From: Cris Di Sclafani Date: Fri, 30 Oct 2020 11:13:40 +0000 (+0100) Subject: Built motion from commit (unavailable).|2.5.4 X-Git-Url: http://repos.xcallymotion.com/base/%22https:/wiki.xcallymotion.com/display/XMV//%22?a=commitdiff_plain;h=c76c5b32b14338fd0ff069bdca74e794b2ae37d2;p=motion2.git Built motion from commit (unavailable).|2.5.4 --- diff --git a/apidoc/api_project.js b/apidoc/api_project.js index deae4cc..90c25bf 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-30T10:30:02.510Z", "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-30T11:05:57.004Z", "url": "http://apidocjs.com", "version": "0.19.0" } }); diff --git a/apidoc/api_project.json b/apidoc/api_project.json index 56de421..0ae0100 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-30T10:30:02.510Z", "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-30T11:05:57.004Z", "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 50d58b6..be87b84 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 _0x8c65=['Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script','integration[AccountId],\x20motionbar[TemplateId,URL,WinAppPath],\x20urlForward[URL]','motionbar[NULL,NULL,WinAppArguments]','TEXT','STRING','contactManager','integration','motionbar','jscripty','urlForward','browser','bot'];(function(_0x2063ac,_0x5dcbf1){var _0x113a8d=function(_0x1b7a82){while(--_0x1b7a82){_0x2063ac['push'](_0x2063ac['shift']());}};_0x113a8d(++_0x5dcbf1);}(_0x8c65,0x94));var _0x58c6=function(_0x238b75,_0x185e8d){_0x238b75=_0x238b75-0x0;var _0x7b0fe4=_0x8c65[_0x238b75];return _0x7b0fe4;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize['VIRTUAL'],'get':function(_0x180683){return this['getDataValue']('action');}},'action':{'type':Sequelize[_0x58c6('0x0')],'allowNull':![],'validate':{'isIn':{'args':[[_0x58c6('0x1'),_0x58c6('0x2'),_0x58c6('0x3'),_0x58c6('0x4'),_0x58c6('0x5'),_0x58c6('0x6'),_0x58c6('0x7'),'script']],'msg':_0x58c6('0x8')}},'comment':_0x58c6('0x8')},'data1':{'type':Sequelize['STRING'](0x1000),'comment':'contactManager[ListId],\x20integration[intName(zendesk)],\x20motionbar[Popup(0),URL(1),WinApp(2)],\x20urlForward[GET,POST],\x20browser[TemplateId(0),URL(1)]'},'data2':{'type':Sequelize['STRING'](0x1000),'comment':_0x58c6('0x9')},'data3':{'type':Sequelize[_0x58c6('0x0')](0x1000),'comment':_0x58c6('0xa')},'data4':{'type':Sequelize[_0x58c6('0x0')](0x1000)},'data5':{'type':Sequelize[_0x58c6('0x0')](0x1000)},'data6':{'type':Sequelize[_0x58c6('0x0')]},'data7':{'type':Sequelize[_0x58c6('0xb')]}}; \ No newline at end of file +var _0x7c2f=['TEXT','exports','VIRTUAL','getDataValue','action','STRING','motionbar','urlForward','bot','script','Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script','contactManager[ListId],\x20integration[intName(zendesk)],\x20motionbar[Popup(0),URL(1),WinApp(2)],\x20urlForward[GET,POST],\x20browser[TemplateId(0),URL(1)]','integration[AccountId],\x20motionbar[TemplateId,URL,WinAppPath],\x20urlForward[URL]','motionbar[NULL,NULL,WinAppArguments]'];(function(_0x4df17c,_0x2d2b61){var _0x4e79b5=function(_0x2134a5){while(--_0x2134a5){_0x4df17c['push'](_0x4df17c['shift']());}};_0x4e79b5(++_0x2d2b61);}(_0x7c2f,0x15f));var _0xf7c2=function(_0x26fdd6,_0x31726a){_0x26fdd6=_0x26fdd6-0x0;var _0x4224e5=_0x7c2f[_0x26fdd6];return _0x4224e5;};'use strict';var Sequelize=require('sequelize');module[_0xf7c2('0x0')]={'name':{'type':Sequelize[_0xf7c2('0x1')],'get':function(_0x522fb2){return this[_0xf7c2('0x2')](_0xf7c2('0x3'));}},'action':{'type':Sequelize[_0xf7c2('0x4')],'allowNull':![],'validate':{'isIn':{'args':[['contactManager','integration',_0xf7c2('0x5'),'jscripty',_0xf7c2('0x6'),'browser',_0xf7c2('0x7'),_0xf7c2('0x8')]],'msg':_0xf7c2('0x9')}},'comment':_0xf7c2('0x9')},'data1':{'type':Sequelize[_0xf7c2('0x4')](0x1000),'comment':_0xf7c2('0xa')},'data2':{'type':Sequelize[_0xf7c2('0x4')](0x1000),'comment':_0xf7c2('0xb')},'data3':{'type':Sequelize['STRING'](0x1000),'comment':_0xf7c2('0xc')},'data4':{'type':Sequelize[_0xf7c2('0x4')](0x1000)},'data5':{'type':Sequelize['STRING'](0x1000)},'data6':{'type':Sequelize[_0xf7c2('0x4')]},'data7':{'type':Sequelize[_0xf7c2('0xd')]}}; \ No newline at end of file diff --git a/server/api/action/action.controller.js b/server/api/action/action.controller.js index 3054bc4..9ef2c6a 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 _0x28a1=['params','then','destroy','catch','html-pdf','eml-format','zip-dir','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','crypto','jsforce','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','count','offset','limit','Content-Range','json','reject','save','error','stack','name','update','body','Action','find'];(function(_0x52ffc8,_0x60f852){var _0x55204a=function(_0x80181c){while(--_0x80181c){_0x52ffc8['push'](_0x52ffc8['shift']());}};_0x55204a(++_0x60f852);}(_0x28a1,0xb4));var _0x128a=function(_0x42bb6d,_0x412255){_0x42bb6d=_0x42bb6d-0x0;var _0x1db89b=_0x28a1[_0x42bb6d];return _0x1db89b;};'use strict';var pdf=require(_0x128a('0x0'));var emlformat=require(_0x128a('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x128a('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x128a('0x3'));var moment=require(_0x128a('0x4'));var BPromise=require(_0x128a('0x5'));var Mustache=require('mustache');var util=require(_0x128a('0x6'));var path=require(_0x128a('0x7'));var sox=require(_0x128a('0x8'));var csv=require(_0x128a('0x9'));var ejs=require(_0x128a('0xa'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0x128a('0xb'));var jsforce=require(_0x128a('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x128a('0xd'));var Papa=require(_0x128a('0xe'));var Redis=require(_0x128a('0xf'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x128a('0x10'));var hardwareService=require(_0x128a('0x11'));var logger=require(_0x128a('0x12'))(_0x128a('0x13'));var utils=require(_0x128a('0x14'));var config=require(_0x128a('0x15'));var db=require(_0x128a('0x16'))['db'];function respondWithStatusCode(_0x300663,_0x4e84ec){_0x4e84ec=_0x4e84ec||0xcc;return function(_0x30a7c0){if(_0x30a7c0){return _0x300663[_0x128a('0x17')](_0x4e84ec);}return _0x300663[_0x128a('0x18')](_0x4e84ec)[_0x128a('0x19')]();};}function respondWithResult(_0x37464d,_0x499123){_0x499123=_0x499123||0xc8;return function(_0x580c48){if(_0x580c48){return _0x37464d[_0x128a('0x18')](_0x499123)['json'](_0x580c48);}};}function respondWithFilteredResult(_0x179c73,_0x34490d){return function(_0x19c838){if(_0x19c838){var _0x275162=_0x19c838[_0x128a('0x1a')],_0x54cfc1=_0x34490d[_0x128a('0x1b')],_0x553657=_0x34490d['offset']+_0x34490d[_0x128a('0x1c')],_0x1a6c4a;if(_0x553657>=_0x275162){_0x553657=_0x275162;_0x1a6c4a=0xc8;}else{_0x1a6c4a=0xce;}_0x179c73['status'](_0x1a6c4a);return _0x179c73['set'](_0x128a('0x1d'),_0x54cfc1+'-'+_0x553657+'/'+_0x275162)[_0x128a('0x1e')](_0x19c838);}return null;};}function patchUpdates(_0x13ff63){return function(_0x7749dc){try{jsonpatch['apply'](_0x7749dc,_0x13ff63,!![]);}catch(_0x2cb406){return BPromise[_0x128a('0x1f')](_0x2cb406);}return _0x7749dc[_0x128a('0x20')]();};}function saveUpdates(_0x6cbaea,_0x46bb68){return function(_0x2c1a6a){if(_0x2c1a6a){return _0x2c1a6a['update'](_0x6cbaea)['then'](function(_0xc8aac7){return _0xc8aac7;});}return null;};}function removeEntity(_0x3393ee,_0x3bbce5){return function(_0x1430d4){if(_0x1430d4){return _0x1430d4['destroy']()['then'](function(){_0x3393ee[_0x128a('0x18')](0xcc)[_0x128a('0x19')]();});}};}function handleEntityNotFound(_0x3b0b42,_0x13c069){return function(_0x24b506){if(!_0x24b506){_0x3b0b42[_0x128a('0x17')](0x194);}return _0x24b506;};}function handleError(_0x53d325,_0x2fa3c6){_0x2fa3c6=_0x2fa3c6||0x1f4;return function(_0x44a247){logger[_0x128a('0x21')](_0x44a247[_0x128a('0x22')]);if(_0x44a247[_0x128a('0x23')]){delete _0x44a247[_0x128a('0x23')];}_0x53d325[_0x128a('0x18')](_0x2fa3c6)['send'](_0x44a247);};}exports[_0x128a('0x24')]=function(_0x303262,_0x38110a){if(_0x303262['body']['id']){delete _0x303262[_0x128a('0x25')]['id'];}return db[_0x128a('0x26')][_0x128a('0x27')]({'where':{'id':_0x303262[_0x128a('0x28')]['id']}})[_0x128a('0x29')](handleEntityNotFound(_0x38110a,null))[_0x128a('0x29')](saveUpdates(_0x303262['body'],null))[_0x128a('0x29')](respondWithResult(_0x38110a,null))['catch'](handleError(_0x38110a,null));};exports[_0x128a('0x2a')]=function(_0x520234,_0x5f1fa5){return db['Action'][_0x128a('0x27')]({'where':{'id':_0x520234['params']['id']}})[_0x128a('0x29')](handleEntityNotFound(_0x5f1fa5,null))[_0x128a('0x29')](removeEntity(_0x5f1fa5,null))[_0x128a('0x2b')](handleError(_0x5f1fa5,null));}; \ No newline at end of file +var _0x872d=['mustache','util','path','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','sendStatus','status','json','count','offset','limit','set','apply','reject','save','then','error','stack','name','send','update','body','Action','find','params','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird'];(function(_0x494965,_0x48ace5){var _0x3e682e=function(_0x463373){while(--_0x463373){_0x494965['push'](_0x494965['shift']());}};_0x3e682e(++_0x48ace5);}(_0x872d,0x17c));var _0xd872=function(_0x4f20b6,_0x178bf4){_0x4f20b6=_0x4f20b6-0x0;var _0x326e51=_0x872d[_0x4f20b6];return _0x326e51;};'use strict';var pdf=require(_0xd872('0x0'));var emlformat=require(_0xd872('0x1'));var rimraf=require(_0xd872('0x2'));var zipdir=require(_0xd872('0x3'));var jsonpatch=require(_0xd872('0x4'));var rp=require('request-promise');var moment=require(_0xd872('0x5'));var BPromise=require(_0xd872('0x6'));var Mustache=require(_0xd872('0x7'));var util=require(_0xd872('0x8'));var path=require(_0xd872('0x9'));var sox=require('sox');var csv=require(_0xd872('0xa'));var ejs=require(_0xd872('0xb'));var fs=require('fs');var _=require(_0xd872('0xc'));var squel=require(_0xd872('0xd'));var crypto=require('crypto');var jsforce=require(_0xd872('0xe'));var deskjs=require(_0xd872('0xf'));var toCsv=require('to-csv');var querystring=require(_0xd872('0x10'));var Papa=require('papaparse');var Redis=require(_0xd872('0x11'));var authService=require(_0xd872('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xd872('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xd872('0x14'))(_0xd872('0x15'));var utils=require('../../config/utils');var config=require(_0xd872('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x196d18,_0x361376){_0x361376=_0x361376||0xcc;return function(_0x3e9b28){if(_0x3e9b28){return _0x196d18[_0xd872('0x17')](_0x361376);}return _0x196d18[_0xd872('0x18')](_0x361376)['end']();};}function respondWithResult(_0x237322,_0x300054){_0x300054=_0x300054||0xc8;return function(_0x60e58c){if(_0x60e58c){return _0x237322[_0xd872('0x18')](_0x300054)[_0xd872('0x19')](_0x60e58c);}};}function respondWithFilteredResult(_0x454190,_0x3d118d){return function(_0x4816b5){if(_0x4816b5){var _0x16160d=_0x4816b5[_0xd872('0x1a')],_0x86b197=_0x3d118d[_0xd872('0x1b')],_0x1d3db9=_0x3d118d[_0xd872('0x1b')]+_0x3d118d[_0xd872('0x1c')],_0x45b6bb;if(_0x1d3db9>=_0x16160d){_0x1d3db9=_0x16160d;_0x45b6bb=0xc8;}else{_0x45b6bb=0xce;}_0x454190['status'](_0x45b6bb);return _0x454190[_0xd872('0x1d')]('Content-Range',_0x86b197+'-'+_0x1d3db9+'/'+_0x16160d)['json'](_0x4816b5);}return null;};}function patchUpdates(_0x1fce4c){return function(_0x36fc0a){try{jsonpatch[_0xd872('0x1e')](_0x36fc0a,_0x1fce4c,!![]);}catch(_0x4cf3){return BPromise[_0xd872('0x1f')](_0x4cf3);}return _0x36fc0a[_0xd872('0x20')]();};}function saveUpdates(_0x9609da,_0x8cbd99){return function(_0x50c479){if(_0x50c479){return _0x50c479['update'](_0x9609da)['then'](function(_0x5a0336){return _0x5a0336;});}return null;};}function removeEntity(_0x17f248,_0x42cbd8){return function(_0x304d38){if(_0x304d38){return _0x304d38['destroy']()[_0xd872('0x21')](function(){_0x17f248['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x399cfc,_0x2e504b){return function(_0x517bcb){if(!_0x517bcb){_0x399cfc[_0xd872('0x17')](0x194);}return _0x517bcb;};}function handleError(_0x2ed656,_0x19f4ef){_0x19f4ef=_0x19f4ef||0x1f4;return function(_0x21f109){logger[_0xd872('0x22')](_0x21f109[_0xd872('0x23')]);if(_0x21f109['name']){delete _0x21f109[_0xd872('0x24')];}_0x2ed656[_0xd872('0x18')](_0x19f4ef)[_0xd872('0x25')](_0x21f109);};}exports[_0xd872('0x26')]=function(_0x1dd82d,_0x4db204){if(_0x1dd82d[_0xd872('0x27')]['id']){delete _0x1dd82d[_0xd872('0x27')]['id'];}return db[_0xd872('0x28')][_0xd872('0x29')]({'where':{'id':_0x1dd82d['params']['id']}})[_0xd872('0x21')](handleEntityNotFound(_0x4db204,null))['then'](saveUpdates(_0x1dd82d[_0xd872('0x27')],null))['then'](respondWithResult(_0x4db204,null))['catch'](handleError(_0x4db204,null));};exports['destroy']=function(_0x528ac0,_0x3d60c3){return db[_0xd872('0x28')][_0xd872('0x29')]({'where':{'id':_0x528ac0[_0xd872('0x2a')]['id']}})[_0xd872('0x21')](handleEntityNotFound(_0x3d60c3,null))[_0xd872('0x21')](removeEntity(_0x3d60c3,null))['catch'](handleError(_0x3d60c3,null));}; \ No newline at end of file diff --git a/server/api/action/action.model.js b/server/api/action/action.model.js index 5968d1e..09350ad 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 _0xacfb=['moment','bluebird','request-promise','path','../../config/environment','./action.attributes','exports','lodash','api'];(function(_0x4afaaa,_0x28b654){var _0x350930=function(_0xe096c8){while(--_0xe096c8){_0x4afaaa['push'](_0x4afaaa['shift']());}};_0x350930(++_0x28b654);}(_0xacfb,0xc4));var _0xbacf=function(_0x530b51,_0x2778e4){_0x530b51=_0x530b51-0x0;var _0x257be7=_0xacfb[_0x530b51];return _0x257be7;};'use strict';var _=require(_0xbacf('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xbacf('0x1'));var moment=require(_0xbacf('0x2'));var BPromise=require(_0xbacf('0x3'));var rp=require(_0xbacf('0x4'));var fs=require('fs');var path=require(_0xbacf('0x5'));var rimraf=require('rimraf');var config=require(_0xbacf('0x6'));var attributes=require(_0xbacf('0x7'));module[_0xbacf('0x8')]=function(_0x295609,_0x8aa887){return _0x295609['define']('Action',attributes,{'tableName':'tools_actions','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xcd1a=['moment','request-promise','rimraf','../../config/environment','./action.attributes','exports','Action','tools_actions','lodash','../../config/logger','api'];(function(_0x5617e2,_0x1ffcd7){var _0x27b60d=function(_0xf3f7a2){while(--_0xf3f7a2){_0x5617e2['push'](_0x5617e2['shift']());}};_0x27b60d(++_0x1ffcd7);}(_0xcd1a,0x76));var _0xacd1=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0xcd1a[_0x57b54c];return _0x59cc19;};'use strict';var _=require(_0xacd1('0x0'));var util=require('util');var logger=require(_0xacd1('0x1'))(_0xacd1('0x2'));var moment=require(_0xacd1('0x3'));var BPromise=require('bluebird');var rp=require(_0xacd1('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xacd1('0x5'));var config=require(_0xacd1('0x6'));var attributes=require(_0xacd1('0x7'));module[_0xacd1('0x8')]=function(_0x54fd3,_0xc622fd){return _0x54fd3['define'](_0xacd1('0x9'),attributes,{'tableName':_0xacd1('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/action/action.rpc.js b/server/api/action/action.rpc.js index 8c729bd..5cc8c0c 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 _0x70e0=['code','Action,\x20%s,\x20%s','message','result','catch','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','request','then','info','debug','Action,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error'];(function(_0x5df8e7,_0x63aeb7){var _0x3d5ec9=function(_0x15b032){while(--_0x15b032){_0x5df8e7['push'](_0x5df8e7['shift']());}};_0x3d5ec9(++_0x63aeb7);}(_0x70e0,0x17b));var _0x070e=function(_0x557496,_0x29b6cd){_0x557496=_0x557496-0x0;var _0x31a63a=_0x70e0[_0x557496];return _0x31a63a;};'use strict';var _=require(_0x070e('0x0'));var util=require(_0x070e('0x1'));var moment=require(_0x070e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x070e('0x3'));var db=require(_0x070e('0x4'))['db'];var utils=require(_0x070e('0x5'));var logger=require(_0x070e('0x6'))('rpc');var config=require(_0x070e('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x070e('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x56e420,_0x5032e5,_0x35ab0c){return new BPromise(function(_0x1e11f0,_0x604664){return client[_0x070e('0x9')](_0x56e420,_0x35ab0c)[_0x070e('0xa')](function(_0x68a09e){logger[_0x070e('0xb')]('Action,\x20%s,\x20%s',_0x5032e5,'request\x20sent');logger[_0x070e('0xc')](_0x070e('0xd'),_0x5032e5,_0x070e('0xe'),JSON[_0x070e('0xf')](_0x68a09e));if(_0x68a09e[_0x070e('0x10')]){if(_0x68a09e[_0x070e('0x10')][_0x070e('0x11')]===0x1f4){logger[_0x070e('0x10')](_0x070e('0x12'),_0x5032e5,_0x68a09e[_0x070e('0x10')][_0x070e('0x13')]);return _0x604664(_0x68a09e['error']['message']);}logger[_0x070e('0x10')]('Action,\x20%s,\x20%s',_0x5032e5,_0x68a09e['error']['message']);return _0x1e11f0(_0x68a09e[_0x070e('0x10')][_0x070e('0x13')]);}else{logger['info']('Action,\x20%s,\x20%s',_0x5032e5,_0x070e('0xe'));_0x1e11f0(_0x68a09e[_0x070e('0x14')][_0x070e('0x13')]);}})[_0x070e('0x15')](function(_0x5bc71e){logger['error'](_0x070e('0x12'),_0x5032e5,_0x5bc71e);_0x604664(_0x5bc71e);});});} \ No newline at end of file +var _0xb7e7=['Action,\x20%s,\x20%s','debug','Action,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','lodash','moment','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','http','request','then','info'];(function(_0x3f5927,_0x23d04b){var _0x33b391=function(_0x3e2907){while(--_0x3e2907){_0x3f5927['push'](_0x3f5927['shift']());}};_0x33b391(++_0x23d04b);}(_0xb7e7,0x121));var _0x7b7e=function(_0x432fca,_0xb0b1b5){_0x432fca=_0x432fca-0x0;var _0x3adba4=_0xb7e7[_0x432fca];return _0x3adba4;};'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')]('Action,\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);});});} \ No newline at end of file diff --git a/server/api/action/index.js b/server/api/action/index.js index 22c9d74..f88058f 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 _0x01f1=['../../config/environment','put','/:id','isAuthenticated','delete','destroy','exports','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service'];(function(_0x2154e2,_0x3eb2a2){var _0x39a490=function(_0x3a4a09){while(--_0x3a4a09){_0x2154e2['push'](_0x2154e2['shift']());}};_0x39a490(++_0x3eb2a2);}(_0x01f1,0xcb));var _0x101f=function(_0x4abab9,_0xde21a4){_0x4abab9=_0x4abab9-0x0;var _0x374eba=_0x01f1[_0x4abab9];return _0x374eba;};'use strict';var multer=require(_0x101f('0x0'));var util=require(_0x101f('0x1'));var path=require(_0x101f('0x2'));var timeout=require(_0x101f('0x3'));var express=require(_0x101f('0x4'));var router=express['Router']();var auth=require(_0x101f('0x5'));var interaction=require(_0x101f('0x6'));var config=require(_0x101f('0x7'));var controller=require('./action.controller');router[_0x101f('0x8')](_0x101f('0x9'),auth[_0x101f('0xa')](),controller['update']);router[_0x101f('0xb')](_0x101f('0x9'),auth['isAuthenticated'](),controller[_0x101f('0xc')]);module[_0x101f('0xd')]=router; \ No newline at end of file +var _0xd686=['destroy','exports','util','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./action.controller','/:id','update','delete','isAuthenticated'];(function(_0x5f59b9,_0x6aa001){var _0x3d6991=function(_0xc5b398){while(--_0xc5b398){_0x5f59b9['push'](_0x5f59b9['shift']());}};_0x3d6991(++_0x6aa001);}(_0xd686,0x92));var _0x6d68=function(_0x5cb1af,_0x4bdc8c){_0x5cb1af=_0x5cb1af-0x0;var _0x8d7940=_0xd686[_0x5cb1af];return _0x8d7940;};'use strict';var multer=require('multer');var util=require(_0x6d68('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x6d68('0x1')]();var auth=require(_0x6d68('0x2'));var interaction=require(_0x6d68('0x3'));var config=require(_0x6d68('0x4'));var controller=require(_0x6d68('0x5'));router['put'](_0x6d68('0x6'),auth['isAuthenticated'](),controller[_0x6d68('0x7')]);router[_0x6d68('0x8')](_0x6d68('0x6'),auth[_0x6d68('0x9')](),controller[_0x6d68('0xa')]);module[_0x6d68('0xb')]=router; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.attributes.js b/server/api/analyticCustomReport/analyticCustomReport.attributes.js index 1697041..c59978f 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 _0xb8c5=['STRING','TEXT','sequelize','exports'];(function(_0x107fd5,_0x44f2e6){var _0xdad8fb=function(_0x3d2eb5){while(--_0x3d2eb5){_0x107fd5['push'](_0x107fd5['shift']());}};_0xdad8fb(++_0x44f2e6);}(_0xb8c5,0x112));var _0x5b8c=function(_0x4f33ff,_0x4cc52d){_0x4f33ff=_0x4f33ff-0x0;var _0x40e19c=_0xb8c5[_0x4f33ff];return _0x40e19c;};'use strict';var Sequelize=require(_0x5b8c('0x0'));module[_0x5b8c('0x1')]={'name':{'type':Sequelize[_0x5b8c('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0x5b8c('0x2')]},'parent':{'type':Sequelize[_0x5b8c('0x2')]},'table':{'type':Sequelize['STRING']},'conditions':{'type':Sequelize['TEXT']},'joins':{'type':Sequelize[_0x5b8c('0x3')]}}; \ No newline at end of file +var _0x7f0e=['TEXT','sequelize','STRING'];(function(_0x2258fd,_0x57b189){var _0x1295ab=function(_0x27be15){while(--_0x27be15){_0x2258fd['push'](_0x2258fd['shift']());}};_0x1295ab(++_0x57b189);}(_0x7f0e,0x85));var _0xe7f0=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x7f0e[_0x1facfa];return _0x9ec701;};'use strict';var Sequelize=require(_0xe7f0('0x0'));module['exports']={'name':{'type':Sequelize[_0xe7f0('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0xe7f0('0x1')]},'parent':{'type':Sequelize[_0xe7f0('0x1')]},'table':{'type':Sequelize[_0xe7f0('0x1')]},'conditions':{'type':Sequelize[_0xe7f0('0x2')]},'joins':{'type':Sequelize[_0xe7f0('0x2')]}}; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.controller.js b/server/api/analyticCustomReport/analyticCustomReport.controller.js index 281e392..b0b527f 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 _0x4403=['from','table','MetricId','metric','function','replace','format','groupBy','orderBy','DESC','alias','joins','parse','foreignTable','foreignKey','%s.%s\x20=\x20%s.%s','parentKey','conditions','clone','debug','Limited\x20Query:','toString','sequelize','QueryTypes','right_join','COUNT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','DATE(%s)','IS\x20NULL','operator','condition','value','SELECT','output','web','fullPath','%s-%s.%s','randomstring','generate','csv','custom','cdr','.calldate\x20BETWEEN\x20?\x20AND\x20?','startDate','endDate','info','Run\x20Query:','../../components/export/','../../files/reports','savename','countTable','COUNT(*)','runReport','zip-dir','request-promise','moment','bluebird','mustache','path','ejs','lodash','squel','jsforce','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','dbH','sendStatus','status','end','json','count','offset','limit','set','apply','reject','save','update','then','get','CustomReports','destroy','error','stack','name','send','index','fieldName','model','map','keys','intersection','attributes','query','length','hasOwnProperty','order','sort','where','filters','type','VIRTUAL','filter','merge','AnalyticCustomReport','include','findAll','rows','catch','show','rawAttributes','fields','includeAll','options','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Reports','UserProfileSection','find','userProfileId','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','preview','join','left_join','cross_join','SUM(%s)','COUNT(DISTINCT\x20%s)','MAX(%s)','MIN(%s)','AVG(%s)','GROUP_CONCAT(%s)','SEC_TO_TIME(%s)','HOUR(%s)','ROUND(%s)','UNIX_TIMESTAMP(%s)','includes','IS\x20NOT\x20NULL','IS\x20EMPTY','IS\x20NOT\x20EMPTY','rules','group','field','getFields','Sequelize','ValidationErrorItem','AnalyticMetric','keyBy','select'];(function(_0x5d70f9,_0x281d2c){var _0x133a6c=function(_0x46d9af){while(--_0x46d9af){_0x5d70f9['push'](_0x5d70f9['shift']());}};_0x133a6c(++_0x281d2c);}(_0x4403,0x179));var _0x3440=function(_0x35b08a,_0xd824d1){_0x35b08a=_0x35b08a-0x0;var _0x20bc1a=_0x4403[_0x35b08a];return _0x20bc1a;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x3440('0x0'));var jsonpatch=require('fast-json-patch');var rp=require(_0x3440('0x1'));var moment=require(_0x3440('0x2'));var BPromise=require(_0x3440('0x3'));var Mustache=require(_0x3440('0x4'));var util=require('util');var path=require(_0x3440('0x5'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x3440('0x6'));var fs=require('fs');var _=require(_0x3440('0x7'));var squel=require(_0x3440('0x8'));var crypto=require('crypto');var jsforce=require(_0x3440('0x9'));var deskjs=require('desk.js');var toCsv=require(_0x3440('0xa'));var querystring=require(_0x3440('0xb'));var Papa=require(_0x3440('0xc'));var Redis=require('ioredis');var authService=require(_0x3440('0xd'));var qs=require(_0x3440('0xe'));var as=require(_0x3440('0xf'));var hardwareService=require(_0x3440('0x10'));var logger=require(_0x3440('0x11'))(_0x3440('0x12'));var utils=require(_0x3440('0x13'));var config=require('../../config/environment');var db=require(_0x3440('0x14'))['db'];var dbH=require(_0x3440('0x14'))[_0x3440('0x15')];function respondWithStatusCode(_0x4f541e,_0x270f4a){_0x270f4a=_0x270f4a||0xcc;return function(_0xb24e14){if(_0xb24e14){return _0x4f541e[_0x3440('0x16')](_0x270f4a);}return _0x4f541e[_0x3440('0x17')](_0x270f4a)[_0x3440('0x18')]();};}function respondWithResult(_0x5201e6,_0x36dd82){_0x36dd82=_0x36dd82||0xc8;return function(_0x55eac4){if(_0x55eac4){return _0x5201e6[_0x3440('0x17')](_0x36dd82)[_0x3440('0x19')](_0x55eac4);}};}function respondWithFilteredResult(_0x33a5bb,_0x18871d){return function(_0x11930d){if(_0x11930d){var _0x1193f7=_0x11930d[_0x3440('0x1a')],_0x131eea=_0x18871d[_0x3440('0x1b')],_0xb66a69=_0x18871d[_0x3440('0x1b')]+_0x18871d[_0x3440('0x1c')],_0x5a5d2a;if(_0xb66a69>=_0x1193f7){_0xb66a69=_0x1193f7;_0x5a5d2a=0xc8;}else{_0x5a5d2a=0xce;}_0x33a5bb[_0x3440('0x17')](_0x5a5d2a);return _0x33a5bb[_0x3440('0x1d')]('Content-Range',_0x131eea+'-'+_0xb66a69+'/'+_0x1193f7)[_0x3440('0x19')](_0x11930d);}return null;};}function patchUpdates(_0x268086){return function(_0x2e692b){try{jsonpatch[_0x3440('0x1e')](_0x2e692b,_0x268086,!![]);}catch(_0x10982f){return BPromise[_0x3440('0x1f')](_0x10982f);}return _0x2e692b[_0x3440('0x20')]();};}function saveUpdates(_0x36f851,_0x25afeb){return function(_0xd34993){if(_0xd34993){return _0xd34993[_0x3440('0x21')](_0x36f851)['then'](function(_0x485350){return _0x485350;});}return null;};}function removeEntity(_0x5f4386,_0x2c8e7c){return function(_0x45afde){if(_0x45afde){return _0x45afde['destroy']()[_0x3440('0x22')](function(){var _0x232b8f=_0x45afde[_0x3440('0x23')]({'plain':!![]});var _0x38bf02=_0x3440('0x24');return db['UserProfileResource'][_0x3440('0x25')]({'where':{'type':_0x38bf02,'resourceId':_0x232b8f['id']}})[_0x3440('0x22')](function(){return _0x45afde;});})[_0x3440('0x22')](function(){_0x5f4386[_0x3440('0x17')](0xcc)[_0x3440('0x18')]();});}};}function handleEntityNotFound(_0x58c03a,_0x381942){return function(_0x2e93c){if(!_0x2e93c){_0x58c03a[_0x3440('0x16')](0x194);}return _0x2e93c;};}function handleError(_0x251646,_0x21ed0c){_0x21ed0c=_0x21ed0c||0x1f4;return function(_0x5bb009){logger[_0x3440('0x26')](_0x5bb009[_0x3440('0x27')]);if(_0x5bb009[_0x3440('0x28')]){delete _0x5bb009[_0x3440('0x28')];}_0x251646[_0x3440('0x17')](_0x21ed0c)[_0x3440('0x29')](_0x5bb009);};}exports[_0x3440('0x2a')]=function(_0x1f7fee,_0xc2167c){var _0xf38d1={},_0x2f2bdb={},_0x581315={'count':0x0,'rows':[]};var _0x5d6b82=_['map'](db['AnalyticCustomReport']['rawAttributes'],function(_0x4ab2ef){return{'name':_0x4ab2ef[_0x3440('0x2b')],'type':_0x4ab2ef['type']['key']};});_0x2f2bdb[_0x3440('0x2c')]=_[_0x3440('0x2d')](_0x5d6b82,_0x3440('0x28'));_0x2f2bdb['query']=_[_0x3440('0x2e')](_0x1f7fee['query']);_0x2f2bdb['filters']=_[_0x3440('0x2f')](_0x2f2bdb['model'],_0x2f2bdb['query']);_0xf38d1[_0x3440('0x30')]=_['intersection'](_0x2f2bdb[_0x3440('0x2c')],qs['fields'](_0x1f7fee[_0x3440('0x31')]['fields']));_0xf38d1[_0x3440('0x30')]=_0xf38d1['attributes'][_0x3440('0x32')]?_0xf38d1[_0x3440('0x30')]:_0x2f2bdb[_0x3440('0x2c')];if(!_0x1f7fee[_0x3440('0x31')][_0x3440('0x33')]('nolimit')){_0xf38d1[_0x3440('0x1c')]=qs[_0x3440('0x1c')](_0x1f7fee[_0x3440('0x31')][_0x3440('0x1c')]);_0xf38d1['offset']=qs[_0x3440('0x1b')](_0x1f7fee[_0x3440('0x31')]['offset']);}_0xf38d1[_0x3440('0x34')]=qs[_0x3440('0x35')](_0x1f7fee[_0x3440('0x31')][_0x3440('0x35')]);_0xf38d1[_0x3440('0x36')]=qs[_0x3440('0x37')](_['pick'](_0x1f7fee[_0x3440('0x31')],_0x2f2bdb[_0x3440('0x37')]),_0x5d6b82);if(_0x1f7fee[_0x3440('0x31')]['filter']){_0xf38d1['where']=_['merge'](_0xf38d1['where'],{'$or':_[_0x3440('0x2d')](_0x5d6b82,function(_0x1eae46){if(_0x1eae46[_0x3440('0x38')]!==_0x3440('0x39')){var _0x67bfe7={};_0x67bfe7[_0x1eae46['name']]={'$like':'%'+_0x1f7fee[_0x3440('0x31')][_0x3440('0x3a')]+'%'};return _0x67bfe7;}})});}_0xf38d1=_[_0x3440('0x3b')]({},_0xf38d1,_0x1f7fee['options']);var _0x4d7204={'where':_0xf38d1['where']};return db[_0x3440('0x3c')][_0x3440('0x1a')](_0x4d7204)[_0x3440('0x22')](function(_0x1e9c62){_0x581315[_0x3440('0x1a')]=_0x1e9c62;if(_0x1f7fee[_0x3440('0x31')]['includeAll']){_0xf38d1[_0x3440('0x3d')]=[{'all':!![]}];}return db[_0x3440('0x3c')][_0x3440('0x3e')](_0xf38d1);})['then'](function(_0x134b76){_0x581315[_0x3440('0x3f')]=_0x134b76;return _0x581315;})[_0x3440('0x22')](respondWithFilteredResult(_0xc2167c,_0xf38d1))[_0x3440('0x40')](handleError(_0xc2167c,null));};exports[_0x3440('0x41')]=function(_0x151ece,_0x54ceff){var _0x40ebe1={'raw':![],'where':{'id':_0x151ece['params']['id']}},_0x2ffa59={};_0x2ffa59[_0x3440('0x2c')]=_[_0x3440('0x2e')](db[_0x3440('0x3c')][_0x3440('0x42')]);_0x2ffa59[_0x3440('0x31')]=_[_0x3440('0x2e')](_0x151ece[_0x3440('0x31')]);_0x2ffa59[_0x3440('0x37')]=_[_0x3440('0x2f')](_0x2ffa59[_0x3440('0x2c')],_0x2ffa59[_0x3440('0x31')]);_0x40ebe1['attributes']=_[_0x3440('0x2f')](_0x2ffa59['model'],qs[_0x3440('0x43')](_0x151ece[_0x3440('0x31')]['fields']));_0x40ebe1[_0x3440('0x30')]=_0x40ebe1[_0x3440('0x30')][_0x3440('0x32')]?_0x40ebe1[_0x3440('0x30')]:_0x2ffa59[_0x3440('0x2c')];if(_0x151ece[_0x3440('0x31')][_0x3440('0x44')]){_0x40ebe1[_0x3440('0x3d')]=[{'all':!![]}];}_0x40ebe1=_[_0x3440('0x3b')]({},_0x40ebe1,_0x151ece[_0x3440('0x45')]);return db[_0x3440('0x3c')]['find'](_0x40ebe1)[_0x3440('0x22')](handleEntityNotFound(_0x54ceff,null))[_0x3440('0x22')](respondWithResult(_0x54ceff,null))['catch'](handleError(_0x54ceff,null));};exports[_0x3440('0x46')]=function(_0x98540c,_0xe76afe){return db[_0x3440('0x3c')][_0x3440('0x46')](_0x98540c[_0x3440('0x47')],{})[_0x3440('0x22')](function(_0x4a00e0){var _0x56d37b=_0x98540c[_0x3440('0x48')][_0x3440('0x23')]({'plain':!![]});if(!_0x56d37b)throw new Error(_0x3440('0x49'));if(_0x56d37b[_0x3440('0x4a')]===_0x3440('0x48')){var _0x36fd4d=_0x4a00e0[_0x3440('0x23')]({'plain':!![]});var _0x265e54=_0x3440('0x4b');return db[_0x3440('0x4c')][_0x3440('0x4d')]({'where':{'name':_0x265e54,'userProfileId':_0x56d37b[_0x3440('0x4e')]},'raw':!![]})[_0x3440('0x22')](function(_0x485490){if(_0x485490&&_0x485490['autoAssociation']===0x0){return db[_0x3440('0x4f')][_0x3440('0x46')]({'name':_0x36fd4d[_0x3440('0x28')],'resourceId':_0x36fd4d['id'],'type':_0x3440('0x24'),'sectionId':_0x485490['id']},{})[_0x3440('0x22')](function(){return _0x4a00e0;});}else{return _0x4a00e0;}})['catch'](function(_0x349f26){logger['error'](_0x3440('0x50'),_0x349f26);throw _0x349f26;});}return _0x4a00e0;})['then'](respondWithResult(_0xe76afe,0xc9))[_0x3440('0x40')](handleError(_0xe76afe,null));};exports['update']=function(_0x3acd64,_0x59f4f9){if(_0x3acd64[_0x3440('0x47')]['id']){delete _0x3acd64[_0x3440('0x47')]['id'];}return db[_0x3440('0x3c')][_0x3440('0x4d')]({'where':{'id':_0x3acd64[_0x3440('0x51')]['id']}})['then'](handleEntityNotFound(_0x59f4f9,null))[_0x3440('0x22')](saveUpdates(_0x3acd64[_0x3440('0x47')],null))[_0x3440('0x22')](respondWithResult(_0x59f4f9,null))[_0x3440('0x40')](handleError(_0x59f4f9,null));};exports[_0x3440('0x25')]=function(_0x224e82,_0x1e1b17){return db[_0x3440('0x3c')][_0x3440('0x4d')]({'where':{'id':_0x224e82['params']['id']}})[_0x3440('0x22')](handleEntityNotFound(_0x1e1b17,null))[_0x3440('0x22')](removeEntity(_0x1e1b17,null))[_0x3440('0x40')](handleError(_0x1e1b17,null));};exports[_0x3440('0x52')]=function(_0x57fb43,_0x3576ab){var _0x40016c=0xa;var _0x55a132=[_0x3440('0x53'),_0x3440('0x54'),'right_join',_0x3440('0x55')];var _0x302ced={'SUM':_0x3440('0x56'),'COUNT':'COUNT(%s)','COUNT DISTINCT':_0x3440('0x57'),'MAX':_0x3440('0x58'),'MIN':_0x3440('0x59'),'AVG':_0x3440('0x5a'),'GROUP_CONCAT':_0x3440('0x5b'),'GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x353d94={'SEC_TO_TIME':_0x3440('0x5c'),'DATE':'DATE(%s)','HOUR':_0x3440('0x5d'),'ROUND':_0x3440('0x5e'),'UNIX_TIMESTAMP':_0x3440('0x5f')};var _0x57197c=function(_0x35ee73){return!_[_0x3440('0x60')](['IS\x20NULL',_0x3440('0x61'),_0x3440('0x62'),_0x3440('0x63')],_0x35ee73);};var _0x1accbe=function(_0x262719){if(!_0x262719||!_0x262719[_0x3440('0x64')]['length']){return'';}for(var _0x21010c='(',_0x5e5f80=0x0;_0x5e5f80<_0x262719[_0x3440('0x64')]['length'];_0x5e5f80+=0x1){_0x5e5f80>0x0&&(_0x21010c+='\x20'+_0x262719['operator']+'\x20');_0x21010c+=_0x262719[_0x3440('0x64')][_0x5e5f80][_0x3440('0x65')]?_0x1accbe(_0x262719[_0x3440('0x64')][_0x5e5f80]['group']):_0x262719[_0x3440('0x64')][_0x5e5f80][_0x3440('0x66')]+'\x20'+_0x262719[_0x3440('0x64')][_0x5e5f80]['condition']+(_0x57197c(_0x262719[_0x3440('0x64')][_0x5e5f80]['condition'])?'\x20'+_0x262719[_0x3440('0x64')][_0x5e5f80]['value']:'');}return _0x21010c+')';};var _0x51c746={'where':{'id':_0x57fb43[_0x3440('0x51')]['id']}},_0x37c158,_0xa2f09e,_0x4854f5,_0x49069d,_0x2f4c4d;_0x51c746=_['merge']({},_0x51c746,_0x57fb43['options']);return db[_0x3440('0x3c')]['find'](_0x51c746)[_0x3440('0x22')](function(_0x47867b){if(_0x47867b){_0x37c158=_0x47867b;return _0x47867b[_0x3440('0x67')]();}return null;})[_0x3440('0x22')](function(_0x5c4b11){if(_0x5c4b11){if(!_0x5c4b11['length']){throw new db[(_0x3440('0x68'))][(_0x3440('0x69'))]('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0xa2f09e=_0x5c4b11;return db[_0x3440('0x6a')][_0x3440('0x3e')]({'raw':!![]});}return null;})['then'](function(_0x1afdfe){if(_0x1afdfe){_0x4854f5=_[_0x3440('0x6b')](_0x1afdfe,'id');var _0x1344b2;var _0x4213e6=squel[_0x3440('0x6c')]();_0x4213e6[_0x3440('0x6d')](_0x37c158[_0x3440('0x6e')]);for(var _0x1772f8=0x0;_0x1772f8<_0xa2f09e['length'];_0x1772f8+=0x1){_0x1344b2=_0xa2f09e[_0x1772f8]['MetricId']?_0x4854f5[_0xa2f09e[_0x1772f8][_0x3440('0x6f')]][_0x3440('0x70')]:_0xa2f09e[_0x1772f8][_0x3440('0x66')];_0x1344b2=_0xa2f09e[_0x1772f8][_0x3440('0x71')]?_[_0x3440('0x72')](_0x302ced[_0xa2f09e[_0x1772f8]['function']],'%s',_0x1344b2):_0x1344b2;_0x1344b2=_0xa2f09e[_0x1772f8][_0x3440('0x73')]?_[_0x3440('0x72')](_0x353d94[_0xa2f09e[_0x1772f8][_0x3440('0x73')]],'%s',_0x1344b2):_0x1344b2;if(_0xa2f09e[_0x1772f8][_0x3440('0x74')]){_0x4213e6['group'](_0x1344b2);}_0xa2f09e[_0x1772f8][_0x3440('0x75')]&&_0x4213e6[_0x3440('0x34')](_0x1344b2,_0xa2f09e[_0x1772f8]['orderBy']===_0x3440('0x76')?![]:!![]);_0x4213e6[_0x3440('0x66')](_0x1344b2,_0xa2f09e[_0x1772f8][_0x3440('0x77')]||_0x1344b2);}if(_0x37c158['joins']){_0x37c158[_0x3440('0x78')]=JSON[_0x3440('0x79')](_0x37c158[_0x3440('0x78')]);for(var _0x46d0ba=0x0;_0x46d0ba<_0x37c158[_0x3440('0x78')][_0x3440('0x32')];_0x46d0ba+=0x1){if(_0x37c158[_0x3440('0x78')][_0x46d0ba][_0x3440('0x38')]&&_[_0x3440('0x60')](_0x55a132,_0x37c158[_0x3440('0x78')][_0x46d0ba][_0x3440('0x38')])&&_0x37c158['joins'][_0x46d0ba]['parentKey']&&_0x37c158[_0x3440('0x78')][_0x46d0ba][_0x3440('0x7a')]&&_0x37c158[_0x3440('0x78')][_0x46d0ba][_0x3440('0x7b')]){_0x4213e6[_0x37c158['joins'][_0x46d0ba]['type']](_0x37c158[_0x3440('0x78')][_0x46d0ba][_0x3440('0x7a')],null,util[_0x3440('0x73')](_0x3440('0x7c'),_0x37c158[_0x3440('0x6e')],_0x37c158[_0x3440('0x78')][_0x46d0ba][_0x3440('0x7d')],_0x37c158[_0x3440('0x78')][_0x46d0ba]['foreignTable'],_0x37c158[_0x3440('0x78')][_0x46d0ba][_0x3440('0x7b')]));}}}if(_0x37c158['conditions']){_0x37c158[_0x3440('0x7e')]=JSON[_0x3440('0x79')](_0x37c158['conditions']);_0x4213e6[_0x3440('0x36')](_0x1accbe(_0x37c158['conditions'][_0x3440('0x65')]));}_0x2f4c4d=_0x4213e6[_0x3440('0x7f')]();_0x4213e6[_0x3440('0x1c')](_0x40016c);_0x4213e6['offset'](0x0);logger[_0x3440('0x80')](_0x3440('0x81'),_0x4213e6[_0x3440('0x82')]());return db[_0x3440('0x83')][_0x3440('0x31')](_0x4213e6[_0x3440('0x82')](),{'type':db[_0x3440('0x83')][_0x3440('0x84')]['SELECT']});}})[_0x3440('0x22')](respondWithResult(_0x3576ab,null))[_0x3440('0x40')](handleError(_0x3576ab,null));};function runReport(_0x463641,_0x2f7ee5,_0x11af84){var _0x5352c8=_0x2f7ee5['name'];var _0x1c1b21=0xa;var _0x357c33=['join',_0x3440('0x54'),_0x3440('0x85'),_0x3440('0x55')];var _0x1a7ae3={'SUM':_0x3440('0x56'),'COUNT':_0x3440('0x86'),'COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':'MAX(%s)','MIN':_0x3440('0x59'),'AVG':'AVG(%s)','GROUP_CONCAT':_0x3440('0x5b'),'GROUP_CONCAT ASC':_0x3440('0x87'),'GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x51f6fa={'SEC_TO_TIME':_0x3440('0x5c'),'DATE':_0x3440('0x88'),'HOUR':_0x3440('0x5d'),'ROUND':'ROUND(%s)','UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x5d9281=function(_0x1e7186){return!_[_0x3440('0x60')]([_0x3440('0x89'),_0x3440('0x61'),_0x3440('0x62'),'IS\x20NOT\x20EMPTY'],_0x1e7186);};var _0x3664d9=function(_0x391a10){if(!_0x391a10||!_0x391a10[_0x3440('0x64')][_0x3440('0x32')]){return'';}for(var _0x2119d6='(',_0x10e939=0x0;_0x10e939<_0x391a10[_0x3440('0x64')][_0x3440('0x32')];_0x10e939+=0x1){_0x10e939>0x0&&(_0x2119d6+='\x20'+_0x391a10[_0x3440('0x8a')]+'\x20');_0x2119d6+=_0x391a10['rules'][_0x10e939][_0x3440('0x65')]?_0x3664d9(_0x391a10['rules'][_0x10e939][_0x3440('0x65')]):_0x391a10[_0x3440('0x64')][_0x10e939][_0x3440('0x66')]+'\x20'+_0x391a10['rules'][_0x10e939]['condition']+(_0x5d9281(_0x391a10[_0x3440('0x64')][_0x10e939][_0x3440('0x8b')])?'\x20'+_0x391a10[_0x3440('0x64')][_0x10e939][_0x3440('0x8c')]:'');}return _0x2119d6+')';};var _0x37d730={'where':{'id':_0x463641['id']}},_0x1a2735,_0x31ca5d,_0x18e3cd,_0x2a5537,_0x25af24;_0x37d730=_[_0x3440('0x3b')]({},_0x37d730,_0x11af84);return db[_0x3440('0x3c')]['find'](_0x37d730)['then'](function(_0x4c1bcf){if(_0x4c1bcf){_0x1a2735=_0x4c1bcf;return _0x4c1bcf[_0x3440('0x67')]();}return null;})[_0x3440('0x22')](function(_0x5a2b2d){if(_0x5a2b2d){if(!_0x5a2b2d[_0x3440('0x32')]){throw new db[(_0x3440('0x68'))]['ValidationErrorItem']('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x31ca5d=_0x5a2b2d;return db[_0x3440('0x6a')][_0x3440('0x3e')]({'raw':!![]});}return null;})[_0x3440('0x22')](function(_0x2cb3e6){if(_0x2cb3e6){_0x18e3cd=_[_0x3440('0x6b')](_0x2cb3e6,'id');var _0x2f7514;var _0x597d85=squel['select']();_0x597d85['from'](_0x1a2735['table']);for(var _0x3a38dc=0x0;_0x3a38dc<_0x31ca5d[_0x3440('0x32')];_0x3a38dc+=0x1){_0x2f7514=_0x31ca5d[_0x3a38dc][_0x3440('0x6f')]?_0x18e3cd[_0x31ca5d[_0x3a38dc][_0x3440('0x6f')]][_0x3440('0x70')]:_0x31ca5d[_0x3a38dc][_0x3440('0x66')];_0x2f7514=_0x31ca5d[_0x3a38dc]['function']?_['replace'](_0x1a7ae3[_0x31ca5d[_0x3a38dc]['function']],'%s',_0x2f7514):_0x2f7514;_0x2f7514=_0x31ca5d[_0x3a38dc][_0x3440('0x73')]?_['replace'](_0x51f6fa[_0x31ca5d[_0x3a38dc][_0x3440('0x73')]],'%s',_0x2f7514):_0x2f7514;if(_0x31ca5d[_0x3a38dc][_0x3440('0x74')]){_0x597d85[_0x3440('0x65')](_0x2f7514);}_0x31ca5d[_0x3a38dc][_0x3440('0x75')]&&_0x597d85[_0x3440('0x34')](_0x2f7514,_0x31ca5d[_0x3a38dc][_0x3440('0x75')]===_0x3440('0x76')?![]:!![]);_0x597d85[_0x3440('0x66')](_0x2f7514,_0x31ca5d[_0x3a38dc][_0x3440('0x77')]||_0x2f7514);}if(_0x1a2735['joins']){_0x1a2735[_0x3440('0x78')]=JSON[_0x3440('0x79')](_0x1a2735[_0x3440('0x78')]);for(var _0x219b5a=0x0;_0x219b5a<_0x1a2735[_0x3440('0x78')][_0x3440('0x32')];_0x219b5a+=0x1){if(_0x1a2735[_0x3440('0x78')][_0x219b5a][_0x3440('0x38')]&&_[_0x3440('0x60')](_0x357c33,_0x1a2735[_0x3440('0x78')][_0x219b5a]['type'])&&_0x1a2735[_0x3440('0x78')][_0x219b5a]['parentKey']&&_0x1a2735[_0x3440('0x78')][_0x219b5a]['foreignTable']&&_0x1a2735['joins'][_0x219b5a][_0x3440('0x7b')]){_0x597d85[_0x1a2735[_0x3440('0x78')][_0x219b5a]['type']](_0x1a2735[_0x3440('0x78')][_0x219b5a]['foreignTable'],null,util[_0x3440('0x73')](_0x3440('0x7c'),_0x1a2735[_0x3440('0x6e')],_0x1a2735[_0x3440('0x78')][_0x219b5a]['parentKey'],_0x1a2735['joins'][_0x219b5a]['foreignTable'],_0x1a2735[_0x3440('0x78')][_0x219b5a][_0x3440('0x7b')]));}}}if(_0x1a2735[_0x3440('0x7e')]){_0x1a2735['conditions']=JSON['parse'](_0x1a2735[_0x3440('0x7e')]);_0x597d85['where'](_0x3664d9(_0x1a2735[_0x3440('0x7e')]['group']));}_0x25af24=_0x597d85[_0x3440('0x7f')]();_0x597d85[_0x3440('0x1c')](_0x1c1b21);_0x597d85[_0x3440('0x1b')](0x0);logger['debug'](_0x3440('0x81'),_0x597d85['toString']());return db[_0x3440('0x83')][_0x3440('0x31')](_0x597d85[_0x3440('0x82')](),{'type':db[_0x3440('0x83')][_0x3440('0x84')][_0x3440('0x8d')]});}})[_0x3440('0x22')](function(_0x35e239){if(!_0x35e239[_0x3440('0x32')]){throw new db[(_0x3440('0x68'))]['ValidationErrorItem']('No\x20available\x20data',0xcc);}if(_0x2f7ee5[_0x3440('0x8e')]===_0x3440('0x8f')){return null;}var _0x91b15f=_[_0x3440('0x3b')](_0x2f7ee5,{'name':_0x2f7ee5[_0x3440('0x90')]||_0x2f7ee5[_0x3440('0x28')]||_0x1a2735['name'],'basename':_0x5352c8,'savename':util[_0x3440('0x73')](_0x3440('0x91'),_0x2f7ee5[_0x3440('0x28')]||_0x1a2735[_0x3440('0x28')],require(_0x3440('0x92'))[_0x3440('0x93')](0x4),_0x2f7ee5[_0x3440('0x8e')]||_0x3440('0x94')),'reportId':_0x1a2735['id'],'reportType':_0x3440('0x95')});return db['AnalyticExtractedReport'][_0x3440('0x46')](_0x91b15f,{'raw':!![]});})[_0x3440('0x22')](function(_0xf80fdb){if(_0x1a2735[_0x3440('0x6e')]===_0x3440('0x96')){_0x25af24[_0x3440('0x36')](_0x1a2735[_0x3440('0x6e')]+_0x3440('0x97'),_0x2f7ee5[_0x3440('0x98')],_0x2f7ee5['endDate']);}else{_0x25af24[_0x3440('0x36')](_0x1a2735[_0x3440('0x6e')]+'.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x2f7ee5[_0x3440('0x98')],_0x2f7ee5[_0x3440('0x99')]);}if(_0xf80fdb){logger[_0x3440('0x9a')](_0x3440('0x9b'),_0x25af24[_0x3440('0x82')]());require('child_process')['fork'](path[_0x3440('0x53')](__dirname,_0x3440('0x9c'),_0xf80fdb[_0x3440('0x8e')]),[_0xf80fdb['id'],_0x25af24[_0x3440('0x82')](),path[_0x3440('0x53')](__dirname,_0x3440('0x9d'),_0xf80fdb[_0x3440('0x9e')]),_0x5352c8]);return _0xf80fdb;}else{var _0x9f41f2=squel[_0x3440('0x6c')]();_0x9f41f2[_0x3440('0x6d')]('('+_0x25af24[_0x3440('0x82')]()+')',_0x3440('0x9f'));_0x9f41f2[_0x3440('0x66')](_0x3440('0xa0'),_0x3440('0x1a'));_0x25af24['limit'](_0x2f7ee5[_0x3440('0x1c')]||_0x1c1b21);_0x25af24[_0x3440('0x1b')](_0x2f7ee5[_0x3440('0x1b')]||0x0);return dbH[_0x3440('0x83')][_0x3440('0x31')](_0x9f41f2[_0x3440('0x82')](),{'type':dbH[_0x3440('0x83')][_0x3440('0x84')]['SELECT']})[_0x3440('0x22')](function(_0x452093){if(!_0x452093[_0x3440('0x32')]){_0x2a5537=0x0;}else{_0x2a5537=_0x452093[0x0][_0x3440('0x1a')]||0x0;}return dbH[_0x3440('0x83')][_0x3440('0x31')](_0x25af24['toString'](),{'type':dbH['sequelize'][_0x3440('0x84')]['SELECT']});})[_0x3440('0x22')](function(_0x41740a){return{'rows':_0x41740a||[],'count':_0x2a5537};});}});}exports['run']=function(_0x20f208,_0x406b00){return runReport(_0x20f208[_0x3440('0x51')],_0x20f208['query'],_0x20f208[_0x3440('0x45')])[_0x3440('0x22')](respondWithResult(_0x406b00,null))[_0x3440('0x40')](handleError(_0x406b00,null));};exports[_0x3440('0xa1')]=runReport;exports[_0x3440('0x31')]=function(_0x5d8410,_0xb020c3){var _0x2c7da1=0xa;var _0x44e8da=[_0x3440('0x53'),_0x3440('0x54'),_0x3440('0x85'),'cross_join'];var _0x445193={'SUM':_0x3440('0x56'),'COUNT':_0x3440('0x86'),'COUNT DISTINCT':_0x3440('0x57'),'MAX':_0x3440('0x58'),'MIN':_0x3440('0x59'),'AVG':_0x3440('0x5a'),'GROUP_CONCAT':_0x3440('0x5b'),'GROUP_CONCAT ASC':_0x3440('0x87'),'GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x4f4ad4={'SEC_TO_TIME':_0x3440('0x5c'),'DATE':'DATE(%s)','HOUR':_0x3440('0x5d'),'ROUND':'ROUND(%s)','UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0xfdccbe=function(_0x307d0e){return!_['includes']([_0x3440('0x89'),_0x3440('0x61'),'IS\x20EMPTY',_0x3440('0x63')],_0x307d0e);};var _0x2c0fe9=function(_0xa24af){if(!_0xa24af||!_0xa24af[_0x3440('0x64')][_0x3440('0x32')]){return'';}for(var _0x1bba0e='(',_0x4b8543=0x0;_0x4b8543<_0xa24af[_0x3440('0x64')][_0x3440('0x32')];_0x4b8543+=0x1){_0x4b8543>0x0&&(_0x1bba0e+='\x20'+_0xa24af[_0x3440('0x8a')]+'\x20');_0x1bba0e+=_0xa24af[_0x3440('0x64')][_0x4b8543][_0x3440('0x65')]?_0x2c0fe9(_0xa24af[_0x3440('0x64')][_0x4b8543][_0x3440('0x65')]):_0xa24af[_0x3440('0x64')][_0x4b8543][_0x3440('0x66')]+'\x20'+_0xa24af[_0x3440('0x64')][_0x4b8543][_0x3440('0x8b')]+(_0xfdccbe(_0xa24af[_0x3440('0x64')][_0x4b8543][_0x3440('0x8b')])?'\x20'+_0xa24af[_0x3440('0x64')][_0x4b8543][_0x3440('0x8c')]:'');}return _0x1bba0e+')';};var _0x386a1a={'where':{'id':_0x5d8410[_0x3440('0x51')]['id']}},_0x535b5a,_0x3bff2e,_0x8d71c,_0x56d8e2,_0x1d2d4a;_0x386a1a=_['merge']({},_0x386a1a,_0x5d8410[_0x3440('0x45')]);return db['AnalyticCustomReport'][_0x3440('0x4d')](_0x386a1a)[_0x3440('0x22')](function(_0x46dd79){if(_0x46dd79){_0x535b5a=_0x46dd79;return _0x46dd79[_0x3440('0x67')]();}return null;})[_0x3440('0x22')](function(_0x2f8f9d){if(_0x2f8f9d){if(!_0x2f8f9d[_0x3440('0x32')]){throw new db[(_0x3440('0x68'))][(_0x3440('0x69'))]('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x3bff2e=_0x2f8f9d;return db[_0x3440('0x6a')][_0x3440('0x3e')]({'raw':!![]});}return null;})[_0x3440('0x22')](function(_0x1e83a1){if(_0x1e83a1){_0x8d71c=_[_0x3440('0x6b')](_0x1e83a1,'id');var _0x21b905;var _0x16e272=squel[_0x3440('0x6c')]();_0x16e272[_0x3440('0x6d')](_0x535b5a[_0x3440('0x6e')]);for(var _0x396480=0x0;_0x396480<_0x3bff2e['length'];_0x396480+=0x1){_0x21b905=_0x3bff2e[_0x396480]['MetricId']?_0x8d71c[_0x3bff2e[_0x396480][_0x3440('0x6f')]][_0x3440('0x70')]:_0x3bff2e[_0x396480][_0x3440('0x66')];_0x21b905=_0x3bff2e[_0x396480]['function']?_[_0x3440('0x72')](_0x445193[_0x3bff2e[_0x396480][_0x3440('0x71')]],'%s',_0x21b905):_0x21b905;_0x21b905=_0x3bff2e[_0x396480][_0x3440('0x73')]?_['replace'](_0x4f4ad4[_0x3bff2e[_0x396480][_0x3440('0x73')]],'%s',_0x21b905):_0x21b905;if(_0x3bff2e[_0x396480]['groupBy']){_0x16e272[_0x3440('0x65')](_0x21b905);}_0x3bff2e[_0x396480][_0x3440('0x75')]&&_0x16e272['order'](_0x21b905,_0x3bff2e[_0x396480][_0x3440('0x75')]===_0x3440('0x76')?![]:!![]);_0x16e272[_0x3440('0x66')](_0x21b905,_0x3bff2e[_0x396480][_0x3440('0x77')]||_0x21b905);}if(_0x535b5a[_0x3440('0x78')]){_0x535b5a[_0x3440('0x78')]=JSON[_0x3440('0x79')](_0x535b5a[_0x3440('0x78')]);for(var _0x3d4c81=0x0;_0x3d4c81<_0x535b5a[_0x3440('0x78')][_0x3440('0x32')];_0x3d4c81+=0x1){if(_0x535b5a['joins'][_0x3d4c81][_0x3440('0x38')]&&_[_0x3440('0x60')](_0x44e8da,_0x535b5a['joins'][_0x3d4c81][_0x3440('0x38')])&&_0x535b5a[_0x3440('0x78')][_0x3d4c81][_0x3440('0x7d')]&&_0x535b5a[_0x3440('0x78')][_0x3d4c81][_0x3440('0x7a')]&&_0x535b5a[_0x3440('0x78')][_0x3d4c81][_0x3440('0x7b')]){_0x16e272[_0x535b5a['joins'][_0x3d4c81][_0x3440('0x38')]](_0x535b5a[_0x3440('0x78')][_0x3d4c81][_0x3440('0x7a')],null,util[_0x3440('0x73')]('%s.%s\x20=\x20%s.%s',_0x535b5a[_0x3440('0x6e')],_0x535b5a[_0x3440('0x78')][_0x3d4c81][_0x3440('0x7d')],_0x535b5a[_0x3440('0x78')][_0x3d4c81][_0x3440('0x7a')],_0x535b5a[_0x3440('0x78')][_0x3d4c81]['foreignKey']));}}}if(_0x535b5a[_0x3440('0x7e')]){_0x535b5a['conditions']=JSON[_0x3440('0x79')](_0x535b5a[_0x3440('0x7e')]);_0x16e272['where'](_0x2c0fe9(_0x535b5a[_0x3440('0x7e')][_0x3440('0x65')]));}_0x1d2d4a=_0x16e272[_0x3440('0x7f')]();_0x16e272[_0x3440('0x1c')](_0x2c7da1);_0x16e272[_0x3440('0x1b')](0x0);logger[_0x3440('0x80')](_0x3440('0x81'),_0x16e272[_0x3440('0x82')]());return db[_0x3440('0x83')]['query'](_0x16e272[_0x3440('0x82')](),{'type':db[_0x3440('0x83')][_0x3440('0x84')][_0x3440('0x8d')]});}})[_0x3440('0x22')](function(){return{'sql':_0x1d2d4a[_0x3440('0x82')]()};})[_0x3440('0x22')](respondWithResult(_0xb020c3,null))[_0x3440('0x40')](handleError(_0xb020c3,null));}; \ No newline at end of file +var _0x2209=['api','../../config/utils','../../config/environment','../../mysqldb','dbH','sendStatus','end','status','json','count','offset','set','apply','reject','save','update','then','get','UserProfileResource','destroy','error','stack','name','send','index','map','AnalyticCustomReport','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','sort','where','filters','pick','merge','filter','options','includeAll','include','findAll','rows','catch','show','find','create','body','user','role','Reports','userProfileId','autoAssociation','CustomReports','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','preview','join','left_join','right_join','cross_join','SUM(%s)','COUNT(%s)','COUNT(DISTINCT\x20%s)','MAX(%s)','AVG(%s)','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','SEC_TO_TIME(%s)','DATE(%s)','HOUR(%s)','ROUND(%s)','includes','IS\x20NULL','IS\x20NOT\x20NULL','IS\x20EMPTY','IS\x20NOT\x20EMPTY','rules','operator','group','field','condition','value','getFields','Sequelize','ValidationErrorItem','Please\x20insert\x20at\x20least\x20one\x20field','AnalyticMetric','keyBy','select','from','table','MetricId','metric','function','replace','format','groupBy','order','DESC','joins','parse','parentKey','foreignTable','foreignKey','%s.%s\x20=\x20%s.%s','conditions','debug','toString','sequelize','QueryTypes','SELECT','MIN(%s)','UNIX_TIMESTAMP(%s)','alias','clone','limit','No\x20available\x20data','output','web','fullPath','%s-%s.%s','randomstring','generate','custom','AnalyticExtractedReport','cdr','.calldate\x20BETWEEN\x20?\x20AND\x20?','startDate','endDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','info','Run\x20Query:','child_process','../../components/export/','savename','countTable','COUNT(*)','runReport','orderBy','Limited\x20Query:','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger'];(function(_0x124851,_0x404f63){var _0x3ddc11=function(_0x2b1294){while(--_0x2b1294){_0x124851['push'](_0x124851['shift']());}};_0x3ddc11(++_0x404f63);}(_0x2209,0x95));var _0x9220=function(_0x1db8b4,_0x18aa52){_0x1db8b4=_0x1db8b4-0x0;var _0xaafd23=_0x2209[_0x1db8b4];return _0xaafd23;};'use strict';var pdf=require(_0x9220('0x0'));var emlformat=require(_0x9220('0x1'));var rimraf=require(_0x9220('0x2'));var zipdir=require(_0x9220('0x3'));var jsonpatch=require(_0x9220('0x4'));var rp=require('request-promise');var moment=require(_0x9220('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x9220('0x6'));var util=require(_0x9220('0x7'));var path=require(_0x9220('0x8'));var sox=require(_0x9220('0x9'));var csv=require(_0x9220('0xa'));var ejs=require(_0x9220('0xb'));var fs=require('fs');var _=require(_0x9220('0xc'));var squel=require(_0x9220('0xd'));var crypto=require(_0x9220('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x9220('0xf'));var toCsv=require(_0x9220('0xa'));var querystring=require('querystring');var Papa=require(_0x9220('0x10'));var Redis=require(_0x9220('0x11'));var authService=require(_0x9220('0x12'));var qs=require(_0x9220('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x9220('0x14'));var logger=require(_0x9220('0x15'))(_0x9220('0x16'));var utils=require(_0x9220('0x17'));var config=require(_0x9220('0x18'));var db=require(_0x9220('0x19'))['db'];var dbH=require(_0x9220('0x19'))[_0x9220('0x1a')];function respondWithStatusCode(_0x4c58e9,_0x2cbe2a){_0x2cbe2a=_0x2cbe2a||0xcc;return function(_0x50bcc8){if(_0x50bcc8){return _0x4c58e9[_0x9220('0x1b')](_0x2cbe2a);}return _0x4c58e9['status'](_0x2cbe2a)[_0x9220('0x1c')]();};}function respondWithResult(_0x4d8bf1,_0xa13cd){_0xa13cd=_0xa13cd||0xc8;return function(_0x45506f){if(_0x45506f){return _0x4d8bf1[_0x9220('0x1d')](_0xa13cd)[_0x9220('0x1e')](_0x45506f);}};}function respondWithFilteredResult(_0x493744,_0x3fe2c1){return function(_0x1f484b){if(_0x1f484b){var _0x4898c5=_0x1f484b[_0x9220('0x1f')],_0x577bd8=_0x3fe2c1[_0x9220('0x20')],_0x3c3473=_0x3fe2c1[_0x9220('0x20')]+_0x3fe2c1['limit'],_0x559581;if(_0x3c3473>=_0x4898c5){_0x3c3473=_0x4898c5;_0x559581=0xc8;}else{_0x559581=0xce;}_0x493744[_0x9220('0x1d')](_0x559581);return _0x493744[_0x9220('0x21')]('Content-Range',_0x577bd8+'-'+_0x3c3473+'/'+_0x4898c5)[_0x9220('0x1e')](_0x1f484b);}return null;};}function patchUpdates(_0x558c28){return function(_0x4e37e0){try{jsonpatch[_0x9220('0x22')](_0x4e37e0,_0x558c28,!![]);}catch(_0x10a8f2){return BPromise[_0x9220('0x23')](_0x10a8f2);}return _0x4e37e0[_0x9220('0x24')]();};}function saveUpdates(_0x2ded94,_0x27f242){return function(_0x3c13b1){if(_0x3c13b1){return _0x3c13b1[_0x9220('0x25')](_0x2ded94)[_0x9220('0x26')](function(_0x9d19fe){return _0x9d19fe;});}return null;};}function removeEntity(_0x462798,_0x2eb9f3){return function(_0x1e1135){if(_0x1e1135){return _0x1e1135['destroy']()[_0x9220('0x26')](function(){var _0x379c1f=_0x1e1135[_0x9220('0x27')]({'plain':!![]});var _0xfde27f='CustomReports';return db[_0x9220('0x28')][_0x9220('0x29')]({'where':{'type':_0xfde27f,'resourceId':_0x379c1f['id']}})[_0x9220('0x26')](function(){return _0x1e1135;});})[_0x9220('0x26')](function(){_0x462798[_0x9220('0x1d')](0xcc)[_0x9220('0x1c')]();});}};}function handleEntityNotFound(_0x5902d2,_0x959dc0){return function(_0x3ca360){if(!_0x3ca360){_0x5902d2[_0x9220('0x1b')](0x194);}return _0x3ca360;};}function handleError(_0x2d7a91,_0x5594c8){_0x5594c8=_0x5594c8||0x1f4;return function(_0x5e6918){logger[_0x9220('0x2a')](_0x5e6918[_0x9220('0x2b')]);if(_0x5e6918[_0x9220('0x2c')]){delete _0x5e6918['name'];}_0x2d7a91['status'](_0x5594c8)[_0x9220('0x2d')](_0x5e6918);};}exports[_0x9220('0x2e')]=function(_0x51cf57,_0x44dffb){var _0x2e4f81={},_0x608ed4={},_0x50f431={'count':0x0,'rows':[]};var _0x18bb7d=_[_0x9220('0x2f')](db[_0x9220('0x30')][_0x9220('0x31')],function(_0x14fee4){return{'name':_0x14fee4[_0x9220('0x32')],'type':_0x14fee4[_0x9220('0x33')][_0x9220('0x34')]};});_0x608ed4[_0x9220('0x35')]=_[_0x9220('0x2f')](_0x18bb7d,'name');_0x608ed4[_0x9220('0x36')]=_[_0x9220('0x37')](_0x51cf57['query']);_0x608ed4['filters']=_[_0x9220('0x38')](_0x608ed4['model'],_0x608ed4[_0x9220('0x36')]);_0x2e4f81[_0x9220('0x39')]=_[_0x9220('0x38')](_0x608ed4[_0x9220('0x35')],qs[_0x9220('0x3a')](_0x51cf57[_0x9220('0x36')]['fields']));_0x2e4f81[_0x9220('0x39')]=_0x2e4f81[_0x9220('0x39')][_0x9220('0x3b')]?_0x2e4f81[_0x9220('0x39')]:_0x608ed4[_0x9220('0x35')];if(!_0x51cf57[_0x9220('0x36')][_0x9220('0x3c')]('nolimit')){_0x2e4f81['limit']=qs['limit'](_0x51cf57[_0x9220('0x36')]['limit']);_0x2e4f81[_0x9220('0x20')]=qs[_0x9220('0x20')](_0x51cf57[_0x9220('0x36')][_0x9220('0x20')]);}_0x2e4f81['order']=qs[_0x9220('0x3d')](_0x51cf57[_0x9220('0x36')][_0x9220('0x3d')]);_0x2e4f81[_0x9220('0x3e')]=qs[_0x9220('0x3f')](_[_0x9220('0x40')](_0x51cf57[_0x9220('0x36')],_0x608ed4[_0x9220('0x3f')]),_0x18bb7d);if(_0x51cf57['query']['filter']){_0x2e4f81[_0x9220('0x3e')]=_[_0x9220('0x41')](_0x2e4f81[_0x9220('0x3e')],{'$or':_[_0x9220('0x2f')](_0x18bb7d,function(_0x1d94fe){if(_0x1d94fe['type']!=='VIRTUAL'){var _0x28064b={};_0x28064b[_0x1d94fe[_0x9220('0x2c')]]={'$like':'%'+_0x51cf57[_0x9220('0x36')][_0x9220('0x42')]+'%'};return _0x28064b;}})});}_0x2e4f81=_[_0x9220('0x41')]({},_0x2e4f81,_0x51cf57[_0x9220('0x43')]);var _0x262018={'where':_0x2e4f81[_0x9220('0x3e')]};return db[_0x9220('0x30')]['count'](_0x262018)[_0x9220('0x26')](function(_0x3d3410){_0x50f431[_0x9220('0x1f')]=_0x3d3410;if(_0x51cf57['query'][_0x9220('0x44')]){_0x2e4f81[_0x9220('0x45')]=[{'all':!![]}];}return db[_0x9220('0x30')][_0x9220('0x46')](_0x2e4f81);})[_0x9220('0x26')](function(_0x5d0683){_0x50f431[_0x9220('0x47')]=_0x5d0683;return _0x50f431;})[_0x9220('0x26')](respondWithFilteredResult(_0x44dffb,_0x2e4f81))[_0x9220('0x48')](handleError(_0x44dffb,null));};exports[_0x9220('0x49')]=function(_0x1e8170,_0x12c6ae){var _0xaf4963={'raw':![],'where':{'id':_0x1e8170['params']['id']}},_0x273d3f={};_0x273d3f[_0x9220('0x35')]=_[_0x9220('0x37')](db['AnalyticCustomReport'][_0x9220('0x31')]);_0x273d3f[_0x9220('0x36')]=_[_0x9220('0x37')](_0x1e8170['query']);_0x273d3f[_0x9220('0x3f')]=_['intersection'](_0x273d3f[_0x9220('0x35')],_0x273d3f[_0x9220('0x36')]);_0xaf4963[_0x9220('0x39')]=_[_0x9220('0x38')](_0x273d3f[_0x9220('0x35')],qs[_0x9220('0x3a')](_0x1e8170[_0x9220('0x36')][_0x9220('0x3a')]));_0xaf4963[_0x9220('0x39')]=_0xaf4963['attributes'][_0x9220('0x3b')]?_0xaf4963[_0x9220('0x39')]:_0x273d3f[_0x9220('0x35')];if(_0x1e8170[_0x9220('0x36')][_0x9220('0x44')]){_0xaf4963[_0x9220('0x45')]=[{'all':!![]}];}_0xaf4963=_['merge']({},_0xaf4963,_0x1e8170[_0x9220('0x43')]);return db[_0x9220('0x30')][_0x9220('0x4a')](_0xaf4963)[_0x9220('0x26')](handleEntityNotFound(_0x12c6ae,null))[_0x9220('0x26')](respondWithResult(_0x12c6ae,null))[_0x9220('0x48')](handleError(_0x12c6ae,null));};exports[_0x9220('0x4b')]=function(_0x2ee52c,_0xb6a97b){return db[_0x9220('0x30')][_0x9220('0x4b')](_0x2ee52c[_0x9220('0x4c')],{})[_0x9220('0x26')](function(_0x26f07b){var _0x4dc5ec=_0x2ee52c[_0x9220('0x4d')][_0x9220('0x27')]({'plain':!![]});if(!_0x4dc5ec)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x4dc5ec[_0x9220('0x4e')]===_0x9220('0x4d')){var _0x19bd37=_0x26f07b[_0x9220('0x27')]({'plain':!![]});var _0x58d3c5=_0x9220('0x4f');return db['UserProfileSection'][_0x9220('0x4a')]({'where':{'name':_0x58d3c5,'userProfileId':_0x4dc5ec[_0x9220('0x50')]},'raw':!![]})[_0x9220('0x26')](function(_0x3ffa7a){if(_0x3ffa7a&&_0x3ffa7a[_0x9220('0x51')]===0x0){return db['UserProfileResource']['create']({'name':_0x19bd37[_0x9220('0x2c')],'resourceId':_0x19bd37['id'],'type':_0x9220('0x52'),'sectionId':_0x3ffa7a['id']},{})['then'](function(){return _0x26f07b;});}else{return _0x26f07b;}})[_0x9220('0x48')](function(_0x5c9d33){logger['error'](_0x9220('0x53'),_0x5c9d33);throw _0x5c9d33;});}return _0x26f07b;})['then'](respondWithResult(_0xb6a97b,0xc9))[_0x9220('0x48')](handleError(_0xb6a97b,null));};exports[_0x9220('0x25')]=function(_0x28849c,_0x1bd1c1){if(_0x28849c['body']['id']){delete _0x28849c[_0x9220('0x4c')]['id'];}return db[_0x9220('0x30')]['find']({'where':{'id':_0x28849c[_0x9220('0x54')]['id']}})['then'](handleEntityNotFound(_0x1bd1c1,null))['then'](saveUpdates(_0x28849c['body'],null))[_0x9220('0x26')](respondWithResult(_0x1bd1c1,null))[_0x9220('0x48')](handleError(_0x1bd1c1,null));};exports[_0x9220('0x29')]=function(_0x3d342c,_0x291be5){return db['AnalyticCustomReport']['find']({'where':{'id':_0x3d342c['params']['id']}})[_0x9220('0x26')](handleEntityNotFound(_0x291be5,null))[_0x9220('0x26')](removeEntity(_0x291be5,null))[_0x9220('0x48')](handleError(_0x291be5,null));};exports[_0x9220('0x55')]=function(_0x53b624,_0x3469fe){var _0x389837=0xa;var _0x1d92ca=[_0x9220('0x56'),_0x9220('0x57'),_0x9220('0x58'),_0x9220('0x59')];var _0x54c672={'SUM':_0x9220('0x5a'),'COUNT':_0x9220('0x5b'),'COUNT DISTINCT':_0x9220('0x5c'),'MAX':_0x9220('0x5d'),'MIN':'MIN(%s)','AVG':_0x9220('0x5e'),'GROUP_CONCAT':_0x9220('0x5f'),'GROUP_CONCAT ASC':_0x9220('0x60'),'GROUP_CONCAT DESC':_0x9220('0x61')};var _0x401817={'SEC_TO_TIME':_0x9220('0x62'),'DATE':_0x9220('0x63'),'HOUR':_0x9220('0x64'),'ROUND':_0x9220('0x65'),'UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x22d03d=function(_0x54e219){return!_[_0x9220('0x66')]([_0x9220('0x67'),_0x9220('0x68'),_0x9220('0x69'),_0x9220('0x6a')],_0x54e219);};var _0x2b74e4=function(_0x262c18){if(!_0x262c18||!_0x262c18[_0x9220('0x6b')][_0x9220('0x3b')]){return'';}for(var _0x581dfe='(',_0x36b5d6=0x0;_0x36b5d6<_0x262c18[_0x9220('0x6b')][_0x9220('0x3b')];_0x36b5d6+=0x1){_0x36b5d6>0x0&&(_0x581dfe+='\x20'+_0x262c18[_0x9220('0x6c')]+'\x20');_0x581dfe+=_0x262c18[_0x9220('0x6b')][_0x36b5d6][_0x9220('0x6d')]?_0x2b74e4(_0x262c18['rules'][_0x36b5d6][_0x9220('0x6d')]):_0x262c18[_0x9220('0x6b')][_0x36b5d6][_0x9220('0x6e')]+'\x20'+_0x262c18[_0x9220('0x6b')][_0x36b5d6][_0x9220('0x6f')]+(_0x22d03d(_0x262c18[_0x9220('0x6b')][_0x36b5d6][_0x9220('0x6f')])?'\x20'+_0x262c18[_0x9220('0x6b')][_0x36b5d6][_0x9220('0x70')]:'');}return _0x581dfe+')';};var _0x493e45={'where':{'id':_0x53b624[_0x9220('0x54')]['id']}},_0x3f3599,_0x66d981,_0x9561ab,_0x265416,_0x357c4a;_0x493e45=_[_0x9220('0x41')]({},_0x493e45,_0x53b624[_0x9220('0x43')]);return db[_0x9220('0x30')][_0x9220('0x4a')](_0x493e45)[_0x9220('0x26')](function(_0x55f50d){if(_0x55f50d){_0x3f3599=_0x55f50d;return _0x55f50d[_0x9220('0x71')]();}return null;})[_0x9220('0x26')](function(_0x3d261e){if(_0x3d261e){if(!_0x3d261e['length']){throw new db[(_0x9220('0x72'))][(_0x9220('0x73'))](_0x9220('0x74'),0x193);}_0x66d981=_0x3d261e;return db[_0x9220('0x75')]['findAll']({'raw':!![]});}return null;})['then'](function(_0x468a87){if(_0x468a87){_0x9561ab=_[_0x9220('0x76')](_0x468a87,'id');var _0x562324;var _0x25d5c6=squel[_0x9220('0x77')]();_0x25d5c6[_0x9220('0x78')](_0x3f3599[_0x9220('0x79')]);for(var _0x47309a=0x0;_0x47309a<_0x66d981[_0x9220('0x3b')];_0x47309a+=0x1){_0x562324=_0x66d981[_0x47309a][_0x9220('0x7a')]?_0x9561ab[_0x66d981[_0x47309a][_0x9220('0x7a')]][_0x9220('0x7b')]:_0x66d981[_0x47309a][_0x9220('0x6e')];_0x562324=_0x66d981[_0x47309a][_0x9220('0x7c')]?_[_0x9220('0x7d')](_0x54c672[_0x66d981[_0x47309a]['function']],'%s',_0x562324):_0x562324;_0x562324=_0x66d981[_0x47309a]['format']?_[_0x9220('0x7d')](_0x401817[_0x66d981[_0x47309a][_0x9220('0x7e')]],'%s',_0x562324):_0x562324;if(_0x66d981[_0x47309a][_0x9220('0x7f')]){_0x25d5c6[_0x9220('0x6d')](_0x562324);}_0x66d981[_0x47309a]['orderBy']&&_0x25d5c6[_0x9220('0x80')](_0x562324,_0x66d981[_0x47309a]['orderBy']===_0x9220('0x81')?![]:!![]);_0x25d5c6[_0x9220('0x6e')](_0x562324,_0x66d981[_0x47309a]['alias']||_0x562324);}if(_0x3f3599[_0x9220('0x82')]){_0x3f3599[_0x9220('0x82')]=JSON[_0x9220('0x83')](_0x3f3599[_0x9220('0x82')]);for(var _0x5b3579=0x0;_0x5b3579<_0x3f3599[_0x9220('0x82')][_0x9220('0x3b')];_0x5b3579+=0x1){if(_0x3f3599['joins'][_0x5b3579]['type']&&_[_0x9220('0x66')](_0x1d92ca,_0x3f3599[_0x9220('0x82')][_0x5b3579]['type'])&&_0x3f3599[_0x9220('0x82')][_0x5b3579][_0x9220('0x84')]&&_0x3f3599['joins'][_0x5b3579][_0x9220('0x85')]&&_0x3f3599[_0x9220('0x82')][_0x5b3579][_0x9220('0x86')]){_0x25d5c6[_0x3f3599[_0x9220('0x82')][_0x5b3579]['type']](_0x3f3599['joins'][_0x5b3579][_0x9220('0x85')],null,util[_0x9220('0x7e')](_0x9220('0x87'),_0x3f3599['table'],_0x3f3599[_0x9220('0x82')][_0x5b3579]['parentKey'],_0x3f3599[_0x9220('0x82')][_0x5b3579][_0x9220('0x85')],_0x3f3599[_0x9220('0x82')][_0x5b3579][_0x9220('0x86')]));}}}if(_0x3f3599['conditions']){_0x3f3599['conditions']=JSON[_0x9220('0x83')](_0x3f3599['conditions']);_0x25d5c6[_0x9220('0x3e')](_0x2b74e4(_0x3f3599[_0x9220('0x88')][_0x9220('0x6d')]));}_0x357c4a=_0x25d5c6['clone']();_0x25d5c6['limit'](_0x389837);_0x25d5c6[_0x9220('0x20')](0x0);logger[_0x9220('0x89')]('Limited\x20Query:',_0x25d5c6['toString']());return db['sequelize'][_0x9220('0x36')](_0x25d5c6[_0x9220('0x8a')](),{'type':db[_0x9220('0x8b')][_0x9220('0x8c')][_0x9220('0x8d')]});}})[_0x9220('0x26')](respondWithResult(_0x3469fe,null))[_0x9220('0x48')](handleError(_0x3469fe,null));};function runReport(_0x3ccf19,_0x2beccf,_0x20a351){var _0x4e5b95=_0x2beccf[_0x9220('0x2c')];var _0x255c90=0xa;var _0x525f77=[_0x9220('0x56'),_0x9220('0x57'),_0x9220('0x58'),_0x9220('0x59')];var _0x2e8a01={'SUM':_0x9220('0x5a'),'COUNT':_0x9220('0x5b'),'COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':_0x9220('0x5d'),'MIN':_0x9220('0x8e'),'AVG':_0x9220('0x5e'),'GROUP_CONCAT':_0x9220('0x5f'),'GROUP_CONCAT ASC':_0x9220('0x60'),'GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x408f67={'SEC_TO_TIME':_0x9220('0x62'),'DATE':_0x9220('0x63'),'HOUR':_0x9220('0x64'),'ROUND':_0x9220('0x65'),'UNIX_TIMESTAMP':_0x9220('0x8f')};var _0x4b0155=function(_0x5ab05a){return!_['includes']([_0x9220('0x67'),_0x9220('0x68'),_0x9220('0x69'),_0x9220('0x6a')],_0x5ab05a);};var _0x34c56f=function(_0x53d701){if(!_0x53d701||!_0x53d701[_0x9220('0x6b')][_0x9220('0x3b')]){return'';}for(var _0x1a9a93='(',_0xc60c45=0x0;_0xc60c45<_0x53d701['rules'][_0x9220('0x3b')];_0xc60c45+=0x1){_0xc60c45>0x0&&(_0x1a9a93+='\x20'+_0x53d701[_0x9220('0x6c')]+'\x20');_0x1a9a93+=_0x53d701[_0x9220('0x6b')][_0xc60c45][_0x9220('0x6d')]?_0x34c56f(_0x53d701['rules'][_0xc60c45]['group']):_0x53d701['rules'][_0xc60c45][_0x9220('0x6e')]+'\x20'+_0x53d701[_0x9220('0x6b')][_0xc60c45]['condition']+(_0x4b0155(_0x53d701[_0x9220('0x6b')][_0xc60c45][_0x9220('0x6f')])?'\x20'+_0x53d701[_0x9220('0x6b')][_0xc60c45]['value']:'');}return _0x1a9a93+')';};var _0x3d67b1={'where':{'id':_0x3ccf19['id']}},_0x583705,_0x4d846c,_0x171e1c,_0x2b3ce1,_0x4d2be3;_0x3d67b1=_[_0x9220('0x41')]({},_0x3d67b1,_0x20a351);return db['AnalyticCustomReport'][_0x9220('0x4a')](_0x3d67b1)[_0x9220('0x26')](function(_0x197fc0){if(_0x197fc0){_0x583705=_0x197fc0;return _0x197fc0[_0x9220('0x71')]();}return null;})[_0x9220('0x26')](function(_0x496a88){if(_0x496a88){if(!_0x496a88[_0x9220('0x3b')]){throw new db[(_0x9220('0x72'))][(_0x9220('0x73'))](_0x9220('0x74'),0x193);}_0x4d846c=_0x496a88;return db[_0x9220('0x75')][_0x9220('0x46')]({'raw':!![]});}return null;})[_0x9220('0x26')](function(_0x43c85d){if(_0x43c85d){_0x171e1c=_['keyBy'](_0x43c85d,'id');var _0x37fcc4;var _0x4ba0c2=squel[_0x9220('0x77')]();_0x4ba0c2['from'](_0x583705[_0x9220('0x79')]);for(var _0x1f6c72=0x0;_0x1f6c72<_0x4d846c['length'];_0x1f6c72+=0x1){_0x37fcc4=_0x4d846c[_0x1f6c72][_0x9220('0x7a')]?_0x171e1c[_0x4d846c[_0x1f6c72][_0x9220('0x7a')]][_0x9220('0x7b')]:_0x4d846c[_0x1f6c72][_0x9220('0x6e')];_0x37fcc4=_0x4d846c[_0x1f6c72][_0x9220('0x7c')]?_[_0x9220('0x7d')](_0x2e8a01[_0x4d846c[_0x1f6c72]['function']],'%s',_0x37fcc4):_0x37fcc4;_0x37fcc4=_0x4d846c[_0x1f6c72][_0x9220('0x7e')]?_[_0x9220('0x7d')](_0x408f67[_0x4d846c[_0x1f6c72][_0x9220('0x7e')]],'%s',_0x37fcc4):_0x37fcc4;if(_0x4d846c[_0x1f6c72][_0x9220('0x7f')]){_0x4ba0c2['group'](_0x37fcc4);}_0x4d846c[_0x1f6c72]['orderBy']&&_0x4ba0c2[_0x9220('0x80')](_0x37fcc4,_0x4d846c[_0x1f6c72]['orderBy']===_0x9220('0x81')?![]:!![]);_0x4ba0c2['field'](_0x37fcc4,_0x4d846c[_0x1f6c72][_0x9220('0x90')]||_0x37fcc4);}if(_0x583705[_0x9220('0x82')]){_0x583705[_0x9220('0x82')]=JSON[_0x9220('0x83')](_0x583705[_0x9220('0x82')]);for(var _0x54df43=0x0;_0x54df43<_0x583705[_0x9220('0x82')][_0x9220('0x3b')];_0x54df43+=0x1){if(_0x583705[_0x9220('0x82')][_0x54df43][_0x9220('0x33')]&&_[_0x9220('0x66')](_0x525f77,_0x583705[_0x9220('0x82')][_0x54df43]['type'])&&_0x583705[_0x9220('0x82')][_0x54df43][_0x9220('0x84')]&&_0x583705[_0x9220('0x82')][_0x54df43][_0x9220('0x85')]&&_0x583705['joins'][_0x54df43]['foreignKey']){_0x4ba0c2[_0x583705[_0x9220('0x82')][_0x54df43]['type']](_0x583705['joins'][_0x54df43]['foreignTable'],null,util[_0x9220('0x7e')]('%s.%s\x20=\x20%s.%s',_0x583705['table'],_0x583705[_0x9220('0x82')][_0x54df43]['parentKey'],_0x583705[_0x9220('0x82')][_0x54df43][_0x9220('0x85')],_0x583705[_0x9220('0x82')][_0x54df43][_0x9220('0x86')]));}}}if(_0x583705[_0x9220('0x88')]){_0x583705['conditions']=JSON[_0x9220('0x83')](_0x583705[_0x9220('0x88')]);_0x4ba0c2[_0x9220('0x3e')](_0x34c56f(_0x583705[_0x9220('0x88')][_0x9220('0x6d')]));}_0x4d2be3=_0x4ba0c2[_0x9220('0x91')]();_0x4ba0c2[_0x9220('0x92')](_0x255c90);_0x4ba0c2['offset'](0x0);logger[_0x9220('0x89')]('Limited\x20Query:',_0x4ba0c2[_0x9220('0x8a')]());return db['sequelize']['query'](_0x4ba0c2[_0x9220('0x8a')](),{'type':db[_0x9220('0x8b')]['QueryTypes'][_0x9220('0x8d')]});}})[_0x9220('0x26')](function(_0x340244){if(!_0x340244[_0x9220('0x3b')]){throw new db[(_0x9220('0x72'))][(_0x9220('0x73'))](_0x9220('0x93'),0xcc);}if(_0x2beccf[_0x9220('0x94')]===_0x9220('0x95')){return null;}var _0x229232=_[_0x9220('0x41')](_0x2beccf,{'name':_0x2beccf[_0x9220('0x96')]||_0x2beccf[_0x9220('0x2c')]||_0x583705[_0x9220('0x2c')],'basename':_0x4e5b95,'savename':util[_0x9220('0x7e')](_0x9220('0x97'),_0x2beccf[_0x9220('0x2c')]||_0x583705[_0x9220('0x2c')],require(_0x9220('0x98'))[_0x9220('0x99')](0x4),_0x2beccf[_0x9220('0x94')]||'csv'),'reportId':_0x583705['id'],'reportType':_0x9220('0x9a')});return db[_0x9220('0x9b')]['create'](_0x229232,{'raw':!![]});})['then'](function(_0x46f82a){if(_0x583705[_0x9220('0x79')]===_0x9220('0x9c')){_0x4d2be3[_0x9220('0x3e')](_0x583705['table']+_0x9220('0x9d'),_0x2beccf[_0x9220('0x9e')],_0x2beccf[_0x9220('0x9f')]);}else{_0x4d2be3['where'](_0x583705['table']+_0x9220('0xa0'),_0x2beccf[_0x9220('0x9e')],_0x2beccf['endDate']);}if(_0x46f82a){logger[_0x9220('0xa1')](_0x9220('0xa2'),_0x4d2be3[_0x9220('0x8a')]());require(_0x9220('0xa3'))['fork'](path[_0x9220('0x56')](__dirname,_0x9220('0xa4'),_0x46f82a['output']),[_0x46f82a['id'],_0x4d2be3[_0x9220('0x8a')](),path[_0x9220('0x56')](__dirname,'../../files/reports',_0x46f82a[_0x9220('0xa5')]),_0x4e5b95]);return _0x46f82a;}else{var _0x24ff08=squel[_0x9220('0x77')]();_0x24ff08['from']('('+_0x4d2be3['toString']()+')',_0x9220('0xa6'));_0x24ff08[_0x9220('0x6e')](_0x9220('0xa7'),_0x9220('0x1f'));_0x4d2be3[_0x9220('0x92')](_0x2beccf[_0x9220('0x92')]||_0x255c90);_0x4d2be3['offset'](_0x2beccf[_0x9220('0x20')]||0x0);return dbH[_0x9220('0x8b')][_0x9220('0x36')](_0x24ff08[_0x9220('0x8a')](),{'type':dbH[_0x9220('0x8b')][_0x9220('0x8c')][_0x9220('0x8d')]})[_0x9220('0x26')](function(_0x12a2b4){if(!_0x12a2b4['length']){_0x2b3ce1=0x0;}else{_0x2b3ce1=_0x12a2b4[0x0]['count']||0x0;}return dbH[_0x9220('0x8b')]['query'](_0x4d2be3[_0x9220('0x8a')](),{'type':dbH['sequelize'][_0x9220('0x8c')][_0x9220('0x8d')]});})[_0x9220('0x26')](function(_0x265338){return{'rows':_0x265338||[],'count':_0x2b3ce1};});}});}exports['run']=function(_0x275f1b,_0x52a1d6){return runReport(_0x275f1b[_0x9220('0x54')],_0x275f1b['query'],_0x275f1b[_0x9220('0x43')])['then'](respondWithResult(_0x52a1d6,null))[_0x9220('0x48')](handleError(_0x52a1d6,null));};exports[_0x9220('0xa8')]=runReport;exports[_0x9220('0x36')]=function(_0x3350cb,_0x2a326f){var _0xb65d54=0xa;var _0x5a4e9b=[_0x9220('0x56'),'left_join',_0x9220('0x58'),_0x9220('0x59')];var _0xa409da={'SUM':_0x9220('0x5a'),'COUNT':_0x9220('0x5b'),'COUNT DISTINCT':_0x9220('0x5c'),'MAX':'MAX(%s)','MIN':'MIN(%s)','AVG':'AVG(%s)','GROUP_CONCAT':_0x9220('0x5f'),'GROUP_CONCAT ASC':_0x9220('0x60'),'GROUP_CONCAT DESC':_0x9220('0x61')};var _0x299870={'SEC_TO_TIME':_0x9220('0x62'),'DATE':_0x9220('0x63'),'HOUR':_0x9220('0x64'),'ROUND':_0x9220('0x65'),'UNIX_TIMESTAMP':_0x9220('0x8f')};var _0x3f3367=function(_0x672f6){return!_[_0x9220('0x66')]([_0x9220('0x67'),'IS\x20NOT\x20NULL',_0x9220('0x69'),'IS\x20NOT\x20EMPTY'],_0x672f6);};var _0x94d760=function(_0x5f51b0){if(!_0x5f51b0||!_0x5f51b0['rules']['length']){return'';}for(var _0x406014='(',_0xa588f8=0x0;_0xa588f8<_0x5f51b0[_0x9220('0x6b')][_0x9220('0x3b')];_0xa588f8+=0x1){_0xa588f8>0x0&&(_0x406014+='\x20'+_0x5f51b0[_0x9220('0x6c')]+'\x20');_0x406014+=_0x5f51b0['rules'][_0xa588f8][_0x9220('0x6d')]?_0x94d760(_0x5f51b0[_0x9220('0x6b')][_0xa588f8]['group']):_0x5f51b0[_0x9220('0x6b')][_0xa588f8][_0x9220('0x6e')]+'\x20'+_0x5f51b0['rules'][_0xa588f8][_0x9220('0x6f')]+(_0x3f3367(_0x5f51b0[_0x9220('0x6b')][_0xa588f8]['condition'])?'\x20'+_0x5f51b0[_0x9220('0x6b')][_0xa588f8][_0x9220('0x70')]:'');}return _0x406014+')';};var _0x192d94={'where':{'id':_0x3350cb[_0x9220('0x54')]['id']}},_0x4a112e,_0x1977c3,_0x42671a,_0x3c7e60,_0x158c2d;_0x192d94=_['merge']({},_0x192d94,_0x3350cb[_0x9220('0x43')]);return db[_0x9220('0x30')][_0x9220('0x4a')](_0x192d94)[_0x9220('0x26')](function(_0x2ff662){if(_0x2ff662){_0x4a112e=_0x2ff662;return _0x2ff662[_0x9220('0x71')]();}return null;})[_0x9220('0x26')](function(_0x48a9c2){if(_0x48a9c2){if(!_0x48a9c2['length']){throw new db[(_0x9220('0x72'))][(_0x9220('0x73'))](_0x9220('0x74'),0x193);}_0x1977c3=_0x48a9c2;return db[_0x9220('0x75')]['findAll']({'raw':!![]});}return null;})[_0x9220('0x26')](function(_0x4cb4e3){if(_0x4cb4e3){_0x42671a=_[_0x9220('0x76')](_0x4cb4e3,'id');var _0x354045;var _0x2f6d6e=squel['select']();_0x2f6d6e[_0x9220('0x78')](_0x4a112e[_0x9220('0x79')]);for(var _0x560eef=0x0;_0x560eef<_0x1977c3[_0x9220('0x3b')];_0x560eef+=0x1){_0x354045=_0x1977c3[_0x560eef]['MetricId']?_0x42671a[_0x1977c3[_0x560eef][_0x9220('0x7a')]][_0x9220('0x7b')]:_0x1977c3[_0x560eef][_0x9220('0x6e')];_0x354045=_0x1977c3[_0x560eef]['function']?_[_0x9220('0x7d')](_0xa409da[_0x1977c3[_0x560eef][_0x9220('0x7c')]],'%s',_0x354045):_0x354045;_0x354045=_0x1977c3[_0x560eef][_0x9220('0x7e')]?_[_0x9220('0x7d')](_0x299870[_0x1977c3[_0x560eef]['format']],'%s',_0x354045):_0x354045;if(_0x1977c3[_0x560eef][_0x9220('0x7f')]){_0x2f6d6e[_0x9220('0x6d')](_0x354045);}_0x1977c3[_0x560eef][_0x9220('0xa9')]&&_0x2f6d6e[_0x9220('0x80')](_0x354045,_0x1977c3[_0x560eef]['orderBy']==='DESC'?![]:!![]);_0x2f6d6e[_0x9220('0x6e')](_0x354045,_0x1977c3[_0x560eef][_0x9220('0x90')]||_0x354045);}if(_0x4a112e['joins']){_0x4a112e[_0x9220('0x82')]=JSON[_0x9220('0x83')](_0x4a112e[_0x9220('0x82')]);for(var _0x4958f2=0x0;_0x4958f2<_0x4a112e[_0x9220('0x82')]['length'];_0x4958f2+=0x1){if(_0x4a112e[_0x9220('0x82')][_0x4958f2][_0x9220('0x33')]&&_[_0x9220('0x66')](_0x5a4e9b,_0x4a112e[_0x9220('0x82')][_0x4958f2][_0x9220('0x33')])&&_0x4a112e[_0x9220('0x82')][_0x4958f2][_0x9220('0x84')]&&_0x4a112e[_0x9220('0x82')][_0x4958f2]['foreignTable']&&_0x4a112e[_0x9220('0x82')][_0x4958f2][_0x9220('0x86')]){_0x2f6d6e[_0x4a112e[_0x9220('0x82')][_0x4958f2]['type']](_0x4a112e[_0x9220('0x82')][_0x4958f2]['foreignTable'],null,util['format'](_0x9220('0x87'),_0x4a112e[_0x9220('0x79')],_0x4a112e[_0x9220('0x82')][_0x4958f2]['parentKey'],_0x4a112e['joins'][_0x4958f2][_0x9220('0x85')],_0x4a112e[_0x9220('0x82')][_0x4958f2][_0x9220('0x86')]));}}}if(_0x4a112e['conditions']){_0x4a112e[_0x9220('0x88')]=JSON['parse'](_0x4a112e[_0x9220('0x88')]);_0x2f6d6e[_0x9220('0x3e')](_0x94d760(_0x4a112e[_0x9220('0x88')][_0x9220('0x6d')]));}_0x158c2d=_0x2f6d6e['clone']();_0x2f6d6e['limit'](_0xb65d54);_0x2f6d6e[_0x9220('0x20')](0x0);logger[_0x9220('0x89')](_0x9220('0xaa'),_0x2f6d6e[_0x9220('0x8a')]());return db[_0x9220('0x8b')][_0x9220('0x36')](_0x2f6d6e['toString'](),{'type':db[_0x9220('0x8b')][_0x9220('0x8c')][_0x9220('0x8d')]});}})[_0x9220('0x26')](function(){return{'sql':_0x158c2d[_0x9220('0x8a')]()};})[_0x9220('0x26')](respondWithResult(_0x2a326f,null))['catch'](handleError(_0x2a326f,null));}; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.model.js b/server/api/analyticCustomReport/analyticCustomReport.model.js index 11c0dfa..490ce75 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 _0xa2b5=['../../config/environment','./analyticCustomReport.attributes','AnalyticCustomReport','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x3fa209,_0x10f34f){var _0x4b5189=function(_0x59e905){while(--_0x59e905){_0x3fa209['push'](_0x3fa209['shift']());}};_0x4b5189(++_0x10f34f);}(_0xa2b5,0x142));var _0x5a2b=function(_0x403425,_0x51c6a2){_0x403425=_0x403425-0x0;var _0x22b7e7=_0xa2b5[_0x403425];return _0x22b7e7;};'use strict';var _=require(_0x5a2b('0x0'));var util=require('util');var logger=require(_0x5a2b('0x1'))(_0x5a2b('0x2'));var moment=require(_0x5a2b('0x3'));var BPromise=require(_0x5a2b('0x4'));var rp=require(_0x5a2b('0x5'));var fs=require('fs');var path=require(_0x5a2b('0x6'));var rimraf=require(_0x5a2b('0x7'));var config=require(_0x5a2b('0x8'));var attributes=require(_0x5a2b('0x9'));module['exports']=function(_0x3c8539,_0x473113){return _0x3c8539['define'](_0x5a2b('0xa'),attributes,{'tableName':'analytics_custom_reports','paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xbf57=['api','moment','bluebird','path','rimraf','exports','analytics_custom_reports','util'];(function(_0x292f97,_0x2d9da1){var _0x1a4f71=function(_0x994a18){while(--_0x994a18){_0x292f97['push'](_0x292f97['shift']());}};_0x1a4f71(++_0x2d9da1);}(_0xbf57,0x1bf));var _0x7bf5=function(_0xdb5b68,_0x1303ee){_0xdb5b68=_0xdb5b68-0x0;var _0x5a441d=_0xbf57[_0xdb5b68];return _0x5a441d;};'use strict';var _=require('lodash');var util=require(_0x7bf5('0x0'));var logger=require('../../config/logger')(_0x7bf5('0x1'));var moment=require(_0x7bf5('0x2'));var BPromise=require(_0x7bf5('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x7bf5('0x4'));var rimraf=require(_0x7bf5('0x5'));var config=require('../../config/environment');var attributes=require('./analyticCustomReport.attributes');module[_0x7bf5('0x6')]=function(_0x158926,_0x13fde7){return _0x158926['define']('AnalyticCustomReport',attributes,{'tableName':_0x7bf5('0x7'),'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 8c4538c..b06dce4 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 _0x279c=['../../config/logger','rpc','../../config/environment','jayson/promise','then','info','AnalyticCustomReport,\x20%s,\x20%s','AnalyticCustomReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x88db2c,_0x20898b){var _0x58cb16=function(_0x4bfea7){while(--_0x4bfea7){_0x88db2c['push'](_0x88db2c['shift']());}};_0x58cb16(++_0x20898b);}(_0x279c,0x1f1));var _0xc279=function(_0x39e84d,_0x11931d){_0x39e84d=_0x39e84d-0x0;var _0x1991bc=_0x279c[_0x39e84d];return _0x1991bc;};'use strict';var _=require(_0xc279('0x0'));var util=require(_0xc279('0x1'));var moment=require(_0xc279('0x2'));var BPromise=require('bluebird');var rs=require(_0xc279('0x3'));var fs=require('fs');var Redis=require(_0xc279('0x4'));var db=require(_0xc279('0x5'))['db'];var utils=require(_0xc279('0x6'));var logger=require(_0xc279('0x7'))(_0xc279('0x8'));var config=require(_0xc279('0x9'));var jayson=require(_0xc279('0xa'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x91bc06,_0x18f799,_0x2c3620){return new BPromise(function(_0x24a4d4,_0x25607c){return client['request'](_0x91bc06,_0x2c3620)[_0xc279('0xb')](function(_0x3b85bc){logger[_0xc279('0xc')](_0xc279('0xd'),_0x18f799,'request\x20sent');logger['debug'](_0xc279('0xe'),_0x18f799,_0xc279('0xf'),JSON[_0xc279('0x10')](_0x3b85bc));if(_0x3b85bc[_0xc279('0x11')]){if(_0x3b85bc[_0xc279('0x11')][_0xc279('0x12')]===0x1f4){logger[_0xc279('0x11')](_0xc279('0xd'),_0x18f799,_0x3b85bc[_0xc279('0x11')][_0xc279('0x13')]);return _0x25607c(_0x3b85bc[_0xc279('0x11')]['message']);}logger[_0xc279('0x11')](_0xc279('0xd'),_0x18f799,_0x3b85bc[_0xc279('0x11')][_0xc279('0x13')]);return _0x24a4d4(_0x3b85bc[_0xc279('0x11')][_0xc279('0x13')]);}else{logger[_0xc279('0xc')](_0xc279('0xd'),_0x18f799,_0xc279('0xf'));_0x24a4d4(_0x3b85bc['result']['message']);}})[_0xc279('0x14')](function(_0x13c3bb){logger['error'](_0xc279('0xd'),_0x18f799,_0x13c3bb);_0x25607c(_0x13c3bb);});});} \ No newline at end of file +var _0x7b73=['request','then','info','AnalyticCustomReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticCustomReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x5c2eac,_0x566843){var _0x7f47f9=function(_0x19612c){while(--_0x19612c){_0x5c2eac['push'](_0x5c2eac['shift']());}};_0x7f47f9(++_0x566843);}(_0x7b73,0x1e8));var _0x37b7=function(_0x358478,_0x5f2729){_0x358478=_0x358478-0x0;var _0x1aa513=_0x7b73[_0x358478];return _0x1aa513;};'use strict';var _=require(_0x37b7('0x0'));var util=require('util');var moment=require(_0x37b7('0x1'));var BPromise=require(_0x37b7('0x2'));var rs=require(_0x37b7('0x3'));var fs=require('fs');var Redis=require(_0x37b7('0x4'));var db=require(_0x37b7('0x5'))['db'];var utils=require(_0x37b7('0x6'));var logger=require('../../config/logger')(_0x37b7('0x7'));var config=require(_0x37b7('0x8'));var jayson=require(_0x37b7('0x9'));var client=jayson[_0x37b7('0xa')][_0x37b7('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x437e14,_0xfba64e,_0x2e5f76){return new BPromise(function(_0x560222,_0x32763d){return client[_0x37b7('0xc')](_0x437e14,_0x2e5f76)[_0x37b7('0xd')](function(_0x56fe3b){logger[_0x37b7('0xe')](_0x37b7('0xf'),_0xfba64e,_0x37b7('0x10'));logger[_0x37b7('0x11')](_0x37b7('0x12'),_0xfba64e,_0x37b7('0x10'),JSON[_0x37b7('0x13')](_0x56fe3b));if(_0x56fe3b['error']){if(_0x56fe3b[_0x37b7('0x14')][_0x37b7('0x15')]===0x1f4){logger[_0x37b7('0x14')]('AnalyticCustomReport,\x20%s,\x20%s',_0xfba64e,_0x56fe3b[_0x37b7('0x14')][_0x37b7('0x16')]);return _0x32763d(_0x56fe3b[_0x37b7('0x14')]['message']);}logger[_0x37b7('0x14')](_0x37b7('0xf'),_0xfba64e,_0x56fe3b[_0x37b7('0x14')]['message']);return _0x560222(_0x56fe3b[_0x37b7('0x14')][_0x37b7('0x16')]);}else{logger['info'](_0x37b7('0xf'),_0xfba64e,'request\x20sent');_0x560222(_0x56fe3b[_0x37b7('0x17')][_0x37b7('0x16')]);}})[_0x37b7('0x18')](function(_0xf822cc){logger[_0x37b7('0x14')]('AnalyticCustomReport,\x20%s,\x20%s',_0xfba64e,_0xf822cc);_0x32763d(_0xf822cc);});});} \ No newline at end of file diff --git a/server/api/analyticCustomReport/index.js b/server/api/analyticCustomReport/index.js index 8322296..55c44fc 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 _0xa5f9=['index','show','/:id/preview','/:id/run','run','/:id/query','post','create','put','update','delete','/:id','exports','multer','util','path','connect-timeout','../../components/auth/service','../../components/interaction/service','./analyticCustomReport.controller','get','isAuthenticated'];(function(_0x25eedd,_0x2c0186){var _0x30af64=function(_0x22c94a){while(--_0x22c94a){_0x25eedd['push'](_0x25eedd['shift']());}};_0x30af64(++_0x2c0186);}(_0xa5f9,0x1af));var _0x9a5f=function(_0x5290b6,_0x8aa8ed){_0x5290b6=_0x5290b6-0x0;var _0x134d64=_0xa5f9[_0x5290b6];return _0x134d64;};'use strict';var multer=require(_0x9a5f('0x0'));var util=require(_0x9a5f('0x1'));var path=require(_0x9a5f('0x2'));var timeout=require(_0x9a5f('0x3'));var express=require('express');var router=express['Router']();var auth=require(_0x9a5f('0x4'));var interaction=require(_0x9a5f('0x5'));var config=require('../../config/environment');var controller=require(_0x9a5f('0x6'));router[_0x9a5f('0x7')]('/',auth[_0x9a5f('0x8')](),controller[_0x9a5f('0x9')]);router[_0x9a5f('0x7')]('/:id',auth[_0x9a5f('0x8')](),controller[_0x9a5f('0xa')]);router[_0x9a5f('0x7')](_0x9a5f('0xb'),auth['isAuthenticated'](),controller['preview']);router[_0x9a5f('0x7')](_0x9a5f('0xc'),auth[_0x9a5f('0x8')](),controller[_0x9a5f('0xd')]);router[_0x9a5f('0x7')](_0x9a5f('0xe'),auth[_0x9a5f('0x8')](),controller['query']);router[_0x9a5f('0xf')]('/',auth['isAuthenticated'](),controller[_0x9a5f('0x10')]);router[_0x9a5f('0x11')]('/:id',auth[_0x9a5f('0x8')](),controller[_0x9a5f('0x12')]);router[_0x9a5f('0x13')](_0x9a5f('0x14'),auth[_0x9a5f('0x8')](),controller['destroy']);module[_0x9a5f('0x15')]=router; \ No newline at end of file +var _0x7550=['preview','/:id/run','run','/:id/query','query','post','create','put','update','multer','util','path','express','Router','../../components/auth/service','../../config/environment','./analyticCustomReport.controller','get','isAuthenticated','index','/:id','show'];(function(_0x35cb03,_0x578e9d){var _0x696377=function(_0x318fa3){while(--_0x318fa3){_0x35cb03['push'](_0x35cb03['shift']());}};_0x696377(++_0x578e9d);}(_0x7550,0xfb));var _0x0755=function(_0x2799b0,_0x5a8089){_0x2799b0=_0x2799b0-0x0;var _0x4ebb6d=_0x7550[_0x2799b0];return _0x4ebb6d;};'use strict';var multer=require(_0x0755('0x0'));var util=require(_0x0755('0x1'));var path=require(_0x0755('0x2'));var timeout=require('connect-timeout');var express=require(_0x0755('0x3'));var router=express[_0x0755('0x4')]();var auth=require(_0x0755('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x0755('0x6'));var controller=require(_0x0755('0x7'));router[_0x0755('0x8')]('/',auth[_0x0755('0x9')](),controller[_0x0755('0xa')]);router[_0x0755('0x8')](_0x0755('0xb'),auth['isAuthenticated'](),controller[_0x0755('0xc')]);router[_0x0755('0x8')]('/:id/preview',auth[_0x0755('0x9')](),controller[_0x0755('0xd')]);router['get'](_0x0755('0xe'),auth[_0x0755('0x9')](),controller[_0x0755('0xf')]);router[_0x0755('0x8')](_0x0755('0x10'),auth['isAuthenticated'](),controller[_0x0755('0x11')]);router[_0x0755('0x12')]('/',auth['isAuthenticated'](),controller[_0x0755('0x13')]);router[_0x0755('0x14')](_0x0755('0xb'),auth[_0x0755('0x9')](),controller[_0x0755('0x15')]);router['delete']('/:id',auth[_0x0755('0x9')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.attributes.js b/server/api/analyticDefaultReport/analyticDefaultReport.attributes.js index e9b66de..c60ffd4 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 _0x14fb=['TEXT','sequelize','exports','STRING'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x14fb,0x95));var _0xb14f=function(_0x2bb04e,_0x13112e){_0x2bb04e=_0x2bb04e-0x0;var _0x52d47a=_0x14fb[_0x2bb04e];return _0x52d47a;};'use strict';var Sequelize=require(_0xb14f('0x0'));module[_0xb14f('0x1')]={'name':{'type':Sequelize[_0xb14f('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0xb14f('0x2')]},'parent':{'type':Sequelize['STRING']},'table':{'type':Sequelize[_0xb14f('0x2')]},'conditions':{'type':Sequelize[_0xb14f('0x3')]},'joins':{'type':Sequelize['TEXT']}}; \ No newline at end of file +var _0x1a53=['TEXT','sequelize','exports','STRING'];(function(_0x3cd0b0,_0x67a6d6){var _0x547862=function(_0x4144ba){while(--_0x4144ba){_0x3cd0b0['push'](_0x3cd0b0['shift']());}};_0x547862(++_0x67a6d6);}(_0x1a53,0xed));var _0x31a5=function(_0x72f370,_0x2ca373){_0x72f370=_0x72f370-0x0;var _0x51ba11=_0x1a53[_0x72f370];return _0x51ba11;};'use strict';var Sequelize=require(_0x31a5('0x0'));module[_0x31a5('0x1')]={'name':{'type':Sequelize[_0x31a5('0x2')],'allowNull':![]},'description':{'type':Sequelize['STRING']},'parent':{'type':Sequelize[_0x31a5('0x2')]},'table':{'type':Sequelize[_0x31a5('0x2')]},'conditions':{'type':Sequelize[_0x31a5('0x3')]},'joins':{'type':Sequelize[_0x31a5('0x3')]}}; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.controller.js b/server/api/analyticDefaultReport/analyticDefaultReport.controller.js index 8dd6f1a..6cb5fe1 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 _0x26c0=['Run\x20Query:','child_process','fork','../../components/export/','countTable','run','runReport','UNIX_TIMESTAMP(%s)','IS\x20NOT\x20NULL','Please\x20insert\x20at\x20least\x20one\x20field','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','Content-Range','apply','reject','save','update','then','destroy','get','DefaultReports','UserProfileResource','error','stack','name','index','AnalyticDefaultReport','rawAttributes','key','model','map','query','keys','intersection','fields','attributes','length','hasOwnProperty','nolimit','limit','sort','where','filters','pick','merge','type','VIRTUAL','filter','options','findAll','rows','show','params','include','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','Reports','UserProfileSection','userProfileId','catch','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','preview','join','left_join','cross_join','SUM(%s)','COUNT(%s)','MAX(%s)','AVG(%s)','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','HOUR(%s)','ROUND(%s)','includes','IS\x20NULL','IS\x20EMPTY','IS\x20NOT\x20EMPTY','rules','operator','group','field','condition','value','keyBy','select','from','MetricId','metric','function','replace','format','groupBy','orderBy','DESC','alias','joins','parse','parentKey','foreignTable','foreignKey','%s.%s\x20=\x20%s.%s','table','conditions','clone','debug','Limited\x20Query:','toString','sequelize','SELECT','right_join','MIN(%s)','SEC_TO_TIME(%s)','DATE(%s)','getFields','Sequelize','ValidationErrorItem','AnalyticMetric','QueryTypes','No\x20available\x20data','output','web','fullPath','%s-%s.%s','randomstring','csv','AnalyticExtractedReport','.calldate\x20BETWEEN\x20?\x20AND\x20?','startDate','endDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','info'];(function(_0x12fc8d,_0x19ee33){var _0x3f9d04=function(_0x52e51c){while(--_0x52e51c){_0x12fc8d['push'](_0x12fc8d['shift']());}};_0x3f9d04(++_0x19ee33);}(_0x26c0,0xb2));var _0x026c=function(_0x475e55,_0x2bfc0c){_0x475e55=_0x475e55-0x0;var _0x59f30a=_0x26c0[_0x475e55];return _0x59f30a;};'use strict';var pdf=require(_0x026c('0x0'));var emlformat=require(_0x026c('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x026c('0x2'));var jsonpatch=require(_0x026c('0x3'));var rp=require(_0x026c('0x4'));var moment=require(_0x026c('0x5'));var BPromise=require(_0x026c('0x6'));var Mustache=require(_0x026c('0x7'));var util=require(_0x026c('0x8'));var path=require(_0x026c('0x9'));var sox=require(_0x026c('0xa'));var csv=require(_0x026c('0xb'));var ejs=require(_0x026c('0xc'));var fs=require('fs');var _=require(_0x026c('0xd'));var squel=require(_0x026c('0xe'));var crypto=require(_0x026c('0xf'));var jsforce=require(_0x026c('0x10'));var deskjs=require(_0x026c('0x11'));var toCsv=require('to-csv');var querystring=require(_0x026c('0x12'));var Papa=require(_0x026c('0x13'));var Redis=require(_0x026c('0x14'));var authService=require(_0x026c('0x15'));var qs=require(_0x026c('0x16'));var as=require(_0x026c('0x17'));var hardwareService=require(_0x026c('0x18'));var logger=require('../../config/logger')(_0x026c('0x19'));var utils=require(_0x026c('0x1a'));var config=require(_0x026c('0x1b'));var db=require(_0x026c('0x1c'))['db'];var dbH=require(_0x026c('0x1c'))['dbH'];function respondWithStatusCode(_0x236a3d,_0x129068){_0x129068=_0x129068||0xcc;return function(_0x2d21bd){if(_0x2d21bd){return _0x236a3d[_0x026c('0x1d')](_0x129068);}return _0x236a3d[_0x026c('0x1e')](_0x129068)[_0x026c('0x1f')]();};}function respondWithResult(_0x41bf79,_0x15244d){_0x15244d=_0x15244d||0xc8;return function(_0x38ae73){if(_0x38ae73){return _0x41bf79[_0x026c('0x1e')](_0x15244d)[_0x026c('0x20')](_0x38ae73);}};}function respondWithFilteredResult(_0x5bbf86,_0x4c6056){return function(_0x247727){if(_0x247727){var _0xb206b0=_0x247727[_0x026c('0x21')],_0x8b65d8=_0x4c6056[_0x026c('0x22')],_0x129541=_0x4c6056[_0x026c('0x22')]+_0x4c6056['limit'],_0xd59087;if(_0x129541>=_0xb206b0){_0x129541=_0xb206b0;_0xd59087=0xc8;}else{_0xd59087=0xce;}_0x5bbf86[_0x026c('0x1e')](_0xd59087);return _0x5bbf86['set'](_0x026c('0x23'),_0x8b65d8+'-'+_0x129541+'/'+_0xb206b0)[_0x026c('0x20')](_0x247727);}return null;};}function patchUpdates(_0x5a6734){return function(_0x314d2a){try{jsonpatch[_0x026c('0x24')](_0x314d2a,_0x5a6734,!![]);}catch(_0x5c5564){return BPromise[_0x026c('0x25')](_0x5c5564);}return _0x314d2a[_0x026c('0x26')]();};}function saveUpdates(_0x250839,_0x28270a){return function(_0xee92f2){if(_0xee92f2){return _0xee92f2[_0x026c('0x27')](_0x250839)[_0x026c('0x28')](function(_0x46cfb5){return _0x46cfb5;});}return null;};}function removeEntity(_0x567b36,_0x8d94b3){return function(_0x439514){if(_0x439514){return _0x439514[_0x026c('0x29')]()['then'](function(){var _0x4eda3d=_0x439514[_0x026c('0x2a')]({'plain':!![]});var _0x3c9038=_0x026c('0x2b');return db[_0x026c('0x2c')][_0x026c('0x29')]({'where':{'type':_0x3c9038,'resourceId':_0x4eda3d['id']}})['then'](function(){return _0x439514;});})[_0x026c('0x28')](function(){_0x567b36[_0x026c('0x1e')](0xcc)[_0x026c('0x1f')]();});}};}function handleEntityNotFound(_0x5d91d0,_0x5f2d99){return function(_0x2fb419){if(!_0x2fb419){_0x5d91d0['sendStatus'](0x194);}return _0x2fb419;};}function handleError(_0x54b14e,_0x226798){_0x226798=_0x226798||0x1f4;return function(_0x396467){logger[_0x026c('0x2d')](_0x396467[_0x026c('0x2e')]);if(_0x396467[_0x026c('0x2f')]){delete _0x396467[_0x026c('0x2f')];}_0x54b14e[_0x026c('0x1e')](_0x226798)['send'](_0x396467);};}exports[_0x026c('0x30')]=function(_0x3fdb34,_0x3c001a){var _0x570a05={},_0x1c67a3={},_0x4ae7cc={'count':0x0,'rows':[]};var _0x323b46=_['map'](db[_0x026c('0x31')][_0x026c('0x32')],function(_0x571e95){return{'name':_0x571e95['fieldName'],'type':_0x571e95['type'][_0x026c('0x33')]};});_0x1c67a3[_0x026c('0x34')]=_[_0x026c('0x35')](_0x323b46,_0x026c('0x2f'));_0x1c67a3[_0x026c('0x36')]=_[_0x026c('0x37')](_0x3fdb34[_0x026c('0x36')]);_0x1c67a3['filters']=_['intersection'](_0x1c67a3['model'],_0x1c67a3[_0x026c('0x36')]);_0x570a05['attributes']=_[_0x026c('0x38')](_0x1c67a3[_0x026c('0x34')],qs[_0x026c('0x39')](_0x3fdb34[_0x026c('0x36')][_0x026c('0x39')]));_0x570a05[_0x026c('0x3a')]=_0x570a05[_0x026c('0x3a')][_0x026c('0x3b')]?_0x570a05['attributes']:_0x1c67a3[_0x026c('0x34')];if(!_0x3fdb34[_0x026c('0x36')][_0x026c('0x3c')](_0x026c('0x3d'))){_0x570a05['limit']=qs[_0x026c('0x3e')](_0x3fdb34[_0x026c('0x36')][_0x026c('0x3e')]);_0x570a05[_0x026c('0x22')]=qs[_0x026c('0x22')](_0x3fdb34[_0x026c('0x36')][_0x026c('0x22')]);}_0x570a05['order']=qs['sort'](_0x3fdb34['query'][_0x026c('0x3f')]);_0x570a05[_0x026c('0x40')]=qs[_0x026c('0x41')](_[_0x026c('0x42')](_0x3fdb34['query'],_0x1c67a3['filters']),_0x323b46);if(_0x3fdb34[_0x026c('0x36')]['filter']){_0x570a05[_0x026c('0x40')]=_[_0x026c('0x43')](_0x570a05[_0x026c('0x40')],{'$or':_['map'](_0x323b46,function(_0x512378){if(_0x512378[_0x026c('0x44')]!==_0x026c('0x45')){var _0x4466f4={};_0x4466f4[_0x512378[_0x026c('0x2f')]]={'$like':'%'+_0x3fdb34['query'][_0x026c('0x46')]+'%'};return _0x4466f4;}})});}_0x570a05=_[_0x026c('0x43')]({},_0x570a05,_0x3fdb34[_0x026c('0x47')]);var _0x5f2e9f={'where':_0x570a05['where']};return db[_0x026c('0x31')][_0x026c('0x21')](_0x5f2e9f)[_0x026c('0x28')](function(_0x43840d){_0x4ae7cc[_0x026c('0x21')]=_0x43840d;if(_0x3fdb34[_0x026c('0x36')]['includeAll']){_0x570a05['include']=[{'all':!![]}];}return db['AnalyticDefaultReport'][_0x026c('0x48')](_0x570a05);})[_0x026c('0x28')](function(_0x5f06e4){_0x4ae7cc[_0x026c('0x49')]=_0x5f06e4;return _0x4ae7cc;})['then'](respondWithFilteredResult(_0x3c001a,_0x570a05))['catch'](handleError(_0x3c001a,null));};exports[_0x026c('0x4a')]=function(_0x4734e3,_0x39d76e){var _0x2a9bed={'raw':!![],'where':{'id':_0x4734e3[_0x026c('0x4b')]['id']}},_0x145a13={};_0x145a13[_0x026c('0x34')]=_[_0x026c('0x37')](db['AnalyticDefaultReport'][_0x026c('0x32')]);_0x145a13[_0x026c('0x36')]=_[_0x026c('0x37')](_0x4734e3[_0x026c('0x36')]);_0x145a13[_0x026c('0x41')]=_['intersection'](_0x145a13[_0x026c('0x34')],_0x145a13[_0x026c('0x36')]);_0x2a9bed['attributes']=_['intersection'](_0x145a13[_0x026c('0x34')],qs[_0x026c('0x39')](_0x4734e3[_0x026c('0x36')][_0x026c('0x39')]));_0x2a9bed['attributes']=_0x2a9bed[_0x026c('0x3a')]['length']?_0x2a9bed['attributes']:_0x145a13['model'];if(_0x4734e3[_0x026c('0x36')]['includeAll']){_0x2a9bed[_0x026c('0x4c')]=[{'all':!![]}];}_0x2a9bed=_[_0x026c('0x43')]({},_0x2a9bed,_0x4734e3[_0x026c('0x47')]);return db[_0x026c('0x31')][_0x026c('0x4d')](_0x2a9bed)[_0x026c('0x28')](handleEntityNotFound(_0x39d76e,null))[_0x026c('0x28')](respondWithResult(_0x39d76e,null))['catch'](handleError(_0x39d76e,null));};exports[_0x026c('0x4e')]=function(_0x2b715c,_0x32f500){return db[_0x026c('0x31')][_0x026c('0x4e')](_0x2b715c['body'],{})[_0x026c('0x28')](function(_0x370827){var _0x4863ca=_0x2b715c[_0x026c('0x4f')][_0x026c('0x2a')]({'plain':!![]});if(!_0x4863ca)throw new Error(_0x026c('0x50'));if(_0x4863ca['role']===_0x026c('0x4f')){var _0x2940de=_0x370827[_0x026c('0x2a')]({'plain':!![]});var _0x3ded94=_0x026c('0x51');return db[_0x026c('0x52')][_0x026c('0x4d')]({'where':{'name':_0x3ded94,'userProfileId':_0x4863ca[_0x026c('0x53')]},'raw':!![]})[_0x026c('0x28')](function(_0x37002b){if(_0x37002b&&_0x37002b['autoAssociation']===0x0){return db['UserProfileResource'][_0x026c('0x4e')]({'name':_0x2940de[_0x026c('0x2f')],'resourceId':_0x2940de['id'],'type':'DefaultReports','sectionId':_0x37002b['id']},{})['then'](function(){return _0x370827;});}else{return _0x370827;}})[_0x026c('0x54')](function(_0x39ce6e){logger[_0x026c('0x2d')](_0x026c('0x55'),_0x39ce6e);throw _0x39ce6e;});}return _0x370827;})[_0x026c('0x28')](respondWithResult(_0x32f500,0xc9))['catch'](handleError(_0x32f500,null));};exports[_0x026c('0x27')]=function(_0x2fea44,_0x3c15d6){if(_0x2fea44[_0x026c('0x56')]['id']){delete _0x2fea44[_0x026c('0x56')]['id'];}return db['AnalyticDefaultReport'][_0x026c('0x4d')]({'where':{'id':_0x2fea44['params']['id']}})['then'](handleEntityNotFound(_0x3c15d6,null))[_0x026c('0x28')](saveUpdates(_0x2fea44[_0x026c('0x56')],null))['then'](respondWithResult(_0x3c15d6,null))[_0x026c('0x54')](handleError(_0x3c15d6,null));};exports[_0x026c('0x29')]=function(_0x3ab2d9,_0x3d2e87){return db['AnalyticDefaultReport'][_0x026c('0x4d')]({'where':{'id':_0x3ab2d9['params']['id']}})['then'](handleEntityNotFound(_0x3d2e87,null))[_0x026c('0x28')](removeEntity(_0x3d2e87,null))[_0x026c('0x54')](handleError(_0x3d2e87,null));};exports[_0x026c('0x57')]=function(_0x3dd9e7,_0x58eff7){var _0x13ef00=0xa;var _0x26da73=[_0x026c('0x58'),_0x026c('0x59'),'right_join',_0x026c('0x5a')];var _0x16b9c7={'SUM':_0x026c('0x5b'),'COUNT':_0x026c('0x5c'),'COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':_0x026c('0x5d'),'MIN':'MIN(%s)','AVG':_0x026c('0x5e'),'GROUP_CONCAT':_0x026c('0x5f'),'GROUP_CONCAT ASC':_0x026c('0x60'),'GROUP_CONCAT DESC':_0x026c('0x61')};var _0x1a2c49={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':'DATE(%s)','HOUR':_0x026c('0x62'),'ROUND':_0x026c('0x63'),'UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x44b1b2=function(_0x1840c9){return!_[_0x026c('0x64')]([_0x026c('0x65'),'IS\x20NOT\x20NULL',_0x026c('0x66'),_0x026c('0x67')],_0x1840c9);};var _0x2e92c2=function(_0x2d250a){if(!_0x2d250a||!_0x2d250a['rules'][_0x026c('0x3b')]){return'';}for(var _0x521975='(',_0x5bd7ee=0x0;_0x5bd7ee<_0x2d250a[_0x026c('0x68')][_0x026c('0x3b')];_0x5bd7ee+=0x1){_0x5bd7ee>0x0&&(_0x521975+='\x20'+_0x2d250a[_0x026c('0x69')]+'\x20');_0x521975+=_0x2d250a[_0x026c('0x68')][_0x5bd7ee][_0x026c('0x6a')]?_0x2e92c2(_0x2d250a['rules'][_0x5bd7ee][_0x026c('0x6a')]):_0x2d250a['rules'][_0x5bd7ee][_0x026c('0x6b')]+'\x20'+_0x2d250a[_0x026c('0x68')][_0x5bd7ee][_0x026c('0x6c')]+(_0x44b1b2(_0x2d250a[_0x026c('0x68')][_0x5bd7ee][_0x026c('0x6c')])?'\x20'+_0x2d250a['rules'][_0x5bd7ee][_0x026c('0x6d')]:'');}return _0x521975+')';};var _0x50cfa6={'where':{'id':_0x3dd9e7['params']['id']}},_0x3e9447,_0x54c32e,_0x500216,_0x527a23,_0x161d5f;_0x50cfa6=_['merge']({},_0x50cfa6,_0x3dd9e7[_0x026c('0x47')]);return db[_0x026c('0x31')]['find'](_0x50cfa6)[_0x026c('0x28')](function(_0x271695){if(_0x271695){_0x3e9447=_0x271695;return _0x271695['getFields']();}return null;})['then'](function(_0x18a31e){if(_0x18a31e){if(!_0x18a31e[_0x026c('0x3b')]){throw new db['Sequelize']['ValidationErrorItem']('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x54c32e=_0x18a31e;return db['AnalyticMetric'][_0x026c('0x48')]({'raw':!![]});}return null;})[_0x026c('0x28')](function(_0x35aae0){if(_0x35aae0){_0x500216=_[_0x026c('0x6e')](_0x35aae0,'id');var _0x4e1222;var _0x2ae9e6=squel[_0x026c('0x6f')]();_0x2ae9e6[_0x026c('0x70')](_0x3e9447['table']);for(var _0x8e0dfa=0x0;_0x8e0dfa<_0x54c32e['length'];_0x8e0dfa+=0x1){_0x4e1222=_0x54c32e[_0x8e0dfa]['MetricId']?_0x500216[_0x54c32e[_0x8e0dfa][_0x026c('0x71')]][_0x026c('0x72')]:_0x54c32e[_0x8e0dfa]['field'];_0x4e1222=_0x54c32e[_0x8e0dfa][_0x026c('0x73')]?_[_0x026c('0x74')](_0x16b9c7[_0x54c32e[_0x8e0dfa][_0x026c('0x73')]],'%s',_0x4e1222):_0x4e1222;_0x4e1222=_0x54c32e[_0x8e0dfa][_0x026c('0x75')]?_[_0x026c('0x74')](_0x1a2c49[_0x54c32e[_0x8e0dfa]['format']],'%s',_0x4e1222):_0x4e1222;if(_0x54c32e[_0x8e0dfa][_0x026c('0x76')]){_0x2ae9e6[_0x026c('0x6a')](_0x4e1222);}_0x54c32e[_0x8e0dfa]['orderBy']&&_0x2ae9e6['order'](_0x4e1222,_0x54c32e[_0x8e0dfa][_0x026c('0x77')]===_0x026c('0x78')?![]:!![]);_0x2ae9e6[_0x026c('0x6b')](_0x4e1222,_0x54c32e[_0x8e0dfa][_0x026c('0x79')]||_0x4e1222);}if(_0x3e9447['joins']){_0x3e9447[_0x026c('0x7a')]=JSON[_0x026c('0x7b')](_0x3e9447[_0x026c('0x7a')]);for(var _0x417d04=0x0;_0x417d04<_0x3e9447[_0x026c('0x7a')][_0x026c('0x3b')];_0x417d04+=0x1){if(_0x3e9447[_0x026c('0x7a')][_0x417d04]['type']&&_[_0x026c('0x64')](_0x26da73,_0x3e9447[_0x026c('0x7a')][_0x417d04]['type'])&&_0x3e9447[_0x026c('0x7a')][_0x417d04][_0x026c('0x7c')]&&_0x3e9447['joins'][_0x417d04][_0x026c('0x7d')]&&_0x3e9447[_0x026c('0x7a')][_0x417d04][_0x026c('0x7e')]){_0x2ae9e6[_0x3e9447[_0x026c('0x7a')][_0x417d04][_0x026c('0x44')]](_0x3e9447['joins'][_0x417d04]['foreignTable'],null,util[_0x026c('0x75')](_0x026c('0x7f'),_0x3e9447[_0x026c('0x80')],_0x3e9447['joins'][_0x417d04][_0x026c('0x7c')],_0x3e9447[_0x026c('0x7a')][_0x417d04][_0x026c('0x7d')],_0x3e9447[_0x026c('0x7a')][_0x417d04][_0x026c('0x7e')]));}}}if(_0x3e9447[_0x026c('0x81')]){_0x3e9447[_0x026c('0x81')]=JSON[_0x026c('0x7b')](_0x3e9447['conditions']);_0x2ae9e6['where'](_0x2e92c2(_0x3e9447[_0x026c('0x81')][_0x026c('0x6a')]));}_0x161d5f=_0x2ae9e6[_0x026c('0x82')]();_0x2ae9e6[_0x026c('0x3e')](_0x13ef00);_0x2ae9e6[_0x026c('0x22')](0x0);logger[_0x026c('0x83')](_0x026c('0x84'),_0x2ae9e6[_0x026c('0x85')]());return db['sequelize'][_0x026c('0x36')](_0x2ae9e6[_0x026c('0x85')](),{'type':db[_0x026c('0x86')]['QueryTypes'][_0x026c('0x87')]});}})['then'](respondWithResult(_0x58eff7,null))[_0x026c('0x54')](handleError(_0x58eff7,null));};function runReport(_0x30f8c6,_0x552299,_0x66e736){var _0xa70e87=_0x552299[_0x026c('0x2f')];var _0x32f60a=0xa;var _0x5a1102=[_0x026c('0x58'),_0x026c('0x59'),_0x026c('0x88'),'cross_join'];var _0x55ea15={'SUM':_0x026c('0x5b'),'COUNT':_0x026c('0x5c'),'COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':_0x026c('0x5d'),'MIN':_0x026c('0x89'),'AVG':_0x026c('0x5e'),'GROUP_CONCAT':_0x026c('0x5f'),'GROUP_CONCAT ASC':_0x026c('0x60'),'GROUP_CONCAT DESC':_0x026c('0x61')};var _0x1615da={'SEC_TO_TIME':_0x026c('0x8a'),'DATE':_0x026c('0x8b'),'HOUR':_0x026c('0x62'),'ROUND':'ROUND(%s)','UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x45c671=function(_0x464b06){return!_[_0x026c('0x64')](['IS\x20NULL','IS\x20NOT\x20NULL',_0x026c('0x66'),_0x026c('0x67')],_0x464b06);};var _0x4e26b8=function(_0x664c8c){if(!_0x664c8c||!_0x664c8c['rules'][_0x026c('0x3b')]){return'';}for(var _0x505f82='(',_0x2d8423=0x0;_0x2d8423<_0x664c8c[_0x026c('0x68')]['length'];_0x2d8423+=0x1){_0x2d8423>0x0&&(_0x505f82+='\x20'+_0x664c8c[_0x026c('0x69')]+'\x20');_0x505f82+=_0x664c8c[_0x026c('0x68')][_0x2d8423][_0x026c('0x6a')]?_0x4e26b8(_0x664c8c[_0x026c('0x68')][_0x2d8423][_0x026c('0x6a')]):_0x664c8c[_0x026c('0x68')][_0x2d8423][_0x026c('0x6b')]+'\x20'+_0x664c8c['rules'][_0x2d8423]['condition']+(_0x45c671(_0x664c8c['rules'][_0x2d8423][_0x026c('0x6c')])?'\x20'+_0x664c8c['rules'][_0x2d8423][_0x026c('0x6d')]:'');}return _0x505f82+')';};var _0x4eb90d={'where':{'id':_0x30f8c6['id']}},_0x1e2fe4,_0x591650,_0x446a5a,_0x4b2c93,_0x1082bc;_0x4eb90d=_['merge']({},_0x4eb90d,_0x66e736);return db['AnalyticDefaultReport'][_0x026c('0x4d')](_0x4eb90d)[_0x026c('0x28')](function(_0x55798b){if(_0x55798b){_0x1e2fe4=_0x55798b;return _0x55798b[_0x026c('0x8c')]();}return null;})[_0x026c('0x28')](function(_0xfa2ba8){if(_0xfa2ba8){if(!_0xfa2ba8[_0x026c('0x3b')]){throw new db[(_0x026c('0x8d'))][(_0x026c('0x8e'))]('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x591650=_0xfa2ba8;return db[_0x026c('0x8f')][_0x026c('0x48')]({'raw':!![]});}return null;})[_0x026c('0x28')](function(_0x29f6a4){if(_0x29f6a4){_0x446a5a=_['keyBy'](_0x29f6a4,'id');var _0x5c9c64;var _0x303f7e=squel[_0x026c('0x6f')]();_0x303f7e[_0x026c('0x70')](_0x1e2fe4[_0x026c('0x80')]);for(var _0x2e0e74=0x0;_0x2e0e74<_0x591650[_0x026c('0x3b')];_0x2e0e74+=0x1){_0x5c9c64=_0x591650[_0x2e0e74][_0x026c('0x71')]?_0x446a5a[_0x591650[_0x2e0e74][_0x026c('0x71')]][_0x026c('0x72')]:_0x591650[_0x2e0e74][_0x026c('0x6b')];_0x5c9c64=_0x591650[_0x2e0e74][_0x026c('0x73')]?_['replace'](_0x55ea15[_0x591650[_0x2e0e74]['function']],'%s',_0x5c9c64):_0x5c9c64;_0x5c9c64=_0x591650[_0x2e0e74]['format']?_['replace'](_0x1615da[_0x591650[_0x2e0e74][_0x026c('0x75')]],'%s',_0x5c9c64):_0x5c9c64;if(_0x591650[_0x2e0e74][_0x026c('0x76')]){_0x303f7e[_0x026c('0x6a')](_0x5c9c64);}_0x591650[_0x2e0e74][_0x026c('0x77')]&&_0x303f7e['order'](_0x5c9c64,_0x591650[_0x2e0e74][_0x026c('0x77')]===_0x026c('0x78')?![]:!![]);_0x303f7e[_0x026c('0x6b')](_0x5c9c64,_0x591650[_0x2e0e74][_0x026c('0x79')]||_0x5c9c64);}if(_0x1e2fe4[_0x026c('0x7a')]){_0x1e2fe4[_0x026c('0x7a')]=JSON[_0x026c('0x7b')](_0x1e2fe4[_0x026c('0x7a')]);for(var _0x3f0727=0x0;_0x3f0727<_0x1e2fe4[_0x026c('0x7a')]['length'];_0x3f0727+=0x1){if(_0x1e2fe4[_0x026c('0x7a')][_0x3f0727][_0x026c('0x44')]&&_[_0x026c('0x64')](_0x5a1102,_0x1e2fe4['joins'][_0x3f0727][_0x026c('0x44')])&&_0x1e2fe4['joins'][_0x3f0727][_0x026c('0x7c')]&&_0x1e2fe4[_0x026c('0x7a')][_0x3f0727][_0x026c('0x7d')]&&_0x1e2fe4[_0x026c('0x7a')][_0x3f0727]['foreignKey']){_0x303f7e[_0x1e2fe4['joins'][_0x3f0727][_0x026c('0x44')]](_0x1e2fe4['joins'][_0x3f0727]['foreignTable'],null,util['format']('%s.%s\x20=\x20%s.%s',_0x1e2fe4[_0x026c('0x80')],_0x1e2fe4[_0x026c('0x7a')][_0x3f0727][_0x026c('0x7c')],_0x1e2fe4[_0x026c('0x7a')][_0x3f0727][_0x026c('0x7d')],_0x1e2fe4['joins'][_0x3f0727][_0x026c('0x7e')]));}}}if(_0x1e2fe4[_0x026c('0x81')]){_0x1e2fe4[_0x026c('0x81')]=JSON[_0x026c('0x7b')](_0x1e2fe4[_0x026c('0x81')]);_0x303f7e[_0x026c('0x40')](_0x4e26b8(_0x1e2fe4['conditions'][_0x026c('0x6a')]));}_0x1082bc=_0x303f7e['clone']();_0x303f7e[_0x026c('0x3e')](_0x32f60a);_0x303f7e[_0x026c('0x22')](0x0);logger[_0x026c('0x83')](_0x026c('0x84'),_0x303f7e[_0x026c('0x85')]());return db[_0x026c('0x86')][_0x026c('0x36')](_0x303f7e['toString'](),{'type':db['sequelize'][_0x026c('0x90')][_0x026c('0x87')]});}})[_0x026c('0x28')](function(_0x906756){if(!_0x906756[_0x026c('0x3b')]){throw new db[(_0x026c('0x8d'))][(_0x026c('0x8e'))](_0x026c('0x91'),0xcc);}if(_0x552299[_0x026c('0x92')]===_0x026c('0x93')){return null;}var _0x1df577=_[_0x026c('0x43')](_0x552299,{'name':_0x552299[_0x026c('0x94')]||_0x552299['name']||_0x1e2fe4[_0x026c('0x2f')],'basename':_0xa70e87,'savename':util[_0x026c('0x75')](_0x026c('0x95'),_0x552299[_0x026c('0x2f')]||_0x1e2fe4['name'],require(_0x026c('0x96'))['generate'](0x4),_0x552299[_0x026c('0x92')]||_0x026c('0x97')),'reportId':_0x1e2fe4['id'],'reportType':'default'});return db[_0x026c('0x98')][_0x026c('0x4e')](_0x1df577,{'raw':!![]});})[_0x026c('0x28')](function(_0xfdded5){if(_0x1e2fe4[_0x026c('0x80')]==='cdr'){_0x1082bc['where'](_0x1e2fe4[_0x026c('0x80')]+_0x026c('0x99'),_0x552299[_0x026c('0x9a')],_0x552299[_0x026c('0x9b')]);}else{_0x1082bc[_0x026c('0x40')](_0x1e2fe4[_0x026c('0x80')]+_0x026c('0x9c'),_0x552299[_0x026c('0x9a')],_0x552299[_0x026c('0x9b')]);}if(_0xfdded5){logger[_0x026c('0x9d')](_0x026c('0x9e'),_0x1082bc[_0x026c('0x85')]());require(_0x026c('0x9f'))[_0x026c('0xa0')](path[_0x026c('0x58')](__dirname,_0x026c('0xa1'),_0xfdded5[_0x026c('0x92')]),[_0xfdded5['id'],_0x1082bc[_0x026c('0x85')](),path[_0x026c('0x58')](__dirname,'../../files/reports',_0xfdded5['savename']),_0xa70e87]);return _0xfdded5;}else{var _0x5e52ab=squel['select']();_0x5e52ab['from']('('+_0x1082bc[_0x026c('0x85')]()+')',_0x026c('0xa2'));_0x5e52ab['field']('COUNT(*)',_0x026c('0x21'));_0x1082bc[_0x026c('0x3e')](_0x552299['limit']||_0x32f60a);_0x1082bc[_0x026c('0x22')](_0x552299[_0x026c('0x22')]||0x0);return dbH[_0x026c('0x86')][_0x026c('0x36')](_0x5e52ab[_0x026c('0x85')](),{'type':dbH['sequelize'][_0x026c('0x90')][_0x026c('0x87')]})[_0x026c('0x28')](function(_0xd1447f){if(!_0xd1447f['length']){_0x4b2c93=0x0;}else{_0x4b2c93=_0xd1447f[0x0][_0x026c('0x21')]||0x0;}return dbH['sequelize']['query'](_0x1082bc[_0x026c('0x85')](),{'type':dbH[_0x026c('0x86')][_0x026c('0x90')]['SELECT']});})[_0x026c('0x28')](function(_0x52e296){return{'rows':_0x52e296||[],'count':_0x4b2c93};});}});}exports[_0x026c('0xa3')]=function(_0x54637e,_0x36689d){return runReport(_0x54637e[_0x026c('0x4b')],_0x54637e[_0x026c('0x36')],_0x54637e[_0x026c('0x47')])[_0x026c('0x28')](respondWithResult(_0x36689d,null))[_0x026c('0x54')](handleError(_0x36689d,null));};exports[_0x026c('0xa4')]=runReport;exports[_0x026c('0x36')]=function(_0x3543e0,_0x52db5e){var _0x161da5=0xa;var _0x2a6db3=['join',_0x026c('0x59'),'right_join',_0x026c('0x5a')];var _0x299d40={'SUM':_0x026c('0x5b'),'COUNT':'COUNT(%s)','COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':_0x026c('0x5d'),'MIN':_0x026c('0x89'),'AVG':_0x026c('0x5e'),'GROUP_CONCAT':_0x026c('0x5f'),'GROUP_CONCAT ASC':_0x026c('0x60'),'GROUP_CONCAT DESC':_0x026c('0x61')};var _0x2b4423={'SEC_TO_TIME':_0x026c('0x8a'),'DATE':'DATE(%s)','HOUR':'HOUR(%s)','ROUND':_0x026c('0x63'),'UNIX_TIMESTAMP':_0x026c('0xa5')};var _0x55dcf9=function(_0x20d342){return!_['includes'](['IS\x20NULL',_0x026c('0xa6'),'IS\x20EMPTY',_0x026c('0x67')],_0x20d342);};var _0x166712=function(_0x3421c2){if(!_0x3421c2||!_0x3421c2[_0x026c('0x68')][_0x026c('0x3b')]){return'';}for(var _0x16dfb3='(',_0x4535bf=0x0;_0x4535bf<_0x3421c2['rules'][_0x026c('0x3b')];_0x4535bf+=0x1){_0x4535bf>0x0&&(_0x16dfb3+='\x20'+_0x3421c2[_0x026c('0x69')]+'\x20');_0x16dfb3+=_0x3421c2['rules'][_0x4535bf][_0x026c('0x6a')]?_0x166712(_0x3421c2[_0x026c('0x68')][_0x4535bf]['group']):_0x3421c2['rules'][_0x4535bf]['field']+'\x20'+_0x3421c2[_0x026c('0x68')][_0x4535bf]['condition']+(_0x55dcf9(_0x3421c2[_0x026c('0x68')][_0x4535bf][_0x026c('0x6c')])?'\x20'+_0x3421c2['rules'][_0x4535bf][_0x026c('0x6d')]:'');}return _0x16dfb3+')';};var _0x584f93={'where':{'id':_0x3543e0[_0x026c('0x4b')]['id']}},_0x21ab76,_0x3bc6bb,_0x42c43e,_0x1b6cb4,_0xbdcc2b;_0x584f93=_[_0x026c('0x43')]({},_0x584f93,_0x3543e0[_0x026c('0x47')]);return db[_0x026c('0x31')][_0x026c('0x4d')](_0x584f93)[_0x026c('0x28')](function(_0x147744){if(_0x147744){_0x21ab76=_0x147744;return _0x147744[_0x026c('0x8c')]();}return null;})['then'](function(_0x38cac0){if(_0x38cac0){if(!_0x38cac0[_0x026c('0x3b')]){throw new db['Sequelize'][(_0x026c('0x8e'))](_0x026c('0xa7'),0x193);}_0x3bc6bb=_0x38cac0;return db['AnalyticMetric'][_0x026c('0x48')]({'raw':!![]});}return null;})['then'](function(_0x31ec3){if(_0x31ec3){_0x42c43e=_[_0x026c('0x6e')](_0x31ec3,'id');var _0x12c814;var _0x15495d=squel[_0x026c('0x6f')]();_0x15495d[_0x026c('0x70')](_0x21ab76['table']);for(var _0x5680c4=0x0;_0x5680c4<_0x3bc6bb['length'];_0x5680c4+=0x1){_0x12c814=_0x3bc6bb[_0x5680c4][_0x026c('0x71')]?_0x42c43e[_0x3bc6bb[_0x5680c4]['MetricId']][_0x026c('0x72')]:_0x3bc6bb[_0x5680c4][_0x026c('0x6b')];_0x12c814=_0x3bc6bb[_0x5680c4][_0x026c('0x73')]?_[_0x026c('0x74')](_0x299d40[_0x3bc6bb[_0x5680c4][_0x026c('0x73')]],'%s',_0x12c814):_0x12c814;_0x12c814=_0x3bc6bb[_0x5680c4][_0x026c('0x75')]?_[_0x026c('0x74')](_0x2b4423[_0x3bc6bb[_0x5680c4][_0x026c('0x75')]],'%s',_0x12c814):_0x12c814;if(_0x3bc6bb[_0x5680c4][_0x026c('0x76')]){_0x15495d[_0x026c('0x6a')](_0x12c814);}_0x3bc6bb[_0x5680c4]['orderBy']&&_0x15495d['order'](_0x12c814,_0x3bc6bb[_0x5680c4][_0x026c('0x77')]==='DESC'?![]:!![]);_0x15495d[_0x026c('0x6b')](_0x12c814,_0x3bc6bb[_0x5680c4][_0x026c('0x79')]||_0x12c814);}if(_0x21ab76['joins']){_0x21ab76[_0x026c('0x7a')]=JSON[_0x026c('0x7b')](_0x21ab76[_0x026c('0x7a')]);for(var _0x57400e=0x0;_0x57400e<_0x21ab76[_0x026c('0x7a')][_0x026c('0x3b')];_0x57400e+=0x1){if(_0x21ab76['joins'][_0x57400e][_0x026c('0x44')]&&_[_0x026c('0x64')](_0x2a6db3,_0x21ab76[_0x026c('0x7a')][_0x57400e][_0x026c('0x44')])&&_0x21ab76[_0x026c('0x7a')][_0x57400e][_0x026c('0x7c')]&&_0x21ab76[_0x026c('0x7a')][_0x57400e][_0x026c('0x7d')]&&_0x21ab76[_0x026c('0x7a')][_0x57400e][_0x026c('0x7e')]){_0x15495d[_0x21ab76[_0x026c('0x7a')][_0x57400e]['type']](_0x21ab76['joins'][_0x57400e][_0x026c('0x7d')],null,util[_0x026c('0x75')](_0x026c('0x7f'),_0x21ab76[_0x026c('0x80')],_0x21ab76['joins'][_0x57400e][_0x026c('0x7c')],_0x21ab76[_0x026c('0x7a')][_0x57400e][_0x026c('0x7d')],_0x21ab76[_0x026c('0x7a')][_0x57400e]['foreignKey']));}}}if(_0x21ab76[_0x026c('0x81')]){_0x21ab76[_0x026c('0x81')]=JSON['parse'](_0x21ab76[_0x026c('0x81')]);_0x15495d[_0x026c('0x40')](_0x166712(_0x21ab76['conditions']['group']));}_0xbdcc2b=_0x15495d[_0x026c('0x82')]();_0x15495d[_0x026c('0x3e')](_0x161da5);_0x15495d['offset'](0x0);logger[_0x026c('0x83')]('Limited\x20Query:',_0x15495d['toString']());return db[_0x026c('0x86')]['query'](_0x15495d[_0x026c('0x85')](),{'type':db[_0x026c('0x86')]['QueryTypes'][_0x026c('0x87')]});}})[_0x026c('0x28')](function(){return{'sql':_0xbdcc2b['toString']()};})[_0x026c('0x28')](respondWithResult(_0x52db5e,null))[_0x026c('0x54')](handleError(_0x52db5e,null));}; \ No newline at end of file +var _0xfefa=['where','pick','filter','type','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','params','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Reports','UserProfileSection','find','userProfileId','autoAssociation','DefaultReports','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','join','left_join','cross_join','COUNT(%s)','COUNT(DISTINCT\x20%s)','MAX(%s)','MIN(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','DATE(%s)','HOUR(%s)','UNIX_TIMESTAMP(%s)','IS\x20NULL','IS\x20NOT\x20NULL','IS\x20EMPTY','IS\x20NOT\x20EMPTY','rules','group','field','condition','value','getFields','Sequelize','ValidationErrorItem','Please\x20insert\x20at\x20least\x20one\x20field','AnalyticMetric','keyBy','select','from','MetricId','metric','function','replace','format','groupBy','orderBy','order','joins','parse','includes','parentKey','foreignTable','foreignKey','%s.%s\x20=\x20%s.%s','conditions','clone','debug','Limited\x20Query:','toString','sequelize','QueryTypes','SELECT','right_join','SUM(%s)','AVG(%s)','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','ROUND(%s)','operator','table','DESC','No\x20available\x20data','output','web','%s-%s.%s','randomstring','generate','csv','default','cdr','endDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','startDate','child_process','../../files/reports','COUNT(*)','run','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','util','path','sox','lodash','squel','crypto','jsforce','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','dbH','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','update','destroy','UserProfileResource','then','error','stack','name','send','map','AnalyticDefaultReport','rawAttributes','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','sort'];(function(_0x455150,_0x274121){var _0x12ca9c=function(_0x47eb22){while(--_0x47eb22){_0x455150['push'](_0x455150['shift']());}};_0x12ca9c(++_0x274121);}(_0xfefa,0xff));var _0xafef=function(_0x1fc6a6,_0x57c2e3){_0x1fc6a6=_0x1fc6a6-0x0;var _0x133140=_0xfefa[_0x1fc6a6];return _0x133140;};'use strict';var pdf=require(_0xafef('0x0'));var emlformat=require(_0xafef('0x1'));var rimraf=require(_0xafef('0x2'));var zipdir=require(_0xafef('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0xafef('0x4'));var moment=require(_0xafef('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xafef('0x6'));var path=require(_0xafef('0x7'));var sox=require(_0xafef('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0xafef('0x9'));var squel=require(_0xafef('0xa'));var crypto=require(_0xafef('0xb'));var jsforce=require(_0xafef('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xafef('0xd'));var Redis=require('ioredis');var authService=require(_0xafef('0xe'));var qs=require(_0xafef('0xf'));var as=require(_0xafef('0x10'));var hardwareService=require(_0xafef('0x11'));var logger=require(_0xafef('0x12'))(_0xafef('0x13'));var utils=require('../../config/utils');var config=require(_0xafef('0x14'));var db=require(_0xafef('0x15'))['db'];var dbH=require('../../mysqldb')[_0xafef('0x16')];function respondWithStatusCode(_0x4bc795,_0x3f37c9){_0x3f37c9=_0x3f37c9||0xcc;return function(_0xcf8f55){if(_0xcf8f55){return _0x4bc795[_0xafef('0x17')](_0x3f37c9);}return _0x4bc795[_0xafef('0x18')](_0x3f37c9)[_0xafef('0x19')]();};}function respondWithResult(_0x45c413,_0x1b1787){_0x1b1787=_0x1b1787||0xc8;return function(_0x5516fd){if(_0x5516fd){return _0x45c413[_0xafef('0x18')](_0x1b1787)[_0xafef('0x1a')](_0x5516fd);}};}function respondWithFilteredResult(_0x35c46b,_0xaaade1){return function(_0x20ddeb){if(_0x20ddeb){var _0x50450c=_0x20ddeb[_0xafef('0x1b')],_0x577c75=_0xaaade1[_0xafef('0x1c')],_0x23bffe=_0xaaade1[_0xafef('0x1c')]+_0xaaade1[_0xafef('0x1d')],_0x130f70;if(_0x23bffe>=_0x50450c){_0x23bffe=_0x50450c;_0x130f70=0xc8;}else{_0x130f70=0xce;}_0x35c46b[_0xafef('0x18')](_0x130f70);return _0x35c46b[_0xafef('0x1e')](_0xafef('0x1f'),_0x577c75+'-'+_0x23bffe+'/'+_0x50450c)[_0xafef('0x1a')](_0x20ddeb);}return null;};}function patchUpdates(_0x469563){return function(_0x14a26d){try{jsonpatch[_0xafef('0x20')](_0x14a26d,_0x469563,!![]);}catch(_0x2f709c){return BPromise['reject'](_0x2f709c);}return _0x14a26d['save']();};}function saveUpdates(_0x525bb5,_0x3b29fc){return function(_0x42bb12){if(_0x42bb12){return _0x42bb12[_0xafef('0x21')](_0x525bb5)['then'](function(_0x1417bf){return _0x1417bf;});}return null;};}function removeEntity(_0x5837cd,_0x492aaf){return function(_0x5c9684){if(_0x5c9684){return _0x5c9684[_0xafef('0x22')]()['then'](function(){var _0x2b2dcd=_0x5c9684['get']({'plain':!![]});var _0x342127='DefaultReports';return db[_0xafef('0x23')][_0xafef('0x22')]({'where':{'type':_0x342127,'resourceId':_0x2b2dcd['id']}})[_0xafef('0x24')](function(){return _0x5c9684;});})[_0xafef('0x24')](function(){_0x5837cd[_0xafef('0x18')](0xcc)[_0xafef('0x19')]();});}};}function handleEntityNotFound(_0x2844c1,_0x22de9c){return function(_0x207e0d){if(!_0x207e0d){_0x2844c1[_0xafef('0x17')](0x194);}return _0x207e0d;};}function handleError(_0x1732d7,_0x4edefa){_0x4edefa=_0x4edefa||0x1f4;return function(_0x158aa3){logger[_0xafef('0x25')](_0x158aa3[_0xafef('0x26')]);if(_0x158aa3[_0xafef('0x27')]){delete _0x158aa3[_0xafef('0x27')];}_0x1732d7['status'](_0x4edefa)[_0xafef('0x28')](_0x158aa3);};}exports['index']=function(_0x3893de,_0x375fd2){var _0x1e7ce7={},_0x42351e={},_0x1ba917={'count':0x0,'rows':[]};var _0x356e8a=_[_0xafef('0x29')](db[_0xafef('0x2a')][_0xafef('0x2b')],function(_0x387125){return{'name':_0x387125['fieldName'],'type':_0x387125['type'][_0xafef('0x2c')]};});_0x42351e[_0xafef('0x2d')]=_['map'](_0x356e8a,_0xafef('0x27'));_0x42351e[_0xafef('0x2e')]=_[_0xafef('0x2f')](_0x3893de[_0xafef('0x2e')]);_0x42351e[_0xafef('0x30')]=_[_0xafef('0x31')](_0x42351e[_0xafef('0x2d')],_0x42351e[_0xafef('0x2e')]);_0x1e7ce7[_0xafef('0x32')]=_['intersection'](_0x42351e[_0xafef('0x2d')],qs['fields'](_0x3893de['query'][_0xafef('0x33')]));_0x1e7ce7['attributes']=_0x1e7ce7[_0xafef('0x32')][_0xafef('0x34')]?_0x1e7ce7['attributes']:_0x42351e['model'];if(!_0x3893de[_0xafef('0x2e')]['hasOwnProperty'](_0xafef('0x35'))){_0x1e7ce7[_0xafef('0x1d')]=qs[_0xafef('0x1d')](_0x3893de['query'][_0xafef('0x1d')]);_0x1e7ce7[_0xafef('0x1c')]=qs['offset'](_0x3893de['query'][_0xafef('0x1c')]);}_0x1e7ce7['order']=qs[_0xafef('0x36')](_0x3893de[_0xafef('0x2e')][_0xafef('0x36')]);_0x1e7ce7[_0xafef('0x37')]=qs[_0xafef('0x30')](_[_0xafef('0x38')](_0x3893de[_0xafef('0x2e')],_0x42351e[_0xafef('0x30')]),_0x356e8a);if(_0x3893de[_0xafef('0x2e')][_0xafef('0x39')]){_0x1e7ce7['where']=_['merge'](_0x1e7ce7[_0xafef('0x37')],{'$or':_['map'](_0x356e8a,function(_0x12c42e){if(_0x12c42e[_0xafef('0x3a')]!==_0xafef('0x3b')){var _0x415343={};_0x415343[_0x12c42e[_0xafef('0x27')]]={'$like':'%'+_0x3893de[_0xafef('0x2e')]['filter']+'%'};return _0x415343;}})});}_0x1e7ce7=_[_0xafef('0x3c')]({},_0x1e7ce7,_0x3893de[_0xafef('0x3d')]);var _0x163e07={'where':_0x1e7ce7[_0xafef('0x37')]};return db[_0xafef('0x2a')][_0xafef('0x1b')](_0x163e07)[_0xafef('0x24')](function(_0x355786){_0x1ba917[_0xafef('0x1b')]=_0x355786;if(_0x3893de[_0xafef('0x2e')][_0xafef('0x3e')]){_0x1e7ce7[_0xafef('0x3f')]=[{'all':!![]}];}return db[_0xafef('0x2a')][_0xafef('0x40')](_0x1e7ce7);})['then'](function(_0x114568){_0x1ba917[_0xafef('0x41')]=_0x114568;return _0x1ba917;})[_0xafef('0x24')](respondWithFilteredResult(_0x375fd2,_0x1e7ce7))[_0xafef('0x42')](handleError(_0x375fd2,null));};exports['show']=function(_0x5ca073,_0x15ef41){var _0x5b832a={'raw':!![],'where':{'id':_0x5ca073[_0xafef('0x43')]['id']}},_0x1aafab={};_0x1aafab[_0xafef('0x2d')]=_[_0xafef('0x2f')](db[_0xafef('0x2a')][_0xafef('0x2b')]);_0x1aafab[_0xafef('0x2e')]=_[_0xafef('0x2f')](_0x5ca073[_0xafef('0x2e')]);_0x1aafab[_0xafef('0x30')]=_[_0xafef('0x31')](_0x1aafab[_0xafef('0x2d')],_0x1aafab[_0xafef('0x2e')]);_0x5b832a[_0xafef('0x32')]=_[_0xafef('0x31')](_0x1aafab[_0xafef('0x2d')],qs[_0xafef('0x33')](_0x5ca073[_0xafef('0x2e')][_0xafef('0x33')]));_0x5b832a['attributes']=_0x5b832a[_0xafef('0x32')][_0xafef('0x34')]?_0x5b832a[_0xafef('0x32')]:_0x1aafab['model'];if(_0x5ca073[_0xafef('0x2e')][_0xafef('0x3e')]){_0x5b832a[_0xafef('0x3f')]=[{'all':!![]}];}_0x5b832a=_['merge']({},_0x5b832a,_0x5ca073['options']);return db[_0xafef('0x2a')]['find'](_0x5b832a)[_0xafef('0x24')](handleEntityNotFound(_0x15ef41,null))['then'](respondWithResult(_0x15ef41,null))[_0xafef('0x42')](handleError(_0x15ef41,null));};exports[_0xafef('0x44')]=function(_0xae2d7e,_0x5530e9){return db[_0xafef('0x2a')][_0xafef('0x44')](_0xae2d7e[_0xafef('0x45')],{})['then'](function(_0x11ce6d){var _0x4819ee=_0xae2d7e['user']['get']({'plain':!![]});if(!_0x4819ee)throw new Error(_0xafef('0x46'));if(_0x4819ee[_0xafef('0x47')]==='user'){var _0x1fc54d=_0x11ce6d['get']({'plain':!![]});var _0x234847=_0xafef('0x48');return db[_0xafef('0x49')][_0xafef('0x4a')]({'where':{'name':_0x234847,'userProfileId':_0x4819ee[_0xafef('0x4b')]},'raw':!![]})['then'](function(_0x54bbee){if(_0x54bbee&&_0x54bbee[_0xafef('0x4c')]===0x0){return db[_0xafef('0x23')][_0xafef('0x44')]({'name':_0x1fc54d['name'],'resourceId':_0x1fc54d['id'],'type':_0xafef('0x4d'),'sectionId':_0x54bbee['id']},{})[_0xafef('0x24')](function(){return _0x11ce6d;});}else{return _0x11ce6d;}})['catch'](function(_0x55cbc3){logger[_0xafef('0x25')](_0xafef('0x4e'),_0x55cbc3);throw _0x55cbc3;});}return _0x11ce6d;})[_0xafef('0x24')](respondWithResult(_0x5530e9,0xc9))[_0xafef('0x42')](handleError(_0x5530e9,null));};exports[_0xafef('0x21')]=function(_0x21b9c7,_0x41bfe1){if(_0x21b9c7['body']['id']){delete _0x21b9c7[_0xafef('0x45')]['id'];}return db[_0xafef('0x2a')]['find']({'where':{'id':_0x21b9c7[_0xafef('0x43')]['id']}})['then'](handleEntityNotFound(_0x41bfe1,null))[_0xafef('0x24')](saveUpdates(_0x21b9c7['body'],null))[_0xafef('0x24')](respondWithResult(_0x41bfe1,null))[_0xafef('0x42')](handleError(_0x41bfe1,null));};exports['destroy']=function(_0x492265,_0x1423d5){return db[_0xafef('0x2a')][_0xafef('0x4a')]({'where':{'id':_0x492265[_0xafef('0x43')]['id']}})['then'](handleEntityNotFound(_0x1423d5,null))[_0xafef('0x24')](removeEntity(_0x1423d5,null))[_0xafef('0x42')](handleError(_0x1423d5,null));};exports['preview']=function(_0x5ed0b4,_0x44f0a2){var _0xd4e54=0xa;var _0x4bfdc2=[_0xafef('0x4f'),_0xafef('0x50'),'right_join',_0xafef('0x51')];var _0x43c440={'SUM':'SUM(%s)','COUNT':_0xafef('0x52'),'COUNT DISTINCT':_0xafef('0x53'),'MAX':_0xafef('0x54'),'MIN':_0xafef('0x55'),'AVG':'AVG(%s)','GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0xafef('0x56')};var _0x9c8c42={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':_0xafef('0x57'),'HOUR':_0xafef('0x58'),'ROUND':'ROUND(%s)','UNIX_TIMESTAMP':_0xafef('0x59')};var _0x6c9977=function(_0x390010){return!_['includes']([_0xafef('0x5a'),_0xafef('0x5b'),_0xafef('0x5c'),_0xafef('0x5d')],_0x390010);};var _0x45e42c=function(_0x26a58d){if(!_0x26a58d||!_0x26a58d[_0xafef('0x5e')][_0xafef('0x34')]){return'';}for(var _0x3fc211='(',_0x5ecb94=0x0;_0x5ecb94<_0x26a58d[_0xafef('0x5e')][_0xafef('0x34')];_0x5ecb94+=0x1){_0x5ecb94>0x0&&(_0x3fc211+='\x20'+_0x26a58d['operator']+'\x20');_0x3fc211+=_0x26a58d[_0xafef('0x5e')][_0x5ecb94][_0xafef('0x5f')]?_0x45e42c(_0x26a58d[_0xafef('0x5e')][_0x5ecb94]['group']):_0x26a58d[_0xafef('0x5e')][_0x5ecb94][_0xafef('0x60')]+'\x20'+_0x26a58d['rules'][_0x5ecb94][_0xafef('0x61')]+(_0x6c9977(_0x26a58d['rules'][_0x5ecb94][_0xafef('0x61')])?'\x20'+_0x26a58d[_0xafef('0x5e')][_0x5ecb94][_0xafef('0x62')]:'');}return _0x3fc211+')';};var _0x389a4e={'where':{'id':_0x5ed0b4['params']['id']}},_0x544a84,_0x210288,_0x18fed5,_0x574e13,_0x4766e6;_0x389a4e=_[_0xafef('0x3c')]({},_0x389a4e,_0x5ed0b4[_0xafef('0x3d')]);return db[_0xafef('0x2a')]['find'](_0x389a4e)['then'](function(_0x359b8f){if(_0x359b8f){_0x544a84=_0x359b8f;return _0x359b8f[_0xafef('0x63')]();}return null;})[_0xafef('0x24')](function(_0x26173d){if(_0x26173d){if(!_0x26173d[_0xafef('0x34')]){throw new db[(_0xafef('0x64'))][(_0xafef('0x65'))](_0xafef('0x66'),0x193);}_0x210288=_0x26173d;return db[_0xafef('0x67')][_0xafef('0x40')]({'raw':!![]});}return null;})[_0xafef('0x24')](function(_0x5256a6){if(_0x5256a6){_0x18fed5=_[_0xafef('0x68')](_0x5256a6,'id');var _0x59262a;var _0x424a69=squel[_0xafef('0x69')]();_0x424a69[_0xafef('0x6a')](_0x544a84['table']);for(var _0x4ad3bb=0x0;_0x4ad3bb<_0x210288[_0xafef('0x34')];_0x4ad3bb+=0x1){_0x59262a=_0x210288[_0x4ad3bb][_0xafef('0x6b')]?_0x18fed5[_0x210288[_0x4ad3bb][_0xafef('0x6b')]][_0xafef('0x6c')]:_0x210288[_0x4ad3bb][_0xafef('0x60')];_0x59262a=_0x210288[_0x4ad3bb][_0xafef('0x6d')]?_[_0xafef('0x6e')](_0x43c440[_0x210288[_0x4ad3bb]['function']],'%s',_0x59262a):_0x59262a;_0x59262a=_0x210288[_0x4ad3bb][_0xafef('0x6f')]?_[_0xafef('0x6e')](_0x9c8c42[_0x210288[_0x4ad3bb]['format']],'%s',_0x59262a):_0x59262a;if(_0x210288[_0x4ad3bb][_0xafef('0x70')]){_0x424a69[_0xafef('0x5f')](_0x59262a);}_0x210288[_0x4ad3bb][_0xafef('0x71')]&&_0x424a69[_0xafef('0x72')](_0x59262a,_0x210288[_0x4ad3bb][_0xafef('0x71')]==='DESC'?![]:!![]);_0x424a69[_0xafef('0x60')](_0x59262a,_0x210288[_0x4ad3bb]['alias']||_0x59262a);}if(_0x544a84[_0xafef('0x73')]){_0x544a84['joins']=JSON[_0xafef('0x74')](_0x544a84[_0xafef('0x73')]);for(var _0x3ce8c5=0x0;_0x3ce8c5<_0x544a84['joins'][_0xafef('0x34')];_0x3ce8c5+=0x1){if(_0x544a84['joins'][_0x3ce8c5][_0xafef('0x3a')]&&_[_0xafef('0x75')](_0x4bfdc2,_0x544a84[_0xafef('0x73')][_0x3ce8c5][_0xafef('0x3a')])&&_0x544a84[_0xafef('0x73')][_0x3ce8c5][_0xafef('0x76')]&&_0x544a84[_0xafef('0x73')][_0x3ce8c5][_0xafef('0x77')]&&_0x544a84[_0xafef('0x73')][_0x3ce8c5][_0xafef('0x78')]){_0x424a69[_0x544a84[_0xafef('0x73')][_0x3ce8c5][_0xafef('0x3a')]](_0x544a84['joins'][_0x3ce8c5][_0xafef('0x77')],null,util[_0xafef('0x6f')](_0xafef('0x79'),_0x544a84['table'],_0x544a84['joins'][_0x3ce8c5][_0xafef('0x76')],_0x544a84[_0xafef('0x73')][_0x3ce8c5][_0xafef('0x77')],_0x544a84['joins'][_0x3ce8c5]['foreignKey']));}}}if(_0x544a84[_0xafef('0x7a')]){_0x544a84[_0xafef('0x7a')]=JSON['parse'](_0x544a84['conditions']);_0x424a69['where'](_0x45e42c(_0x544a84[_0xafef('0x7a')][_0xafef('0x5f')]));}_0x4766e6=_0x424a69[_0xafef('0x7b')]();_0x424a69[_0xafef('0x1d')](_0xd4e54);_0x424a69['offset'](0x0);logger[_0xafef('0x7c')](_0xafef('0x7d'),_0x424a69[_0xafef('0x7e')]());return db[_0xafef('0x7f')][_0xafef('0x2e')](_0x424a69[_0xafef('0x7e')](),{'type':db[_0xafef('0x7f')][_0xafef('0x80')][_0xafef('0x81')]});}})[_0xafef('0x24')](respondWithResult(_0x44f0a2,null))[_0xafef('0x42')](handleError(_0x44f0a2,null));};function runReport(_0xa70c2e,_0x1eff52,_0xc7f62){var _0x5ab896=_0x1eff52[_0xafef('0x27')];var _0xbf8c9f=0xa;var _0x59b25d=[_0xafef('0x4f'),_0xafef('0x50'),_0xafef('0x82'),'cross_join'];var _0x44c29a={'SUM':_0xafef('0x83'),'COUNT':_0xafef('0x52'),'COUNT DISTINCT':_0xafef('0x53'),'MAX':_0xafef('0x54'),'MIN':_0xafef('0x55'),'AVG':_0xafef('0x84'),'GROUP_CONCAT':_0xafef('0x85'),'GROUP_CONCAT ASC':_0xafef('0x86'),'GROUP_CONCAT DESC':_0xafef('0x56')};var _0x59ef3c={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':'DATE(%s)','HOUR':_0xafef('0x58'),'ROUND':_0xafef('0x87'),'UNIX_TIMESTAMP':_0xafef('0x59')};var _0x4f9a72=function(_0x336b53){return!_[_0xafef('0x75')](['IS\x20NULL',_0xafef('0x5b'),_0xafef('0x5c'),'IS\x20NOT\x20EMPTY'],_0x336b53);};var _0x9cf618=function(_0x881f89){if(!_0x881f89||!_0x881f89[_0xafef('0x5e')][_0xafef('0x34')]){return'';}for(var _0x36e831='(',_0x28eddb=0x0;_0x28eddb<_0x881f89[_0xafef('0x5e')][_0xafef('0x34')];_0x28eddb+=0x1){_0x28eddb>0x0&&(_0x36e831+='\x20'+_0x881f89[_0xafef('0x88')]+'\x20');_0x36e831+=_0x881f89[_0xafef('0x5e')][_0x28eddb][_0xafef('0x5f')]?_0x9cf618(_0x881f89['rules'][_0x28eddb][_0xafef('0x5f')]):_0x881f89[_0xafef('0x5e')][_0x28eddb][_0xafef('0x60')]+'\x20'+_0x881f89[_0xafef('0x5e')][_0x28eddb][_0xafef('0x61')]+(_0x4f9a72(_0x881f89[_0xafef('0x5e')][_0x28eddb][_0xafef('0x61')])?'\x20'+_0x881f89[_0xafef('0x5e')][_0x28eddb][_0xafef('0x62')]:'');}return _0x36e831+')';};var _0x2797a3={'where':{'id':_0xa70c2e['id']}},_0x10dc7a,_0x4a5441,_0x2b5ca4,_0x3217a8,_0x23562a;_0x2797a3=_[_0xafef('0x3c')]({},_0x2797a3,_0xc7f62);return db[_0xafef('0x2a')][_0xafef('0x4a')](_0x2797a3)[_0xafef('0x24')](function(_0x416de5){if(_0x416de5){_0x10dc7a=_0x416de5;return _0x416de5['getFields']();}return null;})[_0xafef('0x24')](function(_0x15cc3d){if(_0x15cc3d){if(!_0x15cc3d[_0xafef('0x34')]){throw new db[(_0xafef('0x64'))][(_0xafef('0x65'))](_0xafef('0x66'),0x193);}_0x4a5441=_0x15cc3d;return db[_0xafef('0x67')][_0xafef('0x40')]({'raw':!![]});}return null;})[_0xafef('0x24')](function(_0x5e793d){if(_0x5e793d){_0x2b5ca4=_['keyBy'](_0x5e793d,'id');var _0x57b506;var _0x4850f0=squel[_0xafef('0x69')]();_0x4850f0['from'](_0x10dc7a[_0xafef('0x89')]);for(var _0x186ba0=0x0;_0x186ba0<_0x4a5441[_0xafef('0x34')];_0x186ba0+=0x1){_0x57b506=_0x4a5441[_0x186ba0][_0xafef('0x6b')]?_0x2b5ca4[_0x4a5441[_0x186ba0][_0xafef('0x6b')]][_0xafef('0x6c')]:_0x4a5441[_0x186ba0][_0xafef('0x60')];_0x57b506=_0x4a5441[_0x186ba0][_0xafef('0x6d')]?_[_0xafef('0x6e')](_0x44c29a[_0x4a5441[_0x186ba0][_0xafef('0x6d')]],'%s',_0x57b506):_0x57b506;_0x57b506=_0x4a5441[_0x186ba0][_0xafef('0x6f')]?_[_0xafef('0x6e')](_0x59ef3c[_0x4a5441[_0x186ba0]['format']],'%s',_0x57b506):_0x57b506;if(_0x4a5441[_0x186ba0][_0xafef('0x70')]){_0x4850f0[_0xafef('0x5f')](_0x57b506);}_0x4a5441[_0x186ba0][_0xafef('0x71')]&&_0x4850f0[_0xafef('0x72')](_0x57b506,_0x4a5441[_0x186ba0]['orderBy']===_0xafef('0x8a')?![]:!![]);_0x4850f0[_0xafef('0x60')](_0x57b506,_0x4a5441[_0x186ba0]['alias']||_0x57b506);}if(_0x10dc7a[_0xafef('0x73')]){_0x10dc7a[_0xafef('0x73')]=JSON[_0xafef('0x74')](_0x10dc7a[_0xafef('0x73')]);for(var _0x3784eb=0x0;_0x3784eb<_0x10dc7a[_0xafef('0x73')][_0xafef('0x34')];_0x3784eb+=0x1){if(_0x10dc7a['joins'][_0x3784eb][_0xafef('0x3a')]&&_[_0xafef('0x75')](_0x59b25d,_0x10dc7a[_0xafef('0x73')][_0x3784eb][_0xafef('0x3a')])&&_0x10dc7a[_0xafef('0x73')][_0x3784eb][_0xafef('0x76')]&&_0x10dc7a['joins'][_0x3784eb][_0xafef('0x77')]&&_0x10dc7a[_0xafef('0x73')][_0x3784eb][_0xafef('0x78')]){_0x4850f0[_0x10dc7a[_0xafef('0x73')][_0x3784eb][_0xafef('0x3a')]](_0x10dc7a[_0xafef('0x73')][_0x3784eb][_0xafef('0x77')],null,util[_0xafef('0x6f')](_0xafef('0x79'),_0x10dc7a[_0xafef('0x89')],_0x10dc7a[_0xafef('0x73')][_0x3784eb]['parentKey'],_0x10dc7a['joins'][_0x3784eb]['foreignTable'],_0x10dc7a[_0xafef('0x73')][_0x3784eb][_0xafef('0x78')]));}}}if(_0x10dc7a[_0xafef('0x7a')]){_0x10dc7a[_0xafef('0x7a')]=JSON[_0xafef('0x74')](_0x10dc7a[_0xafef('0x7a')]);_0x4850f0[_0xafef('0x37')](_0x9cf618(_0x10dc7a[_0xafef('0x7a')]['group']));}_0x23562a=_0x4850f0['clone']();_0x4850f0[_0xafef('0x1d')](_0xbf8c9f);_0x4850f0[_0xafef('0x1c')](0x0);logger[_0xafef('0x7c')](_0xafef('0x7d'),_0x4850f0['toString']());return db[_0xafef('0x7f')][_0xafef('0x2e')](_0x4850f0['toString'](),{'type':db[_0xafef('0x7f')][_0xafef('0x80')][_0xafef('0x81')]});}})[_0xafef('0x24')](function(_0x295975){if(!_0x295975[_0xafef('0x34')]){throw new db[(_0xafef('0x64'))][(_0xafef('0x65'))](_0xafef('0x8b'),0xcc);}if(_0x1eff52[_0xafef('0x8c')]===_0xafef('0x8d')){return null;}var _0x5500b3=_['merge'](_0x1eff52,{'name':_0x1eff52['fullPath']||_0x1eff52['name']||_0x10dc7a['name'],'basename':_0x5ab896,'savename':util['format'](_0xafef('0x8e'),_0x1eff52[_0xafef('0x27')]||_0x10dc7a[_0xafef('0x27')],require(_0xafef('0x8f'))[_0xafef('0x90')](0x4),_0x1eff52['output']||_0xafef('0x91')),'reportId':_0x10dc7a['id'],'reportType':_0xafef('0x92')});return db['AnalyticExtractedReport'][_0xafef('0x44')](_0x5500b3,{'raw':!![]});})[_0xafef('0x24')](function(_0x1793d6){if(_0x10dc7a[_0xafef('0x89')]===_0xafef('0x93')){_0x23562a['where'](_0x10dc7a[_0xafef('0x89')]+'.calldate\x20BETWEEN\x20?\x20AND\x20?',_0x1eff52['startDate'],_0x1eff52[_0xafef('0x94')]);}else{_0x23562a[_0xafef('0x37')](_0x10dc7a[_0xafef('0x89')]+_0xafef('0x95'),_0x1eff52[_0xafef('0x96')],_0x1eff52[_0xafef('0x94')]);}if(_0x1793d6){logger['info']('Run\x20Query:',_0x23562a['toString']());require(_0xafef('0x97'))['fork'](path['join'](__dirname,'../../components/export/',_0x1793d6['output']),[_0x1793d6['id'],_0x23562a[_0xafef('0x7e')](),path[_0xafef('0x4f')](__dirname,_0xafef('0x98'),_0x1793d6['savename']),_0x5ab896]);return _0x1793d6;}else{var _0x16801d=squel['select']();_0x16801d[_0xafef('0x6a')]('('+_0x23562a[_0xafef('0x7e')]()+')','countTable');_0x16801d['field'](_0xafef('0x99'),_0xafef('0x1b'));_0x23562a[_0xafef('0x1d')](_0x1eff52[_0xafef('0x1d')]||_0xbf8c9f);_0x23562a['offset'](_0x1eff52[_0xafef('0x1c')]||0x0);return dbH[_0xafef('0x7f')][_0xafef('0x2e')](_0x16801d[_0xafef('0x7e')](),{'type':dbH[_0xafef('0x7f')][_0xafef('0x80')]['SELECT']})[_0xafef('0x24')](function(_0x62f174){if(!_0x62f174[_0xafef('0x34')]){_0x3217a8=0x0;}else{_0x3217a8=_0x62f174[0x0][_0xafef('0x1b')]||0x0;}return dbH[_0xafef('0x7f')][_0xafef('0x2e')](_0x23562a['toString'](),{'type':dbH[_0xafef('0x7f')][_0xafef('0x80')][_0xafef('0x81')]});})[_0xafef('0x24')](function(_0xe4af65){return{'rows':_0xe4af65||[],'count':_0x3217a8};});}});}exports[_0xafef('0x9a')]=function(_0x3679eb,_0x2f8621){return runReport(_0x3679eb['params'],_0x3679eb[_0xafef('0x2e')],_0x3679eb['options'])[_0xafef('0x24')](respondWithResult(_0x2f8621,null))[_0xafef('0x42')](handleError(_0x2f8621,null));};exports['runReport']=runReport;exports['query']=function(_0x5d5508,_0x396395){var _0x299244=0xa;var _0x1d0e05=['join',_0xafef('0x50'),'right_join',_0xafef('0x51')];var _0xdd596c={'SUM':'SUM(%s)','COUNT':_0xafef('0x52'),'COUNT DISTINCT':_0xafef('0x53'),'MAX':'MAX(%s)','MIN':_0xafef('0x55'),'AVG':_0xafef('0x84'),'GROUP_CONCAT':_0xafef('0x85'),'GROUP_CONCAT ASC':_0xafef('0x86'),'GROUP_CONCAT DESC':_0xafef('0x56')};var _0x3c2ec9={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':_0xafef('0x57'),'HOUR':'HOUR(%s)','ROUND':'ROUND(%s)','UNIX_TIMESTAMP':_0xafef('0x59')};var _0x1a8540=function(_0x3cfd10){return!_[_0xafef('0x75')]([_0xafef('0x5a'),_0xafef('0x5b'),_0xafef('0x5c'),_0xafef('0x5d')],_0x3cfd10);};var _0x136e5e=function(_0x483d5e){if(!_0x483d5e||!_0x483d5e[_0xafef('0x5e')]['length']){return'';}for(var _0x1e7f3c='(',_0x249ed0=0x0;_0x249ed0<_0x483d5e[_0xafef('0x5e')][_0xafef('0x34')];_0x249ed0+=0x1){_0x249ed0>0x0&&(_0x1e7f3c+='\x20'+_0x483d5e[_0xafef('0x88')]+'\x20');_0x1e7f3c+=_0x483d5e[_0xafef('0x5e')][_0x249ed0]['group']?_0x136e5e(_0x483d5e[_0xafef('0x5e')][_0x249ed0][_0xafef('0x5f')]):_0x483d5e['rules'][_0x249ed0][_0xafef('0x60')]+'\x20'+_0x483d5e[_0xafef('0x5e')][_0x249ed0][_0xafef('0x61')]+(_0x1a8540(_0x483d5e[_0xafef('0x5e')][_0x249ed0][_0xafef('0x61')])?'\x20'+_0x483d5e[_0xafef('0x5e')][_0x249ed0][_0xafef('0x62')]:'');}return _0x1e7f3c+')';};var _0x4d1b86={'where':{'id':_0x5d5508[_0xafef('0x43')]['id']}},_0x54e778,_0xa4cac2,_0x4313f6,_0x46e4d4,_0x4e9026;_0x4d1b86=_[_0xafef('0x3c')]({},_0x4d1b86,_0x5d5508[_0xafef('0x3d')]);return db['AnalyticDefaultReport'][_0xafef('0x4a')](_0x4d1b86)[_0xafef('0x24')](function(_0x41b8bc){if(_0x41b8bc){_0x54e778=_0x41b8bc;return _0x41b8bc[_0xafef('0x63')]();}return null;})[_0xafef('0x24')](function(_0x2f40dd){if(_0x2f40dd){if(!_0x2f40dd['length']){throw new db[(_0xafef('0x64'))][(_0xafef('0x65'))](_0xafef('0x66'),0x193);}_0xa4cac2=_0x2f40dd;return db[_0xafef('0x67')][_0xafef('0x40')]({'raw':!![]});}return null;})['then'](function(_0x2b3791){if(_0x2b3791){_0x4313f6=_[_0xafef('0x68')](_0x2b3791,'id');var _0xe53431;var _0x3a14bc=squel[_0xafef('0x69')]();_0x3a14bc[_0xafef('0x6a')](_0x54e778[_0xafef('0x89')]);for(var _0x1e588a=0x0;_0x1e588a<_0xa4cac2[_0xafef('0x34')];_0x1e588a+=0x1){_0xe53431=_0xa4cac2[_0x1e588a][_0xafef('0x6b')]?_0x4313f6[_0xa4cac2[_0x1e588a][_0xafef('0x6b')]][_0xafef('0x6c')]:_0xa4cac2[_0x1e588a][_0xafef('0x60')];_0xe53431=_0xa4cac2[_0x1e588a][_0xafef('0x6d')]?_[_0xafef('0x6e')](_0xdd596c[_0xa4cac2[_0x1e588a][_0xafef('0x6d')]],'%s',_0xe53431):_0xe53431;_0xe53431=_0xa4cac2[_0x1e588a]['format']?_[_0xafef('0x6e')](_0x3c2ec9[_0xa4cac2[_0x1e588a]['format']],'%s',_0xe53431):_0xe53431;if(_0xa4cac2[_0x1e588a][_0xafef('0x70')]){_0x3a14bc[_0xafef('0x5f')](_0xe53431);}_0xa4cac2[_0x1e588a][_0xafef('0x71')]&&_0x3a14bc[_0xafef('0x72')](_0xe53431,_0xa4cac2[_0x1e588a][_0xafef('0x71')]===_0xafef('0x8a')?![]:!![]);_0x3a14bc[_0xafef('0x60')](_0xe53431,_0xa4cac2[_0x1e588a]['alias']||_0xe53431);}if(_0x54e778[_0xafef('0x73')]){_0x54e778[_0xafef('0x73')]=JSON[_0xafef('0x74')](_0x54e778[_0xafef('0x73')]);for(var _0x1a63c5=0x0;_0x1a63c5<_0x54e778[_0xafef('0x73')]['length'];_0x1a63c5+=0x1){if(_0x54e778[_0xafef('0x73')][_0x1a63c5][_0xafef('0x3a')]&&_[_0xafef('0x75')](_0x1d0e05,_0x54e778[_0xafef('0x73')][_0x1a63c5][_0xafef('0x3a')])&&_0x54e778[_0xafef('0x73')][_0x1a63c5][_0xafef('0x76')]&&_0x54e778['joins'][_0x1a63c5][_0xafef('0x77')]&&_0x54e778[_0xafef('0x73')][_0x1a63c5][_0xafef('0x78')]){_0x3a14bc[_0x54e778['joins'][_0x1a63c5][_0xafef('0x3a')]](_0x54e778[_0xafef('0x73')][_0x1a63c5]['foreignTable'],null,util['format']('%s.%s\x20=\x20%s.%s',_0x54e778['table'],_0x54e778[_0xafef('0x73')][_0x1a63c5]['parentKey'],_0x54e778['joins'][_0x1a63c5][_0xafef('0x77')],_0x54e778['joins'][_0x1a63c5]['foreignKey']));}}}if(_0x54e778['conditions']){_0x54e778['conditions']=JSON[_0xafef('0x74')](_0x54e778[_0xafef('0x7a')]);_0x3a14bc[_0xafef('0x37')](_0x136e5e(_0x54e778['conditions'][_0xafef('0x5f')]));}_0x4e9026=_0x3a14bc['clone']();_0x3a14bc[_0xafef('0x1d')](_0x299244);_0x3a14bc['offset'](0x0);logger[_0xafef('0x7c')]('Limited\x20Query:',_0x3a14bc['toString']());return db['sequelize'][_0xafef('0x2e')](_0x3a14bc[_0xafef('0x7e')](),{'type':db[_0xafef('0x7f')][_0xafef('0x80')][_0xafef('0x81')]});}})['then'](function(){return{'sql':_0x4e9026['toString']()};})[_0xafef('0x24')](respondWithResult(_0x396395,null))['catch'](handleError(_0x396395,null));}; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.model.js b/server/api/analyticDefaultReport/analyticDefaultReport.model.js index 3904b21..bd9c355 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 _0x7a54=['../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./analyticDefaultReport.attributes','exports','AnalyticDefaultReport','analytics_default_reports','lodash','util'];(function(_0x1a9bd6,_0x20bcb8){var _0x8d30a5=function(_0x199e7a){while(--_0x199e7a){_0x1a9bd6['push'](_0x1a9bd6['shift']());}};_0x8d30a5(++_0x20bcb8);}(_0x7a54,0x106));var _0x47a5=function(_0x13cc57,_0x4b99ab){_0x13cc57=_0x13cc57-0x0;var _0x177d16=_0x7a54[_0x13cc57];return _0x177d16;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var logger=require(_0x47a5('0x2'))('api');var moment=require(_0x47a5('0x3'));var BPromise=require(_0x47a5('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x47a5('0x5'));var rimraf=require(_0x47a5('0x6'));var config=require(_0x47a5('0x7'));var attributes=require(_0x47a5('0x8'));module[_0x47a5('0x9')]=function(_0x545a97,_0x3d5629){return _0x545a97['define'](_0x47a5('0xa'),attributes,{'tableName':_0x47a5('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc4aa=['bluebird','../../config/environment','./analyticDefaultReport.attributes','exports','define','AnalyticDefaultReport','analytics_default_reports','lodash','util','../../config/logger','api','moment'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x273c39,_0x1052e6){_0x273c39=_0x273c39-0x0;var _0x46d6b5=_0xc4aa[_0x273c39];return _0x46d6b5;};'use strict';var _=require(_0xac4a('0x0'));var util=require(_0xac4a('0x1'));var logger=require(_0xac4a('0x2'))(_0xac4a('0x3'));var moment=require(_0xac4a('0x4'));var BPromise=require(_0xac4a('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xac4a('0x6'));var attributes=require(_0xac4a('0x7'));module[_0xac4a('0x8')]=function(_0x215f39,_0x96be2b){return _0x215f39[_0xac4a('0x9')](_0xac4a('0xa'),attributes,{'tableName':_0xac4a('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.rpc.js b/server/api/analyticDefaultReport/analyticDefaultReport.rpc.js index 7c05e31..8f9ed72 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 _0x76bc=['util','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','AnalyticDefaultReport,\x20%s,\x20%s,\x20%s','stringify','error','code','AnalyticDefaultReport,\x20%s,\x20%s','message','result','lodash'];(function(_0x5dfc41,_0x48746b){var _0x110021=function(_0x4e76f4){while(--_0x4e76f4){_0x5dfc41['push'](_0x5dfc41['shift']());}};_0x110021(++_0x48746b);}(_0x76bc,0x17f));var _0xc76b=function(_0x240261,_0x4fe66c){_0x240261=_0x240261-0x0;var _0x45c332=_0x76bc[_0x240261];return _0x45c332;};'use strict';var _=require(_0xc76b('0x0'));var util=require(_0xc76b('0x1'));var moment=require(_0xc76b('0x2'));var BPromise=require(_0xc76b('0x3'));var rs=require(_0xc76b('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xc76b('0x5'));var logger=require(_0xc76b('0x6'))(_0xc76b('0x7'));var config=require(_0xc76b('0x8'));var jayson=require(_0xc76b('0x9'));var client=jayson[_0xc76b('0xa')][_0xc76b('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2cbe53,_0x110f3b,_0x1cb174){return new BPromise(function(_0x235ff3,_0xaf195c){return client[_0xc76b('0xc')](_0x2cbe53,_0x1cb174)[_0xc76b('0xd')](function(_0x2803e9){logger[_0xc76b('0xe')]('AnalyticDefaultReport,\x20%s,\x20%s',_0x110f3b,_0xc76b('0xf'));logger[_0xc76b('0x10')](_0xc76b('0x11'),_0x110f3b,_0xc76b('0xf'),JSON[_0xc76b('0x12')](_0x2803e9));if(_0x2803e9[_0xc76b('0x13')]){if(_0x2803e9['error'][_0xc76b('0x14')]===0x1f4){logger[_0xc76b('0x13')](_0xc76b('0x15'),_0x110f3b,_0x2803e9[_0xc76b('0x13')][_0xc76b('0x16')]);return _0xaf195c(_0x2803e9[_0xc76b('0x13')][_0xc76b('0x16')]);}logger['error']('AnalyticDefaultReport,\x20%s,\x20%s',_0x110f3b,_0x2803e9[_0xc76b('0x13')][_0xc76b('0x16')]);return _0x235ff3(_0x2803e9[_0xc76b('0x13')][_0xc76b('0x16')]);}else{logger[_0xc76b('0xe')]('AnalyticDefaultReport,\x20%s,\x20%s',_0x110f3b,_0xc76b('0xf'));_0x235ff3(_0x2803e9[_0xc76b('0x17')][_0xc76b('0x16')]);}})['catch'](function(_0x4e759e){logger[_0xc76b('0x13')](_0xc76b('0x15'),_0x110f3b,_0x4e759e);_0xaf195c(_0x4e759e);});});} \ No newline at end of file +var _0x66d3=['request','then','AnalyticDefaultReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticDefaultReport,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','lodash','moment','randomstring','ioredis','../../config/utils','rpc','jayson/promise','client','http'];(function(_0x1a3d07,_0x105a71){var _0xd0058a=function(_0x213e53){while(--_0x213e53){_0x1a3d07['push'](_0x1a3d07['shift']());}};_0xd0058a(++_0x105a71);}(_0x66d3,0x10f));var _0x366d=function(_0x1de105,_0x166e04){_0x1de105=_0x1de105-0x0;var _0x4d9fd7=_0x66d3[_0x1de105];return _0x4d9fd7;};'use strict';var _=require(_0x366d('0x0'));var util=require('util');var moment=require(_0x366d('0x1'));var BPromise=require('bluebird');var rs=require(_0x366d('0x2'));var fs=require('fs');var Redis=require(_0x366d('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x366d('0x4'));var logger=require('../../config/logger')(_0x366d('0x5'));var config=require('../../config/environment');var jayson=require(_0x366d('0x6'));var client=jayson[_0x366d('0x7')][_0x366d('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x454c54,_0x2e9573,_0x16907c){return new BPromise(function(_0x247d15,_0x12c7bb){return client[_0x366d('0x9')](_0x454c54,_0x16907c)[_0x366d('0xa')](function(_0x2adf49){logger['info'](_0x366d('0xb'),_0x2e9573,_0x366d('0xc'));logger[_0x366d('0xd')](_0x366d('0xe'),_0x2e9573,_0x366d('0xc'),JSON[_0x366d('0xf')](_0x2adf49));if(_0x2adf49[_0x366d('0x10')]){if(_0x2adf49[_0x366d('0x10')]['code']===0x1f4){logger['error'](_0x366d('0xb'),_0x2e9573,_0x2adf49[_0x366d('0x10')][_0x366d('0x11')]);return _0x12c7bb(_0x2adf49[_0x366d('0x10')][_0x366d('0x11')]);}logger[_0x366d('0x10')]('AnalyticDefaultReport,\x20%s,\x20%s',_0x2e9573,_0x2adf49[_0x366d('0x10')][_0x366d('0x11')]);return _0x247d15(_0x2adf49['error'][_0x366d('0x11')]);}else{logger[_0x366d('0x12')]('AnalyticDefaultReport,\x20%s,\x20%s',_0x2e9573,_0x366d('0xc'));_0x247d15(_0x2adf49[_0x366d('0x13')][_0x366d('0x11')]);}})['catch'](function(_0x10a27f){logger['error'](_0x366d('0xb'),_0x2e9573,_0x10a27f);_0x12c7bb(_0x10a27f);});});} \ No newline at end of file diff --git a/server/api/analyticDefaultReport/index.js b/server/api/analyticDefaultReport/index.js index 46c1135..1b52914 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 _0x3de6=['../../config/environment','./analyticDefaultReport.controller','get','isAuthenticated','index','/:id','/:id/preview','preview','/:id/run','run','/:id/query','query','post','create','put','update','delete','destroy','exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x5bf811,_0x348069){var _0x12d3a5=function(_0x4d9395){while(--_0x4d9395){_0x5bf811['push'](_0x5bf811['shift']());}};_0x12d3a5(++_0x348069);}(_0x3de6,0x199));var _0x63de=function(_0x51a645,_0x14c255){_0x51a645=_0x51a645-0x0;var _0x5d7f72=_0x3de6[_0x51a645];return _0x5d7f72;};'use strict';var multer=require(_0x63de('0x0'));var util=require(_0x63de('0x1'));var path=require('path');var timeout=require(_0x63de('0x2'));var express=require(_0x63de('0x3'));var router=express[_0x63de('0x4')]();var auth=require(_0x63de('0x5'));var interaction=require(_0x63de('0x6'));var config=require(_0x63de('0x7'));var controller=require(_0x63de('0x8'));router[_0x63de('0x9')]('/',auth[_0x63de('0xa')](),controller[_0x63de('0xb')]);router[_0x63de('0x9')](_0x63de('0xc'),auth[_0x63de('0xa')](),controller['show']);router[_0x63de('0x9')](_0x63de('0xd'),auth[_0x63de('0xa')](),controller[_0x63de('0xe')]);router[_0x63de('0x9')](_0x63de('0xf'),auth['isAuthenticated'](),controller[_0x63de('0x10')]);router['get'](_0x63de('0x11'),auth['isAuthenticated'](),controller[_0x63de('0x12')]);router[_0x63de('0x13')]('/',auth[_0x63de('0xa')](),controller[_0x63de('0x14')]);router[_0x63de('0x15')](_0x63de('0xc'),auth['isAuthenticated'](),controller[_0x63de('0x16')]);router[_0x63de('0x17')](_0x63de('0xc'),auth['isAuthenticated'](),controller[_0x63de('0x18')]);module[_0x63de('0x19')]=router; \ No newline at end of file +var _0x28d4=['preview','/:id/run','run','query','post','create','/:id','update','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','isAuthenticated','show','get','/:id/preview'];(function(_0x250496,_0x408b04){var _0x7e28ab=function(_0x50eef4){while(--_0x50eef4){_0x250496['push'](_0x250496['shift']());}};_0x7e28ab(++_0x408b04);}(_0x28d4,0xe6));var _0x428d=function(_0x2c91e9,_0x2fb965){_0x2c91e9=_0x2c91e9-0x0;var _0x13f0ff=_0x28d4[_0x2c91e9];return _0x13f0ff;};'use strict';var multer=require(_0x428d('0x0'));var util=require(_0x428d('0x1'));var path=require(_0x428d('0x2'));var timeout=require(_0x428d('0x3'));var express=require(_0x428d('0x4'));var router=express[_0x428d('0x5')]();var auth=require(_0x428d('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x428d('0x7'));var controller=require('./analyticDefaultReport.controller');router['get']('/',auth[_0x428d('0x8')](),controller['index']);router['get']('/:id',auth[_0x428d('0x8')](),controller[_0x428d('0x9')]);router[_0x428d('0xa')](_0x428d('0xb'),auth[_0x428d('0x8')](),controller[_0x428d('0xc')]);router[_0x428d('0xa')](_0x428d('0xd'),auth[_0x428d('0x8')](),controller[_0x428d('0xe')]);router[_0x428d('0xa')]('/:id/query',auth[_0x428d('0x8')](),controller[_0x428d('0xf')]);router[_0x428d('0x10')]('/',auth[_0x428d('0x8')](),controller[_0x428d('0x11')]);router['put'](_0x428d('0x12'),auth[_0x428d('0x8')](),controller[_0x428d('0x13')]);router['delete']('/:id',auth[_0x428d('0x8')](),controller[_0x428d('0x14')]);module[_0x428d('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 5e38e04..bc94730 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 _0x87e7=['manual','INTEGER','UNSIGNED','sequelize','exports','STRING','ENUM','csv','pdf','xlsx','DATE','Loading'];(function(_0x4de003,_0x1677e9){var _0x2875b9=function(_0x686fda){while(--_0x686fda){_0x4de003['push'](_0x4de003['shift']());}};_0x2875b9(++_0x1677e9);}(_0x87e7,0x1cb));var _0x787e=function(_0x291aaf,_0x4c6d8d){_0x291aaf=_0x291aaf-0x0;var _0x5571e6=_0x87e7[_0x291aaf];return _0x5571e6;};'use strict';var Sequelize=require(_0x787e('0x0'));var moment=require('moment');module[_0x787e('0x1')]={'name':{'type':Sequelize[_0x787e('0x2')],'allowNull':![]},'basename':{'type':Sequelize['STRING'],'allowNull':![]},'output':{'type':Sequelize[_0x787e('0x3')](_0x787e('0x4'),_0x787e('0x5'),_0x787e('0x6')),'allowNull':![],'defaultValue':_0x787e('0x4')},'savename':{'type':Sequelize['STRING'],'allowNull':![]},'startDate':{'type':Sequelize[_0x787e('0x7')]},'endDate':{'type':Sequelize[_0x787e('0x7')]},'status':{'type':Sequelize[_0x787e('0x2')],'defaultValue':_0x787e('0x8')},'type':{'type':Sequelize[_0x787e('0x3')](_0x787e('0x9'),'scheduled'),'allowNull':![],'defaultValue':_0x787e('0x9')},'reportId':{'type':Sequelize[_0x787e('0xa')](0xb)[_0x787e('0xb')]},'reportType':{'type':Sequelize[_0x787e('0x2')]}}; \ No newline at end of file +var _0x440b=['DATE','Loading','ENUM','manual','scheduled','UNSIGNED','sequelize','moment','STRING','csv','pdf','xlsx'];(function(_0xcdafcc,_0x3f49f1){var _0x50722c=function(_0x22c0d9){while(--_0x22c0d9){_0xcdafcc['push'](_0xcdafcc['shift']());}};_0x50722c(++_0x3f49f1);}(_0x440b,0x132));var _0xb440=function(_0x4c1711,_0x2f49ce){_0x4c1711=_0x4c1711-0x0;var _0x3de6eb=_0x440b[_0x4c1711];return _0x3de6eb;};'use strict';var Sequelize=require(_0xb440('0x0'));var moment=require(_0xb440('0x1'));module['exports']={'name':{'type':Sequelize[_0xb440('0x2')],'allowNull':![]},'basename':{'type':Sequelize['STRING'],'allowNull':![]},'output':{'type':Sequelize['ENUM'](_0xb440('0x3'),_0xb440('0x4'),_0xb440('0x5')),'allowNull':![],'defaultValue':_0xb440('0x3')},'savename':{'type':Sequelize['STRING'],'allowNull':![]},'startDate':{'type':Sequelize[_0xb440('0x6')]},'endDate':{'type':Sequelize['DATE']},'status':{'type':Sequelize[_0xb440('0x2')],'defaultValue':_0xb440('0x7')},'type':{'type':Sequelize[_0xb440('0x8')](_0xb440('0x9'),_0xb440('0xa')),'allowNull':![],'defaultValue':'manual'},'reportId':{'type':Sequelize['INTEGER'](0xb)[_0xb440('0xb')]},'reportType':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.controller.js b/server/api/analyticExtractedReport/analyticExtractedReport.controller.js index f893cba..7c468b5 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 _0x327f=['map','AnalyticExtractedReport','rawAttributes','fieldName','type','key','model','keys','filters','attributes','intersection','fields','query','length','hasOwnProperty','order','sort','where','pick','filter','VIRTUAL','merge','options','include','findAll','rows','includeAll','find','create','user','role','ExtractedReports','UserProfileSection','userProfileId','autoAssociation','catch','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','params','download','basename','savename','output','existsSync','join','root','server/files/reports','Report\x20not\x20found\x20or\x20empty','sendStatus','format','%s.%s','html-pdf','eml-format','zip-dir','moment','bluebird','mustache','util','path','sox','ejs','lodash','crypto','jsforce','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','get','UserProfileResource','end','error','name','index'];(function(_0x575246,_0x77ec5d){var _0x223f70=function(_0x349c28){while(--_0x349c28){_0x575246['push'](_0x575246['shift']());}};_0x223f70(++_0x77ec5d);}(_0x327f,0x92));var _0xf327=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0x327f[_0xfae23b];return _0x200640;};'use strict';var pdf=require(_0xf327('0x0'));var emlformat=require(_0xf327('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xf327('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xf327('0x3'));var BPromise=require(_0xf327('0x4'));var Mustache=require(_0xf327('0x5'));var util=require(_0xf327('0x6'));var path=require(_0xf327('0x7'));var sox=require(_0xf327('0x8'));var csv=require('to-csv');var ejs=require(_0xf327('0x9'));var fs=require('fs');var _=require(_0xf327('0xa'));var squel=require('squel');var crypto=require(_0xf327('0xb'));var jsforce=require(_0xf327('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xf327('0xd'));var querystring=require(_0xf327('0xe'));var Papa=require(_0xf327('0xf'));var Redis=require(_0xf327('0x10'));var authService=require(_0xf327('0x11'));var qs=require(_0xf327('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xf327('0x13'));var logger=require(_0xf327('0x14'))(_0xf327('0x15'));var utils=require(_0xf327('0x16'));var config=require(_0xf327('0x17'));var db=require(_0xf327('0x18'))['db'];function respondWithStatusCode(_0x35c92f,_0x3b2562){_0x3b2562=_0x3b2562||0xcc;return function(_0x2c9ebe){if(_0x2c9ebe){return _0x35c92f['sendStatus'](_0x3b2562);}return _0x35c92f['status'](_0x3b2562)['end']();};}function respondWithResult(_0x3559ea,_0x2956ec){_0x2956ec=_0x2956ec||0xc8;return function(_0x9eebd8){if(_0x9eebd8){return _0x3559ea[_0xf327('0x19')](_0x2956ec)[_0xf327('0x1a')](_0x9eebd8);}};}function respondWithFilteredResult(_0x36eec0,_0x27b957){return function(_0x5e8cf1){if(_0x5e8cf1){var _0x525c29=_0x5e8cf1[_0xf327('0x1b')],_0x10c964=_0x27b957[_0xf327('0x1c')],_0x358572=_0x27b957['offset']+_0x27b957[_0xf327('0x1d')],_0x3bb7f2;if(_0x358572>=_0x525c29){_0x358572=_0x525c29;_0x3bb7f2=0xc8;}else{_0x3bb7f2=0xce;}_0x36eec0[_0xf327('0x19')](_0x3bb7f2);return _0x36eec0[_0xf327('0x1e')](_0xf327('0x1f'),_0x10c964+'-'+_0x358572+'/'+_0x525c29)[_0xf327('0x1a')](_0x5e8cf1);}return null;};}function patchUpdates(_0x236a65){return function(_0x24cef1){try{jsonpatch[_0xf327('0x20')](_0x24cef1,_0x236a65,!![]);}catch(_0x785246){return BPromise[_0xf327('0x21')](_0x785246);}return _0x24cef1[_0xf327('0x22')]();};}function saveUpdates(_0x1dbe4d,_0x40438e){return function(_0x783a43){if(_0x783a43){return _0x783a43[_0xf327('0x23')](_0x1dbe4d)[_0xf327('0x24')](function(_0x48b38f){return _0x48b38f;});}return null;};}function removeEntity(_0xfd750f,_0x1a639f){return function(_0x2f9c7e){if(_0x2f9c7e){return _0x2f9c7e[_0xf327('0x25')]()['then'](function(){var _0x27da75=_0x2f9c7e[_0xf327('0x26')]({'plain':!![]});var _0x3cdebc='ExtractedReports';return db[_0xf327('0x27')]['destroy']({'where':{'type':_0x3cdebc,'resourceId':_0x27da75['id']}})[_0xf327('0x24')](function(){return _0x2f9c7e;});})['then'](function(){_0xfd750f[_0xf327('0x19')](0xcc)[_0xf327('0x28')]();});}};}function handleEntityNotFound(_0x3abf80,_0x2ceb78){return function(_0x301f2e){if(!_0x301f2e){_0x3abf80['sendStatus'](0x194);}return _0x301f2e;};}function handleError(_0x93fa96,_0xf555f0){_0xf555f0=_0xf555f0||0x1f4;return function(_0x2a4ef7){logger[_0xf327('0x29')](_0x2a4ef7['stack']);if(_0x2a4ef7['name']){delete _0x2a4ef7[_0xf327('0x2a')];}_0x93fa96['status'](_0xf555f0)['send'](_0x2a4ef7);};}exports[_0xf327('0x2b')]=function(_0x3ce6d6,_0x342618){var _0x4a3baa={},_0x45b608={},_0x1081c0={'count':0x0,'rows':[]};var _0x521c9c=_[_0xf327('0x2c')](db[_0xf327('0x2d')][_0xf327('0x2e')],function(_0x118cdb){return{'name':_0x118cdb[_0xf327('0x2f')],'type':_0x118cdb[_0xf327('0x30')][_0xf327('0x31')]};});_0x45b608[_0xf327('0x32')]=_[_0xf327('0x2c')](_0x521c9c,'name');_0x45b608['query']=_[_0xf327('0x33')](_0x3ce6d6['query']);_0x45b608[_0xf327('0x34')]=_['intersection'](_0x45b608[_0xf327('0x32')],_0x45b608['query']);_0x4a3baa[_0xf327('0x35')]=_[_0xf327('0x36')](_0x45b608[_0xf327('0x32')],qs[_0xf327('0x37')](_0x3ce6d6[_0xf327('0x38')]['fields']));_0x4a3baa[_0xf327('0x35')]=_0x4a3baa[_0xf327('0x35')][_0xf327('0x39')]?_0x4a3baa[_0xf327('0x35')]:_0x45b608[_0xf327('0x32')];if(!_0x3ce6d6[_0xf327('0x38')][_0xf327('0x3a')]('nolimit')){_0x4a3baa[_0xf327('0x1d')]=qs[_0xf327('0x1d')](_0x3ce6d6[_0xf327('0x38')][_0xf327('0x1d')]);_0x4a3baa[_0xf327('0x1c')]=qs[_0xf327('0x1c')](_0x3ce6d6[_0xf327('0x38')][_0xf327('0x1c')]);}_0x4a3baa[_0xf327('0x3b')]=qs[_0xf327('0x3c')](_0x3ce6d6[_0xf327('0x38')]['sort']);_0x4a3baa[_0xf327('0x3d')]=qs[_0xf327('0x34')](_[_0xf327('0x3e')](_0x3ce6d6[_0xf327('0x38')],_0x45b608[_0xf327('0x34')]),_0x521c9c);if(_0x3ce6d6[_0xf327('0x38')][_0xf327('0x3f')]){_0x4a3baa[_0xf327('0x3d')]=_['merge'](_0x4a3baa[_0xf327('0x3d')],{'$or':_[_0xf327('0x2c')](_0x521c9c,function(_0x302cd4){if(_0x302cd4[_0xf327('0x30')]!==_0xf327('0x40')){var _0x26001e={};_0x26001e[_0x302cd4[_0xf327('0x2a')]]={'$like':'%'+_0x3ce6d6[_0xf327('0x38')][_0xf327('0x3f')]+'%'};return _0x26001e;}})});}_0x4a3baa=_[_0xf327('0x41')]({},_0x4a3baa,_0x3ce6d6[_0xf327('0x42')]);var _0x41b39d={'where':_0x4a3baa[_0xf327('0x3d')]};return db[_0xf327('0x2d')][_0xf327('0x1b')](_0x41b39d)[_0xf327('0x24')](function(_0x39ae82){_0x1081c0['count']=_0x39ae82;if(_0x3ce6d6[_0xf327('0x38')]['includeAll']){_0x4a3baa[_0xf327('0x43')]=[{'all':!![]}];}return db[_0xf327('0x2d')][_0xf327('0x44')](_0x4a3baa);})[_0xf327('0x24')](function(_0x40f90c){_0x1081c0[_0xf327('0x45')]=_0x40f90c;return _0x1081c0;})[_0xf327('0x24')](respondWithFilteredResult(_0x342618,_0x4a3baa))['catch'](handleError(_0x342618,null));};exports['show']=function(_0x1bbe15,_0x5a2b0b){var _0x55b1c7={'raw':!![],'where':{'id':_0x1bbe15['params']['id']}},_0x3af3ba={};_0x3af3ba[_0xf327('0x32')]=_[_0xf327('0x33')](db[_0xf327('0x2d')][_0xf327('0x2e')]);_0x3af3ba['query']=_[_0xf327('0x33')](_0x1bbe15[_0xf327('0x38')]);_0x3af3ba[_0xf327('0x34')]=_[_0xf327('0x36')](_0x3af3ba['model'],_0x3af3ba[_0xf327('0x38')]);_0x55b1c7['attributes']=_['intersection'](_0x3af3ba[_0xf327('0x32')],qs[_0xf327('0x37')](_0x1bbe15[_0xf327('0x38')][_0xf327('0x37')]));_0x55b1c7[_0xf327('0x35')]=_0x55b1c7[_0xf327('0x35')][_0xf327('0x39')]?_0x55b1c7[_0xf327('0x35')]:_0x3af3ba[_0xf327('0x32')];if(_0x1bbe15[_0xf327('0x38')][_0xf327('0x46')]){_0x55b1c7[_0xf327('0x43')]=[{'all':!![]}];}_0x55b1c7=_['merge']({},_0x55b1c7,_0x1bbe15[_0xf327('0x42')]);return db[_0xf327('0x2d')][_0xf327('0x47')](_0x55b1c7)[_0xf327('0x24')](handleEntityNotFound(_0x5a2b0b,null))['then'](respondWithResult(_0x5a2b0b,null))['catch'](handleError(_0x5a2b0b,null));};exports[_0xf327('0x48')]=function(_0x3aeb10,_0x5de8a7){return db[_0xf327('0x2d')]['create'](_0x3aeb10['body'],{})[_0xf327('0x24')](function(_0x416d73){var _0x4318ff=_0x3aeb10[_0xf327('0x49')][_0xf327('0x26')]({'plain':!![]});if(!_0x4318ff)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x4318ff[_0xf327('0x4a')]===_0xf327('0x49')){var _0x391458=_0x416d73[_0xf327('0x26')]({'plain':!![]});var _0xc21568=_0xf327('0x4b');return db[_0xf327('0x4c')][_0xf327('0x47')]({'where':{'name':_0xc21568,'userProfileId':_0x4318ff[_0xf327('0x4d')]},'raw':!![]})[_0xf327('0x24')](function(_0x311aad){if(_0x311aad&&_0x311aad[_0xf327('0x4e')]===0x0){return db['UserProfileResource']['create']({'name':_0x391458['name'],'resourceId':_0x391458['id'],'type':_0x311aad[_0xf327('0x2a')],'sectionId':_0x311aad['id']},{})[_0xf327('0x24')](function(){return _0x416d73;});}else{return _0x416d73;}})[_0xf327('0x4f')](function(_0x3e9519){logger['error'](_0xf327('0x50'),_0x3e9519);throw _0x3e9519;});}return _0x416d73;})['then'](respondWithResult(_0x5de8a7,0xc9))[_0xf327('0x4f')](handleError(_0x5de8a7,null));};exports[_0xf327('0x23')]=function(_0x332a5a,_0x24fa45){if(_0x332a5a[_0xf327('0x51')]['id']){delete _0x332a5a[_0xf327('0x51')]['id'];}return db['AnalyticExtractedReport'][_0xf327('0x47')]({'where':{'id':_0x332a5a[_0xf327('0x52')]['id']}})[_0xf327('0x24')](handleEntityNotFound(_0x24fa45,null))[_0xf327('0x24')](saveUpdates(_0x332a5a[_0xf327('0x51')],null))['then'](respondWithResult(_0x24fa45,null))['catch'](handleError(_0x24fa45,null));};exports[_0xf327('0x25')]=function(_0x554026,_0x4dd54c){return db[_0xf327('0x2d')][_0xf327('0x47')]({'where':{'id':_0x554026[_0xf327('0x52')]['id']}})[_0xf327('0x24')](handleEntityNotFound(_0x4dd54c,null))[_0xf327('0x24')](removeEntity(_0x4dd54c,null))[_0xf327('0x4f')](handleError(_0x4dd54c,null));};exports[_0xf327('0x53')]=function(_0x5b7e18,_0x3c1c1e,_0x2d00bd){return db[_0xf327('0x2d')]['find']({'where':{'id':_0x5b7e18[_0xf327('0x52')]['id']},'attributes':[_0xf327('0x2a'),_0xf327('0x54'),_0xf327('0x55'),_0xf327('0x56')],'raw':!![]})[_0xf327('0x24')](handleEntityNotFound(_0x3c1c1e,null))[_0xf327('0x24')](function(_0x5f424b){if(_0x5f424b){if(!fs[_0xf327('0x57')](path[_0xf327('0x58')](config[_0xf327('0x59')],_0xf327('0x5a'),_0x5f424b['savename']))){throw new db['Sequelize']['ValidationError'](_0xf327('0x5b'));}if(_0x5b7e18[_0xf327('0x38')]['exists']){return _0x3c1c1e[_0xf327('0x5c')](0xc8);}return _0x3c1c1e[_0xf327('0x53')](path[_0xf327('0x58')](config[_0xf327('0x59')],_0xf327('0x5a'),_0x5f424b[_0xf327('0x55')]),util[_0xf327('0x5d')](_0xf327('0x5e'),_0x5f424b[_0xf327('0x54')]||_0x5f424b[_0xf327('0x2a')],_0x5f424b[_0xf327('0x56')]['toLowerCase']()));}})[_0xf327('0x4f')](handleError(_0x3c1c1e,null));}; \ No newline at end of file +var _0x5e0c=['../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','end','json','count','offset','set','apply','reject','save','update','destroy','then','get','ExtractedReports','UserProfileResource','error','name','AnalyticExtractedReport','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','hasOwnProperty','limit','order','sort','where','pick','VIRTUAL','filter','merge','options','findAll','rows','catch','params','length','includeAll','include','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','download','basename','savename','existsSync','join','Sequelize','ValidationError','Report\x20not\x20found\x20or\x20empty','root','server/files/reports','%s.%s','toLowerCase','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'];(function(_0x32f296,_0x1877e7){var _0x29e16d=function(_0x149105){while(--_0x149105){_0x32f296['push'](_0x32f296['shift']());}};_0x29e16d(++_0x1877e7);}(_0x5e0c,0x109));var _0xc5e0=function(_0x522bc8,_0x3525bf){_0x522bc8=_0x522bc8-0x0;var _0x5c5ab4=_0x5e0c[_0x522bc8];return _0x5c5ab4;};'use strict';var pdf=require(_0xc5e0('0x0'));var emlformat=require(_0xc5e0('0x1'));var rimraf=require(_0xc5e0('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0xc5e0('0x3'));var rp=require(_0xc5e0('0x4'));var moment=require(_0xc5e0('0x5'));var BPromise=require(_0xc5e0('0x6'));var Mustache=require(_0xc5e0('0x7'));var util=require(_0xc5e0('0x8'));var path=require(_0xc5e0('0x9'));var sox=require(_0xc5e0('0xa'));var csv=require(_0xc5e0('0xb'));var ejs=require(_0xc5e0('0xc'));var fs=require('fs');var _=require(_0xc5e0('0xd'));var squel=require(_0xc5e0('0xe'));var crypto=require(_0xc5e0('0xf'));var jsforce=require(_0xc5e0('0x10'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xc5e0('0x11'));var Redis=require(_0xc5e0('0x12'));var authService=require(_0xc5e0('0x13'));var qs=require(_0xc5e0('0x14'));var as=require(_0xc5e0('0x15'));var hardwareService=require(_0xc5e0('0x16'));var logger=require(_0xc5e0('0x17'))(_0xc5e0('0x18'));var utils=require(_0xc5e0('0x19'));var config=require('../../config/environment');var db=require(_0xc5e0('0x1a'))['db'];function respondWithStatusCode(_0x2bd968,_0x57d908){_0x57d908=_0x57d908||0xcc;return function(_0x4b72f4){if(_0x4b72f4){return _0x2bd968[_0xc5e0('0x1b')](_0x57d908);}return _0x2bd968[_0xc5e0('0x1c')](_0x57d908)[_0xc5e0('0x1d')]();};}function respondWithResult(_0x3e21bb,_0x4a2738){_0x4a2738=_0x4a2738||0xc8;return function(_0x453e4e){if(_0x453e4e){return _0x3e21bb[_0xc5e0('0x1c')](_0x4a2738)[_0xc5e0('0x1e')](_0x453e4e);}};}function respondWithFilteredResult(_0x4076e9,_0x2e23a4){return function(_0x5e7cd4){if(_0x5e7cd4){var _0x2c7fef=_0x5e7cd4[_0xc5e0('0x1f')],_0x5ca30e=_0x2e23a4[_0xc5e0('0x20')],_0x2b2b43=_0x2e23a4[_0xc5e0('0x20')]+_0x2e23a4['limit'],_0x3d6f48;if(_0x2b2b43>=_0x2c7fef){_0x2b2b43=_0x2c7fef;_0x3d6f48=0xc8;}else{_0x3d6f48=0xce;}_0x4076e9[_0xc5e0('0x1c')](_0x3d6f48);return _0x4076e9[_0xc5e0('0x21')]('Content-Range',_0x5ca30e+'-'+_0x2b2b43+'/'+_0x2c7fef)['json'](_0x5e7cd4);}return null;};}function patchUpdates(_0x39938a){return function(_0x11a929){try{jsonpatch[_0xc5e0('0x22')](_0x11a929,_0x39938a,!![]);}catch(_0x55efb3){return BPromise[_0xc5e0('0x23')](_0x55efb3);}return _0x11a929[_0xc5e0('0x24')]();};}function saveUpdates(_0x51f480,_0xc90184){return function(_0x2a86ac){if(_0x2a86ac){return _0x2a86ac[_0xc5e0('0x25')](_0x51f480)['then'](function(_0x65139a){return _0x65139a;});}return null;};}function removeEntity(_0x368b9d,_0x199a09){return function(_0x3441df){if(_0x3441df){return _0x3441df[_0xc5e0('0x26')]()[_0xc5e0('0x27')](function(){var _0x103b7d=_0x3441df[_0xc5e0('0x28')]({'plain':!![]});var _0x3c97ad=_0xc5e0('0x29');return db[_0xc5e0('0x2a')][_0xc5e0('0x26')]({'where':{'type':_0x3c97ad,'resourceId':_0x103b7d['id']}})[_0xc5e0('0x27')](function(){return _0x3441df;});})['then'](function(){_0x368b9d[_0xc5e0('0x1c')](0xcc)[_0xc5e0('0x1d')]();});}};}function handleEntityNotFound(_0x514a4b,_0x1e84ef){return function(_0x964032){if(!_0x964032){_0x514a4b['sendStatus'](0x194);}return _0x964032;};}function handleError(_0x328388,_0xe1b679){_0xe1b679=_0xe1b679||0x1f4;return function(_0x5bb6fe){logger[_0xc5e0('0x2b')](_0x5bb6fe['stack']);if(_0x5bb6fe[_0xc5e0('0x2c')]){delete _0x5bb6fe[_0xc5e0('0x2c')];}_0x328388[_0xc5e0('0x1c')](_0xe1b679)['send'](_0x5bb6fe);};}exports['index']=function(_0xe57c7d,_0x34ebb3){var _0x52de68={},_0x1f4c6b={},_0x364df1={'count':0x0,'rows':[]};var _0x3d31d3=_['map'](db[_0xc5e0('0x2d')][_0xc5e0('0x2e')],function(_0x2ecc59){return{'name':_0x2ecc59[_0xc5e0('0x2f')],'type':_0x2ecc59[_0xc5e0('0x30')][_0xc5e0('0x31')]};});_0x1f4c6b[_0xc5e0('0x32')]=_[_0xc5e0('0x33')](_0x3d31d3,_0xc5e0('0x2c'));_0x1f4c6b[_0xc5e0('0x34')]=_[_0xc5e0('0x35')](_0xe57c7d['query']);_0x1f4c6b[_0xc5e0('0x36')]=_[_0xc5e0('0x37')](_0x1f4c6b[_0xc5e0('0x32')],_0x1f4c6b[_0xc5e0('0x34')]);_0x52de68[_0xc5e0('0x38')]=_[_0xc5e0('0x37')](_0x1f4c6b[_0xc5e0('0x32')],qs[_0xc5e0('0x39')](_0xe57c7d[_0xc5e0('0x34')][_0xc5e0('0x39')]));_0x52de68[_0xc5e0('0x38')]=_0x52de68['attributes']['length']?_0x52de68['attributes']:_0x1f4c6b[_0xc5e0('0x32')];if(!_0xe57c7d[_0xc5e0('0x34')][_0xc5e0('0x3a')]('nolimit')){_0x52de68[_0xc5e0('0x3b')]=qs[_0xc5e0('0x3b')](_0xe57c7d[_0xc5e0('0x34')][_0xc5e0('0x3b')]);_0x52de68[_0xc5e0('0x20')]=qs['offset'](_0xe57c7d['query'][_0xc5e0('0x20')]);}_0x52de68[_0xc5e0('0x3c')]=qs['sort'](_0xe57c7d[_0xc5e0('0x34')][_0xc5e0('0x3d')]);_0x52de68[_0xc5e0('0x3e')]=qs[_0xc5e0('0x36')](_[_0xc5e0('0x3f')](_0xe57c7d[_0xc5e0('0x34')],_0x1f4c6b['filters']),_0x3d31d3);if(_0xe57c7d[_0xc5e0('0x34')]['filter']){_0x52de68[_0xc5e0('0x3e')]=_['merge'](_0x52de68[_0xc5e0('0x3e')],{'$or':_[_0xc5e0('0x33')](_0x3d31d3,function(_0x13ddb0){if(_0x13ddb0[_0xc5e0('0x30')]!==_0xc5e0('0x40')){var _0x171f0f={};_0x171f0f[_0x13ddb0[_0xc5e0('0x2c')]]={'$like':'%'+_0xe57c7d[_0xc5e0('0x34')][_0xc5e0('0x41')]+'%'};return _0x171f0f;}})});}_0x52de68=_[_0xc5e0('0x42')]({},_0x52de68,_0xe57c7d[_0xc5e0('0x43')]);var _0x2f2266={'where':_0x52de68[_0xc5e0('0x3e')]};return db[_0xc5e0('0x2d')]['count'](_0x2f2266)['then'](function(_0x1f1546){_0x364df1['count']=_0x1f1546;if(_0xe57c7d[_0xc5e0('0x34')]['includeAll']){_0x52de68['include']=[{'all':!![]}];}return db[_0xc5e0('0x2d')][_0xc5e0('0x44')](_0x52de68);})[_0xc5e0('0x27')](function(_0x191bbe){_0x364df1[_0xc5e0('0x45')]=_0x191bbe;return _0x364df1;})[_0xc5e0('0x27')](respondWithFilteredResult(_0x34ebb3,_0x52de68))[_0xc5e0('0x46')](handleError(_0x34ebb3,null));};exports['show']=function(_0x32b8bc,_0x276745){var _0xa1b0a4={'raw':!![],'where':{'id':_0x32b8bc[_0xc5e0('0x47')]['id']}},_0x46be42={};_0x46be42[_0xc5e0('0x32')]=_[_0xc5e0('0x35')](db[_0xc5e0('0x2d')][_0xc5e0('0x2e')]);_0x46be42[_0xc5e0('0x34')]=_[_0xc5e0('0x35')](_0x32b8bc['query']);_0x46be42[_0xc5e0('0x36')]=_[_0xc5e0('0x37')](_0x46be42['model'],_0x46be42['query']);_0xa1b0a4['attributes']=_['intersection'](_0x46be42['model'],qs[_0xc5e0('0x39')](_0x32b8bc[_0xc5e0('0x34')]['fields']));_0xa1b0a4[_0xc5e0('0x38')]=_0xa1b0a4[_0xc5e0('0x38')][_0xc5e0('0x48')]?_0xa1b0a4[_0xc5e0('0x38')]:_0x46be42[_0xc5e0('0x32')];if(_0x32b8bc[_0xc5e0('0x34')][_0xc5e0('0x49')]){_0xa1b0a4[_0xc5e0('0x4a')]=[{'all':!![]}];}_0xa1b0a4=_['merge']({},_0xa1b0a4,_0x32b8bc[_0xc5e0('0x43')]);return db[_0xc5e0('0x2d')][_0xc5e0('0x4b')](_0xa1b0a4)[_0xc5e0('0x27')](handleEntityNotFound(_0x276745,null))[_0xc5e0('0x27')](respondWithResult(_0x276745,null))['catch'](handleError(_0x276745,null));};exports[_0xc5e0('0x4c')]=function(_0x710d78,_0x21c416){return db[_0xc5e0('0x2d')][_0xc5e0('0x4c')](_0x710d78[_0xc5e0('0x4d')],{})[_0xc5e0('0x27')](function(_0x3342a1){var _0x102c2f=_0x710d78[_0xc5e0('0x4e')][_0xc5e0('0x28')]({'plain':!![]});if(!_0x102c2f)throw new Error(_0xc5e0('0x4f'));if(_0x102c2f[_0xc5e0('0x50')]===_0xc5e0('0x4e')){var _0x35d2d5=_0x3342a1['get']({'plain':!![]});var _0x3cedcb='ExtractedReports';return db['UserProfileSection'][_0xc5e0('0x4b')]({'where':{'name':_0x3cedcb,'userProfileId':_0x102c2f[_0xc5e0('0x51')]},'raw':!![]})[_0xc5e0('0x27')](function(_0x1a5e4a){if(_0x1a5e4a&&_0x1a5e4a['autoAssociation']===0x0){return db[_0xc5e0('0x2a')][_0xc5e0('0x4c')]({'name':_0x35d2d5[_0xc5e0('0x2c')],'resourceId':_0x35d2d5['id'],'type':_0x1a5e4a[_0xc5e0('0x2c')],'sectionId':_0x1a5e4a['id']},{})[_0xc5e0('0x27')](function(){return _0x3342a1;});}else{return _0x3342a1;}})[_0xc5e0('0x46')](function(_0x1b1192){logger['error'](_0xc5e0('0x52'),_0x1b1192);throw _0x1b1192;});}return _0x3342a1;})[_0xc5e0('0x27')](respondWithResult(_0x21c416,0xc9))['catch'](handleError(_0x21c416,null));};exports['update']=function(_0x27ffef,_0x201217){if(_0x27ffef[_0xc5e0('0x4d')]['id']){delete _0x27ffef[_0xc5e0('0x4d')]['id'];}return db[_0xc5e0('0x2d')]['find']({'where':{'id':_0x27ffef[_0xc5e0('0x47')]['id']}})['then'](handleEntityNotFound(_0x201217,null))[_0xc5e0('0x27')](saveUpdates(_0x27ffef[_0xc5e0('0x4d')],null))['then'](respondWithResult(_0x201217,null))[_0xc5e0('0x46')](handleError(_0x201217,null));};exports[_0xc5e0('0x26')]=function(_0x1fa604,_0x36aea0){return db[_0xc5e0('0x2d')]['find']({'where':{'id':_0x1fa604[_0xc5e0('0x47')]['id']}})['then'](handleEntityNotFound(_0x36aea0,null))[_0xc5e0('0x27')](removeEntity(_0x36aea0,null))['catch'](handleError(_0x36aea0,null));};exports[_0xc5e0('0x53')]=function(_0x64f8ff,_0x423b70,_0x7bf1e7){return db['AnalyticExtractedReport'][_0xc5e0('0x4b')]({'where':{'id':_0x64f8ff[_0xc5e0('0x47')]['id']},'attributes':[_0xc5e0('0x2c'),_0xc5e0('0x54'),_0xc5e0('0x55'),'output'],'raw':!![]})[_0xc5e0('0x27')](handleEntityNotFound(_0x423b70,null))[_0xc5e0('0x27')](function(_0x395c5f){if(_0x395c5f){if(!fs[_0xc5e0('0x56')](path[_0xc5e0('0x57')](config['root'],'server/files/reports',_0x395c5f[_0xc5e0('0x55')]))){throw new db[(_0xc5e0('0x58'))][(_0xc5e0('0x59'))](_0xc5e0('0x5a'));}if(_0x64f8ff[_0xc5e0('0x34')]['exists']){return _0x423b70[_0xc5e0('0x1b')](0xc8);}return _0x423b70['download'](path[_0xc5e0('0x57')](config[_0xc5e0('0x5b')],_0xc5e0('0x5c'),_0x395c5f['savename']),util['format'](_0xc5e0('0x5d'),_0x395c5f[_0xc5e0('0x54')]||_0x395c5f[_0xc5e0('0x2c')],_0x395c5f['output'][_0xc5e0('0x5e')]()));}})[_0xc5e0('0x46')](handleError(_0x423b70,null));}; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.model.js b/server/api/analyticExtractedReport/analyticExtractedReport.model.js index 5d3defc..1aa7671 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 _0xf477=['../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./analyticExtractedReport.attributes','define','AnalyticExtractedReport','analytics_extracted_reports','lodash','util'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xf477,0x10f));var _0x7f47=function(_0x465a0c,_0x19d4d5){_0x465a0c=_0x465a0c-0x0;var _0x1e202e=_0xf477[_0x465a0c];return _0x1e202e;};'use strict';var _=require(_0x7f47('0x0'));var util=require(_0x7f47('0x1'));var logger=require(_0x7f47('0x2'))(_0x7f47('0x3'));var moment=require('moment');var BPromise=require(_0x7f47('0x4'));var rp=require(_0x7f47('0x5'));var fs=require('fs');var path=require(_0x7f47('0x6'));var rimraf=require(_0x7f47('0x7'));var config=require(_0x7f47('0x8'));var attributes=require(_0x7f47('0x9'));module['exports']=function(_0x1b8a37,_0x5a5c44){return _0x1b8a37[_0x7f47('0xa')](_0x7f47('0xb'),attributes,{'tableName':_0x7f47('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8821=['../../config/logger','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','AnalyticExtractedReport','analytics_extracted_reports','util'];(function(_0x4f2fdc,_0x279832){var _0x42a639=function(_0x34436e){while(--_0x34436e){_0x4f2fdc['push'](_0x4f2fdc['shift']());}};_0x42a639(++_0x279832);}(_0x8821,0x1a1));var _0x1882=function(_0x385eb1,_0x497a94){_0x385eb1=_0x385eb1-0x0;var _0x5d40eb=_0x8821[_0x385eb1];return _0x5d40eb;};'use strict';var _=require('lodash');var util=require(_0x1882('0x0'));var logger=require(_0x1882('0x1'))('api');var moment=require('moment');var BPromise=require(_0x1882('0x2'));var rp=require(_0x1882('0x3'));var fs=require('fs');var path=require(_0x1882('0x4'));var rimraf=require(_0x1882('0x5'));var config=require(_0x1882('0x6'));var attributes=require('./analyticExtractedReport.attributes');module[_0x1882('0x7')]=function(_0xbec9cf,_0x3a4337){return _0xbec9cf[_0x1882('0x8')](_0x1882('0x9'),attributes,{'tableName':_0x1882('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.rpc.js b/server/api/analyticExtractedReport/analyticExtractedReport.rpc.js index 9287f18..16bde1f 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 _0x06b4=['jayson/promise','client','request','then','info','AnalyticExtractedReport,\x20%s,\x20%s','debug','AnalyticExtractedReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc'];(function(_0x474f47,_0x2303b7){var _0x21bfe6=function(_0x1121d1){while(--_0x1121d1){_0x474f47['push'](_0x474f47['shift']());}};_0x21bfe6(++_0x2303b7);}(_0x06b4,0x17f));var _0x406b=function(_0x2fc4c5,_0x801c20){_0x2fc4c5=_0x2fc4c5-0x0;var _0x534a37=_0x06b4[_0x2fc4c5];return _0x534a37;};'use strict';var _=require(_0x406b('0x0'));var util=require('util');var moment=require(_0x406b('0x1'));var BPromise=require(_0x406b('0x2'));var rs=require(_0x406b('0x3'));var fs=require('fs');var Redis=require(_0x406b('0x4'));var db=require(_0x406b('0x5'))['db'];var utils=require(_0x406b('0x6'));var logger=require('../../config/logger')(_0x406b('0x7'));var config=require('../../config/environment');var jayson=require(_0x406b('0x8'));var client=jayson[_0x406b('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x48c367,_0x446f5f,_0x1272c5){return new BPromise(function(_0x2ef18a,_0x2d682f){return client[_0x406b('0xa')](_0x48c367,_0x1272c5)[_0x406b('0xb')](function(_0x1e3759){logger[_0x406b('0xc')](_0x406b('0xd'),_0x446f5f,'request\x20sent');logger[_0x406b('0xe')](_0x406b('0xf'),_0x446f5f,'request\x20sent',JSON[_0x406b('0x10')](_0x1e3759));if(_0x1e3759[_0x406b('0x11')]){if(_0x1e3759['error'][_0x406b('0x12')]===0x1f4){logger[_0x406b('0x11')]('AnalyticExtractedReport,\x20%s,\x20%s',_0x446f5f,_0x1e3759[_0x406b('0x11')]['message']);return _0x2d682f(_0x1e3759['error'][_0x406b('0x13')]);}logger[_0x406b('0x11')]('AnalyticExtractedReport,\x20%s,\x20%s',_0x446f5f,_0x1e3759['error']['message']);return _0x2ef18a(_0x1e3759[_0x406b('0x11')][_0x406b('0x13')]);}else{logger['info']('AnalyticExtractedReport,\x20%s,\x20%s',_0x446f5f,_0x406b('0x14'));_0x2ef18a(_0x1e3759[_0x406b('0x15')][_0x406b('0x13')]);}})[_0x406b('0x16')](function(_0x389735){logger[_0x406b('0x11')](_0x406b('0xd'),_0x446f5f,_0x389735);_0x2d682f(_0x389735);});});} \ No newline at end of file +var _0x4484=['request','then','info','AnalyticExtractedReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticExtractedReport,\x20%s,\x20%s,\x20%s','error','code','message','result','lodash','util','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','client'];(function(_0xc36646,_0x2db8f5){var _0x155c57=function(_0x5b6b28){while(--_0x5b6b28){_0xc36646['push'](_0xc36646['shift']());}};_0x155c57(++_0x2db8f5);}(_0x4484,0x128));var _0x4448=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x4484[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x4448('0x0'));var util=require(_0x4448('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x4448('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x4448('0x3'));var logger=require(_0x4448('0x4'))(_0x4448('0x5'));var config=require(_0x4448('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x4448('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2f0bea,_0x567b86,_0x2c5258){return new BPromise(function(_0xd0c6dd,_0x311051){return client[_0x4448('0x8')](_0x2f0bea,_0x2c5258)[_0x4448('0x9')](function(_0x3d7991){logger[_0x4448('0xa')](_0x4448('0xb'),_0x567b86,_0x4448('0xc'));logger[_0x4448('0xd')](_0x4448('0xe'),_0x567b86,'request\x20sent',JSON['stringify'](_0x3d7991));if(_0x3d7991[_0x4448('0xf')]){if(_0x3d7991[_0x4448('0xf')][_0x4448('0x10')]===0x1f4){logger['error'](_0x4448('0xb'),_0x567b86,_0x3d7991['error'][_0x4448('0x11')]);return _0x311051(_0x3d7991['error'][_0x4448('0x11')]);}logger[_0x4448('0xf')](_0x4448('0xb'),_0x567b86,_0x3d7991[_0x4448('0xf')][_0x4448('0x11')]);return _0xd0c6dd(_0x3d7991[_0x4448('0xf')]['message']);}else{logger[_0x4448('0xa')](_0x4448('0xb'),_0x567b86,_0x4448('0xc'));_0xd0c6dd(_0x3d7991[_0x4448('0x12')]['message']);}})['catch'](function(_0x2e77d2){logger[_0x4448('0xf')](_0x4448('0xb'),_0x567b86,_0x2e77d2);_0x311051(_0x2e77d2);});});} \ No newline at end of file diff --git a/server/api/analyticExtractedReport/index.js b/server/api/analyticExtractedReport/index.js index 07ed4e4..d2d96e0 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 _0x55a3=['/:id/download','post','create','put','update','delete','destroy','multer','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./analyticExtractedReport.controller','get','isAuthenticated','index','/:id','show'];(function(_0x279478,_0x5d9207){var _0x141575=function(_0x2d8142){while(--_0x2d8142){_0x279478['push'](_0x279478['shift']());}};_0x141575(++_0x5d9207);}(_0x55a3,0x8c));var _0x355a=function(_0x88342d,_0xe0feb3){_0x88342d=_0x88342d-0x0;var _0x238708=_0x55a3[_0x88342d];return _0x238708;};'use strict';var multer=require(_0x355a('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x355a('0x1'));var express=require(_0x355a('0x2'));var router=express[_0x355a('0x3')]();var auth=require(_0x355a('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x355a('0x5'));var controller=require(_0x355a('0x6'));router[_0x355a('0x7')]('/',auth[_0x355a('0x8')](),controller[_0x355a('0x9')]);router[_0x355a('0x7')](_0x355a('0xa'),auth[_0x355a('0x8')](),controller[_0x355a('0xb')]);router[_0x355a('0x7')](_0x355a('0xc'),auth[_0x355a('0x8')](),controller['download']);router[_0x355a('0xd')]('/',auth['isAuthenticated'](),controller[_0x355a('0xe')]);router[_0x355a('0xf')](_0x355a('0xa'),auth[_0x355a('0x8')](),controller[_0x355a('0x10')]);router[_0x355a('0x11')](_0x355a('0xa'),auth[_0x355a('0x8')](),controller[_0x355a('0x12')]);module['exports']=router; \ No newline at end of file +var _0x921b=['../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticExtractedReport.controller','get','index','/:id','isAuthenticated','show','/:id/download','download','post','create','put','delete','destroy','exports','multer','util','path','Router'];(function(_0x233ab6,_0x3b8bdd){var _0x2c8c8e=function(_0x565c45){while(--_0x565c45){_0x233ab6['push'](_0x233ab6['shift']());}};_0x2c8c8e(++_0x3b8bdd);}(_0x921b,0x10d));var _0xb921=function(_0x4b3426,_0x1e8579){_0x4b3426=_0x4b3426-0x0;var _0x5f04a9=_0x921b[_0x4b3426];return _0x5f04a9;};'use strict';var multer=require(_0xb921('0x0'));var util=require(_0xb921('0x1'));var path=require(_0xb921('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xb921('0x3')]();var auth=require(_0xb921('0x4'));var interaction=require(_0xb921('0x5'));var config=require(_0xb921('0x6'));var controller=require(_0xb921('0x7'));router[_0xb921('0x8')]('/',auth['isAuthenticated'](),controller[_0xb921('0x9')]);router['get'](_0xb921('0xa'),auth[_0xb921('0xb')](),controller[_0xb921('0xc')]);router['get'](_0xb921('0xd'),auth[_0xb921('0xb')](),controller[_0xb921('0xe')]);router[_0xb921('0xf')]('/',auth['isAuthenticated'](),controller[_0xb921('0x10')]);router[_0xb921('0x11')](_0xb921('0xa'),auth[_0xb921('0xb')](),controller['update']);router[_0xb921('0x12')](_0xb921('0xa'),auth[_0xb921('0xb')](),controller[_0xb921('0x13')]);module[_0xb921('0x14')]=router; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.attributes.js b/server/api/analyticFieldReport/analyticFieldReport.attributes.js index 15dd4c4..8e65fc5 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 _0x814b=['TEXT','STRING','BOOLEAN','sequelize','exports'];(function(_0x5076ae,_0x4d9525){var _0x1b936f=function(_0x46f2a4){while(--_0x46f2a4){_0x5076ae['push'](_0x5076ae['shift']());}};_0x1b936f(++_0x4d9525);}(_0x814b,0x1a2));var _0xb814=function(_0x134192,_0x36adc5){_0x134192=_0x134192-0x0;var _0x3cd080=_0x814b[_0x134192];return _0x3cd080;};'use strict';var Sequelize=require(_0xb814('0x0'));module[_0xb814('0x1')]={'field':{'type':Sequelize[_0xb814('0x2')]},'alias':{'type':Sequelize[_0xb814('0x3')]},'function':{'type':Sequelize[_0xb814('0x3')]},'format':{'type':Sequelize[_0xb814('0x3')]},'groupBy':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'orderBy':{'type':Sequelize[_0xb814('0x3')]},'custom':{'type':Sequelize[_0xb814('0x4')],'defaultValue':![]}}; \ No newline at end of file +var _0x326f=['STRING','BOOLEAN','sequelize'];(function(_0x1cd5b1,_0x58dd23){var _0x25b4c7=function(_0x272195){while(--_0x272195){_0x1cd5b1['push'](_0x1cd5b1['shift']());}};_0x25b4c7(++_0x58dd23);}(_0x326f,0xd1));var _0xf326=function(_0x29462d,_0x42f9cb){_0x29462d=_0x29462d-0x0;var _0x4d97b1=_0x326f[_0x29462d];return _0x4d97b1;};'use strict';var Sequelize=require(_0xf326('0x0'));module['exports']={'field':{'type':Sequelize['TEXT']},'alias':{'type':Sequelize[_0xf326('0x1')]},'function':{'type':Sequelize[_0xf326('0x1')]},'format':{'type':Sequelize[_0xf326('0x1')]},'groupBy':{'type':Sequelize[_0xf326('0x2')],'defaultValue':![]},'orderBy':{'type':Sequelize[_0xf326('0x1')]},'custom':{'type':Sequelize[_0xf326('0x2')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.controller.js b/server/api/analyticFieldReport/analyticFieldReport.controller.js index 0dc9fb5..d7c0843 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 _0x7c55=['filter','merge','then','includeAll','include','findAll','rows','catch','show','params','rawAttributes','options','find','create','body','bulkCreate','ids','addFields','AnalyticCustomReport','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','util','path','sox','to-csv','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../mysqldb','sendStatus','end','status','json','count','offset','limit','apply','reject','save','update','destroy','error','stack','name','index','map','AnalyticFieldReport','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','where'];(function(_0x1e5f91,_0xa38bd9){var _0x5bb46b=function(_0x2af6e6){while(--_0x2af6e6){_0x1e5f91['push'](_0x1e5f91['shift']());}};_0x5bb46b(++_0xa38bd9);}(_0x7c55,0x180));var _0x57c5=function(_0x55bf39,_0x20a585){_0x55bf39=_0x55bf39-0x0;var _0x28d307=_0x7c55[_0x55bf39];return _0x28d307;};'use strict';var pdf=require(_0x57c5('0x0'));var emlformat=require(_0x57c5('0x1'));var rimraf=require(_0x57c5('0x2'));var zipdir=require(_0x57c5('0x3'));var jsonpatch=require(_0x57c5('0x4'));var rp=require('request-promise');var moment=require(_0x57c5('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x57c5('0x6'));var util=require(_0x57c5('0x7'));var path=require(_0x57c5('0x8'));var sox=require(_0x57c5('0x9'));var csv=require(_0x57c5('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x57c5('0xb'));var deskjs=require(_0x57c5('0xc'));var toCsv=require(_0x57c5('0xa'));var querystring=require(_0x57c5('0xd'));var Papa=require(_0x57c5('0xe'));var Redis=require('ioredis');var authService=require(_0x57c5('0xf'));var qs=require(_0x57c5('0x10'));var as=require(_0x57c5('0x11'));var hardwareService=require(_0x57c5('0x12'));var logger=require('../../config/logger')(_0x57c5('0x13'));var utils=require('../../config/utils');var config=require(_0x57c5('0x14'));var db=require(_0x57c5('0x15'))['db'];function respondWithStatusCode(_0x42310d,_0x4d3a99){_0x4d3a99=_0x4d3a99||0xcc;return function(_0x29d313){if(_0x29d313){return _0x42310d[_0x57c5('0x16')](_0x4d3a99);}return _0x42310d['status'](_0x4d3a99)[_0x57c5('0x17')]();};}function respondWithResult(_0x3e0174,_0xdc2558){_0xdc2558=_0xdc2558||0xc8;return function(_0x41abfc){if(_0x41abfc){return _0x3e0174[_0x57c5('0x18')](_0xdc2558)[_0x57c5('0x19')](_0x41abfc);}};}function respondWithFilteredResult(_0x31ef5e,_0x408874){return function(_0x45f9c3){if(_0x45f9c3){var _0x3e7798=_0x45f9c3[_0x57c5('0x1a')],_0x5ef878=_0x408874['offset'],_0x151aa3=_0x408874[_0x57c5('0x1b')]+_0x408874[_0x57c5('0x1c')],_0x572385;if(_0x151aa3>=_0x3e7798){_0x151aa3=_0x3e7798;_0x572385=0xc8;}else{_0x572385=0xce;}_0x31ef5e[_0x57c5('0x18')](_0x572385);return _0x31ef5e['set']('Content-Range',_0x5ef878+'-'+_0x151aa3+'/'+_0x3e7798)['json'](_0x45f9c3);}return null;};}function patchUpdates(_0x4baace){return function(_0xe33428){try{jsonpatch[_0x57c5('0x1d')](_0xe33428,_0x4baace,!![]);}catch(_0x4b3a16){return BPromise[_0x57c5('0x1e')](_0x4b3a16);}return _0xe33428[_0x57c5('0x1f')]();};}function saveUpdates(_0x373d1a,_0x58cc9f){return function(_0x35943d){if(_0x35943d){return _0x35943d[_0x57c5('0x20')](_0x373d1a)['then'](function(_0x597e52){return _0x597e52;});}return null;};}function removeEntity(_0x56f182,_0x2a5415){return function(_0x172a4b){if(_0x172a4b){return _0x172a4b[_0x57c5('0x21')]()['then'](function(){_0x56f182[_0x57c5('0x18')](0xcc)[_0x57c5('0x17')]();});}};}function handleEntityNotFound(_0x423d1d,_0x5bb917){return function(_0x1c45f1){if(!_0x1c45f1){_0x423d1d[_0x57c5('0x16')](0x194);}return _0x1c45f1;};}function handleError(_0x22111c,_0x5ec1a1){_0x5ec1a1=_0x5ec1a1||0x1f4;return function(_0x55665d){logger[_0x57c5('0x22')](_0x55665d[_0x57c5('0x23')]);if(_0x55665d[_0x57c5('0x24')]){delete _0x55665d[_0x57c5('0x24')];}_0x22111c[_0x57c5('0x18')](_0x5ec1a1)['send'](_0x55665d);};}exports[_0x57c5('0x25')]=function(_0x12c3d2,_0x5cbbe9){var _0x57e998={},_0x3d121a={},_0x410172={'count':0x0,'rows':[]};var _0x5224a3=_[_0x57c5('0x26')](db[_0x57c5('0x27')]['rawAttributes'],function(_0x5f5d60){return{'name':_0x5f5d60[_0x57c5('0x28')],'type':_0x5f5d60[_0x57c5('0x29')][_0x57c5('0x2a')]};});_0x3d121a[_0x57c5('0x2b')]=_['map'](_0x5224a3,_0x57c5('0x24'));_0x3d121a[_0x57c5('0x2c')]=_[_0x57c5('0x2d')](_0x12c3d2[_0x57c5('0x2c')]);_0x3d121a[_0x57c5('0x2e')]=_[_0x57c5('0x2f')](_0x3d121a[_0x57c5('0x2b')],_0x3d121a[_0x57c5('0x2c')]);_0x57e998[_0x57c5('0x30')]=_[_0x57c5('0x2f')](_0x3d121a['model'],qs[_0x57c5('0x31')](_0x12c3d2[_0x57c5('0x2c')]['fields']));_0x57e998['attributes']=_0x57e998[_0x57c5('0x30')][_0x57c5('0x32')]?_0x57e998[_0x57c5('0x30')]:_0x3d121a[_0x57c5('0x2b')];if(!_0x12c3d2[_0x57c5('0x2c')]['hasOwnProperty'](_0x57c5('0x33'))){_0x57e998[_0x57c5('0x1c')]=qs[_0x57c5('0x1c')](_0x12c3d2[_0x57c5('0x2c')]['limit']);_0x57e998[_0x57c5('0x1b')]=qs[_0x57c5('0x1b')](_0x12c3d2[_0x57c5('0x2c')][_0x57c5('0x1b')]);}_0x57e998[_0x57c5('0x34')]=qs['sort'](_0x12c3d2[_0x57c5('0x2c')]['sort']);_0x57e998[_0x57c5('0x35')]=qs[_0x57c5('0x2e')](_['pick'](_0x12c3d2['query'],_0x3d121a['filters']),_0x5224a3);if(_0x12c3d2[_0x57c5('0x2c')][_0x57c5('0x36')]){_0x57e998[_0x57c5('0x35')]=_[_0x57c5('0x37')](_0x57e998[_0x57c5('0x35')],{'$or':_[_0x57c5('0x26')](_0x5224a3,function(_0x4f4533){if(_0x4f4533[_0x57c5('0x29')]!=='VIRTUAL'){var _0x363257={};_0x363257[_0x4f4533[_0x57c5('0x24')]]={'$like':'%'+_0x12c3d2[_0x57c5('0x2c')][_0x57c5('0x36')]+'%'};return _0x363257;}})});}_0x57e998=_[_0x57c5('0x37')]({},_0x57e998,_0x12c3d2['options']);var _0x2b384e={'where':_0x57e998[_0x57c5('0x35')]};return db[_0x57c5('0x27')][_0x57c5('0x1a')](_0x2b384e)[_0x57c5('0x38')](function(_0x224339){_0x410172[_0x57c5('0x1a')]=_0x224339;if(_0x12c3d2['query'][_0x57c5('0x39')]){_0x57e998[_0x57c5('0x3a')]=[{'all':!![]}];}return db[_0x57c5('0x27')][_0x57c5('0x3b')](_0x57e998);})['then'](function(_0x2c6f4b){_0x410172[_0x57c5('0x3c')]=_0x2c6f4b;return _0x410172;})[_0x57c5('0x38')](respondWithFilteredResult(_0x5cbbe9,_0x57e998))[_0x57c5('0x3d')](handleError(_0x5cbbe9,null));};exports[_0x57c5('0x3e')]=function(_0x52d416,_0x2634cf){var _0x2fbff0={'raw':![],'where':{'id':_0x52d416[_0x57c5('0x3f')]['id']}},_0x24ae67={};_0x24ae67[_0x57c5('0x2b')]=_[_0x57c5('0x2d')](db['AnalyticFieldReport'][_0x57c5('0x40')]);_0x24ae67[_0x57c5('0x2c')]=_[_0x57c5('0x2d')](_0x52d416[_0x57c5('0x2c')]);_0x24ae67['filters']=_[_0x57c5('0x2f')](_0x24ae67[_0x57c5('0x2b')],_0x24ae67[_0x57c5('0x2c')]);_0x2fbff0[_0x57c5('0x30')]=_['intersection'](_0x24ae67[_0x57c5('0x2b')],qs[_0x57c5('0x31')](_0x52d416[_0x57c5('0x2c')][_0x57c5('0x31')]));_0x2fbff0[_0x57c5('0x30')]=_0x2fbff0[_0x57c5('0x30')][_0x57c5('0x32')]?_0x2fbff0[_0x57c5('0x30')]:_0x24ae67['model'];if(_0x52d416[_0x57c5('0x2c')][_0x57c5('0x39')]){_0x2fbff0[_0x57c5('0x3a')]=[{'all':!![]}];}_0x2fbff0=_[_0x57c5('0x37')]({},_0x2fbff0,_0x52d416[_0x57c5('0x41')]);return db['AnalyticFieldReport'][_0x57c5('0x42')](_0x2fbff0)['then'](handleEntityNotFound(_0x2634cf,null))[_0x57c5('0x38')](respondWithResult(_0x2634cf,null))[_0x57c5('0x3d')](handleError(_0x2634cf,null));};exports['create']=function(_0x5a618d,_0x4271bd){return db[_0x57c5('0x27')][_0x57c5('0x43')](_0x5a618d[_0x57c5('0x44')],{})[_0x57c5('0x38')](respondWithResult(_0x4271bd,0xc9))[_0x57c5('0x3d')](handleError(_0x4271bd,null));};exports[_0x57c5('0x45')]=function(_0x37bdb7,_0x846476){return db[_0x57c5('0x27')][_0x57c5('0x45')](_0x37bdb7['body'],{'raw':![],'individualHooks':!![]})[_0x57c5('0x38')](respondWithResult(_0x846476,0xc9))['catch'](handleError(_0x846476,null));};exports[_0x57c5('0x20')]=function(_0x23f24c,_0x3b1540){if(_0x23f24c[_0x57c5('0x44')]['id']){delete _0x23f24c[_0x57c5('0x44')]['id'];}return db[_0x57c5('0x27')][_0x57c5('0x42')]({'where':{'id':_0x23f24c[_0x57c5('0x3f')]['id']}})[_0x57c5('0x38')](handleEntityNotFound(_0x3b1540,null))[_0x57c5('0x38')](saveUpdates(_0x23f24c[_0x57c5('0x44')],null))[_0x57c5('0x38')](respondWithResult(_0x3b1540,null))[_0x57c5('0x3d')](handleError(_0x3b1540,null));};exports['destroy']=function(_0x311b46,_0xf3bb6e){return db['AnalyticFieldReport'][_0x57c5('0x42')]({'where':{'id':_0x311b46[_0x57c5('0x3f')]['id']}})['then'](handleEntityNotFound(_0xf3bb6e,null))['then'](removeEntity(_0xf3bb6e,null))['catch'](handleError(_0xf3bb6e,null));};exports['bulkDestroy']=function(_0x50d665,_0x51aa96){return db[_0x57c5('0x27')][_0x57c5('0x21')]({'where':{'id':_0x50d665['query'][_0x57c5('0x46')]||[]},'raw':![],'individualHooks':!![]})[_0x57c5('0x38')](respondWithResult(_0x51aa96,0xcc))[_0x57c5('0x3d')](handleError(_0x51aa96,null));};exports[_0x57c5('0x47')]=function(_0x14f7f0,_0x1e6137,_0x41ada8){return db[_0x57c5('0x48')]['findOne']({'where':{'id':_0x14f7f0[_0x57c5('0x3f')]['id']}})[_0x57c5('0x38')](handleEntityNotFound(_0x1e6137,null))[_0x57c5('0x38')](function(_0x221534){if(_0x221534){return db['sequelize']['transaction'](function(_0x5861d){return db['AnalyticFieldReport'][_0x57c5('0x21')]({'where':{'CustomReportId':_0x14f7f0[_0x57c5('0x3f')]['id']},'transaction':_0x5861d})[_0x57c5('0x38')](function(_0x478c38){var _0x4b8b2f=_[_0x57c5('0x26')](_0x14f7f0[_0x57c5('0x44')],function(_0x456618){delete _0x456618['id'];_0x456618['CustomReportId']=_0x14f7f0['params']['id'];return _0x456618;});return db[_0x57c5('0x27')][_0x57c5('0x45')](_0x4b8b2f,{'transaction':_0x5861d});});})['then'](function(){return db['AnalyticFieldReport'][_0x57c5('0x3b')]({'where':{'CustomReportId':_0x14f7f0['params']['id']}});});}})['then'](respondWithResult(_0x1e6137,null))[_0x57c5('0x3d')](handleError(_0x1e6137,null));}; \ No newline at end of file +var _0x973f=['util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','api','../../config/utils','../../config/environment','sendStatus','end','status','json','count','offset','set','Content-Range','apply','save','error','stack','name','index','map','AnalyticFieldReport','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','length','nolimit','limit','order','sort','where','pick','filter','merge','options','then','includeAll','findAll','rows','catch','params','include','find','create','body','bulkCreate','update','destroy','bulkDestroy','addFields','AnalyticCustomReport','sequelize','transaction','CustomReportId','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache'];(function(_0x48e2eb,_0x2df535){var _0x5eca92=function(_0x170b22){while(--_0x170b22){_0x48e2eb['push'](_0x48e2eb['shift']());}};_0x5eca92(++_0x2df535);}(_0x973f,0x13f));var _0xf973=function(_0x4b055c,_0x4b870b){_0x4b055c=_0x4b055c-0x0;var _0x4b62bb=_0x973f[_0x4b055c];return _0x4b62bb;};'use strict';var pdf=require(_0xf973('0x0'));var emlformat=require(_0xf973('0x1'));var rimraf=require(_0xf973('0x2'));var zipdir=require(_0xf973('0x3'));var jsonpatch=require(_0xf973('0x4'));var rp=require(_0xf973('0x5'));var moment=require(_0xf973('0x6'));var BPromise=require(_0xf973('0x7'));var Mustache=require(_0xf973('0x8'));var util=require(_0xf973('0x9'));var path=require(_0xf973('0xa'));var sox=require(_0xf973('0xb'));var csv=require(_0xf973('0xc'));var ejs=require(_0xf973('0xd'));var fs=require('fs');var _=require(_0xf973('0xe'));var squel=require(_0xf973('0xf'));var crypto=require(_0xf973('0x10'));var jsforce=require(_0xf973('0x11'));var deskjs=require(_0xf973('0x12'));var toCsv=require('to-csv');var querystring=require(_0xf973('0x13'));var Papa=require('papaparse');var Redis=require(_0xf973('0x14'));var authService=require(_0xf973('0x15'));var qs=require(_0xf973('0x16'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xf973('0x17'));var utils=require(_0xf973('0x18'));var config=require(_0xf973('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x33947f,_0x176b1a){_0x176b1a=_0x176b1a||0xcc;return function(_0x1bef17){if(_0x1bef17){return _0x33947f[_0xf973('0x1a')](_0x176b1a);}return _0x33947f['status'](_0x176b1a)[_0xf973('0x1b')]();};}function respondWithResult(_0x46fd80,_0x44d1d4){_0x44d1d4=_0x44d1d4||0xc8;return function(_0x21d817){if(_0x21d817){return _0x46fd80[_0xf973('0x1c')](_0x44d1d4)[_0xf973('0x1d')](_0x21d817);}};}function respondWithFilteredResult(_0x2d575c,_0x1eb405){return function(_0xb3f815){if(_0xb3f815){var _0x11ae86=_0xb3f815[_0xf973('0x1e')],_0x59509a=_0x1eb405[_0xf973('0x1f')],_0xc51fe1=_0x1eb405[_0xf973('0x1f')]+_0x1eb405['limit'],_0x8f1147;if(_0xc51fe1>=_0x11ae86){_0xc51fe1=_0x11ae86;_0x8f1147=0xc8;}else{_0x8f1147=0xce;}_0x2d575c['status'](_0x8f1147);return _0x2d575c[_0xf973('0x20')](_0xf973('0x21'),_0x59509a+'-'+_0xc51fe1+'/'+_0x11ae86)[_0xf973('0x1d')](_0xb3f815);}return null;};}function patchUpdates(_0x535712){return function(_0x3e043a){try{jsonpatch[_0xf973('0x22')](_0x3e043a,_0x535712,!![]);}catch(_0x2e18dd){return BPromise['reject'](_0x2e18dd);}return _0x3e043a[_0xf973('0x23')]();};}function saveUpdates(_0x4e6ee6,_0x24bac8){return function(_0x56b18b){if(_0x56b18b){return _0x56b18b['update'](_0x4e6ee6)['then'](function(_0x52e7ac){return _0x52e7ac;});}return null;};}function removeEntity(_0x44c100,_0x172b0b){return function(_0x3d0123){if(_0x3d0123){return _0x3d0123['destroy']()['then'](function(){_0x44c100[_0xf973('0x1c')](0xcc)[_0xf973('0x1b')]();});}};}function handleEntityNotFound(_0x459177,_0x2c21f1){return function(_0x715fdc){if(!_0x715fdc){_0x459177[_0xf973('0x1a')](0x194);}return _0x715fdc;};}function handleError(_0x3866d8,_0x3b9f1f){_0x3b9f1f=_0x3b9f1f||0x1f4;return function(_0x5405c8){logger[_0xf973('0x24')](_0x5405c8[_0xf973('0x25')]);if(_0x5405c8['name']){delete _0x5405c8[_0xf973('0x26')];}_0x3866d8[_0xf973('0x1c')](_0x3b9f1f)['send'](_0x5405c8);};}exports[_0xf973('0x27')]=function(_0x31fd9d,_0x2b5843){var _0x10bc79={},_0x28f8d1={},_0x18e2be={'count':0x0,'rows':[]};var _0x4406ee=_[_0xf973('0x28')](db[_0xf973('0x29')][_0xf973('0x2a')],function(_0x1930e5){return{'name':_0x1930e5[_0xf973('0x2b')],'type':_0x1930e5[_0xf973('0x2c')][_0xf973('0x2d')]};});_0x28f8d1[_0xf973('0x2e')]=_[_0xf973('0x28')](_0x4406ee,_0xf973('0x26'));_0x28f8d1[_0xf973('0x2f')]=_[_0xf973('0x30')](_0x31fd9d['query']);_0x28f8d1[_0xf973('0x31')]=_['intersection'](_0x28f8d1[_0xf973('0x2e')],_0x28f8d1[_0xf973('0x2f')]);_0x10bc79[_0xf973('0x32')]=_[_0xf973('0x33')](_0x28f8d1[_0xf973('0x2e')],qs[_0xf973('0x34')](_0x31fd9d['query']['fields']));_0x10bc79[_0xf973('0x32')]=_0x10bc79[_0xf973('0x32')][_0xf973('0x35')]?_0x10bc79[_0xf973('0x32')]:_0x28f8d1[_0xf973('0x2e')];if(!_0x31fd9d[_0xf973('0x2f')]['hasOwnProperty'](_0xf973('0x36'))){_0x10bc79['limit']=qs[_0xf973('0x37')](_0x31fd9d[_0xf973('0x2f')][_0xf973('0x37')]);_0x10bc79['offset']=qs[_0xf973('0x1f')](_0x31fd9d['query'][_0xf973('0x1f')]);}_0x10bc79[_0xf973('0x38')]=qs[_0xf973('0x39')](_0x31fd9d[_0xf973('0x2f')][_0xf973('0x39')]);_0x10bc79[_0xf973('0x3a')]=qs[_0xf973('0x31')](_[_0xf973('0x3b')](_0x31fd9d[_0xf973('0x2f')],_0x28f8d1[_0xf973('0x31')]),_0x4406ee);if(_0x31fd9d['query'][_0xf973('0x3c')]){_0x10bc79[_0xf973('0x3a')]=_['merge'](_0x10bc79[_0xf973('0x3a')],{'$or':_[_0xf973('0x28')](_0x4406ee,function(_0x56cc20){if(_0x56cc20[_0xf973('0x2c')]!=='VIRTUAL'){var _0x44f82d={};_0x44f82d[_0x56cc20[_0xf973('0x26')]]={'$like':'%'+_0x31fd9d[_0xf973('0x2f')][_0xf973('0x3c')]+'%'};return _0x44f82d;}})});}_0x10bc79=_[_0xf973('0x3d')]({},_0x10bc79,_0x31fd9d[_0xf973('0x3e')]);var _0x278f99={'where':_0x10bc79[_0xf973('0x3a')]};return db['AnalyticFieldReport']['count'](_0x278f99)[_0xf973('0x3f')](function(_0x35c1e3){_0x18e2be[_0xf973('0x1e')]=_0x35c1e3;if(_0x31fd9d['query'][_0xf973('0x40')]){_0x10bc79['include']=[{'all':!![]}];}return db['AnalyticFieldReport'][_0xf973('0x41')](_0x10bc79);})[_0xf973('0x3f')](function(_0x26749c){_0x18e2be[_0xf973('0x42')]=_0x26749c;return _0x18e2be;})[_0xf973('0x3f')](respondWithFilteredResult(_0x2b5843,_0x10bc79))[_0xf973('0x43')](handleError(_0x2b5843,null));};exports['show']=function(_0xf8f00a,_0xdaed82){var _0x3a3636={'raw':![],'where':{'id':_0xf8f00a[_0xf973('0x44')]['id']}},_0x544efb={};_0x544efb[_0xf973('0x2e')]=_[_0xf973('0x30')](db[_0xf973('0x29')][_0xf973('0x2a')]);_0x544efb[_0xf973('0x2f')]=_[_0xf973('0x30')](_0xf8f00a[_0xf973('0x2f')]);_0x544efb['filters']=_[_0xf973('0x33')](_0x544efb['model'],_0x544efb[_0xf973('0x2f')]);_0x3a3636[_0xf973('0x32')]=_['intersection'](_0x544efb[_0xf973('0x2e')],qs[_0xf973('0x34')](_0xf8f00a[_0xf973('0x2f')][_0xf973('0x34')]));_0x3a3636[_0xf973('0x32')]=_0x3a3636[_0xf973('0x32')][_0xf973('0x35')]?_0x3a3636['attributes']:_0x544efb[_0xf973('0x2e')];if(_0xf8f00a[_0xf973('0x2f')]['includeAll']){_0x3a3636[_0xf973('0x45')]=[{'all':!![]}];}_0x3a3636=_['merge']({},_0x3a3636,_0xf8f00a[_0xf973('0x3e')]);return db['AnalyticFieldReport'][_0xf973('0x46')](_0x3a3636)[_0xf973('0x3f')](handleEntityNotFound(_0xdaed82,null))[_0xf973('0x3f')](respondWithResult(_0xdaed82,null))[_0xf973('0x43')](handleError(_0xdaed82,null));};exports[_0xf973('0x47')]=function(_0x4c859d,_0x2ac8c9){return db[_0xf973('0x29')][_0xf973('0x47')](_0x4c859d[_0xf973('0x48')],{})[_0xf973('0x3f')](respondWithResult(_0x2ac8c9,0xc9))[_0xf973('0x43')](handleError(_0x2ac8c9,null));};exports['bulkCreate']=function(_0x14e62f,_0x4909d7){return db['AnalyticFieldReport'][_0xf973('0x49')](_0x14e62f['body'],{'raw':![],'individualHooks':!![]})[_0xf973('0x3f')](respondWithResult(_0x4909d7,0xc9))[_0xf973('0x43')](handleError(_0x4909d7,null));};exports[_0xf973('0x4a')]=function(_0x47d31e,_0x223a5a){if(_0x47d31e[_0xf973('0x48')]['id']){delete _0x47d31e[_0xf973('0x48')]['id'];}return db[_0xf973('0x29')][_0xf973('0x46')]({'where':{'id':_0x47d31e[_0xf973('0x44')]['id']}})['then'](handleEntityNotFound(_0x223a5a,null))[_0xf973('0x3f')](saveUpdates(_0x47d31e['body'],null))[_0xf973('0x3f')](respondWithResult(_0x223a5a,null))['catch'](handleError(_0x223a5a,null));};exports[_0xf973('0x4b')]=function(_0x5c7993,_0x73f7e){return db[_0xf973('0x29')][_0xf973('0x46')]({'where':{'id':_0x5c7993[_0xf973('0x44')]['id']}})[_0xf973('0x3f')](handleEntityNotFound(_0x73f7e,null))[_0xf973('0x3f')](removeEntity(_0x73f7e,null))['catch'](handleError(_0x73f7e,null));};exports[_0xf973('0x4c')]=function(_0x3f15fb,_0x3cfa50){return db[_0xf973('0x29')][_0xf973('0x4b')]({'where':{'id':_0x3f15fb[_0xf973('0x2f')]['ids']||[]},'raw':![],'individualHooks':!![]})[_0xf973('0x3f')](respondWithResult(_0x3cfa50,0xcc))[_0xf973('0x43')](handleError(_0x3cfa50,null));};exports[_0xf973('0x4d')]=function(_0x228bfc,_0x1eec6b,_0x1f6136){return db[_0xf973('0x4e')]['findOne']({'where':{'id':_0x228bfc[_0xf973('0x44')]['id']}})[_0xf973('0x3f')](handleEntityNotFound(_0x1eec6b,null))[_0xf973('0x3f')](function(_0xd7f8e9){if(_0xd7f8e9){return db[_0xf973('0x4f')][_0xf973('0x50')](function(_0x12c68b){return db[_0xf973('0x29')][_0xf973('0x4b')]({'where':{'CustomReportId':_0x228bfc[_0xf973('0x44')]['id']},'transaction':_0x12c68b})[_0xf973('0x3f')](function(_0x37af83){var _0x40aca8=_[_0xf973('0x28')](_0x228bfc['body'],function(_0x332e92){delete _0x332e92['id'];_0x332e92[_0xf973('0x51')]=_0x228bfc[_0xf973('0x44')]['id'];return _0x332e92;});return db[_0xf973('0x29')][_0xf973('0x49')](_0x40aca8,{'transaction':_0x12c68b});});})[_0xf973('0x3f')](function(){return db[_0xf973('0x29')][_0xf973('0x41')]({'where':{'CustomReportId':_0x228bfc['params']['id']}});});}})[_0xf973('0x3f')](respondWithResult(_0x1eec6b,null))[_0xf973('0x43')](handleError(_0x1eec6b,null));}; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.model.js b/server/api/analyticFieldReport/analyticFieldReport.model.js index d1e9432..36b5a23 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 _0x1971=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./analyticFieldReport.attributes','define','AnalyticFieldReport','analytics_report_fields','util'];(function(_0x196944,_0x338458){var _0x30d0d1=function(_0x3dbe3f){while(--_0x3dbe3f){_0x196944['push'](_0x196944['shift']());}};_0x30d0d1(++_0x338458);}(_0x1971,0x110));var _0x1197=function(_0x243b2f,_0x30aa15){_0x243b2f=_0x243b2f-0x0;var _0xcb3c2d=_0x1971[_0x243b2f];return _0xcb3c2d;};'use strict';var _=require('lodash');var util=require(_0x1197('0x0'));var logger=require(_0x1197('0x1'))(_0x1197('0x2'));var moment=require(_0x1197('0x3'));var BPromise=require(_0x1197('0x4'));var rp=require(_0x1197('0x5'));var fs=require('fs');var path=require(_0x1197('0x6'));var rimraf=require(_0x1197('0x7'));var config=require(_0x1197('0x8'));var attributes=require(_0x1197('0x9'));module['exports']=function(_0x52eefe,_0x3b2340){return _0x52eefe[_0x1197('0xa')](_0x1197('0xb'),attributes,{'tableName':_0x1197('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9304=['util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./analyticFieldReport.attributes','exports','define','AnalyticFieldReport','analytics_report_fields','lodash'];(function(_0x532dd2,_0xceafdb){var _0x2f6b7d=function(_0x29a058){while(--_0x29a058){_0x532dd2['push'](_0x532dd2['shift']());}};_0x2f6b7d(++_0xceafdb);}(_0x9304,0x1bf));var _0x4930=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x9304[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x4930('0x0'));var util=require(_0x4930('0x1'));var logger=require(_0x4930('0x2'))('api');var moment=require(_0x4930('0x3'));var BPromise=require(_0x4930('0x4'));var rp=require(_0x4930('0x5'));var fs=require('fs');var path=require(_0x4930('0x6'));var rimraf=require(_0x4930('0x7'));var config=require(_0x4930('0x8'));var attributes=require(_0x4930('0x9'));module[_0x4930('0xa')]=function(_0x38daad,_0x442ad4){return _0x38daad[_0x4930('0xb')](_0x4930('0xc'),attributes,{'tableName':_0x4930('0xd'),'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 90cc4f5..2127996 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 _0x2745=['randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','AnalyticFieldReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','info','catch','util','moment','bluebird'];(function(_0x3ea898,_0x54ff1e){var _0x31cf52=function(_0xfb856d){while(--_0xfb856d){_0x3ea898['push'](_0x3ea898['shift']());}};_0x31cf52(++_0x54ff1e);}(_0x2745,0xef));var _0x5274=function(_0xa5053c,_0x467be3){_0xa5053c=_0xa5053c-0x0;var _0x567fd3=_0x2745[_0xa5053c];return _0x567fd3;};'use strict';var _=require('lodash');var util=require(_0x5274('0x0'));var moment=require(_0x5274('0x1'));var BPromise=require(_0x5274('0x2'));var rs=require(_0x5274('0x3'));var fs=require('fs');var Redis=require(_0x5274('0x4'));var db=require(_0x5274('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x5274('0x6'))(_0x5274('0x7'));var config=require(_0x5274('0x8'));var jayson=require(_0x5274('0x9'));var client=jayson[_0x5274('0xa')][_0x5274('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4e9b9f,_0x462aba,_0x267b97){return new BPromise(function(_0x2383d7,_0x6014bd){return client[_0x5274('0xc')](_0x4e9b9f,_0x267b97)[_0x5274('0xd')](function(_0x5c3fcf){logger['info'](_0x5274('0xe'),_0x462aba,_0x5274('0xf'));logger[_0x5274('0x10')]('AnalyticFieldReport,\x20%s,\x20%s,\x20%s',_0x462aba,_0x5274('0xf'),JSON[_0x5274('0x11')](_0x5c3fcf));if(_0x5c3fcf[_0x5274('0x12')]){if(_0x5c3fcf['error']['code']===0x1f4){logger[_0x5274('0x12')]('AnalyticFieldReport,\x20%s,\x20%s',_0x462aba,_0x5c3fcf['error'][_0x5274('0x13')]);return _0x6014bd(_0x5c3fcf[_0x5274('0x12')][_0x5274('0x13')]);}logger[_0x5274('0x12')]('AnalyticFieldReport,\x20%s,\x20%s',_0x462aba,_0x5c3fcf[_0x5274('0x12')][_0x5274('0x13')]);return _0x2383d7(_0x5c3fcf['error']['message']);}else{logger[_0x5274('0x14')](_0x5274('0xe'),_0x462aba,_0x5274('0xf'));_0x2383d7(_0x5c3fcf['result'][_0x5274('0x13')]);}})[_0x5274('0x15')](function(_0x47b0f2){logger[_0x5274('0x12')]('AnalyticFieldReport,\x20%s,\x20%s',_0x462aba,_0x47b0f2);_0x6014bd(_0x47b0f2);});});} \ No newline at end of file +var _0x590b=['ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','http','request','then','request\x20sent','debug','AnalyticFieldReport,\x20%s,\x20%s,\x20%s','stringify','AnalyticFieldReport,\x20%s,\x20%s','error','message','catch','lodash','util','bluebird'];(function(_0x17f8c4,_0x58da02){var _0x5bc08d=function(_0x1bbc63){while(--_0x1bbc63){_0x17f8c4['push'](_0x17f8c4['shift']());}};_0x5bc08d(++_0x58da02);}(_0x590b,0x82));var _0xb590=function(_0x1a2f63,_0x21435f){_0x1a2f63=_0x1a2f63-0x0;var _0xaadc1d=_0x590b[_0x1a2f63];return _0xaadc1d;};'use strict';var _=require(_0xb590('0x0'));var util=require(_0xb590('0x1'));var moment=require('moment');var BPromise=require(_0xb590('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xb590('0x3'));var db=require(_0xb590('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xb590('0x5'))(_0xb590('0x6'));var config=require('../../config/environment');var jayson=require(_0xb590('0x7'));var client=jayson['client'][_0xb590('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x1bf63d,_0x47a96f,_0x4e6b5c){return new BPromise(function(_0x2c77e6,_0x4f039e){return client[_0xb590('0x9')](_0x1bf63d,_0x4e6b5c)[_0xb590('0xa')](function(_0x7afa2a){logger['info']('AnalyticFieldReport,\x20%s,\x20%s',_0x47a96f,_0xb590('0xb'));logger[_0xb590('0xc')](_0xb590('0xd'),_0x47a96f,_0xb590('0xb'),JSON[_0xb590('0xe')](_0x7afa2a));if(_0x7afa2a['error']){if(_0x7afa2a['error']['code']===0x1f4){logger['error'](_0xb590('0xf'),_0x47a96f,_0x7afa2a['error']['message']);return _0x4f039e(_0x7afa2a[_0xb590('0x10')][_0xb590('0x11')]);}logger[_0xb590('0x10')](_0xb590('0xf'),_0x47a96f,_0x7afa2a[_0xb590('0x10')][_0xb590('0x11')]);return _0x2c77e6(_0x7afa2a[_0xb590('0x10')][_0xb590('0x11')]);}else{logger['info']('AnalyticFieldReport,\x20%s,\x20%s',_0x47a96f,_0xb590('0xb'));_0x2c77e6(_0x7afa2a['result']['message']);}})[_0xb590('0x12')](function(_0x48ac7f){logger['error']('AnalyticFieldReport,\x20%s,\x20%s',_0x47a96f,_0x48ac7f);_0x4f039e(_0x48ac7f);});});} \ No newline at end of file diff --git a/server/api/analyticFieldReport/index.js b/server/api/analyticFieldReport/index.js index b613433..cfbb06d 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 _0x5fc3=['get','isAuthenticated','/:id','show','post','create','/create_many','/:id/create_many','addFields','put','update','delete','destroy','exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./analyticFieldReport.controller'];(function(_0x340740,_0x2a07b3){var _0x4da9c2=function(_0x235821){while(--_0x235821){_0x340740['push'](_0x340740['shift']());}};_0x4da9c2(++_0x2a07b3);}(_0x5fc3,0xa8));var _0x35fc=function(_0x43fdf8,_0x8426b3){_0x43fdf8=_0x43fdf8-0x0;var _0x1160c6=_0x5fc3[_0x43fdf8];return _0x1160c6;};'use strict';var multer=require(_0x35fc('0x0'));var util=require(_0x35fc('0x1'));var path=require('path');var timeout=require(_0x35fc('0x2'));var express=require(_0x35fc('0x3'));var router=express[_0x35fc('0x4')]();var auth=require(_0x35fc('0x5'));var interaction=require(_0x35fc('0x6'));var config=require('../../config/environment');var controller=require(_0x35fc('0x7'));router[_0x35fc('0x8')]('/',auth[_0x35fc('0x9')](),controller['index']);router['get'](_0x35fc('0xa'),auth['isAuthenticated'](),controller[_0x35fc('0xb')]);router[_0x35fc('0xc')]('/',auth[_0x35fc('0x9')](),controller[_0x35fc('0xd')]);router[_0x35fc('0xc')](_0x35fc('0xe'),auth[_0x35fc('0x9')](),controller['bulkCreate']);router[_0x35fc('0xc')](_0x35fc('0xf'),auth['isAuthenticated'](),controller[_0x35fc('0x10')]);router[_0x35fc('0x11')]('/:id',auth[_0x35fc('0x9')](),controller[_0x35fc('0x12')]);router['delete']('/destroy_many',auth[_0x35fc('0x9')](),controller['bulkDestroy']);router[_0x35fc('0x13')](_0x35fc('0xa'),auth[_0x35fc('0x9')](),controller[_0x35fc('0x14')]);module[_0x35fc('0x15')]=router; \ No newline at end of file +var _0x814b=['../../config/environment','./analyticFieldReport.controller','get','isAuthenticated','index','/:id','post','create','/create_many','bulkCreate','/:id/create_many','addFields','update','delete','/destroy_many','bulkDestroy','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/interaction/service'];(function(_0x272cd7,_0x342fa2){var _0x4aa0bd=function(_0x36b43c){while(--_0x36b43c){_0x272cd7['push'](_0x272cd7['shift']());}};_0x4aa0bd(++_0x342fa2);}(_0x814b,0x1a2));var _0xb814=function(_0x300860,_0x509371){_0x300860=_0x300860-0x0;var _0x2094ad=_0x814b[_0x300860];return _0x2094ad;};'use strict';var multer=require(_0xb814('0x0'));var util=require(_0xb814('0x1'));var path=require(_0xb814('0x2'));var timeout=require(_0xb814('0x3'));var express=require(_0xb814('0x4'));var router=express[_0xb814('0x5')]();var auth=require('../../components/auth/service');var interaction=require(_0xb814('0x6'));var config=require(_0xb814('0x7'));var controller=require(_0xb814('0x8'));router[_0xb814('0x9')]('/',auth[_0xb814('0xa')](),controller[_0xb814('0xb')]);router['get'](_0xb814('0xc'),auth[_0xb814('0xa')](),controller['show']);router[_0xb814('0xd')]('/',auth[_0xb814('0xa')](),controller[_0xb814('0xe')]);router[_0xb814('0xd')](_0xb814('0xf'),auth[_0xb814('0xa')](),controller[_0xb814('0x10')]);router[_0xb814('0xd')](_0xb814('0x11'),auth[_0xb814('0xa')](),controller[_0xb814('0x12')]);router['put'](_0xb814('0xc'),auth['isAuthenticated'](),controller[_0xb814('0x13')]);router[_0xb814('0x14')](_0xb814('0x15'),auth[_0xb814('0xa')](),controller[_0xb814('0x16')]);router[_0xb814('0x14')](_0xb814('0xc'),auth[_0xb814('0xa')](),controller[_0xb814('0x17')]);module[_0xb814('0x18')]=router; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.attributes.js b/server/api/analyticMetric/analyticMetric.attributes.js index 5f4c69e..812e463 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 _0xc234=['TEXT','exports','STRING'];(function(_0x277fa3,_0x3b2dde){var _0x2e4520=function(_0x209eab){while(--_0x209eab){_0x277fa3['push'](_0x277fa3['shift']());}};_0x2e4520(++_0x3b2dde);}(_0xc234,0x7f));var _0x4c23=function(_0x1d3038,_0x1a6ea3){_0x1d3038=_0x1d3038-0x0;var _0x5e5ac0=_0xc234[_0x1d3038];return _0x5e5ac0;};'use strict';var Sequelize=require('sequelize');module[_0x4c23('0x0')]={'name':{'type':Sequelize[_0x4c23('0x1')],'allowNull':![],'unique':'name'},'table':{'type':Sequelize[_0x4c23('0x1')]},'metric':{'type':Sequelize[_0x4c23('0x2')]},'description':{'type':Sequelize[_0x4c23('0x1')]}}; \ No newline at end of file +var _0xb574=['name','STRING','sequelize','exports'];(function(_0x4b86c9,_0x5d2422){var _0x4991a3=function(_0x54e770){while(--_0x54e770){_0x4b86c9['push'](_0x4b86c9['shift']());}};_0x4991a3(++_0x5d2422);}(_0xb574,0x106));var _0x4b57=function(_0xfac4e0,_0x10eea8){_0xfac4e0=_0xfac4e0-0x0;var _0x59791c=_0xb574[_0xfac4e0];return _0x59791c;};'use strict';var Sequelize=require(_0x4b57('0x0'));module[_0x4b57('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x4b57('0x2')},'table':{'type':Sequelize[_0x4b57('0x3')]},'metric':{'type':Sequelize['TEXT']},'description':{'type':Sequelize[_0x4b57('0x3')]}}; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.controller.js b/server/api/analyticMetric/analyticMetric.controller.js index 966e3a7..9c26e59 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 _0xcf66=['index','rawAttributes','fieldName','type','key','map','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','AnalyticMetric','includeAll','include','findAll','rows','catch','params','keys','find','create','body','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','mustache','util','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','sendStatus','status','end','json','count','offset','limit','Content-Range','apply','reject','save','then','destroy','Metrics','error','stack','name'];(function(_0x4de5c1,_0x5ccdc2){var _0x106360=function(_0x2b0105){while(--_0x2b0105){_0x4de5c1['push'](_0x4de5c1['shift']());}};_0x106360(++_0x5ccdc2);}(_0xcf66,0x71));var _0x6cf6=function(_0x126f36,_0x5d4afd){_0x126f36=_0x126f36-0x0;var _0x31ecc1=_0xcf66[_0x126f36];return _0x31ecc1;};'use strict';var pdf=require(_0x6cf6('0x0'));var emlformat=require(_0x6cf6('0x1'));var rimraf=require(_0x6cf6('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x6cf6('0x3'));var rp=require(_0x6cf6('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x6cf6('0x5'));var util=require(_0x6cf6('0x6'));var path=require('path');var sox=require(_0x6cf6('0x7'));var csv=require(_0x6cf6('0x8'));var ejs=require(_0x6cf6('0x9'));var fs=require('fs');var _=require('lodash');var squel=require(_0x6cf6('0xa'));var crypto=require(_0x6cf6('0xb'));var jsforce=require(_0x6cf6('0xc'));var deskjs=require(_0x6cf6('0xd'));var toCsv=require(_0x6cf6('0x8'));var querystring=require(_0x6cf6('0xe'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x6cf6('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x6cf6('0x10'));var logger=require(_0x6cf6('0x11'))(_0x6cf6('0x12'));var utils=require(_0x6cf6('0x13'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5801a9,_0x3fdfea){_0x3fdfea=_0x3fdfea||0xcc;return function(_0x13b1ad){if(_0x13b1ad){return _0x5801a9[_0x6cf6('0x14')](_0x3fdfea);}return _0x5801a9[_0x6cf6('0x15')](_0x3fdfea)[_0x6cf6('0x16')]();};}function respondWithResult(_0x114c2c,_0x57909f){_0x57909f=_0x57909f||0xc8;return function(_0x32fe64){if(_0x32fe64){return _0x114c2c['status'](_0x57909f)[_0x6cf6('0x17')](_0x32fe64);}};}function respondWithFilteredResult(_0x18360e,_0x4b073f){return function(_0x40e413){if(_0x40e413){var _0x1b40f8=_0x40e413[_0x6cf6('0x18')],_0x2d23ab=_0x4b073f[_0x6cf6('0x19')],_0x74486a=_0x4b073f[_0x6cf6('0x19')]+_0x4b073f[_0x6cf6('0x1a')],_0x2b6d7b;if(_0x74486a>=_0x1b40f8){_0x74486a=_0x1b40f8;_0x2b6d7b=0xc8;}else{_0x2b6d7b=0xce;}_0x18360e[_0x6cf6('0x15')](_0x2b6d7b);return _0x18360e['set'](_0x6cf6('0x1b'),_0x2d23ab+'-'+_0x74486a+'/'+_0x1b40f8)[_0x6cf6('0x17')](_0x40e413);}return null;};}function patchUpdates(_0x22ab0){return function(_0x581164){try{jsonpatch[_0x6cf6('0x1c')](_0x581164,_0x22ab0,!![]);}catch(_0x39b4a2){return BPromise[_0x6cf6('0x1d')](_0x39b4a2);}return _0x581164[_0x6cf6('0x1e')]();};}function saveUpdates(_0x440634,_0x21e903){return function(_0x123993){if(_0x123993){return _0x123993['update'](_0x440634)[_0x6cf6('0x1f')](function(_0x306a64){return _0x306a64;});}return null;};}function removeEntity(_0x1add7a,_0x380a40){return function(_0x5cba3a){if(_0x5cba3a){return _0x5cba3a[_0x6cf6('0x20')]()[_0x6cf6('0x1f')](function(){var _0x111274=_0x5cba3a['get']({'plain':!![]});var _0x5b30e0=_0x6cf6('0x21');return db['UserProfileResource'][_0x6cf6('0x20')]({'where':{'type':_0x5b30e0,'resourceId':_0x111274['id']}})[_0x6cf6('0x1f')](function(){return _0x5cba3a;});})[_0x6cf6('0x1f')](function(){_0x1add7a[_0x6cf6('0x15')](0xcc)[_0x6cf6('0x16')]();});}};}function handleEntityNotFound(_0x565fad,_0x1c966e){return function(_0x4e0e85){if(!_0x4e0e85){_0x565fad[_0x6cf6('0x14')](0x194);}return _0x4e0e85;};}function handleError(_0xc7b489,_0x3eaa31){_0x3eaa31=_0x3eaa31||0x1f4;return function(_0x558405){logger[_0x6cf6('0x22')](_0x558405[_0x6cf6('0x23')]);if(_0x558405[_0x6cf6('0x24')]){delete _0x558405[_0x6cf6('0x24')];}_0xc7b489['status'](_0x3eaa31)['send'](_0x558405);};}exports[_0x6cf6('0x25')]=function(_0x4521af,_0x57099f){var _0x5869e9={},_0x5ccc8f={},_0x2afc06={'count':0x0,'rows':[]};var _0x52717d=_['map'](db['AnalyticMetric'][_0x6cf6('0x26')],function(_0x65433){return{'name':_0x65433[_0x6cf6('0x27')],'type':_0x65433[_0x6cf6('0x28')][_0x6cf6('0x29')]};});_0x5ccc8f['model']=_[_0x6cf6('0x2a')](_0x52717d,_0x6cf6('0x24'));_0x5ccc8f[_0x6cf6('0x2b')]=_['keys'](_0x4521af[_0x6cf6('0x2b')]);_0x5ccc8f[_0x6cf6('0x2c')]=_[_0x6cf6('0x2d')](_0x5ccc8f[_0x6cf6('0x2e')],_0x5ccc8f[_0x6cf6('0x2b')]);_0x5869e9[_0x6cf6('0x2f')]=_[_0x6cf6('0x2d')](_0x5ccc8f[_0x6cf6('0x2e')],qs[_0x6cf6('0x30')](_0x4521af[_0x6cf6('0x2b')][_0x6cf6('0x30')]));_0x5869e9[_0x6cf6('0x2f')]=_0x5869e9[_0x6cf6('0x2f')][_0x6cf6('0x31')]?_0x5869e9[_0x6cf6('0x2f')]:_0x5ccc8f[_0x6cf6('0x2e')];if(!_0x4521af[_0x6cf6('0x2b')][_0x6cf6('0x32')]('nolimit')){_0x5869e9[_0x6cf6('0x1a')]=qs[_0x6cf6('0x1a')](_0x4521af[_0x6cf6('0x2b')][_0x6cf6('0x1a')]);_0x5869e9[_0x6cf6('0x19')]=qs[_0x6cf6('0x19')](_0x4521af[_0x6cf6('0x2b')][_0x6cf6('0x19')]);}_0x5869e9[_0x6cf6('0x33')]=qs[_0x6cf6('0x34')](_0x4521af[_0x6cf6('0x2b')]['sort']);_0x5869e9[_0x6cf6('0x35')]=qs[_0x6cf6('0x2c')](_[_0x6cf6('0x36')](_0x4521af[_0x6cf6('0x2b')],_0x5ccc8f[_0x6cf6('0x2c')]),_0x52717d);if(_0x4521af[_0x6cf6('0x2b')][_0x6cf6('0x37')]){_0x5869e9[_0x6cf6('0x35')]=_[_0x6cf6('0x38')](_0x5869e9['where'],{'$or':_[_0x6cf6('0x2a')](_0x52717d,function(_0x46423f){if(_0x46423f[_0x6cf6('0x28')]!==_0x6cf6('0x39')){var _0x14e0eb={};_0x14e0eb[_0x46423f[_0x6cf6('0x24')]]={'$like':'%'+_0x4521af[_0x6cf6('0x2b')][_0x6cf6('0x37')]+'%'};return _0x14e0eb;}})});}_0x5869e9=_[_0x6cf6('0x38')]({},_0x5869e9,_0x4521af['options']);var _0x23622f={'where':_0x5869e9['where']};return db[_0x6cf6('0x3a')][_0x6cf6('0x18')](_0x23622f)[_0x6cf6('0x1f')](function(_0x1ce0be){_0x2afc06[_0x6cf6('0x18')]=_0x1ce0be;if(_0x4521af[_0x6cf6('0x2b')][_0x6cf6('0x3b')]){_0x5869e9[_0x6cf6('0x3c')]=[{'all':!![]}];}return db['AnalyticMetric'][_0x6cf6('0x3d')](_0x5869e9);})[_0x6cf6('0x1f')](function(_0x52c417){_0x2afc06[_0x6cf6('0x3e')]=_0x52c417;return _0x2afc06;})[_0x6cf6('0x1f')](respondWithFilteredResult(_0x57099f,_0x5869e9))[_0x6cf6('0x3f')](handleError(_0x57099f,null));};exports['show']=function(_0x10bb9b,_0x128f7a){var _0x51d915={'raw':!![],'where':{'id':_0x10bb9b[_0x6cf6('0x40')]['id']}},_0x3f1084={};_0x3f1084[_0x6cf6('0x2e')]=_[_0x6cf6('0x41')](db[_0x6cf6('0x3a')][_0x6cf6('0x26')]);_0x3f1084[_0x6cf6('0x2b')]=_['keys'](_0x10bb9b[_0x6cf6('0x2b')]);_0x3f1084['filters']=_[_0x6cf6('0x2d')](_0x3f1084[_0x6cf6('0x2e')],_0x3f1084['query']);_0x51d915[_0x6cf6('0x2f')]=_[_0x6cf6('0x2d')](_0x3f1084[_0x6cf6('0x2e')],qs[_0x6cf6('0x30')](_0x10bb9b[_0x6cf6('0x2b')]['fields']));_0x51d915[_0x6cf6('0x2f')]=_0x51d915[_0x6cf6('0x2f')][_0x6cf6('0x31')]?_0x51d915['attributes']:_0x3f1084[_0x6cf6('0x2e')];if(_0x10bb9b[_0x6cf6('0x2b')][_0x6cf6('0x3b')]){_0x51d915['include']=[{'all':!![]}];}_0x51d915=_[_0x6cf6('0x38')]({},_0x51d915,_0x10bb9b['options']);return db['AnalyticMetric'][_0x6cf6('0x42')](_0x51d915)[_0x6cf6('0x1f')](handleEntityNotFound(_0x128f7a,null))[_0x6cf6('0x1f')](respondWithResult(_0x128f7a,null))[_0x6cf6('0x3f')](handleError(_0x128f7a,null));};exports[_0x6cf6('0x43')]=function(_0x311745,_0x28629d){return db[_0x6cf6('0x3a')][_0x6cf6('0x43')](_0x311745[_0x6cf6('0x44')],{})[_0x6cf6('0x1f')](function(_0x1ac2cd){var _0x3786d1=_0x311745['user'][_0x6cf6('0x45')]({'plain':!![]});if(!_0x3786d1)throw new Error(_0x6cf6('0x46'));if(_0x3786d1['role']==='user'){var _0x10047a=_0x1ac2cd[_0x6cf6('0x45')]({'plain':!![]});var _0x1db524=_0x6cf6('0x21');return db[_0x6cf6('0x47')][_0x6cf6('0x42')]({'where':{'name':_0x1db524,'userProfileId':_0x3786d1['userProfileId']},'raw':!![]})[_0x6cf6('0x1f')](function(_0x262c23){if(_0x262c23&&_0x262c23[_0x6cf6('0x48')]===0x0){return db['UserProfileResource']['create']({'name':_0x10047a[_0x6cf6('0x24')],'resourceId':_0x10047a['id'],'type':_0x262c23[_0x6cf6('0x24')],'sectionId':_0x262c23['id']},{})[_0x6cf6('0x1f')](function(){return _0x1ac2cd;});}else{return _0x1ac2cd;}})[_0x6cf6('0x3f')](function(_0x2dbd71){logger[_0x6cf6('0x22')](_0x6cf6('0x49'),_0x2dbd71);throw _0x2dbd71;});}return _0x1ac2cd;})[_0x6cf6('0x1f')](respondWithResult(_0x28629d,0xc9))[_0x6cf6('0x3f')](handleError(_0x28629d,null));};exports[_0x6cf6('0x4a')]=function(_0x4bb37e,_0x217072){if(_0x4bb37e[_0x6cf6('0x44')]['id']){delete _0x4bb37e[_0x6cf6('0x44')]['id'];}return db[_0x6cf6('0x3a')][_0x6cf6('0x42')]({'where':{'id':_0x4bb37e[_0x6cf6('0x40')]['id']}})[_0x6cf6('0x1f')](handleEntityNotFound(_0x217072,null))[_0x6cf6('0x1f')](saveUpdates(_0x4bb37e[_0x6cf6('0x44')],null))[_0x6cf6('0x1f')](respondWithResult(_0x217072,null))[_0x6cf6('0x3f')](handleError(_0x217072,null));};exports['destroy']=function(_0x153423,_0x4ec56b){return db[_0x6cf6('0x3a')][_0x6cf6('0x42')]({'where':{'id':_0x153423['params']['id']}})[_0x6cf6('0x1f')](handleEntityNotFound(_0x4ec56b,null))[_0x6cf6('0x1f')](removeEntity(_0x4ec56b,null))[_0x6cf6('0x3f')](handleError(_0x4ec56b,null));}; \ No newline at end of file +var _0x1775=['reject','save','update','then','destroy','Metrics','UserProfileResource','stack','name','send','index','map','AnalyticMetric','rawAttributes','type','key','query','keys','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','filter','merge','VIRTUAL','count','includeAll','include','findAll','rows','catch','params','options','find','body','user','get','UserProfileSection','userProfileId','autoAssociation','create','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','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','end','json','offset','limit','Content-Range','apply'];(function(_0x3e91a9,_0x53c466){var _0x25c9ad=function(_0x69ee2d){while(--_0x69ee2d){_0x3e91a9['push'](_0x3e91a9['shift']());}};_0x25c9ad(++_0x53c466);}(_0x1775,0x1db));var _0x5177=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0x1775[_0x19e35c];return _0x3e1fe8;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x5177('0x0'));var rimraf=require(_0x5177('0x1'));var zipdir=require(_0x5177('0x2'));var jsonpatch=require(_0x5177('0x3'));var rp=require(_0x5177('0x4'));var moment=require(_0x5177('0x5'));var BPromise=require(_0x5177('0x6'));var Mustache=require(_0x5177('0x7'));var util=require(_0x5177('0x8'));var path=require(_0x5177('0x9'));var sox=require(_0x5177('0xa'));var csv=require(_0x5177('0xb'));var ejs=require(_0x5177('0xc'));var fs=require('fs');var _=require(_0x5177('0xd'));var squel=require(_0x5177('0xe'));var crypto=require(_0x5177('0xf'));var jsforce=require(_0x5177('0x10'));var deskjs=require(_0x5177('0x11'));var toCsv=require(_0x5177('0xb'));var querystring=require(_0x5177('0x12'));var Papa=require(_0x5177('0x13'));var Redis=require(_0x5177('0x14'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x5177('0x15'));var hardwareService=require(_0x5177('0x16'));var logger=require(_0x5177('0x17'))(_0x5177('0x18'));var utils=require(_0x5177('0x19'));var config=require('../../config/environment');var db=require(_0x5177('0x1a'))['db'];function respondWithStatusCode(_0x22fe21,_0xc613b9){_0xc613b9=_0xc613b9||0xcc;return function(_0x3c4ced){if(_0x3c4ced){return _0x22fe21[_0x5177('0x1b')](_0xc613b9);}return _0x22fe21[_0x5177('0x1c')](_0xc613b9)[_0x5177('0x1d')]();};}function respondWithResult(_0x2ec90f,_0x3e6224){_0x3e6224=_0x3e6224||0xc8;return function(_0x1eb9dd){if(_0x1eb9dd){return _0x2ec90f[_0x5177('0x1c')](_0x3e6224)[_0x5177('0x1e')](_0x1eb9dd);}};}function respondWithFilteredResult(_0x29cd2c,_0x31aff8){return function(_0x1b32e6){if(_0x1b32e6){var _0x175ca6=_0x1b32e6['count'],_0x2ab5e5=_0x31aff8[_0x5177('0x1f')],_0x7dba6f=_0x31aff8[_0x5177('0x1f')]+_0x31aff8[_0x5177('0x20')],_0xe6dcf6;if(_0x7dba6f>=_0x175ca6){_0x7dba6f=_0x175ca6;_0xe6dcf6=0xc8;}else{_0xe6dcf6=0xce;}_0x29cd2c[_0x5177('0x1c')](_0xe6dcf6);return _0x29cd2c['set'](_0x5177('0x21'),_0x2ab5e5+'-'+_0x7dba6f+'/'+_0x175ca6)[_0x5177('0x1e')](_0x1b32e6);}return null;};}function patchUpdates(_0x13d5d4){return function(_0x5b5918){try{jsonpatch[_0x5177('0x22')](_0x5b5918,_0x13d5d4,!![]);}catch(_0x4cf600){return BPromise[_0x5177('0x23')](_0x4cf600);}return _0x5b5918[_0x5177('0x24')]();};}function saveUpdates(_0x219744,_0x27b732){return function(_0x451e5c){if(_0x451e5c){return _0x451e5c[_0x5177('0x25')](_0x219744)[_0x5177('0x26')](function(_0xfc1bd4){return _0xfc1bd4;});}return null;};}function removeEntity(_0x2152d4,_0x2a95cc){return function(_0x23dad2){if(_0x23dad2){return _0x23dad2[_0x5177('0x27')]()['then'](function(){var _0x3dcea1=_0x23dad2['get']({'plain':!![]});var _0x30b60f=_0x5177('0x28');return db[_0x5177('0x29')][_0x5177('0x27')]({'where':{'type':_0x30b60f,'resourceId':_0x3dcea1['id']}})['then'](function(){return _0x23dad2;});})[_0x5177('0x26')](function(){_0x2152d4['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x19a0c2,_0x15cb93){return function(_0x577bf7){if(!_0x577bf7){_0x19a0c2[_0x5177('0x1b')](0x194);}return _0x577bf7;};}function handleError(_0x4eba3a,_0x231d35){_0x231d35=_0x231d35||0x1f4;return function(_0x1cbd29){logger['error'](_0x1cbd29[_0x5177('0x2a')]);if(_0x1cbd29[_0x5177('0x2b')]){delete _0x1cbd29[_0x5177('0x2b')];}_0x4eba3a[_0x5177('0x1c')](_0x231d35)[_0x5177('0x2c')](_0x1cbd29);};}exports[_0x5177('0x2d')]=function(_0x5577bb,_0x498fcd){var _0x45cf20={},_0x1c660e={},_0x7dae59={'count':0x0,'rows':[]};var _0x174f7a=_[_0x5177('0x2e')](db[_0x5177('0x2f')][_0x5177('0x30')],function(_0x72dced){return{'name':_0x72dced['fieldName'],'type':_0x72dced[_0x5177('0x31')][_0x5177('0x32')]};});_0x1c660e['model']=_[_0x5177('0x2e')](_0x174f7a,'name');_0x1c660e[_0x5177('0x33')]=_[_0x5177('0x34')](_0x5577bb[_0x5177('0x33')]);_0x1c660e['filters']=_['intersection'](_0x1c660e[_0x5177('0x35')],_0x1c660e[_0x5177('0x33')]);_0x45cf20[_0x5177('0x36')]=_[_0x5177('0x37')](_0x1c660e[_0x5177('0x35')],qs[_0x5177('0x38')](_0x5577bb[_0x5177('0x33')][_0x5177('0x38')]));_0x45cf20['attributes']=_0x45cf20[_0x5177('0x36')][_0x5177('0x39')]?_0x45cf20['attributes']:_0x1c660e[_0x5177('0x35')];if(!_0x5577bb[_0x5177('0x33')][_0x5177('0x3a')](_0x5177('0x3b'))){_0x45cf20[_0x5177('0x20')]=qs[_0x5177('0x20')](_0x5577bb['query'][_0x5177('0x20')]);_0x45cf20[_0x5177('0x1f')]=qs[_0x5177('0x1f')](_0x5577bb[_0x5177('0x33')][_0x5177('0x1f')]);}_0x45cf20[_0x5177('0x3c')]=qs[_0x5177('0x3d')](_0x5577bb['query'][_0x5177('0x3d')]);_0x45cf20[_0x5177('0x3e')]=qs['filters'](_['pick'](_0x5577bb[_0x5177('0x33')],_0x1c660e[_0x5177('0x3f')]),_0x174f7a);if(_0x5577bb[_0x5177('0x33')][_0x5177('0x40')]){_0x45cf20[_0x5177('0x3e')]=_[_0x5177('0x41')](_0x45cf20[_0x5177('0x3e')],{'$or':_[_0x5177('0x2e')](_0x174f7a,function(_0xa2ed49){if(_0xa2ed49[_0x5177('0x31')]!==_0x5177('0x42')){var _0x1f15f8={};_0x1f15f8[_0xa2ed49[_0x5177('0x2b')]]={'$like':'%'+_0x5577bb['query'][_0x5177('0x40')]+'%'};return _0x1f15f8;}})});}_0x45cf20=_[_0x5177('0x41')]({},_0x45cf20,_0x5577bb['options']);var _0x7341c0={'where':_0x45cf20['where']};return db[_0x5177('0x2f')][_0x5177('0x43')](_0x7341c0)[_0x5177('0x26')](function(_0x5742aa){_0x7dae59['count']=_0x5742aa;if(_0x5577bb[_0x5177('0x33')][_0x5177('0x44')]){_0x45cf20[_0x5177('0x45')]=[{'all':!![]}];}return db[_0x5177('0x2f')][_0x5177('0x46')](_0x45cf20);})[_0x5177('0x26')](function(_0x41d874){_0x7dae59[_0x5177('0x47')]=_0x41d874;return _0x7dae59;})['then'](respondWithFilteredResult(_0x498fcd,_0x45cf20))[_0x5177('0x48')](handleError(_0x498fcd,null));};exports['show']=function(_0x5e3d30,_0x30e4f3){var _0x17dc98={'raw':!![],'where':{'id':_0x5e3d30[_0x5177('0x49')]['id']}},_0x5172f8={};_0x5172f8['model']=_['keys'](db[_0x5177('0x2f')][_0x5177('0x30')]);_0x5172f8[_0x5177('0x33')]=_[_0x5177('0x34')](_0x5e3d30[_0x5177('0x33')]);_0x5172f8[_0x5177('0x3f')]=_[_0x5177('0x37')](_0x5172f8['model'],_0x5172f8['query']);_0x17dc98[_0x5177('0x36')]=_['intersection'](_0x5172f8[_0x5177('0x35')],qs[_0x5177('0x38')](_0x5e3d30[_0x5177('0x33')][_0x5177('0x38')]));_0x17dc98['attributes']=_0x17dc98[_0x5177('0x36')][_0x5177('0x39')]?_0x17dc98[_0x5177('0x36')]:_0x5172f8[_0x5177('0x35')];if(_0x5e3d30[_0x5177('0x33')][_0x5177('0x44')]){_0x17dc98[_0x5177('0x45')]=[{'all':!![]}];}_0x17dc98=_[_0x5177('0x41')]({},_0x17dc98,_0x5e3d30[_0x5177('0x4a')]);return db[_0x5177('0x2f')][_0x5177('0x4b')](_0x17dc98)['then'](handleEntityNotFound(_0x30e4f3,null))[_0x5177('0x26')](respondWithResult(_0x30e4f3,null))['catch'](handleError(_0x30e4f3,null));};exports['create']=function(_0x5bda8a,_0x2f9ff9){return db[_0x5177('0x2f')]['create'](_0x5bda8a[_0x5177('0x4c')],{})[_0x5177('0x26')](function(_0x208483){var _0x4891fe=_0x5bda8a[_0x5177('0x4d')]['get']({'plain':!![]});if(!_0x4891fe)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x4891fe['role']===_0x5177('0x4d')){var _0x37d5dd=_0x208483[_0x5177('0x4e')]({'plain':!![]});var _0x5a1f8b='Metrics';return db[_0x5177('0x4f')]['find']({'where':{'name':_0x5a1f8b,'userProfileId':_0x4891fe[_0x5177('0x50')]},'raw':!![]})[_0x5177('0x26')](function(_0x430e8e){if(_0x430e8e&&_0x430e8e[_0x5177('0x51')]===0x0){return db[_0x5177('0x29')][_0x5177('0x52')]({'name':_0x37d5dd[_0x5177('0x2b')],'resourceId':_0x37d5dd['id'],'type':_0x430e8e[_0x5177('0x2b')],'sectionId':_0x430e8e['id']},{})[_0x5177('0x26')](function(){return _0x208483;});}else{return _0x208483;}})[_0x5177('0x48')](function(_0x89fe3a){logger[_0x5177('0x53')](_0x5177('0x54'),_0x89fe3a);throw _0x89fe3a;});}return _0x208483;})['then'](respondWithResult(_0x2f9ff9,0xc9))['catch'](handleError(_0x2f9ff9,null));};exports[_0x5177('0x25')]=function(_0x5d5016,_0x649c6f){if(_0x5d5016['body']['id']){delete _0x5d5016[_0x5177('0x4c')]['id'];}return db[_0x5177('0x2f')][_0x5177('0x4b')]({'where':{'id':_0x5d5016['params']['id']}})['then'](handleEntityNotFound(_0x649c6f,null))[_0x5177('0x26')](saveUpdates(_0x5d5016[_0x5177('0x4c')],null))[_0x5177('0x26')](respondWithResult(_0x649c6f,null))[_0x5177('0x48')](handleError(_0x649c6f,null));};exports['destroy']=function(_0x5718a1,_0x3f0e89){return db[_0x5177('0x2f')][_0x5177('0x4b')]({'where':{'id':_0x5718a1[_0x5177('0x49')]['id']}})['then'](handleEntityNotFound(_0x3f0e89,null))[_0x5177('0x26')](removeEntity(_0x3f0e89,null))[_0x5177('0x48')](handleError(_0x3f0e89,null));}; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.model.js b/server/api/analyticMetric/analyticMetric.model.js index 51b8f1e..fa2e9ab 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 _0x4b6b=['./analyticMetric.attributes','define','AnalyticMetric','analytics_metrics','lodash','util','../../config/logger','api','request-promise','rimraf','../../config/environment'];(function(_0x4ea2e2,_0x3ceddd){var _0x40599d=function(_0x2cbff0){while(--_0x2cbff0){_0x4ea2e2['push'](_0x4ea2e2['shift']());}};_0x40599d(++_0x3ceddd);}(_0x4b6b,0x122));var _0xb4b6=function(_0x5a67d3,_0x30b33a){_0x5a67d3=_0x5a67d3-0x0;var _0x14fd66=_0x4b6b[_0x5a67d3];return _0x14fd66;};'use strict';var _=require(_0xb4b6('0x0'));var util=require(_0xb4b6('0x1'));var logger=require(_0xb4b6('0x2'))(_0xb4b6('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xb4b6('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xb4b6('0x5'));var config=require(_0xb4b6('0x6'));var attributes=require(_0xb4b6('0x7'));module['exports']=function(_0x2fa058,_0x3d6e77){return _0x2fa058[_0xb4b6('0x8')](_0xb4b6('0x9'),attributes,{'tableName':_0xb4b6('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5735=['request-promise','path','rimraf','./analyticMetric.attributes','exports','AnalyticMetric','lodash','../../config/logger','api','moment','bluebird'];(function(_0xde3149,_0x14baf9){var _0x4e09a4=function(_0x9ece31){while(--_0x9ece31){_0xde3149['push'](_0xde3149['shift']());}};_0x4e09a4(++_0x14baf9);}(_0x5735,0xed));var _0x5573=function(_0x3c7f77,_0x50b2a2){_0x3c7f77=_0x3c7f77-0x0;var _0x7f4d0=_0x5735[_0x3c7f77];return _0x7f4d0;};'use strict';var _=require(_0x5573('0x0'));var util=require('util');var logger=require(_0x5573('0x1'))(_0x5573('0x2'));var moment=require(_0x5573('0x3'));var BPromise=require(_0x5573('0x4'));var rp=require(_0x5573('0x5'));var fs=require('fs');var path=require(_0x5573('0x6'));var rimraf=require(_0x5573('0x7'));var config=require('../../config/environment');var attributes=require(_0x5573('0x8'));module[_0x5573('0x9')]=function(_0x2e6d3b,_0x18844e){return _0x2e6d3b['define'](_0x5573('0xa'),attributes,{'tableName':'analytics_metrics','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.rpc.js b/server/api/analyticMetric/analyticMetric.rpc.js index 4fb8df4..92b6746 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 _0xdcce=['message','result','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','AnalyticMetric,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','AnalyticMetric,\x20%s,\x20%s'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xdcce,0x128));var _0xedcc=function(_0x48634a,_0x36ed6e){_0x48634a=_0x48634a-0x0;var _0x2b4898=_0xdcce[_0x48634a];return _0x2b4898;};'use strict';var _=require(_0xedcc('0x0'));var util=require(_0xedcc('0x1'));var moment=require(_0xedcc('0x2'));var BPromise=require(_0xedcc('0x3'));var rs=require(_0xedcc('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xedcc('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xedcc('0x6'))('rpc');var config=require(_0xedcc('0x7'));var jayson=require(_0xedcc('0x8'));var client=jayson[_0xedcc('0x9')][_0xedcc('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x21c92f,_0x10b7cc,_0x4a6c75){return new BPromise(function(_0x3c2148,_0xa63a64){return client[_0xedcc('0xb')](_0x21c92f,_0x4a6c75)[_0xedcc('0xc')](function(_0xa8b87a){logger[_0xedcc('0xd')]('AnalyticMetric,\x20%s,\x20%s',_0x10b7cc,'request\x20sent');logger['debug'](_0xedcc('0xe'),_0x10b7cc,_0xedcc('0xf'),JSON[_0xedcc('0x10')](_0xa8b87a));if(_0xa8b87a[_0xedcc('0x11')]){if(_0xa8b87a[_0xedcc('0x11')]['code']===0x1f4){logger['error'](_0xedcc('0x12'),_0x10b7cc,_0xa8b87a[_0xedcc('0x11')][_0xedcc('0x13')]);return _0xa63a64(_0xa8b87a[_0xedcc('0x11')][_0xedcc('0x13')]);}logger['error'](_0xedcc('0x12'),_0x10b7cc,_0xa8b87a[_0xedcc('0x11')]['message']);return _0x3c2148(_0xa8b87a[_0xedcc('0x11')][_0xedcc('0x13')]);}else{logger['info'](_0xedcc('0x12'),_0x10b7cc,'request\x20sent');_0x3c2148(_0xa8b87a[_0xedcc('0x14')]['message']);}})['catch'](function(_0x38f1f8){logger[_0xedcc('0x11')]('AnalyticMetric,\x20%s,\x20%s',_0x10b7cc,_0x38f1f8);_0xa63a64(_0x38f1f8);});});} \ No newline at end of file +var _0xcc49=['http','request','then','info','AnalyticMetric,\x20%s,\x20%s','request\x20sent','debug','AnalyticMetric,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','jayson/promise','client'];(function(_0x20a175,_0x3bcada){var _0xf13f48=function(_0x205010){while(--_0x205010){_0x20a175['push'](_0x20a175['shift']());}};_0xf13f48(++_0x3bcada);}(_0xcc49,0x9f));var _0x9cc4=function(_0x455e00,_0x29577f){_0x455e00=_0x455e00-0x0;var _0x568400=_0xcc49[_0x455e00];return _0x568400;};'use strict';var _=require(_0x9cc4('0x0'));var util=require(_0x9cc4('0x1'));var moment=require('moment');var BPromise=require(_0x9cc4('0x2'));var rs=require(_0x9cc4('0x3'));var fs=require('fs');var Redis=require(_0x9cc4('0x4'));var db=require(_0x9cc4('0x5'))['db'];var utils=require(_0x9cc4('0x6'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0x9cc4('0x7'));var client=jayson[_0x9cc4('0x8')][_0x9cc4('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x281241,_0x3d365a,_0x1bb0ab){return new BPromise(function(_0x6a2bd1,_0x741455){return client[_0x9cc4('0xa')](_0x281241,_0x1bb0ab)[_0x9cc4('0xb')](function(_0x506f8c){logger[_0x9cc4('0xc')](_0x9cc4('0xd'),_0x3d365a,_0x9cc4('0xe'));logger[_0x9cc4('0xf')](_0x9cc4('0x10'),_0x3d365a,'request\x20sent',JSON[_0x9cc4('0x11')](_0x506f8c));if(_0x506f8c[_0x9cc4('0x12')]){if(_0x506f8c[_0x9cc4('0x12')]['code']===0x1f4){logger['error']('AnalyticMetric,\x20%s,\x20%s',_0x3d365a,_0x506f8c[_0x9cc4('0x12')]['message']);return _0x741455(_0x506f8c['error'][_0x9cc4('0x13')]);}logger[_0x9cc4('0x12')]('AnalyticMetric,\x20%s,\x20%s',_0x3d365a,_0x506f8c[_0x9cc4('0x12')]['message']);return _0x6a2bd1(_0x506f8c['error'][_0x9cc4('0x13')]);}else{logger[_0x9cc4('0xc')](_0x9cc4('0xd'),_0x3d365a,_0x9cc4('0xe'));_0x6a2bd1(_0x506f8c['result']['message']);}})[_0x9cc4('0x14')](function(_0x2b1911){logger[_0x9cc4('0x12')](_0x9cc4('0xd'),_0x3d365a,_0x2b1911);_0x741455(_0x2b1911);});});} \ No newline at end of file diff --git a/server/api/analyticMetric/index.js b/server/api/analyticMetric/index.js index 8ad4416..b5a9c37 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 _0x1967=['get','index','/:id','isAuthenticated','show','post','create','put','update','destroy','exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticMetric.controller'];(function(_0x425372,_0x392a79){var _0x5509eb=function(_0xc63ab0){while(--_0xc63ab0){_0x425372['push'](_0x425372['shift']());}};_0x5509eb(++_0x392a79);}(_0x1967,0x173));var _0x7196=function(_0x71783,_0x138cb1){_0x71783=_0x71783-0x0;var _0xd8100f=_0x1967[_0x71783];return _0xd8100f;};'use strict';var multer=require('multer');var util=require(_0x7196('0x0'));var path=require(_0x7196('0x1'));var timeout=require(_0x7196('0x2'));var express=require(_0x7196('0x3'));var router=express[_0x7196('0x4')]();var auth=require(_0x7196('0x5'));var interaction=require(_0x7196('0x6'));var config=require(_0x7196('0x7'));var controller=require(_0x7196('0x8'));router[_0x7196('0x9')]('/',auth['isAuthenticated'](),controller[_0x7196('0xa')]);router[_0x7196('0x9')](_0x7196('0xb'),auth[_0x7196('0xc')](),controller[_0x7196('0xd')]);router[_0x7196('0xe')]('/',auth['isAuthenticated'](),controller[_0x7196('0xf')]);router[_0x7196('0x10')](_0x7196('0xb'),auth[_0x7196('0xc')](),controller[_0x7196('0x11')]);router['delete']('/:id',auth[_0x7196('0xc')](),controller[_0x7196('0x12')]);module[_0x7196('0x13')]=router; \ No newline at end of file +var _0xdb28=['destroy','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticMetric.controller','isAuthenticated','index','show','post','create','put','/:id','update','delete'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0xdb28,0x106));var _0x8db2=function(_0x101217,_0x17939c){_0x101217=_0x101217-0x0;var _0xc999f5=_0xdb28[_0x101217];return _0xc999f5;};'use strict';var multer=require(_0x8db2('0x0'));var util=require(_0x8db2('0x1'));var path=require(_0x8db2('0x2'));var timeout=require(_0x8db2('0x3'));var express=require('express');var router=express[_0x8db2('0x4')]();var auth=require(_0x8db2('0x5'));var interaction=require(_0x8db2('0x6'));var config=require(_0x8db2('0x7'));var controller=require(_0x8db2('0x8'));router['get']('/',auth[_0x8db2('0x9')](),controller[_0x8db2('0xa')]);router['get']('/:id',auth[_0x8db2('0x9')](),controller[_0x8db2('0xb')]);router[_0x8db2('0xc')]('/',auth[_0x8db2('0x9')](),controller[_0x8db2('0xd')]);router[_0x8db2('0xe')](_0x8db2('0xf'),auth['isAuthenticated'](),controller[_0x8db2('0x10')]);router[_0x8db2('0x11')](_0x8db2('0xf'),auth['isAuthenticated'](),controller[_0x8db2('0x12')]);module[_0x8db2('0x13')]=router; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.attributes.js b/server/api/analyticTreeReport/analyticTreeReport.attributes.js index b0ed4a3..cda1c73 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 _0x0540=['sequelize','exports'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0x0540,0x1a0));var _0x0054=function(_0x7eea4,_0x31fb2e){_0x7eea4=_0x7eea4-0x0;var _0x378b00=_0x0540[_0x7eea4];return _0x378b00;};'use strict';var Sequelize=require(_0x0054('0x0'));module[_0x0054('0x1')]={'tree':{'type':Sequelize['TEXT'],'allowNull':![]}}; \ No newline at end of file +var _0x2442=['sequelize','exports','TEXT'];(function(_0x3fa5a3,_0x56efc7){var _0x32d06a=function(_0x3bb6b3){while(--_0x3bb6b3){_0x3fa5a3['push'](_0x3fa5a3['shift']());}};_0x32d06a(++_0x56efc7);}(_0x2442,0xff));var _0x2244=function(_0x3a115e,_0x3dac39){_0x3a115e=_0x3a115e-0x0;var _0x1b7e61=_0x2442[_0x3a115e];return _0x1b7e61;};'use strict';var Sequelize=require(_0x2244('0x0'));module[_0x2244('0x1')]={'tree':{'type':Sequelize[_0x2244('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 912fd76..8f4eb8f 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 _0xe1d9=['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','set','Content-Range','reject','save','update','then','destroy','end','error','stack','name','send','index','map','fieldName','query','keys','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','sort','where','filters','pick','merge','type','VIRTUAL','options','AnalyticTreeReport','include','rows','catch','show','params','rawAttributes','includeAll','create','body','find','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js'];(function(_0x1bc4de,_0x358405){var _0xb73fcf=function(_0xc3b836){while(--_0xc3b836){_0x1bc4de['push'](_0x1bc4de['shift']());}};_0xb73fcf(++_0x358405);}(_0xe1d9,0x88));var _0x9e1d=function(_0x1708d1,_0x494b2c){_0x1708d1=_0x1708d1-0x0;var _0x270211=_0xe1d9[_0x1708d1];return _0x270211;};'use strict';var pdf=require(_0x9e1d('0x0'));var emlformat=require(_0x9e1d('0x1'));var rimraf=require(_0x9e1d('0x2'));var zipdir=require(_0x9e1d('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x9e1d('0x4'));var moment=require(_0x9e1d('0x5'));var BPromise=require(_0x9e1d('0x6'));var Mustache=require('mustache');var util=require(_0x9e1d('0x7'));var path=require(_0x9e1d('0x8'));var sox=require(_0x9e1d('0x9'));var csv=require(_0x9e1d('0xa'));var ejs=require(_0x9e1d('0xb'));var fs=require('fs');var _=require(_0x9e1d('0xc'));var squel=require('squel');var crypto=require(_0x9e1d('0xd'));var jsforce=require(_0x9e1d('0xe'));var deskjs=require(_0x9e1d('0xf'));var toCsv=require(_0x9e1d('0xa'));var querystring=require(_0x9e1d('0x10'));var Papa=require(_0x9e1d('0x11'));var Redis=require('ioredis');var authService=require(_0x9e1d('0x12'));var qs=require(_0x9e1d('0x13'));var as=require(_0x9e1d('0x14'));var hardwareService=require(_0x9e1d('0x15'));var logger=require(_0x9e1d('0x16'))(_0x9e1d('0x17'));var utils=require(_0x9e1d('0x18'));var config=require(_0x9e1d('0x19'));var db=require(_0x9e1d('0x1a'))['db'];function respondWithStatusCode(_0x3098a5,_0x108dc5){_0x108dc5=_0x108dc5||0xcc;return function(_0x2daf51){if(_0x2daf51){return _0x3098a5[_0x9e1d('0x1b')](_0x108dc5);}return _0x3098a5[_0x9e1d('0x1c')](_0x108dc5)['end']();};}function respondWithResult(_0x2eae8e,_0x167774){_0x167774=_0x167774||0xc8;return function(_0x985dde){if(_0x985dde){return _0x2eae8e['status'](_0x167774)[_0x9e1d('0x1d')](_0x985dde);}};}function respondWithFilteredResult(_0x37e2dd,_0x84891d){return function(_0x4ef6fb){if(_0x4ef6fb){var _0x1c634c=_0x4ef6fb[_0x9e1d('0x1e')],_0x56fe55=_0x84891d['offset'],_0xc70e63=_0x84891d[_0x9e1d('0x1f')]+_0x84891d[_0x9e1d('0x20')],_0x36ad68;if(_0xc70e63>=_0x1c634c){_0xc70e63=_0x1c634c;_0x36ad68=0xc8;}else{_0x36ad68=0xce;}_0x37e2dd[_0x9e1d('0x1c')](_0x36ad68);return _0x37e2dd[_0x9e1d('0x21')](_0x9e1d('0x22'),_0x56fe55+'-'+_0xc70e63+'/'+_0x1c634c)[_0x9e1d('0x1d')](_0x4ef6fb);}return null;};}function patchUpdates(_0x218de4){return function(_0x13dfed){try{jsonpatch['apply'](_0x13dfed,_0x218de4,!![]);}catch(_0x19556b){return BPromise[_0x9e1d('0x23')](_0x19556b);}return _0x13dfed[_0x9e1d('0x24')]();};}function saveUpdates(_0x44a0a6,_0x131948){return function(_0x1c0eae){if(_0x1c0eae){return _0x1c0eae[_0x9e1d('0x25')](_0x44a0a6)[_0x9e1d('0x26')](function(_0xad8721){return _0xad8721;});}return null;};}function removeEntity(_0x15b654,_0x434ff9){return function(_0x4bf372){if(_0x4bf372){return _0x4bf372[_0x9e1d('0x27')]()[_0x9e1d('0x26')](function(){_0x15b654[_0x9e1d('0x1c')](0xcc)[_0x9e1d('0x28')]();});}};}function handleEntityNotFound(_0x11807e,_0x35ac93){return function(_0x1e02c7){if(!_0x1e02c7){_0x11807e[_0x9e1d('0x1b')](0x194);}return _0x1e02c7;};}function handleError(_0x1439eb,_0x1c9cd9){_0x1c9cd9=_0x1c9cd9||0x1f4;return function(_0x5358c2){logger[_0x9e1d('0x29')](_0x5358c2[_0x9e1d('0x2a')]);if(_0x5358c2[_0x9e1d('0x2b')]){delete _0x5358c2[_0x9e1d('0x2b')];}_0x1439eb[_0x9e1d('0x1c')](_0x1c9cd9)[_0x9e1d('0x2c')](_0x5358c2);};}exports[_0x9e1d('0x2d')]=function(_0x5af3a0,_0xb78d2d){var _0x2d4c8e={},_0xa8a03={},_0x267508={'count':0x0,'rows':[]};var _0x57fe5a=_[_0x9e1d('0x2e')](db['AnalyticTreeReport']['rawAttributes'],function(_0x355c5f){return{'name':_0x355c5f[_0x9e1d('0x2f')],'type':_0x355c5f['type']['key']};});_0xa8a03['model']=_['map'](_0x57fe5a,'name');_0xa8a03[_0x9e1d('0x30')]=_[_0x9e1d('0x31')](_0x5af3a0['query']);_0xa8a03['filters']=_[_0x9e1d('0x32')](_0xa8a03[_0x9e1d('0x33')],_0xa8a03[_0x9e1d('0x30')]);_0x2d4c8e['attributes']=_['intersection'](_0xa8a03[_0x9e1d('0x33')],qs[_0x9e1d('0x34')](_0x5af3a0['query'][_0x9e1d('0x34')]));_0x2d4c8e[_0x9e1d('0x35')]=_0x2d4c8e[_0x9e1d('0x35')][_0x9e1d('0x36')]?_0x2d4c8e[_0x9e1d('0x35')]:_0xa8a03[_0x9e1d('0x33')];if(!_0x5af3a0[_0x9e1d('0x30')][_0x9e1d('0x37')](_0x9e1d('0x38'))){_0x2d4c8e[_0x9e1d('0x20')]=qs[_0x9e1d('0x20')](_0x5af3a0[_0x9e1d('0x30')][_0x9e1d('0x20')]);_0x2d4c8e[_0x9e1d('0x1f')]=qs['offset'](_0x5af3a0[_0x9e1d('0x30')][_0x9e1d('0x1f')]);}_0x2d4c8e['order']=qs[_0x9e1d('0x39')](_0x5af3a0[_0x9e1d('0x30')]['sort']);_0x2d4c8e[_0x9e1d('0x3a')]=qs[_0x9e1d('0x3b')](_[_0x9e1d('0x3c')](_0x5af3a0[_0x9e1d('0x30')],_0xa8a03[_0x9e1d('0x3b')]),_0x57fe5a);if(_0x5af3a0[_0x9e1d('0x30')]['filter']){_0x2d4c8e[_0x9e1d('0x3a')]=_[_0x9e1d('0x3d')](_0x2d4c8e[_0x9e1d('0x3a')],{'$or':_[_0x9e1d('0x2e')](_0x57fe5a,function(_0x52eba5){if(_0x52eba5[_0x9e1d('0x3e')]!==_0x9e1d('0x3f')){var _0x78a3f2={};_0x78a3f2[_0x52eba5[_0x9e1d('0x2b')]]={'$like':'%'+_0x5af3a0[_0x9e1d('0x30')]['filter']+'%'};return _0x78a3f2;}})});}_0x2d4c8e=_[_0x9e1d('0x3d')]({},_0x2d4c8e,_0x5af3a0[_0x9e1d('0x40')]);var _0x166de3={'where':_0x2d4c8e[_0x9e1d('0x3a')]};return db[_0x9e1d('0x41')][_0x9e1d('0x1e')](_0x166de3)[_0x9e1d('0x26')](function(_0x42dfc9){_0x267508[_0x9e1d('0x1e')]=_0x42dfc9;if(_0x5af3a0[_0x9e1d('0x30')]['includeAll']){_0x2d4c8e[_0x9e1d('0x42')]=[{'all':!![]}];}return db[_0x9e1d('0x41')]['findAll'](_0x2d4c8e);})[_0x9e1d('0x26')](function(_0x37a320){_0x267508[_0x9e1d('0x43')]=_0x37a320;return _0x267508;})[_0x9e1d('0x26')](respondWithFilteredResult(_0xb78d2d,_0x2d4c8e))[_0x9e1d('0x44')](handleError(_0xb78d2d,null));};exports[_0x9e1d('0x45')]=function(_0x344a06,_0x147d9a){var _0x4ecb39={'raw':!![],'where':{'id':_0x344a06[_0x9e1d('0x46')]['id']}},_0x199e47={};_0x199e47['model']=_['keys'](db['AnalyticTreeReport'][_0x9e1d('0x47')]);_0x199e47[_0x9e1d('0x30')]=_[_0x9e1d('0x31')](_0x344a06[_0x9e1d('0x30')]);_0x199e47['filters']=_['intersection'](_0x199e47['model'],_0x199e47[_0x9e1d('0x30')]);_0x4ecb39['attributes']=_[_0x9e1d('0x32')](_0x199e47[_0x9e1d('0x33')],qs[_0x9e1d('0x34')](_0x344a06[_0x9e1d('0x30')][_0x9e1d('0x34')]));_0x4ecb39[_0x9e1d('0x35')]=_0x4ecb39[_0x9e1d('0x35')]['length']?_0x4ecb39[_0x9e1d('0x35')]:_0x199e47[_0x9e1d('0x33')];if(_0x344a06[_0x9e1d('0x30')][_0x9e1d('0x48')]){_0x4ecb39[_0x9e1d('0x42')]=[{'all':!![]}];}_0x4ecb39=_[_0x9e1d('0x3d')]({},_0x4ecb39,_0x344a06[_0x9e1d('0x40')]);return db[_0x9e1d('0x41')]['find'](_0x4ecb39)[_0x9e1d('0x26')](handleEntityNotFound(_0x147d9a,null))[_0x9e1d('0x26')](respondWithResult(_0x147d9a,null))[_0x9e1d('0x44')](handleError(_0x147d9a,null));};exports[_0x9e1d('0x49')]=function(_0xd109b7,_0x3ccb1f){return db[_0x9e1d('0x41')][_0x9e1d('0x49')](_0xd109b7['body'],{})['then'](respondWithResult(_0x3ccb1f,0xc9))['catch'](handleError(_0x3ccb1f,null));};exports[_0x9e1d('0x25')]=function(_0x559edb,_0x3f6290){if(_0x559edb[_0x9e1d('0x4a')]['id']){delete _0x559edb[_0x9e1d('0x4a')]['id'];}return db[_0x9e1d('0x41')][_0x9e1d('0x4b')]({'where':{'id':_0x559edb['params']['id']}})[_0x9e1d('0x26')](handleEntityNotFound(_0x3f6290,null))[_0x9e1d('0x26')](saveUpdates(_0x559edb[_0x9e1d('0x4a')],null))[_0x9e1d('0x26')](respondWithResult(_0x3f6290,null))[_0x9e1d('0x44')](handleError(_0x3f6290,null));};exports[_0x9e1d('0x27')]=function(_0x1d5347,_0x4d9ef7){return db['AnalyticTreeReport'][_0x9e1d('0x4b')]({'where':{'id':_0x1d5347[_0x9e1d('0x46')]['id']}})[_0x9e1d('0x26')](handleEntityNotFound(_0x4d9ef7,null))[_0x9e1d('0x26')](removeEntity(_0x4d9ef7,null))['catch'](handleError(_0x4d9ef7,null));}; \ No newline at end of file +var _0xc67d=['status','json','offset','set','reject','save','update','then','error','stack','name','send','index','map','AnalyticTreeReport','fieldName','type','model','query','keys','filters','intersection','attributes','hasOwnProperty','nolimit','limit','sort','pick','filter','where','VIRTUAL','merge','options','count','includeAll','include','findAll','rows','catch','rawAttributes','fields','length','find','create','body','params','destroy','html-pdf','eml-format','rimraf','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/logger','../../config/environment','../../mysqldb','sendStatus','end'];(function(_0x5d7903,_0x46f3fe){var _0x19a55b=function(_0x577222){while(--_0x577222){_0x5d7903['push'](_0x5d7903['shift']());}};_0x19a55b(++_0x46f3fe);}(_0xc67d,0x1d9));var _0xdc67=function(_0x1f404d,_0x1de0d8){_0x1f404d=_0x1f404d-0x0;var _0x16e68a=_0xc67d[_0x1f404d];return _0x16e68a;};'use strict';var pdf=require(_0xdc67('0x0'));var emlformat=require(_0xdc67('0x1'));var rimraf=require(_0xdc67('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xdc67('0x3'));var moment=require(_0xdc67('0x4'));var BPromise=require(_0xdc67('0x5'));var Mustache=require(_0xdc67('0x6'));var util=require(_0xdc67('0x7'));var path=require('path');var sox=require(_0xdc67('0x8'));var csv=require(_0xdc67('0x9'));var ejs=require(_0xdc67('0xa'));var fs=require('fs');var _=require(_0xdc67('0xb'));var squel=require(_0xdc67('0xc'));var crypto=require(_0xdc67('0xd'));var jsforce=require(_0xdc67('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xdc67('0x9'));var querystring=require(_0xdc67('0xf'));var Papa=require(_0xdc67('0x10'));var Redis=require(_0xdc67('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xdc67('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xdc67('0x13'))('api');var utils=require('../../config/utils');var config=require(_0xdc67('0x14'));var db=require(_0xdc67('0x15'))['db'];function respondWithStatusCode(_0x16d203,_0x3017de){_0x3017de=_0x3017de||0xcc;return function(_0x26353c){if(_0x26353c){return _0x16d203[_0xdc67('0x16')](_0x3017de);}return _0x16d203['status'](_0x3017de)[_0xdc67('0x17')]();};}function respondWithResult(_0x4d3505,_0x2de7d1){_0x2de7d1=_0x2de7d1||0xc8;return function(_0x55fde2){if(_0x55fde2){return _0x4d3505[_0xdc67('0x18')](_0x2de7d1)[_0xdc67('0x19')](_0x55fde2);}};}function respondWithFilteredResult(_0x22feba,_0x25ff4d){return function(_0x45c0cb){if(_0x45c0cb){var _0x38f12c=_0x45c0cb['count'],_0x12c1f3=_0x25ff4d[_0xdc67('0x1a')],_0x3d5807=_0x25ff4d[_0xdc67('0x1a')]+_0x25ff4d['limit'],_0x701fbd;if(_0x3d5807>=_0x38f12c){_0x3d5807=_0x38f12c;_0x701fbd=0xc8;}else{_0x701fbd=0xce;}_0x22feba[_0xdc67('0x18')](_0x701fbd);return _0x22feba[_0xdc67('0x1b')]('Content-Range',_0x12c1f3+'-'+_0x3d5807+'/'+_0x38f12c)['json'](_0x45c0cb);}return null;};}function patchUpdates(_0x51cd80){return function(_0x3fa63f){try{jsonpatch['apply'](_0x3fa63f,_0x51cd80,!![]);}catch(_0x2da385){return BPromise[_0xdc67('0x1c')](_0x2da385);}return _0x3fa63f[_0xdc67('0x1d')]();};}function saveUpdates(_0x55cc92,_0x42d264){return function(_0x48d86c){if(_0x48d86c){return _0x48d86c[_0xdc67('0x1e')](_0x55cc92)[_0xdc67('0x1f')](function(_0x472e47){return _0x472e47;});}return null;};}function removeEntity(_0xdba0a5,_0x2de598){return function(_0x5d93af){if(_0x5d93af){return _0x5d93af['destroy']()[_0xdc67('0x1f')](function(){_0xdba0a5[_0xdc67('0x18')](0xcc)[_0xdc67('0x17')]();});}};}function handleEntityNotFound(_0x58cfff,_0x2766f2){return function(_0x3643b5){if(!_0x3643b5){_0x58cfff[_0xdc67('0x16')](0x194);}return _0x3643b5;};}function handleError(_0x2a483f,_0x451595){_0x451595=_0x451595||0x1f4;return function(_0x35e929){logger[_0xdc67('0x20')](_0x35e929[_0xdc67('0x21')]);if(_0x35e929['name']){delete _0x35e929[_0xdc67('0x22')];}_0x2a483f[_0xdc67('0x18')](_0x451595)[_0xdc67('0x23')](_0x35e929);};}exports[_0xdc67('0x24')]=function(_0x5e2357,_0x409bab){var _0x253f6a={},_0x26830b={},_0x2a2bc5={'count':0x0,'rows':[]};var _0x5713bf=_[_0xdc67('0x25')](db[_0xdc67('0x26')]['rawAttributes'],function(_0x522dd6){return{'name':_0x522dd6[_0xdc67('0x27')],'type':_0x522dd6[_0xdc67('0x28')]['key']};});_0x26830b[_0xdc67('0x29')]=_[_0xdc67('0x25')](_0x5713bf,_0xdc67('0x22'));_0x26830b[_0xdc67('0x2a')]=_[_0xdc67('0x2b')](_0x5e2357[_0xdc67('0x2a')]);_0x26830b[_0xdc67('0x2c')]=_[_0xdc67('0x2d')](_0x26830b[_0xdc67('0x29')],_0x26830b['query']);_0x253f6a['attributes']=_[_0xdc67('0x2d')](_0x26830b[_0xdc67('0x29')],qs['fields'](_0x5e2357[_0xdc67('0x2a')]['fields']));_0x253f6a[_0xdc67('0x2e')]=_0x253f6a[_0xdc67('0x2e')]['length']?_0x253f6a['attributes']:_0x26830b['model'];if(!_0x5e2357[_0xdc67('0x2a')][_0xdc67('0x2f')](_0xdc67('0x30'))){_0x253f6a[_0xdc67('0x31')]=qs[_0xdc67('0x31')](_0x5e2357[_0xdc67('0x2a')][_0xdc67('0x31')]);_0x253f6a[_0xdc67('0x1a')]=qs['offset'](_0x5e2357[_0xdc67('0x2a')]['offset']);}_0x253f6a['order']=qs[_0xdc67('0x32')](_0x5e2357[_0xdc67('0x2a')][_0xdc67('0x32')]);_0x253f6a['where']=qs[_0xdc67('0x2c')](_[_0xdc67('0x33')](_0x5e2357[_0xdc67('0x2a')],_0x26830b['filters']),_0x5713bf);if(_0x5e2357[_0xdc67('0x2a')][_0xdc67('0x34')]){_0x253f6a[_0xdc67('0x35')]=_['merge'](_0x253f6a[_0xdc67('0x35')],{'$or':_[_0xdc67('0x25')](_0x5713bf,function(_0x1ac24b){if(_0x1ac24b[_0xdc67('0x28')]!==_0xdc67('0x36')){var _0x3b75d2={};_0x3b75d2[_0x1ac24b['name']]={'$like':'%'+_0x5e2357[_0xdc67('0x2a')][_0xdc67('0x34')]+'%'};return _0x3b75d2;}})});}_0x253f6a=_[_0xdc67('0x37')]({},_0x253f6a,_0x5e2357[_0xdc67('0x38')]);var _0x4e9773={'where':_0x253f6a[_0xdc67('0x35')]};return db['AnalyticTreeReport'][_0xdc67('0x39')](_0x4e9773)[_0xdc67('0x1f')](function(_0x5f4f28){_0x2a2bc5[_0xdc67('0x39')]=_0x5f4f28;if(_0x5e2357['query'][_0xdc67('0x3a')]){_0x253f6a[_0xdc67('0x3b')]=[{'all':!![]}];}return db[_0xdc67('0x26')][_0xdc67('0x3c')](_0x253f6a);})[_0xdc67('0x1f')](function(_0x3a1a8c){_0x2a2bc5[_0xdc67('0x3d')]=_0x3a1a8c;return _0x2a2bc5;})[_0xdc67('0x1f')](respondWithFilteredResult(_0x409bab,_0x253f6a))[_0xdc67('0x3e')](handleError(_0x409bab,null));};exports['show']=function(_0x2b8cfe,_0x5b475e){var _0x2b7f58={'raw':!![],'where':{'id':_0x2b8cfe['params']['id']}},_0x345512={};_0x345512['model']=_[_0xdc67('0x2b')](db['AnalyticTreeReport'][_0xdc67('0x3f')]);_0x345512[_0xdc67('0x2a')]=_[_0xdc67('0x2b')](_0x2b8cfe[_0xdc67('0x2a')]);_0x345512[_0xdc67('0x2c')]=_[_0xdc67('0x2d')](_0x345512['model'],_0x345512[_0xdc67('0x2a')]);_0x2b7f58[_0xdc67('0x2e')]=_[_0xdc67('0x2d')](_0x345512['model'],qs['fields'](_0x2b8cfe[_0xdc67('0x2a')][_0xdc67('0x40')]));_0x2b7f58[_0xdc67('0x2e')]=_0x2b7f58[_0xdc67('0x2e')][_0xdc67('0x41')]?_0x2b7f58[_0xdc67('0x2e')]:_0x345512[_0xdc67('0x29')];if(_0x2b8cfe[_0xdc67('0x2a')][_0xdc67('0x3a')]){_0x2b7f58[_0xdc67('0x3b')]=[{'all':!![]}];}_0x2b7f58=_['merge']({},_0x2b7f58,_0x2b8cfe['options']);return db[_0xdc67('0x26')][_0xdc67('0x42')](_0x2b7f58)['then'](handleEntityNotFound(_0x5b475e,null))['then'](respondWithResult(_0x5b475e,null))[_0xdc67('0x3e')](handleError(_0x5b475e,null));};exports['create']=function(_0x41369c,_0x1864f1){return db['AnalyticTreeReport'][_0xdc67('0x43')](_0x41369c[_0xdc67('0x44')],{})[_0xdc67('0x1f')](respondWithResult(_0x1864f1,0xc9))[_0xdc67('0x3e')](handleError(_0x1864f1,null));};exports[_0xdc67('0x1e')]=function(_0x5d0b25,_0x2d3310){if(_0x5d0b25[_0xdc67('0x44')]['id']){delete _0x5d0b25['body']['id'];}return db[_0xdc67('0x26')][_0xdc67('0x42')]({'where':{'id':_0x5d0b25[_0xdc67('0x45')]['id']}})['then'](handleEntityNotFound(_0x2d3310,null))['then'](saveUpdates(_0x5d0b25[_0xdc67('0x44')],null))['then'](respondWithResult(_0x2d3310,null))[_0xdc67('0x3e')](handleError(_0x2d3310,null));};exports[_0xdc67('0x46')]=function(_0x2f9897,_0x57f7e8){return db[_0xdc67('0x26')][_0xdc67('0x42')]({'where':{'id':_0x2f9897[_0xdc67('0x45')]['id']}})[_0xdc67('0x1f')](handleEntityNotFound(_0x57f7e8,null))[_0xdc67('0x1f')](removeEntity(_0x57f7e8,null))[_0xdc67('0x3e')](handleError(_0x57f7e8,null));}; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.model.js b/server/api/analyticTreeReport/analyticTreeReport.model.js index 40e5056..1adaf1a 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 _0x18ca=['request-promise','path','rimraf','../../config/environment','./analyticTreeReport.attributes','exports','AnalyticTreeReport','util','../../config/logger','api','moment'];(function(_0x15870f,_0x19e6dc){var _0x4b5a93=function(_0x2f75cd){while(--_0x2f75cd){_0x15870f['push'](_0x15870f['shift']());}};_0x4b5a93(++_0x19e6dc);}(_0x18ca,0x188));var _0xa18c=function(_0x3fa6ad,_0x3d0983){_0x3fa6ad=_0x3fa6ad-0x0;var _0x20099d=_0x18ca[_0x3fa6ad];return _0x20099d;};'use strict';var _=require('lodash');var util=require(_0xa18c('0x0'));var logger=require(_0xa18c('0x1'))(_0xa18c('0x2'));var moment=require(_0xa18c('0x3'));var BPromise=require('bluebird');var rp=require(_0xa18c('0x4'));var fs=require('fs');var path=require(_0xa18c('0x5'));var rimraf=require(_0xa18c('0x6'));var config=require(_0xa18c('0x7'));var attributes=require(_0xa18c('0x8'));module[_0xa18c('0x9')]=function(_0x96f2f3,_0x1d253d){return _0x96f2f3['define'](_0xa18c('0xa'),attributes,{'tableName':'analytics_report_trees','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2e11=['util','api','moment','path','rimraf','../../config/environment','exports','define','AnalyticTreeReport','analytics_report_trees','lodash'];(function(_0x60df74,_0x458e29){var _0x5ee872=function(_0x356888){while(--_0x356888){_0x60df74['push'](_0x60df74['shift']());}};_0x5ee872(++_0x458e29);}(_0x2e11,0x112));var _0x12e1=function(_0x1d01be,_0x107191){_0x1d01be=_0x1d01be-0x0;var _0x467fd8=_0x2e11[_0x1d01be];return _0x467fd8;};'use strict';var _=require(_0x12e1('0x0'));var util=require(_0x12e1('0x1'));var logger=require('../../config/logger')(_0x12e1('0x2'));var moment=require(_0x12e1('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x12e1('0x4'));var rimraf=require(_0x12e1('0x5'));var config=require(_0x12e1('0x6'));var attributes=require('./analyticTreeReport.attributes');module[_0x12e1('0x7')]=function(_0x84785c,_0x4fe6fe){return _0x84785c[_0x12e1('0x8')](_0x12e1('0x9'),attributes,{'tableName':_0x12e1('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 87e9af7..2b7ece1 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 _0x7984=['debug','AnalyticTreeReport,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','request','then','info','AnalyticTreeReport,\x20%s,\x20%s','request\x20sent'];(function(_0x387777,_0x356171){var _0x3f84c0=function(_0x4d4423){while(--_0x4d4423){_0x387777['push'](_0x387777['shift']());}};_0x3f84c0(++_0x356171);}(_0x7984,0x79));var _0x4798=function(_0x652c38,_0x4ec2a3){_0x652c38=_0x652c38-0x0;var _0x31d2fd=_0x7984[_0x652c38];return _0x31d2fd;};'use strict';var _=require(_0x4798('0x0'));var util=require(_0x4798('0x1'));var moment=require(_0x4798('0x2'));var BPromise=require(_0x4798('0x3'));var rs=require(_0x4798('0x4'));var fs=require('fs');var Redis=require(_0x4798('0x5'));var db=require(_0x4798('0x6'))['db'];var utils=require(_0x4798('0x7'));var logger=require(_0x4798('0x8'))(_0x4798('0x9'));var config=require('../../config/environment');var jayson=require(_0x4798('0xa'));var client=jayson['client'][_0x4798('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1bc240,_0x25fc3c,_0x496e1f){return new BPromise(function(_0xcd8961,_0x6feae4){return client[_0x4798('0xc')](_0x1bc240,_0x496e1f)[_0x4798('0xd')](function(_0xc9f17c){logger[_0x4798('0xe')](_0x4798('0xf'),_0x25fc3c,_0x4798('0x10'));logger[_0x4798('0x11')](_0x4798('0x12'),_0x25fc3c,'request\x20sent',JSON[_0x4798('0x13')](_0xc9f17c));if(_0xc9f17c[_0x4798('0x14')]){if(_0xc9f17c[_0x4798('0x14')]['code']===0x1f4){logger[_0x4798('0x14')](_0x4798('0xf'),_0x25fc3c,_0xc9f17c[_0x4798('0x14')][_0x4798('0x15')]);return _0x6feae4(_0xc9f17c[_0x4798('0x14')]['message']);}logger['error'](_0x4798('0xf'),_0x25fc3c,_0xc9f17c[_0x4798('0x14')][_0x4798('0x15')]);return _0xcd8961(_0xc9f17c['error'][_0x4798('0x15')]);}else{logger['info'](_0x4798('0xf'),_0x25fc3c,_0x4798('0x10'));_0xcd8961(_0xc9f17c['result'][_0x4798('0x15')]);}})[_0x4798('0x16')](function(_0x43077f){logger['error'](_0x4798('0xf'),_0x25fc3c,_0x43077f);_0x6feae4(_0x43077f);});});} \ No newline at end of file +var _0xe6a6=['rpc','../../config/environment','jayson/promise','client','http','request','then','info','AnalyticTreeReport,\x20%s,\x20%s','request\x20sent','AnalyticTreeReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger'];(function(_0x581960,_0x1232ff){var _0x4ee892=function(_0x2a920d){while(--_0x2a920d){_0x581960['push'](_0x581960['shift']());}};_0x4ee892(++_0x1232ff);}(_0xe6a6,0x1c1));var _0x6e6a=function(_0x388754,_0x4b72a3){_0x388754=_0x388754-0x0;var _0x12246f=_0xe6a6[_0x388754];return _0x12246f;};'use strict';var _=require('lodash');var util=require(_0x6e6a('0x0'));var moment=require(_0x6e6a('0x1'));var BPromise=require(_0x6e6a('0x2'));var rs=require(_0x6e6a('0x3'));var fs=require('fs');var Redis=require(_0x6e6a('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x6e6a('0x5'));var logger=require(_0x6e6a('0x6'))(_0x6e6a('0x7'));var config=require(_0x6e6a('0x8'));var jayson=require(_0x6e6a('0x9'));var client=jayson[_0x6e6a('0xa')][_0x6e6a('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5a1911,_0x345e83,_0xd7cf7d){return new BPromise(function(_0x232339,_0x208770){return client[_0x6e6a('0xc')](_0x5a1911,_0xd7cf7d)[_0x6e6a('0xd')](function(_0x156caa){logger[_0x6e6a('0xe')](_0x6e6a('0xf'),_0x345e83,_0x6e6a('0x10'));logger['debug'](_0x6e6a('0x11'),_0x345e83,_0x6e6a('0x10'),JSON[_0x6e6a('0x12')](_0x156caa));if(_0x156caa[_0x6e6a('0x13')]){if(_0x156caa['error'][_0x6e6a('0x14')]===0x1f4){logger[_0x6e6a('0x13')](_0x6e6a('0xf'),_0x345e83,_0x156caa[_0x6e6a('0x13')][_0x6e6a('0x15')]);return _0x208770(_0x156caa[_0x6e6a('0x13')][_0x6e6a('0x15')]);}logger[_0x6e6a('0x13')](_0x6e6a('0xf'),_0x345e83,_0x156caa['error'][_0x6e6a('0x15')]);return _0x232339(_0x156caa[_0x6e6a('0x13')][_0x6e6a('0x15')]);}else{logger[_0x6e6a('0xe')](_0x6e6a('0xf'),_0x345e83,'request\x20sent');_0x232339(_0x156caa[_0x6e6a('0x16')][_0x6e6a('0x15')]);}})[_0x6e6a('0x17')](function(_0x32712b){logger['error'](_0x6e6a('0xf'),_0x345e83,_0x32712b);_0x208770(_0x32712b);});});} \ No newline at end of file diff --git a/server/api/analyticTreeReport/index.js b/server/api/analyticTreeReport/index.js index c5c5877..1535d78 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 _0xe302=['../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/:id','show','put','update','delete','exports','multer','util','path','connect-timeout','express','Router'];(function(_0x36fc09,_0x524f5a){var _0x52d555=function(_0x112183){while(--_0x112183){_0x36fc09['push'](_0x36fc09['shift']());}};_0x52d555(++_0x524f5a);}(_0xe302,0x93));var _0x2e30=function(_0x396244,_0x19da7f){_0x396244=_0x396244-0x0;var _0xdf4a90=_0xe302[_0x396244];return _0xdf4a90;};'use strict';var multer=require(_0x2e30('0x0'));var util=require(_0x2e30('0x1'));var path=require(_0x2e30('0x2'));var timeout=require(_0x2e30('0x3'));var express=require(_0x2e30('0x4'));var router=express[_0x2e30('0x5')]();var auth=require(_0x2e30('0x6'));var interaction=require(_0x2e30('0x7'));var config=require(_0x2e30('0x8'));var controller=require('./analyticTreeReport.controller');router[_0x2e30('0x9')]('/',auth[_0x2e30('0xa')](),controller['index']);router[_0x2e30('0x9')](_0x2e30('0xb'),auth[_0x2e30('0xa')](),controller[_0x2e30('0xc')]);router['post']('/',auth[_0x2e30('0xa')](),controller['create']);router[_0x2e30('0xd')](_0x2e30('0xb'),auth[_0x2e30('0xa')](),controller[_0x2e30('0xe')]);router[_0x2e30('0xf')](_0x2e30('0xb'),auth[_0x2e30('0xa')](),controller['destroy']);module[_0x2e30('0x10')]=router; \ No newline at end of file +var _0x2cb3=['index','/:id','show','post','put','update','delete','destroy','exports','multer','util','connect-timeout','Router','../../components/interaction/service','../../config/environment','./analyticTreeReport.controller','get','isAuthenticated'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x2cb3,0x183));var _0x32cb=function(_0x3f4afe,_0x5db38f){_0x3f4afe=_0x3f4afe-0x0;var _0x482cdc=_0x2cb3[_0x3f4afe];return _0x482cdc;};'use strict';var multer=require(_0x32cb('0x0'));var util=require(_0x32cb('0x1'));var path=require('path');var timeout=require(_0x32cb('0x2'));var express=require('express');var router=express[_0x32cb('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0x32cb('0x4'));var config=require(_0x32cb('0x5'));var controller=require(_0x32cb('0x6'));router[_0x32cb('0x7')]('/',auth[_0x32cb('0x8')](),controller[_0x32cb('0x9')]);router[_0x32cb('0x7')](_0x32cb('0xa'),auth['isAuthenticated'](),controller[_0x32cb('0xb')]);router[_0x32cb('0xc')]('/',auth[_0x32cb('0x8')](),controller['create']);router[_0x32cb('0xd')](_0x32cb('0xa'),auth[_0x32cb('0x8')](),controller[_0x32cb('0xe')]);router[_0x32cb('0xf')](_0x32cb('0xa'),auth['isAuthenticated'](),controller[_0x32cb('0x10')]);module[_0x32cb('0x11')]=router; \ No newline at end of file diff --git a/server/api/attachment/attachment.attributes.js b/server/api/attachment/attachment.attributes.js index 9300f5b..822de7a 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 _0x160d=['sequelize','exports','STRING'];(function(_0x225714,_0x1652ae){var _0x580214=function(_0x5e5933){while(--_0x5e5933){_0x225714['push'](_0x225714['shift']());}};_0x580214(++_0x1652ae);}(_0x160d,0x123));var _0xd160=function(_0x4d4ab2,_0x1cb84f){_0x4d4ab2=_0x4d4ab2-0x0;var _0x53a726=_0x160d[_0x4d4ab2];return _0x53a726;};'use strict';var Sequelize=require(_0xd160('0x0'));module[_0xd160('0x1')]={'name':{'type':Sequelize[_0xd160('0x2')]},'basename':{'type':Sequelize[_0xd160('0x2')]},'type':{'type':Sequelize[_0xd160('0x2')]}}; \ No newline at end of file +var _0xd926=['sequelize'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xd926,0x1bb));var _0x6d92=function(_0x3815ca,_0x5d2ce0){_0x3815ca=_0x3815ca-0x0;var _0xccfa9f=_0xd926[_0x3815ca];return _0xccfa9f;};'use strict';var Sequelize=require(_0x6d92('0x0'));module['exports']={'name':{'type':Sequelize['STRING']},'basename':{'type':Sequelize['STRING']},'type':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/attachment/attachment.controller.js b/server/api/attachment/attachment.controller.js index fef8054..43842e4 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 _0x8cb8=['../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','apply','save','update','destroy','error','stack','name','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','order','sort','pick','filter','merge','options','where','then','includeAll','include','Attachment','catch','show','params','find','clone','get','omit','createdAt','updatedAt','body','create','file','basename','filename','mimetype','download','findOne','join','root','server/files/attachments/','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','path','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0x8cb8,0x13c));var _0x88cb=function(_0x1663ae,_0x10484a){_0x1663ae=_0x1663ae-0x0;var _0x30ffb8=_0x8cb8[_0x1663ae];return _0x30ffb8;};'use strict';var pdf=require(_0x88cb('0x0'));var emlformat=require(_0x88cb('0x1'));var rimraf=require(_0x88cb('0x2'));var zipdir=require(_0x88cb('0x3'));var jsonpatch=require(_0x88cb('0x4'));var rp=require(_0x88cb('0x5'));var moment=require(_0x88cb('0x6'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x88cb('0x7'));var path=require(_0x88cb('0x8'));var sox=require(_0x88cb('0x9'));var csv=require(_0x88cb('0xa'));var ejs=require(_0x88cb('0xb'));var fs=require('fs');var _=require(_0x88cb('0xc'));var squel=require('squel');var crypto=require(_0x88cb('0xd'));var jsforce=require(_0x88cb('0xe'));var deskjs=require(_0x88cb('0xf'));var toCsv=require('to-csv');var querystring=require(_0x88cb('0x10'));var Papa=require('papaparse');var Redis=require(_0x88cb('0x11'));var authService=require(_0x88cb('0x12'));var qs=require(_0x88cb('0x13'));var as=require(_0x88cb('0x14'));var hardwareService=require(_0x88cb('0x15'));var logger=require('../../config/logger')(_0x88cb('0x16'));var utils=require(_0x88cb('0x17'));var config=require(_0x88cb('0x18'));var db=require(_0x88cb('0x19'))['db'];function respondWithStatusCode(_0x52ac81,_0x8f67fd){_0x8f67fd=_0x8f67fd||0xcc;return function(_0x986b22){if(_0x986b22){return _0x52ac81[_0x88cb('0x1a')](_0x8f67fd);}return _0x52ac81[_0x88cb('0x1b')](_0x8f67fd)[_0x88cb('0x1c')]();};}function respondWithResult(_0x5336b2,_0x2d1ef5){_0x2d1ef5=_0x2d1ef5||0xc8;return function(_0x563995){if(_0x563995){return _0x5336b2[_0x88cb('0x1b')](_0x2d1ef5)[_0x88cb('0x1d')](_0x563995);}};}function respondWithFilteredResult(_0x21761a,_0x1ca675){return function(_0x547852){if(_0x547852){var _0x3f039b=_0x547852[_0x88cb('0x1e')],_0x1958b4=_0x1ca675[_0x88cb('0x1f')],_0x1bf159=_0x1ca675[_0x88cb('0x1f')]+_0x1ca675[_0x88cb('0x20')],_0x5240cb;if(_0x1bf159>=_0x3f039b){_0x1bf159=_0x3f039b;_0x5240cb=0xc8;}else{_0x5240cb=0xce;}_0x21761a['status'](_0x5240cb);return _0x21761a[_0x88cb('0x21')]('Content-Range',_0x1958b4+'-'+_0x1bf159+'/'+_0x3f039b)[_0x88cb('0x1d')](_0x547852);}return null;};}function patchUpdates(_0x425bc6){return function(_0x54992b){try{jsonpatch[_0x88cb('0x22')](_0x54992b,_0x425bc6,!![]);}catch(_0x25bb08){return BPromise['reject'](_0x25bb08);}return _0x54992b[_0x88cb('0x23')]();};}function saveUpdates(_0x1cd854,_0xbae77f){return function(_0xe79059){if(_0xe79059){return _0xe79059[_0x88cb('0x24')](_0x1cd854)['then'](function(_0x504429){return _0x504429;});}return null;};}function removeEntity(_0x7a60a9,_0x4e79be){return function(_0x1614a9){if(_0x1614a9){return _0x1614a9[_0x88cb('0x25')]()['then'](function(){_0x7a60a9[_0x88cb('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x228f28,_0x57e2c1){return function(_0x370ad7){if(!_0x370ad7){_0x228f28[_0x88cb('0x1a')](0x194);}return _0x370ad7;};}function handleError(_0x3a668e,_0x213076){_0x213076=_0x213076||0x1f4;return function(_0x19aae5){logger[_0x88cb('0x26')](_0x19aae5[_0x88cb('0x27')]);if(_0x19aae5[_0x88cb('0x28')]){delete _0x19aae5['name'];}_0x3a668e['status'](_0x213076)['send'](_0x19aae5);};}exports['index']=function(_0x354e20,_0x3e3e7b){var _0x214cd5={},_0x457aac={},_0x11487a={'count':0x0,'rows':[]};var _0x1f06fa=_[_0x88cb('0x29')](db['Attachment'][_0x88cb('0x2a')],function(_0x198562){return{'name':_0x198562[_0x88cb('0x2b')],'type':_0x198562[_0x88cb('0x2c')][_0x88cb('0x2d')]};});_0x457aac[_0x88cb('0x2e')]=_[_0x88cb('0x29')](_0x1f06fa,_0x88cb('0x28'));_0x457aac[_0x88cb('0x2f')]=_[_0x88cb('0x30')](_0x354e20[_0x88cb('0x2f')]);_0x457aac[_0x88cb('0x31')]=_['intersection'](_0x457aac[_0x88cb('0x2e')],_0x457aac[_0x88cb('0x2f')]);_0x214cd5['attributes']=_[_0x88cb('0x32')](_0x457aac[_0x88cb('0x2e')],qs[_0x88cb('0x33')](_0x354e20[_0x88cb('0x2f')]['fields']));_0x214cd5[_0x88cb('0x34')]=_0x214cd5[_0x88cb('0x34')][_0x88cb('0x35')]?_0x214cd5['attributes']:_0x457aac[_0x88cb('0x2e')];if(!_0x354e20[_0x88cb('0x2f')]['hasOwnProperty']('nolimit')){_0x214cd5[_0x88cb('0x20')]=qs[_0x88cb('0x20')](_0x354e20['query'][_0x88cb('0x20')]);_0x214cd5['offset']=qs[_0x88cb('0x1f')](_0x354e20[_0x88cb('0x2f')]['offset']);}_0x214cd5[_0x88cb('0x36')]=qs[_0x88cb('0x37')](_0x354e20[_0x88cb('0x2f')][_0x88cb('0x37')]);_0x214cd5['where']=qs[_0x88cb('0x31')](_[_0x88cb('0x38')](_0x354e20[_0x88cb('0x2f')],_0x457aac[_0x88cb('0x31')]),_0x1f06fa);if(_0x354e20[_0x88cb('0x2f')][_0x88cb('0x39')]){_0x214cd5['where']=_[_0x88cb('0x3a')](_0x214cd5['where'],{'$or':_[_0x88cb('0x29')](_0x1f06fa,function(_0x179a0f){if(_0x179a0f['type']!=='VIRTUAL'){var _0x19db25={};_0x19db25[_0x179a0f[_0x88cb('0x28')]]={'$like':'%'+_0x354e20['query'][_0x88cb('0x39')]+'%'};return _0x19db25;}})});}_0x214cd5=_[_0x88cb('0x3a')]({},_0x214cd5,_0x354e20[_0x88cb('0x3b')]);var _0x1b7a7b={'where':_0x214cd5[_0x88cb('0x3c')]};return db['Attachment'][_0x88cb('0x1e')](_0x1b7a7b)[_0x88cb('0x3d')](function(_0x2b85b2){_0x11487a[_0x88cb('0x1e')]=_0x2b85b2;if(_0x354e20[_0x88cb('0x2f')][_0x88cb('0x3e')]){_0x214cd5[_0x88cb('0x3f')]=[{'all':!![]}];}return db[_0x88cb('0x40')]['findAll'](_0x214cd5);})[_0x88cb('0x3d')](function(_0x524e79){_0x11487a['rows']=_0x524e79;return _0x11487a;})[_0x88cb('0x3d')](respondWithFilteredResult(_0x3e3e7b,_0x214cd5))[_0x88cb('0x41')](handleError(_0x3e3e7b,null));};exports[_0x88cb('0x42')]=function(_0x5deab6,_0x15a328){var _0x8bf3b4={'raw':!![],'where':{'id':_0x5deab6[_0x88cb('0x43')]['id']}},_0x4b4a9c={};_0x4b4a9c[_0x88cb('0x2e')]=_['keys'](db[_0x88cb('0x40')][_0x88cb('0x2a')]);_0x4b4a9c[_0x88cb('0x2f')]=_[_0x88cb('0x30')](_0x5deab6[_0x88cb('0x2f')]);_0x4b4a9c[_0x88cb('0x31')]=_[_0x88cb('0x32')](_0x4b4a9c[_0x88cb('0x2e')],_0x4b4a9c[_0x88cb('0x2f')]);_0x8bf3b4[_0x88cb('0x34')]=_[_0x88cb('0x32')](_0x4b4a9c['model'],qs[_0x88cb('0x33')](_0x5deab6[_0x88cb('0x2f')]['fields']));_0x8bf3b4['attributes']=_0x8bf3b4[_0x88cb('0x34')]['length']?_0x8bf3b4[_0x88cb('0x34')]:_0x4b4a9c['model'];if(_0x5deab6['query']['includeAll']){_0x8bf3b4[_0x88cb('0x3f')]=[{'all':!![]}];}_0x8bf3b4=_[_0x88cb('0x3a')]({},_0x8bf3b4,_0x5deab6[_0x88cb('0x3b')]);return db[_0x88cb('0x40')][_0x88cb('0x44')](_0x8bf3b4)[_0x88cb('0x3d')](handleEntityNotFound(_0x15a328,null))[_0x88cb('0x3d')](respondWithResult(_0x15a328,null))['catch'](handleError(_0x15a328,null));};exports[_0x88cb('0x45')]=function(_0x38a9ad,_0x4fab43){var _0x1f46ff={'where':{'id':_0x38a9ad[_0x88cb('0x43')]['id']}},_0x4a1e24={};_0x4a1e24[_0x88cb('0x2e')]=_[_0x88cb('0x30')](db['Attachment'][_0x88cb('0x2a')]);_0x1f46ff[_0x88cb('0x34')]=_[_0x88cb('0x32')](_0x4a1e24['model'],qs[_0x88cb('0x33')](_0x38a9ad[_0x88cb('0x2f')][_0x88cb('0x33')]));_0x1f46ff[_0x88cb('0x34')]=_0x1f46ff[_0x88cb('0x34')]['length']?_0x1f46ff[_0x88cb('0x34')]:_0x4a1e24[_0x88cb('0x2e')];if(_0x38a9ad[_0x88cb('0x2f')]['includeAll']){_0x1f46ff['include']=[{'all':!![]}];}_0x1f46ff=_[_0x88cb('0x3a')]({},_0x1f46ff,_0x38a9ad[_0x88cb('0x3b')]);return db['Attachment']['find'](_0x1f46ff)[_0x88cb('0x3d')](handleEntityNotFound(_0x4fab43,null))[_0x88cb('0x3d')](function(_0x2038b9){if(_0x2038b9){var _0x57fca5=_0x2038b9[_0x88cb('0x46')]({'plain':!![]});_0x57fca5=qs[_0x88cb('0x47')](_0x57fca5,['id',_0x88cb('0x48'),_0x88cb('0x49')]);_0x38a9ad[_0x88cb('0x4a')]=_[_0x88cb('0x47')](_0x38a9ad[_0x88cb('0x4a')],['id',_0x88cb('0x48'),_0x88cb('0x49')]);return db['Attachment'][_0x88cb('0x4b')](_[_0x88cb('0x3a')](_0x57fca5,_0x38a9ad[_0x88cb('0x4a')]),{'include':_0x38a9ad[_0x88cb('0x2f')][_0x88cb('0x3e')]?[{'all':!![]}]:undefined});}})[_0x88cb('0x3d')](respondWithResult(_0x4fab43,0xc9))['catch'](handleError(_0x4fab43,null));};exports[_0x88cb('0x24')]=function(_0x13ea39,_0x1a6d12){if(_0x13ea39['body']['id']){delete _0x13ea39[_0x88cb('0x4a')]['id'];}return db['Attachment'][_0x88cb('0x44')]({'where':{'id':_0x13ea39[_0x88cb('0x43')]['id']}})['then'](handleEntityNotFound(_0x1a6d12,null))[_0x88cb('0x3d')](saveUpdates(_0x13ea39[_0x88cb('0x4a')],null))[_0x88cb('0x3d')](respondWithResult(_0x1a6d12,null))[_0x88cb('0x41')](handleError(_0x1a6d12,null));};exports['destroy']=function(_0x193f20,_0x308287){return db[_0x88cb('0x40')]['find']({'where':{'id':_0x193f20['params']['id']}})[_0x88cb('0x3d')](handleEntityNotFound(_0x308287,null))['then'](removeEntity(_0x308287,null))['catch'](handleError(_0x308287,null));};exports[_0x88cb('0x4b')]=function(_0x242c35,_0x21f7eb,_0x4bbafe){_0x242c35[_0x88cb('0x4a')][_0x88cb('0x28')]=_0x242c35[_0x88cb('0x4c')]['originalname'];_0x242c35[_0x88cb('0x4a')][_0x88cb('0x4d')]=_0x242c35['file'][_0x88cb('0x4e')];_0x242c35[_0x88cb('0x4a')][_0x88cb('0x2c')]=_0x242c35[_0x88cb('0x4c')][_0x88cb('0x4f')];return db['Attachment'][_0x88cb('0x4b')](_0x242c35[_0x88cb('0x4a')])[_0x88cb('0x3d')](respondWithResult(_0x21f7eb,0xc9))[_0x88cb('0x41')](handleError(_0x21f7eb,null));};exports[_0x88cb('0x50')]=function(_0x40d1d0,_0xc09947,_0x2588fe){return db['Attachment'][_0x88cb('0x51')]({'where':{'id':_0x40d1d0['params']['id']},'raw':!![]})[_0x88cb('0x3d')](handleEntityNotFound(_0xc09947,null))['then'](function(_0x36f42d){if(_0x36f42d){return _0xc09947[_0x88cb('0x50')](path[_0x88cb('0x52')](config[_0x88cb('0x53')],_0x88cb('0x54'),_0x36f42d['basename']));}})[_0x88cb('0x41')](handleError(_0xc09947,null));}; \ No newline at end of file +var _0xfd42=['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','reject','save','update','then','destroy','error','stack','name','send','index','map','Attachment','rawAttributes','fieldName','key','model','keys','query','intersection','fields','attributes','hasOwnProperty','nolimit','where','filters','type','VIRTUAL','filter','merge','include','findAll','rows','catch','show','includeAll','params','length','options','find','get','omit','createdAt','body','updatedAt','create','originalname','basename','file','filename','download','findOne','join','root','html-pdf','eml-format','moment','bluebird','mustache','util','path','sox','to-csv','ejs','jsforce','desk.js','querystring'];(function(_0x47bc58,_0x1e1998){var _0x4a0860=function(_0x2a5b23){while(--_0x2a5b23){_0x47bc58['push'](_0x47bc58['shift']());}};_0x4a0860(++_0x1e1998);}(_0xfd42,0x1f1));var _0x2fd4=function(_0xcf2200,_0x4f5f6b){_0xcf2200=_0xcf2200-0x0;var _0x3aadf1=_0xfd42[_0xcf2200];return _0x3aadf1;};'use strict';var pdf=require(_0x2fd4('0x0'));var emlformat=require(_0x2fd4('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x2fd4('0x2'));var BPromise=require(_0x2fd4('0x3'));var Mustache=require(_0x2fd4('0x4'));var util=require(_0x2fd4('0x5'));var path=require(_0x2fd4('0x6'));var sox=require(_0x2fd4('0x7'));var csv=require(_0x2fd4('0x8'));var ejs=require(_0x2fd4('0x9'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x2fd4('0xa'));var deskjs=require(_0x2fd4('0xb'));var toCsv=require(_0x2fd4('0x8'));var querystring=require(_0x2fd4('0xc'));var Papa=require(_0x2fd4('0xd'));var Redis=require(_0x2fd4('0xe'));var authService=require(_0x2fd4('0xf'));var qs=require(_0x2fd4('0x10'));var as=require(_0x2fd4('0x11'));var hardwareService=require(_0x2fd4('0x12'));var logger=require(_0x2fd4('0x13'))(_0x2fd4('0x14'));var utils=require(_0x2fd4('0x15'));var config=require(_0x2fd4('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x902d56,_0xb1cabe){_0xb1cabe=_0xb1cabe||0xcc;return function(_0x4e3e5f){if(_0x4e3e5f){return _0x902d56[_0x2fd4('0x17')](_0xb1cabe);}return _0x902d56[_0x2fd4('0x18')](_0xb1cabe)['end']();};}function respondWithResult(_0x46e073,_0x2e671c){_0x2e671c=_0x2e671c||0xc8;return function(_0x78d9ad){if(_0x78d9ad){return _0x46e073[_0x2fd4('0x18')](_0x2e671c)[_0x2fd4('0x19')](_0x78d9ad);}};}function respondWithFilteredResult(_0x21e1b4,_0x4c31a1){return function(_0x406c45){if(_0x406c45){var _0x369683=_0x406c45[_0x2fd4('0x1a')],_0x468a93=_0x4c31a1[_0x2fd4('0x1b')],_0x338e71=_0x4c31a1[_0x2fd4('0x1b')]+_0x4c31a1[_0x2fd4('0x1c')],_0x56db02;if(_0x338e71>=_0x369683){_0x338e71=_0x369683;_0x56db02=0xc8;}else{_0x56db02=0xce;}_0x21e1b4[_0x2fd4('0x18')](_0x56db02);return _0x21e1b4[_0x2fd4('0x1d')](_0x2fd4('0x1e'),_0x468a93+'-'+_0x338e71+'/'+_0x369683)[_0x2fd4('0x19')](_0x406c45);}return null;};}function patchUpdates(_0x42bae8){return function(_0xe86f88){try{jsonpatch[_0x2fd4('0x1f')](_0xe86f88,_0x42bae8,!![]);}catch(_0x30150b){return BPromise[_0x2fd4('0x20')](_0x30150b);}return _0xe86f88[_0x2fd4('0x21')]();};}function saveUpdates(_0x228bff,_0x1d7805){return function(_0x410ed7){if(_0x410ed7){return _0x410ed7[_0x2fd4('0x22')](_0x228bff)[_0x2fd4('0x23')](function(_0x52c8dc){return _0x52c8dc;});}return null;};}function removeEntity(_0x139954,_0x303783){return function(_0x5dbdce){if(_0x5dbdce){return _0x5dbdce[_0x2fd4('0x24')]()[_0x2fd4('0x23')](function(){_0x139954[_0x2fd4('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x37c7f6,_0x29c64c){return function(_0x3651e0){if(!_0x3651e0){_0x37c7f6['sendStatus'](0x194);}return _0x3651e0;};}function handleError(_0x601e14,_0x571503){_0x571503=_0x571503||0x1f4;return function(_0x1fb7eb){logger[_0x2fd4('0x25')](_0x1fb7eb[_0x2fd4('0x26')]);if(_0x1fb7eb[_0x2fd4('0x27')]){delete _0x1fb7eb[_0x2fd4('0x27')];}_0x601e14[_0x2fd4('0x18')](_0x571503)[_0x2fd4('0x28')](_0x1fb7eb);};}exports[_0x2fd4('0x29')]=function(_0x2365bb,_0xb2c070){var _0xf0d278={},_0x448dd9={},_0xfda747={'count':0x0,'rows':[]};var _0x4ae485=_[_0x2fd4('0x2a')](db[_0x2fd4('0x2b')][_0x2fd4('0x2c')],function(_0x481e0d){return{'name':_0x481e0d[_0x2fd4('0x2d')],'type':_0x481e0d['type'][_0x2fd4('0x2e')]};});_0x448dd9[_0x2fd4('0x2f')]=_[_0x2fd4('0x2a')](_0x4ae485,'name');_0x448dd9['query']=_[_0x2fd4('0x30')](_0x2365bb[_0x2fd4('0x31')]);_0x448dd9['filters']=_[_0x2fd4('0x32')](_0x448dd9[_0x2fd4('0x2f')],_0x448dd9[_0x2fd4('0x31')]);_0xf0d278['attributes']=_[_0x2fd4('0x32')](_0x448dd9[_0x2fd4('0x2f')],qs[_0x2fd4('0x33')](_0x2365bb['query'][_0x2fd4('0x33')]));_0xf0d278[_0x2fd4('0x34')]=_0xf0d278[_0x2fd4('0x34')]['length']?_0xf0d278['attributes']:_0x448dd9[_0x2fd4('0x2f')];if(!_0x2365bb[_0x2fd4('0x31')][_0x2fd4('0x35')](_0x2fd4('0x36'))){_0xf0d278[_0x2fd4('0x1c')]=qs[_0x2fd4('0x1c')](_0x2365bb['query'][_0x2fd4('0x1c')]);_0xf0d278[_0x2fd4('0x1b')]=qs['offset'](_0x2365bb[_0x2fd4('0x31')]['offset']);}_0xf0d278['order']=qs['sort'](_0x2365bb[_0x2fd4('0x31')]['sort']);_0xf0d278[_0x2fd4('0x37')]=qs['filters'](_['pick'](_0x2365bb['query'],_0x448dd9[_0x2fd4('0x38')]),_0x4ae485);if(_0x2365bb[_0x2fd4('0x31')]['filter']){_0xf0d278['where']=_['merge'](_0xf0d278[_0x2fd4('0x37')],{'$or':_['map'](_0x4ae485,function(_0x168e53){if(_0x168e53[_0x2fd4('0x39')]!==_0x2fd4('0x3a')){var _0x33593c={};_0x33593c[_0x168e53['name']]={'$like':'%'+_0x2365bb[_0x2fd4('0x31')][_0x2fd4('0x3b')]+'%'};return _0x33593c;}})});}_0xf0d278=_[_0x2fd4('0x3c')]({},_0xf0d278,_0x2365bb['options']);var _0x193fd4={'where':_0xf0d278[_0x2fd4('0x37')]};return db['Attachment'][_0x2fd4('0x1a')](_0x193fd4)[_0x2fd4('0x23')](function(_0x147333){_0xfda747['count']=_0x147333;if(_0x2365bb[_0x2fd4('0x31')]['includeAll']){_0xf0d278[_0x2fd4('0x3d')]=[{'all':!![]}];}return db[_0x2fd4('0x2b')][_0x2fd4('0x3e')](_0xf0d278);})[_0x2fd4('0x23')](function(_0x440bee){_0xfda747[_0x2fd4('0x3f')]=_0x440bee;return _0xfda747;})[_0x2fd4('0x23')](respondWithFilteredResult(_0xb2c070,_0xf0d278))[_0x2fd4('0x40')](handleError(_0xb2c070,null));};exports[_0x2fd4('0x41')]=function(_0x3b8f1e,_0xbdb8b9){var _0x72f26a={'raw':!![],'where':{'id':_0x3b8f1e['params']['id']}},_0x1127cc={};_0x1127cc[_0x2fd4('0x2f')]=_[_0x2fd4('0x30')](db[_0x2fd4('0x2b')][_0x2fd4('0x2c')]);_0x1127cc[_0x2fd4('0x31')]=_[_0x2fd4('0x30')](_0x3b8f1e[_0x2fd4('0x31')]);_0x1127cc[_0x2fd4('0x38')]=_[_0x2fd4('0x32')](_0x1127cc[_0x2fd4('0x2f')],_0x1127cc[_0x2fd4('0x31')]);_0x72f26a[_0x2fd4('0x34')]=_[_0x2fd4('0x32')](_0x1127cc[_0x2fd4('0x2f')],qs[_0x2fd4('0x33')](_0x3b8f1e[_0x2fd4('0x31')][_0x2fd4('0x33')]));_0x72f26a[_0x2fd4('0x34')]=_0x72f26a['attributes']['length']?_0x72f26a[_0x2fd4('0x34')]:_0x1127cc[_0x2fd4('0x2f')];if(_0x3b8f1e[_0x2fd4('0x31')][_0x2fd4('0x42')]){_0x72f26a[_0x2fd4('0x3d')]=[{'all':!![]}];}_0x72f26a=_[_0x2fd4('0x3c')]({},_0x72f26a,_0x3b8f1e['options']);return db['Attachment']['find'](_0x72f26a)[_0x2fd4('0x23')](handleEntityNotFound(_0xbdb8b9,null))['then'](respondWithResult(_0xbdb8b9,null))[_0x2fd4('0x40')](handleError(_0xbdb8b9,null));};exports['clone']=function(_0x342058,_0x79730b){var _0x981731={'where':{'id':_0x342058[_0x2fd4('0x43')]['id']}},_0x3bdf2a={};_0x3bdf2a[_0x2fd4('0x2f')]=_['keys'](db['Attachment'][_0x2fd4('0x2c')]);_0x981731['attributes']=_[_0x2fd4('0x32')](_0x3bdf2a['model'],qs['fields'](_0x342058[_0x2fd4('0x31')]['fields']));_0x981731['attributes']=_0x981731[_0x2fd4('0x34')][_0x2fd4('0x44')]?_0x981731[_0x2fd4('0x34')]:_0x3bdf2a[_0x2fd4('0x2f')];if(_0x342058['query'][_0x2fd4('0x42')]){_0x981731[_0x2fd4('0x3d')]=[{'all':!![]}];}_0x981731=_[_0x2fd4('0x3c')]({},_0x981731,_0x342058[_0x2fd4('0x45')]);return db[_0x2fd4('0x2b')][_0x2fd4('0x46')](_0x981731)['then'](handleEntityNotFound(_0x79730b,null))['then'](function(_0x276a61){if(_0x276a61){var _0x5d1585=_0x276a61[_0x2fd4('0x47')]({'plain':!![]});_0x5d1585=qs[_0x2fd4('0x48')](_0x5d1585,['id',_0x2fd4('0x49'),'updatedAt']);_0x342058[_0x2fd4('0x4a')]=_[_0x2fd4('0x48')](_0x342058[_0x2fd4('0x4a')],['id',_0x2fd4('0x49'),_0x2fd4('0x4b')]);return db[_0x2fd4('0x2b')][_0x2fd4('0x4c')](_[_0x2fd4('0x3c')](_0x5d1585,_0x342058['body']),{'include':_0x342058['query'][_0x2fd4('0x42')]?[{'all':!![]}]:undefined});}})[_0x2fd4('0x23')](respondWithResult(_0x79730b,0xc9))[_0x2fd4('0x40')](handleError(_0x79730b,null));};exports[_0x2fd4('0x22')]=function(_0x3ac7be,_0x167bc8){if(_0x3ac7be[_0x2fd4('0x4a')]['id']){delete _0x3ac7be[_0x2fd4('0x4a')]['id'];}return db[_0x2fd4('0x2b')][_0x2fd4('0x46')]({'where':{'id':_0x3ac7be[_0x2fd4('0x43')]['id']}})[_0x2fd4('0x23')](handleEntityNotFound(_0x167bc8,null))[_0x2fd4('0x23')](saveUpdates(_0x3ac7be[_0x2fd4('0x4a')],null))[_0x2fd4('0x23')](respondWithResult(_0x167bc8,null))[_0x2fd4('0x40')](handleError(_0x167bc8,null));};exports[_0x2fd4('0x24')]=function(_0x38ca1b,_0x18002f){return db[_0x2fd4('0x2b')][_0x2fd4('0x46')]({'where':{'id':_0x38ca1b[_0x2fd4('0x43')]['id']}})[_0x2fd4('0x23')](handleEntityNotFound(_0x18002f,null))[_0x2fd4('0x23')](removeEntity(_0x18002f,null))[_0x2fd4('0x40')](handleError(_0x18002f,null));};exports[_0x2fd4('0x4c')]=function(_0xc8083a,_0x3d4103,_0x44e425){_0xc8083a[_0x2fd4('0x4a')][_0x2fd4('0x27')]=_0xc8083a['file'][_0x2fd4('0x4d')];_0xc8083a['body'][_0x2fd4('0x4e')]=_0xc8083a[_0x2fd4('0x4f')][_0x2fd4('0x50')];_0xc8083a[_0x2fd4('0x4a')][_0x2fd4('0x39')]=_0xc8083a['file']['mimetype'];return db[_0x2fd4('0x2b')]['create'](_0xc8083a['body'])[_0x2fd4('0x23')](respondWithResult(_0x3d4103,0xc9))[_0x2fd4('0x40')](handleError(_0x3d4103,null));};exports[_0x2fd4('0x51')]=function(_0xcafc00,_0x5808c1,_0x36386f){return db[_0x2fd4('0x2b')][_0x2fd4('0x52')]({'where':{'id':_0xcafc00[_0x2fd4('0x43')]['id']},'raw':!![]})['then'](handleEntityNotFound(_0x5808c1,null))['then'](function(_0x55584b){if(_0x55584b){return _0x5808c1[_0x2fd4('0x51')](path[_0x2fd4('0x53')](config[_0x2fd4('0x54')],'server/files/attachments/',_0x55584b[_0x2fd4('0x4e')]));}})[_0x2fd4('0x40')](handleError(_0x5808c1,null));}; \ No newline at end of file diff --git a/server/api/attachment/attachment.model.js b/server/api/attachment/attachment.model.js index 6da6f60..4f44ad7 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 _0xd64b=['define','Attachment','attachments','lodash','../../config/logger','moment','bluebird','request-promise','path','rimraf'];(function(_0x49c1b0,_0x35b033){var _0x5be831=function(_0x1ae2a4){while(--_0x1ae2a4){_0x49c1b0['push'](_0x49c1b0['shift']());}};_0x5be831(++_0x35b033);}(_0xd64b,0xc1));var _0xbd64=function(_0x14ec54,_0x2d5098){_0x14ec54=_0x14ec54-0x0;var _0x2f8c0e=_0xd64b[_0x14ec54];return _0x2f8c0e;};'use strict';var _=require(_0xbd64('0x0'));var util=require('util');var logger=require(_0xbd64('0x1'))('api');var moment=require(_0xbd64('0x2'));var BPromise=require(_0xbd64('0x3'));var rp=require(_0xbd64('0x4'));var fs=require('fs');var path=require(_0xbd64('0x5'));var rimraf=require(_0xbd64('0x6'));var config=require('../../config/environment');var attributes=require('./attachment.attributes');module['exports']=function(_0x51e87d,_0x58e9e7){return _0x51e87d[_0xbd64('0x7')](_0xbd64('0x8'),attributes,{'tableName':_0xbd64('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2f68=['Attachment','util','../../config/logger','api','moment','request-promise','rimraf','../../config/environment','exports'];(function(_0x5c7a85,_0x41dd19){var _0x35290f=function(_0x26215b){while(--_0x26215b){_0x5c7a85['push'](_0x5c7a85['shift']());}};_0x35290f(++_0x41dd19);}(_0x2f68,0x9a));var _0x82f6=function(_0x2c6758,_0x4ffd7a){_0x2c6758=_0x2c6758-0x0;var _0x1c291d=_0x2f68[_0x2c6758];return _0x1c291d;};'use strict';var _=require('lodash');var util=require(_0x82f6('0x0'));var logger=require(_0x82f6('0x1'))(_0x82f6('0x2'));var moment=require(_0x82f6('0x3'));var BPromise=require('bluebird');var rp=require(_0x82f6('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x82f6('0x5'));var config=require(_0x82f6('0x6'));var attributes=require('./attachment.attributes');module[_0x82f6('0x7')]=function(_0x2c4302,_0x542737){return _0x2c4302['define'](_0x82f6('0x8'),attributes,{'tableName':'attachments','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/attachment/attachment.rpc.js b/server/api/attachment/attachment.rpc.js index 808a05e..9fb4b6d 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 _0xb00a=['../../config/utils','../../config/logger','rpc','../../config/environment','http','request','then','info','request\x20sent','debug','Attachment,\x20%s,\x20%s,\x20%s','stringify','error','code','message','Attachment,\x20%s,\x20%s','result','CreateAttachment','Attachment','create','body','options','raw','catch','lodash','util','randomstring','ioredis','../../mysqldb'];(function(_0x465aa1,_0x1e79be){var _0xca3479=function(_0xdd37d3){while(--_0xdd37d3){_0x465aa1['push'](_0x465aa1['shift']());}};_0xca3479(++_0x1e79be);}(_0xb00a,0x13a));var _0xab00=function(_0x1cd202,_0x2fc412){_0x1cd202=_0x1cd202-0x0;var _0xfc0785=_0xb00a[_0x1cd202];return _0xfc0785;};'use strict';var _=require(_0xab00('0x0'));var util=require(_0xab00('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xab00('0x2'));var fs=require('fs');var Redis=require(_0xab00('0x3'));var db=require(_0xab00('0x4'))['db'];var utils=require(_0xab00('0x5'));var logger=require(_0xab00('0x6'))(_0xab00('0x7'));var config=require(_0xab00('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0xab00('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x229e14,_0x3821ad,_0x2a151d){return new BPromise(function(_0x3aefc0,_0x343a9a){return client[_0xab00('0xa')](_0x229e14,_0x2a151d)[_0xab00('0xb')](function(_0x36087a){logger[_0xab00('0xc')]('Attachment,\x20%s,\x20%s',_0x3821ad,_0xab00('0xd'));logger[_0xab00('0xe')](_0xab00('0xf'),_0x3821ad,_0xab00('0xd'),JSON[_0xab00('0x10')](_0x36087a));if(_0x36087a[_0xab00('0x11')]){if(_0x36087a[_0xab00('0x11')][_0xab00('0x12')]===0x1f4){logger[_0xab00('0x11')]('Attachment,\x20%s,\x20%s',_0x3821ad,_0x36087a[_0xab00('0x11')]['message']);return _0x343a9a(_0x36087a['error'][_0xab00('0x13')]);}logger['error'](_0xab00('0x14'),_0x3821ad,_0x36087a[_0xab00('0x11')][_0xab00('0x13')]);return _0x3aefc0(_0x36087a[_0xab00('0x11')][_0xab00('0x13')]);}else{logger['info'](_0xab00('0x14'),_0x3821ad,_0xab00('0xd'));_0x3aefc0(_0x36087a[_0xab00('0x15')][_0xab00('0x13')]);}})['catch'](function(_0x4b55f0){logger['error']('Attachment,\x20%s,\x20%s',_0x3821ad,_0x4b55f0);_0x343a9a(_0x4b55f0);});});}exports[_0xab00('0x16')]=function(_0x194287){var _0x26b987=this;return new Promise(function(_0x361e9c,_0x5c2797){return db[_0xab00('0x17')][_0xab00('0x18')](_0x194287[_0xab00('0x19')],{'raw':_0x194287[_0xab00('0x1a')]?_0x194287[_0xab00('0x1a')][_0xab00('0x1b')]===undefined?!![]:![]:!![]})['then'](function(_0x512811){logger[_0xab00('0xc')](_0xab00('0x16'),_0x194287);logger[_0xab00('0xe')](_0xab00('0x16'),_0x194287,JSON[_0xab00('0x10')](_0x512811));_0x361e9c(_0x512811);})[_0xab00('0x1c')](function(_0x4f8dc4){logger[_0xab00('0x11')](_0xab00('0x16'),_0x4f8dc4[_0xab00('0x13')],_0x194287);_0x5c2797(_0x26b987[_0xab00('0x11')](0x1f4,_0x4f8dc4[_0xab00('0x13')]));});});}; \ No newline at end of file +var _0xe1e7=['body','options','raw','CreateAttachment','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','jayson/promise','client','http','request','then','Attachment,\x20%s,\x20%s','request\x20sent','debug','Attachment,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','Attachment','create'];(function(_0x3948aa,_0x254cf8){var _0x45ccae=function(_0x3855a9){while(--_0x3855a9){_0x3948aa['push'](_0x3948aa['shift']());}};_0x45ccae(++_0x254cf8);}(_0xe1e7,0x143));var _0x7e1e=function(_0x13cba8,_0x4e7fae){_0x13cba8=_0x13cba8-0x0;var _0x1d53b2=_0xe1e7[_0x13cba8];return _0x1d53b2;};'use strict';var _=require(_0x7e1e('0x0'));var util=require('util');var moment=require(_0x7e1e('0x1'));var BPromise=require(_0x7e1e('0x2'));var rs=require(_0x7e1e('0x3'));var fs=require('fs');var Redis=require(_0x7e1e('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x7e1e('0x5'));var logger=require(_0x7e1e('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0x7e1e('0x7'));var client=jayson[_0x7e1e('0x8')][_0x7e1e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x39c4f5,_0x1e1d58,_0x4828f7){return new BPromise(function(_0x1bbc7f,_0xbe7b62){return client[_0x7e1e('0xa')](_0x39c4f5,_0x4828f7)[_0x7e1e('0xb')](function(_0x532324){logger['info'](_0x7e1e('0xc'),_0x1e1d58,_0x7e1e('0xd'));logger[_0x7e1e('0xe')](_0x7e1e('0xf'),_0x1e1d58,_0x7e1e('0xd'),JSON[_0x7e1e('0x10')](_0x532324));if(_0x532324[_0x7e1e('0x11')]){if(_0x532324['error'][_0x7e1e('0x12')]===0x1f4){logger[_0x7e1e('0x11')](_0x7e1e('0xc'),_0x1e1d58,_0x532324[_0x7e1e('0x11')][_0x7e1e('0x13')]);return _0xbe7b62(_0x532324['error'][_0x7e1e('0x13')]);}logger[_0x7e1e('0x11')](_0x7e1e('0xc'),_0x1e1d58,_0x532324['error'][_0x7e1e('0x13')]);return _0x1bbc7f(_0x532324[_0x7e1e('0x11')][_0x7e1e('0x13')]);}else{logger[_0x7e1e('0x14')](_0x7e1e('0xc'),_0x1e1d58,_0x7e1e('0xd'));_0x1bbc7f(_0x532324[_0x7e1e('0x15')][_0x7e1e('0x13')]);}})[_0x7e1e('0x16')](function(_0x1393df){logger['error'](_0x7e1e('0xc'),_0x1e1d58,_0x1393df);_0xbe7b62(_0x1393df);});});}exports['CreateAttachment']=function(_0x3c6713){var _0x2806b1=this;return new Promise(function(_0x2aab71,_0x534487){return db[_0x7e1e('0x17')][_0x7e1e('0x18')](_0x3c6713[_0x7e1e('0x19')],{'raw':_0x3c6713[_0x7e1e('0x1a')]?_0x3c6713[_0x7e1e('0x1a')][_0x7e1e('0x1b')]===undefined?!![]:![]:!![]})[_0x7e1e('0xb')](function(_0x48c182){logger[_0x7e1e('0x14')](_0x7e1e('0x1c'),_0x3c6713);logger[_0x7e1e('0xe')](_0x7e1e('0x1c'),_0x3c6713,JSON[_0x7e1e('0x10')](_0x48c182));_0x2aab71(_0x48c182);})[_0x7e1e('0x16')](function(_0x3d6e3e){logger[_0x7e1e('0x11')](_0x7e1e('0x1c'),_0x3d6e3e[_0x7e1e('0x13')],_0x3c6713);_0x534487(_0x2806b1[_0x7e1e('0x11')](0x1f4,_0x3d6e3e[_0x7e1e('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/attachment/index.js b/server/api/attachment/index.js index ab70c51..3945910 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 _0x566f=['clone','join','root','server/files/attachments/','format','%s-%s','now','originalname','create','put','update','destroy','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./attachment.controller','get','isAuthenticated','index','/:id','show','post','/:id/clone'];(function(_0x1d282d,_0x5d6b25){var _0x38d44d=function(_0x32cc08){while(--_0x32cc08){_0x1d282d['push'](_0x1d282d['shift']());}};_0x38d44d(++_0x5d6b25);}(_0x566f,0x124));var _0xf566=function(_0x50918c,_0x29c59c){_0x50918c=_0x50918c-0x0;var _0x408429=_0x566f[_0x50918c];return _0x408429;};'use strict';var multer=require(_0xf566('0x0'));var util=require(_0xf566('0x1'));var path=require(_0xf566('0x2'));var timeout=require(_0xf566('0x3'));var express=require(_0xf566('0x4'));var router=express[_0xf566('0x5')]();var auth=require(_0xf566('0x6'));var interaction=require(_0xf566('0x7'));var config=require('../../config/environment');var controller=require(_0xf566('0x8'));router[_0xf566('0x9')]('/',auth[_0xf566('0xa')](),controller[_0xf566('0xb')]);router['get'](_0xf566('0xc'),auth[_0xf566('0xa')](),controller[_0xf566('0xd')]);router[_0xf566('0x9')]('/:id/download',auth[_0xf566('0xa')](),controller['download']);router[_0xf566('0xe')](_0xf566('0xf'),auth[_0xf566('0xa')](),controller[_0xf566('0x10')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x26ab55,_0x45e1e6,_0x43ab5e){_0x43ab5e(null,path[_0xf566('0x11')](config[_0xf566('0x12')],_0xf566('0x13')));},'filename':function(_0x4aec5b,_0x3f15a6,_0x5d6937){_0x5d6937(null,util[_0xf566('0x14')](_0xf566('0x15'),Date[_0xf566('0x16')](),_0x3f15a6[_0xf566('0x17')]['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0xf566('0xe')]('/',upload['single']('file'),controller[_0xf566('0x18')]);router[_0xf566('0x19')]('/:id',auth[_0xf566('0xa')](),controller[_0xf566('0x1a')]);router['delete'](_0xf566('0xc'),auth['isAuthenticated'](),controller[_0xf566('0x1b')]);module['exports']=router; \ No newline at end of file +var _0x2015=['connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./attachment.controller','get','isAuthenticated','index','/:id','show','/:id/download','download','post','clone','diskStorage','join','root','server/files/attachments/','format','%s-%s','now','originalname','single','put','destroy','multer','util','path'];(function(_0x14fff8,_0x1c9f11){var _0x3a959b=function(_0x4e92b9){while(--_0x4e92b9){_0x14fff8['push'](_0x14fff8['shift']());}};_0x3a959b(++_0x1c9f11);}(_0x2015,0x193));var _0x5201=function(_0x4ad513,_0x487bc7){_0x4ad513=_0x4ad513-0x0;var _0x8a9d6e=_0x2015[_0x4ad513];return _0x8a9d6e;};'use strict';var multer=require(_0x5201('0x0'));var util=require(_0x5201('0x1'));var path=require(_0x5201('0x2'));var timeout=require(_0x5201('0x3'));var express=require(_0x5201('0x4'));var router=express[_0x5201('0x5')]();var auth=require(_0x5201('0x6'));var interaction=require(_0x5201('0x7'));var config=require('../../config/environment');var controller=require(_0x5201('0x8'));router[_0x5201('0x9')]('/',auth[_0x5201('0xa')](),controller[_0x5201('0xb')]);router[_0x5201('0x9')](_0x5201('0xc'),auth[_0x5201('0xa')](),controller[_0x5201('0xd')]);router[_0x5201('0x9')](_0x5201('0xe'),auth['isAuthenticated'](),controller[_0x5201('0xf')]);router[_0x5201('0x10')]('/:id/clone',auth[_0x5201('0xa')](),controller[_0x5201('0x11')]);var upload=multer({'storage':multer[_0x5201('0x12')]({'destination':function(_0x47aa66,_0x129e16,_0x29c68f){_0x29c68f(null,path[_0x5201('0x13')](config[_0x5201('0x14')],_0x5201('0x15')));},'filename':function(_0x26677a,_0x2038a9,_0x677cd5){_0x677cd5(null,util[_0x5201('0x16')](_0x5201('0x17'),Date[_0x5201('0x18')](),_0x2038a9[_0x5201('0x19')]['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0x5201('0x10')]('/',upload[_0x5201('0x1a')]('file'),controller['create']);router[_0x5201('0x1b')](_0x5201('0xc'),auth[_0x5201('0xa')](),controller['update']);router['delete'](_0x5201('0xc'),auth['isAuthenticated'](),controller[_0x5201('0x1c')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/authGoogle/authGoogle.controller.js b/server/api/authGoogle/authGoogle.controller.js index f3390db..cf04dff 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 _0x8804=['../../config/utils','login','authenticate','google','/login','email','use','clientSecret','callbackURL','Setting','findOne','allowedLoginAttempts','blockDuration','User','map','emails','value','admin','user','disabled','blocked','blockedAt','add','minutes','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','clearBlockUser','then','getLicense','catch','lodash','Strategy','moment','../../config/environment','../../components/auth/service','signToken'];(function(_0x7bbac7,_0x1541b3){var _0x1b4766=function(_0x44d780){while(--_0x44d780){_0x7bbac7['push'](_0x7bbac7['shift']());}};_0x1b4766(++_0x1541b3);}(_0x8804,0x19e));var _0x4880=function(_0x13f2e2,_0x525f93){_0x13f2e2=_0x13f2e2-0x0;var _0x16cb16=_0x8804[_0x13f2e2];return _0x16cb16;};'use strict';var _=require(_0x4880('0x0'));var passport=require('passport');var GoogleStrategy=require('passport-google-oauth20')[_0x4880('0x1')];var moment=require(_0x4880('0x2'));var db=require('../../mysqldb')['db'];var config=require(_0x4880('0x3'));var signToken=require(_0x4880('0x4'))[_0x4880('0x5')];var utils=require(_0x4880('0x6'));exports[_0x4880('0x7')]=passport[_0x4880('0x8')](_0x4880('0x9'),{'failureRedirect':_0x4880('0xa'),'scope':['profile',_0x4880('0xb')],'session':![]});exports['callback']=passport[_0x4880('0x8')]('google',{'failureRedirect':_0x4880('0xa'),'session':![]});passport[_0x4880('0xc')](new GoogleStrategy({'clientID':config[_0x4880('0x9')]?config[_0x4880('0x9')]['clientID']:'id','clientSecret':config[_0x4880('0x9')]?config['google'][_0x4880('0xd')]:'secret','callbackURL':config[_0x4880('0x9')]?config[_0x4880('0x9')][_0x4880('0xe')]:''},function(_0x55a429,_0x20b21c,_0x2f8fbf,_0x3913d9){var _0x43d4fb,_0x1a5f93;return db[_0x4880('0xf')][_0x4880('0x10')]({'where':{'id':0x1},'attributes':[_0x4880('0x11'),_0x4880('0x12')],'raw':!![]})['then'](function(_0x5ed09f){_0x43d4fb=_0x5ed09f;return db[_0x4880('0x13')]['find']({'where':{'email':_[_0x4880('0x14')](_0x2f8fbf[_0x4880('0x15')],_0x4880('0x16')),'role':{'$or':[_0x4880('0x17'),_0x4880('0x18'),'agent']}}});})['then'](function(_0x56226e){_0x1a5f93=_0x56226e;if(_0x1a5f93){if(_0x1a5f93[_0x4880('0x19')]){return _0x3913d9('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}else if(_0x43d4fb['blockDuration']>0x0){if(_0x1a5f93[_0x4880('0x1a')]){if(moment(_0x1a5f93[_0x4880('0x1b')])[_0x4880('0x1c')](_0x43d4fb[_0x4880('0x12')],_0x4880('0x1d'))>moment()){return _0x3913d9(_0x4880('0x1e'));}else{return utils[_0x4880('0x1f')](_0x1a5f93,0x0,![],null)[_0x4880('0x20')](function(){return utils[_0x4880('0x21')](_0x1a5f93);})['then'](function(){return _0x3913d9(null,_0x1a5f93);});}}else{return utils[_0x4880('0x21')](_0x1a5f93)[_0x4880('0x20')](function(){return _0x3913d9(null,_0x1a5f93);});}}else{return utils[_0x4880('0x21')](_0x1a5f93)[_0x4880('0x20')](function(){return _0x3913d9(null,_0x1a5f93);});}}return _0x3913d9('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');})[_0x4880('0x22')](function(_0x2feb0e){_0x3913d9(_0x2feb0e);});})); \ No newline at end of file +var _0x95c3=['value','admin','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','blocked','blockedAt','add','minutes','clearBlockUser','getLicense','lodash','Strategy','../../mysqldb','signToken','../../config/utils','login','authenticate','google','/login','email','use','clientID','secret','findOne','allowedLoginAttempts','blockDuration','then','User','emails'];(function(_0x512490,_0x474d3d){var _0x4cf8e4=function(_0x2880b4){while(--_0x2880b4){_0x512490['push'](_0x512490['shift']());}};_0x4cf8e4(++_0x474d3d);}(_0x95c3,0x1ad));var _0x395c=function(_0x1d1d09,_0x504d77){_0x1d1d09=_0x1d1d09-0x0;var _0x8827e=_0x95c3[_0x1d1d09];return _0x8827e;};'use strict';var _=require(_0x395c('0x0'));var passport=require('passport');var GoogleStrategy=require('passport-google-oauth20')[_0x395c('0x1')];var moment=require('moment');var db=require(_0x395c('0x2'))['db'];var config=require('../../config/environment');var signToken=require('../../components/auth/service')[_0x395c('0x3')];var utils=require(_0x395c('0x4'));exports[_0x395c('0x5')]=passport[_0x395c('0x6')](_0x395c('0x7'),{'failureRedirect':_0x395c('0x8'),'scope':['profile',_0x395c('0x9')],'session':![]});exports['callback']=passport['authenticate'](_0x395c('0x7'),{'failureRedirect':_0x395c('0x8'),'session':![]});passport[_0x395c('0xa')](new GoogleStrategy({'clientID':config[_0x395c('0x7')]?config[_0x395c('0x7')][_0x395c('0xb')]:'id','clientSecret':config['google']?config[_0x395c('0x7')]['clientSecret']:_0x395c('0xc'),'callbackURL':config[_0x395c('0x7')]?config[_0x395c('0x7')]['callbackURL']:''},function(_0xa94b4,_0xe9a3fa,_0x39c8aa,_0x26df26){var _0x50d0e0,_0x347664;return db['Setting'][_0x395c('0xd')]({'where':{'id':0x1},'attributes':[_0x395c('0xe'),_0x395c('0xf')],'raw':!![]})[_0x395c('0x10')](function(_0x19f2d4){_0x50d0e0=_0x19f2d4;return db[_0x395c('0x11')]['find']({'where':{'email':_['map'](_0x39c8aa[_0x395c('0x12')],_0x395c('0x13')),'role':{'$or':[_0x395c('0x14'),'user','agent']}}});})[_0x395c('0x10')](function(_0x45a9ee){_0x347664=_0x45a9ee;if(_0x347664){if(_0x347664['disabled']){return _0x26df26(_0x395c('0x15'));}else if(_0x50d0e0[_0x395c('0xf')]>0x0){if(_0x347664[_0x395c('0x16')]){if(moment(_0x347664[_0x395c('0x17')])[_0x395c('0x18')](_0x50d0e0[_0x395c('0xf')],_0x395c('0x19'))>moment()){return _0x26df26('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}else{return utils[_0x395c('0x1a')](_0x347664,0x0,![],null)['then'](function(){return utils[_0x395c('0x1b')](_0x347664);})[_0x395c('0x10')](function(){return _0x26df26(null,_0x347664);});}}else{return utils[_0x395c('0x1b')](_0x347664)[_0x395c('0x10')](function(){return _0x26df26(null,_0x347664);});}}else{return utils[_0x395c('0x1b')](_0x347664)[_0x395c('0x10')](function(){return _0x26df26(null,_0x347664);});}}return _0x26df26(_0x395c('0x15'));})['catch'](function(_0x553cd4){_0x26df26(_0x553cd4);});})); \ No newline at end of file diff --git a/server/api/authGoogle/index.js b/server/api/authGoogle/index.js index 9d0ff6a..5e84a5a 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 _0x9086=['../user/user.controller.js','../../components/auth/service','get','login','callback','setTokenCookie','express','passport','./authGoogle.controller'];(function(_0x1f4437,_0x5361ff){var _0x2c0908=function(_0xbb1493){while(--_0xbb1493){_0x1f4437['push'](_0x1f4437['shift']());}};_0x2c0908(++_0x5361ff);}(_0x9086,0x10b));var _0x6908=function(_0x5f0bf8,_0x312a15){_0x5f0bf8=_0x5f0bf8-0x0;var _0x4bb7cd=_0x9086[_0x5f0bf8];return _0x4bb7cd;};'use strict';var express=require(_0x6908('0x0'));var passport=require(_0x6908('0x1'));var router=express['Router']();var controller=require(_0x6908('0x2'));var userController=require(_0x6908('0x3'));var authService=require(_0x6908('0x4'));router[_0x6908('0x5')]('/',controller[_0x6908('0x6')]);router[_0x6908('0x5')]('/callback',controller[_0x6908('0x7')],authService['isMiddleware'],userController['login'],authService[_0x6908('0x8')]);module['exports']=router; \ No newline at end of file +var _0xf197=['express','passport','Router','../../components/auth/service','/callback','login','setTokenCookie','exports'];(function(_0x5da321,_0x3b90e1){var _0x58d8e5=function(_0x361f58){while(--_0x361f58){_0x5da321['push'](_0x5da321['shift']());}};_0x58d8e5(++_0x3b90e1);}(_0xf197,0x130));var _0x7f19=function(_0x1e45fa,_0x2ca4ff){_0x1e45fa=_0x1e45fa-0x0;var _0x454118=_0xf197[_0x1e45fa];return _0x454118;};'use strict';var express=require(_0x7f19('0x0'));var passport=require(_0x7f19('0x1'));var router=express[_0x7f19('0x2')]();var controller=require('./authGoogle.controller');var userController=require('../user/user.controller.js');var authService=require(_0x7f19('0x3'));router['get']('/',controller['login']);router['get'](_0x7f19('0x4'),controller['callback'],authService['isMiddleware'],userController[_0x7f19('0x5')],authService[_0x7f19('0x6')]);module[_0x7f19('0x7')]=router; \ No newline at end of file diff --git a/server/api/authLocal/authLocal.controller.js b/server/api/authLocal/authLocal.controller.js index f0a2d8a..20a0172 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 _0xcbd1=['Unable\x20to\x20find\x20a\x20configured\x20SMTP\x20service!','Smtp','service','host','port','secure','authentication','auth','pass','merge','format','\x22%s\x22\x20<%s>','request','SendMail','error','SendMail\x20error:\x20%s.\x20Please\x20contact\x20your\x20Administrator!','message','stringify','status','send','test','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','login','role','signToken','online','forgot','body','Email\x20parameter\x20is\x20missing','trim','toLowerCase','find','This\x20email\x20is\x20not\x20registered.','The\x20user\x20is\x20disabled.\x20Please\x20contact\x20the\x20administrator.','minutes','resetPasswordToken','resetPasswordExpires','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','Please\x20click\x20on\x20the\x20following\x20link,\x20or\x20paste\x20this\x20into\x20your\x20browser\x20to\x20complete\x20the\x20process:\x0a\x0a','headers','/reset/','If\x20you\x20did\x20not\x20request\x20this,\x20please\x20ignore\x20this\x20email\x20and\x20your\x20password\x20will\x20remain\x20unchanged.\x0a','reset','User','params','Password\x20reset\x20token\x20is\x20invalid\x20or\x20has\x20expired.','securePassword','Password\x20reset!','use','util','passport-local','Strategy','jayson/promise','lodash','randomstring','moment','../../mysqldb','../../components/auth/service','../../config/utils','client','Setting','findOne','allowedLoginAttempts','then','password','salt','blocked','blockedAt','loginAttempts','admin','user','agent','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','authenticate','disabled','blockDuration','clearBlockUser','add','getLicense','catch','MailAccount','name','email','MailServerOut'];(function(_0x3bdbd8,_0x2a4ca3){var _0x1fe356=function(_0x340333){while(--_0x340333){_0x3bdbd8['push'](_0x3bdbd8['shift']());}};_0x1fe356(++_0x2a4ca3);}(_0xcbd1,0x89));var _0x1cbd=function(_0x198143,_0x271c9f){_0x198143=_0x198143-0x0;var _0x5da1f7=_0xcbd1[_0x198143];return _0x5da1f7;};'use strict';var util=require(_0x1cbd('0x0'));var passport=require('passport');var LocalStrategy=require(_0x1cbd('0x1'))[_0x1cbd('0x2')];var jayson=require(_0x1cbd('0x3'));var _=require(_0x1cbd('0x4'));var rs=require(_0x1cbd('0x5'));var moment=require(_0x1cbd('0x6'));var db=require(_0x1cbd('0x7'))['db'];var authService=require(_0x1cbd('0x8'));var utils=require(_0x1cbd('0x9'));var client=jayson[_0x1cbd('0xa')]['http']({'port':0x232b});function localAuthenticate(_0x30661b,_0x3534be,_0x5d191e,_0xabbaa){var _0x98990d,_0x39b803;return db[_0x1cbd('0xb')][_0x1cbd('0xc')]({'where':{'id':0x1},'attributes':[_0x1cbd('0xd'),'blockDuration'],'raw':!![]})[_0x1cbd('0xe')](function(_0x2720ff){_0x98990d=_0x2720ff;return _0x30661b[_0x1cbd('0xc')]({'attributes':['id','name',_0x1cbd('0xf'),_0x1cbd('0x10'),'role','disabled',_0x1cbd('0x11'),_0x1cbd('0x12'),_0x1cbd('0x13')],'where':{'name':_0x3534be,'role':{'$or':[_0x1cbd('0x14'),_0x1cbd('0x15'),_0x1cbd('0x16')]}}});})[_0x1cbd('0xe')](function(_0x5cead7){if(!_0x5cead7||_0x5cead7&&_0x5cead7['name']!==_0x3534be){throw new Error(_0x1cbd('0x17'));}else{_0x39b803=_0x5cead7;return _0x39b803;}})[_0x1cbd('0xe')](function(){_0x39b803[_0x1cbd('0x18')](_0x5d191e,function(_0x4b2324,_0xf2a290){var _0x4dd091=_0x39b803['loginAttempts']+0x1;if(_0x4b2324){return _0xabbaa(_0x4b2324);}else if(!_0xf2a290){if(_0x39b803[_0x1cbd('0x19')]){return _0xabbaa(null,![],{'message':_0x1cbd('0x17')});}else if(_0x98990d[_0x1cbd('0xd')]>0x0){if(_0x39b803[_0x1cbd('0x11')]){if(_0x98990d[_0x1cbd('0x1a')]>0x0){if(moment(_0x39b803['blockedAt'])['add'](_0x98990d[_0x1cbd('0x1a')],'minutes')>moment()){return _0xabbaa(null,![],{'message':_0x1cbd('0x17')});}else{return utils['clearBlockUser'](_0x39b803,_0x4dd091,![],null)[_0x1cbd('0xe')](function(){return _0xabbaa(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});});}}else{return _0xabbaa(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}}else{if(_0x4dd091>=_0x98990d[_0x1cbd('0xd')]){return utils[_0x1cbd('0x1b')](_0x39b803,0x0,!![],moment())[_0x1cbd('0xe')](function(){return _0xabbaa(null,![],{'message':_0x1cbd('0x17')});});}else{return utils[_0x1cbd('0x1b')](_0x39b803,_0x4dd091,![],null)[_0x1cbd('0xe')](function(){return _0xabbaa(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});});}}}else{return _0xabbaa(null,![],{'message':_0x1cbd('0x17')});}}else{if(_0x39b803[_0x1cbd('0x19')]){return _0xabbaa(null,![],{'message':_0x1cbd('0x17')});}else if(_0x98990d[_0x1cbd('0xd')]>0x0){if(_0x39b803['blocked']){if(_0x98990d[_0x1cbd('0x1a')]>0x0){if(moment(_0x39b803[_0x1cbd('0x12')])[_0x1cbd('0x1c')](_0x98990d[_0x1cbd('0x1a')],'minutes')>moment()){return _0xabbaa(null,![],{'message':_0x1cbd('0x17')});}else{return utils[_0x1cbd('0x1b')](_0x39b803,0x0,![],null)[_0x1cbd('0xe')](function(){return utils[_0x1cbd('0x1d')](_0x39b803);})['then'](function(){return _0xabbaa(null,_0x39b803);});}}else{return _0xabbaa(null,![],{'message':_0x1cbd('0x17')});}}else{return utils[_0x1cbd('0x1b')](_0x39b803,0x0,![],null)[_0x1cbd('0xe')](function(){return utils[_0x1cbd('0x1d')](_0x39b803);})['then'](function(){return _0xabbaa(null,_0x39b803);})[_0x1cbd('0x1e')](function(_0xfb6c58){return _0xabbaa(null,![],_0xfb6c58);});}}else{if(_0x39b803['blocked']){return _0xabbaa(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}else{return utils[_0x1cbd('0x1d')](_0x39b803)[_0x1cbd('0xe')](function(){return _0xabbaa(null,_0x39b803);});}}}});})[_0x1cbd('0x1e')](function(_0x2eafe8){return _0xabbaa(null,![],_0x2eafe8);});}function sendServiceMail(_0x4477be){return db[_0x1cbd('0x1f')]['find']({'where':{'service':!![]},'attributes':['id',_0x1cbd('0x20'),_0x1cbd('0x21')],'include':[{'model':db[_0x1cbd('0x22')],'as':'Smtp'}]})[_0x1cbd('0xe')](function(_0x22ce2e){if(!_0x22ce2e){throw new Error(_0x1cbd('0x23'));}var _0x59f2da={'tls':{'rejectUnauthorized':![]}};if(_0x22ce2e[_0x1cbd('0x24')][_0x1cbd('0x25')]){_0x59f2da['service']=_0x22ce2e[_0x1cbd('0x24')][_0x1cbd('0x25')];}else{_0x59f2da[_0x1cbd('0x26')]=_0x22ce2e[_0x1cbd('0x24')]['host'];_0x59f2da[_0x1cbd('0x27')]=_0x22ce2e['Smtp'][_0x1cbd('0x27')];_0x59f2da[_0x1cbd('0x28')]=_0x22ce2e[_0x1cbd('0x24')][_0x1cbd('0x28')];}if(_0x22ce2e[_0x1cbd('0x24')][_0x1cbd('0x29')]){_0x59f2da[_0x1cbd('0x2a')]={'user':_0x22ce2e[_0x1cbd('0x24')][_0x1cbd('0x15')],'pass':_0x22ce2e[_0x1cbd('0x24')][_0x1cbd('0x2b')]};}var _0x234be4={'account':_0x59f2da,'message':_[_0x1cbd('0x2c')]({'from':util[_0x1cbd('0x2d')](_0x1cbd('0x2e'),_0x22ce2e['name'],_0x22ce2e[_0x1cbd('0x21')]||_0x22ce2e['Smtp'][_0x1cbd('0x15')])},_0x4477be)};return client[_0x1cbd('0x2f')](_0x1cbd('0x30'),_0x234be4);})[_0x1cbd('0xe')](function(_0x469cb6){if(_0x469cb6[_0x1cbd('0x31')]){throw new Error(util[_0x1cbd('0x2d')](_0x1cbd('0x32'),_0x469cb6[_0x1cbd('0x31')][_0x1cbd('0x33')]||JSON[_0x1cbd('0x34')](_0x469cb6[_0x1cbd('0x31')])));}return!![];});}function handleError(_0x50052c,_0x3fdccb,_0x468c9a){return _0x50052c[_0x1cbd('0x35')](_0x3fdccb||0x1f4)[_0x1cbd('0x36')]({'message':_0x468c9a?_0x468c9a['message']||_0x468c9a:''});}function checkPasswordPattern(_0x8d8cb0,_0x47cc0e,_0x3e2df0){if(_0x3e2df0){var _0x16bf0f=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x16bf0f[_0x1cbd('0x37')](_0x47cc0e)){return _0x8d8cb0;}else{throw new Error(_0x1cbd('0x38'));}}else{return _0x8d8cb0;}}exports[_0x1cbd('0x39')]=function(_0x424028,_0x3bc179,_0x5597a1){passport[_0x1cbd('0x18')]('local',function(_0x189576,_0x2196b9,_0x209f70){var _0x4c4770=_0x189576||_0x209f70;if(_0x4c4770){return handleError(_0x3bc179,0x191,_0x4c4770);}if(!_0x2196b9){return handleError(_0x3bc179,0x194,{'message':'Something\x20went\x20wrong,\x20please\x20try\x20again.'});}else{var _0x2fcfd={'payload':{'id':_0x2196b9['id'],'role':_0x2196b9[_0x1cbd('0x3a')]},'options':{'expiresIn':0x15180}};return authService[_0x1cbd('0x3b')](_0x2fcfd)[_0x1cbd('0xe')](function(_0x326f6a){_0x3bc179['json']({'id':_0x2196b9['id'],'token':_0x326f6a,'statusCall':'','isAlreadyLogged':_0x2196b9[_0x1cbd('0x3c')]});});}})(_0x424028,_0x3bc179,_0x5597a1);};exports[_0x1cbd('0x3d')]=function(_0x28d11e,_0x25dc2d,_0x1aacf9){if(!_0x28d11e[_0x1cbd('0x3e')][_0x1cbd('0x21')]){return handleError(_0x25dc2d,0x1f4,{'message':_0x1cbd('0x3f')});}var _0x5475e2=rs['generate']();_0x28d11e[_0x1cbd('0x3e')][_0x1cbd('0x21')]=_0x28d11e['body'][_0x1cbd('0x21')][_0x1cbd('0x40')]()[_0x1cbd('0x41')]();var _0x4656ff;return db[_0x1cbd('0xb')][_0x1cbd('0xc')]({'where':{'id':0x1},'attributes':[_0x1cbd('0xd'),_0x1cbd('0x1a')],'raw':!![]})[_0x1cbd('0xe')](function(_0x1c3f5a){_0x4656ff=_0x1c3f5a;return db['User'][_0x1cbd('0x42')]({'where':{'email':_0x28d11e[_0x1cbd('0x3e')]['email']}});})[_0x1cbd('0xe')](function(_0x37e8a5){if(!_0x37e8a5){throw new Error(_0x1cbd('0x43'));}if(_0x37e8a5['disabled']){throw new Error(_0x1cbd('0x44'));}if(_0x37e8a5[_0x1cbd('0x11')]){if(moment(_0x37e8a5[_0x1cbd('0x12')])[_0x1cbd('0x1c')](_0x4656ff[_0x1cbd('0x1a')],_0x1cbd('0x45'))>moment()){throw new Error('The\x20user\x20is\x20blocked.\x20Please\x20contact\x20the\x20administrator.');}else{_0x37e8a5['blocked']=![];_0x37e8a5[_0x1cbd('0x12')]=null;}}_0x37e8a5[_0x1cbd('0x46')]=_0x5475e2;_0x37e8a5[_0x1cbd('0x47')]=Date['now']()+0x36ee80;return _0x37e8a5[_0x1cbd('0x48')]();})['then'](function(){return sendServiceMail({'to':_0x28d11e['body'][_0x1cbd('0x21')],'subject':_0x1cbd('0x49'),'text':_0x1cbd('0x4a')+_0x1cbd('0x4b')+'http://'+_0x28d11e[_0x1cbd('0x4c')][_0x1cbd('0x26')]+_0x1cbd('0x4d')+_0x5475e2+'\x0a\x0a'+_0x1cbd('0x4e')});})['then'](function(){_0x25dc2d['status'](0xc8)[_0x1cbd('0x36')]({'message':'Reset\x20Email\x20sent!'});})[_0x1cbd('0x1e')](function(_0x971829){return handleError(_0x25dc2d,0x1f4,_0x971829);});};exports[_0x1cbd('0x4f')]=function(_0x59e41b,_0x21cf44,_0x201667){var _0x345a40;return db[_0x1cbd('0x50')]['find']({'where':{'resetPasswordToken':_0x59e41b[_0x1cbd('0x51')]['token'],'resetPasswordExpires':{'$gt':Date['now']()}}})[_0x1cbd('0xe')](function(_0x1b2abc){_0x345a40=_0x1b2abc;if(!_0x345a40){throw new Error(_0x1cbd('0x52'));}return db[_0x1cbd('0xb')][_0x1cbd('0xc')]({'attributes':['id',_0x1cbd('0x53')]});})['then'](function(_0x23efb4){return checkPasswordPattern(_0x23efb4,_0x59e41b[_0x1cbd('0x3e')][_0x1cbd('0xf')],_0x23efb4[_0x1cbd('0x53')]);})['then'](function(){_0x345a40[_0x1cbd('0xf')]=_0x59e41b['body'][_0x1cbd('0xf')];_0x345a40[_0x1cbd('0x46')]=null;_0x345a40[_0x1cbd('0x47')]=null;return _0x345a40['save']();})['then'](function(){_0x21cf44[_0x1cbd('0x35')](0xc8)['send']({'message':_0x1cbd('0x54')});})['catch'](function(_0x4afc71){return handleError(_0x21cf44,0x1f4,_0x4afc71);});};passport[_0x1cbd('0x55')](new LocalStrategy({'usernameField':_0x1cbd('0x20'),'passwordField':_0x1cbd('0xf')},function(_0x1db4fc,_0x2f6ec4,_0x54bed4){return localAuthenticate(db[_0x1cbd('0x50')],_0x1db4fc,_0x2f6ec4,_0x54bed4);})); \ No newline at end of file +var _0xae0e=['toLowerCase','User','This\x20email\x20is\x20not\x20registered.','The\x20user\x20is\x20disabled.\x20Please\x20contact\x20the\x20administrator.','The\x20user\x20is\x20blocked.\x20Please\x20contact\x20the\x20administrator.','resetPasswordToken','resetPasswordExpires','now','save','xCally\x20Motion\x20Password\x20Reset','headers','/reset/','If\x20you\x20did\x20not\x20request\x20this,\x20please\x20ignore\x20this\x20email\x20and\x20your\x20password\x20will\x20remain\x20unchanged.\x0a','catch','reset','find','params','Password\x20reset\x20token\x20is\x20invalid\x20or\x20has\x20expired.','Setting','securePassword','use','util','passport','passport-local','Strategy','jayson/promise','lodash','randomstring','moment','client','http','findOne','blockDuration','then','name','password','disabled','blocked','blockedAt','loginAttempts','admin','user','agent','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','authenticate','allowedLoginAttempts','clearBlockUser','add','minutes','getLicense','MailAccount','email','MailServerOut','Smtp','Unable\x20to\x20find\x20a\x20configured\x20SMTP\x20service!','service','host','port','secure','authentication','auth','pass','merge','format','\x22%s\x22\x20<%s>','error','SendMail\x20error:\x20%s.\x20Please\x20contact\x20your\x20Administrator!','message','stringify','status','send','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','login','local','Something\x20went\x20wrong,\x20please\x20try\x20again.','json','online','forgot','body','Email\x20parameter\x20is\x20missing','generate','trim'];(function(_0x5f40eb,_0x2c7cae){var _0x7bde29=function(_0xe0a808){while(--_0xe0a808){_0x5f40eb['push'](_0x5f40eb['shift']());}};_0x7bde29(++_0x2c7cae);}(_0xae0e,0xb9));var _0xeae0=function(_0x3b3aca,_0x5e03f8){_0x3b3aca=_0x3b3aca-0x0;var _0x12ad5c=_0xae0e[_0x3b3aca];return _0x12ad5c;};'use strict';var util=require(_0xeae0('0x0'));var passport=require(_0xeae0('0x1'));var LocalStrategy=require(_0xeae0('0x2'))[_0xeae0('0x3')];var jayson=require(_0xeae0('0x4'));var _=require(_0xeae0('0x5'));var rs=require(_0xeae0('0x6'));var moment=require(_0xeae0('0x7'));var db=require('../../mysqldb')['db'];var authService=require('../../components/auth/service');var utils=require('../../config/utils');var client=jayson[_0xeae0('0x8')][_0xeae0('0x9')]({'port':0x232b});function localAuthenticate(_0x22c3c0,_0x3ecfb9,_0x2d3151,_0x440f20){var _0x549f46,_0x3205f2;return db['Setting'][_0xeae0('0xa')]({'where':{'id':0x1},'attributes':['allowedLoginAttempts',_0xeae0('0xb')],'raw':!![]})[_0xeae0('0xc')](function(_0x554d4e){_0x549f46=_0x554d4e;return _0x22c3c0['findOne']({'attributes':['id',_0xeae0('0xd'),_0xeae0('0xe'),'salt','role',_0xeae0('0xf'),_0xeae0('0x10'),_0xeae0('0x11'),_0xeae0('0x12')],'where':{'name':_0x3ecfb9,'role':{'$or':[_0xeae0('0x13'),_0xeae0('0x14'),_0xeae0('0x15')]}}});})[_0xeae0('0xc')](function(_0x5bc752){if(!_0x5bc752||_0x5bc752&&_0x5bc752['name']!==_0x3ecfb9){throw new Error(_0xeae0('0x16'));}else{_0x3205f2=_0x5bc752;return _0x3205f2;}})[_0xeae0('0xc')](function(){_0x3205f2[_0xeae0('0x17')](_0x2d3151,function(_0x58c4b7,_0x10aa8b){var _0x5af7b3=_0x3205f2['loginAttempts']+0x1;if(_0x58c4b7){return _0x440f20(_0x58c4b7);}else if(!_0x10aa8b){if(_0x3205f2['disabled']){return _0x440f20(null,![],{'message':_0xeae0('0x16')});}else if(_0x549f46[_0xeae0('0x18')]>0x0){if(_0x3205f2[_0xeae0('0x10')]){if(_0x549f46[_0xeae0('0xb')]>0x0){if(moment(_0x3205f2[_0xeae0('0x11')])['add'](_0x549f46[_0xeae0('0xb')],'minutes')>moment()){return _0x440f20(null,![],{'message':_0xeae0('0x16')});}else{return utils[_0xeae0('0x19')](_0x3205f2,_0x5af7b3,![],null)[_0xeae0('0xc')](function(){return _0x440f20(null,![],{'message':_0xeae0('0x16')});});}}else{return _0x440f20(null,![],{'message':_0xeae0('0x16')});}}else{if(_0x5af7b3>=_0x549f46[_0xeae0('0x18')]){return utils[_0xeae0('0x19')](_0x3205f2,0x0,!![],moment())[_0xeae0('0xc')](function(){return _0x440f20(null,![],{'message':_0xeae0('0x16')});});}else{return utils[_0xeae0('0x19')](_0x3205f2,_0x5af7b3,![],null)[_0xeae0('0xc')](function(){return _0x440f20(null,![],{'message':_0xeae0('0x16')});});}}}else{return _0x440f20(null,![],{'message':_0xeae0('0x16')});}}else{if(_0x3205f2[_0xeae0('0xf')]){return _0x440f20(null,![],{'message':_0xeae0('0x16')});}else if(_0x549f46[_0xeae0('0x18')]>0x0){if(_0x3205f2[_0xeae0('0x10')]){if(_0x549f46['blockDuration']>0x0){if(moment(_0x3205f2[_0xeae0('0x11')])[_0xeae0('0x1a')](_0x549f46[_0xeae0('0xb')],_0xeae0('0x1b'))>moment()){return _0x440f20(null,![],{'message':_0xeae0('0x16')});}else{return utils['clearBlockUser'](_0x3205f2,0x0,![],null)[_0xeae0('0xc')](function(){return utils[_0xeae0('0x1c')](_0x3205f2);})[_0xeae0('0xc')](function(){return _0x440f20(null,_0x3205f2);});}}else{return _0x440f20(null,![],{'message':_0xeae0('0x16')});}}else{return utils[_0xeae0('0x19')](_0x3205f2,0x0,![],null)[_0xeae0('0xc')](function(){return utils[_0xeae0('0x1c')](_0x3205f2);})['then'](function(){return _0x440f20(null,_0x3205f2);})['catch'](function(_0x1b08ae){return _0x440f20(null,![],_0x1b08ae);});}}else{if(_0x3205f2[_0xeae0('0x10')]){return _0x440f20(null,![],{'message':_0xeae0('0x16')});}else{return utils[_0xeae0('0x1c')](_0x3205f2)[_0xeae0('0xc')](function(){return _0x440f20(null,_0x3205f2);});}}}});})['catch'](function(_0x3bdd7c){return _0x440f20(null,![],_0x3bdd7c);});}function sendServiceMail(_0x451f8e){return db[_0xeae0('0x1d')]['find']({'where':{'service':!![]},'attributes':['id',_0xeae0('0xd'),_0xeae0('0x1e')],'include':[{'model':db[_0xeae0('0x1f')],'as':_0xeae0('0x20')}]})['then'](function(_0x89253e){if(!_0x89253e){throw new Error(_0xeae0('0x21'));}var _0x8d5e18={'tls':{'rejectUnauthorized':![]}};if(_0x89253e[_0xeae0('0x20')][_0xeae0('0x22')]){_0x8d5e18['service']=_0x89253e[_0xeae0('0x20')]['service'];}else{_0x8d5e18[_0xeae0('0x23')]=_0x89253e[_0xeae0('0x20')][_0xeae0('0x23')];_0x8d5e18[_0xeae0('0x24')]=_0x89253e[_0xeae0('0x20')][_0xeae0('0x24')];_0x8d5e18[_0xeae0('0x25')]=_0x89253e[_0xeae0('0x20')]['secure'];}if(_0x89253e[_0xeae0('0x20')][_0xeae0('0x26')]){_0x8d5e18[_0xeae0('0x27')]={'user':_0x89253e[_0xeae0('0x20')][_0xeae0('0x14')],'pass':_0x89253e[_0xeae0('0x20')][_0xeae0('0x28')]};}var _0x149bcf={'account':_0x8d5e18,'message':_[_0xeae0('0x29')]({'from':util[_0xeae0('0x2a')](_0xeae0('0x2b'),_0x89253e[_0xeae0('0xd')],_0x89253e[_0xeae0('0x1e')]||_0x89253e['Smtp']['user'])},_0x451f8e)};return client['request']('SendMail',_0x149bcf);})[_0xeae0('0xc')](function(_0xe9ab7b){if(_0xe9ab7b[_0xeae0('0x2c')]){throw new Error(util['format'](_0xeae0('0x2d'),_0xe9ab7b[_0xeae0('0x2c')][_0xeae0('0x2e')]||JSON[_0xeae0('0x2f')](_0xe9ab7b[_0xeae0('0x2c')])));}return!![];});}function handleError(_0x55a918,_0x26da6e,_0x7ac56d){return _0x55a918[_0xeae0('0x30')](_0x26da6e||0x1f4)[_0xeae0('0x31')]({'message':_0x7ac56d?_0x7ac56d[_0xeae0('0x2e')]||_0x7ac56d:''});}function checkPasswordPattern(_0x4bd039,_0x2204f8,_0x2bccbd){if(_0x2bccbd){var _0x4d9423=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x4d9423['test'](_0x2204f8)){return _0x4bd039;}else{throw new Error(_0xeae0('0x32'));}}else{return _0x4bd039;}}exports[_0xeae0('0x33')]=function(_0x5b1b4c,_0x37a7e5,_0x57d61d){passport[_0xeae0('0x17')](_0xeae0('0x34'),function(_0x4ebfe2,_0x1907ce,_0x1e0d70){var _0x7f7925=_0x4ebfe2||_0x1e0d70;if(_0x7f7925){return handleError(_0x37a7e5,0x191,_0x7f7925);}if(!_0x1907ce){return handleError(_0x37a7e5,0x194,{'message':_0xeae0('0x35')});}else{var _0x5d41af={'payload':{'id':_0x1907ce['id'],'role':_0x1907ce['role']},'options':{'expiresIn':0x15180}};return authService['signToken'](_0x5d41af)[_0xeae0('0xc')](function(_0x20de90){_0x37a7e5[_0xeae0('0x36')]({'id':_0x1907ce['id'],'token':_0x20de90,'statusCall':'','isAlreadyLogged':_0x1907ce[_0xeae0('0x37')]});});}})(_0x5b1b4c,_0x37a7e5,_0x57d61d);};exports[_0xeae0('0x38')]=function(_0x36aa19,_0xe87db,_0xd2dd9f){if(!_0x36aa19[_0xeae0('0x39')][_0xeae0('0x1e')]){return handleError(_0xe87db,0x1f4,{'message':_0xeae0('0x3a')});}var _0xf23de9=rs[_0xeae0('0x3b')]();_0x36aa19[_0xeae0('0x39')][_0xeae0('0x1e')]=_0x36aa19[_0xeae0('0x39')][_0xeae0('0x1e')][_0xeae0('0x3c')]()[_0xeae0('0x3d')]();var _0x14f86c;return db['Setting'][_0xeae0('0xa')]({'where':{'id':0x1},'attributes':[_0xeae0('0x18'),_0xeae0('0xb')],'raw':!![]})[_0xeae0('0xc')](function(_0x2410ab){_0x14f86c=_0x2410ab;return db[_0xeae0('0x3e')]['find']({'where':{'email':_0x36aa19[_0xeae0('0x39')][_0xeae0('0x1e')]}});})[_0xeae0('0xc')](function(_0x58980d){if(!_0x58980d){throw new Error(_0xeae0('0x3f'));}if(_0x58980d[_0xeae0('0xf')]){throw new Error(_0xeae0('0x40'));}if(_0x58980d[_0xeae0('0x10')]){if(moment(_0x58980d['blockedAt'])[_0xeae0('0x1a')](_0x14f86c[_0xeae0('0xb')],_0xeae0('0x1b'))>moment()){throw new Error(_0xeae0('0x41'));}else{_0x58980d['blocked']=![];_0x58980d[_0xeae0('0x11')]=null;}}_0x58980d[_0xeae0('0x42')]=_0xf23de9;_0x58980d[_0xeae0('0x43')]=Date[_0xeae0('0x44')]()+0x36ee80;return _0x58980d[_0xeae0('0x45')]();})['then'](function(){return sendServiceMail({'to':_0x36aa19[_0xeae0('0x39')]['email'],'subject':_0xeae0('0x46'),'text':'You\x20are\x20receiving\x20this\x20because\x20you\x20(or\x20someone\x20else)\x20have\x20requested\x20the\x20reset\x20of\x20the\x20password\x20for\x20your\x20account.\x0a\x0a'+'Please\x20click\x20on\x20the\x20following\x20link,\x20or\x20paste\x20this\x20into\x20your\x20browser\x20to\x20complete\x20the\x20process:\x0a\x0a'+'http://'+_0x36aa19[_0xeae0('0x47')]['host']+_0xeae0('0x48')+_0xf23de9+'\x0a\x0a'+_0xeae0('0x49')});})[_0xeae0('0xc')](function(){_0xe87db['status'](0xc8)['send']({'message':'Reset\x20Email\x20sent!'});})[_0xeae0('0x4a')](function(_0x50fd6e){return handleError(_0xe87db,0x1f4,_0x50fd6e);});};exports[_0xeae0('0x4b')]=function(_0xa18fe1,_0x3f3a86,_0x15da32){var _0x817861;return db[_0xeae0('0x3e')][_0xeae0('0x4c')]({'where':{'resetPasswordToken':_0xa18fe1[_0xeae0('0x4d')]['token'],'resetPasswordExpires':{'$gt':Date[_0xeae0('0x44')]()}}})[_0xeae0('0xc')](function(_0x1aeeda){_0x817861=_0x1aeeda;if(!_0x817861){throw new Error(_0xeae0('0x4e'));}return db[_0xeae0('0x4f')]['findOne']({'attributes':['id',_0xeae0('0x50')]});})['then'](function(_0x129253){return checkPasswordPattern(_0x129253,_0xa18fe1[_0xeae0('0x39')][_0xeae0('0xe')],_0x129253[_0xeae0('0x50')]);})[_0xeae0('0xc')](function(){_0x817861[_0xeae0('0xe')]=_0xa18fe1[_0xeae0('0x39')]['password'];_0x817861[_0xeae0('0x42')]=null;_0x817861[_0xeae0('0x43')]=null;return _0x817861[_0xeae0('0x45')]();})[_0xeae0('0xc')](function(){_0x3f3a86[_0xeae0('0x30')](0xc8)[_0xeae0('0x31')]({'message':'Password\x20reset!'});})['catch'](function(_0x2061c2){return handleError(_0x3f3a86,0x1f4,_0x2061c2);});};passport[_0xeae0('0x51')](new LocalStrategy({'usernameField':_0xeae0('0xd'),'passwordField':_0xeae0('0xe')},function(_0x23c0c0,_0x4cd406,_0x12531a){return localAuthenticate(db[_0xeae0('0x3e')],_0x23c0c0,_0x4cd406,_0x12531a);})); \ No newline at end of file diff --git a/server/api/authLocal/index.js b/server/api/authLocal/index.js index 2c15e99..3c7ef71 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 _0x2e71=['post','/forgot','/reset/:token','exports','express','Router'];(function(_0x3855f4,_0x16073b){var _0x3d4e63=function(_0x2dd743){while(--_0x2dd743){_0x3855f4['push'](_0x3855f4['shift']());}};_0x3d4e63(++_0x16073b);}(_0x2e71,0x18a));var _0x12e7=function(_0x55abd9,_0x1148af){_0x55abd9=_0x55abd9-0x0;var _0x3e5669=_0x2e71[_0x55abd9];return _0x3e5669;};'use strict';var express=require(_0x12e7('0x0'));var router=express[_0x12e7('0x1')]();var controller=require('./authLocal.controller');router[_0x12e7('0x2')]('/',controller['login']);router[_0x12e7('0x2')](_0x12e7('0x3'),controller['forgot']);router['post'](_0x12e7('0x4'),controller['reset']);module[_0x12e7('0x5')]=router; \ No newline at end of file +var _0xd604=['express','post','/forgot','forgot','reset','exports'];(function(_0x1bf809,_0x536f55){var _0x1caa4e=function(_0x9f9636){while(--_0x9f9636){_0x1bf809['push'](_0x1bf809['shift']());}};_0x1caa4e(++_0x536f55);}(_0xd604,0x10e));var _0x4d60=function(_0x5ef8dd,_0x455be5){_0x5ef8dd=_0x5ef8dd-0x0;var _0x59d3ab=_0xd604[_0x5ef8dd];return _0x59d3ab;};'use strict';var express=require(_0x4d60('0x0'));var router=express['Router']();var controller=require('./authLocal.controller');router[_0x4d60('0x1')]('/',controller['login']);router[_0x4d60('0x1')](_0x4d60('0x2'),controller[_0x4d60('0x3')]);router['post']('/reset/:token',controller[_0x4d60('0x4')]);module[_0x4d60('0x5')]=router; \ No newline at end of file diff --git a/server/api/automation/automation.attributes.js b/server/api/automation/automation.attributes.js index 4e8cf7f..437df08 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 _0x094d=['BOOLEAN','INTEGER','sequelize','exports','STRING'];(function(_0x1f9f5f,_0x509fb7){var _0x51d649=function(_0x4a5285){while(--_0x4a5285){_0x1f9f5f['push'](_0x1f9f5f['shift']());}};_0x51d649(++_0x509fb7);}(_0x094d,0x11f));var _0xd094=function(_0x3a5e46,_0x4e3a77){_0x3a5e46=_0x3a5e46-0x0;var _0x2bbf34=_0x094d[_0x3a5e46];return _0x2bbf34;};'use strict';var Sequelize=require(_0xd094('0x0'));module[_0xd094('0x1')]={'name':{'type':Sequelize[_0xd094('0x2')],'allowNull':![]},'channel':{'type':Sequelize[_0xd094('0x2')]},'description':{'type':Sequelize[_0xd094('0x2')]},'status':{'type':Sequelize[_0xd094('0x3')],'defaultValue':![]},'timeout':{'type':Sequelize[_0xd094('0x4')],'defaultValue':0xa}}; \ No newline at end of file +var _0x8c08=['BOOLEAN','INTEGER','sequelize','exports','STRING'];(function(_0x9af652,_0x4de743){var _0x2eb16e=function(_0x4d6e25){while(--_0x4d6e25){_0x9af652['push'](_0x9af652['shift']());}};_0x2eb16e(++_0x4de743);}(_0x8c08,0xb1));var _0x88c0=function(_0x81dcac,_0x8ff7db){_0x81dcac=_0x81dcac-0x0;var _0xc7803b=_0x8c08[_0x81dcac];return _0xc7803b;};'use strict';var Sequelize=require(_0x88c0('0x0'));module[_0x88c0('0x1')]={'name':{'type':Sequelize[_0x88c0('0x2')],'allowNull':![]},'channel':{'type':Sequelize[_0x88c0('0x2')]},'description':{'type':Sequelize[_0x88c0('0x2')]},'status':{'type':Sequelize[_0x88c0('0x3')],'defaultValue':![]},'timeout':{'type':Sequelize[_0x88c0('0x4')],'defaultValue':0xa}}; \ No newline at end of file diff --git a/server/api/automation/automation.controller.js b/server/api/automation/automation.controller.js index 566f842..5e95a1d 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 _0x0276=['Automation','rawAttributes','type','query','keys','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','offset','sort','where','filters','pick','filter','merge','VIRTUAL','options','rows','catch','show','params','includeAll','find','create','body','addConditions','Condition','ids','omit','getConditions','order','addActions','Action','getActions','findOne','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','ejs','crypto','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status','json','count','limit','set','reject','save','update','then','destroy','error','stack','name','send','map'];(function(_0x26a672,_0x59f5be){var _0x348f43=function(_0x461812){while(--_0x461812){_0x26a672['push'](_0x26a672['shift']());}};_0x348f43(++_0x59f5be);}(_0x0276,0x7a));var _0x6027=function(_0xa1e3e3,_0x29fe0e){_0xa1e3e3=_0xa1e3e3-0x0;var _0xc980e9=_0x0276[_0xa1e3e3];return _0xc980e9;};'use strict';var pdf=require(_0x6027('0x0'));var emlformat=require(_0x6027('0x1'));var rimraf=require(_0x6027('0x2'));var zipdir=require(_0x6027('0x3'));var jsonpatch=require(_0x6027('0x4'));var rp=require('request-promise');var moment=require(_0x6027('0x5'));var BPromise=require(_0x6027('0x6'));var Mustache=require(_0x6027('0x7'));var util=require(_0x6027('0x8'));var path=require(_0x6027('0x9'));var sox=require(_0x6027('0xa'));var csv=require('to-csv');var ejs=require(_0x6027('0xb'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0x6027('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x6027('0xd'));var toCsv=require(_0x6027('0xe'));var querystring=require(_0x6027('0xf'));var Papa=require(_0x6027('0x10'));var Redis=require(_0x6027('0x11'));var authService=require(_0x6027('0x12'));var qs=require(_0x6027('0x13'));var as=require(_0x6027('0x14'));var hardwareService=require(_0x6027('0x15'));var logger=require(_0x6027('0x16'))(_0x6027('0x17'));var utils=require(_0x6027('0x18'));var config=require(_0x6027('0x19'));var db=require(_0x6027('0x1a'))['db'];function respondWithStatusCode(_0x263d71,_0x853a04){_0x853a04=_0x853a04||0xcc;return function(_0x16bd15){if(_0x16bd15){return _0x263d71[_0x6027('0x1b')](_0x853a04);}return _0x263d71['status'](_0x853a04)[_0x6027('0x1c')]();};}function respondWithResult(_0x1ad331,_0x29aecc){_0x29aecc=_0x29aecc||0xc8;return function(_0x4ccb05){if(_0x4ccb05){return _0x1ad331[_0x6027('0x1d')](_0x29aecc)[_0x6027('0x1e')](_0x4ccb05);}};}function respondWithFilteredResult(_0x5df5f1,_0x56e4f2){return function(_0x274061){if(_0x274061){var _0x3588a0=_0x274061[_0x6027('0x1f')],_0x405236=_0x56e4f2['offset'],_0x301289=_0x56e4f2['offset']+_0x56e4f2[_0x6027('0x20')],_0x707fe3;if(_0x301289>=_0x3588a0){_0x301289=_0x3588a0;_0x707fe3=0xc8;}else{_0x707fe3=0xce;}_0x5df5f1[_0x6027('0x1d')](_0x707fe3);return _0x5df5f1[_0x6027('0x21')]('Content-Range',_0x405236+'-'+_0x301289+'/'+_0x3588a0)[_0x6027('0x1e')](_0x274061);}return null;};}function patchUpdates(_0x160cf5){return function(_0x2bf233){try{jsonpatch['apply'](_0x2bf233,_0x160cf5,!![]);}catch(_0xce7f48){return BPromise[_0x6027('0x22')](_0xce7f48);}return _0x2bf233[_0x6027('0x23')]();};}function saveUpdates(_0x511d73,_0x4b2cca){return function(_0x228f7d){if(_0x228f7d){return _0x228f7d[_0x6027('0x24')](_0x511d73)[_0x6027('0x25')](function(_0x1aaa12){return _0x1aaa12;});}return null;};}function removeEntity(_0x265f53,_0x1725ce){return function(_0xa2727b){if(_0xa2727b){return _0xa2727b[_0x6027('0x26')]()['then'](function(){_0x265f53[_0x6027('0x1d')](0xcc)[_0x6027('0x1c')]();});}};}function handleEntityNotFound(_0x438b7e,_0x2908db){return function(_0x195363){if(!_0x195363){_0x438b7e[_0x6027('0x1b')](0x194);}return _0x195363;};}function handleError(_0x437f25,_0x55efb6){_0x55efb6=_0x55efb6||0x1f4;return function(_0xc193c4){logger[_0x6027('0x27')](_0xc193c4[_0x6027('0x28')]);if(_0xc193c4[_0x6027('0x29')]){delete _0xc193c4['name'];}_0x437f25[_0x6027('0x1d')](_0x55efb6)[_0x6027('0x2a')](_0xc193c4);};}exports['index']=function(_0x444364,_0x3bb92e){var _0xab6f3c={},_0xa8e067={},_0x38c8bb={'count':0x0,'rows':[]};var _0x4ac904=_[_0x6027('0x2b')](db[_0x6027('0x2c')][_0x6027('0x2d')],function(_0x37efa9){return{'name':_0x37efa9['fieldName'],'type':_0x37efa9[_0x6027('0x2e')]['key']};});_0xa8e067['model']=_[_0x6027('0x2b')](_0x4ac904,_0x6027('0x29'));_0xa8e067[_0x6027('0x2f')]=_[_0x6027('0x30')](_0x444364[_0x6027('0x2f')]);_0xa8e067['filters']=_[_0x6027('0x31')](_0xa8e067[_0x6027('0x32')],_0xa8e067['query']);_0xab6f3c[_0x6027('0x33')]=_[_0x6027('0x31')](_0xa8e067[_0x6027('0x32')],qs[_0x6027('0x34')](_0x444364[_0x6027('0x2f')][_0x6027('0x34')]));_0xab6f3c['attributes']=_0xab6f3c[_0x6027('0x33')][_0x6027('0x35')]?_0xab6f3c['attributes']:_0xa8e067[_0x6027('0x32')];if(!_0x444364[_0x6027('0x2f')][_0x6027('0x36')](_0x6027('0x37'))){_0xab6f3c[_0x6027('0x20')]=qs[_0x6027('0x20')](_0x444364[_0x6027('0x2f')][_0x6027('0x20')]);_0xab6f3c['offset']=qs[_0x6027('0x38')](_0x444364[_0x6027('0x2f')][_0x6027('0x38')]);}_0xab6f3c['order']=qs[_0x6027('0x39')](_0x444364['query'][_0x6027('0x39')]);_0xab6f3c[_0x6027('0x3a')]=qs[_0x6027('0x3b')](_[_0x6027('0x3c')](_0x444364[_0x6027('0x2f')],_0xa8e067[_0x6027('0x3b')]),_0x4ac904);if(_0x444364[_0x6027('0x2f')][_0x6027('0x3d')]){_0xab6f3c[_0x6027('0x3a')]=_[_0x6027('0x3e')](_0xab6f3c[_0x6027('0x3a')],{'$or':_[_0x6027('0x2b')](_0x4ac904,function(_0x35f8af){if(_0x35f8af['type']!==_0x6027('0x3f')){var _0x5f01aa={};_0x5f01aa[_0x35f8af[_0x6027('0x29')]]={'$like':'%'+_0x444364[_0x6027('0x2f')][_0x6027('0x3d')]+'%'};return _0x5f01aa;}})});}_0xab6f3c=_[_0x6027('0x3e')]({},_0xab6f3c,_0x444364[_0x6027('0x40')]);var _0x5313eb={'where':_0xab6f3c['where']};return db[_0x6027('0x2c')][_0x6027('0x1f')](_0x5313eb)[_0x6027('0x25')](function(_0x1af863){_0x38c8bb[_0x6027('0x1f')]=_0x1af863;if(_0x444364['query']['includeAll']){_0xab6f3c['include']=[{'all':!![]}];}return db[_0x6027('0x2c')]['findAll'](_0xab6f3c);})[_0x6027('0x25')](function(_0xab2344){_0x38c8bb[_0x6027('0x41')]=_0xab2344;return _0x38c8bb;})[_0x6027('0x25')](respondWithFilteredResult(_0x3bb92e,_0xab6f3c))[_0x6027('0x42')](handleError(_0x3bb92e,null));};exports[_0x6027('0x43')]=function(_0x13f75f,_0x19dfad){var _0x115031={'raw':![],'where':{'id':_0x13f75f[_0x6027('0x44')]['id']}},_0x108253={};_0x108253[_0x6027('0x32')]=_[_0x6027('0x30')](db[_0x6027('0x2c')][_0x6027('0x2d')]);_0x108253[_0x6027('0x2f')]=_[_0x6027('0x30')](_0x13f75f[_0x6027('0x2f')]);_0x108253[_0x6027('0x3b')]=_[_0x6027('0x31')](_0x108253['model'],_0x108253[_0x6027('0x2f')]);_0x115031[_0x6027('0x33')]=_[_0x6027('0x31')](_0x108253[_0x6027('0x32')],qs[_0x6027('0x34')](_0x13f75f[_0x6027('0x2f')]['fields']));_0x115031[_0x6027('0x33')]=_0x115031[_0x6027('0x33')][_0x6027('0x35')]?_0x115031[_0x6027('0x33')]:_0x108253[_0x6027('0x32')];if(_0x13f75f['query'][_0x6027('0x45')]){_0x115031['include']=[{'all':!![]}];}_0x115031=_['merge']({},_0x115031,_0x13f75f[_0x6027('0x40')]);return db[_0x6027('0x2c')][_0x6027('0x46')](_0x115031)[_0x6027('0x25')](handleEntityNotFound(_0x19dfad,null))[_0x6027('0x25')](respondWithResult(_0x19dfad,null))[_0x6027('0x42')](handleError(_0x19dfad,null));};exports['create']=function(_0x373ad4,_0x1db0ab){return db[_0x6027('0x2c')][_0x6027('0x47')](_0x373ad4['body'],{})[_0x6027('0x25')](respondWithResult(_0x1db0ab,0xc9))[_0x6027('0x42')](handleError(_0x1db0ab,null));};exports[_0x6027('0x24')]=function(_0xe3153e,_0x3c7bbb){if(_0xe3153e['body']['id']){delete _0xe3153e[_0x6027('0x48')]['id'];}return db[_0x6027('0x2c')][_0x6027('0x46')]({'where':{'id':_0xe3153e[_0x6027('0x44')]['id']}})['then'](handleEntityNotFound(_0x3c7bbb,null))[_0x6027('0x25')](saveUpdates(_0xe3153e['body'],null))[_0x6027('0x25')](respondWithResult(_0x3c7bbb,null))[_0x6027('0x42')](handleError(_0x3c7bbb,null));};exports['destroy']=function(_0x8d7584,_0x4790d1){return db[_0x6027('0x2c')][_0x6027('0x46')]({'where':{'id':_0x8d7584[_0x6027('0x44')]['id']}})[_0x6027('0x25')](handleEntityNotFound(_0x4790d1,null))[_0x6027('0x25')](removeEntity(_0x4790d1,null))[_0x6027('0x42')](handleError(_0x4790d1,null));};exports[_0x6027('0x49')]=function(_0x5f2531,_0x591fdd,_0x804267){return db[_0x6027('0x4a')]['find']({'where':{'id':_0x5f2531[_0x6027('0x44')]['id']}})[_0x6027('0x25')](handleEntityNotFound(_0x591fdd,null))[_0x6027('0x25')](function(_0x22d699){if(_0x22d699){return _0x22d699['addConditions'](_0x5f2531[_0x6027('0x48')][_0x6027('0x4b')],_[_0x6027('0x4c')](_0x5f2531[_0x6027('0x48')],[_0x6027('0x4b'),'id'])||{});}})[_0x6027('0x25')](respondWithResult(_0x591fdd,null))['catch'](handleError(_0x591fdd,null));};exports[_0x6027('0x4d')]=function(_0x3f89f6,_0x3f6298,_0x1eb89a){var _0x4537f4={};var _0xd1669d={};var _0x556e38;var _0x3754d5;return db['Automation']['findOne']({'where':{'id':_0x3f89f6[_0x6027('0x44')]['id']}})['then'](handleEntityNotFound(_0x3f6298,null))[_0x6027('0x25')](function(_0x27b539){if(_0x27b539){_0x556e38=_0x27b539;_0xd1669d[_0x6027('0x32')]=_[_0x6027('0x30')](db[_0x6027('0x4a')][_0x6027('0x2d')]);_0xd1669d['query']=_[_0x6027('0x30')](_0x3f89f6['query']);_0xd1669d['filters']=_['intersection'](_0xd1669d[_0x6027('0x32')],_0xd1669d[_0x6027('0x2f')]);_0x4537f4['attributes']=_[_0x6027('0x31')](_0xd1669d['model'],qs[_0x6027('0x34')](_0x3f89f6[_0x6027('0x2f')][_0x6027('0x34')]));_0x4537f4[_0x6027('0x33')]=_0x4537f4[_0x6027('0x33')][_0x6027('0x35')]?_0x4537f4[_0x6027('0x33')]:_0xd1669d[_0x6027('0x32')];_0x4537f4[_0x6027('0x4e')]=qs[_0x6027('0x39')](_0x3f89f6[_0x6027('0x2f')][_0x6027('0x39')]);_0x4537f4[_0x6027('0x3a')]=qs[_0x6027('0x3b')](_[_0x6027('0x3c')](_0x3f89f6[_0x6027('0x2f')],_0xd1669d[_0x6027('0x3b')]));if(_0x3f89f6[_0x6027('0x2f')]['filter']){_0x4537f4['where']=_[_0x6027('0x3e')](_0x4537f4['where'],{'$or':_[_0x6027('0x2b')](_0x4537f4[_0x6027('0x33')],function(_0x531498){var _0x13767b={};_0x13767b[_0x531498]={'$like':'%'+_0x3f89f6[_0x6027('0x2f')]['filter']+'%'};return _0x13767b;})});}_0x4537f4=_[_0x6027('0x3e')]({},_0x4537f4,_0x3f89f6[_0x6027('0x40')]);return _0x556e38[_0x6027('0x4d')](_0x4537f4);}})[_0x6027('0x25')](function(_0x249bb1){if(_0x249bb1){_0x3754d5=_0x249bb1[_0x6027('0x35')];if(!_0x3f89f6[_0x6027('0x2f')][_0x6027('0x36')](_0x6027('0x37'))){_0x4537f4['limit']=qs[_0x6027('0x20')](_0x3f89f6[_0x6027('0x2f')][_0x6027('0x20')]);_0x4537f4[_0x6027('0x38')]=qs[_0x6027('0x38')](_0x3f89f6['query'][_0x6027('0x38')]);}return _0x556e38[_0x6027('0x4d')](_0x4537f4);}})[_0x6027('0x25')](function(_0x4d054d){if(_0x4d054d){return _0x4d054d?{'count':_0x3754d5,'rows':_0x4d054d}:null;}})[_0x6027('0x25')](respondWithResult(_0x3f6298,null))[_0x6027('0x42')](handleError(_0x3f6298,null));};exports[_0x6027('0x4f')]=function(_0x19e1c0,_0x3b34da,_0x25a168){return db[_0x6027('0x50')][_0x6027('0x46')]({'where':{'id':_0x19e1c0[_0x6027('0x44')]['id']}})['then'](handleEntityNotFound(_0x3b34da,null))[_0x6027('0x25')](function(_0x10d10a){if(_0x10d10a){return _0x10d10a[_0x6027('0x4f')](_0x19e1c0[_0x6027('0x48')][_0x6027('0x4b')],_[_0x6027('0x4c')](_0x19e1c0['body'],[_0x6027('0x4b'),'id'])||{});}})[_0x6027('0x25')](respondWithResult(_0x3b34da,null))[_0x6027('0x42')](handleError(_0x3b34da,null));};exports[_0x6027('0x51')]=function(_0x13ffb1,_0x257993,_0x36991b){var _0x9e6e9e={};var _0x1d6672={};var _0xb05d70;var _0x5c9acb;return db[_0x6027('0x2c')][_0x6027('0x52')]({'where':{'id':_0x13ffb1[_0x6027('0x44')]['id']}})['then'](handleEntityNotFound(_0x257993,null))['then'](function(_0x63c89d){if(_0x63c89d){_0xb05d70=_0x63c89d;_0x1d6672['model']=_['keys'](db[_0x6027('0x50')]['rawAttributes']);_0x1d6672[_0x6027('0x2f')]=_[_0x6027('0x30')](_0x13ffb1['query']);_0x1d6672['filters']=_[_0x6027('0x31')](_0x1d6672[_0x6027('0x32')],_0x1d6672[_0x6027('0x2f')]);_0x9e6e9e['attributes']=_[_0x6027('0x31')](_0x1d6672['model'],qs[_0x6027('0x34')](_0x13ffb1[_0x6027('0x2f')]['fields']));_0x9e6e9e[_0x6027('0x33')]=_0x9e6e9e[_0x6027('0x33')][_0x6027('0x35')]?_0x9e6e9e[_0x6027('0x33')]:_0x1d6672[_0x6027('0x32')];_0x9e6e9e[_0x6027('0x4e')]=qs['sort'](_0x13ffb1[_0x6027('0x2f')][_0x6027('0x39')]);_0x9e6e9e[_0x6027('0x3a')]=qs[_0x6027('0x3b')](_['pick'](_0x13ffb1['query'],_0x1d6672[_0x6027('0x3b')]));if(_0x13ffb1[_0x6027('0x2f')][_0x6027('0x3d')]){_0x9e6e9e['where']=_[_0x6027('0x3e')](_0x9e6e9e['where'],{'$or':_[_0x6027('0x2b')](_0x9e6e9e[_0x6027('0x33')],function(_0x50f75b){var _0x3ddab6={};_0x3ddab6[_0x50f75b]={'$like':'%'+_0x13ffb1[_0x6027('0x2f')][_0x6027('0x3d')]+'%'};return _0x3ddab6;})});}_0x9e6e9e=_['merge']({},_0x9e6e9e,_0x13ffb1[_0x6027('0x40')]);return _0xb05d70[_0x6027('0x51')](_0x9e6e9e);}})[_0x6027('0x25')](function(_0xf3a6da){if(_0xf3a6da){_0x5c9acb=_0xf3a6da[_0x6027('0x35')];if(!_0x13ffb1[_0x6027('0x2f')][_0x6027('0x36')](_0x6027('0x37'))){_0x9e6e9e[_0x6027('0x20')]=qs[_0x6027('0x20')](_0x13ffb1[_0x6027('0x2f')][_0x6027('0x20')]);_0x9e6e9e[_0x6027('0x38')]=qs[_0x6027('0x38')](_0x13ffb1[_0x6027('0x2f')]['offset']);}return _0xb05d70[_0x6027('0x51')](_0x9e6e9e);}})[_0x6027('0x25')](function(_0x591518){if(_0x591518){return _0x591518?{'count':_0x5c9acb,'rows':_0x591518}:null;}})['then'](respondWithResult(_0x257993,null))[_0x6027('0x42')](handleError(_0x257993,null));}; \ No newline at end of file +var _0x3933=['type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','sort','where','pick','filter','merge','VIRTUAL','options','Automation','count','include','findAll','then','catch','params','rawAttributes','includeAll','find','create','body','update','addConditions','Condition','ids','omit','getConditions','findOne','order','nolimit','Action','addActions','getActions','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','util','path','sox','to-csv','lodash','squel','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','offset','limit','set','json','apply','reject','save','destroy','error','stack','name','send','index','map','fieldName'];(function(_0x447bcd,_0x36c2a3){var _0x3aac1b=function(_0x4d310b){while(--_0x4d310b){_0x447bcd['push'](_0x447bcd['shift']());}};_0x3aac1b(++_0x36c2a3);}(_0x3933,0x120));var _0x3393=function(_0x52f0d1,_0x3775b8){_0x52f0d1=_0x52f0d1-0x0;var _0xee9e=_0x3933[_0x52f0d1];return _0xee9e;};'use strict';var pdf=require(_0x3393('0x0'));var emlformat=require(_0x3393('0x1'));var rimraf=require(_0x3393('0x2'));var zipdir=require(_0x3393('0x3'));var jsonpatch=require(_0x3393('0x4'));var rp=require('request-promise');var moment=require(_0x3393('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x3393('0x6'));var path=require(_0x3393('0x7'));var sox=require(_0x3393('0x8'));var csv=require(_0x3393('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x3393('0xa'));var squel=require(_0x3393('0xb'));var crypto=require(_0x3393('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x3393('0x9'));var querystring=require(_0x3393('0xd'));var Papa=require(_0x3393('0xe'));var Redis=require(_0x3393('0xf'));var authService=require(_0x3393('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x3393('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x3393('0x12'))('api');var utils=require(_0x3393('0x13'));var config=require(_0x3393('0x14'));var db=require(_0x3393('0x15'))['db'];function respondWithStatusCode(_0x5a3447,_0x426007){_0x426007=_0x426007||0xcc;return function(_0x47a2a5){if(_0x47a2a5){return _0x5a3447[_0x3393('0x16')](_0x426007);}return _0x5a3447[_0x3393('0x17')](_0x426007)[_0x3393('0x18')]();};}function respondWithResult(_0x1e0231,_0x270c59){_0x270c59=_0x270c59||0xc8;return function(_0x46be67){if(_0x46be67){return _0x1e0231['status'](_0x270c59)['json'](_0x46be67);}};}function respondWithFilteredResult(_0x8e8b9e,_0x45d9b3){return function(_0x7580d0){if(_0x7580d0){var _0x499f6b=_0x7580d0['count'],_0x1d76de=_0x45d9b3[_0x3393('0x19')],_0x31560a=_0x45d9b3['offset']+_0x45d9b3[_0x3393('0x1a')],_0x2f8f77;if(_0x31560a>=_0x499f6b){_0x31560a=_0x499f6b;_0x2f8f77=0xc8;}else{_0x2f8f77=0xce;}_0x8e8b9e[_0x3393('0x17')](_0x2f8f77);return _0x8e8b9e[_0x3393('0x1b')]('Content-Range',_0x1d76de+'-'+_0x31560a+'/'+_0x499f6b)[_0x3393('0x1c')](_0x7580d0);}return null;};}function patchUpdates(_0x57925e){return function(_0x15e6a9){try{jsonpatch[_0x3393('0x1d')](_0x15e6a9,_0x57925e,!![]);}catch(_0xe29575){return BPromise[_0x3393('0x1e')](_0xe29575);}return _0x15e6a9[_0x3393('0x1f')]();};}function saveUpdates(_0x5372b7,_0x3ff87c){return function(_0x38b995){if(_0x38b995){return _0x38b995['update'](_0x5372b7)['then'](function(_0x1dbfe2){return _0x1dbfe2;});}return null;};}function removeEntity(_0x8c8531,_0x40ec7e){return function(_0x42ecb1){if(_0x42ecb1){return _0x42ecb1[_0x3393('0x20')]()['then'](function(){_0x8c8531['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x46ec72,_0x1f9db1){return function(_0x5d0b3b){if(!_0x5d0b3b){_0x46ec72[_0x3393('0x16')](0x194);}return _0x5d0b3b;};}function handleError(_0x449e1a,_0x912779){_0x912779=_0x912779||0x1f4;return function(_0x53b74a){logger[_0x3393('0x21')](_0x53b74a[_0x3393('0x22')]);if(_0x53b74a[_0x3393('0x23')]){delete _0x53b74a[_0x3393('0x23')];}_0x449e1a[_0x3393('0x17')](_0x912779)[_0x3393('0x24')](_0x53b74a);};}exports[_0x3393('0x25')]=function(_0x350edb,_0x393790){var _0x159ad4={},_0xcc6fac={},_0x356901={'count':0x0,'rows':[]};var _0x33a1e3=_[_0x3393('0x26')](db['Automation']['rawAttributes'],function(_0x3d5b0a){return{'name':_0x3d5b0a[_0x3393('0x27')],'type':_0x3d5b0a[_0x3393('0x28')][_0x3393('0x29')]};});_0xcc6fac[_0x3393('0x2a')]=_[_0x3393('0x26')](_0x33a1e3,'name');_0xcc6fac[_0x3393('0x2b')]=_[_0x3393('0x2c')](_0x350edb[_0x3393('0x2b')]);_0xcc6fac[_0x3393('0x2d')]=_[_0x3393('0x2e')](_0xcc6fac['model'],_0xcc6fac[_0x3393('0x2b')]);_0x159ad4[_0x3393('0x2f')]=_[_0x3393('0x2e')](_0xcc6fac['model'],qs[_0x3393('0x30')](_0x350edb[_0x3393('0x2b')][_0x3393('0x30')]));_0x159ad4[_0x3393('0x2f')]=_0x159ad4[_0x3393('0x2f')][_0x3393('0x31')]?_0x159ad4[_0x3393('0x2f')]:_0xcc6fac['model'];if(!_0x350edb['query'][_0x3393('0x32')]('nolimit')){_0x159ad4[_0x3393('0x1a')]=qs[_0x3393('0x1a')](_0x350edb['query']['limit']);_0x159ad4['offset']=qs[_0x3393('0x19')](_0x350edb[_0x3393('0x2b')]['offset']);}_0x159ad4['order']=qs[_0x3393('0x33')](_0x350edb[_0x3393('0x2b')][_0x3393('0x33')]);_0x159ad4[_0x3393('0x34')]=qs['filters'](_[_0x3393('0x35')](_0x350edb[_0x3393('0x2b')],_0xcc6fac['filters']),_0x33a1e3);if(_0x350edb[_0x3393('0x2b')][_0x3393('0x36')]){_0x159ad4[_0x3393('0x34')]=_[_0x3393('0x37')](_0x159ad4[_0x3393('0x34')],{'$or':_[_0x3393('0x26')](_0x33a1e3,function(_0xae5d26){if(_0xae5d26[_0x3393('0x28')]!==_0x3393('0x38')){var _0x264575={};_0x264575[_0xae5d26['name']]={'$like':'%'+_0x350edb[_0x3393('0x2b')][_0x3393('0x36')]+'%'};return _0x264575;}})});}_0x159ad4=_[_0x3393('0x37')]({},_0x159ad4,_0x350edb[_0x3393('0x39')]);var _0x34a982={'where':_0x159ad4[_0x3393('0x34')]};return db[_0x3393('0x3a')][_0x3393('0x3b')](_0x34a982)['then'](function(_0x20643c){_0x356901['count']=_0x20643c;if(_0x350edb['query']['includeAll']){_0x159ad4[_0x3393('0x3c')]=[{'all':!![]}];}return db[_0x3393('0x3a')][_0x3393('0x3d')](_0x159ad4);})['then'](function(_0x10f59d){_0x356901['rows']=_0x10f59d;return _0x356901;})[_0x3393('0x3e')](respondWithFilteredResult(_0x393790,_0x159ad4))[_0x3393('0x3f')](handleError(_0x393790,null));};exports['show']=function(_0x17eae1,_0x5de155){var _0x4ab601={'raw':![],'where':{'id':_0x17eae1[_0x3393('0x40')]['id']}},_0x11fbd0={};_0x11fbd0['model']=_[_0x3393('0x2c')](db[_0x3393('0x3a')][_0x3393('0x41')]);_0x11fbd0[_0x3393('0x2b')]=_[_0x3393('0x2c')](_0x17eae1['query']);_0x11fbd0[_0x3393('0x2d')]=_[_0x3393('0x2e')](_0x11fbd0[_0x3393('0x2a')],_0x11fbd0[_0x3393('0x2b')]);_0x4ab601['attributes']=_['intersection'](_0x11fbd0['model'],qs[_0x3393('0x30')](_0x17eae1[_0x3393('0x2b')][_0x3393('0x30')]));_0x4ab601[_0x3393('0x2f')]=_0x4ab601[_0x3393('0x2f')][_0x3393('0x31')]?_0x4ab601['attributes']:_0x11fbd0['model'];if(_0x17eae1[_0x3393('0x2b')][_0x3393('0x42')]){_0x4ab601[_0x3393('0x3c')]=[{'all':!![]}];}_0x4ab601=_[_0x3393('0x37')]({},_0x4ab601,_0x17eae1[_0x3393('0x39')]);return db['Automation'][_0x3393('0x43')](_0x4ab601)[_0x3393('0x3e')](handleEntityNotFound(_0x5de155,null))[_0x3393('0x3e')](respondWithResult(_0x5de155,null))[_0x3393('0x3f')](handleError(_0x5de155,null));};exports[_0x3393('0x44')]=function(_0x4647dd,_0xd1416e){return db[_0x3393('0x3a')][_0x3393('0x44')](_0x4647dd[_0x3393('0x45')],{})['then'](respondWithResult(_0xd1416e,0xc9))['catch'](handleError(_0xd1416e,null));};exports[_0x3393('0x46')]=function(_0x335845,_0x1a9c47){if(_0x335845[_0x3393('0x45')]['id']){delete _0x335845['body']['id'];}return db[_0x3393('0x3a')][_0x3393('0x43')]({'where':{'id':_0x335845[_0x3393('0x40')]['id']}})[_0x3393('0x3e')](handleEntityNotFound(_0x1a9c47,null))[_0x3393('0x3e')](saveUpdates(_0x335845[_0x3393('0x45')],null))[_0x3393('0x3e')](respondWithResult(_0x1a9c47,null))[_0x3393('0x3f')](handleError(_0x1a9c47,null));};exports[_0x3393('0x20')]=function(_0x5b2c08,_0x524993){return db['Automation'][_0x3393('0x43')]({'where':{'id':_0x5b2c08[_0x3393('0x40')]['id']}})[_0x3393('0x3e')](handleEntityNotFound(_0x524993,null))['then'](removeEntity(_0x524993,null))[_0x3393('0x3f')](handleError(_0x524993,null));};exports[_0x3393('0x47')]=function(_0x36b924,_0x1ef10f,_0x437e5b){return db[_0x3393('0x48')][_0x3393('0x43')]({'where':{'id':_0x36b924[_0x3393('0x40')]['id']}})[_0x3393('0x3e')](handleEntityNotFound(_0x1ef10f,null))[_0x3393('0x3e')](function(_0x1b48dd){if(_0x1b48dd){return _0x1b48dd[_0x3393('0x47')](_0x36b924[_0x3393('0x45')][_0x3393('0x49')],_[_0x3393('0x4a')](_0x36b924[_0x3393('0x45')],[_0x3393('0x49'),'id'])||{});}})[_0x3393('0x3e')](respondWithResult(_0x1ef10f,null))[_0x3393('0x3f')](handleError(_0x1ef10f,null));};exports[_0x3393('0x4b')]=function(_0x44ca6b,_0x28bdc8,_0xa860da){var _0x34ed3f={};var _0x525882={};var _0x356c83;var _0xad24e7;return db['Automation'][_0x3393('0x4c')]({'where':{'id':_0x44ca6b[_0x3393('0x40')]['id']}})['then'](handleEntityNotFound(_0x28bdc8,null))[_0x3393('0x3e')](function(_0x1331fb){if(_0x1331fb){_0x356c83=_0x1331fb;_0x525882[_0x3393('0x2a')]=_[_0x3393('0x2c')](db['Condition'][_0x3393('0x41')]);_0x525882[_0x3393('0x2b')]=_[_0x3393('0x2c')](_0x44ca6b[_0x3393('0x2b')]);_0x525882[_0x3393('0x2d')]=_[_0x3393('0x2e')](_0x525882[_0x3393('0x2a')],_0x525882[_0x3393('0x2b')]);_0x34ed3f['attributes']=_[_0x3393('0x2e')](_0x525882[_0x3393('0x2a')],qs[_0x3393('0x30')](_0x44ca6b[_0x3393('0x2b')][_0x3393('0x30')]));_0x34ed3f[_0x3393('0x2f')]=_0x34ed3f[_0x3393('0x2f')][_0x3393('0x31')]?_0x34ed3f[_0x3393('0x2f')]:_0x525882[_0x3393('0x2a')];_0x34ed3f[_0x3393('0x4d')]=qs[_0x3393('0x33')](_0x44ca6b[_0x3393('0x2b')][_0x3393('0x33')]);_0x34ed3f[_0x3393('0x34')]=qs[_0x3393('0x2d')](_[_0x3393('0x35')](_0x44ca6b[_0x3393('0x2b')],_0x525882['filters']));if(_0x44ca6b[_0x3393('0x2b')][_0x3393('0x36')]){_0x34ed3f[_0x3393('0x34')]=_[_0x3393('0x37')](_0x34ed3f[_0x3393('0x34')],{'$or':_['map'](_0x34ed3f[_0x3393('0x2f')],function(_0x15b55b){var _0x262b3b={};_0x262b3b[_0x15b55b]={'$like':'%'+_0x44ca6b[_0x3393('0x2b')][_0x3393('0x36')]+'%'};return _0x262b3b;})});}_0x34ed3f=_[_0x3393('0x37')]({},_0x34ed3f,_0x44ca6b[_0x3393('0x39')]);return _0x356c83[_0x3393('0x4b')](_0x34ed3f);}})[_0x3393('0x3e')](function(_0x40995d){if(_0x40995d){_0xad24e7=_0x40995d[_0x3393('0x31')];if(!_0x44ca6b['query'][_0x3393('0x32')](_0x3393('0x4e'))){_0x34ed3f[_0x3393('0x1a')]=qs[_0x3393('0x1a')](_0x44ca6b[_0x3393('0x2b')][_0x3393('0x1a')]);_0x34ed3f[_0x3393('0x19')]=qs[_0x3393('0x19')](_0x44ca6b[_0x3393('0x2b')][_0x3393('0x19')]);}return _0x356c83[_0x3393('0x4b')](_0x34ed3f);}})[_0x3393('0x3e')](function(_0x1c369e){if(_0x1c369e){return _0x1c369e?{'count':_0xad24e7,'rows':_0x1c369e}:null;}})[_0x3393('0x3e')](respondWithResult(_0x28bdc8,null))[_0x3393('0x3f')](handleError(_0x28bdc8,null));};exports['addActions']=function(_0x582f2a,_0x2d1f8a,_0x2bcf06){return db[_0x3393('0x4f')]['find']({'where':{'id':_0x582f2a['params']['id']}})['then'](handleEntityNotFound(_0x2d1f8a,null))['then'](function(_0xe775ca){if(_0xe775ca){return _0xe775ca[_0x3393('0x50')](_0x582f2a[_0x3393('0x45')][_0x3393('0x49')],_['omit'](_0x582f2a[_0x3393('0x45')],[_0x3393('0x49'),'id'])||{});}})[_0x3393('0x3e')](respondWithResult(_0x2d1f8a,null))[_0x3393('0x3f')](handleError(_0x2d1f8a,null));};exports[_0x3393('0x51')]=function(_0x43efa9,_0x263acb,_0x212887){var _0x24412d={};var _0x493573={};var _0x46a77e;var _0x24b199;return db['Automation'][_0x3393('0x4c')]({'where':{'id':_0x43efa9[_0x3393('0x40')]['id']}})['then'](handleEntityNotFound(_0x263acb,null))[_0x3393('0x3e')](function(_0x99b35){if(_0x99b35){_0x46a77e=_0x99b35;_0x493573['model']=_[_0x3393('0x2c')](db[_0x3393('0x4f')][_0x3393('0x41')]);_0x493573['query']=_['keys'](_0x43efa9[_0x3393('0x2b')]);_0x493573['filters']=_[_0x3393('0x2e')](_0x493573[_0x3393('0x2a')],_0x493573[_0x3393('0x2b')]);_0x24412d[_0x3393('0x2f')]=_['intersection'](_0x493573[_0x3393('0x2a')],qs[_0x3393('0x30')](_0x43efa9[_0x3393('0x2b')][_0x3393('0x30')]));_0x24412d[_0x3393('0x2f')]=_0x24412d[_0x3393('0x2f')][_0x3393('0x31')]?_0x24412d[_0x3393('0x2f')]:_0x493573[_0x3393('0x2a')];_0x24412d[_0x3393('0x4d')]=qs[_0x3393('0x33')](_0x43efa9[_0x3393('0x2b')][_0x3393('0x33')]);_0x24412d[_0x3393('0x34')]=qs['filters'](_[_0x3393('0x35')](_0x43efa9[_0x3393('0x2b')],_0x493573[_0x3393('0x2d')]));if(_0x43efa9[_0x3393('0x2b')]['filter']){_0x24412d[_0x3393('0x34')]=_['merge'](_0x24412d[_0x3393('0x34')],{'$or':_[_0x3393('0x26')](_0x24412d[_0x3393('0x2f')],function(_0x4d8ad9){var _0x225d0f={};_0x225d0f[_0x4d8ad9]={'$like':'%'+_0x43efa9[_0x3393('0x2b')][_0x3393('0x36')]+'%'};return _0x225d0f;})});}_0x24412d=_[_0x3393('0x37')]({},_0x24412d,_0x43efa9[_0x3393('0x39')]);return _0x46a77e[_0x3393('0x51')](_0x24412d);}})[_0x3393('0x3e')](function(_0x1487f0){if(_0x1487f0){_0x24b199=_0x1487f0['length'];if(!_0x43efa9[_0x3393('0x2b')][_0x3393('0x32')]('nolimit')){_0x24412d['limit']=qs[_0x3393('0x1a')](_0x43efa9['query'][_0x3393('0x1a')]);_0x24412d[_0x3393('0x19')]=qs[_0x3393('0x19')](_0x43efa9[_0x3393('0x2b')][_0x3393('0x19')]);}return _0x46a77e[_0x3393('0x51')](_0x24412d);}})[_0x3393('0x3e')](function(_0x1f4d94){if(_0x1f4d94){return _0x1f4d94?{'count':_0x24b199,'rows':_0x1f4d94}:null;}})[_0x3393('0x3e')](respondWithResult(_0x263acb,null))[_0x3393('0x3f')](handleError(_0x263acb,null));}; \ No newline at end of file diff --git a/server/api/automation/automation.model.js b/server/api/automation/automation.model.js index 6c51e0f..32dec13 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 _0x2bd8=['./automation.attributes','exports','define','Automation','tools_automations','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x216494,_0x21a0b4){var _0x3fce22=function(_0x510bbd){while(--_0x510bbd){_0x216494['push'](_0x216494['shift']());}};_0x3fce22(++_0x21a0b4);}(_0x2bd8,0x130));var _0x82bd=function(_0xdcbca9,_0x540b0a){_0xdcbca9=_0xdcbca9-0x0;var _0x56d932=_0x2bd8[_0xdcbca9];return _0x56d932;};'use strict';var _=require(_0x82bd('0x0'));var util=require('util');var logger=require(_0x82bd('0x1'))(_0x82bd('0x2'));var moment=require(_0x82bd('0x3'));var BPromise=require(_0x82bd('0x4'));var rp=require(_0x82bd('0x5'));var fs=require('fs');var path=require(_0x82bd('0x6'));var rimraf=require(_0x82bd('0x7'));var config=require('../../config/environment');var attributes=require(_0x82bd('0x8'));module[_0x82bd('0x9')]=function(_0x3bf810,_0x5ceb60){return _0x3bf810[_0x82bd('0xa')](_0x82bd('0xb'),attributes,{'tableName':_0x82bd('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3e74=['exports','Automation','tools_automations','lodash','../../config/logger','api','moment','path','../../config/environment','./automation.attributes'];(function(_0x178a9c,_0x562a28){var _0x3fd933=function(_0x37a0e2){while(--_0x37a0e2){_0x178a9c['push'](_0x178a9c['shift']());}};_0x3fd933(++_0x562a28);}(_0x3e74,0x175));var _0x43e7=function(_0x3320a3,_0x3032d7){_0x3320a3=_0x3320a3-0x0;var _0x2feece=_0x3e74[_0x3320a3];return _0x2feece;};'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':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/automation/automation.rpc.js b/server/api/automation/automation.rpc.js index 25038af..578f03a 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 _0x8535=['info','request\x20sent','debug','stringify','code','error','Automation,\x20%s,\x20%s','message','result','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then'];(function(_0x1b785c,_0xcd7648){var _0x3ac3f5=function(_0x421faf){while(--_0x421faf){_0x1b785c['push'](_0x1b785c['shift']());}};_0x3ac3f5(++_0xcd7648);}(_0x8535,0xaa));var _0x5853=function(_0x4fa6cd,_0x279bf1){_0x4fa6cd=_0x4fa6cd-0x0;var _0x535fe6=_0x8535[_0x4fa6cd];return _0x535fe6;};'use strict';var _=require(_0x5853('0x0'));var util=require('util');var moment=require(_0x5853('0x1'));var BPromise=require(_0x5853('0x2'));var rs=require(_0x5853('0x3'));var fs=require('fs');var Redis=require(_0x5853('0x4'));var db=require(_0x5853('0x5'))['db'];var utils=require(_0x5853('0x6'));var logger=require('../../config/logger')(_0x5853('0x7'));var config=require(_0x5853('0x8'));var jayson=require(_0x5853('0x9'));var client=jayson[_0x5853('0xa')][_0x5853('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x422fe2,_0x12a158,_0x1b516){return new BPromise(function(_0x59095c,_0x13a3fe){return client[_0x5853('0xc')](_0x422fe2,_0x1b516)[_0x5853('0xd')](function(_0x149e6f){logger[_0x5853('0xe')]('Automation,\x20%s,\x20%s',_0x12a158,_0x5853('0xf'));logger[_0x5853('0x10')]('Automation,\x20%s,\x20%s,\x20%s',_0x12a158,'request\x20sent',JSON[_0x5853('0x11')](_0x149e6f));if(_0x149e6f['error']){if(_0x149e6f['error'][_0x5853('0x12')]===0x1f4){logger[_0x5853('0x13')](_0x5853('0x14'),_0x12a158,_0x149e6f[_0x5853('0x13')]['message']);return _0x13a3fe(_0x149e6f[_0x5853('0x13')][_0x5853('0x15')]);}logger[_0x5853('0x13')](_0x5853('0x14'),_0x12a158,_0x149e6f[_0x5853('0x13')][_0x5853('0x15')]);return _0x59095c(_0x149e6f[_0x5853('0x13')][_0x5853('0x15')]);}else{logger[_0x5853('0xe')](_0x5853('0x14'),_0x12a158,_0x5853('0xf'));_0x59095c(_0x149e6f[_0x5853('0x16')]['message']);}})['catch'](function(_0x5bb28d){logger[_0x5853('0x13')](_0x5853('0x14'),_0x12a158,_0x5bb28d);_0x13a3fe(_0x5bb28d);});});} \ No newline at end of file +var _0x1ca3=['message','result','catch','lodash','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','Automation,\x20%s,\x20%s,\x20%s','stringify','error','code','Automation,\x20%s,\x20%s'];(function(_0x1e3c02,_0x5c07a2){var _0x4d26d7=function(_0x367ed9){while(--_0x367ed9){_0x1e3c02['push'](_0x1e3c02['shift']());}};_0x4d26d7(++_0x5c07a2);}(_0x1ca3,0x18a));var _0x31ca=function(_0x1e6c93,_0x3cd9a7){_0x1e6c93=_0x1e6c93-0x0;var _0x367a16=_0x1ca3[_0x1e6c93];return _0x367a16;};'use strict';var _=require(_0x31ca('0x0'));var util=require('util');var moment=require(_0x31ca('0x1'));var BPromise=require(_0x31ca('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x31ca('0x3'))['db'];var utils=require(_0x31ca('0x4'));var logger=require(_0x31ca('0x5'))(_0x31ca('0x6'));var config=require(_0x31ca('0x7'));var jayson=require(_0x31ca('0x8'));var client=jayson[_0x31ca('0x9')][_0x31ca('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x31c9f8,_0x4ad837,_0x2f0197){return new BPromise(function(_0x200722,_0x45edb7){return client[_0x31ca('0xb')](_0x31c9f8,_0x2f0197)[_0x31ca('0xc')](function(_0x4d41e8){logger[_0x31ca('0xd')]('Automation,\x20%s,\x20%s',_0x4ad837,_0x31ca('0xe'));logger['debug'](_0x31ca('0xf'),_0x4ad837,_0x31ca('0xe'),JSON[_0x31ca('0x10')](_0x4d41e8));if(_0x4d41e8['error']){if(_0x4d41e8[_0x31ca('0x11')][_0x31ca('0x12')]===0x1f4){logger[_0x31ca('0x11')](_0x31ca('0x13'),_0x4ad837,_0x4d41e8['error'][_0x31ca('0x14')]);return _0x45edb7(_0x4d41e8[_0x31ca('0x11')]['message']);}logger[_0x31ca('0x11')](_0x31ca('0x13'),_0x4ad837,_0x4d41e8[_0x31ca('0x11')][_0x31ca('0x14')]);return _0x200722(_0x4d41e8['error']['message']);}else{logger[_0x31ca('0xd')](_0x31ca('0x13'),_0x4ad837,'request\x20sent');_0x200722(_0x4d41e8[_0x31ca('0x15')][_0x31ca('0x14')]);}})[_0x31ca('0x16')](function(_0x26037d){logger[_0x31ca('0x11')]('Automation,\x20%s,\x20%s',_0x4ad837,_0x26037d);_0x45edb7(_0x26037d);});});} \ No newline at end of file diff --git a/server/api/automation/index.js b/server/api/automation/index.js index cbb61b9..bec05dc 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 _0x1921=['show','get','/:id/conditions','getConditions','/:id/actions','getActions','post','create','addConditions','update','delete','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./automation.controller','isAuthenticated','index','/:id'];(function(_0x5612c8,_0xe5949c){var _0x136203=function(_0x558147){while(--_0x558147){_0x5612c8['push'](_0x5612c8['shift']());}};_0x136203(++_0xe5949c);}(_0x1921,0xe4));var _0x1192=function(_0x9f7bff,_0xa544ae){_0x9f7bff=_0x9f7bff-0x0;var _0x21956f=_0x1921[_0x9f7bff];return _0x21956f;};'use strict';var multer=require(_0x1192('0x0'));var util=require(_0x1192('0x1'));var path=require(_0x1192('0x2'));var timeout=require(_0x1192('0x3'));var express=require(_0x1192('0x4'));var router=express[_0x1192('0x5')]();var auth=require(_0x1192('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x1192('0x7'));var controller=require(_0x1192('0x8'));router['get']('/',auth[_0x1192('0x9')](),controller[_0x1192('0xa')]);router['get'](_0x1192('0xb'),auth[_0x1192('0x9')](),controller[_0x1192('0xc')]);router[_0x1192('0xd')](_0x1192('0xe'),auth[_0x1192('0x9')](),controller[_0x1192('0xf')]);router[_0x1192('0xd')](_0x1192('0x10'),auth[_0x1192('0x9')](),controller[_0x1192('0x11')]);router[_0x1192('0x12')]('/',auth[_0x1192('0x9')](),controller[_0x1192('0x13')]);router[_0x1192('0x12')](_0x1192('0xe'),auth[_0x1192('0x9')](),controller[_0x1192('0x14')]);router[_0x1192('0x12')](_0x1192('0x10'),auth[_0x1192('0x9')](),controller['addActions']);router['put'](_0x1192('0xb'),auth[_0x1192('0x9')](),controller[_0x1192('0x15')]);router[_0x1192('0x16')](_0x1192('0xb'),auth[_0x1192('0x9')](),controller['destroy']);module[_0x1192('0x17')]=router; \ No newline at end of file +var _0x3a22=['getActions','post','create','addConditions','addActions','put','delete','destroy','multer','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./automation.controller','get','/:id','isAuthenticated','show','/:id/conditions','getConditions','/:id/actions'];(function(_0x4d9455,_0x58b1b7){var _0x51aa7f=function(_0x5ba4b3){while(--_0x5ba4b3){_0x4d9455['push'](_0x4d9455['shift']());}};_0x51aa7f(++_0x58b1b7);}(_0x3a22,0xa9));var _0x23a2=function(_0x1e0270,_0x4e51c2){_0x1e0270=_0x1e0270-0x0;var _0x46893c=_0x3a22[_0x1e0270];return _0x46893c;};'use strict';var multer=require(_0x23a2('0x0'));var util=require('util');var path=require(_0x23a2('0x1'));var timeout=require(_0x23a2('0x2'));var express=require(_0x23a2('0x3'));var router=express[_0x23a2('0x4')]();var auth=require(_0x23a2('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x23a2('0x6'));var controller=require(_0x23a2('0x7'));router[_0x23a2('0x8')]('/',auth['isAuthenticated'](),controller['index']);router['get'](_0x23a2('0x9'),auth[_0x23a2('0xa')](),controller[_0x23a2('0xb')]);router[_0x23a2('0x8')](_0x23a2('0xc'),auth[_0x23a2('0xa')](),controller[_0x23a2('0xd')]);router[_0x23a2('0x8')](_0x23a2('0xe'),auth[_0x23a2('0xa')](),controller[_0x23a2('0xf')]);router[_0x23a2('0x10')]('/',auth['isAuthenticated'](),controller[_0x23a2('0x11')]);router['post'](_0x23a2('0xc'),auth[_0x23a2('0xa')](),controller[_0x23a2('0x12')]);router[_0x23a2('0x10')](_0x23a2('0xe'),auth[_0x23a2('0xa')](),controller[_0x23a2('0x13')]);router[_0x23a2('0x14')](_0x23a2('0x9'),auth[_0x23a2('0xa')](),controller['update']);router[_0x23a2('0x15')]('/:id',auth['isAuthenticated'](),controller[_0x23a2('0x16')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/campaign/campaign.attributes.js b/server/api/campaign/campaign.attributes.js index e0e6c10..f3c7043 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 _0x2458=['#AMD\x20Initial\x20Silence','#AMD\x20Greeting','#AMD\x20Total\x20Analysis\x20Time','#AMD\x20Between\x20Words\x20Silence','#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)','DESC','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)','#Abandoned\x20Retry\x20(min:1,\x20max:999)','Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Machine\x20Retry\x20(min:1,\x20max:999)','#AgentReject\x20Retry\x20(min:1,\x20max:999)','AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','sequelize','STRING','name','ENUM','ivr','BOOLEAN','Active/Disactive\x20Campaign','INTEGER','UNSIGNED','Max\x20200\x20calls.','Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','#Congestion\x20Retry\x20(min:1,\x20max:999)','#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)','always','never','onlyIfOpen','Active/Disactive\x20AMD'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x2458,0x182));var _0x8245=function(_0x59ee6f,_0x450239){_0x59ee6f=_0x59ee6f-0x0;var _0x4c0979=_0x2458[_0x59ee6f];return _0x4c0979;};'use strict';var Sequelize=require(_0x8245('0x0'));module['exports']={'name':{'type':Sequelize[_0x8245('0x1')],'unique':_0x8245('0x2'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'type':{'type':Sequelize[_0x8245('0x3')](_0x8245('0x4')),'allowNull':![],'defaultValue':_0x8245('0x4')},'description':{'type':Sequelize[_0x8245('0x1')]},'active':{'type':Sequelize[_0x8245('0x5')],'defaultValue':0x0,'comment':_0x8245('0x6')},'limitCalls':{'type':Sequelize[_0x8245('0x7')](0x4)[_0x8245('0x8')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0xc8},'comment':_0x8245('0x9')},'dialOriginateCallerIdName':{'type':Sequelize['STRING']},'dialOriginateCallerIdNumber':{'type':Sequelize[_0x8245('0x1')]},'dialOriginateTimeout':{'type':Sequelize[_0x8245('0x7')](0x3)[_0x8245('0x8')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0x8245('0xa')},'dialCongestionMaxRetry':{'type':Sequelize[_0x8245('0x7')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x8245('0xb')},'dialCongestionRetryFrequency':{'type':Sequelize[_0x8245('0x7')](0x5)[_0x8245('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialBusyMaxRetry':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x8245('0xc')},'dialBusyRetryFrequency':{'type':Sequelize[_0x8245('0x7')](0x5)[_0x8245('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x8245('0xd')},'dialNoAnswerMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x8245('0x8')],'defaultValue':0x3,'comment':_0x8245('0xe')},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0x8245('0x7')](0x5)[_0x8245('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x8245('0xf')},'dialGlobalMaxRetry':{'type':Sequelize[_0x8245('0x7')](0x3)[_0x8245('0x8')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0x8245('0x10')},'dialTimezone':{'type':Sequelize[_0x8245('0x1')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize['STRING'],'defaultValue':'07:00-22:00,*,*,*'},'dialCheckDuplicateType':{'type':Sequelize['ENUM'](_0x8245('0x11'),_0x8245('0x12'),_0x8245('0x13')),'defaultValue':_0x8245('0x11')},'dialAMDActive':{'type':Sequelize[_0x8245('0x5')],'defaultValue':0x0,'comment':_0x8245('0x14')},'dialAMDInitialSilence':{'type':Sequelize[_0x8245('0x7')](0x9)[_0x8245('0x8')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0x8245('0x15')},'dialAMDGreeting':{'type':Sequelize[_0x8245('0x7')](0x9)[_0x8245('0x8')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0x8245('0x16')},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0x8245('0x7')](0x9)[_0x8245('0x8')],'defaultValue':0x320,'validate':{'min':0x0},'comment':'#AMD\x20After\x20Greeting\x20Silence'},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0x8245('0x7')](0x9)['UNSIGNED'],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x8245('0x17')},'dialAMDMinWordLength':{'type':Sequelize[_0x8245('0x7')](0x9)[_0x8245('0x8')],'defaultValue':0x64,'validate':{'min':0x0},'comment':'#AMD\x20Min\x20Word\x20Length'},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0x8245('0x7')](0x9)[_0x8245('0x8')],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0x8245('0x18')},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0x8245('0x7')](0x9)[_0x8245('0x8')],'defaultValue':0x3,'validate':{'min':0x0},'comment':'#AMD\x20Maximum\x20Number\x20Of\x20Words'},'dialAMDSilenceThreshold':{'type':Sequelize['INTEGER'](0x5)[_0x8245('0x8')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0x8245('0x19')},'dialAMDMaximumWordLength':{'type':Sequelize[_0x8245('0x7')](0x9)[_0x8245('0x8')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':'#AMD\x20Maximum\x20Word\x20Length'},'dialOrderByScheduledAt':{'type':Sequelize[_0x8245('0x3')](_0x8245('0x1a'),'ASC'),'defaultValue':_0x8245('0x1a')},'dialPrefix':{'type':Sequelize[_0x8245('0x1')],'defaultValue':null},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0x8245('0x7')](0x3)['UNSIGNED'],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x8245('0x1b')},'dialCutDigit':{'type':Sequelize[_0x8245('0x7')](0x3)['UNSIGNED'],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x8245('0x1c')},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0x8245('0x7')](0x3)[_0x8245('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)'},'dialNoSuchNumberRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x8245('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x8245('0x1d')},'dialDropMaxRetry':{'type':Sequelize[_0x8245('0x7')](0x3)[_0x8245('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x8245('0x1e')},'dialDropRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x8245('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x8245('0x1f')},'dialAbandonedMaxRetry':{'type':Sequelize[_0x8245('0x7')](0x3)[_0x8245('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x8245('0x20')},'dialAbandonedRetryFrequency':{'type':Sequelize[_0x8245('0x7')](0x5)[_0x8245('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x8245('0x21')},'dialMachineMaxRetry':{'type':Sequelize[_0x8245('0x7')](0x3)[_0x8245('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x8245('0x22')},'dialMachineRetryFrequency':{'type':Sequelize[_0x8245('0x7')](0x5)[_0x8245('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialAgentRejectMaxRetry':{'type':Sequelize[_0x8245('0x7')](0x3)[_0x8245('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x8245('0x23')},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0x8245('0x7')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x8245('0x24')}}; \ No newline at end of file +var _0x8094=['#Drop\x20Retry\x20(min:1,\x20max:999)','Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Abandoned\x20Retry\x20(min:1,\x20max:999)','#Machine\x20Retry\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)','#Congestion\x20Retry\x20(min:1,\x20max:999)','#NoAnswer\x20Retry\x20(min:1,\x20max:999)','NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Global\x20Max\x20Retry\x20(min:1,\x20max:999)','07:00-22:00,*,*,*','always','onlyIfOpen','Active/Disactive\x20AMD','#AMD\x20Initial\x20Silence','#AMD\x20Min\x20Word\x20Length','#AMD\x20Between\x20Words\x20Silence','#AMD\x20Maximum\x20Number\x20Of\x20Words','#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)','ASC','DESC','Random\x20Last\x20Digit\x20(min:1,\x20max:15)','Cut\x20Digit\x20(min:1,\x20max:15)','NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'];(function(_0x2a84d6,_0x538497){var _0x55c2ea=function(_0x3f5d46){while(--_0x3f5d46){_0x2a84d6['push'](_0x2a84d6['shift']());}};_0x55c2ea(++_0x538497);}(_0x8094,0x12d));var _0x4809=function(_0x474bc0,_0x26989c){_0x474bc0=_0x474bc0-0x0;var _0x4b24cf=_0x8094[_0x474bc0];return _0x4b24cf;};'use strict';var Sequelize=require('sequelize');module[_0x4809('0x0')]={'name':{'type':Sequelize[_0x4809('0x1')],'unique':_0x4809('0x2'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'type':{'type':Sequelize[_0x4809('0x3')]('ivr'),'allowNull':![],'defaultValue':_0x4809('0x4')},'description':{'type':Sequelize[_0x4809('0x1')]},'active':{'type':Sequelize[_0x4809('0x5')],'defaultValue':0x0,'comment':_0x4809('0x6')},'limitCalls':{'type':Sequelize[_0x4809('0x7')](0x4)[_0x4809('0x8')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0xc8},'comment':_0x4809('0x9')},'dialOriginateCallerIdName':{'type':Sequelize['STRING']},'dialOriginateCallerIdNumber':{'type':Sequelize[_0x4809('0x1')]},'dialOriginateTimeout':{'type':Sequelize['INTEGER'](0x3)[_0x4809('0x8')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0x4809('0xa')},'dialCongestionMaxRetry':{'type':Sequelize[_0x4809('0x7')](0x3)[_0x4809('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x4809('0xb')},'dialCongestionRetryFrequency':{'type':Sequelize[_0x4809('0x7')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialBusyMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x4809('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Busy\x20Retry\x20(min:1,\x20max:999)'},'dialBusyRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x4809('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialNoAnswerMaxRetry':{'type':Sequelize[_0x4809('0x7')](0x3)[_0x4809('0x8')],'defaultValue':0x3,'comment':_0x4809('0xc')},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0x4809('0x7')](0x5)[_0x4809('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x4809('0xd')},'dialGlobalMaxRetry':{'type':Sequelize[_0x4809('0x7')](0x3)['UNSIGNED'],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0x4809('0xe')},'dialTimezone':{'type':Sequelize[_0x4809('0x1')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize['STRING'],'defaultValue':_0x4809('0xf')},'dialCheckDuplicateType':{'type':Sequelize['ENUM'](_0x4809('0x10'),'never',_0x4809('0x11')),'defaultValue':_0x4809('0x10')},'dialAMDActive':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':_0x4809('0x12')},'dialAMDInitialSilence':{'type':Sequelize[_0x4809('0x7')](0x9)[_0x4809('0x8')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0x4809('0x13')},'dialAMDGreeting':{'type':Sequelize['INTEGER'](0x9)[_0x4809('0x8')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':'#AMD\x20Greeting'},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0x4809('0x7')](0x9)[_0x4809('0x8')],'defaultValue':0x320,'validate':{'min':0x0},'comment':'#AMD\x20After\x20Greeting\x20Silence'},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0x4809('0x7')](0x9)[_0x4809('0x8')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':'#AMD\x20Total\x20Analysis\x20Time'},'dialAMDMinWordLength':{'type':Sequelize[_0x4809('0x7')](0x9)[_0x4809('0x8')],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0x4809('0x14')},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0x4809('0x7')](0x9)[_0x4809('0x8')],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0x4809('0x15')},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0x4809('0x7')](0x9)[_0x4809('0x8')],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0x4809('0x16')},'dialAMDSilenceThreshold':{'type':Sequelize[_0x4809('0x7')](0x5)['UNSIGNED'],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0x4809('0x17')},'dialAMDMaximumWordLength':{'type':Sequelize[_0x4809('0x7')](0x9)['UNSIGNED'],'defaultValue':0x1388,'validate':{'min':0x0},'comment':'#AMD\x20Maximum\x20Word\x20Length'},'dialOrderByScheduledAt':{'type':Sequelize['ENUM']('DESC',_0x4809('0x18')),'defaultValue':_0x4809('0x19')},'dialPrefix':{'type':Sequelize[_0x4809('0x1')],'defaultValue':null},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize['INTEGER'](0x3)[_0x4809('0x8')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x4809('0x1a')},'dialCutDigit':{'type':Sequelize['INTEGER'](0x3)[_0x4809('0x8')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x4809('0x1b')},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0x4809('0x7')](0x3)[_0x4809('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)'},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0x4809('0x7')](0x5)[_0x4809('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x4809('0x1c')},'dialDropMaxRetry':{'type':Sequelize[_0x4809('0x7')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x4809('0x1d')},'dialDropRetryFrequency':{'type':Sequelize[_0x4809('0x7')](0x5)[_0x4809('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x4809('0x1e')},'dialAbandonedMaxRetry':{'type':Sequelize[_0x4809('0x7')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x4809('0x1f')},'dialAbandonedRetryFrequency':{'type':Sequelize[_0x4809('0x7')](0x5)[_0x4809('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialMachineMaxRetry':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x4809('0x20')},'dialMachineRetryFrequency':{'type':Sequelize[_0x4809('0x7')](0x5)[_0x4809('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialAgentRejectMaxRetry':{'type':Sequelize[_0x4809('0x7')](0x3)[_0x4809('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#AgentReject\x20Retry\x20(min:1,\x20max:999)'},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0x4809('0x7')](0x5)[_0x4809('0x8')],'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 555a3d4..a6a418e 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 _0x29bc=['clone','omit','createdAt','updatedAt','body','getHoppers','hasOwnProperty','order','rows','CmHopperHistory','CampaignId','getHopperFinals','findOne','CmHopperFinal','getHopperBlacks','getLists','CmList','addLists','ids','dialCheckDuplicateType','always','insert','into','cm_hopper','fromQuery','phone','scheduledAt','ContactId','ListId','select','field','NOW()','CmListId','toString','from','cm_contacts','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','COALESCE(calleridnum,\x27\x27)','CampaignId\x20=\x20?','onlyIfOpen','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','COALESCE(phone,\x27\x27)','push','sequelize','all','removeLists','CmHopper','destroy','getBlackLists','addBlackLists','spread','cm_hopper_black','removeBlackLists','CmHopperBlack','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','api','../../config/environment','../../mysqldb','status','end','json','count','offset','limit','set','apply','save','update','then','get','IvrCampaigns','UserProfileResource','sendStatus','error','stack','name','send','map','Campaign','fieldName','key','model','query','filters','intersection','fields','attributes','length','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','catch','params','keys','rawAttributes','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s'];(function(_0x2431ba,_0x208094){var _0x21da30=function(_0x572155){while(--_0x572155){_0x2431ba['push'](_0x2431ba['shift']());}};_0x21da30(++_0x208094);}(_0x29bc,0x146));var _0xc29b=function(_0x173441,_0x26b0d9){_0x173441=_0x173441-0x0;var _0x2423a8=_0x29bc[_0x173441];return _0x2423a8;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xc29b('0x0'));var rimraf=require(_0xc29b('0x1'));var zipdir=require(_0xc29b('0x2'));var jsonpatch=require(_0xc29b('0x3'));var rp=require(_0xc29b('0x4'));var moment=require('moment');var BPromise=require(_0xc29b('0x5'));var Mustache=require(_0xc29b('0x6'));var util=require(_0xc29b('0x7'));var path=require(_0xc29b('0x8'));var sox=require(_0xc29b('0x9'));var csv=require(_0xc29b('0xa'));var ejs=require(_0xc29b('0xb'));var fs=require('fs');var _=require(_0xc29b('0xc'));var squel=require(_0xc29b('0xd'));var crypto=require(_0xc29b('0xe'));var jsforce=require(_0xc29b('0xf'));var deskjs=require(_0xc29b('0x10'));var toCsv=require(_0xc29b('0xa'));var querystring=require(_0xc29b('0x11'));var Papa=require(_0xc29b('0x12'));var Redis=require(_0xc29b('0x13'));var authService=require(_0xc29b('0x14'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xc29b('0x15'));var logger=require('../../config/logger')(_0xc29b('0x16'));var utils=require('../../config/utils');var config=require(_0xc29b('0x17'));var db=require(_0xc29b('0x18'))['db'];function respondWithStatusCode(_0x3b2bbd,_0xcfbf36){_0xcfbf36=_0xcfbf36||0xcc;return function(_0x340a73){if(_0x340a73){return _0x3b2bbd['sendStatus'](_0xcfbf36);}return _0x3b2bbd[_0xc29b('0x19')](_0xcfbf36)[_0xc29b('0x1a')]();};}function respondWithResult(_0x2d7691,_0x419f5c){_0x419f5c=_0x419f5c||0xc8;return function(_0x3e9006){if(_0x3e9006){return _0x2d7691[_0xc29b('0x19')](_0x419f5c)[_0xc29b('0x1b')](_0x3e9006);}};}function respondWithFilteredResult(_0x3b4d85,_0x27a19a){return function(_0x2b80e9){if(_0x2b80e9){var _0x484e63=_0x2b80e9[_0xc29b('0x1c')],_0x297d7a=_0x27a19a[_0xc29b('0x1d')],_0x382417=_0x27a19a['offset']+_0x27a19a[_0xc29b('0x1e')],_0x4b3e6e;if(_0x382417>=_0x484e63){_0x382417=_0x484e63;_0x4b3e6e=0xc8;}else{_0x4b3e6e=0xce;}_0x3b4d85[_0xc29b('0x19')](_0x4b3e6e);return _0x3b4d85[_0xc29b('0x1f')]('Content-Range',_0x297d7a+'-'+_0x382417+'/'+_0x484e63)[_0xc29b('0x1b')](_0x2b80e9);}return null;};}function patchUpdates(_0xcf618c){return function(_0x4f1f73){try{jsonpatch[_0xc29b('0x20')](_0x4f1f73,_0xcf618c,!![]);}catch(_0x1ecb82){return BPromise['reject'](_0x1ecb82);}return _0x4f1f73[_0xc29b('0x21')]();};}function saveUpdates(_0x567270,_0x473246){return function(_0x59a82e){if(_0x59a82e){return _0x59a82e[_0xc29b('0x22')](_0x567270)[_0xc29b('0x23')](function(_0xb74294){return _0xb74294;});}return null;};}function removeEntity(_0x3c1754,_0x2c280f){return function(_0x3ebea0){if(_0x3ebea0){return _0x3ebea0['destroy']()[_0xc29b('0x23')](function(){var _0x318619=_0x3ebea0[_0xc29b('0x24')]({'plain':!![]});var _0x79ec00=_0xc29b('0x25');return db[_0xc29b('0x26')]['destroy']({'where':{'type':_0x79ec00,'resourceId':_0x318619['id']}})['then'](function(){return _0x3ebea0;});})[_0xc29b('0x23')](function(){_0x3c1754['status'](0xcc)[_0xc29b('0x1a')]();});}};}function handleEntityNotFound(_0x3608d2,_0x58ff5e){return function(_0x1f9d6f){if(!_0x1f9d6f){_0x3608d2[_0xc29b('0x27')](0x194);}return _0x1f9d6f;};}function handleError(_0x3bf257,_0x2e4df8){_0x2e4df8=_0x2e4df8||0x1f4;return function(_0xfffecf){logger[_0xc29b('0x28')](_0xfffecf[_0xc29b('0x29')]);if(_0xfffecf[_0xc29b('0x2a')]){delete _0xfffecf['name'];}_0x3bf257[_0xc29b('0x19')](_0x2e4df8)[_0xc29b('0x2b')](_0xfffecf);};}exports['index']=function(_0x517329,_0x50ccb1){var _0x25f079={},_0x3ec5d5={},_0x55b5ca={'count':0x0,'rows':[]};var _0xb79d00=_[_0xc29b('0x2c')](db[_0xc29b('0x2d')]['rawAttributes'],function(_0xf304c1){return{'name':_0xf304c1[_0xc29b('0x2e')],'type':_0xf304c1['type'][_0xc29b('0x2f')]};});_0x3ec5d5[_0xc29b('0x30')]=_[_0xc29b('0x2c')](_0xb79d00,_0xc29b('0x2a'));_0x3ec5d5[_0xc29b('0x31')]=_['keys'](_0x517329['query']);_0x3ec5d5[_0xc29b('0x32')]=_[_0xc29b('0x33')](_0x3ec5d5['model'],_0x3ec5d5[_0xc29b('0x31')]);_0x25f079['attributes']=_[_0xc29b('0x33')](_0x3ec5d5[_0xc29b('0x30')],qs['fields'](_0x517329[_0xc29b('0x31')][_0xc29b('0x34')]));_0x25f079[_0xc29b('0x35')]=_0x25f079[_0xc29b('0x35')][_0xc29b('0x36')]?_0x25f079[_0xc29b('0x35')]:_0x3ec5d5[_0xc29b('0x30')];if(!_0x517329[_0xc29b('0x31')]['hasOwnProperty'](_0xc29b('0x37'))){_0x25f079[_0xc29b('0x1e')]=qs['limit'](_0x517329[_0xc29b('0x31')][_0xc29b('0x1e')]);_0x25f079[_0xc29b('0x1d')]=qs[_0xc29b('0x1d')](_0x517329['query'][_0xc29b('0x1d')]);}_0x25f079['order']=qs[_0xc29b('0x38')](_0x517329[_0xc29b('0x31')][_0xc29b('0x38')]);_0x25f079[_0xc29b('0x39')]=qs[_0xc29b('0x32')](_[_0xc29b('0x3a')](_0x517329[_0xc29b('0x31')],_0x3ec5d5[_0xc29b('0x32')]),_0xb79d00);if(_0x517329[_0xc29b('0x31')][_0xc29b('0x3b')]){_0x25f079[_0xc29b('0x39')]=_[_0xc29b('0x3c')](_0x25f079[_0xc29b('0x39')],{'$or':_[_0xc29b('0x2c')](_0xb79d00,function(_0x5689cb){if(_0x5689cb['type']!==_0xc29b('0x3d')){var _0x8dcd07={};_0x8dcd07[_0x5689cb[_0xc29b('0x2a')]]={'$like':'%'+_0x517329['query'][_0xc29b('0x3b')]+'%'};return _0x8dcd07;}})});}_0x25f079=_[_0xc29b('0x3c')]({},_0x25f079,_0x517329[_0xc29b('0x3e')]);var _0x1c97f1={'where':_0x25f079[_0xc29b('0x39')]};return db[_0xc29b('0x2d')][_0xc29b('0x1c')](_0x1c97f1)[_0xc29b('0x23')](function(_0x3e4a36){_0x55b5ca[_0xc29b('0x1c')]=_0x3e4a36;if(_0x517329[_0xc29b('0x31')][_0xc29b('0x3f')]){_0x25f079[_0xc29b('0x40')]=[{'all':!![]}];}return db[_0xc29b('0x2d')][_0xc29b('0x41')](_0x25f079);})[_0xc29b('0x23')](function(_0x23c9c6){_0x55b5ca['rows']=_0x23c9c6;return _0x55b5ca;})[_0xc29b('0x23')](respondWithFilteredResult(_0x50ccb1,_0x25f079))[_0xc29b('0x42')](handleError(_0x50ccb1,null));};exports['show']=function(_0x37c949,_0x1566bf){var _0x4e0b1b={'raw':![],'where':{'id':_0x37c949[_0xc29b('0x43')]['id']}},_0x1ee371={};_0x1ee371[_0xc29b('0x30')]=_[_0xc29b('0x44')](db[_0xc29b('0x2d')][_0xc29b('0x45')]);_0x1ee371[_0xc29b('0x31')]=_[_0xc29b('0x44')](_0x37c949[_0xc29b('0x31')]);_0x1ee371['filters']=_[_0xc29b('0x33')](_0x1ee371[_0xc29b('0x30')],_0x1ee371['query']);_0x4e0b1b[_0xc29b('0x35')]=_[_0xc29b('0x33')](_0x1ee371[_0xc29b('0x30')],qs[_0xc29b('0x34')](_0x37c949['query'][_0xc29b('0x34')]));_0x4e0b1b[_0xc29b('0x35')]=_0x4e0b1b['attributes'][_0xc29b('0x36')]?_0x4e0b1b[_0xc29b('0x35')]:_0x1ee371[_0xc29b('0x30')];if(_0x37c949[_0xc29b('0x31')][_0xc29b('0x3f')]){_0x4e0b1b[_0xc29b('0x40')]=[{'all':!![]}];}_0x4e0b1b=_[_0xc29b('0x3c')]({},_0x4e0b1b,_0x37c949[_0xc29b('0x3e')]);return db[_0xc29b('0x2d')]['find'](_0x4e0b1b)[_0xc29b('0x23')](handleEntityNotFound(_0x1566bf,null))['then'](respondWithResult(_0x1566bf,null))[_0xc29b('0x42')](handleError(_0x1566bf,null));};exports[_0xc29b('0x46')]=function(_0x258cda,_0x40e6f1){return db[_0xc29b('0x2d')]['create'](_0x258cda['body'],{})[_0xc29b('0x23')](function(_0x182778){var _0x4272af=_0x258cda[_0xc29b('0x47')][_0xc29b('0x24')]({'plain':!![]});if(!_0x4272af)throw new Error(_0xc29b('0x48'));if(_0x4272af[_0xc29b('0x49')]==='user'){var _0x124026=_0x182778['get']({'plain':!![]});var _0xb7c815=_0xc29b('0x25');return db[_0xc29b('0x4a')][_0xc29b('0x4b')]({'where':{'name':_0xb7c815,'userProfileId':_0x4272af[_0xc29b('0x4c')]},'raw':!![]})['then'](function(_0x363f17){if(_0x363f17&&_0x363f17[_0xc29b('0x4d')]===0x0){return db[_0xc29b('0x26')][_0xc29b('0x46')]({'name':_0x124026[_0xc29b('0x2a')],'resourceId':_0x124026['id'],'type':_0x363f17[_0xc29b('0x2a')],'sectionId':_0x363f17['id']},{})[_0xc29b('0x23')](function(){return _0x182778;});}else{return _0x182778;}})[_0xc29b('0x42')](function(_0x510c47){logger['error'](_0xc29b('0x4e'),_0x510c47);throw _0x510c47;});}return _0x182778;})['then'](respondWithResult(_0x40e6f1,0xc9))[_0xc29b('0x42')](handleError(_0x40e6f1,null));};exports[_0xc29b('0x4f')]=function(_0x232ae6,_0x464178){var _0x429204={'where':{'id':_0x232ae6[_0xc29b('0x43')]['id']}},_0x224f0c={};_0x224f0c[_0xc29b('0x30')]=_[_0xc29b('0x44')](db[_0xc29b('0x2d')][_0xc29b('0x45')]);_0x429204[_0xc29b('0x35')]=_[_0xc29b('0x33')](_0x224f0c[_0xc29b('0x30')],qs[_0xc29b('0x34')](_0x232ae6[_0xc29b('0x31')][_0xc29b('0x34')]));_0x429204[_0xc29b('0x35')]=_0x429204[_0xc29b('0x35')][_0xc29b('0x36')]?_0x429204[_0xc29b('0x35')]:_0x224f0c['model'];if(_0x232ae6[_0xc29b('0x31')][_0xc29b('0x3f')]){_0x429204[_0xc29b('0x40')]=[{'all':!![]}];}_0x429204=_[_0xc29b('0x3c')]({},_0x429204,_0x232ae6[_0xc29b('0x3e')]);return db[_0xc29b('0x2d')][_0xc29b('0x4b')](_0x429204)[_0xc29b('0x23')](handleEntityNotFound(_0x464178,null))['then'](function(_0x31f0ac){if(_0x31f0ac){var _0x165b8f=_0x31f0ac['get']({'plain':!![]});_0x165b8f=qs[_0xc29b('0x50')](_0x165b8f,['id',_0xc29b('0x51'),_0xc29b('0x52')]);_0x232ae6[_0xc29b('0x53')]=_[_0xc29b('0x50')](_0x232ae6[_0xc29b('0x53')],['id',_0xc29b('0x51'),_0xc29b('0x52')]);return db[_0xc29b('0x2d')][_0xc29b('0x46')](_['merge'](_0x165b8f,_0x232ae6[_0xc29b('0x53')]),{'include':_0x232ae6[_0xc29b('0x31')][_0xc29b('0x3f')]?[{'all':!![]}]:undefined})[_0xc29b('0x23')](function(_0x304532){var _0x113c75=_0x232ae6['user'][_0xc29b('0x24')]({'plain':!![]});if(!_0x113c75)throw new Error(_0xc29b('0x48'));if(_0x113c75[_0xc29b('0x49')]===_0xc29b('0x47')){var _0x406d2c=_0x304532[_0xc29b('0x24')]({'plain':!![]});var _0x185e23=_0xc29b('0x25');return db['UserProfileSection'][_0xc29b('0x4b')]({'where':{'name':_0x185e23,'userProfileId':_0x113c75['userProfileId']},'raw':!![]})[_0xc29b('0x23')](function(_0x3bd32f){if(_0x3bd32f&&_0x3bd32f[_0xc29b('0x4d')]===0x0){return db[_0xc29b('0x26')][_0xc29b('0x46')]({'name':_0x406d2c['name'],'resourceId':_0x406d2c['id'],'type':_0x3bd32f['name'],'sectionId':_0x3bd32f['id']},{})[_0xc29b('0x23')](function(){return _0x304532;});}else{return _0x304532;}})[_0xc29b('0x42')](function(_0x1de4da){logger[_0xc29b('0x28')](_0xc29b('0x4e'),_0x1de4da);throw _0x1de4da;});}return _0x304532;});}})[_0xc29b('0x23')](respondWithResult(_0x464178,0xc9))['catch'](handleError(_0x464178,null));};exports[_0xc29b('0x22')]=function(_0x35ad7c,_0xabb277){if(_0x35ad7c[_0xc29b('0x53')]['id']){delete _0x35ad7c['body']['id'];}return db[_0xc29b('0x2d')]['find']({'where':{'id':_0x35ad7c[_0xc29b('0x43')]['id']}})[_0xc29b('0x23')](handleEntityNotFound(_0xabb277,null))[_0xc29b('0x23')](saveUpdates(_0x35ad7c[_0xc29b('0x53')],null))['then'](respondWithResult(_0xabb277,null))[_0xc29b('0x42')](handleError(_0xabb277,null));};exports['destroy']=function(_0x47ad62,_0x143de7){return db[_0xc29b('0x2d')][_0xc29b('0x4b')]({'where':{'id':_0x47ad62[_0xc29b('0x43')]['id']}})[_0xc29b('0x23')](handleEntityNotFound(_0x143de7,null))[_0xc29b('0x23')](removeEntity(_0x143de7,null))['catch'](handleError(_0x143de7,null));};exports[_0xc29b('0x54')]=function(_0xba0560,_0x593710,_0x1f4021){var _0xd0eac9={'raw':!![],'where':{}};var _0x53e344={};var _0x40489a={'count':0x0,'rows':[]};return db[_0xc29b('0x2d')]['findOne']({'where':{'id':_0xba0560[_0xc29b('0x43')]['id']}})[_0xc29b('0x23')](handleEntityNotFound(_0x593710,null))[_0xc29b('0x23')](function(_0x7989d6){if(_0x7989d6){_0x53e344[_0xc29b('0x30')]=_[_0xc29b('0x44')](db['CmHopper'][_0xc29b('0x45')]);_0x53e344['query']=_[_0xc29b('0x44')](_0xba0560[_0xc29b('0x31')]);_0x53e344[_0xc29b('0x32')]=_[_0xc29b('0x33')](_0x53e344[_0xc29b('0x30')],_0x53e344[_0xc29b('0x31')]);_0xd0eac9[_0xc29b('0x35')]=_[_0xc29b('0x33')](_0x53e344[_0xc29b('0x30')],qs['fields'](_0xba0560[_0xc29b('0x31')][_0xc29b('0x34')]));_0xd0eac9[_0xc29b('0x35')]=_0xd0eac9['attributes'][_0xc29b('0x36')]?_0xd0eac9[_0xc29b('0x35')]:_0x53e344[_0xc29b('0x30')];if(!_0xba0560[_0xc29b('0x31')][_0xc29b('0x55')](_0xc29b('0x37'))){_0xd0eac9['limit']=qs['limit'](_0xba0560[_0xc29b('0x31')][_0xc29b('0x1e')]);_0xd0eac9[_0xc29b('0x1d')]=qs[_0xc29b('0x1d')](_0xba0560[_0xc29b('0x31')][_0xc29b('0x1d')]);}_0xd0eac9[_0xc29b('0x56')]=qs[_0xc29b('0x38')](_0xba0560[_0xc29b('0x31')][_0xc29b('0x38')]);_0xd0eac9[_0xc29b('0x39')]=qs['filters'](_[_0xc29b('0x3a')](_0xba0560['query'],_0x53e344[_0xc29b('0x32')]));_0xd0eac9[_0xc29b('0x39')]['CampaignId']=_0x7989d6['id'];if(_0xba0560[_0xc29b('0x31')][_0xc29b('0x3b')]){_0xd0eac9['where']=_['merge'](_0xd0eac9[_0xc29b('0x39')],{'$or':_[_0xc29b('0x2c')](_0xd0eac9[_0xc29b('0x35')],function(_0x49b2ba){var _0xa6102={};_0xa6102[_0x49b2ba]={'$like':'%'+_0xba0560[_0xc29b('0x31')][_0xc29b('0x3b')]+'%'};return _0xa6102;})});}_0xd0eac9=_[_0xc29b('0x3c')]({},_0xd0eac9,_0xba0560['options']);return db['CmHopper'][_0xc29b('0x1c')]({'where':_0xd0eac9[_0xc29b('0x39')]})[_0xc29b('0x23')](function(_0x54f6ef){_0x40489a[_0xc29b('0x1c')]=_0x54f6ef;if(_0xba0560[_0xc29b('0x31')]['includeAll']){_0xd0eac9[_0xc29b('0x40')]=[{'all':!![]}];}return db['CmHopper'][_0xc29b('0x41')](_0xd0eac9);})[_0xc29b('0x23')](function(_0x5eaf5a){_0x40489a[_0xc29b('0x57')]=_0x5eaf5a;return _0x40489a;});}})[_0xc29b('0x23')](respondWithFilteredResult(_0x593710,_0xd0eac9))[_0xc29b('0x42')](handleError(_0x593710,null));};exports['getHopperHistories']=function(_0x34dbc3,_0x2c0de5,_0x5dc17f){var _0x26be26={'raw':!![],'where':{}};var _0x1979c8={};var _0x5d3b7e={'count':0x0,'rows':[]};return db[_0xc29b('0x2d')]['findOne']({'where':{'id':_0x34dbc3[_0xc29b('0x43')]['id']}})['then'](handleEntityNotFound(_0x2c0de5,null))['then'](function(_0x4cfba0){if(_0x4cfba0){_0x1979c8[_0xc29b('0x30')]=_[_0xc29b('0x44')](db[_0xc29b('0x58')][_0xc29b('0x45')]);_0x1979c8[_0xc29b('0x31')]=_['keys'](_0x34dbc3[_0xc29b('0x31')]);_0x1979c8[_0xc29b('0x32')]=_[_0xc29b('0x33')](_0x1979c8[_0xc29b('0x30')],_0x1979c8[_0xc29b('0x31')]);_0x26be26[_0xc29b('0x35')]=_['intersection'](_0x1979c8[_0xc29b('0x30')],qs['fields'](_0x34dbc3[_0xc29b('0x31')][_0xc29b('0x34')]));_0x26be26['attributes']=_0x26be26[_0xc29b('0x35')][_0xc29b('0x36')]?_0x26be26[_0xc29b('0x35')]:_0x1979c8[_0xc29b('0x30')];if(!_0x34dbc3[_0xc29b('0x31')][_0xc29b('0x55')](_0xc29b('0x37'))){_0x26be26['limit']=qs['limit'](_0x34dbc3[_0xc29b('0x31')]['limit']);_0x26be26[_0xc29b('0x1d')]=qs[_0xc29b('0x1d')](_0x34dbc3['query'][_0xc29b('0x1d')]);}_0x26be26[_0xc29b('0x56')]=qs[_0xc29b('0x38')](_0x34dbc3['query']['sort']);_0x26be26[_0xc29b('0x39')]=qs['filters'](_[_0xc29b('0x3a')](_0x34dbc3[_0xc29b('0x31')],_0x1979c8[_0xc29b('0x32')]));_0x26be26[_0xc29b('0x39')][_0xc29b('0x59')]=_0x4cfba0['id'];if(_0x34dbc3[_0xc29b('0x31')][_0xc29b('0x3b')]){_0x26be26[_0xc29b('0x39')]=_[_0xc29b('0x3c')](_0x26be26[_0xc29b('0x39')],{'$or':_[_0xc29b('0x2c')](_0x26be26['attributes'],function(_0x1c942e){var _0xe7baf2={};_0xe7baf2[_0x1c942e]={'$like':'%'+_0x34dbc3[_0xc29b('0x31')][_0xc29b('0x3b')]+'%'};return _0xe7baf2;})});}_0x26be26=_[_0xc29b('0x3c')]({},_0x26be26,_0x34dbc3[_0xc29b('0x3e')]);return db[_0xc29b('0x58')][_0xc29b('0x1c')]({'where':_0x26be26[_0xc29b('0x39')]})[_0xc29b('0x23')](function(_0xde7611){_0x5d3b7e[_0xc29b('0x1c')]=_0xde7611;if(_0x34dbc3['query'][_0xc29b('0x3f')]){_0x26be26['include']=[{'all':!![]}];}return db[_0xc29b('0x58')][_0xc29b('0x41')](_0x26be26);})[_0xc29b('0x23')](function(_0x530fff){_0x5d3b7e[_0xc29b('0x57')]=_0x530fff;return _0x5d3b7e;});}})[_0xc29b('0x23')](respondWithFilteredResult(_0x2c0de5,_0x26be26))[_0xc29b('0x42')](handleError(_0x2c0de5,null));};exports[_0xc29b('0x5a')]=function(_0x1142bf,_0x13dee5,_0x5608db){var _0xe7feae={'raw':!![],'where':{}};var _0x27cdae={};var _0x13e185={'count':0x0,'rows':[]};return db['Campaign'][_0xc29b('0x5b')]({'where':{'id':_0x1142bf['params']['id']}})[_0xc29b('0x23')](handleEntityNotFound(_0x13dee5,null))[_0xc29b('0x23')](function(_0x25ada9){if(_0x25ada9){_0x27cdae[_0xc29b('0x30')]=_[_0xc29b('0x44')](db[_0xc29b('0x5c')][_0xc29b('0x45')]);_0x27cdae[_0xc29b('0x31')]=_[_0xc29b('0x44')](_0x1142bf[_0xc29b('0x31')]);_0x27cdae[_0xc29b('0x32')]=_['intersection'](_0x27cdae[_0xc29b('0x30')],_0x27cdae[_0xc29b('0x31')]);_0xe7feae[_0xc29b('0x35')]=_[_0xc29b('0x33')](_0x27cdae[_0xc29b('0x30')],qs['fields'](_0x1142bf[_0xc29b('0x31')][_0xc29b('0x34')]));_0xe7feae[_0xc29b('0x35')]=_0xe7feae[_0xc29b('0x35')][_0xc29b('0x36')]?_0xe7feae[_0xc29b('0x35')]:_0x27cdae['model'];if(!_0x1142bf['query'][_0xc29b('0x55')](_0xc29b('0x37'))){_0xe7feae[_0xc29b('0x1e')]=qs['limit'](_0x1142bf['query'][_0xc29b('0x1e')]);_0xe7feae[_0xc29b('0x1d')]=qs['offset'](_0x1142bf['query'][_0xc29b('0x1d')]);}_0xe7feae[_0xc29b('0x56')]=qs[_0xc29b('0x38')](_0x1142bf['query'][_0xc29b('0x38')]);_0xe7feae[_0xc29b('0x39')]=qs[_0xc29b('0x32')](_['pick'](_0x1142bf[_0xc29b('0x31')],_0x27cdae[_0xc29b('0x32')]));_0xe7feae[_0xc29b('0x39')][_0xc29b('0x59')]=_0x25ada9['id'];if(_0x1142bf[_0xc29b('0x31')][_0xc29b('0x3b')]){_0xe7feae[_0xc29b('0x39')]=_[_0xc29b('0x3c')](_0xe7feae[_0xc29b('0x39')],{'$or':_[_0xc29b('0x2c')](_0xe7feae['attributes'],function(_0x4a45b1){var _0x38017b={};_0x38017b[_0x4a45b1]={'$like':'%'+_0x1142bf[_0xc29b('0x31')][_0xc29b('0x3b')]+'%'};return _0x38017b;})});}_0xe7feae=_[_0xc29b('0x3c')]({},_0xe7feae,_0x1142bf[_0xc29b('0x3e')]);return db[_0xc29b('0x5c')][_0xc29b('0x1c')]({'where':_0xe7feae['where']})[_0xc29b('0x23')](function(_0x5b13dd){_0x13e185['count']=_0x5b13dd;if(_0x1142bf['query'][_0xc29b('0x3f')]){_0xe7feae[_0xc29b('0x40')]=[{'all':!![]}];}return db[_0xc29b('0x5c')][_0xc29b('0x41')](_0xe7feae);})[_0xc29b('0x23')](function(_0x4693c6){_0x13e185['rows']=_0x4693c6;return _0x13e185;});}})['then'](respondWithFilteredResult(_0x13dee5,_0xe7feae))['catch'](handleError(_0x13dee5,null));};exports[_0xc29b('0x5d')]=function(_0x48a8f7,_0x1737ef,_0x58beee){var _0x549368={'raw':!![],'where':{}};var _0x549833={};var _0x24b4a2={'count':0x0,'rows':[]};return db[_0xc29b('0x2d')][_0xc29b('0x5b')]({'where':{'id':_0x48a8f7[_0xc29b('0x43')]['id']}})['then'](handleEntityNotFound(_0x1737ef,null))[_0xc29b('0x23')](function(_0x2a935a){if(_0x2a935a){_0x549833[_0xc29b('0x30')]=_[_0xc29b('0x44')](db['CmHopperBlack']['rawAttributes']);_0x549833['query']=_[_0xc29b('0x44')](_0x48a8f7[_0xc29b('0x31')]);_0x549833[_0xc29b('0x32')]=_[_0xc29b('0x33')](_0x549833[_0xc29b('0x30')],_0x549833[_0xc29b('0x31')]);_0x549368[_0xc29b('0x35')]=_['intersection'](_0x549833['model'],qs['fields'](_0x48a8f7['query']['fields']));_0x549368['attributes']=_0x549368[_0xc29b('0x35')]['length']?_0x549368[_0xc29b('0x35')]:_0x549833[_0xc29b('0x30')];if(!_0x48a8f7[_0xc29b('0x31')][_0xc29b('0x55')](_0xc29b('0x37'))){_0x549368['limit']=qs[_0xc29b('0x1e')](_0x48a8f7[_0xc29b('0x31')]['limit']);_0x549368[_0xc29b('0x1d')]=qs[_0xc29b('0x1d')](_0x48a8f7[_0xc29b('0x31')][_0xc29b('0x1d')]);}_0x549368['order']=qs[_0xc29b('0x38')](_0x48a8f7[_0xc29b('0x31')][_0xc29b('0x38')]);_0x549368[_0xc29b('0x39')]=qs['filters'](_[_0xc29b('0x3a')](_0x48a8f7[_0xc29b('0x31')],_0x549833['filters']));_0x549368[_0xc29b('0x39')][_0xc29b('0x59')]=_0x2a935a['id'];if(_0x48a8f7[_0xc29b('0x31')][_0xc29b('0x3b')]){_0x549368['where']=_[_0xc29b('0x3c')](_0x549368[_0xc29b('0x39')],{'$or':_['map'](_0x549368['attributes'],function(_0x29f352){var _0x29bdd9={};_0x29bdd9[_0x29f352]={'$like':'%'+_0x48a8f7[_0xc29b('0x31')][_0xc29b('0x3b')]+'%'};return _0x29bdd9;})});}_0x549368=_[_0xc29b('0x3c')]({},_0x549368,_0x48a8f7[_0xc29b('0x3e')]);return db['CmHopperBlack'][_0xc29b('0x1c')]({'where':_0x549368[_0xc29b('0x39')]})['then'](function(_0x44730a){_0x24b4a2['count']=_0x44730a;if(_0x48a8f7[_0xc29b('0x31')]['includeAll']){_0x549368[_0xc29b('0x40')]=[{'all':!![]}];}return db['CmHopperBlack']['findAll'](_0x549368);})[_0xc29b('0x23')](function(_0x4b307a){_0x24b4a2[_0xc29b('0x57')]=_0x4b307a;return _0x24b4a2;});}})[_0xc29b('0x23')](respondWithFilteredResult(_0x1737ef,_0x549368))[_0xc29b('0x42')](handleError(_0x1737ef,null));};exports[_0xc29b('0x5e')]=function(_0x1af331,_0x859929,_0x48ff87){var _0x33670f={};var _0x54514b={};var _0x5cabd7;var _0x7cab81;return db[_0xc29b('0x2d')]['findOne']({'where':{'id':_0x1af331[_0xc29b('0x43')]['id']}})[_0xc29b('0x23')](handleEntityNotFound(_0x859929,null))['then'](function(_0x346a6c){if(_0x346a6c){_0x5cabd7=_0x346a6c;_0x54514b[_0xc29b('0x30')]=_[_0xc29b('0x44')](db[_0xc29b('0x5f')][_0xc29b('0x45')]);_0x54514b[_0xc29b('0x31')]=_[_0xc29b('0x44')](_0x1af331[_0xc29b('0x31')]);_0x54514b[_0xc29b('0x32')]=_[_0xc29b('0x33')](_0x54514b[_0xc29b('0x30')],_0x54514b['query']);_0x33670f[_0xc29b('0x35')]=_[_0xc29b('0x33')](_0x54514b[_0xc29b('0x30')],qs[_0xc29b('0x34')](_0x1af331[_0xc29b('0x31')][_0xc29b('0x34')]));_0x33670f[_0xc29b('0x35')]=_0x33670f['attributes'][_0xc29b('0x36')]?_0x33670f['attributes']:_0x54514b['model'];_0x33670f[_0xc29b('0x56')]=qs[_0xc29b('0x38')](_0x1af331[_0xc29b('0x31')][_0xc29b('0x38')]);_0x33670f[_0xc29b('0x39')]=qs[_0xc29b('0x32')](_[_0xc29b('0x3a')](_0x1af331[_0xc29b('0x31')],_0x54514b[_0xc29b('0x32')]));if(_0x1af331[_0xc29b('0x31')][_0xc29b('0x3b')]){_0x33670f[_0xc29b('0x39')]=_[_0xc29b('0x3c')](_0x33670f[_0xc29b('0x39')],{'$or':_[_0xc29b('0x2c')](_0x33670f[_0xc29b('0x35')],function(_0x3d1734){var _0x39fdd8={};_0x39fdd8[_0x3d1734]={'$like':'%'+_0x1af331[_0xc29b('0x31')][_0xc29b('0x3b')]+'%'};return _0x39fdd8;})});}_0x33670f=_[_0xc29b('0x3c')]({},_0x33670f,_0x1af331[_0xc29b('0x3e')]);return _0x5cabd7[_0xc29b('0x5e')](_0x33670f);}})[_0xc29b('0x23')](function(_0x4b0ef1){if(_0x4b0ef1){_0x7cab81=_0x4b0ef1[_0xc29b('0x36')];if(!_0x1af331['query'][_0xc29b('0x55')](_0xc29b('0x37'))){_0x33670f[_0xc29b('0x1e')]=qs[_0xc29b('0x1e')](_0x1af331['query']['limit']);_0x33670f['offset']=qs['offset'](_0x1af331[_0xc29b('0x31')][_0xc29b('0x1d')]);}return _0x5cabd7[_0xc29b('0x5e')](_0x33670f);}})[_0xc29b('0x23')](function(_0x555a6d){if(_0x555a6d){return _0x555a6d?{'count':_0x7cab81,'rows':_0x555a6d}:null;}})['then'](respondWithResult(_0x859929,null))['catch'](handleError(_0x859929,null));};exports[_0xc29b('0x60')]=function(_0x27af5b,_0x535b0b,_0x14bfcc){var _0x1d7bb9,_0x47fab7;return db[_0xc29b('0x2d')][_0xc29b('0x4b')]({'where':{'id':_0x27af5b[_0xc29b('0x43')]['id']}})[_0xc29b('0x23')](handleEntityNotFound(_0x535b0b,null))[_0xc29b('0x23')](function(_0x40a62d){if(_0x40a62d){_0x47fab7=_0x40a62d;return _0x40a62d['addLists'](_0x27af5b[_0xc29b('0x53')]['ids'],_[_0xc29b('0x50')](_0x27af5b[_0xc29b('0x53')],[_0xc29b('0x61'),'id'])||{});}return null;})['spread'](function(_0xb92582){var _0x35d1f5;_0x1d7bb9=_0xb92582||[];var _0x1c787c=[];if(_0xb92582){for(var _0x29d494=0x0;_0x29d494<_0xb92582[_0xc29b('0x36')];_0x29d494+=0x1){var _0x1985b9=_0xb92582[_0x29d494]['get']({'plain':!![]});_0x47fab7[_0xc29b('0x62')]=_0x27af5b[_0xc29b('0x53')][_0xc29b('0x62')]?_0x27af5b[_0xc29b('0x53')][_0xc29b('0x62')]:_0x47fab7[_0xc29b('0x62')];switch(_0x47fab7[_0xc29b('0x62')]){case _0xc29b('0x63'):_0x35d1f5=squel[_0xc29b('0x64')]()[_0xc29b('0x65')](_0xc29b('0x66'))[_0xc29b('0x67')]([_0xc29b('0x68'),_0xc29b('0x69'),_0xc29b('0x6a'),_0xc29b('0x6b'),_0xc29b('0x59'),_0xc29b('0x51'),_0xc29b('0x52')],squel[_0xc29b('0x6c')]()[_0xc29b('0x6d')]('phone',_0xc29b('0x68'))[_0xc29b('0x6d')](_0xc29b('0x6e'),_0xc29b('0x69'))['field']('id',_0xc29b('0x6a'))['field'](_0x1985b9[_0xc29b('0x6f')][_0xc29b('0x70')](),_0xc29b('0x6b'))[_0xc29b('0x6d')](_0x27af5b[_0xc29b('0x43')]['id'][_0xc29b('0x70')](),_0xc29b('0x59'))[_0xc29b('0x6d')](_0xc29b('0x6e'),_0xc29b('0x51'))[_0xc29b('0x6d')](_0xc29b('0x6e'),'updatedAt')[_0xc29b('0x71')](_0xc29b('0x72'))[_0xc29b('0x39')](_0xc29b('0x73'))[_0xc29b('0x39')](_0xc29b('0x74'),_0x1985b9['CmListId'][_0xc29b('0x70')]())[_0xc29b('0x39')]('phone\x20IS\x20NOT\x20NULL')[_0xc29b('0x39')]('phone\x20NOT\x20IN\x20(?)',squel[_0xc29b('0x6c')]()[_0xc29b('0x6d')](_0xc29b('0x75'))[_0xc29b('0x71')]('cm_hopper_final')['where']('CampaignId\x20=\x20?',_0x27af5b[_0xc29b('0x43')]['id'][_0xc29b('0x70')]()))[_0xc29b('0x39')]('phone\x20NOT\x20IN\x20(?)',squel['select']()[_0xc29b('0x6d')]('COALESCE(phone,\x27\x27)')[_0xc29b('0x71')](_0xc29b('0x66'))[_0xc29b('0x39')](_0xc29b('0x76'),_0x27af5b[_0xc29b('0x43')]['id'][_0xc29b('0x70')]())))[_0xc29b('0x70')]();break;case _0xc29b('0x77'):_0x35d1f5=squel[_0xc29b('0x64')]()[_0xc29b('0x65')](_0xc29b('0x66'))[_0xc29b('0x67')](['phone','scheduledAt',_0xc29b('0x6a'),_0xc29b('0x6b'),_0xc29b('0x59'),_0xc29b('0x51'),'updatedAt'],squel[_0xc29b('0x6c')]()[_0xc29b('0x6d')](_0xc29b('0x68'),_0xc29b('0x68'))[_0xc29b('0x6d')]('NOW()',_0xc29b('0x69'))[_0xc29b('0x6d')]('id',_0xc29b('0x6a'))['field'](_0x1985b9[_0xc29b('0x6f')][_0xc29b('0x70')](),_0xc29b('0x6b'))['field'](_0x27af5b[_0xc29b('0x43')]['id'][_0xc29b('0x70')](),_0xc29b('0x59'))[_0xc29b('0x6d')](_0xc29b('0x6e'),'createdAt')['field'](_0xc29b('0x6e'),'updatedAt')[_0xc29b('0x71')](_0xc29b('0x72'))[_0xc29b('0x39')](_0xc29b('0x73'))['where']('ListId\x20=\x20?',_0x1985b9['CmListId'][_0xc29b('0x70')]())[_0xc29b('0x39')](_0xc29b('0x78'))[_0xc29b('0x39')](_0xc29b('0x79'),squel[_0xc29b('0x6c')]()[_0xc29b('0x6d')](_0xc29b('0x7a'))[_0xc29b('0x71')]('cm_hopper')['where'](_0xc29b('0x76'),_0x27af5b[_0xc29b('0x43')]['id'][_0xc29b('0x70')]())))[_0xc29b('0x70')]();break;default:_0x35d1f5=squel['insert']()[_0xc29b('0x65')](_0xc29b('0x66'))['fromQuery']([_0xc29b('0x68'),'scheduledAt',_0xc29b('0x6a'),_0xc29b('0x6b'),'CampaignId',_0xc29b('0x51'),'updatedAt'],squel['select']()[_0xc29b('0x6d')]('phone',_0xc29b('0x68'))[_0xc29b('0x6d')](_0xc29b('0x6e'),_0xc29b('0x69'))[_0xc29b('0x6d')]('id',_0xc29b('0x6a'))[_0xc29b('0x6d')](_0x1985b9['CmListId'][_0xc29b('0x70')](),_0xc29b('0x6b'))['field'](_0x27af5b[_0xc29b('0x43')]['id'][_0xc29b('0x70')](),_0xc29b('0x59'))['field'](_0xc29b('0x6e'),'createdAt')['field']('NOW()',_0xc29b('0x52'))[_0xc29b('0x71')](_0xc29b('0x72'))[_0xc29b('0x39')](_0xc29b('0x73'))[_0xc29b('0x39')](_0xc29b('0x74'),_0x1985b9['CmListId'][_0xc29b('0x70')]())[_0xc29b('0x39')]('phone\x20IS\x20NOT\x20NULL'))[_0xc29b('0x70')]();}_0x1c787c[_0xc29b('0x7b')](db[_0xc29b('0x7c')][_0xc29b('0x31')](_0x35d1f5));}return BPromise[_0xc29b('0x7d')](_0x1c787c);}})[_0xc29b('0x23')](function(){return _0x1d7bb9;})['then'](respondWithResult(_0x535b0b,null))['catch'](handleError(_0x535b0b,null));};exports[_0xc29b('0x7e')]=function(_0x3c3f52,_0x4aa168,_0x9aa6d2){return db[_0xc29b('0x2d')][_0xc29b('0x4b')]({'where':{'id':_0x3c3f52['params']['id']}})[_0xc29b('0x23')](handleEntityNotFound(_0x4aa168,null))['then'](function(_0xef0389){if(_0xef0389){return _0xef0389[_0xc29b('0x7e')](_0x3c3f52[_0xc29b('0x31')]['ids']);}})['then'](function(_0x513661){if(_0x513661){return db[_0xc29b('0x7f')][_0xc29b('0x80')]({'where':{'ListId':_0x3c3f52[_0xc29b('0x31')]['ids'],'CampaignId':_0x3c3f52[_0xc29b('0x43')]['id']}})[_0xc29b('0x23')](function(){return _0x513661;});}})['then'](respondWithStatusCode(_0x4aa168,null))[_0xc29b('0x42')](handleError(_0x4aa168,null));};exports[_0xc29b('0x81')]=function(_0x46ae72,_0xc8331a,_0x2def21){var _0x226d5e={'raw':!![],'where':{}};var _0x49ec23={};var _0x53f01e={'count':0x0,'rows':[]};return db['Campaign']['findOne']({'where':{'id':_0x46ae72['params']['id']}})[_0xc29b('0x23')](handleEntityNotFound(_0xc8331a,null))['then'](function(_0x3cb2d9){if(_0x3cb2d9){_0x49ec23[_0xc29b('0x30')]=_[_0xc29b('0x44')](db[_0xc29b('0x5f')]['rawAttributes']);_0x49ec23[_0xc29b('0x31')]=_['keys'](_0x46ae72[_0xc29b('0x31')]);_0x49ec23[_0xc29b('0x32')]=_[_0xc29b('0x33')](_0x49ec23[_0xc29b('0x30')],_0x49ec23[_0xc29b('0x31')]);_0x226d5e[_0xc29b('0x35')]=_[_0xc29b('0x33')](_0x49ec23[_0xc29b('0x30')],qs['fields'](_0x46ae72[_0xc29b('0x31')][_0xc29b('0x34')]));_0x226d5e[_0xc29b('0x35')]=_0x226d5e[_0xc29b('0x35')][_0xc29b('0x36')]?_0x226d5e[_0xc29b('0x35')]:_0x49ec23[_0xc29b('0x30')];if(!_0x46ae72[_0xc29b('0x31')][_0xc29b('0x55')](_0xc29b('0x37'))){_0x226d5e[_0xc29b('0x1e')]=qs[_0xc29b('0x1e')](_0x46ae72[_0xc29b('0x31')][_0xc29b('0x1e')]);_0x226d5e[_0xc29b('0x1d')]=qs[_0xc29b('0x1d')](_0x46ae72[_0xc29b('0x31')]['offset']);}_0x226d5e[_0xc29b('0x56')]=qs[_0xc29b('0x38')](_0x46ae72[_0xc29b('0x31')]['sort']);_0x226d5e[_0xc29b('0x39')]=qs[_0xc29b('0x32')](_[_0xc29b('0x3a')](_0x46ae72[_0xc29b('0x31')],_0x49ec23[_0xc29b('0x32')]));_0x226d5e[_0xc29b('0x39')]['CampaignId']=_0x3cb2d9['id'];if(_0x46ae72[_0xc29b('0x31')][_0xc29b('0x3b')]){_0x226d5e[_0xc29b('0x39')]=_['merge'](_0x226d5e[_0xc29b('0x39')],{'$or':_[_0xc29b('0x2c')](_0x226d5e[_0xc29b('0x35')],function(_0x4232a3){var _0x386995={};_0x386995[_0x4232a3]={'$like':'%'+_0x46ae72['query'][_0xc29b('0x3b')]+'%'};return _0x386995;})});}_0x226d5e=_[_0xc29b('0x3c')]({},_0x226d5e,_0x46ae72[_0xc29b('0x3e')]);return db['CmList'][_0xc29b('0x1c')]({'where':_0x226d5e[_0xc29b('0x39')]})['then'](function(_0x34fe1b){_0x53f01e[_0xc29b('0x1c')]=_0x34fe1b;if(_0x46ae72[_0xc29b('0x31')][_0xc29b('0x3f')]){_0x226d5e[_0xc29b('0x40')]=[{'all':!![]}];}return db['CmList'][_0xc29b('0x41')](_0x226d5e);})[_0xc29b('0x23')](function(_0x4b0130){_0x53f01e[_0xc29b('0x57')]=_0x4b0130;return _0x53f01e;});}})['then'](respondWithFilteredResult(_0xc8331a,_0x226d5e))['catch'](handleError(_0xc8331a,null));};exports[_0xc29b('0x82')]=function(_0xaba168,_0x4add88,_0x31bfbf){var _0x461692,_0x40f329;return db['Campaign'][_0xc29b('0x4b')]({'where':{'id':_0xaba168[_0xc29b('0x43')]['id']}})['then'](handleEntityNotFound(_0x4add88,null))[_0xc29b('0x23')](function(_0x19e89e){if(_0x19e89e){_0x40f329=_0x19e89e;return _0x19e89e['addBlackLists'](_0xaba168[_0xc29b('0x53')]['ids'],_[_0xc29b('0x50')](_0xaba168[_0xc29b('0x53')],[_0xc29b('0x61'),'id'])||{});}return null;})[_0xc29b('0x83')](function(_0x461db4){var _0x1b9510;_0x461692=_0x461db4||[];var _0x4e82fa=[];if(_0x461db4){for(var _0x58fc2b=0x0;_0x58fc2b<_0x461db4[_0xc29b('0x36')];_0x58fc2b+=0x1){var _0x2c679a=_0x461db4[_0x58fc2b][_0xc29b('0x24')]({'plain':!![]});_0x1b9510=squel['insert']()[_0xc29b('0x65')](_0xc29b('0x84'))[_0xc29b('0x67')]([_0xc29b('0x68'),'ContactId',_0xc29b('0x6b'),_0xc29b('0x59'),_0xc29b('0x51'),_0xc29b('0x52')],squel[_0xc29b('0x6c')]()[_0xc29b('0x6d')](_0xc29b('0x68'),_0xc29b('0x68'))[_0xc29b('0x6d')]('id',_0xc29b('0x6a'))['field'](_0x2c679a[_0xc29b('0x6f')][_0xc29b('0x70')](),_0xc29b('0x6b'))[_0xc29b('0x6d')](_0xaba168[_0xc29b('0x43')]['id'][_0xc29b('0x70')](),_0xc29b('0x59'))[_0xc29b('0x6d')](_0xc29b('0x6e'),_0xc29b('0x51'))[_0xc29b('0x6d')](_0xc29b('0x6e'),_0xc29b('0x52'))[_0xc29b('0x71')]('cm_contacts')['where'](_0xc29b('0x73'))[_0xc29b('0x39')](_0xc29b('0x74'),_0x2c679a[_0xc29b('0x6f')][_0xc29b('0x70')]())[_0xc29b('0x39')](_0xc29b('0x78')))[_0xc29b('0x70')]();_0x4e82fa[_0xc29b('0x7b')](db[_0xc29b('0x7c')]['query'](_0x1b9510));}return BPromise['all'](_0x4e82fa);}})[_0xc29b('0x23')](function(){return _0x461692;})[_0xc29b('0x23')](respondWithResult(_0x4add88,null))[_0xc29b('0x42')](handleError(_0x4add88,null));};exports[_0xc29b('0x85')]=function(_0x34bf3e,_0x44d3d6,_0x2a00f6){return db[_0xc29b('0x2d')]['find']({'where':{'id':_0x34bf3e[_0xc29b('0x43')]['id']}})[_0xc29b('0x23')](handleEntityNotFound(_0x44d3d6,null))['then'](function(_0x50d5ea){if(_0x50d5ea){return _0x50d5ea['removeBlackLists'](_0x34bf3e[_0xc29b('0x31')][_0xc29b('0x61')]);}})[_0xc29b('0x23')](function(_0xdd890){if(_0xdd890){return db[_0xc29b('0x86')][_0xc29b('0x80')]({'where':{'ListId':_0x34bf3e['query'][_0xc29b('0x61')],'CampaignId':_0x34bf3e[_0xc29b('0x43')]['id']}})['then'](function(){return _0xdd890;});}})[_0xc29b('0x23')](respondWithStatusCode(_0x44d3d6,null))[_0xc29b('0x42')](handleError(_0x44d3d6,null));}; \ No newline at end of file +var _0xf4b0=['count','offset','limit','Content-Range','json','apply','reject','save','update','then','destroy','get','IvrCampaigns','UserProfileResource','error','stack','name','send','index','map','Campaign','fieldName','type','key','model','query','filters','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','include','findAll','catch','show','params','keys','rawAttributes','intersection','includeAll','find','create','body','user','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','omit','updatedAt','role','UserProfileSection','autoAssociation','getHoppers','findOne','CampaignId','CmHopper','getHopperHistories','CmHopperHistory','rows','CmHopperFinal','getHopperBlacks','CmHopperBlack','getLists','CmList','addLists','ids','spread','dialCheckDuplicateType','always','insert','into','cm_hopper','fromQuery','scheduledAt','ListId','field','phone','toString','NOW()','from','cm_contacts','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','CmListId','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','COALESCE(calleridnum,\x27\x27)','cm_hopper_final','CampaignId\x20=\x20?','onlyIfOpen','ContactId','createdAt','select','push','all','removeLists','getBlackLists','addBlackLists','cm_hopper_black','sequelize','removeBlackLists','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','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','end'];(function(_0x5d4607,_0x6b5e7b){var _0x5e4a86=function(_0x46891a){while(--_0x46891a){_0x5d4607['push'](_0x5d4607['shift']());}};_0x5e4a86(++_0x6b5e7b);}(_0xf4b0,0x182));var _0x0f4b=function(_0x3f1728,_0x579c67){_0x3f1728=_0x3f1728-0x0;var _0x1998dc=_0xf4b0[_0x3f1728];return _0x1998dc;};'use strict';var pdf=require(_0x0f4b('0x0'));var emlformat=require(_0x0f4b('0x1'));var rimraf=require(_0x0f4b('0x2'));var zipdir=require(_0x0f4b('0x3'));var jsonpatch=require(_0x0f4b('0x4'));var rp=require('request-promise');var moment=require(_0x0f4b('0x5'));var BPromise=require(_0x0f4b('0x6'));var Mustache=require(_0x0f4b('0x7'));var util=require(_0x0f4b('0x8'));var path=require(_0x0f4b('0x9'));var sox=require(_0x0f4b('0xa'));var csv=require(_0x0f4b('0xb'));var ejs=require(_0x0f4b('0xc'));var fs=require('fs');var _=require(_0x0f4b('0xd'));var squel=require(_0x0f4b('0xe'));var crypto=require(_0x0f4b('0xf'));var jsforce=require('jsforce');var deskjs=require(_0x0f4b('0x10'));var toCsv=require('to-csv');var querystring=require(_0x0f4b('0x11'));var Papa=require('papaparse');var Redis=require(_0x0f4b('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x0f4b('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x0f4b('0x14'));var logger=require(_0x0f4b('0x15'))(_0x0f4b('0x16'));var utils=require('../../config/utils');var config=require(_0x0f4b('0x17'));var db=require(_0x0f4b('0x18'))['db'];function respondWithStatusCode(_0x462831,_0x4caa50){_0x4caa50=_0x4caa50||0xcc;return function(_0x237feb){if(_0x237feb){return _0x462831[_0x0f4b('0x19')](_0x4caa50);}return _0x462831[_0x0f4b('0x1a')](_0x4caa50)[_0x0f4b('0x1b')]();};}function respondWithResult(_0x22a8ee,_0x16581e){_0x16581e=_0x16581e||0xc8;return function(_0x45c014){if(_0x45c014){return _0x22a8ee['status'](_0x16581e)['json'](_0x45c014);}};}function respondWithFilteredResult(_0x2077f6,_0x5edd0c){return function(_0x3d9bae){if(_0x3d9bae){var _0x245274=_0x3d9bae[_0x0f4b('0x1c')],_0xa4ee17=_0x5edd0c[_0x0f4b('0x1d')],_0x1ed776=_0x5edd0c['offset']+_0x5edd0c[_0x0f4b('0x1e')],_0x2781d6;if(_0x1ed776>=_0x245274){_0x1ed776=_0x245274;_0x2781d6=0xc8;}else{_0x2781d6=0xce;}_0x2077f6[_0x0f4b('0x1a')](_0x2781d6);return _0x2077f6['set'](_0x0f4b('0x1f'),_0xa4ee17+'-'+_0x1ed776+'/'+_0x245274)[_0x0f4b('0x20')](_0x3d9bae);}return null;};}function patchUpdates(_0x2d0f09){return function(_0x95bdd9){try{jsonpatch[_0x0f4b('0x21')](_0x95bdd9,_0x2d0f09,!![]);}catch(_0x37a43d){return BPromise[_0x0f4b('0x22')](_0x37a43d);}return _0x95bdd9[_0x0f4b('0x23')]();};}function saveUpdates(_0x4882ee,_0x9a5a04){return function(_0x209c3d){if(_0x209c3d){return _0x209c3d[_0x0f4b('0x24')](_0x4882ee)[_0x0f4b('0x25')](function(_0x2dd4f3){return _0x2dd4f3;});}return null;};}function removeEntity(_0x46a38f,_0x1b6e33){return function(_0x17e81c){if(_0x17e81c){return _0x17e81c[_0x0f4b('0x26')]()[_0x0f4b('0x25')](function(){var _0x13ac69=_0x17e81c[_0x0f4b('0x27')]({'plain':!![]});var _0x4ce0f4=_0x0f4b('0x28');return db[_0x0f4b('0x29')][_0x0f4b('0x26')]({'where':{'type':_0x4ce0f4,'resourceId':_0x13ac69['id']}})['then'](function(){return _0x17e81c;});})[_0x0f4b('0x25')](function(){_0x46a38f[_0x0f4b('0x1a')](0xcc)[_0x0f4b('0x1b')]();});}};}function handleEntityNotFound(_0x380018,_0x4410cb){return function(_0x557a37){if(!_0x557a37){_0x380018['sendStatus'](0x194);}return _0x557a37;};}function handleError(_0x387d7a,_0x40f520){_0x40f520=_0x40f520||0x1f4;return function(_0x47473f){logger[_0x0f4b('0x2a')](_0x47473f[_0x0f4b('0x2b')]);if(_0x47473f[_0x0f4b('0x2c')]){delete _0x47473f[_0x0f4b('0x2c')];}_0x387d7a[_0x0f4b('0x1a')](_0x40f520)[_0x0f4b('0x2d')](_0x47473f);};}exports[_0x0f4b('0x2e')]=function(_0x195090,_0x2ee876){var _0x20dd9e={},_0x59f693={},_0x2d596b={'count':0x0,'rows':[]};var _0x12b785=_[_0x0f4b('0x2f')](db[_0x0f4b('0x30')]['rawAttributes'],function(_0x58cf8b){return{'name':_0x58cf8b[_0x0f4b('0x31')],'type':_0x58cf8b[_0x0f4b('0x32')][_0x0f4b('0x33')]};});_0x59f693[_0x0f4b('0x34')]=_[_0x0f4b('0x2f')](_0x12b785,_0x0f4b('0x2c'));_0x59f693[_0x0f4b('0x35')]=_['keys'](_0x195090['query']);_0x59f693[_0x0f4b('0x36')]=_['intersection'](_0x59f693[_0x0f4b('0x34')],_0x59f693[_0x0f4b('0x35')]);_0x20dd9e[_0x0f4b('0x37')]=_['intersection'](_0x59f693[_0x0f4b('0x34')],qs[_0x0f4b('0x38')](_0x195090[_0x0f4b('0x35')][_0x0f4b('0x38')]));_0x20dd9e['attributes']=_0x20dd9e[_0x0f4b('0x37')][_0x0f4b('0x39')]?_0x20dd9e['attributes']:_0x59f693[_0x0f4b('0x34')];if(!_0x195090['query'][_0x0f4b('0x3a')](_0x0f4b('0x3b'))){_0x20dd9e[_0x0f4b('0x1e')]=qs['limit'](_0x195090[_0x0f4b('0x35')][_0x0f4b('0x1e')]);_0x20dd9e[_0x0f4b('0x1d')]=qs[_0x0f4b('0x1d')](_0x195090['query'][_0x0f4b('0x1d')]);}_0x20dd9e[_0x0f4b('0x3c')]=qs[_0x0f4b('0x3d')](_0x195090[_0x0f4b('0x35')]['sort']);_0x20dd9e[_0x0f4b('0x3e')]=qs[_0x0f4b('0x36')](_[_0x0f4b('0x3f')](_0x195090[_0x0f4b('0x35')],_0x59f693[_0x0f4b('0x36')]),_0x12b785);if(_0x195090[_0x0f4b('0x35')][_0x0f4b('0x40')]){_0x20dd9e['where']=_[_0x0f4b('0x41')](_0x20dd9e[_0x0f4b('0x3e')],{'$or':_[_0x0f4b('0x2f')](_0x12b785,function(_0x5f26bb){if(_0x5f26bb[_0x0f4b('0x32')]!==_0x0f4b('0x42')){var _0x42ba99={};_0x42ba99[_0x5f26bb['name']]={'$like':'%'+_0x195090[_0x0f4b('0x35')][_0x0f4b('0x40')]+'%'};return _0x42ba99;}})});}_0x20dd9e=_['merge']({},_0x20dd9e,_0x195090[_0x0f4b('0x43')]);var _0x572279={'where':_0x20dd9e[_0x0f4b('0x3e')]};return db[_0x0f4b('0x30')]['count'](_0x572279)['then'](function(_0x47c4e1){_0x2d596b[_0x0f4b('0x1c')]=_0x47c4e1;if(_0x195090[_0x0f4b('0x35')]['includeAll']){_0x20dd9e[_0x0f4b('0x44')]=[{'all':!![]}];}return db[_0x0f4b('0x30')][_0x0f4b('0x45')](_0x20dd9e);})[_0x0f4b('0x25')](function(_0x120ec8){_0x2d596b['rows']=_0x120ec8;return _0x2d596b;})[_0x0f4b('0x25')](respondWithFilteredResult(_0x2ee876,_0x20dd9e))[_0x0f4b('0x46')](handleError(_0x2ee876,null));};exports[_0x0f4b('0x47')]=function(_0x13bde7,_0xe12dc8){var _0xd0036c={'raw':![],'where':{'id':_0x13bde7[_0x0f4b('0x48')]['id']}},_0x2e4f79={};_0x2e4f79['model']=_[_0x0f4b('0x49')](db[_0x0f4b('0x30')][_0x0f4b('0x4a')]);_0x2e4f79[_0x0f4b('0x35')]=_['keys'](_0x13bde7['query']);_0x2e4f79[_0x0f4b('0x36')]=_[_0x0f4b('0x4b')](_0x2e4f79[_0x0f4b('0x34')],_0x2e4f79[_0x0f4b('0x35')]);_0xd0036c['attributes']=_[_0x0f4b('0x4b')](_0x2e4f79[_0x0f4b('0x34')],qs[_0x0f4b('0x38')](_0x13bde7[_0x0f4b('0x35')][_0x0f4b('0x38')]));_0xd0036c['attributes']=_0xd0036c[_0x0f4b('0x37')][_0x0f4b('0x39')]?_0xd0036c[_0x0f4b('0x37')]:_0x2e4f79['model'];if(_0x13bde7[_0x0f4b('0x35')][_0x0f4b('0x4c')]){_0xd0036c[_0x0f4b('0x44')]=[{'all':!![]}];}_0xd0036c=_['merge']({},_0xd0036c,_0x13bde7['options']);return db[_0x0f4b('0x30')][_0x0f4b('0x4d')](_0xd0036c)[_0x0f4b('0x25')](handleEntityNotFound(_0xe12dc8,null))[_0x0f4b('0x25')](respondWithResult(_0xe12dc8,null))[_0x0f4b('0x46')](handleError(_0xe12dc8,null));};exports[_0x0f4b('0x4e')]=function(_0x3080d0,_0x1505d4){return db[_0x0f4b('0x30')][_0x0f4b('0x4e')](_0x3080d0[_0x0f4b('0x4f')],{})['then'](function(_0x3a7011){var _0x435a80=_0x3080d0[_0x0f4b('0x50')][_0x0f4b('0x27')]({'plain':!![]});if(!_0x435a80)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x435a80['role']===_0x0f4b('0x50')){var _0x5578d9=_0x3a7011[_0x0f4b('0x27')]({'plain':!![]});var _0x2b7bf9=_0x0f4b('0x28');return db['UserProfileSection'][_0x0f4b('0x4d')]({'where':{'name':_0x2b7bf9,'userProfileId':_0x435a80[_0x0f4b('0x51')]},'raw':!![]})[_0x0f4b('0x25')](function(_0x50b3a4){if(_0x50b3a4&&_0x50b3a4['autoAssociation']===0x0){return db[_0x0f4b('0x29')][_0x0f4b('0x4e')]({'name':_0x5578d9['name'],'resourceId':_0x5578d9['id'],'type':_0x50b3a4['name'],'sectionId':_0x50b3a4['id']},{})[_0x0f4b('0x25')](function(){return _0x3a7011;});}else{return _0x3a7011;}})['catch'](function(_0x4780a4){logger[_0x0f4b('0x2a')](_0x0f4b('0x52'),_0x4780a4);throw _0x4780a4;});}return _0x3a7011;})[_0x0f4b('0x25')](respondWithResult(_0x1505d4,0xc9))['catch'](handleError(_0x1505d4,null));};exports[_0x0f4b('0x53')]=function(_0x320905,_0x6fbe3b){var _0x1c9941={'where':{'id':_0x320905[_0x0f4b('0x48')]['id']}},_0x3f9da9={};_0x3f9da9[_0x0f4b('0x34')]=_[_0x0f4b('0x49')](db['Campaign'][_0x0f4b('0x4a')]);_0x1c9941['attributes']=_[_0x0f4b('0x4b')](_0x3f9da9[_0x0f4b('0x34')],qs[_0x0f4b('0x38')](_0x320905[_0x0f4b('0x35')][_0x0f4b('0x38')]));_0x1c9941[_0x0f4b('0x37')]=_0x1c9941[_0x0f4b('0x37')][_0x0f4b('0x39')]?_0x1c9941[_0x0f4b('0x37')]:_0x3f9da9['model'];if(_0x320905[_0x0f4b('0x35')]['includeAll']){_0x1c9941[_0x0f4b('0x44')]=[{'all':!![]}];}_0x1c9941=_[_0x0f4b('0x41')]({},_0x1c9941,_0x320905['options']);return db[_0x0f4b('0x30')]['find'](_0x1c9941)[_0x0f4b('0x25')](handleEntityNotFound(_0x6fbe3b,null))['then'](function(_0x22e327){if(_0x22e327){var _0xb8af04=_0x22e327['get']({'plain':!![]});_0xb8af04=qs[_0x0f4b('0x54')](_0xb8af04,['id','createdAt',_0x0f4b('0x55')]);_0x320905['body']=_[_0x0f4b('0x54')](_0x320905[_0x0f4b('0x4f')],['id','createdAt',_0x0f4b('0x55')]);return db['Campaign'][_0x0f4b('0x4e')](_['merge'](_0xb8af04,_0x320905[_0x0f4b('0x4f')]),{'include':_0x320905[_0x0f4b('0x35')][_0x0f4b('0x4c')]?[{'all':!![]}]:undefined})['then'](function(_0x41b97a){var _0x2406d4=_0x320905['user'][_0x0f4b('0x27')]({'plain':!![]});if(!_0x2406d4)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x2406d4[_0x0f4b('0x56')]===_0x0f4b('0x50')){var _0x5e4bf6=_0x41b97a['get']({'plain':!![]});var _0x68bdee='IvrCampaigns';return db[_0x0f4b('0x57')][_0x0f4b('0x4d')]({'where':{'name':_0x68bdee,'userProfileId':_0x2406d4[_0x0f4b('0x51')]},'raw':!![]})[_0x0f4b('0x25')](function(_0x1a9f1d){if(_0x1a9f1d&&_0x1a9f1d[_0x0f4b('0x58')]===0x0){return db['UserProfileResource'][_0x0f4b('0x4e')]({'name':_0x5e4bf6['name'],'resourceId':_0x5e4bf6['id'],'type':_0x1a9f1d[_0x0f4b('0x2c')],'sectionId':_0x1a9f1d['id']},{})[_0x0f4b('0x25')](function(){return _0x41b97a;});}else{return _0x41b97a;}})['catch'](function(_0x499630){logger[_0x0f4b('0x2a')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x499630);throw _0x499630;});}return _0x41b97a;});}})[_0x0f4b('0x25')](respondWithResult(_0x6fbe3b,0xc9))['catch'](handleError(_0x6fbe3b,null));};exports[_0x0f4b('0x24')]=function(_0x21f638,_0x21bade){if(_0x21f638['body']['id']){delete _0x21f638[_0x0f4b('0x4f')]['id'];}return db[_0x0f4b('0x30')][_0x0f4b('0x4d')]({'where':{'id':_0x21f638[_0x0f4b('0x48')]['id']}})[_0x0f4b('0x25')](handleEntityNotFound(_0x21bade,null))[_0x0f4b('0x25')](saveUpdates(_0x21f638[_0x0f4b('0x4f')],null))['then'](respondWithResult(_0x21bade,null))[_0x0f4b('0x46')](handleError(_0x21bade,null));};exports[_0x0f4b('0x26')]=function(_0x29fc04,_0x2a2aa1){return db[_0x0f4b('0x30')]['find']({'where':{'id':_0x29fc04[_0x0f4b('0x48')]['id']}})[_0x0f4b('0x25')](handleEntityNotFound(_0x2a2aa1,null))[_0x0f4b('0x25')](removeEntity(_0x2a2aa1,null))[_0x0f4b('0x46')](handleError(_0x2a2aa1,null));};exports[_0x0f4b('0x59')]=function(_0x540141,_0x4775c3,_0x3919f2){var _0xb4201b={'raw':!![],'where':{}};var _0x3da267={};var _0x5ec94b={'count':0x0,'rows':[]};return db[_0x0f4b('0x30')][_0x0f4b('0x5a')]({'where':{'id':_0x540141[_0x0f4b('0x48')]['id']}})[_0x0f4b('0x25')](handleEntityNotFound(_0x4775c3,null))[_0x0f4b('0x25')](function(_0x5ae53a){if(_0x5ae53a){_0x3da267[_0x0f4b('0x34')]=_[_0x0f4b('0x49')](db['CmHopper'][_0x0f4b('0x4a')]);_0x3da267[_0x0f4b('0x35')]=_[_0x0f4b('0x49')](_0x540141[_0x0f4b('0x35')]);_0x3da267[_0x0f4b('0x36')]=_[_0x0f4b('0x4b')](_0x3da267[_0x0f4b('0x34')],_0x3da267['query']);_0xb4201b[_0x0f4b('0x37')]=_[_0x0f4b('0x4b')](_0x3da267[_0x0f4b('0x34')],qs[_0x0f4b('0x38')](_0x540141[_0x0f4b('0x35')]['fields']));_0xb4201b['attributes']=_0xb4201b[_0x0f4b('0x37')]['length']?_0xb4201b[_0x0f4b('0x37')]:_0x3da267[_0x0f4b('0x34')];if(!_0x540141['query'][_0x0f4b('0x3a')](_0x0f4b('0x3b'))){_0xb4201b[_0x0f4b('0x1e')]=qs[_0x0f4b('0x1e')](_0x540141[_0x0f4b('0x35')][_0x0f4b('0x1e')]);_0xb4201b[_0x0f4b('0x1d')]=qs[_0x0f4b('0x1d')](_0x540141[_0x0f4b('0x35')]['offset']);}_0xb4201b['order']=qs[_0x0f4b('0x3d')](_0x540141[_0x0f4b('0x35')][_0x0f4b('0x3d')]);_0xb4201b[_0x0f4b('0x3e')]=qs[_0x0f4b('0x36')](_[_0x0f4b('0x3f')](_0x540141['query'],_0x3da267['filters']));_0xb4201b[_0x0f4b('0x3e')][_0x0f4b('0x5b')]=_0x5ae53a['id'];if(_0x540141[_0x0f4b('0x35')]['filter']){_0xb4201b[_0x0f4b('0x3e')]=_[_0x0f4b('0x41')](_0xb4201b[_0x0f4b('0x3e')],{'$or':_[_0x0f4b('0x2f')](_0xb4201b[_0x0f4b('0x37')],function(_0xd33dd2){var _0x191a68={};_0x191a68[_0xd33dd2]={'$like':'%'+_0x540141[_0x0f4b('0x35')][_0x0f4b('0x40')]+'%'};return _0x191a68;})});}_0xb4201b=_[_0x0f4b('0x41')]({},_0xb4201b,_0x540141[_0x0f4b('0x43')]);return db[_0x0f4b('0x5c')][_0x0f4b('0x1c')]({'where':_0xb4201b[_0x0f4b('0x3e')]})[_0x0f4b('0x25')](function(_0x1a750a){_0x5ec94b[_0x0f4b('0x1c')]=_0x1a750a;if(_0x540141[_0x0f4b('0x35')][_0x0f4b('0x4c')]){_0xb4201b[_0x0f4b('0x44')]=[{'all':!![]}];}return db['CmHopper']['findAll'](_0xb4201b);})[_0x0f4b('0x25')](function(_0x3d9d86){_0x5ec94b['rows']=_0x3d9d86;return _0x5ec94b;});}})['then'](respondWithFilteredResult(_0x4775c3,_0xb4201b))[_0x0f4b('0x46')](handleError(_0x4775c3,null));};exports[_0x0f4b('0x5d')]=function(_0x4389d4,_0xd8963f,_0x362bc7){var _0x52a012={'raw':!![],'where':{}};var _0x525b90={};var _0x154219={'count':0x0,'rows':[]};return db[_0x0f4b('0x30')][_0x0f4b('0x5a')]({'where':{'id':_0x4389d4[_0x0f4b('0x48')]['id']}})['then'](handleEntityNotFound(_0xd8963f,null))[_0x0f4b('0x25')](function(_0x1d5db7){if(_0x1d5db7){_0x525b90[_0x0f4b('0x34')]=_[_0x0f4b('0x49')](db[_0x0f4b('0x5e')][_0x0f4b('0x4a')]);_0x525b90[_0x0f4b('0x35')]=_['keys'](_0x4389d4[_0x0f4b('0x35')]);_0x525b90['filters']=_[_0x0f4b('0x4b')](_0x525b90['model'],_0x525b90[_0x0f4b('0x35')]);_0x52a012[_0x0f4b('0x37')]=_[_0x0f4b('0x4b')](_0x525b90[_0x0f4b('0x34')],qs[_0x0f4b('0x38')](_0x4389d4[_0x0f4b('0x35')]['fields']));_0x52a012[_0x0f4b('0x37')]=_0x52a012['attributes'][_0x0f4b('0x39')]?_0x52a012[_0x0f4b('0x37')]:_0x525b90[_0x0f4b('0x34')];if(!_0x4389d4[_0x0f4b('0x35')]['hasOwnProperty'](_0x0f4b('0x3b'))){_0x52a012[_0x0f4b('0x1e')]=qs[_0x0f4b('0x1e')](_0x4389d4[_0x0f4b('0x35')][_0x0f4b('0x1e')]);_0x52a012[_0x0f4b('0x1d')]=qs[_0x0f4b('0x1d')](_0x4389d4['query'][_0x0f4b('0x1d')]);}_0x52a012[_0x0f4b('0x3c')]=qs[_0x0f4b('0x3d')](_0x4389d4[_0x0f4b('0x35')][_0x0f4b('0x3d')]);_0x52a012[_0x0f4b('0x3e')]=qs['filters'](_[_0x0f4b('0x3f')](_0x4389d4['query'],_0x525b90[_0x0f4b('0x36')]));_0x52a012[_0x0f4b('0x3e')][_0x0f4b('0x5b')]=_0x1d5db7['id'];if(_0x4389d4[_0x0f4b('0x35')]['filter']){_0x52a012[_0x0f4b('0x3e')]=_[_0x0f4b('0x41')](_0x52a012[_0x0f4b('0x3e')],{'$or':_[_0x0f4b('0x2f')](_0x52a012['attributes'],function(_0x48892d){var _0x25095d={};_0x25095d[_0x48892d]={'$like':'%'+_0x4389d4['query'][_0x0f4b('0x40')]+'%'};return _0x25095d;})});}_0x52a012=_['merge']({},_0x52a012,_0x4389d4[_0x0f4b('0x43')]);return db['CmHopperHistory'][_0x0f4b('0x1c')]({'where':_0x52a012[_0x0f4b('0x3e')]})[_0x0f4b('0x25')](function(_0x5c402e){_0x154219[_0x0f4b('0x1c')]=_0x5c402e;if(_0x4389d4[_0x0f4b('0x35')]['includeAll']){_0x52a012[_0x0f4b('0x44')]=[{'all':!![]}];}return db[_0x0f4b('0x5e')][_0x0f4b('0x45')](_0x52a012);})['then'](function(_0x236f07){_0x154219[_0x0f4b('0x5f')]=_0x236f07;return _0x154219;});}})[_0x0f4b('0x25')](respondWithFilteredResult(_0xd8963f,_0x52a012))[_0x0f4b('0x46')](handleError(_0xd8963f,null));};exports['getHopperFinals']=function(_0x18bf70,_0x5533ae,_0x2e217c){var _0x957202={'raw':!![],'where':{}};var _0x10c7ed={};var _0x16e420={'count':0x0,'rows':[]};return db[_0x0f4b('0x30')][_0x0f4b('0x5a')]({'where':{'id':_0x18bf70['params']['id']}})[_0x0f4b('0x25')](handleEntityNotFound(_0x5533ae,null))['then'](function(_0x586043){if(_0x586043){_0x10c7ed[_0x0f4b('0x34')]=_['keys'](db[_0x0f4b('0x60')][_0x0f4b('0x4a')]);_0x10c7ed['query']=_[_0x0f4b('0x49')](_0x18bf70[_0x0f4b('0x35')]);_0x10c7ed[_0x0f4b('0x36')]=_[_0x0f4b('0x4b')](_0x10c7ed['model'],_0x10c7ed[_0x0f4b('0x35')]);_0x957202[_0x0f4b('0x37')]=_[_0x0f4b('0x4b')](_0x10c7ed[_0x0f4b('0x34')],qs[_0x0f4b('0x38')](_0x18bf70['query'][_0x0f4b('0x38')]));_0x957202[_0x0f4b('0x37')]=_0x957202['attributes']['length']?_0x957202[_0x0f4b('0x37')]:_0x10c7ed[_0x0f4b('0x34')];if(!_0x18bf70[_0x0f4b('0x35')]['hasOwnProperty'](_0x0f4b('0x3b'))){_0x957202[_0x0f4b('0x1e')]=qs['limit'](_0x18bf70[_0x0f4b('0x35')]['limit']);_0x957202[_0x0f4b('0x1d')]=qs['offset'](_0x18bf70[_0x0f4b('0x35')][_0x0f4b('0x1d')]);}_0x957202[_0x0f4b('0x3c')]=qs[_0x0f4b('0x3d')](_0x18bf70['query'][_0x0f4b('0x3d')]);_0x957202[_0x0f4b('0x3e')]=qs[_0x0f4b('0x36')](_[_0x0f4b('0x3f')](_0x18bf70[_0x0f4b('0x35')],_0x10c7ed[_0x0f4b('0x36')]));_0x957202[_0x0f4b('0x3e')][_0x0f4b('0x5b')]=_0x586043['id'];if(_0x18bf70[_0x0f4b('0x35')][_0x0f4b('0x40')]){_0x957202[_0x0f4b('0x3e')]=_[_0x0f4b('0x41')](_0x957202[_0x0f4b('0x3e')],{'$or':_[_0x0f4b('0x2f')](_0x957202[_0x0f4b('0x37')],function(_0x3cc3be){var _0x59808e={};_0x59808e[_0x3cc3be]={'$like':'%'+_0x18bf70[_0x0f4b('0x35')]['filter']+'%'};return _0x59808e;})});}_0x957202=_['merge']({},_0x957202,_0x18bf70[_0x0f4b('0x43')]);return db['CmHopperFinal']['count']({'where':_0x957202[_0x0f4b('0x3e')]})['then'](function(_0x22199f){_0x16e420['count']=_0x22199f;if(_0x18bf70[_0x0f4b('0x35')][_0x0f4b('0x4c')]){_0x957202['include']=[{'all':!![]}];}return db[_0x0f4b('0x60')][_0x0f4b('0x45')](_0x957202);})['then'](function(_0x4d3715){_0x16e420[_0x0f4b('0x5f')]=_0x4d3715;return _0x16e420;});}})[_0x0f4b('0x25')](respondWithFilteredResult(_0x5533ae,_0x957202))[_0x0f4b('0x46')](handleError(_0x5533ae,null));};exports[_0x0f4b('0x61')]=function(_0x25a58b,_0x2cb348,_0x5be729){var _0x298ed7={'raw':!![],'where':{}};var _0x2e043c={};var _0x40edf5={'count':0x0,'rows':[]};return db['Campaign'][_0x0f4b('0x5a')]({'where':{'id':_0x25a58b['params']['id']}})[_0x0f4b('0x25')](handleEntityNotFound(_0x2cb348,null))['then'](function(_0x577dc3){if(_0x577dc3){_0x2e043c[_0x0f4b('0x34')]=_['keys'](db[_0x0f4b('0x62')][_0x0f4b('0x4a')]);_0x2e043c[_0x0f4b('0x35')]=_[_0x0f4b('0x49')](_0x25a58b[_0x0f4b('0x35')]);_0x2e043c[_0x0f4b('0x36')]=_[_0x0f4b('0x4b')](_0x2e043c[_0x0f4b('0x34')],_0x2e043c['query']);_0x298ed7[_0x0f4b('0x37')]=_[_0x0f4b('0x4b')](_0x2e043c[_0x0f4b('0x34')],qs[_0x0f4b('0x38')](_0x25a58b[_0x0f4b('0x35')][_0x0f4b('0x38')]));_0x298ed7['attributes']=_0x298ed7['attributes'][_0x0f4b('0x39')]?_0x298ed7[_0x0f4b('0x37')]:_0x2e043c[_0x0f4b('0x34')];if(!_0x25a58b['query'][_0x0f4b('0x3a')](_0x0f4b('0x3b'))){_0x298ed7[_0x0f4b('0x1e')]=qs[_0x0f4b('0x1e')](_0x25a58b['query'][_0x0f4b('0x1e')]);_0x298ed7[_0x0f4b('0x1d')]=qs[_0x0f4b('0x1d')](_0x25a58b[_0x0f4b('0x35')][_0x0f4b('0x1d')]);}_0x298ed7['order']=qs[_0x0f4b('0x3d')](_0x25a58b['query'][_0x0f4b('0x3d')]);_0x298ed7[_0x0f4b('0x3e')]=qs[_0x0f4b('0x36')](_[_0x0f4b('0x3f')](_0x25a58b[_0x0f4b('0x35')],_0x2e043c[_0x0f4b('0x36')]));_0x298ed7[_0x0f4b('0x3e')][_0x0f4b('0x5b')]=_0x577dc3['id'];if(_0x25a58b[_0x0f4b('0x35')][_0x0f4b('0x40')]){_0x298ed7[_0x0f4b('0x3e')]=_[_0x0f4b('0x41')](_0x298ed7['where'],{'$or':_['map'](_0x298ed7[_0x0f4b('0x37')],function(_0xf167a0){var _0x44d36e={};_0x44d36e[_0xf167a0]={'$like':'%'+_0x25a58b[_0x0f4b('0x35')]['filter']+'%'};return _0x44d36e;})});}_0x298ed7=_[_0x0f4b('0x41')]({},_0x298ed7,_0x25a58b[_0x0f4b('0x43')]);return db[_0x0f4b('0x62')][_0x0f4b('0x1c')]({'where':_0x298ed7[_0x0f4b('0x3e')]})['then'](function(_0x481e7f){_0x40edf5[_0x0f4b('0x1c')]=_0x481e7f;if(_0x25a58b[_0x0f4b('0x35')][_0x0f4b('0x4c')]){_0x298ed7[_0x0f4b('0x44')]=[{'all':!![]}];}return db[_0x0f4b('0x62')][_0x0f4b('0x45')](_0x298ed7);})['then'](function(_0x58dd5a){_0x40edf5['rows']=_0x58dd5a;return _0x40edf5;});}})[_0x0f4b('0x25')](respondWithFilteredResult(_0x2cb348,_0x298ed7))[_0x0f4b('0x46')](handleError(_0x2cb348,null));};exports[_0x0f4b('0x63')]=function(_0x58af04,_0x117a25,_0x714c8c){var _0x579f1f={};var _0x1f1beb={};var _0xb1d142;var _0x3f0227;return db[_0x0f4b('0x30')][_0x0f4b('0x5a')]({'where':{'id':_0x58af04['params']['id']}})[_0x0f4b('0x25')](handleEntityNotFound(_0x117a25,null))[_0x0f4b('0x25')](function(_0x362e06){if(_0x362e06){_0xb1d142=_0x362e06;_0x1f1beb['model']=_[_0x0f4b('0x49')](db[_0x0f4b('0x64')][_0x0f4b('0x4a')]);_0x1f1beb['query']=_[_0x0f4b('0x49')](_0x58af04[_0x0f4b('0x35')]);_0x1f1beb['filters']=_[_0x0f4b('0x4b')](_0x1f1beb['model'],_0x1f1beb[_0x0f4b('0x35')]);_0x579f1f['attributes']=_[_0x0f4b('0x4b')](_0x1f1beb[_0x0f4b('0x34')],qs[_0x0f4b('0x38')](_0x58af04[_0x0f4b('0x35')][_0x0f4b('0x38')]));_0x579f1f['attributes']=_0x579f1f[_0x0f4b('0x37')]['length']?_0x579f1f[_0x0f4b('0x37')]:_0x1f1beb[_0x0f4b('0x34')];_0x579f1f[_0x0f4b('0x3c')]=qs[_0x0f4b('0x3d')](_0x58af04[_0x0f4b('0x35')][_0x0f4b('0x3d')]);_0x579f1f['where']=qs[_0x0f4b('0x36')](_[_0x0f4b('0x3f')](_0x58af04[_0x0f4b('0x35')],_0x1f1beb['filters']));if(_0x58af04[_0x0f4b('0x35')][_0x0f4b('0x40')]){_0x579f1f['where']=_[_0x0f4b('0x41')](_0x579f1f[_0x0f4b('0x3e')],{'$or':_[_0x0f4b('0x2f')](_0x579f1f[_0x0f4b('0x37')],function(_0x533a91){var _0x387804={};_0x387804[_0x533a91]={'$like':'%'+_0x58af04['query'][_0x0f4b('0x40')]+'%'};return _0x387804;})});}_0x579f1f=_[_0x0f4b('0x41')]({},_0x579f1f,_0x58af04[_0x0f4b('0x43')]);return _0xb1d142[_0x0f4b('0x63')](_0x579f1f);}})[_0x0f4b('0x25')](function(_0x1c6d77){if(_0x1c6d77){_0x3f0227=_0x1c6d77[_0x0f4b('0x39')];if(!_0x58af04[_0x0f4b('0x35')][_0x0f4b('0x3a')](_0x0f4b('0x3b'))){_0x579f1f[_0x0f4b('0x1e')]=qs[_0x0f4b('0x1e')](_0x58af04['query'][_0x0f4b('0x1e')]);_0x579f1f[_0x0f4b('0x1d')]=qs[_0x0f4b('0x1d')](_0x58af04[_0x0f4b('0x35')][_0x0f4b('0x1d')]);}return _0xb1d142[_0x0f4b('0x63')](_0x579f1f);}})[_0x0f4b('0x25')](function(_0x57fd3f){if(_0x57fd3f){return _0x57fd3f?{'count':_0x3f0227,'rows':_0x57fd3f}:null;}})[_0x0f4b('0x25')](respondWithResult(_0x117a25,null))[_0x0f4b('0x46')](handleError(_0x117a25,null));};exports[_0x0f4b('0x65')]=function(_0x23eb89,_0x71a5a1,_0x2752e4){var _0x2625a6,_0xe3ee47;return db[_0x0f4b('0x30')]['find']({'where':{'id':_0x23eb89[_0x0f4b('0x48')]['id']}})[_0x0f4b('0x25')](handleEntityNotFound(_0x71a5a1,null))['then'](function(_0x10f5f4){if(_0x10f5f4){_0xe3ee47=_0x10f5f4;return _0x10f5f4[_0x0f4b('0x65')](_0x23eb89['body'][_0x0f4b('0x66')],_[_0x0f4b('0x54')](_0x23eb89[_0x0f4b('0x4f')],[_0x0f4b('0x66'),'id'])||{});}return null;})[_0x0f4b('0x67')](function(_0x1a097e){var _0x11177b;_0x2625a6=_0x1a097e||[];var _0x31ad2f=[];if(_0x1a097e){for(var _0xa15f83=0x0;_0xa15f83<_0x1a097e[_0x0f4b('0x39')];_0xa15f83+=0x1){var _0x38b237=_0x1a097e[_0xa15f83][_0x0f4b('0x27')]({'plain':!![]});_0xe3ee47[_0x0f4b('0x68')]=_0x23eb89[_0x0f4b('0x4f')]['dialCheckDuplicateType']?_0x23eb89[_0x0f4b('0x4f')]['dialCheckDuplicateType']:_0xe3ee47[_0x0f4b('0x68')];switch(_0xe3ee47[_0x0f4b('0x68')]){case _0x0f4b('0x69'):_0x11177b=squel[_0x0f4b('0x6a')]()[_0x0f4b('0x6b')](_0x0f4b('0x6c'))[_0x0f4b('0x6d')](['phone',_0x0f4b('0x6e'),'ContactId',_0x0f4b('0x6f'),_0x0f4b('0x5b'),'createdAt',_0x0f4b('0x55')],squel['select']()[_0x0f4b('0x70')]('phone',_0x0f4b('0x71'))[_0x0f4b('0x70')]('NOW()',_0x0f4b('0x6e'))[_0x0f4b('0x70')]('id','ContactId')['field'](_0x38b237['CmListId']['toString'](),_0x0f4b('0x6f'))['field'](_0x23eb89[_0x0f4b('0x48')]['id'][_0x0f4b('0x72')](),_0x0f4b('0x5b'))[_0x0f4b('0x70')](_0x0f4b('0x73'),'createdAt')[_0x0f4b('0x70')]('NOW()','updatedAt')[_0x0f4b('0x74')](_0x0f4b('0x75'))[_0x0f4b('0x3e')](_0x0f4b('0x76'))[_0x0f4b('0x3e')](_0x0f4b('0x77'),_0x38b237[_0x0f4b('0x78')]['toString']())[_0x0f4b('0x3e')](_0x0f4b('0x79'))[_0x0f4b('0x3e')](_0x0f4b('0x7a'),squel['select']()[_0x0f4b('0x70')](_0x0f4b('0x7b'))[_0x0f4b('0x74')](_0x0f4b('0x7c'))[_0x0f4b('0x3e')]('CampaignId\x20=\x20?',_0x23eb89[_0x0f4b('0x48')]['id'][_0x0f4b('0x72')]()))[_0x0f4b('0x3e')](_0x0f4b('0x7a'),squel['select']()[_0x0f4b('0x70')]('COALESCE(phone,\x27\x27)')[_0x0f4b('0x74')](_0x0f4b('0x6c'))[_0x0f4b('0x3e')](_0x0f4b('0x7d'),_0x23eb89[_0x0f4b('0x48')]['id'][_0x0f4b('0x72')]())))[_0x0f4b('0x72')]();break;case _0x0f4b('0x7e'):_0x11177b=squel[_0x0f4b('0x6a')]()[_0x0f4b('0x6b')](_0x0f4b('0x6c'))['fromQuery']([_0x0f4b('0x71'),_0x0f4b('0x6e'),_0x0f4b('0x7f'),_0x0f4b('0x6f'),_0x0f4b('0x5b'),_0x0f4b('0x80'),'updatedAt'],squel[_0x0f4b('0x81')]()['field'](_0x0f4b('0x71'),_0x0f4b('0x71'))[_0x0f4b('0x70')](_0x0f4b('0x73'),_0x0f4b('0x6e'))[_0x0f4b('0x70')]('id',_0x0f4b('0x7f'))[_0x0f4b('0x70')](_0x38b237[_0x0f4b('0x78')]['toString'](),'ListId')[_0x0f4b('0x70')](_0x23eb89[_0x0f4b('0x48')]['id'][_0x0f4b('0x72')](),_0x0f4b('0x5b'))['field'](_0x0f4b('0x73'),_0x0f4b('0x80'))['field'](_0x0f4b('0x73'),_0x0f4b('0x55'))[_0x0f4b('0x74')](_0x0f4b('0x75'))['where'](_0x0f4b('0x76'))[_0x0f4b('0x3e')](_0x0f4b('0x77'),_0x38b237[_0x0f4b('0x78')][_0x0f4b('0x72')]())[_0x0f4b('0x3e')](_0x0f4b('0x79'))['where']('phone\x20NOT\x20IN\x20(?)',squel[_0x0f4b('0x81')]()[_0x0f4b('0x70')]('COALESCE(phone,\x27\x27)')[_0x0f4b('0x74')](_0x0f4b('0x6c'))[_0x0f4b('0x3e')]('CampaignId\x20=\x20?',_0x23eb89[_0x0f4b('0x48')]['id'][_0x0f4b('0x72')]())))[_0x0f4b('0x72')]();break;default:_0x11177b=squel['insert']()['into'](_0x0f4b('0x6c'))[_0x0f4b('0x6d')]([_0x0f4b('0x71'),_0x0f4b('0x6e'),'ContactId','ListId',_0x0f4b('0x5b'),_0x0f4b('0x80'),_0x0f4b('0x55')],squel[_0x0f4b('0x81')]()['field'](_0x0f4b('0x71'),_0x0f4b('0x71'))[_0x0f4b('0x70')](_0x0f4b('0x73'),_0x0f4b('0x6e'))[_0x0f4b('0x70')]('id',_0x0f4b('0x7f'))[_0x0f4b('0x70')](_0x38b237[_0x0f4b('0x78')]['toString'](),'ListId')[_0x0f4b('0x70')](_0x23eb89[_0x0f4b('0x48')]['id'][_0x0f4b('0x72')](),_0x0f4b('0x5b'))[_0x0f4b('0x70')](_0x0f4b('0x73'),_0x0f4b('0x80'))[_0x0f4b('0x70')](_0x0f4b('0x73'),_0x0f4b('0x55'))['from'](_0x0f4b('0x75'))[_0x0f4b('0x3e')](_0x0f4b('0x76'))['where'](_0x0f4b('0x77'),_0x38b237[_0x0f4b('0x78')][_0x0f4b('0x72')]())[_0x0f4b('0x3e')](_0x0f4b('0x79')))[_0x0f4b('0x72')]();}_0x31ad2f[_0x0f4b('0x82')](db['sequelize'][_0x0f4b('0x35')](_0x11177b));}return BPromise[_0x0f4b('0x83')](_0x31ad2f);}})[_0x0f4b('0x25')](function(){return _0x2625a6;})[_0x0f4b('0x25')](respondWithResult(_0x71a5a1,null))[_0x0f4b('0x46')](handleError(_0x71a5a1,null));};exports[_0x0f4b('0x84')]=function(_0x503692,_0xb34431,_0x120f3b){return db[_0x0f4b('0x30')]['find']({'where':{'id':_0x503692['params']['id']}})['then'](handleEntityNotFound(_0xb34431,null))[_0x0f4b('0x25')](function(_0x33d95c){if(_0x33d95c){return _0x33d95c[_0x0f4b('0x84')](_0x503692['query']['ids']);}})[_0x0f4b('0x25')](function(_0x5b6146){if(_0x5b6146){return db[_0x0f4b('0x5c')][_0x0f4b('0x26')]({'where':{'ListId':_0x503692[_0x0f4b('0x35')][_0x0f4b('0x66')],'CampaignId':_0x503692[_0x0f4b('0x48')]['id']}})[_0x0f4b('0x25')](function(){return _0x5b6146;});}})['then'](respondWithStatusCode(_0xb34431,null))[_0x0f4b('0x46')](handleError(_0xb34431,null));};exports[_0x0f4b('0x85')]=function(_0x146468,_0x415774,_0x475343){var _0x34b627={'raw':!![],'where':{}};var _0x150931={};var _0x2b3d37={'count':0x0,'rows':[]};return db[_0x0f4b('0x30')][_0x0f4b('0x5a')]({'where':{'id':_0x146468[_0x0f4b('0x48')]['id']}})['then'](handleEntityNotFound(_0x415774,null))[_0x0f4b('0x25')](function(_0x3d793f){if(_0x3d793f){_0x150931[_0x0f4b('0x34')]=_['keys'](db[_0x0f4b('0x64')][_0x0f4b('0x4a')]);_0x150931[_0x0f4b('0x35')]=_[_0x0f4b('0x49')](_0x146468[_0x0f4b('0x35')]);_0x150931[_0x0f4b('0x36')]=_[_0x0f4b('0x4b')](_0x150931['model'],_0x150931[_0x0f4b('0x35')]);_0x34b627[_0x0f4b('0x37')]=_[_0x0f4b('0x4b')](_0x150931[_0x0f4b('0x34')],qs['fields'](_0x146468[_0x0f4b('0x35')][_0x0f4b('0x38')]));_0x34b627['attributes']=_0x34b627[_0x0f4b('0x37')][_0x0f4b('0x39')]?_0x34b627[_0x0f4b('0x37')]:_0x150931['model'];if(!_0x146468[_0x0f4b('0x35')][_0x0f4b('0x3a')](_0x0f4b('0x3b'))){_0x34b627['limit']=qs[_0x0f4b('0x1e')](_0x146468[_0x0f4b('0x35')][_0x0f4b('0x1e')]);_0x34b627['offset']=qs[_0x0f4b('0x1d')](_0x146468[_0x0f4b('0x35')][_0x0f4b('0x1d')]);}_0x34b627['order']=qs[_0x0f4b('0x3d')](_0x146468[_0x0f4b('0x35')][_0x0f4b('0x3d')]);_0x34b627['where']=qs[_0x0f4b('0x36')](_[_0x0f4b('0x3f')](_0x146468['query'],_0x150931['filters']));_0x34b627[_0x0f4b('0x3e')]['CampaignId']=_0x3d793f['id'];if(_0x146468[_0x0f4b('0x35')][_0x0f4b('0x40')]){_0x34b627[_0x0f4b('0x3e')]=_[_0x0f4b('0x41')](_0x34b627[_0x0f4b('0x3e')],{'$or':_[_0x0f4b('0x2f')](_0x34b627['attributes'],function(_0x154465){var _0x456fca={};_0x456fca[_0x154465]={'$like':'%'+_0x146468[_0x0f4b('0x35')][_0x0f4b('0x40')]+'%'};return _0x456fca;})});}_0x34b627=_[_0x0f4b('0x41')]({},_0x34b627,_0x146468['options']);return db['CmList']['count']({'where':_0x34b627[_0x0f4b('0x3e')]})['then'](function(_0x3d9bef){_0x2b3d37['count']=_0x3d9bef;if(_0x146468[_0x0f4b('0x35')]['includeAll']){_0x34b627[_0x0f4b('0x44')]=[{'all':!![]}];}return db['CmList'][_0x0f4b('0x45')](_0x34b627);})['then'](function(_0x3fc03e){_0x2b3d37[_0x0f4b('0x5f')]=_0x3fc03e;return _0x2b3d37;});}})[_0x0f4b('0x25')](respondWithFilteredResult(_0x415774,_0x34b627))[_0x0f4b('0x46')](handleError(_0x415774,null));};exports[_0x0f4b('0x86')]=function(_0x4d49b5,_0x4ac702,_0x17a69a){var _0xd38428,_0x73f711;return db['Campaign']['find']({'where':{'id':_0x4d49b5[_0x0f4b('0x48')]['id']}})['then'](handleEntityNotFound(_0x4ac702,null))[_0x0f4b('0x25')](function(_0x2a11c2){if(_0x2a11c2){_0x73f711=_0x2a11c2;return _0x2a11c2[_0x0f4b('0x86')](_0x4d49b5['body'][_0x0f4b('0x66')],_['omit'](_0x4d49b5[_0x0f4b('0x4f')],['ids','id'])||{});}return null;})[_0x0f4b('0x67')](function(_0x2cb528){var _0x59bb9b;_0xd38428=_0x2cb528||[];var _0x169a05=[];if(_0x2cb528){for(var _0x310eba=0x0;_0x310eba<_0x2cb528['length'];_0x310eba+=0x1){var _0x350b94=_0x2cb528[_0x310eba][_0x0f4b('0x27')]({'plain':!![]});_0x59bb9b=squel['insert']()[_0x0f4b('0x6b')](_0x0f4b('0x87'))[_0x0f4b('0x6d')]([_0x0f4b('0x71'),_0x0f4b('0x7f'),_0x0f4b('0x6f'),_0x0f4b('0x5b'),_0x0f4b('0x80'),_0x0f4b('0x55')],squel['select']()[_0x0f4b('0x70')](_0x0f4b('0x71'),_0x0f4b('0x71'))[_0x0f4b('0x70')]('id',_0x0f4b('0x7f'))[_0x0f4b('0x70')](_0x350b94[_0x0f4b('0x78')][_0x0f4b('0x72')](),_0x0f4b('0x6f'))['field'](_0x4d49b5[_0x0f4b('0x48')]['id'][_0x0f4b('0x72')](),'CampaignId')['field'](_0x0f4b('0x73'),_0x0f4b('0x80'))['field'](_0x0f4b('0x73'),_0x0f4b('0x55'))[_0x0f4b('0x74')](_0x0f4b('0x75'))['where'](_0x0f4b('0x76'))['where'](_0x0f4b('0x77'),_0x350b94[_0x0f4b('0x78')][_0x0f4b('0x72')]())['where']('phone\x20IS\x20NOT\x20NULL'))[_0x0f4b('0x72')]();_0x169a05['push'](db[_0x0f4b('0x88')][_0x0f4b('0x35')](_0x59bb9b));}return BPromise[_0x0f4b('0x83')](_0x169a05);}})[_0x0f4b('0x25')](function(){return _0xd38428;})['then'](respondWithResult(_0x4ac702,null))[_0x0f4b('0x46')](handleError(_0x4ac702,null));};exports[_0x0f4b('0x89')]=function(_0x476417,_0x15172b,_0x41beb6){return db[_0x0f4b('0x30')][_0x0f4b('0x4d')]({'where':{'id':_0x476417[_0x0f4b('0x48')]['id']}})[_0x0f4b('0x25')](handleEntityNotFound(_0x15172b,null))[_0x0f4b('0x25')](function(_0x100f0b){if(_0x100f0b){return _0x100f0b[_0x0f4b('0x89')](_0x476417[_0x0f4b('0x35')][_0x0f4b('0x66')]);}})[_0x0f4b('0x25')](function(_0x191a8f){if(_0x191a8f){return db[_0x0f4b('0x62')][_0x0f4b('0x26')]({'where':{'ListId':_0x476417[_0x0f4b('0x35')][_0x0f4b('0x66')],'CampaignId':_0x476417[_0x0f4b('0x48')]['id']}})[_0x0f4b('0x25')](function(){return _0x191a8f;});}})[_0x0f4b('0x25')](respondWithStatusCode(_0x15172b,null))[_0x0f4b('0x46')](handleError(_0x15172b,null));}; \ No newline at end of file diff --git a/server/api/campaign/campaign.model.js b/server/api/campaign/campaign.model.js index c17fe38..d6abdb0 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(_0x28a8c7,_0x856bd7){var _0x1648d4=function(_0x36bdc7){while(--_0x36bdc7){_0x28a8c7['push'](_0x28a8c7['shift']());}};_0x1648d4(++_0x856bd7);}(_0xa9e0,0x123));var _0x0a9e=function(_0xbb091,_0x3fe7ee){_0xbb091=_0xbb091-0x0;var _0x467a04=_0xa9e0[_0xbb091];return _0x467a04;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var 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 _0xb10b=['api','moment','request-promise','path','rimraf','../../config/environment','./campaign.attributes','exports','define','campaigns','lodash','../../config/logger'];(function(_0x3fb030,_0x12aebe){var _0xd6899b=function(_0x327646){while(--_0x327646){_0x3fb030['push'](_0x3fb030['shift']());}};_0xd6899b(++_0x12aebe);}(_0xb10b,0x12a));var _0xbb10=function(_0x52b844,_0x434e67){_0x52b844=_0x52b844-0x0;var _0x14432f=_0xb10b[_0x52b844];return _0x14432f;};'use strict';var _=require(_0xbb10('0x0'));var util=require('util');var logger=require(_0xbb10('0x1'))(_0xbb10('0x2'));var moment=require(_0xbb10('0x3'));var BPromise=require('bluebird');var rp=require(_0xbb10('0x4'));var fs=require('fs');var path=require(_0xbb10('0x5'));var rimraf=require(_0xbb10('0x6'));var config=require(_0xbb10('0x7'));var attributes=require(_0xbb10('0x8'));module[_0xbb10('0x9')]=function(_0x481979,_0x328583){return _0x481979[_0xbb10('0xa')]('Campaign',attributes,{'tableName':_0xbb10('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/campaign/campaign.rpc.js b/server/api/campaign/campaign.rpc.js index 4692f61..d313c45 100644 --- a/server/api/campaign/campaign.rpc.js +++ b/server/api/campaign/campaign.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['catch','GetCampaign','findAll','raw','options','where','attributes','limit','map','include','model','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','then','info','Campaign,\x20%s,\x20%s','request\x20sent','debug','Campaign,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result'];(function(_0x336d19,_0x3767d0){var _0x419656=function(_0x3add45){while(--_0x3add45){_0x336d19['push'](_0x336d19['shift']());}};_0x419656(++_0x3767d0);}(_0x9957,0x93));var _0x7995=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x9957[_0x2dafbe];return _0x58a45a;};'use strict';var _=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var moment=require(_0x7995('0x2'));var BPromise=require(_0x7995('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7995('0x4'));var db=require(_0x7995('0x5'))['db'];var utils=require(_0x7995('0x6'));var logger=require(_0x7995('0x7'))('rpc');var config=require(_0x7995('0x8'));var jayson=require(_0x7995('0x9'));var client=jayson[_0x7995('0xa')][_0x7995('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xbda126,_0x326741,_0x4996ca){return new BPromise(function(_0x465276,_0x1cad37){return client['request'](_0xbda126,_0x4996ca)[_0x7995('0xc')](function(_0x3116fb){logger[_0x7995('0xd')](_0x7995('0xe'),_0x326741,_0x7995('0xf'));logger[_0x7995('0x10')](_0x7995('0x11'),_0x326741,'request\x20sent',JSON[_0x7995('0x12')](_0x3116fb));if(_0x3116fb[_0x7995('0x13')]){if(_0x3116fb['error'][_0x7995('0x14')]===0x1f4){logger[_0x7995('0x13')](_0x7995('0xe'),_0x326741,_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);return _0x1cad37(_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);}logger['error']('Campaign,\x20%s,\x20%s',_0x326741,_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);return _0x465276(_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);}else{logger[_0x7995('0xd')](_0x7995('0xe'),_0x326741,_0x7995('0xf'));_0x465276(_0x3116fb[_0x7995('0x16')]['message']);}})[_0x7995('0x17')](function(_0x565d97){logger[_0x7995('0x13')](_0x7995('0xe'),_0x326741,_0x565d97);_0x1cad37(_0x565d97);});});}exports[_0x7995('0x18')]=function(_0x291317){var _0x1e1415=this;return new Promise(function(_0x37a7d4,_0x4faa60){return db['Campaign'][_0x7995('0x19')]({'raw':_0x291317['options']?_0x291317['options'][_0x7995('0x1a')]===undefined?!![]:![]:!![],'where':_0x291317[_0x7995('0x1b')]?_0x291317['options'][_0x7995('0x1c')]||null:null,'attributes':_0x291317['options']?_0x291317['options'][_0x7995('0x1d')]||null:null,'limit':_0x291317[_0x7995('0x1b')]?_0x291317[_0x7995('0x1b')][_0x7995('0x1e')]||null:null,'include':_0x291317[_0x7995('0x1b')]?_0x291317[_0x7995('0x1b')]['include']?_[_0x7995('0x1f')](_0x291317[_0x7995('0x1b')][_0x7995('0x20')],function(_0x285437){return{'model':db[_0x285437[_0x7995('0x21')]],'as':_0x285437['as'],'attributes':_0x285437[_0x7995('0x1d')],'include':_0x285437[_0x7995('0x20')]?_[_0x7995('0x1f')](_0x285437['include'],function(_0x39df42){return{'model':db[_0x39df42[_0x7995('0x21')]],'as':_0x39df42['as'],'attributes':_0x39df42[_0x7995('0x1d')],'include':_0x39df42[_0x7995('0x20')]?_[_0x7995('0x1f')](_0x39df42[_0x7995('0x20')],function(_0x56691a){return{'model':db[_0x56691a[_0x7995('0x21')]],'as':_0x56691a['as'],'attributes':_0x56691a['attributes']};}):[]};}):[]};}):[]:[]})[_0x7995('0xc')](function(_0x49bc7e){logger[_0x7995('0xd')](_0x7995('0x18'),_0x291317);logger[_0x7995('0x10')]('GetCampaign',_0x291317,JSON[_0x7995('0x12')](_0x49bc7e));_0x37a7d4(_0x49bc7e);})['catch'](function(_0x456a28){logger[_0x7995('0x13')](_0x7995('0x18'),_0x456a28['message'],_0x291317);_0x4faa60(_0x1e1415['error'](0x1f4,_0x456a28['message']));});});}; \ No newline at end of file +var _0x9957=['catch','GetCampaign','findAll','raw','options','where','attributes','limit','map','include','model','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','then','info','Campaign,\x20%s,\x20%s','request\x20sent','debug','Campaign,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result'];(function(_0x1d408d,_0x2fef27){var _0x112a98=function(_0x5615a8){while(--_0x5615a8){_0x1d408d['push'](_0x1d408d['shift']());}};_0x112a98(++_0x2fef27);}(_0x9957,0x93));var _0x7995=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x9957[_0x3947c9];return _0x2e7871;};'use strict';var _=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var moment=require(_0x7995('0x2'));var BPromise=require(_0x7995('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7995('0x4'));var db=require(_0x7995('0x5'))['db'];var utils=require(_0x7995('0x6'));var logger=require(_0x7995('0x7'))('rpc');var config=require(_0x7995('0x8'));var jayson=require(_0x7995('0x9'));var client=jayson[_0x7995('0xa')][_0x7995('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xbda126,_0x326741,_0x4996ca){return new BPromise(function(_0x465276,_0x1cad37){return client['request'](_0xbda126,_0x4996ca)[_0x7995('0xc')](function(_0x3116fb){logger[_0x7995('0xd')](_0x7995('0xe'),_0x326741,_0x7995('0xf'));logger[_0x7995('0x10')](_0x7995('0x11'),_0x326741,'request\x20sent',JSON[_0x7995('0x12')](_0x3116fb));if(_0x3116fb[_0x7995('0x13')]){if(_0x3116fb['error'][_0x7995('0x14')]===0x1f4){logger[_0x7995('0x13')](_0x7995('0xe'),_0x326741,_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);return _0x1cad37(_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);}logger['error']('Campaign,\x20%s,\x20%s',_0x326741,_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);return _0x465276(_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);}else{logger[_0x7995('0xd')](_0x7995('0xe'),_0x326741,_0x7995('0xf'));_0x465276(_0x3116fb[_0x7995('0x16')]['message']);}})[_0x7995('0x17')](function(_0x565d97){logger[_0x7995('0x13')](_0x7995('0xe'),_0x326741,_0x565d97);_0x1cad37(_0x565d97);});});}exports[_0x7995('0x18')]=function(_0x291317){var _0x1e1415=this;return new Promise(function(_0x37a7d4,_0x4faa60){return db['Campaign'][_0x7995('0x19')]({'raw':_0x291317['options']?_0x291317['options'][_0x7995('0x1a')]===undefined?!![]:![]:!![],'where':_0x291317[_0x7995('0x1b')]?_0x291317['options'][_0x7995('0x1c')]||null:null,'attributes':_0x291317['options']?_0x291317['options'][_0x7995('0x1d')]||null:null,'limit':_0x291317[_0x7995('0x1b')]?_0x291317[_0x7995('0x1b')][_0x7995('0x1e')]||null:null,'include':_0x291317[_0x7995('0x1b')]?_0x291317[_0x7995('0x1b')]['include']?_[_0x7995('0x1f')](_0x291317[_0x7995('0x1b')][_0x7995('0x20')],function(_0x285437){return{'model':db[_0x285437[_0x7995('0x21')]],'as':_0x285437['as'],'attributes':_0x285437[_0x7995('0x1d')],'include':_0x285437[_0x7995('0x20')]?_[_0x7995('0x1f')](_0x285437['include'],function(_0x39df42){return{'model':db[_0x39df42[_0x7995('0x21')]],'as':_0x39df42['as'],'attributes':_0x39df42[_0x7995('0x1d')],'include':_0x39df42[_0x7995('0x20')]?_[_0x7995('0x1f')](_0x39df42[_0x7995('0x20')],function(_0x56691a){return{'model':db[_0x56691a[_0x7995('0x21')]],'as':_0x56691a['as'],'attributes':_0x56691a['attributes']};}):[]};}):[]};}):[]:[]})[_0x7995('0xc')](function(_0x49bc7e){logger[_0x7995('0xd')](_0x7995('0x18'),_0x291317);logger[_0x7995('0x10')]('GetCampaign',_0x291317,JSON[_0x7995('0x12')](_0x49bc7e));_0x37a7d4(_0x49bc7e);})['catch'](function(_0x456a28){logger[_0x7995('0x13')](_0x7995('0x18'),_0x456a28['message'],_0x291317);_0x4faa60(_0x1e1415['error'](0x1f4,_0x456a28['message']));});});}; \ No newline at end of file diff --git a/server/api/campaign/index.js b/server/api/campaign/index.js index a4753e6..a0f0907 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 _0xf4de=['multer','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./campaign.controller','get','index','/:id','isAuthenticated','getHoppers','/:id/hopper_histories','getHopperHistories','/:id/hopper_finals','getHopperFinals','/:id/hopper_black','getHopperBlacks','/:id/lists','getLists','/:id/blacklists','getBlackLists','post','create','/:id/clone','clone','put','update','delete','destroy','removeBlackLists'];(function(_0x3a3fcc,_0x38afb3){var _0xe16438=function(_0x2280b4){while(--_0x2280b4){_0x3a3fcc['push'](_0x3a3fcc['shift']());}};_0xe16438(++_0x38afb3);}(_0xf4de,0x160));var _0xef4d=function(_0x340fc8,_0x5dbd85){_0x340fc8=_0x340fc8-0x0;var _0x38df28=_0xf4de[_0x340fc8];return _0x38df28;};'use strict';var multer=require(_0xef4d('0x0'));var util=require('util');var path=require(_0xef4d('0x1'));var timeout=require(_0xef4d('0x2'));var express=require(_0xef4d('0x3'));var router=express['Router']();var auth=require(_0xef4d('0x4'));var interaction=require(_0xef4d('0x5'));var config=require(_0xef4d('0x6'));var controller=require(_0xef4d('0x7'));router[_0xef4d('0x8')]('/',auth['isAuthenticated'](),controller[_0xef4d('0x9')]);router[_0xef4d('0x8')](_0xef4d('0xa'),auth[_0xef4d('0xb')](),controller['show']);router[_0xef4d('0x8')]('/:id/hoppers',auth[_0xef4d('0xb')](),controller[_0xef4d('0xc')]);router['get'](_0xef4d('0xd'),auth[_0xef4d('0xb')](),controller[_0xef4d('0xe')]);router[_0xef4d('0x8')](_0xef4d('0xf'),auth[_0xef4d('0xb')](),controller[_0xef4d('0x10')]);router[_0xef4d('0x8')](_0xef4d('0x11'),auth[_0xef4d('0xb')](),controller[_0xef4d('0x12')]);router[_0xef4d('0x8')](_0xef4d('0x13'),auth[_0xef4d('0xb')](),controller[_0xef4d('0x14')]);router[_0xef4d('0x8')](_0xef4d('0x15'),auth['isAuthenticated'](),controller[_0xef4d('0x16')]);router[_0xef4d('0x17')]('/',auth[_0xef4d('0xb')](),controller[_0xef4d('0x18')]);router[_0xef4d('0x17')](_0xef4d('0x19'),auth[_0xef4d('0xb')](),controller[_0xef4d('0x1a')]);router[_0xef4d('0x17')](_0xef4d('0x13'),auth[_0xef4d('0xb')](),controller['addLists']);router['post'](_0xef4d('0x15'),auth[_0xef4d('0xb')](),controller['addBlackLists']);router[_0xef4d('0x1b')](_0xef4d('0xa'),auth[_0xef4d('0xb')](),controller[_0xef4d('0x1c')]);router[_0xef4d('0x1d')]('/:id',auth[_0xef4d('0xb')](),controller[_0xef4d('0x1e')]);router[_0xef4d('0x1d')](_0xef4d('0x13'),auth[_0xef4d('0xb')](),controller['removeLists']);router['delete'](_0xef4d('0x15'),auth[_0xef4d('0xb')](),controller[_0xef4d('0x1f')]);module['exports']=router; \ No newline at end of file +var _0xc037=['getHoppers','/:id/hopper_histories','getHopperFinals','getHopperBlacks','/:id/lists','getLists','post','create','clone','addLists','update','destroy','delete','removeLists','/:id/blacklists','removeBlackLists','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./campaign.controller','get','isAuthenticated','/:id','show','/:id/hoppers'];(function(_0x322652,_0x5a85c0){var _0x5d5e88=function(_0x5ce853){while(--_0x5ce853){_0x322652['push'](_0x322652['shift']());}};_0x5d5e88(++_0x5a85c0);}(_0xc037,0x88));var _0x7c03=function(_0x51b057,_0x1a509c){_0x51b057=_0x51b057-0x0;var _0x55716c=_0xc037[_0x51b057];return _0x55716c;};'use strict';var multer=require('multer');var util=require(_0x7c03('0x0'));var path=require(_0x7c03('0x1'));var timeout=require(_0x7c03('0x2'));var express=require(_0x7c03('0x3'));var router=express[_0x7c03('0x4')]();var auth=require(_0x7c03('0x5'));var interaction=require(_0x7c03('0x6'));var config=require(_0x7c03('0x7'));var controller=require(_0x7c03('0x8'));router[_0x7c03('0x9')]('/',auth[_0x7c03('0xa')](),controller['index']);router[_0x7c03('0x9')](_0x7c03('0xb'),auth[_0x7c03('0xa')](),controller[_0x7c03('0xc')]);router[_0x7c03('0x9')](_0x7c03('0xd'),auth[_0x7c03('0xa')](),controller[_0x7c03('0xe')]);router['get'](_0x7c03('0xf'),auth[_0x7c03('0xa')](),controller['getHopperHistories']);router[_0x7c03('0x9')]('/:id/hopper_finals',auth['isAuthenticated'](),controller[_0x7c03('0x10')]);router[_0x7c03('0x9')]('/:id/hopper_black',auth[_0x7c03('0xa')](),controller[_0x7c03('0x11')]);router[_0x7c03('0x9')](_0x7c03('0x12'),auth['isAuthenticated'](),controller[_0x7c03('0x13')]);router[_0x7c03('0x9')]('/:id/blacklists',auth[_0x7c03('0xa')](),controller['getBlackLists']);router[_0x7c03('0x14')]('/',auth['isAuthenticated'](),controller[_0x7c03('0x15')]);router[_0x7c03('0x14')]('/:id/clone',auth[_0x7c03('0xa')](),controller[_0x7c03('0x16')]);router[_0x7c03('0x14')]('/:id/lists',auth[_0x7c03('0xa')](),controller[_0x7c03('0x17')]);router[_0x7c03('0x14')]('/:id/blacklists',auth[_0x7c03('0xa')](),controller['addBlackLists']);router['put']('/:id',auth[_0x7c03('0xa')](),controller[_0x7c03('0x18')]);router['delete'](_0x7c03('0xb'),auth[_0x7c03('0xa')](),controller[_0x7c03('0x19')]);router[_0x7c03('0x1a')]('/:id/lists',auth[_0x7c03('0xa')](),controller[_0x7c03('0x1b')]);router[_0x7c03('0x1a')](_0x7c03('0x1c'),auth[_0x7c03('0xa')](),controller[_0x7c03('0x1d')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.attributes.js b/server/api/cannedAnswer/cannedAnswer.attributes.js index c506205..4d16dd3 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 _0xd458=['VIRTUAL','getDataValue','key','exports','STRING'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0xd458,0x1de));var _0x8d45=function(_0x519bf7,_0x3b46bf){_0x519bf7=_0x519bf7-0x0;var _0x1267cc=_0xd458[_0x519bf7];return _0x1267cc;};'use strict';var Sequelize=require('sequelize');module[_0x8d45('0x0')]={'key':{'type':Sequelize['STRING'],'allowNull':![]},'value':{'type':Sequelize['TEXT'],'allowNull':![]},'description':{'type':Sequelize[_0x8d45('0x1')]},'name':{'type':Sequelize[_0x8d45('0x2')],'get':function(){return this[_0x8d45('0x3')](_0x8d45('0x4'));}}}; \ No newline at end of file +var _0xd080=['VIRTUAL','getDataValue','key','sequelize','STRING'];(function(_0x5d4607,_0x6b5e7b){var _0x5e4a86=function(_0x46891a){while(--_0x46891a){_0x5d4607['push'](_0x5d4607['shift']());}};_0x5e4a86(++_0x6b5e7b);}(_0xd080,0x198));var _0x0d08=function(_0x21ab24,_0x5849aa){_0x21ab24=_0x21ab24-0x0;var _0x41f411=_0xd080[_0x21ab24];return _0x41f411;};'use strict';var Sequelize=require(_0x0d08('0x0'));module['exports']={'key':{'type':Sequelize[_0x0d08('0x1')],'allowNull':![]},'value':{'type':Sequelize['TEXT'],'allowNull':![]},'description':{'type':Sequelize[_0x0d08('0x1')]},'name':{'type':Sequelize[_0x0d08('0x2')],'get':function(){return this[_0x0d08('0x3')](_0x0d08('0x4'));}}}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.controller.js b/server/api/cannedAnswer/cannedAnswer.controller.js index 8460501..ce76a0a 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 _0x2115=['key','MailAccountId','SmsAccountId','OpenchannelAccountId','ChatWebsiteId','The\x20inserted\x20key\x20already\x20exists.','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','autoAssociation','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','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/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','apply','reject','save','then','destroy','CannedAnswers','UserProfileResource','error','stack','name','send','index','map','CannedAnswer','rawAttributes','fieldName','type','query','keys','filters','intersection','attributes','model','fields','length','sort','where','filter','VIRTUAL','merge','options','includeAll','findAll','rows','catch','show','params','include','find','update','body'];(function(_0x376b45,_0x5964fb){var _0x2341b3=function(_0x5a7f01){while(--_0x5a7f01){_0x376b45['push'](_0x376b45['shift']());}};_0x2341b3(++_0x5964fb);}(_0x2115,0xbf));var _0x5211=function(_0x59710f,_0x44c7f0){_0x59710f=_0x59710f-0x0;var _0xaae66a=_0x2115[_0x59710f];return _0xaae66a;};'use strict';var pdf=require(_0x5211('0x0'));var emlformat=require(_0x5211('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x5211('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x5211('0x3'));var moment=require(_0x5211('0x4'));var BPromise=require(_0x5211('0x5'));var Mustache=require(_0x5211('0x6'));var util=require(_0x5211('0x7'));var path=require(_0x5211('0x8'));var sox=require(_0x5211('0x9'));var csv=require(_0x5211('0xa'));var ejs=require(_0x5211('0xb'));var fs=require('fs');var _=require(_0x5211('0xc'));var squel=require('squel');var crypto=require(_0x5211('0xd'));var jsforce=require(_0x5211('0xe'));var deskjs=require(_0x5211('0xf'));var toCsv=require('to-csv');var querystring=require(_0x5211('0x10'));var Papa=require(_0x5211('0x11'));var Redis=require(_0x5211('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x5211('0x13'));var as=require(_0x5211('0x14'));var hardwareService=require(_0x5211('0x15'));var logger=require(_0x5211('0x16'))(_0x5211('0x17'));var utils=require(_0x5211('0x18'));var config=require(_0x5211('0x19'));var db=require(_0x5211('0x1a'))['db'];function respondWithStatusCode(_0x200393,_0x21e253){_0x21e253=_0x21e253||0xcc;return function(_0x4eb959){if(_0x4eb959){return _0x200393[_0x5211('0x1b')](_0x21e253);}return _0x200393[_0x5211('0x1c')](_0x21e253)[_0x5211('0x1d')]();};}function respondWithResult(_0x13981d,_0x1ccc8e){_0x1ccc8e=_0x1ccc8e||0xc8;return function(_0x36caca){if(_0x36caca){return _0x13981d[_0x5211('0x1c')](_0x1ccc8e)[_0x5211('0x1e')](_0x36caca);}};}function respondWithFilteredResult(_0x1d07f5,_0x404370){return function(_0x1c6db1){if(_0x1c6db1){var _0x596048=_0x1c6db1[_0x5211('0x1f')],_0x22941c=_0x404370[_0x5211('0x20')],_0x539883=_0x404370[_0x5211('0x20')]+_0x404370[_0x5211('0x21')],_0xfd174b;if(_0x539883>=_0x596048){_0x539883=_0x596048;_0xfd174b=0xc8;}else{_0xfd174b=0xce;}_0x1d07f5['status'](_0xfd174b);return _0x1d07f5[_0x5211('0x22')]('Content-Range',_0x22941c+'-'+_0x539883+'/'+_0x596048)['json'](_0x1c6db1);}return null;};}function patchUpdates(_0x353a01){return function(_0x3e78c0){try{jsonpatch[_0x5211('0x23')](_0x3e78c0,_0x353a01,!![]);}catch(_0x3e94ad){return BPromise[_0x5211('0x24')](_0x3e94ad);}return _0x3e78c0[_0x5211('0x25')]();};}function saveUpdates(_0x4bbb4d,_0x5e927b){return function(_0x290c97){if(_0x290c97){return _0x290c97['update'](_0x4bbb4d)[_0x5211('0x26')](function(_0x412f43){return _0x412f43;});}return null;};}function removeEntity(_0x3a7ec1,_0x1524de){return function(_0xf983f2){if(_0xf983f2){return _0xf983f2[_0x5211('0x27')]()[_0x5211('0x26')](function(){var _0x3cf0fa=_0xf983f2['get']({'plain':!![]});var _0x455992=_0x5211('0x28');return db[_0x5211('0x29')]['destroy']({'where':{'type':_0x455992,'resourceId':_0x3cf0fa['id']}})[_0x5211('0x26')](function(){return _0xf983f2;});})[_0x5211('0x26')](function(){_0x3a7ec1[_0x5211('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3466a1,_0x12323d){return function(_0x37ca41){if(!_0x37ca41){_0x3466a1['sendStatus'](0x194);}return _0x37ca41;};}function handleError(_0x3fa475,_0x4067e2){_0x4067e2=_0x4067e2||0x1f4;return function(_0x1f9853){logger[_0x5211('0x2a')](_0x1f9853[_0x5211('0x2b')]);if(_0x1f9853[_0x5211('0x2c')]){delete _0x1f9853[_0x5211('0x2c')];}_0x3fa475[_0x5211('0x1c')](_0x4067e2)[_0x5211('0x2d')](_0x1f9853);};}exports[_0x5211('0x2e')]=function(_0x307c0f,_0xaeadab){var _0x73c9bd={},_0x5536a1={},_0xf3916={'count':0x0,'rows':[]};var _0x23998b=_[_0x5211('0x2f')](db[_0x5211('0x30')][_0x5211('0x31')],function(_0x289ec3){return{'name':_0x289ec3[_0x5211('0x32')],'type':_0x289ec3[_0x5211('0x33')]['key']};});_0x5536a1['model']=_[_0x5211('0x2f')](_0x23998b,_0x5211('0x2c'));_0x5536a1[_0x5211('0x34')]=_[_0x5211('0x35')](_0x307c0f[_0x5211('0x34')]);_0x5536a1[_0x5211('0x36')]=_[_0x5211('0x37')](_0x5536a1['model'],_0x5536a1[_0x5211('0x34')]);_0x73c9bd[_0x5211('0x38')]=_['intersection'](_0x5536a1[_0x5211('0x39')],qs['fields'](_0x307c0f['query'][_0x5211('0x3a')]));_0x73c9bd['attributes']=_0x73c9bd[_0x5211('0x38')][_0x5211('0x3b')]?_0x73c9bd[_0x5211('0x38')]:_0x5536a1[_0x5211('0x39')];if(!_0x307c0f[_0x5211('0x34')]['hasOwnProperty']('nolimit')){_0x73c9bd[_0x5211('0x21')]=qs['limit'](_0x307c0f[_0x5211('0x34')]['limit']);_0x73c9bd['offset']=qs[_0x5211('0x20')](_0x307c0f['query'][_0x5211('0x20')]);}_0x73c9bd['order']=qs[_0x5211('0x3c')](_0x307c0f[_0x5211('0x34')]['sort']);_0x73c9bd[_0x5211('0x3d')]=qs['filters'](_['pick'](_0x307c0f[_0x5211('0x34')],_0x5536a1[_0x5211('0x36')]),_0x23998b);if(_0x307c0f[_0x5211('0x34')][_0x5211('0x3e')]){_0x73c9bd[_0x5211('0x3d')]=_['merge'](_0x73c9bd[_0x5211('0x3d')],{'$or':_['map'](_0x23998b,function(_0x4cd744){if(_0x4cd744[_0x5211('0x33')]!==_0x5211('0x3f')){var _0x64078c={};_0x64078c[_0x4cd744[_0x5211('0x2c')]]={'$like':'%'+_0x307c0f[_0x5211('0x34')][_0x5211('0x3e')]+'%'};return _0x64078c;}})});}_0x73c9bd=_[_0x5211('0x40')]({},_0x73c9bd,_0x307c0f[_0x5211('0x41')]);var _0x1473f4={'where':_0x73c9bd[_0x5211('0x3d')]};return db[_0x5211('0x30')][_0x5211('0x1f')](_0x1473f4)[_0x5211('0x26')](function(_0x4045f8){_0xf3916[_0x5211('0x1f')]=_0x4045f8;if(_0x307c0f[_0x5211('0x34')][_0x5211('0x42')]){_0x73c9bd['include']=[{'all':!![]}];}return db['CannedAnswer'][_0x5211('0x43')](_0x73c9bd);})[_0x5211('0x26')](function(_0x1128b5){_0xf3916[_0x5211('0x44')]=_0x1128b5;return _0xf3916;})[_0x5211('0x26')](respondWithFilteredResult(_0xaeadab,_0x73c9bd))[_0x5211('0x45')](handleError(_0xaeadab,null));};exports[_0x5211('0x46')]=function(_0x42f2cc,_0x2eb6fc){var _0x265d8b={'raw':!![],'where':{'id':_0x42f2cc[_0x5211('0x47')]['id']}},_0x47768b={};_0x47768b[_0x5211('0x39')]=_[_0x5211('0x35')](db[_0x5211('0x30')][_0x5211('0x31')]);_0x47768b['query']=_['keys'](_0x42f2cc[_0x5211('0x34')]);_0x47768b[_0x5211('0x36')]=_[_0x5211('0x37')](_0x47768b[_0x5211('0x39')],_0x47768b[_0x5211('0x34')]);_0x265d8b[_0x5211('0x38')]=_['intersection'](_0x47768b['model'],qs[_0x5211('0x3a')](_0x42f2cc[_0x5211('0x34')]['fields']));_0x265d8b[_0x5211('0x38')]=_0x265d8b[_0x5211('0x38')][_0x5211('0x3b')]?_0x265d8b[_0x5211('0x38')]:_0x47768b[_0x5211('0x39')];if(_0x42f2cc[_0x5211('0x34')]['includeAll']){_0x265d8b[_0x5211('0x48')]=[{'all':!![]}];}_0x265d8b=_[_0x5211('0x40')]({},_0x265d8b,_0x42f2cc[_0x5211('0x41')]);return db[_0x5211('0x30')][_0x5211('0x49')](_0x265d8b)[_0x5211('0x26')](handleEntityNotFound(_0x2eb6fc,null))[_0x5211('0x26')](respondWithResult(_0x2eb6fc,null))[_0x5211('0x45')](handleError(_0x2eb6fc,null));};exports[_0x5211('0x4a')]=function(_0x2856ce,_0x4a6696){if(_0x2856ce[_0x5211('0x4b')]['id']){delete _0x2856ce['body']['id'];}return db[_0x5211('0x30')][_0x5211('0x49')]({'where':{'id':_0x2856ce['params']['id']}})['then'](handleEntityNotFound(_0x4a6696,null))[_0x5211('0x26')](saveUpdates(_0x2856ce[_0x5211('0x4b')],null))[_0x5211('0x26')](respondWithResult(_0x4a6696,null))[_0x5211('0x45')](handleError(_0x4a6696,null));};exports[_0x5211('0x27')]=function(_0x2b2451,_0x3f658d){return db[_0x5211('0x30')]['find']({'where':{'id':_0x2b2451[_0x5211('0x47')]['id']}})[_0x5211('0x26')](handleEntityNotFound(_0x3f658d,null))[_0x5211('0x26')](removeEntity(_0x3f658d,null))[_0x5211('0x45')](handleError(_0x3f658d,null));};exports['create']=function(_0x5818f4,_0x6c0381){var _0x3eae23={'key':_0x5818f4[_0x5211('0x4b')][_0x5211('0x4c')]};if(_0x5818f4[_0x5211('0x4b')][_0x5211('0x4d')]){_0x3eae23[_0x5211('0x4d')]=_0x5818f4[_0x5211('0x4b')][_0x5211('0x4d')];}else if(_0x5818f4[_0x5211('0x4b')][_0x5211('0x4e')]){_0x3eae23[_0x5211('0x4e')]=_0x5818f4['body'][_0x5211('0x4e')];}else if(_0x5818f4[_0x5211('0x4b')]['OpenchannelAccountId']){_0x3eae23[_0x5211('0x4f')]=_0x5818f4[_0x5211('0x4b')][_0x5211('0x4f')];}else if(_0x5818f4[_0x5211('0x4b')][_0x5211('0x50')]){_0x3eae23['ChatWebsiteId']=_0x5818f4['body'][_0x5211('0x50')];}return db[_0x5211('0x30')]['find']({'where':_0x3eae23})['then'](function(_0x5f1a63){if(_0x5f1a63){throw new db['Sequelize']['ValidationError'](_0x5211('0x51'));}return db[_0x5211('0x30')]['create'](_0x5818f4[_0x5211('0x4b')]);})[_0x5211('0x26')](function(_0x54da56){var _0x3af03d=_0x5818f4[_0x5211('0x52')][_0x5211('0x53')]({'plain':!![]});if(!_0x3af03d)throw new Error(_0x5211('0x54'));if(_0x3af03d[_0x5211('0x55')]===_0x5211('0x52')){var _0x2411ad=_0x54da56[_0x5211('0x53')]({'plain':!![]});return db['UserProfileSection'][_0x5211('0x49')]({'where':{'name':_0x5211('0x28'),'userProfileId':_0x3af03d['userProfileId']},'raw':!![]})['then'](function(_0x5f136d){if(_0x5f136d&&_0x5f136d[_0x5211('0x56')]===0x0){return db['UserProfileResource'][_0x5211('0x57')]({'name':_0x2411ad[_0x5211('0x2c')],'resourceId':_0x2411ad['id'],'type':_0x5f136d[_0x5211('0x2c')],'sectionId':_0x5f136d['id']},{})[_0x5211('0x26')](function(){return _0x54da56;});}else{return _0x54da56;}})[_0x5211('0x45')](function(_0x302b3d){logger[_0x5211('0x2a')](_0x5211('0x58'),_0x302b3d);throw _0x302b3d;});}return _0x54da56;})[_0x5211('0x26')](respondWithResult(_0x6c0381,0xc9))[_0x5211('0x45')](handleError(_0x6c0381,null));}; \ No newline at end of file +var _0x9837=['limit','Content-Range','apply','reject','save','update','then','destroy','UserProfileResource','sendStatus','error','name','map','CannedAnswer','rawAttributes','type','key','query','keys','intersection','model','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','rows','show','options','find','catch','body','params','create','MailAccountId','SmsAccountId','OpenchannelAccountId','ChatWebsiteId','Sequelize','ValidationError','The\x20inserted\x20key\x20already\x20exists.','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/environment','../../mysqldb','status','json','count','offset'];(function(_0x5c049a,_0x2c1263){var _0x168e70=function(_0x49441e){while(--_0x49441e){_0x5c049a['push'](_0x5c049a['shift']());}};_0x168e70(++_0x2c1263);}(_0x9837,0x1d6));var _0x7983=function(_0x175b8,_0x176eb6){_0x175b8=_0x175b8-0x0;var _0x41034d=_0x9837[_0x175b8];return _0x41034d;};'use strict';var pdf=require(_0x7983('0x0'));var emlformat=require(_0x7983('0x1'));var rimraf=require(_0x7983('0x2'));var zipdir=require(_0x7983('0x3'));var jsonpatch=require(_0x7983('0x4'));var rp=require('request-promise');var moment=require(_0x7983('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x7983('0x6'));var util=require(_0x7983('0x7'));var path=require(_0x7983('0x8'));var sox=require(_0x7983('0x9'));var csv=require(_0x7983('0xa'));var ejs=require(_0x7983('0xb'));var fs=require('fs');var _=require(_0x7983('0xc'));var squel=require(_0x7983('0xd'));var crypto=require(_0x7983('0xe'));var jsforce=require(_0x7983('0xf'));var deskjs=require(_0x7983('0x10'));var toCsv=require(_0x7983('0xa'));var querystring=require('querystring');var Papa=require(_0x7983('0x11'));var Redis=require('ioredis');var authService=require(_0x7983('0x12'));var qs=require(_0x7983('0x13'));var as=require(_0x7983('0x14'));var hardwareService=require(_0x7983('0x15'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0x7983('0x16'));var db=require(_0x7983('0x17'))['db'];function respondWithStatusCode(_0x33b931,_0xbf1eee){_0xbf1eee=_0xbf1eee||0xcc;return function(_0x43eea7){if(_0x43eea7){return _0x33b931['sendStatus'](_0xbf1eee);}return _0x33b931[_0x7983('0x18')](_0xbf1eee)['end']();};}function respondWithResult(_0x361036,_0x387466){_0x387466=_0x387466||0xc8;return function(_0x578fe6){if(_0x578fe6){return _0x361036[_0x7983('0x18')](_0x387466)[_0x7983('0x19')](_0x578fe6);}};}function respondWithFilteredResult(_0x3b9420,_0x3b03fc){return function(_0x3a1a02){if(_0x3a1a02){var _0xfb5a5c=_0x3a1a02[_0x7983('0x1a')],_0x340dc5=_0x3b03fc[_0x7983('0x1b')],_0x2ced70=_0x3b03fc['offset']+_0x3b03fc[_0x7983('0x1c')],_0x259f1e;if(_0x2ced70>=_0xfb5a5c){_0x2ced70=_0xfb5a5c;_0x259f1e=0xc8;}else{_0x259f1e=0xce;}_0x3b9420['status'](_0x259f1e);return _0x3b9420['set'](_0x7983('0x1d'),_0x340dc5+'-'+_0x2ced70+'/'+_0xfb5a5c)[_0x7983('0x19')](_0x3a1a02);}return null;};}function patchUpdates(_0x51956f){return function(_0x148b27){try{jsonpatch[_0x7983('0x1e')](_0x148b27,_0x51956f,!![]);}catch(_0x5d1191){return BPromise[_0x7983('0x1f')](_0x5d1191);}return _0x148b27[_0x7983('0x20')]();};}function saveUpdates(_0x671bd4,_0x8cf311){return function(_0x41a4c8){if(_0x41a4c8){return _0x41a4c8[_0x7983('0x21')](_0x671bd4)[_0x7983('0x22')](function(_0x497fe9){return _0x497fe9;});}return null;};}function removeEntity(_0x2cced0,_0xf42047){return function(_0x5b4e9e){if(_0x5b4e9e){return _0x5b4e9e[_0x7983('0x23')]()['then'](function(){var _0x444a48=_0x5b4e9e['get']({'plain':!![]});var _0xc50734='CannedAnswers';return db[_0x7983('0x24')]['destroy']({'where':{'type':_0xc50734,'resourceId':_0x444a48['id']}})[_0x7983('0x22')](function(){return _0x5b4e9e;});})[_0x7983('0x22')](function(){_0x2cced0[_0x7983('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4f87a5,_0x299e80){return function(_0x493cb4){if(!_0x493cb4){_0x4f87a5[_0x7983('0x25')](0x194);}return _0x493cb4;};}function handleError(_0x9c4b29,_0x2f0456){_0x2f0456=_0x2f0456||0x1f4;return function(_0x39e528){logger[_0x7983('0x26')](_0x39e528['stack']);if(_0x39e528[_0x7983('0x27')]){delete _0x39e528[_0x7983('0x27')];}_0x9c4b29['status'](_0x2f0456)['send'](_0x39e528);};}exports['index']=function(_0x56f31c,_0x2ce1a7){var _0x266504={},_0x534521={},_0x236c39={'count':0x0,'rows':[]};var _0x49a87c=_[_0x7983('0x28')](db[_0x7983('0x29')][_0x7983('0x2a')],function(_0x53acf3){return{'name':_0x53acf3['fieldName'],'type':_0x53acf3[_0x7983('0x2b')][_0x7983('0x2c')]};});_0x534521['model']=_[_0x7983('0x28')](_0x49a87c,_0x7983('0x27'));_0x534521[_0x7983('0x2d')]=_[_0x7983('0x2e')](_0x56f31c[_0x7983('0x2d')]);_0x534521['filters']=_[_0x7983('0x2f')](_0x534521[_0x7983('0x30')],_0x534521[_0x7983('0x2d')]);_0x266504[_0x7983('0x31')]=_[_0x7983('0x2f')](_0x534521['model'],qs[_0x7983('0x32')](_0x56f31c[_0x7983('0x2d')][_0x7983('0x32')]));_0x266504[_0x7983('0x31')]=_0x266504['attributes'][_0x7983('0x33')]?_0x266504[_0x7983('0x31')]:_0x534521[_0x7983('0x30')];if(!_0x56f31c[_0x7983('0x2d')]['hasOwnProperty'](_0x7983('0x34'))){_0x266504[_0x7983('0x1c')]=qs[_0x7983('0x1c')](_0x56f31c['query'][_0x7983('0x1c')]);_0x266504[_0x7983('0x1b')]=qs['offset'](_0x56f31c[_0x7983('0x2d')][_0x7983('0x1b')]);}_0x266504[_0x7983('0x35')]=qs['sort'](_0x56f31c[_0x7983('0x2d')][_0x7983('0x36')]);_0x266504[_0x7983('0x37')]=qs['filters'](_[_0x7983('0x38')](_0x56f31c[_0x7983('0x2d')],_0x534521['filters']),_0x49a87c);if(_0x56f31c[_0x7983('0x2d')][_0x7983('0x39')]){_0x266504[_0x7983('0x37')]=_[_0x7983('0x3a')](_0x266504[_0x7983('0x37')],{'$or':_[_0x7983('0x28')](_0x49a87c,function(_0x14484b){if(_0x14484b[_0x7983('0x2b')]!==_0x7983('0x3b')){var _0x1106a4={};_0x1106a4[_0x14484b[_0x7983('0x27')]]={'$like':'%'+_0x56f31c[_0x7983('0x2d')][_0x7983('0x39')]+'%'};return _0x1106a4;}})});}_0x266504=_[_0x7983('0x3a')]({},_0x266504,_0x56f31c['options']);var _0x76bb2f={'where':_0x266504[_0x7983('0x37')]};return db['CannedAnswer']['count'](_0x76bb2f)['then'](function(_0x396773){_0x236c39[_0x7983('0x1a')]=_0x396773;if(_0x56f31c[_0x7983('0x2d')][_0x7983('0x3c')]){_0x266504['include']=[{'all':!![]}];}return db[_0x7983('0x29')]['findAll'](_0x266504);})[_0x7983('0x22')](function(_0x56ece3){_0x236c39[_0x7983('0x3d')]=_0x56ece3;return _0x236c39;})[_0x7983('0x22')](respondWithFilteredResult(_0x2ce1a7,_0x266504))['catch'](handleError(_0x2ce1a7,null));};exports[_0x7983('0x3e')]=function(_0x19f2a0,_0x1ea0b1){var _0x51f854={'raw':!![],'where':{'id':_0x19f2a0['params']['id']}},_0x183bc1={};_0x183bc1[_0x7983('0x30')]=_[_0x7983('0x2e')](db[_0x7983('0x29')][_0x7983('0x2a')]);_0x183bc1['query']=_['keys'](_0x19f2a0[_0x7983('0x2d')]);_0x183bc1['filters']=_[_0x7983('0x2f')](_0x183bc1[_0x7983('0x30')],_0x183bc1[_0x7983('0x2d')]);_0x51f854[_0x7983('0x31')]=_[_0x7983('0x2f')](_0x183bc1['model'],qs[_0x7983('0x32')](_0x19f2a0[_0x7983('0x2d')][_0x7983('0x32')]));_0x51f854[_0x7983('0x31')]=_0x51f854['attributes']['length']?_0x51f854[_0x7983('0x31')]:_0x183bc1['model'];if(_0x19f2a0[_0x7983('0x2d')][_0x7983('0x3c')]){_0x51f854['include']=[{'all':!![]}];}_0x51f854=_[_0x7983('0x3a')]({},_0x51f854,_0x19f2a0[_0x7983('0x3f')]);return db['CannedAnswer'][_0x7983('0x40')](_0x51f854)[_0x7983('0x22')](handleEntityNotFound(_0x1ea0b1,null))[_0x7983('0x22')](respondWithResult(_0x1ea0b1,null))[_0x7983('0x41')](handleError(_0x1ea0b1,null));};exports[_0x7983('0x21')]=function(_0x3db01c,_0x1f66f1){if(_0x3db01c[_0x7983('0x42')]['id']){delete _0x3db01c[_0x7983('0x42')]['id'];}return db[_0x7983('0x29')]['find']({'where':{'id':_0x3db01c['params']['id']}})[_0x7983('0x22')](handleEntityNotFound(_0x1f66f1,null))[_0x7983('0x22')](saveUpdates(_0x3db01c[_0x7983('0x42')],null))[_0x7983('0x22')](respondWithResult(_0x1f66f1,null))['catch'](handleError(_0x1f66f1,null));};exports[_0x7983('0x23')]=function(_0x5c4214,_0x28ccc3){return db[_0x7983('0x29')]['find']({'where':{'id':_0x5c4214[_0x7983('0x43')]['id']}})[_0x7983('0x22')](handleEntityNotFound(_0x28ccc3,null))[_0x7983('0x22')](removeEntity(_0x28ccc3,null))['catch'](handleError(_0x28ccc3,null));};exports[_0x7983('0x44')]=function(_0x25e602,_0x107492){var _0x476174={'key':_0x25e602['body'][_0x7983('0x2c')]};if(_0x25e602['body'][_0x7983('0x45')]){_0x476174[_0x7983('0x45')]=_0x25e602[_0x7983('0x42')][_0x7983('0x45')];}else if(_0x25e602['body'][_0x7983('0x46')]){_0x476174[_0x7983('0x46')]=_0x25e602[_0x7983('0x42')][_0x7983('0x46')];}else if(_0x25e602['body'][_0x7983('0x47')]){_0x476174[_0x7983('0x47')]=_0x25e602[_0x7983('0x42')][_0x7983('0x47')];}else if(_0x25e602[_0x7983('0x42')][_0x7983('0x48')]){_0x476174[_0x7983('0x48')]=_0x25e602[_0x7983('0x42')]['ChatWebsiteId'];}return db[_0x7983('0x29')][_0x7983('0x40')]({'where':_0x476174})[_0x7983('0x22')](function(_0xd3fa1e){if(_0xd3fa1e){throw new db[(_0x7983('0x49'))][(_0x7983('0x4a'))](_0x7983('0x4b'));}return db[_0x7983('0x29')][_0x7983('0x44')](_0x25e602[_0x7983('0x42')]);})['then'](function(_0x57e4b8){var _0xecbf9a=_0x25e602['user'][_0x7983('0x4c')]({'plain':!![]});if(!_0xecbf9a)throw new Error(_0x7983('0x4d'));if(_0xecbf9a[_0x7983('0x4e')]==='user'){var _0x31944c=_0x57e4b8[_0x7983('0x4c')]({'plain':!![]});return db[_0x7983('0x4f')][_0x7983('0x40')]({'where':{'name':'CannedAnswers','userProfileId':_0xecbf9a[_0x7983('0x50')]},'raw':!![]})['then'](function(_0x5e8549){if(_0x5e8549&&_0x5e8549[_0x7983('0x51')]===0x0){return db['UserProfileResource'][_0x7983('0x44')]({'name':_0x31944c[_0x7983('0x27')],'resourceId':_0x31944c['id'],'type':_0x5e8549[_0x7983('0x27')],'sectionId':_0x5e8549['id']},{})['then'](function(){return _0x57e4b8;});}else{return _0x57e4b8;}})['catch'](function(_0xf993b1){logger['error'](_0x7983('0x52'),_0xf993b1);throw _0xf993b1;});}return _0x57e4b8;})[_0x7983('0x22')](respondWithResult(_0x107492,0xc9))[_0x7983('0x41')](handleError(_0x107492,null));}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.model.js b/server/api/cannedAnswer/cannedAnswer.model.js index c79e9de..ee34615 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 _0x78d3=['exports','tools_canned_answers','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./cannedAnswer.attributes'];(function(_0x5315bc,_0x3788a0){var _0x40b280=function(_0x4369ea){while(--_0x4369ea){_0x5315bc['push'](_0x5315bc['shift']());}};_0x40b280(++_0x3788a0);}(_0x78d3,0x73));var _0x378d=function(_0x40e609,_0x4e4b74){_0x40e609=_0x40e609-0x0;var _0xf46928=_0x78d3[_0x40e609];return _0xf46928;};'use strict';var _=require(_0x378d('0x0'));var util=require(_0x378d('0x1'));var logger=require(_0x378d('0x2'))(_0x378d('0x3'));var moment=require(_0x378d('0x4'));var BPromise=require(_0x378d('0x5'));var rp=require(_0x378d('0x6'));var fs=require('fs');var path=require(_0x378d('0x7'));var rimraf=require(_0x378d('0x8'));var config=require(_0x378d('0x9'));var attributes=require(_0x378d('0xa'));module[_0x378d('0xb')]=function(_0xc18c0b,_0x59117c){return _0xc18c0b['define']('CannedAnswer',attributes,{'tableName':_0x378d('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x378d('0xd')});}; \ No newline at end of file +var _0x9f7a=['utf8mb4','lodash','util','../../config/logger','api','bluebird','../../config/environment','./cannedAnswer.attributes'];(function(_0x16228d,_0x5ee350){var _0x3e734b=function(_0x51871c){while(--_0x51871c){_0x16228d['push'](_0x16228d['shift']());}};_0x3e734b(++_0x5ee350);}(_0x9f7a,0xf1));var _0xa9f7=function(_0x68ee8b,_0x3cc6c5){_0x68ee8b=_0x68ee8b-0x0;var _0x5148f7=_0x9f7a[_0x68ee8b];return _0x5148f7;};'use strict';var _=require(_0xa9f7('0x0'));var util=require(_0xa9f7('0x1'));var logger=require(_0xa9f7('0x2'))(_0xa9f7('0x3'));var moment=require('moment');var BPromise=require(_0xa9f7('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xa9f7('0x5'));var attributes=require(_0xa9f7('0x6'));module['exports']=function(_0x499ff6,_0xc1334d){return _0x499ff6['define']('CannedAnswer',attributes,{'tableName':'tools_canned_answers','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xa9f7('0x7'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.rpc.js b/server/api/cannedAnswer/cannedAnswer.rpc.js index 512a042..556d889 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 _0xae07=['http','request','then','CannedAnswer,\x20%s,\x20%s','request\x20sent','debug','CannedAnswer,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','jayson/promise','client'];(function(_0x2e9bbc,_0xe722cc){var _0x129d25=function(_0x4ecb64){while(--_0x4ecb64){_0x2e9bbc['push'](_0x2e9bbc['shift']());}};_0x129d25(++_0xe722cc);}(_0xae07,0x1da));var _0x7ae0=function(_0x3054be,_0x1bdc8b){_0x3054be=_0x3054be-0x0;var _0x3df150=_0xae07[_0x3054be];return _0x3df150;};'use strict';var _=require(_0x7ae0('0x0'));var util=require(_0x7ae0('0x1'));var moment=require(_0x7ae0('0x2'));var BPromise=require(_0x7ae0('0x3'));var rs=require(_0x7ae0('0x4'));var fs=require('fs');var Redis=require(_0x7ae0('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x7ae0('0x6'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0x7ae0('0x7'));var client=jayson[_0x7ae0('0x8')][_0x7ae0('0x9')]({'port':0x232a});function respondWithRpcPromise(_0xb3e597,_0x56ba46,_0x1efef8){return new BPromise(function(_0x1f3f85,_0x4fa383){return client[_0x7ae0('0xa')](_0xb3e597,_0x1efef8)[_0x7ae0('0xb')](function(_0x3746ab){logger['info'](_0x7ae0('0xc'),_0x56ba46,_0x7ae0('0xd'));logger[_0x7ae0('0xe')](_0x7ae0('0xf'),_0x56ba46,_0x7ae0('0xd'),JSON[_0x7ae0('0x10')](_0x3746ab));if(_0x3746ab[_0x7ae0('0x11')]){if(_0x3746ab[_0x7ae0('0x11')]['code']===0x1f4){logger[_0x7ae0('0x11')](_0x7ae0('0xc'),_0x56ba46,_0x3746ab['error'][_0x7ae0('0x12')]);return _0x4fa383(_0x3746ab[_0x7ae0('0x11')][_0x7ae0('0x12')]);}logger[_0x7ae0('0x11')](_0x7ae0('0xc'),_0x56ba46,_0x3746ab[_0x7ae0('0x11')][_0x7ae0('0x12')]);return _0x1f3f85(_0x3746ab[_0x7ae0('0x11')][_0x7ae0('0x12')]);}else{logger['info'](_0x7ae0('0xc'),_0x56ba46,'request\x20sent');_0x1f3f85(_0x3746ab[_0x7ae0('0x13')]['message']);}})[_0x7ae0('0x14')](function(_0x216538){logger[_0x7ae0('0x11')]('CannedAnswer,\x20%s,\x20%s',_0x56ba46,_0x216538);_0x4fa383(_0x216538);});});} \ No newline at end of file +var _0x0d1c=['info','CannedAnswer,\x20%s,\x20%s','CannedAnswer,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then'];(function(_0x3220ae,_0x23e4b8){var _0x31def2=function(_0x3b4611){while(--_0x3b4611){_0x3220ae['push'](_0x3220ae['shift']());}};_0x31def2(++_0x23e4b8);}(_0x0d1c,0x1be));var _0xc0d1=function(_0x5a5059,_0x126afc){_0x5a5059=_0x5a5059-0x0;var _0x55be99=_0x0d1c[_0x5a5059];return _0x55be99;};'use strict';var _=require(_0xc0d1('0x0'));var util=require(_0xc0d1('0x1'));var moment=require(_0xc0d1('0x2'));var BPromise=require('bluebird');var rs=require(_0xc0d1('0x3'));var fs=require('fs');var Redis=require(_0xc0d1('0x4'));var db=require(_0xc0d1('0x5'))['db'];var utils=require(_0xc0d1('0x6'));var logger=require(_0xc0d1('0x7'))(_0xc0d1('0x8'));var config=require(_0xc0d1('0x9'));var jayson=require(_0xc0d1('0xa'));var client=jayson['client'][_0xc0d1('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x51e32e,_0x3a5ae9,_0x1d31b8){return new BPromise(function(_0x102bc9,_0x2854e4){return client[_0xc0d1('0xc')](_0x51e32e,_0x1d31b8)[_0xc0d1('0xd')](function(_0x2bfd6d){logger[_0xc0d1('0xe')](_0xc0d1('0xf'),_0x3a5ae9,'request\x20sent');logger['debug'](_0xc0d1('0x10'),_0x3a5ae9,_0xc0d1('0x11'),JSON[_0xc0d1('0x12')](_0x2bfd6d));if(_0x2bfd6d[_0xc0d1('0x13')]){if(_0x2bfd6d[_0xc0d1('0x13')][_0xc0d1('0x14')]===0x1f4){logger['error'](_0xc0d1('0xf'),_0x3a5ae9,_0x2bfd6d['error'][_0xc0d1('0x15')]);return _0x2854e4(_0x2bfd6d[_0xc0d1('0x13')][_0xc0d1('0x15')]);}logger[_0xc0d1('0x13')](_0xc0d1('0xf'),_0x3a5ae9,_0x2bfd6d[_0xc0d1('0x13')][_0xc0d1('0x15')]);return _0x102bc9(_0x2bfd6d[_0xc0d1('0x13')][_0xc0d1('0x15')]);}else{logger[_0xc0d1('0xe')](_0xc0d1('0xf'),_0x3a5ae9,_0xc0d1('0x11'));_0x102bc9(_0x2bfd6d['result'][_0xc0d1('0x15')]);}})[_0xc0d1('0x16')](function(_0x4783fd){logger[_0xc0d1('0x13')]('CannedAnswer,\x20%s,\x20%s',_0x3a5ae9,_0x4783fd);_0x2854e4(_0x4783fd);});});} \ No newline at end of file diff --git a/server/api/cannedAnswer/index.js b/server/api/cannedAnswer/index.js index 32ff29a..c5b4c02 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 _0x813e=['connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./cannedAnswer.controller','isAuthenticated','index','show','post','create','put','/:id','update','delete','destroy','exports','multer','util','path'];(function(_0x1c156e,_0x3263a6){var _0x58fc22=function(_0x42f1eb){while(--_0x42f1eb){_0x1c156e['push'](_0x1c156e['shift']());}};_0x58fc22(++_0x3263a6);}(_0x813e,0xba));var _0xe813=function(_0x39e164,_0x2cb93b){_0x39e164=_0x39e164-0x0;var _0x13fa6b=_0x813e[_0x39e164];return _0x13fa6b;};'use strict';var multer=require(_0xe813('0x0'));var util=require(_0xe813('0x1'));var path=require(_0xe813('0x2'));var timeout=require(_0xe813('0x3'));var express=require(_0xe813('0x4'));var router=express[_0xe813('0x5')]();var auth=require(_0xe813('0x6'));var interaction=require(_0xe813('0x7'));var config=require(_0xe813('0x8'));var controller=require(_0xe813('0x9'));router['get']('/',auth[_0xe813('0xa')](),controller[_0xe813('0xb')]);router['get']('/:id',auth[_0xe813('0xa')](),controller[_0xe813('0xc')]);router[_0xe813('0xd')]('/',auth['isAuthenticated'](),controller[_0xe813('0xe')]);router[_0xe813('0xf')](_0xe813('0x10'),auth[_0xe813('0xa')](),controller[_0xe813('0x11')]);router[_0xe813('0x12')]('/:id',auth[_0xe813('0xa')](),controller[_0xe813('0x13')]);module[_0xe813('0x14')]=router; \ No newline at end of file +var _0xe9d5=['destroy','exports','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./cannedAnswer.controller','get','isAuthenticated','index','/:id','show','post','create','put','update','delete'];(function(_0x2c1923,_0x5446e9){var _0x73c9b4=function(_0x1c0f5d){while(--_0x1c0f5d){_0x2c1923['push'](_0x2c1923['shift']());}};_0x73c9b4(++_0x5446e9);}(_0xe9d5,0x191));var _0x5e9d=function(_0x368e09,_0x2c1517){_0x368e09=_0x368e09-0x0;var _0x14b7df=_0xe9d5[_0x368e09];return _0x14b7df;};'use strict';var multer=require(_0x5e9d('0x0'));var util=require(_0x5e9d('0x1'));var path=require(_0x5e9d('0x2'));var timeout=require(_0x5e9d('0x3'));var express=require(_0x5e9d('0x4'));var router=express['Router']();var auth=require(_0x5e9d('0x5'));var interaction=require(_0x5e9d('0x6'));var config=require(_0x5e9d('0x7'));var controller=require(_0x5e9d('0x8'));router[_0x5e9d('0x9')]('/',auth[_0x5e9d('0xa')](),controller[_0x5e9d('0xb')]);router[_0x5e9d('0x9')](_0x5e9d('0xc'),auth[_0x5e9d('0xa')](),controller[_0x5e9d('0xd')]);router[_0x5e9d('0xe')]('/',auth['isAuthenticated'](),controller[_0x5e9d('0xf')]);router[_0x5e9d('0x10')](_0x5e9d('0xc'),auth[_0x5e9d('0xa')](),controller[_0x5e9d('0x11')]);router[_0x5e9d('0x12')](_0x5e9d('0xc'),auth['isAuthenticated'](),controller[_0x5e9d('0x13')]);module[_0x5e9d('0x14')]=router; \ No newline at end of file diff --git a/server/api/cdr/cdr.attributes.js b/server/api/cdr/cdr.attributes.js index 91ea38f..8c9eea5 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 _0x95b1=['sequelize','exports','DATE','1970-01-01\x2000:00:01','STRING','INTEGER'];(function(_0x465028,_0x4570ac){var _0xb783d4=function(_0x5458c5){while(--_0x5458c5){_0x465028['push'](_0x465028['shift']());}};_0xb783d4(++_0x4570ac);}(_0x95b1,0x7e));var _0x195b=function(_0x2eff65,_0x56d9be){_0x2eff65=_0x2eff65-0x0;var _0x1e898a=_0x95b1[_0x2eff65];return _0x1e898a;};'use strict';var Sequelize=require(_0x195b('0x0'));module[_0x195b('0x1')]={'calldate':{'type':Sequelize[_0x195b('0x2')],'allowNull':![],'defaultValue':_0x195b('0x3')},'clid':{'type':Sequelize[_0x195b('0x4')]},'src':{'type':Sequelize[_0x195b('0x4')]},'dst':{'type':Sequelize[_0x195b('0x4')]},'dcontext':{'type':Sequelize[_0x195b('0x4')]},'channel':{'type':Sequelize[_0x195b('0x4')]},'dstchannel':{'type':Sequelize[_0x195b('0x4')]},'lastapp':{'type':Sequelize['STRING']},'lastdata':{'type':Sequelize['STRING']},'duration':{'type':Sequelize[_0x195b('0x5')],'allowNull':![],'defaultValue':0x0},'billsec':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x0},'disposition':{'type':Sequelize[_0x195b('0x4')]},'amaflags':{'type':Sequelize[_0x195b('0x5')],'allowNull':![],'defaultValue':0x0},'accountcode':{'type':Sequelize[_0x195b('0x4')]},'userfield':{'type':Sequelize[_0x195b('0x4')]},'uniqueid':{'type':Sequelize['STRING']},'linkedid':{'type':Sequelize[_0x195b('0x4')]},'sequence':{'type':Sequelize[_0x195b('0x4')]},'peeraccount':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0x195b('0x4')]},'tag':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x4e45=['1970-01-01\x2000:00:01','STRING','INTEGER'];(function(_0x55a8d1,_0x517b73){var _0x2a5210=function(_0x17c765){while(--_0x17c765){_0x55a8d1['push'](_0x55a8d1['shift']());}};_0x2a5210(++_0x517b73);}(_0x4e45,0x1ef));var _0x54e4=function(_0x30e85e,_0x1f450d){_0x30e85e=_0x30e85e-0x0;var _0x1c86b6=_0x4e45[_0x30e85e];return _0x1c86b6;};'use strict';var Sequelize=require('sequelize');module['exports']={'calldate':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':_0x54e4('0x0')},'clid':{'type':Sequelize[_0x54e4('0x1')]},'src':{'type':Sequelize[_0x54e4('0x1')]},'dst':{'type':Sequelize[_0x54e4('0x1')]},'dcontext':{'type':Sequelize[_0x54e4('0x1')]},'channel':{'type':Sequelize[_0x54e4('0x1')]},'dstchannel':{'type':Sequelize[_0x54e4('0x1')]},'lastapp':{'type':Sequelize[_0x54e4('0x1')]},'lastdata':{'type':Sequelize['STRING']},'duration':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x0},'billsec':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x0},'disposition':{'type':Sequelize[_0x54e4('0x1')]},'amaflags':{'type':Sequelize[_0x54e4('0x2')],'allowNull':![],'defaultValue':0x0},'accountcode':{'type':Sequelize[_0x54e4('0x1')]},'userfield':{'type':Sequelize[_0x54e4('0x1')]},'uniqueid':{'type':Sequelize[_0x54e4('0x1')]},'linkedid':{'type':Sequelize['STRING']},'sequence':{'type':Sequelize['STRING']},'peeraccount':{'type':Sequelize[_0x54e4('0x1')]},'type':{'type':Sequelize[_0x54e4('0x1')]},'tag':{'type':Sequelize[_0x54e4('0x1')]}}; \ No newline at end of file diff --git a/server/api/cdr/cdr.controller.js b/server/api/cdr/cdr.controller.js index 7fef8d6..dbac5fb 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 _0xf2f7=['error','stack','name','send','index','Cdr','rawAttributes','type','key','model','map','keys','query','filters','attributes','intersection','fields','hasOwnProperty','nolimit','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','findAll','then','rows','catch','show','length','include','find','create','body','params','describe','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','ejs','lodash','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status','count','offset','limit','set','Content-Range','json','apply','reject','save'];(function(_0x2c7071,_0xad8154){var _0x7fecdf=function(_0x2fb8b0){while(--_0x2fb8b0){_0x2c7071['push'](_0x2c7071['shift']());}};_0x7fecdf(++_0xad8154);}(_0xf2f7,0x1ef));var _0x7f2f=function(_0x5e05ac,_0x54f012){_0x5e05ac=_0x5e05ac-0x0;var _0x57267f=_0xf2f7[_0x5e05ac];return _0x57267f;};'use strict';var pdf=require(_0x7f2f('0x0'));var emlformat=require(_0x7f2f('0x1'));var rimraf=require(_0x7f2f('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x7f2f('0x3'));var rp=require(_0x7f2f('0x4'));var moment=require('moment');var BPromise=require(_0x7f2f('0x5'));var Mustache=require(_0x7f2f('0x6'));var util=require(_0x7f2f('0x7'));var path=require(_0x7f2f('0x8'));var sox=require(_0x7f2f('0x9'));var csv=require('to-csv');var ejs=require(_0x7f2f('0xa'));var fs=require('fs');var _=require(_0x7f2f('0xb'));var squel=require('squel');var crypto=require(_0x7f2f('0xc'));var jsforce=require(_0x7f2f('0xd'));var deskjs=require(_0x7f2f('0xe'));var toCsv=require('to-csv');var querystring=require(_0x7f2f('0xf'));var Papa=require('papaparse');var Redis=require(_0x7f2f('0x10'));var authService=require(_0x7f2f('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x7f2f('0x12'));var hardwareService=require(_0x7f2f('0x13'));var logger=require(_0x7f2f('0x14'))(_0x7f2f('0x15'));var utils=require(_0x7f2f('0x16'));var config=require(_0x7f2f('0x17'));var db=require(_0x7f2f('0x18'))['db'];function respondWithStatusCode(_0x3a52a9,_0x322dd4){_0x322dd4=_0x322dd4||0xcc;return function(_0x52b3a7){if(_0x52b3a7){return _0x3a52a9[_0x7f2f('0x19')](_0x322dd4);}return _0x3a52a9['status'](_0x322dd4)[_0x7f2f('0x1a')]();};}function respondWithResult(_0x51e7a0,_0x4d7c5c){_0x4d7c5c=_0x4d7c5c||0xc8;return function(_0x389dba){if(_0x389dba){return _0x51e7a0[_0x7f2f('0x1b')](_0x4d7c5c)['json'](_0x389dba);}};}function respondWithFilteredResult(_0x27714d,_0xb3fdc6){return function(_0x3aa3ca){if(_0x3aa3ca){var _0x528086=_0x3aa3ca[_0x7f2f('0x1c')],_0x5b32fe=_0xb3fdc6[_0x7f2f('0x1d')],_0x11cd8e=_0xb3fdc6[_0x7f2f('0x1d')]+_0xb3fdc6[_0x7f2f('0x1e')],_0x52c213;if(_0x11cd8e>=_0x528086){_0x11cd8e=_0x528086;_0x52c213=0xc8;}else{_0x52c213=0xce;}_0x27714d['status'](_0x52c213);return _0x27714d[_0x7f2f('0x1f')](_0x7f2f('0x20'),_0x5b32fe+'-'+_0x11cd8e+'/'+_0x528086)[_0x7f2f('0x21')](_0x3aa3ca);}return null;};}function patchUpdates(_0x291c27){return function(_0x4f128d){try{jsonpatch[_0x7f2f('0x22')](_0x4f128d,_0x291c27,!![]);}catch(_0x59ac0c){return BPromise[_0x7f2f('0x23')](_0x59ac0c);}return _0x4f128d[_0x7f2f('0x24')]();};}function saveUpdates(_0x1e1faa,_0x41a045){return function(_0x49655e){if(_0x49655e){return _0x49655e['update'](_0x1e1faa)['then'](function(_0x21580d){return _0x21580d;});}return null;};}function removeEntity(_0x4f365d,_0x1e8884){return function(_0x17f9ec){if(_0x17f9ec){return _0x17f9ec['destroy']()['then'](function(){_0x4f365d[_0x7f2f('0x1b')](0xcc)[_0x7f2f('0x1a')]();});}};}function handleEntityNotFound(_0x56e10f,_0x4c14cc){return function(_0x344312){if(!_0x344312){_0x56e10f[_0x7f2f('0x19')](0x194);}return _0x344312;};}function handleError(_0x2ece4c,_0x105092){_0x105092=_0x105092||0x1f4;return function(_0x31c28a){logger[_0x7f2f('0x25')](_0x31c28a[_0x7f2f('0x26')]);if(_0x31c28a[_0x7f2f('0x27')]){delete _0x31c28a[_0x7f2f('0x27')];}_0x2ece4c[_0x7f2f('0x1b')](_0x105092)[_0x7f2f('0x28')](_0x31c28a);};}exports[_0x7f2f('0x29')]=function(_0x5a0604,_0x5b283f){var _0x59eef7={},_0xdd5448={},_0x4337df={'count':0x0,'rows':[]};var _0x56fef0=_['map'](db[_0x7f2f('0x2a')][_0x7f2f('0x2b')],function(_0x42c84f){return{'name':_0x42c84f['fieldName'],'type':_0x42c84f[_0x7f2f('0x2c')][_0x7f2f('0x2d')]};});_0xdd5448[_0x7f2f('0x2e')]=_[_0x7f2f('0x2f')](_0x56fef0,_0x7f2f('0x27'));_0xdd5448['query']=_[_0x7f2f('0x30')](_0x5a0604[_0x7f2f('0x31')]);_0xdd5448[_0x7f2f('0x32')]=_['intersection'](_0xdd5448[_0x7f2f('0x2e')],_0xdd5448[_0x7f2f('0x31')]);_0x59eef7[_0x7f2f('0x33')]=_[_0x7f2f('0x34')](_0xdd5448[_0x7f2f('0x2e')],qs[_0x7f2f('0x35')](_0x5a0604[_0x7f2f('0x31')][_0x7f2f('0x35')]));_0x59eef7[_0x7f2f('0x33')]=_0x59eef7[_0x7f2f('0x33')]['length']?_0x59eef7['attributes']:_0xdd5448[_0x7f2f('0x2e')];if(!_0x5a0604['query'][_0x7f2f('0x36')](_0x7f2f('0x37'))){_0x59eef7['limit']=qs[_0x7f2f('0x1e')](_0x5a0604[_0x7f2f('0x31')][_0x7f2f('0x1e')]);_0x59eef7['offset']=qs[_0x7f2f('0x1d')](_0x5a0604[_0x7f2f('0x31')]['offset']);}_0x59eef7['order']=qs[_0x7f2f('0x38')](_0x5a0604[_0x7f2f('0x31')][_0x7f2f('0x38')]);_0x59eef7[_0x7f2f('0x39')]=qs[_0x7f2f('0x32')](_[_0x7f2f('0x3a')](_0x5a0604[_0x7f2f('0x31')],_0xdd5448['filters']),_0x56fef0);if(_0x5a0604[_0x7f2f('0x31')]['filter']){_0x59eef7[_0x7f2f('0x39')]=_[_0x7f2f('0x3b')](_0x59eef7[_0x7f2f('0x39')],{'$or':_[_0x7f2f('0x2f')](_0x56fef0,function(_0x21213e){if(_0x21213e['type']!==_0x7f2f('0x3c')){var _0x3ac79b={};_0x3ac79b[_0x21213e['name']]={'$like':'%'+_0x5a0604[_0x7f2f('0x31')][_0x7f2f('0x3d')]+'%'};return _0x3ac79b;}})});}_0x59eef7=_[_0x7f2f('0x3b')]({},_0x59eef7,_0x5a0604[_0x7f2f('0x3e')]);var _0x55eee4={'where':_0x59eef7[_0x7f2f('0x39')]};return db[_0x7f2f('0x2a')][_0x7f2f('0x1c')](_0x55eee4)['then'](function(_0x23182c){_0x4337df[_0x7f2f('0x1c')]=_0x23182c;if(_0x5a0604['query'][_0x7f2f('0x3f')]){_0x59eef7['include']=[{'all':!![]}];}return db[_0x7f2f('0x2a')][_0x7f2f('0x40')](_0x59eef7);})[_0x7f2f('0x41')](function(_0x5a6f4d){_0x4337df[_0x7f2f('0x42')]=_0x5a6f4d;return _0x4337df;})[_0x7f2f('0x41')](respondWithFilteredResult(_0x5b283f,_0x59eef7))[_0x7f2f('0x43')](handleError(_0x5b283f,null));};exports[_0x7f2f('0x44')]=function(_0x2cbf8c,_0x58f00e){var _0x45e88f={'raw':!![],'where':{'id':_0x2cbf8c['params']['id']}},_0x15256a={};_0x15256a[_0x7f2f('0x2e')]=_['keys'](db[_0x7f2f('0x2a')][_0x7f2f('0x2b')]);_0x15256a[_0x7f2f('0x31')]=_['keys'](_0x2cbf8c['query']);_0x15256a[_0x7f2f('0x32')]=_['intersection'](_0x15256a[_0x7f2f('0x2e')],_0x15256a[_0x7f2f('0x31')]);_0x45e88f['attributes']=_[_0x7f2f('0x34')](_0x15256a['model'],qs[_0x7f2f('0x35')](_0x2cbf8c[_0x7f2f('0x31')][_0x7f2f('0x35')]));_0x45e88f['attributes']=_0x45e88f[_0x7f2f('0x33')][_0x7f2f('0x45')]?_0x45e88f[_0x7f2f('0x33')]:_0x15256a[_0x7f2f('0x2e')];if(_0x2cbf8c[_0x7f2f('0x31')]['includeAll']){_0x45e88f[_0x7f2f('0x46')]=[{'all':!![]}];}_0x45e88f=_['merge']({},_0x45e88f,_0x2cbf8c[_0x7f2f('0x3e')]);return db['Cdr'][_0x7f2f('0x47')](_0x45e88f)[_0x7f2f('0x41')](handleEntityNotFound(_0x58f00e,null))['then'](respondWithResult(_0x58f00e,null))['catch'](handleError(_0x58f00e,null));};exports[_0x7f2f('0x48')]=function(_0x31e59e,_0x4e6927){return db[_0x7f2f('0x2a')]['create'](_0x31e59e[_0x7f2f('0x49')],{})[_0x7f2f('0x41')](respondWithResult(_0x4e6927,0xc9))[_0x7f2f('0x43')](handleError(_0x4e6927,null));};exports['update']=function(_0xdbb50d,_0x34bf33){if(_0xdbb50d[_0x7f2f('0x49')]['id']){delete _0xdbb50d[_0x7f2f('0x49')]['id'];}return db[_0x7f2f('0x2a')][_0x7f2f('0x47')]({'where':{'id':_0xdbb50d['params']['id']}})[_0x7f2f('0x41')](handleEntityNotFound(_0x34bf33,null))[_0x7f2f('0x41')](saveUpdates(_0xdbb50d[_0x7f2f('0x49')],null))[_0x7f2f('0x41')](respondWithResult(_0x34bf33,null))[_0x7f2f('0x43')](handleError(_0x34bf33,null));};exports['destroy']=function(_0x46ac43,_0x59aa06){return db[_0x7f2f('0x2a')]['find']({'where':{'id':_0x46ac43[_0x7f2f('0x4a')]['id']}})[_0x7f2f('0x41')](handleEntityNotFound(_0x59aa06,null))[_0x7f2f('0x41')](removeEntity(_0x59aa06,null))[_0x7f2f('0x43')](handleError(_0x59aa06,null));};exports['describe']=function(_0xe1e86c,_0x44b7b1){return db[_0x7f2f('0x2a')][_0x7f2f('0x4b')]()[_0x7f2f('0x41')](respondWithResult(_0x44b7b1,null))['catch'](handleError(_0x44b7b1,null));}; \ No newline at end of file +var _0x76a4=['ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','sendStatus','status','end','offset','set','Content-Range','apply','save','update','then','destroy','error','stack','name','index','Cdr','rawAttributes','model','map','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','limit','order','sort','where','filter','type','VIRTUAL','merge','options','count','includeAll','rows','catch','keys','length','include','find','create','body','params','describe','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','ejs','crypto','jsforce','desk.js','to-csv','querystring'];(function(_0x554b96,_0xa7f28){var _0xe445a8=function(_0x1c2dfb){while(--_0x1c2dfb){_0x554b96['push'](_0x554b96['shift']());}};_0xe445a8(++_0xa7f28);}(_0x76a4,0x7d));var _0x476a=function(_0x59973d,_0x363064){_0x59973d=_0x59973d-0x0;var _0x465f06=_0x76a4[_0x59973d];return _0x465f06;};'use strict';var pdf=require(_0x476a('0x0'));var emlformat=require(_0x476a('0x1'));var rimraf=require(_0x476a('0x2'));var zipdir=require(_0x476a('0x3'));var jsonpatch=require(_0x476a('0x4'));var rp=require(_0x476a('0x5'));var moment=require('moment');var BPromise=require(_0x476a('0x6'));var Mustache=require(_0x476a('0x7'));var util=require(_0x476a('0x8'));var path=require(_0x476a('0x9'));var sox=require(_0x476a('0xa'));var csv=require('to-csv');var ejs=require(_0x476a('0xb'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0x476a('0xc'));var jsforce=require(_0x476a('0xd'));var deskjs=require(_0x476a('0xe'));var toCsv=require(_0x476a('0xf'));var querystring=require(_0x476a('0x10'));var Papa=require('papaparse');var Redis=require(_0x476a('0x11'));var authService=require(_0x476a('0x12'));var qs=require(_0x476a('0x13'));var as=require(_0x476a('0x14'));var hardwareService=require(_0x476a('0x15'));var logger=require(_0x476a('0x16'))('api');var utils=require('../../config/utils');var config=require(_0x476a('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xdd8d52,_0x4e34a4){_0x4e34a4=_0x4e34a4||0xcc;return function(_0x35d6ed){if(_0x35d6ed){return _0xdd8d52[_0x476a('0x18')](_0x4e34a4);}return _0xdd8d52[_0x476a('0x19')](_0x4e34a4)[_0x476a('0x1a')]();};}function respondWithResult(_0x38c8ea,_0x22e390){_0x22e390=_0x22e390||0xc8;return function(_0x5711f4){if(_0x5711f4){return _0x38c8ea[_0x476a('0x19')](_0x22e390)['json'](_0x5711f4);}};}function respondWithFilteredResult(_0x2db574,_0x4c81b5){return function(_0x11f024){if(_0x11f024){var _0xb039af=_0x11f024['count'],_0x13b93b=_0x4c81b5[_0x476a('0x1b')],_0xafd9d0=_0x4c81b5[_0x476a('0x1b')]+_0x4c81b5['limit'],_0x5204af;if(_0xafd9d0>=_0xb039af){_0xafd9d0=_0xb039af;_0x5204af=0xc8;}else{_0x5204af=0xce;}_0x2db574['status'](_0x5204af);return _0x2db574[_0x476a('0x1c')](_0x476a('0x1d'),_0x13b93b+'-'+_0xafd9d0+'/'+_0xb039af)['json'](_0x11f024);}return null;};}function patchUpdates(_0xe3a5cb){return function(_0x357c00){try{jsonpatch[_0x476a('0x1e')](_0x357c00,_0xe3a5cb,!![]);}catch(_0x377591){return BPromise['reject'](_0x377591);}return _0x357c00[_0x476a('0x1f')]();};}function saveUpdates(_0x2f06e9,_0x5102ea){return function(_0x7d8069){if(_0x7d8069){return _0x7d8069[_0x476a('0x20')](_0x2f06e9)[_0x476a('0x21')](function(_0x4a6b8e){return _0x4a6b8e;});}return null;};}function removeEntity(_0x2c7243,_0x3cca08){return function(_0xde94e7){if(_0xde94e7){return _0xde94e7[_0x476a('0x22')]()[_0x476a('0x21')](function(){_0x2c7243[_0x476a('0x19')](0xcc)[_0x476a('0x1a')]();});}};}function handleEntityNotFound(_0x3baa0f,_0x291840){return function(_0x3bd013){if(!_0x3bd013){_0x3baa0f['sendStatus'](0x194);}return _0x3bd013;};}function handleError(_0x26af7c,_0x3df861){_0x3df861=_0x3df861||0x1f4;return function(_0x3cd89f){logger[_0x476a('0x23')](_0x3cd89f[_0x476a('0x24')]);if(_0x3cd89f[_0x476a('0x25')]){delete _0x3cd89f['name'];}_0x26af7c[_0x476a('0x19')](_0x3df861)['send'](_0x3cd89f);};}exports[_0x476a('0x26')]=function(_0x173fea,_0x316dc9){var _0x3d1de4={},_0x12e570={},_0x8d563e={'count':0x0,'rows':[]};var _0x3e648b=_['map'](db[_0x476a('0x27')][_0x476a('0x28')],function(_0x9420af){return{'name':_0x9420af['fieldName'],'type':_0x9420af['type']['key']};});_0x12e570[_0x476a('0x29')]=_[_0x476a('0x2a')](_0x3e648b,_0x476a('0x25'));_0x12e570[_0x476a('0x2b')]=_['keys'](_0x173fea['query']);_0x12e570[_0x476a('0x2c')]=_[_0x476a('0x2d')](_0x12e570[_0x476a('0x29')],_0x12e570[_0x476a('0x2b')]);_0x3d1de4[_0x476a('0x2e')]=_[_0x476a('0x2d')](_0x12e570[_0x476a('0x29')],qs[_0x476a('0x2f')](_0x173fea[_0x476a('0x2b')][_0x476a('0x2f')]));_0x3d1de4[_0x476a('0x2e')]=_0x3d1de4[_0x476a('0x2e')]['length']?_0x3d1de4['attributes']:_0x12e570[_0x476a('0x29')];if(!_0x173fea[_0x476a('0x2b')][_0x476a('0x30')](_0x476a('0x31'))){_0x3d1de4[_0x476a('0x32')]=qs[_0x476a('0x32')](_0x173fea['query'][_0x476a('0x32')]);_0x3d1de4['offset']=qs[_0x476a('0x1b')](_0x173fea[_0x476a('0x2b')][_0x476a('0x1b')]);}_0x3d1de4[_0x476a('0x33')]=qs[_0x476a('0x34')](_0x173fea[_0x476a('0x2b')][_0x476a('0x34')]);_0x3d1de4[_0x476a('0x35')]=qs[_0x476a('0x2c')](_['pick'](_0x173fea[_0x476a('0x2b')],_0x12e570[_0x476a('0x2c')]),_0x3e648b);if(_0x173fea[_0x476a('0x2b')][_0x476a('0x36')]){_0x3d1de4['where']=_['merge'](_0x3d1de4[_0x476a('0x35')],{'$or':_[_0x476a('0x2a')](_0x3e648b,function(_0x63c7a5){if(_0x63c7a5[_0x476a('0x37')]!==_0x476a('0x38')){var _0x272488={};_0x272488[_0x63c7a5['name']]={'$like':'%'+_0x173fea[_0x476a('0x2b')][_0x476a('0x36')]+'%'};return _0x272488;}})});}_0x3d1de4=_[_0x476a('0x39')]({},_0x3d1de4,_0x173fea[_0x476a('0x3a')]);var _0x23b2e2={'where':_0x3d1de4[_0x476a('0x35')]};return db['Cdr'][_0x476a('0x3b')](_0x23b2e2)['then'](function(_0x2cf4fb){_0x8d563e[_0x476a('0x3b')]=_0x2cf4fb;if(_0x173fea[_0x476a('0x2b')][_0x476a('0x3c')]){_0x3d1de4['include']=[{'all':!![]}];}return db[_0x476a('0x27')]['findAll'](_0x3d1de4);})[_0x476a('0x21')](function(_0x6c6483){_0x8d563e[_0x476a('0x3d')]=_0x6c6483;return _0x8d563e;})[_0x476a('0x21')](respondWithFilteredResult(_0x316dc9,_0x3d1de4))[_0x476a('0x3e')](handleError(_0x316dc9,null));};exports['show']=function(_0x4bdd01,_0x1798a8){var _0x555c74={'raw':!![],'where':{'id':_0x4bdd01['params']['id']}},_0x4846d3={};_0x4846d3[_0x476a('0x29')]=_[_0x476a('0x3f')](db['Cdr']['rawAttributes']);_0x4846d3[_0x476a('0x2b')]=_[_0x476a('0x3f')](_0x4bdd01[_0x476a('0x2b')]);_0x4846d3[_0x476a('0x2c')]=_['intersection'](_0x4846d3[_0x476a('0x29')],_0x4846d3[_0x476a('0x2b')]);_0x555c74[_0x476a('0x2e')]=_[_0x476a('0x2d')](_0x4846d3[_0x476a('0x29')],qs[_0x476a('0x2f')](_0x4bdd01[_0x476a('0x2b')][_0x476a('0x2f')]));_0x555c74[_0x476a('0x2e')]=_0x555c74[_0x476a('0x2e')][_0x476a('0x40')]?_0x555c74[_0x476a('0x2e')]:_0x4846d3['model'];if(_0x4bdd01['query'][_0x476a('0x3c')]){_0x555c74[_0x476a('0x41')]=[{'all':!![]}];}_0x555c74=_[_0x476a('0x39')]({},_0x555c74,_0x4bdd01['options']);return db['Cdr'][_0x476a('0x42')](_0x555c74)[_0x476a('0x21')](handleEntityNotFound(_0x1798a8,null))['then'](respondWithResult(_0x1798a8,null))[_0x476a('0x3e')](handleError(_0x1798a8,null));};exports[_0x476a('0x43')]=function(_0x2db62f,_0x159f48){return db[_0x476a('0x27')][_0x476a('0x43')](_0x2db62f[_0x476a('0x44')],{})[_0x476a('0x21')](respondWithResult(_0x159f48,0xc9))[_0x476a('0x3e')](handleError(_0x159f48,null));};exports['update']=function(_0x168116,_0x45d124){if(_0x168116[_0x476a('0x44')]['id']){delete _0x168116[_0x476a('0x44')]['id'];}return db['Cdr']['find']({'where':{'id':_0x168116[_0x476a('0x45')]['id']}})[_0x476a('0x21')](handleEntityNotFound(_0x45d124,null))[_0x476a('0x21')](saveUpdates(_0x168116[_0x476a('0x44')],null))[_0x476a('0x21')](respondWithResult(_0x45d124,null))[_0x476a('0x3e')](handleError(_0x45d124,null));};exports[_0x476a('0x22')]=function(_0x4b6f14,_0x3b49ce){return db['Cdr'][_0x476a('0x42')]({'where':{'id':_0x4b6f14[_0x476a('0x45')]['id']}})[_0x476a('0x21')](handleEntityNotFound(_0x3b49ce,null))[_0x476a('0x21')](removeEntity(_0x3b49ce,null))[_0x476a('0x3e')](handleError(_0x3b49ce,null));};exports[_0x476a('0x46')]=function(_0x48ef8c,_0x1bd3d6){return db[_0x476a('0x27')][_0x476a('0x46')]()[_0x476a('0x21')](respondWithResult(_0x1bd3d6,null))[_0x476a('0x3e')](handleError(_0x1bd3d6,null));}; \ No newline at end of file diff --git a/server/api/cdr/cdr.model.js b/server/api/cdr/cdr.model.js index 44599d5..9a32d6c 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 _0x2e44=['calldate','disposition','dst','src','uniqueid','lodash','util','api','moment','request-promise','path','../../config/environment','./cdr.attributes','exports','Cdr','cdr','accountcode'];(function(_0x4d582d,_0x43a1e9){var _0x36b316=function(_0x2d74e1){while(--_0x2d74e1){_0x4d582d['push'](_0x4d582d['shift']());}};_0x36b316(++_0x43a1e9);}(_0x2e44,0xf3));var _0x42e4=function(_0x27685e,_0x845417){_0x27685e=_0x27685e-0x0;var _0x224a6f=_0x2e44[_0x27685e];return _0x224a6f;};'use strict';var _=require(_0x42e4('0x0'));var util=require(_0x42e4('0x1'));var logger=require('../../config/logger')(_0x42e4('0x2'));var moment=require(_0x42e4('0x3'));var BPromise=require('bluebird');var rp=require(_0x42e4('0x4'));var fs=require('fs');var path=require(_0x42e4('0x5'));var rimraf=require('rimraf');var config=require(_0x42e4('0x6'));var attributes=require(_0x42e4('0x7'));module[_0x42e4('0x8')]=function(_0x307604,_0x18ee8a){return _0x307604['define'](_0x42e4('0x9'),attributes,{'tableName':_0x42e4('0xa'),'paranoid':![],'indexes':[{'name':_0x42e4('0xb'),'fields':['accountcode']},{'name':_0x42e4('0xc'),'fields':[_0x42e4('0xc')]},{'name':'disposition','fields':[_0x42e4('0xd')]},{'name':_0x42e4('0xe'),'fields':[_0x42e4('0xe')]},{'name':_0x42e4('0xf'),'fields':[_0x42e4('0xf')]},{'name':_0x42e4('0x10'),'fields':[_0x42e4('0x10')]}],'timestamps':![]});}; \ No newline at end of file +var _0x2a1c=['dst','uniqueid','../../config/logger','api','moment','rimraf','./cdr.attributes','exports','define','Cdr','cdr','accountcode','calldate','disposition'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x2a1c,0x9c));var _0xc2a1=function(_0x5c9307,_0x5b97e4){_0x5c9307=_0x5c9307-0x0;var _0x373e29=_0x2a1c[_0x5c9307];return _0x373e29;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xc2a1('0x0'))(_0xc2a1('0x1'));var moment=require(_0xc2a1('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xc2a1('0x3'));var config=require('../../config/environment');var attributes=require(_0xc2a1('0x4'));module[_0xc2a1('0x5')]=function(_0x983014,_0x53203c){return _0x983014[_0xc2a1('0x6')](_0xc2a1('0x7'),attributes,{'tableName':_0xc2a1('0x8'),'paranoid':![],'indexes':[{'name':'accountcode','fields':[_0xc2a1('0x9')]},{'name':'calldate','fields':[_0xc2a1('0xa')]},{'name':_0xc2a1('0xb'),'fields':[_0xc2a1('0xb')]},{'name':_0xc2a1('0xc'),'fields':[_0xc2a1('0xc')]},{'name':'src','fields':['src']},{'name':_0xc2a1('0xd'),'fields':[_0xc2a1('0xd')]}],'timestamps':![]});}; \ No newline at end of file diff --git a/server/api/cdr/cdr.rpc.js b/server/api/cdr/cdr.rpc.js index 7e3e1a1..d9e3083 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 _0xcdd6=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http','request','then','Cdr,\x20%s,\x20%s','request\x20sent','Cdr,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','lodash','util'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0xcdd6,0xbe));var _0x6cdd=function(_0x2ab118,_0xbd2407){_0x2ab118=_0x2ab118-0x0;var _0x52e887=_0xcdd6[_0x2ab118];return _0x52e887;};'use strict';var _=require(_0x6cdd('0x0'));var util=require(_0x6cdd('0x1'));var moment=require(_0x6cdd('0x2'));var BPromise=require(_0x6cdd('0x3'));var rs=require(_0x6cdd('0x4'));var fs=require('fs');var Redis=require(_0x6cdd('0x5'));var db=require(_0x6cdd('0x6'))['db'];var utils=require(_0x6cdd('0x7'));var logger=require('../../config/logger')(_0x6cdd('0x8'));var config=require(_0x6cdd('0x9'));var jayson=require(_0x6cdd('0xa'));var client=jayson['client'][_0x6cdd('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x37ae65,_0x5b18d3,_0x6a3402){return new BPromise(function(_0x2de608,_0x4af298){return client[_0x6cdd('0xc')](_0x37ae65,_0x6a3402)[_0x6cdd('0xd')](function(_0x26e01d){logger['info'](_0x6cdd('0xe'),_0x5b18d3,_0x6cdd('0xf'));logger['debug'](_0x6cdd('0x10'),_0x5b18d3,'request\x20sent',JSON[_0x6cdd('0x11')](_0x26e01d));if(_0x26e01d[_0x6cdd('0x12')]){if(_0x26e01d[_0x6cdd('0x12')][_0x6cdd('0x13')]===0x1f4){logger[_0x6cdd('0x12')](_0x6cdd('0xe'),_0x5b18d3,_0x26e01d[_0x6cdd('0x12')][_0x6cdd('0x14')]);return _0x4af298(_0x26e01d[_0x6cdd('0x12')][_0x6cdd('0x14')]);}logger[_0x6cdd('0x12')](_0x6cdd('0xe'),_0x5b18d3,_0x26e01d['error'][_0x6cdd('0x14')]);return _0x2de608(_0x26e01d[_0x6cdd('0x12')]['message']);}else{logger[_0x6cdd('0x15')](_0x6cdd('0xe'),_0x5b18d3,_0x6cdd('0xf'));_0x2de608(_0x26e01d[_0x6cdd('0x16')][_0x6cdd('0x14')]);}})[_0x6cdd('0x17')](function(_0x50be34){logger[_0x6cdd('0x12')](_0x6cdd('0xe'),_0x5b18d3,_0x50be34);_0x4af298(_0x50be34);});});} \ No newline at end of file +var _0x0612=['jayson/promise','client','http','request','then','info','Cdr,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0x0612,0x1b7));var _0x2061=function(_0x25c654,_0x292a51){_0x25c654=_0x25c654-0x0;var _0xaeb2be=_0x0612[_0x25c654];return _0xaeb2be;};'use strict';var _=require(_0x2061('0x0'));var util=require(_0x2061('0x1'));var moment=require(_0x2061('0x2'));var BPromise=require(_0x2061('0x3'));var rs=require(_0x2061('0x4'));var fs=require('fs');var Redis=require(_0x2061('0x5'));var db=require(_0x2061('0x6'))['db'];var utils=require(_0x2061('0x7'));var logger=require(_0x2061('0x8'))(_0x2061('0x9'));var config=require(_0x2061('0xa'));var jayson=require(_0x2061('0xb'));var client=jayson[_0x2061('0xc')][_0x2061('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x12ba23,_0x27ea35,_0x52d661){return new BPromise(function(_0x3333db,_0x5e7982){return client[_0x2061('0xe')](_0x12ba23,_0x52d661)[_0x2061('0xf')](function(_0x48145b){logger[_0x2061('0x10')](_0x2061('0x11'),_0x27ea35,_0x2061('0x12'));logger[_0x2061('0x13')]('Cdr,\x20%s,\x20%s,\x20%s',_0x27ea35,_0x2061('0x12'),JSON['stringify'](_0x48145b));if(_0x48145b[_0x2061('0x14')]){if(_0x48145b['error'][_0x2061('0x15')]===0x1f4){logger[_0x2061('0x14')](_0x2061('0x11'),_0x27ea35,_0x48145b[_0x2061('0x14')][_0x2061('0x16')]);return _0x5e7982(_0x48145b[_0x2061('0x14')][_0x2061('0x16')]);}logger[_0x2061('0x14')](_0x2061('0x11'),_0x27ea35,_0x48145b['error'][_0x2061('0x16')]);return _0x3333db(_0x48145b[_0x2061('0x14')][_0x2061('0x16')]);}else{logger[_0x2061('0x10')](_0x2061('0x11'),_0x27ea35,_0x2061('0x12'));_0x3333db(_0x48145b[_0x2061('0x17')][_0x2061('0x16')]);}})[_0x2061('0x18')](function(_0x20b404){logger[_0x2061('0x14')]('Cdr,\x20%s,\x20%s',_0x27ea35,_0x20b404);_0x5e7982(_0x20b404);});});} \ No newline at end of file diff --git a/server/api/cdr/index.js b/server/api/cdr/index.js index b00ea03..9aff253 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 _0xda39=['get','isAuthenticated','/:id','show','post','put','delete','destroy','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x59aadc,_0x1584f3){var _0x4b5a98=function(_0x282abb){while(--_0x282abb){_0x59aadc['push'](_0x59aadc['shift']());}};_0x4b5a98(++_0x1584f3);}(_0xda39,0x15d));var _0x9da3=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0xda39[_0x3ab51d];return _0x29a04e;};'use strict';var multer=require(_0x9da3('0x0'));var util=require(_0x9da3('0x1'));var path=require(_0x9da3('0x2'));var timeout=require('connect-timeout');var express=require(_0x9da3('0x3'));var router=express[_0x9da3('0x4')]();var auth=require(_0x9da3('0x5'));var interaction=require(_0x9da3('0x6'));var config=require(_0x9da3('0x7'));var controller=require('./cdr.controller');router[_0x9da3('0x8')]('/',auth[_0x9da3('0x9')](),controller['index']);router[_0x9da3('0x8')]('/describe',auth['isAuthenticated'](),controller['describe']);router[_0x9da3('0x8')](_0x9da3('0xa'),auth['isAuthenticated'](),controller[_0x9da3('0xb')]);router[_0x9da3('0xc')]('/',auth[_0x9da3('0x9')](),controller['create']);router[_0x9da3('0xd')](_0x9da3('0xa'),auth[_0x9da3('0x9')](),controller['update']);router[_0x9da3('0xe')](_0x9da3('0xa'),auth['isAuthenticated'](),controller[_0x9da3('0xf')]);module[_0x9da3('0x10')]=router; \ No newline at end of file +var _0x95dc=['describe','/:id','show','post','create','put','update','delete','exports','multer','util','path','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./cdr.controller','get','isAuthenticated','/describe'];(function(_0x3865b3,_0x456fee){var _0x300357=function(_0x14594f){while(--_0x14594f){_0x3865b3['push'](_0x3865b3['shift']());}};_0x300357(++_0x456fee);}(_0x95dc,0x1e9));var _0xc95d=function(_0xf83315,_0x2ec986){_0xf83315=_0xf83315-0x0;var _0x1ca896=_0x95dc[_0xf83315];return _0x1ca896;};'use strict';var multer=require(_0xc95d('0x0'));var util=require(_0xc95d('0x1'));var path=require(_0xc95d('0x2'));var timeout=require('connect-timeout');var express=require(_0xc95d('0x3'));var router=express['Router']();var auth=require(_0xc95d('0x4'));var interaction=require(_0xc95d('0x5'));var config=require(_0xc95d('0x6'));var controller=require(_0xc95d('0x7'));router[_0xc95d('0x8')]('/',auth[_0xc95d('0x9')](),controller['index']);router[_0xc95d('0x8')](_0xc95d('0xa'),auth['isAuthenticated'](),controller[_0xc95d('0xb')]);router[_0xc95d('0x8')](_0xc95d('0xc'),auth[_0xc95d('0x9')](),controller[_0xc95d('0xd')]);router[_0xc95d('0xe')]('/',auth[_0xc95d('0x9')](),controller[_0xc95d('0xf')]);router[_0xc95d('0x10')]('/:id',auth[_0xc95d('0x9')](),controller[_0xc95d('0x11')]);router[_0xc95d('0x12')](_0xc95d('0xc'),auth[_0xc95d('0x9')](),controller['destroy']);module[_0xc95d('0x13')]=router; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.attributes.js b/server/api/chatApplication/chatApplication.attributes.js index 3e092cd..008b702 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 _0x0f4b=['exports','INTEGER','noop','TEXT','STRING','*,*,*,*','sequelize'];(function(_0x7c97ba,_0x33c896){var _0xe57057=function(_0x31d16f){while(--_0x31d16f){_0x7c97ba['push'](_0x7c97ba['shift']());}};_0xe57057(++_0x33c896);}(_0x0f4b,0x179));var _0xb0f4=function(_0x3d6198,_0x5b65cd){_0x3d6198=_0x3d6198-0x0;var _0x186e9b=_0x0f4b[_0x3d6198];return _0x186e9b;};'use strict';var Sequelize=require(_0xb0f4('0x0'));module[_0xb0f4('0x1')]={'priority':{'type':Sequelize[_0xb0f4('0x2')],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xb0f4('0x3')},'appdata':{'type':Sequelize[_0xb0f4('0x4')]()},'description':{'type':Sequelize[_0xb0f4('0x5')]},'interval':{'type':Sequelize[_0xb0f4('0x5')],'defaultValue':_0xb0f4('0x6')}}; \ No newline at end of file +var _0xca39=['STRING','*,*,*,*','sequelize','exports','INTEGER','noop','TEXT'];(function(_0x6131cd,_0x4c26a1){var _0x47e916=function(_0x1f2bce){while(--_0x1f2bce){_0x6131cd['push'](_0x6131cd['shift']());}};_0x47e916(++_0x4c26a1);}(_0xca39,0xf0));var _0x9ca3=function(_0x2d7f0e,_0x3e6fbd){_0x2d7f0e=_0x2d7f0e-0x0;var _0x110b07=_0xca39[_0x2d7f0e];return _0x110b07;};'use strict';var Sequelize=require(_0x9ca3('0x0'));module[_0x9ca3('0x1')]={'priority':{'type':Sequelize[_0x9ca3('0x2')],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x9ca3('0x3')},'appdata':{'type':Sequelize[_0x9ca3('0x4')]()},'description':{'type':Sequelize[_0x9ca3('0x5')]},'interval':{'type':Sequelize[_0x9ca3('0x5')],'defaultValue':_0x9ca3('0x6')}}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.controller.js b/server/api/chatApplication/chatApplication.controller.js index add3008..a6e4e64 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 _0x2aa6=['mustache','path','to-csv','lodash','squel','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','count','offset','limit','set','Content-Range','json','apply','reject','save','update','then','destroy','error','stack','name','send','show','params','model','keys','ChatApplication','rawAttributes','query','filters','intersection','attributes','fields','include','merge','options','catch','body','find','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird'];(function(_0x26d7c1,_0x51912f){var _0x423d10=function(_0x4cf15a){while(--_0x4cf15a){_0x26d7c1['push'](_0x26d7c1['shift']());}};_0x423d10(++_0x51912f);}(_0x2aa6,0x11c));var _0x62aa=function(_0x4a7631,_0x2c85b9){_0x4a7631=_0x4a7631-0x0;var _0x1a5a6f=_0x2aa6[_0x4a7631];return _0x1a5a6f;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x62aa('0x0'));var rimraf=require(_0x62aa('0x1'));var zipdir=require(_0x62aa('0x2'));var jsonpatch=require(_0x62aa('0x3'));var rp=require('request-promise');var moment=require(_0x62aa('0x4'));var BPromise=require(_0x62aa('0x5'));var Mustache=require(_0x62aa('0x6'));var util=require('util');var path=require(_0x62aa('0x7'));var sox=require('sox');var csv=require(_0x62aa('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x62aa('0x9'));var squel=require(_0x62aa('0xa'));var crypto=require('crypto');var jsforce=require(_0x62aa('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x62aa('0x8'));var querystring=require(_0x62aa('0xc'));var Papa=require(_0x62aa('0xd'));var Redis=require(_0x62aa('0xe'));var authService=require(_0x62aa('0xf'));var qs=require(_0x62aa('0x10'));var as=require(_0x62aa('0x11'));var hardwareService=require(_0x62aa('0x12'));var logger=require(_0x62aa('0x13'))(_0x62aa('0x14'));var utils=require('../../config/utils');var config=require(_0x62aa('0x15'));var db=require(_0x62aa('0x16'))['db'];function respondWithStatusCode(_0x5bdf2a,_0x3deb98){_0x3deb98=_0x3deb98||0xcc;return function(_0x33e62c){if(_0x33e62c){return _0x5bdf2a[_0x62aa('0x17')](_0x3deb98);}return _0x5bdf2a['status'](_0x3deb98)['end']();};}function respondWithResult(_0x1ce90f,_0x3c8b63){_0x3c8b63=_0x3c8b63||0xc8;return function(_0x3bcf81){if(_0x3bcf81){return _0x1ce90f[_0x62aa('0x18')](_0x3c8b63)['json'](_0x3bcf81);}};}function respondWithFilteredResult(_0x53b683,_0x384587){return function(_0x135ff2){if(_0x135ff2){var _0x4929a0=_0x135ff2[_0x62aa('0x19')],_0x2c94b6=_0x384587[_0x62aa('0x1a')],_0x4ac9d7=_0x384587[_0x62aa('0x1a')]+_0x384587[_0x62aa('0x1b')],_0x4b655c;if(_0x4ac9d7>=_0x4929a0){_0x4ac9d7=_0x4929a0;_0x4b655c=0xc8;}else{_0x4b655c=0xce;}_0x53b683[_0x62aa('0x18')](_0x4b655c);return _0x53b683[_0x62aa('0x1c')](_0x62aa('0x1d'),_0x2c94b6+'-'+_0x4ac9d7+'/'+_0x4929a0)[_0x62aa('0x1e')](_0x135ff2);}return null;};}function patchUpdates(_0x42b010){return function(_0x5eb3fe){try{jsonpatch[_0x62aa('0x1f')](_0x5eb3fe,_0x42b010,!![]);}catch(_0x2b0ac3){return BPromise[_0x62aa('0x20')](_0x2b0ac3);}return _0x5eb3fe[_0x62aa('0x21')]();};}function saveUpdates(_0x519a92,_0x52714e){return function(_0x1c56c5){if(_0x1c56c5){return _0x1c56c5[_0x62aa('0x22')](_0x519a92)[_0x62aa('0x23')](function(_0xab8c0){return _0xab8c0;});}return null;};}function removeEntity(_0x122172,_0x2846c2){return function(_0x1b4516){if(_0x1b4516){return _0x1b4516[_0x62aa('0x24')]()['then'](function(){_0x122172[_0x62aa('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5c64e3,_0x3d0e5c){return function(_0x34b555){if(!_0x34b555){_0x5c64e3[_0x62aa('0x17')](0x194);}return _0x34b555;};}function handleError(_0x1b9b74,_0x2ed569){_0x2ed569=_0x2ed569||0x1f4;return function(_0x288dcb){logger[_0x62aa('0x25')](_0x288dcb[_0x62aa('0x26')]);if(_0x288dcb[_0x62aa('0x27')]){delete _0x288dcb[_0x62aa('0x27')];}_0x1b9b74[_0x62aa('0x18')](_0x2ed569)[_0x62aa('0x28')](_0x288dcb);};}exports[_0x62aa('0x29')]=function(_0xd51b31,_0xe8109e){var _0x307504={'raw':!![],'where':{'id':_0xd51b31[_0x62aa('0x2a')]['id']}},_0x4edf2f={};_0x4edf2f[_0x62aa('0x2b')]=_[_0x62aa('0x2c')](db[_0x62aa('0x2d')][_0x62aa('0x2e')]);_0x4edf2f[_0x62aa('0x2f')]=_[_0x62aa('0x2c')](_0xd51b31[_0x62aa('0x2f')]);_0x4edf2f[_0x62aa('0x30')]=_[_0x62aa('0x31')](_0x4edf2f[_0x62aa('0x2b')],_0x4edf2f['query']);_0x307504[_0x62aa('0x32')]=_[_0x62aa('0x31')](_0x4edf2f[_0x62aa('0x2b')],qs[_0x62aa('0x33')](_0xd51b31[_0x62aa('0x2f')][_0x62aa('0x33')]));_0x307504[_0x62aa('0x32')]=_0x307504[_0x62aa('0x32')]['length']?_0x307504[_0x62aa('0x32')]:_0x4edf2f[_0x62aa('0x2b')];if(_0xd51b31[_0x62aa('0x2f')]['includeAll']){_0x307504[_0x62aa('0x34')]=[{'all':!![]}];}_0x307504=_[_0x62aa('0x35')]({},_0x307504,_0xd51b31[_0x62aa('0x36')]);return db[_0x62aa('0x2d')]['find'](_0x307504)[_0x62aa('0x23')](handleEntityNotFound(_0xe8109e,null))[_0x62aa('0x23')](respondWithResult(_0xe8109e,null))[_0x62aa('0x37')](handleError(_0xe8109e,null));};exports[_0x62aa('0x22')]=function(_0x2f2a17,_0x3e9d16){if(_0x2f2a17[_0x62aa('0x38')]['id']){delete _0x2f2a17['body']['id'];}return db[_0x62aa('0x2d')][_0x62aa('0x39')]({'where':{'id':_0x2f2a17[_0x62aa('0x2a')]['id']}})[_0x62aa('0x23')](handleEntityNotFound(_0x3e9d16,null))[_0x62aa('0x23')](saveUpdates(_0x2f2a17[_0x62aa('0x38')],null))[_0x62aa('0x23')](respondWithResult(_0x3e9d16,null))['catch'](handleError(_0x3e9d16,null));};exports[_0x62aa('0x24')]=function(_0x37984f,_0x29c990){return db[_0x62aa('0x2d')][_0x62aa('0x39')]({'where':{'id':_0x37984f[_0x62aa('0x2a')]['id']}})[_0x62aa('0x23')](handleEntityNotFound(_0x29c990,null))[_0x62aa('0x23')](removeEntity(_0x29c990,null))[_0x62aa('0x37')](handleError(_0x29c990,null));}; \ No newline at end of file +var _0xf912=['fields','length','includeAll','include','merge','options','find','catch','update','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','lodash','crypto','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','sendStatus','status','end','json','offset','limit','Content-Range','apply','save','then','destroy','name','send','show','params','ChatApplication','rawAttributes','query','keys','filters','intersection','attributes','model'];(function(_0x11ad47,_0xe38604){var _0x3f95dc=function(_0x567dd1){while(--_0x567dd1){_0x11ad47['push'](_0x11ad47['shift']());}};_0x3f95dc(++_0xe38604);}(_0xf912,0x1b2));var _0x2f91=function(_0x50d2ae,_0x4c533c){_0x50d2ae=_0x50d2ae-0x0;var _0x3e3cdb=_0xf912[_0x50d2ae];return _0x3e3cdb;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x2f91('0x0'));var rimraf=require(_0x2f91('0x1'));var zipdir=require(_0x2f91('0x2'));var jsonpatch=require(_0x2f91('0x3'));var rp=require(_0x2f91('0x4'));var moment=require(_0x2f91('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x2f91('0x6'));var util=require(_0x2f91('0x7'));var path=require('path');var sox=require(_0x2f91('0x8'));var csv=require(_0x2f91('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x2f91('0xa'));var squel=require('squel');var crypto=require(_0x2f91('0xb'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x2f91('0xc'));var Papa=require(_0x2f91('0xd'));var Redis=require('ioredis');var authService=require(_0x2f91('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0x2f91('0xf'));var hardwareService=require(_0x2f91('0x10'));var logger=require('../../config/logger')(_0x2f91('0x11'));var utils=require(_0x2f91('0x12'));var config=require(_0x2f91('0x13'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2d02e8,_0x4417ce){_0x4417ce=_0x4417ce||0xcc;return function(_0xec6b4a){if(_0xec6b4a){return _0x2d02e8[_0x2f91('0x14')](_0x4417ce);}return _0x2d02e8[_0x2f91('0x15')](_0x4417ce)[_0x2f91('0x16')]();};}function respondWithResult(_0x43309d,_0x40c1ed){_0x40c1ed=_0x40c1ed||0xc8;return function(_0x2d7a0c){if(_0x2d7a0c){return _0x43309d['status'](_0x40c1ed)[_0x2f91('0x17')](_0x2d7a0c);}};}function respondWithFilteredResult(_0x51114a,_0x394b2d){return function(_0x6112a5){if(_0x6112a5){var _0x2950d6=_0x6112a5['count'],_0x24fb05=_0x394b2d['offset'],_0x7cf467=_0x394b2d[_0x2f91('0x18')]+_0x394b2d[_0x2f91('0x19')],_0x45c58f;if(_0x7cf467>=_0x2950d6){_0x7cf467=_0x2950d6;_0x45c58f=0xc8;}else{_0x45c58f=0xce;}_0x51114a[_0x2f91('0x15')](_0x45c58f);return _0x51114a['set'](_0x2f91('0x1a'),_0x24fb05+'-'+_0x7cf467+'/'+_0x2950d6)['json'](_0x6112a5);}return null;};}function patchUpdates(_0x3d67ff){return function(_0x836c36){try{jsonpatch[_0x2f91('0x1b')](_0x836c36,_0x3d67ff,!![]);}catch(_0x23ff06){return BPromise['reject'](_0x23ff06);}return _0x836c36[_0x2f91('0x1c')]();};}function saveUpdates(_0x48aa84,_0x3c0b2a){return function(_0x4c600c){if(_0x4c600c){return _0x4c600c['update'](_0x48aa84)[_0x2f91('0x1d')](function(_0x43d56c){return _0x43d56c;});}return null;};}function removeEntity(_0x1975fa,_0x288467){return function(_0x4b5a74){if(_0x4b5a74){return _0x4b5a74[_0x2f91('0x1e')]()[_0x2f91('0x1d')](function(){_0x1975fa[_0x2f91('0x15')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5bbd9a,_0x1c3171){return function(_0x4e402d){if(!_0x4e402d){_0x5bbd9a['sendStatus'](0x194);}return _0x4e402d;};}function handleError(_0x4888fc,_0x496e68){_0x496e68=_0x496e68||0x1f4;return function(_0x23c1c5){logger['error'](_0x23c1c5['stack']);if(_0x23c1c5[_0x2f91('0x1f')]){delete _0x23c1c5[_0x2f91('0x1f')];}_0x4888fc[_0x2f91('0x15')](_0x496e68)[_0x2f91('0x20')](_0x23c1c5);};}exports[_0x2f91('0x21')]=function(_0x55d6ef,_0x325d54){var _0x583176={'raw':!![],'where':{'id':_0x55d6ef[_0x2f91('0x22')]['id']}},_0x391d0c={};_0x391d0c['model']=_['keys'](db[_0x2f91('0x23')][_0x2f91('0x24')]);_0x391d0c[_0x2f91('0x25')]=_[_0x2f91('0x26')](_0x55d6ef[_0x2f91('0x25')]);_0x391d0c[_0x2f91('0x27')]=_[_0x2f91('0x28')](_0x391d0c['model'],_0x391d0c[_0x2f91('0x25')]);_0x583176[_0x2f91('0x29')]=_[_0x2f91('0x28')](_0x391d0c[_0x2f91('0x2a')],qs[_0x2f91('0x2b')](_0x55d6ef[_0x2f91('0x25')][_0x2f91('0x2b')]));_0x583176[_0x2f91('0x29')]=_0x583176[_0x2f91('0x29')][_0x2f91('0x2c')]?_0x583176['attributes']:_0x391d0c[_0x2f91('0x2a')];if(_0x55d6ef[_0x2f91('0x25')][_0x2f91('0x2d')]){_0x583176[_0x2f91('0x2e')]=[{'all':!![]}];}_0x583176=_[_0x2f91('0x2f')]({},_0x583176,_0x55d6ef[_0x2f91('0x30')]);return db[_0x2f91('0x23')][_0x2f91('0x31')](_0x583176)[_0x2f91('0x1d')](handleEntityNotFound(_0x325d54,null))['then'](respondWithResult(_0x325d54,null))[_0x2f91('0x32')](handleError(_0x325d54,null));};exports[_0x2f91('0x33')]=function(_0x245f4c,_0xdf2c9e){if(_0x245f4c[_0x2f91('0x34')]['id']){delete _0x245f4c[_0x2f91('0x34')]['id'];}return db['ChatApplication'][_0x2f91('0x31')]({'where':{'id':_0x245f4c[_0x2f91('0x22')]['id']}})[_0x2f91('0x1d')](handleEntityNotFound(_0xdf2c9e,null))[_0x2f91('0x1d')](saveUpdates(_0x245f4c[_0x2f91('0x34')],null))['then'](respondWithResult(_0xdf2c9e,null))['catch'](handleError(_0xdf2c9e,null));};exports[_0x2f91('0x1e')]=function(_0x55dea9,_0x56ed50){return db[_0x2f91('0x23')]['find']({'where':{'id':_0x55dea9[_0x2f91('0x22')]['id']}})['then'](handleEntityNotFound(_0x56ed50,null))[_0x2f91('0x1d')](removeEntity(_0x56ed50,null))['catch'](handleError(_0x56ed50,null));}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.model.js b/server/api/chatApplication/chatApplication.model.js index e6a3a17..dfb3786 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 _0x7171=['chat_applications','util','../../config/logger','api','moment','path','rimraf','../../config/environment','./chatApplication.attributes','exports','ChatApplication'];(function(_0x45346d,_0xffd56b){var _0x5ce7ca=function(_0x27ce87){while(--_0x27ce87){_0x45346d['push'](_0x45346d['shift']());}};_0x5ce7ca(++_0xffd56b);}(_0x7171,0x182));var _0x1717=function(_0x4fde08,_0x463a36){_0x4fde08=_0x4fde08-0x0;var _0x12e725=_0x7171[_0x4fde08];return _0x12e725;};'use strict';var _=require('lodash');var util=require(_0x1717('0x0'));var logger=require(_0x1717('0x1'))(_0x1717('0x2'));var moment=require(_0x1717('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x1717('0x4'));var rimraf=require(_0x1717('0x5'));var config=require(_0x1717('0x6'));var attributes=require(_0x1717('0x7'));module[_0x1717('0x8')]=function(_0x1e085b,_0xb1fbbd){return _0x1e085b['define'](_0x1717('0x9'),attributes,{'tableName':_0x1717('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0xdee2=['rimraf','../../config/environment','ChatApplication','utf8mb4','utf8mb4_unicode_ci','lodash','../../config/logger','api','bluebird','request-promise','path'];(function(_0x3e8b23,_0x4392cd){var _0x38d8c3=function(_0x41266a){while(--_0x41266a){_0x3e8b23['push'](_0x3e8b23['shift']());}};_0x38d8c3(++_0x4392cd);}(_0xdee2,0x191));var _0x2dee=function(_0x241af1,_0xf80087){_0x241af1=_0x241af1-0x0;var _0x5bdfee=_0xdee2[_0x241af1];return _0x5bdfee;};'use strict';var _=require(_0x2dee('0x0'));var util=require('util');var logger=require(_0x2dee('0x1'))(_0x2dee('0x2'));var moment=require('moment');var BPromise=require(_0x2dee('0x3'));var rp=require(_0x2dee('0x4'));var fs=require('fs');var path=require(_0x2dee('0x5'));var rimraf=require(_0x2dee('0x6'));var config=require(_0x2dee('0x7'));var attributes=require('./chatApplication.attributes');module['exports']=function(_0x4498c1,_0x585982){return _0x4498c1['define'](_0x2dee('0x8'),attributes,{'tableName':'chat_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x2dee('0x9'),'collate':_0x2dee('0xa')});}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.rpc.js b/server/api/chatApplication/chatApplication.rpc.js index 81acb67..57a6079 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 _0xdd68=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','request','then','ChatApplication,\x20%s,\x20%s','request\x20sent','debug','error','code','message','info','result','catch','lodash','util','moment','bluebird'];(function(_0x3acd3b,_0x21e7f5){var _0x5bb412=function(_0x3ae7e3){while(--_0x3ae7e3){_0x3acd3b['push'](_0x3acd3b['shift']());}};_0x5bb412(++_0x21e7f5);}(_0xdd68,0x155));var _0x8dd6=function(_0x710815,_0x520da8){_0x710815=_0x710815-0x0;var _0x5b3b89=_0xdd68[_0x710815];return _0x5b3b89;};'use strict';var _=require(_0x8dd6('0x0'));var util=require(_0x8dd6('0x1'));var moment=require(_0x8dd6('0x2'));var BPromise=require(_0x8dd6('0x3'));var rs=require(_0x8dd6('0x4'));var fs=require('fs');var Redis=require(_0x8dd6('0x5'));var db=require(_0x8dd6('0x6'))['db'];var utils=require(_0x8dd6('0x7'));var logger=require(_0x8dd6('0x8'))(_0x8dd6('0x9'));var config=require(_0x8dd6('0xa'));var jayson=require('jayson/promise');var client=jayson[_0x8dd6('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1303a2,_0x3da3fa,_0x11a4cf){return new BPromise(function(_0x25b8b5,_0x37edec){return client[_0x8dd6('0xc')](_0x1303a2,_0x11a4cf)[_0x8dd6('0xd')](function(_0x5a8789){logger['info'](_0x8dd6('0xe'),_0x3da3fa,_0x8dd6('0xf'));logger[_0x8dd6('0x10')]('ChatApplication,\x20%s,\x20%s,\x20%s',_0x3da3fa,_0x8dd6('0xf'),JSON['stringify'](_0x5a8789));if(_0x5a8789[_0x8dd6('0x11')]){if(_0x5a8789[_0x8dd6('0x11')][_0x8dd6('0x12')]===0x1f4){logger[_0x8dd6('0x11')](_0x8dd6('0xe'),_0x3da3fa,_0x5a8789[_0x8dd6('0x11')][_0x8dd6('0x13')]);return _0x37edec(_0x5a8789[_0x8dd6('0x11')][_0x8dd6('0x13')]);}logger[_0x8dd6('0x11')]('ChatApplication,\x20%s,\x20%s',_0x3da3fa,_0x5a8789[_0x8dd6('0x11')][_0x8dd6('0x13')]);return _0x25b8b5(_0x5a8789[_0x8dd6('0x11')][_0x8dd6('0x13')]);}else{logger[_0x8dd6('0x14')](_0x8dd6('0xe'),_0x3da3fa,'request\x20sent');_0x25b8b5(_0x5a8789[_0x8dd6('0x15')][_0x8dd6('0x13')]);}})[_0x8dd6('0x16')](function(_0xa3ed31){logger[_0x8dd6('0x11')]('ChatApplication,\x20%s,\x20%s',_0x3da3fa,_0xa3ed31);_0x37edec(_0xa3ed31);});});} \ No newline at end of file +var _0x697e=['rpc','../../config/environment','jayson/promise','http','request','info','ChatApplication,\x20%s,\x20%s','request\x20sent','debug','ChatApplication,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x19e57f,_0x4ae750){var _0x469556=function(_0xf6968b){while(--_0xf6968b){_0x19e57f['push'](_0x19e57f['shift']());}};_0x469556(++_0x4ae750);}(_0x697e,0x10c));var _0xe697=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x697e[_0x20a584];return _0x4b41a8;};'use strict';var _=require('lodash');var util=require(_0xe697('0x0'));var moment=require(_0xe697('0x1'));var BPromise=require(_0xe697('0x2'));var rs=require(_0xe697('0x3'));var fs=require('fs');var Redis=require(_0xe697('0x4'));var db=require(_0xe697('0x5'))['db'];var utils=require(_0xe697('0x6'));var logger=require(_0xe697('0x7'))(_0xe697('0x8'));var config=require(_0xe697('0x9'));var jayson=require(_0xe697('0xa'));var client=jayson['client'][_0xe697('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x240ad4,_0x1a754e,_0x7d1d6f){return new BPromise(function(_0x3b0f27,_0x1833ea){return client[_0xe697('0xc')](_0x240ad4,_0x7d1d6f)['then'](function(_0x36f179){logger[_0xe697('0xd')](_0xe697('0xe'),_0x1a754e,_0xe697('0xf'));logger[_0xe697('0x10')](_0xe697('0x11'),_0x1a754e,_0xe697('0xf'),JSON[_0xe697('0x12')](_0x36f179));if(_0x36f179[_0xe697('0x13')]){if(_0x36f179[_0xe697('0x13')]['code']===0x1f4){logger[_0xe697('0x13')](_0xe697('0xe'),_0x1a754e,_0x36f179['error']['message']);return _0x1833ea(_0x36f179[_0xe697('0x13')][_0xe697('0x14')]);}logger[_0xe697('0x13')](_0xe697('0xe'),_0x1a754e,_0x36f179[_0xe697('0x13')][_0xe697('0x14')]);return _0x3b0f27(_0x36f179[_0xe697('0x13')][_0xe697('0x14')]);}else{logger[_0xe697('0xd')](_0xe697('0xe'),_0x1a754e,_0xe697('0xf'));_0x3b0f27(_0x36f179[_0xe697('0x15')]['message']);}})[_0xe697('0x16')](function(_0x36fe7f){logger[_0xe697('0x13')](_0xe697('0xe'),_0x1a754e,_0x36fe7f);_0x1833ea(_0x36fe7f);});});} \ No newline at end of file diff --git a/server/api/chatApplication/index.js b/server/api/chatApplication/index.js index 144e584..8e969f9 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 _0x889f=['/:id','delete','exports','multer','path','connect-timeout','Router','../../components/auth/service','isAuthenticated','put'];(function(_0x327828,_0x15e6c9){var _0xb64e83=function(_0x42ef09){while(--_0x42ef09){_0x327828['push'](_0x327828['shift']());}};_0xb64e83(++_0x15e6c9);}(_0x889f,0x67));var _0xf889=function(_0x1e4a8e,_0x18022b){_0x1e4a8e=_0x1e4a8e-0x0;var _0x5408f9=_0x889f[_0x1e4a8e];return _0x5408f9;};'use strict';var multer=require(_0xf889('0x0'));var util=require('util');var path=require(_0xf889('0x1'));var timeout=require(_0xf889('0x2'));var express=require('express');var router=express[_0xf889('0x3')]();var auth=require(_0xf889('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./chatApplication.controller');router['get']('/:id',auth[_0xf889('0x5')](),controller['show']);router[_0xf889('0x6')](_0xf889('0x7'),auth[_0xf889('0x5')](),controller['update']);router[_0xf889('0x8')](_0xf889('0x7'),auth['isAuthenticated'](),controller['destroy']);module[_0xf889('0x9')]=router; \ No newline at end of file +var _0x92e2=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatApplication.controller','isAuthenticated','put','/:id','update','delete','destroy','exports','multer','path','connect-timeout','express'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x92e2,0x19c));var _0x292e=function(_0x952282,_0x51a614){_0x952282=_0x952282-0x0;var _0x613507=_0x92e2[_0x952282];return _0x613507;};'use strict';var multer=require(_0x292e('0x0'));var util=require('util');var path=require(_0x292e('0x1'));var timeout=require(_0x292e('0x2'));var express=require(_0x292e('0x3'));var router=express[_0x292e('0x4')]();var auth=require(_0x292e('0x5'));var interaction=require(_0x292e('0x6'));var config=require(_0x292e('0x7'));var controller=require(_0x292e('0x8'));router['get']('/:id',auth[_0x292e('0x9')](),controller['show']);router[_0x292e('0xa')](_0x292e('0xb'),auth[_0x292e('0x9')](),controller[_0x292e('0xc')]);router[_0x292e('0xd')](_0x292e('0xb'),auth[_0x292e('0x9')](),controller[_0x292e('0xe')]);module[_0x292e('0xf')]=router; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.attributes.js b/server/api/chatGroup/chatGroup.attributes.js index f1f3334..045ab1d 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 _0x90f8=['STRING','BOOLEAN','sequelize','exports'];(function(_0x13e150,_0x2d4c71){var _0x1d1b72=function(_0x5f4266){while(--_0x5f4266){_0x13e150['push'](_0x13e150['shift']());}};_0x1d1b72(++_0x2d4c71);}(_0x90f8,0x192));var _0x890f=function(_0xbc6932,_0x426566){_0xbc6932=_0xbc6932-0x0;var _0x588a0a=_0x90f8[_0xbc6932];return _0x588a0a;};'use strict';var Sequelize=require(_0x890f('0x0'));module[_0x890f('0x1')]={'name':{'type':Sequelize[_0x890f('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0x890f('0x2')]},'write':{'type':Sequelize[_0x890f('0x3')],'defaultValue':!![]}}; \ No newline at end of file +var _0xa4cb=['BOOLEAN','sequelize','exports','STRING'];(function(_0x2fb690,_0x11edbe){var _0x5c80dc=function(_0xa0f889){while(--_0xa0f889){_0x2fb690['push'](_0x2fb690['shift']());}};_0x5c80dc(++_0x11edbe);}(_0xa4cb,0xc5));var _0xba4c=function(_0xf3ea74,_0x3a6544){_0xf3ea74=_0xf3ea74-0x0;var _0x20527d=_0xa4cb[_0xf3ea74];return _0x20527d;};'use strict';var Sequelize=require(_0xba4c('0x0'));module[_0xba4c('0x1')]={'name':{'type':Sequelize[_0xba4c('0x2')],'allowNull':![]},'description':{'type':Sequelize['STRING']},'write':{'type':Sequelize[_0xba4c('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 e8f9446..39b2913 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 _0xaad8=['VIRTUAL','filter','includeAll','findAll','show','params','length','include','options','find','create','body','destroy','describe','getUnread','user','toInteger','addMembers','ids','omit','getMembers','findOne','addMessage','ChatGroupId','getMessages','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','./chatGroup.socket','jayson/promise','client','http','test','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','info','request\x20sent','debug','error','code','ChatGroup,\x20%s,\x20%s','message','catch','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','stack','name','send','index','map','ChatGroup','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','merge'];(function(_0x2aa031,_0x3643d0){var _0x587fe3=function(_0x14e3ac){while(--_0x14e3ac){_0x2aa031['push'](_0x2aa031['shift']());}};_0x587fe3(++_0x3643d0);}(_0xaad8,0xfd));var _0x8aad=function(_0x54dce5,_0x8bbf80){_0x54dce5=_0x54dce5-0x0;var _0x1de4a7=_0xaad8[_0x54dce5];return _0x1de4a7;};'use strict';var pdf=require(_0x8aad('0x0'));var emlformat=require(_0x8aad('0x1'));var rimraf=require(_0x8aad('0x2'));var zipdir=require(_0x8aad('0x3'));var jsonpatch=require(_0x8aad('0x4'));var rp=require(_0x8aad('0x5'));var moment=require(_0x8aad('0x6'));var BPromise=require(_0x8aad('0x7'));var Mustache=require(_0x8aad('0x8'));var util=require(_0x8aad('0x9'));var path=require('path');var sox=require(_0x8aad('0xa'));var csv=require(_0x8aad('0xb'));var ejs=require(_0x8aad('0xc'));var fs=require('fs');var _=require(_0x8aad('0xd'));var squel=require(_0x8aad('0xe'));var crypto=require(_0x8aad('0xf'));var jsforce=require('jsforce');var deskjs=require(_0x8aad('0x10'));var toCsv=require(_0x8aad('0xb'));var querystring=require(_0x8aad('0x11'));var Papa=require('papaparse');var Redis=require(_0x8aad('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x8aad('0x13'));var as=require(_0x8aad('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x8aad('0x15'))(_0x8aad('0x16'));var utils=require(_0x8aad('0x17'));var config=require(_0x8aad('0x18'));var db=require(_0x8aad('0x19'))['db'];config[_0x8aad('0x1a')]=_['defaults'](config['redis'],{'host':_0x8aad('0x1b'),'port':0x18eb});var socket=require(_0x8aad('0x1c'))(new Redis(config[_0x8aad('0x1a')]));require(_0x8aad('0x1d'))['register'](socket);var jayson=require(_0x8aad('0x1e'));var client=jayson[_0x8aad('0x1f')][_0x8aad('0x20')]({'port':0x232a});function checkPasswordPattern(_0x264acc,_0x10c87f,_0x52a876){if(_0x52a876){var _0x187032=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x187032[_0x8aad('0x21')](_0x10c87f)){return _0x264acc;}else{throw new db[(_0x8aad('0x22'))][(_0x8aad('0x23'))](_0x8aad('0x24'));}}else{return _0x264acc;}}function respondWithRpcPromise(_0x51d0d5,_0x2484b9,_0x16be0a,_0x34de3d){return new BPromise(function(_0x11edf0,_0x11f867){var _0x4df755=_0x34de3d||client;return _0x4df755[_0x8aad('0x25')](_0x51d0d5,_0x16be0a)[_0x8aad('0x26')](function(_0x2539c3){logger[_0x8aad('0x27')]('ChatGroup,\x20%s,\x20%s',_0x2484b9,_0x8aad('0x28'));logger[_0x8aad('0x29')]('ChatGroup,\x20%s,\x20%s,\x20%s',_0x2484b9,_0x8aad('0x28'),JSON['stringify'](_0x2539c3));if(_0x2539c3[_0x8aad('0x2a')]){if(_0x2539c3['error'][_0x8aad('0x2b')]===0x1f4){logger[_0x8aad('0x2a')](_0x8aad('0x2c'),_0x2484b9,_0x2539c3[_0x8aad('0x2a')][_0x8aad('0x2d')]);return _0x11f867(_0x2539c3[_0x8aad('0x2a')][_0x8aad('0x2d')]);}logger['error']('ChatGroup,\x20%s,\x20%s',_0x2484b9,_0x2539c3[_0x8aad('0x2a')][_0x8aad('0x2d')]);return _0x11edf0(_0x2539c3['error']['message']);}else{logger[_0x8aad('0x27')](_0x8aad('0x2c'),_0x2484b9,_0x8aad('0x28'));_0x11edf0(_0x2539c3['result']['message']);}})[_0x8aad('0x2e')](function(_0x5d36b1){logger[_0x8aad('0x2a')](_0x8aad('0x2c'),_0x2484b9,_0x5d36b1);_0x11f867(_0x5d36b1);});});}function respondWithStatusCode(_0x17f9a6,_0x10b34c){_0x10b34c=_0x10b34c||0xcc;return function(_0x393e9){if(_0x393e9){return _0x17f9a6[_0x8aad('0x2f')](_0x10b34c);}return _0x17f9a6[_0x8aad('0x30')](_0x10b34c)[_0x8aad('0x31')]();};}function respondWithResult(_0x41a9c3,_0x20f984){_0x20f984=_0x20f984||0xc8;return function(_0x17917a){if(_0x17917a){return _0x41a9c3['status'](_0x20f984)[_0x8aad('0x32')](_0x17917a);}};}function respondWithFilteredResult(_0x2bccd5,_0x14142c){return function(_0x2ff4dc){if(_0x2ff4dc){var _0x14b366=_0x2ff4dc[_0x8aad('0x33')],_0x1e28d0=_0x14142c[_0x8aad('0x34')],_0x14cf78=_0x14142c['offset']+_0x14142c[_0x8aad('0x35')],_0x53f26d;if(_0x14cf78>=_0x14b366){_0x14cf78=_0x14b366;_0x53f26d=0xc8;}else{_0x53f26d=0xce;}_0x2bccd5[_0x8aad('0x30')](_0x53f26d);return _0x2bccd5[_0x8aad('0x36')](_0x8aad('0x37'),_0x1e28d0+'-'+_0x14cf78+'/'+_0x14b366)[_0x8aad('0x32')](_0x2ff4dc);}return null;};}function patchUpdates(_0x25516c){return function(_0x3a10df){try{jsonpatch[_0x8aad('0x38')](_0x3a10df,_0x25516c,!![]);}catch(_0x5e5934){return BPromise[_0x8aad('0x39')](_0x5e5934);}return _0x3a10df[_0x8aad('0x3a')]();};}function saveUpdates(_0x2f9762,_0x406414){return function(_0x3cfa1a){if(_0x3cfa1a){return _0x3cfa1a[_0x8aad('0x3b')](_0x2f9762)[_0x8aad('0x26')](function(_0x3c1b41){return _0x3c1b41;});}return null;};}function removeEntity(_0x2eac44,_0x594ffb){return function(_0x891b19){if(_0x891b19){return _0x891b19['destroy']()[_0x8aad('0x26')](function(){_0x2eac44[_0x8aad('0x30')](0xcc)[_0x8aad('0x31')]();});}};}function handleEntityNotFound(_0x59de88,_0x282fe9){return function(_0x2d8c2b){if(!_0x2d8c2b){_0x59de88[_0x8aad('0x2f')](0x194);}return _0x2d8c2b;};}function handleError(_0x266a6a,_0x56c21b){_0x56c21b=_0x56c21b||0x1f4;return function(_0x7db13f){logger[_0x8aad('0x2a')](_0x7db13f[_0x8aad('0x3c')]);if(_0x7db13f[_0x8aad('0x3d')]){delete _0x7db13f[_0x8aad('0x3d')];}_0x266a6a[_0x8aad('0x30')](_0x56c21b)[_0x8aad('0x3e')](_0x7db13f);};}exports[_0x8aad('0x3f')]=function(_0x485fb4,_0x18f4ff){var _0x357bec={},_0x550c04={},_0x30af0e={'count':0x0,'rows':[]};var _0x2dd78b=_[_0x8aad('0x40')](db[_0x8aad('0x41')][_0x8aad('0x42')],function(_0x467cc7){return{'name':_0x467cc7['fieldName'],'type':_0x467cc7[_0x8aad('0x43')][_0x8aad('0x44')]};});_0x550c04[_0x8aad('0x45')]=_[_0x8aad('0x40')](_0x2dd78b,_0x8aad('0x3d'));_0x550c04[_0x8aad('0x46')]=_[_0x8aad('0x47')](_0x485fb4[_0x8aad('0x46')]);_0x550c04[_0x8aad('0x48')]=_[_0x8aad('0x49')](_0x550c04[_0x8aad('0x45')],_0x550c04['query']);_0x357bec[_0x8aad('0x4a')]=_['intersection'](_0x550c04[_0x8aad('0x45')],qs[_0x8aad('0x4b')](_0x485fb4[_0x8aad('0x46')][_0x8aad('0x4b')]));_0x357bec[_0x8aad('0x4a')]=_0x357bec[_0x8aad('0x4a')]['length']?_0x357bec[_0x8aad('0x4a')]:_0x550c04[_0x8aad('0x45')];if(!_0x485fb4[_0x8aad('0x46')][_0x8aad('0x4c')](_0x8aad('0x4d'))){_0x357bec['limit']=qs[_0x8aad('0x35')](_0x485fb4['query']['limit']);_0x357bec[_0x8aad('0x34')]=qs[_0x8aad('0x34')](_0x485fb4[_0x8aad('0x46')][_0x8aad('0x34')]);}_0x357bec[_0x8aad('0x4e')]=qs[_0x8aad('0x4f')](_0x485fb4['query'][_0x8aad('0x4f')]);_0x357bec[_0x8aad('0x50')]=qs[_0x8aad('0x48')](_[_0x8aad('0x51')](_0x485fb4[_0x8aad('0x46')],_0x550c04[_0x8aad('0x48')]),_0x2dd78b);if(_0x485fb4['query']['filter']){_0x357bec[_0x8aad('0x50')]=_[_0x8aad('0x52')](_0x357bec[_0x8aad('0x50')],{'$or':_[_0x8aad('0x40')](_0x2dd78b,function(_0xb89731){if(_0xb89731[_0x8aad('0x43')]!==_0x8aad('0x53')){var _0x4df5bd={};_0x4df5bd[_0xb89731['name']]={'$like':'%'+_0x485fb4[_0x8aad('0x46')][_0x8aad('0x54')]+'%'};return _0x4df5bd;}})});}_0x357bec=_[_0x8aad('0x52')]({},_0x357bec,_0x485fb4['options']);var _0x84e7eb={'where':_0x357bec[_0x8aad('0x50')]};return db['ChatGroup'][_0x8aad('0x33')](_0x84e7eb)['then'](function(_0x308a2b){_0x30af0e[_0x8aad('0x33')]=_0x308a2b;if(_0x485fb4['query'][_0x8aad('0x55')]){_0x357bec['include']=[{'all':!![]}];}return db[_0x8aad('0x41')][_0x8aad('0x56')](_0x357bec);})[_0x8aad('0x26')](function(_0x2d5128){_0x30af0e['rows']=_0x2d5128;return _0x30af0e;})[_0x8aad('0x26')](respondWithFilteredResult(_0x18f4ff,_0x357bec))[_0x8aad('0x2e')](handleError(_0x18f4ff,null));};exports[_0x8aad('0x57')]=function(_0x37356f,_0x3cfab6){var _0x135b79={'raw':!![],'where':{'id':_0x37356f[_0x8aad('0x58')]['id']}},_0x49f2b8={};_0x49f2b8[_0x8aad('0x45')]=_[_0x8aad('0x47')](db[_0x8aad('0x41')]['rawAttributes']);_0x49f2b8[_0x8aad('0x46')]=_[_0x8aad('0x47')](_0x37356f[_0x8aad('0x46')]);_0x49f2b8[_0x8aad('0x48')]=_['intersection'](_0x49f2b8[_0x8aad('0x45')],_0x49f2b8['query']);_0x135b79['attributes']=_['intersection'](_0x49f2b8[_0x8aad('0x45')],qs[_0x8aad('0x4b')](_0x37356f[_0x8aad('0x46')][_0x8aad('0x4b')]));_0x135b79[_0x8aad('0x4a')]=_0x135b79[_0x8aad('0x4a')][_0x8aad('0x59')]?_0x135b79[_0x8aad('0x4a')]:_0x49f2b8[_0x8aad('0x45')];if(_0x37356f['query'][_0x8aad('0x55')]){_0x135b79[_0x8aad('0x5a')]=[{'all':!![]}];}_0x135b79=_['merge']({},_0x135b79,_0x37356f[_0x8aad('0x5b')]);return db[_0x8aad('0x41')][_0x8aad('0x5c')](_0x135b79)[_0x8aad('0x26')](handleEntityNotFound(_0x3cfab6,null))[_0x8aad('0x26')](respondWithResult(_0x3cfab6,null))[_0x8aad('0x2e')](handleError(_0x3cfab6,null));};exports[_0x8aad('0x5d')]=function(_0xc2ad2c,_0x54055d){return db[_0x8aad('0x41')][_0x8aad('0x5d')](_0xc2ad2c[_0x8aad('0x5e')],{})[_0x8aad('0x26')](respondWithResult(_0x54055d,0xc9))['catch'](handleError(_0x54055d,null));};exports[_0x8aad('0x3b')]=function(_0x4dde2f,_0x5adfac){if(_0x4dde2f[_0x8aad('0x5e')]['id']){delete _0x4dde2f[_0x8aad('0x5e')]['id'];}return db[_0x8aad('0x41')]['find']({'where':{'id':_0x4dde2f[_0x8aad('0x58')]['id']}})[_0x8aad('0x26')](handleEntityNotFound(_0x5adfac,null))[_0x8aad('0x26')](saveUpdates(_0x4dde2f[_0x8aad('0x5e')],null))[_0x8aad('0x26')](respondWithResult(_0x5adfac,null))['catch'](handleError(_0x5adfac,null));};exports[_0x8aad('0x5f')]=function(_0x282507,_0xbcdd84){return db[_0x8aad('0x41')][_0x8aad('0x5c')]({'where':{'id':_0x282507[_0x8aad('0x58')]['id']}})[_0x8aad('0x26')](handleEntityNotFound(_0xbcdd84,null))[_0x8aad('0x26')](removeEntity(_0xbcdd84,null))['catch'](handleError(_0xbcdd84,null));};exports[_0x8aad('0x60')]=function(_0x2debbe,_0x424514){return db[_0x8aad('0x41')]['describe']()[_0x8aad('0x26')](respondWithResult(_0x424514,null))[_0x8aad('0x2e')](handleError(_0x424514,null));};exports[_0x8aad('0x61')]=function(_0x202780,_0x12847f,_0x5182b9){return db['ChatInternalMessage'][_0x8aad('0x33')]({'where':{'ChatGroupId':_0x202780['params']['id'],'ToId':_0x202780[_0x8aad('0x62')]['id'],'read':![]}})[_0x8aad('0x26')](function(_0x70e34a){return{'id':_[_0x8aad('0x63')](_0x202780['params']['id']),'count':_0x70e34a};})[_0x8aad('0x26')](respondWithResult(_0x12847f,null))[_0x8aad('0x2e')](handleError(_0x12847f,null));};exports[_0x8aad('0x64')]=function(_0x36395f,_0x34058e,_0x34864a){return db[_0x8aad('0x41')][_0x8aad('0x5c')]({'where':{'id':_0x36395f[_0x8aad('0x58')]['id']}})[_0x8aad('0x26')](handleEntityNotFound(_0x34058e,null))[_0x8aad('0x26')](function(_0x30b2d3){if(_0x30b2d3){return _0x30b2d3[_0x8aad('0x64')](_0x36395f[_0x8aad('0x5e')][_0x8aad('0x65')],_[_0x8aad('0x66')](_0x36395f[_0x8aad('0x5e')],[_0x8aad('0x65'),'id'])||{});}})['then'](respondWithResult(_0x34058e,null))[_0x8aad('0x2e')](handleError(_0x34058e,null));};exports[_0x8aad('0x67')]=function(_0x332534,_0x33378d,_0x259059){var _0x3009d7={};var _0x2da8aa={};var _0x34941f;var _0x565231;return db[_0x8aad('0x41')][_0x8aad('0x68')]({'where':{'id':_0x332534[_0x8aad('0x58')]['id']}})[_0x8aad('0x26')](handleEntityNotFound(_0x33378d,null))[_0x8aad('0x26')](function(_0x16891a){if(_0x16891a){_0x34941f=_0x16891a;_0x2da8aa[_0x8aad('0x45')]=_[_0x8aad('0x47')](db['User'][_0x8aad('0x42')]);_0x2da8aa[_0x8aad('0x46')]=_[_0x8aad('0x47')](_0x332534[_0x8aad('0x46')]);_0x2da8aa[_0x8aad('0x48')]=_['intersection'](_0x2da8aa['model'],_0x2da8aa[_0x8aad('0x46')]);_0x3009d7['attributes']=_['intersection'](_0x2da8aa[_0x8aad('0x45')],qs[_0x8aad('0x4b')](_0x332534[_0x8aad('0x46')][_0x8aad('0x4b')]));_0x3009d7[_0x8aad('0x4a')]=_0x3009d7[_0x8aad('0x4a')][_0x8aad('0x59')]?_0x3009d7['attributes']:_0x2da8aa[_0x8aad('0x45')];_0x3009d7[_0x8aad('0x4e')]=qs['sort'](_0x332534[_0x8aad('0x46')][_0x8aad('0x4f')]);_0x3009d7['where']=qs[_0x8aad('0x48')](_[_0x8aad('0x51')](_0x332534[_0x8aad('0x46')],_0x2da8aa[_0x8aad('0x48')]));if(_0x332534[_0x8aad('0x46')][_0x8aad('0x54')]){_0x3009d7[_0x8aad('0x50')]=_[_0x8aad('0x52')](_0x3009d7[_0x8aad('0x50')],{'$or':_[_0x8aad('0x40')](_0x3009d7[_0x8aad('0x4a')],function(_0x1f4dea){var _0x4620cb={};_0x4620cb[_0x1f4dea]={'$like':'%'+_0x332534[_0x8aad('0x46')]['filter']+'%'};return _0x4620cb;})});}_0x3009d7=_[_0x8aad('0x52')]({},_0x3009d7,_0x332534[_0x8aad('0x5b')]);return _0x34941f[_0x8aad('0x67')](_0x3009d7);}})[_0x8aad('0x26')](function(_0x44e52e){if(_0x44e52e){_0x565231=_0x44e52e[_0x8aad('0x59')];if(!_0x332534['query'][_0x8aad('0x4c')](_0x8aad('0x4d'))){_0x3009d7[_0x8aad('0x35')]=qs[_0x8aad('0x35')](_0x332534['query'][_0x8aad('0x35')]);_0x3009d7['offset']=qs[_0x8aad('0x34')](_0x332534[_0x8aad('0x46')]['offset']);}return _0x34941f[_0x8aad('0x67')](_0x3009d7);}})[_0x8aad('0x26')](function(_0x593210){if(_0x593210){return _0x593210?{'count':_0x565231,'rows':_0x593210}:null;}})[_0x8aad('0x26')](respondWithResult(_0x33378d,null))[_0x8aad('0x2e')](handleError(_0x33378d,null));};exports['removeMembers']=function(_0x2f4186,_0x234bfc,_0x1a1946){return db[_0x8aad('0x41')]['find']({'where':{'id':_0x2f4186[_0x8aad('0x58')]['id']}})[_0x8aad('0x26')](handleEntityNotFound(_0x234bfc,null))[_0x8aad('0x26')](function(_0x276027){if(_0x276027){return _0x276027['removeMembers'](_0x2f4186['query'][_0x8aad('0x65')]);}})['then'](respondWithStatusCode(_0x234bfc,null))['catch'](handleError(_0x234bfc,null));};exports[_0x8aad('0x69')]=function(_0x45ca6d,_0xc4ec76,_0x3e110b){if(_0x45ca6d['body']['id']){delete _0x45ca6d[_0x8aad('0x5e')]['id'];}return db[_0x8aad('0x41')]['find']({'where':{'id':_0x45ca6d[_0x8aad('0x58')]['id']}})[_0x8aad('0x26')](handleEntityNotFound(_0xc4ec76,null))[_0x8aad('0x26')](function(_0x19c6a0){if(_0x19c6a0){_0x45ca6d[_0x8aad('0x5e')][_0x8aad('0x6a')]=_0x19c6a0['id'];return db['ChatInternalMessage'][_0x8aad('0x5d')](_0x45ca6d[_0x8aad('0x5e')]);}})[_0x8aad('0x26')](respondWithResult(_0xc4ec76,null))['catch'](handleError(_0xc4ec76,null));};exports[_0x8aad('0x6b')]=function(_0x27c803,_0x33b55d,_0x2314b1){var _0x592163={};var _0x2099bf={};var _0x583ea1;var _0x3f5fa2;return db[_0x8aad('0x41')][_0x8aad('0x68')]({'where':{'id':_0x27c803[_0x8aad('0x58')]['id']}})['then'](handleEntityNotFound(_0x33b55d,null))[_0x8aad('0x26')](function(_0x4f5235){if(_0x4f5235){_0x583ea1=_0x4f5235;_0x2099bf[_0x8aad('0x45')]=_[_0x8aad('0x47')](db['ChatInternalMessage'][_0x8aad('0x42')]);_0x2099bf[_0x8aad('0x46')]=_[_0x8aad('0x47')](_0x27c803[_0x8aad('0x46')]);_0x2099bf[_0x8aad('0x48')]=_[_0x8aad('0x49')](_0x2099bf[_0x8aad('0x45')],_0x2099bf[_0x8aad('0x46')]);_0x592163[_0x8aad('0x4a')]=_[_0x8aad('0x49')](_0x2099bf[_0x8aad('0x45')],qs[_0x8aad('0x4b')](_0x27c803['query'][_0x8aad('0x4b')]));_0x592163[_0x8aad('0x4a')]=_0x592163[_0x8aad('0x4a')]['length']?_0x592163[_0x8aad('0x4a')]:_0x2099bf[_0x8aad('0x45')];_0x592163[_0x8aad('0x4e')]=qs['sort'](_0x27c803[_0x8aad('0x46')][_0x8aad('0x4f')]);_0x592163['where']=qs[_0x8aad('0x48')](_[_0x8aad('0x51')](_0x27c803[_0x8aad('0x46')],_0x2099bf[_0x8aad('0x48')]));if(_0x27c803[_0x8aad('0x46')][_0x8aad('0x54')]){_0x592163[_0x8aad('0x50')]=_[_0x8aad('0x52')](_0x592163['where'],{'$or':_[_0x8aad('0x40')](_0x592163[_0x8aad('0x4a')],function(_0x4835d0){var _0x3a93d1={};_0x3a93d1[_0x4835d0]={'$like':'%'+_0x27c803['query'][_0x8aad('0x54')]+'%'};return _0x3a93d1;})});}if(_0x27c803[_0x8aad('0x46')][_0x8aad('0x6c')]){var _0x4c73e5=_0x27c803[_0x8aad('0x46')][_0x8aad('0x6c')][_0x8aad('0x6d')](',');var _0x3805d6={};_0x3805d6[_0x4c73e5[0x0]]={'$gte':moment(_0x4c73e5[0x1])[_0x8aad('0x6e')](_0x8aad('0x6f'))};_0x592163[_0x8aad('0x50')]=_[_0x8aad('0x52')](_0x592163['where'],_0x3805d6);}_0x592163=_[_0x8aad('0x52')]({},_0x592163,_0x27c803['options']);return _0x583ea1[_0x8aad('0x6b')](_0x592163);}})[_0x8aad('0x26')](function(_0xaa0073){if(_0xaa0073){_0x3f5fa2=_0xaa0073[_0x8aad('0x59')];if(!_0x27c803[_0x8aad('0x46')][_0x8aad('0x4c')](_0x8aad('0x4d'))){_0x592163[_0x8aad('0x35')]=qs[_0x8aad('0x35')](_0x27c803[_0x8aad('0x46')][_0x8aad('0x35')]);_0x592163[_0x8aad('0x34')]=qs[_0x8aad('0x34')](_0x27c803[_0x8aad('0x46')][_0x8aad('0x34')]);}return _0x583ea1[_0x8aad('0x6b')](_0x592163);}})[_0x8aad('0x26')](function(_0x1181e9){if(_0x1181e9){return _0x1181e9?{'count':_0x3f5fa2,'rows':_0x1181e9}:null;}})[_0x8aad('0x26')](respondWithResult(_0x33b55d,null))['catch'](handleError(_0x33b55d,null));}; \ No newline at end of file +var _0xf140=['params','find','create','body','describe','getUnread','ChatInternalMessage','user','addMembers','ids','omit','findOne','User','rawAttributes','sort','options','getMembers','removeMembers','addMessage','ChatGroupId','getMessages','$gte','split','format','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','path','to-csv','ejs','lodash','squel','jsforce','desk.js','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','socket.io-emitter','./chatGroup.socket','jayson/promise','client','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','ChatGroup,\x20%s,\x20%s','request\x20sent','ChatGroup,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','status','end','json','offset','limit','set','Content-Range','apply','update','destroy','stack','name','send','index','map','ChatGroup','fieldName','type','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','pick','filter','where','merge','VIRTUAL','count','includeAll','include','rows','show'];(function(_0x1c2051,_0x4cb6b9){var _0x2b58a0=function(_0x4308df){while(--_0x4308df){_0x1c2051['push'](_0x1c2051['shift']());}};_0x2b58a0(++_0x4cb6b9);}(_0xf140,0xe8));var _0x0f14=function(_0x45d31c,_0xd0b936){_0x45d31c=_0x45d31c-0x0;var _0x33c23a=_0xf140[_0x45d31c];return _0x33c23a;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x0f14('0x0'));var rimraf=require(_0x0f14('0x1'));var zipdir=require(_0x0f14('0x2'));var jsonpatch=require(_0x0f14('0x3'));var rp=require(_0x0f14('0x4'));var moment=require(_0x0f14('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0x0f14('0x6'));var sox=require('sox');var csv=require(_0x0f14('0x7'));var ejs=require(_0x0f14('0x8'));var fs=require('fs');var _=require(_0x0f14('0x9'));var squel=require(_0x0f14('0xa'));var crypto=require('crypto');var jsforce=require(_0x0f14('0xb'));var deskjs=require(_0x0f14('0xc'));var toCsv=require(_0x0f14('0x7'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x0f14('0xd'));var qs=require(_0x0f14('0xe'));var as=require(_0x0f14('0xf'));var hardwareService=require(_0x0f14('0x10'));var logger=require(_0x0f14('0x11'))(_0x0f14('0x12'));var utils=require(_0x0f14('0x13'));var config=require(_0x0f14('0x14'));var db=require(_0x0f14('0x15'))['db'];config[_0x0f14('0x16')]=_[_0x0f14('0x17')](config[_0x0f14('0x16')],{'host':'localhost','port':0x18eb});var socket=require(_0x0f14('0x18'))(new Redis(config[_0x0f14('0x16')]));require(_0x0f14('0x19'))['register'](socket);var jayson=require(_0x0f14('0x1a'));var client=jayson[_0x0f14('0x1b')]['http']({'port':0x232a});function checkPasswordPattern(_0x5510df,_0x3bdc7e,_0x2ad607){if(_0x2ad607){var _0x5a2ff7=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x5a2ff7['test'](_0x3bdc7e)){return _0x5510df;}else{throw new db['Sequelize'][(_0x0f14('0x1c'))](_0x0f14('0x1d'));}}else{return _0x5510df;}}function respondWithRpcPromise(_0x2fbd7b,_0x4ac1ca,_0x5bdedc,_0x232827){return new BPromise(function(_0x2c700d,_0x57be20){var _0x374371=_0x232827||client;return _0x374371[_0x0f14('0x1e')](_0x2fbd7b,_0x5bdedc)[_0x0f14('0x1f')](function(_0x22ce95){logger['info'](_0x0f14('0x20'),_0x4ac1ca,_0x0f14('0x21'));logger['debug'](_0x0f14('0x22'),_0x4ac1ca,_0x0f14('0x21'),JSON[_0x0f14('0x23')](_0x22ce95));if(_0x22ce95[_0x0f14('0x24')]){if(_0x22ce95[_0x0f14('0x24')][_0x0f14('0x25')]===0x1f4){logger[_0x0f14('0x24')](_0x0f14('0x20'),_0x4ac1ca,_0x22ce95[_0x0f14('0x24')][_0x0f14('0x26')]);return _0x57be20(_0x22ce95[_0x0f14('0x24')][_0x0f14('0x26')]);}logger['error']('ChatGroup,\x20%s,\x20%s',_0x4ac1ca,_0x22ce95['error'][_0x0f14('0x26')]);return _0x2c700d(_0x22ce95[_0x0f14('0x24')][_0x0f14('0x26')]);}else{logger[_0x0f14('0x27')]('ChatGroup,\x20%s,\x20%s',_0x4ac1ca,_0x0f14('0x21'));_0x2c700d(_0x22ce95['result'][_0x0f14('0x26')]);}})[_0x0f14('0x28')](function(_0xc73280){logger['error'](_0x0f14('0x20'),_0x4ac1ca,_0xc73280);_0x57be20(_0xc73280);});});}function respondWithStatusCode(_0x1d0fe2,_0x53328e){_0x53328e=_0x53328e||0xcc;return function(_0x2ba39f){if(_0x2ba39f){return _0x1d0fe2['sendStatus'](_0x53328e);}return _0x1d0fe2[_0x0f14('0x29')](_0x53328e)[_0x0f14('0x2a')]();};}function respondWithResult(_0x2bb32f,_0x70f547){_0x70f547=_0x70f547||0xc8;return function(_0x28e677){if(_0x28e677){return _0x2bb32f[_0x0f14('0x29')](_0x70f547)[_0x0f14('0x2b')](_0x28e677);}};}function respondWithFilteredResult(_0x42e781,_0x4b2480){return function(_0x407361){if(_0x407361){var _0x423a0c=_0x407361['count'],_0x129478=_0x4b2480[_0x0f14('0x2c')],_0x460d62=_0x4b2480[_0x0f14('0x2c')]+_0x4b2480[_0x0f14('0x2d')],_0x5103f3;if(_0x460d62>=_0x423a0c){_0x460d62=_0x423a0c;_0x5103f3=0xc8;}else{_0x5103f3=0xce;}_0x42e781[_0x0f14('0x29')](_0x5103f3);return _0x42e781[_0x0f14('0x2e')](_0x0f14('0x2f'),_0x129478+'-'+_0x460d62+'/'+_0x423a0c)['json'](_0x407361);}return null;};}function patchUpdates(_0x298100){return function(_0x19e728){try{jsonpatch[_0x0f14('0x30')](_0x19e728,_0x298100,!![]);}catch(_0x5f5145){return BPromise['reject'](_0x5f5145);}return _0x19e728['save']();};}function saveUpdates(_0x506fee,_0x467ed7){return function(_0x11affa){if(_0x11affa){return _0x11affa[_0x0f14('0x31')](_0x506fee)[_0x0f14('0x1f')](function(_0x24032a){return _0x24032a;});}return null;};}function removeEntity(_0x35ec15,_0x453d45){return function(_0x2a7dfa){if(_0x2a7dfa){return _0x2a7dfa[_0x0f14('0x32')]()[_0x0f14('0x1f')](function(){_0x35ec15['status'](0xcc)[_0x0f14('0x2a')]();});}};}function handleEntityNotFound(_0x553c59,_0x4130ae){return function(_0x494b37){if(!_0x494b37){_0x553c59['sendStatus'](0x194);}return _0x494b37;};}function handleError(_0x995a4e,_0x3d3e6c){_0x3d3e6c=_0x3d3e6c||0x1f4;return function(_0xb4feb4){logger[_0x0f14('0x24')](_0xb4feb4[_0x0f14('0x33')]);if(_0xb4feb4['name']){delete _0xb4feb4[_0x0f14('0x34')];}_0x995a4e['status'](_0x3d3e6c)[_0x0f14('0x35')](_0xb4feb4);};}exports[_0x0f14('0x36')]=function(_0x3d536b,_0x53ab19){var _0x1b2fcb={},_0x549c1a={},_0x12400a={'count':0x0,'rows':[]};var _0x1484e0=_[_0x0f14('0x37')](db[_0x0f14('0x38')]['rawAttributes'],function(_0xa50606){return{'name':_0xa50606[_0x0f14('0x39')],'type':_0xa50606[_0x0f14('0x3a')]['key']};});_0x549c1a['model']=_[_0x0f14('0x37')](_0x1484e0,_0x0f14('0x34'));_0x549c1a[_0x0f14('0x3b')]=_[_0x0f14('0x3c')](_0x3d536b['query']);_0x549c1a[_0x0f14('0x3d')]=_[_0x0f14('0x3e')](_0x549c1a[_0x0f14('0x3f')],_0x549c1a[_0x0f14('0x3b')]);_0x1b2fcb[_0x0f14('0x40')]=_[_0x0f14('0x3e')](_0x549c1a['model'],qs[_0x0f14('0x41')](_0x3d536b['query'][_0x0f14('0x41')]));_0x1b2fcb['attributes']=_0x1b2fcb[_0x0f14('0x40')][_0x0f14('0x42')]?_0x1b2fcb[_0x0f14('0x40')]:_0x549c1a[_0x0f14('0x3f')];if(!_0x3d536b[_0x0f14('0x3b')][_0x0f14('0x43')](_0x0f14('0x44'))){_0x1b2fcb[_0x0f14('0x2d')]=qs[_0x0f14('0x2d')](_0x3d536b[_0x0f14('0x3b')][_0x0f14('0x2d')]);_0x1b2fcb[_0x0f14('0x2c')]=qs[_0x0f14('0x2c')](_0x3d536b['query'][_0x0f14('0x2c')]);}_0x1b2fcb[_0x0f14('0x45')]=qs['sort'](_0x3d536b[_0x0f14('0x3b')]['sort']);_0x1b2fcb['where']=qs['filters'](_[_0x0f14('0x46')](_0x3d536b[_0x0f14('0x3b')],_0x549c1a['filters']),_0x1484e0);if(_0x3d536b[_0x0f14('0x3b')][_0x0f14('0x47')]){_0x1b2fcb[_0x0f14('0x48')]=_[_0x0f14('0x49')](_0x1b2fcb[_0x0f14('0x48')],{'$or':_[_0x0f14('0x37')](_0x1484e0,function(_0x4f1554){if(_0x4f1554['type']!==_0x0f14('0x4a')){var _0x4c3f3f={};_0x4c3f3f[_0x4f1554[_0x0f14('0x34')]]={'$like':'%'+_0x3d536b['query'][_0x0f14('0x47')]+'%'};return _0x4c3f3f;}})});}_0x1b2fcb=_['merge']({},_0x1b2fcb,_0x3d536b['options']);var _0x414c46={'where':_0x1b2fcb[_0x0f14('0x48')]};return db['ChatGroup'][_0x0f14('0x4b')](_0x414c46)[_0x0f14('0x1f')](function(_0x2b389b){_0x12400a[_0x0f14('0x4b')]=_0x2b389b;if(_0x3d536b[_0x0f14('0x3b')][_0x0f14('0x4c')]){_0x1b2fcb[_0x0f14('0x4d')]=[{'all':!![]}];}return db['ChatGroup']['findAll'](_0x1b2fcb);})[_0x0f14('0x1f')](function(_0x723ec6){_0x12400a[_0x0f14('0x4e')]=_0x723ec6;return _0x12400a;})[_0x0f14('0x1f')](respondWithFilteredResult(_0x53ab19,_0x1b2fcb))[_0x0f14('0x28')](handleError(_0x53ab19,null));};exports[_0x0f14('0x4f')]=function(_0x56b77e,_0x2497e7){var _0x3afe79={'raw':!![],'where':{'id':_0x56b77e[_0x0f14('0x50')]['id']}},_0x34f3ea={};_0x34f3ea[_0x0f14('0x3f')]=_[_0x0f14('0x3c')](db[_0x0f14('0x38')]['rawAttributes']);_0x34f3ea[_0x0f14('0x3b')]=_[_0x0f14('0x3c')](_0x56b77e['query']);_0x34f3ea[_0x0f14('0x3d')]=_[_0x0f14('0x3e')](_0x34f3ea[_0x0f14('0x3f')],_0x34f3ea['query']);_0x3afe79[_0x0f14('0x40')]=_[_0x0f14('0x3e')](_0x34f3ea[_0x0f14('0x3f')],qs[_0x0f14('0x41')](_0x56b77e['query'][_0x0f14('0x41')]));_0x3afe79[_0x0f14('0x40')]=_0x3afe79['attributes'][_0x0f14('0x42')]?_0x3afe79[_0x0f14('0x40')]:_0x34f3ea[_0x0f14('0x3f')];if(_0x56b77e['query'][_0x0f14('0x4c')]){_0x3afe79[_0x0f14('0x4d')]=[{'all':!![]}];}_0x3afe79=_[_0x0f14('0x49')]({},_0x3afe79,_0x56b77e['options']);return db[_0x0f14('0x38')][_0x0f14('0x51')](_0x3afe79)['then'](handleEntityNotFound(_0x2497e7,null))[_0x0f14('0x1f')](respondWithResult(_0x2497e7,null))[_0x0f14('0x28')](handleError(_0x2497e7,null));};exports['create']=function(_0x9e28fe,_0x99be93){return db['ChatGroup'][_0x0f14('0x52')](_0x9e28fe[_0x0f14('0x53')],{})[_0x0f14('0x1f')](respondWithResult(_0x99be93,0xc9))['catch'](handleError(_0x99be93,null));};exports[_0x0f14('0x31')]=function(_0x2edb7f,_0x2e8847){if(_0x2edb7f[_0x0f14('0x53')]['id']){delete _0x2edb7f[_0x0f14('0x53')]['id'];}return db[_0x0f14('0x38')]['find']({'where':{'id':_0x2edb7f[_0x0f14('0x50')]['id']}})[_0x0f14('0x1f')](handleEntityNotFound(_0x2e8847,null))[_0x0f14('0x1f')](saveUpdates(_0x2edb7f['body'],null))[_0x0f14('0x1f')](respondWithResult(_0x2e8847,null))[_0x0f14('0x28')](handleError(_0x2e8847,null));};exports[_0x0f14('0x32')]=function(_0x339801,_0x2ea758){return db[_0x0f14('0x38')]['find']({'where':{'id':_0x339801[_0x0f14('0x50')]['id']}})[_0x0f14('0x1f')](handleEntityNotFound(_0x2ea758,null))[_0x0f14('0x1f')](removeEntity(_0x2ea758,null))[_0x0f14('0x28')](handleError(_0x2ea758,null));};exports[_0x0f14('0x54')]=function(_0x18db38,_0x232b44){return db[_0x0f14('0x38')]['describe']()[_0x0f14('0x1f')](respondWithResult(_0x232b44,null))[_0x0f14('0x28')](handleError(_0x232b44,null));};exports[_0x0f14('0x55')]=function(_0x1f6d49,_0x1a85ab,_0x4c0f34){return db[_0x0f14('0x56')][_0x0f14('0x4b')]({'where':{'ChatGroupId':_0x1f6d49[_0x0f14('0x50')]['id'],'ToId':_0x1f6d49[_0x0f14('0x57')]['id'],'read':![]}})[_0x0f14('0x1f')](function(_0x12c281){return{'id':_['toInteger'](_0x1f6d49[_0x0f14('0x50')]['id']),'count':_0x12c281};})['then'](respondWithResult(_0x1a85ab,null))[_0x0f14('0x28')](handleError(_0x1a85ab,null));};exports[_0x0f14('0x58')]=function(_0x13a191,_0x2efb8b,_0x5a890d){return db[_0x0f14('0x38')][_0x0f14('0x51')]({'where':{'id':_0x13a191[_0x0f14('0x50')]['id']}})[_0x0f14('0x1f')](handleEntityNotFound(_0x2efb8b,null))[_0x0f14('0x1f')](function(_0x5d352d){if(_0x5d352d){return _0x5d352d['addMembers'](_0x13a191['body'][_0x0f14('0x59')],_[_0x0f14('0x5a')](_0x13a191[_0x0f14('0x53')],[_0x0f14('0x59'),'id'])||{});}})['then'](respondWithResult(_0x2efb8b,null))[_0x0f14('0x28')](handleError(_0x2efb8b,null));};exports['getMembers']=function(_0x174098,_0xf77d19,_0x3ef989){var _0x5823e0={};var _0x1dcf03={};var _0x29024c;var _0x2371c8;return db[_0x0f14('0x38')][_0x0f14('0x5b')]({'where':{'id':_0x174098['params']['id']}})['then'](handleEntityNotFound(_0xf77d19,null))[_0x0f14('0x1f')](function(_0x180e28){if(_0x180e28){_0x29024c=_0x180e28;_0x1dcf03[_0x0f14('0x3f')]=_[_0x0f14('0x3c')](db[_0x0f14('0x5c')][_0x0f14('0x5d')]);_0x1dcf03[_0x0f14('0x3b')]=_['keys'](_0x174098[_0x0f14('0x3b')]);_0x1dcf03['filters']=_[_0x0f14('0x3e')](_0x1dcf03['model'],_0x1dcf03[_0x0f14('0x3b')]);_0x5823e0['attributes']=_[_0x0f14('0x3e')](_0x1dcf03[_0x0f14('0x3f')],qs[_0x0f14('0x41')](_0x174098[_0x0f14('0x3b')][_0x0f14('0x41')]));_0x5823e0[_0x0f14('0x40')]=_0x5823e0[_0x0f14('0x40')]['length']?_0x5823e0[_0x0f14('0x40')]:_0x1dcf03['model'];_0x5823e0[_0x0f14('0x45')]=qs[_0x0f14('0x5e')](_0x174098['query'][_0x0f14('0x5e')]);_0x5823e0[_0x0f14('0x48')]=qs[_0x0f14('0x3d')](_[_0x0f14('0x46')](_0x174098[_0x0f14('0x3b')],_0x1dcf03[_0x0f14('0x3d')]));if(_0x174098[_0x0f14('0x3b')][_0x0f14('0x47')]){_0x5823e0[_0x0f14('0x48')]=_['merge'](_0x5823e0['where'],{'$or':_['map'](_0x5823e0[_0x0f14('0x40')],function(_0x71d966){var _0x7c14bb={};_0x7c14bb[_0x71d966]={'$like':'%'+_0x174098[_0x0f14('0x3b')][_0x0f14('0x47')]+'%'};return _0x7c14bb;})});}_0x5823e0=_[_0x0f14('0x49')]({},_0x5823e0,_0x174098[_0x0f14('0x5f')]);return _0x29024c[_0x0f14('0x60')](_0x5823e0);}})[_0x0f14('0x1f')](function(_0x163eef){if(_0x163eef){_0x2371c8=_0x163eef[_0x0f14('0x42')];if(!_0x174098[_0x0f14('0x3b')][_0x0f14('0x43')](_0x0f14('0x44'))){_0x5823e0[_0x0f14('0x2d')]=qs['limit'](_0x174098[_0x0f14('0x3b')][_0x0f14('0x2d')]);_0x5823e0[_0x0f14('0x2c')]=qs[_0x0f14('0x2c')](_0x174098[_0x0f14('0x3b')][_0x0f14('0x2c')]);}return _0x29024c[_0x0f14('0x60')](_0x5823e0);}})[_0x0f14('0x1f')](function(_0x57694b){if(_0x57694b){return _0x57694b?{'count':_0x2371c8,'rows':_0x57694b}:null;}})[_0x0f14('0x1f')](respondWithResult(_0xf77d19,null))[_0x0f14('0x28')](handleError(_0xf77d19,null));};exports[_0x0f14('0x61')]=function(_0x4248bf,_0x43fc14,_0x2767b2){return db[_0x0f14('0x38')][_0x0f14('0x51')]({'where':{'id':_0x4248bf[_0x0f14('0x50')]['id']}})['then'](handleEntityNotFound(_0x43fc14,null))[_0x0f14('0x1f')](function(_0x5aacbd){if(_0x5aacbd){return _0x5aacbd[_0x0f14('0x61')](_0x4248bf['query'][_0x0f14('0x59')]);}})[_0x0f14('0x1f')](respondWithStatusCode(_0x43fc14,null))[_0x0f14('0x28')](handleError(_0x43fc14,null));};exports[_0x0f14('0x62')]=function(_0x3df8ce,_0x32a0d8,_0x495a8a){if(_0x3df8ce[_0x0f14('0x53')]['id']){delete _0x3df8ce[_0x0f14('0x53')]['id'];}return db['ChatGroup']['find']({'where':{'id':_0x3df8ce[_0x0f14('0x50')]['id']}})[_0x0f14('0x1f')](handleEntityNotFound(_0x32a0d8,null))['then'](function(_0x46cab2){if(_0x46cab2){_0x3df8ce[_0x0f14('0x53')][_0x0f14('0x63')]=_0x46cab2['id'];return db[_0x0f14('0x56')][_0x0f14('0x52')](_0x3df8ce[_0x0f14('0x53')]);}})[_0x0f14('0x1f')](respondWithResult(_0x32a0d8,null))['catch'](handleError(_0x32a0d8,null));};exports[_0x0f14('0x64')]=function(_0x2f7b47,_0x156ed2,_0x110e14){var _0x2727c8={};var _0x1f72a5={};var _0x10f802;var _0x2d6e5b;return db[_0x0f14('0x38')][_0x0f14('0x5b')]({'where':{'id':_0x2f7b47[_0x0f14('0x50')]['id']}})['then'](handleEntityNotFound(_0x156ed2,null))[_0x0f14('0x1f')](function(_0x46c487){if(_0x46c487){_0x10f802=_0x46c487;_0x1f72a5[_0x0f14('0x3f')]=_[_0x0f14('0x3c')](db[_0x0f14('0x56')]['rawAttributes']);_0x1f72a5[_0x0f14('0x3b')]=_[_0x0f14('0x3c')](_0x2f7b47[_0x0f14('0x3b')]);_0x1f72a5[_0x0f14('0x3d')]=_[_0x0f14('0x3e')](_0x1f72a5[_0x0f14('0x3f')],_0x1f72a5[_0x0f14('0x3b')]);_0x2727c8[_0x0f14('0x40')]=_['intersection'](_0x1f72a5[_0x0f14('0x3f')],qs[_0x0f14('0x41')](_0x2f7b47['query'][_0x0f14('0x41')]));_0x2727c8[_0x0f14('0x40')]=_0x2727c8[_0x0f14('0x40')][_0x0f14('0x42')]?_0x2727c8['attributes']:_0x1f72a5[_0x0f14('0x3f')];_0x2727c8[_0x0f14('0x45')]=qs[_0x0f14('0x5e')](_0x2f7b47[_0x0f14('0x3b')][_0x0f14('0x5e')]);_0x2727c8[_0x0f14('0x48')]=qs[_0x0f14('0x3d')](_[_0x0f14('0x46')](_0x2f7b47[_0x0f14('0x3b')],_0x1f72a5['filters']));if(_0x2f7b47['query'][_0x0f14('0x47')]){_0x2727c8[_0x0f14('0x48')]=_[_0x0f14('0x49')](_0x2727c8[_0x0f14('0x48')],{'$or':_[_0x0f14('0x37')](_0x2727c8[_0x0f14('0x40')],function(_0x34765e){var _0x3727ac={};_0x3727ac[_0x34765e]={'$like':'%'+_0x2f7b47[_0x0f14('0x3b')][_0x0f14('0x47')]+'%'};return _0x3727ac;})});}if(_0x2f7b47[_0x0f14('0x3b')][_0x0f14('0x65')]){var _0x2f1f4e=_0x2f7b47[_0x0f14('0x3b')][_0x0f14('0x65')][_0x0f14('0x66')](',');var _0x3dfa8e={};_0x3dfa8e[_0x2f1f4e[0x0]]={'$gte':moment(_0x2f1f4e[0x1])[_0x0f14('0x67')]('YYYY-MM-DD\x20HH:mm:ss')};_0x2727c8[_0x0f14('0x48')]=_['merge'](_0x2727c8[_0x0f14('0x48')],_0x3dfa8e);}_0x2727c8=_['merge']({},_0x2727c8,_0x2f7b47[_0x0f14('0x5f')]);return _0x10f802[_0x0f14('0x64')](_0x2727c8);}})['then'](function(_0x3f6fbb){if(_0x3f6fbb){_0x2d6e5b=_0x3f6fbb[_0x0f14('0x42')];if(!_0x2f7b47[_0x0f14('0x3b')][_0x0f14('0x43')](_0x0f14('0x44'))){_0x2727c8['limit']=qs[_0x0f14('0x2d')](_0x2f7b47[_0x0f14('0x3b')][_0x0f14('0x2d')]);_0x2727c8[_0x0f14('0x2c')]=qs[_0x0f14('0x2c')](_0x2f7b47[_0x0f14('0x3b')][_0x0f14('0x2c')]);}return _0x10f802[_0x0f14('0x64')](_0x2727c8);}})[_0x0f14('0x1f')](function(_0x45aafc){if(_0x45aafc){return _0x45aafc?{'count':_0x2d6e5b,'rows':_0x45aafc}:null;}})[_0x0f14('0x1f')](respondWithResult(_0x156ed2,null))['catch'](handleError(_0x156ed2,null));}; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.events.js b/server/api/chatGroup/chatGroup.events.js index 21b5d41..3b876a5 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 _0x2032=['exports','../../mysqldb','ChatGroup','setMaxListeners','update','remove','emit','hasOwnProperty','hook'];(function(_0x55e08b,_0x421620){var _0xd1a7ff=function(_0x58c7ff){while(--_0x58c7ff){_0x55e08b['push'](_0x55e08b['shift']());}};_0xd1a7ff(++_0x421620);}(_0x2032,0xd9));var _0x2203=function(_0x35fa8c,_0x165769){_0x35fa8c=_0x35fa8c-0x0;var _0x1d611c=_0x2032[_0x35fa8c];return _0x1d611c;};'use strict';var EventEmitter=require('events');var ChatGroup=require(_0x2203('0x0'))['db'][_0x2203('0x1')];var ChatGroupEvents=new EventEmitter();ChatGroupEvents[_0x2203('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x2203('0x3'),'afterDestroy':_0x2203('0x4')};function emitEvent(_0x4b4c7f){return function(_0x46c49a,_0x880dcd,_0x44ccfd){ChatGroupEvents[_0x2203('0x5')](_0x4b4c7f+':'+_0x46c49a['id'],_0x46c49a);ChatGroupEvents[_0x2203('0x5')](_0x4b4c7f,_0x46c49a);_0x44ccfd(null);};}for(var e in events){if(events[_0x2203('0x6')](e)){var event=events[e];ChatGroup[_0x2203('0x7')](e,emitEvent(event));}}module[_0x2203('0x8')]=ChatGroupEvents; \ No newline at end of file +var _0xadb5=['update','emit','hasOwnProperty','hook','exports','../../mysqldb','setMaxListeners','save'];(function(_0x58a4fe,_0x11d439){var _0x697de2=function(_0xe38c14){while(--_0xe38c14){_0x58a4fe['push'](_0x58a4fe['shift']());}};_0x697de2(++_0x11d439);}(_0xadb5,0xad));var _0x5adb=function(_0x302391,_0x409b4a){_0x302391=_0x302391-0x0;var _0x3674a5=_0xadb5[_0x302391];return _0x3674a5;};'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 diff --git a/server/api/chatGroup/chatGroup.model.js b/server/api/chatGroup/chatGroup.model.js index 3b26a65..c9d341c 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 _0x7c09=['rimraf','../../config/environment','./chatGroup.attributes','define','ChatGroup','chat_groups','util','../../config/logger','moment','bluebird','request-promise','path'];(function(_0x19aa32,_0x33381b){var _0x104dd6=function(_0xd172cd){while(--_0xd172cd){_0x19aa32['push'](_0x19aa32['shift']());}};_0x104dd6(++_0x33381b);}(_0x7c09,0x102));var _0x97c0=function(_0x3ed077,_0x4c0723){_0x3ed077=_0x3ed077-0x0;var _0x893393=_0x7c09[_0x3ed077];return _0x893393;};'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 +var _0x6b8f=['exports','define','ChatGroup','chat_groups','util','api','request-promise','path','../../config/environment','./chatGroup.attributes'];(function(_0x3da36b,_0x1e1878){var _0x40f385=function(_0xd6dc8a){while(--_0xd6dc8a){_0x3da36b['push'](_0x3da36b['shift']());}};_0x40f385(++_0x1e1878);}(_0x6b8f,0x1bc));var _0xf6b8=function(_0x539c3f,_0x12a6c1){_0x539c3f=_0x539c3f-0x0;var _0x14daf7=_0x6b8f[_0x539c3f];return _0x14daf7;};'use strict';var _=require('lodash');var util=require(_0xf6b8('0x0'));var logger=require('../../config/logger')(_0xf6b8('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xf6b8('0x2'));var fs=require('fs');var path=require(_0xf6b8('0x3'));var rimraf=require('rimraf');var config=require(_0xf6b8('0x4'));var attributes=require(_0xf6b8('0x5'));module[_0xf6b8('0x6')]=function(_0x549eac,_0x2d035e){return _0x549eac[_0xf6b8('0x7')](_0xf6b8('0x8'),attributes,{'tableName':_0xf6b8('0x9'),'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 e88e3f7..d1cb7eb 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 _0x9bbb=['./chatGroup.socket','request','ChatGroup,\x20%s,\x20%s','request\x20sent','debug','ChatGroup,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','redis','localhost','socket.io-emitter'];(function(_0x3bcefb,_0x1e88c0){var _0x267bd9=function(_0x2097c8){while(--_0x2097c8){_0x3bcefb['push'](_0x3bcefb['shift']());}};_0x267bd9(++_0x1e88c0);}(_0x9bbb,0x1a4));var _0xb9bb=function(_0x50ebff,_0x5aec48){_0x50ebff=_0x50ebff-0x0;var _0x1596ca=_0x9bbb[_0x50ebff];return _0x1596ca;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xb9bb('0x0'));var BPromise=require(_0xb9bb('0x1'));var rs=require(_0xb9bb('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb9bb('0x3'))['db'];var utils=require(_0xb9bb('0x4'));var logger=require(_0xb9bb('0x5'))(_0xb9bb('0x6'));var config=require(_0xb9bb('0x7'));var jayson=require(_0xb9bb('0x8'));var client=jayson['client']['http']({'port':0x232a});config[_0xb9bb('0x9')]=_['defaults'](config['redis'],{'host':_0xb9bb('0xa'),'port':0x18eb});var socket=require(_0xb9bb('0xb'))(new Redis(config[_0xb9bb('0x9')]));require(_0xb9bb('0xc'))['register'](socket);function respondWithRpcPromise(_0x3f5e98,_0x23fa00,_0x58a993){return new BPromise(function(_0x48c84a,_0xf8dc62){return client[_0xb9bb('0xd')](_0x3f5e98,_0x58a993)['then'](function(_0x5e472c){logger['info'](_0xb9bb('0xe'),_0x23fa00,_0xb9bb('0xf'));logger[_0xb9bb('0x10')](_0xb9bb('0x11'),_0x23fa00,_0xb9bb('0xf'),JSON[_0xb9bb('0x12')](_0x5e472c));if(_0x5e472c[_0xb9bb('0x13')]){if(_0x5e472c[_0xb9bb('0x13')][_0xb9bb('0x14')]===0x1f4){logger[_0xb9bb('0x13')](_0xb9bb('0xe'),_0x23fa00,_0x5e472c[_0xb9bb('0x13')]['message']);return _0xf8dc62(_0x5e472c['error'][_0xb9bb('0x15')]);}logger[_0xb9bb('0x13')](_0xb9bb('0xe'),_0x23fa00,_0x5e472c[_0xb9bb('0x13')][_0xb9bb('0x15')]);return _0x48c84a(_0x5e472c[_0xb9bb('0x13')]['message']);}else{logger[_0xb9bb('0x16')](_0xb9bb('0xe'),_0x23fa00,'request\x20sent');_0x48c84a(_0x5e472c[_0xb9bb('0x17')][_0xb9bb('0x15')]);}})['catch'](function(_0x1a4048){logger[_0xb9bb('0x13')]('ChatGroup,\x20%s,\x20%s',_0x23fa00,_0x1a4048);_0xf8dc62(_0x1a4048);});});} \ No newline at end of file +var _0x8b31=['info','ChatGroup,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','redis','defaults','localhost','socket.io-emitter','register','request','then'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x8b31,0x132));var _0x18b3=function(_0x494653,_0x324945){_0x494653=_0x494653-0x0;var _0x14eb14=_0x8b31[_0x494653];return _0x14eb14;};'use strict';var _=require(_0x18b3('0x0'));var util=require(_0x18b3('0x1'));var moment=require('moment');var BPromise=require(_0x18b3('0x2'));var rs=require(_0x18b3('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x18b3('0x4'))['db'];var utils=require(_0x18b3('0x5'));var logger=require(_0x18b3('0x6'))(_0x18b3('0x7'));var config=require(_0x18b3('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x18b3('0x9')][_0x18b3('0xa')]({'port':0x232a});config[_0x18b3('0xb')]=_[_0x18b3('0xc')](config['redis'],{'host':_0x18b3('0xd'),'port':0x18eb});var socket=require(_0x18b3('0xe'))(new Redis(config[_0x18b3('0xb')]));require('./chatGroup.socket')[_0x18b3('0xf')](socket);function respondWithRpcPromise(_0x3bee19,_0x11c13c,_0x33282a){return new BPromise(function(_0x1df1f7,_0x5755f9){return client[_0x18b3('0x10')](_0x3bee19,_0x33282a)[_0x18b3('0x11')](function(_0x4f839b){logger[_0x18b3('0x12')](_0x18b3('0x13'),_0x11c13c,_0x18b3('0x14'));logger[_0x18b3('0x15')]('ChatGroup,\x20%s,\x20%s,\x20%s',_0x11c13c,_0x18b3('0x14'),JSON[_0x18b3('0x16')](_0x4f839b));if(_0x4f839b[_0x18b3('0x17')]){if(_0x4f839b[_0x18b3('0x17')][_0x18b3('0x18')]===0x1f4){logger[_0x18b3('0x17')]('ChatGroup,\x20%s,\x20%s',_0x11c13c,_0x4f839b[_0x18b3('0x17')][_0x18b3('0x19')]);return _0x5755f9(_0x4f839b[_0x18b3('0x17')][_0x18b3('0x19')]);}logger['error']('ChatGroup,\x20%s,\x20%s',_0x11c13c,_0x4f839b[_0x18b3('0x17')]['message']);return _0x1df1f7(_0x4f839b[_0x18b3('0x17')][_0x18b3('0x19')]);}else{logger[_0x18b3('0x12')](_0x18b3('0x13'),_0x11c13c,_0x18b3('0x14'));_0x1df1f7(_0x4f839b['result'][_0x18b3('0x19')]);}})[_0x18b3('0x1a')](function(_0x295370){logger[_0x18b3('0x17')](_0x18b3('0x13'),_0x11c13c,_0x295370);_0x5755f9(_0x295370);});});} \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.socket.js b/server/api/chatGroup/chatGroup.socket.js index 135c23f..4d32800 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 _0x5c77=['remove','update','emit','register','length','chatGroup:','./chatGroup.events','save'];(function(_0x122096,_0x60c295){var _0x3d1966=function(_0x3d569e){while(--_0x3d569e){_0x122096['push'](_0x122096['shift']());}};_0x3d1966(++_0x60c295);}(_0x5c77,0xae));var _0x75c7=function(_0x3b6bab,_0x4dd853){_0x3b6bab=_0x3b6bab-0x0;var _0x3f6478=_0x5c77[_0x3b6bab];return _0x3f6478;};'use strict';var ChatGroupEvents=require(_0x75c7('0x0'));var events=[_0x75c7('0x1'),_0x75c7('0x2'),_0x75c7('0x3')];function createListener(_0x1baf8a,_0x3c1050){return function(_0x2c5794){_0x3c1050[_0x75c7('0x4')](_0x1baf8a,_0x2c5794);};}function removeListener(_0x32a3e4,_0x39e5be){return function(){ChatGroupEvents['removeListener'](_0x32a3e4,_0x39e5be);};}exports[_0x75c7('0x5')]=function(_0x4d2ade){for(var _0x305a02=0x0,_0xdb23c6=events[_0x75c7('0x6')];_0x305a02<_0xdb23c6;_0x305a02++){var _0x538225=events[_0x305a02];var _0x4dae36=createListener(_0x75c7('0x7')+_0x538225,_0x4d2ade);ChatGroupEvents['on'](_0x538225,_0x4dae36);}}; \ No newline at end of file +var _0xddbe=['removeListener','length','chatGroup:','./chatGroup.events','remove','update','emit'];(function(_0x1fbc06,_0x4cfe7a){var _0x143c60=function(_0x26ad66){while(--_0x26ad66){_0x1fbc06['push'](_0x1fbc06['shift']());}};_0x143c60(++_0x4cfe7a);}(_0xddbe,0xc0));var _0xeddb=function(_0x56722f,_0x168759){_0x56722f=_0x56722f-0x0;var _0x1176ff=_0xddbe[_0x56722f];return _0x1176ff;};'use strict';var ChatGroupEvents=require(_0xeddb('0x0'));var events=['save',_0xeddb('0x1'),_0xeddb('0x2')];function createListener(_0x312f1e,_0x1c89e7){return function(_0x54ec0b){_0x1c89e7[_0xeddb('0x3')](_0x312f1e,_0x54ec0b);};}function removeListener(_0x41e326,_0x4e61d2){return function(){ChatGroupEvents[_0xeddb('0x4')](_0x41e326,_0x4e61d2);};}exports['register']=function(_0x145074){for(var _0x499f25=0x0,_0x4d756b=events[_0xeddb('0x5')];_0x499f25<_0x4d756b;_0x499f25++){var _0x23cc09=events[_0x499f25];var _0x57a75c=createListener(_0xeddb('0x6')+_0x23cc09,_0x145074);ChatGroupEvents['on'](_0x23cc09,_0x57a75c);}}; \ No newline at end of file diff --git a/server/api/chatGroup/index.js b/server/api/chatGroup/index.js index ce59637..a124011 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 _0xa44e=['post','/:id/messages','addMessage','put','update','removeMembers','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatGroup.controller','get','isAuthenticated','index','describe','/:id','show','/:id/unread','getUnread','/:id/members','getMessages','create'];(function(_0x3536de,_0x200191){var _0x18010f=function(_0x3b875f){while(--_0x3b875f){_0x3536de['push'](_0x3536de['shift']());}};_0x18010f(++_0x200191);}(_0xa44e,0xdf));var _0xea44=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xa44e[_0x14add3];return _0x4a174f;};'use strict';var multer=require(_0xea44('0x0'));var util=require(_0xea44('0x1'));var path=require(_0xea44('0x2'));var timeout=require('connect-timeout');var express=require(_0xea44('0x3'));var router=express[_0xea44('0x4')]();var auth=require(_0xea44('0x5'));var interaction=require(_0xea44('0x6'));var config=require(_0xea44('0x7'));var controller=require(_0xea44('0x8'));router[_0xea44('0x9')]('/',auth[_0xea44('0xa')](),controller[_0xea44('0xb')]);router[_0xea44('0x9')]('/describe',auth[_0xea44('0xa')](),controller[_0xea44('0xc')]);router[_0xea44('0x9')](_0xea44('0xd'),auth[_0xea44('0xa')](),controller[_0xea44('0xe')]);router[_0xea44('0x9')](_0xea44('0xf'),auth['isAuthenticated'](),controller[_0xea44('0x10')]);router[_0xea44('0x9')](_0xea44('0x11'),auth[_0xea44('0xa')](),controller['getMembers']);router[_0xea44('0x9')]('/:id/messages',auth[_0xea44('0xa')](),controller[_0xea44('0x12')]);router['post']('/',auth[_0xea44('0xa')](),controller[_0xea44('0x13')]);router['post'](_0xea44('0x11'),auth['isAuthenticated'](),controller['addMembers']);router[_0xea44('0x14')](_0xea44('0x15'),auth[_0xea44('0xa')](),controller[_0xea44('0x16')]);router[_0xea44('0x17')](_0xea44('0xd'),auth[_0xea44('0xa')](),controller[_0xea44('0x18')]);router['delete'](_0xea44('0xd'),auth[_0xea44('0xa')](),controller['destroy']);router['delete'](_0xea44('0x11'),auth[_0xea44('0xa')](),controller[_0xea44('0x19')]);module[_0xea44('0x1a')]=router; \ No newline at end of file +var _0x4707=['index','/describe','isAuthenticated','/:id','show','/:id/unread','getUnread','getMembers','/:id/messages','getMessages','post','/:id/members','addMessage','update','delete','destroy','removeMembers','util','path','connect-timeout','express','../../components/auth/service','./chatGroup.controller','get'];(function(_0x4e23dd,_0x5eb415){var _0x272cc9=function(_0x63cf55){while(--_0x63cf55){_0x4e23dd['push'](_0x4e23dd['shift']());}};_0x272cc9(++_0x5eb415);}(_0x4707,0x71));var _0x7470=function(_0x2db1c5,_0x10ad29){_0x2db1c5=_0x2db1c5-0x0;var _0xd9a8a=_0x4707[_0x2db1c5];return _0xd9a8a;};'use strict';var multer=require('multer');var util=require(_0x7470('0x0'));var path=require(_0x7470('0x1'));var timeout=require(_0x7470('0x2'));var express=require(_0x7470('0x3'));var router=express['Router']();var auth=require(_0x7470('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x7470('0x5'));router[_0x7470('0x6')]('/',auth['isAuthenticated'](),controller[_0x7470('0x7')]);router[_0x7470('0x6')](_0x7470('0x8'),auth[_0x7470('0x9')](),controller['describe']);router[_0x7470('0x6')](_0x7470('0xa'),auth['isAuthenticated'](),controller[_0x7470('0xb')]);router[_0x7470('0x6')](_0x7470('0xc'),auth[_0x7470('0x9')](),controller[_0x7470('0xd')]);router[_0x7470('0x6')]('/:id/members',auth[_0x7470('0x9')](),controller[_0x7470('0xe')]);router['get'](_0x7470('0xf'),auth['isAuthenticated'](),controller[_0x7470('0x10')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0x7470('0x11')](_0x7470('0x12'),auth['isAuthenticated'](),controller['addMembers']);router['post'](_0x7470('0xf'),auth['isAuthenticated'](),controller[_0x7470('0x13')]);router['put'](_0x7470('0xa'),auth[_0x7470('0x9')](),controller[_0x7470('0x14')]);router[_0x7470('0x15')](_0x7470('0xa'),auth['isAuthenticated'](),controller[_0x7470('0x16')]);router[_0x7470('0x15')](_0x7470('0x12'),auth['isAuthenticated'](),controller[_0x7470('0x17')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.attributes.js b/server/api/chatInteraction/chatInteraction.attributes.js index 7e5de21..953ce03 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 _0x137a=['ENUM','star','TEXT','STRING','DATE','exports','BOOLEAN'];(function(_0x29cadc,_0x2b3de0){var _0x36d08a=function(_0x2f8dd7){while(--_0x2f8dd7){_0x29cadc['push'](_0x29cadc['shift']());}};_0x36d08a(++_0x2b3de0);}(_0x137a,0xe5));var _0xa137=function(_0x46587c,_0x574944){_0x46587c=_0x46587c-0x0;var _0xb9f613=_0x137a[_0x46587c];return _0xb9f613;};'use strict';var Sequelize=require('sequelize');module[_0xa137('0x0')]={'closed':{'type':Sequelize[_0xa137('0x1')],'defaultValue':![]},'ratingValue':{'type':Sequelize['INTEGER']},'ratingType':{'type':Sequelize[_0xa137('0x2')](_0xa137('0x3'),'thumb'),'defaultValue':_0xa137('0x3')},'ratingMessage':{'type':Sequelize[_0xa137('0x4')]},'pathTranscript':{'type':Sequelize[_0xa137('0x4')]},'mailTranscript':{'type':Sequelize[_0xa137('0x5')],'validate':{'isEmail':!![]}},'closedAt':{'type':Sequelize[_0xa137('0x6')]},'disposition':{'type':Sequelize[_0xa137('0x5')]},'note':{'type':Sequelize[_0xa137('0x5')]},'browserName':{'type':Sequelize[_0xa137('0x5')]},'browserVersion':{'type':Sequelize[_0xa137('0x5')]},'osName':{'type':Sequelize[_0xa137('0x5')]},'osVersion':{'type':Sequelize['STRING']},'deviceModel':{'type':Sequelize['STRING']},'deviceVendor':{'type':Sequelize[_0xa137('0x5')]},'deviceType':{'type':Sequelize[_0xa137('0x5')]},'referer':{'type':Sequelize['TEXT']},'customerIp':{'type':Sequelize[_0xa137('0x5')]},'formData':{'type':Sequelize[_0xa137('0x4')]('long')},'read1stAt':{'type':Sequelize['DATE']},'lastMsgAt':{'type':Sequelize[_0xa137('0x6')]},'lastMsgDirection':{'type':Sequelize[_0xa137('0x2')]('in','out'),'defaultValue':'in','allowNull':![]},'closeReason':{'type':Sequelize['STRING']},'customerPort':{'type':Sequelize['STRING']},'vidaooSessionId':{'type':Sequelize[_0xa137('0x4')]}}; \ No newline at end of file +var _0x8806=['ENUM','TEXT','STRING','DATE','out','sequelize','BOOLEAN','INTEGER'];(function(_0x5b04a1,_0x389abc){var _0x7abfae=function(_0x2ad898){while(--_0x2ad898){_0x5b04a1['push'](_0x5b04a1['shift']());}};_0x7abfae(++_0x389abc);}(_0x8806,0xbd));var _0x6880=function(_0x40a825,_0x3bac79){_0x40a825=_0x40a825-0x0;var _0x273a54=_0x8806[_0x40a825];return _0x273a54;};'use strict';var Sequelize=require(_0x6880('0x0'));module['exports']={'closed':{'type':Sequelize[_0x6880('0x1')],'defaultValue':![]},'ratingValue':{'type':Sequelize[_0x6880('0x2')]},'ratingType':{'type':Sequelize[_0x6880('0x3')]('star','thumb'),'defaultValue':'star'},'ratingMessage':{'type':Sequelize['TEXT']},'pathTranscript':{'type':Sequelize[_0x6880('0x4')]},'mailTranscript':{'type':Sequelize[_0x6880('0x5')],'validate':{'isEmail':!![]}},'closedAt':{'type':Sequelize[_0x6880('0x6')]},'disposition':{'type':Sequelize[_0x6880('0x5')]},'note':{'type':Sequelize[_0x6880('0x5')]},'browserName':{'type':Sequelize['STRING']},'browserVersion':{'type':Sequelize['STRING']},'osName':{'type':Sequelize['STRING']},'osVersion':{'type':Sequelize[_0x6880('0x5')]},'deviceModel':{'type':Sequelize[_0x6880('0x5')]},'deviceVendor':{'type':Sequelize['STRING']},'deviceType':{'type':Sequelize['STRING']},'referer':{'type':Sequelize['TEXT']},'customerIp':{'type':Sequelize[_0x6880('0x5')]},'formData':{'type':Sequelize['TEXT']('long')},'read1stAt':{'type':Sequelize[_0x6880('0x6')]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize[_0x6880('0x3')]('in',_0x6880('0x7')),'defaultValue':'in','allowNull':![]},'closeReason':{'type':Sequelize[_0x6880('0x5')]},'customerPort':{'type':Sequelize['STRING']},'vidaooSessionId':{'type':Sequelize[_0x6880('0x4')]}}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.controller.js b/server/api/chatInteraction/chatInteraction.controller.js index 6d7bcb1..ec8a562 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 _0x7bd0=['ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','info','ChatInteraction,\x20%s,\x20%s','request\x20sent','ChatInteraction,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','sendStatus','end','status','json','count','offset','set','Content-Range','apply','save','destroy','stack','name','send','Users','map','fullname','TagIds','Tags','split','push','index','ChatInteraction','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','field','color','from','tools_tags','select','u.id','u.fullname','ui.ChatInteractionId','users','u.id\x20=\x20ui.UserId','chat_interactions','left_join','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','chat_messages','me.ChatInteractionId\x20=\x20i.id','chat_interaction_has_tags','it.ChatInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','search','parseSearch','conditions','unreadMessages','value','having','`\x20=\x200','`\x20>\x200','Contact','$substring','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','find','ContactId','forEach','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','User','UserId','buildExpression','text','start','body','some','compact','isEmpty','i.ChatWebsiteId\x20IN\x20?','concat','createdAt','parse','$gte','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','filter','replace','\x27\x27\x27\x27','i.id\x20LIKE\x20?','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','i.id','QueryTypes','SELECT','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','DESC','resolve','ChatWebsiteId','journey','i.ChatWebsiteId\x20IS\x20NOT\x20NULL','user','getChatWebsites','i.ChatWebsiteId\x20IS\x20NULL','sequelize','toString','keyBy','merge','Account.key','Account.mandatoryDisposition','i.*','c.firstName','Contact.firstName','c.lastName','Contact.lastName','c.email','c.phone','Contact.phone','c.mobile','Contact.mobile','o.fullname','Owner.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.ChatInteractionId\x20IN\x20?','groupBy','rows','show','params','include','options','describe','createVidaooSession','findOne','vidaooApiKey','vidaooEscalation','https://api-vidaoo.xcally.com/api/v1/sessions','follow','Error\x20in\x20Vidaoo\x20configuration','join_url','out','ChatMessage','create','Unable\x20to\x20create\x20Vidaoo\x20session','customUpdate','abandonInteraction,\x20%s,\x20%s,\x20%s','abandon','entity\x20not\x20found','disposition','file','originalname','basename','filename','mimetype','Attachment','closed','attachId','join','server/files/attachments/','mailTranscript','root','server/files/chat/upload/','format','now','pathTranscript','Messages','CmContact','%s%d','System','customer','Visitor','website_alias','agentAlias','agent_alias','alias','[%s]\x20%s:\x20%s\x0a','MM/DD/YYYY\x20HH:mm:ss','direction','secret','MailAccount','MailServerOut','Smtp','service','host','port','secure','authentication','auth','pass','SendMail','sendMail','\x22%s\x22\x20<%s>','Mail\x20Transcript','Hi\x20%s,\x20attached\x20you\x20can\x20find\x20your\x20transcript\x20file.\x20\x0a\x0aRegards.\x20\x0a\x0a','addMessage','ids','omit','getMessages','rawAttributes','ChatInteractionId','YYYY-MM-DD\x20HH:mm:ss','findAll','includeAgent','includeAll','setTags','spread','emit','chatInteractionTags:save','removeTags','download','unix','server','files','tmp','attachments','transcript-%d-%s.zip','firstName','lastName','Account','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','Owner','N.A.','closedAt','browserName','referer','customerIp','customerPort','tail','existsSync','createReadStream','pipe','createWriteStream','renderFile','views','downloadInteraction.html','toFile','transcript-','.pdf','err','unlinkSync','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','lodash','squel','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','./chatInteraction.socket','register','jayson/promise','client','http','test','Sequelize'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x7bd0,0x111));var _0x07bd=function(_0x568a61,_0x2124f8){_0x568a61=_0x568a61-0x0;var _0x334c3b=_0x7bd0[_0x568a61];return _0x334c3b;};'use strict';var pdf=require(_0x07bd('0x0'));var emlformat=require(_0x07bd('0x1'));var rimraf=require(_0x07bd('0x2'));var zipdir=require(_0x07bd('0x3'));var jsonpatch=require(_0x07bd('0x4'));var rp=require(_0x07bd('0x5'));var moment=require(_0x07bd('0x6'));var BPromise=require(_0x07bd('0x7'));var Mustache=require('mustache');var util=require(_0x07bd('0x8'));var path=require(_0x07bd('0x9'));var sox=require(_0x07bd('0xa'));var csv=require(_0x07bd('0xb'));var ejs=require(_0x07bd('0xc'));var fs=require('fs');var _=require(_0x07bd('0xd'));var squel=require(_0x07bd('0xe'));var crypto=require('crypto');var jsforce=require(_0x07bd('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x07bd('0xb'));var querystring=require(_0x07bd('0x10'));var Papa=require(_0x07bd('0x11'));var Redis=require('ioredis');var authService=require(_0x07bd('0x12'));var qs=require(_0x07bd('0x13'));var as=require(_0x07bd('0x14'));var hardwareService=require(_0x07bd('0x15'));var logger=require('../../config/logger')(_0x07bd('0x16'));var utils=require(_0x07bd('0x17'));var config=require(_0x07bd('0x18'));var db=require(_0x07bd('0x19'))['db'];config[_0x07bd('0x1a')]=_[_0x07bd('0x1b')](config[_0x07bd('0x1a')],{'host':_0x07bd('0x1c'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x07bd('0x1d'))[_0x07bd('0x1e')](socket);var jayson=require(_0x07bd('0x1f'));var client=jayson[_0x07bd('0x20')][_0x07bd('0x21')]({'port':0x232b});var client9004=jayson[_0x07bd('0x20')][_0x07bd('0x21')]({'port':0x232c});function checkPasswordPattern(_0x49d962,_0x418444,_0x505839){if(_0x505839){var _0x229bf1=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x229bf1[_0x07bd('0x22')](_0x418444)){return _0x49d962;}else{throw new db[(_0x07bd('0x23'))][(_0x07bd('0x24'))](_0x07bd('0x25'));}}else{return _0x49d962;}}function respondWithRpcPromise(_0x4929d6,_0x3f9f0b,_0xc4cf4c,_0x4948f4){return new BPromise(function(_0x3e8ec4,_0x72f775){var _0x758fd5=_0x4948f4||client;return _0x758fd5[_0x07bd('0x26')](_0x4929d6,_0xc4cf4c)[_0x07bd('0x27')](function(_0x109dbc){logger[_0x07bd('0x28')](_0x07bd('0x29'),_0x3f9f0b,_0x07bd('0x2a'));logger['debug'](_0x07bd('0x2b'),_0x3f9f0b,_0x07bd('0x2a'),JSON[_0x07bd('0x2c')](_0x109dbc));if(_0x109dbc[_0x07bd('0x2d')]){if(_0x109dbc[_0x07bd('0x2d')]['code']===0x1f4){logger['error'](_0x07bd('0x29'),_0x3f9f0b,_0x109dbc['error'][_0x07bd('0x2e')]);return _0x72f775(_0x109dbc['error']['message']);}logger[_0x07bd('0x2d')](_0x07bd('0x29'),_0x3f9f0b,_0x109dbc[_0x07bd('0x2d')][_0x07bd('0x2e')]);return _0x3e8ec4(_0x109dbc[_0x07bd('0x2d')][_0x07bd('0x2e')]);}else{logger['info'](_0x07bd('0x29'),_0x3f9f0b,_0x07bd('0x2a'));_0x3e8ec4(_0x109dbc[_0x07bd('0x2f')][_0x07bd('0x2e')]);}})[_0x07bd('0x30')](function(_0x1c1fda){logger['error']('ChatInteraction,\x20%s,\x20%s',_0x3f9f0b,_0x1c1fda);_0x72f775(_0x1c1fda);});});}function respondWithStatusCode(_0x5184dc,_0x335d61){_0x335d61=_0x335d61||0xcc;return function(_0xfa7566){if(_0xfa7566){return _0x5184dc[_0x07bd('0x31')](_0x335d61);}return _0x5184dc['status'](_0x335d61)[_0x07bd('0x32')]();};}function respondWithResult(_0x400cc0,_0x253dc0){_0x253dc0=_0x253dc0||0xc8;return function(_0x46ed12){if(_0x46ed12){return _0x400cc0[_0x07bd('0x33')](_0x253dc0)[_0x07bd('0x34')](_0x46ed12);}};}function respondWithFilteredResult(_0x58f189,_0xfc836f){return function(_0x20cc94){if(_0x20cc94){var _0x4182b9=_0x20cc94[_0x07bd('0x35')],_0x321200=_0xfc836f[_0x07bd('0x36')],_0x1b6cc=_0xfc836f['offset']+_0xfc836f['limit'],_0x314bda;if(_0x1b6cc>=_0x4182b9){_0x1b6cc=_0x4182b9;_0x314bda=0xc8;}else{_0x314bda=0xce;}_0x58f189[_0x07bd('0x33')](_0x314bda);return _0x58f189[_0x07bd('0x37')](_0x07bd('0x38'),_0x321200+'-'+_0x1b6cc+'/'+_0x4182b9)['json'](_0x20cc94);}return null;};}function patchUpdates(_0x31316e){return function(_0x2c8612){try{jsonpatch[_0x07bd('0x39')](_0x2c8612,_0x31316e,!![]);}catch(_0x5eb6ca){return BPromise['reject'](_0x5eb6ca);}return _0x2c8612[_0x07bd('0x3a')]();};}function saveUpdates(_0x185783,_0x71c030){return function(_0x22ed79){if(_0x22ed79){return _0x22ed79['update'](_0x185783)[_0x07bd('0x27')](function(_0x3b1d78){return _0x3b1d78;});}return null;};}function removeEntity(_0x1d6653,_0x4d12df){return function(_0x278afb){if(_0x278afb){return _0x278afb[_0x07bd('0x3b')]()['then'](function(){_0x1d6653[_0x07bd('0x33')](0xcc)[_0x07bd('0x32')]();});}};}function handleEntityNotFound(_0x204eb7,_0x354546){return function(_0x5cde8d){if(!_0x5cde8d){_0x204eb7['sendStatus'](0x194);}return _0x5cde8d;};}function handleError(_0x290e0f,_0x4e5e51){_0x4e5e51=_0x4e5e51||0x1f4;return function(_0x3c2878){logger[_0x07bd('0x2d')](_0x3c2878[_0x07bd('0x3c')]);if(_0x3c2878[_0x07bd('0x3d')]){delete _0x3c2878[_0x07bd('0x3d')];}_0x290e0f[_0x07bd('0x33')](_0x4e5e51)[_0x07bd('0x3e')](_0x3c2878);};}function getInteractionUsers(_0x333ac2,_0x4957fc){return new BPromise(function(_0x27b563,_0x9d843b){try{if(_0x4957fc[_0x333ac2['id']]){_0x333ac2[_0x07bd('0x3f')]=_[_0x07bd('0x40')](_0x4957fc[_0x333ac2['id']],function(_0x51e8e2){return{'id':_0x51e8e2['id'],'fullname':_0x51e8e2[_0x07bd('0x41')]};});}}catch(_0x2799c6){_0x9d843b(_0x2799c6);}_0x27b563(_0x333ac2);});}function getInteractionTags(_0x220a8e,_0x3e38d7){return new BPromise(function(_0x5d1b84,_0x2d2b71){try{if(_0x220a8e[_0x07bd('0x42')]){_0x220a8e[_0x07bd('0x43')]=[];_0x220a8e[_0x07bd('0x42')][_0x07bd('0x44')](',')['forEach'](function(_0x56b964){_0x220a8e[_0x07bd('0x43')][_0x07bd('0x45')](_0x3e38d7[_0x56b964]);});}delete _0x220a8e[_0x07bd('0x42')];}catch(_0x3d8936){_0x2d2b71(_0x3d8936);}_0x5d1b84(_0x220a8e);});}function updateChatInteraction(_0x5ec192,_0x9f9c4c,_0x2e1dcf){return new BPromise(function(_0x3de7d3,_0x6cdf23){return getInteractionUsers(_0x5ec192,_0x2e1dcf)[_0x07bd('0x27')](function(_0x2a08e3){return getInteractionTags(_0x2a08e3,_0x9f9c4c);})[_0x07bd('0x27')](function(_0x52f749){_0x3de7d3(_0x52f749);})[_0x07bd('0x30')](function(_0x7b1042){_0x6cdf23(_0x7b1042);});});}exports[_0x07bd('0x46')]=function(_0x3a5827,_0x418f26){var _0x4d43b1={},_0x243490={},_0x41a5d2={'count':0x0,'rows':[]};var _0x324cfc=_[_0x07bd('0x40')](db[_0x07bd('0x47')]['rawAttributes'],function(_0x14d4d8){return{'name':_0x14d4d8[_0x07bd('0x48')],'type':_0x14d4d8[_0x07bd('0x49')][_0x07bd('0x4a')]};});_0x243490['model']=_['map'](_0x324cfc,_0x07bd('0x3d'));_0x243490[_0x07bd('0x4b')]=_[_0x07bd('0x4c')](_0x3a5827[_0x07bd('0x4b')]);_0x243490[_0x07bd('0x4d')]=_[_0x07bd('0x4e')](_0x243490[_0x07bd('0x4f')],_0x243490[_0x07bd('0x4b')]);_0x4d43b1[_0x07bd('0x50')]=_['intersection'](_0x243490['model'],qs[_0x07bd('0x51')](_0x3a5827[_0x07bd('0x4b')][_0x07bd('0x51')]));_0x4d43b1[_0x07bd('0x50')]=_0x4d43b1[_0x07bd('0x50')][_0x07bd('0x52')]?_0x4d43b1['attributes']:_0x243490[_0x07bd('0x4f')];if(!_0x3a5827[_0x07bd('0x4b')][_0x07bd('0x53')](_0x07bd('0x54'))){_0x4d43b1[_0x07bd('0x55')]=qs[_0x07bd('0x55')](_0x3a5827['query'][_0x07bd('0x55')]);_0x4d43b1[_0x07bd('0x36')]=qs[_0x07bd('0x36')](_0x3a5827[_0x07bd('0x4b')][_0x07bd('0x36')]);}_0x4d43b1[_0x07bd('0x56')]=qs[_0x07bd('0x57')](_0x3a5827[_0x07bd('0x4b')][_0x07bd('0x57')]);_0x4d43b1[_0x07bd('0x58')]=qs[_0x07bd('0x4d')](_[_0x07bd('0x59')](_0x3a5827['query'],_0x243490[_0x07bd('0x4d')]),_0x324cfc);var _0x6db109=[];var _0x41dbe7=squel['select']()['field']('id')[_0x07bd('0x5a')]('name')[_0x07bd('0x5a')](_0x07bd('0x5b'))[_0x07bd('0x5c')](_0x07bd('0x5d'));var _0x2a8167=squel[_0x07bd('0x5e')]()[_0x07bd('0x5a')](_0x07bd('0x5f'))['field'](_0x07bd('0x60'))[_0x07bd('0x5a')](_0x07bd('0x61'))['from']('user_has_chat_interactions','ui')['left_join'](_0x07bd('0x62'),'u',_0x07bd('0x63'));var _0x12eae6=squel['select']()[_0x07bd('0x5c')](_0x07bd('0x64'),'i')[_0x07bd('0x65')](_0x07bd('0x66'),'c',_0x07bd('0x67'))[_0x07bd('0x65')]('users','o','o.id\x20=\x20i.UserId')[_0x07bd('0x65')]('chat_websites','a','a.id\x20=\x20i.ChatWebsiteId')[_0x07bd('0x65')](_0x07bd('0x68'),'me',_0x07bd('0x69'))['left_join'](_0x07bd('0x6a'),'it',_0x07bd('0x6b'))[_0x07bd('0x65')](_0x07bd('0x5d'),'t',_0x07bd('0x6c'));var _0x1a6df7=squel[_0x07bd('0x6d')]();var _0x248d6f=[];var _0x27ff6b=squel['expr']();var _0x38a9ef;if(_0x3a5827['query'][_0x07bd('0x6e')]){_0x38a9ef=as[_0x07bd('0x6f')](_0x3a5827[_0x07bd('0x4b')]['search']);var _0xc1d8b2=_0x38a9ef['sqlOperator'];for(var _0xc4f963=0x0;_0xc4f963<_0x38a9ef[_0x07bd('0x70')][_0x07bd('0x52')];_0xc4f963++){var _0xdde48d=_0x38a9ef['conditions'][_0xc4f963];var _0x5dc6f6='i';var _0x135e4e=_['find'](_0x324cfc,[_0x07bd('0x3d'),_0xdde48d[_0x07bd('0x5a')]]);if(!_0x135e4e){switch(_0xdde48d[_0x07bd('0x5a')]){case _0x07bd('0x71'):if(_0xdde48d[_0x07bd('0x72')]==0x1){_0x12eae6[_0x07bd('0x73')]('`'+_0xdde48d['field']+_0x07bd('0x74'));}else{_0x12eae6[_0x07bd('0x73')]('`'+_0xdde48d[_0x07bd('0x5a')]+_0x07bd('0x75'));}break;case _0x07bd('0x76'):if(_0xdde48d['operator']===_0x07bd('0x77')){if(_0xdde48d[_0x07bd('0x72')][_0x07bd('0x44')]('\x20')['length']>0x1){_0x1a6df7[_0xc1d8b2](_0x07bd('0x78'),qs['getFullTextValue'](_0xdde48d[_0x07bd('0x72')]),null);}else{var _0x46a22c='%'+_0xdde48d['value']+'%';_0x1a6df7[_0xc1d8b2]('c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?',_0x46a22c,_0x46a22c,_0x46a22c);}}else{_0x135e4e=_[_0x07bd('0x79')](_0x324cfc,[_0x07bd('0x3d'),_0x07bd('0x7a')]);_0xdde48d[_0x07bd('0x5a')]=_0x07bd('0x7a');_0x4b4264=as['buildExpression'](_0x5dc6f6,_0x135e4e[_0x07bd('0x49')],_0xdde48d);_0x1a6df7[_0xc1d8b2](_0x4b4264['text'],_0x4b4264[_0x07bd('0x72')]['start'],_0x4b4264[_0x07bd('0x72')]['end']);}break;case'Tag':var _0x3b3331=_0xdde48d[_0x07bd('0x72')][_0x07bd('0x44')](',')[_0x07bd('0x40')](function(_0x475039){return Number(_0x475039);});_0x3b3331[_0x07bd('0x7b')](function(_0x2045d9){_0x27ff6b['or'](_0x07bd('0x7c'),'%,'+_0x2045d9+',%');});_0x248d6f=_[_0x07bd('0x7d')](_0x248d6f,_0x3b3331);break;case _0x07bd('0x7e'):if(_0xdde48d['operator']===_0x07bd('0x77')){_0x1a6df7[_0xc1d8b2]('CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','%'+_0xdde48d[_0x07bd('0x72')]+'%',null);}else{_0x135e4e=_[_0x07bd('0x79')](_0x324cfc,[_0x07bd('0x3d'),'UserId']);_0xdde48d[_0x07bd('0x5a')]=_0x07bd('0x7f');_0x4b4264=as[_0x07bd('0x80')](_0x5dc6f6,_0x135e4e[_0x07bd('0x49')],_0xdde48d);_0x1a6df7[_0xc1d8b2](_0x4b4264[_0x07bd('0x81')],_0x4b4264[_0x07bd('0x72')][_0x07bd('0x82')],_0x4b4264['value'][_0x07bd('0x32')]);}break;case _0x07bd('0x83'):_0x4b4264=as[_0x07bd('0x80')]('me',null,_0xdde48d);_0x1a6df7[_0xc1d8b2](_0x4b4264['text'],_0x4b4264[_0x07bd('0x72')][_0x07bd('0x82')],_0x4b4264[_0x07bd('0x72')][_0x07bd('0x32')]);break;}}else{var _0x4b4264=as[_0x07bd('0x80')](_0x5dc6f6,_0x135e4e[_0x07bd('0x49')],_0xdde48d);_0x1a6df7[_0xc1d8b2](_0x4b4264[_0x07bd('0x81')],_0x4b4264[_0x07bd('0x72')]['start'],_0x4b4264[_0x07bd('0x72')]['end']);}}}else{var _0x2749c3=_(_0x3a5827[_0x07bd('0x4b')])[_0x07bd('0x4c')]()[_0x07bd('0x40')](function(_0x5be4ef){return _[_0x07bd('0x84')](_0x324cfc,[_0x07bd('0x3d'),_0x5be4ef])?_0x5be4ef:undefined;})[_0x07bd('0x85')]()[_0x07bd('0x72')]();if(!_[_0x07bd('0x86')](_0x2749c3)){_0x2749c3[_0x07bd('0x7b')](function(_0x2b3cbb){if(_0x2b3cbb==='ChatWebsiteId'){_0x12eae6[_0x07bd('0x58')](_0x07bd('0x87'),[][_0x07bd('0x88')](_0x3a5827[_0x07bd('0x4b')][_0x2b3cbb]));}else if(_0x2b3cbb===_0x07bd('0x89')){var _0x4d1c79=JSON[_0x07bd('0x8a')](_0x3a5827[_0x07bd('0x4b')][_0x2b3cbb])[_0x07bd('0x8b')];var _0x50aad3=JSON[_0x07bd('0x8a')](_0x3a5827[_0x07bd('0x4b')][_0x2b3cbb])[_0x07bd('0x8c')];_0x12eae6[_0x07bd('0x58')](_0x07bd('0x8d'),_0x4d1c79,_0x50aad3);}else{if(_0x3a5827['query'][_0x2b3cbb]==='null'){_0x12eae6[_0x07bd('0x58')]('i.'+_0x2b3cbb+_0x07bd('0x8e'));}else{_0x12eae6[_0x07bd('0x58')]('i.'+_0x2b3cbb+_0x07bd('0x8f'),_0x3a5827[_0x07bd('0x4b')][_0x2b3cbb]);}}});}if(_0x3a5827[_0x07bd('0x4b')][_0x07bd('0x90')]){if(_0x3a5827[_0x07bd('0x4b')][_0x07bd('0x90')]==0x1){_0x12eae6['having'](_0x07bd('0x91'));}else{_0x12eae6[_0x07bd('0x73')](_0x07bd('0x92'));}}if(_0x3a5827[_0x07bd('0x4b')][_0x07bd('0x93')]){_0x248d6f=_['isArray'](_0x3a5827[_0x07bd('0x4b')]['tag'])?_0x3a5827[_0x07bd('0x4b')][_0x07bd('0x93')]:new Array(_0x3a5827['query'][_0x07bd('0x93')]);_0x248d6f['forEach'](function(_0x4a79c6){_0x27ff6b['or'](_0x07bd('0x7c'),'%,'+_0x4a79c6+',%');});}if(_0x3a5827[_0x07bd('0x4b')][_0x07bd('0x94')]){var _0x30f02a=_0x3a5827[_0x07bd('0x4b')]['filter'][_0x07bd('0x95')]('\x5c','\x5c\x5c')[_0x07bd('0x95')]('\x27\x27',_0x07bd('0x96'));if(qs['isNumeric'](_0x30f02a)){_0x1a6df7['or'](_0x07bd('0x97'),_0x30f02a+'%');}else{_0x1a6df7['or'](_0x07bd('0x98'),qs['getFullTextValue'](_0x30f02a))['or'](_0x07bd('0x99'),_0x30f02a+'%');}}}_0x12eae6[_0x07bd('0x58')](_0x1a6df7);_0x12eae6['group'](_0x07bd('0x9a'));var _0x2c3b85={'type':db[_0x07bd('0x23')][_0x07bd('0x9b')][_0x07bd('0x9c')],'raw':!![]};var _0x3d1275=_0x12eae6[_0x07bd('0x9d')]();_0x3d1275[_0x07bd('0x5a')]('i.id');_0x3d1275[_0x07bd('0x5a')](_0x07bd('0x9e'),'unreadMessages');if(_0x4d43b1[_0x07bd('0x56')]){_0x4d43b1[_0x07bd('0x56')][_0x07bd('0x7b')](function(_0x7d85c2){_0x12eae6['order']('i.'+_0x7d85c2[0x0],_0x7d85c2[0x1]===_0x07bd('0x9f')?![]:!![]);});}if(!_[_0x07bd('0x86')](_0x248d6f)){_0x12eae6[_0x07bd('0x73')](_0x27ff6b);_0x3d1275[_0x07bd('0x58')]('t.id\x20IN\x20?',_0x248d6f);}BPromise[_0x07bd('0xa0')]()[_0x07bd('0x27')](function(){if(!_0x38a9ef){if(_0x3a5827[_0x07bd('0x4b')][_0x07bd('0xa1')]||_0x3a5827[_0x07bd('0x4b')][_0x07bd('0xa2')])return;_0x3d1275[_0x07bd('0x58')](_0x07bd('0xa3'));_0x12eae6[_0x07bd('0x58')](_0x07bd('0xa3'));return;}return _0x3a5827[_0x07bd('0xa4')][_0x07bd('0xa5')]({'attributes':['id'],'raw':!![]})[_0x07bd('0x27')](function(_0x3cd40c){if(_[_0x07bd('0x86')](_0x3cd40c)){_0x3d1275[_0x07bd('0x58')](_0x07bd('0xa6'));_0x12eae6[_0x07bd('0x58')]('i.ChatWebsiteId\x20IS\x20NULL');}else{_0x3d1275[_0x07bd('0x58')](_0x07bd('0x87'),_[_0x07bd('0x40')](_0x3cd40c,'id'));_0x12eae6[_0x07bd('0x58')](_0x07bd('0x87'),_[_0x07bd('0x40')](_0x3cd40c,'id'));}});})[_0x07bd('0x27')](function(){db[_0x07bd('0xa7')][_0x07bd('0x4b')](_0x3d1275[_0x07bd('0xa8')](),_0x2c3b85)['then'](function(_0x289d10){_0x41a5d2[_0x07bd('0x35')]=_0x289d10[_0x07bd('0x52')];if(_0x41a5d2[_0x07bd('0x35')]===0x0)return[];return db[_0x07bd('0xa7')][_0x07bd('0x4b')](_0x41dbe7[_0x07bd('0xa8')](),_0x2c3b85)[_0x07bd('0x27')](function(_0x1b3c8b){_0x6db109=_[_0x07bd('0xa9')](_0x1b3c8b,'id');_0x2c3b85=_[_0x07bd('0xaa')](_0x2c3b85,{'model':db[_0x07bd('0x47')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x3a5827[_0x07bd('0x4b')][_0x07bd('0x51')]){_0x4d43b1[_0x07bd('0x50')][_0x07bd('0x7b')](function(_0x28b036){_0x12eae6[_0x07bd('0x5a')]('i.'+_0x28b036);});}else{_0x12eae6[_0x07bd('0x5a')](_0x07bd('0x9e'),_0x07bd('0x71'));_0x12eae6[_0x07bd('0x5a')]('a.key',_0x07bd('0xab'));_0x12eae6[_0x07bd('0x5a')]('a.mandatoryDisposition',_0x07bd('0xac'));_0x12eae6['field'](_0x07bd('0xad'));_0x12eae6['field'](_0x07bd('0xae'),_0x07bd('0xaf'));_0x12eae6['field'](_0x07bd('0xb0'),_0x07bd('0xb1'));_0x12eae6['field'](_0x07bd('0xb2'),'Contact.email');_0x12eae6[_0x07bd('0x5a')](_0x07bd('0xb3'),_0x07bd('0xb4'));_0x12eae6[_0x07bd('0x5a')](_0x07bd('0xb5'),_0x07bd('0xb6'));_0x12eae6[_0x07bd('0x5a')]('c.fax','Contact.fax');_0x12eae6[_0x07bd('0x5a')](_0x07bd('0xb7'),_0x07bd('0xb8'));_0x12eae6[_0x07bd('0x5a')](_0x07bd('0xb9'),_0x07bd('0xba'));_0x12eae6['field'](_0x07bd('0xbb'),'TagIds');}if(_0x4d43b1[_0x07bd('0x55')])_0x12eae6['limit'](_0x4d43b1[_0x07bd('0x55')]);if(_0x4d43b1[_0x07bd('0x36')])_0x12eae6[_0x07bd('0x36')](_0x4d43b1[_0x07bd('0x36')]);return db[_0x07bd('0xa7')]['query'](_0x12eae6[_0x07bd('0xa8')](),_0x2c3b85);})[_0x07bd('0x27')](function(_0x145647){_0x2a8167[_0x07bd('0x58')](_0x07bd('0xbc'),_[_0x07bd('0x40')](_0x145647,'id'));return db[_0x07bd('0xa7')][_0x07bd('0x4b')](_0x2a8167[_0x07bd('0xa8')](),_0x2c3b85)['then'](function(_0x95eeb8){var _0x3ca8ed=_[_0x07bd('0xbd')](_0x95eeb8,'ChatInteractionId');var _0x234fb4=[];_0x145647[_0x07bd('0x7b')](function(_0xb0923c){_0x234fb4[_0x07bd('0x45')](updateChatInteraction(_0xb0923c,_0x6db109,_0x3ca8ed));});return BPromise['all'](_0x234fb4);});});})[_0x07bd('0x27')](function(_0x337d52){_0x41a5d2[_0x07bd('0xbe')]=_0x337d52;return _0x41a5d2;})[_0x07bd('0x27')](respondWithFilteredResult(_0x418f26,_0x4d43b1));})['catch'](handleError(_0x418f26,null));};exports[_0x07bd('0xbf')]=function(_0x3466cc,_0x12c7c2){var _0x4e1abc={'raw':![],'where':{'id':_0x3466cc[_0x07bd('0xc0')]['id']}},_0x1797d1={};_0x1797d1[_0x07bd('0x4f')]=_[_0x07bd('0x4c')](db['ChatInteraction']['rawAttributes']);_0x1797d1[_0x07bd('0x4b')]=_[_0x07bd('0x4c')](_0x3466cc[_0x07bd('0x4b')]);_0x1797d1[_0x07bd('0x4d')]=_[_0x07bd('0x4e')](_0x1797d1[_0x07bd('0x4f')],_0x1797d1[_0x07bd('0x4b')]);_0x4e1abc['attributes']=_['intersection'](_0x1797d1[_0x07bd('0x4f')],qs['fields'](_0x3466cc[_0x07bd('0x4b')][_0x07bd('0x51')]));_0x4e1abc['attributes']=_0x4e1abc[_0x07bd('0x50')][_0x07bd('0x52')]?_0x4e1abc[_0x07bd('0x50')]:_0x1797d1[_0x07bd('0x4f')];if(_0x3466cc['query']['includeAll']){_0x4e1abc[_0x07bd('0xc1')]=[{'all':!![]}];}_0x4e1abc=_[_0x07bd('0xaa')]({},_0x4e1abc,_0x3466cc[_0x07bd('0xc2')]);return db[_0x07bd('0x47')][_0x07bd('0x79')](_0x4e1abc)[_0x07bd('0x27')](handleEntityNotFound(_0x12c7c2,null))[_0x07bd('0x27')](respondWithResult(_0x12c7c2,null))[_0x07bd('0x30')](handleError(_0x12c7c2,null));};exports['create']=function(_0x3d7f09,_0x582d88){return db[_0x07bd('0x47')]['create'](_0x3d7f09[_0x07bd('0x83')],{})[_0x07bd('0x27')](respondWithResult(_0x582d88,0xc9))[_0x07bd('0x30')](handleError(_0x582d88,null));};exports['update']=function(_0x3be757,_0x1777f9){if(_0x3be757['body']['id']){delete _0x3be757[_0x07bd('0x83')]['id'];}return db[_0x07bd('0x47')][_0x07bd('0x79')]({'where':{'id':_0x3be757[_0x07bd('0xc0')]['id']}})['then'](handleEntityNotFound(_0x1777f9,null))[_0x07bd('0x27')](saveUpdates(_0x3be757[_0x07bd('0x83')],null))[_0x07bd('0x27')](respondWithResult(_0x1777f9,null))[_0x07bd('0x30')](handleError(_0x1777f9,null));};exports[_0x07bd('0x3b')]=function(_0x488daf,_0x18d46b){return db['ChatInteraction'][_0x07bd('0x79')]({'where':{'id':_0x488daf['params']['id']}})[_0x07bd('0x27')](handleEntityNotFound(_0x18d46b,null))[_0x07bd('0x27')](removeEntity(_0x18d46b,null))[_0x07bd('0x30')](handleError(_0x18d46b,null));};exports[_0x07bd('0xc3')]=function(_0x1ca64f,_0x5137ec){return db[_0x07bd('0x47')]['describe']()[_0x07bd('0x27')](respondWithResult(_0x5137ec,null))['catch'](handleError(_0x5137ec,null));};exports[_0x07bd('0xc4')]=function(_0x2e5df4,_0x7e6b24){var _0x3f37e8=_0x2e5df4[_0x07bd('0xc0')]['id'];var _0x5a6eea;var _0x34e9dc;var _0x7c54d5;return db[_0x07bd('0x47')][_0x07bd('0xc5')]({'where':{'id':_0x3f37e8}})[_0x07bd('0x27')](function(_0x394670){_0x5a6eea=_0x394670;return db['ChatWebsite'][_0x07bd('0xc5')]({'where':{'id':_0x394670['ChatWebsiteId']},'attributes':['id',_0x07bd('0xc6'),_0x07bd('0xc7')],'raw':!![]});})['then'](function(_0x4ca3e1){if(_0x4ca3e1&&_0x4ca3e1[_0x07bd('0xc6')]&&_0x4ca3e1[_0x07bd('0xc7')]){_0x34e9dc=_0x4ca3e1;var _0x5f4d04={'rejectUnauthorized':![],'method':'POST','uri':_0x07bd('0xc8'),'headers':{'X-APIKEY':_0x4ca3e1[_0x07bd('0xc6')]},'body':{'name':'MotionCWB:'+_0x3f37e8},'redirect':_0x07bd('0xc9'),'json':!![]};return rp(_0x5f4d04);}else{throw new db[(_0x07bd('0x23'))][(_0x07bd('0x24'))](_0x07bd('0xca'));}})['then'](function(_0x198e27){_0x7c54d5=_0x198e27;if(_0x7c54d5['id']){var _0x1a6fa6={'body':_0x7c54d5[_0x07bd('0xcb')],'ChatWebsiteId':_0x34e9dc['id'],'ChatInteractionId':_0x5a6eea['id'],'direction':_0x07bd('0xcc'),'UserId':_0x2e5df4['user']['id']};return db[_0x07bd('0xcd')][_0x07bd('0xce')](_0x1a6fa6,{});}else{throw new db[(_0x07bd('0x23'))][(_0x07bd('0x24'))](_0x07bd('0xcf'));}})[_0x07bd('0x27')](function(){return _0x5a6eea['updateAttributes']({'vidaooSessionId':_0x7c54d5['id']});})[_0x07bd('0x27')](respondWithResult(_0x7e6b24,null))[_0x07bd('0x30')](handleError(_0x7e6b24,null));};exports[_0x07bd('0xd0')]=function(_0x314211,_0x3da905){if(_0x314211[_0x07bd('0x83')]['id']){delete _0x314211[_0x07bd('0x83')]['id'];}return db['ChatInteraction'][_0x07bd('0x79')]({'where':{'id':_0x314211[_0x07bd('0xc0')]['id']}})[_0x07bd('0x27')](handleEntityNotFound(_0x3da905,null))['then'](saveUpdates(_0x314211[_0x07bd('0x83')],null))[_0x07bd('0x27')](respondWithResult(_0x3da905,null))[_0x07bd('0x30')](handleError(_0x3da905,null));};exports['abandon']=function(_0x433ded,_0xfec700,_0x6cad7e){if(_0x433ded[_0x07bd('0x83')]['id']){delete _0x433ded[_0x07bd('0x83')]['id'];}return db[_0x07bd('0x47')][_0x07bd('0x79')]({'where':{'id':_0x433ded[_0x07bd('0xc0')]['id']}})[_0x07bd('0x27')](function(_0x2c20a3){if(!_0x2c20a3){logger[_0x07bd('0x2d')](_0x07bd('0xd1'),_0x07bd('0xd2'),0x194,_0x07bd('0xd3'));_0xfec700['sendStatus'](0x194);}else{if(_0x2c20a3[_0x07bd('0x7f')]){throw new db['Sequelize']['ValidationError']('Interaction\x20already\x20assigned');}}return _0x2c20a3;})[_0x07bd('0x27')](function(_0x2beefe){if(_0x2beefe){return _0x2beefe['update']({'closed':_0x433ded[_0x07bd('0x83')]['closed'],'disposition':_0x433ded['body'][_0x07bd('0xd4')]})[_0x07bd('0x27')](function(_0x510b6e){return _0x510b6e;});}})[_0x07bd('0x27')](function(_0x519101){return respondWithRpcPromise('AbandonInteraction','abandon',_0x433ded[_0x07bd('0x83')],client9004);})['then'](respondWithResult(_0xfec700,null))[_0x07bd('0x30')](handleError(_0xfec700,null));};exports['attachmentUpload']=function(_0x5e39ff,_0x2bef09,_0x5558a7){_0x5e39ff[_0x07bd('0x83')][_0x07bd('0x3d')]=_0x5e39ff[_0x07bd('0xd5')][_0x07bd('0xd6')];_0x5e39ff[_0x07bd('0x83')][_0x07bd('0xd7')]=_0x5e39ff[_0x07bd('0xd5')][_0x07bd('0xd8')];_0x5e39ff['body']['type']=_0x5e39ff[_0x07bd('0xd5')][_0x07bd('0xd9')];return db[_0x07bd('0xda')]['create'](_0x5e39ff[_0x07bd('0x83')])[_0x07bd('0x27')](respondWithResult(_0x2bef09,0xc9))['catch'](handleError(_0x2bef09,null));};exports['attachmentDownload']=function(_0x4e26ca,_0x8695ca,_0x3133aa){return db[_0x07bd('0x47')]['findOne']({'where':{'id':_0x4e26ca['params']['id']},'raw':!![]})[_0x07bd('0x27')](handleEntityNotFound(_0x8695ca,null))['then'](function(_0x401076){if(_0x401076){if(_0x401076[_0x07bd('0xdb')]){return _0x8695ca['status'](0x193)['json']({'status':0x193,'message':'Unauthorized'});}return db[_0x07bd('0xda')]['findOne']({'where':{'id':_0x4e26ca[_0x07bd('0x4b')][_0x07bd('0xdc')]},'raw':!![]})[_0x07bd('0x27')](handleEntityNotFound(_0x8695ca,null));}})[_0x07bd('0x27')](function(_0x55405e){if(_0x55405e){return _0x8695ca['download'](path[_0x07bd('0xdd')](config['root'],_0x07bd('0xde'),_0x55405e['basename']));}})[_0x07bd('0x30')](handleError(_0x8695ca,null));};exports['close']=function(_0x48263c,_0x91b210){var _0x303e33=null;var _0x53d9d0=null;var _0x382ebc=null;var _0x4f669c=null;if(_0x48263c['body']['id']){delete _0x48263c['body']['id'];}if(_0x48263c['body'][_0x07bd('0xdf')]){_0x4f669c=path[_0x07bd('0xdd')](config[_0x07bd('0xe0')],_0x07bd('0xe1'),util[_0x07bd('0xe2')]('transcript-%s.txt',Date[_0x07bd('0xe3')]()));_0x48263c[_0x07bd('0x83')][_0x07bd('0xe4')]=_0x4f669c;}return db[_0x07bd('0x47')][_0x07bd('0x79')]({'where':{'id':_0x48263c[_0x07bd('0xc0')]['id']},'include':[{'model':db['ChatMessage'],'as':_0x07bd('0xe5'),'include':[{'model':db[_0x07bd('0x7e')],'as':_0x07bd('0x7e')}]}]})[_0x07bd('0x27')](handleEntityNotFound(_0x91b210,null))[_0x07bd('0x27')](saveUpdates(_0x48263c[_0x07bd('0x83')],null))[_0x07bd('0x27')](function(_0x3084fe){if(_0x3084fe){_0x303e33=_0x3084fe;return db['ChatWebsite'][_0x07bd('0x79')]({'where':{'id':_0x303e33[_0x07bd('0xa1')]}});}})[_0x07bd('0x27')](function(_0x4884a8){if(_0x4884a8){_0x382ebc=_0x4884a8;return db[_0x07bd('0xe6')][_0x07bd('0x79')]({'where':{'id':_0x303e33[_0x07bd('0x7a')]}});}})[_0x07bd('0x27')](function(_0xda0a0d){if(_0xda0a0d){_0x53d9d0=_0xda0a0d;if(_0x4f669c){var _0x3206ce=null;for(var _0x45a5d7=0x1;_0x45a5d7<_0x303e33[_0x07bd('0xe5')][_0x07bd('0x52')];++_0x45a5d7){_0x3206ce=_0x303e33['Messages'][_0x45a5d7];var _0x5dceb4=_0x3206ce[_0x07bd('0x7f')]?util[_0x07bd('0xe2')](_0x07bd('0xe7'),_0x382ebc['agentAlias'],_0x3206ce['UserId']):_0x07bd('0xe8');var _0x4be9df=_0x48263c['body'][_0x07bd('0xe9')]||util[_0x07bd('0xe2')](_0x07bd('0xe7'),_0x07bd('0xea'),_0x3206ce['ContactId']);switch(_0x382ebc['agentIdentifier']){case _0x07bd('0xeb'):_0x5dceb4=_0x3206ce[_0x07bd('0x7f')]?util[_0x07bd('0xe2')](_0x07bd('0xe7'),_0x382ebc[_0x07bd('0xec')],_0x3206ce[_0x07bd('0x7f')]):_0x07bd('0xe8');break;case _0x07bd('0xed'):_0x5dceb4=_0x3206ce[_0x07bd('0x7f')]?_0x3206ce[_0x07bd('0x7e')][_0x07bd('0xee')]||_0x3206ce[_0x07bd('0x7e')]['fullname']:_0x07bd('0xe8');break;case'agent_fullname':_0x5dceb4=_0x3206ce['UserId']?_0x3206ce[_0x07bd('0x7e')][_0x07bd('0x41')]:'System';break;default:_0x5dceb4=_0x3206ce[_0x07bd('0x7f')]?util['format'](_0x07bd('0xe7'),_0x382ebc[_0x07bd('0xec')],_0x3206ce[_0x07bd('0x7f')]):_0x07bd('0xe8');}var _0x2f8086=util[_0x07bd('0xe2')](_0x07bd('0xef'),moment(_0x3206ce[_0x07bd('0x89')])[_0x07bd('0xe2')](_0x07bd('0xf0')),_0x3206ce[_0x07bd('0xf1')]==='in'?_0x4be9df:_0x5dceb4,_0x3206ce[_0x07bd('0x83')]);if(!_0x3206ce[_0x07bd('0xf2')]){fs['appendFileSync'](_0x4f669c,_0x2f8086);}}return db[_0x07bd('0xf3')]['findOne']({'where':{'service':!![]},'include':[{'model':db[_0x07bd('0xf4')],'as':_0x07bd('0xf5'),'raw':!![]}]});}}})[_0x07bd('0x27')](function(_0x17262a){if(_0x17262a&&_0x17262a[_0x07bd('0xf5')]&&_0x48263c[_0x07bd('0x83')]){var _0x49ea11={'tls':{'rejectUnauthorized':![]}};if(_0x17262a[_0x07bd('0xf5')][_0x07bd('0xf6')]){_0x49ea11[_0x07bd('0xf6')]=_0x17262a[_0x07bd('0xf5')][_0x07bd('0xf6')];}else{_0x49ea11[_0x07bd('0xf7')]=_0x17262a['Smtp'][_0x07bd('0xf7')];_0x49ea11[_0x07bd('0xf8')]=_0x17262a['Smtp'][_0x07bd('0xf8')];_0x49ea11[_0x07bd('0xf9')]=_0x17262a[_0x07bd('0xf5')][_0x07bd('0xf9')];}if(_0x17262a['Smtp'][_0x07bd('0xfa')]){_0x49ea11[_0x07bd('0xfb')]={'user':_0x17262a['Smtp'][_0x07bd('0xa4')],'pass':_0x17262a[_0x07bd('0xf5')][_0x07bd('0xfc')]};}return respondWithRpcPromise(_0x07bd('0xfd'),_0x07bd('0xfe'),{'account':_0x49ea11,'message':{'from':util[_0x07bd('0xe2')](_0x07bd('0xff'),_0x17262a[_0x07bd('0x3d')],_0x17262a['email']||_0x17262a[_0x07bd('0xf5')][_0x07bd('0xa4')]),'to':_0x48263c[_0x07bd('0x83')]['mailTranscript'],'subject':_0x07bd('0x100'),'text':util[_0x07bd('0xe2')](_0x07bd('0x101'),_0x48263c[_0x07bd('0x83')]['mailTranscript']),'attachments':[{'path':_0x4f669c}]}})[_0x07bd('0x27')](function(){return _0x303e33;})[_0x07bd('0x30')](function(_0x3989f0){console[_0x07bd('0x2d')](_0x3989f0);});}else{return _0x303e33;}})[_0x07bd('0x27')](respondWithStatusCode(_0x91b210,0xc8))[_0x07bd('0x30')](handleError(_0x91b210,null));};exports[_0x07bd('0x102')]=function(_0x58b380,_0x17a4c4,_0x555142){return db['ChatMessage'][_0x07bd('0x79')]({'where':{'id':_0x58b380[_0x07bd('0xc0')]['id']}})[_0x07bd('0x27')](handleEntityNotFound(_0x17a4c4,null))['then'](function(_0x51caf9){if(_0x51caf9){return _0x51caf9['addMessage'](_0x58b380[_0x07bd('0x83')][_0x07bd('0x103')],_[_0x07bd('0x104')](_0x58b380['body'],[_0x07bd('0x103'),'id'])||{});}})[_0x07bd('0x27')](respondWithResult(_0x17a4c4,null))['catch'](handleError(_0x17a4c4,null));};exports[_0x07bd('0x105')]=function(_0x5415fb,_0x16217a,_0x59e629){var _0x3fbdc5={'raw':![],'where':{}};var _0x53a683={};var _0xd48416={'count':0x0,'rows':[]};return db[_0x07bd('0x47')][_0x07bd('0xc5')]({'where':{'id':_0x5415fb['params']['id']}})[_0x07bd('0x27')](handleEntityNotFound(_0x16217a,null))[_0x07bd('0x27')](function(_0x124ce6){if(_0x124ce6){_0x53a683[_0x07bd('0x4f')]=_[_0x07bd('0x4c')](db[_0x07bd('0xcd')][_0x07bd('0x106')]);_0x53a683[_0x07bd('0x4b')]=_[_0x07bd('0x4c')](_0x5415fb[_0x07bd('0x4b')]);_0x53a683['filters']=_[_0x07bd('0x4e')](_0x53a683[_0x07bd('0x4f')],_0x53a683[_0x07bd('0x4b')]);_0x3fbdc5[_0x07bd('0x50')]=_[_0x07bd('0x4e')](_0x53a683[_0x07bd('0x4f')],qs[_0x07bd('0x51')](_0x5415fb[_0x07bd('0x4b')][_0x07bd('0x51')]));_0x3fbdc5[_0x07bd('0x50')]=_0x3fbdc5[_0x07bd('0x50')]['length']?_0x3fbdc5['attributes']:_0x53a683[_0x07bd('0x4f')];if(!_0x5415fb[_0x07bd('0x4b')][_0x07bd('0x53')]('nolimit')){_0x3fbdc5['limit']=qs[_0x07bd('0x55')](_0x5415fb[_0x07bd('0x4b')][_0x07bd('0x55')]);_0x3fbdc5[_0x07bd('0x36')]=qs['offset'](_0x5415fb['query'][_0x07bd('0x36')]);}_0x3fbdc5[_0x07bd('0x56')]=qs[_0x07bd('0x57')](_0x5415fb[_0x07bd('0x4b')][_0x07bd('0x57')]);_0x3fbdc5[_0x07bd('0x58')]=qs['filters'](_['pick'](_0x5415fb['query'],_0x53a683[_0x07bd('0x4d')]));_0x3fbdc5[_0x07bd('0x58')][_0x07bd('0x107')]=_0x124ce6['id'];if(_0x5415fb['query'][_0x07bd('0x94')]){_0x3fbdc5['where']=_[_0x07bd('0xaa')](_0x3fbdc5[_0x07bd('0x58')],{'$or':_['map'](_0x3fbdc5[_0x07bd('0x50')],function(_0x16714a){var _0x3b41b7={};_0x3b41b7[_0x16714a]={'$like':'%'+_0x5415fb[_0x07bd('0x4b')][_0x07bd('0x94')]+'%'};return _0x3b41b7;})});}if(_0x5415fb[_0x07bd('0x4b')][_0x07bd('0x8b')]){var _0x109536=_0x5415fb[_0x07bd('0x4b')][_0x07bd('0x8b')]['split'](',');var _0x49b2d6={};_0x49b2d6[_0x109536[0x0]]={'$gte':moment(_0x109536[0x1])[_0x07bd('0xe2')](_0x07bd('0x108'))};_0x3fbdc5[_0x07bd('0x58')]=_[_0x07bd('0xaa')](_0x3fbdc5['where'],_0x49b2d6);}_0x3fbdc5=_[_0x07bd('0xaa')]({},_0x3fbdc5,_0x5415fb[_0x07bd('0xc2')]);return db[_0x07bd('0xcd')][_0x07bd('0x35')]({'where':_0x3fbdc5[_0x07bd('0x58')]})['then'](function(_0x3dd7df){_0xd48416[_0x07bd('0x35')]=_0x3dd7df;if(_0x5415fb[_0x07bd('0x4b')]['includeAll']){_0x3fbdc5['include']=[{'all':!![]}];}return db['ChatMessage'][_0x07bd('0x109')](_0x3fbdc5);})[_0x07bd('0x27')](function(_0x130188){_0xd48416[_0x07bd('0xbe')]=_0x130188;return _0xd48416;});}})[_0x07bd('0x27')](respondWithFilteredResult(_0x16217a,_0x3fbdc5))[_0x07bd('0x30')](handleError(_0x16217a,null));};exports['getMyMessages']=function(_0x3d3e16,_0x2cb7d5,_0x521183){var _0x338a8b={'where':{}},_0x47b90f={},_0x47c2ee={'count':0x0,'rows':[]};return db[_0x07bd('0x47')][_0x07bd('0xc5')]({'where':{'id':_0x3d3e16[_0x07bd('0xc0')]['id']}})['then'](handleEntityNotFound(_0x2cb7d5,null))[_0x07bd('0x27')](function(_0x3e5b03){if(_0x3e5b03){_0x47b90f['model']=_['keys'](db[_0x07bd('0xcd')][_0x07bd('0x106')]);_0x47b90f[_0x07bd('0x4b')]=_['keys'](_0x3d3e16[_0x07bd('0x4b')]);_0x47b90f[_0x07bd('0x4d')]=_['intersection'](_0x47b90f[_0x07bd('0x4f')],_0x47b90f['query']);_0x338a8b[_0x07bd('0x50')]=_['intersection'](_0x47b90f[_0x07bd('0x4f')],qs[_0x07bd('0x51')](_0x3d3e16[_0x07bd('0x4b')][_0x07bd('0x51')]));_0x338a8b['attributes']=_0x338a8b[_0x07bd('0x50')][_0x07bd('0x52')]?_0x338a8b[_0x07bd('0x50')]:_0x47b90f[_0x07bd('0x4f')];if(!_0x3d3e16[_0x07bd('0x4b')]['hasOwnProperty']('nolimit')){_0x338a8b[_0x07bd('0x55')]=qs[_0x07bd('0x55')](_0x3d3e16['query']['limit']);_0x338a8b['offset']=qs[_0x07bd('0x36')](_0x3d3e16[_0x07bd('0x4b')][_0x07bd('0x36')]);}_0x338a8b['order']=qs[_0x07bd('0x57')](_0x3d3e16[_0x07bd('0x4b')]['sort']);_0x338a8b[_0x07bd('0x58')]=qs[_0x07bd('0x4d')](_[_0x07bd('0x59')](_0x3d3e16['query'],_0x47b90f[_0x07bd('0x4d')]));_0x338a8b[_0x07bd('0x58')][_0x07bd('0x107')]=_0x3e5b03['id'];if(_0x3d3e16[_0x07bd('0x4b')][_0x07bd('0x94')]){_0x338a8b[_0x07bd('0x58')]=_['merge'](_0x338a8b['where'],{'$or':_[_0x07bd('0x40')](_0x338a8b[_0x07bd('0x50')],function(_0x44470e){var _0x1c18f6={};_0x1c18f6[_0x44470e]={'$like':'%'+_0x3d3e16[_0x07bd('0x4b')]['filter']+'%'};return _0x1c18f6;})});}_0x338a8b[_0x07bd('0x58')][_0x07bd('0xf2')]=![];if(_0x3d3e16['query']['id']){_0x338a8b[_0x07bd('0x58')]['id']={'$gt':_0x3d3e16['query']['id']};}_0x338a8b=_[_0x07bd('0xaa')]({},_0x338a8b,_0x3d3e16[_0x07bd('0xc2')]);return db[_0x07bd('0xcd')][_0x07bd('0x35')]({'where':_0x338a8b[_0x07bd('0x58')]})[_0x07bd('0x27')](function(_0x1e5acb){_0x47c2ee[_0x07bd('0x35')]=_0x1e5acb;_0x338a8b['include']=[];if(_0x3d3e16[_0x07bd('0x4b')][_0x07bd('0x10a')]){_0x338a8b[_0x07bd('0xc1')][_0x07bd('0x45')]({'model':db[_0x07bd('0x7e')],'as':_0x07bd('0x7e'),'attributes':['id','fullname',_0x07bd('0xee')]});}if(_0x3d3e16[_0x07bd('0x4b')][_0x07bd('0x10b')]){_0x338a8b[_0x07bd('0xc1')]=[{'all':!![]}];}return db[_0x07bd('0xcd')]['findAll'](_0x338a8b);})[_0x07bd('0x27')](function(_0x2e8391){_0x47c2ee[_0x07bd('0xbe')]=_0x2e8391;return _0x47c2ee;});}})[_0x07bd('0x27')](respondWithFilteredResult(_0x2cb7d5,_0x338a8b))['catch'](handleError(_0x2cb7d5,null));};exports['addTags']=function(_0x2723fc,_0x543735,_0x38fcdb){return db['ChatInteraction'][_0x07bd('0x79')]({'where':{'id':_0x2723fc[_0x07bd('0xc0')]['id']}})[_0x07bd('0x27')](handleEntityNotFound(_0x543735,null))[_0x07bd('0x27')](function(_0x517bd6){if(_0x517bd6){return _0x517bd6[_0x07bd('0x10c')](_0x2723fc[_0x07bd('0x83')][_0x07bd('0x103')],_[_0x07bd('0x104')](_0x2723fc[_0x07bd('0x83')],[_0x07bd('0x103'),'id'])||{})[_0x07bd('0x10d')](function(){return db['Tag'][_0x07bd('0x109')]({'attributes':['id',_0x07bd('0x3d'),_0x07bd('0x5b')],'where':{'id':_0x2723fc[_0x07bd('0x83')][_0x07bd('0x103')]}});})['then'](function(_0x11f77c){socket[_0x07bd('0x10e')](_0x07bd('0x10f'),{'id':Number(_0x2723fc[_0x07bd('0xc0')]['id']),'tags':_0x11f77c||[]});return{'id':Number(_0x2723fc[_0x07bd('0xc0')]['id']),'tags':_0x11f77c||[]};});}})['then'](respondWithResult(_0x543735,null))['catch'](handleError(_0x543735,null));};exports[_0x07bd('0x110')]=function(_0x309582,_0x3a1783,_0x1209b5){return db[_0x07bd('0x47')][_0x07bd('0x79')]({'where':{'id':_0x309582[_0x07bd('0xc0')]['id']}})[_0x07bd('0x27')](handleEntityNotFound(_0x3a1783,null))[_0x07bd('0x27')](function(_0x47975a){if(_0x47975a){return _0x47975a[_0x07bd('0x110')](_0x309582[_0x07bd('0x4b')]['ids']);}})[_0x07bd('0x27')](respondWithStatusCode(_0x3a1783,null))[_0x07bd('0x30')](handleError(_0x3a1783,null));};exports[_0x07bd('0x111')]=function(_0xcd654c,_0x1e06bb){var _0x144b56=moment()[_0x07bd('0x112')]()[_0x07bd('0xa8')]();var _0x575701=path[_0x07bd('0xdd')](config[_0x07bd('0xe0')],_0x07bd('0x113'),_0x07bd('0x114'),_0x07bd('0x115'));var _0x4432ac=path[_0x07bd('0xdd')](config[_0x07bd('0xe0')],'server','files',_0x07bd('0x116'));var _0x5d6a67=path[_0x07bd('0xdd')](_0x575701,_0x144b56);var _0x2cae5c=util[_0x07bd('0xe2')](_0x07bd('0x117'),_0xcd654c[_0x07bd('0xc0')]['id'],_0x144b56);var _0x8703d0=path['join'](_0x575701,_0x2cae5c);var _0x1639b9=[];_0x1639b9[_0x07bd('0x45')]({'model':db[_0x07bd('0x7e')],'as':'User','attributes':['id',_0x07bd('0x41')],'raw':!![]});_0x1639b9[_0x07bd('0x45')]({'model':db['CmContact'],'as':_0x07bd('0x76'),'attributes':['id',_0x07bd('0x118'),_0x07bd('0x119')],'raw':!![]});if(_0xcd654c[_0x07bd('0x4b')][_0x07bd('0x116')]){_0x1639b9[_0x07bd('0x45')]({'model':db['Attachment'],'as':_0x07bd('0xda'),'raw':!![]});}var _0x41cd5e=[{'model':db[_0x07bd('0xcd')],'as':_0x07bd('0xe5'),'attributes':['id',_0x07bd('0x83'),'createdAt',_0x07bd('0xf1'),_0x07bd('0xf2'),'read'],'include':_0x1639b9}];_0x41cd5e[_0x07bd('0x45')]({'model':db['ChatWebsite'],'as':_0x07bd('0x11a'),'attributes':['id',_0x07bd('0x3d')]});_0x41cd5e['push']({'model':db[_0x07bd('0x7e')],'as':'Owner','attributes':['id',_0x07bd('0x41')]});return db['ChatInteraction'][_0x07bd('0x79')]({'where':{'id':_0xcd654c[_0x07bd('0xc0')]['id']},'include':_0x41cd5e})[_0x07bd('0x27')](handleEntityNotFound(_0x1e06bb,null))[_0x07bd('0x27')](function(_0x1a1ead){if(_0x1a1ead){var _0x144514=_0x1a1ead['get']({'plain':!![]});fs['mkdirSync'](_0x5d6a67);var _0x335863={'format':'A4','border':_0x07bd('0x11b'),'header':{'height':_0x07bd('0x11c'),'contents':{'first':_0x07bd('0x11d')}},'footer':{'height':_0x07bd('0x11e'),'contents':{'default':util['format'](_0x07bd('0x11f'),util[_0x07bd('0xe2')]('%s\x20#%d',_0x07bd('0x120'),_0x144514['id']),moment()[_0x07bd('0xe2')]('YYYY-MM-DD')[_0x07bd('0xa8')]())}}};var _0x2da7ca={'channel':'Chat','account':_0x144514[_0x07bd('0x11a')][_0x07bd('0x3d')],'agent':_0x144514[_0x07bd('0x121')]?_0x144514['Owner'][_0x07bd('0x41')]:_0x07bd('0x122'),'createdAt':moment(_0x144514[_0x07bd('0x89')])[_0x07bd('0xe2')](_0x07bd('0x108'))[_0x07bd('0xa8')](),'closedAt':_0x144514[_0x07bd('0xdb')]?moment(_0x144514[_0x07bd('0x123')])[_0x07bd('0xe2')](_0x07bd('0x108'))[_0x07bd('0xa8')]():'','disposition':_0x144514[_0x07bd('0xd4')],'chatInfo':{'browser':_0x144514[_0x07bd('0x124')],'os':_0x144514['osName'],'referer':_0x144514[_0x07bd('0x125')],'customerIp':_0x144514[_0x07bd('0x126')],'customerPort':_0x144514[_0x07bd('0x127')]?_0x144514[_0x07bd('0x127')]:_0x07bd('0x122')},'messages':_(_0x144514[_0x07bd('0xe5')])[_0x07bd('0x128')]()[_0x07bd('0x94')]({'secret':![]})[_0x07bd('0x40')](function(_0x5e0443){if(_0x5e0443['Attachment']){var _0x322c73=path[_0x07bd('0xdd')](_0x4432ac,_0x5e0443[_0x07bd('0xda')][_0x07bd('0xd7')]);if(fs[_0x07bd('0x129')](_0x322c73)){fs[_0x07bd('0x12a')](_0x322c73)[_0x07bd('0x12b')](fs[_0x07bd('0x12c')](path[_0x07bd('0xdd')](_0x5d6a67,_0x5e0443[_0x07bd('0xda')][_0x07bd('0xd7')])));}}return{'date':moment(_0x5e0443[_0x07bd('0x89')])['format'](_0x07bd('0x108'))['toString'](),'sender':_0x5e0443[_0x07bd('0xf1')]===_0x07bd('0xcc')?_0x5e0443[_0x07bd('0x7e')]?_0x5e0443[_0x07bd('0x7e')][_0x07bd('0x41')]:_0x07bd('0xe8'):_0x5e0443[_0x07bd('0x76')]['firstName']+(_0x5e0443[_0x07bd('0x76')]['lastName']?'\x20'+_0x5e0443[_0x07bd('0x76')][_0x07bd('0x119')]:''),'body':_0x5e0443[_0x07bd('0xda')]?_0x5e0443[_0x07bd('0xda')]['basename']:_0x5e0443[_0x07bd('0x83')],'direction':_0x5e0443[_0x07bd('0xf1')]===_0x07bd('0xcc')?'A':'C','secret':_0x5e0443['secret'],'read':_0x5e0443[_0x07bd('0x90')],'attachment':_0x5e0443[_0x07bd('0xda')]};})[_0x07bd('0x72')]()};return ejs[_0x07bd('0x12d')](path[_0x07bd('0xdd')](config[_0x07bd('0xe0')],_0x07bd('0x113'),_0x07bd('0x12e'),_0x07bd('0x12f')),{'interaction':_0x2da7ca})[_0x07bd('0x27')](function(_0x389742){return new BPromise(function(_0xe36373,_0x152e53){pdf[_0x07bd('0xce')](_0x389742,_0x335863)[_0x07bd('0x130')](path[_0x07bd('0xdd')](_0x5d6a67,_0x07bd('0x131')+_0x144514['id']+'-'+_0x144b56+_0x07bd('0x132')),function(_0x5184f9,_0x2cea3f){if(_0x5184f9)return _0x152e53(_0x5184f9);_0xe36373(_0x2cea3f);});});})['then'](function(){return new BPromise(function(_0xdbbc02,_0x235f96){zipdir(_0x5d6a67,{'saveTo':_0x8703d0},function(_0x32b928,_0x37c797){if(_0x32b928)return _0x235f96(_0x32b928);return _0xdbbc02(_0x37c797);});})[_0x07bd('0x27')](function(){return new BPromise(function(_0x4002ba,_0x2f15e5){rimraf(_0x5d6a67,function(_0x29c6d0){if(_0x29c6d0)_0x2f15e5(_0x29c6d0);return _0x4002ba();});});})[_0x07bd('0x27')](function(){return _0x1e06bb[_0x07bd('0x111')](_0x8703d0,_0x2cae5c,function(_0x53d0cc){if(_0x53d0cc){console['log'](_0x07bd('0x133'),_0x53d0cc);}else{fs[_0x07bd('0x134')](_0x8703d0);}});});});}else{return _0x1e06bb[_0x07bd('0x31')](0xc8);}})[_0x07bd('0x30')](handleError(_0x1e06bb,null));}; \ No newline at end of file +var _0x0295=['ContactId','buildExpression','text','start','Tag','union','operator','UserId','some','compact','i.ChatWebsiteId\x20IN\x20?','parse','$gte','$lte','null','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20>\x200','isArray','tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','filter','replace','\x27\x27\x27\x27','i.id\x20LIKE\x20?','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','group','i.id','QueryTypes','SELECT','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','DESC','t.id\x20IN\x20?','resolve','ChatWebsiteId','journey','i.ChatWebsiteId\x20IS\x20NOT\x20NULL','user','getChatWebsites','i.ChatWebsiteId\x20IS\x20NULL','sequelize','toString','keyBy','a.key','Account.key','a.mandatoryDisposition','Account.mandatoryDisposition','i.*','c.lastName','c.email','Contact.email','c.phone','Contact.phone','c.mobile','c.fax','Owner.fullname','o.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.ChatInteractionId\x20IN\x20?','groupBy','ChatInteractionId','all','rows','show','rawAttributes','includeAll','merge','options','create','body','params','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','abandonInteraction,\x20%s,\x20%s,\x20%s','entity\x20not\x20found','Interaction\x20already\x20assigned','closed','attachmentUpload','file','originalname','basename','filename','Attachment','attachmentDownload','Unauthorized','attachId','download','join','root','server/files/attachments/','close','mailTranscript','server/files/chat/upload/','format','transcript-%s.txt','now','pathTranscript','User','Messages','%s%d','agentAlias','System','customer','agentIdentifier','website_alias','agent_alias','alias','agent_fullname','[%s]\x20%s:\x20%s\x0a','createdAt','direction','appendFileSync','MailAccount','MailServerOut','Smtp','service','host','secure','authentication','auth','pass','SendMail','\x22%s\x22\x20<%s>','addMessage','ids','getMessages','include','getMyMessages','secret','includeAgent','addTags','setTags','omit','spread','findAll','color','emit','chatInteractionTags:save','removeTags','unix','files','tmp','server','attachments','transcript-%d-%s.zip','CmContact','firstName','Account','Owner','mkdirSync','40px','\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20
Interaction\x20Transcript
\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','30px','\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20%s\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20{{page}}/{{pages}}\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20%s\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','%s\x20#%d','Chat','YYYY-MM-DD','N.A.','YYYY-MM-DD\x20HH:mm:ss','closedAt','disposition','browserName','customerIp','customerPort','tail','existsSync','createReadStream','pipe','lastName','views','toFile','transcript-','.pdf','log','err','unlinkSync','html-pdf','zip-dir','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','redis','defaults','./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','ChatInteraction,\x20%s,\x20%s','request\x20sent','debug','ChatInteraction,\x20%s,\x20%s,\x20%s','error','code','message','info','result','catch','sendStatus','end','status','json','count','offset','limit','set','reject','save','update','then','destroy','name','Users','map','fullname','TagIds','split','forEach','push','index','ChatInteraction','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','select','from','tools_tags','u.id','field','left_join','users','u.id\x20=\x20ui.UserId','chat_interactions','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','chat_websites','me.ChatInteractionId\x20=\x20i.id','chat_interaction_has_tags','it.ChatInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','parseSearch','search','conditions','find','unreadMessages','value','having','`\x20>\x200','Contact','$substring','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)'];(function(_0x32a8a8,_0x340cd5){var _0x25837c=function(_0x4c81ec){while(--_0x4c81ec){_0x32a8a8['push'](_0x32a8a8['shift']());}};_0x25837c(++_0x340cd5);}(_0x0295,0x1f0));var _0x5029=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x0295[_0x14add3];return _0x4a174f;};'use strict';var pdf=require(_0x5029('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x5029('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x5029('0x2'));var BPromise=require(_0x5029('0x3'));var Mustache=require(_0x5029('0x4'));var util=require(_0x5029('0x5'));var path=require(_0x5029('0x6'));var sox=require(_0x5029('0x7'));var csv=require(_0x5029('0x8'));var ejs=require(_0x5029('0x9'));var fs=require('fs');var _=require(_0x5029('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x5029('0xb'));var toCsv=require('to-csv');var querystring=require(_0x5029('0xc'));var Papa=require('papaparse');var Redis=require(_0x5029('0xd'));var authService=require('../../components/auth/service');var qs=require(_0x5029('0xe'));var as=require(_0x5029('0xf'));var hardwareService=require(_0x5029('0x10'));var logger=require('../../config/logger')(_0x5029('0x11'));var utils=require(_0x5029('0x12'));var config=require(_0x5029('0x13'));var db=require('../../mysqldb')['db'];config[_0x5029('0x14')]=_[_0x5029('0x15')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x5029('0x16'))[_0x5029('0x17')](socket);var jayson=require(_0x5029('0x18'));var client=jayson[_0x5029('0x19')][_0x5029('0x1a')]({'port':0x232b});var client9004=jayson[_0x5029('0x19')][_0x5029('0x1a')]({'port':0x232c});function checkPasswordPattern(_0x317c20,_0x10bf55,_0x326923){if(_0x326923){var _0x457c73=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x457c73[_0x5029('0x1b')](_0x10bf55)){return _0x317c20;}else{throw new db[(_0x5029('0x1c'))][(_0x5029('0x1d'))](_0x5029('0x1e'));}}else{return _0x317c20;}}function respondWithRpcPromise(_0x4f7ab4,_0x1ed567,_0x31a155,_0x35de81){return new BPromise(function(_0x4902f3,_0x8cea01){var _0x5e115f=_0x35de81||client;return _0x5e115f[_0x5029('0x1f')](_0x4f7ab4,_0x31a155)['then'](function(_0x226a5c){logger['info'](_0x5029('0x20'),_0x1ed567,_0x5029('0x21'));logger[_0x5029('0x22')](_0x5029('0x23'),_0x1ed567,'request\x20sent',JSON['stringify'](_0x226a5c));if(_0x226a5c[_0x5029('0x24')]){if(_0x226a5c['error'][_0x5029('0x25')]===0x1f4){logger[_0x5029('0x24')](_0x5029('0x20'),_0x1ed567,_0x226a5c[_0x5029('0x24')][_0x5029('0x26')]);return _0x8cea01(_0x226a5c[_0x5029('0x24')][_0x5029('0x26')]);}logger[_0x5029('0x24')](_0x5029('0x20'),_0x1ed567,_0x226a5c['error']['message']);return _0x4902f3(_0x226a5c['error'][_0x5029('0x26')]);}else{logger[_0x5029('0x27')]('ChatInteraction,\x20%s,\x20%s',_0x1ed567,'request\x20sent');_0x4902f3(_0x226a5c[_0x5029('0x28')][_0x5029('0x26')]);}})[_0x5029('0x29')](function(_0x5527fc){logger[_0x5029('0x24')](_0x5029('0x20'),_0x1ed567,_0x5527fc);_0x8cea01(_0x5527fc);});});}function respondWithStatusCode(_0x5e45c4,_0x2b6d99){_0x2b6d99=_0x2b6d99||0xcc;return function(_0x31f0a0){if(_0x31f0a0){return _0x5e45c4[_0x5029('0x2a')](_0x2b6d99);}return _0x5e45c4['status'](_0x2b6d99)[_0x5029('0x2b')]();};}function respondWithResult(_0x251f99,_0xe5313e){_0xe5313e=_0xe5313e||0xc8;return function(_0x4b6f92){if(_0x4b6f92){return _0x251f99[_0x5029('0x2c')](_0xe5313e)[_0x5029('0x2d')](_0x4b6f92);}};}function respondWithFilteredResult(_0x4cc16a,_0x1d79b9){return function(_0x25032b){if(_0x25032b){var _0x4434ff=_0x25032b[_0x5029('0x2e')],_0x1c3dd9=_0x1d79b9[_0x5029('0x2f')],_0x196830=_0x1d79b9[_0x5029('0x2f')]+_0x1d79b9[_0x5029('0x30')],_0x2a1ed6;if(_0x196830>=_0x4434ff){_0x196830=_0x4434ff;_0x2a1ed6=0xc8;}else{_0x2a1ed6=0xce;}_0x4cc16a[_0x5029('0x2c')](_0x2a1ed6);return _0x4cc16a[_0x5029('0x31')]('Content-Range',_0x1c3dd9+'-'+_0x196830+'/'+_0x4434ff)[_0x5029('0x2d')](_0x25032b);}return null;};}function patchUpdates(_0x5cb04b){return function(_0x31c621){try{jsonpatch['apply'](_0x31c621,_0x5cb04b,!![]);}catch(_0x48f387){return BPromise[_0x5029('0x32')](_0x48f387);}return _0x31c621[_0x5029('0x33')]();};}function saveUpdates(_0x1f9173,_0x4b7330){return function(_0x2a1535){if(_0x2a1535){return _0x2a1535[_0x5029('0x34')](_0x1f9173)[_0x5029('0x35')](function(_0x29c59a){return _0x29c59a;});}return null;};}function removeEntity(_0x1bb896,_0x4513b9){return function(_0x46ec59){if(_0x46ec59){return _0x46ec59[_0x5029('0x36')]()[_0x5029('0x35')](function(){_0x1bb896['status'](0xcc)[_0x5029('0x2b')]();});}};}function handleEntityNotFound(_0xa4a432,_0xc110e8){return function(_0x1b3817){if(!_0x1b3817){_0xa4a432['sendStatus'](0x194);}return _0x1b3817;};}function handleError(_0x184b8d,_0x388cca){_0x388cca=_0x388cca||0x1f4;return function(_0x3e2d88){logger['error'](_0x3e2d88['stack']);if(_0x3e2d88[_0x5029('0x37')]){delete _0x3e2d88[_0x5029('0x37')];}_0x184b8d['status'](_0x388cca)['send'](_0x3e2d88);};}function getInteractionUsers(_0x9656f2,_0x157969){return new BPromise(function(_0x270d66,_0x3210cb){try{if(_0x157969[_0x9656f2['id']]){_0x9656f2[_0x5029('0x38')]=_[_0x5029('0x39')](_0x157969[_0x9656f2['id']],function(_0x3cb84e){return{'id':_0x3cb84e['id'],'fullname':_0x3cb84e[_0x5029('0x3a')]};});}}catch(_0x10eb75){_0x3210cb(_0x10eb75);}_0x270d66(_0x9656f2);});}function getInteractionTags(_0x3effa4,_0x3e5b67){return new BPromise(function(_0xbdb3fa,_0x46314a){try{if(_0x3effa4[_0x5029('0x3b')]){_0x3effa4['Tags']=[];_0x3effa4['TagIds'][_0x5029('0x3c')](',')[_0x5029('0x3d')](function(_0x423ed1){_0x3effa4['Tags'][_0x5029('0x3e')](_0x3e5b67[_0x423ed1]);});}delete _0x3effa4[_0x5029('0x3b')];}catch(_0x52572a){_0x46314a(_0x52572a);}_0xbdb3fa(_0x3effa4);});}function updateChatInteraction(_0x247789,_0x4c3e11,_0x506f0d){return new BPromise(function(_0x5653cb,_0x2a6286){return getInteractionUsers(_0x247789,_0x506f0d)[_0x5029('0x35')](function(_0x24a18d){return getInteractionTags(_0x24a18d,_0x4c3e11);})[_0x5029('0x35')](function(_0x346fd9){_0x5653cb(_0x346fd9);})[_0x5029('0x29')](function(_0x4b2219){_0x2a6286(_0x4b2219);});});}exports[_0x5029('0x3f')]=function(_0x2ae047,_0x5a3e4d){var _0x103dfb={},_0x236455={},_0x1e040d={'count':0x0,'rows':[]};var _0x1edc00=_[_0x5029('0x39')](db[_0x5029('0x40')]['rawAttributes'],function(_0x259db8){return{'name':_0x259db8[_0x5029('0x41')],'type':_0x259db8[_0x5029('0x42')][_0x5029('0x43')]};});_0x236455[_0x5029('0x44')]=_['map'](_0x1edc00,_0x5029('0x37'));_0x236455[_0x5029('0x45')]=_[_0x5029('0x46')](_0x2ae047[_0x5029('0x45')]);_0x236455[_0x5029('0x47')]=_[_0x5029('0x48')](_0x236455[_0x5029('0x44')],_0x236455[_0x5029('0x45')]);_0x103dfb[_0x5029('0x49')]=_['intersection'](_0x236455[_0x5029('0x44')],qs[_0x5029('0x4a')](_0x2ae047[_0x5029('0x45')][_0x5029('0x4a')]));_0x103dfb['attributes']=_0x103dfb['attributes'][_0x5029('0x4b')]?_0x103dfb[_0x5029('0x49')]:_0x236455[_0x5029('0x44')];if(!_0x2ae047[_0x5029('0x45')][_0x5029('0x4c')](_0x5029('0x4d'))){_0x103dfb[_0x5029('0x30')]=qs[_0x5029('0x30')](_0x2ae047[_0x5029('0x45')][_0x5029('0x30')]);_0x103dfb[_0x5029('0x2f')]=qs[_0x5029('0x2f')](_0x2ae047[_0x5029('0x45')][_0x5029('0x2f')]);}_0x103dfb[_0x5029('0x4e')]=qs[_0x5029('0x4f')](_0x2ae047[_0x5029('0x45')][_0x5029('0x4f')]);_0x103dfb[_0x5029('0x50')]=qs[_0x5029('0x47')](_[_0x5029('0x51')](_0x2ae047['query'],_0x236455[_0x5029('0x47')]),_0x1edc00);var _0x5e1bcb=[];var _0x189d7d=squel[_0x5029('0x52')]()['field']('id')['field'](_0x5029('0x37'))['field']('color')[_0x5029('0x53')](_0x5029('0x54'));var _0x2e4c4e=squel['select']()['field'](_0x5029('0x55'))[_0x5029('0x56')]('u.fullname')[_0x5029('0x56')]('ui.ChatInteractionId')[_0x5029('0x53')]('user_has_chat_interactions','ui')[_0x5029('0x57')](_0x5029('0x58'),'u',_0x5029('0x59'));var _0x6d03b2=squel[_0x5029('0x52')]()[_0x5029('0x53')](_0x5029('0x5a'),'i')[_0x5029('0x57')]('cm_contacts','c',_0x5029('0x5b'))['left_join'](_0x5029('0x58'),'o',_0x5029('0x5c'))['left_join'](_0x5029('0x5d'),'a','a.id\x20=\x20i.ChatWebsiteId')['left_join']('chat_messages','me',_0x5029('0x5e'))['left_join'](_0x5029('0x5f'),'it',_0x5029('0x60'))[_0x5029('0x57')]('tools_tags','t',_0x5029('0x61'));var _0x53fd4f=squel['expr']();var _0x45c7cd=[];var _0x98abd1=squel[_0x5029('0x62')]();var _0x448273;if(_0x2ae047[_0x5029('0x45')]['search']){_0x448273=as[_0x5029('0x63')](_0x2ae047[_0x5029('0x45')][_0x5029('0x64')]);var _0x4311a6=_0x448273['sqlOperator'];for(var _0x33812b=0x0;_0x33812b<_0x448273[_0x5029('0x65')]['length'];_0x33812b++){var _0x512de9=_0x448273[_0x5029('0x65')][_0x33812b];var _0x4685a6='i';var _0x1263ba=_[_0x5029('0x66')](_0x1edc00,['name',_0x512de9[_0x5029('0x56')]]);if(!_0x1263ba){switch(_0x512de9[_0x5029('0x56')]){case _0x5029('0x67'):if(_0x512de9[_0x5029('0x68')]==0x1){_0x6d03b2[_0x5029('0x69')]('`'+_0x512de9[_0x5029('0x56')]+'`\x20=\x200');}else{_0x6d03b2['having']('`'+_0x512de9[_0x5029('0x56')]+_0x5029('0x6a'));}break;case _0x5029('0x6b'):if(_0x512de9['operator']===_0x5029('0x6c')){if(_0x512de9[_0x5029('0x68')][_0x5029('0x3c')]('\x20')[_0x5029('0x4b')]>0x1){_0x53fd4f[_0x4311a6](_0x5029('0x6d'),qs['getFullTextValue'](_0x512de9[_0x5029('0x68')]),null);}else{var _0x352736='%'+_0x512de9[_0x5029('0x68')]+'%';_0x53fd4f[_0x4311a6]('c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?',_0x352736,_0x352736,_0x352736);}}else{_0x1263ba=_[_0x5029('0x66')](_0x1edc00,['name',_0x5029('0x6e')]);_0x512de9['field']=_0x5029('0x6e');_0x236c3f=as[_0x5029('0x6f')](_0x4685a6,_0x1263ba[_0x5029('0x42')],_0x512de9);_0x53fd4f[_0x4311a6](_0x236c3f[_0x5029('0x70')],_0x236c3f[_0x5029('0x68')][_0x5029('0x71')],_0x236c3f['value'][_0x5029('0x2b')]);}break;case _0x5029('0x72'):var _0x1ff8df=_0x512de9[_0x5029('0x68')][_0x5029('0x3c')](',')['map'](function(_0x13ca47){return Number(_0x13ca47);});_0x1ff8df['forEach'](function(_0x2780e2){_0x98abd1['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x2780e2+',%');});_0x45c7cd=_[_0x5029('0x73')](_0x45c7cd,_0x1ff8df);break;case'User':if(_0x512de9[_0x5029('0x74')]==='$substring'){_0x53fd4f[_0x4311a6]('CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','%'+_0x512de9[_0x5029('0x68')]+'%',null);}else{_0x1263ba=_['find'](_0x1edc00,[_0x5029('0x37'),_0x5029('0x75')]);_0x512de9[_0x5029('0x56')]='UserId';_0x236c3f=as[_0x5029('0x6f')](_0x4685a6,_0x1263ba['type'],_0x512de9);_0x53fd4f[_0x4311a6](_0x236c3f[_0x5029('0x70')],_0x236c3f[_0x5029('0x68')][_0x5029('0x71')],_0x236c3f[_0x5029('0x68')][_0x5029('0x2b')]);}break;case'body':_0x236c3f=as[_0x5029('0x6f')]('me',null,_0x512de9);_0x53fd4f[_0x4311a6](_0x236c3f[_0x5029('0x70')],_0x236c3f['value'][_0x5029('0x71')],_0x236c3f[_0x5029('0x68')][_0x5029('0x2b')]);break;}}else{var _0x236c3f=as[_0x5029('0x6f')](_0x4685a6,_0x1263ba[_0x5029('0x42')],_0x512de9);_0x53fd4f[_0x4311a6](_0x236c3f['text'],_0x236c3f['value'][_0x5029('0x71')],_0x236c3f['value'][_0x5029('0x2b')]);}}}else{var _0x21fad4=_(_0x2ae047['query'])[_0x5029('0x46')]()['map'](function(_0x4cc275){return _[_0x5029('0x76')](_0x1edc00,[_0x5029('0x37'),_0x4cc275])?_0x4cc275:undefined;})[_0x5029('0x77')]()[_0x5029('0x68')]();if(!_['isEmpty'](_0x21fad4)){_0x21fad4[_0x5029('0x3d')](function(_0x43fcc0){if(_0x43fcc0==='ChatWebsiteId'){_0x6d03b2[_0x5029('0x50')](_0x5029('0x78'),[]['concat'](_0x2ae047['query'][_0x43fcc0]));}else if(_0x43fcc0==='createdAt'){var _0x7441d8=JSON[_0x5029('0x79')](_0x2ae047[_0x5029('0x45')][_0x43fcc0])[_0x5029('0x7a')];var _0x46be5a=JSON[_0x5029('0x79')](_0x2ae047[_0x5029('0x45')][_0x43fcc0])[_0x5029('0x7b')];_0x6d03b2[_0x5029('0x50')]('i.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x7441d8,_0x46be5a);}else{if(_0x2ae047['query'][_0x43fcc0]===_0x5029('0x7c')){_0x6d03b2[_0x5029('0x50')]('i.'+_0x43fcc0+_0x5029('0x7d'));}else{_0x6d03b2[_0x5029('0x50')]('i.'+_0x43fcc0+_0x5029('0x7e'),_0x2ae047[_0x5029('0x45')][_0x43fcc0]);}}});}if(_0x2ae047[_0x5029('0x45')]['read']){if(_0x2ae047[_0x5029('0x45')][_0x5029('0x7f')]==0x1){_0x6d03b2[_0x5029('0x69')]('`unreadMessages`\x20=\x200');}else{_0x6d03b2[_0x5029('0x69')](_0x5029('0x80'));}}if(_0x2ae047[_0x5029('0x45')]['tag']){_0x45c7cd=_[_0x5029('0x81')](_0x2ae047[_0x5029('0x45')][_0x5029('0x82')])?_0x2ae047['query'][_0x5029('0x82')]:new Array(_0x2ae047[_0x5029('0x45')]['tag']);_0x45c7cd[_0x5029('0x3d')](function(_0x42d795){_0x98abd1['or'](_0x5029('0x83'),'%,'+_0x42d795+',%');});}if(_0x2ae047[_0x5029('0x45')][_0x5029('0x84')]){var _0x4a2f3a=_0x2ae047[_0x5029('0x45')][_0x5029('0x84')][_0x5029('0x85')]('\x5c','\x5c\x5c')[_0x5029('0x85')]('\x27\x27',_0x5029('0x86'));if(qs['isNumeric'](_0x4a2f3a)){_0x53fd4f['or'](_0x5029('0x87'),_0x4a2f3a+'%');}else{_0x53fd4f['or'](_0x5029('0x88'),qs[_0x5029('0x89')](_0x4a2f3a))['or']('CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?',_0x4a2f3a+'%');}}}_0x6d03b2[_0x5029('0x50')](_0x53fd4f);_0x6d03b2[_0x5029('0x8a')](_0x5029('0x8b'));var _0x3e47bd={'type':db[_0x5029('0x1c')][_0x5029('0x8c')][_0x5029('0x8d')],'raw':!![]};var _0x5e2c3e=_0x6d03b2[_0x5029('0x8e')]();_0x5e2c3e[_0x5029('0x56')](_0x5029('0x8b'));_0x5e2c3e[_0x5029('0x56')](_0x5029('0x8f'),'unreadMessages');if(_0x103dfb[_0x5029('0x4e')]){_0x103dfb[_0x5029('0x4e')][_0x5029('0x3d')](function(_0x4f2ceb){_0x6d03b2[_0x5029('0x4e')]('i.'+_0x4f2ceb[0x0],_0x4f2ceb[0x1]===_0x5029('0x90')?![]:!![]);});}if(!_['isEmpty'](_0x45c7cd)){_0x6d03b2['having'](_0x98abd1);_0x5e2c3e['where'](_0x5029('0x91'),_0x45c7cd);}BPromise[_0x5029('0x92')]()[_0x5029('0x35')](function(){if(!_0x448273){if(_0x2ae047[_0x5029('0x45')][_0x5029('0x93')]||_0x2ae047['query'][_0x5029('0x94')])return;_0x5e2c3e[_0x5029('0x50')](_0x5029('0x95'));_0x6d03b2['where']('i.ChatWebsiteId\x20IS\x20NOT\x20NULL');return;}return _0x2ae047[_0x5029('0x96')][_0x5029('0x97')]({'attributes':['id'],'raw':!![]})[_0x5029('0x35')](function(_0x24a8f6){if(_['isEmpty'](_0x24a8f6)){_0x5e2c3e[_0x5029('0x50')](_0x5029('0x98'));_0x6d03b2[_0x5029('0x50')](_0x5029('0x98'));}else{_0x5e2c3e[_0x5029('0x50')](_0x5029('0x78'),_[_0x5029('0x39')](_0x24a8f6,'id'));_0x6d03b2[_0x5029('0x50')]('i.ChatWebsiteId\x20IN\x20?',_[_0x5029('0x39')](_0x24a8f6,'id'));}});})['then'](function(){db['sequelize'][_0x5029('0x45')](_0x5e2c3e['toString'](),_0x3e47bd)[_0x5029('0x35')](function(_0xe7fa61){_0x1e040d[_0x5029('0x2e')]=_0xe7fa61[_0x5029('0x4b')];if(_0x1e040d[_0x5029('0x2e')]===0x0)return[];return db[_0x5029('0x99')][_0x5029('0x45')](_0x189d7d[_0x5029('0x9a')](),_0x3e47bd)['then'](function(_0x5b7694){_0x5e1bcb=_[_0x5029('0x9b')](_0x5b7694,'id');_0x3e47bd=_['merge'](_0x3e47bd,{'model':db['ChatInteraction'],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x2ae047[_0x5029('0x45')]['fields']){_0x103dfb['attributes'][_0x5029('0x3d')](function(_0xb8da0b){_0x6d03b2[_0x5029('0x56')]('i.'+_0xb8da0b);});}else{_0x6d03b2[_0x5029('0x56')](_0x5029('0x8f'),'unreadMessages');_0x6d03b2[_0x5029('0x56')](_0x5029('0x9c'),_0x5029('0x9d'));_0x6d03b2['field'](_0x5029('0x9e'),_0x5029('0x9f'));_0x6d03b2[_0x5029('0x56')](_0x5029('0xa0'));_0x6d03b2[_0x5029('0x56')]('c.firstName','Contact.firstName');_0x6d03b2[_0x5029('0x56')](_0x5029('0xa1'),'Contact.lastName');_0x6d03b2[_0x5029('0x56')](_0x5029('0xa2'),_0x5029('0xa3'));_0x6d03b2[_0x5029('0x56')](_0x5029('0xa4'),_0x5029('0xa5'));_0x6d03b2[_0x5029('0x56')](_0x5029('0xa6'),'Contact.mobile');_0x6d03b2['field'](_0x5029('0xa7'),'Contact.fax');_0x6d03b2[_0x5029('0x56')]('o.fullname',_0x5029('0xa8'));_0x6d03b2[_0x5029('0x56')](_0x5029('0xa9'),'Owner.internal');_0x6d03b2[_0x5029('0x56')](_0x5029('0xaa'),_0x5029('0x3b'));}if(_0x103dfb['limit'])_0x6d03b2[_0x5029('0x30')](_0x103dfb[_0x5029('0x30')]);if(_0x103dfb[_0x5029('0x2f')])_0x6d03b2[_0x5029('0x2f')](_0x103dfb[_0x5029('0x2f')]);return db[_0x5029('0x99')][_0x5029('0x45')](_0x6d03b2[_0x5029('0x9a')](),_0x3e47bd);})[_0x5029('0x35')](function(_0x1834f2){_0x2e4c4e[_0x5029('0x50')](_0x5029('0xab'),_[_0x5029('0x39')](_0x1834f2,'id'));return db[_0x5029('0x99')][_0x5029('0x45')](_0x2e4c4e[_0x5029('0x9a')](),_0x3e47bd)[_0x5029('0x35')](function(_0x2468fa){var _0x4da8f8=_[_0x5029('0xac')](_0x2468fa,_0x5029('0xad'));var _0x2102ef=[];_0x1834f2[_0x5029('0x3d')](function(_0x34494c){_0x2102ef['push'](updateChatInteraction(_0x34494c,_0x5e1bcb,_0x4da8f8));});return BPromise[_0x5029('0xae')](_0x2102ef);});});})[_0x5029('0x35')](function(_0xec074c){_0x1e040d[_0x5029('0xaf')]=_0xec074c;return _0x1e040d;})[_0x5029('0x35')](respondWithFilteredResult(_0x5a3e4d,_0x103dfb));})['catch'](handleError(_0x5a3e4d,null));};exports[_0x5029('0xb0')]=function(_0x46be82,_0x20b00e){var _0x139971={'raw':![],'where':{'id':_0x46be82['params']['id']}},_0x3c601c={};_0x3c601c[_0x5029('0x44')]=_[_0x5029('0x46')](db[_0x5029('0x40')][_0x5029('0xb1')]);_0x3c601c[_0x5029('0x45')]=_[_0x5029('0x46')](_0x46be82[_0x5029('0x45')]);_0x3c601c[_0x5029('0x47')]=_['intersection'](_0x3c601c['model'],_0x3c601c[_0x5029('0x45')]);_0x139971[_0x5029('0x49')]=_[_0x5029('0x48')](_0x3c601c[_0x5029('0x44')],qs[_0x5029('0x4a')](_0x46be82['query'][_0x5029('0x4a')]));_0x139971['attributes']=_0x139971[_0x5029('0x49')][_0x5029('0x4b')]?_0x139971[_0x5029('0x49')]:_0x3c601c[_0x5029('0x44')];if(_0x46be82[_0x5029('0x45')][_0x5029('0xb2')]){_0x139971['include']=[{'all':!![]}];}_0x139971=_[_0x5029('0xb3')]({},_0x139971,_0x46be82[_0x5029('0xb4')]);return db['ChatInteraction'][_0x5029('0x66')](_0x139971)[_0x5029('0x35')](handleEntityNotFound(_0x20b00e,null))['then'](respondWithResult(_0x20b00e,null))[_0x5029('0x29')](handleError(_0x20b00e,null));};exports['create']=function(_0x54c0f3,_0x50d603){return db['ChatInteraction'][_0x5029('0xb5')](_0x54c0f3['body'],{})[_0x5029('0x35')](respondWithResult(_0x50d603,0xc9))[_0x5029('0x29')](handleError(_0x50d603,null));};exports['update']=function(_0x28fc01,_0x2084cf){if(_0x28fc01['body']['id']){delete _0x28fc01[_0x5029('0xb6')]['id'];}return db[_0x5029('0x40')]['find']({'where':{'id':_0x28fc01[_0x5029('0xb7')]['id']}})[_0x5029('0x35')](handleEntityNotFound(_0x2084cf,null))['then'](saveUpdates(_0x28fc01[_0x5029('0xb6')],null))[_0x5029('0x35')](respondWithResult(_0x2084cf,null))[_0x5029('0x29')](handleError(_0x2084cf,null));};exports[_0x5029('0x36')]=function(_0xf57e38,_0x233ce5){return db['ChatInteraction'][_0x5029('0x66')]({'where':{'id':_0xf57e38['params']['id']}})[_0x5029('0x35')](handleEntityNotFound(_0x233ce5,null))[_0x5029('0x35')](removeEntity(_0x233ce5,null))[_0x5029('0x29')](handleError(_0x233ce5,null));};exports[_0x5029('0xb8')]=function(_0x3e4f7d,_0x2138cc){return db[_0x5029('0x40')][_0x5029('0xb8')]()[_0x5029('0x35')](respondWithResult(_0x2138cc,null))[_0x5029('0x29')](handleError(_0x2138cc,null));};exports[_0x5029('0xb9')]=function(_0x41ca12,_0x14f995){var _0x3ccdc9=_0x41ca12[_0x5029('0xb7')]['id'];var _0x2ac88e;var _0x55ee4f;var _0x1fa9eb;return db[_0x5029('0x40')][_0x5029('0xba')]({'where':{'id':_0x3ccdc9}})[_0x5029('0x35')](function(_0x1ebc8c){_0x2ac88e=_0x1ebc8c;return db[_0x5029('0xbb')]['findOne']({'where':{'id':_0x1ebc8c[_0x5029('0x93')]},'attributes':['id',_0x5029('0xbc'),_0x5029('0xbd')],'raw':!![]});})[_0x5029('0x35')](function(_0x156da){if(_0x156da&&_0x156da['vidaooApiKey']&&_0x156da[_0x5029('0xbd')]){_0x55ee4f=_0x156da;var _0x2a3025={'rejectUnauthorized':![],'method':_0x5029('0xbe'),'uri':_0x5029('0xbf'),'headers':{'X-APIKEY':_0x156da[_0x5029('0xbc')]},'body':{'name':_0x5029('0xc0')+_0x3ccdc9},'redirect':_0x5029('0xc1'),'json':!![]};return rp(_0x2a3025);}else{throw new db[(_0x5029('0x1c'))][(_0x5029('0x1d'))](_0x5029('0xc2'));}})['then'](function(_0xb26cc0){_0x1fa9eb=_0xb26cc0;if(_0x1fa9eb['id']){var _0x4ac3b8={'body':_0x1fa9eb[_0x5029('0xc3')],'ChatWebsiteId':_0x55ee4f['id'],'ChatInteractionId':_0x2ac88e['id'],'direction':_0x5029('0xc4'),'UserId':_0x41ca12[_0x5029('0x96')]['id']};return db[_0x5029('0xc5')]['create'](_0x4ac3b8,{});}else{throw new db[(_0x5029('0x1c'))][(_0x5029('0x1d'))]('Unable\x20to\x20create\x20Vidaoo\x20session');}})[_0x5029('0x35')](function(){return _0x2ac88e[_0x5029('0xc6')]({'vidaooSessionId':_0x1fa9eb['id']});})['then'](respondWithResult(_0x14f995,null))[_0x5029('0x29')](handleError(_0x14f995,null));};exports[_0x5029('0xc7')]=function(_0x5b290f,_0x4a5d3e){if(_0x5b290f[_0x5029('0xb6')]['id']){delete _0x5b290f['body']['id'];}return db['ChatInteraction'][_0x5029('0x66')]({'where':{'id':_0x5b290f['params']['id']}})[_0x5029('0x35')](handleEntityNotFound(_0x4a5d3e,null))[_0x5029('0x35')](saveUpdates(_0x5b290f['body'],null))[_0x5029('0x35')](respondWithResult(_0x4a5d3e,null))[_0x5029('0x29')](handleError(_0x4a5d3e,null));};exports['abandon']=function(_0x3ac39a,_0x37c47b,_0x62e4af){if(_0x3ac39a['body']['id']){delete _0x3ac39a[_0x5029('0xb6')]['id'];}return db['ChatInteraction'][_0x5029('0x66')]({'where':{'id':_0x3ac39a[_0x5029('0xb7')]['id']}})[_0x5029('0x35')](function(_0x5e7ec8){if(!_0x5e7ec8){logger[_0x5029('0x24')](_0x5029('0xc8'),'abandon',0x194,_0x5029('0xc9'));_0x37c47b[_0x5029('0x2a')](0x194);}else{if(_0x5e7ec8['UserId']){throw new db['Sequelize'][(_0x5029('0x1d'))](_0x5029('0xca'));}}return _0x5e7ec8;})['then'](function(_0x5842a5){if(_0x5842a5){return _0x5842a5['update']({'closed':_0x3ac39a[_0x5029('0xb6')][_0x5029('0xcb')],'disposition':_0x3ac39a[_0x5029('0xb6')]['disposition']})[_0x5029('0x35')](function(_0x581237){return _0x581237;});}})[_0x5029('0x35')](function(_0x5de481){return respondWithRpcPromise('AbandonInteraction','abandon',_0x3ac39a['body'],client9004);})[_0x5029('0x35')](respondWithResult(_0x37c47b,null))[_0x5029('0x29')](handleError(_0x37c47b,null));};exports[_0x5029('0xcc')]=function(_0x11f39c,_0x12ba67,_0x5b0939){_0x11f39c[_0x5029('0xb6')][_0x5029('0x37')]=_0x11f39c[_0x5029('0xcd')][_0x5029('0xce')];_0x11f39c[_0x5029('0xb6')][_0x5029('0xcf')]=_0x11f39c['file'][_0x5029('0xd0')];_0x11f39c[_0x5029('0xb6')][_0x5029('0x42')]=_0x11f39c['file']['mimetype'];return db[_0x5029('0xd1')][_0x5029('0xb5')](_0x11f39c[_0x5029('0xb6')])[_0x5029('0x35')](respondWithResult(_0x12ba67,0xc9))[_0x5029('0x29')](handleError(_0x12ba67,null));};exports[_0x5029('0xd2')]=function(_0x181970,_0x10a16e,_0x47b508){return db[_0x5029('0x40')][_0x5029('0xba')]({'where':{'id':_0x181970[_0x5029('0xb7')]['id']},'raw':!![]})['then'](handleEntityNotFound(_0x10a16e,null))[_0x5029('0x35')](function(_0x594896){if(_0x594896){if(_0x594896[_0x5029('0xcb')]){return _0x10a16e[_0x5029('0x2c')](0x193)[_0x5029('0x2d')]({'status':0x193,'message':_0x5029('0xd3')});}return db[_0x5029('0xd1')][_0x5029('0xba')]({'where':{'id':_0x181970[_0x5029('0x45')][_0x5029('0xd4')]},'raw':!![]})['then'](handleEntityNotFound(_0x10a16e,null));}})['then'](function(_0x4dc23a){if(_0x4dc23a){return _0x10a16e[_0x5029('0xd5')](path[_0x5029('0xd6')](config[_0x5029('0xd7')],_0x5029('0xd8'),_0x4dc23a[_0x5029('0xcf')]));}})['catch'](handleError(_0x10a16e,null));};exports[_0x5029('0xd9')]=function(_0x17dfbd,_0xa26684){var _0x156450=null;var _0x3bb095=null;var _0x4ee7b0=null;var _0x32b1b4=null;if(_0x17dfbd[_0x5029('0xb6')]['id']){delete _0x17dfbd[_0x5029('0xb6')]['id'];}if(_0x17dfbd[_0x5029('0xb6')][_0x5029('0xda')]){_0x32b1b4=path[_0x5029('0xd6')](config[_0x5029('0xd7')],_0x5029('0xdb'),util[_0x5029('0xdc')](_0x5029('0xdd'),Date[_0x5029('0xde')]()));_0x17dfbd[_0x5029('0xb6')][_0x5029('0xdf')]=_0x32b1b4;}return db['ChatInteraction']['find']({'where':{'id':_0x17dfbd[_0x5029('0xb7')]['id']},'include':[{'model':db[_0x5029('0xc5')],'as':'Messages','include':[{'model':db[_0x5029('0xe0')],'as':_0x5029('0xe0')}]}]})['then'](handleEntityNotFound(_0xa26684,null))[_0x5029('0x35')](saveUpdates(_0x17dfbd[_0x5029('0xb6')],null))[_0x5029('0x35')](function(_0x54794c){if(_0x54794c){_0x156450=_0x54794c;return db[_0x5029('0xbb')][_0x5029('0x66')]({'where':{'id':_0x156450['ChatWebsiteId']}});}})[_0x5029('0x35')](function(_0x50637d){if(_0x50637d){_0x4ee7b0=_0x50637d;return db['CmContact'][_0x5029('0x66')]({'where':{'id':_0x156450['ContactId']}});}})[_0x5029('0x35')](function(_0x139540){if(_0x139540){_0x3bb095=_0x139540;if(_0x32b1b4){var _0x35f7b5=null;for(var _0x58b3e7=0x1;_0x58b3e7<_0x156450[_0x5029('0xe1')]['length'];++_0x58b3e7){_0x35f7b5=_0x156450['Messages'][_0x58b3e7];var _0x196706=_0x35f7b5['UserId']?util[_0x5029('0xdc')](_0x5029('0xe2'),_0x4ee7b0[_0x5029('0xe3')],_0x35f7b5['UserId']):_0x5029('0xe4');var _0x1caa56=_0x17dfbd[_0x5029('0xb6')][_0x5029('0xe5')]||util[_0x5029('0xdc')](_0x5029('0xe2'),'Visitor',_0x35f7b5['ContactId']);switch(_0x4ee7b0[_0x5029('0xe6')]){case _0x5029('0xe7'):_0x196706=_0x35f7b5['UserId']?util[_0x5029('0xdc')]('%s%d',_0x4ee7b0['agentAlias'],_0x35f7b5[_0x5029('0x75')]):_0x5029('0xe4');break;case _0x5029('0xe8'):_0x196706=_0x35f7b5[_0x5029('0x75')]?_0x35f7b5[_0x5029('0xe0')][_0x5029('0xe9')]||_0x35f7b5[_0x5029('0xe0')][_0x5029('0x3a')]:_0x5029('0xe4');break;case _0x5029('0xea'):_0x196706=_0x35f7b5[_0x5029('0x75')]?_0x35f7b5[_0x5029('0xe0')][_0x5029('0x3a')]:_0x5029('0xe4');break;default:_0x196706=_0x35f7b5[_0x5029('0x75')]?util[_0x5029('0xdc')](_0x5029('0xe2'),_0x4ee7b0[_0x5029('0xe3')],_0x35f7b5[_0x5029('0x75')]):_0x5029('0xe4');}var _0x38bb6b=util['format'](_0x5029('0xeb'),moment(_0x35f7b5[_0x5029('0xec')])[_0x5029('0xdc')]('MM/DD/YYYY\x20HH:mm:ss'),_0x35f7b5[_0x5029('0xed')]==='in'?_0x1caa56:_0x196706,_0x35f7b5['body']);if(!_0x35f7b5['secret']){fs[_0x5029('0xee')](_0x32b1b4,_0x38bb6b);}}return db[_0x5029('0xef')][_0x5029('0xba')]({'where':{'service':!![]},'include':[{'model':db[_0x5029('0xf0')],'as':_0x5029('0xf1'),'raw':!![]}]});}}})[_0x5029('0x35')](function(_0x2f3103){if(_0x2f3103&&_0x2f3103['Smtp']&&_0x17dfbd[_0x5029('0xb6')]){var _0x47b6de={'tls':{'rejectUnauthorized':![]}};if(_0x2f3103['Smtp'][_0x5029('0xf2')]){_0x47b6de[_0x5029('0xf2')]=_0x2f3103[_0x5029('0xf1')][_0x5029('0xf2')];}else{_0x47b6de[_0x5029('0xf3')]=_0x2f3103['Smtp']['host'];_0x47b6de['port']=_0x2f3103['Smtp']['port'];_0x47b6de['secure']=_0x2f3103[_0x5029('0xf1')][_0x5029('0xf4')];}if(_0x2f3103[_0x5029('0xf1')][_0x5029('0xf5')]){_0x47b6de[_0x5029('0xf6')]={'user':_0x2f3103['Smtp'][_0x5029('0x96')],'pass':_0x2f3103['Smtp'][_0x5029('0xf7')]};}return respondWithRpcPromise(_0x5029('0xf8'),'sendMail',{'account':_0x47b6de,'message':{'from':util[_0x5029('0xdc')](_0x5029('0xf9'),_0x2f3103['name'],_0x2f3103['email']||_0x2f3103[_0x5029('0xf1')]['user']),'to':_0x17dfbd[_0x5029('0xb6')]['mailTranscript'],'subject':'Mail\x20Transcript','text':util['format']('Hi\x20%s,\x20attached\x20you\x20can\x20find\x20your\x20transcript\x20file.\x20\x0a\x0aRegards.\x20\x0a\x0a',_0x17dfbd[_0x5029('0xb6')][_0x5029('0xda')]),'attachments':[{'path':_0x32b1b4}]}})['then'](function(){return _0x156450;})['catch'](function(_0x4aa892){console['error'](_0x4aa892);});}else{return _0x156450;}})[_0x5029('0x35')](respondWithStatusCode(_0xa26684,0xc8))[_0x5029('0x29')](handleError(_0xa26684,null));};exports['addMessage']=function(_0x28dc2d,_0xb6d199,_0x54f1cb){return db[_0x5029('0xc5')][_0x5029('0x66')]({'where':{'id':_0x28dc2d[_0x5029('0xb7')]['id']}})[_0x5029('0x35')](handleEntityNotFound(_0xb6d199,null))[_0x5029('0x35')](function(_0x1d52b5){if(_0x1d52b5){return _0x1d52b5[_0x5029('0xfa')](_0x28dc2d[_0x5029('0xb6')][_0x5029('0xfb')],_['omit'](_0x28dc2d[_0x5029('0xb6')],[_0x5029('0xfb'),'id'])||{});}})[_0x5029('0x35')](respondWithResult(_0xb6d199,null))[_0x5029('0x29')](handleError(_0xb6d199,null));};exports[_0x5029('0xfc')]=function(_0xa0b531,_0xe35b61,_0x32c365){var _0x4f8884={'raw':![],'where':{}};var _0x2e5925={};var _0x5e2547={'count':0x0,'rows':[]};return db['ChatInteraction'][_0x5029('0xba')]({'where':{'id':_0xa0b531['params']['id']}})[_0x5029('0x35')](handleEntityNotFound(_0xe35b61,null))['then'](function(_0x3f64e1){if(_0x3f64e1){_0x2e5925[_0x5029('0x44')]=_[_0x5029('0x46')](db[_0x5029('0xc5')][_0x5029('0xb1')]);_0x2e5925['query']=_[_0x5029('0x46')](_0xa0b531[_0x5029('0x45')]);_0x2e5925[_0x5029('0x47')]=_[_0x5029('0x48')](_0x2e5925[_0x5029('0x44')],_0x2e5925[_0x5029('0x45')]);_0x4f8884[_0x5029('0x49')]=_['intersection'](_0x2e5925[_0x5029('0x44')],qs['fields'](_0xa0b531[_0x5029('0x45')][_0x5029('0x4a')]));_0x4f8884[_0x5029('0x49')]=_0x4f8884[_0x5029('0x49')]['length']?_0x4f8884[_0x5029('0x49')]:_0x2e5925[_0x5029('0x44')];if(!_0xa0b531['query']['hasOwnProperty'](_0x5029('0x4d'))){_0x4f8884[_0x5029('0x30')]=qs[_0x5029('0x30')](_0xa0b531[_0x5029('0x45')]['limit']);_0x4f8884[_0x5029('0x2f')]=qs[_0x5029('0x2f')](_0xa0b531['query'][_0x5029('0x2f')]);}_0x4f8884[_0x5029('0x4e')]=qs['sort'](_0xa0b531[_0x5029('0x45')]['sort']);_0x4f8884[_0x5029('0x50')]=qs[_0x5029('0x47')](_[_0x5029('0x51')](_0xa0b531[_0x5029('0x45')],_0x2e5925['filters']));_0x4f8884[_0x5029('0x50')]['ChatInteractionId']=_0x3f64e1['id'];if(_0xa0b531[_0x5029('0x45')]['filter']){_0x4f8884['where']=_[_0x5029('0xb3')](_0x4f8884[_0x5029('0x50')],{'$or':_['map'](_0x4f8884[_0x5029('0x49')],function(_0x37fb59){var _0x58cfe1={};_0x58cfe1[_0x37fb59]={'$like':'%'+_0xa0b531['query'][_0x5029('0x84')]+'%'};return _0x58cfe1;})});}if(_0xa0b531[_0x5029('0x45')][_0x5029('0x7a')]){var _0x239e86=_0xa0b531[_0x5029('0x45')]['$gte'][_0x5029('0x3c')](',');var _0x2fc922={};_0x2fc922[_0x239e86[0x0]]={'$gte':moment(_0x239e86[0x1])['format']('YYYY-MM-DD\x20HH:mm:ss')};_0x4f8884['where']=_[_0x5029('0xb3')](_0x4f8884['where'],_0x2fc922);}_0x4f8884=_[_0x5029('0xb3')]({},_0x4f8884,_0xa0b531[_0x5029('0xb4')]);return db[_0x5029('0xc5')][_0x5029('0x2e')]({'where':_0x4f8884[_0x5029('0x50')]})[_0x5029('0x35')](function(_0x7b22ad){_0x5e2547['count']=_0x7b22ad;if(_0xa0b531[_0x5029('0x45')][_0x5029('0xb2')]){_0x4f8884[_0x5029('0xfd')]=[{'all':!![]}];}return db['ChatMessage']['findAll'](_0x4f8884);})[_0x5029('0x35')](function(_0x29ac1d){_0x5e2547['rows']=_0x29ac1d;return _0x5e2547;});}})['then'](respondWithFilteredResult(_0xe35b61,_0x4f8884))['catch'](handleError(_0xe35b61,null));};exports[_0x5029('0xfe')]=function(_0x523b0d,_0x57d3af,_0x10cf6b){var _0x6ae483={'where':{}},_0x5405a1={},_0x4b7d7e={'count':0x0,'rows':[]};return db[_0x5029('0x40')][_0x5029('0xba')]({'where':{'id':_0x523b0d[_0x5029('0xb7')]['id']}})['then'](handleEntityNotFound(_0x57d3af,null))['then'](function(_0x53e729){if(_0x53e729){_0x5405a1[_0x5029('0x44')]=_['keys'](db[_0x5029('0xc5')]['rawAttributes']);_0x5405a1['query']=_[_0x5029('0x46')](_0x523b0d[_0x5029('0x45')]);_0x5405a1[_0x5029('0x47')]=_[_0x5029('0x48')](_0x5405a1[_0x5029('0x44')],_0x5405a1['query']);_0x6ae483[_0x5029('0x49')]=_[_0x5029('0x48')](_0x5405a1[_0x5029('0x44')],qs[_0x5029('0x4a')](_0x523b0d[_0x5029('0x45')][_0x5029('0x4a')]));_0x6ae483['attributes']=_0x6ae483[_0x5029('0x49')][_0x5029('0x4b')]?_0x6ae483[_0x5029('0x49')]:_0x5405a1['model'];if(!_0x523b0d['query'][_0x5029('0x4c')](_0x5029('0x4d'))){_0x6ae483[_0x5029('0x30')]=qs[_0x5029('0x30')](_0x523b0d[_0x5029('0x45')][_0x5029('0x30')]);_0x6ae483[_0x5029('0x2f')]=qs['offset'](_0x523b0d['query'][_0x5029('0x2f')]);}_0x6ae483[_0x5029('0x4e')]=qs[_0x5029('0x4f')](_0x523b0d[_0x5029('0x45')]['sort']);_0x6ae483[_0x5029('0x50')]=qs[_0x5029('0x47')](_[_0x5029('0x51')](_0x523b0d['query'],_0x5405a1[_0x5029('0x47')]));_0x6ae483[_0x5029('0x50')][_0x5029('0xad')]=_0x53e729['id'];if(_0x523b0d[_0x5029('0x45')][_0x5029('0x84')]){_0x6ae483[_0x5029('0x50')]=_[_0x5029('0xb3')](_0x6ae483[_0x5029('0x50')],{'$or':_[_0x5029('0x39')](_0x6ae483[_0x5029('0x49')],function(_0x3eae37){var _0x290290={};_0x290290[_0x3eae37]={'$like':'%'+_0x523b0d[_0x5029('0x45')][_0x5029('0x84')]+'%'};return _0x290290;})});}_0x6ae483[_0x5029('0x50')][_0x5029('0xff')]=![];if(_0x523b0d[_0x5029('0x45')]['id']){_0x6ae483['where']['id']={'$gt':_0x523b0d[_0x5029('0x45')]['id']};}_0x6ae483=_[_0x5029('0xb3')]({},_0x6ae483,_0x523b0d[_0x5029('0xb4')]);return db[_0x5029('0xc5')][_0x5029('0x2e')]({'where':_0x6ae483[_0x5029('0x50')]})[_0x5029('0x35')](function(_0x5e9494){_0x4b7d7e[_0x5029('0x2e')]=_0x5e9494;_0x6ae483[_0x5029('0xfd')]=[];if(_0x523b0d[_0x5029('0x45')][_0x5029('0x100')]){_0x6ae483[_0x5029('0xfd')][_0x5029('0x3e')]({'model':db['User'],'as':_0x5029('0xe0'),'attributes':['id','fullname',_0x5029('0xe9')]});}if(_0x523b0d[_0x5029('0x45')][_0x5029('0xb2')]){_0x6ae483[_0x5029('0xfd')]=[{'all':!![]}];}return db[_0x5029('0xc5')]['findAll'](_0x6ae483);})[_0x5029('0x35')](function(_0x44c4f2){_0x4b7d7e['rows']=_0x44c4f2;return _0x4b7d7e;});}})[_0x5029('0x35')](respondWithFilteredResult(_0x57d3af,_0x6ae483))['catch'](handleError(_0x57d3af,null));};exports[_0x5029('0x101')]=function(_0x4246b3,_0x26b20e,_0x1210f8){return db[_0x5029('0x40')][_0x5029('0x66')]({'where':{'id':_0x4246b3[_0x5029('0xb7')]['id']}})['then'](handleEntityNotFound(_0x26b20e,null))['then'](function(_0x3355f8){if(_0x3355f8){return _0x3355f8[_0x5029('0x102')](_0x4246b3[_0x5029('0xb6')]['ids'],_[_0x5029('0x103')](_0x4246b3[_0x5029('0xb6')],[_0x5029('0xfb'),'id'])||{})[_0x5029('0x104')](function(){return db[_0x5029('0x72')][_0x5029('0x105')]({'attributes':['id',_0x5029('0x37'),_0x5029('0x106')],'where':{'id':_0x4246b3[_0x5029('0xb6')][_0x5029('0xfb')]}});})['then'](function(_0x351108){socket[_0x5029('0x107')](_0x5029('0x108'),{'id':Number(_0x4246b3[_0x5029('0xb7')]['id']),'tags':_0x351108||[]});return{'id':Number(_0x4246b3['params']['id']),'tags':_0x351108||[]};});}})[_0x5029('0x35')](respondWithResult(_0x26b20e,null))[_0x5029('0x29')](handleError(_0x26b20e,null));};exports[_0x5029('0x109')]=function(_0x353828,_0x462d02,_0xf147f9){return db[_0x5029('0x40')][_0x5029('0x66')]({'where':{'id':_0x353828['params']['id']}})[_0x5029('0x35')](handleEntityNotFound(_0x462d02,null))[_0x5029('0x35')](function(_0x4050ba){if(_0x4050ba){return _0x4050ba[_0x5029('0x109')](_0x353828[_0x5029('0x45')]['ids']);}})[_0x5029('0x35')](respondWithStatusCode(_0x462d02,null))[_0x5029('0x29')](handleError(_0x462d02,null));};exports[_0x5029('0xd5')]=function(_0x5c119a,_0x12c8ab){var _0x45d7ea=moment()[_0x5029('0x10a')]()['toString']();var _0xcd3b26=path[_0x5029('0xd6')](config[_0x5029('0xd7')],'server',_0x5029('0x10b'),_0x5029('0x10c'));var _0x45b31f=path[_0x5029('0xd6')](config['root'],_0x5029('0x10d'),_0x5029('0x10b'),_0x5029('0x10e'));var _0x195b81=path['join'](_0xcd3b26,_0x45d7ea);var _0x32c962=util['format'](_0x5029('0x10f'),_0x5c119a['params']['id'],_0x45d7ea);var _0x3b20f9=path[_0x5029('0xd6')](_0xcd3b26,_0x32c962);var _0x52f005=[];_0x52f005[_0x5029('0x3e')]({'model':db[_0x5029('0xe0')],'as':_0x5029('0xe0'),'attributes':['id','fullname'],'raw':!![]});_0x52f005[_0x5029('0x3e')]({'model':db[_0x5029('0x110')],'as':_0x5029('0x6b'),'attributes':['id',_0x5029('0x111'),'lastName'],'raw':!![]});if(_0x5c119a[_0x5029('0x45')]['attachments']){_0x52f005[_0x5029('0x3e')]({'model':db[_0x5029('0xd1')],'as':_0x5029('0xd1'),'raw':!![]});}var _0x54523d=[{'model':db[_0x5029('0xc5')],'as':_0x5029('0xe1'),'attributes':['id','body',_0x5029('0xec'),'direction','secret',_0x5029('0x7f')],'include':_0x52f005}];_0x54523d[_0x5029('0x3e')]({'model':db['ChatWebsite'],'as':_0x5029('0x112'),'attributes':['id',_0x5029('0x37')]});_0x54523d[_0x5029('0x3e')]({'model':db['User'],'as':_0x5029('0x113'),'attributes':['id','fullname']});return db[_0x5029('0x40')][_0x5029('0x66')]({'where':{'id':_0x5c119a[_0x5029('0xb7')]['id']},'include':_0x54523d})[_0x5029('0x35')](handleEntityNotFound(_0x12c8ab,null))[_0x5029('0x35')](function(_0x568b05){if(_0x568b05){var _0x19fb32=_0x568b05['get']({'plain':!![]});fs[_0x5029('0x114')](_0x195b81);var _0x524300={'format':'A4','border':'10px','header':{'height':_0x5029('0x115'),'contents':{'first':_0x5029('0x116')}},'footer':{'height':_0x5029('0x117'),'contents':{'default':util[_0x5029('0xdc')](_0x5029('0x118'),util[_0x5029('0xdc')](_0x5029('0x119'),_0x5029('0x11a'),_0x19fb32['id']),moment()[_0x5029('0xdc')](_0x5029('0x11b'))[_0x5029('0x9a')]())}}};var _0x8456be={'channel':_0x5029('0x11a'),'account':_0x19fb32['Account'][_0x5029('0x37')],'agent':_0x19fb32[_0x5029('0x113')]?_0x19fb32[_0x5029('0x113')]['fullname']:_0x5029('0x11c'),'createdAt':moment(_0x19fb32['createdAt'])[_0x5029('0xdc')](_0x5029('0x11d'))['toString'](),'closedAt':_0x19fb32['closed']?moment(_0x19fb32[_0x5029('0x11e')])[_0x5029('0xdc')](_0x5029('0x11d'))[_0x5029('0x9a')]():'','disposition':_0x19fb32[_0x5029('0x11f')],'chatInfo':{'browser':_0x19fb32[_0x5029('0x120')],'os':_0x19fb32['osName'],'referer':_0x19fb32['referer'],'customerIp':_0x19fb32[_0x5029('0x121')],'customerPort':_0x19fb32[_0x5029('0x122')]?_0x19fb32[_0x5029('0x122')]:_0x5029('0x11c')},'messages':_(_0x19fb32['Messages'])[_0x5029('0x123')]()[_0x5029('0x84')]({'secret':![]})[_0x5029('0x39')](function(_0x24fb0a){if(_0x24fb0a[_0x5029('0xd1')]){var _0x8b8ea4=path[_0x5029('0xd6')](_0x45b31f,_0x24fb0a[_0x5029('0xd1')][_0x5029('0xcf')]);if(fs[_0x5029('0x124')](_0x8b8ea4)){fs[_0x5029('0x125')](_0x8b8ea4)[_0x5029('0x126')](fs['createWriteStream'](path['join'](_0x195b81,_0x24fb0a[_0x5029('0xd1')]['basename'])));}}return{'date':moment(_0x24fb0a[_0x5029('0xec')])['format'](_0x5029('0x11d'))[_0x5029('0x9a')](),'sender':_0x24fb0a[_0x5029('0xed')]===_0x5029('0xc4')?_0x24fb0a[_0x5029('0xe0')]?_0x24fb0a[_0x5029('0xe0')]['fullname']:_0x5029('0xe4'):_0x24fb0a['Contact'][_0x5029('0x111')]+(_0x24fb0a['Contact']['lastName']?'\x20'+_0x24fb0a[_0x5029('0x6b')][_0x5029('0x127')]:''),'body':_0x24fb0a[_0x5029('0xd1')]?_0x24fb0a['Attachment']['basename']:_0x24fb0a['body'],'direction':_0x24fb0a[_0x5029('0xed')]===_0x5029('0xc4')?'A':'C','secret':_0x24fb0a[_0x5029('0xff')],'read':_0x24fb0a[_0x5029('0x7f')],'attachment':_0x24fb0a[_0x5029('0xd1')]};})[_0x5029('0x68')]()};return ejs['renderFile'](path[_0x5029('0xd6')](config[_0x5029('0xd7')],'server',_0x5029('0x128'),'downloadInteraction.html'),{'interaction':_0x8456be})[_0x5029('0x35')](function(_0x22cff6){return new BPromise(function(_0x557bc0,_0x3b9b79){pdf['create'](_0x22cff6,_0x524300)[_0x5029('0x129')](path[_0x5029('0xd6')](_0x195b81,_0x5029('0x12a')+_0x19fb32['id']+'-'+_0x45d7ea+_0x5029('0x12b')),function(_0x348ca3,_0x1f1322){if(_0x348ca3)return _0x3b9b79(_0x348ca3);_0x557bc0(_0x1f1322);});});})[_0x5029('0x35')](function(){return new BPromise(function(_0xd4c200,_0x3d5e48){zipdir(_0x195b81,{'saveTo':_0x3b20f9},function(_0x437897,_0x2aef6b){if(_0x437897)return _0x3d5e48(_0x437897);return _0xd4c200(_0x2aef6b);});})[_0x5029('0x35')](function(){return new BPromise(function(_0x3da175,_0x3d9ff4){rimraf(_0x195b81,function(_0x1680eb){if(_0x1680eb)_0x3d9ff4(_0x1680eb);return _0x3da175();});});})['then'](function(){return _0x12c8ab[_0x5029('0xd5')](_0x3b20f9,_0x32c962,function(_0xb7a7fb){if(_0xb7a7fb){console[_0x5029('0x12c')](_0x5029('0x12d'),_0xb7a7fb);}else{fs[_0x5029('0x12e')](_0x3b20f9);}});});});}else{return _0x12c8ab[_0x5029('0x2a')](0xc8);}})['catch'](handleError(_0x12c8ab,null));}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.events.js b/server/api/chatInteraction/chatInteraction.events.js index a7d95a3..aca2a20 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 _0xf105=['events','../../mysqldb','ChatInteraction','ChatMessage','setMaxListeners','update','getUsers','then','setDataValue','map','findAll','length','emit','catch','hasOwnProperty','hook'];(function(_0x6abd7f,_0x23d86a){var _0x2a3b37=function(_0x2eab19){while(--_0x2eab19){_0x6abd7f['push'](_0x6abd7f['shift']());}};_0x2a3b37(++_0x23d86a);}(_0xf105,0x1b0));var _0x5f10=function(_0x1a60b1,_0x1a6171){_0x1a60b1=_0x1a60b1-0x0;var _0x21b0e9=_0xf105[_0x1a60b1];return _0x21b0e9;};'use strict';var EventEmitter=require(_0x5f10('0x0'));var ChatInteraction=require(_0x5f10('0x1'))['db'][_0x5f10('0x2')];var ChatMessage=require(_0x5f10('0x1'))['db'][_0x5f10('0x3')];var ChatInteractionEvents=new EventEmitter();ChatInteractionEvents[_0x5f10('0x4')](0x0);var events={'afterCreate':'save','afterUpdate':_0x5f10('0x5'),'afterDestroy':'remove'};function emitEvent(_0x2c0393){return function(_0x14dcab,_0xd0dde3,_0x1b7489){_0x14dcab[_0x5f10('0x6')]({'attributes':['id'],'raw':!![]})[_0x5f10('0x7')](function(_0x34bd06){_0x14dcab[_0x5f10('0x8')]('Users',_0x34bd06[_0x5f10('0x9')](function(_0x3430fd){return{'id':_0x3430fd['id']};}));return ChatMessage[_0x5f10('0xa')]({'where':{'ChatInteractionId':_0x14dcab['id'],'direction':'in','read':![]},'raw':!![]});})[_0x5f10('0x7')](function(_0x1b5463){_0x14dcab[_0x5f10('0x8')]('unreadMessages',_0x1b5463[_0x5f10('0xb')]);ChatInteractionEvents[_0x5f10('0xc')](_0x2c0393+':'+_0x14dcab['id'],_0x14dcab);ChatInteractionEvents[_0x5f10('0xc')](_0x2c0393,_0x14dcab);_0x1b7489(null);})[_0x5f10('0xd')](_0x1b7489(null));};}for(var e in events){if(events[_0x5f10('0xe')](e)){var event=events[e];ChatInteraction[_0x5f10('0xf')](e,emitEvent(event));}}module['exports']=ChatInteractionEvents; \ No newline at end of file +var _0x3f7d=['findAll','unreadMessages','length','emit','catch','hasOwnProperty','hook','events','../../mysqldb','ChatInteraction','ChatMessage','setMaxListeners','save','update','remove','then','setDataValue','Users','map'];(function(_0x5447fd,_0x52a6b5){var _0x15b28a=function(_0x370d4f){while(--_0x370d4f){_0x5447fd['push'](_0x5447fd['shift']());}};_0x15b28a(++_0x52a6b5);}(_0x3f7d,0x1cf));var _0xd3f7=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x3f7d[_0x321bb2];return _0x9c12ed;};'use strict';var EventEmitter=require(_0xd3f7('0x0'));var ChatInteraction=require(_0xd3f7('0x1'))['db'][_0xd3f7('0x2')];var ChatMessage=require(_0xd3f7('0x1'))['db'][_0xd3f7('0x3')];var ChatInteractionEvents=new EventEmitter();ChatInteractionEvents[_0xd3f7('0x4')](0x0);var events={'afterCreate':_0xd3f7('0x5'),'afterUpdate':_0xd3f7('0x6'),'afterDestroy':_0xd3f7('0x7')};function emitEvent(_0x52b7b3){return function(_0x4cf348,_0x7bc4d6,_0x4eec54){_0x4cf348['getUsers']({'attributes':['id'],'raw':!![]})[_0xd3f7('0x8')](function(_0x189041){_0x4cf348[_0xd3f7('0x9')](_0xd3f7('0xa'),_0x189041[_0xd3f7('0xb')](function(_0x16d010){return{'id':_0x16d010['id']};}));return ChatMessage[_0xd3f7('0xc')]({'where':{'ChatInteractionId':_0x4cf348['id'],'direction':'in','read':![]},'raw':!![]});})[_0xd3f7('0x8')](function(_0x526757){_0x4cf348['setDataValue'](_0xd3f7('0xd'),_0x526757[_0xd3f7('0xe')]);ChatInteractionEvents['emit'](_0x52b7b3+':'+_0x4cf348['id'],_0x4cf348);ChatInteractionEvents[_0xd3f7('0xf')](_0x52b7b3,_0x4cf348);_0x4eec54(null);})[_0xd3f7('0x10')](_0x4eec54(null));};}for(var e in events){if(events[_0xd3f7('0x11')](e)){var event=events[e];ChatInteraction[_0xd3f7('0x12')](e,emitEvent(event));}}module['exports']=ChatInteractionEvents; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.model.js b/server/api/chatInteraction/chatInteraction.model.js index 6b85765..23e4360 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 _0x5184=['YYYY-MM-DD\x20HH:mm:ss','util','api','bluebird','path','define','ChatInteraction','chat_interactions','changed','closed','closedAt'];(function(_0x2abbd9,_0x3b519e){var _0x370282=function(_0x635d87){while(--_0x635d87){_0x2abbd9['push'](_0x2abbd9['shift']());}};_0x370282(++_0x3b519e);}(_0x5184,0x16c));var _0x4518=function(_0x49c433,_0x27c449){_0x49c433=_0x49c433-0x0;var _0x191026=_0x5184[_0x49c433];return _0x191026;};'use strict';var _=require('lodash');var util=require(_0x4518('0x0'));var logger=require('../../config/logger')(_0x4518('0x1'));var moment=require('moment');var BPromise=require(_0x4518('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x4518('0x3'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./chatInteraction.attributes');module['exports']=function(_0x4b5863,_0x3c1e27){return _0x4b5863[_0x4518('0x4')](_0x4518('0x5'),attributes,{'tableName':_0x4518('0x6'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x38154b,_0x9e951e,_0x44fe36){if(_0x38154b[_0x4518('0x7')](_0x4518('0x8'))){_0x38154b[_0x4518('0x9')]=moment()['format'](_0x4518('0xa'));}_0x44fe36(null,_0x38154b);}},'charset':'utf8mb4','collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x7963=['YYYY-MM-DD\x20HH:mm:ss','utf8mb4','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./chatInteraction.attributes','exports','define','ChatInteraction','changed','closed','closedAt','format'];(function(_0x29720b,_0x7e179d){var _0x44c4b4=function(_0x45ca45){while(--_0x45ca45){_0x29720b['push'](_0x29720b['shift']());}};_0x44c4b4(++_0x7e179d);}(_0x7963,0x92));var _0x3796=function(_0x16e5d1,_0x9cf085){_0x16e5d1=_0x16e5d1-0x0;var _0x3f72e6=_0x7963[_0x16e5d1];return _0x3f72e6;};'use strict';var _=require('lodash');var util=require(_0x3796('0x0'));var logger=require(_0x3796('0x1'))(_0x3796('0x2'));var moment=require(_0x3796('0x3'));var BPromise=require('bluebird');var rp=require(_0x3796('0x4'));var fs=require('fs');var path=require(_0x3796('0x5'));var rimraf=require(_0x3796('0x6'));var config=require(_0x3796('0x7'));var attributes=require(_0x3796('0x8'));module[_0x3796('0x9')]=function(_0x6b34af,_0x3190e1){return _0x6b34af[_0x3796('0xa')](_0x3796('0xb'),attributes,{'tableName':'chat_interactions','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x2d4f77,_0x17be6f,_0x5b2220){if(_0x2d4f77[_0x3796('0xc')](_0x3796('0xd'))){_0x2d4f77[_0x3796('0xe')]=moment()[_0x3796('0xf')](_0x3796('0x10'));}_0x5b2220(null,_0x2d4f77);}},'charset':_0x3796('0x11'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.rpc.js b/server/api/chatInteraction/chatInteraction.rpc.js index 15fbbe4..86d63bf 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 _0xc234=['http','redis','defaults','localhost','socket.io-emitter','./chatInteraction.socket','request','then','info','ChatInteraction,\x20%s,\x20%s','request\x20sent','debug','ChatInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','UpdateChatInteraction','ChatInteraction','update','body','options','where','attributes','limit','AddTagsToChatInteraction','find','addTags','ids','omit','spread','AddTags','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client'];(function(_0x5be197,_0x1c1847){var _0x581449=function(_0x328574){while(--_0x328574){_0x5be197['push'](_0x5be197['shift']());}};_0x581449(++_0x1c1847);}(_0xc234,0x1b7));var _0x4c23=function(_0x46774d,_0x559bc8){_0x46774d=_0x46774d-0x0;var _0x187f5a=_0xc234[_0x46774d];return _0x187f5a;};'use strict';var _=require(_0x4c23('0x0'));var util=require(_0x4c23('0x1'));var moment=require('moment');var BPromise=require(_0x4c23('0x2'));var rs=require(_0x4c23('0x3'));var fs=require('fs');var Redis=require(_0x4c23('0x4'));var db=require(_0x4c23('0x5'))['db'];var utils=require(_0x4c23('0x6'));var logger=require(_0x4c23('0x7'))(_0x4c23('0x8'));var config=require(_0x4c23('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x4c23('0xa')][_0x4c23('0xb')]({'port':0x232a});config[_0x4c23('0xc')]=_[_0x4c23('0xd')](config['redis'],{'host':_0x4c23('0xe'),'port':0x18eb});var socket=require(_0x4c23('0xf'))(new Redis(config[_0x4c23('0xc')]));require(_0x4c23('0x10'))['register'](socket);function respondWithRpcPromise(_0x22fe12,_0x1eb1ad,_0x460496){return new BPromise(function(_0x31d285,_0x4430cf){return client[_0x4c23('0x11')](_0x22fe12,_0x460496)[_0x4c23('0x12')](function(_0x17887e){logger[_0x4c23('0x13')](_0x4c23('0x14'),_0x1eb1ad,_0x4c23('0x15'));logger[_0x4c23('0x16')](_0x4c23('0x17'),_0x1eb1ad,_0x4c23('0x15'),JSON[_0x4c23('0x18')](_0x17887e));if(_0x17887e[_0x4c23('0x19')]){if(_0x17887e[_0x4c23('0x19')][_0x4c23('0x1a')]===0x1f4){logger[_0x4c23('0x19')](_0x4c23('0x14'),_0x1eb1ad,_0x17887e[_0x4c23('0x19')][_0x4c23('0x1b')]);return _0x4430cf(_0x17887e[_0x4c23('0x19')][_0x4c23('0x1b')]);}logger[_0x4c23('0x19')](_0x4c23('0x14'),_0x1eb1ad,_0x17887e['error'][_0x4c23('0x1b')]);return _0x31d285(_0x17887e[_0x4c23('0x19')][_0x4c23('0x1b')]);}else{logger['info'](_0x4c23('0x14'),_0x1eb1ad,_0x4c23('0x15'));_0x31d285(_0x17887e[_0x4c23('0x1c')][_0x4c23('0x1b')]);}})[_0x4c23('0x1d')](function(_0x4aa46c){logger[_0x4c23('0x19')](_0x4c23('0x14'),_0x1eb1ad,_0x4aa46c);_0x4430cf(_0x4aa46c);});});}exports[_0x4c23('0x1e')]=function(_0x4e3a64){var _0x2da0db=this;return new Promise(function(_0xbde47a,_0x3a8343){return db[_0x4c23('0x1f')][_0x4c23('0x20')](_0x4e3a64[_0x4c23('0x21')],{'raw':_0x4e3a64[_0x4c23('0x22')]?_0x4e3a64[_0x4c23('0x22')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4e3a64[_0x4c23('0x22')]?_0x4e3a64[_0x4c23('0x22')][_0x4c23('0x23')]||null:null,'attributes':_0x4e3a64['options']?_0x4e3a64[_0x4c23('0x22')][_0x4c23('0x24')]||null:null,'limit':_0x4e3a64['options']?_0x4e3a64[_0x4c23('0x22')][_0x4c23('0x25')]||null:null})[_0x4c23('0x12')](function(_0x56cc67){logger[_0x4c23('0x13')](_0x4c23('0x1e'),_0x4e3a64);logger[_0x4c23('0x16')](_0x4c23('0x1e'),_0x4e3a64,JSON[_0x4c23('0x18')](_0x56cc67));_0xbde47a(_0x56cc67);})[_0x4c23('0x1d')](function(_0x55e27e){logger[_0x4c23('0x19')](_0x4c23('0x1e'),_0x55e27e['message'],_0x4e3a64);_0x3a8343(_0x2da0db[_0x4c23('0x19')](0x1f4,_0x55e27e[_0x4c23('0x1b')]));});});};exports[_0x4c23('0x26')]=function(_0x10eedb){return new Promise(function(_0x3633a8,_0x2f29c1){return db[_0x4c23('0x1f')][_0x4c23('0x27')]({'where':_0x10eedb['options']?_0x10eedb[_0x4c23('0x22')]['where']||null:null})[_0x4c23('0x12')](function(_0x4fa34a){if(_0x4fa34a){return _0x4fa34a[_0x4c23('0x28')](_0x10eedb['body'][_0x4c23('0x29')],_[_0x4c23('0x2a')](_0x10eedb[_0x4c23('0x21')],[_0x4c23('0x29'),'id'])||{});}})[_0x4c23('0x2b')](function(_0x3d2c26){logger[_0x4c23('0x13')]('AddTags',_0x10eedb);logger[_0x4c23('0x16')](_0x4c23('0x2c'),_0x10eedb,JSON[_0x4c23('0x18')](_0x3d2c26));_0x3633a8(_0x3d2c26);})[_0x4c23('0x1d')](function(_0x5384d4){logger['error'](_0x4c23('0x2c'),_0x5384d4[_0x4c23('0x1b')],_0x10eedb);_0x2f29c1(_this['error'](0x1f4,_0x5384d4[_0x4c23('0x1b')]));});});}; \ No newline at end of file +var _0x2286=['../../config/environment','jayson/promise','client','defaults','redis','localhost','socket.io-emitter','./chatInteraction.socket','register','info','request\x20sent','debug','ChatInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','ChatInteraction,\x20%s,\x20%s','message','result','catch','UpdateChatInteraction','ChatInteraction','update','body','options','raw','where','attributes','limit','AddTagsToChatInteraction','find','then','addTags','ids','omit','spread','AddTags','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x43f2af,_0x5c563c){var _0x423674=function(_0x3be993){while(--_0x3be993){_0x43f2af['push'](_0x43f2af['shift']());}};_0x423674(++_0x5c563c);}(_0x2286,0x167));var _0x6228=function(_0x5a4825,_0x27644a){_0x5a4825=_0x5a4825-0x0;var _0x9f2654=_0x2286[_0x5a4825];return _0x9f2654;};'use strict';var _=require(_0x6228('0x0'));var util=require('util');var moment=require(_0x6228('0x1'));var BPromise=require(_0x6228('0x2'));var rs=require(_0x6228('0x3'));var fs=require('fs');var Redis=require(_0x6228('0x4'));var db=require(_0x6228('0x5'))['db'];var utils=require(_0x6228('0x6'));var logger=require(_0x6228('0x7'))(_0x6228('0x8'));var config=require(_0x6228('0x9'));var jayson=require(_0x6228('0xa'));var client=jayson[_0x6228('0xb')]['http']({'port':0x232a});config['redis']=_[_0x6228('0xc')](config[_0x6228('0xd')],{'host':_0x6228('0xe'),'port':0x18eb});var socket=require(_0x6228('0xf'))(new Redis(config[_0x6228('0xd')]));require(_0x6228('0x10'))[_0x6228('0x11')](socket);function respondWithRpcPromise(_0x112a6b,_0x255a7c,_0x26e8c8){return new BPromise(function(_0x392c38,_0x26c305){return client['request'](_0x112a6b,_0x26e8c8)['then'](function(_0x454310){logger[_0x6228('0x12')]('ChatInteraction,\x20%s,\x20%s',_0x255a7c,_0x6228('0x13'));logger[_0x6228('0x14')](_0x6228('0x15'),_0x255a7c,'request\x20sent',JSON[_0x6228('0x16')](_0x454310));if(_0x454310[_0x6228('0x17')]){if(_0x454310[_0x6228('0x17')][_0x6228('0x18')]===0x1f4){logger[_0x6228('0x17')](_0x6228('0x19'),_0x255a7c,_0x454310[_0x6228('0x17')][_0x6228('0x1a')]);return _0x26c305(_0x454310['error'][_0x6228('0x1a')]);}logger[_0x6228('0x17')](_0x6228('0x19'),_0x255a7c,_0x454310[_0x6228('0x17')][_0x6228('0x1a')]);return _0x392c38(_0x454310[_0x6228('0x17')]['message']);}else{logger[_0x6228('0x12')](_0x6228('0x19'),_0x255a7c,_0x6228('0x13'));_0x392c38(_0x454310[_0x6228('0x1b')]['message']);}})[_0x6228('0x1c')](function(_0x1e27b2){logger[_0x6228('0x17')](_0x6228('0x19'),_0x255a7c,_0x1e27b2);_0x26c305(_0x1e27b2);});});}exports[_0x6228('0x1d')]=function(_0x2228ae){var _0x2a0be8=this;return new Promise(function(_0x5dbc46,_0x152a62){return db[_0x6228('0x1e')][_0x6228('0x1f')](_0x2228ae[_0x6228('0x20')],{'raw':_0x2228ae[_0x6228('0x21')]?_0x2228ae[_0x6228('0x21')][_0x6228('0x22')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2228ae['options']?_0x2228ae[_0x6228('0x21')][_0x6228('0x23')]||null:null,'attributes':_0x2228ae[_0x6228('0x21')]?_0x2228ae['options'][_0x6228('0x24')]||null:null,'limit':_0x2228ae[_0x6228('0x21')]?_0x2228ae['options'][_0x6228('0x25')]||null:null})['then'](function(_0x407063){logger['info']('UpdateChatInteraction',_0x2228ae);logger[_0x6228('0x14')](_0x6228('0x1d'),_0x2228ae,JSON['stringify'](_0x407063));_0x5dbc46(_0x407063);})['catch'](function(_0x53a0a9){logger[_0x6228('0x17')]('UpdateChatInteraction',_0x53a0a9['message'],_0x2228ae);_0x152a62(_0x2a0be8[_0x6228('0x17')](0x1f4,_0x53a0a9[_0x6228('0x1a')]));});});};exports[_0x6228('0x26')]=function(_0x2e1fd6){return new Promise(function(_0xbc2052,_0x22cafc){return db['ChatInteraction'][_0x6228('0x27')]({'where':_0x2e1fd6['options']?_0x2e1fd6[_0x6228('0x21')][_0x6228('0x23')]||null:null})[_0x6228('0x28')](function(_0x46f8ce){if(_0x46f8ce){return _0x46f8ce[_0x6228('0x29')](_0x2e1fd6[_0x6228('0x20')][_0x6228('0x2a')],_[_0x6228('0x2b')](_0x2e1fd6['body'],[_0x6228('0x2a'),'id'])||{});}})[_0x6228('0x2c')](function(_0x271609){logger[_0x6228('0x12')](_0x6228('0x2d'),_0x2e1fd6);logger[_0x6228('0x14')](_0x6228('0x2d'),_0x2e1fd6,JSON[_0x6228('0x16')](_0x271609));_0xbc2052(_0x271609);})['catch'](function(_0x431e2e){logger['error']('AddTags',_0x431e2e['message'],_0x2e1fd6);_0x22cafc(_this[_0x6228('0x17')](0x1f4,_0x431e2e[_0x6228('0x1a')]));});});}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.socket.js b/server/api/chatInteraction/chatInteraction.socket.js index 14e1b76..9c7d2ab 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 _0x6925=['save','update','emit','length','chatInteraction:','./chatInteraction.events'];(function(_0x718493,_0x485616){var _0x59af54=function(_0x21268d){while(--_0x21268d){_0x718493['push'](_0x718493['shift']());}};_0x59af54(++_0x485616);}(_0x6925,0x1f1));var _0x5692=function(_0x55cebe,_0xb85afd){_0x55cebe=_0x55cebe-0x0;var _0x14c2be=_0x6925[_0x55cebe];return _0x14c2be;};'use strict';var ChatInteractionEvents=require(_0x5692('0x0'));var events=[_0x5692('0x1'),'remove',_0x5692('0x2')];function createListener(_0x10720a,_0x31061a){return function(_0xaead20){_0x31061a[_0x5692('0x3')](_0x10720a,_0xaead20);};}function removeListener(_0x4abb34,_0x253b80){return function(){ChatInteractionEvents['removeListener'](_0x4abb34,_0x253b80);};}exports['register']=function(_0x34eaa6){for(var _0x4843b3=0x0,_0x2e4871=events[_0x5692('0x4')];_0x4843b3<_0x2e4871;_0x4843b3++){var _0x71162b=events[_0x4843b3];var _0x41fb93=createListener(_0x5692('0x5')+_0x71162b,_0x34eaa6);ChatInteractionEvents['on'](_0x71162b,_0x41fb93);}}; \ No newline at end of file +var _0xf38a=['register','chatInteraction:','./chatInteraction.events','save','remove'];(function(_0x5345e0,_0x1c93a4){var _0x35e35b=function(_0x2925ba){while(--_0x2925ba){_0x5345e0['push'](_0x5345e0['shift']());}};_0x35e35b(++_0x1c93a4);}(_0xf38a,0x133));var _0xaf38=function(_0x2d994d,_0x168a27){_0x2d994d=_0x2d994d-0x0;var _0xd54be4=_0xf38a[_0x2d994d];return _0xd54be4;};'use strict';var ChatInteractionEvents=require(_0xaf38('0x0'));var events=[_0xaf38('0x1'),_0xaf38('0x2'),'update'];function createListener(_0x17e63b,_0x38cc07){return function(_0x6570b6){_0x38cc07['emit'](_0x17e63b,_0x6570b6);};}function removeListener(_0x275a3b,_0x5e2baf){return function(){ChatInteractionEvents['removeListener'](_0x275a3b,_0x5e2baf);};}exports[_0xaf38('0x3')]=function(_0x13a854){for(var _0x25b1ee=0x0,_0x22d364=events['length'];_0x25b1ee<_0x22d364;_0x25b1ee++){var _0x34144d=events[_0x25b1ee];var _0xdccb18=createListener(_0xaf38('0x4')+_0x34144d,_0x13a854);ChatInteractionEvents['on'](_0x34144d,_0xdccb18);}}; \ No newline at end of file diff --git a/server/api/chatInteraction/index.js b/server/api/chatInteraction/index.js index eeb45e3..e4b7334 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 _0x8533=['attachmentDownload','/:id/messages','getMessages','/:id/my_messages','/:id/download','download','create','post','/:id/vidaoo','join','root','format','%s-%s','now','originalname','replace','single','attachmentUpload','addMessage','/:id/tags','chat','chatinteraction:addtags','addTags','put','tracked','chatinteraction:update','/:id/abandon','abandon','close','delete','destroy','removeTags','exports','multer','util','path','express','Router','../../components/interaction/service','./chatInteraction.controller','isAuthenticated','index','get','/describe','describe','/:id','/:id/attachment_download','isChatInteractionAuthorized'];(function(_0x173441,_0x26b0d9){var _0x2423a8=function(_0x4d96c2){while(--_0x4d96c2){_0x173441['push'](_0x173441['shift']());}};_0x2423a8(++_0x26b0d9);}(_0x8533,0x141));var _0x3853=function(_0x44a86f,_0x5e37d6){_0x44a86f=_0x44a86f-0x0;var _0x2a7458=_0x8533[_0x44a86f];return _0x2a7458;};'use strict';var multer=require(_0x3853('0x0'));var util=require(_0x3853('0x1'));var path=require(_0x3853('0x2'));var timeout=require('connect-timeout');var express=require(_0x3853('0x3'));var router=express[_0x3853('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x3853('0x5'));var config=require('../../config/environment');var controller=require(_0x3853('0x6'));router['get']('/',auth[_0x3853('0x7')](),controller[_0x3853('0x8')]);router[_0x3853('0x9')](_0x3853('0xa'),auth['isAuthenticated'](),controller[_0x3853('0xb')]);router[_0x3853('0x9')](_0x3853('0xc'),auth['isChatInteractionAuthorized'](),controller['show']);router[_0x3853('0x9')](_0x3853('0xd'),auth[_0x3853('0xe')](),controller[_0x3853('0xf')]);router['get'](_0x3853('0x10'),auth[_0x3853('0x7')](),controller[_0x3853('0x11')]);router[_0x3853('0x9')](_0x3853('0x12'),auth[_0x3853('0xe')](),controller['getMyMessages']);router[_0x3853('0x9')](_0x3853('0x13'),auth[_0x3853('0x7')](),controller[_0x3853('0x14')]);router['post']('/',auth[_0x3853('0x7')](),controller[_0x3853('0x15')]);router[_0x3853('0x16')](_0x3853('0x17'),auth['isAuthenticated'](),controller['createVidaooSession']);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x130b7b,_0x77518,_0x378431){_0x378431(null,path[_0x3853('0x18')](config[_0x3853('0x19')],'server/files/attachments/'));},'filename':function(_0x14c3df,_0x4bf82a,_0x28f339){_0x28f339(null,util[_0x3853('0x1a')](_0x3853('0x1b'),Date[_0x3853('0x1c')](),_0x4bf82a[_0x3853('0x1d')][_0x3853('0x1e')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router['post']('/:id/attachment_upload',upload[_0x3853('0x1f')]('file'),controller[_0x3853('0x20')]);router[_0x3853('0x16')]('/:id/messages',auth[_0x3853('0xe')](),controller[_0x3853('0x21')]);router[_0x3853('0x16')](_0x3853('0x22'),auth[_0x3853('0x7')](),interaction['tracked'](_0x3853('0x23'),_0x3853('0x24')),controller[_0x3853('0x25')]);router[_0x3853('0x26')](_0x3853('0xc'),auth[_0x3853('0x7')](),interaction[_0x3853('0x27')]('chat',_0x3853('0x28')),controller['update']);router[_0x3853('0x26')]('/:id/custom_update',controller['customUpdate']);router[_0x3853('0x26')](_0x3853('0x29'),auth[_0x3853('0xe')](),controller[_0x3853('0x2a')]);router[_0x3853('0x26')]('/:id/close',controller[_0x3853('0x2b')]);router[_0x3853('0x2c')]('/:id',auth[_0x3853('0x7')](),interaction['tracked']('chat','chatinteraction:destroy'),controller[_0x3853('0x2d')]);router[_0x3853('0x2c')](_0x3853('0x22'),auth['isAuthenticated'](),controller[_0x3853('0x2e')]);module[_0x3853('0x2f')]=router; \ No newline at end of file +var _0xd052=['chatinteraction:update','update','/:id/custom_update','customUpdate','/:id/close','close','delete','chatinteraction:destroy','destroy','removeTags','exports','path','express','../../components/interaction/service','./chatInteraction.controller','get','index','/describe','isAuthenticated','describe','/:id','isChatInteractionAuthorized','show','/:id/attachment_download','/:id/messages','getMessages','/:id/download','post','create','createVidaooSession','diskStorage','root','server/files/attachments/','format','%s-%s','now','replace','/:id/attachment_upload','file','attachmentUpload','addMessage','/:id/tags','tracked','chatinteraction:addtags','addTags','put','chat'];(function(_0x1bc930,_0x5b74cd){var _0x24eda7=function(_0x494b73){while(--_0x494b73){_0x1bc930['push'](_0x1bc930['shift']());}};_0x24eda7(++_0x5b74cd);}(_0xd052,0x69));var _0x2d05=function(_0x1b87a5,_0x5875ef){_0x1b87a5=_0x1b87a5-0x0;var _0x212666=_0xd052[_0x1b87a5];return _0x212666;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x2d05('0x0'));var timeout=require('connect-timeout');var express=require(_0x2d05('0x1'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0x2d05('0x2'));var config=require('../../config/environment');var controller=require(_0x2d05('0x3'));router[_0x2d05('0x4')]('/',auth['isAuthenticated'](),controller[_0x2d05('0x5')]);router[_0x2d05('0x4')](_0x2d05('0x6'),auth[_0x2d05('0x7')](),controller[_0x2d05('0x8')]);router[_0x2d05('0x4')](_0x2d05('0x9'),auth[_0x2d05('0xa')](),controller[_0x2d05('0xb')]);router[_0x2d05('0x4')](_0x2d05('0xc'),auth['isChatInteractionAuthorized'](),controller['attachmentDownload']);router['get'](_0x2d05('0xd'),auth[_0x2d05('0x7')](),controller[_0x2d05('0xe')]);router[_0x2d05('0x4')]('/:id/my_messages',auth[_0x2d05('0xa')](),controller['getMyMessages']);router[_0x2d05('0x4')](_0x2d05('0xf'),auth[_0x2d05('0x7')](),controller['download']);router[_0x2d05('0x10')]('/',auth[_0x2d05('0x7')](),controller[_0x2d05('0x11')]);router['post']('/:id/vidaoo',auth['isAuthenticated'](),controller[_0x2d05('0x12')]);var upload=multer({'storage':multer[_0x2d05('0x13')]({'destination':function(_0x4cf64f,_0x2a68bd,_0x5bf467){_0x5bf467(null,path['join'](config[_0x2d05('0x14')],_0x2d05('0x15')));},'filename':function(_0x4b02be,_0x15b13c,_0x3f9b30){_0x3f9b30(null,util[_0x2d05('0x16')](_0x2d05('0x17'),Date[_0x2d05('0x18')](),_0x15b13c['originalname'][_0x2d05('0x19')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0x2d05('0x10')](_0x2d05('0x1a'),upload['single'](_0x2d05('0x1b')),controller[_0x2d05('0x1c')]);router[_0x2d05('0x10')](_0x2d05('0xd'),auth[_0x2d05('0xa')](),controller[_0x2d05('0x1d')]);router[_0x2d05('0x10')](_0x2d05('0x1e'),auth[_0x2d05('0x7')](),interaction[_0x2d05('0x1f')]('chat',_0x2d05('0x20')),controller[_0x2d05('0x21')]);router[_0x2d05('0x22')](_0x2d05('0x9'),auth[_0x2d05('0x7')](),interaction[_0x2d05('0x1f')](_0x2d05('0x23'),_0x2d05('0x24')),controller[_0x2d05('0x25')]);router['put'](_0x2d05('0x26'),controller[_0x2d05('0x27')]);router[_0x2d05('0x22')]('/:id/abandon',auth['isChatInteractionAuthorized'](),controller['abandon']);router[_0x2d05('0x22')](_0x2d05('0x28'),controller[_0x2d05('0x29')]);router[_0x2d05('0x2a')](_0x2d05('0x9'),auth['isAuthenticated'](),interaction[_0x2d05('0x1f')]('chat',_0x2d05('0x2b')),controller[_0x2d05('0x2c')]);router[_0x2d05('0x2a')](_0x2d05('0x1e'),auth[_0x2d05('0x7')](),controller[_0x2d05('0x2d')]);module[_0x2d05('0x2e')]=router; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.attributes.js b/server/api/chatInternalMessage/chatInternalMessage.attributes.js index 1f2908d..dc5af17 100644 --- a/server/api/chatInternalMessage/chatInternalMessage.attributes.js +++ b/server/api/chatInternalMessage/chatInternalMessage.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xda2d=['medium','BOOLEAN','INTEGER','exports','TEXT'];(function(_0x32bda0,_0x807e85){var _0x4122ce=function(_0x505fa8){while(--_0x505fa8){_0x32bda0['push'](_0x32bda0['shift']());}};_0x4122ce(++_0x807e85);}(_0xda2d,0x102));var _0xdda2=function(_0x535594,_0x405ab6){_0x535594=_0x535594-0x0;var _0x26ec47=_0xda2d[_0x535594];return _0x26ec47;};'use strict';var Sequelize=require('sequelize');module[_0xdda2('0x0')]={'body':{'type':Sequelize[_0xdda2('0x1')](_0xdda2('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0xdda2('0x3')],'defaultValue':![]},'ChatInternalMessageId':{'type':Sequelize[_0xdda2('0x4')]}}; \ No newline at end of file +var _0xadb5=['INTEGER','exports','medium','BOOLEAN'];(function(_0x2f0948,_0x1e86ee){var _0x3de563=function(_0x5c1dbc){while(--_0x5c1dbc){_0x2f0948['push'](_0x2f0948['shift']());}};_0x3de563(++_0x1e86ee);}(_0xadb5,0xad));var _0x5adb=function(_0xe36231,_0x5c222d){_0xe36231=_0xe36231-0x0;var _0x3cac4e=_0xadb5[_0xe36231];return _0x3cac4e;};'use strict';var Sequelize=require('sequelize');module[_0x5adb('0x0')]={'body':{'type':Sequelize['TEXT'](_0x5adb('0x1')),'allowNull':![]},'read':{'type':Sequelize[_0x5adb('0x2')],'defaultValue':![]},'ChatInternalMessageId':{'type':Sequelize[_0x5adb('0x3')]}}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.controller.js b/server/api/chatInternalMessage/chatInternalMessage.controller.js index 6f6472a..b541cda 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 _0x492d=['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','redis','defaults','socket.io-emitter','./chatInternalMessage.socket','register','sendStatus','status','count','offset','limit','set','Content-Range','json','apply','reject','update','then','destroy','end','error','stack','name','index','map','ChatInternalMessage','rawAttributes','fieldName','type','key','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','where','pick','filter','merge','options','includeAll','rows','catch','show','keys','include','create','body','find','params','describe','messages','lastMessageAt','createdAt','lastMessage','format','getUsers','User','findAll','agent','fullname','role','internal','lastLoginAt','allowmessenger','showWebBar','sort','VoiceQueue','VoiceQueues','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','Agents','userProfileId','autoAssociation','isEmpty','push','ToId','read','-createdAt','all','html-pdf','zip-dir','mustache','util','path','sox'];(function(_0x25d403,_0x5612bb){var _0x3f3b24=function(_0x4c0691){while(--_0x4c0691){_0x25d403['push'](_0x25d403['shift']());}};_0x3f3b24(++_0x5612bb);}(_0x492d,0x64));var _0xd492=function(_0x28a180,_0x2eb1f7){_0x28a180=_0x28a180-0x0;var _0x1071a8=_0x492d[_0x28a180];return _0x1071a8;};'use strict';var pdf=require(_0xd492('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xd492('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xd492('0x2'));var util=require(_0xd492('0x3'));var path=require(_0xd492('0x4'));var sox=require(_0xd492('0x5'));var csv=require('to-csv');var ejs=require(_0xd492('0x6'));var fs=require('fs');var _=require(_0xd492('0x7'));var squel=require(_0xd492('0x8'));var crypto=require(_0xd492('0x9'));var jsforce=require('jsforce');var deskjs=require(_0xd492('0xa'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xd492('0xb'));var Redis=require(_0xd492('0xc'));var authService=require(_0xd492('0xd'));var qs=require(_0xd492('0xe'));var as=require(_0xd492('0xf'));var hardwareService=require(_0xd492('0x10'));var logger=require(_0xd492('0x11'))(_0xd492('0x12'));var utils=require(_0xd492('0x13'));var config=require('../../config/environment');var db=require(_0xd492('0x14'))['db'];config[_0xd492('0x15')]=_[_0xd492('0x16')](config[_0xd492('0x15')],{'host':'localhost','port':0x18eb});var socket=require(_0xd492('0x17'))(new Redis(config[_0xd492('0x15')]));require(_0xd492('0x18'))[_0xd492('0x19')](socket);function respondWithStatusCode(_0xb8460b,_0x75268e){_0x75268e=_0x75268e||0xcc;return function(_0x339e01){if(_0x339e01){return _0xb8460b[_0xd492('0x1a')](_0x75268e);}return _0xb8460b[_0xd492('0x1b')](_0x75268e)['end']();};}function respondWithResult(_0x23b6cd,_0x250a11){_0x250a11=_0x250a11||0xc8;return function(_0x906aa6){if(_0x906aa6){return _0x23b6cd[_0xd492('0x1b')](_0x250a11)['json'](_0x906aa6);}};}function respondWithFilteredResult(_0x552049,_0x283c77){return function(_0x279d38){if(_0x279d38){var _0x546d62=_0x279d38[_0xd492('0x1c')],_0xed587e=_0x283c77[_0xd492('0x1d')],_0x4dc0f5=_0x283c77[_0xd492('0x1d')]+_0x283c77[_0xd492('0x1e')],_0xd324ff;if(_0x4dc0f5>=_0x546d62){_0x4dc0f5=_0x546d62;_0xd324ff=0xc8;}else{_0xd324ff=0xce;}_0x552049['status'](_0xd324ff);return _0x552049[_0xd492('0x1f')](_0xd492('0x20'),_0xed587e+'-'+_0x4dc0f5+'/'+_0x546d62)[_0xd492('0x21')](_0x279d38);}return null;};}function patchUpdates(_0x306615){return function(_0x1f0aa3){try{jsonpatch[_0xd492('0x22')](_0x1f0aa3,_0x306615,!![]);}catch(_0x1868b6){return BPromise[_0xd492('0x23')](_0x1868b6);}return _0x1f0aa3['save']();};}function saveUpdates(_0x25200e,_0x17078c){return function(_0x4fcda1){if(_0x4fcda1){return _0x4fcda1[_0xd492('0x24')](_0x25200e)[_0xd492('0x25')](function(_0x15715f){return _0x15715f;});}return null;};}function removeEntity(_0x1110b9,_0x312e82){return function(_0x78adfa){if(_0x78adfa){return _0x78adfa[_0xd492('0x26')]()[_0xd492('0x25')](function(){_0x1110b9[_0xd492('0x1b')](0xcc)[_0xd492('0x27')]();});}};}function handleEntityNotFound(_0x93bb3d,_0x2dee5d){return function(_0x88a33f){if(!_0x88a33f){_0x93bb3d[_0xd492('0x1a')](0x194);}return _0x88a33f;};}function handleError(_0x44dd88,_0x17004d){_0x17004d=_0x17004d||0x1f4;return function(_0x46a132){logger[_0xd492('0x28')](_0x46a132[_0xd492('0x29')]);if(_0x46a132[_0xd492('0x2a')]){delete _0x46a132[_0xd492('0x2a')];}_0x44dd88[_0xd492('0x1b')](_0x17004d)['send'](_0x46a132);};}exports[_0xd492('0x2b')]=function(_0x553d17,_0x4a822b){var _0x5b248a={},_0x5079f7={},_0x4701fe={'count':0x0,'rows':[]};var _0x28b838=_[_0xd492('0x2c')](db[_0xd492('0x2d')][_0xd492('0x2e')],function(_0x2492d5){return{'name':_0x2492d5[_0xd492('0x2f')],'type':_0x2492d5[_0xd492('0x30')][_0xd492('0x31')]};});_0x5079f7[_0xd492('0x32')]=_['map'](_0x28b838,_0xd492('0x2a'));_0x5079f7[_0xd492('0x33')]=_['keys'](_0x553d17['query']);_0x5079f7[_0xd492('0x34')]=_[_0xd492('0x35')](_0x5079f7[_0xd492('0x32')],_0x5079f7[_0xd492('0x33')]);_0x5b248a['attributes']=_['intersection'](_0x5079f7['model'],qs[_0xd492('0x36')](_0x553d17[_0xd492('0x33')][_0xd492('0x36')]));_0x5b248a[_0xd492('0x37')]=_0x5b248a[_0xd492('0x37')][_0xd492('0x38')]?_0x5b248a[_0xd492('0x37')]:_0x5079f7[_0xd492('0x32')];if(!_0x553d17[_0xd492('0x33')][_0xd492('0x39')](_0xd492('0x3a'))){_0x5b248a[_0xd492('0x1e')]=qs['limit'](_0x553d17[_0xd492('0x33')][_0xd492('0x1e')]);_0x5b248a['offset']=qs['offset'](_0x553d17[_0xd492('0x33')][_0xd492('0x1d')]);}_0x5b248a[_0xd492('0x3b')]=qs['sort'](_0x553d17[_0xd492('0x33')]['sort']);_0x5b248a[_0xd492('0x3c')]=qs[_0xd492('0x34')](_[_0xd492('0x3d')](_0x553d17['query'],_0x5079f7[_0xd492('0x34')]),_0x28b838);if(_0x553d17['query'][_0xd492('0x3e')]){_0x5b248a[_0xd492('0x3c')]=_[_0xd492('0x3f')](_0x5b248a[_0xd492('0x3c')],{'$or':_[_0xd492('0x2c')](_0x28b838,function(_0x3a27e0){if(_0x3a27e0[_0xd492('0x30')]!=='VIRTUAL'){var _0x2df73d={};_0x2df73d[_0x3a27e0['name']]={'$like':'%'+_0x553d17[_0xd492('0x33')][_0xd492('0x3e')]+'%'};return _0x2df73d;}})});}_0x5b248a=_[_0xd492('0x3f')]({},_0x5b248a,_0x553d17[_0xd492('0x40')]);var _0x4dc9e3={'where':_0x5b248a[_0xd492('0x3c')]};return db['ChatInternalMessage'][_0xd492('0x1c')](_0x4dc9e3)[_0xd492('0x25')](function(_0x56e272){_0x4701fe['count']=_0x56e272;if(_0x553d17['query'][_0xd492('0x41')]){_0x5b248a['include']=[{'all':!![]}];}return db[_0xd492('0x2d')]['findAll'](_0x5b248a);})['then'](function(_0x1646c6){_0x4701fe[_0xd492('0x42')]=_0x1646c6;return _0x4701fe;})[_0xd492('0x25')](respondWithFilteredResult(_0x4a822b,_0x5b248a))[_0xd492('0x43')](handleError(_0x4a822b,null));};exports[_0xd492('0x44')]=function(_0x5a6ed7,_0x388d09){var _0x3a08aa={'raw':!![],'where':{'id':_0x5a6ed7['params']['id']}},_0x2363a9={};_0x2363a9[_0xd492('0x32')]=_[_0xd492('0x45')](db[_0xd492('0x2d')][_0xd492('0x2e')]);_0x2363a9[_0xd492('0x33')]=_[_0xd492('0x45')](_0x5a6ed7[_0xd492('0x33')]);_0x2363a9[_0xd492('0x34')]=_[_0xd492('0x35')](_0x2363a9[_0xd492('0x32')],_0x2363a9[_0xd492('0x33')]);_0x3a08aa[_0xd492('0x37')]=_[_0xd492('0x35')](_0x2363a9[_0xd492('0x32')],qs[_0xd492('0x36')](_0x5a6ed7[_0xd492('0x33')]['fields']));_0x3a08aa[_0xd492('0x37')]=_0x3a08aa[_0xd492('0x37')][_0xd492('0x38')]?_0x3a08aa[_0xd492('0x37')]:_0x2363a9[_0xd492('0x32')];if(_0x5a6ed7['query'][_0xd492('0x41')]){_0x3a08aa[_0xd492('0x46')]=[{'all':!![]}];}_0x3a08aa=_[_0xd492('0x3f')]({},_0x3a08aa,_0x5a6ed7[_0xd492('0x40')]);return db[_0xd492('0x2d')]['find'](_0x3a08aa)[_0xd492('0x25')](handleEntityNotFound(_0x388d09,null))[_0xd492('0x25')](respondWithResult(_0x388d09,null))[_0xd492('0x43')](handleError(_0x388d09,null));};exports['create']=function(_0x6cdeb2,_0x20400d){return db[_0xd492('0x2d')][_0xd492('0x47')](_0x6cdeb2['body'],{})[_0xd492('0x25')](respondWithResult(_0x20400d,0xc9))[_0xd492('0x43')](handleError(_0x20400d,null));};exports['update']=function(_0xb2d3bf,_0x4cb329){if(_0xb2d3bf['body']['id']){delete _0xb2d3bf[_0xd492('0x48')]['id'];}return db[_0xd492('0x2d')][_0xd492('0x49')]({'where':{'id':_0xb2d3bf[_0xd492('0x4a')]['id']}})['then'](handleEntityNotFound(_0x4cb329,null))['then'](saveUpdates(_0xb2d3bf['body'],null))[_0xd492('0x25')](respondWithResult(_0x4cb329,null))[_0xd492('0x43')](handleError(_0x4cb329,null));};exports[_0xd492('0x26')]=function(_0x45b192,_0x28f66f){return db[_0xd492('0x2d')][_0xd492('0x49')]({'where':{'id':_0x45b192[_0xd492('0x4a')]['id']}})[_0xd492('0x25')](handleEntityNotFound(_0x28f66f,null))[_0xd492('0x25')](removeEntity(_0x28f66f,null))[_0xd492('0x43')](handleError(_0x28f66f,null));};exports[_0xd492('0x4b')]=function(_0x437c42,_0x33ba33){return db[_0xd492('0x2d')]['describe']()[_0xd492('0x25')](respondWithResult(_0x33ba33,null))[_0xd492('0x43')](handleError(_0x33ba33,null));};function wrapUser(_0x267b8d){return function(_0xf4b928){var _0x56ef37=_0x267b8d['get']({'plain':!![]});_0x56ef37[_0xd492('0x4c')]=[];if(_0xf4b928){_0x56ef37[_0xd492('0x4d')]=_0xf4b928[_0xd492('0x4e')];_0x56ef37[_0xd492('0x4f')]=_0xf4b928;}else{_0x56ef37[_0xd492('0x4d')]=moment(0x0)[_0xd492('0x50')]('YYYY-MM-DD\x20HH:mm:ss');_0x56ef37['lastMessage']={};}return _0x56ef37;};}exports[_0xd492('0x51')]=function(_0x4af32e,_0x3904ea,_0x9ba9c6){var _0x4993f5=[];return db[_0xd492('0x52')][_0xd492('0x53')]({'where':{'role':[_0xd492('0x54'),'admin','user']},'attributes':['id',_0xd492('0x55'),'name',_0xd492('0x56'),'userpic',_0xd492('0x57'),'online',_0xd492('0x58'),_0xd492('0x59'),_0xd492('0x5a')],'order':qs[_0xd492('0x5b')]('-online'),'include':[{'model':db[_0xd492('0x5c')],'as':_0xd492('0x5d'),'attributes':['id',_0xd492('0x2a'),_0xd492('0x30')],'through':{'attributes':[]}}]})[_0xd492('0x25')](function(_0x533bb3){if(_0x533bb3){var _0x532b52=_0x4af32e[_0xd492('0x5e')]['get']({'plain':!![]});if(!_0x532b52)throw new Error(_0xd492('0x5f'));if(_0x532b52['role']===_0xd492('0x5e')){return db[_0xd492('0x60')][_0xd492('0x49')]({'where':{'name':_0xd492('0x61'),'userProfileId':_0x532b52[_0xd492('0x62')]},'raw':!![]})[_0xd492('0x25')](function(_0x22ae98){if(_0x22ae98){if(_0x22ae98[_0xd492('0x63')]===0x0){return db['UserProfileResource'][_0xd492('0x53')]({'where':{'sectionId':_0x22ae98['id']},'raw':!![]})[_0xd492('0x25')](function(_0x335621){var _0x4f6405=[];if(_[_0xd492('0x64')](_0x335621)){_0x4f6405=_[_0xd492('0x3e')](_0x533bb3,function(_0xdc77df){if(_0xdc77df[_0xd492('0x56')]!=='agent'){return _0xdc77df;}});return _0x4f6405;}else{for(var _0x390833=0x0;_0x390833<_0x533bb3[_0xd492('0x38')];_0x390833++){var _0x37eeb8=_0x533bb3[_0x390833];if(_0x37eeb8[_0xd492('0x56')]==='agent'){var _0x4c1bb0=_[_0xd492('0x49')](_0x335621,function(_0x36bd06){return _0x36bd06['resourceId']===_0x37eeb8['id'];});if(_0x4c1bb0)_0x4f6405[_0xd492('0x65')](_0x37eeb8);}else{_0x4f6405[_0xd492('0x65')](_0x37eeb8);}}return _0x4f6405;}});}else{return _0x533bb3;}}else{var _0x4603a8=_[_0xd492('0x3e')](_0x533bb3,function(_0x2db5c6){if(_0x2db5c6[_0xd492('0x56')]!=='agent'){return _0x2db5c6;}});return _0x4603a8;}});}else{return _0x533bb3;}}})['then'](function(_0x135b94){var _0x54f331=[];if(_0x135b94){_0x4993f5=_0x135b94;for(var _0x108466=0x0;_0x108466<_0x135b94[_0xd492('0x38')];_0x108466+=0x1){_0x4993f5[_0x108466][_0xd492('0x4c')]=[];_0x54f331[_0xd492('0x65')](db[_0xd492('0x2d')][_0xd492('0x49')]({'where':{'FromId':[_0x4af32e[_0xd492('0x5e')]['id'],_0x135b94[_0x108466]['id']],'ToId':[_0x4af32e[_0xd492('0x5e')]['id'],_0x135b94[_0x108466]['id']],'ChatGroupId':null},'attributes':['id',_0xd492('0x4e'),'FromId',_0xd492('0x66'),_0xd492('0x67'),'body'],'order':qs['sort'](_0xd492('0x68')),'limit':0x1,'offset':0x0,'raw':!![]})['then'](wrapUser(_0x135b94[_0x108466])));}return BPromise[_0xd492('0x69')](_0x54f331);}return[];})[_0xd492('0x25')](function(_0x1a8427){return{'rows':_0x1a8427,'count':_0x1a8427[_0xd492('0x38')]};})[_0xd492('0x25')](respondWithResult(_0x3904ea,null))['catch'](handleError(_0x3904ea,null));}; \ No newline at end of file +var _0x7c86=['intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','rows','catch','show','params','length','include','find','body','update','describe','get','messages','lastMessageAt','createdAt','lastMessage','format','YYYY-MM-DD\x20HH:mm:ss','getUsers','findAll','agent','admin','user','role','userpic','online','lastLoginAt','showWebBar','VoiceQueue','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','isEmpty','resourceId','push','FromId','all','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','to-csv','ejs','lodash','squel','crypto','jsforce','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','redis','defaults','localhost','./chatInternalMessage.socket','register','status','end','json','count','offset','limit','set','reject','save','then','destroy','sendStatus','error','send','index','map','ChatInternalMessage','rawAttributes','fieldName','type','key','model','name','query','keys','filters'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x7c86,0x171));var _0x67c8=function(_0x341e0f,_0x4a09d0){_0x341e0f=_0x341e0f-0x0;var _0x59555a=_0x7c86[_0x341e0f];return _0x59555a;};'use strict';var pdf=require(_0x67c8('0x0'));var emlformat=require(_0x67c8('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x67c8('0x2'));var jsonpatch=require(_0x67c8('0x3'));var rp=require(_0x67c8('0x4'));var moment=require(_0x67c8('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x67c8('0x6'));var util=require(_0x67c8('0x7'));var path=require(_0x67c8('0x8'));var sox=require('sox');var csv=require(_0x67c8('0x9'));var ejs=require(_0x67c8('0xa'));var fs=require('fs');var _=require(_0x67c8('0xb'));var squel=require(_0x67c8('0xc'));var crypto=require(_0x67c8('0xd'));var jsforce=require(_0x67c8('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x67c8('0x9'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x67c8('0xf'));var authService=require(_0x67c8('0x10'));var qs=require(_0x67c8('0x11'));var as=require(_0x67c8('0x12'));var hardwareService=require(_0x67c8('0x13'));var logger=require(_0x67c8('0x14'))(_0x67c8('0x15'));var utils=require(_0x67c8('0x16'));var config=require('../../config/environment');var db=require(_0x67c8('0x17'))['db'];config[_0x67c8('0x18')]=_[_0x67c8('0x19')](config[_0x67c8('0x18')],{'host':_0x67c8('0x1a'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x67c8('0x18')]));require(_0x67c8('0x1b'))[_0x67c8('0x1c')](socket);function respondWithStatusCode(_0x10a6d1,_0xdd44ae){_0xdd44ae=_0xdd44ae||0xcc;return function(_0xc73b4d){if(_0xc73b4d){return _0x10a6d1['sendStatus'](_0xdd44ae);}return _0x10a6d1[_0x67c8('0x1d')](_0xdd44ae)[_0x67c8('0x1e')]();};}function respondWithResult(_0x4347e5,_0x37ed79){_0x37ed79=_0x37ed79||0xc8;return function(_0x483ff9){if(_0x483ff9){return _0x4347e5[_0x67c8('0x1d')](_0x37ed79)[_0x67c8('0x1f')](_0x483ff9);}};}function respondWithFilteredResult(_0x29e2a8,_0xbdadcc){return function(_0x36a917){if(_0x36a917){var _0x4a06e6=_0x36a917[_0x67c8('0x20')],_0x427db3=_0xbdadcc[_0x67c8('0x21')],_0x4a0789=_0xbdadcc[_0x67c8('0x21')]+_0xbdadcc[_0x67c8('0x22')],_0x2728d1;if(_0x4a0789>=_0x4a06e6){_0x4a0789=_0x4a06e6;_0x2728d1=0xc8;}else{_0x2728d1=0xce;}_0x29e2a8[_0x67c8('0x1d')](_0x2728d1);return _0x29e2a8[_0x67c8('0x23')]('Content-Range',_0x427db3+'-'+_0x4a0789+'/'+_0x4a06e6)[_0x67c8('0x1f')](_0x36a917);}return null;};}function patchUpdates(_0xb5f990){return function(_0x3f5eb3){try{jsonpatch['apply'](_0x3f5eb3,_0xb5f990,!![]);}catch(_0x531cd9){return BPromise[_0x67c8('0x24')](_0x531cd9);}return _0x3f5eb3[_0x67c8('0x25')]();};}function saveUpdates(_0x336bdb,_0x5c5880){return function(_0x1a89f5){if(_0x1a89f5){return _0x1a89f5['update'](_0x336bdb)[_0x67c8('0x26')](function(_0x3316db){return _0x3316db;});}return null;};}function removeEntity(_0x9cc1f5,_0x479e8b){return function(_0x348048){if(_0x348048){return _0x348048[_0x67c8('0x27')]()[_0x67c8('0x26')](function(){_0x9cc1f5[_0x67c8('0x1d')](0xcc)[_0x67c8('0x1e')]();});}};}function handleEntityNotFound(_0x54a12b,_0xc79ba6){return function(_0x4d96f3){if(!_0x4d96f3){_0x54a12b[_0x67c8('0x28')](0x194);}return _0x4d96f3;};}function handleError(_0x1dbce4,_0x4bd5b1){_0x4bd5b1=_0x4bd5b1||0x1f4;return function(_0x165f48){logger[_0x67c8('0x29')](_0x165f48['stack']);if(_0x165f48['name']){delete _0x165f48['name'];}_0x1dbce4['status'](_0x4bd5b1)[_0x67c8('0x2a')](_0x165f48);};}exports[_0x67c8('0x2b')]=function(_0x2365ca,_0x1d730d){var _0x308d3d={},_0x534ab9={},_0x29b749={'count':0x0,'rows':[]};var _0x35fa0e=_[_0x67c8('0x2c')](db[_0x67c8('0x2d')][_0x67c8('0x2e')],function(_0x5c452d){return{'name':_0x5c452d[_0x67c8('0x2f')],'type':_0x5c452d[_0x67c8('0x30')][_0x67c8('0x31')]};});_0x534ab9[_0x67c8('0x32')]=_[_0x67c8('0x2c')](_0x35fa0e,_0x67c8('0x33'));_0x534ab9[_0x67c8('0x34')]=_[_0x67c8('0x35')](_0x2365ca[_0x67c8('0x34')]);_0x534ab9[_0x67c8('0x36')]=_[_0x67c8('0x37')](_0x534ab9[_0x67c8('0x32')],_0x534ab9[_0x67c8('0x34')]);_0x308d3d[_0x67c8('0x38')]=_[_0x67c8('0x37')](_0x534ab9[_0x67c8('0x32')],qs[_0x67c8('0x39')](_0x2365ca[_0x67c8('0x34')][_0x67c8('0x39')]));_0x308d3d[_0x67c8('0x38')]=_0x308d3d[_0x67c8('0x38')]['length']?_0x308d3d[_0x67c8('0x38')]:_0x534ab9['model'];if(!_0x2365ca[_0x67c8('0x34')][_0x67c8('0x3a')](_0x67c8('0x3b'))){_0x308d3d[_0x67c8('0x22')]=qs[_0x67c8('0x22')](_0x2365ca[_0x67c8('0x34')]['limit']);_0x308d3d[_0x67c8('0x21')]=qs[_0x67c8('0x21')](_0x2365ca['query'][_0x67c8('0x21')]);}_0x308d3d[_0x67c8('0x3c')]=qs['sort'](_0x2365ca['query'][_0x67c8('0x3d')]);_0x308d3d[_0x67c8('0x3e')]=qs[_0x67c8('0x36')](_[_0x67c8('0x3f')](_0x2365ca['query'],_0x534ab9[_0x67c8('0x36')]),_0x35fa0e);if(_0x2365ca[_0x67c8('0x34')][_0x67c8('0x40')]){_0x308d3d['where']=_[_0x67c8('0x41')](_0x308d3d['where'],{'$or':_['map'](_0x35fa0e,function(_0x429dda){if(_0x429dda[_0x67c8('0x30')]!==_0x67c8('0x42')){var _0x42cb7c={};_0x42cb7c[_0x429dda[_0x67c8('0x33')]]={'$like':'%'+_0x2365ca[_0x67c8('0x34')]['filter']+'%'};return _0x42cb7c;}})});}_0x308d3d=_[_0x67c8('0x41')]({},_0x308d3d,_0x2365ca[_0x67c8('0x43')]);var _0x475231={'where':_0x308d3d['where']};return db[_0x67c8('0x2d')]['count'](_0x475231)[_0x67c8('0x26')](function(_0x475569){_0x29b749[_0x67c8('0x20')]=_0x475569;if(_0x2365ca['query'][_0x67c8('0x44')]){_0x308d3d['include']=[{'all':!![]}];}return db[_0x67c8('0x2d')]['findAll'](_0x308d3d);})['then'](function(_0x321d73){_0x29b749[_0x67c8('0x45')]=_0x321d73;return _0x29b749;})[_0x67c8('0x26')](respondWithFilteredResult(_0x1d730d,_0x308d3d))[_0x67c8('0x46')](handleError(_0x1d730d,null));};exports[_0x67c8('0x47')]=function(_0x2ae283,_0x1f9506){var _0xa1b285={'raw':!![],'where':{'id':_0x2ae283[_0x67c8('0x48')]['id']}},_0xa4ea5e={};_0xa4ea5e[_0x67c8('0x32')]=_[_0x67c8('0x35')](db['ChatInternalMessage'][_0x67c8('0x2e')]);_0xa4ea5e['query']=_['keys'](_0x2ae283[_0x67c8('0x34')]);_0xa4ea5e[_0x67c8('0x36')]=_[_0x67c8('0x37')](_0xa4ea5e['model'],_0xa4ea5e[_0x67c8('0x34')]);_0xa1b285[_0x67c8('0x38')]=_[_0x67c8('0x37')](_0xa4ea5e['model'],qs[_0x67c8('0x39')](_0x2ae283[_0x67c8('0x34')][_0x67c8('0x39')]));_0xa1b285[_0x67c8('0x38')]=_0xa1b285[_0x67c8('0x38')][_0x67c8('0x49')]?_0xa1b285[_0x67c8('0x38')]:_0xa4ea5e[_0x67c8('0x32')];if(_0x2ae283[_0x67c8('0x34')]['includeAll']){_0xa1b285[_0x67c8('0x4a')]=[{'all':!![]}];}_0xa1b285=_[_0x67c8('0x41')]({},_0xa1b285,_0x2ae283['options']);return db[_0x67c8('0x2d')][_0x67c8('0x4b')](_0xa1b285)[_0x67c8('0x26')](handleEntityNotFound(_0x1f9506,null))[_0x67c8('0x26')](respondWithResult(_0x1f9506,null))['catch'](handleError(_0x1f9506,null));};exports['create']=function(_0x2101f8,_0x14f74b){return db[_0x67c8('0x2d')]['create'](_0x2101f8[_0x67c8('0x4c')],{})[_0x67c8('0x26')](respondWithResult(_0x14f74b,0xc9))[_0x67c8('0x46')](handleError(_0x14f74b,null));};exports[_0x67c8('0x4d')]=function(_0x527bc3,_0x2be485){if(_0x527bc3['body']['id']){delete _0x527bc3[_0x67c8('0x4c')]['id'];}return db[_0x67c8('0x2d')][_0x67c8('0x4b')]({'where':{'id':_0x527bc3[_0x67c8('0x48')]['id']}})[_0x67c8('0x26')](handleEntityNotFound(_0x2be485,null))[_0x67c8('0x26')](saveUpdates(_0x527bc3[_0x67c8('0x4c')],null))[_0x67c8('0x26')](respondWithResult(_0x2be485,null))[_0x67c8('0x46')](handleError(_0x2be485,null));};exports[_0x67c8('0x27')]=function(_0x1adb9c,_0xbfd7fe){return db[_0x67c8('0x2d')][_0x67c8('0x4b')]({'where':{'id':_0x1adb9c[_0x67c8('0x48')]['id']}})[_0x67c8('0x26')](handleEntityNotFound(_0xbfd7fe,null))[_0x67c8('0x26')](removeEntity(_0xbfd7fe,null))[_0x67c8('0x46')](handleError(_0xbfd7fe,null));};exports[_0x67c8('0x4e')]=function(_0x241cc8,_0x4a26f1){return db[_0x67c8('0x2d')][_0x67c8('0x4e')]()['then'](respondWithResult(_0x4a26f1,null))[_0x67c8('0x46')](handleError(_0x4a26f1,null));};function wrapUser(_0x189f98){return function(_0x441503){var _0x5bddb4=_0x189f98[_0x67c8('0x4f')]({'plain':!![]});_0x5bddb4[_0x67c8('0x50')]=[];if(_0x441503){_0x5bddb4[_0x67c8('0x51')]=_0x441503[_0x67c8('0x52')];_0x5bddb4[_0x67c8('0x53')]=_0x441503;}else{_0x5bddb4[_0x67c8('0x51')]=moment(0x0)[_0x67c8('0x54')](_0x67c8('0x55'));_0x5bddb4[_0x67c8('0x53')]={};}return _0x5bddb4;};}exports[_0x67c8('0x56')]=function(_0xa08f8f,_0xa91b2f,_0x4cbc46){var _0x40c589=[];return db['User'][_0x67c8('0x57')]({'where':{'role':[_0x67c8('0x58'),_0x67c8('0x59'),_0x67c8('0x5a')]},'attributes':['id','fullname',_0x67c8('0x33'),_0x67c8('0x5b'),_0x67c8('0x5c'),'internal',_0x67c8('0x5d'),_0x67c8('0x5e'),'allowmessenger',_0x67c8('0x5f')],'order':qs[_0x67c8('0x3d')]('-online'),'include':[{'model':db[_0x67c8('0x60')],'as':'VoiceQueues','attributes':['id',_0x67c8('0x33'),_0x67c8('0x30')],'through':{'attributes':[]}}]})[_0x67c8('0x26')](function(_0x2212aa){if(_0x2212aa){var _0x23813b=_0xa08f8f[_0x67c8('0x5a')][_0x67c8('0x4f')]({'plain':!![]});if(!_0x23813b)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x23813b[_0x67c8('0x5b')]===_0x67c8('0x5a')){return db[_0x67c8('0x61')][_0x67c8('0x4b')]({'where':{'name':'Agents','userProfileId':_0x23813b[_0x67c8('0x62')]},'raw':!![]})['then'](function(_0x2c03a1){if(_0x2c03a1){if(_0x2c03a1[_0x67c8('0x63')]===0x0){return db[_0x67c8('0x64')][_0x67c8('0x57')]({'where':{'sectionId':_0x2c03a1['id']},'raw':!![]})[_0x67c8('0x26')](function(_0x1a513a){var _0x2de889=[];if(_[_0x67c8('0x65')](_0x1a513a)){_0x2de889=_['filter'](_0x2212aa,function(_0x2e73dc){if(_0x2e73dc['role']!==_0x67c8('0x58')){return _0x2e73dc;}});return _0x2de889;}else{for(var _0x57a813=0x0;_0x57a813<_0x2212aa[_0x67c8('0x49')];_0x57a813++){var _0x1236bd=_0x2212aa[_0x57a813];if(_0x1236bd[_0x67c8('0x5b')]==='agent'){var _0x3c4370=_[_0x67c8('0x4b')](_0x1a513a,function(_0x516ac9){return _0x516ac9[_0x67c8('0x66')]===_0x1236bd['id'];});if(_0x3c4370)_0x2de889['push'](_0x1236bd);}else{_0x2de889[_0x67c8('0x67')](_0x1236bd);}}return _0x2de889;}});}else{return _0x2212aa;}}else{var _0x526551=_[_0x67c8('0x40')](_0x2212aa,function(_0x3d713e){if(_0x3d713e['role']!==_0x67c8('0x58')){return _0x3d713e;}});return _0x526551;}});}else{return _0x2212aa;}}})['then'](function(_0xe3ffdd){var _0x46e793=[];if(_0xe3ffdd){_0x40c589=_0xe3ffdd;for(var _0x15bf76=0x0;_0x15bf76<_0xe3ffdd[_0x67c8('0x49')];_0x15bf76+=0x1){_0x40c589[_0x15bf76]['messages']=[];_0x46e793[_0x67c8('0x67')](db['ChatInternalMessage'][_0x67c8('0x4b')]({'where':{'FromId':[_0xa08f8f[_0x67c8('0x5a')]['id'],_0xe3ffdd[_0x15bf76]['id']],'ToId':[_0xa08f8f[_0x67c8('0x5a')]['id'],_0xe3ffdd[_0x15bf76]['id']],'ChatGroupId':null},'attributes':['id',_0x67c8('0x52'),_0x67c8('0x68'),'ToId','read',_0x67c8('0x4c')],'order':qs['sort']('-createdAt'),'limit':0x1,'offset':0x0,'raw':!![]})['then'](wrapUser(_0xe3ffdd[_0x15bf76])));}return BPromise[_0x67c8('0x69')](_0x46e793);}return[];})[_0x67c8('0x26')](function(_0x1979e6){return{'rows':_0x1979e6,'count':_0x1979e6['length']};})[_0x67c8('0x26')](respondWithResult(_0xa91b2f,null))[_0x67c8('0x46')](handleError(_0xa91b2f,null));}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.events.js b/server/api/chatInternalMessage/chatInternalMessage.events.js index 774732a..1ec43a3 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 _0xa8ca=['save','update','remove','emit','exports','events','ChatInternalMessage'];(function(_0x4b075e,_0x57874c){var _0x31385c=function(_0x3ab6ef){while(--_0x3ab6ef){_0x4b075e['push'](_0x4b075e['shift']());}};_0x31385c(++_0x57874c);}(_0xa8ca,0x12b));var _0xaa8c=function(_0x1cc806,_0x340aaf){_0x1cc806=_0x1cc806-0x0;var _0x187566=_0xa8ca[_0x1cc806];return _0x187566;};'use strict';var EventEmitter=require(_0xaa8c('0x0'));var ChatInternalMessage=require('../../mysqldb')['db'][_0xaa8c('0x1')];var ChatInternalMessageEvents=new EventEmitter();ChatInternalMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xaa8c('0x2'),'afterUpdate':_0xaa8c('0x3'),'afterDestroy':_0xaa8c('0x4')};function emitEvent(_0x1f965d){return function(_0x2c993f,_0x3b6002,_0x4a0298){ChatInternalMessageEvents[_0xaa8c('0x5')](_0x1f965d+':'+_0x2c993f['id'],_0x2c993f);ChatInternalMessageEvents[_0xaa8c('0x5')](_0x1f965d,_0x2c993f);_0x4a0298(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatInternalMessage['hook'](e,emitEvent(event));}}module[_0xaa8c('0x6')]=ChatInternalMessageEvents; \ No newline at end of file +var _0xd8ee=['hasOwnProperty','hook','exports','events','ChatInternalMessage','setMaxListeners','save','remove','emit'];(function(_0x4416be,_0x28ba96){var _0x21128b=function(_0x291fdb){while(--_0x291fdb){_0x4416be['push'](_0x4416be['shift']());}};_0x21128b(++_0x28ba96);}(_0xd8ee,0x1f2));var _0xed8e=function(_0x16cf30,_0x593b43){_0x16cf30=_0x16cf30-0x0;var _0x1818ee=_0xd8ee[_0x16cf30];return _0x1818ee;};'use strict';var EventEmitter=require(_0xed8e('0x0'));var ChatInternalMessage=require('../../mysqldb')['db'][_0xed8e('0x1')];var ChatInternalMessageEvents=new EventEmitter();ChatInternalMessageEvents[_0xed8e('0x2')](0x0);var events={'afterCreate':_0xed8e('0x3'),'afterUpdate':'update','afterDestroy':_0xed8e('0x4')};function emitEvent(_0x3db0fb){return function(_0x3402ae,_0x35aed7,_0x474f12){ChatInternalMessageEvents[_0xed8e('0x5')](_0x3db0fb+':'+_0x3402ae['id'],_0x3402ae);ChatInternalMessageEvents['emit'](_0x3db0fb,_0x3402ae);_0x474f12(null);};}for(var e in events){if(events[_0xed8e('0x6')](e)){var event=events[e];ChatInternalMessage[_0xed8e('0x7')](e,emitEvent(event));}}module[_0xed8e('0x8')]=ChatInternalMessageEvents; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.model.js b/server/api/chatInternalMessage/chatInternalMessage.model.js index 211b9af..8075d48 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 _0xf3d2=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./chatInternalMessage.attributes','exports','define','ChatInternalMessage','chat_internal_messages','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger'];(function(_0x82129b,_0x484ae9){var _0x2ae5dc=function(_0x299e34){while(--_0x299e34){_0x82129b['push'](_0x82129b['shift']());}};_0x2ae5dc(++_0x484ae9);}(_0xf3d2,0x11e));var _0x2f3d=function(_0x584a03,_0x59e0c8){_0x584a03=_0x584a03-0x0;var _0x29d9c9=_0xf3d2[_0x584a03];return _0x29d9c9;};'use strict';var _=require(_0x2f3d('0x0'));var util=require(_0x2f3d('0x1'));var logger=require(_0x2f3d('0x2'))(_0x2f3d('0x3'));var moment=require(_0x2f3d('0x4'));var BPromise=require(_0x2f3d('0x5'));var rp=require(_0x2f3d('0x6'));var fs=require('fs');var path=require(_0x2f3d('0x7'));var rimraf=require(_0x2f3d('0x8'));var config=require(_0x2f3d('0x9'));var attributes=require(_0x2f3d('0xa'));module[_0x2f3d('0xb')]=function(_0xdcefc7,_0x39a626){return _0xdcefc7[_0x2f3d('0xc')](_0x2f3d('0xd'),attributes,{'tableName':_0x2f3d('0xe'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x2f3d('0xf'),'collate':_0x2f3d('0x10')});}; \ No newline at end of file +var _0x89ee=['moment','bluebird','request-promise','../../config/environment','./chatInternalMessage.attributes','exports','ChatInternalMessage','chat_internal_messages','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api'];(function(_0x226444,_0x282b29){var _0x278811=function(_0x1d150d){while(--_0x1d150d){_0x226444['push'](_0x226444['shift']());}};_0x278811(++_0x282b29);}(_0x89ee,0x130));var _0xe89e=function(_0x33f13f,_0x2bd0d4){_0x33f13f=_0x33f13f-0x0;var _0x201f02=_0x89ee[_0x33f13f];return _0x201f02;};'use strict';var _=require(_0xe89e('0x0'));var util=require(_0xe89e('0x1'));var logger=require(_0xe89e('0x2'))(_0xe89e('0x3'));var moment=require(_0xe89e('0x4'));var BPromise=require(_0xe89e('0x5'));var rp=require(_0xe89e('0x6'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xe89e('0x7'));var attributes=require(_0xe89e('0x8'));module[_0xe89e('0x9')]=function(_0x5091c4,_0x712f98){return _0x5091c4['define'](_0xe89e('0xa'),attributes,{'tableName':_0xe89e('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xe89e('0xc'),'collate':_0xe89e('0xd')});}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.rpc.js b/server/api/chatInternalMessage/chatInternalMessage.rpc.js index 8b3aa89..02fbf16 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 _0x8c68=['catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','./chatInternalMessage.socket','register','request','then','info','debug','ChatInternalMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','ChatInternalMessage,\x20%s,\x20%s','message','result'];(function(_0x2a66ff,_0x6f8400){var _0x426ff9=function(_0x375b14){while(--_0x375b14){_0x2a66ff['push'](_0x2a66ff['shift']());}};_0x426ff9(++_0x6f8400);}(_0x8c68,0x1c3));var _0x88c6=function(_0x152b9f,_0x51b306){_0x152b9f=_0x152b9f-0x0;var _0x5f0f8e=_0x8c68[_0x152b9f];return _0x5f0f8e;};'use strict';var _=require(_0x88c6('0x0'));var util=require('util');var moment=require(_0x88c6('0x1'));var BPromise=require(_0x88c6('0x2'));var rs=require(_0x88c6('0x3'));var fs=require('fs');var Redis=require(_0x88c6('0x4'));var db=require(_0x88c6('0x5'))['db'];var utils=require(_0x88c6('0x6'));var logger=require(_0x88c6('0x7'))('rpc');var config=require(_0x88c6('0x8'));var jayson=require(_0x88c6('0x9'));var client=jayson[_0x88c6('0xa')][_0x88c6('0xb')]({'port':0x232a});config[_0x88c6('0xc')]=_['defaults'](config['redis'],{'host':_0x88c6('0xd'),'port':0x18eb});var socket=require(_0x88c6('0xe'))(new Redis(config[_0x88c6('0xc')]));require(_0x88c6('0xf'))[_0x88c6('0x10')](socket);function respondWithRpcPromise(_0x39fc49,_0x1f0376,_0xc379a3){return new BPromise(function(_0x4b4310,_0x555e4e){return client[_0x88c6('0x11')](_0x39fc49,_0xc379a3)[_0x88c6('0x12')](function(_0x596408){logger[_0x88c6('0x13')]('ChatInternalMessage,\x20%s,\x20%s',_0x1f0376,'request\x20sent');logger[_0x88c6('0x14')](_0x88c6('0x15'),_0x1f0376,_0x88c6('0x16'),JSON[_0x88c6('0x17')](_0x596408));if(_0x596408[_0x88c6('0x18')]){if(_0x596408[_0x88c6('0x18')][_0x88c6('0x19')]===0x1f4){logger['error'](_0x88c6('0x1a'),_0x1f0376,_0x596408[_0x88c6('0x18')][_0x88c6('0x1b')]);return _0x555e4e(_0x596408[_0x88c6('0x18')][_0x88c6('0x1b')]);}logger[_0x88c6('0x18')](_0x88c6('0x1a'),_0x1f0376,_0x596408[_0x88c6('0x18')][_0x88c6('0x1b')]);return _0x4b4310(_0x596408[_0x88c6('0x18')]['message']);}else{logger[_0x88c6('0x13')](_0x88c6('0x1a'),_0x1f0376,_0x88c6('0x16'));_0x4b4310(_0x596408[_0x88c6('0x1c')][_0x88c6('0x1b')]);}})[_0x88c6('0x1d')](function(_0x12e07f){logger[_0x88c6('0x18')](_0x88c6('0x1a'),_0x1f0376,_0x12e07f);_0x555e4e(_0x12e07f);});});} \ No newline at end of file +var _0x37be=['jayson/promise','client','http','redis','localhost','socket.io-emitter','./chatInternalMessage.socket','then','info','ChatInternalMessage,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','lodash','bluebird','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x56b138,_0x2396d6){var _0x3df878=function(_0x4b3ccc){while(--_0x4b3ccc){_0x56b138['push'](_0x56b138['shift']());}};_0x3df878(++_0x2396d6);}(_0x37be,0xba));var _0xe37b=function(_0x5b0c03,_0x53ca0a){_0x5b0c03=_0x5b0c03-0x0;var _0x2f664a=_0x37be[_0x5b0c03];return _0x2f664a;};'use strict';var _=require(_0xe37b('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xe37b('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xe37b('0x2'));var logger=require(_0xe37b('0x3'))(_0xe37b('0x4'));var config=require(_0xe37b('0x5'));var jayson=require(_0xe37b('0x6'));var client=jayson[_0xe37b('0x7')][_0xe37b('0x8')]({'port':0x232a});config[_0xe37b('0x9')]=_['defaults'](config[_0xe37b('0x9')],{'host':_0xe37b('0xa'),'port':0x18eb});var socket=require(_0xe37b('0xb'))(new Redis(config[_0xe37b('0x9')]));require(_0xe37b('0xc'))['register'](socket);function respondWithRpcPromise(_0x8b85b8,_0x102b7f,_0x5358c8){return new BPromise(function(_0x18496c,_0x3db05c){return client['request'](_0x8b85b8,_0x5358c8)[_0xe37b('0xd')](function(_0x3d5800){logger[_0xe37b('0xe')](_0xe37b('0xf'),_0x102b7f,_0xe37b('0x10'));logger[_0xe37b('0x11')]('ChatInternalMessage,\x20%s,\x20%s,\x20%s',_0x102b7f,_0xe37b('0x10'),JSON[_0xe37b('0x12')](_0x3d5800));if(_0x3d5800[_0xe37b('0x13')]){if(_0x3d5800[_0xe37b('0x13')][_0xe37b('0x14')]===0x1f4){logger[_0xe37b('0x13')](_0xe37b('0xf'),_0x102b7f,_0x3d5800['error'][_0xe37b('0x15')]);return _0x3db05c(_0x3d5800[_0xe37b('0x13')][_0xe37b('0x15')]);}logger[_0xe37b('0x13')](_0xe37b('0xf'),_0x102b7f,_0x3d5800[_0xe37b('0x13')][_0xe37b('0x15')]);return _0x18496c(_0x3d5800[_0xe37b('0x13')]['message']);}else{logger[_0xe37b('0xe')]('ChatInternalMessage,\x20%s,\x20%s',_0x102b7f,_0xe37b('0x10'));_0x18496c(_0x3d5800[_0xe37b('0x16')][_0xe37b('0x15')]);}})[_0xe37b('0x17')](function(_0x53995c){logger[_0xe37b('0x13')](_0xe37b('0xf'),_0x102b7f,_0x53995c);_0x3db05c(_0x53995c);});});} \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.socket.js b/server/api/chatInternalMessage/chatInternalMessage.socket.js index d280094..f215c70 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 _0xcf1c=['chatInternalMessage:','./chatInternalMessage.events','save','update','removeListener','length'];(function(_0x97d252,_0x5c55aa){var _0x535670=function(_0x636a4a){while(--_0x636a4a){_0x97d252['push'](_0x97d252['shift']());}};_0x535670(++_0x5c55aa);}(_0xcf1c,0x18d));var _0xccf1=function(_0x1a0ef3,_0x535bbf){_0x1a0ef3=_0x1a0ef3-0x0;var _0x2b86da=_0xcf1c[_0x1a0ef3];return _0x2b86da;};'use strict';var ChatInternalMessageEvents=require(_0xccf1('0x0'));var events=[_0xccf1('0x1'),'remove',_0xccf1('0x2')];function createListener(_0x3b9acb,_0x1d0b09){return function(_0x2800a8){_0x1d0b09['emit'](_0x3b9acb,_0x2800a8);};}function removeListener(_0x5d3e85,_0x509c8d){return function(){ChatInternalMessageEvents[_0xccf1('0x3')](_0x5d3e85,_0x509c8d);};}exports['register']=function(_0x17e358){for(var _0x2ee316=0x0,_0x2c381f=events[_0xccf1('0x4')];_0x2ee316<_0x2c381f;_0x2ee316++){var _0x1ee241=events[_0x2ee316];var _0x12ca5d=createListener(_0xccf1('0x5')+_0x1ee241,_0x17e358);ChatInternalMessageEvents['on'](_0x1ee241,_0x12ca5d);}}; \ No newline at end of file +var _0xb575=['chatInternalMessage:','./chatInternalMessage.events','save','update','emit','removeListener','register'];(function(_0xc57c18,_0x3259fc){var _0x5daed9=function(_0x58537b){while(--_0x58537b){_0xc57c18['push'](_0xc57c18['shift']());}};_0x5daed9(++_0x3259fc);}(_0xb575,0xda));var _0x5b57=function(_0x28f5da,_0xaf971d){_0x28f5da=_0x28f5da-0x0;var _0x2362b8=_0xb575[_0x28f5da];return _0x2362b8;};'use strict';var ChatInternalMessageEvents=require(_0x5b57('0x0'));var events=[_0x5b57('0x1'),'remove',_0x5b57('0x2')];function createListener(_0x4c5b3f,_0x4a644c){return function(_0x585c94){_0x4a644c[_0x5b57('0x3')](_0x4c5b3f,_0x585c94);};}function removeListener(_0x34ae8e,_0x4b91c3){return function(){ChatInternalMessageEvents[_0x5b57('0x4')](_0x34ae8e,_0x4b91c3);};}exports[_0x5b57('0x5')]=function(_0x501a91){for(var _0x542b77=0x0,_0x672beb=events['length'];_0x542b77<_0x672beb;_0x542b77++){var _0x4232d0=events[_0x542b77];var _0x5dd0c7=createListener(_0x5b57('0x6')+_0x4232d0,_0x501a91);ChatInternalMessageEvents['on'](_0x4232d0,_0x5dd0c7);}}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/index.js b/server/api/chatInternalMessage/index.js index 6493491..4af1fdb 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 _0xa9e0=['destroy','exports','multer','util','path','Router','../../components/interaction/service','../../config/environment','./chatInternalMessage.controller','get','isAuthenticated','/describe','/users','/:id','show','post','delete'];(function(_0x557c0c,_0x21d92c){var _0x576852=function(_0x4f83c7){while(--_0x4f83c7){_0x557c0c['push'](_0x557c0c['shift']());}};_0x576852(++_0x21d92c);}(_0xa9e0,0x123));var _0x0a9e=function(_0x12d033,_0x25fa2f){_0x12d033=_0x12d033-0x0;var _0x3b4e80=_0xa9e0[_0x12d033];return _0x3b4e80;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0x0a9e('0x4'));var config=require(_0x0a9e('0x5'));var controller=require(_0x0a9e('0x6'));router[_0x0a9e('0x7')]('/',auth[_0x0a9e('0x8')](),controller['index']);router[_0x0a9e('0x7')](_0x0a9e('0x9'),auth[_0x0a9e('0x8')](),controller['describe']);router['get'](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['getUsers']);router[_0x0a9e('0x7')](_0x0a9e('0xb'),auth[_0x0a9e('0x8')](),controller[_0x0a9e('0xc')]);router[_0x0a9e('0xd')]('/',auth[_0x0a9e('0x8')](),controller['create']);router['put']('/:id',controller['update']);router[_0x0a9e('0xe')](_0x0a9e('0xb'),auth[_0x0a9e('0x8')](),controller[_0x0a9e('0xf')]);module[_0x0a9e('0x10')]=router; \ No newline at end of file +var _0xd8b0=['put','update','delete','destroy','exports','multer','util','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatInternalMessage.controller','index','get','/describe','describe','isAuthenticated','getUsers','/:id','show','post'];(function(_0x30cd7b,_0x140683){var _0x59cc85=function(_0x30fe59){while(--_0x30fe59){_0x30cd7b['push'](_0x30cd7b['shift']());}};_0x59cc85(++_0x140683);}(_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')]('/users',auth[_0x0d8b('0xb')](),controller[_0x0d8b('0xc')]);router[_0x0d8b('0x8')](_0x0d8b('0xd'),auth[_0x0d8b('0xb')](),controller[_0x0d8b('0xe')]);router[_0x0d8b('0xf')]('/',auth[_0x0d8b('0xb')](),controller['create']);router[_0x0d8b('0x10')]('/:id',controller[_0x0d8b('0x11')]);router[_0x0d8b('0x12')](_0x0d8b('0xd'),auth[_0x0d8b('0xb')](),controller[_0x0d8b('0x13')]);module[_0x0d8b('0x14')]=router; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.attributes.js b/server/api/chatMessage/chatMessage.attributes.js index 58d8539..513bbe8 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 _0x0693=['BOOLEAN','ENUM','DATE','sequelize','exports','medium'];(function(_0x2be8c2,_0x14a4b5){var _0x97f531=function(_0xcee58d){while(--_0xcee58d){_0x2be8c2['push'](_0x2be8c2['shift']());}};_0x97f531(++_0x14a4b5);}(_0x0693,0x135));var _0x3069=function(_0x252ca8,_0x19a004){_0x252ca8=_0x252ca8-0x0;var _0x222b2b=_0x0693[_0x252ca8];return _0x222b2b;};'use strict';var Sequelize=require(_0x3069('0x0'));module[_0x3069('0x1')]={'body':{'type':Sequelize['TEXT'](_0x3069('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0x3069('0x3')],'defaultValue':![]},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize[_0x3069('0x4')]('in','out'),'defaultValue':'out','allowNull':![]},'readAt':{'type':Sequelize[_0x3069('0x5')]}}; \ No newline at end of file +var _0x372a=['medium','BOOLEAN','ENUM','out','DATE','sequelize','exports','TEXT'];(function(_0x22d655,_0x3941dd){var _0x257739=function(_0x98136e){while(--_0x98136e){_0x22d655['push'](_0x22d655['shift']());}};_0x257739(++_0x3941dd);}(_0x372a,0x115));var _0xa372=function(_0x167472,_0x455f52){_0x167472=_0x167472-0x0;var _0x34b3bc=_0x372a[_0x167472];return _0x34b3bc;};'use strict';var Sequelize=require(_0xa372('0x0'));module[_0xa372('0x1')]={'body':{'type':Sequelize[_0xa372('0x2')](_0xa372('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0xa372('0x4')],'defaultValue':![]},'secret':{'type':Sequelize[_0xa372('0x4')],'defaultValue':![]},'direction':{'type':Sequelize[_0xa372('0x5')]('in',_0xa372('0x6')),'defaultValue':_0xa372('0x6'),'allowNull':![]},'readAt':{'type':Sequelize[_0xa372('0x7')]}}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.controller.js b/server/api/chatMessage/chatMessage.controller.js index a1376d0..87d02b1 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 _0x5717=['querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./chatMessage.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~!@#$%^&-_=+[{]}.','then','info','ChatMessage,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','result','catch','sendStatus','status','offset','limit','set','Content-Range','json','apply','reject','save','update','destroy','end','stack','name','send','index','map','ChatMessage','rawAttributes','fieldName','type','key','model','query','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','count','includeAll','findAll','rows','keys','length','include','options','find','create','body','params','describe','chat-interactions','chat','read','readAt','format','UserId','user','Contact','get','ChatInteraction','isNil','read1stAt','interaction','[CHATMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','AcceptMessage','manual','SIP/%s','channel','event','EventManager','acceptmessage','formData','agent','ChatInteractionId','[CHATMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','interface','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','lodash','squel','jsforce','desk.js'];(function(_0x30b0d8,_0x57470c){var _0x459c09=function(_0x5e51b6){while(--_0x5e51b6){_0x30b0d8['push'](_0x30b0d8['shift']());}};_0x459c09(++_0x57470c);}(_0x5717,0xf4));var _0x7571=function(_0x4f389b,_0x59951d){_0x4f389b=_0x4f389b-0x0;var _0x516950=_0x5717[_0x4f389b];return _0x516950;};'use strict';var pdf=require(_0x7571('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x7571('0x1'));var zipdir=require(_0x7571('0x2'));var jsonpatch=require(_0x7571('0x3'));var rp=require(_0x7571('0x4'));var moment=require(_0x7571('0x5'));var BPromise=require(_0x7571('0x6'));var Mustache=require(_0x7571('0x7'));var util=require(_0x7571('0x8'));var path=require('path');var sox=require(_0x7571('0x9'));var csv=require(_0x7571('0xa'));var ejs=require(_0x7571('0xb'));var fs=require('fs');var _=require(_0x7571('0xc'));var squel=require(_0x7571('0xd'));var crypto=require('crypto');var jsforce=require(_0x7571('0xe'));var deskjs=require(_0x7571('0xf'));var toCsv=require(_0x7571('0xa'));var querystring=require(_0x7571('0x10'));var Papa=require(_0x7571('0x11'));var Redis=require(_0x7571('0x12'));var authService=require(_0x7571('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x7571('0x14'));var hardwareService=require(_0x7571('0x15'));var logger=require(_0x7571('0x16'))(_0x7571('0x17'));var utils=require(_0x7571('0x18'));var config=require(_0x7571('0x19'));var db=require(_0x7571('0x1a'))['db'];config[_0x7571('0x1b')]=_[_0x7571('0x1c')](config['redis'],{'host':_0x7571('0x1d'),'port':0x18eb});var socket=require(_0x7571('0x1e'))(new Redis(config[_0x7571('0x1b')]));require(_0x7571('0x1f'))[_0x7571('0x20')](socket);var jayson=require(_0x7571('0x21'));var client=jayson[_0x7571('0x22')][_0x7571('0x23')]({'port':0x232c});var client9002=jayson[_0x7571('0x22')][_0x7571('0x23')]({'port':0x232a});function checkPasswordPattern(_0x49db42,_0x2c45d9,_0x350c41){if(_0x350c41){var _0x3ec2f6=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x3ec2f6[_0x7571('0x24')](_0x2c45d9)){return _0x49db42;}else{throw new db[(_0x7571('0x25'))]['ValidationError'](_0x7571('0x26'));}}else{return _0x49db42;}}function respondWithRpcPromise(_0x41d307,_0x33fb3c,_0x5938a8,_0x500348){return new BPromise(function(_0x198aea,_0xcf8d60){var _0x2a6e5f=_0x500348||client;return _0x2a6e5f['request'](_0x41d307,_0x5938a8)[_0x7571('0x27')](function(_0x4d55d){logger[_0x7571('0x28')](_0x7571('0x29'),_0x33fb3c,'request\x20sent');logger[_0x7571('0x2a')]('ChatMessage,\x20%s,\x20%s,\x20%s',_0x33fb3c,_0x7571('0x2b'),JSON[_0x7571('0x2c')](_0x4d55d));if(_0x4d55d[_0x7571('0x2d')]){if(_0x4d55d['error'][_0x7571('0x2e')]===0x1f4){logger[_0x7571('0x2d')](_0x7571('0x29'),_0x33fb3c,_0x4d55d[_0x7571('0x2d')]['message']);return _0xcf8d60(_0x4d55d[_0x7571('0x2d')][_0x7571('0x2f')]);}logger[_0x7571('0x2d')]('ChatMessage,\x20%s,\x20%s',_0x33fb3c,_0x4d55d[_0x7571('0x2d')]['message']);return _0x198aea(_0x4d55d[_0x7571('0x2d')][_0x7571('0x2f')]);}else{logger[_0x7571('0x28')]('ChatMessage,\x20%s,\x20%s',_0x33fb3c,_0x7571('0x2b'));_0x198aea(_0x4d55d[_0x7571('0x30')][_0x7571('0x2f')]);}})[_0x7571('0x31')](function(_0x592ef3){logger[_0x7571('0x2d')]('ChatMessage,\x20%s,\x20%s',_0x33fb3c,_0x592ef3);_0xcf8d60(_0x592ef3);});});}function respondWithStatusCode(_0x5c4675,_0x43f152){_0x43f152=_0x43f152||0xcc;return function(_0x34193c){if(_0x34193c){return _0x5c4675[_0x7571('0x32')](_0x43f152);}return _0x5c4675[_0x7571('0x33')](_0x43f152)['end']();};}function respondWithResult(_0xa2e653,_0x1736f5){_0x1736f5=_0x1736f5||0xc8;return function(_0x65ac67){if(_0x65ac67){return _0xa2e653[_0x7571('0x33')](_0x1736f5)['json'](_0x65ac67);}};}function respondWithFilteredResult(_0x5144a4,_0x2da0cd){return function(_0x4befed){if(_0x4befed){var _0x1c51e2=_0x4befed['count'],_0x18261b=_0x2da0cd[_0x7571('0x34')],_0x16afe1=_0x2da0cd[_0x7571('0x34')]+_0x2da0cd[_0x7571('0x35')],_0x1e7a74;if(_0x16afe1>=_0x1c51e2){_0x16afe1=_0x1c51e2;_0x1e7a74=0xc8;}else{_0x1e7a74=0xce;}_0x5144a4[_0x7571('0x33')](_0x1e7a74);return _0x5144a4[_0x7571('0x36')](_0x7571('0x37'),_0x18261b+'-'+_0x16afe1+'/'+_0x1c51e2)[_0x7571('0x38')](_0x4befed);}return null;};}function patchUpdates(_0x50f889){return function(_0x5e9d2a){try{jsonpatch[_0x7571('0x39')](_0x5e9d2a,_0x50f889,!![]);}catch(_0x4247f3){return BPromise[_0x7571('0x3a')](_0x4247f3);}return _0x5e9d2a[_0x7571('0x3b')]();};}function saveUpdates(_0x31fc83,_0x4a28cf){return function(_0x424c4f){if(_0x424c4f){return _0x424c4f[_0x7571('0x3c')](_0x31fc83)['then'](function(_0x435f46){return _0x435f46;});}return null;};}function removeEntity(_0x32f26c,_0x5c6d98){return function(_0x40e26b){if(_0x40e26b){return _0x40e26b[_0x7571('0x3d')]()[_0x7571('0x27')](function(){_0x32f26c[_0x7571('0x33')](0xcc)[_0x7571('0x3e')]();});}};}function handleEntityNotFound(_0x20f52d,_0x78de52){return function(_0x1eec2d){if(!_0x1eec2d){_0x20f52d[_0x7571('0x32')](0x194);}return _0x1eec2d;};}function handleError(_0x90bb73,_0x497f12){_0x497f12=_0x497f12||0x1f4;return function(_0x5ab4c3){logger[_0x7571('0x2d')](_0x5ab4c3[_0x7571('0x3f')]);if(_0x5ab4c3['name']){delete _0x5ab4c3[_0x7571('0x40')];}_0x90bb73[_0x7571('0x33')](_0x497f12)[_0x7571('0x41')](_0x5ab4c3);};}exports[_0x7571('0x42')]=function(_0x36c756,_0x2269f5){var _0x4a0a91={},_0x59c044={},_0x1253a4={'count':0x0,'rows':[]};var _0x135e5e=_[_0x7571('0x43')](db[_0x7571('0x44')][_0x7571('0x45')],function(_0x324b66){return{'name':_0x324b66[_0x7571('0x46')],'type':_0x324b66[_0x7571('0x47')][_0x7571('0x48')]};});_0x59c044[_0x7571('0x49')]=_['map'](_0x135e5e,'name');_0x59c044[_0x7571('0x4a')]=_['keys'](_0x36c756[_0x7571('0x4a')]);_0x59c044['filters']=_[_0x7571('0x4b')](_0x59c044[_0x7571('0x49')],_0x59c044['query']);_0x4a0a91[_0x7571('0x4c')]=_[_0x7571('0x4b')](_0x59c044[_0x7571('0x49')],qs[_0x7571('0x4d')](_0x36c756[_0x7571('0x4a')][_0x7571('0x4d')]));_0x4a0a91['attributes']=_0x4a0a91['attributes']['length']?_0x4a0a91[_0x7571('0x4c')]:_0x59c044['model'];if(!_0x36c756[_0x7571('0x4a')][_0x7571('0x4e')](_0x7571('0x4f'))){_0x4a0a91['limit']=qs[_0x7571('0x35')](_0x36c756[_0x7571('0x4a')]['limit']);_0x4a0a91['offset']=qs[_0x7571('0x34')](_0x36c756[_0x7571('0x4a')]['offset']);}_0x4a0a91[_0x7571('0x50')]=qs['sort'](_0x36c756[_0x7571('0x4a')][_0x7571('0x51')]);_0x4a0a91[_0x7571('0x52')]=qs[_0x7571('0x53')](_[_0x7571('0x54')](_0x36c756[_0x7571('0x4a')],_0x59c044[_0x7571('0x53')]),_0x135e5e);if(_0x36c756[_0x7571('0x4a')][_0x7571('0x55')]){_0x4a0a91[_0x7571('0x52')]=_[_0x7571('0x56')](_0x4a0a91[_0x7571('0x52')],{'$or':_[_0x7571('0x43')](_0x135e5e,function(_0x2ed667){if(_0x2ed667['type']!==_0x7571('0x57')){var _0x3d3684={};_0x3d3684[_0x2ed667[_0x7571('0x40')]]={'$like':'%'+_0x36c756[_0x7571('0x4a')]['filter']+'%'};return _0x3d3684;}})});}_0x4a0a91=_['merge']({},_0x4a0a91,_0x36c756['options']);var _0x1d7ffd={'where':_0x4a0a91[_0x7571('0x52')]};return db[_0x7571('0x44')][_0x7571('0x58')](_0x1d7ffd)['then'](function(_0x12ec3e){_0x1253a4[_0x7571('0x58')]=_0x12ec3e;if(_0x36c756['query'][_0x7571('0x59')]){_0x4a0a91['include']=[{'all':!![]}];}return db['ChatMessage'][_0x7571('0x5a')](_0x4a0a91);})['then'](function(_0x5a776d){_0x1253a4[_0x7571('0x5b')]=_0x5a776d;return _0x1253a4;})[_0x7571('0x27')](respondWithFilteredResult(_0x2269f5,_0x4a0a91))['catch'](handleError(_0x2269f5,null));};exports['show']=function(_0x5c1dd0,_0x3545d5){var _0x4e24bb={'raw':!![],'where':{'id':_0x5c1dd0['params']['id']}},_0x10cbbd={};_0x10cbbd['model']=_['keys'](db[_0x7571('0x44')]['rawAttributes']);_0x10cbbd[_0x7571('0x4a')]=_[_0x7571('0x5c')](_0x5c1dd0[_0x7571('0x4a')]);_0x10cbbd[_0x7571('0x53')]=_[_0x7571('0x4b')](_0x10cbbd[_0x7571('0x49')],_0x10cbbd[_0x7571('0x4a')]);_0x4e24bb['attributes']=_[_0x7571('0x4b')](_0x10cbbd['model'],qs[_0x7571('0x4d')](_0x5c1dd0[_0x7571('0x4a')][_0x7571('0x4d')]));_0x4e24bb[_0x7571('0x4c')]=_0x4e24bb['attributes'][_0x7571('0x5d')]?_0x4e24bb['attributes']:_0x10cbbd[_0x7571('0x49')];if(_0x5c1dd0[_0x7571('0x4a')][_0x7571('0x59')]){_0x4e24bb[_0x7571('0x5e')]=[{'all':!![]}];}_0x4e24bb=_[_0x7571('0x56')]({},_0x4e24bb,_0x5c1dd0[_0x7571('0x5f')]);return db[_0x7571('0x44')][_0x7571('0x60')](_0x4e24bb)[_0x7571('0x27')](handleEntityNotFound(_0x3545d5,null))[_0x7571('0x27')](respondWithResult(_0x3545d5,null))['catch'](handleError(_0x3545d5,null));};exports[_0x7571('0x61')]=function(_0x16261c,_0x404f02){return db[_0x7571('0x44')][_0x7571('0x61')](_0x16261c[_0x7571('0x62')],{})[_0x7571('0x27')](respondWithResult(_0x404f02,0xc9))['catch'](handleError(_0x404f02,null));};exports[_0x7571('0x3c')]=function(_0x4bc455,_0x474ad2){if(_0x4bc455[_0x7571('0x62')]['id']){delete _0x4bc455[_0x7571('0x62')]['id'];}return db[_0x7571('0x44')][_0x7571('0x60')]({'where':{'id':_0x4bc455[_0x7571('0x63')]['id']}})[_0x7571('0x27')](handleEntityNotFound(_0x474ad2,null))[_0x7571('0x27')](saveUpdates(_0x4bc455[_0x7571('0x62')],null))[_0x7571('0x27')](respondWithResult(_0x474ad2,null))[_0x7571('0x31')](handleError(_0x474ad2,null));};exports['destroy']=function(_0x2b25e2,_0x432f4b){return db[_0x7571('0x44')][_0x7571('0x60')]({'where':{'id':_0x2b25e2['params']['id']}})[_0x7571('0x27')](handleEntityNotFound(_0x432f4b,null))[_0x7571('0x27')](removeEntity(_0x432f4b,null))['catch'](handleError(_0x432f4b,null));};exports[_0x7571('0x64')]=function(_0x579c0c,_0x53d407){return db[_0x7571('0x44')][_0x7571('0x64')]()[_0x7571('0x27')](respondWithResult(_0x53d407,null))['catch'](handleError(_0x53d407,null));};var interaction_log=require(_0x7571('0x16'))(_0x7571('0x65'));exports['accept']=function(_0x24a276,_0x1ccf0c,_0x25085a){var _0x5486c9={'channel':_0x7571('0x66')};if(_0x24a276[_0x7571('0x62')]['id']){delete _0x24a276[_0x7571('0x62')]['id'];}_0x24a276[_0x7571('0x62')][_0x7571('0x67')]=!![];_0x24a276[_0x7571('0x62')][_0x7571('0x68')]=moment()[_0x7571('0x69')]('YYYY-MM-DD\x20HH:mm:ss');_0x24a276[_0x7571('0x62')][_0x7571('0x6a')]=_0x24a276[_0x7571('0x62')][_0x7571('0x6a')]||_0x24a276[_0x7571('0x6b')]['id'];return db[_0x7571('0x44')][_0x7571('0x60')]({'where':{'id':_0x24a276['params']['id'],'UserId':null},'include':[{'model':db['CmContact'],'as':_0x7571('0x6c')}]})[_0x7571('0x27')](handleEntityNotFound(_0x1ccf0c,null))[_0x7571('0x27')](saveUpdates(_0x24a276[_0x7571('0x62')],null))['then'](function(_0x4943b9){if(_0x4943b9){_0x5486c9[_0x7571('0x2f')]=_0x4943b9[_0x7571('0x6d')]({'plain':!![]});return db[_0x7571('0x6e')][_0x7571('0x60')]({'where':{'id':_0x4943b9['ChatInteractionId']}});}return null;})[_0x7571('0x27')](handleEntityNotFound(_0x1ccf0c,null))[_0x7571('0x27')](function(_0x34a722){if(_0x34a722){return _0x34a722['update']({'UserId':_0x24a276['body'][_0x7571('0x6a')],'read1stAt':_[_0x7571('0x6f')](_0x34a722[_0x7571('0x70')])?moment()['format']('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})['then'](function(_0x2ba941){if(_0x2ba941){_0x5486c9[_0x7571('0x71')]=_0x2ba941[_0x7571('0x6d')]({'plain':!![]});interaction_log['info'](_0x7571('0x72'),_0x24a276[_0x7571('0x6b')]['id'],_0x24a276[_0x7571('0x6b')][_0x7571('0x40')],_0x24a276[_0x7571('0x6b')][_0x7571('0x73')],_0x5486c9[_0x7571('0x71')]['id'],_0x24a276[_0x7571('0x62')]?JSON['stringify'](_0x24a276[_0x7571('0x62')]):_0x7571('0x74'));return respondWithRpcPromise(_0x7571('0x75'),'acceptMessage',_0x5486c9);}return null;})[_0x7571('0x27')](function(_0x5dfb5a){if(_0x5dfb5a){if(_0x24a276['body'][_0x7571('0x76')]){_0x5486c9[_0x7571('0x2f')]['interface']=util[_0x7571('0x69')](_0x7571('0x77'),_0x24a276['user'][_0x7571('0x40')]);_0x5486c9['message'][_0x7571('0x78')]=_0x5486c9['channel'];_0x5486c9[_0x7571('0x2f')][_0x7571('0x79')]='accept';return respondWithRpcPromise(_0x7571('0x7a'),_0x7571('0x7a'),{'event':_0x7571('0x7b'),'message':_['merge'](_0x5486c9[_0x7571('0x2f')],JSON['parse'](_0x5486c9['interaction'][_0x7571('0x7c')]))},client9002)[_0x7571('0x27')](function(){return _0x5486c9;});}return _0x5486c9;}return null;})[_0x7571('0x27')](respondWithResult(_0x1ccf0c,null))[_0x7571('0x31')](handleError(_0x1ccf0c,null));};var interaction_log=require(_0x7571('0x16'))(_0x7571('0x65'));exports[_0x7571('0x3a')]=function(_0x5e6ba0,_0x5cc940,_0x51cfda){var _0x100950={'agent':{},'channel':_0x7571('0x66')};if(_0x5e6ba0[_0x7571('0x62')]['id']){delete _0x5e6ba0[_0x7571('0x62')]['id'];}_0x5e6ba0[_0x7571('0x62')][_0x7571('0x6a')]=_0x5e6ba0[_0x7571('0x62')][_0x7571('0x6a')]||_0x5e6ba0['user']['id'];_0x100950[_0x7571('0x7d')]['id']=_0x5e6ba0[_0x7571('0x62')][_0x7571('0x6a')];return db[_0x7571('0x44')]['find']({'where':{'id':_0x5e6ba0[_0x7571('0x63')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x5cc940,null))[_0x7571('0x27')](function(_0xa3965d){if(_0xa3965d){_0x100950[_0x7571('0x2f')]=_0xa3965d[_0x7571('0x6d')]({'plain':!![]});return db[_0x7571('0x6e')][_0x7571('0x60')]({'where':{'id':_0xa3965d[_0x7571('0x7e')]}});}return null;})[_0x7571('0x27')](handleEntityNotFound(_0x5cc940,null))[_0x7571('0x27')](function(_0x58a462){if(_0x58a462){_0x100950[_0x7571('0x71')]=_0x58a462['get']({'plain':!![]});interaction_log[_0x7571('0x28')](_0x7571('0x7f'),_0x5e6ba0[_0x7571('0x6b')]['id'],_0x5e6ba0[_0x7571('0x6b')][_0x7571('0x40')],_0x5e6ba0['user'][_0x7571('0x73')],_0x100950['interaction']['id'],_0x5e6ba0[_0x7571('0x62')]?JSON[_0x7571('0x2c')](_0x5e6ba0[_0x7571('0x62')]):'null');return respondWithRpcPromise(_0x7571('0x80'),'rejectMessage',_0x100950);}return null;})['then'](function(_0x26e262){if(_0x26e262){_0x26e262[_0x7571('0x2f')][_0x7571('0x81')]=util['format'](_0x7571('0x77'),_0x5e6ba0['user'][_0x7571('0x40')]);_0x26e262[_0x7571('0x2f')][_0x7571('0x78')]=_0x100950[_0x7571('0x78')];_0x26e262[_0x7571('0x2f')][_0x7571('0x79')]=_0x7571('0x3a');respondWithRpcPromise('EventManager',_0x7571('0x7a'),{'event':'rejectmessage','message':_0x26e262['message']},client9002);return _0x100950;}return null;})[_0x7571('0x27')](respondWithResult(_0x5cc940,null))[_0x7571('0x31')](handleError(_0x5cc940,null));}; \ No newline at end of file +var _0x06be=['length','nolimit','order','sort','where','pick','filters','filter','merge','options','includeAll','include','findAll','rows','catch','show','create','body','find','params','accept','chat','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','CmContact','Contact','ChatInteraction','isNil','read1stAt','interaction','role','null','AcceptMessage','acceptMessage','manual','channel','event','EventManager','acceptmessage','parse','chat-interactions','agent','get','ChatInteractionId','[CHATMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','SIP/%s','reject','rejectmessage','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','crypto','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','defaults','redis','socket.io-emitter','./chatMessage.socket','register','jayson/promise','client','http','test','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','request\x20sent','debug','ChatMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','ChatMessage,\x20%s,\x20%s','message','info','result','status','end','json','count','offset','limit','Content-Range','apply','save','update','destroy','sendStatus','stack','name','map','ChatMessage','rawAttributes','fieldName','type','key','query','keys','intersection','model','attributes','fields'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x06be,0xb1));var _0xe06b=function(_0x291bac,_0x1bc4af){_0x291bac=_0x291bac-0x0;var _0x11866e=_0x06be[_0x291bac];return _0x11866e;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xe06b('0x0'));var rimraf=require(_0xe06b('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xe06b('0x2'));var rp=require(_0xe06b('0x3'));var moment=require(_0xe06b('0x4'));var BPromise=require(_0xe06b('0x5'));var Mustache=require(_0xe06b('0x6'));var util=require(_0xe06b('0x7'));var path=require(_0xe06b('0x8'));var sox=require(_0xe06b('0x9'));var csv=require(_0xe06b('0xa'));var ejs=require(_0xe06b('0xb'));var fs=require('fs');var _=require(_0xe06b('0xc'));var squel=require('squel');var crypto=require(_0xe06b('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xe06b('0xe'));var toCsv=require('to-csv');var querystring=require(_0xe06b('0xf'));var Papa=require('papaparse');var Redis=require(_0xe06b('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xe06b('0x11'));var as=require(_0xe06b('0x12'));var hardwareService=require(_0xe06b('0x13'));var logger=require(_0xe06b('0x14'))('api');var utils=require(_0xe06b('0x15'));var config=require(_0xe06b('0x16'));var db=require(_0xe06b('0x17'))['db'];config['redis']=_[_0xe06b('0x18')](config[_0xe06b('0x19')],{'host':'localhost','port':0x18eb});var socket=require(_0xe06b('0x1a'))(new Redis(config['redis']));require(_0xe06b('0x1b'))[_0xe06b('0x1c')](socket);var jayson=require(_0xe06b('0x1d'));var client=jayson[_0xe06b('0x1e')][_0xe06b('0x1f')]({'port':0x232c});var client9002=jayson[_0xe06b('0x1e')][_0xe06b('0x1f')]({'port':0x232a});function checkPasswordPattern(_0x5aff1d,_0x3a6a46,_0x2e3d9a){if(_0x2e3d9a){var _0x33d8c9=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x33d8c9[_0xe06b('0x20')](_0x3a6a46)){return _0x5aff1d;}else{throw new db['Sequelize'][(_0xe06b('0x21'))](_0xe06b('0x22'));}}else{return _0x5aff1d;}}function respondWithRpcPromise(_0x425159,_0x10a3b5,_0x31bbce,_0x5f1d58){return new BPromise(function(_0x58e7e2,_0x10f106){var _0x1a5d64=_0x5f1d58||client;return _0x1a5d64[_0xe06b('0x23')](_0x425159,_0x31bbce)[_0xe06b('0x24')](function(_0x51d7b3){logger['info']('ChatMessage,\x20%s,\x20%s',_0x10a3b5,_0xe06b('0x25'));logger[_0xe06b('0x26')](_0xe06b('0x27'),_0x10a3b5,'request\x20sent',JSON[_0xe06b('0x28')](_0x51d7b3));if(_0x51d7b3[_0xe06b('0x29')]){if(_0x51d7b3[_0xe06b('0x29')][_0xe06b('0x2a')]===0x1f4){logger[_0xe06b('0x29')](_0xe06b('0x2b'),_0x10a3b5,_0x51d7b3['error'][_0xe06b('0x2c')]);return _0x10f106(_0x51d7b3[_0xe06b('0x29')][_0xe06b('0x2c')]);}logger['error'](_0xe06b('0x2b'),_0x10a3b5,_0x51d7b3[_0xe06b('0x29')][_0xe06b('0x2c')]);return _0x58e7e2(_0x51d7b3[_0xe06b('0x29')][_0xe06b('0x2c')]);}else{logger[_0xe06b('0x2d')](_0xe06b('0x2b'),_0x10a3b5,'request\x20sent');_0x58e7e2(_0x51d7b3[_0xe06b('0x2e')][_0xe06b('0x2c')]);}})['catch'](function(_0x825639){logger[_0xe06b('0x29')](_0xe06b('0x2b'),_0x10a3b5,_0x825639);_0x10f106(_0x825639);});});}function respondWithStatusCode(_0x24fba4,_0xb28880){_0xb28880=_0xb28880||0xcc;return function(_0x1a2369){if(_0x1a2369){return _0x24fba4['sendStatus'](_0xb28880);}return _0x24fba4[_0xe06b('0x2f')](_0xb28880)[_0xe06b('0x30')]();};}function respondWithResult(_0x506619,_0x46953f){_0x46953f=_0x46953f||0xc8;return function(_0x453499){if(_0x453499){return _0x506619['status'](_0x46953f)[_0xe06b('0x31')](_0x453499);}};}function respondWithFilteredResult(_0x125f9b,_0x386eab){return function(_0xf47708){if(_0xf47708){var _0x4d92f9=_0xf47708[_0xe06b('0x32')],_0x188a99=_0x386eab['offset'],_0x26bc7d=_0x386eab[_0xe06b('0x33')]+_0x386eab[_0xe06b('0x34')],_0x3b94c5;if(_0x26bc7d>=_0x4d92f9){_0x26bc7d=_0x4d92f9;_0x3b94c5=0xc8;}else{_0x3b94c5=0xce;}_0x125f9b[_0xe06b('0x2f')](_0x3b94c5);return _0x125f9b['set'](_0xe06b('0x35'),_0x188a99+'-'+_0x26bc7d+'/'+_0x4d92f9)[_0xe06b('0x31')](_0xf47708);}return null;};}function patchUpdates(_0x51a534){return function(_0x4d2923){try{jsonpatch[_0xe06b('0x36')](_0x4d2923,_0x51a534,!![]);}catch(_0x5008f3){return BPromise['reject'](_0x5008f3);}return _0x4d2923[_0xe06b('0x37')]();};}function saveUpdates(_0x1c343a,_0xcb6248){return function(_0x549f7a){if(_0x549f7a){return _0x549f7a[_0xe06b('0x38')](_0x1c343a)[_0xe06b('0x24')](function(_0x59f4ca){return _0x59f4ca;});}return null;};}function removeEntity(_0x501e5d,_0x92aa4c){return function(_0x28a5a7){if(_0x28a5a7){return _0x28a5a7[_0xe06b('0x39')]()[_0xe06b('0x24')](function(){_0x501e5d['status'](0xcc)[_0xe06b('0x30')]();});}};}function handleEntityNotFound(_0x47468e,_0xf40c45){return function(_0x1638af){if(!_0x1638af){_0x47468e[_0xe06b('0x3a')](0x194);}return _0x1638af;};}function handleError(_0x5b5337,_0x1e28aa){_0x1e28aa=_0x1e28aa||0x1f4;return function(_0x38b6b3){logger['error'](_0x38b6b3[_0xe06b('0x3b')]);if(_0x38b6b3[_0xe06b('0x3c')]){delete _0x38b6b3[_0xe06b('0x3c')];}_0x5b5337['status'](_0x1e28aa)['send'](_0x38b6b3);};}exports['index']=function(_0x5c7b37,_0x1a9f41){var _0x323d1f={},_0x225d87={},_0x584004={'count':0x0,'rows':[]};var _0x3983cf=_[_0xe06b('0x3d')](db[_0xe06b('0x3e')][_0xe06b('0x3f')],function(_0x22fd53){return{'name':_0x22fd53[_0xe06b('0x40')],'type':_0x22fd53[_0xe06b('0x41')][_0xe06b('0x42')]};});_0x225d87['model']=_[_0xe06b('0x3d')](_0x3983cf,_0xe06b('0x3c'));_0x225d87[_0xe06b('0x43')]=_[_0xe06b('0x44')](_0x5c7b37[_0xe06b('0x43')]);_0x225d87['filters']=_[_0xe06b('0x45')](_0x225d87[_0xe06b('0x46')],_0x225d87[_0xe06b('0x43')]);_0x323d1f[_0xe06b('0x47')]=_[_0xe06b('0x45')](_0x225d87[_0xe06b('0x46')],qs[_0xe06b('0x48')](_0x5c7b37[_0xe06b('0x43')]['fields']));_0x323d1f[_0xe06b('0x47')]=_0x323d1f[_0xe06b('0x47')][_0xe06b('0x49')]?_0x323d1f['attributes']:_0x225d87['model'];if(!_0x5c7b37['query']['hasOwnProperty'](_0xe06b('0x4a'))){_0x323d1f[_0xe06b('0x34')]=qs['limit'](_0x5c7b37[_0xe06b('0x43')]['limit']);_0x323d1f['offset']=qs[_0xe06b('0x33')](_0x5c7b37[_0xe06b('0x43')][_0xe06b('0x33')]);}_0x323d1f[_0xe06b('0x4b')]=qs[_0xe06b('0x4c')](_0x5c7b37[_0xe06b('0x43')][_0xe06b('0x4c')]);_0x323d1f[_0xe06b('0x4d')]=qs['filters'](_[_0xe06b('0x4e')](_0x5c7b37[_0xe06b('0x43')],_0x225d87[_0xe06b('0x4f')]),_0x3983cf);if(_0x5c7b37[_0xe06b('0x43')][_0xe06b('0x50')]){_0x323d1f[_0xe06b('0x4d')]=_['merge'](_0x323d1f[_0xe06b('0x4d')],{'$or':_[_0xe06b('0x3d')](_0x3983cf,function(_0x1cac76){if(_0x1cac76[_0xe06b('0x41')]!=='VIRTUAL'){var _0x56e087={};_0x56e087[_0x1cac76[_0xe06b('0x3c')]]={'$like':'%'+_0x5c7b37['query'][_0xe06b('0x50')]+'%'};return _0x56e087;}})});}_0x323d1f=_[_0xe06b('0x51')]({},_0x323d1f,_0x5c7b37[_0xe06b('0x52')]);var _0x137be8={'where':_0x323d1f['where']};return db['ChatMessage'][_0xe06b('0x32')](_0x137be8)[_0xe06b('0x24')](function(_0x2ef893){_0x584004[_0xe06b('0x32')]=_0x2ef893;if(_0x5c7b37[_0xe06b('0x43')][_0xe06b('0x53')]){_0x323d1f[_0xe06b('0x54')]=[{'all':!![]}];}return db[_0xe06b('0x3e')][_0xe06b('0x55')](_0x323d1f);})[_0xe06b('0x24')](function(_0x555432){_0x584004[_0xe06b('0x56')]=_0x555432;return _0x584004;})['then'](respondWithFilteredResult(_0x1a9f41,_0x323d1f))[_0xe06b('0x57')](handleError(_0x1a9f41,null));};exports[_0xe06b('0x58')]=function(_0x4712e7,_0x64dcb0){var _0x2923ea={'raw':!![],'where':{'id':_0x4712e7['params']['id']}},_0x11c5d0={};_0x11c5d0[_0xe06b('0x46')]=_[_0xe06b('0x44')](db[_0xe06b('0x3e')][_0xe06b('0x3f')]);_0x11c5d0['query']=_[_0xe06b('0x44')](_0x4712e7[_0xe06b('0x43')]);_0x11c5d0['filters']=_['intersection'](_0x11c5d0['model'],_0x11c5d0[_0xe06b('0x43')]);_0x2923ea[_0xe06b('0x47')]=_[_0xe06b('0x45')](_0x11c5d0[_0xe06b('0x46')],qs[_0xe06b('0x48')](_0x4712e7['query']['fields']));_0x2923ea['attributes']=_0x2923ea['attributes'][_0xe06b('0x49')]?_0x2923ea['attributes']:_0x11c5d0[_0xe06b('0x46')];if(_0x4712e7['query'][_0xe06b('0x53')]){_0x2923ea['include']=[{'all':!![]}];}_0x2923ea=_[_0xe06b('0x51')]({},_0x2923ea,_0x4712e7['options']);return db['ChatMessage']['find'](_0x2923ea)[_0xe06b('0x24')](handleEntityNotFound(_0x64dcb0,null))[_0xe06b('0x24')](respondWithResult(_0x64dcb0,null))[_0xe06b('0x57')](handleError(_0x64dcb0,null));};exports[_0xe06b('0x59')]=function(_0x3f4117,_0x27b692){return db[_0xe06b('0x3e')][_0xe06b('0x59')](_0x3f4117[_0xe06b('0x5a')],{})[_0xe06b('0x24')](respondWithResult(_0x27b692,0xc9))[_0xe06b('0x57')](handleError(_0x27b692,null));};exports[_0xe06b('0x38')]=function(_0x3bddbe,_0x1a4bef){if(_0x3bddbe[_0xe06b('0x5a')]['id']){delete _0x3bddbe['body']['id'];}return db[_0xe06b('0x3e')][_0xe06b('0x5b')]({'where':{'id':_0x3bddbe[_0xe06b('0x5c')]['id']}})[_0xe06b('0x24')](handleEntityNotFound(_0x1a4bef,null))[_0xe06b('0x24')](saveUpdates(_0x3bddbe[_0xe06b('0x5a')],null))[_0xe06b('0x24')](respondWithResult(_0x1a4bef,null))[_0xe06b('0x57')](handleError(_0x1a4bef,null));};exports[_0xe06b('0x39')]=function(_0x4ef260,_0xb729b4){return db['ChatMessage'][_0xe06b('0x5b')]({'where':{'id':_0x4ef260[_0xe06b('0x5c')]['id']}})['then'](handleEntityNotFound(_0xb729b4,null))[_0xe06b('0x24')](removeEntity(_0xb729b4,null))[_0xe06b('0x57')](handleError(_0xb729b4,null));};exports['describe']=function(_0x361c36,_0x16fd3a){return db[_0xe06b('0x3e')]['describe']()[_0xe06b('0x24')](respondWithResult(_0x16fd3a,null))[_0xe06b('0x57')](handleError(_0x16fd3a,null));};var interaction_log=require(_0xe06b('0x14'))('chat-interactions');exports[_0xe06b('0x5d')]=function(_0x4369e2,_0x44bfd2,_0x1b2ed8){var _0x1d207e={'channel':_0xe06b('0x5e')};if(_0x4369e2[_0xe06b('0x5a')]['id']){delete _0x4369e2['body']['id'];}_0x4369e2[_0xe06b('0x5a')][_0xe06b('0x5f')]=!![];_0x4369e2[_0xe06b('0x5a')][_0xe06b('0x60')]=moment()[_0xe06b('0x61')](_0xe06b('0x62'));_0x4369e2[_0xe06b('0x5a')]['UserId']=_0x4369e2[_0xe06b('0x5a')][_0xe06b('0x63')]||_0x4369e2[_0xe06b('0x64')]['id'];return db[_0xe06b('0x3e')][_0xe06b('0x5b')]({'where':{'id':_0x4369e2['params']['id'],'UserId':null},'include':[{'model':db[_0xe06b('0x65')],'as':_0xe06b('0x66')}]})[_0xe06b('0x24')](handleEntityNotFound(_0x44bfd2,null))[_0xe06b('0x24')](saveUpdates(_0x4369e2[_0xe06b('0x5a')],null))['then'](function(_0x4e290f){if(_0x4e290f){_0x1d207e[_0xe06b('0x2c')]=_0x4e290f['get']({'plain':!![]});return db[_0xe06b('0x67')][_0xe06b('0x5b')]({'where':{'id':_0x4e290f['ChatInteractionId']}});}return null;})['then'](handleEntityNotFound(_0x44bfd2,null))['then'](function(_0x1e6bf0){if(_0x1e6bf0){return _0x1e6bf0[_0xe06b('0x38')]({'UserId':_0x4369e2[_0xe06b('0x5a')][_0xe06b('0x63')],'read1stAt':_[_0xe06b('0x68')](_0x1e6bf0[_0xe06b('0x69')])?moment()[_0xe06b('0x61')](_0xe06b('0x62')):undefined});}return null;})[_0xe06b('0x24')](function(_0x5574e0){if(_0x5574e0){_0x1d207e[_0xe06b('0x6a')]=_0x5574e0['get']({'plain':!![]});interaction_log['info']('[CHATMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x4369e2[_0xe06b('0x64')]['id'],_0x4369e2[_0xe06b('0x64')][_0xe06b('0x3c')],_0x4369e2[_0xe06b('0x64')][_0xe06b('0x6b')],_0x1d207e[_0xe06b('0x6a')]['id'],_0x4369e2[_0xe06b('0x5a')]?JSON[_0xe06b('0x28')](_0x4369e2[_0xe06b('0x5a')]):_0xe06b('0x6c'));return respondWithRpcPromise(_0xe06b('0x6d'),_0xe06b('0x6e'),_0x1d207e);}return null;})[_0xe06b('0x24')](function(_0x24bdf4){if(_0x24bdf4){if(_0x4369e2[_0xe06b('0x5a')][_0xe06b('0x6f')]){_0x1d207e[_0xe06b('0x2c')]['interface']=util[_0xe06b('0x61')]('SIP/%s',_0x4369e2['user'][_0xe06b('0x3c')]);_0x1d207e[_0xe06b('0x2c')][_0xe06b('0x70')]=_0x1d207e[_0xe06b('0x70')];_0x1d207e[_0xe06b('0x2c')][_0xe06b('0x71')]=_0xe06b('0x5d');return respondWithRpcPromise(_0xe06b('0x72'),_0xe06b('0x72'),{'event':_0xe06b('0x73'),'message':_[_0xe06b('0x51')](_0x1d207e[_0xe06b('0x2c')],JSON[_0xe06b('0x74')](_0x1d207e[_0xe06b('0x6a')]['formData']))},client9002)[_0xe06b('0x24')](function(){return _0x1d207e;});}return _0x1d207e;}return null;})[_0xe06b('0x24')](respondWithResult(_0x44bfd2,null))[_0xe06b('0x57')](handleError(_0x44bfd2,null));};var interaction_log=require('../../config/logger')(_0xe06b('0x75'));exports['reject']=function(_0xc3e6e7,_0x218151,_0x2cac03){var _0x550f6b={'agent':{},'channel':_0xe06b('0x5e')};if(_0xc3e6e7[_0xe06b('0x5a')]['id']){delete _0xc3e6e7[_0xe06b('0x5a')]['id'];}_0xc3e6e7['body']['UserId']=_0xc3e6e7[_0xe06b('0x5a')][_0xe06b('0x63')]||_0xc3e6e7[_0xe06b('0x64')]['id'];_0x550f6b[_0xe06b('0x76')]['id']=_0xc3e6e7[_0xe06b('0x5a')][_0xe06b('0x63')];return db[_0xe06b('0x3e')]['find']({'where':{'id':_0xc3e6e7[_0xe06b('0x5c')]['id'],'UserId':null}})[_0xe06b('0x24')](handleEntityNotFound(_0x218151,null))[_0xe06b('0x24')](function(_0xb5cdf8){if(_0xb5cdf8){_0x550f6b['message']=_0xb5cdf8[_0xe06b('0x77')]({'plain':!![]});return db[_0xe06b('0x67')]['find']({'where':{'id':_0xb5cdf8[_0xe06b('0x78')]}});}return null;})[_0xe06b('0x24')](handleEntityNotFound(_0x218151,null))[_0xe06b('0x24')](function(_0x3506b5){if(_0x3506b5){_0x550f6b[_0xe06b('0x6a')]=_0x3506b5[_0xe06b('0x77')]({'plain':!![]});interaction_log[_0xe06b('0x2d')](_0xe06b('0x79'),_0xc3e6e7[_0xe06b('0x64')]['id'],_0xc3e6e7[_0xe06b('0x64')][_0xe06b('0x3c')],_0xc3e6e7[_0xe06b('0x64')][_0xe06b('0x6b')],_0x550f6b[_0xe06b('0x6a')]['id'],_0xc3e6e7[_0xe06b('0x5a')]?JSON['stringify'](_0xc3e6e7[_0xe06b('0x5a')]):_0xe06b('0x6c'));return respondWithRpcPromise('RejectMessage','rejectMessage',_0x550f6b);}return null;})[_0xe06b('0x24')](function(_0x4b7a81){if(_0x4b7a81){_0x4b7a81[_0xe06b('0x2c')]['interface']=util['format'](_0xe06b('0x7a'),_0xc3e6e7[_0xe06b('0x64')][_0xe06b('0x3c')]);_0x4b7a81[_0xe06b('0x2c')][_0xe06b('0x70')]=_0x550f6b[_0xe06b('0x70')];_0x4b7a81[_0xe06b('0x2c')]['event']=_0xe06b('0x7b');respondWithRpcPromise(_0xe06b('0x72'),_0xe06b('0x72'),{'event':_0xe06b('0x7c'),'message':_0x4b7a81[_0xe06b('0x2c')]},client9002);return _0x550f6b;}return null;})[_0xe06b('0x24')](respondWithResult(_0x218151,null))['catch'](handleError(_0x218151,null));}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.events.js b/server/api/chatMessage/chatMessage.events.js index 2dce6a3..b3a2dc4 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 _0x7947=['update','remove','emit','hasOwnProperty','exports','events','../../mysqldb','setMaxListeners','save'];(function(_0xf89c3,_0x351bf1){var _0x274fc8=function(_0x5e0c91){while(--_0x5e0c91){_0xf89c3['push'](_0xf89c3['shift']());}};_0x274fc8(++_0x351bf1);}(_0x7947,0x15b));var _0x7794=function(_0x201601,_0x58301d){_0x201601=_0x201601-0x0;var _0x542fa6=_0x7947[_0x201601];return _0x542fa6;};'use strict';var EventEmitter=require(_0x7794('0x0'));var ChatMessage=require(_0x7794('0x1'))['db']['ChatMessage'];var ChatMessageEvents=new EventEmitter();ChatMessageEvents[_0x7794('0x2')](0x0);var events={'afterCreate':_0x7794('0x3'),'afterUpdate':_0x7794('0x4'),'afterDestroy':_0x7794('0x5')};function emitEvent(_0x4dec9a){return function(_0x2e439c,_0x26271b,_0x2a7a05){ChatMessageEvents[_0x7794('0x6')](_0x4dec9a+':'+_0x2e439c['id'],_0x2e439c);ChatMessageEvents[_0x7794('0x6')](_0x4dec9a,_0x2e439c);_0x2a7a05(null);};}for(var e in events){if(events[_0x7794('0x7')](e)){var event=events[e];ChatMessage['hook'](e,emitEvent(event));}}module[_0x7794('0x8')]=ChatMessageEvents; \ No newline at end of file +var _0x96a8=['events','setMaxListeners','update','hook','exports'];(function(_0x576f20,_0x3c6602){var _0x540ff1=function(_0x4a186e){while(--_0x4a186e){_0x576f20['push'](_0x576f20['shift']());}};_0x540ff1(++_0x3c6602);}(_0x96a8,0x16d));var _0x896a=function(_0xd74f82,_0x1a5de1){_0xd74f82=_0xd74f82-0x0;var _0x5ad9c4=_0x96a8[_0xd74f82];return _0x5ad9c4;};'use strict';var EventEmitter=require(_0x896a('0x0'));var ChatMessage=require('../../mysqldb')['db']['ChatMessage'];var ChatMessageEvents=new EventEmitter();ChatMessageEvents[_0x896a('0x1')](0x0);var events={'afterCreate':'save','afterUpdate':_0x896a('0x2'),'afterDestroy':'remove'};function emitEvent(_0x5725cd){return function(_0x42b870,_0x484da8,_0x2956ca){ChatMessageEvents['emit'](_0x5725cd+':'+_0x42b870['id'],_0x42b870);ChatMessageEvents['emit'](_0x5725cd,_0x42b870);_0x2956ca(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatMessage[_0x896a('0x3')](e,emitEvent(event));}}module[_0x896a('0x4')]=ChatMessageEvents; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.model.js b/server/api/chatMessage/chatMessage.model.js index 3ae1565..fd53cbb 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 _0x8227=['body','FULLTEXT','models','get','direction','toLowerCase','out','secret','isNil','ChatInteraction','findOne','ChatInteractionId','then','update','createdAt','catch','error','utf8mb4','utf8mb4_unicode_ci','lodash','util','api','moment','bluebird','request-promise','path','rimraf','./chatMessage.attributes','exports','define','fti_chat_messages'];(function(_0x3a15eb,_0x619ead){var _0x4c6741=function(_0x55db68){while(--_0x55db68){_0x3a15eb['push'](_0x3a15eb['shift']());}};_0x4c6741(++_0x619ead);}(_0x8227,0x8f));var _0x7822=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x8227[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0x7822('0x0'));var util=require(_0x7822('0x1'));var logger=require('../../config/logger')(_0x7822('0x2'));var moment=require(_0x7822('0x3'));var BPromise=require(_0x7822('0x4'));var rp=require(_0x7822('0x5'));var fs=require('fs');var path=require(_0x7822('0x6'));var rimraf=require(_0x7822('0x7'));var config=require('../../config/environment');var attributes=require(_0x7822('0x8'));module[_0x7822('0x9')]=function(_0x525062,_0x4820aa){return _0x525062[_0x7822('0xa')]('ChatMessage',attributes,{'tableName':'chat_messages','paranoid':![],'indexes':[{'name':_0x7822('0xb'),'fields':[_0x7822('0xc')],'type':_0x7822('0xd')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x160a7b,_0x5f1c84,_0x5e9207){var _0x4bd8a6=_0x525062[_0x7822('0xe')];var _0x4585b3=_0x160a7b[_0x7822('0xf')]({'plain':!![]});if(_0x4585b3[_0x7822('0x10')][_0x7822('0x11')]()==='in'||_0x4585b3[_0x7822('0x10')][_0x7822('0x11')]()===_0x7822('0x12')&&!_0x4585b3[_0x7822('0x13')]&&!_[_0x7822('0x14')](_0x4585b3['UserId'])){_0x4bd8a6[_0x7822('0x15')][_0x7822('0x16')]({'where':{'id':_0x4585b3[_0x7822('0x17')]}})[_0x7822('0x18')](function(_0x5dfa13){if(_0x5dfa13){_0x5dfa13[_0x7822('0x19')]({'lastMsgAt':_0x4585b3[_0x7822('0x1a')],'lastMsgDirection':_0x4585b3['direction'][_0x7822('0x11')]()});}})[_0x7822('0x1b')](function(_0x40b321){console[_0x7822('0x1c')](_0x40b321);});}_0x5e9207();}},'charset':_0x7822('0x1d'),'collate':_0x7822('0x1e')});}; \ No newline at end of file +var _0xf073=['chat_messages','fti_chat_messages','body','FULLTEXT','get','out','secret','isNil','UserId','findOne','ChatInteractionId','then','update','createdAt','direction','toLowerCase','error','utf8mb4','utf8mb4_unicode_ci','util','../../config/logger','bluebird','path','../../config/environment','./chatMessage.attributes','exports','ChatMessage'];(function(_0x297eea,_0x5060be){var _0x1c42d2=function(_0x3afff4){while(--_0x3afff4){_0x297eea['push'](_0x297eea['shift']());}};_0x1c42d2(++_0x5060be);}(_0xf073,0xb5));var _0x3f07=function(_0x35c4d4,_0x2881a8){_0x35c4d4=_0x35c4d4-0x0;var _0x327471=_0xf073[_0x35c4d4];return _0x327471;};'use strict';var _=require('lodash');var util=require(_0x3f07('0x0'));var logger=require(_0x3f07('0x1'))('api');var moment=require('moment');var BPromise=require(_0x3f07('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x3f07('0x3'));var rimraf=require('rimraf');var config=require(_0x3f07('0x4'));var attributes=require(_0x3f07('0x5'));module[_0x3f07('0x6')]=function(_0x453bd3,_0x4d5db4){return _0x453bd3['define'](_0x3f07('0x7'),attributes,{'tableName':_0x3f07('0x8'),'paranoid':![],'indexes':[{'name':_0x3f07('0x9'),'fields':[_0x3f07('0xa')],'type':_0x3f07('0xb')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x5a1f76,_0x19274a,_0x448839){var _0x5f47be=_0x453bd3['models'];var _0x35e020=_0x5a1f76[_0x3f07('0xc')]({'plain':!![]});if(_0x35e020['direction']['toLowerCase']()==='in'||_0x35e020['direction']['toLowerCase']()===_0x3f07('0xd')&&!_0x35e020[_0x3f07('0xe')]&&!_[_0x3f07('0xf')](_0x35e020[_0x3f07('0x10')])){_0x5f47be['ChatInteraction'][_0x3f07('0x11')]({'where':{'id':_0x35e020[_0x3f07('0x12')]}})[_0x3f07('0x13')](function(_0x1367d6){if(_0x1367d6){_0x1367d6[_0x3f07('0x14')]({'lastMsgAt':_0x35e020[_0x3f07('0x15')],'lastMsgDirection':_0x35e020[_0x3f07('0x16')][_0x3f07('0x17')]()});}})['catch'](function(_0xcb2512){console[_0x3f07('0x18')](_0xcb2512);});}_0x448839();}},'charset':_0x3f07('0x19'),'collate':_0x3f07('0x1a')});}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.rpc.js b/server/api/chatMessage/chatMessage.rpc.js index b2b8ba1..40b7ae9 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 _0x3abd=['create','options','raw','debug','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','./chatMessage.socket','register','request','then','ChatMessage,\x20%s,\x20%s','request\x20sent','ChatMessage,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','CreateChatMessage','ChatMessage'];(function(_0x40bf12,_0x4d03ae){var _0x1b3b01=function(_0x22a537){while(--_0x22a537){_0x40bf12['push'](_0x40bf12['shift']());}};_0x1b3b01(++_0x4d03ae);}(_0x3abd,0x6b));var _0xd3ab=function(_0x1e4360,_0x930b9b){_0x1e4360=_0x1e4360-0x0;var _0x31e6b4=_0x3abd[_0x1e4360];return _0x31e6b4;};'use strict';var _=require(_0xd3ab('0x0'));var util=require(_0xd3ab('0x1'));var moment=require(_0xd3ab('0x2'));var BPromise=require('bluebird');var rs=require(_0xd3ab('0x3'));var fs=require('fs');var Redis=require(_0xd3ab('0x4'));var db=require(_0xd3ab('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xd3ab('0x6'))(_0xd3ab('0x7'));var config=require(_0xd3ab('0x8'));var jayson=require(_0xd3ab('0x9'));var client=jayson[_0xd3ab('0xa')][_0xd3ab('0xb')]({'port':0x232a});config[_0xd3ab('0xc')]=_['defaults'](config['redis'],{'host':_0xd3ab('0xd'),'port':0x18eb});var socket=require(_0xd3ab('0xe'))(new Redis(config['redis']));require(_0xd3ab('0xf'))[_0xd3ab('0x10')](socket);function respondWithRpcPromise(_0x1af318,_0x1338fd,_0x17a2bc){return new BPromise(function(_0x3540ef,_0x34291a){return client[_0xd3ab('0x11')](_0x1af318,_0x17a2bc)[_0xd3ab('0x12')](function(_0x40b34e){logger['info'](_0xd3ab('0x13'),_0x1338fd,_0xd3ab('0x14'));logger['debug'](_0xd3ab('0x15'),_0x1338fd,'request\x20sent',JSON[_0xd3ab('0x16')](_0x40b34e));if(_0x40b34e[_0xd3ab('0x17')]){if(_0x40b34e[_0xd3ab('0x17')]['code']===0x1f4){logger['error'](_0xd3ab('0x13'),_0x1338fd,_0x40b34e['error'][_0xd3ab('0x18')]);return _0x34291a(_0x40b34e['error'][_0xd3ab('0x18')]);}logger['error'](_0xd3ab('0x13'),_0x1338fd,_0x40b34e['error'][_0xd3ab('0x18')]);return _0x3540ef(_0x40b34e[_0xd3ab('0x17')][_0xd3ab('0x18')]);}else{logger[_0xd3ab('0x19')](_0xd3ab('0x13'),_0x1338fd,_0xd3ab('0x14'));_0x3540ef(_0x40b34e[_0xd3ab('0x1a')][_0xd3ab('0x18')]);}})['catch'](function(_0x1f5f18){logger[_0xd3ab('0x17')](_0xd3ab('0x13'),_0x1338fd,_0x1f5f18);_0x34291a(_0x1f5f18);});});}exports[_0xd3ab('0x1b')]=function(_0x7beca1){var _0x3c52cd=this;return new Promise(function(_0x56bb9a,_0x4bb5a6){return db[_0xd3ab('0x1c')][_0xd3ab('0x1d')](_0x7beca1['body'],{'raw':_0x7beca1[_0xd3ab('0x1e')]?_0x7beca1['options'][_0xd3ab('0x1f')]===undefined?!![]:![]:!![]})[_0xd3ab('0x12')](function(_0x465c75){logger['info'](_0xd3ab('0x1b'),_0x7beca1);logger[_0xd3ab('0x20')]('CreateChatMessage',_0x7beca1,JSON[_0xd3ab('0x16')](_0x465c75));_0x56bb9a(_0x465c75);})[_0xd3ab('0x21')](function(_0x5a2704){logger[_0xd3ab('0x17')]('CreateChatMessage',_0x5a2704[_0xd3ab('0x18')],_0x7beca1);_0x4bb5a6(_0x3c52cd[_0xd3ab('0x17')](0x1f4,_0x5a2704[_0xd3ab('0x18')]));});});}; \ No newline at end of file +var _0xc799=['ChatMessage,\x20%s,\x20%s','message','result','CreateChatMessage','ChatMessage','create','body','options','raw','debug','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','defaults','redis','localhost','register','request','then','info','request\x20sent','stringify','error','code'];(function(_0x4e676e,_0x2a7c6d){var _0x336a3c=function(_0x4767c4){while(--_0x4767c4){_0x4e676e['push'](_0x4e676e['shift']());}};_0x336a3c(++_0x2a7c6d);}(_0xc799,0x146));var _0x9c79=function(_0x21e38e,_0x381a5b){_0x21e38e=_0x21e38e-0x0;var _0x5e89f4=_0xc799[_0x21e38e];return _0x5e89f4;};'use strict';var _=require('lodash');var util=require(_0x9c79('0x0'));var moment=require(_0x9c79('0x1'));var BPromise=require(_0x9c79('0x2'));var rs=require(_0x9c79('0x3'));var fs=require('fs');var Redis=require(_0x9c79('0x4'));var db=require(_0x9c79('0x5'))['db'];var utils=require(_0x9c79('0x6'));var logger=require(_0x9c79('0x7'))(_0x9c79('0x8'));var config=require(_0x9c79('0x9'));var jayson=require(_0x9c79('0xa'));var client=jayson[_0x9c79('0xb')][_0x9c79('0xc')]({'port':0x232a});config['redis']=_[_0x9c79('0xd')](config[_0x9c79('0xe')],{'host':_0x9c79('0xf'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x9c79('0xe')]));require('./chatMessage.socket')[_0x9c79('0x10')](socket);function respondWithRpcPromise(_0x2cb353,_0x4ec184,_0x15f6b9){return new BPromise(function(_0x5164bf,_0x901730){return client[_0x9c79('0x11')](_0x2cb353,_0x15f6b9)[_0x9c79('0x12')](function(_0x1bbe04){logger[_0x9c79('0x13')]('ChatMessage,\x20%s,\x20%s',_0x4ec184,_0x9c79('0x14'));logger['debug']('ChatMessage,\x20%s,\x20%s,\x20%s',_0x4ec184,_0x9c79('0x14'),JSON[_0x9c79('0x15')](_0x1bbe04));if(_0x1bbe04['error']){if(_0x1bbe04[_0x9c79('0x16')][_0x9c79('0x17')]===0x1f4){logger[_0x9c79('0x16')](_0x9c79('0x18'),_0x4ec184,_0x1bbe04[_0x9c79('0x16')]['message']);return _0x901730(_0x1bbe04['error'][_0x9c79('0x19')]);}logger[_0x9c79('0x16')](_0x9c79('0x18'),_0x4ec184,_0x1bbe04[_0x9c79('0x16')][_0x9c79('0x19')]);return _0x5164bf(_0x1bbe04[_0x9c79('0x16')][_0x9c79('0x19')]);}else{logger[_0x9c79('0x13')](_0x9c79('0x18'),_0x4ec184,'request\x20sent');_0x5164bf(_0x1bbe04[_0x9c79('0x1a')]['message']);}})['catch'](function(_0x117dd9){logger[_0x9c79('0x16')]('ChatMessage,\x20%s,\x20%s',_0x4ec184,_0x117dd9);_0x901730(_0x117dd9);});});}exports[_0x9c79('0x1b')]=function(_0x59c772){var _0x455598=this;return new Promise(function(_0x1b095c,_0x426df4){return db[_0x9c79('0x1c')][_0x9c79('0x1d')](_0x59c772[_0x9c79('0x1e')],{'raw':_0x59c772[_0x9c79('0x1f')]?_0x59c772[_0x9c79('0x1f')][_0x9c79('0x20')]===undefined?!![]:![]:!![]})[_0x9c79('0x12')](function(_0x50686a){logger['info']('CreateChatMessage',_0x59c772);logger[_0x9c79('0x21')](_0x9c79('0x1b'),_0x59c772,JSON[_0x9c79('0x15')](_0x50686a));_0x1b095c(_0x50686a);})[_0x9c79('0x22')](function(_0x4bbfc0){logger['error']('CreateChatMessage',_0x4bbfc0[_0x9c79('0x19')],_0x59c772);_0x426df4(_0x455598[_0x9c79('0x16')](0x1f4,_0x4bbfc0[_0x9c79('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.socket.js b/server/api/chatMessage/chatMessage.socket.js index 6568a4d..bfbb276 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 _0xeda8=['chatMessage:','./chatMessage.events','save','update','emit','removeListener','register'];(function(_0x24d24e,_0x4e17a4){var _0x20e068=function(_0x48d5e5){while(--_0x48d5e5){_0x24d24e['push'](_0x24d24e['shift']());}};_0x20e068(++_0x4e17a4);}(_0xeda8,0x104));var _0x8eda=function(_0x4604d4,_0xa4a64d){_0x4604d4=_0x4604d4-0x0;var _0x4302a1=_0xeda8[_0x4604d4];return _0x4302a1;};'use strict';var ChatMessageEvents=require(_0x8eda('0x0'));var events=[_0x8eda('0x1'),'remove',_0x8eda('0x2')];function createListener(_0xd8b5d5,_0x2090a2){return function(_0xc01211){_0x2090a2[_0x8eda('0x3')](_0xd8b5d5,_0xc01211);};}function removeListener(_0x94b83f,_0x25b19a){return function(){ChatMessageEvents[_0x8eda('0x4')](_0x94b83f,_0x25b19a);};}exports[_0x8eda('0x5')]=function(_0x1f3556){for(var _0x349361=0x0,_0x32abe8=events['length'];_0x349361<_0x32abe8;_0x349361++){var _0x28b721=events[_0x349361];var _0x1b6a1d=createListener(_0x8eda('0x6')+_0x28b721,_0x1f3556);ChatMessageEvents['on'](_0x28b721,_0x1b6a1d);}}; \ No newline at end of file +var _0xacf4=['removeListener','register','length','remove','update','emit'];(function(_0x30ae5e,_0x391fc4){var _0x1f2e93=function(_0x60307d){while(--_0x60307d){_0x30ae5e['push'](_0x30ae5e['shift']());}};_0x1f2e93(++_0x391fc4);}(_0xacf4,0xe7));var _0x4acf=function(_0x59312d,_0x52bb25){_0x59312d=_0x59312d-0x0;var _0x13ca66=_0xacf4[_0x59312d];return _0x13ca66;};'use strict';var ChatMessageEvents=require('./chatMessage.events');var events=['save',_0x4acf('0x0'),_0x4acf('0x1')];function createListener(_0x1e2413,_0x21fb75){return function(_0x25709c){_0x21fb75[_0x4acf('0x2')](_0x1e2413,_0x25709c);};}function removeListener(_0x145264,_0x5cf22d){return function(){ChatMessageEvents[_0x4acf('0x3')](_0x145264,_0x5cf22d);};}exports[_0x4acf('0x4')]=function(_0x4e0c43){for(var _0x24bf24=0x0,_0x2ba08a=events[_0x4acf('0x5')];_0x24bf24<_0x2ba08a;_0x24bf24++){var _0x45a5a4=events[_0x24bf24];var _0x25d345=createListener('chatMessage:'+_0x45a5a4,_0x4e0c43);ChatMessageEvents['on'](_0x45a5a4,_0x25d345);}}; \ No newline at end of file diff --git a/server/api/chatMessage/index.js b/server/api/chatMessage/index.js index c6bd94a..9a965f4 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 _0x0c0b=['accept','/:id/reject','reject','destroy','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','/describe','describe','get','/:id','show','post','tracked','chat','create','put','/:id/accept'];(function(_0x378720,_0xa711f1){var _0x47920a=function(_0xc5056){while(--_0xc5056){_0x378720['push'](_0x378720['shift']());}};_0x47920a(++_0xa711f1);}(_0x0c0b,0x81));var _0xb0c0=function(_0x15d9b2,_0x463fe5){_0x15d9b2=_0x15d9b2-0x0;var _0x1b8e8c=_0x0c0b[_0x15d9b2];return _0x1b8e8c;};'use strict';var multer=require(_0xb0c0('0x0'));var util=require('util');var path=require(_0xb0c0('0x1'));var timeout=require(_0xb0c0('0x2'));var express=require(_0xb0c0('0x3'));var router=express[_0xb0c0('0x4')]();var auth=require(_0xb0c0('0x5'));var interaction=require(_0xb0c0('0x6'));var config=require(_0xb0c0('0x7'));var controller=require('./chatMessage.controller');router['get']('/',auth[_0xb0c0('0x8')](),controller[_0xb0c0('0x9')]);router['get'](_0xb0c0('0xa'),auth['isAuthenticated'](),controller[_0xb0c0('0xb')]);router[_0xb0c0('0xc')](_0xb0c0('0xd'),auth['isAuthenticated'](),controller[_0xb0c0('0xe')]);router[_0xb0c0('0xf')]('/',auth[_0xb0c0('0x8')](),interaction[_0xb0c0('0x10')](_0xb0c0('0x11'),'chatmessage:create'),controller[_0xb0c0('0x12')]);router[_0xb0c0('0x13')](_0xb0c0('0xd'),controller['update']);router[_0xb0c0('0x13')](_0xb0c0('0x14'),auth[_0xb0c0('0x8')](),controller[_0xb0c0('0x15')]);router[_0xb0c0('0x13')](_0xb0c0('0x16'),auth['isAuthenticated'](),controller[_0xb0c0('0x17')]);router['delete']('/:id',auth[_0xb0c0('0x8')](),controller[_0xb0c0('0x18')]);module['exports']=router; \ No newline at end of file +var _0xda9d=['create','put','/:id/accept','reject','/:id','exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./chatMessage.controller','get','/describe','isAuthenticated','describe','show','post','tracked'];(function(_0x5b4c95,_0x3d7219){var _0x238df5=function(_0x2966b5){while(--_0x2966b5){_0x5b4c95['push'](_0x5b4c95['shift']());}};_0x238df5(++_0x3d7219);}(_0xda9d,0x195));var _0xdda9=function(_0x343e44,_0x519af9){_0x343e44=_0x343e44-0x0;var _0xa5130e=_0xda9d[_0x343e44];return _0xa5130e;};'use strict';var multer=require('multer');var util=require(_0xdda9('0x0'));var path=require(_0xdda9('0x1'));var timeout=require(_0xdda9('0x2'));var express=require(_0xdda9('0x3'));var router=express[_0xdda9('0x4')]();var auth=require(_0xdda9('0x5'));var interaction=require(_0xdda9('0x6'));var config=require('../../config/environment');var controller=require(_0xdda9('0x7'));router[_0xdda9('0x8')]('/',auth['isAuthenticated'](),controller['index']);router[_0xdda9('0x8')](_0xdda9('0x9'),auth[_0xdda9('0xa')](),controller[_0xdda9('0xb')]);router['get']('/:id',auth[_0xdda9('0xa')](),controller[_0xdda9('0xc')]);router[_0xdda9('0xd')]('/',auth[_0xdda9('0xa')](),interaction[_0xdda9('0xe')]('chat','chatmessage:create'),controller[_0xdda9('0xf')]);router[_0xdda9('0x10')]('/:id',controller['update']);router[_0xdda9('0x10')](_0xdda9('0x11'),auth[_0xdda9('0xa')](),controller['accept']);router['put']('/:id/reject',auth[_0xdda9('0xa')](),controller[_0xdda9('0x12')]);router['delete'](_0xdda9('0x13'),auth[_0xdda9('0xa')](),controller['destroy']);module[_0xdda9('0x14')]=router; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.attributes.js b/server/api/chatOfflineMessage/chatOfflineMessage.attributes.js index e6cfbf8..dd3b38f 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 _0x1306=['sequelize','exports','TEXT'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x1306,0x99));var _0x6130=function(_0x19ee6a,_0x42f15e){_0x19ee6a=_0x19ee6a-0x0;var _0x48ffbf=_0x1306[_0x19ee6a];return _0x48ffbf;};'use strict';var Sequelize=require(_0x6130('0x0'));module[_0x6130('0x1')]={'body':{'type':Sequelize[_0x6130('0x2')]('medium'),'allowNull':![]}}; \ No newline at end of file +var _0xa97d=['exports','medium','sequelize'];(function(_0x445aaa,_0x23be09){var _0x3079d6=function(_0x1ae48e){while(--_0x1ae48e){_0x445aaa['push'](_0x445aaa['shift']());}};_0x3079d6(++_0x23be09);}(_0xa97d,0x11f));var _0xda97=function(_0x5ceb75,_0x285bba){_0x5ceb75=_0x5ceb75-0x0;var _0x2b4079=_0xa97d[_0x5ceb75];return _0x2b4079;};'use strict';var Sequelize=require(_0xda97('0x0'));module[_0xda97('0x1')]={'body':{'type':Sequelize['TEXT'](_0xda97('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 2248641..ef31ba2 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 _0x1883=['fields','length','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','catch','show','find','create','body','params','describe','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','sendStatus','status','end','json','count','offset','limit','set','Content-Range','reject','update','then','destroy','error','stack','name','send','index','map','ChatOfflineMessage','rawAttributes','fieldName','type','model','keys','query','filters','intersection','attributes'];(function(_0x256f51,_0x3092bd){var _0x486ac6=function(_0x46ebe4){while(--_0x46ebe4){_0x256f51['push'](_0x256f51['shift']());}};_0x486ac6(++_0x3092bd);}(_0x1883,0xab));var _0x3188=function(_0x4e04f1,_0x198d5f){_0x4e04f1=_0x4e04f1-0x0;var _0x2c1544=_0x1883[_0x4e04f1];return _0x2c1544;};'use strict';var pdf=require(_0x3188('0x0'));var emlformat=require(_0x3188('0x1'));var rimraf=require(_0x3188('0x2'));var zipdir=require(_0x3188('0x3'));var jsonpatch=require(_0x3188('0x4'));var rp=require(_0x3188('0x5'));var moment=require(_0x3188('0x6'));var BPromise=require(_0x3188('0x7'));var Mustache=require(_0x3188('0x8'));var util=require(_0x3188('0x9'));var path=require(_0x3188('0xa'));var sox=require(_0x3188('0xb'));var csv=require(_0x3188('0xc'));var ejs=require(_0x3188('0xd'));var fs=require('fs');var _=require(_0x3188('0xe'));var squel=require(_0x3188('0xf'));var crypto=require(_0x3188('0x10'));var jsforce=require('jsforce');var deskjs=require(_0x3188('0x11'));var toCsv=require(_0x3188('0xc'));var querystring=require('querystring');var Papa=require(_0x3188('0x12'));var Redis=require('ioredis');var authService=require(_0x3188('0x13'));var qs=require(_0x3188('0x14'));var as=require(_0x3188('0x15'));var hardwareService=require(_0x3188('0x16'));var logger=require('../../config/logger')(_0x3188('0x17'));var utils=require(_0x3188('0x18'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x339b4a,_0x45e94e){_0x45e94e=_0x45e94e||0xcc;return function(_0x20fef6){if(_0x20fef6){return _0x339b4a[_0x3188('0x19')](_0x45e94e);}return _0x339b4a[_0x3188('0x1a')](_0x45e94e)[_0x3188('0x1b')]();};}function respondWithResult(_0x490104,_0x276d69){_0x276d69=_0x276d69||0xc8;return function(_0x5e0044){if(_0x5e0044){return _0x490104['status'](_0x276d69)[_0x3188('0x1c')](_0x5e0044);}};}function respondWithFilteredResult(_0x53668b,_0x54a87f){return function(_0x32c239){if(_0x32c239){var _0x1beead=_0x32c239[_0x3188('0x1d')],_0xa2269=_0x54a87f['offset'],_0x195d8e=_0x54a87f[_0x3188('0x1e')]+_0x54a87f[_0x3188('0x1f')],_0x145293;if(_0x195d8e>=_0x1beead){_0x195d8e=_0x1beead;_0x145293=0xc8;}else{_0x145293=0xce;}_0x53668b[_0x3188('0x1a')](_0x145293);return _0x53668b[_0x3188('0x20')](_0x3188('0x21'),_0xa2269+'-'+_0x195d8e+'/'+_0x1beead)[_0x3188('0x1c')](_0x32c239);}return null;};}function patchUpdates(_0xac7f48){return function(_0x4602c6){try{jsonpatch['apply'](_0x4602c6,_0xac7f48,!![]);}catch(_0x354338){return BPromise[_0x3188('0x22')](_0x354338);}return _0x4602c6['save']();};}function saveUpdates(_0x518b2f,_0x5d8d62){return function(_0x46a318){if(_0x46a318){return _0x46a318[_0x3188('0x23')](_0x518b2f)[_0x3188('0x24')](function(_0x5980f3){return _0x5980f3;});}return null;};}function removeEntity(_0x48673c,_0x266260){return function(_0x461286){if(_0x461286){return _0x461286[_0x3188('0x25')]()[_0x3188('0x24')](function(){_0x48673c[_0x3188('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x30cf2c,_0x33f882){return function(_0x5a2e67){if(!_0x5a2e67){_0x30cf2c[_0x3188('0x19')](0x194);}return _0x5a2e67;};}function handleError(_0x4be6c3,_0x5c69be){_0x5c69be=_0x5c69be||0x1f4;return function(_0x45ae2f){logger[_0x3188('0x26')](_0x45ae2f[_0x3188('0x27')]);if(_0x45ae2f[_0x3188('0x28')]){delete _0x45ae2f[_0x3188('0x28')];}_0x4be6c3[_0x3188('0x1a')](_0x5c69be)[_0x3188('0x29')](_0x45ae2f);};}exports[_0x3188('0x2a')]=function(_0x4b4675,_0x2cc5d9){var _0x2d000a={},_0x52bb13={},_0xd3ee40={'count':0x0,'rows':[]};var _0x14299b=_[_0x3188('0x2b')](db[_0x3188('0x2c')][_0x3188('0x2d')],function(_0x1f1c6f){return{'name':_0x1f1c6f[_0x3188('0x2e')],'type':_0x1f1c6f[_0x3188('0x2f')]['key']};});_0x52bb13[_0x3188('0x30')]=_['map'](_0x14299b,_0x3188('0x28'));_0x52bb13['query']=_[_0x3188('0x31')](_0x4b4675[_0x3188('0x32')]);_0x52bb13[_0x3188('0x33')]=_[_0x3188('0x34')](_0x52bb13[_0x3188('0x30')],_0x52bb13[_0x3188('0x32')]);_0x2d000a[_0x3188('0x35')]=_[_0x3188('0x34')](_0x52bb13[_0x3188('0x30')],qs[_0x3188('0x36')](_0x4b4675[_0x3188('0x32')][_0x3188('0x36')]));_0x2d000a[_0x3188('0x35')]=_0x2d000a[_0x3188('0x35')][_0x3188('0x37')]?_0x2d000a[_0x3188('0x35')]:_0x52bb13[_0x3188('0x30')];if(!_0x4b4675[_0x3188('0x32')]['hasOwnProperty'](_0x3188('0x38'))){_0x2d000a['limit']=qs[_0x3188('0x1f')](_0x4b4675[_0x3188('0x32')]['limit']);_0x2d000a[_0x3188('0x1e')]=qs[_0x3188('0x1e')](_0x4b4675[_0x3188('0x32')][_0x3188('0x1e')]);}_0x2d000a[_0x3188('0x39')]=qs[_0x3188('0x3a')](_0x4b4675[_0x3188('0x32')]['sort']);_0x2d000a['where']=qs[_0x3188('0x33')](_[_0x3188('0x3b')](_0x4b4675[_0x3188('0x32')],_0x52bb13[_0x3188('0x33')]),_0x14299b);if(_0x4b4675['query'][_0x3188('0x3c')]){_0x2d000a[_0x3188('0x3d')]=_[_0x3188('0x3e')](_0x2d000a[_0x3188('0x3d')],{'$or':_['map'](_0x14299b,function(_0x201ef2){if(_0x201ef2['type']!==_0x3188('0x3f')){var _0x57895f={};_0x57895f[_0x201ef2[_0x3188('0x28')]]={'$like':'%'+_0x4b4675[_0x3188('0x32')][_0x3188('0x3c')]+'%'};return _0x57895f;}})});}_0x2d000a=_[_0x3188('0x3e')]({},_0x2d000a,_0x4b4675[_0x3188('0x40')]);var _0x2305bf={'where':_0x2d000a[_0x3188('0x3d')]};return db[_0x3188('0x2c')][_0x3188('0x1d')](_0x2305bf)[_0x3188('0x24')](function(_0x539a0f){_0xd3ee40[_0x3188('0x1d')]=_0x539a0f;if(_0x4b4675[_0x3188('0x32')][_0x3188('0x41')]){_0x2d000a[_0x3188('0x42')]=[{'all':!![]}];}return db[_0x3188('0x2c')][_0x3188('0x43')](_0x2d000a);})['then'](function(_0x6b2347){_0xd3ee40['rows']=_0x6b2347;return _0xd3ee40;})[_0x3188('0x24')](respondWithFilteredResult(_0x2cc5d9,_0x2d000a))[_0x3188('0x44')](handleError(_0x2cc5d9,null));};exports[_0x3188('0x45')]=function(_0x8f3756,_0x42c47b){var _0x549ab2={'raw':!![],'where':{'id':_0x8f3756['params']['id']}},_0x484eeb={};_0x484eeb['model']=_['keys'](db[_0x3188('0x2c')][_0x3188('0x2d')]);_0x484eeb[_0x3188('0x32')]=_[_0x3188('0x31')](_0x8f3756[_0x3188('0x32')]);_0x484eeb['filters']=_[_0x3188('0x34')](_0x484eeb['model'],_0x484eeb[_0x3188('0x32')]);_0x549ab2[_0x3188('0x35')]=_[_0x3188('0x34')](_0x484eeb[_0x3188('0x30')],qs['fields'](_0x8f3756[_0x3188('0x32')][_0x3188('0x36')]));_0x549ab2[_0x3188('0x35')]=_0x549ab2[_0x3188('0x35')][_0x3188('0x37')]?_0x549ab2['attributes']:_0x484eeb['model'];if(_0x8f3756[_0x3188('0x32')][_0x3188('0x41')]){_0x549ab2['include']=[{'all':!![]}];}_0x549ab2=_[_0x3188('0x3e')]({},_0x549ab2,_0x8f3756[_0x3188('0x40')]);return db['ChatOfflineMessage'][_0x3188('0x46')](_0x549ab2)[_0x3188('0x24')](handleEntityNotFound(_0x42c47b,null))[_0x3188('0x24')](respondWithResult(_0x42c47b,null))[_0x3188('0x44')](handleError(_0x42c47b,null));};exports[_0x3188('0x47')]=function(_0x5a3142,_0x467ead){return db['ChatOfflineMessage'][_0x3188('0x47')](_0x5a3142[_0x3188('0x48')],{})[_0x3188('0x24')](respondWithResult(_0x467ead,0xc9))[_0x3188('0x44')](handleError(_0x467ead,null));};exports[_0x3188('0x23')]=function(_0x315524,_0x2aa232){if(_0x315524[_0x3188('0x48')]['id']){delete _0x315524[_0x3188('0x48')]['id'];}return db[_0x3188('0x2c')][_0x3188('0x46')]({'where':{'id':_0x315524['params']['id']}})['then'](handleEntityNotFound(_0x2aa232,null))[_0x3188('0x24')](saveUpdates(_0x315524['body'],null))[_0x3188('0x24')](respondWithResult(_0x2aa232,null))[_0x3188('0x44')](handleError(_0x2aa232,null));};exports['destroy']=function(_0x3abc6b,_0x16417a){return db[_0x3188('0x2c')][_0x3188('0x46')]({'where':{'id':_0x3abc6b[_0x3188('0x49')]['id']}})[_0x3188('0x24')](handleEntityNotFound(_0x16417a,null))[_0x3188('0x24')](removeEntity(_0x16417a,null))[_0x3188('0x44')](handleError(_0x16417a,null));};exports['describe']=function(_0x3b8fe9,_0x3051ce){return db['ChatOfflineMessage'][_0x3188('0x4a')]()['then'](respondWithResult(_0x3051ce,null))[_0x3188('0x44')](handleError(_0x3051ce,null));}; \ No newline at end of file +var _0x6050=['end','count','offset','limit','set','Content-Range','json','apply','save','update','then','destroy','error','stack','name','send','map','ChatOfflineMessage','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filter','merge','VIRTUAL','options','includeAll','findAll','show','params','keys','rawAttributes','find','catch','create','body','describe','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','ejs','jsforce','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status'];(function(_0x313086,_0x8027d5){var _0x7c2858=function(_0x26227f){while(--_0x26227f){_0x313086['push'](_0x313086['shift']());}};_0x7c2858(++_0x8027d5);}(_0x6050,0x196));var _0x0605=function(_0x48b5ad,_0x8545e3){_0x48b5ad=_0x48b5ad-0x0;var _0x4398af=_0x6050[_0x48b5ad];return _0x4398af;};'use strict';var pdf=require(_0x0605('0x0'));var emlformat=require(_0x0605('0x1'));var rimraf=require(_0x0605('0x2'));var zipdir=require(_0x0605('0x3'));var jsonpatch=require(_0x0605('0x4'));var rp=require(_0x0605('0x5'));var moment=require('moment');var BPromise=require(_0x0605('0x6'));var Mustache=require(_0x0605('0x7'));var util=require(_0x0605('0x8'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x0605('0x9'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x0605('0xa'));var deskjs=require(_0x0605('0xb'));var toCsv=require(_0x0605('0xc'));var querystring=require(_0x0605('0xd'));var Papa=require(_0x0605('0xe'));var Redis=require('ioredis');var authService=require(_0x0605('0xf'));var qs=require(_0x0605('0x10'));var as=require(_0x0605('0x11'));var hardwareService=require(_0x0605('0x12'));var logger=require(_0x0605('0x13'))(_0x0605('0x14'));var utils=require(_0x0605('0x15'));var config=require(_0x0605('0x16'));var db=require(_0x0605('0x17'))['db'];function respondWithStatusCode(_0x434e62,_0xd22e35){_0xd22e35=_0xd22e35||0xcc;return function(_0x39e288){if(_0x39e288){return _0x434e62[_0x0605('0x18')](_0xd22e35);}return _0x434e62[_0x0605('0x19')](_0xd22e35)[_0x0605('0x1a')]();};}function respondWithResult(_0x44e793,_0x169a70){_0x169a70=_0x169a70||0xc8;return function(_0x65a20b){if(_0x65a20b){return _0x44e793[_0x0605('0x19')](_0x169a70)['json'](_0x65a20b);}};}function respondWithFilteredResult(_0x2b4610,_0x1a802b){return function(_0x4993ab){if(_0x4993ab){var _0x5ce56a=_0x4993ab[_0x0605('0x1b')],_0x4eefe9=_0x1a802b[_0x0605('0x1c')],_0x12a455=_0x1a802b[_0x0605('0x1c')]+_0x1a802b[_0x0605('0x1d')],_0xd0996d;if(_0x12a455>=_0x5ce56a){_0x12a455=_0x5ce56a;_0xd0996d=0xc8;}else{_0xd0996d=0xce;}_0x2b4610[_0x0605('0x19')](_0xd0996d);return _0x2b4610[_0x0605('0x1e')](_0x0605('0x1f'),_0x4eefe9+'-'+_0x12a455+'/'+_0x5ce56a)[_0x0605('0x20')](_0x4993ab);}return null;};}function patchUpdates(_0x3a22e9){return function(_0x2fa77e){try{jsonpatch[_0x0605('0x21')](_0x2fa77e,_0x3a22e9,!![]);}catch(_0x103952){return BPromise['reject'](_0x103952);}return _0x2fa77e[_0x0605('0x22')]();};}function saveUpdates(_0x14a920,_0x430f28){return function(_0x443326){if(_0x443326){return _0x443326[_0x0605('0x23')](_0x14a920)[_0x0605('0x24')](function(_0x379211){return _0x379211;});}return null;};}function removeEntity(_0x2c90ed,_0x226ef5){return function(_0x5b0d44){if(_0x5b0d44){return _0x5b0d44[_0x0605('0x25')]()['then'](function(){_0x2c90ed[_0x0605('0x19')](0xcc)[_0x0605('0x1a')]();});}};}function handleEntityNotFound(_0x110098,_0xf182c4){return function(_0x10c575){if(!_0x10c575){_0x110098[_0x0605('0x18')](0x194);}return _0x10c575;};}function handleError(_0x2ea61d,_0x1ae3db){_0x1ae3db=_0x1ae3db||0x1f4;return function(_0x234231){logger[_0x0605('0x26')](_0x234231[_0x0605('0x27')]);if(_0x234231[_0x0605('0x28')]){delete _0x234231['name'];}_0x2ea61d[_0x0605('0x19')](_0x1ae3db)[_0x0605('0x29')](_0x234231);};}exports['index']=function(_0x4d9a31,_0x55ebd8){var _0x33558f={},_0x226825={},_0x4163cd={'count':0x0,'rows':[]};var _0x149e36=_[_0x0605('0x2a')](db[_0x0605('0x2b')]['rawAttributes'],function(_0x34f25d){return{'name':_0x34f25d['fieldName'],'type':_0x34f25d[_0x0605('0x2c')][_0x0605('0x2d')]};});_0x226825[_0x0605('0x2e')]=_[_0x0605('0x2a')](_0x149e36,_0x0605('0x28'));_0x226825[_0x0605('0x2f')]=_['keys'](_0x4d9a31[_0x0605('0x2f')]);_0x226825[_0x0605('0x30')]=_[_0x0605('0x31')](_0x226825[_0x0605('0x2e')],_0x226825[_0x0605('0x2f')]);_0x33558f[_0x0605('0x32')]=_[_0x0605('0x31')](_0x226825[_0x0605('0x2e')],qs[_0x0605('0x33')](_0x4d9a31[_0x0605('0x2f')][_0x0605('0x33')]));_0x33558f[_0x0605('0x32')]=_0x33558f[_0x0605('0x32')][_0x0605('0x34')]?_0x33558f[_0x0605('0x32')]:_0x226825[_0x0605('0x2e')];if(!_0x4d9a31[_0x0605('0x2f')][_0x0605('0x35')](_0x0605('0x36'))){_0x33558f[_0x0605('0x1d')]=qs[_0x0605('0x1d')](_0x4d9a31[_0x0605('0x2f')][_0x0605('0x1d')]);_0x33558f[_0x0605('0x1c')]=qs[_0x0605('0x1c')](_0x4d9a31[_0x0605('0x2f')][_0x0605('0x1c')]);}_0x33558f['order']=qs[_0x0605('0x37')](_0x4d9a31[_0x0605('0x2f')]['sort']);_0x33558f[_0x0605('0x38')]=qs[_0x0605('0x30')](_['pick'](_0x4d9a31[_0x0605('0x2f')],_0x226825[_0x0605('0x30')]),_0x149e36);if(_0x4d9a31[_0x0605('0x2f')][_0x0605('0x39')]){_0x33558f[_0x0605('0x38')]=_[_0x0605('0x3a')](_0x33558f['where'],{'$or':_['map'](_0x149e36,function(_0x216f82){if(_0x216f82[_0x0605('0x2c')]!==_0x0605('0x3b')){var _0x500497={};_0x500497[_0x216f82[_0x0605('0x28')]]={'$like':'%'+_0x4d9a31['query'][_0x0605('0x39')]+'%'};return _0x500497;}})});}_0x33558f=_[_0x0605('0x3a')]({},_0x33558f,_0x4d9a31[_0x0605('0x3c')]);var _0x22b61c={'where':_0x33558f[_0x0605('0x38')]};return db[_0x0605('0x2b')][_0x0605('0x1b')](_0x22b61c)[_0x0605('0x24')](function(_0x2ef7bf){_0x4163cd[_0x0605('0x1b')]=_0x2ef7bf;if(_0x4d9a31['query'][_0x0605('0x3d')]){_0x33558f['include']=[{'all':!![]}];}return db[_0x0605('0x2b')][_0x0605('0x3e')](_0x33558f);})[_0x0605('0x24')](function(_0x479c55){_0x4163cd['rows']=_0x479c55;return _0x4163cd;})[_0x0605('0x24')](respondWithFilteredResult(_0x55ebd8,_0x33558f))['catch'](handleError(_0x55ebd8,null));};exports[_0x0605('0x3f')]=function(_0x52f4b6,_0xef54f1){var _0x3de34a={'raw':!![],'where':{'id':_0x52f4b6[_0x0605('0x40')]['id']}},_0x354f4e={};_0x354f4e[_0x0605('0x2e')]=_[_0x0605('0x41')](db[_0x0605('0x2b')][_0x0605('0x42')]);_0x354f4e[_0x0605('0x2f')]=_[_0x0605('0x41')](_0x52f4b6[_0x0605('0x2f')]);_0x354f4e['filters']=_['intersection'](_0x354f4e[_0x0605('0x2e')],_0x354f4e['query']);_0x3de34a[_0x0605('0x32')]=_[_0x0605('0x31')](_0x354f4e['model'],qs[_0x0605('0x33')](_0x52f4b6[_0x0605('0x2f')]['fields']));_0x3de34a[_0x0605('0x32')]=_0x3de34a[_0x0605('0x32')]['length']?_0x3de34a[_0x0605('0x32')]:_0x354f4e[_0x0605('0x2e')];if(_0x52f4b6['query'][_0x0605('0x3d')]){_0x3de34a['include']=[{'all':!![]}];}_0x3de34a=_['merge']({},_0x3de34a,_0x52f4b6[_0x0605('0x3c')]);return db[_0x0605('0x2b')][_0x0605('0x43')](_0x3de34a)[_0x0605('0x24')](handleEntityNotFound(_0xef54f1,null))[_0x0605('0x24')](respondWithResult(_0xef54f1,null))[_0x0605('0x44')](handleError(_0xef54f1,null));};exports[_0x0605('0x45')]=function(_0x232c93,_0x56190c){return db[_0x0605('0x2b')][_0x0605('0x45')](_0x232c93[_0x0605('0x46')],{})['then'](respondWithResult(_0x56190c,0xc9))[_0x0605('0x44')](handleError(_0x56190c,null));};exports[_0x0605('0x23')]=function(_0x45cc1a,_0x3a1624){if(_0x45cc1a[_0x0605('0x46')]['id']){delete _0x45cc1a[_0x0605('0x46')]['id'];}return db[_0x0605('0x2b')][_0x0605('0x43')]({'where':{'id':_0x45cc1a[_0x0605('0x40')]['id']}})['then'](handleEntityNotFound(_0x3a1624,null))[_0x0605('0x24')](saveUpdates(_0x45cc1a[_0x0605('0x46')],null))[_0x0605('0x24')](respondWithResult(_0x3a1624,null))[_0x0605('0x44')](handleError(_0x3a1624,null));};exports[_0x0605('0x25')]=function(_0x434289,_0x18995e){return db[_0x0605('0x2b')][_0x0605('0x43')]({'where':{'id':_0x434289[_0x0605('0x40')]['id']}})['then'](handleEntityNotFound(_0x18995e,null))['then'](removeEntity(_0x18995e,null))['catch'](handleError(_0x18995e,null));};exports[_0x0605('0x47')]=function(_0x7daeb7,_0x46d852){return db[_0x0605('0x2b')][_0x0605('0x47')]()[_0x0605('0x24')](respondWithResult(_0x46d852,null))['catch'](handleError(_0x46d852,null));}; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.model.js b/server/api/chatOfflineMessage/chatOfflineMessage.model.js index d7afffe..7800e4f 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 _0x867d=['lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','define','ChatOfflineMessage','chat_offline_messages','utf8mb4','utf8mb4_unicode_ci'];(function(_0x474b2d,_0x3c036d){var _0x28092c=function(_0xeb6467){while(--_0xeb6467){_0x474b2d['push'](_0x474b2d['shift']());}};_0x28092c(++_0x3c036d);}(_0x867d,0x134));var _0xd867=function(_0x2a0cad,_0x27bea2){_0x2a0cad=_0x2a0cad-0x0;var _0x14170b=_0x867d[_0x2a0cad];return _0x14170b;};'use strict';var _=require(_0xd867('0x0'));var util=require(_0xd867('0x1'));var logger=require(_0xd867('0x2'))(_0xd867('0x3'));var moment=require('moment');var BPromise=require(_0xd867('0x4'));var rp=require(_0xd867('0x5'));var fs=require('fs');var path=require(_0xd867('0x6'));var rimraf=require(_0xd867('0x7'));var config=require(_0xd867('0x8'));var attributes=require('./chatOfflineMessage.attributes');module['exports']=function(_0x36d7d9,_0x2fbbe4){return _0x36d7d9[_0xd867('0x9')](_0xd867('0xa'),attributes,{'tableName':_0xd867('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xd867('0xc'),'collate':_0xd867('0xd')});}; \ No newline at end of file +var _0x4ed6=['exports','define','ChatOfflineMessage','chat_offline_messages','utf8mb4','utf8mb4_unicode_ci','lodash','util','api','moment','request-promise','rimraf','../../config/environment','./chatOfflineMessage.attributes'];(function(_0x27b30f,_0x3949fe){var _0x3b563a=function(_0x3d8c66){while(--_0x3d8c66){_0x27b30f['push'](_0x27b30f['shift']());}};_0x3b563a(++_0x3949fe);}(_0x4ed6,0x76));var _0x64ed=function(_0x554c56,_0x35958f){_0x554c56=_0x554c56-0x0;var _0x50d470=_0x4ed6[_0x554c56];return _0x50d470;};'use strict';var _=require(_0x64ed('0x0'));var util=require(_0x64ed('0x1'));var logger=require('../../config/logger')(_0x64ed('0x2'));var moment=require(_0x64ed('0x3'));var BPromise=require('bluebird');var rp=require(_0x64ed('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x64ed('0x5'));var config=require(_0x64ed('0x6'));var attributes=require(_0x64ed('0x7'));module[_0x64ed('0x8')]=function(_0x1782c1,_0x1e1af1){return _0x1782c1[_0x64ed('0x9')](_0x64ed('0xa'),attributes,{'tableName':_0x64ed('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x64ed('0xc'),'collate':_0x64ed('0xd')});}; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.rpc.js b/server/api/chatOfflineMessage/chatOfflineMessage.rpc.js index d77d065..732aced 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 _0x078b=['ChatOfflineMessage,\x20%s,\x20%s','request\x20sent','debug','ChatOfflineMessage,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','request','then','info'];(function(_0x628eee,_0x3f3fba){var _0x447718=function(_0x38112b){while(--_0x38112b){_0x628eee['push'](_0x628eee['shift']());}};_0x447718(++_0x3f3fba);}(_0x078b,0x1ed));var _0xb078=function(_0x22ad4e,_0x165ba6){_0x22ad4e=_0x22ad4e-0x0;var _0x4750cc=_0x078b[_0x22ad4e];return _0x4750cc;};'use strict';var _=require(_0xb078('0x0'));var util=require(_0xb078('0x1'));var moment=require(_0xb078('0x2'));var BPromise=require('bluebird');var rs=require(_0xb078('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb078('0x4'))['db'];var utils=require(_0xb078('0x5'));var logger=require(_0xb078('0x6'))(_0xb078('0x7'));var config=require(_0xb078('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0xb078('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3ecc79,_0x3a7da2,_0xce5c6){return new BPromise(function(_0x2d043e,_0x2a42a6){return client[_0xb078('0xa')](_0x3ecc79,_0xce5c6)[_0xb078('0xb')](function(_0x4b8fd5){logger[_0xb078('0xc')](_0xb078('0xd'),_0x3a7da2,_0xb078('0xe'));logger[_0xb078('0xf')](_0xb078('0x10'),_0x3a7da2,'request\x20sent',JSON[_0xb078('0x11')](_0x4b8fd5));if(_0x4b8fd5[_0xb078('0x12')]){if(_0x4b8fd5['error']['code']===0x1f4){logger[_0xb078('0x12')]('ChatOfflineMessage,\x20%s,\x20%s',_0x3a7da2,_0x4b8fd5[_0xb078('0x12')][_0xb078('0x13')]);return _0x2a42a6(_0x4b8fd5[_0xb078('0x12')]['message']);}logger[_0xb078('0x12')]('ChatOfflineMessage,\x20%s,\x20%s',_0x3a7da2,_0x4b8fd5[_0xb078('0x12')][_0xb078('0x13')]);return _0x2d043e(_0x4b8fd5[_0xb078('0x12')][_0xb078('0x13')]);}else{logger[_0xb078('0xc')](_0xb078('0xd'),_0x3a7da2,'request\x20sent');_0x2d043e(_0x4b8fd5[_0xb078('0x14')][_0xb078('0x13')]);}})[_0xb078('0x15')](function(_0x4effcc){logger[_0xb078('0x12')](_0xb078('0xd'),_0x3a7da2,_0x4effcc);_0x2a42a6(_0x4effcc);});});} \ No newline at end of file +var _0x1478=['rpc','../../config/environment','jayson/promise','client','http','request','then','ChatOfflineMessage,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','catch','moment','randomstring','../../mysqldb','../../config/logger'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x1478,0x74));var _0x8147=function(_0x302a64,_0x191bf6){_0x302a64=_0x302a64-0x0;var _0xc4c71e=_0x1478[_0x302a64];return _0xc4c71e;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x8147('0x0'));var BPromise=require('bluebird');var rs=require(_0x8147('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x8147('0x2'))['db'];var utils=require('../../config/utils');var logger=require(_0x8147('0x3'))(_0x8147('0x4'));var config=require(_0x8147('0x5'));var jayson=require(_0x8147('0x6'));var client=jayson[_0x8147('0x7')][_0x8147('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x5197ea,_0x451ff6,_0x403a55){return new BPromise(function(_0xde8c70,_0x440394){return client[_0x8147('0x9')](_0x5197ea,_0x403a55)[_0x8147('0xa')](function(_0x4bc7c7){logger['info'](_0x8147('0xb'),_0x451ff6,_0x8147('0xc'));logger['debug']('ChatOfflineMessage,\x20%s,\x20%s,\x20%s',_0x451ff6,_0x8147('0xc'),JSON[_0x8147('0xd')](_0x4bc7c7));if(_0x4bc7c7[_0x8147('0xe')]){if(_0x4bc7c7['error'][_0x8147('0xf')]===0x1f4){logger[_0x8147('0xe')](_0x8147('0xb'),_0x451ff6,_0x4bc7c7['error'][_0x8147('0x10')]);return _0x440394(_0x4bc7c7['error']['message']);}logger[_0x8147('0xe')](_0x8147('0xb'),_0x451ff6,_0x4bc7c7[_0x8147('0xe')][_0x8147('0x10')]);return _0xde8c70(_0x4bc7c7[_0x8147('0xe')][_0x8147('0x10')]);}else{logger[_0x8147('0x11')](_0x8147('0xb'),_0x451ff6,_0x8147('0xc'));_0xde8c70(_0x4bc7c7[_0x8147('0x12')][_0x8147('0x10')]);}})[_0x8147('0x13')](function(_0x432107){logger['error'](_0x8147('0xb'),_0x451ff6,_0x432107);_0x440394(_0x432107);});});} \ No newline at end of file diff --git a/server/api/chatOfflineMessage/index.js b/server/api/chatOfflineMessage/index.js index 214f30f..7a0e566 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 _0x00dd=['isAuthenticated','index','describe','/:id','show','post','create','put','update','destroy','exports','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get'];(function(_0x3054be,_0x1bdc8b){var _0x3df150=function(_0x56cfbf){while(--_0x56cfbf){_0x3054be['push'](_0x3054be['shift']());}};_0x3df150(++_0x1bdc8b);}(_0x00dd,0x89));var _0xd00d=function(_0x38c3f3,_0x544c71){_0x38c3f3=_0x38c3f3-0x0;var _0x285b99=_0x00dd[_0x38c3f3];return _0x285b99;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0xd00d('0x0'));var express=require(_0xd00d('0x1'));var router=express[_0xd00d('0x2')]();var auth=require(_0xd00d('0x3'));var interaction=require(_0xd00d('0x4'));var config=require(_0xd00d('0x5'));var controller=require('./chatOfflineMessage.controller');router[_0xd00d('0x6')]('/',auth[_0xd00d('0x7')](),controller[_0xd00d('0x8')]);router['get']('/describe',auth[_0xd00d('0x7')](),controller[_0xd00d('0x9')]);router['get'](_0xd00d('0xa'),auth[_0xd00d('0x7')](),controller[_0xd00d('0xb')]);router[_0xd00d('0xc')]('/',auth[_0xd00d('0x7')](),controller[_0xd00d('0xd')]);router[_0xd00d('0xe')](_0xd00d('0xa'),auth['isAuthenticated'](),controller[_0xd00d('0xf')]);router['delete'](_0xd00d('0xa'),auth['isAuthenticated'](),controller[_0xd00d('0x10')]);module[_0xd00d('0x11')]=router; \ No newline at end of file +var _0x4c16=['../../components/auth/service','../../config/environment','./chatOfflineMessage.controller','get','isAuthenticated','index','/describe','describe','/:id','show','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express'];(function(_0x5171e6,_0x4efdd8){var _0x258670=function(_0x3566c3){while(--_0x3566c3){_0x5171e6['push'](_0x5171e6['shift']());}};_0x258670(++_0x4efdd8);}(_0x4c16,0x18a));var _0x64c1=function(_0x5a56cc,_0x29650c){_0x5a56cc=_0x5a56cc-0x0;var _0x589caa=_0x4c16[_0x5a56cc];return _0x589caa;};'use strict';var multer=require(_0x64c1('0x0'));var util=require(_0x64c1('0x1'));var path=require(_0x64c1('0x2'));var timeout=require(_0x64c1('0x3'));var express=require(_0x64c1('0x4'));var router=express['Router']();var auth=require(_0x64c1('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x64c1('0x6'));var controller=require(_0x64c1('0x7'));router[_0x64c1('0x8')]('/',auth[_0x64c1('0x9')](),controller[_0x64c1('0xa')]);router[_0x64c1('0x8')](_0x64c1('0xb'),auth[_0x64c1('0x9')](),controller[_0x64c1('0xc')]);router[_0x64c1('0x8')](_0x64c1('0xd'),auth['isAuthenticated'](),controller[_0x64c1('0xe')]);router['post']('/',auth['isAuthenticated'](),controller[_0x64c1('0xf')]);router[_0x64c1('0x10')](_0x64c1('0xd'),auth[_0x64c1('0x9')](),controller[_0x64c1('0x11')]);router[_0x64c1('0x12')](_0x64c1('0xd'),auth[_0x64c1('0x9')](),controller[_0x64c1('0x13')]);module[_0x64c1('0x14')]=router; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.attributes.js b/server/api/chatProactiveAction/chatProactiveAction.attributes.js index 7d15349..a4136f3 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 _0xc633=['sequelize','STRING','ENUM','mouseOver'];(function(_0x153efb,_0x19fd9f){var _0x2672ee=function(_0x2a81ef){while(--_0x2a81ef){_0x153efb['push'](_0x153efb['shift']());}};_0x2672ee(++_0x19fd9f);}(_0xc633,0x198));var _0x3c63=function(_0x127775,_0x482d6b){_0x127775=_0x127775-0x0;var _0x1429cc=_0xc633[_0x127775];return _0x1429cc;};'use strict';var Sequelize=require(_0x3c63('0x0'));module['exports']={'name':{'type':Sequelize[_0x3c63('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0x3c63('0x2')](_0x3c63('0x3'),'timeout'),'defaultValue':'mouseOver'},'selector':{'type':Sequelize[_0x3c63('0x1')]},'timeout':{'type':Sequelize['INTEGER']}}; \ No newline at end of file +var _0x9022=['mouseOver','STRING','INTEGER','sequelize','timeout'];(function(_0x34bcbf,_0x529caf){var _0x4951ee=function(_0x22734c){while(--_0x22734c){_0x34bcbf['push'](_0x34bcbf['shift']());}};_0x4951ee(++_0x529caf);}(_0x9022,0x125));var _0x2902=function(_0x582689,_0x20c7b4){_0x582689=_0x582689-0x0;var _0x1041ca=_0x9022[_0x582689];return _0x1041ca;};'use strict';var Sequelize=require(_0x2902('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize['ENUM']('mouseOver',_0x2902('0x1')),'defaultValue':_0x2902('0x2')},'selector':{'type':Sequelize[_0x2902('0x3')]},'timeout':{'type':Sequelize[_0x2902('0x4')]}}; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.controller.js b/server/api/chatProactiveAction/chatProactiveAction.controller.js index 888ad3d..d482d5c 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 _0xcb91=['../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','status','end','json','count','offset','limit','apply','reject','save','then','destroy','sendStatus','error','stack','name','send','params','model','keys','ChatProactiveAction','rawAttributes','query','intersection','attributes','length','includeAll','merge','options','find','catch','create','body','update','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','sox','ejs','lodash','crypto','jsforce','to-csv','ioredis','../../components/auth/service'];(function(_0x297fd3,_0x115406){var _0x2af381=function(_0x1dd31b){while(--_0x1dd31b){_0x297fd3['push'](_0x297fd3['shift']());}};_0x2af381(++_0x115406);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x232ec0,_0x45fdd0){_0x232ec0=_0x232ec0-0x0;var _0x356705=_0xcb91[_0x232ec0];return _0x356705;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0x1cb9('0x0'));var zipdir=require(_0x1cb9('0x1'));var jsonpatch=require(_0x1cb9('0x2'));var rp=require(_0x1cb9('0x3'));var moment=require('moment');var BPromise=require(_0x1cb9('0x4'));var Mustache=require(_0x1cb9('0x5'));var util=require('util');var path=require(_0x1cb9('0x6'));var sox=require(_0x1cb9('0x7'));var csv=require('to-csv');var ejs=require(_0x1cb9('0x8'));var fs=require('fs');var _=require(_0x1cb9('0x9'));var squel=require('squel');var crypto=require(_0x1cb9('0xa'));var jsforce=require(_0x1cb9('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x1cb9('0xc'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x1cb9('0xd'));var authService=require(_0x1cb9('0xe'));var qs=require(_0x1cb9('0xf'));var as=require(_0x1cb9('0x10'));var hardwareService=require(_0x1cb9('0x11'));var logger=require('../../config/logger')(_0x1cb9('0x12'));var utils=require(_0x1cb9('0x13'));var config=require(_0x1cb9('0x14'));var db=require(_0x1cb9('0x15'))['db'];function respondWithStatusCode(_0x46af58,_0x5445e1){_0x5445e1=_0x5445e1||0xcc;return function(_0x5e3c19){if(_0x5e3c19){return _0x46af58['sendStatus'](_0x5445e1);}return _0x46af58[_0x1cb9('0x16')](_0x5445e1)[_0x1cb9('0x17')]();};}function respondWithResult(_0x384496,_0x1c714f){_0x1c714f=_0x1c714f||0xc8;return function(_0x56884d){if(_0x56884d){return _0x384496[_0x1cb9('0x16')](_0x1c714f)[_0x1cb9('0x18')](_0x56884d);}};}function respondWithFilteredResult(_0x1b3cd7,_0x8dfa55){return function(_0x3e2d11){if(_0x3e2d11){var _0x5806d8=_0x3e2d11[_0x1cb9('0x19')],_0x5572cb=_0x8dfa55[_0x1cb9('0x1a')],_0xd446a3=_0x8dfa55[_0x1cb9('0x1a')]+_0x8dfa55[_0x1cb9('0x1b')],_0x3cc765;if(_0xd446a3>=_0x5806d8){_0xd446a3=_0x5806d8;_0x3cc765=0xc8;}else{_0x3cc765=0xce;}_0x1b3cd7[_0x1cb9('0x16')](_0x3cc765);return _0x1b3cd7['set']('Content-Range',_0x5572cb+'-'+_0xd446a3+'/'+_0x5806d8)[_0x1cb9('0x18')](_0x3e2d11);}return null;};}function patchUpdates(_0x41ac41){return function(_0x2b2669){try{jsonpatch[_0x1cb9('0x1c')](_0x2b2669,_0x41ac41,!![]);}catch(_0x280a84){return BPromise[_0x1cb9('0x1d')](_0x280a84);}return _0x2b2669[_0x1cb9('0x1e')]();};}function saveUpdates(_0x4ac422,_0x559bcc){return function(_0x1a5a72){if(_0x1a5a72){return _0x1a5a72['update'](_0x4ac422)[_0x1cb9('0x1f')](function(_0x2265ea){return _0x2265ea;});}return null;};}function removeEntity(_0x523b26,_0x599275){return function(_0x2e3854){if(_0x2e3854){return _0x2e3854[_0x1cb9('0x20')]()[_0x1cb9('0x1f')](function(){_0x523b26[_0x1cb9('0x16')](0xcc)[_0x1cb9('0x17')]();});}};}function handleEntityNotFound(_0x27db16,_0x59ebea){return function(_0x55b232){if(!_0x55b232){_0x27db16[_0x1cb9('0x21')](0x194);}return _0x55b232;};}function handleError(_0x557199,_0x10a419){_0x10a419=_0x10a419||0x1f4;return function(_0x2b1275){logger[_0x1cb9('0x22')](_0x2b1275[_0x1cb9('0x23')]);if(_0x2b1275[_0x1cb9('0x24')]){delete _0x2b1275['name'];}_0x557199[_0x1cb9('0x16')](_0x10a419)[_0x1cb9('0x25')](_0x2b1275);};}exports['show']=function(_0xd6891c,_0x21effa){var _0x41a9a0={'raw':!![],'where':{'id':_0xd6891c[_0x1cb9('0x26')]['id']}},_0x1804fd={};_0x1804fd[_0x1cb9('0x27')]=_[_0x1cb9('0x28')](db[_0x1cb9('0x29')][_0x1cb9('0x2a')]);_0x1804fd[_0x1cb9('0x2b')]=_['keys'](_0xd6891c[_0x1cb9('0x2b')]);_0x1804fd['filters']=_[_0x1cb9('0x2c')](_0x1804fd['model'],_0x1804fd[_0x1cb9('0x2b')]);_0x41a9a0[_0x1cb9('0x2d')]=_[_0x1cb9('0x2c')](_0x1804fd[_0x1cb9('0x27')],qs['fields'](_0xd6891c[_0x1cb9('0x2b')]['fields']));_0x41a9a0[_0x1cb9('0x2d')]=_0x41a9a0[_0x1cb9('0x2d')][_0x1cb9('0x2e')]?_0x41a9a0['attributes']:_0x1804fd[_0x1cb9('0x27')];if(_0xd6891c['query'][_0x1cb9('0x2f')]){_0x41a9a0['include']=[{'all':!![]}];}_0x41a9a0=_[_0x1cb9('0x30')]({},_0x41a9a0,_0xd6891c[_0x1cb9('0x31')]);return db[_0x1cb9('0x29')][_0x1cb9('0x32')](_0x41a9a0)['then'](handleEntityNotFound(_0x21effa,null))[_0x1cb9('0x1f')](respondWithResult(_0x21effa,null))[_0x1cb9('0x33')](handleError(_0x21effa,null));};exports[_0x1cb9('0x34')]=function(_0x91a1db,_0xc6784c){return db[_0x1cb9('0x29')][_0x1cb9('0x34')](_0x91a1db[_0x1cb9('0x35')],{})[_0x1cb9('0x1f')](respondWithResult(_0xc6784c,0xc9))[_0x1cb9('0x33')](handleError(_0xc6784c,null));};exports[_0x1cb9('0x36')]=function(_0x26b950,_0x29f149){if(_0x26b950['body']['id']){delete _0x26b950['body']['id'];}return db[_0x1cb9('0x29')][_0x1cb9('0x32')]({'where':{'id':_0x26b950[_0x1cb9('0x26')]['id']}})[_0x1cb9('0x1f')](handleEntityNotFound(_0x29f149,null))[_0x1cb9('0x1f')](saveUpdates(_0x26b950[_0x1cb9('0x35')],null))[_0x1cb9('0x1f')](respondWithResult(_0x29f149,null))[_0x1cb9('0x33')](handleError(_0x29f149,null));};exports['destroy']=function(_0x2aa59b,_0x1482c4){return db[_0x1cb9('0x29')]['find']({'where':{'id':_0x2aa59b[_0x1cb9('0x26')]['id']}})['then'](handleEntityNotFound(_0x1482c4,null))[_0x1cb9('0x1f')](removeEntity(_0x1482c4,null))['catch'](handleError(_0x1482c4,null));}; \ No newline at end of file +var _0x70e0=['mustache','path','to-csv','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','json','offset','limit','status','set','Content-Range','apply','reject','update','then','destroy','end','stack','send','show','params','model','keys','ChatProactiveAction','rawAttributes','query','filters','intersection','fields','attributes','length','include','options','catch','create','body','find','html-pdf','eml-format','rimraf','request-promise','moment','bluebird'];(function(_0xe7b87d,_0x230ee6){var _0x4a86ea=function(_0x89ff74){while(--_0x89ff74){_0xe7b87d['push'](_0xe7b87d['shift']());}};_0x4a86ea(++_0x230ee6);}(_0x70e0,0x17b));var _0x070e=function(_0x4770b5,_0x352a49){_0x4770b5=_0x4770b5-0x0;var _0x818eaf=_0x70e0[_0x4770b5];return _0x818eaf;};'use strict';var pdf=require(_0x070e('0x0'));var emlformat=require(_0x070e('0x1'));var rimraf=require(_0x070e('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x070e('0x3'));var moment=require(_0x070e('0x4'));var BPromise=require(_0x070e('0x5'));var Mustache=require(_0x070e('0x6'));var util=require('util');var path=require(_0x070e('0x7'));var sox=require('sox');var csv=require(_0x070e('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0x070e('0x9'));var jsforce=require(_0x070e('0xa'));var deskjs=require(_0x070e('0xb'));var toCsv=require(_0x070e('0x8'));var querystring=require(_0x070e('0xc'));var Papa=require(_0x070e('0xd'));var Redis=require(_0x070e('0xe'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x070e('0xf'));var hardwareService=require(_0x070e('0x10'));var logger=require(_0x070e('0x11'))(_0x070e('0x12'));var utils=require(_0x070e('0x13'));var config=require(_0x070e('0x14'));var db=require(_0x070e('0x15'))['db'];function respondWithStatusCode(_0x1baa12,_0x39d2b9){_0x39d2b9=_0x39d2b9||0xcc;return function(_0x5bf079){if(_0x5bf079){return _0x1baa12[_0x070e('0x16')](_0x39d2b9);}return _0x1baa12['status'](_0x39d2b9)['end']();};}function respondWithResult(_0x24baba,_0x56c7ba){_0x56c7ba=_0x56c7ba||0xc8;return function(_0x4a33d2){if(_0x4a33d2){return _0x24baba['status'](_0x56c7ba)[_0x070e('0x17')](_0x4a33d2);}};}function respondWithFilteredResult(_0x14c3fd,_0x51d14d){return function(_0x5d3a38){if(_0x5d3a38){var _0x373d86=_0x5d3a38['count'],_0xeae1a5=_0x51d14d['offset'],_0x180897=_0x51d14d[_0x070e('0x18')]+_0x51d14d[_0x070e('0x19')],_0x19d9da;if(_0x180897>=_0x373d86){_0x180897=_0x373d86;_0x19d9da=0xc8;}else{_0x19d9da=0xce;}_0x14c3fd[_0x070e('0x1a')](_0x19d9da);return _0x14c3fd[_0x070e('0x1b')](_0x070e('0x1c'),_0xeae1a5+'-'+_0x180897+'/'+_0x373d86)['json'](_0x5d3a38);}return null;};}function patchUpdates(_0x3938b5){return function(_0x168dc6){try{jsonpatch[_0x070e('0x1d')](_0x168dc6,_0x3938b5,!![]);}catch(_0x3ea105){return BPromise[_0x070e('0x1e')](_0x3ea105);}return _0x168dc6['save']();};}function saveUpdates(_0x5b2f48,_0x4e958f){return function(_0x9907cf){if(_0x9907cf){return _0x9907cf[_0x070e('0x1f')](_0x5b2f48)[_0x070e('0x20')](function(_0x4be0d7){return _0x4be0d7;});}return null;};}function removeEntity(_0x5b184,_0x5dc5d2){return function(_0xf8dd5d){if(_0xf8dd5d){return _0xf8dd5d[_0x070e('0x21')]()[_0x070e('0x20')](function(){_0x5b184[_0x070e('0x1a')](0xcc)[_0x070e('0x22')]();});}};}function handleEntityNotFound(_0xa86797,_0xe405e){return function(_0x164cdf){if(!_0x164cdf){_0xa86797['sendStatus'](0x194);}return _0x164cdf;};}function handleError(_0x2f8055,_0x270061){_0x270061=_0x270061||0x1f4;return function(_0x4790eb){logger['error'](_0x4790eb[_0x070e('0x23')]);if(_0x4790eb['name']){delete _0x4790eb['name'];}_0x2f8055[_0x070e('0x1a')](_0x270061)[_0x070e('0x24')](_0x4790eb);};}exports[_0x070e('0x25')]=function(_0x1743cc,_0x4763c6){var _0x497f58={'raw':!![],'where':{'id':_0x1743cc[_0x070e('0x26')]['id']}},_0x374c54={};_0x374c54[_0x070e('0x27')]=_[_0x070e('0x28')](db[_0x070e('0x29')][_0x070e('0x2a')]);_0x374c54[_0x070e('0x2b')]=_[_0x070e('0x28')](_0x1743cc['query']);_0x374c54[_0x070e('0x2c')]=_[_0x070e('0x2d')](_0x374c54[_0x070e('0x27')],_0x374c54['query']);_0x497f58['attributes']=_[_0x070e('0x2d')](_0x374c54[_0x070e('0x27')],qs[_0x070e('0x2e')](_0x1743cc['query'][_0x070e('0x2e')]));_0x497f58[_0x070e('0x2f')]=_0x497f58[_0x070e('0x2f')][_0x070e('0x30')]?_0x497f58['attributes']:_0x374c54['model'];if(_0x1743cc['query']['includeAll']){_0x497f58[_0x070e('0x31')]=[{'all':!![]}];}_0x497f58=_['merge']({},_0x497f58,_0x1743cc[_0x070e('0x32')]);return db[_0x070e('0x29')]['find'](_0x497f58)['then'](handleEntityNotFound(_0x4763c6,null))[_0x070e('0x20')](respondWithResult(_0x4763c6,null))[_0x070e('0x33')](handleError(_0x4763c6,null));};exports['create']=function(_0x546a16,_0x41ade4){return db[_0x070e('0x29')][_0x070e('0x34')](_0x546a16[_0x070e('0x35')],{})[_0x070e('0x20')](respondWithResult(_0x41ade4,0xc9))['catch'](handleError(_0x41ade4,null));};exports['update']=function(_0x24d17d,_0x3011c4){if(_0x24d17d[_0x070e('0x35')]['id']){delete _0x24d17d[_0x070e('0x35')]['id'];}return db[_0x070e('0x29')]['find']({'where':{'id':_0x24d17d[_0x070e('0x26')]['id']}})[_0x070e('0x20')](handleEntityNotFound(_0x3011c4,null))['then'](saveUpdates(_0x24d17d[_0x070e('0x35')],null))[_0x070e('0x20')](respondWithResult(_0x3011c4,null))['catch'](handleError(_0x3011c4,null));};exports['destroy']=function(_0x5ddbe9,_0x363bff){return db[_0x070e('0x29')][_0x070e('0x36')]({'where':{'id':_0x5ddbe9[_0x070e('0x26')]['id']}})[_0x070e('0x20')](handleEntityNotFound(_0x363bff,null))['then'](removeEntity(_0x363bff,null))[_0x070e('0x33')](handleError(_0x363bff,null));}; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.model.js b/server/api/chatProactiveAction/chatProactiveAction.model.js index bcfdc00..ccbde02 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 _0x9863=['./chatProactiveAction.attributes','exports','ChatProactiveAction','util','../../config/logger','moment','request-promise','path','rimraf'];(function(_0x1d24eb,_0x12295b){var _0x1dc576=function(_0x4d5770){while(--_0x4d5770){_0x1d24eb['push'](_0x1d24eb['shift']());}};_0x1dc576(++_0x12295b);}(_0x9863,0x1bc));var _0x3986=function(_0x59ee6f,_0x450239){_0x59ee6f=_0x59ee6f-0x0;var _0x4c0979=_0x9863[_0x59ee6f];return _0x4c0979;};'use strict';var _=require('lodash');var util=require(_0x3986('0x0'));var logger=require(_0x3986('0x1'))('api');var moment=require(_0x3986('0x2'));var BPromise=require('bluebird');var rp=require(_0x3986('0x3'));var fs=require('fs');var path=require(_0x3986('0x4'));var rimraf=require(_0x3986('0x5'));var config=require('../../config/environment');var attributes=require(_0x3986('0x6'));module[_0x3986('0x7')]=function(_0x402337,_0x434084){return _0x402337['define'](_0x3986('0x8'),attributes,{'tableName':'chat_proactive_actions','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7177=['lodash','util','api','bluebird','request-promise','path','rimraf','../../config/environment','./chatProactiveAction.attributes','exports','define','ChatProactiveAction','chat_proactive_actions'];(function(_0x208f80,_0x2522c6){var _0x71c40c=function(_0x555c9a){while(--_0x555c9a){_0x208f80['push'](_0x208f80['shift']());}};_0x71c40c(++_0x2522c6);}(_0x7177,0xf7));var _0x7717=function(_0x114dbf,_0x3dd101){_0x114dbf=_0x114dbf-0x0;var _0x5953c9=_0x7177[_0x114dbf];return _0x5953c9;};'use strict';var _=require(_0x7717('0x0'));var util=require(_0x7717('0x1'));var logger=require('../../config/logger')(_0x7717('0x2'));var moment=require('moment');var BPromise=require(_0x7717('0x3'));var rp=require(_0x7717('0x4'));var fs=require('fs');var path=require(_0x7717('0x5'));var rimraf=require(_0x7717('0x6'));var config=require(_0x7717('0x7'));var attributes=require(_0x7717('0x8'));module[_0x7717('0x9')]=function(_0x2805b1,_0x2d0ce1){return _0x2805b1[_0x7717('0xa')](_0x7717('0xb'),attributes,{'tableName':_0x7717('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 540ade0..ad19dab 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 _0xf722=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','ChatProactiveAction,\x20%s,\x20%s','debug','ChatProactiveAction,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','lodash','bluebird','randomstring','ioredis'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xf722,0xc2));var _0x2f72=function(_0x1ac595,_0x5d2081){_0x1ac595=_0x1ac595-0x0;var _0x455fff=_0xf722[_0x1ac595];return _0x455fff;};'use strict';var _=require(_0x2f72('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x2f72('0x1'));var rs=require(_0x2f72('0x2'));var fs=require('fs');var Redis=require(_0x2f72('0x3'));var db=require(_0x2f72('0x4'))['db'];var utils=require(_0x2f72('0x5'));var logger=require(_0x2f72('0x6'))(_0x2f72('0x7'));var config=require(_0x2f72('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x2f72('0x9')][_0x2f72('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x12d78d,_0x9ed773,_0x256dcf){return new BPromise(function(_0x2e20b6,_0x5332a3){return client[_0x2f72('0xb')](_0x12d78d,_0x256dcf)[_0x2f72('0xc')](function(_0x5866cf){logger['info'](_0x2f72('0xd'),_0x9ed773,'request\x20sent');logger[_0x2f72('0xe')](_0x2f72('0xf'),_0x9ed773,_0x2f72('0x10'),JSON[_0x2f72('0x11')](_0x5866cf));if(_0x5866cf[_0x2f72('0x12')]){if(_0x5866cf[_0x2f72('0x12')][_0x2f72('0x13')]===0x1f4){logger['error'](_0x2f72('0xd'),_0x9ed773,_0x5866cf[_0x2f72('0x12')][_0x2f72('0x14')]);return _0x5332a3(_0x5866cf[_0x2f72('0x12')]['message']);}logger[_0x2f72('0x12')]('ChatProactiveAction,\x20%s,\x20%s',_0x9ed773,_0x5866cf[_0x2f72('0x12')][_0x2f72('0x14')]);return _0x2e20b6(_0x5866cf[_0x2f72('0x12')]['message']);}else{logger['info'](_0x2f72('0xd'),_0x9ed773,_0x2f72('0x10'));_0x2e20b6(_0x5866cf[_0x2f72('0x15')][_0x2f72('0x14')]);}})['catch'](function(_0x5391d6){logger[_0x2f72('0x12')]('ChatProactiveAction,\x20%s,\x20%s',_0x9ed773,_0x5391d6);_0x5332a3(_0x5391d6);});});} \ No newline at end of file +var _0x5151=['util','moment','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','info','ChatProactiveAction,\x20%s,\x20%s','request\x20sent','debug','ChatProactiveAction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash'];(function(_0x3759f0,_0x2cc445){var _0x4252b5=function(_0x215baa){while(--_0x215baa){_0x3759f0['push'](_0x3759f0['shift']());}};_0x4252b5(++_0x2cc445);}(_0x5151,0x113));var _0x1515=function(_0x37550d,_0x44f31c){_0x37550d=_0x37550d-0x0;var _0x170ff4=_0x5151[_0x37550d];return _0x170ff4;};'use strict';var _=require(_0x1515('0x0'));var util=require(_0x1515('0x1'));var moment=require(_0x1515('0x2'));var BPromise=require(_0x1515('0x3'));var rs=require(_0x1515('0x4'));var fs=require('fs');var Redis=require(_0x1515('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x1515('0x6'))(_0x1515('0x7'));var config=require(_0x1515('0x8'));var jayson=require(_0x1515('0x9'));var client=jayson[_0x1515('0xa')][_0x1515('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x356a6d,_0x384822,_0x40cbbd){return new BPromise(function(_0x951f72,_0xa1bfaf){return client['request'](_0x356a6d,_0x40cbbd)['then'](function(_0x2524f2){logger[_0x1515('0xc')](_0x1515('0xd'),_0x384822,_0x1515('0xe'));logger[_0x1515('0xf')](_0x1515('0x10'),_0x384822,'request\x20sent',JSON[_0x1515('0x11')](_0x2524f2));if(_0x2524f2[_0x1515('0x12')]){if(_0x2524f2['error'][_0x1515('0x13')]===0x1f4){logger[_0x1515('0x12')]('ChatProactiveAction,\x20%s,\x20%s',_0x384822,_0x2524f2[_0x1515('0x12')][_0x1515('0x14')]);return _0xa1bfaf(_0x2524f2['error'][_0x1515('0x14')]);}logger[_0x1515('0x12')](_0x1515('0xd'),_0x384822,_0x2524f2[_0x1515('0x12')]['message']);return _0x951f72(_0x2524f2[_0x1515('0x12')][_0x1515('0x14')]);}else{logger[_0x1515('0xc')](_0x1515('0xd'),_0x384822,_0x1515('0xe'));_0x951f72(_0x2524f2[_0x1515('0x15')][_0x1515('0x14')]);}})[_0x1515('0x16')](function(_0x25f29f){logger[_0x1515('0x12')]('ChatProactiveAction,\x20%s,\x20%s',_0x384822,_0x25f29f);_0xa1bfaf(_0x25f29f);});});} \ No newline at end of file diff --git a/server/api/chatProactiveAction/index.js b/server/api/chatProactiveAction/index.js index b186a60..605c5e8 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 _0xa0c9=['multer','util','connect-timeout','express','Router','../../components/auth/service','get','/:id','isAuthenticated','show','post','create','put','update','exports'];(function(_0x4f2141,_0x2b4d34){var _0x312b5a=function(_0xcdb863){while(--_0xcdb863){_0x4f2141['push'](_0x4f2141['shift']());}};_0x312b5a(++_0x2b4d34);}(_0xa0c9,0xf0));var _0x9a0c=function(_0x19ae53,_0x2164c3){_0x19ae53=_0x19ae53-0x0;var _0x3e1bf7=_0xa0c9[_0x19ae53];return _0x3e1bf7;};'use strict';var multer=require(_0x9a0c('0x0'));var util=require(_0x9a0c('0x1'));var path=require('path');var timeout=require(_0x9a0c('0x2'));var express=require(_0x9a0c('0x3'));var router=express[_0x9a0c('0x4')]();var auth=require(_0x9a0c('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./chatProactiveAction.controller');router[_0x9a0c('0x6')](_0x9a0c('0x7'),auth[_0x9a0c('0x8')](),controller[_0x9a0c('0x9')]);router[_0x9a0c('0xa')]('/',auth[_0x9a0c('0x8')](),controller[_0x9a0c('0xb')]);router[_0x9a0c('0xc')](_0x9a0c('0x7'),auth[_0x9a0c('0x8')](),controller[_0x9a0c('0xd')]);router['delete'](_0x9a0c('0x7'),auth[_0x9a0c('0x8')](),controller['destroy']);module[_0x9a0c('0xe')]=router; \ No newline at end of file +var _0xbcee=['../../config/environment','./chatProactiveAction.controller','get','/:id','show','isAuthenticated','create','delete','destroy','exports','util','connect-timeout','express','Router','../../components/auth/service'];(function(_0x457b6c,_0x2b3821){var _0x2f8b58=function(_0x1a597c){while(--_0x1a597c){_0x457b6c['push'](_0x457b6c['shift']());}};_0x2f8b58(++_0x2b3821);}(_0xbcee,0xbe));var _0xebce=function(_0x375927,_0x5060d7){_0x375927=_0x375927-0x0;var _0x30337c=_0xbcee[_0x375927];return _0x30337c;};'use strict';var multer=require('multer');var util=require(_0xebce('0x0'));var path=require('path');var timeout=require(_0xebce('0x1'));var express=require(_0xebce('0x2'));var router=express[_0xebce('0x3')]();var auth=require(_0xebce('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xebce('0x5'));var controller=require(_0xebce('0x6'));router[_0xebce('0x7')](_0xebce('0x8'),auth['isAuthenticated'](),controller[_0xebce('0x9')]);router['post']('/',auth[_0xebce('0xa')](),controller[_0xebce('0xb')]);router['put'](_0xebce('0x8'),auth[_0xebce('0xa')](),controller['update']);router[_0xebce('0xc')](_0xebce('0x8'),auth['isAuthenticated'](),controller[_0xebce('0xd')]);module[_0xebce('0xe')]=router; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.attributes.js b/server/api/chatQueue/chatQueue.attributes.js index ae13448..8a2c3ed 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 _0xb131=['STRING','name','rrmemory','beepall','sequelize','exports'];(function(_0x5a52f7,_0x21c442){var _0x76e886=function(_0x398f28){while(--_0x398f28){_0x5a52f7['push'](_0x5a52f7['shift']());}};_0x76e886(++_0x21c442);}(_0xb131,0x1a8));var _0x1b13=function(_0x4c2f17,_0x5c6821){_0x4c2f17=_0x4c2f17-0x0;var _0x20919e=_0xb131[_0x4c2f17];return _0x20919e;};'use strict';var Sequelize=require(_0x1b13('0x0'));module[_0x1b13('0x1')]={'name':{'type':Sequelize[_0x1b13('0x2')],'unique':_0x1b13('0x3'),'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['ENUM'](_0x1b13('0x4'),_0x1b13('0x5'),'roundrobin')}}; \ No newline at end of file +var _0x5fc1=['INTEGER','ENUM','rrmemory','roundrobin','sequelize','exports','STRING','name'];(function(_0x392dbc,_0x4d31cf){var _0x119302=function(_0x250580){while(--_0x250580){_0x392dbc['push'](_0x392dbc['shift']());}};_0x119302(++_0x4d31cf);}(_0x5fc1,0x6c));var _0x15fc=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x5fc1[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x15fc('0x0'));module[_0x15fc('0x1')]={'name':{'type':Sequelize[_0x15fc('0x2')],'unique':_0x15fc('0x3'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x15fc('0x2')]},'timeout':{'type':Sequelize[_0x15fc('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x15fc('0x5')](_0x15fc('0x6'),'beepall',_0x15fc('0x7'))}}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.controller.js b/server/api/chatQueue/chatQueue.controller.js index 2429a8f..5b038f6 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 _0x4f1c=['jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','defaults','redis','localhost','socket.io-emitter','register','jayson/promise','http','test','Sequelize','then','info','ChatQueue,\x20%s,\x20%s','request\x20sent','debug','ChatQueue,\x20%s,\x20%s,\x20%s','error','message','catch','sendStatus','status','json','count','offset','limit','set','Content-Range','apply','reject','save','update','destroy','get','ChatQueues','UserProfileResource','end','stack','name','send','index','map','rawAttributes','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filter','VIRTUAL','merge','options','ChatQueue','includeAll','findAll','rows','length','include','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','find','params','describe','getMembers','findOne','UserChatQueue','ChatQueueId','User','chatPause','updatedAt','createdAt','%s/%s','SIP','getTeams','Team','pick','ids','Agents','voicePause','interface','sequelize','addTeams','findOrCreate','forEach','emit','removeTeams','select','tq.TeamId','from','team_has_chat_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','ChatQueueId\x20=\x20?','ut.UserId\x20=\x20?','push','toString','QueryTypes','every','includes','all','union','compact','transaction','isEmpty','removeAgents','userChatQueue:remove','addAgents','omit','spread','getAgents','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','mustache','path','sox','lodash','crypto'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x4f1c,0x1a8));var _0xc4f1=function(_0x28d350,_0x2a7852){_0x28d350=_0x28d350-0x0;var _0x1531f1=_0x4f1c[_0x28d350];return _0x1531f1;};'use strict';var pdf=require(_0xc4f1('0x0'));var emlformat=require(_0xc4f1('0x1'));var rimraf=require(_0xc4f1('0x2'));var zipdir=require(_0xc4f1('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0xc4f1('0x4'));var moment=require(_0xc4f1('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xc4f1('0x6'));var util=require('util');var path=require(_0xc4f1('0x7'));var sox=require(_0xc4f1('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0xc4f1('0x9'));var squel=require('squel');var crypto=require(_0xc4f1('0xa'));var jsforce=require(_0xc4f1('0xb'));var deskjs=require(_0xc4f1('0xc'));var toCsv=require(_0xc4f1('0xd'));var querystring=require(_0xc4f1('0xe'));var Papa=require(_0xc4f1('0xf'));var Redis=require(_0xc4f1('0x10'));var authService=require(_0xc4f1('0x11'));var qs=require(_0xc4f1('0x12'));var as=require(_0xc4f1('0x13'));var hardwareService=require(_0xc4f1('0x14'));var logger=require(_0xc4f1('0x15'))(_0xc4f1('0x16'));var utils=require('../../config/utils');var config=require(_0xc4f1('0x17'));var db=require(_0xc4f1('0x18'))['db'];config['redis']=_[_0xc4f1('0x19')](config[_0xc4f1('0x1a')],{'host':_0xc4f1('0x1b'),'port':0x18eb});var socket=require(_0xc4f1('0x1c'))(new Redis(config[_0xc4f1('0x1a')]));require('./chatQueue.socket')[_0xc4f1('0x1d')](socket);var jayson=require(_0xc4f1('0x1e'));var client=jayson['client'][_0xc4f1('0x1f')]({'port':0x232a});function checkPasswordPattern(_0x10e081,_0x2d0e05,_0xe0348a){if(_0xe0348a){var _0x5d15d3=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x5d15d3[_0xc4f1('0x20')](_0x2d0e05)){return _0x10e081;}else{throw new db[(_0xc4f1('0x21'))]['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 _0x10e081;}}function respondWithRpcPromise(_0xf12939,_0x31edc2,_0x5e798f,_0x59cff3){return new BPromise(function(_0x219557,_0x7619e5){var _0xd408bc=_0x59cff3||client;return _0xd408bc['request'](_0xf12939,_0x5e798f)[_0xc4f1('0x22')](function(_0x1a4edd){logger[_0xc4f1('0x23')](_0xc4f1('0x24'),_0x31edc2,_0xc4f1('0x25'));logger[_0xc4f1('0x26')](_0xc4f1('0x27'),_0x31edc2,_0xc4f1('0x25'),JSON['stringify'](_0x1a4edd));if(_0x1a4edd['error']){if(_0x1a4edd[_0xc4f1('0x28')]['code']===0x1f4){logger['error'](_0xc4f1('0x24'),_0x31edc2,_0x1a4edd[_0xc4f1('0x28')][_0xc4f1('0x29')]);return _0x7619e5(_0x1a4edd[_0xc4f1('0x28')][_0xc4f1('0x29')]);}logger['error']('ChatQueue,\x20%s,\x20%s',_0x31edc2,_0x1a4edd[_0xc4f1('0x28')]['message']);return _0x219557(_0x1a4edd[_0xc4f1('0x28')]['message']);}else{logger['info'](_0xc4f1('0x24'),_0x31edc2,_0xc4f1('0x25'));_0x219557(_0x1a4edd['result']['message']);}})[_0xc4f1('0x2a')](function(_0x53851c){logger['error'](_0xc4f1('0x24'),_0x31edc2,_0x53851c);_0x7619e5(_0x53851c);});});}function respondWithStatusCode(_0x111eae,_0x14c35e){_0x14c35e=_0x14c35e||0xcc;return function(_0x2004a2){if(_0x2004a2){return _0x111eae[_0xc4f1('0x2b')](_0x14c35e);}return _0x111eae[_0xc4f1('0x2c')](_0x14c35e)['end']();};}function respondWithResult(_0x46a931,_0x521a){_0x521a=_0x521a||0xc8;return function(_0x131665){if(_0x131665){return _0x46a931[_0xc4f1('0x2c')](_0x521a)[_0xc4f1('0x2d')](_0x131665);}};}function respondWithFilteredResult(_0x52e06d,_0x330f07){return function(_0x12d02e){if(_0x12d02e){var _0x345928=_0x12d02e[_0xc4f1('0x2e')],_0x13914b=_0x330f07[_0xc4f1('0x2f')],_0x677924=_0x330f07[_0xc4f1('0x2f')]+_0x330f07[_0xc4f1('0x30')],_0x4e3aa5;if(_0x677924>=_0x345928){_0x677924=_0x345928;_0x4e3aa5=0xc8;}else{_0x4e3aa5=0xce;}_0x52e06d[_0xc4f1('0x2c')](_0x4e3aa5);return _0x52e06d[_0xc4f1('0x31')](_0xc4f1('0x32'),_0x13914b+'-'+_0x677924+'/'+_0x345928)[_0xc4f1('0x2d')](_0x12d02e);}return null;};}function patchUpdates(_0x483085){return function(_0x50c7d7){try{jsonpatch[_0xc4f1('0x33')](_0x50c7d7,_0x483085,!![]);}catch(_0x5a31f0){return BPromise[_0xc4f1('0x34')](_0x5a31f0);}return _0x50c7d7[_0xc4f1('0x35')]();};}function saveUpdates(_0x2c3f92,_0x7ebfb4){return function(_0x5dc04f){if(_0x5dc04f){return _0x5dc04f[_0xc4f1('0x36')](_0x2c3f92)['then'](function(_0x3cfdc6){return _0x3cfdc6;});}return null;};}function removeEntity(_0x554332,_0xf8a81){return function(_0x11b0ef){if(_0x11b0ef){return _0x11b0ef[_0xc4f1('0x37')]()['then'](function(){var _0x1b3f8f=_0x11b0ef[_0xc4f1('0x38')]({'plain':!![]});var _0x4416a5=_0xc4f1('0x39');return db[_0xc4f1('0x3a')][_0xc4f1('0x37')]({'where':{'type':_0x4416a5,'resourceId':_0x1b3f8f['id']}})[_0xc4f1('0x22')](function(){return _0x11b0ef;});})[_0xc4f1('0x22')](function(){_0x554332[_0xc4f1('0x2c')](0xcc)[_0xc4f1('0x3b')]();});}};}function handleEntityNotFound(_0x1208b7,_0x33220b){return function(_0x3fec35){if(!_0x3fec35){_0x1208b7['sendStatus'](0x194);}return _0x3fec35;};}function handleError(_0x242613,_0x4ce539){_0x4ce539=_0x4ce539||0x1f4;return function(_0x1c2b07){logger[_0xc4f1('0x28')](_0x1c2b07[_0xc4f1('0x3c')]);if(_0x1c2b07[_0xc4f1('0x3d')]){delete _0x1c2b07[_0xc4f1('0x3d')];}_0x242613[_0xc4f1('0x2c')](_0x4ce539)[_0xc4f1('0x3e')](_0x1c2b07);};}exports[_0xc4f1('0x3f')]=function(_0x270d0f,_0x2f898f){var _0x44b8bc={},_0x3f88ec={},_0xd8e484={'count':0x0,'rows':[]};var _0x48d4df=_[_0xc4f1('0x40')](db['ChatQueue'][_0xc4f1('0x41')],function(_0x49e71a){return{'name':_0x49e71a['fieldName'],'type':_0x49e71a['type'][_0xc4f1('0x42')]};});_0x3f88ec[_0xc4f1('0x43')]=_[_0xc4f1('0x40')](_0x48d4df,_0xc4f1('0x3d'));_0x3f88ec[_0xc4f1('0x44')]=_[_0xc4f1('0x45')](_0x270d0f[_0xc4f1('0x44')]);_0x3f88ec[_0xc4f1('0x46')]=_[_0xc4f1('0x47')](_0x3f88ec[_0xc4f1('0x43')],_0x3f88ec[_0xc4f1('0x44')]);_0x44b8bc[_0xc4f1('0x48')]=_[_0xc4f1('0x47')](_0x3f88ec[_0xc4f1('0x43')],qs[_0xc4f1('0x49')](_0x270d0f[_0xc4f1('0x44')]['fields']));_0x44b8bc[_0xc4f1('0x48')]=_0x44b8bc[_0xc4f1('0x48')]['length']?_0x44b8bc[_0xc4f1('0x48')]:_0x3f88ec[_0xc4f1('0x43')];if(!_0x270d0f[_0xc4f1('0x44')][_0xc4f1('0x4a')](_0xc4f1('0x4b'))){_0x44b8bc[_0xc4f1('0x30')]=qs['limit'](_0x270d0f[_0xc4f1('0x44')][_0xc4f1('0x30')]);_0x44b8bc[_0xc4f1('0x2f')]=qs[_0xc4f1('0x2f')](_0x270d0f[_0xc4f1('0x44')][_0xc4f1('0x2f')]);}_0x44b8bc[_0xc4f1('0x4c')]=qs[_0xc4f1('0x4d')](_0x270d0f[_0xc4f1('0x44')][_0xc4f1('0x4d')]);_0x44b8bc[_0xc4f1('0x4e')]=qs[_0xc4f1('0x46')](_['pick'](_0x270d0f['query'],_0x3f88ec[_0xc4f1('0x46')]),_0x48d4df);if(_0x270d0f['query'][_0xc4f1('0x4f')]){_0x44b8bc[_0xc4f1('0x4e')]=_['merge'](_0x44b8bc[_0xc4f1('0x4e')],{'$or':_[_0xc4f1('0x40')](_0x48d4df,function(_0x416c04){if(_0x416c04['type']!==_0xc4f1('0x50')){var _0x244c6d={};_0x244c6d[_0x416c04[_0xc4f1('0x3d')]]={'$like':'%'+_0x270d0f[_0xc4f1('0x44')]['filter']+'%'};return _0x244c6d;}})});}_0x44b8bc=_[_0xc4f1('0x51')]({},_0x44b8bc,_0x270d0f[_0xc4f1('0x52')]);var _0x3adf51={'where':_0x44b8bc['where']};return db[_0xc4f1('0x53')][_0xc4f1('0x2e')](_0x3adf51)[_0xc4f1('0x22')](function(_0x2b2ec4){_0xd8e484[_0xc4f1('0x2e')]=_0x2b2ec4;if(_0x270d0f[_0xc4f1('0x44')][_0xc4f1('0x54')]){_0x44b8bc['include']=[{'all':!![]}];}return db[_0xc4f1('0x53')][_0xc4f1('0x55')](_0x44b8bc);})[_0xc4f1('0x22')](function(_0x1361bb){_0xd8e484[_0xc4f1('0x56')]=_0x1361bb;return _0xd8e484;})[_0xc4f1('0x22')](respondWithFilteredResult(_0x2f898f,_0x44b8bc))['catch'](handleError(_0x2f898f,null));};exports['show']=function(_0xcd33d,_0x2ef941){var _0x3a2154={'raw':!![],'where':{'id':_0xcd33d['params']['id']}},_0x54aa1b={};_0x54aa1b[_0xc4f1('0x43')]=_[_0xc4f1('0x45')](db[_0xc4f1('0x53')][_0xc4f1('0x41')]);_0x54aa1b[_0xc4f1('0x44')]=_[_0xc4f1('0x45')](_0xcd33d[_0xc4f1('0x44')]);_0x54aa1b['filters']=_['intersection'](_0x54aa1b[_0xc4f1('0x43')],_0x54aa1b[_0xc4f1('0x44')]);_0x3a2154[_0xc4f1('0x48')]=_['intersection'](_0x54aa1b['model'],qs[_0xc4f1('0x49')](_0xcd33d['query'][_0xc4f1('0x49')]));_0x3a2154[_0xc4f1('0x48')]=_0x3a2154['attributes'][_0xc4f1('0x57')]?_0x3a2154[_0xc4f1('0x48')]:_0x54aa1b[_0xc4f1('0x43')];if(_0xcd33d[_0xc4f1('0x44')]['includeAll']){_0x3a2154[_0xc4f1('0x58')]=[{'all':!![]}];}_0x3a2154=_['merge']({},_0x3a2154,_0xcd33d[_0xc4f1('0x52')]);return db[_0xc4f1('0x53')]['find'](_0x3a2154)[_0xc4f1('0x22')](handleEntityNotFound(_0x2ef941,null))[_0xc4f1('0x22')](respondWithResult(_0x2ef941,null))[_0xc4f1('0x2a')](handleError(_0x2ef941,null));};exports[_0xc4f1('0x59')]=function(_0x4f6dc4,_0x5398ff){return db['ChatQueue'][_0xc4f1('0x59')](_0x4f6dc4[_0xc4f1('0x5a')],{})['then'](function(_0x204e42){var _0x492b80=_0x4f6dc4[_0xc4f1('0x5b')][_0xc4f1('0x38')]({'plain':!![]});if(!_0x492b80)throw new Error(_0xc4f1('0x5c'));if(_0x492b80['role']===_0xc4f1('0x5b')){var _0x11d004=_0x204e42['get']({'plain':!![]});var _0x26de7c=_0xc4f1('0x39');return db[_0xc4f1('0x5d')][_0xc4f1('0x5e')]({'where':{'name':_0x26de7c,'userProfileId':_0x492b80['userProfileId']},'raw':!![]})['then'](function(_0x263e45){if(_0x263e45&&_0x263e45['autoAssociation']===0x0){return db[_0xc4f1('0x3a')][_0xc4f1('0x59')]({'name':_0x11d004['name'],'resourceId':_0x11d004['id'],'type':_0x263e45[_0xc4f1('0x3d')],'sectionId':_0x263e45['id']},{})[_0xc4f1('0x22')](function(){return _0x204e42;});}else{return _0x204e42;}})[_0xc4f1('0x2a')](function(_0x422b36){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x422b36);throw _0x422b36;});}return _0x204e42;})[_0xc4f1('0x22')](respondWithResult(_0x5398ff,0xc9))['catch'](handleError(_0x5398ff,null));};exports['update']=function(_0x3c4286,_0x43916b){if(_0x3c4286[_0xc4f1('0x5a')]['id']){delete _0x3c4286['body']['id'];}return db['ChatQueue'][_0xc4f1('0x5e')]({'where':{'id':_0x3c4286[_0xc4f1('0x5f')]['id']}})['then'](handleEntityNotFound(_0x43916b,null))[_0xc4f1('0x22')](saveUpdates(_0x3c4286[_0xc4f1('0x5a')],null))['then'](respondWithResult(_0x43916b,null))['catch'](handleError(_0x43916b,null));};exports[_0xc4f1('0x37')]=function(_0x248a69,_0x330828){return db[_0xc4f1('0x53')][_0xc4f1('0x5e')]({'where':{'id':_0x248a69[_0xc4f1('0x5f')]['id']}})[_0xc4f1('0x22')](handleEntityNotFound(_0x330828,null))[_0xc4f1('0x22')](removeEntity(_0x330828,null))[_0xc4f1('0x2a')](handleError(_0x330828,null));};exports[_0xc4f1('0x60')]=function(_0x52cc07,_0x39e0a8){return db[_0xc4f1('0x53')]['describe']()['then'](respondWithResult(_0x39e0a8,null))[_0xc4f1('0x2a')](handleError(_0x39e0a8,null));};exports[_0xc4f1('0x61')]=function(_0x5596d3,_0x1f5255,_0x1a58a6){var _0x2ebdfe={'raw':!![],'where':{}},_0x545ef0={},_0x2f39f4;return db['ChatQueue'][_0xc4f1('0x62')]({'where':{'id':_0x5596d3[_0xc4f1('0x5f')]['id']}})['then'](handleEntityNotFound(_0x1f5255,null))[_0xc4f1('0x22')](function(_0x25dce9){if(_0x25dce9){_0x2f39f4=_0x25dce9[_0xc4f1('0x38')]({'plain':!![]});_0x545ef0['model']=_['keys'](db[_0xc4f1('0x63')][_0xc4f1('0x41')]);_0x545ef0[_0xc4f1('0x44')]=_[_0xc4f1('0x45')](_0x5596d3[_0xc4f1('0x44')]);_0x545ef0['filters']=_[_0xc4f1('0x47')](_0x545ef0[_0xc4f1('0x43')],_0x545ef0[_0xc4f1('0x44')]);_0x2ebdfe['attributes']=_[_0xc4f1('0x47')](_0x545ef0[_0xc4f1('0x43')],qs['fields'](_0x5596d3[_0xc4f1('0x44')]['fields']));_0x2ebdfe['attributes']=_0x2ebdfe[_0xc4f1('0x48')][_0xc4f1('0x57')]?_0x2ebdfe['attributes']:_0x545ef0[_0xc4f1('0x43')];if(!_0x5596d3[_0xc4f1('0x44')][_0xc4f1('0x4a')](_0xc4f1('0x4b'))){_0x2ebdfe[_0xc4f1('0x30')]=qs['limit'](_0x5596d3[_0xc4f1('0x44')][_0xc4f1('0x30')]);_0x2ebdfe[_0xc4f1('0x2f')]=qs[_0xc4f1('0x2f')](_0x5596d3[_0xc4f1('0x44')][_0xc4f1('0x2f')]);}_0x2ebdfe[_0xc4f1('0x4c')]=qs[_0xc4f1('0x4d')](_0x5596d3[_0xc4f1('0x44')][_0xc4f1('0x4d')]);_0x2ebdfe['where']=qs[_0xc4f1('0x46')](_['pick'](_0x5596d3[_0xc4f1('0x44')],_0x545ef0[_0xc4f1('0x46')]));_0x2ebdfe[_0xc4f1('0x4e')][_0xc4f1('0x64')]=_0x25dce9['id'];if(_0x5596d3[_0xc4f1('0x44')][_0xc4f1('0x4f')]){_0x2ebdfe['where']=_['merge'](_0x2ebdfe[_0xc4f1('0x4e')],{'$or':_[_0xc4f1('0x40')](_0x2ebdfe[_0xc4f1('0x48')],function(_0x2bb4f8){var _0x999beb={};_0x999beb[_0x2bb4f8]={'$like':'%'+_0x5596d3['query'][_0xc4f1('0x4f')]+'%'};return _0x999beb;})});}_0x2ebdfe=_['merge']({},_0x2ebdfe,_0x5596d3[_0xc4f1('0x52')]);return db[_0xc4f1('0x63')][_0xc4f1('0x55')](_0x2ebdfe);}})[_0xc4f1('0x22')](function(_0x55d750){if(_0x55d750){return db[_0xc4f1('0x65')]['findAndCountAll']({'where':{'id':_[_0xc4f1('0x40')](_0x55d750,'UserId'),'role':'agent'},'attributes':['id',_0xc4f1('0x3d'),_0xc4f1('0x66'),_0xc4f1('0x67'),_0xc4f1('0x68')]});}})[_0xc4f1('0x22')](function(_0x396715){if(_0x396715){return{'count':_0x396715[_0xc4f1('0x2e')],'rows':_[_0xc4f1('0x40')](_0x396715[_0xc4f1('0x56')],function(_0x40b2ce){return{'membername':_0x40b2ce['name'],'UserId':_0x40b2ce['id'],'queue_name':_0x2f39f4[_0xc4f1('0x3d')],'ChatQueueId':_0x2f39f4['id'],'interface':util['format'](_0xc4f1('0x69'),_0xc4f1('0x6a'),_0x40b2ce['name']),'penalty':0x0,'paused':_0x40b2ce['chatPause'],'createdAt':_0x40b2ce[_0xc4f1('0x68')],'updatedAt':_0x40b2ce[_0xc4f1('0x67')]};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x1f5255,_0x2ebdfe))[_0xc4f1('0x2a')](handleError(_0x1f5255,null));};exports[_0xc4f1('0x6b')]=function(_0x4fc132,_0xd5cd05,_0x145c5c){var _0x3e9f12={};var _0x5da3ba={};var _0x4e54d2;var _0x155cb7;return db[_0xc4f1('0x53')]['findOne']({'where':{'id':_0x4fc132['params']['id']}})[_0xc4f1('0x22')](handleEntityNotFound(_0xd5cd05,null))[_0xc4f1('0x22')](function(_0x120dbc){if(_0x120dbc){_0x4e54d2=_0x120dbc;_0x5da3ba[_0xc4f1('0x43')]=_[_0xc4f1('0x45')](db[_0xc4f1('0x6c')][_0xc4f1('0x41')]);_0x5da3ba['query']=_['keys'](_0x4fc132[_0xc4f1('0x44')]);_0x5da3ba['filters']=_[_0xc4f1('0x47')](_0x5da3ba[_0xc4f1('0x43')],_0x5da3ba[_0xc4f1('0x44')]);_0x3e9f12[_0xc4f1('0x48')]=_[_0xc4f1('0x47')](_0x5da3ba[_0xc4f1('0x43')],qs[_0xc4f1('0x49')](_0x4fc132[_0xc4f1('0x44')][_0xc4f1('0x49')]));_0x3e9f12[_0xc4f1('0x48')]=_0x3e9f12[_0xc4f1('0x48')][_0xc4f1('0x57')]?_0x3e9f12['attributes']:_0x5da3ba[_0xc4f1('0x43')];_0x3e9f12['order']=qs[_0xc4f1('0x4d')](_0x4fc132['query'][_0xc4f1('0x4d')]);_0x3e9f12[_0xc4f1('0x4e')]=qs[_0xc4f1('0x46')](_[_0xc4f1('0x6d')](_0x4fc132[_0xc4f1('0x44')],_0x5da3ba[_0xc4f1('0x46')]));if(_0x4fc132[_0xc4f1('0x44')][_0xc4f1('0x4f')]){_0x3e9f12[_0xc4f1('0x4e')]=_[_0xc4f1('0x51')](_0x3e9f12[_0xc4f1('0x4e')],{'$or':_['map'](_0x3e9f12[_0xc4f1('0x48')],function(_0x45be22){var _0x3321c8={};_0x3321c8[_0x45be22]={'$like':'%'+_0x4fc132[_0xc4f1('0x44')][_0xc4f1('0x4f')]+'%'};return _0x3321c8;})});}_0x3e9f12=_[_0xc4f1('0x51')]({},_0x3e9f12,_0x4fc132[_0xc4f1('0x52')]);return _0x4e54d2['getTeams'](_0x3e9f12);}})['then'](function(_0x22d731){if(_0x22d731){_0x155cb7=_0x22d731['length'];if(!_0x4fc132[_0xc4f1('0x44')][_0xc4f1('0x4a')](_0xc4f1('0x4b'))){_0x3e9f12['limit']=qs[_0xc4f1('0x30')](_0x4fc132[_0xc4f1('0x44')][_0xc4f1('0x30')]);_0x3e9f12[_0xc4f1('0x2f')]=qs[_0xc4f1('0x2f')](_0x4fc132[_0xc4f1('0x44')][_0xc4f1('0x2f')]);}return _0x4e54d2[_0xc4f1('0x6b')](_0x3e9f12);}})[_0xc4f1('0x22')](function(_0xcd9048){if(_0xcd9048){return _0xcd9048?{'count':_0x155cb7,'rows':_0xcd9048}:null;}})[_0xc4f1('0x22')](respondWithResult(_0xd5cd05,null))[_0xc4f1('0x2a')](handleError(_0xd5cd05,null));};exports['addTeams']=function(_0x6f1951,_0x57609b,_0x5cfd71){var _0x453f3d=_0x6f1951[_0xc4f1('0x5a')][_0xc4f1('0x6e')];return db[_0xc4f1('0x6c')]['findAll']({'where':{'id':_0x453f3d},'attributes':['id'],'include':[{'model':db['User'],'as':_0xc4f1('0x6f'),'attributes':['id','name','online',_0xc4f1('0x70'),_0xc4f1('0x71')],'raw':!![]}]})[_0xc4f1('0x22')](function(_0x36c979){if(_0x36c979){var _0x421f4a=_['flatMap'](_0x36c979,function(_0x21e2d3){var _0x2a7767=_0x21e2d3['get']({'plain':!![]});return _0x2a7767[_0xc4f1('0x6f')];});return db[_0xc4f1('0x53')][_0xc4f1('0x5e')]({'where':{'id':_0x6f1951[_0xc4f1('0x5f')]['id']}})[_0xc4f1('0x22')](function(_0x369ab8){return db[_0xc4f1('0x72')]['transaction'](function(_0x136863){return _0x369ab8[_0xc4f1('0x73')](_0x453f3d,{'transaction':_0x136863})[_0xc4f1('0x22')](function(){return BPromise['each'](_0x421f4a,function(_0x3fcc5f){return db['UserChatQueue'][_0xc4f1('0x74')]({'where':{'UserId':_0x3fcc5f['id'],'ChatQueueId':_0x6f1951[_0xc4f1('0x5f')]['id']},'transaction':_0x136863});});})[_0xc4f1('0x22')](function(){_0x421f4a[_0xc4f1('0x75')](function(_0x593a7d){socket[_0xc4f1('0x76')]('userChatQueue:save',{'UserId':_0x593a7d['id'],'ChatQueueId':_0x369ab8['id']});});});});});}})[_0xc4f1('0x22')](respondWithStatusCode(_0x57609b,null))[_0xc4f1('0x2a')](handleError(_0x57609b,null));};exports[_0xc4f1('0x77')]=function(_0x29e617,_0x546fa5,_0x416599){return db['Team'][_0xc4f1('0x55')]({'where':{'id':_0x29e617[_0xc4f1('0x44')][_0xc4f1('0x6e')]},'attributes':['id'],'include':[{'model':db[_0xc4f1('0x65')],'as':_0xc4f1('0x6f'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x546fa5,null))[_0xc4f1('0x22')](function(_0x26d0c2){var _0x1dda73=_['map'](_0x26d0c2,'id');var _0xb1bf8e=[];var _0x271f4a=[];var _0x77ecc9=squel[_0xc4f1('0x78')]();_0x77ecc9['field'](_0xc4f1('0x79'))[_0xc4f1('0x7a')](_0xc4f1('0x7b'),'tq')[_0xc4f1('0x7c')](_0xc4f1('0x7d'),'ut',_0xc4f1('0x7e'))[_0xc4f1('0x4e')](_0xc4f1('0x7f'),_0x29e617['params']['id']);for(var _0x28dfdb=0x0;_0x28dfdb<_0x26d0c2[_0xc4f1('0x57')];_0x28dfdb+=0x1){let _0x2c6f25=_0x26d0c2[_0x28dfdb];for(var _0x74cea6=0x0;_0x74cea6<_0x2c6f25[_0xc4f1('0x6f')][_0xc4f1('0x57')];_0x74cea6+=0x1){let _0x4f16bb=_0x2c6f25[_0xc4f1('0x6f')][_0x74cea6];var _0x41c161=_0x77ecc9['clone']();_0x41c161['where'](_0xc4f1('0x80'),_0x4f16bb['id']);_0x271f4a[_0xc4f1('0x81')](db['sequelize'][_0xc4f1('0x44')](_0x41c161[_0xc4f1('0x82')](),{'type':db[_0xc4f1('0x72')][_0xc4f1('0x83')]['SELECT']})[_0xc4f1('0x22')](function(_0x727350){if(_0x727350['length']===0x1){return _0x4f16bb['id'];}else{var _0x25915c=_[_0xc4f1('0x84')](_[_0xc4f1('0x40')](_0x727350,'TeamId'),function(_0xbb0b84){return _[_0xc4f1('0x85')](_0x1dda73,_0xbb0b84);});if(_0x25915c){return _0x4f16bb['id'];}}}));}}return BPromise[_0xc4f1('0x86')](_0x271f4a)[_0xc4f1('0x22')](function(_0x37bb0e){_0xb1bf8e=_(_0xb1bf8e)[_0xc4f1('0x87')](_0x37bb0e)[_0xc4f1('0x88')]()['value']();return db[_0xc4f1('0x53')]['find']({'where':{'id':_0x29e617['params']['id']}})[_0xc4f1('0x22')](function(_0x1cda6e){return db[_0xc4f1('0x72')][_0xc4f1('0x89')](function(_0x2dcf09){return _0x1cda6e[_0xc4f1('0x77')](_0x29e617[_0xc4f1('0x44')]['ids'],{'transaction':_0x2dcf09})[_0xc4f1('0x22')](function(){if(!_[_0xc4f1('0x8a')](_0xb1bf8e)){return _0x1cda6e[_0xc4f1('0x8b')](_0xb1bf8e,{'transaction':_0x2dcf09});}})[_0xc4f1('0x22')](function(){_0xb1bf8e[_0xc4f1('0x75')](function(_0x2e710f){socket['emit'](_0xc4f1('0x8c'),{'UserId':_0x2e710f,'ChatQueueId':_0x1cda6e['id']});});});});});});})['then'](respondWithStatusCode(_0x546fa5,null))[_0xc4f1('0x2a')](handleError(_0x546fa5,null));};exports[_0xc4f1('0x8d')]=function(_0x29c6cf,_0x26d379,_0x2c5cd6){return db[_0xc4f1('0x53')][_0xc4f1('0x5e')]({'where':{'id':_0x29c6cf[_0xc4f1('0x5f')]['id']}})[_0xc4f1('0x22')](handleEntityNotFound(_0x26d379,null))[_0xc4f1('0x22')](function(_0x546d18){if(_0x546d18){return _0x546d18[_0xc4f1('0x8d')](_0x29c6cf[_0xc4f1('0x5a')]['ids'],_[_0xc4f1('0x8e')](_0x29c6cf[_0xc4f1('0x5a')],['ids','id'])||{})[_0xc4f1('0x8f')](function(_0x590da0){for(var _0xc44005=0x0;_0xc44005<_0x29c6cf[_0xc4f1('0x5a')][_0xc4f1('0x6e')][_0xc4f1('0x57')];_0xc44005+=0x1){socket[_0xc4f1('0x76')]('userChatQueue:save',{'UserId':_0x29c6cf[_0xc4f1('0x5a')][_0xc4f1('0x6e')][_0xc44005],'ChatQueueId':_0x29c6cf[_0xc4f1('0x5f')]['id']});}return _0x590da0;});}})[_0xc4f1('0x22')](respondWithResult(_0x26d379,null))[_0xc4f1('0x2a')](handleError(_0x26d379,null));};exports['removeAgents']=function(_0x4767a5,_0x59b04b,_0x160575){return db[_0xc4f1('0x53')][_0xc4f1('0x5e')]({'where':{'id':_0x4767a5['params']['id']}})[_0xc4f1('0x22')](handleEntityNotFound(_0x59b04b,null))[_0xc4f1('0x22')](function(_0x5a1c03){if(_0x5a1c03){return _0x5a1c03['removeAgents'](_0x4767a5[_0xc4f1('0x44')]['ids'])['then'](function(){if(_['isArray'](_0x4767a5[_0xc4f1('0x44')][_0xc4f1('0x6e')])){for(var _0xde668f=0x0;_0xde668f<_0x4767a5['query'][_0xc4f1('0x6e')][_0xc4f1('0x57')];_0xde668f+=0x1){socket['emit']('userChatQueue:remove',{'UserId':Number(_0x4767a5[_0xc4f1('0x44')][_0xc4f1('0x6e')][_0xde668f]),'ChatQueueId':Number(_0x4767a5[_0xc4f1('0x5f')]['id'])});}}else{socket['emit'](_0xc4f1('0x8c'),{'UserId':Number(_0x4767a5['query'][_0xc4f1('0x6e')]),'ChatQueueId':Number(_0x4767a5[_0xc4f1('0x5f')]['id'])});}});}})[_0xc4f1('0x22')](respondWithStatusCode(_0x59b04b,null))[_0xc4f1('0x2a')](handleError(_0x59b04b,null));};exports[_0xc4f1('0x90')]=function(_0x29dbf4,_0x225d5b,_0x411cf6){var _0x58ed67={};var _0x56b61e={};var _0x3299dc;var _0x3f6d8b;return db[_0xc4f1('0x53')][_0xc4f1('0x62')]({'where':{'id':_0x29dbf4['params']['id']}})['then'](handleEntityNotFound(_0x225d5b,null))[_0xc4f1('0x22')](function(_0x1d23cd){if(_0x1d23cd){_0x3299dc=_0x1d23cd;_0x56b61e[_0xc4f1('0x43')]=_['keys'](db[_0xc4f1('0x65')][_0xc4f1('0x41')]);_0x56b61e[_0xc4f1('0x44')]=_['keys'](_0x29dbf4['query']);_0x56b61e[_0xc4f1('0x46')]=_[_0xc4f1('0x47')](_0x56b61e[_0xc4f1('0x43')],_0x56b61e[_0xc4f1('0x44')]);_0x58ed67[_0xc4f1('0x48')]=_[_0xc4f1('0x47')](_0x56b61e[_0xc4f1('0x43')],qs['fields'](_0x29dbf4['query']['fields']));_0x58ed67[_0xc4f1('0x48')]=_0x58ed67[_0xc4f1('0x48')][_0xc4f1('0x57')]?_0x58ed67[_0xc4f1('0x48')]:_0x56b61e['model'];_0x58ed67[_0xc4f1('0x4c')]=qs[_0xc4f1('0x4d')](_0x29dbf4['query'][_0xc4f1('0x4d')]);_0x58ed67[_0xc4f1('0x4e')]=qs[_0xc4f1('0x46')](_[_0xc4f1('0x6d')](_0x29dbf4['query'],_0x56b61e[_0xc4f1('0x46')]));if(_0x29dbf4['query']['filter']){_0x58ed67['where']=_[_0xc4f1('0x51')](_0x58ed67[_0xc4f1('0x4e')],{'$or':_[_0xc4f1('0x40')](_0x58ed67[_0xc4f1('0x48')],function(_0x14d040){var _0x10db1e={};_0x10db1e[_0x14d040]={'$like':'%'+_0x29dbf4[_0xc4f1('0x44')][_0xc4f1('0x4f')]+'%'};return _0x10db1e;})});}_0x58ed67=_['merge']({},_0x58ed67,_0x29dbf4['options']);return _0x3299dc['getAgents'](_0x58ed67);}})[_0xc4f1('0x22')](function(_0x2605d6){if(_0x2605d6){_0x3f6d8b=_0x2605d6['length'];if(!_0x29dbf4[_0xc4f1('0x44')][_0xc4f1('0x4a')](_0xc4f1('0x4b'))){_0x58ed67[_0xc4f1('0x30')]=qs['limit'](_0x29dbf4[_0xc4f1('0x44')]['limit']);_0x58ed67[_0xc4f1('0x2f')]=qs[_0xc4f1('0x2f')](_0x29dbf4[_0xc4f1('0x44')]['offset']);}return _0x3299dc[_0xc4f1('0x90')](_0x58ed67);}})[_0xc4f1('0x22')](function(_0x396f30){if(_0x396f30){return _0x396f30?{'count':_0x3f6d8b,'rows':_0x396f30}:null;}})[_0xc4f1('0x22')](respondWithResult(_0x225d5b,null))[_0xc4f1('0x2a')](handleError(_0x225d5b,null));}; \ No newline at end of file +var _0x1ae0=['Unable\x20to\x20retrieve\x20the\x20current\x20user','find','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','describe','findOne','UserChatQueue','options','User','agent','chatPause','SIP','createdAt','updatedAt','getTeams','Team','addTeams','ids','Agents','voicePause','interface','flatMap','sequelize','transaction','each','findOrCreate','forEach','emit','removeTeams','tq.TeamId','from','join','user_has_teams','clone','ut.UserId\x20=\x20?','push','QueryTypes','SELECT','every','TeamId','all','value','isEmpty','removeAgents','addAgents','omit','spread','userChatQueue:save','userChatQueue:remove','getAgents','html-pdf','rimraf','zip-dir','request-promise','moment','bluebird','mustache','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','defaults','localhost','socket.io-emitter','redis','./chatQueue.socket','jayson/promise','client','http','test','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','info','ChatQueue,\x20%s,\x20%s','debug','ChatQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','sendStatus','status','json','offset','limit','set','apply','reject','save','update','get','ChatQueues','UserProfileResource','destroy','end','stack','name','send','map','fieldName','type','key','model','query','keys','fields','attributes','length','hasOwnProperty','nolimit','order','sort','pick','filters','where','merge','VIRTUAL','filter','count','includeAll','ChatQueue','findAll','rows','show','rawAttributes','intersection','include','create','body','user'];(function(_0x4c1c6a,_0x4c1ef5){var _0x59a9df=function(_0x6825f8){while(--_0x6825f8){_0x4c1c6a['push'](_0x4c1c6a['shift']());}};_0x59a9df(++_0x4c1ef5);}(_0x1ae0,0x15b));var _0x01ae=function(_0x46aaff,_0x439b0a){_0x46aaff=_0x46aaff-0x0;var _0x13abbf=_0x1ae0[_0x46aaff];return _0x13abbf;};'use strict';var pdf=require(_0x01ae('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x01ae('0x1'));var zipdir=require(_0x01ae('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x01ae('0x3'));var moment=require(_0x01ae('0x4'));var BPromise=require(_0x01ae('0x5'));var Mustache=require(_0x01ae('0x6'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0x01ae('0x7'));var ejs=require(_0x01ae('0x8'));var fs=require('fs');var _=require('lodash');var squel=require(_0x01ae('0x9'));var crypto=require(_0x01ae('0xa'));var jsforce=require(_0x01ae('0xb'));var deskjs=require(_0x01ae('0xc'));var toCsv=require(_0x01ae('0x7'));var querystring=require(_0x01ae('0xd'));var Papa=require('papaparse');var Redis=require(_0x01ae('0xe'));var authService=require(_0x01ae('0xf'));var qs=require(_0x01ae('0x10'));var as=require(_0x01ae('0x11'));var hardwareService=require(_0x01ae('0x12'));var logger=require(_0x01ae('0x13'))(_0x01ae('0x14'));var utils=require(_0x01ae('0x15'));var config=require(_0x01ae('0x16'));var db=require('../../mysqldb')['db'];config['redis']=_[_0x01ae('0x17')](config['redis'],{'host':_0x01ae('0x18'),'port':0x18eb});var socket=require(_0x01ae('0x19'))(new Redis(config[_0x01ae('0x1a')]));require(_0x01ae('0x1b'))['register'](socket);var jayson=require(_0x01ae('0x1c'));var client=jayson[_0x01ae('0x1d')][_0x01ae('0x1e')]({'port':0x232a});function checkPasswordPattern(_0x53f045,_0x66044,_0x240d26){if(_0x240d26){var _0x49683d=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x49683d[_0x01ae('0x1f')](_0x66044)){return _0x53f045;}else{throw new db['Sequelize'][(_0x01ae('0x20'))](_0x01ae('0x21'));}}else{return _0x53f045;}}function respondWithRpcPromise(_0x1c51c9,_0x52f38e,_0x433fde,_0x2efb56){return new BPromise(function(_0x380b5f,_0x7b7ce2){var _0x25442c=_0x2efb56||client;return _0x25442c[_0x01ae('0x22')](_0x1c51c9,_0x433fde)[_0x01ae('0x23')](function(_0x554367){logger[_0x01ae('0x24')](_0x01ae('0x25'),_0x52f38e,'request\x20sent');logger[_0x01ae('0x26')](_0x01ae('0x27'),_0x52f38e,_0x01ae('0x28'),JSON[_0x01ae('0x29')](_0x554367));if(_0x554367[_0x01ae('0x2a')]){if(_0x554367[_0x01ae('0x2a')][_0x01ae('0x2b')]===0x1f4){logger[_0x01ae('0x2a')](_0x01ae('0x25'),_0x52f38e,_0x554367[_0x01ae('0x2a')]['message']);return _0x7b7ce2(_0x554367[_0x01ae('0x2a')]['message']);}logger[_0x01ae('0x2a')](_0x01ae('0x25'),_0x52f38e,_0x554367[_0x01ae('0x2a')][_0x01ae('0x2c')]);return _0x380b5f(_0x554367[_0x01ae('0x2a')][_0x01ae('0x2c')]);}else{logger[_0x01ae('0x24')]('ChatQueue,\x20%s,\x20%s',_0x52f38e,_0x01ae('0x28'));_0x380b5f(_0x554367[_0x01ae('0x2d')][_0x01ae('0x2c')]);}})[_0x01ae('0x2e')](function(_0x28e41a){logger[_0x01ae('0x2a')](_0x01ae('0x25'),_0x52f38e,_0x28e41a);_0x7b7ce2(_0x28e41a);});});}function respondWithStatusCode(_0x30b817,_0x13e989){_0x13e989=_0x13e989||0xcc;return function(_0x191ef9){if(_0x191ef9){return _0x30b817[_0x01ae('0x2f')](_0x13e989);}return _0x30b817[_0x01ae('0x30')](_0x13e989)['end']();};}function respondWithResult(_0x42b840,_0x5e7c92){_0x5e7c92=_0x5e7c92||0xc8;return function(_0x52783e){if(_0x52783e){return _0x42b840[_0x01ae('0x30')](_0x5e7c92)[_0x01ae('0x31')](_0x52783e);}};}function respondWithFilteredResult(_0x476851,_0x5927cb){return function(_0x517bd2){if(_0x517bd2){var _0x40b1f6=_0x517bd2['count'],_0x251395=_0x5927cb[_0x01ae('0x32')],_0x52be55=_0x5927cb[_0x01ae('0x32')]+_0x5927cb[_0x01ae('0x33')],_0x2b21b3;if(_0x52be55>=_0x40b1f6){_0x52be55=_0x40b1f6;_0x2b21b3=0xc8;}else{_0x2b21b3=0xce;}_0x476851['status'](_0x2b21b3);return _0x476851[_0x01ae('0x34')]('Content-Range',_0x251395+'-'+_0x52be55+'/'+_0x40b1f6)[_0x01ae('0x31')](_0x517bd2);}return null;};}function patchUpdates(_0x5b6e51){return function(_0x4bf723){try{jsonpatch[_0x01ae('0x35')](_0x4bf723,_0x5b6e51,!![]);}catch(_0x9cff62){return BPromise[_0x01ae('0x36')](_0x9cff62);}return _0x4bf723[_0x01ae('0x37')]();};}function saveUpdates(_0x588a81,_0x1b1f6d){return function(_0x43f701){if(_0x43f701){return _0x43f701[_0x01ae('0x38')](_0x588a81)[_0x01ae('0x23')](function(_0x47fe81){return _0x47fe81;});}return null;};}function removeEntity(_0x57f807,_0x44f084){return function(_0x53a948){if(_0x53a948){return _0x53a948['destroy']()[_0x01ae('0x23')](function(){var _0xfd698e=_0x53a948[_0x01ae('0x39')]({'plain':!![]});var _0x55e974=_0x01ae('0x3a');return db[_0x01ae('0x3b')][_0x01ae('0x3c')]({'where':{'type':_0x55e974,'resourceId':_0xfd698e['id']}})['then'](function(){return _0x53a948;});})[_0x01ae('0x23')](function(){_0x57f807[_0x01ae('0x30')](0xcc)[_0x01ae('0x3d')]();});}};}function handleEntityNotFound(_0x2e88ac,_0x51c422){return function(_0x1e145c){if(!_0x1e145c){_0x2e88ac[_0x01ae('0x2f')](0x194);}return _0x1e145c;};}function handleError(_0x398381,_0x534f7e){_0x534f7e=_0x534f7e||0x1f4;return function(_0x1efdfb){logger[_0x01ae('0x2a')](_0x1efdfb[_0x01ae('0x3e')]);if(_0x1efdfb[_0x01ae('0x3f')]){delete _0x1efdfb[_0x01ae('0x3f')];}_0x398381[_0x01ae('0x30')](_0x534f7e)[_0x01ae('0x40')](_0x1efdfb);};}exports['index']=function(_0xfba725,_0x274d4f){var _0x1a9da3={},_0x135448={},_0x4a316a={'count':0x0,'rows':[]};var _0x14ab01=_[_0x01ae('0x41')](db['ChatQueue']['rawAttributes'],function(_0x357440){return{'name':_0x357440[_0x01ae('0x42')],'type':_0x357440[_0x01ae('0x43')][_0x01ae('0x44')]};});_0x135448[_0x01ae('0x45')]=_[_0x01ae('0x41')](_0x14ab01,_0x01ae('0x3f'));_0x135448[_0x01ae('0x46')]=_[_0x01ae('0x47')](_0xfba725[_0x01ae('0x46')]);_0x135448['filters']=_['intersection'](_0x135448[_0x01ae('0x45')],_0x135448['query']);_0x1a9da3['attributes']=_['intersection'](_0x135448[_0x01ae('0x45')],qs['fields'](_0xfba725['query'][_0x01ae('0x48')]));_0x1a9da3[_0x01ae('0x49')]=_0x1a9da3['attributes'][_0x01ae('0x4a')]?_0x1a9da3[_0x01ae('0x49')]:_0x135448[_0x01ae('0x45')];if(!_0xfba725[_0x01ae('0x46')][_0x01ae('0x4b')](_0x01ae('0x4c'))){_0x1a9da3['limit']=qs[_0x01ae('0x33')](_0xfba725[_0x01ae('0x46')]['limit']);_0x1a9da3['offset']=qs[_0x01ae('0x32')](_0xfba725[_0x01ae('0x46')][_0x01ae('0x32')]);}_0x1a9da3[_0x01ae('0x4d')]=qs[_0x01ae('0x4e')](_0xfba725[_0x01ae('0x46')][_0x01ae('0x4e')]);_0x1a9da3['where']=qs['filters'](_[_0x01ae('0x4f')](_0xfba725[_0x01ae('0x46')],_0x135448[_0x01ae('0x50')]),_0x14ab01);if(_0xfba725[_0x01ae('0x46')]['filter']){_0x1a9da3[_0x01ae('0x51')]=_[_0x01ae('0x52')](_0x1a9da3[_0x01ae('0x51')],{'$or':_[_0x01ae('0x41')](_0x14ab01,function(_0x13f472){if(_0x13f472[_0x01ae('0x43')]!==_0x01ae('0x53')){var _0x2d35af={};_0x2d35af[_0x13f472[_0x01ae('0x3f')]]={'$like':'%'+_0xfba725['query'][_0x01ae('0x54')]+'%'};return _0x2d35af;}})});}_0x1a9da3=_['merge']({},_0x1a9da3,_0xfba725['options']);var _0x1dfb07={'where':_0x1a9da3[_0x01ae('0x51')]};return db['ChatQueue'][_0x01ae('0x55')](_0x1dfb07)[_0x01ae('0x23')](function(_0x38cebd){_0x4a316a['count']=_0x38cebd;if(_0xfba725[_0x01ae('0x46')][_0x01ae('0x56')]){_0x1a9da3['include']=[{'all':!![]}];}return db[_0x01ae('0x57')][_0x01ae('0x58')](_0x1a9da3);})[_0x01ae('0x23')](function(_0x2c7987){_0x4a316a[_0x01ae('0x59')]=_0x2c7987;return _0x4a316a;})['then'](respondWithFilteredResult(_0x274d4f,_0x1a9da3))[_0x01ae('0x2e')](handleError(_0x274d4f,null));};exports[_0x01ae('0x5a')]=function(_0x1a7645,_0x442428){var _0x782fcc={'raw':!![],'where':{'id':_0x1a7645['params']['id']}},_0x142b42={};_0x142b42[_0x01ae('0x45')]=_[_0x01ae('0x47')](db['ChatQueue'][_0x01ae('0x5b')]);_0x142b42[_0x01ae('0x46')]=_['keys'](_0x1a7645[_0x01ae('0x46')]);_0x142b42[_0x01ae('0x50')]=_[_0x01ae('0x5c')](_0x142b42['model'],_0x142b42[_0x01ae('0x46')]);_0x782fcc[_0x01ae('0x49')]=_[_0x01ae('0x5c')](_0x142b42[_0x01ae('0x45')],qs[_0x01ae('0x48')](_0x1a7645[_0x01ae('0x46')]['fields']));_0x782fcc['attributes']=_0x782fcc['attributes']['length']?_0x782fcc['attributes']:_0x142b42[_0x01ae('0x45')];if(_0x1a7645[_0x01ae('0x46')][_0x01ae('0x56')]){_0x782fcc[_0x01ae('0x5d')]=[{'all':!![]}];}_0x782fcc=_[_0x01ae('0x52')]({},_0x782fcc,_0x1a7645['options']);return db['ChatQueue']['find'](_0x782fcc)[_0x01ae('0x23')](handleEntityNotFound(_0x442428,null))['then'](respondWithResult(_0x442428,null))[_0x01ae('0x2e')](handleError(_0x442428,null));};exports[_0x01ae('0x5e')]=function(_0x3a8a3d,_0x1b57e3){return db[_0x01ae('0x57')][_0x01ae('0x5e')](_0x3a8a3d[_0x01ae('0x5f')],{})[_0x01ae('0x23')](function(_0x1553a4){var _0x27c0b1=_0x3a8a3d[_0x01ae('0x60')][_0x01ae('0x39')]({'plain':!![]});if(!_0x27c0b1)throw new Error(_0x01ae('0x61'));if(_0x27c0b1['role']==='user'){var _0x14a729=_0x1553a4[_0x01ae('0x39')]({'plain':!![]});var _0x1f58ed='ChatQueues';return db['UserProfileSection'][_0x01ae('0x62')]({'where':{'name':_0x1f58ed,'userProfileId':_0x27c0b1[_0x01ae('0x63')]},'raw':!![]})['then'](function(_0x4f7389){if(_0x4f7389&&_0x4f7389['autoAssociation']===0x0){return db['UserProfileResource'][_0x01ae('0x5e')]({'name':_0x14a729['name'],'resourceId':_0x14a729['id'],'type':_0x4f7389['name'],'sectionId':_0x4f7389['id']},{})[_0x01ae('0x23')](function(){return _0x1553a4;});}else{return _0x1553a4;}})[_0x01ae('0x2e')](function(_0x350586){logger[_0x01ae('0x2a')](_0x01ae('0x64'),_0x350586);throw _0x350586;});}return _0x1553a4;})['then'](respondWithResult(_0x1b57e3,0xc9))[_0x01ae('0x2e')](handleError(_0x1b57e3,null));};exports[_0x01ae('0x38')]=function(_0x319f5e,_0x569f95){if(_0x319f5e[_0x01ae('0x5f')]['id']){delete _0x319f5e[_0x01ae('0x5f')]['id'];}return db[_0x01ae('0x57')][_0x01ae('0x62')]({'where':{'id':_0x319f5e[_0x01ae('0x65')]['id']}})[_0x01ae('0x23')](handleEntityNotFound(_0x569f95,null))[_0x01ae('0x23')](saveUpdates(_0x319f5e[_0x01ae('0x5f')],null))[_0x01ae('0x23')](respondWithResult(_0x569f95,null))[_0x01ae('0x2e')](handleError(_0x569f95,null));};exports[_0x01ae('0x3c')]=function(_0x31e092,_0xea1b4e){return db[_0x01ae('0x57')][_0x01ae('0x62')]({'where':{'id':_0x31e092[_0x01ae('0x65')]['id']}})['then'](handleEntityNotFound(_0xea1b4e,null))[_0x01ae('0x23')](removeEntity(_0xea1b4e,null))['catch'](handleError(_0xea1b4e,null));};exports[_0x01ae('0x66')]=function(_0x40236a,_0x362877){return db[_0x01ae('0x57')][_0x01ae('0x66')]()[_0x01ae('0x23')](respondWithResult(_0x362877,null))['catch'](handleError(_0x362877,null));};exports['getMembers']=function(_0x2575ba,_0x14c502,_0x35e5ba){var _0x1c84a6={'raw':!![],'where':{}},_0x25a372={},_0x11d4ca;return db[_0x01ae('0x57')][_0x01ae('0x67')]({'where':{'id':_0x2575ba[_0x01ae('0x65')]['id']}})[_0x01ae('0x23')](handleEntityNotFound(_0x14c502,null))['then'](function(_0x4c63ad){if(_0x4c63ad){_0x11d4ca=_0x4c63ad[_0x01ae('0x39')]({'plain':!![]});_0x25a372[_0x01ae('0x45')]=_[_0x01ae('0x47')](db[_0x01ae('0x68')][_0x01ae('0x5b')]);_0x25a372[_0x01ae('0x46')]=_[_0x01ae('0x47')](_0x2575ba['query']);_0x25a372[_0x01ae('0x50')]=_['intersection'](_0x25a372[_0x01ae('0x45')],_0x25a372[_0x01ae('0x46')]);_0x1c84a6[_0x01ae('0x49')]=_[_0x01ae('0x5c')](_0x25a372['model'],qs['fields'](_0x2575ba['query']['fields']));_0x1c84a6[_0x01ae('0x49')]=_0x1c84a6[_0x01ae('0x49')][_0x01ae('0x4a')]?_0x1c84a6['attributes']:_0x25a372[_0x01ae('0x45')];if(!_0x2575ba[_0x01ae('0x46')][_0x01ae('0x4b')](_0x01ae('0x4c'))){_0x1c84a6[_0x01ae('0x33')]=qs[_0x01ae('0x33')](_0x2575ba[_0x01ae('0x46')][_0x01ae('0x33')]);_0x1c84a6[_0x01ae('0x32')]=qs[_0x01ae('0x32')](_0x2575ba[_0x01ae('0x46')][_0x01ae('0x32')]);}_0x1c84a6[_0x01ae('0x4d')]=qs[_0x01ae('0x4e')](_0x2575ba[_0x01ae('0x46')][_0x01ae('0x4e')]);_0x1c84a6[_0x01ae('0x51')]=qs[_0x01ae('0x50')](_[_0x01ae('0x4f')](_0x2575ba[_0x01ae('0x46')],_0x25a372[_0x01ae('0x50')]));_0x1c84a6['where']['ChatQueueId']=_0x4c63ad['id'];if(_0x2575ba[_0x01ae('0x46')]['filter']){_0x1c84a6[_0x01ae('0x51')]=_['merge'](_0x1c84a6[_0x01ae('0x51')],{'$or':_[_0x01ae('0x41')](_0x1c84a6[_0x01ae('0x49')],function(_0x4d9488){var _0x2c87af={};_0x2c87af[_0x4d9488]={'$like':'%'+_0x2575ba[_0x01ae('0x46')]['filter']+'%'};return _0x2c87af;})});}_0x1c84a6=_[_0x01ae('0x52')]({},_0x1c84a6,_0x2575ba[_0x01ae('0x69')]);return db[_0x01ae('0x68')][_0x01ae('0x58')](_0x1c84a6);}})[_0x01ae('0x23')](function(_0x2714ee){if(_0x2714ee){return db[_0x01ae('0x6a')]['findAndCountAll']({'where':{'id':_[_0x01ae('0x41')](_0x2714ee,'UserId'),'role':_0x01ae('0x6b')},'attributes':['id','name',_0x01ae('0x6c'),'updatedAt','createdAt']});}})[_0x01ae('0x23')](function(_0x3fb4ca){if(_0x3fb4ca){return{'count':_0x3fb4ca[_0x01ae('0x55')],'rows':_[_0x01ae('0x41')](_0x3fb4ca[_0x01ae('0x59')],function(_0x31aa25){return{'membername':_0x31aa25[_0x01ae('0x3f')],'UserId':_0x31aa25['id'],'queue_name':_0x11d4ca['name'],'ChatQueueId':_0x11d4ca['id'],'interface':util['format']('%s/%s',_0x01ae('0x6d'),_0x31aa25[_0x01ae('0x3f')]),'penalty':0x0,'paused':_0x31aa25[_0x01ae('0x6c')],'createdAt':_0x31aa25[_0x01ae('0x6e')],'updatedAt':_0x31aa25[_0x01ae('0x6f')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x01ae('0x23')](respondWithFilteredResult(_0x14c502,_0x1c84a6))[_0x01ae('0x2e')](handleError(_0x14c502,null));};exports[_0x01ae('0x70')]=function(_0x36099e,_0x463741,_0x3f129e){var _0x49d11a={};var _0x54d931={};var _0x1aac4e;var _0x48915c;return db['ChatQueue'][_0x01ae('0x67')]({'where':{'id':_0x36099e[_0x01ae('0x65')]['id']}})[_0x01ae('0x23')](handleEntityNotFound(_0x463741,null))[_0x01ae('0x23')](function(_0x5c02e4){if(_0x5c02e4){_0x1aac4e=_0x5c02e4;_0x54d931[_0x01ae('0x45')]=_[_0x01ae('0x47')](db[_0x01ae('0x71')][_0x01ae('0x5b')]);_0x54d931[_0x01ae('0x46')]=_[_0x01ae('0x47')](_0x36099e[_0x01ae('0x46')]);_0x54d931[_0x01ae('0x50')]=_['intersection'](_0x54d931[_0x01ae('0x45')],_0x54d931[_0x01ae('0x46')]);_0x49d11a[_0x01ae('0x49')]=_[_0x01ae('0x5c')](_0x54d931['model'],qs[_0x01ae('0x48')](_0x36099e['query'][_0x01ae('0x48')]));_0x49d11a['attributes']=_0x49d11a['attributes']['length']?_0x49d11a[_0x01ae('0x49')]:_0x54d931[_0x01ae('0x45')];_0x49d11a[_0x01ae('0x4d')]=qs[_0x01ae('0x4e')](_0x36099e[_0x01ae('0x46')][_0x01ae('0x4e')]);_0x49d11a[_0x01ae('0x51')]=qs['filters'](_[_0x01ae('0x4f')](_0x36099e[_0x01ae('0x46')],_0x54d931['filters']));if(_0x36099e[_0x01ae('0x46')][_0x01ae('0x54')]){_0x49d11a['where']=_[_0x01ae('0x52')](_0x49d11a[_0x01ae('0x51')],{'$or':_['map'](_0x49d11a[_0x01ae('0x49')],function(_0x1682b9){var _0x388db8={};_0x388db8[_0x1682b9]={'$like':'%'+_0x36099e['query'][_0x01ae('0x54')]+'%'};return _0x388db8;})});}_0x49d11a=_['merge']({},_0x49d11a,_0x36099e['options']);return _0x1aac4e[_0x01ae('0x70')](_0x49d11a);}})[_0x01ae('0x23')](function(_0x26a0c6){if(_0x26a0c6){_0x48915c=_0x26a0c6[_0x01ae('0x4a')];if(!_0x36099e['query'][_0x01ae('0x4b')]('nolimit')){_0x49d11a[_0x01ae('0x33')]=qs[_0x01ae('0x33')](_0x36099e['query'][_0x01ae('0x33')]);_0x49d11a['offset']=qs[_0x01ae('0x32')](_0x36099e[_0x01ae('0x46')][_0x01ae('0x32')]);}return _0x1aac4e['getTeams'](_0x49d11a);}})['then'](function(_0x271ce5){if(_0x271ce5){return _0x271ce5?{'count':_0x48915c,'rows':_0x271ce5}:null;}})[_0x01ae('0x23')](respondWithResult(_0x463741,null))['catch'](handleError(_0x463741,null));};exports[_0x01ae('0x72')]=function(_0x40abf3,_0x3b18d6,_0x4c02a3){var _0x1c3ec3=_0x40abf3['body'][_0x01ae('0x73')];return db[_0x01ae('0x71')][_0x01ae('0x58')]({'where':{'id':_0x1c3ec3},'attributes':['id'],'include':[{'model':db['User'],'as':_0x01ae('0x74'),'attributes':['id','name','online',_0x01ae('0x75'),_0x01ae('0x76')],'raw':!![]}]})[_0x01ae('0x23')](function(_0x330159){if(_0x330159){var _0x2c0a0c=_[_0x01ae('0x77')](_0x330159,function(_0x48c375){var _0x51279a=_0x48c375[_0x01ae('0x39')]({'plain':!![]});return _0x51279a[_0x01ae('0x74')];});return db[_0x01ae('0x57')][_0x01ae('0x62')]({'where':{'id':_0x40abf3[_0x01ae('0x65')]['id']}})[_0x01ae('0x23')](function(_0x4638c3){return db[_0x01ae('0x78')][_0x01ae('0x79')](function(_0x41d970){return _0x4638c3['addTeams'](_0x1c3ec3,{'transaction':_0x41d970})['then'](function(){return BPromise[_0x01ae('0x7a')](_0x2c0a0c,function(_0x2a5813){return db[_0x01ae('0x68')][_0x01ae('0x7b')]({'where':{'UserId':_0x2a5813['id'],'ChatQueueId':_0x40abf3[_0x01ae('0x65')]['id']},'transaction':_0x41d970});});})[_0x01ae('0x23')](function(){_0x2c0a0c[_0x01ae('0x7c')](function(_0x5c0eb8){socket[_0x01ae('0x7d')]('userChatQueue:save',{'UserId':_0x5c0eb8['id'],'ChatQueueId':_0x4638c3['id']});});});});});}})[_0x01ae('0x23')](respondWithStatusCode(_0x3b18d6,null))[_0x01ae('0x2e')](handleError(_0x3b18d6,null));};exports[_0x01ae('0x7e')]=function(_0x1901ab,_0x3d15ec,_0x285437){return db[_0x01ae('0x71')][_0x01ae('0x58')]({'where':{'id':_0x1901ab[_0x01ae('0x46')][_0x01ae('0x73')]},'attributes':['id'],'include':[{'model':db[_0x01ae('0x6a')],'as':_0x01ae('0x74'),'attributes':['id'],'raw':!![]}]})[_0x01ae('0x23')](handleEntityNotFound(_0x3d15ec,null))[_0x01ae('0x23')](function(_0x4c5118){var _0x552e07=_[_0x01ae('0x41')](_0x4c5118,'id');var _0x1389e4=[];var _0x2cd419=[];var _0x224109=squel['select']();_0x224109['field'](_0x01ae('0x7f'))[_0x01ae('0x80')]('team_has_chat_queues','tq')[_0x01ae('0x81')](_0x01ae('0x82'),'ut','ut.TeamId\x20=\x20tq.TeamId')[_0x01ae('0x51')]('ChatQueueId\x20=\x20?',_0x1901ab[_0x01ae('0x65')]['id']);for(var _0x1e5c8f=0x0;_0x1e5c8f<_0x4c5118[_0x01ae('0x4a')];_0x1e5c8f+=0x1){let _0x56c1c4=_0x4c5118[_0x1e5c8f];for(var _0x1ebf46=0x0;_0x1ebf46<_0x56c1c4[_0x01ae('0x74')][_0x01ae('0x4a')];_0x1ebf46+=0x1){let _0x34b4de=_0x56c1c4[_0x01ae('0x74')][_0x1ebf46];var _0x11621e=_0x224109[_0x01ae('0x83')]();_0x11621e['where'](_0x01ae('0x84'),_0x34b4de['id']);_0x2cd419[_0x01ae('0x85')](db[_0x01ae('0x78')][_0x01ae('0x46')](_0x11621e['toString'](),{'type':db[_0x01ae('0x78')][_0x01ae('0x86')][_0x01ae('0x87')]})[_0x01ae('0x23')](function(_0x2c06c6){if(_0x2c06c6['length']===0x1){return _0x34b4de['id'];}else{var _0x592e3b=_[_0x01ae('0x88')](_[_0x01ae('0x41')](_0x2c06c6,_0x01ae('0x89')),function(_0x399334){return _['includes'](_0x552e07,_0x399334);});if(_0x592e3b){return _0x34b4de['id'];}}}));}}return BPromise[_0x01ae('0x8a')](_0x2cd419)['then'](function(_0x21c940){_0x1389e4=_(_0x1389e4)['union'](_0x21c940)['compact']()[_0x01ae('0x8b')]();return db[_0x01ae('0x57')]['find']({'where':{'id':_0x1901ab[_0x01ae('0x65')]['id']}})[_0x01ae('0x23')](function(_0x47cca1){return db[_0x01ae('0x78')][_0x01ae('0x79')](function(_0x291f37){return _0x47cca1[_0x01ae('0x7e')](_0x1901ab['query']['ids'],{'transaction':_0x291f37})['then'](function(){if(!_[_0x01ae('0x8c')](_0x1389e4)){return _0x47cca1[_0x01ae('0x8d')](_0x1389e4,{'transaction':_0x291f37});}})[_0x01ae('0x23')](function(){_0x1389e4[_0x01ae('0x7c')](function(_0x19a9ff){socket['emit']('userChatQueue:remove',{'UserId':_0x19a9ff,'ChatQueueId':_0x47cca1['id']});});});});});});})[_0x01ae('0x23')](respondWithStatusCode(_0x3d15ec,null))[_0x01ae('0x2e')](handleError(_0x3d15ec,null));};exports[_0x01ae('0x8e')]=function(_0x163185,_0x463987,_0x213bd1){return db[_0x01ae('0x57')][_0x01ae('0x62')]({'where':{'id':_0x163185[_0x01ae('0x65')]['id']}})[_0x01ae('0x23')](handleEntityNotFound(_0x463987,null))[_0x01ae('0x23')](function(_0x55d2b0){if(_0x55d2b0){return _0x55d2b0[_0x01ae('0x8e')](_0x163185[_0x01ae('0x5f')][_0x01ae('0x73')],_[_0x01ae('0x8f')](_0x163185[_0x01ae('0x5f')],[_0x01ae('0x73'),'id'])||{})[_0x01ae('0x90')](function(_0x3b347d){for(var _0x9962c6=0x0;_0x9962c6<_0x163185[_0x01ae('0x5f')][_0x01ae('0x73')][_0x01ae('0x4a')];_0x9962c6+=0x1){socket['emit'](_0x01ae('0x91'),{'UserId':_0x163185[_0x01ae('0x5f')][_0x01ae('0x73')][_0x9962c6],'ChatQueueId':_0x163185[_0x01ae('0x65')]['id']});}return _0x3b347d;});}})['then'](respondWithResult(_0x463987,null))['catch'](handleError(_0x463987,null));};exports[_0x01ae('0x8d')]=function(_0x101545,_0x496b8f,_0xc3eea5){return db[_0x01ae('0x57')]['find']({'where':{'id':_0x101545[_0x01ae('0x65')]['id']}})[_0x01ae('0x23')](handleEntityNotFound(_0x496b8f,null))[_0x01ae('0x23')](function(_0x54210d){if(_0x54210d){return _0x54210d[_0x01ae('0x8d')](_0x101545['query']['ids'])['then'](function(){if(_['isArray'](_0x101545['query']['ids'])){for(var _0x12d5ee=0x0;_0x12d5ee<_0x101545[_0x01ae('0x46')][_0x01ae('0x73')][_0x01ae('0x4a')];_0x12d5ee+=0x1){socket['emit'](_0x01ae('0x92'),{'UserId':Number(_0x101545[_0x01ae('0x46')][_0x01ae('0x73')][_0x12d5ee]),'ChatQueueId':Number(_0x101545[_0x01ae('0x65')]['id'])});}}else{socket[_0x01ae('0x7d')](_0x01ae('0x92'),{'UserId':Number(_0x101545[_0x01ae('0x46')][_0x01ae('0x73')]),'ChatQueueId':Number(_0x101545[_0x01ae('0x65')]['id'])});}});}})[_0x01ae('0x23')](respondWithStatusCode(_0x496b8f,null))[_0x01ae('0x2e')](handleError(_0x496b8f,null));};exports[_0x01ae('0x93')]=function(_0x2d8db6,_0x4454f4,_0x3688f6){var _0x4ee1dd={};var _0x3f3ef0={};var _0x342f68;var _0x47a71e;return db[_0x01ae('0x57')][_0x01ae('0x67')]({'where':{'id':_0x2d8db6[_0x01ae('0x65')]['id']}})[_0x01ae('0x23')](handleEntityNotFound(_0x4454f4,null))[_0x01ae('0x23')](function(_0x3f913a){if(_0x3f913a){_0x342f68=_0x3f913a;_0x3f3ef0[_0x01ae('0x45')]=_[_0x01ae('0x47')](db['User']['rawAttributes']);_0x3f3ef0[_0x01ae('0x46')]=_[_0x01ae('0x47')](_0x2d8db6[_0x01ae('0x46')]);_0x3f3ef0['filters']=_['intersection'](_0x3f3ef0[_0x01ae('0x45')],_0x3f3ef0['query']);_0x4ee1dd['attributes']=_[_0x01ae('0x5c')](_0x3f3ef0[_0x01ae('0x45')],qs[_0x01ae('0x48')](_0x2d8db6[_0x01ae('0x46')][_0x01ae('0x48')]));_0x4ee1dd[_0x01ae('0x49')]=_0x4ee1dd[_0x01ae('0x49')][_0x01ae('0x4a')]?_0x4ee1dd[_0x01ae('0x49')]:_0x3f3ef0[_0x01ae('0x45')];_0x4ee1dd[_0x01ae('0x4d')]=qs[_0x01ae('0x4e')](_0x2d8db6['query'][_0x01ae('0x4e')]);_0x4ee1dd[_0x01ae('0x51')]=qs[_0x01ae('0x50')](_['pick'](_0x2d8db6[_0x01ae('0x46')],_0x3f3ef0[_0x01ae('0x50')]));if(_0x2d8db6[_0x01ae('0x46')][_0x01ae('0x54')]){_0x4ee1dd['where']=_[_0x01ae('0x52')](_0x4ee1dd[_0x01ae('0x51')],{'$or':_[_0x01ae('0x41')](_0x4ee1dd[_0x01ae('0x49')],function(_0x2f2055){var _0x108cec={};_0x108cec[_0x2f2055]={'$like':'%'+_0x2d8db6['query'][_0x01ae('0x54')]+'%'};return _0x108cec;})});}_0x4ee1dd=_[_0x01ae('0x52')]({},_0x4ee1dd,_0x2d8db6[_0x01ae('0x69')]);return _0x342f68[_0x01ae('0x93')](_0x4ee1dd);}})[_0x01ae('0x23')](function(_0x4dedc8){if(_0x4dedc8){_0x47a71e=_0x4dedc8['length'];if(!_0x2d8db6[_0x01ae('0x46')]['hasOwnProperty'](_0x01ae('0x4c'))){_0x4ee1dd[_0x01ae('0x33')]=qs[_0x01ae('0x33')](_0x2d8db6[_0x01ae('0x46')]['limit']);_0x4ee1dd[_0x01ae('0x32')]=qs[_0x01ae('0x32')](_0x2d8db6[_0x01ae('0x46')][_0x01ae('0x32')]);}return _0x342f68[_0x01ae('0x93')](_0x4ee1dd);}})[_0x01ae('0x23')](function(_0x1e8119){if(_0x1e8119){return _0x1e8119?{'count':_0x47a71e,'rows':_0x1e8119}:null;}})[_0x01ae('0x23')](respondWithResult(_0x4454f4,null))[_0x01ae('0x2e')](handleError(_0x4454f4,null));}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.events.js b/server/api/chatQueue/chatQueue.events.js index 9c42e80..5db6324 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 _0xadb5=['update','emit','hasOwnProperty','hook','exports','../../mysqldb','setMaxListeners','save'];(function(_0x12aaee,_0x5bf50c){var _0x37c350=function(_0x182775){while(--_0x182775){_0x12aaee['push'](_0x12aaee['shift']());}};_0x37c350(++_0x5bf50c);}(_0xadb5,0xad));var _0x5adb=function(_0x49ad0d,_0x9286ba){_0x49ad0d=_0x49ad0d-0x0;var _0x2677b6=_0xadb5[_0x49ad0d];return _0x2677b6;};'use strict';var EventEmitter=require('events');var ChatQueue=require(_0x5adb('0x0'))['db']['ChatQueue'];var ChatQueueEvents=new EventEmitter();ChatQueueEvents[_0x5adb('0x1')](0x0);var events={'afterCreate':_0x5adb('0x2'),'afterUpdate':_0x5adb('0x3'),'afterDestroy':'remove'};function emitEvent(_0x248dc6){return function(_0x31457,_0x2e3ef4,_0x4cb1d1){ChatQueueEvents[_0x5adb('0x4')](_0x248dc6+':'+_0x31457['id'],_0x31457);ChatQueueEvents[_0x5adb('0x4')](_0x248dc6,_0x31457);_0x4cb1d1(null);};}for(var e in events){if(events[_0x5adb('0x5')](e)){var event=events[e];ChatQueue[_0x5adb('0x6')](e,emitEvent(event));}}module[_0x5adb('0x7')]=ChatQueueEvents; \ No newline at end of file +var _0x0b0e=['ChatQueue','save','update','remove','emit','hasOwnProperty','hook','events'];(function(_0x962220,_0xb60f61){var _0x43adb7=function(_0x19a58a){while(--_0x19a58a){_0x962220['push'](_0x962220['shift']());}};_0x43adb7(++_0xb60f61);}(_0x0b0e,0x187));var _0xe0b0=function(_0xfb65aa,_0x1651a6){_0xfb65aa=_0xfb65aa-0x0;var _0x2aee31=_0x0b0e[_0xfb65aa];return _0x2aee31;};'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 diff --git a/server/api/chatQueue/chatQueue.model.js b/server/api/chatQueue/chatQueue.model.js index 1b76c0f..7dc2c45 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 _0xf820=['../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./chatQueue.attributes','ChatQueue','chat_queues'];(function(_0x30faee,_0x1c3794){var _0x3a90ab=function(_0x11129b){while(--_0x11129b){_0x30faee['push'](_0x30faee['shift']());}};_0x3a90ab(++_0x1c3794);}(_0xf820,0x1d6));var _0x0f82=function(_0x1c9085,_0x8956c){_0x1c9085=_0x1c9085-0x0;var _0x2c4e8e=_0xf820[_0x1c9085];return _0x2c4e8e;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x0f82('0x0'))(_0x0f82('0x1'));var moment=require(_0x0f82('0x2'));var BPromise=require(_0x0f82('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0f82('0x4'));var rimraf=require(_0x0f82('0x5'));var config=require(_0x0f82('0x6'));var attributes=require(_0x0f82('0x7'));module['exports']=function(_0x421fd8,_0xb84a96){return _0x421fd8['define'](_0x0f82('0x8'),attributes,{'tableName':_0x0f82('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa098=['../../config/environment','./chatQueue.attributes','ChatQueue','chat_queues','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x3d15db,_0x33bbf6){var _0x309078=function(_0x2c6aa9){while(--_0x2c6aa9){_0x3d15db['push'](_0x3d15db['shift']());}};_0x309078(++_0x33bbf6);}(_0xa098,0x100));var _0x8a09=function(_0x2c485c,_0x592e01){_0x2c485c=_0x2c485c-0x0;var _0x3cac6c=_0xa098[_0x2c485c];return _0x3cac6c;};'use strict';var _=require(_0x8a09('0x0'));var util=require(_0x8a09('0x1'));var logger=require(_0x8a09('0x2'))(_0x8a09('0x3'));var moment=require(_0x8a09('0x4'));var BPromise=require(_0x8a09('0x5'));var rp=require(_0x8a09('0x6'));var fs=require('fs');var path=require(_0x8a09('0x7'));var rimraf=require('rimraf');var config=require(_0x8a09('0x8'));var attributes=require(_0x8a09('0x9'));module['exports']=function(_0x4f0f59,_0xe328a7){return _0x4f0f59['define'](_0x8a09('0xa'),attributes,{'tableName':_0x8a09('0xb'),'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 04c8ca7..0842c47 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 _0xa7fa=['code','message','info','ChatQueue,\x20%s,\x20%s','catch','findAll','options','raw','where','attributes','limit','include','map','model','GetChatQueue','ShowChatQueue','ChatQueue','find','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','socket.io-emitter','./chatQueue.socket','register','request','then','request\x20sent','debug','ChatQueue,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x423e73,_0x499c66){var _0x5bed62=function(_0x5c43b0){while(--_0x5c43b0){_0x423e73['push'](_0x423e73['shift']());}};_0x5bed62(++_0x499c66);}(_0xa7fa,0xfc));var _0xaa7f=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xa7fa[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0xaa7f('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xaa7f('0x1'));var rs=require(_0xaa7f('0x2'));var fs=require('fs');var Redis=require(_0xaa7f('0x3'));var db=require(_0xaa7f('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xaa7f('0x5'))(_0xaa7f('0x6'));var config=require(_0xaa7f('0x7'));var jayson=require(_0xaa7f('0x8'));var client=jayson['client'][_0xaa7f('0x9')]({'port':0x232a});config['redis']=_['defaults'](config[_0xaa7f('0xa')],{'host':'localhost','port':0x18eb});var socket=require(_0xaa7f('0xb'))(new Redis(config[_0xaa7f('0xa')]));require(_0xaa7f('0xc'))[_0xaa7f('0xd')](socket);function respondWithRpcPromise(_0x5de597,_0x38c907,_0x3e7148){return new BPromise(function(_0x5692a7,_0x471fdc){return client[_0xaa7f('0xe')](_0x5de597,_0x3e7148)[_0xaa7f('0xf')](function(_0x17cd90){logger['info']('ChatQueue,\x20%s,\x20%s',_0x38c907,_0xaa7f('0x10'));logger[_0xaa7f('0x11')](_0xaa7f('0x12'),_0x38c907,_0xaa7f('0x10'),JSON[_0xaa7f('0x13')](_0x17cd90));if(_0x17cd90[_0xaa7f('0x14')]){if(_0x17cd90[_0xaa7f('0x14')][_0xaa7f('0x15')]===0x1f4){logger[_0xaa7f('0x14')]('ChatQueue,\x20%s,\x20%s',_0x38c907,_0x17cd90[_0xaa7f('0x14')]['message']);return _0x471fdc(_0x17cd90[_0xaa7f('0x14')][_0xaa7f('0x16')]);}logger[_0xaa7f('0x14')]('ChatQueue,\x20%s,\x20%s',_0x38c907,_0x17cd90[_0xaa7f('0x14')][_0xaa7f('0x16')]);return _0x5692a7(_0x17cd90[_0xaa7f('0x14')][_0xaa7f('0x16')]);}else{logger[_0xaa7f('0x17')](_0xaa7f('0x18'),_0x38c907,_0xaa7f('0x10'));_0x5692a7(_0x17cd90['result'][_0xaa7f('0x16')]);}})[_0xaa7f('0x19')](function(_0x132382){logger[_0xaa7f('0x14')]('ChatQueue,\x20%s,\x20%s',_0x38c907,_0x132382);_0x471fdc(_0x132382);});});}exports['GetChatQueue']=function(_0x182476){var _0x4cded6=this;return new Promise(function(_0x2a0980,_0x21e870){return db['ChatQueue'][_0xaa7f('0x1a')]({'raw':_0x182476['options']?_0x182476[_0xaa7f('0x1b')][_0xaa7f('0x1c')]===undefined?!![]:![]:!![],'where':_0x182476[_0xaa7f('0x1b')]?_0x182476['options'][_0xaa7f('0x1d')]||null:null,'attributes':_0x182476[_0xaa7f('0x1b')]?_0x182476[_0xaa7f('0x1b')][_0xaa7f('0x1e')]||null:null,'limit':_0x182476['options']?_0x182476['options'][_0xaa7f('0x1f')]||null:null,'include':_0x182476[_0xaa7f('0x1b')]?_0x182476[_0xaa7f('0x1b')][_0xaa7f('0x20')]?_[_0xaa7f('0x21')](_0x182476[_0xaa7f('0x1b')]['include'],function(_0x5442e2){return{'model':db[_0x5442e2['model']],'as':_0x5442e2['as'],'attributes':_0x5442e2[_0xaa7f('0x1e')],'include':_0x5442e2['include']?_[_0xaa7f('0x21')](_0x5442e2[_0xaa7f('0x20')],function(_0x4c79fa){return{'model':db[_0x4c79fa[_0xaa7f('0x22')]],'as':_0x4c79fa['as'],'attributes':_0x4c79fa['attributes'],'include':_0x4c79fa[_0xaa7f('0x20')]?_[_0xaa7f('0x21')](_0x4c79fa[_0xaa7f('0x20')],function(_0xfcf172){return{'model':db[_0xfcf172[_0xaa7f('0x22')]],'as':_0xfcf172['as'],'attributes':_0xfcf172['attributes']};}):[]};}):[]};}):[]:[]})[_0xaa7f('0xf')](function(_0x3e0223){logger[_0xaa7f('0x17')]('GetChatQueue',_0x182476);logger[_0xaa7f('0x11')](_0xaa7f('0x23'),_0x182476,JSON[_0xaa7f('0x13')](_0x3e0223));_0x2a0980(_0x3e0223);})[_0xaa7f('0x19')](function(_0x3ba5e5){logger[_0xaa7f('0x14')]('GetChatQueue',_0x3ba5e5[_0xaa7f('0x16')],_0x182476);_0x21e870(_0x4cded6[_0xaa7f('0x14')](0x1f4,_0x3ba5e5['message']));});});};exports[_0xaa7f('0x24')]=function(_0x1593cb){var _0x403ead=this;return new Promise(function(_0xcf8a2b,_0x182770){return db[_0xaa7f('0x25')][_0xaa7f('0x26')]({'raw':_0x1593cb[_0xaa7f('0x1b')]?_0x1593cb[_0xaa7f('0x1b')][_0xaa7f('0x1c')]===undefined?!![]:![]:!![],'where':_0x1593cb[_0xaa7f('0x1b')]?_0x1593cb[_0xaa7f('0x1b')][_0xaa7f('0x1d')]||null:null,'attributes':_0x1593cb[_0xaa7f('0x1b')]?_0x1593cb[_0xaa7f('0x1b')]['attributes']||null:null,'include':_0x1593cb[_0xaa7f('0x1b')]?_0x1593cb['options'][_0xaa7f('0x20')]?_[_0xaa7f('0x21')](_0x1593cb['options'][_0xaa7f('0x20')],function(_0x293407){return{'model':db[_0x293407['model']],'as':_0x293407['as'],'attributes':_0x293407[_0xaa7f('0x1e')],'include':_0x293407[_0xaa7f('0x20')]?_['map'](_0x293407['include'],function(_0x5ca758){return{'model':db[_0x5ca758[_0xaa7f('0x22')]],'as':_0x5ca758['as'],'attributes':_0x5ca758[_0xaa7f('0x1e')],'include':_0x5ca758[_0xaa7f('0x20')]?_[_0xaa7f('0x21')](_0x5ca758['include'],function(_0x56eab0){return{'model':db[_0x56eab0[_0xaa7f('0x22')]],'as':_0x56eab0['as'],'attributes':_0x56eab0[_0xaa7f('0x1e')]};}):[]};}):[]};}):[]:[]})[_0xaa7f('0xf')](function(_0x1fb281){logger[_0xaa7f('0x17')](_0xaa7f('0x24'),_0x1593cb);logger[_0xaa7f('0x11')]('ShowChatQueue',_0x1593cb,JSON[_0xaa7f('0x13')](_0x1fb281));_0xcf8a2b(_0x1fb281);})[_0xaa7f('0x19')](function(_0x349e02){logger[_0xaa7f('0x14')](_0xaa7f('0x24'),_0x349e02[_0xaa7f('0x16')],_0x1593cb);_0x182770(_0x403ead[_0xaa7f('0x14')](0x1f4,_0x349e02[_0xaa7f('0x16')]));});});}; \ No newline at end of file +var _0xd943=['include','map','model','GetChatQueue','ShowChatQueue','find','then','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','redis','localhost','./chatQueue.socket','register','request','info','ChatQueue,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','ChatQueue','options','raw','where','attributes','limit'];(function(_0x4ffe26,_0x3d0beb){var _0x144660=function(_0x2e6dfb){while(--_0x2e6dfb){_0x4ffe26['push'](_0x4ffe26['shift']());}};_0x144660(++_0x3d0beb);}(_0xd943,0x15d));var _0x3d94=function(_0x55dae9,_0x18a582){_0x55dae9=_0x55dae9-0x0;var _0x3cb19b=_0xd943[_0x55dae9];return _0x3cb19b;};'use strict';var _=require(_0x3d94('0x0'));var util=require(_0x3d94('0x1'));var moment=require(_0x3d94('0x2'));var BPromise=require(_0x3d94('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x3d94('0x4'));var db=require(_0x3d94('0x5'))['db'];var utils=require(_0x3d94('0x6'));var logger=require(_0x3d94('0x7'))(_0x3d94('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x3d94('0x9')]['http']({'port':0x232a});config['redis']=_['defaults'](config[_0x3d94('0xa')],{'host':_0x3d94('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x3d94('0xc'))[_0x3d94('0xd')](socket);function respondWithRpcPromise(_0x1cc58c,_0x5908a7,_0x182066){return new BPromise(function(_0x4ac968,_0x39e2fa){return client[_0x3d94('0xe')](_0x1cc58c,_0x182066)['then'](function(_0x1897de){logger[_0x3d94('0xf')](_0x3d94('0x10'),_0x5908a7,_0x3d94('0x11'));logger[_0x3d94('0x12')]('ChatQueue,\x20%s,\x20%s,\x20%s',_0x5908a7,_0x3d94('0x11'),JSON[_0x3d94('0x13')](_0x1897de));if(_0x1897de[_0x3d94('0x14')]){if(_0x1897de['error'][_0x3d94('0x15')]===0x1f4){logger[_0x3d94('0x14')](_0x3d94('0x10'),_0x5908a7,_0x1897de['error'][_0x3d94('0x16')]);return _0x39e2fa(_0x1897de[_0x3d94('0x14')][_0x3d94('0x16')]);}logger[_0x3d94('0x14')](_0x3d94('0x10'),_0x5908a7,_0x1897de[_0x3d94('0x14')][_0x3d94('0x16')]);return _0x4ac968(_0x1897de[_0x3d94('0x14')]['message']);}else{logger[_0x3d94('0xf')](_0x3d94('0x10'),_0x5908a7,_0x3d94('0x11'));_0x4ac968(_0x1897de[_0x3d94('0x17')][_0x3d94('0x16')]);}})[_0x3d94('0x18')](function(_0xef8b3){logger['error'](_0x3d94('0x10'),_0x5908a7,_0xef8b3);_0x39e2fa(_0xef8b3);});});}exports['GetChatQueue']=function(_0x28bead){var _0x193934=this;return new Promise(function(_0x16a6d0,_0x1e9ec2){return db[_0x3d94('0x19')]['findAll']({'raw':_0x28bead['options']?_0x28bead[_0x3d94('0x1a')][_0x3d94('0x1b')]===undefined?!![]:![]:!![],'where':_0x28bead[_0x3d94('0x1a')]?_0x28bead['options'][_0x3d94('0x1c')]||null:null,'attributes':_0x28bead[_0x3d94('0x1a')]?_0x28bead[_0x3d94('0x1a')][_0x3d94('0x1d')]||null:null,'limit':_0x28bead[_0x3d94('0x1a')]?_0x28bead[_0x3d94('0x1a')][_0x3d94('0x1e')]||null:null,'include':_0x28bead[_0x3d94('0x1a')]?_0x28bead[_0x3d94('0x1a')][_0x3d94('0x1f')]?_[_0x3d94('0x20')](_0x28bead[_0x3d94('0x1a')][_0x3d94('0x1f')],function(_0x3496c3){return{'model':db[_0x3496c3[_0x3d94('0x21')]],'as':_0x3496c3['as'],'attributes':_0x3496c3['attributes'],'include':_0x3496c3[_0x3d94('0x1f')]?_['map'](_0x3496c3[_0x3d94('0x1f')],function(_0x1d0a7a){return{'model':db[_0x1d0a7a[_0x3d94('0x21')]],'as':_0x1d0a7a['as'],'attributes':_0x1d0a7a[_0x3d94('0x1d')],'include':_0x1d0a7a[_0x3d94('0x1f')]?_[_0x3d94('0x20')](_0x1d0a7a[_0x3d94('0x1f')],function(_0x47d6ab){return{'model':db[_0x47d6ab['model']],'as':_0x47d6ab['as'],'attributes':_0x47d6ab[_0x3d94('0x1d')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x4dd410){logger[_0x3d94('0xf')]('GetChatQueue',_0x28bead);logger[_0x3d94('0x12')](_0x3d94('0x22'),_0x28bead,JSON[_0x3d94('0x13')](_0x4dd410));_0x16a6d0(_0x4dd410);})['catch'](function(_0x2a07b4){logger['error'](_0x3d94('0x22'),_0x2a07b4['message'],_0x28bead);_0x1e9ec2(_0x193934[_0x3d94('0x14')](0x1f4,_0x2a07b4[_0x3d94('0x16')]));});});};exports[_0x3d94('0x23')]=function(_0x246f88){var _0x50560c=this;return new Promise(function(_0x18f854,_0x51f634){return db[_0x3d94('0x19')][_0x3d94('0x24')]({'raw':_0x246f88['options']?_0x246f88['options'][_0x3d94('0x1b')]===undefined?!![]:![]:!![],'where':_0x246f88[_0x3d94('0x1a')]?_0x246f88[_0x3d94('0x1a')]['where']||null:null,'attributes':_0x246f88[_0x3d94('0x1a')]?_0x246f88[_0x3d94('0x1a')]['attributes']||null:null,'include':_0x246f88[_0x3d94('0x1a')]?_0x246f88[_0x3d94('0x1a')][_0x3d94('0x1f')]?_[_0x3d94('0x20')](_0x246f88[_0x3d94('0x1a')]['include'],function(_0xa43fc){return{'model':db[_0xa43fc[_0x3d94('0x21')]],'as':_0xa43fc['as'],'attributes':_0xa43fc[_0x3d94('0x1d')],'include':_0xa43fc[_0x3d94('0x1f')]?_[_0x3d94('0x20')](_0xa43fc[_0x3d94('0x1f')],function(_0x546658){return{'model':db[_0x546658['model']],'as':_0x546658['as'],'attributes':_0x546658[_0x3d94('0x1d')],'include':_0x546658[_0x3d94('0x1f')]?_[_0x3d94('0x20')](_0x546658[_0x3d94('0x1f')],function(_0x3bfc16){return{'model':db[_0x3bfc16[_0x3d94('0x21')]],'as':_0x3bfc16['as'],'attributes':_0x3bfc16[_0x3d94('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x3d94('0x25')](function(_0x2e7b97){logger[_0x3d94('0xf')]('ShowChatQueue',_0x246f88);logger[_0x3d94('0x12')](_0x3d94('0x23'),_0x246f88,JSON[_0x3d94('0x13')](_0x2e7b97));_0x18f854(_0x2e7b97);})[_0x3d94('0x18')](function(_0x525d90){logger[_0x3d94('0x14')](_0x3d94('0x23'),_0x525d90[_0x3d94('0x16')],_0x246f88);_0x51f634(_0x50560c[_0x3d94('0x14')](0x1f4,_0x525d90[_0x3d94('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.socket.js b/server/api/chatQueue/chatQueue.socket.js index a378b6c..7e62acc 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(_0x3d89ce,_0x5d5e4b){var _0x494a2e=function(_0x1222b8){while(--_0x1222b8){_0x3d89ce['push'](_0x3d89ce['shift']());}};_0x494a2e(++_0x5d5e4b);}(_0x5f2f,0x73));var _0xf5f2=function(_0x372b53,_0x376a30){_0x372b53=_0x372b53-0x0;var _0x10b540=_0x5f2f[_0x372b53];return _0x10b540;};'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 _0xbaf0=['removeListener','register','length','chatQueue:','save','remove','update'];(function(_0x5be216,_0x5a2010){var _0x189a77=function(_0x462d4d){while(--_0x462d4d){_0x5be216['push'](_0x5be216['shift']());}};_0x189a77(++_0x5a2010);}(_0xbaf0,0x12a));var _0x0baf=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0xbaf0[_0x432682];return _0x463d05;};'use strict';var ChatQueueEvents=require('./chatQueue.events');var events=[_0x0baf('0x0'),_0x0baf('0x1'),_0x0baf('0x2')];function createListener(_0x263f79,_0x1688bc){return function(_0x4d2e72){_0x1688bc['emit'](_0x263f79,_0x4d2e72);};}function removeListener(_0x232cc7,_0x1c383e){return function(){ChatQueueEvents[_0x0baf('0x3')](_0x232cc7,_0x1c383e);};}exports[_0x0baf('0x4')]=function(_0xe4c3c4){for(var _0x335e24=0x0,_0x1a10b1=events[_0x0baf('0x5')];_0x335e24<_0x1a10b1;_0x335e24++){var _0x1d0a0d=events[_0x335e24];var _0x5f5030=createListener(_0x0baf('0x6')+_0x1d0a0d,_0xe4c3c4);ChatQueueEvents['on'](_0x1d0a0d,_0x5f5030);}}; \ No newline at end of file diff --git a/server/api/chatQueue/index.js b/server/api/chatQueue/index.js index b81a1fc..7c77d38 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 _0xe417=['../../components/interaction/service','get','index','isAuthenticated','describe','show','/:id/members','getMembers','/:id/teams','getTeams','/:id/users','getAgents','post','addAgents','put','update','/:id','destroy','delete','removeTeams','removeAgents','exports','multer','util','path','connect-timeout','Router','../../components/auth/service'];(function(_0x1b349a,_0x22222c){var _0x5d1f7c=function(_0x368d7c){while(--_0x368d7c){_0x1b349a['push'](_0x1b349a['shift']());}};_0x5d1f7c(++_0x22222c);}(_0xe417,0x86));var _0x7e41=function(_0x2fbd0e,_0x3460a9){_0x2fbd0e=_0x2fbd0e-0x0;var _0x481c9f=_0xe417[_0x2fbd0e];return _0x481c9f;};'use strict';var multer=require(_0x7e41('0x0'));var util=require(_0x7e41('0x1'));var path=require(_0x7e41('0x2'));var timeout=require(_0x7e41('0x3'));var express=require('express');var router=express[_0x7e41('0x4')]();var auth=require(_0x7e41('0x5'));var interaction=require(_0x7e41('0x6'));var config=require('../../config/environment');var controller=require('./chatQueue.controller');router[_0x7e41('0x7')]('/',auth['isAuthenticated'](),controller[_0x7e41('0x8')]);router['get']('/describe',auth[_0x7e41('0x9')](),controller[_0x7e41('0xa')]);router[_0x7e41('0x7')]('/:id',auth[_0x7e41('0x9')](),controller[_0x7e41('0xb')]);router['get'](_0x7e41('0xc'),auth[_0x7e41('0x9')](),controller[_0x7e41('0xd')]);router['get'](_0x7e41('0xe'),auth['isAuthenticated'](),controller[_0x7e41('0xf')]);router[_0x7e41('0x7')](_0x7e41('0x10'),auth[_0x7e41('0x9')](),controller[_0x7e41('0x11')]);router[_0x7e41('0x12')]('/',auth['isAuthenticated'](),controller['create']);router[_0x7e41('0x12')]('/:id/teams',auth['isAuthenticated'](),controller['addTeams']);router[_0x7e41('0x12')]('/:id/users',auth['isAuthenticated'](),controller[_0x7e41('0x13')]);router[_0x7e41('0x14')]('/:id',auth[_0x7e41('0x9')](),controller[_0x7e41('0x15')]);router['delete'](_0x7e41('0x16'),auth[_0x7e41('0x9')](),controller[_0x7e41('0x17')]);router[_0x7e41('0x18')](_0x7e41('0xe'),auth[_0x7e41('0x9')](),controller[_0x7e41('0x19')]);router[_0x7e41('0x18')](_0x7e41('0x10'),auth[_0x7e41('0x9')](),controller[_0x7e41('0x1a')]);module[_0x7e41('0x1b')]=router; \ No newline at end of file +var _0x6a92=['/:id/teams','getTeams','/:id/users','getAgents','post','addTeams','addAgents','update','delete','removeTeams','removeAgents','exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','show','getMembers'];(function(_0x32e865,_0x317078){var _0x850461=function(_0x37417f){while(--_0x37417f){_0x32e865['push'](_0x32e865['shift']());}};_0x850461(++_0x317078);}(_0x6a92,0xec));var _0x26a9=function(_0x21a9d9,_0x4d5ac8){_0x21a9d9=_0x21a9d9-0x0;var _0x46adce=_0x6a92[_0x21a9d9];return _0x46adce;};'use strict';var multer=require('multer');var util=require(_0x26a9('0x0'));var path=require(_0x26a9('0x1'));var timeout=require(_0x26a9('0x2'));var express=require(_0x26a9('0x3'));var router=express[_0x26a9('0x4')]();var auth=require(_0x26a9('0x5'));var interaction=require(_0x26a9('0x6'));var config=require(_0x26a9('0x7'));var controller=require('./chatQueue.controller');router[_0x26a9('0x8')]('/',auth[_0x26a9('0x9')](),controller[_0x26a9('0xa')]);router[_0x26a9('0x8')](_0x26a9('0xb'),auth['isAuthenticated'](),controller[_0x26a9('0xc')]);router[_0x26a9('0x8')](_0x26a9('0xd'),auth[_0x26a9('0x9')](),controller[_0x26a9('0xe')]);router[_0x26a9('0x8')]('/:id/members',auth['isAuthenticated'](),controller[_0x26a9('0xf')]);router[_0x26a9('0x8')](_0x26a9('0x10'),auth[_0x26a9('0x9')](),controller[_0x26a9('0x11')]);router[_0x26a9('0x8')](_0x26a9('0x12'),auth[_0x26a9('0x9')](),controller[_0x26a9('0x13')]);router[_0x26a9('0x14')]('/',auth[_0x26a9('0x9')](),controller['create']);router[_0x26a9('0x14')](_0x26a9('0x10'),auth['isAuthenticated'](),controller[_0x26a9('0x15')]);router[_0x26a9('0x14')]('/:id/users',auth[_0x26a9('0x9')](),controller[_0x26a9('0x16')]);router['put'](_0x26a9('0xd'),auth[_0x26a9('0x9')](),controller[_0x26a9('0x17')]);router[_0x26a9('0x18')]('/:id',auth['isAuthenticated'](),controller['destroy']);router[_0x26a9('0x18')](_0x26a9('0x10'),auth[_0x26a9('0x9')](),controller[_0x26a9('0x19')]);router[_0x26a9('0x18')](_0x26a9('0x12'),auth['isAuthenticated'](),controller[_0x26a9('0x1a')]);module[_0x26a9('0x1b')]=router; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.attributes.js b/server/api/chatQueueReport/chatQueueReport.attributes.js index 272ffc2..ae4337e 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 _0xcded=['STRING','DATE','moment','exports'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xcded,0x92));var _0xdcde=function(_0x195577,_0x5de53a){_0x195577=_0x195577-0x0;var _0x13c367=_0xcded[_0x195577];return _0x13c367;};'use strict';var moment=require(_0xdcde('0x0'));var Sequelize=require('sequelize');module[_0xdcde('0x1')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize[_0xdcde('0x2')]},'joinAt':{'type':Sequelize[_0xdcde('0x3')]},'leaveAt':{'type':Sequelize[_0xdcde('0x3')]},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize['DATE']},'reason':{'type':Sequelize[_0xdcde('0x2')]}}; \ No newline at end of file +var _0x959a=['moment','sequelize','exports','STRING','DATE'];(function(_0x5227b5,_0x1a6609){var _0x4a481a=function(_0x115f77){while(--_0x115f77){_0x5227b5['push'](_0x5227b5['shift']());}};_0x4a481a(++_0x1a6609);}(_0x959a,0x122));var _0xa959=function(_0x465a0c,_0x19d4d5){_0x465a0c=_0x465a0c-0x0;var _0x1e202e=_0x959a[_0x465a0c];return _0x1e202e;};'use strict';var moment=require(_0xa959('0x0'));var Sequelize=require(_0xa959('0x1'));module[_0xa959('0x2')]={'uniqueid':{'type':Sequelize[_0xa959('0x3')],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0xa959('0x4')]},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0xa959('0x4')]},'reason':{'type':Sequelize[_0xa959('0x3')]}}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.controller.js b/server/api/chatQueueReport/chatQueueReport.controller.js index 7e6cfc0..dae009b 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(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0xb7e7,0x121));var _0x7b7e=function(_0x13d07a,_0x41efc3){_0x13d07a=_0x13d07a-0x0;var _0x5ee0ee=_0xb7e7[_0x13d07a];return _0x5ee0ee;};'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 _0xe706=['catch','create','body','destroy','describe','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../mysqldb','sendStatus','status','end','count','limit','set','Content-Range','apply','reject','save','update','then','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','offset','sort','where','pick','filter','merge','VIRTUAL','ChatQueueReport','include','findAll','rows','params','includeAll','options','find'];(function(_0x4e0118,_0x346ad5){var _0x5bce12=function(_0x437901){while(--_0x437901){_0x4e0118['push'](_0x4e0118['shift']());}};_0x5bce12(++_0x346ad5);}(_0xe706,0xa3));var _0x6e70=function(_0x42b3aa,_0x223f53){_0x42b3aa=_0x42b3aa-0x0;var _0x319157=_0xe706[_0x42b3aa];return _0x319157;};'use strict';var pdf=require(_0x6e70('0x0'));var emlformat=require(_0x6e70('0x1'));var rimraf=require(_0x6e70('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x6e70('0x3'));var rp=require(_0x6e70('0x4'));var moment=require(_0x6e70('0x5'));var BPromise=require(_0x6e70('0x6'));var Mustache=require(_0x6e70('0x7'));var util=require(_0x6e70('0x8'));var path=require(_0x6e70('0x9'));var sox=require(_0x6e70('0xa'));var csv=require(_0x6e70('0xb'));var ejs=require(_0x6e70('0xc'));var fs=require('fs');var _=require(_0x6e70('0xd'));var squel=require(_0x6e70('0xe'));var crypto=require(_0x6e70('0xf'));var jsforce=require(_0x6e70('0x10'));var deskjs=require(_0x6e70('0x11'));var toCsv=require(_0x6e70('0xb'));var querystring=require(_0x6e70('0x12'));var Papa=require(_0x6e70('0x13'));var Redis=require(_0x6e70('0x14'));var authService=require(_0x6e70('0x15'));var qs=require(_0x6e70('0x16'));var as=require(_0x6e70('0x17'));var hardwareService=require(_0x6e70('0x18'));var logger=require(_0x6e70('0x19'))('api');var utils=require('../../config/utils');var config=require(_0x6e70('0x1a'));var db=require(_0x6e70('0x1b'))['db'];function respondWithStatusCode(_0x18cf27,_0x27dd9b){_0x27dd9b=_0x27dd9b||0xcc;return function(_0x3b38f3){if(_0x3b38f3){return _0x18cf27[_0x6e70('0x1c')](_0x27dd9b);}return _0x18cf27[_0x6e70('0x1d')](_0x27dd9b)[_0x6e70('0x1e')]();};}function respondWithResult(_0x5dfbaa,_0x52737e){_0x52737e=_0x52737e||0xc8;return function(_0x48bc72){if(_0x48bc72){return _0x5dfbaa[_0x6e70('0x1d')](_0x52737e)['json'](_0x48bc72);}};}function respondWithFilteredResult(_0x53aed0,_0x304716){return function(_0x22c50c){if(_0x22c50c){var _0x5d9263=_0x22c50c[_0x6e70('0x1f')],_0x24f3ac=_0x304716['offset'],_0x5c3fe7=_0x304716['offset']+_0x304716[_0x6e70('0x20')],_0x2efc0f;if(_0x5c3fe7>=_0x5d9263){_0x5c3fe7=_0x5d9263;_0x2efc0f=0xc8;}else{_0x2efc0f=0xce;}_0x53aed0['status'](_0x2efc0f);return _0x53aed0[_0x6e70('0x21')](_0x6e70('0x22'),_0x24f3ac+'-'+_0x5c3fe7+'/'+_0x5d9263)['json'](_0x22c50c);}return null;};}function patchUpdates(_0x497d61){return function(_0xc238ba){try{jsonpatch[_0x6e70('0x23')](_0xc238ba,_0x497d61,!![]);}catch(_0x2368eb){return BPromise[_0x6e70('0x24')](_0x2368eb);}return _0xc238ba[_0x6e70('0x25')]();};}function saveUpdates(_0xcdf9f2,_0x1b2453){return function(_0x44a49f){if(_0x44a49f){return _0x44a49f[_0x6e70('0x26')](_0xcdf9f2)[_0x6e70('0x27')](function(_0x4a0cfe){return _0x4a0cfe;});}return null;};}function removeEntity(_0x228350,_0x344b65){return function(_0x27b294){if(_0x27b294){return _0x27b294['destroy']()[_0x6e70('0x27')](function(){_0x228350[_0x6e70('0x1d')](0xcc)[_0x6e70('0x1e')]();});}};}function handleEntityNotFound(_0x50da2c,_0x10fc91){return function(_0x538b9c){if(!_0x538b9c){_0x50da2c['sendStatus'](0x194);}return _0x538b9c;};}function handleError(_0x4e97c7,_0x41e352){_0x41e352=_0x41e352||0x1f4;return function(_0x19c5ae){logger['error'](_0x19c5ae[_0x6e70('0x28')]);if(_0x19c5ae[_0x6e70('0x29')]){delete _0x19c5ae['name'];}_0x4e97c7[_0x6e70('0x1d')](_0x41e352)[_0x6e70('0x2a')](_0x19c5ae);};}exports[_0x6e70('0x2b')]=function(_0x4a67ac,_0x54a5fe){var _0x2c4d37={},_0x3af17f={},_0x83c836={'count':0x0,'rows':[]};var _0x114344=_[_0x6e70('0x2c')](db['ChatQueueReport'][_0x6e70('0x2d')],function(_0x406f29){return{'name':_0x406f29[_0x6e70('0x2e')],'type':_0x406f29[_0x6e70('0x2f')][_0x6e70('0x30')]};});_0x3af17f[_0x6e70('0x31')]=_[_0x6e70('0x2c')](_0x114344,_0x6e70('0x29'));_0x3af17f[_0x6e70('0x32')]=_[_0x6e70('0x33')](_0x4a67ac['query']);_0x3af17f[_0x6e70('0x34')]=_['intersection'](_0x3af17f[_0x6e70('0x31')],_0x3af17f['query']);_0x2c4d37[_0x6e70('0x35')]=_[_0x6e70('0x36')](_0x3af17f[_0x6e70('0x31')],qs['fields'](_0x4a67ac[_0x6e70('0x32')][_0x6e70('0x37')]));_0x2c4d37['attributes']=_0x2c4d37[_0x6e70('0x35')][_0x6e70('0x38')]?_0x2c4d37['attributes']:_0x3af17f[_0x6e70('0x31')];if(!_0x4a67ac[_0x6e70('0x32')][_0x6e70('0x39')](_0x6e70('0x3a'))){_0x2c4d37[_0x6e70('0x20')]=qs[_0x6e70('0x20')](_0x4a67ac[_0x6e70('0x32')][_0x6e70('0x20')]);_0x2c4d37[_0x6e70('0x3b')]=qs[_0x6e70('0x3b')](_0x4a67ac['query'][_0x6e70('0x3b')]);}_0x2c4d37['order']=qs[_0x6e70('0x3c')](_0x4a67ac[_0x6e70('0x32')][_0x6e70('0x3c')]);_0x2c4d37[_0x6e70('0x3d')]=qs[_0x6e70('0x34')](_[_0x6e70('0x3e')](_0x4a67ac[_0x6e70('0x32')],_0x3af17f[_0x6e70('0x34')]),_0x114344);if(_0x4a67ac[_0x6e70('0x32')][_0x6e70('0x3f')]){_0x2c4d37[_0x6e70('0x3d')]=_[_0x6e70('0x40')](_0x2c4d37[_0x6e70('0x3d')],{'$or':_['map'](_0x114344,function(_0x5446a2){if(_0x5446a2['type']!==_0x6e70('0x41')){var _0x3841a0={};_0x3841a0[_0x5446a2[_0x6e70('0x29')]]={'$like':'%'+_0x4a67ac[_0x6e70('0x32')][_0x6e70('0x3f')]+'%'};return _0x3841a0;}})});}_0x2c4d37=_[_0x6e70('0x40')]({},_0x2c4d37,_0x4a67ac['options']);var _0x3b508c={'where':_0x2c4d37[_0x6e70('0x3d')]};return db[_0x6e70('0x42')][_0x6e70('0x1f')](_0x3b508c)[_0x6e70('0x27')](function(_0x37bf46){_0x83c836[_0x6e70('0x1f')]=_0x37bf46;if(_0x4a67ac[_0x6e70('0x32')]['includeAll']){_0x2c4d37[_0x6e70('0x43')]=[{'all':!![]}];}return db[_0x6e70('0x42')][_0x6e70('0x44')](_0x2c4d37);})[_0x6e70('0x27')](function(_0x201da9){_0x83c836[_0x6e70('0x45')]=_0x201da9;return _0x83c836;})[_0x6e70('0x27')](respondWithFilteredResult(_0x54a5fe,_0x2c4d37))['catch'](handleError(_0x54a5fe,null));};exports['show']=function(_0x5ae898,_0x154e0c){var _0x2b63cc={'raw':!![],'where':{'id':_0x5ae898[_0x6e70('0x46')]['id']}},_0x83847b={};_0x83847b[_0x6e70('0x31')]=_['keys'](db[_0x6e70('0x42')][_0x6e70('0x2d')]);_0x83847b[_0x6e70('0x32')]=_['keys'](_0x5ae898['query']);_0x83847b['filters']=_[_0x6e70('0x36')](_0x83847b['model'],_0x83847b[_0x6e70('0x32')]);_0x2b63cc[_0x6e70('0x35')]=_[_0x6e70('0x36')](_0x83847b[_0x6e70('0x31')],qs['fields'](_0x5ae898[_0x6e70('0x32')]['fields']));_0x2b63cc[_0x6e70('0x35')]=_0x2b63cc[_0x6e70('0x35')][_0x6e70('0x38')]?_0x2b63cc[_0x6e70('0x35')]:_0x83847b['model'];if(_0x5ae898[_0x6e70('0x32')][_0x6e70('0x47')]){_0x2b63cc[_0x6e70('0x43')]=[{'all':!![]}];}_0x2b63cc=_[_0x6e70('0x40')]({},_0x2b63cc,_0x5ae898[_0x6e70('0x48')]);return db[_0x6e70('0x42')][_0x6e70('0x49')](_0x2b63cc)['then'](handleEntityNotFound(_0x154e0c,null))[_0x6e70('0x27')](respondWithResult(_0x154e0c,null))[_0x6e70('0x4a')](handleError(_0x154e0c,null));};exports[_0x6e70('0x4b')]=function(_0x2f99cb,_0x3f86cf){return db[_0x6e70('0x42')][_0x6e70('0x4b')](_0x2f99cb['body'],{})[_0x6e70('0x27')](respondWithResult(_0x3f86cf,0xc9))['catch'](handleError(_0x3f86cf,null));};exports[_0x6e70('0x26')]=function(_0x3836e4,_0x4b351e){if(_0x3836e4['body']['id']){delete _0x3836e4[_0x6e70('0x4c')]['id'];}return db[_0x6e70('0x42')][_0x6e70('0x49')]({'where':{'id':_0x3836e4['params']['id']}})['then'](handleEntityNotFound(_0x4b351e,null))[_0x6e70('0x27')](saveUpdates(_0x3836e4[_0x6e70('0x4c')],null))[_0x6e70('0x27')](respondWithResult(_0x4b351e,null))[_0x6e70('0x4a')](handleError(_0x4b351e,null));};exports[_0x6e70('0x4d')]=function(_0x340674,_0x4ad5a9){return db[_0x6e70('0x42')][_0x6e70('0x49')]({'where':{'id':_0x340674[_0x6e70('0x46')]['id']}})[_0x6e70('0x27')](handleEntityNotFound(_0x4ad5a9,null))[_0x6e70('0x27')](removeEntity(_0x4ad5a9,null))['catch'](handleError(_0x4ad5a9,null));};exports['describe']=function(_0x2c5538,_0x2e3ea6){return db[_0x6e70('0x42')][_0x6e70('0x4e')]()[_0x6e70('0x27')](respondWithResult(_0x2e3ea6,null))['catch'](handleError(_0x2e3ea6,null));}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.model.js b/server/api/chatQueueReport/chatQueueReport.model.js index 3e2df0d..296b27e 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 _0x1c47=['ChatQueueReport','uniqueid','lodash','util','../../config/logger','moment','bluebird','path','../../config/environment','exports','define'];(function(_0x2e997e,_0x4edf31){var _0x5a6cb1=function(_0x3904da){while(--_0x3904da){_0x2e997e['push'](_0x2e997e['shift']());}};_0x5a6cb1(++_0x4edf31);}(_0x1c47,0x86));var _0x71c4=function(_0x163040,_0x38a58c){_0x163040=_0x163040-0x0;var _0x364667=_0x1c47[_0x163040];return _0x364667;};'use strict';var _=require(_0x71c4('0x0'));var util=require(_0x71c4('0x1'));var logger=require(_0x71c4('0x2'))('api');var moment=require(_0x71c4('0x3'));var BPromise=require(_0x71c4('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x71c4('0x5'));var rimraf=require('rimraf');var config=require(_0x71c4('0x6'));var attributes=require('./chatQueueReport.attributes');module[_0x71c4('0x7')]=function(_0x28c289,_0x1f067f){return _0x28c289[_0x71c4('0x8')](_0x71c4('0x9'),attributes,{'tableName':'report_chat_queue','paranoid':![],'indexes':[{'name':_0x71c4('0xa'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x5a3b=['path','../../config/environment','./chatQueueReport.attributes','exports','report_chat_queue','uniqueid','../../config/logger','api'];(function(_0x3d90b4,_0x1e2fc6){var _0x4c65d3=function(_0x311abc){while(--_0x311abc){_0x3d90b4['push'](_0x3d90b4['shift']());}};_0x4c65d3(++_0x1e2fc6);}(_0x5a3b,0x10e));var _0xb5a3=function(_0x28c47e,_0x305d64){_0x28c47e=_0x28c47e-0x0;var _0x4c9e16=_0x5a3b[_0x28c47e];return _0x4c9e16;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xb5a3('0x0'))(_0xb5a3('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xb5a3('0x2'));var rimraf=require('rimraf');var config=require(_0xb5a3('0x3'));var attributes=require(_0xb5a3('0x4'));module[_0xb5a3('0x5')]=function(_0x1eb40b,_0x30ab12){return _0x1eb40b['define']('ChatQueueReport',attributes,{'tableName':_0xb5a3('0x6'),'paranoid':![],'indexes':[{'name':_0xb5a3('0x7'),'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 bf4c02b..58c1378 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 _0x4b36=['../../config/utils','rpc','jayson/promise','http','request','then','info','ChatQueueReport,\x20%s,\x20%s','debug','request\x20sent','error','code','message','result','catch','CreateChatQueueReport','ChatQueueReport','create','options','raw','stringify','UpdateChatQueueReport','update','body','attributes','lodash','util','moment','randomstring','ioredis','../../mysqldb'];(function(_0x242849,_0x5e7b64){var _0x14aab6=function(_0x13fcfe){while(--_0x13fcfe){_0x242849['push'](_0x242849['shift']());}};_0x14aab6(++_0x5e7b64);}(_0x4b36,0xf2));var _0x64b3=function(_0xc4001c,_0x1bf8f0){_0xc4001c=_0xc4001c-0x0;var _0x49f7bc=_0x4b36[_0xc4001c];return _0x49f7bc;};'use strict';var _=require(_0x64b3('0x0'));var util=require(_0x64b3('0x1'));var moment=require(_0x64b3('0x2'));var BPromise=require('bluebird');var rs=require(_0x64b3('0x3'));var fs=require('fs');var Redis=require(_0x64b3('0x4'));var db=require(_0x64b3('0x5'))['db'];var utils=require(_0x64b3('0x6'));var logger=require('../../config/logger')(_0x64b3('0x7'));var config=require('../../config/environment');var jayson=require(_0x64b3('0x8'));var client=jayson['client'][_0x64b3('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x21a19a,_0xbf6a62,_0x4d2399){return new BPromise(function(_0x15f7f6,_0x440c08){return client[_0x64b3('0xa')](_0x21a19a,_0x4d2399)[_0x64b3('0xb')](function(_0xbbdd56){logger[_0x64b3('0xc')](_0x64b3('0xd'),_0xbf6a62,'request\x20sent');logger[_0x64b3('0xe')]('ChatQueueReport,\x20%s,\x20%s,\x20%s',_0xbf6a62,_0x64b3('0xf'),JSON['stringify'](_0xbbdd56));if(_0xbbdd56[_0x64b3('0x10')]){if(_0xbbdd56[_0x64b3('0x10')][_0x64b3('0x11')]===0x1f4){logger[_0x64b3('0x10')]('ChatQueueReport,\x20%s,\x20%s',_0xbf6a62,_0xbbdd56[_0x64b3('0x10')][_0x64b3('0x12')]);return _0x440c08(_0xbbdd56[_0x64b3('0x10')][_0x64b3('0x12')]);}logger[_0x64b3('0x10')]('ChatQueueReport,\x20%s,\x20%s',_0xbf6a62,_0xbbdd56['error'][_0x64b3('0x12')]);return _0x15f7f6(_0xbbdd56[_0x64b3('0x10')]['message']);}else{logger[_0x64b3('0xc')](_0x64b3('0xd'),_0xbf6a62,_0x64b3('0xf'));_0x15f7f6(_0xbbdd56[_0x64b3('0x13')][_0x64b3('0x12')]);}})[_0x64b3('0x14')](function(_0x2e0795){logger[_0x64b3('0x10')]('ChatQueueReport,\x20%s,\x20%s',_0xbf6a62,_0x2e0795);_0x440c08(_0x2e0795);});});}exports[_0x64b3('0x15')]=function(_0x485693){var _0x507a53=this;return new Promise(function(_0x1bb27f,_0x3f099c){return db[_0x64b3('0x16')][_0x64b3('0x17')](_0x485693['body'],{'raw':_0x485693[_0x64b3('0x18')]?_0x485693[_0x64b3('0x18')][_0x64b3('0x19')]===undefined?!![]:![]:!![]})[_0x64b3('0xb')](function(_0x17549a){logger[_0x64b3('0xc')](_0x64b3('0x15'),_0x485693);logger[_0x64b3('0xe')](_0x64b3('0x15'),_0x485693,JSON[_0x64b3('0x1a')](_0x17549a));_0x1bb27f(_0x17549a);})['catch'](function(_0x2505cb){logger[_0x64b3('0x10')]('CreateChatQueueReport',_0x2505cb[_0x64b3('0x12')],_0x485693);_0x3f099c(_0x507a53[_0x64b3('0x10')](0x1f4,_0x2505cb[_0x64b3('0x12')]));});});};exports[_0x64b3('0x1b')]=function(_0xf3a813){var _0x33b7c1=this;return new Promise(function(_0x561e7c,_0x2fe2db){return db[_0x64b3('0x16')][_0x64b3('0x1c')](_0xf3a813[_0x64b3('0x1d')],{'raw':_0xf3a813[_0x64b3('0x18')]?_0xf3a813[_0x64b3('0x18')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xf3a813['options']?_0xf3a813['options']['where']||null:null,'attributes':_0xf3a813[_0x64b3('0x18')]?_0xf3a813[_0x64b3('0x18')][_0x64b3('0x1e')]||null:null,'limit':_0xf3a813[_0x64b3('0x18')]?_0xf3a813['options']['limit']||null:null})['then'](function(_0x20c401){logger[_0x64b3('0xc')](_0x64b3('0x1b'),_0xf3a813);logger[_0x64b3('0xe')](_0x64b3('0x1b'),_0xf3a813,JSON[_0x64b3('0x1a')](_0x20c401));_0x561e7c(_0x20c401);})['catch'](function(_0x13d328){logger[_0x64b3('0x10')]('UpdateChatQueueReport',_0x13d328['message'],_0xf3a813);_0x2fe2db(_0x33b7c1[_0x64b3('0x10')](0x1f4,_0x13d328['message']));});});}; \ No newline at end of file +var _0x4ba4=['ChatQueueReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','ChatQueueReport,\x20%s,\x20%s','message','catch','CreateChatQueueReport','create','options','UpdateChatQueueReport','body','raw','limit','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','request','then','info','debug'];(function(_0x10ddd3,_0x1174a2){var _0x22d7d2=function(_0xcb8c85){while(--_0xcb8c85){_0x10ddd3['push'](_0x10ddd3['shift']());}};_0x22d7d2(++_0x1174a2);}(_0x4ba4,0x11c));var _0x44ba=function(_0x1ae636,_0x212002){_0x1ae636=_0x1ae636-0x0;var _0x4385ec=_0x4ba4[_0x1ae636];return _0x4385ec;};'use strict';var _=require(_0x44ba('0x0'));var util=require(_0x44ba('0x1'));var moment=require(_0x44ba('0x2'));var BPromise=require(_0x44ba('0x3'));var rs=require(_0x44ba('0x4'));var fs=require('fs');var Redis=require(_0x44ba('0x5'));var db=require(_0x44ba('0x6'))['db'];var utils=require(_0x44ba('0x7'));var logger=require(_0x44ba('0x8'))(_0x44ba('0x9'));var config=require(_0x44ba('0xa'));var jayson=require('jayson/promise');var client=jayson[_0x44ba('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x14b2c4,_0x5dfa51,_0x11ffd9){return new BPromise(function(_0x1c7b6a,_0xb278c){return client[_0x44ba('0xc')](_0x14b2c4,_0x11ffd9)[_0x44ba('0xd')](function(_0x3a309e){logger[_0x44ba('0xe')]('ChatQueueReport,\x20%s,\x20%s',_0x5dfa51,'request\x20sent');logger[_0x44ba('0xf')](_0x44ba('0x10'),_0x5dfa51,_0x44ba('0x11'),JSON[_0x44ba('0x12')](_0x3a309e));if(_0x3a309e[_0x44ba('0x13')]){if(_0x3a309e[_0x44ba('0x13')]['code']===0x1f4){logger[_0x44ba('0x13')](_0x44ba('0x14'),_0x5dfa51,_0x3a309e[_0x44ba('0x13')]['message']);return _0xb278c(_0x3a309e[_0x44ba('0x13')][_0x44ba('0x15')]);}logger['error']('ChatQueueReport,\x20%s,\x20%s',_0x5dfa51,_0x3a309e['error'][_0x44ba('0x15')]);return _0x1c7b6a(_0x3a309e[_0x44ba('0x13')]['message']);}else{logger['info']('ChatQueueReport,\x20%s,\x20%s',_0x5dfa51,_0x44ba('0x11'));_0x1c7b6a(_0x3a309e['result'][_0x44ba('0x15')]);}})[_0x44ba('0x16')](function(_0x34294f){logger[_0x44ba('0x13')](_0x44ba('0x14'),_0x5dfa51,_0x34294f);_0xb278c(_0x34294f);});});}exports[_0x44ba('0x17')]=function(_0x3b04a0){var _0xc5865e=this;return new Promise(function(_0x367992,_0x461d56){return db['ChatQueueReport'][_0x44ba('0x18')](_0x3b04a0['body'],{'raw':_0x3b04a0[_0x44ba('0x19')]?_0x3b04a0[_0x44ba('0x19')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x2feaaf){logger[_0x44ba('0xe')](_0x44ba('0x17'),_0x3b04a0);logger['debug'](_0x44ba('0x17'),_0x3b04a0,JSON['stringify'](_0x2feaaf));_0x367992(_0x2feaaf);})[_0x44ba('0x16')](function(_0x1ccbfb){logger[_0x44ba('0x13')](_0x44ba('0x17'),_0x1ccbfb[_0x44ba('0x15')],_0x3b04a0);_0x461d56(_0xc5865e[_0x44ba('0x13')](0x1f4,_0x1ccbfb['message']));});});};exports[_0x44ba('0x1a')]=function(_0x304535){var _0x1031b4=this;return new Promise(function(_0x23be78,_0x1ef65b){return db['ChatQueueReport']['update'](_0x304535[_0x44ba('0x1b')],{'raw':_0x304535[_0x44ba('0x19')]?_0x304535[_0x44ba('0x19')][_0x44ba('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x304535['options']?_0x304535[_0x44ba('0x19')]['where']||null:null,'attributes':_0x304535[_0x44ba('0x19')]?_0x304535[_0x44ba('0x19')]['attributes']||null:null,'limit':_0x304535['options']?_0x304535[_0x44ba('0x19')][_0x44ba('0x1d')]||null:null})[_0x44ba('0xd')](function(_0x2354fd){logger[_0x44ba('0xe')](_0x44ba('0x1a'),_0x304535);logger[_0x44ba('0xf')](_0x44ba('0x1a'),_0x304535,JSON[_0x44ba('0x12')](_0x2354fd));_0x23be78(_0x2354fd);})[_0x44ba('0x16')](function(_0x15a254){logger[_0x44ba('0x13')]('UpdateChatQueueReport',_0x15a254[_0x44ba('0x15')],_0x304535);_0x1ef65b(_0x1031b4[_0x44ba('0x13')](0x1f4,_0x15a254[_0x44ba('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/chatQueueReport/index.js b/server/api/chatQueueReport/index.js index 83221ca..c74e8dc 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 _0x1b78=['/describe','describe','/:id','show','post','put','update','destroy','exports','multer','path','connect-timeout','../../config/environment','get','isAuthenticated'];(function(_0x58ab22,_0x42c988){var _0x3bedba=function(_0x121f16){while(--_0x121f16){_0x58ab22['push'](_0x58ab22['shift']());}};_0x3bedba(++_0x42c988);}(_0x1b78,0x108));var _0x81b7=function(_0x423a79,_0x41b567){_0x423a79=_0x423a79-0x0;var _0x172e87=_0x1b78[_0x423a79];return _0x172e87;};'use strict';var multer=require(_0x81b7('0x0'));var util=require('util');var path=require(_0x81b7('0x1'));var timeout=require(_0x81b7('0x2'));var express=require('express');var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x81b7('0x3'));var controller=require('./chatQueueReport.controller');router[_0x81b7('0x4')]('/',auth[_0x81b7('0x5')](),controller['index']);router[_0x81b7('0x4')](_0x81b7('0x6'),auth[_0x81b7('0x5')](),controller[_0x81b7('0x7')]);router['get'](_0x81b7('0x8'),auth[_0x81b7('0x5')](),controller[_0x81b7('0x9')]);router[_0x81b7('0xa')]('/',auth[_0x81b7('0x5')](),controller['create']);router[_0x81b7('0xb')]('/:id',auth['isAuthenticated'](),controller[_0x81b7('0xc')]);router['delete'](_0x81b7('0x8'),auth[_0x81b7('0x5')](),controller[_0x81b7('0xd')]);module[_0x81b7('0xe')]=router; \ No newline at end of file +var _0x754a=['exports','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatQueueReport.controller','isAuthenticated','index','get','/describe','describe','/:id','show','post','put','update','delete'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x754a,0x12d));var _0xa754=function(_0x45e98e,_0x169b60){_0x45e98e=_0x45e98e-0x0;var _0x374dba=_0x754a[_0x45e98e];return _0x374dba;};'use strict';var multer=require('multer');var util=require(_0xa754('0x0'));var path=require(_0xa754('0x1'));var timeout=require('connect-timeout');var express=require(_0xa754('0x2'));var router=express[_0xa754('0x3')]();var auth=require(_0xa754('0x4'));var interaction=require(_0xa754('0x5'));var config=require(_0xa754('0x6'));var controller=require(_0xa754('0x7'));router['get']('/',auth[_0xa754('0x8')](),controller[_0xa754('0x9')]);router[_0xa754('0xa')](_0xa754('0xb'),auth[_0xa754('0x8')](),controller[_0xa754('0xc')]);router[_0xa754('0xa')](_0xa754('0xd'),auth[_0xa754('0x8')](),controller[_0xa754('0xe')]);router[_0xa754('0xf')]('/',auth['isAuthenticated'](),controller['create']);router[_0xa754('0x10')]('/:id',auth[_0xa754('0x8')](),controller[_0xa754('0x11')]);router[_0xa754('0x12')](_0xa754('0xd'),auth[_0xa754('0x8')](),controller['destroy']);module[_0xa754('0x13')]=router; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.attributes.js b/server/api/chatTransferReport/chatTransferReport.attributes.js index b81df54..9cefa9e 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 _0x6b53=['agent','DATE','NOW','ENUM','account'];(function(_0x2b1bb9,_0x3f85cc){var _0x59f401=function(_0x14ac15){while(--_0x14ac15){_0x2b1bb9['push'](_0x2b1bb9['shift']());}};_0x59f401(++_0x3f85cc);}(_0x6b53,0x120));var _0x36b5=function(_0x5b9f30,_0x196843){_0x5b9f30=_0x5b9f30-0x0;var _0x30fd79=_0x6b53[_0x5b9f30];return _0x30fd79;};'use strict';var moment=require('moment');var Sequelize=require('sequelize');module['exports']={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0x36b5('0x0')](_0x36b5('0x1'),_0x36b5('0x2'),'queue'),'allowNull':![],'defaultValue':'queue'},'transferredAt':{'type':Sequelize[_0x36b5('0x3')],'allowNull':![],'defaultValue':Sequelize[_0x36b5('0x4')]}}; \ No newline at end of file +var _0x90f7=['exports','STRING','ENUM','account','agent','queue','DATE','NOW','moment','sequelize'];(function(_0x36c198,_0x1a9ec1){var _0x24d3ac=function(_0x4fb024){while(--_0x4fb024){_0x36c198['push'](_0x36c198['shift']());}};_0x24d3ac(++_0x1a9ec1);}(_0x90f7,0x1ca));var _0x790f=function(_0xd9c529,_0x19f8cc){_0xd9c529=_0xd9c529-0x0;var _0x146760=_0x90f7[_0xd9c529];return _0x146760;};'use strict';var moment=require(_0x790f('0x0'));var Sequelize=require(_0x790f('0x1'));module[_0x790f('0x2')]={'uniqueid':{'type':Sequelize[_0x790f('0x3')],'allowNull':![]},'type':{'type':Sequelize[_0x790f('0x4')](_0x790f('0x5'),_0x790f('0x6'),_0x790f('0x7')),'allowNull':![],'defaultValue':_0x790f('0x7')},'transferredAt':{'type':Sequelize[_0x790f('0x8')],'allowNull':![],'defaultValue':Sequelize[_0x790f('0x9')]}}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.controller.js b/server/api/chatTransferReport/chatTransferReport.controller.js index e2343f2..ce81bac 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 _0x9c6d=['create','body','find','describe','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','ejs','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','set','Content-Range','apply','reject','update','then','destroy','stack','name','send','ChatTransferReport','fieldName','type','model','map','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','merge','VIRTUAL','options','include','findAll','rows','catch','show','params','keys','rawAttributes','length','includeAll'];(function(_0x2c2aaa,_0x27673e){var _0x43f6fa=function(_0x59c73f){while(--_0x59c73f){_0x2c2aaa['push'](_0x2c2aaa['shift']());}};_0x43f6fa(++_0x27673e);}(_0x9c6d,0xe5));var _0xd9c6=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x9c6d[_0x3dd15e];return _0x231fd0;};'use strict';var pdf=require(_0xd9c6('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xd9c6('0x1'));var zipdir=require(_0xd9c6('0x2'));var jsonpatch=require(_0xd9c6('0x3'));var rp=require(_0xd9c6('0x4'));var moment=require(_0xd9c6('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xd9c6('0x6'));var util=require(_0xd9c6('0x7'));var path=require('path');var sox=require(_0xd9c6('0x8'));var csv=require(_0xd9c6('0x9'));var ejs=require(_0xd9c6('0xa'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xd9c6('0xb'));var deskjs=require(_0xd9c6('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xd9c6('0xd'));var Redis=require(_0xd9c6('0xe'));var authService=require(_0xd9c6('0xf'));var qs=require(_0xd9c6('0x10'));var as=require(_0xd9c6('0x11'));var hardwareService=require(_0xd9c6('0x12'));var logger=require(_0xd9c6('0x13'))(_0xd9c6('0x14'));var utils=require(_0xd9c6('0x15'));var config=require(_0xd9c6('0x16'));var db=require(_0xd9c6('0x17'))['db'];function respondWithStatusCode(_0xd9ce6c,_0x51ac9b){_0x51ac9b=_0x51ac9b||0xcc;return function(_0xd45301){if(_0xd45301){return _0xd9ce6c[_0xd9c6('0x18')](_0x51ac9b);}return _0xd9ce6c[_0xd9c6('0x19')](_0x51ac9b)[_0xd9c6('0x1a')]();};}function respondWithResult(_0x2f4fb9,_0x3fa118){_0x3fa118=_0x3fa118||0xc8;return function(_0x5d986a){if(_0x5d986a){return _0x2f4fb9[_0xd9c6('0x19')](_0x3fa118)[_0xd9c6('0x1b')](_0x5d986a);}};}function respondWithFilteredResult(_0x44766d,_0x1165f9){return function(_0x56fb44){if(_0x56fb44){var _0x4904c1=_0x56fb44[_0xd9c6('0x1c')],_0xc62365=_0x1165f9['offset'],_0x149537=_0x1165f9[_0xd9c6('0x1d')]+_0x1165f9['limit'],_0x2f6c21;if(_0x149537>=_0x4904c1){_0x149537=_0x4904c1;_0x2f6c21=0xc8;}else{_0x2f6c21=0xce;}_0x44766d['status'](_0x2f6c21);return _0x44766d[_0xd9c6('0x1e')](_0xd9c6('0x1f'),_0xc62365+'-'+_0x149537+'/'+_0x4904c1)[_0xd9c6('0x1b')](_0x56fb44);}return null;};}function patchUpdates(_0x441fe8){return function(_0x5948a1){try{jsonpatch[_0xd9c6('0x20')](_0x5948a1,_0x441fe8,!![]);}catch(_0x9fc293){return BPromise[_0xd9c6('0x21')](_0x9fc293);}return _0x5948a1['save']();};}function saveUpdates(_0x43cd09,_0x4e3dcf){return function(_0x3f24e2){if(_0x3f24e2){return _0x3f24e2[_0xd9c6('0x22')](_0x43cd09)[_0xd9c6('0x23')](function(_0x20f887){return _0x20f887;});}return null;};}function removeEntity(_0x4234fe,_0x4e47ee){return function(_0x1f57d0){if(_0x1f57d0){return _0x1f57d0[_0xd9c6('0x24')]()['then'](function(){_0x4234fe[_0xd9c6('0x19')](0xcc)[_0xd9c6('0x1a')]();});}};}function handleEntityNotFound(_0x43cdce,_0x284274){return function(_0x953469){if(!_0x953469){_0x43cdce[_0xd9c6('0x18')](0x194);}return _0x953469;};}function handleError(_0x3c0bb1,_0x5dee27){_0x5dee27=_0x5dee27||0x1f4;return function(_0x5e093f){logger['error'](_0x5e093f[_0xd9c6('0x25')]);if(_0x5e093f[_0xd9c6('0x26')]){delete _0x5e093f['name'];}_0x3c0bb1[_0xd9c6('0x19')](_0x5dee27)[_0xd9c6('0x27')](_0x5e093f);};}exports['index']=function(_0x5d702a,_0x5acb07){var _0x2272df={},_0x36239e={},_0x1cdcd8={'count':0x0,'rows':[]};var _0x10ec78=_['map'](db[_0xd9c6('0x28')]['rawAttributes'],function(_0xec1667){return{'name':_0xec1667[_0xd9c6('0x29')],'type':_0xec1667[_0xd9c6('0x2a')]['key']};});_0x36239e[_0xd9c6('0x2b')]=_[_0xd9c6('0x2c')](_0x10ec78,_0xd9c6('0x26'));_0x36239e[_0xd9c6('0x2d')]=_['keys'](_0x5d702a[_0xd9c6('0x2d')]);_0x36239e[_0xd9c6('0x2e')]=_[_0xd9c6('0x2f')](_0x36239e[_0xd9c6('0x2b')],_0x36239e[_0xd9c6('0x2d')]);_0x2272df[_0xd9c6('0x30')]=_['intersection'](_0x36239e[_0xd9c6('0x2b')],qs[_0xd9c6('0x31')](_0x5d702a[_0xd9c6('0x2d')]['fields']));_0x2272df[_0xd9c6('0x30')]=_0x2272df['attributes']['length']?_0x2272df['attributes']:_0x36239e[_0xd9c6('0x2b')];if(!_0x5d702a[_0xd9c6('0x2d')][_0xd9c6('0x32')](_0xd9c6('0x33'))){_0x2272df[_0xd9c6('0x34')]=qs['limit'](_0x5d702a[_0xd9c6('0x2d')][_0xd9c6('0x34')]);_0x2272df[_0xd9c6('0x1d')]=qs[_0xd9c6('0x1d')](_0x5d702a[_0xd9c6('0x2d')][_0xd9c6('0x1d')]);}_0x2272df[_0xd9c6('0x35')]=qs[_0xd9c6('0x36')](_0x5d702a[_0xd9c6('0x2d')][_0xd9c6('0x36')]);_0x2272df[_0xd9c6('0x37')]=qs[_0xd9c6('0x2e')](_[_0xd9c6('0x38')](_0x5d702a['query'],_0x36239e[_0xd9c6('0x2e')]),_0x10ec78);if(_0x5d702a['query'][_0xd9c6('0x39')]){_0x2272df[_0xd9c6('0x37')]=_[_0xd9c6('0x3a')](_0x2272df[_0xd9c6('0x37')],{'$or':_[_0xd9c6('0x2c')](_0x10ec78,function(_0xfbf116){if(_0xfbf116[_0xd9c6('0x2a')]!==_0xd9c6('0x3b')){var _0x389924={};_0x389924[_0xfbf116[_0xd9c6('0x26')]]={'$like':'%'+_0x5d702a['query'][_0xd9c6('0x39')]+'%'};return _0x389924;}})});}_0x2272df=_[_0xd9c6('0x3a')]({},_0x2272df,_0x5d702a[_0xd9c6('0x3c')]);var _0x84ee7e={'where':_0x2272df[_0xd9c6('0x37')]};return db[_0xd9c6('0x28')]['count'](_0x84ee7e)[_0xd9c6('0x23')](function(_0x324433){_0x1cdcd8[_0xd9c6('0x1c')]=_0x324433;if(_0x5d702a[_0xd9c6('0x2d')]['includeAll']){_0x2272df[_0xd9c6('0x3d')]=[{'all':!![]}];}return db[_0xd9c6('0x28')][_0xd9c6('0x3e')](_0x2272df);})[_0xd9c6('0x23')](function(_0x3389d2){_0x1cdcd8[_0xd9c6('0x3f')]=_0x3389d2;return _0x1cdcd8;})[_0xd9c6('0x23')](respondWithFilteredResult(_0x5acb07,_0x2272df))[_0xd9c6('0x40')](handleError(_0x5acb07,null));};exports[_0xd9c6('0x41')]=function(_0x571a13,_0x5254e1){var _0x1dbf6b={'raw':!![],'where':{'id':_0x571a13[_0xd9c6('0x42')]['id']}},_0x1c837f={};_0x1c837f['model']=_[_0xd9c6('0x43')](db[_0xd9c6('0x28')][_0xd9c6('0x44')]);_0x1c837f[_0xd9c6('0x2d')]=_[_0xd9c6('0x43')](_0x571a13['query']);_0x1c837f[_0xd9c6('0x2e')]=_[_0xd9c6('0x2f')](_0x1c837f[_0xd9c6('0x2b')],_0x1c837f[_0xd9c6('0x2d')]);_0x1dbf6b[_0xd9c6('0x30')]=_[_0xd9c6('0x2f')](_0x1c837f[_0xd9c6('0x2b')],qs['fields'](_0x571a13[_0xd9c6('0x2d')][_0xd9c6('0x31')]));_0x1dbf6b['attributes']=_0x1dbf6b[_0xd9c6('0x30')][_0xd9c6('0x45')]?_0x1dbf6b[_0xd9c6('0x30')]:_0x1c837f['model'];if(_0x571a13['query'][_0xd9c6('0x46')]){_0x1dbf6b[_0xd9c6('0x3d')]=[{'all':!![]}];}_0x1dbf6b=_[_0xd9c6('0x3a')]({},_0x1dbf6b,_0x571a13[_0xd9c6('0x3c')]);return db[_0xd9c6('0x28')]['find'](_0x1dbf6b)[_0xd9c6('0x23')](handleEntityNotFound(_0x5254e1,null))[_0xd9c6('0x23')](respondWithResult(_0x5254e1,null))[_0xd9c6('0x40')](handleError(_0x5254e1,null));};exports[_0xd9c6('0x47')]=function(_0x2b50db,_0x4d3fd0){return db['ChatTransferReport'][_0xd9c6('0x47')](_0x2b50db[_0xd9c6('0x48')],{})['then'](respondWithResult(_0x4d3fd0,0xc9))[_0xd9c6('0x40')](handleError(_0x4d3fd0,null));};exports[_0xd9c6('0x22')]=function(_0x4f4b2d,_0x1a6c18){if(_0x4f4b2d['body']['id']){delete _0x4f4b2d[_0xd9c6('0x48')]['id'];}return db[_0xd9c6('0x28')][_0xd9c6('0x49')]({'where':{'id':_0x4f4b2d[_0xd9c6('0x42')]['id']}})['then'](handleEntityNotFound(_0x1a6c18,null))[_0xd9c6('0x23')](saveUpdates(_0x4f4b2d[_0xd9c6('0x48')],null))[_0xd9c6('0x23')](respondWithResult(_0x1a6c18,null))[_0xd9c6('0x40')](handleError(_0x1a6c18,null));};exports[_0xd9c6('0x24')]=function(_0x4565a9,_0x2eb3fa){return db['ChatTransferReport'][_0xd9c6('0x49')]({'where':{'id':_0x4565a9['params']['id']}})['then'](handleEntityNotFound(_0x2eb3fa,null))['then'](removeEntity(_0x2eb3fa,null))[_0xd9c6('0x40')](handleError(_0x2eb3fa,null));};exports['describe']=function(_0x41c0b3,_0xb9e07d){return db['ChatTransferReport'][_0xd9c6('0x4a')]()[_0xd9c6('0x23')](respondWithResult(_0xb9e07d,null))[_0xd9c6('0x40')](handleError(_0xb9e07d,null));}; \ No newline at end of file +var _0xadbe=['apply','reject','save','update','then','error','stack','name','send','index','map','ChatTransferReport','rawAttributes','type','key','model','query','keys','intersection','attributes','fields','length','order','sort','filters','merge','where','VIRTUAL','filter','options','includeAll','findAll','rows','show','params','find','create','body','catch','destroy','describe','html-pdf','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','Content-Range'];(function(_0x15d668,_0x322ee5){var _0x595232=function(_0x3ef2e8){while(--_0x3ef2e8){_0x15d668['push'](_0x15d668['shift']());}};_0x595232(++_0x322ee5);}(_0xadbe,0x75));var _0xeadb=function(_0x57e532,_0x67bf3c){_0x57e532=_0x57e532-0x0;var _0x48bad3=_0xadbe[_0x57e532];return _0x48bad3;};'use strict';var pdf=require(_0xeadb('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xeadb('0x1'));var zipdir=require(_0xeadb('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xeadb('0x3'));var moment=require(_0xeadb('0x4'));var BPromise=require(_0xeadb('0x5'));var Mustache=require(_0xeadb('0x6'));var util=require(_0xeadb('0x7'));var path=require(_0xeadb('0x8'));var sox=require(_0xeadb('0x9'));var csv=require(_0xeadb('0xa'));var ejs=require(_0xeadb('0xb'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0xeadb('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xeadb('0xd'));var toCsv=require('to-csv');var querystring=require(_0xeadb('0xe'));var Papa=require(_0xeadb('0xf'));var Redis=require(_0xeadb('0x10'));var authService=require(_0xeadb('0x11'));var qs=require(_0xeadb('0x12'));var as=require(_0xeadb('0x13'));var hardwareService=require(_0xeadb('0x14'));var logger=require(_0xeadb('0x15'))(_0xeadb('0x16'));var utils=require(_0xeadb('0x17'));var config=require(_0xeadb('0x18'));var db=require(_0xeadb('0x19'))['db'];function respondWithStatusCode(_0x566854,_0x4773af){_0x4773af=_0x4773af||0xcc;return function(_0x4c41cb){if(_0x4c41cb){return _0x566854[_0xeadb('0x1a')](_0x4773af);}return _0x566854[_0xeadb('0x1b')](_0x4773af)[_0xeadb('0x1c')]();};}function respondWithResult(_0x26914c,_0x39d0a0){_0x39d0a0=_0x39d0a0||0xc8;return function(_0xbf88b1){if(_0xbf88b1){return _0x26914c[_0xeadb('0x1b')](_0x39d0a0)[_0xeadb('0x1d')](_0xbf88b1);}};}function respondWithFilteredResult(_0x39bbe6,_0x390911){return function(_0x337573){if(_0x337573){var _0x453002=_0x337573[_0xeadb('0x1e')],_0x5551d5=_0x390911[_0xeadb('0x1f')],_0x5395f5=_0x390911[_0xeadb('0x1f')]+_0x390911[_0xeadb('0x20')],_0x4077f7;if(_0x5395f5>=_0x453002){_0x5395f5=_0x453002;_0x4077f7=0xc8;}else{_0x4077f7=0xce;}_0x39bbe6[_0xeadb('0x1b')](_0x4077f7);return _0x39bbe6[_0xeadb('0x21')](_0xeadb('0x22'),_0x5551d5+'-'+_0x5395f5+'/'+_0x453002)[_0xeadb('0x1d')](_0x337573);}return null;};}function patchUpdates(_0x9c076e){return function(_0x18cee3){try{jsonpatch[_0xeadb('0x23')](_0x18cee3,_0x9c076e,!![]);}catch(_0xbde056){return BPromise[_0xeadb('0x24')](_0xbde056);}return _0x18cee3[_0xeadb('0x25')]();};}function saveUpdates(_0x2a1650,_0x21ae8c){return function(_0xa4c071){if(_0xa4c071){return _0xa4c071[_0xeadb('0x26')](_0x2a1650)[_0xeadb('0x27')](function(_0x18da48){return _0x18da48;});}return null;};}function removeEntity(_0x314115,_0x287029){return function(_0x4b62e3){if(_0x4b62e3){return _0x4b62e3['destroy']()[_0xeadb('0x27')](function(){_0x314115['status'](0xcc)[_0xeadb('0x1c')]();});}};}function handleEntityNotFound(_0x18c462,_0x4d5de9){return function(_0x9a8310){if(!_0x9a8310){_0x18c462[_0xeadb('0x1a')](0x194);}return _0x9a8310;};}function handleError(_0x28b18b,_0x2f6137){_0x2f6137=_0x2f6137||0x1f4;return function(_0x2849a3){logger[_0xeadb('0x28')](_0x2849a3[_0xeadb('0x29')]);if(_0x2849a3[_0xeadb('0x2a')]){delete _0x2849a3['name'];}_0x28b18b[_0xeadb('0x1b')](_0x2f6137)[_0xeadb('0x2b')](_0x2849a3);};}exports[_0xeadb('0x2c')]=function(_0x4862f1,_0x4bb347){var _0x1d2dc7={},_0xb9f8c9={},_0xd917f5={'count':0x0,'rows':[]};var _0x2ee3a2=_[_0xeadb('0x2d')](db[_0xeadb('0x2e')][_0xeadb('0x2f')],function(_0x44cae1){return{'name':_0x44cae1['fieldName'],'type':_0x44cae1[_0xeadb('0x30')][_0xeadb('0x31')]};});_0xb9f8c9[_0xeadb('0x32')]=_[_0xeadb('0x2d')](_0x2ee3a2,_0xeadb('0x2a'));_0xb9f8c9[_0xeadb('0x33')]=_[_0xeadb('0x34')](_0x4862f1[_0xeadb('0x33')]);_0xb9f8c9['filters']=_[_0xeadb('0x35')](_0xb9f8c9[_0xeadb('0x32')],_0xb9f8c9[_0xeadb('0x33')]);_0x1d2dc7[_0xeadb('0x36')]=_['intersection'](_0xb9f8c9[_0xeadb('0x32')],qs[_0xeadb('0x37')](_0x4862f1['query'][_0xeadb('0x37')]));_0x1d2dc7[_0xeadb('0x36')]=_0x1d2dc7[_0xeadb('0x36')][_0xeadb('0x38')]?_0x1d2dc7[_0xeadb('0x36')]:_0xb9f8c9[_0xeadb('0x32')];if(!_0x4862f1[_0xeadb('0x33')]['hasOwnProperty']('nolimit')){_0x1d2dc7['limit']=qs[_0xeadb('0x20')](_0x4862f1['query']['limit']);_0x1d2dc7[_0xeadb('0x1f')]=qs[_0xeadb('0x1f')](_0x4862f1['query'][_0xeadb('0x1f')]);}_0x1d2dc7[_0xeadb('0x39')]=qs['sort'](_0x4862f1['query'][_0xeadb('0x3a')]);_0x1d2dc7['where']=qs[_0xeadb('0x3b')](_['pick'](_0x4862f1['query'],_0xb9f8c9[_0xeadb('0x3b')]),_0x2ee3a2);if(_0x4862f1[_0xeadb('0x33')]['filter']){_0x1d2dc7['where']=_[_0xeadb('0x3c')](_0x1d2dc7[_0xeadb('0x3d')],{'$or':_[_0xeadb('0x2d')](_0x2ee3a2,function(_0x53ac18){if(_0x53ac18[_0xeadb('0x30')]!==_0xeadb('0x3e')){var _0x2c1d6c={};_0x2c1d6c[_0x53ac18['name']]={'$like':'%'+_0x4862f1['query'][_0xeadb('0x3f')]+'%'};return _0x2c1d6c;}})});}_0x1d2dc7=_[_0xeadb('0x3c')]({},_0x1d2dc7,_0x4862f1[_0xeadb('0x40')]);var _0x2a26ba={'where':_0x1d2dc7[_0xeadb('0x3d')]};return db[_0xeadb('0x2e')]['count'](_0x2a26ba)[_0xeadb('0x27')](function(_0x3dc278){_0xd917f5[_0xeadb('0x1e')]=_0x3dc278;if(_0x4862f1['query'][_0xeadb('0x41')]){_0x1d2dc7['include']=[{'all':!![]}];}return db['ChatTransferReport'][_0xeadb('0x42')](_0x1d2dc7);})[_0xeadb('0x27')](function(_0x2868ed){_0xd917f5[_0xeadb('0x43')]=_0x2868ed;return _0xd917f5;})['then'](respondWithFilteredResult(_0x4bb347,_0x1d2dc7))['catch'](handleError(_0x4bb347,null));};exports[_0xeadb('0x44')]=function(_0x1eba3c,_0x226b94){var _0x15cea8={'raw':!![],'where':{'id':_0x1eba3c[_0xeadb('0x45')]['id']}},_0x172bc2={};_0x172bc2['model']=_[_0xeadb('0x34')](db[_0xeadb('0x2e')][_0xeadb('0x2f')]);_0x172bc2[_0xeadb('0x33')]=_['keys'](_0x1eba3c[_0xeadb('0x33')]);_0x172bc2[_0xeadb('0x3b')]=_['intersection'](_0x172bc2[_0xeadb('0x32')],_0x172bc2[_0xeadb('0x33')]);_0x15cea8[_0xeadb('0x36')]=_[_0xeadb('0x35')](_0x172bc2[_0xeadb('0x32')],qs[_0xeadb('0x37')](_0x1eba3c[_0xeadb('0x33')][_0xeadb('0x37')]));_0x15cea8['attributes']=_0x15cea8[_0xeadb('0x36')]['length']?_0x15cea8[_0xeadb('0x36')]:_0x172bc2[_0xeadb('0x32')];if(_0x1eba3c['query'][_0xeadb('0x41')]){_0x15cea8['include']=[{'all':!![]}];}_0x15cea8=_[_0xeadb('0x3c')]({},_0x15cea8,_0x1eba3c[_0xeadb('0x40')]);return db[_0xeadb('0x2e')][_0xeadb('0x46')](_0x15cea8)[_0xeadb('0x27')](handleEntityNotFound(_0x226b94,null))[_0xeadb('0x27')](respondWithResult(_0x226b94,null))['catch'](handleError(_0x226b94,null));};exports[_0xeadb('0x47')]=function(_0x3bb45c,_0x192236){return db[_0xeadb('0x2e')]['create'](_0x3bb45c[_0xeadb('0x48')],{})['then'](respondWithResult(_0x192236,0xc9))[_0xeadb('0x49')](handleError(_0x192236,null));};exports[_0xeadb('0x26')]=function(_0x2d5422,_0x275a66){if(_0x2d5422[_0xeadb('0x48')]['id']){delete _0x2d5422[_0xeadb('0x48')]['id'];}return db['ChatTransferReport'][_0xeadb('0x46')]({'where':{'id':_0x2d5422[_0xeadb('0x45')]['id']}})[_0xeadb('0x27')](handleEntityNotFound(_0x275a66,null))['then'](saveUpdates(_0x2d5422[_0xeadb('0x48')],null))['then'](respondWithResult(_0x275a66,null))['catch'](handleError(_0x275a66,null));};exports[_0xeadb('0x4a')]=function(_0x3ee8e1,_0x58db58){return db[_0xeadb('0x2e')][_0xeadb('0x46')]({'where':{'id':_0x3ee8e1[_0xeadb('0x45')]['id']}})[_0xeadb('0x27')](handleEntityNotFound(_0x58db58,null))[_0xeadb('0x27')](removeEntity(_0x58db58,null))['catch'](handleError(_0x58db58,null));};exports[_0xeadb('0x4b')]=function(_0x4fcc73,_0x416b52){return db[_0xeadb('0x2e')]['describe']()['then'](respondWithResult(_0x416b52,null))[_0xeadb('0x49')](handleError(_0x416b52,null));}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.model.js b/server/api/chatTransferReport/chatTransferReport.model.js index 05541a5..318c081 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 _0x008c=['lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./chatTransferReport.attributes','exports','define','report_chat_transfer','uniqueid'];(function(_0x1aa83b,_0x78f627){var _0x3e6dcf=function(_0x4606a3){while(--_0x4606a3){_0x1aa83b['push'](_0x1aa83b['shift']());}};_0x3e6dcf(++_0x78f627);}(_0x008c,0x188));var _0xc008=function(_0x5480fd,_0x46600d){_0x5480fd=_0x5480fd-0x0;var _0x2ec312=_0x008c[_0x5480fd];return _0x2ec312;};'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')]('ChatTransferReport',attributes,{'tableName':_0xc008('0xc'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0xc008('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xf3cd=['report_chat_transfer','uniqueid','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','exports','define','ChatTransferReport'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xf3cd,0xfe));var _0xdf3c=function(_0x5f3905,_0x43a651){_0x5f3905=_0x5f3905-0x0;var _0x2923b1=_0xf3cd[_0x5f3905];return _0x2923b1;};'use strict';var _=require(_0xdf3c('0x0'));var util=require(_0xdf3c('0x1'));var logger=require(_0xdf3c('0x2'))(_0xdf3c('0x3'));var moment=require(_0xdf3c('0x4'));var BPromise=require(_0xdf3c('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xdf3c('0x6'));var rimraf=require(_0xdf3c('0x7'));var config=require(_0xdf3c('0x8'));var attributes=require('./chatTransferReport.attributes');module[_0xdf3c('0x9')]=function(_0x17d42a,_0x1313d5){return _0x17d42a[_0xdf3c('0xa')](_0xdf3c('0xb'),attributes,{'tableName':_0xdf3c('0xc'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0xdf3c('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.rpc.js b/server/api/chatTransferReport/chatTransferReport.rpc.js index dc24bdf..c2e7633 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 _0x6bb4=['then','ChatTransferReport,\x20%s,\x20%s','ChatTransferReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','info','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x6bb4,0x77));var _0x46bb=function(_0x56deed,_0x276cc2){_0x56deed=_0x56deed-0x0;var _0x48d933=_0x6bb4[_0x56deed];return _0x48d933;};'use strict';var _=require(_0x46bb('0x0'));var util=require(_0x46bb('0x1'));var moment=require(_0x46bb('0x2'));var BPromise=require(_0x46bb('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x46bb('0x4'));var db=require(_0x46bb('0x5'))['db'];var utils=require(_0x46bb('0x6'));var logger=require(_0x46bb('0x7'))(_0x46bb('0x8'));var config=require(_0x46bb('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x46bb('0xa')][_0x46bb('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5b5508,_0x5a4228,_0x421df1){return new BPromise(function(_0x5c76a2,_0x4e4d5f){return client[_0x46bb('0xc')](_0x5b5508,_0x421df1)[_0x46bb('0xd')](function(_0x30d2e6){logger['info'](_0x46bb('0xe'),_0x5a4228,'request\x20sent');logger['debug'](_0x46bb('0xf'),_0x5a4228,_0x46bb('0x10'),JSON[_0x46bb('0x11')](_0x30d2e6));if(_0x30d2e6['error']){if(_0x30d2e6['error']['code']===0x1f4){logger[_0x46bb('0x12')]('ChatTransferReport,\x20%s,\x20%s',_0x5a4228,_0x30d2e6['error'][_0x46bb('0x13')]);return _0x4e4d5f(_0x30d2e6[_0x46bb('0x12')][_0x46bb('0x13')]);}logger[_0x46bb('0x12')](_0x46bb('0xe'),_0x5a4228,_0x30d2e6[_0x46bb('0x12')][_0x46bb('0x13')]);return _0x5c76a2(_0x30d2e6[_0x46bb('0x12')][_0x46bb('0x13')]);}else{logger[_0x46bb('0x14')](_0x46bb('0xe'),_0x5a4228,'request\x20sent');_0x5c76a2(_0x30d2e6['result']['message']);}})[_0x46bb('0x15')](function(_0x13ae57){logger[_0x46bb('0x12')](_0x46bb('0xe'),_0x5a4228,_0x13ae57);_0x4e4d5f(_0x13ae57);});});} \ No newline at end of file +var _0x46eb=['lodash','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','request','info','request\x20sent','debug','error','ChatTransferReport,\x20%s,\x20%s','message','result','catch'];(function(_0x54f493,_0x385811){var _0x5f2b47=function(_0x2d2323){while(--_0x2d2323){_0x54f493['push'](_0x54f493['shift']());}};_0x5f2b47(++_0x385811);}(_0x46eb,0x90));var _0xb46e=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x46eb[_0xa464c9];return _0x3d73c4;};'use strict';var _=require(_0xb46e('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xb46e('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xb46e('0x2'));var db=require(_0xb46e('0x3'))['db'];var utils=require(_0xb46e('0x4'));var logger=require(_0xb46e('0x5'))(_0xb46e('0x6'));var config=require(_0xb46e('0x7'));var jayson=require(_0xb46e('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x397f5a,_0x59df53,_0x189a2f){return new BPromise(function(_0x3398f5,_0x48ccf2){return client[_0xb46e('0x9')](_0x397f5a,_0x189a2f)['then'](function(_0xfd0075){logger[_0xb46e('0xa')]('ChatTransferReport,\x20%s,\x20%s',_0x59df53,_0xb46e('0xb'));logger[_0xb46e('0xc')]('ChatTransferReport,\x20%s,\x20%s,\x20%s',_0x59df53,'request\x20sent',JSON['stringify'](_0xfd0075));if(_0xfd0075[_0xb46e('0xd')]){if(_0xfd0075[_0xb46e('0xd')]['code']===0x1f4){logger[_0xb46e('0xd')](_0xb46e('0xe'),_0x59df53,_0xfd0075[_0xb46e('0xd')][_0xb46e('0xf')]);return _0x48ccf2(_0xfd0075[_0xb46e('0xd')][_0xb46e('0xf')]);}logger[_0xb46e('0xd')]('ChatTransferReport,\x20%s,\x20%s',_0x59df53,_0xfd0075[_0xb46e('0xd')][_0xb46e('0xf')]);return _0x3398f5(_0xfd0075[_0xb46e('0xd')]['message']);}else{logger['info'](_0xb46e('0xe'),_0x59df53,_0xb46e('0xb'));_0x3398f5(_0xfd0075[_0xb46e('0x10')][_0xb46e('0xf')]);}})[_0xb46e('0x11')](function(_0x491858){logger[_0xb46e('0xd')](_0xb46e('0xe'),_0x59df53,_0x491858);_0x48ccf2(_0x491858);});});} \ No newline at end of file diff --git a/server/api/chatTransferReport/index.js b/server/api/chatTransferReport/index.js index 4d8d1bb..17ff001 100644 --- a/server/api/chatTransferReport/index.js +++ b/server/api/chatTransferReport/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5f2f=['/describe','/:id','post','create','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index'];(function(_0x474e31,_0xeb809d){var _0x5d38a6=function(_0x8caf5e){while(--_0x8caf5e){_0x474e31['push'](_0x474e31['shift']());}};_0x5d38a6(++_0xeb809d);}(_0x5f2f,0x73));var _0xf5f2=function(_0x27e6c4,_0x5c26dd){_0x27e6c4=_0x27e6c4-0x0;var _0x33011c=_0x5f2f[_0x27e6c4];return _0x33011c;};'use strict';var multer=require(_0xf5f2('0x0'));var util=require(_0xf5f2('0x1'));var path=require(_0xf5f2('0x2'));var timeout=require(_0xf5f2('0x3'));var express=require(_0xf5f2('0x4'));var router=express[_0xf5f2('0x5')]();var auth=require(_0xf5f2('0x6'));var interaction=require(_0xf5f2('0x7'));var config=require('../../config/environment');var controller=require('./chatTransferReport.controller');router[_0xf5f2('0x8')]('/',auth[_0xf5f2('0x9')](),controller[_0xf5f2('0xa')]);router[_0xf5f2('0x8')](_0xf5f2('0xb'),auth[_0xf5f2('0x9')](),controller['describe']);router[_0xf5f2('0x8')](_0xf5f2('0xc'),auth[_0xf5f2('0x9')](),controller['show']);router[_0xf5f2('0xd')]('/',auth[_0xf5f2('0x9')](),controller[_0xf5f2('0xe')]);router['put'](_0xf5f2('0xc'),auth['isAuthenticated'](),controller['update']);router[_0xf5f2('0xf')](_0xf5f2('0xc'),auth['isAuthenticated'](),controller[_0xf5f2('0x10')]);module[_0xf5f2('0x11')]=router; \ No newline at end of file +var _0xb7e7=['multer','path','express','../../components/auth/service','../../config/environment','./chatTransferReport.controller','get','/describe','isAuthenticated','/:id','show','post','create','update','delete','destroy','exports'];(function(_0x1ee8cb,_0x4d1c68){var _0x21f29b=function(_0x168f18){while(--_0x168f18){_0x1ee8cb['push'](_0x1ee8cb['shift']());}};_0x21f29b(++_0x4d1c68);}(_0xb7e7,0x121));var _0x7b7e=function(_0x13d07a,_0x41efc3){_0x13d07a=_0x13d07a-0x0;var _0x5ee0ee=_0xb7e7[_0x13d07a];return _0x5ee0ee;};'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 diff --git a/server/api/chatWebsite/chatWebsite.attributes.js b/server/api/chatWebsite/chatWebsite.attributes.js index 9ffff12..2f9a5bd 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 _0x2873=['squared','We\x20are\x20here!','Send','Contact\x20us','Powered\x20by\x20xCALLY','TEXT','Form\x20submission\x20error','Type\x20a\x20message','Thanks\x20you\x20for\x20your\x20time!','Skip','Feedback','star','thumb','stringify','input','name','text','getDataValue','onlineForm','setDataValue','textarea','Comments','Leave\x20your\x20comments','parse','offlineForm','generate','All\x20of\x20our\x20agents\x20are\x20busy\x20at\x20this\x20time.\x20Your\x20chat\x20is\x20very\x20important\x20to\x20us.','Please\x20hold\x20and\x20we\x20will\x20answer\x20your\x20request\x20as\x20soon\x20as\x20possible.','New\x20offline\x20message\x20from\x20websiteName','You\x20received\x20a\x20new\x20offline\x20message\x20from\x20websiteName.\x20Here\x20you\x20can\x20find\x20the\x20details\x20of\x20the\x20request:','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','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','randomstring','exports','STRING','address','email','#011F6A','#ffffff','INTEGER','BOOLEAN','ENUM','rounded'];(function(_0x155751,_0x31c85d){var _0x126e7b=function(_0x491a1a){while(--_0x491a1a){_0x155751['push'](_0x155751['shift']());}};_0x126e7b(++_0x31c85d);}(_0x2873,0x1f2));var _0x3287=function(_0x3aeea0,_0x1dd1fd){_0x3aeea0=_0x3aeea0-0x0;var _0x6bab4d=_0x2873[_0x3aeea0];return _0x6bab4d;};'use strict';var Sequelize=require(_0x3287('0x0'));var rs=require(_0x3287('0x1'));module[_0x3287('0x2')]={'name':{'type':Sequelize[_0x3287('0x3')],'allowNull':![]},'address':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x3287('0x4')},'description':{'type':Sequelize[_0x3287('0x3')]},'mapKey':{'type':Sequelize['STRING'],'defaultValue':_0x3287('0x5')},'mapKeyOffline':{'type':Sequelize[_0x3287('0x3')],'defaultValue':'email'},'key':{'type':Sequelize[_0x3287('0x3')],'allowNull':![]},'agentAlias':{'type':Sequelize[_0x3287('0x3')],'defaultValue':'Agent'},'customerAlias':{'type':Sequelize[_0x3287('0x3')],'defaultValue':'Me'},'color':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x3287('0x6'),'validate':{'notEmpty':!![]}},'color_button':{'type':Sequelize[_0x3287('0x3')],'allowNull':![],'defaultValue':_0x3287('0x6'),'validate':{'notEmpty':!![]}},'textColor':{'type':Sequelize[_0x3287('0x3')],'allowNull':![],'defaultValue':_0x3287('0x7'),'validate':{'notEmpty':!![]}},'fontSize':{'type':Sequelize[_0x3287('0x8')],'defaultValue':0xf},'remote':{'type':Sequelize[_0x3287('0x3')]},'animation':{'type':Sequelize[_0x3287('0x9')],'defaultValue':!![]},'header_shape':{'type':Sequelize[_0x3287('0xa')](_0x3287('0xb'),_0x3287('0xc')),'defaultValue':_0x3287('0xb')},'header_online':{'type':Sequelize[_0x3287('0x3')],'defaultValue':_0x3287('0xd')},'start_chat_button':{'type':Sequelize[_0x3287('0x3')],'defaultValue':'Chat'},'offline_chat_button':{'type':Sequelize['STRING'],'defaultValue':_0x3287('0xe')},'header_offline':{'type':Sequelize[_0x3287('0x3')],'defaultValue':_0x3287('0xf')},'download_transcript':{'type':Sequelize[_0x3287('0x9')],'defaultValue':!![]},'timeout':{'type':Sequelize[_0x3287('0x8')],'defaultValue':0x0},'whiteLabel':{'type':Sequelize['STRING'],'defaultValue':_0x3287('0x10')},'defaultWhiteLabel':{'type':Sequelize[_0x3287('0x9')],'defaultValue':!![]},'sitepic':{'type':Sequelize[_0x3287('0x11')]},'closingQuestion':{'type':Sequelize[_0x3287('0x3')],'defaultValue':'Do\x20you\x20want\x20to\x20close\x20the\x20interaction?'},'formSubmitSuccessMessage':{'type':Sequelize[_0x3287('0x3')],'defaultValue':'Form\x20properly\x20submitted'},'formSubmitFailureMessage':{'type':Sequelize[_0x3287('0x3')],'defaultValue':_0x3287('0x12')},'noteTitle':{'type':Sequelize[_0x3287('0x3')],'defaultValue':'Note'},'placeholderMessage':{'type':Sequelize[_0x3287('0x3')],'defaultValue':_0x3287('0x13')},'closingMessage':{'type':Sequelize[_0x3287('0x3')],'defaultValue':_0x3287('0x14')},'closingMessageButton':{'type':Sequelize[_0x3287('0x3')],'defaultValue':'Send'},'skipMessageButton':{'type':Sequelize['STRING'],'defaultValue':_0x3287('0x15')},'conditionAgreement':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'enableRating':{'type':Sequelize[_0x3287('0x9')],'defaultValue':![]},'enableFeedback':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'enableSendButton':{'type':Sequelize[_0x3287('0x9')],'defaultValue':![]},'feedbackTitle':{'type':Sequelize['STRING'],'defaultValue':_0x3287('0x16')},'ratingType':{'type':Sequelize[_0x3287('0xa')](_0x3287('0x17'),_0x3287('0x18')),'defaultValue':_0x3287('0x17')},'ratingStarsNumber':{'type':Sequelize[_0x3287('0x8')],'defaultValue':0x5},'onlineForm':{'type':Sequelize[_0x3287('0x11')],'defaultValue':function(){return JSON[_0x3287('0x19')]({'items':[{'type':_0x3287('0x1a'),'variable':null,'config':{'placeholder':_0x3287('0x1b'),'type':_0x3287('0x1c'),'required':!![]},'props':{'title':'name','helpText':''}},{'type':'input','props':{'title':_0x3287('0x5'),'helpText':''},'config':{'required':!![],'placeholder':_0x3287('0x5'),'type':_0x3287('0x5')},'variable':null}],'fromKey':0x1});},'get':function(){return this[_0x3287('0x1d')](_0x3287('0x1e'))?JSON['parse'](this[_0x3287('0x1d')](_0x3287('0x1e'))):{};},'set':function(_0x1955c6){return this[_0x3287('0x1f')](_0x3287('0x1e'),JSON[_0x3287('0x19')](_0x1955c6));}},'offlineForm':{'type':Sequelize[_0x3287('0x11')],'defaultValue':function(){return JSON[_0x3287('0x19')]({'items':[{'type':'input','props':{'title':_0x3287('0x5'),'helpText':''},'config':{'required':!![],'placeholder':_0x3287('0x5'),'type':'email'},'variable':null},{'type':_0x3287('0x20'),'config':{'placeholder':_0x3287('0x21')},'props':{'title':_0x3287('0x21'),'helpText':_0x3287('0x22')}}],'fromKey':0x0});},'get':function(){return this[_0x3287('0x1d')]('offlineForm')?JSON[_0x3287('0x23')](this[_0x3287('0x1d')]('offlineForm')):{};},'set':function(_0x32ef52){return this[_0x3287('0x1f')](_0x3287('0x24'),JSON[_0x3287('0x19')](_0x32ef52));}},'token':{'type':Sequelize['STRING'],'defaultValue':function(){return rs[_0x3287('0x25')]();}},'autoclose':{'type':Sequelize[_0x3287('0x9')],'defaultValue':!![]},'enableCustomerWriting':{'type':Sequelize[_0x3287('0x9')],'defaultValue':![]},'forwardTranscript':{'type':Sequelize[_0x3287('0x9')],'defaultValue':![]},'forwardTranscriptMessage':{'type':Sequelize['STRING']},'forwardOffline':{'type':Sequelize[_0x3287('0x9')],'defaultValue':![]},'forwardOfflineAddress':{'type':Sequelize[_0x3287('0x3')]},'waitingTitle':{'type':Sequelize[_0x3287('0x3')],'defaultValue':_0x3287('0x26')},'waitingMessage':{'type':Sequelize[_0x3287('0x3')],'defaultValue':_0x3287('0x27')},'offlineMessageSubject':{'type':Sequelize[_0x3287('0x3')],'defaultValue':_0x3287('0x28')},'offlineMessageBody':{'type':Sequelize['STRING'],'defaultValue':_0x3287('0x29')},'enableUnmanagedNote':{'type':Sequelize[_0x3287('0x9')],'defaultValue':!![]},'unmanagedMessage':{'type':Sequelize[_0x3287('0x3')],'defaultValue':'Your\x20request\x20has\x20not\x20been\x20processed.'},'skipUnmanaged':{'type':Sequelize[_0x3287('0x3')],'defaultValue':'Skip'},'sendUnmanaged':{'type':Sequelize[_0x3287('0x3')],'defaultValue':_0x3287('0xe')},'enableCustomerAttachment':{'type':Sequelize[_0x3287('0x9')],'defaultValue':![]},'enableCustomerCheckmarks':{'type':Sequelize[_0x3287('0x9')],'defaultValue':![]},'agentAvatar':{'type':Sequelize[_0x3287('0x11')]},'showAgentAvatar':{'type':Sequelize[_0x3287('0x9')],'defaultValue':![]},'timezone':{'type':Sequelize[_0x3287('0x3')]},'notificationTemplate':{'type':Sequelize[_0x3287('0x11')],'defaultValue':function(){return _0x3287('0x2a');}},'notificationSound':{'type':Sequelize[_0x3287('0x9')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x3287('0x9')],'defaultValue':![]},'hideWhenOffline':{'type':Sequelize[_0x3287('0x9')],'defaultValue':![]},'agentIdentifier':{'type':Sequelize[_0x3287('0x3')],'defaultValue':_0x3287('0x2b')},'waitForTheAssignedAgent':{'type':Sequelize[_0x3287('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'alignment':{'type':Sequelize[_0x3287('0x3')],'defaultValue':_0x3287('0x2c')},'verticalAlignment':{'type':Sequelize[_0x3287('0x8')],'defaultValue':0x1e},'messagesAlignment':{'type':Sequelize['STRING'],'defaultValue':_0x3287('0x2d')},'defaultTitle':{'type':Sequelize['STRING']},'customerAvatar':{'type':Sequelize[_0x3287('0x11')]},'showCustomerAvatar':{'type':Sequelize[_0x3287('0x9')],'defaultValue':![]},'messageFontSize':{'type':Sequelize[_0x3287('0x8')],'defaultValue':0xc},'backgroundColor':{'type':Sequelize[_0x3287('0x3')],'allowNull':![],'defaultValue':_0x3287('0x2e'),'validate':{'notEmpty':!![]}},'queueTransfer':{'type':Sequelize[_0x3287('0x9')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x3287('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x3287('0x9')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x3287('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'systemAlias':{'type':Sequelize[_0x3287('0x3')],'defaultValue':_0x3287('0x2f')},'systemAvatar':{'type':Sequelize[_0x3287('0x11')]},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize[_0x3287('0x9')],'defaultValue':![],'comment':_0x3287('0x30'),'set':function(_0x482bfd){if(!_0x482bfd)this[_0x3287('0x1f')](_0x3287('0x31'),null);this[_0x3287('0x1f')](_0x3287('0x32'),_0x482bfd);}},'vidaooEscalation':{'type':Sequelize[_0x3287('0x9')],'defaultValue':![]},'vidaooApiKey':{'type':Sequelize['STRING'],'defaultValue':![]}}; \ No newline at end of file +var _0x86f4=['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','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','website_alias','System','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','randomstring','exports','STRING','address','email','Agent','#011F6A','#ffffff','INTEGER','BOOLEAN','ENUM','rounded','squared','We\x20are\x20here!','Chat','Send','Powered\x20by\x20xCALLY','Do\x20you\x20want\x20to\x20close\x20the\x20interaction?','Form\x20submission\x20error','Type\x20a\x20message','Thanks\x20you\x20for\x20your\x20time!','Skip','Feedback','star','thumb','TEXT','stringify','input','name','getDataValue','onlineForm','parse','setDataValue','textarea','Comments','offlineForm','generate'];(function(_0xa66e4f,_0x38fdc9){var _0x2f3ee2=function(_0x1cada4){while(--_0x1cada4){_0xa66e4f['push'](_0xa66e4f['shift']());}};_0x2f3ee2(++_0x38fdc9);}(_0x86f4,0x18a));var _0x486f=function(_0x36934b,_0x1aa99f){_0x36934b=_0x36934b-0x0;var _0xe109e6=_0x86f4[_0x36934b];return _0xe109e6;};'use strict';var Sequelize=require(_0x486f('0x0'));var rs=require(_0x486f('0x1'));module[_0x486f('0x2')]={'name':{'type':Sequelize[_0x486f('0x3')],'allowNull':![]},'address':{'type':Sequelize[_0x486f('0x3')],'allowNull':![],'unique':_0x486f('0x4')},'description':{'type':Sequelize[_0x486f('0x3')]},'mapKey':{'type':Sequelize['STRING'],'defaultValue':_0x486f('0x5')},'mapKeyOffline':{'type':Sequelize[_0x486f('0x3')],'defaultValue':'email'},'key':{'type':Sequelize[_0x486f('0x3')],'allowNull':![]},'agentAlias':{'type':Sequelize[_0x486f('0x3')],'defaultValue':_0x486f('0x6')},'customerAlias':{'type':Sequelize[_0x486f('0x3')],'defaultValue':'Me'},'color':{'type':Sequelize[_0x486f('0x3')],'allowNull':![],'defaultValue':_0x486f('0x7'),'validate':{'notEmpty':!![]}},'color_button':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x486f('0x7'),'validate':{'notEmpty':!![]}},'textColor':{'type':Sequelize[_0x486f('0x3')],'allowNull':![],'defaultValue':_0x486f('0x8'),'validate':{'notEmpty':!![]}},'fontSize':{'type':Sequelize[_0x486f('0x9')],'defaultValue':0xf},'remote':{'type':Sequelize[_0x486f('0x3')]},'animation':{'type':Sequelize[_0x486f('0xa')],'defaultValue':!![]},'header_shape':{'type':Sequelize[_0x486f('0xb')](_0x486f('0xc'),_0x486f('0xd')),'defaultValue':_0x486f('0xc')},'header_online':{'type':Sequelize[_0x486f('0x3')],'defaultValue':_0x486f('0xe')},'start_chat_button':{'type':Sequelize[_0x486f('0x3')],'defaultValue':_0x486f('0xf')},'offline_chat_button':{'type':Sequelize[_0x486f('0x3')],'defaultValue':_0x486f('0x10')},'header_offline':{'type':Sequelize[_0x486f('0x3')],'defaultValue':'Contact\x20us'},'download_transcript':{'type':Sequelize[_0x486f('0xa')],'defaultValue':!![]},'timeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'whiteLabel':{'type':Sequelize[_0x486f('0x3')],'defaultValue':_0x486f('0x11')},'defaultWhiteLabel':{'type':Sequelize[_0x486f('0xa')],'defaultValue':!![]},'sitepic':{'type':Sequelize['TEXT']},'closingQuestion':{'type':Sequelize['STRING'],'defaultValue':_0x486f('0x12')},'formSubmitSuccessMessage':{'type':Sequelize[_0x486f('0x3')],'defaultValue':'Form\x20properly\x20submitted'},'formSubmitFailureMessage':{'type':Sequelize[_0x486f('0x3')],'defaultValue':_0x486f('0x13')},'noteTitle':{'type':Sequelize[_0x486f('0x3')],'defaultValue':'Note'},'placeholderMessage':{'type':Sequelize['STRING'],'defaultValue':_0x486f('0x14')},'closingMessage':{'type':Sequelize[_0x486f('0x3')],'defaultValue':_0x486f('0x15')},'closingMessageButton':{'type':Sequelize[_0x486f('0x3')],'defaultValue':'Send'},'skipMessageButton':{'type':Sequelize['STRING'],'defaultValue':_0x486f('0x16')},'conditionAgreement':{'type':Sequelize[_0x486f('0xa')],'defaultValue':![]},'enableRating':{'type':Sequelize[_0x486f('0xa')],'defaultValue':![]},'enableFeedback':{'type':Sequelize[_0x486f('0xa')],'defaultValue':![]},'enableSendButton':{'type':Sequelize[_0x486f('0xa')],'defaultValue':![]},'feedbackTitle':{'type':Sequelize[_0x486f('0x3')],'defaultValue':_0x486f('0x17')},'ratingType':{'type':Sequelize[_0x486f('0xb')](_0x486f('0x18'),_0x486f('0x19')),'defaultValue':_0x486f('0x18')},'ratingStarsNumber':{'type':Sequelize[_0x486f('0x9')],'defaultValue':0x5},'onlineForm':{'type':Sequelize[_0x486f('0x1a')],'defaultValue':function(){return JSON[_0x486f('0x1b')]({'items':[{'type':_0x486f('0x1c'),'variable':null,'config':{'placeholder':_0x486f('0x1d'),'type':'text','required':!![]},'props':{'title':_0x486f('0x1d'),'helpText':''}},{'type':_0x486f('0x1c'),'props':{'title':_0x486f('0x5'),'helpText':''},'config':{'required':!![],'placeholder':_0x486f('0x5'),'type':_0x486f('0x5')},'variable':null}],'fromKey':0x1});},'get':function(){return this[_0x486f('0x1e')](_0x486f('0x1f'))?JSON[_0x486f('0x20')](this[_0x486f('0x1e')](_0x486f('0x1f'))):{};},'set':function(_0x2e983b){return this[_0x486f('0x21')](_0x486f('0x1f'),JSON[_0x486f('0x1b')](_0x2e983b));}},'offlineForm':{'type':Sequelize[_0x486f('0x1a')],'defaultValue':function(){return JSON[_0x486f('0x1b')]({'items':[{'type':_0x486f('0x1c'),'props':{'title':_0x486f('0x5'),'helpText':''},'config':{'required':!![],'placeholder':_0x486f('0x5'),'type':_0x486f('0x5')},'variable':null},{'type':_0x486f('0x22'),'config':{'placeholder':_0x486f('0x23')},'props':{'title':'Comments','helpText':'Leave\x20your\x20comments'}}],'fromKey':0x0});},'get':function(){return this['getDataValue']('offlineForm')?JSON[_0x486f('0x20')](this['getDataValue'](_0x486f('0x24'))):{};},'set':function(_0x3ffa45){return this['setDataValue'](_0x486f('0x24'),JSON['stringify'](_0x3ffa45));}},'token':{'type':Sequelize[_0x486f('0x3')],'defaultValue':function(){return rs[_0x486f('0x25')]();}},'autoclose':{'type':Sequelize[_0x486f('0xa')],'defaultValue':!![]},'enableCustomerWriting':{'type':Sequelize[_0x486f('0xa')],'defaultValue':![]},'forwardTranscript':{'type':Sequelize[_0x486f('0xa')],'defaultValue':![]},'forwardTranscriptMessage':{'type':Sequelize[_0x486f('0x3')]},'forwardOffline':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'forwardOfflineAddress':{'type':Sequelize[_0x486f('0x3')]},'waitingTitle':{'type':Sequelize[_0x486f('0x3')],'defaultValue':_0x486f('0x26')},'waitingMessage':{'type':Sequelize[_0x486f('0x3')],'defaultValue':_0x486f('0x27')},'offlineMessageSubject':{'type':Sequelize[_0x486f('0x3')],'defaultValue':_0x486f('0x28')},'offlineMessageBody':{'type':Sequelize[_0x486f('0x3')],'defaultValue':'You\x20received\x20a\x20new\x20offline\x20message\x20from\x20websiteName.\x20Here\x20you\x20can\x20find\x20the\x20details\x20of\x20the\x20request:'},'enableUnmanagedNote':{'type':Sequelize[_0x486f('0xa')],'defaultValue':!![]},'unmanagedMessage':{'type':Sequelize[_0x486f('0x3')],'defaultValue':'Your\x20request\x20has\x20not\x20been\x20processed.'},'skipUnmanaged':{'type':Sequelize[_0x486f('0x3')],'defaultValue':_0x486f('0x16')},'sendUnmanaged':{'type':Sequelize[_0x486f('0x3')],'defaultValue':_0x486f('0x10')},'enableCustomerAttachment':{'type':Sequelize[_0x486f('0xa')],'defaultValue':![]},'enableCustomerCheckmarks':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentAvatar':{'type':Sequelize[_0x486f('0x1a')]},'showAgentAvatar':{'type':Sequelize[_0x486f('0xa')],'defaultValue':![]},'timezone':{'type':Sequelize[_0x486f('0x3')]},'notificationTemplate':{'type':Sequelize[_0x486f('0x1a')],'defaultValue':function(){return _0x486f('0x29');}},'notificationSound':{'type':Sequelize[_0x486f('0xa')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x486f('0xa')],'defaultValue':![]},'hideWhenOffline':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentIdentifier':{'type':Sequelize[_0x486f('0x3')],'defaultValue':_0x486f('0x2a')},'waitForTheAssignedAgent':{'type':Sequelize[_0x486f('0x9')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'alignment':{'type':Sequelize['STRING'],'defaultValue':'bottom_right'},'verticalAlignment':{'type':Sequelize[_0x486f('0x9')],'defaultValue':0x1e},'messagesAlignment':{'type':Sequelize[_0x486f('0x3')],'defaultValue':'alternate'},'defaultTitle':{'type':Sequelize[_0x486f('0x3')]},'customerAvatar':{'type':Sequelize['TEXT']},'showCustomerAvatar':{'type':Sequelize[_0x486f('0xa')],'defaultValue':![]},'messageFontSize':{'type':Sequelize[_0x486f('0x9')],'defaultValue':0xc},'backgroundColor':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'#fafafa','validate':{'notEmpty':!![]}},'queueTransfer':{'type':Sequelize[_0x486f('0xa')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x486f('0x9')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x486f('0xa')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x486f('0x9')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'systemAlias':{'type':Sequelize[_0x486f('0x3')],'defaultValue':_0x486f('0x2b')},'systemAvatar':{'type':Sequelize[_0x486f('0x1a')]},'mandatoryDispositionPauseId':{'type':Sequelize[_0x486f('0x9')],'comment':_0x486f('0x2c')},'mandatoryDisposition':{'type':Sequelize[_0x486f('0xa')],'defaultValue':![],'comment':_0x486f('0x2d'),'set':function(_0x737fee){if(!_0x737fee)this[_0x486f('0x21')](_0x486f('0x2e'),null);this['setDataValue'](_0x486f('0x2f'),_0x737fee);}},'vidaooEscalation':{'type':Sequelize[_0x486f('0xa')],'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 fb0942c..9782d2f 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 _0xcd89=['index','Pause','mandatoryDispositionPause','map','rawAttributes','fieldName','type','model','name','query','keys','filters','intersection','attributes','fields','length','nolimit','offset','sort','where','pick','filter','merge','VIRTUAL','options','ChatWebsite','includeAll','include','findAll','rows','show','params','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','ChatWebsites','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','addDisposition','ChatWebsiteId','getDispositions','findOne','Disposition','hasOwnProperty','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','order','removeAnswers','addLogo','file','agentAvatar','filename','addCustomerAvatar','addSystemAvatar','getLogo','join','server/files/images/logos/default_logo.svg','../../config/license/util','getLicense','custom','isNil','sitepic','existsSync','server/files/images/logos/','root','download','getAvatar','server/files/images/avatars/','getCustomerAvatar','server/files/images/avatars/customer_avatar.png','customerAvatar','showCustomerAvatar','getSystemAvatar','systemAvatar','notify','setUA','headers','user-agent','getResult','no\x20available\x20attributes','difference','createdAt','updatedAt','CompanyId','from','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','List','CmContact','DESC','Applications','account','applications','list','asc','Contacts','defaults','ListId','contact','customerIp','cf-connecting-ip','first','x-forwarded-for','split','firstName','lastName','x-real-port','referer','browser','version','%s\x20%s','unknown','format','device','vendor','%s\x20%s\x20%s','stringify','threadId','ChatInteraction','externalUrl','ContactId','interaction','spread','messageId','update','created','close','unmanaged','*,*,*,*','AttachmentId','UserId','User','unshift','agent','waitForTheAssignedAgent','forcedOwnership','startRouting','Start','EventManager','offline','mapKeyOffline','mapKeyOffline\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKeyOffline\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','findOrCreate','server/files/templates/chatOfflineMessage.ejs','toPairs','ChatOfflineMessage','MailAccount','MailServerOut','Smtp','forwardOfflineAddress','service','host','port','secure','authentication','auth','pass','SendMail','sendMail','\x22%s\x22\x20<%s>','email','addInteraction','omit','Contact','Owner','Tags','color','tag','Command','getSnippet','iftime\x20%s,%s','interval','timezone','iftime\x20%s','true','[%s][INTERVAL][%s]\x20%s\x20%s\x20(%s)','ONLINE','OFFLINE','inspect','No\x20timezone','Interval','getProactiveActions','License','increment','chatLicenseExceeded','Intervals','push','all','some','readFileSync','utf8','x-real-ip','connection','remoteAddress','virtual','alignment','textColor','addApplications','sequelize','transaction','ChatApplication','bulkCreate','findAndCountAll','priority','getApplications','addProactiveActions','chatProactiveAction','ChatProactiveAction','getFields','false','onlineForm','items','fromKey','getOfflineMessages','addAgents','removeAgents','isArray','userChatWebsite:remove','emit','getAgents','html-pdf','eml-format','fast-json-patch','moment','bluebird','path','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','localhost','./chatWebsite.socket','jayson/promise','http','client','test','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','info','ChatWebsite,\x20%s,\x20%s','request\x20sent','ChatWebsite,\x20%s,\x20%s,\x20%s','error','message','catch','sendStatus','end','status','json','count','limit','apply','reject','save','destroy','get','UserProfileResource','send'];(function(_0x47e741,_0x1d44c6){var _0x1f390c=function(_0x46fb59){while(--_0x46fb59){_0x47e741['push'](_0x47e741['shift']());}};_0x1f390c(++_0x1d44c6);}(_0xcd89,0xe8));var _0x9cd8=function(_0x4eff04,_0x290c3b){_0x4eff04=_0x4eff04-0x0;var _0x5255bd=_0xcd89[_0x4eff04];return _0x5255bd;};'use strict';var pdf=require(_0x9cd8('0x0'));var emlformat=require(_0x9cd8('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x9cd8('0x2'));var rp=require('request-promise');var moment=require(_0x9cd8('0x3'));var BPromise=require(_0x9cd8('0x4'));var Mustache=require('mustache');var util=require('util');var path=require(_0x9cd8('0x5'));var sox=require('sox');var csv=require(_0x9cd8('0x6'));var ejs=require(_0x9cd8('0x7'));var fs=require('fs');var _=require('lodash');var squel=require(_0x9cd8('0x8'));var crypto=require(_0x9cd8('0x9'));var jsforce=require(_0x9cd8('0xa'));var deskjs=require(_0x9cd8('0xb'));var toCsv=require(_0x9cd8('0x6'));var querystring=require(_0x9cd8('0xc'));var Papa=require(_0x9cd8('0xd'));var Redis=require(_0x9cd8('0xe'));var authService=require('../../components/auth/service');var qs=require(_0x9cd8('0xf'));var as=require(_0x9cd8('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x9cd8('0x11'))(_0x9cd8('0x12'));var utils=require(_0x9cd8('0x13'));var config=require(_0x9cd8('0x14'));var db=require(_0x9cd8('0x15'))['db'];config[_0x9cd8('0x16')]=_['defaults'](config['redis'],{'host':_0x9cd8('0x17'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x9cd8('0x16')]));require(_0x9cd8('0x18'))['register'](socket);var jayson=require(_0x9cd8('0x19'));var client=jayson['client'][_0x9cd8('0x1a')]({'port':0x232c});var client9002=jayson[_0x9cd8('0x1b')][_0x9cd8('0x1a')]({'port':0x232a});var client9003=jayson[_0x9cd8('0x1b')][_0x9cd8('0x1a')]({'port':0x232b});function checkPasswordPattern(_0x7b689f,_0x34ef7f,_0x1254d1){if(_0x1254d1){var _0x4d14f6=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x4d14f6[_0x9cd8('0x1c')](_0x34ef7f)){return _0x7b689f;}else{throw new db[(_0x9cd8('0x1d'))][(_0x9cd8('0x1e'))](_0x9cd8('0x1f'));}}else{return _0x7b689f;}}function respondWithRpcPromise(_0x5f3686,_0x19a4d1,_0x5367e9,_0x353054){return new BPromise(function(_0x446b04,_0x47c5a1){var _0x50d5f7=_0x353054||client;return _0x50d5f7[_0x9cd8('0x20')](_0x5f3686,_0x5367e9)[_0x9cd8('0x21')](function(_0x54ed4f){logger[_0x9cd8('0x22')](_0x9cd8('0x23'),_0x19a4d1,_0x9cd8('0x24'));logger['debug'](_0x9cd8('0x25'),_0x19a4d1,_0x9cd8('0x24'),JSON['stringify'](_0x54ed4f));if(_0x54ed4f['error']){if(_0x54ed4f[_0x9cd8('0x26')]['code']===0x1f4){logger['error'](_0x9cd8('0x23'),_0x19a4d1,_0x54ed4f[_0x9cd8('0x26')][_0x9cd8('0x27')]);return _0x47c5a1(_0x54ed4f[_0x9cd8('0x26')][_0x9cd8('0x27')]);}logger[_0x9cd8('0x26')]('ChatWebsite,\x20%s,\x20%s',_0x19a4d1,_0x54ed4f[_0x9cd8('0x26')][_0x9cd8('0x27')]);return _0x446b04(_0x54ed4f[_0x9cd8('0x26')][_0x9cd8('0x27')]);}else{logger['info'](_0x9cd8('0x23'),_0x19a4d1,_0x9cd8('0x24'));_0x446b04(_0x54ed4f['result']['message']);}})[_0x9cd8('0x28')](function(_0x592e21){logger[_0x9cd8('0x26')](_0x9cd8('0x23'),_0x19a4d1,_0x592e21);_0x47c5a1(_0x592e21);});});}function respondWithStatusCode(_0x444fec,_0x45449c){_0x45449c=_0x45449c||0xcc;return function(_0x31a9d6){if(_0x31a9d6){return _0x444fec[_0x9cd8('0x29')](_0x45449c);}return _0x444fec['status'](_0x45449c)[_0x9cd8('0x2a')]();};}function respondWithResult(_0x5916ce,_0x3be8a2){_0x3be8a2=_0x3be8a2||0xc8;return function(_0x12a3c0){if(_0x12a3c0){return _0x5916ce[_0x9cd8('0x2b')](_0x3be8a2)[_0x9cd8('0x2c')](_0x12a3c0);}};}function respondWithFilteredResult(_0x152edf,_0x1ebe79){return function(_0x34464f){if(_0x34464f){var _0x580859=_0x34464f[_0x9cd8('0x2d')],_0x47f9a8=_0x1ebe79['offset'],_0x40bd2d=_0x1ebe79['offset']+_0x1ebe79[_0x9cd8('0x2e')],_0x24b469;if(_0x40bd2d>=_0x580859){_0x40bd2d=_0x580859;_0x24b469=0xc8;}else{_0x24b469=0xce;}_0x152edf['status'](_0x24b469);return _0x152edf['set']('Content-Range',_0x47f9a8+'-'+_0x40bd2d+'/'+_0x580859)['json'](_0x34464f);}return null;};}function patchUpdates(_0x3902ac){return function(_0x262fd6){try{jsonpatch[_0x9cd8('0x2f')](_0x262fd6,_0x3902ac,!![]);}catch(_0x1d2fa8){return BPromise[_0x9cd8('0x30')](_0x1d2fa8);}return _0x262fd6[_0x9cd8('0x31')]();};}function saveUpdates(_0x4a0758,_0x225c75){return function(_0x3ef1de){if(_0x3ef1de){return _0x3ef1de['update'](_0x4a0758)[_0x9cd8('0x21')](function(_0x2ee23d){return _0x2ee23d;});}return null;};}function removeEntity(_0x3458e9,_0x1ca935){return function(_0xf2a54f){if(_0xf2a54f){return _0xf2a54f[_0x9cd8('0x32')]()[_0x9cd8('0x21')](function(){var _0x4e7588=_0xf2a54f[_0x9cd8('0x33')]({'plain':!![]});var _0x9170ed='ChatWebsites';return db[_0x9cd8('0x34')]['destroy']({'where':{'type':_0x9170ed,'resourceId':_0x4e7588['id']}})[_0x9cd8('0x21')](function(){return _0xf2a54f;});})[_0x9cd8('0x21')](function(){_0x3458e9[_0x9cd8('0x2b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4ed366,_0x1d6317){return function(_0x3d3bef){if(!_0x3d3bef){_0x4ed366[_0x9cd8('0x29')](0x194);}return _0x3d3bef;};}function handleError(_0x4436cf,_0x5ead4e){_0x5ead4e=_0x5ead4e||0x1f4;return function(_0x57ec24){logger[_0x9cd8('0x26')](_0x57ec24['stack']);if(_0x57ec24['name']){delete _0x57ec24['name'];}_0x4436cf[_0x9cd8('0x2b')](_0x5ead4e)[_0x9cd8('0x35')](_0x57ec24);};}exports[_0x9cd8('0x36')]=function(_0x502810,_0x1ba63d){var _0x3e7a68={'include':[{'model':db[_0x9cd8('0x37')],'as':_0x9cd8('0x38')}]},_0x1d4ee6={},_0x1b880b={'count':0x0,'rows':[]};var _0x59d225=_[_0x9cd8('0x39')](db['ChatWebsite'][_0x9cd8('0x3a')],function(_0x4b7638){return{'name':_0x4b7638[_0x9cd8('0x3b')],'type':_0x4b7638[_0x9cd8('0x3c')]['key']};});_0x1d4ee6[_0x9cd8('0x3d')]=_[_0x9cd8('0x39')](_0x59d225,_0x9cd8('0x3e'));_0x1d4ee6[_0x9cd8('0x3f')]=_[_0x9cd8('0x40')](_0x502810[_0x9cd8('0x3f')]);_0x1d4ee6[_0x9cd8('0x41')]=_[_0x9cd8('0x42')](_0x1d4ee6['model'],_0x1d4ee6[_0x9cd8('0x3f')]);_0x3e7a68[_0x9cd8('0x43')]=_[_0x9cd8('0x42')](_0x1d4ee6[_0x9cd8('0x3d')],qs[_0x9cd8('0x44')](_0x502810[_0x9cd8('0x3f')][_0x9cd8('0x44')]));_0x3e7a68['attributes']=_0x3e7a68[_0x9cd8('0x43')][_0x9cd8('0x45')]?_0x3e7a68['attributes']:_0x1d4ee6[_0x9cd8('0x3d')];if(!_0x502810['query']['hasOwnProperty'](_0x9cd8('0x46'))){_0x3e7a68[_0x9cd8('0x2e')]=qs[_0x9cd8('0x2e')](_0x502810[_0x9cd8('0x3f')]['limit']);_0x3e7a68[_0x9cd8('0x47')]=qs['offset'](_0x502810[_0x9cd8('0x3f')][_0x9cd8('0x47')]);}_0x3e7a68['order']=qs[_0x9cd8('0x48')](_0x502810[_0x9cd8('0x3f')][_0x9cd8('0x48')]);_0x3e7a68[_0x9cd8('0x49')]=qs['filters'](_[_0x9cd8('0x4a')](_0x502810[_0x9cd8('0x3f')],_0x1d4ee6[_0x9cd8('0x41')]),_0x59d225);if(_0x502810[_0x9cd8('0x3f')][_0x9cd8('0x4b')]){_0x3e7a68[_0x9cd8('0x49')]=_[_0x9cd8('0x4c')](_0x3e7a68[_0x9cd8('0x49')],{'$or':_[_0x9cd8('0x39')](_0x59d225,function(_0x34b47b){if(_0x34b47b[_0x9cd8('0x3c')]!==_0x9cd8('0x4d')){var _0x373b64={};_0x373b64[_0x34b47b['name']]={'$like':'%'+_0x502810[_0x9cd8('0x3f')][_0x9cd8('0x4b')]+'%'};return _0x373b64;}})});}_0x3e7a68=_['merge']({},_0x3e7a68,_0x502810[_0x9cd8('0x4e')]);var _0x24b6c3={'where':_0x3e7a68[_0x9cd8('0x49')]};return db[_0x9cd8('0x4f')]['count'](_0x24b6c3)[_0x9cd8('0x21')](function(_0x2964a0){_0x1b880b[_0x9cd8('0x2d')]=_0x2964a0;if(_0x502810[_0x9cd8('0x3f')][_0x9cd8('0x50')]){_0x3e7a68[_0x9cd8('0x51')]=[{'all':!![]}];}return db['ChatWebsite'][_0x9cd8('0x52')](_0x3e7a68);})[_0x9cd8('0x21')](function(_0x56850e){_0x1b880b[_0x9cd8('0x53')]=_0x56850e;return _0x1b880b;})[_0x9cd8('0x21')](respondWithFilteredResult(_0x1ba63d,_0x3e7a68))[_0x9cd8('0x28')](handleError(_0x1ba63d,null));};exports[_0x9cd8('0x54')]=function(_0x5ada00,_0x1441d9){var _0x5a0808={'raw':![],'where':{'id':_0x5ada00[_0x9cd8('0x55')]['id']},'include':[{'model':db[_0x9cd8('0x37')],'as':_0x9cd8('0x38')}]},_0x3695e8={};_0x3695e8['model']=_['keys'](db[_0x9cd8('0x4f')][_0x9cd8('0x3a')]);_0x3695e8[_0x9cd8('0x3f')]=_[_0x9cd8('0x40')](_0x5ada00['query']);_0x3695e8[_0x9cd8('0x41')]=_[_0x9cd8('0x42')](_0x3695e8['model'],_0x3695e8[_0x9cd8('0x3f')]);_0x5a0808[_0x9cd8('0x43')]=_[_0x9cd8('0x42')](_0x3695e8[_0x9cd8('0x3d')],qs['fields'](_0x5ada00['query'][_0x9cd8('0x44')]));_0x5a0808[_0x9cd8('0x43')]=_0x5a0808[_0x9cd8('0x43')][_0x9cd8('0x45')]?_0x5a0808[_0x9cd8('0x43')]:_0x3695e8[_0x9cd8('0x3d')];if(_0x5ada00[_0x9cd8('0x3f')][_0x9cd8('0x50')]){_0x5a0808[_0x9cd8('0x51')]=[{'all':!![]}];}_0x5a0808=_[_0x9cd8('0x4c')]({},_0x5a0808,_0x5ada00['options']);return db[_0x9cd8('0x4f')][_0x9cd8('0x56')](_0x5a0808)[_0x9cd8('0x21')](handleEntityNotFound(_0x1441d9,null))[_0x9cd8('0x21')](respondWithResult(_0x1441d9,null))[_0x9cd8('0x28')](handleError(_0x1441d9,null));};exports[_0x9cd8('0x57')]=function(_0x315bf6,_0x5382b9){return db[_0x9cd8('0x4f')]['create'](_0x315bf6[_0x9cd8('0x58')],{})[_0x9cd8('0x21')](function(_0x3bc0ba){var _0x16c953=_0x315bf6['user'][_0x9cd8('0x33')]({'plain':!![]});if(!_0x16c953)throw new Error(_0x9cd8('0x59'));if(_0x16c953[_0x9cd8('0x5a')]===_0x9cd8('0x5b')){var _0x49a2b3=_0x3bc0ba['get']({'plain':!![]});var _0x61430b=_0x9cd8('0x5c');return db['UserProfileSection'][_0x9cd8('0x56')]({'where':{'name':_0x61430b,'userProfileId':_0x16c953['userProfileId']},'raw':!![]})[_0x9cd8('0x21')](function(_0x5b9532){if(_0x5b9532&&_0x5b9532['autoAssociation']===0x0){return db['UserProfileResource'][_0x9cd8('0x57')]({'name':_0x49a2b3[_0x9cd8('0x3e')],'resourceId':_0x49a2b3['id'],'type':_0x5b9532[_0x9cd8('0x3e')],'sectionId':_0x5b9532['id']},{})['then'](function(){return _0x3bc0ba;});}else{return _0x3bc0ba;}})[_0x9cd8('0x28')](function(_0x187212){logger[_0x9cd8('0x26')](_0x9cd8('0x5d'),_0x187212);throw _0x187212;});}return _0x3bc0ba;})[_0x9cd8('0x21')](respondWithResult(_0x5382b9,0xc9))[_0x9cd8('0x28')](handleError(_0x5382b9,null));};exports['update']=function(_0x25fc7b,_0x767360){if(_0x25fc7b[_0x9cd8('0x58')]['id']){delete _0x25fc7b[_0x9cd8('0x58')]['id'];}return db[_0x9cd8('0x4f')][_0x9cd8('0x56')]({'where':{'id':_0x25fc7b['params']['id']},'include':[{'model':db[_0x9cd8('0x37')],'as':_0x9cd8('0x38')}]})[_0x9cd8('0x21')](handleEntityNotFound(_0x767360,null))['then'](saveUpdates(_0x25fc7b[_0x9cd8('0x58')],null))['then'](respondWithResult(_0x767360,null))[_0x9cd8('0x28')](handleError(_0x767360,null));};exports[_0x9cd8('0x32')]=function(_0x53534e,_0x179d3f){return db['ChatWebsite'][_0x9cd8('0x56')]({'where':{'id':_0x53534e[_0x9cd8('0x55')]['id']}})[_0x9cd8('0x21')](handleEntityNotFound(_0x179d3f,null))[_0x9cd8('0x21')](removeEntity(_0x179d3f,null))[_0x9cd8('0x28')](handleError(_0x179d3f,null));};exports[_0x9cd8('0x5e')]=function(_0x4d2637,_0x5f053f){return db[_0x9cd8('0x4f')][_0x9cd8('0x5e')]()[_0x9cd8('0x21')](respondWithResult(_0x5f053f,null))['catch'](handleError(_0x5f053f,null));};exports[_0x9cd8('0x5f')]=function(_0x3bf493,_0x3028bb,_0x495fdc){if(_0x3bf493[_0x9cd8('0x58')]['id']){delete _0x3bf493[_0x9cd8('0x58')]['id'];}return db[_0x9cd8('0x4f')][_0x9cd8('0x56')]({'where':{'id':_0x3bf493['params']['id']}})[_0x9cd8('0x21')](handleEntityNotFound(_0x3028bb,null))[_0x9cd8('0x21')](function(_0x1cafdd){if(_0x1cafdd){_0x3bf493[_0x9cd8('0x58')][_0x9cd8('0x60')]=_0x1cafdd['id'];return db['Disposition'][_0x9cd8('0x57')](_0x3bf493['body']);}})[_0x9cd8('0x21')](respondWithResult(_0x3028bb,null))[_0x9cd8('0x28')](handleError(_0x3028bb,null));};exports[_0x9cd8('0x61')]=function(_0x2e87c3,_0x17391a,_0x49a708){var _0x356fb8={'raw':![],'where':{}};var _0x5ac0a9={};var _0xe1891c={'count':0x0,'rows':[]};return db[_0x9cd8('0x4f')][_0x9cd8('0x62')]({'where':{'id':_0x2e87c3['params']['id']}})[_0x9cd8('0x21')](handleEntityNotFound(_0x17391a,null))[_0x9cd8('0x21')](function(_0x3994be){if(_0x3994be){_0x5ac0a9[_0x9cd8('0x3d')]=_[_0x9cd8('0x40')](db[_0x9cd8('0x63')][_0x9cd8('0x3a')]);_0x5ac0a9[_0x9cd8('0x3f')]=_['keys'](_0x2e87c3[_0x9cd8('0x3f')]);_0x5ac0a9[_0x9cd8('0x41')]=_['intersection'](_0x5ac0a9[_0x9cd8('0x3d')],_0x5ac0a9[_0x9cd8('0x3f')]);_0x356fb8[_0x9cd8('0x43')]=_[_0x9cd8('0x42')](_0x5ac0a9[_0x9cd8('0x3d')],qs[_0x9cd8('0x44')](_0x2e87c3[_0x9cd8('0x3f')][_0x9cd8('0x44')]));_0x356fb8[_0x9cd8('0x43')]=_0x356fb8['attributes']['length']?_0x356fb8[_0x9cd8('0x43')]:_0x5ac0a9[_0x9cd8('0x3d')];if(!_0x2e87c3[_0x9cd8('0x3f')][_0x9cd8('0x64')]('nolimit')){_0x356fb8[_0x9cd8('0x2e')]=qs[_0x9cd8('0x2e')](_0x2e87c3[_0x9cd8('0x3f')][_0x9cd8('0x2e')]);_0x356fb8['offset']=qs[_0x9cd8('0x47')](_0x2e87c3['query']['offset']);}_0x356fb8['order']=qs[_0x9cd8('0x48')](_0x2e87c3[_0x9cd8('0x3f')]['sort']);_0x356fb8[_0x9cd8('0x49')]=qs[_0x9cd8('0x41')](_[_0x9cd8('0x4a')](_0x2e87c3[_0x9cd8('0x3f')],_0x5ac0a9[_0x9cd8('0x41')]));_0x356fb8[_0x9cd8('0x49')]['ChatWebsiteId']=_0x3994be['id'];if(_0x2e87c3[_0x9cd8('0x3f')][_0x9cd8('0x4b')]){_0x356fb8['where']=_[_0x9cd8('0x4c')](_0x356fb8[_0x9cd8('0x49')],{'$or':_['map'](_0x356fb8['attributes'],function(_0x3b9e84){var _0x458831={};_0x458831[_0x3b9e84]={'$like':'%'+_0x2e87c3[_0x9cd8('0x3f')]['filter']+'%'};return _0x458831;})});}_0x356fb8=_[_0x9cd8('0x4c')]({},_0x356fb8,_0x2e87c3['options']);return db[_0x9cd8('0x63')][_0x9cd8('0x2d')]({'where':_0x356fb8[_0x9cd8('0x49')]})[_0x9cd8('0x21')](function(_0x1094cb){_0xe1891c['count']=_0x1094cb;if(_0x2e87c3[_0x9cd8('0x3f')][_0x9cd8('0x50')]){_0x356fb8[_0x9cd8('0x51')]=[{'all':!![]}];}return db['Disposition'][_0x9cd8('0x52')](_0x356fb8);})['then'](function(_0x22a381){_0xe1891c[_0x9cd8('0x53')]=_0x22a381;return _0xe1891c;});}})['then'](respondWithFilteredResult(_0x17391a,_0x356fb8))[_0x9cd8('0x28')](handleError(_0x17391a,null));};exports['removeDispositions']=function(_0x2de1dc,_0x21316b,_0x12e558){return db[_0x9cd8('0x4f')]['find']({'where':{'id':_0x2de1dc[_0x9cd8('0x55')]['id']}})['then'](handleEntityNotFound(_0x21316b,null))[_0x9cd8('0x21')](function(_0xa39a0d){if(_0xa39a0d){return _0xa39a0d[_0x9cd8('0x65')](_0x2de1dc[_0x9cd8('0x3f')][_0x9cd8('0x66')]);}})['then'](respondWithStatusCode(_0x21316b,null))[_0x9cd8('0x28')](handleError(_0x21316b,null));};exports[_0x9cd8('0x67')]=function(_0x97e5d6,_0x4c4d8f,_0x439d2d){if(_0x97e5d6[_0x9cd8('0x58')]['id']){delete _0x97e5d6[_0x9cd8('0x58')]['id'];}return db[_0x9cd8('0x4f')]['find']({'where':{'id':_0x97e5d6['params']['id']}})['then'](handleEntityNotFound(_0x4c4d8f,null))[_0x9cd8('0x21')](function(_0x2effd2){if(_0x2effd2){_0x97e5d6[_0x9cd8('0x58')][_0x9cd8('0x60')]=_0x2effd2['id'];return db[_0x9cd8('0x68')][_0x9cd8('0x57')](_0x97e5d6[_0x9cd8('0x58')]);}})['then'](respondWithResult(_0x4c4d8f,null))[_0x9cd8('0x28')](handleError(_0x4c4d8f,null));};exports[_0x9cd8('0x69')]=function(_0x8a03b1,_0x3f1e18,_0x478e73){var _0xfdeb4={'raw':![],'where':{}};var _0x238f85={};var _0x173d7a={'count':0x0,'rows':[]};return db['ChatWebsite'][_0x9cd8('0x62')]({'where':{'id':_0x8a03b1[_0x9cd8('0x55')]['id']}})[_0x9cd8('0x21')](handleEntityNotFound(_0x3f1e18,null))[_0x9cd8('0x21')](function(_0x3e6aee){if(_0x3e6aee){_0x238f85['model']=_[_0x9cd8('0x40')](db['CannedAnswer'][_0x9cd8('0x3a')]);_0x238f85['query']=_['keys'](_0x8a03b1[_0x9cd8('0x3f')]);_0x238f85[_0x9cd8('0x41')]=_['intersection'](_0x238f85['model'],_0x238f85[_0x9cd8('0x3f')]);_0xfdeb4[_0x9cd8('0x43')]=_['intersection'](_0x238f85['model'],qs[_0x9cd8('0x44')](_0x8a03b1[_0x9cd8('0x3f')][_0x9cd8('0x44')]));_0xfdeb4[_0x9cd8('0x43')]=_0xfdeb4['attributes']['length']?_0xfdeb4[_0x9cd8('0x43')]:_0x238f85[_0x9cd8('0x3d')];if(!_0x8a03b1['query'][_0x9cd8('0x64')](_0x9cd8('0x46'))){_0xfdeb4[_0x9cd8('0x2e')]=qs[_0x9cd8('0x2e')](_0x8a03b1[_0x9cd8('0x3f')]['limit']);_0xfdeb4['offset']=qs[_0x9cd8('0x47')](_0x8a03b1[_0x9cd8('0x3f')][_0x9cd8('0x47')]);}_0xfdeb4[_0x9cd8('0x6a')]=qs[_0x9cd8('0x48')](_0x8a03b1[_0x9cd8('0x3f')][_0x9cd8('0x48')]);_0xfdeb4['where']=qs[_0x9cd8('0x41')](_[_0x9cd8('0x4a')](_0x8a03b1[_0x9cd8('0x3f')],_0x238f85['filters']));_0xfdeb4['where'][_0x9cd8('0x60')]=_0x3e6aee['id'];if(_0x8a03b1[_0x9cd8('0x3f')][_0x9cd8('0x4b')]){_0xfdeb4[_0x9cd8('0x49')]=_[_0x9cd8('0x4c')](_0xfdeb4['where'],{'$or':_[_0x9cd8('0x39')](_0xfdeb4[_0x9cd8('0x43')],function(_0x327eab){var _0x4496b2={};_0x4496b2[_0x327eab]={'$like':'%'+_0x8a03b1[_0x9cd8('0x3f')]['filter']+'%'};return _0x4496b2;})});}_0xfdeb4=_[_0x9cd8('0x4c')]({},_0xfdeb4,_0x8a03b1['options']);return db[_0x9cd8('0x68')][_0x9cd8('0x2d')]({'where':_0xfdeb4[_0x9cd8('0x49')]})['then'](function(_0x5d32a7){_0x173d7a[_0x9cd8('0x2d')]=_0x5d32a7;if(_0x8a03b1[_0x9cd8('0x3f')][_0x9cd8('0x50')]){_0xfdeb4['include']=[{'all':!![]}];}return db[_0x9cd8('0x68')][_0x9cd8('0x52')](_0xfdeb4);})['then'](function(_0x22e2dd){_0x173d7a[_0x9cd8('0x53')]=_0x22e2dd;return _0x173d7a;});}})['then'](respondWithFilteredResult(_0x3f1e18,_0xfdeb4))[_0x9cd8('0x28')](handleError(_0x3f1e18,null));};exports['removeAnswers']=function(_0x38009c,_0x1a6939,_0x38dfc1){return db['ChatWebsite']['find']({'where':{'id':_0x38009c[_0x9cd8('0x55')]['id']}})[_0x9cd8('0x21')](handleEntityNotFound(_0x1a6939,null))[_0x9cd8('0x21')](function(_0x45b164){if(_0x45b164){return _0x45b164[_0x9cd8('0x6b')](_0x38009c[_0x9cd8('0x3f')][_0x9cd8('0x66')]);}})[_0x9cd8('0x21')](respondWithStatusCode(_0x1a6939,null))[_0x9cd8('0x28')](handleError(_0x1a6939,null));};exports[_0x9cd8('0x6c')]=function(_0x5a065a,_0x580c65,_0x422329){_0x5a065a[_0x9cd8('0x58')]['sitepic']=_0x5a065a[_0x9cd8('0x6d')]['filename'];return db['ChatWebsite'][_0x9cd8('0x56')]({'where':{'id':_0x5a065a['params']['id']}})[_0x9cd8('0x21')](handleEntityNotFound(_0x580c65,null))[_0x9cd8('0x21')](saveUpdates(_0x5a065a[_0x9cd8('0x58')],null))[_0x9cd8('0x21')](respondWithResult(_0x580c65,null))[_0x9cd8('0x28')](handleError(_0x580c65,null));};exports['addAvatar']=function(_0x2ce955,_0x21c308,_0x37be74){_0x2ce955[_0x9cd8('0x58')][_0x9cd8('0x6e')]=_0x2ce955['file'][_0x9cd8('0x6f')];return db[_0x9cd8('0x4f')][_0x9cd8('0x56')]({'where':{'id':_0x2ce955[_0x9cd8('0x55')]['id']}})['then'](handleEntityNotFound(_0x21c308,null))['then'](saveUpdates(_0x2ce955['body'],null))['then'](respondWithResult(_0x21c308,null))[_0x9cd8('0x28')](handleError(_0x21c308,null));};exports[_0x9cd8('0x70')]=function(_0x31fc56,_0xbcfdd9,_0x19419c){_0x31fc56['body']['customerAvatar']=_0x31fc56[_0x9cd8('0x6d')][_0x9cd8('0x6f')];return db['ChatWebsite'][_0x9cd8('0x56')]({'where':{'id':_0x31fc56['params']['id']}})[_0x9cd8('0x21')](handleEntityNotFound(_0xbcfdd9,null))[_0x9cd8('0x21')](saveUpdates(_0x31fc56['body'],null))[_0x9cd8('0x21')](respondWithResult(_0xbcfdd9,null))[_0x9cd8('0x28')](handleError(_0xbcfdd9,null));};exports[_0x9cd8('0x71')]=function(_0xd7267,_0x3fcaac,_0x2718b0){_0xd7267['body']['systemAvatar']=_0xd7267[_0x9cd8('0x6d')][_0x9cd8('0x6f')];return db['ChatWebsite'][_0x9cd8('0x56')]({'where':{'id':_0xd7267[_0x9cd8('0x55')]['id']}})[_0x9cd8('0x21')](handleEntityNotFound(_0x3fcaac,null))[_0x9cd8('0x21')](saveUpdates(_0xd7267[_0x9cd8('0x58')],null))[_0x9cd8('0x21')](respondWithResult(_0x3fcaac,null))[_0x9cd8('0x28')](handleError(_0x3fcaac,null));};exports[_0x9cd8('0x72')]=function(_0x347f9c,_0x4bfab6,_0x2577a5){var _0x265895=path[_0x9cd8('0x73')](config['root'],_0x9cd8('0x74'));var _0x408b6d={'where':{'id':_0x347f9c[_0x9cd8('0x55')]['id']},'attributes':['id','sitepic'],'raw':!![]};var _0x5944f4=![];return require(_0x9cd8('0x75'))[_0x9cd8('0x76')]()['then'](function(_0x71947){if(_0x71947){_0x5944f4=_0x71947[_0x9cd8('0x77')];}})[_0x9cd8('0x21')](function(){return db['ChatWebsite'][_0x9cd8('0x56')](_0x408b6d);})[_0x9cd8('0x21')](handleEntityNotFound(_0x4bfab6,null))[_0x9cd8('0x21')](function(_0x548837){if(_0x548837){if(!_[_0x9cd8('0x78')](_0x548837[_0x9cd8('0x79')])){if(fs[_0x9cd8('0x7a')](path['join'](config['root'],_0x9cd8('0x7b'),_0x548837[_0x9cd8('0x79')]))&&_0x5944f4){_0x265895=path['join'](config[_0x9cd8('0x7c')],_0x9cd8('0x7b'),_0x548837[_0x9cd8('0x79')]);}}return _0x4bfab6[_0x9cd8('0x7d')](_0x265895);}})[_0x9cd8('0x28')](handleError(_0x4bfab6,null));};exports[_0x9cd8('0x7e')]=function(_0x413da2,_0x504332,_0x16f057){var _0x1f7315=path[_0x9cd8('0x73')](config['root'],'server/files/images/avatars/default_avatar.png');var _0x489e74={'where':{'id':_0x413da2[_0x9cd8('0x55')]['id']},'attributes':['id',_0x9cd8('0x6e')],'raw':!![]};return db[_0x9cd8('0x4f')][_0x9cd8('0x56')](_0x489e74)['then'](handleEntityNotFound(_0x504332,null))['then'](function(_0x522093){if(_0x522093){if(!_[_0x9cd8('0x78')](_0x522093[_0x9cd8('0x6e')])){if(fs[_0x9cd8('0x7a')](path[_0x9cd8('0x73')](config[_0x9cd8('0x7c')],_0x9cd8('0x7f'),_0x522093['agentAvatar']))){_0x1f7315=path[_0x9cd8('0x73')](config['root'],_0x9cd8('0x7f'),_0x522093[_0x9cd8('0x6e')]);}}return _0x504332['download'](_0x1f7315);}})['catch'](handleError(_0x504332,null));};exports[_0x9cd8('0x80')]=function(_0x22d184,_0x46a11a,_0x289f5a){var _0x33c66c=path[_0x9cd8('0x73')](config['root'],_0x9cd8('0x81'));var _0x464aca={'where':{'id':_0x22d184[_0x9cd8('0x55')]['id']},'attributes':['id',_0x9cd8('0x82'),_0x9cd8('0x83')],'raw':!![]};return db[_0x9cd8('0x4f')][_0x9cd8('0x56')](_0x464aca)[_0x9cd8('0x21')](handleEntityNotFound(_0x46a11a,null))[_0x9cd8('0x21')](function(_0x3262a1){if(_0x3262a1){if(!_[_0x9cd8('0x78')](_0x3262a1[_0x9cd8('0x82')])){if(fs[_0x9cd8('0x7a')](path['join'](config[_0x9cd8('0x7c')],'server/files/images/avatars/',_0x3262a1['customerAvatar']))&&_0x3262a1['showCustomerAvatar']){_0x33c66c=path['join'](config[_0x9cd8('0x7c')],_0x9cd8('0x7f'),_0x3262a1[_0x9cd8('0x82')]);}}return _0x46a11a[_0x9cd8('0x7d')](_0x33c66c);}})[_0x9cd8('0x28')](handleError(_0x46a11a,null));};exports[_0x9cd8('0x84')]=function(_0x50e752,_0x5be84b,_0x129089){var _0x3b632f=path[_0x9cd8('0x73')](config[_0x9cd8('0x7c')],'server/files/images/avatars/system_avatar.png');var _0xb898f2={'where':{'id':_0x50e752[_0x9cd8('0x55')]['id']},'attributes':['id',_0x9cd8('0x85')],'raw':!![]};return db[_0x9cd8('0x4f')][_0x9cd8('0x56')](_0xb898f2)['then'](handleEntityNotFound(_0x5be84b,null))[_0x9cd8('0x21')](function(_0x41f74f){if(_0x41f74f){if(!_[_0x9cd8('0x78')](_0x41f74f['systemAvatar'])){if(fs[_0x9cd8('0x7a')](path[_0x9cd8('0x73')](config[_0x9cd8('0x7c')],_0x9cd8('0x7f'),_0x41f74f[_0x9cd8('0x85')]))){_0x3b632f=path['join'](config[_0x9cd8('0x7c')],_0x9cd8('0x7f'),_0x41f74f['systemAvatar']);}}return _0x5be84b[_0x9cd8('0x7d')](_0x3b632f);}})[_0x9cd8('0x28')](handleError(_0x5be84b,null));};exports[_0x9cd8('0x86')]=function(_0x1d3066,_0x4ce01c,_0x5af59c){var _0x2db4b0=require('user-agent-parser');var _0x1d1025=new _0x2db4b0();var _0x2d1491=_0x1d1025[_0x9cd8('0x87')](_0x1d3066[_0x9cd8('0x88')][_0x9cd8('0x89')])[_0x9cd8('0x8a')]();var _0x561b9d={'body':_0x1d3066[_0x9cd8('0x58')],'channel':'chat'};var _0x336df1=[];var _0xe1c04b=[];var _0x31d1ea={};var _0x3033f4=![];return db['CmContact'][_0x9cd8('0x5e')]()[_0x9cd8('0x21')](function(_0x23ec3b){if(!_0x23ec3b){throw new db[(_0x9cd8('0x1d'))][(_0x9cd8('0x1e'))](_0x9cd8('0x8b'));}_0x336df1=_[_0x9cd8('0x8c')](_[_0x9cd8('0x40')](_0x23ec3b),[_0x9cd8('0x8d'),_0x9cd8('0x8e')]);_0xe1c04b=_[_0x9cd8('0x8c')](_[_0x9cd8('0x40')](_0x23ec3b),[_0x9cd8('0x8d'),'updatedAt',_0x9cd8('0x8f'),'ListId']);if(_0x1d3066[_0x9cd8('0x58')]['id']){delete _0x1d3066[_0x9cd8('0x58')]['id'];}if(_['isNil'](_0x1d3066[_0x9cd8('0x58')][_0x9cd8('0x90')])){throw new db['Sequelize'][(_0x9cd8('0x1e'))](_0x9cd8('0x91'));}if(_['isNil'](_0x1d3066[_0x9cd8('0x58')]['body'])||_0x1d3066[_0x9cd8('0x58')][_0x9cd8('0x58')]===''){throw new db[(_0x9cd8('0x1d'))][(_0x9cd8('0x1e'))](_0x9cd8('0x92'));}if(_[_0x9cd8('0x78')](_0x1d3066[_0x9cd8('0x58')]['mapKey'])){throw new db[(_0x9cd8('0x1d'))][(_0x9cd8('0x1e'))](_0x9cd8('0x93')+_0xe1c04b);}if(!_[_0x9cd8('0x94')](_0xe1c04b,_0x1d3066[_0x9cd8('0x58')][_0x9cd8('0x95')])){throw new db[(_0x9cd8('0x1d'))][(_0x9cd8('0x1e'))](_0x9cd8('0x96')+_0xe1c04b);}_0x31d1ea[_0x1d3066[_0x9cd8('0x58')][_0x9cd8('0x95')]]=_0x1d3066[_0x9cd8('0x58')]['from'];})[_0x9cd8('0x21')](function(){return db[_0x9cd8('0x4f')][_0x9cd8('0x56')]({'where':{'id':_0x1d3066[_0x9cd8('0x55')]['id']},'include':[{'model':db[_0x9cd8('0x97')],'as':_0x9cd8('0x98'),'include':[{'model':db[_0x9cd8('0x99')],'as':'Contacts','where':_0x31d1ea,'limit':0x1,'order':[[_0x9cd8('0x8e'),_0x9cd8('0x9a')]]}]},{'model':db['ChatApplication'],'as':_0x9cd8('0x9b')}]});})['then'](handleEntityNotFound(_0x4ce01c,null))['then'](function(_0x30fb6e){if(_0x30fb6e&&_0x30fb6e[_0x9cd8('0x98')]){_0x561b9d[_0x9cd8('0x9c')]=_0x30fb6e;_0x561b9d[_0x9cd8('0x9d')]=_0x30fb6e[_0x9cd8('0x9b')];_0x561b9d[_0x9cd8('0x9e')]=_0x30fb6e['List'];_0x561b9d[_0x9cd8('0x9d')]=_['orderBy'](_0x561b9d[_0x9cd8('0x9d')],['priority'],[_0x9cd8('0x9f')]);if(_0x561b9d['account'][_0x9cd8('0x9b')]){delete _0x561b9d['account'][_0x9cd8('0x9b')];}if(_0x561b9d[_0x9cd8('0x9c')]['List']&&_0x561b9d[_0x9cd8('0x9c')][_0x9cd8('0x98')]['Contacts'][_0x9cd8('0x45')]){return _0x561b9d['account'][_0x9cd8('0x98')][_0x9cd8('0xa0')][0x0];}var _0x3fe13f=_[_0x9cd8('0xa1')](_0x1d3066[_0x9cd8('0x58')],{'firstName':_0x1d3066['body']['from'],'ListId':_0x30fb6e[_0x9cd8('0xa2')]});_0x3fe13f[_0x1d3066[_0x9cd8('0x58')][_0x9cd8('0x95')]]=_0x1d3066['body'][_0x9cd8('0x90')];return db[_0x9cd8('0x99')]['create'](_0x3fe13f,{'fields':_0x336df1,'raw':!![]});}})[_0x9cd8('0x21')](handleEntityNotFound(_0x4ce01c,null))['then'](function(_0x16402d){_0x561b9d[_0x9cd8('0xa3')]=_0x16402d;var _0x3ca282=_0x1d3066[_0x9cd8('0x58')][_0x9cd8('0xa4')];if(_0x1d3066[_0x9cd8('0x88')][_0x9cd8('0xa5')]){_0x3ca282=_0x1d3066[_0x9cd8('0x88')]['cf-connecting-ip'];}else if(_0x1d3066[_0x9cd8('0x88')]['x-forwarded-for']){_0x3ca282=_[_0x9cd8('0xa6')](_0x1d3066[_0x9cd8('0x88')][_0x9cd8('0xa7')][_0x9cd8('0xa8')](','));}if(_0x16402d){var _0x450bf8={'ContactId':_0x16402d['id'],'ChatWebsiteId':_0x1d3066['params']['id'],'from':(_0x16402d[_0x9cd8('0xa9')]||'')+'\x20'+(_0x16402d[_0x9cd8('0xaa')]||''),'customerIp':_0x3ca282,'customerPort':_0x1d3066[_0x9cd8('0x88')][_0x9cd8('0xab')]?_0x1d3066[_0x9cd8('0x88')][_0x9cd8('0xab')]:null,'referer':_0x1d3066[_0x9cd8('0x58')][_0x9cd8('0xac')],'browserName':_0x2d1491[_0x9cd8('0xad')][_0x9cd8('0x3e')]&&_0x2d1491['browser'][_0x9cd8('0xae')]?util['format'](_0x9cd8('0xaf'),_0x2d1491[_0x9cd8('0xad')][_0x9cd8('0x3e')],_0x2d1491[_0x9cd8('0xad')][_0x9cd8('0xae')]):_0x9cd8('0xb0'),'browserVersion':_0x2d1491[_0x9cd8('0xad')][_0x9cd8('0xae')]||_0x9cd8('0xb0'),'osName':util[_0x9cd8('0xb1')](_0x9cd8('0xaf'),_0x2d1491['os'][_0x9cd8('0x3e')],_0x2d1491['os'][_0x9cd8('0xae')]),'osVersion':_0x2d1491['os'][_0x9cd8('0xae')],'deviceModel':_0x2d1491[_0x9cd8('0xb2')]['model']&&_0x2d1491[_0x9cd8('0xb2')][_0x9cd8('0xb3')]?util[_0x9cd8('0xb1')](_0x9cd8('0xb4'),_0x2d1491['device']['model'],_0x2d1491[_0x9cd8('0xb2')]['vendor'],_0x2d1491['device']['type']):null,'deviceVendor':_0x2d1491[_0x9cd8('0xb2')][_0x9cd8('0xb3')],'deviceType':_0x2d1491[_0x9cd8('0xb2')][_0x9cd8('0x3c')],'formData':JSON[_0x9cd8('0xb5')](_0x1d3066[_0x9cd8('0x58')])};var _0x26b3ad={'ChatWebsiteId':_0x1d3066['params']['id'],'closed':![]};if(_0x1d3066[_0x9cd8('0x58')][_0x9cd8('0xb6')]){_0x26b3ad[_0x9cd8('0xb6')]=_0x1d3066['body']['threadId'];return db[_0x9cd8('0xb7')][_0x9cd8('0x56')]({'where':_0x26b3ad})[_0x9cd8('0x21')](function(_0x1a9fff){if(_0x1a9fff){return[_0x1a9fff,![]];}_0x450bf8['threadId']=_0x1d3066['body'][_0x9cd8('0xb6')];_0x450bf8['externalUrl']=_0x1d3066['body'][_0x9cd8('0xb8')];return db[_0x9cd8('0xb7')][_0x9cd8('0x57')](_0x450bf8)[_0x9cd8('0x21')](function(_0x246480){return[_0x246480,!![]];});});}_0x26b3ad[_0x9cd8('0xb9')]=_0x16402d['id'];if(_0x1d3066[_0x9cd8('0x58')][_0x9cd8('0xba')]&&_0x1d3066[_0x9cd8('0x58')][_0x9cd8('0xba')]['id']){_0x26b3ad['id']=_0x1d3066[_0x9cd8('0x58')]['interaction']['id'];return db[_0x9cd8('0xb7')][_0x9cd8('0x56')]({'where':_0x26b3ad})['then'](function(_0x8cd0fc){if(_0x8cd0fc){return[_0x8cd0fc,![]];}return db[_0x9cd8('0xb7')][_0x9cd8('0x57')](_0x450bf8)[_0x9cd8('0x21')](function(_0x434e9e){return[_0x434e9e,!![]];});});}return db[_0x9cd8('0xb7')][_0x9cd8('0x57')](_0x450bf8)['then'](function(_0x1f4c09){return[_0x1f4c09,!![]];});}})[_0x9cd8('0xbb')](function(_0x1a8c47,_0x88fe0e){if(_0x1a8c47){_0x3033f4=_0x88fe0e;if(!_0x88fe0e){var _0xc3a323={'from':(_0x561b9d[_0x9cd8('0xa3')][_0x9cd8('0xa9')]||'')+'\x20'+(_0x561b9d['contact'][_0x9cd8('0xaa')]||'')};if(_0x1d3066['body'][_0x9cd8('0xb6')]&&_0x1d3066[_0x9cd8('0x58')]['messageId']&&_0x1d3066[_0x9cd8('0x58')][_0x9cd8('0xb6')]!=_0x1d3066[_0x9cd8('0x58')][_0x9cd8('0xbc')]){_0xc3a323[_0x9cd8('0xb6')]=_0x1d3066[_0x9cd8('0x58')][_0x9cd8('0xbc')];}return _0x1a8c47[_0x9cd8('0xbd')](_0xc3a323);}else{return _0x1a8c47;}}})[_0x9cd8('0x21')](function(_0x493b8e){_0x561b9d[_0x9cd8('0xba')]=_0x493b8e[_0x9cd8('0x33')]({'plain':!![]});_0x561b9d[_0x9cd8('0xba')][_0x9cd8('0xbe')]=_0x3033f4;if(_0x561b9d[_0x9cd8('0xba')][_0x9cd8('0xbe')]){if(_0x561b9d[_0x9cd8('0x9c')]['autoclose']){_0x561b9d[_0x9cd8('0x9d')]['push']({'id':0x0,'priority':_0x561b9d[_0x9cd8('0x9d')][_0x9cd8('0x45')]+0x1,'app':_0x9cd8('0xbf'),'appdata':_0x9cd8('0xc0'),'interval':_0x9cd8('0xc1')});}}return db['ChatMessage'][_0x9cd8('0x57')]({'body':_0x1d3066['body']['body'],'ChatWebsiteId':_0x1d3066[_0x9cd8('0x55')]['id'],'ChatInteractionId':_0x493b8e['id'],'direction':'in','ContactId':_0x561b9d['contact']['id'],'AttachmentId':_0x1d3066[_0x9cd8('0x58')][_0x9cd8('0xc2')]});})[_0x9cd8('0x21')](function(_0x639475){_0x561b9d[_0x9cd8('0x27')]=_0x639475;if(_0x561b9d[_0x9cd8('0xba')][_0x9cd8('0xc3')]){return db[_0x9cd8('0xc4')][_0x9cd8('0x56')]({'attributes':['id',_0x9cd8('0x3e')],'where':{'id':_0x561b9d['interaction'][_0x9cd8('0xc3')]}})['then'](function(_0x418b09){if(_0x418b09){_0x561b9d[_0x9cd8('0x9d')][_0x9cd8('0xc5')]({'id':0x0,'priority':0x0,'app':_0x9cd8('0xc6'),'appdata':_0x418b09[_0x9cd8('0x3e')]+','+(_0x561b9d[_0x9cd8('0x9c')][_0x9cd8('0xc7')]||0xa),'interval':'*,*,*,*'});_0x561b9d[_0x9cd8('0xc8')]=!![];}return respondWithRpcPromise('Start',_0x9cd8('0xc9'),_0x561b9d);});}return respondWithRpcPromise(_0x9cd8('0xca'),_0x9cd8('0xc9'),_0x561b9d);})[_0x9cd8('0x21')](function(_0x1f79f2){respondWithRpcPromise(_0x9cd8('0xcb'),_0x9cd8('0xcb'),{'event':_0x9cd8('0x86'),'message':_0x1f79f2},client9002);return _0x1f79f2;})['then'](respondWithResult(_0x4ce01c,null))[_0x9cd8('0x28')](handleError(_0x4ce01c,null));};exports[_0x9cd8('0xcc')]=function(_0x1bc1d7,_0x102809,_0x5777d9){var _0xaabf64,_0x5bfb0b,_0x4b9b3c;var _0x1761cc=[];var _0x51e689=[];var _0x55b095={};return db[_0x9cd8('0x99')][_0x9cd8('0x5e')]()[_0x9cd8('0x21')](function(_0x2f94d2){if(!_0x2f94d2){throw new db[(_0x9cd8('0x1d'))][(_0x9cd8('0x1e'))]('no\x20available\x20attributes');}_0x51e689=_[_0x9cd8('0x8c')](_[_0x9cd8('0x40')](_0x2f94d2),[_0x9cd8('0x8d'),'updatedAt']);_0x1761cc=_[_0x9cd8('0x8c')](_[_0x9cd8('0x40')](_0x2f94d2),[_0x9cd8('0x8d'),'updatedAt',_0x9cd8('0x8f'),_0x9cd8('0xa2')]);if(_0x1bc1d7[_0x9cd8('0x58')]['id']){delete _0x1bc1d7[_0x9cd8('0x58')]['id'];}if(_[_0x9cd8('0x78')](_0x1bc1d7[_0x9cd8('0x58')][_0x9cd8('0x90')])){throw _0x102809[_0x9cd8('0x2b')](0x1f4)[_0x9cd8('0x35')](new db[(_0x9cd8('0x1d'))][(_0x9cd8('0x1e'))](_0x9cd8('0x91')));}if(_[_0x9cd8('0x78')](_0x1bc1d7[_0x9cd8('0x58')]['body'])||_0x1bc1d7[_0x9cd8('0x58')][_0x9cd8('0x58')]===''){throw _0x102809[_0x9cd8('0x2b')](0x1f4)['send'](new db[(_0x9cd8('0x1d'))][(_0x9cd8('0x1e'))](_0x9cd8('0x92')));}if(_[_0x9cd8('0x78')](_0x1bc1d7[_0x9cd8('0x58')][_0x9cd8('0xcd')])){throw _0x102809['status'](0x1f4)['send'](new db[(_0x9cd8('0x1d'))][(_0x9cd8('0x1e'))](_0x9cd8('0xce')+_0x1761cc));}if(!_[_0x9cd8('0x94')](_0x1761cc,_0x1bc1d7['body'][_0x9cd8('0xcd')])){throw _0x102809[_0x9cd8('0x2b')](0x1f4)[_0x9cd8('0x35')](new db[(_0x9cd8('0x1d'))][(_0x9cd8('0x1e'))](_0x9cd8('0xcf')+_0x1761cc));}_0x55b095[_0x1bc1d7['body']['mapKeyOffline']]=_0x1bc1d7[_0x9cd8('0x58')][_0x9cd8('0x90')];})[_0x9cd8('0x21')](function(){return db[_0x9cd8('0x4f')][_0x9cd8('0x56')]({'where':{'id':_0x1bc1d7[_0x9cd8('0x55')]['id']},'include':[{'model':db[_0x9cd8('0x97')],'as':_0x9cd8('0x98')}]});})['then'](handleEntityNotFound(_0x102809,null))[_0x9cd8('0x21')](function(_0x5dbb6a){if(_0x5dbb6a&&_0x5dbb6a['List']){_0x5bfb0b=_0x5dbb6a;var _0x1e6d76=_[_0x9cd8('0xa1')](_0x1bc1d7[_0x9cd8('0x58')],{'firstName':_0x1bc1d7[_0x9cd8('0x58')][_0x9cd8('0x90')],'phone':_0x1bc1d7[_0x9cd8('0x58')][_0x9cd8('0x90')],'ListId':_0x5dbb6a[_0x9cd8('0xa2')]});_0x1e6d76[_0x1bc1d7[_0x9cd8('0x58')][_0x9cd8('0xcd')]]=_0x1bc1d7[_0x9cd8('0x58')][_0x9cd8('0x90')];return db[_0x9cd8('0x99')][_0x9cd8('0xd0')]({'where':_0x55b095,'defaults':_0x1e6d76});}})[_0x9cd8('0xbb')](function(_0x303afe){if(_0x303afe){_0x4b9b3c=_0x303afe;var _0x2e96ed=fs['readFileSync'](path[_0x9cd8('0x73')](config[_0x9cd8('0x7c')],_0x9cd8('0xd1')),'utf8');var _0x38778f=ejs['render'](_0x2e96ed,{'body':_[_0x9cd8('0xd2')](_0x1bc1d7[_0x9cd8('0x58')][_0x9cd8('0x58')]),'bodyTitle':_0x5bfb0b['offlineMessageBody']});return db[_0x9cd8('0xd3')][_0x9cd8('0x57')]({'body':_0x38778f,'ContactId':_0x303afe['id'],'ChatWebsiteId':_0x5bfb0b['id']});}})[_0x9cd8('0x21')](function(_0x4cd014){if(_0x4cd014){_0xaabf64=_0x4cd014;return db[_0x9cd8('0xd4')][_0x9cd8('0x62')]({'where':{'service':!![]},'include':[{'model':db[_0x9cd8('0xd5')],'as':_0x9cd8('0xd6'),'raw':!![]}]});}})[_0x9cd8('0x21')](function(_0x41f6ee){if(_0x41f6ee&&_0x41f6ee[_0x9cd8('0xd6')]&&_0x5bfb0b[_0x9cd8('0xd7')]){var _0x199e65={'tls':{'rejectUnauthorized':![]}};if(_0x41f6ee[_0x9cd8('0xd6')][_0x9cd8('0xd8')]){_0x199e65[_0x9cd8('0xd8')]=_0x41f6ee['Smtp']['service'];}else{_0x199e65[_0x9cd8('0xd9')]=_0x41f6ee[_0x9cd8('0xd6')][_0x9cd8('0xd9')];_0x199e65[_0x9cd8('0xda')]=_0x41f6ee[_0x9cd8('0xd6')][_0x9cd8('0xda')];_0x199e65[_0x9cd8('0xdb')]=_0x41f6ee[_0x9cd8('0xd6')][_0x9cd8('0xdb')];}if(_0x41f6ee[_0x9cd8('0xd6')][_0x9cd8('0xdc')]){_0x199e65[_0x9cd8('0xdd')]={'user':_0x41f6ee[_0x9cd8('0xd6')]['user'],'pass':_0x41f6ee[_0x9cd8('0xd6')][_0x9cd8('0xde')]};}return respondWithRpcPromise(_0x9cd8('0xdf'),_0x9cd8('0xe0'),{'account':_0x199e65,'message':{'from':util['format'](_0x9cd8('0xe1'),_0x41f6ee[_0x9cd8('0x3e')],_0x41f6ee[_0x9cd8('0xe2')]||_0x41f6ee[_0x9cd8('0xd6')][_0x9cd8('0x5b')]),'to':_0x5bfb0b[_0x9cd8('0xd7')],'subject':_0x5bfb0b['offlineMessageSubject'],'text':_0xaabf64[_0x9cd8('0x58')]}},client9003)[_0x9cd8('0x21')](function(){return _0xaabf64;})[_0x9cd8('0x28')](function(_0x5b9497){console['error'](_0x5b9497);});}})[_0x9cd8('0x21')](function(){if(_0xaabf64){return _0xaabf64;}})[_0x9cd8('0x21')](respondWithResult(_0x102809,null))[_0x9cd8('0x28')](handleError(_0x102809,null));};exports['addInteraction']=function(_0x41be5a,_0x15e715,_0x47475c){return db['ChatInteraction'][_0x9cd8('0x56')]({'where':{'id':_0x41be5a[_0x9cd8('0x55')]['id']}})[_0x9cd8('0x21')](handleEntityNotFound(_0x15e715,null))[_0x9cd8('0x21')](function(_0x48ec7e){if(_0x48ec7e){return _0x48ec7e[_0x9cd8('0xe3')](_0x41be5a[_0x9cd8('0x58')][_0x9cd8('0x66')],_[_0x9cd8('0xe4')](_0x41be5a[_0x9cd8('0x58')],[_0x9cd8('0x66'),'id'])||{});}})['then'](respondWithResult(_0x15e715,null))[_0x9cd8('0x28')](handleError(_0x15e715,null));};exports['getInteractions']=function(_0x3c4bff,_0x211d48,_0xccba44){var _0x999246={'raw':![],'where':{}};var _0x679e36={};var _0x1306de={'count':0x0,'rows':[]};return db[_0x9cd8('0x4f')][_0x9cd8('0x62')]({'where':{'id':_0x3c4bff['params']['id']}})[_0x9cd8('0x21')](handleEntityNotFound(_0x211d48,null))[_0x9cd8('0x21')](function(_0x408bf8){if(_0x408bf8){_0x679e36[_0x9cd8('0x3d')]=_['keys'](db[_0x9cd8('0xb7')][_0x9cd8('0x3a')]);_0x679e36[_0x9cd8('0x3f')]=_[_0x9cd8('0x40')](_0x3c4bff[_0x9cd8('0x3f')]);_0x679e36[_0x9cd8('0x41')]=_['intersection'](_0x679e36[_0x9cd8('0x3d')],_0x679e36[_0x9cd8('0x3f')]);_0x999246[_0x9cd8('0x43')]=_[_0x9cd8('0x42')](_0x679e36['model'],qs['fields'](_0x3c4bff[_0x9cd8('0x3f')][_0x9cd8('0x44')]));_0x999246[_0x9cd8('0x43')]=_0x999246[_0x9cd8('0x43')][_0x9cd8('0x45')]?_0x999246[_0x9cd8('0x43')]:_0x679e36[_0x9cd8('0x3d')];if(!_0x3c4bff['query']['hasOwnProperty']('nolimit')){_0x999246['limit']=qs[_0x9cd8('0x2e')](_0x3c4bff[_0x9cd8('0x3f')][_0x9cd8('0x2e')]);_0x999246[_0x9cd8('0x47')]=qs[_0x9cd8('0x47')](_0x3c4bff['query'][_0x9cd8('0x47')]);}_0x999246[_0x9cd8('0x6a')]=qs[_0x9cd8('0x48')](_0x3c4bff[_0x9cd8('0x3f')][_0x9cd8('0x48')]);_0x999246[_0x9cd8('0x49')]=qs['filters'](_[_0x9cd8('0x4a')](_0x3c4bff[_0x9cd8('0x3f')],_0x679e36[_0x9cd8('0x41')]));_0x999246[_0x9cd8('0x49')]['ChatWebsiteId']=_0x408bf8['id'];if(_0x3c4bff[_0x9cd8('0x3f')]['filter']){_0x999246[_0x9cd8('0x49')]=_['merge'](_0x999246[_0x9cd8('0x49')],{'$or':_['map'](_0x999246[_0x9cd8('0x43')],function(_0x37112b){var _0x4217a5={};_0x4217a5[_0x37112b]={'$like':'%'+_0x3c4bff[_0x9cd8('0x3f')][_0x9cd8('0x4b')]+'%'};return _0x4217a5;})});}_0x999246=_[_0x9cd8('0x4c')]({},_0x999246,_0x3c4bff[_0x9cd8('0x4e')]);return db['ChatInteraction'][_0x9cd8('0x2d')]({'where':_0x999246[_0x9cd8('0x49')]})[_0x9cd8('0x21')](function(_0x2745e7){_0x1306de[_0x9cd8('0x2d')]=_0x2745e7;if(_0x3c4bff[_0x9cd8('0x3f')][_0x9cd8('0x50')]){_0x999246[_0x9cd8('0x51')]=[{'model':db['CmContact'],'as':_0x9cd8('0xe5'),'required':![]},{'model':db['User'],'as':_0x9cd8('0xe6'),'attributes':[_0x9cd8('0x3e'),'fullname','internal'],'required':![]},{'model':db['Tag'],'as':_0x9cd8('0xe7'),'attributes':['id','name',_0x9cd8('0xe8')],'where':_0x3c4bff[_0x9cd8('0x3f')][_0x9cd8('0xe9')]?{'id':_0x3c4bff[_0x9cd8('0x3f')]['tag']}:undefined,'required':_0x3c4bff[_0x9cd8('0x3f')][_0x9cd8('0xe9')]?!![]:![]}];}return db[_0x9cd8('0xb7')][_0x9cd8('0x52')](_0x999246);})[_0x9cd8('0x21')](function(_0x9a3877){_0x1306de[_0x9cd8('0x53')]=_0x9a3877;return _0x1306de;});}})['then'](respondWithFilteredResult(_0x211d48,_0x999246))[_0x9cd8('0x28')](handleError(_0x211d48,null));};function iftimePromise(_0xd6d306,_0x404bd8){return respondWithRpcPromise(_0x9cd8('0xea'),_0x9cd8('0xeb'),{'command':_0x404bd8['timezone']?util['format'](_0x9cd8('0xec'),_0xd6d306[_0x9cd8('0xed')],_0x404bd8[_0x9cd8('0xee')]):util[_0x9cd8('0xb1')](_0x9cd8('0xef'),_0xd6d306[_0x9cd8('0xed')])},client9002)[_0x9cd8('0x21')](function(_0x4fefb3){var _0xf8e629=_0x4fefb3&&_0x4fefb3['indexOf'](_0x9cd8('0xf0'))>=0x0?!![]:![];logger[_0x9cd8('0x22')](_0x9cd8('0xf1'),_0x404bd8['id'],_0xd6d306['id'],_0xd6d306[_0x9cd8('0xed')],_0xf8e629?_0x9cd8('0xf2'):_0x9cd8('0xf3'),_0x404bd8[_0x9cd8('0xee')]?_0x404bd8[_0x9cd8('0xee')]:'No\x20timezone');return _0xf8e629;})[_0x9cd8('0x28')](function(_0x14f21b){logger[_0x9cd8('0x26')](_0x9cd8('0xf1'),_0x404bd8['id'],_0xd6d306['id'],_0xd6d306[_0x9cd8('0xed')],util[_0x9cd8('0xf4')](_0x14f21b,{'showHidden':![],'depth':null}),_0x404bd8[_0x9cd8('0xee')]?_0x404bd8[_0x9cd8('0xee')]:_0x9cd8('0xf5'));return![];});}exports['getSnippet']=function(_0x1bfa88,_0x151464,_0x153e19){var _0x57b831=0x0;var _0x599336=0x0;var _0x650b65=![];var _0x13fa29;var _0x5bb707;return db['ChatWebsite']['find']({'where':{'id':_0x1bfa88['params']['id']},'include':[{'model':db[_0x9cd8('0xf6')],'as':_0x9cd8('0xf6'),'include':[{'model':db[_0x9cd8('0xf6')],'as':'Intervals','attributes':['id',_0x9cd8('0xed')],'raw':!![]}]}]})[_0x9cd8('0x21')](handleEntityNotFound(_0x151464,null))[_0x9cd8('0x21')](function(_0x3f8373){if(_0x3f8373){_0x13fa29=_0x3f8373;return _0x3f8373[_0x9cd8('0xf7')]({'raw':!![]});}})[_0x9cd8('0x21')](function(_0x2dd0cc){if(_0x13fa29){if(_0x2dd0cc){_0x5bb707=_0x2dd0cc;}}return require(_0x9cd8('0x75'))['getLicense']();})[_0x9cd8('0x21')](function(_0x137170){if(_0x137170){_0x599336=_0x137170['virtual'];_0x650b65=_0x137170[_0x9cd8('0x77')];}})[_0x9cd8('0x21')](function(){return db[_0x9cd8('0xb7')]['count']({'where':{'closed':![]}});})[_0x9cd8('0x21')](function(_0x5b8de2){_0x57b831=_0x5b8de2;if(_0x599336&&_0x5b8de2>_0x599336){return db[_0x9cd8('0xf8')][_0x9cd8('0x62')]({'where':{'id':0x1}})['then'](function(_0xa59181){if(_0xa59181){_0xa59181[_0x9cd8('0xf9')](_0x9cd8('0xfa'));}});}})['then'](function(){if(_0x13fa29[_0x9cd8('0xf6')]&&_0x13fa29['Interval'][_0x9cd8('0xfb')]){var _0x612d6c=[];for(var _0x172afc=0x0;_0x172afc<_0x13fa29[_0x9cd8('0xf6')][_0x9cd8('0xfb')][_0x9cd8('0x45')];_0x172afc++){var _0x469d33=_0x13fa29[_0x9cd8('0xf6')][_0x9cd8('0xfb')][_0x172afc][_0x9cd8('0x33')]({'plain':!![]});_0x612d6c[_0x9cd8('0xfc')](iftimePromise(_0x469d33,_0x13fa29));}return BPromise[_0x9cd8('0xfd')](_0x612d6c)[_0x9cd8('0x21')](function(_0x3bb621){return _[_0x9cd8('0xfe')](_0x3bb621);});}else{return!![];}})[_0x9cd8('0x21')](function(_0x44229d){var _0x1f8c90=fs[_0x9cd8('0xff')](path[_0x9cd8('0x73')](config[_0x9cd8('0x7c')],'server/files/chat/iframe.js'),_0x9cd8('0x100'));var _0x5666f9={'remote':_0x13fa29['remote'],'query':querystring[_0x9cd8('0xb5')](_[_0x9cd8('0x4c')](_0x13fa29[_0x9cd8('0x33')]({'plain':!![]}),{'customerIp':_0x1bfa88[_0x9cd8('0x88')][_0x9cd8('0xa7')]||_0x1bfa88[_0x9cd8('0x88')][_0x9cd8('0x101')]||_0x1bfa88[_0x9cd8('0x102')][_0x9cd8('0x103')]||_0x1bfa88['ip'],'referer':_0x1bfa88[_0x9cd8('0x88')]['referer'],'openedInteractions':_0x57b831,'maxInteractions':_0x599336,'virtual':_0x650b65[_0x9cd8('0x104')],'online':_0x44229d,'custom':_0x650b65}))['replace'](/'/g,'\x5c\x27')};_0x151464[_0x9cd8('0x35')](ejs['render'](Mustache['render'](_0x1f8c90,_0x5666f9),{'proactiveActions':_0x5bb707,'alignment':_0x13fa29[_0x9cd8('0x105')],'verticalAlignment':_0x13fa29['verticalAlignment'],'div_color':_0x13fa29['color'],'text_color':_0x13fa29[_0x9cd8('0x106')]}));})[_0x9cd8('0x28')](handleError(_0x151464,null));};exports[_0x9cd8('0x107')]=function(_0x1c9e01,_0xa4d3b9,_0x24af91){return db[_0x9cd8('0x4f')][_0x9cd8('0x62')]({'where':{'id':_0x1c9e01[_0x9cd8('0x55')]['id']}})[_0x9cd8('0x21')](handleEntityNotFound(_0xa4d3b9,null))['then'](function(_0x17be46){if(_0x17be46){return db[_0x9cd8('0x108')][_0x9cd8('0x109')](function(_0x225780){return db[_0x9cd8('0x10a')]['destroy']({'where':{'ChatWebsiteId':_0x1c9e01[_0x9cd8('0x55')]['id']},'transaction':_0x225780})[_0x9cd8('0x21')](function(_0x14e44e){var _0x5b0b7f=_[_0x9cd8('0x39')](_0x1c9e01[_0x9cd8('0x58')],function(_0x2999c5){_0x2999c5['ChatWebsiteId']=_0x1c9e01[_0x9cd8('0x55')]['id'];return _0x2999c5;});return db[_0x9cd8('0x10a')][_0x9cd8('0x10b')](_0x5b0b7f,{'transaction':_0x225780});});})['then'](function(){return db[_0x9cd8('0x10a')][_0x9cd8('0x10c')]({'where':{'ChatWebsiteId':_0x1c9e01[_0x9cd8('0x55')]['id']},'order':_0x9cd8('0x10d')});});}})[_0x9cd8('0x21')](respondWithResult(_0xa4d3b9,null))['catch'](handleError(_0xa4d3b9,null));};exports['getApplications']=function(_0x35144e,_0x2eac36,_0x4d4cb8){var _0x47ea8c={};var _0x5bf1a7={};var _0x28f89c;var _0x100bf3;return db[_0x9cd8('0x4f')][_0x9cd8('0x62')]({'where':{'id':_0x35144e[_0x9cd8('0x55')]['id']}})[_0x9cd8('0x21')](handleEntityNotFound(_0x2eac36,null))['then'](function(_0x31970f){if(_0x31970f){_0x28f89c=_0x31970f;_0x5bf1a7[_0x9cd8('0x3d')]=_[_0x9cd8('0x40')](db[_0x9cd8('0x10a')][_0x9cd8('0x3a')]);_0x5bf1a7[_0x9cd8('0x3f')]=_['keys'](_0x35144e[_0x9cd8('0x3f')]);_0x5bf1a7[_0x9cd8('0x41')]=_[_0x9cd8('0x42')](_0x5bf1a7['model'],_0x5bf1a7['query']);_0x47ea8c[_0x9cd8('0x43')]=_[_0x9cd8('0x42')](_0x5bf1a7[_0x9cd8('0x3d')],qs[_0x9cd8('0x44')](_0x35144e[_0x9cd8('0x3f')][_0x9cd8('0x44')]));_0x47ea8c[_0x9cd8('0x43')]=_0x47ea8c[_0x9cd8('0x43')]['length']?_0x47ea8c[_0x9cd8('0x43')]:_0x5bf1a7[_0x9cd8('0x3d')];_0x47ea8c[_0x9cd8('0x6a')]=qs[_0x9cd8('0x48')](_0x35144e['query'][_0x9cd8('0x48')]);_0x47ea8c[_0x9cd8('0x49')]=qs[_0x9cd8('0x41')](_[_0x9cd8('0x4a')](_0x35144e[_0x9cd8('0x3f')],_0x5bf1a7['filters']));if(_0x35144e[_0x9cd8('0x3f')][_0x9cd8('0x4b')]){_0x47ea8c[_0x9cd8('0x49')]=_[_0x9cd8('0x4c')](_0x47ea8c[_0x9cd8('0x49')],{'$or':_[_0x9cd8('0x39')](_0x47ea8c[_0x9cd8('0x43')],function(_0x217a98){var _0x3fc75f={};_0x3fc75f[_0x217a98]={'$like':'%'+_0x35144e['query'][_0x9cd8('0x4b')]+'%'};return _0x3fc75f;})});}_0x47ea8c=_['merge']({},_0x47ea8c,_0x35144e['options']);return _0x28f89c[_0x9cd8('0x10e')](_0x47ea8c);}})[_0x9cd8('0x21')](function(_0x30b299){if(_0x30b299){_0x100bf3=_0x30b299[_0x9cd8('0x45')];if(!_0x35144e['query']['hasOwnProperty']('nolimit')){_0x47ea8c['limit']=qs[_0x9cd8('0x2e')](_0x35144e[_0x9cd8('0x3f')][_0x9cd8('0x2e')]);_0x47ea8c[_0x9cd8('0x47')]=qs[_0x9cd8('0x47')](_0x35144e[_0x9cd8('0x3f')]['offset']);}return _0x28f89c[_0x9cd8('0x10e')](_0x47ea8c);}})[_0x9cd8('0x21')](function(_0x5d8944){if(_0x5d8944){return _0x5d8944?{'count':_0x100bf3,'rows':_0x5d8944}:null;}})[_0x9cd8('0x21')](respondWithResult(_0x2eac36,null))[_0x9cd8('0x28')](handleError(_0x2eac36,null));};exports[_0x9cd8('0x10f')]=function(_0x1c49f6,_0x5ee47f,_0x41bff6){return db[_0x9cd8('0x110')][_0x9cd8('0x56')]({'where':{'id':_0x1c49f6[_0x9cd8('0x55')]['id']}})['then'](handleEntityNotFound(_0x5ee47f,null))[_0x9cd8('0x21')](function(_0x29bb5f){if(_0x29bb5f){return _0x29bb5f[_0x9cd8('0x10f')](_0x1c49f6['body']['ids'],_[_0x9cd8('0xe4')](_0x1c49f6[_0x9cd8('0x58')],[_0x9cd8('0x66'),'id'])||{});}})['then'](respondWithResult(_0x5ee47f,null))['catch'](handleError(_0x5ee47f,null));};exports[_0x9cd8('0xf7')]=function(_0x5649b9,_0x249380,_0x3bf374){var _0x7ad271={};var _0x36d299={};var _0xf6a042;var _0x109e0d;return db[_0x9cd8('0x4f')][_0x9cd8('0x62')]({'where':{'id':_0x5649b9[_0x9cd8('0x55')]['id']}})[_0x9cd8('0x21')](handleEntityNotFound(_0x249380,null))[_0x9cd8('0x21')](function(_0x4c097d){if(_0x4c097d){_0xf6a042=_0x4c097d;_0x36d299[_0x9cd8('0x3d')]=_['keys'](db[_0x9cd8('0x111')][_0x9cd8('0x3a')]);_0x36d299[_0x9cd8('0x3f')]=_[_0x9cd8('0x40')](_0x5649b9[_0x9cd8('0x3f')]);_0x36d299[_0x9cd8('0x41')]=_['intersection'](_0x36d299[_0x9cd8('0x3d')],_0x36d299[_0x9cd8('0x3f')]);_0x7ad271['attributes']=_['intersection'](_0x36d299[_0x9cd8('0x3d')],qs[_0x9cd8('0x44')](_0x5649b9[_0x9cd8('0x3f')][_0x9cd8('0x44')]));_0x7ad271['attributes']=_0x7ad271['attributes'][_0x9cd8('0x45')]?_0x7ad271[_0x9cd8('0x43')]:_0x36d299[_0x9cd8('0x3d')];_0x7ad271[_0x9cd8('0x6a')]=qs[_0x9cd8('0x48')](_0x5649b9[_0x9cd8('0x3f')][_0x9cd8('0x48')]);_0x7ad271['where']=qs[_0x9cd8('0x41')](_[_0x9cd8('0x4a')](_0x5649b9[_0x9cd8('0x3f')],_0x36d299[_0x9cd8('0x41')]));if(_0x5649b9['query'][_0x9cd8('0x4b')]){_0x7ad271[_0x9cd8('0x49')]=_[_0x9cd8('0x4c')](_0x7ad271[_0x9cd8('0x49')],{'$or':_['map'](_0x7ad271[_0x9cd8('0x43')],function(_0x305407){var _0x418476={};_0x418476[_0x305407]={'$like':'%'+_0x5649b9[_0x9cd8('0x3f')][_0x9cd8('0x4b')]+'%'};return _0x418476;})});}_0x7ad271=_[_0x9cd8('0x4c')]({},_0x7ad271,_0x5649b9[_0x9cd8('0x4e')]);return _0xf6a042[_0x9cd8('0xf7')](_0x7ad271);}})[_0x9cd8('0x21')](function(_0x545f7a){if(_0x545f7a){_0x109e0d=_0x545f7a[_0x9cd8('0x45')];if(!_0x5649b9[_0x9cd8('0x3f')][_0x9cd8('0x64')](_0x9cd8('0x46'))){_0x7ad271[_0x9cd8('0x2e')]=qs['limit'](_0x5649b9[_0x9cd8('0x3f')]['limit']);_0x7ad271[_0x9cd8('0x47')]=qs['offset'](_0x5649b9['query'][_0x9cd8('0x47')]);}return _0xf6a042['getProactiveActions'](_0x7ad271);}})['then'](function(_0x4e7945){if(_0x4e7945){return _0x4e7945?{'count':_0x109e0d,'rows':_0x4e7945}:null;}})[_0x9cd8('0x21')](respondWithResult(_0x249380,null))['catch'](handleError(_0x249380,null));};exports[_0x9cd8('0x112')]=function(_0xb1e4df,_0x3ebbe2,_0x5d29db){var _0x2e7af5=_0xb1e4df['query']['online']===_0x9cd8('0x113')?'offlineForm':_0x9cd8('0x114');return db[_0x9cd8('0x4f')][_0x9cd8('0x56')]({'attributes':['id',_0x2e7af5],'where':{'id':_0xb1e4df['params']['id']}})[_0x9cd8('0x21')](handleEntityNotFound(_0x3ebbe2,null))[_0x9cd8('0x21')](function(_0x18e819){if(_0x18e819){var _0x5769b7=_0x18e819[_0x2e7af5];var _0x732c23=_0x5769b7&&_0x5769b7[_0x9cd8('0x115')]?_0x5769b7['items']:[];_0x3ebbe2['send']({'fromKey':_['isNil'](_0x5769b7[_0x9cd8('0x116')])?undefined:_0x5769b7['fromKey'],'count':_0x732c23[_0x9cd8('0x45')],'rows':_0x732c23});}})[_0x9cd8('0x28')](handleError(_0x3ebbe2,null));};exports[_0x9cd8('0x117')]=function(_0x2dd971,_0xc9bc87,_0x51f333){var _0x3bf7de={'raw':![],'where':{}};var _0x5734bc={};var _0x4c0176={'count':0x0,'rows':[]};return db[_0x9cd8('0x4f')]['findOne']({'where':{'id':_0x2dd971['params']['id']}})['then'](handleEntityNotFound(_0xc9bc87,null))[_0x9cd8('0x21')](function(_0x556c7e){if(_0x556c7e){_0x5734bc[_0x9cd8('0x3d')]=_[_0x9cd8('0x40')](db['ChatOfflineMessage'][_0x9cd8('0x3a')]);_0x5734bc[_0x9cd8('0x3f')]=_[_0x9cd8('0x40')](_0x2dd971[_0x9cd8('0x3f')]);_0x5734bc[_0x9cd8('0x41')]=_[_0x9cd8('0x42')](_0x5734bc[_0x9cd8('0x3d')],_0x5734bc[_0x9cd8('0x3f')]);_0x3bf7de[_0x9cd8('0x43')]=_[_0x9cd8('0x42')](_0x5734bc[_0x9cd8('0x3d')],qs[_0x9cd8('0x44')](_0x2dd971[_0x9cd8('0x3f')][_0x9cd8('0x44')]));_0x3bf7de[_0x9cd8('0x43')]=_0x3bf7de[_0x9cd8('0x43')][_0x9cd8('0x45')]?_0x3bf7de[_0x9cd8('0x43')]:_0x5734bc['model'];if(!_0x2dd971[_0x9cd8('0x3f')][_0x9cd8('0x64')](_0x9cd8('0x46'))){_0x3bf7de['limit']=qs[_0x9cd8('0x2e')](_0x2dd971[_0x9cd8('0x3f')][_0x9cd8('0x2e')]);_0x3bf7de[_0x9cd8('0x47')]=qs['offset'](_0x2dd971[_0x9cd8('0x3f')]['offset']);}_0x3bf7de[_0x9cd8('0x6a')]=qs[_0x9cd8('0x48')](_0x2dd971['query']['sort']);_0x3bf7de['where']=qs['filters'](_['pick'](_0x2dd971[_0x9cd8('0x3f')],_0x5734bc[_0x9cd8('0x41')]));_0x3bf7de[_0x9cd8('0x49')][_0x9cd8('0x60')]=_0x556c7e['id'];if(_0x2dd971[_0x9cd8('0x3f')][_0x9cd8('0x4b')]){_0x3bf7de[_0x9cd8('0x49')]=_['merge'](_0x3bf7de[_0x9cd8('0x49')],{'$or':_[_0x9cd8('0x39')](_0x3bf7de[_0x9cd8('0x43')],function(_0x4e46a9){var _0x42a732={};_0x42a732[_0x4e46a9]={'$like':'%'+_0x2dd971['query'][_0x9cd8('0x4b')]+'%'};return _0x42a732;})});}_0x3bf7de=_[_0x9cd8('0x4c')]({},_0x3bf7de,_0x2dd971['options']);return db[_0x9cd8('0xd3')][_0x9cd8('0x2d')]({'where':_0x3bf7de[_0x9cd8('0x49')]})[_0x9cd8('0x21')](function(_0x17f11f){_0x4c0176[_0x9cd8('0x2d')]=_0x17f11f;if(_0x2dd971[_0x9cd8('0x3f')][_0x9cd8('0x50')]){_0x3bf7de[_0x9cd8('0x51')]=[{'all':!![]}];}else{_0x3bf7de[_0x9cd8('0x51')]=[{'model':db[_0x9cd8('0x99')],'as':_0x9cd8('0xe5'),'required':![]}];}return db[_0x9cd8('0xd3')]['findAll'](_0x3bf7de);})[_0x9cd8('0x21')](function(_0x5d50af){_0x4c0176['rows']=_0x5d50af;return _0x4c0176;});}})[_0x9cd8('0x21')](respondWithFilteredResult(_0xc9bc87,_0x3bf7de))[_0x9cd8('0x28')](handleError(_0xc9bc87,null));};exports[_0x9cd8('0x118')]=function(_0x18bd8a,_0x409f98,_0x32cdde){return db[_0x9cd8('0x4f')][_0x9cd8('0x56')]({'where':{'id':_0x18bd8a[_0x9cd8('0x55')]['id']}})[_0x9cd8('0x21')](handleEntityNotFound(_0x409f98,null))[_0x9cd8('0x21')](function(_0x335ccb){if(_0x335ccb){return _0x335ccb['addAgents'](_0x18bd8a['body']['ids'],_[_0x9cd8('0xe4')](_0x18bd8a[_0x9cd8('0x58')],[_0x9cd8('0x66'),'id'])||{})[_0x9cd8('0xbb')](function(_0x16c00d){for(var _0x45e30f=0x0;_0x45e30f<_0x18bd8a[_0x9cd8('0x58')]['ids']['length'];_0x45e30f+=0x1){socket['emit']('userChatWebsite:save',{'UserId':_0x18bd8a[_0x9cd8('0x58')]['ids'][_0x45e30f],'ChatWebsiteId':_0x18bd8a[_0x9cd8('0x55')]['id']});}return _0x16c00d;});}})[_0x9cd8('0x21')](respondWithResult(_0x409f98,null))[_0x9cd8('0x28')](handleError(_0x409f98,null));};exports[_0x9cd8('0x119')]=function(_0x496733,_0x4e2aae,_0x4732da){return db[_0x9cd8('0x4f')][_0x9cd8('0x56')]({'where':{'id':_0x496733['params']['id']}})[_0x9cd8('0x21')](handleEntityNotFound(_0x4e2aae,null))[_0x9cd8('0x21')](function(_0xb1c3a7){if(_0xb1c3a7){return _0xb1c3a7[_0x9cd8('0x119')](_0x496733[_0x9cd8('0x3f')][_0x9cd8('0x66')])[_0x9cd8('0x21')](function(){if(_[_0x9cd8('0x11a')](_0x496733[_0x9cd8('0x3f')]['ids'])){for(var _0x597c9d=0x0;_0x597c9d<_0x496733[_0x9cd8('0x3f')][_0x9cd8('0x66')][_0x9cd8('0x45')];_0x597c9d+=0x1){socket['emit'](_0x9cd8('0x11b'),{'UserId':Number(_0x496733[_0x9cd8('0x3f')][_0x9cd8('0x66')][_0x597c9d]),'ChatWebsiteId':Number(_0x496733[_0x9cd8('0x55')]['id'])});}}else{socket[_0x9cd8('0x11c')](_0x9cd8('0x11b'),{'UserId':Number(_0x496733['query'][_0x9cd8('0x66')]),'ChatWebsiteId':Number(_0x496733[_0x9cd8('0x55')]['id'])});}});}})[_0x9cd8('0x21')](respondWithStatusCode(_0x4e2aae,null))[_0x9cd8('0x28')](handleError(_0x4e2aae,null));};exports[_0x9cd8('0x11d')]=function(_0x2329de,_0x5177f3,_0x53d97b){var _0x3aff9b={};var _0x138c44={};var _0x27d6a3;var _0x4eb8b5;return db[_0x9cd8('0x4f')][_0x9cd8('0x62')]({'where':{'id':_0x2329de['params']['id']}})[_0x9cd8('0x21')](handleEntityNotFound(_0x5177f3,null))[_0x9cd8('0x21')](function(_0x586b63){if(_0x586b63){_0x27d6a3=_0x586b63;_0x138c44[_0x9cd8('0x3d')]=_[_0x9cd8('0x40')](db[_0x9cd8('0xc4')][_0x9cd8('0x3a')]);_0x138c44['query']=_[_0x9cd8('0x40')](_0x2329de[_0x9cd8('0x3f')]);_0x138c44['filters']=_['intersection'](_0x138c44[_0x9cd8('0x3d')],_0x138c44[_0x9cd8('0x3f')]);_0x3aff9b[_0x9cd8('0x43')]=_['intersection'](_0x138c44[_0x9cd8('0x3d')],qs['fields'](_0x2329de[_0x9cd8('0x3f')][_0x9cd8('0x44')]));_0x3aff9b[_0x9cd8('0x43')]=_0x3aff9b[_0x9cd8('0x43')]['length']?_0x3aff9b[_0x9cd8('0x43')]:_0x138c44['model'];_0x3aff9b[_0x9cd8('0x6a')]=qs[_0x9cd8('0x48')](_0x2329de['query'][_0x9cd8('0x48')]);_0x3aff9b[_0x9cd8('0x49')]=qs[_0x9cd8('0x41')](_[_0x9cd8('0x4a')](_0x2329de['query'],_0x138c44['filters']));if(_0x2329de[_0x9cd8('0x3f')][_0x9cd8('0x4b')]){_0x3aff9b[_0x9cd8('0x49')]=_[_0x9cd8('0x4c')](_0x3aff9b['where'],{'$or':_['map'](_0x3aff9b[_0x9cd8('0x43')],function(_0x2c44b7){var _0x15d913={};_0x15d913[_0x2c44b7]={'$like':'%'+_0x2329de[_0x9cd8('0x3f')]['filter']+'%'};return _0x15d913;})});}_0x3aff9b=_[_0x9cd8('0x4c')]({},_0x3aff9b,_0x2329de['options']);return _0x27d6a3['getAgents'](_0x3aff9b);}})[_0x9cd8('0x21')](function(_0x52462f){if(_0x52462f){_0x4eb8b5=_0x52462f[_0x9cd8('0x45')];if(!_0x2329de['query'][_0x9cd8('0x64')](_0x9cd8('0x46'))){_0x3aff9b[_0x9cd8('0x2e')]=qs[_0x9cd8('0x2e')](_0x2329de[_0x9cd8('0x3f')][_0x9cd8('0x2e')]);_0x3aff9b[_0x9cd8('0x47')]=qs[_0x9cd8('0x47')](_0x2329de[_0x9cd8('0x3f')]['offset']);}return _0x27d6a3[_0x9cd8('0x11d')](_0x3aff9b);}})[_0x9cd8('0x21')](function(_0x1cbb7f){if(_0x1cbb7f){return _0x1cbb7f?{'count':_0x4eb8b5,'rows':_0x1cbb7f}:null;}})[_0x9cd8('0x21')](respondWithResult(_0x5177f3,null))[_0x9cd8('0x28')](handleError(_0x5177f3,null));}; \ No newline at end of file +var _0x1e6e=['server/files/images/avatars/system_avatar.png','systemAvatar','isNil','user-agent-parser','setUA','headers','user-agent','getResult','no\x20available\x20attributes','difference','updatedAt','createdAt','CompanyId','ListId','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','from','CmList','List','CmContact','Contacts','DESC','ChatApplication','Applications','applications','orderBy','priority','asc','account','defaults','contact','cf-connecting-ip','x-forwarded-for','split','firstName','lastName','x-real-port','browser','format','version','unknown','%s\x20%s','device','%s\x20%s\x20%s','vendor','threadId','ChatInteraction','externalUrl','ContactId','interaction','spread','messageId','created','autoclose','push','unmanaged','*,*,*,*','UserId','User','unshift','agent','forcedOwnership','Start','startRouting','EventManager','notify','offline','mapKeyOffline','mapKeyOffline\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKeyOffline\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','findOrCreate','server/files/templates/chatOfflineMessage.ejs','utf8','render','toPairs','offlineMessageBody','MailServerOut','Smtp','forwardOfflineAddress','service','host','port','secure','authentication','SendMail','\x22%s\x22\x20<%s>','email','addInteraction','omit','getInteractions','Owner','Tag','Tags','color','tag','getSnippet','timezone','iftime\x20%s,%s','interval','iftime\x20%s','true','[%s][INTERVAL][%s]\x20%s\x20%s\x20(%s)','ONLINE','OFFLINE','No\x20timezone','inspect','Interval','virtual','increment','chatLicenseExceeded','Intervals','some','readFileSync','server/files/chat/iframe.js','remote','connection','remoteAddress','referer','replace','verticalAlignment','textColor','addApplications','sequelize','bulkCreate','findAndCountAll','getApplications','addProactiveActions','chatProactiveAction','getProactiveActions','getFields','false','offlineForm','onlineForm','items','fromKey','ChatOfflineMessage','Contact','addAgents','userChatWebsite:save','removeAgents','isArray','emit','userChatWebsite:remove','getAgents','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','lodash','squel','jsforce','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','redis','localhost','socket.io-emitter','./chatWebsite.socket','client','http','test','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','request\x20sent','debug','stringify','error','code','ChatWebsite,\x20%s,\x20%s','message','info','result','sendStatus','status','end','offset','set','Content-Range','reject','save','update','destroy','get','ChatWebsites','UserProfileResource','stack','name','send','index','Pause','map','ChatWebsite','fieldName','type','key','query','keys','filters','intersection','attributes','model','fields','hasOwnProperty','limit','order','sort','filter','merge','where','options','count','includeAll','findAll','rows','catch','show','mandatoryDispositionPause','rawAttributes','length','include','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','params','describe','Disposition','getDispositions','nolimit','pick','ChatWebsiteId','removeDispositions','ids','addAnswer','CannedAnswer','findOne','removeAnswers','addLogo','file','filename','addAvatar','addCustomerAvatar','customerAvatar','addSystemAvatar','getLogo','join','root','server/files/images/logos/default_logo.svg','sitepic','../../config/license/util','getLicense','custom','existsSync','server/files/images/logos/','download','agentAvatar','getCustomerAvatar','server/files/images/avatars/customer_avatar.png','showCustomerAvatar','server/files/images/avatars/','getSystemAvatar'];(function(_0x3b8837,_0x34da1a){var _0x35be05=function(_0x4393e4){while(--_0x4393e4){_0x3b8837['push'](_0x3b8837['shift']());}};_0x35be05(++_0x34da1a);}(_0x1e6e,0x1b2));var _0xe1e6=function(_0x40220a,_0x22feb1){_0x40220a=_0x40220a-0x0;var _0x3903cc=_0x1e6e[_0x40220a];return _0x3903cc;};'use strict';var pdf=require(_0xe1e6('0x0'));var emlformat=require(_0xe1e6('0x1'));var rimraf=require(_0xe1e6('0x2'));var zipdir=require(_0xe1e6('0x3'));var jsonpatch=require(_0xe1e6('0x4'));var rp=require(_0xe1e6('0x5'));var moment=require(_0xe1e6('0x6'));var BPromise=require(_0xe1e6('0x7'));var Mustache=require(_0xe1e6('0x8'));var util=require(_0xe1e6('0x9'));var path=require(_0xe1e6('0xa'));var sox=require('sox');var csv=require(_0xe1e6('0xb'));var ejs=require(_0xe1e6('0xc'));var fs=require('fs');var _=require(_0xe1e6('0xd'));var squel=require(_0xe1e6('0xe'));var crypto=require('crypto');var jsforce=require(_0xe1e6('0xf'));var deskjs=require('desk.js');var toCsv=require(_0xe1e6('0xb'));var querystring=require(_0xe1e6('0x10'));var Papa=require('papaparse');var Redis=require(_0xe1e6('0x11'));var authService=require('../../components/auth/service');var qs=require(_0xe1e6('0x12'));var as=require(_0xe1e6('0x13'));var hardwareService=require(_0xe1e6('0x14'));var logger=require(_0xe1e6('0x15'))(_0xe1e6('0x16'));var utils=require(_0xe1e6('0x17'));var config=require('../../config/environment');var db=require(_0xe1e6('0x18'))['db'];config[_0xe1e6('0x19')]=_['defaults'](config['redis'],{'host':_0xe1e6('0x1a'),'port':0x18eb});var socket=require(_0xe1e6('0x1b'))(new Redis(config[_0xe1e6('0x19')]));require(_0xe1e6('0x1c'))['register'](socket);var jayson=require('jayson/promise');var client=jayson[_0xe1e6('0x1d')]['http']({'port':0x232c});var client9002=jayson[_0xe1e6('0x1d')][_0xe1e6('0x1e')]({'port':0x232a});var client9003=jayson[_0xe1e6('0x1d')][_0xe1e6('0x1e')]({'port':0x232b});function checkPasswordPattern(_0x3186f9,_0x1b0409,_0x468b4c){if(_0x468b4c){var _0x5914ae=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x5914ae[_0xe1e6('0x1f')](_0x1b0409)){return _0x3186f9;}else{throw new db[(_0xe1e6('0x20'))][(_0xe1e6('0x21'))](_0xe1e6('0x22'));}}else{return _0x3186f9;}}function respondWithRpcPromise(_0x47e2bb,_0x4ddbd3,_0x4c17a8,_0x481aa9){return new BPromise(function(_0x560c76,_0x495ba9){var _0x59a2e1=_0x481aa9||client;return _0x59a2e1[_0xe1e6('0x23')](_0x47e2bb,_0x4c17a8)[_0xe1e6('0x24')](function(_0x51cf03){logger['info']('ChatWebsite,\x20%s,\x20%s',_0x4ddbd3,_0xe1e6('0x25'));logger[_0xe1e6('0x26')]('ChatWebsite,\x20%s,\x20%s,\x20%s',_0x4ddbd3,'request\x20sent',JSON[_0xe1e6('0x27')](_0x51cf03));if(_0x51cf03['error']){if(_0x51cf03[_0xe1e6('0x28')][_0xe1e6('0x29')]===0x1f4){logger[_0xe1e6('0x28')](_0xe1e6('0x2a'),_0x4ddbd3,_0x51cf03[_0xe1e6('0x28')][_0xe1e6('0x2b')]);return _0x495ba9(_0x51cf03[_0xe1e6('0x28')]['message']);}logger[_0xe1e6('0x28')](_0xe1e6('0x2a'),_0x4ddbd3,_0x51cf03[_0xe1e6('0x28')][_0xe1e6('0x2b')]);return _0x560c76(_0x51cf03[_0xe1e6('0x28')][_0xe1e6('0x2b')]);}else{logger[_0xe1e6('0x2c')](_0xe1e6('0x2a'),_0x4ddbd3,_0xe1e6('0x25'));_0x560c76(_0x51cf03[_0xe1e6('0x2d')]['message']);}})['catch'](function(_0x1a1da3){logger['error'](_0xe1e6('0x2a'),_0x4ddbd3,_0x1a1da3);_0x495ba9(_0x1a1da3);});});}function respondWithStatusCode(_0x27c7fb,_0x339dea){_0x339dea=_0x339dea||0xcc;return function(_0x91ed04){if(_0x91ed04){return _0x27c7fb[_0xe1e6('0x2e')](_0x339dea);}return _0x27c7fb[_0xe1e6('0x2f')](_0x339dea)[_0xe1e6('0x30')]();};}function respondWithResult(_0xf1806d,_0x4f64b2){_0x4f64b2=_0x4f64b2||0xc8;return function(_0x2403b9){if(_0x2403b9){return _0xf1806d[_0xe1e6('0x2f')](_0x4f64b2)['json'](_0x2403b9);}};}function respondWithFilteredResult(_0xb2fbc5,_0x45f807){return function(_0x285c20){if(_0x285c20){var _0x576826=_0x285c20['count'],_0x464595=_0x45f807[_0xe1e6('0x31')],_0x579402=_0x45f807[_0xe1e6('0x31')]+_0x45f807['limit'],_0x1dc6f1;if(_0x579402>=_0x576826){_0x579402=_0x576826;_0x1dc6f1=0xc8;}else{_0x1dc6f1=0xce;}_0xb2fbc5['status'](_0x1dc6f1);return _0xb2fbc5[_0xe1e6('0x32')](_0xe1e6('0x33'),_0x464595+'-'+_0x579402+'/'+_0x576826)['json'](_0x285c20);}return null;};}function patchUpdates(_0x18ddd9){return function(_0x43a607){try{jsonpatch['apply'](_0x43a607,_0x18ddd9,!![]);}catch(_0x50b4b3){return BPromise[_0xe1e6('0x34')](_0x50b4b3);}return _0x43a607[_0xe1e6('0x35')]();};}function saveUpdates(_0x2b0698,_0x96cdb0){return function(_0x25baa6){if(_0x25baa6){return _0x25baa6[_0xe1e6('0x36')](_0x2b0698)[_0xe1e6('0x24')](function(_0x46f7c3){return _0x46f7c3;});}return null;};}function removeEntity(_0x5b7d2a,_0x542879){return function(_0x4cd1a6){if(_0x4cd1a6){return _0x4cd1a6[_0xe1e6('0x37')]()['then'](function(){var _0x5c4a40=_0x4cd1a6[_0xe1e6('0x38')]({'plain':!![]});var _0x22ddc9=_0xe1e6('0x39');return db[_0xe1e6('0x3a')][_0xe1e6('0x37')]({'where':{'type':_0x22ddc9,'resourceId':_0x5c4a40['id']}})[_0xe1e6('0x24')](function(){return _0x4cd1a6;});})['then'](function(){_0x5b7d2a['status'](0xcc)[_0xe1e6('0x30')]();});}};}function handleEntityNotFound(_0x442c06,_0x53e68f){return function(_0x1578cb){if(!_0x1578cb){_0x442c06['sendStatus'](0x194);}return _0x1578cb;};}function handleError(_0x5a9246,_0x9353c9){_0x9353c9=_0x9353c9||0x1f4;return function(_0x41358d){logger[_0xe1e6('0x28')](_0x41358d[_0xe1e6('0x3b')]);if(_0x41358d[_0xe1e6('0x3c')]){delete _0x41358d[_0xe1e6('0x3c')];}_0x5a9246[_0xe1e6('0x2f')](_0x9353c9)[_0xe1e6('0x3d')](_0x41358d);};}exports[_0xe1e6('0x3e')]=function(_0x592ad1,_0x4eae18){var _0x2b58a2={'include':[{'model':db[_0xe1e6('0x3f')],'as':'mandatoryDispositionPause'}]},_0x1eaef2={},_0x5ecc1b={'count':0x0,'rows':[]};var _0x3b8525=_[_0xe1e6('0x40')](db[_0xe1e6('0x41')]['rawAttributes'],function(_0x39b0d5){return{'name':_0x39b0d5[_0xe1e6('0x42')],'type':_0x39b0d5[_0xe1e6('0x43')][_0xe1e6('0x44')]};});_0x1eaef2['model']=_['map'](_0x3b8525,_0xe1e6('0x3c'));_0x1eaef2[_0xe1e6('0x45')]=_[_0xe1e6('0x46')](_0x592ad1[_0xe1e6('0x45')]);_0x1eaef2[_0xe1e6('0x47')]=_[_0xe1e6('0x48')](_0x1eaef2['model'],_0x1eaef2['query']);_0x2b58a2[_0xe1e6('0x49')]=_['intersection'](_0x1eaef2[_0xe1e6('0x4a')],qs[_0xe1e6('0x4b')](_0x592ad1[_0xe1e6('0x45')]['fields']));_0x2b58a2[_0xe1e6('0x49')]=_0x2b58a2[_0xe1e6('0x49')]['length']?_0x2b58a2[_0xe1e6('0x49')]:_0x1eaef2[_0xe1e6('0x4a')];if(!_0x592ad1[_0xe1e6('0x45')][_0xe1e6('0x4c')]('nolimit')){_0x2b58a2[_0xe1e6('0x4d')]=qs[_0xe1e6('0x4d')](_0x592ad1[_0xe1e6('0x45')]['limit']);_0x2b58a2[_0xe1e6('0x31')]=qs[_0xe1e6('0x31')](_0x592ad1[_0xe1e6('0x45')][_0xe1e6('0x31')]);}_0x2b58a2[_0xe1e6('0x4e')]=qs[_0xe1e6('0x4f')](_0x592ad1[_0xe1e6('0x45')]['sort']);_0x2b58a2['where']=qs['filters'](_['pick'](_0x592ad1[_0xe1e6('0x45')],_0x1eaef2[_0xe1e6('0x47')]),_0x3b8525);if(_0x592ad1[_0xe1e6('0x45')][_0xe1e6('0x50')]){_0x2b58a2['where']=_[_0xe1e6('0x51')](_0x2b58a2[_0xe1e6('0x52')],{'$or':_[_0xe1e6('0x40')](_0x3b8525,function(_0x20b67e){if(_0x20b67e[_0xe1e6('0x43')]!=='VIRTUAL'){var _0x49b9d7={};_0x49b9d7[_0x20b67e[_0xe1e6('0x3c')]]={'$like':'%'+_0x592ad1[_0xe1e6('0x45')][_0xe1e6('0x50')]+'%'};return _0x49b9d7;}})});}_0x2b58a2=_[_0xe1e6('0x51')]({},_0x2b58a2,_0x592ad1[_0xe1e6('0x53')]);var _0x3b0d86={'where':_0x2b58a2[_0xe1e6('0x52')]};return db[_0xe1e6('0x41')][_0xe1e6('0x54')](_0x3b0d86)[_0xe1e6('0x24')](function(_0x3fdbd0){_0x5ecc1b['count']=_0x3fdbd0;if(_0x592ad1['query'][_0xe1e6('0x55')]){_0x2b58a2['include']=[{'all':!![]}];}return db['ChatWebsite'][_0xe1e6('0x56')](_0x2b58a2);})[_0xe1e6('0x24')](function(_0x45ec1f){_0x5ecc1b[_0xe1e6('0x57')]=_0x45ec1f;return _0x5ecc1b;})[_0xe1e6('0x24')](respondWithFilteredResult(_0x4eae18,_0x2b58a2))[_0xe1e6('0x58')](handleError(_0x4eae18,null));};exports[_0xe1e6('0x59')]=function(_0x1e0015,_0x373298){var _0x1cd19b={'raw':![],'where':{'id':_0x1e0015['params']['id']},'include':[{'model':db[_0xe1e6('0x3f')],'as':_0xe1e6('0x5a')}]},_0x1cbb3b={};_0x1cbb3b[_0xe1e6('0x4a')]=_['keys'](db[_0xe1e6('0x41')][_0xe1e6('0x5b')]);_0x1cbb3b[_0xe1e6('0x45')]=_[_0xe1e6('0x46')](_0x1e0015[_0xe1e6('0x45')]);_0x1cbb3b[_0xe1e6('0x47')]=_[_0xe1e6('0x48')](_0x1cbb3b['model'],_0x1cbb3b[_0xe1e6('0x45')]);_0x1cd19b[_0xe1e6('0x49')]=_[_0xe1e6('0x48')](_0x1cbb3b[_0xe1e6('0x4a')],qs[_0xe1e6('0x4b')](_0x1e0015[_0xe1e6('0x45')]['fields']));_0x1cd19b[_0xe1e6('0x49')]=_0x1cd19b[_0xe1e6('0x49')][_0xe1e6('0x5c')]?_0x1cd19b[_0xe1e6('0x49')]:_0x1cbb3b[_0xe1e6('0x4a')];if(_0x1e0015[_0xe1e6('0x45')][_0xe1e6('0x55')]){_0x1cd19b[_0xe1e6('0x5d')]=[{'all':!![]}];}_0x1cd19b=_['merge']({},_0x1cd19b,_0x1e0015['options']);return db['ChatWebsite'][_0xe1e6('0x5e')](_0x1cd19b)[_0xe1e6('0x24')](handleEntityNotFound(_0x373298,null))[_0xe1e6('0x24')](respondWithResult(_0x373298,null))[_0xe1e6('0x58')](handleError(_0x373298,null));};exports[_0xe1e6('0x5f')]=function(_0x584b66,_0x3a4043){return db[_0xe1e6('0x41')][_0xe1e6('0x5f')](_0x584b66['body'],{})[_0xe1e6('0x24')](function(_0x5bae2c){var _0x4d9246=_0x584b66[_0xe1e6('0x60')][_0xe1e6('0x38')]({'plain':!![]});if(!_0x4d9246)throw new Error(_0xe1e6('0x61'));if(_0x4d9246[_0xe1e6('0x62')]==='user'){var _0x1dd256=_0x5bae2c[_0xe1e6('0x38')]({'plain':!![]});var _0x1d5323=_0xe1e6('0x39');return db[_0xe1e6('0x63')]['find']({'where':{'name':_0x1d5323,'userProfileId':_0x4d9246['userProfileId']},'raw':!![]})[_0xe1e6('0x24')](function(_0x4de68e){if(_0x4de68e&&_0x4de68e[_0xe1e6('0x64')]===0x0){return db['UserProfileResource']['create']({'name':_0x1dd256['name'],'resourceId':_0x1dd256['id'],'type':_0x4de68e[_0xe1e6('0x3c')],'sectionId':_0x4de68e['id']},{})[_0xe1e6('0x24')](function(){return _0x5bae2c;});}else{return _0x5bae2c;}})[_0xe1e6('0x58')](function(_0x393731){logger[_0xe1e6('0x28')](_0xe1e6('0x65'),_0x393731);throw _0x393731;});}return _0x5bae2c;})['then'](respondWithResult(_0x3a4043,0xc9))[_0xe1e6('0x58')](handleError(_0x3a4043,null));};exports[_0xe1e6('0x36')]=function(_0x4cfb02,_0x23db95){if(_0x4cfb02[_0xe1e6('0x66')]['id']){delete _0x4cfb02['body']['id'];}return db[_0xe1e6('0x41')][_0xe1e6('0x5e')]({'where':{'id':_0x4cfb02['params']['id']},'include':[{'model':db[_0xe1e6('0x3f')],'as':_0xe1e6('0x5a')}]})[_0xe1e6('0x24')](handleEntityNotFound(_0x23db95,null))[_0xe1e6('0x24')](saveUpdates(_0x4cfb02[_0xe1e6('0x66')],null))[_0xe1e6('0x24')](respondWithResult(_0x23db95,null))['catch'](handleError(_0x23db95,null));};exports['destroy']=function(_0x3f2847,_0x2701f7){return db[_0xe1e6('0x41')][_0xe1e6('0x5e')]({'where':{'id':_0x3f2847[_0xe1e6('0x67')]['id']}})[_0xe1e6('0x24')](handleEntityNotFound(_0x2701f7,null))[_0xe1e6('0x24')](removeEntity(_0x2701f7,null))[_0xe1e6('0x58')](handleError(_0x2701f7,null));};exports[_0xe1e6('0x68')]=function(_0x3500f1,_0x499882){return db['ChatWebsite'][_0xe1e6('0x68')]()[_0xe1e6('0x24')](respondWithResult(_0x499882,null))[_0xe1e6('0x58')](handleError(_0x499882,null));};exports['addDisposition']=function(_0x2bd6e8,_0x32ae90,_0x361c34){if(_0x2bd6e8[_0xe1e6('0x66')]['id']){delete _0x2bd6e8[_0xe1e6('0x66')]['id'];}return db['ChatWebsite'][_0xe1e6('0x5e')]({'where':{'id':_0x2bd6e8[_0xe1e6('0x67')]['id']}})[_0xe1e6('0x24')](handleEntityNotFound(_0x32ae90,null))['then'](function(_0x910001){if(_0x910001){_0x2bd6e8['body']['ChatWebsiteId']=_0x910001['id'];return db[_0xe1e6('0x69')][_0xe1e6('0x5f')](_0x2bd6e8[_0xe1e6('0x66')]);}})['then'](respondWithResult(_0x32ae90,null))[_0xe1e6('0x58')](handleError(_0x32ae90,null));};exports[_0xe1e6('0x6a')]=function(_0xe4f251,_0x3e9362,_0x63ef4e){var _0x1a0c9e={'raw':![],'where':{}};var _0x23f0e1={};var _0x2cf668={'count':0x0,'rows':[]};return db[_0xe1e6('0x41')]['findOne']({'where':{'id':_0xe4f251[_0xe1e6('0x67')]['id']}})[_0xe1e6('0x24')](handleEntityNotFound(_0x3e9362,null))['then'](function(_0x1cd422){if(_0x1cd422){_0x23f0e1['model']=_['keys'](db[_0xe1e6('0x69')][_0xe1e6('0x5b')]);_0x23f0e1[_0xe1e6('0x45')]=_['keys'](_0xe4f251[_0xe1e6('0x45')]);_0x23f0e1[_0xe1e6('0x47')]=_[_0xe1e6('0x48')](_0x23f0e1[_0xe1e6('0x4a')],_0x23f0e1[_0xe1e6('0x45')]);_0x1a0c9e['attributes']=_[_0xe1e6('0x48')](_0x23f0e1[_0xe1e6('0x4a')],qs[_0xe1e6('0x4b')](_0xe4f251['query'][_0xe1e6('0x4b')]));_0x1a0c9e[_0xe1e6('0x49')]=_0x1a0c9e['attributes'][_0xe1e6('0x5c')]?_0x1a0c9e[_0xe1e6('0x49')]:_0x23f0e1[_0xe1e6('0x4a')];if(!_0xe4f251['query'][_0xe1e6('0x4c')](_0xe1e6('0x6b'))){_0x1a0c9e[_0xe1e6('0x4d')]=qs['limit'](_0xe4f251[_0xe1e6('0x45')][_0xe1e6('0x4d')]);_0x1a0c9e['offset']=qs[_0xe1e6('0x31')](_0xe4f251[_0xe1e6('0x45')][_0xe1e6('0x31')]);}_0x1a0c9e['order']=qs[_0xe1e6('0x4f')](_0xe4f251[_0xe1e6('0x45')][_0xe1e6('0x4f')]);_0x1a0c9e[_0xe1e6('0x52')]=qs[_0xe1e6('0x47')](_[_0xe1e6('0x6c')](_0xe4f251['query'],_0x23f0e1[_0xe1e6('0x47')]));_0x1a0c9e[_0xe1e6('0x52')][_0xe1e6('0x6d')]=_0x1cd422['id'];if(_0xe4f251[_0xe1e6('0x45')]['filter']){_0x1a0c9e[_0xe1e6('0x52')]=_[_0xe1e6('0x51')](_0x1a0c9e[_0xe1e6('0x52')],{'$or':_[_0xe1e6('0x40')](_0x1a0c9e[_0xe1e6('0x49')],function(_0x46eefb){var _0x3993b4={};_0x3993b4[_0x46eefb]={'$like':'%'+_0xe4f251['query'][_0xe1e6('0x50')]+'%'};return _0x3993b4;})});}_0x1a0c9e=_[_0xe1e6('0x51')]({},_0x1a0c9e,_0xe4f251['options']);return db['Disposition']['count']({'where':_0x1a0c9e[_0xe1e6('0x52')]})[_0xe1e6('0x24')](function(_0x4bfac1){_0x2cf668[_0xe1e6('0x54')]=_0x4bfac1;if(_0xe4f251[_0xe1e6('0x45')][_0xe1e6('0x55')]){_0x1a0c9e['include']=[{'all':!![]}];}return db['Disposition'][_0xe1e6('0x56')](_0x1a0c9e);})[_0xe1e6('0x24')](function(_0x59a59b){_0x2cf668[_0xe1e6('0x57')]=_0x59a59b;return _0x2cf668;});}})[_0xe1e6('0x24')](respondWithFilteredResult(_0x3e9362,_0x1a0c9e))[_0xe1e6('0x58')](handleError(_0x3e9362,null));};exports['removeDispositions']=function(_0x4a84fb,_0x255fbb,_0x2e8f5f){return db['ChatWebsite'][_0xe1e6('0x5e')]({'where':{'id':_0x4a84fb[_0xe1e6('0x67')]['id']}})[_0xe1e6('0x24')](handleEntityNotFound(_0x255fbb,null))['then'](function(_0x59505b){if(_0x59505b){return _0x59505b[_0xe1e6('0x6e')](_0x4a84fb[_0xe1e6('0x45')][_0xe1e6('0x6f')]);}})[_0xe1e6('0x24')](respondWithStatusCode(_0x255fbb,null))[_0xe1e6('0x58')](handleError(_0x255fbb,null));};exports[_0xe1e6('0x70')]=function(_0x17791a,_0x3162e9,_0x474bfb){if(_0x17791a['body']['id']){delete _0x17791a[_0xe1e6('0x66')]['id'];}return db[_0xe1e6('0x41')][_0xe1e6('0x5e')]({'where':{'id':_0x17791a[_0xe1e6('0x67')]['id']}})[_0xe1e6('0x24')](handleEntityNotFound(_0x3162e9,null))['then'](function(_0xb9c578){if(_0xb9c578){_0x17791a['body'][_0xe1e6('0x6d')]=_0xb9c578['id'];return db[_0xe1e6('0x71')]['create'](_0x17791a[_0xe1e6('0x66')]);}})[_0xe1e6('0x24')](respondWithResult(_0x3162e9,null))['catch'](handleError(_0x3162e9,null));};exports['getAnswers']=function(_0x386a48,_0x227b21,_0x4c7e13){var _0x4ed266={'raw':![],'where':{}};var _0x1d0952={};var _0x50fa05={'count':0x0,'rows':[]};return db[_0xe1e6('0x41')][_0xe1e6('0x72')]({'where':{'id':_0x386a48[_0xe1e6('0x67')]['id']}})[_0xe1e6('0x24')](handleEntityNotFound(_0x227b21,null))[_0xe1e6('0x24')](function(_0x15391c){if(_0x15391c){_0x1d0952[_0xe1e6('0x4a')]=_[_0xe1e6('0x46')](db[_0xe1e6('0x71')]['rawAttributes']);_0x1d0952['query']=_[_0xe1e6('0x46')](_0x386a48[_0xe1e6('0x45')]);_0x1d0952[_0xe1e6('0x47')]=_[_0xe1e6('0x48')](_0x1d0952[_0xe1e6('0x4a')],_0x1d0952[_0xe1e6('0x45')]);_0x4ed266['attributes']=_[_0xe1e6('0x48')](_0x1d0952[_0xe1e6('0x4a')],qs[_0xe1e6('0x4b')](_0x386a48[_0xe1e6('0x45')][_0xe1e6('0x4b')]));_0x4ed266['attributes']=_0x4ed266[_0xe1e6('0x49')][_0xe1e6('0x5c')]?_0x4ed266[_0xe1e6('0x49')]:_0x1d0952['model'];if(!_0x386a48[_0xe1e6('0x45')][_0xe1e6('0x4c')]('nolimit')){_0x4ed266[_0xe1e6('0x4d')]=qs[_0xe1e6('0x4d')](_0x386a48[_0xe1e6('0x45')]['limit']);_0x4ed266[_0xe1e6('0x31')]=qs[_0xe1e6('0x31')](_0x386a48[_0xe1e6('0x45')]['offset']);}_0x4ed266['order']=qs[_0xe1e6('0x4f')](_0x386a48['query'][_0xe1e6('0x4f')]);_0x4ed266[_0xe1e6('0x52')]=qs['filters'](_[_0xe1e6('0x6c')](_0x386a48['query'],_0x1d0952[_0xe1e6('0x47')]));_0x4ed266[_0xe1e6('0x52')][_0xe1e6('0x6d')]=_0x15391c['id'];if(_0x386a48['query'][_0xe1e6('0x50')]){_0x4ed266['where']=_[_0xe1e6('0x51')](_0x4ed266[_0xe1e6('0x52')],{'$or':_[_0xe1e6('0x40')](_0x4ed266[_0xe1e6('0x49')],function(_0x4299ca){var _0x47493b={};_0x47493b[_0x4299ca]={'$like':'%'+_0x386a48[_0xe1e6('0x45')][_0xe1e6('0x50')]+'%'};return _0x47493b;})});}_0x4ed266=_['merge']({},_0x4ed266,_0x386a48[_0xe1e6('0x53')]);return db[_0xe1e6('0x71')][_0xe1e6('0x54')]({'where':_0x4ed266[_0xe1e6('0x52')]})[_0xe1e6('0x24')](function(_0x5c7295){_0x50fa05[_0xe1e6('0x54')]=_0x5c7295;if(_0x386a48['query'][_0xe1e6('0x55')]){_0x4ed266[_0xe1e6('0x5d')]=[{'all':!![]}];}return db[_0xe1e6('0x71')][_0xe1e6('0x56')](_0x4ed266);})[_0xe1e6('0x24')](function(_0x249926){_0x50fa05[_0xe1e6('0x57')]=_0x249926;return _0x50fa05;});}})['then'](respondWithFilteredResult(_0x227b21,_0x4ed266))['catch'](handleError(_0x227b21,null));};exports[_0xe1e6('0x73')]=function(_0x3aa0a4,_0x229a83,_0x52be82){return db[_0xe1e6('0x41')][_0xe1e6('0x5e')]({'where':{'id':_0x3aa0a4[_0xe1e6('0x67')]['id']}})[_0xe1e6('0x24')](handleEntityNotFound(_0x229a83,null))[_0xe1e6('0x24')](function(_0x391f89){if(_0x391f89){return _0x391f89[_0xe1e6('0x73')](_0x3aa0a4['query'][_0xe1e6('0x6f')]);}})[_0xe1e6('0x24')](respondWithStatusCode(_0x229a83,null))[_0xe1e6('0x58')](handleError(_0x229a83,null));};exports[_0xe1e6('0x74')]=function(_0x785ec0,_0x2a091b,_0x3136dd){_0x785ec0[_0xe1e6('0x66')]['sitepic']=_0x785ec0[_0xe1e6('0x75')][_0xe1e6('0x76')];return db[_0xe1e6('0x41')]['find']({'where':{'id':_0x785ec0['params']['id']}})[_0xe1e6('0x24')](handleEntityNotFound(_0x2a091b,null))[_0xe1e6('0x24')](saveUpdates(_0x785ec0[_0xe1e6('0x66')],null))[_0xe1e6('0x24')](respondWithResult(_0x2a091b,null))[_0xe1e6('0x58')](handleError(_0x2a091b,null));};exports[_0xe1e6('0x77')]=function(_0x46e02e,_0x24843b,_0x25654c){_0x46e02e[_0xe1e6('0x66')]['agentAvatar']=_0x46e02e[_0xe1e6('0x75')][_0xe1e6('0x76')];return db[_0xe1e6('0x41')][_0xe1e6('0x5e')]({'where':{'id':_0x46e02e[_0xe1e6('0x67')]['id']}})[_0xe1e6('0x24')](handleEntityNotFound(_0x24843b,null))[_0xe1e6('0x24')](saveUpdates(_0x46e02e[_0xe1e6('0x66')],null))[_0xe1e6('0x24')](respondWithResult(_0x24843b,null))[_0xe1e6('0x58')](handleError(_0x24843b,null));};exports[_0xe1e6('0x78')]=function(_0x25f280,_0xe84be8,_0x2ced72){_0x25f280['body'][_0xe1e6('0x79')]=_0x25f280[_0xe1e6('0x75')][_0xe1e6('0x76')];return db[_0xe1e6('0x41')][_0xe1e6('0x5e')]({'where':{'id':_0x25f280[_0xe1e6('0x67')]['id']}})['then'](handleEntityNotFound(_0xe84be8,null))[_0xe1e6('0x24')](saveUpdates(_0x25f280['body'],null))['then'](respondWithResult(_0xe84be8,null))[_0xe1e6('0x58')](handleError(_0xe84be8,null));};exports[_0xe1e6('0x7a')]=function(_0x1a0e6d,_0x206037,_0x185bb4){_0x1a0e6d[_0xe1e6('0x66')]['systemAvatar']=_0x1a0e6d['file'][_0xe1e6('0x76')];return db[_0xe1e6('0x41')][_0xe1e6('0x5e')]({'where':{'id':_0x1a0e6d['params']['id']}})[_0xe1e6('0x24')](handleEntityNotFound(_0x206037,null))[_0xe1e6('0x24')](saveUpdates(_0x1a0e6d[_0xe1e6('0x66')],null))[_0xe1e6('0x24')](respondWithResult(_0x206037,null))[_0xe1e6('0x58')](handleError(_0x206037,null));};exports[_0xe1e6('0x7b')]=function(_0x44dbcc,_0x27b034,_0x31775d){var _0x35dfa8=path[_0xe1e6('0x7c')](config[_0xe1e6('0x7d')],_0xe1e6('0x7e'));var _0x51da48={'where':{'id':_0x44dbcc[_0xe1e6('0x67')]['id']},'attributes':['id',_0xe1e6('0x7f')],'raw':!![]};var _0x43d4a6=![];return require(_0xe1e6('0x80'))[_0xe1e6('0x81')]()[_0xe1e6('0x24')](function(_0xa5b1b0){if(_0xa5b1b0){_0x43d4a6=_0xa5b1b0[_0xe1e6('0x82')];}})[_0xe1e6('0x24')](function(){return db['ChatWebsite'][_0xe1e6('0x5e')](_0x51da48);})[_0xe1e6('0x24')](handleEntityNotFound(_0x27b034,null))[_0xe1e6('0x24')](function(_0x38d6a7){if(_0x38d6a7){if(!_['isNil'](_0x38d6a7[_0xe1e6('0x7f')])){if(fs[_0xe1e6('0x83')](path[_0xe1e6('0x7c')](config['root'],_0xe1e6('0x84'),_0x38d6a7[_0xe1e6('0x7f')]))&&_0x43d4a6){_0x35dfa8=path['join'](config[_0xe1e6('0x7d')],_0xe1e6('0x84'),_0x38d6a7[_0xe1e6('0x7f')]);}}return _0x27b034[_0xe1e6('0x85')](_0x35dfa8);}})[_0xe1e6('0x58')](handleError(_0x27b034,null));};exports['getAvatar']=function(_0x4f72a6,_0x1ce853,_0x171c55){var _0x444497=path[_0xe1e6('0x7c')](config[_0xe1e6('0x7d')],'server/files/images/avatars/default_avatar.png');var _0x203c6b={'where':{'id':_0x4f72a6[_0xe1e6('0x67')]['id']},'attributes':['id',_0xe1e6('0x86')],'raw':!![]};return db[_0xe1e6('0x41')][_0xe1e6('0x5e')](_0x203c6b)[_0xe1e6('0x24')](handleEntityNotFound(_0x1ce853,null))[_0xe1e6('0x24')](function(_0x29c36f){if(_0x29c36f){if(!_['isNil'](_0x29c36f[_0xe1e6('0x86')])){if(fs['existsSync'](path[_0xe1e6('0x7c')](config['root'],'server/files/images/avatars/',_0x29c36f[_0xe1e6('0x86')]))){_0x444497=path['join'](config[_0xe1e6('0x7d')],'server/files/images/avatars/',_0x29c36f[_0xe1e6('0x86')]);}}return _0x1ce853[_0xe1e6('0x85')](_0x444497);}})[_0xe1e6('0x58')](handleError(_0x1ce853,null));};exports[_0xe1e6('0x87')]=function(_0x2b5696,_0x200f0e,_0x384cac){var _0x4c67ef=path[_0xe1e6('0x7c')](config[_0xe1e6('0x7d')],_0xe1e6('0x88'));var _0x28bb6c={'where':{'id':_0x2b5696[_0xe1e6('0x67')]['id']},'attributes':['id','customerAvatar',_0xe1e6('0x89')],'raw':!![]};return db[_0xe1e6('0x41')][_0xe1e6('0x5e')](_0x28bb6c)[_0xe1e6('0x24')](handleEntityNotFound(_0x200f0e,null))[_0xe1e6('0x24')](function(_0x36f1d7){if(_0x36f1d7){if(!_['isNil'](_0x36f1d7[_0xe1e6('0x79')])){if(fs[_0xe1e6('0x83')](path[_0xe1e6('0x7c')](config[_0xe1e6('0x7d')],_0xe1e6('0x8a'),_0x36f1d7[_0xe1e6('0x79')]))&&_0x36f1d7[_0xe1e6('0x89')]){_0x4c67ef=path['join'](config['root'],_0xe1e6('0x8a'),_0x36f1d7['customerAvatar']);}}return _0x200f0e['download'](_0x4c67ef);}})[_0xe1e6('0x58')](handleError(_0x200f0e,null));};exports[_0xe1e6('0x8b')]=function(_0x3cda66,_0x5334ee,_0x214c85){var _0x2e852b=path['join'](config[_0xe1e6('0x7d')],_0xe1e6('0x8c'));var _0x53fa65={'where':{'id':_0x3cda66[_0xe1e6('0x67')]['id']},'attributes':['id',_0xe1e6('0x8d')],'raw':!![]};return db['ChatWebsite'][_0xe1e6('0x5e')](_0x53fa65)[_0xe1e6('0x24')](handleEntityNotFound(_0x5334ee,null))[_0xe1e6('0x24')](function(_0x120d1d){if(_0x120d1d){if(!_[_0xe1e6('0x8e')](_0x120d1d[_0xe1e6('0x8d')])){if(fs['existsSync'](path[_0xe1e6('0x7c')](config['root'],_0xe1e6('0x8a'),_0x120d1d[_0xe1e6('0x8d')]))){_0x2e852b=path[_0xe1e6('0x7c')](config[_0xe1e6('0x7d')],_0xe1e6('0x8a'),_0x120d1d['systemAvatar']);}}return _0x5334ee['download'](_0x2e852b);}})[_0xe1e6('0x58')](handleError(_0x5334ee,null));};exports['notify']=function(_0xa120f8,_0x2488b5,_0x3f2c35){var _0x57c310=require(_0xe1e6('0x8f'));var _0x412069=new _0x57c310();var _0x46d173=_0x412069[_0xe1e6('0x90')](_0xa120f8[_0xe1e6('0x91')][_0xe1e6('0x92')])[_0xe1e6('0x93')]();var _0x314f66={'body':_0xa120f8[_0xe1e6('0x66')],'channel':'chat'};var _0x313e4a=[];var _0x2b8f9a=[];var _0x1a0449={};var _0x333730=![];return db['CmContact'][_0xe1e6('0x68')]()['then'](function(_0x3c38d5){if(!_0x3c38d5){throw new db[(_0xe1e6('0x20'))][(_0xe1e6('0x21'))](_0xe1e6('0x94'));}_0x313e4a=_[_0xe1e6('0x95')](_['keys'](_0x3c38d5),['createdAt',_0xe1e6('0x96')]);_0x2b8f9a=_['difference'](_[_0xe1e6('0x46')](_0x3c38d5),[_0xe1e6('0x97'),'updatedAt',_0xe1e6('0x98'),_0xe1e6('0x99')]);if(_0xa120f8[_0xe1e6('0x66')]['id']){delete _0xa120f8['body']['id'];}if(_['isNil'](_0xa120f8[_0xe1e6('0x66')]['from'])){throw new db[(_0xe1e6('0x20'))][(_0xe1e6('0x21'))](_0xe1e6('0x9a'));}if(_['isNil'](_0xa120f8['body'][_0xe1e6('0x66')])||_0xa120f8[_0xe1e6('0x66')][_0xe1e6('0x66')]===''){throw new db[(_0xe1e6('0x20'))][(_0xe1e6('0x21'))](_0xe1e6('0x9b'));}if(_['isNil'](_0xa120f8[_0xe1e6('0x66')][_0xe1e6('0x9c')])){throw new db[(_0xe1e6('0x20'))][(_0xe1e6('0x21'))]('mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x2b8f9a);}if(!_[_0xe1e6('0x9d')](_0x2b8f9a,_0xa120f8['body']['mapKey'])){throw new db[(_0xe1e6('0x20'))][(_0xe1e6('0x21'))](_0xe1e6('0x9e')+_0x2b8f9a);}_0x1a0449[_0xa120f8[_0xe1e6('0x66')][_0xe1e6('0x9c')]]=_0xa120f8[_0xe1e6('0x66')][_0xe1e6('0x9f')];})['then'](function(){return db[_0xe1e6('0x41')][_0xe1e6('0x5e')]({'where':{'id':_0xa120f8[_0xe1e6('0x67')]['id']},'include':[{'model':db[_0xe1e6('0xa0')],'as':_0xe1e6('0xa1'),'include':[{'model':db[_0xe1e6('0xa2')],'as':_0xe1e6('0xa3'),'where':_0x1a0449,'limit':0x1,'order':[[_0xe1e6('0x96'),_0xe1e6('0xa4')]]}]},{'model':db[_0xe1e6('0xa5')],'as':'Applications'}]});})[_0xe1e6('0x24')](handleEntityNotFound(_0x2488b5,null))['then'](function(_0x137dda){if(_0x137dda&&_0x137dda[_0xe1e6('0xa1')]){_0x314f66['account']=_0x137dda;_0x314f66['applications']=_0x137dda[_0xe1e6('0xa6')];_0x314f66['list']=_0x137dda[_0xe1e6('0xa1')];_0x314f66[_0xe1e6('0xa7')]=_[_0xe1e6('0xa8')](_0x314f66[_0xe1e6('0xa7')],[_0xe1e6('0xa9')],[_0xe1e6('0xaa')]);if(_0x314f66['account'][_0xe1e6('0xa6')]){delete _0x314f66[_0xe1e6('0xab')]['Applications'];}if(_0x314f66[_0xe1e6('0xab')][_0xe1e6('0xa1')]&&_0x314f66[_0xe1e6('0xab')][_0xe1e6('0xa1')][_0xe1e6('0xa3')]['length']){return _0x314f66[_0xe1e6('0xab')][_0xe1e6('0xa1')][_0xe1e6('0xa3')][0x0];}var _0x1aa4ba=_[_0xe1e6('0xac')](_0xa120f8[_0xe1e6('0x66')],{'firstName':_0xa120f8['body'][_0xe1e6('0x9f')],'ListId':_0x137dda[_0xe1e6('0x99')]});_0x1aa4ba[_0xa120f8[_0xe1e6('0x66')][_0xe1e6('0x9c')]]=_0xa120f8['body'][_0xe1e6('0x9f')];return db[_0xe1e6('0xa2')][_0xe1e6('0x5f')](_0x1aa4ba,{'fields':_0x313e4a,'raw':!![]});}})[_0xe1e6('0x24')](handleEntityNotFound(_0x2488b5,null))[_0xe1e6('0x24')](function(_0x5dca6f){_0x314f66[_0xe1e6('0xad')]=_0x5dca6f;var _0x21e337=_0xa120f8[_0xe1e6('0x66')]['customerIp'];if(_0xa120f8[_0xe1e6('0x91')][_0xe1e6('0xae')]){_0x21e337=_0xa120f8[_0xe1e6('0x91')]['cf-connecting-ip'];}else if(_0xa120f8[_0xe1e6('0x91')][_0xe1e6('0xaf')]){_0x21e337=_['first'](_0xa120f8['headers'][_0xe1e6('0xaf')][_0xe1e6('0xb0')](','));}if(_0x5dca6f){var _0x4f3aa1={'ContactId':_0x5dca6f['id'],'ChatWebsiteId':_0xa120f8[_0xe1e6('0x67')]['id'],'from':(_0x5dca6f[_0xe1e6('0xb1')]||'')+'\x20'+(_0x5dca6f[_0xe1e6('0xb2')]||''),'customerIp':_0x21e337,'customerPort':_0xa120f8[_0xe1e6('0x91')]['x-real-port']?_0xa120f8[_0xe1e6('0x91')][_0xe1e6('0xb3')]:null,'referer':_0xa120f8['body']['referer'],'browserName':_0x46d173[_0xe1e6('0xb4')]['name']&&_0x46d173[_0xe1e6('0xb4')]['version']?util[_0xe1e6('0xb5')]('%s\x20%s',_0x46d173[_0xe1e6('0xb4')][_0xe1e6('0x3c')],_0x46d173['browser'][_0xe1e6('0xb6')]):'unknown','browserVersion':_0x46d173[_0xe1e6('0xb4')][_0xe1e6('0xb6')]||_0xe1e6('0xb7'),'osName':util[_0xe1e6('0xb5')](_0xe1e6('0xb8'),_0x46d173['os'][_0xe1e6('0x3c')],_0x46d173['os'][_0xe1e6('0xb6')]),'osVersion':_0x46d173['os'][_0xe1e6('0xb6')],'deviceModel':_0x46d173['device'][_0xe1e6('0x4a')]&&_0x46d173[_0xe1e6('0xb9')]['vendor']?util[_0xe1e6('0xb5')](_0xe1e6('0xba'),_0x46d173['device']['model'],_0x46d173['device']['vendor'],_0x46d173[_0xe1e6('0xb9')][_0xe1e6('0x43')]):null,'deviceVendor':_0x46d173[_0xe1e6('0xb9')][_0xe1e6('0xbb')],'deviceType':_0x46d173[_0xe1e6('0xb9')][_0xe1e6('0x43')],'formData':JSON[_0xe1e6('0x27')](_0xa120f8[_0xe1e6('0x66')])};var _0x40f2d9={'ChatWebsiteId':_0xa120f8[_0xe1e6('0x67')]['id'],'closed':![]};if(_0xa120f8[_0xe1e6('0x66')][_0xe1e6('0xbc')]){_0x40f2d9[_0xe1e6('0xbc')]=_0xa120f8['body'][_0xe1e6('0xbc')];return db[_0xe1e6('0xbd')][_0xe1e6('0x5e')]({'where':_0x40f2d9})[_0xe1e6('0x24')](function(_0x2aea75){if(_0x2aea75){return[_0x2aea75,![]];}_0x4f3aa1['threadId']=_0xa120f8[_0xe1e6('0x66')][_0xe1e6('0xbc')];_0x4f3aa1[_0xe1e6('0xbe')]=_0xa120f8[_0xe1e6('0x66')][_0xe1e6('0xbe')];return db[_0xe1e6('0xbd')][_0xe1e6('0x5f')](_0x4f3aa1)[_0xe1e6('0x24')](function(_0x45ecaf){return[_0x45ecaf,!![]];});});}_0x40f2d9[_0xe1e6('0xbf')]=_0x5dca6f['id'];if(_0xa120f8['body'][_0xe1e6('0xc0')]&&_0xa120f8['body']['interaction']['id']){_0x40f2d9['id']=_0xa120f8[_0xe1e6('0x66')]['interaction']['id'];return db[_0xe1e6('0xbd')][_0xe1e6('0x5e')]({'where':_0x40f2d9})['then'](function(_0x3bf0b9){if(_0x3bf0b9){return[_0x3bf0b9,![]];}return db[_0xe1e6('0xbd')][_0xe1e6('0x5f')](_0x4f3aa1)[_0xe1e6('0x24')](function(_0x845fb8){return[_0x845fb8,!![]];});});}return db[_0xe1e6('0xbd')][_0xe1e6('0x5f')](_0x4f3aa1)[_0xe1e6('0x24')](function(_0x37137e){return[_0x37137e,!![]];});}})[_0xe1e6('0xc1')](function(_0x101218,_0x26bbd1){if(_0x101218){_0x333730=_0x26bbd1;if(!_0x26bbd1){var _0x226d15={'from':(_0x314f66[_0xe1e6('0xad')][_0xe1e6('0xb1')]||'')+'\x20'+(_0x314f66['contact'][_0xe1e6('0xb2')]||'')};if(_0xa120f8['body']['threadId']&&_0xa120f8[_0xe1e6('0x66')][_0xe1e6('0xc2')]&&_0xa120f8['body']['threadId']!=_0xa120f8['body']['messageId']){_0x226d15[_0xe1e6('0xbc')]=_0xa120f8[_0xe1e6('0x66')]['messageId'];}return _0x101218[_0xe1e6('0x36')](_0x226d15);}else{return _0x101218;}}})[_0xe1e6('0x24')](function(_0x1fa896){_0x314f66[_0xe1e6('0xc0')]=_0x1fa896[_0xe1e6('0x38')]({'plain':!![]});_0x314f66[_0xe1e6('0xc0')][_0xe1e6('0xc3')]=_0x333730;if(_0x314f66[_0xe1e6('0xc0')]['created']){if(_0x314f66['account'][_0xe1e6('0xc4')]){_0x314f66[_0xe1e6('0xa7')][_0xe1e6('0xc5')]({'id':0x0,'priority':_0x314f66[_0xe1e6('0xa7')][_0xe1e6('0x5c')]+0x1,'app':'close','appdata':_0xe1e6('0xc6'),'interval':_0xe1e6('0xc7')});}}return db['ChatMessage']['create']({'body':_0xa120f8[_0xe1e6('0x66')]['body'],'ChatWebsiteId':_0xa120f8[_0xe1e6('0x67')]['id'],'ChatInteractionId':_0x1fa896['id'],'direction':'in','ContactId':_0x314f66[_0xe1e6('0xad')]['id'],'AttachmentId':_0xa120f8[_0xe1e6('0x66')]['AttachmentId']});})['then'](function(_0x32d4e3){_0x314f66['message']=_0x32d4e3;if(_0x314f66['interaction'][_0xe1e6('0xc8')]){return db[_0xe1e6('0xc9')][_0xe1e6('0x5e')]({'attributes':['id',_0xe1e6('0x3c')],'where':{'id':_0x314f66[_0xe1e6('0xc0')][_0xe1e6('0xc8')]}})['then'](function(_0x1a0e65){if(_0x1a0e65){_0x314f66['applications'][_0xe1e6('0xca')]({'id':0x0,'priority':0x0,'app':_0xe1e6('0xcb'),'appdata':_0x1a0e65[_0xe1e6('0x3c')]+','+(_0x314f66[_0xe1e6('0xab')]['waitForTheAssignedAgent']||0xa),'interval':'*,*,*,*'});_0x314f66[_0xe1e6('0xcc')]=!![];}return respondWithRpcPromise(_0xe1e6('0xcd'),_0xe1e6('0xce'),_0x314f66);});}return respondWithRpcPromise(_0xe1e6('0xcd'),_0xe1e6('0xce'),_0x314f66);})['then'](function(_0x2d07e6){respondWithRpcPromise('EventManager',_0xe1e6('0xcf'),{'event':_0xe1e6('0xd0'),'message':_0x2d07e6},client9002);return _0x2d07e6;})[_0xe1e6('0x24')](respondWithResult(_0x2488b5,null))[_0xe1e6('0x58')](handleError(_0x2488b5,null));};exports[_0xe1e6('0xd1')]=function(_0x6fa068,_0x1c5035,_0xc7cb2e){var _0x568b8d,_0x2ee6bc,_0x3c58fd;var _0x45255f=[];var _0x3319d3=[];var _0x4299a7={};return db[_0xe1e6('0xa2')]['describe']()[_0xe1e6('0x24')](function(_0x46a86f){if(!_0x46a86f){throw new db[(_0xe1e6('0x20'))][(_0xe1e6('0x21'))](_0xe1e6('0x94'));}_0x3319d3=_[_0xe1e6('0x95')](_['keys'](_0x46a86f),['createdAt','updatedAt']);_0x45255f=_[_0xe1e6('0x95')](_[_0xe1e6('0x46')](_0x46a86f),[_0xe1e6('0x97'),_0xe1e6('0x96'),_0xe1e6('0x98'),'ListId']);if(_0x6fa068[_0xe1e6('0x66')]['id']){delete _0x6fa068[_0xe1e6('0x66')]['id'];}if(_['isNil'](_0x6fa068[_0xe1e6('0x66')][_0xe1e6('0x9f')])){throw _0x1c5035[_0xe1e6('0x2f')](0x1f4)[_0xe1e6('0x3d')](new db[(_0xe1e6('0x20'))]['ValidationError']('from\x20is\x20mandatory'));}if(_['isNil'](_0x6fa068[_0xe1e6('0x66')][_0xe1e6('0x66')])||_0x6fa068[_0xe1e6('0x66')]['body']===''){throw _0x1c5035[_0xe1e6('0x2f')](0x1f4)[_0xe1e6('0x3d')](new db['Sequelize'][(_0xe1e6('0x21'))]('body\x20is\x20mandatory\x20and\x20not\x20empty'));}if(_[_0xe1e6('0x8e')](_0x6fa068['body'][_0xe1e6('0xd2')])){throw _0x1c5035[_0xe1e6('0x2f')](0x1f4)['send'](new db[(_0xe1e6('0x20'))][(_0xe1e6('0x21'))](_0xe1e6('0xd3')+_0x45255f));}if(!_[_0xe1e6('0x9d')](_0x45255f,_0x6fa068[_0xe1e6('0x66')][_0xe1e6('0xd2')])){throw _0x1c5035[_0xe1e6('0x2f')](0x1f4)['send'](new db['Sequelize'][(_0xe1e6('0x21'))](_0xe1e6('0xd4')+_0x45255f));}_0x4299a7[_0x6fa068['body'][_0xe1e6('0xd2')]]=_0x6fa068['body'][_0xe1e6('0x9f')];})[_0xe1e6('0x24')](function(){return db['ChatWebsite'][_0xe1e6('0x5e')]({'where':{'id':_0x6fa068[_0xe1e6('0x67')]['id']},'include':[{'model':db[_0xe1e6('0xa0')],'as':_0xe1e6('0xa1')}]});})[_0xe1e6('0x24')](handleEntityNotFound(_0x1c5035,null))[_0xe1e6('0x24')](function(_0x1ca193){if(_0x1ca193&&_0x1ca193[_0xe1e6('0xa1')]){_0x2ee6bc=_0x1ca193;var _0x271923=_[_0xe1e6('0xac')](_0x6fa068[_0xe1e6('0x66')],{'firstName':_0x6fa068[_0xe1e6('0x66')][_0xe1e6('0x9f')],'phone':_0x6fa068[_0xe1e6('0x66')][_0xe1e6('0x9f')],'ListId':_0x1ca193['ListId']});_0x271923[_0x6fa068[_0xe1e6('0x66')][_0xe1e6('0xd2')]]=_0x6fa068[_0xe1e6('0x66')][_0xe1e6('0x9f')];return db[_0xe1e6('0xa2')][_0xe1e6('0xd5')]({'where':_0x4299a7,'defaults':_0x271923});}})[_0xe1e6('0xc1')](function(_0x18b72f){if(_0x18b72f){_0x3c58fd=_0x18b72f;var _0x5af0bf=fs['readFileSync'](path['join'](config[_0xe1e6('0x7d')],_0xe1e6('0xd6')),_0xe1e6('0xd7'));var _0x3e837a=ejs[_0xe1e6('0xd8')](_0x5af0bf,{'body':_[_0xe1e6('0xd9')](_0x6fa068[_0xe1e6('0x66')]['body']),'bodyTitle':_0x2ee6bc[_0xe1e6('0xda')]});return db['ChatOfflineMessage'][_0xe1e6('0x5f')]({'body':_0x3e837a,'ContactId':_0x18b72f['id'],'ChatWebsiteId':_0x2ee6bc['id']});}})[_0xe1e6('0x24')](function(_0x318ef5){if(_0x318ef5){_0x568b8d=_0x318ef5;return db['MailAccount']['findOne']({'where':{'service':!![]},'include':[{'model':db[_0xe1e6('0xdb')],'as':_0xe1e6('0xdc'),'raw':!![]}]});}})[_0xe1e6('0x24')](function(_0x5388fe){if(_0x5388fe&&_0x5388fe[_0xe1e6('0xdc')]&&_0x2ee6bc[_0xe1e6('0xdd')]){var _0x16fa17={'tls':{'rejectUnauthorized':![]}};if(_0x5388fe[_0xe1e6('0xdc')]['service']){_0x16fa17['service']=_0x5388fe['Smtp'][_0xe1e6('0xde')];}else{_0x16fa17[_0xe1e6('0xdf')]=_0x5388fe['Smtp'][_0xe1e6('0xdf')];_0x16fa17['port']=_0x5388fe[_0xe1e6('0xdc')][_0xe1e6('0xe0')];_0x16fa17[_0xe1e6('0xe1')]=_0x5388fe[_0xe1e6('0xdc')][_0xe1e6('0xe1')];}if(_0x5388fe['Smtp'][_0xe1e6('0xe2')]){_0x16fa17['auth']={'user':_0x5388fe[_0xe1e6('0xdc')][_0xe1e6('0x60')],'pass':_0x5388fe['Smtp']['pass']};}return respondWithRpcPromise(_0xe1e6('0xe3'),'sendMail',{'account':_0x16fa17,'message':{'from':util[_0xe1e6('0xb5')](_0xe1e6('0xe4'),_0x5388fe[_0xe1e6('0x3c')],_0x5388fe[_0xe1e6('0xe5')]||_0x5388fe['Smtp'][_0xe1e6('0x60')]),'to':_0x2ee6bc['forwardOfflineAddress'],'subject':_0x2ee6bc['offlineMessageSubject'],'text':_0x568b8d[_0xe1e6('0x66')]}},client9003)['then'](function(){return _0x568b8d;})[_0xe1e6('0x58')](function(_0x5b48fe){console[_0xe1e6('0x28')](_0x5b48fe);});}})[_0xe1e6('0x24')](function(){if(_0x568b8d){return _0x568b8d;}})['then'](respondWithResult(_0x1c5035,null))['catch'](handleError(_0x1c5035,null));};exports[_0xe1e6('0xe6')]=function(_0x5b73ba,_0x169be0,_0x41bacf){return db[_0xe1e6('0xbd')][_0xe1e6('0x5e')]({'where':{'id':_0x5b73ba[_0xe1e6('0x67')]['id']}})[_0xe1e6('0x24')](handleEntityNotFound(_0x169be0,null))[_0xe1e6('0x24')](function(_0x3f89b4){if(_0x3f89b4){return _0x3f89b4[_0xe1e6('0xe6')](_0x5b73ba[_0xe1e6('0x66')]['ids'],_[_0xe1e6('0xe7')](_0x5b73ba[_0xe1e6('0x66')],[_0xe1e6('0x6f'),'id'])||{});}})['then'](respondWithResult(_0x169be0,null))[_0xe1e6('0x58')](handleError(_0x169be0,null));};exports[_0xe1e6('0xe8')]=function(_0x3cd924,_0x21f9be,_0x16961b){var _0x55bdf9={'raw':![],'where':{}};var _0x3ce3e9={};var _0xc251d3={'count':0x0,'rows':[]};return db[_0xe1e6('0x41')][_0xe1e6('0x72')]({'where':{'id':_0x3cd924[_0xe1e6('0x67')]['id']}})[_0xe1e6('0x24')](handleEntityNotFound(_0x21f9be,null))[_0xe1e6('0x24')](function(_0xdb667f){if(_0xdb667f){_0x3ce3e9[_0xe1e6('0x4a')]=_[_0xe1e6('0x46')](db[_0xe1e6('0xbd')][_0xe1e6('0x5b')]);_0x3ce3e9[_0xe1e6('0x45')]=_[_0xe1e6('0x46')](_0x3cd924[_0xe1e6('0x45')]);_0x3ce3e9[_0xe1e6('0x47')]=_['intersection'](_0x3ce3e9[_0xe1e6('0x4a')],_0x3ce3e9[_0xe1e6('0x45')]);_0x55bdf9[_0xe1e6('0x49')]=_[_0xe1e6('0x48')](_0x3ce3e9[_0xe1e6('0x4a')],qs[_0xe1e6('0x4b')](_0x3cd924['query']['fields']));_0x55bdf9['attributes']=_0x55bdf9[_0xe1e6('0x49')][_0xe1e6('0x5c')]?_0x55bdf9[_0xe1e6('0x49')]:_0x3ce3e9['model'];if(!_0x3cd924[_0xe1e6('0x45')]['hasOwnProperty']('nolimit')){_0x55bdf9['limit']=qs['limit'](_0x3cd924[_0xe1e6('0x45')][_0xe1e6('0x4d')]);_0x55bdf9[_0xe1e6('0x31')]=qs[_0xe1e6('0x31')](_0x3cd924[_0xe1e6('0x45')][_0xe1e6('0x31')]);}_0x55bdf9[_0xe1e6('0x4e')]=qs[_0xe1e6('0x4f')](_0x3cd924['query'][_0xe1e6('0x4f')]);_0x55bdf9['where']=qs[_0xe1e6('0x47')](_[_0xe1e6('0x6c')](_0x3cd924[_0xe1e6('0x45')],_0x3ce3e9[_0xe1e6('0x47')]));_0x55bdf9[_0xe1e6('0x52')][_0xe1e6('0x6d')]=_0xdb667f['id'];if(_0x3cd924['query'][_0xe1e6('0x50')]){_0x55bdf9['where']=_[_0xe1e6('0x51')](_0x55bdf9[_0xe1e6('0x52')],{'$or':_[_0xe1e6('0x40')](_0x55bdf9[_0xe1e6('0x49')],function(_0x3320c5){var _0x1d2579={};_0x1d2579[_0x3320c5]={'$like':'%'+_0x3cd924['query'][_0xe1e6('0x50')]+'%'};return _0x1d2579;})});}_0x55bdf9=_[_0xe1e6('0x51')]({},_0x55bdf9,_0x3cd924[_0xe1e6('0x53')]);return db[_0xe1e6('0xbd')]['count']({'where':_0x55bdf9[_0xe1e6('0x52')]})[_0xe1e6('0x24')](function(_0x9c9cef){_0xc251d3[_0xe1e6('0x54')]=_0x9c9cef;if(_0x3cd924[_0xe1e6('0x45')]['includeAll']){_0x55bdf9['include']=[{'model':db[_0xe1e6('0xa2')],'as':'Contact','required':![]},{'model':db[_0xe1e6('0xc9')],'as':_0xe1e6('0xe9'),'attributes':['name','fullname','internal'],'required':![]},{'model':db[_0xe1e6('0xea')],'as':_0xe1e6('0xeb'),'attributes':['id','name',_0xe1e6('0xec')],'where':_0x3cd924[_0xe1e6('0x45')][_0xe1e6('0xed')]?{'id':_0x3cd924[_0xe1e6('0x45')]['tag']}:undefined,'required':_0x3cd924['query'][_0xe1e6('0xed')]?!![]:![]}];}return db[_0xe1e6('0xbd')]['findAll'](_0x55bdf9);})['then'](function(_0x63d579){_0xc251d3['rows']=_0x63d579;return _0xc251d3;});}})[_0xe1e6('0x24')](respondWithFilteredResult(_0x21f9be,_0x55bdf9))[_0xe1e6('0x58')](handleError(_0x21f9be,null));};function iftimePromise(_0xa42f42,_0x51a842){return respondWithRpcPromise('Command',_0xe1e6('0xee'),{'command':_0x51a842[_0xe1e6('0xef')]?util[_0xe1e6('0xb5')](_0xe1e6('0xf0'),_0xa42f42[_0xe1e6('0xf1')],_0x51a842[_0xe1e6('0xef')]):util['format'](_0xe1e6('0xf2'),_0xa42f42[_0xe1e6('0xf1')])},client9002)[_0xe1e6('0x24')](function(_0x285837){var _0x2f598f=_0x285837&&_0x285837['indexOf'](_0xe1e6('0xf3'))>=0x0?!![]:![];logger[_0xe1e6('0x2c')](_0xe1e6('0xf4'),_0x51a842['id'],_0xa42f42['id'],_0xa42f42['interval'],_0x2f598f?_0xe1e6('0xf5'):_0xe1e6('0xf6'),_0x51a842[_0xe1e6('0xef')]?_0x51a842[_0xe1e6('0xef')]:_0xe1e6('0xf7'));return _0x2f598f;})[_0xe1e6('0x58')](function(_0xa43deb){logger[_0xe1e6('0x28')](_0xe1e6('0xf4'),_0x51a842['id'],_0xa42f42['id'],_0xa42f42['interval'],util[_0xe1e6('0xf8')](_0xa43deb,{'showHidden':![],'depth':null}),_0x51a842[_0xe1e6('0xef')]?_0x51a842['timezone']:_0xe1e6('0xf7'));return![];});}exports[_0xe1e6('0xee')]=function(_0x9be0b5,_0x2bb241,_0x10fcf5){var _0x2c2973=0x0;var _0x14b91e=0x0;var _0x4d6962=![];var _0xe0fd9c;var _0x3215e8;return db['ChatWebsite']['find']({'where':{'id':_0x9be0b5[_0xe1e6('0x67')]['id']},'include':[{'model':db['Interval'],'as':_0xe1e6('0xf9'),'include':[{'model':db[_0xe1e6('0xf9')],'as':'Intervals','attributes':['id',_0xe1e6('0xf1')],'raw':!![]}]}]})[_0xe1e6('0x24')](handleEntityNotFound(_0x2bb241,null))[_0xe1e6('0x24')](function(_0x27fd77){if(_0x27fd77){_0xe0fd9c=_0x27fd77;return _0x27fd77['getProactiveActions']({'raw':!![]});}})[_0xe1e6('0x24')](function(_0x57da25){if(_0xe0fd9c){if(_0x57da25){_0x3215e8=_0x57da25;}}return require(_0xe1e6('0x80'))[_0xe1e6('0x81')]();})[_0xe1e6('0x24')](function(_0x434c21){if(_0x434c21){_0x14b91e=_0x434c21[_0xe1e6('0xfa')];_0x4d6962=_0x434c21[_0xe1e6('0x82')];}})[_0xe1e6('0x24')](function(){return db[_0xe1e6('0xbd')][_0xe1e6('0x54')]({'where':{'closed':![]}});})[_0xe1e6('0x24')](function(_0x23d4a6){_0x2c2973=_0x23d4a6;if(_0x14b91e&&_0x23d4a6>_0x14b91e){return db['License'][_0xe1e6('0x72')]({'where':{'id':0x1}})[_0xe1e6('0x24')](function(_0xadd835){if(_0xadd835){_0xadd835[_0xe1e6('0xfb')](_0xe1e6('0xfc'));}});}})[_0xe1e6('0x24')](function(){if(_0xe0fd9c[_0xe1e6('0xf9')]&&_0xe0fd9c[_0xe1e6('0xf9')][_0xe1e6('0xfd')]){var _0x3fde06=[];for(var _0x35acc2=0x0;_0x35acc2<_0xe0fd9c[_0xe1e6('0xf9')][_0xe1e6('0xfd')][_0xe1e6('0x5c')];_0x35acc2++){var _0xabdcf=_0xe0fd9c[_0xe1e6('0xf9')][_0xe1e6('0xfd')][_0x35acc2][_0xe1e6('0x38')]({'plain':!![]});_0x3fde06[_0xe1e6('0xc5')](iftimePromise(_0xabdcf,_0xe0fd9c));}return BPromise['all'](_0x3fde06)[_0xe1e6('0x24')](function(_0x3bcd2e){return _[_0xe1e6('0xfe')](_0x3bcd2e);});}else{return!![];}})['then'](function(_0x3dae3a){var _0x2a6305=fs[_0xe1e6('0xff')](path[_0xe1e6('0x7c')](config['root'],_0xe1e6('0x100')),'utf8');var _0x307cba={'remote':_0xe0fd9c[_0xe1e6('0x101')],'query':querystring['stringify'](_['merge'](_0xe0fd9c[_0xe1e6('0x38')]({'plain':!![]}),{'customerIp':_0x9be0b5['headers'][_0xe1e6('0xaf')]||_0x9be0b5[_0xe1e6('0x91')]['x-real-ip']||_0x9be0b5[_0xe1e6('0x102')][_0xe1e6('0x103')]||_0x9be0b5['ip'],'referer':_0x9be0b5[_0xe1e6('0x91')][_0xe1e6('0x104')],'openedInteractions':_0x2c2973,'maxInteractions':_0x14b91e,'virtual':_0x4d6962[_0xe1e6('0xfa')],'online':_0x3dae3a,'custom':_0x4d6962}))[_0xe1e6('0x105')](/'/g,'\x5c\x27')};_0x2bb241['send'](ejs[_0xe1e6('0xd8')](Mustache[_0xe1e6('0xd8')](_0x2a6305,_0x307cba),{'proactiveActions':_0x3215e8,'alignment':_0xe0fd9c['alignment'],'verticalAlignment':_0xe0fd9c[_0xe1e6('0x106')],'div_color':_0xe0fd9c[_0xe1e6('0xec')],'text_color':_0xe0fd9c[_0xe1e6('0x107')]}));})[_0xe1e6('0x58')](handleError(_0x2bb241,null));};exports[_0xe1e6('0x108')]=function(_0x50c5c2,_0x28aede,_0x379c04){return db[_0xe1e6('0x41')]['findOne']({'where':{'id':_0x50c5c2['params']['id']}})['then'](handleEntityNotFound(_0x28aede,null))[_0xe1e6('0x24')](function(_0x49cc48){if(_0x49cc48){return db[_0xe1e6('0x109')]['transaction'](function(_0x304ff5){return db['ChatApplication'][_0xe1e6('0x37')]({'where':{'ChatWebsiteId':_0x50c5c2[_0xe1e6('0x67')]['id']},'transaction':_0x304ff5})['then'](function(_0x29beef){var _0x4702a0=_[_0xe1e6('0x40')](_0x50c5c2[_0xe1e6('0x66')],function(_0x32638d){_0x32638d[_0xe1e6('0x6d')]=_0x50c5c2[_0xe1e6('0x67')]['id'];return _0x32638d;});return db[_0xe1e6('0xa5')][_0xe1e6('0x10a')](_0x4702a0,{'transaction':_0x304ff5});});})['then'](function(){return db[_0xe1e6('0xa5')][_0xe1e6('0x10b')]({'where':{'ChatWebsiteId':_0x50c5c2[_0xe1e6('0x67')]['id']},'order':'priority'});});}})[_0xe1e6('0x24')](respondWithResult(_0x28aede,null))[_0xe1e6('0x58')](handleError(_0x28aede,null));};exports['getApplications']=function(_0x24861b,_0x46bdd3,_0x2af581){var _0x52689a={};var _0x5efab1={};var _0x1834d2;var _0x35c85c;return db[_0xe1e6('0x41')][_0xe1e6('0x72')]({'where':{'id':_0x24861b[_0xe1e6('0x67')]['id']}})[_0xe1e6('0x24')](handleEntityNotFound(_0x46bdd3,null))[_0xe1e6('0x24')](function(_0x24fbf5){if(_0x24fbf5){_0x1834d2=_0x24fbf5;_0x5efab1['model']=_[_0xe1e6('0x46')](db['ChatApplication'][_0xe1e6('0x5b')]);_0x5efab1[_0xe1e6('0x45')]=_[_0xe1e6('0x46')](_0x24861b[_0xe1e6('0x45')]);_0x5efab1[_0xe1e6('0x47')]=_[_0xe1e6('0x48')](_0x5efab1[_0xe1e6('0x4a')],_0x5efab1[_0xe1e6('0x45')]);_0x52689a['attributes']=_[_0xe1e6('0x48')](_0x5efab1[_0xe1e6('0x4a')],qs[_0xe1e6('0x4b')](_0x24861b[_0xe1e6('0x45')][_0xe1e6('0x4b')]));_0x52689a['attributes']=_0x52689a[_0xe1e6('0x49')][_0xe1e6('0x5c')]?_0x52689a[_0xe1e6('0x49')]:_0x5efab1[_0xe1e6('0x4a')];_0x52689a[_0xe1e6('0x4e')]=qs[_0xe1e6('0x4f')](_0x24861b['query'][_0xe1e6('0x4f')]);_0x52689a[_0xe1e6('0x52')]=qs[_0xe1e6('0x47')](_[_0xe1e6('0x6c')](_0x24861b[_0xe1e6('0x45')],_0x5efab1[_0xe1e6('0x47')]));if(_0x24861b['query'][_0xe1e6('0x50')]){_0x52689a[_0xe1e6('0x52')]=_[_0xe1e6('0x51')](_0x52689a[_0xe1e6('0x52')],{'$or':_[_0xe1e6('0x40')](_0x52689a[_0xe1e6('0x49')],function(_0x240fd9){var _0x6c240={};_0x6c240[_0x240fd9]={'$like':'%'+_0x24861b['query']['filter']+'%'};return _0x6c240;})});}_0x52689a=_['merge']({},_0x52689a,_0x24861b[_0xe1e6('0x53')]);return _0x1834d2[_0xe1e6('0x10c')](_0x52689a);}})[_0xe1e6('0x24')](function(_0xb14bff){if(_0xb14bff){_0x35c85c=_0xb14bff[_0xe1e6('0x5c')];if(!_0x24861b[_0xe1e6('0x45')][_0xe1e6('0x4c')](_0xe1e6('0x6b'))){_0x52689a['limit']=qs[_0xe1e6('0x4d')](_0x24861b['query'][_0xe1e6('0x4d')]);_0x52689a[_0xe1e6('0x31')]=qs[_0xe1e6('0x31')](_0x24861b['query'][_0xe1e6('0x31')]);}return _0x1834d2['getApplications'](_0x52689a);}})[_0xe1e6('0x24')](function(_0x47a2c2){if(_0x47a2c2){return _0x47a2c2?{'count':_0x35c85c,'rows':_0x47a2c2}:null;}})[_0xe1e6('0x24')](respondWithResult(_0x46bdd3,null))[_0xe1e6('0x58')](handleError(_0x46bdd3,null));};exports[_0xe1e6('0x10d')]=function(_0x217529,_0x11b38b,_0x550aa8){return db[_0xe1e6('0x10e')][_0xe1e6('0x5e')]({'where':{'id':_0x217529[_0xe1e6('0x67')]['id']}})[_0xe1e6('0x24')](handleEntityNotFound(_0x11b38b,null))['then'](function(_0x225a0e){if(_0x225a0e){return _0x225a0e[_0xe1e6('0x10d')](_0x217529[_0xe1e6('0x66')][_0xe1e6('0x6f')],_[_0xe1e6('0xe7')](_0x217529[_0xe1e6('0x66')],[_0xe1e6('0x6f'),'id'])||{});}})[_0xe1e6('0x24')](respondWithResult(_0x11b38b,null))[_0xe1e6('0x58')](handleError(_0x11b38b,null));};exports['getProactiveActions']=function(_0x5494a3,_0x3863ec,_0x50e703){var _0xafa87={};var _0x6fa73a={};var _0x5b7d32;var _0x1fe500;return db[_0xe1e6('0x41')][_0xe1e6('0x72')]({'where':{'id':_0x5494a3[_0xe1e6('0x67')]['id']}})['then'](handleEntityNotFound(_0x3863ec,null))[_0xe1e6('0x24')](function(_0x450d90){if(_0x450d90){_0x5b7d32=_0x450d90;_0x6fa73a[_0xe1e6('0x4a')]=_[_0xe1e6('0x46')](db['ChatProactiveAction'][_0xe1e6('0x5b')]);_0x6fa73a['query']=_[_0xe1e6('0x46')](_0x5494a3['query']);_0x6fa73a[_0xe1e6('0x47')]=_['intersection'](_0x6fa73a[_0xe1e6('0x4a')],_0x6fa73a[_0xe1e6('0x45')]);_0xafa87[_0xe1e6('0x49')]=_[_0xe1e6('0x48')](_0x6fa73a[_0xe1e6('0x4a')],qs[_0xe1e6('0x4b')](_0x5494a3['query']['fields']));_0xafa87['attributes']=_0xafa87['attributes'][_0xe1e6('0x5c')]?_0xafa87[_0xe1e6('0x49')]:_0x6fa73a[_0xe1e6('0x4a')];_0xafa87[_0xe1e6('0x4e')]=qs[_0xe1e6('0x4f')](_0x5494a3[_0xe1e6('0x45')][_0xe1e6('0x4f')]);_0xafa87['where']=qs['filters'](_[_0xe1e6('0x6c')](_0x5494a3[_0xe1e6('0x45')],_0x6fa73a[_0xe1e6('0x47')]));if(_0x5494a3[_0xe1e6('0x45')]['filter']){_0xafa87['where']=_['merge'](_0xafa87[_0xe1e6('0x52')],{'$or':_['map'](_0xafa87[_0xe1e6('0x49')],function(_0x11e091){var _0x31d734={};_0x31d734[_0x11e091]={'$like':'%'+_0x5494a3['query']['filter']+'%'};return _0x31d734;})});}_0xafa87=_['merge']({},_0xafa87,_0x5494a3['options']);return _0x5b7d32[_0xe1e6('0x10f')](_0xafa87);}})[_0xe1e6('0x24')](function(_0x29e94c){if(_0x29e94c){_0x1fe500=_0x29e94c[_0xe1e6('0x5c')];if(!_0x5494a3[_0xe1e6('0x45')]['hasOwnProperty'](_0xe1e6('0x6b'))){_0xafa87[_0xe1e6('0x4d')]=qs[_0xe1e6('0x4d')](_0x5494a3[_0xe1e6('0x45')][_0xe1e6('0x4d')]);_0xafa87['offset']=qs[_0xe1e6('0x31')](_0x5494a3[_0xe1e6('0x45')]['offset']);}return _0x5b7d32['getProactiveActions'](_0xafa87);}})['then'](function(_0x4af4d3){if(_0x4af4d3){return _0x4af4d3?{'count':_0x1fe500,'rows':_0x4af4d3}:null;}})['then'](respondWithResult(_0x3863ec,null))['catch'](handleError(_0x3863ec,null));};exports[_0xe1e6('0x110')]=function(_0x22acf2,_0x41846b,_0x1aa751){var _0x43af74=_0x22acf2['query']['online']===_0xe1e6('0x111')?_0xe1e6('0x112'):_0xe1e6('0x113');return db[_0xe1e6('0x41')][_0xe1e6('0x5e')]({'attributes':['id',_0x43af74],'where':{'id':_0x22acf2[_0xe1e6('0x67')]['id']}})['then'](handleEntityNotFound(_0x41846b,null))[_0xe1e6('0x24')](function(_0x195100){if(_0x195100){var _0x150516=_0x195100[_0x43af74];var _0x454a48=_0x150516&&_0x150516[_0xe1e6('0x114')]?_0x150516[_0xe1e6('0x114')]:[];_0x41846b[_0xe1e6('0x3d')]({'fromKey':_[_0xe1e6('0x8e')](_0x150516[_0xe1e6('0x115')])?undefined:_0x150516[_0xe1e6('0x115')],'count':_0x454a48[_0xe1e6('0x5c')],'rows':_0x454a48});}})[_0xe1e6('0x58')](handleError(_0x41846b,null));};exports['getOfflineMessages']=function(_0x581162,_0x32fbe0,_0x32b225){var _0x57c99f={'raw':![],'where':{}};var _0x57ad4b={};var _0x659c5a={'count':0x0,'rows':[]};return db[_0xe1e6('0x41')][_0xe1e6('0x72')]({'where':{'id':_0x581162['params']['id']}})[_0xe1e6('0x24')](handleEntityNotFound(_0x32fbe0,null))[_0xe1e6('0x24')](function(_0x468308){if(_0x468308){_0x57ad4b[_0xe1e6('0x4a')]=_['keys'](db['ChatOfflineMessage'][_0xe1e6('0x5b')]);_0x57ad4b[_0xe1e6('0x45')]=_[_0xe1e6('0x46')](_0x581162[_0xe1e6('0x45')]);_0x57ad4b[_0xe1e6('0x47')]=_[_0xe1e6('0x48')](_0x57ad4b['model'],_0x57ad4b[_0xe1e6('0x45')]);_0x57c99f[_0xe1e6('0x49')]=_['intersection'](_0x57ad4b[_0xe1e6('0x4a')],qs[_0xe1e6('0x4b')](_0x581162[_0xe1e6('0x45')][_0xe1e6('0x4b')]));_0x57c99f[_0xe1e6('0x49')]=_0x57c99f[_0xe1e6('0x49')]['length']?_0x57c99f['attributes']:_0x57ad4b[_0xe1e6('0x4a')];if(!_0x581162[_0xe1e6('0x45')][_0xe1e6('0x4c')](_0xe1e6('0x6b'))){_0x57c99f[_0xe1e6('0x4d')]=qs['limit'](_0x581162[_0xe1e6('0x45')][_0xe1e6('0x4d')]);_0x57c99f[_0xe1e6('0x31')]=qs['offset'](_0x581162[_0xe1e6('0x45')][_0xe1e6('0x31')]);}_0x57c99f[_0xe1e6('0x4e')]=qs['sort'](_0x581162[_0xe1e6('0x45')][_0xe1e6('0x4f')]);_0x57c99f[_0xe1e6('0x52')]=qs[_0xe1e6('0x47')](_[_0xe1e6('0x6c')](_0x581162['query'],_0x57ad4b[_0xe1e6('0x47')]));_0x57c99f[_0xe1e6('0x52')][_0xe1e6('0x6d')]=_0x468308['id'];if(_0x581162['query'][_0xe1e6('0x50')]){_0x57c99f['where']=_[_0xe1e6('0x51')](_0x57c99f['where'],{'$or':_[_0xe1e6('0x40')](_0x57c99f[_0xe1e6('0x49')],function(_0x35b25d){var _0x18a635={};_0x18a635[_0x35b25d]={'$like':'%'+_0x581162['query'][_0xe1e6('0x50')]+'%'};return _0x18a635;})});}_0x57c99f=_['merge']({},_0x57c99f,_0x581162[_0xe1e6('0x53')]);return db[_0xe1e6('0x116')][_0xe1e6('0x54')]({'where':_0x57c99f[_0xe1e6('0x52')]})[_0xe1e6('0x24')](function(_0x278703){_0x659c5a[_0xe1e6('0x54')]=_0x278703;if(_0x581162['query']['includeAll']){_0x57c99f[_0xe1e6('0x5d')]=[{'all':!![]}];}else{_0x57c99f[_0xe1e6('0x5d')]=[{'model':db['CmContact'],'as':_0xe1e6('0x117'),'required':![]}];}return db[_0xe1e6('0x116')][_0xe1e6('0x56')](_0x57c99f);})[_0xe1e6('0x24')](function(_0x433ff1){_0x659c5a[_0xe1e6('0x57')]=_0x433ff1;return _0x659c5a;});}})['then'](respondWithFilteredResult(_0x32fbe0,_0x57c99f))['catch'](handleError(_0x32fbe0,null));};exports[_0xe1e6('0x118')]=function(_0x2a59b8,_0x300d4d,_0x24be92){return db[_0xe1e6('0x41')][_0xe1e6('0x5e')]({'where':{'id':_0x2a59b8[_0xe1e6('0x67')]['id']}})['then'](handleEntityNotFound(_0x300d4d,null))[_0xe1e6('0x24')](function(_0x4246dd){if(_0x4246dd){return _0x4246dd[_0xe1e6('0x118')](_0x2a59b8[_0xe1e6('0x66')]['ids'],_[_0xe1e6('0xe7')](_0x2a59b8[_0xe1e6('0x66')],[_0xe1e6('0x6f'),'id'])||{})[_0xe1e6('0xc1')](function(_0x53de22){for(var _0x16854b=0x0;_0x16854b<_0x2a59b8[_0xe1e6('0x66')][_0xe1e6('0x6f')]['length'];_0x16854b+=0x1){socket['emit'](_0xe1e6('0x119'),{'UserId':_0x2a59b8[_0xe1e6('0x66')]['ids'][_0x16854b],'ChatWebsiteId':_0x2a59b8[_0xe1e6('0x67')]['id']});}return _0x53de22;});}})[_0xe1e6('0x24')](respondWithResult(_0x300d4d,null))[_0xe1e6('0x58')](handleError(_0x300d4d,null));};exports['removeAgents']=function(_0x3f3543,_0x2377bd,_0x2f6852){return db[_0xe1e6('0x41')][_0xe1e6('0x5e')]({'where':{'id':_0x3f3543[_0xe1e6('0x67')]['id']}})[_0xe1e6('0x24')](handleEntityNotFound(_0x2377bd,null))[_0xe1e6('0x24')](function(_0x36aff1){if(_0x36aff1){return _0x36aff1[_0xe1e6('0x11a')](_0x3f3543['query']['ids'])[_0xe1e6('0x24')](function(){if(_[_0xe1e6('0x11b')](_0x3f3543[_0xe1e6('0x45')][_0xe1e6('0x6f')])){for(var _0xb87c8d=0x0;_0xb87c8d<_0x3f3543[_0xe1e6('0x45')][_0xe1e6('0x6f')][_0xe1e6('0x5c')];_0xb87c8d+=0x1){socket[_0xe1e6('0x11c')]('userChatWebsite:remove',{'UserId':Number(_0x3f3543[_0xe1e6('0x45')][_0xe1e6('0x6f')][_0xb87c8d]),'ChatWebsiteId':Number(_0x3f3543[_0xe1e6('0x67')]['id'])});}}else{socket[_0xe1e6('0x11c')](_0xe1e6('0x11d'),{'UserId':Number(_0x3f3543[_0xe1e6('0x45')][_0xe1e6('0x6f')]),'ChatWebsiteId':Number(_0x3f3543['params']['id'])});}});}})['then'](respondWithStatusCode(_0x2377bd,null))[_0xe1e6('0x58')](handleError(_0x2377bd,null));};exports[_0xe1e6('0x11e')]=function(_0x3c7f65,_0x6810f,_0x455047){var _0x2aa92b={};var _0x38ae7f={};var _0x16b967;var _0xcd945e;return db[_0xe1e6('0x41')]['findOne']({'where':{'id':_0x3c7f65[_0xe1e6('0x67')]['id']}})[_0xe1e6('0x24')](handleEntityNotFound(_0x6810f,null))[_0xe1e6('0x24')](function(_0x495857){if(_0x495857){_0x16b967=_0x495857;_0x38ae7f[_0xe1e6('0x4a')]=_[_0xe1e6('0x46')](db[_0xe1e6('0xc9')][_0xe1e6('0x5b')]);_0x38ae7f[_0xe1e6('0x45')]=_['keys'](_0x3c7f65['query']);_0x38ae7f[_0xe1e6('0x47')]=_[_0xe1e6('0x48')](_0x38ae7f[_0xe1e6('0x4a')],_0x38ae7f[_0xe1e6('0x45')]);_0x2aa92b[_0xe1e6('0x49')]=_[_0xe1e6('0x48')](_0x38ae7f[_0xe1e6('0x4a')],qs[_0xe1e6('0x4b')](_0x3c7f65['query'][_0xe1e6('0x4b')]));_0x2aa92b[_0xe1e6('0x49')]=_0x2aa92b['attributes'][_0xe1e6('0x5c')]?_0x2aa92b[_0xe1e6('0x49')]:_0x38ae7f[_0xe1e6('0x4a')];_0x2aa92b['order']=qs[_0xe1e6('0x4f')](_0x3c7f65['query'][_0xe1e6('0x4f')]);_0x2aa92b[_0xe1e6('0x52')]=qs['filters'](_[_0xe1e6('0x6c')](_0x3c7f65[_0xe1e6('0x45')],_0x38ae7f[_0xe1e6('0x47')]));if(_0x3c7f65[_0xe1e6('0x45')][_0xe1e6('0x50')]){_0x2aa92b[_0xe1e6('0x52')]=_[_0xe1e6('0x51')](_0x2aa92b[_0xe1e6('0x52')],{'$or':_[_0xe1e6('0x40')](_0x2aa92b['attributes'],function(_0x5f3e33){var _0x5d15c0={};_0x5d15c0[_0x5f3e33]={'$like':'%'+_0x3c7f65[_0xe1e6('0x45')][_0xe1e6('0x50')]+'%'};return _0x5d15c0;})});}_0x2aa92b=_['merge']({},_0x2aa92b,_0x3c7f65[_0xe1e6('0x53')]);return _0x16b967[_0xe1e6('0x11e')](_0x2aa92b);}})[_0xe1e6('0x24')](function(_0x5024a5){if(_0x5024a5){_0xcd945e=_0x5024a5[_0xe1e6('0x5c')];if(!_0x3c7f65[_0xe1e6('0x45')][_0xe1e6('0x4c')](_0xe1e6('0x6b'))){_0x2aa92b[_0xe1e6('0x4d')]=qs[_0xe1e6('0x4d')](_0x3c7f65['query'][_0xe1e6('0x4d')]);_0x2aa92b[_0xe1e6('0x31')]=qs[_0xe1e6('0x31')](_0x3c7f65[_0xe1e6('0x45')][_0xe1e6('0x31')]);}return _0x16b967[_0xe1e6('0x11e')](_0x2aa92b);}})[_0xe1e6('0x24')](function(_0xf5409f){if(_0xf5409f){return _0xf5409f?{'count':_0xcd945e,'rows':_0xf5409f}:null;}})['then'](respondWithResult(_0x6810f,null))[_0xe1e6('0x58')](handleError(_0x6810f,null));}; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.events.js b/server/api/chatWebsite/chatWebsite.events.js index 1accff1..e3ce751 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 _0xbeff=['setMaxListeners','save','update','emit','hasOwnProperty','hook','../../mysqldb','ChatWebsite'];(function(_0xb8baa9,_0x3fcc6a){var _0x464bd0=function(_0x3db1c6){while(--_0x3db1c6){_0xb8baa9['push'](_0xb8baa9['shift']());}};_0x464bd0(++_0x3fcc6a);}(_0xbeff,0x8e));var _0xfbef=function(_0x18787c,_0xc3b5f7){_0x18787c=_0x18787c-0x0;var _0x52b24e=_0xbeff[_0x18787c];return _0x52b24e;};'use strict';var EventEmitter=require('events');var ChatWebsite=require(_0xfbef('0x0'))['db'][_0xfbef('0x1')];var ChatWebsiteEvents=new EventEmitter();ChatWebsiteEvents[_0xfbef('0x2')](0x0);var events={'afterCreate':_0xfbef('0x3'),'afterUpdate':_0xfbef('0x4'),'afterDestroy':'remove'};function emitEvent(_0x4f6ba4){return function(_0x474798,_0x387be8,_0x367559){ChatWebsiteEvents[_0xfbef('0x5')](_0x4f6ba4+':'+_0x474798['id'],_0x474798);ChatWebsiteEvents['emit'](_0x4f6ba4,_0x474798);_0x367559(null);};}for(var e in events){if(events[_0xfbef('0x6')](e)){var event=events[e];ChatWebsite[_0xfbef('0x7')](e,emitEvent(event));}}module['exports']=ChatWebsiteEvents; \ No newline at end of file +var _0xf380=['emit','hasOwnProperty','exports','../../mysqldb','setMaxListeners','update','remove'];(function(_0x2247ab,_0x3f4162){var _0x430062=function(_0x591dd7){while(--_0x591dd7){_0x2247ab['push'](_0x2247ab['shift']());}};_0x430062(++_0x3f4162);}(_0xf380,0xb9));var _0x0f38=function(_0x3656aa,_0x14f8b8){_0x3656aa=_0x3656aa-0x0;var _0x513a85=_0xf380[_0x3656aa];return _0x513a85;};'use strict';var EventEmitter=require('events');var ChatWebsite=require(_0x0f38('0x0'))['db']['ChatWebsite'];var ChatWebsiteEvents=new EventEmitter();ChatWebsiteEvents[_0x0f38('0x1')](0x0);var events={'afterCreate':'save','afterUpdate':_0x0f38('0x2'),'afterDestroy':_0x0f38('0x3')};function emitEvent(_0x3bb0e3){return function(_0x38db31,_0x2ad344,_0x2e9c9d){ChatWebsiteEvents[_0x0f38('0x4')](_0x3bb0e3+':'+_0x38db31['id'],_0x38db31);ChatWebsiteEvents[_0x0f38('0x4')](_0x3bb0e3,_0x38db31);_0x2e9c9d(null);};}for(var e in events){if(events[_0x0f38('0x5')](e)){var event=events[e];ChatWebsite['hook'](e,emitEvent(event));}}module[_0x0f38('0x6')]=ChatWebsiteEvents; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.model.js b/server/api/chatWebsite/chatWebsite.model.js index 7ba983a..9017201 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 _0xcb91=['rimraf','./chatWebsite.attributes','exports','define','chat_websites','../../config/logger','api','moment','bluebird','path'];(function(_0x5061a3,_0x59da29){var _0x34cc76=function(_0xb87e8a){while(--_0xb87e8a){_0x5061a3['push'](_0x5061a3['shift']());}};_0x34cc76(++_0x59da29);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x34f545,_0x2bd2ee){_0x34f545=_0x34f545-0x0;var _0x1ff6b8=_0xcb91[_0x34f545];return _0x1ff6b8;};'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')]('ChatWebsite',attributes,{'tableName':_0x1cb9('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1da6=['exports','define','ChatWebsite','chat_websites','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./chatWebsite.attributes'];(function(_0x10b48a,_0x1a0a3f){var _0x2c4533=function(_0x5e4be6){while(--_0x5e4be6){_0x10b48a['push'](_0x10b48a['shift']());}};_0x2c4533(++_0x1a0a3f);}(_0x1da6,0x7c));var _0x61da=function(_0x3034ce,_0x1421b6){_0x3034ce=_0x3034ce-0x0;var _0x4bc0e3=_0x1da6[_0x3034ce];return _0x4bc0e3;};'use strict';var _=require(_0x61da('0x0'));var util=require(_0x61da('0x1'));var logger=require(_0x61da('0x2'))(_0x61da('0x3'));var moment=require(_0x61da('0x4'));var BPromise=require(_0x61da('0x5'));var rp=require(_0x61da('0x6'));var fs=require('fs');var path=require(_0x61da('0x7'));var rimraf=require(_0x61da('0x8'));var config=require(_0x61da('0x9'));var attributes=require(_0x61da('0xa'));module[_0x61da('0xb')]=function(_0x16cd66,_0x2c40c6){return _0x16cd66[_0x61da('0xc')](_0x61da('0xd'),attributes,{'tableName':_0x61da('0xe'),'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 054e5fd..495bdd2 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 _0x1a37=['rpc','jayson/promise','http','redis','defaults','register','request','then','request\x20sent','debug','ChatWebsite,\x20%s,\x20%s,\x20%s','stringify','error','code','ChatWebsite,\x20%s,\x20%s','message','info','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x450fe1,_0x2aa8a6){var _0x7cd4b7=function(_0x4eb25b){while(--_0x4eb25b){_0x450fe1['push'](_0x450fe1['shift']());}};_0x7cd4b7(++_0x2aa8a6);}(_0x1a37,0xb4));var _0x71a3=function(_0x3ff085,_0x27c92e){_0x3ff085=_0x3ff085-0x0;var _0x2b68c3=_0x1a37[_0x3ff085];return _0x2b68c3;};'use strict';var _=require(_0x71a3('0x0'));var util=require(_0x71a3('0x1'));var moment=require(_0x71a3('0x2'));var BPromise=require(_0x71a3('0x3'));var rs=require(_0x71a3('0x4'));var fs=require('fs');var Redis=require(_0x71a3('0x5'));var db=require(_0x71a3('0x6'))['db'];var utils=require(_0x71a3('0x7'));var logger=require(_0x71a3('0x8'))(_0x71a3('0x9'));var config=require('../../config/environment');var jayson=require(_0x71a3('0xa'));var client=jayson['client'][_0x71a3('0xb')]({'port':0x232a});config[_0x71a3('0xc')]=_[_0x71a3('0xd')](config[_0x71a3('0xc')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require('./chatWebsite.socket')[_0x71a3('0xe')](socket);function respondWithRpcPromise(_0x18320a,_0x3709bc,_0x3aeb48){return new BPromise(function(_0x3a7fc1,_0x2215f2){return client[_0x71a3('0xf')](_0x18320a,_0x3aeb48)[_0x71a3('0x10')](function(_0x5c464c){logger['info']('ChatWebsite,\x20%s,\x20%s',_0x3709bc,_0x71a3('0x11'));logger[_0x71a3('0x12')](_0x71a3('0x13'),_0x3709bc,_0x71a3('0x11'),JSON[_0x71a3('0x14')](_0x5c464c));if(_0x5c464c[_0x71a3('0x15')]){if(_0x5c464c[_0x71a3('0x15')][_0x71a3('0x16')]===0x1f4){logger[_0x71a3('0x15')](_0x71a3('0x17'),_0x3709bc,_0x5c464c[_0x71a3('0x15')]['message']);return _0x2215f2(_0x5c464c[_0x71a3('0x15')][_0x71a3('0x18')]);}logger['error']('ChatWebsite,\x20%s,\x20%s',_0x3709bc,_0x5c464c[_0x71a3('0x15')][_0x71a3('0x18')]);return _0x3a7fc1(_0x5c464c[_0x71a3('0x15')][_0x71a3('0x18')]);}else{logger[_0x71a3('0x19')](_0x71a3('0x17'),_0x3709bc,'request\x20sent');_0x3a7fc1(_0x5c464c[_0x71a3('0x1a')][_0x71a3('0x18')]);}})['catch'](function(_0x5f4562){logger[_0x71a3('0x15')](_0x71a3('0x17'),_0x3709bc,_0x5f4562);_0x2215f2(_0x5f4562);});});} \ No newline at end of file +var _0x47c5=['ChatWebsite,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','./chatWebsite.socket','register','request','then','ChatWebsite,\x20%s,\x20%s','request\x20sent'];(function(_0x546ecb,_0x457191){var _0x97f7bc=function(_0x5655af){while(--_0x5655af){_0x546ecb['push'](_0x546ecb['shift']());}};_0x97f7bc(++_0x457191);}(_0x47c5,0x165));var _0x547c=function(_0x560964,_0x2c0ad6){_0x560964=_0x560964-0x0;var _0xe78f82=_0x47c5[_0x560964];return _0xe78f82;};'use strict';var _=require(_0x547c('0x0'));var util=require(_0x547c('0x1'));var moment=require(_0x547c('0x2'));var BPromise=require(_0x547c('0x3'));var rs=require(_0x547c('0x4'));var fs=require('fs');var Redis=require(_0x547c('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x547c('0x6'));var logger=require(_0x547c('0x7'))('rpc');var config=require(_0x547c('0x8'));var jayson=require(_0x547c('0x9'));var client=jayson['client'][_0x547c('0xa')]({'port':0x232a});config[_0x547c('0xb')]=_[_0x547c('0xc')](config[_0x547c('0xb')],{'host':_0x547c('0xd'),'port':0x18eb});var socket=require(_0x547c('0xe'))(new Redis(config[_0x547c('0xb')]));require(_0x547c('0xf'))[_0x547c('0x10')](socket);function respondWithRpcPromise(_0x44a581,_0x72828d,_0x2c54e){return new BPromise(function(_0x111457,_0x2455e9){return client[_0x547c('0x11')](_0x44a581,_0x2c54e)[_0x547c('0x12')](function(_0x44ab17){logger['info'](_0x547c('0x13'),_0x72828d,_0x547c('0x14'));logger['debug'](_0x547c('0x15'),_0x72828d,_0x547c('0x14'),JSON[_0x547c('0x16')](_0x44ab17));if(_0x44ab17[_0x547c('0x17')]){if(_0x44ab17[_0x547c('0x17')][_0x547c('0x18')]===0x1f4){logger[_0x547c('0x17')](_0x547c('0x13'),_0x72828d,_0x44ab17[_0x547c('0x17')][_0x547c('0x19')]);return _0x2455e9(_0x44ab17[_0x547c('0x17')][_0x547c('0x19')]);}logger[_0x547c('0x17')](_0x547c('0x13'),_0x72828d,_0x44ab17[_0x547c('0x17')][_0x547c('0x19')]);return _0x111457(_0x44ab17[_0x547c('0x17')][_0x547c('0x19')]);}else{logger['info']('ChatWebsite,\x20%s,\x20%s',_0x72828d,_0x547c('0x14'));_0x111457(_0x44ab17[_0x547c('0x1a')][_0x547c('0x19')]);}})['catch'](function(_0x248aca){logger[_0x547c('0x17')](_0x547c('0x13'),_0x72828d,_0x248aca);_0x2455e9(_0x248aca);});});} \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.socket.js b/server/api/chatWebsite/chatWebsite.socket.js index f0e7df7..1df9a7c 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 _0xb10b=['emit','removeListener','register','chatWebsite:','./chatWebsite.events','remove','update'];(function(_0x52d303,_0x26f460){var _0x42d1c6=function(_0x23d305){while(--_0x23d305){_0x52d303['push'](_0x52d303['shift']());}};_0x42d1c6(++_0x26f460);}(_0xb10b,0x12a));var _0xbb10=function(_0x3bfdde,_0x306be4){_0x3bfdde=_0x3bfdde-0x0;var _0x3f752a=_0xb10b[_0x3bfdde];return _0x3f752a;};'use strict';var ChatWebsiteEvents=require(_0xbb10('0x0'));var events=['save',_0xbb10('0x1'),_0xbb10('0x2')];function createListener(_0x1dcb08,_0x4d688c){return function(_0x4541ae){_0x4d688c[_0xbb10('0x3')](_0x1dcb08,_0x4541ae);};}function removeListener(_0x460981,_0x22320e){return function(){ChatWebsiteEvents[_0xbb10('0x4')](_0x460981,_0x22320e);};}exports[_0xbb10('0x5')]=function(_0x481979){for(var _0x328583=0x0,_0x3cdd53=events['length'];_0x328583<_0x3cdd53;_0x328583++){var _0x1b9e94=events[_0x328583];var _0x3fb675=createListener(_0xbb10('0x6')+_0x1b9e94,_0x481979);ChatWebsiteEvents['on'](_0x1b9e94,_0x3fb675);}}; \ No newline at end of file +var _0xb10b=['emit','removeListener','register','chatWebsite:','./chatWebsite.events','remove','update'];(function(_0x212b03,_0x1f1b50){var _0x423115=function(_0x35ab9d){while(--_0x35ab9d){_0x212b03['push'](_0x212b03['shift']());}};_0x423115(++_0x1f1b50);}(_0xb10b,0x12a));var _0xbb10=function(_0x291276,_0x5a4690){_0x291276=_0x291276-0x0;var _0x303ab3=_0xb10b[_0x291276];return _0x303ab3;};'use strict';var ChatWebsiteEvents=require(_0xbb10('0x0'));var events=['save',_0xbb10('0x1'),_0xbb10('0x2')];function createListener(_0x1dcb08,_0x4d688c){return function(_0x4541ae){_0x4d688c[_0xbb10('0x3')](_0x1dcb08,_0x4541ae);};}function removeListener(_0x460981,_0x22320e){return function(){ChatWebsiteEvents[_0xbb10('0x4')](_0x460981,_0x22320e);};}exports[_0xbb10('0x5')]=function(_0x481979){for(var _0x328583=0x0,_0x3cdd53=events['length'];_0x328583<_0x3cdd53;_0x328583++){var _0x1b9e94=events[_0x328583];var _0x3fb675=createListener(_0xbb10('0x6')+_0x1b9e94,_0x481979);ChatWebsiteEvents['on'](_0x1b9e94,_0x3fb675);}}; \ No newline at end of file diff --git a/server/api/chatWebsite/index.js b/server/api/chatWebsite/index.js index 23cf06c..62c2bc5 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 _0x20fa=['getCustomerAvatar','/:id/system_avatar','getSystemAvatar','/:id/interactions','getInteractions','/:id/snippet','getSnippet','/:id/applications','getProactiveActions','getFields','getOfflineMessages','/:id/users','post','create','addDisposition','addAnswer','diskStorage','join','server/files/images/logos/','format','%s-%s','originalname','addLogo','root','server/files/images/avatars/','addAvatar','now','single','file','/:id/notify','notify','/:id/offline','addInteraction','addApplications','/:id/proactive_actions','addProactiveActions','addAgents','update','delete','removeDispositions','removeAgents','exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatWebsite.controller','isAuthenticated','index','get','/describe','/:id','show','/:id/dispositions','/:id/canned_answers','getAnswers','/:id/logo','getLogo','/:id/avatar','/:id/customer_avatar'];(function(_0x3ed617,_0x281d6e){var _0x23238f=function(_0x169661){while(--_0x169661){_0x3ed617['push'](_0x3ed617['shift']());}};_0x23238f(++_0x281d6e);}(_0x20fa,0xea));var _0xa20f=function(_0x4ded65,_0xc8d7c1){_0x4ded65=_0x4ded65-0x0;var _0x5864fb=_0x20fa[_0x4ded65];return _0x5864fb;};'use strict';var multer=require(_0xa20f('0x0'));var util=require(_0xa20f('0x1'));var path=require('path');var timeout=require(_0xa20f('0x2'));var express=require(_0xa20f('0x3'));var router=express[_0xa20f('0x4')]();var auth=require(_0xa20f('0x5'));var interaction=require(_0xa20f('0x6'));var config=require(_0xa20f('0x7'));var controller=require(_0xa20f('0x8'));router['get']('/',auth[_0xa20f('0x9')](),controller[_0xa20f('0xa')]);router[_0xa20f('0xb')](_0xa20f('0xc'),auth[_0xa20f('0x9')](),controller['describe']);router[_0xa20f('0xb')](_0xa20f('0xd'),auth[_0xa20f('0x9')](),controller[_0xa20f('0xe')]);router[_0xa20f('0xb')](_0xa20f('0xf'),auth[_0xa20f('0x9')](),controller['getDispositions']);router[_0xa20f('0xb')](_0xa20f('0x10'),auth['isAuthenticated'](),controller[_0xa20f('0x11')]);router[_0xa20f('0xb')](_0xa20f('0x12'),controller[_0xa20f('0x13')]);router[_0xa20f('0xb')](_0xa20f('0x14'),controller['getAvatar']);router[_0xa20f('0xb')](_0xa20f('0x15'),controller[_0xa20f('0x16')]);router[_0xa20f('0xb')](_0xa20f('0x17'),controller[_0xa20f('0x18')]);router[_0xa20f('0xb')](_0xa20f('0x19'),auth['isAuthenticated'](),controller[_0xa20f('0x1a')]);router['get'](_0xa20f('0x1b'),controller[_0xa20f('0x1c')]);router[_0xa20f('0xb')](_0xa20f('0x1d'),auth[_0xa20f('0x9')](),controller['getApplications']);router[_0xa20f('0xb')]('/:id/proactive_actions',auth['isAuthenticated'](),controller[_0xa20f('0x1e')]);router['get']('/:id/fields',controller[_0xa20f('0x1f')]);router[_0xa20f('0xb')]('/:id/offline_messages',auth[_0xa20f('0x9')](),controller[_0xa20f('0x20')]);router[_0xa20f('0xb')](_0xa20f('0x21'),auth['isAuthenticated'](),controller['getAgents']);router[_0xa20f('0x22')]('/',auth[_0xa20f('0x9')](),controller[_0xa20f('0x23')]);router['post'](_0xa20f('0xf'),auth['isAuthenticated'](),controller[_0xa20f('0x24')]);router['post'](_0xa20f('0x10'),auth['isAuthenticated'](),controller[_0xa20f('0x25')]);var upload=multer({'storage':multer[_0xa20f('0x26')]({'destination':function(_0x4e5521,_0x5d9bfd,_0x48bdb4){_0x48bdb4(null,path[_0xa20f('0x27')](config['root'],_0xa20f('0x28')));},'filename':function(_0x4b271d,_0x5653f1,_0x5ebd88){_0x5ebd88(null,util[_0xa20f('0x29')](_0xa20f('0x2a'),Date['now'](),_0x5653f1[_0xa20f('0x2b')]));}})});router[_0xa20f('0x22')](_0xa20f('0x12'),upload['single']('file'),controller[_0xa20f('0x2c')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x16c83a,_0x17634c,_0x3b24bb){_0x3b24bb(null,path[_0xa20f('0x27')](config[_0xa20f('0x2d')],_0xa20f('0x2e')));},'filename':function(_0x4be8f2,_0x36ef15,_0x3617f3){_0x3617f3(null,util[_0xa20f('0x29')](_0xa20f('0x2a'),Date['now'](),_0x36ef15[_0xa20f('0x2b')]));}})});router[_0xa20f('0x22')](_0xa20f('0x14'),upload['single']('file'),controller[_0xa20f('0x2f')]);var upload=multer({'storage':multer[_0xa20f('0x26')]({'destination':function(_0x3f46c4,_0x5611f1,_0x8b5090){_0x8b5090(null,path[_0xa20f('0x27')](config['root'],_0xa20f('0x2e')));},'filename':function(_0x43c239,_0x2d814b,_0x56d7f6){_0x56d7f6(null,util[_0xa20f('0x29')](_0xa20f('0x2a'),Date[_0xa20f('0x30')](),_0x2d814b[_0xa20f('0x2b')]));}})});router[_0xa20f('0x22')](_0xa20f('0x15'),upload[_0xa20f('0x31')](_0xa20f('0x32')),controller['addCustomerAvatar']);var upload=multer({'storage':multer[_0xa20f('0x26')]({'destination':function(_0x4537a1,_0x51a405,_0x3d29fe){_0x3d29fe(null,path['join'](config['root'],_0xa20f('0x2e')));},'filename':function(_0x347aea,_0x2d146b,_0x34c39f){_0x34c39f(null,util[_0xa20f('0x29')](_0xa20f('0x2a'),Date['now'](),_0x2d146b['originalname']));}})});router['post']('/:id/system_avatar',upload[_0xa20f('0x31')](_0xa20f('0x32')),controller['addSystemAvatar']);router['post'](_0xa20f('0x33'),controller[_0xa20f('0x34')]);router[_0xa20f('0x22')](_0xa20f('0x35'),controller['offline']);router[_0xa20f('0x22')](_0xa20f('0x19'),auth['isAuthenticated'](),controller[_0xa20f('0x36')]);router['post']('/:id/applications',auth[_0xa20f('0x9')](),controller[_0xa20f('0x37')]);router['post'](_0xa20f('0x38'),auth[_0xa20f('0x9')](),controller[_0xa20f('0x39')]);router[_0xa20f('0x22')](_0xa20f('0x21'),auth[_0xa20f('0x9')](),controller[_0xa20f('0x3a')]);router['put'](_0xa20f('0xd'),auth[_0xa20f('0x9')](),controller[_0xa20f('0x3b')]);router[_0xa20f('0x3c')](_0xa20f('0xd'),auth[_0xa20f('0x9')](),controller['destroy']);router[_0xa20f('0x3c')](_0xa20f('0xf'),auth[_0xa20f('0x9')](),controller[_0xa20f('0x3d')]);router[_0xa20f('0x3c')](_0xa20f('0x10'),auth[_0xa20f('0x9')](),controller['removeAnswers']);router[_0xa20f('0x3c')]('/:id/users',auth[_0xa20f('0x9')](),controller[_0xa20f('0x3e')]);module[_0xa20f('0x3f')]=router; \ No newline at end of file +var _0xab31=['describe','/:id','show','/:id/dispositions','getDispositions','getAnswers','/:id/logo','/:id/avatar','getCustomerAvatar','/:id/system_avatar','getSystemAvatar','/:id/interactions','getInteractions','/:id/snippet','getApplications','getProactiveActions','/:id/offline_messages','getOfflineMessages','/:id/users','getAgents','create','post','/:id/canned_answers','addAnswer','join','server/files/images/logos/','format','%s-%s','originalname','single','addLogo','diskStorage','root','server/files/images/avatars/','now','file','addAvatar','/:id/customer_avatar','addCustomerAvatar','addSystemAvatar','/:id/offline','offline','addInteraction','addApplications','addProactiveActions','addAgents','put','update','delete','destroy','removeAnswers','removeAgents','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatWebsite.controller','isAuthenticated','index','get'];(function(_0x46abc7,_0x588588){var _0x2e64e6=function(_0x4b925c){while(--_0x4b925c){_0x46abc7['push'](_0x46abc7['shift']());}};_0x2e64e6(++_0x588588);}(_0xab31,0xb7));var _0x1ab3=function(_0x1b858f,_0x3c4368){_0x1b858f=_0x1b858f-0x0;var _0x22d781=_0xab31[_0x1b858f];return _0x22d781;};'use strict';var multer=require(_0x1ab3('0x0'));var util=require('util');var path=require(_0x1ab3('0x1'));var timeout=require(_0x1ab3('0x2'));var express=require(_0x1ab3('0x3'));var router=express[_0x1ab3('0x4')]();var auth=require(_0x1ab3('0x5'));var interaction=require(_0x1ab3('0x6'));var config=require(_0x1ab3('0x7'));var controller=require(_0x1ab3('0x8'));router['get']('/',auth[_0x1ab3('0x9')](),controller[_0x1ab3('0xa')]);router[_0x1ab3('0xb')]('/describe',auth[_0x1ab3('0x9')](),controller[_0x1ab3('0xc')]);router[_0x1ab3('0xb')](_0x1ab3('0xd'),auth['isAuthenticated'](),controller[_0x1ab3('0xe')]);router[_0x1ab3('0xb')](_0x1ab3('0xf'),auth[_0x1ab3('0x9')](),controller[_0x1ab3('0x10')]);router[_0x1ab3('0xb')]('/:id/canned_answers',auth[_0x1ab3('0x9')](),controller[_0x1ab3('0x11')]);router[_0x1ab3('0xb')](_0x1ab3('0x12'),controller['getLogo']);router['get'](_0x1ab3('0x13'),controller['getAvatar']);router['get']('/:id/customer_avatar',controller[_0x1ab3('0x14')]);router[_0x1ab3('0xb')](_0x1ab3('0x15'),controller[_0x1ab3('0x16')]);router['get'](_0x1ab3('0x17'),auth[_0x1ab3('0x9')](),controller[_0x1ab3('0x18')]);router['get'](_0x1ab3('0x19'),controller['getSnippet']);router['get']('/:id/applications',auth[_0x1ab3('0x9')](),controller[_0x1ab3('0x1a')]);router['get']('/:id/proactive_actions',auth['isAuthenticated'](),controller[_0x1ab3('0x1b')]);router['get']('/:id/fields',controller['getFields']);router[_0x1ab3('0xb')](_0x1ab3('0x1c'),auth[_0x1ab3('0x9')](),controller[_0x1ab3('0x1d')]);router['get'](_0x1ab3('0x1e'),auth[_0x1ab3('0x9')](),controller[_0x1ab3('0x1f')]);router['post']('/',auth[_0x1ab3('0x9')](),controller[_0x1ab3('0x20')]);router['post'](_0x1ab3('0xf'),auth[_0x1ab3('0x9')](),controller['addDisposition']);router[_0x1ab3('0x21')](_0x1ab3('0x22'),auth[_0x1ab3('0x9')](),controller[_0x1ab3('0x23')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x10083f,_0x1b92c2,_0x229635){_0x229635(null,path[_0x1ab3('0x24')](config['root'],_0x1ab3('0x25')));},'filename':function(_0xc5a0a7,_0x4a48f7,_0x63d698){_0x63d698(null,util[_0x1ab3('0x26')](_0x1ab3('0x27'),Date['now'](),_0x4a48f7[_0x1ab3('0x28')]));}})});router[_0x1ab3('0x21')](_0x1ab3('0x12'),upload[_0x1ab3('0x29')]('file'),controller[_0x1ab3('0x2a')]);var upload=multer({'storage':multer[_0x1ab3('0x2b')]({'destination':function(_0x265a34,_0x27e416,_0xf86e95){_0xf86e95(null,path[_0x1ab3('0x24')](config[_0x1ab3('0x2c')],_0x1ab3('0x2d')));},'filename':function(_0x2261a1,_0x1e2bca,_0x4ea82e){_0x4ea82e(null,util[_0x1ab3('0x26')]('%s-%s',Date[_0x1ab3('0x2e')](),_0x1e2bca[_0x1ab3('0x28')]));}})});router[_0x1ab3('0x21')](_0x1ab3('0x13'),upload[_0x1ab3('0x29')](_0x1ab3('0x2f')),controller[_0x1ab3('0x30')]);var upload=multer({'storage':multer[_0x1ab3('0x2b')]({'destination':function(_0x2d3aaf,_0x5636fb,_0x15b5cb){_0x15b5cb(null,path[_0x1ab3('0x24')](config[_0x1ab3('0x2c')],_0x1ab3('0x2d')));},'filename':function(_0x14919f,_0x410f62,_0x32a1bc){_0x32a1bc(null,util[_0x1ab3('0x26')](_0x1ab3('0x27'),Date[_0x1ab3('0x2e')](),_0x410f62['originalname']));}})});router[_0x1ab3('0x21')](_0x1ab3('0x31'),upload['single'](_0x1ab3('0x2f')),controller[_0x1ab3('0x32')]);var upload=multer({'storage':multer[_0x1ab3('0x2b')]({'destination':function(_0x2fb514,_0x47fac8,_0xb0e1e){_0xb0e1e(null,path[_0x1ab3('0x24')](config[_0x1ab3('0x2c')],_0x1ab3('0x2d')));},'filename':function(_0x31b165,_0x24269c,_0xb9e7a1){_0xb9e7a1(null,util[_0x1ab3('0x26')]('%s-%s',Date[_0x1ab3('0x2e')](),_0x24269c[_0x1ab3('0x28')]));}})});router[_0x1ab3('0x21')](_0x1ab3('0x15'),upload[_0x1ab3('0x29')](_0x1ab3('0x2f')),controller[_0x1ab3('0x33')]);router['post']('/:id/notify',controller['notify']);router[_0x1ab3('0x21')](_0x1ab3('0x34'),controller[_0x1ab3('0x35')]);router[_0x1ab3('0x21')](_0x1ab3('0x17'),auth['isAuthenticated'](),controller[_0x1ab3('0x36')]);router[_0x1ab3('0x21')]('/:id/applications',auth['isAuthenticated'](),controller[_0x1ab3('0x37')]);router['post']('/:id/proactive_actions',auth['isAuthenticated'](),controller[_0x1ab3('0x38')]);router['post'](_0x1ab3('0x1e'),auth['isAuthenticated'](),controller[_0x1ab3('0x39')]);router[_0x1ab3('0x3a')](_0x1ab3('0xd'),auth[_0x1ab3('0x9')](),controller[_0x1ab3('0x3b')]);router[_0x1ab3('0x3c')](_0x1ab3('0xd'),auth[_0x1ab3('0x9')](),controller[_0x1ab3('0x3d')]);router[_0x1ab3('0x3c')](_0x1ab3('0xf'),auth[_0x1ab3('0x9')](),controller['removeDispositions']);router[_0x1ab3('0x3c')]('/:id/canned_answers',auth[_0x1ab3('0x9')](),controller[_0x1ab3('0x3e')]);router['delete'](_0x1ab3('0x1e'),auth[_0x1ab3('0x9')](),controller[_0x1ab3('0x3f')]);module[_0x1ab3('0x40')]=router; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.attributes.js b/server/api/cloudProvider/cloudProvider.attributes.js index 7448f8b..ae9b6c2 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 _0xadf0=['Google','exports','STRING','ENUM','AmazonAWS'];(function(_0x217779,_0x34e5b5){var _0x386998=function(_0x16f248){while(--_0x16f248){_0x217779['push'](_0x217779['shift']());}};_0x386998(++_0x34e5b5);}(_0xadf0,0x12d));var _0x0adf=function(_0x204584,_0x356ecf){_0x204584=_0x204584-0x0;var _0x461f8f=_0xadf0[_0x204584];return _0x461f8f;};'use strict';var Sequelize=require('sequelize');module[_0x0adf('0x0')]={'name':{'type':Sequelize[_0x0adf('0x1')],'allowNull':![],'validate':{'notEmpty':!![]}},'service':{'type':Sequelize[_0x0adf('0x2')](_0x0adf('0x3'),_0x0adf('0x4')),'allowNull':![],'validate':{'notEmpty':!![]}},'data1':{'type':Sequelize[_0x0adf('0x1')]},'data2':{'type':Sequelize[_0x0adf('0x1')]}}; \ No newline at end of file +var _0x24ce=['ENUM','AmazonAWS','exports','STRING'];(function(_0x59fec8,_0x2a864){var _0x22f12e=function(_0x5c5d53){while(--_0x5c5d53){_0x59fec8['push'](_0x59fec8['shift']());}};_0x22f12e(++_0x2a864);}(_0x24ce,0x1de));var _0xe24c=function(_0x3724a4,_0x11c5df){_0x3724a4=_0x3724a4-0x0;var _0x3ea1c9=_0x24ce[_0x3724a4];return _0x3ea1c9;};'use strict';var Sequelize=require('sequelize');module[_0xe24c('0x0')]={'name':{'type':Sequelize[_0xe24c('0x1')],'allowNull':![],'validate':{'notEmpty':!![]}},'service':{'type':Sequelize[_0xe24c('0x2')](_0xe24c('0x3'),'Google'),'allowNull':![],'validate':{'notEmpty':!![]}},'data1':{'type':Sequelize['STRING']},'data2':{'type':Sequelize[_0xe24c('0x1')]}}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.controller.js b/server/api/cloudProvider/cloudProvider.controller.js index c893762..785d114 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 _0xb355=['fast-json-patch','request-promise','moment','path','sox','to-csv','ejs','lodash','jsforce','desk.js','../../components/auth/service','../../config/license/hardware','../../config/logger','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','set','Content-Range','apply','reject','update','destroy','stack','name','send','index','map','type','key','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','limit','order','where','pick','filter','VIRTUAL','options','CloudProvider','then','includeAll','rows','catch','show','params','keys','rawAttributes','include','create','body','find','html-pdf','eml-format','rimraf','zip-dir'];(function(_0x4f46f6,_0x54e2ad){var _0x4f6337=function(_0x56d80d){while(--_0x56d80d){_0x4f46f6['push'](_0x4f46f6['shift']());}};_0x4f6337(++_0x54e2ad);}(_0xb355,0x1d1));var _0x5b35=function(_0x47f7a9,_0x4c8770){_0x47f7a9=_0x47f7a9-0x0;var _0x2dcc4d=_0xb355[_0x47f7a9];return _0x2dcc4d;};'use strict';var pdf=require(_0x5b35('0x0'));var emlformat=require(_0x5b35('0x1'));var rimraf=require(_0x5b35('0x2'));var zipdir=require(_0x5b35('0x3'));var jsonpatch=require(_0x5b35('0x4'));var rp=require(_0x5b35('0x5'));var moment=require(_0x5b35('0x6'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0x5b35('0x7'));var sox=require(_0x5b35('0x8'));var csv=require(_0x5b35('0x9'));var ejs=require(_0x5b35('0xa'));var fs=require('fs');var _=require(_0x5b35('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x5b35('0xc'));var deskjs=require(_0x5b35('0xd'));var toCsv=require(_0x5b35('0x9'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x5b35('0xe'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x5b35('0xf'));var logger=require(_0x5b35('0x10'))('api');var utils=require('../../config/utils');var config=require(_0x5b35('0x11'));var db=require(_0x5b35('0x12'))['db'];function respondWithStatusCode(_0x228b85,_0x444349){_0x444349=_0x444349||0xcc;return function(_0xb7ccbb){if(_0xb7ccbb){return _0x228b85[_0x5b35('0x13')](_0x444349);}return _0x228b85[_0x5b35('0x14')](_0x444349)[_0x5b35('0x15')]();};}function respondWithResult(_0x370889,_0x35123a){_0x35123a=_0x35123a||0xc8;return function(_0x321c45){if(_0x321c45){return _0x370889['status'](_0x35123a)[_0x5b35('0x16')](_0x321c45);}};}function respondWithFilteredResult(_0x4a57b1,_0x2d837a){return function(_0x4ad4fa){if(_0x4ad4fa){var _0x311757=_0x4ad4fa[_0x5b35('0x17')],_0x246406=_0x2d837a[_0x5b35('0x18')],_0x57077e=_0x2d837a[_0x5b35('0x18')]+_0x2d837a['limit'],_0x3cd1b3;if(_0x57077e>=_0x311757){_0x57077e=_0x311757;_0x3cd1b3=0xc8;}else{_0x3cd1b3=0xce;}_0x4a57b1[_0x5b35('0x14')](_0x3cd1b3);return _0x4a57b1[_0x5b35('0x19')](_0x5b35('0x1a'),_0x246406+'-'+_0x57077e+'/'+_0x311757)[_0x5b35('0x16')](_0x4ad4fa);}return null;};}function patchUpdates(_0x2014f1){return function(_0x58010c){try{jsonpatch[_0x5b35('0x1b')](_0x58010c,_0x2014f1,!![]);}catch(_0x1b6e7f){return BPromise[_0x5b35('0x1c')](_0x1b6e7f);}return _0x58010c['save']();};}function saveUpdates(_0x4922e9,_0x2bada6){return function(_0x43c07e){if(_0x43c07e){return _0x43c07e[_0x5b35('0x1d')](_0x4922e9)['then'](function(_0x27e822){return _0x27e822;});}return null;};}function removeEntity(_0x58e348,_0x3c4978){return function(_0x428412){if(_0x428412){return _0x428412[_0x5b35('0x1e')]()['then'](function(){_0x58e348[_0x5b35('0x14')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2494f0,_0x231526){return function(_0x2fd493){if(!_0x2fd493){_0x2494f0[_0x5b35('0x13')](0x194);}return _0x2fd493;};}function handleError(_0x3c7a0d,_0x2f0d31){_0x2f0d31=_0x2f0d31||0x1f4;return function(_0x36b984){logger['error'](_0x36b984[_0x5b35('0x1f')]);if(_0x36b984[_0x5b35('0x20')]){delete _0x36b984['name'];}_0x3c7a0d[_0x5b35('0x14')](_0x2f0d31)[_0x5b35('0x21')](_0x36b984);};}exports[_0x5b35('0x22')]=function(_0x69db,_0x9c4663){var _0x5b47e6={},_0x42461a={},_0x5bf62c={'count':0x0,'rows':[]};var _0x210dee=_[_0x5b35('0x23')](db['CloudProvider']['rawAttributes'],function(_0x3ddda1){return{'name':_0x3ddda1['fieldName'],'type':_0x3ddda1[_0x5b35('0x24')][_0x5b35('0x25')]};});_0x42461a[_0x5b35('0x26')]=_[_0x5b35('0x23')](_0x210dee,_0x5b35('0x20'));_0x42461a[_0x5b35('0x27')]=_['keys'](_0x69db['query']);_0x42461a[_0x5b35('0x28')]=_[_0x5b35('0x29')](_0x42461a['model'],_0x42461a[_0x5b35('0x27')]);_0x5b47e6['attributes']=_[_0x5b35('0x29')](_0x42461a[_0x5b35('0x26')],qs['fields'](_0x69db['query'][_0x5b35('0x2a')]));_0x5b47e6['attributes']=_0x5b47e6[_0x5b35('0x2b')][_0x5b35('0x2c')]?_0x5b47e6[_0x5b35('0x2b')]:_0x42461a['model'];if(!_0x69db[_0x5b35('0x27')][_0x5b35('0x2d')](_0x5b35('0x2e'))){_0x5b47e6[_0x5b35('0x2f')]=qs[_0x5b35('0x2f')](_0x69db[_0x5b35('0x27')][_0x5b35('0x2f')]);_0x5b47e6[_0x5b35('0x18')]=qs[_0x5b35('0x18')](_0x69db[_0x5b35('0x27')][_0x5b35('0x18')]);}_0x5b47e6[_0x5b35('0x30')]=qs['sort'](_0x69db['query']['sort']);_0x5b47e6[_0x5b35('0x31')]=qs[_0x5b35('0x28')](_[_0x5b35('0x32')](_0x69db[_0x5b35('0x27')],_0x42461a[_0x5b35('0x28')]),_0x210dee);if(_0x69db['query'][_0x5b35('0x33')]){_0x5b47e6[_0x5b35('0x31')]=_['merge'](_0x5b47e6[_0x5b35('0x31')],{'$or':_['map'](_0x210dee,function(_0x41e7c8){if(_0x41e7c8[_0x5b35('0x24')]!==_0x5b35('0x34')){var _0x414726={};_0x414726[_0x41e7c8[_0x5b35('0x20')]]={'$like':'%'+_0x69db[_0x5b35('0x27')][_0x5b35('0x33')]+'%'};return _0x414726;}})});}_0x5b47e6=_['merge']({},_0x5b47e6,_0x69db[_0x5b35('0x35')]);var _0x5e19ad={'where':_0x5b47e6['where']};return db[_0x5b35('0x36')]['count'](_0x5e19ad)[_0x5b35('0x37')](function(_0x328d3b){_0x5bf62c[_0x5b35('0x17')]=_0x328d3b;if(_0x69db[_0x5b35('0x27')][_0x5b35('0x38')]){_0x5b47e6['include']=[{'all':!![]}];}return db[_0x5b35('0x36')]['findAll'](_0x5b47e6);})['then'](function(_0x13de1d){_0x5bf62c[_0x5b35('0x39')]=_0x13de1d;return _0x5bf62c;})[_0x5b35('0x37')](respondWithFilteredResult(_0x9c4663,_0x5b47e6))[_0x5b35('0x3a')](handleError(_0x9c4663,null));};exports[_0x5b35('0x3b')]=function(_0xdb9daa,_0x38086d){var _0x1936ac={'raw':!![],'where':{'id':_0xdb9daa[_0x5b35('0x3c')]['id']}},_0x399c34={};_0x399c34[_0x5b35('0x26')]=_[_0x5b35('0x3d')](db[_0x5b35('0x36')][_0x5b35('0x3e')]);_0x399c34['query']=_[_0x5b35('0x3d')](_0xdb9daa[_0x5b35('0x27')]);_0x399c34[_0x5b35('0x28')]=_[_0x5b35('0x29')](_0x399c34['model'],_0x399c34['query']);_0x1936ac['attributes']=_[_0x5b35('0x29')](_0x399c34[_0x5b35('0x26')],qs[_0x5b35('0x2a')](_0xdb9daa[_0x5b35('0x27')][_0x5b35('0x2a')]));_0x1936ac[_0x5b35('0x2b')]=_0x1936ac[_0x5b35('0x2b')][_0x5b35('0x2c')]?_0x1936ac[_0x5b35('0x2b')]:_0x399c34['model'];if(_0xdb9daa[_0x5b35('0x27')][_0x5b35('0x38')]){_0x1936ac[_0x5b35('0x3f')]=[{'all':!![]}];}_0x1936ac=_['merge']({},_0x1936ac,_0xdb9daa['options']);return db[_0x5b35('0x36')]['find'](_0x1936ac)[_0x5b35('0x37')](handleEntityNotFound(_0x38086d,null))[_0x5b35('0x37')](respondWithResult(_0x38086d,null))[_0x5b35('0x3a')](handleError(_0x38086d,null));};exports[_0x5b35('0x40')]=function(_0xc79e67,_0xc1133a){return db[_0x5b35('0x36')]['create'](_0xc79e67[_0x5b35('0x41')],{})['then'](respondWithResult(_0xc1133a,0xc9))[_0x5b35('0x3a')](handleError(_0xc1133a,null));};exports[_0x5b35('0x1d')]=function(_0x5ecfe0,_0x1a3a2c){if(_0x5ecfe0[_0x5b35('0x41')]['id']){delete _0x5ecfe0[_0x5b35('0x41')]['id'];}return db[_0x5b35('0x36')][_0x5b35('0x42')]({'where':{'id':_0x5ecfe0[_0x5b35('0x3c')]['id']}})['then'](handleEntityNotFound(_0x1a3a2c,null))[_0x5b35('0x37')](saveUpdates(_0x5ecfe0[_0x5b35('0x41')],null))[_0x5b35('0x37')](respondWithResult(_0x1a3a2c,null))[_0x5b35('0x3a')](handleError(_0x1a3a2c,null));};exports[_0x5b35('0x1e')]=function(_0x3e6a8d,_0x2e7d02){return db['CloudProvider'][_0x5b35('0x42')]({'where':{'id':_0x3e6a8d[_0x5b35('0x3c')]['id']}})[_0x5b35('0x37')](handleEntityNotFound(_0x2e7d02,null))['then'](removeEntity(_0x2e7d02,null))[_0x5b35('0x3a')](handleError(_0x2e7d02,null));}; \ No newline at end of file +var _0xef83=['error','stack','name','send','index','map','CloudProvider','rawAttributes','fieldName','type','key','query','filters','intersection','model','attributes','length','hasOwnProperty','limit','order','sort','where','pick','filter','merge','VIRTUAL','options','count','include','findAll','rows','catch','show','params','keys','includeAll','find','create','body','update','eml-format','rimraf','fast-json-patch','moment','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/logger','api','../../config/utils','sendStatus','status','end','json','offset','set','Content-Range','reject','save','then','destroy'];(function(_0x2caadd,_0x4d26b4){var _0x509c79=function(_0x50bb80){while(--_0x50bb80){_0x2caadd['push'](_0x2caadd['shift']());}};_0x509c79(++_0x4d26b4);}(_0xef83,0x150));var _0x3ef8=function(_0x1829c6,_0x4d98fd){_0x1829c6=_0x1829c6-0x0;var _0x19a7a0=_0xef83[_0x1829c6];return _0x19a7a0;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x3ef8('0x0'));var rimraf=require(_0x3ef8('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x3ef8('0x2'));var rp=require('request-promise');var moment=require(_0x3ef8('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x3ef8('0x4'));var util=require('util');var path=require(_0x3ef8('0x5'));var sox=require(_0x3ef8('0x6'));var csv=require('to-csv');var ejs=require(_0x3ef8('0x7'));var fs=require('fs');var _=require(_0x3ef8('0x8'));var squel=require(_0x3ef8('0x9'));var crypto=require(_0x3ef8('0xa'));var jsforce=require(_0x3ef8('0xb'));var deskjs=require(_0x3ef8('0xc'));var toCsv=require(_0x3ef8('0xd'));var querystring=require(_0x3ef8('0xe'));var Papa=require(_0x3ef8('0xf'));var Redis=require(_0x3ef8('0x10'));var authService=require(_0x3ef8('0x11'));var qs=require(_0x3ef8('0x12'));var as=require(_0x3ef8('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x3ef8('0x14'))(_0x3ef8('0x15'));var utils=require(_0x3ef8('0x16'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xf4ab6f,_0x130378){_0x130378=_0x130378||0xcc;return function(_0x593d78){if(_0x593d78){return _0xf4ab6f[_0x3ef8('0x17')](_0x130378);}return _0xf4ab6f[_0x3ef8('0x18')](_0x130378)[_0x3ef8('0x19')]();};}function respondWithResult(_0x3346bf,_0x5d914){_0x5d914=_0x5d914||0xc8;return function(_0xa4438f){if(_0xa4438f){return _0x3346bf[_0x3ef8('0x18')](_0x5d914)[_0x3ef8('0x1a')](_0xa4438f);}};}function respondWithFilteredResult(_0x4cd285,_0x529d91){return function(_0x3e9c3b){if(_0x3e9c3b){var _0x146df0=_0x3e9c3b['count'],_0x1af001=_0x529d91[_0x3ef8('0x1b')],_0x5e653c=_0x529d91[_0x3ef8('0x1b')]+_0x529d91['limit'],_0x286388;if(_0x5e653c>=_0x146df0){_0x5e653c=_0x146df0;_0x286388=0xc8;}else{_0x286388=0xce;}_0x4cd285[_0x3ef8('0x18')](_0x286388);return _0x4cd285[_0x3ef8('0x1c')](_0x3ef8('0x1d'),_0x1af001+'-'+_0x5e653c+'/'+_0x146df0)['json'](_0x3e9c3b);}return null;};}function patchUpdates(_0x16799f){return function(_0x468e20){try{jsonpatch['apply'](_0x468e20,_0x16799f,!![]);}catch(_0x5f428a){return BPromise[_0x3ef8('0x1e')](_0x5f428a);}return _0x468e20[_0x3ef8('0x1f')]();};}function saveUpdates(_0x4b6f1d,_0x33280d){return function(_0x2e7d44){if(_0x2e7d44){return _0x2e7d44['update'](_0x4b6f1d)[_0x3ef8('0x20')](function(_0x1f938f){return _0x1f938f;});}return null;};}function removeEntity(_0x13fa92,_0x5f7770){return function(_0x339a75){if(_0x339a75){return _0x339a75[_0x3ef8('0x21')]()['then'](function(){_0x13fa92['status'](0xcc)[_0x3ef8('0x19')]();});}};}function handleEntityNotFound(_0x165a03,_0x5b9dbf){return function(_0xbaf9d4){if(!_0xbaf9d4){_0x165a03[_0x3ef8('0x17')](0x194);}return _0xbaf9d4;};}function handleError(_0x31174a,_0x491dff){_0x491dff=_0x491dff||0x1f4;return function(_0x16a984){logger[_0x3ef8('0x22')](_0x16a984[_0x3ef8('0x23')]);if(_0x16a984['name']){delete _0x16a984[_0x3ef8('0x24')];}_0x31174a[_0x3ef8('0x18')](_0x491dff)[_0x3ef8('0x25')](_0x16a984);};}exports[_0x3ef8('0x26')]=function(_0x811080,_0x511e89){var _0x28d348={},_0x2313d0={},_0xf3b3f5={'count':0x0,'rows':[]};var _0x33b255=_[_0x3ef8('0x27')](db[_0x3ef8('0x28')][_0x3ef8('0x29')],function(_0x24f483){return{'name':_0x24f483[_0x3ef8('0x2a')],'type':_0x24f483[_0x3ef8('0x2b')][_0x3ef8('0x2c')]};});_0x2313d0['model']=_[_0x3ef8('0x27')](_0x33b255,_0x3ef8('0x24'));_0x2313d0[_0x3ef8('0x2d')]=_['keys'](_0x811080['query']);_0x2313d0[_0x3ef8('0x2e')]=_[_0x3ef8('0x2f')](_0x2313d0[_0x3ef8('0x30')],_0x2313d0[_0x3ef8('0x2d')]);_0x28d348['attributes']=_[_0x3ef8('0x2f')](_0x2313d0['model'],qs['fields'](_0x811080[_0x3ef8('0x2d')]['fields']));_0x28d348[_0x3ef8('0x31')]=_0x28d348[_0x3ef8('0x31')][_0x3ef8('0x32')]?_0x28d348[_0x3ef8('0x31')]:_0x2313d0[_0x3ef8('0x30')];if(!_0x811080[_0x3ef8('0x2d')][_0x3ef8('0x33')]('nolimit')){_0x28d348[_0x3ef8('0x34')]=qs[_0x3ef8('0x34')](_0x811080[_0x3ef8('0x2d')][_0x3ef8('0x34')]);_0x28d348['offset']=qs[_0x3ef8('0x1b')](_0x811080[_0x3ef8('0x2d')][_0x3ef8('0x1b')]);}_0x28d348[_0x3ef8('0x35')]=qs[_0x3ef8('0x36')](_0x811080['query'][_0x3ef8('0x36')]);_0x28d348[_0x3ef8('0x37')]=qs['filters'](_[_0x3ef8('0x38')](_0x811080[_0x3ef8('0x2d')],_0x2313d0['filters']),_0x33b255);if(_0x811080['query'][_0x3ef8('0x39')]){_0x28d348[_0x3ef8('0x37')]=_[_0x3ef8('0x3a')](_0x28d348[_0x3ef8('0x37')],{'$or':_[_0x3ef8('0x27')](_0x33b255,function(_0x42dc9d){if(_0x42dc9d[_0x3ef8('0x2b')]!==_0x3ef8('0x3b')){var _0x2d2ffd={};_0x2d2ffd[_0x42dc9d[_0x3ef8('0x24')]]={'$like':'%'+_0x811080['query'][_0x3ef8('0x39')]+'%'};return _0x2d2ffd;}})});}_0x28d348=_['merge']({},_0x28d348,_0x811080[_0x3ef8('0x3c')]);var _0x54cfd0={'where':_0x28d348[_0x3ef8('0x37')]};return db[_0x3ef8('0x28')][_0x3ef8('0x3d')](_0x54cfd0)[_0x3ef8('0x20')](function(_0xd36ee0){_0xf3b3f5[_0x3ef8('0x3d')]=_0xd36ee0;if(_0x811080[_0x3ef8('0x2d')]['includeAll']){_0x28d348[_0x3ef8('0x3e')]=[{'all':!![]}];}return db[_0x3ef8('0x28')][_0x3ef8('0x3f')](_0x28d348);})['then'](function(_0x2f5117){_0xf3b3f5[_0x3ef8('0x40')]=_0x2f5117;return _0xf3b3f5;})['then'](respondWithFilteredResult(_0x511e89,_0x28d348))[_0x3ef8('0x41')](handleError(_0x511e89,null));};exports[_0x3ef8('0x42')]=function(_0x5220af,_0x697f83){var _0x350721={'raw':!![],'where':{'id':_0x5220af[_0x3ef8('0x43')]['id']}},_0x293aa4={};_0x293aa4[_0x3ef8('0x30')]=_[_0x3ef8('0x44')](db[_0x3ef8('0x28')][_0x3ef8('0x29')]);_0x293aa4[_0x3ef8('0x2d')]=_[_0x3ef8('0x44')](_0x5220af[_0x3ef8('0x2d')]);_0x293aa4[_0x3ef8('0x2e')]=_[_0x3ef8('0x2f')](_0x293aa4[_0x3ef8('0x30')],_0x293aa4[_0x3ef8('0x2d')]);_0x350721[_0x3ef8('0x31')]=_[_0x3ef8('0x2f')](_0x293aa4['model'],qs['fields'](_0x5220af[_0x3ef8('0x2d')]['fields']));_0x350721[_0x3ef8('0x31')]=_0x350721[_0x3ef8('0x31')][_0x3ef8('0x32')]?_0x350721[_0x3ef8('0x31')]:_0x293aa4['model'];if(_0x5220af[_0x3ef8('0x2d')][_0x3ef8('0x45')]){_0x350721[_0x3ef8('0x3e')]=[{'all':!![]}];}_0x350721=_[_0x3ef8('0x3a')]({},_0x350721,_0x5220af[_0x3ef8('0x3c')]);return db[_0x3ef8('0x28')][_0x3ef8('0x46')](_0x350721)[_0x3ef8('0x20')](handleEntityNotFound(_0x697f83,null))['then'](respondWithResult(_0x697f83,null))[_0x3ef8('0x41')](handleError(_0x697f83,null));};exports[_0x3ef8('0x47')]=function(_0x4b6e66,_0x219eea){return db[_0x3ef8('0x28')]['create'](_0x4b6e66[_0x3ef8('0x48')],{})[_0x3ef8('0x20')](respondWithResult(_0x219eea,0xc9))[_0x3ef8('0x41')](handleError(_0x219eea,null));};exports[_0x3ef8('0x49')]=function(_0x3c8efb,_0x13389f){if(_0x3c8efb['body']['id']){delete _0x3c8efb[_0x3ef8('0x48')]['id'];}return db[_0x3ef8('0x28')][_0x3ef8('0x46')]({'where':{'id':_0x3c8efb[_0x3ef8('0x43')]['id']}})['then'](handleEntityNotFound(_0x13389f,null))[_0x3ef8('0x20')](saveUpdates(_0x3c8efb[_0x3ef8('0x48')],null))[_0x3ef8('0x20')](respondWithResult(_0x13389f,null))['catch'](handleError(_0x13389f,null));};exports[_0x3ef8('0x21')]=function(_0x545b31,_0x5a4466){return db[_0x3ef8('0x28')][_0x3ef8('0x46')]({'where':{'id':_0x545b31[_0x3ef8('0x43')]['id']}})['then'](handleEntityNotFound(_0x5a4466,null))['then'](removeEntity(_0x5a4466,null))[_0x3ef8('0x41')](handleError(_0x5a4466,null));}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.model.js b/server/api/cloudProvider/cloudProvider.model.js index 4d1f96b..e6a6682 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 _0x1493=['exports','define','cloud_providers','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./cloudProvider.attributes'];(function(_0x22b5ec,_0x76491a){var _0x62895b=function(_0x85a7b){while(--_0x85a7b){_0x22b5ec['push'](_0x22b5ec['shift']());}};_0x62895b(++_0x76491a);}(_0x1493,0x87));var _0x3149=function(_0x20a541,_0x15adcb){_0x20a541=_0x20a541-0x0;var _0x11264c=_0x1493[_0x20a541];return _0x11264c;};'use strict';var _=require('lodash');var util=require(_0x3149('0x0'));var logger=require(_0x3149('0x1'))(_0x3149('0x2'));var moment=require(_0x3149('0x3'));var BPromise=require(_0x3149('0x4'));var rp=require(_0x3149('0x5'));var fs=require('fs');var path=require(_0x3149('0x6'));var rimraf=require(_0x3149('0x7'));var config=require('../../config/environment');var attributes=require(_0x3149('0x8'));module[_0x3149('0x9')]=function(_0x58ee59,_0x3d09f5){return _0x58ee59[_0x3149('0xa')]('CloudProvider',attributes,{'tableName':_0x3149('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9055=['../../config/environment','./cloudProvider.attributes','define','cloud_providers','lodash','util','../../config/logger','bluebird','request-promise','path','rimraf'];(function(_0x222550,_0x3c0a0c){var _0x58ac61=function(_0x4f7201){while(--_0x4f7201){_0x222550['push'](_0x222550['shift']());}};_0x58ac61(++_0x3c0a0c);}(_0x9055,0x1dd));var _0x5905=function(_0x409b87,_0x5ef488){_0x409b87=_0x409b87-0x0;var _0x46fa68=_0x9055[_0x409b87];return _0x46fa68;};'use strict';var _=require(_0x5905('0x0'));var util=require(_0x5905('0x1'));var logger=require(_0x5905('0x2'))('api');var moment=require('moment');var BPromise=require(_0x5905('0x3'));var rp=require(_0x5905('0x4'));var fs=require('fs');var path=require(_0x5905('0x5'));var rimraf=require(_0x5905('0x6'));var config=require(_0x5905('0x7'));var attributes=require(_0x5905('0x8'));module['exports']=function(_0x1d7fd9,_0x4f48f2){return _0x1d7fd9[_0x5905('0x9')]('CloudProvider',attributes,{'tableName':_0x5905('0xa'),'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 0790d7f..4b5bcf1 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 _0xf05e=['lodash','util','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','CloudProvider,\x20%s,\x20%s','request\x20sent','debug','CloudProvider,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result'];(function(_0x26ef7b,_0x578a7f){var _0x3a8e98=function(_0x403309){while(--_0x403309){_0x26ef7b['push'](_0x26ef7b['shift']());}};_0x3a8e98(++_0x578a7f);}(_0xf05e,0xd8));var _0xef05=function(_0x320610,_0x21802d){_0x320610=_0x320610-0x0;var _0x275cc4=_0xf05e[_0x320610];return _0x275cc4;};'use strict';var _=require(_0xef05('0x0'));var util=require(_0xef05('0x1'));var moment=require(_0xef05('0x2'));var BPromise=require(_0xef05('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xef05('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xef05('0x5'));var logger=require(_0xef05('0x6'))(_0xef05('0x7'));var config=require(_0xef05('0x8'));var jayson=require(_0xef05('0x9'));var client=jayson[_0xef05('0xa')][_0xef05('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x292121,_0x506f19,_0x2572ea){return new BPromise(function(_0x4c9a0c,_0x2748a5){return client[_0xef05('0xc')](_0x292121,_0x2572ea)[_0xef05('0xd')](function(_0x42aa76){logger[_0xef05('0xe')](_0xef05('0xf'),_0x506f19,_0xef05('0x10'));logger[_0xef05('0x11')](_0xef05('0x12'),_0x506f19,_0xef05('0x10'),JSON[_0xef05('0x13')](_0x42aa76));if(_0x42aa76[_0xef05('0x14')]){if(_0x42aa76[_0xef05('0x14')][_0xef05('0x15')]===0x1f4){logger[_0xef05('0x14')](_0xef05('0xf'),_0x506f19,_0x42aa76[_0xef05('0x14')]['message']);return _0x2748a5(_0x42aa76[_0xef05('0x14')][_0xef05('0x16')]);}logger[_0xef05('0x14')](_0xef05('0xf'),_0x506f19,_0x42aa76['error'][_0xef05('0x16')]);return _0x4c9a0c(_0x42aa76[_0xef05('0x14')][_0xef05('0x16')]);}else{logger[_0xef05('0xe')](_0xef05('0xf'),_0x506f19,'request\x20sent');_0x4c9a0c(_0x42aa76[_0xef05('0x17')][_0xef05('0x16')]);}})['catch'](function(_0x1f340d){logger[_0xef05('0x14')](_0xef05('0xf'),_0x506f19,_0x1f340d);_0x2748a5(_0x1f340d);});});} \ No newline at end of file +var _0x2fc1=['../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info','CloudProvider,\x20%s,\x20%s','request\x20sent','CloudProvider,\x20%s,\x20%s,\x20%s','error','code','message','result','lodash','util','moment','bluebird','ioredis'];(function(_0x3e8776,_0x240200){var _0x1fde7e=function(_0x47ee22){while(--_0x47ee22){_0x3e8776['push'](_0x3e8776['shift']());}};_0x1fde7e(++_0x240200);}(_0x2fc1,0x8e));var _0x12fc=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x2fc1[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x12fc('0x0'));var util=require(_0x12fc('0x1'));var moment=require(_0x12fc('0x2'));var BPromise=require(_0x12fc('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x12fc('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x12fc('0x5'));var logger=require('../../config/logger')(_0x12fc('0x6'));var config=require(_0x12fc('0x7'));var jayson=require(_0x12fc('0x8'));var client=jayson[_0x12fc('0x9')][_0x12fc('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3b2d89,_0x719b0a,_0x5e0da7){return new BPromise(function(_0x5df479,_0x5ddac5){return client[_0x12fc('0xb')](_0x3b2d89,_0x5e0da7)[_0x12fc('0xc')](function(_0x2c4dfc){logger[_0x12fc('0xd')](_0x12fc('0xe'),_0x719b0a,_0x12fc('0xf'));logger['debug'](_0x12fc('0x10'),_0x719b0a,_0x12fc('0xf'),JSON['stringify'](_0x2c4dfc));if(_0x2c4dfc['error']){if(_0x2c4dfc[_0x12fc('0x11')][_0x12fc('0x12')]===0x1f4){logger[_0x12fc('0x11')]('CloudProvider,\x20%s,\x20%s',_0x719b0a,_0x2c4dfc[_0x12fc('0x11')][_0x12fc('0x13')]);return _0x5ddac5(_0x2c4dfc[_0x12fc('0x11')]['message']);}logger[_0x12fc('0x11')]('CloudProvider,\x20%s,\x20%s',_0x719b0a,_0x2c4dfc[_0x12fc('0x11')][_0x12fc('0x13')]);return _0x5df479(_0x2c4dfc[_0x12fc('0x11')][_0x12fc('0x13')]);}else{logger[_0x12fc('0xd')]('CloudProvider,\x20%s,\x20%s',_0x719b0a,_0x12fc('0xf'));_0x5df479(_0x2c4dfc[_0x12fc('0x14')][_0x12fc('0x13')]);}})['catch'](function(_0x3d0fb7){logger['error'](_0x12fc('0xe'),_0x719b0a,_0x3d0fb7);_0x5ddac5(_0x3d0fb7);});});} \ No newline at end of file diff --git a/server/api/cloudProvider/index.js b/server/api/cloudProvider/index.js index e4c56bb..c8198c2 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 _0x88ba=['/:id','isAuthenticated','post','create','put','update','delete','destroy','exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./cloudProvider.controller','index','get'];(function(_0x4cea4b,_0x371227){var _0x161856=function(_0x545400){while(--_0x545400){_0x4cea4b['push'](_0x4cea4b['shift']());}};_0x161856(++_0x371227);}(_0x88ba,0xbd));var _0xa88b=function(_0x309991,_0x457e73){_0x309991=_0x309991-0x0;var _0x4ca94d=_0x88ba[_0x309991];return _0x4ca94d;};'use strict';var multer=require(_0xa88b('0x0'));var util=require(_0xa88b('0x1'));var path=require('path');var timeout=require(_0xa88b('0x2'));var express=require(_0xa88b('0x3'));var router=express[_0xa88b('0x4')]();var auth=require(_0xa88b('0x5'));var interaction=require(_0xa88b('0x6'));var config=require(_0xa88b('0x7'));var controller=require(_0xa88b('0x8'));router['get']('/',auth['isAuthenticated'](),controller[_0xa88b('0x9')]);router[_0xa88b('0xa')](_0xa88b('0xb'),auth[_0xa88b('0xc')](),controller['show']);router[_0xa88b('0xd')]('/',auth[_0xa88b('0xc')](),controller[_0xa88b('0xe')]);router[_0xa88b('0xf')](_0xa88b('0xb'),auth[_0xa88b('0xc')](),controller[_0xa88b('0x10')]);router[_0xa88b('0x11')]('/:id',auth[_0xa88b('0xc')](),controller[_0xa88b('0x12')]);module[_0xa88b('0x13')]=router; \ No newline at end of file +var _0xd888=['isAuthenticated','show','post','create','put','/:id','delete','exports','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','get'];(function(_0x21c71f,_0x927cd3){var _0x3903dd=function(_0x47f8ad){while(--_0x47f8ad){_0x21c71f['push'](_0x21c71f['shift']());}};_0x3903dd(++_0x927cd3);}(_0xd888,0x198));var _0x8d88=function(_0x272d10,_0x25b188){_0x272d10=_0x272d10-0x0;var _0x5162b6=_0xd888[_0x272d10];return _0x5162b6;};'use strict';var multer=require('multer');var util=require(_0x8d88('0x0'));var path=require(_0x8d88('0x1'));var timeout=require(_0x8d88('0x2'));var express=require(_0x8d88('0x3'));var router=express[_0x8d88('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x8d88('0x5'));var config=require(_0x8d88('0x6'));var controller=require('./cloudProvider.controller');router[_0x8d88('0x7')]('/',auth[_0x8d88('0x8')](),controller['index']);router[_0x8d88('0x7')]('/:id',auth[_0x8d88('0x8')](),controller[_0x8d88('0x9')]);router[_0x8d88('0xa')]('/',auth['isAuthenticated'](),controller[_0x8d88('0xb')]);router[_0x8d88('0xc')](_0x8d88('0xd'),auth[_0x8d88('0x8')](),controller['update']);router[_0x8d88('0xe')](_0x8d88('0xd'),auth[_0x8d88('0x8')](),controller['destroy']);module[_0x8d88('0xf')]=router; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.attributes.js b/server/api/cmCompany/cmCompany.attributes.js index db1486f..7ef643f 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 _0x1f3b=['exports','STRING','name','sequelize'];(function(_0x62ce2d,_0x4f4ef9){var _0x2984d8=function(_0x1b45a4){while(--_0x1b45a4){_0x62ce2d['push'](_0x62ce2d['shift']());}};_0x2984d8(++_0x4f4ef9);}(_0x1f3b,0x163));var _0xb1f3=function(_0x5eaa6a,_0x41d4f9){_0x5eaa6a=_0x5eaa6a-0x0;var _0x332a98=_0x1f3b[_0x5eaa6a];return _0x332a98;};'use strict';var Sequelize=require(_0xb1f3('0x0'));module[_0xb1f3('0x1')]={'name':{'type':Sequelize[_0xb1f3('0x2')],'unique':_0xb1f3('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'vat':{'type':Sequelize[_0xb1f3('0x2')]},'companyId':{'type':Sequelize[_0xb1f3('0x2')]},'website':{'type':Sequelize[_0xb1f3('0x2')]},'phone':{'type':Sequelize[_0xb1f3('0x2')]},'fax':{'type':Sequelize[_0xb1f3('0x2')]},'type':{'type':Sequelize[_0xb1f3('0x2')]},'street':{'type':Sequelize['STRING']},'postalCode':{'type':Sequelize[_0xb1f3('0x2')]},'city':{'type':Sequelize[_0xb1f3('0x2')]},'country':{'type':Sequelize[_0xb1f3('0x2')]},'email':{'type':Sequelize[_0xb1f3('0x2')],'validate':{'isEmail':!![]}},'emailDomain':{'type':Sequelize[_0xb1f3('0x2')]},'sStreet':{'type':Sequelize[_0xb1f3('0x2')]},'sPostalCode':{'type':Sequelize[_0xb1f3('0x2')]},'sCity':{'type':Sequelize[_0xb1f3('0x2')]},'sCountry':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xb1f3('0x2')]}}; \ No newline at end of file +var _0xe1be=['sequelize','exports','STRING'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0xe1be,0xab));var _0xee1b=function(_0x68ae65,_0x12cdb2){_0x68ae65=_0x68ae65-0x0;var _0x108c42=_0xe1be[_0x68ae65];return _0x108c42;};'use strict';var Sequelize=require(_0xee1b('0x0'));module[_0xee1b('0x1')]={'name':{'type':Sequelize[_0xee1b('0x2')],'unique':'name','allowNull':![],'validate':{'notEmpty':!![]}},'vat':{'type':Sequelize[_0xee1b('0x2')]},'companyId':{'type':Sequelize[_0xee1b('0x2')]},'website':{'type':Sequelize[_0xee1b('0x2')]},'phone':{'type':Sequelize[_0xee1b('0x2')]},'fax':{'type':Sequelize[_0xee1b('0x2')]},'type':{'type':Sequelize[_0xee1b('0x2')]},'street':{'type':Sequelize[_0xee1b('0x2')]},'postalCode':{'type':Sequelize[_0xee1b('0x2')]},'city':{'type':Sequelize[_0xee1b('0x2')]},'country':{'type':Sequelize[_0xee1b('0x2')]},'email':{'type':Sequelize[_0xee1b('0x2')],'validate':{'isEmail':!![]}},'emailDomain':{'type':Sequelize[_0xee1b('0x2')]},'sStreet':{'type':Sequelize[_0xee1b('0x2')]},'sPostalCode':{'type':Sequelize[_0xee1b('0x2')]},'sCity':{'type':Sequelize['STRING']},'sCountry':{'type':Sequelize[_0xee1b('0x2')]},'description':{'type':Sequelize[_0xee1b('0x2')]}}; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.controller.js b/server/api/cmCompany/cmCompany.controller.js index cc8c44c..339fa50 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 _0x84ad=['Companies','UserProfileResource','error','stack','name','send','CmCompany','describe','model','keys','query','filters','attributes','intersection','fields','length','hasOwnProperty','order','sort','pick','filter','merge','where','options','count','includeAll','include','findAll','catch','params','rawAttributes','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','addContacts','ids','omit','getContacts','map','nolimit','html-pdf','rimraf','zip-dir','fast-json-patch','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','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','limit','set','Content-Range','apply','save','update','destroy','then'];(function(_0x37d1da,_0x21a138){var _0x5344d4=function(_0x37cf85){while(--_0x37cf85){_0x37d1da['push'](_0x37d1da['shift']());}};_0x5344d4(++_0x21a138);}(_0x84ad,0x1d3));var _0xd84a=function(_0x2a99ea,_0x1bfb13){_0x2a99ea=_0x2a99ea-0x0;var _0x5887ae=_0x84ad[_0x2a99ea];return _0x5887ae;};'use strict';var pdf=require(_0xd84a('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xd84a('0x1'));var zipdir=require(_0xd84a('0x2'));var jsonpatch=require(_0xd84a('0x3'));var rp=require('request-promise');var moment=require(_0xd84a('0x4'));var BPromise=require(_0xd84a('0x5'));var Mustache=require(_0xd84a('0x6'));var util=require(_0xd84a('0x7'));var path=require(_0xd84a('0x8'));var sox=require(_0xd84a('0x9'));var csv=require(_0xd84a('0xa'));var ejs=require(_0xd84a('0xb'));var fs=require('fs');var _=require(_0xd84a('0xc'));var squel=require('squel');var crypto=require(_0xd84a('0xd'));var jsforce=require(_0xd84a('0xe'));var deskjs=require(_0xd84a('0xf'));var toCsv=require(_0xd84a('0xa'));var querystring=require('querystring');var Papa=require(_0xd84a('0x10'));var Redis=require(_0xd84a('0x11'));var authService=require(_0xd84a('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xd84a('0x13'));var hardwareService=require(_0xd84a('0x14'));var logger=require(_0xd84a('0x15'))('api');var utils=require('../../config/utils');var config=require(_0xd84a('0x16'));var db=require(_0xd84a('0x17'))['db'];function respondWithStatusCode(_0x162170,_0x24c08f){_0x24c08f=_0x24c08f||0xcc;return function(_0x3ef7a9){if(_0x3ef7a9){return _0x162170[_0xd84a('0x18')](_0x24c08f);}return _0x162170[_0xd84a('0x19')](_0x24c08f)[_0xd84a('0x1a')]();};}function respondWithResult(_0x47c17a,_0x2c5153){_0x2c5153=_0x2c5153||0xc8;return function(_0x2ab51c){if(_0x2ab51c){return _0x47c17a['status'](_0x2c5153)[_0xd84a('0x1b')](_0x2ab51c);}};}function respondWithFilteredResult(_0x222f7c,_0x2cf044){return function(_0x558908){if(_0x558908){var _0x370e6d=_0x558908['count'],_0x38c8b3=_0x2cf044[_0xd84a('0x1c')],_0x5a00bf=_0x2cf044['offset']+_0x2cf044[_0xd84a('0x1d')],_0x34a93c;if(_0x5a00bf>=_0x370e6d){_0x5a00bf=_0x370e6d;_0x34a93c=0xc8;}else{_0x34a93c=0xce;}_0x222f7c[_0xd84a('0x19')](_0x34a93c);return _0x222f7c[_0xd84a('0x1e')](_0xd84a('0x1f'),_0x38c8b3+'-'+_0x5a00bf+'/'+_0x370e6d)['json'](_0x558908);}return null;};}function patchUpdates(_0x2b3a9c){return function(_0x45e709){try{jsonpatch[_0xd84a('0x20')](_0x45e709,_0x2b3a9c,!![]);}catch(_0x33f552){return BPromise['reject'](_0x33f552);}return _0x45e709[_0xd84a('0x21')]();};}function saveUpdates(_0x286337,_0x4efd96){return function(_0x20cf8c){if(_0x20cf8c){return _0x20cf8c[_0xd84a('0x22')](_0x286337)['then'](function(_0x57f882){return _0x57f882;});}return null;};}function removeEntity(_0x10fd92,_0x2cce12){return function(_0x4c58b7){if(_0x4c58b7){return _0x4c58b7[_0xd84a('0x23')]()[_0xd84a('0x24')](function(){var _0x477778=_0x4c58b7['get']({'plain':!![]});var _0x13c4e8=_0xd84a('0x25');return db[_0xd84a('0x26')][_0xd84a('0x23')]({'where':{'type':_0x13c4e8,'resourceId':_0x477778['id']}})['then'](function(){return _0x4c58b7;});})[_0xd84a('0x24')](function(){_0x10fd92[_0xd84a('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5b6be9,_0x15d384){return function(_0x12d27e){if(!_0x12d27e){_0x5b6be9['sendStatus'](0x194);}return _0x12d27e;};}function handleError(_0x46ea24,_0x388da8){_0x388da8=_0x388da8||0x1f4;return function(_0x47491c){logger[_0xd84a('0x27')](_0x47491c[_0xd84a('0x28')]);if(_0x47491c[_0xd84a('0x29')]){delete _0x47491c[_0xd84a('0x29')];}_0x46ea24[_0xd84a('0x19')](_0x388da8)[_0xd84a('0x2a')](_0x47491c);};}exports['index']=function(_0x3cf1da,_0x569dff){var _0x70fb7={},_0x128374={},_0x45d8af={'count':0x0,'rows':[]};return db[_0xd84a('0x2b')][_0xd84a('0x2c')]()[_0xd84a('0x24')](function(_0x2d2797){_0x128374[_0xd84a('0x2d')]=_[_0xd84a('0x2e')](_0x2d2797);_0x128374[_0xd84a('0x2f')]=_[_0xd84a('0x2e')](_0x3cf1da['query']);_0x128374[_0xd84a('0x30')]=_['intersection'](_0x128374[_0xd84a('0x2d')],_0x128374[_0xd84a('0x2f')]);_0x70fb7[_0xd84a('0x31')]=_[_0xd84a('0x32')](_0x128374['model'],qs['fields'](_0x3cf1da[_0xd84a('0x2f')][_0xd84a('0x33')]));_0x70fb7[_0xd84a('0x31')]=_0x70fb7[_0xd84a('0x31')][_0xd84a('0x34')]?_0x70fb7[_0xd84a('0x31')]:_0x128374[_0xd84a('0x2d')];if(!_0x3cf1da[_0xd84a('0x2f')][_0xd84a('0x35')]('nolimit')){_0x70fb7[_0xd84a('0x1d')]=qs['limit'](_0x3cf1da[_0xd84a('0x2f')]['limit']);_0x70fb7['offset']=qs[_0xd84a('0x1c')](_0x3cf1da[_0xd84a('0x2f')][_0xd84a('0x1c')]);}_0x70fb7[_0xd84a('0x36')]=qs[_0xd84a('0x37')](_0x3cf1da[_0xd84a('0x2f')][_0xd84a('0x37')]);_0x70fb7['where']=qs[_0xd84a('0x30')](_[_0xd84a('0x38')](_0x3cf1da[_0xd84a('0x2f')],_0x128374[_0xd84a('0x30')]),_0x2d2797);if(_0x3cf1da[_0xd84a('0x2f')][_0xd84a('0x39')]){_0x70fb7['where']=_[_0xd84a('0x3a')](_0x70fb7[_0xd84a('0x3b')],{'$or':_['map'](_0x70fb7[_0xd84a('0x31')],function(_0x3dbad2){var _0x6f7da3={};_0x6f7da3[_0x3dbad2]={'$like':'%'+_0x3cf1da[_0xd84a('0x2f')]['filter']+'%'};return _0x6f7da3;})});}_0x70fb7=_[_0xd84a('0x3a')]({},_0x70fb7,_0x3cf1da[_0xd84a('0x3c')]);var _0x5d5cee={'where':_0x70fb7[_0xd84a('0x3b')]};return db[_0xd84a('0x2b')][_0xd84a('0x3d')](_0x5d5cee)[_0xd84a('0x24')](function(_0x524e58){_0x45d8af['count']=_0x524e58;if(_0x3cf1da['query'][_0xd84a('0x3e')]){_0x70fb7[_0xd84a('0x3f')]=[{'all':!![]}];}return db[_0xd84a('0x2b')][_0xd84a('0x40')](_0x70fb7);})[_0xd84a('0x24')](function(_0x259a31){_0x45d8af['rows']=_0x259a31;return _0x45d8af;})[_0xd84a('0x24')](respondWithFilteredResult(_0x569dff,_0x70fb7))[_0xd84a('0x41')](handleError(_0x569dff,null));})[_0xd84a('0x41')](handleError(_0x569dff,null));};exports['show']=function(_0x4fac38,_0xb82835){var _0x29bdd8={'raw':![],'where':{'id':_0x4fac38[_0xd84a('0x42')]['id']}},_0x3e8534={};_0x3e8534['model']=_[_0xd84a('0x2e')](db[_0xd84a('0x2b')][_0xd84a('0x43')]);_0x3e8534['query']=_[_0xd84a('0x2e')](_0x4fac38[_0xd84a('0x2f')]);_0x3e8534[_0xd84a('0x30')]=_[_0xd84a('0x32')](_0x3e8534[_0xd84a('0x2d')],_0x3e8534[_0xd84a('0x2f')]);_0x29bdd8[_0xd84a('0x31')]=_[_0xd84a('0x32')](_0x3e8534[_0xd84a('0x2d')],qs[_0xd84a('0x33')](_0x4fac38[_0xd84a('0x2f')][_0xd84a('0x33')]));_0x29bdd8[_0xd84a('0x31')]=_0x29bdd8[_0xd84a('0x31')][_0xd84a('0x34')]?_0x29bdd8[_0xd84a('0x31')]:_0x3e8534[_0xd84a('0x2d')];if(_0x4fac38[_0xd84a('0x2f')]['includeAll']){_0x29bdd8[_0xd84a('0x3f')]=[{'all':!![]}];}_0x29bdd8=_[_0xd84a('0x3a')]({},_0x29bdd8,_0x4fac38[_0xd84a('0x3c')]);return db['CmCompany'][_0xd84a('0x44')](_0x29bdd8)[_0xd84a('0x24')](handleEntityNotFound(_0xb82835,null))['then'](respondWithResult(_0xb82835,null))[_0xd84a('0x41')](handleError(_0xb82835,null));};exports[_0xd84a('0x45')]=function(_0x295d53,_0x374806){return db[_0xd84a('0x2b')][_0xd84a('0x45')](_0x295d53[_0xd84a('0x46')],{})[_0xd84a('0x24')](function(_0x367a52){var _0x3f6a6b=_0x295d53[_0xd84a('0x47')][_0xd84a('0x48')]({'plain':!![]});if(!_0x3f6a6b)throw new Error(_0xd84a('0x49'));if(_0x3f6a6b['role']===_0xd84a('0x47')){var _0x1c6ec3=_0x367a52['get']({'plain':!![]});var _0x5294db=_0xd84a('0x25');return db[_0xd84a('0x4a')]['find']({'where':{'name':_0x5294db,'userProfileId':_0x3f6a6b[_0xd84a('0x4b')]},'raw':!![]})[_0xd84a('0x24')](function(_0x1e117f){if(_0x1e117f&&_0x1e117f[_0xd84a('0x4c')]===0x0){return db[_0xd84a('0x26')][_0xd84a('0x45')]({'name':_0x1c6ec3[_0xd84a('0x29')],'resourceId':_0x1c6ec3['id'],'type':_0x1e117f['name'],'sectionId':_0x1e117f['id']},{})[_0xd84a('0x24')](function(){return _0x367a52;});}else{return _0x367a52;}})[_0xd84a('0x41')](function(_0x292eef){logger['error'](_0xd84a('0x4d'),_0x292eef);throw _0x292eef;});}return _0x367a52;})['then'](respondWithResult(_0x374806,0xc9))[_0xd84a('0x41')](handleError(_0x374806,null));};exports['update']=function(_0x14d75e,_0x4c7b44){if(_0x14d75e['body']['id']){delete _0x14d75e[_0xd84a('0x46')]['id'];}return db['CmCompany'][_0xd84a('0x44')]({'where':{'id':_0x14d75e[_0xd84a('0x42')]['id']}})[_0xd84a('0x24')](handleEntityNotFound(_0x4c7b44,null))[_0xd84a('0x24')](saveUpdates(_0x14d75e[_0xd84a('0x46')],null))[_0xd84a('0x24')](respondWithResult(_0x4c7b44,null))['catch'](handleError(_0x4c7b44,null));};exports[_0xd84a('0x23')]=function(_0x3f565f,_0x51a3ab){return db['CmCompany'][_0xd84a('0x44')]({'where':{'id':_0x3f565f[_0xd84a('0x42')]['id']}})[_0xd84a('0x24')](handleEntityNotFound(_0x51a3ab,null))['then'](removeEntity(_0x51a3ab,null))['catch'](handleError(_0x51a3ab,null));};exports['describe']=function(_0x4a0a85,_0x3db359){return db[_0xd84a('0x2b')]['describe']()[_0xd84a('0x24')](respondWithResult(_0x3db359,null))[_0xd84a('0x41')](handleError(_0x3db359,null));};exports[_0xd84a('0x4e')]=function(_0x3a1e2d,_0x15a452,_0x4999d9){return db['CmContact'][_0xd84a('0x44')]({'where':{'id':_0x3a1e2d['params']['id']}})[_0xd84a('0x24')](handleEntityNotFound(_0x15a452,null))['then'](function(_0x43434e){if(_0x43434e){return _0x43434e[_0xd84a('0x4e')](_0x3a1e2d[_0xd84a('0x46')][_0xd84a('0x4f')],_[_0xd84a('0x50')](_0x3a1e2d[_0xd84a('0x46')],['ids','id'])||{});}})[_0xd84a('0x24')](respondWithResult(_0x15a452,null))[_0xd84a('0x41')](handleError(_0x15a452,null));};exports[_0xd84a('0x51')]=function(_0x4d0806,_0x4f2c46,_0x30c54d){var _0x2a2228={};var _0x1d32f1={};var _0x573b9a;var _0x12befc;return db['CmCompany']['findOne']({'where':{'id':_0x4d0806[_0xd84a('0x42')]['id']}})[_0xd84a('0x24')](handleEntityNotFound(_0x4f2c46,null))[_0xd84a('0x24')](function(_0x4860b7){if(_0x4860b7){_0x573b9a=_0x4860b7;_0x1d32f1['model']=_[_0xd84a('0x2e')](db['CmContact'][_0xd84a('0x43')]);_0x1d32f1[_0xd84a('0x2f')]=_[_0xd84a('0x2e')](_0x4d0806[_0xd84a('0x2f')]);_0x1d32f1[_0xd84a('0x30')]=_[_0xd84a('0x32')](_0x1d32f1[_0xd84a('0x2d')],_0x1d32f1[_0xd84a('0x2f')]);_0x2a2228['attributes']=_[_0xd84a('0x32')](_0x1d32f1[_0xd84a('0x2d')],qs[_0xd84a('0x33')](_0x4d0806[_0xd84a('0x2f')][_0xd84a('0x33')]));_0x2a2228[_0xd84a('0x31')]=_0x2a2228[_0xd84a('0x31')][_0xd84a('0x34')]?_0x2a2228[_0xd84a('0x31')]:_0x1d32f1[_0xd84a('0x2d')];_0x2a2228[_0xd84a('0x36')]=qs[_0xd84a('0x37')](_0x4d0806[_0xd84a('0x2f')][_0xd84a('0x37')]);_0x2a2228['where']=qs[_0xd84a('0x30')](_[_0xd84a('0x38')](_0x4d0806[_0xd84a('0x2f')],_0x1d32f1[_0xd84a('0x30')]));if(_0x4d0806['query'][_0xd84a('0x39')]){_0x2a2228[_0xd84a('0x3b')]=_['merge'](_0x2a2228[_0xd84a('0x3b')],{'$or':_[_0xd84a('0x52')](_0x2a2228['attributes'],function(_0xb82e5d){var _0x43c040={};_0x43c040[_0xb82e5d]={'$like':'%'+_0x4d0806[_0xd84a('0x2f')][_0xd84a('0x39')]+'%'};return _0x43c040;})});}_0x2a2228=_['merge']({},_0x2a2228,_0x4d0806['options']);return _0x573b9a[_0xd84a('0x51')](_0x2a2228);}})[_0xd84a('0x24')](function(_0x29046b){if(_0x29046b){_0x12befc=_0x29046b[_0xd84a('0x34')];if(!_0x4d0806[_0xd84a('0x2f')][_0xd84a('0x35')](_0xd84a('0x53'))){_0x2a2228[_0xd84a('0x1d')]=qs[_0xd84a('0x1d')](_0x4d0806[_0xd84a('0x2f')][_0xd84a('0x1d')]);_0x2a2228[_0xd84a('0x1c')]=qs[_0xd84a('0x1c')](_0x4d0806[_0xd84a('0x2f')][_0xd84a('0x1c')]);}return _0x573b9a['getContacts'](_0x2a2228);}})[_0xd84a('0x24')](function(_0x1dcb8c){if(_0x1dcb8c){return _0x1dcb8c?{'count':_0x12befc,'rows':_0x1dcb8c}:null;}})[_0xd84a('0x24')](respondWithResult(_0x4f2c46,null))[_0xd84a('0x41')](handleError(_0x4f2c46,null));}; \ No newline at end of file +var _0x84ff=['save','update','then','get','Companies','UserProfileResource','error','stack','name','send','index','CmCompany','describe','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','sort','where','pick','merge','map','filter','count','include','findAll','catch','show','params','rawAttributes','includeAll','options','find','create','body','user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','destroy','addContacts','ids','omit','getContacts','CmContact','eml-format','rimraf','zip-dir','request-promise','moment','path','to-csv','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status','json','offset','set','apply','reject'];(function(_0x3ff085,_0x27c92e){var _0x2b68c3=function(_0x37811e){while(--_0x37811e){_0x3ff085['push'](_0x3ff085['shift']());}};_0x2b68c3(++_0x27c92e);}(_0x84ff,0x1df));var _0xf84f=function(_0x1487fa,_0x124d57){_0x1487fa=_0x1487fa-0x0;var _0x8af541=_0x84ff[_0x1487fa];return _0x8af541;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xf84f('0x0'));var rimraf=require(_0xf84f('0x1'));var zipdir=require(_0xf84f('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xf84f('0x3'));var moment=require(_0xf84f('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0xf84f('0x5'));var sox=require('sox');var csv=require(_0xf84f('0x6'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xf84f('0x7'));var squel=require(_0xf84f('0x8'));var crypto=require(_0xf84f('0x9'));var jsforce=require('jsforce');var deskjs=require(_0xf84f('0xa'));var toCsv=require(_0xf84f('0x6'));var querystring=require(_0xf84f('0xb'));var Papa=require(_0xf84f('0xc'));var Redis=require(_0xf84f('0xd'));var authService=require(_0xf84f('0xe'));var qs=require(_0xf84f('0xf'));var as=require(_0xf84f('0x10'));var hardwareService=require(_0xf84f('0x11'));var logger=require(_0xf84f('0x12'))(_0xf84f('0x13'));var utils=require(_0xf84f('0x14'));var config=require(_0xf84f('0x15'));var db=require(_0xf84f('0x16'))['db'];function respondWithStatusCode(_0x22f790,_0x235c94){_0x235c94=_0x235c94||0xcc;return function(_0x1ba0e0){if(_0x1ba0e0){return _0x22f790[_0xf84f('0x17')](_0x235c94);}return _0x22f790['status'](_0x235c94)[_0xf84f('0x18')]();};}function respondWithResult(_0xf9ef15,_0x57beee){_0x57beee=_0x57beee||0xc8;return function(_0x235da0){if(_0x235da0){return _0xf9ef15[_0xf84f('0x19')](_0x57beee)[_0xf84f('0x1a')](_0x235da0);}};}function respondWithFilteredResult(_0x218fc0,_0x59c318){return function(_0x397f4a){if(_0x397f4a){var _0x37402a=_0x397f4a['count'],_0x823726=_0x59c318[_0xf84f('0x1b')],_0x371074=_0x59c318[_0xf84f('0x1b')]+_0x59c318['limit'],_0x13d908;if(_0x371074>=_0x37402a){_0x371074=_0x37402a;_0x13d908=0xc8;}else{_0x13d908=0xce;}_0x218fc0['status'](_0x13d908);return _0x218fc0[_0xf84f('0x1c')]('Content-Range',_0x823726+'-'+_0x371074+'/'+_0x37402a)[_0xf84f('0x1a')](_0x397f4a);}return null;};}function patchUpdates(_0x1432d5){return function(_0x7f7f6f){try{jsonpatch[_0xf84f('0x1d')](_0x7f7f6f,_0x1432d5,!![]);}catch(_0x3eab29){return BPromise[_0xf84f('0x1e')](_0x3eab29);}return _0x7f7f6f[_0xf84f('0x1f')]();};}function saveUpdates(_0x5bf6ac,_0x12b5c8){return function(_0x4511c1){if(_0x4511c1){return _0x4511c1[_0xf84f('0x20')](_0x5bf6ac)[_0xf84f('0x21')](function(_0x510119){return _0x510119;});}return null;};}function removeEntity(_0x2ee82f,_0x23461e){return function(_0x1b76e2){if(_0x1b76e2){return _0x1b76e2['destroy']()[_0xf84f('0x21')](function(){var _0x336fd3=_0x1b76e2[_0xf84f('0x22')]({'plain':!![]});var _0x161e5e=_0xf84f('0x23');return db[_0xf84f('0x24')]['destroy']({'where':{'type':_0x161e5e,'resourceId':_0x336fd3['id']}})['then'](function(){return _0x1b76e2;});})['then'](function(){_0x2ee82f[_0xf84f('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x34ab3c,_0x2801fe){return function(_0x1717dd){if(!_0x1717dd){_0x34ab3c[_0xf84f('0x17')](0x194);}return _0x1717dd;};}function handleError(_0x5de861,_0x117285){_0x117285=_0x117285||0x1f4;return function(_0x13adf2){logger[_0xf84f('0x25')](_0x13adf2[_0xf84f('0x26')]);if(_0x13adf2[_0xf84f('0x27')]){delete _0x13adf2[_0xf84f('0x27')];}_0x5de861['status'](_0x117285)[_0xf84f('0x28')](_0x13adf2);};}exports[_0xf84f('0x29')]=function(_0x5b2380,_0x26c8cb){var _0x4e71b9={},_0x1fe35c={},_0x26ef1e={'count':0x0,'rows':[]};return db[_0xf84f('0x2a')][_0xf84f('0x2b')]()[_0xf84f('0x21')](function(_0x26cb64){_0x1fe35c[_0xf84f('0x2c')]=_[_0xf84f('0x2d')](_0x26cb64);_0x1fe35c[_0xf84f('0x2e')]=_[_0xf84f('0x2d')](_0x5b2380['query']);_0x1fe35c[_0xf84f('0x2f')]=_[_0xf84f('0x30')](_0x1fe35c[_0xf84f('0x2c')],_0x1fe35c[_0xf84f('0x2e')]);_0x4e71b9[_0xf84f('0x31')]=_['intersection'](_0x1fe35c[_0xf84f('0x2c')],qs[_0xf84f('0x32')](_0x5b2380[_0xf84f('0x2e')][_0xf84f('0x32')]));_0x4e71b9[_0xf84f('0x31')]=_0x4e71b9[_0xf84f('0x31')][_0xf84f('0x33')]?_0x4e71b9[_0xf84f('0x31')]:_0x1fe35c[_0xf84f('0x2c')];if(!_0x5b2380[_0xf84f('0x2e')][_0xf84f('0x34')](_0xf84f('0x35'))){_0x4e71b9['limit']=qs[_0xf84f('0x36')](_0x5b2380[_0xf84f('0x2e')][_0xf84f('0x36')]);_0x4e71b9['offset']=qs[_0xf84f('0x1b')](_0x5b2380['query'][_0xf84f('0x1b')]);}_0x4e71b9['order']=qs['sort'](_0x5b2380[_0xf84f('0x2e')][_0xf84f('0x37')]);_0x4e71b9[_0xf84f('0x38')]=qs[_0xf84f('0x2f')](_[_0xf84f('0x39')](_0x5b2380['query'],_0x1fe35c[_0xf84f('0x2f')]),_0x26cb64);if(_0x5b2380[_0xf84f('0x2e')]['filter']){_0x4e71b9[_0xf84f('0x38')]=_[_0xf84f('0x3a')](_0x4e71b9[_0xf84f('0x38')],{'$or':_[_0xf84f('0x3b')](_0x4e71b9['attributes'],function(_0x5c8ad9){var _0x51a0a6={};_0x51a0a6[_0x5c8ad9]={'$like':'%'+_0x5b2380['query'][_0xf84f('0x3c')]+'%'};return _0x51a0a6;})});}_0x4e71b9=_['merge']({},_0x4e71b9,_0x5b2380['options']);var _0x184c6d={'where':_0x4e71b9[_0xf84f('0x38')]};return db['CmCompany'][_0xf84f('0x3d')](_0x184c6d)[_0xf84f('0x21')](function(_0x4a692e){_0x26ef1e[_0xf84f('0x3d')]=_0x4a692e;if(_0x5b2380[_0xf84f('0x2e')]['includeAll']){_0x4e71b9[_0xf84f('0x3e')]=[{'all':!![]}];}return db[_0xf84f('0x2a')][_0xf84f('0x3f')](_0x4e71b9);})[_0xf84f('0x21')](function(_0x15a0de){_0x26ef1e['rows']=_0x15a0de;return _0x26ef1e;})[_0xf84f('0x21')](respondWithFilteredResult(_0x26c8cb,_0x4e71b9))[_0xf84f('0x40')](handleError(_0x26c8cb,null));})[_0xf84f('0x40')](handleError(_0x26c8cb,null));};exports[_0xf84f('0x41')]=function(_0x485d29,_0x578841){var _0x146e7a={'raw':![],'where':{'id':_0x485d29[_0xf84f('0x42')]['id']}},_0x2926ca={};_0x2926ca[_0xf84f('0x2c')]=_[_0xf84f('0x2d')](db[_0xf84f('0x2a')][_0xf84f('0x43')]);_0x2926ca[_0xf84f('0x2e')]=_['keys'](_0x485d29[_0xf84f('0x2e')]);_0x2926ca['filters']=_['intersection'](_0x2926ca[_0xf84f('0x2c')],_0x2926ca[_0xf84f('0x2e')]);_0x146e7a['attributes']=_[_0xf84f('0x30')](_0x2926ca[_0xf84f('0x2c')],qs['fields'](_0x485d29['query'][_0xf84f('0x32')]));_0x146e7a['attributes']=_0x146e7a[_0xf84f('0x31')][_0xf84f('0x33')]?_0x146e7a[_0xf84f('0x31')]:_0x2926ca[_0xf84f('0x2c')];if(_0x485d29[_0xf84f('0x2e')][_0xf84f('0x44')]){_0x146e7a[_0xf84f('0x3e')]=[{'all':!![]}];}_0x146e7a=_[_0xf84f('0x3a')]({},_0x146e7a,_0x485d29[_0xf84f('0x45')]);return db[_0xf84f('0x2a')][_0xf84f('0x46')](_0x146e7a)[_0xf84f('0x21')](handleEntityNotFound(_0x578841,null))['then'](respondWithResult(_0x578841,null))[_0xf84f('0x40')](handleError(_0x578841,null));};exports[_0xf84f('0x47')]=function(_0x42634f,_0x4d3343){return db[_0xf84f('0x2a')]['create'](_0x42634f[_0xf84f('0x48')],{})[_0xf84f('0x21')](function(_0x105cab){var _0x3831be=_0x42634f[_0xf84f('0x49')][_0xf84f('0x22')]({'plain':!![]});if(!_0x3831be)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x3831be[_0xf84f('0x4a')]==='user'){var _0x6bd5a1=_0x105cab[_0xf84f('0x22')]({'plain':!![]});var _0x17eac5=_0xf84f('0x23');return db[_0xf84f('0x4b')][_0xf84f('0x46')]({'where':{'name':_0x17eac5,'userProfileId':_0x3831be[_0xf84f('0x4c')]},'raw':!![]})[_0xf84f('0x21')](function(_0x38dd35){if(_0x38dd35&&_0x38dd35[_0xf84f('0x4d')]===0x0){return db[_0xf84f('0x24')]['create']({'name':_0x6bd5a1[_0xf84f('0x27')],'resourceId':_0x6bd5a1['id'],'type':_0x38dd35['name'],'sectionId':_0x38dd35['id']},{})[_0xf84f('0x21')](function(){return _0x105cab;});}else{return _0x105cab;}})['catch'](function(_0xa486de){logger[_0xf84f('0x25')](_0xf84f('0x4e'),_0xa486de);throw _0xa486de;});}return _0x105cab;})[_0xf84f('0x21')](respondWithResult(_0x4d3343,0xc9))['catch'](handleError(_0x4d3343,null));};exports[_0xf84f('0x20')]=function(_0x265e0f,_0x16c9e9){if(_0x265e0f[_0xf84f('0x48')]['id']){delete _0x265e0f[_0xf84f('0x48')]['id'];}return db[_0xf84f('0x2a')][_0xf84f('0x46')]({'where':{'id':_0x265e0f[_0xf84f('0x42')]['id']}})[_0xf84f('0x21')](handleEntityNotFound(_0x16c9e9,null))[_0xf84f('0x21')](saveUpdates(_0x265e0f[_0xf84f('0x48')],null))[_0xf84f('0x21')](respondWithResult(_0x16c9e9,null))[_0xf84f('0x40')](handleError(_0x16c9e9,null));};exports[_0xf84f('0x4f')]=function(_0x12a5a7,_0x2fc38b){return db[_0xf84f('0x2a')][_0xf84f('0x46')]({'where':{'id':_0x12a5a7[_0xf84f('0x42')]['id']}})['then'](handleEntityNotFound(_0x2fc38b,null))['then'](removeEntity(_0x2fc38b,null))[_0xf84f('0x40')](handleError(_0x2fc38b,null));};exports[_0xf84f('0x2b')]=function(_0x328515,_0x36950a){return db[_0xf84f('0x2a')][_0xf84f('0x2b')]()[_0xf84f('0x21')](respondWithResult(_0x36950a,null))['catch'](handleError(_0x36950a,null));};exports[_0xf84f('0x50')]=function(_0x3917c9,_0x110029,_0x567e7f){return db['CmContact'][_0xf84f('0x46')]({'where':{'id':_0x3917c9[_0xf84f('0x42')]['id']}})[_0xf84f('0x21')](handleEntityNotFound(_0x110029,null))[_0xf84f('0x21')](function(_0x52e13f){if(_0x52e13f){return _0x52e13f['addContacts'](_0x3917c9['body'][_0xf84f('0x51')],_[_0xf84f('0x52')](_0x3917c9['body'],[_0xf84f('0x51'),'id'])||{});}})[_0xf84f('0x21')](respondWithResult(_0x110029,null))['catch'](handleError(_0x110029,null));};exports[_0xf84f('0x53')]=function(_0x505e80,_0x279596,_0x451d6a){var _0x2f7272={};var _0x424372={};var _0x55aaf0;var _0xc72fde;return db[_0xf84f('0x2a')]['findOne']({'where':{'id':_0x505e80['params']['id']}})[_0xf84f('0x21')](handleEntityNotFound(_0x279596,null))[_0xf84f('0x21')](function(_0x143a73){if(_0x143a73){_0x55aaf0=_0x143a73;_0x424372['model']=_[_0xf84f('0x2d')](db[_0xf84f('0x54')]['rawAttributes']);_0x424372['query']=_[_0xf84f('0x2d')](_0x505e80['query']);_0x424372[_0xf84f('0x2f')]=_[_0xf84f('0x30')](_0x424372[_0xf84f('0x2c')],_0x424372[_0xf84f('0x2e')]);_0x2f7272['attributes']=_[_0xf84f('0x30')](_0x424372[_0xf84f('0x2c')],qs['fields'](_0x505e80[_0xf84f('0x2e')][_0xf84f('0x32')]));_0x2f7272['attributes']=_0x2f7272['attributes'][_0xf84f('0x33')]?_0x2f7272[_0xf84f('0x31')]:_0x424372[_0xf84f('0x2c')];_0x2f7272['order']=qs[_0xf84f('0x37')](_0x505e80[_0xf84f('0x2e')]['sort']);_0x2f7272[_0xf84f('0x38')]=qs[_0xf84f('0x2f')](_[_0xf84f('0x39')](_0x505e80[_0xf84f('0x2e')],_0x424372[_0xf84f('0x2f')]));if(_0x505e80[_0xf84f('0x2e')][_0xf84f('0x3c')]){_0x2f7272[_0xf84f('0x38')]=_[_0xf84f('0x3a')](_0x2f7272[_0xf84f('0x38')],{'$or':_[_0xf84f('0x3b')](_0x2f7272['attributes'],function(_0x424a21){var _0x3bf31e={};_0x3bf31e[_0x424a21]={'$like':'%'+_0x505e80[_0xf84f('0x2e')][_0xf84f('0x3c')]+'%'};return _0x3bf31e;})});}_0x2f7272=_['merge']({},_0x2f7272,_0x505e80[_0xf84f('0x45')]);return _0x55aaf0['getContacts'](_0x2f7272);}})[_0xf84f('0x21')](function(_0x36c108){if(_0x36c108){_0xc72fde=_0x36c108['length'];if(!_0x505e80[_0xf84f('0x2e')][_0xf84f('0x34')](_0xf84f('0x35'))){_0x2f7272['limit']=qs[_0xf84f('0x36')](_0x505e80[_0xf84f('0x2e')][_0xf84f('0x36')]);_0x2f7272['offset']=qs[_0xf84f('0x1b')](_0x505e80[_0xf84f('0x2e')][_0xf84f('0x1b')]);}return _0x55aaf0[_0xf84f('0x53')](_0x2f7272);}})['then'](function(_0x49a98f){if(_0x49a98f){return _0x49a98f?{'count':_0xc72fde,'rows':_0x49a98f}:null;}})[_0xf84f('0x21')](respondWithResult(_0x279596,null))[_0xf84f('0x40')](handleError(_0x279596,null));}; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.model.js b/server/api/cmCompany/cmCompany.model.js index 3175688..50c1407 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 _0x83e0=['exports','CmCompany','cm_companies','lodash','util','../../config/logger','bluebird','request-promise','path','../../config/environment'];(function(_0xcbdea2,_0x89553f){var _0x45f09=function(_0x563505){while(--_0x563505){_0xcbdea2['push'](_0xcbdea2['shift']());}};_0x45f09(++_0x89553f);}(_0x83e0,0x175));var _0x083e=function(_0x5bec15,_0x26dea5){_0x5bec15=_0x5bec15-0x0;var _0x46307b=_0x83e0[_0x5bec15];return _0x46307b;};'use strict';var _=require(_0x083e('0x0'));var util=require(_0x083e('0x1'));var logger=require(_0x083e('0x2'))('api');var moment=require('moment');var BPromise=require(_0x083e('0x3'));var rp=require(_0x083e('0x4'));var fs=require('fs');var path=require(_0x083e('0x5'));var rimraf=require('rimraf');var config=require(_0x083e('0x6'));var attributes=require('./cmCompany.attributes');module[_0x083e('0x7')]=function(_0xd5b216,_0x4da81d){return _0xd5b216['define'](_0x083e('0x8'),attributes,{'tableName':_0x083e('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4b85=['path','../../config/environment','exports','define','CmCompany','cm_companies','lodash','util','api','moment'];(function(_0x5d77f6,_0x55c6dc){var _0x4d97d9=function(_0x2cd9ca){while(--_0x2cd9ca){_0x5d77f6['push'](_0x5d77f6['shift']());}};_0x4d97d9(++_0x55c6dc);}(_0x4b85,0x92));var _0x54b8=function(_0x2efc77,_0x3bf951){_0x2efc77=_0x2efc77-0x0;var _0x724beb=_0x4b85[_0x2efc77];return _0x724beb;};'use strict';var _=require(_0x54b8('0x0'));var util=require(_0x54b8('0x1'));var logger=require('../../config/logger')(_0x54b8('0x2'));var moment=require(_0x54b8('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x54b8('0x4'));var rimraf=require('rimraf');var config=require(_0x54b8('0x5'));var attributes=require('./cmCompany.attributes');module[_0x54b8('0x6')]=function(_0xaaa5a3,_0x1720ab){return _0xaaa5a3[_0x54b8('0x7')](_0x54b8('0x8'),attributes,{'tableName':_0x54b8('0x9'),'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 ad85220..60f744e 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 _0x06e2=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','request','info','CmCompany,\x20%s,\x20%s','request\x20sent','debug','CmCompany,\x20%s,\x20%s,\x20%s','stringify','error','message','result','lodash','util','moment'];(function(_0x597c16,_0x2292fe){var _0x30cc2c=function(_0x26cb58){while(--_0x26cb58){_0x597c16['push'](_0x597c16['shift']());}};_0x30cc2c(++_0x2292fe);}(_0x06e2,0xf9));var _0x206e=function(_0x17dfba,_0x4f3f41){_0x17dfba=_0x17dfba-0x0;var _0x4dc37e=_0x06e2[_0x17dfba];return _0x4dc37e;};'use strict';var _=require(_0x206e('0x0'));var util=require(_0x206e('0x1'));var moment=require(_0x206e('0x2'));var BPromise=require('bluebird');var rs=require(_0x206e('0x3'));var fs=require('fs');var Redis=require(_0x206e('0x4'));var db=require(_0x206e('0x5'))['db'];var utils=require(_0x206e('0x6'));var logger=require(_0x206e('0x7'))('rpc');var config=require(_0x206e('0x8'));var jayson=require(_0x206e('0x9'));var client=jayson[_0x206e('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4fbf62,_0x5b4387,_0x31d354){return new BPromise(function(_0x44ef19,_0x501e95){return client[_0x206e('0xb')](_0x4fbf62,_0x31d354)['then'](function(_0x343b03){logger[_0x206e('0xc')](_0x206e('0xd'),_0x5b4387,_0x206e('0xe'));logger[_0x206e('0xf')](_0x206e('0x10'),_0x5b4387,_0x206e('0xe'),JSON[_0x206e('0x11')](_0x343b03));if(_0x343b03[_0x206e('0x12')]){if(_0x343b03[_0x206e('0x12')]['code']===0x1f4){logger[_0x206e('0x12')](_0x206e('0xd'),_0x5b4387,_0x343b03[_0x206e('0x12')]['message']);return _0x501e95(_0x343b03[_0x206e('0x12')][_0x206e('0x13')]);}logger[_0x206e('0x12')](_0x206e('0xd'),_0x5b4387,_0x343b03[_0x206e('0x12')][_0x206e('0x13')]);return _0x44ef19(_0x343b03['error'][_0x206e('0x13')]);}else{logger[_0x206e('0xc')]('CmCompany,\x20%s,\x20%s',_0x5b4387,'request\x20sent');_0x44ef19(_0x343b03[_0x206e('0x14')][_0x206e('0x13')]);}})['catch'](function(_0x30b881){logger[_0x206e('0x12')](_0x206e('0xd'),_0x5b4387,_0x30b881);_0x501e95(_0x30b881);});});} \ No newline at end of file +var _0x77d1=['jayson/promise','http','request','then','info','CmCompany,\x20%s,\x20%s','request\x20sent','debug','CmCompany,\x20%s,\x20%s,\x20%s','error','message','catch','lodash','util','moment','bluebird','ioredis','../../config/logger','rpc','../../config/environment'];(function(_0x13b02f,_0x462a53){var _0x12e9a6=function(_0x187d57){while(--_0x187d57){_0x13b02f['push'](_0x13b02f['shift']());}};_0x12e9a6(++_0x462a53);}(_0x77d1,0xe8));var _0x177d=function(_0x3899d1,_0x4aa04c){_0x3899d1=_0x3899d1-0x0;var _0xeb4a7d=_0x77d1[_0x3899d1];return _0xeb4a7d;};'use strict';var _=require(_0x177d('0x0'));var util=require(_0x177d('0x1'));var moment=require(_0x177d('0x2'));var BPromise=require(_0x177d('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x177d('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x177d('0x5'))(_0x177d('0x6'));var config=require(_0x177d('0x7'));var jayson=require(_0x177d('0x8'));var client=jayson['client'][_0x177d('0x9')]({'port':0x232a});function respondWithRpcPromise(_0xc0c3c2,_0x5196e8,_0x5d84f7){return new BPromise(function(_0x482d0b,_0xd011ac){return client[_0x177d('0xa')](_0xc0c3c2,_0x5d84f7)[_0x177d('0xb')](function(_0x4b026c){logger[_0x177d('0xc')](_0x177d('0xd'),_0x5196e8,_0x177d('0xe'));logger[_0x177d('0xf')](_0x177d('0x10'),_0x5196e8,_0x177d('0xe'),JSON['stringify'](_0x4b026c));if(_0x4b026c[_0x177d('0x11')]){if(_0x4b026c[_0x177d('0x11')]['code']===0x1f4){logger['error'](_0x177d('0xd'),_0x5196e8,_0x4b026c[_0x177d('0x11')][_0x177d('0x12')]);return _0xd011ac(_0x4b026c[_0x177d('0x11')][_0x177d('0x12')]);}logger[_0x177d('0x11')]('CmCompany,\x20%s,\x20%s',_0x5196e8,_0x4b026c[_0x177d('0x11')]['message']);return _0x482d0b(_0x4b026c['error'][_0x177d('0x12')]);}else{logger[_0x177d('0xc')]('CmCompany,\x20%s,\x20%s',_0x5196e8,'request\x20sent');_0x482d0b(_0x4b026c['result'][_0x177d('0x12')]);}})[_0x177d('0x13')](function(_0x168c1c){logger[_0x177d('0x11')]('CmCompany,\x20%s,\x20%s',_0x5196e8,_0x168c1c);_0xd011ac(_0x168c1c);});});} \ No newline at end of file diff --git a/server/api/cmCompany/index.js b/server/api/cmCompany/index.js index e69be0e..d9ca445 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 _0x3e74=['isAuthenticated','index','describe','/:id','getContacts','post','create','/:id/contacts','put','update','destroy','exports','multer','path','connect-timeout','express','../../components/interaction/service','./cmCompany.controller','get'];(function(_0x1e1a40,_0x120381){var _0x233c8e=function(_0x134c29){while(--_0x134c29){_0x1e1a40['push'](_0x1e1a40['shift']());}};_0x233c8e(++_0x120381);}(_0x3e74,0x175));var _0x43e7=function(_0x35c8ee,_0x10527a){_0x35c8ee=_0x35c8ee-0x0;var _0x5f1981=_0x3e74[_0x35c8ee];return _0x5f1981;};'use strict';var multer=require(_0x43e7('0x0'));var util=require('util');var path=require(_0x43e7('0x1'));var timeout=require(_0x43e7('0x2'));var express=require(_0x43e7('0x3'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0x43e7('0x4'));var config=require('../../config/environment');var controller=require(_0x43e7('0x5'));router[_0x43e7('0x6')]('/',auth[_0x43e7('0x7')](),controller[_0x43e7('0x8')]);router[_0x43e7('0x6')]('/describe',auth[_0x43e7('0x7')](),controller[_0x43e7('0x9')]);router[_0x43e7('0x6')](_0x43e7('0xa'),auth[_0x43e7('0x7')](),controller['show']);router[_0x43e7('0x6')]('/:id/contacts',auth['isAuthenticated'](),controller[_0x43e7('0xb')]);router[_0x43e7('0xc')]('/',auth['isAuthenticated'](),controller[_0x43e7('0xd')]);router['post'](_0x43e7('0xe'),auth[_0x43e7('0x7')](),controller['addContacts']);router[_0x43e7('0xf')](_0x43e7('0xa'),auth[_0x43e7('0x7')](),controller[_0x43e7('0x10')]);router['delete']('/:id',auth[_0x43e7('0x7')](),controller[_0x43e7('0x11')]);module[_0x43e7('0x12')]=router; \ No newline at end of file +var _0x9c44=['express','Router','../../components/auth/service','../../components/interaction/service','get','index','/describe','isAuthenticated','describe','/:id','show','getContacts','post','create','addContacts','put','update','destroy','exports','path','connect-timeout'];(function(_0x2a0c36,_0x3491c2){var _0x291001=function(_0x10b002){while(--_0x10b002){_0x2a0c36['push'](_0x2a0c36['shift']());}};_0x291001(++_0x3491c2);}(_0x9c44,0x178));var _0x49c4=function(_0x1035c1,_0x2d8583){_0x1035c1=_0x1035c1-0x0;var _0x308d67=_0x9c44[_0x1035c1];return _0x308d67;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x49c4('0x0'));var timeout=require(_0x49c4('0x1'));var express=require(_0x49c4('0x2'));var router=express[_0x49c4('0x3')]();var auth=require(_0x49c4('0x4'));var interaction=require(_0x49c4('0x5'));var config=require('../../config/environment');var controller=require('./cmCompany.controller');router[_0x49c4('0x6')]('/',auth['isAuthenticated'](),controller[_0x49c4('0x7')]);router[_0x49c4('0x6')](_0x49c4('0x8'),auth[_0x49c4('0x9')](),controller[_0x49c4('0xa')]);router['get'](_0x49c4('0xb'),auth[_0x49c4('0x9')](),controller[_0x49c4('0xc')]);router[_0x49c4('0x6')]('/:id/contacts',auth['isAuthenticated'](),controller[_0x49c4('0xd')]);router[_0x49c4('0xe')]('/',auth['isAuthenticated'](),controller[_0x49c4('0xf')]);router[_0x49c4('0xe')]('/:id/contacts',auth['isAuthenticated'](),controller[_0x49c4('0x10')]);router[_0x49c4('0x11')]('/:id',auth[_0x49c4('0x9')](),controller[_0x49c4('0x12')]);router['delete'](_0x49c4('0xb'),auth[_0x49c4('0x9')](),controller[_0x49c4('0x13')]);module[_0x49c4('0x14')]=router; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.attributes.js b/server/api/cmContact/cmContact.attributes.js index ab4bc2b..ae26528 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 _0x3fb1=['DATE','NOW','lodash','sequelize','exports','STRING','INTEGER'];(function(_0x47e7cb,_0x4c1b8d){var _0x2a8874=function(_0x36498f){while(--_0x36498f){_0x47e7cb['push'](_0x47e7cb['shift']());}};_0x2a8874(++_0x4c1b8d);}(_0x3fb1,0x80));var _0x13fb=function(_0x5b6957,_0x763e24){_0x5b6957=_0x5b6957-0x0;var _0x2f526c=_0x3fb1[_0x5b6957];return _0x2f526c;};'use strict';var _=require(_0x13fb('0x0'));var Sequelize=require(_0x13fb('0x1'));module[_0x13fb('0x2')]={'firstName':{'type':Sequelize[_0x13fb('0x3')],'allowNull':![]},'lastName':{'type':Sequelize[_0x13fb('0x3')]},'street':{'type':Sequelize[_0x13fb('0x3')]},'postalCode':{'type':Sequelize[_0x13fb('0x3')]},'city':{'type':Sequelize['STRING']},'country':{'type':Sequelize[_0x13fb('0x3')]},'dateOfBirth':{'type':Sequelize['STRING']},'description':{'type':Sequelize['TEXT']},'phone':{'type':Sequelize[_0x13fb('0x3')]},'mobile':{'type':Sequelize['STRING']},'fax':{'type':Sequelize[_0x13fb('0x3')]},'email':{'type':Sequelize[_0x13fb('0x3')]},'url':{'type':Sequelize['STRING']},'facebook':{'type':Sequelize[_0x13fb('0x3')]},'fb_data':{'type':Sequelize[_0x13fb('0x3')]},'twitter':{'type':Sequelize[_0x13fb('0x3')]},'skype':{'type':Sequelize['STRING']},'teams':{'type':Sequelize[_0x13fb('0x3')]},'viber':{'type':Sequelize[_0x13fb('0x3')]},'line':{'type':Sequelize[_0x13fb('0x3')]},'wechat':{'type':Sequelize['STRING']},'telegram':{'type':Sequelize['STRING']},'UserId':{'type':Sequelize[_0x13fb('0x4')]},'priority':{'type':Sequelize[_0x13fb('0x4')](0x2)['UNSIGNED'],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'scheduledat':{'type':Sequelize[_0x13fb('0x5')],'defaultValue':Sequelize[_0x13fb('0x6')]},'dialTimezone':{'type':Sequelize[_0x13fb('0x3')]},'utcOffset':{'type':Sequelize[_0x13fb('0x4')]}}; \ No newline at end of file +var _0x7184=['INTEGER','DATE','NOW','lodash','sequelize','STRING'];(function(_0x5d4db4,_0x233574){var _0x25b0c0=function(_0x106574){while(--_0x106574){_0x5d4db4['push'](_0x5d4db4['shift']());}};_0x25b0c0(++_0x233574);}(_0x7184,0xd5));var _0x4718=function(_0xdb628e,_0x103e9a){_0xdb628e=_0xdb628e-0x0;var _0x493aa5=_0x7184[_0xdb628e];return _0x493aa5;};'use strict';var _=require(_0x4718('0x0'));var Sequelize=require(_0x4718('0x1'));module['exports']={'firstName':{'type':Sequelize[_0x4718('0x2')],'allowNull':![]},'lastName':{'type':Sequelize['STRING']},'street':{'type':Sequelize[_0x4718('0x2')]},'postalCode':{'type':Sequelize[_0x4718('0x2')]},'city':{'type':Sequelize[_0x4718('0x2')]},'country':{'type':Sequelize[_0x4718('0x2')]},'dateOfBirth':{'type':Sequelize[_0x4718('0x2')]},'description':{'type':Sequelize['TEXT']},'phone':{'type':Sequelize[_0x4718('0x2')]},'mobile':{'type':Sequelize[_0x4718('0x2')]},'fax':{'type':Sequelize[_0x4718('0x2')]},'email':{'type':Sequelize['STRING']},'url':{'type':Sequelize[_0x4718('0x2')]},'facebook':{'type':Sequelize['STRING']},'fb_data':{'type':Sequelize[_0x4718('0x2')]},'twitter':{'type':Sequelize[_0x4718('0x2')]},'skype':{'type':Sequelize['STRING']},'teams':{'type':Sequelize[_0x4718('0x2')]},'viber':{'type':Sequelize[_0x4718('0x2')]},'line':{'type':Sequelize[_0x4718('0x2')]},'wechat':{'type':Sequelize[_0x4718('0x2')]},'telegram':{'type':Sequelize[_0x4718('0x2')]},'UserId':{'type':Sequelize[_0x4718('0x3')]},'priority':{'type':Sequelize[_0x4718('0x3')](0x2)['UNSIGNED'],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'scheduledat':{'type':Sequelize[_0x4718('0x4')],'defaultValue':Sequelize[_0x4718('0x5')]},'dialTimezone':{'type':Sequelize[_0x4718('0x2')]},'utcOffset':{'type':Sequelize['INTEGER']}}; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.controller.js b/server/api/cmContact/cmContact.controller.js index 979e2c5..7fd7fbb 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 _0x308c=['concat','CONCAT_WS(\x27\x20\x27,\x20c.firstName,\x20c.lastName,\x20c.email)\x20LIKE\x20?','\x20=\x20?','tag','isArray','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','filter','replace','\x27\x27\x27\x27','getFullTextValue','isNumeric','c.id\x20LIKE\x20?','c.phone\x20LIKE\x20?','c.mobile\x20LIKE\x20?','c.fax\x20LIKE\x20?','isEmail','c.email\x20LIKE\x20?','c.firstName\x20LIKE\x20?','group','c.id','Sequelize','SELECT','clone','order','DESC','resolve','some','User','getLists','c.ListId\x20IS\x20NULL','c.ListId\x20IN\x20?','sequelize','keyBy','merge','CmContact','c.firstName','c.mobile','c.email','c.ListId','c.deletedAt','GROUP_CONCAT(DISTINCT\x20t.id)','toString','TagIds','Tags','rows','catch','params','tags','columnName','displayName','findAll','alias','custom','values','body','get','join','info','[CmContact][merge]\x20to\x20%s\x20from\x20%s','destroy','[CmContact][merge][destroy][CmHopper],\x20%s','CmHopperBlack','[CmContact][merge][destroy][CmHopperBlack],\x20%s','ChatMessage','ChatOfflineMessage','MailInteraction','MailMessage','SmsMessage','FaxMessage','OpenchannelMessage','CmHopperFinal','CmHopperHistory','VoiceCallReport','FaxQueueReport','MailQueueReport','SmsQueueReport','JscriptySessionReport','create','bulkCreate','duplicates','$or','findOrCreate','spread','show','$and','format','cf_%d','omit','pickBy','table','setFields','id\x20=\x20?','CmHopper','phone','findOne','rawAttributes','options','getTags','setTags','ids','getHoppers','ContactId','includeAll','include','getHopperHistories','getHopperFinals','getJscriptySessions','uploadCsv','No\x20ListId\x20specified','No\x20association\x20keys\x20specified!','No\x20association\x20values\x20specified!','Unable\x20to\x20synchronize\x20socket,\x20no\x20timestamp\x20passed','binding_values','Incorrect\x20binding\x20parameters\x20passed!','zipObject','No\x20phone\x20column\x20specified','firstName','server/files/tmp','file','filename','chmodSync','0777','child_process','../../components/import/cm/csv','binding_keys','CompanyId','socket_timestamp','File\x20uploaded\x20correctly!','pid','upload','createReadStream','path','meta','import','agent','binding','No\x20firstName\x20column\x20specified','fork','../../components/import/cm/csv2','stringify','message','error\x20child\x20process','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','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','redis','defaults','localhost','socket.io-emitter','./cmContact.socket','register','sendStatus','status','json','count','offset','limit','Content-Range','apply','save','update','then','end','error','stack','name','send','index','describe','keys','startsWith','cf_','push','CmCustomField','trimStart','all','length','type','query','intersection','model','attributes','fields','nolimit','sort','filters','pick','select','field','color','from','cm_contacts','left_join','cm_user_has_contacts','uc.CmContactId\x20=\x20c.id','cm_contact_has_tags','ct.CmContactId\x20=\x20c.id','tools_tags','t.id\x20=\x20ct.TagId','where','c.deletedAt\x20IS\x20NULL','expr','search','parseSearch','sqlOperator','conditions','find','Tag','value','split','map','forEach','union','and','uc.UserId\x20=\x20?','dateOfBirth','datetime','buildExpression','text','start','hasOwnProperty','isNil','Contact','isEmpty','ListId'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0x308c,0x8e));var _0xc308=function(_0x21a9d9,_0x4d5ac8){_0x21a9d9=_0x21a9d9-0x0;var _0x46adce=_0x308c[_0x21a9d9];return _0x46adce;};'use strict';var pdf=require(_0xc308('0x0'));var emlformat=require(_0xc308('0x1'));var rimraf=require(_0xc308('0x2'));var zipdir=require(_0xc308('0x3'));var jsonpatch=require(_0xc308('0x4'));var rp=require(_0xc308('0x5'));var moment=require(_0xc308('0x6'));var BPromise=require(_0xc308('0x7'));var Mustache=require(_0xc308('0x8'));var util=require(_0xc308('0x9'));var path=require('path');var sox=require(_0xc308('0xa'));var csv=require(_0xc308('0xb'));var ejs=require(_0xc308('0xc'));var fs=require('fs');var _=require('lodash');var squel=require(_0xc308('0xd'));var crypto=require(_0xc308('0xe'));var jsforce=require(_0xc308('0xf'));var deskjs=require(_0xc308('0x10'));var toCsv=require('to-csv');var querystring=require(_0xc308('0x11'));var Papa=require('papaparse');var Redis=require(_0xc308('0x12'));var authService=require(_0xc308('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0xc308('0x14'));var hardwareService=require(_0xc308('0x15'));var logger=require(_0xc308('0x16'))(_0xc308('0x17'));var utils=require(_0xc308('0x18'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];config[_0xc308('0x19')]=_[_0xc308('0x1a')](config['redis'],{'host':_0xc308('0x1b'),'port':0x18eb});var socket=require(_0xc308('0x1c'))(new Redis(config[_0xc308('0x19')]));require(_0xc308('0x1d'))[_0xc308('0x1e')](socket);function respondWithStatusCode(_0x36dc2b,_0x4f0e1e){_0x4f0e1e=_0x4f0e1e||0xcc;return function(_0x22e1a1){if(_0x22e1a1){return _0x36dc2b[_0xc308('0x1f')](_0x4f0e1e);}return _0x36dc2b[_0xc308('0x20')](_0x4f0e1e)['end']();};}function respondWithResult(_0x538bb0,_0xdd9076){_0xdd9076=_0xdd9076||0xc8;return function(_0x1b4fd5){if(_0x1b4fd5){return _0x538bb0['status'](_0xdd9076)[_0xc308('0x21')](_0x1b4fd5);}};}function respondWithFilteredResult(_0x5bcc22,_0x2bf453){return function(_0x5f2d41){if(_0x5f2d41){var _0x1ddef9=_0x5f2d41[_0xc308('0x22')],_0x5e2414=_0x2bf453[_0xc308('0x23')],_0x3c1ed7=_0x2bf453[_0xc308('0x23')]+_0x2bf453[_0xc308('0x24')],_0x353e24;if(_0x3c1ed7>=_0x1ddef9){_0x3c1ed7=_0x1ddef9;_0x353e24=0xc8;}else{_0x353e24=0xce;}_0x5bcc22['status'](_0x353e24);return _0x5bcc22['set'](_0xc308('0x25'),_0x5e2414+'-'+_0x3c1ed7+'/'+_0x1ddef9)[_0xc308('0x21')](_0x5f2d41);}return null;};}function patchUpdates(_0x565a79){return function(_0x291d1f){try{jsonpatch[_0xc308('0x26')](_0x291d1f,_0x565a79,!![]);}catch(_0x37f30e){return BPromise['reject'](_0x37f30e);}return _0x291d1f[_0xc308('0x27')]();};}function saveUpdates(_0x290930,_0x49ea55){return function(_0x2d7c48){if(_0x2d7c48){return _0x2d7c48[_0xc308('0x28')](_0x290930)[_0xc308('0x29')](function(_0x25e135){return _0x25e135;});}return null;};}function removeEntity(_0x580200,_0x56cb29){return function(_0x2bbb86){if(_0x2bbb86){return _0x2bbb86['destroy']()['then'](function(){_0x580200['status'](0xcc)[_0xc308('0x2a')]();});}};}function handleEntityNotFound(_0x589b8b,_0x5578ed){return function(_0x471913){if(!_0x471913){_0x589b8b[_0xc308('0x1f')](0x194);}return _0x471913;};}function handleError(_0x367a02,_0x5817a4){_0x5817a4=_0x5817a4||0x1f4;return function(_0x279f6b){logger[_0xc308('0x2b')](_0x279f6b[_0xc308('0x2c')]);if(_0x279f6b[_0xc308('0x2d')]){delete _0x279f6b[_0xc308('0x2d')];}_0x367a02[_0xc308('0x20')](_0x5817a4)[_0xc308('0x2e')](_0x279f6b);};}exports[_0xc308('0x2f')]=function(_0x9a3c52,_0x1ea8c5){var _0xa645c0={},_0x2a510c={},_0x405f09={'count':0x0,'rows':[]};return db['CmContact'][_0xc308('0x30')]()[_0xc308('0x29')](function(_0x58e779){var _0xf6245f=[];for(var _0x3dcdd9=0x0;_0x3dcdd90x1){_0x492cb3['or']('MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0xc308('0x72')](_0x20eae8),null);}else{if(qs[_0xc308('0x73')](_0x20eae8)){_0x492cb3['or'](_0xc308('0x74'),_0x20eae8+'%');_0x492cb3['or'](_0xc308('0x75'),_0x20eae8+'%');_0x492cb3['or'](_0xc308('0x76'),_0x20eae8+'%');_0x492cb3['or'](_0xc308('0x77'),_0x20eae8+'%');}else if(qs[_0xc308('0x78')](_0x20eae8)){_0x492cb3['or'](_0xc308('0x79'),_0x20eae8+'%');}else{_0x492cb3['or'](_0xc308('0x7a'),'%'+_0x20eae8+'%');_0x492cb3['or']('c.lastName\x20LIKE\x20?','%'+_0x20eae8+'%');_0x492cb3['or'](_0xc308('0x79'),'%'+_0x20eae8+'%');}}}}_0x1e738b[_0xc308('0x4f')](_0x492cb3);_0x1e738b[_0xc308('0x7b')](_0xc308('0x7c'));var _0x2e535b={'type':db[_0xc308('0x7d')]['QueryTypes'][_0xc308('0x7e')],'raw':!![]};var _0x2937f6=_0x1e738b[_0xc308('0x7f')]()['field']('c.id');if(_0xa645c0['order']){_0xa645c0[_0xc308('0x80')][_0xc308('0x5b')](function(_0xf6819a){_0x1e738b[_0xc308('0x80')]('c.'+_0xf6819a[0x0],_0xf6819a[0x1]===_0xc308('0x81')?![]:!![]);});}if(!_[_0xc308('0x67')](_0x4d28df)){_0x1e738b['having'](_0x1c8f92);_0x2937f6[_0xc308('0x4f')]('t.id\x20IN\x20?',_0x4d28df);}BPromise[_0xc308('0x82')]()['then'](function(){if(_0x383252&&!_[_0xc308('0x83')](_0x383252[_0xc308('0x55')],[_0xc308('0x44'),_0xc308('0x84')])){return _0x9a3c52['user'][_0xc308('0x85')]({'attributes':['id'],'raw':!![]})['then'](function(_0x4cda2a){if(_[_0xc308('0x67')](_0x4cda2a)){_0x2937f6[_0xc308('0x4f')](_0xc308('0x86'));_0x1e738b['where'](_0xc308('0x86'));}else{_0x2937f6['where'](_0xc308('0x87'),_['map'](_0x4cda2a,'id'));_0x1e738b['where'](_0xc308('0x87'),_[_0xc308('0x5a')](_0x4cda2a,'id'));}});}else{return;}})['then'](function(){db[_0xc308('0x88')]['query'](_0x2937f6['toString'](),_0x2e535b)[_0xc308('0x29')](function(_0x7a675a){_0x405f09['count']=_0x7a675a[_0xc308('0x38')];if(_0x405f09[_0xc308('0x22')]===0x0)return[];return db[_0xc308('0x88')][_0xc308('0x3a')](_0x349f1e['toString'](),_0x2e535b);})[_0xc308('0x29')](function(_0x3eeb55){_0x33b253=_[_0xc308('0x89')](_0x3eeb55,'id');_0x2e535b=_[_0xc308('0x8a')](_0x2e535b,{'model':db[_0xc308('0x8b')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x9a3c52[_0xc308('0x3a')][_0xc308('0x3e')]){_0xa645c0['attributes'][_0xc308('0x5b')](function(_0x219dab){_0x1e738b[_0xc308('0x44')]('c.'+_0x219dab);});}else{_0x1e738b[_0xc308('0x44')](_0xc308('0x7c'));_0x1e738b[_0xc308('0x44')](_0xc308('0x8c'));_0x1e738b[_0xc308('0x44')]('c.lastName');_0x1e738b[_0xc308('0x44')]('c.phone');_0x1e738b[_0xc308('0x44')](_0xc308('0x8d'));_0x1e738b['field']('c.fax');_0x1e738b[_0xc308('0x44')](_0xc308('0x8e'));_0x1e738b['field'](_0xc308('0x8f'));_0x1e738b[_0xc308('0x44')](_0xc308('0x90'));_0x1e738b['field'](_0xc308('0x91'),'TagIds');}if(_0xa645c0[_0xc308('0x24')])_0x1e738b[_0xc308('0x24')](_0xa645c0['limit']);if(_0xa645c0['offset'])_0x1e738b[_0xc308('0x23')](_0xa645c0[_0xc308('0x23')]);return db['sequelize'][_0xc308('0x3a')](_0x1e738b[_0xc308('0x92')](),_0x2e535b);})[_0xc308('0x29')](function(_0x6e6426){_0x6e6426[_0xc308('0x5b')](function(_0x3ba19c){if(_0x3ba19c[_0xc308('0x93')]){_0x3ba19c[_0xc308('0x94')]=[];_0x3ba19c[_0xc308('0x93')][_0xc308('0x59')](',')[_0xc308('0x5b')](function(_0x36b324){_0x3ba19c[_0xc308('0x94')]['push'](_0x33b253[_0x36b324]);});}delete _0x3ba19c[_0xc308('0x93')];});_0x405f09[_0xc308('0x95')]=_0x6e6426;return _0x405f09;})['then'](respondWithFilteredResult(_0x1ea8c5,_0xa645c0));});})[_0xc308('0x96')](handleError(_0x1ea8c5,null));};exports['destroy']=function(_0x22ded7,_0x1c2e6b){return db['CmContact']['find']({'where':{'id':_0x22ded7[_0xc308('0x97')]['id']}})[_0xc308('0x29')](handleEntityNotFound(_0x1c2e6b,null))[_0xc308('0x29')](removeEntity(_0x1c2e6b,null))[_0xc308('0x96')](handleError(_0x1c2e6b,null));};exports[_0xc308('0x30')]=function(_0x54e085,_0x22dbbe){return db[_0xc308('0x8b')]['describe']()[_0xc308('0x29')](function(_0x562d7a){delete _0x562d7a[_0xc308('0x98')];for(var _0x593607=0x0;_0x593607=_0x3eff1c){_0x37bd4f=_0x3eff1c;_0x380d93=0xc8;}else{_0x380d93=0xce;}_0x321802['status'](_0x380d93);return _0x321802[_0x07c1('0x21')](_0x07c1('0x22'),_0x4f0313+'-'+_0x37bd4f+'/'+_0x3eff1c)[_0x07c1('0x1e')](_0x58e121);}return null;};}function patchUpdates(_0x454ef4){return function(_0x20d22e){try{jsonpatch['apply'](_0x20d22e,_0x454ef4,!![]);}catch(_0x5a80b1){return BPromise[_0x07c1('0x23')](_0x5a80b1);}return _0x20d22e[_0x07c1('0x24')]();};}function saveUpdates(_0x1633bc,_0x19f3a5){return function(_0xcb0425){if(_0xcb0425){return _0xcb0425[_0x07c1('0x25')](_0x1633bc)['then'](function(_0x4f71c5){return _0x4f71c5;});}return null;};}function removeEntity(_0x312575,_0x15c276){return function(_0x23dd31){if(_0x23dd31){return _0x23dd31[_0x07c1('0x26')]()['then'](function(){_0x312575[_0x07c1('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x20ee08,_0xcb4d6c){return function(_0x3b5cab){if(!_0x3b5cab){_0x20ee08[_0x07c1('0x27')](0x194);}return _0x3b5cab;};}function handleError(_0x2ef1d0,_0x8e8a60){_0x8e8a60=_0x8e8a60||0x1f4;return function(_0x65b039){logger['error'](_0x65b039[_0x07c1('0x28')]);if(_0x65b039[_0x07c1('0x29')]){delete _0x65b039[_0x07c1('0x29')];}_0x2ef1d0[_0x07c1('0x1d')](_0x8e8a60)[_0x07c1('0x2a')](_0x65b039);};}exports[_0x07c1('0x2b')]=function(_0x5f279f,_0x3f8977){var _0x438cef={},_0x4e7f93={},_0x16939={'count':0x0,'rows':[]};return db[_0x07c1('0x2c')][_0x07c1('0x2d')]()[_0x07c1('0x2e')](function(_0x402c7e){var _0x2a3237=[];for(var _0x1c75d6=0x0;_0x1c75d60x1){_0x3d9220['or'](_0x07c1('0x6c'),qs['getFullTextValue'](_0x55541e),null);}else{if(qs['isNumeric'](_0x55541e)){_0x3d9220['or'](_0x07c1('0x6d'),_0x55541e+'%');_0x3d9220['or'](_0x07c1('0x6e'),_0x55541e+'%');_0x3d9220['or']('c.mobile\x20LIKE\x20?',_0x55541e+'%');_0x3d9220['or'](_0x07c1('0x6f'),_0x55541e+'%');}else if(qs[_0x07c1('0x70')](_0x55541e)){_0x3d9220['or'](_0x07c1('0x71'),_0x55541e+'%');}else{_0x3d9220['or'](_0x07c1('0x72'),'%'+_0x55541e+'%');_0x3d9220['or'](_0x07c1('0x73'),'%'+_0x55541e+'%');_0x3d9220['or']('c.email\x20LIKE\x20?','%'+_0x55541e+'%');}}}}_0xa89129[_0x07c1('0x64')](_0x3d9220);_0xa89129[_0x07c1('0x74')](_0x07c1('0x75'));var _0xbe66be={'type':db['Sequelize']['QueryTypes'][_0x07c1('0x76')],'raw':!![]};var _0x2fffe0=_0xa89129[_0x07c1('0x77')]()[_0x07c1('0x43')]('c.id');if(_0x438cef[_0x07c1('0x3f')]){_0x438cef[_0x07c1('0x3f')][_0x07c1('0x57')](function(_0x1ec9ff){_0xa89129['order']('c.'+_0x1ec9ff[0x0],_0x1ec9ff[0x1]===_0x07c1('0x78')?![]:!![]);});}if(!_[_0x07c1('0x62')](_0x15edf4)){_0xa89129[_0x07c1('0x79')](_0x44800b);_0x2fffe0[_0x07c1('0x64')](_0x07c1('0x7a'),_0x15edf4);}BPromise['resolve']()[_0x07c1('0x2e')](function(){if(_0x34dfe6&&!_[_0x07c1('0x7b')](_0x34dfe6[_0x07c1('0x51')],[_0x07c1('0x43'),'User'])){return _0x5f279f[_0x07c1('0x7c')][_0x07c1('0x7d')]({'attributes':['id'],'raw':!![]})[_0x07c1('0x2e')](function(_0x5caddd){if(_[_0x07c1('0x62')](_0x5caddd)){_0x2fffe0[_0x07c1('0x64')](_0x07c1('0x7e'));_0xa89129['where']('c.ListId\x20IS\x20NULL');}else{_0x2fffe0['where']('c.ListId\x20IN\x20?',_[_0x07c1('0x56')](_0x5caddd,'id'));_0xa89129[_0x07c1('0x64')](_0x07c1('0x65'),_[_0x07c1('0x56')](_0x5caddd,'id'));}});}else{return;}})[_0x07c1('0x2e')](function(){db[_0x07c1('0x7f')][_0x07c1('0x38')](_0x2fffe0[_0x07c1('0x80')](),_0xbe66be)[_0x07c1('0x2e')](function(_0xbb6f3a){_0x16939['count']=_0xbb6f3a[_0x07c1('0x36')];if(_0x16939['count']===0x0)return[];return db[_0x07c1('0x7f')][_0x07c1('0x38')](_0x3f13ae['toString'](),_0xbe66be);})[_0x07c1('0x2e')](function(_0x540841){_0x267d29=_[_0x07c1('0x81')](_0x540841,'id');_0xbe66be=_[_0x07c1('0x82')](_0xbe66be,{'model':db[_0x07c1('0x2c')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x5f279f[_0x07c1('0x38')][_0x07c1('0x3c')]){_0x438cef['attributes'][_0x07c1('0x57')](function(_0x15e2e5){_0xa89129[_0x07c1('0x43')]('c.'+_0x15e2e5);});}else{_0xa89129[_0x07c1('0x43')](_0x07c1('0x75'));_0xa89129[_0x07c1('0x43')](_0x07c1('0x83'));_0xa89129[_0x07c1('0x43')](_0x07c1('0x84'));_0xa89129[_0x07c1('0x43')](_0x07c1('0x85'));_0xa89129['field'](_0x07c1('0x86'));_0xa89129['field'](_0x07c1('0x87'));_0xa89129['field'](_0x07c1('0x88'));_0xa89129['field']('c.ListId');_0xa89129['field']('c.deletedAt');_0xa89129[_0x07c1('0x43')](_0x07c1('0x89'),_0x07c1('0x8a'));}if(_0x438cef[_0x07c1('0x3e')])_0xa89129[_0x07c1('0x3e')](_0x438cef[_0x07c1('0x3e')]);if(_0x438cef[_0x07c1('0x20')])_0xa89129[_0x07c1('0x20')](_0x438cef['offset']);return db[_0x07c1('0x7f')]['query'](_0xa89129[_0x07c1('0x80')](),_0xbe66be);})['then'](function(_0x529a22){_0x529a22['forEach'](function(_0x5dd3a5){if(_0x5dd3a5[_0x07c1('0x8a')]){_0x5dd3a5[_0x07c1('0x8b')]=[];_0x5dd3a5[_0x07c1('0x8a')]['split'](',')[_0x07c1('0x57')](function(_0x58c638){_0x5dd3a5[_0x07c1('0x8b')][_0x07c1('0x32')](_0x267d29[_0x58c638]);});}delete _0x5dd3a5[_0x07c1('0x8a')];});_0x16939['rows']=_0x529a22;return _0x16939;})[_0x07c1('0x2e')](respondWithFilteredResult(_0x3f8977,_0x438cef));});})[_0x07c1('0x8c')](handleError(_0x3f8977,null));};exports['destroy']=function(_0x2f572d,_0x5b27d0){return db[_0x07c1('0x2c')][_0x07c1('0x52')]({'where':{'id':_0x2f572d[_0x07c1('0x8d')]['id']}})[_0x07c1('0x2e')](handleEntityNotFound(_0x5b27d0,null))[_0x07c1('0x2e')](removeEntity(_0x5b27d0,null))[_0x07c1('0x8c')](handleError(_0x5b27d0,null));};exports['describe']=function(_0x457b30,_0x17a513){return db['CmContact'][_0x07c1('0x2d')]()[_0x07c1('0x2e')](function(_0x22afc4){delete _0x22afc4[_0x07c1('0x8e')];for(var _0x494fc6=0x0;_0x494fc6{}\s\\|]/g,'-');_0x3229d1(null,util[_0x35fc('0x1f')](_0x35fc('0x20'),path[_0x35fc('0x21')](_0x350a27[_0x35fc('0x1d')],path['extname'](_0x350a27[_0x35fc('0x1d')])),Date[_0x35fc('0x22')](),path[_0x35fc('0x23')](_0x350a27[_0x35fc('0x1d')])));}})});router[_0x35fc('0x16')]('/csv',upload[_0x35fc('0x24')](_0x35fc('0x25')),controller['uploadCsv']);var upload=multer({'storage':multer[_0x35fc('0x1a')]({'destination':function(_0x5a93df,_0x3d4a98,_0x51cfec){_0x51cfec(null,path[_0x35fc('0x1b')](config['root'],_0x35fc('0x26')));},'filename':function(_0xdfab9f,_0x5cb986,_0x519264){_0x5cb986[_0x35fc('0x1d')]=_0x5cb986['originalname'][_0x35fc('0x1e')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x519264(null,util[_0x35fc('0x1f')]('%s-%s%s',path[_0x35fc('0x21')](_0x5cb986[_0x35fc('0x1d')],path[_0x35fc('0x23')](_0x5cb986[_0x35fc('0x1d')])),Date[_0x35fc('0x22')](),path[_0x35fc('0x23')](_0x5cb986[_0x35fc('0x1d')])));}})});router[_0x35fc('0x16')]('/upload',upload[_0x35fc('0x24')](_0x35fc('0x25')),controller[_0x35fc('0x27')]);router['post'](_0x35fc('0x28'),auth[_0x35fc('0x9')](),controller[_0x35fc('0x29')]);router[_0x35fc('0x2a')](_0x35fc('0xc'),auth[_0x35fc('0x9')](),controller[_0x35fc('0x2b')]);router[_0x35fc('0x2c')](_0x35fc('0xc'),auth[_0x35fc('0x9')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xf494=['getTags','/:id/hoppers','getHopperHistories','getHopperFinals','/:id/jscripty_sessions','getJscriptySessions','post','merge','/create_many','join','root','server/files/tmp','originalname','replace','%s-%s%s','basename','now','extname','/csv','uploadCsv','diskStorage','/upload','single','file','/upload/:id','import','put','update','delete','destroy','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmContact.controller','get','isAuthenticated','index','/describe','/:id','show','/:id/tags'];(function(_0x72a99b,_0xfd0c65){var _0x5bee30=function(_0x7cabb3){while(--_0x7cabb3){_0x72a99b['push'](_0x72a99b['shift']());}};_0x5bee30(++_0xfd0c65);}(_0xf494,0x1c6));var _0x4f49=function(_0x1f2b08,_0xcdc8bf){_0x1f2b08=_0x1f2b08-0x0;var _0x30568e=_0xf494[_0x1f2b08];return _0x30568e;};'use strict';var multer=require(_0x4f49('0x0'));var util=require(_0x4f49('0x1'));var path=require(_0x4f49('0x2'));var timeout=require('connect-timeout');var express=require(_0x4f49('0x3'));var router=express[_0x4f49('0x4')]();var auth=require(_0x4f49('0x5'));var interaction=require(_0x4f49('0x6'));var config=require(_0x4f49('0x7'));var controller=require(_0x4f49('0x8'));router[_0x4f49('0x9')]('/',auth[_0x4f49('0xa')](),controller[_0x4f49('0xb')]);router[_0x4f49('0x9')](_0x4f49('0xc'),auth['isAuthenticated'](),controller['describe']);router[_0x4f49('0x9')](_0x4f49('0xd'),auth[_0x4f49('0xa')](),controller[_0x4f49('0xe')]);router[_0x4f49('0x9')](_0x4f49('0xf'),auth[_0x4f49('0xa')](),controller[_0x4f49('0x10')]);router['get'](_0x4f49('0x11'),auth[_0x4f49('0xa')](),controller['getHoppers']);router[_0x4f49('0x9')]('/:id/hopper_histories',auth['isAuthenticated'](),controller[_0x4f49('0x12')]);router[_0x4f49('0x9')]('/:id/hopper_finals',auth[_0x4f49('0xa')](),controller[_0x4f49('0x13')]);router[_0x4f49('0x9')](_0x4f49('0x14'),auth[_0x4f49('0xa')](),controller[_0x4f49('0x15')]);router[_0x4f49('0x16')]('/merge',auth[_0x4f49('0xa')](),controller[_0x4f49('0x17')]);router[_0x4f49('0x16')]('/',auth['isAuthenticated'](),controller['create']);router[_0x4f49('0x16')](_0x4f49('0x18'),auth[_0x4f49('0xa')](),controller['bulkCreate']);router[_0x4f49('0x16')](_0x4f49('0xf'),auth[_0x4f49('0xa')](),controller['setTags']);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x560592,_0x47f1e8,_0xb2081a){_0xb2081a(null,path[_0x4f49('0x19')](config[_0x4f49('0x1a')],_0x4f49('0x1b')));},'filename':function(_0x5793ac,_0x416893,_0x2aed27){_0x416893[_0x4f49('0x1c')]=_0x416893[_0x4f49('0x1c')][_0x4f49('0x1d')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x2aed27(null,util['format'](_0x4f49('0x1e'),path[_0x4f49('0x1f')](_0x416893[_0x4f49('0x1c')],path['extname'](_0x416893[_0x4f49('0x1c')])),Date[_0x4f49('0x20')](),path[_0x4f49('0x21')](_0x416893[_0x4f49('0x1c')])));}})});router[_0x4f49('0x16')](_0x4f49('0x22'),upload['single']('file'),controller[_0x4f49('0x23')]);var upload=multer({'storage':multer[_0x4f49('0x24')]({'destination':function(_0x4fedbb,_0x408552,_0x2c1519){_0x2c1519(null,path[_0x4f49('0x19')](config['root'],_0x4f49('0x1b')));},'filename':function(_0x2eed1c,_0x298785,_0x148153){_0x298785[_0x4f49('0x1c')]=_0x298785[_0x4f49('0x1c')]['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x148153(null,util['format'](_0x4f49('0x1e'),path[_0x4f49('0x1f')](_0x298785[_0x4f49('0x1c')],path['extname'](_0x298785[_0x4f49('0x1c')])),Date[_0x4f49('0x20')](),path[_0x4f49('0x21')](_0x298785['originalname'])));}})});router['post'](_0x4f49('0x25'),upload[_0x4f49('0x26')](_0x4f49('0x27')),controller['upload']);router[_0x4f49('0x16')](_0x4f49('0x28'),auth[_0x4f49('0xa')](),controller[_0x4f49('0x29')]);router[_0x4f49('0x2a')](_0x4f49('0xd'),auth[_0x4f49('0xa')](),controller[_0x4f49('0x2b')]);router[_0x4f49('0x2c')](_0x4f49('0xd'),auth[_0x4f49('0xa')](),controller[_0x4f49('0x2d')]);module[_0x4f49('0x2e')]=router; \ No newline at end of file diff --git a/server/api/cmContactHasItem/cmContactHasItem.attributes.js b/server/api/cmContactHasItem/cmContactHasItem.attributes.js index 970e7da..cb8db02 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 _0x8bc3=['STRING','sequelize','INTEGER'];(function(_0x5d4607,_0x6b5e7b){var _0x5e4a86=function(_0x46891a){while(--_0x46891a){_0x5d4607['push'](_0x5d4607['shift']());}};_0x5e4a86(++_0x6b5e7b);}(_0x8bc3,0x82));var _0x38bc=function(_0x54bb5e,_0xc9513a){_0x54bb5e=_0x54bb5e-0x0;var _0x2cfe75=_0x8bc3[_0x54bb5e];return _0x2cfe75;};'use strict';var Sequelize=require(_0x38bc('0x0'));module['exports']={'CmContactId':{'type':Sequelize[_0x38bc('0x1')],'primaryKey':!![]},'item':{'type':Sequelize['STRING'],'defaultValue':'','primaryKey':!![]},'ItemTypeId':{'type':Sequelize[_0x38bc('0x1')],'defaultValue':null},'ItemClass':{'type':Sequelize[_0x38bc('0x2')],'defaultValue':'PHONE'},'OrderBy':{'type':Sequelize[_0x38bc('0x1')],'defaultValue':null}}; \ No newline at end of file +var _0x3714=['INTEGER','sequelize','exports','STRING'];(function(_0x14d175,_0x230bf7){var _0x2946e9=function(_0x417219){while(--_0x417219){_0x14d175['push'](_0x14d175['shift']());}};_0x2946e9(++_0x230bf7);}(_0x3714,0x95));var _0x4371=function(_0x1352f8,_0x7a1f6f){_0x1352f8=_0x1352f8-0x0;var _0x399e93=_0x3714[_0x1352f8];return _0x399e93;};'use strict';var Sequelize=require(_0x4371('0x0'));module[_0x4371('0x1')]={'CmContactId':{'type':Sequelize['INTEGER'],'primaryKey':!![]},'item':{'type':Sequelize[_0x4371('0x2')],'defaultValue':'','primaryKey':!![]},'ItemTypeId':{'type':Sequelize[_0x4371('0x3')],'defaultValue':null},'ItemClass':{'type':Sequelize[_0x4371('0x2')],'defaultValue':'PHONE'},'OrderBy':{'type':Sequelize[_0x4371('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 e0363bf..d6796ec 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 _0x483a=['mustache','util','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','get','CmContactHasItems','UserProfileResource','error','stack','name','send','index','map','CmContactHasItem','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','limit','sort','where','pick','filter','merge','VIRTUAL','options','include','rows','catch','show','params','includeAll','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','userProfileId','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','html-pdf','eml-format','zip-dir','request-promise','moment','bluebird'];(function(_0x1d42ca,_0x12f27c){var _0x156a11=function(_0x1dc4e){while(--_0x1dc4e){_0x1d42ca['push'](_0x1d42ca['shift']());}};_0x156a11(++_0x12f27c);}(_0x483a,0x156));var _0xa483=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x483a[_0x3dd15e];return _0x231fd0;};'use strict';var pdf=require(_0xa483('0x0'));var emlformat=require(_0xa483('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xa483('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xa483('0x3'));var moment=require(_0xa483('0x4'));var BPromise=require(_0xa483('0x5'));var Mustache=require(_0xa483('0x6'));var util=require(_0xa483('0x7'));var path=require('path');var sox=require(_0xa483('0x8'));var csv=require(_0xa483('0x9'));var ejs=require(_0xa483('0xa'));var fs=require('fs');var _=require(_0xa483('0xb'));var squel=require(_0xa483('0xc'));var crypto=require(_0xa483('0xd'));var jsforce=require(_0xa483('0xe'));var deskjs=require(_0xa483('0xf'));var toCsv=require(_0xa483('0x9'));var querystring=require(_0xa483('0x10'));var Papa=require(_0xa483('0x11'));var Redis=require('ioredis');var authService=require(_0xa483('0x12'));var qs=require(_0xa483('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xa483('0x14'));var logger=require(_0xa483('0x15'))(_0xa483('0x16'));var utils=require(_0xa483('0x17'));var config=require(_0xa483('0x18'));var db=require(_0xa483('0x19'))['db'];function respondWithStatusCode(_0x2d460d,_0x5cc23e){_0x5cc23e=_0x5cc23e||0xcc;return function(_0x4a8b82){if(_0x4a8b82){return _0x2d460d[_0xa483('0x1a')](_0x5cc23e);}return _0x2d460d[_0xa483('0x1b')](_0x5cc23e)[_0xa483('0x1c')]();};}function respondWithResult(_0x4077b5,_0x3da9e0){_0x3da9e0=_0x3da9e0||0xc8;return function(_0x296d79){if(_0x296d79){return _0x4077b5[_0xa483('0x1b')](_0x3da9e0)[_0xa483('0x1d')](_0x296d79);}};}function respondWithFilteredResult(_0x7b5150,_0x178114){return function(_0x5f4595){if(_0x5f4595){var _0x169c89=_0x5f4595[_0xa483('0x1e')],_0x234a6b=_0x178114['offset'],_0x1656d2=_0x178114[_0xa483('0x1f')]+_0x178114['limit'],_0x19f89d;if(_0x1656d2>=_0x169c89){_0x1656d2=_0x169c89;_0x19f89d=0xc8;}else{_0x19f89d=0xce;}_0x7b5150[_0xa483('0x1b')](_0x19f89d);return _0x7b5150[_0xa483('0x20')](_0xa483('0x21'),_0x234a6b+'-'+_0x1656d2+'/'+_0x169c89)[_0xa483('0x1d')](_0x5f4595);}return null;};}function patchUpdates(_0x18ac58){return function(_0x11ec9d){try{jsonpatch[_0xa483('0x22')](_0x11ec9d,_0x18ac58,!![]);}catch(_0x405936){return BPromise[_0xa483('0x23')](_0x405936);}return _0x11ec9d[_0xa483('0x24')]();};}function saveUpdates(_0x31da12,_0x15ef11){return function(_0x4fe08b){if(_0x4fe08b){return _0x4fe08b[_0xa483('0x25')](_0x31da12)[_0xa483('0x26')](function(_0x3572f6){return _0x3572f6;});}return null;};}function removeEntity(_0x3ec5e2,_0x18949a){return function(_0x4125e6){if(_0x4125e6){return _0x4125e6[_0xa483('0x27')]()[_0xa483('0x26')](function(){var _0x2477be=_0x4125e6[_0xa483('0x28')]({'plain':!![]});var _0x199184=_0xa483('0x29');return db[_0xa483('0x2a')]['destroy']({'where':{'type':_0x199184,'resourceId':_0x2477be['id']}})[_0xa483('0x26')](function(){return _0x4125e6;});})['then'](function(){_0x3ec5e2[_0xa483('0x1b')](0xcc)[_0xa483('0x1c')]();});}};}function handleEntityNotFound(_0x476d70,_0x561486){return function(_0x390ba0){if(!_0x390ba0){_0x476d70['sendStatus'](0x194);}return _0x390ba0;};}function handleError(_0x32ed75,_0xbb004c){_0xbb004c=_0xbb004c||0x1f4;return function(_0x7511db){logger[_0xa483('0x2b')](_0x7511db[_0xa483('0x2c')]);if(_0x7511db[_0xa483('0x2d')]){delete _0x7511db[_0xa483('0x2d')];}_0x32ed75[_0xa483('0x1b')](_0xbb004c)[_0xa483('0x2e')](_0x7511db);};}exports[_0xa483('0x2f')]=function(_0x500195,_0xdf25){var _0x80116d={},_0x38ec56={},_0x330ebf={'count':0x0,'rows':[]};var _0xcd32ab=_[_0xa483('0x30')](db[_0xa483('0x31')][_0xa483('0x32')],function(_0x3bc775){return{'name':_0x3bc775[_0xa483('0x33')],'type':_0x3bc775[_0xa483('0x34')][_0xa483('0x35')]};});_0x38ec56['model']=_[_0xa483('0x30')](_0xcd32ab,'name');_0x38ec56[_0xa483('0x36')]=_[_0xa483('0x37')](_0x500195[_0xa483('0x36')]);_0x38ec56[_0xa483('0x38')]=_[_0xa483('0x39')](_0x38ec56[_0xa483('0x3a')],_0x38ec56[_0xa483('0x36')]);_0x80116d[_0xa483('0x3b')]=_[_0xa483('0x39')](_0x38ec56[_0xa483('0x3a')],qs[_0xa483('0x3c')](_0x500195['query'][_0xa483('0x3c')]));_0x80116d['attributes']=_0x80116d[_0xa483('0x3b')][_0xa483('0x3d')]?_0x80116d[_0xa483('0x3b')]:_0x38ec56[_0xa483('0x3a')];if(!_0x500195['query'][_0xa483('0x3e')](_0xa483('0x3f'))){_0x80116d[_0xa483('0x40')]=qs[_0xa483('0x40')](_0x500195['query'][_0xa483('0x40')]);_0x80116d['offset']=qs['offset'](_0x500195[_0xa483('0x36')]['offset']);}_0x80116d['order']=qs[_0xa483('0x41')](_0x500195[_0xa483('0x36')][_0xa483('0x41')]);_0x80116d[_0xa483('0x42')]=qs[_0xa483('0x38')](_[_0xa483('0x43')](_0x500195[_0xa483('0x36')],_0x38ec56['filters']),_0xcd32ab);if(_0x500195[_0xa483('0x36')][_0xa483('0x44')]){_0x80116d[_0xa483('0x42')]=_[_0xa483('0x45')](_0x80116d[_0xa483('0x42')],{'$or':_[_0xa483('0x30')](_0xcd32ab,function(_0x18b3af){if(_0x18b3af[_0xa483('0x34')]!==_0xa483('0x46')){var _0x1eadf4={};_0x1eadf4[_0x18b3af[_0xa483('0x2d')]]={'$like':'%'+_0x500195[_0xa483('0x36')][_0xa483('0x44')]+'%'};return _0x1eadf4;}})});}_0x80116d=_[_0xa483('0x45')]({},_0x80116d,_0x500195[_0xa483('0x47')]);var _0x267a48={'where':_0x80116d[_0xa483('0x42')]};return db['CmContactHasItem'][_0xa483('0x1e')](_0x267a48)[_0xa483('0x26')](function(_0xe0ca3b){_0x330ebf['count']=_0xe0ca3b;if(_0x500195[_0xa483('0x36')]['includeAll']){_0x80116d[_0xa483('0x48')]=[{'all':!![]}];}return db[_0xa483('0x31')]['findAll'](_0x80116d);})[_0xa483('0x26')](function(_0xca70ae){_0x330ebf[_0xa483('0x49')]=_0xca70ae;return _0x330ebf;})[_0xa483('0x26')](respondWithFilteredResult(_0xdf25,_0x80116d))[_0xa483('0x4a')](handleError(_0xdf25,null));};exports[_0xa483('0x4b')]=function(_0x2397ed,_0x25f9b3){var _0x47a9a4={'raw':!![],'where':{'id':_0x2397ed[_0xa483('0x4c')]['id']}},_0xcf3439={};_0xcf3439['model']=_['keys'](db['CmContactHasItem'][_0xa483('0x32')]);_0xcf3439['query']=_[_0xa483('0x37')](_0x2397ed[_0xa483('0x36')]);_0xcf3439[_0xa483('0x38')]=_[_0xa483('0x39')](_0xcf3439[_0xa483('0x3a')],_0xcf3439[_0xa483('0x36')]);_0x47a9a4[_0xa483('0x3b')]=_[_0xa483('0x39')](_0xcf3439[_0xa483('0x3a')],qs[_0xa483('0x3c')](_0x2397ed[_0xa483('0x36')][_0xa483('0x3c')]));_0x47a9a4['attributes']=_0x47a9a4[_0xa483('0x3b')][_0xa483('0x3d')]?_0x47a9a4[_0xa483('0x3b')]:_0xcf3439[_0xa483('0x3a')];if(_0x2397ed[_0xa483('0x36')][_0xa483('0x4d')]){_0x47a9a4[_0xa483('0x48')]=[{'all':!![]}];}_0x47a9a4=_['merge']({},_0x47a9a4,_0x2397ed['options']);return db[_0xa483('0x31')]['find'](_0x47a9a4)[_0xa483('0x26')](handleEntityNotFound(_0x25f9b3,null))[_0xa483('0x26')](respondWithResult(_0x25f9b3,null))['catch'](handleError(_0x25f9b3,null));};exports['create']=function(_0x578a3c,_0x4b074f){return db[_0xa483('0x31')]['create'](_0x578a3c[_0xa483('0x4e')],{})[_0xa483('0x26')](function(_0x1a9b94){var _0x3a4e24=_0x578a3c[_0xa483('0x4f')][_0xa483('0x28')]({'plain':!![]});if(!_0x3a4e24)throw new Error(_0xa483('0x50'));if(_0x3a4e24[_0xa483('0x51')]===_0xa483('0x4f')){var _0x6f2918=_0x1a9b94[_0xa483('0x28')]({'plain':!![]});var _0xf45f9b=_0xa483('0x29');return db[_0xa483('0x52')][_0xa483('0x53')]({'where':{'name':_0xf45f9b,'userProfileId':_0x3a4e24[_0xa483('0x54')]},'raw':!![]})[_0xa483('0x26')](function(_0x265cfa){if(_0x265cfa&&_0x265cfa['autoAssociation']===0x0){return db['UserProfileResource'][_0xa483('0x55')]({'name':_0x6f2918[_0xa483('0x2d')],'resourceId':_0x6f2918['id'],'type':_0x265cfa[_0xa483('0x2d')],'sectionId':_0x265cfa['id']},{})[_0xa483('0x26')](function(){return _0x1a9b94;});}else{return _0x1a9b94;}})[_0xa483('0x4a')](function(_0x544a24){logger[_0xa483('0x2b')](_0xa483('0x56'),_0x544a24);throw _0x544a24;});}return _0x1a9b94;})[_0xa483('0x26')](respondWithResult(_0x4b074f,0xc9))[_0xa483('0x4a')](handleError(_0x4b074f,null));};exports[_0xa483('0x25')]=function(_0x2ea8c1,_0x19a27a){if(_0x2ea8c1['body']['id']){delete _0x2ea8c1['body']['id'];}return db[_0xa483('0x31')]['find']({'where':{'id':_0x2ea8c1[_0xa483('0x4c')]['id']}})[_0xa483('0x26')](handleEntityNotFound(_0x19a27a,null))[_0xa483('0x26')](saveUpdates(_0x2ea8c1[_0xa483('0x4e')],null))[_0xa483('0x26')](respondWithResult(_0x19a27a,null))[_0xa483('0x4a')](handleError(_0x19a27a,null));};exports['destroy']=function(_0x31e390,_0x2865a9){return db[_0xa483('0x31')][_0xa483('0x53')]({'where':{'id':_0x31e390[_0xa483('0x4c')]['id']}})['then'](handleEntityNotFound(_0x2865a9,null))['then'](removeEntity(_0x2865a9,null))[_0xa483('0x4a')](handleError(_0x2865a9,null));}; \ No newline at end of file +var _0x7e1e=['filters','filter','merge','VIRTUAL','options','includeAll','rows','catch','show','params','rawAttributes','include','find','create','body','user','CmContactHasItems','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','to-csv','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','end','count','offset','limit','Content-Range','json','apply','reject','save','update','destroy','then','get','UserProfileResource','error','name','index','map','CmContactHasItem','fieldName','type','model','query','keys','intersection','fields','attributes','length','hasOwnProperty','order','sort','where','pick'];(function(_0x1b72a6,_0x41b8f7){var _0x3208fa=function(_0xb218b1){while(--_0xb218b1){_0x1b72a6['push'](_0x1b72a6['shift']());}};_0x3208fa(++_0x41b8f7);}(_0x7e1e,0x147));var _0xe7e1=function(_0x37f11e,_0x19e262){_0x37f11e=_0x37f11e-0x0;var _0x2c5d8a=_0x7e1e[_0x37f11e];return _0x2c5d8a;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xe7e1('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xe7e1('0x1'));var jsonpatch=require(_0xe7e1('0x2'));var rp=require(_0xe7e1('0x3'));var moment=require('moment');var BPromise=require(_0xe7e1('0x4'));var Mustache=require(_0xe7e1('0x5'));var util=require(_0xe7e1('0x6'));var path=require(_0xe7e1('0x7'));var sox=require('sox');var csv=require(_0xe7e1('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xe7e1('0x9'));var squel=require('squel');var crypto=require(_0xe7e1('0xa'));var jsforce=require(_0xe7e1('0xb'));var deskjs=require(_0xe7e1('0xc'));var toCsv=require(_0xe7e1('0x8'));var querystring=require(_0xe7e1('0xd'));var Papa=require(_0xe7e1('0xe'));var Redis=require(_0xe7e1('0xf'));var authService=require(_0xe7e1('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0xe7e1('0x11'));var hardwareService=require(_0xe7e1('0x12'));var logger=require(_0xe7e1('0x13'))(_0xe7e1('0x14'));var utils=require('../../config/utils');var config=require(_0xe7e1('0x15'));var db=require(_0xe7e1('0x16'))['db'];function respondWithStatusCode(_0x1c362e,_0x2b529c){_0x2b529c=_0x2b529c||0xcc;return function(_0x4e108a){if(_0x4e108a){return _0x1c362e[_0xe7e1('0x17')](_0x2b529c);}return _0x1c362e[_0xe7e1('0x18')](_0x2b529c)[_0xe7e1('0x19')]();};}function respondWithResult(_0x1e2fdc,_0x2df967){_0x2df967=_0x2df967||0xc8;return function(_0x1e993f){if(_0x1e993f){return _0x1e2fdc[_0xe7e1('0x18')](_0x2df967)['json'](_0x1e993f);}};}function respondWithFilteredResult(_0x484bfa,_0x294ccf){return function(_0x3df224){if(_0x3df224){var _0x416258=_0x3df224[_0xe7e1('0x1a')],_0xddf9e0=_0x294ccf[_0xe7e1('0x1b')],_0x15fc5e=_0x294ccf[_0xe7e1('0x1b')]+_0x294ccf[_0xe7e1('0x1c')],_0x3c5178;if(_0x15fc5e>=_0x416258){_0x15fc5e=_0x416258;_0x3c5178=0xc8;}else{_0x3c5178=0xce;}_0x484bfa[_0xe7e1('0x18')](_0x3c5178);return _0x484bfa['set'](_0xe7e1('0x1d'),_0xddf9e0+'-'+_0x15fc5e+'/'+_0x416258)[_0xe7e1('0x1e')](_0x3df224);}return null;};}function patchUpdates(_0x4df349){return function(_0x168dfa){try{jsonpatch[_0xe7e1('0x1f')](_0x168dfa,_0x4df349,!![]);}catch(_0x1ebf7d){return BPromise[_0xe7e1('0x20')](_0x1ebf7d);}return _0x168dfa[_0xe7e1('0x21')]();};}function saveUpdates(_0x52b613,_0x57e32e){return function(_0x105b4f){if(_0x105b4f){return _0x105b4f[_0xe7e1('0x22')](_0x52b613)['then'](function(_0x202df0){return _0x202df0;});}return null;};}function removeEntity(_0x1f4639,_0x109db6){return function(_0x5baa24){if(_0x5baa24){return _0x5baa24[_0xe7e1('0x23')]()[_0xe7e1('0x24')](function(){var _0xa8e4e8=_0x5baa24[_0xe7e1('0x25')]({'plain':!![]});var _0x4576c0='CmContactHasItems';return db[_0xe7e1('0x26')][_0xe7e1('0x23')]({'where':{'type':_0x4576c0,'resourceId':_0xa8e4e8['id']}})['then'](function(){return _0x5baa24;});})[_0xe7e1('0x24')](function(){_0x1f4639[_0xe7e1('0x18')](0xcc)[_0xe7e1('0x19')]();});}};}function handleEntityNotFound(_0x281494,_0x433ce0){return function(_0x2f89e8){if(!_0x2f89e8){_0x281494['sendStatus'](0x194);}return _0x2f89e8;};}function handleError(_0x26db90,_0x3690ab){_0x3690ab=_0x3690ab||0x1f4;return function(_0x10962e){logger[_0xe7e1('0x27')](_0x10962e['stack']);if(_0x10962e['name']){delete _0x10962e[_0xe7e1('0x28')];}_0x26db90[_0xe7e1('0x18')](_0x3690ab)['send'](_0x10962e);};}exports[_0xe7e1('0x29')]=function(_0x3c06a6,_0x1e42c2){var _0xa09331={},_0x37deb7={},_0x2b136f={'count':0x0,'rows':[]};var _0xdaac25=_[_0xe7e1('0x2a')](db[_0xe7e1('0x2b')]['rawAttributes'],function(_0x801ab5){return{'name':_0x801ab5[_0xe7e1('0x2c')],'type':_0x801ab5[_0xe7e1('0x2d')]['key']};});_0x37deb7[_0xe7e1('0x2e')]=_['map'](_0xdaac25,'name');_0x37deb7[_0xe7e1('0x2f')]=_[_0xe7e1('0x30')](_0x3c06a6['query']);_0x37deb7['filters']=_[_0xe7e1('0x31')](_0x37deb7['model'],_0x37deb7[_0xe7e1('0x2f')]);_0xa09331['attributes']=_[_0xe7e1('0x31')](_0x37deb7['model'],qs[_0xe7e1('0x32')](_0x3c06a6[_0xe7e1('0x2f')][_0xe7e1('0x32')]));_0xa09331[_0xe7e1('0x33')]=_0xa09331[_0xe7e1('0x33')][_0xe7e1('0x34')]?_0xa09331['attributes']:_0x37deb7[_0xe7e1('0x2e')];if(!_0x3c06a6[_0xe7e1('0x2f')][_0xe7e1('0x35')]('nolimit')){_0xa09331[_0xe7e1('0x1c')]=qs['limit'](_0x3c06a6[_0xe7e1('0x2f')][_0xe7e1('0x1c')]);_0xa09331[_0xe7e1('0x1b')]=qs[_0xe7e1('0x1b')](_0x3c06a6[_0xe7e1('0x2f')]['offset']);}_0xa09331[_0xe7e1('0x36')]=qs[_0xe7e1('0x37')](_0x3c06a6['query'][_0xe7e1('0x37')]);_0xa09331[_0xe7e1('0x38')]=qs['filters'](_[_0xe7e1('0x39')](_0x3c06a6['query'],_0x37deb7[_0xe7e1('0x3a')]),_0xdaac25);if(_0x3c06a6['query'][_0xe7e1('0x3b')]){_0xa09331[_0xe7e1('0x38')]=_[_0xe7e1('0x3c')](_0xa09331[_0xe7e1('0x38')],{'$or':_[_0xe7e1('0x2a')](_0xdaac25,function(_0x4ed0a9){if(_0x4ed0a9[_0xe7e1('0x2d')]!==_0xe7e1('0x3d')){var _0xca996d={};_0xca996d[_0x4ed0a9[_0xe7e1('0x28')]]={'$like':'%'+_0x3c06a6['query']['filter']+'%'};return _0xca996d;}})});}_0xa09331=_['merge']({},_0xa09331,_0x3c06a6[_0xe7e1('0x3e')]);var _0x843ccb={'where':_0xa09331[_0xe7e1('0x38')]};return db[_0xe7e1('0x2b')][_0xe7e1('0x1a')](_0x843ccb)[_0xe7e1('0x24')](function(_0x3c396e){_0x2b136f['count']=_0x3c396e;if(_0x3c06a6[_0xe7e1('0x2f')][_0xe7e1('0x3f')]){_0xa09331['include']=[{'all':!![]}];}return db[_0xe7e1('0x2b')]['findAll'](_0xa09331);})[_0xe7e1('0x24')](function(_0x484dcf){_0x2b136f[_0xe7e1('0x40')]=_0x484dcf;return _0x2b136f;})[_0xe7e1('0x24')](respondWithFilteredResult(_0x1e42c2,_0xa09331))[_0xe7e1('0x41')](handleError(_0x1e42c2,null));};exports[_0xe7e1('0x42')]=function(_0x4a58ec,_0x2d05b0){var _0x7f8019={'raw':!![],'where':{'id':_0x4a58ec[_0xe7e1('0x43')]['id']}},_0xf24532={};_0xf24532['model']=_[_0xe7e1('0x30')](db['CmContactHasItem'][_0xe7e1('0x44')]);_0xf24532[_0xe7e1('0x2f')]=_[_0xe7e1('0x30')](_0x4a58ec[_0xe7e1('0x2f')]);_0xf24532[_0xe7e1('0x3a')]=_[_0xe7e1('0x31')](_0xf24532[_0xe7e1('0x2e')],_0xf24532[_0xe7e1('0x2f')]);_0x7f8019[_0xe7e1('0x33')]=_[_0xe7e1('0x31')](_0xf24532['model'],qs[_0xe7e1('0x32')](_0x4a58ec[_0xe7e1('0x2f')][_0xe7e1('0x32')]));_0x7f8019[_0xe7e1('0x33')]=_0x7f8019['attributes'][_0xe7e1('0x34')]?_0x7f8019[_0xe7e1('0x33')]:_0xf24532['model'];if(_0x4a58ec['query']['includeAll']){_0x7f8019[_0xe7e1('0x45')]=[{'all':!![]}];}_0x7f8019=_[_0xe7e1('0x3c')]({},_0x7f8019,_0x4a58ec[_0xe7e1('0x3e')]);return db[_0xe7e1('0x2b')][_0xe7e1('0x46')](_0x7f8019)[_0xe7e1('0x24')](handleEntityNotFound(_0x2d05b0,null))[_0xe7e1('0x24')](respondWithResult(_0x2d05b0,null))[_0xe7e1('0x41')](handleError(_0x2d05b0,null));};exports[_0xe7e1('0x47')]=function(_0xe481f0,_0x36ccea){return db[_0xe7e1('0x2b')][_0xe7e1('0x47')](_0xe481f0[_0xe7e1('0x48')],{})[_0xe7e1('0x24')](function(_0x4d7a25){var _0x5330a8=_0xe481f0[_0xe7e1('0x49')][_0xe7e1('0x25')]({'plain':!![]});if(!_0x5330a8)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x5330a8['role']===_0xe7e1('0x49')){var _0x1c250d=_0x4d7a25[_0xe7e1('0x25')]({'plain':!![]});var _0x3056a1=_0xe7e1('0x4a');return db['UserProfileSection'][_0xe7e1('0x46')]({'where':{'name':_0x3056a1,'userProfileId':_0x5330a8['userProfileId']},'raw':!![]})[_0xe7e1('0x24')](function(_0x433756){if(_0x433756&&_0x433756[_0xe7e1('0x4b')]===0x0){return db['UserProfileResource'][_0xe7e1('0x47')]({'name':_0x1c250d[_0xe7e1('0x28')],'resourceId':_0x1c250d['id'],'type':_0x433756[_0xe7e1('0x28')],'sectionId':_0x433756['id']},{})[_0xe7e1('0x24')](function(){return _0x4d7a25;});}else{return _0x4d7a25;}})[_0xe7e1('0x41')](function(_0x35fa7f){logger[_0xe7e1('0x27')](_0xe7e1('0x4c'),_0x35fa7f);throw _0x35fa7f;});}return _0x4d7a25;})[_0xe7e1('0x24')](respondWithResult(_0x36ccea,0xc9))[_0xe7e1('0x41')](handleError(_0x36ccea,null));};exports[_0xe7e1('0x22')]=function(_0x141022,_0x338c67){if(_0x141022['body']['id']){delete _0x141022[_0xe7e1('0x48')]['id'];}return db[_0xe7e1('0x2b')][_0xe7e1('0x46')]({'where':{'id':_0x141022[_0xe7e1('0x43')]['id']}})['then'](handleEntityNotFound(_0x338c67,null))[_0xe7e1('0x24')](saveUpdates(_0x141022[_0xe7e1('0x48')],null))['then'](respondWithResult(_0x338c67,null))[_0xe7e1('0x41')](handleError(_0x338c67,null));};exports[_0xe7e1('0x23')]=function(_0x4f357c,_0x378279){return db[_0xe7e1('0x2b')][_0xe7e1('0x46')]({'where':{'id':_0x4f357c[_0xe7e1('0x43')]['id']}})[_0xe7e1('0x24')](handleEntityNotFound(_0x378279,null))[_0xe7e1('0x24')](removeEntity(_0x378279,null))[_0xe7e1('0x41')](handleError(_0x378279,null));}; \ No newline at end of file diff --git a/server/api/cmContactHasItem/cmContactHasItem.model.js b/server/api/cmContactHasItem/cmContactHasItem.model.js index d58f292..8f5e492 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 _0x1db9=['CmContactHasItem','cm_contact_has_items','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','exports','define'];(function(_0x26f03d,_0x4866c2){var _0x42dc9f=function(_0x110528){while(--_0x110528){_0x26f03d['push'](_0x26f03d['shift']());}};_0x42dc9f(++_0x4866c2);}(_0x1db9,0x176));var _0x91db=function(_0x21f83a,_0x156c7d){_0x21f83a=_0x21f83a-0x0;var _0x44cc7e=_0x1db9[_0x21f83a];return _0x44cc7e;};'use strict';var _=require(_0x91db('0x0'));var util=require(_0x91db('0x1'));var logger=require(_0x91db('0x2'))(_0x91db('0x3'));var moment=require(_0x91db('0x4'));var BPromise=require(_0x91db('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x91db('0x6'));var rimraf=require(_0x91db('0x7'));var config=require('../../config/environment');var attributes=require('./cmContactHasItem.attributes');module[_0x91db('0x8')]=function(_0x4b3f5c,_0x5e69d9){return _0x4b3f5c[_0x91db('0x9')](_0x91db('0xa'),attributes,{'tableName':_0x91db('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0309=['rimraf','../../config/environment','./cmContactHasItem.attributes','define','cm_contact_has_items','lodash','../../config/logger','moment','bluebird','request-promise','path'];(function(_0x9cd4c3,_0x1c9b2c){var _0x4c9025=function(_0x25b3c6){while(--_0x25b3c6){_0x9cd4c3['push'](_0x9cd4c3['shift']());}};_0x4c9025(++_0x1c9b2c);}(_0x0309,0x165));var _0x9030=function(_0x1f72be,_0x44647e){_0x1f72be=_0x1f72be-0x0;var _0x289390=_0x0309[_0x1f72be];return _0x289390;};'use strict';var _=require(_0x9030('0x0'));var util=require('util');var logger=require(_0x9030('0x1'))('api');var moment=require(_0x9030('0x2'));var BPromise=require(_0x9030('0x3'));var rp=require(_0x9030('0x4'));var fs=require('fs');var path=require(_0x9030('0x5'));var rimraf=require(_0x9030('0x6'));var config=require(_0x9030('0x7'));var attributes=require(_0x9030('0x8'));module['exports']=function(_0x5a3334,_0x1c9c7b){return _0x5a3334[_0x9030('0x9')]('CmContactHasItem',attributes,{'tableName':_0x9030('0xa'),'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 c6ec54f..fb27381 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 _0xe826=['moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','CmContactHasItem,\x20%s,\x20%s','request\x20sent','debug','CmContactHasItem,\x20%s,\x20%s,\x20%s','error','message','result','lodash','util'];(function(_0xb9580,_0x441821){var _0x532515=function(_0x32ef38){while(--_0x32ef38){_0xb9580['push'](_0xb9580['shift']());}};_0x532515(++_0x441821);}(_0xe826,0x14e));var _0x6e82=function(_0x4331f8,_0xe06640){_0x4331f8=_0x4331f8-0x0;var _0x44a1a5=_0xe826[_0x4331f8];return _0x44a1a5;};'use strict';var _=require(_0x6e82('0x0'));var util=require(_0x6e82('0x1'));var moment=require(_0x6e82('0x2'));var BPromise=require('bluebird');var rs=require(_0x6e82('0x3'));var fs=require('fs');var Redis=require(_0x6e82('0x4'));var db=require(_0x6e82('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x6e82('0x6'))(_0x6e82('0x7'));var config=require(_0x6e82('0x8'));var jayson=require(_0x6e82('0x9'));var client=jayson[_0x6e82('0xa')][_0x6e82('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x14df8f,_0x30d952,_0x41e9b0){return new BPromise(function(_0x3ebce2,_0x18c7d2){return client['request'](_0x14df8f,_0x41e9b0)[_0x6e82('0xc')](function(_0x1fc4d2){logger[_0x6e82('0xd')](_0x6e82('0xe'),_0x30d952,_0x6e82('0xf'));logger[_0x6e82('0x10')](_0x6e82('0x11'),_0x30d952,_0x6e82('0xf'),JSON['stringify'](_0x1fc4d2));if(_0x1fc4d2[_0x6e82('0x12')]){if(_0x1fc4d2[_0x6e82('0x12')]['code']===0x1f4){logger[_0x6e82('0x12')](_0x6e82('0xe'),_0x30d952,_0x1fc4d2[_0x6e82('0x12')]['message']);return _0x18c7d2(_0x1fc4d2[_0x6e82('0x12')][_0x6e82('0x13')]);}logger[_0x6e82('0x12')](_0x6e82('0xe'),_0x30d952,_0x1fc4d2['error'][_0x6e82('0x13')]);return _0x3ebce2(_0x1fc4d2['error'][_0x6e82('0x13')]);}else{logger['info'](_0x6e82('0xe'),_0x30d952,_0x6e82('0xf'));_0x3ebce2(_0x1fc4d2[_0x6e82('0x14')]['message']);}})['catch'](function(_0x4c1f9a){logger[_0x6e82('0x12')](_0x6e82('0xe'),_0x30d952,_0x4c1f9a);_0x18c7d2(_0x4c1f9a);});});} \ No newline at end of file +var _0xf6be=['request\x20sent','debug','CmContactHasItem,\x20%s,\x20%s,\x20%s','error','CmContactHasItem,\x20%s,\x20%s','message','result','catch','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','request','then'];(function(_0x34f2a4,_0x5bb81d){var _0x4aa1f2=function(_0x1c4a45){while(--_0x1c4a45){_0x34f2a4['push'](_0x34f2a4['shift']());}};_0x4aa1f2(++_0x5bb81d);}(_0xf6be,0x80));var _0xef6b=function(_0x45ae0d,_0x1ea3b9){_0x45ae0d=_0x45ae0d-0x0;var _0x371826=_0xf6be[_0x45ae0d];return _0x371826;};'use strict';var _=require(_0xef6b('0x0'));var util=require('util');var moment=require(_0xef6b('0x1'));var BPromise=require('bluebird');var rs=require(_0xef6b('0x2'));var fs=require('fs');var Redis=require(_0xef6b('0x3'));var db=require(_0xef6b('0x4'))['db'];var utils=require(_0xef6b('0x5'));var logger=require(_0xef6b('0x6'))(_0xef6b('0x7'));var config=require(_0xef6b('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xef6b('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x11d0ab,_0x3c14f3,_0x36eac5){return new BPromise(function(_0x21dca0,_0x53aa82){return client[_0xef6b('0xa')](_0x11d0ab,_0x36eac5)[_0xef6b('0xb')](function(_0x310d77){logger['info']('CmContactHasItem,\x20%s,\x20%s',_0x3c14f3,_0xef6b('0xc'));logger[_0xef6b('0xd')](_0xef6b('0xe'),_0x3c14f3,_0xef6b('0xc'),JSON['stringify'](_0x310d77));if(_0x310d77[_0xef6b('0xf')]){if(_0x310d77['error']['code']===0x1f4){logger[_0xef6b('0xf')](_0xef6b('0x10'),_0x3c14f3,_0x310d77[_0xef6b('0xf')]['message']);return _0x53aa82(_0x310d77[_0xef6b('0xf')][_0xef6b('0x11')]);}logger['error'](_0xef6b('0x10'),_0x3c14f3,_0x310d77[_0xef6b('0xf')][_0xef6b('0x11')]);return _0x21dca0(_0x310d77[_0xef6b('0xf')][_0xef6b('0x11')]);}else{logger['info'](_0xef6b('0x10'),_0x3c14f3,_0xef6b('0xc'));_0x21dca0(_0x310d77[_0xef6b('0x12')]['message']);}})[_0xef6b('0x13')](function(_0x331442){logger[_0xef6b('0xf')]('CmContactHasItem,\x20%s,\x20%s',_0x3c14f3,_0x331442);_0x53aa82(_0x331442);});});} \ No newline at end of file diff --git a/server/api/cmContactHasItem/index.js b/server/api/cmContactHasItem/index.js index 7000924..225ec51 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 _0x7416=['update','delete','destroy','exports','multer','util','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','./cmContactHasItem.controller','get','index','/:id','isAuthenticated','show','post','put'];(function(_0x131b26,_0x20b4ad){var _0x513652=function(_0x15badc){while(--_0x15badc){_0x131b26['push'](_0x131b26['shift']());}};_0x513652(++_0x20b4ad);}(_0x7416,0x94));var _0x6741=function(_0x1b7ea6,_0x195a62){_0x1b7ea6=_0x1b7ea6-0x0;var _0x4fcea6=_0x7416[_0x1b7ea6];return _0x4fcea6;};'use strict';var multer=require(_0x6741('0x0'));var util=require(_0x6741('0x1'));var path=require('path');var timeout=require(_0x6741('0x2'));var express=require('express');var router=express[_0x6741('0x3')]();var auth=require(_0x6741('0x4'));var interaction=require(_0x6741('0x5'));var config=require('../../config/environment');var controller=require(_0x6741('0x6'));router[_0x6741('0x7')]('/',auth['isAuthenticated'](),controller[_0x6741('0x8')]);router[_0x6741('0x7')](_0x6741('0x9'),auth[_0x6741('0xa')](),controller[_0x6741('0xb')]);router[_0x6741('0xc')]('/',auth[_0x6741('0xa')](),controller['create']);router[_0x6741('0xd')]('/:id',auth['isAuthenticated'](),controller[_0x6741('0xe')]);router[_0x6741('0xf')](_0x6741('0x9'),auth[_0x6741('0xa')](),controller[_0x6741('0x10')]);module[_0x6741('0x11')]=router; \ No newline at end of file +var _0x23ae=['update','destroy','exports','path','connect-timeout','Router','../../components/auth/service','../../config/environment','./cmContactHasItem.controller','get','isAuthenticated','/:id','show','create','put'];(function(_0x320d0a,_0x13cdf3){var _0x431c97=function(_0x52df40){while(--_0x52df40){_0x320d0a['push'](_0x320d0a['shift']());}};_0x431c97(++_0x13cdf3);}(_0x23ae,0x1b6));var _0xe23a=function(_0xadc7d9,_0x203608){_0xadc7d9=_0xadc7d9-0x0;var _0x915ca1=_0x23ae[_0xadc7d9];return _0x915ca1;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xe23a('0x0'));var timeout=require(_0xe23a('0x1'));var express=require('express');var router=express[_0xe23a('0x2')]();var auth=require(_0xe23a('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0xe23a('0x4'));var controller=require(_0xe23a('0x5'));router[_0xe23a('0x6')]('/',auth[_0xe23a('0x7')](),controller['index']);router[_0xe23a('0x6')](_0xe23a('0x8'),auth[_0xe23a('0x7')](),controller[_0xe23a('0x9')]);router['post']('/',auth[_0xe23a('0x7')](),controller[_0xe23a('0xa')]);router[_0xe23a('0xb')](_0xe23a('0x8'),auth[_0xe23a('0x7')](),controller[_0xe23a('0xc')]);router['delete'](_0xe23a('0x8'),auth[_0xe23a('0x7')](),controller[_0xe23a('0xd')]);module[_0xe23a('0xe')]=router; \ No newline at end of file diff --git a/server/api/cmContactHasPhone/cmContactHasPhone.attributes.js b/server/api/cmContactHasPhone/cmContactHasPhone.attributes.js index f07f5bb..9562a53 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 _0xa8a6=['INTEGER','STRING','sequelize','exports'];(function(_0x3855fc,_0x57685d){var _0x416286=function(_0x5d9b46){while(--_0x5d9b46){_0x3855fc['push'](_0x3855fc['shift']());}};_0x416286(++_0x57685d);}(_0xa8a6,0x102));var _0x6a8a=function(_0x26f300,_0x3115c0){_0x26f300=_0x26f300-0x0;var _0x53bf7c=_0xa8a6[_0x26f300];return _0x53bf7c;};'use strict';var Sequelize=require(_0x6a8a('0x0'));module[_0x6a8a('0x1')]={'CmContactId':{'type':Sequelize[_0x6a8a('0x2')],'primaryKey':!![]},'phone':{'type':Sequelize[_0x6a8a('0x3')],'defaultValue':'','primaryKey':!![]}}; \ No newline at end of file +var _0xbd4a=['exports','STRING','sequelize'];(function(_0x3ccdf8,_0x584ceb){var _0x243dab=function(_0x1a90d1){while(--_0x1a90d1){_0x3ccdf8['push'](_0x3ccdf8['shift']());}};_0x243dab(++_0x584ceb);}(_0xbd4a,0xbf));var _0xabd4=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xbd4a[_0x122ef9];return _0x42fba0;};'use strict';var Sequelize=require(_0xabd4('0x0'));module[_0xabd4('0x1')]={'CmContactId':{'type':Sequelize['INTEGER'],'primaryKey':!![]},'phone':{'type':Sequelize[_0xabd4('0x2')],'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 e74717d..aac11fe 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 _0x08d1=['stack','name','send','index','CmContactHasPhone','rawAttributes','type','key','model','keys','filters','intersection','query','attributes','fields','length','nolimit','order','sort','pick','where','merge','VIRTUAL','filter','count','include','rows','catch','params','includeAll','find','create','body','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','autoAssociation','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','path','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','end','offset','limit','Content-Range','update','destroy','then','CmContactHasPhones','UserProfileResource','error'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x08d1,0x112));var _0x108d=function(_0x38907b,_0x352cab){_0x38907b=_0x38907b-0x0;var _0xa64806=_0x08d1[_0x38907b];return _0xa64806;};'use strict';var pdf=require(_0x108d('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x108d('0x1'));var zipdir=require(_0x108d('0x2'));var jsonpatch=require(_0x108d('0x3'));var rp=require(_0x108d('0x4'));var moment=require(_0x108d('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x108d('0x6'));var util=require('util');var path=require(_0x108d('0x7'));var sox=require(_0x108d('0x8'));var csv=require(_0x108d('0x9'));var ejs=require(_0x108d('0xa'));var fs=require('fs');var _=require('lodash');var squel=require(_0x108d('0xb'));var crypto=require(_0x108d('0xc'));var jsforce=require(_0x108d('0xd'));var deskjs=require(_0x108d('0xe'));var toCsv=require(_0x108d('0x9'));var querystring=require(_0x108d('0xf'));var Papa=require(_0x108d('0x10'));var Redis=require(_0x108d('0x11'));var authService=require(_0x108d('0x12'));var qs=require(_0x108d('0x13'));var as=require(_0x108d('0x14'));var hardwareService=require(_0x108d('0x15'));var logger=require(_0x108d('0x16'))(_0x108d('0x17'));var utils=require(_0x108d('0x18'));var config=require('../../config/environment');var db=require(_0x108d('0x19'))['db'];function respondWithStatusCode(_0x411d8a,_0x23aac5){_0x23aac5=_0x23aac5||0xcc;return function(_0x530525){if(_0x530525){return _0x411d8a[_0x108d('0x1a')](_0x23aac5);}return _0x411d8a[_0x108d('0x1b')](_0x23aac5)[_0x108d('0x1c')]();};}function respondWithResult(_0x5167ab,_0x2c5a57){_0x2c5a57=_0x2c5a57||0xc8;return function(_0xdbc535){if(_0xdbc535){return _0x5167ab['status'](_0x2c5a57)['json'](_0xdbc535);}};}function respondWithFilteredResult(_0x35ebfd,_0x32f753){return function(_0x4f5d05){if(_0x4f5d05){var _0x4529aa=_0x4f5d05['count'],_0x28e404=_0x32f753[_0x108d('0x1d')],_0x2e2fa3=_0x32f753['offset']+_0x32f753[_0x108d('0x1e')],_0x52f281;if(_0x2e2fa3>=_0x4529aa){_0x2e2fa3=_0x4529aa;_0x52f281=0xc8;}else{_0x52f281=0xce;}_0x35ebfd['status'](_0x52f281);return _0x35ebfd['set'](_0x108d('0x1f'),_0x28e404+'-'+_0x2e2fa3+'/'+_0x4529aa)['json'](_0x4f5d05);}return null;};}function patchUpdates(_0x333f69){return function(_0x36717d){try{jsonpatch['apply'](_0x36717d,_0x333f69,!![]);}catch(_0x1f1d8e){return BPromise['reject'](_0x1f1d8e);}return _0x36717d['save']();};}function saveUpdates(_0xb2664c,_0x4bf3cc){return function(_0x589e0f){if(_0x589e0f){return _0x589e0f[_0x108d('0x20')](_0xb2664c)['then'](function(_0x349547){return _0x349547;});}return null;};}function removeEntity(_0x5b3d84,_0x2a7872){return function(_0x3fa2da){if(_0x3fa2da){return _0x3fa2da[_0x108d('0x21')]()[_0x108d('0x22')](function(){var _0x2db9b4=_0x3fa2da['get']({'plain':!![]});var _0x2142ae=_0x108d('0x23');return db[_0x108d('0x24')][_0x108d('0x21')]({'where':{'type':_0x2142ae,'resourceId':_0x2db9b4['id']}})[_0x108d('0x22')](function(){return _0x3fa2da;});})['then'](function(){_0x5b3d84[_0x108d('0x1b')](0xcc)[_0x108d('0x1c')]();});}};}function handleEntityNotFound(_0x4b549c,_0x591e10){return function(_0x8b5297){if(!_0x8b5297){_0x4b549c[_0x108d('0x1a')](0x194);}return _0x8b5297;};}function handleError(_0x12ceec,_0x30ad47){_0x30ad47=_0x30ad47||0x1f4;return function(_0x3a61d7){logger[_0x108d('0x25')](_0x3a61d7[_0x108d('0x26')]);if(_0x3a61d7[_0x108d('0x27')]){delete _0x3a61d7['name'];}_0x12ceec[_0x108d('0x1b')](_0x30ad47)[_0x108d('0x28')](_0x3a61d7);};}exports[_0x108d('0x29')]=function(_0x42d732,_0x125133){var _0x853011={},_0x29f657={},_0x141fd4={'count':0x0,'rows':[]};var _0x33af8e=_['map'](db[_0x108d('0x2a')][_0x108d('0x2b')],function(_0x5074f2){return{'name':_0x5074f2['fieldName'],'type':_0x5074f2[_0x108d('0x2c')][_0x108d('0x2d')]};});_0x29f657[_0x108d('0x2e')]=_['map'](_0x33af8e,_0x108d('0x27'));_0x29f657['query']=_[_0x108d('0x2f')](_0x42d732['query']);_0x29f657[_0x108d('0x30')]=_[_0x108d('0x31')](_0x29f657[_0x108d('0x2e')],_0x29f657[_0x108d('0x32')]);_0x853011[_0x108d('0x33')]=_[_0x108d('0x31')](_0x29f657[_0x108d('0x2e')],qs[_0x108d('0x34')](_0x42d732[_0x108d('0x32')][_0x108d('0x34')]));_0x853011[_0x108d('0x33')]=_0x853011[_0x108d('0x33')][_0x108d('0x35')]?_0x853011[_0x108d('0x33')]:_0x29f657[_0x108d('0x2e')];if(!_0x42d732[_0x108d('0x32')]['hasOwnProperty'](_0x108d('0x36'))){_0x853011[_0x108d('0x1e')]=qs['limit'](_0x42d732[_0x108d('0x32')][_0x108d('0x1e')]);_0x853011[_0x108d('0x1d')]=qs[_0x108d('0x1d')](_0x42d732[_0x108d('0x32')][_0x108d('0x1d')]);}_0x853011[_0x108d('0x37')]=qs['sort'](_0x42d732[_0x108d('0x32')][_0x108d('0x38')]);_0x853011['where']=qs[_0x108d('0x30')](_[_0x108d('0x39')](_0x42d732[_0x108d('0x32')],_0x29f657[_0x108d('0x30')]),_0x33af8e);if(_0x42d732['query']['filter']){_0x853011[_0x108d('0x3a')]=_[_0x108d('0x3b')](_0x853011[_0x108d('0x3a')],{'$or':_['map'](_0x33af8e,function(_0x4868a3){if(_0x4868a3[_0x108d('0x2c')]!==_0x108d('0x3c')){var _0x7d01a4={};_0x7d01a4[_0x4868a3[_0x108d('0x27')]]={'$like':'%'+_0x42d732[_0x108d('0x32')][_0x108d('0x3d')]+'%'};return _0x7d01a4;}})});}_0x853011=_[_0x108d('0x3b')]({},_0x853011,_0x42d732['options']);var _0x547ce2={'where':_0x853011[_0x108d('0x3a')]};return db['CmContactHasPhone'][_0x108d('0x3e')](_0x547ce2)[_0x108d('0x22')](function(_0x5460b7){_0x141fd4[_0x108d('0x3e')]=_0x5460b7;if(_0x42d732['query']['includeAll']){_0x853011[_0x108d('0x3f')]=[{'all':!![]}];}return db[_0x108d('0x2a')]['findAll'](_0x853011);})[_0x108d('0x22')](function(_0x34bed0){_0x141fd4[_0x108d('0x40')]=_0x34bed0;return _0x141fd4;})[_0x108d('0x22')](respondWithFilteredResult(_0x125133,_0x853011))[_0x108d('0x41')](handleError(_0x125133,null));};exports['show']=function(_0x4e7623,_0x2d3d1d){var _0x354eab={'raw':!![],'where':{'id':_0x4e7623[_0x108d('0x42')]['id']}},_0xfcf283={};_0xfcf283[_0x108d('0x2e')]=_[_0x108d('0x2f')](db[_0x108d('0x2a')][_0x108d('0x2b')]);_0xfcf283[_0x108d('0x32')]=_[_0x108d('0x2f')](_0x4e7623[_0x108d('0x32')]);_0xfcf283[_0x108d('0x30')]=_[_0x108d('0x31')](_0xfcf283['model'],_0xfcf283[_0x108d('0x32')]);_0x354eab[_0x108d('0x33')]=_[_0x108d('0x31')](_0xfcf283[_0x108d('0x2e')],qs[_0x108d('0x34')](_0x4e7623['query'][_0x108d('0x34')]));_0x354eab['attributes']=_0x354eab[_0x108d('0x33')]['length']?_0x354eab['attributes']:_0xfcf283[_0x108d('0x2e')];if(_0x4e7623[_0x108d('0x32')][_0x108d('0x43')]){_0x354eab[_0x108d('0x3f')]=[{'all':!![]}];}_0x354eab=_[_0x108d('0x3b')]({},_0x354eab,_0x4e7623['options']);return db[_0x108d('0x2a')][_0x108d('0x44')](_0x354eab)['then'](handleEntityNotFound(_0x2d3d1d,null))['then'](respondWithResult(_0x2d3d1d,null))['catch'](handleError(_0x2d3d1d,null));};exports['create']=function(_0x40d033,_0xd09acf){return db[_0x108d('0x2a')][_0x108d('0x45')](_0x40d033[_0x108d('0x46')],{})[_0x108d('0x22')](function(_0x4f403f){var _0x2f049a=_0x40d033['user'][_0x108d('0x47')]({'plain':!![]});if(!_0x2f049a)throw new Error(_0x108d('0x48'));if(_0x2f049a[_0x108d('0x49')]===_0x108d('0x4a')){var _0x4d3257=_0x4f403f[_0x108d('0x47')]({'plain':!![]});var _0x3f384d=_0x108d('0x23');return db[_0x108d('0x4b')][_0x108d('0x44')]({'where':{'name':_0x3f384d,'userProfileId':_0x2f049a[_0x108d('0x4c')]},'raw':!![]})[_0x108d('0x22')](function(_0x209ee0){if(_0x209ee0&&_0x209ee0[_0x108d('0x4d')]===0x0){return db[_0x108d('0x24')]['create']({'name':_0x4d3257[_0x108d('0x27')],'resourceId':_0x4d3257['id'],'type':_0x209ee0[_0x108d('0x27')],'sectionId':_0x209ee0['id']},{})[_0x108d('0x22')](function(){return _0x4f403f;});}else{return _0x4f403f;}})[_0x108d('0x41')](function(_0x4fb364){logger[_0x108d('0x25')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x4fb364);throw _0x4fb364;});}return _0x4f403f;})['then'](respondWithResult(_0xd09acf,0xc9))[_0x108d('0x41')](handleError(_0xd09acf,null));};exports[_0x108d('0x20')]=function(_0xcbd958,_0x4efb2f){if(_0xcbd958[_0x108d('0x46')]['id']){delete _0xcbd958['body']['id'];}return db[_0x108d('0x2a')][_0x108d('0x44')]({'where':{'id':_0xcbd958[_0x108d('0x42')]['id']}})[_0x108d('0x22')](handleEntityNotFound(_0x4efb2f,null))[_0x108d('0x22')](saveUpdates(_0xcbd958[_0x108d('0x46')],null))['then'](respondWithResult(_0x4efb2f,null))[_0x108d('0x41')](handleError(_0x4efb2f,null));};exports[_0x108d('0x21')]=function(_0xeb201f,_0x106d52){return db[_0x108d('0x2a')][_0x108d('0x44')]({'where':{'id':_0xeb201f[_0x108d('0x42')]['id']}})[_0x108d('0x22')](handleEntityNotFound(_0x106d52,null))[_0x108d('0x22')](removeEntity(_0x106d52,null))[_0x108d('0x41')](handleError(_0x106d52,null));}; \ No newline at end of file +var _0x89aa=['where','filters','merge','type','filter','includeAll','include','findAll','rows','catch','show','params','options','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','fast-json-patch','moment','mustache','util','path','sox','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/logger','../../config/environment','sendStatus','status','end','json','count','offset','limit','apply','reject','save','update','then','CmContactHasPhones','UserProfileResource','destroy','error','stack','name','send','index','map','CmContactHasPhone','rawAttributes','fieldName','query','keys','intersection','model','fields','attributes','length','sort'];(function(_0x218727,_0x5a4879){var _0x34537a=function(_0xbb3cb2){while(--_0xbb3cb2){_0x218727['push'](_0x218727['shift']());}};_0x34537a(++_0x5a4879);}(_0x89aa,0xec));var _0xa89a=function(_0x417081,_0x21e877){_0x417081=_0x417081-0x0;var _0x2204c7=_0x89aa[_0x417081];return _0x2204c7;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xa89a('0x0'));var rimraf=require(_0xa89a('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xa89a('0x2'));var rp=require('request-promise');var moment=require(_0xa89a('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xa89a('0x4'));var util=require(_0xa89a('0x5'));var path=require(_0xa89a('0x6'));var sox=require(_0xa89a('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xa89a('0x8'));var toCsv=require(_0xa89a('0x9'));var querystring=require(_0xa89a('0xa'));var Papa=require(_0xa89a('0xb'));var Redis=require('ioredis');var authService=require(_0xa89a('0xc'));var qs=require(_0xa89a('0xd'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xa89a('0xe'))('api');var utils=require('../../config/utils');var config=require(_0xa89a('0xf'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3d433a,_0x548eed){_0x548eed=_0x548eed||0xcc;return function(_0x3c0eb4){if(_0x3c0eb4){return _0x3d433a[_0xa89a('0x10')](_0x548eed);}return _0x3d433a[_0xa89a('0x11')](_0x548eed)[_0xa89a('0x12')]();};}function respondWithResult(_0x14b5fb,_0x121638){_0x121638=_0x121638||0xc8;return function(_0x3b0804){if(_0x3b0804){return _0x14b5fb['status'](_0x121638)[_0xa89a('0x13')](_0x3b0804);}};}function respondWithFilteredResult(_0x242349,_0xd9f5b3){return function(_0x5e3738){if(_0x5e3738){var _0x1b7115=_0x5e3738[_0xa89a('0x14')],_0x338446=_0xd9f5b3[_0xa89a('0x15')],_0x2ecb3a=_0xd9f5b3[_0xa89a('0x15')]+_0xd9f5b3[_0xa89a('0x16')],_0xc78546;if(_0x2ecb3a>=_0x1b7115){_0x2ecb3a=_0x1b7115;_0xc78546=0xc8;}else{_0xc78546=0xce;}_0x242349[_0xa89a('0x11')](_0xc78546);return _0x242349['set']('Content-Range',_0x338446+'-'+_0x2ecb3a+'/'+_0x1b7115)[_0xa89a('0x13')](_0x5e3738);}return null;};}function patchUpdates(_0x5551c0){return function(_0x3ee3a9){try{jsonpatch[_0xa89a('0x17')](_0x3ee3a9,_0x5551c0,!![]);}catch(_0xdf6c12){return BPromise[_0xa89a('0x18')](_0xdf6c12);}return _0x3ee3a9[_0xa89a('0x19')]();};}function saveUpdates(_0x322396,_0x172ee4){return function(_0x30aad2){if(_0x30aad2){return _0x30aad2[_0xa89a('0x1a')](_0x322396)[_0xa89a('0x1b')](function(_0x192065){return _0x192065;});}return null;};}function removeEntity(_0x33a522,_0x3d7b0a){return function(_0x47e6f7){if(_0x47e6f7){return _0x47e6f7['destroy']()[_0xa89a('0x1b')](function(){var _0x20ee5e=_0x47e6f7['get']({'plain':!![]});var _0xde8382=_0xa89a('0x1c');return db[_0xa89a('0x1d')][_0xa89a('0x1e')]({'where':{'type':_0xde8382,'resourceId':_0x20ee5e['id']}})[_0xa89a('0x1b')](function(){return _0x47e6f7;});})[_0xa89a('0x1b')](function(){_0x33a522[_0xa89a('0x11')](0xcc)[_0xa89a('0x12')]();});}};}function handleEntityNotFound(_0x8f86a3,_0x40be14){return function(_0x151073){if(!_0x151073){_0x8f86a3[_0xa89a('0x10')](0x194);}return _0x151073;};}function handleError(_0x57bc51,_0x5a901a){_0x5a901a=_0x5a901a||0x1f4;return function(_0x55591c){logger[_0xa89a('0x1f')](_0x55591c[_0xa89a('0x20')]);if(_0x55591c[_0xa89a('0x21')]){delete _0x55591c[_0xa89a('0x21')];}_0x57bc51[_0xa89a('0x11')](_0x5a901a)[_0xa89a('0x22')](_0x55591c);};}exports[_0xa89a('0x23')]=function(_0xb93bec,_0x59ae45){var _0x22d1ed={},_0x3600dd={},_0x34b1cb={'count':0x0,'rows':[]};var _0x3fe05d=_[_0xa89a('0x24')](db[_0xa89a('0x25')][_0xa89a('0x26')],function(_0x3daf4b){return{'name':_0x3daf4b[_0xa89a('0x27')],'type':_0x3daf4b['type']['key']};});_0x3600dd['model']=_[_0xa89a('0x24')](_0x3fe05d,'name');_0x3600dd[_0xa89a('0x28')]=_[_0xa89a('0x29')](_0xb93bec['query']);_0x3600dd['filters']=_[_0xa89a('0x2a')](_0x3600dd[_0xa89a('0x2b')],_0x3600dd[_0xa89a('0x28')]);_0x22d1ed['attributes']=_[_0xa89a('0x2a')](_0x3600dd[_0xa89a('0x2b')],qs[_0xa89a('0x2c')](_0xb93bec['query']['fields']));_0x22d1ed[_0xa89a('0x2d')]=_0x22d1ed[_0xa89a('0x2d')][_0xa89a('0x2e')]?_0x22d1ed[_0xa89a('0x2d')]:_0x3600dd['model'];if(!_0xb93bec[_0xa89a('0x28')]['hasOwnProperty']('nolimit')){_0x22d1ed[_0xa89a('0x16')]=qs[_0xa89a('0x16')](_0xb93bec['query'][_0xa89a('0x16')]);_0x22d1ed[_0xa89a('0x15')]=qs[_0xa89a('0x15')](_0xb93bec[_0xa89a('0x28')][_0xa89a('0x15')]);}_0x22d1ed['order']=qs[_0xa89a('0x2f')](_0xb93bec[_0xa89a('0x28')][_0xa89a('0x2f')]);_0x22d1ed[_0xa89a('0x30')]=qs[_0xa89a('0x31')](_['pick'](_0xb93bec[_0xa89a('0x28')],_0x3600dd[_0xa89a('0x31')]),_0x3fe05d);if(_0xb93bec[_0xa89a('0x28')]['filter']){_0x22d1ed[_0xa89a('0x30')]=_[_0xa89a('0x32')](_0x22d1ed['where'],{'$or':_[_0xa89a('0x24')](_0x3fe05d,function(_0x4768b9){if(_0x4768b9[_0xa89a('0x33')]!=='VIRTUAL'){var _0x3808be={};_0x3808be[_0x4768b9[_0xa89a('0x21')]]={'$like':'%'+_0xb93bec[_0xa89a('0x28')][_0xa89a('0x34')]+'%'};return _0x3808be;}})});}_0x22d1ed=_['merge']({},_0x22d1ed,_0xb93bec['options']);var _0x2b49a4={'where':_0x22d1ed[_0xa89a('0x30')]};return db['CmContactHasPhone'][_0xa89a('0x14')](_0x2b49a4)[_0xa89a('0x1b')](function(_0x50d31f){_0x34b1cb[_0xa89a('0x14')]=_0x50d31f;if(_0xb93bec[_0xa89a('0x28')][_0xa89a('0x35')]){_0x22d1ed[_0xa89a('0x36')]=[{'all':!![]}];}return db['CmContactHasPhone'][_0xa89a('0x37')](_0x22d1ed);})[_0xa89a('0x1b')](function(_0xddc096){_0x34b1cb[_0xa89a('0x38')]=_0xddc096;return _0x34b1cb;})['then'](respondWithFilteredResult(_0x59ae45,_0x22d1ed))[_0xa89a('0x39')](handleError(_0x59ae45,null));};exports[_0xa89a('0x3a')]=function(_0x82d067,_0x1638fa){var _0x4e6485={'raw':!![],'where':{'id':_0x82d067[_0xa89a('0x3b')]['id']}},_0x4b0372={};_0x4b0372['model']=_[_0xa89a('0x29')](db[_0xa89a('0x25')][_0xa89a('0x26')]);_0x4b0372[_0xa89a('0x28')]=_['keys'](_0x82d067[_0xa89a('0x28')]);_0x4b0372[_0xa89a('0x31')]=_[_0xa89a('0x2a')](_0x4b0372[_0xa89a('0x2b')],_0x4b0372[_0xa89a('0x28')]);_0x4e6485[_0xa89a('0x2d')]=_[_0xa89a('0x2a')](_0x4b0372[_0xa89a('0x2b')],qs[_0xa89a('0x2c')](_0x82d067[_0xa89a('0x28')][_0xa89a('0x2c')]));_0x4e6485['attributes']=_0x4e6485[_0xa89a('0x2d')][_0xa89a('0x2e')]?_0x4e6485['attributes']:_0x4b0372['model'];if(_0x82d067[_0xa89a('0x28')][_0xa89a('0x35')]){_0x4e6485['include']=[{'all':!![]}];}_0x4e6485=_['merge']({},_0x4e6485,_0x82d067[_0xa89a('0x3c')]);return db[_0xa89a('0x25')][_0xa89a('0x3d')](_0x4e6485)[_0xa89a('0x1b')](handleEntityNotFound(_0x1638fa,null))[_0xa89a('0x1b')](respondWithResult(_0x1638fa,null))[_0xa89a('0x39')](handleError(_0x1638fa,null));};exports['create']=function(_0x1d653c,_0x3e6734){return db['CmContactHasPhone'][_0xa89a('0x3e')](_0x1d653c[_0xa89a('0x3f')],{})[_0xa89a('0x1b')](function(_0x2f6006){var _0x6cf93=_0x1d653c[_0xa89a('0x40')][_0xa89a('0x41')]({'plain':!![]});if(!_0x6cf93)throw new Error(_0xa89a('0x42'));if(_0x6cf93[_0xa89a('0x43')]===_0xa89a('0x40')){var _0xe0ab0e=_0x2f6006['get']({'plain':!![]});var _0x334103=_0xa89a('0x1c');return db[_0xa89a('0x44')][_0xa89a('0x3d')]({'where':{'name':_0x334103,'userProfileId':_0x6cf93[_0xa89a('0x45')]},'raw':!![]})[_0xa89a('0x1b')](function(_0x47c335){if(_0x47c335&&_0x47c335['autoAssociation']===0x0){return db[_0xa89a('0x1d')][_0xa89a('0x3e')]({'name':_0xe0ab0e[_0xa89a('0x21')],'resourceId':_0xe0ab0e['id'],'type':_0x47c335['name'],'sectionId':_0x47c335['id']},{})[_0xa89a('0x1b')](function(){return _0x2f6006;});}else{return _0x2f6006;}})['catch'](function(_0x2e70e9){logger[_0xa89a('0x1f')](_0xa89a('0x46'),_0x2e70e9);throw _0x2e70e9;});}return _0x2f6006;})[_0xa89a('0x1b')](respondWithResult(_0x3e6734,0xc9))['catch'](handleError(_0x3e6734,null));};exports['update']=function(_0x1254d3,_0x2234db){if(_0x1254d3['body']['id']){delete _0x1254d3[_0xa89a('0x3f')]['id'];}return db['CmContactHasPhone']['find']({'where':{'id':_0x1254d3['params']['id']}})[_0xa89a('0x1b')](handleEntityNotFound(_0x2234db,null))['then'](saveUpdates(_0x1254d3['body'],null))['then'](respondWithResult(_0x2234db,null))['catch'](handleError(_0x2234db,null));};exports['destroy']=function(_0x1b452b,_0x203da9){return db[_0xa89a('0x25')]['find']({'where':{'id':_0x1b452b[_0xa89a('0x3b')]['id']}})['then'](handleEntityNotFound(_0x203da9,null))[_0xa89a('0x1b')](removeEntity(_0x203da9,null))[_0xa89a('0x39')](handleError(_0x203da9,null));}; \ No newline at end of file diff --git a/server/api/cmContactHasPhone/cmContactHasPhone.model.js b/server/api/cmContactHasPhone/cmContactHasPhone.model.js index 24a0a3b..8f50094 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 _0x07dc=['exports','define','CmContactHasPhone','cm_contact_has_phones','util','moment','request-promise','../../config/environment'];(function(_0x782302,_0x2d7d7c){var _0x244e6f=function(_0x3e1e10){while(--_0x3e1e10){_0x782302['push'](_0x782302['shift']());}};_0x244e6f(++_0x2d7d7c);}(_0x07dc,0x174));var _0xc07d=function(_0x21a9d9,_0x4d5ac8){_0x21a9d9=_0x21a9d9-0x0;var _0x46adce=_0x07dc[_0x21a9d9];return _0x46adce;};'use strict';var _=require('lodash');var util=require(_0xc07d('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0xc07d('0x1'));var BPromise=require('bluebird');var rp=require(_0xc07d('0x2'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xc07d('0x3'));var attributes=require('./cmContactHasPhone.attributes');module[_0xc07d('0x4')]=function(_0x24a973,_0xb21120){return _0x24a973[_0xc07d('0x5')](_0xc07d('0x6'),attributes,{'tableName':_0xc07d('0x7'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf72b=['./cmContactHasPhone.attributes','exports','define','CmContactHasPhone','cm_contact_has_phones','lodash','../../config/logger','moment','bluebird','path','rimraf','../../config/environment'];(function(_0x467cc1,_0x2efb98){var _0x23041a=function(_0x4c59bd){while(--_0x4c59bd){_0x467cc1['push'](_0x467cc1['shift']());}};_0x23041a(++_0x2efb98);}(_0xf72b,0x1d9));var _0xbf72=function(_0x1d9d88,_0x1b41c9){_0x1d9d88=_0x1d9d88-0x0;var _0x39ee63=_0xf72b[_0x1d9d88];return _0x39ee63;};'use strict';var _=require(_0xbf72('0x0'));var util=require('util');var logger=require(_0xbf72('0x1'))('api');var moment=require(_0xbf72('0x2'));var BPromise=require(_0xbf72('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xbf72('0x4'));var rimraf=require(_0xbf72('0x5'));var config=require(_0xbf72('0x6'));var attributes=require(_0xbf72('0x7'));module[_0xbf72('0x8')]=function(_0x2b8440,_0x5ee060){return _0x2b8440[_0xbf72('0x9')](_0xbf72('0xa'),attributes,{'tableName':_0xbf72('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmContactHasPhone/cmContactHasPhone.rpc.js b/server/api/cmContactHasPhone/cmContactHasPhone.rpc.js index 47489fc..82d5ea8 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 _0x5dbc=['error','code','message','CmContactHasPhone,\x20%s,\x20%s','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','then','info','request\x20sent','CmContactHasPhone,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x937a27,_0x2f6f62){var _0x4d7ea8=function(_0x10901d){while(--_0x10901d){_0x937a27['push'](_0x937a27['shift']());}};_0x4d7ea8(++_0x2f6f62);}(_0x5dbc,0x166));var _0xc5db=function(_0x1d61c8,_0x420cde){_0x1d61c8=_0x1d61c8-0x0;var _0x196fac=_0x5dbc[_0x1d61c8];return _0x196fac;};'use strict';var _=require(_0xc5db('0x0'));var util=require('util');var moment=require(_0xc5db('0x1'));var BPromise=require(_0xc5db('0x2'));var rs=require(_0xc5db('0x3'));var fs=require('fs');var Redis=require(_0xc5db('0x4'));var db=require(_0xc5db('0x5'))['db'];var utils=require(_0xc5db('0x6'));var logger=require(_0xc5db('0x7'))(_0xc5db('0x8'));var config=require('../../config/environment');var jayson=require(_0xc5db('0x9'));var client=jayson[_0xc5db('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3a9dc8,_0x30f81f,_0xc5a688){return new BPromise(function(_0x1314e3,_0x1fc796){return client['request'](_0x3a9dc8,_0xc5a688)[_0xc5db('0xb')](function(_0x34f3bb){logger[_0xc5db('0xc')]('CmContactHasPhone,\x20%s,\x20%s',_0x30f81f,_0xc5db('0xd'));logger['debug'](_0xc5db('0xe'),_0x30f81f,_0xc5db('0xd'),JSON[_0xc5db('0xf')](_0x34f3bb));if(_0x34f3bb[_0xc5db('0x10')]){if(_0x34f3bb[_0xc5db('0x10')][_0xc5db('0x11')]===0x1f4){logger[_0xc5db('0x10')]('CmContactHasPhone,\x20%s,\x20%s',_0x30f81f,_0x34f3bb[_0xc5db('0x10')][_0xc5db('0x12')]);return _0x1fc796(_0x34f3bb[_0xc5db('0x10')][_0xc5db('0x12')]);}logger[_0xc5db('0x10')](_0xc5db('0x13'),_0x30f81f,_0x34f3bb[_0xc5db('0x10')][_0xc5db('0x12')]);return _0x1314e3(_0x34f3bb[_0xc5db('0x10')][_0xc5db('0x12')]);}else{logger[_0xc5db('0xc')](_0xc5db('0x13'),_0x30f81f,_0xc5db('0xd'));_0x1314e3(_0x34f3bb[_0xc5db('0x14')][_0xc5db('0x12')]);}})[_0xc5db('0x15')](function(_0x2a926c){logger[_0xc5db('0x10')]('CmContactHasPhone,\x20%s,\x20%s',_0x30f81f,_0x2a926c);_0x1fc796(_0x2a926c);});});} \ No newline at end of file +var _0xd677=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','request','then','CmContactHasPhone,\x20%s,\x20%s','request\x20sent','debug','CmContactHasPhone,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','moment'];(function(_0x311c35,_0x534915){var _0x5cc50c=function(_0x3ad680){while(--_0x3ad680){_0x311c35['push'](_0x311c35['shift']());}};_0x5cc50c(++_0x534915);}(_0xd677,0x88));var _0x7d67=function(_0xc048e2,_0x3825ef){_0xc048e2=_0xc048e2-0x0;var _0x4012ed=_0xd677[_0xc048e2];return _0x4012ed;};'use strict';var _=require(_0x7d67('0x0'));var util=require('util');var moment=require(_0x7d67('0x1'));var BPromise=require(_0x7d67('0x2'));var rs=require(_0x7d67('0x3'));var fs=require('fs');var Redis=require(_0x7d67('0x4'));var db=require(_0x7d67('0x5'))['db'];var utils=require(_0x7d67('0x6'));var logger=require('../../config/logger')(_0x7d67('0x7'));var config=require(_0x7d67('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x7d67('0x9')][_0x7d67('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x203640,_0x34b0dd,_0x4f6fae){return new BPromise(function(_0x32952a,_0x2e5f25){return client[_0x7d67('0xb')](_0x203640,_0x4f6fae)[_0x7d67('0xc')](function(_0x33cd51){logger['info'](_0x7d67('0xd'),_0x34b0dd,_0x7d67('0xe'));logger[_0x7d67('0xf')](_0x7d67('0x10'),_0x34b0dd,_0x7d67('0xe'),JSON[_0x7d67('0x11')](_0x33cd51));if(_0x33cd51[_0x7d67('0x12')]){if(_0x33cd51[_0x7d67('0x12')][_0x7d67('0x13')]===0x1f4){logger[_0x7d67('0x12')](_0x7d67('0xd'),_0x34b0dd,_0x33cd51[_0x7d67('0x12')][_0x7d67('0x14')]);return _0x2e5f25(_0x33cd51[_0x7d67('0x12')][_0x7d67('0x14')]);}logger[_0x7d67('0x12')]('CmContactHasPhone,\x20%s,\x20%s',_0x34b0dd,_0x33cd51[_0x7d67('0x12')][_0x7d67('0x14')]);return _0x32952a(_0x33cd51[_0x7d67('0x12')][_0x7d67('0x14')]);}else{logger['info'](_0x7d67('0xd'),_0x34b0dd,'request\x20sent');_0x32952a(_0x33cd51[_0x7d67('0x15')][_0x7d67('0x14')]);}})[_0x7d67('0x16')](function(_0x3d5572){logger['error'](_0x7d67('0xd'),_0x34b0dd,_0x3d5572);_0x2e5f25(_0x3d5572);});});} \ No newline at end of file diff --git a/server/api/cmContactHasPhone/index.js b/server/api/cmContactHasPhone/index.js index 4db8e29..4267a48 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 _0x03ae=['/:id','show','post','create','put','destroy','util','path','connect-timeout','Router','../../components/auth/service','../../config/environment','get','isAuthenticated','index'];(function(_0x5c69c8,_0x5f0729){var _0x3e97ba=function(_0x427b37){while(--_0x427b37){_0x5c69c8['push'](_0x5c69c8['shift']());}};_0x3e97ba(++_0x5f0729);}(_0x03ae,0x15f));var _0xe03a=function(_0x45d3f0,_0x4be53f){_0x45d3f0=_0x45d3f0-0x0;var _0x314b79=_0x03ae[_0x45d3f0];return _0x314b79;};'use strict';var multer=require('multer');var util=require(_0xe03a('0x0'));var path=require(_0xe03a('0x1'));var timeout=require(_0xe03a('0x2'));var express=require('express');var router=express[_0xe03a('0x3')]();var auth=require(_0xe03a('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xe03a('0x5'));var controller=require('./cmContactHasPhone.controller');router[_0xe03a('0x6')]('/',auth[_0xe03a('0x7')](),controller[_0xe03a('0x8')]);router[_0xe03a('0x6')](_0xe03a('0x9'),auth[_0xe03a('0x7')](),controller[_0xe03a('0xa')]);router[_0xe03a('0xb')]('/',auth[_0xe03a('0x7')](),controller[_0xe03a('0xc')]);router[_0xe03a('0xd')](_0xe03a('0x9'),auth[_0xe03a('0x7')](),controller['update']);router['delete']('/:id',auth[_0xe03a('0x7')](),controller[_0xe03a('0xe')]);module['exports']=router; \ No newline at end of file +var _0xa572=['delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./cmContactHasPhone.controller','get','index','isAuthenticated','post','put','/:id','update'];(function(_0x23b671,_0x37c762){var _0x49689f=function(_0x49e395){while(--_0x49e395){_0x23b671['push'](_0x23b671['shift']());}};_0x49689f(++_0x37c762);}(_0xa572,0x1a5));var _0x2a57=function(_0x4ca333,_0x1218a3){_0x4ca333=_0x4ca333-0x0;var _0x13b2e1=_0xa572[_0x4ca333];return _0x13b2e1;};'use strict';var multer=require(_0x2a57('0x0'));var util=require(_0x2a57('0x1'));var path=require(_0x2a57('0x2'));var timeout=require(_0x2a57('0x3'));var express=require(_0x2a57('0x4'));var router=express[_0x2a57('0x5')]();var auth=require('../../components/auth/service');var interaction=require(_0x2a57('0x6'));var config=require(_0x2a57('0x7'));var controller=require(_0x2a57('0x8'));router[_0x2a57('0x9')]('/',auth['isAuthenticated'](),controller[_0x2a57('0xa')]);router[_0x2a57('0x9')]('/:id',auth[_0x2a57('0xb')](),controller['show']);router[_0x2a57('0xc')]('/',auth[_0x2a57('0xb')](),controller['create']);router[_0x2a57('0xd')](_0x2a57('0xe'),auth[_0x2a57('0xb')](),controller[_0x2a57('0xf')]);router[_0x2a57('0x10')]('/:id',auth[_0x2a57('0xb')](),controller[_0x2a57('0x11')]);module[_0x2a57('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 0cd79e5..8c8624c 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 _0x2034=['BOOLEAN','sequelize','lodash','exports','VIRTUAL','getDataValue','alias','setDataValue','name','STRING','TEXT','long','type','select','values','isArray','stringify'];(function(_0x3b7911,_0x3d8c28){var _0x193910=function(_0x26df8c){while(--_0x26df8c){_0x3b7911['push'](_0x3b7911['shift']());}};_0x193910(++_0x3d8c28);}(_0x2034,0x133));var _0x4203=function(_0x55ad1d,_0x101d17){_0x55ad1d=_0x55ad1d-0x0;var _0x324bc0=_0x2034[_0x55ad1d];return _0x324bc0;};'use strict';var Sequelize=require(_0x4203('0x0'));var _=require(_0x4203('0x1'));module[_0x4203('0x2')]={'name':{'type':Sequelize[_0x4203('0x3')],'get':function(_0x334c6b){return this[_0x4203('0x4')](_0x4203('0x5'));}},'alias':{'type':Sequelize['STRING'],'allowNull':![],'set':function(_0x360713){this[_0x4203('0x6')](_0x4203('0x5'),_0x360713?_0x360713:this[_0x4203('0x4')](_0x4203('0x7')));}},'type':{'type':Sequelize[_0x4203('0x8')],'allowNull':![]},'values':{'type':Sequelize[_0x4203('0x9')](_0x4203('0xa')),'get':function(){if(this[_0x4203('0x4')](_0x4203('0xb'))===_0x4203('0xc')){return JSON['parse'](this[_0x4203('0x4')](_0x4203('0xd')));}else{return this[_0x4203('0x4')](_0x4203('0xd'));}},'set':function(_0x57c61f){if(Array[_0x4203('0xe')](_0x57c61f)){this[_0x4203('0x6')](_0x4203('0xd'),JSON[_0x4203('0xf')](_0x57c61f));}else{this[_0x4203('0x6')]('values',_0x57c61f);}}},'required':{'type':Sequelize[_0x4203('0x10')],'defaultValue':![]}}; \ No newline at end of file +var _0xfd93=['stringify','BOOLEAN','sequelize','lodash','exports','VIRTUAL','getDataValue','alias','STRING','setDataValue','name','TEXT','long','select','parse','values','isArray'];(function(_0x4f5547,_0xffd557){var _0x5a69ce=function(_0x384b92){while(--_0x384b92){_0x4f5547['push'](_0x4f5547['shift']());}};_0x5a69ce(++_0xffd557);}(_0xfd93,0x101));var _0x3fd9=function(_0x4d05a0,_0x53aa7e){_0x4d05a0=_0x4d05a0-0x0;var _0x4c999c=_0xfd93[_0x4d05a0];return _0x4c999c;};'use strict';var Sequelize=require(_0x3fd9('0x0'));var _=require(_0x3fd9('0x1'));module[_0x3fd9('0x2')]={'name':{'type':Sequelize[_0x3fd9('0x3')],'get':function(_0x2dfd17){return this[_0x3fd9('0x4')](_0x3fd9('0x5'));}},'alias':{'type':Sequelize[_0x3fd9('0x6')],'allowNull':![],'set':function(_0x3e919b){this[_0x3fd9('0x7')]('alias',_0x3e919b?_0x3e919b:this['getDataValue'](_0x3fd9('0x8')));}},'type':{'type':Sequelize[_0x3fd9('0x6')],'allowNull':![]},'values':{'type':Sequelize[_0x3fd9('0x9')](_0x3fd9('0xa')),'get':function(){if(this[_0x3fd9('0x4')]('type')===_0x3fd9('0xb')){return JSON[_0x3fd9('0xc')](this[_0x3fd9('0x4')](_0x3fd9('0xd')));}else{return this['getDataValue'](_0x3fd9('0xd'));}},'set':function(_0x1325c1){if(Array[_0x3fd9('0xe')](_0x1325c1)){this[_0x3fd9('0x7')](_0x3fd9('0xd'),JSON[_0x3fd9('0xf')](_0x1325c1));}else{this[_0x3fd9('0x7')](_0x3fd9('0xd'),_0x1325c1);}}},'required':{'type':Sequelize[_0x3fd9('0x10')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.controller.js b/server/api/cmCustomField/cmCustomField.controller.js index 0d43d50..504ed66 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 _0x9539=['rimraf','fast-json-patch','moment','bluebird','mustache','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','sendStatus','status','end','json','count','offset','limit','Content-Range','apply','reject','update','destroy','then','error','stack','name','send','index','map','CmCustomField','rawAttributes','type','key','model','differenceBy','query','keys','filters','intersection','fields','attributes','length','order','sort','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','params','catch','body','find','create','sequelize','transaction','Sequelize','TEXT','text','number','INTEGER','BOOLEAN','defaultValue','queryInterface','addColumn','cm_contacts','format','html-pdf','eml-format'];(function(_0x56482c,_0x16118d){var _0x5aae7a=function(_0x52512f){while(--_0x52512f){_0x56482c['push'](_0x56482c['shift']());}};_0x5aae7a(++_0x16118d);}(_0x9539,0x14a));var _0x9953=function(_0x3b3b56,_0xd3d724){_0x3b3b56=_0x3b3b56-0x0;var _0x232bce=_0x9539[_0x3b3b56];return _0x232bce;};'use strict';var pdf=require(_0x9953('0x0'));var emlformat=require(_0x9953('0x1'));var rimraf=require(_0x9953('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x9953('0x3'));var rp=require('request-promise');var moment=require(_0x9953('0x4'));var BPromise=require(_0x9953('0x5'));var Mustache=require(_0x9953('0x6'));var util=require('util');var path=require('path');var sox=require(_0x9953('0x7'));var csv=require(_0x9953('0x8'));var ejs=require(_0x9953('0x9'));var fs=require('fs');var _=require('lodash');var squel=require(_0x9953('0xa'));var crypto=require(_0x9953('0xb'));var jsforce=require(_0x9953('0xc'));var deskjs=require(_0x9953('0xd'));var toCsv=require('to-csv');var querystring=require(_0x9953('0xe'));var Papa=require(_0x9953('0xf'));var Redis=require(_0x9953('0x10'));var authService=require(_0x9953('0x11'));var qs=require(_0x9953('0x12'));var as=require(_0x9953('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x9953('0x14'))('api');var utils=require(_0x9953('0x15'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xaad53c,_0x24f665){_0x24f665=_0x24f665||0xcc;return function(_0x14ec0f){if(_0x14ec0f){return _0xaad53c[_0x9953('0x16')](_0x24f665);}return _0xaad53c[_0x9953('0x17')](_0x24f665)[_0x9953('0x18')]();};}function respondWithResult(_0x1c10e4,_0x4030a8){_0x4030a8=_0x4030a8||0xc8;return function(_0x18dec5){if(_0x18dec5){return _0x1c10e4[_0x9953('0x17')](_0x4030a8)[_0x9953('0x19')](_0x18dec5);}};}function respondWithFilteredResult(_0x7bc26c,_0x3e1d33){return function(_0x559393){if(_0x559393){var _0x40036f=_0x559393[_0x9953('0x1a')],_0x20a3f0=_0x3e1d33[_0x9953('0x1b')],_0x5063b7=_0x3e1d33[_0x9953('0x1b')]+_0x3e1d33[_0x9953('0x1c')],_0x438063;if(_0x5063b7>=_0x40036f){_0x5063b7=_0x40036f;_0x438063=0xc8;}else{_0x438063=0xce;}_0x7bc26c[_0x9953('0x17')](_0x438063);return _0x7bc26c['set'](_0x9953('0x1d'),_0x20a3f0+'-'+_0x5063b7+'/'+_0x40036f)[_0x9953('0x19')](_0x559393);}return null;};}function patchUpdates(_0x48970c){return function(_0x3c4e99){try{jsonpatch[_0x9953('0x1e')](_0x3c4e99,_0x48970c,!![]);}catch(_0x2cab4d){return BPromise[_0x9953('0x1f')](_0x2cab4d);}return _0x3c4e99['save']();};}function saveUpdates(_0x489f04,_0x284859){return function(_0x189dbd){if(_0x189dbd){return _0x189dbd[_0x9953('0x20')](_0x489f04)['then'](function(_0x10d8a3){return _0x10d8a3;});}return null;};}function removeEntity(_0x3df34b,_0x2ad775){return function(_0x49d149){if(_0x49d149){return _0x49d149[_0x9953('0x21')]()[_0x9953('0x22')](function(){_0x3df34b[_0x9953('0x17')](0xcc)[_0x9953('0x18')]();});}};}function handleEntityNotFound(_0x432b3b,_0x549f67){return function(_0x2ab293){if(!_0x2ab293){_0x432b3b['sendStatus'](0x194);}return _0x2ab293;};}function handleError(_0x583941,_0x46f0e3){_0x46f0e3=_0x46f0e3||0x1f4;return function(_0x2880b2){logger[_0x9953('0x23')](_0x2880b2[_0x9953('0x24')]);if(_0x2880b2[_0x9953('0x25')]){delete _0x2880b2[_0x9953('0x25')];}_0x583941[_0x9953('0x17')](_0x46f0e3)[_0x9953('0x26')](_0x2880b2);};}exports[_0x9953('0x27')]=function(_0x476274,_0x19b5a7){var _0x1aa7f7={},_0x19cc50={},_0x14de7b={'count':0x0,'rows':[]};var _0x5ea81c=_[_0x9953('0x28')](db[_0x9953('0x29')][_0x9953('0x2a')],function(_0xb00fd6){return{'name':_0xb00fd6['fieldName'],'type':_0xb00fd6[_0x9953('0x2b')][_0x9953('0x2c')]};});_0x19cc50[_0x9953('0x2d')]=_[_0x9953('0x2e')](_[_0x9953('0x28')](_0x5ea81c,_0x9953('0x25')),[_0x9953('0x25')]);_0x19cc50[_0x9953('0x2f')]=_[_0x9953('0x30')](_0x476274[_0x9953('0x2f')]);_0x19cc50[_0x9953('0x31')]=_[_0x9953('0x32')](_0x19cc50['model'],_0x19cc50['query']);_0x1aa7f7['attributes']=_[_0x9953('0x32')](_0x19cc50[_0x9953('0x2d')],qs[_0x9953('0x33')](_0x476274[_0x9953('0x2f')][_0x9953('0x33')]));_0x1aa7f7[_0x9953('0x34')]=_0x1aa7f7[_0x9953('0x34')][_0x9953('0x35')]?_0x1aa7f7[_0x9953('0x34')]:_0x19cc50['model'];if(!_0x476274['query']['hasOwnProperty']('nolimit')){_0x1aa7f7[_0x9953('0x1c')]=qs[_0x9953('0x1c')](_0x476274[_0x9953('0x2f')]['limit']);_0x1aa7f7['offset']=qs[_0x9953('0x1b')](_0x476274[_0x9953('0x2f')]['offset']);}_0x1aa7f7[_0x9953('0x36')]=qs['sort'](_0x476274[_0x9953('0x2f')][_0x9953('0x37')]);_0x1aa7f7['where']=qs['filters'](_[_0x9953('0x38')](_0x476274[_0x9953('0x2f')],_0x19cc50[_0x9953('0x31')]),_0x5ea81c);if(_0x476274[_0x9953('0x2f')][_0x9953('0x39')]){_0x1aa7f7['where']=_[_0x9953('0x3a')](_0x1aa7f7['where'],{'$or':_[_0x9953('0x28')](_0x5ea81c,function(_0x122701){if(_0x122701[_0x9953('0x2b')]!==_0x9953('0x3b')){var _0x1bcd68={};_0x1bcd68[_0x122701[_0x9953('0x25')]]={'$like':'%'+_0x476274[_0x9953('0x2f')][_0x9953('0x39')]+'%'};return _0x1bcd68;}})});}_0x1aa7f7=_[_0x9953('0x3a')]({},_0x1aa7f7,_0x476274[_0x9953('0x3c')]);var _0x17191b={'where':_0x1aa7f7['where']};return db[_0x9953('0x29')][_0x9953('0x1a')](_0x17191b)[_0x9953('0x22')](function(_0x2326ca){_0x14de7b['count']=_0x2326ca;if(_0x476274['query'][_0x9953('0x3d')]){_0x1aa7f7[_0x9953('0x3e')]=[{'all':!![]}];}return db[_0x9953('0x29')][_0x9953('0x3f')](_0x1aa7f7);})[_0x9953('0x22')](function(_0x27530e){_0x14de7b[_0x9953('0x40')]=_0x27530e;return _0x14de7b;})[_0x9953('0x22')](respondWithFilteredResult(_0x19b5a7,_0x1aa7f7))['catch'](handleError(_0x19b5a7,null));};exports['show']=function(_0x2bdea6,_0x1ec5d1){var _0x63acc0={'raw':!![],'where':{'id':_0x2bdea6[_0x9953('0x41')]['id']}},_0xbeb7a7={};_0xbeb7a7[_0x9953('0x2d')]=_[_0x9953('0x30')](db[_0x9953('0x29')][_0x9953('0x2a')]);_0xbeb7a7[_0x9953('0x2f')]=_[_0x9953('0x30')](_0x2bdea6['query']);_0xbeb7a7['filters']=_[_0x9953('0x32')](_0xbeb7a7[_0x9953('0x2d')],_0xbeb7a7['query']);_0x63acc0[_0x9953('0x34')]=_[_0x9953('0x32')](_0xbeb7a7['model'],qs[_0x9953('0x33')](_0x2bdea6[_0x9953('0x2f')][_0x9953('0x33')]));_0x63acc0['attributes']=_0x63acc0[_0x9953('0x34')][_0x9953('0x35')]?_0x63acc0[_0x9953('0x34')]:_0xbeb7a7['model'];if(_0x2bdea6[_0x9953('0x2f')][_0x9953('0x3d')]){_0x63acc0[_0x9953('0x3e')]=[{'all':!![]}];}_0x63acc0=_[_0x9953('0x3a')]({},_0x63acc0,_0x2bdea6[_0x9953('0x3c')]);return db[_0x9953('0x29')]['find'](_0x63acc0)[_0x9953('0x22')](handleEntityNotFound(_0x1ec5d1,null))[_0x9953('0x22')](respondWithResult(_0x1ec5d1,null))[_0x9953('0x42')](handleError(_0x1ec5d1,null));};exports[_0x9953('0x20')]=function(_0x23d608,_0x5db0b2){if(_0x23d608['body']['id']){delete _0x23d608[_0x9953('0x43')]['id'];}return db[_0x9953('0x29')][_0x9953('0x44')]({'where':{'id':_0x23d608[_0x9953('0x41')]['id']}})['then'](handleEntityNotFound(_0x5db0b2,null))['then'](saveUpdates(_0x23d608[_0x9953('0x43')],null))['then'](respondWithResult(_0x5db0b2,null))[_0x9953('0x42')](handleError(_0x5db0b2,null));};exports[_0x9953('0x21')]=function(_0x334f4c,_0x5ded9a){return db['CmCustomField'][_0x9953('0x44')]({'where':{'id':_0x334f4c[_0x9953('0x41')]['id']}})[_0x9953('0x22')](handleEntityNotFound(_0x5ded9a,null))[_0x9953('0x22')](removeEntity(_0x5ded9a,null))[_0x9953('0x42')](handleError(_0x5ded9a,null));};exports[_0x9953('0x45')]=function(_0x21a6f8,_0x394fea){var _0x41cad5;return db[_0x9953('0x46')][_0x9953('0x47')](function(_0x20cc34){return db[_0x9953('0x29')][_0x9953('0x45')](_0x21a6f8['body'],{'transaction':_0x20cc34})['then'](function(_0x425f8f){_0x41cad5=_0x425f8f;var _0x3df7c9={'type':db[_0x9953('0x48')][_0x9953('0x49')],'transaction':_0x20cc34};switch(_0x21a6f8[_0x9953('0x43')][_0x9953('0x2b')]){case _0x9953('0x4a'):_0x3df7c9[_0x9953('0x2b')]=db[_0x9953('0x48')][_0x9953('0x49')];break;case _0x9953('0x4b'):_0x3df7c9['type']=db['Sequelize'][_0x9953('0x4c')];break;case'switch':_0x3df7c9[_0x9953('0x2b')]=db[_0x9953('0x48')][_0x9953('0x4d')];_0x3df7c9[_0x9953('0x4e')]=![];break;default:}return db[_0x9953('0x46')][_0x9953('0x4f')][_0x9953('0x50')](_0x9953('0x51'),util[_0x9953('0x52')]('cf_%d',_0x41cad5['id']),_0x3df7c9);})['then'](function(){return _0x41cad5;});})['then'](respondWithResult(_0x394fea,0xc9))[_0x9953('0x42')](handleError(_0x394fea,null));}; \ No newline at end of file +var _0xa0dd=['intersection','model','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','rows','catch','show','includeAll','include','find','body','params','create','sequelize','transaction','Sequelize','TEXT','text','number','INTEGER','defaultValue','queryInterface','addColumn','cf_%d','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','lodash','squel','crypto','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','stack','name','map','CmCustomField','rawAttributes','type','key','differenceBy','keys','query','filters'];(function(_0x4dab8e,_0x2de10b){var _0x2eacf5=function(_0x413a7a){while(--_0x413a7a){_0x4dab8e['push'](_0x4dab8e['shift']());}};_0x2eacf5(++_0x2de10b);}(_0xa0dd,0x172));var _0xda0d=function(_0x3d9cef,_0x13bc7a){_0x3d9cef=_0x3d9cef-0x0;var _0x45aad9=_0xa0dd[_0x3d9cef];return _0x45aad9;};'use strict';var pdf=require(_0xda0d('0x0'));var emlformat=require(_0xda0d('0x1'));var rimraf=require(_0xda0d('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0xda0d('0x3'));var rp=require(_0xda0d('0x4'));var moment=require(_0xda0d('0x5'));var BPromise=require(_0xda0d('0x6'));var Mustache=require(_0xda0d('0x7'));var util=require(_0xda0d('0x8'));var path=require(_0xda0d('0x9'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0xda0d('0xa'));var squel=require(_0xda0d('0xb'));var crypto=require(_0xda0d('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xda0d('0xd'));var querystring=require(_0xda0d('0xe'));var Papa=require('papaparse');var Redis=require(_0xda0d('0xf'));var authService=require(_0xda0d('0x10'));var qs=require(_0xda0d('0x11'));var as=require(_0xda0d('0x12'));var hardwareService=require(_0xda0d('0x13'));var logger=require(_0xda0d('0x14'))(_0xda0d('0x15'));var utils=require('../../config/utils');var config=require(_0xda0d('0x16'));var db=require(_0xda0d('0x17'))['db'];function respondWithStatusCode(_0x478e4e,_0x3edc5f){_0x3edc5f=_0x3edc5f||0xcc;return function(_0x1bb803){if(_0x1bb803){return _0x478e4e[_0xda0d('0x18')](_0x3edc5f);}return _0x478e4e[_0xda0d('0x19')](_0x3edc5f)[_0xda0d('0x1a')]();};}function respondWithResult(_0x5a2666,_0x2186f4){_0x2186f4=_0x2186f4||0xc8;return function(_0x15c417){if(_0x15c417){return _0x5a2666[_0xda0d('0x19')](_0x2186f4)[_0xda0d('0x1b')](_0x15c417);}};}function respondWithFilteredResult(_0x437748,_0x1b3d9f){return function(_0x51fc3f){if(_0x51fc3f){var _0x3f68b9=_0x51fc3f[_0xda0d('0x1c')],_0x155fcb=_0x1b3d9f[_0xda0d('0x1d')],_0x50b544=_0x1b3d9f[_0xda0d('0x1d')]+_0x1b3d9f[_0xda0d('0x1e')],_0x2e27da;if(_0x50b544>=_0x3f68b9){_0x50b544=_0x3f68b9;_0x2e27da=0xc8;}else{_0x2e27da=0xce;}_0x437748[_0xda0d('0x19')](_0x2e27da);return _0x437748[_0xda0d('0x1f')](_0xda0d('0x20'),_0x155fcb+'-'+_0x50b544+'/'+_0x3f68b9)[_0xda0d('0x1b')](_0x51fc3f);}return null;};}function patchUpdates(_0x18d4da){return function(_0x5f2c19){try{jsonpatch[_0xda0d('0x21')](_0x5f2c19,_0x18d4da,!![]);}catch(_0x1b65a9){return BPromise[_0xda0d('0x22')](_0x1b65a9);}return _0x5f2c19[_0xda0d('0x23')]();};}function saveUpdates(_0x683fc6,_0xdda438){return function(_0x5fb9a2){if(_0x5fb9a2){return _0x5fb9a2[_0xda0d('0x24')](_0x683fc6)[_0xda0d('0x25')](function(_0x57c3e0){return _0x57c3e0;});}return null;};}function removeEntity(_0x14e3d5,_0x23ec7d){return function(_0x4b8910){if(_0x4b8910){return _0x4b8910[_0xda0d('0x26')]()[_0xda0d('0x25')](function(){_0x14e3d5[_0xda0d('0x19')](0xcc)[_0xda0d('0x1a')]();});}};}function handleEntityNotFound(_0x365947,_0x2e89fe){return function(_0x36a387){if(!_0x36a387){_0x365947['sendStatus'](0x194);}return _0x36a387;};}function handleError(_0x3d6034,_0x5562b1){_0x5562b1=_0x5562b1||0x1f4;return function(_0x280b0f){logger['error'](_0x280b0f[_0xda0d('0x27')]);if(_0x280b0f['name']){delete _0x280b0f[_0xda0d('0x28')];}_0x3d6034[_0xda0d('0x19')](_0x5562b1)['send'](_0x280b0f);};}exports['index']=function(_0x45ebc0,_0x2035be){var _0x7335d7={},_0x19042b={},_0xb48a71={'count':0x0,'rows':[]};var _0x401af7=_[_0xda0d('0x29')](db[_0xda0d('0x2a')][_0xda0d('0x2b')],function(_0x32c9b8){return{'name':_0x32c9b8['fieldName'],'type':_0x32c9b8[_0xda0d('0x2c')][_0xda0d('0x2d')]};});_0x19042b['model']=_[_0xda0d('0x2e')](_['map'](_0x401af7,'name'),[_0xda0d('0x28')]);_0x19042b['query']=_[_0xda0d('0x2f')](_0x45ebc0[_0xda0d('0x30')]);_0x19042b[_0xda0d('0x31')]=_[_0xda0d('0x32')](_0x19042b[_0xda0d('0x33')],_0x19042b[_0xda0d('0x30')]);_0x7335d7[_0xda0d('0x34')]=_[_0xda0d('0x32')](_0x19042b['model'],qs[_0xda0d('0x35')](_0x45ebc0['query'][_0xda0d('0x35')]));_0x7335d7[_0xda0d('0x34')]=_0x7335d7['attributes'][_0xda0d('0x36')]?_0x7335d7[_0xda0d('0x34')]:_0x19042b[_0xda0d('0x33')];if(!_0x45ebc0['query'][_0xda0d('0x37')]('nolimit')){_0x7335d7[_0xda0d('0x1e')]=qs[_0xda0d('0x1e')](_0x45ebc0['query'][_0xda0d('0x1e')]);_0x7335d7[_0xda0d('0x1d')]=qs['offset'](_0x45ebc0['query'][_0xda0d('0x1d')]);}_0x7335d7[_0xda0d('0x38')]=qs[_0xda0d('0x39')](_0x45ebc0['query'][_0xda0d('0x39')]);_0x7335d7[_0xda0d('0x3a')]=qs[_0xda0d('0x31')](_[_0xda0d('0x3b')](_0x45ebc0[_0xda0d('0x30')],_0x19042b[_0xda0d('0x31')]),_0x401af7);if(_0x45ebc0['query'][_0xda0d('0x3c')]){_0x7335d7[_0xda0d('0x3a')]=_[_0xda0d('0x3d')](_0x7335d7[_0xda0d('0x3a')],{'$or':_[_0xda0d('0x29')](_0x401af7,function(_0x7164c3){if(_0x7164c3[_0xda0d('0x2c')]!==_0xda0d('0x3e')){var _0x514d25={};_0x514d25[_0x7164c3[_0xda0d('0x28')]]={'$like':'%'+_0x45ebc0[_0xda0d('0x30')]['filter']+'%'};return _0x514d25;}})});}_0x7335d7=_[_0xda0d('0x3d')]({},_0x7335d7,_0x45ebc0[_0xda0d('0x3f')]);var _0x44933d={'where':_0x7335d7[_0xda0d('0x3a')]};return db[_0xda0d('0x2a')][_0xda0d('0x1c')](_0x44933d)[_0xda0d('0x25')](function(_0x26e1cf){_0xb48a71[_0xda0d('0x1c')]=_0x26e1cf;if(_0x45ebc0[_0xda0d('0x30')]['includeAll']){_0x7335d7['include']=[{'all':!![]}];}return db[_0xda0d('0x2a')]['findAll'](_0x7335d7);})[_0xda0d('0x25')](function(_0x3cb237){_0xb48a71[_0xda0d('0x40')]=_0x3cb237;return _0xb48a71;})[_0xda0d('0x25')](respondWithFilteredResult(_0x2035be,_0x7335d7))[_0xda0d('0x41')](handleError(_0x2035be,null));};exports[_0xda0d('0x42')]=function(_0x53da8f,_0x32b94c){var _0x4bbb7f={'raw':!![],'where':{'id':_0x53da8f['params']['id']}},_0xf8565={};_0xf8565[_0xda0d('0x33')]=_[_0xda0d('0x2f')](db[_0xda0d('0x2a')][_0xda0d('0x2b')]);_0xf8565[_0xda0d('0x30')]=_[_0xda0d('0x2f')](_0x53da8f[_0xda0d('0x30')]);_0xf8565[_0xda0d('0x31')]=_[_0xda0d('0x32')](_0xf8565[_0xda0d('0x33')],_0xf8565[_0xda0d('0x30')]);_0x4bbb7f[_0xda0d('0x34')]=_[_0xda0d('0x32')](_0xf8565[_0xda0d('0x33')],qs[_0xda0d('0x35')](_0x53da8f[_0xda0d('0x30')][_0xda0d('0x35')]));_0x4bbb7f[_0xda0d('0x34')]=_0x4bbb7f[_0xda0d('0x34')][_0xda0d('0x36')]?_0x4bbb7f[_0xda0d('0x34')]:_0xf8565[_0xda0d('0x33')];if(_0x53da8f[_0xda0d('0x30')][_0xda0d('0x43')]){_0x4bbb7f[_0xda0d('0x44')]=[{'all':!![]}];}_0x4bbb7f=_[_0xda0d('0x3d')]({},_0x4bbb7f,_0x53da8f[_0xda0d('0x3f')]);return db[_0xda0d('0x2a')][_0xda0d('0x45')](_0x4bbb7f)[_0xda0d('0x25')](handleEntityNotFound(_0x32b94c,null))[_0xda0d('0x25')](respondWithResult(_0x32b94c,null))[_0xda0d('0x41')](handleError(_0x32b94c,null));};exports['update']=function(_0x749af8,_0xf59f53){if(_0x749af8['body']['id']){delete _0x749af8[_0xda0d('0x46')]['id'];}return db[_0xda0d('0x2a')]['find']({'where':{'id':_0x749af8[_0xda0d('0x47')]['id']}})[_0xda0d('0x25')](handleEntityNotFound(_0xf59f53,null))[_0xda0d('0x25')](saveUpdates(_0x749af8['body'],null))[_0xda0d('0x25')](respondWithResult(_0xf59f53,null))[_0xda0d('0x41')](handleError(_0xf59f53,null));};exports[_0xda0d('0x26')]=function(_0x383d8a,_0x30205b){return db['CmCustomField'][_0xda0d('0x45')]({'where':{'id':_0x383d8a[_0xda0d('0x47')]['id']}})[_0xda0d('0x25')](handleEntityNotFound(_0x30205b,null))[_0xda0d('0x25')](removeEntity(_0x30205b,null))[_0xda0d('0x41')](handleError(_0x30205b,null));};exports[_0xda0d('0x48')]=function(_0xf0ad7f,_0x18f16a){var _0x4e6778;return db[_0xda0d('0x49')][_0xda0d('0x4a')](function(_0xecd2b7){return db[_0xda0d('0x2a')][_0xda0d('0x48')](_0xf0ad7f[_0xda0d('0x46')],{'transaction':_0xecd2b7})[_0xda0d('0x25')](function(_0x404111){_0x4e6778=_0x404111;var _0x1c8d2f={'type':db[_0xda0d('0x4b')][_0xda0d('0x4c')],'transaction':_0xecd2b7};switch(_0xf0ad7f[_0xda0d('0x46')][_0xda0d('0x2c')]){case _0xda0d('0x4d'):_0x1c8d2f[_0xda0d('0x2c')]=db[_0xda0d('0x4b')][_0xda0d('0x4c')];break;case _0xda0d('0x4e'):_0x1c8d2f[_0xda0d('0x2c')]=db[_0xda0d('0x4b')][_0xda0d('0x4f')];break;case'switch':_0x1c8d2f[_0xda0d('0x2c')]=db[_0xda0d('0x4b')]['BOOLEAN'];_0x1c8d2f[_0xda0d('0x50')]=![];break;default:}return db[_0xda0d('0x49')][_0xda0d('0x51')][_0xda0d('0x52')]('cm_contacts',util['format'](_0xda0d('0x53'),_0x4e6778['id']),_0x1c8d2f);})[_0xda0d('0x25')](function(){return _0x4e6778;});})['then'](respondWithResult(_0x18f16a,0xc9))['catch'](handleError(_0x18f16a,null));}; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.model.js b/server/api/cmCustomField/cmCustomField.model.js index 9b3504f..3c4a5a8 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 _0x1c3d=['util','../../config/logger','api','moment','bluebird','rimraf','../../config/environment','./cmCustomField.attributes','exports','CmCustomField','cm_custom_fields'];(function(_0x2aea9e,_0x1f587f){var _0x430b92=function(_0x416c37){while(--_0x416c37){_0x2aea9e['push'](_0x2aea9e['shift']());}};_0x430b92(++_0x1f587f);}(_0x1c3d,0x1b8));var _0xd1c3=function(_0x4d89fd,_0x411fe1){_0x4d89fd=_0x4d89fd-0x0;var _0x3262a6=_0x1c3d[_0x4d89fd];return _0x3262a6;};'use strict';var _=require('lodash');var util=require(_0xd1c3('0x0'));var logger=require(_0xd1c3('0x1'))(_0xd1c3('0x2'));var moment=require(_0xd1c3('0x3'));var BPromise=require(_0xd1c3('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xd1c3('0x5'));var config=require(_0xd1c3('0x6'));var attributes=require(_0xd1c3('0x7'));module[_0xd1c3('0x8')]=function(_0x14093d,_0x391a41){return _0x14093d['define'](_0xd1c3('0x9'),attributes,{'tableName':_0xd1c3('0xa'),'paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x153c=['lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./cmCustomField.attributes','exports','define','CmCustomField','cm_custom_fields'];(function(_0x1ba480,_0x6586a8){var _0x7ce11f=function(_0x3bfb9d){while(--_0x3bfb9d){_0x1ba480['push'](_0x1ba480['shift']());}};_0x7ce11f(++_0x6586a8);}(_0x153c,0x8c));var _0xc153=function(_0x1deb62,_0xc72101){_0x1deb62=_0x1deb62-0x0;var _0x54271b=_0x153c[_0x1deb62];return _0x54271b;};'use strict';var _=require(_0xc153('0x0'));var util=require(_0xc153('0x1'));var logger=require(_0xc153('0x2'))(_0xc153('0x3'));var moment=require('moment');var BPromise=require(_0xc153('0x4'));var rp=require(_0xc153('0x5'));var fs=require('fs');var path=require(_0xc153('0x6'));var rimraf=require(_0xc153('0x7'));var config=require(_0xc153('0x8'));var attributes=require(_0xc153('0x9'));module[_0xc153('0xa')]=function(_0x58f5c5,_0x267a79){return _0x58f5c5[_0xc153('0xb')](_0xc153('0xc'),attributes,{'tableName':_0xc153('0xd'),'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 4b0f1f8..f7a16b4 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 _0x4d9e=['../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','CmCustomField,\x20%s,\x20%s,\x20%s','stringify','error','CmCustomField,\x20%s,\x20%s','message','catch','lodash','bluebird','ioredis','../../config/utils'];(function(_0xbf5e16,_0x146ce3){var _0x5975a5=function(_0x2387a7){while(--_0x2387a7){_0xbf5e16['push'](_0xbf5e16['shift']());}};_0x5975a5(++_0x146ce3);}(_0x4d9e,0x18c));var _0xe4d9=function(_0x27b93c,_0x36cbdf){_0x27b93c=_0x27b93c-0x0;var _0x1d6813=_0x4d9e[_0x27b93c];return _0x1d6813;};'use strict';var _=require(_0xe4d9('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xe4d9('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xe4d9('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0xe4d9('0x3'));var logger=require(_0xe4d9('0x4'))('rpc');var config=require(_0xe4d9('0x5'));var jayson=require(_0xe4d9('0x6'));var client=jayson[_0xe4d9('0x7')][_0xe4d9('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x125dbc,_0x32222c,_0x54a63a){return new BPromise(function(_0x36316f,_0x1d3810){return client[_0xe4d9('0x9')](_0x125dbc,_0x54a63a)[_0xe4d9('0xa')](function(_0x3f8937){logger[_0xe4d9('0xb')]('CmCustomField,\x20%s,\x20%s',_0x32222c,_0xe4d9('0xc'));logger[_0xe4d9('0xd')](_0xe4d9('0xe'),_0x32222c,_0xe4d9('0xc'),JSON[_0xe4d9('0xf')](_0x3f8937));if(_0x3f8937[_0xe4d9('0x10')]){if(_0x3f8937[_0xe4d9('0x10')]['code']===0x1f4){logger['error']('CmCustomField,\x20%s,\x20%s',_0x32222c,_0x3f8937['error']['message']);return _0x1d3810(_0x3f8937['error']['message']);}logger['error'](_0xe4d9('0x11'),_0x32222c,_0x3f8937[_0xe4d9('0x10')][_0xe4d9('0x12')]);return _0x36316f(_0x3f8937['error'][_0xe4d9('0x12')]);}else{logger[_0xe4d9('0xb')](_0xe4d9('0x11'),_0x32222c,_0xe4d9('0xc'));_0x36316f(_0x3f8937['result'][_0xe4d9('0x12')]);}})[_0xe4d9('0x13')](function(_0x4687f8){logger['error']('CmCustomField,\x20%s,\x20%s',_0x32222c,_0x4687f8);_0x1d3810(_0x4687f8);});});} \ No newline at end of file +var _0x984b=['CmCustomField,\x20%s,\x20%s','request\x20sent','debug','CmCustomField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','bluebird','randomstring','ioredis','../../config/logger','rpc','client','http','then','info'];(function(_0x52b56c,_0x1eb8f9){var _0x2db252=function(_0xec0cb0){while(--_0xec0cb0){_0x52b56c['push'](_0x52b56c['shift']());}};_0x2db252(++_0x1eb8f9);}(_0x984b,0xee));var _0xb984=function(_0x2fb217,_0x43c114){_0x2fb217=_0x2fb217-0x0;var _0x5c6e11=_0x984b[_0x2fb217];return _0x5c6e11;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0xb984('0x0'));var rs=require(_0xb984('0x1'));var fs=require('fs');var Redis=require(_0xb984('0x2'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xb984('0x3'))(_0xb984('0x4'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xb984('0x5')][_0xb984('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x5a605a,_0x7405cd,_0x1a00d6){return new BPromise(function(_0x4d72b7,_0x37fd36){return client['request'](_0x5a605a,_0x1a00d6)[_0xb984('0x7')](function(_0x42dfd9){logger[_0xb984('0x8')](_0xb984('0x9'),_0x7405cd,_0xb984('0xa'));logger[_0xb984('0xb')](_0xb984('0xc'),_0x7405cd,_0xb984('0xa'),JSON[_0xb984('0xd')](_0x42dfd9));if(_0x42dfd9[_0xb984('0xe')]){if(_0x42dfd9[_0xb984('0xe')][_0xb984('0xf')]===0x1f4){logger['error'](_0xb984('0x9'),_0x7405cd,_0x42dfd9['error'][_0xb984('0x10')]);return _0x37fd36(_0x42dfd9[_0xb984('0xe')]['message']);}logger[_0xb984('0xe')](_0xb984('0x9'),_0x7405cd,_0x42dfd9['error'][_0xb984('0x10')]);return _0x4d72b7(_0x42dfd9[_0xb984('0xe')]['message']);}else{logger[_0xb984('0x8')](_0xb984('0x9'),_0x7405cd,'request\x20sent');_0x4d72b7(_0x42dfd9[_0xb984('0x11')]['message']);}})[_0xb984('0x12')](function(_0x1dc4df){logger[_0xb984('0xe')](_0xb984('0x9'),_0x7405cd,_0x1dc4df);_0x37fd36(_0x1dc4df);});});} \ No newline at end of file diff --git a/server/api/cmCustomField/index.js b/server/api/cmCustomField/index.js index 0bc6032..bc4f153 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 _0xeb54=['./cmCustomField.controller','get','index','/:id','isAuthenticated','show','post','create','put','update','delete','destroy','multer','util','path','connect-timeout','express','Router','../../components/auth/service'];(function(_0x5c397c,_0x2ef1f4){var _0x5be5c7=function(_0x118bd8){while(--_0x118bd8){_0x5c397c['push'](_0x5c397c['shift']());}};_0x5be5c7(++_0x2ef1f4);}(_0xeb54,0xb7));var _0x4eb5=function(_0x51a1ca,_0x22fd11){_0x51a1ca=_0x51a1ca-0x0;var _0x35f0f8=_0xeb54[_0x51a1ca];return _0x35f0f8;};'use strict';var multer=require(_0x4eb5('0x0'));var util=require(_0x4eb5('0x1'));var path=require(_0x4eb5('0x2'));var timeout=require(_0x4eb5('0x3'));var express=require(_0x4eb5('0x4'));var router=express[_0x4eb5('0x5')]();var auth=require(_0x4eb5('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x4eb5('0x7'));router[_0x4eb5('0x8')]('/',auth['isAuthenticated'](),controller[_0x4eb5('0x9')]);router[_0x4eb5('0x8')](_0x4eb5('0xa'),auth[_0x4eb5('0xb')](),controller[_0x4eb5('0xc')]);router[_0x4eb5('0xd')]('/',auth[_0x4eb5('0xb')](),controller[_0x4eb5('0xe')]);router[_0x4eb5('0xf')](_0x4eb5('0xa'),auth[_0x4eb5('0xb')](),controller[_0x4eb5('0x10')]);router[_0x4eb5('0x11')](_0x4eb5('0xa'),auth[_0x4eb5('0xb')](),controller[_0x4eb5('0x12')]);module['exports']=router; \ No newline at end of file +var _0x87cd=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmCustomField.controller','get','isAuthenticated','index','/:id','post','create','put','update','delete','multer','util','path','express'];(function(_0x127a60,_0x37f33a){var _0xc1f6a3=function(_0x8ed035){while(--_0x8ed035){_0x127a60['push'](_0x127a60['shift']());}};_0xc1f6a3(++_0x37f33a);}(_0x87cd,0xe6));var _0xd87c=function(_0x3e18a6,_0x5f2dcf){_0x3e18a6=_0x3e18a6-0x0;var _0x52fa2e=_0x87cd[_0x3e18a6];return _0x52fa2e;};'use strict';var multer=require(_0xd87c('0x0'));var util=require(_0xd87c('0x1'));var path=require(_0xd87c('0x2'));var timeout=require('connect-timeout');var express=require(_0xd87c('0x3'));var router=express[_0xd87c('0x4')]();var auth=require(_0xd87c('0x5'));var interaction=require(_0xd87c('0x6'));var config=require(_0xd87c('0x7'));var controller=require(_0xd87c('0x8'));router[_0xd87c('0x9')]('/',auth[_0xd87c('0xa')](),controller[_0xd87c('0xb')]);router[_0xd87c('0x9')](_0xd87c('0xc'),auth['isAuthenticated'](),controller['show']);router[_0xd87c('0xd')]('/',auth[_0xd87c('0xa')](),controller[_0xd87c('0xe')]);router[_0xd87c('0xf')]('/:id',auth[_0xd87c('0xa')](),controller[_0xd87c('0x10')]);router[_0xd87c('0x11')]('/:id',auth[_0xd87c('0xa')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.attributes.js b/server/api/cmHopper/cmHopper.attributes.js index a6a2286..a677ef5 100644 --- a/server/api/cmHopper/cmHopper.attributes.js +++ b/server/api/cmHopper/cmHopper.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2675=['YYYY-MM-DD\x20HH:mm:ss','INTEGER','STRING','UNSIGNED','contactListQueue','moment','BOOLEAN','DATE'];(function(_0xa17204,_0x441d32){var _0x542e34=function(_0x589901){while(--_0x589901){_0xa17204['push'](_0xa17204['shift']());}};_0x542e34(++_0x441d32);}(_0x2675,0x75));var _0x5267=function(_0xc53012,_0x22b0f0){_0xc53012=_0xc53012-0x0;var _0x23fb3b=_0x2675[_0xc53012];return _0x23fb3b;};'use strict';var moment=require(_0x5267('0x0'));var Sequelize=require('sequelize');module['exports']={'phone':{'type':Sequelize['STRING'],'allowNull':![]},'active':{'type':Sequelize[_0x5267('0x1')],'defaultValue':![]},'scheduledat':{'type':Sequelize[_0x5267('0x2')],'defaultValue':moment()['format'](_0x5267('0x3'))},'countbusyretry':{'type':Sequelize[_0x5267('0x4')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x5267('0x4')],'defaultValue':0x0},'callback':{'type':Sequelize[_0x5267('0x1')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x5267('0x5')],'defaultValue':null},'callbackat':{'type':Sequelize[_0x5267('0x2')]},'priority':{'type':Sequelize[_0x5267('0x4')](0x2)[_0x5267('0x6')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'recallme':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'ContactId':{'type':Sequelize[_0x5267('0x4')],'unique':_0x5267('0x7')},'ListId':{'type':Sequelize['INTEGER'],'unique':_0x5267('0x7')},'UserId':{'type':Sequelize['INTEGER']},'VoiceQueueId':{'type':Sequelize[_0x5267('0x4')],'unique':_0x5267('0x7')},'CampaignId':{'type':Sequelize[_0x5267('0x4')]},'countnosuchnumberretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x5267('0x4')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x5267('0x4')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'dialTimezone':{'type':Sequelize[_0x5267('0x5')]}}; \ No newline at end of file +var _0xf494=['YYYY-MM-DD\x20HH:mm:ss','INTEGER','STRING','contactListQueue','moment','sequelize','exports','BOOLEAN','DATE','format'];(function(_0x1966e0,_0xe513a4){var _0x1caff2=function(_0x491368){while(--_0x491368){_0x1966e0['push'](_0x1966e0['shift']());}};_0x1caff2(++_0xe513a4);}(_0xf494,0x1c6));var _0x4f49=function(_0x317698,_0xd8d128){_0x317698=_0x317698-0x0;var _0x2c8969=_0xf494[_0x317698];return _0x2c8969;};'use strict';var moment=require(_0x4f49('0x0'));var Sequelize=require(_0x4f49('0x1'));module[_0x4f49('0x2')]={'phone':{'type':Sequelize['STRING'],'allowNull':![]},'active':{'type':Sequelize[_0x4f49('0x3')],'defaultValue':![]},'scheduledat':{'type':Sequelize[_0x4f49('0x4')],'defaultValue':moment()[_0x4f49('0x5')](_0x4f49('0x6'))},'countbusyretry':{'type':Sequelize[_0x4f49('0x7')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x4f49('0x7')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x4f49('0x7')],'defaultValue':0x0},'callback':{'type':Sequelize[_0x4f49('0x3')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x4f49('0x8')],'defaultValue':null},'callbackat':{'type':Sequelize[_0x4f49('0x4')]},'priority':{'type':Sequelize[_0x4f49('0x7')](0x2)['UNSIGNED'],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'recallme':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'ContactId':{'type':Sequelize[_0x4f49('0x7')],'unique':_0x4f49('0x9')},'ListId':{'type':Sequelize[_0x4f49('0x7')],'unique':_0x4f49('0x9')},'UserId':{'type':Sequelize[_0x4f49('0x7')]},'VoiceQueueId':{'type':Sequelize[_0x4f49('0x7')],'unique':_0x4f49('0x9')},'CampaignId':{'type':Sequelize[_0x4f49('0x7')]},'countnosuchnumberretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x4f49('0x7')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x4f49('0x7')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x4f49('0x7')],'defaultValue':0x0},'dialTimezone':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.controller.js b/server/api/cmHopper/cmHopper.controller.js index 67193af..6e31435 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 _0xd9cb=['dialActive','error','getOpenContacts','timezones','push','utcOffset','getTimezone','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','path','ejs','lodash','squel','crypto','desk.js','to-csv','querystring','papaparse','ioredis','../../config/environment','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','sendStatus','end','status','json','count','offset','limit','set','Content-Range','reject','update','then','destroy','stack','name','send','map','CmHopper','rawAttributes','fieldName','type','query','keys','intersection','model','filters','concat','$and','$or','$gte','$lt','$lte','$ne','$eq','$between','$in','$notIn','$like','$notLike','$iLike','$notILike','$overlap','$contains','$contained','$any','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','includeAll','include','findAll','rows','catch','length','find','create','body','params','describe','VoiceQueueId','CampaignId','VoiceQueue','Campaign','omit','updatedAt','state','deleted','membername','user','UserId','deletedat','YYYY-MM-DD\x20HH:mm:ss','queue','ivr','CmContact','ContactId','firstName','lastName','isNil','calleridname','finally','CmHopperFinal','getPreview','getVoiceQueues','outbound','preview','sequelize','transaction','direction','prev','hopperIds','ASC','scheduledAt','dialOrderByScheduledAt','DESC','isEmpty','priority','literal','COALESCE(CmHopper.UserId,\x200)\x20DESC','scheduledat','LOCK','UPDATE','Contact','CmCompany','Company','CmList','List','Queue'];(function(_0x5d7c33,_0x4e96e2){var _0x376f06=function(_0x483e07){while(--_0x483e07){_0x5d7c33['push'](_0x5d7c33['shift']());}};_0x376f06(++_0x4e96e2);}(_0xd9cb,0x127));var _0xbd9c=function(_0x6d60a4,_0x42ffce){_0x6d60a4=_0x6d60a4-0x0;var _0x3a06ee=_0xd9cb[_0x6d60a4];return _0x3a06ee;};'use strict';var pdf=require(_0xbd9c('0x0'));var emlformat=require(_0xbd9c('0x1'));var rimraf=require(_0xbd9c('0x2'));var zipdir=require(_0xbd9c('0x3'));var jsonpatch=require(_0xbd9c('0x4'));var rp=require('request-promise');var moment=require(_0xbd9c('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xbd9c('0x6'));var util=require('util');var path=require(_0xbd9c('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xbd9c('0x8'));var fs=require('fs');var _=require(_0xbd9c('0x9'));var squel=require(_0xbd9c('0xa'));var crypto=require(_0xbd9c('0xb'));var jsforce=require('jsforce');var deskjs=require(_0xbd9c('0xc'));var toCsv=require(_0xbd9c('0xd'));var querystring=require(_0xbd9c('0xe'));var Papa=require(_0xbd9c('0xf'));var Redis=require(_0xbd9c('0x10'));var shared=require(_0xbd9c('0x11'));var authService=require(_0xbd9c('0x12'));var qs=require(_0xbd9c('0x13'));var as=require(_0xbd9c('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xbd9c('0x15'));var utils=require('../../config/utils');var config=require(_0xbd9c('0x11'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2cb239,_0x5f1b6e){_0x5f1b6e=_0x5f1b6e||0xcc;return function(_0x1cee09){if(_0x1cee09){return _0x2cb239[_0xbd9c('0x16')](_0x5f1b6e);}return _0x2cb239['status'](_0x5f1b6e)[_0xbd9c('0x17')]();};}function respondWithResult(_0x5d2443,_0x594cc3){_0x594cc3=_0x594cc3||0xc8;return function(_0x1081d6){if(_0x1081d6){return _0x5d2443[_0xbd9c('0x18')](_0x594cc3)[_0xbd9c('0x19')](_0x1081d6);}};}function respondWithFilteredResult(_0x57fb57,_0x4266b3){return function(_0x2811f9){if(_0x2811f9){var _0x5a6a82=_0x2811f9[_0xbd9c('0x1a')],_0xd47981=_0x4266b3['offset'],_0x198676=_0x4266b3[_0xbd9c('0x1b')]+_0x4266b3[_0xbd9c('0x1c')],_0x402008;if(_0x198676>=_0x5a6a82){_0x198676=_0x5a6a82;_0x402008=0xc8;}else{_0x402008=0xce;}_0x57fb57[_0xbd9c('0x18')](_0x402008);return _0x57fb57[_0xbd9c('0x1d')](_0xbd9c('0x1e'),_0xd47981+'-'+_0x198676+'/'+_0x5a6a82)[_0xbd9c('0x19')](_0x2811f9);}return null;};}function patchUpdates(_0x215634){return function(_0x36cf34){try{jsonpatch['apply'](_0x36cf34,_0x215634,!![]);}catch(_0x2e93ca){return BPromise[_0xbd9c('0x1f')](_0x2e93ca);}return _0x36cf34['save']();};}function saveUpdates(_0x2df1ca,_0x338839){return function(_0x3771dc){if(_0x3771dc){return _0x3771dc[_0xbd9c('0x20')](_0x2df1ca)[_0xbd9c('0x21')](function(_0x3e1efb){return _0x3e1efb;});}return null;};}function removeEntity(_0x5957c0,_0x4f020c){return function(_0x5c4798){if(_0x5c4798){return _0x5c4798[_0xbd9c('0x22')]()[_0xbd9c('0x21')](function(){_0x5957c0[_0xbd9c('0x18')](0xcc)[_0xbd9c('0x17')]();});}};}function handleEntityNotFound(_0xd22837,_0x3a23c1){return function(_0x1c7515){if(!_0x1c7515){_0xd22837['sendStatus'](0x194);}return _0x1c7515;};}function handleError(_0x5cfd63,_0x317736){_0x317736=_0x317736||0x1f4;return function(_0x2e7562){logger['error'](_0x2e7562[_0xbd9c('0x23')]);if(_0x2e7562['name']){delete _0x2e7562[_0xbd9c('0x24')];}_0x5cfd63['status'](_0x317736)[_0xbd9c('0x25')](_0x2e7562);};}exports['index']=function(_0x3ca64d,_0x5e7b64){var _0x449d71={},_0x10bc4d={},_0x51d811={'count':0x0,'rows':[]};var _0x4118df=_[_0xbd9c('0x26')](db[_0xbd9c('0x27')][_0xbd9c('0x28')],function(_0x4e563f){return{'name':_0x4e563f[_0xbd9c('0x29')],'type':_0x4e563f[_0xbd9c('0x2a')]['key']};});_0x10bc4d['model']=_['map'](_0x4118df,_0xbd9c('0x24'));_0x10bc4d[_0xbd9c('0x2b')]=_[_0xbd9c('0x2c')](_0x3ca64d[_0xbd9c('0x2b')]);_0x10bc4d['filters']=_[_0xbd9c('0x2d')](_0x10bc4d[_0xbd9c('0x2e')],_0x10bc4d[_0xbd9c('0x2b')]);_0x10bc4d[_0xbd9c('0x2f')]=_[_0xbd9c('0x30')](_0x10bc4d[_0xbd9c('0x2f')],[_0xbd9c('0x31'),_0xbd9c('0x32'),'$gt',_0xbd9c('0x33'),_0xbd9c('0x34'),_0xbd9c('0x35'),_0xbd9c('0x36'),_0xbd9c('0x37'),'$not',_0xbd9c('0x38'),'$notBetween',_0xbd9c('0x39'),_0xbd9c('0x3a'),_0xbd9c('0x3b'),_0xbd9c('0x3c'),_0xbd9c('0x3d'),_0xbd9c('0x3e'),_0xbd9c('0x3b'),_0xbd9c('0x3f'),_0xbd9c('0x40'),_0xbd9c('0x41'),_0xbd9c('0x42')]);_0x449d71[_0xbd9c('0x43')]=_[_0xbd9c('0x2d')](_0x10bc4d[_0xbd9c('0x2e')],qs[_0xbd9c('0x44')](_0x3ca64d[_0xbd9c('0x2b')][_0xbd9c('0x44')]));_0x449d71[_0xbd9c('0x43')]=_0x449d71['attributes']['length']?_0x449d71['attributes']:_0x10bc4d[_0xbd9c('0x2e')];if(!_0x3ca64d[_0xbd9c('0x2b')][_0xbd9c('0x45')](_0xbd9c('0x46'))){_0x449d71['limit']=qs[_0xbd9c('0x1c')](_0x3ca64d['query']['limit']);_0x449d71[_0xbd9c('0x1b')]=qs[_0xbd9c('0x1b')](_0x3ca64d[_0xbd9c('0x2b')]['offset']);}_0x449d71[_0xbd9c('0x47')]=qs[_0xbd9c('0x48')](_0x3ca64d['query'][_0xbd9c('0x48')]);_0x449d71[_0xbd9c('0x49')]=qs[_0xbd9c('0x2f')](_[_0xbd9c('0x4a')](_0x3ca64d['query'],_0x10bc4d['filters']),_0x4118df);if(_0x3ca64d[_0xbd9c('0x2b')][_0xbd9c('0x4b')]){_0x449d71[_0xbd9c('0x49')]=_[_0xbd9c('0x4c')](_0x449d71[_0xbd9c('0x49')],{'$or':_[_0xbd9c('0x26')](_0x4118df,function(_0x52bc5b){if(_0x52bc5b[_0xbd9c('0x2a')]!=='VIRTUAL'){var _0x18171a={};_0x18171a[_0x52bc5b[_0xbd9c('0x24')]]={'$like':'%'+_0x3ca64d['query'][_0xbd9c('0x4b')]+'%'};return _0x18171a;}})});}_0x449d71=_[_0xbd9c('0x4c')]({},_0x449d71,_0x3ca64d['options']);var _0x20de85={'where':_0x449d71[_0xbd9c('0x49')]};return db[_0xbd9c('0x27')]['count'](_0x20de85)[_0xbd9c('0x21')](function(_0x1b62f5){_0x51d811['count']=_0x1b62f5;if(_0x3ca64d[_0xbd9c('0x2b')][_0xbd9c('0x4d')]){_0x449d71[_0xbd9c('0x4e')]=[{'all':!![]}];}return db[_0xbd9c('0x27')][_0xbd9c('0x4f')](_0x449d71);})[_0xbd9c('0x21')](function(_0x17867c){_0x51d811[_0xbd9c('0x50')]=_0x17867c;return _0x51d811;})[_0xbd9c('0x21')](respondWithFilteredResult(_0x5e7b64,_0x449d71))[_0xbd9c('0x51')](handleError(_0x5e7b64,null));};exports['show']=function(_0x3cd533,_0x44b959){var _0xab14a3={'raw':!![],'where':{'id':_0x3cd533['params']['id']}},_0x1714d3={};_0x1714d3['model']=_[_0xbd9c('0x2c')](db[_0xbd9c('0x27')][_0xbd9c('0x28')]);_0x1714d3[_0xbd9c('0x2b')]=_[_0xbd9c('0x2c')](_0x3cd533[_0xbd9c('0x2b')]);_0x1714d3[_0xbd9c('0x2f')]=_[_0xbd9c('0x2d')](_0x1714d3[_0xbd9c('0x2e')],_0x1714d3[_0xbd9c('0x2b')]);_0xab14a3[_0xbd9c('0x43')]=_[_0xbd9c('0x2d')](_0x1714d3['model'],qs['fields'](_0x3cd533['query'][_0xbd9c('0x44')]));_0xab14a3[_0xbd9c('0x43')]=_0xab14a3['attributes'][_0xbd9c('0x52')]?_0xab14a3[_0xbd9c('0x43')]:_0x1714d3[_0xbd9c('0x2e')];if(_0x3cd533[_0xbd9c('0x2b')]['includeAll']){_0xab14a3[_0xbd9c('0x4e')]=[{'all':!![]}];}_0xab14a3=_[_0xbd9c('0x4c')]({},_0xab14a3,_0x3cd533['options']);return db[_0xbd9c('0x27')][_0xbd9c('0x53')](_0xab14a3)[_0xbd9c('0x21')](handleEntityNotFound(_0x44b959,null))['then'](respondWithResult(_0x44b959,null))['catch'](handleError(_0x44b959,null));};exports[_0xbd9c('0x54')]=function(_0x214ce9,_0x2d6f83){return db[_0xbd9c('0x27')]['create'](_0x214ce9[_0xbd9c('0x55')],{})[_0xbd9c('0x21')](respondWithResult(_0x2d6f83,0xc9))[_0xbd9c('0x51')](handleError(_0x2d6f83,null));};exports[_0xbd9c('0x20')]=function(_0x177ad5,_0x12d396){if(_0x177ad5[_0xbd9c('0x55')]['id']){delete _0x177ad5['body']['id'];}return db['CmHopper'][_0xbd9c('0x53')]({'where':{'id':_0x177ad5[_0xbd9c('0x56')]['id']}})['then'](handleEntityNotFound(_0x12d396,null))[_0xbd9c('0x21')](saveUpdates(_0x177ad5[_0xbd9c('0x55')],null))[_0xbd9c('0x21')](respondWithResult(_0x12d396,null))['catch'](handleError(_0x12d396,null));};exports[_0xbd9c('0x57')]=function(_0xb5f83b,_0x5dee9d){return db[_0xbd9c('0x27')]['describe']()[_0xbd9c('0x21')](respondWithResult(_0x5dee9d,null))['catch'](handleError(_0x5dee9d,null));};exports[_0xbd9c('0x22')]=function(_0x5ae87d,_0x112d5c){var _0x5d9ce2;return db['CmHopper']['find']({'where':{'id':_0x5ae87d[_0xbd9c('0x56')]['id']}})['then'](handleEntityNotFound(_0x112d5c,null))[_0xbd9c('0x21')](function(_0x88a008){if(_0x88a008){return _0x88a008[_0xbd9c('0x22')]()[_0xbd9c('0x21')](function(_0x1a9bb7){return _0x1a9bb7;});}})[_0xbd9c('0x21')](function(_0x3cb20f){_0x5d9ce2=_0x3cb20f;if(_0x3cb20f){if(_0x3cb20f[_0xbd9c('0x58')]||_0x3cb20f[_0xbd9c('0x59')]){return db[_0x3cb20f['VoiceQueueId']?_0xbd9c('0x5a'):_0xbd9c('0x5b')][_0xbd9c('0x53')]({'where':{'id':_0x3cb20f[_0xbd9c('0x58')]?_0x3cb20f[_0xbd9c('0x58')]:_0x3cb20f['CampaignId']},'attributes':['id','name'],'raw':!![]});}}})[_0xbd9c('0x21')](function(_0x4198a2){var _0x2b01ff={};if(_0x4198a2){_[_0xbd9c('0x4c')](_0x2b01ff,_[_0xbd9c('0x5c')](_0x5d9ce2['dataValues'],['createdAt',_0xbd9c('0x5d'),'id']));_0x2b01ff[_0xbd9c('0x5e')]=0x15;_0x2b01ff['statedesc']=_0xbd9c('0x5f');_0x2b01ff['campaign']=_0x4198a2[_0xbd9c('0x24')];_0x2b01ff[_0xbd9c('0x60')]=_0x5ae87d[_0xbd9c('0x61')][_0xbd9c('0x24')];_0x2b01ff[_0xbd9c('0x62')]=_0x5ae87d[_0xbd9c('0x61')]['id'];_0x2b01ff[_0xbd9c('0x5f')]=!![];_0x2b01ff[_0xbd9c('0x63')]=moment()['format'](_0xbd9c('0x64'));_0x2b01ff['calleridnum']=_0x5d9ce2['phone'];_0x2b01ff['campaigntype']=_0x5d9ce2[_0xbd9c('0x58')]?_0xbd9c('0x65'):_0xbd9c('0x66');return db[_0xbd9c('0x67')][_0xbd9c('0x53')]({'where':{'id':_0x2b01ff[_0xbd9c('0x68')]},'attributes':[_0xbd9c('0x69'),_0xbd9c('0x6a')]})[_0xbd9c('0x21')](function(_0x5486a3){if(!_[_0xbd9c('0x6b')](_0x112d5c)&&!_[_0xbd9c('0x6b')](_0x5486a3[_0xbd9c('0x69')])){_0x2b01ff['calleridname']=_0x5486a3[_0xbd9c('0x69')];if(!_[_0xbd9c('0x6b')](_0x5486a3[_0xbd9c('0x6a')])){_0x2b01ff[_0xbd9c('0x6c')]+='\x20'+_0x5486a3[_0xbd9c('0x6a')];}}})[_0xbd9c('0x6d')](function(){return db[_0xbd9c('0x6e')][_0xbd9c('0x54')](_0x2b01ff);});}})[_0xbd9c('0x21')](function(){return _0x112d5c['status'](0xcc)[_0xbd9c('0x17')]();})[_0xbd9c('0x51')](handleError(_0x112d5c,null));};exports[_0xbd9c('0x6f')]=function(_0x59011f,_0x60303,_0x35eb79){var _0x350b13=[];return db['CmContact']['describe']()[_0xbd9c('0x21')](function(_0x411742){_0x350b13=_[_0xbd9c('0x2c')](_0x411742);return _0x59011f[_0xbd9c('0x61')][_0xbd9c('0x70')]({'where':{'type':_0xbd9c('0x71'),'dialActive':!![],'dialMethod':_0xbd9c('0x72')},'attributes':['id','dialOrderByScheduledAt'],'raw':!![]});})['then'](function(_0x299ce8){if(_0x299ce8&&_0x299ce8[_0xbd9c('0x52')]){return db[_0xbd9c('0x73')][_0xbd9c('0x74')](function(_0x34d02e){var _0x33f9a1={'active':![],'recallme':![],'scheduledAt':{'$lte':moment()['format'](_0xbd9c('0x64'))},'VoiceQueueId':{'$in':_[_0xbd9c('0x26')](_0x299ce8,'id')},'$or':[{'UserId':null},{'UserId':_0x59011f[_0xbd9c('0x61')]['id']}]};var _0x33477a=[];if(_0x59011f[_0xbd9c('0x55')]['direction']&&_0x59011f[_0xbd9c('0x55')][_0xbd9c('0x75')]===_0xbd9c('0x76')){if(!_['isEmpty'](_0x59011f[_0xbd9c('0x55')][_0xbd9c('0x77')])){_0x33f9a1['id']={'$in':_0x59011f['body']['hopperIds']};}_0x33477a=[['priority',_0xbd9c('0x78')],[_0xbd9c('0x79'),_0x299ce8[0x0][_0xbd9c('0x7a')]===_0xbd9c('0x78')?_0xbd9c('0x7b'):_0xbd9c('0x78')],db[_0xbd9c('0x73')]['literal']('COALESCE(CmHopper.UserId,\x200)\x20ASC'),['id','DESC']];}else{if(!_[_0xbd9c('0x7c')](_0x59011f[_0xbd9c('0x55')]['hopperIds'])){_0x33f9a1['id']={'$notIn':_0x59011f[_0xbd9c('0x55')][_0xbd9c('0x77')]};}_0x33477a=[[_0xbd9c('0x7d'),_0xbd9c('0x7b')],[_0xbd9c('0x79'),_0x299ce8[0x0][_0xbd9c('0x7a')]],db['sequelize'][_0xbd9c('0x7e')](_0xbd9c('0x7f')),['id',_0xbd9c('0x78')]];}return db['CmHopper']['findOne']({'attributes':['id',_0xbd9c('0x80')],'where':_0x33f9a1,'order':_0x33477a,'transaction':_0x34d02e,'lock':_0x34d02e[_0xbd9c('0x81')][_0xbd9c('0x82')],'include':[{'model':db[_0xbd9c('0x67')],'as':_0xbd9c('0x83'),'attributes':_0x350b13,'include':[{'model':db[_0xbd9c('0x84')],'as':_0xbd9c('0x85'),'attributes':['id',_0xbd9c('0x24')]}]},{'model':db[_0xbd9c('0x86')],'as':_0xbd9c('0x87'),'attributes':['id',_0xbd9c('0x24')]},{'model':db[_0xbd9c('0x5a')],'as':_0xbd9c('0x88'),'attributes':['id',_0xbd9c('0x24'),_0xbd9c('0x89')]}]})[_0xbd9c('0x21')](function(_0x4ca638){if(_0x4ca638){return _0x4ca638[_0xbd9c('0x20')]({'UserId':_0x59011f[_0xbd9c('0x61')]['id']},{'transaction':_0x34d02e});}});});}})[_0xbd9c('0x21')](handleEntityNotFound(_0x60303,null))[_0xbd9c('0x21')](respondWithResult(_0x60303,null))[_0xbd9c('0x51')](handleError(_0x60303,null));};exports['getOpenContacts']=function(_0x19812b,_0xedb1d6,_0x1a2e7a){return _0x19812b[_0xbd9c('0x61')]['getVoiceQueues']({'where':{'type':_0xbd9c('0x71'),'dialActive':!![],'dialMethod':'preview'},'attributes':['id'],'raw':!![]})[_0xbd9c('0x21')](function(_0x161b00){if(_0x161b00&&_0x161b00[_0xbd9c('0x52')]){return db[_0xbd9c('0x27')][_0xbd9c('0x1a')]({'where':{'active':![],'recallme':![],'scheduledAt':{'$lte':moment()['format'](_0xbd9c('0x64'))},'VoiceQueueId':{'$in':_[_0xbd9c('0x26')](_0x161b00,'id')},'$or':[{'UserId':null},{'UserId':_0x19812b[_0xbd9c('0x61')]['id']}]}});}return 0x0;})['then'](function(_0x34a3fc){if(!_[_0xbd9c('0x6b')](_0x34a3fc)&&_['isNumber'](_0x34a3fc)){return _0xedb1d6['status'](0xc8)[_0xbd9c('0x19')]({'contacts':_0x34a3fc});}else{logger[_0xbd9c('0x8a')]('CmHopper,\x20%s,\x20%s,\x20%s',_0xbd9c('0x8b'),0x194,'entity\x20not\x20found');_0xedb1d6[_0xbd9c('0x16')](0x194);}})['catch'](handleError(_0xedb1d6,null));};exports['getTimezones']=function(_0x122b91,_0x13e500,_0x548991){var _0x292d03=shared[_0xbd9c('0x8c')];var _0x3d4ffb=[];_[_0xbd9c('0x26')](_0x292d03,function(_0x4ae3bf){_0x3d4ffb[_0xbd9c('0x8d')]({'id':_0x4ae3bf['name'],'name':_0x4ae3bf['name'],'utcOffset':_0x4ae3bf[_0xbd9c('0x8e')]});});return _0x13e500[_0xbd9c('0x18')](0xc8)[_0xbd9c('0x19')]({'tz':_0x3d4ffb});};exports[_0xbd9c('0x8f')]=function(_0x428017,_0x3ad94f,_0xb979dc){var _0x5acd58=shared[_0xbd9c('0x8c')];var _0x393db8={};if(!_['isNil'](_0x5acd58[_0x428017[_0xbd9c('0x55')]['id']]))_0x393db8=_0x5acd58[_0x428017['body']['id']];return _0x3ad94f['status'](0xc8)[_0xbd9c('0x19')](_0x393db8);}; \ No newline at end of file +var _0x4ff5=['dialActive','getOpenContacts','outbound','error','CmHopper,\x20%s,\x20%s,\x20%s','entity\x20not\x20found','utcOffset','getTimezone','timezones','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','lodash','squel','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','set','Content-Range','reject','save','update','name','index','map','CmHopper','rawAttributes','fieldName','type','key','model','query','filters','concat','$or','$gt','$gte','$lt','$lte','$ne','$eq','$not','$between','$in','$notIn','$like','$notLike','$overlap','$contained','$any','attributes','intersection','fields','length','hasOwnProperty','limit','order','sort','where','pick','filter','VIRTUAL','options','then','includeAll','rows','catch','show','keys','include','merge','find','create','body','params','describe','destroy','VoiceQueueId','VoiceQueue','Campaign','omit','createdAt','state','membername','user','UserId','deleted','deletedat','phone','campaigntype','queue','ContactId','firstName','lastName','isNil','calleridname','CmHopperFinal','CmContact','getVoiceQueues','preview','dialOrderByScheduledAt','sequelize','transaction','format','YYYY-MM-DD\x20HH:mm:ss','direction','prev','hopperIds','priority','ASC','DESC','literal','COALESCE(CmHopper.UserId,\x200)\x20ASC','isEmpty','scheduledAt','findOne','scheduledat','LOCK','UPDATE','Contact','Company','List','Queue'];(function(_0x2664a5,_0x3dcd55){var _0x1d154c=function(_0x3e72ea){while(--_0x3e72ea){_0x2664a5['push'](_0x2664a5['shift']());}};_0x1d154c(++_0x3dcd55);}(_0x4ff5,0x9e));var _0x54ff=function(_0x3bf7c7,_0x3bf784){_0x3bf7c7=_0x3bf7c7-0x0;var _0x519fbc=_0x4ff5[_0x3bf7c7];return _0x519fbc;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x54ff('0x0'));var rimraf=require(_0x54ff('0x1'));var zipdir=require(_0x54ff('0x2'));var jsonpatch=require(_0x54ff('0x3'));var rp=require(_0x54ff('0x4'));var moment=require(_0x54ff('0x5'));var BPromise=require(_0x54ff('0x6'));var Mustache=require(_0x54ff('0x7'));var util=require(_0x54ff('0x8'));var path=require(_0x54ff('0x9'));var sox=require('sox');var csv=require(_0x54ff('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x54ff('0xb'));var squel=require(_0x54ff('0xc'));var crypto=require(_0x54ff('0xd'));var jsforce=require(_0x54ff('0xe'));var deskjs=require(_0x54ff('0xf'));var toCsv=require(_0x54ff('0xa'));var querystring=require(_0x54ff('0x10'));var Papa=require(_0x54ff('0x11'));var Redis=require(_0x54ff('0x12'));var shared=require(_0x54ff('0x13'));var authService=require(_0x54ff('0x14'));var qs=require(_0x54ff('0x15'));var as=require(_0x54ff('0x16'));var hardwareService=require(_0x54ff('0x17'));var logger=require(_0x54ff('0x18'))(_0x54ff('0x19'));var utils=require(_0x54ff('0x1a'));var config=require('../../config/environment');var db=require(_0x54ff('0x1b'))['db'];function respondWithStatusCode(_0x4b53f7,_0x280fcd){_0x280fcd=_0x280fcd||0xcc;return function(_0x544e3a){if(_0x544e3a){return _0x4b53f7[_0x54ff('0x1c')](_0x280fcd);}return _0x4b53f7[_0x54ff('0x1d')](_0x280fcd)[_0x54ff('0x1e')]();};}function respondWithResult(_0x5ee9f0,_0x134f57){_0x134f57=_0x134f57||0xc8;return function(_0x40a479){if(_0x40a479){return _0x5ee9f0[_0x54ff('0x1d')](_0x134f57)[_0x54ff('0x1f')](_0x40a479);}};}function respondWithFilteredResult(_0x198e3c,_0x3a349a){return function(_0x2b56b6){if(_0x2b56b6){var _0xc80601=_0x2b56b6[_0x54ff('0x20')],_0x156530=_0x3a349a['offset'],_0x11d802=_0x3a349a[_0x54ff('0x21')]+_0x3a349a['limit'],_0x383c6;if(_0x11d802>=_0xc80601){_0x11d802=_0xc80601;_0x383c6=0xc8;}else{_0x383c6=0xce;}_0x198e3c['status'](_0x383c6);return _0x198e3c[_0x54ff('0x22')](_0x54ff('0x23'),_0x156530+'-'+_0x11d802+'/'+_0xc80601)[_0x54ff('0x1f')](_0x2b56b6);}return null;};}function patchUpdates(_0x2c1f01){return function(_0xd60aee){try{jsonpatch['apply'](_0xd60aee,_0x2c1f01,!![]);}catch(_0x514319){return BPromise[_0x54ff('0x24')](_0x514319);}return _0xd60aee[_0x54ff('0x25')]();};}function saveUpdates(_0x4e52fb,_0x2bb1f3){return function(_0x59c936){if(_0x59c936){return _0x59c936[_0x54ff('0x26')](_0x4e52fb)['then'](function(_0x49719b){return _0x49719b;});}return null;};}function removeEntity(_0x47a90a,_0x453862){return function(_0xb60aed){if(_0xb60aed){return _0xb60aed['destroy']()['then'](function(){_0x47a90a['status'](0xcc)[_0x54ff('0x1e')]();});}};}function handleEntityNotFound(_0x424851,_0x2a146a){return function(_0x3ee4b3){if(!_0x3ee4b3){_0x424851['sendStatus'](0x194);}return _0x3ee4b3;};}function handleError(_0x12db16,_0x301685){_0x301685=_0x301685||0x1f4;return function(_0x245ffe){logger['error'](_0x245ffe['stack']);if(_0x245ffe[_0x54ff('0x27')]){delete _0x245ffe[_0x54ff('0x27')];}_0x12db16['status'](_0x301685)['send'](_0x245ffe);};}exports[_0x54ff('0x28')]=function(_0x1cdd39,_0x3d7ba3){var _0x4f64c1={},_0x10f35a={},_0x11f060={'count':0x0,'rows':[]};var _0x2e1602=_[_0x54ff('0x29')](db[_0x54ff('0x2a')][_0x54ff('0x2b')],function(_0x10afc1){return{'name':_0x10afc1[_0x54ff('0x2c')],'type':_0x10afc1[_0x54ff('0x2d')][_0x54ff('0x2e')]};});_0x10f35a[_0x54ff('0x2f')]=_['map'](_0x2e1602,_0x54ff('0x27'));_0x10f35a[_0x54ff('0x30')]=_['keys'](_0x1cdd39['query']);_0x10f35a['filters']=_['intersection'](_0x10f35a[_0x54ff('0x2f')],_0x10f35a[_0x54ff('0x30')]);_0x10f35a[_0x54ff('0x31')]=_[_0x54ff('0x32')](_0x10f35a[_0x54ff('0x31')],['$and',_0x54ff('0x33'),_0x54ff('0x34'),_0x54ff('0x35'),_0x54ff('0x36'),_0x54ff('0x37'),_0x54ff('0x38'),_0x54ff('0x39'),_0x54ff('0x3a'),_0x54ff('0x3b'),'$notBetween',_0x54ff('0x3c'),_0x54ff('0x3d'),_0x54ff('0x3e'),_0x54ff('0x3f'),'$iLike','$notILike',_0x54ff('0x3e'),_0x54ff('0x40'),'$contains',_0x54ff('0x41'),_0x54ff('0x42')]);_0x4f64c1[_0x54ff('0x43')]=_[_0x54ff('0x44')](_0x10f35a[_0x54ff('0x2f')],qs[_0x54ff('0x45')](_0x1cdd39[_0x54ff('0x30')][_0x54ff('0x45')]));_0x4f64c1[_0x54ff('0x43')]=_0x4f64c1[_0x54ff('0x43')][_0x54ff('0x46')]?_0x4f64c1[_0x54ff('0x43')]:_0x10f35a[_0x54ff('0x2f')];if(!_0x1cdd39['query'][_0x54ff('0x47')]('nolimit')){_0x4f64c1[_0x54ff('0x48')]=qs['limit'](_0x1cdd39[_0x54ff('0x30')]['limit']);_0x4f64c1[_0x54ff('0x21')]=qs[_0x54ff('0x21')](_0x1cdd39[_0x54ff('0x30')]['offset']);}_0x4f64c1[_0x54ff('0x49')]=qs[_0x54ff('0x4a')](_0x1cdd39[_0x54ff('0x30')][_0x54ff('0x4a')]);_0x4f64c1[_0x54ff('0x4b')]=qs[_0x54ff('0x31')](_[_0x54ff('0x4c')](_0x1cdd39[_0x54ff('0x30')],_0x10f35a[_0x54ff('0x31')]),_0x2e1602);if(_0x1cdd39[_0x54ff('0x30')][_0x54ff('0x4d')]){_0x4f64c1[_0x54ff('0x4b')]=_['merge'](_0x4f64c1[_0x54ff('0x4b')],{'$or':_[_0x54ff('0x29')](_0x2e1602,function(_0x595818){if(_0x595818[_0x54ff('0x2d')]!==_0x54ff('0x4e')){var _0x1cf595={};_0x1cf595[_0x595818[_0x54ff('0x27')]]={'$like':'%'+_0x1cdd39['query'][_0x54ff('0x4d')]+'%'};return _0x1cf595;}})});}_0x4f64c1=_['merge']({},_0x4f64c1,_0x1cdd39[_0x54ff('0x4f')]);var _0x5e8e07={'where':_0x4f64c1[_0x54ff('0x4b')]};return db[_0x54ff('0x2a')][_0x54ff('0x20')](_0x5e8e07)[_0x54ff('0x50')](function(_0x2b1cbc){_0x11f060[_0x54ff('0x20')]=_0x2b1cbc;if(_0x1cdd39[_0x54ff('0x30')][_0x54ff('0x51')]){_0x4f64c1['include']=[{'all':!![]}];}return db[_0x54ff('0x2a')]['findAll'](_0x4f64c1);})['then'](function(_0x2598cc){_0x11f060[_0x54ff('0x52')]=_0x2598cc;return _0x11f060;})[_0x54ff('0x50')](respondWithFilteredResult(_0x3d7ba3,_0x4f64c1))[_0x54ff('0x53')](handleError(_0x3d7ba3,null));};exports[_0x54ff('0x54')]=function(_0x38b6ef,_0x11b943){var _0x512e06={'raw':!![],'where':{'id':_0x38b6ef['params']['id']}},_0x3023e0={};_0x3023e0['model']=_[_0x54ff('0x55')](db[_0x54ff('0x2a')][_0x54ff('0x2b')]);_0x3023e0[_0x54ff('0x30')]=_['keys'](_0x38b6ef['query']);_0x3023e0['filters']=_[_0x54ff('0x44')](_0x3023e0[_0x54ff('0x2f')],_0x3023e0[_0x54ff('0x30')]);_0x512e06[_0x54ff('0x43')]=_[_0x54ff('0x44')](_0x3023e0['model'],qs[_0x54ff('0x45')](_0x38b6ef[_0x54ff('0x30')][_0x54ff('0x45')]));_0x512e06[_0x54ff('0x43')]=_0x512e06['attributes']['length']?_0x512e06[_0x54ff('0x43')]:_0x3023e0[_0x54ff('0x2f')];if(_0x38b6ef[_0x54ff('0x30')][_0x54ff('0x51')]){_0x512e06[_0x54ff('0x56')]=[{'all':!![]}];}_0x512e06=_[_0x54ff('0x57')]({},_0x512e06,_0x38b6ef[_0x54ff('0x4f')]);return db['CmHopper'][_0x54ff('0x58')](_0x512e06)[_0x54ff('0x50')](handleEntityNotFound(_0x11b943,null))[_0x54ff('0x50')](respondWithResult(_0x11b943,null))[_0x54ff('0x53')](handleError(_0x11b943,null));};exports['create']=function(_0x3d89fe,_0x52c4d9){return db[_0x54ff('0x2a')][_0x54ff('0x59')](_0x3d89fe[_0x54ff('0x5a')],{})[_0x54ff('0x50')](respondWithResult(_0x52c4d9,0xc9))[_0x54ff('0x53')](handleError(_0x52c4d9,null));};exports['update']=function(_0x143054,_0xcf1e0){if(_0x143054[_0x54ff('0x5a')]['id']){delete _0x143054[_0x54ff('0x5a')]['id'];}return db['CmHopper'][_0x54ff('0x58')]({'where':{'id':_0x143054[_0x54ff('0x5b')]['id']}})[_0x54ff('0x50')](handleEntityNotFound(_0xcf1e0,null))[_0x54ff('0x50')](saveUpdates(_0x143054[_0x54ff('0x5a')],null))[_0x54ff('0x50')](respondWithResult(_0xcf1e0,null))[_0x54ff('0x53')](handleError(_0xcf1e0,null));};exports[_0x54ff('0x5c')]=function(_0x5e4234,_0x475c39){return db['CmHopper'][_0x54ff('0x5c')]()['then'](respondWithResult(_0x475c39,null))[_0x54ff('0x53')](handleError(_0x475c39,null));};exports[_0x54ff('0x5d')]=function(_0x324a27,_0x3af23b){var _0x9c9483;return db['CmHopper']['find']({'where':{'id':_0x324a27['params']['id']}})[_0x54ff('0x50')](handleEntityNotFound(_0x3af23b,null))['then'](function(_0x83a2cc){if(_0x83a2cc){return _0x83a2cc[_0x54ff('0x5d')]()[_0x54ff('0x50')](function(_0x1b71c5){return _0x1b71c5;});}})[_0x54ff('0x50')](function(_0x3214c7){_0x9c9483=_0x3214c7;if(_0x3214c7){if(_0x3214c7[_0x54ff('0x5e')]||_0x3214c7['CampaignId']){return db[_0x3214c7[_0x54ff('0x5e')]?_0x54ff('0x5f'):_0x54ff('0x60')][_0x54ff('0x58')]({'where':{'id':_0x3214c7[_0x54ff('0x5e')]?_0x3214c7[_0x54ff('0x5e')]:_0x3214c7['CampaignId']},'attributes':['id',_0x54ff('0x27')],'raw':!![]});}}})[_0x54ff('0x50')](function(_0x1a51a3){var _0x1d7838={};if(_0x1a51a3){_[_0x54ff('0x57')](_0x1d7838,_[_0x54ff('0x61')](_0x9c9483['dataValues'],[_0x54ff('0x62'),'updatedAt','id']));_0x1d7838[_0x54ff('0x63')]=0x15;_0x1d7838['statedesc']='deleted';_0x1d7838['campaign']=_0x1a51a3[_0x54ff('0x27')];_0x1d7838[_0x54ff('0x64')]=_0x324a27[_0x54ff('0x65')]['name'];_0x1d7838[_0x54ff('0x66')]=_0x324a27[_0x54ff('0x65')]['id'];_0x1d7838[_0x54ff('0x67')]=!![];_0x1d7838[_0x54ff('0x68')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x1d7838['calleridnum']=_0x9c9483[_0x54ff('0x69')];_0x1d7838[_0x54ff('0x6a')]=_0x9c9483['VoiceQueueId']?_0x54ff('0x6b'):'ivr';return db['CmContact'][_0x54ff('0x58')]({'where':{'id':_0x1d7838[_0x54ff('0x6c')]},'attributes':[_0x54ff('0x6d'),_0x54ff('0x6e')]})['then'](function(_0x13cf99){if(!_['isNil'](_0x3af23b)&&!_[_0x54ff('0x6f')](_0x13cf99[_0x54ff('0x6d')])){_0x1d7838[_0x54ff('0x70')]=_0x13cf99['firstName'];if(!_[_0x54ff('0x6f')](_0x13cf99[_0x54ff('0x6e')])){_0x1d7838['calleridname']+='\x20'+_0x13cf99[_0x54ff('0x6e')];}}})['finally'](function(){return db[_0x54ff('0x71')][_0x54ff('0x59')](_0x1d7838);});}})[_0x54ff('0x50')](function(){return _0x3af23b['status'](0xcc)[_0x54ff('0x1e')]();})[_0x54ff('0x53')](handleError(_0x3af23b,null));};exports['getPreview']=function(_0x36d831,_0xb0b091,_0x3dcade){var _0x206419=[];return db[_0x54ff('0x72')][_0x54ff('0x5c')]()[_0x54ff('0x50')](function(_0x152279){_0x206419=_[_0x54ff('0x55')](_0x152279);return _0x36d831[_0x54ff('0x65')][_0x54ff('0x73')]({'where':{'type':'outbound','dialActive':!![],'dialMethod':_0x54ff('0x74')},'attributes':['id',_0x54ff('0x75')],'raw':!![]});})[_0x54ff('0x50')](function(_0x20a60b){if(_0x20a60b&&_0x20a60b['length']){return db[_0x54ff('0x76')][_0x54ff('0x77')](function(_0x1a7d55){var _0x32f888={'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0x54ff('0x78')](_0x54ff('0x79'))},'VoiceQueueId':{'$in':_['map'](_0x20a60b,'id')},'$or':[{'UserId':null},{'UserId':_0x36d831[_0x54ff('0x65')]['id']}]};var _0x1fbc49=[];if(_0x36d831[_0x54ff('0x5a')]['direction']&&_0x36d831[_0x54ff('0x5a')][_0x54ff('0x7a')]===_0x54ff('0x7b')){if(!_['isEmpty'](_0x36d831['body']['hopperIds'])){_0x32f888['id']={'$in':_0x36d831['body'][_0x54ff('0x7c')]};}_0x1fbc49=[[_0x54ff('0x7d'),_0x54ff('0x7e')],['scheduledAt',_0x20a60b[0x0][_0x54ff('0x75')]===_0x54ff('0x7e')?_0x54ff('0x7f'):'ASC'],db[_0x54ff('0x76')][_0x54ff('0x80')](_0x54ff('0x81')),['id',_0x54ff('0x7f')]];}else{if(!_[_0x54ff('0x82')](_0x36d831['body'][_0x54ff('0x7c')])){_0x32f888['id']={'$notIn':_0x36d831[_0x54ff('0x5a')][_0x54ff('0x7c')]};}_0x1fbc49=[[_0x54ff('0x7d'),_0x54ff('0x7f')],[_0x54ff('0x83'),_0x20a60b[0x0]['dialOrderByScheduledAt']],db[_0x54ff('0x76')][_0x54ff('0x80')]('COALESCE(CmHopper.UserId,\x200)\x20DESC'),['id',_0x54ff('0x7e')]];}return db[_0x54ff('0x2a')][_0x54ff('0x84')]({'attributes':['id',_0x54ff('0x85')],'where':_0x32f888,'order':_0x1fbc49,'transaction':_0x1a7d55,'lock':_0x1a7d55[_0x54ff('0x86')][_0x54ff('0x87')],'include':[{'model':db[_0x54ff('0x72')],'as':_0x54ff('0x88'),'attributes':_0x206419,'include':[{'model':db['CmCompany'],'as':_0x54ff('0x89'),'attributes':['id',_0x54ff('0x27')]}]},{'model':db['CmList'],'as':_0x54ff('0x8a'),'attributes':['id',_0x54ff('0x27')]},{'model':db[_0x54ff('0x5f')],'as':_0x54ff('0x8b'),'attributes':['id','name',_0x54ff('0x8c')]}]})[_0x54ff('0x50')](function(_0x263e42){if(_0x263e42){return _0x263e42[_0x54ff('0x26')]({'UserId':_0x36d831[_0x54ff('0x65')]['id']},{'transaction':_0x1a7d55});}});});}})['then'](handleEntityNotFound(_0xb0b091,null))[_0x54ff('0x50')](respondWithResult(_0xb0b091,null))['catch'](handleError(_0xb0b091,null));};exports[_0x54ff('0x8d')]=function(_0x3a9c2e,_0x4280de,_0xf2042e){return _0x3a9c2e[_0x54ff('0x65')][_0x54ff('0x73')]({'where':{'type':_0x54ff('0x8e'),'dialActive':!![],'dialMethod':'preview'},'attributes':['id'],'raw':!![]})['then'](function(_0x21787f){if(_0x21787f&&_0x21787f[_0x54ff('0x46')]){return db[_0x54ff('0x2a')][_0x54ff('0x20')]({'where':{'active':![],'recallme':![],'scheduledAt':{'$lte':moment()['format']('YYYY-MM-DD\x20HH:mm:ss')},'VoiceQueueId':{'$in':_['map'](_0x21787f,'id')},'$or':[{'UserId':null},{'UserId':_0x3a9c2e[_0x54ff('0x65')]['id']}]}});}return 0x0;})[_0x54ff('0x50')](function(_0x3605b4){if(!_[_0x54ff('0x6f')](_0x3605b4)&&_['isNumber'](_0x3605b4)){return _0x4280de[_0x54ff('0x1d')](0xc8)[_0x54ff('0x1f')]({'contacts':_0x3605b4});}else{logger[_0x54ff('0x8f')](_0x54ff('0x90'),_0x54ff('0x8d'),0x194,_0x54ff('0x91'));_0x4280de[_0x54ff('0x1c')](0x194);}})[_0x54ff('0x53')](handleError(_0x4280de,null));};exports['getTimezones']=function(_0x1bc9fb,_0xa8fbcd,_0x40a875){var _0x55fbd0=shared['timezones'];var _0x12b509=[];_['map'](_0x55fbd0,function(_0x511f71){_0x12b509['push']({'id':_0x511f71[_0x54ff('0x27')],'name':_0x511f71[_0x54ff('0x27')],'utcOffset':_0x511f71[_0x54ff('0x92')]});});return _0xa8fbcd['status'](0xc8)[_0x54ff('0x1f')]({'tz':_0x12b509});};exports[_0x54ff('0x93')]=function(_0x1d9f16,_0x5b4a3a,_0x409403){var _0x4b9292=shared[_0x54ff('0x94')];var _0x5bef4e={};if(!_['isNil'](_0x4b9292[_0x1d9f16[_0x54ff('0x5a')]['id']]))_0x5bef4e=_0x4b9292[_0x1d9f16[_0x54ff('0x5a')]['id']];return _0x5b4a3a[_0x54ff('0x1d')](0xc8)[_0x54ff('0x1f')](_0x5bef4e);}; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.model.js b/server/api/cmHopper/cmHopper.model.js index f755977..33fd68e 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 _0x3920=['path','rimraf','../../config/environment','exports','define','CmHopper','cm_hopper','scheduledat','phone','priority','lodash','api','moment','bluebird','request-promise'];(function(_0x18a246,_0x5e7f4b){var _0x268977=function(_0x5cf902){while(--_0x5cf902){_0x18a246['push'](_0x18a246['shift']());}};_0x268977(++_0x5e7f4b);}(_0x3920,0x118));var _0x0392=function(_0x26236b,_0x29ab1e){_0x26236b=_0x26236b-0x0;var _0x3f2d5=_0x3920[_0x26236b];return _0x3f2d5;};'use strict';var _=require(_0x0392('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x0392('0x1'));var moment=require(_0x0392('0x2'));var BPromise=require(_0x0392('0x3'));var rp=require(_0x0392('0x4'));var fs=require('fs');var path=require(_0x0392('0x5'));var rimraf=require(_0x0392('0x6'));var config=require(_0x0392('0x7'));var attributes=require('./cmHopper.attributes');module[_0x0392('0x8')]=function(_0x1dc112,_0x556d21){return _0x1dc112[_0x0392('0x9')](_0x0392('0xa'),attributes,{'tableName':_0x0392('0xb'),'paranoid':![],'indexes':[{'name':_0x0392('0xc'),'fields':[_0x0392('0xc')]},{'name':_0x0392('0xd'),'fields':[_0x0392('0xd')]},{'name':_0x0392('0xe'),'fields':[_0x0392('0xe')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x061c=['moment','request-promise','path','rimraf','../../config/environment','exports','define','CmHopper','cm_hopper','scheduledat','phone','priority','lodash','../../config/logger','api'];(function(_0x5c7a85,_0x41dd19){var _0x35290f=function(_0x26215b){while(--_0x26215b){_0x5c7a85['push'](_0x5c7a85['shift']());}};_0x35290f(++_0x41dd19);}(_0x061c,0x183));var _0xc061=function(_0x4407ac,_0x43a383){_0x4407ac=_0x4407ac-0x0;var _0x517fff=_0x061c[_0x4407ac];return _0x517fff;};'use strict';var _=require(_0xc061('0x0'));var util=require('util');var logger=require(_0xc061('0x1'))(_0xc061('0x2'));var moment=require(_0xc061('0x3'));var BPromise=require('bluebird');var rp=require(_0xc061('0x4'));var fs=require('fs');var path=require(_0xc061('0x5'));var rimraf=require(_0xc061('0x6'));var config=require(_0xc061('0x7'));var attributes=require('./cmHopper.attributes');module[_0xc061('0x8')]=function(_0x2861dd,_0x2200ff){return _0x2861dd[_0xc061('0x9')](_0xc061('0xa'),attributes,{'tableName':_0xc061('0xb'),'paranoid':![],'indexes':[{'name':_0xc061('0xc'),'fields':[_0xc061('0xc')]},{'name':'phone','fields':[_0xc061('0xd')]},{'name':'priority','fields':[_0xc061('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 516b511..8a11e44 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 _0x5bba=['getContactByPhone','log','req\x20value','DESC','getcontactbyohone','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','CmHopper,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','findAll','options','raw','where','limit','include','map','model','attributes','GetCmHopper','ShowCmHopper','find','CmHopper','create','body','CreateCmHopper','UpdateCmHopper','update','DestroyCmHopper','destroy','GetContactDialer','CmContact','sequelize','transaction','UPDATE','Contact','keys','User','voicePause','length','includes','UserId','push','MoveContactManagedDialer','CmHopperFinal','CountReScheduled','COUNT','`scheduledat`\x20>=\x20','format','\x22%s\x22','\x20,\x201,\x20null','contactsRescheduled','GetContactRecallMe','describe','LOCK','all'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0x5bba,0x9b));var _0xa5bb=function(_0x8263ba,_0x368f9a){_0x8263ba=_0x8263ba-0x0;var _0xe02789=_0x5bba[_0x8263ba];return _0xe02789;};'use strict';var _=require('lodash');var util=require(_0xa5bb('0x0'));var moment=require(_0xa5bb('0x1'));var BPromise=require(_0xa5bb('0x2'));var rs=require(_0xa5bb('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xa5bb('0x4'))['db'];var utils=require(_0xa5bb('0x5'));var logger=require(_0xa5bb('0x6'))(_0xa5bb('0x7'));var config=require(_0xa5bb('0x8'));var jayson=require(_0xa5bb('0x9'));var client=jayson[_0xa5bb('0xa')][_0xa5bb('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x22a89c,_0xc034c6,_0x723c22){return new BPromise(function(_0x454970,_0x522f2a){return client[_0xa5bb('0xc')](_0x22a89c,_0x723c22)[_0xa5bb('0xd')](function(_0x1c7214){logger[_0xa5bb('0xe')](_0xa5bb('0xf'),_0xc034c6,_0xa5bb('0x10'));logger[_0xa5bb('0x11')]('CmHopper,\x20%s,\x20%s,\x20%s',_0xc034c6,_0xa5bb('0x10'),JSON[_0xa5bb('0x12')](_0x1c7214));if(_0x1c7214[_0xa5bb('0x13')]){if(_0x1c7214[_0xa5bb('0x13')][_0xa5bb('0x14')]===0x1f4){logger[_0xa5bb('0x13')]('CmHopper,\x20%s,\x20%s',_0xc034c6,_0x1c7214[_0xa5bb('0x13')][_0xa5bb('0x15')]);return _0x522f2a(_0x1c7214[_0xa5bb('0x13')][_0xa5bb('0x15')]);}logger[_0xa5bb('0x13')](_0xa5bb('0xf'),_0xc034c6,_0x1c7214[_0xa5bb('0x13')][_0xa5bb('0x15')]);return _0x454970(_0x1c7214['error'][_0xa5bb('0x15')]);}else{logger[_0xa5bb('0xe')]('CmHopper,\x20%s,\x20%s',_0xc034c6,_0xa5bb('0x10'));_0x454970(_0x1c7214[_0xa5bb('0x16')]['message']);}})[_0xa5bb('0x17')](function(_0x246191){logger[_0xa5bb('0x13')]('CmHopper,\x20%s,\x20%s',_0xc034c6,_0x246191);_0x522f2a(_0x246191);});});}exports['GetCmHopper']=function(_0x4ea048){var _0x33e837=this;return new Promise(function(_0x6299a,_0xf6bb2f){return db['CmHopper'][_0xa5bb('0x18')]({'raw':_0x4ea048[_0xa5bb('0x19')]?_0x4ea048[_0xa5bb('0x19')][_0xa5bb('0x1a')]===undefined?!![]:![]:!![],'where':_0x4ea048['options']?_0x4ea048[_0xa5bb('0x19')][_0xa5bb('0x1b')]||null:null,'attributes':_0x4ea048[_0xa5bb('0x19')]?_0x4ea048[_0xa5bb('0x19')]['attributes']||null:null,'limit':_0x4ea048[_0xa5bb('0x19')]?_0x4ea048['options'][_0xa5bb('0x1c')]||null:null,'include':_0x4ea048[_0xa5bb('0x19')]?_0x4ea048[_0xa5bb('0x19')][_0xa5bb('0x1d')]?_[_0xa5bb('0x1e')](_0x4ea048[_0xa5bb('0x19')][_0xa5bb('0x1d')],function(_0x411abd){return{'model':db[_0x411abd[_0xa5bb('0x1f')]],'as':_0x411abd['as'],'attributes':_0x411abd[_0xa5bb('0x20')],'include':_0x411abd[_0xa5bb('0x1d')]?_[_0xa5bb('0x1e')](_0x411abd['include'],function(_0x3ec290){return{'model':db[_0x3ec290[_0xa5bb('0x1f')]],'as':_0x3ec290['as'],'attributes':_0x3ec290[_0xa5bb('0x20')],'include':_0x3ec290[_0xa5bb('0x1d')]?_[_0xa5bb('0x1e')](_0x3ec290['include'],function(_0x284ba5){return{'model':db[_0x284ba5[_0xa5bb('0x1f')]],'as':_0x284ba5['as'],'attributes':_0x284ba5['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x4e0c3a){logger['info']('GetCmHopper',_0x4ea048);logger[_0xa5bb('0x11')](_0xa5bb('0x21'),_0x4ea048,JSON[_0xa5bb('0x12')](_0x4e0c3a));_0x6299a(_0x4e0c3a);})[_0xa5bb('0x17')](function(_0x129d68){logger[_0xa5bb('0x13')](_0xa5bb('0x21'),_0x129d68[_0xa5bb('0x15')],_0x4ea048);_0xf6bb2f(_0x33e837[_0xa5bb('0x13')](0x1f4,_0x129d68[_0xa5bb('0x15')]));});});};exports[_0xa5bb('0x22')]=function(_0x4d4a1c){var _0x5b00a6=this;return new Promise(function(_0x51ab5f,_0x12b06e){return db['CmHopper'][_0xa5bb('0x23')]({'raw':_0x4d4a1c[_0xa5bb('0x19')]?_0x4d4a1c[_0xa5bb('0x19')][_0xa5bb('0x1a')]===undefined?!![]:![]:!![],'where':_0x4d4a1c['options']?_0x4d4a1c[_0xa5bb('0x19')][_0xa5bb('0x1b')]||null:null,'attributes':_0x4d4a1c[_0xa5bb('0x19')]?_0x4d4a1c[_0xa5bb('0x19')][_0xa5bb('0x20')]||null:null,'include':_0x4d4a1c[_0xa5bb('0x19')]?_0x4d4a1c[_0xa5bb('0x19')]['include']?_[_0xa5bb('0x1e')](_0x4d4a1c[_0xa5bb('0x19')][_0xa5bb('0x1d')],function(_0x521fe3){return{'model':db[_0x521fe3['model']],'as':_0x521fe3['as'],'attributes':_0x521fe3['attributes'],'include':_0x521fe3[_0xa5bb('0x1d')]?_[_0xa5bb('0x1e')](_0x521fe3[_0xa5bb('0x1d')],function(_0x965a04){return{'model':db[_0x965a04[_0xa5bb('0x1f')]],'as':_0x965a04['as'],'attributes':_0x965a04[_0xa5bb('0x20')],'include':_0x965a04[_0xa5bb('0x1d')]?_[_0xa5bb('0x1e')](_0x965a04[_0xa5bb('0x1d')],function(_0x2b9bab){return{'model':db[_0x2b9bab[_0xa5bb('0x1f')]],'as':_0x2b9bab['as'],'attributes':_0x2b9bab[_0xa5bb('0x20')]};}):[]};}):[]};}):[]:[]})[_0xa5bb('0xd')](function(_0x2d7dbc){logger[_0xa5bb('0xe')]('ShowCmHopper',_0x4d4a1c);logger['debug'](_0xa5bb('0x22'),_0x4d4a1c,JSON[_0xa5bb('0x12')](_0x2d7dbc));_0x51ab5f(_0x2d7dbc);})[_0xa5bb('0x17')](function(_0x2b3859){logger[_0xa5bb('0x13')](_0xa5bb('0x22'),_0x2b3859[_0xa5bb('0x15')],_0x4d4a1c);_0x12b06e(_0x5b00a6[_0xa5bb('0x13')](0x1f4,_0x2b3859[_0xa5bb('0x15')]));});});};exports['CreateCmHopper']=function(_0x645185){var _0x806060=this;return new Promise(function(_0x14caa7,_0x40ac14){return db[_0xa5bb('0x24')][_0xa5bb('0x25')](_0x645185[_0xa5bb('0x26')],{'raw':_0x645185[_0xa5bb('0x19')]?_0x645185[_0xa5bb('0x19')]['raw']===undefined?!![]:![]:!![]})[_0xa5bb('0xd')](function(_0x57aae9){logger[_0xa5bb('0xe')](_0xa5bb('0x27'),_0x645185);logger['debug'](_0xa5bb('0x27'),_0x645185,JSON[_0xa5bb('0x12')](_0x57aae9));_0x14caa7(_0x57aae9);})['catch'](function(_0x88df04){logger[_0xa5bb('0x13')](_0xa5bb('0x27'),_0x88df04[_0xa5bb('0x15')],_0x645185);_0x40ac14(_0x806060[_0xa5bb('0x13')](0x1f4,_0x88df04[_0xa5bb('0x15')]));});});};exports[_0xa5bb('0x28')]=function(_0x3fd52d){var _0x4527b9=this;return new Promise(function(_0x10ef78,_0x2d2896){return db[_0xa5bb('0x24')][_0xa5bb('0x29')](_0x3fd52d[_0xa5bb('0x26')],{'raw':_0x3fd52d['options']?_0x3fd52d['options'][_0xa5bb('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3fd52d[_0xa5bb('0x19')]?_0x3fd52d[_0xa5bb('0x19')][_0xa5bb('0x1b')]||null:null,'attributes':_0x3fd52d['options']?_0x3fd52d[_0xa5bb('0x19')][_0xa5bb('0x20')]||null:null,'limit':_0x3fd52d[_0xa5bb('0x19')]?_0x3fd52d[_0xa5bb('0x19')][_0xa5bb('0x1c')]||null:null})['then'](function(_0x236cea){logger[_0xa5bb('0xe')]('UpdateCmHopper',_0x3fd52d);logger[_0xa5bb('0x11')](_0xa5bb('0x28'),_0x3fd52d,JSON[_0xa5bb('0x12')](_0x236cea));_0x10ef78(_0x236cea);})[_0xa5bb('0x17')](function(_0x44ea17){logger[_0xa5bb('0x13')]('UpdateCmHopper',_0x44ea17[_0xa5bb('0x15')],_0x3fd52d);_0x2d2896(_0x4527b9[_0xa5bb('0x13')](0x1f4,_0x44ea17[_0xa5bb('0x15')]));});});};exports[_0xa5bb('0x2a')]=function(_0x962849){var _0x46cf0e=this;return new Promise(function(_0x5b4226,_0x1775a9){return db[_0xa5bb('0x24')][_0xa5bb('0x2b')]({'where':_0x962849[_0xa5bb('0x19')]?_0x962849[_0xa5bb('0x19')][_0xa5bb('0x1b')]||null:null})[_0xa5bb('0xd')](function(_0xe24708){logger['info']('DestroyCmHopper',_0x962849);logger[_0xa5bb('0x11')](_0xa5bb('0x2a'),_0x962849,JSON[_0xa5bb('0x12')](_0xe24708));_0x5b4226(_0xe24708);})[_0xa5bb('0x17')](function(_0x3beb62){logger['error'](_0xa5bb('0x2a'),_0x3beb62['message'],_0x962849);_0x1775a9(_0x46cf0e[_0xa5bb('0x13')](0x1f4,_0x3beb62[_0xa5bb('0x15')]));});});};exports[_0xa5bb('0x2c')]=function(_0xc7041){var _0x1572e5=this;return new Promise(function(_0x3b9b0b,_0x2f5b71){return db[_0xa5bb('0x2d')]['describe']()[_0xa5bb('0xd')](function(_0x2578f5){return db[_0xa5bb('0x2e')][_0xa5bb('0x2f')](function(_0x591ad1){return db[_0xa5bb('0x24')]['findAll']({'where':_0xc7041[_0xa5bb('0x19')]?_0xc7041[_0xa5bb('0x19')][_0xa5bb('0x1b')]||null:null,'attributes':_0xc7041[_0xa5bb('0x19')]?_0xc7041[_0xa5bb('0x19')][_0xa5bb('0x20')]||null:null,'limit':_0xc7041[_0xa5bb('0x19')]?_0xc7041[_0xa5bb('0x19')][_0xa5bb('0x1c')]||null:null,'order':_0xc7041['options']?_0xc7041[_0xa5bb('0x19')]['order']||null:null,'transaction':_0x591ad1,'lock':_0x591ad1['LOCK'][_0xa5bb('0x30')],'include':[{'model':db[_0xa5bb('0x2d')],'as':_0xa5bb('0x31'),'attributes':_[_0xa5bb('0x32')](_0x2578f5)},{'model':db[_0xa5bb('0x33')],'as':'Agent','attributes':['id','name',_0xa5bb('0x34')]}]})[_0xa5bb('0xd')](function(_0x5042b0){var _0x2aeb62=[];var _0x55c0e7=[];for(var _0x1de447=0x0;_0x1de447<_0x5042b0[_0xa5bb('0x35')];_0x1de447+=0x1){if(!_0x55c0e7[_0xa5bb('0x36')](_0x5042b0[_0x1de447][_0xa5bb('0x37')])){_0x55c0e7[_0xa5bb('0x38')](_0x5042b0[_0x1de447][_0xa5bb('0x37')]);_0x2aeb62[_0xa5bb('0x38')](_0x5042b0[_0x1de447][_0xa5bb('0x29')](_0xc7041[_0xa5bb('0x26')],{'transaction':_0x591ad1}));}}return BPromise['all'](_0x2aeb62);});})[_0xa5bb('0xd')](function(_0x2b54ab){logger[_0xa5bb('0xe')](_0xa5bb('0x2c'),_0xc7041);logger[_0xa5bb('0x11')](_0xa5bb('0x2c'),_0xc7041,JSON[_0xa5bb('0x12')](_0x2b54ab));_0x3b9b0b(_0x2b54ab);})[_0xa5bb('0x17')](function(_0x2d2768){logger[_0xa5bb('0x13')](_0xa5bb('0x2c'),_0x2d2768['message'],_0xc7041);_0x2f5b71(_0x1572e5[_0xa5bb('0x13')](0x1f4,_0x2d2768['message']));});});});};exports[_0xa5bb('0x39')]=function(_0x27c75d){var _0x434a71=this;return new Promise(function(_0xed8391,_0x41fe25){return db[_0xa5bb('0x2e')][_0xa5bb('0x2f')](function(_0x57926d){return db[_0xa5bb('0x3a')][_0xa5bb('0x25')](_0x27c75d[_0xa5bb('0x26')],{'raw':_0x27c75d[_0xa5bb('0x19')]?_0x27c75d['options'][_0xa5bb('0x1a')]===undefined?!![]:![]:!![],'transaction':_0x57926d})[_0xa5bb('0xd')](function(){return db[_0xa5bb('0x24')][_0xa5bb('0x2b')]({'where':_0x27c75d[_0xa5bb('0x19')]?_0x27c75d['options'][_0xa5bb('0x1b')]||null:null,'transaction':_0x57926d});});})[_0xa5bb('0xd')](function(_0x2dfe62){logger['info'](_0xa5bb('0x39'),_0x27c75d);logger[_0xa5bb('0x11')](_0xa5bb('0x39'),_0x27c75d,JSON[_0xa5bb('0x12')](_0x2dfe62));_0xed8391(_0x2dfe62);})[_0xa5bb('0x17')](function(_0x585c42){logger[_0xa5bb('0x13')](_0xa5bb('0x39'),_0x585c42[_0xa5bb('0x15')],_0x27c75d);_0x41fe25(_0x434a71['error'](0x1f4,_0x585c42[_0xa5bb('0x15')]));});});};exports[_0xa5bb('0x3b')]=function(_0xdbd47f){var _0x1e84fe=this;return new Promise(function(_0x3a38a3,_0x250037){return db[_0xa5bb('0x24')][_0xa5bb('0x18')]({'raw':_0xdbd47f[_0xa5bb('0x19')]?_0xdbd47f[_0xa5bb('0x19')][_0xa5bb('0x1a')]===undefined?!![]:![]:!![],'where':_0xdbd47f[_0xa5bb('0x19')]?_0xdbd47f[_0xa5bb('0x19')][_0xa5bb('0x1b')]||null:null,'attributes':[[db[_0xa5bb('0x2e')]['fn'](_0xa5bb('0x3c'),db[_0xa5bb('0x2e')]['fn']('IF',db[_0xa5bb('0x2e')]['literal'](_0xa5bb('0x3d')+util[_0xa5bb('0x3e')](_0xa5bb('0x3f'),moment()[_0xa5bb('0x3e')]('YYYY-MM-DD\x20HH:mm:ss'))+_0xa5bb('0x40')))),_0xa5bb('0x41')]]})[_0xa5bb('0xd')](function(_0x1268f6){logger[_0xa5bb('0xe')]('CountReScheduled',_0xdbd47f);logger['debug'](_0xa5bb('0x3b'),_0xdbd47f,JSON[_0xa5bb('0x12')](_0x1268f6));_0x3a38a3(_0x1268f6);})['catch'](function(_0x35f2a8){logger[_0xa5bb('0x13')](_0xa5bb('0x3b'),_0x35f2a8['message'],_0xdbd47f);_0x250037(_0x1e84fe[_0xa5bb('0x13')](0x1f4,_0x35f2a8[_0xa5bb('0x15')]));});});};exports[_0xa5bb('0x42')]=function(_0x41ff09){var _0x522aa6=this;return new Promise(function(_0x5265a7,_0x111d52){return db[_0xa5bb('0x2d')][_0xa5bb('0x43')]()[_0xa5bb('0xd')](function(_0x3c50d0){return db[_0xa5bb('0x2e')]['transaction'](function(_0x305313){return db[_0xa5bb('0x24')][_0xa5bb('0x18')]({'where':_0x41ff09[_0xa5bb('0x19')]?_0x41ff09['options'][_0xa5bb('0x1b')]||null:null,'attributes':_0x41ff09['options']?_0x41ff09['options'][_0xa5bb('0x20')]||null:null,'limit':0x1,'order':_0x41ff09[_0xa5bb('0x19')]?_0x41ff09[_0xa5bb('0x19')]['order']||null:null,'group':db[_0xa5bb('0x24')][_0xa5bb('0x37')],'transaction':_0x305313,'lock':_0x305313[_0xa5bb('0x44')][_0xa5bb('0x30')],'include':_0x41ff09[_0xa5bb('0x19')]?_0x41ff09['options']['include']?_[_0xa5bb('0x1e')](_0x41ff09[_0xa5bb('0x19')]['include'],function(_0x356f70){return{'model':db[_0x356f70[_0xa5bb('0x1f')]],'as':_0x356f70['as'],'attributes':_0x356f70['attributes'],'include':_0x356f70['include']?_['map'](_0x356f70[_0xa5bb('0x1d')],function(_0x4436cf){return{'model':db[_0x4436cf[_0xa5bb('0x1f')]],'as':_0x4436cf['as'],'attributes':_0x4436cf[_0xa5bb('0x20')],'include':_0x4436cf[_0xa5bb('0x1d')]?_[_0xa5bb('0x1e')](_0x4436cf[_0xa5bb('0x1d')],function(_0x271db7){return{'model':db[_0x271db7[_0xa5bb('0x1f')]],'as':_0x271db7['as'],'attributes':_0x271db7[_0xa5bb('0x20')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x4b8b54){var _0x343940=[];for(var _0x54ab53=0x0;_0x54ab53<_0x4b8b54[_0xa5bb('0x35')];_0x54ab53+=0x1){_0x343940[_0xa5bb('0x38')](_0x4b8b54[_0x54ab53]['update'](_0x41ff09[_0xa5bb('0x26')],{'transaction':_0x305313}));}return BPromise[_0xa5bb('0x45')](_0x343940);});})[_0xa5bb('0xd')](function(_0x2e5fc3){logger[_0xa5bb('0xe')]('GetContactRecallMe',_0x41ff09);logger[_0xa5bb('0x11')]('GetContactRecallMe',_0x41ff09,JSON['stringify'](_0x2e5fc3));_0x5265a7(_0x2e5fc3);})[_0xa5bb('0x17')](function(_0x2cdb33){logger[_0xa5bb('0x13')]('GetContactRecallMe',_0x2cdb33[_0xa5bb('0x15')],_0x41ff09);_0x111d52(_0x522aa6[_0xa5bb('0x13')](0x1f4,_0x2cdb33[_0xa5bb('0x15')]));});});});};exports['GetCmHopperPreview']=function(_0x5b5037){var _0x717771=this;return new Promise(function(_0x4a2c75,_0x474e41){db['CmContact'][_0xa5bb('0x43')]()[_0xa5bb('0xd')](function(_0x38917f){return db['CmHopper'][_0xa5bb('0x18')]({'raw':_0x5b5037[_0xa5bb('0x19')]?_0x5b5037['options'][_0xa5bb('0x1a')]===undefined?!![]:![]:!![],'where':_0x5b5037['options']?_0x5b5037[_0xa5bb('0x19')]['where']||null:null,'attributes':_0x5b5037['options']?_0x5b5037[_0xa5bb('0x19')][_0xa5bb('0x20')]||null:null,'limit':_0x5b5037[_0xa5bb('0x19')]?_0x5b5037['options'][_0xa5bb('0x1c')]||null:null,'include':_0x5b5037['options']?_0x5b5037[_0xa5bb('0x19')][_0xa5bb('0x1d')]?_[_0xa5bb('0x1e')](_0x5b5037[_0xa5bb('0x19')][_0xa5bb('0x1d')],function(_0x477ed4){return{'model':db[_0x477ed4[_0xa5bb('0x1f')]],'as':_0x477ed4['as'],'attributes':_0x477ed4['as']==='Contact'?_['keys'](_0x38917f):_0x477ed4[_0xa5bb('0x20')],'include':_0x477ed4['include']?_[_0xa5bb('0x1e')](_0x477ed4[_0xa5bb('0x1d')],function(_0x203647){return{'model':db[_0x203647[_0xa5bb('0x1f')]],'as':_0x203647['as'],'attributes':_0x203647[_0xa5bb('0x20')],'include':_0x203647[_0xa5bb('0x1d')]?_['map'](_0x203647[_0xa5bb('0x1d')],function(_0x202ab0){return{'model':db[_0x202ab0[_0xa5bb('0x1f')]],'as':_0x202ab0['as'],'attributes':_0x202ab0[_0xa5bb('0x20')]};}):[]};}):[]};}):[]:[]})[_0xa5bb('0xd')](function(_0x52ae8c){logger[_0xa5bb('0xe')](_0xa5bb('0x21'),_0x5b5037);logger[_0xa5bb('0x11')]('GetCmHopper',_0x5b5037,JSON[_0xa5bb('0x12')](_0x52ae8c));_0x4a2c75(_0x52ae8c);})[_0xa5bb('0x17')](function(_0x5b98b2){logger['error'](_0xa5bb('0x21'),_0x5b98b2[_0xa5bb('0x15')],_0x5b5037);_0x474e41(_0x717771[_0xa5bb('0x13')](0x1f4,_0x5b98b2[_0xa5bb('0x15')]));});});});};exports[_0xa5bb('0x46')]=function(_0x524649){console[_0xa5bb('0x47')](_0xa5bb('0x48'),_0x524649);var _0x365a7e=this;return new Promise(function(_0x2bdc1f,_0x18c765){return db[_0xa5bb('0x2d')]['findOne']({'raw':!![],'where':{'phone':_0x524649[_0xa5bb('0x26')]['phone']},'attributes':['id'],'order':[['id',_0xa5bb('0x49')]]})[_0xa5bb('0xd')](function(_0x734439){console[_0xa5bb('0x47')](_0xa5bb('0x4a'),_0x734439);logger[_0xa5bb('0xe')](_0xa5bb('0x46'),_0x524649);logger[_0xa5bb('0x11')](_0xa5bb('0x46'),_0x524649,JSON[_0xa5bb('0x12')](_0x734439));_0x2bdc1f(_0x734439);})['catch'](function(_0x256606){logger['error'](_0xa5bb('0x46'),_0x256606[_0xa5bb('0x15')],_0x524649);_0x18c765(_0x365a7e[_0xa5bb('0x13')](0x1f4,_0x256606[_0xa5bb('0x15')]));});});}; \ No newline at end of file +var _0x9576=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','info','debug','CmHopper,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','CmHopper,\x20%s,\x20%s','result','GetCmHopper','findAll','options','raw','where','limit','include','map','model','attributes','then','ShowCmHopper','catch','CreateCmHopper','UpdateCmHopper','CmHopper','update','body','DestroyCmHopper','GetContactDialer','describe','LOCK','CmContact','Contact','User','Agent','name','voicePause','length','UserId','push','all','MoveContactManagedDialer','sequelize','transaction','CmHopperFinal','destroy','CountReScheduled','COUNT','literal','`scheduledat`\x20>=\x20','format','\x22%s\x22','YYYY-MM-DD\x20HH:mm:ss','\x20,\x201,\x20null','order','UPDATE','GetContactRecallMe','GetCmHopperPreview','keys','GetContactByPhone','log','req\x20value','DESC','getcontactbyohone','getContactByPhone','lodash','util','moment','bluebird'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0x9576,0x182));var _0x6957=function(_0x498de6,_0x2911f6){_0x498de6=_0x498de6-0x0;var _0x42c788=_0x9576[_0x498de6];return _0x42c788;};'use strict';var _=require(_0x6957('0x0'));var util=require(_0x6957('0x1'));var moment=require(_0x6957('0x2'));var BPromise=require(_0x6957('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x6957('0x4'))['db'];var utils=require(_0x6957('0x5'));var logger=require(_0x6957('0x6'))(_0x6957('0x7'));var config=require(_0x6957('0x8'));var jayson=require(_0x6957('0x9'));var client=jayson[_0x6957('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x6d8af8,_0x3425fe,_0x70b8c4){return new BPromise(function(_0x2e5727,_0x6397fe){return client[_0x6957('0xb')](_0x6d8af8,_0x70b8c4)['then'](function(_0x28a4c6){logger[_0x6957('0xc')]('CmHopper,\x20%s,\x20%s',_0x3425fe,'request\x20sent');logger[_0x6957('0xd')](_0x6957('0xe'),_0x3425fe,_0x6957('0xf'),JSON[_0x6957('0x10')](_0x28a4c6));if(_0x28a4c6[_0x6957('0x11')]){if(_0x28a4c6[_0x6957('0x11')][_0x6957('0x12')]===0x1f4){logger['error']('CmHopper,\x20%s,\x20%s',_0x3425fe,_0x28a4c6['error'][_0x6957('0x13')]);return _0x6397fe(_0x28a4c6[_0x6957('0x11')][_0x6957('0x13')]);}logger[_0x6957('0x11')](_0x6957('0x14'),_0x3425fe,_0x28a4c6[_0x6957('0x11')][_0x6957('0x13')]);return _0x2e5727(_0x28a4c6['error']['message']);}else{logger['info'](_0x6957('0x14'),_0x3425fe,_0x6957('0xf'));_0x2e5727(_0x28a4c6[_0x6957('0x15')][_0x6957('0x13')]);}})['catch'](function(_0x14422d){logger['error'](_0x6957('0x14'),_0x3425fe,_0x14422d);_0x6397fe(_0x14422d);});});}exports[_0x6957('0x16')]=function(_0x49aa31){var _0x2ccd8e=this;return new Promise(function(_0x448ff6,_0x26b577){return db['CmHopper'][_0x6957('0x17')]({'raw':_0x49aa31[_0x6957('0x18')]?_0x49aa31[_0x6957('0x18')][_0x6957('0x19')]===undefined?!![]:![]:!![],'where':_0x49aa31[_0x6957('0x18')]?_0x49aa31[_0x6957('0x18')][_0x6957('0x1a')]||null:null,'attributes':_0x49aa31[_0x6957('0x18')]?_0x49aa31['options']['attributes']||null:null,'limit':_0x49aa31[_0x6957('0x18')]?_0x49aa31[_0x6957('0x18')][_0x6957('0x1b')]||null:null,'include':_0x49aa31[_0x6957('0x18')]?_0x49aa31[_0x6957('0x18')][_0x6957('0x1c')]?_[_0x6957('0x1d')](_0x49aa31[_0x6957('0x18')]['include'],function(_0x2b2dcd){return{'model':db[_0x2b2dcd[_0x6957('0x1e')]],'as':_0x2b2dcd['as'],'attributes':_0x2b2dcd[_0x6957('0x1f')],'include':_0x2b2dcd[_0x6957('0x1c')]?_['map'](_0x2b2dcd['include'],function(_0xa1e6af){return{'model':db[_0xa1e6af[_0x6957('0x1e')]],'as':_0xa1e6af['as'],'attributes':_0xa1e6af['attributes'],'include':_0xa1e6af['include']?_[_0x6957('0x1d')](_0xa1e6af[_0x6957('0x1c')],function(_0x3bc22f){return{'model':db[_0x3bc22f['model']],'as':_0x3bc22f['as'],'attributes':_0x3bc22f[_0x6957('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x6957('0x20')](function(_0x35ba67){logger[_0x6957('0xc')](_0x6957('0x16'),_0x49aa31);logger[_0x6957('0xd')](_0x6957('0x16'),_0x49aa31,JSON[_0x6957('0x10')](_0x35ba67));_0x448ff6(_0x35ba67);})['catch'](function(_0x2e7fe1){logger[_0x6957('0x11')](_0x6957('0x16'),_0x2e7fe1[_0x6957('0x13')],_0x49aa31);_0x26b577(_0x2ccd8e[_0x6957('0x11')](0x1f4,_0x2e7fe1[_0x6957('0x13')]));});});};exports[_0x6957('0x21')]=function(_0xef7f63){var _0x1300b1=this;return new Promise(function(_0x28994a,_0x3de770){return db['CmHopper']['find']({'raw':_0xef7f63[_0x6957('0x18')]?_0xef7f63[_0x6957('0x18')][_0x6957('0x19')]===undefined?!![]:![]:!![],'where':_0xef7f63[_0x6957('0x18')]?_0xef7f63['options'][_0x6957('0x1a')]||null:null,'attributes':_0xef7f63[_0x6957('0x18')]?_0xef7f63[_0x6957('0x18')]['attributes']||null:null,'include':_0xef7f63['options']?_0xef7f63[_0x6957('0x18')][_0x6957('0x1c')]?_[_0x6957('0x1d')](_0xef7f63['options'][_0x6957('0x1c')],function(_0x1d40a7){return{'model':db[_0x1d40a7[_0x6957('0x1e')]],'as':_0x1d40a7['as'],'attributes':_0x1d40a7[_0x6957('0x1f')],'include':_0x1d40a7[_0x6957('0x1c')]?_[_0x6957('0x1d')](_0x1d40a7[_0x6957('0x1c')],function(_0xcbfba9){return{'model':db[_0xcbfba9[_0x6957('0x1e')]],'as':_0xcbfba9['as'],'attributes':_0xcbfba9['attributes'],'include':_0xcbfba9[_0x6957('0x1c')]?_[_0x6957('0x1d')](_0xcbfba9[_0x6957('0x1c')],function(_0x5edcae){return{'model':db[_0x5edcae['model']],'as':_0x5edcae['as'],'attributes':_0x5edcae['attributes']};}):[]};}):[]};}):[]:[]})[_0x6957('0x20')](function(_0x59a58e){logger['info'](_0x6957('0x21'),_0xef7f63);logger[_0x6957('0xd')]('ShowCmHopper',_0xef7f63,JSON['stringify'](_0x59a58e));_0x28994a(_0x59a58e);})[_0x6957('0x22')](function(_0x1fa233){logger[_0x6957('0x11')](_0x6957('0x21'),_0x1fa233[_0x6957('0x13')],_0xef7f63);_0x3de770(_0x1300b1['error'](0x1f4,_0x1fa233[_0x6957('0x13')]));});});};exports['CreateCmHopper']=function(_0x52f86c){var _0x57cfa7=this;return new Promise(function(_0x5ab079,_0x570fd6){return db['CmHopper']['create'](_0x52f86c['body'],{'raw':_0x52f86c['options']?_0x52f86c[_0x6957('0x18')][_0x6957('0x19')]===undefined?!![]:![]:!![]})[_0x6957('0x20')](function(_0x330c5c){logger[_0x6957('0xc')](_0x6957('0x23'),_0x52f86c);logger[_0x6957('0xd')](_0x6957('0x23'),_0x52f86c,JSON['stringify'](_0x330c5c));_0x5ab079(_0x330c5c);})[_0x6957('0x22')](function(_0x570450){logger[_0x6957('0x11')](_0x6957('0x23'),_0x570450[_0x6957('0x13')],_0x52f86c);_0x570fd6(_0x57cfa7[_0x6957('0x11')](0x1f4,_0x570450[_0x6957('0x13')]));});});};exports[_0x6957('0x24')]=function(_0x170084){var _0x16575e=this;return new Promise(function(_0x18fb2a,_0x35fa2d){return db[_0x6957('0x25')][_0x6957('0x26')](_0x170084[_0x6957('0x27')],{'raw':_0x170084[_0x6957('0x18')]?_0x170084[_0x6957('0x18')][_0x6957('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x170084['options']?_0x170084[_0x6957('0x18')]['where']||null:null,'attributes':_0x170084['options']?_0x170084[_0x6957('0x18')]['attributes']||null:null,'limit':_0x170084['options']?_0x170084[_0x6957('0x18')][_0x6957('0x1b')]||null:null})[_0x6957('0x20')](function(_0x345dd1){logger[_0x6957('0xc')](_0x6957('0x24'),_0x170084);logger[_0x6957('0xd')](_0x6957('0x24'),_0x170084,JSON[_0x6957('0x10')](_0x345dd1));_0x18fb2a(_0x345dd1);})[_0x6957('0x22')](function(_0x51e907){logger['error'](_0x6957('0x24'),_0x51e907['message'],_0x170084);_0x35fa2d(_0x16575e[_0x6957('0x11')](0x1f4,_0x51e907[_0x6957('0x13')]));});});};exports['DestroyCmHopper']=function(_0xd49c13){var _0x3a4b6c=this;return new Promise(function(_0x2ffb11,_0x5461d8){return db[_0x6957('0x25')]['destroy']({'where':_0xd49c13[_0x6957('0x18')]?_0xd49c13[_0x6957('0x18')][_0x6957('0x1a')]||null:null})[_0x6957('0x20')](function(_0x4fb888){logger[_0x6957('0xc')](_0x6957('0x28'),_0xd49c13);logger['debug'](_0x6957('0x28'),_0xd49c13,JSON[_0x6957('0x10')](_0x4fb888));_0x2ffb11(_0x4fb888);})[_0x6957('0x22')](function(_0x118616){logger['error']('DestroyCmHopper',_0x118616[_0x6957('0x13')],_0xd49c13);_0x5461d8(_0x3a4b6c[_0x6957('0x11')](0x1f4,_0x118616[_0x6957('0x13')]));});});};exports[_0x6957('0x29')]=function(_0x519e0c){var _0x1681f9=this;return new Promise(function(_0x4ca6dc,_0x10fac5){return db['CmContact'][_0x6957('0x2a')]()['then'](function(_0x354ace){return db['sequelize']['transaction'](function(_0x274d40){return db[_0x6957('0x25')][_0x6957('0x17')]({'where':_0x519e0c[_0x6957('0x18')]?_0x519e0c[_0x6957('0x18')][_0x6957('0x1a')]||null:null,'attributes':_0x519e0c[_0x6957('0x18')]?_0x519e0c[_0x6957('0x18')][_0x6957('0x1f')]||null:null,'limit':_0x519e0c[_0x6957('0x18')]?_0x519e0c['options'][_0x6957('0x1b')]||null:null,'order':_0x519e0c[_0x6957('0x18')]?_0x519e0c[_0x6957('0x18')]['order']||null:null,'transaction':_0x274d40,'lock':_0x274d40[_0x6957('0x2b')]['UPDATE'],'include':[{'model':db[_0x6957('0x2c')],'as':_0x6957('0x2d'),'attributes':_['keys'](_0x354ace)},{'model':db[_0x6957('0x2e')],'as':_0x6957('0x2f'),'attributes':['id',_0x6957('0x30'),_0x6957('0x31')]}]})[_0x6957('0x20')](function(_0x3eba40){var _0x3963fb=[];var _0x4543e7=[];for(var _0x596f95=0x0;_0x596f95<_0x3eba40[_0x6957('0x32')];_0x596f95+=0x1){if(!_0x4543e7['includes'](_0x3eba40[_0x596f95][_0x6957('0x33')])){_0x4543e7[_0x6957('0x34')](_0x3eba40[_0x596f95][_0x6957('0x33')]);_0x3963fb['push'](_0x3eba40[_0x596f95][_0x6957('0x26')](_0x519e0c[_0x6957('0x27')],{'transaction':_0x274d40}));}}return BPromise[_0x6957('0x35')](_0x3963fb);});})['then'](function(_0x574d1e){logger[_0x6957('0xc')](_0x6957('0x29'),_0x519e0c);logger[_0x6957('0xd')]('GetContactDialer',_0x519e0c,JSON[_0x6957('0x10')](_0x574d1e));_0x4ca6dc(_0x574d1e);})['catch'](function(_0x6b9d9e){logger[_0x6957('0x11')](_0x6957('0x29'),_0x6b9d9e['message'],_0x519e0c);_0x10fac5(_0x1681f9[_0x6957('0x11')](0x1f4,_0x6b9d9e['message']));});});});};exports[_0x6957('0x36')]=function(_0x23d1a3){var _0x4d91d4=this;return new Promise(function(_0x221b5a,_0x455770){return db[_0x6957('0x37')][_0x6957('0x38')](function(_0x5ce857){return db[_0x6957('0x39')]['create'](_0x23d1a3['body'],{'raw':_0x23d1a3[_0x6957('0x18')]?_0x23d1a3['options'][_0x6957('0x19')]===undefined?!![]:![]:!![],'transaction':_0x5ce857})[_0x6957('0x20')](function(){return db[_0x6957('0x25')][_0x6957('0x3a')]({'where':_0x23d1a3[_0x6957('0x18')]?_0x23d1a3[_0x6957('0x18')][_0x6957('0x1a')]||null:null,'transaction':_0x5ce857});});})['then'](function(_0x345372){logger[_0x6957('0xc')](_0x6957('0x36'),_0x23d1a3);logger[_0x6957('0xd')]('MoveContactManagedDialer',_0x23d1a3,JSON[_0x6957('0x10')](_0x345372));_0x221b5a(_0x345372);})[_0x6957('0x22')](function(_0x1542ed){logger[_0x6957('0x11')]('MoveContactManagedDialer',_0x1542ed[_0x6957('0x13')],_0x23d1a3);_0x455770(_0x4d91d4[_0x6957('0x11')](0x1f4,_0x1542ed[_0x6957('0x13')]));});});};exports[_0x6957('0x3b')]=function(_0x5e3cb5){var _0x770dd3=this;return new Promise(function(_0x16babe,_0x463df2){return db[_0x6957('0x25')][_0x6957('0x17')]({'raw':_0x5e3cb5[_0x6957('0x18')]?_0x5e3cb5[_0x6957('0x18')][_0x6957('0x19')]===undefined?!![]:![]:!![],'where':_0x5e3cb5['options']?_0x5e3cb5['options'][_0x6957('0x1a')]||null:null,'attributes':[[db[_0x6957('0x37')]['fn'](_0x6957('0x3c'),db[_0x6957('0x37')]['fn']('IF',db[_0x6957('0x37')][_0x6957('0x3d')](_0x6957('0x3e')+util[_0x6957('0x3f')](_0x6957('0x40'),moment()['format'](_0x6957('0x41')))+_0x6957('0x42')))),'contactsRescheduled']]})['then'](function(_0x1077ea){logger[_0x6957('0xc')](_0x6957('0x3b'),_0x5e3cb5);logger[_0x6957('0xd')](_0x6957('0x3b'),_0x5e3cb5,JSON[_0x6957('0x10')](_0x1077ea));_0x16babe(_0x1077ea);})[_0x6957('0x22')](function(_0x5ae056){logger[_0x6957('0x11')]('CountReScheduled',_0x5ae056[_0x6957('0x13')],_0x5e3cb5);_0x463df2(_0x770dd3[_0x6957('0x11')](0x1f4,_0x5ae056['message']));});});};exports['GetContactRecallMe']=function(_0x1ed255){var _0x4eb586=this;return new Promise(function(_0xc94667,_0x3c5195){return db[_0x6957('0x2c')][_0x6957('0x2a')]()[_0x6957('0x20')](function(_0x1b3a87){return db[_0x6957('0x37')]['transaction'](function(_0x20e0e2){return db['CmHopper']['findAll']({'where':_0x1ed255['options']?_0x1ed255[_0x6957('0x18')][_0x6957('0x1a')]||null:null,'attributes':_0x1ed255['options']?_0x1ed255[_0x6957('0x18')][_0x6957('0x1f')]||null:null,'limit':0x1,'order':_0x1ed255['options']?_0x1ed255[_0x6957('0x18')][_0x6957('0x43')]||null:null,'group':db['CmHopper'][_0x6957('0x33')],'transaction':_0x20e0e2,'lock':_0x20e0e2[_0x6957('0x2b')][_0x6957('0x44')],'include':_0x1ed255[_0x6957('0x18')]?_0x1ed255[_0x6957('0x18')][_0x6957('0x1c')]?_[_0x6957('0x1d')](_0x1ed255['options'][_0x6957('0x1c')],function(_0x4a7701){return{'model':db[_0x4a7701['model']],'as':_0x4a7701['as'],'attributes':_0x4a7701[_0x6957('0x1f')],'include':_0x4a7701[_0x6957('0x1c')]?_['map'](_0x4a7701[_0x6957('0x1c')],function(_0x4c5803){return{'model':db[_0x4c5803['model']],'as':_0x4c5803['as'],'attributes':_0x4c5803[_0x6957('0x1f')],'include':_0x4c5803['include']?_[_0x6957('0x1d')](_0x4c5803['include'],function(_0x1c768d){return{'model':db[_0x1c768d['model']],'as':_0x1c768d['as'],'attributes':_0x1c768d['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x130cb8){var _0x5bb0c7=[];for(var _0x5d4174=0x0;_0x5d4174<_0x130cb8[_0x6957('0x32')];_0x5d4174+=0x1){_0x5bb0c7['push'](_0x130cb8[_0x5d4174][_0x6957('0x26')](_0x1ed255['body'],{'transaction':_0x20e0e2}));}return BPromise[_0x6957('0x35')](_0x5bb0c7);});})['then'](function(_0x21ea52){logger[_0x6957('0xc')](_0x6957('0x45'),_0x1ed255);logger[_0x6957('0xd')](_0x6957('0x45'),_0x1ed255,JSON[_0x6957('0x10')](_0x21ea52));_0xc94667(_0x21ea52);})[_0x6957('0x22')](function(_0x369916){logger[_0x6957('0x11')](_0x6957('0x45'),_0x369916[_0x6957('0x13')],_0x1ed255);_0x3c5195(_0x4eb586[_0x6957('0x11')](0x1f4,_0x369916[_0x6957('0x13')]));});});});};exports[_0x6957('0x46')]=function(_0x189fdb){var _0x4b6015=this;return new Promise(function(_0x71eb06,_0x8ad2b4){db[_0x6957('0x2c')]['describe']()['then'](function(_0x59b090){return db[_0x6957('0x25')][_0x6957('0x17')]({'raw':_0x189fdb[_0x6957('0x18')]?_0x189fdb[_0x6957('0x18')][_0x6957('0x19')]===undefined?!![]:![]:!![],'where':_0x189fdb[_0x6957('0x18')]?_0x189fdb['options']['where']||null:null,'attributes':_0x189fdb[_0x6957('0x18')]?_0x189fdb[_0x6957('0x18')][_0x6957('0x1f')]||null:null,'limit':_0x189fdb[_0x6957('0x18')]?_0x189fdb[_0x6957('0x18')][_0x6957('0x1b')]||null:null,'include':_0x189fdb['options']?_0x189fdb['options'][_0x6957('0x1c')]?_[_0x6957('0x1d')](_0x189fdb[_0x6957('0x18')][_0x6957('0x1c')],function(_0x2feb45){return{'model':db[_0x2feb45[_0x6957('0x1e')]],'as':_0x2feb45['as'],'attributes':_0x2feb45['as']===_0x6957('0x2d')?_[_0x6957('0x47')](_0x59b090):_0x2feb45[_0x6957('0x1f')],'include':_0x2feb45['include']?_[_0x6957('0x1d')](_0x2feb45['include'],function(_0x3383ab){return{'model':db[_0x3383ab[_0x6957('0x1e')]],'as':_0x3383ab['as'],'attributes':_0x3383ab[_0x6957('0x1f')],'include':_0x3383ab[_0x6957('0x1c')]?_[_0x6957('0x1d')](_0x3383ab[_0x6957('0x1c')],function(_0x43931b){return{'model':db[_0x43931b['model']],'as':_0x43931b['as'],'attributes':_0x43931b[_0x6957('0x1f')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x323cd7){logger[_0x6957('0xc')](_0x6957('0x16'),_0x189fdb);logger[_0x6957('0xd')](_0x6957('0x16'),_0x189fdb,JSON[_0x6957('0x10')](_0x323cd7));_0x71eb06(_0x323cd7);})[_0x6957('0x22')](function(_0x2ec15f){logger[_0x6957('0x11')](_0x6957('0x16'),_0x2ec15f[_0x6957('0x13')],_0x189fdb);_0x8ad2b4(_0x4b6015[_0x6957('0x11')](0x1f4,_0x2ec15f[_0x6957('0x13')]));});});});};exports[_0x6957('0x48')]=function(_0x552607){console[_0x6957('0x49')](_0x6957('0x4a'),_0x552607);var _0x486c55=this;return new Promise(function(_0x2949b5,_0x1c30f9){return db[_0x6957('0x2c')]['findOne']({'raw':!![],'where':{'phone':_0x552607[_0x6957('0x27')]['phone']},'attributes':['id'],'order':[['id',_0x6957('0x4b')]]})[_0x6957('0x20')](function(_0x469cb0){console[_0x6957('0x49')](_0x6957('0x4c'),_0x469cb0);logger[_0x6957('0xc')]('getContactByPhone',_0x552607);logger[_0x6957('0xd')]('getContactByPhone',_0x552607,JSON[_0x6957('0x10')](_0x469cb0));_0x2949b5(_0x469cb0);})[_0x6957('0x22')](function(_0x157717){logger[_0x6957('0x11')](_0x6957('0x4d'),_0x157717[_0x6957('0x13')],_0x552607);_0x1c30f9(_0x486c55[_0x6957('0x11')](0x1f4,_0x157717[_0x6957('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopper/index.js b/server/api/cmHopper/index.js index 45d4f6f..27bcd58 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 _0xbd50=['/describe','isAuthenticated','describe','getOpenContacts','getTimezones','/:id','post','create','/preview','getPreview','/timezone','getTimezone','put','update','destroy','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','index','get'];(function(_0x5ae21a,_0xe0ada){var _0x327e75=function(_0x11d070){while(--_0x11d070){_0x5ae21a['push'](_0x5ae21a['shift']());}};_0x327e75(++_0xe0ada);}(_0xbd50,0x196));var _0x0bd5=function(_0x898cc2,_0x346605){_0x898cc2=_0x898cc2-0x0;var _0x10ec50=_0xbd50[_0x898cc2];return _0x10ec50;};'use strict';var multer=require(_0x0bd5('0x0'));var util=require(_0x0bd5('0x1'));var path=require(_0x0bd5('0x2'));var timeout=require('connect-timeout');var express=require(_0x0bd5('0x3'));var router=express[_0x0bd5('0x4')]();var auth=require(_0x0bd5('0x5'));var interaction=require(_0x0bd5('0x6'));var config=require(_0x0bd5('0x7'));var controller=require('./cmHopper.controller');router['get']('/',auth['isAuthenticated'](),controller[_0x0bd5('0x8')]);router[_0x0bd5('0x9')](_0x0bd5('0xa'),auth[_0x0bd5('0xb')](),controller[_0x0bd5('0xc')]);router['get']('/opencontacts',auth[_0x0bd5('0xb')](),controller[_0x0bd5('0xd')]);router[_0x0bd5('0x9')]('/timezones',auth[_0x0bd5('0xb')](),controller[_0x0bd5('0xe')]);router['get'](_0x0bd5('0xf'),auth[_0x0bd5('0xb')](),controller['show']);router[_0x0bd5('0x10')]('/',auth[_0x0bd5('0xb')](),controller[_0x0bd5('0x11')]);router['post'](_0x0bd5('0x12'),auth[_0x0bd5('0xb')](),controller[_0x0bd5('0x13')]);router[_0x0bd5('0x10')](_0x0bd5('0x14'),auth[_0x0bd5('0xb')](),controller[_0x0bd5('0x15')]);router[_0x0bd5('0x16')]('/:id',auth[_0x0bd5('0xb')](),controller[_0x0bd5('0x17')]);router['delete'](_0x0bd5('0xf'),auth[_0x0bd5('0xb')](),controller[_0x0bd5('0x18')]);module[_0x0bd5('0x19')]=router; \ No newline at end of file +var _0xdc97=['delete','destroy','exports','multer','util','path','express','../../components/auth/service','../../components/interaction/service','./cmHopper.controller','get','isAuthenticated','index','/describe','/opencontacts','getOpenContacts','getTimezones','/:id','show','post','getPreview','/timezone','getTimezone','put'];(function(_0x54ce88,_0x19778e){var _0x475fea=function(_0x43d9c2){while(--_0x43d9c2){_0x54ce88['push'](_0x54ce88['shift']());}};_0x475fea(++_0x19778e);}(_0xdc97,0x13b));var _0x7dc9=function(_0xa47489,_0x5d6b82){_0xa47489=_0xa47489-0x0;var _0x3d19d1=_0xdc97[_0xa47489];return _0x3d19d1;};'use strict';var multer=require(_0x7dc9('0x0'));var util=require(_0x7dc9('0x1'));var path=require(_0x7dc9('0x2'));var timeout=require('connect-timeout');var express=require(_0x7dc9('0x3'));var router=express['Router']();var auth=require(_0x7dc9('0x4'));var interaction=require(_0x7dc9('0x5'));var config=require('../../config/environment');var controller=require(_0x7dc9('0x6'));router[_0x7dc9('0x7')]('/',auth[_0x7dc9('0x8')](),controller[_0x7dc9('0x9')]);router['get'](_0x7dc9('0xa'),auth['isAuthenticated'](),controller['describe']);router[_0x7dc9('0x7')](_0x7dc9('0xb'),auth[_0x7dc9('0x8')](),controller[_0x7dc9('0xc')]);router[_0x7dc9('0x7')]('/timezones',auth[_0x7dc9('0x8')](),controller[_0x7dc9('0xd')]);router[_0x7dc9('0x7')](_0x7dc9('0xe'),auth[_0x7dc9('0x8')](),controller[_0x7dc9('0xf')]);router[_0x7dc9('0x10')]('/',auth['isAuthenticated'](),controller['create']);router['post']('/preview',auth[_0x7dc9('0x8')](),controller[_0x7dc9('0x11')]);router['post'](_0x7dc9('0x12'),auth[_0x7dc9('0x8')](),controller[_0x7dc9('0x13')]);router[_0x7dc9('0x14')](_0x7dc9('0xe'),auth[_0x7dc9('0x8')](),controller['update']);router[_0x7dc9('0x15')](_0x7dc9('0xe'),auth[_0x7dc9('0x8')](),controller[_0x7dc9('0x16')]);module[_0x7dc9('0x17')]=router; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.attributes.js b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.attributes.js index 2738f55..435692b 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 _0x55d3=['YYYY-MM-DD\x20HH:mm:ss','moment','sequelize','STRING','INTEGER','format'];(function(_0x8184d7,_0x5e09e4){var _0x2b4303=function(_0x5a0096){while(--_0x5a0096){_0x8184d7['push'](_0x8184d7['shift']());}};_0x2b4303(++_0x5e09e4);}(_0x55d3,0xc7));var _0x355d=function(_0x2ef8a3,_0x1dbf49){_0x2ef8a3=_0x2ef8a3-0x0;var _0x2c771d=_0x55d3[_0x2ef8a3];return _0x2c771d;};'use strict';var moment=require(_0x355d('0x0'));var Sequelize=require(_0x355d('0x1'));module['exports']={'CmHopperId':{'type':Sequelize['INTEGER']},'phone':{'type':Sequelize[_0x355d('0x2')],'allowNull':![]},'OrderBy':{'type':Sequelize[_0x355d('0x3')],'defaultValue':0x0},'scheduledat':{'type':Sequelize['DATE'],'defaultValue':moment()[_0x355d('0x4')](_0x355d('0x5'))},'countbusyretry':{'type':Sequelize[_0x355d('0x3')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x355d('0x3')],'defaultValue':0x0},'countnosuchnumberretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x355d('0x3')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x355d('0x3')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x355d('0x3')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x355d('0x3')],'defaultValue':0x0}}; \ No newline at end of file +var _0xed47=['INTEGER','DATE','YYYY-MM-DD\x20HH:mm:ss','moment','exports','STRING'];(function(_0x339129,_0x86dcc6){var _0x1570df=function(_0x3b537e){while(--_0x3b537e){_0x339129['push'](_0x339129['shift']());}};_0x1570df(++_0x86dcc6);}(_0xed47,0x189));var _0x7ed4=function(_0x592d48,_0x23f1ba){_0x592d48=_0x592d48-0x0;var _0x5d789e=_0xed47[_0x592d48];return _0x5d789e;};'use strict';var moment=require(_0x7ed4('0x0'));var Sequelize=require('sequelize');module[_0x7ed4('0x1')]={'CmHopperId':{'type':Sequelize['INTEGER']},'phone':{'type':Sequelize[_0x7ed4('0x2')],'allowNull':![]},'OrderBy':{'type':Sequelize[_0x7ed4('0x3')],'defaultValue':0x0},'scheduledat':{'type':Sequelize[_0x7ed4('0x4')],'defaultValue':moment()['format'](_0x7ed4('0x5'))},'countbusyretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x7ed4('0x3')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countnosuchnumberretry':{'type':Sequelize[_0x7ed4('0x3')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x7ed4('0x3')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x7ed4('0x3')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x7ed4('0x3')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x7ed4('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 2e3189e..d1ebcef 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 _0xfdb6=['lodash','squel','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','api','../../config/utils','status','end','json','count','offset','limit','Content-Range','apply','reject','save','update','then','destroy','CmHopperAdditionalPhones','UserProfileResource','sendStatus','error','name','send','map','CmHopperAdditionalPhone','rawAttributes','fieldName','key','keys','query','attributes','intersection','model','fields','hasOwnProperty','nolimit','order','sort','filters','filter','where','merge','type','VIRTUAL','options','findAll','rows','catch','params','length','include','find','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','html-pdf','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox'];(function(_0x2a8c21,_0x163576){var _0x5f3061=function(_0x4dc8eb){while(--_0x4dc8eb){_0x2a8c21['push'](_0x2a8c21['shift']());}};_0x5f3061(++_0x163576);}(_0xfdb6,0x1cb));var _0x6fdb=function(_0x229060,_0x54534b){_0x229060=_0x229060-0x0;var _0x46d71b=_0xfdb6[_0x229060];return _0x46d71b;};'use strict';var pdf=require(_0x6fdb('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x6fdb('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x6fdb('0x2'));var rp=require(_0x6fdb('0x3'));var moment=require(_0x6fdb('0x4'));var BPromise=require(_0x6fdb('0x5'));var Mustache=require(_0x6fdb('0x6'));var util=require('util');var path=require(_0x6fdb('0x7'));var sox=require(_0x6fdb('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0x6fdb('0x9'));var squel=require(_0x6fdb('0xa'));var crypto=require(_0x6fdb('0xb'));var jsforce=require(_0x6fdb('0xc'));var deskjs=require(_0x6fdb('0xd'));var toCsv=require(_0x6fdb('0xe'));var querystring=require('querystring');var Papa=require(_0x6fdb('0xf'));var Redis=require(_0x6fdb('0x10'));var authService=require(_0x6fdb('0x11'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x6fdb('0x12'));var utils=require(_0x6fdb('0x13'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x516a24,_0x4d8f24){_0x4d8f24=_0x4d8f24||0xcc;return function(_0x2bfb34){if(_0x2bfb34){return _0x516a24['sendStatus'](_0x4d8f24);}return _0x516a24[_0x6fdb('0x14')](_0x4d8f24)[_0x6fdb('0x15')]();};}function respondWithResult(_0x53aff5,_0xdf4496){_0xdf4496=_0xdf4496||0xc8;return function(_0x4263c2){if(_0x4263c2){return _0x53aff5[_0x6fdb('0x14')](_0xdf4496)[_0x6fdb('0x16')](_0x4263c2);}};}function respondWithFilteredResult(_0x157e9d,_0x10cfc6){return function(_0x16e79f){if(_0x16e79f){var _0x511977=_0x16e79f[_0x6fdb('0x17')],_0x3b9eee=_0x10cfc6[_0x6fdb('0x18')],_0x1b8fe2=_0x10cfc6[_0x6fdb('0x18')]+_0x10cfc6[_0x6fdb('0x19')],_0x98cb7c;if(_0x1b8fe2>=_0x511977){_0x1b8fe2=_0x511977;_0x98cb7c=0xc8;}else{_0x98cb7c=0xce;}_0x157e9d[_0x6fdb('0x14')](_0x98cb7c);return _0x157e9d['set'](_0x6fdb('0x1a'),_0x3b9eee+'-'+_0x1b8fe2+'/'+_0x511977)[_0x6fdb('0x16')](_0x16e79f);}return null;};}function patchUpdates(_0x2b82ac){return function(_0x48d61d){try{jsonpatch[_0x6fdb('0x1b')](_0x48d61d,_0x2b82ac,!![]);}catch(_0x176902){return BPromise[_0x6fdb('0x1c')](_0x176902);}return _0x48d61d[_0x6fdb('0x1d')]();};}function saveUpdates(_0x56dd7c,_0xac0da9){return function(_0x1d1bb9){if(_0x1d1bb9){return _0x1d1bb9[_0x6fdb('0x1e')](_0x56dd7c)[_0x6fdb('0x1f')](function(_0x1a712f){return _0x1a712f;});}return null;};}function removeEntity(_0x119dae,_0x5d1872){return function(_0x5741e1){if(_0x5741e1){return _0x5741e1[_0x6fdb('0x20')]()['then'](function(){var _0x848388=_0x5741e1['get']({'plain':!![]});var _0x42b662=_0x6fdb('0x21');return db[_0x6fdb('0x22')][_0x6fdb('0x20')]({'where':{'type':_0x42b662,'resourceId':_0x848388['id']}})[_0x6fdb('0x1f')](function(){return _0x5741e1;});})[_0x6fdb('0x1f')](function(){_0x119dae[_0x6fdb('0x14')](0xcc)['end']();});}};}function handleEntityNotFound(_0x101961,_0x34be0e){return function(_0x49cba4){if(!_0x49cba4){_0x101961[_0x6fdb('0x23')](0x194);}return _0x49cba4;};}function handleError(_0x4d3d43,_0x2a14d1){_0x2a14d1=_0x2a14d1||0x1f4;return function(_0x1cd1cc){logger[_0x6fdb('0x24')](_0x1cd1cc['stack']);if(_0x1cd1cc[_0x6fdb('0x25')]){delete _0x1cd1cc[_0x6fdb('0x25')];}_0x4d3d43[_0x6fdb('0x14')](_0x2a14d1)[_0x6fdb('0x26')](_0x1cd1cc);};}exports['index']=function(_0x53f3c0,_0x306b52){var _0x28316f={},_0x257d58={},_0x592547={'count':0x0,'rows':[]};var _0x4505d3=_[_0x6fdb('0x27')](db[_0x6fdb('0x28')][_0x6fdb('0x29')],function(_0x3c9924){return{'name':_0x3c9924[_0x6fdb('0x2a')],'type':_0x3c9924['type'][_0x6fdb('0x2b')]};});_0x257d58['model']=_[_0x6fdb('0x27')](_0x4505d3,_0x6fdb('0x25'));_0x257d58['query']=_[_0x6fdb('0x2c')](_0x53f3c0['query']);_0x257d58['filters']=_['intersection'](_0x257d58['model'],_0x257d58[_0x6fdb('0x2d')]);_0x28316f[_0x6fdb('0x2e')]=_[_0x6fdb('0x2f')](_0x257d58[_0x6fdb('0x30')],qs[_0x6fdb('0x31')](_0x53f3c0[_0x6fdb('0x2d')][_0x6fdb('0x31')]));_0x28316f[_0x6fdb('0x2e')]=_0x28316f['attributes']['length']?_0x28316f['attributes']:_0x257d58[_0x6fdb('0x30')];if(!_0x53f3c0[_0x6fdb('0x2d')][_0x6fdb('0x32')](_0x6fdb('0x33'))){_0x28316f[_0x6fdb('0x19')]=qs[_0x6fdb('0x19')](_0x53f3c0['query'][_0x6fdb('0x19')]);_0x28316f['offset']=qs[_0x6fdb('0x18')](_0x53f3c0[_0x6fdb('0x2d')][_0x6fdb('0x18')]);}_0x28316f[_0x6fdb('0x34')]=qs[_0x6fdb('0x35')](_0x53f3c0['query']['sort']);_0x28316f['where']=qs[_0x6fdb('0x36')](_['pick'](_0x53f3c0['query'],_0x257d58[_0x6fdb('0x36')]),_0x4505d3);if(_0x53f3c0['query'][_0x6fdb('0x37')]){_0x28316f[_0x6fdb('0x38')]=_[_0x6fdb('0x39')](_0x28316f['where'],{'$or':_['map'](_0x4505d3,function(_0x828aa9){if(_0x828aa9[_0x6fdb('0x3a')]!==_0x6fdb('0x3b')){var _0x590159={};_0x590159[_0x828aa9[_0x6fdb('0x25')]]={'$like':'%'+_0x53f3c0[_0x6fdb('0x2d')][_0x6fdb('0x37')]+'%'};return _0x590159;}})});}_0x28316f=_[_0x6fdb('0x39')]({},_0x28316f,_0x53f3c0[_0x6fdb('0x3c')]);var _0x4eed26={'where':_0x28316f['where']};return db[_0x6fdb('0x28')][_0x6fdb('0x17')](_0x4eed26)['then'](function(_0x1c51b0){_0x592547[_0x6fdb('0x17')]=_0x1c51b0;if(_0x53f3c0[_0x6fdb('0x2d')]['includeAll']){_0x28316f['include']=[{'all':!![]}];}return db[_0x6fdb('0x28')][_0x6fdb('0x3d')](_0x28316f);})[_0x6fdb('0x1f')](function(_0x6850db){_0x592547[_0x6fdb('0x3e')]=_0x6850db;return _0x592547;})[_0x6fdb('0x1f')](respondWithFilteredResult(_0x306b52,_0x28316f))[_0x6fdb('0x3f')](handleError(_0x306b52,null));};exports['show']=function(_0x4c2601,_0x5e1fd3){var _0x27806a={'raw':!![],'where':{'id':_0x4c2601[_0x6fdb('0x40')]['id']}},_0x3559e8={};_0x3559e8[_0x6fdb('0x30')]=_['keys'](db[_0x6fdb('0x28')][_0x6fdb('0x29')]);_0x3559e8[_0x6fdb('0x2d')]=_['keys'](_0x4c2601[_0x6fdb('0x2d')]);_0x3559e8[_0x6fdb('0x36')]=_[_0x6fdb('0x2f')](_0x3559e8[_0x6fdb('0x30')],_0x3559e8[_0x6fdb('0x2d')]);_0x27806a[_0x6fdb('0x2e')]=_[_0x6fdb('0x2f')](_0x3559e8['model'],qs[_0x6fdb('0x31')](_0x4c2601[_0x6fdb('0x2d')][_0x6fdb('0x31')]));_0x27806a[_0x6fdb('0x2e')]=_0x27806a[_0x6fdb('0x2e')][_0x6fdb('0x41')]?_0x27806a[_0x6fdb('0x2e')]:_0x3559e8[_0x6fdb('0x30')];if(_0x4c2601[_0x6fdb('0x2d')]['includeAll']){_0x27806a[_0x6fdb('0x42')]=[{'all':!![]}];}_0x27806a=_[_0x6fdb('0x39')]({},_0x27806a,_0x4c2601['options']);return db['CmHopperAdditionalPhone'][_0x6fdb('0x43')](_0x27806a)['then'](handleEntityNotFound(_0x5e1fd3,null))['then'](respondWithResult(_0x5e1fd3,null))[_0x6fdb('0x3f')](handleError(_0x5e1fd3,null));};exports['create']=function(_0x2476ea,_0x15090b){return db[_0x6fdb('0x28')]['create'](_0x2476ea['body'],{})[_0x6fdb('0x1f')](function(_0x146ecd){var _0x58f590=_0x2476ea[_0x6fdb('0x44')][_0x6fdb('0x45')]({'plain':!![]});if(!_0x58f590)throw new Error(_0x6fdb('0x46'));if(_0x58f590[_0x6fdb('0x47')]==='user'){var _0x4c0f48=_0x146ecd['get']({'plain':!![]});var _0x538e95='CmHopperAdditionalPhones';return db[_0x6fdb('0x48')]['find']({'where':{'name':_0x538e95,'userProfileId':_0x58f590[_0x6fdb('0x49')]},'raw':!![]})['then'](function(_0x52b7c4){if(_0x52b7c4&&_0x52b7c4[_0x6fdb('0x4a')]===0x0){return db[_0x6fdb('0x22')][_0x6fdb('0x4b')]({'name':_0x4c0f48['name'],'resourceId':_0x4c0f48['id'],'type':_0x52b7c4[_0x6fdb('0x25')],'sectionId':_0x52b7c4['id']},{})[_0x6fdb('0x1f')](function(){return _0x146ecd;});}else{return _0x146ecd;}})[_0x6fdb('0x3f')](function(_0x1bb494){logger[_0x6fdb('0x24')](_0x6fdb('0x4c'),_0x1bb494);throw _0x1bb494;});}return _0x146ecd;})['then'](respondWithResult(_0x15090b,0xc9))[_0x6fdb('0x3f')](handleError(_0x15090b,null));};exports[_0x6fdb('0x1e')]=function(_0x5e7428,_0x47238c){if(_0x5e7428[_0x6fdb('0x4d')]['id']){delete _0x5e7428[_0x6fdb('0x4d')]['id'];}return db[_0x6fdb('0x28')][_0x6fdb('0x43')]({'where':{'id':_0x5e7428[_0x6fdb('0x40')]['id']}})[_0x6fdb('0x1f')](handleEntityNotFound(_0x47238c,null))[_0x6fdb('0x1f')](saveUpdates(_0x5e7428[_0x6fdb('0x4d')],null))[_0x6fdb('0x1f')](respondWithResult(_0x47238c,null))['catch'](handleError(_0x47238c,null));};exports['destroy']=function(_0x2e8d2d,_0x55c125){return db[_0x6fdb('0x28')]['find']({'where':{'id':_0x2e8d2d[_0x6fdb('0x40')]['id']}})[_0x6fdb('0x1f')](handleEntityNotFound(_0x55c125,null))[_0x6fdb('0x1f')](removeEntity(_0x55c125,null))[_0x6fdb('0x3f')](handleError(_0x55c125,null));}; \ No newline at end of file +var _0x422a=['CmHopperAdditionalPhones','UserProfileResource','stack','name','send','index','map','CmHopperAdditionalPhone','type','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','merge','filter','options','count','includeAll','include','catch','show','params','rawAttributes','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','html-pdf','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','ejs','lodash','crypto','jsforce','desk.js','to-csv','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','end','offset','limit','set','Content-Range','json','save','update','then','destroy','get'];(function(_0x43d8c3,_0x5951eb){var _0x248aa0=function(_0x15b630){while(--_0x15b630){_0x43d8c3['push'](_0x43d8c3['shift']());}};_0x248aa0(++_0x5951eb);}(_0x422a,0x78));var _0xa422=function(_0x570f01,_0x30784e){_0x570f01=_0x570f01-0x0;var _0xeb1117=_0x422a[_0x570f01];return _0xeb1117;};'use strict';var pdf=require(_0xa422('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xa422('0x1'));var zipdir=require(_0xa422('0x2'));var jsonpatch=require(_0xa422('0x3'));var rp=require('request-promise');var moment=require(_0xa422('0x4'));var BPromise=require(_0xa422('0x5'));var Mustache=require(_0xa422('0x6'));var util=require(_0xa422('0x7'));var path=require(_0xa422('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xa422('0x9'));var fs=require('fs');var _=require(_0xa422('0xa'));var squel=require('squel');var crypto=require(_0xa422('0xb'));var jsforce=require(_0xa422('0xc'));var deskjs=require(_0xa422('0xd'));var toCsv=require(_0xa422('0xe'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xa422('0xf'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xa422('0x10'));var logger=require(_0xa422('0x11'))(_0xa422('0x12'));var utils=require(_0xa422('0x13'));var config=require(_0xa422('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4c043e,_0x5c777c){_0x5c777c=_0x5c777c||0xcc;return function(_0x4f6754){if(_0x4f6754){return _0x4c043e[_0xa422('0x15')](_0x5c777c);}return _0x4c043e[_0xa422('0x16')](_0x5c777c)[_0xa422('0x17')]();};}function respondWithResult(_0x2edeef,_0x396817){_0x396817=_0x396817||0xc8;return function(_0x275677){if(_0x275677){return _0x2edeef[_0xa422('0x16')](_0x396817)['json'](_0x275677);}};}function respondWithFilteredResult(_0xf4c04d,_0x184b63){return function(_0x3a7d1b){if(_0x3a7d1b){var _0x5e838c=_0x3a7d1b['count'],_0x2f06aa=_0x184b63[_0xa422('0x18')],_0x1a404c=_0x184b63['offset']+_0x184b63[_0xa422('0x19')],_0x5e00ca;if(_0x1a404c>=_0x5e838c){_0x1a404c=_0x5e838c;_0x5e00ca=0xc8;}else{_0x5e00ca=0xce;}_0xf4c04d['status'](_0x5e00ca);return _0xf4c04d[_0xa422('0x1a')](_0xa422('0x1b'),_0x2f06aa+'-'+_0x1a404c+'/'+_0x5e838c)[_0xa422('0x1c')](_0x3a7d1b);}return null;};}function patchUpdates(_0x58976c){return function(_0x48d43d){try{jsonpatch['apply'](_0x48d43d,_0x58976c,!![]);}catch(_0x2f85aa){return BPromise['reject'](_0x2f85aa);}return _0x48d43d[_0xa422('0x1d')]();};}function saveUpdates(_0x26c028,_0x8bf9e3){return function(_0x38df30){if(_0x38df30){return _0x38df30[_0xa422('0x1e')](_0x26c028)[_0xa422('0x1f')](function(_0x222246){return _0x222246;});}return null;};}function removeEntity(_0x322c0b,_0x3cbb6a){return function(_0x5ec3d8){if(_0x5ec3d8){return _0x5ec3d8[_0xa422('0x20')]()[_0xa422('0x1f')](function(){var _0x38d5fb=_0x5ec3d8[_0xa422('0x21')]({'plain':!![]});var _0x3b4fcf=_0xa422('0x22');return db[_0xa422('0x23')][_0xa422('0x20')]({'where':{'type':_0x3b4fcf,'resourceId':_0x38d5fb['id']}})[_0xa422('0x1f')](function(){return _0x5ec3d8;});})[_0xa422('0x1f')](function(){_0x322c0b[_0xa422('0x16')](0xcc)[_0xa422('0x17')]();});}};}function handleEntityNotFound(_0xa60c3d,_0x14e528){return function(_0x48b8ca){if(!_0x48b8ca){_0xa60c3d[_0xa422('0x15')](0x194);}return _0x48b8ca;};}function handleError(_0x24ec17,_0x4f29b6){_0x4f29b6=_0x4f29b6||0x1f4;return function(_0x10d445){logger['error'](_0x10d445[_0xa422('0x24')]);if(_0x10d445[_0xa422('0x25')]){delete _0x10d445[_0xa422('0x25')];}_0x24ec17[_0xa422('0x16')](_0x4f29b6)[_0xa422('0x26')](_0x10d445);};}exports[_0xa422('0x27')]=function(_0x4e466e,_0x188f5e){var _0x50db2e={},_0x17fb54={},_0x523df9={'count':0x0,'rows':[]};var _0x36afee=_[_0xa422('0x28')](db[_0xa422('0x29')]['rawAttributes'],function(_0x3a148d){return{'name':_0x3a148d['fieldName'],'type':_0x3a148d[_0xa422('0x2a')]['key']};});_0x17fb54[_0xa422('0x2b')]=_[_0xa422('0x28')](_0x36afee,'name');_0x17fb54[_0xa422('0x2c')]=_[_0xa422('0x2d')](_0x4e466e['query']);_0x17fb54[_0xa422('0x2e')]=_[_0xa422('0x2f')](_0x17fb54[_0xa422('0x2b')],_0x17fb54[_0xa422('0x2c')]);_0x50db2e[_0xa422('0x30')]=_[_0xa422('0x2f')](_0x17fb54['model'],qs[_0xa422('0x31')](_0x4e466e[_0xa422('0x2c')]['fields']));_0x50db2e[_0xa422('0x30')]=_0x50db2e[_0xa422('0x30')][_0xa422('0x32')]?_0x50db2e['attributes']:_0x17fb54[_0xa422('0x2b')];if(!_0x4e466e[_0xa422('0x2c')]['hasOwnProperty'](_0xa422('0x33'))){_0x50db2e[_0xa422('0x19')]=qs[_0xa422('0x19')](_0x4e466e[_0xa422('0x2c')][_0xa422('0x19')]);_0x50db2e[_0xa422('0x18')]=qs['offset'](_0x4e466e['query']['offset']);}_0x50db2e[_0xa422('0x34')]=qs[_0xa422('0x35')](_0x4e466e[_0xa422('0x2c')][_0xa422('0x35')]);_0x50db2e[_0xa422('0x36')]=qs['filters'](_[_0xa422('0x37')](_0x4e466e[_0xa422('0x2c')],_0x17fb54['filters']),_0x36afee);if(_0x4e466e['query']['filter']){_0x50db2e[_0xa422('0x36')]=_[_0xa422('0x38')](_0x50db2e[_0xa422('0x36')],{'$or':_['map'](_0x36afee,function(_0x2ab716){if(_0x2ab716[_0xa422('0x2a')]!=='VIRTUAL'){var _0x9441cc={};_0x9441cc[_0x2ab716['name']]={'$like':'%'+_0x4e466e[_0xa422('0x2c')][_0xa422('0x39')]+'%'};return _0x9441cc;}})});}_0x50db2e=_[_0xa422('0x38')]({},_0x50db2e,_0x4e466e[_0xa422('0x3a')]);var _0x4f1baf={'where':_0x50db2e[_0xa422('0x36')]};return db[_0xa422('0x29')][_0xa422('0x3b')](_0x4f1baf)[_0xa422('0x1f')](function(_0x3ac4fc){_0x523df9[_0xa422('0x3b')]=_0x3ac4fc;if(_0x4e466e['query'][_0xa422('0x3c')]){_0x50db2e[_0xa422('0x3d')]=[{'all':!![]}];}return db[_0xa422('0x29')]['findAll'](_0x50db2e);})[_0xa422('0x1f')](function(_0x112518){_0x523df9['rows']=_0x112518;return _0x523df9;})[_0xa422('0x1f')](respondWithFilteredResult(_0x188f5e,_0x50db2e))[_0xa422('0x3e')](handleError(_0x188f5e,null));};exports[_0xa422('0x3f')]=function(_0x59c2cd,_0x171a42){var _0x43bccc={'raw':!![],'where':{'id':_0x59c2cd[_0xa422('0x40')]['id']}},_0x5c4022={};_0x5c4022[_0xa422('0x2b')]=_['keys'](db['CmHopperAdditionalPhone'][_0xa422('0x41')]);_0x5c4022['query']=_[_0xa422('0x2d')](_0x59c2cd[_0xa422('0x2c')]);_0x5c4022['filters']=_[_0xa422('0x2f')](_0x5c4022[_0xa422('0x2b')],_0x5c4022[_0xa422('0x2c')]);_0x43bccc[_0xa422('0x30')]=_[_0xa422('0x2f')](_0x5c4022[_0xa422('0x2b')],qs[_0xa422('0x31')](_0x59c2cd[_0xa422('0x2c')]['fields']));_0x43bccc[_0xa422('0x30')]=_0x43bccc['attributes'][_0xa422('0x32')]?_0x43bccc[_0xa422('0x30')]:_0x5c4022['model'];if(_0x59c2cd['query'][_0xa422('0x3c')]){_0x43bccc['include']=[{'all':!![]}];}_0x43bccc=_['merge']({},_0x43bccc,_0x59c2cd['options']);return db['CmHopperAdditionalPhone'][_0xa422('0x42')](_0x43bccc)['then'](handleEntityNotFound(_0x171a42,null))[_0xa422('0x1f')](respondWithResult(_0x171a42,null))[_0xa422('0x3e')](handleError(_0x171a42,null));};exports[_0xa422('0x43')]=function(_0x226366,_0xf24077){return db[_0xa422('0x29')][_0xa422('0x43')](_0x226366[_0xa422('0x44')],{})[_0xa422('0x1f')](function(_0x402fb6){var _0x4a653d=_0x226366[_0xa422('0x45')][_0xa422('0x21')]({'plain':!![]});if(!_0x4a653d)throw new Error(_0xa422('0x46'));if(_0x4a653d[_0xa422('0x47')]===_0xa422('0x45')){var _0x19b945=_0x402fb6[_0xa422('0x21')]({'plain':!![]});var _0x2ad944=_0xa422('0x22');return db[_0xa422('0x48')][_0xa422('0x42')]({'where':{'name':_0x2ad944,'userProfileId':_0x4a653d[_0xa422('0x49')]},'raw':!![]})['then'](function(_0x1b7d10){if(_0x1b7d10&&_0x1b7d10[_0xa422('0x4a')]===0x0){return db[_0xa422('0x23')]['create']({'name':_0x19b945[_0xa422('0x25')],'resourceId':_0x19b945['id'],'type':_0x1b7d10['name'],'sectionId':_0x1b7d10['id']},{})[_0xa422('0x1f')](function(){return _0x402fb6;});}else{return _0x402fb6;}})[_0xa422('0x3e')](function(_0x3c5d3a){logger[_0xa422('0x4b')](_0xa422('0x4c'),_0x3c5d3a);throw _0x3c5d3a;});}return _0x402fb6;})[_0xa422('0x1f')](respondWithResult(_0xf24077,0xc9))[_0xa422('0x3e')](handleError(_0xf24077,null));};exports[_0xa422('0x1e')]=function(_0x20b65b,_0x4c73f5){if(_0x20b65b[_0xa422('0x44')]['id']){delete _0x20b65b[_0xa422('0x44')]['id'];}return db[_0xa422('0x29')][_0xa422('0x42')]({'where':{'id':_0x20b65b[_0xa422('0x40')]['id']}})['then'](handleEntityNotFound(_0x4c73f5,null))[_0xa422('0x1f')](saveUpdates(_0x20b65b['body'],null))[_0xa422('0x1f')](respondWithResult(_0x4c73f5,null))[_0xa422('0x3e')](handleError(_0x4c73f5,null));};exports[_0xa422('0x20')]=function(_0x2a73a3,_0x4ff222){return db[_0xa422('0x29')][_0xa422('0x42')]({'where':{'id':_0x2a73a3[_0xa422('0x40')]['id']}})['then'](handleEntityNotFound(_0x4ff222,null))['then'](removeEntity(_0x4ff222,null))[_0xa422('0x3e')](handleError(_0x4ff222,null));}; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model.js b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model.js index 12e4b35..065ae8d 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 _0x2087=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./cmHopperAdditionalPhone.attributes','exports','define','lodash'];(function(_0x13bad3,_0x4a7f19){var _0x49292c=function(_0x443290){while(--_0x443290){_0x13bad3['push'](_0x13bad3['shift']());}};_0x49292c(++_0x4a7f19);}(_0x2087,0x11f));var _0x7208=function(_0x139c3e,_0x584ed6){_0x139c3e=_0x139c3e-0x0;var _0x1fe091=_0x2087[_0x139c3e];return _0x1fe091;};'use strict';var _=require(_0x7208('0x0'));var util=require('util');var logger=require(_0x7208('0x1'))(_0x7208('0x2'));var moment=require(_0x7208('0x3'));var BPromise=require(_0x7208('0x4'));var rp=require(_0x7208('0x5'));var fs=require('fs');var path=require(_0x7208('0x6'));var rimraf=require(_0x7208('0x7'));var config=require(_0x7208('0x8'));var attributes=require(_0x7208('0x9'));module[_0x7208('0xa')]=function(_0x5dc4e5,_0x2f502e){return _0x5dc4e5[_0x7208('0xb')]('CmHopperAdditionalPhone',attributes,{'tableName':'cm_hopper_additional_phones','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc472=['./cmHopperAdditionalPhone.attributes','exports','define','CmHopperAdditionalPhone','cm_hopper_additional_phones','lodash','util','../../config/logger','bluebird','request-promise','path','rimraf'];(function(_0x4c81f9,_0x2abb01){var _0x5622e1=function(_0x49cd7c){while(--_0x49cd7c){_0x4c81f9['push'](_0x4c81f9['shift']());}};_0x5622e1(++_0x2abb01);}(_0xc472,0x1a9));var _0x2c47=function(_0x3e3f27,_0x2c2ecf){_0x3e3f27=_0x3e3f27-0x0;var _0x15c868=_0xc472[_0x3e3f27];return _0x15c868;};'use strict';var _=require(_0x2c47('0x0'));var util=require(_0x2c47('0x1'));var logger=require(_0x2c47('0x2'))('api');var moment=require('moment');var BPromise=require(_0x2c47('0x3'));var rp=require(_0x2c47('0x4'));var fs=require('fs');var path=require(_0x2c47('0x5'));var rimraf=require(_0x2c47('0x6'));var config=require('../../config/environment');var attributes=require(_0x2c47('0x7'));module[_0x2c47('0x8')]=function(_0x1fa968,_0x5bea5b){return _0x1fa968[_0x2c47('0x9')](_0x2c47('0xa'),attributes,{'tableName':_0x2c47('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.rpc.js b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.rpc.js index 5e8d7e8..8c83473 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 _0x5273=['info','CmHopperAdditionalPhone,\x20%s,\x20%s','debug','CmHopperAdditionalPhone,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','VerifyAdditionalPhones','CmHopper','findOne','body','ListId','VoiceQueueId','CampaignId','CmHopperAdditionalPhone','OrderBy','ASC','countbusyretry','countcongestionretry','countnoanswerretry','countabandonedretry','countmachineretry','countagentrejectretry','dialGlobalMaxRetry','countdropretry','SwapAdditionalPhones','waitTime','scheduledat','add','minutes','phone','isNil','countnosuchnumberretry','createdAt','updatedAt','hopperToAdd','transaction','update','IncrementPreviewCounters','field','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','then'];(function(_0x4fa665,_0x1ae12a){var _0x62ccff=function(_0x4f0bb8){while(--_0x4f0bb8){_0x4fa665['push'](_0x4fa665['shift']());}};_0x62ccff(++_0x1ae12a);}(_0x5273,0x1eb));var _0x3527=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x5273[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0x3527('0x0'));var util=require(_0x3527('0x1'));var moment=require(_0x3527('0x2'));var BPromise=require(_0x3527('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x3527('0x4'));var db=require(_0x3527('0x5'))['db'];var utils=require(_0x3527('0x6'));var logger=require('../../config/logger')(_0x3527('0x7'));var config=require(_0x3527('0x8'));var jayson=require(_0x3527('0x9'));var client=jayson[_0x3527('0xa')][_0x3527('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2d6718,_0x5c4092,_0x3973bd){return new BPromise(function(_0x5cf7a3,_0x28ad1e){return client['request'](_0x2d6718,_0x3973bd)[_0x3527('0xc')](function(_0x172c51){logger[_0x3527('0xd')](_0x3527('0xe'),_0x5c4092,'request\x20sent');logger[_0x3527('0xf')](_0x3527('0x10'),_0x5c4092,_0x3527('0x11'),JSON[_0x3527('0x12')](_0x172c51));if(_0x172c51[_0x3527('0x13')]){if(_0x172c51[_0x3527('0x13')]['code']===0x1f4){logger['error'](_0x3527('0xe'),_0x5c4092,_0x172c51['error'][_0x3527('0x14')]);return _0x28ad1e(_0x172c51['error']['message']);}logger[_0x3527('0x13')]('CmHopperAdditionalPhone,\x20%s,\x20%s',_0x5c4092,_0x172c51[_0x3527('0x13')]['message']);return _0x5cf7a3(_0x172c51[_0x3527('0x13')][_0x3527('0x14')]);}else{logger[_0x3527('0xd')]('CmHopperAdditionalPhone,\x20%s,\x20%s',_0x5c4092,_0x3527('0x11'));_0x5cf7a3(_0x172c51[_0x3527('0x15')][_0x3527('0x14')]);}})[_0x3527('0x16')](function(_0x546576){logger['error']('CmHopperAdditionalPhone,\x20%s,\x20%s',_0x5c4092,_0x546576);_0x28ad1e(_0x546576);});});}exports[_0x3527('0x17')]=function(_0x2a2226){var _0x2e9ab9=this;return new Promise(function(_0x25f3f7,_0x5621eb){return db[_0x3527('0x18')][_0x3527('0x19')]({'raw':!![],'where':{'ContactId':_0x2a2226[_0x3527('0x1a')]['ContactId'],'ListId':_0x2a2226[_0x3527('0x1a')][_0x3527('0x1b')],'VoiceQueueId':_0x2a2226['body'][_0x3527('0x1c')]===undefined?null:_0x2a2226['body']['VoiceQueueId'],'CampaignId':_0x2a2226[_0x3527('0x1a')][_0x3527('0x1d')]===undefined?null:_0x2a2226[_0x3527('0x1a')][_0x3527('0x1d')]}})[_0x3527('0xc')](function(_0x589c11){if(_0x589c11!=null){return db[_0x3527('0x1e')][_0x3527('0x19')]({'raw':!![],'where':{'CmHopperId':_0x589c11['id'],'OrderBy':{'$gt':_0x589c11[_0x3527('0x1f')]}},'order':[[_0x3527('0x1f'),_0x3527('0x20')]]})[_0x3527('0xc')](function(_0x5905d3){var _0x2aef6a=0x0;if(_0x5905d3){if(_0x5905d3[_0x3527('0x21')]+_0x5905d3[_0x3527('0x22')]+_0x5905d3[_0x3527('0x23')]+_0x5905d3['countnosuchnumberretry']+_0x5905d3['countdropretry']+_0x5905d3[_0x3527('0x24')]+_0x5905d3[_0x3527('0x25')]+_0x5905d3[_0x3527('0x26')]<_0x2a2226['entity'][_0x3527('0x27')])_0x2aef6a=0x1;_0x25f3f7({'additional':_0x2aef6a});}else{return db[_0x3527('0x1e')][_0x3527('0x19')]({'raw':!![],'where':{'CmHopperId':_0x589c11['id']},'order':[[_0x3527('0x1f'),_0x3527('0x20')]]})[_0x3527('0xc')](function(_0x202695){var _0x45af1e=0x0;if(_0x202695){if(_0x202695['countbusyretry']+_0x202695[_0x3527('0x22')]+_0x202695[_0x3527('0x23')]+_0x202695['countnosuchnumberretry']+_0x202695[_0x3527('0x28')]+_0x202695[_0x3527('0x24')]+_0x202695[_0x3527('0x25')]+_0x202695[_0x3527('0x26')]<_0x2a2226['entity'][_0x3527('0x27')])_0x45af1e=0x1;_0x25f3f7({'additional':_0x45af1e});}else{_0x25f3f7({'additional':0x0});}})[_0x3527('0x16')](function(_0x474071){logger['error'](_0x3527('0x17'),_0x474071[_0x3527('0x14')],_0x2a2226);_0x5621eb(_0x2e9ab9[_0x3527('0x13')](0x1f4,_0x474071[_0x3527('0x14')]));});}})[_0x3527('0x16')](function(_0x4d90bd){logger[_0x3527('0x13')](_0x3527('0x17'),_0x4d90bd['message'],_0x2a2226);_0x5621eb(_0x2e9ab9['error'](0x1f4,_0x4d90bd['message']));});}else _0x25f3f7({'additional':0x0});});});};exports[_0x3527('0x29')]=function(_0x66f919){var _0x59def1=this;return new Promise(function(_0x32ac7f,_0x48e1f2){return db['CmHopper']['findOne']({'raw':!![],'where':{'ContactId':_0x66f919[_0x3527('0x1a')]['ContactId'],'ListId':_0x66f919[_0x3527('0x1a')][_0x3527('0x1b')],'VoiceQueueId':_0x66f919['body'][_0x3527('0x1c')]===undefined?null:_0x66f919[_0x3527('0x1a')]['VoiceQueueId'],'CampaignId':_0x66f919[_0x3527('0x1a')][_0x3527('0x1d')]===undefined?null:_0x66f919[_0x3527('0x1a')]['CampaignId']}})['then'](function(_0x42bc32){if(_0x42bc32!=null){return db['CmHopperAdditionalPhone'][_0x3527('0x19')]({'raw':!![],'where':{'CmHopperId':_0x42bc32['id'],'OrderBy':{'$gt':_0x42bc32[_0x3527('0x1f')]}},'order':[['OrderBy','ASC']]})[_0x3527('0xc')](function(_0x544f6f){if(_0x544f6f)return activateAdditionalPhone(_0x42bc32,_0x66f919['body'],_0x544f6f,_0x66f919['duration'],_0x66f919['waitTime'])[_0x3527('0xc')](function(_0x17bf30){_0x32ac7f(_0x17bf30);});else{return db['CmHopperAdditionalPhone']['findOne']({'raw':!![],'where':{'CmHopperId':_0x42bc32['id']},'order':[[_0x3527('0x1f'),_0x3527('0x20')]]})[_0x3527('0xc')](function(_0x1e92de){if(_0x1e92de)return activateAdditionalPhone(_0x42bc32,_0x66f919[_0x3527('0x1a')],_0x1e92de,_0x66f919['duration'],_0x66f919[_0x3527('0x2a')])[_0x3527('0xc')](function(_0x424301){_0x32ac7f(_0x424301);});else{_0x32ac7f({'id':_0x42bc32['id'],'phone':''});}})[_0x3527('0x16')](function(_0x25ffc6){logger[_0x3527('0x13')]('VerifyAdditionalPhones',_0x25ffc6['message'],_0x66f919);_0x48e1f2(_0x59def1[_0x3527('0x13')](0x1f4,_0x25ffc6[_0x3527('0x14')]));});}})[_0x3527('0x16')](function(_0x3de451){logger['error'](_0x3527('0x17'),_0x3de451[_0x3527('0x14')],_0x66f919);_0x48e1f2(_0x59def1['error'](0x1f4,_0x3de451[_0x3527('0x14')]));});}else _0x32ac7f(0x1);});});};function activateAdditionalPhone(_0x34cf19,_0x3d9195,_0x46d1d9,_0x22a751,_0x1728fc){return new Promise(function(_0x2ad202,_0x505028){logger[_0x3527('0xd')]('VerifyAdditionalPhones',_0x46d1d9);var _0x448844;if(moment()>moment(_0x46d1d9[_0x3527('0x2b')])){_0x448844=moment()[_0x3527('0x2c')](_0x1728fc||0x3,_0x3527('0x2d'));}else{if(_0x46d1d9[_0x3527('0x1f')]==0x0){_0x448844=moment(_0x46d1d9[_0x3527('0x2b')]);}else{_0x448844=moment()['add'](_0x1728fc||0x3,_0x3527('0x2d'));}}var _0x340218={'phone':_0x34cf19[_0x3527('0x2e')],'active':0x0,'OrderBy':_[_0x3527('0x2f')](_0x34cf19[_0x3527('0x1f')])?0x0:_0x34cf19[_0x3527('0x1f')],'scheduledat':moment()[_0x3527('0x2c')](_0x22a751||0x1,_0x3527('0x2d')),'countbusyretry':_0x3d9195[_0x3527('0x21')],'countcongestionretry':_0x3d9195[_0x3527('0x22')],'countnoanswerretry':_0x3d9195[_0x3527('0x23')],'countnosuchnumberretry':_0x3d9195[_0x3527('0x30')],'countdropretry':_0x3d9195[_0x3527('0x28')],'countabandonedretry':_0x3d9195[_0x3527('0x24')],'countmachineretry':_0x3d9195[_0x3527('0x25')],'countagentrejectretry':_0x3d9195[_0x3527('0x26')],'createdAt':_0x3d9195[_0x3527('0x31')],'updatedAt':_0x3d9195[_0x3527('0x32')]};var _0x22631d={'CmHopperId':_0x34cf19['id'],'phone':_0x46d1d9[_0x3527('0x2e')],'active':0x0,'OrderBy':_['isNil'](_0x46d1d9[_0x3527('0x1f')])?0x0:_0x46d1d9[_0x3527('0x1f')],'scheduledat':_0x448844,'countbusyretry':_0x46d1d9[_0x3527('0x21')],'countcongestionretry':_0x46d1d9['countcongestionretry'],'countnoanswerretry':_0x46d1d9['countnoanswerretry'],'countnosuchnumberretry':_0x3d9195['countnosuchnumberretry'],'countdropretry':_0x3d9195[_0x3527('0x28')],'countabandonedretry':_0x3d9195['countabandonedretry'],'countmachineretry':_0x3d9195[_0x3527('0x25')],'countagentrejectretry':_0x3d9195[_0x3527('0x26')],'createdAt':_0x46d1d9[_0x3527('0x31')],'updatedAt':_0x46d1d9[_0x3527('0x32')]};logger[_0x3527('0xd')](_0x3527('0x33'),_0x340218);logger[_0x3527('0xd')]('additionalToHop',_0x22631d);return db['sequelize'][_0x3527('0x34')](function(_0x59b1cc){return db[_0x3527('0x1e')][_0x3527('0x35')](_0x340218,{'where':{'id':_0x46d1d9['id']}},{'transaction':_0x59b1cc})[_0x3527('0xc')](function(){return db[_0x3527('0x18')][_0x3527('0x35')](_0x22631d,{'where':{'id':_0x34cf19['id']}},{'transaction':_0x59b1cc});});})['then'](function(_0xb4f1ac){_0x2ad202({'id':_0x34cf19['id'],'phone':_0x46d1d9['phone']});})[_0x3527('0x16')](function(_0x49dcc1){logger[_0x3527('0x13')]('VerifyAdditionalPhones',_0x49dcc1['message'],req);_0x505028(_this[_0x3527('0x13')](0x1f4,_0x49dcc1[_0x3527('0x14')]));});});}exports[_0x3527('0x36')]=function(_0x58a92e){var _0x528dee=this;return new Promise(function(_0xf59c35,_0xbfa23c){return db['CmHopper'][_0x3527('0x35')](_0x58a92e[_0x3527('0x1a')][_0x3527('0x37')],{'where':{'id':_0x58a92e[_0x3527('0x1a')]['id']}})['then'](function(_0x499205){_0xf59c35(_0x499205);})['catch'](function(_0x538a42){logger[_0x3527('0x13')](_0x3527('0x36'),_0x538a42[_0x3527('0x14')],_0x58a92e);_0xbfa23c(_0x528dee[_0x3527('0x13')](0x1f4,_0x538a42[_0x3527('0x14')]));});});}; \ No newline at end of file +var _0x0303=['../../mysqldb','../../config/utils','rpc','../../config/environment','request','then','CmHopperAdditionalPhone,\x20%s,\x20%s','request\x20sent','debug','CmHopperAdditionalPhone,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','VerifyAdditionalPhones','findOne','body','ContactId','ListId','VoiceQueueId','CampaignId','CmHopperAdditionalPhone','OrderBy','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countabandonedretry','countmachineretry','countagentrejectretry','entity','dialGlobalMaxRetry','ASC','countdropretry','SwapAdditionalPhones','CmHopper','duration','waitTime','scheduledat','add','minutes','phone','isNil','updatedAt','createdAt','hopperToAdd','additionalToHop','sequelize','transaction','update','IncrementPreviewCounters','field','bluebird','randomstring','ioredis'];(function(_0x4bd9da,_0x3d6e93){var _0x3f7605=function(_0x10cee8){while(--_0x10cee8){_0x4bd9da['push'](_0x4bd9da['shift']());}};_0x3f7605(++_0x3d6e93);}(_0x0303,0x159));var _0x3030=function(_0x55821d,_0x27a22e){_0x55821d=_0x55821d-0x0;var _0x58ea8a=_0x0303[_0x55821d];return _0x58ea8a;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0x3030('0x0'));var rs=require(_0x3030('0x1'));var fs=require('fs');var Redis=require(_0x3030('0x2'));var db=require(_0x3030('0x3'))['db'];var utils=require(_0x3030('0x4'));var logger=require('../../config/logger')(_0x3030('0x5'));var config=require(_0x3030('0x6'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x5aaa69,_0x4b8e2f,_0x4e3a16){return new BPromise(function(_0x2805f7,_0x178a19){return client[_0x3030('0x7')](_0x5aaa69,_0x4e3a16)[_0x3030('0x8')](function(_0x2cf3e7){logger['info'](_0x3030('0x9'),_0x4b8e2f,_0x3030('0xa'));logger[_0x3030('0xb')](_0x3030('0xc'),_0x4b8e2f,'request\x20sent',JSON[_0x3030('0xd')](_0x2cf3e7));if(_0x2cf3e7[_0x3030('0xe')]){if(_0x2cf3e7['error'][_0x3030('0xf')]===0x1f4){logger[_0x3030('0xe')]('CmHopperAdditionalPhone,\x20%s,\x20%s',_0x4b8e2f,_0x2cf3e7['error'][_0x3030('0x10')]);return _0x178a19(_0x2cf3e7[_0x3030('0xe')][_0x3030('0x10')]);}logger[_0x3030('0xe')](_0x3030('0x9'),_0x4b8e2f,_0x2cf3e7['error'][_0x3030('0x10')]);return _0x2805f7(_0x2cf3e7[_0x3030('0xe')][_0x3030('0x10')]);}else{logger[_0x3030('0x11')](_0x3030('0x9'),_0x4b8e2f,_0x3030('0xa'));_0x2805f7(_0x2cf3e7[_0x3030('0x12')][_0x3030('0x10')]);}})[_0x3030('0x13')](function(_0x1f0861){logger['error']('CmHopperAdditionalPhone,\x20%s,\x20%s',_0x4b8e2f,_0x1f0861);_0x178a19(_0x1f0861);});});}exports[_0x3030('0x14')]=function(_0xddeadd){var _0x393bfa=this;return new Promise(function(_0x328a33,_0x3afcd8){return db['CmHopper'][_0x3030('0x15')]({'raw':!![],'where':{'ContactId':_0xddeadd[_0x3030('0x16')][_0x3030('0x17')],'ListId':_0xddeadd[_0x3030('0x16')][_0x3030('0x18')],'VoiceQueueId':_0xddeadd[_0x3030('0x16')][_0x3030('0x19')]===undefined?null:_0xddeadd[_0x3030('0x16')][_0x3030('0x19')],'CampaignId':_0xddeadd[_0x3030('0x16')]['CampaignId']===undefined?null:_0xddeadd['body'][_0x3030('0x1a')]}})[_0x3030('0x8')](function(_0x3868c7){if(_0x3868c7!=null){return db[_0x3030('0x1b')][_0x3030('0x15')]({'raw':!![],'where':{'CmHopperId':_0x3868c7['id'],'OrderBy':{'$gt':_0x3868c7['OrderBy']}},'order':[[_0x3030('0x1c'),'ASC']]})[_0x3030('0x8')](function(_0x5d6124){var _0x1e10c4=0x0;if(_0x5d6124){if(_0x5d6124[_0x3030('0x1d')]+_0x5d6124[_0x3030('0x1e')]+_0x5d6124[_0x3030('0x1f')]+_0x5d6124[_0x3030('0x20')]+_0x5d6124['countdropretry']+_0x5d6124[_0x3030('0x21')]+_0x5d6124[_0x3030('0x22')]+_0x5d6124[_0x3030('0x23')]<_0xddeadd[_0x3030('0x24')][_0x3030('0x25')])_0x1e10c4=0x1;_0x328a33({'additional':_0x1e10c4});}else{return db[_0x3030('0x1b')][_0x3030('0x15')]({'raw':!![],'where':{'CmHopperId':_0x3868c7['id']},'order':[[_0x3030('0x1c'),_0x3030('0x26')]]})[_0x3030('0x8')](function(_0x5af1e9){var _0x5d7d14=0x0;if(_0x5af1e9){if(_0x5af1e9[_0x3030('0x1d')]+_0x5af1e9[_0x3030('0x1e')]+_0x5af1e9[_0x3030('0x1f')]+_0x5af1e9[_0x3030('0x20')]+_0x5af1e9[_0x3030('0x27')]+_0x5af1e9[_0x3030('0x21')]+_0x5af1e9['countmachineretry']+_0x5af1e9['countagentrejectretry']<_0xddeadd['entity'][_0x3030('0x25')])_0x5d7d14=0x1;_0x328a33({'additional':_0x5d7d14});}else{_0x328a33({'additional':0x0});}})['catch'](function(_0xdeb0b1){logger['error'](_0x3030('0x14'),_0xdeb0b1['message'],_0xddeadd);_0x3afcd8(_0x393bfa['error'](0x1f4,_0xdeb0b1[_0x3030('0x10')]));});}})['catch'](function(_0x104542){logger[_0x3030('0xe')]('VerifyAdditionalPhones',_0x104542[_0x3030('0x10')],_0xddeadd);_0x3afcd8(_0x393bfa['error'](0x1f4,_0x104542[_0x3030('0x10')]));});}else _0x328a33({'additional':0x0});});});};exports[_0x3030('0x28')]=function(_0x32e1e6){var _0x55311e=this;return new Promise(function(_0x5c9d79,_0x5c7581){return db[_0x3030('0x29')][_0x3030('0x15')]({'raw':!![],'where':{'ContactId':_0x32e1e6[_0x3030('0x16')][_0x3030('0x17')],'ListId':_0x32e1e6[_0x3030('0x16')][_0x3030('0x18')],'VoiceQueueId':_0x32e1e6[_0x3030('0x16')][_0x3030('0x19')]===undefined?null:_0x32e1e6[_0x3030('0x16')][_0x3030('0x19')],'CampaignId':_0x32e1e6[_0x3030('0x16')][_0x3030('0x1a')]===undefined?null:_0x32e1e6['body'][_0x3030('0x1a')]}})[_0x3030('0x8')](function(_0x2e2d8b){if(_0x2e2d8b!=null){return db[_0x3030('0x1b')][_0x3030('0x15')]({'raw':!![],'where':{'CmHopperId':_0x2e2d8b['id'],'OrderBy':{'$gt':_0x2e2d8b[_0x3030('0x1c')]}},'order':[[_0x3030('0x1c'),'ASC']]})[_0x3030('0x8')](function(_0x33f37a){if(_0x33f37a)return activateAdditionalPhone(_0x2e2d8b,_0x32e1e6[_0x3030('0x16')],_0x33f37a,_0x32e1e6[_0x3030('0x2a')],_0x32e1e6[_0x3030('0x2b')])[_0x3030('0x8')](function(_0x4e4221){_0x5c9d79(_0x4e4221);});else{return db[_0x3030('0x1b')][_0x3030('0x15')]({'raw':!![],'where':{'CmHopperId':_0x2e2d8b['id']},'order':[['OrderBy',_0x3030('0x26')]]})[_0x3030('0x8')](function(_0x2fd269){if(_0x2fd269)return activateAdditionalPhone(_0x2e2d8b,_0x32e1e6['body'],_0x2fd269,_0x32e1e6[_0x3030('0x2a')],_0x32e1e6['waitTime'])[_0x3030('0x8')](function(_0x205abc){_0x5c9d79(_0x205abc);});else{_0x5c9d79({'id':_0x2e2d8b['id'],'phone':''});}})[_0x3030('0x13')](function(_0x1da2ab){logger[_0x3030('0xe')](_0x3030('0x14'),_0x1da2ab[_0x3030('0x10')],_0x32e1e6);_0x5c7581(_0x55311e['error'](0x1f4,_0x1da2ab[_0x3030('0x10')]));});}})[_0x3030('0x13')](function(_0x931184){logger[_0x3030('0xe')](_0x3030('0x14'),_0x931184[_0x3030('0x10')],_0x32e1e6);_0x5c7581(_0x55311e[_0x3030('0xe')](0x1f4,_0x931184[_0x3030('0x10')]));});}else _0x5c9d79(0x1);});});};function activateAdditionalPhone(_0x33ee5a,_0x57a7d9,_0x4084d0,_0x2a3ceb,_0x17a90a){return new Promise(function(_0x330f65,_0x269a34){logger[_0x3030('0x11')](_0x3030('0x14'),_0x4084d0);var _0x1a000b;if(moment()>moment(_0x4084d0[_0x3030('0x2c')])){_0x1a000b=moment()[_0x3030('0x2d')](_0x17a90a||0x3,'minutes');}else{if(_0x4084d0[_0x3030('0x1c')]==0x0){_0x1a000b=moment(_0x4084d0['scheduledat']);}else{_0x1a000b=moment()['add'](_0x17a90a||0x3,_0x3030('0x2e'));}}var _0x363fc1={'phone':_0x33ee5a[_0x3030('0x2f')],'active':0x0,'OrderBy':_[_0x3030('0x30')](_0x33ee5a[_0x3030('0x1c')])?0x0:_0x33ee5a['OrderBy'],'scheduledat':moment()[_0x3030('0x2d')](_0x2a3ceb||0x1,_0x3030('0x2e')),'countbusyretry':_0x57a7d9[_0x3030('0x1d')],'countcongestionretry':_0x57a7d9[_0x3030('0x1e')],'countnoanswerretry':_0x57a7d9[_0x3030('0x1f')],'countnosuchnumberretry':_0x57a7d9['countnosuchnumberretry'],'countdropretry':_0x57a7d9[_0x3030('0x27')],'countabandonedretry':_0x57a7d9[_0x3030('0x21')],'countmachineretry':_0x57a7d9[_0x3030('0x22')],'countagentrejectretry':_0x57a7d9[_0x3030('0x23')],'createdAt':_0x57a7d9['createdAt'],'updatedAt':_0x57a7d9[_0x3030('0x31')]};var _0x25fc9a={'CmHopperId':_0x33ee5a['id'],'phone':_0x4084d0[_0x3030('0x2f')],'active':0x0,'OrderBy':_[_0x3030('0x30')](_0x4084d0['OrderBy'])?0x0:_0x4084d0[_0x3030('0x1c')],'scheduledat':_0x1a000b,'countbusyretry':_0x4084d0[_0x3030('0x1d')],'countcongestionretry':_0x4084d0['countcongestionretry'],'countnoanswerretry':_0x4084d0[_0x3030('0x1f')],'countnosuchnumberretry':_0x57a7d9[_0x3030('0x20')],'countdropretry':_0x57a7d9[_0x3030('0x27')],'countabandonedretry':_0x57a7d9[_0x3030('0x21')],'countmachineretry':_0x57a7d9[_0x3030('0x22')],'countagentrejectretry':_0x57a7d9[_0x3030('0x23')],'createdAt':_0x4084d0[_0x3030('0x32')],'updatedAt':_0x4084d0[_0x3030('0x31')]};logger['info'](_0x3030('0x33'),_0x363fc1);logger[_0x3030('0x11')](_0x3030('0x34'),_0x25fc9a);return db[_0x3030('0x35')][_0x3030('0x36')](function(_0x3a15ab){return db[_0x3030('0x1b')][_0x3030('0x37')](_0x363fc1,{'where':{'id':_0x4084d0['id']}},{'transaction':_0x3a15ab})[_0x3030('0x8')](function(){return db['CmHopper']['update'](_0x25fc9a,{'where':{'id':_0x33ee5a['id']}},{'transaction':_0x3a15ab});});})['then'](function(_0x240719){_0x330f65({'id':_0x33ee5a['id'],'phone':_0x4084d0[_0x3030('0x2f')]});})[_0x3030('0x13')](function(_0x1a5aab){logger[_0x3030('0xe')]('VerifyAdditionalPhones',_0x1a5aab[_0x3030('0x10')],req);_0x269a34(_this[_0x3030('0xe')](0x1f4,_0x1a5aab[_0x3030('0x10')]));});});}exports[_0x3030('0x38')]=function(_0x21be7a){var _0xef2fde=this;return new Promise(function(_0x1789ab,_0x302c01){return db['CmHopper'][_0x3030('0x37')](_0x21be7a[_0x3030('0x16')][_0x3030('0x39')],{'where':{'id':_0x21be7a[_0x3030('0x16')]['id']}})[_0x3030('0x8')](function(_0x4d9aef){_0x1789ab(_0x4d9aef);})[_0x3030('0x13')](function(_0x293a3b){logger[_0x3030('0xe')](_0x3030('0x38'),_0x293a3b[_0x3030('0x10')],_0x21be7a);_0x302c01(_0xef2fde[_0x3030('0xe')](0x1f4,_0x293a3b[_0x3030('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/index.js b/server/api/cmHopperAdditionalPhone/index.js index 45c2e2b..0413254 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 _0x8ce5=['../../config/environment','./cmHopperAdditionalPhone.controller','get','index','/:id','isAuthenticated','show','post','create','put','delete','destroy','exports','util','Router','../../components/auth/service'];(function(_0x72feca,_0x4d6730){var _0x2ec5a9=function(_0x2d3b6e){while(--_0x2d3b6e){_0x72feca['push'](_0x72feca['shift']());}};_0x2ec5a9(++_0x4d6730);}(_0x8ce5,0x17d));var _0x58ce=function(_0x31508e,_0x46c25e){_0x31508e=_0x31508e-0x0;var _0x226068=_0x8ce5[_0x31508e];return _0x226068;};'use strict';var multer=require('multer');var util=require(_0x58ce('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x58ce('0x1')]();var auth=require(_0x58ce('0x2'));var interaction=require('../../components/interaction/service');var config=require(_0x58ce('0x3'));var controller=require(_0x58ce('0x4'));router[_0x58ce('0x5')]('/',auth['isAuthenticated'](),controller[_0x58ce('0x6')]);router[_0x58ce('0x5')](_0x58ce('0x7'),auth[_0x58ce('0x8')](),controller[_0x58ce('0x9')]);router[_0x58ce('0xa')]('/',auth[_0x58ce('0x8')](),controller[_0x58ce('0xb')]);router[_0x58ce('0xc')](_0x58ce('0x7'),auth[_0x58ce('0x8')](),controller['update']);router[_0x58ce('0xd')](_0x58ce('0x7'),auth[_0x58ce('0x8')](),controller[_0x58ce('0xe')]);module[_0x58ce('0xf')]=router; \ No newline at end of file +var _0x2480=['isAuthenticated','/:id','show','post','create','put','update','destroy','exports','util','path','connect-timeout','express','Router','./cmHopperAdditionalPhone.controller','get'];(function(_0x4737b9,_0x5a83c5){var _0xe396e0=function(_0x54fe52){while(--_0x54fe52){_0x4737b9['push'](_0x4737b9['shift']());}};_0xe396e0(++_0x5a83c5);}(_0x2480,0x1c9));var _0x0248=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x2480[_0x2dafbe];return _0x58a45a;};'use strict';var multer=require('multer');var util=require(_0x0248('0x0'));var path=require(_0x0248('0x1'));var timeout=require(_0x0248('0x2'));var express=require(_0x0248('0x3'));var router=express[_0x0248('0x4')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x0248('0x5'));router[_0x0248('0x6')]('/',auth[_0x0248('0x7')](),controller['index']);router[_0x0248('0x6')](_0x0248('0x8'),auth['isAuthenticated'](),controller[_0x0248('0x9')]);router[_0x0248('0xa')]('/',auth[_0x0248('0x7')](),controller[_0x0248('0xb')]);router[_0x0248('0xc')](_0x0248('0x8'),auth[_0x0248('0x7')](),controller[_0x0248('0xd')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0x0248('0xe')]);module[_0x0248('0xf')]=router; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.attributes.js b/server/api/cmHopperBlack/cmHopperBlack.attributes.js index 2afb31a..941e055 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 _0xc917=['sequelize','STRING','INTEGER','contactListQueue','moment'];(function(_0x40220a,_0x22feb1){var _0x3903cc=function(_0x33a296){while(--_0x33a296){_0x40220a['push'](_0x40220a['shift']());}};_0x3903cc(++_0x22feb1);}(_0xc917,0xd1));var _0x7c91=function(_0x511bd1,_0x223e5b){_0x511bd1=_0x511bd1-0x0;var _0x4c48ec=_0xc917[_0x511bd1];return _0x4c48ec;};'use strict';var moment=require(_0x7c91('0x0'));var Sequelize=require(_0x7c91('0x1'));module['exports']={'phone':{'type':Sequelize[_0x7c91('0x2')],'allowNull':![]},'ContactId':{'type':Sequelize[_0x7c91('0x3')],'unique':_0x7c91('0x4')},'ListId':{'type':Sequelize[_0x7c91('0x3')],'unique':_0x7c91('0x4')},'VoiceQueueId':{'type':Sequelize['INTEGER'],'unique':_0x7c91('0x4')}}; \ No newline at end of file +var _0x6305=['INTEGER','moment','sequelize','STRING','contactListQueue'];(function(_0x468f75,_0x21cae8){var _0x4697ba=function(_0x285bc4){while(--_0x285bc4){_0x468f75['push'](_0x468f75['shift']());}};_0x4697ba(++_0x21cae8);}(_0x6305,0x178));var _0x5630=function(_0x47e7cb,_0x4c1b8d){_0x47e7cb=_0x47e7cb-0x0;var _0x2a8874=_0x6305[_0x47e7cb];return _0x2a8874;};'use strict';var moment=require(_0x5630('0x0'));var Sequelize=require(_0x5630('0x1'));module['exports']={'phone':{'type':Sequelize[_0x5630('0x2')],'allowNull':![]},'ContactId':{'type':Sequelize['INTEGER'],'unique':_0x5630('0x3')},'ListId':{'type':Sequelize[_0x5630('0x4')],'unique':'contactListQueue'},'VoiceQueueId':{'type':Sequelize['INTEGER'],'unique':_0x5630('0x3')}}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.controller.js b/server/api/cmHopperBlack/cmHopperBlack.controller.js index 29f1d3e..0e51131 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(_0x1ad1e2,_0x5746b2){var _0xfeab08=function(_0x3c4c55){while(--_0x3c4c55){_0x1ad1e2['push'](_0x1ad1e2['shift']());}};_0xfeab08(++_0x5746b2);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5b78e8,_0x55096b){_0x5b78e8=_0x5b78e8-0x0;var _0xf2c321=_0xa9e0[_0x5b78e8];return _0xf2c321;};'use strict';var pdf=require(_0x0a9e('0x0'));var emlformat=require(_0x0a9e('0x1'));var rimraf=require(_0x0a9e('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x0a9e('0x3'));var moment=require('moment');var BPromise=require(_0x0a9e('0x4'));var Mustache=require(_0x0a9e('0x5'));var util=require(_0x0a9e('0x6'));var path=require(_0x0a9e('0x7'));var sox=require(_0x0a9e('0x8'));var csv=require('to-csv');var ejs=require(_0x0a9e('0x9'));var fs=require('fs');var _=require(_0x0a9e('0xa'));var squel=require(_0x0a9e('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x0a9e('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x0a9e('0xd'));var Redis=require(_0x0a9e('0xe'));var authService=require(_0x0a9e('0xf'));var qs=require(_0x0a9e('0x10'));var as=require(_0x0a9e('0x11'));var hardwareService=require(_0x0a9e('0x12'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require('../../config/environment');var db=require(_0x0a9e('0x13'))['db'];function respondWithStatusCode(_0x36471c,_0xd5b662){_0xd5b662=_0xd5b662||0xcc;return function(_0x26d672){if(_0x26d672){return _0x36471c[_0x0a9e('0x14')](_0xd5b662);}return _0x36471c[_0x0a9e('0x15')](_0xd5b662)['end']();};}function respondWithResult(_0x4283ce,_0x239b12){_0x239b12=_0x239b12||0xc8;return function(_0x2b4227){if(_0x2b4227){return _0x4283ce[_0x0a9e('0x15')](_0x239b12)[_0x0a9e('0x16')](_0x2b4227);}};}function respondWithFilteredResult(_0x4d5611,_0x52a03d){return function(_0x22dccb){if(_0x22dccb){var _0x5d0880=_0x22dccb[_0x0a9e('0x17')],_0x1985b6=_0x52a03d['offset'],_0x519dfd=_0x52a03d[_0x0a9e('0x18')]+_0x52a03d['limit'],_0x16033c;if(_0x519dfd>=_0x5d0880){_0x519dfd=_0x5d0880;_0x16033c=0xc8;}else{_0x16033c=0xce;}_0x4d5611[_0x0a9e('0x15')](_0x16033c);return _0x4d5611[_0x0a9e('0x19')](_0x0a9e('0x1a'),_0x1985b6+'-'+_0x519dfd+'/'+_0x5d0880)[_0x0a9e('0x16')](_0x22dccb);}return null;};}function patchUpdates(_0x31b1ca){return function(_0x2eb11f){try{jsonpatch[_0x0a9e('0x1b')](_0x2eb11f,_0x31b1ca,!![]);}catch(_0x20559e){return BPromise[_0x0a9e('0x1c')](_0x20559e);}return _0x2eb11f[_0x0a9e('0x1d')]();};}function saveUpdates(_0x1c696a,_0x105080){return function(_0x4bb1e3){if(_0x4bb1e3){return _0x4bb1e3[_0x0a9e('0x1e')](_0x1c696a)[_0x0a9e('0x1f')](function(_0x53682f){return _0x53682f;});}return null;};}function removeEntity(_0x20f109,_0x5a09ef){return function(_0x588269){if(_0x588269){return _0x588269[_0x0a9e('0x20')]()[_0x0a9e('0x1f')](function(){_0x20f109[_0x0a9e('0x15')](0xcc)[_0x0a9e('0x21')]();});}};}function handleEntityNotFound(_0x4abc77,_0xfb6e48){return function(_0x2fb0e4){if(!_0x2fb0e4){_0x4abc77[_0x0a9e('0x14')](0x194);}return _0x2fb0e4;};}function handleError(_0x4d00e6,_0x370d86){_0x370d86=_0x370d86||0x1f4;return function(_0x42ac8f){logger[_0x0a9e('0x22')](_0x42ac8f['stack']);if(_0x42ac8f['name']){delete _0x42ac8f[_0x0a9e('0x23')];}_0x4d00e6[_0x0a9e('0x15')](_0x370d86)[_0x0a9e('0x24')](_0x42ac8f);};}exports[_0x0a9e('0x25')]=function(_0x526cf3,_0x384319){var _0x479bc4={},_0x45a1e7={},_0x5bfb33={'count':0x0,'rows':[]};var _0x1dc186=_[_0x0a9e('0x26')](db[_0x0a9e('0x27')][_0x0a9e('0x28')],function(_0x140511){return{'name':_0x140511[_0x0a9e('0x29')],'type':_0x140511[_0x0a9e('0x2a')][_0x0a9e('0x2b')]};});_0x45a1e7['model']=_[_0x0a9e('0x26')](_0x1dc186,_0x0a9e('0x23'));_0x45a1e7[_0x0a9e('0x2c')]=_[_0x0a9e('0x2d')](_0x526cf3['query']);_0x45a1e7[_0x0a9e('0x2e')]=_[_0x0a9e('0x2f')](_0x45a1e7[_0x0a9e('0x30')],_0x45a1e7[_0x0a9e('0x2c')]);_0x479bc4[_0x0a9e('0x31')]=_[_0x0a9e('0x2f')](_0x45a1e7[_0x0a9e('0x30')],qs[_0x0a9e('0x32')](_0x526cf3[_0x0a9e('0x2c')]['fields']));_0x479bc4[_0x0a9e('0x31')]=_0x479bc4['attributes'][_0x0a9e('0x33')]?_0x479bc4[_0x0a9e('0x31')]:_0x45a1e7[_0x0a9e('0x30')];if(!_0x526cf3[_0x0a9e('0x2c')][_0x0a9e('0x34')]('nolimit')){_0x479bc4[_0x0a9e('0x35')]=qs[_0x0a9e('0x35')](_0x526cf3[_0x0a9e('0x2c')][_0x0a9e('0x35')]);_0x479bc4[_0x0a9e('0x18')]=qs[_0x0a9e('0x18')](_0x526cf3[_0x0a9e('0x2c')][_0x0a9e('0x18')]);}_0x479bc4['order']=qs[_0x0a9e('0x36')](_0x526cf3['query'][_0x0a9e('0x36')]);_0x479bc4[_0x0a9e('0x37')]=qs[_0x0a9e('0x2e')](_[_0x0a9e('0x38')](_0x526cf3['query'],_0x45a1e7[_0x0a9e('0x2e')]),_0x1dc186);if(_0x526cf3[_0x0a9e('0x2c')][_0x0a9e('0x39')]){_0x479bc4[_0x0a9e('0x37')]=_['merge'](_0x479bc4['where'],{'$or':_[_0x0a9e('0x26')](_0x1dc186,function(_0x5640eb){if(_0x5640eb[_0x0a9e('0x2a')]!==_0x0a9e('0x3a')){var _0x381c37={};_0x381c37[_0x5640eb[_0x0a9e('0x23')]]={'$like':'%'+_0x526cf3['query'][_0x0a9e('0x39')]+'%'};return _0x381c37;}})});}_0x479bc4=_[_0x0a9e('0x3b')]({},_0x479bc4,_0x526cf3[_0x0a9e('0x3c')]);var _0x533942={'where':_0x479bc4[_0x0a9e('0x37')]};return db[_0x0a9e('0x27')][_0x0a9e('0x17')](_0x533942)['then'](function(_0x546ef8){_0x5bfb33[_0x0a9e('0x17')]=_0x546ef8;if(_0x526cf3[_0x0a9e('0x2c')]['includeAll']){_0x479bc4[_0x0a9e('0x3d')]=[{'all':!![]}];}return db[_0x0a9e('0x27')][_0x0a9e('0x3e')](_0x479bc4);})[_0x0a9e('0x1f')](function(_0x4b38d9){_0x5bfb33['rows']=_0x4b38d9;return _0x5bfb33;})[_0x0a9e('0x1f')](respondWithFilteredResult(_0x384319,_0x479bc4))[_0x0a9e('0x3f')](handleError(_0x384319,null));};exports['show']=function(_0x183991,_0x1dec2e){var _0x1459bb={'raw':!![],'where':{'id':_0x183991[_0x0a9e('0x40')]['id']}},_0x5b4f5e={};_0x5b4f5e[_0x0a9e('0x30')]=_[_0x0a9e('0x2d')](db[_0x0a9e('0x27')][_0x0a9e('0x28')]);_0x5b4f5e[_0x0a9e('0x2c')]=_[_0x0a9e('0x2d')](_0x183991[_0x0a9e('0x2c')]);_0x5b4f5e[_0x0a9e('0x2e')]=_[_0x0a9e('0x2f')](_0x5b4f5e[_0x0a9e('0x30')],_0x5b4f5e[_0x0a9e('0x2c')]);_0x1459bb[_0x0a9e('0x31')]=_[_0x0a9e('0x2f')](_0x5b4f5e[_0x0a9e('0x30')],qs['fields'](_0x183991['query'][_0x0a9e('0x32')]));_0x1459bb[_0x0a9e('0x31')]=_0x1459bb[_0x0a9e('0x31')][_0x0a9e('0x33')]?_0x1459bb[_0x0a9e('0x31')]:_0x5b4f5e[_0x0a9e('0x30')];if(_0x183991[_0x0a9e('0x2c')][_0x0a9e('0x41')]){_0x1459bb[_0x0a9e('0x3d')]=[{'all':!![]}];}_0x1459bb=_[_0x0a9e('0x3b')]({},_0x1459bb,_0x183991[_0x0a9e('0x3c')]);return db[_0x0a9e('0x27')]['find'](_0x1459bb)[_0x0a9e('0x1f')](handleEntityNotFound(_0x1dec2e,null))[_0x0a9e('0x1f')](respondWithResult(_0x1dec2e,null))[_0x0a9e('0x3f')](handleError(_0x1dec2e,null));};exports[_0x0a9e('0x1e')]=function(_0x2e8caf,_0xbe9d19){if(_0x2e8caf[_0x0a9e('0x42')]['id']){delete _0x2e8caf[_0x0a9e('0x42')]['id'];}return db['CmHopperBlack'][_0x0a9e('0x43')]({'where':{'id':_0x2e8caf['params']['id']}})[_0x0a9e('0x1f')](handleEntityNotFound(_0xbe9d19,null))[_0x0a9e('0x1f')](saveUpdates(_0x2e8caf[_0x0a9e('0x42')],null))['then'](respondWithResult(_0xbe9d19,null))[_0x0a9e('0x3f')](handleError(_0xbe9d19,null));};exports[_0x0a9e('0x20')]=function(_0x4774f4,_0x34aa5a){return db[_0x0a9e('0x27')][_0x0a9e('0x43')]({'where':{'id':_0x4774f4[_0x0a9e('0x40')]['id']}})['then'](handleEntityNotFound(_0x34aa5a,null))[_0x0a9e('0x1f')](removeEntity(_0x34aa5a,null))[_0x0a9e('0x3f')](handleError(_0x34aa5a,null));};exports[_0x0a9e('0x44')]=function(_0x16f976,_0x409789){return db[_0x0a9e('0x27')][_0x0a9e('0x44')]()[_0x0a9e('0x1f')](respondWithResult(_0x409789,null))[_0x0a9e('0x3f')](handleError(_0x409789,null));}; \ No newline at end of file +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(_0x1f2f18,_0x204085){var _0x2950d1=function(_0x2c6253){while(--_0x2c6253){_0x1f2f18['push'](_0x1f2f18['shift']());}};_0x2950d1(++_0x204085);}(_0xa9e0,0x123));var _0x0a9e=function(_0xae7c2f,_0xf31e04){_0xae7c2f=_0xae7c2f-0x0;var _0x5d7001=_0xa9e0[_0xae7c2f];return _0x5d7001;};'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 8f9390b..3ea3d78 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 _0xcb91=['rimraf','./cmHopperBlack.attributes','exports','define','cm_hopper_black','../../config/logger','api','moment','bluebird','path'];(function(_0x1dcace,_0x8b01c1){var _0xefd218=function(_0x50d063){while(--_0x50d063){_0x1dcace['push'](_0x1dcace['shift']());}};_0xefd218(++_0x8b01c1);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x53ccf2,_0x13cb67){_0x53ccf2=_0x53ccf2-0x0;var _0x5a2964=_0xcb91[_0x53ccf2];return _0x5a2964;};'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')]('CmHopperBlack',attributes,{'tableName':_0x1cb9('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9c44=['request-promise','path','./cmHopperBlack.attributes','define','CmHopperBlack','cm_hopper_black','../../config/logger','api','moment','bluebird'];(function(_0x3ee7c4,_0x4b75d4){var _0x370dde=function(_0x321215){while(--_0x321215){_0x3ee7c4['push'](_0x3ee7c4['shift']());}};_0x370dde(++_0x4b75d4);}(_0x9c44,0x178));var _0x49c4=function(_0x17b6e3,_0x4522ed){_0x17b6e3=_0x17b6e3-0x0;var _0x3906f3=_0x9c44[_0x17b6e3];return _0x3906f3;};'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 diff --git a/server/api/cmHopperBlack/cmHopperBlack.rpc.js b/server/api/cmHopperBlack/cmHopperBlack.rpc.js index 6b940b2..26c6c11 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 _0xff0e=['moment','bluebird','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','CmHopperBlack,\x20%s,\x20%s,\x20%s','stringify','error','code','CmHopperBlack,\x20%s,\x20%s','message','result','catch','GetCmHopperBlack','CmHopperBlack','options','raw','where','attributes','limit','include','model','debug','UpdateCmHopperBlack','update','DestroyCmHopperBlack','destroy','util'];(function(_0x12065e,_0x483306){var _0x1b4f98=function(_0x53f19d){while(--_0x53f19d){_0x12065e['push'](_0x12065e['shift']());}};_0x1b4f98(++_0x483306);}(_0xff0e,0x18b));var _0xeff0=function(_0x33fcc0,_0x1e66c6){_0x33fcc0=_0x33fcc0-0x0;var _0x49b9ad=_0xff0e[_0x33fcc0];return _0x49b9ad;};'use strict';var _=require('lodash');var util=require(_0xeff0('0x0'));var moment=require(_0xeff0('0x1'));var BPromise=require(_0xeff0('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xeff0('0x3'));var logger=require(_0xeff0('0x4'))(_0xeff0('0x5'));var config=require(_0xeff0('0x6'));var jayson=require(_0xeff0('0x7'));var client=jayson[_0xeff0('0x8')][_0xeff0('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x35939a,_0x35dfa8,_0x5a6990){return new BPromise(function(_0x403f4c,_0x43e331){return client[_0xeff0('0xa')](_0x35939a,_0x5a6990)[_0xeff0('0xb')](function(_0x42c2d6){logger[_0xeff0('0xc')]('CmHopperBlack,\x20%s,\x20%s',_0x35dfa8,_0xeff0('0xd'));logger['debug'](_0xeff0('0xe'),_0x35dfa8,_0xeff0('0xd'),JSON[_0xeff0('0xf')](_0x42c2d6));if(_0x42c2d6[_0xeff0('0x10')]){if(_0x42c2d6[_0xeff0('0x10')][_0xeff0('0x11')]===0x1f4){logger['error'](_0xeff0('0x12'),_0x35dfa8,_0x42c2d6[_0xeff0('0x10')][_0xeff0('0x13')]);return _0x43e331(_0x42c2d6[_0xeff0('0x10')][_0xeff0('0x13')]);}logger[_0xeff0('0x10')](_0xeff0('0x12'),_0x35dfa8,_0x42c2d6[_0xeff0('0x10')]['message']);return _0x403f4c(_0x42c2d6[_0xeff0('0x10')][_0xeff0('0x13')]);}else{logger[_0xeff0('0xc')]('CmHopperBlack,\x20%s,\x20%s',_0x35dfa8,_0xeff0('0xd'));_0x403f4c(_0x42c2d6[_0xeff0('0x14')][_0xeff0('0x13')]);}})[_0xeff0('0x15')](function(_0x3ea53c){logger[_0xeff0('0x10')](_0xeff0('0x12'),_0x35dfa8,_0x3ea53c);_0x43e331(_0x3ea53c);});});}exports[_0xeff0('0x16')]=function(_0x461205){var _0x4afe03=this;return new Promise(function(_0x564501,_0x43b2f4){return db[_0xeff0('0x17')]['findAll']({'raw':_0x461205[_0xeff0('0x18')]?_0x461205['options'][_0xeff0('0x19')]===undefined?!![]:![]:!![],'where':_0x461205[_0xeff0('0x18')]?_0x461205['options'][_0xeff0('0x1a')]||null:null,'attributes':_0x461205[_0xeff0('0x18')]?_0x461205[_0xeff0('0x18')][_0xeff0('0x1b')]||null:null,'limit':_0x461205[_0xeff0('0x18')]?_0x461205[_0xeff0('0x18')][_0xeff0('0x1c')]||null:null,'include':_0x461205['options']?_0x461205['options'][_0xeff0('0x1d')]?_['map'](_0x461205[_0xeff0('0x18')][_0xeff0('0x1d')],function(_0x1f87bf){return{'model':db[_0x1f87bf[_0xeff0('0x1e')]],'as':_0x1f87bf['as'],'attributes':_0x1f87bf[_0xeff0('0x1b')],'include':_0x1f87bf[_0xeff0('0x1d')]?_['map'](_0x1f87bf[_0xeff0('0x1d')],function(_0x2f10fd){return{'model':db[_0x2f10fd[_0xeff0('0x1e')]],'as':_0x2f10fd['as'],'attributes':_0x2f10fd[_0xeff0('0x1b')],'include':_0x2f10fd[_0xeff0('0x1d')]?_['map'](_0x2f10fd[_0xeff0('0x1d')],function(_0x263115){return{'model':db[_0x263115[_0xeff0('0x1e')]],'as':_0x263115['as'],'attributes':_0x263115[_0xeff0('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xeff0('0xb')](function(_0x41cee5){logger[_0xeff0('0xc')]('GetCmHopperBlack',_0x461205);logger[_0xeff0('0x1f')](_0xeff0('0x16'),_0x461205,JSON[_0xeff0('0xf')](_0x41cee5));_0x564501(_0x41cee5);})['catch'](function(_0x355e7f){logger[_0xeff0('0x10')](_0xeff0('0x16'),_0x355e7f[_0xeff0('0x13')],_0x461205);_0x43b2f4(_0x4afe03['error'](0x1f4,_0x355e7f['message']));});});};exports[_0xeff0('0x20')]=function(_0x32b3d1){var _0x461194=this;return new Promise(function(_0x5abaf0,_0x9c1bda){return db[_0xeff0('0x17')][_0xeff0('0x21')](_0x32b3d1['body'],{'raw':_0x32b3d1[_0xeff0('0x18')]?_0x32b3d1['options'][_0xeff0('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x32b3d1[_0xeff0('0x18')]?_0x32b3d1[_0xeff0('0x18')]['where']||null:null,'attributes':_0x32b3d1['options']?_0x32b3d1[_0xeff0('0x18')]['attributes']||null:null,'limit':_0x32b3d1[_0xeff0('0x18')]?_0x32b3d1['options'][_0xeff0('0x1c')]||null:null})['then'](function(_0x209920){logger[_0xeff0('0xc')](_0xeff0('0x20'),_0x32b3d1);logger[_0xeff0('0x1f')](_0xeff0('0x20'),_0x32b3d1,JSON[_0xeff0('0xf')](_0x209920));_0x5abaf0(_0x209920);})['catch'](function(_0xf5c6a9){logger[_0xeff0('0x10')]('UpdateCmHopperBlack',_0xf5c6a9[_0xeff0('0x13')],_0x32b3d1);_0x9c1bda(_0x461194[_0xeff0('0x10')](0x1f4,_0xf5c6a9[_0xeff0('0x13')]));});});};exports[_0xeff0('0x22')]=function(_0x45ae8c){var _0x2a2f26=this;return new Promise(function(_0x3faaa5,_0x5ab2d9){return db['CmHopperBlack'][_0xeff0('0x23')]({'where':_0x45ae8c['options']?_0x45ae8c[_0xeff0('0x18')][_0xeff0('0x1a')]||null:null})['then'](function(_0x1b0376){logger[_0xeff0('0xc')](_0xeff0('0x22'),_0x45ae8c);logger[_0xeff0('0x1f')](_0xeff0('0x22'),_0x45ae8c,JSON[_0xeff0('0xf')](_0x1b0376));_0x3faaa5(_0x1b0376);})[_0xeff0('0x15')](function(_0x3260d5){logger[_0xeff0('0x10')](_0xeff0('0x22'),_0x3260d5[_0xeff0('0x13')],_0x45ae8c);_0x5ab2d9(_0x2a2f26[_0xeff0('0x10')](0x1f4,_0x3260d5[_0xeff0('0x13')]));});});}; \ No newline at end of file +var _0xa50f=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info','CmHopperBlack,\x20%s,\x20%s','debug','CmHopperBlack,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','GetCmHopperBlack','CmHopperBlack','options','attributes','limit','include','map','model','stringify','catch','UpdateCmHopperBlack','body','raw','where','DestroyCmHopperBlack','destroy','lodash','util','moment'];(function(_0x3dec17,_0x54285d){var _0x1e3c0f=function(_0x568f8a){while(--_0x568f8a){_0x3dec17['push'](_0x3dec17['shift']());}};_0x1e3c0f(++_0x54285d);}(_0xa50f,0x8d));var _0xfa50=function(_0x13d07a,_0x41efc3){_0x13d07a=_0x13d07a-0x0;var _0x5ee0ee=_0xa50f[_0x13d07a];return _0x5ee0ee;};'use strict';var _=require(_0xfa50('0x0'));var util=require(_0xfa50('0x1'));var moment=require(_0xfa50('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xfa50('0x3'))['db'];var utils=require(_0xfa50('0x4'));var logger=require(_0xfa50('0x5'))(_0xfa50('0x6'));var config=require(_0xfa50('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xfa50('0x8')][_0xfa50('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x45b039,_0x94ae8c,_0x5c9dec){return new BPromise(function(_0x27b0a5,_0x254bba){return client[_0xfa50('0xa')](_0x45b039,_0x5c9dec)[_0xfa50('0xb')](function(_0x1e2652){logger[_0xfa50('0xc')](_0xfa50('0xd'),_0x94ae8c,'request\x20sent');logger[_0xfa50('0xe')](_0xfa50('0xf'),_0x94ae8c,_0xfa50('0x10'),JSON['stringify'](_0x1e2652));if(_0x1e2652[_0xfa50('0x11')]){if(_0x1e2652['error'][_0xfa50('0x12')]===0x1f4){logger['error'](_0xfa50('0xd'),_0x94ae8c,_0x1e2652[_0xfa50('0x11')]['message']);return _0x254bba(_0x1e2652[_0xfa50('0x11')][_0xfa50('0x13')]);}logger['error']('CmHopperBlack,\x20%s,\x20%s',_0x94ae8c,_0x1e2652['error']['message']);return _0x27b0a5(_0x1e2652[_0xfa50('0x11')][_0xfa50('0x13')]);}else{logger[_0xfa50('0xc')](_0xfa50('0xd'),_0x94ae8c,'request\x20sent');_0x27b0a5(_0x1e2652['result'][_0xfa50('0x13')]);}})['catch'](function(_0x270947){logger[_0xfa50('0x11')](_0xfa50('0xd'),_0x94ae8c,_0x270947);_0x254bba(_0x270947);});});}exports[_0xfa50('0x14')]=function(_0x2f88cc){var _0x2928f1=this;return new Promise(function(_0x40c618,_0x437501){return db[_0xfa50('0x15')]['findAll']({'raw':_0x2f88cc[_0xfa50('0x16')]?_0x2f88cc[_0xfa50('0x16')]['raw']===undefined?!![]:![]:!![],'where':_0x2f88cc[_0xfa50('0x16')]?_0x2f88cc['options']['where']||null:null,'attributes':_0x2f88cc['options']?_0x2f88cc[_0xfa50('0x16')][_0xfa50('0x17')]||null:null,'limit':_0x2f88cc[_0xfa50('0x16')]?_0x2f88cc['options'][_0xfa50('0x18')]||null:null,'include':_0x2f88cc[_0xfa50('0x16')]?_0x2f88cc['options'][_0xfa50('0x19')]?_[_0xfa50('0x1a')](_0x2f88cc[_0xfa50('0x16')][_0xfa50('0x19')],function(_0x164dbf){return{'model':db[_0x164dbf[_0xfa50('0x1b')]],'as':_0x164dbf['as'],'attributes':_0x164dbf[_0xfa50('0x17')],'include':_0x164dbf[_0xfa50('0x19')]?_[_0xfa50('0x1a')](_0x164dbf[_0xfa50('0x19')],function(_0x2b0993){return{'model':db[_0x2b0993[_0xfa50('0x1b')]],'as':_0x2b0993['as'],'attributes':_0x2b0993['attributes'],'include':_0x2b0993[_0xfa50('0x19')]?_[_0xfa50('0x1a')](_0x2b0993[_0xfa50('0x19')],function(_0x34e112){return{'model':db[_0x34e112[_0xfa50('0x1b')]],'as':_0x34e112['as'],'attributes':_0x34e112[_0xfa50('0x17')]};}):[]};}):[]};}):[]:[]})[_0xfa50('0xb')](function(_0x43dae2){logger[_0xfa50('0xc')](_0xfa50('0x14'),_0x2f88cc);logger['debug'](_0xfa50('0x14'),_0x2f88cc,JSON[_0xfa50('0x1c')](_0x43dae2));_0x40c618(_0x43dae2);})[_0xfa50('0x1d')](function(_0x27e2a9){logger[_0xfa50('0x11')]('GetCmHopperBlack',_0x27e2a9[_0xfa50('0x13')],_0x2f88cc);_0x437501(_0x2928f1['error'](0x1f4,_0x27e2a9[_0xfa50('0x13')]));});});};exports[_0xfa50('0x1e')]=function(_0x82524f){var _0x28136c=this;return new Promise(function(_0xcf8b25,_0x2a8432){return db[_0xfa50('0x15')]['update'](_0x82524f[_0xfa50('0x1f')],{'raw':_0x82524f['options']?_0x82524f[_0xfa50('0x16')][_0xfa50('0x20')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x82524f['options']?_0x82524f[_0xfa50('0x16')][_0xfa50('0x21')]||null:null,'attributes':_0x82524f[_0xfa50('0x16')]?_0x82524f[_0xfa50('0x16')]['attributes']||null:null,'limit':_0x82524f[_0xfa50('0x16')]?_0x82524f[_0xfa50('0x16')]['limit']||null:null})[_0xfa50('0xb')](function(_0x28fff0){logger[_0xfa50('0xc')]('UpdateCmHopperBlack',_0x82524f);logger[_0xfa50('0xe')](_0xfa50('0x1e'),_0x82524f,JSON[_0xfa50('0x1c')](_0x28fff0));_0xcf8b25(_0x28fff0);})['catch'](function(_0xb18937){logger[_0xfa50('0x11')](_0xfa50('0x1e'),_0xb18937[_0xfa50('0x13')],_0x82524f);_0x2a8432(_0x28136c[_0xfa50('0x11')](0x1f4,_0xb18937[_0xfa50('0x13')]));});});};exports[_0xfa50('0x22')]=function(_0x5d08b2){var _0x2b3012=this;return new Promise(function(_0x9d5458,_0x1d220b){return db['CmHopperBlack'][_0xfa50('0x23')]({'where':_0x5d08b2['options']?_0x5d08b2[_0xfa50('0x16')][_0xfa50('0x21')]||null:null})[_0xfa50('0xb')](function(_0x140988){logger['info'](_0xfa50('0x22'),_0x5d08b2);logger['debug']('DestroyCmHopperBlack',_0x5d08b2,JSON['stringify'](_0x140988));_0x9d5458(_0x140988);})[_0xfa50('0x1d')](function(_0x4b7d3d){logger['error'](_0xfa50('0x22'),_0x4b7d3d[_0xfa50('0x13')],_0x5d08b2);_0x1d220b(_0x2b3012[_0xfa50('0x11')](0x1f4,_0x4b7d3d[_0xfa50('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/index.js b/server/api/cmHopperBlack/index.js index cb39b27..85e2b32 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 _0x7217=['multer','path','connect-timeout','express','Router','../../components/auth/service','./cmHopperBlack.controller','get','isAuthenticated','index','/describe','describe','/:id','show','put','delete','destroy','exports'];(function(_0x2885db,_0x19d7f9){var _0xb365d8=function(_0x81f0e6){while(--_0x81f0e6){_0x2885db['push'](_0x2885db['shift']());}};_0xb365d8(++_0x19d7f9);}(_0x7217,0x19e));var _0x7721=function(_0x311c35,_0x534915){_0x311c35=_0x311c35-0x0;var _0x5cc50c=_0x7217[_0x311c35];return _0x5cc50c;};'use strict';var multer=require(_0x7721('0x0'));var util=require('util');var path=require(_0x7721('0x1'));var timeout=require(_0x7721('0x2'));var express=require(_0x7721('0x3'));var router=express[_0x7721('0x4')]();var auth=require(_0x7721('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x7721('0x6'));router[_0x7721('0x7')]('/',auth[_0x7721('0x8')](),controller[_0x7721('0x9')]);router[_0x7721('0x7')](_0x7721('0xa'),auth[_0x7721('0x8')](),controller[_0x7721('0xb')]);router[_0x7721('0x7')](_0x7721('0xc'),auth[_0x7721('0x8')](),controller[_0x7721('0xd')]);router[_0x7721('0xe')](_0x7721('0xc'),auth[_0x7721('0x8')](),controller['update']);router[_0x7721('0xf')](_0x7721('0xc'),auth[_0x7721('0x8')](),controller[_0x7721('0x10')]);module[_0x7721('0x11')]=router; \ No newline at end of file +var _0x7bae=['index','/describe','describe','/:id','show','update','delete','destroy','exports','path','connect-timeout','Router','../../components/interaction/service','../../config/environment','./cmHopperBlack.controller','get','isAuthenticated'];(function(_0x516286,_0x4805f2){var _0x41d434=function(_0x17c825){while(--_0x17c825){_0x516286['push'](_0x516286['shift']());}};_0x41d434(++_0x4805f2);}(_0x7bae,0x13b));var _0xe7ba=function(_0x5e36d1,_0x471178){_0x5e36d1=_0x5e36d1-0x0;var _0x950b9e=_0x7bae[_0x5e36d1];return _0x950b9e;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xe7ba('0x0'));var timeout=require(_0xe7ba('0x1'));var express=require('express');var router=express[_0xe7ba('0x2')]();var auth=require('../../components/auth/service');var interaction=require(_0xe7ba('0x3'));var config=require(_0xe7ba('0x4'));var controller=require(_0xe7ba('0x5'));router[_0xe7ba('0x6')]('/',auth[_0xe7ba('0x7')](),controller[_0xe7ba('0x8')]);router[_0xe7ba('0x6')](_0xe7ba('0x9'),auth[_0xe7ba('0x7')](),controller[_0xe7ba('0xa')]);router[_0xe7ba('0x6')](_0xe7ba('0xb'),auth[_0xe7ba('0x7')](),controller[_0xe7ba('0xc')]);router['put'](_0xe7ba('0xb'),auth[_0xe7ba('0x7')](),controller[_0xe7ba('0xd')]);router[_0xe7ba('0xe')](_0xe7ba('0xb'),auth[_0xe7ba('0x7')](),controller[_0xe7ba('0xf')]);module[_0xe7ba('0x10')]=router; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.attributes.js b/server/api/cmHopperFinal/cmHopperFinal.attributes.js index 7d7dbe4..08f4c5b 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 _0xcbd8=['dispositionat','BOOLEAN','sequelize','moment','exports','INTEGER','DATE','STRING','endtime','setDataValue','followuptime','seconds'];(function(_0x2e4aa2,_0x11956a){var _0x5e6092=function(_0x4c12c2){while(--_0x4c12c2){_0x2e4aa2['push'](_0x2e4aa2['shift']());}};_0x5e6092(++_0x11956a);}(_0xcbd8,0x92));var _0x8cbd=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xcbd8[_0x14add3];return _0x4a174f;};'use strict';var Sequelize=require(_0x8cbd('0x0'));var moment=require(_0x8cbd('0x1'));module[_0x8cbd('0x2')]={'state':{'type':Sequelize[_0x8cbd('0x3')](0x2)},'statedesc':{'type':Sequelize['STRING']},'scheduledat':{'type':Sequelize[_0x8cbd('0x4')]},'countbusyretry':{'type':Sequelize[_0x8cbd('0x3')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x8cbd('0x3')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x8cbd('0x3')],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0x8cbd('0x3')],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0x8cbd('0x5')]},'originatecalleridnum':{'type':Sequelize['STRING']},'originatecalleridname':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0x8cbd('0x5')]},'calleridname':{'type':Sequelize[_0x8cbd('0x5')]},'starttime':{'type':Sequelize['DATE']},'responsetime':{'type':Sequelize[_0x8cbd('0x4')]},'answertime':{'type':Sequelize['DATE']},'droptime':{'type':Sequelize[_0x8cbd('0x4')]},'endtime':{'type':Sequelize['DATE']},'ringtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0x8cbd('0x3')],'defaultValue':0x0},'talktime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'followuptime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0x8cbd('0x5')]},'campaign':{'type':Sequelize[_0x8cbd('0x5')]},'campaigntype':{'type':Sequelize[_0x8cbd('0x5')]},'membername':{'type':Sequelize[_0x8cbd('0x5')]},'reason':{'type':Sequelize[_0x8cbd('0x5')]},'disposition':{'type':Sequelize[_0x8cbd('0x5')]},'dispositionat':{'type':Sequelize[_0x8cbd('0x4')],'set':function(_0x162a28){var _0x214e40=this['getDataValue'](_0x8cbd('0x6'));if(_0x214e40&&_0x162a28){this[_0x8cbd('0x7')](_0x8cbd('0x8'),moment(_0x162a28)['diff'](moment(_0x214e40),_0x8cbd('0x9')));}return this[_0x8cbd('0x7')](_0x8cbd('0xa'),_0x162a28);}},'amd':{'type':Sequelize[_0x8cbd('0xb')],'defaultValue':![]},'fax':{'type':Sequelize[_0x8cbd('0xb')],'defaultValue':![]},'blacklist':{'type':Sequelize[_0x8cbd('0xb')],'defaultValue':![]},'rescheduled':{'type':Sequelize[_0x8cbd('0xb')],'defaultValue':![]},'rescheduledat':{'type':Sequelize[_0x8cbd('0x4')]},'callback':{'type':Sequelize[_0x8cbd('0xb')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x8cbd('0x5')],'defaultValue':null},'callbackat':{'type':Sequelize['DATE']},'deleted':{'type':Sequelize[_0x8cbd('0x5')],'defaultValue':null},'deletedat':{'type':Sequelize['DATE']},'recallme':{'type':Sequelize[_0x8cbd('0xb')],'defaultValue':![]},'agiafterat':{'type':Sequelize[_0x8cbd('0x4')]},'countnosuchnumberretry':{'type':Sequelize[_0x8cbd('0x3')],'defaultValue':0x0},'countdropretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x8cbd('0x3')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x8cbd('0x3')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x8cbd('0x3')],'defaultValue':0x0}}; \ No newline at end of file +var _0x25f3=['STRING','getDataValue','setDataValue','diff','seconds','dispositionat','BOOLEAN','sequelize','moment','INTEGER','DATE'];(function(_0x333d99,_0x87dd42){var _0x41c679=function(_0xae20f){while(--_0xae20f){_0x333d99['push'](_0x333d99['shift']());}};_0x41c679(++_0x87dd42);}(_0x25f3,0x8b));var _0x325f=function(_0x28798e,_0x284ab3){_0x28798e=_0x28798e-0x0;var _0x48b1c0=_0x25f3[_0x28798e];return _0x48b1c0;};'use strict';var Sequelize=require(_0x325f('0x0'));var moment=require(_0x325f('0x1'));module['exports']={'state':{'type':Sequelize[_0x325f('0x2')](0x2)},'statedesc':{'type':Sequelize['STRING']},'scheduledat':{'type':Sequelize[_0x325f('0x3')]},'countbusyretry':{'type':Sequelize[_0x325f('0x2')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x325f('0x2')],'defaultValue':0x0},'countglobal':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'uniqueid':{'type':Sequelize['STRING']},'originatecalleridnum':{'type':Sequelize['STRING']},'originatecalleridname':{'type':Sequelize[_0x325f('0x4')]},'calleridnum':{'type':Sequelize[_0x325f('0x4')]},'calleridname':{'type':Sequelize[_0x325f('0x4')]},'starttime':{'type':Sequelize['DATE']},'responsetime':{'type':Sequelize[_0x325f('0x3')]},'answertime':{'type':Sequelize['DATE']},'droptime':{'type':Sequelize[_0x325f('0x3')]},'endtime':{'type':Sequelize['DATE']},'ringtime':{'type':Sequelize[_0x325f('0x2')],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0x325f('0x2')],'defaultValue':0x0},'talktime':{'type':Sequelize[_0x325f('0x2')],'defaultValue':0x0},'followuptime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0x325f('0x4')]},'campaign':{'type':Sequelize[_0x325f('0x4')]},'campaigntype':{'type':Sequelize[_0x325f('0x4')]},'membername':{'type':Sequelize[_0x325f('0x4')]},'reason':{'type':Sequelize[_0x325f('0x4')]},'disposition':{'type':Sequelize[_0x325f('0x4')]},'dispositionat':{'type':Sequelize[_0x325f('0x3')],'set':function(_0x219bdf){var _0x266953=this[_0x325f('0x5')]('endtime');if(_0x266953&&_0x219bdf){this[_0x325f('0x6')]('followuptime',moment(_0x219bdf)[_0x325f('0x7')](moment(_0x266953),_0x325f('0x8')));}return this[_0x325f('0x6')](_0x325f('0x9'),_0x219bdf);}},'amd':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'fax':{'type':Sequelize[_0x325f('0xa')],'defaultValue':![]},'blacklist':{'type':Sequelize[_0x325f('0xa')],'defaultValue':![]},'rescheduled':{'type':Sequelize[_0x325f('0xa')],'defaultValue':![]},'rescheduledat':{'type':Sequelize['DATE']},'callback':{'type':Sequelize[_0x325f('0xa')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize['STRING'],'defaultValue':null},'callbackat':{'type':Sequelize['DATE']},'deleted':{'type':Sequelize[_0x325f('0x4')],'defaultValue':null},'deletedat':{'type':Sequelize[_0x325f('0x3')]},'recallme':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agiafterat':{'type':Sequelize[_0x325f('0x3')]},'countnosuchnumberretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x325f('0x2')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x325f('0x2')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x325f('0x2')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.controller.js b/server/api/cmHopperFinal/cmHopperFinal.controller.js index 3d58d85..ab46edc 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 _0xd1ca=['where','filters','pick','filter','merge','count','includeAll','include','catch','show','params','keys','options','find','describe','body','uniqueid','findAll','sequelize','COUNT','noSuchContacts','literal','`state`\x20=\x203,\x201,\x20null','noAnswerContacts','`state`\x20=\x205,\x201,\x20null','`state`\x20=\x208,\x201,\x20null','congestionContacts','`state`\x20=\x2010\x20,\x201,\x20null','dropContacts','`state`\x20=\x2011\x20,\x201,\x20null','abandonedContacts','`state`\x20=\x2022,\x201,\x20null','`state`\x20=\x2019,\x201,\x20null','countContactsIvrCampaignHopperFinal','`state`\x20=\x200,\x201,\x20null','busyContacts','reCallContacts','answeringMachine','VoiceQueue','insert','into','cm_hopper','fromQuery','phone','scheduledAt','ContactId','ListId','VoiceQueueId','createdAt','updatedAt','select','field','ANY_VALUE(calleridnum)','NOW()','from','cm_hopper_final','state\x20=\x20?','toString','calleridnum\x20NOT\x20IN\x20(?)','VoiceQueueId\x20=\x20?','state\x20=\x204','group','moveContactsIvrCampaignHopperFinal','Campaign','ANY_VALUE(ListId)','ANY_VALUE(CampaignId)','CampaignId','state','calleridnum\x20IS\x20NOT\x20NULL','checkContactHopper','CmHopper','findOne','html-pdf','eml-format','request-promise','moment','bluebird','util','to-csv','ejs','lodash','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','sendStatus','status','end','json','offset','limit','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','CmHopperFinal','fieldName','type','query','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort'];(function(_0x2ce4d2,_0x4d8688){var _0x95af01=function(_0x3fd77b){while(--_0x3fd77b){_0x2ce4d2['push'](_0x2ce4d2['shift']());}};_0x95af01(++_0x4d8688);}(_0xd1ca,0x140));var _0xad1c=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0xd1ca[_0x2641f9];return _0x585741;};'use strict';var pdf=require(_0xad1c('0x0'));var emlformat=require(_0xad1c('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xad1c('0x2'));var moment=require(_0xad1c('0x3'));var BPromise=require(_0xad1c('0x4'));var Mustache=require('mustache');var util=require(_0xad1c('0x5'));var path=require('path');var sox=require('sox');var csv=require(_0xad1c('0x6'));var ejs=require(_0xad1c('0x7'));var fs=require('fs');var _=require(_0xad1c('0x8'));var squel=require('squel');var crypto=require(_0xad1c('0x9'));var jsforce=require('jsforce');var deskjs=require(_0xad1c('0xa'));var toCsv=require(_0xad1c('0x6'));var querystring=require(_0xad1c('0xb'));var Papa=require(_0xad1c('0xc'));var Redis=require(_0xad1c('0xd'));var authService=require(_0xad1c('0xe'));var qs=require(_0xad1c('0xf'));var as=require(_0xad1c('0x10'));var hardwareService=require(_0xad1c('0x11'));var logger=require(_0xad1c('0x12'))('api');var utils=require(_0xad1c('0x13'));var config=require(_0xad1c('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4615a4,_0x7494c3){_0x7494c3=_0x7494c3||0xcc;return function(_0xd5bdd7){if(_0xd5bdd7){return _0x4615a4[_0xad1c('0x15')](_0x7494c3);}return _0x4615a4[_0xad1c('0x16')](_0x7494c3)[_0xad1c('0x17')]();};}function respondWithResult(_0xeebfde,_0x4ce86e){_0x4ce86e=_0x4ce86e||0xc8;return function(_0x324030){if(_0x324030){return _0xeebfde[_0xad1c('0x16')](_0x4ce86e)[_0xad1c('0x18')](_0x324030);}};}function respondWithFilteredResult(_0x5b6015,_0x210eba){return function(_0x494b59){if(_0x494b59){var _0x4194c0=_0x494b59['count'],_0x48c651=_0x210eba[_0xad1c('0x19')],_0x2173e5=_0x210eba['offset']+_0x210eba[_0xad1c('0x1a')],_0x8420de;if(_0x2173e5>=_0x4194c0){_0x2173e5=_0x4194c0;_0x8420de=0xc8;}else{_0x8420de=0xce;}_0x5b6015[_0xad1c('0x16')](_0x8420de);return _0x5b6015['set']('Content-Range',_0x48c651+'-'+_0x2173e5+'/'+_0x4194c0)[_0xad1c('0x18')](_0x494b59);}return null;};}function patchUpdates(_0xa353d8){return function(_0x20850d){try{jsonpatch[_0xad1c('0x1b')](_0x20850d,_0xa353d8,!![]);}catch(_0x519d1b){return BPromise[_0xad1c('0x1c')](_0x519d1b);}return _0x20850d[_0xad1c('0x1d')]();};}function saveUpdates(_0xa80469,_0x51d25c){return function(_0x5e2d17){if(_0x5e2d17){return _0x5e2d17[_0xad1c('0x1e')](_0xa80469)[_0xad1c('0x1f')](function(_0x328b63){return _0x328b63;});}return null;};}function removeEntity(_0x2b23eb,_0x1008c3){return function(_0x16f940){if(_0x16f940){return _0x16f940[_0xad1c('0x20')]()['then'](function(){_0x2b23eb[_0xad1c('0x16')](0xcc)[_0xad1c('0x17')]();});}};}function handleEntityNotFound(_0x2b33ab,_0x509c13){return function(_0x42e527){if(!_0x42e527){_0x2b33ab[_0xad1c('0x15')](0x194);}return _0x42e527;};}function handleError(_0x518a14,_0x3b3bf3){_0x3b3bf3=_0x3b3bf3||0x1f4;return function(_0x58b727){logger[_0xad1c('0x21')](_0x58b727[_0xad1c('0x22')]);if(_0x58b727[_0xad1c('0x23')]){delete _0x58b727[_0xad1c('0x23')];}_0x518a14['status'](_0x3b3bf3)[_0xad1c('0x24')](_0x58b727);};}exports[_0xad1c('0x25')]=function(_0x44a938,_0x345174){var _0x30abaa={},_0x5c1203={},_0x2a26c0={'count':0x0,'rows':[]};var _0x5518e0=_[_0xad1c('0x26')](db[_0xad1c('0x27')]['rawAttributes'],function(_0x35406d){return{'name':_0x35406d[_0xad1c('0x28')],'type':_0x35406d[_0xad1c('0x29')]['key']};});_0x5c1203['model']=_[_0xad1c('0x26')](_0x5518e0,'name');_0x5c1203[_0xad1c('0x2a')]=_['keys'](_0x44a938[_0xad1c('0x2a')]);_0x5c1203['filters']=_[_0xad1c('0x2b')](_0x5c1203[_0xad1c('0x2c')],_0x5c1203[_0xad1c('0x2a')]);_0x30abaa[_0xad1c('0x2d')]=_[_0xad1c('0x2b')](_0x5c1203[_0xad1c('0x2c')],qs[_0xad1c('0x2e')](_0x44a938[_0xad1c('0x2a')][_0xad1c('0x2e')]));_0x30abaa[_0xad1c('0x2d')]=_0x30abaa['attributes'][_0xad1c('0x2f')]?_0x30abaa[_0xad1c('0x2d')]:_0x5c1203['model'];if(!_0x44a938[_0xad1c('0x2a')][_0xad1c('0x30')](_0xad1c('0x31'))){_0x30abaa['limit']=qs['limit'](_0x44a938[_0xad1c('0x2a')]['limit']);_0x30abaa[_0xad1c('0x19')]=qs[_0xad1c('0x19')](_0x44a938[_0xad1c('0x2a')][_0xad1c('0x19')]);}_0x30abaa[_0xad1c('0x32')]=qs['sort'](_0x44a938[_0xad1c('0x2a')][_0xad1c('0x33')]);_0x30abaa[_0xad1c('0x34')]=qs[_0xad1c('0x35')](_[_0xad1c('0x36')](_0x44a938['query'],_0x5c1203[_0xad1c('0x35')]),_0x5518e0);if(_0x44a938[_0xad1c('0x2a')][_0xad1c('0x37')]){_0x30abaa[_0xad1c('0x34')]=_[_0xad1c('0x38')](_0x30abaa[_0xad1c('0x34')],{'$or':_[_0xad1c('0x26')](_0x5518e0,function(_0x28c80e){if(_0x28c80e[_0xad1c('0x29')]!=='VIRTUAL'){var _0x1c44c7={};_0x1c44c7[_0x28c80e[_0xad1c('0x23')]]={'$like':'%'+_0x44a938[_0xad1c('0x2a')]['filter']+'%'};return _0x1c44c7;}})});}_0x30abaa=_[_0xad1c('0x38')]({},_0x30abaa,_0x44a938['options']);var _0x562ceb={'where':_0x30abaa[_0xad1c('0x34')]};return db[_0xad1c('0x27')][_0xad1c('0x39')](_0x562ceb)[_0xad1c('0x1f')](function(_0x36f821){_0x2a26c0[_0xad1c('0x39')]=_0x36f821;if(_0x44a938['query'][_0xad1c('0x3a')]){_0x30abaa[_0xad1c('0x3b')]=[{'all':!![]}];}return db[_0xad1c('0x27')]['findAll'](_0x30abaa);})['then'](function(_0xaf9013){_0x2a26c0['rows']=_0xaf9013;return _0x2a26c0;})[_0xad1c('0x1f')](respondWithFilteredResult(_0x345174,_0x30abaa))[_0xad1c('0x3c')](handleError(_0x345174,null));};exports[_0xad1c('0x3d')]=function(_0x6ad690,_0x5a2301){var _0x1b5a1a={'raw':!![],'where':{'id':_0x6ad690[_0xad1c('0x3e')]['id']}},_0x1f91d4={};_0x1f91d4[_0xad1c('0x2c')]=_[_0xad1c('0x3f')](db['CmHopperFinal']['rawAttributes']);_0x1f91d4['query']=_[_0xad1c('0x3f')](_0x6ad690[_0xad1c('0x2a')]);_0x1f91d4[_0xad1c('0x35')]=_[_0xad1c('0x2b')](_0x1f91d4[_0xad1c('0x2c')],_0x1f91d4[_0xad1c('0x2a')]);_0x1b5a1a[_0xad1c('0x2d')]=_[_0xad1c('0x2b')](_0x1f91d4[_0xad1c('0x2c')],qs[_0xad1c('0x2e')](_0x6ad690[_0xad1c('0x2a')][_0xad1c('0x2e')]));_0x1b5a1a[_0xad1c('0x2d')]=_0x1b5a1a[_0xad1c('0x2d')][_0xad1c('0x2f')]?_0x1b5a1a['attributes']:_0x1f91d4[_0xad1c('0x2c')];if(_0x6ad690['query'][_0xad1c('0x3a')]){_0x1b5a1a[_0xad1c('0x3b')]=[{'all':!![]}];}_0x1b5a1a=_[_0xad1c('0x38')]({},_0x1b5a1a,_0x6ad690[_0xad1c('0x40')]);return db[_0xad1c('0x27')][_0xad1c('0x41')](_0x1b5a1a)[_0xad1c('0x1f')](handleEntityNotFound(_0x5a2301,null))['then'](respondWithResult(_0x5a2301,null))['catch'](handleError(_0x5a2301,null));};exports[_0xad1c('0x42')]=function(_0x233a1b,_0x2d97af){return db['CmHopperFinal'][_0xad1c('0x42')]()['then'](respondWithResult(_0x2d97af,null))['catch'](handleError(_0x2d97af,null));};exports[_0xad1c('0x1e')]=function(_0x1d4e86,_0x39d597){if(_0x1d4e86[_0xad1c('0x43')][_0xad1c('0x44')]){delete _0x1d4e86[_0xad1c('0x43')][_0xad1c('0x44')];}return db['CmHopperFinal']['find']({'where':{'uniqueid':_0x1d4e86[_0xad1c('0x3e')]['id']}})[_0xad1c('0x1f')](handleEntityNotFound(_0x39d597,null))[_0xad1c('0x1f')](saveUpdates(_0x1d4e86[_0xad1c('0x43')],null))[_0xad1c('0x1f')](respondWithResult(_0x39d597,null))[_0xad1c('0x3c')](handleError(_0x39d597,null));};exports['countContactsQueueCampaignHopperFinal']=function(_0x19cd6f,_0x357c21,_0x222049){return db[_0xad1c('0x27')][_0xad1c('0x45')]({'raw':![],'where':{'VoiceQueueId':_0x19cd6f[_0xad1c('0x3e')]['id']},'attributes':[[db[_0xad1c('0x46')]['fn'](_0xad1c('0x47'),db['sequelize']['fn']('IF',db[_0xad1c('0x46')]['literal']('`state`\x20=\x200,\x201,\x20null'))),_0xad1c('0x48')],[db['sequelize']['fn'](_0xad1c('0x47'),db[_0xad1c('0x46')]['fn']('IF',db[_0xad1c('0x46')][_0xad1c('0x49')](_0xad1c('0x4a')))),_0xad1c('0x4b')],[db[_0xad1c('0x46')]['fn'](_0xad1c('0x47'),db[_0xad1c('0x46')]['fn']('IF',db[_0xad1c('0x46')][_0xad1c('0x49')](_0xad1c('0x4c')))),'busyContacts'],[db['sequelize']['fn'](_0xad1c('0x47'),db[_0xad1c('0x46')]['fn']('IF',db[_0xad1c('0x46')][_0xad1c('0x49')](_0xad1c('0x4d')))),_0xad1c('0x4e')],[db[_0xad1c('0x46')]['fn'](_0xad1c('0x47'),db[_0xad1c('0x46')]['fn']('IF',db[_0xad1c('0x46')]['literal'](_0xad1c('0x4f')))),_0xad1c('0x50')],[db['sequelize']['fn'](_0xad1c('0x47'),db[_0xad1c('0x46')]['fn']('IF',db['sequelize'][_0xad1c('0x49')](_0xad1c('0x51')))),_0xad1c('0x52')],[db[_0xad1c('0x46')]['fn']('COUNT',db[_0xad1c('0x46')]['fn']('IF',db[_0xad1c('0x46')][_0xad1c('0x49')](_0xad1c('0x53')))),'reCallContacts'],[db[_0xad1c('0x46')]['fn'](_0xad1c('0x47'),db[_0xad1c('0x46')]['fn']('IF',db[_0xad1c('0x46')][_0xad1c('0x49')](_0xad1c('0x54')))),'answeringMachine']]})['then'](handleEntityNotFound(_0x357c21,null))[_0xad1c('0x1f')](respondWithResult(_0x357c21,null))[_0xad1c('0x3c')](handleError(_0x357c21,null));};exports[_0xad1c('0x55')]=function(_0xb12705,_0x3b98f7,_0x19c879){return db[_0xad1c('0x27')]['findAll']({'raw':![],'where':{'CampaignId':_0xb12705['params']['id']},'attributes':[[db['sequelize']['fn'](_0xad1c('0x47'),db[_0xad1c('0x46')]['fn']('IF',db['sequelize']['literal'](_0xad1c('0x56')))),_0xad1c('0x48')],[db[_0xad1c('0x46')]['fn']('COUNT',db[_0xad1c('0x46')]['fn']('IF',db[_0xad1c('0x46')][_0xad1c('0x49')](_0xad1c('0x4a')))),_0xad1c('0x4b')],[db[_0xad1c('0x46')]['fn'](_0xad1c('0x47'),db[_0xad1c('0x46')]['fn']('IF',db[_0xad1c('0x46')][_0xad1c('0x49')](_0xad1c('0x4c')))),_0xad1c('0x57')],[db[_0xad1c('0x46')]['fn'](_0xad1c('0x47'),db[_0xad1c('0x46')]['fn']('IF',db['sequelize'][_0xad1c('0x49')](_0xad1c('0x4d')))),_0xad1c('0x4e')],[db['sequelize']['fn']('COUNT',db[_0xad1c('0x46')]['fn']('IF',db[_0xad1c('0x46')]['literal']('`state`\x20=\x2010\x20,\x201,\x20null'))),_0xad1c('0x50')],[db[_0xad1c('0x46')]['fn'](_0xad1c('0x47'),db['sequelize']['fn']('IF',db[_0xad1c('0x46')][_0xad1c('0x49')](_0xad1c('0x51')))),_0xad1c('0x52')],[db[_0xad1c('0x46')]['fn']('COUNT',db[_0xad1c('0x46')]['fn']('IF',db[_0xad1c('0x46')][_0xad1c('0x49')](_0xad1c('0x53')))),_0xad1c('0x58')],[db[_0xad1c('0x46')]['fn'](_0xad1c('0x47'),db[_0xad1c('0x46')]['fn']('IF',db[_0xad1c('0x46')]['literal'](_0xad1c('0x54')))),_0xad1c('0x59')]]})[_0xad1c('0x1f')](handleEntityNotFound(_0x3b98f7,null))[_0xad1c('0x1f')](respondWithResult(_0x3b98f7,null))['catch'](handleError(_0x3b98f7,null));};exports['moveContactsQueueCampaignHopperFinal']=function(_0x2dd27a,_0x2940af,_0x5df53a){return db[_0xad1c('0x5a')]['find']({'where':{'id':_0x2dd27a[_0xad1c('0x3e')]['id']}})[_0xad1c('0x1f')](handleEntityNotFound(_0x2940af,null))[_0xad1c('0x1f')](function(_0x1eea0f){var _0x46a365;if(_0x1eea0f){_0x46a365=squel[_0xad1c('0x5b')]()[_0xad1c('0x5c')](_0xad1c('0x5d'))[_0xad1c('0x5e')]([_0xad1c('0x5f'),_0xad1c('0x60'),_0xad1c('0x61'),_0xad1c('0x62'),_0xad1c('0x63'),_0xad1c('0x64'),_0xad1c('0x65')],squel[_0xad1c('0x66')]()[_0xad1c('0x67')](_0xad1c('0x68'),_0xad1c('0x5f'))[_0xad1c('0x67')]('NOW()',_0xad1c('0x60'))['field']('ANY_VALUE(ContactId)',_0xad1c('0x61'))[_0xad1c('0x67')]('ANY_VALUE(ListId)',_0xad1c('0x62'))[_0xad1c('0x67')]('ANY_VALUE(VoiceQueueId)',_0xad1c('0x63'))['field']('NOW()',_0xad1c('0x64'))['field'](_0xad1c('0x69'),_0xad1c('0x65'))[_0xad1c('0x6a')](_0xad1c('0x6b'))[_0xad1c('0x34')]('VoiceQueueId\x20=\x20?',_0x2dd27a['params']['id']['toString']())[_0xad1c('0x34')](_0xad1c('0x6c'),_0x2dd27a['body']['state'][_0xad1c('0x6d')]())[_0xad1c('0x34')]('calleridnum\x20IS\x20NOT\x20NULL')[_0xad1c('0x34')](_0xad1c('0x6e'),squel[_0xad1c('0x66')]()[_0xad1c('0x67')](_0xad1c('0x5f'))[_0xad1c('0x6a')](_0xad1c('0x5d'))[_0xad1c('0x34')](_0xad1c('0x6f'),_0x2dd27a[_0xad1c('0x3e')]['id']['toString']()))[_0xad1c('0x34')]('calleridnum\x20NOT\x20IN\x20(?)',squel['select']()['field']('calleridnum')[_0xad1c('0x6a')](_0xad1c('0x6b'))[_0xad1c('0x34')](_0xad1c('0x6f'),_0x2dd27a['params']['id'][_0xad1c('0x6d')]())[_0xad1c('0x34')](_0xad1c('0x70')))[_0xad1c('0x71')]('ContactId'))['toString']();return db[_0xad1c('0x46')][_0xad1c('0x2a')](_0x46a365);}return[];})['then'](respondWithResult(_0x2940af,null))[_0xad1c('0x3c')](handleError(_0x2940af,null));};exports[_0xad1c('0x72')]=function(_0x2db5c8,_0x7b7f7b,_0xf5f219){return db[_0xad1c('0x73')][_0xad1c('0x41')]({'where':{'id':_0x2db5c8[_0xad1c('0x3e')]['id']}})[_0xad1c('0x1f')](handleEntityNotFound(_0x7b7f7b,null))[_0xad1c('0x1f')](function(_0x565a15){var _0x39911f;if(_0x565a15){_0x39911f=squel[_0xad1c('0x5b')]()[_0xad1c('0x5c')]('cm_hopper')['fromQuery']([_0xad1c('0x5f'),'scheduledAt',_0xad1c('0x61'),_0xad1c('0x62'),'CampaignId',_0xad1c('0x64'),_0xad1c('0x65')],squel[_0xad1c('0x66')]()[_0xad1c('0x67')]('ANY_VALUE(calleridnum)',_0xad1c('0x5f'))[_0xad1c('0x67')](_0xad1c('0x69'),_0xad1c('0x60'))[_0xad1c('0x67')]('ANY_VALUE(ContactId)',_0xad1c('0x61'))[_0xad1c('0x67')](_0xad1c('0x74'),_0xad1c('0x62'))['field'](_0xad1c('0x75'),_0xad1c('0x76'))['field']('NOW()',_0xad1c('0x64'))['field'](_0xad1c('0x69'),_0xad1c('0x65'))[_0xad1c('0x6a')](_0xad1c('0x6b'))[_0xad1c('0x34')]('CampaignId\x20=\x20?',_0x2db5c8[_0xad1c('0x3e')]['id'][_0xad1c('0x6d')]())['where']('state\x20=\x20?',_0x2db5c8['body'][_0xad1c('0x77')][_0xad1c('0x6d')]())[_0xad1c('0x34')](_0xad1c('0x78'))[_0xad1c('0x34')](_0xad1c('0x6e'),squel[_0xad1c('0x66')]()[_0xad1c('0x67')](_0xad1c('0x5f'))['from'](_0xad1c('0x5d'))[_0xad1c('0x34')]('CampaignId\x20=\x20?',_0x2db5c8['params']['id'][_0xad1c('0x6d')]()))[_0xad1c('0x34')](_0xad1c('0x6e'),squel[_0xad1c('0x66')]()['field']('calleridnum')[_0xad1c('0x6a')](_0xad1c('0x6b'))[_0xad1c('0x34')]('CampaignId\x20=\x20?',_0x2db5c8[_0xad1c('0x3e')]['id'][_0xad1c('0x6d')]())[_0xad1c('0x34')]('state\x20=\x204'))[_0xad1c('0x71')]('ContactId'))['toString']();return db['sequelize']['query'](_0x39911f);}return[];})[_0xad1c('0x1f')](respondWithResult(_0x7b7f7b,null))[_0xad1c('0x3c')](handleError(_0x7b7f7b,null));};exports[_0xad1c('0x79')]=function(_0x1203d2,_0x1df7e9,_0x32e3b4){return db[_0xad1c('0x7a')][_0xad1c('0x7b')]({'where':{'VoiceQueueId':_0x1203d2[_0xad1c('0x43')][_0xad1c('0x63')],'CampaignId':_0x1203d2[_0xad1c('0x43')][_0xad1c('0x76')],'ContactId':_0x1203d2[_0xad1c('0x43')][_0xad1c('0x61')]}})['then'](handleEntityNotFound(_0x1df7e9,null))[_0xad1c('0x1f')](function(_0x3c8941){if(_0x3c8941){return _0x3c8941;}return null;})[_0xad1c('0x1f')](respondWithResult(_0x1df7e9,null))[_0xad1c('0x3c')](handleError(_0x1df7e9,null));}; \ No newline at end of file +var _0x39e6=['field','phone','ANY_VALUE(ContactId)','ANY_VALUE(ListId)','ANY_VALUE(VoiceQueueId)','NOW()','from','cm_hopper_final','VoiceQueueId\x20=\x20?','state\x20=\x20?','state','toString','calleridnum\x20NOT\x20IN\x20(?)','select','calleridnum','state\x20=\x204','group','moveContactsIvrCampaignHopperFinal','updatedAt','ANY_VALUE(calleridnum)','ANY_VALUE(CampaignId)','CampaignId\x20=\x20?','calleridnum\x20IS\x20NOT\x20NULL','checkContactHopper','CmHopper','findOne','CampaignId','html-pdf','rimraf','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','api','../../config/utils','../../config/environment','../../mysqldb','end','status','json','offset','limit','set','Content-Range','apply','save','update','error','stack','name','send','index','CmHopperFinal','fieldName','type','key','model','map','keys','query','attributes','fields','length','hasOwnProperty','order','sort','where','filters','pick','filter','VIRTUAL','merge','options','count','then','includeAll','include','catch','params','rawAttributes','intersection','describe','body','uniqueid','find','countContactsQueueCampaignHopperFinal','sequelize','COUNT','literal','`state`\x20=\x200,\x201,\x20null','noSuchContacts','`state`\x20=\x203,\x201,\x20null','noAnswerContacts','`state`\x20=\x205,\x201,\x20null','busyContacts','congestionContacts','`state`\x20=\x2010\x20,\x201,\x20null','`state`\x20=\x2011\x20,\x201,\x20null','abandonedContacts','`state`\x20=\x2022,\x201,\x20null','`state`\x20=\x2019,\x201,\x20null','answeringMachine','countContactsIvrCampaignHopperFinal','findAll','dropContacts','moveContactsQueueCampaignHopperFinal','VoiceQueue','insert','into','cm_hopper','fromQuery','scheduledAt','ContactId','ListId','VoiceQueueId','createdAt'];(function(_0x556927,_0x34b53f){var _0x5f1235=function(_0x4f4e44){while(--_0x4f4e44){_0x556927['push'](_0x556927['shift']());}};_0x5f1235(++_0x34b53f);}(_0x39e6,0x9e));var _0x639e=function(_0x418263,_0x4da860){_0x418263=_0x418263-0x0;var _0x3481df=_0x39e6[_0x418263];return _0x3481df;};'use strict';var pdf=require(_0x639e('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x639e('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x639e('0x2'));var moment=require(_0x639e('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x639e('0x4'));var util=require(_0x639e('0x5'));var path=require(_0x639e('0x6'));var sox=require(_0x639e('0x7'));var csv=require(_0x639e('0x8'));var ejs=require(_0x639e('0x9'));var fs=require('fs');var _=require(_0x639e('0xa'));var squel=require(_0x639e('0xb'));var crypto=require(_0x639e('0xc'));var jsforce=require(_0x639e('0xd'));var deskjs=require(_0x639e('0xe'));var toCsv=require(_0x639e('0x8'));var querystring=require(_0x639e('0xf'));var Papa=require(_0x639e('0x10'));var Redis=require(_0x639e('0x11'));var authService=require(_0x639e('0x12'));var qs=require(_0x639e('0x13'));var as=require(_0x639e('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x639e('0x15'));var utils=require(_0x639e('0x16'));var config=require(_0x639e('0x17'));var db=require(_0x639e('0x18'))['db'];function respondWithStatusCode(_0x1be347,_0x16117b){_0x16117b=_0x16117b||0xcc;return function(_0x30b490){if(_0x30b490){return _0x1be347['sendStatus'](_0x16117b);}return _0x1be347['status'](_0x16117b)[_0x639e('0x19')]();};}function respondWithResult(_0x3a1693,_0x89302c){_0x89302c=_0x89302c||0xc8;return function(_0x199fb5){if(_0x199fb5){return _0x3a1693[_0x639e('0x1a')](_0x89302c)[_0x639e('0x1b')](_0x199fb5);}};}function respondWithFilteredResult(_0x55728e,_0x31826a){return function(_0x20bfbb){if(_0x20bfbb){var _0x23f0f9=_0x20bfbb['count'],_0x4077c5=_0x31826a[_0x639e('0x1c')],_0x4fa3fa=_0x31826a[_0x639e('0x1c')]+_0x31826a[_0x639e('0x1d')],_0x6dd912;if(_0x4fa3fa>=_0x23f0f9){_0x4fa3fa=_0x23f0f9;_0x6dd912=0xc8;}else{_0x6dd912=0xce;}_0x55728e[_0x639e('0x1a')](_0x6dd912);return _0x55728e[_0x639e('0x1e')](_0x639e('0x1f'),_0x4077c5+'-'+_0x4fa3fa+'/'+_0x23f0f9)['json'](_0x20bfbb);}return null;};}function patchUpdates(_0x1e8310){return function(_0x34baca){try{jsonpatch[_0x639e('0x20')](_0x34baca,_0x1e8310,!![]);}catch(_0x1da55e){return BPromise['reject'](_0x1da55e);}return _0x34baca[_0x639e('0x21')]();};}function saveUpdates(_0xdf47a5,_0x44dd33){return function(_0x149472){if(_0x149472){return _0x149472[_0x639e('0x22')](_0xdf47a5)['then'](function(_0xf31cf7){return _0xf31cf7;});}return null;};}function removeEntity(_0x35565b,_0x4f4421){return function(_0x25ead8){if(_0x25ead8){return _0x25ead8['destroy']()['then'](function(){_0x35565b[_0x639e('0x1a')](0xcc)[_0x639e('0x19')]();});}};}function handleEntityNotFound(_0x3ab673,_0x24e1ad){return function(_0x211fcb){if(!_0x211fcb){_0x3ab673['sendStatus'](0x194);}return _0x211fcb;};}function handleError(_0x2b699c,_0x3647d9){_0x3647d9=_0x3647d9||0x1f4;return function(_0x39b44f){logger[_0x639e('0x23')](_0x39b44f[_0x639e('0x24')]);if(_0x39b44f['name']){delete _0x39b44f[_0x639e('0x25')];}_0x2b699c[_0x639e('0x1a')](_0x3647d9)[_0x639e('0x26')](_0x39b44f);};}exports[_0x639e('0x27')]=function(_0x5b5b8c,_0x2ae3b7){var _0x282d87={},_0x13ef2b={},_0x49b921={'count':0x0,'rows':[]};var _0xefbf1c=_['map'](db[_0x639e('0x28')]['rawAttributes'],function(_0x525a1f){return{'name':_0x525a1f[_0x639e('0x29')],'type':_0x525a1f[_0x639e('0x2a')][_0x639e('0x2b')]};});_0x13ef2b[_0x639e('0x2c')]=_[_0x639e('0x2d')](_0xefbf1c,_0x639e('0x25'));_0x13ef2b['query']=_[_0x639e('0x2e')](_0x5b5b8c[_0x639e('0x2f')]);_0x13ef2b['filters']=_['intersection'](_0x13ef2b[_0x639e('0x2c')],_0x13ef2b[_0x639e('0x2f')]);_0x282d87[_0x639e('0x30')]=_['intersection'](_0x13ef2b[_0x639e('0x2c')],qs['fields'](_0x5b5b8c[_0x639e('0x2f')][_0x639e('0x31')]));_0x282d87[_0x639e('0x30')]=_0x282d87['attributes'][_0x639e('0x32')]?_0x282d87['attributes']:_0x13ef2b[_0x639e('0x2c')];if(!_0x5b5b8c[_0x639e('0x2f')][_0x639e('0x33')]('nolimit')){_0x282d87[_0x639e('0x1d')]=qs[_0x639e('0x1d')](_0x5b5b8c[_0x639e('0x2f')]['limit']);_0x282d87[_0x639e('0x1c')]=qs['offset'](_0x5b5b8c[_0x639e('0x2f')][_0x639e('0x1c')]);}_0x282d87[_0x639e('0x34')]=qs[_0x639e('0x35')](_0x5b5b8c[_0x639e('0x2f')]['sort']);_0x282d87[_0x639e('0x36')]=qs[_0x639e('0x37')](_[_0x639e('0x38')](_0x5b5b8c[_0x639e('0x2f')],_0x13ef2b['filters']),_0xefbf1c);if(_0x5b5b8c[_0x639e('0x2f')][_0x639e('0x39')]){_0x282d87[_0x639e('0x36')]=_['merge'](_0x282d87[_0x639e('0x36')],{'$or':_['map'](_0xefbf1c,function(_0x463aa7){if(_0x463aa7[_0x639e('0x2a')]!==_0x639e('0x3a')){var _0x4541cc={};_0x4541cc[_0x463aa7[_0x639e('0x25')]]={'$like':'%'+_0x5b5b8c[_0x639e('0x2f')]['filter']+'%'};return _0x4541cc;}})});}_0x282d87=_[_0x639e('0x3b')]({},_0x282d87,_0x5b5b8c[_0x639e('0x3c')]);var _0x55a8e2={'where':_0x282d87[_0x639e('0x36')]};return db['CmHopperFinal'][_0x639e('0x3d')](_0x55a8e2)[_0x639e('0x3e')](function(_0x3ba300){_0x49b921[_0x639e('0x3d')]=_0x3ba300;if(_0x5b5b8c[_0x639e('0x2f')][_0x639e('0x3f')]){_0x282d87[_0x639e('0x40')]=[{'all':!![]}];}return db[_0x639e('0x28')]['findAll'](_0x282d87);})['then'](function(_0x490045){_0x49b921['rows']=_0x490045;return _0x49b921;})[_0x639e('0x3e')](respondWithFilteredResult(_0x2ae3b7,_0x282d87))[_0x639e('0x41')](handleError(_0x2ae3b7,null));};exports['show']=function(_0x2fa730,_0x3f13ec){var _0x16a792={'raw':!![],'where':{'id':_0x2fa730[_0x639e('0x42')]['id']}},_0x54f0c9={};_0x54f0c9[_0x639e('0x2c')]=_[_0x639e('0x2e')](db[_0x639e('0x28')][_0x639e('0x43')]);_0x54f0c9[_0x639e('0x2f')]=_[_0x639e('0x2e')](_0x2fa730[_0x639e('0x2f')]);_0x54f0c9[_0x639e('0x37')]=_['intersection'](_0x54f0c9[_0x639e('0x2c')],_0x54f0c9[_0x639e('0x2f')]);_0x16a792[_0x639e('0x30')]=_[_0x639e('0x44')](_0x54f0c9[_0x639e('0x2c')],qs[_0x639e('0x31')](_0x2fa730['query'][_0x639e('0x31')]));_0x16a792[_0x639e('0x30')]=_0x16a792[_0x639e('0x30')][_0x639e('0x32')]?_0x16a792[_0x639e('0x30')]:_0x54f0c9[_0x639e('0x2c')];if(_0x2fa730[_0x639e('0x2f')][_0x639e('0x3f')]){_0x16a792[_0x639e('0x40')]=[{'all':!![]}];}_0x16a792=_[_0x639e('0x3b')]({},_0x16a792,_0x2fa730[_0x639e('0x3c')]);return db[_0x639e('0x28')]['find'](_0x16a792)[_0x639e('0x3e')](handleEntityNotFound(_0x3f13ec,null))['then'](respondWithResult(_0x3f13ec,null))['catch'](handleError(_0x3f13ec,null));};exports[_0x639e('0x45')]=function(_0x106f47,_0x44a3e5){return db[_0x639e('0x28')][_0x639e('0x45')]()['then'](respondWithResult(_0x44a3e5,null))[_0x639e('0x41')](handleError(_0x44a3e5,null));};exports[_0x639e('0x22')]=function(_0x56ecea,_0x32000e){if(_0x56ecea[_0x639e('0x46')][_0x639e('0x47')]){delete _0x56ecea['body'][_0x639e('0x47')];}return db[_0x639e('0x28')][_0x639e('0x48')]({'where':{'uniqueid':_0x56ecea[_0x639e('0x42')]['id']}})['then'](handleEntityNotFound(_0x32000e,null))[_0x639e('0x3e')](saveUpdates(_0x56ecea['body'],null))[_0x639e('0x3e')](respondWithResult(_0x32000e,null))['catch'](handleError(_0x32000e,null));};exports[_0x639e('0x49')]=function(_0x413ebd,_0x4398d0,_0x8f10f2){return db[_0x639e('0x28')]['findAll']({'raw':![],'where':{'VoiceQueueId':_0x413ebd[_0x639e('0x42')]['id']},'attributes':[[db[_0x639e('0x4a')]['fn'](_0x639e('0x4b'),db['sequelize']['fn']('IF',db[_0x639e('0x4a')][_0x639e('0x4c')](_0x639e('0x4d')))),_0x639e('0x4e')],[db['sequelize']['fn'](_0x639e('0x4b'),db['sequelize']['fn']('IF',db[_0x639e('0x4a')][_0x639e('0x4c')](_0x639e('0x4f')))),_0x639e('0x50')],[db['sequelize']['fn'](_0x639e('0x4b'),db['sequelize']['fn']('IF',db['sequelize'][_0x639e('0x4c')](_0x639e('0x51')))),_0x639e('0x52')],[db[_0x639e('0x4a')]['fn']('COUNT',db[_0x639e('0x4a')]['fn']('IF',db[_0x639e('0x4a')][_0x639e('0x4c')]('`state`\x20=\x208,\x201,\x20null'))),_0x639e('0x53')],[db[_0x639e('0x4a')]['fn'](_0x639e('0x4b'),db[_0x639e('0x4a')]['fn']('IF',db[_0x639e('0x4a')][_0x639e('0x4c')](_0x639e('0x54')))),'dropContacts'],[db[_0x639e('0x4a')]['fn'](_0x639e('0x4b'),db[_0x639e('0x4a')]['fn']('IF',db[_0x639e('0x4a')]['literal'](_0x639e('0x55')))),_0x639e('0x56')],[db[_0x639e('0x4a')]['fn']('COUNT',db['sequelize']['fn']('IF',db['sequelize'][_0x639e('0x4c')](_0x639e('0x57')))),'reCallContacts'],[db[_0x639e('0x4a')]['fn'](_0x639e('0x4b'),db[_0x639e('0x4a')]['fn']('IF',db[_0x639e('0x4a')][_0x639e('0x4c')](_0x639e('0x58')))),_0x639e('0x59')]]})[_0x639e('0x3e')](handleEntityNotFound(_0x4398d0,null))['then'](respondWithResult(_0x4398d0,null))[_0x639e('0x41')](handleError(_0x4398d0,null));};exports[_0x639e('0x5a')]=function(_0x496fe5,_0x560ac1,_0x368619){return db['CmHopperFinal'][_0x639e('0x5b')]({'raw':![],'where':{'CampaignId':_0x496fe5[_0x639e('0x42')]['id']},'attributes':[[db[_0x639e('0x4a')]['fn']('COUNT',db[_0x639e('0x4a')]['fn']('IF',db[_0x639e('0x4a')][_0x639e('0x4c')](_0x639e('0x4d')))),'noSuchContacts'],[db[_0x639e('0x4a')]['fn'](_0x639e('0x4b'),db['sequelize']['fn']('IF',db[_0x639e('0x4a')][_0x639e('0x4c')](_0x639e('0x4f')))),_0x639e('0x50')],[db[_0x639e('0x4a')]['fn']('COUNT',db[_0x639e('0x4a')]['fn']('IF',db[_0x639e('0x4a')][_0x639e('0x4c')](_0x639e('0x51')))),_0x639e('0x52')],[db[_0x639e('0x4a')]['fn'](_0x639e('0x4b'),db[_0x639e('0x4a')]['fn']('IF',db[_0x639e('0x4a')][_0x639e('0x4c')]('`state`\x20=\x208,\x201,\x20null'))),'congestionContacts'],[db[_0x639e('0x4a')]['fn'](_0x639e('0x4b'),db[_0x639e('0x4a')]['fn']('IF',db[_0x639e('0x4a')][_0x639e('0x4c')]('`state`\x20=\x2010\x20,\x201,\x20null'))),_0x639e('0x5c')],[db['sequelize']['fn'](_0x639e('0x4b'),db[_0x639e('0x4a')]['fn']('IF',db[_0x639e('0x4a')]['literal']('`state`\x20=\x2011\x20,\x201,\x20null'))),_0x639e('0x56')],[db[_0x639e('0x4a')]['fn'](_0x639e('0x4b'),db['sequelize']['fn']('IF',db['sequelize'][_0x639e('0x4c')](_0x639e('0x57')))),'reCallContacts'],[db[_0x639e('0x4a')]['fn'](_0x639e('0x4b'),db[_0x639e('0x4a')]['fn']('IF',db[_0x639e('0x4a')]['literal'](_0x639e('0x58')))),_0x639e('0x59')]]})[_0x639e('0x3e')](handleEntityNotFound(_0x560ac1,null))[_0x639e('0x3e')](respondWithResult(_0x560ac1,null))['catch'](handleError(_0x560ac1,null));};exports[_0x639e('0x5d')]=function(_0x1b3d07,_0x1bd708,_0x3c945c){return db[_0x639e('0x5e')]['find']({'where':{'id':_0x1b3d07[_0x639e('0x42')]['id']}})[_0x639e('0x3e')](handleEntityNotFound(_0x1bd708,null))[_0x639e('0x3e')](function(_0x156e51){var _0x2aa53b;if(_0x156e51){_0x2aa53b=squel[_0x639e('0x5f')]()[_0x639e('0x60')](_0x639e('0x61'))[_0x639e('0x62')](['phone',_0x639e('0x63'),_0x639e('0x64'),_0x639e('0x65'),_0x639e('0x66'),_0x639e('0x67'),'updatedAt'],squel['select']()[_0x639e('0x68')]('ANY_VALUE(calleridnum)',_0x639e('0x69'))[_0x639e('0x68')]('NOW()',_0x639e('0x63'))[_0x639e('0x68')](_0x639e('0x6a'),_0x639e('0x64'))['field'](_0x639e('0x6b'),_0x639e('0x65'))[_0x639e('0x68')](_0x639e('0x6c'),'VoiceQueueId')[_0x639e('0x68')]('NOW()',_0x639e('0x67'))[_0x639e('0x68')](_0x639e('0x6d'),'updatedAt')[_0x639e('0x6e')](_0x639e('0x6f'))[_0x639e('0x36')](_0x639e('0x70'),_0x1b3d07[_0x639e('0x42')]['id']['toString']())['where'](_0x639e('0x71'),_0x1b3d07[_0x639e('0x46')][_0x639e('0x72')][_0x639e('0x73')]())[_0x639e('0x36')]('calleridnum\x20IS\x20NOT\x20NULL')[_0x639e('0x36')](_0x639e('0x74'),squel[_0x639e('0x75')]()[_0x639e('0x68')](_0x639e('0x69'))[_0x639e('0x6e')](_0x639e('0x61'))[_0x639e('0x36')]('VoiceQueueId\x20=\x20?',_0x1b3d07['params']['id']['toString']()))[_0x639e('0x36')](_0x639e('0x74'),squel[_0x639e('0x75')]()[_0x639e('0x68')](_0x639e('0x76'))[_0x639e('0x6e')](_0x639e('0x6f'))['where'](_0x639e('0x70'),_0x1b3d07['params']['id'][_0x639e('0x73')]())[_0x639e('0x36')](_0x639e('0x77')))[_0x639e('0x78')]('ContactId'))[_0x639e('0x73')]();return db[_0x639e('0x4a')][_0x639e('0x2f')](_0x2aa53b);}return[];})[_0x639e('0x3e')](respondWithResult(_0x1bd708,null))['catch'](handleError(_0x1bd708,null));};exports[_0x639e('0x79')]=function(_0xd66e73,_0x356d88,_0x1732f8){return db['Campaign'][_0x639e('0x48')]({'where':{'id':_0xd66e73[_0x639e('0x42')]['id']}})['then'](handleEntityNotFound(_0x356d88,null))[_0x639e('0x3e')](function(_0x527dd3){var _0x294922;if(_0x527dd3){_0x294922=squel[_0x639e('0x5f')]()[_0x639e('0x60')](_0x639e('0x61'))[_0x639e('0x62')](['phone',_0x639e('0x63'),_0x639e('0x64'),_0x639e('0x65'),'CampaignId',_0x639e('0x67'),_0x639e('0x7a')],squel[_0x639e('0x75')]()['field'](_0x639e('0x7b'),_0x639e('0x69'))[_0x639e('0x68')](_0x639e('0x6d'),_0x639e('0x63'))[_0x639e('0x68')](_0x639e('0x6a'),_0x639e('0x64'))[_0x639e('0x68')](_0x639e('0x6b'),_0x639e('0x65'))[_0x639e('0x68')](_0x639e('0x7c'),'CampaignId')[_0x639e('0x68')]('NOW()',_0x639e('0x67'))[_0x639e('0x68')](_0x639e('0x6d'),_0x639e('0x7a'))[_0x639e('0x6e')]('cm_hopper_final')[_0x639e('0x36')](_0x639e('0x7d'),_0xd66e73[_0x639e('0x42')]['id'][_0x639e('0x73')]())[_0x639e('0x36')](_0x639e('0x71'),_0xd66e73[_0x639e('0x46')][_0x639e('0x72')][_0x639e('0x73')]())[_0x639e('0x36')](_0x639e('0x7e'))['where']('calleridnum\x20NOT\x20IN\x20(?)',squel[_0x639e('0x75')]()[_0x639e('0x68')](_0x639e('0x69'))['from'](_0x639e('0x61'))[_0x639e('0x36')](_0x639e('0x7d'),_0xd66e73['params']['id'][_0x639e('0x73')]()))[_0x639e('0x36')](_0x639e('0x74'),squel['select']()[_0x639e('0x68')](_0x639e('0x76'))[_0x639e('0x6e')](_0x639e('0x6f'))[_0x639e('0x36')](_0x639e('0x7d'),_0xd66e73[_0x639e('0x42')]['id'][_0x639e('0x73')]())['where'](_0x639e('0x77')))['group'](_0x639e('0x64')))[_0x639e('0x73')]();return db[_0x639e('0x4a')][_0x639e('0x2f')](_0x294922);}return[];})['then'](respondWithResult(_0x356d88,null))[_0x639e('0x41')](handleError(_0x356d88,null));};exports[_0x639e('0x7f')]=function(_0x56b313,_0x47bf07,_0xedca5f){return db[_0x639e('0x80')][_0x639e('0x81')]({'where':{'VoiceQueueId':_0x56b313[_0x639e('0x46')][_0x639e('0x66')],'CampaignId':_0x56b313[_0x639e('0x46')][_0x639e('0x82')],'ContactId':_0x56b313[_0x639e('0x46')][_0x639e('0x64')]}})['then'](handleEntityNotFound(_0x47bf07,null))[_0x639e('0x3e')](function(_0x3a51e1){if(_0x3a51e1){return _0x3a51e1;}return null;})[_0x639e('0x3e')](respondWithResult(_0x47bf07,null))[_0x639e('0x41')](handleError(_0x47bf07,null));}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.model.js b/server/api/cmHopperFinal/cmHopperFinal.model.js index 7518c11..ddfd86f 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 _0x5db8=['exports','CmHopperFinal','cm_hopper_final','calleridnum','uniqueid','lodash','util','../../config/logger','moment','bluebird','request-promise','../../config/environment','./cmHopperFinal.attributes'];(function(_0x50a3fe,_0x396f4a){var _0x2edb0e=function(_0x20cd39){while(--_0x20cd39){_0x50a3fe['push'](_0x50a3fe['shift']());}};_0x2edb0e(++_0x396f4a);}(_0x5db8,0xbb));var _0x85db=function(_0x118733,_0x2bd820){_0x118733=_0x118733-0x0;var _0x4777af=_0x5db8[_0x118733];return _0x4777af;};'use strict';var _=require(_0x85db('0x0'));var util=require(_0x85db('0x1'));var logger=require(_0x85db('0x2'))('api');var moment=require(_0x85db('0x3'));var BPromise=require(_0x85db('0x4'));var rp=require(_0x85db('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x85db('0x6'));var attributes=require(_0x85db('0x7'));module[_0x85db('0x8')]=function(_0x34d71f,_0x48bf16){return _0x34d71f['define'](_0x85db('0x9'),attributes,{'tableName':_0x85db('0xa'),'paranoid':![],'indexes':[{'name':_0x85db('0xb'),'fields':[_0x85db('0xb')]},{'name':'uniqueid','fields':[_0x85db('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x16e4=['api','moment','bluebird','path','../../config/environment','./cmHopperFinal.attributes','define','CmHopperFinal','cm_hopper_final','calleridnum','uniqueid','lodash','util','../../config/logger'];(function(_0x277107,_0x3420dc){var _0x1da046=function(_0x47122d){while(--_0x47122d){_0x277107['push'](_0x277107['shift']());}};_0x1da046(++_0x3420dc);}(_0x16e4,0x97));var _0x416e=function(_0x12dcf9,_0x47c679){_0x12dcf9=_0x12dcf9-0x0;var _0x2e02cf=_0x16e4[_0x12dcf9];return _0x2e02cf;};'use strict';var _=require(_0x416e('0x0'));var util=require(_0x416e('0x1'));var logger=require(_0x416e('0x2'))(_0x416e('0x3'));var moment=require(_0x416e('0x4'));var BPromise=require(_0x416e('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x416e('0x6'));var rimraf=require('rimraf');var config=require(_0x416e('0x7'));var attributes=require(_0x416e('0x8'));module['exports']=function(_0x1dad5d,_0x2f7484){return _0x1dad5d[_0x416e('0x9')](_0x416e('0xa'),attributes,{'tableName':_0x416e('0xb'),'paranoid':![],'indexes':[{'name':_0x416e('0xc'),'fields':[_0x416e('0xc')]},{'name':_0x416e('0xd'),'fields':[_0x416e('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.rpc.js b/server/api/cmHopperFinal/cmHopperFinal.rpc.js index 8035f89..11bb210 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 _0x011c=['debug','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','CmHopperFinal,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','CreateCmHopperFinal','create','body','options','raw'];(function(_0x292423,_0x1759b7){var _0x2801cb=function(_0x23c821){while(--_0x23c821){_0x292423['push'](_0x292423['shift']());}};_0x2801cb(++_0x1759b7);}(_0x011c,0x8e));var _0xc011=function(_0x497a6a,_0x25b228){_0x497a6a=_0x497a6a-0x0;var _0x2b43c8=_0x011c[_0x497a6a];return _0x2b43c8;};'use strict';var _=require(_0xc011('0x0'));var util=require(_0xc011('0x1'));var moment=require(_0xc011('0x2'));var BPromise=require(_0xc011('0x3'));var rs=require(_0xc011('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xc011('0x5'))['db'];var utils=require(_0xc011('0x6'));var logger=require(_0xc011('0x7'))(_0xc011('0x8'));var config=require(_0xc011('0x9'));var jayson=require(_0xc011('0xa'));var client=jayson['client'][_0xc011('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x19b4ac,_0x5788e4,_0x56f9b7){return new BPromise(function(_0x26e24c,_0x57421d){return client[_0xc011('0xc')](_0x19b4ac,_0x56f9b7)[_0xc011('0xd')](function(_0x370c6b){logger[_0xc011('0xe')](_0xc011('0xf'),_0x5788e4,_0xc011('0x10'));logger['debug']('CmHopperFinal,\x20%s,\x20%s,\x20%s',_0x5788e4,'request\x20sent',JSON[_0xc011('0x11')](_0x370c6b));if(_0x370c6b[_0xc011('0x12')]){if(_0x370c6b['error'][_0xc011('0x13')]===0x1f4){logger['error'](_0xc011('0xf'),_0x5788e4,_0x370c6b[_0xc011('0x12')]['message']);return _0x57421d(_0x370c6b['error'][_0xc011('0x14')]);}logger['error'](_0xc011('0xf'),_0x5788e4,_0x370c6b[_0xc011('0x12')][_0xc011('0x14')]);return _0x26e24c(_0x370c6b[_0xc011('0x12')][_0xc011('0x14')]);}else{logger[_0xc011('0xe')](_0xc011('0xf'),_0x5788e4,_0xc011('0x10'));_0x26e24c(_0x370c6b['result']['message']);}})['catch'](function(_0x455e79){logger[_0xc011('0x12')](_0xc011('0xf'),_0x5788e4,_0x455e79);_0x57421d(_0x455e79);});});}exports[_0xc011('0x15')]=function(_0x3d491e){var _0x20d89f=this;return new Promise(function(_0x23fbf4,_0x3ee5ed){return db['CmHopperFinal'][_0xc011('0x16')](_0x3d491e[_0xc011('0x17')],{'raw':_0x3d491e['options']?_0x3d491e[_0xc011('0x18')][_0xc011('0x19')]===undefined?!![]:![]:!![]})[_0xc011('0xd')](function(_0x5756fd){logger[_0xc011('0xe')](_0xc011('0x15'),_0x3d491e);logger[_0xc011('0x1a')]('CreateCmHopperFinal',_0x3d491e,JSON[_0xc011('0x11')](_0x5756fd));_0x23fbf4(_0x5756fd);})[_0xc011('0x1b')](function(_0x271de8){logger['error'](_0xc011('0x15'),_0x271de8['message'],_0x3d491e);_0x3ee5ed(_0x20d89f[_0xc011('0x12')](0x1f4,_0x271de8[_0xc011('0x14')]));});});}; \ No newline at end of file +var _0xcbc3=['create','body','options','CreateCmHopperFinal','stringify','lodash','util','bluebird','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','request','then','info','CmHopperFinal,\x20%s,\x20%s','request\x20sent','debug','CmHopperFinal,\x20%s,\x20%s,\x20%s','error','message','result','catch','CmHopperFinal'];(function(_0x5575cd,_0x73ab7a){var _0x4979a0=function(_0x1ac744){while(--_0x1ac744){_0x5575cd['push'](_0x5575cd['shift']());}};_0x4979a0(++_0x73ab7a);}(_0xcbc3,0x1a5));var _0x3cbc=function(_0x1121b1,_0x4e40f2){_0x1121b1=_0x1121b1-0x0;var _0x5bf648=_0xcbc3[_0x1121b1];return _0x5bf648;};'use strict';var _=require(_0x3cbc('0x0'));var util=require(_0x3cbc('0x1'));var moment=require('moment');var BPromise=require(_0x3cbc('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x3cbc('0x3'))['db'];var utils=require(_0x3cbc('0x4'));var logger=require(_0x3cbc('0x5'))('rpc');var config=require(_0x3cbc('0x6'));var jayson=require(_0x3cbc('0x7'));var client=jayson[_0x3cbc('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x59faa8,_0x2d2add,_0x595796){return new BPromise(function(_0x2e072,_0x3cb26d){return client[_0x3cbc('0x9')](_0x59faa8,_0x595796)[_0x3cbc('0xa')](function(_0x4f70de){logger[_0x3cbc('0xb')](_0x3cbc('0xc'),_0x2d2add,_0x3cbc('0xd'));logger[_0x3cbc('0xe')](_0x3cbc('0xf'),_0x2d2add,'request\x20sent',JSON['stringify'](_0x4f70de));if(_0x4f70de['error']){if(_0x4f70de[_0x3cbc('0x10')]['code']===0x1f4){logger[_0x3cbc('0x10')](_0x3cbc('0xc'),_0x2d2add,_0x4f70de[_0x3cbc('0x10')][_0x3cbc('0x11')]);return _0x3cb26d(_0x4f70de[_0x3cbc('0x10')]['message']);}logger[_0x3cbc('0x10')]('CmHopperFinal,\x20%s,\x20%s',_0x2d2add,_0x4f70de[_0x3cbc('0x10')][_0x3cbc('0x11')]);return _0x2e072(_0x4f70de[_0x3cbc('0x10')]['message']);}else{logger[_0x3cbc('0xb')](_0x3cbc('0xc'),_0x2d2add,_0x3cbc('0xd'));_0x2e072(_0x4f70de[_0x3cbc('0x12')][_0x3cbc('0x11')]);}})[_0x3cbc('0x13')](function(_0x5dfa15){logger['error'](_0x3cbc('0xc'),_0x2d2add,_0x5dfa15);_0x3cb26d(_0x5dfa15);});});}exports['CreateCmHopperFinal']=function(_0x29548e){var _0x2483dd=this;return new Promise(function(_0x4cdb83,_0x5bed87){return db[_0x3cbc('0x14')][_0x3cbc('0x15')](_0x29548e[_0x3cbc('0x16')],{'raw':_0x29548e[_0x3cbc('0x17')]?_0x29548e[_0x3cbc('0x17')]['raw']===undefined?!![]:![]:!![]})[_0x3cbc('0xa')](function(_0x498896){logger['info'](_0x3cbc('0x18'),_0x29548e);logger[_0x3cbc('0xe')](_0x3cbc('0x18'),_0x29548e,JSON[_0x3cbc('0x19')](_0x498896));_0x4cdb83(_0x498896);})['catch'](function(_0x59a57a){logger[_0x3cbc('0x10')](_0x3cbc('0x18'),_0x59a57a[_0x3cbc('0x11')],_0x29548e);_0x5bed87(_0x2483dd[_0x3cbc('0x10')](0x1f4,_0x59a57a[_0x3cbc('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/index.js b/server/api/cmHopperFinal/index.js index 35cf3d5..e227df5 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 _0xc348=['/voice/queue/moveContacts/:id','checkContactHopper','put','/:id','update','exports','multer','util','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmHopperFinal.controller','isAuthenticated','index','get','/describe','describe','show','countContactsQueueCampaignHopperFinal','/campaign/countAttributes/:id','countContactsIvrCampaignHopperFinal','post'];(function(_0x3d2cab,_0x4baf9c){var _0x49feb9=function(_0x3133c3){while(--_0x3133c3){_0x3d2cab['push'](_0x3d2cab['shift']());}};_0x49feb9(++_0x4baf9c);}(_0xc348,0xd5));var _0x8c34=function(_0x9b0064,_0x4b5ef7){_0x9b0064=_0x9b0064-0x0;var _0xe356a0=_0xc348[_0x9b0064];return _0xe356a0;};'use strict';var multer=require(_0x8c34('0x0'));var util=require(_0x8c34('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x8c34('0x2')]();var auth=require(_0x8c34('0x3'));var interaction=require(_0x8c34('0x4'));var config=require(_0x8c34('0x5'));var controller=require(_0x8c34('0x6'));router['get']('/',auth[_0x8c34('0x7')](),controller[_0x8c34('0x8')]);router[_0x8c34('0x9')](_0x8c34('0xa'),auth['isAuthenticated'](),controller[_0x8c34('0xb')]);router['get']('/:id',auth[_0x8c34('0x7')](),controller[_0x8c34('0xc')]);router[_0x8c34('0x9')]('/voice/queue/countAttributes/:id',auth['isAuthenticated'](),controller[_0x8c34('0xd')]);router[_0x8c34('0x9')](_0x8c34('0xe'),auth[_0x8c34('0x7')](),controller[_0x8c34('0xf')]);router[_0x8c34('0x10')](_0x8c34('0x11'),auth['isAuthenticated'](),controller['moveContactsQueueCampaignHopperFinal']);router[_0x8c34('0x10')]('/voice/campaign/moveContacts/:id',auth[_0x8c34('0x7')](),controller['moveContactsIvrCampaignHopperFinal']);router[_0x8c34('0x10')]('/checkContactHopper',auth['isAuthenticated'](),controller[_0x8c34('0x12')]);router[_0x8c34('0x13')](_0x8c34('0x14'),auth[_0x8c34('0x7')](),controller[_0x8c34('0x15')]);module[_0x8c34('0x16')]=router; \ No newline at end of file +var _0x6b87=['post','/voice/queue/moveContacts/:id','/voice/campaign/moveContacts/:id','/checkContactHopper','put','exports','multer','util','path','connect-timeout','Router','../../components/interaction/service','get','isAuthenticated','index','/describe','describe','/:id','show','/voice/queue/countAttributes/:id','countContactsQueueCampaignHopperFinal','/campaign/countAttributes/:id'];(function(_0x51aee3,_0x30c7e4){var _0x346280=function(_0x456939){while(--_0x456939){_0x51aee3['push'](_0x51aee3['shift']());}};_0x346280(++_0x30c7e4);}(_0x6b87,0x166));var _0x76b8=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x6b87[_0x2641f9];return _0x585741;};'use strict';var multer=require(_0x76b8('0x0'));var util=require(_0x76b8('0x1'));var path=require(_0x76b8('0x2'));var timeout=require(_0x76b8('0x3'));var express=require('express');var router=express[_0x76b8('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x76b8('0x5'));var config=require('../../config/environment');var controller=require('./cmHopperFinal.controller');router[_0x76b8('0x6')]('/',auth[_0x76b8('0x7')](),controller[_0x76b8('0x8')]);router[_0x76b8('0x6')](_0x76b8('0x9'),auth[_0x76b8('0x7')](),controller[_0x76b8('0xa')]);router[_0x76b8('0x6')](_0x76b8('0xb'),auth[_0x76b8('0x7')](),controller[_0x76b8('0xc')]);router[_0x76b8('0x6')](_0x76b8('0xd'),auth[_0x76b8('0x7')](),controller[_0x76b8('0xe')]);router[_0x76b8('0x6')](_0x76b8('0xf'),auth[_0x76b8('0x7')](),controller['countContactsIvrCampaignHopperFinal']);router[_0x76b8('0x10')](_0x76b8('0x11'),auth['isAuthenticated'](),controller['moveContactsQueueCampaignHopperFinal']);router[_0x76b8('0x10')](_0x76b8('0x12'),auth[_0x76b8('0x7')](),controller['moveContactsIvrCampaignHopperFinal']);router[_0x76b8('0x10')](_0x76b8('0x13'),auth[_0x76b8('0x7')](),controller['checkContactHopper']);router[_0x76b8('0x14')](_0x76b8('0xb'),auth[_0x76b8('0x7')](),controller['update']);module[_0x76b8('0x15')]=router; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.attributes.js b/server/api/cmHopperHistory/cmHopperHistory.attributes.js index b316940..10de981 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 _0x2e17=['BOOLEAN','exports','DATE','INTEGER','STRING'];(function(_0x4e2272,_0x2e1ae0){var _0x45511c=function(_0x285414){while(--_0x285414){_0x4e2272['push'](_0x4e2272['shift']());}};_0x45511c(++_0x2e1ae0);}(_0x2e17,0x14b));var _0x72e1=function(_0x342700,_0x569f75){_0x342700=_0x342700-0x0;var _0x53406f=_0x2e17[_0x342700];return _0x53406f;};'use strict';var Sequelize=require('sequelize');module[_0x72e1('0x0')]={'state':{'type':Sequelize['INTEGER'](0x2)},'statedesc':{'type':Sequelize['STRING']},'scheduledat':{'type':Sequelize[_0x72e1('0x1')]},'countbusyretry':{'type':Sequelize[_0x72e1('0x2')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x72e1('0x2')],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0x72e1('0x2')],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0x72e1('0x3')]},'originatecalleridnum':{'type':Sequelize[_0x72e1('0x3')]},'originatecalleridname':{'type':Sequelize[_0x72e1('0x3')]},'calleridnum':{'type':Sequelize[_0x72e1('0x3')]},'calleridname':{'type':Sequelize[_0x72e1('0x3')]},'starttime':{'type':Sequelize[_0x72e1('0x1')]},'responsetime':{'type':Sequelize[_0x72e1('0x1')]},'answertime':{'type':Sequelize[_0x72e1('0x1')]},'droptime':{'type':Sequelize[_0x72e1('0x1')]},'endtime':{'type':Sequelize[_0x72e1('0x1')]},'ringtime':{'type':Sequelize[_0x72e1('0x2')],'defaultValue':0x0},'holdtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'talktime':{'type':Sequelize[_0x72e1('0x2')],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0x72e1('0x2')],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0x72e1('0x3')]},'campaign':{'type':Sequelize['STRING']},'campaigntype':{'type':Sequelize['STRING']},'membername':{'type':Sequelize[_0x72e1('0x3')]},'reason':{'type':Sequelize[_0x72e1('0x3')]},'amd':{'type':Sequelize[_0x72e1('0x4')],'defaultValue':![]},'fax':{'type':Sequelize[_0x72e1('0x4')],'defaultValue':![]},'callback':{'type':Sequelize[_0x72e1('0x4')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x72e1('0x3')],'defaultValue':null},'callbackat':{'type':Sequelize[_0x72e1('0x1')]},'recallme':{'type':Sequelize[_0x72e1('0x4')],'defaultValue':![]},'editedat':{'type':Sequelize[_0x72e1('0x1')]},'edited':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'countnosuchnumberretry':{'type':Sequelize[_0x72e1('0x2')],'defaultValue':0x0},'countdropretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x72e1('0x2')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x72e1('0x2')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'dialTimezone':{'type':Sequelize[_0x72e1('0x3')]}}; \ No newline at end of file +var _0x59cf=['STRING','DATE','BOOLEAN','sequelize','exports','INTEGER'];(function(_0x1ab180,_0x382b2c){var _0xfb2c2d=function(_0x1c5fd3){while(--_0x1c5fd3){_0x1ab180['push'](_0x1ab180['shift']());}};_0xfb2c2d(++_0x382b2c);}(_0x59cf,0xe7));var _0xf59c=function(_0x903228,_0x42c429){_0x903228=_0x903228-0x0;var _0xcec81d=_0x59cf[_0x903228];return _0xcec81d;};'use strict';var Sequelize=require(_0xf59c('0x0'));module[_0xf59c('0x1')]={'state':{'type':Sequelize[_0xf59c('0x2')](0x2)},'statedesc':{'type':Sequelize[_0xf59c('0x3')]},'scheduledat':{'type':Sequelize[_0xf59c('0x4')]},'countbusyretry':{'type':Sequelize[_0xf59c('0x2')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0xf59c('0x2')],'defaultValue':0x0},'countglobal':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'uniqueid':{'type':Sequelize['STRING']},'originatecalleridnum':{'type':Sequelize['STRING']},'originatecalleridname':{'type':Sequelize[_0xf59c('0x3')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0xf59c('0x3')]},'starttime':{'type':Sequelize[_0xf59c('0x4')]},'responsetime':{'type':Sequelize[_0xf59c('0x4')]},'answertime':{'type':Sequelize['DATE']},'droptime':{'type':Sequelize['DATE']},'endtime':{'type':Sequelize[_0xf59c('0x4')]},'ringtime':{'type':Sequelize[_0xf59c('0x2')],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0xf59c('0x2')],'defaultValue':0x0},'talktime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0xf59c('0x2')],'defaultValue':0x0},'dropreason':{'type':Sequelize['STRING']},'campaign':{'type':Sequelize['STRING']},'campaigntype':{'type':Sequelize['STRING']},'membername':{'type':Sequelize['STRING']},'reason':{'type':Sequelize[_0xf59c('0x3')]},'amd':{'type':Sequelize[_0xf59c('0x5')],'defaultValue':![]},'fax':{'type':Sequelize[_0xf59c('0x5')],'defaultValue':![]},'callback':{'type':Sequelize[_0xf59c('0x5')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0xf59c('0x3')],'defaultValue':null},'callbackat':{'type':Sequelize[_0xf59c('0x4')]},'recallme':{'type':Sequelize[_0xf59c('0x5')],'defaultValue':![]},'editedat':{'type':Sequelize[_0xf59c('0x4')]},'edited':{'type':Sequelize[_0xf59c('0x5')],'defaultValue':![]},'countnosuchnumberretry':{'type':Sequelize[_0xf59c('0x2')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0xf59c('0x2')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0xf59c('0x2')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0xf59c('0x2')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0xf59c('0x2')],'defaultValue':0x0},'dialTimezone':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.controller.js b/server/api/cmHopperHistory/cmHopperHistory.controller.js index 2b52bb2..362d820 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 _0xb6b6=['find','create','describe','body','uniqueid','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','lodash','jsforce','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','count','offset','limit','json','apply','update','then','destroy','error','stack','name','send','index','map','CmHopperHistory','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','rows','catch','params','keys'];(function(_0x257855,_0x41ec3c){var _0x393025=function(_0x5acc0d){while(--_0x5acc0d){_0x257855['push'](_0x257855['shift']());}};_0x393025(++_0x41ec3c);}(_0xb6b6,0x1b5));var _0x6b6b=function(_0x4b055c,_0x4b870b){_0x4b055c=_0x4b055c-0x0;var _0x4b62bb=_0xb6b6[_0x4b055c];return _0x4b62bb;};'use strict';var pdf=require(_0x6b6b('0x0'));var emlformat=require(_0x6b6b('0x1'));var rimraf=require(_0x6b6b('0x2'));var zipdir=require(_0x6b6b('0x3'));var jsonpatch=require(_0x6b6b('0x4'));var rp=require(_0x6b6b('0x5'));var moment=require(_0x6b6b('0x6'));var BPromise=require(_0x6b6b('0x7'));var Mustache=require(_0x6b6b('0x8'));var util=require(_0x6b6b('0x9'));var path=require(_0x6b6b('0xa'));var sox=require('sox');var csv=require(_0x6b6b('0xb'));var ejs=require(_0x6b6b('0xc'));var fs=require('fs');var _=require(_0x6b6b('0xd'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x6b6b('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x6b6b('0xf'));var Papa=require('papaparse');var Redis=require(_0x6b6b('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x6b6b('0x11'));var as=require(_0x6b6b('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x6b6b('0x13'))('api');var utils=require(_0x6b6b('0x14'));var config=require(_0x6b6b('0x15'));var db=require(_0x6b6b('0x16'))['db'];function respondWithStatusCode(_0x1744e0,_0x6766b){_0x6766b=_0x6766b||0xcc;return function(_0xd93007){if(_0xd93007){return _0x1744e0[_0x6b6b('0x17')](_0x6766b);}return _0x1744e0[_0x6b6b('0x18')](_0x6766b)[_0x6b6b('0x19')]();};}function respondWithResult(_0x34365d,_0x2c35af){_0x2c35af=_0x2c35af||0xc8;return function(_0x3a0dca){if(_0x3a0dca){return _0x34365d[_0x6b6b('0x18')](_0x2c35af)['json'](_0x3a0dca);}};}function respondWithFilteredResult(_0xca274,_0x1b1a4e){return function(_0x2a0e92){if(_0x2a0e92){var _0x38c15c=_0x2a0e92[_0x6b6b('0x1a')],_0x29bf20=_0x1b1a4e[_0x6b6b('0x1b')],_0x5a745a=_0x1b1a4e[_0x6b6b('0x1b')]+_0x1b1a4e[_0x6b6b('0x1c')],_0x173208;if(_0x5a745a>=_0x38c15c){_0x5a745a=_0x38c15c;_0x173208=0xc8;}else{_0x173208=0xce;}_0xca274['status'](_0x173208);return _0xca274['set']('Content-Range',_0x29bf20+'-'+_0x5a745a+'/'+_0x38c15c)[_0x6b6b('0x1d')](_0x2a0e92);}return null;};}function patchUpdates(_0x38978e){return function(_0x3bbaa0){try{jsonpatch[_0x6b6b('0x1e')](_0x3bbaa0,_0x38978e,!![]);}catch(_0x4de08f){return BPromise['reject'](_0x4de08f);}return _0x3bbaa0['save']();};}function saveUpdates(_0x1edbd7,_0x586776){return function(_0x432785){if(_0x432785){return _0x432785[_0x6b6b('0x1f')](_0x1edbd7)[_0x6b6b('0x20')](function(_0x1a6e78){return _0x1a6e78;});}return null;};}function removeEntity(_0x3d528e,_0x3b523f){return function(_0x458468){if(_0x458468){return _0x458468[_0x6b6b('0x21')]()[_0x6b6b('0x20')](function(){_0x3d528e[_0x6b6b('0x18')](0xcc)[_0x6b6b('0x19')]();});}};}function handleEntityNotFound(_0x20120e,_0x206a62){return function(_0x43a81b){if(!_0x43a81b){_0x20120e['sendStatus'](0x194);}return _0x43a81b;};}function handleError(_0x401914,_0x36ba4b){_0x36ba4b=_0x36ba4b||0x1f4;return function(_0x35be7e){logger[_0x6b6b('0x22')](_0x35be7e[_0x6b6b('0x23')]);if(_0x35be7e[_0x6b6b('0x24')]){delete _0x35be7e[_0x6b6b('0x24')];}_0x401914[_0x6b6b('0x18')](_0x36ba4b)[_0x6b6b('0x25')](_0x35be7e);};}exports[_0x6b6b('0x26')]=function(_0x3395d3,_0x1fd6c1){var _0x2aab53={},_0x305eb9={},_0x29c613={'count':0x0,'rows':[]};var _0x40022b=_[_0x6b6b('0x27')](db[_0x6b6b('0x28')][_0x6b6b('0x29')],function(_0x54a30a){return{'name':_0x54a30a[_0x6b6b('0x2a')],'type':_0x54a30a[_0x6b6b('0x2b')][_0x6b6b('0x2c')]};});_0x305eb9[_0x6b6b('0x2d')]=_['map'](_0x40022b,_0x6b6b('0x24'));_0x305eb9[_0x6b6b('0x2e')]=_['keys'](_0x3395d3['query']);_0x305eb9[_0x6b6b('0x2f')]=_[_0x6b6b('0x30')](_0x305eb9[_0x6b6b('0x2d')],_0x305eb9['query']);_0x2aab53[_0x6b6b('0x31')]=_['intersection'](_0x305eb9['model'],qs[_0x6b6b('0x32')](_0x3395d3[_0x6b6b('0x2e')]['fields']));_0x2aab53[_0x6b6b('0x31')]=_0x2aab53[_0x6b6b('0x31')][_0x6b6b('0x33')]?_0x2aab53[_0x6b6b('0x31')]:_0x305eb9[_0x6b6b('0x2d')];if(!_0x3395d3['query']['hasOwnProperty'](_0x6b6b('0x34'))){_0x2aab53[_0x6b6b('0x1c')]=qs[_0x6b6b('0x1c')](_0x3395d3[_0x6b6b('0x2e')][_0x6b6b('0x1c')]);_0x2aab53[_0x6b6b('0x1b')]=qs[_0x6b6b('0x1b')](_0x3395d3[_0x6b6b('0x2e')]['offset']);}_0x2aab53[_0x6b6b('0x35')]=qs[_0x6b6b('0x36')](_0x3395d3[_0x6b6b('0x2e')][_0x6b6b('0x36')]);_0x2aab53[_0x6b6b('0x37')]=qs[_0x6b6b('0x2f')](_[_0x6b6b('0x38')](_0x3395d3['query'],_0x305eb9[_0x6b6b('0x2f')]),_0x40022b);if(_0x3395d3[_0x6b6b('0x2e')][_0x6b6b('0x39')]){_0x2aab53[_0x6b6b('0x37')]=_[_0x6b6b('0x3a')](_0x2aab53[_0x6b6b('0x37')],{'$or':_['map'](_0x40022b,function(_0x38c69c){if(_0x38c69c[_0x6b6b('0x2b')]!==_0x6b6b('0x3b')){var _0x2f39ef={};_0x2f39ef[_0x38c69c[_0x6b6b('0x24')]]={'$like':'%'+_0x3395d3[_0x6b6b('0x2e')][_0x6b6b('0x39')]+'%'};return _0x2f39ef;}})});}_0x2aab53=_[_0x6b6b('0x3a')]({},_0x2aab53,_0x3395d3['options']);var _0x27e6d4={'where':_0x2aab53[_0x6b6b('0x37')]};return db[_0x6b6b('0x28')][_0x6b6b('0x1a')](_0x27e6d4)[_0x6b6b('0x20')](function(_0x2ff6ae){_0x29c613[_0x6b6b('0x1a')]=_0x2ff6ae;if(_0x3395d3[_0x6b6b('0x2e')][_0x6b6b('0x3c')]){_0x2aab53[_0x6b6b('0x3d')]=[{'all':!![]}];}return db[_0x6b6b('0x28')][_0x6b6b('0x3e')](_0x2aab53);})[_0x6b6b('0x20')](function(_0x28edf8){_0x29c613[_0x6b6b('0x3f')]=_0x28edf8;return _0x29c613;})['then'](respondWithFilteredResult(_0x1fd6c1,_0x2aab53))[_0x6b6b('0x40')](handleError(_0x1fd6c1,null));};exports['show']=function(_0x22070e,_0x2ebd39){var _0xa20963={'raw':!![],'where':{'id':_0x22070e[_0x6b6b('0x41')]['id']}},_0x1e6927={};_0x1e6927[_0x6b6b('0x2d')]=_[_0x6b6b('0x42')](db[_0x6b6b('0x28')]['rawAttributes']);_0x1e6927[_0x6b6b('0x2e')]=_[_0x6b6b('0x42')](_0x22070e[_0x6b6b('0x2e')]);_0x1e6927[_0x6b6b('0x2f')]=_[_0x6b6b('0x30')](_0x1e6927['model'],_0x1e6927[_0x6b6b('0x2e')]);_0xa20963[_0x6b6b('0x31')]=_[_0x6b6b('0x30')](_0x1e6927[_0x6b6b('0x2d')],qs[_0x6b6b('0x32')](_0x22070e['query'][_0x6b6b('0x32')]));_0xa20963['attributes']=_0xa20963[_0x6b6b('0x31')][_0x6b6b('0x33')]?_0xa20963[_0x6b6b('0x31')]:_0x1e6927[_0x6b6b('0x2d')];if(_0x22070e[_0x6b6b('0x2e')][_0x6b6b('0x3c')]){_0xa20963[_0x6b6b('0x3d')]=[{'all':!![]}];}_0xa20963=_['merge']({},_0xa20963,_0x22070e['options']);return db[_0x6b6b('0x28')][_0x6b6b('0x43')](_0xa20963)[_0x6b6b('0x20')](handleEntityNotFound(_0x2ebd39,null))[_0x6b6b('0x20')](respondWithResult(_0x2ebd39,null))['catch'](handleError(_0x2ebd39,null));};exports[_0x6b6b('0x44')]=function(_0x309cfc,_0x94609a){return db['CmHopperHistory'][_0x6b6b('0x44')](_0x309cfc['body'],{})['then'](respondWithResult(_0x94609a,0xc9))[_0x6b6b('0x40')](handleError(_0x94609a,null));};exports[_0x6b6b('0x45')]=function(_0xdeeb33,_0x3385a3){return db['CmHopperHistory']['describe']()[_0x6b6b('0x20')](respondWithResult(_0x3385a3,null))[_0x6b6b('0x40')](handleError(_0x3385a3,null));};exports[_0x6b6b('0x1f')]=function(_0x417743,_0x469e22){if(_0x417743[_0x6b6b('0x46')][_0x6b6b('0x47')]){delete _0x417743[_0x6b6b('0x46')][_0x6b6b('0x47')];}return db[_0x6b6b('0x28')][_0x6b6b('0x43')]({'where':{'uniqueid':_0x417743[_0x6b6b('0x41')]['id']}})[_0x6b6b('0x20')](handleEntityNotFound(_0x469e22,null))['then'](saveUpdates(_0x417743[_0x6b6b('0x46')],null))[_0x6b6b('0x20')](respondWithResult(_0x469e22,null))[_0x6b6b('0x40')](handleError(_0x469e22,null));}; \ No newline at end of file +var _0xd56f=['path','sox','ejs','lodash','squel','crypto','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','json','offset','reject','then','destroy','end','error','stack','name','index','map','CmHopperHistory','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','merge','VIRTUAL','options','count','findAll','catch','show','includeAll','find','create','body','describe','update','uniqueid','html-pdf','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache'];(function(_0x458c52,_0x5e3fb4){var _0x43f43b=function(_0x5cdfeb){while(--_0x5cdfeb){_0x458c52['push'](_0x458c52['shift']());}};_0x43f43b(++_0x5e3fb4);}(_0xd56f,0x161));var _0xfd56=function(_0x47242d,_0x13f993){_0x47242d=_0x47242d-0x0;var _0x30273a=_0xd56f[_0x47242d];return _0x30273a;};'use strict';var pdf=require(_0xfd56('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xfd56('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xfd56('0x2'));var rp=require(_0xfd56('0x3'));var moment=require(_0xfd56('0x4'));var BPromise=require(_0xfd56('0x5'));var Mustache=require(_0xfd56('0x6'));var util=require('util');var path=require(_0xfd56('0x7'));var sox=require(_0xfd56('0x8'));var csv=require('to-csv');var ejs=require(_0xfd56('0x9'));var fs=require('fs');var _=require(_0xfd56('0xa'));var squel=require(_0xfd56('0xb'));var crypto=require(_0xfd56('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xfd56('0xd'));var toCsv=require(_0xfd56('0xe'));var querystring=require(_0xfd56('0xf'));var Papa=require(_0xfd56('0x10'));var Redis=require(_0xfd56('0x11'));var authService=require('../../components/auth/service');var qs=require(_0xfd56('0x12'));var as=require(_0xfd56('0x13'));var hardwareService=require(_0xfd56('0x14'));var logger=require(_0xfd56('0x15'))(_0xfd56('0x16'));var utils=require(_0xfd56('0x17'));var config=require(_0xfd56('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4218aa,_0x217852){_0x217852=_0x217852||0xcc;return function(_0x211164){if(_0x211164){return _0x4218aa[_0xfd56('0x19')](_0x217852);}return _0x4218aa[_0xfd56('0x1a')](_0x217852)['end']();};}function respondWithResult(_0x3b72c0,_0x3d8ae1){_0x3d8ae1=_0x3d8ae1||0xc8;return function(_0x1f5bc4){if(_0x1f5bc4){return _0x3b72c0['status'](_0x3d8ae1)[_0xfd56('0x1b')](_0x1f5bc4);}};}function respondWithFilteredResult(_0x1fb205,_0x498ff6){return function(_0x5ad6d6){if(_0x5ad6d6){var _0x16054b=_0x5ad6d6['count'],_0xd28c5f=_0x498ff6[_0xfd56('0x1c')],_0x378b2b=_0x498ff6['offset']+_0x498ff6['limit'],_0x4dcb2e;if(_0x378b2b>=_0x16054b){_0x378b2b=_0x16054b;_0x4dcb2e=0xc8;}else{_0x4dcb2e=0xce;}_0x1fb205['status'](_0x4dcb2e);return _0x1fb205['set']('Content-Range',_0xd28c5f+'-'+_0x378b2b+'/'+_0x16054b)[_0xfd56('0x1b')](_0x5ad6d6);}return null;};}function patchUpdates(_0x5470e8){return function(_0x50fa07){try{jsonpatch['apply'](_0x50fa07,_0x5470e8,!![]);}catch(_0x439003){return BPromise[_0xfd56('0x1d')](_0x439003);}return _0x50fa07['save']();};}function saveUpdates(_0x46fede,_0xcb695d){return function(_0x4e4cbd){if(_0x4e4cbd){return _0x4e4cbd['update'](_0x46fede)[_0xfd56('0x1e')](function(_0x220992){return _0x220992;});}return null;};}function removeEntity(_0x5f20f4,_0x50b076){return function(_0x2240b8){if(_0x2240b8){return _0x2240b8[_0xfd56('0x1f')]()[_0xfd56('0x1e')](function(){_0x5f20f4['status'](0xcc)[_0xfd56('0x20')]();});}};}function handleEntityNotFound(_0x1bdc61,_0x58b6f0){return function(_0x5b0729){if(!_0x5b0729){_0x1bdc61[_0xfd56('0x19')](0x194);}return _0x5b0729;};}function handleError(_0x534323,_0x7f92cf){_0x7f92cf=_0x7f92cf||0x1f4;return function(_0x32a08b){logger[_0xfd56('0x21')](_0x32a08b[_0xfd56('0x22')]);if(_0x32a08b[_0xfd56('0x23')]){delete _0x32a08b[_0xfd56('0x23')];}_0x534323[_0xfd56('0x1a')](_0x7f92cf)['send'](_0x32a08b);};}exports[_0xfd56('0x24')]=function(_0x3acaa0,_0x34b2e9){var _0x3111e2={},_0x49edca={},_0xfce12={'count':0x0,'rows':[]};var _0x370e64=_[_0xfd56('0x25')](db[_0xfd56('0x26')][_0xfd56('0x27')],function(_0x3bc01e){return{'name':_0x3bc01e[_0xfd56('0x28')],'type':_0x3bc01e[_0xfd56('0x29')][_0xfd56('0x2a')]};});_0x49edca[_0xfd56('0x2b')]=_[_0xfd56('0x25')](_0x370e64,_0xfd56('0x23'));_0x49edca[_0xfd56('0x2c')]=_[_0xfd56('0x2d')](_0x3acaa0[_0xfd56('0x2c')]);_0x49edca[_0xfd56('0x2e')]=_[_0xfd56('0x2f')](_0x49edca[_0xfd56('0x2b')],_0x49edca[_0xfd56('0x2c')]);_0x3111e2[_0xfd56('0x30')]=_[_0xfd56('0x2f')](_0x49edca[_0xfd56('0x2b')],qs[_0xfd56('0x31')](_0x3acaa0['query'][_0xfd56('0x31')]));_0x3111e2[_0xfd56('0x30')]=_0x3111e2[_0xfd56('0x30')]['length']?_0x3111e2[_0xfd56('0x30')]:_0x49edca[_0xfd56('0x2b')];if(!_0x3acaa0[_0xfd56('0x2c')][_0xfd56('0x32')](_0xfd56('0x33'))){_0x3111e2[_0xfd56('0x34')]=qs['limit'](_0x3acaa0['query'][_0xfd56('0x34')]);_0x3111e2[_0xfd56('0x1c')]=qs[_0xfd56('0x1c')](_0x3acaa0[_0xfd56('0x2c')][_0xfd56('0x1c')]);}_0x3111e2[_0xfd56('0x35')]=qs[_0xfd56('0x36')](_0x3acaa0['query']['sort']);_0x3111e2[_0xfd56('0x37')]=qs['filters'](_[_0xfd56('0x38')](_0x3acaa0['query'],_0x49edca[_0xfd56('0x2e')]),_0x370e64);if(_0x3acaa0[_0xfd56('0x2c')][_0xfd56('0x39')]){_0x3111e2['where']=_[_0xfd56('0x3a')](_0x3111e2[_0xfd56('0x37')],{'$or':_[_0xfd56('0x25')](_0x370e64,function(_0x4c6a5f){if(_0x4c6a5f[_0xfd56('0x29')]!==_0xfd56('0x3b')){var _0x4a9dac={};_0x4a9dac[_0x4c6a5f['name']]={'$like':'%'+_0x3acaa0[_0xfd56('0x2c')][_0xfd56('0x39')]+'%'};return _0x4a9dac;}})});}_0x3111e2=_[_0xfd56('0x3a')]({},_0x3111e2,_0x3acaa0[_0xfd56('0x3c')]);var _0x1603d8={'where':_0x3111e2[_0xfd56('0x37')]};return db['CmHopperHistory'][_0xfd56('0x3d')](_0x1603d8)[_0xfd56('0x1e')](function(_0x240cba){_0xfce12[_0xfd56('0x3d')]=_0x240cba;if(_0x3acaa0[_0xfd56('0x2c')]['includeAll']){_0x3111e2['include']=[{'all':!![]}];}return db[_0xfd56('0x26')][_0xfd56('0x3e')](_0x3111e2);})[_0xfd56('0x1e')](function(_0x50ed59){_0xfce12['rows']=_0x50ed59;return _0xfce12;})['then'](respondWithFilteredResult(_0x34b2e9,_0x3111e2))[_0xfd56('0x3f')](handleError(_0x34b2e9,null));};exports[_0xfd56('0x40')]=function(_0x19d19b,_0x23f236){var _0xa623c7={'raw':!![],'where':{'id':_0x19d19b['params']['id']}},_0x2a3a3c={};_0x2a3a3c[_0xfd56('0x2b')]=_[_0xfd56('0x2d')](db[_0xfd56('0x26')][_0xfd56('0x27')]);_0x2a3a3c[_0xfd56('0x2c')]=_[_0xfd56('0x2d')](_0x19d19b[_0xfd56('0x2c')]);_0x2a3a3c['filters']=_['intersection'](_0x2a3a3c[_0xfd56('0x2b')],_0x2a3a3c[_0xfd56('0x2c')]);_0xa623c7[_0xfd56('0x30')]=_['intersection'](_0x2a3a3c[_0xfd56('0x2b')],qs[_0xfd56('0x31')](_0x19d19b[_0xfd56('0x2c')][_0xfd56('0x31')]));_0xa623c7[_0xfd56('0x30')]=_0xa623c7['attributes']['length']?_0xa623c7[_0xfd56('0x30')]:_0x2a3a3c[_0xfd56('0x2b')];if(_0x19d19b[_0xfd56('0x2c')][_0xfd56('0x41')]){_0xa623c7['include']=[{'all':!![]}];}_0xa623c7=_[_0xfd56('0x3a')]({},_0xa623c7,_0x19d19b[_0xfd56('0x3c')]);return db[_0xfd56('0x26')][_0xfd56('0x42')](_0xa623c7)['then'](handleEntityNotFound(_0x23f236,null))[_0xfd56('0x1e')](respondWithResult(_0x23f236,null))[_0xfd56('0x3f')](handleError(_0x23f236,null));};exports[_0xfd56('0x43')]=function(_0x90b1b0,_0x1a9ebe){return db['CmHopperHistory'][_0xfd56('0x43')](_0x90b1b0[_0xfd56('0x44')],{})[_0xfd56('0x1e')](respondWithResult(_0x1a9ebe,0xc9))[_0xfd56('0x3f')](handleError(_0x1a9ebe,null));};exports[_0xfd56('0x45')]=function(_0x5f3229,_0x1eefe5){return db[_0xfd56('0x26')][_0xfd56('0x45')]()['then'](respondWithResult(_0x1eefe5,null))[_0xfd56('0x3f')](handleError(_0x1eefe5,null));};exports[_0xfd56('0x46')]=function(_0x57f735,_0x5aa0ab){if(_0x57f735['body'][_0xfd56('0x47')]){delete _0x57f735['body']['uniqueid'];}return db[_0xfd56('0x26')][_0xfd56('0x42')]({'where':{'uniqueid':_0x57f735['params']['id']}})[_0xfd56('0x1e')](handleEntityNotFound(_0x5aa0ab,null))['then'](saveUpdates(_0x57f735[_0xfd56('0x44')],null))[_0xfd56('0x1e')](respondWithResult(_0x5aa0ab,null))[_0xfd56('0x3f')](handleError(_0x5aa0ab,null));}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.model.js b/server/api/cmHopperHistory/cmHopperHistory.model.js index 350f86c..25539c3 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 _0xe855=['request-promise','./cmHopperHistory.attributes','exports','define','CmHopperHistory','endtime','uniqueid','lodash','util','api','bluebird'];(function(_0x40fcc0,_0x4c9766){var _0x5004cb=function(_0x3d8b8e){while(--_0x3d8b8e){_0x40fcc0['push'](_0x40fcc0['shift']());}};_0x5004cb(++_0x4c9766);}(_0xe855,0x130));var _0x5e85=function(_0x5aae53,_0x33c6d4){_0x5aae53=_0x5aae53-0x0;var _0x11a64d=_0xe855[_0x5aae53];return _0x11a64d;};'use strict';var _=require(_0x5e85('0x0'));var util=require(_0x5e85('0x1'));var logger=require('../../config/logger')(_0x5e85('0x2'));var moment=require('moment');var BPromise=require(_0x5e85('0x3'));var rp=require(_0x5e85('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x5e85('0x5'));module[_0x5e85('0x6')]=function(_0x5a732b,_0x531c84){return _0x5a732b[_0x5e85('0x7')](_0x5e85('0x8'),attributes,{'tableName':'cm_hopper_history','paranoid':![],'indexes':[{'name':_0x5e85('0x9'),'fields':[_0x5e85('0x9')]},{'name':_0x5e85('0xa'),'fields':[_0x5e85('0xa')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x13ca=['uniqueid','lodash','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','endtime'];(function(_0x3fd64f,_0x57c478){var _0x2d1ca2=function(_0x28e5ff){while(--_0x28e5ff){_0x3fd64f['push'](_0x3fd64f['shift']());}};_0x2d1ca2(++_0x57c478);}(_0x13ca,0x9d));var _0xa13c=function(_0x95c262,_0x2843cd){_0x95c262=_0x95c262-0x0;var _0x2dc3cb=_0x13ca[_0x95c262];return _0x2dc3cb;};'use strict';var _=require(_0xa13c('0x0'));var util=require(_0xa13c('0x1'));var logger=require('../../config/logger')(_0xa13c('0x2'));var moment=require(_0xa13c('0x3'));var BPromise=require(_0xa13c('0x4'));var rp=require(_0xa13c('0x5'));var fs=require('fs');var path=require(_0xa13c('0x6'));var rimraf=require(_0xa13c('0x7'));var config=require(_0xa13c('0x8'));var attributes=require('./cmHopperHistory.attributes');module[_0xa13c('0x9')]=function(_0x2b5f11,_0x43756f){return _0x2b5f11[_0xa13c('0xa')]('CmHopperHistory',attributes,{'tableName':'cm_hopper_history','paranoid':![],'indexes':[{'name':_0xa13c('0xb'),'fields':[_0xa13c('0xb')]},{'name':_0xa13c('0xc'),'fields':[_0xa13c('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.rpc.js b/server/api/cmHopperHistory/cmHopperHistory.rpc.js index 1c2273d..af178ae 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 _0xda3f=['COUNT','sequelize','col','predictiveIntervalTotalCalls','literal','`state`\x20=\x204,\x201,\x20null','predictiveIntervalAnsweredCalls','`state`\x20=\x2011,\x201,\x20null','predictiveIntervalDroppedCallsCallersExit','AVG','`state`\x20=\x204,\x20`holdtime`,\x20null','predictiveIntervalAvgHoldtime','GetVoiceQueueHopperHistory','findAll','name','`state`\x20=\x200,\x201,\x20null','outboundNoSuchCallsDay','`state`\x20=\x203,\x201,\x20null','outboundNoAnswerCallsDay','outboundAnswerCallsDay','outboundBusyCallsDay','`state`\x20=\x208,\x201,\x20null','outboundCongestionCallsDay','`state`\x20=\x2011\x20,\x201,\x20null','outboundDropCallsDayCallersExit','`state`\x20=\x2012,\x201,\x20null','outboundUnknownCallsDay','`state`\x20=\x2013,\x201,\x20null','outboundBlacklistCallsDay','outboundOriginateFailureCallsDay','`state`\x20=\x2018,\x201,\x20null','outboundRejectCallsDay','outboundAnswerAgiCallsDay','`state`\x20=\x2020,\x201,\x20null','`state`\x20=\x2022\x20or\x20`state`\x20=\x2023,\x201,\x20null','campaign','GetCampaignHopperHistory','ivrTotalCallsDays','util','moment','../../mysqldb','../../config/logger','rpc','jayson/promise','client','request','then','info','CmHopperHistory,\x20%s,\x20%s','request\x20sent','debug','CmHopperHistory,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateCmHopperHistory','CmHopperHistory','create','body','options','raw','AvgHandleTime','where'];(function(_0x10b757,_0x3cf7ca){var _0x5fffd2=function(_0xd83dbc){while(--_0xd83dbc){_0x10b757['push'](_0x10b757['shift']());}};_0x5fffd2(++_0x3cf7ca);}(_0xda3f,0xec));var _0xfda3=function(_0x30f8cd,_0x359d9a){_0x30f8cd=_0x30f8cd-0x0;var _0x159537=_0xda3f[_0x30f8cd];return _0x159537;};'use strict';var _=require('lodash');var util=require(_0xfda3('0x0'));var moment=require(_0xfda3('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xfda3('0x2'))['db'];var utils=require('../../config/utils');var logger=require(_0xfda3('0x3'))(_0xfda3('0x4'));var config=require('../../config/environment');var jayson=require(_0xfda3('0x5'));var client=jayson[_0xfda3('0x6')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4e72d1,_0x316792,_0x42476a){return new BPromise(function(_0x125e2a,_0x4018c0){return client[_0xfda3('0x7')](_0x4e72d1,_0x42476a)[_0xfda3('0x8')](function(_0x46655c){logger[_0xfda3('0x9')](_0xfda3('0xa'),_0x316792,_0xfda3('0xb'));logger[_0xfda3('0xc')](_0xfda3('0xd'),_0x316792,'request\x20sent',JSON[_0xfda3('0xe')](_0x46655c));if(_0x46655c[_0xfda3('0xf')]){if(_0x46655c[_0xfda3('0xf')][_0xfda3('0x10')]===0x1f4){logger[_0xfda3('0xf')]('CmHopperHistory,\x20%s,\x20%s',_0x316792,_0x46655c[_0xfda3('0xf')]['message']);return _0x4018c0(_0x46655c[_0xfda3('0xf')][_0xfda3('0x11')]);}logger['error']('CmHopperHistory,\x20%s,\x20%s',_0x316792,_0x46655c['error'][_0xfda3('0x11')]);return _0x125e2a(_0x46655c[_0xfda3('0xf')]['message']);}else{logger['info']('CmHopperHistory,\x20%s,\x20%s',_0x316792,_0xfda3('0xb'));_0x125e2a(_0x46655c[_0xfda3('0x12')][_0xfda3('0x11')]);}})[_0xfda3('0x13')](function(_0x34900d){logger[_0xfda3('0xf')](_0xfda3('0xa'),_0x316792,_0x34900d);_0x4018c0(_0x34900d);});});}exports[_0xfda3('0x14')]=function(_0x4680bf){var _0xc62ae6=this;return new Promise(function(_0x54a7c6,_0x15ddb9){return db[_0xfda3('0x15')][_0xfda3('0x16')](_0x4680bf[_0xfda3('0x17')],{'raw':_0x4680bf['options']?_0x4680bf[_0xfda3('0x18')][_0xfda3('0x19')]===undefined?!![]:![]:!![]})[_0xfda3('0x8')](function(_0x51e731){logger['info'](_0xfda3('0x14'),_0x4680bf);logger[_0xfda3('0xc')](_0xfda3('0x14'),_0x4680bf,JSON['stringify'](_0x51e731));_0x54a7c6(_0x51e731);})[_0xfda3('0x13')](function(_0xef2535){logger[_0xfda3('0xf')](_0xfda3('0x14'),_0xef2535[_0xfda3('0x11')],_0x4680bf);_0x15ddb9(_0xc62ae6[_0xfda3('0xf')](0x1f4,_0xef2535[_0xfda3('0x11')]));});});};exports[_0xfda3('0x1a')]=function(_0x16eaa6){var _0x5499f5=this;return new Promise(function(_0x82341b,_0x2d5b44){return db[_0xfda3('0x15')]['findAll']({'raw':_0x16eaa6[_0xfda3('0x18')]?_0x16eaa6[_0xfda3('0x18')][_0xfda3('0x19')]===undefined?!![]:![]:!![],'where':_0x16eaa6[_0xfda3('0x18')]?_0x16eaa6[_0xfda3('0x18')][_0xfda3('0x1b')]||null:null,'attributes':[[db['sequelize']['fn'](_0xfda3('0x1c'),db[_0xfda3('0x1d')][_0xfda3('0x1e')]('id')),_0xfda3('0x1f')],[db[_0xfda3('0x1d')]['fn']('COUNT',db[_0xfda3('0x1d')]['fn']('IF',db[_0xfda3('0x1d')][_0xfda3('0x20')](_0xfda3('0x21')))),_0xfda3('0x22')],[db[_0xfda3('0x1d')]['fn'](_0xfda3('0x1c'),db['sequelize']['fn']('IF',db['sequelize'][_0xfda3('0x20')]('`state`\x20=\x2010,\x201,\x20null'))),'predictiveIntervalDroppedCallsTimeout'],[db[_0xfda3('0x1d')]['fn'](_0xfda3('0x1c'),db[_0xfda3('0x1d')]['fn']('IF',db[_0xfda3('0x1d')][_0xfda3('0x20')](_0xfda3('0x23')))),_0xfda3('0x24')],[db[_0xfda3('0x1d')]['fn'](_0xfda3('0x25'),db['sequelize']['fn']('IF',db[_0xfda3('0x1d')][_0xfda3('0x20')](_0xfda3('0x26')))),_0xfda3('0x27')],[db[_0xfda3('0x1d')]['fn'](_0xfda3('0x25'),db[_0xfda3('0x1d')]['fn']('IF',db[_0xfda3('0x1d')][_0xfda3('0x20')]('`state`\x20=\x204,\x20`talktime`,\x20null'))),'predictiveIntervalAvgTalktime']]})[_0xfda3('0x8')](function(_0x17cccb){logger['info'](_0xfda3('0x1a'),_0x16eaa6);logger[_0xfda3('0xc')](_0xfda3('0x1a'),_0x16eaa6,JSON['stringify'](_0x17cccb));_0x82341b(_0x17cccb);})[_0xfda3('0x13')](function(_0x378bf0){logger[_0xfda3('0xf')](_0xfda3('0x1a'),_0x378bf0[_0xfda3('0x11')],_0x16eaa6);_0x2d5b44(_0x5499f5['error'](0x1f4,_0x378bf0[_0xfda3('0x11')]));});});};exports[_0xfda3('0x28')]=function(_0x33bdfb){var _0x56bed2=this;return new Promise(function(_0x373c96,_0x4854b1){return db[_0xfda3('0x15')][_0xfda3('0x29')]({'raw':_0x33bdfb[_0xfda3('0x18')]?_0x33bdfb[_0xfda3('0x18')][_0xfda3('0x19')]===undefined?!![]:![]:!![],'where':_0x33bdfb[_0xfda3('0x18')]?_0x33bdfb[_0xfda3('0x18')][_0xfda3('0x1b')]||null:null,'attributes':[['campaign',_0xfda3('0x2a')],[db[_0xfda3('0x1d')]['fn'](_0xfda3('0x1c'),db[_0xfda3('0x1d')]['fn']('IF',db['sequelize'][_0xfda3('0x20')](_0xfda3('0x2b')))),_0xfda3('0x2c')],[db['sequelize']['fn']('COUNT',db[_0xfda3('0x1d')]['fn']('IF',db[_0xfda3('0x1d')][_0xfda3('0x20')](_0xfda3('0x2d')))),_0xfda3('0x2e')],[db[_0xfda3('0x1d')]['fn'](_0xfda3('0x1c'),db[_0xfda3('0x1d')]['fn']('IF',db[_0xfda3('0x1d')][_0xfda3('0x20')]('`state`\x20=\x204,\x201,\x20null'))),_0xfda3('0x2f')],[db[_0xfda3('0x1d')]['fn']('COUNT',db[_0xfda3('0x1d')]['fn']('IF',db['sequelize']['literal']('`state`\x20=\x205,\x201,\x20null'))),_0xfda3('0x30')],[db[_0xfda3('0x1d')]['fn'](_0xfda3('0x1c'),db[_0xfda3('0x1d')]['fn']('IF',db['sequelize'][_0xfda3('0x20')](_0xfda3('0x31')))),_0xfda3('0x32')],[db[_0xfda3('0x1d')]['fn']('COUNT',db[_0xfda3('0x1d')]['fn']('IF',db[_0xfda3('0x1d')][_0xfda3('0x20')]('`state`\x20=\x2010\x20,\x201,\x20null'))),'outboundDropCallsDayTimeout'],[db[_0xfda3('0x1d')]['fn'](_0xfda3('0x1c'),db[_0xfda3('0x1d')]['fn']('IF',db[_0xfda3('0x1d')][_0xfda3('0x20')](_0xfda3('0x33')))),_0xfda3('0x34')],[db[_0xfda3('0x1d')]['fn'](_0xfda3('0x1c'),db[_0xfda3('0x1d')]['fn']('IF',db[_0xfda3('0x1d')][_0xfda3('0x20')](_0xfda3('0x35')))),_0xfda3('0x36')],[db['sequelize']['fn']('COUNT',db[_0xfda3('0x1d')]['fn']('IF',db[_0xfda3('0x1d')][_0xfda3('0x20')](_0xfda3('0x37')))),_0xfda3('0x38')],[db[_0xfda3('0x1d')]['fn'](_0xfda3('0x1c'),db[_0xfda3('0x1d')]['fn']('IF',db[_0xfda3('0x1d')][_0xfda3('0x20')]('`state`\x20=\x2014,\x201,\x20null'))),_0xfda3('0x39')],[db[_0xfda3('0x1d')]['fn'](_0xfda3('0x1c'),db[_0xfda3('0x1d')]['fn']('IF',db[_0xfda3('0x1d')]['literal'](_0xfda3('0x3a')))),_0xfda3('0x3b')],[db[_0xfda3('0x1d')]['fn']('COUNT',db[_0xfda3('0x1d')]['fn']('IF',db[_0xfda3('0x1d')][_0xfda3('0x20')]('`state`\x20=\x2016,\x201,\x20null'))),_0xfda3('0x3c')],[db[_0xfda3('0x1d')]['fn'](_0xfda3('0x1c'),db[_0xfda3('0x1d')]['fn']('IF',db[_0xfda3('0x1d')]['literal'](_0xfda3('0x3d')))),'outboundRejectCallsDay'],[db[_0xfda3('0x1d')]['fn']('COUNT',db[_0xfda3('0x1d')]['fn']('IF',db[_0xfda3('0x1d')][_0xfda3('0x20')](_0xfda3('0x3e')))),'outboundReCallsDay']],'group':[_0xfda3('0x3f')]})[_0xfda3('0x8')](function(_0x2f2c32){logger[_0xfda3('0x9')](_0xfda3('0x28'),_0x33bdfb);logger[_0xfda3('0xc')](_0xfda3('0x28'),_0x33bdfb,JSON['stringify'](_0x2f2c32));_0x373c96(_0x2f2c32);})['catch'](function(_0x4fb214){logger[_0xfda3('0xf')](_0xfda3('0x28'),_0x4fb214['message'],_0x33bdfb);_0x4854b1(_0x56bed2['error'](0x1f4,_0x4fb214[_0xfda3('0x11')]));});});};exports[_0xfda3('0x40')]=function(_0x10ee1b){var _0x421e02=this;return new Promise(function(_0x2fcbe7,_0x4bc976){return db[_0xfda3('0x15')][_0xfda3('0x29')]({'raw':_0x10ee1b[_0xfda3('0x18')]?_0x10ee1b[_0xfda3('0x18')][_0xfda3('0x19')]===undefined?!![]:![]:!![],'where':_0x10ee1b[_0xfda3('0x18')]?_0x10ee1b[_0xfda3('0x18')][_0xfda3('0x1b')]||null:null,'attributes':[[_0xfda3('0x3f'),_0xfda3('0x2a')],[db[_0xfda3('0x1d')]['fn'](_0xfda3('0x1c'),db['sequelize'][_0xfda3('0x1e')]('id')),_0xfda3('0x41')],[db[_0xfda3('0x1d')]['fn'](_0xfda3('0x1c'),db[_0xfda3('0x1d')]['fn']('IF',db[_0xfda3('0x1d')][_0xfda3('0x20')]('`state`\x20=\x204,\x201,\x20null'))),'ivrAnswerCallsDay']],'group':[_0xfda3('0x3f')]})[_0xfda3('0x8')](function(_0x486e55){logger[_0xfda3('0x9')](_0xfda3('0x40'),_0x10ee1b);logger[_0xfda3('0xc')](_0xfda3('0x40'),_0x10ee1b,JSON['stringify'](_0x486e55));_0x2fcbe7(_0x486e55);})['catch'](function(_0xb61f7c){logger[_0xfda3('0xf')](_0xfda3('0x40'),_0xb61f7c['message'],_0x10ee1b);_0x4bc976(_0x421e02[_0xfda3('0xf')](0x1f4,_0xb61f7c['message']));});});}; \ No newline at end of file +var _0x5eb8=['raw','then','CreateCmHopperHistory','stringify','AvgHandleTime','sequelize','COUNT','col','predictiveIntervalTotalCalls','`state`\x20=\x204,\x201,\x20null','literal','`state`\x20=\x2010,\x201,\x20null','predictiveIntervalDroppedCallsTimeout','AVG','`state`\x20=\x204,\x20`holdtime`,\x20null','predictiveIntervalAvgHoldtime','`state`\x20=\x204,\x20`talktime`,\x20null','GetVoiceQueueHopperHistory','findAll','campaign','`state`\x20=\x200,\x201,\x20null','outboundNoAnswerCallsDay','outboundAnswerCallsDay','`state`\x20=\x205,\x201,\x20null','outboundBusyCallsDay','`state`\x20=\x208,\x201,\x20null','outboundCongestionCallsDay','`state`\x20=\x2010\x20,\x201,\x20null','`state`\x20=\x2011\x20,\x201,\x20null','`state`\x20=\x2012,\x201,\x20null','outboundUnknownCallsDay','`state`\x20=\x2013,\x201,\x20null','outboundBlacklistCallsDay','`state`\x20=\x2014,\x201,\x20null','outboundOriginateFailureCallsDay','`state`\x20=\x2018,\x201,\x20null','outboundRejectCallsDay','`state`\x20=\x2016,\x201,\x20null','outboundAnswerAgiCallsDay','`state`\x20=\x2022\x20or\x20`state`\x20=\x2023,\x201,\x20null','GetCampaignHopperHistory','where','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','CmHopperHistory,\x20%s,\x20%s','request\x20sent','debug','CmHopperHistory,\x20%s,\x20%s,\x20%s','error','message','catch','CmHopperHistory','create','body','options'];(function(_0x19ac6e,_0x435862){var _0x1cdcf3=function(_0x23151c){while(--_0x23151c){_0x19ac6e['push'](_0x19ac6e['shift']());}};_0x1cdcf3(++_0x435862);}(_0x5eb8,0xb0));var _0x85eb=function(_0x5222d9,_0x12496d){_0x5222d9=_0x5222d9-0x0;var _0x16b0d5=_0x5eb8[_0x5222d9];return _0x16b0d5;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x85eb('0x0'));var BPromise=require(_0x85eb('0x1'));var rs=require(_0x85eb('0x2'));var fs=require('fs');var Redis=require(_0x85eb('0x3'));var db=require(_0x85eb('0x4'))['db'];var utils=require(_0x85eb('0x5'));var logger=require(_0x85eb('0x6'))(_0x85eb('0x7'));var config=require(_0x85eb('0x8'));var jayson=require(_0x85eb('0x9'));var client=jayson[_0x85eb('0xa')][_0x85eb('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4a8814,_0x16d7b9,_0x3af658){return new BPromise(function(_0x448345,_0x5cd4ec){return client[_0x85eb('0xc')](_0x4a8814,_0x3af658)['then'](function(_0x1f0036){logger[_0x85eb('0xd')](_0x85eb('0xe'),_0x16d7b9,_0x85eb('0xf'));logger[_0x85eb('0x10')](_0x85eb('0x11'),_0x16d7b9,_0x85eb('0xf'),JSON['stringify'](_0x1f0036));if(_0x1f0036[_0x85eb('0x12')]){if(_0x1f0036[_0x85eb('0x12')]['code']===0x1f4){logger[_0x85eb('0x12')](_0x85eb('0xe'),_0x16d7b9,_0x1f0036[_0x85eb('0x12')][_0x85eb('0x13')]);return _0x5cd4ec(_0x1f0036['error']['message']);}logger[_0x85eb('0x12')]('CmHopperHistory,\x20%s,\x20%s',_0x16d7b9,_0x1f0036[_0x85eb('0x12')][_0x85eb('0x13')]);return _0x448345(_0x1f0036[_0x85eb('0x12')][_0x85eb('0x13')]);}else{logger[_0x85eb('0xd')]('CmHopperHistory,\x20%s,\x20%s',_0x16d7b9,_0x85eb('0xf'));_0x448345(_0x1f0036['result'][_0x85eb('0x13')]);}})[_0x85eb('0x14')](function(_0x3e23e8){logger[_0x85eb('0x12')]('CmHopperHistory,\x20%s,\x20%s',_0x16d7b9,_0x3e23e8);_0x5cd4ec(_0x3e23e8);});});}exports['CreateCmHopperHistory']=function(_0x50d2a8){var _0xe198ca=this;return new Promise(function(_0x39ca96,_0x10cf2f){return db[_0x85eb('0x15')][_0x85eb('0x16')](_0x50d2a8[_0x85eb('0x17')],{'raw':_0x50d2a8['options']?_0x50d2a8[_0x85eb('0x18')][_0x85eb('0x19')]===undefined?!![]:![]:!![]})[_0x85eb('0x1a')](function(_0x4e8041){logger['info']('CreateCmHopperHistory',_0x50d2a8);logger['debug'](_0x85eb('0x1b'),_0x50d2a8,JSON[_0x85eb('0x1c')](_0x4e8041));_0x39ca96(_0x4e8041);})[_0x85eb('0x14')](function(_0x255ca7){logger[_0x85eb('0x12')](_0x85eb('0x1b'),_0x255ca7['message'],_0x50d2a8);_0x10cf2f(_0xe198ca['error'](0x1f4,_0x255ca7['message']));});});};exports[_0x85eb('0x1d')]=function(_0x1426c8){var _0x3f7a4d=this;return new Promise(function(_0x28b87d,_0x312b3e){return db[_0x85eb('0x15')]['findAll']({'raw':_0x1426c8[_0x85eb('0x18')]?_0x1426c8[_0x85eb('0x18')][_0x85eb('0x19')]===undefined?!![]:![]:!![],'where':_0x1426c8[_0x85eb('0x18')]?_0x1426c8[_0x85eb('0x18')]['where']||null:null,'attributes':[[db[_0x85eb('0x1e')]['fn'](_0x85eb('0x1f'),db[_0x85eb('0x1e')][_0x85eb('0x20')]('id')),_0x85eb('0x21')],[db[_0x85eb('0x1e')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0x85eb('0x1e')]['literal'](_0x85eb('0x22')))),'predictiveIntervalAnsweredCalls'],[db[_0x85eb('0x1e')]['fn'](_0x85eb('0x1f'),db[_0x85eb('0x1e')]['fn']('IF',db[_0x85eb('0x1e')][_0x85eb('0x23')](_0x85eb('0x24')))),_0x85eb('0x25')],[db['sequelize']['fn'](_0x85eb('0x1f'),db[_0x85eb('0x1e')]['fn']('IF',db['sequelize'][_0x85eb('0x23')]('`state`\x20=\x2011,\x201,\x20null'))),'predictiveIntervalDroppedCallsCallersExit'],[db[_0x85eb('0x1e')]['fn'](_0x85eb('0x26'),db[_0x85eb('0x1e')]['fn']('IF',db[_0x85eb('0x1e')][_0x85eb('0x23')](_0x85eb('0x27')))),_0x85eb('0x28')],[db[_0x85eb('0x1e')]['fn'](_0x85eb('0x26'),db[_0x85eb('0x1e')]['fn']('IF',db['sequelize'][_0x85eb('0x23')](_0x85eb('0x29')))),'predictiveIntervalAvgTalktime']]})['then'](function(_0x340745){logger[_0x85eb('0xd')](_0x85eb('0x1d'),_0x1426c8);logger[_0x85eb('0x10')](_0x85eb('0x1d'),_0x1426c8,JSON[_0x85eb('0x1c')](_0x340745));_0x28b87d(_0x340745);})[_0x85eb('0x14')](function(_0x35f092){logger[_0x85eb('0x12')](_0x85eb('0x1d'),_0x35f092[_0x85eb('0x13')],_0x1426c8);_0x312b3e(_0x3f7a4d[_0x85eb('0x12')](0x1f4,_0x35f092[_0x85eb('0x13')]));});});};exports[_0x85eb('0x2a')]=function(_0x4b69a7){var _0x4361e2=this;return new Promise(function(_0x3dfe74,_0x58f091){return db['CmHopperHistory'][_0x85eb('0x2b')]({'raw':_0x4b69a7[_0x85eb('0x18')]?_0x4b69a7['options'][_0x85eb('0x19')]===undefined?!![]:![]:!![],'where':_0x4b69a7['options']?_0x4b69a7[_0x85eb('0x18')]['where']||null:null,'attributes':[[_0x85eb('0x2c'),'name'],[db[_0x85eb('0x1e')]['fn']('COUNT',db[_0x85eb('0x1e')]['fn']('IF',db[_0x85eb('0x1e')]['literal'](_0x85eb('0x2d')))),'outboundNoSuchCallsDay'],[db[_0x85eb('0x1e')]['fn'](_0x85eb('0x1f'),db['sequelize']['fn']('IF',db[_0x85eb('0x1e')]['literal']('`state`\x20=\x203,\x201,\x20null'))),_0x85eb('0x2e')],[db['sequelize']['fn'](_0x85eb('0x1f'),db[_0x85eb('0x1e')]['fn']('IF',db['sequelize']['literal'](_0x85eb('0x22')))),_0x85eb('0x2f')],[db['sequelize']['fn']('COUNT',db[_0x85eb('0x1e')]['fn']('IF',db[_0x85eb('0x1e')][_0x85eb('0x23')](_0x85eb('0x30')))),_0x85eb('0x31')],[db['sequelize']['fn'](_0x85eb('0x1f'),db[_0x85eb('0x1e')]['fn']('IF',db[_0x85eb('0x1e')][_0x85eb('0x23')](_0x85eb('0x32')))),_0x85eb('0x33')],[db[_0x85eb('0x1e')]['fn'](_0x85eb('0x1f'),db[_0x85eb('0x1e')]['fn']('IF',db['sequelize'][_0x85eb('0x23')](_0x85eb('0x34')))),'outboundDropCallsDayTimeout'],[db[_0x85eb('0x1e')]['fn'](_0x85eb('0x1f'),db[_0x85eb('0x1e')]['fn']('IF',db[_0x85eb('0x1e')][_0x85eb('0x23')](_0x85eb('0x35')))),'outboundDropCallsDayCallersExit'],[db[_0x85eb('0x1e')]['fn'](_0x85eb('0x1f'),db[_0x85eb('0x1e')]['fn']('IF',db[_0x85eb('0x1e')][_0x85eb('0x23')](_0x85eb('0x36')))),_0x85eb('0x37')],[db[_0x85eb('0x1e')]['fn']('COUNT',db[_0x85eb('0x1e')]['fn']('IF',db[_0x85eb('0x1e')][_0x85eb('0x23')](_0x85eb('0x38')))),_0x85eb('0x39')],[db[_0x85eb('0x1e')]['fn'](_0x85eb('0x1f'),db[_0x85eb('0x1e')]['fn']('IF',db[_0x85eb('0x1e')][_0x85eb('0x23')](_0x85eb('0x3a')))),_0x85eb('0x3b')],[db['sequelize']['fn'](_0x85eb('0x1f'),db[_0x85eb('0x1e')]['fn']('IF',db[_0x85eb('0x1e')]['literal'](_0x85eb('0x3c')))),_0x85eb('0x3d')],[db[_0x85eb('0x1e')]['fn'](_0x85eb('0x1f'),db[_0x85eb('0x1e')]['fn']('IF',db['sequelize'][_0x85eb('0x23')](_0x85eb('0x3e')))),_0x85eb('0x3f')],[db['sequelize']['fn'](_0x85eb('0x1f'),db[_0x85eb('0x1e')]['fn']('IF',db[_0x85eb('0x1e')]['literal']('`state`\x20=\x2020,\x201,\x20null'))),_0x85eb('0x3d')],[db['sequelize']['fn']('COUNT',db[_0x85eb('0x1e')]['fn']('IF',db['sequelize'][_0x85eb('0x23')](_0x85eb('0x40')))),'outboundReCallsDay']],'group':['campaign']})[_0x85eb('0x1a')](function(_0x249511){logger[_0x85eb('0xd')](_0x85eb('0x2a'),_0x4b69a7);logger[_0x85eb('0x10')]('GetVoiceQueueHopperHistory',_0x4b69a7,JSON[_0x85eb('0x1c')](_0x249511));_0x3dfe74(_0x249511);})[_0x85eb('0x14')](function(_0x270bb2){logger[_0x85eb('0x12')](_0x85eb('0x2a'),_0x270bb2['message'],_0x4b69a7);_0x58f091(_0x4361e2[_0x85eb('0x12')](0x1f4,_0x270bb2['message']));});});};exports[_0x85eb('0x41')]=function(_0x40d846){var _0x4ee529=this;return new Promise(function(_0x341ddb,_0xd04f24){return db[_0x85eb('0x15')][_0x85eb('0x2b')]({'raw':_0x40d846[_0x85eb('0x18')]?_0x40d846[_0x85eb('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x40d846[_0x85eb('0x18')]?_0x40d846['options'][_0x85eb('0x42')]||null:null,'attributes':[[_0x85eb('0x2c'),'name'],[db[_0x85eb('0x1e')]['fn'](_0x85eb('0x1f'),db['sequelize'][_0x85eb('0x20')]('id')),'ivrTotalCallsDays'],[db[_0x85eb('0x1e')]['fn'](_0x85eb('0x1f'),db[_0x85eb('0x1e')]['fn']('IF',db[_0x85eb('0x1e')][_0x85eb('0x23')](_0x85eb('0x22')))),'ivrAnswerCallsDay']],'group':[_0x85eb('0x2c')]})[_0x85eb('0x1a')](function(_0x1d3204){logger[_0x85eb('0xd')](_0x85eb('0x41'),_0x40d846);logger[_0x85eb('0x10')](_0x85eb('0x41'),_0x40d846,JSON[_0x85eb('0x1c')](_0x1d3204));_0x341ddb(_0x1d3204);})[_0x85eb('0x14')](function(_0x13cc2a){logger[_0x85eb('0x12')]('GetCampaignHopperHistory',_0x13cc2a[_0x85eb('0x13')],_0x40d846);_0xd04f24(_0x4ee529[_0x85eb('0x12')](0x1f4,_0x13cc2a[_0x85eb('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/index.js b/server/api/cmHopperHistory/index.js index 23e4294..4d04ec9 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 _0x1e6f=['get','/describe','describe','create','/:id','exports','multer','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmHopperHistory.controller','isAuthenticated','index'];(function(_0xec2cd8,_0x286998){var _0xfc393f=function(_0x1057c0){while(--_0x1057c0){_0xec2cd8['push'](_0xec2cd8['shift']());}};_0xfc393f(++_0x286998);}(_0x1e6f,0xb6));var _0xf1e6=function(_0x475113,_0x20b08d){_0x475113=_0x475113-0x0;var _0x40df07=_0x1e6f[_0x475113];return _0x40df07;};'use strict';var multer=require(_0xf1e6('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xf1e6('0x1'));var express=require(_0xf1e6('0x2'));var router=express[_0xf1e6('0x3')]();var auth=require(_0xf1e6('0x4'));var interaction=require(_0xf1e6('0x5'));var config=require(_0xf1e6('0x6'));var controller=require(_0xf1e6('0x7'));router['get']('/',auth[_0xf1e6('0x8')](),controller[_0xf1e6('0x9')]);router[_0xf1e6('0xa')](_0xf1e6('0xb'),auth[_0xf1e6('0x8')](),controller[_0xf1e6('0xc')]);router[_0xf1e6('0xa')]('/:id',auth[_0xf1e6('0x8')](),controller['show']);router['post']('/',auth['isAuthenticated'](),controller[_0xf1e6('0xd')]);router['put'](_0xf1e6('0xe'),auth['isAuthenticated'](),controller['update']);module[_0xf1e6('0xf')]=router; \ No newline at end of file +var _0xdb3e=['update','exports','util','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./cmHopperHistory.controller','get','isAuthenticated','index','/describe','/:id','post','create'];(function(_0x5a3718,_0x50ee3b){var _0x132206=function(_0x4c0ac4){while(--_0x4c0ac4){_0x5a3718['push'](_0x5a3718['shift']());}};_0x132206(++_0x50ee3b);}(_0xdb3e,0x1e2));var _0xedb3=function(_0x2e62a6,_0x3206a1){_0x2e62a6=_0x2e62a6-0x0;var _0x541d90=_0xdb3e[_0x2e62a6];return _0x541d90;};'use strict';var multer=require('multer');var util=require(_0xedb3('0x0'));var path=require('path');var timeout=require(_0xedb3('0x1'));var express=require(_0xedb3('0x2'));var router=express[_0xedb3('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0xedb3('0x4'));var config=require(_0xedb3('0x5'));var controller=require(_0xedb3('0x6'));router[_0xedb3('0x7')]('/',auth[_0xedb3('0x8')](),controller[_0xedb3('0x9')]);router[_0xedb3('0x7')](_0xedb3('0xa'),auth[_0xedb3('0x8')](),controller['describe']);router['get'](_0xedb3('0xb'),auth[_0xedb3('0x8')](),controller['show']);router[_0xedb3('0xc')]('/',auth[_0xedb3('0x8')](),controller[_0xedb3('0xd')]);router['put'](_0xedb3('0xb'),auth[_0xedb3('0x8')](),controller[_0xedb3('0xe')]);module[_0xedb3('0xf')]=router; \ No newline at end of file diff --git a/server/api/cmList/cmList.attributes.js b/server/api/cmList/cmList.attributes.js index ad2e3f9..aad8aff 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 _0xf2af=['name','STRING'];(function(_0x56f3d5,_0xe55685){var _0x27aaee=function(_0x254208){while(--_0x254208){_0x56f3d5['push'](_0x56f3d5['shift']());}};_0x27aaee(++_0xe55685);}(_0xf2af,0x109));var _0xff2a=function(_0x2ef87d,_0x29d48d){_0x2ef87d=_0x2ef87d-0x0;var _0x49d160=_0xf2af[_0x2ef87d];return _0x49d160;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0xff2a('0x0')],'unique':_0xff2a('0x1'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0xff2a('0x0')]},'dialPrefix':{'type':Sequelize[_0xff2a('0x0')]}}; \ No newline at end of file +var _0x3b27=['name','sequelize','exports','STRING'];(function(_0x48f2e3,_0x4c8fef){var _0x106263=function(_0x1432d8){while(--_0x1432d8){_0x48f2e3['push'](_0x48f2e3['shift']());}};_0x106263(++_0x4c8fef);}(_0x3b27,0xd1));var _0x73b2=function(_0x556927,_0x34b53f){_0x556927=_0x556927-0x0;var _0x5f1235=_0x3b27[_0x556927];return _0x5f1235;};'use strict';var Sequelize=require(_0x73b2('0x0'));module[_0x73b2('0x1')]={'name':{'type':Sequelize[_0x73b2('0x2')],'unique':_0x73b2('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x73b2('0x2')]},'dialPrefix':{'type':Sequelize[_0x73b2('0x2')]}}; \ No newline at end of file diff --git a/server/api/cmList/cmList.controller.js b/server/api/cmList/cmList.controller.js index 8fa88f0..55e9b93 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 _0x0533=['squel','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','./cmList.socket','sendStatus','status','end','json','count','offset','limit','set','apply','reject','save','update','then','destroy','get','Lists','UserProfileResource','error','stack','name','send','index','CmList','rawAttributes','type','model','map','keys','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','rows','catch','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','describe','addDisposition','ListId','Disposition','getDispositions','findAll','ids','addContacts','isArray','tags','join','each','CmContact','success','dataValues','CmCustomField','CustomFields','concat','format','cf_%d','getContacts','raw','now','writeFileSync','/tmp/list_%d_%s.csv','setHeader','Content-disposition','attachment;\x20filename=','list_%d_%s.csv','Content-type','text/csv','download','findOne','sequelize','transaction','addCustomFields','Sequelize','text','INTEGER','defaultValue','queryInterface','addColumn','cm_contacts','cf_%s','getCustomFields','findAndCountAll','addAgents','omit','emit','removeAgents','userCmList:remove','getAgents','html-pdf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','lodash'];(function(_0x453a97,_0x244a78){var _0x30548d=function(_0x1c58d2){while(--_0x1c58d2){_0x453a97['push'](_0x453a97['shift']());}};_0x30548d(++_0x244a78);}(_0x0533,0x7d));var _0x3053=function(_0x5a0410,_0x277e8a){_0x5a0410=_0x5a0410-0x0;var _0x4bb75b=_0x0533[_0x5a0410];return _0x4bb75b;};'use strict';var pdf=require(_0x3053('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x3053('0x1'));var jsonpatch=require(_0x3053('0x2'));var rp=require(_0x3053('0x3'));var moment=require(_0x3053('0x4'));var BPromise=require(_0x3053('0x5'));var Mustache=require('mustache');var util=require(_0x3053('0x6'));var path=require(_0x3053('0x7'));var sox=require(_0x3053('0x8'));var csv=require(_0x3053('0x9'));var ejs=require(_0x3053('0xa'));var fs=require('fs');var _=require(_0x3053('0xb'));var squel=require(_0x3053('0xc'));var crypto=require(_0x3053('0xd'));var jsforce=require(_0x3053('0xe'));var deskjs=require(_0x3053('0xf'));var toCsv=require(_0x3053('0x9'));var querystring=require('querystring');var Papa=require(_0x3053('0x10'));var Redis=require('ioredis');var authService=require(_0x3053('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x3053('0x12'));var hardwareService=require(_0x3053('0x13'));var logger=require(_0x3053('0x14'))('api');var utils=require(_0x3053('0x15'));var config=require(_0x3053('0x16'));var db=require(_0x3053('0x17'))['db'];config[_0x3053('0x18')]=_[_0x3053('0x19')](config[_0x3053('0x18')],{'host':_0x3053('0x1a'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x3053('0x1b'))['register'](socket);function respondWithStatusCode(_0x38bd37,_0x27af4d){_0x27af4d=_0x27af4d||0xcc;return function(_0x4d1076){if(_0x4d1076){return _0x38bd37[_0x3053('0x1c')](_0x27af4d);}return _0x38bd37[_0x3053('0x1d')](_0x27af4d)[_0x3053('0x1e')]();};}function respondWithResult(_0x538825,_0x5699aa){_0x5699aa=_0x5699aa||0xc8;return function(_0x352bf9){if(_0x352bf9){return _0x538825['status'](_0x5699aa)[_0x3053('0x1f')](_0x352bf9);}};}function respondWithFilteredResult(_0x25fb00,_0x1388f0){return function(_0x575841){if(_0x575841){var _0x1ebf3e=_0x575841[_0x3053('0x20')],_0x2e0fcb=_0x1388f0[_0x3053('0x21')],_0x49e57d=_0x1388f0['offset']+_0x1388f0[_0x3053('0x22')],_0x2f5152;if(_0x49e57d>=_0x1ebf3e){_0x49e57d=_0x1ebf3e;_0x2f5152=0xc8;}else{_0x2f5152=0xce;}_0x25fb00[_0x3053('0x1d')](_0x2f5152);return _0x25fb00[_0x3053('0x23')]('Content-Range',_0x2e0fcb+'-'+_0x49e57d+'/'+_0x1ebf3e)[_0x3053('0x1f')](_0x575841);}return null;};}function patchUpdates(_0x4add87){return function(_0x2e29c7){try{jsonpatch[_0x3053('0x24')](_0x2e29c7,_0x4add87,!![]);}catch(_0x5bfa67){return BPromise[_0x3053('0x25')](_0x5bfa67);}return _0x2e29c7[_0x3053('0x26')]();};}function saveUpdates(_0xf6cffd,_0x233e05){return function(_0x1e4ddf){if(_0x1e4ddf){return _0x1e4ddf[_0x3053('0x27')](_0xf6cffd)[_0x3053('0x28')](function(_0x13e2af){return _0x13e2af;});}return null;};}function removeEntity(_0x597377,_0x20e84d){return function(_0x471bbb){if(_0x471bbb){return _0x471bbb[_0x3053('0x29')]()[_0x3053('0x28')](function(){var _0x371aef=_0x471bbb[_0x3053('0x2a')]({'plain':!![]});var _0x4d4588=_0x3053('0x2b');return db[_0x3053('0x2c')][_0x3053('0x29')]({'where':{'type':_0x4d4588,'resourceId':_0x371aef['id']}})[_0x3053('0x28')](function(){return _0x471bbb;});})['then'](function(){_0x597377[_0x3053('0x1d')](0xcc)[_0x3053('0x1e')]();});}};}function handleEntityNotFound(_0x1e5694,_0x1a43c9){return function(_0x241726){if(!_0x241726){_0x1e5694[_0x3053('0x1c')](0x194);}return _0x241726;};}function handleError(_0x320a2d,_0x4a5d85){_0x4a5d85=_0x4a5d85||0x1f4;return function(_0x3756a8){logger[_0x3053('0x2d')](_0x3756a8[_0x3053('0x2e')]);if(_0x3756a8[_0x3053('0x2f')]){delete _0x3756a8['name'];}_0x320a2d['status'](_0x4a5d85)[_0x3053('0x30')](_0x3756a8);};}exports[_0x3053('0x31')]=function(_0x1b6603,_0x2e5cec){var _0x36e83c={},_0xf0a6b7={},_0x1ed5b7={'count':0x0,'rows':[]};var _0x339bbc=_['map'](db[_0x3053('0x32')][_0x3053('0x33')],function(_0x295d03){return{'name':_0x295d03['fieldName'],'type':_0x295d03[_0x3053('0x34')]['key']};});_0xf0a6b7[_0x3053('0x35')]=_[_0x3053('0x36')](_0x339bbc,_0x3053('0x2f'));_0xf0a6b7['query']=_[_0x3053('0x37')](_0x1b6603[_0x3053('0x38')]);_0xf0a6b7[_0x3053('0x39')]=_['intersection'](_0xf0a6b7[_0x3053('0x35')],_0xf0a6b7[_0x3053('0x38')]);_0x36e83c[_0x3053('0x3a')]=_[_0x3053('0x3b')](_0xf0a6b7['model'],qs['fields'](_0x1b6603['query'][_0x3053('0x3c')]));_0x36e83c[_0x3053('0x3a')]=_0x36e83c[_0x3053('0x3a')][_0x3053('0x3d')]?_0x36e83c['attributes']:_0xf0a6b7['model'];if(!_0x1b6603[_0x3053('0x38')][_0x3053('0x3e')](_0x3053('0x3f'))){_0x36e83c['limit']=qs[_0x3053('0x22')](_0x1b6603[_0x3053('0x38')][_0x3053('0x22')]);_0x36e83c['offset']=qs['offset'](_0x1b6603[_0x3053('0x38')][_0x3053('0x21')]);}_0x36e83c[_0x3053('0x40')]=qs[_0x3053('0x41')](_0x1b6603[_0x3053('0x38')]['sort']);_0x36e83c[_0x3053('0x42')]=qs[_0x3053('0x39')](_[_0x3053('0x43')](_0x1b6603[_0x3053('0x38')],_0xf0a6b7[_0x3053('0x39')]),_0x339bbc);if(_0x1b6603[_0x3053('0x38')][_0x3053('0x44')]){_0x36e83c[_0x3053('0x42')]=_[_0x3053('0x45')](_0x36e83c[_0x3053('0x42')],{'$or':_[_0x3053('0x36')](_0x339bbc,function(_0x3f6c6f){if(_0x3f6c6f['type']!==_0x3053('0x46')){var _0x1305c6={};_0x1305c6[_0x3f6c6f['name']]={'$like':'%'+_0x1b6603[_0x3053('0x38')][_0x3053('0x44')]+'%'};return _0x1305c6;}})});}_0x36e83c=_[_0x3053('0x45')]({},_0x36e83c,_0x1b6603[_0x3053('0x47')]);var _0x3e15ec={'where':_0x36e83c[_0x3053('0x42')]};return db[_0x3053('0x32')][_0x3053('0x20')](_0x3e15ec)['then'](function(_0x8714c1){_0x1ed5b7['count']=_0x8714c1;if(_0x1b6603[_0x3053('0x38')][_0x3053('0x48')]){_0x36e83c[_0x3053('0x49')]=[{'all':!![]}];}return db[_0x3053('0x32')]['findAll'](_0x36e83c);})[_0x3053('0x28')](function(_0xda5bc4){_0x1ed5b7[_0x3053('0x4a')]=_0xda5bc4;return _0x1ed5b7;})[_0x3053('0x28')](respondWithFilteredResult(_0x2e5cec,_0x36e83c))[_0x3053('0x4b')](handleError(_0x2e5cec,null));};exports['show']=function(_0x34a222,_0x139c62){var _0x520fd7={'raw':![],'where':{'id':_0x34a222['params']['id']}},_0x1fe12d={};_0x1fe12d['model']=_[_0x3053('0x37')](db[_0x3053('0x32')][_0x3053('0x33')]);_0x1fe12d[_0x3053('0x38')]=_[_0x3053('0x37')](_0x34a222[_0x3053('0x38')]);_0x1fe12d[_0x3053('0x39')]=_[_0x3053('0x3b')](_0x1fe12d[_0x3053('0x35')],_0x1fe12d['query']);_0x520fd7[_0x3053('0x3a')]=_[_0x3053('0x3b')](_0x1fe12d[_0x3053('0x35')],qs[_0x3053('0x3c')](_0x34a222[_0x3053('0x38')]['fields']));_0x520fd7[_0x3053('0x3a')]=_0x520fd7['attributes']['length']?_0x520fd7[_0x3053('0x3a')]:_0x1fe12d[_0x3053('0x35')];if(_0x34a222[_0x3053('0x38')][_0x3053('0x48')]){_0x520fd7['include']=[{'all':!![]}];}_0x520fd7=_[_0x3053('0x45')]({},_0x520fd7,_0x34a222['options']);return db[_0x3053('0x32')][_0x3053('0x4c')](_0x520fd7)[_0x3053('0x28')](handleEntityNotFound(_0x139c62,null))[_0x3053('0x28')](respondWithResult(_0x139c62,null))[_0x3053('0x4b')](handleError(_0x139c62,null));};exports['create']=function(_0x1a5205,_0x4b3e09){return db[_0x3053('0x32')][_0x3053('0x4d')](_0x1a5205[_0x3053('0x4e')],{})['then'](function(_0x30889b){var _0x3e6a9d=_0x1a5205[_0x3053('0x4f')][_0x3053('0x2a')]({'plain':!![]});if(!_0x3e6a9d)throw new Error(_0x3053('0x50'));if(_0x3e6a9d[_0x3053('0x51')]===_0x3053('0x4f')){var _0x5817ef=_0x30889b['get']({'plain':!![]});var _0x4636a4=_0x3053('0x2b');return db['UserProfileSection'][_0x3053('0x4c')]({'where':{'name':_0x4636a4,'userProfileId':_0x3e6a9d['userProfileId']},'raw':!![]})[_0x3053('0x28')](function(_0x5c2ca6){if(_0x5c2ca6&&_0x5c2ca6[_0x3053('0x52')]===0x0){return db[_0x3053('0x2c')][_0x3053('0x4d')]({'name':_0x5817ef['name'],'resourceId':_0x5817ef['id'],'type':_0x5c2ca6[_0x3053('0x2f')],'sectionId':_0x5c2ca6['id']},{})[_0x3053('0x28')](function(){return _0x30889b;});}else{return _0x30889b;}})[_0x3053('0x4b')](function(_0x174522){logger[_0x3053('0x2d')](_0x3053('0x53'),_0x174522);throw _0x174522;});}return _0x30889b;})[_0x3053('0x28')](respondWithResult(_0x4b3e09,0xc9))[_0x3053('0x4b')](handleError(_0x4b3e09,null));};exports[_0x3053('0x27')]=function(_0x217c94,_0xd33ab4){if(_0x217c94['body']['id']){delete _0x217c94[_0x3053('0x4e')]['id'];}return db[_0x3053('0x32')]['find']({'where':{'id':_0x217c94[_0x3053('0x54')]['id']}})['then'](handleEntityNotFound(_0xd33ab4,null))['then'](saveUpdates(_0x217c94[_0x3053('0x4e')],null))[_0x3053('0x28')](respondWithResult(_0xd33ab4,null))[_0x3053('0x4b')](handleError(_0xd33ab4,null));};exports[_0x3053('0x29')]=function(_0x11361e,_0x2dd7d5){return db[_0x3053('0x32')][_0x3053('0x4c')]({'where':{'id':_0x11361e[_0x3053('0x54')]['id']}})[_0x3053('0x28')](handleEntityNotFound(_0x2dd7d5,null))[_0x3053('0x28')](removeEntity(_0x2dd7d5,null))[_0x3053('0x4b')](handleError(_0x2dd7d5,null));};exports[_0x3053('0x55')]=function(_0x4f6f87,_0x17a0bc){return db[_0x3053('0x32')][_0x3053('0x55')]()[_0x3053('0x28')](respondWithResult(_0x17a0bc,null))['catch'](handleError(_0x17a0bc,null));};exports[_0x3053('0x56')]=function(_0x2d607d,_0x1bc1a1,_0x2d22ec){if(_0x2d607d[_0x3053('0x4e')]['id']){delete _0x2d607d[_0x3053('0x4e')]['id'];}return db[_0x3053('0x32')][_0x3053('0x4c')]({'where':{'id':_0x2d607d[_0x3053('0x54')]['id']}})[_0x3053('0x28')](handleEntityNotFound(_0x1bc1a1,null))[_0x3053('0x28')](function(_0x45d08b){if(_0x45d08b){_0x2d607d[_0x3053('0x4e')][_0x3053('0x57')]=_0x45d08b['id'];return db[_0x3053('0x58')][_0x3053('0x4d')](_0x2d607d[_0x3053('0x4e')]);}})['then'](respondWithResult(_0x1bc1a1,null))[_0x3053('0x4b')](handleError(_0x1bc1a1,null));};exports[_0x3053('0x59')]=function(_0x5748f8,_0x32e7dd,_0x4e22e8){var _0x3e05e6={'raw':![],'where':{}};var _0x381ce8={};var _0x48550c={'count':0x0,'rows':[]};return db[_0x3053('0x32')]['findOne']({'where':{'id':_0x5748f8[_0x3053('0x54')]['id']}})['then'](handleEntityNotFound(_0x32e7dd,null))['then'](function(_0x202474){if(_0x202474){_0x381ce8[_0x3053('0x35')]=_[_0x3053('0x37')](db['Disposition'][_0x3053('0x33')]);_0x381ce8[_0x3053('0x38')]=_[_0x3053('0x37')](_0x5748f8[_0x3053('0x38')]);_0x381ce8[_0x3053('0x39')]=_['intersection'](_0x381ce8['model'],_0x381ce8['query']);_0x3e05e6[_0x3053('0x3a')]=_[_0x3053('0x3b')](_0x381ce8[_0x3053('0x35')],qs[_0x3053('0x3c')](_0x5748f8[_0x3053('0x38')][_0x3053('0x3c')]));_0x3e05e6[_0x3053('0x3a')]=_0x3e05e6[_0x3053('0x3a')][_0x3053('0x3d')]?_0x3e05e6[_0x3053('0x3a')]:_0x381ce8['model'];if(!_0x5748f8['query'][_0x3053('0x3e')](_0x3053('0x3f'))){_0x3e05e6['limit']=qs[_0x3053('0x22')](_0x5748f8[_0x3053('0x38')]['limit']);_0x3e05e6[_0x3053('0x21')]=qs[_0x3053('0x21')](_0x5748f8[_0x3053('0x38')][_0x3053('0x21')]);}_0x3e05e6[_0x3053('0x40')]=qs[_0x3053('0x41')](_0x5748f8[_0x3053('0x38')]['sort']);_0x3e05e6['where']=qs[_0x3053('0x39')](_['pick'](_0x5748f8[_0x3053('0x38')],_0x381ce8[_0x3053('0x39')]));_0x3e05e6['where'][_0x3053('0x57')]=_0x202474['id'];if(_0x5748f8[_0x3053('0x38')]['filter']){_0x3e05e6['where']=_[_0x3053('0x45')](_0x3e05e6[_0x3053('0x42')],{'$or':_[_0x3053('0x36')](_0x3e05e6[_0x3053('0x3a')],function(_0x297841){var _0x2572b1={};_0x2572b1[_0x297841]={'$like':'%'+_0x5748f8[_0x3053('0x38')][_0x3053('0x44')]+'%'};return _0x2572b1;})});}_0x3e05e6=_[_0x3053('0x45')]({},_0x3e05e6,_0x5748f8[_0x3053('0x47')]);return db[_0x3053('0x58')]['count']({'where':_0x3e05e6[_0x3053('0x42')]})[_0x3053('0x28')](function(_0x12a799){_0x48550c[_0x3053('0x20')]=_0x12a799;if(_0x5748f8[_0x3053('0x38')]['includeAll']){_0x3e05e6[_0x3053('0x49')]=[{'all':!![]}];}return db[_0x3053('0x58')][_0x3053('0x5a')](_0x3e05e6);})[_0x3053('0x28')](function(_0x4db908){_0x48550c[_0x3053('0x4a')]=_0x4db908;return _0x48550c;});}})[_0x3053('0x28')](respondWithFilteredResult(_0x32e7dd,_0x3e05e6))[_0x3053('0x4b')](handleError(_0x32e7dd,null));};exports['removeDispositions']=function(_0x3d8e8a,_0x3ab2cc,_0x284f6e){return db[_0x3053('0x32')][_0x3053('0x4c')]({'where':{'id':_0x3d8e8a[_0x3053('0x54')]['id']}})[_0x3053('0x28')](handleEntityNotFound(_0x3ab2cc,null))['then'](function(_0x48d06a){if(_0x48d06a){return _0x48d06a['removeDispositions'](_0x3d8e8a['query'][_0x3053('0x5b')]);}})['then'](respondWithStatusCode(_0x3ab2cc,null))[_0x3053('0x4b')](handleError(_0x3ab2cc,null));};exports[_0x3053('0x5c')]=function(_0x1608fd,_0x48b0ff,_0x40bd59){return db['CmList']['find']({'where':{'id':_0x1608fd[_0x3053('0x54')]['id']}})[_0x3053('0x28')](handleEntityNotFound(_0x48b0ff,null))[_0x3053('0x28')](function(_0xf8f2a6){if(_0xf8f2a6){var _0x350b26=[];var _0x9f59a7={'success':[],'errors':[]};return db['CmContact'][_0x3053('0x55')]()[_0x3053('0x28')](function(_0x125447){if(_0x1608fd[_0x3053('0x4e')]['tags']&&_[_0x3053('0x5d')](_0x1608fd[_0x3053('0x4e')]['tags'])){if(_0x1608fd[_0x3053('0x4e')][_0x3053('0x5e')][_0x3053('0x3d')]){_0x1608fd[_0x3053('0x4e')]['tags']=_0x1608fd[_0x3053('0x4e')][_0x3053('0x5e')][_0x3053('0x5f')](';')+';';}else{_0x1608fd[_0x3053('0x4e')][_0x3053('0x5e')]=null;}}else{_0x1608fd['body'][_0x3053('0x5e')]=null;}if(_0x1608fd[_0x3053('0x4e')]&&_[_0x3053('0x5d')](_0x1608fd['body'])){for(var _0x345ea9=0x0;_0x345ea9<_0x1608fd[_0x3053('0x4e')]['length'];_0x345ea9+=0x1){_0x1608fd[_0x3053('0x4e')][_0x345ea9][_0x3053('0x57')]=_0x1608fd['params']['id'];_0x350b26['push'](_0x1608fd[_0x3053('0x4e')][_0x345ea9]);}return BPromise[_0x3053('0x60')](_0x350b26,function(_0x13c4fe){return db[_0x3053('0x61')][_0x3053('0x4d')](_['omit'](_0x13c4fe,[_0x3053('0x5b'),'id'])||{},{'fields':_[_0x3053('0x37')](_0x125447),'raw':!![]})[_0x3053('0x28')](function(_0x446d04){_0x9f59a7[_0x3053('0x62')]['push'](_0x446d04[_0x3053('0x63')]);})[_0x3053('0x4b')](function(_0x54798f){_0x9f59a7['errors']['push']({'data':_0x13c4fe,'error':_0x54798f['message']});});})[_0x3053('0x28')](function(_0x5c738d){return _0x9f59a7;})[_0x3053('0x4b')](function(_0x934362){return _0x934362;});}else{_0x48b0ff[_0x3053('0x1d')](0x190)[_0x3053('0x1f')]({'message':'Malformed\x20request\x20syntax'});}});}})['then'](respondWithResult(_0x48b0ff,null))[_0x3053('0x4b')](handleError(_0x48b0ff,null));};exports['getContacts']=function(_0x39a044,_0x3d4350,_0x35fefc){var _0x53fc32;return db['CmList'][_0x3053('0x4c')]({'where':{'id':_0x39a044[_0x3053('0x54')]['id']},'include':[{'model':db[_0x3053('0x64')],'as':_0x3053('0x65')}]})[_0x3053('0x28')](handleEntityNotFound(_0x3d4350,null))[_0x3053('0x28')](function(_0x2262b5){if(_0x2262b5){_0x53fc32=_0x2262b5;return db[_0x3053('0x61')][_0x3053('0x33')];}})[_0x3053('0x28')](function(_0x5e59b6){if(_0x5e59b6){var _0x1d0918={};var _0x114319={};_0x114319['model']=_[_0x3053('0x66')](_[_0x3053('0x37')](_0x5e59b6),_[_0x3053('0x36')](_0x53fc32[_0x3053('0x65')],function(_0x3884c3){return util[_0x3053('0x67')](_0x3053('0x68'),_0x3884c3['id']);}));_0x114319[_0x3053('0x38')]=_[_0x3053('0x37')](_0x39a044[_0x3053('0x38')]);_0x114319['filters']=_[_0x3053('0x3b')](_0x114319[_0x3053('0x35')],_0x114319[_0x3053('0x38')]);_0x1d0918[_0x3053('0x3a')]=_['intersection'](_0x114319['model'],qs[_0x3053('0x3c')](_0x39a044[_0x3053('0x38')][_0x3053('0x3c')]));_0x1d0918['attributes']=_0x1d0918[_0x3053('0x3a')][_0x3053('0x3d')]?_0x1d0918['attributes']:_0x114319[_0x3053('0x35')];if(!_0x39a044['query']['hasOwnProperty']('nolimit')){_0x1d0918[_0x3053('0x22')]=qs[_0x3053('0x22')](_0x39a044[_0x3053('0x38')]['limit']);_0x1d0918['offset']=qs[_0x3053('0x21')](_0x39a044['query'][_0x3053('0x21')]);}_0x1d0918[_0x3053('0x40')]=qs[_0x3053('0x41')](_0x39a044[_0x3053('0x38')][_0x3053('0x41')]);_0x1d0918['where']=qs['filters'](_['pick'](_0x39a044[_0x3053('0x38')],_0x114319[_0x3053('0x39')]));_0x1d0918['raw']=!![];if(_0x39a044[_0x3053('0x38')]['filter']){_0x1d0918[_0x3053('0x42')]=_['merge'](_0x1d0918[_0x3053('0x42')],{'$or':_[_0x3053('0x36')](_0x1d0918['attributes'],function(_0x595f7c){var _0x15f78e={};_0x15f78e[_0x595f7c]={'$like':'%'+_0x39a044['query'][_0x3053('0x44')]+'%'};return _0x15f78e;})});}_0x1d0918=_['merge']({},_0x1d0918,_0x39a044[_0x3053('0x47')]);return _0x53fc32[_0x3053('0x69')](_0x1d0918);}})['then'](respondWithResult(_0x3d4350,null))[_0x3053('0x4b')](handleError(_0x3d4350,null));};exports['getContactsCsv']=function(_0x1e6616,_0x23b99a,_0x568254){var _0x8fd99c;return db[_0x3053('0x32')][_0x3053('0x4c')]({'where':{'id':_0x1e6616[_0x3053('0x54')]['id']},'include':[{'model':db['CmCustomField'],'as':'CustomFields'}]})[_0x3053('0x28')](handleEntityNotFound(_0x23b99a,null))[_0x3053('0x28')](function(_0x45af3f){if(_0x45af3f){_0x8fd99c=_0x45af3f;return db[_0x3053('0x61')][_0x3053('0x33')];}})[_0x3053('0x28')](function(_0x172043){if(_0x172043){var _0xea007a={};var _0x275194={};_0x275194[_0x3053('0x35')]=_[_0x3053('0x66')](_['keys'](_0x172043),_[_0x3053('0x36')](_0x8fd99c[_0x3053('0x65')],function(_0x431ca6){return util[_0x3053('0x67')](_0x3053('0x68'),_0x431ca6['id']);}));_0x275194['query']=_[_0x3053('0x37')](_0x1e6616[_0x3053('0x38')]);_0x275194[_0x3053('0x39')]=_[_0x3053('0x3b')](_0x275194[_0x3053('0x35')],_0x275194['query']);_0xea007a[_0x3053('0x3a')]=_[_0x3053('0x3b')](_0x275194[_0x3053('0x35')],qs[_0x3053('0x3c')](_0x1e6616[_0x3053('0x38')][_0x3053('0x3c')]));_0xea007a['attributes']=_0xea007a[_0x3053('0x3a')][_0x3053('0x3d')]?_0xea007a[_0x3053('0x3a')]:_0x275194[_0x3053('0x35')];if(!_0x1e6616[_0x3053('0x38')][_0x3053('0x3e')](_0x3053('0x3f'))){_0xea007a[_0x3053('0x22')]=qs[_0x3053('0x22')](_0x1e6616[_0x3053('0x38')][_0x3053('0x22')]);_0xea007a[_0x3053('0x21')]=qs[_0x3053('0x21')](_0x1e6616['query']['offset']);}_0xea007a['order']=qs['sort'](_0x1e6616[_0x3053('0x38')][_0x3053('0x41')]);_0xea007a[_0x3053('0x42')]=qs['filters'](_['pick'](_0x1e6616[_0x3053('0x38')],_0x275194[_0x3053('0x39')]));_0xea007a[_0x3053('0x6a')]=!![];if(_0x1e6616[_0x3053('0x38')][_0x3053('0x44')]){_0xea007a['where']=_['merge'](_0xea007a[_0x3053('0x42')],{'$or':_[_0x3053('0x36')](_0xea007a[_0x3053('0x3a')],function(_0x280ae0){var _0x45fe76={};_0x45fe76[_0x280ae0]={'$like':'%'+_0x1e6616[_0x3053('0x38')][_0x3053('0x44')]+'%'};return _0x45fe76;})});}_0xea007a=_['merge']({},_0xea007a,_0x1e6616['options']);return _0x8fd99c[_0x3053('0x69')](_0xea007a);}})[_0x3053('0x28')](function(_0x599b02){if(!_['isEmpty'](_0x599b02)){var _0x513830=toCsv(_0x599b02);var _0x27b9ca=Date[_0x3053('0x6b')]();fs[_0x3053('0x6c')](util[_0x3053('0x67')](_0x3053('0x6d'),_0x8fd99c['id'],_0x27b9ca),_0x513830);_0x23b99a[_0x3053('0x6e')](_0x3053('0x6f'),_0x3053('0x70')+util[_0x3053('0x67')](_0x3053('0x71'),_0x8fd99c['id'],_0x27b9ca));_0x23b99a[_0x3053('0x6e')](_0x3053('0x72'),_0x3053('0x73'));return _0x23b99a[_0x3053('0x74')](util[_0x3053('0x67')]('/tmp/list_%d_%s.csv',_0x8fd99c['id'],_0x27b9ca));}else{return _0x23b99a['sendStatus'](0xcc);}})[_0x3053('0x4b')](handleError(_0x23b99a,null));};exports['addCustomField']=function(_0x36a467,_0xddef6c,_0x25a89f){var _0x1cc4b9;delete _0x36a467['body']['id'];return db[_0x3053('0x32')][_0x3053('0x75')]({'where':{'id':_0x36a467[_0x3053('0x54')]['id']}})[_0x3053('0x28')](handleEntityNotFound(_0xddef6c,null))[_0x3053('0x28')](function(_0x1e0309){if(_0x1e0309){return db[_0x3053('0x76')][_0x3053('0x77')](function(_0x14d555){return db['CmCustomField'][_0x3053('0x4d')](_0x36a467[_0x3053('0x4e')],{'transaction':_0x14d555})['then'](function(_0x47a0a9){_0x1cc4b9=_0x47a0a9;return _0x1e0309[_0x3053('0x78')](_0x47a0a9,{'transaction':_0x14d555});})[_0x3053('0x28')](function(){var _0x9dcaff={'type':db[_0x3053('0x79')]['TEXT'],'transaction':_0x14d555};switch(_0x36a467[_0x3053('0x4e')][_0x3053('0x34')]){case _0x3053('0x7a'):_0x9dcaff[_0x3053('0x34')]=db[_0x3053('0x79')]['TEXT'];break;case'number':_0x9dcaff['type']=db[_0x3053('0x79')][_0x3053('0x7b')];break;case'switch':_0x9dcaff[_0x3053('0x34')]=db['Sequelize']['BOOLEAN'];_0x9dcaff[_0x3053('0x7c')]=![];break;default:}return db[_0x3053('0x76')][_0x3053('0x7d')][_0x3053('0x7e')](_0x3053('0x7f'),util['format'](_0x3053('0x80'),_0x1cc4b9['id']),_0x9dcaff);})[_0x3053('0x28')](function(){return _0x1cc4b9;});});}})[_0x3053('0x28')](respondWithResult(_0xddef6c,null))[_0x3053('0x4b')](handleError(_0xddef6c,null));};exports[_0x3053('0x81')]=function(_0x214dd7,_0x35d6ee,_0xe00ea3){var _0x57b823={};var _0x52c829={};var _0x372a6c;var _0x17688c;return db['CmList'][_0x3053('0x75')]({'where':{'id':_0x214dd7['params']['id']}})[_0x3053('0x28')](handleEntityNotFound(_0x35d6ee,null))[_0x3053('0x28')](function(_0x236f0a){if(_0x236f0a){_0x372a6c=_0x236f0a;_0x52c829[_0x3053('0x35')]=_['keys'](db[_0x3053('0x64')]['rawAttributes']);_0x52c829[_0x3053('0x38')]=_[_0x3053('0x37')](_0x214dd7[_0x3053('0x38')]);_0x52c829[_0x3053('0x39')]=_[_0x3053('0x3b')](_0x52c829[_0x3053('0x35')],_0x52c829[_0x3053('0x38')]);_0x57b823['attributes']=_[_0x3053('0x3b')](_0x52c829[_0x3053('0x35')],qs[_0x3053('0x3c')](_0x214dd7[_0x3053('0x38')][_0x3053('0x3c')]));_0x57b823['attributes']=_0x57b823[_0x3053('0x3a')]['length']?_0x57b823[_0x3053('0x3a')]:_0x52c829[_0x3053('0x35')];_0x57b823[_0x3053('0x40')]=qs[_0x3053('0x41')](_0x214dd7[_0x3053('0x38')][_0x3053('0x41')]);_0x57b823[_0x3053('0x42')]=qs[_0x3053('0x39')](_[_0x3053('0x43')](_0x214dd7[_0x3053('0x38')],_0x52c829[_0x3053('0x39')]));_0x57b823[_0x3053('0x42')]=_[_0x3053('0x45')](_0x57b823[_0x3053('0x42')],{'$or':[{'ListId':_0x236f0a['id']},{'ListId':null}]});if(_0x214dd7[_0x3053('0x38')][_0x3053('0x44')]){_0x57b823[_0x3053('0x42')]=_['merge'](_0x57b823['where'],{'$or':_[_0x3053('0x36')](_0x57b823[_0x3053('0x3a')],function(_0xc813be){var _0x10d595={};_0x10d595[_0xc813be]={'$like':'%'+_0x214dd7[_0x3053('0x38')][_0x3053('0x44')]+'%'};return _0x10d595;})});}_0x57b823=_[_0x3053('0x45')]({},_0x57b823,_0x214dd7['options']);return db[_0x3053('0x64')][_0x3053('0x82')](_0x57b823);}})[_0x3053('0x28')](respondWithResult(_0x35d6ee,null))[_0x3053('0x4b')](handleError(_0x35d6ee,null));};exports[_0x3053('0x83')]=function(_0x2982ef,_0x39fdd7,_0x2040f5){return db[_0x3053('0x32')][_0x3053('0x4c')]({'where':{'id':_0x2982ef[_0x3053('0x54')]['id']}})[_0x3053('0x28')](handleEntityNotFound(_0x39fdd7,null))[_0x3053('0x28')](function(_0x1176f4){if(_0x1176f4){return _0x1176f4[_0x3053('0x83')](_0x2982ef[_0x3053('0x4e')][_0x3053('0x5b')],_[_0x3053('0x84')](_0x2982ef[_0x3053('0x4e')],[_0x3053('0x5b'),'id'])||{})['spread'](function(_0x3b80e6){for(var _0x543262=0x0;_0x543262<_0x2982ef[_0x3053('0x4e')][_0x3053('0x5b')][_0x3053('0x3d')];_0x543262+=0x1){socket[_0x3053('0x85')]('userCmList:save',{'UserId':_0x2982ef['body'][_0x3053('0x5b')][_0x543262],'CmListId':_0x2982ef[_0x3053('0x54')]['id']});}return _0x3b80e6;});}})[_0x3053('0x28')](respondWithResult(_0x39fdd7,null))[_0x3053('0x4b')](handleError(_0x39fdd7,null));};exports[_0x3053('0x86')]=function(_0x898f3c,_0x539276,_0x450a57){return db['CmList'][_0x3053('0x4c')]({'where':{'id':_0x898f3c[_0x3053('0x54')]['id']}})['then'](handleEntityNotFound(_0x539276,null))[_0x3053('0x28')](function(_0x1fce0b){if(_0x1fce0b){return _0x1fce0b[_0x3053('0x86')](_0x898f3c['query'][_0x3053('0x5b')])['then'](function(){if(_[_0x3053('0x5d')](_0x898f3c[_0x3053('0x38')][_0x3053('0x5b')])){for(var _0x2c4639=0x0;_0x2c4639<_0x898f3c['query']['ids']['length'];_0x2c4639+=0x1){socket[_0x3053('0x85')]('userCmList:remove',{'UserId':Number(_0x898f3c['query']['ids'][_0x2c4639]),'CmListId':Number(_0x898f3c[_0x3053('0x54')]['id'])});}}else{socket['emit'](_0x3053('0x87'),{'UserId':Number(_0x898f3c['query'][_0x3053('0x5b')]),'CmListId':Number(_0x898f3c[_0x3053('0x54')]['id'])});}});}})[_0x3053('0x28')](respondWithStatusCode(_0x539276,null))['catch'](handleError(_0x539276,null));};exports[_0x3053('0x88')]=function(_0x29743e,_0x143a9f,_0x550ba0){var _0x522559={};var _0x31c581={};var _0x538906;var _0x1e1625;return db[_0x3053('0x32')][_0x3053('0x75')]({'where':{'id':_0x29743e['params']['id']}})[_0x3053('0x28')](handleEntityNotFound(_0x143a9f,null))[_0x3053('0x28')](function(_0x580b38){if(_0x580b38){_0x538906=_0x580b38;_0x31c581['model']=_[_0x3053('0x37')](db['User']['rawAttributes']);_0x31c581['query']=_[_0x3053('0x37')](_0x29743e['query']);_0x31c581[_0x3053('0x39')]=_[_0x3053('0x3b')](_0x31c581[_0x3053('0x35')],_0x31c581[_0x3053('0x38')]);_0x522559[_0x3053('0x3a')]=_[_0x3053('0x3b')](_0x31c581[_0x3053('0x35')],qs[_0x3053('0x3c')](_0x29743e[_0x3053('0x38')][_0x3053('0x3c')]));_0x522559[_0x3053('0x3a')]=_0x522559[_0x3053('0x3a')]['length']?_0x522559[_0x3053('0x3a')]:_0x31c581[_0x3053('0x35')];_0x522559[_0x3053('0x40')]=qs[_0x3053('0x41')](_0x29743e[_0x3053('0x38')]['sort']);_0x522559['where']=qs['filters'](_[_0x3053('0x43')](_0x29743e['query'],_0x31c581['filters']));if(_0x29743e[_0x3053('0x38')][_0x3053('0x44')]){_0x522559['where']=_[_0x3053('0x45')](_0x522559['where'],{'$or':_[_0x3053('0x36')](_0x522559[_0x3053('0x3a')],function(_0x410995){var _0x2e43ae={};_0x2e43ae[_0x410995]={'$like':'%'+_0x29743e['query'][_0x3053('0x44')]+'%'};return _0x2e43ae;})});}_0x522559=_[_0x3053('0x45')]({},_0x522559,_0x29743e['options']);return _0x538906[_0x3053('0x88')](_0x522559);}})[_0x3053('0x28')](function(_0x48baa8){if(_0x48baa8){_0x1e1625=_0x48baa8[_0x3053('0x3d')];if(!_0x29743e[_0x3053('0x38')]['hasOwnProperty'](_0x3053('0x3f'))){_0x522559[_0x3053('0x22')]=qs[_0x3053('0x22')](_0x29743e[_0x3053('0x38')]['limit']);_0x522559[_0x3053('0x21')]=qs[_0x3053('0x21')](_0x29743e[_0x3053('0x38')]['offset']);}return _0x538906['getAgents'](_0x522559);}})[_0x3053('0x28')](function(_0x37f73e){if(_0x37f73e){return _0x37f73e?{'count':_0x1e1625,'rows':_0x37f73e}:null;}})[_0x3053('0x28')](respondWithResult(_0x143a9f,null))[_0x3053('0x4b')](handleError(_0x143a9f,null));}; \ No newline at end of file +var _0x1ab8=['json','count','offset','set','then','get','Lists','destroy','error','name','send','index','map','CmList','rawAttributes','fieldName','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','merge','type','includeAll','include','findAll','rows','catch','keys','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','UserProfileResource','update','params','describe','addDisposition','ListId','getDispositions','findOne','Disposition','removeDispositions','ids','addContacts','tags','isArray','join','each','CmContact','omit','success','push','dataValues','message','Malformed\x20request\x20syntax','getContacts','CmCustomField','CustomFields','concat','format','cf_%d','raw','options','getContactsCsv','isEmpty','now','writeFileSync','/tmp/list_%d_%s.csv','Content-disposition','attachment;\x20filename=','setHeader','Content-type','text/csv','download','addCustomField','Sequelize','TEXT','BOOLEAN','defaultValue','queryInterface','addColumn','cm_contacts','cf_%s','getCustomFields','findAndCountAll','addAgents','spread','emit','userCmList:save','removeAgents','userCmList:remove','getAgents','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','redis','socket.io-emitter','register','sendStatus','end','status'];(function(_0x4c808f,_0x574779){var _0x4ff320=function(_0x4e2b0a){while(--_0x4e2b0a){_0x4c808f['push'](_0x4c808f['shift']());}};_0x4ff320(++_0x574779);}(_0x1ab8,0x17b));var _0x81ab=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x1ab8[_0x501510];return _0x1e6ee5;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x81ab('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x81ab('0x1'));var jsonpatch=require(_0x81ab('0x2'));var rp=require(_0x81ab('0x3'));var moment=require(_0x81ab('0x4'));var BPromise=require(_0x81ab('0x5'));var Mustache=require(_0x81ab('0x6'));var util=require('util');var path=require(_0x81ab('0x7'));var sox=require(_0x81ab('0x8'));var csv=require(_0x81ab('0x9'));var ejs=require(_0x81ab('0xa'));var fs=require('fs');var _=require(_0x81ab('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x81ab('0xc'));var toCsv=require(_0x81ab('0x9'));var querystring=require(_0x81ab('0xd'));var Papa=require(_0x81ab('0xe'));var Redis=require(_0x81ab('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x81ab('0x10'));var as=require(_0x81ab('0x11'));var hardwareService=require(_0x81ab('0x12'));var logger=require(_0x81ab('0x13'))('api');var utils=require(_0x81ab('0x14'));var config=require(_0x81ab('0x15'));var db=require(_0x81ab('0x16'))['db'];config['redis']=_['defaults'](config[_0x81ab('0x17')],{'host':'localhost','port':0x18eb});var socket=require(_0x81ab('0x18'))(new Redis(config[_0x81ab('0x17')]));require('./cmList.socket')[_0x81ab('0x19')](socket);function respondWithStatusCode(_0x2a62c1,_0x333924){_0x333924=_0x333924||0xcc;return function(_0x4b83d0){if(_0x4b83d0){return _0x2a62c1[_0x81ab('0x1a')](_0x333924);}return _0x2a62c1['status'](_0x333924)[_0x81ab('0x1b')]();};}function respondWithResult(_0x5128dc,_0x4af848){_0x4af848=_0x4af848||0xc8;return function(_0x511b3c){if(_0x511b3c){return _0x5128dc[_0x81ab('0x1c')](_0x4af848)[_0x81ab('0x1d')](_0x511b3c);}};}function respondWithFilteredResult(_0x5575f2,_0x1d7bf9){return function(_0x164cdd){if(_0x164cdd){var _0x18fe28=_0x164cdd[_0x81ab('0x1e')],_0x3ad441=_0x1d7bf9['offset'],_0x22581a=_0x1d7bf9[_0x81ab('0x1f')]+_0x1d7bf9['limit'],_0x8d0282;if(_0x22581a>=_0x18fe28){_0x22581a=_0x18fe28;_0x8d0282=0xc8;}else{_0x8d0282=0xce;}_0x5575f2[_0x81ab('0x1c')](_0x8d0282);return _0x5575f2[_0x81ab('0x20')]('Content-Range',_0x3ad441+'-'+_0x22581a+'/'+_0x18fe28)[_0x81ab('0x1d')](_0x164cdd);}return null;};}function patchUpdates(_0x51e82a){return function(_0x58ae14){try{jsonpatch['apply'](_0x58ae14,_0x51e82a,!![]);}catch(_0x16f6a1){return BPromise['reject'](_0x16f6a1);}return _0x58ae14['save']();};}function saveUpdates(_0x3b11a0,_0x1c9426){return function(_0x1a4b28){if(_0x1a4b28){return _0x1a4b28['update'](_0x3b11a0)[_0x81ab('0x21')](function(_0x271f7d){return _0x271f7d;});}return null;};}function removeEntity(_0x7ef796,_0x387d48){return function(_0x673315){if(_0x673315){return _0x673315['destroy']()[_0x81ab('0x21')](function(){var _0x513e92=_0x673315[_0x81ab('0x22')]({'plain':!![]});var _0x3cdb97=_0x81ab('0x23');return db['UserProfileResource'][_0x81ab('0x24')]({'where':{'type':_0x3cdb97,'resourceId':_0x513e92['id']}})[_0x81ab('0x21')](function(){return _0x673315;});})['then'](function(){_0x7ef796[_0x81ab('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0xdb6286,_0x54d7e3){return function(_0x305871){if(!_0x305871){_0xdb6286['sendStatus'](0x194);}return _0x305871;};}function handleError(_0x2904c2,_0x35533b){_0x35533b=_0x35533b||0x1f4;return function(_0x3caf6f){logger[_0x81ab('0x25')](_0x3caf6f['stack']);if(_0x3caf6f[_0x81ab('0x26')]){delete _0x3caf6f[_0x81ab('0x26')];}_0x2904c2[_0x81ab('0x1c')](_0x35533b)[_0x81ab('0x27')](_0x3caf6f);};}exports[_0x81ab('0x28')]=function(_0x340237,_0x95a250){var _0x2e157c={},_0xa541b4={},_0x4ce780={'count':0x0,'rows':[]};var _0x54c391=_[_0x81ab('0x29')](db[_0x81ab('0x2a')][_0x81ab('0x2b')],function(_0x25f6bf){return{'name':_0x25f6bf[_0x81ab('0x2c')],'type':_0x25f6bf['type'][_0x81ab('0x2d')]};});_0xa541b4[_0x81ab('0x2e')]=_['map'](_0x54c391,'name');_0xa541b4[_0x81ab('0x2f')]=_['keys'](_0x340237[_0x81ab('0x2f')]);_0xa541b4[_0x81ab('0x30')]=_[_0x81ab('0x31')](_0xa541b4[_0x81ab('0x2e')],_0xa541b4[_0x81ab('0x2f')]);_0x2e157c[_0x81ab('0x32')]=_[_0x81ab('0x31')](_0xa541b4['model'],qs[_0x81ab('0x33')](_0x340237[_0x81ab('0x2f')]['fields']));_0x2e157c['attributes']=_0x2e157c[_0x81ab('0x32')][_0x81ab('0x34')]?_0x2e157c[_0x81ab('0x32')]:_0xa541b4[_0x81ab('0x2e')];if(!_0x340237[_0x81ab('0x2f')][_0x81ab('0x35')](_0x81ab('0x36'))){_0x2e157c[_0x81ab('0x37')]=qs[_0x81ab('0x37')](_0x340237['query']['limit']);_0x2e157c['offset']=qs[_0x81ab('0x1f')](_0x340237[_0x81ab('0x2f')][_0x81ab('0x1f')]);}_0x2e157c[_0x81ab('0x38')]=qs[_0x81ab('0x39')](_0x340237[_0x81ab('0x2f')][_0x81ab('0x39')]);_0x2e157c[_0x81ab('0x3a')]=qs[_0x81ab('0x30')](_[_0x81ab('0x3b')](_0x340237[_0x81ab('0x2f')],_0xa541b4[_0x81ab('0x30')]),_0x54c391);if(_0x340237['query'][_0x81ab('0x3c')]){_0x2e157c['where']=_[_0x81ab('0x3d')](_0x2e157c[_0x81ab('0x3a')],{'$or':_['map'](_0x54c391,function(_0x30101f){if(_0x30101f[_0x81ab('0x3e')]!=='VIRTUAL'){var _0x51a492={};_0x51a492[_0x30101f[_0x81ab('0x26')]]={'$like':'%'+_0x340237['query'][_0x81ab('0x3c')]+'%'};return _0x51a492;}})});}_0x2e157c=_[_0x81ab('0x3d')]({},_0x2e157c,_0x340237['options']);var _0x3c142f={'where':_0x2e157c[_0x81ab('0x3a')]};return db[_0x81ab('0x2a')][_0x81ab('0x1e')](_0x3c142f)['then'](function(_0x44b63d){_0x4ce780[_0x81ab('0x1e')]=_0x44b63d;if(_0x340237[_0x81ab('0x2f')][_0x81ab('0x3f')]){_0x2e157c[_0x81ab('0x40')]=[{'all':!![]}];}return db[_0x81ab('0x2a')][_0x81ab('0x41')](_0x2e157c);})[_0x81ab('0x21')](function(_0x2b4358){_0x4ce780[_0x81ab('0x42')]=_0x2b4358;return _0x4ce780;})[_0x81ab('0x21')](respondWithFilteredResult(_0x95a250,_0x2e157c))[_0x81ab('0x43')](handleError(_0x95a250,null));};exports['show']=function(_0x4e465d,_0x2dbccc){var _0x23329c={'raw':![],'where':{'id':_0x4e465d['params']['id']}},_0x471a37={};_0x471a37['model']=_[_0x81ab('0x44')](db[_0x81ab('0x2a')]['rawAttributes']);_0x471a37['query']=_[_0x81ab('0x44')](_0x4e465d[_0x81ab('0x2f')]);_0x471a37[_0x81ab('0x30')]=_[_0x81ab('0x31')](_0x471a37[_0x81ab('0x2e')],_0x471a37[_0x81ab('0x2f')]);_0x23329c[_0x81ab('0x32')]=_[_0x81ab('0x31')](_0x471a37[_0x81ab('0x2e')],qs[_0x81ab('0x33')](_0x4e465d[_0x81ab('0x2f')][_0x81ab('0x33')]));_0x23329c['attributes']=_0x23329c['attributes']['length']?_0x23329c['attributes']:_0x471a37[_0x81ab('0x2e')];if(_0x4e465d[_0x81ab('0x2f')][_0x81ab('0x3f')]){_0x23329c[_0x81ab('0x40')]=[{'all':!![]}];}_0x23329c=_['merge']({},_0x23329c,_0x4e465d['options']);return db[_0x81ab('0x2a')][_0x81ab('0x45')](_0x23329c)[_0x81ab('0x21')](handleEntityNotFound(_0x2dbccc,null))['then'](respondWithResult(_0x2dbccc,null))['catch'](handleError(_0x2dbccc,null));};exports[_0x81ab('0x46')]=function(_0x46aa44,_0x177379){return db[_0x81ab('0x2a')][_0x81ab('0x46')](_0x46aa44[_0x81ab('0x47')],{})['then'](function(_0x2650d4){var _0x4a44ab=_0x46aa44[_0x81ab('0x48')][_0x81ab('0x22')]({'plain':!![]});if(!_0x4a44ab)throw new Error(_0x81ab('0x49'));if(_0x4a44ab[_0x81ab('0x4a')]===_0x81ab('0x48')){var _0x2dfac6=_0x2650d4[_0x81ab('0x22')]({'plain':!![]});var _0x55226f=_0x81ab('0x23');return db[_0x81ab('0x4b')][_0x81ab('0x45')]({'where':{'name':_0x55226f,'userProfileId':_0x4a44ab['userProfileId']},'raw':!![]})['then'](function(_0x2a356f){if(_0x2a356f&&_0x2a356f['autoAssociation']===0x0){return db[_0x81ab('0x4c')][_0x81ab('0x46')]({'name':_0x2dfac6['name'],'resourceId':_0x2dfac6['id'],'type':_0x2a356f['name'],'sectionId':_0x2a356f['id']},{})[_0x81ab('0x21')](function(){return _0x2650d4;});}else{return _0x2650d4;}})[_0x81ab('0x43')](function(_0x515017){logger[_0x81ab('0x25')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x515017);throw _0x515017;});}return _0x2650d4;})[_0x81ab('0x21')](respondWithResult(_0x177379,0xc9))['catch'](handleError(_0x177379,null));};exports[_0x81ab('0x4d')]=function(_0x47c818,_0x4d33f2){if(_0x47c818[_0x81ab('0x47')]['id']){delete _0x47c818[_0x81ab('0x47')]['id'];}return db['CmList'][_0x81ab('0x45')]({'where':{'id':_0x47c818[_0x81ab('0x4e')]['id']}})[_0x81ab('0x21')](handleEntityNotFound(_0x4d33f2,null))[_0x81ab('0x21')](saveUpdates(_0x47c818['body'],null))['then'](respondWithResult(_0x4d33f2,null))['catch'](handleError(_0x4d33f2,null));};exports['destroy']=function(_0x434419,_0x3188ae){return db['CmList'][_0x81ab('0x45')]({'where':{'id':_0x434419['params']['id']}})[_0x81ab('0x21')](handleEntityNotFound(_0x3188ae,null))[_0x81ab('0x21')](removeEntity(_0x3188ae,null))[_0x81ab('0x43')](handleError(_0x3188ae,null));};exports[_0x81ab('0x4f')]=function(_0x38065a,_0x1f594c){return db['CmList']['describe']()[_0x81ab('0x21')](respondWithResult(_0x1f594c,null))[_0x81ab('0x43')](handleError(_0x1f594c,null));};exports[_0x81ab('0x50')]=function(_0x36995f,_0x583048,_0x515ec8){if(_0x36995f[_0x81ab('0x47')]['id']){delete _0x36995f[_0x81ab('0x47')]['id'];}return db['CmList'][_0x81ab('0x45')]({'where':{'id':_0x36995f[_0x81ab('0x4e')]['id']}})[_0x81ab('0x21')](handleEntityNotFound(_0x583048,null))[_0x81ab('0x21')](function(_0x48c59e){if(_0x48c59e){_0x36995f[_0x81ab('0x47')][_0x81ab('0x51')]=_0x48c59e['id'];return db['Disposition'][_0x81ab('0x46')](_0x36995f[_0x81ab('0x47')]);}})[_0x81ab('0x21')](respondWithResult(_0x583048,null))['catch'](handleError(_0x583048,null));};exports[_0x81ab('0x52')]=function(_0x3bb4c5,_0x2d091d,_0x54e015){var _0xb4a095={'raw':![],'where':{}};var _0x369b40={};var _0x1c82d5={'count':0x0,'rows':[]};return db['CmList'][_0x81ab('0x53')]({'where':{'id':_0x3bb4c5['params']['id']}})['then'](handleEntityNotFound(_0x2d091d,null))[_0x81ab('0x21')](function(_0x367d55){if(_0x367d55){_0x369b40[_0x81ab('0x2e')]=_['keys'](db['Disposition'][_0x81ab('0x2b')]);_0x369b40[_0x81ab('0x2f')]=_[_0x81ab('0x44')](_0x3bb4c5[_0x81ab('0x2f')]);_0x369b40[_0x81ab('0x30')]=_[_0x81ab('0x31')](_0x369b40[_0x81ab('0x2e')],_0x369b40[_0x81ab('0x2f')]);_0xb4a095[_0x81ab('0x32')]=_['intersection'](_0x369b40[_0x81ab('0x2e')],qs[_0x81ab('0x33')](_0x3bb4c5[_0x81ab('0x2f')][_0x81ab('0x33')]));_0xb4a095[_0x81ab('0x32')]=_0xb4a095[_0x81ab('0x32')][_0x81ab('0x34')]?_0xb4a095[_0x81ab('0x32')]:_0x369b40['model'];if(!_0x3bb4c5['query'][_0x81ab('0x35')](_0x81ab('0x36'))){_0xb4a095['limit']=qs[_0x81ab('0x37')](_0x3bb4c5[_0x81ab('0x2f')][_0x81ab('0x37')]);_0xb4a095[_0x81ab('0x1f')]=qs[_0x81ab('0x1f')](_0x3bb4c5['query'][_0x81ab('0x1f')]);}_0xb4a095[_0x81ab('0x38')]=qs[_0x81ab('0x39')](_0x3bb4c5['query'][_0x81ab('0x39')]);_0xb4a095['where']=qs['filters'](_[_0x81ab('0x3b')](_0x3bb4c5[_0x81ab('0x2f')],_0x369b40['filters']));_0xb4a095[_0x81ab('0x3a')][_0x81ab('0x51')]=_0x367d55['id'];if(_0x3bb4c5[_0x81ab('0x2f')][_0x81ab('0x3c')]){_0xb4a095[_0x81ab('0x3a')]=_[_0x81ab('0x3d')](_0xb4a095['where'],{'$or':_[_0x81ab('0x29')](_0xb4a095[_0x81ab('0x32')],function(_0x2c98d0){var _0x4c02a6={};_0x4c02a6[_0x2c98d0]={'$like':'%'+_0x3bb4c5[_0x81ab('0x2f')][_0x81ab('0x3c')]+'%'};return _0x4c02a6;})});}_0xb4a095=_[_0x81ab('0x3d')]({},_0xb4a095,_0x3bb4c5['options']);return db[_0x81ab('0x54')][_0x81ab('0x1e')]({'where':_0xb4a095[_0x81ab('0x3a')]})[_0x81ab('0x21')](function(_0x362c63){_0x1c82d5[_0x81ab('0x1e')]=_0x362c63;if(_0x3bb4c5[_0x81ab('0x2f')][_0x81ab('0x3f')]){_0xb4a095[_0x81ab('0x40')]=[{'all':!![]}];}return db['Disposition'][_0x81ab('0x41')](_0xb4a095);})[_0x81ab('0x21')](function(_0xe82610){_0x1c82d5['rows']=_0xe82610;return _0x1c82d5;});}})[_0x81ab('0x21')](respondWithFilteredResult(_0x2d091d,_0xb4a095))[_0x81ab('0x43')](handleError(_0x2d091d,null));};exports[_0x81ab('0x55')]=function(_0x23330b,_0x314492,_0xff23cd){return db[_0x81ab('0x2a')][_0x81ab('0x45')]({'where':{'id':_0x23330b[_0x81ab('0x4e')]['id']}})[_0x81ab('0x21')](handleEntityNotFound(_0x314492,null))['then'](function(_0xc74d12){if(_0xc74d12){return _0xc74d12[_0x81ab('0x55')](_0x23330b[_0x81ab('0x2f')][_0x81ab('0x56')]);}})['then'](respondWithStatusCode(_0x314492,null))[_0x81ab('0x43')](handleError(_0x314492,null));};exports[_0x81ab('0x57')]=function(_0x16d849,_0x382da1,_0x3e5434){return db[_0x81ab('0x2a')][_0x81ab('0x45')]({'where':{'id':_0x16d849[_0x81ab('0x4e')]['id']}})['then'](handleEntityNotFound(_0x382da1,null))[_0x81ab('0x21')](function(_0xade6e2){if(_0xade6e2){var _0x53d25f=[];var _0x357693={'success':[],'errors':[]};return db['CmContact'][_0x81ab('0x4f')]()[_0x81ab('0x21')](function(_0x39c51d){if(_0x16d849[_0x81ab('0x47')][_0x81ab('0x58')]&&_[_0x81ab('0x59')](_0x16d849['body']['tags'])){if(_0x16d849[_0x81ab('0x47')][_0x81ab('0x58')][_0x81ab('0x34')]){_0x16d849[_0x81ab('0x47')][_0x81ab('0x58')]=_0x16d849[_0x81ab('0x47')][_0x81ab('0x58')][_0x81ab('0x5a')](';')+';';}else{_0x16d849['body'][_0x81ab('0x58')]=null;}}else{_0x16d849[_0x81ab('0x47')][_0x81ab('0x58')]=null;}if(_0x16d849[_0x81ab('0x47')]&&_['isArray'](_0x16d849[_0x81ab('0x47')])){for(var _0x5157c6=0x0;_0x5157c6<_0x16d849['body'][_0x81ab('0x34')];_0x5157c6+=0x1){_0x16d849['body'][_0x5157c6][_0x81ab('0x51')]=_0x16d849[_0x81ab('0x4e')]['id'];_0x53d25f['push'](_0x16d849[_0x81ab('0x47')][_0x5157c6]);}return BPromise[_0x81ab('0x5b')](_0x53d25f,function(_0x2e7edd){return db[_0x81ab('0x5c')]['create'](_[_0x81ab('0x5d')](_0x2e7edd,[_0x81ab('0x56'),'id'])||{},{'fields':_[_0x81ab('0x44')](_0x39c51d),'raw':!![]})[_0x81ab('0x21')](function(_0x4fb7b5){_0x357693[_0x81ab('0x5e')][_0x81ab('0x5f')](_0x4fb7b5[_0x81ab('0x60')]);})[_0x81ab('0x43')](function(_0x5411c5){_0x357693['errors']['push']({'data':_0x2e7edd,'error':_0x5411c5[_0x81ab('0x61')]});});})[_0x81ab('0x21')](function(_0x619af5){return _0x357693;})['catch'](function(_0x535d57){return _0x535d57;});}else{_0x382da1[_0x81ab('0x1c')](0x190)[_0x81ab('0x1d')]({'message':_0x81ab('0x62')});}});}})[_0x81ab('0x21')](respondWithResult(_0x382da1,null))[_0x81ab('0x43')](handleError(_0x382da1,null));};exports[_0x81ab('0x63')]=function(_0x4a04db,_0x290b15,_0x23146c){var _0x2bec97;return db[_0x81ab('0x2a')][_0x81ab('0x45')]({'where':{'id':_0x4a04db['params']['id']},'include':[{'model':db[_0x81ab('0x64')],'as':_0x81ab('0x65')}]})[_0x81ab('0x21')](handleEntityNotFound(_0x290b15,null))[_0x81ab('0x21')](function(_0x854214){if(_0x854214){_0x2bec97=_0x854214;return db[_0x81ab('0x5c')]['rawAttributes'];}})[_0x81ab('0x21')](function(_0x387889){if(_0x387889){var _0x6821c3={};var _0x327517={};_0x327517[_0x81ab('0x2e')]=_[_0x81ab('0x66')](_[_0x81ab('0x44')](_0x387889),_[_0x81ab('0x29')](_0x2bec97[_0x81ab('0x65')],function(_0x3e8e8a){return util[_0x81ab('0x67')](_0x81ab('0x68'),_0x3e8e8a['id']);}));_0x327517[_0x81ab('0x2f')]=_[_0x81ab('0x44')](_0x4a04db[_0x81ab('0x2f')]);_0x327517[_0x81ab('0x30')]=_[_0x81ab('0x31')](_0x327517[_0x81ab('0x2e')],_0x327517['query']);_0x6821c3[_0x81ab('0x32')]=_[_0x81ab('0x31')](_0x327517[_0x81ab('0x2e')],qs[_0x81ab('0x33')](_0x4a04db[_0x81ab('0x2f')]['fields']));_0x6821c3[_0x81ab('0x32')]=_0x6821c3[_0x81ab('0x32')]['length']?_0x6821c3[_0x81ab('0x32')]:_0x327517[_0x81ab('0x2e')];if(!_0x4a04db[_0x81ab('0x2f')][_0x81ab('0x35')]('nolimit')){_0x6821c3[_0x81ab('0x37')]=qs[_0x81ab('0x37')](_0x4a04db[_0x81ab('0x2f')][_0x81ab('0x37')]);_0x6821c3[_0x81ab('0x1f')]=qs[_0x81ab('0x1f')](_0x4a04db[_0x81ab('0x2f')][_0x81ab('0x1f')]);}_0x6821c3[_0x81ab('0x38')]=qs[_0x81ab('0x39')](_0x4a04db[_0x81ab('0x2f')][_0x81ab('0x39')]);_0x6821c3[_0x81ab('0x3a')]=qs[_0x81ab('0x30')](_[_0x81ab('0x3b')](_0x4a04db[_0x81ab('0x2f')],_0x327517['filters']));_0x6821c3[_0x81ab('0x69')]=!![];if(_0x4a04db[_0x81ab('0x2f')][_0x81ab('0x3c')]){_0x6821c3['where']=_[_0x81ab('0x3d')](_0x6821c3[_0x81ab('0x3a')],{'$or':_[_0x81ab('0x29')](_0x6821c3[_0x81ab('0x32')],function(_0x2c33f3){var _0x20d318={};_0x20d318[_0x2c33f3]={'$like':'%'+_0x4a04db[_0x81ab('0x2f')]['filter']+'%'};return _0x20d318;})});}_0x6821c3=_[_0x81ab('0x3d')]({},_0x6821c3,_0x4a04db[_0x81ab('0x6a')]);return _0x2bec97['getContacts'](_0x6821c3);}})[_0x81ab('0x21')](respondWithResult(_0x290b15,null))['catch'](handleError(_0x290b15,null));};exports[_0x81ab('0x6b')]=function(_0x1d6372,_0x54a0de,_0xd92eaf){var _0x2d3515;return db[_0x81ab('0x2a')]['find']({'where':{'id':_0x1d6372[_0x81ab('0x4e')]['id']},'include':[{'model':db['CmCustomField'],'as':_0x81ab('0x65')}]})['then'](handleEntityNotFound(_0x54a0de,null))['then'](function(_0x5c00f7){if(_0x5c00f7){_0x2d3515=_0x5c00f7;return db['CmContact'][_0x81ab('0x2b')];}})[_0x81ab('0x21')](function(_0x151506){if(_0x151506){var _0xf83b35={};var _0x19fa34={};_0x19fa34['model']=_['concat'](_[_0x81ab('0x44')](_0x151506),_[_0x81ab('0x29')](_0x2d3515[_0x81ab('0x65')],function(_0xa3dfb9){return util[_0x81ab('0x67')](_0x81ab('0x68'),_0xa3dfb9['id']);}));_0x19fa34[_0x81ab('0x2f')]=_['keys'](_0x1d6372[_0x81ab('0x2f')]);_0x19fa34[_0x81ab('0x30')]=_[_0x81ab('0x31')](_0x19fa34[_0x81ab('0x2e')],_0x19fa34[_0x81ab('0x2f')]);_0xf83b35[_0x81ab('0x32')]=_[_0x81ab('0x31')](_0x19fa34[_0x81ab('0x2e')],qs[_0x81ab('0x33')](_0x1d6372[_0x81ab('0x2f')]['fields']));_0xf83b35[_0x81ab('0x32')]=_0xf83b35[_0x81ab('0x32')]['length']?_0xf83b35[_0x81ab('0x32')]:_0x19fa34[_0x81ab('0x2e')];if(!_0x1d6372[_0x81ab('0x2f')][_0x81ab('0x35')]('nolimit')){_0xf83b35[_0x81ab('0x37')]=qs[_0x81ab('0x37')](_0x1d6372['query']['limit']);_0xf83b35[_0x81ab('0x1f')]=qs[_0x81ab('0x1f')](_0x1d6372['query'][_0x81ab('0x1f')]);}_0xf83b35[_0x81ab('0x38')]=qs[_0x81ab('0x39')](_0x1d6372[_0x81ab('0x2f')][_0x81ab('0x39')]);_0xf83b35['where']=qs[_0x81ab('0x30')](_[_0x81ab('0x3b')](_0x1d6372[_0x81ab('0x2f')],_0x19fa34[_0x81ab('0x30')]));_0xf83b35['raw']=!![];if(_0x1d6372['query'][_0x81ab('0x3c')]){_0xf83b35[_0x81ab('0x3a')]=_[_0x81ab('0x3d')](_0xf83b35['where'],{'$or':_['map'](_0xf83b35['attributes'],function(_0x5accca){var _0x1c2d04={};_0x1c2d04[_0x5accca]={'$like':'%'+_0x1d6372['query'][_0x81ab('0x3c')]+'%'};return _0x1c2d04;})});}_0xf83b35=_[_0x81ab('0x3d')]({},_0xf83b35,_0x1d6372['options']);return _0x2d3515[_0x81ab('0x63')](_0xf83b35);}})[_0x81ab('0x21')](function(_0x31df63){if(!_[_0x81ab('0x6c')](_0x31df63)){var _0x50b30c=toCsv(_0x31df63);var _0x485194=Date[_0x81ab('0x6d')]();fs[_0x81ab('0x6e')](util[_0x81ab('0x67')](_0x81ab('0x6f'),_0x2d3515['id'],_0x485194),_0x50b30c);_0x54a0de['setHeader'](_0x81ab('0x70'),_0x81ab('0x71')+util[_0x81ab('0x67')]('list_%d_%s.csv',_0x2d3515['id'],_0x485194));_0x54a0de[_0x81ab('0x72')](_0x81ab('0x73'),_0x81ab('0x74'));return _0x54a0de[_0x81ab('0x75')](util[_0x81ab('0x67')](_0x81ab('0x6f'),_0x2d3515['id'],_0x485194));}else{return _0x54a0de[_0x81ab('0x1a')](0xcc);}})['catch'](handleError(_0x54a0de,null));};exports[_0x81ab('0x76')]=function(_0x296f4f,_0x4463e5,_0x39868a){var _0x42e174;delete _0x296f4f['body']['id'];return db[_0x81ab('0x2a')][_0x81ab('0x53')]({'where':{'id':_0x296f4f['params']['id']}})[_0x81ab('0x21')](handleEntityNotFound(_0x4463e5,null))[_0x81ab('0x21')](function(_0x2259f7){if(_0x2259f7){return db['sequelize']['transaction'](function(_0x34e513){return db[_0x81ab('0x64')][_0x81ab('0x46')](_0x296f4f[_0x81ab('0x47')],{'transaction':_0x34e513})[_0x81ab('0x21')](function(_0x372d13){_0x42e174=_0x372d13;return _0x2259f7['addCustomFields'](_0x372d13,{'transaction':_0x34e513});})['then'](function(){var _0x4c56b8={'type':db[_0x81ab('0x77')][_0x81ab('0x78')],'transaction':_0x34e513};switch(_0x296f4f[_0x81ab('0x47')][_0x81ab('0x3e')]){case'text':_0x4c56b8[_0x81ab('0x3e')]=db[_0x81ab('0x77')][_0x81ab('0x78')];break;case'number':_0x4c56b8[_0x81ab('0x3e')]=db['Sequelize']['INTEGER'];break;case'switch':_0x4c56b8[_0x81ab('0x3e')]=db[_0x81ab('0x77')][_0x81ab('0x79')];_0x4c56b8[_0x81ab('0x7a')]=![];break;default:}return db['sequelize'][_0x81ab('0x7b')][_0x81ab('0x7c')](_0x81ab('0x7d'),util['format'](_0x81ab('0x7e'),_0x42e174['id']),_0x4c56b8);})[_0x81ab('0x21')](function(){return _0x42e174;});});}})[_0x81ab('0x21')](respondWithResult(_0x4463e5,null))[_0x81ab('0x43')](handleError(_0x4463e5,null));};exports[_0x81ab('0x7f')]=function(_0x46b28c,_0x49ee13,_0x32e1e6){var _0x407829={};var _0x52ffcf={};var _0x532137;var _0x17bd96;return db['CmList'][_0x81ab('0x53')]({'where':{'id':_0x46b28c[_0x81ab('0x4e')]['id']}})[_0x81ab('0x21')](handleEntityNotFound(_0x49ee13,null))[_0x81ab('0x21')](function(_0x19b351){if(_0x19b351){_0x532137=_0x19b351;_0x52ffcf[_0x81ab('0x2e')]=_['keys'](db[_0x81ab('0x64')][_0x81ab('0x2b')]);_0x52ffcf[_0x81ab('0x2f')]=_[_0x81ab('0x44')](_0x46b28c[_0x81ab('0x2f')]);_0x52ffcf[_0x81ab('0x30')]=_[_0x81ab('0x31')](_0x52ffcf[_0x81ab('0x2e')],_0x52ffcf[_0x81ab('0x2f')]);_0x407829[_0x81ab('0x32')]=_[_0x81ab('0x31')](_0x52ffcf[_0x81ab('0x2e')],qs[_0x81ab('0x33')](_0x46b28c[_0x81ab('0x2f')][_0x81ab('0x33')]));_0x407829[_0x81ab('0x32')]=_0x407829[_0x81ab('0x32')]['length']?_0x407829[_0x81ab('0x32')]:_0x52ffcf[_0x81ab('0x2e')];_0x407829['order']=qs[_0x81ab('0x39')](_0x46b28c[_0x81ab('0x2f')][_0x81ab('0x39')]);_0x407829[_0x81ab('0x3a')]=qs[_0x81ab('0x30')](_[_0x81ab('0x3b')](_0x46b28c['query'],_0x52ffcf[_0x81ab('0x30')]));_0x407829['where']=_[_0x81ab('0x3d')](_0x407829[_0x81ab('0x3a')],{'$or':[{'ListId':_0x19b351['id']},{'ListId':null}]});if(_0x46b28c['query'][_0x81ab('0x3c')]){_0x407829[_0x81ab('0x3a')]=_['merge'](_0x407829['where'],{'$or':_[_0x81ab('0x29')](_0x407829['attributes'],function(_0x5318ab){var _0xd002a8={};_0xd002a8[_0x5318ab]={'$like':'%'+_0x46b28c[_0x81ab('0x2f')][_0x81ab('0x3c')]+'%'};return _0xd002a8;})});}_0x407829=_[_0x81ab('0x3d')]({},_0x407829,_0x46b28c[_0x81ab('0x6a')]);return db[_0x81ab('0x64')][_0x81ab('0x80')](_0x407829);}})[_0x81ab('0x21')](respondWithResult(_0x49ee13,null))['catch'](handleError(_0x49ee13,null));};exports[_0x81ab('0x81')]=function(_0x25251d,_0x41419a,_0xf83adc){return db[_0x81ab('0x2a')][_0x81ab('0x45')]({'where':{'id':_0x25251d[_0x81ab('0x4e')]['id']}})[_0x81ab('0x21')](handleEntityNotFound(_0x41419a,null))[_0x81ab('0x21')](function(_0x32ff7f){if(_0x32ff7f){return _0x32ff7f[_0x81ab('0x81')](_0x25251d['body'][_0x81ab('0x56')],_['omit'](_0x25251d[_0x81ab('0x47')],[_0x81ab('0x56'),'id'])||{})[_0x81ab('0x82')](function(_0x5082a6){for(var _0x1f893b=0x0;_0x1f893b<_0x25251d['body'][_0x81ab('0x56')][_0x81ab('0x34')];_0x1f893b+=0x1){socket[_0x81ab('0x83')](_0x81ab('0x84'),{'UserId':_0x25251d[_0x81ab('0x47')][_0x81ab('0x56')][_0x1f893b],'CmListId':_0x25251d['params']['id']});}return _0x5082a6;});}})[_0x81ab('0x21')](respondWithResult(_0x41419a,null))[_0x81ab('0x43')](handleError(_0x41419a,null));};exports[_0x81ab('0x85')]=function(_0x207425,_0x3b3186,_0x5174cf){return db[_0x81ab('0x2a')][_0x81ab('0x45')]({'where':{'id':_0x207425[_0x81ab('0x4e')]['id']}})[_0x81ab('0x21')](handleEntityNotFound(_0x3b3186,null))[_0x81ab('0x21')](function(_0x53b0d3){if(_0x53b0d3){return _0x53b0d3[_0x81ab('0x85')](_0x207425[_0x81ab('0x2f')][_0x81ab('0x56')])[_0x81ab('0x21')](function(){if(_[_0x81ab('0x59')](_0x207425[_0x81ab('0x2f')][_0x81ab('0x56')])){for(var _0x56fe3b=0x0;_0x56fe3b<_0x207425[_0x81ab('0x2f')][_0x81ab('0x56')]['length'];_0x56fe3b+=0x1){socket['emit'](_0x81ab('0x86'),{'UserId':Number(_0x207425[_0x81ab('0x2f')][_0x81ab('0x56')][_0x56fe3b]),'CmListId':Number(_0x207425[_0x81ab('0x4e')]['id'])});}}else{socket[_0x81ab('0x83')](_0x81ab('0x86'),{'UserId':Number(_0x207425['query']['ids']),'CmListId':Number(_0x207425['params']['id'])});}});}})['then'](respondWithStatusCode(_0x3b3186,null))['catch'](handleError(_0x3b3186,null));};exports[_0x81ab('0x87')]=function(_0xfcd308,_0x4068c4,_0x463f16){var _0x551f2d={};var _0xb8ebe9={};var _0x283555;var _0x194c98;return db['CmList'][_0x81ab('0x53')]({'where':{'id':_0xfcd308['params']['id']}})['then'](handleEntityNotFound(_0x4068c4,null))[_0x81ab('0x21')](function(_0xa01d94){if(_0xa01d94){_0x283555=_0xa01d94;_0xb8ebe9['model']=_[_0x81ab('0x44')](db['User'][_0x81ab('0x2b')]);_0xb8ebe9[_0x81ab('0x2f')]=_[_0x81ab('0x44')](_0xfcd308[_0x81ab('0x2f')]);_0xb8ebe9['filters']=_[_0x81ab('0x31')](_0xb8ebe9[_0x81ab('0x2e')],_0xb8ebe9['query']);_0x551f2d[_0x81ab('0x32')]=_[_0x81ab('0x31')](_0xb8ebe9[_0x81ab('0x2e')],qs[_0x81ab('0x33')](_0xfcd308[_0x81ab('0x2f')][_0x81ab('0x33')]));_0x551f2d[_0x81ab('0x32')]=_0x551f2d[_0x81ab('0x32')][_0x81ab('0x34')]?_0x551f2d[_0x81ab('0x32')]:_0xb8ebe9[_0x81ab('0x2e')];_0x551f2d[_0x81ab('0x38')]=qs[_0x81ab('0x39')](_0xfcd308[_0x81ab('0x2f')]['sort']);_0x551f2d[_0x81ab('0x3a')]=qs[_0x81ab('0x30')](_[_0x81ab('0x3b')](_0xfcd308[_0x81ab('0x2f')],_0xb8ebe9['filters']));if(_0xfcd308[_0x81ab('0x2f')][_0x81ab('0x3c')]){_0x551f2d[_0x81ab('0x3a')]=_[_0x81ab('0x3d')](_0x551f2d[_0x81ab('0x3a')],{'$or':_[_0x81ab('0x29')](_0x551f2d['attributes'],function(_0x2d5d22){var _0x22db7e={};_0x22db7e[_0x2d5d22]={'$like':'%'+_0xfcd308[_0x81ab('0x2f')]['filter']+'%'};return _0x22db7e;})});}_0x551f2d=_[_0x81ab('0x3d')]({},_0x551f2d,_0xfcd308[_0x81ab('0x6a')]);return _0x283555[_0x81ab('0x87')](_0x551f2d);}})['then'](function(_0x57a67e){if(_0x57a67e){_0x194c98=_0x57a67e[_0x81ab('0x34')];if(!_0xfcd308[_0x81ab('0x2f')][_0x81ab('0x35')](_0x81ab('0x36'))){_0x551f2d[_0x81ab('0x37')]=qs[_0x81ab('0x37')](_0xfcd308[_0x81ab('0x2f')][_0x81ab('0x37')]);_0x551f2d[_0x81ab('0x1f')]=qs[_0x81ab('0x1f')](_0xfcd308[_0x81ab('0x2f')][_0x81ab('0x1f')]);}return _0x283555[_0x81ab('0x87')](_0x551f2d);}})[_0x81ab('0x21')](function(_0x406e3a){if(_0x406e3a){return _0x406e3a?{'count':_0x194c98,'rows':_0x406e3a}:null;}})[_0x81ab('0x21')](respondWithResult(_0x4068c4,null))['catch'](handleError(_0x4068c4,null));}; \ No newline at end of file diff --git a/server/api/cmList/cmList.events.js b/server/api/cmList/cmList.events.js index 1dc02e6..9682915 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 _0x2e36=['hasOwnProperty','exports','events','../../mysqldb','setMaxListeners','save','update'];(function(_0xf6e75d,_0xc70967){var _0x27514d=function(_0xc2c6dd){while(--_0xc2c6dd){_0xf6e75d['push'](_0xf6e75d['shift']());}};_0x27514d(++_0xc70967);}(_0x2e36,0xd4));var _0x62e3=function(_0x47ead2,_0xfb55ad){_0x47ead2=_0x47ead2-0x0;var _0x4a54e8=_0x2e36[_0x47ead2];return _0x4a54e8;};'use strict';var EventEmitter=require(_0x62e3('0x0'));var CmList=require(_0x62e3('0x1'))['db']['CmList'];var CmListEvents=new EventEmitter();CmListEvents[_0x62e3('0x2')](0x0);var events={'afterCreate':_0x62e3('0x3'),'afterUpdate':_0x62e3('0x4'),'afterDestroy':'remove'};function emitEvent(_0xbb7b20){return function(_0x790fdc,_0x5b242c,_0x319aa8){CmListEvents['emit'](_0xbb7b20+':'+_0x790fdc['id'],_0x790fdc);CmListEvents['emit'](_0xbb7b20,_0x790fdc);_0x319aa8(null);};}for(var e in events){if(events[_0x62e3('0x5')](e)){var event=events[e];CmList['hook'](e,emitEvent(event));}}module[_0x62e3('0x6')]=CmListEvents; \ No newline at end of file +var _0x2cba=['update','remove','emit','hasOwnProperty','events','../../mysqldb','CmList','setMaxListeners','save'];(function(_0x114db7,_0x3c3d4b){var _0x391c20=function(_0x2c9a57){while(--_0x2c9a57){_0x114db7['push'](_0x114db7['shift']());}};_0x391c20(++_0x3c3d4b);}(_0x2cba,0xaf));var _0xa2cb=function(_0x428802,_0x31689d){_0x428802=_0x428802-0x0;var _0x11be43=_0x2cba[_0x428802];return _0x11be43;};'use strict';var EventEmitter=require(_0xa2cb('0x0'));var CmList=require(_0xa2cb('0x1'))['db'][_0xa2cb('0x2')];var CmListEvents=new EventEmitter();CmListEvents[_0xa2cb('0x3')](0x0);var events={'afterCreate':_0xa2cb('0x4'),'afterUpdate':_0xa2cb('0x5'),'afterDestroy':_0xa2cb('0x6')};function emitEvent(_0x175e4d){return function(_0x3802c5,_0x42f7dd,_0xa44540){CmListEvents[_0xa2cb('0x7')](_0x175e4d+':'+_0x3802c5['id'],_0x3802c5);CmListEvents[_0xa2cb('0x7')](_0x175e4d,_0x3802c5);_0xa44540(null);};}for(var e in events){if(events[_0xa2cb('0x8')](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 fb59679..4b90462 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 _0x57d2=['define','CmList','cm_lists','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./cmList.attributes','exports'];(function(_0x2ac41e,_0x1a5137){var _0x3e0589=function(_0x2b9b01){while(--_0x2b9b01){_0x2ac41e['push'](_0x2ac41e['shift']());}};_0x3e0589(++_0x1a5137);}(_0x57d2,0x65));var _0x257d=function(_0x113f32,_0x4b7c3a){_0x113f32=_0x113f32-0x0;var _0x4a6ec5=_0x57d2[_0x113f32];return _0x4a6ec5;};'use strict';var _=require(_0x257d('0x0'));var util=require(_0x257d('0x1'));var logger=require(_0x257d('0x2'))(_0x257d('0x3'));var moment=require(_0x257d('0x4'));var BPromise=require('bluebird');var rp=require(_0x257d('0x5'));var fs=require('fs');var path=require(_0x257d('0x6'));var rimraf=require(_0x257d('0x7'));var config=require(_0x257d('0x8'));var attributes=require(_0x257d('0x9'));module[_0x257d('0xa')]=function(_0xda71d1,_0x3a52eb){return _0xda71d1[_0x257d('0xb')](_0x257d('0xc'),attributes,{'tableName':_0x257d('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7e07=['api','bluebird','request-promise','path','../../config/environment','exports','define','CmList','lodash','util','../../config/logger'];(function(_0x341e52,_0x1ee60c){var _0x5d2890=function(_0x5ce075){while(--_0x5ce075){_0x341e52['push'](_0x341e52['shift']());}};_0x5d2890(++_0x1ee60c);}(_0x7e07,0x15d));var _0x77e0=function(_0x246f80,_0x3e1148){_0x246f80=_0x246f80-0x0;var _0x5dd512=_0x7e07[_0x246f80];return _0x5dd512;};'use strict';var _=require(_0x77e0('0x0'));var util=require(_0x77e0('0x1'));var logger=require(_0x77e0('0x2'))(_0x77e0('0x3'));var moment=require('moment');var BPromise=require(_0x77e0('0x4'));var rp=require(_0x77e0('0x5'));var fs=require('fs');var path=require(_0x77e0('0x6'));var rimraf=require('rimraf');var config=require(_0x77e0('0x7'));var attributes=require('./cmList.attributes');module[_0x77e0('0x8')]=function(_0x39b3e1,_0x528077){return _0x39b3e1[_0x77e0('0x9')](_0x77e0('0xa'),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 8ce821a..6718bf1 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 _0xd651=['rpc','../../config/environment','jayson/promise','client','http','defaults','localhost','register','request','then','info','CmList,\x20%s,\x20%s','debug','stringify','error','message','request\x20sent','result','catch','lodash','util','moment','randomstring','../../mysqldb','../../config/logger'];(function(_0x3b33fc,_0x211491){var _0x1c2e91=function(_0x1d431f){while(--_0x1d431f){_0x3b33fc['push'](_0x3b33fc['shift']());}};_0x1c2e91(++_0x211491);}(_0xd651,0x18a));var _0x1d65=function(_0xe25179,_0x58199e){_0xe25179=_0xe25179-0x0;var _0x3ee18f=_0xd651[_0xe25179];return _0x3ee18f;};'use strict';var _=require(_0x1d65('0x0'));var util=require(_0x1d65('0x1'));var moment=require(_0x1d65('0x2'));var BPromise=require('bluebird');var rs=require(_0x1d65('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x1d65('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x1d65('0x5'))(_0x1d65('0x6'));var config=require(_0x1d65('0x7'));var jayson=require(_0x1d65('0x8'));var client=jayson[_0x1d65('0x9')][_0x1d65('0xa')]({'port':0x232a});config['redis']=_[_0x1d65('0xb')](config['redis'],{'host':_0x1d65('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require('./cmList.socket')[_0x1d65('0xd')](socket);function respondWithRpcPromise(_0x22119a,_0x5862c5,_0x52c636){return new BPromise(function(_0x10d864,_0x4ad4b0){return client[_0x1d65('0xe')](_0x22119a,_0x52c636)[_0x1d65('0xf')](function(_0x35726e){logger[_0x1d65('0x10')](_0x1d65('0x11'),_0x5862c5,'request\x20sent');logger[_0x1d65('0x12')]('CmList,\x20%s,\x20%s,\x20%s',_0x5862c5,'request\x20sent',JSON[_0x1d65('0x13')](_0x35726e));if(_0x35726e[_0x1d65('0x14')]){if(_0x35726e[_0x1d65('0x14')]['code']===0x1f4){logger['error'](_0x1d65('0x11'),_0x5862c5,_0x35726e['error']['message']);return _0x4ad4b0(_0x35726e[_0x1d65('0x14')]['message']);}logger[_0x1d65('0x14')](_0x1d65('0x11'),_0x5862c5,_0x35726e['error'][_0x1d65('0x15')]);return _0x10d864(_0x35726e[_0x1d65('0x14')]['message']);}else{logger['info'](_0x1d65('0x11'),_0x5862c5,_0x1d65('0x16'));_0x10d864(_0x35726e[_0x1d65('0x17')]['message']);}})[_0x1d65('0x18')](function(_0x3fddf7){logger[_0x1d65('0x14')](_0x1d65('0x11'),_0x5862c5,_0x3fddf7);_0x4ad4b0(_0x3fddf7);});});} \ No newline at end of file +var _0xcf42=['rpc','jayson/promise','client','http','redis','defaults','localhost','./cmList.socket','register','request','then','CmList,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','CmList,\x20%s,\x20%s','message','info','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x5db688,_0xe12614){var _0x388437=function(_0x195ae6){while(--_0x195ae6){_0x5db688['push'](_0x5db688['shift']());}};_0x388437(++_0xe12614);}(_0xcf42,0x1f0));var _0x2cf4=function(_0x34a355,_0x2031f8){_0x34a355=_0x34a355-0x0;var _0x3338b6=_0xcf42[_0x34a355];return _0x3338b6;};'use strict';var _=require('lodash');var util=require(_0x2cf4('0x0'));var moment=require(_0x2cf4('0x1'));var BPromise=require(_0x2cf4('0x2'));var rs=require(_0x2cf4('0x3'));var fs=require('fs');var Redis=require(_0x2cf4('0x4'));var db=require(_0x2cf4('0x5'))['db'];var utils=require(_0x2cf4('0x6'));var logger=require(_0x2cf4('0x7'))(_0x2cf4('0x8'));var config=require('../../config/environment');var jayson=require(_0x2cf4('0x9'));var client=jayson[_0x2cf4('0xa')][_0x2cf4('0xb')]({'port':0x232a});config[_0x2cf4('0xc')]=_[_0x2cf4('0xd')](config['redis'],{'host':_0x2cf4('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x2cf4('0xc')]));require(_0x2cf4('0xf'))[_0x2cf4('0x10')](socket);function respondWithRpcPromise(_0x2764df,_0xa95b9e,_0x3a1dec){return new BPromise(function(_0x4e10be,_0x48c289){return client[_0x2cf4('0x11')](_0x2764df,_0x3a1dec)[_0x2cf4('0x12')](function(_0x59fb5d){logger['info']('CmList,\x20%s,\x20%s',_0xa95b9e,'request\x20sent');logger['debug'](_0x2cf4('0x13'),_0xa95b9e,_0x2cf4('0x14'),JSON[_0x2cf4('0x15')](_0x59fb5d));if(_0x59fb5d[_0x2cf4('0x16')]){if(_0x59fb5d[_0x2cf4('0x16')]['code']===0x1f4){logger['error'](_0x2cf4('0x17'),_0xa95b9e,_0x59fb5d[_0x2cf4('0x16')][_0x2cf4('0x18')]);return _0x48c289(_0x59fb5d[_0x2cf4('0x16')]['message']);}logger[_0x2cf4('0x16')]('CmList,\x20%s,\x20%s',_0xa95b9e,_0x59fb5d['error'][_0x2cf4('0x18')]);return _0x4e10be(_0x59fb5d['error'][_0x2cf4('0x18')]);}else{logger[_0x2cf4('0x19')]('CmList,\x20%s,\x20%s',_0xa95b9e,_0x2cf4('0x14'));_0x4e10be(_0x59fb5d[_0x2cf4('0x1a')][_0x2cf4('0x18')]);}})[_0x2cf4('0x1b')](function(_0x4643d9){logger[_0x2cf4('0x16')]('CmList,\x20%s,\x20%s',_0xa95b9e,_0x4643d9);_0x48c289(_0x4643d9);});});} \ No newline at end of file diff --git a/server/api/cmList/cmList.socket.js b/server/api/cmList/cmList.socket.js index 95183cf..c675420 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 _0x6c7b=['register','cmList:','./cmList.events','emit','removeListener'];(function(_0xda501a,_0x159d6a){var _0x44be3a=function(_0x5c1c5f){while(--_0x5c1c5f){_0xda501a['push'](_0xda501a['shift']());}};_0x44be3a(++_0x159d6a);}(_0x6c7b,0x10b));var _0xb6c7=function(_0x36d14b,_0x1ba5eb){_0x36d14b=_0x36d14b-0x0;var _0x4be643=_0x6c7b[_0x36d14b];return _0x4be643;};'use strict';var CmListEvents=require(_0xb6c7('0x0'));var events=['save','remove','update'];function createListener(_0x3f3910,_0x5528b3){return function(_0x2b678a){_0x5528b3[_0xb6c7('0x1')](_0x3f3910,_0x2b678a);};}function removeListener(_0x35674b,_0x5857e0){return function(){CmListEvents[_0xb6c7('0x2')](_0x35674b,_0x5857e0);};}exports[_0xb6c7('0x3')]=function(_0xfe3eb9){for(var _0x219abc=0x0,_0xb889c3=events['length'];_0x219abc<_0xb889c3;_0x219abc++){var _0x12e97e=events[_0x219abc];var _0x41a5a5=createListener(_0xb6c7('0x4')+_0x12e97e,_0xfe3eb9);CmListEvents['on'](_0x12e97e,_0x41a5a5);}}; \ No newline at end of file +var _0xc949=['cmList:','./cmList.events','remove','update','emit','removeListener','register','length'];(function(_0x40f713,_0x179bee){var _0x467aed=function(_0xdff5f9){while(--_0xdff5f9){_0x40f713['push'](_0x40f713['shift']());}};_0x467aed(++_0x179bee);}(_0xc949,0x181));var _0x9c94=function(_0x1da04e,_0x31024b){_0x1da04e=_0x1da04e-0x0;var _0xdd8c41=_0xc949[_0x1da04e];return _0xdd8c41;};'use strict';var CmListEvents=require(_0x9c94('0x0'));var events=['save',_0x9c94('0x1'),_0x9c94('0x2')];function createListener(_0x209cd8,_0x27613f){return function(_0x54facf){_0x27613f[_0x9c94('0x3')](_0x209cd8,_0x54facf);};}function removeListener(_0x231762,_0x528a17){return function(){CmListEvents[_0x9c94('0x4')](_0x231762,_0x528a17);};}exports[_0x9c94('0x5')]=function(_0x46d560){for(var _0x1357ac=0x0,_0x57fcd7=events[_0x9c94('0x6')];_0x1357ac<_0x57fcd7;_0x1357ac++){var _0x360e7b=events[_0x1357ac];var _0x25ecd0=createListener(_0x9c94('0x7')+_0x360e7b,_0x46d560);CmListEvents['on'](_0x360e7b,_0x25ecd0);}}; \ No newline at end of file diff --git a/server/api/cmList/index.js b/server/api/cmList/index.js index 4517660..ba71c44 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 _0x4095=['path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./cmList.controller','get','index','/describe','isAuthenticated','/:id','show','/:id/dispositions','getDispositions','/:id/contacts','getContacts','/:id/contacts/csv','getContactsCsv','/:id/fields','getAgents','create','post','addContacts','/:id/users','addAgents','put','update','delete','destroy','removeAgents','exports','multer','util'];(function(_0x41e159,_0x54b1be){var _0x2f896b=function(_0x44783c){while(--_0x44783c){_0x41e159['push'](_0x41e159['shift']());}};_0x2f896b(++_0x54b1be);}(_0x4095,0x152));var _0x5409=function(_0x1eda20,_0x1149f4){_0x1eda20=_0x1eda20-0x0;var _0x31b953=_0x4095[_0x1eda20];return _0x31b953;};'use strict';var multer=require(_0x5409('0x0'));var util=require(_0x5409('0x1'));var path=require(_0x5409('0x2'));var timeout=require(_0x5409('0x3'));var express=require(_0x5409('0x4'));var router=express[_0x5409('0x5')]();var auth=require(_0x5409('0x6'));var interaction=require(_0x5409('0x7'));var config=require('../../config/environment');var controller=require(_0x5409('0x8'));router[_0x5409('0x9')]('/',auth['isAuthenticated'](),controller[_0x5409('0xa')]);router[_0x5409('0x9')](_0x5409('0xb'),auth[_0x5409('0xc')](),controller['describe']);router[_0x5409('0x9')](_0x5409('0xd'),auth[_0x5409('0xc')](),controller[_0x5409('0xe')]);router['get'](_0x5409('0xf'),auth[_0x5409('0xc')](),controller[_0x5409('0x10')]);router['get'](_0x5409('0x11'),auth['isAuthenticated'](),controller[_0x5409('0x12')]);router[_0x5409('0x9')](_0x5409('0x13'),auth[_0x5409('0xc')](),controller[_0x5409('0x14')]);router['get'](_0x5409('0x15'),auth[_0x5409('0xc')](),controller['getCustomFields']);router[_0x5409('0x9')]('/:id/users',auth[_0x5409('0xc')](),controller[_0x5409('0x16')]);router['post']('/',auth[_0x5409('0xc')](),controller[_0x5409('0x17')]);router[_0x5409('0x18')](_0x5409('0xf'),auth[_0x5409('0xc')](),controller['addDisposition']);router[_0x5409('0x18')](_0x5409('0x11'),auth[_0x5409('0xc')](),controller[_0x5409('0x19')]);router[_0x5409('0x18')](_0x5409('0x15'),auth[_0x5409('0xc')](),controller['addCustomField']);router[_0x5409('0x18')](_0x5409('0x1a'),auth[_0x5409('0xc')](),controller[_0x5409('0x1b')]);router[_0x5409('0x1c')](_0x5409('0xd'),auth[_0x5409('0xc')](),controller[_0x5409('0x1d')]);router[_0x5409('0x1e')](_0x5409('0xd'),auth[_0x5409('0xc')](),controller[_0x5409('0x1f')]);router[_0x5409('0x1e')]('/:id/dispositions',auth[_0x5409('0xc')](),controller['removeDispositions']);router[_0x5409('0x1e')](_0x5409('0x1a'),auth[_0x5409('0xc')](),controller[_0x5409('0x20')]);module[_0x5409('0x21')]=router; \ No newline at end of file +var _0xcbd7=['getContacts','/:id/contacts/csv','getContactsCsv','/:id/fields','getCustomFields','/:id/users','getAgents','post','addDisposition','/:id/contacts','addContacts','addCustomField','destroy','delete','removeDispositions','removeAgents','exports','util','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','./cmList.controller','get','isAuthenticated','/describe','describe','/:id','/:id/dispositions','getDispositions'];(function(_0x1232f9,_0x5aa500){var _0x43f173=function(_0x3ff4a5){while(--_0x3ff4a5){_0x1232f9['push'](_0x1232f9['shift']());}};_0x43f173(++_0x5aa500);}(_0xcbd7,0x197));var _0x7cbd=function(_0x27b1ac,_0x19a301){_0x27b1ac=_0x27b1ac-0x0;var _0x2ac1f3=_0xcbd7[_0x27b1ac];return _0x2ac1f3;};'use strict';var multer=require('multer');var util=require(_0x7cbd('0x0'));var path=require('path');var timeout=require(_0x7cbd('0x1'));var express=require('express');var router=express[_0x7cbd('0x2')]();var auth=require(_0x7cbd('0x3'));var interaction=require(_0x7cbd('0x4'));var config=require('../../config/environment');var controller=require(_0x7cbd('0x5'));router[_0x7cbd('0x6')]('/',auth[_0x7cbd('0x7')](),controller['index']);router[_0x7cbd('0x6')](_0x7cbd('0x8'),auth[_0x7cbd('0x7')](),controller[_0x7cbd('0x9')]);router[_0x7cbd('0x6')](_0x7cbd('0xa'),auth['isAuthenticated'](),controller['show']);router['get'](_0x7cbd('0xb'),auth[_0x7cbd('0x7')](),controller[_0x7cbd('0xc')]);router[_0x7cbd('0x6')]('/:id/contacts',auth[_0x7cbd('0x7')](),controller[_0x7cbd('0xd')]);router['get'](_0x7cbd('0xe'),auth[_0x7cbd('0x7')](),controller[_0x7cbd('0xf')]);router[_0x7cbd('0x6')](_0x7cbd('0x10'),auth[_0x7cbd('0x7')](),controller[_0x7cbd('0x11')]);router[_0x7cbd('0x6')](_0x7cbd('0x12'),auth[_0x7cbd('0x7')](),controller[_0x7cbd('0x13')]);router['post']('/',auth[_0x7cbd('0x7')](),controller['create']);router[_0x7cbd('0x14')](_0x7cbd('0xb'),auth[_0x7cbd('0x7')](),controller[_0x7cbd('0x15')]);router[_0x7cbd('0x14')](_0x7cbd('0x16'),auth['isAuthenticated'](),controller[_0x7cbd('0x17')]);router[_0x7cbd('0x14')](_0x7cbd('0x10'),auth[_0x7cbd('0x7')](),controller[_0x7cbd('0x18')]);router[_0x7cbd('0x14')](_0x7cbd('0x12'),auth['isAuthenticated'](),controller['addAgents']);router['put']('/:id',auth['isAuthenticated'](),controller['update']);router['delete'](_0x7cbd('0xa'),auth[_0x7cbd('0x7')](),controller[_0x7cbd('0x19')]);router[_0x7cbd('0x1a')](_0x7cbd('0xb'),auth[_0x7cbd('0x7')](),controller[_0x7cbd('0x1b')]);router[_0x7cbd('0x1a')](_0x7cbd('0x12'),auth[_0x7cbd('0x7')](),controller[_0x7cbd('0x1c')]);module[_0x7cbd('0x1d')]=router; \ No newline at end of file diff --git a/server/api/condition/condition.attributes.js b/server/api/condition/condition.attributes.js index a6c0900..155dea4 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(_0x366487,_0x58e80f){var _0x51b11d=function(_0x515cea){while(--_0x515cea){_0x366487['push'](_0x366487['shift']());}};_0x51b11d(++_0x58e80f);}(_0x9957,0x93));var _0x7995=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0x9957[_0x19e35c];return _0x3e1fe8;};'use strict';var Sequelize=require(_0x7995('0x0'));module[_0x7995('0x1')]={'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 _0x9957=['field','STRING','sequelize','exports','VIRTUAL'];(function(_0x7664d9,_0x24e562){var _0x3b9def=function(_0x56e7fe){while(--_0x56e7fe){_0x7664d9['push'](_0x7664d9['shift']());}};_0x3b9def(++_0x24e562);}(_0x9957,0x93));var _0x7995=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0x9957[_0xbca1b1];return _0x4e1686;};'use strict';var Sequelize=require(_0x7995('0x0'));module[_0x7995('0x1')]={'name':{'type':Sequelize[_0x7995('0x2')],'get':function(_0x10a05d){return this['getDataValue'](_0x7995('0x3'));}},'field':{'type':Sequelize[_0x7995('0x4')],'allowNull':![]},'operator':{'type':Sequelize[_0x7995('0x4')],'allowNull':![]},'value':{'type':Sequelize[_0x7995('0x4')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/condition/condition.controller.js b/server/api/condition/condition.controller.js index 435c197..8389267 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 _0xf56c=['error','name','send','update','body','Condition','find','params','catch','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','lodash','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','end','json','count','offset','limit','status','set','Content-Range','apply','reject','save','then'];(function(_0xf2726b,_0x87deb7){var _0xa61a5=function(_0x27759c){while(--_0x27759c){_0xf2726b['push'](_0xf2726b['shift']());}};_0xa61a5(++_0x87deb7);}(_0xf56c,0x67));var _0xcf56=function(_0x3ba39c,_0x2b71ec){_0x3ba39c=_0x3ba39c-0x0;var _0x32a3a8=_0xf56c[_0x3ba39c];return _0x32a3a8;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xcf56('0x0'));var rimraf=require(_0xcf56('0x1'));var zipdir=require(_0xcf56('0x2'));var jsonpatch=require(_0xcf56('0x3'));var rp=require('request-promise');var moment=require(_0xcf56('0x4'));var BPromise=require(_0xcf56('0x5'));var Mustache=require(_0xcf56('0x6'));var util=require(_0xcf56('0x7'));var path=require(_0xcf56('0x8'));var sox=require(_0xcf56('0x9'));var csv=require(_0xcf56('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xcf56('0xb'));var squel=require('squel');var crypto=require(_0xcf56('0xc'));var jsforce=require(_0xcf56('0xd'));var deskjs=require(_0xcf56('0xe'));var toCsv=require(_0xcf56('0xa'));var querystring=require(_0xcf56('0xf'));var Papa=require('papaparse');var Redis=require(_0xcf56('0x10'));var authService=require(_0xcf56('0x11'));var qs=require(_0xcf56('0x12'));var as=require(_0xcf56('0x13'));var hardwareService=require(_0xcf56('0x14'));var logger=require(_0xcf56('0x15'))(_0xcf56('0x16'));var utils=require('../../config/utils');var config=require(_0xcf56('0x17'));var db=require(_0xcf56('0x18'))['db'];function respondWithStatusCode(_0x4bc40a,_0x1baa30){_0x1baa30=_0x1baa30||0xcc;return function(_0x197ce0){if(_0x197ce0){return _0x4bc40a[_0xcf56('0x19')](_0x1baa30);}return _0x4bc40a['status'](_0x1baa30)[_0xcf56('0x1a')]();};}function respondWithResult(_0x2bd938,_0x1f92e7){_0x1f92e7=_0x1f92e7||0xc8;return function(_0x4088ca){if(_0x4088ca){return _0x2bd938['status'](_0x1f92e7)[_0xcf56('0x1b')](_0x4088ca);}};}function respondWithFilteredResult(_0x4f71a4,_0x3ace8f){return function(_0x19c136){if(_0x19c136){var _0x53ba6e=_0x19c136[_0xcf56('0x1c')],_0x136eaf=_0x3ace8f['offset'],_0x25573e=_0x3ace8f[_0xcf56('0x1d')]+_0x3ace8f[_0xcf56('0x1e')],_0x3014cc;if(_0x25573e>=_0x53ba6e){_0x25573e=_0x53ba6e;_0x3014cc=0xc8;}else{_0x3014cc=0xce;}_0x4f71a4[_0xcf56('0x1f')](_0x3014cc);return _0x4f71a4[_0xcf56('0x20')](_0xcf56('0x21'),_0x136eaf+'-'+_0x25573e+'/'+_0x53ba6e)['json'](_0x19c136);}return null;};}function patchUpdates(_0x582eb8){return function(_0x51fc83){try{jsonpatch[_0xcf56('0x22')](_0x51fc83,_0x582eb8,!![]);}catch(_0x5c22e9){return BPromise[_0xcf56('0x23')](_0x5c22e9);}return _0x51fc83[_0xcf56('0x24')]();};}function saveUpdates(_0x3e9024,_0x2e561f){return function(_0x5ec0c3){if(_0x5ec0c3){return _0x5ec0c3['update'](_0x3e9024)[_0xcf56('0x25')](function(_0x174b6d){return _0x174b6d;});}return null;};}function removeEntity(_0x2287cf,_0x380845){return function(_0x4a75a3){if(_0x4a75a3){return _0x4a75a3['destroy']()[_0xcf56('0x25')](function(){_0x2287cf[_0xcf56('0x1f')](0xcc)[_0xcf56('0x1a')]();});}};}function handleEntityNotFound(_0x47733f,_0x2cb514){return function(_0x512f0b){if(!_0x512f0b){_0x47733f[_0xcf56('0x19')](0x194);}return _0x512f0b;};}function handleError(_0x2c7c8e,_0x32bc14){_0x32bc14=_0x32bc14||0x1f4;return function(_0x53b72a){logger[_0xcf56('0x26')](_0x53b72a['stack']);if(_0x53b72a[_0xcf56('0x27')]){delete _0x53b72a[_0xcf56('0x27')];}_0x2c7c8e[_0xcf56('0x1f')](_0x32bc14)[_0xcf56('0x28')](_0x53b72a);};}exports[_0xcf56('0x29')]=function(_0x49f38e,_0x2078b0){if(_0x49f38e[_0xcf56('0x2a')]['id']){delete _0x49f38e[_0xcf56('0x2a')]['id'];}return db[_0xcf56('0x2b')][_0xcf56('0x2c')]({'where':{'id':_0x49f38e[_0xcf56('0x2d')]['id']}})[_0xcf56('0x25')](handleEntityNotFound(_0x2078b0,null))[_0xcf56('0x25')](saveUpdates(_0x49f38e['body'],null))[_0xcf56('0x25')](respondWithResult(_0x2078b0,null))[_0xcf56('0x2e')](handleError(_0x2078b0,null));};exports['destroy']=function(_0x419085,_0x43831b){return db[_0xcf56('0x2b')][_0xcf56('0x2c')]({'where':{'id':_0x419085['params']['id']}})['then'](handleEntityNotFound(_0x43831b,null))['then'](removeEntity(_0x43831b,null))[_0xcf56('0x2e')](handleError(_0x43831b,null));}; \ No newline at end of file +var _0x44d5=['../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','set','Content-Range','apply','save','update','then','stack','name','send','body','Condition','find','catch','destroy','params','html-pdf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis'];(function(_0x195919,_0x177c79){var _0x2aa39d=function(_0x31841c){while(--_0x31841c){_0x195919['push'](_0x195919['shift']());}};_0x2aa39d(++_0x177c79);}(_0x44d5,0xa1));var _0x544d=function(_0x15f603,_0x19466a){_0x15f603=_0x15f603-0x0;var _0x26fd2e=_0x44d5[_0x15f603];return _0x26fd2e;};'use strict';var pdf=require(_0x544d('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x544d('0x1'));var jsonpatch=require(_0x544d('0x2'));var rp=require(_0x544d('0x3'));var moment=require(_0x544d('0x4'));var BPromise=require(_0x544d('0x5'));var Mustache=require(_0x544d('0x6'));var util=require('util');var path=require(_0x544d('0x7'));var sox=require(_0x544d('0x8'));var csv=require(_0x544d('0x9'));var ejs=require(_0x544d('0xa'));var fs=require('fs');var _=require(_0x544d('0xb'));var squel=require(_0x544d('0xc'));var crypto=require(_0x544d('0xd'));var jsforce=require(_0x544d('0xe'));var deskjs=require(_0x544d('0xf'));var toCsv=require('to-csv');var querystring=require(_0x544d('0x10'));var Papa=require(_0x544d('0x11'));var Redis=require(_0x544d('0x12'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x544d('0x13'));var hardwareService=require(_0x544d('0x14'));var logger=require('../../config/logger')(_0x544d('0x15'));var utils=require(_0x544d('0x16'));var config=require(_0x544d('0x17'));var db=require(_0x544d('0x18'))['db'];function respondWithStatusCode(_0x4d6add,_0x27a6c7){_0x27a6c7=_0x27a6c7||0xcc;return function(_0xae4d82){if(_0xae4d82){return _0x4d6add[_0x544d('0x19')](_0x27a6c7);}return _0x4d6add[_0x544d('0x1a')](_0x27a6c7)[_0x544d('0x1b')]();};}function respondWithResult(_0x20fe25,_0xb30740){_0xb30740=_0xb30740||0xc8;return function(_0x3ea2fb){if(_0x3ea2fb){return _0x20fe25['status'](_0xb30740)[_0x544d('0x1c')](_0x3ea2fb);}};}function respondWithFilteredResult(_0x99057,_0xadbded){return function(_0x46ea34){if(_0x46ea34){var _0x2cf1ed=_0x46ea34[_0x544d('0x1d')],_0x5af934=_0xadbded['offset'],_0x28e341=_0xadbded['offset']+_0xadbded['limit'],_0x348f76;if(_0x28e341>=_0x2cf1ed){_0x28e341=_0x2cf1ed;_0x348f76=0xc8;}else{_0x348f76=0xce;}_0x99057[_0x544d('0x1a')](_0x348f76);return _0x99057[_0x544d('0x1e')](_0x544d('0x1f'),_0x5af934+'-'+_0x28e341+'/'+_0x2cf1ed)[_0x544d('0x1c')](_0x46ea34);}return null;};}function patchUpdates(_0x3922d9){return function(_0x57f384){try{jsonpatch[_0x544d('0x20')](_0x57f384,_0x3922d9,!![]);}catch(_0x5ac330){return BPromise['reject'](_0x5ac330);}return _0x57f384[_0x544d('0x21')]();};}function saveUpdates(_0x472589,_0x3d847d){return function(_0x395ebb){if(_0x395ebb){return _0x395ebb[_0x544d('0x22')](_0x472589)[_0x544d('0x23')](function(_0x142fb){return _0x142fb;});}return null;};}function removeEntity(_0x4681d2,_0x5bbc86){return function(_0x1bb8a5){if(_0x1bb8a5){return _0x1bb8a5['destroy']()[_0x544d('0x23')](function(){_0x4681d2['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x420f37,_0x583b8f){return function(_0x4d4d0d){if(!_0x4d4d0d){_0x420f37['sendStatus'](0x194);}return _0x4d4d0d;};}function handleError(_0x3b1f52,_0xef93c2){_0xef93c2=_0xef93c2||0x1f4;return function(_0x4617a0){logger['error'](_0x4617a0[_0x544d('0x24')]);if(_0x4617a0[_0x544d('0x25')]){delete _0x4617a0['name'];}_0x3b1f52[_0x544d('0x1a')](_0xef93c2)[_0x544d('0x26')](_0x4617a0);};}exports[_0x544d('0x22')]=function(_0x11c952,_0x30e737){if(_0x11c952[_0x544d('0x27')]['id']){delete _0x11c952[_0x544d('0x27')]['id'];}return db[_0x544d('0x28')][_0x544d('0x29')]({'where':{'id':_0x11c952['params']['id']}})[_0x544d('0x23')](handleEntityNotFound(_0x30e737,null))['then'](saveUpdates(_0x11c952[_0x544d('0x27')],null))[_0x544d('0x23')](respondWithResult(_0x30e737,null))[_0x544d('0x2a')](handleError(_0x30e737,null));};exports[_0x544d('0x2b')]=function(_0x45d105,_0x19d78b){return db['Condition'][_0x544d('0x29')]({'where':{'id':_0x45d105[_0x544d('0x2c')]['id']}})['then'](handleEntityNotFound(_0x19d78b,null))[_0x544d('0x23')](removeEntity(_0x19d78b,null))['catch'](handleError(_0x19d78b,null));}; \ No newline at end of file diff --git a/server/api/condition/condition.model.js b/server/api/condition/condition.model.js index a00874b..cbf8b86 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 _0x2ab1=['define','Condition','tools_conditions','lodash','util','../../config/logger','api','bluebird','request-promise','path','../../config/environment','./condition.attributes'];(function(_0x44160a,_0x535111){var _0x48b5f8=function(_0x2170b1){while(--_0x2170b1){_0x44160a['push'](_0x44160a['shift']());}};_0x48b5f8(++_0x535111);}(_0x2ab1,0x13b));var _0x12ab=function(_0x53c145,_0x2451b4){_0x53c145=_0x53c145-0x0;var _0xacaca3=_0x2ab1[_0x53c145];return _0xacaca3;};'use strict';var _=require(_0x12ab('0x0'));var util=require(_0x12ab('0x1'));var logger=require(_0x12ab('0x2'))(_0x12ab('0x3'));var moment=require('moment');var BPromise=require(_0x12ab('0x4'));var rp=require(_0x12ab('0x5'));var fs=require('fs');var path=require(_0x12ab('0x6'));var rimraf=require('rimraf');var config=require(_0x12ab('0x7'));var attributes=require(_0x12ab('0x8'));module['exports']=function(_0x21c9f2,_0x4648a7){return _0x21c9f2[_0x12ab('0x9')](_0x12ab('0xa'),attributes,{'tableName':_0x12ab('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf73b=['bluebird','request-promise','path','rimraf','./condition.attributes','exports','define','Condition','tools_conditions','lodash','util','../../config/logger','api','moment'];(function(_0x1dc01f,_0x157a75){var _0x298041=function(_0x47fce1){while(--_0x47fce1){_0x1dc01f['push'](_0x1dc01f['shift']());}};_0x298041(++_0x157a75);}(_0xf73b,0x95));var _0xbf73=function(_0x56fa56,_0x5a0c7d){_0x56fa56=_0x56fa56-0x0;var _0x35d445=_0xf73b[_0x56fa56];return _0x35d445;};'use strict';var _=require(_0xbf73('0x0'));var util=require(_0xbf73('0x1'));var logger=require(_0xbf73('0x2'))(_0xbf73('0x3'));var moment=require(_0xbf73('0x4'));var BPromise=require(_0xbf73('0x5'));var rp=require(_0xbf73('0x6'));var fs=require('fs');var path=require(_0xbf73('0x7'));var rimraf=require(_0xbf73('0x8'));var config=require('../../config/environment');var attributes=require(_0xbf73('0x9'));module[_0xbf73('0xa')]=function(_0x394e45,_0x45eb54){return _0x394e45[_0xbf73('0xb')](_0xbf73('0xc'),attributes,{'tableName':_0xbf73('0xd'),'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 99735d4..5b02c85 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 _0xabc4=['code','message','request\x20sent','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','request','then','Condition,\x20%s,\x20%s','stringify','error'];(function(_0x4bd349,_0x5b041e){var _0x4c40b4=function(_0x1a9de5){while(--_0x1a9de5){_0x4bd349['push'](_0x4bd349['shift']());}};_0x4c40b4(++_0x5b041e);}(_0xabc4,0x192));var _0x4abc=function(_0x46ee1c,_0x45a091){_0x46ee1c=_0x46ee1c-0x0;var _0x23d17b=_0xabc4[_0x46ee1c];return _0x23d17b;};'use strict';var _=require(_0x4abc('0x0'));var util=require(_0x4abc('0x1'));var moment=require(_0x4abc('0x2'));var BPromise=require(_0x4abc('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x4abc('0x4'));var db=require(_0x4abc('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x4abc('0x6'))(_0x4abc('0x7'));var config=require(_0x4abc('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x4abc('0x9')][_0x4abc('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1daefe,_0x2b5729,_0x4fe29f){return new BPromise(function(_0x245923,_0xa6e8b){return client[_0x4abc('0xb')](_0x1daefe,_0x4fe29f)[_0x4abc('0xc')](function(_0x14ac30){logger['info'](_0x4abc('0xd'),_0x2b5729,'request\x20sent');logger['debug']('Condition,\x20%s,\x20%s,\x20%s',_0x2b5729,'request\x20sent',JSON[_0x4abc('0xe')](_0x14ac30));if(_0x14ac30[_0x4abc('0xf')]){if(_0x14ac30[_0x4abc('0xf')][_0x4abc('0x10')]===0x1f4){logger[_0x4abc('0xf')](_0x4abc('0xd'),_0x2b5729,_0x14ac30['error'][_0x4abc('0x11')]);return _0xa6e8b(_0x14ac30[_0x4abc('0xf')]['message']);}logger['error'](_0x4abc('0xd'),_0x2b5729,_0x14ac30['error']['message']);return _0x245923(_0x14ac30['error']['message']);}else{logger['info']('Condition,\x20%s,\x20%s',_0x2b5729,_0x4abc('0x12'));_0x245923(_0x14ac30['result']['message']);}})['catch'](function(_0x1d12fb){logger['error']('Condition,\x20%s,\x20%s',_0x2b5729,_0x1d12fb);_0xa6e8b(_0x1d12fb);});});} \ No newline at end of file +var _0xf1dc=['jayson/promise','http','request','then','info','Condition,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc'];(function(_0xc4553d,_0x50cf13){var _0xeff54f=function(_0x49bf94){while(--_0x49bf94){_0xc4553d['push'](_0xc4553d['shift']());}};_0xeff54f(++_0x50cf13);}(_0xf1dc,0x157));var _0xcf1d=function(_0xcefb4,_0x46cbf8){_0xcefb4=_0xcefb4-0x0;var _0x29e43f=_0xf1dc[_0xcefb4];return _0x29e43f;};'use strict';var _=require(_0xcf1d('0x0'));var util=require(_0xcf1d('0x1'));var moment=require(_0xcf1d('0x2'));var BPromise=require(_0xcf1d('0x3'));var rs=require(_0xcf1d('0x4'));var fs=require('fs');var Redis=require(_0xcf1d('0x5'));var db=require(_0xcf1d('0x6'))['db'];var utils=require(_0xcf1d('0x7'));var logger=require('../../config/logger')(_0xcf1d('0x8'));var config=require('../../config/environment');var jayson=require(_0xcf1d('0x9'));var client=jayson['client'][_0xcf1d('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2d01a4,_0x4f9399,_0x44117a){return new BPromise(function(_0x1c48a7,_0x2ad006){return client[_0xcf1d('0xb')](_0x2d01a4,_0x44117a)[_0xcf1d('0xc')](function(_0x13d398){logger[_0xcf1d('0xd')](_0xcf1d('0xe'),_0x4f9399,_0xcf1d('0xf'));logger[_0xcf1d('0x10')]('Condition,\x20%s,\x20%s,\x20%s',_0x4f9399,_0xcf1d('0xf'),JSON[_0xcf1d('0x11')](_0x13d398));if(_0x13d398[_0xcf1d('0x12')]){if(_0x13d398['error'][_0xcf1d('0x13')]===0x1f4){logger['error'](_0xcf1d('0xe'),_0x4f9399,_0x13d398[_0xcf1d('0x12')][_0xcf1d('0x14')]);return _0x2ad006(_0x13d398[_0xcf1d('0x12')][_0xcf1d('0x14')]);}logger[_0xcf1d('0x12')]('Condition,\x20%s,\x20%s',_0x4f9399,_0x13d398[_0xcf1d('0x12')][_0xcf1d('0x14')]);return _0x1c48a7(_0x13d398[_0xcf1d('0x12')]['message']);}else{logger[_0xcf1d('0xd')](_0xcf1d('0xe'),_0x4f9399,_0xcf1d('0xf'));_0x1c48a7(_0x13d398[_0xcf1d('0x15')]['message']);}})['catch'](function(_0x1d7037){logger[_0xcf1d('0x12')](_0xcf1d('0xe'),_0x4f9399,_0x1d7037);_0x2ad006(_0x1d7037);});});} \ No newline at end of file diff --git a/server/api/condition/index.js b/server/api/condition/index.js index e398438..62f5d95 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 _0x7e78=['/:id','update','delete','isAuthenticated','exports','multer','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./condition.controller','put'];(function(_0x1b9080,_0x25d543){var _0x4ce6ee=function(_0x4cccf8){while(--_0x4cccf8){_0x1b9080['push'](_0x1b9080['shift']());}};_0x4ce6ee(++_0x25d543);}(_0x7e78,0x139));var _0x87e7=function(_0x425a53,_0x56ef6c){_0x425a53=_0x425a53-0x0;var _0xeb3b49=_0x7e78[_0x425a53];return _0xeb3b49;};'use strict';var multer=require(_0x87e7('0x0'));var util=require('util');var path=require(_0x87e7('0x1'));var timeout=require('connect-timeout');var express=require(_0x87e7('0x2'));var router=express[_0x87e7('0x3')]();var auth=require(_0x87e7('0x4'));var interaction=require(_0x87e7('0x5'));var config=require(_0x87e7('0x6'));var controller=require(_0x87e7('0x7'));router[_0x87e7('0x8')](_0x87e7('0x9'),auth['isAuthenticated'](),controller[_0x87e7('0xa')]);router[_0x87e7('0xb')](_0x87e7('0x9'),auth[_0x87e7('0xc')](),controller['destroy']);module[_0x87e7('0xd')]=router; \ No newline at end of file +var _0x8d31=['Router','../../components/auth/service','../../config/environment','./condition.controller','put','/:id','isAuthenticated','destroy','multer','util','path','express'];(function(_0x486f4a,_0x478dc7){var _0x135d99=function(_0x434008){while(--_0x434008){_0x486f4a['push'](_0x486f4a['shift']());}};_0x135d99(++_0x478dc7);}(_0x8d31,0x1c4));var _0x18d3=function(_0x43537e,_0x508c24){_0x43537e=_0x43537e-0x0;var _0x2465ee=_0x8d31[_0x43537e];return _0x2465ee;};'use strict';var multer=require(_0x18d3('0x0'));var util=require(_0x18d3('0x1'));var path=require(_0x18d3('0x2'));var timeout=require('connect-timeout');var express=require(_0x18d3('0x3'));var router=express[_0x18d3('0x4')]();var auth=require(_0x18d3('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x18d3('0x6'));var controller=require(_0x18d3('0x7'));router[_0x18d3('0x8')](_0x18d3('0x9'),auth[_0x18d3('0xa')](),controller['update']);router['delete'](_0x18d3('0x9'),auth[_0x18d3('0xa')](),controller[_0x18d3('0xb')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/contactItemType/contactItemType.attributes.js b/server/api/contactItemType/contactItemType.attributes.js index 4af7691..6a06279 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 _0xc01b=['name','sequelize','exports','STRING'];(function(_0x34c267,_0x4b2774){var _0x595460=function(_0x19d80d){while(--_0x19d80d){_0x34c267['push'](_0x34c267['shift']());}};_0x595460(++_0x4b2774);}(_0xc01b,0x65));var _0xbc01=function(_0x3506a5,_0x1a500e){_0x3506a5=_0x3506a5-0x0;var _0x511a36=_0xc01b[_0x3506a5];return _0x511a36;};'use strict';var Sequelize=require(_0xbc01('0x0'));module[_0xbc01('0x1')]={'name':{'type':Sequelize[_0xbc01('0x2')],'allowNull':![],'unique':_0xbc01('0x3')},'OrderBy':{'type':Sequelize['INTEGER'],'allowNull':!![]},'rgbBackgroundColor':{'type':Sequelize[_0xbc01('0x2')],'allowNull':!![]}}; \ No newline at end of file +var _0xae1c=['STRING','INTEGER'];(function(_0x254dc7,_0xd6b6d0){var _0x16a3c4=function(_0x2ee67c){while(--_0x2ee67c){_0x254dc7['push'](_0x254dc7['shift']());}};_0x16a3c4(++_0xd6b6d0);}(_0xae1c,0xff));var _0xcae1=function(_0x5a8c9f,_0x4affdd){_0x5a8c9f=_0x5a8c9f-0x0;var _0x6efc96=_0xae1c[_0x5a8c9f];return _0x6efc96;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':'name'},'OrderBy':{'type':Sequelize[_0xcae1('0x0')],'allowNull':!![]},'rgbBackgroundColor':{'type':Sequelize[_0xcae1('0x1')],'allowNull':!![]}}; \ No newline at end of file diff --git a/server/api/contactItemType/contactItemType.controller.js b/server/api/contactItemType/contactItemType.controller.js index 8ed329d..f831dfa 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 _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(_0xd3cebe,_0x15b670){var _0x373ea8=function(_0x3306a0){while(--_0x3306a0){_0xd3cebe['push'](_0xd3cebe['shift']());}};_0x373ea8(++_0x15b670);}(_0xf3cd,0xfe));var _0xdf3c=function(_0x3ad9b3,_0x5c76e9){_0x3ad9b3=_0x3ad9b3-0x0;var _0x4ef8d1=_0xf3cd[_0x3ad9b3];return _0x4ef8d1;};'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 +var _0x9c44=['Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../mysqldb','sendStatus','end','status','json','count','offset','limit','Content-Range','apply','reject','save','update','then','ContactItemTypes','UserProfileResource','destroy','error','name','send','map','ContactItemType','rawAttributes','fieldName','query','keys','intersection','model','attributes','fields','order','where','filters','pick','filter','type','VIRTUAL','merge','options','includeAll','include','findAll','show','params','length','find','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','get','userProfileId','autoAssociation'];(function(_0x37e0f6,_0x16d9d2){var _0xe5bfc6=function(_0x563419){while(--_0x563419){_0x37e0f6['push'](_0x37e0f6['shift']());}};_0xe5bfc6(++_0x16d9d2);}(_0x9c44,0x178));var _0x49c4=function(_0x465a0c,_0x19d4d5){_0x465a0c=_0x465a0c-0x0;var _0x1e202e=_0x9c44[_0x465a0c];return _0x1e202e;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0x49c4('0x0'));var zipdir=require(_0x49c4('0x1'));var jsonpatch=require(_0x49c4('0x2'));var rp=require(_0x49c4('0x3'));var moment=require(_0x49c4('0x4'));var BPromise=require(_0x49c4('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0x49c4('0x6'));var sox=require('sox');var csv=require(_0x49c4('0x7'));var ejs=require(_0x49c4('0x8'));var fs=require('fs');var _=require(_0x49c4('0x9'));var squel=require(_0x49c4('0xa'));var crypto=require(_0x49c4('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x49c4('0xc'));var toCsv=require(_0x49c4('0x7'));var querystring=require(_0x49c4('0xd'));var Papa=require(_0x49c4('0xe'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x49c4('0xf'));var as=require(_0x49c4('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x49c4('0x11'))(_0x49c4('0x12'));var utils=require('../../config/utils');var config=require('../../config/environment');var db=require(_0x49c4('0x13'))['db'];function respondWithStatusCode(_0x6d1b08,_0x5487cd){_0x5487cd=_0x5487cd||0xcc;return function(_0x7df3a9){if(_0x7df3a9){return _0x6d1b08[_0x49c4('0x14')](_0x5487cd);}return _0x6d1b08['status'](_0x5487cd)[_0x49c4('0x15')]();};}function respondWithResult(_0x280996,_0x21f15a){_0x21f15a=_0x21f15a||0xc8;return function(_0x2decee){if(_0x2decee){return _0x280996[_0x49c4('0x16')](_0x21f15a)[_0x49c4('0x17')](_0x2decee);}};}function respondWithFilteredResult(_0x75ea8,_0x3de397){return function(_0x58d177){if(_0x58d177){var _0x3acd06=_0x58d177[_0x49c4('0x18')],_0x141003=_0x3de397['offset'],_0x13a2db=_0x3de397[_0x49c4('0x19')]+_0x3de397[_0x49c4('0x1a')],_0x81e831;if(_0x13a2db>=_0x3acd06){_0x13a2db=_0x3acd06;_0x81e831=0xc8;}else{_0x81e831=0xce;}_0x75ea8['status'](_0x81e831);return _0x75ea8['set'](_0x49c4('0x1b'),_0x141003+'-'+_0x13a2db+'/'+_0x3acd06)[_0x49c4('0x17')](_0x58d177);}return null;};}function patchUpdates(_0x3addb2){return function(_0x59f29b){try{jsonpatch[_0x49c4('0x1c')](_0x59f29b,_0x3addb2,!![]);}catch(_0x50b151){return BPromise[_0x49c4('0x1d')](_0x50b151);}return _0x59f29b[_0x49c4('0x1e')]();};}function saveUpdates(_0xe31fcc,_0x291526){return function(_0x382040){if(_0x382040){return _0x382040[_0x49c4('0x1f')](_0xe31fcc)[_0x49c4('0x20')](function(_0x46e475){return _0x46e475;});}return null;};}function removeEntity(_0x2197d2,_0x578447){return function(_0x527126){if(_0x527126){return _0x527126['destroy']()[_0x49c4('0x20')](function(){var _0x4f0b62=_0x527126['get']({'plain':!![]});var _0x2263ae=_0x49c4('0x21');return db[_0x49c4('0x22')][_0x49c4('0x23')]({'where':{'type':_0x2263ae,'resourceId':_0x4f0b62['id']}})['then'](function(){return _0x527126;});})['then'](function(){_0x2197d2[_0x49c4('0x16')](0xcc)[_0x49c4('0x15')]();});}};}function handleEntityNotFound(_0x565423,_0x207358){return function(_0x43e014){if(!_0x43e014){_0x565423[_0x49c4('0x14')](0x194);}return _0x43e014;};}function handleError(_0xa7a826,_0x531d92){_0x531d92=_0x531d92||0x1f4;return function(_0x543ea2){logger[_0x49c4('0x24')](_0x543ea2['stack']);if(_0x543ea2[_0x49c4('0x25')]){delete _0x543ea2[_0x49c4('0x25')];}_0xa7a826[_0x49c4('0x16')](_0x531d92)[_0x49c4('0x26')](_0x543ea2);};}exports['index']=function(_0x889909,_0x2b2793){var _0x46e04d={},_0x4f28a2={},_0x6329b3={'count':0x0,'rows':[]};var _0x29f835=_[_0x49c4('0x27')](db[_0x49c4('0x28')][_0x49c4('0x29')],function(_0x2cbd88){return{'name':_0x2cbd88[_0x49c4('0x2a')],'type':_0x2cbd88['type']['key']};});_0x4f28a2['model']=_[_0x49c4('0x27')](_0x29f835,_0x49c4('0x25'));_0x4f28a2[_0x49c4('0x2b')]=_[_0x49c4('0x2c')](_0x889909[_0x49c4('0x2b')]);_0x4f28a2['filters']=_[_0x49c4('0x2d')](_0x4f28a2[_0x49c4('0x2e')],_0x4f28a2[_0x49c4('0x2b')]);_0x46e04d[_0x49c4('0x2f')]=_['intersection'](_0x4f28a2['model'],qs[_0x49c4('0x30')](_0x889909[_0x49c4('0x2b')][_0x49c4('0x30')]));_0x46e04d[_0x49c4('0x2f')]=_0x46e04d[_0x49c4('0x2f')]['length']?_0x46e04d[_0x49c4('0x2f')]:_0x4f28a2[_0x49c4('0x2e')];if(!_0x889909[_0x49c4('0x2b')]['hasOwnProperty']('nolimit')){_0x46e04d[_0x49c4('0x1a')]=qs[_0x49c4('0x1a')](_0x889909[_0x49c4('0x2b')][_0x49c4('0x1a')]);_0x46e04d[_0x49c4('0x19')]=qs[_0x49c4('0x19')](_0x889909[_0x49c4('0x2b')][_0x49c4('0x19')]);}_0x46e04d[_0x49c4('0x31')]=qs['sort'](_0x889909[_0x49c4('0x2b')]['sort']);_0x46e04d[_0x49c4('0x32')]=qs[_0x49c4('0x33')](_[_0x49c4('0x34')](_0x889909[_0x49c4('0x2b')],_0x4f28a2['filters']),_0x29f835);if(_0x889909[_0x49c4('0x2b')][_0x49c4('0x35')]){_0x46e04d[_0x49c4('0x32')]=_['merge'](_0x46e04d[_0x49c4('0x32')],{'$or':_[_0x49c4('0x27')](_0x29f835,function(_0x178987){if(_0x178987[_0x49c4('0x36')]!==_0x49c4('0x37')){var _0x24c177={};_0x24c177[_0x178987[_0x49c4('0x25')]]={'$like':'%'+_0x889909[_0x49c4('0x2b')][_0x49c4('0x35')]+'%'};return _0x24c177;}})});}_0x46e04d=_[_0x49c4('0x38')]({},_0x46e04d,_0x889909[_0x49c4('0x39')]);var _0x4e0663={'where':_0x46e04d[_0x49c4('0x32')]};return db[_0x49c4('0x28')][_0x49c4('0x18')](_0x4e0663)[_0x49c4('0x20')](function(_0x41ad28){_0x6329b3[_0x49c4('0x18')]=_0x41ad28;if(_0x889909[_0x49c4('0x2b')][_0x49c4('0x3a')]){_0x46e04d[_0x49c4('0x3b')]=[{'all':!![]}];}return db[_0x49c4('0x28')][_0x49c4('0x3c')](_0x46e04d);})[_0x49c4('0x20')](function(_0x326142){_0x6329b3['rows']=_0x326142;return _0x6329b3;})[_0x49c4('0x20')](respondWithFilteredResult(_0x2b2793,_0x46e04d))['catch'](handleError(_0x2b2793,null));};exports[_0x49c4('0x3d')]=function(_0x4915bc,_0x28d4fb){var _0x1480da={'raw':!![],'where':{'id':_0x4915bc[_0x49c4('0x3e')]['id']}},_0x239327={};_0x239327['model']=_['keys'](db[_0x49c4('0x28')][_0x49c4('0x29')]);_0x239327[_0x49c4('0x2b')]=_[_0x49c4('0x2c')](_0x4915bc['query']);_0x239327[_0x49c4('0x33')]=_[_0x49c4('0x2d')](_0x239327[_0x49c4('0x2e')],_0x239327[_0x49c4('0x2b')]);_0x1480da[_0x49c4('0x2f')]=_[_0x49c4('0x2d')](_0x239327[_0x49c4('0x2e')],qs[_0x49c4('0x30')](_0x4915bc[_0x49c4('0x2b')]['fields']));_0x1480da[_0x49c4('0x2f')]=_0x1480da['attributes'][_0x49c4('0x3f')]?_0x1480da[_0x49c4('0x2f')]:_0x239327[_0x49c4('0x2e')];if(_0x4915bc[_0x49c4('0x2b')][_0x49c4('0x3a')]){_0x1480da['include']=[{'all':!![]}];}_0x1480da=_[_0x49c4('0x38')]({},_0x1480da,_0x4915bc[_0x49c4('0x39')]);return db[_0x49c4('0x28')][_0x49c4('0x40')](_0x1480da)[_0x49c4('0x20')](handleEntityNotFound(_0x28d4fb,null))[_0x49c4('0x20')](respondWithResult(_0x28d4fb,null))[_0x49c4('0x41')](handleError(_0x28d4fb,null));};exports['create']=function(_0x3bac1b,_0x5cfff9){return db[_0x49c4('0x28')][_0x49c4('0x42')](_0x3bac1b[_0x49c4('0x43')],{})[_0x49c4('0x20')](function(_0x2d8087){var _0x30bea5=_0x3bac1b[_0x49c4('0x44')]['get']({'plain':!![]});if(!_0x30bea5)throw new Error(_0x49c4('0x45'));if(_0x30bea5[_0x49c4('0x46')]==='user'){var _0x1e1ac4=_0x2d8087[_0x49c4('0x47')]({'plain':!![]});var _0xfbe179=_0x49c4('0x21');return db['UserProfileSection']['find']({'where':{'name':_0xfbe179,'userProfileId':_0x30bea5[_0x49c4('0x48')]},'raw':!![]})['then'](function(_0x4597c3){if(_0x4597c3&&_0x4597c3[_0x49c4('0x49')]===0x0){return db[_0x49c4('0x22')][_0x49c4('0x42')]({'name':_0x1e1ac4[_0x49c4('0x25')],'resourceId':_0x1e1ac4['id'],'type':_0x4597c3[_0x49c4('0x25')],'sectionId':_0x4597c3['id']},{})[_0x49c4('0x20')](function(){return _0x2d8087;});}else{return _0x2d8087;}})['catch'](function(_0x1f26c2){logger[_0x49c4('0x24')](_0x49c4('0x4a'),_0x1f26c2);throw _0x1f26c2;});}return _0x2d8087;})[_0x49c4('0x20')](respondWithResult(_0x5cfff9,0xc9))[_0x49c4('0x41')](handleError(_0x5cfff9,null));};exports[_0x49c4('0x1f')]=function(_0x156748,_0x25d174){if(_0x156748[_0x49c4('0x43')]['id']){delete _0x156748[_0x49c4('0x43')]['id'];}return db['ContactItemType']['find']({'where':{'id':_0x156748[_0x49c4('0x3e')]['id']}})[_0x49c4('0x20')](handleEntityNotFound(_0x25d174,null))['then'](saveUpdates(_0x156748['body'],null))[_0x49c4('0x20')](respondWithResult(_0x25d174,null))['catch'](handleError(_0x25d174,null));};exports['destroy']=function(_0x3208c2,_0x4081a5){return db[_0x49c4('0x28')][_0x49c4('0x40')]({'where':{'id':_0x3208c2[_0x49c4('0x3e')]['id']}})[_0x49c4('0x20')](handleEntityNotFound(_0x4081a5,null))[_0x49c4('0x20')](removeEntity(_0x4081a5,null))['catch'](handleError(_0x4081a5,null));}; \ No newline at end of file diff --git a/server/api/contactItemType/contactItemType.model.js b/server/api/contactItemType/contactItemType.model.js index 8ede58d..9306120 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 _0x3dd6=['request-promise','path','rimraf','./contactItemType.attributes','define','ContactItemType','tools_contact_item_types','api','moment','bluebird'];(function(_0x377c53,_0x526c6c){var _0xb34630=function(_0x43f0d2){while(--_0x43f0d2){_0x377c53['push'](_0x377c53['shift']());}};_0xb34630(++_0x526c6c);}(_0x3dd6,0xcf));var _0x63dd=function(_0x32e8f2,_0x33cff3){_0x32e8f2=_0x32e8f2-0x0;var _0xefd2e6=_0x3dd6[_0x32e8f2];return _0xefd2e6;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0x63dd('0x0'));var moment=require(_0x63dd('0x1'));var BPromise=require(_0x63dd('0x2'));var rp=require(_0x63dd('0x3'));var fs=require('fs');var path=require(_0x63dd('0x4'));var rimraf=require(_0x63dd('0x5'));var config=require('../../config/environment');var attributes=require(_0x63dd('0x6'));module['exports']=function(_0x32bad9,_0xf7e03e){return _0x32bad9[_0x63dd('0x7')](_0x63dd('0x8'),attributes,{'tableName':_0x63dd('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x873a=['lodash','util','../../config/logger','moment','path','rimraf','./contactItemType.attributes','exports','ContactItemType','tools_contact_item_types'];(function(_0xbdf03f,_0x595215){var _0x2bbe9e=function(_0x59fbd4){while(--_0x59fbd4){_0xbdf03f['push'](_0xbdf03f['shift']());}};_0x2bbe9e(++_0x595215);}(_0x873a,0x1c2));var _0xa873=function(_0x6472ed,_0x2ae443){_0x6472ed=_0x6472ed-0x0;var _0x23ab07=_0x873a[_0x6472ed];return _0x23ab07;};'use strict';var _=require(_0xa873('0x0'));var util=require(_0xa873('0x1'));var logger=require(_0xa873('0x2'))('api');var moment=require(_0xa873('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xa873('0x4'));var rimraf=require(_0xa873('0x5'));var config=require('../../config/environment');var attributes=require(_0xa873('0x6'));module[_0xa873('0x7')]=function(_0x5c0d74,_0x370b8a){return _0x5c0d74['define'](_0xa873('0x8'),attributes,{'tableName':_0xa873('0x9'),'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 fd10cf4..e17d4f2 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 _0x0439=['catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','then','ContactItemType,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','result'];(function(_0x5cdca0,_0x242f29){var _0xcdc240=function(_0x28f168){while(--_0x28f168){_0x5cdca0['push'](_0x5cdca0['shift']());}};_0xcdc240(++_0x242f29);}(_0x0439,0xdd));var _0x9043=function(_0x4e1a49,_0x4da738){_0x4e1a49=_0x4e1a49-0x0;var _0x136aae=_0x0439[_0x4e1a49];return _0x136aae;};'use strict';var _=require(_0x9043('0x0'));var util=require(_0x9043('0x1'));var moment=require(_0x9043('0x2'));var BPromise=require(_0x9043('0x3'));var rs=require(_0x9043('0x4'));var fs=require('fs');var Redis=require(_0x9043('0x5'));var db=require(_0x9043('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x9043('0x7'))(_0x9043('0x8'));var config=require(_0x9043('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x9043('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4f79c2,_0x2fe4da,_0x19bf02){return new BPromise(function(_0x5bea98,_0x135a40){return client['request'](_0x4f79c2,_0x19bf02)[_0x9043('0xb')](function(_0x36a5cb){logger['info'](_0x9043('0xc'),_0x2fe4da,_0x9043('0xd'));logger[_0x9043('0xe')]('ContactItemType,\x20%s,\x20%s,\x20%s',_0x2fe4da,'request\x20sent',JSON[_0x9043('0xf')](_0x36a5cb));if(_0x36a5cb[_0x9043('0x10')]){if(_0x36a5cb['error'][_0x9043('0x11')]===0x1f4){logger[_0x9043('0x10')](_0x9043('0xc'),_0x2fe4da,_0x36a5cb[_0x9043('0x10')][_0x9043('0x12')]);return _0x135a40(_0x36a5cb[_0x9043('0x10')]['message']);}logger[_0x9043('0x10')](_0x9043('0xc'),_0x2fe4da,_0x36a5cb['error'][_0x9043('0x12')]);return _0x5bea98(_0x36a5cb[_0x9043('0x10')]['message']);}else{logger[_0x9043('0x13')](_0x9043('0xc'),_0x2fe4da,_0x9043('0xd'));_0x5bea98(_0x36a5cb[_0x9043('0x14')][_0x9043('0x12')]);}})[_0x9043('0x15')](function(_0x13b613){logger[_0x9043('0x10')](_0x9043('0xc'),_0x2fe4da,_0x13b613);_0x135a40(_0x13b613);});});} \ No newline at end of file +var _0x6075=['result','catch','lodash','util','bluebird','randomstring','../../config/utils','../../config/environment','client','request','then','info','ContactItemType,\x20%s,\x20%s','request\x20sent','debug','ContactItemType,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x47a5bd,_0x508329){var _0x5c2184=function(_0x40ddea){while(--_0x40ddea){_0x47a5bd['push'](_0x47a5bd['shift']());}};_0x5c2184(++_0x508329);}(_0x6075,0x142));var _0x5607=function(_0x5bc299,_0x203221){_0x5bc299=_0x5bc299-0x0;var _0x1cd31a=_0x6075[_0x5bc299];return _0x1cd31a;};'use strict';var _=require(_0x5607('0x0'));var util=require(_0x5607('0x1'));var moment=require('moment');var BPromise=require(_0x5607('0x2'));var rs=require(_0x5607('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x5607('0x4'));var logger=require('../../config/logger')('rpc');var config=require(_0x5607('0x5'));var jayson=require('jayson/promise');var client=jayson[_0x5607('0x6')]['http']({'port':0x232a});function respondWithRpcPromise(_0x34a8d9,_0x49f0f2,_0x415836){return new BPromise(function(_0x5f92ad,_0xbdf802){return client[_0x5607('0x7')](_0x34a8d9,_0x415836)[_0x5607('0x8')](function(_0x2aec99){logger[_0x5607('0x9')](_0x5607('0xa'),_0x49f0f2,_0x5607('0xb'));logger[_0x5607('0xc')](_0x5607('0xd'),_0x49f0f2,_0x5607('0xb'),JSON[_0x5607('0xe')](_0x2aec99));if(_0x2aec99['error']){if(_0x2aec99[_0x5607('0xf')][_0x5607('0x10')]===0x1f4){logger[_0x5607('0xf')]('ContactItemType,\x20%s,\x20%s',_0x49f0f2,_0x2aec99[_0x5607('0xf')][_0x5607('0x11')]);return _0xbdf802(_0x2aec99['error'][_0x5607('0x11')]);}logger[_0x5607('0xf')]('ContactItemType,\x20%s,\x20%s',_0x49f0f2,_0x2aec99[_0x5607('0xf')]['message']);return _0x5f92ad(_0x2aec99[_0x5607('0xf')][_0x5607('0x11')]);}else{logger[_0x5607('0x9')](_0x5607('0xa'),_0x49f0f2,_0x5607('0xb'));_0x5f92ad(_0x2aec99[_0x5607('0x12')][_0x5607('0x11')]);}})[_0x5607('0x13')](function(_0x156060){logger[_0x5607('0xf')](_0x5607('0xa'),_0x49f0f2,_0x156060);_0xbdf802(_0x156060);});});} \ No newline at end of file diff --git a/server/api/contactItemType/index.js b/server/api/contactItemType/index.js index 1a5cb48..24933d4 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 _0x34ef=['/:id','update','delete','destroy','exports','multer','path','connect-timeout','express','../../config/environment','./contactItemType.controller','get','index','isAuthenticated','post','create','put'];(function(_0xb75b5b,_0x3e79e0){var _0x4b6d76=function(_0x19b3fa){while(--_0x19b3fa){_0xb75b5b['push'](_0xb75b5b['shift']());}};_0x4b6d76(++_0x3e79e0);}(_0x34ef,0xc0));var _0xf34e=function(_0x428bcb,_0x2e5365){_0x428bcb=_0x428bcb-0x0;var _0x2bbd41=_0x34ef[_0x428bcb];return _0x2bbd41;};'use strict';var multer=require(_0xf34e('0x0'));var util=require('util');var path=require(_0xf34e('0x1'));var timeout=require(_0xf34e('0x2'));var express=require(_0xf34e('0x3'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xf34e('0x4'));var controller=require(_0xf34e('0x5'));router[_0xf34e('0x6')]('/',auth['isAuthenticated'](),controller[_0xf34e('0x7')]);router['get']('/:id',auth[_0xf34e('0x8')](),controller['show']);router[_0xf34e('0x9')]('/',auth[_0xf34e('0x8')](),controller[_0xf34e('0xa')]);router[_0xf34e('0xb')](_0xf34e('0xc'),auth[_0xf34e('0x8')](),controller[_0xf34e('0xd')]);router[_0xf34e('0xe')](_0xf34e('0xc'),auth[_0xf34e('0x8')](),controller[_0xf34e('0xf')]);module[_0xf34e('0x10')]=router; \ No newline at end of file +var _0x79a2=['../../components/interaction/service','../../config/environment','./contactItemType.controller','get','isAuthenticated','/:id','show','post','create','update','delete','multer','util','path','connect-timeout','express','Router'];(function(_0x2cec5c,_0x1c452d){var _0x4920c4=function(_0x5edf2e){while(--_0x5edf2e){_0x2cec5c['push'](_0x2cec5c['shift']());}};_0x4920c4(++_0x1c452d);}(_0x79a2,0x1a3));var _0x279a=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0x79a2[_0x4565bf];return _0x5610ba;};'use strict';var multer=require(_0x279a('0x0'));var util=require(_0x279a('0x1'));var path=require(_0x279a('0x2'));var timeout=require(_0x279a('0x3'));var express=require(_0x279a('0x4'));var router=express[_0x279a('0x5')]();var auth=require('../../components/auth/service');var interaction=require(_0x279a('0x6'));var config=require(_0x279a('0x7'));var controller=require(_0x279a('0x8'));router[_0x279a('0x9')]('/',auth[_0x279a('0xa')](),controller['index']);router[_0x279a('0x9')](_0x279a('0xb'),auth[_0x279a('0xa')](),controller[_0x279a('0xc')]);router[_0x279a('0xd')]('/',auth[_0x279a('0xa')](),controller[_0x279a('0xe')]);router['put'](_0x279a('0xb'),auth[_0x279a('0xa')](),controller[_0x279a('0xf')]);router[_0x279a('0x10')](_0x279a('0xb'),auth[_0x279a('0xa')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.attributes.js b/server/api/dashboard/dashboard.attributes.js index f78ba4f..5745c5c 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 _0x0e6a=['name','exports','STRING'];(function(_0x6e4f10,_0x649a11){var _0x280287=function(_0x1f8346){while(--_0x1f8346){_0x6e4f10['push'](_0x6e4f10['shift']());}};_0x280287(++_0x649a11);}(_0x0e6a,0x100));var _0xa0e6=function(_0x3a3b6a,_0x51e1e5){_0x3a3b6a=_0x3a3b6a-0x0;var _0x2c5061=_0x0e6a[_0x3a3b6a];return _0x2c5061;};'use strict';var Sequelize=require('sequelize');module[_0xa0e6('0x0')]={'name':{'type':Sequelize[_0xa0e6('0x1')],'allowNull':![],'unique':_0xa0e6('0x2')},'description':{'type':Sequelize[_0xa0e6('0x1')]}}; \ No newline at end of file +var _0x4a99=['sequelize','name','STRING'];(function(_0x2ad5a6,_0x42ff60){var _0x13267f=function(_0x5ca534){while(--_0x5ca534){_0x2ad5a6['push'](_0x2ad5a6['shift']());}};_0x13267f(++_0x42ff60);}(_0x4a99,0x1aa));var _0x94a9=function(_0x37bd26,_0x5ad346){_0x37bd26=_0x37bd26-0x0;var _0xe83dc4=_0x4a99[_0x37bd26];return _0xe83dc4;};'use strict';var Sequelize=require(_0x94a9('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x94a9('0x1')},'description':{'type':Sequelize[_0x94a9('0x2')]}}; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.controller.js b/server/api/dashboard/dashboard.controller.js index 5522034..0ccd82b 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 _0x187e=['error','iframe','attrUrl','attrs','https://','custom','attrPath','value','attrHourFormat','attrFontSize','counter','attrMetric','attrVoiceQueues','multibar-chart','pie-chart','attrSerie1','attrSerie2','attrSerie3','attrReport','reportType','attrRefresh','widgetAttributes:\x20%s','stringify','DashboardId','DashboardItem','getItems','findOne','hasOwnProperty','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','lodash','squel','crypto','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./dashboard.socket','register','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','get','CustomDashboards','UserProfileResource','sendStatus','stack','name','send','index','map','Dashboard','fieldName','type','key','model','query','filters','intersection','attributes','fields','nolimit','order','sort','where','pick','filter','merge','includeAll','findAll','rows','show','params','keys','rawAttributes','include','find','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','length','options','omit','createdAt','updatedAt'];(function(_0x37c22c,_0x28a70d){var _0x119d79=function(_0x243a13){while(--_0x243a13){_0x37c22c['push'](_0x37c22c['shift']());}};_0x119d79(++_0x28a70d);}(_0x187e,0x18d));var _0xe187=function(_0x234d19,_0xb2f44b){_0x234d19=_0x234d19-0x0;var _0x1fe212=_0x187e[_0x234d19];return _0x1fe212;};'use strict';var pdf=require(_0xe187('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xe187('0x1'));var zipdir=require(_0xe187('0x2'));var jsonpatch=require(_0xe187('0x3'));var rp=require(_0xe187('0x4'));var moment=require(_0xe187('0x5'));var BPromise=require(_0xe187('0x6'));var Mustache=require('mustache');var util=require(_0xe187('0x7'));var path=require(_0xe187('0x8'));var sox=require(_0xe187('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0xe187('0xa'));var squel=require(_0xe187('0xb'));var crypto=require(_0xe187('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xe187('0xd'));var toCsv=require(_0xe187('0xe'));var querystring=require('querystring');var Papa=require(_0xe187('0xf'));var Redis=require(_0xe187('0x10'));var authService=require(_0xe187('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xe187('0x12'));var hardwareService=require(_0xe187('0x13'));var logger=require(_0xe187('0x14'))(_0xe187('0x15'));var utils=require(_0xe187('0x16'));var config=require('../../config/environment');var db=require(_0xe187('0x17'))['db'];config[_0xe187('0x18')]=_[_0xe187('0x19')](config[_0xe187('0x18')],{'host':_0xe187('0x1a'),'port':0x18eb});var socket=require(_0xe187('0x1b'))(new Redis(config[_0xe187('0x18')]));require(_0xe187('0x1c'))[_0xe187('0x1d')](socket);function respondWithStatusCode(_0x56258c,_0x1902b7){_0x1902b7=_0x1902b7||0xcc;return function(_0x554c8e){if(_0x554c8e){return _0x56258c['sendStatus'](_0x1902b7);}return _0x56258c[_0xe187('0x1e')](_0x1902b7)[_0xe187('0x1f')]();};}function respondWithResult(_0x5a47a4,_0x6af385){_0x6af385=_0x6af385||0xc8;return function(_0x3e7024){if(_0x3e7024){return _0x5a47a4[_0xe187('0x1e')](_0x6af385)[_0xe187('0x20')](_0x3e7024);}};}function respondWithFilteredResult(_0x4c7bcc,_0x5bedb8){return function(_0x57b454){if(_0x57b454){var _0x316fd2=_0x57b454[_0xe187('0x21')],_0x26aeb2=_0x5bedb8[_0xe187('0x22')],_0x452e54=_0x5bedb8[_0xe187('0x22')]+_0x5bedb8[_0xe187('0x23')],_0x597fb2;if(_0x452e54>=_0x316fd2){_0x452e54=_0x316fd2;_0x597fb2=0xc8;}else{_0x597fb2=0xce;}_0x4c7bcc[_0xe187('0x1e')](_0x597fb2);return _0x4c7bcc[_0xe187('0x24')](_0xe187('0x25'),_0x26aeb2+'-'+_0x452e54+'/'+_0x316fd2)[_0xe187('0x20')](_0x57b454);}return null;};}function patchUpdates(_0x471ec4){return function(_0x28666f){try{jsonpatch[_0xe187('0x26')](_0x28666f,_0x471ec4,!![]);}catch(_0x2060c0){return BPromise[_0xe187('0x27')](_0x2060c0);}return _0x28666f[_0xe187('0x28')]();};}function saveUpdates(_0x4904ed,_0x15830f){return function(_0x58edeb){if(_0x58edeb){return _0x58edeb[_0xe187('0x29')](_0x4904ed)[_0xe187('0x2a')](function(_0x574321){return _0x574321;});}return null;};}function removeEntity(_0x55779a,_0x2900b1){return function(_0x255bc4){if(_0x255bc4){return _0x255bc4[_0xe187('0x2b')]()[_0xe187('0x2a')](function(){var _0x37318c=_0x255bc4[_0xe187('0x2c')]({'plain':!![]});var _0xb57471=_0xe187('0x2d');return db[_0xe187('0x2e')][_0xe187('0x2b')]({'where':{'type':_0xb57471,'resourceId':_0x37318c['id']}})[_0xe187('0x2a')](function(){return _0x255bc4;});})['then'](function(){_0x55779a['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x10512b,_0x17fd93){return function(_0x5c4d94){if(!_0x5c4d94){_0x10512b[_0xe187('0x2f')](0x194);}return _0x5c4d94;};}function handleError(_0x12cc62,_0x58c077){_0x58c077=_0x58c077||0x1f4;return function(_0x38fd94){logger['error'](_0x38fd94[_0xe187('0x30')]);if(_0x38fd94['name']){delete _0x38fd94[_0xe187('0x31')];}_0x12cc62[_0xe187('0x1e')](_0x58c077)[_0xe187('0x32')](_0x38fd94);};}exports[_0xe187('0x33')]=function(_0x1dff59,_0x3701d1){var _0x306ac6={},_0x4d2666={},_0x18bc4c={'count':0x0,'rows':[]};var _0x9f1c45=_[_0xe187('0x34')](db[_0xe187('0x35')]['rawAttributes'],function(_0x46da77){return{'name':_0x46da77[_0xe187('0x36')],'type':_0x46da77[_0xe187('0x37')][_0xe187('0x38')]};});_0x4d2666[_0xe187('0x39')]=_['map'](_0x9f1c45,'name');_0x4d2666[_0xe187('0x3a')]=_['keys'](_0x1dff59[_0xe187('0x3a')]);_0x4d2666[_0xe187('0x3b')]=_[_0xe187('0x3c')](_0x4d2666[_0xe187('0x39')],_0x4d2666[_0xe187('0x3a')]);_0x306ac6[_0xe187('0x3d')]=_['intersection'](_0x4d2666[_0xe187('0x39')],qs[_0xe187('0x3e')](_0x1dff59[_0xe187('0x3a')][_0xe187('0x3e')]));_0x306ac6[_0xe187('0x3d')]=_0x306ac6['attributes']['length']?_0x306ac6['attributes']:_0x4d2666[_0xe187('0x39')];if(!_0x1dff59[_0xe187('0x3a')]['hasOwnProperty'](_0xe187('0x3f'))){_0x306ac6[_0xe187('0x23')]=qs[_0xe187('0x23')](_0x1dff59[_0xe187('0x3a')][_0xe187('0x23')]);_0x306ac6[_0xe187('0x22')]=qs[_0xe187('0x22')](_0x1dff59[_0xe187('0x3a')][_0xe187('0x22')]);}_0x306ac6[_0xe187('0x40')]=qs[_0xe187('0x41')](_0x1dff59[_0xe187('0x3a')]['sort']);_0x306ac6[_0xe187('0x42')]=qs[_0xe187('0x3b')](_[_0xe187('0x43')](_0x1dff59[_0xe187('0x3a')],_0x4d2666['filters']),_0x9f1c45);if(_0x1dff59['query'][_0xe187('0x44')]){_0x306ac6[_0xe187('0x42')]=_['merge'](_0x306ac6[_0xe187('0x42')],{'$or':_['map'](_0x9f1c45,function(_0x379d4d){if(_0x379d4d[_0xe187('0x37')]!=='VIRTUAL'){var _0x16d8d9={};_0x16d8d9[_0x379d4d[_0xe187('0x31')]]={'$like':'%'+_0x1dff59['query']['filter']+'%'};return _0x16d8d9;}})});}_0x306ac6=_[_0xe187('0x45')]({},_0x306ac6,_0x1dff59['options']);var _0x2af640={'where':_0x306ac6[_0xe187('0x42')]};return db[_0xe187('0x35')][_0xe187('0x21')](_0x2af640)[_0xe187('0x2a')](function(_0x222f0c){_0x18bc4c[_0xe187('0x21')]=_0x222f0c;if(_0x1dff59[_0xe187('0x3a')][_0xe187('0x46')]){_0x306ac6['include']=[{'all':!![]}];}return db[_0xe187('0x35')][_0xe187('0x47')](_0x306ac6);})[_0xe187('0x2a')](function(_0x416b25){_0x18bc4c[_0xe187('0x48')]=_0x416b25;return _0x18bc4c;})[_0xe187('0x2a')](respondWithFilteredResult(_0x3701d1,_0x306ac6))['catch'](handleError(_0x3701d1,null));};exports[_0xe187('0x49')]=function(_0x327c9a,_0x271d3d){var _0x433abe={'raw':![],'where':{'id':_0x327c9a[_0xe187('0x4a')]['id']}},_0x4e0360={};_0x4e0360[_0xe187('0x39')]=_[_0xe187('0x4b')](db[_0xe187('0x35')][_0xe187('0x4c')]);_0x4e0360[_0xe187('0x3a')]=_['keys'](_0x327c9a[_0xe187('0x3a')]);_0x4e0360['filters']=_[_0xe187('0x3c')](_0x4e0360[_0xe187('0x39')],_0x4e0360[_0xe187('0x3a')]);_0x433abe['attributes']=_[_0xe187('0x3c')](_0x4e0360[_0xe187('0x39')],qs[_0xe187('0x3e')](_0x327c9a[_0xe187('0x3a')]['fields']));_0x433abe[_0xe187('0x3d')]=_0x433abe[_0xe187('0x3d')]['length']?_0x433abe[_0xe187('0x3d')]:_0x4e0360[_0xe187('0x39')];if(_0x327c9a['query'][_0xe187('0x46')]){_0x433abe[_0xe187('0x4d')]=[{'all':!![]}];}_0x433abe=_[_0xe187('0x45')]({},_0x433abe,_0x327c9a['options']);return db['Dashboard'][_0xe187('0x4e')](_0x433abe)['then'](handleEntityNotFound(_0x271d3d,null))[_0xe187('0x2a')](respondWithResult(_0x271d3d,null))[_0xe187('0x4f')](handleError(_0x271d3d,null));};exports[_0xe187('0x50')]=function(_0x87d3d8,_0x465b8d){return db[_0xe187('0x35')]['create'](_0x87d3d8[_0xe187('0x51')],{})[_0xe187('0x2a')](function(_0x4eaa1f){var _0x53daaf=_0x87d3d8[_0xe187('0x52')][_0xe187('0x2c')]({'plain':!![]});if(!_0x53daaf)throw new Error(_0xe187('0x53'));if(_0x53daaf[_0xe187('0x54')]===_0xe187('0x52')){var _0x436932=_0x4eaa1f[_0xe187('0x2c')]({'plain':!![]});var _0x306691=_0xe187('0x2d');return db[_0xe187('0x55')][_0xe187('0x4e')]({'where':{'name':_0x306691,'userProfileId':_0x53daaf[_0xe187('0x56')]},'raw':!![]})[_0xe187('0x2a')](function(_0x334af7){if(_0x334af7&&_0x334af7[_0xe187('0x57')]===0x0){return db[_0xe187('0x2e')][_0xe187('0x50')]({'name':_0x436932[_0xe187('0x31')],'resourceId':_0x436932['id'],'type':_0x334af7[_0xe187('0x31')],'sectionId':_0x334af7['id']},{})[_0xe187('0x2a')](function(){return _0x4eaa1f;});}else{return _0x4eaa1f;}})[_0xe187('0x4f')](function(_0x4441f5){logger['error'](_0xe187('0x58'),_0x4441f5);throw _0x4441f5;});}return _0x4eaa1f;})[_0xe187('0x2a')](respondWithResult(_0x465b8d,0xc9))[_0xe187('0x4f')](handleError(_0x465b8d,null));};exports[_0xe187('0x59')]=function(_0x224ce6,_0x3c4b62){var _0x169854={'where':{'id':_0x224ce6[_0xe187('0x4a')]['id']}},_0x3e6a1d={};_0x3e6a1d[_0xe187('0x39')]=_[_0xe187('0x4b')](db[_0xe187('0x35')][_0xe187('0x4c')]);_0x169854[_0xe187('0x3d')]=_[_0xe187('0x3c')](_0x3e6a1d[_0xe187('0x39')],qs[_0xe187('0x3e')](_0x224ce6[_0xe187('0x3a')][_0xe187('0x3e')]));_0x169854['attributes']=_0x169854[_0xe187('0x3d')][_0xe187('0x5a')]?_0x169854[_0xe187('0x3d')]:_0x3e6a1d[_0xe187('0x39')];if(_0x224ce6[_0xe187('0x3a')][_0xe187('0x46')]){_0x169854[_0xe187('0x4d')]=[{'all':!![]}];}_0x169854=_[_0xe187('0x45')]({},_0x169854,_0x224ce6[_0xe187('0x5b')]);return db[_0xe187('0x35')][_0xe187('0x4e')](_0x169854)[_0xe187('0x2a')](handleEntityNotFound(_0x3c4b62,null))[_0xe187('0x2a')](function(_0x162ac3){if(_0x162ac3){var _0x1ff357=_0x162ac3[_0xe187('0x2c')]({'plain':!![]});_0x1ff357=qs[_0xe187('0x5c')](_0x1ff357,['id',_0xe187('0x5d'),_0xe187('0x5e')]);_0x224ce6['body']=_[_0xe187('0x5c')](_0x224ce6[_0xe187('0x51')],['id',_0xe187('0x5d'),_0xe187('0x5e')]);return db[_0xe187('0x35')]['create'](_[_0xe187('0x45')](_0x1ff357,_0x224ce6['body']),{'include':_0x224ce6[_0xe187('0x3a')][_0xe187('0x46')]?[{'all':!![]}]:undefined})['then'](function(_0x47519b){var _0x318f6d=_0x224ce6[_0xe187('0x52')][_0xe187('0x2c')]({'plain':!![]});if(!_0x318f6d)throw new Error(_0xe187('0x53'));if(_0x318f6d[_0xe187('0x54')]==='user'){var _0xb5675d=_0x47519b[_0xe187('0x2c')]({'plain':!![]});var _0x2bd7ab=_0xe187('0x2d');return db[_0xe187('0x55')][_0xe187('0x4e')]({'where':{'name':_0x2bd7ab,'userProfileId':_0x318f6d[_0xe187('0x56')]},'raw':!![]})[_0xe187('0x2a')](function(_0x268317){if(_0x268317&&_0x268317[_0xe187('0x57')]===0x0){return db[_0xe187('0x2e')]['create']({'name':_0xb5675d['name'],'resourceId':_0xb5675d['id'],'type':_0x268317[_0xe187('0x31')],'sectionId':_0x268317['id']},{})[_0xe187('0x2a')](function(){return _0x47519b;});}else{return _0x47519b;}})[_0xe187('0x4f')](function(_0x1acec6){logger[_0xe187('0x5f')](_0xe187('0x58'),_0x1acec6);throw _0x1acec6;});}return _0x47519b;});}})[_0xe187('0x2a')](respondWithResult(_0x3c4b62,0xc9))[_0xe187('0x4f')](handleError(_0x3c4b62,null));};exports[_0xe187('0x29')]=function(_0x4898ba,_0x4d07c4){if(_0x4898ba['body']['id']){delete _0x4898ba[_0xe187('0x51')]['id'];}return db['Dashboard']['find']({'where':{'id':_0x4898ba['params']['id']}})[_0xe187('0x2a')](handleEntityNotFound(_0x4d07c4,null))['then'](saveUpdates(_0x4898ba[_0xe187('0x51')],null))['then'](respondWithResult(_0x4d07c4,null))[_0xe187('0x4f')](handleError(_0x4d07c4,null));};exports[_0xe187('0x2b')]=function(_0x26b693,_0x42ddae){return db['Dashboard'][_0xe187('0x4e')]({'where':{'id':_0x26b693[_0xe187('0x4a')]['id']}})[_0xe187('0x2a')](handleEntityNotFound(_0x42ddae,null))[_0xe187('0x2a')](removeEntity(_0x42ddae,null))[_0xe187('0x4f')](handleError(_0x42ddae,null));};function widgetAttributes(_0x4cfdb3){try{switch(_0x4cfdb3[_0xe187('0x37')]){case _0xe187('0x60'):return[{'name':_0xe187('0x61'),'value':_0x4cfdb3[_0xe187('0x61')]||(_0x4cfdb3[_0xe187('0x62')]&&_0x4cfdb3['attrs'][0x0]?_0x4cfdb3[_0xe187('0x62')][0x0]['value']:undefined)||_0xe187('0x63')}];case _0xe187('0x64'):return[{'name':_0xe187('0x65'),'value':_0x4cfdb3[_0xe187('0x65')]||(_0x4cfdb3[_0xe187('0x62')]&&_0x4cfdb3[_0xe187('0x62')][0x0]?_0x4cfdb3[_0xe187('0x62')][0x0][_0xe187('0x66')]:undefined)||''}];case'clock':return[{'name':_0xe187('0x67'),'value':_0x4cfdb3['attrHourFormat']||(_0x4cfdb3[_0xe187('0x62')]&&_0x4cfdb3[_0xe187('0x62')][0x0]?_0x4cfdb3['attrs'][0x0]['value']:undefined)||'HH:mm:ss'},{'name':'attrTimezone','value':_0x4cfdb3['attrTimezone']||(_0x4cfdb3[_0xe187('0x62')]&&_0x4cfdb3[_0xe187('0x62')][0x1]?_0x4cfdb3['attrs'][0x1][_0xe187('0x66')]:undefined)||'0.00'},{'name':_0xe187('0x68'),'value':_0x4cfdb3[_0xe187('0x68')]||(_0x4cfdb3[_0xe187('0x62')]&&_0x4cfdb3[_0xe187('0x62')][0x2]?_0x4cfdb3[_0xe187('0x62')][0x2]['value']:undefined)||0xc}];case _0xe187('0x69'):return[{'name':_0xe187('0x6a'),'value':_0x4cfdb3[_0xe187('0x6a')]||(_0x4cfdb3['attrs']&&_0x4cfdb3[_0xe187('0x62')][0x0]?_0x4cfdb3[_0xe187('0x62')][0x0][_0xe187('0x66')]:undefined)||'total'},{'name':_0xe187('0x6b'),'value':_0x4cfdb3[_0xe187('0x6b')]||(_0x4cfdb3['attrs']&&_0x4cfdb3[_0xe187('0x62')][0x1]?_0x4cfdb3[_0xe187('0x62')][0x1][_0xe187('0x66')]:undefined)||[]},{'name':'attrFontSize','value':_0x4cfdb3[_0xe187('0x68')]||(_0x4cfdb3[_0xe187('0x62')]&&_0x4cfdb3['attrs'][0x2]?_0x4cfdb3[_0xe187('0x62')][0x2]['value']:undefined)||0x14}];case _0xe187('0x6c'):case _0xe187('0x6d'):return[{'name':_0xe187('0x6e'),'value':_0x4cfdb3[_0xe187('0x6e')]||(_0x4cfdb3[_0xe187('0x62')]&&_0x4cfdb3[_0xe187('0x62')][0x0]?_0x4cfdb3[_0xe187('0x62')][0x0][_0xe187('0x66')]:undefined)||'total'},{'name':_0xe187('0x6f'),'value':_0x4cfdb3[_0xe187('0x6f')]||(_0x4cfdb3[_0xe187('0x62')]&&_0x4cfdb3[_0xe187('0x62')][0x1]?_0x4cfdb3['attrs'][0x1][_0xe187('0x66')]:undefined)||null},{'name':_0xe187('0x70'),'value':_0x4cfdb3[_0xe187('0x70')]||(_0x4cfdb3[_0xe187('0x62')]&&_0x4cfdb3[_0xe187('0x62')][0x2]?_0x4cfdb3['attrs'][0x2][_0xe187('0x66')]:undefined)||null},{'name':_0xe187('0x6b'),'value':_0x4cfdb3[_0xe187('0x6b')]||(_0x4cfdb3[_0xe187('0x62')]&&_0x4cfdb3[_0xe187('0x62')][0x3]?_0x4cfdb3[_0xe187('0x62')][0x3][_0xe187('0x66')]:undefined)||[]}];case'web-report':return[{'name':_0xe187('0x71'),'type':_0x4cfdb3[_0xe187('0x72')]||(_0x4cfdb3[_0xe187('0x62')]&&_0x4cfdb3[_0xe187('0x62')][0x0]?_0x4cfdb3[_0xe187('0x62')][0x0]['type']:undefined)||null,'value':_0x4cfdb3[_0xe187('0x71')]||(_0x4cfdb3['attrs']&&_0x4cfdb3['attrs'][0x0]?_0x4cfdb3[_0xe187('0x62')][0x0][_0xe187('0x66')]:undefined)||null},{'name':_0xe187('0x73'),'value':_0x4cfdb3['attrRefresh']||(_0x4cfdb3[_0xe187('0x62')]&&_0x4cfdb3[_0xe187('0x62')][0x1]?_0x4cfdb3[_0xe187('0x62')][0x1]['value']:undefined)||0x0}];default:return[];}}catch(_0x35d2e8){logger[_0xe187('0x5f')](_0xe187('0x74'),JSON[_0xe187('0x75')](_0x35d2e8));return[];}}exports['addItem']=function(_0x284466,_0x1c2885,_0xaf39a2){if(_0x284466['body']['id']){delete _0x284466[_0xe187('0x51')]['id'];}return db[_0xe187('0x35')][_0xe187('0x4e')]({'where':{'id':_0x284466[_0xe187('0x4a')]['id']}})[_0xe187('0x2a')](handleEntityNotFound(_0x1c2885,null))[_0xe187('0x2a')](function(_0x221f7c){if(_0x221f7c){_0x284466[_0xe187('0x51')][_0xe187('0x76')]=_0x221f7c['id'];_0x284466[_0xe187('0x51')]['attrs']=widgetAttributes(_0x284466[_0xe187('0x51')]);return db[_0xe187('0x77')][_0xe187('0x50')](_0x284466[_0xe187('0x51')]);}})[_0xe187('0x2a')](respondWithResult(_0x1c2885,null))[_0xe187('0x4f')](handleError(_0x1c2885,null));};exports[_0xe187('0x78')]=function(_0x2f182e,_0x413fa6,_0x225849){var _0x1be5dc={};var _0x436fc7={};var _0xce693c;var _0x732273;return db['Dashboard'][_0xe187('0x79')]({'where':{'id':_0x2f182e['params']['id']}})[_0xe187('0x2a')](handleEntityNotFound(_0x413fa6,null))['then'](function(_0x1ba213){if(_0x1ba213){_0xce693c=_0x1ba213;_0x436fc7[_0xe187('0x39')]=_[_0xe187('0x4b')](db[_0xe187('0x77')]['rawAttributes']);_0x436fc7[_0xe187('0x3a')]=_['keys'](_0x2f182e['query']);_0x436fc7[_0xe187('0x3b')]=_['intersection'](_0x436fc7[_0xe187('0x39')],_0x436fc7[_0xe187('0x3a')]);_0x1be5dc[_0xe187('0x3d')]=_[_0xe187('0x3c')](_0x436fc7['model'],qs['fields'](_0x2f182e['query'][_0xe187('0x3e')]));_0x1be5dc[_0xe187('0x3d')]=_0x1be5dc['attributes'][_0xe187('0x5a')]?_0x1be5dc[_0xe187('0x3d')]:_0x436fc7['model'];_0x1be5dc['order']=qs[_0xe187('0x41')](_0x2f182e['query'][_0xe187('0x41')]);_0x1be5dc[_0xe187('0x42')]=qs[_0xe187('0x3b')](_[_0xe187('0x43')](_0x2f182e['query'],_0x436fc7[_0xe187('0x3b')]));if(_0x2f182e[_0xe187('0x3a')][_0xe187('0x44')]){_0x1be5dc['where']=_['merge'](_0x1be5dc[_0xe187('0x42')],{'$or':_[_0xe187('0x34')](_0x1be5dc['attributes'],function(_0x43cf03){var _0x4c0f48={};_0x4c0f48[_0x43cf03]={'$like':'%'+_0x2f182e['query'][_0xe187('0x44')]+'%'};return _0x4c0f48;})});}_0x1be5dc=_[_0xe187('0x45')]({},_0x1be5dc,_0x2f182e[_0xe187('0x5b')]);return _0xce693c[_0xe187('0x78')](_0x1be5dc);}})[_0xe187('0x2a')](function(_0x245c42){if(_0x245c42){_0x732273=_0x245c42[_0xe187('0x5a')];if(!_0x2f182e[_0xe187('0x3a')][_0xe187('0x7a')](_0xe187('0x3f'))){_0x1be5dc[_0xe187('0x23')]=qs[_0xe187('0x23')](_0x2f182e[_0xe187('0x3a')]['limit']);_0x1be5dc[_0xe187('0x22')]=qs[_0xe187('0x22')](_0x2f182e[_0xe187('0x3a')][_0xe187('0x22')]);}return _0xce693c[_0xe187('0x78')](_0x1be5dc);}})[_0xe187('0x2a')](function(_0x4fc3e5){if(_0x4fc3e5){return _0x4fc3e5?{'count':_0x732273,'rows':_0x4fc3e5}:null;}})[_0xe187('0x2a')](respondWithResult(_0x413fa6,null))[_0xe187('0x4f')](handleError(_0x413fa6,null));}; \ No newline at end of file +var _0x64f9=['counter','attrMetric','total','attrVoiceQueues','multibar-chart','attrSerie1','attrSerie2','attrSerie3','web-report','reportType','attrReport','attrRefresh','widgetAttributes:\x20%s','stringify','addItem','DashboardItem','getItems','findOne','filter','hasOwnProperty','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./dashboard.socket','sendStatus','status','json','offset','limit','set','apply','save','update','then','get','CustomDashboards','end','error','stack','send','map','Dashboard','rawAttributes','type','key','name','query','keys','filters','intersection','model','attributes','fields','length','nolimit','sort','where','pick','VIRTUAL','merge','options','count','includeAll','include','findAll','catch','params','find','create','user','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','clone','createdAt','updatedAt','omit','body','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','iframe','attrUrl','attrs','value','https://','custom','attrPath','attrHourFormat','attrTimezone','0.00','attrFontSize'];(function(_0x37817f,_0x3f242b){var _0x6e2a0b=function(_0x3b33e4){while(--_0x3b33e4){_0x37817f['push'](_0x37817f['shift']());}};_0x6e2a0b(++_0x3f242b);}(_0x64f9,0x17c));var _0x964f=function(_0x1d426f,_0x37e919){_0x1d426f=_0x1d426f-0x0;var _0x17f71a=_0x64f9[_0x1d426f];return _0x17f71a;};'use strict';var pdf=require(_0x964f('0x0'));var emlformat=require(_0x964f('0x1'));var rimraf=require(_0x964f('0x2'));var zipdir=require(_0x964f('0x3'));var jsonpatch=require(_0x964f('0x4'));var rp=require(_0x964f('0x5'));var moment=require(_0x964f('0x6'));var BPromise=require(_0x964f('0x7'));var Mustache=require(_0x964f('0x8'));var util=require(_0x964f('0x9'));var path=require(_0x964f('0xa'));var sox=require('sox');var csv=require(_0x964f('0xb'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x964f('0xc'));var squel=require(_0x964f('0xd'));var crypto=require(_0x964f('0xe'));var jsforce=require(_0x964f('0xf'));var deskjs=require(_0x964f('0x10'));var toCsv=require(_0x964f('0xb'));var querystring=require(_0x964f('0x11'));var Papa=require(_0x964f('0x12'));var Redis=require('ioredis');var authService=require(_0x964f('0x13'));var qs=require(_0x964f('0x14'));var as=require(_0x964f('0x15'));var hardwareService=require(_0x964f('0x16'));var logger=require('../../config/logger')(_0x964f('0x17'));var utils=require(_0x964f('0x18'));var config=require(_0x964f('0x19'));var db=require(_0x964f('0x1a'))['db'];config[_0x964f('0x1b')]=_[_0x964f('0x1c')](config[_0x964f('0x1b')],{'host':_0x964f('0x1d'),'port':0x18eb});var socket=require(_0x964f('0x1e'))(new Redis(config[_0x964f('0x1b')]));require(_0x964f('0x1f'))['register'](socket);function respondWithStatusCode(_0x1b4cd9,_0x5b3938){_0x5b3938=_0x5b3938||0xcc;return function(_0x5bc93f){if(_0x5bc93f){return _0x1b4cd9[_0x964f('0x20')](_0x5b3938);}return _0x1b4cd9[_0x964f('0x21')](_0x5b3938)['end']();};}function respondWithResult(_0x49aa68,_0x4f6f5f){_0x4f6f5f=_0x4f6f5f||0xc8;return function(_0x401539){if(_0x401539){return _0x49aa68[_0x964f('0x21')](_0x4f6f5f)[_0x964f('0x22')](_0x401539);}};}function respondWithFilteredResult(_0x1b1647,_0x220d58){return function(_0x1b212c){if(_0x1b212c){var _0x275b12=_0x1b212c['count'],_0x1899e8=_0x220d58[_0x964f('0x23')],_0x261dbc=_0x220d58[_0x964f('0x23')]+_0x220d58[_0x964f('0x24')],_0x122201;if(_0x261dbc>=_0x275b12){_0x261dbc=_0x275b12;_0x122201=0xc8;}else{_0x122201=0xce;}_0x1b1647[_0x964f('0x21')](_0x122201);return _0x1b1647[_0x964f('0x25')]('Content-Range',_0x1899e8+'-'+_0x261dbc+'/'+_0x275b12)[_0x964f('0x22')](_0x1b212c);}return null;};}function patchUpdates(_0x18de55){return function(_0x48358a){try{jsonpatch[_0x964f('0x26')](_0x48358a,_0x18de55,!![]);}catch(_0x1e3f0a){return BPromise['reject'](_0x1e3f0a);}return _0x48358a[_0x964f('0x27')]();};}function saveUpdates(_0x4a9acb,_0x155646){return function(_0x3240c4){if(_0x3240c4){return _0x3240c4[_0x964f('0x28')](_0x4a9acb)[_0x964f('0x29')](function(_0x46936b){return _0x46936b;});}return null;};}function removeEntity(_0x2bf709,_0x3ca7c3){return function(_0x2238d6){if(_0x2238d6){return _0x2238d6['destroy']()[_0x964f('0x29')](function(){var _0x228702=_0x2238d6[_0x964f('0x2a')]({'plain':!![]});var _0x142f16=_0x964f('0x2b');return db['UserProfileResource']['destroy']({'where':{'type':_0x142f16,'resourceId':_0x228702['id']}})[_0x964f('0x29')](function(){return _0x2238d6;});})[_0x964f('0x29')](function(){_0x2bf709[_0x964f('0x21')](0xcc)[_0x964f('0x2c')]();});}};}function handleEntityNotFound(_0xa4d7f5,_0x14f740){return function(_0xcbc026){if(!_0xcbc026){_0xa4d7f5[_0x964f('0x20')](0x194);}return _0xcbc026;};}function handleError(_0x3d61e3,_0x2ddd7d){_0x2ddd7d=_0x2ddd7d||0x1f4;return function(_0x62189f){logger[_0x964f('0x2d')](_0x62189f[_0x964f('0x2e')]);if(_0x62189f['name']){delete _0x62189f['name'];}_0x3d61e3['status'](_0x2ddd7d)[_0x964f('0x2f')](_0x62189f);};}exports['index']=function(_0x5a0201,_0x4d0c15){var _0x285a52={},_0x12e618={},_0x2da33a={'count':0x0,'rows':[]};var _0x4b515c=_[_0x964f('0x30')](db[_0x964f('0x31')][_0x964f('0x32')],function(_0x18de38){return{'name':_0x18de38['fieldName'],'type':_0x18de38[_0x964f('0x33')][_0x964f('0x34')]};});_0x12e618['model']=_[_0x964f('0x30')](_0x4b515c,_0x964f('0x35'));_0x12e618[_0x964f('0x36')]=_[_0x964f('0x37')](_0x5a0201[_0x964f('0x36')]);_0x12e618[_0x964f('0x38')]=_[_0x964f('0x39')](_0x12e618[_0x964f('0x3a')],_0x12e618[_0x964f('0x36')]);_0x285a52[_0x964f('0x3b')]=_[_0x964f('0x39')](_0x12e618[_0x964f('0x3a')],qs['fields'](_0x5a0201['query'][_0x964f('0x3c')]));_0x285a52['attributes']=_0x285a52['attributes'][_0x964f('0x3d')]?_0x285a52[_0x964f('0x3b')]:_0x12e618['model'];if(!_0x5a0201[_0x964f('0x36')]['hasOwnProperty'](_0x964f('0x3e'))){_0x285a52[_0x964f('0x24')]=qs[_0x964f('0x24')](_0x5a0201['query'][_0x964f('0x24')]);_0x285a52[_0x964f('0x23')]=qs[_0x964f('0x23')](_0x5a0201[_0x964f('0x36')][_0x964f('0x23')]);}_0x285a52['order']=qs[_0x964f('0x3f')](_0x5a0201['query'][_0x964f('0x3f')]);_0x285a52[_0x964f('0x40')]=qs['filters'](_[_0x964f('0x41')](_0x5a0201[_0x964f('0x36')],_0x12e618[_0x964f('0x38')]),_0x4b515c);if(_0x5a0201[_0x964f('0x36')]['filter']){_0x285a52[_0x964f('0x40')]=_['merge'](_0x285a52['where'],{'$or':_[_0x964f('0x30')](_0x4b515c,function(_0x1a6965){if(_0x1a6965[_0x964f('0x33')]!==_0x964f('0x42')){var _0x46f706={};_0x46f706[_0x1a6965[_0x964f('0x35')]]={'$like':'%'+_0x5a0201['query']['filter']+'%'};return _0x46f706;}})});}_0x285a52=_[_0x964f('0x43')]({},_0x285a52,_0x5a0201[_0x964f('0x44')]);var _0x417a11={'where':_0x285a52[_0x964f('0x40')]};return db['Dashboard'][_0x964f('0x45')](_0x417a11)[_0x964f('0x29')](function(_0x25911b){_0x2da33a[_0x964f('0x45')]=_0x25911b;if(_0x5a0201[_0x964f('0x36')][_0x964f('0x46')]){_0x285a52[_0x964f('0x47')]=[{'all':!![]}];}return db[_0x964f('0x31')][_0x964f('0x48')](_0x285a52);})[_0x964f('0x29')](function(_0x47e8e5){_0x2da33a['rows']=_0x47e8e5;return _0x2da33a;})[_0x964f('0x29')](respondWithFilteredResult(_0x4d0c15,_0x285a52))[_0x964f('0x49')](handleError(_0x4d0c15,null));};exports['show']=function(_0x5e4718,_0x26c736){var _0x40bf36={'raw':![],'where':{'id':_0x5e4718[_0x964f('0x4a')]['id']}},_0x5f44fc={};_0x5f44fc[_0x964f('0x3a')]=_[_0x964f('0x37')](db[_0x964f('0x31')]['rawAttributes']);_0x5f44fc[_0x964f('0x36')]=_[_0x964f('0x37')](_0x5e4718[_0x964f('0x36')]);_0x5f44fc[_0x964f('0x38')]=_['intersection'](_0x5f44fc['model'],_0x5f44fc['query']);_0x40bf36[_0x964f('0x3b')]=_[_0x964f('0x39')](_0x5f44fc[_0x964f('0x3a')],qs[_0x964f('0x3c')](_0x5e4718[_0x964f('0x36')][_0x964f('0x3c')]));_0x40bf36[_0x964f('0x3b')]=_0x40bf36[_0x964f('0x3b')][_0x964f('0x3d')]?_0x40bf36['attributes']:_0x5f44fc[_0x964f('0x3a')];if(_0x5e4718['query'][_0x964f('0x46')]){_0x40bf36[_0x964f('0x47')]=[{'all':!![]}];}_0x40bf36=_['merge']({},_0x40bf36,_0x5e4718['options']);return db[_0x964f('0x31')][_0x964f('0x4b')](_0x40bf36)[_0x964f('0x29')](handleEntityNotFound(_0x26c736,null))[_0x964f('0x29')](respondWithResult(_0x26c736,null))['catch'](handleError(_0x26c736,null));};exports[_0x964f('0x4c')]=function(_0x1acab7,_0x15fa5d){return db[_0x964f('0x31')][_0x964f('0x4c')](_0x1acab7['body'],{})['then'](function(_0x3c2e3f){var _0x358dd0=_0x1acab7[_0x964f('0x4d')][_0x964f('0x2a')]({'plain':!![]});if(!_0x358dd0)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x358dd0[_0x964f('0x4e')]===_0x964f('0x4d')){var _0x436478=_0x3c2e3f[_0x964f('0x2a')]({'plain':!![]});var _0x4372d2=_0x964f('0x2b');return db[_0x964f('0x4f')][_0x964f('0x4b')]({'where':{'name':_0x4372d2,'userProfileId':_0x358dd0[_0x964f('0x50')]},'raw':!![]})[_0x964f('0x29')](function(_0x3f536c){if(_0x3f536c&&_0x3f536c[_0x964f('0x51')]===0x0){return db[_0x964f('0x52')]['create']({'name':_0x436478[_0x964f('0x35')],'resourceId':_0x436478['id'],'type':_0x3f536c[_0x964f('0x35')],'sectionId':_0x3f536c['id']},{})['then'](function(){return _0x3c2e3f;});}else{return _0x3c2e3f;}})[_0x964f('0x49')](function(_0x4a292e){logger[_0x964f('0x2d')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x4a292e);throw _0x4a292e;});}return _0x3c2e3f;})['then'](respondWithResult(_0x15fa5d,0xc9))[_0x964f('0x49')](handleError(_0x15fa5d,null));};exports[_0x964f('0x53')]=function(_0x351bd1,_0x296a98){var _0x2e66db={'where':{'id':_0x351bd1[_0x964f('0x4a')]['id']}},_0x342d75={};_0x342d75['model']=_[_0x964f('0x37')](db['Dashboard']['rawAttributes']);_0x2e66db[_0x964f('0x3b')]=_[_0x964f('0x39')](_0x342d75['model'],qs[_0x964f('0x3c')](_0x351bd1[_0x964f('0x36')][_0x964f('0x3c')]));_0x2e66db[_0x964f('0x3b')]=_0x2e66db[_0x964f('0x3b')]['length']?_0x2e66db[_0x964f('0x3b')]:_0x342d75['model'];if(_0x351bd1['query'][_0x964f('0x46')]){_0x2e66db['include']=[{'all':!![]}];}_0x2e66db=_[_0x964f('0x43')]({},_0x2e66db,_0x351bd1[_0x964f('0x44')]);return db[_0x964f('0x31')][_0x964f('0x4b')](_0x2e66db)[_0x964f('0x29')](handleEntityNotFound(_0x296a98,null))[_0x964f('0x29')](function(_0x333110){if(_0x333110){var _0x216a31=_0x333110['get']({'plain':!![]});_0x216a31=qs['omit'](_0x216a31,['id',_0x964f('0x54'),_0x964f('0x55')]);_0x351bd1['body']=_[_0x964f('0x56')](_0x351bd1[_0x964f('0x57')],['id',_0x964f('0x54'),_0x964f('0x55')]);return db['Dashboard'][_0x964f('0x4c')](_[_0x964f('0x43')](_0x216a31,_0x351bd1[_0x964f('0x57')]),{'include':_0x351bd1[_0x964f('0x36')][_0x964f('0x46')]?[{'all':!![]}]:undefined})['then'](function(_0x37e7f4){var _0xaa5d1c=_0x351bd1[_0x964f('0x4d')][_0x964f('0x2a')]({'plain':!![]});if(!_0xaa5d1c)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0xaa5d1c[_0x964f('0x4e')]==='user'){var _0x522300=_0x37e7f4['get']({'plain':!![]});var _0x10deaf=_0x964f('0x2b');return db[_0x964f('0x4f')][_0x964f('0x4b')]({'where':{'name':_0x10deaf,'userProfileId':_0xaa5d1c[_0x964f('0x50')]},'raw':!![]})['then'](function(_0x2c4e2e){if(_0x2c4e2e&&_0x2c4e2e[_0x964f('0x51')]===0x0){return db[_0x964f('0x52')][_0x964f('0x4c')]({'name':_0x522300[_0x964f('0x35')],'resourceId':_0x522300['id'],'type':_0x2c4e2e[_0x964f('0x35')],'sectionId':_0x2c4e2e['id']},{})['then'](function(){return _0x37e7f4;});}else{return _0x37e7f4;}})[_0x964f('0x49')](function(_0x9009bf){logger[_0x964f('0x2d')](_0x964f('0x58'),_0x9009bf);throw _0x9009bf;});}return _0x37e7f4;});}})[_0x964f('0x29')](respondWithResult(_0x296a98,0xc9))[_0x964f('0x49')](handleError(_0x296a98,null));};exports[_0x964f('0x28')]=function(_0x5c79f4,_0x30cff4){if(_0x5c79f4[_0x964f('0x57')]['id']){delete _0x5c79f4['body']['id'];}return db[_0x964f('0x31')][_0x964f('0x4b')]({'where':{'id':_0x5c79f4[_0x964f('0x4a')]['id']}})[_0x964f('0x29')](handleEntityNotFound(_0x30cff4,null))[_0x964f('0x29')](saveUpdates(_0x5c79f4['body'],null))[_0x964f('0x29')](respondWithResult(_0x30cff4,null))['catch'](handleError(_0x30cff4,null));};exports['destroy']=function(_0x342394,_0x20b637){return db[_0x964f('0x31')][_0x964f('0x4b')]({'where':{'id':_0x342394[_0x964f('0x4a')]['id']}})[_0x964f('0x29')](handleEntityNotFound(_0x20b637,null))[_0x964f('0x29')](removeEntity(_0x20b637,null))[_0x964f('0x49')](handleError(_0x20b637,null));};function widgetAttributes(_0x569e6d){try{switch(_0x569e6d[_0x964f('0x33')]){case _0x964f('0x59'):return[{'name':_0x964f('0x5a'),'value':_0x569e6d[_0x964f('0x5a')]||(_0x569e6d[_0x964f('0x5b')]&&_0x569e6d[_0x964f('0x5b')][0x0]?_0x569e6d[_0x964f('0x5b')][0x0][_0x964f('0x5c')]:undefined)||_0x964f('0x5d')}];case _0x964f('0x5e'):return[{'name':_0x964f('0x5f'),'value':_0x569e6d[_0x964f('0x5f')]||(_0x569e6d['attrs']&&_0x569e6d[_0x964f('0x5b')][0x0]?_0x569e6d[_0x964f('0x5b')][0x0][_0x964f('0x5c')]:undefined)||''}];case'clock':return[{'name':_0x964f('0x60'),'value':_0x569e6d['attrHourFormat']||(_0x569e6d['attrs']&&_0x569e6d[_0x964f('0x5b')][0x0]?_0x569e6d[_0x964f('0x5b')][0x0][_0x964f('0x5c')]:undefined)||'HH:mm:ss'},{'name':_0x964f('0x61'),'value':_0x569e6d[_0x964f('0x61')]||(_0x569e6d['attrs']&&_0x569e6d[_0x964f('0x5b')][0x1]?_0x569e6d['attrs'][0x1][_0x964f('0x5c')]:undefined)||_0x964f('0x62')},{'name':'attrFontSize','value':_0x569e6d[_0x964f('0x63')]||(_0x569e6d[_0x964f('0x5b')]&&_0x569e6d[_0x964f('0x5b')][0x2]?_0x569e6d[_0x964f('0x5b')][0x2][_0x964f('0x5c')]:undefined)||0xc}];case _0x964f('0x64'):return[{'name':_0x964f('0x65'),'value':_0x569e6d[_0x964f('0x65')]||(_0x569e6d[_0x964f('0x5b')]&&_0x569e6d['attrs'][0x0]?_0x569e6d['attrs'][0x0]['value']:undefined)||_0x964f('0x66')},{'name':_0x964f('0x67'),'value':_0x569e6d[_0x964f('0x67')]||(_0x569e6d[_0x964f('0x5b')]&&_0x569e6d[_0x964f('0x5b')][0x1]?_0x569e6d[_0x964f('0x5b')][0x1][_0x964f('0x5c')]:undefined)||[]},{'name':_0x964f('0x63'),'value':_0x569e6d['attrFontSize']||(_0x569e6d['attrs']&&_0x569e6d[_0x964f('0x5b')][0x2]?_0x569e6d[_0x964f('0x5b')][0x2]['value']:undefined)||0x14}];case _0x964f('0x68'):case'pie-chart':return[{'name':_0x964f('0x69'),'value':_0x569e6d['attrSerie1']||(_0x569e6d['attrs']&&_0x569e6d[_0x964f('0x5b')][0x0]?_0x569e6d[_0x964f('0x5b')][0x0][_0x964f('0x5c')]:undefined)||_0x964f('0x66')},{'name':'attrSerie2','value':_0x569e6d[_0x964f('0x6a')]||(_0x569e6d[_0x964f('0x5b')]&&_0x569e6d[_0x964f('0x5b')][0x1]?_0x569e6d[_0x964f('0x5b')][0x1]['value']:undefined)||null},{'name':_0x964f('0x6b'),'value':_0x569e6d['attrSerie3']||(_0x569e6d[_0x964f('0x5b')]&&_0x569e6d[_0x964f('0x5b')][0x2]?_0x569e6d['attrs'][0x2][_0x964f('0x5c')]:undefined)||null},{'name':_0x964f('0x67'),'value':_0x569e6d[_0x964f('0x67')]||(_0x569e6d[_0x964f('0x5b')]&&_0x569e6d[_0x964f('0x5b')][0x3]?_0x569e6d[_0x964f('0x5b')][0x3][_0x964f('0x5c')]:undefined)||[]}];case _0x964f('0x6c'):return[{'name':'attrReport','type':_0x569e6d[_0x964f('0x6d')]||(_0x569e6d[_0x964f('0x5b')]&&_0x569e6d[_0x964f('0x5b')][0x0]?_0x569e6d[_0x964f('0x5b')][0x0][_0x964f('0x33')]:undefined)||null,'value':_0x569e6d[_0x964f('0x6e')]||(_0x569e6d[_0x964f('0x5b')]&&_0x569e6d[_0x964f('0x5b')][0x0]?_0x569e6d[_0x964f('0x5b')][0x0]['value']:undefined)||null},{'name':_0x964f('0x6f'),'value':_0x569e6d[_0x964f('0x6f')]||(_0x569e6d[_0x964f('0x5b')]&&_0x569e6d[_0x964f('0x5b')][0x1]?_0x569e6d[_0x964f('0x5b')][0x1][_0x964f('0x5c')]:undefined)||0x0}];default:return[];}}catch(_0x52396f){logger['error'](_0x964f('0x70'),JSON[_0x964f('0x71')](_0x52396f));return[];}}exports[_0x964f('0x72')]=function(_0xac6ce9,_0x499371,_0x4576f7){if(_0xac6ce9[_0x964f('0x57')]['id']){delete _0xac6ce9[_0x964f('0x57')]['id'];}return db[_0x964f('0x31')][_0x964f('0x4b')]({'where':{'id':_0xac6ce9['params']['id']}})[_0x964f('0x29')](handleEntityNotFound(_0x499371,null))[_0x964f('0x29')](function(_0x3bb637){if(_0x3bb637){_0xac6ce9[_0x964f('0x57')]['DashboardId']=_0x3bb637['id'];_0xac6ce9[_0x964f('0x57')][_0x964f('0x5b')]=widgetAttributes(_0xac6ce9[_0x964f('0x57')]);return db[_0x964f('0x73')][_0x964f('0x4c')](_0xac6ce9['body']);}})[_0x964f('0x29')](respondWithResult(_0x499371,null))[_0x964f('0x49')](handleError(_0x499371,null));};exports[_0x964f('0x74')]=function(_0x2a5d59,_0xc30766,_0x5e5cb6){var _0x6189ea={};var _0x54320d={};var _0x5869ee;var _0x4b4deb;return db[_0x964f('0x31')][_0x964f('0x75')]({'where':{'id':_0x2a5d59[_0x964f('0x4a')]['id']}})[_0x964f('0x29')](handleEntityNotFound(_0xc30766,null))['then'](function(_0x421d64){if(_0x421d64){_0x5869ee=_0x421d64;_0x54320d['model']=_['keys'](db[_0x964f('0x73')][_0x964f('0x32')]);_0x54320d[_0x964f('0x36')]=_[_0x964f('0x37')](_0x2a5d59['query']);_0x54320d[_0x964f('0x38')]=_['intersection'](_0x54320d[_0x964f('0x3a')],_0x54320d['query']);_0x6189ea['attributes']=_['intersection'](_0x54320d[_0x964f('0x3a')],qs[_0x964f('0x3c')](_0x2a5d59[_0x964f('0x36')][_0x964f('0x3c')]));_0x6189ea[_0x964f('0x3b')]=_0x6189ea[_0x964f('0x3b')][_0x964f('0x3d')]?_0x6189ea[_0x964f('0x3b')]:_0x54320d[_0x964f('0x3a')];_0x6189ea['order']=qs[_0x964f('0x3f')](_0x2a5d59[_0x964f('0x36')][_0x964f('0x3f')]);_0x6189ea[_0x964f('0x40')]=qs[_0x964f('0x38')](_[_0x964f('0x41')](_0x2a5d59['query'],_0x54320d['filters']));if(_0x2a5d59[_0x964f('0x36')][_0x964f('0x76')]){_0x6189ea[_0x964f('0x40')]=_[_0x964f('0x43')](_0x6189ea[_0x964f('0x40')],{'$or':_[_0x964f('0x30')](_0x6189ea[_0x964f('0x3b')],function(_0x1dc99b){var _0x3e8185={};_0x3e8185[_0x1dc99b]={'$like':'%'+_0x2a5d59[_0x964f('0x36')][_0x964f('0x76')]+'%'};return _0x3e8185;})});}_0x6189ea=_[_0x964f('0x43')]({},_0x6189ea,_0x2a5d59[_0x964f('0x44')]);return _0x5869ee[_0x964f('0x74')](_0x6189ea);}})[_0x964f('0x29')](function(_0x343985){if(_0x343985){_0x4b4deb=_0x343985['length'];if(!_0x2a5d59[_0x964f('0x36')][_0x964f('0x77')]('nolimit')){_0x6189ea['limit']=qs[_0x964f('0x24')](_0x2a5d59['query'][_0x964f('0x24')]);_0x6189ea[_0x964f('0x23')]=qs[_0x964f('0x23')](_0x2a5d59[_0x964f('0x36')][_0x964f('0x23')]);}return _0x5869ee[_0x964f('0x74')](_0x6189ea);}})[_0x964f('0x29')](function(_0xea5717){if(_0xea5717){return _0xea5717?{'count':_0x4b4deb,'rows':_0xea5717}:null;}})[_0x964f('0x29')](respondWithResult(_0xc30766,null))[_0x964f('0x49')](handleError(_0xc30766,null));}; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.events.js b/server/api/dashboard/dashboard.events.js index 00dd87c..11042cc 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 _0x0adf=['Dashboard','setMaxListeners','save','update','emit','hook','exports','../../mysqldb'];(function(_0x513047,_0x2199c5){var _0x15b779=function(_0x412fd5){while(--_0x412fd5){_0x513047['push'](_0x513047['shift']());}};_0x15b779(++_0x2199c5);}(_0x0adf,0xdf));var _0xf0ad=function(_0x49a81c,_0x157493){_0x49a81c=_0x49a81c-0x0;var _0x1cff10=_0x0adf[_0x49a81c];return _0x1cff10;};'use strict';var EventEmitter=require('events');var Dashboard=require(_0xf0ad('0x0'))['db'][_0xf0ad('0x1')];var DashboardEvents=new EventEmitter();DashboardEvents[_0xf0ad('0x2')](0x0);var events={'afterCreate':_0xf0ad('0x3'),'afterUpdate':_0xf0ad('0x4'),'afterDestroy':'remove'};function emitEvent(_0x111860){return function(_0x472b97,_0x28c32b,_0x4345b7){DashboardEvents[_0xf0ad('0x5')](_0x111860+':'+_0x472b97['id'],_0x472b97);DashboardEvents[_0xf0ad('0x5')](_0x111860,_0x472b97);_0x4345b7(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];Dashboard[_0xf0ad('0x6')](e,emitEvent(event));}}module[_0xf0ad('0x7')]=DashboardEvents; \ No newline at end of file +var _0x9137=['save','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','setMaxListeners'];(function(_0x1b5a05,_0x2c80de){var _0x347931=function(_0xd39454){while(--_0xd39454){_0x1b5a05['push'](_0x1b5a05['shift']());}};_0x347931(++_0x2c80de);}(_0x9137,0x126));var _0x7913=function(_0x677920,_0x1e3e6a){_0x677920=_0x677920-0x0;var _0x1c593b=_0x9137[_0x677920];return _0x1c593b;};'use strict';var EventEmitter=require(_0x7913('0x0'));var Dashboard=require(_0x7913('0x1'))['db']['Dashboard'];var DashboardEvents=new EventEmitter();DashboardEvents[_0x7913('0x2')](0x0);var events={'afterCreate':_0x7913('0x3'),'afterUpdate':'update','afterDestroy':_0x7913('0x4')};function emitEvent(_0x43c0fb){return function(_0x298b0a,_0x2f182b,_0x334fde){DashboardEvents[_0x7913('0x5')](_0x43c0fb+':'+_0x298b0a['id'],_0x298b0a);DashboardEvents[_0x7913('0x5')](_0x43c0fb,_0x298b0a);_0x334fde(null);};}for(var e in events){if(events[_0x7913('0x6')](e)){var event=events[e];Dashboard[_0x7913('0x7')](e,emitEvent(event));}}module[_0x7913('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 bd44282..f3f0359 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 _0x9916=['request-promise','path','rimraf','../../config/environment','exports','define','Dashboard','dashboards','util','../../config/logger','api','moment','bluebird'];(function(_0x4d613c,_0x55f220){var _0x301fe3=function(_0x5eec0b){while(--_0x5eec0b){_0x4d613c['push'](_0x4d613c['shift']());}};_0x301fe3(++_0x55f220);}(_0x9916,0x1dc));var _0x6991=function(_0x52198b,_0x11e264){_0x52198b=_0x52198b-0x0;var _0x1553c6=_0x9916[_0x52198b];return _0x1553c6;};'use strict';var _=require('lodash');var util=require(_0x6991('0x0'));var logger=require(_0x6991('0x1'))(_0x6991('0x2'));var moment=require(_0x6991('0x3'));var BPromise=require(_0x6991('0x4'));var rp=require(_0x6991('0x5'));var fs=require('fs');var path=require(_0x6991('0x6'));var rimraf=require(_0x6991('0x7'));var config=require(_0x6991('0x8'));var attributes=require('./dashboard.attributes');module[_0x6991('0x9')]=function(_0x5d61c1,_0x56fbcd){return _0x5d61c1[_0x6991('0xa')](_0x6991('0xb'),attributes,{'tableName':_0x6991('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x83e7=['rimraf','exports','lodash','../../config/logger','api','bluebird','request-promise','path'];(function(_0xbb091,_0x3fe7ee){var _0x467a04=function(_0x3a978d){while(--_0x3a978d){_0xbb091['push'](_0xbb091['shift']());}};_0x467a04(++_0x3fe7ee);}(_0x83e7,0x1e2));var _0x783e=function(_0x895358,_0x32f914){_0x895358=_0x895358-0x0;var _0x26e26e=_0x83e7[_0x895358];return _0x26e26e;};'use strict';var _=require(_0x783e('0x0'));var util=require('util');var logger=require(_0x783e('0x1'))(_0x783e('0x2'));var moment=require('moment');var BPromise=require(_0x783e('0x3'));var rp=require(_0x783e('0x4'));var fs=require('fs');var path=require(_0x783e('0x5'));var rimraf=require(_0x783e('0x6'));var config=require('../../config/environment');var attributes=require('./dashboard.attributes');module[_0x783e('0x7')]=function(_0x35ef4a,_0x9daaec){return _0x35ef4a['define']('Dashboard',attributes,{'tableName':'dashboards','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.rpc.js b/server/api/dashboard/dashboard.rpc.js index 9c6fcef..2af894d 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 _0x8684=['stringify','error','code','message','Dashboard,\x20%s,\x20%s','result','lodash','bluebird','randomstring','ioredis','../../config/logger','jayson/promise','client','redis','defaults','localhost','./dashboard.socket','then','info','request\x20sent','debug','Dashboard,\x20%s,\x20%s,\x20%s'];(function(_0x52355b,_0x89404e){var _0xf86f90=function(_0x146a84){while(--_0x146a84){_0x52355b['push'](_0x52355b['shift']());}};_0xf86f90(++_0x89404e);}(_0x8684,0x150));var _0x4868=function(_0x4e8b80,_0x4d66e2){_0x4e8b80=_0x4e8b80-0x0;var _0x94200a=_0x8684[_0x4e8b80];return _0x94200a;};'use strict';var _=require(_0x4868('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x4868('0x1'));var rs=require(_0x4868('0x2'));var fs=require('fs');var Redis=require(_0x4868('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x4868('0x4'))('rpc');var config=require('../../config/environment');var jayson=require(_0x4868('0x5'));var client=jayson[_0x4868('0x6')]['http']({'port':0x232a});config[_0x4868('0x7')]=_[_0x4868('0x8')](config[_0x4868('0x7')],{'host':_0x4868('0x9'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x4868('0x7')]));require(_0x4868('0xa'))['register'](socket);function respondWithRpcPromise(_0x6c9549,_0x42c142,_0xf7bf8b){return new BPromise(function(_0xd2612e,_0x2f33c9){return client['request'](_0x6c9549,_0xf7bf8b)[_0x4868('0xb')](function(_0x55741f){logger[_0x4868('0xc')]('Dashboard,\x20%s,\x20%s',_0x42c142,_0x4868('0xd'));logger[_0x4868('0xe')](_0x4868('0xf'),_0x42c142,'request\x20sent',JSON[_0x4868('0x10')](_0x55741f));if(_0x55741f['error']){if(_0x55741f[_0x4868('0x11')][_0x4868('0x12')]===0x1f4){logger[_0x4868('0x11')]('Dashboard,\x20%s,\x20%s',_0x42c142,_0x55741f[_0x4868('0x11')][_0x4868('0x13')]);return _0x2f33c9(_0x55741f[_0x4868('0x11')][_0x4868('0x13')]);}logger[_0x4868('0x11')](_0x4868('0x14'),_0x42c142,_0x55741f[_0x4868('0x11')][_0x4868('0x13')]);return _0xd2612e(_0x55741f['error'][_0x4868('0x13')]);}else{logger[_0x4868('0xc')]('Dashboard,\x20%s,\x20%s',_0x42c142,'request\x20sent');_0xd2612e(_0x55741f[_0x4868('0x15')][_0x4868('0x13')]);}})['catch'](function(_0x50df50){logger[_0x4868('0x11')](_0x4868('0x14'),_0x42c142,_0x50df50);_0x2f33c9(_0x50df50);});});} \ No newline at end of file +var _0xbf52=['request\x20sent','debug','Dashboard,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','util','bluebird','randomstring','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./dashboard.socket','request','then','info','Dashboard,\x20%s,\x20%s'];(function(_0x3737c5,_0x1d420c){var _0x5d2b1c=function(_0x6567ae){while(--_0x6567ae){_0x3737c5['push'](_0x3737c5['shift']());}};_0x5d2b1c(++_0x1d420c);}(_0xbf52,0x1a8));var _0x2bf5=function(_0x623c6f,_0x34e2ef){_0x623c6f=_0x623c6f-0x0;var _0x3c7fa1=_0xbf52[_0x623c6f];return _0x3c7fa1;};'use strict';var _=require('lodash');var util=require(_0x2bf5('0x0'));var moment=require('moment');var BPromise=require(_0x2bf5('0x1'));var rs=require(_0x2bf5('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x2bf5('0x3'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x2bf5('0x4'));var config=require(_0x2bf5('0x5'));var jayson=require(_0x2bf5('0x6'));var client=jayson[_0x2bf5('0x7')][_0x2bf5('0x8')]({'port':0x232a});config[_0x2bf5('0x9')]=_[_0x2bf5('0xa')](config[_0x2bf5('0x9')],{'host':_0x2bf5('0xb'),'port':0x18eb});var socket=require(_0x2bf5('0xc'))(new Redis(config['redis']));require(_0x2bf5('0xd'))['register'](socket);function respondWithRpcPromise(_0x16ebe4,_0x3d4ed3,_0x2e4e31){return new BPromise(function(_0x4ec8ab,_0x393e2d){return client[_0x2bf5('0xe')](_0x16ebe4,_0x2e4e31)[_0x2bf5('0xf')](function(_0x8db7d8){logger[_0x2bf5('0x10')](_0x2bf5('0x11'),_0x3d4ed3,_0x2bf5('0x12'));logger[_0x2bf5('0x13')](_0x2bf5('0x14'),_0x3d4ed3,_0x2bf5('0x12'),JSON['stringify'](_0x8db7d8));if(_0x8db7d8[_0x2bf5('0x15')]){if(_0x8db7d8['error'][_0x2bf5('0x16')]===0x1f4){logger['error']('Dashboard,\x20%s,\x20%s',_0x3d4ed3,_0x8db7d8[_0x2bf5('0x15')][_0x2bf5('0x17')]);return _0x393e2d(_0x8db7d8['error'][_0x2bf5('0x17')]);}logger[_0x2bf5('0x15')](_0x2bf5('0x11'),_0x3d4ed3,_0x8db7d8[_0x2bf5('0x15')][_0x2bf5('0x17')]);return _0x4ec8ab(_0x8db7d8[_0x2bf5('0x15')][_0x2bf5('0x17')]);}else{logger[_0x2bf5('0x10')](_0x2bf5('0x11'),_0x3d4ed3,_0x2bf5('0x12'));_0x4ec8ab(_0x8db7d8[_0x2bf5('0x18')][_0x2bf5('0x17')]);}})[_0x2bf5('0x19')](function(_0x782322){logger[_0x2bf5('0x15')](_0x2bf5('0x11'),_0x3d4ed3,_0x782322);_0x393e2d(_0x782322);});});} \ No newline at end of file diff --git a/server/api/dashboard/dashboard.socket.js b/server/api/dashboard/dashboard.socket.js index 2666fd0..34d345c 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 _0x3ae2=['dashboard:','./dashboard.events','remove','update','emit','removeListener','register','length'];(function(_0x542850,_0x272d61){var _0x3a56c5=function(_0x14cc69){while(--_0x14cc69){_0x542850['push'](_0x542850['shift']());}};_0x3a56c5(++_0x272d61);}(_0x3ae2,0x89));var _0x23ae=function(_0x240261,_0x4fe66c){_0x240261=_0x240261-0x0;var _0x45c332=_0x3ae2[_0x240261];return _0x45c332;};'use strict';var DashboardEvents=require(_0x23ae('0x0'));var events=['save',_0x23ae('0x1'),_0x23ae('0x2')];function createListener(_0x5b3841,_0x2789aa){return function(_0x268d05){_0x2789aa[_0x23ae('0x3')](_0x5b3841,_0x268d05);};}function removeListener(_0x49b823,_0x3c52bd){return function(){DashboardEvents[_0x23ae('0x4')](_0x49b823,_0x3c52bd);};}exports[_0x23ae('0x5')]=function(_0x4a666e){for(var _0x2487d6=0x0,_0x1b2660=events[_0x23ae('0x6')];_0x2487d6<_0x1b2660;_0x2487d6++){var _0x22a237=events[_0x2487d6];var _0x366a41=createListener(_0x23ae('0x7')+_0x22a237,_0x4a666e);DashboardEvents['on'](_0x22a237,_0x366a41);}}; \ No newline at end of file +var _0x12ba=['save','remove','update','emit','removeListener','register','dashboard:','./dashboard.events'];(function(_0x2d7f0e,_0x3e6fbd){var _0x110b07=function(_0x557b00){while(--_0x557b00){_0x2d7f0e['push'](_0x2d7f0e['shift']());}};_0x110b07(++_0x3e6fbd);}(_0x12ba,0x137));var _0xa12b=function(_0x59e19d,_0x189496){_0x59e19d=_0x59e19d-0x0;var _0x4215d6=_0x12ba[_0x59e19d];return _0x4215d6;};'use strict';var DashboardEvents=require(_0xa12b('0x0'));var events=[_0xa12b('0x1'),_0xa12b('0x2'),_0xa12b('0x3')];function createListener(_0x17362f,_0x25e0be){return function(_0x5949d0){_0x25e0be[_0xa12b('0x4')](_0x17362f,_0x5949d0);};}function removeListener(_0x5bfce8,_0x15d9e3){return function(){DashboardEvents[_0xa12b('0x5')](_0x5bfce8,_0x15d9e3);};}exports[_0xa12b('0x6')]=function(_0x2a3fc1){for(var _0x349bba=0x0,_0x2a47f3=events['length'];_0x349bba<_0x2a47f3;_0x349bba++){var _0x13a28f=events[_0x349bba];var _0x2a2811=createListener(_0xa12b('0x7')+_0x13a28f,_0x2a3fc1);DashboardEvents['on'](_0x13a28f,_0x2a2811);}}; \ No newline at end of file diff --git a/server/api/dashboard/index.js b/server/api/dashboard/index.js index 32485ac..bf1ed51 100644 --- a/server/api/dashboard/index.js +++ b/server/api/dashboard/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0713=['exports','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./dashboard.controller','get','isAuthenticated','index','/:id','show','/:id/items','getItems','create','post','/:id/clone','addItem','put','update'];(function(_0x3ee810,_0x22540d){var _0x2788d2=function(_0x470c50){while(--_0x470c50){_0x3ee810['push'](_0x3ee810['shift']());}};_0x2788d2(++_0x22540d);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x3071('0x0'));var timeout=require(_0x3071('0x1'));var express=require(_0x3071('0x2'));var router=express[_0x3071('0x3')]();var auth=require(_0x3071('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x3071('0x5'));var controller=require(_0x3071('0x6'));router[_0x3071('0x7')]('/',auth[_0x3071('0x8')](),controller[_0x3071('0x9')]);router[_0x3071('0x7')](_0x3071('0xa'),auth[_0x3071('0x8')](),controller[_0x3071('0xb')]);router[_0x3071('0x7')](_0x3071('0xc'),auth[_0x3071('0x8')](),controller[_0x3071('0xd')]);router['post']('/',auth[_0x3071('0x8')](),controller[_0x3071('0xe')]);router[_0x3071('0xf')](_0x3071('0x10'),auth[_0x3071('0x8')](),controller['clone']);router[_0x3071('0xf')](_0x3071('0xc'),auth[_0x3071('0x8')](),controller[_0x3071('0x11')]);router[_0x3071('0x12')]('/:id',auth['isAuthenticated'](),controller[_0x3071('0x13')]);router['delete'](_0x3071('0xa'),auth[_0x3071('0x8')](),controller['destroy']);module[_0x3071('0x14')]=router; \ No newline at end of file +var _0xd8b0=['../../components/auth/service','../../components/interaction/service','../../config/environment','./dashboard.controller','index','get','/:id','show','isAuthenticated','getItems','post','create','/:id/clone','addItem','put','update','delete','destroy','exports','multer','util','Router'];(function(_0xe4bb3d,_0x21e87e){var _0xd9e51=function(_0x1f732b){while(--_0x1f732b){_0xe4bb3d['push'](_0xe4bb3d['shift']());}};_0xd9e51(++_0x21e87e);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var auth=require(_0x0d8b('0x3'));var interaction=require(_0x0d8b('0x4'));var config=require(_0x0d8b('0x5'));var controller=require(_0x0d8b('0x6'));router['get']('/',auth['isAuthenticated'](),controller[_0x0d8b('0x7')]);router[_0x0d8b('0x8')](_0x0d8b('0x9'),auth['isAuthenticated'](),controller[_0x0d8b('0xa')]);router[_0x0d8b('0x8')]('/:id/items',auth[_0x0d8b('0xb')](),controller[_0x0d8b('0xc')]);router[_0x0d8b('0xd')]('/',auth[_0x0d8b('0xb')](),controller[_0x0d8b('0xe')]);router[_0x0d8b('0xd')](_0x0d8b('0xf'),auth[_0x0d8b('0xb')](),controller['clone']);router[_0x0d8b('0xd')]('/:id/items',auth[_0x0d8b('0xb')](),controller[_0x0d8b('0x10')]);router[_0x0d8b('0x11')](_0x0d8b('0x9'),auth[_0x0d8b('0xb')](),controller[_0x0d8b('0x12')]);router[_0x0d8b('0x13')](_0x0d8b('0x9'),auth[_0x0d8b('0xb')](),controller[_0x0d8b('0x14')]);module[_0x0d8b('0x15')]=router; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.attributes.js b/server/api/dashboardItem/dashboardItem.attributes.js index 1a77237..e11dd94 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 _0x3713=['exports','STRING','TEXT','long','parse','getDataValue','setDataValue','attrs','INTEGER','#2196f3','sequelize','lodash'];(function(_0x2d69c0,_0x364d57){var _0x593cdc=function(_0x2a7a30){while(--_0x2a7a30){_0x2d69c0['push'](_0x2d69c0['shift']());}};_0x593cdc(++_0x364d57);}(_0x3713,0x18a));var _0x3371=function(_0x1e2b10,_0xf3c1ca){_0x1e2b10=_0x1e2b10-0x0;var _0x166bc8=_0x3713[_0x1e2b10];return _0x166bc8;};'use strict';var Sequelize=require(_0x3371('0x0'));var squel=require('squel');var _=require(_0x3371('0x1'));module[_0x3371('0x2')]={'title':{'type':Sequelize[_0x3371('0x3')],'allowNull':![]},'type':{'type':Sequelize[_0x3371('0x3')](0x14),'allowNull':![],'validate':{'len':[0x1,0x14]}},'attrs':{'type':Sequelize[_0x3371('0x4')](_0x3371('0x5')),'get':function(){try{return JSON[_0x3371('0x6')](this[_0x3371('0x7')]('attrs'));}catch(_0x2736fd){return[];}},'set':function(_0x1bbaf4){try{this[_0x3371('0x8')](_0x3371('0x9'),JSON['stringify'](_0x1bbaf4));}catch(_0x1840ce){this[_0x3371('0x8')]('attrs',JSON['stringify']([]));}}},'sizeX':{'type':Sequelize[_0x3371('0xa')],'allowNull':![],'defaultValue':0x1},'sizeY':{'type':Sequelize[_0x3371('0xa')],'allowNull':![],'defaultValue':0x1},'row':{'type':Sequelize['INTEGER']},'col':{'type':Sequelize['INTEGER']},'background':{'type':Sequelize[_0x3371('0x3')],'allowNull':![],'defaultValue':'#ffffff','validate':{'notEmpty':!![]}},'foreground':{'type':Sequelize[_0x3371('0x3')],'allowNull':![],'defaultValue':_0x3371('0xb'),'validate':{'notEmpty':!![]}},'link':{'type':Sequelize[_0x3371('0x3')]}}; \ No newline at end of file +var _0xe47d=['parse','getDataValue','setDataValue','attrs','stringify','INTEGER','#ffffff','#2196f3','sequelize','squel','lodash','exports','STRING','TEXT','long'];(function(_0x1ff8c7,_0x3c1a52){var _0x20957e=function(_0x2d0ac4){while(--_0x2d0ac4){_0x1ff8c7['push'](_0x1ff8c7['shift']());}};_0x20957e(++_0x3c1a52);}(_0xe47d,0x107));var _0xde47=function(_0x35d06a,_0x81abc0){_0x35d06a=_0x35d06a-0x0;var _0x3cf8a5=_0xe47d[_0x35d06a];return _0x3cf8a5;};'use strict';var Sequelize=require(_0xde47('0x0'));var squel=require(_0xde47('0x1'));var _=require(_0xde47('0x2'));module[_0xde47('0x3')]={'title':{'type':Sequelize[_0xde47('0x4')],'allowNull':![]},'type':{'type':Sequelize[_0xde47('0x4')](0x14),'allowNull':![],'validate':{'len':[0x1,0x14]}},'attrs':{'type':Sequelize[_0xde47('0x5')](_0xde47('0x6')),'get':function(){try{return JSON[_0xde47('0x7')](this[_0xde47('0x8')]('attrs'));}catch(_0x4d6e72){return[];}},'set':function(_0x29c03a){try{this[_0xde47('0x9')](_0xde47('0xa'),JSON[_0xde47('0xb')](_0x29c03a));}catch(_0x4adfeb){this[_0xde47('0x9')](_0xde47('0xa'),JSON[_0xde47('0xb')]([]));}}},'sizeX':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x1},'sizeY':{'type':Sequelize[_0xde47('0xc')],'allowNull':![],'defaultValue':0x1},'row':{'type':Sequelize['INTEGER']},'col':{'type':Sequelize[_0xde47('0xc')]},'background':{'type':Sequelize[_0xde47('0x4')],'allowNull':![],'defaultValue':_0xde47('0xd'),'validate':{'notEmpty':!![]}},'foreground':{'type':Sequelize[_0xde47('0x4')],'allowNull':![],'defaultValue':_0xde47('0xe'),'validate':{'notEmpty':!![]}},'link':{'type':Sequelize[_0xde47('0x4')]}}; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.controller.js b/server/api/dashboardItem/dashboardItem.controller.js index a35c35e..8cbfe7b 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 _0xd8e4=['jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','redis','localhost','socket.io-emitter','./dashboardItem.socket','sendStatus','status','end','json','count','offset','Content-Range','apply','reject','save','then','destroy','error','stack','name','send','show','params','model','keys','rawAttributes','query','filters','intersection','fields','attributes','length','include','merge','options','DashboardItem','find','catch','type','iframe','attrUrl','attrs','value','https://','custom','attrPath','attrHourFormat','attrTimezone','0.00','attrFontSize','attrMetric','total','attrVoiceQueues','multibar-chart','attrSerie2','attrSerie3','attrReport','attrRefresh','widgetAttributes:\x20%s','stringify','body','create','update','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto'];(function(_0x2ed396,_0x4e4dea){var _0x2adc27=function(_0x2a300e){while(--_0x2a300e){_0x2ed396['push'](_0x2ed396['shift']());}};_0x2adc27(++_0x4e4dea);}(_0xd8e4,0xa3));var _0x4d8e=function(_0x232e87,_0x203795){_0x232e87=_0x232e87-0x0;var _0x18c3ba=_0xd8e4[_0x232e87];return _0x18c3ba;};'use strict';var pdf=require(_0x4d8e('0x0'));var emlformat=require(_0x4d8e('0x1'));var rimraf=require(_0x4d8e('0x2'));var zipdir=require(_0x4d8e('0x3'));var jsonpatch=require(_0x4d8e('0x4'));var rp=require(_0x4d8e('0x5'));var moment=require(_0x4d8e('0x6'));var BPromise=require(_0x4d8e('0x7'));var Mustache=require(_0x4d8e('0x8'));var util=require(_0x4d8e('0x9'));var path=require(_0x4d8e('0xa'));var sox=require(_0x4d8e('0xb'));var csv=require(_0x4d8e('0xc'));var ejs=require(_0x4d8e('0xd'));var fs=require('fs');var _=require(_0x4d8e('0xe'));var squel=require(_0x4d8e('0xf'));var crypto=require(_0x4d8e('0x10'));var jsforce=require(_0x4d8e('0x11'));var deskjs=require(_0x4d8e('0x12'));var toCsv=require(_0x4d8e('0xc'));var querystring=require(_0x4d8e('0x13'));var Papa=require(_0x4d8e('0x14'));var Redis=require(_0x4d8e('0x15'));var authService=require('../../components/auth/service');var qs=require(_0x4d8e('0x16'));var as=require(_0x4d8e('0x17'));var hardwareService=require(_0x4d8e('0x18'));var logger=require(_0x4d8e('0x19'))(_0x4d8e('0x1a'));var utils=require(_0x4d8e('0x1b'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];config[_0x4d8e('0x1c')]=_['defaults'](config[_0x4d8e('0x1c')],{'host':_0x4d8e('0x1d'),'port':0x18eb});var socket=require(_0x4d8e('0x1e'))(new Redis(config['redis']));require(_0x4d8e('0x1f'))['register'](socket);function respondWithStatusCode(_0x3b930e,_0x536747){_0x536747=_0x536747||0xcc;return function(_0x40c7c8){if(_0x40c7c8){return _0x3b930e[_0x4d8e('0x20')](_0x536747);}return _0x3b930e[_0x4d8e('0x21')](_0x536747)[_0x4d8e('0x22')]();};}function respondWithResult(_0x411a5b,_0x36eb12){_0x36eb12=_0x36eb12||0xc8;return function(_0x3a286f){if(_0x3a286f){return _0x411a5b[_0x4d8e('0x21')](_0x36eb12)[_0x4d8e('0x23')](_0x3a286f);}};}function respondWithFilteredResult(_0x3e7c46,_0x3f13e1){return function(_0x55dfbc){if(_0x55dfbc){var _0x35c617=_0x55dfbc[_0x4d8e('0x24')],_0x3a761a=_0x3f13e1[_0x4d8e('0x25')],_0x272c70=_0x3f13e1[_0x4d8e('0x25')]+_0x3f13e1['limit'],_0x55625e;if(_0x272c70>=_0x35c617){_0x272c70=_0x35c617;_0x55625e=0xc8;}else{_0x55625e=0xce;}_0x3e7c46[_0x4d8e('0x21')](_0x55625e);return _0x3e7c46['set'](_0x4d8e('0x26'),_0x3a761a+'-'+_0x272c70+'/'+_0x35c617)['json'](_0x55dfbc);}return null;};}function patchUpdates(_0x23063d){return function(_0x23985c){try{jsonpatch[_0x4d8e('0x27')](_0x23985c,_0x23063d,!![]);}catch(_0x1e1b63){return BPromise[_0x4d8e('0x28')](_0x1e1b63);}return _0x23985c[_0x4d8e('0x29')]();};}function saveUpdates(_0xc15534,_0x10ff80){return function(_0x2a3080){if(_0x2a3080){return _0x2a3080['update'](_0xc15534)[_0x4d8e('0x2a')](function(_0xe7f972){return _0xe7f972;});}return null;};}function removeEntity(_0x3cabbc,_0x4787f4){return function(_0x27465b){if(_0x27465b){return _0x27465b[_0x4d8e('0x2b')]()['then'](function(){_0x3cabbc[_0x4d8e('0x21')](0xcc)[_0x4d8e('0x22')]();});}};}function handleEntityNotFound(_0x4932e3,_0x566852){return function(_0x3113c2){if(!_0x3113c2){_0x4932e3[_0x4d8e('0x20')](0x194);}return _0x3113c2;};}function handleError(_0x8840d,_0x1e9b85){_0x1e9b85=_0x1e9b85||0x1f4;return function(_0x3605f4){logger[_0x4d8e('0x2c')](_0x3605f4[_0x4d8e('0x2d')]);if(_0x3605f4[_0x4d8e('0x2e')]){delete _0x3605f4[_0x4d8e('0x2e')];}_0x8840d[_0x4d8e('0x21')](_0x1e9b85)[_0x4d8e('0x2f')](_0x3605f4);};}exports[_0x4d8e('0x30')]=function(_0x2ef8d6,_0x277547){var _0x505ee4={'raw':![],'where':{'id':_0x2ef8d6[_0x4d8e('0x31')]['id']}},_0x2cf9f9={};_0x2cf9f9[_0x4d8e('0x32')]=_[_0x4d8e('0x33')](db['DashboardItem'][_0x4d8e('0x34')]);_0x2cf9f9[_0x4d8e('0x35')]=_[_0x4d8e('0x33')](_0x2ef8d6[_0x4d8e('0x35')]);_0x2cf9f9[_0x4d8e('0x36')]=_['intersection'](_0x2cf9f9['model'],_0x2cf9f9['query']);_0x505ee4['attributes']=_[_0x4d8e('0x37')](_0x2cf9f9[_0x4d8e('0x32')],qs[_0x4d8e('0x38')](_0x2ef8d6['query'][_0x4d8e('0x38')]));_0x505ee4['attributes']=_0x505ee4[_0x4d8e('0x39')][_0x4d8e('0x3a')]?_0x505ee4[_0x4d8e('0x39')]:_0x2cf9f9['model'];if(_0x2ef8d6[_0x4d8e('0x35')]['includeAll']){_0x505ee4[_0x4d8e('0x3b')]=[{'all':!![]}];}_0x505ee4=_[_0x4d8e('0x3c')]({},_0x505ee4,_0x2ef8d6[_0x4d8e('0x3d')]);return db[_0x4d8e('0x3e')][_0x4d8e('0x3f')](_0x505ee4)[_0x4d8e('0x2a')](handleEntityNotFound(_0x277547,null))[_0x4d8e('0x2a')](respondWithResult(_0x277547,null))[_0x4d8e('0x40')](handleError(_0x277547,null));};exports[_0x4d8e('0x2b')]=function(_0x40f5a1,_0x40427e){return db[_0x4d8e('0x3e')][_0x4d8e('0x3f')]({'where':{'id':_0x40f5a1['params']['id']}})[_0x4d8e('0x2a')](handleEntityNotFound(_0x40427e,null))[_0x4d8e('0x2a')](removeEntity(_0x40427e,null))[_0x4d8e('0x40')](handleError(_0x40427e,null));};function widgetAttributes(_0x1bbc60){try{switch(_0x1bbc60[_0x4d8e('0x41')]){case _0x4d8e('0x42'):return[{'name':'attrUrl','value':_0x1bbc60[_0x4d8e('0x43')]||(_0x1bbc60[_0x4d8e('0x44')]&&_0x1bbc60[_0x4d8e('0x44')][0x0]?_0x1bbc60['attrs'][0x0][_0x4d8e('0x45')]:undefined)||_0x4d8e('0x46')}];case _0x4d8e('0x47'):return[{'name':_0x4d8e('0x48'),'value':_0x1bbc60[_0x4d8e('0x48')]||(_0x1bbc60[_0x4d8e('0x44')]&&_0x1bbc60['attrs'][0x0]?_0x1bbc60[_0x4d8e('0x44')][0x0][_0x4d8e('0x45')]:undefined)||''}];case'clock':return[{'name':_0x4d8e('0x49'),'value':_0x1bbc60[_0x4d8e('0x49')]||(_0x1bbc60['attrs']&&_0x1bbc60[_0x4d8e('0x44')][0x0]?_0x1bbc60['attrs'][0x0]['value']:undefined)||'HH:mm:ss'},{'name':_0x4d8e('0x4a'),'value':_0x1bbc60[_0x4d8e('0x4a')]||(_0x1bbc60[_0x4d8e('0x44')]&&_0x1bbc60['attrs'][0x1]?_0x1bbc60[_0x4d8e('0x44')][0x1][_0x4d8e('0x45')]:undefined)||_0x4d8e('0x4b')},{'name':'attrFontSize','value':_0x1bbc60[_0x4d8e('0x4c')]||(_0x1bbc60[_0x4d8e('0x44')]&&_0x1bbc60[_0x4d8e('0x44')][0x2]?_0x1bbc60['attrs'][0x2]['value']:undefined)||0xc}];case'counter':return[{'name':_0x4d8e('0x4d'),'value':_0x1bbc60[_0x4d8e('0x4d')]||(_0x1bbc60[_0x4d8e('0x44')]&&_0x1bbc60[_0x4d8e('0x44')][0x0]?_0x1bbc60[_0x4d8e('0x44')][0x0]['value']:undefined)||_0x4d8e('0x4e')},{'name':'attrVoiceQueues','value':_0x1bbc60[_0x4d8e('0x4f')]||(_0x1bbc60[_0x4d8e('0x44')]&&_0x1bbc60['attrs'][0x1]?_0x1bbc60[_0x4d8e('0x44')][0x1]['value']:undefined)||[]},{'name':_0x4d8e('0x4c'),'value':_0x1bbc60[_0x4d8e('0x4c')]||(_0x1bbc60[_0x4d8e('0x44')]&&_0x1bbc60[_0x4d8e('0x44')][0x2]?_0x1bbc60['attrs'][0x2][_0x4d8e('0x45')]:undefined)||0x14}];case _0x4d8e('0x50'):case'pie-chart':return[{'name':'attrSerie1','value':_0x1bbc60['attrSerie1']||(_0x1bbc60[_0x4d8e('0x44')]&&_0x1bbc60[_0x4d8e('0x44')][0x0]?_0x1bbc60[_0x4d8e('0x44')][0x0]['value']:undefined)||'total'},{'name':_0x4d8e('0x51'),'value':_0x1bbc60[_0x4d8e('0x51')]||(_0x1bbc60[_0x4d8e('0x44')]&&_0x1bbc60[_0x4d8e('0x44')][0x1]?_0x1bbc60[_0x4d8e('0x44')][0x1][_0x4d8e('0x45')]:undefined)||null},{'name':_0x4d8e('0x52'),'value':_0x1bbc60[_0x4d8e('0x52')]||(_0x1bbc60[_0x4d8e('0x44')]&&_0x1bbc60[_0x4d8e('0x44')][0x2]?_0x1bbc60[_0x4d8e('0x44')][0x2][_0x4d8e('0x45')]:undefined)||null},{'name':_0x4d8e('0x4f'),'value':_0x1bbc60[_0x4d8e('0x4f')]||(_0x1bbc60[_0x4d8e('0x44')]&&_0x1bbc60[_0x4d8e('0x44')][0x3]?_0x1bbc60[_0x4d8e('0x44')][0x3]['value']:undefined)||[]}];case'web-report':return[{'name':_0x4d8e('0x53'),'type':_0x1bbc60['reportType']||(_0x1bbc60[_0x4d8e('0x44')]&&_0x1bbc60[_0x4d8e('0x44')][0x0]?_0x1bbc60[_0x4d8e('0x44')][0x0][_0x4d8e('0x41')]:undefined)||null,'value':_0x1bbc60[_0x4d8e('0x53')]||(_0x1bbc60[_0x4d8e('0x44')]&&_0x1bbc60[_0x4d8e('0x44')][0x0]?_0x1bbc60[_0x4d8e('0x44')][0x0]['value']:undefined)||null},{'name':_0x4d8e('0x54'),'value':_0x1bbc60['attrRefresh']||(_0x1bbc60[_0x4d8e('0x44')]&&_0x1bbc60['attrs'][0x1]?_0x1bbc60[_0x4d8e('0x44')][0x1]['value']:undefined)||0x0}];default:return[];}}catch(_0x718d97){logger[_0x4d8e('0x2c')](_0x4d8e('0x55'),JSON[_0x4d8e('0x56')](_0x718d97));return[];}}exports['create']=function(_0x3e7596,_0x192b62){if(_0x3e7596[_0x4d8e('0x57')]){_0x3e7596['body'][_0x4d8e('0x44')]=widgetAttributes(_0x3e7596[_0x4d8e('0x57')]);}return db[_0x4d8e('0x3e')][_0x4d8e('0x58')](_0x3e7596[_0x4d8e('0x57')],{})['then'](respondWithResult(_0x192b62,0xc9))[_0x4d8e('0x40')](handleError(_0x192b62,null));};exports[_0x4d8e('0x59')]=function(_0x243716,_0x2d0a85){if(_0x243716[_0x4d8e('0x57')]['id']){delete _0x243716[_0x4d8e('0x57')]['id'];}_0x243716[_0x4d8e('0x57')][_0x4d8e('0x44')]=widgetAttributes(_0x243716['body']);return db[_0x4d8e('0x3e')][_0x4d8e('0x3f')]({'where':{'id':_0x243716['params']['id']}})['then'](handleEntityNotFound(_0x2d0a85,null))[_0x4d8e('0x2a')](saveUpdates(_0x243716[_0x4d8e('0x57')],null))['then'](respondWithResult(_0x2d0a85,null))[_0x4d8e('0x40')](handleError(_0x2d0a85,null));}; \ No newline at end of file +var _0x2991=['https://','attrPath','clock','attrHourFormat','attrTimezone','0.00','attrFontSize','attrMetric','attrVoiceQueues','multibar-chart','pie-chart','attrSerie1','total','attrSerie2','attrSerie3','web-report','attrReport','reportType','attrRefresh','stringify','create','body','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','redis','defaults','localhost','socket.io-emitter','./dashboardItem.socket','end','status','json','count','offset','set','apply','reject','save','update','destroy','then','error','stack','name','send','show','params','model','DashboardItem','rawAttributes','query','keys','filters','intersection','attributes','fields','length','includeAll','include','options','find','catch','type','iframe','attrUrl','attrs','value'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x2991,0x186));var _0x1299=function(_0x1e7aaf,_0x119b16){_0x1e7aaf=_0x1e7aaf-0x0;var _0x4f14ed=_0x2991[_0x1e7aaf];return _0x4f14ed;};'use strict';var pdf=require(_0x1299('0x0'));var emlformat=require(_0x1299('0x1'));var rimraf=require(_0x1299('0x2'));var zipdir=require(_0x1299('0x3'));var jsonpatch=require(_0x1299('0x4'));var rp=require(_0x1299('0x5'));var moment=require(_0x1299('0x6'));var BPromise=require(_0x1299('0x7'));var Mustache=require(_0x1299('0x8'));var util=require(_0x1299('0x9'));var path=require(_0x1299('0xa'));var sox=require(_0x1299('0xb'));var csv=require(_0x1299('0xc'));var ejs=require(_0x1299('0xd'));var fs=require('fs');var _=require(_0x1299('0xe'));var squel=require(_0x1299('0xf'));var crypto=require(_0x1299('0x10'));var jsforce=require(_0x1299('0x11'));var deskjs=require(_0x1299('0x12'));var toCsv=require(_0x1299('0xc'));var querystring=require('querystring');var Papa=require(_0x1299('0x13'));var Redis=require('ioredis');var authService=require(_0x1299('0x14'));var qs=require(_0x1299('0x15'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x1299('0x16'));var logger=require(_0x1299('0x17'))(_0x1299('0x18'));var utils=require(_0x1299('0x19'));var config=require(_0x1299('0x1a'));var db=require('../../mysqldb')['db'];config[_0x1299('0x1b')]=_[_0x1299('0x1c')](config[_0x1299('0x1b')],{'host':_0x1299('0x1d'),'port':0x18eb});var socket=require(_0x1299('0x1e'))(new Redis(config[_0x1299('0x1b')]));require(_0x1299('0x1f'))['register'](socket);function respondWithStatusCode(_0x5bbfbc,_0x4af732){_0x4af732=_0x4af732||0xcc;return function(_0x34514c){if(_0x34514c){return _0x5bbfbc['sendStatus'](_0x4af732);}return _0x5bbfbc['status'](_0x4af732)[_0x1299('0x20')]();};}function respondWithResult(_0x2af28d,_0x40b6ee){_0x40b6ee=_0x40b6ee||0xc8;return function(_0x474fec){if(_0x474fec){return _0x2af28d[_0x1299('0x21')](_0x40b6ee)[_0x1299('0x22')](_0x474fec);}};}function respondWithFilteredResult(_0x1abc02,_0x5df4a6){return function(_0x3f67e1){if(_0x3f67e1){var _0x291d68=_0x3f67e1[_0x1299('0x23')],_0x5d88e6=_0x5df4a6[_0x1299('0x24')],_0x2dbbab=_0x5df4a6[_0x1299('0x24')]+_0x5df4a6['limit'],_0x1e9bdd;if(_0x2dbbab>=_0x291d68){_0x2dbbab=_0x291d68;_0x1e9bdd=0xc8;}else{_0x1e9bdd=0xce;}_0x1abc02[_0x1299('0x21')](_0x1e9bdd);return _0x1abc02[_0x1299('0x25')]('Content-Range',_0x5d88e6+'-'+_0x2dbbab+'/'+_0x291d68)[_0x1299('0x22')](_0x3f67e1);}return null;};}function patchUpdates(_0x1d683a){return function(_0x4e50e1){try{jsonpatch[_0x1299('0x26')](_0x4e50e1,_0x1d683a,!![]);}catch(_0x43ed8a){return BPromise[_0x1299('0x27')](_0x43ed8a);}return _0x4e50e1[_0x1299('0x28')]();};}function saveUpdates(_0xdb86e,_0x267d12){return function(_0xf17549){if(_0xf17549){return _0xf17549[_0x1299('0x29')](_0xdb86e)['then'](function(_0x2aa976){return _0x2aa976;});}return null;};}function removeEntity(_0x17c85f,_0x3c99a4){return function(_0x761275){if(_0x761275){return _0x761275[_0x1299('0x2a')]()[_0x1299('0x2b')](function(){_0x17c85f[_0x1299('0x21')](0xcc)[_0x1299('0x20')]();});}};}function handleEntityNotFound(_0x35f6e7,_0x1d3785){return function(_0x19a55e){if(!_0x19a55e){_0x35f6e7['sendStatus'](0x194);}return _0x19a55e;};}function handleError(_0x132bad,_0x8dfccb){_0x8dfccb=_0x8dfccb||0x1f4;return function(_0x2c32e6){logger[_0x1299('0x2c')](_0x2c32e6[_0x1299('0x2d')]);if(_0x2c32e6[_0x1299('0x2e')]){delete _0x2c32e6[_0x1299('0x2e')];}_0x132bad[_0x1299('0x21')](_0x8dfccb)[_0x1299('0x2f')](_0x2c32e6);};}exports[_0x1299('0x30')]=function(_0x4713ce,_0x4c40eb){var _0x48ac68={'raw':![],'where':{'id':_0x4713ce[_0x1299('0x31')]['id']}},_0x2ea7af={};_0x2ea7af[_0x1299('0x32')]=_['keys'](db[_0x1299('0x33')][_0x1299('0x34')]);_0x2ea7af[_0x1299('0x35')]=_[_0x1299('0x36')](_0x4713ce[_0x1299('0x35')]);_0x2ea7af[_0x1299('0x37')]=_[_0x1299('0x38')](_0x2ea7af['model'],_0x2ea7af['query']);_0x48ac68[_0x1299('0x39')]=_[_0x1299('0x38')](_0x2ea7af['model'],qs[_0x1299('0x3a')](_0x4713ce[_0x1299('0x35')]['fields']));_0x48ac68[_0x1299('0x39')]=_0x48ac68['attributes'][_0x1299('0x3b')]?_0x48ac68[_0x1299('0x39')]:_0x2ea7af[_0x1299('0x32')];if(_0x4713ce[_0x1299('0x35')][_0x1299('0x3c')]){_0x48ac68[_0x1299('0x3d')]=[{'all':!![]}];}_0x48ac68=_['merge']({},_0x48ac68,_0x4713ce[_0x1299('0x3e')]);return db[_0x1299('0x33')][_0x1299('0x3f')](_0x48ac68)[_0x1299('0x2b')](handleEntityNotFound(_0x4c40eb,null))[_0x1299('0x2b')](respondWithResult(_0x4c40eb,null))[_0x1299('0x40')](handleError(_0x4c40eb,null));};exports[_0x1299('0x2a')]=function(_0x2f49ed,_0xf17884){return db[_0x1299('0x33')]['find']({'where':{'id':_0x2f49ed['params']['id']}})[_0x1299('0x2b')](handleEntityNotFound(_0xf17884,null))[_0x1299('0x2b')](removeEntity(_0xf17884,null))[_0x1299('0x40')](handleError(_0xf17884,null));};function widgetAttributes(_0x5eb18c){try{switch(_0x5eb18c[_0x1299('0x41')]){case _0x1299('0x42'):return[{'name':_0x1299('0x43'),'value':_0x5eb18c[_0x1299('0x43')]||(_0x5eb18c[_0x1299('0x44')]&&_0x5eb18c[_0x1299('0x44')][0x0]?_0x5eb18c[_0x1299('0x44')][0x0][_0x1299('0x45')]:undefined)||_0x1299('0x46')}];case'custom':return[{'name':_0x1299('0x47'),'value':_0x5eb18c[_0x1299('0x47')]||(_0x5eb18c[_0x1299('0x44')]&&_0x5eb18c[_0x1299('0x44')][0x0]?_0x5eb18c[_0x1299('0x44')][0x0][_0x1299('0x45')]:undefined)||''}];case _0x1299('0x48'):return[{'name':_0x1299('0x49'),'value':_0x5eb18c['attrHourFormat']||(_0x5eb18c[_0x1299('0x44')]&&_0x5eb18c[_0x1299('0x44')][0x0]?_0x5eb18c[_0x1299('0x44')][0x0][_0x1299('0x45')]:undefined)||'HH:mm:ss'},{'name':_0x1299('0x4a'),'value':_0x5eb18c[_0x1299('0x4a')]||(_0x5eb18c[_0x1299('0x44')]&&_0x5eb18c[_0x1299('0x44')][0x1]?_0x5eb18c['attrs'][0x1][_0x1299('0x45')]:undefined)||_0x1299('0x4b')},{'name':_0x1299('0x4c'),'value':_0x5eb18c[_0x1299('0x4c')]||(_0x5eb18c[_0x1299('0x44')]&&_0x5eb18c['attrs'][0x2]?_0x5eb18c[_0x1299('0x44')][0x2][_0x1299('0x45')]:undefined)||0xc}];case'counter':return[{'name':_0x1299('0x4d'),'value':_0x5eb18c[_0x1299('0x4d')]||(_0x5eb18c[_0x1299('0x44')]&&_0x5eb18c['attrs'][0x0]?_0x5eb18c[_0x1299('0x44')][0x0][_0x1299('0x45')]:undefined)||'total'},{'name':_0x1299('0x4e'),'value':_0x5eb18c[_0x1299('0x4e')]||(_0x5eb18c[_0x1299('0x44')]&&_0x5eb18c[_0x1299('0x44')][0x1]?_0x5eb18c['attrs'][0x1]['value']:undefined)||[]},{'name':_0x1299('0x4c'),'value':_0x5eb18c[_0x1299('0x4c')]||(_0x5eb18c[_0x1299('0x44')]&&_0x5eb18c[_0x1299('0x44')][0x2]?_0x5eb18c[_0x1299('0x44')][0x2][_0x1299('0x45')]:undefined)||0x14}];case _0x1299('0x4f'):case _0x1299('0x50'):return[{'name':_0x1299('0x51'),'value':_0x5eb18c[_0x1299('0x51')]||(_0x5eb18c[_0x1299('0x44')]&&_0x5eb18c[_0x1299('0x44')][0x0]?_0x5eb18c[_0x1299('0x44')][0x0]['value']:undefined)||_0x1299('0x52')},{'name':_0x1299('0x53'),'value':_0x5eb18c[_0x1299('0x53')]||(_0x5eb18c[_0x1299('0x44')]&&_0x5eb18c[_0x1299('0x44')][0x1]?_0x5eb18c[_0x1299('0x44')][0x1][_0x1299('0x45')]:undefined)||null},{'name':_0x1299('0x54'),'value':_0x5eb18c[_0x1299('0x54')]||(_0x5eb18c[_0x1299('0x44')]&&_0x5eb18c['attrs'][0x2]?_0x5eb18c[_0x1299('0x44')][0x2][_0x1299('0x45')]:undefined)||null},{'name':_0x1299('0x4e'),'value':_0x5eb18c['attrVoiceQueues']||(_0x5eb18c['attrs']&&_0x5eb18c[_0x1299('0x44')][0x3]?_0x5eb18c['attrs'][0x3][_0x1299('0x45')]:undefined)||[]}];case _0x1299('0x55'):return[{'name':_0x1299('0x56'),'type':_0x5eb18c[_0x1299('0x57')]||(_0x5eb18c[_0x1299('0x44')]&&_0x5eb18c['attrs'][0x0]?_0x5eb18c['attrs'][0x0][_0x1299('0x41')]:undefined)||null,'value':_0x5eb18c['attrReport']||(_0x5eb18c[_0x1299('0x44')]&&_0x5eb18c[_0x1299('0x44')][0x0]?_0x5eb18c[_0x1299('0x44')][0x0][_0x1299('0x45')]:undefined)||null},{'name':_0x1299('0x58'),'value':_0x5eb18c[_0x1299('0x58')]||(_0x5eb18c[_0x1299('0x44')]&&_0x5eb18c[_0x1299('0x44')][0x1]?_0x5eb18c[_0x1299('0x44')][0x1][_0x1299('0x45')]:undefined)||0x0}];default:return[];}}catch(_0x46aa8e){logger[_0x1299('0x2c')]('widgetAttributes:\x20%s',JSON[_0x1299('0x59')](_0x46aa8e));return[];}}exports[_0x1299('0x5a')]=function(_0x527d63,_0x44112b){if(_0x527d63[_0x1299('0x5b')]){_0x527d63[_0x1299('0x5b')]['attrs']=widgetAttributes(_0x527d63[_0x1299('0x5b')]);}return db[_0x1299('0x33')]['create'](_0x527d63[_0x1299('0x5b')],{})[_0x1299('0x2b')](respondWithResult(_0x44112b,0xc9))['catch'](handleError(_0x44112b,null));};exports[_0x1299('0x29')]=function(_0x5b5411,_0xdb2be9){if(_0x5b5411[_0x1299('0x5b')]['id']){delete _0x5b5411['body']['id'];}_0x5b5411[_0x1299('0x5b')][_0x1299('0x44')]=widgetAttributes(_0x5b5411[_0x1299('0x5b')]);return db[_0x1299('0x33')][_0x1299('0x3f')]({'where':{'id':_0x5b5411['params']['id']}})[_0x1299('0x2b')](handleEntityNotFound(_0xdb2be9,null))[_0x1299('0x2b')](saveUpdates(_0x5b5411[_0x1299('0x5b')],null))['then'](respondWithResult(_0xdb2be9,null))[_0x1299('0x40')](handleError(_0xdb2be9,null));}; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.events.js b/server/api/dashboardItem/dashboardItem.events.js index 2b68eb5..17baf77 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 _0x25f6=['../../mysqldb','DashboardItem','setMaxListeners','remove','hasOwnProperty','hook','exports','events'];(function(_0x19c59d,_0x53c490){var _0x26374a=function(_0x47d5eb){while(--_0x47d5eb){_0x19c59d['push'](_0x19c59d['shift']());}};_0x26374a(++_0x53c490);}(_0x25f6,0x197));var _0x625f=function(_0x28b3d7,_0x17b41d){_0x28b3d7=_0x28b3d7-0x0;var _0x49619d=_0x25f6[_0x28b3d7];return _0x49619d;};'use strict';var EventEmitter=require(_0x625f('0x0'));var DashboardItem=require(_0x625f('0x1'))['db'][_0x625f('0x2')];var DashboardItemEvents=new EventEmitter();DashboardItemEvents[_0x625f('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0x625f('0x4')};function emitEvent(_0x2e8d99){return function(_0x4b8d99,_0x442e7b,_0x148e21){DashboardItemEvents['emit'](_0x2e8d99+':'+_0x4b8d99['id'],_0x4b8d99);DashboardItemEvents['emit'](_0x2e8d99,_0x4b8d99);_0x148e21(null);};}for(var e in events){if(events[_0x625f('0x5')](e)){var event=events[e];DashboardItem[_0x625f('0x6')](e,emitEvent(event));}}module[_0x625f('0x7')]=DashboardItemEvents; \ No newline at end of file +var _0xe606=['remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','save','update'];(function(_0x4c7fb5,_0x2548ef){var _0x2e10ac=function(_0xf7e27c){while(--_0xf7e27c){_0x4c7fb5['push'](_0x4c7fb5['shift']());}};_0x2e10ac(++_0x2548ef);}(_0xe606,0x11c));var _0x6e60=function(_0x5321ab,_0x3efaca){_0x5321ab=_0x5321ab-0x0;var _0x3991ad=_0xe606[_0x5321ab];return _0x3991ad;};'use strict';var EventEmitter=require(_0x6e60('0x0'));var DashboardItem=require(_0x6e60('0x1'))['db']['DashboardItem'];var DashboardItemEvents=new EventEmitter();DashboardItemEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x6e60('0x2'),'afterUpdate':_0x6e60('0x3'),'afterDestroy':_0x6e60('0x4')};function emitEvent(_0x21c43c){return function(_0x1f6b93,_0x576367,_0x520516){DashboardItemEvents['emit'](_0x21c43c+':'+_0x1f6b93['id'],_0x1f6b93);DashboardItemEvents[_0x6e60('0x5')](_0x21c43c,_0x1f6b93);_0x520516(null);};}for(var e in events){if(events[_0x6e60('0x6')](e)){var event=events[e];DashboardItem[_0x6e60('0x7')](e,emitEvent(event));}}module[_0x6e60('0x8')]=DashboardItemEvents; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.model.js b/server/api/dashboardItem/dashboardItem.model.js index 55366bb..11e8a13 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 _0x1c44=['path','../../config/environment','./dashboardItem.attributes','exports','define','dashboard_items','lodash','util','api','bluebird'];(function(_0x47aa64,_0xfb8a07){var _0x549c7a=function(_0x266165){while(--_0x266165){_0x47aa64['push'](_0x47aa64['shift']());}};_0x549c7a(++_0xfb8a07);}(_0x1c44,0x1b4));var _0x41c4=function(_0x42d744,_0x411795){_0x42d744=_0x42d744-0x0;var _0xa28b89=_0x1c44[_0x42d744];return _0xa28b89;};'use strict';var _=require(_0x41c4('0x0'));var util=require(_0x41c4('0x1'));var logger=require('../../config/logger')(_0x41c4('0x2'));var moment=require('moment');var BPromise=require(_0x41c4('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x41c4('0x4'));var rimraf=require('rimraf');var config=require(_0x41c4('0x5'));var attributes=require(_0x41c4('0x6'));module[_0x41c4('0x7')]=function(_0x5a4681,_0x161a0c){return _0x5a4681[_0x41c4('0x8')]('DashboardItem',attributes,{'tableName':_0x41c4('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9648=['dashboard_items','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./dashboardItem.attributes','exports','define','DashboardItem'];(function(_0x356085,_0x5ed3ae){var _0x5acb73=function(_0x35b6bc){while(--_0x35b6bc){_0x356085['push'](_0x356085['shift']());}};_0x5acb73(++_0x5ed3ae);}(_0x9648,0x1eb));var _0x8964=function(_0x15378c,_0x183c5a){_0x15378c=_0x15378c-0x0;var _0x58d36c=_0x9648[_0x15378c];return _0x58d36c;};'use strict';var _=require(_0x8964('0x0'));var util=require(_0x8964('0x1'));var logger=require(_0x8964('0x2'))(_0x8964('0x3'));var moment=require('moment');var BPromise=require(_0x8964('0x4'));var rp=require(_0x8964('0x5'));var fs=require('fs');var path=require(_0x8964('0x6'));var rimraf=require(_0x8964('0x7'));var config=require(_0x8964('0x8'));var attributes=require(_0x8964('0x9'));module[_0x8964('0xa')]=function(_0x48576d,_0x3c2fb3){return _0x48576d[_0x8964('0xb')](_0x8964('0xc'),attributes,{'tableName':_0x8964('0xd'),'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 a4ea356..83d74c7 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 _0x55cb=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','defaults','socket.io-emitter','register','request','then','info','request\x20sent','debug','DashboardItem,\x20%s,\x20%s,\x20%s','error','code','DashboardItem,\x20%s,\x20%s','message','result','catch','lodash','util','moment'];(function(_0x3fc2df,_0x276585){var _0x55427d=function(_0xf617dd){while(--_0xf617dd){_0x3fc2df['push'](_0x3fc2df['shift']());}};_0x55427d(++_0x276585);}(_0x55cb,0x13c));var _0xb55c=function(_0x45f6cb,_0x531af6){_0x45f6cb=_0x45f6cb-0x0;var _0x5b7f93=_0x55cb[_0x45f6cb];return _0x5b7f93;};'use strict';var _=require(_0xb55c('0x0'));var util=require(_0xb55c('0x1'));var moment=require(_0xb55c('0x2'));var BPromise=require(_0xb55c('0x3'));var rs=require(_0xb55c('0x4'));var fs=require('fs');var Redis=require(_0xb55c('0x5'));var db=require(_0xb55c('0x6'))['db'];var utils=require(_0xb55c('0x7'));var logger=require(_0xb55c('0x8'))(_0xb55c('0x9'));var config=require(_0xb55c('0xa'));var jayson=require(_0xb55c('0xb'));var client=jayson['client'][_0xb55c('0xc')]({'port':0x232a});config[_0xb55c('0xd')]=_[_0xb55c('0xe')](config[_0xb55c('0xd')],{'host':'localhost','port':0x18eb});var socket=require(_0xb55c('0xf'))(new Redis(config[_0xb55c('0xd')]));require('./dashboardItem.socket')[_0xb55c('0x10')](socket);function respondWithRpcPromise(_0x34931b,_0x3c4831,_0x505c94){return new BPromise(function(_0x547d6f,_0xe33c01){return client[_0xb55c('0x11')](_0x34931b,_0x505c94)[_0xb55c('0x12')](function(_0x2b9f5f){logger[_0xb55c('0x13')]('DashboardItem,\x20%s,\x20%s',_0x3c4831,_0xb55c('0x14'));logger[_0xb55c('0x15')](_0xb55c('0x16'),_0x3c4831,'request\x20sent',JSON['stringify'](_0x2b9f5f));if(_0x2b9f5f[_0xb55c('0x17')]){if(_0x2b9f5f[_0xb55c('0x17')][_0xb55c('0x18')]===0x1f4){logger[_0xb55c('0x17')](_0xb55c('0x19'),_0x3c4831,_0x2b9f5f[_0xb55c('0x17')][_0xb55c('0x1a')]);return _0xe33c01(_0x2b9f5f[_0xb55c('0x17')][_0xb55c('0x1a')]);}logger[_0xb55c('0x17')](_0xb55c('0x19'),_0x3c4831,_0x2b9f5f[_0xb55c('0x17')][_0xb55c('0x1a')]);return _0x547d6f(_0x2b9f5f[_0xb55c('0x17')][_0xb55c('0x1a')]);}else{logger[_0xb55c('0x13')](_0xb55c('0x19'),_0x3c4831,'request\x20sent');_0x547d6f(_0x2b9f5f[_0xb55c('0x1b')]['message']);}})[_0xb55c('0x1c')](function(_0x3bfca0){logger[_0xb55c('0x17')]('DashboardItem,\x20%s,\x20%s',_0x3c4831,_0x3bfca0);_0xe33c01(_0x3bfca0);});});} \ No newline at end of file +var _0xad52=['socket.io-emitter','redis','./dashboardItem.socket','register','request','then','info','DashboardItem,\x20%s,\x20%s','debug','DashboardItem,\x20%s,\x20%s,\x20%s','error','code','message','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http'];(function(_0x3cc693,_0x45ca5b){var _0x309578=function(_0x48980e){while(--_0x48980e){_0x3cc693['push'](_0x3cc693['shift']());}};_0x309578(++_0x45ca5b);}(_0xad52,0x13a));var _0x2ad5=function(_0x5cdf4b,_0x1122f7){_0x5cdf4b=_0x5cdf4b-0x0;var _0x3a1171=_0xad52[_0x5cdf4b];return _0x3a1171;};'use strict';var _=require(_0x2ad5('0x0'));var util=require(_0x2ad5('0x1'));var moment=require(_0x2ad5('0x2'));var BPromise=require('bluebird');var rs=require(_0x2ad5('0x3'));var fs=require('fs');var Redis=require(_0x2ad5('0x4'));var db=require(_0x2ad5('0x5'))['db'];var utils=require(_0x2ad5('0x6'));var logger=require(_0x2ad5('0x7'))(_0x2ad5('0x8'));var config=require('../../config/environment');var jayson=require(_0x2ad5('0x9'));var client=jayson['client'][_0x2ad5('0xa')]({'port':0x232a});config['redis']=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x2ad5('0xb'))(new Redis(config[_0x2ad5('0xc')]));require(_0x2ad5('0xd'))[_0x2ad5('0xe')](socket);function respondWithRpcPromise(_0x3f8283,_0x163823,_0x3a7395){return new BPromise(function(_0x1ccf35,_0x4e9e42){return client[_0x2ad5('0xf')](_0x3f8283,_0x3a7395)[_0x2ad5('0x10')](function(_0x2049b0){logger[_0x2ad5('0x11')](_0x2ad5('0x12'),_0x163823,'request\x20sent');logger[_0x2ad5('0x13')](_0x2ad5('0x14'),_0x163823,'request\x20sent',JSON['stringify'](_0x2049b0));if(_0x2049b0['error']){if(_0x2049b0[_0x2ad5('0x15')][_0x2ad5('0x16')]===0x1f4){logger['error'](_0x2ad5('0x12'),_0x163823,_0x2049b0[_0x2ad5('0x15')][_0x2ad5('0x17')]);return _0x4e9e42(_0x2049b0[_0x2ad5('0x15')][_0x2ad5('0x17')]);}logger[_0x2ad5('0x15')](_0x2ad5('0x12'),_0x163823,_0x2049b0[_0x2ad5('0x15')][_0x2ad5('0x17')]);return _0x1ccf35(_0x2049b0['error'][_0x2ad5('0x17')]);}else{logger['info'](_0x2ad5('0x12'),_0x163823,'request\x20sent');_0x1ccf35(_0x2049b0['result'][_0x2ad5('0x17')]);}})[_0x2ad5('0x18')](function(_0x4321a7){logger[_0x2ad5('0x15')](_0x2ad5('0x12'),_0x163823,_0x4321a7);_0x4e9e42(_0x4321a7);});});} \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.socket.js b/server/api/dashboardItem/dashboardItem.socket.js index 378fa16..1dedb00 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 _0xf9a2=['length','dashboardItem:','./dashboardItem.events','save','emit','removeListener','register'];(function(_0x1d24eb,_0x12295b){var _0x1dc576=function(_0x4d5770){while(--_0x4d5770){_0x1d24eb['push'](_0x1d24eb['shift']());}};_0x1dc576(++_0x12295b);}(_0xf9a2,0x72));var _0x2f9a=function(_0x4f7a5a,_0x2b8b5b){_0x4f7a5a=_0x4f7a5a-0x0;var _0x101223=_0xf9a2[_0x4f7a5a];return _0x101223;};'use strict';var DashboardItemEvents=require(_0x2f9a('0x0'));var events=[_0x2f9a('0x1'),'remove','update'];function createListener(_0x144d67,_0x439d25){return function(_0x3b7c31){_0x439d25[_0x2f9a('0x2')](_0x144d67,_0x3b7c31);};}function removeListener(_0x393083,_0x155d0a){return function(){DashboardItemEvents[_0x2f9a('0x3')](_0x393083,_0x155d0a);};}exports[_0x2f9a('0x4')]=function(_0x52d045){for(var _0x5d0e2a=0x0,_0x21c277=events[_0x2f9a('0x5')];_0x5d0e2a<_0x21c277;_0x5d0e2a++){var _0xcbef73=events[_0x5d0e2a];var _0x44f73d=createListener(_0x2f9a('0x6')+_0xcbef73,_0x52d045);DashboardItemEvents['on'](_0xcbef73,_0x44f73d);}}; \ No newline at end of file +var _0x7163=['remove','update','removeListener','register','length','dashboardItem:','save'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x7163,0x187));var _0x3716=function(_0x2283dc,_0x2fcfc5){_0x2283dc=_0x2283dc-0x0;var _0x16db90=_0x7163[_0x2283dc];return _0x16db90;};'use strict';var DashboardItemEvents=require('./dashboardItem.events');var events=[_0x3716('0x0'),_0x3716('0x1'),_0x3716('0x2')];function createListener(_0x3fcb65,_0x139331){return function(_0xac73c5){_0x139331['emit'](_0x3fcb65,_0xac73c5);};}function removeListener(_0x30b045,_0x413e94){return function(){DashboardItemEvents[_0x3716('0x3')](_0x30b045,_0x413e94);};}exports[_0x3716('0x4')]=function(_0x4e6693){for(var _0x4af449=0x0,_0x516a6d=events[_0x3716('0x5')];_0x4af449<_0x516a6d;_0x4af449++){var _0x1f2212=events[_0x4af449];var _0x6a60e2=createListener(_0x3716('0x6')+_0x1f2212,_0x4e6693);DashboardItemEvents['on'](_0x1f2212,_0x6a60e2);}}; \ No newline at end of file diff --git a/server/api/dashboardItem/index.js b/server/api/dashboardItem/index.js index aa2ef85..006a307 100644 --- a/server/api/dashboardItem/index.js +++ b/server/api/dashboardItem/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7fbe=['connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./dashboardItem.controller','get','/:id','isAuthenticated','show','post','put','update','destroy','exports','path'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0x7fbe,0x1ec));var _0xe7fb=function(_0x3de01a,_0xcc1fd4){_0x3de01a=_0x3de01a-0x0;var _0x43f31e=_0x7fbe[_0x3de01a];return _0x43f31e;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xe7fb('0x0'));var timeout=require(_0xe7fb('0x1'));var express=require(_0xe7fb('0x2'));var router=express[_0xe7fb('0x3')]();var auth=require(_0xe7fb('0x4'));var interaction=require(_0xe7fb('0x5'));var config=require(_0xe7fb('0x6'));var controller=require(_0xe7fb('0x7'));router[_0xe7fb('0x8')](_0xe7fb('0x9'),auth[_0xe7fb('0xa')](),controller[_0xe7fb('0xb')]);router[_0xe7fb('0xc')]('/',auth[_0xe7fb('0xa')](),controller['create']);router[_0xe7fb('0xd')](_0xe7fb('0x9'),auth[_0xe7fb('0xa')](),controller[_0xe7fb('0xe')]);router['delete']('/:id',auth[_0xe7fb('0xa')](),controller[_0xe7fb('0xf')]);module[_0xe7fb('0x10')]=router; \ No newline at end of file +var _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(_0xa8883,_0x1f107f){var _0x479426=function(_0x4e56b9){while(--_0x4e56b9){_0xa8883['push'](_0xa8883['shift']());}};_0x479426(++_0x1f107f);}(_0xf2ca,0x16a));var _0xaf2c=function(_0x54e333,_0x4ba478){_0x54e333=_0x54e333-0x0;var _0x47279e=_0xf2ca[_0x54e333];return _0x47279e;};'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 c2cc1eb..f5c2ca0 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 _0x63a9=['sequelize','STRING'];(function(_0x281353,_0x5d53a9){var _0x4f4e7b=function(_0x43ade6){while(--_0x43ade6){_0x281353['push'](_0x281353['shift']());}};_0x4f4e7b(++_0x5d53a9);}(_0x63a9,0x192));var _0x963a=function(_0x1c3701,_0x57a048){_0x1c3701=_0x1c3701-0x0;var _0x489349=_0x63a9[_0x1c3701];return _0x489349;};'use strict';var Sequelize=require(_0x963a('0x0'));module['exports']={'name':{'type':Sequelize[_0x963a('0x1')],'allowNull':![]}}; \ No newline at end of file +var _0xb2c5=['exports','STRING','sequelize'];(function(_0x5c2e3e,_0x26ecd3){var _0x53f64a=function(_0x2b5df8){while(--_0x2b5df8){_0x5c2e3e['push'](_0x5c2e3e['shift']());}};_0x53f64a(++_0x26ecd3);}(_0xb2c5,0x9b));var _0x5b2c=function(_0x38c6ff,_0x442ac9){_0x38c6ff=_0x38c6ff-0x0;var _0xfbea01=_0xb2c5[_0x38c6ff];return _0xfbea01;};'use strict';var Sequelize=require(_0x5b2c('0x0'));module[_0x5b2c('0x1')]={'name':{'type':Sequelize[_0x5b2c('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 4b66d5d..c6c800f 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 _0x7065=['querystring','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','end','json','count','offset','set','Content-Range','save','then','destroy','get','Dispositions','error','stack','name','send','index','Disposition','rawAttributes','fieldName','type','map','query','keys','intersection','attributes','fields','length','model','limit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','include','rows','catch','show','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','params','html-pdf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','ejs','squel','crypto','jsforce','to-csv'];(function(_0x25707b,_0x125df2){var _0xa18ef6=function(_0x1cd94f){while(--_0x1cd94f){_0x25707b['push'](_0x25707b['shift']());}};_0xa18ef6(++_0x125df2);}(_0x7065,0x8e));var _0x5706=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x7065[_0x3dd15e];return _0x231fd0;};'use strict';var pdf=require(_0x5706('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x5706('0x1'));var jsonpatch=require(_0x5706('0x2'));var rp=require(_0x5706('0x3'));var moment=require(_0x5706('0x4'));var BPromise=require(_0x5706('0x5'));var Mustache=require(_0x5706('0x6'));var util=require('util');var path=require(_0x5706('0x7'));var sox=require(_0x5706('0x8'));var csv=require('to-csv');var ejs=require(_0x5706('0x9'));var fs=require('fs');var _=require('lodash');var squel=require(_0x5706('0xa'));var crypto=require(_0x5706('0xb'));var jsforce=require(_0x5706('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x5706('0xd'));var querystring=require(_0x5706('0xe'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x5706('0xf'));var as=require(_0x5706('0x10'));var hardwareService=require(_0x5706('0x11'));var logger=require(_0x5706('0x12'))(_0x5706('0x13'));var utils=require(_0x5706('0x14'));var config=require(_0x5706('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x354951,_0x1c3a1b){_0x1c3a1b=_0x1c3a1b||0xcc;return function(_0x278cee){if(_0x278cee){return _0x354951[_0x5706('0x16')](_0x1c3a1b);}return _0x354951[_0x5706('0x17')](_0x1c3a1b)[_0x5706('0x18')]();};}function respondWithResult(_0x5a4af1,_0x3a14f3){_0x3a14f3=_0x3a14f3||0xc8;return function(_0x28767b){if(_0x28767b){return _0x5a4af1['status'](_0x3a14f3)[_0x5706('0x19')](_0x28767b);}};}function respondWithFilteredResult(_0x1df967,_0x371224){return function(_0x82d366){if(_0x82d366){var _0x14de9d=_0x82d366[_0x5706('0x1a')],_0x53793d=_0x371224[_0x5706('0x1b')],_0x14a77f=_0x371224[_0x5706('0x1b')]+_0x371224['limit'],_0x5aa784;if(_0x14a77f>=_0x14de9d){_0x14a77f=_0x14de9d;_0x5aa784=0xc8;}else{_0x5aa784=0xce;}_0x1df967[_0x5706('0x17')](_0x5aa784);return _0x1df967[_0x5706('0x1c')](_0x5706('0x1d'),_0x53793d+'-'+_0x14a77f+'/'+_0x14de9d)['json'](_0x82d366);}return null;};}function patchUpdates(_0x5ca198){return function(_0x5c3067){try{jsonpatch['apply'](_0x5c3067,_0x5ca198,!![]);}catch(_0x34c075){return BPromise['reject'](_0x34c075);}return _0x5c3067[_0x5706('0x1e')]();};}function saveUpdates(_0x292973,_0x1faf59){return function(_0x44235c){if(_0x44235c){return _0x44235c['update'](_0x292973)[_0x5706('0x1f')](function(_0x576971){return _0x576971;});}return null;};}function removeEntity(_0x34c016,_0x1aebf5){return function(_0x20723){if(_0x20723){return _0x20723[_0x5706('0x20')]()[_0x5706('0x1f')](function(){var _0x3ffec6=_0x20723[_0x5706('0x21')]({'plain':!![]});var _0x59e448=_0x5706('0x22');return db['UserProfileResource'][_0x5706('0x20')]({'where':{'type':_0x59e448,'resourceId':_0x3ffec6['id']}})[_0x5706('0x1f')](function(){return _0x20723;});})[_0x5706('0x1f')](function(){_0x34c016['status'](0xcc)[_0x5706('0x18')]();});}};}function handleEntityNotFound(_0x4531bd,_0x21a4f6){return function(_0x303e90){if(!_0x303e90){_0x4531bd[_0x5706('0x16')](0x194);}return _0x303e90;};}function handleError(_0x563832,_0xe397bc){_0xe397bc=_0xe397bc||0x1f4;return function(_0x492b51){logger[_0x5706('0x23')](_0x492b51[_0x5706('0x24')]);if(_0x492b51[_0x5706('0x25')]){delete _0x492b51[_0x5706('0x25')];}_0x563832[_0x5706('0x17')](_0xe397bc)[_0x5706('0x26')](_0x492b51);};}exports[_0x5706('0x27')]=function(_0x2a0567,_0xe0590a){var _0x594d64={},_0x5238e7={},_0xe5b8ef={'count':0x0,'rows':[]};var _0x5904ce=_['map'](db[_0x5706('0x28')][_0x5706('0x29')],function(_0x2ada32){return{'name':_0x2ada32[_0x5706('0x2a')],'type':_0x2ada32[_0x5706('0x2b')]['key']};});_0x5238e7['model']=_[_0x5706('0x2c')](_0x5904ce,_0x5706('0x25'));_0x5238e7[_0x5706('0x2d')]=_[_0x5706('0x2e')](_0x2a0567[_0x5706('0x2d')]);_0x5238e7['filters']=_[_0x5706('0x2f')](_0x5238e7['model'],_0x5238e7[_0x5706('0x2d')]);_0x594d64[_0x5706('0x30')]=_['intersection'](_0x5238e7['model'],qs['fields'](_0x2a0567[_0x5706('0x2d')][_0x5706('0x31')]));_0x594d64[_0x5706('0x30')]=_0x594d64['attributes'][_0x5706('0x32')]?_0x594d64[_0x5706('0x30')]:_0x5238e7[_0x5706('0x33')];if(!_0x2a0567[_0x5706('0x2d')]['hasOwnProperty']('nolimit')){_0x594d64[_0x5706('0x34')]=qs[_0x5706('0x34')](_0x2a0567[_0x5706('0x2d')][_0x5706('0x34')]);_0x594d64[_0x5706('0x1b')]=qs['offset'](_0x2a0567['query'][_0x5706('0x1b')]);}_0x594d64[_0x5706('0x35')]=qs[_0x5706('0x36')](_0x2a0567['query'][_0x5706('0x36')]);_0x594d64[_0x5706('0x37')]=qs[_0x5706('0x38')](_[_0x5706('0x39')](_0x2a0567[_0x5706('0x2d')],_0x5238e7[_0x5706('0x38')]),_0x5904ce);if(_0x2a0567['query'][_0x5706('0x3a')]){_0x594d64['where']=_[_0x5706('0x3b')](_0x594d64[_0x5706('0x37')],{'$or':_[_0x5706('0x2c')](_0x5904ce,function(_0x108015){if(_0x108015[_0x5706('0x2b')]!==_0x5706('0x3c')){var _0x37e061={};_0x37e061[_0x108015['name']]={'$like':'%'+_0x2a0567[_0x5706('0x2d')][_0x5706('0x3a')]+'%'};return _0x37e061;}})});}_0x594d64=_[_0x5706('0x3b')]({},_0x594d64,_0x2a0567[_0x5706('0x3d')]);var _0x47573a={'where':_0x594d64[_0x5706('0x37')]};return db[_0x5706('0x28')][_0x5706('0x1a')](_0x47573a)[_0x5706('0x1f')](function(_0x3578d3){_0xe5b8ef[_0x5706('0x1a')]=_0x3578d3;if(_0x2a0567['query'][_0x5706('0x3e')]){_0x594d64[_0x5706('0x3f')]=[{'all':!![]}];}return db[_0x5706('0x28')]['findAll'](_0x594d64);})[_0x5706('0x1f')](function(_0x350453){_0xe5b8ef[_0x5706('0x40')]=_0x350453;return _0xe5b8ef;})[_0x5706('0x1f')](respondWithFilteredResult(_0xe0590a,_0x594d64))[_0x5706('0x41')](handleError(_0xe0590a,null));};exports[_0x5706('0x42')]=function(_0x2e309e,_0x433aa1){var _0x5e2d0f={'raw':!![],'where':{'id':_0x2e309e['params']['id']}},_0xf97743={};_0xf97743[_0x5706('0x33')]=_['keys'](db['Disposition']['rawAttributes']);_0xf97743[_0x5706('0x2d')]=_[_0x5706('0x2e')](_0x2e309e[_0x5706('0x2d')]);_0xf97743[_0x5706('0x38')]=_['intersection'](_0xf97743['model'],_0xf97743['query']);_0x5e2d0f[_0x5706('0x30')]=_['intersection'](_0xf97743[_0x5706('0x33')],qs[_0x5706('0x31')](_0x2e309e[_0x5706('0x2d')][_0x5706('0x31')]));_0x5e2d0f[_0x5706('0x30')]=_0x5e2d0f[_0x5706('0x30')][_0x5706('0x32')]?_0x5e2d0f[_0x5706('0x30')]:_0xf97743[_0x5706('0x33')];if(_0x2e309e[_0x5706('0x2d')][_0x5706('0x3e')]){_0x5e2d0f[_0x5706('0x3f')]=[{'all':!![]}];}_0x5e2d0f=_[_0x5706('0x3b')]({},_0x5e2d0f,_0x2e309e[_0x5706('0x3d')]);return db['Disposition'][_0x5706('0x43')](_0x5e2d0f)[_0x5706('0x1f')](handleEntityNotFound(_0x433aa1,null))['then'](respondWithResult(_0x433aa1,null))[_0x5706('0x41')](handleError(_0x433aa1,null));};exports[_0x5706('0x44')]=function(_0x1d5912,_0x43a887){return db['Disposition']['create'](_0x1d5912[_0x5706('0x45')],{})[_0x5706('0x1f')](function(_0x2b273a){var _0x1f7916=_0x1d5912[_0x5706('0x46')][_0x5706('0x21')]({'plain':!![]});if(!_0x1f7916)throw new Error(_0x5706('0x47'));if(_0x1f7916[_0x5706('0x48')]===_0x5706('0x46')){var _0x4213e9=_0x2b273a['get']({'plain':!![]});var _0x2b732c=_0x5706('0x22');return db[_0x5706('0x49')][_0x5706('0x43')]({'where':{'name':_0x2b732c,'userProfileId':_0x1f7916['userProfileId']},'raw':!![]})['then'](function(_0x2d2998){if(_0x2d2998&&_0x2d2998[_0x5706('0x4a')]===0x0){return db['UserProfileResource'][_0x5706('0x44')]({'name':_0x4213e9[_0x5706('0x25')],'resourceId':_0x4213e9['id'],'type':_0x2d2998[_0x5706('0x25')],'sectionId':_0x2d2998['id']},{})[_0x5706('0x1f')](function(){return _0x2b273a;});}else{return _0x2b273a;}})[_0x5706('0x41')](function(_0x39597c){logger['error'](_0x5706('0x4b'),_0x39597c);throw _0x39597c;});}return _0x2b273a;})[_0x5706('0x1f')](respondWithResult(_0x43a887,0xc9))['catch'](handleError(_0x43a887,null));};exports[_0x5706('0x4c')]=function(_0x191cb9,_0x5db59b){if(_0x191cb9[_0x5706('0x45')]['id']){delete _0x191cb9['body']['id'];}return db[_0x5706('0x28')][_0x5706('0x43')]({'where':{'id':_0x191cb9['params']['id']}})['then'](handleEntityNotFound(_0x5db59b,null))[_0x5706('0x1f')](saveUpdates(_0x191cb9[_0x5706('0x45')],null))[_0x5706('0x1f')](respondWithResult(_0x5db59b,null))['catch'](handleError(_0x5db59b,null));};exports[_0x5706('0x20')]=function(_0x56a9f1,_0x47089b){return db[_0x5706('0x28')][_0x5706('0x43')]({'where':{'id':_0x56a9f1[_0x5706('0x4d')]['id']}})['then'](handleEntityNotFound(_0x47089b,null))[_0x5706('0x1f')](removeEntity(_0x47089b,null))[_0x5706('0x41')](handleError(_0x47089b,null));}; \ No newline at end of file +var _0xef62=['offset','set','apply','save','update','then','destroy','get','Dispositions','UserProfileResource','error','stack','send','Disposition','rawAttributes','fieldName','type','key','model','map','name','query','filters','intersection','fields','attributes','length','hasOwnProperty','limit','sort','pick','where','merge','VIRTUAL','filter','options','includeAll','rows','catch','show','params','keys','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','ejs','lodash','squel','crypto','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','count'];(function(_0x30ddf3,_0x7a86f6){var _0x694bdf=function(_0x3d2401){while(--_0x3d2401){_0x30ddf3['push'](_0x30ddf3['shift']());}};_0x694bdf(++_0x7a86f6);}(_0xef62,0xd4));var _0x2ef6=function(_0x91b429,_0x4594af){_0x91b429=_0x91b429-0x0;var _0x1ccb72=_0xef62[_0x91b429];return _0x1ccb72;};'use strict';var pdf=require(_0x2ef6('0x0'));var emlformat=require(_0x2ef6('0x1'));var rimraf=require(_0x2ef6('0x2'));var zipdir=require(_0x2ef6('0x3'));var jsonpatch=require(_0x2ef6('0x4'));var rp=require('request-promise');var moment=require(_0x2ef6('0x5'));var BPromise=require(_0x2ef6('0x6'));var Mustache=require(_0x2ef6('0x7'));var util=require(_0x2ef6('0x8'));var path=require(_0x2ef6('0x9'));var sox=require(_0x2ef6('0xa'));var csv=require('to-csv');var ejs=require(_0x2ef6('0xb'));var fs=require('fs');var _=require(_0x2ef6('0xc'));var squel=require(_0x2ef6('0xd'));var crypto=require(_0x2ef6('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x2ef6('0xf'));var toCsv=require(_0x2ef6('0x10'));var querystring=require(_0x2ef6('0x11'));var Papa=require(_0x2ef6('0x12'));var Redis=require(_0x2ef6('0x13'));var authService=require(_0x2ef6('0x14'));var qs=require('../../components/parsers/qs');var as=require(_0x2ef6('0x15'));var hardwareService=require(_0x2ef6('0x16'));var logger=require('../../config/logger')(_0x2ef6('0x17'));var utils=require(_0x2ef6('0x18'));var config=require(_0x2ef6('0x19'));var db=require(_0x2ef6('0x1a'))['db'];function respondWithStatusCode(_0x2b40a6,_0x2bb220){_0x2bb220=_0x2bb220||0xcc;return function(_0x5674c7){if(_0x5674c7){return _0x2b40a6[_0x2ef6('0x1b')](_0x2bb220);}return _0x2b40a6[_0x2ef6('0x1c')](_0x2bb220)[_0x2ef6('0x1d')]();};}function respondWithResult(_0x2667b5,_0x34a667){_0x34a667=_0x34a667||0xc8;return function(_0x8ce1cd){if(_0x8ce1cd){return _0x2667b5[_0x2ef6('0x1c')](_0x34a667)['json'](_0x8ce1cd);}};}function respondWithFilteredResult(_0x246a47,_0x5993cc){return function(_0x2b2ddc){if(_0x2b2ddc){var _0x2ff824=_0x2b2ddc[_0x2ef6('0x1e')],_0x42adab=_0x5993cc['offset'],_0x540cfb=_0x5993cc[_0x2ef6('0x1f')]+_0x5993cc['limit'],_0x29569a;if(_0x540cfb>=_0x2ff824){_0x540cfb=_0x2ff824;_0x29569a=0xc8;}else{_0x29569a=0xce;}_0x246a47[_0x2ef6('0x1c')](_0x29569a);return _0x246a47[_0x2ef6('0x20')]('Content-Range',_0x42adab+'-'+_0x540cfb+'/'+_0x2ff824)['json'](_0x2b2ddc);}return null;};}function patchUpdates(_0x405a35){return function(_0xb6d202){try{jsonpatch[_0x2ef6('0x21')](_0xb6d202,_0x405a35,!![]);}catch(_0x14d0aa){return BPromise['reject'](_0x14d0aa);}return _0xb6d202[_0x2ef6('0x22')]();};}function saveUpdates(_0x15ba61,_0x4fb7d2){return function(_0x362343){if(_0x362343){return _0x362343[_0x2ef6('0x23')](_0x15ba61)[_0x2ef6('0x24')](function(_0x450d40){return _0x450d40;});}return null;};}function removeEntity(_0x4286a8,_0x51836d){return function(_0x464bb8){if(_0x464bb8){return _0x464bb8[_0x2ef6('0x25')]()['then'](function(){var _0x42bb16=_0x464bb8[_0x2ef6('0x26')]({'plain':!![]});var _0xe02214=_0x2ef6('0x27');return db[_0x2ef6('0x28')][_0x2ef6('0x25')]({'where':{'type':_0xe02214,'resourceId':_0x42bb16['id']}})[_0x2ef6('0x24')](function(){return _0x464bb8;});})[_0x2ef6('0x24')](function(){_0x4286a8[_0x2ef6('0x1c')](0xcc)[_0x2ef6('0x1d')]();});}};}function handleEntityNotFound(_0x5b23f7,_0x1ef371){return function(_0x3ba958){if(!_0x3ba958){_0x5b23f7['sendStatus'](0x194);}return _0x3ba958;};}function handleError(_0x266b75,_0x21a7bf){_0x21a7bf=_0x21a7bf||0x1f4;return function(_0x5be675){logger[_0x2ef6('0x29')](_0x5be675[_0x2ef6('0x2a')]);if(_0x5be675['name']){delete _0x5be675['name'];}_0x266b75[_0x2ef6('0x1c')](_0x21a7bf)[_0x2ef6('0x2b')](_0x5be675);};}exports['index']=function(_0x27406e,_0x3f4154){var _0x58e47b={},_0x49af66={},_0x2d138b={'count':0x0,'rows':[]};var _0x20c750=_['map'](db[_0x2ef6('0x2c')][_0x2ef6('0x2d')],function(_0x228382){return{'name':_0x228382[_0x2ef6('0x2e')],'type':_0x228382[_0x2ef6('0x2f')][_0x2ef6('0x30')]};});_0x49af66[_0x2ef6('0x31')]=_[_0x2ef6('0x32')](_0x20c750,_0x2ef6('0x33'));_0x49af66[_0x2ef6('0x34')]=_['keys'](_0x27406e[_0x2ef6('0x34')]);_0x49af66[_0x2ef6('0x35')]=_['intersection'](_0x49af66[_0x2ef6('0x31')],_0x49af66['query']);_0x58e47b['attributes']=_[_0x2ef6('0x36')](_0x49af66[_0x2ef6('0x31')],qs[_0x2ef6('0x37')](_0x27406e[_0x2ef6('0x34')][_0x2ef6('0x37')]));_0x58e47b['attributes']=_0x58e47b[_0x2ef6('0x38')][_0x2ef6('0x39')]?_0x58e47b[_0x2ef6('0x38')]:_0x49af66[_0x2ef6('0x31')];if(!_0x27406e[_0x2ef6('0x34')][_0x2ef6('0x3a')]('nolimit')){_0x58e47b[_0x2ef6('0x3b')]=qs[_0x2ef6('0x3b')](_0x27406e[_0x2ef6('0x34')][_0x2ef6('0x3b')]);_0x58e47b[_0x2ef6('0x1f')]=qs[_0x2ef6('0x1f')](_0x27406e[_0x2ef6('0x34')][_0x2ef6('0x1f')]);}_0x58e47b['order']=qs['sort'](_0x27406e[_0x2ef6('0x34')][_0x2ef6('0x3c')]);_0x58e47b['where']=qs['filters'](_[_0x2ef6('0x3d')](_0x27406e['query'],_0x49af66[_0x2ef6('0x35')]),_0x20c750);if(_0x27406e[_0x2ef6('0x34')]['filter']){_0x58e47b[_0x2ef6('0x3e')]=_[_0x2ef6('0x3f')](_0x58e47b[_0x2ef6('0x3e')],{'$or':_['map'](_0x20c750,function(_0x1aa930){if(_0x1aa930[_0x2ef6('0x2f')]!==_0x2ef6('0x40')){var _0x4caa5e={};_0x4caa5e[_0x1aa930[_0x2ef6('0x33')]]={'$like':'%'+_0x27406e[_0x2ef6('0x34')][_0x2ef6('0x41')]+'%'};return _0x4caa5e;}})});}_0x58e47b=_['merge']({},_0x58e47b,_0x27406e[_0x2ef6('0x42')]);var _0x3a5e3f={'where':_0x58e47b[_0x2ef6('0x3e')]};return db[_0x2ef6('0x2c')][_0x2ef6('0x1e')](_0x3a5e3f)[_0x2ef6('0x24')](function(_0x380232){_0x2d138b[_0x2ef6('0x1e')]=_0x380232;if(_0x27406e['query'][_0x2ef6('0x43')]){_0x58e47b['include']=[{'all':!![]}];}return db[_0x2ef6('0x2c')]['findAll'](_0x58e47b);})[_0x2ef6('0x24')](function(_0x1bc2f9){_0x2d138b[_0x2ef6('0x44')]=_0x1bc2f9;return _0x2d138b;})[_0x2ef6('0x24')](respondWithFilteredResult(_0x3f4154,_0x58e47b))[_0x2ef6('0x45')](handleError(_0x3f4154,null));};exports[_0x2ef6('0x46')]=function(_0x359fcd,_0x554c96){var _0x573533={'raw':!![],'where':{'id':_0x359fcd[_0x2ef6('0x47')]['id']}},_0x182552={};_0x182552['model']=_[_0x2ef6('0x48')](db[_0x2ef6('0x2c')][_0x2ef6('0x2d')]);_0x182552[_0x2ef6('0x34')]=_[_0x2ef6('0x48')](_0x359fcd[_0x2ef6('0x34')]);_0x182552['filters']=_[_0x2ef6('0x36')](_0x182552[_0x2ef6('0x31')],_0x182552[_0x2ef6('0x34')]);_0x573533[_0x2ef6('0x38')]=_['intersection'](_0x182552['model'],qs[_0x2ef6('0x37')](_0x359fcd[_0x2ef6('0x34')]['fields']));_0x573533[_0x2ef6('0x38')]=_0x573533[_0x2ef6('0x38')][_0x2ef6('0x39')]?_0x573533[_0x2ef6('0x38')]:_0x182552['model'];if(_0x359fcd[_0x2ef6('0x34')][_0x2ef6('0x43')]){_0x573533['include']=[{'all':!![]}];}_0x573533=_[_0x2ef6('0x3f')]({},_0x573533,_0x359fcd[_0x2ef6('0x42')]);return db[_0x2ef6('0x2c')][_0x2ef6('0x49')](_0x573533)[_0x2ef6('0x24')](handleEntityNotFound(_0x554c96,null))[_0x2ef6('0x24')](respondWithResult(_0x554c96,null))[_0x2ef6('0x45')](handleError(_0x554c96,null));};exports[_0x2ef6('0x4a')]=function(_0x26d343,_0x4ad9bc){return db['Disposition']['create'](_0x26d343[_0x2ef6('0x4b')],{})[_0x2ef6('0x24')](function(_0x3fcc43){var _0xb0ee18=_0x26d343['user'][_0x2ef6('0x26')]({'plain':!![]});if(!_0xb0ee18)throw new Error(_0x2ef6('0x4c'));if(_0xb0ee18[_0x2ef6('0x4d')]===_0x2ef6('0x4e')){var _0x3964a3=_0x3fcc43[_0x2ef6('0x26')]({'plain':!![]});var _0x293e52=_0x2ef6('0x27');return db[_0x2ef6('0x4f')][_0x2ef6('0x49')]({'where':{'name':_0x293e52,'userProfileId':_0xb0ee18['userProfileId']},'raw':!![]})['then'](function(_0x4d76bf){if(_0x4d76bf&&_0x4d76bf['autoAssociation']===0x0){return db[_0x2ef6('0x28')][_0x2ef6('0x4a')]({'name':_0x3964a3[_0x2ef6('0x33')],'resourceId':_0x3964a3['id'],'type':_0x4d76bf[_0x2ef6('0x33')],'sectionId':_0x4d76bf['id']},{})[_0x2ef6('0x24')](function(){return _0x3fcc43;});}else{return _0x3fcc43;}})[_0x2ef6('0x45')](function(_0x57f501){logger[_0x2ef6('0x29')](_0x2ef6('0x50'),_0x57f501);throw _0x57f501;});}return _0x3fcc43;})[_0x2ef6('0x24')](respondWithResult(_0x4ad9bc,0xc9))[_0x2ef6('0x45')](handleError(_0x4ad9bc,null));};exports[_0x2ef6('0x23')]=function(_0x268abe,_0x41cacb){if(_0x268abe[_0x2ef6('0x4b')]['id']){delete _0x268abe[_0x2ef6('0x4b')]['id'];}return db['Disposition'][_0x2ef6('0x49')]({'where':{'id':_0x268abe[_0x2ef6('0x47')]['id']}})['then'](handleEntityNotFound(_0x41cacb,null))['then'](saveUpdates(_0x268abe[_0x2ef6('0x4b')],null))[_0x2ef6('0x24')](respondWithResult(_0x41cacb,null))['catch'](handleError(_0x41cacb,null));};exports[_0x2ef6('0x25')]=function(_0x4a2393,_0x14581c){return db[_0x2ef6('0x2c')][_0x2ef6('0x49')]({'where':{'id':_0x4a2393['params']['id']}})['then'](handleEntityNotFound(_0x14581c,null))['then'](removeEntity(_0x14581c,null))[_0x2ef6('0x45')](handleError(_0x14581c,null));}; \ No newline at end of file diff --git a/server/api/disposition/disposition.model.js b/server/api/disposition/disposition.model.js index f2e1e3e..46918c6 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 _0x6305=['rimraf','../../config/environment','./disposition.attributes','exports','define','Disposition','name','ListId','name_chat','name_mail','SmsAccountId','name_fax','FaxAccountId','name_openchannel','name_whatsapp','WhatsappAccountId','../../config/logger','api','moment','bluebird','path'];(function(_0x4c165f,_0x368235){var _0x22e906=function(_0x35836a){while(--_0x35836a){_0x4c165f['push'](_0x4c165f['shift']());}};_0x22e906(++_0x368235);}(_0x6305,0x10c));var _0x5630=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0x6305[_0x432682];return _0x463d05;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x5630('0x0'))(_0x5630('0x1'));var moment=require(_0x5630('0x2'));var BPromise=require(_0x5630('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x5630('0x4'));var rimraf=require(_0x5630('0x5'));var config=require(_0x5630('0x6'));var attributes=require(_0x5630('0x7'));module[_0x5630('0x8')]=function(_0x280c25,_0x28bcd7){return _0x280c25[_0x5630('0x9')](_0x5630('0xa'),attributes,{'tableName':'tools_dispositions','paranoid':![],'indexes':[{'unique':!![],'name':'name_voice','fields':[_0x5630('0xb'),_0x5630('0xc')]},{'unique':!![],'name':_0x5630('0xd'),'fields':[_0x5630('0xb'),'ChatWebsiteId']},{'unique':!![],'name':_0x5630('0xe'),'fields':['name','MailAccountId']},{'unique':!![],'name':'name_sms','fields':[_0x5630('0xb'),_0x5630('0xf')]},{'unique':!![],'name':_0x5630('0x10'),'fields':[_0x5630('0xb'),_0x5630('0x11')]},{'unique':!![],'name':_0x5630('0x12'),'fields':[_0x5630('0xb'),'OpenchannelAccountId']},{'unique':!![],'name':_0x5630('0x13'),'fields':[_0x5630('0xb'),_0x5630('0x14')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x591a=['WhatsappAccountId','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','exports','define','Disposition','name_voice','name','ListId','ChatWebsiteId','name_mail','MailAccountId','SmsAccountId','FaxAccountId','name_openchannel','OpenchannelAccountId'];(function(_0x5be89e,_0x33a526){var _0x2808e6=function(_0x437e02){while(--_0x437e02){_0x5be89e['push'](_0x5be89e['shift']());}};_0x2808e6(++_0x33a526);}(_0x591a,0x18d));var _0xa591=function(_0x34f701,_0x37e407){_0x34f701=_0x34f701-0x0;var _0x3e2429=_0x591a[_0x34f701];return _0x3e2429;};'use strict';var _=require(_0xa591('0x0'));var util=require(_0xa591('0x1'));var logger=require(_0xa591('0x2'))(_0xa591('0x3'));var moment=require('moment');var BPromise=require(_0xa591('0x4'));var rp=require(_0xa591('0x5'));var fs=require('fs');var path=require(_0xa591('0x6'));var rimraf=require(_0xa591('0x7'));var config=require('../../config/environment');var attributes=require('./disposition.attributes');module[_0xa591('0x8')]=function(_0x5a9341,_0x36d854){return _0x5a9341[_0xa591('0x9')](_0xa591('0xa'),attributes,{'tableName':'tools_dispositions','paranoid':![],'indexes':[{'unique':!![],'name':_0xa591('0xb'),'fields':[_0xa591('0xc'),_0xa591('0xd')]},{'unique':!![],'name':'name_chat','fields':[_0xa591('0xc'),_0xa591('0xe')]},{'unique':!![],'name':_0xa591('0xf'),'fields':['name',_0xa591('0x10')]},{'unique':!![],'name':'name_sms','fields':[_0xa591('0xc'),_0xa591('0x11')]},{'unique':!![],'name':'name_fax','fields':['name',_0xa591('0x12')]},{'unique':!![],'name':_0xa591('0x13'),'fields':[_0xa591('0xc'),_0xa591('0x14')]},{'unique':!![],'name':'name_whatsapp','fields':[_0xa591('0xc'),_0xa591('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 bc9dfca..f31c566 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 _0xf239=['debug','Disposition,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','Disposition,\x20%s,\x20%s','request\x20sent'];(function(_0x4b5d4a,_0x1a3b8f){var _0x307ce4=function(_0x53c585){while(--_0x53c585){_0x4b5d4a['push'](_0x4b5d4a['shift']());}};_0x307ce4(++_0x1a3b8f);}(_0xf239,0x1b8));var _0x9f23=function(_0x3daad2,_0x25d5c9){_0x3daad2=_0x3daad2-0x0;var _0x41e91c=_0xf239[_0x3daad2];return _0x41e91c;};'use strict';var _=require(_0x9f23('0x0'));var util=require(_0x9f23('0x1'));var moment=require(_0x9f23('0x2'));var BPromise=require(_0x9f23('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x9f23('0x4'));var db=require(_0x9f23('0x5'))['db'];var utils=require(_0x9f23('0x6'));var logger=require(_0x9f23('0x7'))(_0x9f23('0x8'));var config=require(_0x9f23('0x9'));var jayson=require(_0x9f23('0xa'));var client=jayson[_0x9f23('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0xf3901a,_0x3517d4,_0x2da513){return new BPromise(function(_0x3197ac,_0x31e275){return client[_0x9f23('0xc')](_0xf3901a,_0x2da513)[_0x9f23('0xd')](function(_0x221a72){logger['info'](_0x9f23('0xe'),_0x3517d4,_0x9f23('0xf'));logger[_0x9f23('0x10')](_0x9f23('0x11'),_0x3517d4,'request\x20sent',JSON[_0x9f23('0x12')](_0x221a72));if(_0x221a72[_0x9f23('0x13')]){if(_0x221a72[_0x9f23('0x13')]['code']===0x1f4){logger[_0x9f23('0x13')](_0x9f23('0xe'),_0x3517d4,_0x221a72[_0x9f23('0x13')][_0x9f23('0x14')]);return _0x31e275(_0x221a72[_0x9f23('0x13')][_0x9f23('0x14')]);}logger[_0x9f23('0x13')](_0x9f23('0xe'),_0x3517d4,_0x221a72['error'][_0x9f23('0x14')]);return _0x3197ac(_0x221a72[_0x9f23('0x13')][_0x9f23('0x14')]);}else{logger[_0x9f23('0x15')](_0x9f23('0xe'),_0x3517d4,_0x9f23('0xf'));_0x3197ac(_0x221a72[_0x9f23('0x16')][_0x9f23('0x14')]);}})[_0x9f23('0x17')](function(_0x4419d3){logger[_0x9f23('0x13')]('Disposition,\x20%s,\x20%s',_0x3517d4,_0x4419d3);_0x31e275(_0x4419d3);});});} \ No newline at end of file +var _0xc212=['util','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','stringify','error','message','Disposition,\x20%s,\x20%s','lodash'];(function(_0x3cb86b,_0x3c75f6){var _0x3c10a0=function(_0x71331f){while(--_0x71331f){_0x3cb86b['push'](_0x3cb86b['shift']());}};_0x3c10a0(++_0x3c75f6);}(_0xc212,0xef));var _0x2c21=function(_0x1c1b18,_0x56e6ee){_0x1c1b18=_0x1c1b18-0x0;var _0x278327=_0xc212[_0x1c1b18];return _0x278327;};'use strict';var _=require(_0x2c21('0x0'));var util=require(_0x2c21('0x1'));var moment=require('moment');var BPromise=require(_0x2c21('0x2'));var rs=require(_0x2c21('0x3'));var fs=require('fs');var Redis=require(_0x2c21('0x4'));var db=require(_0x2c21('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x2c21('0x6'));var config=require(_0x2c21('0x7'));var jayson=require(_0x2c21('0x8'));var client=jayson[_0x2c21('0x9')][_0x2c21('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x56efc4,_0x2e0aad,_0x3ae7f1){return new BPromise(function(_0x25caa1,_0x2c304d){return client[_0x2c21('0xb')](_0x56efc4,_0x3ae7f1)[_0x2c21('0xc')](function(_0x19c6c9){logger[_0x2c21('0xd')]('Disposition,\x20%s,\x20%s',_0x2e0aad,_0x2c21('0xe'));logger[_0x2c21('0xf')]('Disposition,\x20%s,\x20%s,\x20%s',_0x2e0aad,_0x2c21('0xe'),JSON[_0x2c21('0x10')](_0x19c6c9));if(_0x19c6c9[_0x2c21('0x11')]){if(_0x19c6c9[_0x2c21('0x11')]['code']===0x1f4){logger[_0x2c21('0x11')]('Disposition,\x20%s,\x20%s',_0x2e0aad,_0x19c6c9[_0x2c21('0x11')]['message']);return _0x2c304d(_0x19c6c9[_0x2c21('0x11')][_0x2c21('0x12')]);}logger['error']('Disposition,\x20%s,\x20%s',_0x2e0aad,_0x19c6c9['error'][_0x2c21('0x12')]);return _0x25caa1(_0x19c6c9[_0x2c21('0x11')][_0x2c21('0x12')]);}else{logger['info'](_0x2c21('0x13'),_0x2e0aad,_0x2c21('0xe'));_0x25caa1(_0x19c6c9['result']['message']);}})['catch'](function(_0x4d32f7){logger[_0x2c21('0x11')](_0x2c21('0x13'),_0x2e0aad,_0x4d32f7);_0x2c304d(_0x4d32f7);});});} \ No newline at end of file diff --git a/server/api/disposition/index.js b/server/api/disposition/index.js index c20d136..43835c5 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 _0x8f25=['/:id','show','post','create','put','update','delete','exports','multer','util','path','connect-timeout','express','Router','./disposition.controller','get','isAuthenticated'];(function(_0x710815,_0x520da8){var _0x5b3b89=function(_0x2e1a8e){while(--_0x2e1a8e){_0x710815['push'](_0x710815['shift']());}};_0x5b3b89(++_0x520da8);}(_0x8f25,0x14b));var _0x58f2=function(_0x5c351c,_0x2046d8){_0x5c351c=_0x5c351c-0x0;var _0x26f3b3=_0x8f25[_0x5c351c];return _0x26f3b3;};'use strict';var multer=require(_0x58f2('0x0'));var util=require(_0x58f2('0x1'));var path=require(_0x58f2('0x2'));var timeout=require(_0x58f2('0x3'));var express=require(_0x58f2('0x4'));var router=express[_0x58f2('0x5')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x58f2('0x6'));router[_0x58f2('0x7')]('/',auth[_0x58f2('0x8')](),controller['index']);router[_0x58f2('0x7')](_0x58f2('0x9'),auth[_0x58f2('0x8')](),controller[_0x58f2('0xa')]);router[_0x58f2('0xb')]('/',auth[_0x58f2('0x8')](),controller[_0x58f2('0xc')]);router[_0x58f2('0xd')]('/:id',auth[_0x58f2('0x8')](),controller[_0x58f2('0xe')]);router[_0x58f2('0xf')](_0x58f2('0x9'),auth[_0x58f2('0x8')](),controller['destroy']);module[_0x58f2('0x10')]=router; \ No newline at end of file +var _0xa866=['path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','post','create','put','delete','exports','multer','util'];(function(_0x35a547,_0x5507a7){var _0x485b9f=function(_0x53b2ef){while(--_0x53b2ef){_0x35a547['push'](_0x35a547['shift']());}};_0x485b9f(++_0x5507a7);}(_0xa866,0x6a));var _0x6a86=function(_0x1d7d5c,_0x40b80e){_0x1d7d5c=_0x1d7d5c-0x0;var _0x5dfe7b=_0xa866[_0x1d7d5c];return _0x5dfe7b;};'use strict';var multer=require(_0x6a86('0x0'));var util=require(_0x6a86('0x1'));var path=require(_0x6a86('0x2'));var timeout=require(_0x6a86('0x3'));var express=require(_0x6a86('0x4'));var router=express['Router']();var auth=require(_0x6a86('0x5'));var interaction=require(_0x6a86('0x6'));var config=require(_0x6a86('0x7'));var controller=require('./disposition.controller');router[_0x6a86('0x8')]('/',auth[_0x6a86('0x9')](),controller[_0x6a86('0xa')]);router['get'](_0x6a86('0xb'),auth[_0x6a86('0x9')](),controller[_0x6a86('0xc')]);router[_0x6a86('0xd')]('/',auth[_0x6a86('0x9')](),controller[_0x6a86('0xe')]);router[_0x6a86('0xf')](_0x6a86('0xb'),auth[_0x6a86('0x9')](),controller['update']);router[_0x6a86('0x10')](_0x6a86('0xb'),auth[_0x6a86('0x9')](),controller['destroy']);module[_0x6a86('0x11')]=router; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.attributes.js b/server/api/faxAccount/faxAccount.attributes.js index 65e853f..d4923a6 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 _0x4da3=['localstationid','4800','7200','12000','9600','14400','v17,v27,v29','INTEGER','SIP','IAX','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','mandatoryDispositionPauseId','exports','STRING','ENUM','yes','xCALLY\x20Motion\x20Fax'];(function(_0x1e8fc8,_0x11a543){var _0xc54186=function(_0x2003f9){while(--_0x2003f9){_0x1e8fc8['push'](_0x1e8fc8['shift']());}};_0xc54186(++_0x11a543);}(_0x4da3,0x121));var _0x34da=function(_0x31206d,_0x2d5200){_0x31206d=_0x31206d-0x0;var _0x58d2bc=_0x4da3[_0x31206d];return _0x58d2bc;};'use strict';var Sequelize=require('sequelize');module[_0x34da('0x0')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x34da('0x1')]},'ecm':{'type':Sequelize[_0x34da('0x2')](_0x34da('0x3'),'no'),'defaultValue':_0x34da('0x3')},'headerinfo':{'type':Sequelize[_0x34da('0x1')],'defaultValue':_0x34da('0x4')},'localstationid':{'type':Sequelize['STRING'],'unique':_0x34da('0x5')},'minrate':{'type':Sequelize[_0x34da('0x2')]('2400',_0x34da('0x6'),_0x34da('0x7'),'9600',_0x34da('0x8'),'14400'),'defaultValue':_0x34da('0x6')},'maxrate':{'type':Sequelize[_0x34da('0x2')]('2400','4800',_0x34da('0x7'),_0x34da('0x9'),'12000',_0x34da('0xa')),'defaultValue':_0x34da('0xa')},'modem':{'type':Sequelize['STRING'],'defaultValue':_0x34da('0xb')},'gateway':{'type':Sequelize[_0x34da('0x1')],'defaultValue':'no','validate':{'is':/^(?:yes|no|[0-9]+)$/}},'faxdetect':{'type':Sequelize[_0x34da('0x1')],'defaultValue':'no','validate':{'is':/^(?:yes|no|t38|cng|[0-9]+)$/}},'t38timeout':{'type':Sequelize[_0x34da('0xc')],'defaultValue':0x1388,'validate':{'min':0x3e8}},'tech':{'type':Sequelize['ENUM'](_0x34da('0xd'),_0x34da('0xe'),'DADHI','KHOMP'),'defaultValue':_0x34da('0xd')},'key':{'type':Sequelize['STRING'],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0x34da('0xf')],'defaultValue':function(){return _0x34da('0x10');}},'notificationSound':{'type':Sequelize[_0x34da('0x11')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x34da('0x11')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x34da('0xc')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x34da('0x11')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x34da('0xc')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x34da('0xc')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x34da('0xc')],'allowNull':!![],'defaultValue':null,'comment':_0x34da('0x12')},'mandatoryDisposition':{'type':Sequelize[_0x34da('0x11')],'defaultValue':![],'comment':_0x34da('0x13'),'set':function(_0x169fd5){if(!_0x169fd5)this['setDataValue'](_0x34da('0x14'),null);this['setDataValue']('mandatoryDisposition',_0x169fd5);}}}; \ No newline at end of file +var _0x80f9=['TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','sequelize','exports','STRING','yes','xCALLY\x20Motion\x20Fax','localstationid','2400','4800','7200','9600','12000','ENUM','14400','INTEGER','IAX','DADHI','KHOMP','SIP'];(function(_0x197949,_0x5c89e3){var _0x3b6fcb=function(_0xe15c26){while(--_0xe15c26){_0x197949['push'](_0x197949['shift']());}};_0x3b6fcb(++_0x5c89e3);}(_0x80f9,0xc6));var _0x980f=function(_0x11b3d4,_0x2692eb){_0x11b3d4=_0x11b3d4-0x0;var _0xfd5f99=_0x80f9[_0x11b3d4];return _0xfd5f99;};'use strict';var Sequelize=require(_0x980f('0x0'));module[_0x980f('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x980f('0x2')]},'ecm':{'type':Sequelize['ENUM'](_0x980f('0x3'),'no'),'defaultValue':_0x980f('0x3')},'headerinfo':{'type':Sequelize[_0x980f('0x2')],'defaultValue':_0x980f('0x4')},'localstationid':{'type':Sequelize['STRING'],'unique':_0x980f('0x5')},'minrate':{'type':Sequelize['ENUM'](_0x980f('0x6'),_0x980f('0x7'),_0x980f('0x8'),_0x980f('0x9'),_0x980f('0xa'),'14400'),'defaultValue':_0x980f('0x7')},'maxrate':{'type':Sequelize[_0x980f('0xb')](_0x980f('0x6'),_0x980f('0x7'),'7200',_0x980f('0x9'),'12000',_0x980f('0xc')),'defaultValue':_0x980f('0xc')},'modem':{'type':Sequelize[_0x980f('0x2')],'defaultValue':'v17,v27,v29'},'gateway':{'type':Sequelize[_0x980f('0x2')],'defaultValue':'no','validate':{'is':/^(?:yes|no|[0-9]+)$/}},'faxdetect':{'type':Sequelize[_0x980f('0x2')],'defaultValue':'no','validate':{'is':/^(?:yes|no|t38|cng|[0-9]+)$/}},'t38timeout':{'type':Sequelize[_0x980f('0xd')],'defaultValue':0x1388,'validate':{'min':0x3e8}},'tech':{'type':Sequelize[_0x980f('0xb')]('SIP',_0x980f('0xe'),_0x980f('0xf'),_0x980f('0x10')),'defaultValue':_0x980f('0x11')},'key':{'type':Sequelize['STRING'],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0x980f('0x12')],'defaultValue':function(){return _0x980f('0x13');}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x980f('0x14')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x980f('0xd')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x980f('0x14')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x980f('0xd')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x980f('0x14')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x980f('0xd')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x980f('0xd')],'allowNull':!![],'defaultValue':null,'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize[_0x980f('0x14')],'defaultValue':![],'comment':_0x980f('0x15'),'set':function(_0x393d1c){if(!_0x393d1c)this[_0x980f('0x16')](_0x980f('0x17'),null);this[_0x980f('0x16')]('mandatoryDisposition',_0x393d1c);}}}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.controller.js b/server/api/faxAccount/faxAccount.controller.js index bcf282b..1195d7f 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 _0x094e=['stringify','code','error','message','result','status','end','json','offset','limit','set','Content-Range','apply','save','destroy','FaxAccounts','UserProfileResource','sendStatus','stack','name','send','Pause','mandatoryDispositionPause','FaxAccount','key','model','query','keys','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','count','includeAll','findAll','catch','show','params','rawAttributes','filters','include','options','find','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','body','describe','FaxAccountId','Disposition','create','getDispositions','findOne','map','rows','removeDispositions','ids','CannedAnswer','removeAnswers','addInteraction','FaxInteraction','omit','getInteractions','CmContact','Contact','Owner','fullname','internal','Tag','Tags','color','tag','addApplications','sequelize','transaction','FaxApplication','bulkCreate','findAndCountAll','getApplications','context','exten','app','system','description','Fax\x20Extension','priority','appdata','push','Answer','CDR(type)=inbound-fax','Set','ecm','localstationid','gateway','faxdetect','maxrate','modem','FAXOPT(','Wait','ReceiveFax','VoiceExtension','updateAccountApplications','tech','TrunkId','ListId','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','CmList','Contacts','updatedAt','DESC','attachments','join','root','server/files/attachments','basename','CheckAfterSend','isNil','\x22%s\x22\x20<%s>','fax','List','List\x20not\x20found','Send\x20Fax\x20failed','out','filename','FaxMessage','Contact\x20not\x20found','spread','ContactId','dataValues','Messages','SendFax','SendFaxRpc,\x20%s','addAgents','emit','userFaxAccount:save','removeAgents','isArray','userFaxAccount:remove','getAgents','html-pdf','eml-format','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./faxAccount.socket','register','jayson/promise','client','http','test','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','info','FaxAccount,\x20%s,\x20%s','request\x20sent','debug','FaxAccount,\x20%s,\x20%s,\x20%s'];(function(_0x17cfdc,_0x4d6016){var _0x125059=function(_0x566e3b){while(--_0x566e3b){_0x17cfdc['push'](_0x17cfdc['shift']());}};_0x125059(++_0x4d6016);}(_0x094e,0x164));var _0xe094=function(_0x156df1,_0x580693){_0x156df1=_0x156df1-0x0;var _0x2f5007=_0x094e[_0x156df1];return _0x2f5007;};'use strict';var pdf=require(_0xe094('0x0'));var emlformat=require(_0xe094('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xe094('0x2'));var moment=require(_0xe094('0x3'));var BPromise=require(_0xe094('0x4'));var Mustache=require(_0xe094('0x5'));var util=require(_0xe094('0x6'));var path=require(_0xe094('0x7'));var sox=require(_0xe094('0x8'));var csv=require(_0xe094('0x9'));var ejs=require(_0xe094('0xa'));var fs=require('fs');var _=require(_0xe094('0xb'));var squel=require(_0xe094('0xc'));var crypto=require(_0xe094('0xd'));var jsforce=require(_0xe094('0xe'));var deskjs=require(_0xe094('0xf'));var toCsv=require(_0xe094('0x9'));var querystring=require(_0xe094('0x10'));var Papa=require('papaparse');var Redis=require(_0xe094('0x11'));var authService=require(_0xe094('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xe094('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xe094('0x14'))('api');var utils=require('../../config/utils');var config=require(_0xe094('0x15'));var db=require(_0xe094('0x16'))['db'];config[_0xe094('0x17')]=_[_0xe094('0x18')](config[_0xe094('0x17')],{'host':_0xe094('0x19'),'port':0x18eb});var socket=require(_0xe094('0x1a'))(new Redis(config[_0xe094('0x17')]));require(_0xe094('0x1b'))[_0xe094('0x1c')](socket);var jayson=require(_0xe094('0x1d'));var client=jayson[_0xe094('0x1e')][_0xe094('0x1f')]({'port':0x232c});var client9002=jayson[_0xe094('0x1e')]['http']({'port':0x232a});function checkPasswordPattern(_0x3409ec,_0x19a28a,_0x548f53){if(_0x548f53){var _0x2ca402=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x2ca402[_0xe094('0x20')](_0x19a28a)){return _0x3409ec;}else{throw new db['Sequelize'][(_0xe094('0x21'))](_0xe094('0x22'));}}else{return _0x3409ec;}}function respondWithRpcPromise(_0x4e860a,_0x2782f9,_0x9132a7,_0x8ab457){return new BPromise(function(_0x254f4c,_0x46472d){var _0x551d6c=_0x8ab457||client;return _0x551d6c[_0xe094('0x23')](_0x4e860a,_0x9132a7)[_0xe094('0x24')](function(_0x2672b6){logger[_0xe094('0x25')](_0xe094('0x26'),_0x2782f9,_0xe094('0x27'));logger[_0xe094('0x28')](_0xe094('0x29'),_0x2782f9,_0xe094('0x27'),JSON[_0xe094('0x2a')](_0x2672b6));if(_0x2672b6['error']){if(_0x2672b6['error'][_0xe094('0x2b')]===0x1f4){logger['error'](_0xe094('0x26'),_0x2782f9,_0x2672b6[_0xe094('0x2c')]['message']);return _0x46472d(_0x2672b6[_0xe094('0x2c')][_0xe094('0x2d')]);}logger[_0xe094('0x2c')](_0xe094('0x26'),_0x2782f9,_0x2672b6['error'][_0xe094('0x2d')]);return _0x254f4c(_0x2672b6[_0xe094('0x2c')][_0xe094('0x2d')]);}else{logger[_0xe094('0x25')](_0xe094('0x26'),_0x2782f9,_0xe094('0x27'));_0x254f4c(_0x2672b6[_0xe094('0x2e')][_0xe094('0x2d')]);}})['catch'](function(_0x1b7265){logger['error'](_0xe094('0x26'),_0x2782f9,_0x1b7265);_0x46472d(_0x1b7265);});});}function respondWithStatusCode(_0x2363f5,_0x4ab07a){_0x4ab07a=_0x4ab07a||0xcc;return function(_0xd7c448){if(_0xd7c448){return _0x2363f5['sendStatus'](_0x4ab07a);}return _0x2363f5[_0xe094('0x2f')](_0x4ab07a)[_0xe094('0x30')]();};}function respondWithResult(_0x786ada,_0x42e822){_0x42e822=_0x42e822||0xc8;return function(_0x2777ea){if(_0x2777ea){return _0x786ada[_0xe094('0x2f')](_0x42e822)[_0xe094('0x31')](_0x2777ea);}};}function respondWithFilteredResult(_0x18b181,_0x94288f){return function(_0x560e5a){if(_0x560e5a){var _0x27d31d=_0x560e5a['count'],_0x1efc11=_0x94288f[_0xe094('0x32')],_0x436218=_0x94288f['offset']+_0x94288f[_0xe094('0x33')],_0x4bfa11;if(_0x436218>=_0x27d31d){_0x436218=_0x27d31d;_0x4bfa11=0xc8;}else{_0x4bfa11=0xce;}_0x18b181['status'](_0x4bfa11);return _0x18b181[_0xe094('0x34')](_0xe094('0x35'),_0x1efc11+'-'+_0x436218+'/'+_0x27d31d)[_0xe094('0x31')](_0x560e5a);}return null;};}function patchUpdates(_0x13343f){return function(_0x38b0eb){try{jsonpatch[_0xe094('0x36')](_0x38b0eb,_0x13343f,!![]);}catch(_0x50c54d){return BPromise['reject'](_0x50c54d);}return _0x38b0eb[_0xe094('0x37')]();};}function saveUpdates(_0x8e9eb5,_0x2bf43c){return function(_0xd75a9e){if(_0xd75a9e){return _0xd75a9e['update'](_0x8e9eb5)[_0xe094('0x24')](function(_0x4e2065){return _0x4e2065;});}return null;};}function removeEntity(_0x530e5e,_0x4b7b4d){return function(_0x3d60ff){if(_0x3d60ff){return _0x3d60ff[_0xe094('0x38')]()[_0xe094('0x24')](function(){var _0x4cf212=_0x3d60ff['get']({'plain':!![]});var _0x143843=_0xe094('0x39');return db[_0xe094('0x3a')][_0xe094('0x38')]({'where':{'type':_0x143843,'resourceId':_0x4cf212['id']}})['then'](function(){return _0x3d60ff;});})['then'](function(){_0x530e5e[_0xe094('0x2f')](0xcc)[_0xe094('0x30')]();});}};}function handleEntityNotFound(_0x29ca79,_0x291c94){return function(_0x90b292){if(!_0x90b292){_0x29ca79[_0xe094('0x3b')](0x194);}return _0x90b292;};}function handleError(_0x2de511,_0x20f0be){_0x20f0be=_0x20f0be||0x1f4;return function(_0x226122){logger['error'](_0x226122[_0xe094('0x3c')]);if(_0x226122[_0xe094('0x3d')]){delete _0x226122[_0xe094('0x3d')];}_0x2de511[_0xe094('0x2f')](_0x20f0be)[_0xe094('0x3e')](_0x226122);};}exports['index']=function(_0x1f0843,_0x5755f0){var _0x1f1ba4={'include':[{'model':db[_0xe094('0x3f')],'as':_0xe094('0x40')}]},_0x23c24a={},_0x422f67={'count':0x0,'rows':[]};var _0x4cd1e7=_['map'](db[_0xe094('0x41')]['rawAttributes'],function(_0x2962a9){return{'name':_0x2962a9['fieldName'],'type':_0x2962a9['type'][_0xe094('0x42')]};});_0x23c24a[_0xe094('0x43')]=_['map'](_0x4cd1e7,'name');_0x23c24a[_0xe094('0x44')]=_[_0xe094('0x45')](_0x1f0843[_0xe094('0x44')]);_0x23c24a['filters']=_[_0xe094('0x46')](_0x23c24a[_0xe094('0x43')],_0x23c24a[_0xe094('0x44')]);_0x1f1ba4['attributes']=_[_0xe094('0x46')](_0x23c24a['model'],qs['fields'](_0x1f0843[_0xe094('0x44')][_0xe094('0x47')]));_0x1f1ba4[_0xe094('0x48')]=_0x1f1ba4[_0xe094('0x48')][_0xe094('0x49')]?_0x1f1ba4[_0xe094('0x48')]:_0x23c24a[_0xe094('0x43')];if(!_0x1f0843[_0xe094('0x44')][_0xe094('0x4a')](_0xe094('0x4b'))){_0x1f1ba4[_0xe094('0x33')]=qs[_0xe094('0x33')](_0x1f0843[_0xe094('0x44')][_0xe094('0x33')]);_0x1f1ba4[_0xe094('0x32')]=qs[_0xe094('0x32')](_0x1f0843[_0xe094('0x44')]['offset']);}_0x1f1ba4[_0xe094('0x4c')]=qs[_0xe094('0x4d')](_0x1f0843[_0xe094('0x44')][_0xe094('0x4d')]);_0x1f1ba4[_0xe094('0x4e')]=qs['filters'](_[_0xe094('0x4f')](_0x1f0843[_0xe094('0x44')],_0x23c24a['filters']),_0x4cd1e7);if(_0x1f0843[_0xe094('0x44')][_0xe094('0x50')]){_0x1f1ba4['where']=_[_0xe094('0x51')](_0x1f1ba4[_0xe094('0x4e')],{'$or':_['map'](_0x4cd1e7,function(_0x2605a1){if(_0x2605a1[_0xe094('0x52')]!==_0xe094('0x53')){var _0x1987c0={};_0x1987c0[_0x2605a1[_0xe094('0x3d')]]={'$like':'%'+_0x1f0843[_0xe094('0x44')][_0xe094('0x50')]+'%'};return _0x1987c0;}})});}_0x1f1ba4=_[_0xe094('0x51')]({},_0x1f1ba4,_0x1f0843['options']);var _0x2fc806={'where':_0x1f1ba4[_0xe094('0x4e')]};return db[_0xe094('0x41')][_0xe094('0x54')](_0x2fc806)[_0xe094('0x24')](function(_0x30444c){_0x422f67[_0xe094('0x54')]=_0x30444c;if(_0x1f0843[_0xe094('0x44')][_0xe094('0x55')]){_0x1f1ba4['include']=[{'all':!![]}];}return db[_0xe094('0x41')][_0xe094('0x56')](_0x1f1ba4);})[_0xe094('0x24')](function(_0xb069a3){_0x422f67['rows']=_0xb069a3;return _0x422f67;})[_0xe094('0x24')](respondWithFilteredResult(_0x5755f0,_0x1f1ba4))[_0xe094('0x57')](handleError(_0x5755f0,null));};exports[_0xe094('0x58')]=function(_0x11f3d1,_0x35a66a){var _0x2e9ca1={'raw':![],'where':{'id':_0x11f3d1[_0xe094('0x59')]['id']},'include':[{'model':db[_0xe094('0x3f')],'as':_0xe094('0x40')}]},_0x127d39={};_0x127d39['model']=_[_0xe094('0x45')](db[_0xe094('0x41')][_0xe094('0x5a')]);_0x127d39[_0xe094('0x44')]=_[_0xe094('0x45')](_0x11f3d1[_0xe094('0x44')]);_0x127d39[_0xe094('0x5b')]=_[_0xe094('0x46')](_0x127d39[_0xe094('0x43')],_0x127d39[_0xe094('0x44')]);_0x2e9ca1['attributes']=_[_0xe094('0x46')](_0x127d39['model'],qs[_0xe094('0x47')](_0x11f3d1[_0xe094('0x44')][_0xe094('0x47')]));_0x2e9ca1[_0xe094('0x48')]=_0x2e9ca1[_0xe094('0x48')][_0xe094('0x49')]?_0x2e9ca1[_0xe094('0x48')]:_0x127d39[_0xe094('0x43')];if(_0x11f3d1['query'][_0xe094('0x55')]){_0x2e9ca1[_0xe094('0x5c')]=[{'all':!![]}];}_0x2e9ca1=_[_0xe094('0x51')]({},_0x2e9ca1,_0x11f3d1[_0xe094('0x5d')]);return db[_0xe094('0x41')][_0xe094('0x5e')](_0x2e9ca1)[_0xe094('0x24')](handleEntityNotFound(_0x35a66a,null))[_0xe094('0x24')](respondWithResult(_0x35a66a,null))[_0xe094('0x57')](handleError(_0x35a66a,null));};exports['create']=function(_0x5f4de7,_0x5ccae4){return db[_0xe094('0x41')]['create'](_0x5f4de7['body'],{})['then'](function(_0xbfe4de){var _0x1c754a=_0x5f4de7[_0xe094('0x5f')][_0xe094('0x60')]({'plain':!![]});if(!_0x1c754a)throw new Error(_0xe094('0x61'));if(_0x1c754a['role']===_0xe094('0x5f')){var _0x49c259=_0xbfe4de[_0xe094('0x60')]({'plain':!![]});var _0x58f7df=_0xe094('0x39');return db[_0xe094('0x62')][_0xe094('0x5e')]({'where':{'name':_0x58f7df,'userProfileId':_0x1c754a[_0xe094('0x63')]},'raw':!![]})[_0xe094('0x24')](function(_0x38dee6){if(_0x38dee6&&_0x38dee6[_0xe094('0x64')]===0x0){return db[_0xe094('0x3a')]['create']({'name':_0x49c259[_0xe094('0x3d')],'resourceId':_0x49c259['id'],'type':_0x38dee6[_0xe094('0x3d')],'sectionId':_0x38dee6['id']},{})['then'](function(){return _0xbfe4de;});}else{return _0xbfe4de;}})[_0xe094('0x57')](function(_0x305463){logger[_0xe094('0x2c')](_0xe094('0x65'),_0x305463);throw _0x305463;});}return _0xbfe4de;})['then'](respondWithResult(_0x5ccae4,0xc9))[_0xe094('0x57')](handleError(_0x5ccae4,null));};exports[_0xe094('0x66')]=function(_0x199cd6,_0x801c0d){if(_0x199cd6['body']['id']){delete _0x199cd6[_0xe094('0x67')]['id'];}return db[_0xe094('0x41')]['find']({'where':{'id':_0x199cd6[_0xe094('0x59')]['id']},'include':[{'model':db[_0xe094('0x3f')],'as':_0xe094('0x40')}]})['then'](handleEntityNotFound(_0x801c0d,null))['then'](saveUpdates(_0x199cd6[_0xe094('0x67')],null))['then'](respondWithResult(_0x801c0d,null))['catch'](handleError(_0x801c0d,null));};exports['destroy']=function(_0x478fee,_0x51e53f){return db[_0xe094('0x41')][_0xe094('0x5e')]({'where':{'id':_0x478fee[_0xe094('0x59')]['id']}})[_0xe094('0x24')](handleEntityNotFound(_0x51e53f,null))[_0xe094('0x24')](removeEntity(_0x51e53f,null))[_0xe094('0x57')](handleError(_0x51e53f,null));};exports[_0xe094('0x68')]=function(_0x5b6ad3,_0x11d654){return db[_0xe094('0x41')][_0xe094('0x68')]()[_0xe094('0x24')](respondWithResult(_0x11d654,null))[_0xe094('0x57')](handleError(_0x11d654,null));};exports['addDisposition']=function(_0x11a298,_0x2f59f1,_0xf3d2f){if(_0x11a298[_0xe094('0x67')]['id']){delete _0x11a298[_0xe094('0x67')]['id'];}return db[_0xe094('0x41')][_0xe094('0x5e')]({'where':{'id':_0x11a298[_0xe094('0x59')]['id']}})[_0xe094('0x24')](handleEntityNotFound(_0x2f59f1,null))[_0xe094('0x24')](function(_0x2cc298){if(_0x2cc298){_0x11a298['body'][_0xe094('0x69')]=_0x2cc298['id'];return db[_0xe094('0x6a')][_0xe094('0x6b')](_0x11a298[_0xe094('0x67')]);}})[_0xe094('0x24')](respondWithResult(_0x2f59f1,null))[_0xe094('0x57')](handleError(_0x2f59f1,null));};exports[_0xe094('0x6c')]=function(_0xeea9cb,_0x455896,_0xfcde90){var _0x2a0664={'raw':![],'where':{}};var _0x2b696a={};var _0x5c03a4={'count':0x0,'rows':[]};return db[_0xe094('0x41')][_0xe094('0x6d')]({'where':{'id':_0xeea9cb[_0xe094('0x59')]['id']}})['then'](handleEntityNotFound(_0x455896,null))[_0xe094('0x24')](function(_0x365062){if(_0x365062){_0x2b696a[_0xe094('0x43')]=_[_0xe094('0x45')](db[_0xe094('0x6a')][_0xe094('0x5a')]);_0x2b696a['query']=_['keys'](_0xeea9cb[_0xe094('0x44')]);_0x2b696a[_0xe094('0x5b')]=_[_0xe094('0x46')](_0x2b696a[_0xe094('0x43')],_0x2b696a[_0xe094('0x44')]);_0x2a0664[_0xe094('0x48')]=_[_0xe094('0x46')](_0x2b696a['model'],qs['fields'](_0xeea9cb[_0xe094('0x44')]['fields']));_0x2a0664[_0xe094('0x48')]=_0x2a0664[_0xe094('0x48')][_0xe094('0x49')]?_0x2a0664[_0xe094('0x48')]:_0x2b696a[_0xe094('0x43')];if(!_0xeea9cb[_0xe094('0x44')][_0xe094('0x4a')]('nolimit')){_0x2a0664['limit']=qs[_0xe094('0x33')](_0xeea9cb[_0xe094('0x44')][_0xe094('0x33')]);_0x2a0664[_0xe094('0x32')]=qs[_0xe094('0x32')](_0xeea9cb[_0xe094('0x44')][_0xe094('0x32')]);}_0x2a0664[_0xe094('0x4c')]=qs[_0xe094('0x4d')](_0xeea9cb[_0xe094('0x44')][_0xe094('0x4d')]);_0x2a0664['where']=qs[_0xe094('0x5b')](_[_0xe094('0x4f')](_0xeea9cb['query'],_0x2b696a[_0xe094('0x5b')]));_0x2a0664['where'][_0xe094('0x69')]=_0x365062['id'];if(_0xeea9cb[_0xe094('0x44')][_0xe094('0x50')]){_0x2a0664['where']=_['merge'](_0x2a0664[_0xe094('0x4e')],{'$or':_[_0xe094('0x6e')](_0x2a0664[_0xe094('0x48')],function(_0x2926e0){var _0xcd42c7={};_0xcd42c7[_0x2926e0]={'$like':'%'+_0xeea9cb[_0xe094('0x44')][_0xe094('0x50')]+'%'};return _0xcd42c7;})});}_0x2a0664=_[_0xe094('0x51')]({},_0x2a0664,_0xeea9cb[_0xe094('0x5d')]);return db['Disposition']['count']({'where':_0x2a0664[_0xe094('0x4e')]})[_0xe094('0x24')](function(_0x2ee411){_0x5c03a4[_0xe094('0x54')]=_0x2ee411;if(_0xeea9cb['query'][_0xe094('0x55')]){_0x2a0664[_0xe094('0x5c')]=[{'all':!![]}];}return db['Disposition'][_0xe094('0x56')](_0x2a0664);})[_0xe094('0x24')](function(_0x55f87b){_0x5c03a4[_0xe094('0x6f')]=_0x55f87b;return _0x5c03a4;});}})[_0xe094('0x24')](respondWithFilteredResult(_0x455896,_0x2a0664))['catch'](handleError(_0x455896,null));};exports['removeDispositions']=function(_0x255ea5,_0x30e6c7,_0x5332e1){return db[_0xe094('0x41')][_0xe094('0x5e')]({'where':{'id':_0x255ea5[_0xe094('0x59')]['id']}})[_0xe094('0x24')](handleEntityNotFound(_0x30e6c7,null))['then'](function(_0x45911a){if(_0x45911a){return _0x45911a[_0xe094('0x70')](_0x255ea5[_0xe094('0x44')][_0xe094('0x71')]);}})[_0xe094('0x24')](respondWithStatusCode(_0x30e6c7,null))[_0xe094('0x57')](handleError(_0x30e6c7,null));};exports['addAnswer']=function(_0x5a9845,_0x304ac6,_0x384187){if(_0x5a9845[_0xe094('0x67')]['id']){delete _0x5a9845[_0xe094('0x67')]['id'];}return db[_0xe094('0x41')][_0xe094('0x5e')]({'where':{'id':_0x5a9845[_0xe094('0x59')]['id']}})[_0xe094('0x24')](handleEntityNotFound(_0x304ac6,null))['then'](function(_0x3da9eb){if(_0x3da9eb){_0x5a9845['body'][_0xe094('0x69')]=_0x3da9eb['id'];return db[_0xe094('0x72')]['create'](_0x5a9845[_0xe094('0x67')]);}})[_0xe094('0x24')](respondWithResult(_0x304ac6,null))[_0xe094('0x57')](handleError(_0x304ac6,null));};exports['getAnswers']=function(_0x157225,_0x3b918a,_0xee4480){var _0x537a35={'raw':![],'where':{}};var _0x107156={};var _0x534cb1={'count':0x0,'rows':[]};return db['FaxAccount'][_0xe094('0x6d')]({'where':{'id':_0x157225['params']['id']}})['then'](handleEntityNotFound(_0x3b918a,null))[_0xe094('0x24')](function(_0x4e2aa7){if(_0x4e2aa7){_0x107156[_0xe094('0x43')]=_[_0xe094('0x45')](db['CannedAnswer'][_0xe094('0x5a')]);_0x107156[_0xe094('0x44')]=_[_0xe094('0x45')](_0x157225[_0xe094('0x44')]);_0x107156['filters']=_[_0xe094('0x46')](_0x107156[_0xe094('0x43')],_0x107156['query']);_0x537a35[_0xe094('0x48')]=_[_0xe094('0x46')](_0x107156[_0xe094('0x43')],qs[_0xe094('0x47')](_0x157225[_0xe094('0x44')][_0xe094('0x47')]));_0x537a35['attributes']=_0x537a35[_0xe094('0x48')][_0xe094('0x49')]?_0x537a35[_0xe094('0x48')]:_0x107156[_0xe094('0x43')];if(!_0x157225[_0xe094('0x44')][_0xe094('0x4a')]('nolimit')){_0x537a35[_0xe094('0x33')]=qs['limit'](_0x157225[_0xe094('0x44')]['limit']);_0x537a35[_0xe094('0x32')]=qs[_0xe094('0x32')](_0x157225[_0xe094('0x44')][_0xe094('0x32')]);}_0x537a35['order']=qs['sort'](_0x157225[_0xe094('0x44')][_0xe094('0x4d')]);_0x537a35[_0xe094('0x4e')]=qs[_0xe094('0x5b')](_[_0xe094('0x4f')](_0x157225[_0xe094('0x44')],_0x107156[_0xe094('0x5b')]));_0x537a35[_0xe094('0x4e')]['FaxAccountId']=_0x4e2aa7['id'];if(_0x157225[_0xe094('0x44')][_0xe094('0x50')]){_0x537a35[_0xe094('0x4e')]=_[_0xe094('0x51')](_0x537a35[_0xe094('0x4e')],{'$or':_[_0xe094('0x6e')](_0x537a35[_0xe094('0x48')],function(_0x5b5192){var _0x541ca9={};_0x541ca9[_0x5b5192]={'$like':'%'+_0x157225[_0xe094('0x44')][_0xe094('0x50')]+'%'};return _0x541ca9;})});}_0x537a35=_[_0xe094('0x51')]({},_0x537a35,_0x157225['options']);return db[_0xe094('0x72')][_0xe094('0x54')]({'where':_0x537a35[_0xe094('0x4e')]})[_0xe094('0x24')](function(_0x1c0e76){_0x534cb1[_0xe094('0x54')]=_0x1c0e76;if(_0x157225[_0xe094('0x44')][_0xe094('0x55')]){_0x537a35[_0xe094('0x5c')]=[{'all':!![]}];}return db['CannedAnswer'][_0xe094('0x56')](_0x537a35);})[_0xe094('0x24')](function(_0x536c78){_0x534cb1['rows']=_0x536c78;return _0x534cb1;});}})[_0xe094('0x24')](respondWithFilteredResult(_0x3b918a,_0x537a35))['catch'](handleError(_0x3b918a,null));};exports[_0xe094('0x73')]=function(_0x467ae1,_0x590ef6,_0x275d16){return db[_0xe094('0x41')][_0xe094('0x5e')]({'where':{'id':_0x467ae1['params']['id']}})[_0xe094('0x24')](handleEntityNotFound(_0x590ef6,null))[_0xe094('0x24')](function(_0x5a22bc){if(_0x5a22bc){return _0x5a22bc[_0xe094('0x73')](_0x467ae1[_0xe094('0x44')][_0xe094('0x71')]);}})[_0xe094('0x24')](respondWithStatusCode(_0x590ef6,null))[_0xe094('0x57')](handleError(_0x590ef6,null));};exports[_0xe094('0x74')]=function(_0x2f8e6f,_0x2655bc,_0x377676){return db[_0xe094('0x75')][_0xe094('0x5e')]({'where':{'id':_0x2f8e6f[_0xe094('0x59')]['id']}})[_0xe094('0x24')](handleEntityNotFound(_0x2655bc,null))[_0xe094('0x24')](function(_0x3bd157){if(_0x3bd157){return _0x3bd157[_0xe094('0x74')](_0x2f8e6f[_0xe094('0x67')]['ids'],_[_0xe094('0x76')](_0x2f8e6f['body'],[_0xe094('0x71'),'id'])||{});}})['then'](respondWithResult(_0x2655bc,null))['catch'](handleError(_0x2655bc,null));};exports[_0xe094('0x77')]=function(_0x113037,_0x5b0faa,_0x1de96b){var _0x51b3ec={'raw':![],'where':{}};var _0xbf606d={};var _0x2fc103={'count':0x0,'rows':[]};return db['FaxAccount'][_0xe094('0x6d')]({'where':{'id':_0x113037['params']['id']}})[_0xe094('0x24')](handleEntityNotFound(_0x5b0faa,null))[_0xe094('0x24')](function(_0x4466ff){if(_0x4466ff){_0xbf606d[_0xe094('0x43')]=_['keys'](db[_0xe094('0x75')][_0xe094('0x5a')]);_0xbf606d[_0xe094('0x44')]=_[_0xe094('0x45')](_0x113037[_0xe094('0x44')]);_0xbf606d[_0xe094('0x5b')]=_[_0xe094('0x46')](_0xbf606d['model'],_0xbf606d[_0xe094('0x44')]);_0x51b3ec[_0xe094('0x48')]=_[_0xe094('0x46')](_0xbf606d[_0xe094('0x43')],qs[_0xe094('0x47')](_0x113037[_0xe094('0x44')][_0xe094('0x47')]));_0x51b3ec[_0xe094('0x48')]=_0x51b3ec[_0xe094('0x48')][_0xe094('0x49')]?_0x51b3ec[_0xe094('0x48')]:_0xbf606d[_0xe094('0x43')];if(!_0x113037[_0xe094('0x44')][_0xe094('0x4a')](_0xe094('0x4b'))){_0x51b3ec[_0xe094('0x33')]=qs[_0xe094('0x33')](_0x113037[_0xe094('0x44')]['limit']);_0x51b3ec[_0xe094('0x32')]=qs[_0xe094('0x32')](_0x113037['query']['offset']);}_0x51b3ec['order']=qs[_0xe094('0x4d')](_0x113037['query'][_0xe094('0x4d')]);_0x51b3ec[_0xe094('0x4e')]=qs['filters'](_[_0xe094('0x4f')](_0x113037[_0xe094('0x44')],_0xbf606d[_0xe094('0x5b')]));_0x51b3ec['where'][_0xe094('0x69')]=_0x4466ff['id'];if(_0x113037[_0xe094('0x44')]['filter']){_0x51b3ec[_0xe094('0x4e')]=_[_0xe094('0x51')](_0x51b3ec['where'],{'$or':_[_0xe094('0x6e')](_0x51b3ec[_0xe094('0x48')],function(_0x1f8e7c){var _0x30f1d2={};_0x30f1d2[_0x1f8e7c]={'$like':'%'+_0x113037[_0xe094('0x44')][_0xe094('0x50')]+'%'};return _0x30f1d2;})});}_0x51b3ec=_[_0xe094('0x51')]({},_0x51b3ec,_0x113037[_0xe094('0x5d')]);return db[_0xe094('0x75')]['count']({'where':_0x51b3ec['where']})['then'](function(_0x50dfa1){_0x2fc103[_0xe094('0x54')]=_0x50dfa1;if(_0x113037[_0xe094('0x44')][_0xe094('0x55')]){_0x51b3ec['include']=[{'model':db[_0xe094('0x78')],'as':_0xe094('0x79'),'required':![]},{'model':db['User'],'as':_0xe094('0x7a'),'attributes':[_0xe094('0x3d'),_0xe094('0x7b'),_0xe094('0x7c')],'required':![]},{'model':db[_0xe094('0x7d')],'as':_0xe094('0x7e'),'attributes':['id','name',_0xe094('0x7f')],'where':_0x113037[_0xe094('0x44')][_0xe094('0x80')]?{'id':_0x113037[_0xe094('0x44')][_0xe094('0x80')]}:undefined,'required':_0x113037[_0xe094('0x44')][_0xe094('0x80')]?!![]:![]}];}return db[_0xe094('0x75')][_0xe094('0x56')](_0x51b3ec);})['then'](function(_0x4335a0){_0x2fc103[_0xe094('0x6f')]=_0x4335a0;return _0x2fc103;});}})[_0xe094('0x24')](respondWithFilteredResult(_0x5b0faa,_0x51b3ec))[_0xe094('0x57')](handleError(_0x5b0faa,null));};exports[_0xe094('0x81')]=function(_0x256a0a,_0x31c436,_0x8af5a6){return db[_0xe094('0x41')][_0xe094('0x6d')]({'where':{'id':_0x256a0a[_0xe094('0x59')]['id']}})[_0xe094('0x24')](handleEntityNotFound(_0x31c436,null))[_0xe094('0x24')](function(_0x39908f){if(_0x39908f){return db[_0xe094('0x82')][_0xe094('0x83')](function(_0x18c875){return db['FaxApplication'][_0xe094('0x38')]({'where':{'FaxAccountId':_0x256a0a[_0xe094('0x59')]['id']},'transaction':_0x18c875})['then'](function(_0x2346c6){var _0x475cd5=_[_0xe094('0x6e')](_0x256a0a[_0xe094('0x67')],function(_0x433e8c){_0x433e8c['FaxAccountId']=_0x256a0a[_0xe094('0x59')]['id'];return _0x433e8c;});return db[_0xe094('0x84')][_0xe094('0x85')](_0x475cd5,{'transaction':_0x18c875});});})[_0xe094('0x24')](function(){return db['FaxApplication'][_0xe094('0x86')]({'where':{'FaxAccountId':_0x256a0a[_0xe094('0x59')]['id']},'order':'priority'});});}})[_0xe094('0x24')](respondWithResult(_0x31c436,null))[_0xe094('0x57')](handleError(_0x31c436,null));};exports[_0xe094('0x87')]=function(_0xfdc422,_0x70d50,_0xfabb36){var _0x508d12={};var _0x38089d={};var _0x434668;var _0xb4bc4c;return db[_0xe094('0x41')]['findOne']({'where':{'id':_0xfdc422[_0xe094('0x59')]['id']}})[_0xe094('0x24')](handleEntityNotFound(_0x70d50,null))['then'](function(_0x76ec0b){if(_0x76ec0b){_0x434668=_0x76ec0b;_0x38089d['model']=_[_0xe094('0x45')](db[_0xe094('0x84')][_0xe094('0x5a')]);_0x38089d[_0xe094('0x44')]=_[_0xe094('0x45')](_0xfdc422[_0xe094('0x44')]);_0x38089d[_0xe094('0x5b')]=_[_0xe094('0x46')](_0x38089d['model'],_0x38089d[_0xe094('0x44')]);_0x508d12[_0xe094('0x48')]=_['intersection'](_0x38089d['model'],qs['fields'](_0xfdc422[_0xe094('0x44')][_0xe094('0x47')]));_0x508d12[_0xe094('0x48')]=_0x508d12['attributes'][_0xe094('0x49')]?_0x508d12[_0xe094('0x48')]:_0x38089d[_0xe094('0x43')];_0x508d12[_0xe094('0x4c')]=qs[_0xe094('0x4d')](_0xfdc422[_0xe094('0x44')][_0xe094('0x4d')]);_0x508d12[_0xe094('0x4e')]=qs[_0xe094('0x5b')](_[_0xe094('0x4f')](_0xfdc422[_0xe094('0x44')],_0x38089d[_0xe094('0x5b')]));if(_0xfdc422['query'][_0xe094('0x50')]){_0x508d12['where']=_[_0xe094('0x51')](_0x508d12[_0xe094('0x4e')],{'$or':_[_0xe094('0x6e')](_0x508d12[_0xe094('0x48')],function(_0x1bb4bc){var _0x46995a={};_0x46995a[_0x1bb4bc]={'$like':'%'+_0xfdc422[_0xe094('0x44')]['filter']+'%'};return _0x46995a;})});}_0x508d12=_['merge']({},_0x508d12,_0xfdc422['options']);return _0x434668[_0xe094('0x87')](_0x508d12);}})[_0xe094('0x24')](function(_0x563522){if(_0x563522){_0xb4bc4c=_0x563522['length'];if(!_0xfdc422[_0xe094('0x44')][_0xe094('0x4a')](_0xe094('0x4b'))){_0x508d12['limit']=qs[_0xe094('0x33')](_0xfdc422[_0xe094('0x44')][_0xe094('0x33')]);_0x508d12[_0xe094('0x32')]=qs['offset'](_0xfdc422['query'][_0xe094('0x32')]);}return _0x434668[_0xe094('0x87')](_0x508d12);}})[_0xe094('0x24')](function(_0x229866){if(_0x229866){return _0x229866?{'count':_0xb4bc4c,'rows':_0x229866}:null;}})[_0xe094('0x24')](respondWithResult(_0x70d50,null))[_0xe094('0x57')](handleError(_0x70d50,null));};function Extension(_0x287936,_0x2fbd42,_0xaa8526,_0x1eec74){this[_0xe094('0x88')]='from-voip-provider';this[_0xe094('0x89')]=_0x287936['localstationid'];this[_0xe094('0x8a')]=_0x1eec74;this[_0xe094('0x52')]=_0xe094('0x8b');this[_0xe094('0x8c')]=_0xe094('0x8d');this[_0xe094('0x69')]=_0x287936['id'];this[_0xe094('0x8e')]=_0x2fbd42;this[_0xe094('0x8f')]=_0xaa8526;}function createExtensionsReciveFax(_0x105fbe){var _0x577c2e=0x1;var _0x167e18=[];_0x167e18[_0xe094('0x90')](new Extension(_0x105fbe,_0x577c2e,'',_0xe094('0x91')));_0x577c2e+=0x1;_0x167e18[_0xe094('0x90')](new Extension(_0x105fbe,_0x577c2e,_0xe094('0x92'),_0xe094('0x93')));_0x577c2e+=0x1;for(var _0x57e452 in _0x105fbe){if(_0x105fbe[_0xe094('0x4a')](_0x57e452)&&(_0x57e452===_0xe094('0x94')||_0x57e452===_0xe094('0x95')||_0x57e452===_0xe094('0x96')||_0x57e452===_0xe094('0x97')||_0x57e452==='headerinfo'||_0x57e452===_0xe094('0x98')||_0x57e452==='minrate'||_0x57e452===_0xe094('0x99')||_0x57e452==='t38timeout')){_0x167e18[_0xe094('0x90')](new Extension(_0x105fbe,_0x577c2e,_0xe094('0x9a')+_0x57e452+')='+_0x105fbe[_0x57e452],_0xe094('0x93')));_0x577c2e+=0x1;}}_0x167e18[_0xe094('0x90')](new Extension(_0x105fbe,_0x577c2e,'6',_0xe094('0x9b')));_0x577c2e+=0x1;_0x167e18[_0xe094('0x90')](new Extension(_0x105fbe,_0x577c2e,'/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',_0xe094('0x9c')));_0x577c2e=0x0;return _0x167e18;}exports['addAccountApplications']=function(_0x3e6b60,_0x237b85,_0x5c3026){var _0x51557c;return db['sequelize']['transaction'](function(_0x589c74){return db[_0xe094('0x41')][_0xe094('0x6b')](_0x3e6b60[_0xe094('0x67')],{'transaction':_0x589c74})[_0xe094('0x24')](function(_0x22b056){_0x51557c=_0x22b056[_0xe094('0x60')]({'plain':!![]});return db[_0xe094('0x9d')]['bulkCreate'](createExtensionsReciveFax(_0x51557c),{'transaction':_0x589c74});});})[_0xe094('0x24')](function(){return _0x51557c;})[_0xe094('0x24')](respondWithResult(_0x237b85,null))[_0xe094('0x57')](handleError(_0x237b85,null));};exports[_0xe094('0x9e')]=function(_0x4990e2,_0xc64403,_0x281bab){var _0x241eb7;return db[_0xe094('0x82')][_0xe094('0x83')](function(_0x3cdd6a){return db['FaxAccount']['update'](_0x4990e2[_0xe094('0x67')],{'where':{'id':_0x4990e2[_0xe094('0x67')]['id']},'transaction':_0x3cdd6a})['then'](function(_0x2ba227){return db[_0xe094('0x9d')][_0xe094('0x38')]({'where':{'FaxAccountId':_0x4990e2[_0xe094('0x67')]['id']},'transaction':_0x3cdd6a})[_0xe094('0x24')](function(_0x358e79){return db[_0xe094('0x9d')][_0xe094('0x85')](createExtensionsReciveFax(_['omit'](_0x4990e2[_0xe094('0x67')],[_0xe094('0x9f'),'key','createdAt','updatedAt',_0xe094('0xa0'),_0xe094('0xa1')])),{'transaction':_0x3cdd6a});});});})[_0xe094('0x24')](function(){return db[_0xe094('0x41')]['findById'](_0x4990e2['body']['id']);})['then'](respondWithResult(_0xc64403,null))[_0xe094('0x57')](handleError(_0xc64403,null));};exports['getMessages']=function(_0x4d72ac,_0x42a789,_0x421628){var _0x35300f={'raw':!![],'where':{}};var _0x9c3ba7={};var _0x602023={'count':0x0,'rows':[]};return db[_0xe094('0x41')]['findOne']({'where':{'id':_0x4d72ac['params']['id']}})[_0xe094('0x24')](handleEntityNotFound(_0x42a789,null))[_0xe094('0x24')](function(_0x45fd9b){if(_0x45fd9b){_0x9c3ba7[_0xe094('0x43')]=_['keys'](db['FaxMessage'][_0xe094('0x5a')]);_0x9c3ba7['query']=_[_0xe094('0x45')](_0x4d72ac[_0xe094('0x44')]);_0x9c3ba7[_0xe094('0x5b')]=_[_0xe094('0x46')](_0x9c3ba7[_0xe094('0x43')],_0x9c3ba7['query']);_0x35300f[_0xe094('0x48')]=_[_0xe094('0x46')](_0x9c3ba7['model'],qs[_0xe094('0x47')](_0x4d72ac[_0xe094('0x44')][_0xe094('0x47')]));_0x35300f[_0xe094('0x48')]=_0x35300f[_0xe094('0x48')]['length']?_0x35300f[_0xe094('0x48')]:_0x9c3ba7['model'];if(!_0x4d72ac[_0xe094('0x44')]['hasOwnProperty'](_0xe094('0x4b'))){_0x35300f[_0xe094('0x33')]=qs[_0xe094('0x33')](_0x4d72ac[_0xe094('0x44')]['limit']);_0x35300f['offset']=qs[_0xe094('0x32')](_0x4d72ac[_0xe094('0x44')][_0xe094('0x32')]);}_0x35300f[_0xe094('0x4c')]=qs['sort'](_0x4d72ac[_0xe094('0x44')][_0xe094('0x4d')]);_0x35300f[_0xe094('0x4e')]=qs['filters'](_['pick'](_0x4d72ac[_0xe094('0x44')],_0x9c3ba7['filters']));_0x35300f['where'][_0xe094('0x69')]=_0x45fd9b['id'];if(_0x4d72ac['query'][_0xe094('0x50')]){_0x35300f[_0xe094('0x4e')]=_[_0xe094('0x51')](_0x35300f[_0xe094('0x4e')],{'$or':_[_0xe094('0x6e')](_0x35300f[_0xe094('0x48')],function(_0x2aa92c){var _0x1a360a={};_0x1a360a[_0x2aa92c]={'$like':'%'+_0x4d72ac['query']['filter']+'%'};return _0x1a360a;})});}if(_0x4d72ac[_0xe094('0x44')][_0xe094('0xa2')]){var _0x373cff=_0x4d72ac[_0xe094('0x44')][_0xe094('0xa2')][_0xe094('0xa3')](',');var _0x265f2d={};_0x265f2d[_0x373cff[0x0]]={'$gte':moment(_0x373cff[0x1])[_0xe094('0xa4')](_0xe094('0xa5'))};_0x35300f[_0xe094('0x4e')]=_[_0xe094('0x51')](_0x35300f['where'],_0x265f2d);}_0x35300f=_[_0xe094('0x51')]({},_0x35300f,_0x4d72ac[_0xe094('0x5d')]);return db['FaxMessage'][_0xe094('0x54')]({'where':_0x35300f['where']})[_0xe094('0x24')](function(_0x37a052){_0x602023['count']=_0x37a052;if(_0x4d72ac['query'][_0xe094('0x55')]){_0x35300f[_0xe094('0x5c')]=[{'all':!![]}];}return db['FaxMessage'][_0xe094('0x56')](_0x35300f);})[_0xe094('0x24')](function(_0x177b2b){_0x602023[_0xe094('0x6f')]=_0x177b2b;return _0x602023;});}})[_0xe094('0x24')](respondWithFilteredResult(_0x42a789,_0x35300f))[_0xe094('0x57')](handleError(_0x42a789,null));};exports[_0xe094('0x3e')]=function(_0x2d9086,_0x476583,_0x3e2810){var _0x27494a,_0x26c53a={},_0x1a7570;if(_0x2d9086[_0xe094('0x67')]['to']){_0x1a7570=_0x2d9086[_0xe094('0x67')]['to'][0x0];}return db[_0xe094('0x41')][_0xe094('0x5e')]({'where':{'id':_0x2d9086[_0xe094('0x59')]['id']},'include':[{'model':db[_0xe094('0xa6')],'as':'List','include':[{'model':db[_0xe094('0x78')],'as':_0xe094('0xa7'),'where':{'fax':_0x1a7570},'limit':0x1,'order':[[_0xe094('0xa8'),_0xe094('0xa9')]]}]}]})[_0xe094('0x24')](handleEntityNotFound(_0x476583,null))['then'](function(_0x2d5c19){_0x27494a=_0x2d5c19;if(_0x2d9086[_0xe094('0x67')][_0xe094('0xaa')]&&_0x2d9086[_0xe094('0x67')]['attachments'][_0xe094('0x49')]){for(var _0x2f164c=0x0;_0x2f164c<_0x2d9086[_0xe094('0x67')][_0xe094('0xaa')][_0xe094('0x49')];_0x2f164c+=0x1){_0x2d9086[_0xe094('0x67')][_0xe094('0xaa')][_0x2f164c]={'filename':_0x2d9086[_0xe094('0x67')][_0xe094('0xaa')][_0x2f164c][_0xe094('0x3d')],'id':_0x2d9086[_0xe094('0x67')][_0xe094('0xaa')][_0x2f164c]['id'],'path':path[_0xe094('0xab')](config[_0xe094('0xac')],_0xe094('0xad'),_0x2d9086[_0xe094('0x67')][_0xe094('0xaa')][_0x2f164c][_0xe094('0xae')])};}}return respondWithRpcPromise(_0xe094('0xaf'),_0xe094('0xaf'),{'FaxAccountId':_[_0xe094('0xb0')](_0x2d9086[_0xe094('0x59')]['id'])?undefined:_0x2d9086[_0xe094('0x59')]['id'],'path':_[_0xe094('0xb0')](_0x2d9086['body'][_0xe094('0xaa')][0x0][_0xe094('0x7')])?undefined:_0x2d9086[_0xe094('0x67')][_0xe094('0xaa')][0x0][_0xe094('0x7')],'fax':_[_0xe094('0xb0')](_0x2d9086['body']['to'][0x0])?undefined:_0x2d9086[_0xe094('0x67')]['to'][0x0]},client9002);})[_0xe094('0x24')](function(){if(_0x27494a){if(_[_0xe094('0xb0')](_0x2d9086[_0xe094('0x67')]['from'])){_0x2d9086[_0xe094('0x67')]['from']=util[_0xe094('0xa4')](_0xe094('0xb1'),_0x27494a['name'],_0x27494a[_0xe094('0xb2')]);}if(_0x27494a[_0xe094('0xb3')]){if(_0x27494a['List'][_0xe094('0xa7')][_0xe094('0x49')]){return _0x27494a[_0xe094('0xb3')][_0xe094('0xa7')][0x0];}else{return db[_0xe094('0x78')][_0xe094('0x6b')](_[_0xe094('0x18')](_0x2d9086[_0xe094('0x67')],{'firstName':_0x2d9086[_0xe094('0x67')]['to'][0x0],'phone':_0x2d9086[_0xe094('0x67')]['to'][0x0],'fax':_0x2d9086['body']['to'][0x0],'ListId':_0x27494a[_0xe094('0xa1')]}));}}else{throw new Error(_0xe094('0xb4'));}}else{throw new Error(_0xe094('0xb5'));}})['then'](function(_0xbcca88){if(_0xbcca88){return db[_0xe094('0x75')]['find']({'where':{'ContactId':_0xbcca88['id'],'closed':![],'FaxAccountId':_0x27494a['id']}})[_0xe094('0x24')](function(_0x56b1b1){if(_0x56b1b1){return[_0x56b1b1,![]];}return db[_0xe094('0x75')][_0xe094('0x6b')]({'UserId':_0x2d9086[_0xe094('0x5f')]['id'],'ContactId':_0xbcca88['id'],'FaxAccountId':_0x27494a['id'],'fax':_0x2d9086[_0xe094('0x67')]['to'][0x0],'firstMsgDirection':_0xe094('0xb6'),'Messages':[_['merge'](_0x2d9086['body'],{'read':![],'body':_0x2d9086[_0xe094('0x67')][_0xe094('0xaa')][0x0][_0xe094('0xb7')],'FaxAccountId':_0x27494a['id'],'UserId':_0x2d9086[_0xe094('0x5f')]['id'],'ContactId':_0xbcca88['id'],'AttachmentId':_0x2d9086['body'][_0xe094('0xaa')][0x0]['id']})]},{'include':[{'model':db[_0xe094('0xb8')],'as':'Messages'}]})[_0xe094('0x24')](function(_0x309449){return[_0x309449,!![]];});});}else{throw new Error(_0xe094('0xb9'));}})[_0xe094('0xba')](function(_0x54cdc0,_0x35c0c9){if(_0x35c0c9){return _0x54cdc0;}return db[_0xe094('0xb8')][_0xe094('0x6b')]({'direction':_0xe094('0xb6'),'read':![],'body':_0x2d9086['body'][_0xe094('0xaa')][0x0][_0xe094('0xb7')],'FaxAccountId':_0x27494a['id'],'FaxInteractionId':_0x54cdc0['id'],'UserId':_0x2d9086[_0xe094('0x5f')]['id'],'ContactId':_0x54cdc0[_0xe094('0xbb')],'AttachmentId':_0x2d9086['body'][_0xe094('0xaa')][0x0]['id']})['then'](function(_0x2e1cb5){_0x54cdc0[_0xe094('0xbc')][_0xe094('0xbd')]=[];_0x54cdc0['dataValues']['Messages'][_0xe094('0x90')](_0x2e1cb5[_0xe094('0xbc')]);return _0x54cdc0;});})['then'](function(_0x491c0a){respondWithRpcPromise(_0xe094('0xbe'),_0xe094('0xbe'),{'FaxAccountId':_['isNil'](_0x2d9086[_0xe094('0x59')]['id'])?undefined:_0x2d9086[_0xe094('0x59')]['id'],'path':_[_0xe094('0xb0')](_0x2d9086[_0xe094('0x67')][_0xe094('0xaa')][0x0][_0xe094('0x7')])?undefined:_0x2d9086[_0xe094('0x67')]['attachments'][0x0][_0xe094('0x7')],'fax':_['isNil'](_0x2d9086[_0xe094('0x67')]['to'][0x0])?undefined:_0x2d9086[_0xe094('0x67')]['to'][0x0],'AttachmentId':_0x2d9086['body'][_0xe094('0xaa')][0x0]['id']},client9002)[_0xe094('0x24')](function(_0x2ad463){logger[_0xe094('0x25')](_0xe094('0xbf'),_0x2ad463);})['catch'](function(_0x4ca6a0){logger[_0xe094('0x25')]('SendFaxRpc,\x20%s',_0x4ca6a0);});return _0x491c0a;})[_0xe094('0x24')](respondWithResult(_0x476583,null))[_0xe094('0x57')](handleError(_0x476583,null));};exports['addAgents']=function(_0x15f8dd,_0x43fdf7,_0x26da55){return db['FaxAccount'][_0xe094('0x5e')]({'where':{'id':_0x15f8dd[_0xe094('0x59')]['id']}})[_0xe094('0x24')](handleEntityNotFound(_0x43fdf7,null))[_0xe094('0x24')](function(_0x5081ed){if(_0x5081ed){return _0x5081ed[_0xe094('0xc0')](_0x15f8dd['body'][_0xe094('0x71')],_['omit'](_0x15f8dd['body'],['ids','id'])||{})[_0xe094('0xba')](function(_0xa3e69c){for(var _0x3dbe62=0x0;_0x3dbe62<_0x15f8dd[_0xe094('0x67')][_0xe094('0x71')][_0xe094('0x49')];_0x3dbe62+=0x1){socket[_0xe094('0xc1')](_0xe094('0xc2'),{'UserId':_0x15f8dd[_0xe094('0x67')]['ids'][_0x3dbe62],'FaxAccountId':_0x15f8dd[_0xe094('0x59')]['id']});}return _0xa3e69c;});}})[_0xe094('0x24')](respondWithResult(_0x43fdf7,null))[_0xe094('0x57')](handleError(_0x43fdf7,null));};exports[_0xe094('0xc3')]=function(_0x52209f,_0x224ed6,_0x332f79){return db[_0xe094('0x41')][_0xe094('0x5e')]({'where':{'id':_0x52209f[_0xe094('0x59')]['id']}})['then'](handleEntityNotFound(_0x224ed6,null))['then'](function(_0x4a711c){if(_0x4a711c){return _0x4a711c[_0xe094('0xc3')](_0x52209f[_0xe094('0x44')][_0xe094('0x71')])[_0xe094('0x24')](function(){if(_[_0xe094('0xc4')](_0x52209f[_0xe094('0x44')][_0xe094('0x71')])){for(var _0x2a232e=0x0;_0x2a232e<_0x52209f[_0xe094('0x44')][_0xe094('0x71')][_0xe094('0x49')];_0x2a232e+=0x1){socket['emit'](_0xe094('0xc5'),{'UserId':Number(_0x52209f['query'][_0xe094('0x71')][_0x2a232e]),'FaxAccountId':Number(_0x52209f[_0xe094('0x59')]['id'])});}}else{socket['emit'](_0xe094('0xc5'),{'UserId':Number(_0x52209f[_0xe094('0x44')][_0xe094('0x71')]),'FaxAccountId':Number(_0x52209f[_0xe094('0x59')]['id'])});}});}})['then'](respondWithStatusCode(_0x224ed6,null))[_0xe094('0x57')](handleError(_0x224ed6,null));};exports[_0xe094('0xc6')]=function(_0x22a0cd,_0x155f88,_0x583750){var _0x2e0ef5={};var _0xdb8b7d={};var _0x41b021;var _0xff4ee8;return db['FaxAccount'][_0xe094('0x6d')]({'where':{'id':_0x22a0cd[_0xe094('0x59')]['id']}})['then'](handleEntityNotFound(_0x155f88,null))[_0xe094('0x24')](function(_0x1e509c){if(_0x1e509c){_0x41b021=_0x1e509c;_0xdb8b7d[_0xe094('0x43')]=_[_0xe094('0x45')](db['User'][_0xe094('0x5a')]);_0xdb8b7d[_0xe094('0x44')]=_[_0xe094('0x45')](_0x22a0cd[_0xe094('0x44')]);_0xdb8b7d[_0xe094('0x5b')]=_[_0xe094('0x46')](_0xdb8b7d[_0xe094('0x43')],_0xdb8b7d[_0xe094('0x44')]);_0x2e0ef5[_0xe094('0x48')]=_['intersection'](_0xdb8b7d[_0xe094('0x43')],qs[_0xe094('0x47')](_0x22a0cd[_0xe094('0x44')][_0xe094('0x47')]));_0x2e0ef5['attributes']=_0x2e0ef5['attributes'][_0xe094('0x49')]?_0x2e0ef5[_0xe094('0x48')]:_0xdb8b7d[_0xe094('0x43')];_0x2e0ef5[_0xe094('0x4c')]=qs[_0xe094('0x4d')](_0x22a0cd[_0xe094('0x44')][_0xe094('0x4d')]);_0x2e0ef5['where']=qs['filters'](_['pick'](_0x22a0cd[_0xe094('0x44')],_0xdb8b7d['filters']));if(_0x22a0cd[_0xe094('0x44')]['filter']){_0x2e0ef5[_0xe094('0x4e')]=_['merge'](_0x2e0ef5[_0xe094('0x4e')],{'$or':_[_0xe094('0x6e')](_0x2e0ef5[_0xe094('0x48')],function(_0x271801){var _0x419891={};_0x419891[_0x271801]={'$like':'%'+_0x22a0cd[_0xe094('0x44')][_0xe094('0x50')]+'%'};return _0x419891;})});}_0x2e0ef5=_[_0xe094('0x51')]({},_0x2e0ef5,_0x22a0cd[_0xe094('0x5d')]);return _0x41b021[_0xe094('0xc6')](_0x2e0ef5);}})[_0xe094('0x24')](function(_0xd256d9){if(_0xd256d9){_0xff4ee8=_0xd256d9[_0xe094('0x49')];if(!_0x22a0cd[_0xe094('0x44')][_0xe094('0x4a')](_0xe094('0x4b'))){_0x2e0ef5[_0xe094('0x33')]=qs[_0xe094('0x33')](_0x22a0cd[_0xe094('0x44')][_0xe094('0x33')]);_0x2e0ef5[_0xe094('0x32')]=qs['offset'](_0x22a0cd[_0xe094('0x44')]['offset']);}return _0x41b021[_0xe094('0xc6')](_0x2e0ef5);}})['then'](function(_0x31f7fe){if(_0x31f7fe){return _0x31f7fe?{'count':_0xff4ee8,'rows':_0x31f7fe}:null;}})[_0xe094('0x24')](respondWithResult(_0x155f88,null))[_0xe094('0x57')](handleError(_0x155f88,null));}; \ No newline at end of file +var _0x29eb=['includeAll','removeDispositions','addAnswer','CannedAnswer','removeAnswers','ids','addInteraction','FaxInteraction','omit','getInteractions','CmContact','Contact','User','fullname','internal','Tag','Tags','color','tag','addApplications','FaxApplication','bulkCreate','priority','getApplications','context','exten','app','description','Fax\x20Extension','push','Answer','CDR(type)=inbound-fax','localstationid','gateway','faxdetect','headerinfo','maxrate','minrate','modem','t38timeout','Set','Wait','/var/opt/motion2/server/files/attachments/fax-${CALLERID(num)}-${CUT(UNIQUEID,.,1)}-${CUT(UNIQUEID,.,2)}-${STRFTIME(,,%C%y%m%d%H%M%S)}-rx.tif,d','ReceiveFax','addAccountApplications','sequelize','transaction','VoiceExtension','updateAccountApplications','tech','createdAt','updatedAt','TrunkId','getMessages','FaxMessage','$gte','split','YYYY-MM-DD\x20HH:mm:ss','List','Contacts','DESC','attachments','join','root','server/files/attachments','CheckAfterSend','isNil','from','format','\x22%s\x22\x20<%s>','fax','ListId','List\x20not\x20found','Send\x20Fax\x20failed','Messages','Contact\x20not\x20found','spread','out','filename','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','bluebird','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','redis','defaults','localhost','./faxAccount.socket','register','jayson/promise','http','client','test','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','then','info','request\x20sent','debug','FaxAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','FaxAccount,\x20%s,\x20%s','message','catch','sendStatus','status','json','offset','limit','set','Content-Range','reject','save','update','destroy','get','FaxAccounts','UserProfileResource','stack','name','index','Pause','mandatoryDispositionPause','FaxAccount','rawAttributes','fieldName','type','key','model','map','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','include','findAll','rows','show','params','keys','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','describe','Disposition','getDispositions','findOne','FaxAccountId','count'];(function(_0x1ac5e9,_0x321509){var _0x5e92dc=function(_0xdacf6e){while(--_0xdacf6e){_0x1ac5e9['push'](_0x1ac5e9['shift']());}};_0x5e92dc(++_0x321509);}(_0x29eb,0x11f));var _0xb29e=function(_0x125166,_0xd7e07e){_0x125166=_0x125166-0x0;var _0x4b5856=_0x29eb[_0x125166];return _0x4b5856;};'use strict';var pdf=require(_0xb29e('0x0'));var emlformat=require(_0xb29e('0x1'));var rimraf=require(_0xb29e('0x2'));var zipdir=require(_0xb29e('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0xb29e('0x4'));var moment=require(_0xb29e('0x5'));var BPromise=require(_0xb29e('0x6'));var Mustache=require('mustache');var util=require(_0xb29e('0x7'));var path=require(_0xb29e('0x8'));var sox=require(_0xb29e('0x9'));var csv=require(_0xb29e('0xa'));var ejs=require(_0xb29e('0xb'));var fs=require('fs');var _=require(_0xb29e('0xc'));var squel=require(_0xb29e('0xd'));var crypto=require(_0xb29e('0xe'));var jsforce=require(_0xb29e('0xf'));var deskjs=require(_0xb29e('0x10'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xb29e('0x11'));var authService=require(_0xb29e('0x12'));var qs=require(_0xb29e('0x13'));var as=require(_0xb29e('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xb29e('0x15'));var utils=require('../../config/utils');var config=require('../../config/environment');var db=require('../../mysqldb')['db'];config[_0xb29e('0x16')]=_[_0xb29e('0x17')](config[_0xb29e('0x16')],{'host':_0xb29e('0x18'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xb29e('0x16')]));require(_0xb29e('0x19'))[_0xb29e('0x1a')](socket);var jayson=require(_0xb29e('0x1b'));var client=jayson['client'][_0xb29e('0x1c')]({'port':0x232c});var client9002=jayson[_0xb29e('0x1d')]['http']({'port':0x232a});function checkPasswordPattern(_0x370aa2,_0x419eb7,_0xc62791){if(_0xc62791){var _0x408a96=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x408a96[_0xb29e('0x1e')](_0x419eb7)){return _0x370aa2;}else{throw new db['Sequelize']['ValidationError'](_0xb29e('0x1f'));}}else{return _0x370aa2;}}function respondWithRpcPromise(_0x39cb7d,_0x9185dc,_0x893e71,_0x556edf){return new BPromise(function(_0xb8efa9,_0x4b01b8){var _0x2dcf96=_0x556edf||client;return _0x2dcf96['request'](_0x39cb7d,_0x893e71)[_0xb29e('0x20')](function(_0x2d53e2){logger[_0xb29e('0x21')]('FaxAccount,\x20%s,\x20%s',_0x9185dc,_0xb29e('0x22'));logger[_0xb29e('0x23')](_0xb29e('0x24'),_0x9185dc,_0xb29e('0x22'),JSON[_0xb29e('0x25')](_0x2d53e2));if(_0x2d53e2[_0xb29e('0x26')]){if(_0x2d53e2[_0xb29e('0x26')][_0xb29e('0x27')]===0x1f4){logger[_0xb29e('0x26')](_0xb29e('0x28'),_0x9185dc,_0x2d53e2['error'][_0xb29e('0x29')]);return _0x4b01b8(_0x2d53e2[_0xb29e('0x26')][_0xb29e('0x29')]);}logger['error'](_0xb29e('0x28'),_0x9185dc,_0x2d53e2[_0xb29e('0x26')]['message']);return _0xb8efa9(_0x2d53e2[_0xb29e('0x26')][_0xb29e('0x29')]);}else{logger[_0xb29e('0x21')](_0xb29e('0x28'),_0x9185dc,_0xb29e('0x22'));_0xb8efa9(_0x2d53e2['result']['message']);}})[_0xb29e('0x2a')](function(_0x2022b7){logger[_0xb29e('0x26')](_0xb29e('0x28'),_0x9185dc,_0x2022b7);_0x4b01b8(_0x2022b7);});});}function respondWithStatusCode(_0x118e0e,_0x463ff){_0x463ff=_0x463ff||0xcc;return function(_0x27f771){if(_0x27f771){return _0x118e0e[_0xb29e('0x2b')](_0x463ff);}return _0x118e0e[_0xb29e('0x2c')](_0x463ff)['end']();};}function respondWithResult(_0x1408e1,_0x40bf79){_0x40bf79=_0x40bf79||0xc8;return function(_0x4ff5b2){if(_0x4ff5b2){return _0x1408e1[_0xb29e('0x2c')](_0x40bf79)[_0xb29e('0x2d')](_0x4ff5b2);}};}function respondWithFilteredResult(_0x576b73,_0x2c0e66){return function(_0x320828){if(_0x320828){var _0x2f0751=_0x320828['count'],_0x24d991=_0x2c0e66[_0xb29e('0x2e')],_0x1ead8d=_0x2c0e66[_0xb29e('0x2e')]+_0x2c0e66[_0xb29e('0x2f')],_0x4d347a;if(_0x1ead8d>=_0x2f0751){_0x1ead8d=_0x2f0751;_0x4d347a=0xc8;}else{_0x4d347a=0xce;}_0x576b73[_0xb29e('0x2c')](_0x4d347a);return _0x576b73[_0xb29e('0x30')](_0xb29e('0x31'),_0x24d991+'-'+_0x1ead8d+'/'+_0x2f0751)[_0xb29e('0x2d')](_0x320828);}return null;};}function patchUpdates(_0x2e6baf){return function(_0x34b6cb){try{jsonpatch['apply'](_0x34b6cb,_0x2e6baf,!![]);}catch(_0x397b58){return BPromise[_0xb29e('0x32')](_0x397b58);}return _0x34b6cb[_0xb29e('0x33')]();};}function saveUpdates(_0x279108,_0x3137f2){return function(_0x2b94dd){if(_0x2b94dd){return _0x2b94dd[_0xb29e('0x34')](_0x279108)[_0xb29e('0x20')](function(_0xab88e6){return _0xab88e6;});}return null;};}function removeEntity(_0x460f79,_0x19add8){return function(_0x13e338){if(_0x13e338){return _0x13e338[_0xb29e('0x35')]()[_0xb29e('0x20')](function(){var _0x193156=_0x13e338[_0xb29e('0x36')]({'plain':!![]});var _0x1c281c=_0xb29e('0x37');return db[_0xb29e('0x38')][_0xb29e('0x35')]({'where':{'type':_0x1c281c,'resourceId':_0x193156['id']}})['then'](function(){return _0x13e338;});})['then'](function(){_0x460f79[_0xb29e('0x2c')](0xcc)['end']();});}};}function handleEntityNotFound(_0xa743c1,_0x260286){return function(_0x3fdc33){if(!_0x3fdc33){_0xa743c1['sendStatus'](0x194);}return _0x3fdc33;};}function handleError(_0x59aed5,_0x5d80ba){_0x5d80ba=_0x5d80ba||0x1f4;return function(_0x12363b){logger['error'](_0x12363b[_0xb29e('0x39')]);if(_0x12363b[_0xb29e('0x3a')]){delete _0x12363b['name'];}_0x59aed5[_0xb29e('0x2c')](_0x5d80ba)['send'](_0x12363b);};}exports[_0xb29e('0x3b')]=function(_0x4da8da,_0x30425d){var _0x51ee2c={'include':[{'model':db[_0xb29e('0x3c')],'as':_0xb29e('0x3d')}]},_0x41108f={},_0x5a405c={'count':0x0,'rows':[]};var _0x43c708=_['map'](db[_0xb29e('0x3e')][_0xb29e('0x3f')],function(_0x10d1fd){return{'name':_0x10d1fd[_0xb29e('0x40')],'type':_0x10d1fd[_0xb29e('0x41')][_0xb29e('0x42')]};});_0x41108f[_0xb29e('0x43')]=_[_0xb29e('0x44')](_0x43c708,'name');_0x41108f[_0xb29e('0x45')]=_['keys'](_0x4da8da['query']);_0x41108f[_0xb29e('0x46')]=_[_0xb29e('0x47')](_0x41108f[_0xb29e('0x43')],_0x41108f['query']);_0x51ee2c[_0xb29e('0x48')]=_[_0xb29e('0x47')](_0x41108f[_0xb29e('0x43')],qs[_0xb29e('0x49')](_0x4da8da[_0xb29e('0x45')][_0xb29e('0x49')]));_0x51ee2c[_0xb29e('0x48')]=_0x51ee2c[_0xb29e('0x48')][_0xb29e('0x4a')]?_0x51ee2c[_0xb29e('0x48')]:_0x41108f['model'];if(!_0x4da8da[_0xb29e('0x45')][_0xb29e('0x4b')](_0xb29e('0x4c'))){_0x51ee2c['limit']=qs[_0xb29e('0x2f')](_0x4da8da['query']['limit']);_0x51ee2c[_0xb29e('0x2e')]=qs['offset'](_0x4da8da['query'][_0xb29e('0x2e')]);}_0x51ee2c[_0xb29e('0x4d')]=qs[_0xb29e('0x4e')](_0x4da8da[_0xb29e('0x45')][_0xb29e('0x4e')]);_0x51ee2c[_0xb29e('0x4f')]=qs[_0xb29e('0x46')](_[_0xb29e('0x50')](_0x4da8da[_0xb29e('0x45')],_0x41108f[_0xb29e('0x46')]),_0x43c708);if(_0x4da8da['query']['filter']){_0x51ee2c[_0xb29e('0x4f')]=_[_0xb29e('0x51')](_0x51ee2c[_0xb29e('0x4f')],{'$or':_[_0xb29e('0x44')](_0x43c708,function(_0x1d366a){if(_0x1d366a[_0xb29e('0x41')]!==_0xb29e('0x52')){var _0x126f25={};_0x126f25[_0x1d366a[_0xb29e('0x3a')]]={'$like':'%'+_0x4da8da[_0xb29e('0x45')][_0xb29e('0x53')]+'%'};return _0x126f25;}})});}_0x51ee2c=_[_0xb29e('0x51')]({},_0x51ee2c,_0x4da8da[_0xb29e('0x54')]);var _0x5057ba={'where':_0x51ee2c[_0xb29e('0x4f')]};return db[_0xb29e('0x3e')]['count'](_0x5057ba)[_0xb29e('0x20')](function(_0x3708f7){_0x5a405c['count']=_0x3708f7;if(_0x4da8da[_0xb29e('0x45')]['includeAll']){_0x51ee2c[_0xb29e('0x55')]=[{'all':!![]}];}return db[_0xb29e('0x3e')][_0xb29e('0x56')](_0x51ee2c);})['then'](function(_0x35d698){_0x5a405c[_0xb29e('0x57')]=_0x35d698;return _0x5a405c;})['then'](respondWithFilteredResult(_0x30425d,_0x51ee2c))[_0xb29e('0x2a')](handleError(_0x30425d,null));};exports[_0xb29e('0x58')]=function(_0x3d0926,_0x51cf46){var _0x43d15b={'raw':![],'where':{'id':_0x3d0926[_0xb29e('0x59')]['id']},'include':[{'model':db[_0xb29e('0x3c')],'as':'mandatoryDispositionPause'}]},_0x5c55e7={};_0x5c55e7['model']=_[_0xb29e('0x5a')](db['FaxAccount'][_0xb29e('0x3f')]);_0x5c55e7['query']=_[_0xb29e('0x5a')](_0x3d0926['query']);_0x5c55e7[_0xb29e('0x46')]=_[_0xb29e('0x47')](_0x5c55e7[_0xb29e('0x43')],_0x5c55e7['query']);_0x43d15b[_0xb29e('0x48')]=_[_0xb29e('0x47')](_0x5c55e7[_0xb29e('0x43')],qs['fields'](_0x3d0926[_0xb29e('0x45')]['fields']));_0x43d15b[_0xb29e('0x48')]=_0x43d15b['attributes'][_0xb29e('0x4a')]?_0x43d15b[_0xb29e('0x48')]:_0x5c55e7[_0xb29e('0x43')];if(_0x3d0926[_0xb29e('0x45')]['includeAll']){_0x43d15b['include']=[{'all':!![]}];}_0x43d15b=_[_0xb29e('0x51')]({},_0x43d15b,_0x3d0926['options']);return db[_0xb29e('0x3e')][_0xb29e('0x5b')](_0x43d15b)[_0xb29e('0x20')](handleEntityNotFound(_0x51cf46,null))['then'](respondWithResult(_0x51cf46,null))[_0xb29e('0x2a')](handleError(_0x51cf46,null));};exports[_0xb29e('0x5c')]=function(_0x1d2438,_0x2e7c38){return db[_0xb29e('0x3e')]['create'](_0x1d2438[_0xb29e('0x5d')],{})[_0xb29e('0x20')](function(_0x5a5624){var _0x93cb84=_0x1d2438[_0xb29e('0x5e')][_0xb29e('0x36')]({'plain':!![]});if(!_0x93cb84)throw new Error(_0xb29e('0x5f'));if(_0x93cb84[_0xb29e('0x60')]==='user'){var _0x36da60=_0x5a5624[_0xb29e('0x36')]({'plain':!![]});var _0x4314e5=_0xb29e('0x37');return db[_0xb29e('0x61')][_0xb29e('0x5b')]({'where':{'name':_0x4314e5,'userProfileId':_0x93cb84[_0xb29e('0x62')]},'raw':!![]})[_0xb29e('0x20')](function(_0x2d95d1){if(_0x2d95d1&&_0x2d95d1[_0xb29e('0x63')]===0x0){return db[_0xb29e('0x38')]['create']({'name':_0x36da60[_0xb29e('0x3a')],'resourceId':_0x36da60['id'],'type':_0x2d95d1['name'],'sectionId':_0x2d95d1['id']},{})[_0xb29e('0x20')](function(){return _0x5a5624;});}else{return _0x5a5624;}})[_0xb29e('0x2a')](function(_0x3f6842){logger['error'](_0xb29e('0x64'),_0x3f6842);throw _0x3f6842;});}return _0x5a5624;})[_0xb29e('0x20')](respondWithResult(_0x2e7c38,0xc9))[_0xb29e('0x2a')](handleError(_0x2e7c38,null));};exports['update']=function(_0x4ba35e,_0x41819a){if(_0x4ba35e[_0xb29e('0x5d')]['id']){delete _0x4ba35e[_0xb29e('0x5d')]['id'];}return db[_0xb29e('0x3e')][_0xb29e('0x5b')]({'where':{'id':_0x4ba35e[_0xb29e('0x59')]['id']},'include':[{'model':db[_0xb29e('0x3c')],'as':_0xb29e('0x3d')}]})['then'](handleEntityNotFound(_0x41819a,null))[_0xb29e('0x20')](saveUpdates(_0x4ba35e[_0xb29e('0x5d')],null))[_0xb29e('0x20')](respondWithResult(_0x41819a,null))[_0xb29e('0x2a')](handleError(_0x41819a,null));};exports['destroy']=function(_0x390c85,_0x4de06b){return db[_0xb29e('0x3e')][_0xb29e('0x5b')]({'where':{'id':_0x390c85[_0xb29e('0x59')]['id']}})[_0xb29e('0x20')](handleEntityNotFound(_0x4de06b,null))[_0xb29e('0x20')](removeEntity(_0x4de06b,null))['catch'](handleError(_0x4de06b,null));};exports[_0xb29e('0x65')]=function(_0x52ed26,_0x132f78){return db[_0xb29e('0x3e')][_0xb29e('0x65')]()[_0xb29e('0x20')](respondWithResult(_0x132f78,null))['catch'](handleError(_0x132f78,null));};exports['addDisposition']=function(_0x3ca5e8,_0x177bae,_0x3fa650){if(_0x3ca5e8[_0xb29e('0x5d')]['id']){delete _0x3ca5e8[_0xb29e('0x5d')]['id'];}return db[_0xb29e('0x3e')]['find']({'where':{'id':_0x3ca5e8[_0xb29e('0x59')]['id']}})['then'](handleEntityNotFound(_0x177bae,null))[_0xb29e('0x20')](function(_0x2885ab){if(_0x2885ab){_0x3ca5e8[_0xb29e('0x5d')]['FaxAccountId']=_0x2885ab['id'];return db[_0xb29e('0x66')][_0xb29e('0x5c')](_0x3ca5e8[_0xb29e('0x5d')]);}})[_0xb29e('0x20')](respondWithResult(_0x177bae,null))['catch'](handleError(_0x177bae,null));};exports[_0xb29e('0x67')]=function(_0x5bf3ec,_0x5e697d,_0x597450){var _0x209606={'raw':![],'where':{}};var _0x1950cd={};var _0xea04cc={'count':0x0,'rows':[]};return db['FaxAccount'][_0xb29e('0x68')]({'where':{'id':_0x5bf3ec[_0xb29e('0x59')]['id']}})['then'](handleEntityNotFound(_0x5e697d,null))[_0xb29e('0x20')](function(_0x3dd509){if(_0x3dd509){_0x1950cd[_0xb29e('0x43')]=_[_0xb29e('0x5a')](db[_0xb29e('0x66')][_0xb29e('0x3f')]);_0x1950cd['query']=_['keys'](_0x5bf3ec[_0xb29e('0x45')]);_0x1950cd['filters']=_[_0xb29e('0x47')](_0x1950cd['model'],_0x1950cd[_0xb29e('0x45')]);_0x209606[_0xb29e('0x48')]=_['intersection'](_0x1950cd[_0xb29e('0x43')],qs[_0xb29e('0x49')](_0x5bf3ec[_0xb29e('0x45')][_0xb29e('0x49')]));_0x209606[_0xb29e('0x48')]=_0x209606[_0xb29e('0x48')][_0xb29e('0x4a')]?_0x209606['attributes']:_0x1950cd[_0xb29e('0x43')];if(!_0x5bf3ec[_0xb29e('0x45')][_0xb29e('0x4b')](_0xb29e('0x4c'))){_0x209606[_0xb29e('0x2f')]=qs[_0xb29e('0x2f')](_0x5bf3ec['query']['limit']);_0x209606[_0xb29e('0x2e')]=qs[_0xb29e('0x2e')](_0x5bf3ec[_0xb29e('0x45')][_0xb29e('0x2e')]);}_0x209606[_0xb29e('0x4d')]=qs[_0xb29e('0x4e')](_0x5bf3ec[_0xb29e('0x45')][_0xb29e('0x4e')]);_0x209606[_0xb29e('0x4f')]=qs[_0xb29e('0x46')](_['pick'](_0x5bf3ec[_0xb29e('0x45')],_0x1950cd[_0xb29e('0x46')]));_0x209606[_0xb29e('0x4f')][_0xb29e('0x69')]=_0x3dd509['id'];if(_0x5bf3ec[_0xb29e('0x45')][_0xb29e('0x53')]){_0x209606[_0xb29e('0x4f')]=_[_0xb29e('0x51')](_0x209606['where'],{'$or':_['map'](_0x209606[_0xb29e('0x48')],function(_0x3b3660){var _0x1c6828={};_0x1c6828[_0x3b3660]={'$like':'%'+_0x5bf3ec[_0xb29e('0x45')]['filter']+'%'};return _0x1c6828;})});}_0x209606=_[_0xb29e('0x51')]({},_0x209606,_0x5bf3ec[_0xb29e('0x54')]);return db[_0xb29e('0x66')][_0xb29e('0x6a')]({'where':_0x209606[_0xb29e('0x4f')]})['then'](function(_0x26fe4f){_0xea04cc['count']=_0x26fe4f;if(_0x5bf3ec[_0xb29e('0x45')][_0xb29e('0x6b')]){_0x209606[_0xb29e('0x55')]=[{'all':!![]}];}return db[_0xb29e('0x66')]['findAll'](_0x209606);})[_0xb29e('0x20')](function(_0x509f32){_0xea04cc[_0xb29e('0x57')]=_0x509f32;return _0xea04cc;});}})[_0xb29e('0x20')](respondWithFilteredResult(_0x5e697d,_0x209606))[_0xb29e('0x2a')](handleError(_0x5e697d,null));};exports[_0xb29e('0x6c')]=function(_0x4c8d30,_0x5a372f,_0x3e4794){return db[_0xb29e('0x3e')]['find']({'where':{'id':_0x4c8d30[_0xb29e('0x59')]['id']}})['then'](handleEntityNotFound(_0x5a372f,null))[_0xb29e('0x20')](function(_0x17ccc0){if(_0x17ccc0){return _0x17ccc0[_0xb29e('0x6c')](_0x4c8d30['query']['ids']);}})[_0xb29e('0x20')](respondWithStatusCode(_0x5a372f,null))[_0xb29e('0x2a')](handleError(_0x5a372f,null));};exports[_0xb29e('0x6d')]=function(_0x2ad25a,_0x4a3004,_0x1766f7){if(_0x2ad25a[_0xb29e('0x5d')]['id']){delete _0x2ad25a['body']['id'];}return db['FaxAccount']['find']({'where':{'id':_0x2ad25a['params']['id']}})[_0xb29e('0x20')](handleEntityNotFound(_0x4a3004,null))['then'](function(_0xe515c2){if(_0xe515c2){_0x2ad25a[_0xb29e('0x5d')][_0xb29e('0x69')]=_0xe515c2['id'];return db[_0xb29e('0x6e')][_0xb29e('0x5c')](_0x2ad25a[_0xb29e('0x5d')]);}})['then'](respondWithResult(_0x4a3004,null))['catch'](handleError(_0x4a3004,null));};exports['getAnswers']=function(_0x3ffb3c,_0x3b3316,_0x4dd3d){var _0x2d7d84={'raw':![],'where':{}};var _0x19de7a={};var _0x4c2298={'count':0x0,'rows':[]};return db[_0xb29e('0x3e')][_0xb29e('0x68')]({'where':{'id':_0x3ffb3c[_0xb29e('0x59')]['id']}})[_0xb29e('0x20')](handleEntityNotFound(_0x3b3316,null))[_0xb29e('0x20')](function(_0x2f9669){if(_0x2f9669){_0x19de7a[_0xb29e('0x43')]=_['keys'](db[_0xb29e('0x6e')][_0xb29e('0x3f')]);_0x19de7a[_0xb29e('0x45')]=_[_0xb29e('0x5a')](_0x3ffb3c['query']);_0x19de7a['filters']=_[_0xb29e('0x47')](_0x19de7a['model'],_0x19de7a['query']);_0x2d7d84['attributes']=_[_0xb29e('0x47')](_0x19de7a[_0xb29e('0x43')],qs[_0xb29e('0x49')](_0x3ffb3c[_0xb29e('0x45')][_0xb29e('0x49')]));_0x2d7d84[_0xb29e('0x48')]=_0x2d7d84[_0xb29e('0x48')][_0xb29e('0x4a')]?_0x2d7d84[_0xb29e('0x48')]:_0x19de7a[_0xb29e('0x43')];if(!_0x3ffb3c['query'][_0xb29e('0x4b')](_0xb29e('0x4c'))){_0x2d7d84[_0xb29e('0x2f')]=qs[_0xb29e('0x2f')](_0x3ffb3c[_0xb29e('0x45')]['limit']);_0x2d7d84[_0xb29e('0x2e')]=qs['offset'](_0x3ffb3c['query']['offset']);}_0x2d7d84[_0xb29e('0x4d')]=qs[_0xb29e('0x4e')](_0x3ffb3c[_0xb29e('0x45')]['sort']);_0x2d7d84['where']=qs[_0xb29e('0x46')](_[_0xb29e('0x50')](_0x3ffb3c['query'],_0x19de7a[_0xb29e('0x46')]));_0x2d7d84[_0xb29e('0x4f')][_0xb29e('0x69')]=_0x2f9669['id'];if(_0x3ffb3c[_0xb29e('0x45')]['filter']){_0x2d7d84[_0xb29e('0x4f')]=_['merge'](_0x2d7d84['where'],{'$or':_[_0xb29e('0x44')](_0x2d7d84[_0xb29e('0x48')],function(_0x562d88){var _0x1ec9d2={};_0x1ec9d2[_0x562d88]={'$like':'%'+_0x3ffb3c[_0xb29e('0x45')][_0xb29e('0x53')]+'%'};return _0x1ec9d2;})});}_0x2d7d84=_['merge']({},_0x2d7d84,_0x3ffb3c['options']);return db[_0xb29e('0x6e')]['count']({'where':_0x2d7d84['where']})[_0xb29e('0x20')](function(_0x500df4){_0x4c2298['count']=_0x500df4;if(_0x3ffb3c[_0xb29e('0x45')][_0xb29e('0x6b')]){_0x2d7d84[_0xb29e('0x55')]=[{'all':!![]}];}return db[_0xb29e('0x6e')][_0xb29e('0x56')](_0x2d7d84);})[_0xb29e('0x20')](function(_0x3c4957){_0x4c2298[_0xb29e('0x57')]=_0x3c4957;return _0x4c2298;});}})[_0xb29e('0x20')](respondWithFilteredResult(_0x3b3316,_0x2d7d84))[_0xb29e('0x2a')](handleError(_0x3b3316,null));};exports[_0xb29e('0x6f')]=function(_0x457ab1,_0xa0175e,_0x1fe317){return db['FaxAccount'][_0xb29e('0x5b')]({'where':{'id':_0x457ab1[_0xb29e('0x59')]['id']}})[_0xb29e('0x20')](handleEntityNotFound(_0xa0175e,null))[_0xb29e('0x20')](function(_0x26b3f9){if(_0x26b3f9){return _0x26b3f9[_0xb29e('0x6f')](_0x457ab1[_0xb29e('0x45')][_0xb29e('0x70')]);}})[_0xb29e('0x20')](respondWithStatusCode(_0xa0175e,null))[_0xb29e('0x2a')](handleError(_0xa0175e,null));};exports[_0xb29e('0x71')]=function(_0x4f91b7,_0x402dd1,_0x4fbcb1){return db[_0xb29e('0x72')][_0xb29e('0x5b')]({'where':{'id':_0x4f91b7[_0xb29e('0x59')]['id']}})['then'](handleEntityNotFound(_0x402dd1,null))['then'](function(_0x2441f6){if(_0x2441f6){return _0x2441f6[_0xb29e('0x71')](_0x4f91b7[_0xb29e('0x5d')][_0xb29e('0x70')],_[_0xb29e('0x73')](_0x4f91b7[_0xb29e('0x5d')],['ids','id'])||{});}})[_0xb29e('0x20')](respondWithResult(_0x402dd1,null))[_0xb29e('0x2a')](handleError(_0x402dd1,null));};exports[_0xb29e('0x74')]=function(_0x282aeb,_0x339cf1,_0x4795b0){var _0x228a1f={'raw':![],'where':{}};var _0x451b34={};var _0x2fc6b4={'count':0x0,'rows':[]};return db['FaxAccount'][_0xb29e('0x68')]({'where':{'id':_0x282aeb['params']['id']}})[_0xb29e('0x20')](handleEntityNotFound(_0x339cf1,null))[_0xb29e('0x20')](function(_0x5bc4af){if(_0x5bc4af){_0x451b34['model']=_[_0xb29e('0x5a')](db[_0xb29e('0x72')][_0xb29e('0x3f')]);_0x451b34['query']=_[_0xb29e('0x5a')](_0x282aeb[_0xb29e('0x45')]);_0x451b34['filters']=_[_0xb29e('0x47')](_0x451b34[_0xb29e('0x43')],_0x451b34['query']);_0x228a1f[_0xb29e('0x48')]=_[_0xb29e('0x47')](_0x451b34[_0xb29e('0x43')],qs[_0xb29e('0x49')](_0x282aeb[_0xb29e('0x45')]['fields']));_0x228a1f[_0xb29e('0x48')]=_0x228a1f['attributes'][_0xb29e('0x4a')]?_0x228a1f[_0xb29e('0x48')]:_0x451b34[_0xb29e('0x43')];if(!_0x282aeb[_0xb29e('0x45')][_0xb29e('0x4b')](_0xb29e('0x4c'))){_0x228a1f[_0xb29e('0x2f')]=qs[_0xb29e('0x2f')](_0x282aeb[_0xb29e('0x45')][_0xb29e('0x2f')]);_0x228a1f[_0xb29e('0x2e')]=qs[_0xb29e('0x2e')](_0x282aeb[_0xb29e('0x45')][_0xb29e('0x2e')]);}_0x228a1f[_0xb29e('0x4d')]=qs[_0xb29e('0x4e')](_0x282aeb[_0xb29e('0x45')][_0xb29e('0x4e')]);_0x228a1f[_0xb29e('0x4f')]=qs['filters'](_[_0xb29e('0x50')](_0x282aeb[_0xb29e('0x45')],_0x451b34[_0xb29e('0x46')]));_0x228a1f['where'][_0xb29e('0x69')]=_0x5bc4af['id'];if(_0x282aeb[_0xb29e('0x45')][_0xb29e('0x53')]){_0x228a1f['where']=_[_0xb29e('0x51')](_0x228a1f[_0xb29e('0x4f')],{'$or':_[_0xb29e('0x44')](_0x228a1f[_0xb29e('0x48')],function(_0x3840db){var _0x1ced13={};_0x1ced13[_0x3840db]={'$like':'%'+_0x282aeb[_0xb29e('0x45')][_0xb29e('0x53')]+'%'};return _0x1ced13;})});}_0x228a1f=_[_0xb29e('0x51')]({},_0x228a1f,_0x282aeb[_0xb29e('0x54')]);return db[_0xb29e('0x72')][_0xb29e('0x6a')]({'where':_0x228a1f[_0xb29e('0x4f')]})[_0xb29e('0x20')](function(_0x9cdb2c){_0x2fc6b4[_0xb29e('0x6a')]=_0x9cdb2c;if(_0x282aeb[_0xb29e('0x45')]['includeAll']){_0x228a1f[_0xb29e('0x55')]=[{'model':db[_0xb29e('0x75')],'as':_0xb29e('0x76'),'required':![]},{'model':db[_0xb29e('0x77')],'as':'Owner','attributes':[_0xb29e('0x3a'),_0xb29e('0x78'),_0xb29e('0x79')],'required':![]},{'model':db[_0xb29e('0x7a')],'as':_0xb29e('0x7b'),'attributes':['id','name',_0xb29e('0x7c')],'where':_0x282aeb[_0xb29e('0x45')]['tag']?{'id':_0x282aeb['query'][_0xb29e('0x7d')]}:undefined,'required':_0x282aeb[_0xb29e('0x45')][_0xb29e('0x7d')]?!![]:![]}];}return db[_0xb29e('0x72')][_0xb29e('0x56')](_0x228a1f);})[_0xb29e('0x20')](function(_0x3da448){_0x2fc6b4[_0xb29e('0x57')]=_0x3da448;return _0x2fc6b4;});}})[_0xb29e('0x20')](respondWithFilteredResult(_0x339cf1,_0x228a1f))[_0xb29e('0x2a')](handleError(_0x339cf1,null));};exports[_0xb29e('0x7e')]=function(_0x3c8a47,_0x2eeb02,_0x59d936){return db[_0xb29e('0x3e')][_0xb29e('0x68')]({'where':{'id':_0x3c8a47[_0xb29e('0x59')]['id']}})[_0xb29e('0x20')](handleEntityNotFound(_0x2eeb02,null))[_0xb29e('0x20')](function(_0x4da2b3){if(_0x4da2b3){return db['sequelize']['transaction'](function(_0x247f6b){return db['FaxApplication'][_0xb29e('0x35')]({'where':{'FaxAccountId':_0x3c8a47[_0xb29e('0x59')]['id']},'transaction':_0x247f6b})[_0xb29e('0x20')](function(_0x27fe75){var _0x3c2dc5=_['map'](_0x3c8a47[_0xb29e('0x5d')],function(_0x4af790){_0x4af790[_0xb29e('0x69')]=_0x3c8a47[_0xb29e('0x59')]['id'];return _0x4af790;});return db[_0xb29e('0x7f')][_0xb29e('0x80')](_0x3c2dc5,{'transaction':_0x247f6b});});})[_0xb29e('0x20')](function(){return db[_0xb29e('0x7f')]['findAndCountAll']({'where':{'FaxAccountId':_0x3c8a47[_0xb29e('0x59')]['id']},'order':_0xb29e('0x81')});});}})[_0xb29e('0x20')](respondWithResult(_0x2eeb02,null))[_0xb29e('0x2a')](handleError(_0x2eeb02,null));};exports['getApplications']=function(_0x3dd921,_0x35ad26,_0x2533b5){var _0x3d518e={};var _0x3a8810={};var _0x15d1d3;var _0xe0110c;return db['FaxAccount']['findOne']({'where':{'id':_0x3dd921[_0xb29e('0x59')]['id']}})[_0xb29e('0x20')](handleEntityNotFound(_0x35ad26,null))['then'](function(_0x3ca2a3){if(_0x3ca2a3){_0x15d1d3=_0x3ca2a3;_0x3a8810['model']=_[_0xb29e('0x5a')](db['FaxApplication'][_0xb29e('0x3f')]);_0x3a8810[_0xb29e('0x45')]=_[_0xb29e('0x5a')](_0x3dd921[_0xb29e('0x45')]);_0x3a8810['filters']=_[_0xb29e('0x47')](_0x3a8810[_0xb29e('0x43')],_0x3a8810[_0xb29e('0x45')]);_0x3d518e[_0xb29e('0x48')]=_[_0xb29e('0x47')](_0x3a8810[_0xb29e('0x43')],qs['fields'](_0x3dd921['query'][_0xb29e('0x49')]));_0x3d518e[_0xb29e('0x48')]=_0x3d518e[_0xb29e('0x48')][_0xb29e('0x4a')]?_0x3d518e['attributes']:_0x3a8810['model'];_0x3d518e[_0xb29e('0x4d')]=qs[_0xb29e('0x4e')](_0x3dd921[_0xb29e('0x45')]['sort']);_0x3d518e[_0xb29e('0x4f')]=qs[_0xb29e('0x46')](_[_0xb29e('0x50')](_0x3dd921[_0xb29e('0x45')],_0x3a8810['filters']));if(_0x3dd921[_0xb29e('0x45')][_0xb29e('0x53')]){_0x3d518e[_0xb29e('0x4f')]=_[_0xb29e('0x51')](_0x3d518e['where'],{'$or':_[_0xb29e('0x44')](_0x3d518e[_0xb29e('0x48')],function(_0x5cf7a1){var _0x71b0cd={};_0x71b0cd[_0x5cf7a1]={'$like':'%'+_0x3dd921[_0xb29e('0x45')][_0xb29e('0x53')]+'%'};return _0x71b0cd;})});}_0x3d518e=_[_0xb29e('0x51')]({},_0x3d518e,_0x3dd921[_0xb29e('0x54')]);return _0x15d1d3[_0xb29e('0x82')](_0x3d518e);}})['then'](function(_0x2a8506){if(_0x2a8506){_0xe0110c=_0x2a8506[_0xb29e('0x4a')];if(!_0x3dd921['query']['hasOwnProperty'](_0xb29e('0x4c'))){_0x3d518e[_0xb29e('0x2f')]=qs[_0xb29e('0x2f')](_0x3dd921['query']['limit']);_0x3d518e[_0xb29e('0x2e')]=qs[_0xb29e('0x2e')](_0x3dd921[_0xb29e('0x45')][_0xb29e('0x2e')]);}return _0x15d1d3['getApplications'](_0x3d518e);}})[_0xb29e('0x20')](function(_0x19c89b){if(_0x19c89b){return _0x19c89b?{'count':_0xe0110c,'rows':_0x19c89b}:null;}})['then'](respondWithResult(_0x35ad26,null))[_0xb29e('0x2a')](handleError(_0x35ad26,null));};function Extension(_0x181c25,_0x2c9dcf,_0x100a45,_0x197b04){this[_0xb29e('0x83')]='from-voip-provider';this[_0xb29e('0x84')]=_0x181c25['localstationid'];this[_0xb29e('0x85')]=_0x197b04;this[_0xb29e('0x41')]='system';this[_0xb29e('0x86')]=_0xb29e('0x87');this[_0xb29e('0x69')]=_0x181c25['id'];this['priority']=_0x2c9dcf;this['appdata']=_0x100a45;}function createExtensionsReciveFax(_0x1eb70f){var _0x28a8b2=0x1;var _0x4a1061=[];_0x4a1061[_0xb29e('0x88')](new Extension(_0x1eb70f,_0x28a8b2,'',_0xb29e('0x89')));_0x28a8b2+=0x1;_0x4a1061['push'](new Extension(_0x1eb70f,_0x28a8b2,_0xb29e('0x8a'),'Set'));_0x28a8b2+=0x1;for(var _0x1c03fb in _0x1eb70f){if(_0x1eb70f[_0xb29e('0x4b')](_0x1c03fb)&&(_0x1c03fb==='ecm'||_0x1c03fb===_0xb29e('0x8b')||_0x1c03fb===_0xb29e('0x8c')||_0x1c03fb===_0xb29e('0x8d')||_0x1c03fb===_0xb29e('0x8e')||_0x1c03fb===_0xb29e('0x8f')||_0x1c03fb===_0xb29e('0x90')||_0x1c03fb===_0xb29e('0x91')||_0x1c03fb===_0xb29e('0x92'))){_0x4a1061[_0xb29e('0x88')](new Extension(_0x1eb70f,_0x28a8b2,'FAXOPT('+_0x1c03fb+')='+_0x1eb70f[_0x1c03fb],_0xb29e('0x93')));_0x28a8b2+=0x1;}}_0x4a1061[_0xb29e('0x88')](new Extension(_0x1eb70f,_0x28a8b2,'6',_0xb29e('0x94')));_0x28a8b2+=0x1;_0x4a1061[_0xb29e('0x88')](new Extension(_0x1eb70f,_0x28a8b2,_0xb29e('0x95'),_0xb29e('0x96')));_0x28a8b2=0x0;return _0x4a1061;}exports[_0xb29e('0x97')]=function(_0x4d8ced,_0x2ee538,_0x4caad5){var _0x255203;return db[_0xb29e('0x98')][_0xb29e('0x99')](function(_0x47e9e7){return db['FaxAccount'][_0xb29e('0x5c')](_0x4d8ced[_0xb29e('0x5d')],{'transaction':_0x47e9e7})['then'](function(_0xf65fb9){_0x255203=_0xf65fb9[_0xb29e('0x36')]({'plain':!![]});return db[_0xb29e('0x9a')][_0xb29e('0x80')](createExtensionsReciveFax(_0x255203),{'transaction':_0x47e9e7});});})[_0xb29e('0x20')](function(){return _0x255203;})[_0xb29e('0x20')](respondWithResult(_0x2ee538,null))[_0xb29e('0x2a')](handleError(_0x2ee538,null));};exports[_0xb29e('0x9b')]=function(_0x5664d8,_0x1ccbe1,_0x2654ec){var _0x2451b2;return db[_0xb29e('0x98')][_0xb29e('0x99')](function(_0x591f3e){return db['FaxAccount']['update'](_0x5664d8[_0xb29e('0x5d')],{'where':{'id':_0x5664d8[_0xb29e('0x5d')]['id']},'transaction':_0x591f3e})[_0xb29e('0x20')](function(_0x4fb319){return db['VoiceExtension'][_0xb29e('0x35')]({'where':{'FaxAccountId':_0x5664d8[_0xb29e('0x5d')]['id']},'transaction':_0x591f3e})[_0xb29e('0x20')](function(_0x16e5df){return db[_0xb29e('0x9a')][_0xb29e('0x80')](createExtensionsReciveFax(_[_0xb29e('0x73')](_0x5664d8[_0xb29e('0x5d')],[_0xb29e('0x9c'),_0xb29e('0x42'),_0xb29e('0x9d'),_0xb29e('0x9e'),_0xb29e('0x9f'),'ListId'])),{'transaction':_0x591f3e});});});})['then'](function(){return db['FaxAccount']['findById'](_0x5664d8[_0xb29e('0x5d')]['id']);})[_0xb29e('0x20')](respondWithResult(_0x1ccbe1,null))[_0xb29e('0x2a')](handleError(_0x1ccbe1,null));};exports[_0xb29e('0xa0')]=function(_0x505025,_0x1c56b8,_0x56ce0c){var _0x4bfdaf={'raw':!![],'where':{}};var _0xaacc43={};var _0x576722={'count':0x0,'rows':[]};return db[_0xb29e('0x3e')][_0xb29e('0x68')]({'where':{'id':_0x505025[_0xb29e('0x59')]['id']}})[_0xb29e('0x20')](handleEntityNotFound(_0x1c56b8,null))[_0xb29e('0x20')](function(_0x1fe3b3){if(_0x1fe3b3){_0xaacc43['model']=_['keys'](db[_0xb29e('0xa1')]['rawAttributes']);_0xaacc43[_0xb29e('0x45')]=_[_0xb29e('0x5a')](_0x505025[_0xb29e('0x45')]);_0xaacc43['filters']=_[_0xb29e('0x47')](_0xaacc43[_0xb29e('0x43')],_0xaacc43[_0xb29e('0x45')]);_0x4bfdaf['attributes']=_[_0xb29e('0x47')](_0xaacc43['model'],qs[_0xb29e('0x49')](_0x505025[_0xb29e('0x45')][_0xb29e('0x49')]));_0x4bfdaf[_0xb29e('0x48')]=_0x4bfdaf['attributes'][_0xb29e('0x4a')]?_0x4bfdaf['attributes']:_0xaacc43[_0xb29e('0x43')];if(!_0x505025[_0xb29e('0x45')][_0xb29e('0x4b')]('nolimit')){_0x4bfdaf[_0xb29e('0x2f')]=qs['limit'](_0x505025[_0xb29e('0x45')]['limit']);_0x4bfdaf[_0xb29e('0x2e')]=qs[_0xb29e('0x2e')](_0x505025[_0xb29e('0x45')][_0xb29e('0x2e')]);}_0x4bfdaf[_0xb29e('0x4d')]=qs[_0xb29e('0x4e')](_0x505025['query'][_0xb29e('0x4e')]);_0x4bfdaf[_0xb29e('0x4f')]=qs[_0xb29e('0x46')](_['pick'](_0x505025[_0xb29e('0x45')],_0xaacc43[_0xb29e('0x46')]));_0x4bfdaf[_0xb29e('0x4f')]['FaxAccountId']=_0x1fe3b3['id'];if(_0x505025[_0xb29e('0x45')][_0xb29e('0x53')]){_0x4bfdaf[_0xb29e('0x4f')]=_[_0xb29e('0x51')](_0x4bfdaf['where'],{'$or':_[_0xb29e('0x44')](_0x4bfdaf[_0xb29e('0x48')],function(_0x1e6999){var _0x1f6ef5={};_0x1f6ef5[_0x1e6999]={'$like':'%'+_0x505025[_0xb29e('0x45')][_0xb29e('0x53')]+'%'};return _0x1f6ef5;})});}if(_0x505025[_0xb29e('0x45')][_0xb29e('0xa2')]){var _0x2ad843=_0x505025[_0xb29e('0x45')][_0xb29e('0xa2')][_0xb29e('0xa3')](',');var _0x5dc90c={};_0x5dc90c[_0x2ad843[0x0]]={'$gte':moment(_0x2ad843[0x1])['format'](_0xb29e('0xa4'))};_0x4bfdaf[_0xb29e('0x4f')]=_['merge'](_0x4bfdaf[_0xb29e('0x4f')],_0x5dc90c);}_0x4bfdaf=_[_0xb29e('0x51')]({},_0x4bfdaf,_0x505025[_0xb29e('0x54')]);return db[_0xb29e('0xa1')]['count']({'where':_0x4bfdaf[_0xb29e('0x4f')]})['then'](function(_0x2b96bb){_0x576722[_0xb29e('0x6a')]=_0x2b96bb;if(_0x505025[_0xb29e('0x45')][_0xb29e('0x6b')]){_0x4bfdaf[_0xb29e('0x55')]=[{'all':!![]}];}return db[_0xb29e('0xa1')]['findAll'](_0x4bfdaf);})[_0xb29e('0x20')](function(_0x55283e){_0x576722[_0xb29e('0x57')]=_0x55283e;return _0x576722;});}})[_0xb29e('0x20')](respondWithFilteredResult(_0x1c56b8,_0x4bfdaf))[_0xb29e('0x2a')](handleError(_0x1c56b8,null));};exports['send']=function(_0x344453,_0x3a3892,_0x52de83){var _0x4c221d,_0xadb5fa={},_0x3bfe4e;if(_0x344453[_0xb29e('0x5d')]['to']){_0x3bfe4e=_0x344453[_0xb29e('0x5d')]['to'][0x0];}return db[_0xb29e('0x3e')]['find']({'where':{'id':_0x344453['params']['id']},'include':[{'model':db['CmList'],'as':_0xb29e('0xa5'),'include':[{'model':db['CmContact'],'as':_0xb29e('0xa6'),'where':{'fax':_0x3bfe4e},'limit':0x1,'order':[['updatedAt',_0xb29e('0xa7')]]}]}]})[_0xb29e('0x20')](handleEntityNotFound(_0x3a3892,null))[_0xb29e('0x20')](function(_0x16d2f0){_0x4c221d=_0x16d2f0;if(_0x344453[_0xb29e('0x5d')][_0xb29e('0xa8')]&&_0x344453['body']['attachments'][_0xb29e('0x4a')]){for(var _0x5d5c52=0x0;_0x5d5c52<_0x344453['body'][_0xb29e('0xa8')]['length'];_0x5d5c52+=0x1){_0x344453[_0xb29e('0x5d')][_0xb29e('0xa8')][_0x5d5c52]={'filename':_0x344453['body'][_0xb29e('0xa8')][_0x5d5c52][_0xb29e('0x3a')],'id':_0x344453[_0xb29e('0x5d')][_0xb29e('0xa8')][_0x5d5c52]['id'],'path':path[_0xb29e('0xa9')](config[_0xb29e('0xaa')],_0xb29e('0xab'),_0x344453[_0xb29e('0x5d')][_0xb29e('0xa8')][_0x5d5c52]['basename'])};}}return respondWithRpcPromise(_0xb29e('0xac'),_0xb29e('0xac'),{'FaxAccountId':_[_0xb29e('0xad')](_0x344453[_0xb29e('0x59')]['id'])?undefined:_0x344453[_0xb29e('0x59')]['id'],'path':_[_0xb29e('0xad')](_0x344453[_0xb29e('0x5d')][_0xb29e('0xa8')][0x0][_0xb29e('0x8')])?undefined:_0x344453[_0xb29e('0x5d')][_0xb29e('0xa8')][0x0]['path'],'fax':_[_0xb29e('0xad')](_0x344453[_0xb29e('0x5d')]['to'][0x0])?undefined:_0x344453[_0xb29e('0x5d')]['to'][0x0]},client9002);})[_0xb29e('0x20')](function(){if(_0x4c221d){if(_['isNil'](_0x344453[_0xb29e('0x5d')]['from'])){_0x344453[_0xb29e('0x5d')][_0xb29e('0xae')]=util[_0xb29e('0xaf')](_0xb29e('0xb0'),_0x4c221d['name'],_0x4c221d[_0xb29e('0xb1')]);}if(_0x4c221d[_0xb29e('0xa5')]){if(_0x4c221d[_0xb29e('0xa5')][_0xb29e('0xa6')][_0xb29e('0x4a')]){return _0x4c221d[_0xb29e('0xa5')]['Contacts'][0x0];}else{return db[_0xb29e('0x75')][_0xb29e('0x5c')](_['defaults'](_0x344453[_0xb29e('0x5d')],{'firstName':_0x344453[_0xb29e('0x5d')]['to'][0x0],'phone':_0x344453[_0xb29e('0x5d')]['to'][0x0],'fax':_0x344453['body']['to'][0x0],'ListId':_0x4c221d[_0xb29e('0xb2')]}));}}else{throw new Error(_0xb29e('0xb3'));}}else{throw new Error(_0xb29e('0xb4'));}})[_0xb29e('0x20')](function(_0x55de3e){if(_0x55de3e){return db['FaxInteraction'][_0xb29e('0x5b')]({'where':{'ContactId':_0x55de3e['id'],'closed':![],'FaxAccountId':_0x4c221d['id']}})['then'](function(_0x22c9de){if(_0x22c9de){return[_0x22c9de,![]];}return db[_0xb29e('0x72')][_0xb29e('0x5c')]({'UserId':_0x344453[_0xb29e('0x5e')]['id'],'ContactId':_0x55de3e['id'],'FaxAccountId':_0x4c221d['id'],'fax':_0x344453[_0xb29e('0x5d')]['to'][0x0],'firstMsgDirection':'out','Messages':[_[_0xb29e('0x51')](_0x344453[_0xb29e('0x5d')],{'read':![],'body':_0x344453[_0xb29e('0x5d')][_0xb29e('0xa8')][0x0]['filename'],'FaxAccountId':_0x4c221d['id'],'UserId':_0x344453[_0xb29e('0x5e')]['id'],'ContactId':_0x55de3e['id'],'AttachmentId':_0x344453[_0xb29e('0x5d')][_0xb29e('0xa8')][0x0]['id']})]},{'include':[{'model':db[_0xb29e('0xa1')],'as':_0xb29e('0xb5')}]})['then'](function(_0x59f991){return[_0x59f991,!![]];});});}else{throw new Error(_0xb29e('0xb6'));}})[_0xb29e('0xb7')](function(_0x33a7b0,_0x5c2182){if(_0x5c2182){return _0x33a7b0;}return db[_0xb29e('0xa1')][_0xb29e('0x5c')]({'direction':_0xb29e('0xb8'),'read':![],'body':_0x344453['body']['attachments'][0x0][_0xb29e('0xb9')],'FaxAccountId':_0x4c221d['id'],'FaxInteractionId':_0x33a7b0['id'],'UserId':_0x344453[_0xb29e('0x5e')]['id'],'ContactId':_0x33a7b0[_0xb29e('0xba')],'AttachmentId':_0x344453[_0xb29e('0x5d')][_0xb29e('0xa8')][0x0]['id']})[_0xb29e('0x20')](function(_0x1eaca0){_0x33a7b0[_0xb29e('0xbb')]['Messages']=[];_0x33a7b0['dataValues'][_0xb29e('0xb5')][_0xb29e('0x88')](_0x1eaca0[_0xb29e('0xbb')]);return _0x33a7b0;});})[_0xb29e('0x20')](function(_0x1e1b8e){respondWithRpcPromise(_0xb29e('0xbc'),_0xb29e('0xbc'),{'FaxAccountId':_[_0xb29e('0xad')](_0x344453[_0xb29e('0x59')]['id'])?undefined:_0x344453[_0xb29e('0x59')]['id'],'path':_[_0xb29e('0xad')](_0x344453[_0xb29e('0x5d')][_0xb29e('0xa8')][0x0][_0xb29e('0x8')])?undefined:_0x344453[_0xb29e('0x5d')][_0xb29e('0xa8')][0x0]['path'],'fax':_[_0xb29e('0xad')](_0x344453[_0xb29e('0x5d')]['to'][0x0])?undefined:_0x344453[_0xb29e('0x5d')]['to'][0x0],'AttachmentId':_0x344453[_0xb29e('0x5d')]['attachments'][0x0]['id']},client9002)[_0xb29e('0x20')](function(_0x5a6d4b){logger[_0xb29e('0x21')](_0xb29e('0xbd'),_0x5a6d4b);})[_0xb29e('0x2a')](function(_0x562651){logger[_0xb29e('0x21')]('SendFaxRpc,\x20%s',_0x562651);});return _0x1e1b8e;})[_0xb29e('0x20')](respondWithResult(_0x3a3892,null))[_0xb29e('0x2a')](handleError(_0x3a3892,null));};exports[_0xb29e('0xbe')]=function(_0x4fad7a,_0x2c15e9,_0x1430b6){return db[_0xb29e('0x3e')][_0xb29e('0x5b')]({'where':{'id':_0x4fad7a[_0xb29e('0x59')]['id']}})[_0xb29e('0x20')](handleEntityNotFound(_0x2c15e9,null))['then'](function(_0x338474){if(_0x338474){return _0x338474['addAgents'](_0x4fad7a['body'][_0xb29e('0x70')],_[_0xb29e('0x73')](_0x4fad7a[_0xb29e('0x5d')],['ids','id'])||{})[_0xb29e('0xb7')](function(_0x177204){for(var _0xdd281=0x0;_0xdd281<_0x4fad7a[_0xb29e('0x5d')][_0xb29e('0x70')][_0xb29e('0x4a')];_0xdd281+=0x1){socket[_0xb29e('0xbf')](_0xb29e('0xc0'),{'UserId':_0x4fad7a['body']['ids'][_0xdd281],'FaxAccountId':_0x4fad7a[_0xb29e('0x59')]['id']});}return _0x177204;});}})[_0xb29e('0x20')](respondWithResult(_0x2c15e9,null))['catch'](handleError(_0x2c15e9,null));};exports['removeAgents']=function(_0x228dec,_0x1066ba,_0x16d7d4){return db[_0xb29e('0x3e')]['find']({'where':{'id':_0x228dec[_0xb29e('0x59')]['id']}})[_0xb29e('0x20')](handleEntityNotFound(_0x1066ba,null))[_0xb29e('0x20')](function(_0x126486){if(_0x126486){return _0x126486[_0xb29e('0xc1')](_0x228dec[_0xb29e('0x45')][_0xb29e('0x70')])[_0xb29e('0x20')](function(){if(_[_0xb29e('0xc2')](_0x228dec[_0xb29e('0x45')]['ids'])){for(var _0x42d646=0x0;_0x42d646<_0x228dec[_0xb29e('0x45')]['ids'][_0xb29e('0x4a')];_0x42d646+=0x1){socket[_0xb29e('0xbf')](_0xb29e('0xc3'),{'UserId':Number(_0x228dec[_0xb29e('0x45')][_0xb29e('0x70')][_0x42d646]),'FaxAccountId':Number(_0x228dec[_0xb29e('0x59')]['id'])});}}else{socket['emit'](_0xb29e('0xc3'),{'UserId':Number(_0x228dec[_0xb29e('0x45')]['ids']),'FaxAccountId':Number(_0x228dec[_0xb29e('0x59')]['id'])});}});}})['then'](respondWithStatusCode(_0x1066ba,null))[_0xb29e('0x2a')](handleError(_0x1066ba,null));};exports[_0xb29e('0xc4')]=function(_0x466f2b,_0x3664d1,_0x447f95){var _0xaa67ff={};var _0x172e08={};var _0x14fb3e;var _0x4d8e56;return db[_0xb29e('0x3e')]['findOne']({'where':{'id':_0x466f2b[_0xb29e('0x59')]['id']}})[_0xb29e('0x20')](handleEntityNotFound(_0x3664d1,null))[_0xb29e('0x20')](function(_0x15fece){if(_0x15fece){_0x14fb3e=_0x15fece;_0x172e08[_0xb29e('0x43')]=_[_0xb29e('0x5a')](db[_0xb29e('0x77')][_0xb29e('0x3f')]);_0x172e08[_0xb29e('0x45')]=_[_0xb29e('0x5a')](_0x466f2b[_0xb29e('0x45')]);_0x172e08[_0xb29e('0x46')]=_[_0xb29e('0x47')](_0x172e08[_0xb29e('0x43')],_0x172e08['query']);_0xaa67ff[_0xb29e('0x48')]=_[_0xb29e('0x47')](_0x172e08[_0xb29e('0x43')],qs[_0xb29e('0x49')](_0x466f2b[_0xb29e('0x45')][_0xb29e('0x49')]));_0xaa67ff[_0xb29e('0x48')]=_0xaa67ff[_0xb29e('0x48')]['length']?_0xaa67ff[_0xb29e('0x48')]:_0x172e08[_0xb29e('0x43')];_0xaa67ff['order']=qs[_0xb29e('0x4e')](_0x466f2b['query'][_0xb29e('0x4e')]);_0xaa67ff[_0xb29e('0x4f')]=qs[_0xb29e('0x46')](_[_0xb29e('0x50')](_0x466f2b[_0xb29e('0x45')],_0x172e08[_0xb29e('0x46')]));if(_0x466f2b[_0xb29e('0x45')][_0xb29e('0x53')]){_0xaa67ff[_0xb29e('0x4f')]=_['merge'](_0xaa67ff['where'],{'$or':_['map'](_0xaa67ff[_0xb29e('0x48')],function(_0x26b00f){var _0x35bd2e={};_0x35bd2e[_0x26b00f]={'$like':'%'+_0x466f2b['query'][_0xb29e('0x53')]+'%'};return _0x35bd2e;})});}_0xaa67ff=_[_0xb29e('0x51')]({},_0xaa67ff,_0x466f2b['options']);return _0x14fb3e[_0xb29e('0xc4')](_0xaa67ff);}})[_0xb29e('0x20')](function(_0x1d923e){if(_0x1d923e){_0x4d8e56=_0x1d923e[_0xb29e('0x4a')];if(!_0x466f2b[_0xb29e('0x45')]['hasOwnProperty']('nolimit')){_0xaa67ff[_0xb29e('0x2f')]=qs['limit'](_0x466f2b[_0xb29e('0x45')][_0xb29e('0x2f')]);_0xaa67ff['offset']=qs[_0xb29e('0x2e')](_0x466f2b[_0xb29e('0x45')][_0xb29e('0x2e')]);}return _0x14fb3e[_0xb29e('0xc4')](_0xaa67ff);}})['then'](function(_0x41c6a9){if(_0x41c6a9){return _0x41c6a9?{'count':_0x4d8e56,'rows':_0x41c6a9}:null;}})[_0xb29e('0x20')](respondWithResult(_0x3664d1,null))[_0xb29e('0x2a')](handleError(_0x3664d1,null));}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.events.js b/server/api/faxAccount/faxAccount.events.js index 4825078..f83a0ec 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 _0x60eb=['hasOwnProperty','hook','events','../../mysqldb','FaxAccount','setMaxListeners','save','update','remove','emit'];(function(_0x262be8,_0x599c41){var _0x594485=function(_0x436faf){while(--_0x436faf){_0x262be8['push'](_0x262be8['shift']());}};_0x594485(++_0x599c41);}(_0x60eb,0x142));var _0xb60e=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x60eb[_0x122ef9];return _0x42fba0;};'use strict';var EventEmitter=require(_0xb60e('0x0'));var FaxAccount=require(_0xb60e('0x1'))['db'][_0xb60e('0x2')];var FaxAccountEvents=new EventEmitter();FaxAccountEvents[_0xb60e('0x3')](0x0);var events={'afterCreate':_0xb60e('0x4'),'afterUpdate':_0xb60e('0x5'),'afterDestroy':_0xb60e('0x6')};function emitEvent(_0x436838){return function(_0x3df4e6,_0x16f04e,_0x14b10d){FaxAccountEvents[_0xb60e('0x7')](_0x436838+':'+_0x3df4e6['id'],_0x3df4e6);FaxAccountEvents[_0xb60e('0x7')](_0x436838,_0x3df4e6);_0x14b10d(null);};}for(var e in events){if(events[_0xb60e('0x8')](e)){var event=events[e];FaxAccount[_0xb60e('0x9')](e,emitEvent(event));}}module['exports']=FaxAccountEvents; \ No newline at end of file +var _0xb7d8=['remove','emit','hasOwnProperty','exports','events','../../mysqldb','FaxAccount','save'];(function(_0x3c3ccc,_0x419870){var _0x26ec55=function(_0x3ec764){while(--_0x3ec764){_0x3c3ccc['push'](_0x3c3ccc['shift']());}};_0x26ec55(++_0x419870);}(_0xb7d8,0x7c));var _0x8b7d=function(_0x170e2f,_0xae68e4){_0x170e2f=_0x170e2f-0x0;var _0x265067=_0xb7d8[_0x170e2f];return _0x265067;};'use strict';var EventEmitter=require(_0x8b7d('0x0'));var FaxAccount=require(_0x8b7d('0x1'))['db'][_0x8b7d('0x2')];var FaxAccountEvents=new EventEmitter();FaxAccountEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x8b7d('0x3'),'afterUpdate':'update','afterDestroy':_0x8b7d('0x4')};function emitEvent(_0x14c112){return function(_0x32cea7,_0x10a459,_0x5d9974){FaxAccountEvents[_0x8b7d('0x5')](_0x14c112+':'+_0x32cea7['id'],_0x32cea7);FaxAccountEvents[_0x8b7d('0x5')](_0x14c112,_0x32cea7);_0x5d9974(null);};}for(var e in events){if(events[_0x8b7d('0x6')](e)){var event=events[e];FaxAccount['hook'](e,emitEvent(event));}}module[_0x8b7d('0x7')]=FaxAccountEvents; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.model.js b/server/api/faxAccount/faxAccount.model.js index cf690d1..64adb41 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 _0x0d5b=['request-promise','path','rimraf','../../config/environment','./faxAccount.attributes','exports','define','FaxAccount','fax_accounts','util','../../config/logger','api','moment','bluebird'];(function(_0x1c60ef,_0x51da79){var _0x5b6b80=function(_0x1df436){while(--_0x1df436){_0x1c60ef['push'](_0x1c60ef['shift']());}};_0x5b6b80(++_0x51da79);}(_0x0d5b,0x87));var _0xb0d5=function(_0x50007c,_0x1cbf11){_0x50007c=_0x50007c-0x0;var _0x5c1ec7=_0x0d5b[_0x50007c];return _0x5c1ec7;};'use strict';var _=require('lodash');var util=require(_0xb0d5('0x0'));var logger=require(_0xb0d5('0x1'))(_0xb0d5('0x2'));var moment=require(_0xb0d5('0x3'));var BPromise=require(_0xb0d5('0x4'));var rp=require(_0xb0d5('0x5'));var fs=require('fs');var path=require(_0xb0d5('0x6'));var rimraf=require(_0xb0d5('0x7'));var config=require(_0xb0d5('0x8'));var attributes=require(_0xb0d5('0x9'));module[_0xb0d5('0xa')]=function(_0x7f533a,_0x59809f){return _0x7f533a[_0xb0d5('0xb')](_0xb0d5('0xc'),attributes,{'tableName':_0xb0d5('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4fd5=['util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./faxAccount.attributes','exports','define','FaxAccount','fax_accounts','lodash'];(function(_0x2ecd74,_0x43247c){var _0x2d6a1d=function(_0x3c0571){while(--_0x3c0571){_0x2ecd74['push'](_0x2ecd74['shift']());}};_0x2d6a1d(++_0x43247c);}(_0x4fd5,0x15d));var _0x54fd=function(_0x2d1691,_0x146891){_0x2d1691=_0x2d1691-0x0;var _0x320eb4=_0x4fd5[_0x2d1691];return _0x320eb4;};'use strict';var _=require(_0x54fd('0x0'));var util=require(_0x54fd('0x1'));var logger=require(_0x54fd('0x2'))(_0x54fd('0x3'));var moment=require(_0x54fd('0x4'));var BPromise=require(_0x54fd('0x5'));var rp=require(_0x54fd('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x54fd('0x7'));var config=require(_0x54fd('0x8'));var attributes=require(_0x54fd('0x9'));module[_0x54fd('0xa')]=function(_0x27932d,_0x259cdf){return _0x27932d[_0x54fd('0xb')](_0x54fd('0xc'),attributes,{'tableName':_0x54fd('0xd'),'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 257436c..00729ce 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 _0x0186=['fax','CmContact','describe','Sequelize','ValidationError','no\x20available\x20attributes','difference','keys','createdAt','updatedAt','CompanyId','ListId','from','isNil','includes','mapKey','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','find','CmList','List','Contacts','DESC','FaxApplication','Applications','get','account','list','applications','orderBy','priority','asc','create','contact','FaxInteraction','Contact\x20not\x20found','spread','close','unmanaged','*,*,*,*','created','interaction','FaxMessage','ContactId','AttachmentId','User','name','UserId','unshift','waitForTheAssignedAgent','Start','startRouting','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','jayson/promise','http','redis','defaults','socket.io-emitter','./faxAccount.socket','register','request','then','FaxAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','info','result','catch','GetFaxAccount','FaxAccount','findAll','options','where','attributes','limit','include','model','map','NotifyFaxAccount','body'];(function(_0x398945,_0x513743){var _0xc73f30=function(_0x12bcd8){while(--_0x12bcd8){_0x398945['push'](_0x398945['shift']());}};_0xc73f30(++_0x513743);}(_0x0186,0xe5));var _0x6018=function(_0x5c8187,_0x14d623){_0x5c8187=_0x5c8187-0x0;var _0x28fd43=_0x0186[_0x5c8187];return _0x28fd43;};'use strict';var _=require(_0x6018('0x0'));var util=require(_0x6018('0x1'));var moment=require(_0x6018('0x2'));var BPromise=require(_0x6018('0x3'));var rs=require(_0x6018('0x4'));var fs=require('fs');var Redis=require(_0x6018('0x5'));var db=require(_0x6018('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x6018('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0x6018('0x8'));var client=jayson['client'][_0x6018('0x9')]({'port':0x232c});config[_0x6018('0xa')]=_[_0x6018('0xb')](config[_0x6018('0xa')],{'host':'localhost','port':0x18eb});var socket=require(_0x6018('0xc'))(new Redis(config[_0x6018('0xa')]));require(_0x6018('0xd'))[_0x6018('0xe')](socket);function respondWithRpcPromise(_0x5765a3,_0x3ed283,_0x498199){return new BPromise(function(_0x3e7485,_0x3a1e6c){return client[_0x6018('0xf')](_0x5765a3,_0x498199)[_0x6018('0x10')](function(_0x2cdf0e){logger['info'](_0x6018('0x11'),_0x3ed283,_0x6018('0x12'));logger[_0x6018('0x13')]('FaxAccount,\x20%s,\x20%s,\x20%s',_0x3ed283,'request\x20sent',JSON[_0x6018('0x14')](_0x2cdf0e));if(_0x2cdf0e[_0x6018('0x15')]){if(_0x2cdf0e[_0x6018('0x15')]['code']===0x1f4){logger[_0x6018('0x15')](_0x6018('0x11'),_0x3ed283,_0x2cdf0e['error']['message']);return _0x3a1e6c(_0x2cdf0e[_0x6018('0x15')][_0x6018('0x16')]);}logger[_0x6018('0x15')](_0x6018('0x11'),_0x3ed283,_0x2cdf0e[_0x6018('0x15')][_0x6018('0x16')]);return _0x3e7485(_0x2cdf0e[_0x6018('0x15')]['message']);}else{logger[_0x6018('0x17')](_0x6018('0x11'),_0x3ed283,_0x6018('0x12'));_0x3e7485(_0x2cdf0e[_0x6018('0x18')][_0x6018('0x16')]);}})[_0x6018('0x19')](function(_0xdb3620){logger['error'](_0x6018('0x11'),_0x3ed283,_0xdb3620);_0x3a1e6c(_0xdb3620);});});}exports[_0x6018('0x1a')]=function(_0x65262b){var _0x5d7615=this;return new Promise(function(_0x1fff9b,_0x516d46){return db[_0x6018('0x1b')][_0x6018('0x1c')]({'raw':_0x65262b[_0x6018('0x1d')]?_0x65262b[_0x6018('0x1d')]['raw']===undefined?!![]:![]:!![],'where':_0x65262b[_0x6018('0x1d')]?_0x65262b[_0x6018('0x1d')][_0x6018('0x1e')]||null:null,'attributes':_0x65262b[_0x6018('0x1d')]?_0x65262b['options'][_0x6018('0x1f')]||null:null,'limit':_0x65262b[_0x6018('0x1d')]?_0x65262b[_0x6018('0x1d')][_0x6018('0x20')]||null:null,'include':_0x65262b[_0x6018('0x1d')]?_0x65262b[_0x6018('0x1d')][_0x6018('0x21')]?_['map'](_0x65262b[_0x6018('0x1d')][_0x6018('0x21')],function(_0x204b32){return{'model':db[_0x204b32[_0x6018('0x22')]],'as':_0x204b32['as'],'attributes':_0x204b32[_0x6018('0x1f')],'include':_0x204b32['include']?_[_0x6018('0x23')](_0x204b32['include'],function(_0x257f94){return{'model':db[_0x257f94[_0x6018('0x22')]],'as':_0x257f94['as'],'attributes':_0x257f94['attributes'],'include':_0x257f94[_0x6018('0x21')]?_[_0x6018('0x23')](_0x257f94[_0x6018('0x21')],function(_0x54030a){return{'model':db[_0x54030a[_0x6018('0x22')]],'as':_0x54030a['as'],'attributes':_0x54030a[_0x6018('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x6018('0x10')](function(_0x36f87a){logger['info'](_0x6018('0x1a'),_0x65262b);logger['debug'](_0x6018('0x1a'),_0x65262b,JSON[_0x6018('0x14')](_0x36f87a));_0x1fff9b(_0x36f87a);})[_0x6018('0x19')](function(_0x15627a){logger['error'](_0x6018('0x1a'),_0x15627a[_0x6018('0x16')],_0x65262b);_0x516d46(_0x5d7615[_0x6018('0x15')](0x1f4,_0x15627a[_0x6018('0x16')]));});});};exports[_0x6018('0x24')]=function(_0x42a537,_0x5a0a47,_0x4a35d2){var _0x20d2d0=this;return new Promise(function(_0x295b8c,_0x2e75a0){var _0x2f8e07={'body':_0x42a537[_0x6018('0x25')],'channel':_0x6018('0x26')};var _0x419525=[];var _0x4b0d30=[];var _0x1e320b={};return db[_0x6018('0x27')][_0x6018('0x28')]()[_0x6018('0x10')](function(_0x30d60e){if(!_0x30d60e){throw new db[(_0x6018('0x29'))][(_0x6018('0x2a'))](_0x6018('0x2b'));}_0x419525=_[_0x6018('0x2c')](_[_0x6018('0x2d')](_0x30d60e),[_0x6018('0x2e'),_0x6018('0x2f')]);_0x4b0d30=_[_0x6018('0x2c')](_[_0x6018('0x2d')](_0x30d60e),[_0x6018('0x2e'),_0x6018('0x2f'),_0x6018('0x30'),_0x6018('0x31')]);if(_0x42a537[_0x6018('0x25')]['id']){delete _0x42a537[_0x6018('0x25')]['id'];}if(_['isNil'](_0x42a537['body'][_0x6018('0x32')])){throw new db[(_0x6018('0x29'))][(_0x6018('0x2a'))]('from\x20is\x20mandatory');}if(_[_0x6018('0x33')](_0x42a537[_0x6018('0x25')][_0x6018('0x25')])||_0x42a537[_0x6018('0x25')][_0x6018('0x25')]===''){throw new db['Sequelize'][(_0x6018('0x2a'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0x6018('0x33')](_0x42a537['body']['mapKey'])){throw new db[(_0x6018('0x29'))]['ValidationError']('mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x4b0d30);}if(!_[_0x6018('0x34')](_0x4b0d30,_0x42a537['body'][_0x6018('0x35')])){throw new db[(_0x6018('0x29'))][(_0x6018('0x2a'))](_0x6018('0x36')+_0x4b0d30);}_0x1e320b[_0x42a537['body'][_0x6018('0x35')]]=_0x42a537[_0x6018('0x25')][_0x6018('0x32')];})[_0x6018('0x10')](function(){return db[_0x6018('0x1b')][_0x6018('0x37')]({'where':{'id':_0x42a537['account']['id']},'include':[{'model':db[_0x6018('0x38')],'as':_0x6018('0x39'),'include':[{'model':db[_0x6018('0x27')],'as':_0x6018('0x3a'),'where':_0x1e320b,'limit':0x1,'order':[[_0x6018('0x2f'),_0x6018('0x3b')]]}]},{'model':db[_0x6018('0x3c')],'as':_0x6018('0x3d')}]});})['then'](function(_0x2ae8ae){if(_0x2ae8ae&&_0x2ae8ae['List']){var _0x3e077f=_0x2ae8ae[_0x6018('0x3e')]({'plain':!![]});_0x2f8e07[_0x6018('0x3f')]=_0x3e077f;_0x2f8e07['applications']=_0x3e077f[_0x6018('0x3d')];_0x2f8e07[_0x6018('0x40')]=_0x3e077f['List'];_0x2f8e07[_0x6018('0x41')]=_[_0x6018('0x42')](_0x2f8e07[_0x6018('0x41')],[_0x6018('0x43')],[_0x6018('0x44')]);if(_0x2f8e07[_0x6018('0x3f')][_0x6018('0x3d')]){delete _0x2f8e07['account'][_0x6018('0x3d')];}if(_0x2f8e07[_0x6018('0x3f')][_0x6018('0x39')]&&_0x2f8e07[_0x6018('0x3f')]['List'][_0x6018('0x3a')]['length']){return _0x2f8e07[_0x6018('0x3f')][_0x6018('0x39')][_0x6018('0x3a')][0x0];}var _0x488375=_[_0x6018('0xb')](_0x42a537['body'],{'firstName':_0x42a537[_0x6018('0x25')][_0x6018('0x32')],'ListId':_0x3e077f['ListId']});_0x488375[_0x42a537[_0x6018('0x25')][_0x6018('0x35')]]=_0x42a537[_0x6018('0x25')]['from'];return db[_0x6018('0x27')][_0x6018('0x45')](_0x488375,{'fields':_0x419525,'raw':!![]});}})[_0x6018('0x10')](function(_0x582f4f){_0x2f8e07[_0x6018('0x46')]=_0x582f4f;if(_0x582f4f){var _0x21d2f4={'ContactId':_0x582f4f['id'],'FaxAccountId':_0x42a537[_0x6018('0x3f')]['id'],'fax':_0x582f4f[_0x6018('0x26')]};return db[_0x6018('0x47')][_0x6018('0x37')]({'where':{'ContactId':_0x582f4f['id'],'closed':![],'FaxAccountId':_0x42a537[_0x6018('0x3f')]['id']}})[_0x6018('0x10')](function(_0x194026){if(_0x194026){return[_0x194026,![]];}return db[_0x6018('0x47')][_0x6018('0x45')](_0x21d2f4)['then'](function(_0x275a63){return[_0x275a63,!![]];});});}else{throw new Error(_0x6018('0x48'));}})[_0x6018('0x49')](function(_0xc1318,_0x35f3c0){var _0x180dd2=_0xc1318['get']({'plain':!![]});if(_0x35f3c0){if(_0x2f8e07[_0x6018('0x3f')]['autoclose']){_0x2f8e07[_0x6018('0x41')]['push']({'id':0x0,'priority':_0x2f8e07[_0x6018('0x41')]['length']+0x1,'app':_0x6018('0x4a'),'appdata':_0x6018('0x4b'),'interval':_0x6018('0x4c')});}_0x180dd2['created']=!![];}else{_0x180dd2[_0x6018('0x4d')]=![];}_0x2f8e07[_0x6018('0x4e')]=_0x180dd2;return db[_0x6018('0x4f')]['create']({'body':_0x42a537[_0x6018('0x25')][_0x6018('0x25')],'FaxAccountId':_0x42a537[_0x6018('0x3f')]['id'],'FaxInteractionId':_0xc1318['id'],'direction':'in','ContactId':_0xc1318[_0x6018('0x50')],'AttachmentId':_0x42a537[_0x6018('0x25')][_0x6018('0x51')]});})[_0x6018('0x10')](function(_0x563bec){_0x2f8e07[_0x6018('0x16')]=_0x563bec;if(_0x2f8e07['interaction']['UserId']){return db[_0x6018('0x52')]['find']({'attributes':['id',_0x6018('0x53')],'where':{'id':_0x2f8e07[_0x6018('0x4e')][_0x6018('0x54')]}})[_0x6018('0x10')](function(_0x23188f){if(_0x23188f){_0x2f8e07[_0x6018('0x41')][_0x6018('0x55')]({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x23188f[_0x6018('0x53')]+','+(_0x2f8e07[_0x6018('0x3f')][_0x6018('0x56')]||0xa),'interval':'*,*,*,*'});}return respondWithRpcPromise(_0x6018('0x57'),_0x6018('0x58'),_0x2f8e07);});}return respondWithRpcPromise(_0x6018('0x57'),'startRouting',_0x2f8e07);})[_0x6018('0x10')](function(_0x4dc395){_0x295b8c(_0x4dc395);})[_0x6018('0x19')](function(_0x54228c){_0x2e75a0(_0x20d2d0[_0x6018('0x15')](0x1f4,_0x54228c[_0x6018('0x16')]));});});}; \ No newline at end of file +var _0x376b=['redis','defaults','localhost','./faxAccount.socket','register','then','FaxAccount,\x20%s,\x20%s','request\x20sent','debug','FaxAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','findAll','options','raw','where','attributes','include','map','model','GetFaxAccount','catch','NotifyFaxAccount','body','describe','Sequelize','ValidationError','difference','keys','createdAt','updatedAt','ListId','isNil','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','FaxAccount','find','CmList','List','CmContact','Contacts','DESC','FaxApplication','get','account','applications','Applications','orderBy','priority','length','from','mapKey','contact','fax','FaxInteraction','create','spread','autoclose','push','close','unmanaged','*,*,*,*','created','FaxMessage','ContactId','interaction','UserId','User','agent','name','waitForTheAssignedAgent','Start','startRouting','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x58965a,_0x2e71db){var _0x254efc=function(_0xf14fb4){while(--_0xf14fb4){_0x58965a['push'](_0x58965a['shift']());}};_0x254efc(++_0x2e71db);}(_0x376b,0x1c0));var _0xb376=function(_0x2692f8,_0x31f1b2){_0x2692f8=_0x2692f8-0x0;var _0x560968=_0x376b[_0x2692f8];return _0x560968;};'use strict';var _=require(_0xb376('0x0'));var util=require('util');var moment=require(_0xb376('0x1'));var BPromise=require('bluebird');var rs=require(_0xb376('0x2'));var fs=require('fs');var Redis=require(_0xb376('0x3'));var db=require(_0xb376('0x4'))['db'];var utils=require(_0xb376('0x5'));var logger=require(_0xb376('0x6'))(_0xb376('0x7'));var config=require(_0xb376('0x8'));var jayson=require(_0xb376('0x9'));var client=jayson[_0xb376('0xa')][_0xb376('0xb')]({'port':0x232c});config[_0xb376('0xc')]=_[_0xb376('0xd')](config['redis'],{'host':_0xb376('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xb376('0xc')]));require(_0xb376('0xf'))[_0xb376('0x10')](socket);function respondWithRpcPromise(_0x2d42ce,_0x255bcf,_0x734b69){return new BPromise(function(_0x578146,_0x48e340){return client['request'](_0x2d42ce,_0x734b69)[_0xb376('0x11')](function(_0x21df00){logger['info'](_0xb376('0x12'),_0x255bcf,_0xb376('0x13'));logger[_0xb376('0x14')](_0xb376('0x15'),_0x255bcf,_0xb376('0x13'),JSON[_0xb376('0x16')](_0x21df00));if(_0x21df00[_0xb376('0x17')]){if(_0x21df00[_0xb376('0x17')][_0xb376('0x18')]===0x1f4){logger['error'](_0xb376('0x12'),_0x255bcf,_0x21df00[_0xb376('0x17')][_0xb376('0x19')]);return _0x48e340(_0x21df00['error'][_0xb376('0x19')]);}logger['error']('FaxAccount,\x20%s,\x20%s',_0x255bcf,_0x21df00[_0xb376('0x17')]['message']);return _0x578146(_0x21df00[_0xb376('0x17')][_0xb376('0x19')]);}else{logger[_0xb376('0x1a')](_0xb376('0x12'),_0x255bcf,_0xb376('0x13'));_0x578146(_0x21df00[_0xb376('0x1b')][_0xb376('0x19')]);}})['catch'](function(_0x1ccc81){logger['error'](_0xb376('0x12'),_0x255bcf,_0x1ccc81);_0x48e340(_0x1ccc81);});});}exports['GetFaxAccount']=function(_0x125e6d){var _0x2c9cb7=this;return new Promise(function(_0x14e436,_0x573ed4){return db['FaxAccount'][_0xb376('0x1c')]({'raw':_0x125e6d[_0xb376('0x1d')]?_0x125e6d[_0xb376('0x1d')][_0xb376('0x1e')]===undefined?!![]:![]:!![],'where':_0x125e6d[_0xb376('0x1d')]?_0x125e6d[_0xb376('0x1d')][_0xb376('0x1f')]||null:null,'attributes':_0x125e6d[_0xb376('0x1d')]?_0x125e6d[_0xb376('0x1d')][_0xb376('0x20')]||null:null,'limit':_0x125e6d[_0xb376('0x1d')]?_0x125e6d[_0xb376('0x1d')]['limit']||null:null,'include':_0x125e6d['options']?_0x125e6d[_0xb376('0x1d')][_0xb376('0x21')]?_[_0xb376('0x22')](_0x125e6d[_0xb376('0x1d')][_0xb376('0x21')],function(_0x3c0ac6){return{'model':db[_0x3c0ac6[_0xb376('0x23')]],'as':_0x3c0ac6['as'],'attributes':_0x3c0ac6[_0xb376('0x20')],'include':_0x3c0ac6[_0xb376('0x21')]?_['map'](_0x3c0ac6[_0xb376('0x21')],function(_0x2cf9ab){return{'model':db[_0x2cf9ab[_0xb376('0x23')]],'as':_0x2cf9ab['as'],'attributes':_0x2cf9ab[_0xb376('0x20')],'include':_0x2cf9ab[_0xb376('0x21')]?_[_0xb376('0x22')](_0x2cf9ab['include'],function(_0x4d60be){return{'model':db[_0x4d60be[_0xb376('0x23')]],'as':_0x4d60be['as'],'attributes':_0x4d60be[_0xb376('0x20')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x28f31e){logger[_0xb376('0x1a')](_0xb376('0x24'),_0x125e6d);logger[_0xb376('0x14')](_0xb376('0x24'),_0x125e6d,JSON['stringify'](_0x28f31e));_0x14e436(_0x28f31e);})[_0xb376('0x25')](function(_0x24c0a3){logger['error'](_0xb376('0x24'),_0x24c0a3[_0xb376('0x19')],_0x125e6d);_0x573ed4(_0x2c9cb7[_0xb376('0x17')](0x1f4,_0x24c0a3[_0xb376('0x19')]));});});};exports[_0xb376('0x26')]=function(_0x2862fa,_0x502802,_0xdd2a1d){var _0x2ee07f=this;return new Promise(function(_0x5a6849,_0x3cdcbd){var _0x441305={'body':_0x2862fa[_0xb376('0x27')],'channel':'fax'};var _0x3fe0eb=[];var _0x1616a6=[];var _0xc27d97={};return db['CmContact'][_0xb376('0x28')]()[_0xb376('0x11')](function(_0x50b959){if(!_0x50b959){throw new db[(_0xb376('0x29'))][(_0xb376('0x2a'))]('no\x20available\x20attributes');}_0x3fe0eb=_[_0xb376('0x2b')](_[_0xb376('0x2c')](_0x50b959),[_0xb376('0x2d'),'updatedAt']);_0x1616a6=_['difference'](_['keys'](_0x50b959),[_0xb376('0x2d'),_0xb376('0x2e'),'CompanyId',_0xb376('0x2f')]);if(_0x2862fa[_0xb376('0x27')]['id']){delete _0x2862fa[_0xb376('0x27')]['id'];}if(_[_0xb376('0x30')](_0x2862fa['body']['from'])){throw new db[(_0xb376('0x29'))][(_0xb376('0x2a'))](_0xb376('0x31'));}if(_[_0xb376('0x30')](_0x2862fa['body']['body'])||_0x2862fa['body'][_0xb376('0x27')]===''){throw new db[(_0xb376('0x29'))][(_0xb376('0x2a'))](_0xb376('0x32'));}if(_[_0xb376('0x30')](_0x2862fa[_0xb376('0x27')]['mapKey'])){throw new db[(_0xb376('0x29'))][(_0xb376('0x2a'))](_0xb376('0x33')+_0x1616a6);}if(!_[_0xb376('0x34')](_0x1616a6,_0x2862fa[_0xb376('0x27')]['mapKey'])){throw new db[(_0xb376('0x29'))]['ValidationError'](_0xb376('0x35')+_0x1616a6);}_0xc27d97[_0x2862fa[_0xb376('0x27')]['mapKey']]=_0x2862fa['body']['from'];})[_0xb376('0x11')](function(){return db[_0xb376('0x36')][_0xb376('0x37')]({'where':{'id':_0x2862fa['account']['id']},'include':[{'model':db[_0xb376('0x38')],'as':_0xb376('0x39'),'include':[{'model':db[_0xb376('0x3a')],'as':_0xb376('0x3b'),'where':_0xc27d97,'limit':0x1,'order':[[_0xb376('0x2e'),_0xb376('0x3c')]]}]},{'model':db[_0xb376('0x3d')],'as':'Applications'}]});})[_0xb376('0x11')](function(_0x3a1a2b){if(_0x3a1a2b&&_0x3a1a2b[_0xb376('0x39')]){var _0x62c600=_0x3a1a2b[_0xb376('0x3e')]({'plain':!![]});_0x441305[_0xb376('0x3f')]=_0x62c600;_0x441305[_0xb376('0x40')]=_0x62c600[_0xb376('0x41')];_0x441305['list']=_0x62c600[_0xb376('0x39')];_0x441305['applications']=_[_0xb376('0x42')](_0x441305['applications'],[_0xb376('0x43')],['asc']);if(_0x441305[_0xb376('0x3f')][_0xb376('0x41')]){delete _0x441305[_0xb376('0x3f')][_0xb376('0x41')];}if(_0x441305['account'][_0xb376('0x39')]&&_0x441305[_0xb376('0x3f')]['List'][_0xb376('0x3b')][_0xb376('0x44')]){return _0x441305[_0xb376('0x3f')][_0xb376('0x39')][_0xb376('0x3b')][0x0];}var _0xb7a241=_['defaults'](_0x2862fa[_0xb376('0x27')],{'firstName':_0x2862fa[_0xb376('0x27')][_0xb376('0x45')],'ListId':_0x62c600['ListId']});_0xb7a241[_0x2862fa[_0xb376('0x27')][_0xb376('0x46')]]=_0x2862fa[_0xb376('0x27')][_0xb376('0x45')];return db['CmContact']['create'](_0xb7a241,{'fields':_0x3fe0eb,'raw':!![]});}})[_0xb376('0x11')](function(_0x28ddf4){_0x441305[_0xb376('0x47')]=_0x28ddf4;if(_0x28ddf4){var _0x76630e={'ContactId':_0x28ddf4['id'],'FaxAccountId':_0x2862fa[_0xb376('0x3f')]['id'],'fax':_0x28ddf4[_0xb376('0x48')]};return db[_0xb376('0x49')][_0xb376('0x37')]({'where':{'ContactId':_0x28ddf4['id'],'closed':![],'FaxAccountId':_0x2862fa[_0xb376('0x3f')]['id']}})[_0xb376('0x11')](function(_0xc2acc6){if(_0xc2acc6){return[_0xc2acc6,![]];}return db['FaxInteraction'][_0xb376('0x4a')](_0x76630e)[_0xb376('0x11')](function(_0x51213b){return[_0x51213b,!![]];});});}else{throw new Error('Contact\x20not\x20found');}})[_0xb376('0x4b')](function(_0x3210c8,_0x5c6266){var _0x56a81d=_0x3210c8['get']({'plain':!![]});if(_0x5c6266){if(_0x441305[_0xb376('0x3f')][_0xb376('0x4c')]){_0x441305[_0xb376('0x40')][_0xb376('0x4d')]({'id':0x0,'priority':_0x441305[_0xb376('0x40')][_0xb376('0x44')]+0x1,'app':_0xb376('0x4e'),'appdata':_0xb376('0x4f'),'interval':_0xb376('0x50')});}_0x56a81d[_0xb376('0x51')]=!![];}else{_0x56a81d['created']=![];}_0x441305['interaction']=_0x56a81d;return db[_0xb376('0x52')]['create']({'body':_0x2862fa[_0xb376('0x27')][_0xb376('0x27')],'FaxAccountId':_0x2862fa[_0xb376('0x3f')]['id'],'FaxInteractionId':_0x3210c8['id'],'direction':'in','ContactId':_0x3210c8[_0xb376('0x53')],'AttachmentId':_0x2862fa[_0xb376('0x27')]['AttachmentId']});})[_0xb376('0x11')](function(_0x1930e0){_0x441305[_0xb376('0x19')]=_0x1930e0;if(_0x441305[_0xb376('0x54')][_0xb376('0x55')]){return db[_0xb376('0x56')][_0xb376('0x37')]({'attributes':['id','name'],'where':{'id':_0x441305['interaction']['UserId']}})[_0xb376('0x11')](function(_0x234581){if(_0x234581){_0x441305[_0xb376('0x40')]['unshift']({'id':0x0,'priority':0x0,'app':_0xb376('0x57'),'appdata':_0x234581[_0xb376('0x58')]+','+(_0x441305['account'][_0xb376('0x59')]||0xa),'interval':_0xb376('0x50')});}return respondWithRpcPromise(_0xb376('0x5a'),_0xb376('0x5b'),_0x441305);});}return respondWithRpcPromise(_0xb376('0x5a'),'startRouting',_0x441305);})[_0xb376('0x11')](function(_0x329dd7){_0x5a6849(_0x329dd7);})['catch'](function(_0x22cea1){_0x3cdcbd(_0x2ee07f[_0xb376('0x17')](0x1f4,_0x22cea1[_0xb376('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.socket.js b/server/api/faxAccount/faxAccount.socket.js index 3c2e82d..1cb2664 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 _0x7046=['./faxAccount.events','save','remove','update','emit','removeListener','register','length','faxAccount:'];(function(_0x4bb66f,_0x3cd682){var _0xf2772f=function(_0x2e3698){while(--_0x2e3698){_0x4bb66f['push'](_0x4bb66f['shift']());}};_0xf2772f(++_0x3cd682);}(_0x7046,0x144));var _0x6704=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x7046[_0x2641f9];return _0x585741;};'use strict';var FaxAccountEvents=require(_0x6704('0x0'));var events=[_0x6704('0x1'),_0x6704('0x2'),_0x6704('0x3')];function createListener(_0x54a895,_0x1fd895){return function(_0x4399c6){_0x1fd895[_0x6704('0x4')](_0x54a895,_0x4399c6);};}function removeListener(_0x5258e7,_0x1e9b2a){return function(){FaxAccountEvents[_0x6704('0x5')](_0x5258e7,_0x1e9b2a);};}exports[_0x6704('0x6')]=function(_0x626a14){for(var _0x2917be=0x0,_0x4badf8=events[_0x6704('0x7')];_0x2917be<_0x4badf8;_0x2917be++){var _0x49b8b6=events[_0x2917be];var _0x56b1ff=createListener(_0x6704('0x8')+_0x49b8b6,_0x626a14);FaxAccountEvents['on'](_0x49b8b6,_0x56b1ff);}}; \ No newline at end of file +var _0x7278=['length','faxAccount:','./faxAccount.events','save','remove','update','emit','removeListener','register'];(function(_0x3238ea,_0x91809d){var _0x4aaac2=function(_0xc5b102){while(--_0xc5b102){_0x3238ea['push'](_0x3238ea['shift']());}};_0x4aaac2(++_0x91809d);}(_0x7278,0x161));var _0x8727=function(_0x269362,_0x5173e6){_0x269362=_0x269362-0x0;var _0x48ee4e=_0x7278[_0x269362];return _0x48ee4e;};'use strict';var FaxAccountEvents=require(_0x8727('0x0'));var events=[_0x8727('0x1'),_0x8727('0x2'),_0x8727('0x3')];function createListener(_0x2ee64e,_0x5822da){return function(_0x1ddbe9){_0x5822da[_0x8727('0x4')](_0x2ee64e,_0x1ddbe9);};}function removeListener(_0x6007de,_0x221021){return function(){FaxAccountEvents[_0x8727('0x5')](_0x6007de,_0x221021);};}exports[_0x8727('0x6')]=function(_0x180b71){for(var _0x5549d5=0x0,_0xfd1902=events[_0x8727('0x7')];_0x5549d5<_0xfd1902;_0x5549d5++){var _0xffd783=events[_0x5549d5];var _0x435911=createListener(_0x8727('0x8')+_0xffd783,_0x180b71);FaxAccountEvents['on'](_0xffd783,_0x435911);}}; \ No newline at end of file diff --git a/server/api/faxAccount/index.js b/server/api/faxAccount/index.js index 17c07fd..75bad22 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 _0xe4fa=['post','/:id/dispositions','addAnswer','/:id/interactions','addInteraction','/:id/applications','addApplications','/addaccountapplications','addAccountApplications','updateAccountApplications','/:id/send','send','addAgents','put','update','delete','destroy','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxAccount.controller','get','isAuthenticated','index','/describe','/:id','show','getDispositions','/:id/canned_answers','getAnswers','getInteractions','/:id/messages','getMessages','/:id/users','getAgents'];(function(_0x171bde,_0x15afe7){var _0x42fb16=function(_0xfc00f1){while(--_0xfc00f1){_0x171bde['push'](_0x171bde['shift']());}};_0x42fb16(++_0x15afe7);}(_0xe4fa,0x15a));var _0xae4f=function(_0x2c9057,_0x2b3d6f){_0x2c9057=_0x2c9057-0x0;var _0x578dc6=_0xe4fa[_0x2c9057];return _0x578dc6;};'use strict';var multer=require(_0xae4f('0x0'));var util=require('util');var path=require(_0xae4f('0x1'));var timeout=require(_0xae4f('0x2'));var express=require(_0xae4f('0x3'));var router=express[_0xae4f('0x4')]();var auth=require(_0xae4f('0x5'));var interaction=require(_0xae4f('0x6'));var config=require(_0xae4f('0x7'));var controller=require(_0xae4f('0x8'));router[_0xae4f('0x9')]('/',auth[_0xae4f('0xa')](),controller[_0xae4f('0xb')]);router[_0xae4f('0x9')](_0xae4f('0xc'),auth[_0xae4f('0xa')](),controller['describe']);router[_0xae4f('0x9')](_0xae4f('0xd'),auth['isAuthenticated'](),controller[_0xae4f('0xe')]);router['get']('/:id/dispositions',auth[_0xae4f('0xa')](),controller[_0xae4f('0xf')]);router['get'](_0xae4f('0x10'),auth[_0xae4f('0xa')](),controller[_0xae4f('0x11')]);router[_0xae4f('0x9')]('/:id/interactions',auth['isAuthenticated'](),controller[_0xae4f('0x12')]);router[_0xae4f('0x9')]('/:id/applications',auth[_0xae4f('0xa')](),controller['getApplications']);router['get'](_0xae4f('0x13'),auth[_0xae4f('0xa')](),controller[_0xae4f('0x14')]);router[_0xae4f('0x9')](_0xae4f('0x15'),auth['isAuthenticated'](),controller[_0xae4f('0x16')]);router[_0xae4f('0x17')]('/',auth[_0xae4f('0xa')](),controller['create']);router[_0xae4f('0x17')](_0xae4f('0x18'),auth[_0xae4f('0xa')](),controller['addDisposition']);router[_0xae4f('0x17')](_0xae4f('0x10'),auth['isAuthenticated'](),controller[_0xae4f('0x19')]);router['post'](_0xae4f('0x1a'),auth['isAuthenticated'](),controller[_0xae4f('0x1b')]);router[_0xae4f('0x17')](_0xae4f('0x1c'),auth[_0xae4f('0xa')](),controller[_0xae4f('0x1d')]);router[_0xae4f('0x17')](_0xae4f('0x1e'),auth['isAuthenticated'](),controller[_0xae4f('0x1f')]);router[_0xae4f('0x17')]('/updateaccountapplications',auth[_0xae4f('0xa')](),controller[_0xae4f('0x20')]);router[_0xae4f('0x17')](_0xae4f('0x21'),auth[_0xae4f('0xa')](),controller[_0xae4f('0x22')]);router[_0xae4f('0x17')]('/:id/users',auth[_0xae4f('0xa')](),controller[_0xae4f('0x23')]);router[_0xae4f('0x24')]('/:id',auth['isAuthenticated'](),controller[_0xae4f('0x25')]);router[_0xae4f('0x26')](_0xae4f('0xd'),auth[_0xae4f('0xa')](),controller[_0xae4f('0x27')]);router[_0xae4f('0x26')](_0xae4f('0x18'),auth[_0xae4f('0xa')](),controller['removeDispositions']);router[_0xae4f('0x26')]('/:id/canned_answers',auth[_0xae4f('0xa')](),controller['removeAnswers']);router['delete']('/:id/users',auth[_0xae4f('0xa')](),controller['removeAgents']);module[_0xae4f('0x28')]=router; \ No newline at end of file +var _0xfe3c=['/:id','show','/:id/dispositions','getDispositions','getAnswers','/:id/interactions','getInteractions','/:id/applications','/:id/messages','getMessages','/:id/users','post','create','addDisposition','addInteraction','/addaccountapplications','addAccountApplications','/updateaccountapplications','updateAccountApplications','/:id/send','send','addAgents','put','update','delete','destroy','/:id/canned_answers','removeAnswers','removeAgents','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxAccount.controller','get','index','/describe','isAuthenticated'];(function(_0x403be2,_0x1d4b99){var _0x252fe4=function(_0xe04bbc){while(--_0xe04bbc){_0x403be2['push'](_0x403be2['shift']());}};_0x252fe4(++_0x1d4b99);}(_0xfe3c,0x76));var _0xcfe3=function(_0x422941,_0xe77aac){_0x422941=_0x422941-0x0;var _0x4729d1=_0xfe3c[_0x422941];return _0x4729d1;};'use strict';var multer=require(_0xcfe3('0x0'));var util=require(_0xcfe3('0x1'));var path=require(_0xcfe3('0x2'));var timeout=require(_0xcfe3('0x3'));var express=require(_0xcfe3('0x4'));var router=express[_0xcfe3('0x5')]();var auth=require(_0xcfe3('0x6'));var interaction=require(_0xcfe3('0x7'));var config=require(_0xcfe3('0x8'));var controller=require(_0xcfe3('0x9'));router[_0xcfe3('0xa')]('/',auth['isAuthenticated'](),controller[_0xcfe3('0xb')]);router[_0xcfe3('0xa')](_0xcfe3('0xc'),auth[_0xcfe3('0xd')](),controller['describe']);router[_0xcfe3('0xa')](_0xcfe3('0xe'),auth[_0xcfe3('0xd')](),controller[_0xcfe3('0xf')]);router['get'](_0xcfe3('0x10'),auth['isAuthenticated'](),controller[_0xcfe3('0x11')]);router[_0xcfe3('0xa')]('/:id/canned_answers',auth[_0xcfe3('0xd')](),controller[_0xcfe3('0x12')]);router[_0xcfe3('0xa')](_0xcfe3('0x13'),auth[_0xcfe3('0xd')](),controller[_0xcfe3('0x14')]);router['get'](_0xcfe3('0x15'),auth['isAuthenticated'](),controller['getApplications']);router[_0xcfe3('0xa')](_0xcfe3('0x16'),auth[_0xcfe3('0xd')](),controller[_0xcfe3('0x17')]);router['get'](_0xcfe3('0x18'),auth[_0xcfe3('0xd')](),controller['getAgents']);router[_0xcfe3('0x19')]('/',auth['isAuthenticated'](),controller[_0xcfe3('0x1a')]);router[_0xcfe3('0x19')](_0xcfe3('0x10'),auth[_0xcfe3('0xd')](),controller[_0xcfe3('0x1b')]);router['post']('/:id/canned_answers',auth['isAuthenticated'](),controller['addAnswer']);router['post'](_0xcfe3('0x13'),auth[_0xcfe3('0xd')](),controller[_0xcfe3('0x1c')]);router['post']('/:id/applications',auth[_0xcfe3('0xd')](),controller['addApplications']);router[_0xcfe3('0x19')](_0xcfe3('0x1d'),auth['isAuthenticated'](),controller[_0xcfe3('0x1e')]);router[_0xcfe3('0x19')](_0xcfe3('0x1f'),auth[_0xcfe3('0xd')](),controller[_0xcfe3('0x20')]);router[_0xcfe3('0x19')](_0xcfe3('0x21'),auth[_0xcfe3('0xd')](),controller[_0xcfe3('0x22')]);router[_0xcfe3('0x19')](_0xcfe3('0x18'),auth[_0xcfe3('0xd')](),controller[_0xcfe3('0x23')]);router[_0xcfe3('0x24')](_0xcfe3('0xe'),auth['isAuthenticated'](),controller[_0xcfe3('0x25')]);router[_0xcfe3('0x26')]('/:id',auth['isAuthenticated'](),controller[_0xcfe3('0x27')]);router[_0xcfe3('0x26')](_0xcfe3('0x10'),auth[_0xcfe3('0xd')](),controller['removeDispositions']);router[_0xcfe3('0x26')](_0xcfe3('0x28'),auth[_0xcfe3('0xd')](),controller[_0xcfe3('0x29')]);router[_0xcfe3('0x26')]('/:id/users',auth['isAuthenticated'](),controller[_0xcfe3('0x2a')]);module[_0xcfe3('0x2b')]=router; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.attributes.js b/server/api/faxApplication/faxApplication.attributes.js index e1ee4fb..6d80060 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 _0xf3dc=['TEXT','INTEGER','STRING','noop'];(function(_0x1c8314,_0x512e7e){var _0x4bfc4b=function(_0x2d8410){while(--_0x2d8410){_0x1c8314['push'](_0x1c8314['shift']());}};_0x4bfc4b(++_0x512e7e);}(_0xf3dc,0x1a5));var _0xcf3d=function(_0x12c98e,_0x2d0b4b){_0x12c98e=_0x12c98e-0x0;var _0x198b35=_0xf3dc[_0x12c98e];return _0x198b35;};'use strict';var Sequelize=require('sequelize');module['exports']={'priority':{'type':Sequelize[_0xcf3d('0x0')],'allowNull':![]},'app':{'type':Sequelize[_0xcf3d('0x1')],'allowNull':![],'defaultValue':_0xcf3d('0x2')},'appdata':{'type':Sequelize[_0xcf3d('0x3')]()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize['STRING'],'defaultValue':'*,*,*,*'}}; \ No newline at end of file +var _0x6636=['exports','STRING','noop','TEXT','*,*,*,*','sequelize'];(function(_0x29b609,_0x19d388){var _0x54c952=function(_0xb3c38d){while(--_0xb3c38d){_0x29b609['push'](_0x29b609['shift']());}};_0x54c952(++_0x19d388);}(_0x6636,0x119));var _0x6663=function(_0x5444c4,_0x123c56){_0x5444c4=_0x5444c4-0x0;var _0x371206=_0x6636[_0x5444c4];return _0x371206;};'use strict';var Sequelize=require(_0x6663('0x0'));module[_0x6663('0x1')]={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize[_0x6663('0x2')],'allowNull':![],'defaultValue':_0x6663('0x3')},'appdata':{'type':Sequelize[_0x6663('0x4')]()},'description':{'type':Sequelize[_0x6663('0x2')]},'interval':{'type':Sequelize[_0x6663('0x2')],'defaultValue':_0x6663('0x5')}}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.controller.js b/server/api/faxApplication/faxApplication.controller.js index fb54bbc..cda9dc3 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 _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(_0xd816e2,_0x5edac2){var _0x1f5924=function(_0x1bcbf0){while(--_0x1bcbf0){_0xd816e2['push'](_0xd816e2['shift']());}};_0x1f5924(++_0x5edac2);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x17b6e3,_0x4522ed){_0x17b6e3=_0x17b6e3-0x0;var _0x3906f3=_0xc4aa[_0x17b6e3];return _0x3906f3;};'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 +var _0x1261=['model','fields','attributes','hasOwnProperty','nolimit','order','sort','filters','pick','filter','where','type','merge','options','includeAll','findAll','rows','show','params','keys','length','include','catch','create','body','update','find','destroy','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','ejs','lodash','crypto','jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/utils','../../mysqldb','sendStatus','status','end','json','count','offset','limit','Content-Range','apply','reject','save','then','error','stack','name','index','FaxApplication','rawAttributes','fieldName','key','map','query','intersection'];(function(_0x547d24,_0x21514a){var _0x49b3ab=function(_0x2ac36d){while(--_0x2ac36d){_0x547d24['push'](_0x547d24['shift']());}};_0x49b3ab(++_0x21514a);}(_0x1261,0x144));var _0x1126=function(_0x2134b7,_0x1eb5e2){_0x2134b7=_0x2134b7-0x0;var _0x6c5914=_0x1261[_0x2134b7];return _0x6c5914;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x1126('0x0'));var rimraf=require(_0x1126('0x1'));var zipdir=require(_0x1126('0x2'));var jsonpatch=require(_0x1126('0x3'));var rp=require(_0x1126('0x4'));var moment=require(_0x1126('0x5'));var BPromise=require(_0x1126('0x6'));var Mustache=require(_0x1126('0x7'));var util=require(_0x1126('0x8'));var path=require(_0x1126('0x9'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x1126('0xa'));var fs=require('fs');var _=require(_0x1126('0xb'));var squel=require('squel');var crypto=require(_0x1126('0xc'));var jsforce=require(_0x1126('0xd'));var deskjs=require(_0x1126('0xe'));var toCsv=require(_0x1126('0xf'));var querystring=require(_0x1126('0x10'));var Papa=require('papaparse');var Redis=require(_0x1126('0x11'));var authService=require(_0x1126('0x12'));var qs=require(_0x1126('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x1126('0x14'));var logger=require('../../config/logger')('api');var utils=require(_0x1126('0x15'));var config=require('../../config/environment');var db=require(_0x1126('0x16'))['db'];function respondWithStatusCode(_0x1b364a,_0xd26a32){_0xd26a32=_0xd26a32||0xcc;return function(_0x273896){if(_0x273896){return _0x1b364a[_0x1126('0x17')](_0xd26a32);}return _0x1b364a[_0x1126('0x18')](_0xd26a32)[_0x1126('0x19')]();};}function respondWithResult(_0x2048ad,_0x43850b){_0x43850b=_0x43850b||0xc8;return function(_0x53a8f0){if(_0x53a8f0){return _0x2048ad['status'](_0x43850b)[_0x1126('0x1a')](_0x53a8f0);}};}function respondWithFilteredResult(_0x154e20,_0x279455){return function(_0x4be0c6){if(_0x4be0c6){var _0x45149c=_0x4be0c6[_0x1126('0x1b')],_0x4794a7=_0x279455['offset'],_0x35fe9f=_0x279455[_0x1126('0x1c')]+_0x279455[_0x1126('0x1d')],_0x42f379;if(_0x35fe9f>=_0x45149c){_0x35fe9f=_0x45149c;_0x42f379=0xc8;}else{_0x42f379=0xce;}_0x154e20['status'](_0x42f379);return _0x154e20['set'](_0x1126('0x1e'),_0x4794a7+'-'+_0x35fe9f+'/'+_0x45149c)[_0x1126('0x1a')](_0x4be0c6);}return null;};}function patchUpdates(_0x58d11a){return function(_0x548359){try{jsonpatch[_0x1126('0x1f')](_0x548359,_0x58d11a,!![]);}catch(_0x58b109){return BPromise[_0x1126('0x20')](_0x58b109);}return _0x548359[_0x1126('0x21')]();};}function saveUpdates(_0x2f70ac,_0x54400a){return function(_0x2a08ba){if(_0x2a08ba){return _0x2a08ba['update'](_0x2f70ac)['then'](function(_0x30f6b3){return _0x30f6b3;});}return null;};}function removeEntity(_0x3a9bed,_0x25b24b){return function(_0x36d254){if(_0x36d254){return _0x36d254['destroy']()[_0x1126('0x22')](function(){_0x3a9bed[_0x1126('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2175fa,_0x59cd8e){return function(_0x529dd9){if(!_0x529dd9){_0x2175fa['sendStatus'](0x194);}return _0x529dd9;};}function handleError(_0x2199d9,_0x15bcc3){_0x15bcc3=_0x15bcc3||0x1f4;return function(_0x329914){logger[_0x1126('0x23')](_0x329914[_0x1126('0x24')]);if(_0x329914[_0x1126('0x25')]){delete _0x329914[_0x1126('0x25')];}_0x2199d9[_0x1126('0x18')](_0x15bcc3)['send'](_0x329914);};}exports[_0x1126('0x26')]=function(_0x375e59,_0xa293f4){var _0x5ddf63={},_0x541bc9={},_0xeb7d89={'count':0x0,'rows':[]};var _0x39bf0e=_['map'](db[_0x1126('0x27')][_0x1126('0x28')],function(_0x4a334a){return{'name':_0x4a334a[_0x1126('0x29')],'type':_0x4a334a['type'][_0x1126('0x2a')]};});_0x541bc9['model']=_[_0x1126('0x2b')](_0x39bf0e,'name');_0x541bc9[_0x1126('0x2c')]=_['keys'](_0x375e59['query']);_0x541bc9['filters']=_[_0x1126('0x2d')](_0x541bc9[_0x1126('0x2e')],_0x541bc9[_0x1126('0x2c')]);_0x5ddf63['attributes']=_[_0x1126('0x2d')](_0x541bc9[_0x1126('0x2e')],qs['fields'](_0x375e59[_0x1126('0x2c')][_0x1126('0x2f')]));_0x5ddf63[_0x1126('0x30')]=_0x5ddf63[_0x1126('0x30')]['length']?_0x5ddf63['attributes']:_0x541bc9[_0x1126('0x2e')];if(!_0x375e59[_0x1126('0x2c')][_0x1126('0x31')](_0x1126('0x32'))){_0x5ddf63['limit']=qs[_0x1126('0x1d')](_0x375e59[_0x1126('0x2c')][_0x1126('0x1d')]);_0x5ddf63[_0x1126('0x1c')]=qs[_0x1126('0x1c')](_0x375e59['query'][_0x1126('0x1c')]);}_0x5ddf63[_0x1126('0x33')]=qs[_0x1126('0x34')](_0x375e59[_0x1126('0x2c')]['sort']);_0x5ddf63['where']=qs[_0x1126('0x35')](_[_0x1126('0x36')](_0x375e59['query'],_0x541bc9[_0x1126('0x35')]),_0x39bf0e);if(_0x375e59[_0x1126('0x2c')][_0x1126('0x37')]){_0x5ddf63['where']=_['merge'](_0x5ddf63[_0x1126('0x38')],{'$or':_[_0x1126('0x2b')](_0x39bf0e,function(_0x3aa08f){if(_0x3aa08f[_0x1126('0x39')]!=='VIRTUAL'){var _0x428d3d={};_0x428d3d[_0x3aa08f['name']]={'$like':'%'+_0x375e59[_0x1126('0x2c')][_0x1126('0x37')]+'%'};return _0x428d3d;}})});}_0x5ddf63=_[_0x1126('0x3a')]({},_0x5ddf63,_0x375e59[_0x1126('0x3b')]);var _0x57e5d2={'where':_0x5ddf63['where']};return db[_0x1126('0x27')][_0x1126('0x1b')](_0x57e5d2)[_0x1126('0x22')](function(_0x397e3b){_0xeb7d89[_0x1126('0x1b')]=_0x397e3b;if(_0x375e59[_0x1126('0x2c')][_0x1126('0x3c')]){_0x5ddf63['include']=[{'all':!![]}];}return db[_0x1126('0x27')][_0x1126('0x3d')](_0x5ddf63);})[_0x1126('0x22')](function(_0xf3a0bd){_0xeb7d89[_0x1126('0x3e')]=_0xf3a0bd;return _0xeb7d89;})['then'](respondWithFilteredResult(_0xa293f4,_0x5ddf63))['catch'](handleError(_0xa293f4,null));};exports[_0x1126('0x3f')]=function(_0x219bcc,_0xcee9de){var _0x21c38e={'raw':!![],'where':{'id':_0x219bcc[_0x1126('0x40')]['id']}},_0x18b496={};_0x18b496['model']=_['keys'](db['FaxApplication'][_0x1126('0x28')]);_0x18b496['query']=_[_0x1126('0x41')](_0x219bcc[_0x1126('0x2c')]);_0x18b496[_0x1126('0x35')]=_[_0x1126('0x2d')](_0x18b496['model'],_0x18b496['query']);_0x21c38e[_0x1126('0x30')]=_[_0x1126('0x2d')](_0x18b496[_0x1126('0x2e')],qs['fields'](_0x219bcc[_0x1126('0x2c')]['fields']));_0x21c38e[_0x1126('0x30')]=_0x21c38e['attributes'][_0x1126('0x42')]?_0x21c38e[_0x1126('0x30')]:_0x18b496[_0x1126('0x2e')];if(_0x219bcc['query'][_0x1126('0x3c')]){_0x21c38e[_0x1126('0x43')]=[{'all':!![]}];}_0x21c38e=_[_0x1126('0x3a')]({},_0x21c38e,_0x219bcc['options']);return db['FaxApplication']['find'](_0x21c38e)[_0x1126('0x22')](handleEntityNotFound(_0xcee9de,null))['then'](respondWithResult(_0xcee9de,null))[_0x1126('0x44')](handleError(_0xcee9de,null));};exports['create']=function(_0x2f45b9,_0x323499){return db[_0x1126('0x27')][_0x1126('0x45')](_0x2f45b9[_0x1126('0x46')],{})['then'](respondWithResult(_0x323499,0xc9))[_0x1126('0x44')](handleError(_0x323499,null));};exports[_0x1126('0x47')]=function(_0x5111d3,_0x1a15f8){if(_0x5111d3[_0x1126('0x46')]['id']){delete _0x5111d3['body']['id'];}return db[_0x1126('0x27')][_0x1126('0x48')]({'where':{'id':_0x5111d3['params']['id']}})[_0x1126('0x22')](handleEntityNotFound(_0x1a15f8,null))[_0x1126('0x22')](saveUpdates(_0x5111d3[_0x1126('0x46')],null))['then'](respondWithResult(_0x1a15f8,null))[_0x1126('0x44')](handleError(_0x1a15f8,null));};exports[_0x1126('0x49')]=function(_0x411c89,_0x5878bb){return db[_0x1126('0x27')][_0x1126('0x48')]({'where':{'id':_0x411c89[_0x1126('0x40')]['id']}})[_0x1126('0x22')](handleEntityNotFound(_0x5878bb,null))['then'](removeEntity(_0x5878bb,null))[_0x1126('0x44')](handleError(_0x5878bb,null));}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.model.js b/server/api/faxApplication/faxApplication.model.js index ea1a600..dda1fc8 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 _0x8250=['api','bluebird','request-promise','rimraf','./faxApplication.attributes','define','fax_applications','utf8mb4_unicode_ci','lodash','util','../../config/logger'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x8250,0xfa));var _0x0825=function(_0xa0033a,_0x51bef2){_0xa0033a=_0xa0033a-0x0;var _0x79d94e=_0x8250[_0xa0033a];return _0x79d94e;};'use strict';var _=require(_0x0825('0x0'));var util=require(_0x0825('0x1'));var logger=require(_0x0825('0x2'))(_0x0825('0x3'));var moment=require('moment');var BPromise=require(_0x0825('0x4'));var rp=require(_0x0825('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x0825('0x6'));var config=require('../../config/environment');var attributes=require(_0x0825('0x7'));module['exports']=function(_0x18733,_0x1a3bf8){return _0x18733[_0x0825('0x8')]('FaxApplication',attributes,{'tableName':_0x0825('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x0825('0xa')});}; \ No newline at end of file +var _0xfae0=['request-promise','rimraf','../../config/environment','define','fax_applications','lodash','util','api','moment','bluebird'];(function(_0x103d9d,_0x454dea){var _0x13bd9c=function(_0x227761){while(--_0x227761){_0x103d9d['push'](_0x103d9d['shift']());}};_0x13bd9c(++_0x454dea);}(_0xfae0,0x19f));var _0x0fae=function(_0x1433df,_0x1c1ddc){_0x1433df=_0x1433df-0x0;var _0x49fade=_0xfae0[_0x1433df];return _0x49fade;};'use strict';var _=require(_0x0fae('0x0'));var util=require(_0x0fae('0x1'));var logger=require('../../config/logger')(_0x0fae('0x2'));var moment=require(_0x0fae('0x3'));var BPromise=require(_0x0fae('0x4'));var rp=require(_0x0fae('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x0fae('0x6'));var config=require(_0x0fae('0x7'));var attributes=require('./faxApplication.attributes');module['exports']=function(_0x41a1f1,_0x25d67f){return _0x41a1f1[_0x0fae('0x8')]('FaxApplication',attributes,{'tableName':_0x0fae('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.rpc.js b/server/api/faxApplication/faxApplication.rpc.js index f5476c5..f2b4324 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 _0xb524=['../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','FaxApplication,\x20%s,\x20%s','request\x20sent','FaxApplication,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','UpdateFaxApplication','update','body','options','raw','where','attributes','limit','debug','lodash','moment','randomstring','ioredis','../../mysqldb'];(function(_0x4d788d,_0x2d34ac){var _0x4f3efa=function(_0x7e7c26){while(--_0x7e7c26){_0x4d788d['push'](_0x4d788d['shift']());}};_0x4f3efa(++_0x2d34ac);}(_0xb524,0x112));var _0x4b52=function(_0x19844d,_0xff414f){_0x19844d=_0x19844d-0x0;var _0x524499=_0xb524[_0x19844d];return _0x524499;};'use strict';var _=require(_0x4b52('0x0'));var util=require('util');var moment=require(_0x4b52('0x1'));var BPromise=require('bluebird');var rs=require(_0x4b52('0x2'));var fs=require('fs');var Redis=require(_0x4b52('0x3'));var db=require(_0x4b52('0x4'))['db'];var utils=require(_0x4b52('0x5'));var logger=require(_0x4b52('0x6'))(_0x4b52('0x7'));var config=require(_0x4b52('0x8'));var jayson=require(_0x4b52('0x9'));var client=jayson[_0x4b52('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x997683,_0x24f29,_0x571ecb){return new BPromise(function(_0x7210a5,_0x29d6de){return client[_0x4b52('0xb')](_0x997683,_0x571ecb)[_0x4b52('0xc')](function(_0x357d27){logger[_0x4b52('0xd')](_0x4b52('0xe'),_0x24f29,_0x4b52('0xf'));logger['debug'](_0x4b52('0x10'),_0x24f29,'request\x20sent',JSON[_0x4b52('0x11')](_0x357d27));if(_0x357d27[_0x4b52('0x12')]){if(_0x357d27[_0x4b52('0x12')]['code']===0x1f4){logger[_0x4b52('0x12')]('FaxApplication,\x20%s,\x20%s',_0x24f29,_0x357d27[_0x4b52('0x12')][_0x4b52('0x13')]);return _0x29d6de(_0x357d27[_0x4b52('0x12')]['message']);}logger[_0x4b52('0x12')]('FaxApplication,\x20%s,\x20%s',_0x24f29,_0x357d27['error'][_0x4b52('0x13')]);return _0x7210a5(_0x357d27['error'][_0x4b52('0x13')]);}else{logger[_0x4b52('0xd')](_0x4b52('0xe'),_0x24f29,_0x4b52('0xf'));_0x7210a5(_0x357d27[_0x4b52('0x14')]['message']);}})[_0x4b52('0x15')](function(_0x55eb02){logger[_0x4b52('0x12')](_0x4b52('0xe'),_0x24f29,_0x55eb02);_0x29d6de(_0x55eb02);});});}exports[_0x4b52('0x16')]=function(_0x26290f){var _0x419eb2=this;return new Promise(function(_0x201557,_0x5b8281){return db['FaxApplication'][_0x4b52('0x17')](_0x26290f[_0x4b52('0x18')],{'raw':_0x26290f[_0x4b52('0x19')]?_0x26290f[_0x4b52('0x19')][_0x4b52('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x26290f[_0x4b52('0x19')]?_0x26290f[_0x4b52('0x19')][_0x4b52('0x1b')]||null:null,'attributes':_0x26290f['options']?_0x26290f[_0x4b52('0x19')][_0x4b52('0x1c')]||null:null,'limit':_0x26290f[_0x4b52('0x19')]?_0x26290f[_0x4b52('0x19')][_0x4b52('0x1d')]||null:null})[_0x4b52('0xc')](function(_0x3dd987){logger['info'](_0x4b52('0x16'),_0x26290f);logger[_0x4b52('0x1e')](_0x4b52('0x16'),_0x26290f,JSON[_0x4b52('0x11')](_0x3dd987));_0x201557(_0x3dd987);})[_0x4b52('0x15')](function(_0x5273d3){logger[_0x4b52('0x12')](_0x4b52('0x16'),_0x5273d3[_0x4b52('0x13')],_0x26290f);_0x5b8281(_0x419eb2[_0x4b52('0x12')](0x1f4,_0x5273d3[_0x4b52('0x13')]));});});}; \ No newline at end of file +var _0xc67a=['rpc','../../config/environment','jayson/promise','client','http','request','then','info','FaxApplication,\x20%s,\x20%s','request\x20sent','debug','FaxApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','FaxApplication','update','body','options','raw','where','limit','UpdateFaxApplication','lodash','util','moment','bluebird','randomstring','../../config/utils','../../config/logger'];(function(_0x2bd280,_0x312b76){var _0x807559=function(_0x31ecda){while(--_0x31ecda){_0x2bd280['push'](_0x2bd280['shift']());}};_0x807559(++_0x312b76);}(_0xc67a,0x122));var _0xac67=function(_0x4c3bcf,_0x5c02aa){_0x4c3bcf=_0x4c3bcf-0x0;var _0xdfe560=_0xc67a[_0x4c3bcf];return _0xdfe560;};'use strict';var _=require(_0xac67('0x0'));var util=require(_0xac67('0x1'));var moment=require(_0xac67('0x2'));var BPromise=require(_0xac67('0x3'));var rs=require(_0xac67('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xac67('0x5'));var logger=require(_0xac67('0x6'))(_0xac67('0x7'));var config=require(_0xac67('0x8'));var jayson=require(_0xac67('0x9'));var client=jayson[_0xac67('0xa')][_0xac67('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xaa9f6a,_0x20c7ca,_0x19e380){return new BPromise(function(_0x967db2,_0x37e83d){return client[_0xac67('0xc')](_0xaa9f6a,_0x19e380)[_0xac67('0xd')](function(_0x5c615a){logger[_0xac67('0xe')](_0xac67('0xf'),_0x20c7ca,_0xac67('0x10'));logger[_0xac67('0x11')](_0xac67('0x12'),_0x20c7ca,'request\x20sent',JSON[_0xac67('0x13')](_0x5c615a));if(_0x5c615a[_0xac67('0x14')]){if(_0x5c615a[_0xac67('0x14')][_0xac67('0x15')]===0x1f4){logger[_0xac67('0x14')](_0xac67('0xf'),_0x20c7ca,_0x5c615a[_0xac67('0x14')]['message']);return _0x37e83d(_0x5c615a[_0xac67('0x14')][_0xac67('0x16')]);}logger['error']('FaxApplication,\x20%s,\x20%s',_0x20c7ca,_0x5c615a[_0xac67('0x14')]['message']);return _0x967db2(_0x5c615a[_0xac67('0x14')][_0xac67('0x16')]);}else{logger[_0xac67('0xe')](_0xac67('0xf'),_0x20c7ca,_0xac67('0x10'));_0x967db2(_0x5c615a[_0xac67('0x17')][_0xac67('0x16')]);}})[_0xac67('0x18')](function(_0x347553){logger[_0xac67('0x14')](_0xac67('0xf'),_0x20c7ca,_0x347553);_0x37e83d(_0x347553);});});}exports['UpdateFaxApplication']=function(_0x1b4329){var _0x147e6e=this;return new Promise(function(_0x1f7e2f,_0x40783a){return db[_0xac67('0x19')][_0xac67('0x1a')](_0x1b4329[_0xac67('0x1b')],{'raw':_0x1b4329[_0xac67('0x1c')]?_0x1b4329['options'][_0xac67('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1b4329['options']?_0x1b4329[_0xac67('0x1c')][_0xac67('0x1e')]||null:null,'attributes':_0x1b4329[_0xac67('0x1c')]?_0x1b4329['options']['attributes']||null:null,'limit':_0x1b4329[_0xac67('0x1c')]?_0x1b4329[_0xac67('0x1c')][_0xac67('0x1f')]||null:null})[_0xac67('0xd')](function(_0x58bfc9){logger[_0xac67('0xe')](_0xac67('0x20'),_0x1b4329);logger[_0xac67('0x11')](_0xac67('0x20'),_0x1b4329,JSON[_0xac67('0x13')](_0x58bfc9));_0x1f7e2f(_0x58bfc9);})[_0xac67('0x18')](function(_0x2aedf2){logger[_0xac67('0x14')](_0xac67('0x20'),_0x2aedf2['message'],_0x1b4329);_0x40783a(_0x147e6e[_0xac67('0x14')](0x1f4,_0x2aedf2[_0xac67('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/faxApplication/index.js b/server/api/faxApplication/index.js index 09c9a79..7cec849 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 _0x53ec=['post','create','put','update','delete','exports','multer','util','path','connect-timeout','express','Router','../../components/interaction/service','./faxApplication.controller','get','index','/:id','isAuthenticated'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0x53ec,0x192));var _0xc53e=function(_0x4def98,_0x421f3f){_0x4def98=_0x4def98-0x0;var _0x40f8cc=_0x53ec[_0x4def98];return _0x40f8cc;};'use strict';var multer=require(_0xc53e('0x0'));var util=require(_0xc53e('0x1'));var path=require(_0xc53e('0x2'));var timeout=require(_0xc53e('0x3'));var express=require(_0xc53e('0x4'));var router=express[_0xc53e('0x5')]();var auth=require('../../components/auth/service');var interaction=require(_0xc53e('0x6'));var config=require('../../config/environment');var controller=require(_0xc53e('0x7'));router[_0xc53e('0x8')]('/',auth['isAuthenticated'](),controller[_0xc53e('0x9')]);router['get'](_0xc53e('0xa'),auth[_0xc53e('0xb')](),controller['show']);router[_0xc53e('0xc')]('/',auth[_0xc53e('0xb')](),controller[_0xc53e('0xd')]);router[_0xc53e('0xe')](_0xc53e('0xa'),auth[_0xc53e('0xb')](),controller[_0xc53e('0xf')]);router[_0xc53e('0x10')](_0xc53e('0xa'),auth['isAuthenticated'](),controller['destroy']);module[_0xc53e('0x11')]=router; \ No newline at end of file +var _0xabce=['post','isAuthenticated','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','../../components/interaction/service','../../config/environment','./faxApplication.controller','index','/:id','show'];(function(_0x52e251,_0x3b6303){var _0x5eee63=function(_0xf1cd77){while(--_0xf1cd77){_0x52e251['push'](_0x52e251['shift']());}};_0x5eee63(++_0x3b6303);}(_0xabce,0x103));var _0xeabc=function(_0x53cf8e,_0x3d290f){_0x53cf8e=_0x53cf8e-0x0;var _0x459197=_0xabce[_0x53cf8e];return _0x459197;};'use strict';var multer=require(_0xeabc('0x0'));var util=require(_0xeabc('0x1'));var path=require(_0xeabc('0x2'));var timeout=require(_0xeabc('0x3'));var express=require(_0xeabc('0x4'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0xeabc('0x5'));var config=require(_0xeabc('0x6'));var controller=require(_0xeabc('0x7'));router['get']('/',auth['isAuthenticated'](),controller[_0xeabc('0x8')]);router['get'](_0xeabc('0x9'),auth['isAuthenticated'](),controller[_0xeabc('0xa')]);router[_0xeabc('0xb')]('/',auth[_0xeabc('0xc')](),controller['create']);router[_0xeabc('0xd')](_0xeabc('0x9'),auth[_0xeabc('0xc')](),controller[_0xeabc('0xe')]);router[_0xeabc('0xf')](_0xeabc('0x9'),auth[_0xeabc('0xc')](),controller[_0xeabc('0x10')]);module[_0xeabc('0x11')]=router; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.attributes.js b/server/api/faxInteraction/faxInteraction.attributes.js index 231a013..1008b0e 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 _0xdb80=['exports','BOOLEAN','DATE','STRING','ENUM','out','sequelize'];(function(_0xd511d,_0x3546b9){var _0x3f148e=function(_0x51f35f){while(--_0x51f35f){_0xd511d['push'](_0xd511d['shift']());}};_0x3f148e(++_0x3546b9);}(_0xdb80,0x1f0));var _0x0db8=function(_0x52aa1d,_0x2c150f){_0x52aa1d=_0x52aa1d-0x0;var _0x8024f8=_0xdb80[_0x52aa1d];return _0x8024f8;};'use strict';var Sequelize=require(_0x0db8('0x0'));module[_0x0db8('0x1')]={'closed':{'type':Sequelize[_0x0db8('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x0db8('0x3')]},'disposition':{'type':Sequelize[_0x0db8('0x4')]},'note':{'type':Sequelize[_0x0db8('0x4')]},'read1stAt':{'type':Sequelize[_0x0db8('0x3')]},'fax':{'type':Sequelize[_0x0db8('0x4')]},'firstMsgDirection':{'type':Sequelize[_0x0db8('0x5')]('in','out'),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x0db8('0x3')]},'lastMsgDirection':{'type':Sequelize[_0x0db8('0x5')]('in',_0x0db8('0x6')),'defaultValue':'in','allowNull':![]}}; \ No newline at end of file +var _0x6955=['out','sequelize','BOOLEAN','DATE','STRING'];(function(_0x570ac2,_0x4dd57d){var _0x36b004=function(_0x25f2c8){while(--_0x25f2c8){_0x570ac2['push'](_0x570ac2['shift']());}};_0x36b004(++_0x4dd57d);}(_0x6955,0x128));var _0x5695=function(_0x1089e0,_0x89a7f3){_0x1089e0=_0x1089e0-0x0;var _0xc2421e=_0x6955[_0x1089e0];return _0xc2421e;};'use strict';var Sequelize=require(_0x5695('0x0'));module['exports']={'closed':{'type':Sequelize[_0x5695('0x1')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x5695('0x2')]},'disposition':{'type':Sequelize[_0x5695('0x3')]},'note':{'type':Sequelize[_0x5695('0x3')]},'read1stAt':{'type':Sequelize[_0x5695('0x2')]},'fax':{'type':Sequelize[_0x5695('0x3')]},'firstMsgDirection':{'type':Sequelize['ENUM']('in',_0x5695('0x4')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x5695('0x2')]},'lastMsgDirection':{'type':Sequelize['ENUM']('in',_0x5695('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 8078ea7..af4a797 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 _0xf12a=['color','from','tools_tags','u.id','u.fullname','ui.FaxInteractionId','users','u.id\x20=\x20ui.UserId','fax_interactions','left_join','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','a.id\x20=\x20i.FaxAccountId','fax_messages','me.FaxInteractionId\x20=\x20i.id','fax_interaction_has_tags','t.id\x20=\x20it.TagId','expr','parseSearch','sqlOperator','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','ContactId','buildExpression','type','text','Tag','forEach','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','start','body','some','compact','isEmpty','FaxAccountId','where','concat','createdAt','parse','$gte','$lte','null','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','isArray','filter','replace','isNumeric','i.id\x20LIKE\x20?','i.fax\x20LIKE\x20?','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','group','i.id','Sequelize','QueryTypes','SELECT','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','DESC','t.id\x20IN\x20?','resolve','journey','i.FaxAccountId\x20IS\x20NOT\x20NULL','user','getFaxAccounts','i.FaxAccountId\x20IS\x20NULL','i.FaxAccountId\x20IN\x20?','toString','keyBy','a.key','Account.key','c.firstName','Contact.firstName','c.lastName','Contact.lastName','c.email','Contact.email','c.phone','Contact.phone','c.mobile','Contact.mobile','c.fax','Contact.fax','o.internal','Owner.internal','ui.FaxInteractionId\x20IN\x20?','sequelize','FaxInteractionId','all','rows','params','include','merge','options','create','describe','addMessage','FaxMessage','omit','ids','findOne','YYYY-MM-DD\x20HH:mm:ss','includeAll','findAll','emit','removeTags','download','unix','join','root','server','files','tmp','attachments','format','Attachment','Messages','get','existsSync','createReadStream','pipe','createWriteStream','basename','err','unlinkSync','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','sox','ejs','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','api','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./faxInteraction.socket','register','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','destroy','then','error','stack','name','send','TagIds','split','push','catch','index','FaxInteraction','fieldName','key','map','keys','intersection','model','query','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filters','pick','select','field'];(function(_0x29ca12,_0x436440){var _0x27900e=function(_0x1139c6){while(--_0x1139c6){_0x29ca12['push'](_0x29ca12['shift']());}};_0x27900e(++_0x436440);}(_0xf12a,0x8e));var _0xaf12=function(_0x1c2404,_0x120c50){_0x1c2404=_0x1c2404-0x0;var _0x389702=_0xf12a[_0x1c2404];return _0x389702;};'use strict';var pdf=require(_0xaf12('0x0'));var emlformat=require(_0xaf12('0x1'));var rimraf=require(_0xaf12('0x2'));var zipdir=require(_0xaf12('0x3'));var jsonpatch=require(_0xaf12('0x4'));var rp=require(_0xaf12('0x5'));var moment=require(_0xaf12('0x6'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xaf12('0x7'));var path=require('path');var sox=require(_0xaf12('0x8'));var csv=require('to-csv');var ejs=require(_0xaf12('0x9'));var fs=require('fs');var _=require('lodash');var squel=require(_0xaf12('0xa'));var crypto=require(_0xaf12('0xb'));var jsforce=require(_0xaf12('0xc'));var deskjs=require(_0xaf12('0xd'));var toCsv=require(_0xaf12('0xe'));var querystring=require(_0xaf12('0xf'));var Papa=require(_0xaf12('0x10'));var Redis=require(_0xaf12('0x11'));var authService=require('../../components/auth/service');var qs=require(_0xaf12('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xaf12('0x13'));var logger=require('../../config/logger')(_0xaf12('0x14'));var utils=require('../../config/utils');var config=require('../../config/environment');var db=require(_0xaf12('0x15'))['db'];config[_0xaf12('0x16')]=_[_0xaf12('0x17')](config[_0xaf12('0x16')],{'host':_0xaf12('0x18'),'port':0x18eb});var socket=require(_0xaf12('0x19'))(new Redis(config[_0xaf12('0x16')]));require(_0xaf12('0x1a'))[_0xaf12('0x1b')](socket);function respondWithStatusCode(_0x3f1476,_0xa41e71){_0xa41e71=_0xa41e71||0xcc;return function(_0x627227){if(_0x627227){return _0x3f1476[_0xaf12('0x1c')](_0xa41e71);}return _0x3f1476[_0xaf12('0x1d')](_0xa41e71)[_0xaf12('0x1e')]();};}function respondWithResult(_0x3205ae,_0x450cd2){_0x450cd2=_0x450cd2||0xc8;return function(_0x5107e7){if(_0x5107e7){return _0x3205ae[_0xaf12('0x1d')](_0x450cd2)[_0xaf12('0x1f')](_0x5107e7);}};}function respondWithFilteredResult(_0x4b6d83,_0x4bc03e){return function(_0x4c8541){if(_0x4c8541){var _0xd0c5f=_0x4c8541[_0xaf12('0x20')],_0x4cc0a4=_0x4bc03e[_0xaf12('0x21')],_0x3530a8=_0x4bc03e[_0xaf12('0x21')]+_0x4bc03e[_0xaf12('0x22')],_0x516bad;if(_0x3530a8>=_0xd0c5f){_0x3530a8=_0xd0c5f;_0x516bad=0xc8;}else{_0x516bad=0xce;}_0x4b6d83['status'](_0x516bad);return _0x4b6d83[_0xaf12('0x23')](_0xaf12('0x24'),_0x4cc0a4+'-'+_0x3530a8+'/'+_0xd0c5f)[_0xaf12('0x1f')](_0x4c8541);}return null;};}function patchUpdates(_0x18c4e0){return function(_0x1982c7){try{jsonpatch[_0xaf12('0x25')](_0x1982c7,_0x18c4e0,!![]);}catch(_0x656675){return BPromise[_0xaf12('0x26')](_0x656675);}return _0x1982c7[_0xaf12('0x27')]();};}function saveUpdates(_0x41f9f7,_0x2c3a93){return function(_0x374e3c){if(_0x374e3c){return _0x374e3c[_0xaf12('0x28')](_0x41f9f7)['then'](function(_0x2c9ba3){return _0x2c9ba3;});}return null;};}function removeEntity(_0x566109,_0x576fd4){return function(_0x26e97a){if(_0x26e97a){return _0x26e97a[_0xaf12('0x29')]()[_0xaf12('0x2a')](function(){_0x566109['status'](0xcc)[_0xaf12('0x1e')]();});}};}function handleEntityNotFound(_0x3dbc35,_0x5c32bf){return function(_0x439409){if(!_0x439409){_0x3dbc35[_0xaf12('0x1c')](0x194);}return _0x439409;};}function handleError(_0x478286,_0x2ed53d){_0x2ed53d=_0x2ed53d||0x1f4;return function(_0x22f46f){logger[_0xaf12('0x2b')](_0x22f46f[_0xaf12('0x2c')]);if(_0x22f46f[_0xaf12('0x2d')]){delete _0x22f46f[_0xaf12('0x2d')];}_0x478286['status'](_0x2ed53d)[_0xaf12('0x2e')](_0x22f46f);};}function getInteractionUsers(_0x59328c,_0x39b12f){return new BPromise(function(_0x23e4d6,_0xb975f5){try{if(_0x39b12f[_0x59328c['id']]){_0x59328c['Users']=_['map'](_0x39b12f[_0x59328c['id']],function(_0x51ddae){return{'id':_0x51ddae['id'],'fullname':_0x51ddae['fullname']};});}}catch(_0x5484c8){_0xb975f5(_0x5484c8);}_0x23e4d6(_0x59328c);});}function getInteractionTags(_0x53401b,_0x64625){return new BPromise(function(_0x32abc3,_0x2fd548){try{if(_0x53401b[_0xaf12('0x2f')]){_0x53401b['Tags']=[];_0x53401b[_0xaf12('0x2f')][_0xaf12('0x30')](',')['forEach'](function(_0x384cad){_0x53401b['Tags'][_0xaf12('0x31')](_0x64625[_0x384cad]);});}delete _0x53401b[_0xaf12('0x2f')];}catch(_0x45e5db){_0x2fd548(_0x45e5db);}_0x32abc3(_0x53401b);});}function updateFaxInteraction(_0x182a6e,_0xddd4ec,_0x562132){return new BPromise(function(_0x406c32,_0x19d394){return getInteractionUsers(_0x182a6e,_0x562132)[_0xaf12('0x2a')](function(_0x173bfb){return getInteractionTags(_0x173bfb,_0xddd4ec);})[_0xaf12('0x2a')](function(_0x1e9744){_0x406c32(_0x1e9744);})[_0xaf12('0x32')](function(_0xe5def6){_0x19d394(_0xe5def6);});});}exports[_0xaf12('0x33')]=function(_0x55f694,_0x5d7936){var _0x4d7448={},_0x2f0fb9={},_0x59f131={'count':0x0,'rows':[]};var _0x4a907b=_['map'](db[_0xaf12('0x34')]['rawAttributes'],function(_0x47dec9){return{'name':_0x47dec9[_0xaf12('0x35')],'type':_0x47dec9['type'][_0xaf12('0x36')]};});_0x2f0fb9['model']=_[_0xaf12('0x37')](_0x4a907b,_0xaf12('0x2d'));_0x2f0fb9['query']=_[_0xaf12('0x38')](_0x55f694['query']);_0x2f0fb9['filters']=_[_0xaf12('0x39')](_0x2f0fb9[_0xaf12('0x3a')],_0x2f0fb9[_0xaf12('0x3b')]);_0x4d7448[_0xaf12('0x3c')]=_[_0xaf12('0x39')](_0x2f0fb9[_0xaf12('0x3a')],qs[_0xaf12('0x3d')](_0x55f694[_0xaf12('0x3b')][_0xaf12('0x3d')]));_0x4d7448['attributes']=_0x4d7448['attributes'][_0xaf12('0x3e')]?_0x4d7448[_0xaf12('0x3c')]:_0x2f0fb9[_0xaf12('0x3a')];if(!_0x55f694[_0xaf12('0x3b')][_0xaf12('0x3f')](_0xaf12('0x40'))){_0x4d7448[_0xaf12('0x22')]=qs['limit'](_0x55f694[_0xaf12('0x3b')][_0xaf12('0x22')]);_0x4d7448[_0xaf12('0x21')]=qs[_0xaf12('0x21')](_0x55f694[_0xaf12('0x3b')][_0xaf12('0x21')]);}_0x4d7448[_0xaf12('0x41')]=qs[_0xaf12('0x42')](_0x55f694[_0xaf12('0x3b')][_0xaf12('0x42')]);_0x4d7448['where']=qs[_0xaf12('0x43')](_[_0xaf12('0x44')](_0x55f694['query'],_0x2f0fb9['filters']),_0x4a907b);var _0x16784c=[];var _0x387c96=squel[_0xaf12('0x45')]()['field']('id')[_0xaf12('0x46')](_0xaf12('0x2d'))[_0xaf12('0x46')](_0xaf12('0x47'))[_0xaf12('0x48')](_0xaf12('0x49'));var _0x3c4678=squel['select']()[_0xaf12('0x46')](_0xaf12('0x4a'))[_0xaf12('0x46')](_0xaf12('0x4b'))[_0xaf12('0x46')](_0xaf12('0x4c'))[_0xaf12('0x48')]('user_has_fax_interactions','ui')['left_join'](_0xaf12('0x4d'),'u',_0xaf12('0x4e'));var _0x1fed3c=squel[_0xaf12('0x45')]()['from'](_0xaf12('0x4f'),'i')[_0xaf12('0x50')](_0xaf12('0x51'),'c',_0xaf12('0x52'))['left_join'](_0xaf12('0x4d'),'o',_0xaf12('0x53'))[_0xaf12('0x50')]('fax_accounts','a',_0xaf12('0x54'))[_0xaf12('0x50')](_0xaf12('0x55'),'me',_0xaf12('0x56'))['left_join'](_0xaf12('0x57'),'it','it.FaxInteractionId\x20=\x20i.id')[_0xaf12('0x50')](_0xaf12('0x49'),'t',_0xaf12('0x58'));var _0x271c34=squel[_0xaf12('0x59')]();var _0x98f195=[];var _0x418004=squel['expr']();var _0x178107;if(_0x55f694['query']['search']){_0x178107=as[_0xaf12('0x5a')](_0x55f694[_0xaf12('0x3b')]['search']);var _0x2063b1=_0x178107[_0xaf12('0x5b')];for(var _0x2add43=0x0;_0x2add43<_0x178107['conditions'][_0xaf12('0x3e')];_0x2add43++){var _0x3a984a=_0x178107['conditions'][_0x2add43];var _0x348170='i';var _0x4ab493=_[_0xaf12('0x5c')](_0x4a907b,['name',_0x3a984a[_0xaf12('0x46')]]);if(!_0x4ab493){switch(_0x3a984a[_0xaf12('0x46')]){case _0xaf12('0x5d'):if(_0x3a984a[_0xaf12('0x5e')]==0x1){_0x1fed3c[_0xaf12('0x5f')]('`'+_0x3a984a[_0xaf12('0x46')]+_0xaf12('0x60'));}else{_0x1fed3c[_0xaf12('0x5f')]('`'+_0x3a984a[_0xaf12('0x46')]+_0xaf12('0x61'));}break;case _0xaf12('0x62'):if(_0x3a984a[_0xaf12('0x63')]===_0xaf12('0x64')){if(_0x3a984a['value']['split']('\x20')[_0xaf12('0x3e')]>0x1){_0x271c34[_0x2063b1](_0xaf12('0x65'),qs[_0xaf12('0x66')](_0x3a984a[_0xaf12('0x5e')]),null);}else{var _0xbdb7db='%'+_0x3a984a[_0xaf12('0x5e')]+'%';_0x271c34[_0x2063b1]('c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?',_0xbdb7db,_0xbdb7db,_0xbdb7db);}}else{_0x4ab493=_[_0xaf12('0x5c')](_0x4a907b,[_0xaf12('0x2d'),'ContactId']);_0x3a984a[_0xaf12('0x46')]=_0xaf12('0x67');_0x2b04cc=as[_0xaf12('0x68')](_0x348170,_0x4ab493[_0xaf12('0x69')],_0x3a984a);_0x271c34[_0x2063b1](_0x2b04cc[_0xaf12('0x6a')],_0x2b04cc[_0xaf12('0x5e')]['start'],_0x2b04cc[_0xaf12('0x5e')]['end']);}break;case _0xaf12('0x6b'):var _0x2cd4a8=_0x3a984a[_0xaf12('0x5e')][_0xaf12('0x30')](',')[_0xaf12('0x37')](function(_0x5263aa){return Number(_0x5263aa);});_0x2cd4a8[_0xaf12('0x6c')](function(_0x916cc7){_0x418004['or'](_0xaf12('0x6d'),'%,'+_0x916cc7+',%');});_0x98f195=_[_0xaf12('0x6e')](_0x98f195,_0x2cd4a8);break;case'User':if(_0x3a984a[_0xaf12('0x63')]===_0xaf12('0x64')){_0x271c34[_0x2063b1](_0xaf12('0x6f'),'%'+_0x3a984a[_0xaf12('0x5e')]+'%',null);}else{_0x4ab493=_[_0xaf12('0x5c')](_0x4a907b,['name',_0xaf12('0x70')]);_0x3a984a['field']=_0xaf12('0x70');_0x2b04cc=as[_0xaf12('0x68')](_0x348170,_0x4ab493['type'],_0x3a984a);_0x271c34[_0x2063b1](_0x2b04cc['text'],_0x2b04cc[_0xaf12('0x5e')][_0xaf12('0x71')],_0x2b04cc[_0xaf12('0x5e')][_0xaf12('0x1e')]);}break;case _0xaf12('0x72'):_0x2b04cc=as[_0xaf12('0x68')]('me',null,_0x3a984a);_0x271c34[_0x2063b1](_0x2b04cc['text'],_0x2b04cc[_0xaf12('0x5e')]['start'],_0x2b04cc['value'][_0xaf12('0x1e')]);break;}}else{var _0x2b04cc=as[_0xaf12('0x68')](_0x348170,_0x4ab493[_0xaf12('0x69')],_0x3a984a);_0x271c34[_0x2063b1](_0x2b04cc[_0xaf12('0x6a')],_0x2b04cc[_0xaf12('0x5e')][_0xaf12('0x71')],_0x2b04cc[_0xaf12('0x5e')][_0xaf12('0x1e')]);}}}else{var _0x27bebc=_(_0x55f694[_0xaf12('0x3b')])[_0xaf12('0x38')]()[_0xaf12('0x37')](function(_0x4fcd15){return _[_0xaf12('0x73')](_0x4a907b,[_0xaf12('0x2d'),_0x4fcd15])?_0x4fcd15:undefined;})[_0xaf12('0x74')]()[_0xaf12('0x5e')]();if(!_[_0xaf12('0x75')](_0x27bebc)){_0x27bebc[_0xaf12('0x6c')](function(_0x315f6a){if(_0x315f6a===_0xaf12('0x76')){_0x1fed3c[_0xaf12('0x77')]('i.FaxAccountId\x20IN\x20?',[][_0xaf12('0x78')](_0x55f694['query'][_0x315f6a]));}else if(_0x315f6a===_0xaf12('0x79')){var _0x2a7ca4=JSON[_0xaf12('0x7a')](_0x55f694[_0xaf12('0x3b')][_0x315f6a])[_0xaf12('0x7b')];var _0x4364f8=JSON['parse'](_0x55f694[_0xaf12('0x3b')][_0x315f6a])[_0xaf12('0x7c')];_0x1fed3c[_0xaf12('0x77')]('i.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x2a7ca4,_0x4364f8);}else{if(_0x55f694[_0xaf12('0x3b')][_0x315f6a]===_0xaf12('0x7d')){_0x1fed3c[_0xaf12('0x77')]('i.'+_0x315f6a+_0xaf12('0x7e'));}else{_0x1fed3c[_0xaf12('0x77')]('i.'+_0x315f6a+_0xaf12('0x7f'),_0x55f694[_0xaf12('0x3b')][_0x315f6a]);}}});}if(_0x55f694['query']['read']){if(_0x55f694[_0xaf12('0x3b')][_0xaf12('0x80')]==0x1){_0x1fed3c[_0xaf12('0x5f')](_0xaf12('0x81'));}else{_0x1fed3c[_0xaf12('0x5f')](_0xaf12('0x82'));}}if(_0x55f694[_0xaf12('0x3b')][_0xaf12('0x83')]){_0x98f195=_[_0xaf12('0x84')](_0x55f694[_0xaf12('0x3b')][_0xaf12('0x83')])?_0x55f694[_0xaf12('0x3b')][_0xaf12('0x83')]:new Array(_0x55f694[_0xaf12('0x3b')][_0xaf12('0x83')]);_0x98f195['forEach'](function(_0x2bf73c){_0x418004['or'](_0xaf12('0x6d'),'%,'+_0x2bf73c+',%');});}if(_0x55f694['query'][_0xaf12('0x85')]){var _0x4f4947=_0x55f694[_0xaf12('0x3b')][_0xaf12('0x85')][_0xaf12('0x86')]('\x5c','\x5c\x5c')['replace']('\x27\x27','\x27\x27\x27\x27');if(qs[_0xaf12('0x87')](_0x4f4947)){_0x271c34['or'](_0xaf12('0x88'),_0x4f4947+'%')['or'](_0xaf12('0x89'),_0x4f4947+'%');}_0x271c34['or'](_0xaf12('0x8a'),_0x4f4947+'%');}}_0x1fed3c['where'](_0x271c34);_0x1fed3c[_0xaf12('0x8b')](_0xaf12('0x8c'));var _0x5605d6={'type':db[_0xaf12('0x8d')][_0xaf12('0x8e')][_0xaf12('0x8f')],'raw':!![]};var _0x4965ca=_0x1fed3c[_0xaf12('0x90')]();_0x4965ca[_0xaf12('0x46')](_0xaf12('0x8c'));_0x4965ca['field'](_0xaf12('0x91'),_0xaf12('0x5d'));if(_0x4d7448['order']){_0x4d7448[_0xaf12('0x41')][_0xaf12('0x6c')](function(_0x551340){_0x1fed3c[_0xaf12('0x41')]('i.'+_0x551340[0x0],_0x551340[0x1]===_0xaf12('0x92')?![]:!![]);});}if(!_['isEmpty'](_0x98f195)){_0x1fed3c[_0xaf12('0x5f')](_0x418004);_0x4965ca[_0xaf12('0x77')](_0xaf12('0x93'),_0x98f195);}BPromise[_0xaf12('0x94')]()[_0xaf12('0x2a')](function(){if(!_0x178107){if(_0x55f694[_0xaf12('0x3b')][_0xaf12('0x76')]||_0x55f694[_0xaf12('0x3b')][_0xaf12('0x95')])return;_0x4965ca['where']('i.FaxAccountId\x20IS\x20NOT\x20NULL');_0x1fed3c[_0xaf12('0x77')](_0xaf12('0x96'));return;}return _0x55f694[_0xaf12('0x97')][_0xaf12('0x98')]({'attributes':['id'],'raw':!![]})[_0xaf12('0x2a')](function(_0x40de6a){if(_[_0xaf12('0x75')](_0x40de6a)){_0x4965ca[_0xaf12('0x77')](_0xaf12('0x99'));_0x1fed3c[_0xaf12('0x77')](_0xaf12('0x99'));}else{_0x4965ca['where'](_0xaf12('0x9a'),_[_0xaf12('0x37')](_0x40de6a,'id'));_0x1fed3c['where']('i.FaxAccountId\x20IN\x20?',_['map'](_0x40de6a,'id'));}});})['then'](function(){db['sequelize'][_0xaf12('0x3b')](_0x4965ca[_0xaf12('0x9b')](),_0x5605d6)[_0xaf12('0x2a')](function(_0x3729a6){_0x59f131[_0xaf12('0x20')]=_0x3729a6[_0xaf12('0x3e')];if(_0x59f131[_0xaf12('0x20')]===0x0)return[];return db['sequelize']['query'](_0x387c96['toString'](),_0x5605d6)[_0xaf12('0x2a')](function(_0x5adfc0){_0x16784c=_[_0xaf12('0x9c')](_0x5adfc0,'id');_0x5605d6=_['merge'](_0x5605d6,{'model':db['FaxInteraction'],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x55f694[_0xaf12('0x3b')][_0xaf12('0x3d')]){_0x4d7448[_0xaf12('0x3c')]['forEach'](function(_0x21c2e1){_0x1fed3c['field']('i.'+_0x21c2e1);});}else{_0x1fed3c['field'](_0xaf12('0x91'),_0xaf12('0x5d'));_0x1fed3c[_0xaf12('0x46')](_0xaf12('0x9d'),_0xaf12('0x9e'));_0x1fed3c[_0xaf12('0x46')]('a.mandatoryDisposition','Account.mandatoryDisposition');_0x1fed3c['field']('i.*');_0x1fed3c[_0xaf12('0x46')](_0xaf12('0x9f'),_0xaf12('0xa0'));_0x1fed3c[_0xaf12('0x46')](_0xaf12('0xa1'),_0xaf12('0xa2'));_0x1fed3c[_0xaf12('0x46')](_0xaf12('0xa3'),_0xaf12('0xa4'));_0x1fed3c[_0xaf12('0x46')](_0xaf12('0xa5'),_0xaf12('0xa6'));_0x1fed3c[_0xaf12('0x46')](_0xaf12('0xa7'),_0xaf12('0xa8'));_0x1fed3c[_0xaf12('0x46')](_0xaf12('0xa9'),_0xaf12('0xaa'));_0x1fed3c[_0xaf12('0x46')]('o.fullname','Owner.fullname');_0x1fed3c[_0xaf12('0x46')](_0xaf12('0xab'),_0xaf12('0xac'));_0x1fed3c['field']('GROUP_CONCAT(DISTINCT\x20t.id)','TagIds');}if(_0x4d7448[_0xaf12('0x22')])_0x1fed3c[_0xaf12('0x22')](_0x4d7448[_0xaf12('0x22')]);if(_0x4d7448[_0xaf12('0x21')])_0x1fed3c[_0xaf12('0x21')](_0x4d7448[_0xaf12('0x21')]);return db['sequelize']['query'](_0x1fed3c[_0xaf12('0x9b')](),_0x5605d6);})[_0xaf12('0x2a')](function(_0x336a14){_0x3c4678[_0xaf12('0x77')](_0xaf12('0xad'),_[_0xaf12('0x37')](_0x336a14,'id'));return db[_0xaf12('0xae')][_0xaf12('0x3b')](_0x3c4678[_0xaf12('0x9b')](),_0x5605d6)['then'](function(_0x236f59){var _0x14ecd4=_['groupBy'](_0x236f59,_0xaf12('0xaf'));var _0x59ac28=[];_0x336a14['forEach'](function(_0x1888ae){_0x59ac28[_0xaf12('0x31')](updateFaxInteraction(_0x1888ae,_0x16784c,_0x14ecd4));});return BPromise[_0xaf12('0xb0')](_0x59ac28);});});})[_0xaf12('0x2a')](function(_0x56ca2b){_0x59f131[_0xaf12('0xb1')]=_0x56ca2b;return _0x59f131;})[_0xaf12('0x2a')](respondWithFilteredResult(_0x5d7936,_0x4d7448));})[_0xaf12('0x32')](handleError(_0x5d7936,null));};exports['show']=function(_0x2408c2,_0x59d6d0){var _0xda38b4={'raw':![],'where':{'id':_0x2408c2[_0xaf12('0xb2')]['id']}},_0x1b9a13={};_0x1b9a13[_0xaf12('0x3a')]=_[_0xaf12('0x38')](db[_0xaf12('0x34')]['rawAttributes']);_0x1b9a13['query']=_[_0xaf12('0x38')](_0x2408c2[_0xaf12('0x3b')]);_0x1b9a13[_0xaf12('0x43')]=_[_0xaf12('0x39')](_0x1b9a13['model'],_0x1b9a13['query']);_0xda38b4[_0xaf12('0x3c')]=_[_0xaf12('0x39')](_0x1b9a13['model'],qs[_0xaf12('0x3d')](_0x2408c2[_0xaf12('0x3b')][_0xaf12('0x3d')]));_0xda38b4[_0xaf12('0x3c')]=_0xda38b4[_0xaf12('0x3c')][_0xaf12('0x3e')]?_0xda38b4[_0xaf12('0x3c')]:_0x1b9a13[_0xaf12('0x3a')];if(_0x2408c2['query']['includeAll']){_0xda38b4[_0xaf12('0xb3')]=[{'all':!![]}];}_0xda38b4=_[_0xaf12('0xb4')]({},_0xda38b4,_0x2408c2[_0xaf12('0xb5')]);return db[_0xaf12('0x34')][_0xaf12('0x5c')](_0xda38b4)[_0xaf12('0x2a')](handleEntityNotFound(_0x59d6d0,null))['then'](respondWithResult(_0x59d6d0,null))['catch'](handleError(_0x59d6d0,null));};exports[_0xaf12('0xb6')]=function(_0x3a8e2b,_0x3e4bb5){return db[_0xaf12('0x34')][_0xaf12('0xb6')](_0x3a8e2b['body'],{})[_0xaf12('0x2a')](respondWithResult(_0x3e4bb5,0xc9))['catch'](handleError(_0x3e4bb5,null));};exports[_0xaf12('0x28')]=function(_0x3b13bd,_0xe37e4a){if(_0x3b13bd['body']['id']){delete _0x3b13bd[_0xaf12('0x72')]['id'];}return db[_0xaf12('0x34')][_0xaf12('0x5c')]({'where':{'id':_0x3b13bd[_0xaf12('0xb2')]['id']}})[_0xaf12('0x2a')](handleEntityNotFound(_0xe37e4a,null))[_0xaf12('0x2a')](saveUpdates(_0x3b13bd[_0xaf12('0x72')],null))[_0xaf12('0x2a')](respondWithResult(_0xe37e4a,null))[_0xaf12('0x32')](handleError(_0xe37e4a,null));};exports['destroy']=function(_0x48f528,_0x1df12f){return db['FaxInteraction'][_0xaf12('0x5c')]({'where':{'id':_0x48f528['params']['id']}})['then'](handleEntityNotFound(_0x1df12f,null))[_0xaf12('0x2a')](removeEntity(_0x1df12f,null))[_0xaf12('0x32')](handleError(_0x1df12f,null));};exports[_0xaf12('0xb7')]=function(_0x389807,_0x402eb0){return db[_0xaf12('0x34')][_0xaf12('0xb7')]()[_0xaf12('0x2a')](respondWithResult(_0x402eb0,null))[_0xaf12('0x32')](handleError(_0x402eb0,null));};exports[_0xaf12('0xb8')]=function(_0x15961d,_0x3d43e5,_0x230573){return db[_0xaf12('0xb9')][_0xaf12('0x5c')]({'where':{'id':_0x15961d['params']['id']}})[_0xaf12('0x2a')](handleEntityNotFound(_0x3d43e5,null))[_0xaf12('0x2a')](function(_0x1b3417){if(_0x1b3417){return _0x1b3417[_0xaf12('0xb8')](_0x15961d['body']['ids'],_[_0xaf12('0xba')](_0x15961d[_0xaf12('0x72')],[_0xaf12('0xbb'),'id'])||{});}})[_0xaf12('0x2a')](respondWithResult(_0x3d43e5,null))[_0xaf12('0x32')](handleError(_0x3d43e5,null));};exports['getMessages']=function(_0x12ea07,_0x3f41f1,_0x3a03ad){var _0x29f49f={'raw':![],'where':{}};var _0x5bc9a3={};var _0x33d1d9={'count':0x0,'rows':[]};return db[_0xaf12('0x34')][_0xaf12('0xbc')]({'where':{'id':_0x12ea07[_0xaf12('0xb2')]['id']}})[_0xaf12('0x2a')](handleEntityNotFound(_0x3f41f1,null))[_0xaf12('0x2a')](function(_0x32fd46){if(_0x32fd46){_0x5bc9a3['model']=_[_0xaf12('0x38')](db['FaxMessage']['rawAttributes']);_0x5bc9a3[_0xaf12('0x3b')]=_[_0xaf12('0x38')](_0x12ea07[_0xaf12('0x3b')]);_0x5bc9a3['filters']=_[_0xaf12('0x39')](_0x5bc9a3[_0xaf12('0x3a')],_0x5bc9a3[_0xaf12('0x3b')]);_0x29f49f[_0xaf12('0x3c')]=_[_0xaf12('0x39')](_0x5bc9a3[_0xaf12('0x3a')],qs[_0xaf12('0x3d')](_0x12ea07[_0xaf12('0x3b')][_0xaf12('0x3d')]));_0x29f49f[_0xaf12('0x3c')]=_0x29f49f[_0xaf12('0x3c')][_0xaf12('0x3e')]?_0x29f49f[_0xaf12('0x3c')]:_0x5bc9a3[_0xaf12('0x3a')];if(!_0x12ea07[_0xaf12('0x3b')][_0xaf12('0x3f')]('nolimit')){_0x29f49f['limit']=qs[_0xaf12('0x22')](_0x12ea07['query'][_0xaf12('0x22')]);_0x29f49f['offset']=qs[_0xaf12('0x21')](_0x12ea07[_0xaf12('0x3b')][_0xaf12('0x21')]);}_0x29f49f[_0xaf12('0x41')]=qs[_0xaf12('0x42')](_0x12ea07[_0xaf12('0x3b')][_0xaf12('0x42')]);_0x29f49f['where']=qs['filters'](_[_0xaf12('0x44')](_0x12ea07['query'],_0x5bc9a3['filters']));_0x29f49f[_0xaf12('0x77')][_0xaf12('0xaf')]=_0x32fd46['id'];if(_0x12ea07[_0xaf12('0x3b')][_0xaf12('0x85')]){_0x29f49f[_0xaf12('0x77')]=_[_0xaf12('0xb4')](_0x29f49f[_0xaf12('0x77')],{'$or':_[_0xaf12('0x37')](_0x29f49f[_0xaf12('0x3c')],function(_0x3e9385){var _0x517b53={};_0x517b53[_0x3e9385]={'$like':'%'+_0x12ea07['query'][_0xaf12('0x85')]+'%'};return _0x517b53;})});}if(_0x12ea07[_0xaf12('0x3b')][_0xaf12('0x7b')]){var _0x24188c=_0x12ea07[_0xaf12('0x3b')][_0xaf12('0x7b')][_0xaf12('0x30')](',');var _0x449e4a={};_0x449e4a[_0x24188c[0x0]]={'$gte':moment(_0x24188c[0x1])['format'](_0xaf12('0xbd'))};_0x29f49f[_0xaf12('0x77')]=_[_0xaf12('0xb4')](_0x29f49f['where'],_0x449e4a);}_0x29f49f=_[_0xaf12('0xb4')]({},_0x29f49f,_0x12ea07['options']);return db[_0xaf12('0xb9')][_0xaf12('0x20')]({'where':_0x29f49f[_0xaf12('0x77')]})[_0xaf12('0x2a')](function(_0x118552){_0x33d1d9[_0xaf12('0x20')]=_0x118552;if(_0x12ea07['query'][_0xaf12('0xbe')]){_0x29f49f[_0xaf12('0xb3')]=[{'all':!![]}];}return db[_0xaf12('0xb9')][_0xaf12('0xbf')](_0x29f49f);})[_0xaf12('0x2a')](function(_0x5e9d0e){_0x33d1d9[_0xaf12('0xb1')]=_0x5e9d0e;return _0x33d1d9;});}})[_0xaf12('0x2a')](respondWithFilteredResult(_0x3f41f1,_0x29f49f))['catch'](handleError(_0x3f41f1,null));};exports['addTags']=function(_0x4dfcf1,_0x590a1a,_0x55d189){return db[_0xaf12('0x34')][_0xaf12('0x5c')]({'where':{'id':_0x4dfcf1[_0xaf12('0xb2')]['id']}})['then'](handleEntityNotFound(_0x590a1a,null))[_0xaf12('0x2a')](function(_0x23fd78){if(_0x23fd78){return _0x23fd78['setTags'](_0x4dfcf1['body']['ids'],_[_0xaf12('0xba')](_0x4dfcf1[_0xaf12('0x72')],[_0xaf12('0xbb'),'id'])||{})['spread'](function(){return db[_0xaf12('0x6b')][_0xaf12('0xbf')]({'attributes':['id',_0xaf12('0x2d'),_0xaf12('0x47')],'where':{'id':_0x4dfcf1['body'][_0xaf12('0xbb')]}});})[_0xaf12('0x2a')](function(_0x143af3){socket[_0xaf12('0xc0')]('faxInteractionTags:save',{'id':Number(_0x4dfcf1[_0xaf12('0xb2')]['id']),'tags':_0x143af3||[]});return{'id':Number(_0x4dfcf1[_0xaf12('0xb2')]['id']),'tags':_0x143af3||[]};});}})[_0xaf12('0x2a')](respondWithResult(_0x590a1a,null))[_0xaf12('0x32')](handleError(_0x590a1a,null));};exports[_0xaf12('0xc1')]=function(_0xeedd4c,_0x174151,_0x40e457){return db[_0xaf12('0x34')]['find']({'where':{'id':_0xeedd4c[_0xaf12('0xb2')]['id']}})[_0xaf12('0x2a')](handleEntityNotFound(_0x174151,null))[_0xaf12('0x2a')](function(_0x320110){if(_0x320110){return _0x320110['removeTags'](_0xeedd4c[_0xaf12('0x3b')][_0xaf12('0xbb')]);}})[_0xaf12('0x2a')](respondWithStatusCode(_0x174151,null))['catch'](handleError(_0x174151,null));};exports[_0xaf12('0xc2')]=function(_0x1fafb2,_0x290c37){var _0xff0d29=moment()[_0xaf12('0xc3')]()['toString']();var _0x2ba073=path[_0xaf12('0xc4')](config[_0xaf12('0xc5')],_0xaf12('0xc6'),_0xaf12('0xc7'),_0xaf12('0xc8'));var _0x2ad6ef=path[_0xaf12('0xc4')](config[_0xaf12('0xc5')],_0xaf12('0xc6'),_0xaf12('0xc7'),_0xaf12('0xc9'));var _0x38d0ce=path['join'](_0x2ba073,_0xff0d29);var _0x34c271=util[_0xaf12('0xca')]('transcript-%d-%s.zip',_0x1fafb2['params']['id'],_0xff0d29);var _0x1c5290=path[_0xaf12('0xc4')](_0x2ba073,_0x34c271);var _0x5d42f6=[];_0x5d42f6[_0xaf12('0x31')]({'model':db['Attachment'],'as':_0xaf12('0xcb'),'raw':!![]});var _0x2aed08=[{'model':db[_0xaf12('0xb9')],'as':_0xaf12('0xcc'),'attributes':['id','body','createdAt'],'include':_0x5d42f6}];return db['FaxInteraction'][_0xaf12('0x5c')]({'where':{'id':_0x1fafb2[_0xaf12('0xb2')]['id']},'include':_0x2aed08})[_0xaf12('0x2a')](handleEntityNotFound(_0x290c37,null))[_0xaf12('0x2a')](function(_0x4ade24){if(_0x4ade24&&_0x4ade24['Messages']){var _0x31b760=_0x4ade24[_0xaf12('0xcd')]({'plain':!![]});fs['mkdirSync'](_0x38d0ce);for(var _0x4c49e5=0x0;_0x4c49e5<_0x31b760[_0xaf12('0xcc')][_0xaf12('0x3e')];_0x4c49e5++){var _0x5f3fb9=_0x31b760[_0xaf12('0xcc')][_0x4c49e5]['Attachment'];if(_0x5f3fb9){var _0x2743b9=path[_0xaf12('0xc4')](_0x2ad6ef,_0x5f3fb9['basename']);if(fs[_0xaf12('0xce')](_0x2743b9)){fs[_0xaf12('0xcf')](_0x2743b9)[_0xaf12('0xd0')](fs[_0xaf12('0xd1')](path[_0xaf12('0xc4')](_0x38d0ce,_0x5f3fb9[_0xaf12('0xd2')])));}}}return BPromise['resolve']()['then'](function(){return new BPromise(function(_0x7ba374,_0x57848d){zipdir(_0x38d0ce,{'saveTo':_0x1c5290},function(_0x4884e4,_0x26ac41){if(_0x4884e4)return _0x57848d(_0x4884e4);return _0x7ba374(_0x26ac41);});})['then'](function(){return new BPromise(function(_0x323edd,_0x51f714){rimraf(_0x38d0ce,function(_0x2369a9){if(_0x2369a9)_0x51f714(_0x2369a9);return _0x323edd();});});})[_0xaf12('0x2a')](function(){return _0x290c37['download'](_0x1c5290,_0x34c271,function(_0x36f152){if(_0x36f152){console['log'](_0xaf12('0xd3'),_0x36f152);}else{fs[_0xaf12('0xd4')](_0x1c5290);}});});});}else{return _0x290c37['sendStatus'](0xc8);}})[_0xaf12('0x32')](handleError(_0x290c37,null));}; \ No newline at end of file +var _0xb10d=['key','model','query','keys','intersection','attributes','fields','hasOwnProperty','order','where','filters','select','field','tools_tags','u.id','u.fullname','ui.FaxInteractionId','from','user_has_fax_interactions','left_join','users','u.id\x20=\x20ui.UserId','fax_interactions','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','fax_accounts','a.id\x20=\x20i.FaxAccountId','fax_messages','me.FaxInteractionId\x20=\x20i.id','it.FaxInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','search','parseSearch','sqlOperator','conditions','length','find','`\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','value','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','buildExpression','text','start','end','Tag','forEach','User','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','body','compact','isEmpty','i.FaxAccountId\x20IN\x20?','concat','createdAt','parse','$gte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','\x20=\x20?','read','having','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','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?','group','i.id','SELECT','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','DESC','t.id\x20IN\x20?','resolve','FaxAccountId','journey','i.FaxAccountId\x20IS\x20NOT\x20NULL','user','getFaxAccounts','i.FaxAccountId\x20IS\x20NULL','sequelize','toString','keyBy','merge','unreadMessages','a.key','i.*','c.firstName','Contact.firstName','c.lastName','Contact.lastName','c.email','Contact.email','c.phone','Contact.phone','Contact.mobile','c.fax','Contact.fax','Owner.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.FaxInteractionId\x20IN\x20?','groupBy','FaxInteractionId','all','rows','show','params','include','options','create','describe','addMessage','FaxMessage','omit','ids','getMessages','findOne','nolimit','sort','pick','format','findAll','addTags','setTags','spread','faxInteractionTags:save','removeTags','download','unix','join','root','server','files','attachments','transcript-%d-%s.zip','Attachment','Messages','get','basename','existsSync','createWriteStream','err','unlinkSync','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','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','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','sendStatus','status','json','count','offset','limit','set','Content-Range','apply','reject','save','then','destroy','error','stack','name','send','Users','map','fullname','TagIds','Tags','split','push','catch','FaxInteraction','rawAttributes','fieldName','type'];(function(_0x55c193,_0x3dc41a){var _0x56f621=function(_0xb184fb){while(--_0xb184fb){_0x55c193['push'](_0x55c193['shift']());}};_0x56f621(++_0x3dc41a);}(_0xb10d,0x17f));var _0xdb10=function(_0x5b97dc,_0x40d43e){_0x5b97dc=_0x5b97dc-0x0;var _0x44d434=_0xb10d[_0x5b97dc];return _0x44d434;};'use strict';var pdf=require(_0xdb10('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xdb10('0x1'));var zipdir=require(_0xdb10('0x2'));var jsonpatch=require(_0xdb10('0x3'));var rp=require(_0xdb10('0x4'));var moment=require(_0xdb10('0x5'));var BPromise=require(_0xdb10('0x6'));var Mustache=require(_0xdb10('0x7'));var util=require(_0xdb10('0x8'));var path=require(_0xdb10('0x9'));var sox=require(_0xdb10('0xa'));var csv=require(_0xdb10('0xb'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xdb10('0xc'));var squel=require(_0xdb10('0xd'));var crypto=require(_0xdb10('0xe'));var jsforce=require(_0xdb10('0xf'));var deskjs=require(_0xdb10('0x10'));var toCsv=require(_0xdb10('0xb'));var querystring=require(_0xdb10('0x11'));var Papa=require(_0xdb10('0x12'));var Redis=require(_0xdb10('0x13'));var authService=require(_0xdb10('0x14'));var qs=require(_0xdb10('0x15'));var as=require(_0xdb10('0x16'));var hardwareService=require(_0xdb10('0x17'));var logger=require(_0xdb10('0x18'))(_0xdb10('0x19'));var utils=require(_0xdb10('0x1a'));var config=require(_0xdb10('0x1b'));var db=require(_0xdb10('0x1c'))['db'];config[_0xdb10('0x1d')]=_[_0xdb10('0x1e')](config[_0xdb10('0x1d')],{'host':_0xdb10('0x1f'),'port':0x18eb});var socket=require(_0xdb10('0x20'))(new Redis(config[_0xdb10('0x1d')]));require('./faxInteraction.socket')[_0xdb10('0x21')](socket);function respondWithStatusCode(_0x1daa95,_0xf8cc1){_0xf8cc1=_0xf8cc1||0xcc;return function(_0x3efe0e){if(_0x3efe0e){return _0x1daa95[_0xdb10('0x22')](_0xf8cc1);}return _0x1daa95[_0xdb10('0x23')](_0xf8cc1)['end']();};}function respondWithResult(_0x161e0d,_0x21393b){_0x21393b=_0x21393b||0xc8;return function(_0x506de3){if(_0x506de3){return _0x161e0d[_0xdb10('0x23')](_0x21393b)[_0xdb10('0x24')](_0x506de3);}};}function respondWithFilteredResult(_0x5b484e,_0xe826ef){return function(_0x52ccdd){if(_0x52ccdd){var _0xbf36da=_0x52ccdd[_0xdb10('0x25')],_0x4964aa=_0xe826ef[_0xdb10('0x26')],_0x3b9f45=_0xe826ef['offset']+_0xe826ef[_0xdb10('0x27')],_0xe1d26e;if(_0x3b9f45>=_0xbf36da){_0x3b9f45=_0xbf36da;_0xe1d26e=0xc8;}else{_0xe1d26e=0xce;}_0x5b484e[_0xdb10('0x23')](_0xe1d26e);return _0x5b484e[_0xdb10('0x28')](_0xdb10('0x29'),_0x4964aa+'-'+_0x3b9f45+'/'+_0xbf36da)['json'](_0x52ccdd);}return null;};}function patchUpdates(_0xcb38eb){return function(_0x138afd){try{jsonpatch[_0xdb10('0x2a')](_0x138afd,_0xcb38eb,!![]);}catch(_0xda224e){return BPromise[_0xdb10('0x2b')](_0xda224e);}return _0x138afd[_0xdb10('0x2c')]();};}function saveUpdates(_0x145497,_0x30baba){return function(_0x8d5fb4){if(_0x8d5fb4){return _0x8d5fb4['update'](_0x145497)[_0xdb10('0x2d')](function(_0x148f2b){return _0x148f2b;});}return null;};}function removeEntity(_0x5ba42a,_0x249e94){return function(_0x7e43d){if(_0x7e43d){return _0x7e43d[_0xdb10('0x2e')]()[_0xdb10('0x2d')](function(){_0x5ba42a['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0xc65e60,_0x53e626){return function(_0x2d67aa){if(!_0x2d67aa){_0xc65e60[_0xdb10('0x22')](0x194);}return _0x2d67aa;};}function handleError(_0x39116e,_0x4db7ba){_0x4db7ba=_0x4db7ba||0x1f4;return function(_0xea9ba7){logger[_0xdb10('0x2f')](_0xea9ba7[_0xdb10('0x30')]);if(_0xea9ba7[_0xdb10('0x31')]){delete _0xea9ba7[_0xdb10('0x31')];}_0x39116e[_0xdb10('0x23')](_0x4db7ba)[_0xdb10('0x32')](_0xea9ba7);};}function getInteractionUsers(_0x2a9ecd,_0xa48d52){return new BPromise(function(_0x42ef28,_0x3627ae){try{if(_0xa48d52[_0x2a9ecd['id']]){_0x2a9ecd[_0xdb10('0x33')]=_[_0xdb10('0x34')](_0xa48d52[_0x2a9ecd['id']],function(_0x413af0){return{'id':_0x413af0['id'],'fullname':_0x413af0[_0xdb10('0x35')]};});}}catch(_0xfa535a){_0x3627ae(_0xfa535a);}_0x42ef28(_0x2a9ecd);});}function getInteractionTags(_0x4a68a9,_0x176a92){return new BPromise(function(_0x162f07,_0x29ad5a){try{if(_0x4a68a9[_0xdb10('0x36')]){_0x4a68a9[_0xdb10('0x37')]=[];_0x4a68a9[_0xdb10('0x36')][_0xdb10('0x38')](',')['forEach'](function(_0x1b2d93){_0x4a68a9[_0xdb10('0x37')][_0xdb10('0x39')](_0x176a92[_0x1b2d93]);});}delete _0x4a68a9['TagIds'];}catch(_0x5bb47f){_0x29ad5a(_0x5bb47f);}_0x162f07(_0x4a68a9);});}function updateFaxInteraction(_0x4d8224,_0x47a08f,_0x3891ea){return new BPromise(function(_0x20995d,_0x5aa891){return getInteractionUsers(_0x4d8224,_0x3891ea)['then'](function(_0x510be0){return getInteractionTags(_0x510be0,_0x47a08f);})[_0xdb10('0x2d')](function(_0x5bb6de){_0x20995d(_0x5bb6de);})[_0xdb10('0x3a')](function(_0x391021){_0x5aa891(_0x391021);});});}exports['index']=function(_0x1efbf0,_0x31de80){var _0x25391d={},_0x59b8f4={},_0x22fdde={'count':0x0,'rows':[]};var _0xc399ab=_[_0xdb10('0x34')](db[_0xdb10('0x3b')][_0xdb10('0x3c')],function(_0xef31d4){return{'name':_0xef31d4[_0xdb10('0x3d')],'type':_0xef31d4[_0xdb10('0x3e')][_0xdb10('0x3f')]};});_0x59b8f4[_0xdb10('0x40')]=_[_0xdb10('0x34')](_0xc399ab,_0xdb10('0x31'));_0x59b8f4[_0xdb10('0x41')]=_[_0xdb10('0x42')](_0x1efbf0['query']);_0x59b8f4['filters']=_[_0xdb10('0x43')](_0x59b8f4[_0xdb10('0x40')],_0x59b8f4[_0xdb10('0x41')]);_0x25391d[_0xdb10('0x44')]=_[_0xdb10('0x43')](_0x59b8f4[_0xdb10('0x40')],qs[_0xdb10('0x45')](_0x1efbf0['query']['fields']));_0x25391d[_0xdb10('0x44')]=_0x25391d['attributes']['length']?_0x25391d['attributes']:_0x59b8f4[_0xdb10('0x40')];if(!_0x1efbf0[_0xdb10('0x41')][_0xdb10('0x46')]('nolimit')){_0x25391d[_0xdb10('0x27')]=qs[_0xdb10('0x27')](_0x1efbf0[_0xdb10('0x41')][_0xdb10('0x27')]);_0x25391d[_0xdb10('0x26')]=qs[_0xdb10('0x26')](_0x1efbf0['query'][_0xdb10('0x26')]);}_0x25391d[_0xdb10('0x47')]=qs['sort'](_0x1efbf0[_0xdb10('0x41')]['sort']);_0x25391d[_0xdb10('0x48')]=qs['filters'](_['pick'](_0x1efbf0[_0xdb10('0x41')],_0x59b8f4[_0xdb10('0x49')]),_0xc399ab);var _0x7009e1=[];var _0x477391=squel[_0xdb10('0x4a')]()[_0xdb10('0x4b')]('id')[_0xdb10('0x4b')](_0xdb10('0x31'))[_0xdb10('0x4b')]('color')['from'](_0xdb10('0x4c'));var _0x5c88b2=squel[_0xdb10('0x4a')]()[_0xdb10('0x4b')](_0xdb10('0x4d'))['field'](_0xdb10('0x4e'))[_0xdb10('0x4b')](_0xdb10('0x4f'))[_0xdb10('0x50')](_0xdb10('0x51'),'ui')[_0xdb10('0x52')](_0xdb10('0x53'),'u',_0xdb10('0x54'));var _0x3fcb18=squel[_0xdb10('0x4a')]()[_0xdb10('0x50')](_0xdb10('0x55'),'i')['left_join'](_0xdb10('0x56'),'c',_0xdb10('0x57'))[_0xdb10('0x52')]('users','o',_0xdb10('0x58'))[_0xdb10('0x52')](_0xdb10('0x59'),'a',_0xdb10('0x5a'))[_0xdb10('0x52')](_0xdb10('0x5b'),'me',_0xdb10('0x5c'))['left_join']('fax_interaction_has_tags','it',_0xdb10('0x5d'))[_0xdb10('0x52')](_0xdb10('0x4c'),'t',_0xdb10('0x5e'));var _0x3b2bc9=squel[_0xdb10('0x5f')]();var _0xf2392a=[];var _0x398669=squel[_0xdb10('0x5f')]();var _0x17dfaa;if(_0x1efbf0[_0xdb10('0x41')][_0xdb10('0x60')]){_0x17dfaa=as[_0xdb10('0x61')](_0x1efbf0['query']['search']);var _0x31c899=_0x17dfaa[_0xdb10('0x62')];for(var _0x312717=0x0;_0x312717<_0x17dfaa[_0xdb10('0x63')][_0xdb10('0x64')];_0x312717++){var _0x12bd00=_0x17dfaa['conditions'][_0x312717];var _0x4ff1b1='i';var _0x51aa5b=_[_0xdb10('0x65')](_0xc399ab,[_0xdb10('0x31'),_0x12bd00[_0xdb10('0x4b')]]);if(!_0x51aa5b){switch(_0x12bd00[_0xdb10('0x4b')]){case'unreadMessages':if(_0x12bd00['value']==0x1){_0x3fcb18['having']('`'+_0x12bd00[_0xdb10('0x4b')]+_0xdb10('0x66'));}else{_0x3fcb18['having']('`'+_0x12bd00['field']+'`\x20>\x200');}break;case _0xdb10('0x67'):if(_0x12bd00[_0xdb10('0x68')]===_0xdb10('0x69')){if(_0x12bd00['value']['split']('\x20')[_0xdb10('0x64')]>0x1){_0x3b2bc9[_0x31c899](_0xdb10('0x6a'),qs[_0xdb10('0x6b')](_0x12bd00[_0xdb10('0x6c')]),null);}else{var _0x2f2b6f='%'+_0x12bd00['value']+'%';_0x3b2bc9[_0x31c899](_0xdb10('0x6d'),_0x2f2b6f,_0x2f2b6f,_0x2f2b6f);}}else{_0x51aa5b=_['find'](_0xc399ab,[_0xdb10('0x31'),_0xdb10('0x6e')]);_0x12bd00['field']=_0xdb10('0x6e');_0x46bdc4=as[_0xdb10('0x6f')](_0x4ff1b1,_0x51aa5b['type'],_0x12bd00);_0x3b2bc9[_0x31c899](_0x46bdc4[_0xdb10('0x70')],_0x46bdc4[_0xdb10('0x6c')][_0xdb10('0x71')],_0x46bdc4[_0xdb10('0x6c')][_0xdb10('0x72')]);}break;case _0xdb10('0x73'):var _0x55ed89=_0x12bd00['value']['split'](',')[_0xdb10('0x34')](function(_0x48a08b){return Number(_0x48a08b);});_0x55ed89[_0xdb10('0x74')](function(_0x1a7d29){_0x398669['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x1a7d29+',%');});_0xf2392a=_['union'](_0xf2392a,_0x55ed89);break;case _0xdb10('0x75'):if(_0x12bd00[_0xdb10('0x68')]===_0xdb10('0x69')){_0x3b2bc9[_0x31c899](_0xdb10('0x76'),'%'+_0x12bd00['value']+'%',null);}else{_0x51aa5b=_[_0xdb10('0x65')](_0xc399ab,[_0xdb10('0x31'),_0xdb10('0x77')]);_0x12bd00[_0xdb10('0x4b')]=_0xdb10('0x77');_0x46bdc4=as[_0xdb10('0x6f')](_0x4ff1b1,_0x51aa5b[_0xdb10('0x3e')],_0x12bd00);_0x3b2bc9[_0x31c899](_0x46bdc4[_0xdb10('0x70')],_0x46bdc4[_0xdb10('0x6c')][_0xdb10('0x71')],_0x46bdc4['value'][_0xdb10('0x72')]);}break;case _0xdb10('0x78'):_0x46bdc4=as[_0xdb10('0x6f')]('me',null,_0x12bd00);_0x3b2bc9[_0x31c899](_0x46bdc4[_0xdb10('0x70')],_0x46bdc4['value'][_0xdb10('0x71')],_0x46bdc4['value'][_0xdb10('0x72')]);break;}}else{var _0x46bdc4=as[_0xdb10('0x6f')](_0x4ff1b1,_0x51aa5b['type'],_0x12bd00);_0x3b2bc9[_0x31c899](_0x46bdc4[_0xdb10('0x70')],_0x46bdc4[_0xdb10('0x6c')][_0xdb10('0x71')],_0x46bdc4[_0xdb10('0x6c')][_0xdb10('0x72')]);}}}else{var _0x299976=_(_0x1efbf0[_0xdb10('0x41')])[_0xdb10('0x42')]()[_0xdb10('0x34')](function(_0x4ad2f7){return _['some'](_0xc399ab,[_0xdb10('0x31'),_0x4ad2f7])?_0x4ad2f7:undefined;})[_0xdb10('0x79')]()[_0xdb10('0x6c')]();if(!_[_0xdb10('0x7a')](_0x299976)){_0x299976[_0xdb10('0x74')](function(_0x31933b){if(_0x31933b==='FaxAccountId'){_0x3fcb18[_0xdb10('0x48')](_0xdb10('0x7b'),[][_0xdb10('0x7c')](_0x1efbf0['query'][_0x31933b]));}else if(_0x31933b===_0xdb10('0x7d')){var _0x315e29=JSON[_0xdb10('0x7e')](_0x1efbf0[_0xdb10('0x41')][_0x31933b])[_0xdb10('0x7f')];var _0x35b25c=JSON[_0xdb10('0x7e')](_0x1efbf0[_0xdb10('0x41')][_0x31933b])['$lte'];_0x3fcb18[_0xdb10('0x48')](_0xdb10('0x80'),_0x315e29,_0x35b25c);}else{if(_0x1efbf0[_0xdb10('0x41')][_0x31933b]===_0xdb10('0x81')){_0x3fcb18[_0xdb10('0x48')]('i.'+_0x31933b+_0xdb10('0x82'));}else{_0x3fcb18[_0xdb10('0x48')]('i.'+_0x31933b+_0xdb10('0x83'),_0x1efbf0[_0xdb10('0x41')][_0x31933b]);}}});}if(_0x1efbf0[_0xdb10('0x41')][_0xdb10('0x84')]){if(_0x1efbf0[_0xdb10('0x41')][_0xdb10('0x84')]==0x1){_0x3fcb18[_0xdb10('0x85')](_0xdb10('0x86'));}else{_0x3fcb18[_0xdb10('0x85')](_0xdb10('0x87'));}}if(_0x1efbf0[_0xdb10('0x41')][_0xdb10('0x88')]){_0xf2392a=_['isArray'](_0x1efbf0['query']['tag'])?_0x1efbf0[_0xdb10('0x41')][_0xdb10('0x88')]:new Array(_0x1efbf0['query'][_0xdb10('0x88')]);_0xf2392a[_0xdb10('0x74')](function(_0x5936fa){_0x398669['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x5936fa+',%');});}if(_0x1efbf0[_0xdb10('0x41')][_0xdb10('0x89')]){var _0x4eab70=_0x1efbf0[_0xdb10('0x41')][_0xdb10('0x89')]['replace']('\x5c','\x5c\x5c')[_0xdb10('0x8a')]('\x27\x27',_0xdb10('0x8b'));if(qs[_0xdb10('0x8c')](_0x4eab70)){_0x3b2bc9['or'](_0xdb10('0x8d'),_0x4eab70+'%')['or'](_0xdb10('0x8e'),_0x4eab70+'%');}_0x3b2bc9['or'](_0xdb10('0x8f'),_0x4eab70+'%');}}_0x3fcb18[_0xdb10('0x48')](_0x3b2bc9);_0x3fcb18[_0xdb10('0x90')](_0xdb10('0x91'));var _0x2da03b={'type':db['Sequelize']['QueryTypes'][_0xdb10('0x92')],'raw':!![]};var _0x215a58=_0x3fcb18[_0xdb10('0x93')]();_0x215a58['field']('i.id');_0x215a58[_0xdb10('0x4b')](_0xdb10('0x94'),'unreadMessages');if(_0x25391d[_0xdb10('0x47')]){_0x25391d[_0xdb10('0x47')][_0xdb10('0x74')](function(_0x3aec3c){_0x3fcb18[_0xdb10('0x47')]('i.'+_0x3aec3c[0x0],_0x3aec3c[0x1]===_0xdb10('0x95')?![]:!![]);});}if(!_[_0xdb10('0x7a')](_0xf2392a)){_0x3fcb18[_0xdb10('0x85')](_0x398669);_0x215a58['where'](_0xdb10('0x96'),_0xf2392a);}BPromise[_0xdb10('0x97')]()[_0xdb10('0x2d')](function(){if(!_0x17dfaa){if(_0x1efbf0['query'][_0xdb10('0x98')]||_0x1efbf0[_0xdb10('0x41')][_0xdb10('0x99')])return;_0x215a58[_0xdb10('0x48')](_0xdb10('0x9a'));_0x3fcb18['where']('i.FaxAccountId\x20IS\x20NOT\x20NULL');return;}return _0x1efbf0[_0xdb10('0x9b')][_0xdb10('0x9c')]({'attributes':['id'],'raw':!![]})[_0xdb10('0x2d')](function(_0x31ae51){if(_[_0xdb10('0x7a')](_0x31ae51)){_0x215a58[_0xdb10('0x48')](_0xdb10('0x9d'));_0x3fcb18['where'](_0xdb10('0x9d'));}else{_0x215a58[_0xdb10('0x48')](_0xdb10('0x7b'),_[_0xdb10('0x34')](_0x31ae51,'id'));_0x3fcb18[_0xdb10('0x48')](_0xdb10('0x7b'),_[_0xdb10('0x34')](_0x31ae51,'id'));}});})[_0xdb10('0x2d')](function(){db[_0xdb10('0x9e')][_0xdb10('0x41')](_0x215a58[_0xdb10('0x9f')](),_0x2da03b)[_0xdb10('0x2d')](function(_0x4d6b9a){_0x22fdde[_0xdb10('0x25')]=_0x4d6b9a[_0xdb10('0x64')];if(_0x22fdde[_0xdb10('0x25')]===0x0)return[];return db[_0xdb10('0x9e')][_0xdb10('0x41')](_0x477391['toString'](),_0x2da03b)['then'](function(_0x366b54){_0x7009e1=_[_0xdb10('0xa0')](_0x366b54,'id');_0x2da03b=_[_0xdb10('0xa1')](_0x2da03b,{'model':db[_0xdb10('0x3b')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x1efbf0['query'][_0xdb10('0x45')]){_0x25391d[_0xdb10('0x44')][_0xdb10('0x74')](function(_0x138ec7){_0x3fcb18[_0xdb10('0x4b')]('i.'+_0x138ec7);});}else{_0x3fcb18[_0xdb10('0x4b')](_0xdb10('0x94'),_0xdb10('0xa2'));_0x3fcb18[_0xdb10('0x4b')](_0xdb10('0xa3'),'Account.key');_0x3fcb18['field']('a.mandatoryDisposition','Account.mandatoryDisposition');_0x3fcb18[_0xdb10('0x4b')](_0xdb10('0xa4'));_0x3fcb18[_0xdb10('0x4b')](_0xdb10('0xa5'),_0xdb10('0xa6'));_0x3fcb18[_0xdb10('0x4b')](_0xdb10('0xa7'),_0xdb10('0xa8'));_0x3fcb18[_0xdb10('0x4b')](_0xdb10('0xa9'),_0xdb10('0xaa'));_0x3fcb18[_0xdb10('0x4b')](_0xdb10('0xab'),_0xdb10('0xac'));_0x3fcb18[_0xdb10('0x4b')]('c.mobile',_0xdb10('0xad'));_0x3fcb18['field'](_0xdb10('0xae'),_0xdb10('0xaf'));_0x3fcb18[_0xdb10('0x4b')]('o.fullname',_0xdb10('0xb0'));_0x3fcb18[_0xdb10('0x4b')](_0xdb10('0xb1'),_0xdb10('0xb2'));_0x3fcb18[_0xdb10('0x4b')](_0xdb10('0xb3'),'TagIds');}if(_0x25391d[_0xdb10('0x27')])_0x3fcb18[_0xdb10('0x27')](_0x25391d[_0xdb10('0x27')]);if(_0x25391d[_0xdb10('0x26')])_0x3fcb18[_0xdb10('0x26')](_0x25391d[_0xdb10('0x26')]);return db['sequelize'][_0xdb10('0x41')](_0x3fcb18[_0xdb10('0x9f')](),_0x2da03b);})[_0xdb10('0x2d')](function(_0x42b12f){_0x5c88b2[_0xdb10('0x48')](_0xdb10('0xb4'),_['map'](_0x42b12f,'id'));return db[_0xdb10('0x9e')][_0xdb10('0x41')](_0x5c88b2[_0xdb10('0x9f')](),_0x2da03b)[_0xdb10('0x2d')](function(_0x325fa6){var _0x45ea99=_[_0xdb10('0xb5')](_0x325fa6,_0xdb10('0xb6'));var _0x278011=[];_0x42b12f['forEach'](function(_0x40991a){_0x278011[_0xdb10('0x39')](updateFaxInteraction(_0x40991a,_0x7009e1,_0x45ea99));});return BPromise[_0xdb10('0xb7')](_0x278011);});});})[_0xdb10('0x2d')](function(_0x344097){_0x22fdde[_0xdb10('0xb8')]=_0x344097;return _0x22fdde;})['then'](respondWithFilteredResult(_0x31de80,_0x25391d));})[_0xdb10('0x3a')](handleError(_0x31de80,null));};exports[_0xdb10('0xb9')]=function(_0xfad854,_0x1bb9e9){var _0x4f0f73={'raw':![],'where':{'id':_0xfad854[_0xdb10('0xba')]['id']}},_0x55c35d={};_0x55c35d[_0xdb10('0x40')]=_[_0xdb10('0x42')](db['FaxInteraction'][_0xdb10('0x3c')]);_0x55c35d['query']=_[_0xdb10('0x42')](_0xfad854['query']);_0x55c35d[_0xdb10('0x49')]=_['intersection'](_0x55c35d[_0xdb10('0x40')],_0x55c35d[_0xdb10('0x41')]);_0x4f0f73[_0xdb10('0x44')]=_[_0xdb10('0x43')](_0x55c35d[_0xdb10('0x40')],qs[_0xdb10('0x45')](_0xfad854[_0xdb10('0x41')][_0xdb10('0x45')]));_0x4f0f73[_0xdb10('0x44')]=_0x4f0f73['attributes'][_0xdb10('0x64')]?_0x4f0f73['attributes']:_0x55c35d['model'];if(_0xfad854['query']['includeAll']){_0x4f0f73[_0xdb10('0xbb')]=[{'all':!![]}];}_0x4f0f73=_[_0xdb10('0xa1')]({},_0x4f0f73,_0xfad854[_0xdb10('0xbc')]);return db[_0xdb10('0x3b')][_0xdb10('0x65')](_0x4f0f73)[_0xdb10('0x2d')](handleEntityNotFound(_0x1bb9e9,null))[_0xdb10('0x2d')](respondWithResult(_0x1bb9e9,null))[_0xdb10('0x3a')](handleError(_0x1bb9e9,null));};exports['create']=function(_0x29ed6a,_0x555dd9){return db[_0xdb10('0x3b')][_0xdb10('0xbd')](_0x29ed6a[_0xdb10('0x78')],{})['then'](respondWithResult(_0x555dd9,0xc9))[_0xdb10('0x3a')](handleError(_0x555dd9,null));};exports['update']=function(_0x6bfc0b,_0x3c2ef7){if(_0x6bfc0b[_0xdb10('0x78')]['id']){delete _0x6bfc0b[_0xdb10('0x78')]['id'];}return db['FaxInteraction'][_0xdb10('0x65')]({'where':{'id':_0x6bfc0b[_0xdb10('0xba')]['id']}})[_0xdb10('0x2d')](handleEntityNotFound(_0x3c2ef7,null))[_0xdb10('0x2d')](saveUpdates(_0x6bfc0b[_0xdb10('0x78')],null))['then'](respondWithResult(_0x3c2ef7,null))[_0xdb10('0x3a')](handleError(_0x3c2ef7,null));};exports[_0xdb10('0x2e')]=function(_0x1f980a,_0x15010f){return db['FaxInteraction'][_0xdb10('0x65')]({'where':{'id':_0x1f980a['params']['id']}})['then'](handleEntityNotFound(_0x15010f,null))['then'](removeEntity(_0x15010f,null))[_0xdb10('0x3a')](handleError(_0x15010f,null));};exports[_0xdb10('0xbe')]=function(_0x428caa,_0x548415){return db[_0xdb10('0x3b')][_0xdb10('0xbe')]()[_0xdb10('0x2d')](respondWithResult(_0x548415,null))[_0xdb10('0x3a')](handleError(_0x548415,null));};exports[_0xdb10('0xbf')]=function(_0x187733,_0x2a9206,_0x4e1bee){return db[_0xdb10('0xc0')]['find']({'where':{'id':_0x187733[_0xdb10('0xba')]['id']}})[_0xdb10('0x2d')](handleEntityNotFound(_0x2a9206,null))['then'](function(_0x5709fa){if(_0x5709fa){return _0x5709fa[_0xdb10('0xbf')](_0x187733[_0xdb10('0x78')]['ids'],_[_0xdb10('0xc1')](_0x187733['body'],[_0xdb10('0xc2'),'id'])||{});}})[_0xdb10('0x2d')](respondWithResult(_0x2a9206,null))[_0xdb10('0x3a')](handleError(_0x2a9206,null));};exports[_0xdb10('0xc3')]=function(_0x2f40ad,_0x5da3a1,_0xbb8d60){var _0x1e45e3={'raw':![],'where':{}};var _0x2eec59={};var _0x237f77={'count':0x0,'rows':[]};return db[_0xdb10('0x3b')][_0xdb10('0xc4')]({'where':{'id':_0x2f40ad[_0xdb10('0xba')]['id']}})[_0xdb10('0x2d')](handleEntityNotFound(_0x5da3a1,null))[_0xdb10('0x2d')](function(_0x363ea4){if(_0x363ea4){_0x2eec59[_0xdb10('0x40')]=_[_0xdb10('0x42')](db['FaxMessage'][_0xdb10('0x3c')]);_0x2eec59['query']=_[_0xdb10('0x42')](_0x2f40ad[_0xdb10('0x41')]);_0x2eec59['filters']=_[_0xdb10('0x43')](_0x2eec59[_0xdb10('0x40')],_0x2eec59['query']);_0x1e45e3[_0xdb10('0x44')]=_[_0xdb10('0x43')](_0x2eec59[_0xdb10('0x40')],qs['fields'](_0x2f40ad[_0xdb10('0x41')][_0xdb10('0x45')]));_0x1e45e3[_0xdb10('0x44')]=_0x1e45e3['attributes'][_0xdb10('0x64')]?_0x1e45e3['attributes']:_0x2eec59[_0xdb10('0x40')];if(!_0x2f40ad[_0xdb10('0x41')]['hasOwnProperty'](_0xdb10('0xc5'))){_0x1e45e3[_0xdb10('0x27')]=qs['limit'](_0x2f40ad[_0xdb10('0x41')][_0xdb10('0x27')]);_0x1e45e3[_0xdb10('0x26')]=qs['offset'](_0x2f40ad[_0xdb10('0x41')]['offset']);}_0x1e45e3[_0xdb10('0x47')]=qs['sort'](_0x2f40ad[_0xdb10('0x41')][_0xdb10('0xc6')]);_0x1e45e3['where']=qs[_0xdb10('0x49')](_[_0xdb10('0xc7')](_0x2f40ad[_0xdb10('0x41')],_0x2eec59[_0xdb10('0x49')]));_0x1e45e3[_0xdb10('0x48')][_0xdb10('0xb6')]=_0x363ea4['id'];if(_0x2f40ad[_0xdb10('0x41')]['filter']){_0x1e45e3['where']=_[_0xdb10('0xa1')](_0x1e45e3[_0xdb10('0x48')],{'$or':_['map'](_0x1e45e3[_0xdb10('0x44')],function(_0x1dd4f7){var _0xb0ebba={};_0xb0ebba[_0x1dd4f7]={'$like':'%'+_0x2f40ad[_0xdb10('0x41')][_0xdb10('0x89')]+'%'};return _0xb0ebba;})});}if(_0x2f40ad[_0xdb10('0x41')][_0xdb10('0x7f')]){var _0x49aca5=_0x2f40ad[_0xdb10('0x41')][_0xdb10('0x7f')]['split'](',');var _0x53dc27={};_0x53dc27[_0x49aca5[0x0]]={'$gte':moment(_0x49aca5[0x1])[_0xdb10('0xc8')]('YYYY-MM-DD\x20HH:mm:ss')};_0x1e45e3[_0xdb10('0x48')]=_[_0xdb10('0xa1')](_0x1e45e3[_0xdb10('0x48')],_0x53dc27);}_0x1e45e3=_[_0xdb10('0xa1')]({},_0x1e45e3,_0x2f40ad[_0xdb10('0xbc')]);return db['FaxMessage']['count']({'where':_0x1e45e3['where']})['then'](function(_0xcaa3f2){_0x237f77[_0xdb10('0x25')]=_0xcaa3f2;if(_0x2f40ad['query']['includeAll']){_0x1e45e3['include']=[{'all':!![]}];}return db['FaxMessage'][_0xdb10('0xc9')](_0x1e45e3);})['then'](function(_0x39ccd5){_0x237f77[_0xdb10('0xb8')]=_0x39ccd5;return _0x237f77;});}})[_0xdb10('0x2d')](respondWithFilteredResult(_0x5da3a1,_0x1e45e3))['catch'](handleError(_0x5da3a1,null));};exports[_0xdb10('0xca')]=function(_0x4de46d,_0x10d81d,_0x5f12d3){return db['FaxInteraction'][_0xdb10('0x65')]({'where':{'id':_0x4de46d[_0xdb10('0xba')]['id']}})[_0xdb10('0x2d')](handleEntityNotFound(_0x10d81d,null))[_0xdb10('0x2d')](function(_0x54025e){if(_0x54025e){return _0x54025e[_0xdb10('0xcb')](_0x4de46d['body'][_0xdb10('0xc2')],_['omit'](_0x4de46d[_0xdb10('0x78')],[_0xdb10('0xc2'),'id'])||{})[_0xdb10('0xcc')](function(){return db[_0xdb10('0x73')][_0xdb10('0xc9')]({'attributes':['id','name','color'],'where':{'id':_0x4de46d[_0xdb10('0x78')][_0xdb10('0xc2')]}});})[_0xdb10('0x2d')](function(_0x4461ff){socket['emit'](_0xdb10('0xcd'),{'id':Number(_0x4de46d['params']['id']),'tags':_0x4461ff||[]});return{'id':Number(_0x4de46d[_0xdb10('0xba')]['id']),'tags':_0x4461ff||[]};});}})[_0xdb10('0x2d')](respondWithResult(_0x10d81d,null))[_0xdb10('0x3a')](handleError(_0x10d81d,null));};exports[_0xdb10('0xce')]=function(_0x52794a,_0x3d45ea,_0x46b109){return db[_0xdb10('0x3b')][_0xdb10('0x65')]({'where':{'id':_0x52794a[_0xdb10('0xba')]['id']}})[_0xdb10('0x2d')](handleEntityNotFound(_0x3d45ea,null))[_0xdb10('0x2d')](function(_0x5645fd){if(_0x5645fd){return _0x5645fd['removeTags'](_0x52794a['query']['ids']);}})[_0xdb10('0x2d')](respondWithStatusCode(_0x3d45ea,null))[_0xdb10('0x3a')](handleError(_0x3d45ea,null));};exports[_0xdb10('0xcf')]=function(_0x4d9a10,_0x16b86c){var _0x5154b0=moment()[_0xdb10('0xd0')]()['toString']();var _0x29b4aa=path[_0xdb10('0xd1')](config[_0xdb10('0xd2')],_0xdb10('0xd3'),_0xdb10('0xd4'),'tmp');var _0x41383e=path[_0xdb10('0xd1')](config[_0xdb10('0xd2')],_0xdb10('0xd3'),_0xdb10('0xd4'),_0xdb10('0xd5'));var _0xeaf912=path[_0xdb10('0xd1')](_0x29b4aa,_0x5154b0);var _0x35edd8=util[_0xdb10('0xc8')](_0xdb10('0xd6'),_0x4d9a10[_0xdb10('0xba')]['id'],_0x5154b0);var _0x32ed1c=path[_0xdb10('0xd1')](_0x29b4aa,_0x35edd8);var _0x66cefd=[];_0x66cefd[_0xdb10('0x39')]({'model':db[_0xdb10('0xd7')],'as':_0xdb10('0xd7'),'raw':!![]});var _0x3dd0f4=[{'model':db[_0xdb10('0xc0')],'as':'Messages','attributes':['id',_0xdb10('0x78'),_0xdb10('0x7d')],'include':_0x66cefd}];return db[_0xdb10('0x3b')]['find']({'where':{'id':_0x4d9a10[_0xdb10('0xba')]['id']},'include':_0x3dd0f4})[_0xdb10('0x2d')](handleEntityNotFound(_0x16b86c,null))['then'](function(_0x511050){if(_0x511050&&_0x511050[_0xdb10('0xd8')]){var _0x52e78b=_0x511050[_0xdb10('0xd9')]({'plain':!![]});fs['mkdirSync'](_0xeaf912);for(var _0x57c0a9=0x0;_0x57c0a9<_0x52e78b[_0xdb10('0xd8')][_0xdb10('0x64')];_0x57c0a9++){var _0x1e7e11=_0x52e78b['Messages'][_0x57c0a9]['Attachment'];if(_0x1e7e11){var _0x55745b=path[_0xdb10('0xd1')](_0x41383e,_0x1e7e11[_0xdb10('0xda')]);if(fs[_0xdb10('0xdb')](_0x55745b)){fs['createReadStream'](_0x55745b)['pipe'](fs[_0xdb10('0xdc')](path[_0xdb10('0xd1')](_0xeaf912,_0x1e7e11[_0xdb10('0xda')])));}}}return BPromise[_0xdb10('0x97')]()[_0xdb10('0x2d')](function(){return new BPromise(function(_0x3e01af,_0xdd9608){zipdir(_0xeaf912,{'saveTo':_0x32ed1c},function(_0xe8dba,_0x189e37){if(_0xe8dba)return _0xdd9608(_0xe8dba);return _0x3e01af(_0x189e37);});})[_0xdb10('0x2d')](function(){return new BPromise(function(_0x2312f7,_0x3422bc){rimraf(_0xeaf912,function(_0x46f707){if(_0x46f707)_0x3422bc(_0x46f707);return _0x2312f7();});});})[_0xdb10('0x2d')](function(){return _0x16b86c[_0xdb10('0xcf')](_0x32ed1c,_0x35edd8,function(_0x518eab){if(_0x518eab){console['log'](_0xdb10('0xdd'),_0x518eab);}else{fs[_0xdb10('0xde')](_0x32ed1c);}});});});}else{return _0x16b86c['sendStatus'](0xc8);}})[_0xdb10('0x3a')](handleError(_0x16b86c,null));}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.events.js b/server/api/faxInteraction/faxInteraction.events.js index 9c10fcf..bd96c99 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 _0x326f=['../../mysqldb','FaxMessage','setMaxListeners','save','update','remove','then','setDataValue','Users','unreadMessages','length','emit','hasOwnProperty','exports','events'];(function(_0x4e5242,_0x1164f8){var _0x311688=function(_0x2355cc){while(--_0x2355cc){_0x4e5242['push'](_0x4e5242['shift']());}};_0x311688(++_0x1164f8);}(_0x326f,0xd1));var _0xf326=function(_0x2c6da8,_0x1c2dd4){_0x2c6da8=_0x2c6da8-0x0;var _0x501f8f=_0x326f[_0x2c6da8];return _0x501f8f;};'use strict';var EventEmitter=require(_0xf326('0x0'));var FaxInteraction=require('../../mysqldb')['db']['FaxInteraction'];var FaxMessage=require(_0xf326('0x1'))['db'][_0xf326('0x2')];var FaxInteractionEvents=new EventEmitter();FaxInteractionEvents[_0xf326('0x3')](0x0);var events={'afterCreate':_0xf326('0x4'),'afterUpdate':_0xf326('0x5'),'afterDestroy':_0xf326('0x6')};function emitEvent(_0x9445c6){return function(_0xf1c243,_0x1b5a56,_0x3ace29){_0xf1c243['getUsers']({'attributes':['id'],'raw':!![]})[_0xf326('0x7')](function(_0x3851eb){_0xf1c243[_0xf326('0x8')](_0xf326('0x9'),_0x3851eb['map'](function(_0x4c206c){return{'id':_0x4c206c['id']};}));return FaxMessage['findAll']({'where':{'FaxInteractionId':_0xf1c243['id'],'direction':'in','read':![]},'raw':!![]});})[_0xf326('0x7')](function(_0x1fc80e){_0xf1c243[_0xf326('0x8')](_0xf326('0xa'),_0x1fc80e[_0xf326('0xb')]);FaxInteractionEvents['emit'](_0x9445c6+':'+_0xf1c243['id'],_0xf1c243);FaxInteractionEvents[_0xf326('0xc')](_0x9445c6,_0xf1c243);_0x3ace29(null);})['catch'](_0x3ace29(null));};}for(var e in events){if(events[_0xf326('0xd')](e)){var event=events[e];FaxInteraction['hook'](e,emitEvent(event));}}module[_0xf326('0xe')]=FaxInteractionEvents; \ No newline at end of file +var _0x326f=['../../mysqldb','FaxMessage','setMaxListeners','save','update','remove','then','setDataValue','Users','unreadMessages','length','emit','hasOwnProperty','exports','events'];(function(_0x4af449,_0x5675af){var _0x1c0899=function(_0x3d3a2){while(--_0x3d3a2){_0x4af449['push'](_0x4af449['shift']());}};_0x1c0899(++_0x5675af);}(_0x326f,0xd1));var _0xf326=function(_0x3a80e6,_0x2f0e55){_0x3a80e6=_0x3a80e6-0x0;var _0x7f6678=_0x326f[_0x3a80e6];return _0x7f6678;};'use strict';var EventEmitter=require(_0xf326('0x0'));var FaxInteraction=require('../../mysqldb')['db']['FaxInteraction'];var FaxMessage=require(_0xf326('0x1'))['db'][_0xf326('0x2')];var FaxInteractionEvents=new EventEmitter();FaxInteractionEvents[_0xf326('0x3')](0x0);var events={'afterCreate':_0xf326('0x4'),'afterUpdate':_0xf326('0x5'),'afterDestroy':_0xf326('0x6')};function emitEvent(_0x9445c6){return function(_0xf1c243,_0x1b5a56,_0x3ace29){_0xf1c243['getUsers']({'attributes':['id'],'raw':!![]})[_0xf326('0x7')](function(_0x3851eb){_0xf1c243[_0xf326('0x8')](_0xf326('0x9'),_0x3851eb['map'](function(_0x4c206c){return{'id':_0x4c206c['id']};}));return FaxMessage['findAll']({'where':{'FaxInteractionId':_0xf1c243['id'],'direction':'in','read':![]},'raw':!![]});})[_0xf326('0x7')](function(_0x1fc80e){_0xf1c243[_0xf326('0x8')](_0xf326('0xa'),_0x1fc80e[_0xf326('0xb')]);FaxInteractionEvents['emit'](_0x9445c6+':'+_0xf1c243['id'],_0xf1c243);FaxInteractionEvents[_0xf326('0xc')](_0x9445c6,_0xf1c243);_0x3ace29(null);})['catch'](_0x3ace29(null));};}for(var e in events){if(events[_0xf326('0xd')](e)){var event=events[e];FaxInteraction['hook'](e,emitEvent(event));}}module[_0xf326('0xe')]=FaxInteractionEvents; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.model.js b/server/api/faxInteraction/faxInteraction.model.js index adeda5b..b0062ab 100644 --- a/server/api/faxInteraction/faxInteraction.model.js +++ b/server/api/faxInteraction/faxInteraction.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb821=['../../config/logger','bluebird','rimraf','../../config/environment','./faxInteraction.attributes','exports','define','FaxInteraction','fax_interactions','changed','closed','format','YYYY-MM-DD\x20HH:mm:ss','util'];(function(_0x2c0bf2,_0x1339af){var _0x59b9db=function(_0x10ca7f){while(--_0x10ca7f){_0x2c0bf2['push'](_0x2c0bf2['shift']());}};_0x59b9db(++_0x1339af);}(_0xb821,0xa7));var _0x1b82=function(_0x439a99,_0xbfad39){_0x439a99=_0x439a99-0x0;var _0x3837c9=_0xb821[_0x439a99];return _0x3837c9;};'use strict';var _=require('lodash');var util=require(_0x1b82('0x0'));var logger=require(_0x1b82('0x1'))('api');var moment=require('moment');var BPromise=require(_0x1b82('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x1b82('0x3'));var config=require(_0x1b82('0x4'));var attributes=require(_0x1b82('0x5'));module[_0x1b82('0x6')]=function(_0x597ca7,_0x3e27c4){return _0x597ca7[_0x1b82('0x7')](_0x1b82('0x8'),attributes,{'tableName':_0x1b82('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x18f45f,_0x7b87e8,_0x161155){if(_0x18f45f[_0x1b82('0xa')](_0x1b82('0xb'))){_0x18f45f['closedAt']=moment()[_0x1b82('0xc')](_0x1b82('0xd'));}_0x161155(null,_0x18f45f);}}});}; \ No newline at end of file +var _0x6f0d=['FaxInteraction','fax_interactions','changed','closed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./faxInteraction.attributes','define'];(function(_0x399f3f,_0x4bd01b){var _0xb636e2=function(_0x3e0e19){while(--_0x3e0e19){_0x399f3f['push'](_0x399f3f['shift']());}};_0xb636e2(++_0x4bd01b);}(_0x6f0d,0x16c));var _0xd6f0=function(_0x408b9e,_0x5b5170){_0x408b9e=_0x408b9e-0x0;var _0x3d33ac=_0x6f0d[_0x408b9e];return _0x3d33ac;};'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':!![],'hooks':{'beforeUpdate':function(_0x1a48a0,_0x4c4916,_0x507048){if(_0x1a48a0[_0xd6f0('0xc')](_0xd6f0('0xd'))){_0x1a48a0[_0xd6f0('0xe')]=moment()[_0xd6f0('0xf')](_0xd6f0('0x10'));}_0x507048(null,_0x1a48a0);}}});}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.rpc.js b/server/api/faxInteraction/faxInteraction.rpc.js index a8dd0fa..d8c33c9 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 _0x8350=['localhost','socket.io-emitter','register','request','then','info','request\x20sent','debug','FaxInteraction,\x20%s,\x20%s,\x20%s','error','code','FaxInteraction,\x20%s,\x20%s','message','UpdateFaxInteraction','FaxInteraction','options','raw','where','attributes','limit','catch','body','ids','omit','spread','AddTags','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','redis','defaults'];(function(_0x472ee2,_0x295444){var _0x18387b=function(_0x320611){while(--_0x320611){_0x472ee2['push'](_0x472ee2['shift']());}};_0x18387b(++_0x295444);}(_0x8350,0x68));var _0x0835=function(_0x547b27,_0x146be0){_0x547b27=_0x547b27-0x0;var _0x3ed0eb=_0x8350[_0x547b27];return _0x3ed0eb;};'use strict';var _=require(_0x0835('0x0'));var util=require('util');var moment=require(_0x0835('0x1'));var BPromise=require(_0x0835('0x2'));var rs=require(_0x0835('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x0835('0x4'))['db'];var utils=require(_0x0835('0x5'));var logger=require('../../config/logger')(_0x0835('0x6'));var config=require(_0x0835('0x7'));var jayson=require(_0x0835('0x8'));var client=jayson[_0x0835('0x9')][_0x0835('0xa')]({'port':0x232a});config[_0x0835('0xb')]=_[_0x0835('0xc')](config[_0x0835('0xb')],{'host':_0x0835('0xd'),'port':0x18eb});var socket=require(_0x0835('0xe'))(new Redis(config[_0x0835('0xb')]));require('./faxInteraction.socket')[_0x0835('0xf')](socket);function respondWithRpcPromise(_0x1b251e,_0x5025ef,_0x3ab924){return new BPromise(function(_0x509274,_0x56efc4){return client[_0x0835('0x10')](_0x1b251e,_0x3ab924)[_0x0835('0x11')](function(_0x47c5e1){logger[_0x0835('0x12')]('FaxInteraction,\x20%s,\x20%s',_0x5025ef,_0x0835('0x13'));logger[_0x0835('0x14')](_0x0835('0x15'),_0x5025ef,_0x0835('0x13'),JSON['stringify'](_0x47c5e1));if(_0x47c5e1[_0x0835('0x16')]){if(_0x47c5e1[_0x0835('0x16')][_0x0835('0x17')]===0x1f4){logger[_0x0835('0x16')](_0x0835('0x18'),_0x5025ef,_0x47c5e1[_0x0835('0x16')][_0x0835('0x19')]);return _0x56efc4(_0x47c5e1['error'][_0x0835('0x19')]);}logger[_0x0835('0x16')](_0x0835('0x18'),_0x5025ef,_0x47c5e1[_0x0835('0x16')][_0x0835('0x19')]);return _0x509274(_0x47c5e1[_0x0835('0x16')][_0x0835('0x19')]);}else{logger[_0x0835('0x12')](_0x0835('0x18'),_0x5025ef,_0x0835('0x13'));_0x509274(_0x47c5e1['result'][_0x0835('0x19')]);}})['catch'](function(_0x2990cf){logger[_0x0835('0x16')]('FaxInteraction,\x20%s,\x20%s',_0x5025ef,_0x2990cf);_0x56efc4(_0x2990cf);});});}exports[_0x0835('0x1a')]=function(_0x3a3e6d){var _0xceb2db=this;return new Promise(function(_0x2ebc8d,_0x55e99b){return db[_0x0835('0x1b')]['update'](_0x3a3e6d['body'],{'raw':_0x3a3e6d[_0x0835('0x1c')]?_0x3a3e6d[_0x0835('0x1c')][_0x0835('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3a3e6d[_0x0835('0x1c')]?_0x3a3e6d[_0x0835('0x1c')][_0x0835('0x1e')]||null:null,'attributes':_0x3a3e6d[_0x0835('0x1c')]?_0x3a3e6d['options'][_0x0835('0x1f')]||null:null,'limit':_0x3a3e6d[_0x0835('0x1c')]?_0x3a3e6d[_0x0835('0x1c')][_0x0835('0x20')]||null:null})[_0x0835('0x11')](function(_0x20ee6f){logger[_0x0835('0x12')](_0x0835('0x1a'),_0x3a3e6d);logger[_0x0835('0x14')](_0x0835('0x1a'),_0x3a3e6d,JSON['stringify'](_0x20ee6f));_0x2ebc8d(_0x20ee6f);})[_0x0835('0x21')](function(_0x1a8690){logger[_0x0835('0x16')](_0x0835('0x1a'),_0x1a8690[_0x0835('0x19')],_0x3a3e6d);_0x55e99b(_0xceb2db[_0x0835('0x16')](0x1f4,_0x1a8690[_0x0835('0x19')]));});});};exports['AddTagsToFaxInteraction']=function(_0x16bdf8){return new Promise(function(_0xd8d5a0,_0x116ac2){return db[_0x0835('0x1b')]['find']({'where':_0x16bdf8['options']?_0x16bdf8[_0x0835('0x1c')][_0x0835('0x1e')]||null:null})[_0x0835('0x11')](function(_0x1e329b){if(_0x1e329b){return _0x1e329b['addTags'](_0x16bdf8[_0x0835('0x22')][_0x0835('0x23')],_[_0x0835('0x24')](_0x16bdf8['body'],['ids','id'])||{});}})[_0x0835('0x25')](function(_0x2b0495){logger[_0x0835('0x12')](_0x0835('0x26'),_0x16bdf8);logger[_0x0835('0x14')](_0x0835('0x26'),_0x16bdf8,JSON['stringify'](_0x2b0495));_0xd8d5a0(_0x2b0495);})[_0x0835('0x21')](function(_0x2ebc0a){logger[_0x0835('0x16')]('AddTags',_0x2ebc0a['message'],_0x16bdf8);_0x116ac2(_this[_0x0835('0x16')](0x1f4,_0x2ebc0a['message']));});});}; \ No newline at end of file +var _0xc2c1=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','defaults','localhost','./faxInteraction.socket','register','then','FaxInteraction,\x20%s,\x20%s','debug','FaxInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','request\x20sent','result','catch','update','options','raw','attributes','limit','UpdateFaxInteraction','where','addTags','body','ids','AddTags','lodash','util'];(function(_0xd10d51,_0x37eb56){var _0x5e7b61=function(_0x296125){while(--_0x296125){_0xd10d51['push'](_0xd10d51['shift']());}};_0x5e7b61(++_0x37eb56);}(_0xc2c1,0xee));var _0x1c2c=function(_0x49058f,_0x429511){_0x49058f=_0x49058f-0x0;var _0x32bcd6=_0xc2c1[_0x49058f];return _0x32bcd6;};'use strict';var _=require(_0x1c2c('0x0'));var util=require(_0x1c2c('0x1'));var moment=require(_0x1c2c('0x2'));var BPromise=require(_0x1c2c('0x3'));var rs=require(_0x1c2c('0x4'));var fs=require('fs');var Redis=require(_0x1c2c('0x5'));var db=require(_0x1c2c('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x1c2c('0x7'))(_0x1c2c('0x8'));var config=require(_0x1c2c('0x9'));var jayson=require(_0x1c2c('0xa'));var client=jayson['client'][_0x1c2c('0xb')]({'port':0x232a});config[_0x1c2c('0xc')]=_[_0x1c2c('0xd')](config['redis'],{'host':_0x1c2c('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x1c2c('0xc')]));require(_0x1c2c('0xf'))[_0x1c2c('0x10')](socket);function respondWithRpcPromise(_0x4b677f,_0x3623f2,_0x30d347){return new BPromise(function(_0x45cd89,_0xe7726e){return client['request'](_0x4b677f,_0x30d347)[_0x1c2c('0x11')](function(_0x3ce4fe){logger['info'](_0x1c2c('0x12'),_0x3623f2,'request\x20sent');logger[_0x1c2c('0x13')](_0x1c2c('0x14'),_0x3623f2,'request\x20sent',JSON[_0x1c2c('0x15')](_0x3ce4fe));if(_0x3ce4fe[_0x1c2c('0x16')]){if(_0x3ce4fe[_0x1c2c('0x16')][_0x1c2c('0x17')]===0x1f4){logger[_0x1c2c('0x16')](_0x1c2c('0x12'),_0x3623f2,_0x3ce4fe[_0x1c2c('0x16')][_0x1c2c('0x18')]);return _0xe7726e(_0x3ce4fe[_0x1c2c('0x16')][_0x1c2c('0x18')]);}logger[_0x1c2c('0x16')](_0x1c2c('0x12'),_0x3623f2,_0x3ce4fe[_0x1c2c('0x16')][_0x1c2c('0x18')]);return _0x45cd89(_0x3ce4fe[_0x1c2c('0x16')][_0x1c2c('0x18')]);}else{logger[_0x1c2c('0x19')](_0x1c2c('0x12'),_0x3623f2,_0x1c2c('0x1a'));_0x45cd89(_0x3ce4fe[_0x1c2c('0x1b')][_0x1c2c('0x18')]);}})[_0x1c2c('0x1c')](function(_0xbd719a){logger[_0x1c2c('0x16')](_0x1c2c('0x12'),_0x3623f2,_0xbd719a);_0xe7726e(_0xbd719a);});});}exports['UpdateFaxInteraction']=function(_0x300c66){var _0x488a28=this;return new Promise(function(_0x521289,_0x1480d6){return db['FaxInteraction'][_0x1c2c('0x1d')](_0x300c66['body'],{'raw':_0x300c66[_0x1c2c('0x1e')]?_0x300c66[_0x1c2c('0x1e')][_0x1c2c('0x1f')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x300c66['options']?_0x300c66['options']['where']||null:null,'attributes':_0x300c66[_0x1c2c('0x1e')]?_0x300c66[_0x1c2c('0x1e')][_0x1c2c('0x20')]||null:null,'limit':_0x300c66[_0x1c2c('0x1e')]?_0x300c66['options'][_0x1c2c('0x21')]||null:null})[_0x1c2c('0x11')](function(_0x10839f){logger[_0x1c2c('0x19')]('UpdateFaxInteraction',_0x300c66);logger[_0x1c2c('0x13')](_0x1c2c('0x22'),_0x300c66,JSON[_0x1c2c('0x15')](_0x10839f));_0x521289(_0x10839f);})[_0x1c2c('0x1c')](function(_0x3af0bd){logger['error']('UpdateFaxInteraction',_0x3af0bd[_0x1c2c('0x18')],_0x300c66);_0x1480d6(_0x488a28[_0x1c2c('0x16')](0x1f4,_0x3af0bd[_0x1c2c('0x18')]));});});};exports['AddTagsToFaxInteraction']=function(_0x3b671f){return new Promise(function(_0x4fd2eb,_0x1d43c4){return db['FaxInteraction']['find']({'where':_0x3b671f[_0x1c2c('0x1e')]?_0x3b671f['options'][_0x1c2c('0x23')]||null:null})['then'](function(_0x31681a){if(_0x31681a){return _0x31681a[_0x1c2c('0x24')](_0x3b671f[_0x1c2c('0x25')][_0x1c2c('0x26')],_['omit'](_0x3b671f[_0x1c2c('0x25')],[_0x1c2c('0x26'),'id'])||{});}})['spread'](function(_0x593729){logger[_0x1c2c('0x19')]('AddTags',_0x3b671f);logger['debug'](_0x1c2c('0x27'),_0x3b671f,JSON[_0x1c2c('0x15')](_0x593729));_0x4fd2eb(_0x593729);})[_0x1c2c('0x1c')](function(_0x53a835){logger[_0x1c2c('0x16')](_0x1c2c('0x27'),_0x53a835[_0x1c2c('0x18')],_0x3b671f);_0x1d43c4(_this[_0x1c2c('0x16')](0x1f4,_0x53a835[_0x1c2c('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.socket.js b/server/api/faxInteraction/faxInteraction.socket.js index 1696f36..f3b5a60 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 _0x14ea=['faxInteraction:','./faxInteraction.events','save','remove','update','emit','length'];(function(_0x323088,_0x18ced6){var _0x4b6c08=function(_0x1b951f){while(--_0x1b951f){_0x323088['push'](_0x323088['shift']());}};_0x4b6c08(++_0x18ced6);}(_0x14ea,0x189));var _0xa14e=function(_0x1cd47d,_0x55bc75){_0x1cd47d=_0x1cd47d-0x0;var _0x29d52f=_0x14ea[_0x1cd47d];return _0x29d52f;};'use strict';var FaxInteractionEvents=require(_0xa14e('0x0'));var events=[_0xa14e('0x1'),_0xa14e('0x2'),_0xa14e('0x3')];function createListener(_0x24ab87,_0x382b7a){return function(_0x1961d5){_0x382b7a[_0xa14e('0x4')](_0x24ab87,_0x1961d5);};}function removeListener(_0x5c3cfe,_0x3e4cff){return function(){FaxInteractionEvents['removeListener'](_0x5c3cfe,_0x3e4cff);};}exports['register']=function(_0x11acf0){for(var _0x5e5198=0x0,_0x4976ad=events[_0xa14e('0x5')];_0x5e5198<_0x4976ad;_0x5e5198++){var _0xc0223e=events[_0x5e5198];var _0x43c39c=createListener(_0xa14e('0x6')+_0xc0223e,_0x11acf0);FaxInteractionEvents['on'](_0xc0223e,_0x43c39c);}}; \ No newline at end of file +var _0xf33a=['emit','./faxInteraction.events','save','remove','update'];(function(_0x3e0a39,_0xa284fd){var _0x5c90a1=function(_0x570e1f){while(--_0x570e1f){_0x3e0a39['push'](_0x3e0a39['shift']());}};_0x5c90a1(++_0xa284fd);}(_0xf33a,0x79));var _0xaf33=function(_0xa8fff6,_0x366f9a){_0xa8fff6=_0xa8fff6-0x0;var _0x3c2a16=_0xf33a[_0xa8fff6];return _0x3c2a16;};'use strict';var FaxInteractionEvents=require(_0xaf33('0x0'));var events=[_0xaf33('0x1'),_0xaf33('0x2'),_0xaf33('0x3')];function createListener(_0x3a8d83,_0x336a50){return function(_0x22c9e3){_0x336a50[_0xaf33('0x4')](_0x3a8d83,_0x22c9e3);};}function removeListener(_0x2ecc53,_0x5e31a7){return function(){FaxInteractionEvents['removeListener'](_0x2ecc53,_0x5e31a7);};}exports['register']=function(_0xf450b3){for(var _0x7917c5=0x0,_0x1c941c=events['length'];_0x7917c5<_0x1c941c;_0x7917c5++){var _0x13a8f0=events[_0x7917c5];var _0xd3ae04=createListener('faxInteraction:'+_0x13a8f0,_0xf450b3);FaxInteractionEvents['on'](_0x13a8f0,_0xd3ae04);}}; \ No newline at end of file diff --git a/server/api/faxInteraction/index.js b/server/api/faxInteraction/index.js index e3cc219..7709dd3 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 _0x4fb6=['path','connect-timeout','express','Router','./faxInteraction.controller','index','get','/describe','isAuthenticated','describe','show','/:id/messages','getMessages','/:id/download','download','post','create','/:id/tags','tracked','fax','faxinteraction:addtags','addTags','/:id','faxinteraction:update','delete','destroy','removeTags'];(function(_0x1c6f0e,_0x5cb576){var _0x1ab876=function(_0x29a858){while(--_0x29a858){_0x1c6f0e['push'](_0x1c6f0e['shift']());}};_0x1ab876(++_0x5cb576);}(_0x4fb6,0x15f));var _0x64fb=function(_0x50f6e5,_0x151ccb){_0x50f6e5=_0x50f6e5-0x0;var _0x5988c5=_0x4fb6[_0x50f6e5];return _0x5988c5;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x64fb('0x0'));var timeout=require(_0x64fb('0x1'));var express=require(_0x64fb('0x2'));var router=express[_0x64fb('0x3')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x64fb('0x4'));router['get']('/',auth['isAuthenticated'](),controller[_0x64fb('0x5')]);router[_0x64fb('0x6')](_0x64fb('0x7'),auth[_0x64fb('0x8')](),controller[_0x64fb('0x9')]);router[_0x64fb('0x6')]('/:id',auth[_0x64fb('0x8')](),controller[_0x64fb('0xa')]);router['get'](_0x64fb('0xb'),auth['isAuthenticated'](),controller[_0x64fb('0xc')]);router[_0x64fb('0x6')](_0x64fb('0xd'),auth['isAuthenticated'](),controller[_0x64fb('0xe')]);router[_0x64fb('0xf')]('/',auth[_0x64fb('0x8')](),controller[_0x64fb('0x10')]);router[_0x64fb('0xf')]('/:id/messages',auth[_0x64fb('0x8')](),controller['addMessage']);router[_0x64fb('0xf')](_0x64fb('0x11'),auth[_0x64fb('0x8')](),interaction[_0x64fb('0x12')](_0x64fb('0x13'),_0x64fb('0x14')),controller[_0x64fb('0x15')]);router['put'](_0x64fb('0x16'),auth[_0x64fb('0x8')](),interaction[_0x64fb('0x12')](_0x64fb('0x13'),_0x64fb('0x17')),controller['update']);router[_0x64fb('0x18')](_0x64fb('0x16'),auth[_0x64fb('0x8')](),interaction[_0x64fb('0x12')](_0x64fb('0x13'),'faxinteraction:destroy'),controller[_0x64fb('0x19')]);router[_0x64fb('0x18')]('/:id/tags',auth['isAuthenticated'](),controller[_0x64fb('0x1a')]);module['exports']=router; \ No newline at end of file +var _0x12c9=['update','delete','faxinteraction:destroy','destroy','/:id/tags','removeTags','exports','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxInteraction.controller','get','/describe','isAuthenticated','describe','download','post','/:id/messages','addMessage','fax','faxinteraction:addtags','put','/:id','tracked','faxinteraction:update'];(function(_0x21481c,_0x1b51ba){var _0x5dd77a=function(_0x4ee13c){while(--_0x4ee13c){_0x21481c['push'](_0x21481c['shift']());}};_0x5dd77a(++_0x1b51ba);}(_0x12c9,0x1c9));var _0x912c=function(_0x5e5b30,_0x1d922f){_0x5e5b30=_0x5e5b30-0x0;var _0x249e28=_0x12c9[_0x5e5b30];return _0x249e28;};'use strict';var multer=require(_0x912c('0x0'));var util=require(_0x912c('0x1'));var path=require(_0x912c('0x2'));var timeout=require(_0x912c('0x3'));var express=require(_0x912c('0x4'));var router=express['Router']();var auth=require(_0x912c('0x5'));var interaction=require(_0x912c('0x6'));var config=require(_0x912c('0x7'));var controller=require(_0x912c('0x8'));router[_0x912c('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0x912c('0x9')](_0x912c('0xa'),auth[_0x912c('0xb')](),controller[_0x912c('0xc')]);router[_0x912c('0x9')]('/:id',auth[_0x912c('0xb')](),controller['show']);router[_0x912c('0x9')]('/:id/messages',auth[_0x912c('0xb')](),controller['getMessages']);router[_0x912c('0x9')]('/:id/download',auth[_0x912c('0xb')](),controller[_0x912c('0xd')]);router['post']('/',auth[_0x912c('0xb')](),controller['create']);router[_0x912c('0xe')](_0x912c('0xf'),auth[_0x912c('0xb')](),controller[_0x912c('0x10')]);router[_0x912c('0xe')]('/:id/tags',auth[_0x912c('0xb')](),interaction['tracked'](_0x912c('0x11'),_0x912c('0x12')),controller['addTags']);router[_0x912c('0x13')](_0x912c('0x14'),auth[_0x912c('0xb')](),interaction[_0x912c('0x15')](_0x912c('0x11'),_0x912c('0x16')),controller[_0x912c('0x17')]);router[_0x912c('0x18')](_0x912c('0x14'),auth[_0x912c('0xb')](),interaction['tracked'](_0x912c('0x11'),_0x912c('0x19')),controller[_0x912c('0x1a')]);router[_0x912c('0x18')](_0x912c('0x1b'),auth[_0x912c('0xb')](),controller[_0x912c('0x1c')]);module[_0x912c('0x1d')]=router; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.attributes.js b/server/api/faxMessage/faxMessage.attributes.js index 9efabe5..f4992ff 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 _0x0721=['BOOLEAN','ENUM','out','DATE','sequelize','exports','TEXT'];(function(_0x5af112,_0x4e673b){var _0x4afe0f=function(_0x45cb30){while(--_0x45cb30){_0x5af112['push'](_0x5af112['shift']());}};_0x4afe0f(++_0x4e673b);}(_0x0721,0x169));var _0x1072=function(_0x422baa,_0x98d34a){_0x422baa=_0x422baa-0x0;var _0x31c810=_0x0721[_0x422baa];return _0x31c810;};'use strict';var Sequelize=require(_0x1072('0x0'));module[_0x1072('0x1')]={'body':{'type':Sequelize[_0x1072('0x2')]('medium'),'allowNull':![]},'read':{'type':Sequelize[_0x1072('0x3')],'defaultValue':![]},'direction':{'type':Sequelize[_0x1072('0x4')]('in',_0x1072('0x5')),'defaultValue':_0x1072('0x5'),'allowNull':![]},'failMessage':{'type':Sequelize[_0x1072('0x2')],'defaultValue':null},'readAt':{'type':Sequelize[_0x1072('0x6')]}}; \ No newline at end of file +var _0x65c2=['DATE','sequelize','exports','TEXT','medium','ENUM','out'];(function(_0x4aba15,_0x4e90aa){var _0x1c8122=function(_0x568dba){while(--_0x568dba){_0x4aba15['push'](_0x4aba15['shift']());}};_0x1c8122(++_0x4e90aa);}(_0x65c2,0x1cf));var _0x265c=function(_0x1399d1,_0x40b592){_0x1399d1=_0x1399d1-0x0;var _0x2ce4b2=_0x65c2[_0x1399d1];return _0x2ce4b2;};'use strict';var Sequelize=require(_0x265c('0x0'));module[_0x265c('0x1')]={'body':{'type':Sequelize[_0x265c('0x2')](_0x265c('0x3')),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize[_0x265c('0x4')]('in',_0x265c('0x5')),'defaultValue':_0x265c('0x5'),'allowNull':![]},'failMessage':{'type':Sequelize['TEXT'],'defaultValue':null},'readAt':{'type':Sequelize[_0x265c('0x6')]}}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.controller.js b/server/api/faxMessage/faxMessage.controller.js index caa1125..380b2a3 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 _0x488b=['files','attachments','download','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','lodash','squel','crypto','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','redis','defaults','localhost','socket.io-emitter','jayson/promise','client','http','test','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','info','FaxMessage,\x20%s,\x20%s','request\x20sent','debug','FaxMessage,\x20%s,\x20%s,\x20%s','code','error','message','catch','status','json','offset','limit','set','Content-Range','save','update','end','sendStatus','map','FaxMessage','type','key','query','keys','filters','intersection','attributes','model','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','options','count','includeAll','include','findAll','params','rawAttributes','find','body','describe','fax-interactions','accept','fax','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','CmContact','FaxInteraction','FaxInteractionId','read1stAt','interaction','get','[FAXMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','user','name','stringify','null','AcceptMessage','acceptMessage','manual','interface','channel','event','EventManager','acceptmessage','reject','agent','[FAXMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','RejectMessage','SIP/%s','rejectmessage','findOne','Attachment','AttachmentId','SendFax','FaxAccountId','isNil','/var/opt/motion2/server/files/attachments/%s','basename','join','server'];(function(_0xe96711,_0x3c2895){var _0x311cc5=function(_0xf27035){while(--_0xf27035){_0xe96711['push'](_0xe96711['shift']());}};_0x311cc5(++_0x3c2895);}(_0x488b,0x10b));var _0xb488=function(_0x2f01d5,_0x4fca5e){_0x2f01d5=_0x2f01d5-0x0;var _0x3cc6ee=_0x488b[_0x2f01d5];return _0x3cc6ee;};'use strict';var pdf=require(_0xb488('0x0'));var emlformat=require(_0xb488('0x1'));var rimraf=require(_0xb488('0x2'));var zipdir=require(_0xb488('0x3'));var jsonpatch=require(_0xb488('0x4'));var rp=require(_0xb488('0x5'));var moment=require(_0xb488('0x6'));var BPromise=require('bluebird');var Mustache=require(_0xb488('0x7'));var util=require(_0xb488('0x8'));var path=require(_0xb488('0x9'));var sox=require(_0xb488('0xa'));var csv=require(_0xb488('0xb'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xb488('0xc'));var squel=require(_0xb488('0xd'));var crypto=require(_0xb488('0xe'));var jsforce=require('jsforce');var deskjs=require(_0xb488('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xb488('0x10'));var Redis=require(_0xb488('0x11'));var authService=require(_0xb488('0x12'));var qs=require(_0xb488('0x13'));var as=require(_0xb488('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xb488('0x15'))(_0xb488('0x16'));var utils=require(_0xb488('0x17'));var config=require(_0xb488('0x18'));var db=require('../../mysqldb')['db'];config[_0xb488('0x19')]=_[_0xb488('0x1a')](config['redis'],{'host':_0xb488('0x1b'),'port':0x18eb});var socket=require(_0xb488('0x1c'))(new Redis(config[_0xb488('0x19')]));require('./faxMessage.socket')['register'](socket);var jayson=require(_0xb488('0x1d'));var client=jayson[_0xb488('0x1e')]['http']({'port':0x232c});var client9002=jayson[_0xb488('0x1e')][_0xb488('0x1f')]({'port':0x232a});function checkPasswordPattern(_0x52e7ac,_0x17d490,_0xe40fdf){if(_0xe40fdf){var _0x1bb315=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x1bb315[_0xb488('0x20')](_0x17d490)){return _0x52e7ac;}else{throw new db['Sequelize'][(_0xb488('0x21'))](_0xb488('0x22'));}}else{return _0x52e7ac;}}function respondWithRpcPromise(_0x19def7,_0x36c393,_0x468934,_0x578a6d){return new BPromise(function(_0x5e4441,_0x423a6e){var _0xa01bce=_0x578a6d||client;return _0xa01bce[_0xb488('0x23')](_0x19def7,_0x468934)[_0xb488('0x24')](function(_0x22ba96){logger[_0xb488('0x25')](_0xb488('0x26'),_0x36c393,_0xb488('0x27'));logger[_0xb488('0x28')](_0xb488('0x29'),_0x36c393,_0xb488('0x27'),JSON['stringify'](_0x22ba96));if(_0x22ba96['error']){if(_0x22ba96['error'][_0xb488('0x2a')]===0x1f4){logger[_0xb488('0x2b')](_0xb488('0x26'),_0x36c393,_0x22ba96[_0xb488('0x2b')][_0xb488('0x2c')]);return _0x423a6e(_0x22ba96[_0xb488('0x2b')][_0xb488('0x2c')]);}logger[_0xb488('0x2b')](_0xb488('0x26'),_0x36c393,_0x22ba96[_0xb488('0x2b')][_0xb488('0x2c')]);return _0x5e4441(_0x22ba96[_0xb488('0x2b')][_0xb488('0x2c')]);}else{logger['info'](_0xb488('0x26'),_0x36c393,_0xb488('0x27'));_0x5e4441(_0x22ba96['result'][_0xb488('0x2c')]);}})[_0xb488('0x2d')](function(_0x2ff0da){logger[_0xb488('0x2b')](_0xb488('0x26'),_0x36c393,_0x2ff0da);_0x423a6e(_0x2ff0da);});});}function respondWithStatusCode(_0x5b9260,_0x405287){_0x405287=_0x405287||0xcc;return function(_0x549238){if(_0x549238){return _0x5b9260['sendStatus'](_0x405287);}return _0x5b9260[_0xb488('0x2e')](_0x405287)['end']();};}function respondWithResult(_0x241459,_0x4b90c2){_0x4b90c2=_0x4b90c2||0xc8;return function(_0x306899){if(_0x306899){return _0x241459[_0xb488('0x2e')](_0x4b90c2)[_0xb488('0x2f')](_0x306899);}};}function respondWithFilteredResult(_0x10654d,_0x28d2f2){return function(_0x4666b1){if(_0x4666b1){var _0x3079d3=_0x4666b1['count'],_0x1eb819=_0x28d2f2[_0xb488('0x30')],_0x3438d5=_0x28d2f2[_0xb488('0x30')]+_0x28d2f2[_0xb488('0x31')],_0x507c14;if(_0x3438d5>=_0x3079d3){_0x3438d5=_0x3079d3;_0x507c14=0xc8;}else{_0x507c14=0xce;}_0x10654d[_0xb488('0x2e')](_0x507c14);return _0x10654d[_0xb488('0x32')](_0xb488('0x33'),_0x1eb819+'-'+_0x3438d5+'/'+_0x3079d3)[_0xb488('0x2f')](_0x4666b1);}return null;};}function patchUpdates(_0x4db4a5){return function(_0x51d70b){try{jsonpatch['apply'](_0x51d70b,_0x4db4a5,!![]);}catch(_0x491714){return BPromise['reject'](_0x491714);}return _0x51d70b[_0xb488('0x34')]();};}function saveUpdates(_0x2d7348,_0x30599a){return function(_0x1b5347){if(_0x1b5347){return _0x1b5347[_0xb488('0x35')](_0x2d7348)[_0xb488('0x24')](function(_0x3cde0c){return _0x3cde0c;});}return null;};}function removeEntity(_0x478ff1,_0x2968d1){return function(_0x2f35ba){if(_0x2f35ba){return _0x2f35ba['destroy']()['then'](function(){_0x478ff1[_0xb488('0x2e')](0xcc)[_0xb488('0x36')]();});}};}function handleEntityNotFound(_0xa37733,_0x80cd09){return function(_0x171c0f){if(!_0x171c0f){_0xa37733[_0xb488('0x37')](0x194);}return _0x171c0f;};}function handleError(_0x3fb91e,_0xf78c2e){_0xf78c2e=_0xf78c2e||0x1f4;return function(_0xe32b98){logger[_0xb488('0x2b')](_0xe32b98['stack']);if(_0xe32b98['name']){delete _0xe32b98['name'];}_0x3fb91e['status'](_0xf78c2e)['send'](_0xe32b98);};}exports['index']=function(_0x212c49,_0xe0fcf0){var _0x152ff5={},_0x167d5a={},_0x5353d4={'count':0x0,'rows':[]};var _0x17e5d4=_[_0xb488('0x38')](db[_0xb488('0x39')]['rawAttributes'],function(_0x1759bf){return{'name':_0x1759bf['fieldName'],'type':_0x1759bf[_0xb488('0x3a')][_0xb488('0x3b')]};});_0x167d5a['model']=_[_0xb488('0x38')](_0x17e5d4,'name');_0x167d5a[_0xb488('0x3c')]=_[_0xb488('0x3d')](_0x212c49['query']);_0x167d5a[_0xb488('0x3e')]=_[_0xb488('0x3f')](_0x167d5a['model'],_0x167d5a[_0xb488('0x3c')]);_0x152ff5[_0xb488('0x40')]=_['intersection'](_0x167d5a[_0xb488('0x41')],qs[_0xb488('0x42')](_0x212c49[_0xb488('0x3c')][_0xb488('0x42')]));_0x152ff5[_0xb488('0x40')]=_0x152ff5[_0xb488('0x40')][_0xb488('0x43')]?_0x152ff5[_0xb488('0x40')]:_0x167d5a[_0xb488('0x41')];if(!_0x212c49[_0xb488('0x3c')][_0xb488('0x44')](_0xb488('0x45'))){_0x152ff5[_0xb488('0x31')]=qs[_0xb488('0x31')](_0x212c49[_0xb488('0x3c')][_0xb488('0x31')]);_0x152ff5[_0xb488('0x30')]=qs[_0xb488('0x30')](_0x212c49[_0xb488('0x3c')]['offset']);}_0x152ff5[_0xb488('0x46')]=qs[_0xb488('0x47')](_0x212c49[_0xb488('0x3c')][_0xb488('0x47')]);_0x152ff5[_0xb488('0x48')]=qs['filters'](_['pick'](_0x212c49[_0xb488('0x3c')],_0x167d5a[_0xb488('0x3e')]),_0x17e5d4);if(_0x212c49['query'][_0xb488('0x49')]){_0x152ff5['where']=_[_0xb488('0x4a')](_0x152ff5['where'],{'$or':_['map'](_0x17e5d4,function(_0x35946f){if(_0x35946f[_0xb488('0x3a')]!=='VIRTUAL'){var _0x134c26={};_0x134c26[_0x35946f['name']]={'$like':'%'+_0x212c49[_0xb488('0x3c')][_0xb488('0x49')]+'%'};return _0x134c26;}})});}_0x152ff5=_[_0xb488('0x4a')]({},_0x152ff5,_0x212c49[_0xb488('0x4b')]);var _0x5ba6f3={'where':_0x152ff5[_0xb488('0x48')]};return db[_0xb488('0x39')][_0xb488('0x4c')](_0x5ba6f3)[_0xb488('0x24')](function(_0x84a3ef){_0x5353d4[_0xb488('0x4c')]=_0x84a3ef;if(_0x212c49[_0xb488('0x3c')][_0xb488('0x4d')]){_0x152ff5[_0xb488('0x4e')]=[{'all':!![]}];}return db[_0xb488('0x39')][_0xb488('0x4f')](_0x152ff5);})['then'](function(_0x40292d){_0x5353d4['rows']=_0x40292d;return _0x5353d4;})[_0xb488('0x24')](respondWithFilteredResult(_0xe0fcf0,_0x152ff5))[_0xb488('0x2d')](handleError(_0xe0fcf0,null));};exports['show']=function(_0x41862b,_0x4d3e95){var _0x421c1c={'raw':!![],'where':{'id':_0x41862b[_0xb488('0x50')]['id']}},_0x488bc8={};_0x488bc8[_0xb488('0x41')]=_[_0xb488('0x3d')](db['FaxMessage'][_0xb488('0x51')]);_0x488bc8['query']=_[_0xb488('0x3d')](_0x41862b[_0xb488('0x3c')]);_0x488bc8[_0xb488('0x3e')]=_['intersection'](_0x488bc8[_0xb488('0x41')],_0x488bc8['query']);_0x421c1c[_0xb488('0x40')]=_[_0xb488('0x3f')](_0x488bc8[_0xb488('0x41')],qs[_0xb488('0x42')](_0x41862b['query'][_0xb488('0x42')]));_0x421c1c['attributes']=_0x421c1c[_0xb488('0x40')][_0xb488('0x43')]?_0x421c1c[_0xb488('0x40')]:_0x488bc8['model'];if(_0x41862b['query']['includeAll']){_0x421c1c[_0xb488('0x4e')]=[{'all':!![]}];}_0x421c1c=_[_0xb488('0x4a')]({},_0x421c1c,_0x41862b['options']);return db[_0xb488('0x39')][_0xb488('0x52')](_0x421c1c)['then'](handleEntityNotFound(_0x4d3e95,null))[_0xb488('0x24')](respondWithResult(_0x4d3e95,null))['catch'](handleError(_0x4d3e95,null));};exports[_0xb488('0x35')]=function(_0x196f6,_0x4d49a5){if(_0x196f6[_0xb488('0x53')]['id']){delete _0x196f6[_0xb488('0x53')]['id'];}return db[_0xb488('0x39')][_0xb488('0x52')]({'where':{'id':_0x196f6['params']['id']}})['then'](handleEntityNotFound(_0x4d49a5,null))[_0xb488('0x24')](saveUpdates(_0x196f6['body'],null))[_0xb488('0x24')](respondWithResult(_0x4d49a5,null))[_0xb488('0x2d')](handleError(_0x4d49a5,null));};exports['destroy']=function(_0x168915,_0x91ffce){return db[_0xb488('0x39')][_0xb488('0x52')]({'where':{'id':_0x168915['params']['id']}})['then'](handleEntityNotFound(_0x91ffce,null))[_0xb488('0x24')](removeEntity(_0x91ffce,null))[_0xb488('0x2d')](handleError(_0x91ffce,null));};exports[_0xb488('0x54')]=function(_0x236923,_0x241179){return db[_0xb488('0x39')][_0xb488('0x54')]()[_0xb488('0x24')](respondWithResult(_0x241179,null))[_0xb488('0x2d')](handleError(_0x241179,null));};var interaction_log=require('../../config/logger')(_0xb488('0x55'));exports[_0xb488('0x56')]=function(_0x1ecb2c,_0x25d88c,_0x3a8f25){var _0x19ad33={'channel':_0xb488('0x57')};if(_0x1ecb2c['body']['id']){delete _0x1ecb2c[_0xb488('0x53')]['id'];}_0x1ecb2c[_0xb488('0x53')][_0xb488('0x58')]=!![];_0x1ecb2c[_0xb488('0x53')][_0xb488('0x59')]=moment()[_0xb488('0x5a')](_0xb488('0x5b'));_0x1ecb2c[_0xb488('0x53')][_0xb488('0x5c')]=_0x1ecb2c[_0xb488('0x53')][_0xb488('0x5c')]||_0x1ecb2c['user']['id'];return db[_0xb488('0x39')][_0xb488('0x52')]({'where':{'id':_0x1ecb2c[_0xb488('0x50')]['id'],'UserId':null},'include':[{'model':db[_0xb488('0x5d')],'as':'Contact'}]})['then'](handleEntityNotFound(_0x25d88c,null))[_0xb488('0x24')](saveUpdates(_0x1ecb2c[_0xb488('0x53')],null))[_0xb488('0x24')](function(_0x52dc4b){if(_0x52dc4b){_0x19ad33[_0xb488('0x2c')]=_0x52dc4b['get']({'plain':!![]});return db[_0xb488('0x5e')][_0xb488('0x52')]({'where':{'id':_0x52dc4b[_0xb488('0x5f')]}});}return null;})[_0xb488('0x24')](handleEntityNotFound(_0x25d88c,null))[_0xb488('0x24')](function(_0x460258){if(_0x460258){return _0x460258[_0xb488('0x35')]({'UserId':_0x1ecb2c[_0xb488('0x53')]['UserId'],'read1stAt':_['isNil'](_0x460258[_0xb488('0x60')])?moment()[_0xb488('0x5a')]('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})['then'](function(_0x5168cf){if(_0x5168cf){_0x19ad33[_0xb488('0x61')]=_0x5168cf[_0xb488('0x62')]({'plain':!![]});interaction_log[_0xb488('0x25')](_0xb488('0x63'),_0x1ecb2c[_0xb488('0x64')]['id'],_0x1ecb2c[_0xb488('0x64')][_0xb488('0x65')],_0x1ecb2c[_0xb488('0x64')]['role'],_0x19ad33['interaction']['id'],_0x1ecb2c[_0xb488('0x53')]?JSON[_0xb488('0x66')](_0x1ecb2c[_0xb488('0x53')]):_0xb488('0x67'));return respondWithRpcPromise(_0xb488('0x68'),_0xb488('0x69'),_0x19ad33);}return null;})[_0xb488('0x24')](function(_0x4b2bf3){if(_0x4b2bf3){if(_0x1ecb2c[_0xb488('0x53')][_0xb488('0x6a')]){_0x19ad33[_0xb488('0x2c')][_0xb488('0x6b')]=util[_0xb488('0x5a')]('SIP/%s',_0x1ecb2c['user'][_0xb488('0x65')]);_0x19ad33[_0xb488('0x2c')][_0xb488('0x6c')]=_0x19ad33[_0xb488('0x6c')];_0x19ad33[_0xb488('0x2c')][_0xb488('0x6d')]=_0xb488('0x56');return respondWithRpcPromise('EventManager',_0xb488('0x6e'),{'event':_0xb488('0x6f'),'message':_0x19ad33['message']},client9002)[_0xb488('0x24')](function(){return _0x19ad33;});}return _0x19ad33;}return null;})[_0xb488('0x24')](respondWithResult(_0x25d88c,null))[_0xb488('0x2d')](handleError(_0x25d88c,null));};var interaction_log=require('../../config/logger')(_0xb488('0x55'));exports[_0xb488('0x70')]=function(_0x55d4c6,_0xb72ae6,_0xe3a3b5){var _0x2270c4={'agent':{},'channel':_0xb488('0x57')};if(_0x55d4c6[_0xb488('0x53')]['id']){delete _0x55d4c6[_0xb488('0x53')]['id'];}_0x55d4c6['body'][_0xb488('0x5c')]=_0x55d4c6['body']['UserId']||_0x55d4c6[_0xb488('0x64')]['id'];_0x2270c4[_0xb488('0x71')]['id']=_0x55d4c6[_0xb488('0x53')][_0xb488('0x5c')];return db[_0xb488('0x39')][_0xb488('0x52')]({'where':{'id':_0x55d4c6[_0xb488('0x50')]['id'],'UserId':null}})[_0xb488('0x24')](handleEntityNotFound(_0xb72ae6,null))[_0xb488('0x24')](function(_0x2d8e02){if(_0x2d8e02){_0x2270c4[_0xb488('0x2c')]=_0x2d8e02['get']({'plain':!![]});return db['FaxInteraction'][_0xb488('0x52')]({'where':{'id':_0x2d8e02[_0xb488('0x5f')]}});}return null;})[_0xb488('0x24')](handleEntityNotFound(_0xb72ae6,null))[_0xb488('0x24')](function(_0xd99e99){if(_0xd99e99){_0x2270c4[_0xb488('0x61')]=_0xd99e99['get']({'plain':!![]});interaction_log[_0xb488('0x25')](_0xb488('0x72'),_0x55d4c6[_0xb488('0x64')]['id'],_0x55d4c6[_0xb488('0x64')][_0xb488('0x65')],_0x55d4c6[_0xb488('0x64')][_0xb488('0x73')],_0x2270c4['interaction']['id'],_0x55d4c6['body']?JSON[_0xb488('0x66')](_0x55d4c6['body']):_0xb488('0x67'));return respondWithRpcPromise(_0xb488('0x74'),'rejectMessage',_0x2270c4);}return null;})[_0xb488('0x24')](function(_0x45d8a5){if(_0x45d8a5){_0x45d8a5[_0xb488('0x2c')][_0xb488('0x6b')]=util['format'](_0xb488('0x75'),_0x55d4c6[_0xb488('0x64')]['name']);_0x45d8a5[_0xb488('0x2c')]['channel']=_0x2270c4[_0xb488('0x6c')];_0x45d8a5[_0xb488('0x2c')][_0xb488('0x6d')]='reject';respondWithRpcPromise(_0xb488('0x6e'),_0xb488('0x6e'),{'event':_0xb488('0x76'),'message':_0x45d8a5[_0xb488('0x2c')]},client9002);return _0x2270c4;}return null;})[_0xb488('0x24')](respondWithResult(_0xb72ae6,null))['catch'](handleError(_0xb72ae6,null));};exports['create']=function(_0x17dd93,_0x26e724){var _0x24b31c;return db[_0xb488('0x39')]['create'](_0x17dd93[_0xb488('0x53')],{})['then'](function(_0x6611c1){_0x24b31c=_0x6611c1;return db['CmContact'][_0xb488('0x77')]({'where':{'id':_0x24b31c['ContactId']}});})[_0xb488('0x24')](function(_0x413545){if(_['isNil'](_0x413545)){return;}else{_0x24b31c['fax']=_0x413545[_0xb488('0x57')];return db[_0xb488('0x78')]['findOne']({'where':{'id':_0x24b31c[_0xb488('0x79')]}});}})[_0xb488('0x24')](function(_0x21ab06){return respondWithRpcPromise(_0xb488('0x7a'),_0xb488('0x7a'),{'FaxAccountId':_['isNil'](_0x17dd93[_0xb488('0x53')])?undefined:_0x17dd93['body'][_0xb488('0x7b')],'path':_[_0xb488('0x7c')](_0x21ab06)?undefined:util[_0xb488('0x5a')](_0xb488('0x7d'),_0x21ab06[_0xb488('0x7e')]),'fax':_[_0xb488('0x7c')](_0x24b31c[_0xb488('0x57')])?undefined:_0x24b31c[_0xb488('0x57')],'AttachmentId':_0x24b31c[_0xb488('0x79')]},client9002);})[_0xb488('0x24')](respondWithResult(_0x26e724,0xc9))[_0xb488('0x2d')](handleError(_0x26e724,null));};exports['download']=function(_0x145804,_0x46be01){var _0x16fc59=path[_0xb488('0x7f')](config['root'],_0xb488('0x80'),_0xb488('0x81'),_0xb488('0x82'));return db[_0xb488('0x39')][_0xb488('0x52')]({'where':{'id':_0x145804[_0xb488('0x50')]['id']},'include':[{'model':db['Attachment'],'as':_0xb488('0x78')}]})['then'](handleEntityNotFound(_0x46be01,null))['then'](function(_0x4e2e24){if(_0x4e2e24){return _0x46be01[_0xb488('0x83')](path[_0xb488('0x7f')](_0x16fc59,_0x4e2e24['Attachment'][_0xb488('0x7e')]));}})[_0xb488('0x2d')](handleError(_0x46be01,null));}; \ No newline at end of file +var _0x7f5d=['defaults','socket.io-emitter','./faxMessage.socket','register','jayson/promise','http','client','test','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','then','debug','FaxMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','FaxMessage,\x20%s,\x20%s','message','result','sendStatus','status','end','count','offset','limit','set','Content-Range','json','apply','save','update','destroy','stack','name','map','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','options','include','FaxMessage','findAll','rows','catch','show','params','includeAll','find','body','describe','fax-interactions','accept','fax','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','CmContact','Contact','FaxInteraction','FaxInteractionId','isNil','interaction','get','info','role','null','AcceptMessage','manual','SIP/%s','channel','event','EventManager','acceptmessage','reject','agent','[FAXMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','rejectmessage','create','ContactId','findOne','AttachmentId','FaxAccountId','/var/opt/motion2/server/files/attachments/%s','basename','download','join','server','files','attachments','Attachment','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','sox','to-csv','lodash','squel','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis'];(function(_0xe89e13,_0x2e7b4c){var _0x208190=function(_0x5e4167){while(--_0x5e4167){_0xe89e13['push'](_0xe89e13['shift']());}};_0x208190(++_0x2e7b4c);}(_0x7f5d,0xf5));var _0xd7f5=function(_0x330518,_0x30bb6b){_0x330518=_0x330518-0x0;var _0x12d432=_0x7f5d[_0x330518];return _0x12d432;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xd7f5('0x0'));var rimraf=require(_0xd7f5('0x1'));var zipdir=require(_0xd7f5('0x2'));var jsonpatch=require(_0xd7f5('0x3'));var rp=require(_0xd7f5('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xd7f5('0x5'));var util=require(_0xd7f5('0x6'));var path=require('path');var sox=require(_0xd7f5('0x7'));var csv=require(_0xd7f5('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xd7f5('0x9'));var squel=require(_0xd7f5('0xa'));var crypto=require(_0xd7f5('0xb'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xd7f5('0x8'));var querystring=require(_0xd7f5('0xc'));var Papa=require(_0xd7f5('0xd'));var Redis=require(_0xd7f5('0xe'));var authService=require(_0xd7f5('0xf'));var qs=require(_0xd7f5('0x10'));var as=require(_0xd7f5('0x11'));var hardwareService=require(_0xd7f5('0x12'));var logger=require(_0xd7f5('0x13'))(_0xd7f5('0x14'));var utils=require(_0xd7f5('0x15'));var config=require(_0xd7f5('0x16'));var db=require(_0xd7f5('0x17'))['db'];config[_0xd7f5('0x18')]=_[_0xd7f5('0x19')](config[_0xd7f5('0x18')],{'host':'localhost','port':0x18eb});var socket=require(_0xd7f5('0x1a'))(new Redis(config[_0xd7f5('0x18')]));require(_0xd7f5('0x1b'))[_0xd7f5('0x1c')](socket);var jayson=require(_0xd7f5('0x1d'));var client=jayson['client'][_0xd7f5('0x1e')]({'port':0x232c});var client9002=jayson[_0xd7f5('0x1f')][_0xd7f5('0x1e')]({'port':0x232a});function checkPasswordPattern(_0x4d5ffd,_0x47c3e3,_0x50377b){if(_0x50377b){var _0x2b330b=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x2b330b[_0xd7f5('0x20')](_0x47c3e3)){return _0x4d5ffd;}else{throw new db['Sequelize']['ValidationError'](_0xd7f5('0x21'));}}else{return _0x4d5ffd;}}function respondWithRpcPromise(_0x368b72,_0x1fdeb7,_0x503dfd,_0x5f45d8){return new BPromise(function(_0x2ea5ea,_0x14418f){var _0x56d4cd=_0x5f45d8||client;return _0x56d4cd['request'](_0x368b72,_0x503dfd)[_0xd7f5('0x22')](function(_0x2c7e3e){logger['info']('FaxMessage,\x20%s,\x20%s',_0x1fdeb7,'request\x20sent');logger[_0xd7f5('0x23')](_0xd7f5('0x24'),_0x1fdeb7,_0xd7f5('0x25'),JSON[_0xd7f5('0x26')](_0x2c7e3e));if(_0x2c7e3e[_0xd7f5('0x27')]){if(_0x2c7e3e[_0xd7f5('0x27')][_0xd7f5('0x28')]===0x1f4){logger[_0xd7f5('0x27')](_0xd7f5('0x29'),_0x1fdeb7,_0x2c7e3e[_0xd7f5('0x27')][_0xd7f5('0x2a')]);return _0x14418f(_0x2c7e3e['error'][_0xd7f5('0x2a')]);}logger[_0xd7f5('0x27')](_0xd7f5('0x29'),_0x1fdeb7,_0x2c7e3e[_0xd7f5('0x27')][_0xd7f5('0x2a')]);return _0x2ea5ea(_0x2c7e3e['error'][_0xd7f5('0x2a')]);}else{logger['info']('FaxMessage,\x20%s,\x20%s',_0x1fdeb7,_0xd7f5('0x25'));_0x2ea5ea(_0x2c7e3e[_0xd7f5('0x2b')][_0xd7f5('0x2a')]);}})['catch'](function(_0x330e33){logger[_0xd7f5('0x27')](_0xd7f5('0x29'),_0x1fdeb7,_0x330e33);_0x14418f(_0x330e33);});});}function respondWithStatusCode(_0x215658,_0x422534){_0x422534=_0x422534||0xcc;return function(_0x342b8e){if(_0x342b8e){return _0x215658[_0xd7f5('0x2c')](_0x422534);}return _0x215658[_0xd7f5('0x2d')](_0x422534)[_0xd7f5('0x2e')]();};}function respondWithResult(_0x43099a,_0x438136){_0x438136=_0x438136||0xc8;return function(_0x329afe){if(_0x329afe){return _0x43099a[_0xd7f5('0x2d')](_0x438136)['json'](_0x329afe);}};}function respondWithFilteredResult(_0x2c03ee,_0xf1315){return function(_0x2e40fa){if(_0x2e40fa){var _0x11a166=_0x2e40fa[_0xd7f5('0x2f')],_0x21ca5e=_0xf1315[_0xd7f5('0x30')],_0x42852b=_0xf1315[_0xd7f5('0x30')]+_0xf1315[_0xd7f5('0x31')],_0x5eabd2;if(_0x42852b>=_0x11a166){_0x42852b=_0x11a166;_0x5eabd2=0xc8;}else{_0x5eabd2=0xce;}_0x2c03ee[_0xd7f5('0x2d')](_0x5eabd2);return _0x2c03ee[_0xd7f5('0x32')](_0xd7f5('0x33'),_0x21ca5e+'-'+_0x42852b+'/'+_0x11a166)[_0xd7f5('0x34')](_0x2e40fa);}return null;};}function patchUpdates(_0x21273a){return function(_0xae2ebb){try{jsonpatch[_0xd7f5('0x35')](_0xae2ebb,_0x21273a,!![]);}catch(_0x3c0cc5){return BPromise['reject'](_0x3c0cc5);}return _0xae2ebb[_0xd7f5('0x36')]();};}function saveUpdates(_0x1e3f40,_0x5186ba){return function(_0x215d8f){if(_0x215d8f){return _0x215d8f[_0xd7f5('0x37')](_0x1e3f40)[_0xd7f5('0x22')](function(_0x3f2e80){return _0x3f2e80;});}return null;};}function removeEntity(_0x96bc9d,_0x11081){return function(_0x54262e){if(_0x54262e){return _0x54262e[_0xd7f5('0x38')]()[_0xd7f5('0x22')](function(){_0x96bc9d[_0xd7f5('0x2d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x326d9f,_0x29721d){return function(_0xb2d322){if(!_0xb2d322){_0x326d9f[_0xd7f5('0x2c')](0x194);}return _0xb2d322;};}function handleError(_0x520c4b,_0x4234f1){_0x4234f1=_0x4234f1||0x1f4;return function(_0x22cdeb){logger[_0xd7f5('0x27')](_0x22cdeb[_0xd7f5('0x39')]);if(_0x22cdeb[_0xd7f5('0x3a')]){delete _0x22cdeb['name'];}_0x520c4b[_0xd7f5('0x2d')](_0x4234f1)['send'](_0x22cdeb);};}exports['index']=function(_0x170442,_0x4bd143){var _0x224411={},_0x11a3da={},_0x15c586={'count':0x0,'rows':[]};var _0x25d4d3=_[_0xd7f5('0x3b')](db['FaxMessage'][_0xd7f5('0x3c')],function(_0x4d2957){return{'name':_0x4d2957[_0xd7f5('0x3d')],'type':_0x4d2957[_0xd7f5('0x3e')][_0xd7f5('0x3f')]};});_0x11a3da[_0xd7f5('0x40')]=_['map'](_0x25d4d3,'name');_0x11a3da['query']=_[_0xd7f5('0x41')](_0x170442[_0xd7f5('0x42')]);_0x11a3da[_0xd7f5('0x43')]=_[_0xd7f5('0x44')](_0x11a3da[_0xd7f5('0x40')],_0x11a3da[_0xd7f5('0x42')]);_0x224411['attributes']=_[_0xd7f5('0x44')](_0x11a3da[_0xd7f5('0x40')],qs[_0xd7f5('0x45')](_0x170442['query'][_0xd7f5('0x45')]));_0x224411['attributes']=_0x224411[_0xd7f5('0x46')][_0xd7f5('0x47')]?_0x224411[_0xd7f5('0x46')]:_0x11a3da[_0xd7f5('0x40')];if(!_0x170442[_0xd7f5('0x42')][_0xd7f5('0x48')](_0xd7f5('0x49'))){_0x224411['limit']=qs[_0xd7f5('0x31')](_0x170442[_0xd7f5('0x42')][_0xd7f5('0x31')]);_0x224411[_0xd7f5('0x30')]=qs[_0xd7f5('0x30')](_0x170442[_0xd7f5('0x42')][_0xd7f5('0x30')]);}_0x224411[_0xd7f5('0x4a')]=qs[_0xd7f5('0x4b')](_0x170442[_0xd7f5('0x42')][_0xd7f5('0x4b')]);_0x224411[_0xd7f5('0x4c')]=qs['filters'](_['pick'](_0x170442[_0xd7f5('0x42')],_0x11a3da[_0xd7f5('0x43')]),_0x25d4d3);if(_0x170442[_0xd7f5('0x42')][_0xd7f5('0x4d')]){_0x224411['where']=_[_0xd7f5('0x4e')](_0x224411[_0xd7f5('0x4c')],{'$or':_[_0xd7f5('0x3b')](_0x25d4d3,function(_0xcfb929){if(_0xcfb929['type']!=='VIRTUAL'){var _0x28a686={};_0x28a686[_0xcfb929[_0xd7f5('0x3a')]]={'$like':'%'+_0x170442['query'][_0xd7f5('0x4d')]+'%'};return _0x28a686;}})});}_0x224411=_[_0xd7f5('0x4e')]({},_0x224411,_0x170442[_0xd7f5('0x4f')]);var _0x2cb2d1={'where':_0x224411[_0xd7f5('0x4c')]};return db['FaxMessage']['count'](_0x2cb2d1)[_0xd7f5('0x22')](function(_0x503d97){_0x15c586['count']=_0x503d97;if(_0x170442[_0xd7f5('0x42')]['includeAll']){_0x224411[_0xd7f5('0x50')]=[{'all':!![]}];}return db[_0xd7f5('0x51')][_0xd7f5('0x52')](_0x224411);})[_0xd7f5('0x22')](function(_0x1e75ca){_0x15c586[_0xd7f5('0x53')]=_0x1e75ca;return _0x15c586;})['then'](respondWithFilteredResult(_0x4bd143,_0x224411))[_0xd7f5('0x54')](handleError(_0x4bd143,null));};exports[_0xd7f5('0x55')]=function(_0x21cbb0,_0x542a49){var _0x4b236a={'raw':!![],'where':{'id':_0x21cbb0[_0xd7f5('0x56')]['id']}},_0x1dfdef={};_0x1dfdef[_0xd7f5('0x40')]=_[_0xd7f5('0x41')](db['FaxMessage'][_0xd7f5('0x3c')]);_0x1dfdef[_0xd7f5('0x42')]=_[_0xd7f5('0x41')](_0x21cbb0[_0xd7f5('0x42')]);_0x1dfdef[_0xd7f5('0x43')]=_[_0xd7f5('0x44')](_0x1dfdef[_0xd7f5('0x40')],_0x1dfdef[_0xd7f5('0x42')]);_0x4b236a['attributes']=_[_0xd7f5('0x44')](_0x1dfdef[_0xd7f5('0x40')],qs[_0xd7f5('0x45')](_0x21cbb0[_0xd7f5('0x42')][_0xd7f5('0x45')]));_0x4b236a['attributes']=_0x4b236a[_0xd7f5('0x46')][_0xd7f5('0x47')]?_0x4b236a[_0xd7f5('0x46')]:_0x1dfdef[_0xd7f5('0x40')];if(_0x21cbb0[_0xd7f5('0x42')][_0xd7f5('0x57')]){_0x4b236a['include']=[{'all':!![]}];}_0x4b236a=_[_0xd7f5('0x4e')]({},_0x4b236a,_0x21cbb0[_0xd7f5('0x4f')]);return db[_0xd7f5('0x51')][_0xd7f5('0x58')](_0x4b236a)[_0xd7f5('0x22')](handleEntityNotFound(_0x542a49,null))[_0xd7f5('0x22')](respondWithResult(_0x542a49,null))[_0xd7f5('0x54')](handleError(_0x542a49,null));};exports[_0xd7f5('0x37')]=function(_0x413c39,_0x4bee4c){if(_0x413c39[_0xd7f5('0x59')]['id']){delete _0x413c39['body']['id'];}return db['FaxMessage'][_0xd7f5('0x58')]({'where':{'id':_0x413c39[_0xd7f5('0x56')]['id']}})[_0xd7f5('0x22')](handleEntityNotFound(_0x4bee4c,null))[_0xd7f5('0x22')](saveUpdates(_0x413c39[_0xd7f5('0x59')],null))['then'](respondWithResult(_0x4bee4c,null))[_0xd7f5('0x54')](handleError(_0x4bee4c,null));};exports[_0xd7f5('0x38')]=function(_0x4ea770,_0x132100){return db['FaxMessage']['find']({'where':{'id':_0x4ea770[_0xd7f5('0x56')]['id']}})['then'](handleEntityNotFound(_0x132100,null))[_0xd7f5('0x22')](removeEntity(_0x132100,null))[_0xd7f5('0x54')](handleError(_0x132100,null));};exports[_0xd7f5('0x5a')]=function(_0x40851d,_0x3b7196){return db[_0xd7f5('0x51')][_0xd7f5('0x5a')]()[_0xd7f5('0x22')](respondWithResult(_0x3b7196,null))[_0xd7f5('0x54')](handleError(_0x3b7196,null));};var interaction_log=require('../../config/logger')(_0xd7f5('0x5b'));exports[_0xd7f5('0x5c')]=function(_0x4c2193,_0xa9789b,_0x3a03ac){var _0x53ceb0={'channel':_0xd7f5('0x5d')};if(_0x4c2193[_0xd7f5('0x59')]['id']){delete _0x4c2193['body']['id'];}_0x4c2193[_0xd7f5('0x59')]['read']=!![];_0x4c2193[_0xd7f5('0x59')][_0xd7f5('0x5e')]=moment()[_0xd7f5('0x5f')](_0xd7f5('0x60'));_0x4c2193[_0xd7f5('0x59')][_0xd7f5('0x61')]=_0x4c2193[_0xd7f5('0x59')][_0xd7f5('0x61')]||_0x4c2193[_0xd7f5('0x62')]['id'];return db[_0xd7f5('0x51')]['find']({'where':{'id':_0x4c2193[_0xd7f5('0x56')]['id'],'UserId':null},'include':[{'model':db[_0xd7f5('0x63')],'as':_0xd7f5('0x64')}]})[_0xd7f5('0x22')](handleEntityNotFound(_0xa9789b,null))[_0xd7f5('0x22')](saveUpdates(_0x4c2193[_0xd7f5('0x59')],null))['then'](function(_0x51db33){if(_0x51db33){_0x53ceb0[_0xd7f5('0x2a')]=_0x51db33['get']({'plain':!![]});return db[_0xd7f5('0x65')][_0xd7f5('0x58')]({'where':{'id':_0x51db33[_0xd7f5('0x66')]}});}return null;})[_0xd7f5('0x22')](handleEntityNotFound(_0xa9789b,null))['then'](function(_0xeda450){if(_0xeda450){return _0xeda450[_0xd7f5('0x37')]({'UserId':_0x4c2193['body'][_0xd7f5('0x61')],'read1stAt':_[_0xd7f5('0x67')](_0xeda450['read1stAt'])?moment()[_0xd7f5('0x5f')]('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})[_0xd7f5('0x22')](function(_0x42a477){if(_0x42a477){_0x53ceb0[_0xd7f5('0x68')]=_0x42a477[_0xd7f5('0x69')]({'plain':!![]});interaction_log[_0xd7f5('0x6a')]('[FAXMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x4c2193[_0xd7f5('0x62')]['id'],_0x4c2193[_0xd7f5('0x62')]['name'],_0x4c2193['user'][_0xd7f5('0x6b')],_0x53ceb0[_0xd7f5('0x68')]['id'],_0x4c2193[_0xd7f5('0x59')]?JSON[_0xd7f5('0x26')](_0x4c2193['body']):_0xd7f5('0x6c'));return respondWithRpcPromise(_0xd7f5('0x6d'),'acceptMessage',_0x53ceb0);}return null;})['then'](function(_0x2bfd8d){if(_0x2bfd8d){if(_0x4c2193[_0xd7f5('0x59')][_0xd7f5('0x6e')]){_0x53ceb0[_0xd7f5('0x2a')]['interface']=util[_0xd7f5('0x5f')](_0xd7f5('0x6f'),_0x4c2193[_0xd7f5('0x62')][_0xd7f5('0x3a')]);_0x53ceb0['message'][_0xd7f5('0x70')]=_0x53ceb0[_0xd7f5('0x70')];_0x53ceb0['message'][_0xd7f5('0x71')]=_0xd7f5('0x5c');return respondWithRpcPromise(_0xd7f5('0x72'),_0xd7f5('0x72'),{'event':_0xd7f5('0x73'),'message':_0x53ceb0[_0xd7f5('0x2a')]},client9002)[_0xd7f5('0x22')](function(){return _0x53ceb0;});}return _0x53ceb0;}return null;})[_0xd7f5('0x22')](respondWithResult(_0xa9789b,null))['catch'](handleError(_0xa9789b,null));};var interaction_log=require(_0xd7f5('0x13'))(_0xd7f5('0x5b'));exports[_0xd7f5('0x74')]=function(_0x2a31e1,_0x33408a,_0x367940){var _0x4a0a99={'agent':{},'channel':_0xd7f5('0x5d')};if(_0x2a31e1['body']['id']){delete _0x2a31e1[_0xd7f5('0x59')]['id'];}_0x2a31e1['body']['UserId']=_0x2a31e1[_0xd7f5('0x59')][_0xd7f5('0x61')]||_0x2a31e1['user']['id'];_0x4a0a99[_0xd7f5('0x75')]['id']=_0x2a31e1[_0xd7f5('0x59')][_0xd7f5('0x61')];return db[_0xd7f5('0x51')][_0xd7f5('0x58')]({'where':{'id':_0x2a31e1[_0xd7f5('0x56')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x33408a,null))[_0xd7f5('0x22')](function(_0x2e0feb){if(_0x2e0feb){_0x4a0a99['message']=_0x2e0feb[_0xd7f5('0x69')]({'plain':!![]});return db[_0xd7f5('0x65')][_0xd7f5('0x58')]({'where':{'id':_0x2e0feb['FaxInteractionId']}});}return null;})[_0xd7f5('0x22')](handleEntityNotFound(_0x33408a,null))['then'](function(_0x392398){if(_0x392398){_0x4a0a99[_0xd7f5('0x68')]=_0x392398[_0xd7f5('0x69')]({'plain':!![]});interaction_log[_0xd7f5('0x6a')](_0xd7f5('0x76'),_0x2a31e1[_0xd7f5('0x62')]['id'],_0x2a31e1[_0xd7f5('0x62')][_0xd7f5('0x3a')],_0x2a31e1[_0xd7f5('0x62')][_0xd7f5('0x6b')],_0x4a0a99[_0xd7f5('0x68')]['id'],_0x2a31e1['body']?JSON['stringify'](_0x2a31e1[_0xd7f5('0x59')]):'null');return respondWithRpcPromise(_0xd7f5('0x77'),_0xd7f5('0x78'),_0x4a0a99);}return null;})[_0xd7f5('0x22')](function(_0x264beb){if(_0x264beb){_0x264beb[_0xd7f5('0x2a')]['interface']=util[_0xd7f5('0x5f')](_0xd7f5('0x6f'),_0x2a31e1[_0xd7f5('0x62')][_0xd7f5('0x3a')]);_0x264beb[_0xd7f5('0x2a')][_0xd7f5('0x70')]=_0x4a0a99[_0xd7f5('0x70')];_0x264beb['message'][_0xd7f5('0x71')]='reject';respondWithRpcPromise(_0xd7f5('0x72'),'EventManager',{'event':_0xd7f5('0x79'),'message':_0x264beb[_0xd7f5('0x2a')]},client9002);return _0x4a0a99;}return null;})[_0xd7f5('0x22')](respondWithResult(_0x33408a,null))[_0xd7f5('0x54')](handleError(_0x33408a,null));};exports[_0xd7f5('0x7a')]=function(_0xabb394,_0x40a2c1){var _0x354aaa;return db[_0xd7f5('0x51')][_0xd7f5('0x7a')](_0xabb394[_0xd7f5('0x59')],{})[_0xd7f5('0x22')](function(_0x4eab69){_0x354aaa=_0x4eab69;return db[_0xd7f5('0x63')]['findOne']({'where':{'id':_0x354aaa[_0xd7f5('0x7b')]}});})[_0xd7f5('0x22')](function(_0x1bde5e){if(_[_0xd7f5('0x67')](_0x1bde5e)){return;}else{_0x354aaa[_0xd7f5('0x5d')]=_0x1bde5e[_0xd7f5('0x5d')];return db['Attachment'][_0xd7f5('0x7c')]({'where':{'id':_0x354aaa[_0xd7f5('0x7d')]}});}})['then'](function(_0x5c01f3){return respondWithRpcPromise('SendFax','SendFax',{'FaxAccountId':_[_0xd7f5('0x67')](_0xabb394[_0xd7f5('0x59')])?undefined:_0xabb394[_0xd7f5('0x59')][_0xd7f5('0x7e')],'path':_['isNil'](_0x5c01f3)?undefined:util[_0xd7f5('0x5f')](_0xd7f5('0x7f'),_0x5c01f3[_0xd7f5('0x80')]),'fax':_[_0xd7f5('0x67')](_0x354aaa[_0xd7f5('0x5d')])?undefined:_0x354aaa[_0xd7f5('0x5d')],'AttachmentId':_0x354aaa[_0xd7f5('0x7d')]},client9002);})[_0xd7f5('0x22')](respondWithResult(_0x40a2c1,0xc9))[_0xd7f5('0x54')](handleError(_0x40a2c1,null));};exports[_0xd7f5('0x81')]=function(_0x4a07b6,_0x221798){var _0xbf80b6=path[_0xd7f5('0x82')](config['root'],_0xd7f5('0x83'),_0xd7f5('0x84'),_0xd7f5('0x85'));return db[_0xd7f5('0x51')][_0xd7f5('0x58')]({'where':{'id':_0x4a07b6[_0xd7f5('0x56')]['id']},'include':[{'model':db['Attachment'],'as':_0xd7f5('0x86')}]})[_0xd7f5('0x22')](handleEntityNotFound(_0x221798,null))[_0xd7f5('0x22')](function(_0x3a6702){if(_0x3a6702){return _0x221798[_0xd7f5('0x81')](path[_0xd7f5('0x82')](_0xbf80b6,_0x3a6702['Attachment'][_0xd7f5('0x80')]));}})[_0xd7f5('0x54')](handleError(_0x221798,null));}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.events.js b/server/api/faxMessage/faxMessage.events.js index 11a638b..7096e52 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 _0xe14b=['hasOwnProperty','hook','exports','events','../../mysqldb','save','update','emit'];(function(_0x5b644e,_0x2e5e07){var _0x49c6bf=function(_0x3032d9){while(--_0x3032d9){_0x5b644e['push'](_0x5b644e['shift']());}};_0x49c6bf(++_0x2e5e07);}(_0xe14b,0x93));var _0xbe14=function(_0x4b6cbe,_0x5a061e){_0x4b6cbe=_0x4b6cbe-0x0;var _0x106364=_0xe14b[_0x4b6cbe];return _0x106364;};'use strict';var EventEmitter=require(_0xbe14('0x0'));var FaxMessage=require(_0xbe14('0x1'))['db']['FaxMessage'];var FaxMessageEvents=new EventEmitter();FaxMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xbe14('0x2'),'afterUpdate':_0xbe14('0x3'),'afterDestroy':'remove'};function emitEvent(_0x7d3665){return function(_0x5ce8fb,_0x496c04,_0x1833e3){FaxMessageEvents[_0xbe14('0x4')](_0x7d3665+':'+_0x5ce8fb['id'],_0x5ce8fb);FaxMessageEvents[_0xbe14('0x4')](_0x7d3665,_0x5ce8fb);_0x1833e3(null);};}for(var e in events){if(events[_0xbe14('0x5')](e)){var event=events[e];FaxMessage[_0xbe14('0x6')](e,emitEvent(event));}}module[_0xbe14('0x7')]=FaxMessageEvents; \ No newline at end of file +var _0x34e8=['emit','hasOwnProperty','exports','events','../../mysqldb','FaxMessage','setMaxListeners','update','remove'];(function(_0x2d7f0e,_0x3e6fbd){var _0x110b07=function(_0x557b00){while(--_0x557b00){_0x2d7f0e['push'](_0x2d7f0e['shift']());}};_0x110b07(++_0x3e6fbd);}(_0x34e8,0x12c));var _0x834e=function(_0x5f2cbc,_0x282246){_0x5f2cbc=_0x5f2cbc-0x0;var _0x4f0351=_0x34e8[_0x5f2cbc];return _0x4f0351;};'use strict';var EventEmitter=require(_0x834e('0x0'));var FaxMessage=require(_0x834e('0x1'))['db'][_0x834e('0x2')];var FaxMessageEvents=new EventEmitter();FaxMessageEvents[_0x834e('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x834e('0x4'),'afterDestroy':_0x834e('0x5')};function emitEvent(_0x472111){return function(_0x31bf20,_0x289ef2,_0x19a3e0){FaxMessageEvents[_0x834e('0x6')](_0x472111+':'+_0x31bf20['id'],_0x31bf20);FaxMessageEvents['emit'](_0x472111,_0x31bf20);_0x19a3e0(null);};}for(var e in events){if(events[_0x834e('0x7')](e)){var event=events[e];FaxMessage['hook'](e,emitEvent(event));}}module[_0x834e('0x8')]=FaxMessageEvents; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.model.js b/server/api/faxMessage/faxMessage.model.js index a5d5439..e15acdd 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 _0xe238=['rimraf','./faxMessage.attributes','FaxMessage','fax_messages','fti_fax_messages','body','models','direction','toLowerCase','out','secret','FaxInteraction','FaxInteractionId','then','update','createdAt','catch','error','utf8mb4','utf8mb4_unicode_ci','util','api','bluebird'];(function(_0x222ac5,_0x5e14da){var _0x4bc51e=function(_0x8f98b3){while(--_0x8f98b3){_0x222ac5['push'](_0x222ac5['shift']());}};_0x4bc51e(++_0x5e14da);}(_0xe238,0x1c9));var _0x8e23=function(_0x11005e,_0x20c3d2){_0x11005e=_0x11005e-0x0;var _0x29338f=_0xe238[_0x11005e];return _0x29338f;};'use strict';var _=require('lodash');var util=require(_0x8e23('0x0'));var logger=require('../../config/logger')(_0x8e23('0x1'));var moment=require('moment');var BPromise=require(_0x8e23('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x8e23('0x3'));var config=require('../../config/environment');var attributes=require(_0x8e23('0x4'));module['exports']=function(_0x5f568d,_0x54f92d){return _0x5f568d['define'](_0x8e23('0x5'),attributes,{'tableName':_0x8e23('0x6'),'paranoid':![],'indexes':[{'name':_0x8e23('0x7'),'fields':[_0x8e23('0x8')],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'afterCreate':function(_0x269004,_0x95cd2a,_0x55ac45){var _0x352410=_0x5f568d[_0x8e23('0x9')];var _0x401aa6=_0x269004['get']({'plain':!![]});if(_0x401aa6['direction']['toLowerCase']()==='in'||_0x401aa6[_0x8e23('0xa')][_0x8e23('0xb')]()===_0x8e23('0xc')&&!_0x401aa6[_0x8e23('0xd')]&&!_['isNil'](_0x401aa6['UserId'])){_0x352410[_0x8e23('0xe')]['findOne']({'where':{'id':_0x401aa6[_0x8e23('0xf')]}})[_0x8e23('0x10')](function(_0x39fc61){if(_0x39fc61){_0x39fc61[_0x8e23('0x11')]({'lastMsgAt':_0x401aa6[_0x8e23('0x12')],'lastMsgDirection':_0x401aa6[_0x8e23('0xa')]['toLowerCase']()});}})[_0x8e23('0x13')](function(_0x9aeb12){console[_0x8e23('0x14')](_0x9aeb12);});}_0x55ac45();}},'charset':_0x8e23('0x15'),'collate':_0x8e23('0x16')});}; \ No newline at end of file +var _0x9dfb=['body','get','toLowerCase','out','secret','isNil','FaxInteraction','findOne','then','update','createdAt','direction','catch','error','utf8mb4','utf8mb4_unicode_ci','util','api','moment','path','rimraf','../../config/environment','./faxMessage.attributes','define','fti_fax_messages'];(function(_0x68a0b0,_0x2bba91){var _0x4b4ee6=function(_0x36f6da){while(--_0x36f6da){_0x68a0b0['push'](_0x68a0b0['shift']());}};_0x4b4ee6(++_0x2bba91);}(_0x9dfb,0x1a0));var _0xb9df=function(_0x1ac359,_0x53a9ba){_0x1ac359=_0x1ac359-0x0;var _0x35a575=_0x9dfb[_0x1ac359];return _0x35a575;};'use strict';var _=require('lodash');var util=require(_0xb9df('0x0'));var logger=require('../../config/logger')(_0xb9df('0x1'));var moment=require(_0xb9df('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xb9df('0x3'));var rimraf=require(_0xb9df('0x4'));var config=require(_0xb9df('0x5'));var attributes=require(_0xb9df('0x6'));module['exports']=function(_0x529414,_0x33174a){return _0x529414[_0xb9df('0x7')]('FaxMessage',attributes,{'tableName':'fax_messages','paranoid':![],'indexes':[{'name':_0xb9df('0x8'),'fields':[_0xb9df('0x9')],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'afterCreate':function(_0x25186d,_0x33e0ed,_0x3f1acd){var _0x5b3c3c=_0x529414['models'];var _0x2eaed4=_0x25186d[_0xb9df('0xa')]({'plain':!![]});if(_0x2eaed4['direction'][_0xb9df('0xb')]()==='in'||_0x2eaed4['direction'][_0xb9df('0xb')]()===_0xb9df('0xc')&&!_0x2eaed4[_0xb9df('0xd')]&&!_[_0xb9df('0xe')](_0x2eaed4['UserId'])){_0x5b3c3c[_0xb9df('0xf')][_0xb9df('0x10')]({'where':{'id':_0x2eaed4['FaxInteractionId']}})[_0xb9df('0x11')](function(_0x43dcec){if(_0x43dcec){_0x43dcec[_0xb9df('0x12')]({'lastMsgAt':_0x2eaed4[_0xb9df('0x13')],'lastMsgDirection':_0x2eaed4[_0xb9df('0x14')][_0xb9df('0xb')]()});}})[_0xb9df('0x15')](function(_0x3f5e35){console[_0xb9df('0x16')](_0x3f5e35);});}_0x3f1acd();}},'charset':_0xb9df('0x17'),'collate':_0xb9df('0x18')});}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.rpc.js b/server/api/faxMessage/faxMessage.rpc.js index 0aa7720..2a8131b 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 _0x81e8=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','redis','localhost','socket.io-emitter','./faxMessage.socket','request','then','debug','FaxMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','FaxMessage,\x20%s,\x20%s','message','info','request\x20sent','result','CreateFaxMessage','FaxMessage','create','options','catch','UpdateFaxMessage','update','body','raw','where','limit','moment'];(function(_0x2338c2,_0xeca855){var _0x149734=function(_0x514eb0){while(--_0x514eb0){_0x2338c2['push'](_0x2338c2['shift']());}};_0x149734(++_0xeca855);}(_0x81e8,0x1db));var _0x881e=function(_0x170134,_0x4b7948){_0x170134=_0x170134-0x0;var _0x1d5033=_0x81e8[_0x170134];return _0x1d5033;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x881e('0x0'));var BPromise=require(_0x881e('0x1'));var rs=require(_0x881e('0x2'));var fs=require('fs');var Redis=require(_0x881e('0x3'));var db=require(_0x881e('0x4'))['db'];var utils=require(_0x881e('0x5'));var logger=require(_0x881e('0x6'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});config[_0x881e('0x7')]=_['defaults'](config['redis'],{'host':_0x881e('0x8'),'port':0x18eb});var socket=require(_0x881e('0x9'))(new Redis(config[_0x881e('0x7')]));require(_0x881e('0xa'))['register'](socket);function respondWithRpcPromise(_0xf44d27,_0x2db310,_0x1e3b58){return new BPromise(function(_0x21c0e3,_0x160470){return client[_0x881e('0xb')](_0xf44d27,_0x1e3b58)[_0x881e('0xc')](function(_0xcb74fd){logger['info']('FaxMessage,\x20%s,\x20%s',_0x2db310,'request\x20sent');logger[_0x881e('0xd')](_0x881e('0xe'),_0x2db310,'request\x20sent',JSON[_0x881e('0xf')](_0xcb74fd));if(_0xcb74fd[_0x881e('0x10')]){if(_0xcb74fd[_0x881e('0x10')][_0x881e('0x11')]===0x1f4){logger[_0x881e('0x10')](_0x881e('0x12'),_0x2db310,_0xcb74fd[_0x881e('0x10')][_0x881e('0x13')]);return _0x160470(_0xcb74fd[_0x881e('0x10')][_0x881e('0x13')]);}logger['error'](_0x881e('0x12'),_0x2db310,_0xcb74fd[_0x881e('0x10')][_0x881e('0x13')]);return _0x21c0e3(_0xcb74fd[_0x881e('0x10')]['message']);}else{logger[_0x881e('0x14')](_0x881e('0x12'),_0x2db310,_0x881e('0x15'));_0x21c0e3(_0xcb74fd[_0x881e('0x16')][_0x881e('0x13')]);}})['catch'](function(_0x414a47){logger['error'](_0x881e('0x12'),_0x2db310,_0x414a47);_0x160470(_0x414a47);});});}exports[_0x881e('0x17')]=function(_0x214847){var _0x32c90f=this;return new Promise(function(_0x4d208f,_0x36b30){return db[_0x881e('0x18')][_0x881e('0x19')](_0x214847['body'],{'raw':_0x214847[_0x881e('0x1a')]?_0x214847[_0x881e('0x1a')]['raw']===undefined?!![]:![]:!![]})[_0x881e('0xc')](function(_0x23e937){logger[_0x881e('0x14')](_0x881e('0x17'),_0x214847);logger[_0x881e('0xd')](_0x881e('0x17'),_0x214847,JSON[_0x881e('0xf')](_0x23e937));_0x4d208f(_0x23e937);})[_0x881e('0x1b')](function(_0x5a11c3){logger[_0x881e('0x10')]('CreateFaxMessage',_0x5a11c3[_0x881e('0x13')],_0x214847);_0x36b30(_0x32c90f[_0x881e('0x10')](0x1f4,_0x5a11c3[_0x881e('0x13')]));});});};exports[_0x881e('0x1c')]=function(_0x19ef96){var _0x53b8d9=this;return new Promise(function(_0x530abf,_0x43c33c){return db[_0x881e('0x18')][_0x881e('0x1d')](_0x19ef96[_0x881e('0x1e')],{'raw':_0x19ef96[_0x881e('0x1a')]?_0x19ef96['options'][_0x881e('0x1f')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x19ef96[_0x881e('0x1a')]?_0x19ef96[_0x881e('0x1a')][_0x881e('0x20')]||null:null,'attributes':_0x19ef96['options']?_0x19ef96[_0x881e('0x1a')]['attributes']||null:null,'limit':_0x19ef96['options']?_0x19ef96[_0x881e('0x1a')][_0x881e('0x21')]||null:null})[_0x881e('0xc')](function(_0x44286f){logger[_0x881e('0x14')](_0x881e('0x1c'),_0x19ef96);logger['debug']('UpdateFaxMessage',_0x19ef96,JSON['stringify'](_0x44286f));_0x530abf(_0x44286f);})[_0x881e('0x1b')](function(_0x227df6){logger[_0x881e('0x10')]('UpdateFaxMessage',_0x227df6['message'],_0x19ef96);_0x43c33c(_0x53b8d9[_0x881e('0x10')](0x1f4,_0x227df6[_0x881e('0x13')]));});});}; \ No newline at end of file +var _0xbe85=['../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','./faxMessage.socket','register','request','then','request\x20sent','FaxMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','FaxMessage,\x20%s,\x20%s','message','info','catch','CreateFaxMessage','FaxMessage','create','options','raw','UpdateFaxMessage','body','where','debug','lodash','util','moment','randomstring','ioredis','../../mysqldb'];(function(_0x1c9942,_0xe5dda3){var _0x3e0172=function(_0x3c8491){while(--_0x3c8491){_0x1c9942['push'](_0x1c9942['shift']());}};_0x3e0172(++_0xe5dda3);}(_0xbe85,0x19c));var _0x5be8=function(_0x1ff9f5,_0x310c70){_0x1ff9f5=_0x1ff9f5-0x0;var _0x3606ff=_0xbe85[_0x1ff9f5];return _0x3606ff;};'use strict';var _=require(_0x5be8('0x0'));var util=require(_0x5be8('0x1'));var moment=require(_0x5be8('0x2'));var BPromise=require('bluebird');var rs=require(_0x5be8('0x3'));var fs=require('fs');var Redis=require(_0x5be8('0x4'));var db=require(_0x5be8('0x5'))['db'];var utils=require(_0x5be8('0x6'));var logger=require(_0x5be8('0x7'))(_0x5be8('0x8'));var config=require(_0x5be8('0x9'));var jayson=require(_0x5be8('0xa'));var client=jayson[_0x5be8('0xb')][_0x5be8('0xc')]({'port':0x232a});config[_0x5be8('0xd')]=_[_0x5be8('0xe')](config[_0x5be8('0xd')],{'host':_0x5be8('0xf'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x5be8('0x10'))[_0x5be8('0x11')](socket);function respondWithRpcPromise(_0x1bd278,_0x40cf01,_0x182c0f){return new BPromise(function(_0x41e55d,_0x54c052){return client[_0x5be8('0x12')](_0x1bd278,_0x182c0f)[_0x5be8('0x13')](function(_0x50a107){logger['info']('FaxMessage,\x20%s,\x20%s',_0x40cf01,_0x5be8('0x14'));logger['debug'](_0x5be8('0x15'),_0x40cf01,_0x5be8('0x14'),JSON[_0x5be8('0x16')](_0x50a107));if(_0x50a107[_0x5be8('0x17')]){if(_0x50a107[_0x5be8('0x17')][_0x5be8('0x18')]===0x1f4){logger[_0x5be8('0x17')](_0x5be8('0x19'),_0x40cf01,_0x50a107[_0x5be8('0x17')][_0x5be8('0x1a')]);return _0x54c052(_0x50a107[_0x5be8('0x17')][_0x5be8('0x1a')]);}logger['error']('FaxMessage,\x20%s,\x20%s',_0x40cf01,_0x50a107[_0x5be8('0x17')][_0x5be8('0x1a')]);return _0x41e55d(_0x50a107['error'][_0x5be8('0x1a')]);}else{logger[_0x5be8('0x1b')](_0x5be8('0x19'),_0x40cf01,'request\x20sent');_0x41e55d(_0x50a107['result'][_0x5be8('0x1a')]);}})[_0x5be8('0x1c')](function(_0x29515f){logger[_0x5be8('0x17')](_0x5be8('0x19'),_0x40cf01,_0x29515f);_0x54c052(_0x29515f);});});}exports[_0x5be8('0x1d')]=function(_0x342cb9){var _0x36b4a0=this;return new Promise(function(_0x58b54a,_0x55f63b){return db[_0x5be8('0x1e')][_0x5be8('0x1f')](_0x342cb9['body'],{'raw':_0x342cb9[_0x5be8('0x20')]?_0x342cb9[_0x5be8('0x20')][_0x5be8('0x21')]===undefined?!![]:![]:!![]})[_0x5be8('0x13')](function(_0x490e28){logger['info'](_0x5be8('0x1d'),_0x342cb9);logger['debug']('CreateFaxMessage',_0x342cb9,JSON['stringify'](_0x490e28));_0x58b54a(_0x490e28);})[_0x5be8('0x1c')](function(_0xf73049){logger[_0x5be8('0x17')]('CreateFaxMessage',_0xf73049[_0x5be8('0x1a')],_0x342cb9);_0x55f63b(_0x36b4a0[_0x5be8('0x17')](0x1f4,_0xf73049[_0x5be8('0x1a')]));});});};exports[_0x5be8('0x22')]=function(_0x5545b4){var _0x1ae1a2=this;return new Promise(function(_0x21dc5c,_0x164fa9){return db[_0x5be8('0x1e')]['update'](_0x5545b4[_0x5be8('0x23')],{'raw':_0x5545b4['options']?_0x5545b4[_0x5be8('0x20')][_0x5be8('0x21')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5545b4[_0x5be8('0x20')]?_0x5545b4[_0x5be8('0x20')][_0x5be8('0x24')]||null:null,'attributes':_0x5545b4['options']?_0x5545b4[_0x5be8('0x20')]['attributes']||null:null,'limit':_0x5545b4['options']?_0x5545b4['options']['limit']||null:null})[_0x5be8('0x13')](function(_0x2dee53){logger[_0x5be8('0x1b')](_0x5be8('0x22'),_0x5545b4);logger[_0x5be8('0x25')](_0x5be8('0x22'),_0x5545b4,JSON[_0x5be8('0x16')](_0x2dee53));_0x21dc5c(_0x2dee53);})[_0x5be8('0x1c')](function(_0x5080b2){logger['error'](_0x5be8('0x22'),_0x5080b2[_0x5be8('0x1a')],_0x5545b4);_0x164fa9(_0x1ae1a2['error'](0x1f4,_0x5080b2[_0x5be8('0x1a')]));});});}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.socket.js b/server/api/faxMessage/faxMessage.socket.js index a2c47c3..4afcaf9 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(_0x3239f5,_0x50e77c){var _0x3559c8=function(_0x4f9f83){while(--_0x4f9f83){_0x3239f5['push'](_0x3239f5['shift']());}};_0x3559c8(++_0x50e77c);}(_0x9957,0x93));var _0x7995=function(_0x618414,_0x1a7a60){_0x618414=_0x618414-0x0;var _0x21c19a=_0x9957[_0x618414];return _0x21c19a;};'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(_0x3d8ca8,_0x1a9764){var _0x517e45=function(_0x641ad9){while(--_0x641ad9){_0x3d8ca8['push'](_0x3d8ca8['shift']());}};_0x517e45(++_0x1a9764);}(_0x9957,0x93));var _0x7995=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0x9957[_0x5ddb1c];return _0x354adc;};'use strict';var FaxMessageEvents=require(_0x7995('0x0'));var events=[_0x7995('0x1'),_0x7995('0x2'),_0x7995('0x3')];function createListener(_0x5b96eb,_0x86c128){return function(_0x3c58eb){_0x86c128[_0x7995('0x4')](_0x5b96eb,_0x3c58eb);};}function removeListener(_0x462a03,_0x576d89){return function(){FaxMessageEvents[_0x7995('0x5')](_0x462a03,_0x576d89);};}exports[_0x7995('0x6')]=function(_0x137b6b){for(var _0x219534=0x0,_0xbda126=events[_0x7995('0x7')];_0x219534<_0xbda126;_0x219534++){var _0x4996ca=events[_0x219534];var _0x465276=createListener(_0x7995('0x8')+_0x4996ca,_0x137b6b);FaxMessageEvents['on'](_0x4996ca,_0x465276);}}; \ No newline at end of file diff --git a/server/api/faxMessage/index.js b/server/api/faxMessage/index.js index 1928c6f..8655bcc 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 _0xf492=['./faxMessage.controller','get','isAuthenticated','describe','/:id','show','download','tracked','fax','faxmessage:create','put','accept','/:id/reject','reject','delete','destroy','exports','multer','path','connect-timeout','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x3481a0,_0x3e4f09){var _0x141b2b=function(_0x31cc9d){while(--_0x31cc9d){_0x3481a0['push'](_0x3481a0['shift']());}};_0x141b2b(++_0x3e4f09);}(_0xf492,0xb2));var _0x2f49=function(_0x189e16,_0x1af32a){_0x189e16=_0x189e16-0x0;var _0xc870ec=_0xf492[_0x189e16];return _0xc870ec;};'use strict';var multer=require(_0x2f49('0x0'));var util=require('util');var path=require(_0x2f49('0x1'));var timeout=require(_0x2f49('0x2'));var express=require('express');var router=express['Router']();var auth=require(_0x2f49('0x3'));var interaction=require(_0x2f49('0x4'));var config=require(_0x2f49('0x5'));var controller=require(_0x2f49('0x6'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0x2f49('0x7')]('/describe',auth[_0x2f49('0x8')](),controller[_0x2f49('0x9')]);router['get'](_0x2f49('0xa'),auth['isAuthenticated'](),controller[_0x2f49('0xb')]);router[_0x2f49('0x7')]('/:id/download',auth[_0x2f49('0x8')](),controller[_0x2f49('0xc')]);router['post']('/',auth[_0x2f49('0x8')](),interaction[_0x2f49('0xd')](_0x2f49('0xe'),_0x2f49('0xf')),controller['create']);router[_0x2f49('0x10')](_0x2f49('0xa'),auth[_0x2f49('0x8')](),controller['update']);router['put']('/:id/accept',auth[_0x2f49('0x8')](),controller[_0x2f49('0x11')]);router[_0x2f49('0x10')](_0x2f49('0x12'),auth[_0x2f49('0x8')](),controller[_0x2f49('0x13')]);router[_0x2f49('0x14')]('/:id',auth['isAuthenticated'](),controller[_0x2f49('0x15')]);module[_0x2f49('0x16')]=router; \ No newline at end of file +var _0xa100=['/:id','show','/:id/download','download','post','tracked','create','put','update','accept','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxMessage.controller','index','get','/describe','isAuthenticated','describe'];(function(_0x5322a1,_0x16a3bf){var _0x24d538=function(_0x51f436){while(--_0x51f436){_0x5322a1['push'](_0x5322a1['shift']());}};_0x24d538(++_0x16a3bf);}(_0xa100,0x1b1));var _0x0a10=function(_0x529724,_0xf7985d){_0x529724=_0x529724-0x0;var _0x4c0aa5=_0xa100[_0x529724];return _0x4c0aa5;};'use strict';var multer=require(_0x0a10('0x0'));var util=require(_0x0a10('0x1'));var path=require(_0x0a10('0x2'));var timeout=require(_0x0a10('0x3'));var express=require(_0x0a10('0x4'));var router=express[_0x0a10('0x5')]();var auth=require(_0x0a10('0x6'));var interaction=require(_0x0a10('0x7'));var config=require(_0x0a10('0x8'));var controller=require(_0x0a10('0x9'));router['get']('/',auth['isAuthenticated'](),controller[_0x0a10('0xa')]);router[_0x0a10('0xb')](_0x0a10('0xc'),auth[_0x0a10('0xd')](),controller[_0x0a10('0xe')]);router['get'](_0x0a10('0xf'),auth[_0x0a10('0xd')](),controller[_0x0a10('0x10')]);router[_0x0a10('0xb')](_0x0a10('0x11'),auth[_0x0a10('0xd')](),controller[_0x0a10('0x12')]);router[_0x0a10('0x13')]('/',auth[_0x0a10('0xd')](),interaction[_0x0a10('0x14')]('fax','faxmessage:create'),controller[_0x0a10('0x15')]);router[_0x0a10('0x16')]('/:id',auth['isAuthenticated'](),controller[_0x0a10('0x17')]);router[_0x0a10('0x16')]('/:id/accept',auth[_0x0a10('0xd')](),controller[_0x0a10('0x18')]);router['put']('/:id/reject',auth[_0x0a10('0xd')](),controller['reject']);router[_0x0a10('0x19')]('/:id',auth[_0x0a10('0xd')](),controller[_0x0a10('0x1a')]);module[_0x0a10('0x1b')]=router; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.attributes.js b/server/api/faxQueue/faxQueue.attributes.js index fb0eb31..2fd835c 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 _0x2b39=['ENUM','rrmemory','roundrobin','INTEGER','sequelize','exports','STRING','name'];(function(_0x5e786d,_0x5ddc59){var _0x5536f6=function(_0x21dcf9){while(--_0x21dcf9){_0x5e786d['push'](_0x5e786d['shift']());}};_0x5536f6(++_0x5ddc59);}(_0x2b39,0x11c));var _0x92b3=function(_0x366961,_0x3a976d){_0x366961=_0x366961-0x0;var _0x24d566=_0x2b39[_0x366961];return _0x24d566;};'use strict';var Sequelize=require(_0x92b3('0x0'));module[_0x92b3('0x1')]={'name':{'type':Sequelize[_0x92b3('0x2')],'unique':_0x92b3('0x3'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x92b3('0x2')]},'timeout':{'type':Sequelize['INTEGER'],'allowNull':![],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x92b3('0x4')](_0x92b3('0x5'),'beepall',_0x92b3('0x6')),'allowNull':![]},'lastAgent':{'type':Sequelize[_0x92b3('0x7')],'defaultValue':0x0}}; \ No newline at end of file +var _0x08d2=['rrmemory','beepall','sequelize','name','STRING','INTEGER'];(function(_0x3358ba,_0x24c5fc){var _0x296e73=function(_0x843ff3){while(--_0x843ff3){_0x3358ba['push'](_0x3358ba['shift']());}};_0x296e73(++_0x24c5fc);}(_0x08d2,0x182));var _0x208d=function(_0x116e6f,_0x3c33cb){_0x116e6f=_0x116e6f-0x0;var _0x2ed403=_0x08d2[_0x116e6f];return _0x2ed403;};'use strict';var Sequelize=require(_0x208d('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'unique':_0x208d('0x1'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x208d('0x2')]},'timeout':{'type':Sequelize[_0x208d('0x3')],'allowNull':![],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM'](_0x208d('0x4'),_0x208d('0x5'),'roundrobin'),'allowNull':![]},'lastAgent':{'type':Sequelize[_0x208d('0x3')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.controller.js b/server/api/faxQueue/faxQueue.controller.js index f4f17b5..9e9f368 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 _0x1184=['pick','addTeams','ids','findAll','User','Agents','online','flatMap','sequelize','transaction','findOrCreate','emit','userFaxQueue:save','field','from','team_has_fax_queues','join','ut.TeamId\x20=\x20tq.TeamId','clone','toString','QueryTypes','SELECT','TeamId','includes','union','compact','removeTeams','isEmpty','removeAgents','forEach','addAgents','userFaxQueue:remove','getAgents','html-pdf','rimraf','zip-dir','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','squel','crypto','jsforce','querystring','../../components/auth/service','../../components/parsers/qs','api','../../config/environment','defaults','socket.io-emitter','redis','./faxQueue.socket','status','json','count','offset','set','Content-Range','apply','reject','save','update','then','get','FaxQueues','destroy','end','error','name','send','index','map','FaxQueue','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','nolimit','limit','order','sort','where','filter','merge','VIRTUAL','options','includeAll','catch','show','length','include','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','findOne','UserFaxQueue','hasOwnProperty','FaxQueueId','findAndCountAll','UserId','faxPause','updatedAt','createdAt','format','%s/%s','getTeams','Team'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x1184,0xa0));var _0x4118=function(_0x25d6cc,_0x28228d){_0x25d6cc=_0x25d6cc-0x0;var _0x2e8731=_0x1184[_0x25d6cc];return _0x2e8731;};'use strict';var pdf=require(_0x4118('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x4118('0x1'));var zipdir=require(_0x4118('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x4118('0x3'));var moment=require(_0x4118('0x4'));var BPromise=require(_0x4118('0x5'));var Mustache=require(_0x4118('0x6'));var util=require('util');var path=require(_0x4118('0x7'));var sox=require(_0x4118('0x8'));var csv=require(_0x4118('0x9'));var ejs=require(_0x4118('0xa'));var fs=require('fs');var _=require('lodash');var squel=require(_0x4118('0xb'));var crypto=require(_0x4118('0xc'));var jsforce=require(_0x4118('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x4118('0xe'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x4118('0xf'));var qs=require(_0x4118('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x4118('0x11'));var utils=require('../../config/utils');var config=require(_0x4118('0x12'));var db=require('../../mysqldb')['db'];config['redis']=_[_0x4118('0x13')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x4118('0x14'))(new Redis(config[_0x4118('0x15')]));require(_0x4118('0x16'))['register'](socket);function respondWithStatusCode(_0x292086,_0xc9fee9){_0xc9fee9=_0xc9fee9||0xcc;return function(_0x3c077d){if(_0x3c077d){return _0x292086['sendStatus'](_0xc9fee9);}return _0x292086[_0x4118('0x17')](_0xc9fee9)['end']();};}function respondWithResult(_0x18d135,_0x45ec56){_0x45ec56=_0x45ec56||0xc8;return function(_0x38189b){if(_0x38189b){return _0x18d135['status'](_0x45ec56)[_0x4118('0x18')](_0x38189b);}};}function respondWithFilteredResult(_0x458887,_0x33eb6d){return function(_0xa88d23){if(_0xa88d23){var _0x1fb629=_0xa88d23[_0x4118('0x19')],_0x49ee6d=_0x33eb6d[_0x4118('0x1a')],_0x2d48ec=_0x33eb6d[_0x4118('0x1a')]+_0x33eb6d['limit'],_0x2c3e5c;if(_0x2d48ec>=_0x1fb629){_0x2d48ec=_0x1fb629;_0x2c3e5c=0xc8;}else{_0x2c3e5c=0xce;}_0x458887[_0x4118('0x17')](_0x2c3e5c);return _0x458887[_0x4118('0x1b')](_0x4118('0x1c'),_0x49ee6d+'-'+_0x2d48ec+'/'+_0x1fb629)['json'](_0xa88d23);}return null;};}function patchUpdates(_0x34c62f){return function(_0x2c19c9){try{jsonpatch[_0x4118('0x1d')](_0x2c19c9,_0x34c62f,!![]);}catch(_0xe0329b){return BPromise[_0x4118('0x1e')](_0xe0329b);}return _0x2c19c9[_0x4118('0x1f')]();};}function saveUpdates(_0x5dc4a7,_0x70906e){return function(_0x29ec36){if(_0x29ec36){return _0x29ec36[_0x4118('0x20')](_0x5dc4a7)[_0x4118('0x21')](function(_0xa6c615){return _0xa6c615;});}return null;};}function removeEntity(_0x4b49b0,_0x4af9c5){return function(_0x4e69f4){if(_0x4e69f4){return _0x4e69f4['destroy']()['then'](function(){var _0x20c3d0=_0x4e69f4[_0x4118('0x22')]({'plain':!![]});var _0x1cf952=_0x4118('0x23');return db['UserProfileResource'][_0x4118('0x24')]({'where':{'type':_0x1cf952,'resourceId':_0x20c3d0['id']}})['then'](function(){return _0x4e69f4;});})[_0x4118('0x21')](function(){_0x4b49b0[_0x4118('0x17')](0xcc)[_0x4118('0x25')]();});}};}function handleEntityNotFound(_0x2773b2,_0x35d809){return function(_0x36edea){if(!_0x36edea){_0x2773b2['sendStatus'](0x194);}return _0x36edea;};}function handleError(_0x138df2,_0x170a67){_0x170a67=_0x170a67||0x1f4;return function(_0x34507e){logger[_0x4118('0x26')](_0x34507e['stack']);if(_0x34507e['name']){delete _0x34507e[_0x4118('0x27')];}_0x138df2[_0x4118('0x17')](_0x170a67)[_0x4118('0x28')](_0x34507e);};}exports[_0x4118('0x29')]=function(_0x132e76,_0x5949c5){var _0x5f115e={},_0x2462d1={},_0x36f0c5={'count':0x0,'rows':[]};var _0x478598=_[_0x4118('0x2a')](db[_0x4118('0x2b')][_0x4118('0x2c')],function(_0x194dfa){return{'name':_0x194dfa[_0x4118('0x2d')],'type':_0x194dfa[_0x4118('0x2e')][_0x4118('0x2f')]};});_0x2462d1[_0x4118('0x30')]=_[_0x4118('0x2a')](_0x478598,_0x4118('0x27'));_0x2462d1[_0x4118('0x31')]=_[_0x4118('0x32')](_0x132e76[_0x4118('0x31')]);_0x2462d1[_0x4118('0x33')]=_[_0x4118('0x34')](_0x2462d1[_0x4118('0x30')],_0x2462d1['query']);_0x5f115e[_0x4118('0x35')]=_[_0x4118('0x34')](_0x2462d1[_0x4118('0x30')],qs[_0x4118('0x36')](_0x132e76[_0x4118('0x31')][_0x4118('0x36')]));_0x5f115e['attributes']=_0x5f115e[_0x4118('0x35')]['length']?_0x5f115e['attributes']:_0x2462d1[_0x4118('0x30')];if(!_0x132e76[_0x4118('0x31')]['hasOwnProperty'](_0x4118('0x37'))){_0x5f115e[_0x4118('0x38')]=qs[_0x4118('0x38')](_0x132e76['query'][_0x4118('0x38')]);_0x5f115e[_0x4118('0x1a')]=qs[_0x4118('0x1a')](_0x132e76['query']['offset']);}_0x5f115e[_0x4118('0x39')]=qs[_0x4118('0x3a')](_0x132e76[_0x4118('0x31')][_0x4118('0x3a')]);_0x5f115e[_0x4118('0x3b')]=qs[_0x4118('0x33')](_['pick'](_0x132e76[_0x4118('0x31')],_0x2462d1['filters']),_0x478598);if(_0x132e76['query'][_0x4118('0x3c')]){_0x5f115e['where']=_[_0x4118('0x3d')](_0x5f115e[_0x4118('0x3b')],{'$or':_[_0x4118('0x2a')](_0x478598,function(_0x509f1c){if(_0x509f1c[_0x4118('0x2e')]!==_0x4118('0x3e')){var _0x33db2c={};_0x33db2c[_0x509f1c[_0x4118('0x27')]]={'$like':'%'+_0x132e76[_0x4118('0x31')][_0x4118('0x3c')]+'%'};return _0x33db2c;}})});}_0x5f115e=_[_0x4118('0x3d')]({},_0x5f115e,_0x132e76[_0x4118('0x3f')]);var _0x485d0c={'where':_0x5f115e[_0x4118('0x3b')]};return db[_0x4118('0x2b')][_0x4118('0x19')](_0x485d0c)[_0x4118('0x21')](function(_0x25252c){_0x36f0c5[_0x4118('0x19')]=_0x25252c;if(_0x132e76[_0x4118('0x31')][_0x4118('0x40')]){_0x5f115e['include']=[{'all':!![]}];}return db[_0x4118('0x2b')]['findAll'](_0x5f115e);})[_0x4118('0x21')](function(_0x10cc8d){_0x36f0c5['rows']=_0x10cc8d;return _0x36f0c5;})['then'](respondWithFilteredResult(_0x5949c5,_0x5f115e))[_0x4118('0x41')](handleError(_0x5949c5,null));};exports[_0x4118('0x42')]=function(_0x3c929f,_0x2b24ac){var _0x5e72a1={'raw':!![],'where':{'id':_0x3c929f['params']['id']}},_0x47b72d={};_0x47b72d['model']=_[_0x4118('0x32')](db['FaxQueue'][_0x4118('0x2c')]);_0x47b72d[_0x4118('0x31')]=_[_0x4118('0x32')](_0x3c929f[_0x4118('0x31')]);_0x47b72d[_0x4118('0x33')]=_[_0x4118('0x34')](_0x47b72d['model'],_0x47b72d[_0x4118('0x31')]);_0x5e72a1[_0x4118('0x35')]=_[_0x4118('0x34')](_0x47b72d[_0x4118('0x30')],qs[_0x4118('0x36')](_0x3c929f[_0x4118('0x31')]['fields']));_0x5e72a1['attributes']=_0x5e72a1['attributes'][_0x4118('0x43')]?_0x5e72a1[_0x4118('0x35')]:_0x47b72d['model'];if(_0x3c929f[_0x4118('0x31')][_0x4118('0x40')]){_0x5e72a1[_0x4118('0x44')]=[{'all':!![]}];}_0x5e72a1=_[_0x4118('0x3d')]({},_0x5e72a1,_0x3c929f['options']);return db[_0x4118('0x2b')][_0x4118('0x45')](_0x5e72a1)[_0x4118('0x21')](handleEntityNotFound(_0x2b24ac,null))[_0x4118('0x21')](respondWithResult(_0x2b24ac,null))[_0x4118('0x41')](handleError(_0x2b24ac,null));};exports[_0x4118('0x46')]=function(_0x4421d6,_0x113f6d){return db[_0x4118('0x2b')][_0x4118('0x46')](_0x4421d6[_0x4118('0x47')],{})['then'](function(_0x5970e1){var _0x4a974b=_0x4421d6[_0x4118('0x48')][_0x4118('0x22')]({'plain':!![]});if(!_0x4a974b)throw new Error(_0x4118('0x49'));if(_0x4a974b[_0x4118('0x4a')]==='user'){var _0x1059f5=_0x5970e1[_0x4118('0x22')]({'plain':!![]});var _0x35254b=_0x4118('0x23');return db[_0x4118('0x4b')][_0x4118('0x45')]({'where':{'name':_0x35254b,'userProfileId':_0x4a974b[_0x4118('0x4c')]},'raw':!![]})[_0x4118('0x21')](function(_0x3f4dd7){if(_0x3f4dd7&&_0x3f4dd7[_0x4118('0x4d')]===0x0){return db[_0x4118('0x4e')]['create']({'name':_0x1059f5[_0x4118('0x27')],'resourceId':_0x1059f5['id'],'type':_0x3f4dd7[_0x4118('0x27')],'sectionId':_0x3f4dd7['id']},{})['then'](function(){return _0x5970e1;});}else{return _0x5970e1;}})[_0x4118('0x41')](function(_0x5e6b09){logger['error'](_0x4118('0x4f'),_0x5e6b09);throw _0x5e6b09;});}return _0x5970e1;})[_0x4118('0x21')](respondWithResult(_0x113f6d,0xc9))[_0x4118('0x41')](handleError(_0x113f6d,null));};exports['update']=function(_0x2e195c,_0x5377a8){if(_0x2e195c['body']['id']){delete _0x2e195c[_0x4118('0x47')]['id'];}return db['FaxQueue'][_0x4118('0x45')]({'where':{'id':_0x2e195c[_0x4118('0x50')]['id']}})[_0x4118('0x21')](handleEntityNotFound(_0x5377a8,null))['then'](saveUpdates(_0x2e195c[_0x4118('0x47')],null))['then'](respondWithResult(_0x5377a8,null))[_0x4118('0x41')](handleError(_0x5377a8,null));};exports['destroy']=function(_0x1c8ca3,_0x41a694){return db[_0x4118('0x2b')][_0x4118('0x45')]({'where':{'id':_0x1c8ca3[_0x4118('0x50')]['id']}})[_0x4118('0x21')](handleEntityNotFound(_0x41a694,null))[_0x4118('0x21')](removeEntity(_0x41a694,null))[_0x4118('0x41')](handleError(_0x41a694,null));};exports['describe']=function(_0x370cd4,_0x1d3317){return db['FaxQueue']['describe']()[_0x4118('0x21')](respondWithResult(_0x1d3317,null))['catch'](handleError(_0x1d3317,null));};exports['getMembers']=function(_0x5f34aa,_0x3be9e7,_0x52861a){var _0x4b4ed4={'raw':!![],'where':{}},_0xb4df93={},_0x1727a1;return db['FaxQueue'][_0x4118('0x51')]({'where':{'id':_0x5f34aa['params']['id']}})[_0x4118('0x21')](handleEntityNotFound(_0x3be9e7,null))['then'](function(_0x2c4e31){if(_0x2c4e31){_0x1727a1=_0x2c4e31['get']({'plain':!![]});_0xb4df93['model']=_[_0x4118('0x32')](db[_0x4118('0x52')]['rawAttributes']);_0xb4df93['query']=_['keys'](_0x5f34aa[_0x4118('0x31')]);_0xb4df93['filters']=_[_0x4118('0x34')](_0xb4df93[_0x4118('0x30')],_0xb4df93[_0x4118('0x31')]);_0x4b4ed4[_0x4118('0x35')]=_[_0x4118('0x34')](_0xb4df93[_0x4118('0x30')],qs[_0x4118('0x36')](_0x5f34aa[_0x4118('0x31')][_0x4118('0x36')]));_0x4b4ed4[_0x4118('0x35')]=_0x4b4ed4[_0x4118('0x35')][_0x4118('0x43')]?_0x4b4ed4[_0x4118('0x35')]:_0xb4df93[_0x4118('0x30')];if(!_0x5f34aa[_0x4118('0x31')][_0x4118('0x53')](_0x4118('0x37'))){_0x4b4ed4[_0x4118('0x38')]=qs['limit'](_0x5f34aa[_0x4118('0x31')]['limit']);_0x4b4ed4[_0x4118('0x1a')]=qs['offset'](_0x5f34aa[_0x4118('0x31')][_0x4118('0x1a')]);}_0x4b4ed4['order']=qs[_0x4118('0x3a')](_0x5f34aa['query']['sort']);_0x4b4ed4[_0x4118('0x3b')]=qs[_0x4118('0x33')](_['pick'](_0x5f34aa[_0x4118('0x31')],_0xb4df93[_0x4118('0x33')]));_0x4b4ed4[_0x4118('0x3b')][_0x4118('0x54')]=_0x2c4e31['id'];if(_0x5f34aa[_0x4118('0x31')][_0x4118('0x3c')]){_0x4b4ed4[_0x4118('0x3b')]=_['merge'](_0x4b4ed4[_0x4118('0x3b')],{'$or':_['map'](_0x4b4ed4[_0x4118('0x35')],function(_0x409318){var _0x939e05={};_0x939e05[_0x409318]={'$like':'%'+_0x5f34aa[_0x4118('0x31')][_0x4118('0x3c')]+'%'};return _0x939e05;})});}_0x4b4ed4=_[_0x4118('0x3d')]({},_0x4b4ed4,_0x5f34aa[_0x4118('0x3f')]);return db['UserFaxQueue']['findAll'](_0x4b4ed4);}})[_0x4118('0x21')](function(_0x2e31ed){if(_0x2e31ed){return db['User'][_0x4118('0x55')]({'where':{'id':_[_0x4118('0x2a')](_0x2e31ed,_0x4118('0x56')),'role':'agent'},'attributes':['id','name',_0x4118('0x57'),_0x4118('0x58'),_0x4118('0x59')]});}})[_0x4118('0x21')](function(_0x382bcf){if(_0x382bcf){return{'count':_0x382bcf[_0x4118('0x19')],'rows':_[_0x4118('0x2a')](_0x382bcf['rows'],function(_0x34013c){return{'membername':_0x34013c[_0x4118('0x27')],'UserId':_0x34013c['id'],'queue_name':_0x1727a1[_0x4118('0x27')],'FaxQueueId':_0x1727a1['id'],'interface':util[_0x4118('0x5a')](_0x4118('0x5b'),'SIP',_0x34013c[_0x4118('0x27')]),'penalty':0x0,'paused':_0x34013c[_0x4118('0x57')],'createdAt':_0x34013c[_0x4118('0x59')],'updatedAt':_0x34013c['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})[_0x4118('0x21')](respondWithFilteredResult(_0x3be9e7,_0x4b4ed4))['catch'](handleError(_0x3be9e7,null));};exports[_0x4118('0x5c')]=function(_0x383a9f,_0x459156,_0x4d3736){var _0x35571c={};var _0x5a2b27={};var _0x5e4ede;var _0x16b394;return db[_0x4118('0x2b')][_0x4118('0x51')]({'where':{'id':_0x383a9f[_0x4118('0x50')]['id']}})[_0x4118('0x21')](handleEntityNotFound(_0x459156,null))[_0x4118('0x21')](function(_0x41d036){if(_0x41d036){_0x5e4ede=_0x41d036;_0x5a2b27['model']=_[_0x4118('0x32')](db[_0x4118('0x5d')][_0x4118('0x2c')]);_0x5a2b27[_0x4118('0x31')]=_[_0x4118('0x32')](_0x383a9f[_0x4118('0x31')]);_0x5a2b27[_0x4118('0x33')]=_[_0x4118('0x34')](_0x5a2b27[_0x4118('0x30')],_0x5a2b27[_0x4118('0x31')]);_0x35571c['attributes']=_['intersection'](_0x5a2b27[_0x4118('0x30')],qs[_0x4118('0x36')](_0x383a9f[_0x4118('0x31')][_0x4118('0x36')]));_0x35571c[_0x4118('0x35')]=_0x35571c[_0x4118('0x35')]['length']?_0x35571c['attributes']:_0x5a2b27[_0x4118('0x30')];_0x35571c[_0x4118('0x39')]=qs[_0x4118('0x3a')](_0x383a9f[_0x4118('0x31')][_0x4118('0x3a')]);_0x35571c[_0x4118('0x3b')]=qs[_0x4118('0x33')](_[_0x4118('0x5e')](_0x383a9f['query'],_0x5a2b27['filters']));if(_0x383a9f['query'][_0x4118('0x3c')]){_0x35571c[_0x4118('0x3b')]=_[_0x4118('0x3d')](_0x35571c['where'],{'$or':_[_0x4118('0x2a')](_0x35571c[_0x4118('0x35')],function(_0x5932c1){var _0x2029d6={};_0x2029d6[_0x5932c1]={'$like':'%'+_0x383a9f['query'][_0x4118('0x3c')]+'%'};return _0x2029d6;})});}_0x35571c=_['merge']({},_0x35571c,_0x383a9f[_0x4118('0x3f')]);return _0x5e4ede['getTeams'](_0x35571c);}})['then'](function(_0x4b98bd){if(_0x4b98bd){_0x16b394=_0x4b98bd[_0x4118('0x43')];if(!_0x383a9f[_0x4118('0x31')]['hasOwnProperty'](_0x4118('0x37'))){_0x35571c[_0x4118('0x38')]=qs[_0x4118('0x38')](_0x383a9f[_0x4118('0x31')][_0x4118('0x38')]);_0x35571c[_0x4118('0x1a')]=qs[_0x4118('0x1a')](_0x383a9f[_0x4118('0x31')][_0x4118('0x1a')]);}return _0x5e4ede[_0x4118('0x5c')](_0x35571c);}})[_0x4118('0x21')](function(_0x39cfac){if(_0x39cfac){return _0x39cfac?{'count':_0x16b394,'rows':_0x39cfac}:null;}})[_0x4118('0x21')](respondWithResult(_0x459156,null))[_0x4118('0x41')](handleError(_0x459156,null));};exports[_0x4118('0x5f')]=function(_0x15bc79,_0xffcd9c,_0x4d4bd2){var _0x59f5c7=_0x15bc79[_0x4118('0x47')][_0x4118('0x60')];return db[_0x4118('0x5d')][_0x4118('0x61')]({'where':{'id':_0x59f5c7},'attributes':['id'],'include':[{'model':db[_0x4118('0x62')],'as':_0x4118('0x63'),'attributes':['id',_0x4118('0x27'),_0x4118('0x64'),'voicePause','interface'],'raw':!![]}]})[_0x4118('0x21')](function(_0x2ac388){if(_0x2ac388){var _0x5a08a7=_[_0x4118('0x65')](_0x2ac388,function(_0x58eb99){var _0x4bb857=_0x58eb99[_0x4118('0x22')]({'plain':!![]});return _0x4bb857['Agents'];});return db[_0x4118('0x2b')][_0x4118('0x45')]({'where':{'id':_0x15bc79[_0x4118('0x50')]['id']}})[_0x4118('0x21')](function(_0x29a17c){return db[_0x4118('0x66')][_0x4118('0x67')](function(_0x901b1){return _0x29a17c[_0x4118('0x5f')](_0x59f5c7,{'transaction':_0x901b1})[_0x4118('0x21')](function(){return BPromise['each'](_0x5a08a7,function(_0x47b0a0){return db[_0x4118('0x52')][_0x4118('0x68')]({'where':{'UserId':_0x47b0a0['id'],'FaxQueueId':_0x15bc79['params']['id']},'transaction':_0x901b1});});})['then'](function(){_0x5a08a7['forEach'](function(_0x317cad){socket[_0x4118('0x69')](_0x4118('0x6a'),{'UserId':_0x317cad['id'],'FaxQueueId':_0x29a17c['id']});});});});});}})[_0x4118('0x21')](respondWithStatusCode(_0xffcd9c,null))[_0x4118('0x41')](handleError(_0xffcd9c,null));};exports['removeTeams']=function(_0xdfb630,_0x5c35ef,_0x5e5812){return db['Team'][_0x4118('0x61')]({'where':{'id':_0xdfb630[_0x4118('0x31')]['ids']},'attributes':['id'],'include':[{'model':db[_0x4118('0x62')],'as':_0x4118('0x63'),'attributes':['id'],'raw':!![]}]})[_0x4118('0x21')](handleEntityNotFound(_0x5c35ef,null))[_0x4118('0x21')](function(_0x42c45d){var _0x237886=_[_0x4118('0x2a')](_0x42c45d,'id');var _0x3af3e8=[];var _0x4f8e5f=[];var _0x34be6e=squel['select']();_0x34be6e[_0x4118('0x6b')]('tq.TeamId')[_0x4118('0x6c')](_0x4118('0x6d'),'tq')[_0x4118('0x6e')]('user_has_teams','ut',_0x4118('0x6f'))[_0x4118('0x3b')]('FaxQueueId\x20=\x20?',_0xdfb630[_0x4118('0x50')]['id']);for(var _0x4f7426=0x0;_0x4f7426<_0x42c45d['length'];_0x4f7426+=0x1){let _0x11eb2d=_0x42c45d[_0x4f7426];for(var _0x407c74=0x0;_0x407c74<_0x11eb2d[_0x4118('0x63')][_0x4118('0x43')];_0x407c74+=0x1){let _0x25fa12=_0x11eb2d[_0x4118('0x63')][_0x407c74];var _0x58c464=_0x34be6e[_0x4118('0x70')]();_0x58c464[_0x4118('0x3b')]('ut.UserId\x20=\x20?',_0x25fa12['id']);_0x4f8e5f['push'](db[_0x4118('0x66')][_0x4118('0x31')](_0x58c464[_0x4118('0x71')](),{'type':db[_0x4118('0x66')][_0x4118('0x72')][_0x4118('0x73')]})['then'](function(_0x5f479d){if(_0x5f479d['length']===0x1){return _0x25fa12['id'];}else{var _0x33bad0=_['every'](_['map'](_0x5f479d,_0x4118('0x74')),function(_0x17356d){return _[_0x4118('0x75')](_0x237886,_0x17356d);});if(_0x33bad0){return _0x25fa12['id'];}}}));}}return BPromise['all'](_0x4f8e5f)[_0x4118('0x21')](function(_0x1581b1){_0x3af3e8=_(_0x3af3e8)[_0x4118('0x76')](_0x1581b1)[_0x4118('0x77')]()['value']();return db[_0x4118('0x2b')][_0x4118('0x45')]({'where':{'id':_0xdfb630['params']['id']}})[_0x4118('0x21')](function(_0x4a1b75){return db['sequelize']['transaction'](function(_0xac2f61){return _0x4a1b75[_0x4118('0x78')](_0xdfb630[_0x4118('0x31')][_0x4118('0x60')],{'transaction':_0xac2f61})[_0x4118('0x21')](function(){if(!_[_0x4118('0x79')](_0x3af3e8)){return _0x4a1b75[_0x4118('0x7a')](_0x3af3e8,{'transaction':_0xac2f61});}})[_0x4118('0x21')](function(){_0x3af3e8[_0x4118('0x7b')](function(_0x4b590f){socket[_0x4118('0x69')]('userFaxQueue:remove',{'UserId':_0x4b590f,'FaxQueueId':_0x4a1b75['id']});});});});});});})[_0x4118('0x21')](respondWithStatusCode(_0x5c35ef,null))['catch'](handleError(_0x5c35ef,null));};exports[_0x4118('0x7c')]=function(_0x5dbedd,_0xa3682f,_0x224ca2){return db[_0x4118('0x2b')][_0x4118('0x45')]({'where':{'id':_0x5dbedd[_0x4118('0x50')]['id']}})[_0x4118('0x21')](handleEntityNotFound(_0xa3682f,null))[_0x4118('0x21')](function(_0x4ba3f0){if(_0x4ba3f0){return _0x4ba3f0['addAgents'](_0x5dbedd[_0x4118('0x47')][_0x4118('0x60')],_['omit'](_0x5dbedd[_0x4118('0x47')],[_0x4118('0x60'),'id'])||{})['spread'](function(_0x2174c4){for(var _0x2c48c6=0x0;_0x2c48c6<_0x5dbedd[_0x4118('0x47')][_0x4118('0x60')][_0x4118('0x43')];_0x2c48c6+=0x1){socket[_0x4118('0x69')]('userFaxQueue:save',{'UserId':_0x5dbedd[_0x4118('0x47')][_0x4118('0x60')][_0x2c48c6],'FaxQueueId':_0x5dbedd[_0x4118('0x50')]['id']});}return _0x2174c4;});}})[_0x4118('0x21')](respondWithResult(_0xa3682f,null))['catch'](handleError(_0xa3682f,null));};exports[_0x4118('0x7a')]=function(_0x19f6ab,_0x2c84e6,_0x58ca6d){return db[_0x4118('0x2b')][_0x4118('0x45')]({'where':{'id':_0x19f6ab[_0x4118('0x50')]['id']}})[_0x4118('0x21')](handleEntityNotFound(_0x2c84e6,null))[_0x4118('0x21')](function(_0xe4a39a){if(_0xe4a39a){return _0xe4a39a[_0x4118('0x7a')](_0x19f6ab[_0x4118('0x31')]['ids'])[_0x4118('0x21')](function(){if(_['isArray'](_0x19f6ab[_0x4118('0x31')][_0x4118('0x60')])){for(var _0x4f53e8=0x0;_0x4f53e8<_0x19f6ab[_0x4118('0x31')][_0x4118('0x60')][_0x4118('0x43')];_0x4f53e8+=0x1){socket[_0x4118('0x69')](_0x4118('0x7d'),{'UserId':Number(_0x19f6ab[_0x4118('0x31')][_0x4118('0x60')][_0x4f53e8]),'FaxQueueId':Number(_0x19f6ab[_0x4118('0x50')]['id'])});}}else{socket[_0x4118('0x69')]('userFaxQueue:remove',{'UserId':Number(_0x19f6ab[_0x4118('0x31')][_0x4118('0x60')]),'FaxQueueId':Number(_0x19f6ab[_0x4118('0x50')]['id'])});}});}})[_0x4118('0x21')](respondWithStatusCode(_0x2c84e6,null))[_0x4118('0x41')](handleError(_0x2c84e6,null));};exports[_0x4118('0x7e')]=function(_0x211775,_0x4bab3f,_0x1a7874){var _0x5e1fff={};var _0x1c9b71={};var _0x285a54;var _0x256242;return db['FaxQueue'][_0x4118('0x51')]({'where':{'id':_0x211775[_0x4118('0x50')]['id']}})['then'](handleEntityNotFound(_0x4bab3f,null))[_0x4118('0x21')](function(_0x12a171){if(_0x12a171){_0x285a54=_0x12a171;_0x1c9b71[_0x4118('0x30')]=_[_0x4118('0x32')](db[_0x4118('0x62')][_0x4118('0x2c')]);_0x1c9b71['query']=_[_0x4118('0x32')](_0x211775[_0x4118('0x31')]);_0x1c9b71[_0x4118('0x33')]=_['intersection'](_0x1c9b71['model'],_0x1c9b71[_0x4118('0x31')]);_0x5e1fff['attributes']=_['intersection'](_0x1c9b71[_0x4118('0x30')],qs[_0x4118('0x36')](_0x211775[_0x4118('0x31')]['fields']));_0x5e1fff[_0x4118('0x35')]=_0x5e1fff[_0x4118('0x35')][_0x4118('0x43')]?_0x5e1fff[_0x4118('0x35')]:_0x1c9b71[_0x4118('0x30')];_0x5e1fff['order']=qs[_0x4118('0x3a')](_0x211775[_0x4118('0x31')]['sort']);_0x5e1fff[_0x4118('0x3b')]=qs['filters'](_[_0x4118('0x5e')](_0x211775[_0x4118('0x31')],_0x1c9b71['filters']));if(_0x211775[_0x4118('0x31')][_0x4118('0x3c')]){_0x5e1fff['where']=_[_0x4118('0x3d')](_0x5e1fff['where'],{'$or':_['map'](_0x5e1fff[_0x4118('0x35')],function(_0x3b168b){var _0x8f9ff={};_0x8f9ff[_0x3b168b]={'$like':'%'+_0x211775['query']['filter']+'%'};return _0x8f9ff;})});}_0x5e1fff=_['merge']({},_0x5e1fff,_0x211775[_0x4118('0x3f')]);return _0x285a54[_0x4118('0x7e')](_0x5e1fff);}})['then'](function(_0x5b55fd){if(_0x5b55fd){_0x256242=_0x5b55fd[_0x4118('0x43')];if(!_0x211775['query'][_0x4118('0x53')](_0x4118('0x37'))){_0x5e1fff[_0x4118('0x38')]=qs[_0x4118('0x38')](_0x211775[_0x4118('0x31')][_0x4118('0x38')]);_0x5e1fff[_0x4118('0x1a')]=qs[_0x4118('0x1a')](_0x211775[_0x4118('0x31')][_0x4118('0x1a')]);}return _0x285a54[_0x4118('0x7e')](_0x5e1fff);}})[_0x4118('0x21')](function(_0x501ffa){if(_0x501ffa){return _0x501ffa?{'count':_0x256242,'rows':_0x501ffa}:null;}})['then'](respondWithResult(_0x4bab3f,null))[_0x4118('0x41')](handleError(_0x4bab3f,null));}; \ No newline at end of file +var _0x35c0=['util','path','sox','to-csv','ejs','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','sendStatus','status','end','json','count','offset','limit','set','Content-Range','reject','save','update','then','get','FaxQueues','UserProfileResource','destroy','error','stack','name','send','index','map','FaxQueue','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','fields','attributes','length','nolimit','sort','where','filter','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','getMembers','UserFaxQueue','order','User','findAndCountAll','UserId','agent','faxPause','updatedAt','createdAt','format','SIP','getTeams','Team','pick','addTeams','ids','Agents','online','voicePause','interface','flatMap','sequelize','transaction','findOrCreate','forEach','emit','removeTeams','from','team_has_fax_queues','join','user_has_teams','clone','ut.UserId\x20=\x20?','push','toString','QueryTypes','SELECT','every','TeamId','includes','all','union','value','removeAgents','userFaxQueue:remove','omit','spread','userFaxQueue:save','getAgents','hasOwnProperty','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache'];(function(_0x3d7b31,_0x173c74){var _0xc5a32f=function(_0x5cd0f9){while(--_0x5cd0f9){_0x3d7b31['push'](_0x3d7b31['shift']());}};_0xc5a32f(++_0x173c74);}(_0x35c0,0x10d));var _0x035c=function(_0x60878f,_0x1166d3){_0x60878f=_0x60878f-0x0;var _0x1fbefb=_0x35c0[_0x60878f];return _0x1fbefb;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x035c('0x0'));var rimraf=require(_0x035c('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x035c('0x2'));var rp=require(_0x035c('0x3'));var moment=require(_0x035c('0x4'));var BPromise=require(_0x035c('0x5'));var Mustache=require(_0x035c('0x6'));var util=require(_0x035c('0x7'));var path=require(_0x035c('0x8'));var sox=require(_0x035c('0x9'));var csv=require(_0x035c('0xa'));var ejs=require(_0x035c('0xb'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0x035c('0xc'));var jsforce=require(_0x035c('0xd'));var deskjs=require(_0x035c('0xe'));var toCsv=require(_0x035c('0xa'));var querystring=require('querystring');var Papa=require(_0x035c('0xf'));var Redis=require(_0x035c('0x10'));var authService=require(_0x035c('0x11'));var qs=require(_0x035c('0x12'));var as=require(_0x035c('0x13'));var hardwareService=require(_0x035c('0x14'));var logger=require(_0x035c('0x15'))(_0x035c('0x16'));var utils=require(_0x035c('0x17'));var config=require(_0x035c('0x18'));var db=require(_0x035c('0x19'))['db'];config[_0x035c('0x1a')]=_[_0x035c('0x1b')](config[_0x035c('0x1a')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require('./faxQueue.socket')['register'](socket);function respondWithStatusCode(_0xcf7f6f,_0x12c503){_0x12c503=_0x12c503||0xcc;return function(_0x447234){if(_0x447234){return _0xcf7f6f[_0x035c('0x1c')](_0x12c503);}return _0xcf7f6f[_0x035c('0x1d')](_0x12c503)[_0x035c('0x1e')]();};}function respondWithResult(_0x452f28,_0x341fdf){_0x341fdf=_0x341fdf||0xc8;return function(_0x196fc6){if(_0x196fc6){return _0x452f28[_0x035c('0x1d')](_0x341fdf)[_0x035c('0x1f')](_0x196fc6);}};}function respondWithFilteredResult(_0x5988e8,_0x5d4b32){return function(_0x308937){if(_0x308937){var _0x58c80e=_0x308937[_0x035c('0x20')],_0x264dc1=_0x5d4b32[_0x035c('0x21')],_0x2c521a=_0x5d4b32['offset']+_0x5d4b32[_0x035c('0x22')],_0x273236;if(_0x2c521a>=_0x58c80e){_0x2c521a=_0x58c80e;_0x273236=0xc8;}else{_0x273236=0xce;}_0x5988e8[_0x035c('0x1d')](_0x273236);return _0x5988e8[_0x035c('0x23')](_0x035c('0x24'),_0x264dc1+'-'+_0x2c521a+'/'+_0x58c80e)[_0x035c('0x1f')](_0x308937);}return null;};}function patchUpdates(_0x43f521){return function(_0x489e29){try{jsonpatch['apply'](_0x489e29,_0x43f521,!![]);}catch(_0x118d78){return BPromise[_0x035c('0x25')](_0x118d78);}return _0x489e29[_0x035c('0x26')]();};}function saveUpdates(_0x45d850,_0x2627ff){return function(_0x38ba37){if(_0x38ba37){return _0x38ba37[_0x035c('0x27')](_0x45d850)[_0x035c('0x28')](function(_0x8bbdc9){return _0x8bbdc9;});}return null;};}function removeEntity(_0x4944ec,_0x5d4002){return function(_0x54b581){if(_0x54b581){return _0x54b581['destroy']()[_0x035c('0x28')](function(){var _0x540157=_0x54b581[_0x035c('0x29')]({'plain':!![]});var _0x190c08=_0x035c('0x2a');return db[_0x035c('0x2b')][_0x035c('0x2c')]({'where':{'type':_0x190c08,'resourceId':_0x540157['id']}})['then'](function(){return _0x54b581;});})[_0x035c('0x28')](function(){_0x4944ec['status'](0xcc)[_0x035c('0x1e')]();});}};}function handleEntityNotFound(_0x3988d6,_0x59d918){return function(_0x3e72c5){if(!_0x3e72c5){_0x3988d6[_0x035c('0x1c')](0x194);}return _0x3e72c5;};}function handleError(_0x5ccb3f,_0x2a58e8){_0x2a58e8=_0x2a58e8||0x1f4;return function(_0x4591db){logger[_0x035c('0x2d')](_0x4591db[_0x035c('0x2e')]);if(_0x4591db[_0x035c('0x2f')]){delete _0x4591db[_0x035c('0x2f')];}_0x5ccb3f[_0x035c('0x1d')](_0x2a58e8)[_0x035c('0x30')](_0x4591db);};}exports[_0x035c('0x31')]=function(_0x5d9b66,_0x51737b){var _0x3c6d99={},_0xdc2553={},_0x3b2761={'count':0x0,'rows':[]};var _0x7b82e7=_[_0x035c('0x32')](db[_0x035c('0x33')][_0x035c('0x34')],function(_0x417ea3){return{'name':_0x417ea3[_0x035c('0x35')],'type':_0x417ea3[_0x035c('0x36')][_0x035c('0x37')]};});_0xdc2553[_0x035c('0x38')]=_[_0x035c('0x32')](_0x7b82e7,'name');_0xdc2553['query']=_[_0x035c('0x39')](_0x5d9b66[_0x035c('0x3a')]);_0xdc2553[_0x035c('0x3b')]=_['intersection'](_0xdc2553['model'],_0xdc2553[_0x035c('0x3a')]);_0x3c6d99['attributes']=_[_0x035c('0x3c')](_0xdc2553[_0x035c('0x38')],qs['fields'](_0x5d9b66['query'][_0x035c('0x3d')]));_0x3c6d99[_0x035c('0x3e')]=_0x3c6d99[_0x035c('0x3e')][_0x035c('0x3f')]?_0x3c6d99[_0x035c('0x3e')]:_0xdc2553[_0x035c('0x38')];if(!_0x5d9b66[_0x035c('0x3a')]['hasOwnProperty'](_0x035c('0x40'))){_0x3c6d99[_0x035c('0x22')]=qs[_0x035c('0x22')](_0x5d9b66['query'][_0x035c('0x22')]);_0x3c6d99['offset']=qs[_0x035c('0x21')](_0x5d9b66[_0x035c('0x3a')][_0x035c('0x21')]);}_0x3c6d99['order']=qs[_0x035c('0x41')](_0x5d9b66[_0x035c('0x3a')][_0x035c('0x41')]);_0x3c6d99[_0x035c('0x42')]=qs[_0x035c('0x3b')](_['pick'](_0x5d9b66['query'],_0xdc2553[_0x035c('0x3b')]),_0x7b82e7);if(_0x5d9b66[_0x035c('0x3a')][_0x035c('0x43')]){_0x3c6d99[_0x035c('0x42')]=_['merge'](_0x3c6d99[_0x035c('0x42')],{'$or':_['map'](_0x7b82e7,function(_0x52d5bd){if(_0x52d5bd[_0x035c('0x36')]!==_0x035c('0x44')){var _0x3b8c28={};_0x3b8c28[_0x52d5bd[_0x035c('0x2f')]]={'$like':'%'+_0x5d9b66[_0x035c('0x3a')][_0x035c('0x43')]+'%'};return _0x3b8c28;}})});}_0x3c6d99=_[_0x035c('0x45')]({},_0x3c6d99,_0x5d9b66[_0x035c('0x46')]);var _0x26c90e={'where':_0x3c6d99[_0x035c('0x42')]};return db['FaxQueue'][_0x035c('0x20')](_0x26c90e)[_0x035c('0x28')](function(_0x505a09){_0x3b2761[_0x035c('0x20')]=_0x505a09;if(_0x5d9b66[_0x035c('0x3a')][_0x035c('0x47')]){_0x3c6d99[_0x035c('0x48')]=[{'all':!![]}];}return db[_0x035c('0x33')][_0x035c('0x49')](_0x3c6d99);})[_0x035c('0x28')](function(_0x56f832){_0x3b2761[_0x035c('0x4a')]=_0x56f832;return _0x3b2761;})[_0x035c('0x28')](respondWithFilteredResult(_0x51737b,_0x3c6d99))[_0x035c('0x4b')](handleError(_0x51737b,null));};exports[_0x035c('0x4c')]=function(_0x3fd504,_0xc8755c){var _0x262054={'raw':!![],'where':{'id':_0x3fd504[_0x035c('0x4d')]['id']}},_0x32b5ab={};_0x32b5ab[_0x035c('0x38')]=_[_0x035c('0x39')](db[_0x035c('0x33')][_0x035c('0x34')]);_0x32b5ab[_0x035c('0x3a')]=_[_0x035c('0x39')](_0x3fd504[_0x035c('0x3a')]);_0x32b5ab[_0x035c('0x3b')]=_['intersection'](_0x32b5ab['model'],_0x32b5ab[_0x035c('0x3a')]);_0x262054[_0x035c('0x3e')]=_[_0x035c('0x3c')](_0x32b5ab[_0x035c('0x38')],qs[_0x035c('0x3d')](_0x3fd504[_0x035c('0x3a')][_0x035c('0x3d')]));_0x262054[_0x035c('0x3e')]=_0x262054['attributes'][_0x035c('0x3f')]?_0x262054[_0x035c('0x3e')]:_0x32b5ab[_0x035c('0x38')];if(_0x3fd504[_0x035c('0x3a')][_0x035c('0x47')]){_0x262054[_0x035c('0x48')]=[{'all':!![]}];}_0x262054=_[_0x035c('0x45')]({},_0x262054,_0x3fd504[_0x035c('0x46')]);return db[_0x035c('0x33')][_0x035c('0x4e')](_0x262054)['then'](handleEntityNotFound(_0xc8755c,null))[_0x035c('0x28')](respondWithResult(_0xc8755c,null))['catch'](handleError(_0xc8755c,null));};exports['create']=function(_0x13cb65,_0xe1c824){return db[_0x035c('0x33')][_0x035c('0x4f')](_0x13cb65[_0x035c('0x50')],{})['then'](function(_0x1b27c8){var _0x2c6cd7=_0x13cb65[_0x035c('0x51')][_0x035c('0x29')]({'plain':!![]});if(!_0x2c6cd7)throw new Error(_0x035c('0x52'));if(_0x2c6cd7[_0x035c('0x53')]==='user'){var _0x32bc84=_0x1b27c8['get']({'plain':!![]});var _0x2d47fc=_0x035c('0x2a');return db[_0x035c('0x54')][_0x035c('0x4e')]({'where':{'name':_0x2d47fc,'userProfileId':_0x2c6cd7[_0x035c('0x55')]},'raw':!![]})[_0x035c('0x28')](function(_0x4042e2){if(_0x4042e2&&_0x4042e2[_0x035c('0x56')]===0x0){return db[_0x035c('0x2b')][_0x035c('0x4f')]({'name':_0x32bc84[_0x035c('0x2f')],'resourceId':_0x32bc84['id'],'type':_0x4042e2['name'],'sectionId':_0x4042e2['id']},{})[_0x035c('0x28')](function(){return _0x1b27c8;});}else{return _0x1b27c8;}})[_0x035c('0x4b')](function(_0x6db39c){logger[_0x035c('0x2d')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x6db39c);throw _0x6db39c;});}return _0x1b27c8;})[_0x035c('0x28')](respondWithResult(_0xe1c824,0xc9))[_0x035c('0x4b')](handleError(_0xe1c824,null));};exports['update']=function(_0x523161,_0x2be6db){if(_0x523161[_0x035c('0x50')]['id']){delete _0x523161[_0x035c('0x50')]['id'];}return db[_0x035c('0x33')][_0x035c('0x4e')]({'where':{'id':_0x523161[_0x035c('0x4d')]['id']}})['then'](handleEntityNotFound(_0x2be6db,null))[_0x035c('0x28')](saveUpdates(_0x523161[_0x035c('0x50')],null))[_0x035c('0x28')](respondWithResult(_0x2be6db,null))[_0x035c('0x4b')](handleError(_0x2be6db,null));};exports['destroy']=function(_0x2ae327,_0x43e2cc){return db[_0x035c('0x33')][_0x035c('0x4e')]({'where':{'id':_0x2ae327[_0x035c('0x4d')]['id']}})['then'](handleEntityNotFound(_0x43e2cc,null))[_0x035c('0x28')](removeEntity(_0x43e2cc,null))[_0x035c('0x4b')](handleError(_0x43e2cc,null));};exports['describe']=function(_0x39be24,_0x5d4abe){return db[_0x035c('0x33')]['describe']()[_0x035c('0x28')](respondWithResult(_0x5d4abe,null))[_0x035c('0x4b')](handleError(_0x5d4abe,null));};exports[_0x035c('0x57')]=function(_0x40ae3d,_0x1ed68f,_0x3485d1){var _0x272681={'raw':!![],'where':{}},_0x1eb58b={},_0x130f1d;return db[_0x035c('0x33')]['findOne']({'where':{'id':_0x40ae3d[_0x035c('0x4d')]['id']}})[_0x035c('0x28')](handleEntityNotFound(_0x1ed68f,null))['then'](function(_0x2f9b80){if(_0x2f9b80){_0x130f1d=_0x2f9b80[_0x035c('0x29')]({'plain':!![]});_0x1eb58b[_0x035c('0x38')]=_['keys'](db[_0x035c('0x58')][_0x035c('0x34')]);_0x1eb58b[_0x035c('0x3a')]=_[_0x035c('0x39')](_0x40ae3d['query']);_0x1eb58b['filters']=_['intersection'](_0x1eb58b[_0x035c('0x38')],_0x1eb58b[_0x035c('0x3a')]);_0x272681[_0x035c('0x3e')]=_[_0x035c('0x3c')](_0x1eb58b['model'],qs[_0x035c('0x3d')](_0x40ae3d[_0x035c('0x3a')][_0x035c('0x3d')]));_0x272681['attributes']=_0x272681['attributes'][_0x035c('0x3f')]?_0x272681[_0x035c('0x3e')]:_0x1eb58b[_0x035c('0x38')];if(!_0x40ae3d[_0x035c('0x3a')]['hasOwnProperty'](_0x035c('0x40'))){_0x272681['limit']=qs['limit'](_0x40ae3d[_0x035c('0x3a')][_0x035c('0x22')]);_0x272681[_0x035c('0x21')]=qs[_0x035c('0x21')](_0x40ae3d[_0x035c('0x3a')][_0x035c('0x21')]);}_0x272681[_0x035c('0x59')]=qs['sort'](_0x40ae3d[_0x035c('0x3a')][_0x035c('0x41')]);_0x272681[_0x035c('0x42')]=qs['filters'](_['pick'](_0x40ae3d[_0x035c('0x3a')],_0x1eb58b[_0x035c('0x3b')]));_0x272681[_0x035c('0x42')]['FaxQueueId']=_0x2f9b80['id'];if(_0x40ae3d['query'][_0x035c('0x43')]){_0x272681[_0x035c('0x42')]=_[_0x035c('0x45')](_0x272681[_0x035c('0x42')],{'$or':_[_0x035c('0x32')](_0x272681[_0x035c('0x3e')],function(_0x12fa05){var _0x23d23a={};_0x23d23a[_0x12fa05]={'$like':'%'+_0x40ae3d['query'][_0x035c('0x43')]+'%'};return _0x23d23a;})});}_0x272681=_[_0x035c('0x45')]({},_0x272681,_0x40ae3d[_0x035c('0x46')]);return db[_0x035c('0x58')][_0x035c('0x49')](_0x272681);}})[_0x035c('0x28')](function(_0x23044f){if(_0x23044f){return db[_0x035c('0x5a')][_0x035c('0x5b')]({'where':{'id':_[_0x035c('0x32')](_0x23044f,_0x035c('0x5c')),'role':_0x035c('0x5d')},'attributes':['id',_0x035c('0x2f'),_0x035c('0x5e'),_0x035c('0x5f'),_0x035c('0x60')]});}})[_0x035c('0x28')](function(_0x46a5af){if(_0x46a5af){return{'count':_0x46a5af['count'],'rows':_[_0x035c('0x32')](_0x46a5af[_0x035c('0x4a')],function(_0x171b46){return{'membername':_0x171b46[_0x035c('0x2f')],'UserId':_0x171b46['id'],'queue_name':_0x130f1d[_0x035c('0x2f')],'FaxQueueId':_0x130f1d['id'],'interface':util[_0x035c('0x61')]('%s/%s',_0x035c('0x62'),_0x171b46[_0x035c('0x2f')]),'penalty':0x0,'paused':_0x171b46[_0x035c('0x5e')],'createdAt':_0x171b46[_0x035c('0x60')],'updatedAt':_0x171b46[_0x035c('0x5f')]};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x1ed68f,_0x272681))[_0x035c('0x4b')](handleError(_0x1ed68f,null));};exports[_0x035c('0x63')]=function(_0x2bf3d4,_0x405ab7,_0x5a1ca4){var _0x515097={};var _0x21577f={};var _0x3a9ac5;var _0x5bb73a;return db[_0x035c('0x33')]['findOne']({'where':{'id':_0x2bf3d4[_0x035c('0x4d')]['id']}})[_0x035c('0x28')](handleEntityNotFound(_0x405ab7,null))[_0x035c('0x28')](function(_0x39905c){if(_0x39905c){_0x3a9ac5=_0x39905c;_0x21577f[_0x035c('0x38')]=_[_0x035c('0x39')](db[_0x035c('0x64')][_0x035c('0x34')]);_0x21577f[_0x035c('0x3a')]=_['keys'](_0x2bf3d4[_0x035c('0x3a')]);_0x21577f[_0x035c('0x3b')]=_[_0x035c('0x3c')](_0x21577f[_0x035c('0x38')],_0x21577f[_0x035c('0x3a')]);_0x515097[_0x035c('0x3e')]=_[_0x035c('0x3c')](_0x21577f[_0x035c('0x38')],qs['fields'](_0x2bf3d4['query']['fields']));_0x515097[_0x035c('0x3e')]=_0x515097[_0x035c('0x3e')][_0x035c('0x3f')]?_0x515097[_0x035c('0x3e')]:_0x21577f['model'];_0x515097[_0x035c('0x59')]=qs[_0x035c('0x41')](_0x2bf3d4[_0x035c('0x3a')][_0x035c('0x41')]);_0x515097[_0x035c('0x42')]=qs[_0x035c('0x3b')](_[_0x035c('0x65')](_0x2bf3d4['query'],_0x21577f[_0x035c('0x3b')]));if(_0x2bf3d4[_0x035c('0x3a')][_0x035c('0x43')]){_0x515097[_0x035c('0x42')]=_[_0x035c('0x45')](_0x515097[_0x035c('0x42')],{'$or':_[_0x035c('0x32')](_0x515097['attributes'],function(_0x39516f){var _0x18c5ec={};_0x18c5ec[_0x39516f]={'$like':'%'+_0x2bf3d4[_0x035c('0x3a')][_0x035c('0x43')]+'%'};return _0x18c5ec;})});}_0x515097=_['merge']({},_0x515097,_0x2bf3d4[_0x035c('0x46')]);return _0x3a9ac5[_0x035c('0x63')](_0x515097);}})[_0x035c('0x28')](function(_0x1fb7a7){if(_0x1fb7a7){_0x5bb73a=_0x1fb7a7['length'];if(!_0x2bf3d4[_0x035c('0x3a')]['hasOwnProperty'](_0x035c('0x40'))){_0x515097['limit']=qs[_0x035c('0x22')](_0x2bf3d4[_0x035c('0x3a')][_0x035c('0x22')]);_0x515097[_0x035c('0x21')]=qs[_0x035c('0x21')](_0x2bf3d4[_0x035c('0x3a')][_0x035c('0x21')]);}return _0x3a9ac5[_0x035c('0x63')](_0x515097);}})[_0x035c('0x28')](function(_0x552118){if(_0x552118){return _0x552118?{'count':_0x5bb73a,'rows':_0x552118}:null;}})['then'](respondWithResult(_0x405ab7,null))[_0x035c('0x4b')](handleError(_0x405ab7,null));};exports[_0x035c('0x66')]=function(_0x48ecf3,_0x58b716,_0x30ed86){var _0x1f3eb5=_0x48ecf3[_0x035c('0x50')][_0x035c('0x67')];return db[_0x035c('0x64')][_0x035c('0x49')]({'where':{'id':_0x1f3eb5},'attributes':['id'],'include':[{'model':db[_0x035c('0x5a')],'as':_0x035c('0x68'),'attributes':['id',_0x035c('0x2f'),_0x035c('0x69'),_0x035c('0x6a'),_0x035c('0x6b')],'raw':!![]}]})[_0x035c('0x28')](function(_0x13d697){if(_0x13d697){var _0x44d87c=_[_0x035c('0x6c')](_0x13d697,function(_0x5e3133){var _0x5c8dbd=_0x5e3133[_0x035c('0x29')]({'plain':!![]});return _0x5c8dbd['Agents'];});return db[_0x035c('0x33')][_0x035c('0x4e')]({'where':{'id':_0x48ecf3[_0x035c('0x4d')]['id']}})['then'](function(_0x587705){return db[_0x035c('0x6d')][_0x035c('0x6e')](function(_0x20fd3a){return _0x587705[_0x035c('0x66')](_0x1f3eb5,{'transaction':_0x20fd3a})['then'](function(){return BPromise['each'](_0x44d87c,function(_0x793434){return db['UserFaxQueue'][_0x035c('0x6f')]({'where':{'UserId':_0x793434['id'],'FaxQueueId':_0x48ecf3[_0x035c('0x4d')]['id']},'transaction':_0x20fd3a});});})[_0x035c('0x28')](function(){_0x44d87c[_0x035c('0x70')](function(_0x2a6134){socket[_0x035c('0x71')]('userFaxQueue:save',{'UserId':_0x2a6134['id'],'FaxQueueId':_0x587705['id']});});});});});}})[_0x035c('0x28')](respondWithStatusCode(_0x58b716,null))['catch'](handleError(_0x58b716,null));};exports[_0x035c('0x72')]=function(_0x1cdf5d,_0x19ed57,_0x537249){return db[_0x035c('0x64')][_0x035c('0x49')]({'where':{'id':_0x1cdf5d[_0x035c('0x3a')][_0x035c('0x67')]},'attributes':['id'],'include':[{'model':db[_0x035c('0x5a')],'as':_0x035c('0x68'),'attributes':['id'],'raw':!![]}]})[_0x035c('0x28')](handleEntityNotFound(_0x19ed57,null))[_0x035c('0x28')](function(_0x1704a1){var _0x823f2a=_[_0x035c('0x32')](_0x1704a1,'id');var _0xb760e6=[];var _0x2ca079=[];var _0x45133a=squel['select']();_0x45133a['field']('tq.TeamId')[_0x035c('0x73')](_0x035c('0x74'),'tq')[_0x035c('0x75')](_0x035c('0x76'),'ut','ut.TeamId\x20=\x20tq.TeamId')['where']('FaxQueueId\x20=\x20?',_0x1cdf5d[_0x035c('0x4d')]['id']);for(var _0x54fdba=0x0;_0x54fdba<_0x1704a1[_0x035c('0x3f')];_0x54fdba+=0x1){let _0x41228f=_0x1704a1[_0x54fdba];for(var _0x7e9466=0x0;_0x7e9466<_0x41228f[_0x035c('0x68')][_0x035c('0x3f')];_0x7e9466+=0x1){let _0x46bb1f=_0x41228f['Agents'][_0x7e9466];var _0x37b7b2=_0x45133a[_0x035c('0x77')]();_0x37b7b2[_0x035c('0x42')](_0x035c('0x78'),_0x46bb1f['id']);_0x2ca079[_0x035c('0x79')](db['sequelize'][_0x035c('0x3a')](_0x37b7b2[_0x035c('0x7a')](),{'type':db[_0x035c('0x6d')][_0x035c('0x7b')][_0x035c('0x7c')]})[_0x035c('0x28')](function(_0x2d4124){if(_0x2d4124[_0x035c('0x3f')]===0x1){return _0x46bb1f['id'];}else{var _0x4e527c=_[_0x035c('0x7d')](_[_0x035c('0x32')](_0x2d4124,_0x035c('0x7e')),function(_0xb68049){return _[_0x035c('0x7f')](_0x823f2a,_0xb68049);});if(_0x4e527c){return _0x46bb1f['id'];}}}));}}return BPromise[_0x035c('0x80')](_0x2ca079)[_0x035c('0x28')](function(_0x5c4cc1){_0xb760e6=_(_0xb760e6)[_0x035c('0x81')](_0x5c4cc1)['compact']()[_0x035c('0x82')]();return db['FaxQueue'][_0x035c('0x4e')]({'where':{'id':_0x1cdf5d[_0x035c('0x4d')]['id']}})[_0x035c('0x28')](function(_0x1a7e5c){return db[_0x035c('0x6d')][_0x035c('0x6e')](function(_0xdb4f17){return _0x1a7e5c[_0x035c('0x72')](_0x1cdf5d[_0x035c('0x3a')][_0x035c('0x67')],{'transaction':_0xdb4f17})[_0x035c('0x28')](function(){if(!_['isEmpty'](_0xb760e6)){return _0x1a7e5c[_0x035c('0x83')](_0xb760e6,{'transaction':_0xdb4f17});}})['then'](function(){_0xb760e6[_0x035c('0x70')](function(_0x304cd2){socket[_0x035c('0x71')](_0x035c('0x84'),{'UserId':_0x304cd2,'FaxQueueId':_0x1a7e5c['id']});});});});});});})[_0x035c('0x28')](respondWithStatusCode(_0x19ed57,null))['catch'](handleError(_0x19ed57,null));};exports['addAgents']=function(_0x51a815,_0x4f0100,_0x14ab56){return db[_0x035c('0x33')][_0x035c('0x4e')]({'where':{'id':_0x51a815['params']['id']}})['then'](handleEntityNotFound(_0x4f0100,null))['then'](function(_0x78d0e2){if(_0x78d0e2){return _0x78d0e2['addAgents'](_0x51a815[_0x035c('0x50')][_0x035c('0x67')],_[_0x035c('0x85')](_0x51a815['body'],[_0x035c('0x67'),'id'])||{})[_0x035c('0x86')](function(_0x932467){for(var _0x25ba41=0x0;_0x25ba41<_0x51a815[_0x035c('0x50')][_0x035c('0x67')][_0x035c('0x3f')];_0x25ba41+=0x1){socket[_0x035c('0x71')](_0x035c('0x87'),{'UserId':_0x51a815[_0x035c('0x50')][_0x035c('0x67')][_0x25ba41],'FaxQueueId':_0x51a815[_0x035c('0x4d')]['id']});}return _0x932467;});}})['then'](respondWithResult(_0x4f0100,null))['catch'](handleError(_0x4f0100,null));};exports[_0x035c('0x83')]=function(_0x2273da,_0x5b09f4,_0x6af247){return db[_0x035c('0x33')][_0x035c('0x4e')]({'where':{'id':_0x2273da[_0x035c('0x4d')]['id']}})['then'](handleEntityNotFound(_0x5b09f4,null))[_0x035c('0x28')](function(_0x39f923){if(_0x39f923){return _0x39f923[_0x035c('0x83')](_0x2273da[_0x035c('0x3a')]['ids'])['then'](function(){if(_['isArray'](_0x2273da['query'][_0x035c('0x67')])){for(var _0x51fd26=0x0;_0x51fd26<_0x2273da['query']['ids'][_0x035c('0x3f')];_0x51fd26+=0x1){socket[_0x035c('0x71')](_0x035c('0x84'),{'UserId':Number(_0x2273da[_0x035c('0x3a')][_0x035c('0x67')][_0x51fd26]),'FaxQueueId':Number(_0x2273da[_0x035c('0x4d')]['id'])});}}else{socket[_0x035c('0x71')](_0x035c('0x84'),{'UserId':Number(_0x2273da[_0x035c('0x3a')][_0x035c('0x67')]),'FaxQueueId':Number(_0x2273da[_0x035c('0x4d')]['id'])});}});}})[_0x035c('0x28')](respondWithStatusCode(_0x5b09f4,null))[_0x035c('0x4b')](handleError(_0x5b09f4,null));};exports[_0x035c('0x88')]=function(_0x5d03ad,_0x3d2f55,_0x547492){var _0xd9d127={};var _0x245346={};var _0x2edbab;var _0x208df3;return db[_0x035c('0x33')]['findOne']({'where':{'id':_0x5d03ad[_0x035c('0x4d')]['id']}})['then'](handleEntityNotFound(_0x3d2f55,null))[_0x035c('0x28')](function(_0x5c540d){if(_0x5c540d){_0x2edbab=_0x5c540d;_0x245346[_0x035c('0x38')]=_[_0x035c('0x39')](db[_0x035c('0x5a')][_0x035c('0x34')]);_0x245346['query']=_[_0x035c('0x39')](_0x5d03ad[_0x035c('0x3a')]);_0x245346[_0x035c('0x3b')]=_['intersection'](_0x245346[_0x035c('0x38')],_0x245346[_0x035c('0x3a')]);_0xd9d127[_0x035c('0x3e')]=_[_0x035c('0x3c')](_0x245346[_0x035c('0x38')],qs[_0x035c('0x3d')](_0x5d03ad[_0x035c('0x3a')][_0x035c('0x3d')]));_0xd9d127[_0x035c('0x3e')]=_0xd9d127[_0x035c('0x3e')][_0x035c('0x3f')]?_0xd9d127[_0x035c('0x3e')]:_0x245346[_0x035c('0x38')];_0xd9d127['order']=qs['sort'](_0x5d03ad[_0x035c('0x3a')][_0x035c('0x41')]);_0xd9d127[_0x035c('0x42')]=qs[_0x035c('0x3b')](_[_0x035c('0x65')](_0x5d03ad[_0x035c('0x3a')],_0x245346['filters']));if(_0x5d03ad[_0x035c('0x3a')][_0x035c('0x43')]){_0xd9d127['where']=_['merge'](_0xd9d127[_0x035c('0x42')],{'$or':_['map'](_0xd9d127['attributes'],function(_0x11a36a){var _0x946e4e={};_0x946e4e[_0x11a36a]={'$like':'%'+_0x5d03ad[_0x035c('0x3a')][_0x035c('0x43')]+'%'};return _0x946e4e;})});}_0xd9d127=_[_0x035c('0x45')]({},_0xd9d127,_0x5d03ad[_0x035c('0x46')]);return _0x2edbab[_0x035c('0x88')](_0xd9d127);}})[_0x035c('0x28')](function(_0x3463df){if(_0x3463df){_0x208df3=_0x3463df[_0x035c('0x3f')];if(!_0x5d03ad[_0x035c('0x3a')][_0x035c('0x89')](_0x035c('0x40'))){_0xd9d127[_0x035c('0x22')]=qs[_0x035c('0x22')](_0x5d03ad['query'][_0x035c('0x22')]);_0xd9d127['offset']=qs['offset'](_0x5d03ad[_0x035c('0x3a')]['offset']);}return _0x2edbab[_0x035c('0x88')](_0xd9d127);}})[_0x035c('0x28')](function(_0x5bcbe2){if(_0x5bcbe2){return _0x5bcbe2?{'count':_0x208df3,'rows':_0x5bcbe2}:null;}})[_0x035c('0x28')](respondWithResult(_0x3d2f55,null))['catch'](handleError(_0x3d2f55,null));}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.events.js b/server/api/faxQueue/faxQueue.events.js index 23e4c47..ffd1ddb 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 _0x9035=['save','update','remove','emit','hook','exports','events','../../mysqldb','FaxQueue','setMaxListeners'];(function(_0x82129b,_0x484ae9){var _0x2ae5dc=function(_0x299e34){while(--_0x299e34){_0x82129b['push'](_0x82129b['shift']());}};_0x2ae5dc(++_0x484ae9);}(_0x9035,0x132));var _0x5903=function(_0x171e90,_0x5a3122){_0x171e90=_0x171e90-0x0;var _0x58e4b7=_0x9035[_0x171e90];return _0x58e4b7;};'use strict';var EventEmitter=require(_0x5903('0x0'));var FaxQueue=require(_0x5903('0x1'))['db'][_0x5903('0x2')];var FaxQueueEvents=new EventEmitter();FaxQueueEvents[_0x5903('0x3')](0x0);var events={'afterCreate':_0x5903('0x4'),'afterUpdate':_0x5903('0x5'),'afterDestroy':_0x5903('0x6')};function emitEvent(_0x23fd18){return function(_0x507ef9,_0x519dd2,_0x4c0632){FaxQueueEvents[_0x5903('0x7')](_0x23fd18+':'+_0x507ef9['id'],_0x507ef9);FaxQueueEvents[_0x5903('0x7')](_0x23fd18,_0x507ef9);_0x4c0632(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];FaxQueue[_0x5903('0x8')](e,emitEvent(event));}}module[_0x5903('0x9')]=FaxQueueEvents; \ No newline at end of file +var _0xcb0a=['update','emit','hook','../../mysqldb','FaxQueue','setMaxListeners','save'];(function(_0x934425,_0x5af72f){var _0x31d596=function(_0x219869){while(--_0x219869){_0x934425['push'](_0x934425['shift']());}};_0x31d596(++_0x5af72f);}(_0xcb0a,0x96));var _0xacb0=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0xcb0a[_0x17d9e3];return _0x14192d;};'use strict';var EventEmitter=require('events');var FaxQueue=require(_0xacb0('0x0'))['db'][_0xacb0('0x1')];var FaxQueueEvents=new EventEmitter();FaxQueueEvents[_0xacb0('0x2')](0x0);var events={'afterCreate':_0xacb0('0x3'),'afterUpdate':_0xacb0('0x4'),'afterDestroy':'remove'};function emitEvent(_0x509bfa){return function(_0xd6b7d8,_0x484131,_0x2c889b){FaxQueueEvents[_0xacb0('0x5')](_0x509bfa+':'+_0xd6b7d8['id'],_0xd6b7d8);FaxQueueEvents[_0xacb0('0x5')](_0x509bfa,_0xd6b7d8);_0x2c889b(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];FaxQueue[_0xacb0('0x6')](e,emitEvent(event));}}module['exports']=FaxQueueEvents; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.model.js b/server/api/faxQueue/faxQueue.model.js index 2ffa1df..91959d6 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 _0x87c4=['FaxQueue','fax_queues','util','../../config/logger','request-promise','path','../../config/environment','./faxQueue.attributes','exports','define'];(function(_0x34b8ae,_0x5bbdf0){var _0x1a6654=function(_0x23cbc2){while(--_0x23cbc2){_0x34b8ae['push'](_0x34b8ae['shift']());}};_0x1a6654(++_0x5bbdf0);}(_0x87c4,0x1e2));var _0x487c=function(_0x1b6d3e,_0x474505){_0x1b6d3e=_0x1b6d3e-0x0;var _0x2960ab=_0x87c4[_0x1b6d3e];return _0x2960ab;};'use strict';var _=require('lodash');var util=require(_0x487c('0x0'));var logger=require(_0x487c('0x1'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x487c('0x2'));var fs=require('fs');var path=require(_0x487c('0x3'));var rimraf=require('rimraf');var config=require(_0x487c('0x4'));var attributes=require(_0x487c('0x5'));module[_0x487c('0x6')]=function(_0x437214,_0xab4c21){return _0x437214[_0x487c('0x7')](_0x487c('0x8'),attributes,{'tableName':_0x487c('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xabdf=['define','FaxQueue','fax_queues','lodash','util','../../config/logger','api','moment','bluebird','path','../../config/environment'];(function(_0x535246,_0x20318e){var _0x13d5d4=function(_0x3e828e){while(--_0x3e828e){_0x535246['push'](_0x535246['shift']());}};_0x13d5d4(++_0x20318e);}(_0xabdf,0x184));var _0xfabd=function(_0x1ddb7a,_0x51994e){_0x1ddb7a=_0x1ddb7a-0x0;var _0x4ae029=_0xabdf[_0x1ddb7a];return _0x4ae029;};'use strict';var _=require(_0xfabd('0x0'));var util=require(_0xfabd('0x1'));var logger=require(_0xfabd('0x2'))(_0xfabd('0x3'));var moment=require(_0xfabd('0x4'));var BPromise=require(_0xfabd('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xfabd('0x6'));var rimraf=require('rimraf');var config=require(_0xfabd('0x7'));var attributes=require('./faxQueue.attributes');module['exports']=function(_0x59c404,_0x2b563a){return _0x59c404[_0xfabd('0x8')](_0xfabd('0x9'),attributes,{'tableName':_0xfabd('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.rpc.js b/server/api/faxQueue/faxQueue.rpc.js index cf9394a..28feaa0 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 _0x2455=['rpc','../../config/environment','client','http','defaults','redis','socket.io-emitter','register','then','info','FaxQueue,\x20%s,\x20%s','request\x20sent','stringify','error','message','catch','GetFaxQueue','FaxQueue','findAll','options','raw','where','attributes','limit','map','include','model','find','ShowFaxQueue','debug','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x2941c3,_0x4f143f){var _0x4c1d51=function(_0x213ed7){while(--_0x213ed7){_0x2941c3['push'](_0x2941c3['shift']());}};_0x4c1d51(++_0x4f143f);}(_0x2455,0x128));var _0x5245=function(_0x54784f,_0x2a24d8){_0x54784f=_0x54784f-0x0;var _0x241e1b=_0x2455[_0x54784f];return _0x241e1b;};'use strict';var _=require(_0x5245('0x0'));var util=require(_0x5245('0x1'));var moment=require(_0x5245('0x2'));var BPromise=require(_0x5245('0x3'));var rs=require(_0x5245('0x4'));var fs=require('fs');var Redis=require(_0x5245('0x5'));var db=require(_0x5245('0x6'))['db'];var utils=require(_0x5245('0x7'));var logger=require('../../config/logger')(_0x5245('0x8'));var config=require(_0x5245('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x5245('0xa')][_0x5245('0xb')]({'port':0x232a});config['redis']=_[_0x5245('0xc')](config[_0x5245('0xd')],{'host':'localhost','port':0x18eb});var socket=require(_0x5245('0xe'))(new Redis(config[_0x5245('0xd')]));require('./faxQueue.socket')[_0x5245('0xf')](socket);function respondWithRpcPromise(_0x11eb8d,_0x3394b4,_0x10541e){return new BPromise(function(_0x4eb140,_0x35afe4){return client['request'](_0x11eb8d,_0x10541e)[_0x5245('0x10')](function(_0x4a701a){logger[_0x5245('0x11')](_0x5245('0x12'),_0x3394b4,_0x5245('0x13'));logger['debug']('FaxQueue,\x20%s,\x20%s,\x20%s',_0x3394b4,_0x5245('0x13'),JSON[_0x5245('0x14')](_0x4a701a));if(_0x4a701a[_0x5245('0x15')]){if(_0x4a701a['error']['code']===0x1f4){logger[_0x5245('0x15')](_0x5245('0x12'),_0x3394b4,_0x4a701a['error'][_0x5245('0x16')]);return _0x35afe4(_0x4a701a[_0x5245('0x15')][_0x5245('0x16')]);}logger['error'](_0x5245('0x12'),_0x3394b4,_0x4a701a[_0x5245('0x15')]['message']);return _0x4eb140(_0x4a701a[_0x5245('0x15')][_0x5245('0x16')]);}else{logger[_0x5245('0x11')](_0x5245('0x12'),_0x3394b4,_0x5245('0x13'));_0x4eb140(_0x4a701a['result'][_0x5245('0x16')]);}})[_0x5245('0x17')](function(_0x22d3d5){logger[_0x5245('0x15')](_0x5245('0x12'),_0x3394b4,_0x22d3d5);_0x35afe4(_0x22d3d5);});});}exports[_0x5245('0x18')]=function(_0x15d66e){var _0x28316c=this;return new Promise(function(_0x42b2c2,_0x4313df){return db[_0x5245('0x19')][_0x5245('0x1a')]({'raw':_0x15d66e['options']?_0x15d66e[_0x5245('0x1b')][_0x5245('0x1c')]===undefined?!![]:![]:!![],'where':_0x15d66e['options']?_0x15d66e[_0x5245('0x1b')][_0x5245('0x1d')]||null:null,'attributes':_0x15d66e[_0x5245('0x1b')]?_0x15d66e[_0x5245('0x1b')][_0x5245('0x1e')]||null:null,'limit':_0x15d66e[_0x5245('0x1b')]?_0x15d66e[_0x5245('0x1b')][_0x5245('0x1f')]||null:null,'include':_0x15d66e[_0x5245('0x1b')]?_0x15d66e[_0x5245('0x1b')]['include']?_[_0x5245('0x20')](_0x15d66e[_0x5245('0x1b')][_0x5245('0x21')],function(_0xe2964f){return{'model':db[_0xe2964f[_0x5245('0x22')]],'as':_0xe2964f['as'],'attributes':_0xe2964f['attributes'],'include':_0xe2964f['include']?_[_0x5245('0x20')](_0xe2964f[_0x5245('0x21')],function(_0x1e84bd){return{'model':db[_0x1e84bd[_0x5245('0x22')]],'as':_0x1e84bd['as'],'attributes':_0x1e84bd[_0x5245('0x1e')],'include':_0x1e84bd[_0x5245('0x21')]?_[_0x5245('0x20')](_0x1e84bd[_0x5245('0x21')],function(_0x3ca94c){return{'model':db[_0x3ca94c['model']],'as':_0x3ca94c['as'],'attributes':_0x3ca94c[_0x5245('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x5245('0x10')](function(_0x113a91){logger['info'](_0x5245('0x18'),_0x15d66e);logger['debug']('GetFaxQueue',_0x15d66e,JSON['stringify'](_0x113a91));_0x42b2c2(_0x113a91);})['catch'](function(_0x27d70c){logger[_0x5245('0x15')](_0x5245('0x18'),_0x27d70c[_0x5245('0x16')],_0x15d66e);_0x4313df(_0x28316c[_0x5245('0x15')](0x1f4,_0x27d70c[_0x5245('0x16')]));});});};exports['ShowFaxQueue']=function(_0x506390){var _0x54ce13=this;return new Promise(function(_0x5ca3dd,_0x4efdc5){return db[_0x5245('0x19')][_0x5245('0x23')]({'raw':_0x506390['options']?_0x506390['options']['raw']===undefined?!![]:![]:!![],'where':_0x506390[_0x5245('0x1b')]?_0x506390[_0x5245('0x1b')][_0x5245('0x1d')]||null:null,'attributes':_0x506390[_0x5245('0x1b')]?_0x506390['options']['attributes']||null:null,'include':_0x506390[_0x5245('0x1b')]?_0x506390['options'][_0x5245('0x21')]?_[_0x5245('0x20')](_0x506390[_0x5245('0x1b')]['include'],function(_0x41c60b){return{'model':db[_0x41c60b['model']],'as':_0x41c60b['as'],'attributes':_0x41c60b[_0x5245('0x1e')],'include':_0x41c60b[_0x5245('0x21')]?_[_0x5245('0x20')](_0x41c60b[_0x5245('0x21')],function(_0x13f25a){return{'model':db[_0x13f25a[_0x5245('0x22')]],'as':_0x13f25a['as'],'attributes':_0x13f25a[_0x5245('0x1e')],'include':_0x13f25a[_0x5245('0x21')]?_[_0x5245('0x20')](_0x13f25a[_0x5245('0x21')],function(_0x23cb1f){return{'model':db[_0x23cb1f[_0x5245('0x22')]],'as':_0x23cb1f['as'],'attributes':_0x23cb1f[_0x5245('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x5245('0x10')](function(_0x177e6c){logger[_0x5245('0x11')](_0x5245('0x24'),_0x506390);logger[_0x5245('0x25')](_0x5245('0x24'),_0x506390,JSON[_0x5245('0x14')](_0x177e6c));_0x5ca3dd(_0x177e6c);})[_0x5245('0x17')](function(_0x4917d0){logger[_0x5245('0x15')]('ShowFaxQueue',_0x4917d0[_0x5245('0x16')],_0x506390);_0x4efdc5(_0x54ce13[_0x5245('0x15')](0x1f4,_0x4917d0['message']));});});}; \ No newline at end of file +var _0x7318=['include','map','model','then','GetFaxQueue','ShowFaxQueue','find','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','redis','defaults','localhost','./faxQueue.socket','info','FaxQueue,\x20%s,\x20%s','request\x20sent','debug','FaxQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','findAll','options','raw','where','attributes'];(function(_0x47eaec,_0x587b76){var _0x15e9f4=function(_0x5466fd){while(--_0x5466fd){_0x47eaec['push'](_0x47eaec['shift']());}};_0x15e9f4(++_0x587b76);}(_0x7318,0x18d));var _0x8731=function(_0x1178fe,_0x1c1a22){_0x1178fe=_0x1178fe-0x0;var _0x4fa293=_0x7318[_0x1178fe];return _0x4fa293;};'use strict';var _=require(_0x8731('0x0'));var util=require(_0x8731('0x1'));var moment=require(_0x8731('0x2'));var BPromise=require(_0x8731('0x3'));var rs=require(_0x8731('0x4'));var fs=require('fs');var Redis=require(_0x8731('0x5'));var db=require(_0x8731('0x6'))['db'];var utils=require(_0x8731('0x7'));var logger=require(_0x8731('0x8'))(_0x8731('0x9'));var config=require('../../config/environment');var jayson=require(_0x8731('0xa'));var client=jayson[_0x8731('0xb')]['http']({'port':0x232a});config[_0x8731('0xc')]=_[_0x8731('0xd')](config['redis'],{'host':_0x8731('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x8731('0xc')]));require(_0x8731('0xf'))['register'](socket);function respondWithRpcPromise(_0x3f25e6,_0x302268,_0xa1a0a9){return new BPromise(function(_0xedeaa4,_0x449410){return client['request'](_0x3f25e6,_0xa1a0a9)['then'](function(_0x579f94){logger[_0x8731('0x10')](_0x8731('0x11'),_0x302268,_0x8731('0x12'));logger[_0x8731('0x13')](_0x8731('0x14'),_0x302268,_0x8731('0x12'),JSON[_0x8731('0x15')](_0x579f94));if(_0x579f94[_0x8731('0x16')]){if(_0x579f94[_0x8731('0x16')][_0x8731('0x17')]===0x1f4){logger['error'](_0x8731('0x11'),_0x302268,_0x579f94['error']['message']);return _0x449410(_0x579f94[_0x8731('0x16')][_0x8731('0x18')]);}logger[_0x8731('0x16')]('FaxQueue,\x20%s,\x20%s',_0x302268,_0x579f94['error'][_0x8731('0x18')]);return _0xedeaa4(_0x579f94['error'][_0x8731('0x18')]);}else{logger[_0x8731('0x10')](_0x8731('0x11'),_0x302268,_0x8731('0x12'));_0xedeaa4(_0x579f94[_0x8731('0x19')]['message']);}})[_0x8731('0x1a')](function(_0x2413b9){logger[_0x8731('0x16')](_0x8731('0x11'),_0x302268,_0x2413b9);_0x449410(_0x2413b9);});});}exports['GetFaxQueue']=function(_0x544465){var _0x2bfccf=this;return new Promise(function(_0x5f32b0,_0x12072d){return db['FaxQueue'][_0x8731('0x1b')]({'raw':_0x544465[_0x8731('0x1c')]?_0x544465['options'][_0x8731('0x1d')]===undefined?!![]:![]:!![],'where':_0x544465[_0x8731('0x1c')]?_0x544465[_0x8731('0x1c')][_0x8731('0x1e')]||null:null,'attributes':_0x544465[_0x8731('0x1c')]?_0x544465['options'][_0x8731('0x1f')]||null:null,'limit':_0x544465[_0x8731('0x1c')]?_0x544465[_0x8731('0x1c')]['limit']||null:null,'include':_0x544465[_0x8731('0x1c')]?_0x544465[_0x8731('0x1c')][_0x8731('0x20')]?_[_0x8731('0x21')](_0x544465[_0x8731('0x1c')][_0x8731('0x20')],function(_0x32207d){return{'model':db[_0x32207d[_0x8731('0x22')]],'as':_0x32207d['as'],'attributes':_0x32207d[_0x8731('0x1f')],'include':_0x32207d[_0x8731('0x20')]?_[_0x8731('0x21')](_0x32207d[_0x8731('0x20')],function(_0x231727){return{'model':db[_0x231727['model']],'as':_0x231727['as'],'attributes':_0x231727[_0x8731('0x1f')],'include':_0x231727['include']?_[_0x8731('0x21')](_0x231727[_0x8731('0x20')],function(_0x290860){return{'model':db[_0x290860[_0x8731('0x22')]],'as':_0x290860['as'],'attributes':_0x290860[_0x8731('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x8731('0x23')](function(_0x4d2780){logger[_0x8731('0x10')](_0x8731('0x24'),_0x544465);logger[_0x8731('0x13')](_0x8731('0x24'),_0x544465,JSON[_0x8731('0x15')](_0x4d2780));_0x5f32b0(_0x4d2780);})['catch'](function(_0x3f89a){logger['error'](_0x8731('0x24'),_0x3f89a['message'],_0x544465);_0x12072d(_0x2bfccf[_0x8731('0x16')](0x1f4,_0x3f89a[_0x8731('0x18')]));});});};exports[_0x8731('0x25')]=function(_0x2c4d1f){var _0x431abd=this;return new Promise(function(_0x149497,_0x4e989e){return db['FaxQueue'][_0x8731('0x26')]({'raw':_0x2c4d1f[_0x8731('0x1c')]?_0x2c4d1f[_0x8731('0x1c')][_0x8731('0x1d')]===undefined?!![]:![]:!![],'where':_0x2c4d1f[_0x8731('0x1c')]?_0x2c4d1f[_0x8731('0x1c')][_0x8731('0x1e')]||null:null,'attributes':_0x2c4d1f[_0x8731('0x1c')]?_0x2c4d1f[_0x8731('0x1c')][_0x8731('0x1f')]||null:null,'include':_0x2c4d1f[_0x8731('0x1c')]?_0x2c4d1f['options']['include']?_[_0x8731('0x21')](_0x2c4d1f[_0x8731('0x1c')][_0x8731('0x20')],function(_0x4cfbf3){return{'model':db[_0x4cfbf3['model']],'as':_0x4cfbf3['as'],'attributes':_0x4cfbf3[_0x8731('0x1f')],'include':_0x4cfbf3['include']?_[_0x8731('0x21')](_0x4cfbf3[_0x8731('0x20')],function(_0x157050){return{'model':db[_0x157050['model']],'as':_0x157050['as'],'attributes':_0x157050[_0x8731('0x1f')],'include':_0x157050[_0x8731('0x20')]?_[_0x8731('0x21')](_0x157050[_0x8731('0x20')],function(_0x4b1067){return{'model':db[_0x4b1067[_0x8731('0x22')]],'as':_0x4b1067['as'],'attributes':_0x4b1067['attributes']};}):[]};}):[]};}):[]:[]})[_0x8731('0x23')](function(_0x1ee107){logger['info'](_0x8731('0x25'),_0x2c4d1f);logger[_0x8731('0x13')]('ShowFaxQueue',_0x2c4d1f,JSON[_0x8731('0x15')](_0x1ee107));_0x149497(_0x1ee107);})[_0x8731('0x1a')](function(_0x127a84){logger['error'](_0x8731('0x25'),_0x127a84['message'],_0x2c4d1f);_0x4e989e(_0x431abd[_0x8731('0x16')](0x1f4,_0x127a84['message']));});});}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.socket.js b/server/api/faxQueue/faxQueue.socket.js index 55c65ae..b7be8d6 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 _0x74fe=['./faxQueue.events','save','update','length'];(function(_0x51f574,_0x43e008){var _0x10d93b=function(_0x13f501){while(--_0x13f501){_0x51f574['push'](_0x51f574['shift']());}};_0x10d93b(++_0x43e008);}(_0x74fe,0x84));var _0xe74f=function(_0x2bc0db,_0x3a381a){_0x2bc0db=_0x2bc0db-0x0;var _0x3d475f=_0x74fe[_0x2bc0db];return _0x3d475f;};'use strict';var FaxQueueEvents=require(_0xe74f('0x0'));var events=[_0xe74f('0x1'),'remove',_0xe74f('0x2')];function createListener(_0x19af91,_0x3d73cf){return function(_0x5d28b3){_0x3d73cf['emit'](_0x19af91,_0x5d28b3);};}function removeListener(_0xab433f,_0xde88){return function(){FaxQueueEvents['removeListener'](_0xab433f,_0xde88);};}exports['register']=function(_0x651832){for(var _0x4afcdd=0x0,_0x3c16e8=events[_0xe74f('0x3')];_0x4afcdd<_0x3c16e8;_0x4afcdd++){var _0x3ec151=events[_0x4afcdd];var _0x5bf82c=createListener('faxQueue:'+_0x3ec151,_0x651832);FaxQueueEvents['on'](_0x3ec151,_0x5bf82c);}}; \ No newline at end of file +var _0xa53f=['./faxQueue.events','update','removeListener','length'];(function(_0x26ce99,_0x51c44a){var _0x69dd3d=function(_0x3dc2d9){while(--_0x3dc2d9){_0x26ce99['push'](_0x26ce99['shift']());}};_0x69dd3d(++_0x51c44a);}(_0xa53f,0xa8));var _0xfa53=function(_0x571ad8,_0x455385){_0x571ad8=_0x571ad8-0x0;var _0x2e0723=_0xa53f[_0x571ad8];return _0x2e0723;};'use strict';var FaxQueueEvents=require(_0xfa53('0x0'));var events=['save','remove',_0xfa53('0x1')];function createListener(_0x19a96f,_0x3b8de0){return function(_0x1c38d2){_0x3b8de0['emit'](_0x19a96f,_0x1c38d2);};}function removeListener(_0x373acc,_0x437ce6){return function(){FaxQueueEvents[_0xfa53('0x2')](_0x373acc,_0x437ce6);};}exports['register']=function(_0x44a384){for(var _0x276376=0x0,_0x35f8c4=events[_0xfa53('0x3')];_0x276376<_0x35f8c4;_0x276376++){var _0x2f9494=events[_0x276376];var _0x4e967c=createListener('faxQueue:'+_0x2f9494,_0x44a384);FaxQueueEvents['on'](_0x2f9494,_0x4e967c);}}; \ No newline at end of file diff --git a/server/api/faxQueue/index.js b/server/api/faxQueue/index.js index c918eb0..7b311a3 100644 --- a/server/api/faxQueue/index.js +++ b/server/api/faxQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb10b=['addTeams','addAgents','put','update','delete','destroy','removeTeams','removeAgents','multer','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxQueue.controller','get','isAuthenticated','/describe','describe','/:id','show','/:id/members','/:id/teams','getTeams','/:id/users','getAgents','post','create'];(function(_0x32d457,_0x1a39c9){var _0x338386=function(_0x199d7a){while(--_0x199d7a){_0x32d457['push'](_0x32d457['shift']());}};_0x338386(++_0x1a39c9);}(_0xb10b,0x12a));var _0xbb10=function(_0x6f2ce5,_0x4231eb){_0x6f2ce5=_0x6f2ce5-0x0;var _0x28a54a=_0xb10b[_0x6f2ce5];return _0x28a54a;};'use strict';var multer=require(_0xbb10('0x0'));var util=require('util');var path=require(_0xbb10('0x1'));var timeout=require(_0xbb10('0x2'));var express=require(_0xbb10('0x3'));var router=express['Router']();var auth=require(_0xbb10('0x4'));var interaction=require(_0xbb10('0x5'));var config=require(_0xbb10('0x6'));var controller=require(_0xbb10('0x7'));router[_0xbb10('0x8')]('/',auth[_0xbb10('0x9')](),controller['index']);router[_0xbb10('0x8')](_0xbb10('0xa'),auth['isAuthenticated'](),controller[_0xbb10('0xb')]);router[_0xbb10('0x8')](_0xbb10('0xc'),auth[_0xbb10('0x9')](),controller[_0xbb10('0xd')]);router[_0xbb10('0x8')](_0xbb10('0xe'),auth[_0xbb10('0x9')](),controller['getMembers']);router['get'](_0xbb10('0xf'),auth[_0xbb10('0x9')](),controller[_0xbb10('0x10')]);router['get'](_0xbb10('0x11'),auth['isAuthenticated'](),controller[_0xbb10('0x12')]);router[_0xbb10('0x13')]('/',auth[_0xbb10('0x9')](),controller[_0xbb10('0x14')]);router[_0xbb10('0x13')](_0xbb10('0xf'),auth['isAuthenticated'](),controller[_0xbb10('0x15')]);router[_0xbb10('0x13')](_0xbb10('0x11'),auth[_0xbb10('0x9')](),controller[_0xbb10('0x16')]);router[_0xbb10('0x17')](_0xbb10('0xc'),auth[_0xbb10('0x9')](),controller[_0xbb10('0x18')]);router[_0xbb10('0x19')]('/:id',auth[_0xbb10('0x9')](),controller[_0xbb10('0x1a')]);router[_0xbb10('0x19')](_0xbb10('0xf'),auth[_0xbb10('0x9')](),controller[_0xbb10('0x1b')]);router[_0xbb10('0x19')](_0xbb10('0x11'),auth[_0xbb10('0x9')](),controller[_0xbb10('0x1c')]);module['exports']=router; \ No newline at end of file +var _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(_0x240261,_0x4fe66c){var _0x45c332=function(_0x4f367a){while(--_0x4f367a){_0x240261['push'](_0x240261['shift']());}};_0x45c332(++_0x4fe66c);}(_0xb10b,0x12a));var _0xbb10=function(_0x3364fc,_0x559233){_0x3364fc=_0x3364fc-0x0;var _0x10df36=_0xb10b[_0x3364fc];return _0x10df36;};'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 ba9b50b..35718cd 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 _0xaf1e=['STRING','DATE','moment'];(function(_0x521e81,_0x48a6fb){var _0x23d85f=function(_0x2b66ba){while(--_0x2b66ba){_0x521e81['push'](_0x521e81['shift']());}};_0x23d85f(++_0x48a6fb);}(_0xaf1e,0x110));var _0xeaf1=function(_0x857aa4,_0x5608f6){_0x857aa4=_0x857aa4-0x0;var _0x313d1e=_0xaf1e[_0x857aa4];return _0x313d1e;};'use strict';var moment=require(_0xeaf1('0x0'));var Sequelize=require('sequelize');module['exports']={'uniqueid':{'type':Sequelize[_0xeaf1('0x1')],'allowNull':![]},'from':{'type':Sequelize[_0xeaf1('0x1')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0xeaf1('0x2')]},'reason':{'type':Sequelize[_0xeaf1('0x1')]}}; \ No newline at end of file +var _0x2569=['STRING','DATE','moment','exports'];(function(_0x4c3b60,_0x324bd4){var _0x4b0f05=function(_0x1562fd){while(--_0x1562fd){_0x4c3b60['push'](_0x4c3b60['shift']());}};_0x4b0f05(++_0x324bd4);}(_0x2569,0x172));var _0x9256=function(_0x582d5a,_0x3b57c0){_0x582d5a=_0x582d5a-0x0;var _0x5625ef=_0x2569[_0x582d5a];return _0x5625ef;};'use strict';var moment=require(_0x9256('0x0'));var Sequelize=require('sequelize');module[_0x9256('0x1')]={'uniqueid':{'type':Sequelize[_0x9256('0x2')],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0x9256('0x3')]},'leaveAt':{'type':Sequelize[_0x9256('0x3')]},'acceptAt':{'type':Sequelize[_0x9256('0x3')]},'exitAt':{'type':Sequelize[_0x9256('0x3')]},'reason':{'type':Sequelize[_0x9256('0x2')]}}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.controller.js b/server/api/faxQueueReport/faxQueueReport.controller.js index 6dfa8d4..0d8a571 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 _0x519a=['filter','options','includeAll','include','findAll','rows','catch','show','params','merge','find','create','body','update','describe','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','path','sox','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','status','end','count','set','Content-Range','apply','reject','then','destroy','sendStatus','error','stack','name','send','map','FaxQueueReport','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','nolimit','limit','offset','order','sort','where','pick','VIRTUAL'];(function(_0x56fd29,_0x17790b){var _0x2a0bf7=function(_0x568f20){while(--_0x568f20){_0x56fd29['push'](_0x56fd29['shift']());}};_0x2a0bf7(++_0x17790b);}(_0x519a,0xa1));var _0xa519=function(_0x21af3a,_0x386e1d){_0x21af3a=_0x21af3a-0x0;var _0x268a49=_0x519a[_0x21af3a];return _0x268a49;};'use strict';var pdf=require(_0xa519('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xa519('0x1'));var zipdir=require(_0xa519('0x2'));var jsonpatch=require(_0xa519('0x3'));var rp=require(_0xa519('0x4'));var moment=require('moment');var BPromise=require(_0xa519('0x5'));var Mustache=require('mustache');var util=require(_0xa519('0x6'));var path=require(_0xa519('0x7'));var sox=require(_0xa519('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0xa519('0x9'));var squel=require(_0xa519('0xa'));var crypto=require(_0xa519('0xb'));var jsforce=require(_0xa519('0xc'));var deskjs=require(_0xa519('0xd'));var toCsv=require('to-csv');var querystring=require(_0xa519('0xe'));var Papa=require('papaparse');var Redis=require(_0xa519('0xf'));var authService=require(_0xa519('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0xa519('0x11'));var hardwareService=require(_0xa519('0x12'));var logger=require(_0xa519('0x13'))(_0xa519('0x14'));var utils=require(_0xa519('0x15'));var config=require(_0xa519('0x16'));var db=require(_0xa519('0x17'))['db'];function respondWithStatusCode(_0x1bf586,_0x23f2b6){_0x23f2b6=_0x23f2b6||0xcc;return function(_0x5d0ece){if(_0x5d0ece){return _0x1bf586['sendStatus'](_0x23f2b6);}return _0x1bf586[_0xa519('0x18')](_0x23f2b6)[_0xa519('0x19')]();};}function respondWithResult(_0x3fc1ba,_0x244b25){_0x244b25=_0x244b25||0xc8;return function(_0x4f86f2){if(_0x4f86f2){return _0x3fc1ba[_0xa519('0x18')](_0x244b25)['json'](_0x4f86f2);}};}function respondWithFilteredResult(_0x352642,_0x432d02){return function(_0x340323){if(_0x340323){var _0x48ddb3=_0x340323[_0xa519('0x1a')],_0x89534e=_0x432d02['offset'],_0x4b597f=_0x432d02['offset']+_0x432d02['limit'],_0x5ac0e4;if(_0x4b597f>=_0x48ddb3){_0x4b597f=_0x48ddb3;_0x5ac0e4=0xc8;}else{_0x5ac0e4=0xce;}_0x352642[_0xa519('0x18')](_0x5ac0e4);return _0x352642[_0xa519('0x1b')](_0xa519('0x1c'),_0x89534e+'-'+_0x4b597f+'/'+_0x48ddb3)['json'](_0x340323);}return null;};}function patchUpdates(_0x22e5c7){return function(_0x373677){try{jsonpatch[_0xa519('0x1d')](_0x373677,_0x22e5c7,!![]);}catch(_0x53d5d9){return BPromise[_0xa519('0x1e')](_0x53d5d9);}return _0x373677['save']();};}function saveUpdates(_0x2bd7c1,_0x5150ba){return function(_0x5d46af){if(_0x5d46af){return _0x5d46af['update'](_0x2bd7c1)[_0xa519('0x1f')](function(_0x308a90){return _0x308a90;});}return null;};}function removeEntity(_0x36c293,_0x376fb2){return function(_0x4e8e1f){if(_0x4e8e1f){return _0x4e8e1f[_0xa519('0x20')]()['then'](function(){_0x36c293[_0xa519('0x18')](0xcc)[_0xa519('0x19')]();});}};}function handleEntityNotFound(_0x56c841,_0x1d84b2){return function(_0x435d13){if(!_0x435d13){_0x56c841[_0xa519('0x21')](0x194);}return _0x435d13;};}function handleError(_0x5a08cf,_0x243060){_0x243060=_0x243060||0x1f4;return function(_0x12a9b5){logger[_0xa519('0x22')](_0x12a9b5[_0xa519('0x23')]);if(_0x12a9b5[_0xa519('0x24')]){delete _0x12a9b5['name'];}_0x5a08cf[_0xa519('0x18')](_0x243060)[_0xa519('0x25')](_0x12a9b5);};}exports['index']=function(_0x4f63b7,_0x5d2c84){var _0xbcf7a4={},_0x9b9a6a={},_0x298746={'count':0x0,'rows':[]};var _0x37bd0d=_[_0xa519('0x26')](db[_0xa519('0x27')]['rawAttributes'],function(_0x4f6353){return{'name':_0x4f6353[_0xa519('0x28')],'type':_0x4f6353[_0xa519('0x29')]['key']};});_0x9b9a6a[_0xa519('0x2a')]=_['map'](_0x37bd0d,_0xa519('0x24'));_0x9b9a6a[_0xa519('0x2b')]=_[_0xa519('0x2c')](_0x4f63b7[_0xa519('0x2b')]);_0x9b9a6a[_0xa519('0x2d')]=_[_0xa519('0x2e')](_0x9b9a6a[_0xa519('0x2a')],_0x9b9a6a[_0xa519('0x2b')]);_0xbcf7a4[_0xa519('0x2f')]=_['intersection'](_0x9b9a6a[_0xa519('0x2a')],qs[_0xa519('0x30')](_0x4f63b7['query']['fields']));_0xbcf7a4[_0xa519('0x2f')]=_0xbcf7a4[_0xa519('0x2f')][_0xa519('0x31')]?_0xbcf7a4[_0xa519('0x2f')]:_0x9b9a6a['model'];if(!_0x4f63b7[_0xa519('0x2b')]['hasOwnProperty'](_0xa519('0x32'))){_0xbcf7a4[_0xa519('0x33')]=qs['limit'](_0x4f63b7[_0xa519('0x2b')][_0xa519('0x33')]);_0xbcf7a4[_0xa519('0x34')]=qs[_0xa519('0x34')](_0x4f63b7[_0xa519('0x2b')][_0xa519('0x34')]);}_0xbcf7a4[_0xa519('0x35')]=qs['sort'](_0x4f63b7[_0xa519('0x2b')][_0xa519('0x36')]);_0xbcf7a4[_0xa519('0x37')]=qs[_0xa519('0x2d')](_[_0xa519('0x38')](_0x4f63b7[_0xa519('0x2b')],_0x9b9a6a['filters']),_0x37bd0d);if(_0x4f63b7['query']['filter']){_0xbcf7a4[_0xa519('0x37')]=_['merge'](_0xbcf7a4['where'],{'$or':_[_0xa519('0x26')](_0x37bd0d,function(_0x25825a){if(_0x25825a[_0xa519('0x29')]!==_0xa519('0x39')){var _0x1e7d2e={};_0x1e7d2e[_0x25825a['name']]={'$like':'%'+_0x4f63b7[_0xa519('0x2b')][_0xa519('0x3a')]+'%'};return _0x1e7d2e;}})});}_0xbcf7a4=_['merge']({},_0xbcf7a4,_0x4f63b7[_0xa519('0x3b')]);var _0x21d36d={'where':_0xbcf7a4[_0xa519('0x37')]};return db[_0xa519('0x27')][_0xa519('0x1a')](_0x21d36d)[_0xa519('0x1f')](function(_0x284cff){_0x298746[_0xa519('0x1a')]=_0x284cff;if(_0x4f63b7[_0xa519('0x2b')][_0xa519('0x3c')]){_0xbcf7a4[_0xa519('0x3d')]=[{'all':!![]}];}return db[_0xa519('0x27')][_0xa519('0x3e')](_0xbcf7a4);})[_0xa519('0x1f')](function(_0x15365e){_0x298746[_0xa519('0x3f')]=_0x15365e;return _0x298746;})[_0xa519('0x1f')](respondWithFilteredResult(_0x5d2c84,_0xbcf7a4))[_0xa519('0x40')](handleError(_0x5d2c84,null));};exports[_0xa519('0x41')]=function(_0x287298,_0x5c2569){var _0x4ec511={'raw':!![],'where':{'id':_0x287298[_0xa519('0x42')]['id']}},_0x4a79c6={};_0x4a79c6[_0xa519('0x2a')]=_[_0xa519('0x2c')](db['FaxQueueReport']['rawAttributes']);_0x4a79c6['query']=_[_0xa519('0x2c')](_0x287298['query']);_0x4a79c6[_0xa519('0x2d')]=_[_0xa519('0x2e')](_0x4a79c6['model'],_0x4a79c6[_0xa519('0x2b')]);_0x4ec511['attributes']=_[_0xa519('0x2e')](_0x4a79c6[_0xa519('0x2a')],qs[_0xa519('0x30')](_0x287298['query'][_0xa519('0x30')]));_0x4ec511['attributes']=_0x4ec511['attributes'][_0xa519('0x31')]?_0x4ec511['attributes']:_0x4a79c6[_0xa519('0x2a')];if(_0x287298[_0xa519('0x2b')][_0xa519('0x3c')]){_0x4ec511[_0xa519('0x3d')]=[{'all':!![]}];}_0x4ec511=_[_0xa519('0x43')]({},_0x4ec511,_0x287298[_0xa519('0x3b')]);return db[_0xa519('0x27')][_0xa519('0x44')](_0x4ec511)[_0xa519('0x1f')](handleEntityNotFound(_0x5c2569,null))[_0xa519('0x1f')](respondWithResult(_0x5c2569,null))['catch'](handleError(_0x5c2569,null));};exports[_0xa519('0x45')]=function(_0xfd348f,_0xce99b9){return db[_0xa519('0x27')][_0xa519('0x45')](_0xfd348f[_0xa519('0x46')],{})[_0xa519('0x1f')](respondWithResult(_0xce99b9,0xc9))[_0xa519('0x40')](handleError(_0xce99b9,null));};exports[_0xa519('0x47')]=function(_0xd01d30,_0x3526e5){if(_0xd01d30['body']['id']){delete _0xd01d30[_0xa519('0x46')]['id'];}return db[_0xa519('0x27')][_0xa519('0x44')]({'where':{'id':_0xd01d30[_0xa519('0x42')]['id']}})[_0xa519('0x1f')](handleEntityNotFound(_0x3526e5,null))[_0xa519('0x1f')](saveUpdates(_0xd01d30[_0xa519('0x46')],null))['then'](respondWithResult(_0x3526e5,null))['catch'](handleError(_0x3526e5,null));};exports['destroy']=function(_0xa6902d,_0x5c8d6a){return db['FaxQueueReport'][_0xa519('0x44')]({'where':{'id':_0xa6902d[_0xa519('0x42')]['id']}})[_0xa519('0x1f')](handleEntityNotFound(_0x5c8d6a,null))[_0xa519('0x1f')](removeEntity(_0x5c8d6a,null))[_0xa519('0x40')](handleError(_0x5c8d6a,null));};exports[_0xa519('0x48')]=function(_0x35e66b,_0xa24256){return db[_0xa519('0x27')]['describe']()[_0xa519('0x1f')](respondWithResult(_0xa24256,null))[_0xa519('0x40')](handleError(_0xa24256,null));}; \ No newline at end of file +var _0x9817=['index','map','FaxQueueReport','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','count','includeAll','include','findAll','rows','catch','params','create','body','update','find','destroy','describe','html-pdf','zip-dir','request-promise','moment','bluebird','mustache','path','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../mysqldb','status','end','json','offset','limit','set','Content-Range','apply','reject','save','then','sendStatus','error','stack','name','send'];(function(_0x53c779,_0xd4aacd){var _0x2859d5=function(_0x229252){while(--_0x229252){_0x53c779['push'](_0x53c779['shift']());}};_0x2859d5(++_0xd4aacd);}(_0x9817,0x109));var _0x7981=function(_0x9f5610,_0x29f657){_0x9f5610=_0x9f5610-0x0;var _0x206d77=_0x9817[_0x9f5610];return _0x206d77;};'use strict';var pdf=require(_0x7981('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x7981('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x7981('0x2'));var moment=require(_0x7981('0x3'));var BPromise=require(_0x7981('0x4'));var Mustache=require(_0x7981('0x5'));var util=require('util');var path=require(_0x7981('0x6'));var sox=require('sox');var csv=require(_0x7981('0x7'));var ejs=require(_0x7981('0x8'));var fs=require('fs');var _=require(_0x7981('0x9'));var squel=require(_0x7981('0xa'));var crypto=require(_0x7981('0xb'));var jsforce=require(_0x7981('0xc'));var deskjs=require(_0x7981('0xd'));var toCsv=require(_0x7981('0x7'));var querystring=require(_0x7981('0xe'));var Papa=require(_0x7981('0xf'));var Redis=require(_0x7981('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x7981('0x11'));var as=require(_0x7981('0x12'));var hardwareService=require(_0x7981('0x13'));var logger=require('../../config/logger')(_0x7981('0x14'));var utils=require(_0x7981('0x15'));var config=require('../../config/environment');var db=require(_0x7981('0x16'))['db'];function respondWithStatusCode(_0x2b1053,_0x3c9c36){_0x3c9c36=_0x3c9c36||0xcc;return function(_0x13d0bc){if(_0x13d0bc){return _0x2b1053['sendStatus'](_0x3c9c36);}return _0x2b1053[_0x7981('0x17')](_0x3c9c36)[_0x7981('0x18')]();};}function respondWithResult(_0xf977dd,_0x5e6390){_0x5e6390=_0x5e6390||0xc8;return function(_0x420574){if(_0x420574){return _0xf977dd[_0x7981('0x17')](_0x5e6390)[_0x7981('0x19')](_0x420574);}};}function respondWithFilteredResult(_0x302c31,_0x2fa329){return function(_0x32b71d){if(_0x32b71d){var _0x5c72af=_0x32b71d['count'],_0x271666=_0x2fa329[_0x7981('0x1a')],_0x1a65a4=_0x2fa329[_0x7981('0x1a')]+_0x2fa329[_0x7981('0x1b')],_0x3ba54f;if(_0x1a65a4>=_0x5c72af){_0x1a65a4=_0x5c72af;_0x3ba54f=0xc8;}else{_0x3ba54f=0xce;}_0x302c31[_0x7981('0x17')](_0x3ba54f);return _0x302c31[_0x7981('0x1c')](_0x7981('0x1d'),_0x271666+'-'+_0x1a65a4+'/'+_0x5c72af)[_0x7981('0x19')](_0x32b71d);}return null;};}function patchUpdates(_0x4276bd){return function(_0x52bef6){try{jsonpatch[_0x7981('0x1e')](_0x52bef6,_0x4276bd,!![]);}catch(_0x33badc){return BPromise[_0x7981('0x1f')](_0x33badc);}return _0x52bef6[_0x7981('0x20')]();};}function saveUpdates(_0x624654,_0x204fc5){return function(_0x3398a2){if(_0x3398a2){return _0x3398a2['update'](_0x624654)[_0x7981('0x21')](function(_0x1f5a3b){return _0x1f5a3b;});}return null;};}function removeEntity(_0x2b2bdd,_0xcd7898){return function(_0x4b053c){if(_0x4b053c){return _0x4b053c['destroy']()[_0x7981('0x21')](function(){_0x2b2bdd[_0x7981('0x17')](0xcc)[_0x7981('0x18')]();});}};}function handleEntityNotFound(_0x4bb43a,_0x35c8ca){return function(_0x302a53){if(!_0x302a53){_0x4bb43a[_0x7981('0x22')](0x194);}return _0x302a53;};}function handleError(_0x3be557,_0x188b0d){_0x188b0d=_0x188b0d||0x1f4;return function(_0x5c3172){logger[_0x7981('0x23')](_0x5c3172[_0x7981('0x24')]);if(_0x5c3172[_0x7981('0x25')]){delete _0x5c3172[_0x7981('0x25')];}_0x3be557[_0x7981('0x17')](_0x188b0d)[_0x7981('0x26')](_0x5c3172);};}exports[_0x7981('0x27')]=function(_0x56575a,_0x4c09ab){var _0x127712={},_0x4a2882={},_0x1d56c0={'count':0x0,'rows':[]};var _0xd63930=_[_0x7981('0x28')](db[_0x7981('0x29')][_0x7981('0x2a')],function(_0x4110e6){return{'name':_0x4110e6[_0x7981('0x2b')],'type':_0x4110e6[_0x7981('0x2c')][_0x7981('0x2d')]};});_0x4a2882[_0x7981('0x2e')]=_['map'](_0xd63930,_0x7981('0x25'));_0x4a2882[_0x7981('0x2f')]=_[_0x7981('0x30')](_0x56575a[_0x7981('0x2f')]);_0x4a2882[_0x7981('0x31')]=_[_0x7981('0x32')](_0x4a2882[_0x7981('0x2e')],_0x4a2882[_0x7981('0x2f')]);_0x127712[_0x7981('0x33')]=_[_0x7981('0x32')](_0x4a2882[_0x7981('0x2e')],qs[_0x7981('0x34')](_0x56575a[_0x7981('0x2f')][_0x7981('0x34')]));_0x127712[_0x7981('0x33')]=_0x127712[_0x7981('0x33')][_0x7981('0x35')]?_0x127712[_0x7981('0x33')]:_0x4a2882[_0x7981('0x2e')];if(!_0x56575a[_0x7981('0x2f')][_0x7981('0x36')](_0x7981('0x37'))){_0x127712['limit']=qs[_0x7981('0x1b')](_0x56575a[_0x7981('0x2f')][_0x7981('0x1b')]);_0x127712[_0x7981('0x1a')]=qs[_0x7981('0x1a')](_0x56575a[_0x7981('0x2f')][_0x7981('0x1a')]);}_0x127712[_0x7981('0x38')]=qs['sort'](_0x56575a[_0x7981('0x2f')][_0x7981('0x39')]);_0x127712[_0x7981('0x3a')]=qs[_0x7981('0x31')](_[_0x7981('0x3b')](_0x56575a[_0x7981('0x2f')],_0x4a2882[_0x7981('0x31')]),_0xd63930);if(_0x56575a['query'][_0x7981('0x3c')]){_0x127712[_0x7981('0x3a')]=_[_0x7981('0x3d')](_0x127712['where'],{'$or':_[_0x7981('0x28')](_0xd63930,function(_0x32217a){if(_0x32217a[_0x7981('0x2c')]!=='VIRTUAL'){var _0x46b0de={};_0x46b0de[_0x32217a[_0x7981('0x25')]]={'$like':'%'+_0x56575a[_0x7981('0x2f')][_0x7981('0x3c')]+'%'};return _0x46b0de;}})});}_0x127712=_['merge']({},_0x127712,_0x56575a[_0x7981('0x3e')]);var _0x4f4cc2={'where':_0x127712[_0x7981('0x3a')]};return db[_0x7981('0x29')][_0x7981('0x3f')](_0x4f4cc2)[_0x7981('0x21')](function(_0x4d351f){_0x1d56c0['count']=_0x4d351f;if(_0x56575a['query'][_0x7981('0x40')]){_0x127712[_0x7981('0x41')]=[{'all':!![]}];}return db[_0x7981('0x29')][_0x7981('0x42')](_0x127712);})[_0x7981('0x21')](function(_0x164ba2){_0x1d56c0[_0x7981('0x43')]=_0x164ba2;return _0x1d56c0;})[_0x7981('0x21')](respondWithFilteredResult(_0x4c09ab,_0x127712))[_0x7981('0x44')](handleError(_0x4c09ab,null));};exports['show']=function(_0x393183,_0x1d2e11){var _0x4ae7b3={'raw':!![],'where':{'id':_0x393183[_0x7981('0x45')]['id']}},_0x2bbf01={};_0x2bbf01['model']=_[_0x7981('0x30')](db[_0x7981('0x29')][_0x7981('0x2a')]);_0x2bbf01[_0x7981('0x2f')]=_[_0x7981('0x30')](_0x393183[_0x7981('0x2f')]);_0x2bbf01[_0x7981('0x31')]=_[_0x7981('0x32')](_0x2bbf01[_0x7981('0x2e')],_0x2bbf01['query']);_0x4ae7b3[_0x7981('0x33')]=_['intersection'](_0x2bbf01[_0x7981('0x2e')],qs[_0x7981('0x34')](_0x393183[_0x7981('0x2f')][_0x7981('0x34')]));_0x4ae7b3[_0x7981('0x33')]=_0x4ae7b3[_0x7981('0x33')]['length']?_0x4ae7b3[_0x7981('0x33')]:_0x2bbf01['model'];if(_0x393183[_0x7981('0x2f')][_0x7981('0x40')]){_0x4ae7b3[_0x7981('0x41')]=[{'all':!![]}];}_0x4ae7b3=_[_0x7981('0x3d')]({},_0x4ae7b3,_0x393183[_0x7981('0x3e')]);return db[_0x7981('0x29')]['find'](_0x4ae7b3)[_0x7981('0x21')](handleEntityNotFound(_0x1d2e11,null))[_0x7981('0x21')](respondWithResult(_0x1d2e11,null))[_0x7981('0x44')](handleError(_0x1d2e11,null));};exports[_0x7981('0x46')]=function(_0x36b476,_0x5c9538){return db[_0x7981('0x29')][_0x7981('0x46')](_0x36b476[_0x7981('0x47')],{})[_0x7981('0x21')](respondWithResult(_0x5c9538,0xc9))[_0x7981('0x44')](handleError(_0x5c9538,null));};exports[_0x7981('0x48')]=function(_0x32f0ba,_0x2044a5){if(_0x32f0ba[_0x7981('0x47')]['id']){delete _0x32f0ba[_0x7981('0x47')]['id'];}return db[_0x7981('0x29')][_0x7981('0x49')]({'where':{'id':_0x32f0ba[_0x7981('0x45')]['id']}})[_0x7981('0x21')](handleEntityNotFound(_0x2044a5,null))[_0x7981('0x21')](saveUpdates(_0x32f0ba['body'],null))[_0x7981('0x21')](respondWithResult(_0x2044a5,null))[_0x7981('0x44')](handleError(_0x2044a5,null));};exports[_0x7981('0x4a')]=function(_0x78fe3f,_0x38d859){return db[_0x7981('0x29')][_0x7981('0x49')]({'where':{'id':_0x78fe3f['params']['id']}})['then'](handleEntityNotFound(_0x38d859,null))[_0x7981('0x21')](removeEntity(_0x38d859,null))[_0x7981('0x44')](handleError(_0x38d859,null));};exports[_0x7981('0x4b')]=function(_0x53605a,_0x49c385){return db[_0x7981('0x29')][_0x7981('0x4b')]()[_0x7981('0x21')](respondWithResult(_0x49c385,null))[_0x7981('0x44')](handleError(_0x49c385,null));}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.model.js b/server/api/faxQueueReport/faxQueueReport.model.js index 7414a0c..9475160 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 _0x09df=['../../config/environment','./faxQueueReport.attributes','define','report_fax_queue','uniqueid','lodash','util','api','request-promise'];(function(_0x32c074,_0x121556){var _0x3a966a=function(_0x3cf551){while(--_0x3cf551){_0x32c074['push'](_0x32c074['shift']());}};_0x3a966a(++_0x121556);}(_0x09df,0x164));var _0xf09d=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0x09df[_0x19950b];return _0x3c6b41;};'use strict';var _=require(_0xf09d('0x0'));var util=require(_0xf09d('0x1'));var logger=require('../../config/logger')(_0xf09d('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xf09d('0x3'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xf09d('0x4'));var attributes=require(_0xf09d('0x5'));module['exports']=function(_0x4db4e7,_0x4b452b){return _0x4db4e7[_0xf09d('0x6')]('FaxQueueReport',attributes,{'tableName':_0xf09d('0x7'),'paranoid':![],'indexes':[{'name':_0xf09d('0x8'),'fields':[_0xf09d('0x8')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xf65d=['path','exports','define','report_fax_queue','uniqueid','lodash','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x234a7b,_0x4d22ca){var _0x21aef1=function(_0x289d67){while(--_0x289d67){_0x234a7b['push'](_0x234a7b['shift']());}};_0x21aef1(++_0x4d22ca);}(_0xf65d,0x9f));var _0xdf65=function(_0xe24841,_0x2c0f66){_0xe24841=_0xe24841-0x0;var _0x2e41b3=_0xf65d[_0xe24841];return _0x2e41b3;};'use strict';var _=require(_0xdf65('0x0'));var util=require('util');var logger=require(_0xdf65('0x1'))(_0xdf65('0x2'));var moment=require(_0xdf65('0x3'));var BPromise=require(_0xdf65('0x4'));var rp=require(_0xdf65('0x5'));var fs=require('fs');var path=require(_0xdf65('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./faxQueueReport.attributes');module[_0xdf65('0x7')]=function(_0x4ac44a,_0x254ddf){return _0x4ac44a[_0xdf65('0x8')]('FaxQueueReport',attributes,{'tableName':_0xdf65('0x9'),'paranoid':![],'indexes':[{'name':_0xdf65('0xa'),'fields':[_0xdf65('0xa')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.rpc.js b/server/api/faxQueueReport/faxQueueReport.rpc.js index 618d52a..65999b3 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 _0xcb87=['UpdateFaxQueueReport','update','where','attributes','limit','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','FaxQueueReport,\x20%s,\x20%s','request\x20sent','FaxQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','CreateFaxQueueReport','FaxQueueReport','create','body','options','raw','debug'];(function(_0x56dac8,_0xf9f741){var _0x1c0ad6=function(_0x220f2b){while(--_0x220f2b){_0x56dac8['push'](_0x56dac8['shift']());}};_0x1c0ad6(++_0xf9f741);}(_0xcb87,0x125));var _0x7cb8=function(_0x51bda1,_0x44f80d){_0x51bda1=_0x51bda1-0x0;var _0x1ce08c=_0xcb87[_0x51bda1];return _0x1ce08c;};'use strict';var _=require(_0x7cb8('0x0'));var util=require(_0x7cb8('0x1'));var moment=require(_0x7cb8('0x2'));var BPromise=require(_0x7cb8('0x3'));var rs=require(_0x7cb8('0x4'));var fs=require('fs');var Redis=require(_0x7cb8('0x5'));var db=require(_0x7cb8('0x6'))['db'];var utils=require(_0x7cb8('0x7'));var logger=require(_0x7cb8('0x8'))('rpc');var config=require(_0x7cb8('0x9'));var jayson=require(_0x7cb8('0xa'));var client=jayson[_0x7cb8('0xb')][_0x7cb8('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x4fd89c,_0x399705,_0x1b18f8){return new BPromise(function(_0x63b6fb,_0x17b27d){return client[_0x7cb8('0xd')](_0x4fd89c,_0x1b18f8)[_0x7cb8('0xe')](function(_0x3da5da){logger[_0x7cb8('0xf')](_0x7cb8('0x10'),_0x399705,_0x7cb8('0x11'));logger['debug'](_0x7cb8('0x12'),_0x399705,_0x7cb8('0x11'),JSON[_0x7cb8('0x13')](_0x3da5da));if(_0x3da5da[_0x7cb8('0x14')]){if(_0x3da5da[_0x7cb8('0x14')][_0x7cb8('0x15')]===0x1f4){logger['error'](_0x7cb8('0x10'),_0x399705,_0x3da5da[_0x7cb8('0x14')][_0x7cb8('0x16')]);return _0x17b27d(_0x3da5da[_0x7cb8('0x14')][_0x7cb8('0x16')]);}logger['error'](_0x7cb8('0x10'),_0x399705,_0x3da5da[_0x7cb8('0x14')][_0x7cb8('0x16')]);return _0x63b6fb(_0x3da5da[_0x7cb8('0x14')][_0x7cb8('0x16')]);}else{logger[_0x7cb8('0xf')](_0x7cb8('0x10'),_0x399705,'request\x20sent');_0x63b6fb(_0x3da5da['result'][_0x7cb8('0x16')]);}})[_0x7cb8('0x17')](function(_0x5e7851){logger[_0x7cb8('0x14')](_0x7cb8('0x10'),_0x399705,_0x5e7851);_0x17b27d(_0x5e7851);});});}exports[_0x7cb8('0x18')]=function(_0x38a2c6){var _0xc5169b=this;return new Promise(function(_0x17aa22,_0x406af0){return db[_0x7cb8('0x19')][_0x7cb8('0x1a')](_0x38a2c6[_0x7cb8('0x1b')],{'raw':_0x38a2c6[_0x7cb8('0x1c')]?_0x38a2c6['options'][_0x7cb8('0x1d')]===undefined?!![]:![]:!![]})['then'](function(_0x3760f3){logger['info']('CreateFaxQueueReport',_0x38a2c6);logger[_0x7cb8('0x1e')](_0x7cb8('0x18'),_0x38a2c6,JSON[_0x7cb8('0x13')](_0x3760f3));_0x17aa22(_0x3760f3);})['catch'](function(_0x272cca){logger[_0x7cb8('0x14')](_0x7cb8('0x18'),_0x272cca[_0x7cb8('0x16')],_0x38a2c6);_0x406af0(_0xc5169b[_0x7cb8('0x14')](0x1f4,_0x272cca['message']));});});};exports[_0x7cb8('0x1f')]=function(_0x4d9108){var _0x222991=this;return new Promise(function(_0x47094c,_0x449907){return db[_0x7cb8('0x19')][_0x7cb8('0x20')](_0x4d9108[_0x7cb8('0x1b')],{'raw':_0x4d9108[_0x7cb8('0x1c')]?_0x4d9108[_0x7cb8('0x1c')][_0x7cb8('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4d9108[_0x7cb8('0x1c')]?_0x4d9108[_0x7cb8('0x1c')][_0x7cb8('0x21')]||null:null,'attributes':_0x4d9108[_0x7cb8('0x1c')]?_0x4d9108[_0x7cb8('0x1c')][_0x7cb8('0x22')]||null:null,'limit':_0x4d9108['options']?_0x4d9108[_0x7cb8('0x1c')][_0x7cb8('0x23')]||null:null})[_0x7cb8('0xe')](function(_0x32b7c5){logger['info'](_0x7cb8('0x1f'),_0x4d9108);logger[_0x7cb8('0x1e')](_0x7cb8('0x1f'),_0x4d9108,JSON[_0x7cb8('0x13')](_0x32b7c5));_0x47094c(_0x32b7c5);})[_0x7cb8('0x17')](function(_0x44a3aa){logger[_0x7cb8('0x14')](_0x7cb8('0x1f'),_0x44a3aa[_0x7cb8('0x16')],_0x4d9108);_0x449907(_0x222991['error'](0x1f4,_0x44a3aa['message']));});});}; \ No newline at end of file +var _0x997b=['result','catch','CreateFaxQueueReport','FaxQueueReport','create','UpdateFaxQueueReport','update','body','options','raw','where','attributes','limit','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','FaxQueueReport,\x20%s,\x20%s','debug','FaxQueueReport,\x20%s,\x20%s,\x20%s','request\x20sent','code','message','error'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0x997b,0x175));var _0xb997=function(_0x487bce,_0xd11228){_0x487bce=_0x487bce-0x0;var _0x17ba7a=_0x997b[_0x487bce];return _0x17ba7a;};'use strict';var _=require(_0xb997('0x0'));var util=require(_0xb997('0x1'));var moment=require(_0xb997('0x2'));var BPromise=require(_0xb997('0x3'));var rs=require(_0xb997('0x4'));var fs=require('fs');var Redis=require(_0xb997('0x5'));var db=require(_0xb997('0x6'))['db'];var utils=require(_0xb997('0x7'));var logger=require(_0xb997('0x8'))('rpc');var config=require(_0xb997('0x9'));var jayson=require(_0xb997('0xa'));var client=jayson[_0xb997('0xb')][_0xb997('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x498122,_0x45da65,_0x1b5275){return new BPromise(function(_0x255656,_0x3852b2){return client[_0xb997('0xd')](_0x498122,_0x1b5275)[_0xb997('0xe')](function(_0x4f92ae){logger[_0xb997('0xf')](_0xb997('0x10'),_0x45da65,'request\x20sent');logger[_0xb997('0x11')](_0xb997('0x12'),_0x45da65,_0xb997('0x13'),JSON['stringify'](_0x4f92ae));if(_0x4f92ae['error']){if(_0x4f92ae['error'][_0xb997('0x14')]===0x1f4){logger['error']('FaxQueueReport,\x20%s,\x20%s',_0x45da65,_0x4f92ae['error'][_0xb997('0x15')]);return _0x3852b2(_0x4f92ae[_0xb997('0x16')]['message']);}logger['error']('FaxQueueReport,\x20%s,\x20%s',_0x45da65,_0x4f92ae[_0xb997('0x16')][_0xb997('0x15')]);return _0x255656(_0x4f92ae[_0xb997('0x16')][_0xb997('0x15')]);}else{logger[_0xb997('0xf')](_0xb997('0x10'),_0x45da65,_0xb997('0x13'));_0x255656(_0x4f92ae[_0xb997('0x17')][_0xb997('0x15')]);}})[_0xb997('0x18')](function(_0x1ba356){logger['error'](_0xb997('0x10'),_0x45da65,_0x1ba356);_0x3852b2(_0x1ba356);});});}exports[_0xb997('0x19')]=function(_0x40e438){var _0x3e83b8=this;return new Promise(function(_0x4d1342,_0x27804a){return db[_0xb997('0x1a')][_0xb997('0x1b')](_0x40e438['body'],{'raw':_0x40e438['options']?_0x40e438['options']['raw']===undefined?!![]:![]:!![]})[_0xb997('0xe')](function(_0x51e9e5){logger[_0xb997('0xf')](_0xb997('0x19'),_0x40e438);logger['debug'](_0xb997('0x19'),_0x40e438,JSON['stringify'](_0x51e9e5));_0x4d1342(_0x51e9e5);})['catch'](function(_0xf143ec){logger[_0xb997('0x16')](_0xb997('0x19'),_0xf143ec['message'],_0x40e438);_0x27804a(_0x3e83b8[_0xb997('0x16')](0x1f4,_0xf143ec[_0xb997('0x15')]));});});};exports[_0xb997('0x1c')]=function(_0x5ce52b){var _0x1626e1=this;return new Promise(function(_0x441b20,_0x316bff){return db[_0xb997('0x1a')][_0xb997('0x1d')](_0x5ce52b[_0xb997('0x1e')],{'raw':_0x5ce52b[_0xb997('0x1f')]?_0x5ce52b['options'][_0xb997('0x20')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5ce52b[_0xb997('0x1f')]?_0x5ce52b[_0xb997('0x1f')][_0xb997('0x21')]||null:null,'attributes':_0x5ce52b[_0xb997('0x1f')]?_0x5ce52b[_0xb997('0x1f')][_0xb997('0x22')]||null:null,'limit':_0x5ce52b['options']?_0x5ce52b[_0xb997('0x1f')][_0xb997('0x23')]||null:null})['then'](function(_0x2401b2){logger[_0xb997('0xf')](_0xb997('0x1c'),_0x5ce52b);logger[_0xb997('0x11')](_0xb997('0x1c'),_0x5ce52b,JSON['stringify'](_0x2401b2));_0x441b20(_0x2401b2);})[_0xb997('0x18')](function(_0x2f7d85){logger['error'](_0xb997('0x1c'),_0x2f7d85[_0xb997('0x15')],_0x5ce52b);_0x316bff(_0x1626e1[_0xb997('0x16')](0x1f4,_0x2f7d85[_0xb997('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/faxQueueReport/index.js b/server/api/faxQueueReport/index.js index 198a560..b7ed02a 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 _0x1557=['post','update','delete','destroy','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./faxQueueReport.controller','isAuthenticated','/describe','describe','get','/:id','show'];(function(_0x431247,_0x4777c7){var _0x361f2a=function(_0x11fe73){while(--_0x11fe73){_0x431247['push'](_0x431247['shift']());}};_0x361f2a(++_0x4777c7);}(_0x1557,0x77));var _0x7155=function(_0x51fa53,_0x437eb2){_0x51fa53=_0x51fa53-0x0;var _0x40144a=_0x1557[_0x51fa53];return _0x40144a;};'use strict';var multer=require(_0x7155('0x0'));var util=require('util');var path=require(_0x7155('0x1'));var timeout=require(_0x7155('0x2'));var express=require(_0x7155('0x3'));var router=express[_0x7155('0x4')]();var auth=require(_0x7155('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x7155('0x6'));var controller=require(_0x7155('0x7'));router['get']('/',auth[_0x7155('0x8')](),controller['index']);router['get'](_0x7155('0x9'),auth[_0x7155('0x8')](),controller[_0x7155('0xa')]);router[_0x7155('0xb')](_0x7155('0xc'),auth['isAuthenticated'](),controller[_0x7155('0xd')]);router[_0x7155('0xe')]('/',auth['isAuthenticated'](),controller['create']);router['put']('/:id',auth[_0x7155('0x8')](),controller[_0x7155('0xf')]);router[_0x7155('0x10')]('/:id',auth[_0x7155('0x8')](),controller[_0x7155('0x11')]);module[_0x7155('0x12')]=router; \ No newline at end of file +var _0x16b9=['Router','../../components/interaction/service','../../config/environment','./faxQueueReport.controller','get','/describe','isAuthenticated','/:id','post','create','put','delete','exports','multer','path','connect-timeout','express'];(function(_0x1e1d07,_0x299b1e){var _0x225dce=function(_0x21fb0a){while(--_0x21fb0a){_0x1e1d07['push'](_0x1e1d07['shift']());}};_0x225dce(++_0x299b1e);}(_0x16b9,0x73));var _0x916b=function(_0x5a9c0c,_0x4ec485){_0x5a9c0c=_0x5a9c0c-0x0;var _0x53c77d=_0x16b9[_0x5a9c0c];return _0x53c77d;};'use strict';var multer=require(_0x916b('0x0'));var util=require('util');var path=require(_0x916b('0x1'));var timeout=require(_0x916b('0x2'));var express=require(_0x916b('0x3'));var router=express[_0x916b('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x916b('0x5'));var config=require(_0x916b('0x6'));var controller=require(_0x916b('0x7'));router[_0x916b('0x8')]('/',auth['isAuthenticated'](),controller['index']);router['get'](_0x916b('0x9'),auth[_0x916b('0xa')](),controller['describe']);router[_0x916b('0x8')](_0x916b('0xb'),auth[_0x916b('0xa')](),controller['show']);router[_0x916b('0xc')]('/',auth[_0x916b('0xa')](),controller[_0x916b('0xd')]);router[_0x916b('0xe')](_0x916b('0xb'),auth[_0x916b('0xa')](),controller['update']);router[_0x916b('0xf')]('/:id',auth[_0x916b('0xa')](),controller['destroy']);module[_0x916b('0x10')]=router; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.attributes.js b/server/api/faxTransferReport/faxTransferReport.attributes.js index f6ed58a..793bd11 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 _0xc812=['ENUM','account','agent','queue','NOW','sequelize','exports'];(function(_0x1d4f6d,_0x2d86a3){var _0x5c515f=function(_0x56805d){while(--_0x56805d){_0x1d4f6d['push'](_0x1d4f6d['shift']());}};_0x5c515f(++_0x2d86a3);}(_0xc812,0x1d3));var _0x2c81=function(_0x32704f,_0x7fad76){_0x32704f=_0x32704f-0x0;var _0x5bdc34=_0xc812[_0x32704f];return _0x5bdc34;};'use strict';var moment=require('moment');var Sequelize=require(_0x2c81('0x0'));module[_0x2c81('0x1')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0x2c81('0x2')](_0x2c81('0x3'),_0x2c81('0x4'),_0x2c81('0x5')),'allowNull':![],'defaultValue':_0x2c81('0x5')},'transferredAt':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':Sequelize[_0x2c81('0x6')]}}; \ No newline at end of file +var _0x4dd4=['exports','STRING','ENUM','account','queue','DATE','NOW','moment'];(function(_0x1b6c0c,_0x51ef20){var _0x178991=function(_0x3b6f64){while(--_0x3b6f64){_0x1b6c0c['push'](_0x1b6c0c['shift']());}};_0x178991(++_0x51ef20);}(_0x4dd4,0x1d7));var _0x44dd=function(_0x3c5da1,_0x52b72c){_0x3c5da1=_0x3c5da1-0x0;var _0x8d2d23=_0x4dd4[_0x3c5da1];return _0x8d2d23;};'use strict';var moment=require(_0x44dd('0x0'));var Sequelize=require('sequelize');module[_0x44dd('0x1')]={'uniqueid':{'type':Sequelize[_0x44dd('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x44dd('0x3')](_0x44dd('0x4'),'agent','queue'),'allowNull':![],'defaultValue':_0x44dd('0x5')},'transferredAt':{'type':Sequelize[_0x44dd('0x6')],'allowNull':![],'defaultValue':Sequelize[_0x44dd('0x7')]}}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.controller.js b/server/api/faxTransferReport/faxTransferReport.controller.js index 465a0e5..02f9728 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 _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(_0x24a8e3,_0x31ee31){var _0x392f80=function(_0x3a845d){while(--_0x3a845d){_0x24a8e3['push'](_0x24a8e3['shift']());}};_0x392f80(++_0x31ee31);}(_0x2ef3,0xba));var _0x32ef=function(_0x39f078,_0xe663f6){_0x39f078=_0x39f078-0x0;var _0x311263=_0x2ef3[_0x39f078];return _0x311263;};'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 +var _0x5f66=['show','params','rawAttributes','includeAll','find','create','body','describe','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','sox','to-csv','squel','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','Content-Range','save','update','then','destroy','error','stack','name','index','map','FaxTransferReport','type','key','model','query','keys','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','where','filters','merge','VIRTUAL','options','include','findAll','rows','catch'];(function(_0x3f533b,_0x3b57aa){var _0x290edb=function(_0x45985c){while(--_0x45985c){_0x3f533b['push'](_0x3f533b['shift']());}};_0x290edb(++_0x3b57aa);}(_0x5f66,0x1a0));var _0x65f6=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0x5f66[_0x432682];return _0x463d05;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x65f6('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x65f6('0x1'));var jsonpatch=require(_0x65f6('0x2'));var rp=require(_0x65f6('0x3'));var moment=require(_0x65f6('0x4'));var BPromise=require(_0x65f6('0x5'));var Mustache=require('mustache');var util=require(_0x65f6('0x6'));var path=require('path');var sox=require(_0x65f6('0x7'));var csv=require(_0x65f6('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0x65f6('0x9'));var crypto=require(_0x65f6('0xa'));var jsforce=require(_0x65f6('0xb'));var deskjs=require(_0x65f6('0xc'));var toCsv=require(_0x65f6('0x8'));var querystring=require(_0x65f6('0xd'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x65f6('0xe'));var qs=require(_0x65f6('0xf'));var as=require(_0x65f6('0x10'));var hardwareService=require(_0x65f6('0x11'));var logger=require('../../config/logger')(_0x65f6('0x12'));var utils=require('../../config/utils');var config=require('../../config/environment');var db=require(_0x65f6('0x13'))['db'];function respondWithStatusCode(_0x576875,_0x419819){_0x419819=_0x419819||0xcc;return function(_0x4862a5){if(_0x4862a5){return _0x576875[_0x65f6('0x14')](_0x419819);}return _0x576875[_0x65f6('0x15')](_0x419819)[_0x65f6('0x16')]();};}function respondWithResult(_0x217570,_0x369f96){_0x369f96=_0x369f96||0xc8;return function(_0x1d29fd){if(_0x1d29fd){return _0x217570[_0x65f6('0x15')](_0x369f96)[_0x65f6('0x17')](_0x1d29fd);}};}function respondWithFilteredResult(_0x46dbc6,_0x3440af){return function(_0x59154e){if(_0x59154e){var _0x19b9ff=_0x59154e[_0x65f6('0x18')],_0x49a913=_0x3440af[_0x65f6('0x19')],_0x5dd324=_0x3440af[_0x65f6('0x19')]+_0x3440af[_0x65f6('0x1a')],_0x1693e6;if(_0x5dd324>=_0x19b9ff){_0x5dd324=_0x19b9ff;_0x1693e6=0xc8;}else{_0x1693e6=0xce;}_0x46dbc6[_0x65f6('0x15')](_0x1693e6);return _0x46dbc6[_0x65f6('0x1b')](_0x65f6('0x1c'),_0x49a913+'-'+_0x5dd324+'/'+_0x19b9ff)['json'](_0x59154e);}return null;};}function patchUpdates(_0x4d79a1){return function(_0x2d538c){try{jsonpatch['apply'](_0x2d538c,_0x4d79a1,!![]);}catch(_0x4c81f3){return BPromise['reject'](_0x4c81f3);}return _0x2d538c[_0x65f6('0x1d')]();};}function saveUpdates(_0x21ea88,_0x5114a4){return function(_0x39e19f){if(_0x39e19f){return _0x39e19f[_0x65f6('0x1e')](_0x21ea88)[_0x65f6('0x1f')](function(_0x3876ed){return _0x3876ed;});}return null;};}function removeEntity(_0x219ab2,_0xc139c2){return function(_0x581374){if(_0x581374){return _0x581374[_0x65f6('0x20')]()['then'](function(){_0x219ab2['status'](0xcc)[_0x65f6('0x16')]();});}};}function handleEntityNotFound(_0xd173f4,_0x524e42){return function(_0x1eeaaa){if(!_0x1eeaaa){_0xd173f4[_0x65f6('0x14')](0x194);}return _0x1eeaaa;};}function handleError(_0x2317ce,_0x2774a1){_0x2774a1=_0x2774a1||0x1f4;return function(_0x4f5a69){logger[_0x65f6('0x21')](_0x4f5a69[_0x65f6('0x22')]);if(_0x4f5a69[_0x65f6('0x23')]){delete _0x4f5a69['name'];}_0x2317ce['status'](_0x2774a1)['send'](_0x4f5a69);};}exports[_0x65f6('0x24')]=function(_0x16cde8,_0x4b2292){var _0x296cd9={},_0x28f710={},_0x52277c={'count':0x0,'rows':[]};var _0x325cb4=_[_0x65f6('0x25')](db[_0x65f6('0x26')]['rawAttributes'],function(_0x4ac04b){return{'name':_0x4ac04b['fieldName'],'type':_0x4ac04b[_0x65f6('0x27')][_0x65f6('0x28')]};});_0x28f710[_0x65f6('0x29')]=_[_0x65f6('0x25')](_0x325cb4,_0x65f6('0x23'));_0x28f710[_0x65f6('0x2a')]=_[_0x65f6('0x2b')](_0x16cde8['query']);_0x28f710['filters']=_[_0x65f6('0x2c')](_0x28f710[_0x65f6('0x29')],_0x28f710['query']);_0x296cd9['attributes']=_[_0x65f6('0x2c')](_0x28f710[_0x65f6('0x29')],qs[_0x65f6('0x2d')](_0x16cde8[_0x65f6('0x2a')][_0x65f6('0x2d')]));_0x296cd9[_0x65f6('0x2e')]=_0x296cd9['attributes'][_0x65f6('0x2f')]?_0x296cd9[_0x65f6('0x2e')]:_0x28f710[_0x65f6('0x29')];if(!_0x16cde8['query'][_0x65f6('0x30')](_0x65f6('0x31'))){_0x296cd9[_0x65f6('0x1a')]=qs[_0x65f6('0x1a')](_0x16cde8[_0x65f6('0x2a')][_0x65f6('0x1a')]);_0x296cd9['offset']=qs[_0x65f6('0x19')](_0x16cde8[_0x65f6('0x2a')]['offset']);}_0x296cd9[_0x65f6('0x32')]=qs['sort'](_0x16cde8[_0x65f6('0x2a')]['sort']);_0x296cd9[_0x65f6('0x33')]=qs[_0x65f6('0x34')](_['pick'](_0x16cde8[_0x65f6('0x2a')],_0x28f710[_0x65f6('0x34')]),_0x325cb4);if(_0x16cde8[_0x65f6('0x2a')]['filter']){_0x296cd9['where']=_[_0x65f6('0x35')](_0x296cd9['where'],{'$or':_[_0x65f6('0x25')](_0x325cb4,function(_0x4e6653){if(_0x4e6653[_0x65f6('0x27')]!==_0x65f6('0x36')){var _0x5e97f1={};_0x5e97f1[_0x4e6653[_0x65f6('0x23')]]={'$like':'%'+_0x16cde8['query']['filter']+'%'};return _0x5e97f1;}})});}_0x296cd9=_[_0x65f6('0x35')]({},_0x296cd9,_0x16cde8[_0x65f6('0x37')]);var _0x413956={'where':_0x296cd9[_0x65f6('0x33')]};return db[_0x65f6('0x26')][_0x65f6('0x18')](_0x413956)[_0x65f6('0x1f')](function(_0x1153f1){_0x52277c['count']=_0x1153f1;if(_0x16cde8[_0x65f6('0x2a')]['includeAll']){_0x296cd9[_0x65f6('0x38')]=[{'all':!![]}];}return db[_0x65f6('0x26')][_0x65f6('0x39')](_0x296cd9);})[_0x65f6('0x1f')](function(_0x5ef5c2){_0x52277c[_0x65f6('0x3a')]=_0x5ef5c2;return _0x52277c;})[_0x65f6('0x1f')](respondWithFilteredResult(_0x4b2292,_0x296cd9))[_0x65f6('0x3b')](handleError(_0x4b2292,null));};exports[_0x65f6('0x3c')]=function(_0x81fd69,_0x3f6103){var _0xed4c96={'raw':!![],'where':{'id':_0x81fd69[_0x65f6('0x3d')]['id']}},_0x2acca5={};_0x2acca5['model']=_[_0x65f6('0x2b')](db[_0x65f6('0x26')][_0x65f6('0x3e')]);_0x2acca5[_0x65f6('0x2a')]=_[_0x65f6('0x2b')](_0x81fd69[_0x65f6('0x2a')]);_0x2acca5[_0x65f6('0x34')]=_[_0x65f6('0x2c')](_0x2acca5[_0x65f6('0x29')],_0x2acca5[_0x65f6('0x2a')]);_0xed4c96[_0x65f6('0x2e')]=_[_0x65f6('0x2c')](_0x2acca5[_0x65f6('0x29')],qs[_0x65f6('0x2d')](_0x81fd69[_0x65f6('0x2a')][_0x65f6('0x2d')]));_0xed4c96['attributes']=_0xed4c96[_0x65f6('0x2e')][_0x65f6('0x2f')]?_0xed4c96[_0x65f6('0x2e')]:_0x2acca5[_0x65f6('0x29')];if(_0x81fd69['query'][_0x65f6('0x3f')]){_0xed4c96[_0x65f6('0x38')]=[{'all':!![]}];}_0xed4c96=_[_0x65f6('0x35')]({},_0xed4c96,_0x81fd69['options']);return db[_0x65f6('0x26')][_0x65f6('0x40')](_0xed4c96)[_0x65f6('0x1f')](handleEntityNotFound(_0x3f6103,null))[_0x65f6('0x1f')](respondWithResult(_0x3f6103,null))['catch'](handleError(_0x3f6103,null));};exports[_0x65f6('0x41')]=function(_0x512527,_0x3f1baa){return db[_0x65f6('0x26')]['create'](_0x512527[_0x65f6('0x42')],{})['then'](respondWithResult(_0x3f1baa,0xc9))[_0x65f6('0x3b')](handleError(_0x3f1baa,null));};exports[_0x65f6('0x1e')]=function(_0x2d1706,_0xc0db01){if(_0x2d1706[_0x65f6('0x42')]['id']){delete _0x2d1706[_0x65f6('0x42')]['id'];}return db['FaxTransferReport']['find']({'where':{'id':_0x2d1706[_0x65f6('0x3d')]['id']}})[_0x65f6('0x1f')](handleEntityNotFound(_0xc0db01,null))[_0x65f6('0x1f')](saveUpdates(_0x2d1706[_0x65f6('0x42')],null))[_0x65f6('0x1f')](respondWithResult(_0xc0db01,null))[_0x65f6('0x3b')](handleError(_0xc0db01,null));};exports[_0x65f6('0x20')]=function(_0x41690c,_0x414f49){return db['FaxTransferReport'][_0x65f6('0x40')]({'where':{'id':_0x41690c[_0x65f6('0x3d')]['id']}})[_0x65f6('0x1f')](handleEntityNotFound(_0x414f49,null))['then'](removeEntity(_0x414f49,null))[_0x65f6('0x3b')](handleError(_0x414f49,null));};exports[_0x65f6('0x43')]=function(_0x49ba5a,_0x22d745){return db[_0x65f6('0x26')]['describe']()[_0x65f6('0x1f')](respondWithResult(_0x22d745,null))['catch'](handleError(_0x22d745,null));}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.model.js b/server/api/faxTransferReport/faxTransferReport.model.js index e8ea9de..fc56cf5 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 _0x47c0=['request-promise','path','rimraf','../../config/environment','exports','define','report_fax_transfer','uniqueid','lodash','util','../../config/logger','moment','bluebird'];(function(_0xa7056,_0x4245a3){var _0xc8452d=function(_0x34f537){while(--_0x34f537){_0xa7056['push'](_0xa7056['shift']());}};_0xc8452d(++_0x4245a3);}(_0x47c0,0x1dc));var _0x047c=function(_0x18fd05,_0x47d555){_0x18fd05=_0x18fd05-0x0;var _0x2c76b6=_0x47c0[_0x18fd05];return _0x2c76b6;};'use strict';var _=require(_0x047c('0x0'));var util=require(_0x047c('0x1'));var logger=require(_0x047c('0x2'))('api');var moment=require(_0x047c('0x3'));var BPromise=require(_0x047c('0x4'));var rp=require(_0x047c('0x5'));var fs=require('fs');var path=require(_0x047c('0x6'));var rimraf=require(_0x047c('0x7'));var config=require(_0x047c('0x8'));var attributes=require('./faxTransferReport.attributes');module[_0x047c('0x9')]=function(_0x521b31,_0x11344f){return _0x521b31[_0x047c('0xa')]('FaxTransferReport',attributes,{'tableName':_0x047c('0xb'),'paranoid':![],'indexes':[{'name':_0x047c('0xc'),'fields':[_0x047c('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x4dc0=['bluebird','request-promise','rimraf','../../config/environment','./faxTransferReport.attributes','define','uniqueid','../../config/logger','api','moment'];(function(_0x19903c,_0x5192e4){var _0x222a6c=function(_0x2121ae){while(--_0x2121ae){_0x19903c['push'](_0x19903c['shift']());}};_0x222a6c(++_0x5192e4);}(_0x4dc0,0x13d));var _0x04dc=function(_0x4baae2,_0x487ab6){_0x4baae2=_0x4baae2-0x0;var _0x1a2285=_0x4dc0[_0x4baae2];return _0x1a2285;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x04dc('0x0'))(_0x04dc('0x1'));var moment=require(_0x04dc('0x2'));var BPromise=require(_0x04dc('0x3'));var rp=require(_0x04dc('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x04dc('0x5'));var config=require(_0x04dc('0x6'));var attributes=require(_0x04dc('0x7'));module['exports']=function(_0x224df5,_0x40b21a){return _0x224df5[_0x04dc('0x8')]('FaxTransferReport',attributes,{'tableName':'report_fax_transfer','paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x04dc('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 17f7653..ad3f14a 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 _0x4cdc=['jayson/promise','http','request','then','FaxTransferReport,\x20%s,\x20%s','request\x20sent','debug','FaxTransferReport,\x20%s,\x20%s,\x20%s','code','error','message','info','catch','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x1dbb97,_0xc2e02f){var _0x57612f=function(_0x5e9ffc){while(--_0x5e9ffc){_0x1dbb97['push'](_0x1dbb97['shift']());}};_0x57612f(++_0xc2e02f);}(_0x4cdc,0xb5));var _0xc4cd=function(_0x2cd706,_0x48112d){_0x2cd706=_0x2cd706-0x0;var _0x446369=_0x4cdc[_0x2cd706];return _0x446369;};'use strict';var _=require(_0xc4cd('0x0'));var util=require(_0xc4cd('0x1'));var moment=require('moment');var BPromise=require(_0xc4cd('0x2'));var rs=require(_0xc4cd('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xc4cd('0x4'))['db'];var utils=require(_0xc4cd('0x5'));var logger=require(_0xc4cd('0x6'))(_0xc4cd('0x7'));var config=require('../../config/environment');var jayson=require(_0xc4cd('0x8'));var client=jayson['client'][_0xc4cd('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x412f09,_0x37570a,_0x1609bb){return new BPromise(function(_0x23f5b0,_0x1da3b0){return client[_0xc4cd('0xa')](_0x412f09,_0x1609bb)[_0xc4cd('0xb')](function(_0x356303){logger['info'](_0xc4cd('0xc'),_0x37570a,_0xc4cd('0xd'));logger[_0xc4cd('0xe')](_0xc4cd('0xf'),_0x37570a,'request\x20sent',JSON['stringify'](_0x356303));if(_0x356303['error']){if(_0x356303['error'][_0xc4cd('0x10')]===0x1f4){logger['error']('FaxTransferReport,\x20%s,\x20%s',_0x37570a,_0x356303[_0xc4cd('0x11')][_0xc4cd('0x12')]);return _0x1da3b0(_0x356303['error'][_0xc4cd('0x12')]);}logger[_0xc4cd('0x11')](_0xc4cd('0xc'),_0x37570a,_0x356303[_0xc4cd('0x11')][_0xc4cd('0x12')]);return _0x23f5b0(_0x356303[_0xc4cd('0x11')]['message']);}else{logger[_0xc4cd('0x13')](_0xc4cd('0xc'),_0x37570a,_0xc4cd('0xd'));_0x23f5b0(_0x356303['result'][_0xc4cd('0x12')]);}})[_0xc4cd('0x14')](function(_0x48888c){logger[_0xc4cd('0x11')]('FaxTransferReport,\x20%s,\x20%s',_0x37570a,_0x48888c);_0x1da3b0(_0x48888c);});});} \ No newline at end of file +var _0x6e39=['FaxTransferReport,\x20%s,\x20%s','FaxTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','request\x20sent','catch','util','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then'];(function(_0x1662b6,_0x31276f){var _0xafb667=function(_0x17d816){while(--_0x17d816){_0x1662b6['push'](_0x1662b6['shift']());}};_0xafb667(++_0x31276f);}(_0x6e39,0x169));var _0x96e3=function(_0x52ced7,_0x33f680){_0x52ced7=_0x52ced7-0x0;var _0xde7fb=_0x6e39[_0x52ced7];return _0xde7fb;};'use strict';var _=require('lodash');var util=require(_0x96e3('0x0'));var moment=require(_0x96e3('0x1'));var BPromise=require(_0x96e3('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x96e3('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x96e3('0x4'));var logger=require(_0x96e3('0x5'))(_0x96e3('0x6'));var config=require(_0x96e3('0x7'));var jayson=require(_0x96e3('0x8'));var client=jayson[_0x96e3('0x9')][_0x96e3('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1c5d8f,_0x45bc94,_0x28d4e8){return new BPromise(function(_0x507a99,_0x34dd5d){return client[_0x96e3('0xb')](_0x1c5d8f,_0x28d4e8)[_0x96e3('0xc')](function(_0x41e2c6){logger['info'](_0x96e3('0xd'),_0x45bc94,'request\x20sent');logger['debug'](_0x96e3('0xe'),_0x45bc94,'request\x20sent',JSON[_0x96e3('0xf')](_0x41e2c6));if(_0x41e2c6[_0x96e3('0x10')]){if(_0x41e2c6['error'][_0x96e3('0x11')]===0x1f4){logger[_0x96e3('0x10')](_0x96e3('0xd'),_0x45bc94,_0x41e2c6[_0x96e3('0x10')][_0x96e3('0x12')]);return _0x34dd5d(_0x41e2c6[_0x96e3('0x10')][_0x96e3('0x12')]);}logger['error']('FaxTransferReport,\x20%s,\x20%s',_0x45bc94,_0x41e2c6[_0x96e3('0x10')]['message']);return _0x507a99(_0x41e2c6[_0x96e3('0x10')]['message']);}else{logger[_0x96e3('0x13')](_0x96e3('0xd'),_0x45bc94,_0x96e3('0x14'));_0x507a99(_0x41e2c6['result'][_0x96e3('0x12')]);}})[_0x96e3('0x15')](function(_0x2b2535){logger[_0x96e3('0x10')](_0x96e3('0xd'),_0x45bc94,_0x2b2535);_0x34dd5d(_0x2b2535);});});} \ No newline at end of file diff --git a/server/api/faxTransferReport/index.js b/server/api/faxTransferReport/index.js index 6f1c158..81ff6c8 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 _0x6128=['show','post','create','put','destroy','exports','multer','connect-timeout','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','describe','/:id'];(function(_0x5a9c0c,_0x4ec485){var _0x53c77d=function(_0x1cf384){while(--_0x1cf384){_0x5a9c0c['push'](_0x5a9c0c['shift']());}};_0x53c77d(++_0x4ec485);}(_0x6128,0x7e));var _0x8612=function(_0x3f93aa,_0x18c17c){_0x3f93aa=_0x3f93aa-0x0;var _0x5453cf=_0x6128[_0x3f93aa];return _0x5453cf;};'use strict';var multer=require(_0x8612('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x8612('0x1'));var express=require('express');var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0x8612('0x2'));var config=require(_0x8612('0x3'));var controller=require('./faxTransferReport.controller');router['get']('/',auth[_0x8612('0x4')](),controller[_0x8612('0x5')]);router[_0x8612('0x6')]('/describe',auth[_0x8612('0x4')](),controller[_0x8612('0x7')]);router[_0x8612('0x6')](_0x8612('0x8'),auth['isAuthenticated'](),controller[_0x8612('0x9')]);router[_0x8612('0xa')]('/',auth[_0x8612('0x4')](),controller[_0x8612('0xb')]);router[_0x8612('0xc')]('/:id',auth['isAuthenticated'](),controller['update']);router['delete'](_0x8612('0x8'),auth[_0x8612('0x4')](),controller[_0x8612('0xd')]);module[_0x8612('0xe')]=router; \ No newline at end of file +var _0xe77e=['util','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxTransferReport.controller','get','/describe','describe','/:id','isAuthenticated','show','delete','destroy','exports','multer'];(function(_0x465ccf,_0x486b3d){var _0x1d1bce=function(_0x469c1f){while(--_0x469c1f){_0x465ccf['push'](_0x465ccf['shift']());}};_0x1d1bce(++_0x486b3d);}(_0xe77e,0x1a8));var _0xee77=function(_0x5e0d05,_0x27706f){_0x5e0d05=_0x5e0d05-0x0;var _0x21a290=_0xe77e[_0x5e0d05];return _0x21a290;};'use strict';var multer=require(_0xee77('0x0'));var util=require(_0xee77('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xee77('0x2'));var router=express[_0xee77('0x3')]();var auth=require(_0xee77('0x4'));var interaction=require(_0xee77('0x5'));var config=require(_0xee77('0x6'));var controller=require(_0xee77('0x7'));router[_0xee77('0x8')]('/',auth['isAuthenticated'](),controller['index']);router[_0xee77('0x8')](_0xee77('0x9'),auth['isAuthenticated'](),controller[_0xee77('0xa')]);router[_0xee77('0x8')](_0xee77('0xb'),auth[_0xee77('0xc')](),controller[_0xee77('0xd')]);router['post']('/',auth[_0xee77('0xc')](),controller['create']);router['put'](_0xee77('0xb'),auth['isAuthenticated'](),controller['update']);router[_0xee77('0xe')]('/:id',auth[_0xee77('0xc')](),controller[_0xee77('0xf')]);module[_0xee77('0x10')]=router; \ No newline at end of file diff --git a/server/api/intDeskAccount/index.js b/server/api/intDeskAccount/index.js index 80a6227..037beb7 100644 --- a/server/api/intDeskAccount/index.js +++ b/server/api/intDeskAccount/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x6f47=['destroy','util','path','express','../../components/auth/service','../../config/environment','./intDeskAccount.controller','get','isAuthenticated','/:id','/:id/configurations','getConfigurations','getFields','post','addConfiguration','put','update','delete'];(function(_0x46d0c9,_0x526bfa){var _0x174506=function(_0x654bc6){while(--_0x654bc6){_0x46d0c9['push'](_0x46d0c9['shift']());}};_0x174506(++_0x526bfa);}(_0x6f47,0xc7));var _0x76f4=function(_0x465028,_0x4570ac){_0x465028=_0x465028-0x0;var _0xb783d4=_0x6f47[_0x465028];return _0xb783d4;};'use strict';var multer=require('multer');var util=require(_0x76f4('0x0'));var path=require(_0x76f4('0x1'));var timeout=require('connect-timeout');var express=require(_0x76f4('0x2'));var router=express['Router']();var auth=require(_0x76f4('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0x76f4('0x4'));var controller=require(_0x76f4('0x5'));router[_0x76f4('0x6')]('/',auth[_0x76f4('0x7')](),controller['index']);router[_0x76f4('0x6')](_0x76f4('0x8'),auth[_0x76f4('0x7')](),controller['show']);router[_0x76f4('0x6')](_0x76f4('0x9'),auth[_0x76f4('0x7')](),controller[_0x76f4('0xa')]);router[_0x76f4('0x6')]('/:id/fields',auth['isAuthenticated'](),controller[_0x76f4('0xb')]);router[_0x76f4('0xc')]('/',auth['isAuthenticated'](),controller['create']);router[_0x76f4('0xc')](_0x76f4('0x9'),auth[_0x76f4('0x7')](),controller[_0x76f4('0xd')]);router[_0x76f4('0xe')](_0x76f4('0x8'),auth[_0x76f4('0x7')](),controller[_0x76f4('0xf')]);router[_0x76f4('0x10')]('/:id',auth[_0x76f4('0x7')](),controller[_0x76f4('0x11')]);module['exports']=router; \ No newline at end of file +var _0x5577=['path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDeskAccount.controller','get','index','/:id','isAuthenticated','show','/:id/configurations','getConfigurations','/:id/fields','getFields','post','addConfiguration','put','update','delete','exports','multer'];(function(_0x1a36a5,_0x746928){var _0x746243=function(_0x481966){while(--_0x481966){_0x1a36a5['push'](_0x1a36a5['shift']());}};_0x746243(++_0x746928);}(_0x5577,0x1b4));var _0x7557=function(_0x5a7b0e,_0x4794cf){_0x5a7b0e=_0x5a7b0e-0x0;var _0x452a68=_0x5577[_0x5a7b0e];return _0x452a68;};'use strict';var multer=require(_0x7557('0x0'));var util=require('util');var path=require(_0x7557('0x1'));var timeout=require(_0x7557('0x2'));var express=require('express');var router=express[_0x7557('0x3')]();var auth=require(_0x7557('0x4'));var interaction=require(_0x7557('0x5'));var config=require(_0x7557('0x6'));var controller=require(_0x7557('0x7'));router[_0x7557('0x8')]('/',auth['isAuthenticated'](),controller[_0x7557('0x9')]);router[_0x7557('0x8')](_0x7557('0xa'),auth[_0x7557('0xb')](),controller[_0x7557('0xc')]);router[_0x7557('0x8')](_0x7557('0xd'),auth[_0x7557('0xb')](),controller[_0x7557('0xe')]);router[_0x7557('0x8')](_0x7557('0xf'),auth[_0x7557('0xb')](),controller[_0x7557('0x10')]);router[_0x7557('0x11')]('/',auth[_0x7557('0xb')](),controller['create']);router['post'](_0x7557('0xd'),auth[_0x7557('0xb')](),controller[_0x7557('0x12')]);router[_0x7557('0x13')](_0x7557('0xa'),auth[_0x7557('0xb')](),controller[_0x7557('0x14')]);router[_0x7557('0x15')](_0x7557('0xa'),auth[_0x7557('0xb')](),controller['destroy']);module[_0x7557('0x16')]=router; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.attributes.js b/server/api/intDeskAccount/intDeskAccount.attributes.js index 00a3f02..41a8507 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 _0x40b4=['exports','STRING','ENUM','basic','integrationTab','newTab','sequelize'];(function(_0x39e84d,_0x11931d){var _0x1991bc=function(_0xc81e32){while(--_0xc81e32){_0x39e84d['push'](_0x39e84d['shift']());}};_0x1991bc(++_0x11931d);}(_0x40b4,0x76));var _0x440b=function(_0x1f77be,_0x1ea03c){_0x1f77be=_0x1f77be-0x0;var _0x349b38=_0x40b4[_0x1f77be];return _0x349b38;};'use strict';var Sequelize=require(_0x440b('0x0'));module[_0x440b('0x1')]={'name':{'type':Sequelize[_0x440b('0x2')]},'description':{'type':Sequelize[_0x440b('0x2')]},'username':{'type':Sequelize[_0x440b('0x2')]},'remoteUri':{'type':Sequelize[_0x440b('0x2')]},'authType':{'type':Sequelize[_0x440b('0x3')]('basic'),'defaultValue':_0x440b('0x4')},'password':{'type':Sequelize['STRING']},'consumerKey':{'type':Sequelize[_0x440b('0x2')]},'consumerSecret':{'type':Sequelize[_0x440b('0x2')]},'token':{'type':Sequelize[_0x440b('0x2')]},'tokenSecret':{'type':Sequelize[_0x440b('0x2')]},'serverUrl':{'type':Sequelize[_0x440b('0x2')]},'type':{'type':Sequelize[_0x440b('0x3')](_0x440b('0x5'),_0x440b('0x6')),'defaultValue':'integrationTab'}}; \ No newline at end of file +var _0x8414=['integrationTab','newTab','sequelize','exports','STRING','ENUM','basic'];(function(_0x6ca7e8,_0xe79539){var _0x3dfbe=function(_0x25a9d8){while(--_0x25a9d8){_0x6ca7e8['push'](_0x6ca7e8['shift']());}};_0x3dfbe(++_0xe79539);}(_0x8414,0xb8));var _0x4841=function(_0x2e04ef,_0x31a596){_0x2e04ef=_0x2e04ef-0x0;var _0x5722b0=_0x8414[_0x2e04ef];return _0x5722b0;};'use strict';var Sequelize=require(_0x4841('0x0'));module[_0x4841('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x4841('0x2')]},'username':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0x4841('0x2')]},'authType':{'type':Sequelize[_0x4841('0x3')](_0x4841('0x4')),'defaultValue':_0x4841('0x4')},'password':{'type':Sequelize[_0x4841('0x2')]},'consumerKey':{'type':Sequelize[_0x4841('0x2')]},'consumerSecret':{'type':Sequelize['STRING']},'token':{'type':Sequelize[_0x4841('0x2')]},'tokenSecret':{'type':Sequelize[_0x4841('0x2')]},'serverUrl':{'type':Sequelize[_0x4841('0x2')]},'type':{'type':Sequelize[_0x4841('0x3')](_0x4841('0x5'),_0x4841('0x6')),'defaultValue':_0x4841('0x5')}}; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.controller.js b/server/api/intDeskAccount/intDeskAccount.controller.js index 84cc2e9..55835fe 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 _0xb625=['filter','merge','map','options','DeskAccount','findAll','rows','show','params','includeAll','include','find','create','body','update','getConfigurations','findOne','DeskConfiguration','hasOwnProperty','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','DeskField','getFields','priority','remoteUri','username','consumerSecret','token','substring','lastIndexOf','GET','format','%s/custom_fields','application/json','authType','basic','headers','Authorization','Basic\x20%s','%s:%s','password','toString','base64','concat','_embedded','active','label','statusCode','send','Wrong\x20credentials','html-pdf','eml-format','rimraf','fast-json-patch','bluebird','util','path','sox','ejs','lodash','squel','crypto','jsforce','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','jayson/promise','client','test','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','info','DeskAccount,\x20%s,\x20%s','request\x20sent','DeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','status','end','json','count','offset','limit','Content-Range','apply','reject','destroy','stack','name','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','length','order','sort','where','pick'];(function(_0x74e789,_0x2915ef){var _0x31161c=function(_0x2dfcab){while(--_0x2dfcab){_0x74e789['push'](_0x74e789['shift']());}};_0x31161c(++_0x2915ef);}(_0xb625,0x12f));var _0x5b62=function(_0x25e65e,_0x2039aa){_0x25e65e=_0x25e65e-0x0;var _0x5c69a6=_0xb625[_0x25e65e];return _0x5c69a6;};'use strict';var pdf=require(_0x5b62('0x0'));var emlformat=require(_0x5b62('0x1'));var rimraf=require(_0x5b62('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x5b62('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x5b62('0x4'));var Mustache=require('mustache');var util=require(_0x5b62('0x5'));var path=require(_0x5b62('0x6'));var sox=require(_0x5b62('0x7'));var csv=require('to-csv');var ejs=require(_0x5b62('0x8'));var fs=require('fs');var _=require(_0x5b62('0x9'));var squel=require(_0x5b62('0xa'));var crypto=require(_0x5b62('0xb'));var jsforce=require(_0x5b62('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x5b62('0xd'));var querystring=require(_0x5b62('0xe'));var Papa=require(_0x5b62('0xf'));var Redis=require(_0x5b62('0x10'));var authService=require(_0x5b62('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x5b62('0x12'));var hardwareService=require(_0x5b62('0x13'));var logger=require(_0x5b62('0x14'))(_0x5b62('0x15'));var utils=require(_0x5b62('0x16'));var config=require(_0x5b62('0x17'));var db=require(_0x5b62('0x18'))['db'];var integrations=require('../../components/integrations/configuration');var jayson=require(_0x5b62('0x19'));var client=jayson[_0x5b62('0x1a')]['http']({'port':0x232a});function checkPasswordPattern(_0x1428a7,_0x2ece20,_0x5bea17){if(_0x5bea17){var _0x111034=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x111034[_0x5b62('0x1b')](_0x2ece20)){return _0x1428a7;}else{throw new db['Sequelize']['ValidationError'](_0x5b62('0x1c'));}}else{return _0x1428a7;}}function respondWithRpcPromise(_0x1be3e8,_0x532952,_0x63be5,_0x1dc744){return new BPromise(function(_0x2ff40e,_0x1fe73c){var _0x2bf88a=_0x1dc744||client;return _0x2bf88a[_0x5b62('0x1d')](_0x1be3e8,_0x63be5)[_0x5b62('0x1e')](function(_0x50b96e){logger[_0x5b62('0x1f')](_0x5b62('0x20'),_0x532952,_0x5b62('0x21'));logger['debug'](_0x5b62('0x22'),_0x532952,_0x5b62('0x21'),JSON[_0x5b62('0x23')](_0x50b96e));if(_0x50b96e[_0x5b62('0x24')]){if(_0x50b96e['error'][_0x5b62('0x25')]===0x1f4){logger[_0x5b62('0x24')]('DeskAccount,\x20%s,\x20%s',_0x532952,_0x50b96e['error'][_0x5b62('0x26')]);return _0x1fe73c(_0x50b96e[_0x5b62('0x24')][_0x5b62('0x26')]);}logger[_0x5b62('0x24')](_0x5b62('0x20'),_0x532952,_0x50b96e[_0x5b62('0x24')][_0x5b62('0x26')]);return _0x2ff40e(_0x50b96e[_0x5b62('0x24')][_0x5b62('0x26')]);}else{logger[_0x5b62('0x1f')](_0x5b62('0x20'),_0x532952,'request\x20sent');_0x2ff40e(_0x50b96e[_0x5b62('0x27')][_0x5b62('0x26')]);}})[_0x5b62('0x28')](function(_0x262457){logger['error'](_0x5b62('0x20'),_0x532952,_0x262457);_0x1fe73c(_0x262457);});});}function respondWithStatusCode(_0x349805,_0x20a64a){_0x20a64a=_0x20a64a||0xcc;return function(_0x390f6e){if(_0x390f6e){return _0x349805[_0x5b62('0x29')](_0x20a64a);}return _0x349805[_0x5b62('0x2a')](_0x20a64a)[_0x5b62('0x2b')]();};}function respondWithResult(_0x19579a,_0x28a452){_0x28a452=_0x28a452||0xc8;return function(_0x2f5e2a){if(_0x2f5e2a){return _0x19579a[_0x5b62('0x2a')](_0x28a452)[_0x5b62('0x2c')](_0x2f5e2a);}};}function respondWithFilteredResult(_0x44bbeb,_0x437b1f){return function(_0x102d5b){if(_0x102d5b){var _0x3c9cb9=_0x102d5b[_0x5b62('0x2d')],_0x1daedd=_0x437b1f[_0x5b62('0x2e')],_0x5cda23=_0x437b1f[_0x5b62('0x2e')]+_0x437b1f[_0x5b62('0x2f')],_0x177c84;if(_0x5cda23>=_0x3c9cb9){_0x5cda23=_0x3c9cb9;_0x177c84=0xc8;}else{_0x177c84=0xce;}_0x44bbeb[_0x5b62('0x2a')](_0x177c84);return _0x44bbeb['set'](_0x5b62('0x30'),_0x1daedd+'-'+_0x5cda23+'/'+_0x3c9cb9)[_0x5b62('0x2c')](_0x102d5b);}return null;};}function patchUpdates(_0x5ad9c4){return function(_0x30cb5a){try{jsonpatch[_0x5b62('0x31')](_0x30cb5a,_0x5ad9c4,!![]);}catch(_0x26c826){return BPromise[_0x5b62('0x32')](_0x26c826);}return _0x30cb5a['save']();};}function saveUpdates(_0x15e5da,_0x40f804){return function(_0x1dc6e1){if(_0x1dc6e1){return _0x1dc6e1['update'](_0x15e5da)['then'](function(_0x3b0f3c){return _0x3b0f3c;});}return null;};}function removeEntity(_0x4e1731,_0x34b67f){return function(_0x47d7d5){if(_0x47d7d5){return _0x47d7d5[_0x5b62('0x33')]()[_0x5b62('0x1e')](function(){_0x4e1731['status'](0xcc)[_0x5b62('0x2b')]();});}};}function handleEntityNotFound(_0x256b31,_0x1b2b44){return function(_0x1eb100){if(!_0x1eb100){_0x256b31[_0x5b62('0x29')](0x194);}return _0x1eb100;};}function handleError(_0x262e6a,_0x29c285){_0x29c285=_0x29c285||0x1f4;return function(_0x18ffb6){logger['error'](_0x18ffb6[_0x5b62('0x34')]);if(_0x18ffb6['name']){delete _0x18ffb6[_0x5b62('0x35')];}_0x262e6a[_0x5b62('0x2a')](_0x29c285)['send'](_0x18ffb6);};}exports['index']=function(_0x517ef1,_0x2fadb2){var _0x1eb5eb={},_0x449581={},_0x31035f={'count':0x0,'rows':[]};var _0x2423f5=_['map'](db['DeskAccount'][_0x5b62('0x36')],function(_0x140336){return{'name':_0x140336['fieldName'],'type':_0x140336[_0x5b62('0x37')][_0x5b62('0x38')]};});_0x449581[_0x5b62('0x39')]=_['map'](_0x2423f5,_0x5b62('0x35'));_0x449581[_0x5b62('0x3a')]=_[_0x5b62('0x3b')](_0x517ef1[_0x5b62('0x3a')]);_0x449581[_0x5b62('0x3c')]=_[_0x5b62('0x3d')](_0x449581['model'],_0x449581[_0x5b62('0x3a')]);_0x1eb5eb[_0x5b62('0x3e')]=_['intersection'](_0x449581['model'],qs[_0x5b62('0x3f')](_0x517ef1[_0x5b62('0x3a')][_0x5b62('0x3f')]));_0x1eb5eb['attributes']=_0x1eb5eb[_0x5b62('0x3e')][_0x5b62('0x40')]?_0x1eb5eb[_0x5b62('0x3e')]:_0x449581[_0x5b62('0x39')];if(!_0x517ef1[_0x5b62('0x3a')]['hasOwnProperty']('nolimit')){_0x1eb5eb[_0x5b62('0x2f')]=qs[_0x5b62('0x2f')](_0x517ef1[_0x5b62('0x3a')][_0x5b62('0x2f')]);_0x1eb5eb[_0x5b62('0x2e')]=qs[_0x5b62('0x2e')](_0x517ef1[_0x5b62('0x3a')]['offset']);}_0x1eb5eb[_0x5b62('0x41')]=qs['sort'](_0x517ef1['query'][_0x5b62('0x42')]);_0x1eb5eb[_0x5b62('0x43')]=qs[_0x5b62('0x3c')](_[_0x5b62('0x44')](_0x517ef1['query'],_0x449581[_0x5b62('0x3c')]),_0x2423f5);if(_0x517ef1[_0x5b62('0x3a')][_0x5b62('0x45')]){_0x1eb5eb[_0x5b62('0x43')]=_[_0x5b62('0x46')](_0x1eb5eb[_0x5b62('0x43')],{'$or':_[_0x5b62('0x47')](_0x2423f5,function(_0x278a1){if(_0x278a1[_0x5b62('0x37')]!=='VIRTUAL'){var _0x1fa865={};_0x1fa865[_0x278a1['name']]={'$like':'%'+_0x517ef1[_0x5b62('0x3a')][_0x5b62('0x45')]+'%'};return _0x1fa865;}})});}_0x1eb5eb=_[_0x5b62('0x46')]({},_0x1eb5eb,_0x517ef1[_0x5b62('0x48')]);var _0x53586f={'where':_0x1eb5eb[_0x5b62('0x43')]};return db[_0x5b62('0x49')][_0x5b62('0x2d')](_0x53586f)[_0x5b62('0x1e')](function(_0x2253be){_0x31035f['count']=_0x2253be;if(_0x517ef1[_0x5b62('0x3a')]['includeAll']){_0x1eb5eb['include']=[{'all':!![]}];}return db['DeskAccount'][_0x5b62('0x4a')](_0x1eb5eb);})[_0x5b62('0x1e')](function(_0x25c5b5){_0x31035f[_0x5b62('0x4b')]=_0x25c5b5;return _0x31035f;})[_0x5b62('0x1e')](respondWithFilteredResult(_0x2fadb2,_0x1eb5eb))['catch'](handleError(_0x2fadb2,null));};exports[_0x5b62('0x4c')]=function(_0x2fe3c5,_0x4a10a2){var _0x1e0ffa={'raw':![],'where':{'id':_0x2fe3c5[_0x5b62('0x4d')]['id']}},_0x2c7235={};_0x2c7235[_0x5b62('0x39')]=_['keys'](db[_0x5b62('0x49')][_0x5b62('0x36')]);_0x2c7235[_0x5b62('0x3a')]=_['keys'](_0x2fe3c5['query']);_0x2c7235['filters']=_[_0x5b62('0x3d')](_0x2c7235[_0x5b62('0x39')],_0x2c7235[_0x5b62('0x3a')]);_0x1e0ffa[_0x5b62('0x3e')]=_[_0x5b62('0x3d')](_0x2c7235[_0x5b62('0x39')],qs['fields'](_0x2fe3c5[_0x5b62('0x3a')][_0x5b62('0x3f')]));_0x1e0ffa[_0x5b62('0x3e')]=_0x1e0ffa[_0x5b62('0x3e')][_0x5b62('0x40')]?_0x1e0ffa[_0x5b62('0x3e')]:_0x2c7235[_0x5b62('0x39')];if(_0x2fe3c5[_0x5b62('0x3a')][_0x5b62('0x4e')]){_0x1e0ffa[_0x5b62('0x4f')]=[{'all':!![]}];}_0x1e0ffa=_[_0x5b62('0x46')]({},_0x1e0ffa,_0x2fe3c5['options']);return db[_0x5b62('0x49')][_0x5b62('0x50')](_0x1e0ffa)[_0x5b62('0x1e')](handleEntityNotFound(_0x4a10a2,null))[_0x5b62('0x1e')](respondWithResult(_0x4a10a2,null))['catch'](handleError(_0x4a10a2,null));};exports[_0x5b62('0x51')]=function(_0x3d4798,_0x1c4a3f){return db[_0x5b62('0x49')][_0x5b62('0x51')](_0x3d4798[_0x5b62('0x52')],{})['then'](respondWithResult(_0x1c4a3f,0xc9))['catch'](handleError(_0x1c4a3f,null));};exports[_0x5b62('0x53')]=function(_0x208899,_0x22f867){if(_0x208899[_0x5b62('0x52')]['id']){delete _0x208899['body']['id'];}return db[_0x5b62('0x49')][_0x5b62('0x50')]({'where':{'id':_0x208899[_0x5b62('0x4d')]['id']}})[_0x5b62('0x1e')](handleEntityNotFound(_0x22f867,null))[_0x5b62('0x1e')](saveUpdates(_0x208899[_0x5b62('0x52')],null))[_0x5b62('0x1e')](respondWithResult(_0x22f867,null))[_0x5b62('0x28')](handleError(_0x22f867,null));};exports[_0x5b62('0x33')]=function(_0x5ec8e8,_0x4dda31){return db[_0x5b62('0x49')][_0x5b62('0x50')]({'where':{'id':_0x5ec8e8[_0x5b62('0x4d')]['id']}})[_0x5b62('0x1e')](handleEntityNotFound(_0x4dda31,null))[_0x5b62('0x1e')](removeEntity(_0x4dda31,null))[_0x5b62('0x28')](handleError(_0x4dda31,null));};exports[_0x5b62('0x54')]=function(_0x203913,_0x5ab9d2,_0x36fb02){var _0x506920={};var _0x5fd0d2={};var _0x53b721;var _0x38e6cb;return db[_0x5b62('0x49')][_0x5b62('0x55')]({'where':{'id':_0x203913[_0x5b62('0x4d')]['id']}})['then'](handleEntityNotFound(_0x5ab9d2,null))[_0x5b62('0x1e')](function(_0x1c8dbc){if(_0x1c8dbc){_0x53b721=_0x1c8dbc;_0x5fd0d2[_0x5b62('0x39')]=_[_0x5b62('0x3b')](db[_0x5b62('0x56')][_0x5b62('0x36')]);_0x5fd0d2['query']=_[_0x5b62('0x3b')](_0x203913[_0x5b62('0x3a')]);_0x5fd0d2[_0x5b62('0x3c')]=_[_0x5b62('0x3d')](_0x5fd0d2['model'],_0x5fd0d2['query']);_0x506920['attributes']=_[_0x5b62('0x3d')](_0x5fd0d2[_0x5b62('0x39')],qs[_0x5b62('0x3f')](_0x203913['query'][_0x5b62('0x3f')]));_0x506920[_0x5b62('0x3e')]=_0x506920[_0x5b62('0x3e')][_0x5b62('0x40')]?_0x506920[_0x5b62('0x3e')]:_0x5fd0d2[_0x5b62('0x39')];_0x506920[_0x5b62('0x41')]=qs[_0x5b62('0x42')](_0x203913['query'][_0x5b62('0x42')]);_0x506920['where']=qs['filters'](_[_0x5b62('0x44')](_0x203913['query'],_0x5fd0d2[_0x5b62('0x3c')]));if(_0x203913['query'][_0x5b62('0x45')]){_0x506920[_0x5b62('0x43')]=_[_0x5b62('0x46')](_0x506920['where'],{'$or':_[_0x5b62('0x47')](_0x506920['attributes'],function(_0x4b9142){var _0x2b7696={};_0x2b7696[_0x4b9142]={'$like':'%'+_0x203913[_0x5b62('0x3a')]['filter']+'%'};return _0x2b7696;})});}_0x506920=_[_0x5b62('0x46')]({},_0x506920,_0x203913['options']);return _0x53b721['getConfigurations'](_0x506920);}})[_0x5b62('0x1e')](function(_0x490f4c){if(_0x490f4c){_0x38e6cb=_0x490f4c[_0x5b62('0x40')];if(!_0x203913['query'][_0x5b62('0x57')]('nolimit')){_0x506920[_0x5b62('0x2f')]=qs[_0x5b62('0x2f')](_0x203913[_0x5b62('0x3a')]['limit']);_0x506920['offset']=qs[_0x5b62('0x2e')](_0x203913['query'][_0x5b62('0x2e')]);}return _0x53b721[_0x5b62('0x54')](_0x506920);}})[_0x5b62('0x1e')](function(_0x1152e5){if(_0x1152e5){return _0x1152e5?{'count':_0x38e6cb,'rows':_0x1152e5}:null;}})[_0x5b62('0x1e')](respondWithResult(_0x5ab9d2,null))[_0x5b62('0x28')](handleError(_0x5ab9d2,null));};exports[_0x5b62('0x58')]=function(_0x41f9c4,_0x56979d,_0x46436e){if(_0x41f9c4[_0x5b62('0x52')]['id']){delete _0x41f9c4['body']['id'];}return db[_0x5b62('0x49')][_0x5b62('0x55')]({'where':{'id':_0x41f9c4[_0x5b62('0x4d')]['id']}})[_0x5b62('0x1e')](handleEntityNotFound(_0x56979d,null))[_0x5b62('0x1e')](function(_0x5d5b8f){if(_0x5d5b8f){_0x41f9c4[_0x5b62('0x52')][_0x5b62('0x59')]=_0x5d5b8f['id'];_0x41f9c4[_0x5b62('0x52')][_0x5b62('0x5a')]=integrations[_0x5b62('0x5b')](_0x41f9c4['body'][_0x5b62('0x5c')],_0x41f9c4['body']['type']);_0x41f9c4[_0x5b62('0x52')][_0x5b62('0x5d')]=integrations[_0x5b62('0x5e')](_0x41f9c4[_0x5b62('0x52')][_0x5b62('0x5c')],_0x41f9c4[_0x5b62('0x52')][_0x5b62('0x37')]);return db[_0x5b62('0x56')][_0x5b62('0x51')](_0x41f9c4[_0x5b62('0x52')],{'include':[{'model':db[_0x5b62('0x5f')],'as':_0x5b62('0x5a')},{'model':db[_0x5b62('0x5f')],'as':_0x5b62('0x5d')}]});}return null;})[_0x5b62('0x1e')](respondWithResult(_0x56979d,null))[_0x5b62('0x28')](handleError(_0x56979d,null));};exports[_0x5b62('0x60')]=function(_0x108415,_0x341211,_0x7db8c0){var _0x291ffd=[{'name':_0x5b62('0x61'),'label':'priority','custom':![],'options':[{'name':0x1,'value':0x1},{'name':0x2,'value':0x2},{'name':0x3,'value':0x3},{'name':0x4,'value':0x4},{'name':0x5,'value':0x5},{'name':0x6,'value':0x6},{'name':0x7,'value':0x7},{'name':0x8,'value':0x8},{'name':0x9,'value':0x9},{'name':0xa,'value':0xa}]}];var _0x281d44='';return db['DeskAccount']['findOne']({'where':{'id':_0x108415[_0x5b62('0x4d')]['id']},'attributes':['id',_0x5b62('0x62'),'authType',_0x5b62('0x63'),'password','consumerKey',_0x5b62('0x64'),_0x5b62('0x65'),'tokenSecret']})[_0x5b62('0x1e')](handleEntityNotFound(_0x341211,null))[_0x5b62('0x1e')](function(_0xa491b0){if(_0xa491b0){_0x281d44=_0xa491b0['remoteUri'];var _0x3f5015=_0x281d44['slice'](-0x1);if(_0x3f5015==='/'){_0x281d44=_0x281d44[_0x5b62('0x66')](0x0,_0x281d44[_0x5b62('0x67')](_0x3f5015));}var _0x3a1e06={'method':_0x5b62('0x68'),'uri':util[_0x5b62('0x69')](_0x5b62('0x6a'),_0x281d44),'headers':{'Content-Type':'application/json','Accept':_0x5b62('0x6b')},'json':!![]};if(_0xa491b0[_0x5b62('0x6c')]===_0x5b62('0x6d')){_0x3a1e06[_0x5b62('0x6e')][_0x5b62('0x6f')]=util[_0x5b62('0x69')](_0x5b62('0x70'),new Buffer(util[_0x5b62('0x69')](_0x5b62('0x71'),_0xa491b0[_0x5b62('0x63')],_0xa491b0[_0x5b62('0x72')]))[_0x5b62('0x73')](_0x5b62('0x74')));}return rp(_0x3a1e06)[_0x5b62('0x1e')](function(_0x2e9728){return _0x291ffd[_0x5b62('0x75')](_['map'](_0x2e9728[_0x5b62('0x76')]['entries'],function(_0x3eb1be){return{'id':_0x3eb1be[_0x5b62('0x35')],'name':_0x3eb1be[_0x5b62('0x35')],'type':_0x3eb1be[_0x5b62('0x37')],'active':_0x3eb1be[_0x5b62('0x77')],'label':_0x3eb1be[_0x5b62('0x78')],'custom':!![]};}));});}})[_0x5b62('0x1e')](function(_0x534cf0){return{'count':_0x534cf0['length'],'rows':_0x534cf0};})['then'](respondWithResult(_0x341211,null))['catch'](function(_0x48df73){var _0x38f444=_0x108415[_0x5b62('0x3a')][_0x5b62('0x1b')]?0x1f4:_0x48df73[_0x5b62('0x79')]||0x1f4;logger[_0x5b62('0x24')]('getFields,\x20%s,\x20%s,\x20%s',_0x5b62('0x60'),_0x38f444,JSON[_0x5b62('0x23')](_0x48df73));delete _0x48df73[_0x5b62('0x35')];if(_0x38f444===0x191){_0x38f444=0x190;}_0x341211['status'](_0x38f444)[_0x5b62('0x7a')](_0x108415[_0x5b62('0x3a')][_0x5b62('0x1b')]?{'message':_0x5b62('0x7b'),'statusCode':_0x48df73[_0x5b62('0x79')]}:_0x48df73);});}; \ No newline at end of file +var _0xea39=['getSubjects','channel','Descriptions','getDescriptions','DeskField','getFields','priority','remoteUri','password','consumerKey','token','tokenSecret','slice','substring','lastIndexOf','format','%s/custom_fields','application/json','basic','headers','Authorization','Basic\x20%s','username','toString','base64','_embedded','entries','active','label','getFields,\x20%s,\x20%s,\x20%s','Wrong\x20credentials','statusCode','html-pdf','eml-format','zip-dir','request-promise','moment','bluebird','util','path','ejs','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','jayson/promise','client','http','test','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','then','info','request\x20sent','debug','DeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','DeskAccount,\x20%s,\x20%s','catch','status','end','json','count','set','apply','reject','save','update','destroy','sendStatus','stack','name','send','index','map','DeskAccount','rawAttributes','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','limit','offset','order','sort','where','pick','filter','merge','options','includeAll','include','findAll','show','params','create','body','find','findOne','DeskConfiguration','getConfigurations','nolimit','addConfiguration','AccountId','Subjects'];(function(_0x143146,_0x8a7852){var _0x3e9b16=function(_0x428a81){while(--_0x428a81){_0x143146['push'](_0x143146['shift']());}};_0x3e9b16(++_0x8a7852);}(_0xea39,0x9d));var _0x9ea3=function(_0x23869c,_0x4d26c4){_0x23869c=_0x23869c-0x0;var _0x3733b7=_0xea39[_0x23869c];return _0x3733b7;};'use strict';var pdf=require(_0x9ea3('0x0'));var emlformat=require(_0x9ea3('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x9ea3('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x9ea3('0x3'));var moment=require(_0x9ea3('0x4'));var BPromise=require(_0x9ea3('0x5'));var Mustache=require('mustache');var util=require(_0x9ea3('0x6'));var path=require(_0x9ea3('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x9ea3('0x8'));var fs=require('fs');var _=require(_0x9ea3('0x9'));var squel=require(_0x9ea3('0xa'));var crypto=require(_0x9ea3('0xb'));var jsforce=require(_0x9ea3('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x9ea3('0xd'));var Papa=require(_0x9ea3('0xe'));var Redis=require(_0x9ea3('0xf'));var authService=require(_0x9ea3('0x10'));var qs=require(_0x9ea3('0x11'));var as=require(_0x9ea3('0x12'));var hardwareService=require(_0x9ea3('0x13'));var logger=require(_0x9ea3('0x14'))('api');var utils=require(_0x9ea3('0x15'));var config=require(_0x9ea3('0x16'));var db=require('../../mysqldb')['db'];var integrations=require('../../components/integrations/configuration');var jayson=require(_0x9ea3('0x17'));var client=jayson[_0x9ea3('0x18')][_0x9ea3('0x19')]({'port':0x232a});function checkPasswordPattern(_0x2a4878,_0x37caf0,_0x475cdd){if(_0x475cdd){var _0x21234a=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x21234a[_0x9ea3('0x1a')](_0x37caf0)){return _0x2a4878;}else{throw new db['Sequelize'][(_0x9ea3('0x1b'))](_0x9ea3('0x1c'));}}else{return _0x2a4878;}}function respondWithRpcPromise(_0x5c605d,_0x5db2d6,_0x1b8a7d,_0x3b1d8a){return new BPromise(function(_0x120c3c,_0x41b21c){var _0xa27b1e=_0x3b1d8a||client;return _0xa27b1e['request'](_0x5c605d,_0x1b8a7d)[_0x9ea3('0x1d')](function(_0x10a98f){logger[_0x9ea3('0x1e')]('DeskAccount,\x20%s,\x20%s',_0x5db2d6,_0x9ea3('0x1f'));logger[_0x9ea3('0x20')](_0x9ea3('0x21'),_0x5db2d6,_0x9ea3('0x1f'),JSON[_0x9ea3('0x22')](_0x10a98f));if(_0x10a98f[_0x9ea3('0x23')]){if(_0x10a98f['error'][_0x9ea3('0x24')]===0x1f4){logger[_0x9ea3('0x23')]('DeskAccount,\x20%s,\x20%s',_0x5db2d6,_0x10a98f[_0x9ea3('0x23')][_0x9ea3('0x25')]);return _0x41b21c(_0x10a98f[_0x9ea3('0x23')][_0x9ea3('0x25')]);}logger['error'](_0x9ea3('0x26'),_0x5db2d6,_0x10a98f[_0x9ea3('0x23')][_0x9ea3('0x25')]);return _0x120c3c(_0x10a98f[_0x9ea3('0x23')][_0x9ea3('0x25')]);}else{logger[_0x9ea3('0x1e')]('DeskAccount,\x20%s,\x20%s',_0x5db2d6,_0x9ea3('0x1f'));_0x120c3c(_0x10a98f['result'][_0x9ea3('0x25')]);}})[_0x9ea3('0x27')](function(_0x4599a5){logger[_0x9ea3('0x23')](_0x9ea3('0x26'),_0x5db2d6,_0x4599a5);_0x41b21c(_0x4599a5);});});}function respondWithStatusCode(_0x3fdd1f,_0x3bbc8){_0x3bbc8=_0x3bbc8||0xcc;return function(_0xfdbe55){if(_0xfdbe55){return _0x3fdd1f['sendStatus'](_0x3bbc8);}return _0x3fdd1f[_0x9ea3('0x28')](_0x3bbc8)[_0x9ea3('0x29')]();};}function respondWithResult(_0x776e80,_0x75fd7){_0x75fd7=_0x75fd7||0xc8;return function(_0x5a01db){if(_0x5a01db){return _0x776e80[_0x9ea3('0x28')](_0x75fd7)[_0x9ea3('0x2a')](_0x5a01db);}};}function respondWithFilteredResult(_0x385490,_0x28d700){return function(_0x358fe2){if(_0x358fe2){var _0x168875=_0x358fe2[_0x9ea3('0x2b')],_0x3383d3=_0x28d700['offset'],_0x127667=_0x28d700['offset']+_0x28d700['limit'],_0x27d77f;if(_0x127667>=_0x168875){_0x127667=_0x168875;_0x27d77f=0xc8;}else{_0x27d77f=0xce;}_0x385490[_0x9ea3('0x28')](_0x27d77f);return _0x385490[_0x9ea3('0x2c')]('Content-Range',_0x3383d3+'-'+_0x127667+'/'+_0x168875)[_0x9ea3('0x2a')](_0x358fe2);}return null;};}function patchUpdates(_0xee8501){return function(_0x5a707f){try{jsonpatch[_0x9ea3('0x2d')](_0x5a707f,_0xee8501,!![]);}catch(_0x157766){return BPromise[_0x9ea3('0x2e')](_0x157766);}return _0x5a707f[_0x9ea3('0x2f')]();};}function saveUpdates(_0x4d2d8d,_0x2eb32e){return function(_0xa51ca2){if(_0xa51ca2){return _0xa51ca2[_0x9ea3('0x30')](_0x4d2d8d)['then'](function(_0x5e4d36){return _0x5e4d36;});}return null;};}function removeEntity(_0x344116,_0xd97250){return function(_0x5423d7){if(_0x5423d7){return _0x5423d7[_0x9ea3('0x31')]()['then'](function(){_0x344116[_0x9ea3('0x28')](0xcc)[_0x9ea3('0x29')]();});}};}function handleEntityNotFound(_0x125fc2,_0x6eb891){return function(_0x583956){if(!_0x583956){_0x125fc2[_0x9ea3('0x32')](0x194);}return _0x583956;};}function handleError(_0x12629f,_0x488dd1){_0x488dd1=_0x488dd1||0x1f4;return function(_0x187dfc){logger[_0x9ea3('0x23')](_0x187dfc[_0x9ea3('0x33')]);if(_0x187dfc['name']){delete _0x187dfc[_0x9ea3('0x34')];}_0x12629f[_0x9ea3('0x28')](_0x488dd1)[_0x9ea3('0x35')](_0x187dfc);};}exports[_0x9ea3('0x36')]=function(_0x1f6e6c,_0x38dae6){var _0x3ba0ef={},_0x12f665={},_0x3c3840={'count':0x0,'rows':[]};var _0x3b39a9=_[_0x9ea3('0x37')](db[_0x9ea3('0x38')][_0x9ea3('0x39')],function(_0x23c587){return{'name':_0x23c587['fieldName'],'type':_0x23c587[_0x9ea3('0x3a')][_0x9ea3('0x3b')]};});_0x12f665[_0x9ea3('0x3c')]=_['map'](_0x3b39a9,_0x9ea3('0x34'));_0x12f665[_0x9ea3('0x3d')]=_[_0x9ea3('0x3e')](_0x1f6e6c[_0x9ea3('0x3d')]);_0x12f665[_0x9ea3('0x3f')]=_[_0x9ea3('0x40')](_0x12f665[_0x9ea3('0x3c')],_0x12f665['query']);_0x3ba0ef['attributes']=_[_0x9ea3('0x40')](_0x12f665[_0x9ea3('0x3c')],qs[_0x9ea3('0x41')](_0x1f6e6c['query'][_0x9ea3('0x41')]));_0x3ba0ef[_0x9ea3('0x42')]=_0x3ba0ef['attributes'][_0x9ea3('0x43')]?_0x3ba0ef['attributes']:_0x12f665[_0x9ea3('0x3c')];if(!_0x1f6e6c['query'][_0x9ea3('0x44')]('nolimit')){_0x3ba0ef[_0x9ea3('0x45')]=qs[_0x9ea3('0x45')](_0x1f6e6c['query'][_0x9ea3('0x45')]);_0x3ba0ef['offset']=qs['offset'](_0x1f6e6c['query'][_0x9ea3('0x46')]);}_0x3ba0ef[_0x9ea3('0x47')]=qs[_0x9ea3('0x48')](_0x1f6e6c[_0x9ea3('0x3d')]['sort']);_0x3ba0ef[_0x9ea3('0x49')]=qs[_0x9ea3('0x3f')](_[_0x9ea3('0x4a')](_0x1f6e6c[_0x9ea3('0x3d')],_0x12f665[_0x9ea3('0x3f')]),_0x3b39a9);if(_0x1f6e6c[_0x9ea3('0x3d')][_0x9ea3('0x4b')]){_0x3ba0ef[_0x9ea3('0x49')]=_[_0x9ea3('0x4c')](_0x3ba0ef['where'],{'$or':_['map'](_0x3b39a9,function(_0x335c2d){if(_0x335c2d[_0x9ea3('0x3a')]!=='VIRTUAL'){var _0x33f2c1={};_0x33f2c1[_0x335c2d['name']]={'$like':'%'+_0x1f6e6c[_0x9ea3('0x3d')][_0x9ea3('0x4b')]+'%'};return _0x33f2c1;}})});}_0x3ba0ef=_['merge']({},_0x3ba0ef,_0x1f6e6c[_0x9ea3('0x4d')]);var _0x3e65a8={'where':_0x3ba0ef[_0x9ea3('0x49')]};return db['DeskAccount'][_0x9ea3('0x2b')](_0x3e65a8)['then'](function(_0xb0868c){_0x3c3840['count']=_0xb0868c;if(_0x1f6e6c['query'][_0x9ea3('0x4e')]){_0x3ba0ef[_0x9ea3('0x4f')]=[{'all':!![]}];}return db[_0x9ea3('0x38')][_0x9ea3('0x50')](_0x3ba0ef);})['then'](function(_0x2ae3fb){_0x3c3840['rows']=_0x2ae3fb;return _0x3c3840;})[_0x9ea3('0x1d')](respondWithFilteredResult(_0x38dae6,_0x3ba0ef))[_0x9ea3('0x27')](handleError(_0x38dae6,null));};exports[_0x9ea3('0x51')]=function(_0x5a2fc6,_0x7f9005){var _0x3a959d={'raw':![],'where':{'id':_0x5a2fc6[_0x9ea3('0x52')]['id']}},_0x1ffd5d={};_0x1ffd5d[_0x9ea3('0x3c')]=_[_0x9ea3('0x3e')](db['DeskAccount']['rawAttributes']);_0x1ffd5d[_0x9ea3('0x3d')]=_[_0x9ea3('0x3e')](_0x5a2fc6[_0x9ea3('0x3d')]);_0x1ffd5d[_0x9ea3('0x3f')]=_[_0x9ea3('0x40')](_0x1ffd5d[_0x9ea3('0x3c')],_0x1ffd5d[_0x9ea3('0x3d')]);_0x3a959d[_0x9ea3('0x42')]=_[_0x9ea3('0x40')](_0x1ffd5d[_0x9ea3('0x3c')],qs[_0x9ea3('0x41')](_0x5a2fc6[_0x9ea3('0x3d')][_0x9ea3('0x41')]));_0x3a959d[_0x9ea3('0x42')]=_0x3a959d['attributes'][_0x9ea3('0x43')]?_0x3a959d[_0x9ea3('0x42')]:_0x1ffd5d[_0x9ea3('0x3c')];if(_0x5a2fc6['query'][_0x9ea3('0x4e')]){_0x3a959d[_0x9ea3('0x4f')]=[{'all':!![]}];}_0x3a959d=_[_0x9ea3('0x4c')]({},_0x3a959d,_0x5a2fc6[_0x9ea3('0x4d')]);return db[_0x9ea3('0x38')]['find'](_0x3a959d)['then'](handleEntityNotFound(_0x7f9005,null))[_0x9ea3('0x1d')](respondWithResult(_0x7f9005,null))[_0x9ea3('0x27')](handleError(_0x7f9005,null));};exports[_0x9ea3('0x53')]=function(_0xb851b0,_0x2964b1){return db[_0x9ea3('0x38')][_0x9ea3('0x53')](_0xb851b0[_0x9ea3('0x54')],{})[_0x9ea3('0x1d')](respondWithResult(_0x2964b1,0xc9))[_0x9ea3('0x27')](handleError(_0x2964b1,null));};exports[_0x9ea3('0x30')]=function(_0x5a9091,_0x478939){if(_0x5a9091['body']['id']){delete _0x5a9091[_0x9ea3('0x54')]['id'];}return db[_0x9ea3('0x38')][_0x9ea3('0x55')]({'where':{'id':_0x5a9091[_0x9ea3('0x52')]['id']}})['then'](handleEntityNotFound(_0x478939,null))[_0x9ea3('0x1d')](saveUpdates(_0x5a9091[_0x9ea3('0x54')],null))[_0x9ea3('0x1d')](respondWithResult(_0x478939,null))[_0x9ea3('0x27')](handleError(_0x478939,null));};exports[_0x9ea3('0x31')]=function(_0xdd88d3,_0x27e5f4){return db[_0x9ea3('0x38')][_0x9ea3('0x55')]({'where':{'id':_0xdd88d3['params']['id']}})[_0x9ea3('0x1d')](handleEntityNotFound(_0x27e5f4,null))[_0x9ea3('0x1d')](removeEntity(_0x27e5f4,null))[_0x9ea3('0x27')](handleError(_0x27e5f4,null));};exports['getConfigurations']=function(_0x51a42f,_0x32f722,_0x280d18){var _0x29367d={};var _0x405303={};var _0x4988b1;var _0x573b2b;return db[_0x9ea3('0x38')][_0x9ea3('0x56')]({'where':{'id':_0x51a42f[_0x9ea3('0x52')]['id']}})[_0x9ea3('0x1d')](handleEntityNotFound(_0x32f722,null))['then'](function(_0x52b197){if(_0x52b197){_0x4988b1=_0x52b197;_0x405303[_0x9ea3('0x3c')]=_['keys'](db[_0x9ea3('0x57')][_0x9ea3('0x39')]);_0x405303[_0x9ea3('0x3d')]=_[_0x9ea3('0x3e')](_0x51a42f[_0x9ea3('0x3d')]);_0x405303[_0x9ea3('0x3f')]=_[_0x9ea3('0x40')](_0x405303[_0x9ea3('0x3c')],_0x405303[_0x9ea3('0x3d')]);_0x29367d[_0x9ea3('0x42')]=_[_0x9ea3('0x40')](_0x405303[_0x9ea3('0x3c')],qs[_0x9ea3('0x41')](_0x51a42f[_0x9ea3('0x3d')][_0x9ea3('0x41')]));_0x29367d[_0x9ea3('0x42')]=_0x29367d[_0x9ea3('0x42')][_0x9ea3('0x43')]?_0x29367d['attributes']:_0x405303[_0x9ea3('0x3c')];_0x29367d['order']=qs['sort'](_0x51a42f['query'][_0x9ea3('0x48')]);_0x29367d[_0x9ea3('0x49')]=qs['filters'](_[_0x9ea3('0x4a')](_0x51a42f['query'],_0x405303[_0x9ea3('0x3f')]));if(_0x51a42f[_0x9ea3('0x3d')][_0x9ea3('0x4b')]){_0x29367d[_0x9ea3('0x49')]=_['merge'](_0x29367d[_0x9ea3('0x49')],{'$or':_['map'](_0x29367d[_0x9ea3('0x42')],function(_0x22032d){var _0x5f5c2e={};_0x5f5c2e[_0x22032d]={'$like':'%'+_0x51a42f[_0x9ea3('0x3d')]['filter']+'%'};return _0x5f5c2e;})});}_0x29367d=_['merge']({},_0x29367d,_0x51a42f['options']);return _0x4988b1[_0x9ea3('0x58')](_0x29367d);}})['then'](function(_0x40dc41){if(_0x40dc41){_0x573b2b=_0x40dc41[_0x9ea3('0x43')];if(!_0x51a42f[_0x9ea3('0x3d')]['hasOwnProperty'](_0x9ea3('0x59'))){_0x29367d[_0x9ea3('0x45')]=qs[_0x9ea3('0x45')](_0x51a42f[_0x9ea3('0x3d')][_0x9ea3('0x45')]);_0x29367d['offset']=qs[_0x9ea3('0x46')](_0x51a42f[_0x9ea3('0x3d')][_0x9ea3('0x46')]);}return _0x4988b1[_0x9ea3('0x58')](_0x29367d);}})[_0x9ea3('0x1d')](function(_0x547549){if(_0x547549){return _0x547549?{'count':_0x573b2b,'rows':_0x547549}:null;}})['then'](respondWithResult(_0x32f722,null))[_0x9ea3('0x27')](handleError(_0x32f722,null));};exports[_0x9ea3('0x5a')]=function(_0x41ad00,_0x40bc6d,_0x5850a9){if(_0x41ad00['body']['id']){delete _0x41ad00['body']['id'];}return db['DeskAccount'][_0x9ea3('0x56')]({'where':{'id':_0x41ad00['params']['id']}})[_0x9ea3('0x1d')](handleEntityNotFound(_0x40bc6d,null))[_0x9ea3('0x1d')](function(_0x2475e7){if(_0x2475e7){_0x41ad00['body'][_0x9ea3('0x5b')]=_0x2475e7['id'];_0x41ad00[_0x9ea3('0x54')][_0x9ea3('0x5c')]=integrations[_0x9ea3('0x5d')](_0x41ad00[_0x9ea3('0x54')][_0x9ea3('0x5e')],_0x41ad00[_0x9ea3('0x54')][_0x9ea3('0x3a')]);_0x41ad00[_0x9ea3('0x54')][_0x9ea3('0x5f')]=integrations[_0x9ea3('0x60')](_0x41ad00[_0x9ea3('0x54')][_0x9ea3('0x5e')],_0x41ad00['body'][_0x9ea3('0x3a')]);return db['DeskConfiguration'][_0x9ea3('0x53')](_0x41ad00[_0x9ea3('0x54')],{'include':[{'model':db[_0x9ea3('0x61')],'as':_0x9ea3('0x5c')},{'model':db[_0x9ea3('0x61')],'as':'Descriptions'}]});}return null;})[_0x9ea3('0x1d')](respondWithResult(_0x40bc6d,null))[_0x9ea3('0x27')](handleError(_0x40bc6d,null));};exports[_0x9ea3('0x62')]=function(_0x120d6b,_0x18ac3c,_0x4b4f23){var _0x189d6d=[{'name':_0x9ea3('0x63'),'label':'priority','custom':![],'options':[{'name':0x1,'value':0x1},{'name':0x2,'value':0x2},{'name':0x3,'value':0x3},{'name':0x4,'value':0x4},{'name':0x5,'value':0x5},{'name':0x6,'value':0x6},{'name':0x7,'value':0x7},{'name':0x8,'value':0x8},{'name':0x9,'value':0x9},{'name':0xa,'value':0xa}]}];var _0x3fdc9a='';return db[_0x9ea3('0x38')]['findOne']({'where':{'id':_0x120d6b[_0x9ea3('0x52')]['id']},'attributes':['id',_0x9ea3('0x64'),'authType','username',_0x9ea3('0x65'),_0x9ea3('0x66'),'consumerSecret',_0x9ea3('0x67'),_0x9ea3('0x68')]})[_0x9ea3('0x1d')](handleEntityNotFound(_0x18ac3c,null))[_0x9ea3('0x1d')](function(_0x124156){if(_0x124156){_0x3fdc9a=_0x124156[_0x9ea3('0x64')];var _0x50cb09=_0x3fdc9a[_0x9ea3('0x69')](-0x1);if(_0x50cb09==='/'){_0x3fdc9a=_0x3fdc9a[_0x9ea3('0x6a')](0x0,_0x3fdc9a[_0x9ea3('0x6b')](_0x50cb09));}var _0x133e8c={'method':'GET','uri':util[_0x9ea3('0x6c')](_0x9ea3('0x6d'),_0x3fdc9a),'headers':{'Content-Type':_0x9ea3('0x6e'),'Accept':_0x9ea3('0x6e')},'json':!![]};if(_0x124156['authType']===_0x9ea3('0x6f')){_0x133e8c[_0x9ea3('0x70')][_0x9ea3('0x71')]=util['format'](_0x9ea3('0x72'),new Buffer(util[_0x9ea3('0x6c')]('%s:%s',_0x124156[_0x9ea3('0x73')],_0x124156[_0x9ea3('0x65')]))[_0x9ea3('0x74')](_0x9ea3('0x75')));}return rp(_0x133e8c)['then'](function(_0x45d0e1){return _0x189d6d['concat'](_[_0x9ea3('0x37')](_0x45d0e1[_0x9ea3('0x76')][_0x9ea3('0x77')],function(_0x40204c){return{'id':_0x40204c['name'],'name':_0x40204c[_0x9ea3('0x34')],'type':_0x40204c[_0x9ea3('0x3a')],'active':_0x40204c[_0x9ea3('0x78')],'label':_0x40204c[_0x9ea3('0x79')],'custom':!![]};}));});}})[_0x9ea3('0x1d')](function(_0x4d4dc8){return{'count':_0x4d4dc8[_0x9ea3('0x43')],'rows':_0x4d4dc8};})[_0x9ea3('0x1d')](respondWithResult(_0x18ac3c,null))[_0x9ea3('0x27')](function(_0x89d35c){var _0x80d13e=_0x120d6b[_0x9ea3('0x3d')][_0x9ea3('0x1a')]?0x1f4:_0x89d35c['statusCode']||0x1f4;logger[_0x9ea3('0x23')](_0x9ea3('0x7a'),_0x9ea3('0x62'),_0x80d13e,JSON[_0x9ea3('0x22')](_0x89d35c));delete _0x89d35c[_0x9ea3('0x34')];if(_0x80d13e===0x191){_0x80d13e=0x190;}_0x18ac3c[_0x9ea3('0x28')](_0x80d13e)[_0x9ea3('0x35')](_0x120d6b[_0x9ea3('0x3d')][_0x9ea3('0x1a')]?{'message':_0x9ea3('0x7b'),'statusCode':_0x89d35c[_0x9ea3('0x7c')]}:_0x89d35c);});}; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.model.js b/server/api/intDeskAccount/intDeskAccount.model.js index 0911382..0e9ce5d 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 _0xffe2=['define','DeskAccount','int_desk_accounts','lodash','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intDeskAccount.attributes','../../components/integrations/configuration'];(function(_0x459aa6,_0x4c82bc){var _0x2af938=function(_0x5abd60){while(--_0x5abd60){_0x459aa6['push'](_0x459aa6['shift']());}};_0x2af938(++_0x4c82bc);}(_0xffe2,0x1b0));var _0x2ffe=function(_0x4f90e,_0x3b6af2){_0x4f90e=_0x4f90e-0x0;var _0x32ec9f=_0xffe2[_0x4f90e];return _0x32ec9f;};'use strict';var _=require(_0x2ffe('0x0'));var util=require('util');var logger=require(_0x2ffe('0x1'))('api');var moment=require(_0x2ffe('0x2'));var BPromise=require(_0x2ffe('0x3'));var rp=require(_0x2ffe('0x4'));var fs=require('fs');var path=require(_0x2ffe('0x5'));var rimraf=require(_0x2ffe('0x6'));var config=require(_0x2ffe('0x7'));var attributes=require(_0x2ffe('0x8'));var integrations=require(_0x2ffe('0x9'));module['exports']=function(_0x5f46e7,_0x572a05){return _0x5f46e7[_0x2ffe('0xa')](_0x2ffe('0xb'),attributes,{'tableName':_0x2ffe('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2ae0=['DeskAccount','int_desk_accounts','lodash','util','moment','bluebird','request-promise','path','../../config/environment','./intDeskAccount.attributes','../../components/integrations/configuration','exports','define'];(function(_0x348860,_0x4531f6){var _0x2fc2ad=function(_0x3b449f){while(--_0x3b449f){_0x348860['push'](_0x348860['shift']());}};_0x2fc2ad(++_0x4531f6);}(_0x2ae0,0x161));var _0x02ae=function(_0x415e13,_0x19623a){_0x415e13=_0x415e13-0x0;var _0xa3a89=_0x2ae0[_0x415e13];return _0xa3a89;};'use strict';var _=require(_0x02ae('0x0'));var util=require(_0x02ae('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x02ae('0x2'));var BPromise=require(_0x02ae('0x3'));var rp=require(_0x02ae('0x4'));var fs=require('fs');var path=require(_0x02ae('0x5'));var rimraf=require('rimraf');var config=require(_0x02ae('0x6'));var attributes=require(_0x02ae('0x7'));var integrations=require(_0x02ae('0x8'));module[_0x02ae('0x9')]=function(_0x32c0b8,_0x25edc3){return _0x32c0b8[_0x02ae('0xa')](_0x02ae('0xb'),attributes,{'tableName':_0x02ae('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.rpc.js b/server/api/intDeskAccount/intDeskAccount.rpc.js index 4e3246d..c128880 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 _0x2ada=['http','request','info','DeskAccount,\x20%s,\x20%s','debug','DeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','catch','DeskAccount','options','raw','where','attributes','limit','include','map','model','then','GetDeskAccount','ShowDeskAccount','find','lodash','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x2ada,0x1bd));var _0xa2ad=function(_0x33dcf7,_0x3d5390){_0x33dcf7=_0x33dcf7-0x0;var _0x542d4e=_0x2ada[_0x33dcf7];return _0x542d4e;};'use strict';var _=require(_0xa2ad('0x0'));var util=require(_0xa2ad('0x1'));var moment=require(_0xa2ad('0x2'));var BPromise=require(_0xa2ad('0x3'));var rs=require(_0xa2ad('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xa2ad('0x5'));var logger=require(_0xa2ad('0x6'))('rpc');var config=require(_0xa2ad('0x7'));var jayson=require(_0xa2ad('0x8'));var client=jayson[_0xa2ad('0x9')][_0xa2ad('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x212dd3,_0x543aab,_0x2634ad){return new BPromise(function(_0x2316bd,_0x282b63){return client[_0xa2ad('0xb')](_0x212dd3,_0x2634ad)['then'](function(_0x5a6cb6){logger[_0xa2ad('0xc')](_0xa2ad('0xd'),_0x543aab,'request\x20sent');logger[_0xa2ad('0xe')](_0xa2ad('0xf'),_0x543aab,'request\x20sent',JSON[_0xa2ad('0x10')](_0x5a6cb6));if(_0x5a6cb6[_0xa2ad('0x11')]){if(_0x5a6cb6['error'][_0xa2ad('0x12')]===0x1f4){logger[_0xa2ad('0x11')](_0xa2ad('0xd'),_0x543aab,_0x5a6cb6[_0xa2ad('0x11')]['message']);return _0x282b63(_0x5a6cb6[_0xa2ad('0x11')][_0xa2ad('0x13')]);}logger[_0xa2ad('0x11')](_0xa2ad('0xd'),_0x543aab,_0x5a6cb6['error']['message']);return _0x2316bd(_0x5a6cb6[_0xa2ad('0x11')][_0xa2ad('0x13')]);}else{logger[_0xa2ad('0xc')]('DeskAccount,\x20%s,\x20%s',_0x543aab,_0xa2ad('0x14'));_0x2316bd(_0x5a6cb6['result'][_0xa2ad('0x13')]);}})[_0xa2ad('0x15')](function(_0x253e5d){logger[_0xa2ad('0x11')](_0xa2ad('0xd'),_0x543aab,_0x253e5d);_0x282b63(_0x253e5d);});});}exports['GetDeskAccount']=function(_0x3623f5){var _0x35e034=this;return new Promise(function(_0x22ce34,_0x3e5849){return db[_0xa2ad('0x16')]['findAll']({'raw':_0x3623f5[_0xa2ad('0x17')]?_0x3623f5[_0xa2ad('0x17')][_0xa2ad('0x18')]===undefined?!![]:![]:!![],'where':_0x3623f5[_0xa2ad('0x17')]?_0x3623f5['options'][_0xa2ad('0x19')]||null:null,'attributes':_0x3623f5[_0xa2ad('0x17')]?_0x3623f5[_0xa2ad('0x17')][_0xa2ad('0x1a')]||null:null,'limit':_0x3623f5[_0xa2ad('0x17')]?_0x3623f5[_0xa2ad('0x17')][_0xa2ad('0x1b')]||null:null,'include':_0x3623f5['options']?_0x3623f5[_0xa2ad('0x17')][_0xa2ad('0x1c')]?_[_0xa2ad('0x1d')](_0x3623f5[_0xa2ad('0x17')]['include'],function(_0x253bff){return{'model':db[_0x253bff['model']],'as':_0x253bff['as'],'attributes':_0x253bff['attributes'],'include':_0x253bff[_0xa2ad('0x1c')]?_[_0xa2ad('0x1d')](_0x253bff[_0xa2ad('0x1c')],function(_0x2fb32a){return{'model':db[_0x2fb32a[_0xa2ad('0x1e')]],'as':_0x2fb32a['as'],'attributes':_0x2fb32a[_0xa2ad('0x1a')],'include':_0x2fb32a[_0xa2ad('0x1c')]?_['map'](_0x2fb32a[_0xa2ad('0x1c')],function(_0x154326){return{'model':db[_0x154326[_0xa2ad('0x1e')]],'as':_0x154326['as'],'attributes':_0x154326['attributes']};}):[]};}):[]};}):[]:[]})[_0xa2ad('0x1f')](function(_0x197217){logger[_0xa2ad('0xc')](_0xa2ad('0x20'),_0x3623f5);logger['debug']('GetDeskAccount',_0x3623f5,JSON[_0xa2ad('0x10')](_0x197217));_0x22ce34(_0x197217);})['catch'](function(_0x5f0140){logger['error']('GetDeskAccount',_0x5f0140[_0xa2ad('0x13')],_0x3623f5);_0x3e5849(_0x35e034[_0xa2ad('0x11')](0x1f4,_0x5f0140[_0xa2ad('0x13')]));});});};exports[_0xa2ad('0x21')]=function(_0x3929c1){var _0x1b0bbb=this;return new Promise(function(_0x335036,_0x281f42){return db['DeskAccount'][_0xa2ad('0x22')]({'raw':_0x3929c1[_0xa2ad('0x17')]?_0x3929c1[_0xa2ad('0x17')][_0xa2ad('0x18')]===undefined?!![]:![]:!![],'where':_0x3929c1[_0xa2ad('0x17')]?_0x3929c1[_0xa2ad('0x17')]['where']||null:null,'attributes':_0x3929c1['options']?_0x3929c1[_0xa2ad('0x17')]['attributes']||null:null,'include':_0x3929c1['options']?_0x3929c1[_0xa2ad('0x17')]['include']?_[_0xa2ad('0x1d')](_0x3929c1['options']['include'],function(_0x24193e){return{'model':db[_0x24193e['model']],'as':_0x24193e['as'],'attributes':_0x24193e[_0xa2ad('0x1a')],'include':_0x24193e[_0xa2ad('0x1c')]?_[_0xa2ad('0x1d')](_0x24193e[_0xa2ad('0x1c')],function(_0x7cfb12){return{'model':db[_0x7cfb12[_0xa2ad('0x1e')]],'as':_0x7cfb12['as'],'attributes':_0x7cfb12[_0xa2ad('0x1a')],'include':_0x7cfb12[_0xa2ad('0x1c')]?_['map'](_0x7cfb12[_0xa2ad('0x1c')],function(_0x1cab83){return{'model':db[_0x1cab83['model']],'as':_0x1cab83['as'],'attributes':_0x1cab83[_0xa2ad('0x1a')]};}):[]};}):[]};}):[]:[]})[_0xa2ad('0x1f')](function(_0x5a55f9){logger[_0xa2ad('0xc')](_0xa2ad('0x21'),_0x3929c1);logger[_0xa2ad('0xe')](_0xa2ad('0x21'),_0x3929c1,JSON['stringify'](_0x5a55f9));_0x335036(_0x5a55f9);})[_0xa2ad('0x15')](function(_0x3ca0bc){logger[_0xa2ad('0x11')](_0xa2ad('0x21'),_0x3ca0bc[_0xa2ad('0x13')],_0x3929c1);_0x281f42(_0x1b0bbb['error'](0x1f4,_0x3ca0bc[_0xa2ad('0x13')]));});});}; \ No newline at end of file +var _0xe51d=['GetDeskAccount','DeskAccount','findAll','options','raw','where','attributes','limit','include','map','model','then','find','ShowDeskAccount','stringify','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','request','DeskAccount,\x20%s,\x20%s','request\x20sent','debug','DeskAccount,\x20%s,\x20%s,\x20%s','error','message','info','result','catch'];(function(_0x5aec33,_0x402923){var _0x1f3ce5=function(_0x23e95c){while(--_0x23e95c){_0x5aec33['push'](_0x5aec33['shift']());}};_0x1f3ce5(++_0x402923);}(_0xe51d,0x1e3));var _0xde51=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xe51d[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xde51('0x0'));var util=require(_0xde51('0x1'));var moment=require('moment');var BPromise=require(_0xde51('0x2'));var rs=require(_0xde51('0x3'));var fs=require('fs');var Redis=require(_0xde51('0x4'));var db=require(_0xde51('0x5'))['db'];var utils=require(_0xde51('0x6'));var logger=require(_0xde51('0x7'))('rpc');var config=require(_0xde51('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xde51('0x9')][_0xde51('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4a94fa,_0x4bbf0d,_0x1d6da5){return new BPromise(function(_0x202460,_0x942e97){return client[_0xde51('0xb')](_0x4a94fa,_0x1d6da5)['then'](function(_0x4bf2f0){logger['info'](_0xde51('0xc'),_0x4bbf0d,_0xde51('0xd'));logger[_0xde51('0xe')](_0xde51('0xf'),_0x4bbf0d,_0xde51('0xd'),JSON['stringify'](_0x4bf2f0));if(_0x4bf2f0[_0xde51('0x10')]){if(_0x4bf2f0[_0xde51('0x10')]['code']===0x1f4){logger[_0xde51('0x10')](_0xde51('0xc'),_0x4bbf0d,_0x4bf2f0[_0xde51('0x10')][_0xde51('0x11')]);return _0x942e97(_0x4bf2f0[_0xde51('0x10')][_0xde51('0x11')]);}logger[_0xde51('0x10')](_0xde51('0xc'),_0x4bbf0d,_0x4bf2f0[_0xde51('0x10')]['message']);return _0x202460(_0x4bf2f0[_0xde51('0x10')][_0xde51('0x11')]);}else{logger[_0xde51('0x12')](_0xde51('0xc'),_0x4bbf0d,'request\x20sent');_0x202460(_0x4bf2f0[_0xde51('0x13')][_0xde51('0x11')]);}})[_0xde51('0x14')](function(_0x21f37e){logger[_0xde51('0x10')](_0xde51('0xc'),_0x4bbf0d,_0x21f37e);_0x942e97(_0x21f37e);});});}exports[_0xde51('0x15')]=function(_0x4ffe64){var _0x2d2108=this;return new Promise(function(_0x16191f,_0x41e12d){return db[_0xde51('0x16')][_0xde51('0x17')]({'raw':_0x4ffe64['options']?_0x4ffe64[_0xde51('0x18')][_0xde51('0x19')]===undefined?!![]:![]:!![],'where':_0x4ffe64[_0xde51('0x18')]?_0x4ffe64[_0xde51('0x18')][_0xde51('0x1a')]||null:null,'attributes':_0x4ffe64['options']?_0x4ffe64[_0xde51('0x18')][_0xde51('0x1b')]||null:null,'limit':_0x4ffe64['options']?_0x4ffe64[_0xde51('0x18')][_0xde51('0x1c')]||null:null,'include':_0x4ffe64[_0xde51('0x18')]?_0x4ffe64[_0xde51('0x18')][_0xde51('0x1d')]?_[_0xde51('0x1e')](_0x4ffe64[_0xde51('0x18')][_0xde51('0x1d')],function(_0x58b9fd){return{'model':db[_0x58b9fd['model']],'as':_0x58b9fd['as'],'attributes':_0x58b9fd[_0xde51('0x1b')],'include':_0x58b9fd[_0xde51('0x1d')]?_[_0xde51('0x1e')](_0x58b9fd[_0xde51('0x1d')],function(_0xee3b47){return{'model':db[_0xee3b47['model']],'as':_0xee3b47['as'],'attributes':_0xee3b47['attributes'],'include':_0xee3b47[_0xde51('0x1d')]?_[_0xde51('0x1e')](_0xee3b47[_0xde51('0x1d')],function(_0x516c14){return{'model':db[_0x516c14[_0xde51('0x1f')]],'as':_0x516c14['as'],'attributes':_0x516c14['attributes']};}):[]};}):[]};}):[]:[]})[_0xde51('0x20')](function(_0x580bdd){logger[_0xde51('0x12')]('GetDeskAccount',_0x4ffe64);logger[_0xde51('0xe')](_0xde51('0x15'),_0x4ffe64,JSON['stringify'](_0x580bdd));_0x16191f(_0x580bdd);})[_0xde51('0x14')](function(_0x3eb00a){logger[_0xde51('0x10')](_0xde51('0x15'),_0x3eb00a[_0xde51('0x11')],_0x4ffe64);_0x41e12d(_0x2d2108['error'](0x1f4,_0x3eb00a[_0xde51('0x11')]));});});};exports['ShowDeskAccount']=function(_0x2c1b02){var _0x3aff61=this;return new Promise(function(_0x36f7e0,_0x5c7431){return db['DeskAccount'][_0xde51('0x21')]({'raw':_0x2c1b02['options']?_0x2c1b02['options'][_0xde51('0x19')]===undefined?!![]:![]:!![],'where':_0x2c1b02['options']?_0x2c1b02['options'][_0xde51('0x1a')]||null:null,'attributes':_0x2c1b02['options']?_0x2c1b02['options']['attributes']||null:null,'include':_0x2c1b02[_0xde51('0x18')]?_0x2c1b02[_0xde51('0x18')][_0xde51('0x1d')]?_[_0xde51('0x1e')](_0x2c1b02['options'][_0xde51('0x1d')],function(_0x14a1e8){return{'model':db[_0x14a1e8[_0xde51('0x1f')]],'as':_0x14a1e8['as'],'attributes':_0x14a1e8[_0xde51('0x1b')],'include':_0x14a1e8[_0xde51('0x1d')]?_['map'](_0x14a1e8[_0xde51('0x1d')],function(_0x3921dc){return{'model':db[_0x3921dc[_0xde51('0x1f')]],'as':_0x3921dc['as'],'attributes':_0x3921dc['attributes'],'include':_0x3921dc[_0xde51('0x1d')]?_[_0xde51('0x1e')](_0x3921dc[_0xde51('0x1d')],function(_0x34969e){return{'model':db[_0x34969e[_0xde51('0x1f')]],'as':_0x34969e['as'],'attributes':_0x34969e['attributes']};}):[]};}):[]};}):[]:[]})[_0xde51('0x20')](function(_0x2c7528){logger[_0xde51('0x12')](_0xde51('0x22'),_0x2c1b02);logger[_0xde51('0xe')](_0xde51('0x22'),_0x2c1b02,JSON[_0xde51('0x23')](_0x2c7528));_0x36f7e0(_0x2c7528);})[_0xde51('0x14')](function(_0x21775c){logger[_0xde51('0x10')](_0xde51('0x22'),_0x21775c['message'],_0x2c1b02);_0x5c7431(_0x3aff61[_0xde51('0x10')](0x1f4,_0x21775c['message']));});});}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/index.js b/server/api/intDeskConfiguration/index.js index 99a20a5..7b792eb 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 _0x1267=['update','multer','util','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDeskConfiguration.controller','get','index','/:id','isAuthenticated','/:id/subjects','getSubjects','getDescriptions','/:id/tags','getTags','post','put'];(function(_0x460e9c,_0xd3f252){var _0x390a5c=function(_0x19503b){while(--_0x19503b){_0x460e9c['push'](_0x460e9c['shift']());}};_0x390a5c(++_0xd3f252);}(_0x1267,0xb5));var _0x7126=function(_0x54a358,_0x34e54c){_0x54a358=_0x54a358-0x0;var _0x54006d=_0x1267[_0x54a358];return _0x54006d;};'use strict';var multer=require(_0x7126('0x0'));var util=require(_0x7126('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x7126('0x2'));var router=express[_0x7126('0x3')]();var auth=require(_0x7126('0x4'));var interaction=require(_0x7126('0x5'));var config=require(_0x7126('0x6'));var controller=require(_0x7126('0x7'));router[_0x7126('0x8')]('/',auth['isAuthenticated'](),controller[_0x7126('0x9')]);router[_0x7126('0x8')](_0x7126('0xa'),auth[_0x7126('0xb')](),controller['show']);router[_0x7126('0x8')]('/:id/fields',auth[_0x7126('0xb')](),controller['getFields']);router[_0x7126('0x8')](_0x7126('0xc'),auth[_0x7126('0xb')](),controller[_0x7126('0xd')]);router[_0x7126('0x8')]('/:id/descriptions',auth['isAuthenticated'](),controller[_0x7126('0xe')]);router[_0x7126('0x8')](_0x7126('0xf'),auth[_0x7126('0xb')](),controller[_0x7126('0x10')]);router[_0x7126('0x11')]('/',auth['isAuthenticated'](),controller['create']);router[_0x7126('0x11')](_0x7126('0xf'),auth['isAuthenticated'](),controller['setTags']);router[_0x7126('0x12')](_0x7126('0xa'),auth['isAuthenticated'](),controller[_0x7126('0x13')]);router['delete'](_0x7126('0xa'),auth[_0x7126('0xb')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x6f44=['getTags','post','create','setTags','update','exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDeskConfiguration.controller','get','isAuthenticated','/:id','/:id/fields','/:id/descriptions','getDescriptions','/:id/tags'];(function(_0x2f3794,_0x3c3bec){var _0x1c9fbe=function(_0x2d2eac){while(--_0x2d2eac){_0x2f3794['push'](_0x2f3794['shift']());}};_0x1c9fbe(++_0x3c3bec);}(_0x6f44,0x1ea));var _0x46f4=function(_0x39a9fd,_0x504964){_0x39a9fd=_0x39a9fd-0x0;var _0x4da98b=_0x6f44[_0x39a9fd];return _0x4da98b;};'use strict';var multer=require(_0x46f4('0x0'));var util=require(_0x46f4('0x1'));var path=require('path');var timeout=require(_0x46f4('0x2'));var express=require(_0x46f4('0x3'));var router=express[_0x46f4('0x4')]();var auth=require(_0x46f4('0x5'));var interaction=require(_0x46f4('0x6'));var config=require(_0x46f4('0x7'));var controller=require(_0x46f4('0x8'));router[_0x46f4('0x9')]('/',auth[_0x46f4('0xa')](),controller['index']);router[_0x46f4('0x9')](_0x46f4('0xb'),auth[_0x46f4('0xa')](),controller['show']);router['get'](_0x46f4('0xc'),auth[_0x46f4('0xa')](),controller['getFields']);router[_0x46f4('0x9')]('/:id/subjects',auth[_0x46f4('0xa')](),controller['getSubjects']);router[_0x46f4('0x9')](_0x46f4('0xd'),auth[_0x46f4('0xa')](),controller[_0x46f4('0xe')]);router[_0x46f4('0x9')](_0x46f4('0xf'),auth[_0x46f4('0xa')](),controller[_0x46f4('0x10')]);router[_0x46f4('0x11')]('/',auth[_0x46f4('0xa')](),controller[_0x46f4('0x12')]);router[_0x46f4('0x11')]('/:id/tags',auth[_0x46f4('0xa')](),controller[_0x46f4('0x13')]);router['put'](_0x46f4('0xb'),auth[_0x46f4('0xa')](),controller[_0x46f4('0x14')]);router['delete'](_0x46f4('0xb'),auth['isAuthenticated'](),controller['destroy']);module[_0x46f4('0x15')]=router; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.attributes.js b/server/api/intDeskConfiguration/intDeskConfiguration.attributes.js index ee57996..12ece0d 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 _0x718e=['exports','STRING','sequelize'];(function(_0x75f869,_0x3690d6){var _0x10af8b=function(_0x22d3ff){while(--_0x22d3ff){_0x75f869['push'](_0x75f869['shift']());}};_0x10af8b(++_0x3690d6);}(_0x718e,0x1a9));var _0xe718=function(_0x56e813,_0x2f7fe0){_0x56e813=_0x56e813-0x0;var _0x2ae2a4=_0x718e[_0x56e813];return _0x2ae2a4;};'use strict';var Sequelize=require(_0xe718('0x0'));module[_0xe718('0x1')]={'name':{'type':Sequelize[_0xe718('0x2')]},'description':{'type':Sequelize[_0xe718('0x2')]}}; \ No newline at end of file +var _0xb7c2=['sequelize','exports','STRING'];(function(_0x53c35c,_0x454f9f){var _0x698bd8=function(_0x86e843){while(--_0x86e843){_0x53c35c['push'](_0x53c35c['shift']());}};_0x698bd8(++_0x454f9f);}(_0xb7c2,0x1ef));var _0x2b7c=function(_0x3d4179,_0x301ec9){_0x3d4179=_0x3d4179-0x0;var _0x3e5f4d=_0xb7c2[_0x3d4179];return _0x3e5f4d;};'use strict';var Sequelize=require(_0x2b7c('0x0'));module[_0x2b7c('0x1')]={'name':{'type':Sequelize[_0x2b7c('0x2')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.controller.js b/server/api/intDeskConfiguration/intDeskConfiguration.controller.js index 01c62fe..9fa6b0c 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 _0xcb81=['end','stack','name','send','index','DeskConfiguration','rawAttributes','fieldName','type','key','model','map','query','keys','attributes','intersection','fields','length','hasOwnProperty','order','sort','where','filter','merge','VIRTUAL','options','includeAll','findAll','rows','show','params','filters','include','create','body','find','getFields','findOne','DeskField','pick','nolimit','getSubjects','getDescriptions','getTags','setTags','ids','html-pdf','eml-format','zip-dir','bluebird','mustache','util','path','sox','ejs','lodash','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','jayson/promise','client','http','test','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','info','DeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','DeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','status','json','count','offset','limit','set','apply','save','update'];(function(_0x28947d,_0x4cc9c6){var _0x12d2ee=function(_0x3f38fc){while(--_0x3f38fc){_0x28947d['push'](_0x28947d['shift']());}};_0x12d2ee(++_0x4cc9c6);}(_0xcb81,0x154));var _0x1cb8=function(_0x3e6b2f,_0x1ffa07){_0x3e6b2f=_0x3e6b2f-0x0;var _0x323215=_0xcb81[_0x3e6b2f];return _0x323215;};'use strict';var pdf=require(_0x1cb8('0x0'));var emlformat=require(_0x1cb8('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x1cb8('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x1cb8('0x3'));var Mustache=require(_0x1cb8('0x4'));var util=require(_0x1cb8('0x5'));var path=require(_0x1cb8('0x6'));var sox=require(_0x1cb8('0x7'));var csv=require('to-csv');var ejs=require(_0x1cb8('0x8'));var fs=require('fs');var _=require(_0x1cb8('0x9'));var squel=require('squel');var crypto=require(_0x1cb8('0xa'));var jsforce=require(_0x1cb8('0xb'));var deskjs=require(_0x1cb8('0xc'));var toCsv=require('to-csv');var querystring=require(_0x1cb8('0xd'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x1cb8('0xe'));var qs=require(_0x1cb8('0xf'));var as=require(_0x1cb8('0x10'));var hardwareService=require(_0x1cb8('0x11'));var logger=require(_0x1cb8('0x12'))(_0x1cb8('0x13'));var utils=require(_0x1cb8('0x14'));var config=require(_0x1cb8('0x15'));var db=require('../../mysqldb')['db'];var jayson=require(_0x1cb8('0x16'));var client=jayson[_0x1cb8('0x17')][_0x1cb8('0x18')]({'port':0x232a});function checkPasswordPattern(_0x299eea,_0x1371cb,_0x5dfde1){if(_0x5dfde1){var _0x389c12=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x389c12[_0x1cb8('0x19')](_0x1371cb)){return _0x299eea;}else{throw new db[(_0x1cb8('0x1a'))][(_0x1cb8('0x1b'))](_0x1cb8('0x1c'));}}else{return _0x299eea;}}function respondWithRpcPromise(_0xe5402a,_0x339ad0,_0x243930,_0x5af4a3){return new BPromise(function(_0x17a95d,_0x4b4917){var _0xf6b347=_0x5af4a3||client;return _0xf6b347[_0x1cb8('0x1d')](_0xe5402a,_0x243930)[_0x1cb8('0x1e')](function(_0x46abd0){logger[_0x1cb8('0x1f')](_0x1cb8('0x20'),_0x339ad0,_0x1cb8('0x21'));logger[_0x1cb8('0x22')](_0x1cb8('0x23'),_0x339ad0,_0x1cb8('0x21'),JSON[_0x1cb8('0x24')](_0x46abd0));if(_0x46abd0[_0x1cb8('0x25')]){if(_0x46abd0['error'][_0x1cb8('0x26')]===0x1f4){logger[_0x1cb8('0x25')](_0x1cb8('0x20'),_0x339ad0,_0x46abd0[_0x1cb8('0x25')]['message']);return _0x4b4917(_0x46abd0[_0x1cb8('0x25')]['message']);}logger[_0x1cb8('0x25')](_0x1cb8('0x20'),_0x339ad0,_0x46abd0[_0x1cb8('0x25')][_0x1cb8('0x27')]);return _0x17a95d(_0x46abd0['error']['message']);}else{logger[_0x1cb8('0x1f')](_0x1cb8('0x20'),_0x339ad0,_0x1cb8('0x21'));_0x17a95d(_0x46abd0[_0x1cb8('0x28')][_0x1cb8('0x27')]);}})[_0x1cb8('0x29')](function(_0x144b66){logger['error'](_0x1cb8('0x20'),_0x339ad0,_0x144b66);_0x4b4917(_0x144b66);});});}function respondWithStatusCode(_0x4554d5,_0x35c890){_0x35c890=_0x35c890||0xcc;return function(_0xeeb21d){if(_0xeeb21d){return _0x4554d5[_0x1cb8('0x2a')](_0x35c890);}return _0x4554d5[_0x1cb8('0x2b')](_0x35c890)['end']();};}function respondWithResult(_0x1ec995,_0x23ac21){_0x23ac21=_0x23ac21||0xc8;return function(_0xfdfb31){if(_0xfdfb31){return _0x1ec995[_0x1cb8('0x2b')](_0x23ac21)[_0x1cb8('0x2c')](_0xfdfb31);}};}function respondWithFilteredResult(_0x4a9b74,_0xed576b){return function(_0x2e3adf){if(_0x2e3adf){var _0x3a8b53=_0x2e3adf[_0x1cb8('0x2d')],_0x21c17a=_0xed576b[_0x1cb8('0x2e')],_0x4fda96=_0xed576b['offset']+_0xed576b[_0x1cb8('0x2f')],_0x2a79e0;if(_0x4fda96>=_0x3a8b53){_0x4fda96=_0x3a8b53;_0x2a79e0=0xc8;}else{_0x2a79e0=0xce;}_0x4a9b74[_0x1cb8('0x2b')](_0x2a79e0);return _0x4a9b74[_0x1cb8('0x30')]('Content-Range',_0x21c17a+'-'+_0x4fda96+'/'+_0x3a8b53)[_0x1cb8('0x2c')](_0x2e3adf);}return null;};}function patchUpdates(_0x3e2af4){return function(_0x239c62){try{jsonpatch[_0x1cb8('0x31')](_0x239c62,_0x3e2af4,!![]);}catch(_0x36f63d){return BPromise['reject'](_0x36f63d);}return _0x239c62[_0x1cb8('0x32')]();};}function saveUpdates(_0x1de806,_0x21fde7){return function(_0x1413a2){if(_0x1413a2){return _0x1413a2[_0x1cb8('0x33')](_0x1de806)[_0x1cb8('0x1e')](function(_0x145f75){return _0x145f75;});}return null;};}function removeEntity(_0x18cc99,_0x1aaae4){return function(_0x562975){if(_0x562975){return _0x562975['destroy']()[_0x1cb8('0x1e')](function(){_0x18cc99[_0x1cb8('0x2b')](0xcc)[_0x1cb8('0x34')]();});}};}function handleEntityNotFound(_0x5be4b7,_0x5f04e3){return function(_0x20fca9){if(!_0x20fca9){_0x5be4b7[_0x1cb8('0x2a')](0x194);}return _0x20fca9;};}function handleError(_0x9cdbed,_0xb21715){_0xb21715=_0xb21715||0x1f4;return function(_0x198848){logger[_0x1cb8('0x25')](_0x198848[_0x1cb8('0x35')]);if(_0x198848[_0x1cb8('0x36')]){delete _0x198848['name'];}_0x9cdbed[_0x1cb8('0x2b')](_0xb21715)[_0x1cb8('0x37')](_0x198848);};}exports[_0x1cb8('0x38')]=function(_0x328b7c,_0x1bf06d){var _0x421ce7={},_0xb5bc3c={},_0x2ad7f6={'count':0x0,'rows':[]};var _0x2e6ddb=_['map'](db[_0x1cb8('0x39')][_0x1cb8('0x3a')],function(_0x5e9f5f){return{'name':_0x5e9f5f[_0x1cb8('0x3b')],'type':_0x5e9f5f[_0x1cb8('0x3c')][_0x1cb8('0x3d')]};});_0xb5bc3c[_0x1cb8('0x3e')]=_[_0x1cb8('0x3f')](_0x2e6ddb,'name');_0xb5bc3c[_0x1cb8('0x40')]=_[_0x1cb8('0x41')](_0x328b7c[_0x1cb8('0x40')]);_0xb5bc3c['filters']=_['intersection'](_0xb5bc3c['model'],_0xb5bc3c[_0x1cb8('0x40')]);_0x421ce7[_0x1cb8('0x42')]=_[_0x1cb8('0x43')](_0xb5bc3c[_0x1cb8('0x3e')],qs['fields'](_0x328b7c['query'][_0x1cb8('0x44')]));_0x421ce7[_0x1cb8('0x42')]=_0x421ce7[_0x1cb8('0x42')][_0x1cb8('0x45')]?_0x421ce7[_0x1cb8('0x42')]:_0xb5bc3c[_0x1cb8('0x3e')];if(!_0x328b7c[_0x1cb8('0x40')][_0x1cb8('0x46')]('nolimit')){_0x421ce7[_0x1cb8('0x2f')]=qs[_0x1cb8('0x2f')](_0x328b7c[_0x1cb8('0x40')][_0x1cb8('0x2f')]);_0x421ce7['offset']=qs[_0x1cb8('0x2e')](_0x328b7c['query'][_0x1cb8('0x2e')]);}_0x421ce7[_0x1cb8('0x47')]=qs['sort'](_0x328b7c[_0x1cb8('0x40')][_0x1cb8('0x48')]);_0x421ce7[_0x1cb8('0x49')]=qs['filters'](_['pick'](_0x328b7c[_0x1cb8('0x40')],_0xb5bc3c['filters']),_0x2e6ddb);if(_0x328b7c[_0x1cb8('0x40')][_0x1cb8('0x4a')]){_0x421ce7[_0x1cb8('0x49')]=_[_0x1cb8('0x4b')](_0x421ce7[_0x1cb8('0x49')],{'$or':_[_0x1cb8('0x3f')](_0x2e6ddb,function(_0x15e960){if(_0x15e960['type']!==_0x1cb8('0x4c')){var _0x1df9cb={};_0x1df9cb[_0x15e960[_0x1cb8('0x36')]]={'$like':'%'+_0x328b7c[_0x1cb8('0x40')]['filter']+'%'};return _0x1df9cb;}})});}_0x421ce7=_[_0x1cb8('0x4b')]({},_0x421ce7,_0x328b7c[_0x1cb8('0x4d')]);var _0x1b83a6={'where':_0x421ce7[_0x1cb8('0x49')]};return db[_0x1cb8('0x39')]['count'](_0x1b83a6)[_0x1cb8('0x1e')](function(_0x4452ba){_0x2ad7f6[_0x1cb8('0x2d')]=_0x4452ba;if(_0x328b7c[_0x1cb8('0x40')][_0x1cb8('0x4e')]){_0x421ce7['include']=[{'all':!![]}];}return db[_0x1cb8('0x39')][_0x1cb8('0x4f')](_0x421ce7);})['then'](function(_0x423916){_0x2ad7f6[_0x1cb8('0x50')]=_0x423916;return _0x2ad7f6;})[_0x1cb8('0x1e')](respondWithFilteredResult(_0x1bf06d,_0x421ce7))[_0x1cb8('0x29')](handleError(_0x1bf06d,null));};exports[_0x1cb8('0x51')]=function(_0x4564aa,_0x3b063c){var _0x219541={'raw':![],'where':{'id':_0x4564aa[_0x1cb8('0x52')]['id']}},_0xd530f8={};_0xd530f8[_0x1cb8('0x3e')]=_[_0x1cb8('0x41')](db[_0x1cb8('0x39')][_0x1cb8('0x3a')]);_0xd530f8['query']=_[_0x1cb8('0x41')](_0x4564aa[_0x1cb8('0x40')]);_0xd530f8[_0x1cb8('0x53')]=_[_0x1cb8('0x43')](_0xd530f8[_0x1cb8('0x3e')],_0xd530f8[_0x1cb8('0x40')]);_0x219541[_0x1cb8('0x42')]=_['intersection'](_0xd530f8[_0x1cb8('0x3e')],qs[_0x1cb8('0x44')](_0x4564aa[_0x1cb8('0x40')]['fields']));_0x219541['attributes']=_0x219541[_0x1cb8('0x42')][_0x1cb8('0x45')]?_0x219541[_0x1cb8('0x42')]:_0xd530f8[_0x1cb8('0x3e')];if(_0x4564aa[_0x1cb8('0x40')]['includeAll']){_0x219541[_0x1cb8('0x54')]=[{'all':!![]}];}_0x219541=_[_0x1cb8('0x4b')]({},_0x219541,_0x4564aa[_0x1cb8('0x4d')]);return db['DeskConfiguration']['find'](_0x219541)['then'](handleEntityNotFound(_0x3b063c,null))[_0x1cb8('0x1e')](respondWithResult(_0x3b063c,null))['catch'](handleError(_0x3b063c,null));};exports[_0x1cb8('0x55')]=function(_0x34d5d1,_0xcd5fe2){return db[_0x1cb8('0x39')][_0x1cb8('0x55')](_0x34d5d1['body'],{})[_0x1cb8('0x1e')](respondWithResult(_0xcd5fe2,0xc9))[_0x1cb8('0x29')](handleError(_0xcd5fe2,null));};exports[_0x1cb8('0x33')]=function(_0x1d179b,_0x43585c){if(_0x1d179b[_0x1cb8('0x56')]['id']){delete _0x1d179b[_0x1cb8('0x56')]['id'];}return db['DeskConfiguration'][_0x1cb8('0x57')]({'where':{'id':_0x1d179b[_0x1cb8('0x52')]['id']}})[_0x1cb8('0x1e')](handleEntityNotFound(_0x43585c,null))[_0x1cb8('0x1e')](saveUpdates(_0x1d179b[_0x1cb8('0x56')],null))[_0x1cb8('0x1e')](respondWithResult(_0x43585c,null))[_0x1cb8('0x29')](handleError(_0x43585c,null));};exports['destroy']=function(_0x542064,_0x56ee83){return db[_0x1cb8('0x39')]['find']({'where':{'id':_0x542064[_0x1cb8('0x52')]['id']}})[_0x1cb8('0x1e')](handleEntityNotFound(_0x56ee83,null))[_0x1cb8('0x1e')](removeEntity(_0x56ee83,null))[_0x1cb8('0x29')](handleError(_0x56ee83,null));};exports[_0x1cb8('0x58')]=function(_0x5d736c,_0x579d54,_0x5de2b2){var _0x38e3d9={};var _0x3f8cba={};var _0x482d4f;var _0x2dc31b;return db['DeskConfiguration'][_0x1cb8('0x59')]({'where':{'id':_0x5d736c[_0x1cb8('0x52')]['id']}})['then'](handleEntityNotFound(_0x579d54,null))[_0x1cb8('0x1e')](function(_0x19f3f0){if(_0x19f3f0){_0x482d4f=_0x19f3f0;_0x3f8cba[_0x1cb8('0x3e')]=_[_0x1cb8('0x41')](db[_0x1cb8('0x5a')][_0x1cb8('0x3a')]);_0x3f8cba[_0x1cb8('0x40')]=_[_0x1cb8('0x41')](_0x5d736c[_0x1cb8('0x40')]);_0x3f8cba[_0x1cb8('0x53')]=_[_0x1cb8('0x43')](_0x3f8cba[_0x1cb8('0x3e')],_0x3f8cba[_0x1cb8('0x40')]);_0x38e3d9['attributes']=_[_0x1cb8('0x43')](_0x3f8cba[_0x1cb8('0x3e')],qs[_0x1cb8('0x44')](_0x5d736c['query'][_0x1cb8('0x44')]));_0x38e3d9[_0x1cb8('0x42')]=_0x38e3d9[_0x1cb8('0x42')][_0x1cb8('0x45')]?_0x38e3d9['attributes']:_0x3f8cba[_0x1cb8('0x3e')];_0x38e3d9[_0x1cb8('0x47')]=qs['sort'](_0x5d736c[_0x1cb8('0x40')][_0x1cb8('0x48')]);_0x38e3d9['where']=qs[_0x1cb8('0x53')](_[_0x1cb8('0x5b')](_0x5d736c[_0x1cb8('0x40')],_0x3f8cba[_0x1cb8('0x53')]));if(_0x5d736c['query']['filter']){_0x38e3d9['where']=_[_0x1cb8('0x4b')](_0x38e3d9[_0x1cb8('0x49')],{'$or':_[_0x1cb8('0x3f')](_0x38e3d9[_0x1cb8('0x42')],function(_0x2e2d1c){var _0x2f8cea={};_0x2f8cea[_0x2e2d1c]={'$like':'%'+_0x5d736c[_0x1cb8('0x40')]['filter']+'%'};return _0x2f8cea;})});}_0x38e3d9=_[_0x1cb8('0x4b')]({},_0x38e3d9,_0x5d736c[_0x1cb8('0x4d')]);return _0x482d4f[_0x1cb8('0x58')](_0x38e3d9);}})['then'](function(_0x3ed577){if(_0x3ed577){_0x2dc31b=_0x3ed577[_0x1cb8('0x45')];if(!_0x5d736c[_0x1cb8('0x40')][_0x1cb8('0x46')](_0x1cb8('0x5c'))){_0x38e3d9['limit']=qs[_0x1cb8('0x2f')](_0x5d736c[_0x1cb8('0x40')][_0x1cb8('0x2f')]);_0x38e3d9['offset']=qs[_0x1cb8('0x2e')](_0x5d736c[_0x1cb8('0x40')]['offset']);}return _0x482d4f[_0x1cb8('0x58')](_0x38e3d9);}})['then'](function(_0x5b3517){if(_0x5b3517){return _0x5b3517?{'count':_0x2dc31b,'rows':_0x5b3517}:null;}})[_0x1cb8('0x1e')](respondWithResult(_0x579d54,null))[_0x1cb8('0x29')](handleError(_0x579d54,null));};exports[_0x1cb8('0x5d')]=function(_0x4eba1a,_0x4945c9,_0x5943d5){var _0x6ac83={};var _0x2c40f1={};var _0x2b1cca;var _0x3ff46e;return db[_0x1cb8('0x39')][_0x1cb8('0x59')]({'where':{'id':_0x4eba1a[_0x1cb8('0x52')]['id']}})['then'](handleEntityNotFound(_0x4945c9,null))['then'](function(_0x524d5c){if(_0x524d5c){_0x2b1cca=_0x524d5c;_0x2c40f1['model']=_[_0x1cb8('0x41')](db['DeskField'][_0x1cb8('0x3a')]);_0x2c40f1['query']=_['keys'](_0x4eba1a['query']);_0x2c40f1[_0x1cb8('0x53')]=_[_0x1cb8('0x43')](_0x2c40f1[_0x1cb8('0x3e')],_0x2c40f1[_0x1cb8('0x40')]);_0x6ac83[_0x1cb8('0x42')]=_[_0x1cb8('0x43')](_0x2c40f1[_0x1cb8('0x3e')],qs[_0x1cb8('0x44')](_0x4eba1a[_0x1cb8('0x40')][_0x1cb8('0x44')]));_0x6ac83[_0x1cb8('0x42')]=_0x6ac83[_0x1cb8('0x42')][_0x1cb8('0x45')]?_0x6ac83[_0x1cb8('0x42')]:_0x2c40f1[_0x1cb8('0x3e')];_0x6ac83[_0x1cb8('0x47')]=qs['sort'](_0x4eba1a[_0x1cb8('0x40')][_0x1cb8('0x48')]);_0x6ac83[_0x1cb8('0x49')]=qs[_0x1cb8('0x53')](_[_0x1cb8('0x5b')](_0x4eba1a[_0x1cb8('0x40')],_0x2c40f1['filters']));if(_0x4eba1a[_0x1cb8('0x40')][_0x1cb8('0x4a')]){_0x6ac83[_0x1cb8('0x49')]=_[_0x1cb8('0x4b')](_0x6ac83[_0x1cb8('0x49')],{'$or':_['map'](_0x6ac83[_0x1cb8('0x42')],function(_0x34094c){var _0x5bfe0c={};_0x5bfe0c[_0x34094c]={'$like':'%'+_0x4eba1a[_0x1cb8('0x40')]['filter']+'%'};return _0x5bfe0c;})});}_0x6ac83=_[_0x1cb8('0x4b')]({},_0x6ac83,_0x4eba1a[_0x1cb8('0x4d')]);return _0x2b1cca[_0x1cb8('0x5d')](_0x6ac83);}})['then'](function(_0x44b951){if(_0x44b951){_0x3ff46e=_0x44b951[_0x1cb8('0x45')];if(!_0x4eba1a['query']['hasOwnProperty'](_0x1cb8('0x5c'))){_0x6ac83[_0x1cb8('0x2f')]=qs['limit'](_0x4eba1a[_0x1cb8('0x40')][_0x1cb8('0x2f')]);_0x6ac83[_0x1cb8('0x2e')]=qs[_0x1cb8('0x2e')](_0x4eba1a[_0x1cb8('0x40')][_0x1cb8('0x2e')]);}return _0x2b1cca[_0x1cb8('0x5d')](_0x6ac83);}})['then'](function(_0x438d49){if(_0x438d49){return _0x438d49?{'count':_0x3ff46e,'rows':_0x438d49}:null;}})['then'](respondWithResult(_0x4945c9,null))['catch'](handleError(_0x4945c9,null));};exports['getDescriptions']=function(_0x3a7740,_0x217178,_0x4ab060){var _0x1d30e1={};var _0xa0b86={};var _0x5a04b3;var _0x4822cc;return db['DeskConfiguration'][_0x1cb8('0x59')]({'where':{'id':_0x3a7740['params']['id']}})[_0x1cb8('0x1e')](handleEntityNotFound(_0x217178,null))[_0x1cb8('0x1e')](function(_0x2e392f){if(_0x2e392f){_0x5a04b3=_0x2e392f;_0xa0b86['model']=_['keys'](db[_0x1cb8('0x5a')]['rawAttributes']);_0xa0b86[_0x1cb8('0x40')]=_[_0x1cb8('0x41')](_0x3a7740[_0x1cb8('0x40')]);_0xa0b86[_0x1cb8('0x53')]=_[_0x1cb8('0x43')](_0xa0b86[_0x1cb8('0x3e')],_0xa0b86[_0x1cb8('0x40')]);_0x1d30e1[_0x1cb8('0x42')]=_[_0x1cb8('0x43')](_0xa0b86[_0x1cb8('0x3e')],qs[_0x1cb8('0x44')](_0x3a7740[_0x1cb8('0x40')][_0x1cb8('0x44')]));_0x1d30e1['attributes']=_0x1d30e1['attributes'][_0x1cb8('0x45')]?_0x1d30e1[_0x1cb8('0x42')]:_0xa0b86[_0x1cb8('0x3e')];_0x1d30e1[_0x1cb8('0x47')]=qs['sort'](_0x3a7740[_0x1cb8('0x40')][_0x1cb8('0x48')]);_0x1d30e1[_0x1cb8('0x49')]=qs[_0x1cb8('0x53')](_[_0x1cb8('0x5b')](_0x3a7740['query'],_0xa0b86[_0x1cb8('0x53')]));if(_0x3a7740[_0x1cb8('0x40')][_0x1cb8('0x4a')]){_0x1d30e1[_0x1cb8('0x49')]=_[_0x1cb8('0x4b')](_0x1d30e1[_0x1cb8('0x49')],{'$or':_[_0x1cb8('0x3f')](_0x1d30e1[_0x1cb8('0x42')],function(_0x3c0da5){var _0x7e24da={};_0x7e24da[_0x3c0da5]={'$like':'%'+_0x3a7740['query'][_0x1cb8('0x4a')]+'%'};return _0x7e24da;})});}_0x1d30e1=_[_0x1cb8('0x4b')]({},_0x1d30e1,_0x3a7740['options']);return _0x5a04b3['getDescriptions'](_0x1d30e1);}})[_0x1cb8('0x1e')](function(_0x5bbb90){if(_0x5bbb90){_0x4822cc=_0x5bbb90['length'];if(!_0x3a7740[_0x1cb8('0x40')][_0x1cb8('0x46')]('nolimit')){_0x1d30e1['limit']=qs[_0x1cb8('0x2f')](_0x3a7740['query'][_0x1cb8('0x2f')]);_0x1d30e1['offset']=qs[_0x1cb8('0x2e')](_0x3a7740[_0x1cb8('0x40')]['offset']);}return _0x5a04b3[_0x1cb8('0x5e')](_0x1d30e1);}})[_0x1cb8('0x1e')](function(_0x17615b){if(_0x17615b){return _0x17615b?{'count':_0x4822cc,'rows':_0x17615b}:null;}})[_0x1cb8('0x1e')](respondWithResult(_0x217178,null))[_0x1cb8('0x29')](handleError(_0x217178,null));};exports[_0x1cb8('0x5f')]=function(_0xeea4ce,_0x1f76d9,_0x4ef049){var _0x2025ec={};var _0x5de093={};var _0x1b90c6;var _0x24852e;return db[_0x1cb8('0x39')]['findOne']({'where':{'id':_0xeea4ce['params']['id']}})[_0x1cb8('0x1e')](handleEntityNotFound(_0x1f76d9,null))[_0x1cb8('0x1e')](function(_0x3868f4){if(_0x3868f4){_0x1b90c6=_0x3868f4;_0x5de093['model']=_['keys'](db['Tag']['rawAttributes']);_0x5de093[_0x1cb8('0x40')]=_[_0x1cb8('0x41')](_0xeea4ce[_0x1cb8('0x40')]);_0x5de093[_0x1cb8('0x53')]=_[_0x1cb8('0x43')](_0x5de093[_0x1cb8('0x3e')],_0x5de093['query']);_0x2025ec[_0x1cb8('0x42')]=_[_0x1cb8('0x43')](_0x5de093[_0x1cb8('0x3e')],qs[_0x1cb8('0x44')](_0xeea4ce[_0x1cb8('0x40')]['fields']));_0x2025ec[_0x1cb8('0x42')]=_0x2025ec[_0x1cb8('0x42')][_0x1cb8('0x45')]?_0x2025ec[_0x1cb8('0x42')]:_0x5de093[_0x1cb8('0x3e')];_0x2025ec[_0x1cb8('0x47')]=qs[_0x1cb8('0x48')](_0xeea4ce['query']['sort']);_0x2025ec['where']=qs[_0x1cb8('0x53')](_[_0x1cb8('0x5b')](_0xeea4ce[_0x1cb8('0x40')],_0x5de093[_0x1cb8('0x53')]));if(_0xeea4ce['query'][_0x1cb8('0x4a')]){_0x2025ec['where']=_[_0x1cb8('0x4b')](_0x2025ec[_0x1cb8('0x49')],{'$or':_[_0x1cb8('0x3f')](_0x2025ec['attributes'],function(_0x5e6b36){var _0x26190e={};_0x26190e[_0x5e6b36]={'$like':'%'+_0xeea4ce[_0x1cb8('0x40')][_0x1cb8('0x4a')]+'%'};return _0x26190e;})});}_0x2025ec=_[_0x1cb8('0x4b')]({},_0x2025ec,_0xeea4ce['options']);return _0x1b90c6[_0x1cb8('0x5f')](_0x2025ec);}})[_0x1cb8('0x1e')](function(_0x2fd2b2){if(_0x2fd2b2){_0x24852e=_0x2fd2b2['length'];if(!_0xeea4ce[_0x1cb8('0x40')][_0x1cb8('0x46')](_0x1cb8('0x5c'))){_0x2025ec[_0x1cb8('0x2f')]=qs[_0x1cb8('0x2f')](_0xeea4ce['query']['limit']);_0x2025ec[_0x1cb8('0x2e')]=qs['offset'](_0xeea4ce[_0x1cb8('0x40')][_0x1cb8('0x2e')]);}return _0x1b90c6['getTags'](_0x2025ec);}})[_0x1cb8('0x1e')](function(_0x1280c2){if(_0x1280c2){return _0x1280c2?{'count':_0x24852e,'rows':_0x1280c2}:null;}})[_0x1cb8('0x1e')](respondWithResult(_0x1f76d9,null))[_0x1cb8('0x29')](handleError(_0x1f76d9,null));};exports[_0x1cb8('0x60')]=function(_0x4cd7d8,_0x1a8ac0,_0x1a700d){if(_0x4cd7d8[_0x1cb8('0x56')]['id']){delete _0x4cd7d8[_0x1cb8('0x56')]['id'];}return db['DeskConfiguration'][_0x1cb8('0x59')]({'where':{'id':_0x4cd7d8[_0x1cb8('0x52')]['id']}})[_0x1cb8('0x1e')](handleEntityNotFound(_0x1a8ac0,null))[_0x1cb8('0x1e')](function(_0x5933c6){if(_0x5933c6){return _0x5933c6['setTags'](_0x4cd7d8['body'][_0x1cb8('0x61')]||[]);}return null;})[_0x1cb8('0x1e')](respondWithResult(_0x1a8ac0,null))[_0x1cb8('0x29')](handleError(_0x1a8ac0,null));}; \ No newline at end of file +var _0x2029=['../../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~!@#$%^&-_=+[{]}.','then','info','DeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','DeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','code','error','message','result','catch','sendStatus','end','count','offset','limit','set','json','reject','save','update','destroy','status','stack','name','index','DeskConfiguration','rawAttributes','fieldName','map','query','keys','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','sort','filters','filter','where','merge','type','VIRTUAL','findAll','show','params','includeAll','include','options','find','create','body','getFields','findOne','order','pick','getSubjects','DeskField','getDescriptions','getTags','Tag','setTags','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api'];(function(_0x220d5b,_0x290a1f){var _0x54ce5f=function(_0x11b979){while(--_0x11b979){_0x220d5b['push'](_0x220d5b['shift']());}};_0x54ce5f(++_0x290a1f);}(_0x2029,0x171));var _0x9202=function(_0x1419ef,_0x3ee45b){_0x1419ef=_0x1419ef-0x0;var _0x386d16=_0x2029[_0x1419ef];return _0x386d16;};'use strict';var pdf=require(_0x9202('0x0'));var emlformat=require(_0x9202('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x9202('0x2'));var jsonpatch=require(_0x9202('0x3'));var rp=require(_0x9202('0x4'));var moment=require(_0x9202('0x5'));var BPromise=require(_0x9202('0x6'));var Mustache=require(_0x9202('0x7'));var util=require(_0x9202('0x8'));var path=require(_0x9202('0x9'));var sox=require(_0x9202('0xa'));var csv=require(_0x9202('0xb'));var ejs=require(_0x9202('0xc'));var fs=require('fs');var _=require(_0x9202('0xd'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x9202('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x9202('0xb'));var querystring=require(_0x9202('0xf'));var Papa=require('papaparse');var Redis=require(_0x9202('0x10'));var authService=require(_0x9202('0x11'));var qs=require(_0x9202('0x12'));var as=require(_0x9202('0x13'));var hardwareService=require(_0x9202('0x14'));var logger=require(_0x9202('0x15'))(_0x9202('0x16'));var utils=require(_0x9202('0x17'));var config=require(_0x9202('0x18'));var db=require(_0x9202('0x19'))['db'];var jayson=require(_0x9202('0x1a'));var client=jayson[_0x9202('0x1b')][_0x9202('0x1c')]({'port':0x232a});function checkPasswordPattern(_0x946c29,_0x1890ac,_0x4093bc){if(_0x4093bc){var _0x152ef0=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x152ef0['test'](_0x1890ac)){return _0x946c29;}else{throw new db[(_0x9202('0x1d'))][(_0x9202('0x1e'))](_0x9202('0x1f'));}}else{return _0x946c29;}}function respondWithRpcPromise(_0xb5ecc3,_0x24e938,_0x141a17,_0x1ca7a3){return new BPromise(function(_0x1bb4c1,_0x8c1319){var _0x420245=_0x1ca7a3||client;return _0x420245['request'](_0xb5ecc3,_0x141a17)[_0x9202('0x20')](function(_0x1c3243){logger[_0x9202('0x21')](_0x9202('0x22'),_0x24e938,_0x9202('0x23'));logger[_0x9202('0x24')](_0x9202('0x25'),_0x24e938,_0x9202('0x23'),JSON[_0x9202('0x26')](_0x1c3243));if(_0x1c3243['error']){if(_0x1c3243['error'][_0x9202('0x27')]===0x1f4){logger[_0x9202('0x28')](_0x9202('0x22'),_0x24e938,_0x1c3243[_0x9202('0x28')]['message']);return _0x8c1319(_0x1c3243[_0x9202('0x28')]['message']);}logger[_0x9202('0x28')](_0x9202('0x22'),_0x24e938,_0x1c3243['error'][_0x9202('0x29')]);return _0x1bb4c1(_0x1c3243['error'][_0x9202('0x29')]);}else{logger[_0x9202('0x21')](_0x9202('0x22'),_0x24e938,_0x9202('0x23'));_0x1bb4c1(_0x1c3243[_0x9202('0x2a')][_0x9202('0x29')]);}})[_0x9202('0x2b')](function(_0x47de09){logger[_0x9202('0x28')](_0x9202('0x22'),_0x24e938,_0x47de09);_0x8c1319(_0x47de09);});});}function respondWithStatusCode(_0x2dab50,_0x2f4988){_0x2f4988=_0x2f4988||0xcc;return function(_0x3e722a){if(_0x3e722a){return _0x2dab50[_0x9202('0x2c')](_0x2f4988);}return _0x2dab50['status'](_0x2f4988)[_0x9202('0x2d')]();};}function respondWithResult(_0x2484ef,_0x3ecfc6){_0x3ecfc6=_0x3ecfc6||0xc8;return function(_0x5082b6){if(_0x5082b6){return _0x2484ef['status'](_0x3ecfc6)['json'](_0x5082b6);}};}function respondWithFilteredResult(_0x2be839,_0x17d7e8){return function(_0x228092){if(_0x228092){var _0x5459a0=_0x228092[_0x9202('0x2e')],_0x195589=_0x17d7e8[_0x9202('0x2f')],_0x5e9ca2=_0x17d7e8[_0x9202('0x2f')]+_0x17d7e8[_0x9202('0x30')],_0x35186d;if(_0x5e9ca2>=_0x5459a0){_0x5e9ca2=_0x5459a0;_0x35186d=0xc8;}else{_0x35186d=0xce;}_0x2be839['status'](_0x35186d);return _0x2be839[_0x9202('0x31')]('Content-Range',_0x195589+'-'+_0x5e9ca2+'/'+_0x5459a0)[_0x9202('0x32')](_0x228092);}return null;};}function patchUpdates(_0x390f8f){return function(_0x5d92ff){try{jsonpatch['apply'](_0x5d92ff,_0x390f8f,!![]);}catch(_0x52a964){return BPromise[_0x9202('0x33')](_0x52a964);}return _0x5d92ff[_0x9202('0x34')]();};}function saveUpdates(_0x251254,_0x3766ce){return function(_0x4ff7a4){if(_0x4ff7a4){return _0x4ff7a4[_0x9202('0x35')](_0x251254)[_0x9202('0x20')](function(_0x15591f){return _0x15591f;});}return null;};}function removeEntity(_0x4e7c30,_0x2de068){return function(_0x2a1178){if(_0x2a1178){return _0x2a1178[_0x9202('0x36')]()[_0x9202('0x20')](function(){_0x4e7c30[_0x9202('0x37')](0xcc)[_0x9202('0x2d')]();});}};}function handleEntityNotFound(_0xa4564a,_0x46d641){return function(_0x1c3070){if(!_0x1c3070){_0xa4564a[_0x9202('0x2c')](0x194);}return _0x1c3070;};}function handleError(_0x26697a,_0x3f34ca){_0x3f34ca=_0x3f34ca||0x1f4;return function(_0x243a64){logger['error'](_0x243a64[_0x9202('0x38')]);if(_0x243a64[_0x9202('0x39')]){delete _0x243a64['name'];}_0x26697a[_0x9202('0x37')](_0x3f34ca)['send'](_0x243a64);};}exports[_0x9202('0x3a')]=function(_0x265220,_0x3308e4){var _0x3c4c1f={},_0xd688c6={},_0x538109={'count':0x0,'rows':[]};var _0x3c394b=_['map'](db[_0x9202('0x3b')][_0x9202('0x3c')],function(_0x844134){return{'name':_0x844134[_0x9202('0x3d')],'type':_0x844134['type']['key']};});_0xd688c6['model']=_[_0x9202('0x3e')](_0x3c394b,_0x9202('0x39'));_0xd688c6[_0x9202('0x3f')]=_[_0x9202('0x40')](_0x265220[_0x9202('0x3f')]);_0xd688c6['filters']=_[_0x9202('0x41')](_0xd688c6[_0x9202('0x42')],_0xd688c6[_0x9202('0x3f')]);_0x3c4c1f[_0x9202('0x43')]=_[_0x9202('0x41')](_0xd688c6['model'],qs[_0x9202('0x44')](_0x265220[_0x9202('0x3f')][_0x9202('0x44')]));_0x3c4c1f[_0x9202('0x43')]=_0x3c4c1f[_0x9202('0x43')][_0x9202('0x45')]?_0x3c4c1f['attributes']:_0xd688c6[_0x9202('0x42')];if(!_0x265220[_0x9202('0x3f')][_0x9202('0x46')](_0x9202('0x47'))){_0x3c4c1f[_0x9202('0x30')]=qs['limit'](_0x265220[_0x9202('0x3f')][_0x9202('0x30')]);_0x3c4c1f[_0x9202('0x2f')]=qs[_0x9202('0x2f')](_0x265220['query'][_0x9202('0x2f')]);}_0x3c4c1f['order']=qs[_0x9202('0x48')](_0x265220[_0x9202('0x3f')]['sort']);_0x3c4c1f['where']=qs[_0x9202('0x49')](_['pick'](_0x265220[_0x9202('0x3f')],_0xd688c6[_0x9202('0x49')]),_0x3c394b);if(_0x265220[_0x9202('0x3f')][_0x9202('0x4a')]){_0x3c4c1f[_0x9202('0x4b')]=_[_0x9202('0x4c')](_0x3c4c1f['where'],{'$or':_[_0x9202('0x3e')](_0x3c394b,function(_0x2336ac){if(_0x2336ac[_0x9202('0x4d')]!==_0x9202('0x4e')){var _0x4e841e={};_0x4e841e[_0x2336ac['name']]={'$like':'%'+_0x265220[_0x9202('0x3f')][_0x9202('0x4a')]+'%'};return _0x4e841e;}})});}_0x3c4c1f=_[_0x9202('0x4c')]({},_0x3c4c1f,_0x265220['options']);var _0x5edc12={'where':_0x3c4c1f['where']};return db[_0x9202('0x3b')][_0x9202('0x2e')](_0x5edc12)[_0x9202('0x20')](function(_0x171017){_0x538109[_0x9202('0x2e')]=_0x171017;if(_0x265220[_0x9202('0x3f')]['includeAll']){_0x3c4c1f['include']=[{'all':!![]}];}return db[_0x9202('0x3b')][_0x9202('0x4f')](_0x3c4c1f);})[_0x9202('0x20')](function(_0x20d10e){_0x538109['rows']=_0x20d10e;return _0x538109;})['then'](respondWithFilteredResult(_0x3308e4,_0x3c4c1f))['catch'](handleError(_0x3308e4,null));};exports[_0x9202('0x50')]=function(_0x411c3a,_0x4b9d05){var _0x2b12a7={'raw':![],'where':{'id':_0x411c3a[_0x9202('0x51')]['id']}},_0xa8e09e={};_0xa8e09e[_0x9202('0x42')]=_[_0x9202('0x40')](db[_0x9202('0x3b')][_0x9202('0x3c')]);_0xa8e09e['query']=_[_0x9202('0x40')](_0x411c3a[_0x9202('0x3f')]);_0xa8e09e[_0x9202('0x49')]=_['intersection'](_0xa8e09e[_0x9202('0x42')],_0xa8e09e[_0x9202('0x3f')]);_0x2b12a7[_0x9202('0x43')]=_[_0x9202('0x41')](_0xa8e09e['model'],qs[_0x9202('0x44')](_0x411c3a['query'][_0x9202('0x44')]));_0x2b12a7[_0x9202('0x43')]=_0x2b12a7[_0x9202('0x43')][_0x9202('0x45')]?_0x2b12a7[_0x9202('0x43')]:_0xa8e09e[_0x9202('0x42')];if(_0x411c3a[_0x9202('0x3f')][_0x9202('0x52')]){_0x2b12a7[_0x9202('0x53')]=[{'all':!![]}];}_0x2b12a7=_[_0x9202('0x4c')]({},_0x2b12a7,_0x411c3a[_0x9202('0x54')]);return db[_0x9202('0x3b')][_0x9202('0x55')](_0x2b12a7)[_0x9202('0x20')](handleEntityNotFound(_0x4b9d05,null))[_0x9202('0x20')](respondWithResult(_0x4b9d05,null))[_0x9202('0x2b')](handleError(_0x4b9d05,null));};exports[_0x9202('0x56')]=function(_0x5cbe49,_0x5e072c){return db[_0x9202('0x3b')]['create'](_0x5cbe49['body'],{})[_0x9202('0x20')](respondWithResult(_0x5e072c,0xc9))[_0x9202('0x2b')](handleError(_0x5e072c,null));};exports[_0x9202('0x35')]=function(_0xd02f28,_0x4adf29){if(_0xd02f28[_0x9202('0x57')]['id']){delete _0xd02f28[_0x9202('0x57')]['id'];}return db[_0x9202('0x3b')][_0x9202('0x55')]({'where':{'id':_0xd02f28[_0x9202('0x51')]['id']}})['then'](handleEntityNotFound(_0x4adf29,null))[_0x9202('0x20')](saveUpdates(_0xd02f28[_0x9202('0x57')],null))[_0x9202('0x20')](respondWithResult(_0x4adf29,null))[_0x9202('0x2b')](handleError(_0x4adf29,null));};exports['destroy']=function(_0x15c753,_0x5babf6){return db[_0x9202('0x3b')][_0x9202('0x55')]({'where':{'id':_0x15c753[_0x9202('0x51')]['id']}})['then'](handleEntityNotFound(_0x5babf6,null))[_0x9202('0x20')](removeEntity(_0x5babf6,null))[_0x9202('0x2b')](handleError(_0x5babf6,null));};exports[_0x9202('0x58')]=function(_0x3a9a34,_0x5b68bf,_0x48ada5){var _0x295d41={};var _0x301c80={};var _0x126357;var _0x6e1b88;return db[_0x9202('0x3b')][_0x9202('0x59')]({'where':{'id':_0x3a9a34['params']['id']}})[_0x9202('0x20')](handleEntityNotFound(_0x5b68bf,null))[_0x9202('0x20')](function(_0x5689cf){if(_0x5689cf){_0x126357=_0x5689cf;_0x301c80[_0x9202('0x42')]=_[_0x9202('0x40')](db['DeskField']['rawAttributes']);_0x301c80[_0x9202('0x3f')]=_['keys'](_0x3a9a34['query']);_0x301c80[_0x9202('0x49')]=_[_0x9202('0x41')](_0x301c80[_0x9202('0x42')],_0x301c80[_0x9202('0x3f')]);_0x295d41[_0x9202('0x43')]=_[_0x9202('0x41')](_0x301c80[_0x9202('0x42')],qs[_0x9202('0x44')](_0x3a9a34[_0x9202('0x3f')][_0x9202('0x44')]));_0x295d41[_0x9202('0x43')]=_0x295d41[_0x9202('0x43')][_0x9202('0x45')]?_0x295d41[_0x9202('0x43')]:_0x301c80[_0x9202('0x42')];_0x295d41[_0x9202('0x5a')]=qs[_0x9202('0x48')](_0x3a9a34[_0x9202('0x3f')]['sort']);_0x295d41[_0x9202('0x4b')]=qs[_0x9202('0x49')](_[_0x9202('0x5b')](_0x3a9a34[_0x9202('0x3f')],_0x301c80[_0x9202('0x49')]));if(_0x3a9a34['query'][_0x9202('0x4a')]){_0x295d41[_0x9202('0x4b')]=_[_0x9202('0x4c')](_0x295d41[_0x9202('0x4b')],{'$or':_['map'](_0x295d41[_0x9202('0x43')],function(_0x5822d9){var _0x2f0e69={};_0x2f0e69[_0x5822d9]={'$like':'%'+_0x3a9a34[_0x9202('0x3f')]['filter']+'%'};return _0x2f0e69;})});}_0x295d41=_[_0x9202('0x4c')]({},_0x295d41,_0x3a9a34[_0x9202('0x54')]);return _0x126357['getFields'](_0x295d41);}})[_0x9202('0x20')](function(_0x12b935){if(_0x12b935){_0x6e1b88=_0x12b935[_0x9202('0x45')];if(!_0x3a9a34[_0x9202('0x3f')][_0x9202('0x46')](_0x9202('0x47'))){_0x295d41[_0x9202('0x30')]=qs[_0x9202('0x30')](_0x3a9a34['query']['limit']);_0x295d41[_0x9202('0x2f')]=qs[_0x9202('0x2f')](_0x3a9a34[_0x9202('0x3f')][_0x9202('0x2f')]);}return _0x126357[_0x9202('0x58')](_0x295d41);}})[_0x9202('0x20')](function(_0x44d876){if(_0x44d876){return _0x44d876?{'count':_0x6e1b88,'rows':_0x44d876}:null;}})['then'](respondWithResult(_0x5b68bf,null))[_0x9202('0x2b')](handleError(_0x5b68bf,null));};exports[_0x9202('0x5c')]=function(_0x3bca3b,_0x562719,_0x3edf89){var _0x393bfa={};var _0x1ab82f={};var _0x5f5259;var _0x248123;return db[_0x9202('0x3b')][_0x9202('0x59')]({'where':{'id':_0x3bca3b['params']['id']}})[_0x9202('0x20')](handleEntityNotFound(_0x562719,null))[_0x9202('0x20')](function(_0x588b45){if(_0x588b45){_0x5f5259=_0x588b45;_0x1ab82f[_0x9202('0x42')]=_[_0x9202('0x40')](db[_0x9202('0x5d')][_0x9202('0x3c')]);_0x1ab82f[_0x9202('0x3f')]=_['keys'](_0x3bca3b[_0x9202('0x3f')]);_0x1ab82f[_0x9202('0x49')]=_[_0x9202('0x41')](_0x1ab82f[_0x9202('0x42')],_0x1ab82f[_0x9202('0x3f')]);_0x393bfa[_0x9202('0x43')]=_[_0x9202('0x41')](_0x1ab82f[_0x9202('0x42')],qs[_0x9202('0x44')](_0x3bca3b['query']['fields']));_0x393bfa[_0x9202('0x43')]=_0x393bfa['attributes'][_0x9202('0x45')]?_0x393bfa[_0x9202('0x43')]:_0x1ab82f[_0x9202('0x42')];_0x393bfa['order']=qs[_0x9202('0x48')](_0x3bca3b[_0x9202('0x3f')][_0x9202('0x48')]);_0x393bfa['where']=qs[_0x9202('0x49')](_[_0x9202('0x5b')](_0x3bca3b[_0x9202('0x3f')],_0x1ab82f[_0x9202('0x49')]));if(_0x3bca3b[_0x9202('0x3f')]['filter']){_0x393bfa[_0x9202('0x4b')]=_[_0x9202('0x4c')](_0x393bfa[_0x9202('0x4b')],{'$or':_[_0x9202('0x3e')](_0x393bfa[_0x9202('0x43')],function(_0x520dc9){var _0x151838={};_0x151838[_0x520dc9]={'$like':'%'+_0x3bca3b[_0x9202('0x3f')]['filter']+'%'};return _0x151838;})});}_0x393bfa=_[_0x9202('0x4c')]({},_0x393bfa,_0x3bca3b[_0x9202('0x54')]);return _0x5f5259[_0x9202('0x5c')](_0x393bfa);}})[_0x9202('0x20')](function(_0x3a5f6f){if(_0x3a5f6f){_0x248123=_0x3a5f6f[_0x9202('0x45')];if(!_0x3bca3b[_0x9202('0x3f')][_0x9202('0x46')](_0x9202('0x47'))){_0x393bfa[_0x9202('0x30')]=qs[_0x9202('0x30')](_0x3bca3b[_0x9202('0x3f')][_0x9202('0x30')]);_0x393bfa[_0x9202('0x2f')]=qs[_0x9202('0x2f')](_0x3bca3b['query'][_0x9202('0x2f')]);}return _0x5f5259[_0x9202('0x5c')](_0x393bfa);}})[_0x9202('0x20')](function(_0x19d53c){if(_0x19d53c){return _0x19d53c?{'count':_0x248123,'rows':_0x19d53c}:null;}})[_0x9202('0x20')](respondWithResult(_0x562719,null))['catch'](handleError(_0x562719,null));};exports[_0x9202('0x5e')]=function(_0x1163ee,_0x261d84,_0x256bcb){var _0x1c31a1={};var _0x4f6273={};var _0x170dff;var _0x174a61;return db[_0x9202('0x3b')][_0x9202('0x59')]({'where':{'id':_0x1163ee[_0x9202('0x51')]['id']}})[_0x9202('0x20')](handleEntityNotFound(_0x261d84,null))['then'](function(_0x2dc7f8){if(_0x2dc7f8){_0x170dff=_0x2dc7f8;_0x4f6273['model']=_['keys'](db[_0x9202('0x5d')][_0x9202('0x3c')]);_0x4f6273['query']=_[_0x9202('0x40')](_0x1163ee[_0x9202('0x3f')]);_0x4f6273[_0x9202('0x49')]=_['intersection'](_0x4f6273[_0x9202('0x42')],_0x4f6273[_0x9202('0x3f')]);_0x1c31a1['attributes']=_[_0x9202('0x41')](_0x4f6273[_0x9202('0x42')],qs[_0x9202('0x44')](_0x1163ee[_0x9202('0x3f')][_0x9202('0x44')]));_0x1c31a1[_0x9202('0x43')]=_0x1c31a1[_0x9202('0x43')][_0x9202('0x45')]?_0x1c31a1['attributes']:_0x4f6273[_0x9202('0x42')];_0x1c31a1[_0x9202('0x5a')]=qs[_0x9202('0x48')](_0x1163ee[_0x9202('0x3f')][_0x9202('0x48')]);_0x1c31a1[_0x9202('0x4b')]=qs[_0x9202('0x49')](_[_0x9202('0x5b')](_0x1163ee[_0x9202('0x3f')],_0x4f6273[_0x9202('0x49')]));if(_0x1163ee[_0x9202('0x3f')][_0x9202('0x4a')]){_0x1c31a1[_0x9202('0x4b')]=_['merge'](_0x1c31a1['where'],{'$or':_[_0x9202('0x3e')](_0x1c31a1[_0x9202('0x43')],function(_0x5e5022){var _0x51a71a={};_0x51a71a[_0x5e5022]={'$like':'%'+_0x1163ee[_0x9202('0x3f')][_0x9202('0x4a')]+'%'};return _0x51a71a;})});}_0x1c31a1=_['merge']({},_0x1c31a1,_0x1163ee['options']);return _0x170dff['getDescriptions'](_0x1c31a1);}})[_0x9202('0x20')](function(_0x532b62){if(_0x532b62){_0x174a61=_0x532b62['length'];if(!_0x1163ee['query'][_0x9202('0x46')](_0x9202('0x47'))){_0x1c31a1[_0x9202('0x30')]=qs[_0x9202('0x30')](_0x1163ee['query'][_0x9202('0x30')]);_0x1c31a1[_0x9202('0x2f')]=qs['offset'](_0x1163ee['query'][_0x9202('0x2f')]);}return _0x170dff[_0x9202('0x5e')](_0x1c31a1);}})['then'](function(_0x2ce334){if(_0x2ce334){return _0x2ce334?{'count':_0x174a61,'rows':_0x2ce334}:null;}})['then'](respondWithResult(_0x261d84,null))[_0x9202('0x2b')](handleError(_0x261d84,null));};exports[_0x9202('0x5f')]=function(_0x21eb5e,_0x13c520,_0x5b9d7d){var _0x147b39={};var _0x4c0651={};var _0x4bc960;var _0x840677;return db[_0x9202('0x3b')][_0x9202('0x59')]({'where':{'id':_0x21eb5e[_0x9202('0x51')]['id']}})['then'](handleEntityNotFound(_0x13c520,null))[_0x9202('0x20')](function(_0x126651){if(_0x126651){_0x4bc960=_0x126651;_0x4c0651[_0x9202('0x42')]=_[_0x9202('0x40')](db[_0x9202('0x60')]['rawAttributes']);_0x4c0651[_0x9202('0x3f')]=_['keys'](_0x21eb5e['query']);_0x4c0651[_0x9202('0x49')]=_[_0x9202('0x41')](_0x4c0651[_0x9202('0x42')],_0x4c0651[_0x9202('0x3f')]);_0x147b39[_0x9202('0x43')]=_[_0x9202('0x41')](_0x4c0651[_0x9202('0x42')],qs[_0x9202('0x44')](_0x21eb5e['query'][_0x9202('0x44')]));_0x147b39[_0x9202('0x43')]=_0x147b39['attributes'][_0x9202('0x45')]?_0x147b39['attributes']:_0x4c0651[_0x9202('0x42')];_0x147b39['order']=qs[_0x9202('0x48')](_0x21eb5e[_0x9202('0x3f')][_0x9202('0x48')]);_0x147b39[_0x9202('0x4b')]=qs[_0x9202('0x49')](_[_0x9202('0x5b')](_0x21eb5e[_0x9202('0x3f')],_0x4c0651['filters']));if(_0x21eb5e[_0x9202('0x3f')]['filter']){_0x147b39[_0x9202('0x4b')]=_[_0x9202('0x4c')](_0x147b39[_0x9202('0x4b')],{'$or':_['map'](_0x147b39[_0x9202('0x43')],function(_0x1ccfc6){var _0x58ac24={};_0x58ac24[_0x1ccfc6]={'$like':'%'+_0x21eb5e[_0x9202('0x3f')][_0x9202('0x4a')]+'%'};return _0x58ac24;})});}_0x147b39=_[_0x9202('0x4c')]({},_0x147b39,_0x21eb5e['options']);return _0x4bc960['getTags'](_0x147b39);}})['then'](function(_0xb299ac){if(_0xb299ac){_0x840677=_0xb299ac[_0x9202('0x45')];if(!_0x21eb5e[_0x9202('0x3f')][_0x9202('0x46')]('nolimit')){_0x147b39['limit']=qs['limit'](_0x21eb5e[_0x9202('0x3f')][_0x9202('0x30')]);_0x147b39['offset']=qs[_0x9202('0x2f')](_0x21eb5e[_0x9202('0x3f')]['offset']);}return _0x4bc960[_0x9202('0x5f')](_0x147b39);}})[_0x9202('0x20')](function(_0x42c6b8){if(_0x42c6b8){return _0x42c6b8?{'count':_0x840677,'rows':_0x42c6b8}:null;}})[_0x9202('0x20')](respondWithResult(_0x13c520,null))[_0x9202('0x2b')](handleError(_0x13c520,null));};exports[_0x9202('0x61')]=function(_0x317071,_0x39fd5c,_0x5197ec){if(_0x317071[_0x9202('0x57')]['id']){delete _0x317071[_0x9202('0x57')]['id'];}return db[_0x9202('0x3b')][_0x9202('0x59')]({'where':{'id':_0x317071[_0x9202('0x51')]['id']}})[_0x9202('0x20')](handleEntityNotFound(_0x39fd5c,null))[_0x9202('0x20')](function(_0x482e80){if(_0x482e80){return _0x482e80[_0x9202('0x61')](_0x317071[_0x9202('0x57')]['ids']||[]);}return null;})[_0x9202('0x20')](respondWithResult(_0x39fd5c,null))[_0x9202('0x2b')](handleError(_0x39fd5c,null));}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.model.js b/server/api/intDeskConfiguration/intDeskConfiguration.model.js index 6407d2e..a6ab784 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 _0xd314=['moment','request-promise','path','../../config/environment','./intDeskConfiguration.attributes','exports','define','DeskConfiguration','int_desk_configurations','lodash','../../config/logger','api'];(function(_0x52d847,_0x54130f){var _0x4272d7=function(_0x3a92eb){while(--_0x3a92eb){_0x52d847['push'](_0x52d847['shift']());}};_0x4272d7(++_0x54130f);}(_0xd314,0x1dd));var _0x4d31=function(_0x260554,_0xa38304){_0x260554=_0x260554-0x0;var _0x392cf6=_0xd314[_0x260554];return _0x392cf6;};'use strict';var _=require(_0x4d31('0x0'));var util=require('util');var logger=require(_0x4d31('0x1'))(_0x4d31('0x2'));var moment=require(_0x4d31('0x3'));var BPromise=require('bluebird');var rp=require(_0x4d31('0x4'));var fs=require('fs');var path=require(_0x4d31('0x5'));var rimraf=require('rimraf');var config=require(_0x4d31('0x6'));var attributes=require(_0x4d31('0x7'));module[_0x4d31('0x8')]=function(_0x195af9,_0x5c772d){return _0x195af9[_0x4d31('0x9')](_0x4d31('0xa'),attributes,{'tableName':_0x4d31('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2e36=['define','DeskConfiguration','../../config/logger','moment','bluebird','path','../../config/environment'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0x2e36,0x175));var _0x62e3=function(_0x2ae9d8,_0x1f6962){_0x2ae9d8=_0x2ae9d8-0x0;var _0x3e5022=_0x2e36[_0x2ae9d8];return _0x3e5022;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x62e3('0x0'))('api');var moment=require(_0x62e3('0x1'));var BPromise=require(_0x62e3('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x62e3('0x3'));var rimraf=require('rimraf');var config=require(_0x62e3('0x4'));var attributes=require('./intDeskConfiguration.attributes');module['exports']=function(_0x534c05,_0x350867){return _0x534c05[_0x62e3('0x5')](_0x62e3('0x6'),attributes,{'tableName':'int_desk_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.rpc.js b/server/api/intDeskConfiguration/intDeskConfiguration.rpc.js index dd9c388..6582b33 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 _0x5712=['lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','request','DeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','DeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','message','info'];(function(_0x2842b4,_0x2b1b7b){var _0x2b9521=function(_0x3613b8){while(--_0x3613b8){_0x2842b4['push'](_0x2842b4['shift']());}};_0x2b9521(++_0x2b1b7b);}(_0x5712,0x140));var _0x2571=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x5712[_0x501510];return _0x1e6ee5;};'use strict';var _=require(_0x2571('0x0'));var util=require(_0x2571('0x1'));var moment=require(_0x2571('0x2'));var BPromise=require(_0x2571('0x3'));var rs=require(_0x2571('0x4'));var fs=require('fs');var Redis=require(_0x2571('0x5'));var db=require(_0x2571('0x6'))['db'];var utils=require(_0x2571('0x7'));var logger=require(_0x2571('0x8'))(_0x2571('0x9'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x2571('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3e19b2,_0x251ee6,_0x3ca885){return new BPromise(function(_0x204ecc,_0xda659a){return client[_0x2571('0xb')](_0x3e19b2,_0x3ca885)['then'](function(_0x1f0c98){logger['info'](_0x2571('0xc'),_0x251ee6,_0x2571('0xd'));logger[_0x2571('0xe')](_0x2571('0xf'),_0x251ee6,_0x2571('0xd'),JSON[_0x2571('0x10')](_0x1f0c98));if(_0x1f0c98[_0x2571('0x11')]){if(_0x1f0c98[_0x2571('0x11')]['code']===0x1f4){logger['error'](_0x2571('0xc'),_0x251ee6,_0x1f0c98[_0x2571('0x11')][_0x2571('0x12')]);return _0xda659a(_0x1f0c98[_0x2571('0x11')][_0x2571('0x12')]);}logger[_0x2571('0x11')](_0x2571('0xc'),_0x251ee6,_0x1f0c98[_0x2571('0x11')][_0x2571('0x12')]);return _0x204ecc(_0x1f0c98[_0x2571('0x11')][_0x2571('0x12')]);}else{logger[_0x2571('0x13')]('DeskConfiguration,\x20%s,\x20%s',_0x251ee6,_0x2571('0xd'));_0x204ecc(_0x1f0c98['result']['message']);}})['catch'](function(_0x4c3e11){logger[_0x2571('0x11')](_0x2571('0xc'),_0x251ee6,_0x4c3e11);_0xda659a(_0x4c3e11);});});} \ No newline at end of file +var _0xe9ad=['info','DeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then'];(function(_0x13fafd,_0x2f939d){var _0x2ae7b3=function(_0x2146f0){while(--_0x2146f0){_0x13fafd['push'](_0x13fafd['shift']());}};_0x2ae7b3(++_0x2f939d);}(_0xe9ad,0x82));var _0xde9a=function(_0xa24985,_0x1d2c15){_0xa24985=_0xa24985-0x0;var _0x2f7c36=_0xe9ad[_0xa24985];return _0x2f7c36;};'use strict';var _=require(_0xde9a('0x0'));var util=require(_0xde9a('0x1'));var moment=require(_0xde9a('0x2'));var BPromise=require(_0xde9a('0x3'));var rs=require(_0xde9a('0x4'));var fs=require('fs');var Redis=require(_0xde9a('0x5'));var db=require(_0xde9a('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xde9a('0x7'))(_0xde9a('0x8'));var config=require(_0xde9a('0x9'));var jayson=require(_0xde9a('0xa'));var client=jayson['client'][_0xde9a('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2bb666,_0xd47b9c,_0x5d4412){return new BPromise(function(_0x45d4a7,_0x17f89b){return client[_0xde9a('0xc')](_0x2bb666,_0x5d4412)[_0xde9a('0xd')](function(_0x297975){logger[_0xde9a('0xe')](_0xde9a('0xf'),_0xd47b9c,_0xde9a('0x10'));logger[_0xde9a('0x11')]('DeskConfiguration,\x20%s,\x20%s,\x20%s',_0xd47b9c,_0xde9a('0x10'),JSON[_0xde9a('0x12')](_0x297975));if(_0x297975[_0xde9a('0x13')]){if(_0x297975[_0xde9a('0x13')][_0xde9a('0x14')]===0x1f4){logger[_0xde9a('0x13')](_0xde9a('0xf'),_0xd47b9c,_0x297975[_0xde9a('0x13')][_0xde9a('0x15')]);return _0x17f89b(_0x297975['error'][_0xde9a('0x15')]);}logger[_0xde9a('0x13')](_0xde9a('0xf'),_0xd47b9c,_0x297975[_0xde9a('0x13')][_0xde9a('0x15')]);return _0x45d4a7(_0x297975[_0xde9a('0x13')][_0xde9a('0x15')]);}else{logger[_0xde9a('0xe')](_0xde9a('0xf'),_0xd47b9c,_0xde9a('0x10'));_0x45d4a7(_0x297975[_0xde9a('0x16')][_0xde9a('0x15')]);}})[_0xde9a('0x17')](function(_0x39e1d0){logger[_0xde9a('0x13')](_0xde9a('0xf'),_0xd47b9c,_0x39e1d0);_0x17f89b(_0x39e1d0);});});} \ No newline at end of file diff --git a/server/api/intDeskField/index.js b/server/api/intDeskField/index.js index 5bc89b9..d125647 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 _0xce71=['isAuthenticated','show','post','create','put','/:id','update','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./intDeskField.controller','index','get'];(function(_0x2a390b,_0xf49f9b){var _0x5df10a=function(_0x115dbe){while(--_0x115dbe){_0x2a390b['push'](_0x2a390b['shift']());}};_0x5df10a(++_0xf49f9b);}(_0xce71,0xf9));var _0x1ce7=function(_0x2e6724,_0xee938a){_0x2e6724=_0x2e6724-0x0;var _0x3eb41b=_0xce71[_0x2e6724];return _0x3eb41b;};'use strict';var multer=require(_0x1ce7('0x0'));var util=require(_0x1ce7('0x1'));var path=require(_0x1ce7('0x2'));var timeout=require(_0x1ce7('0x3'));var express=require(_0x1ce7('0x4'));var router=express[_0x1ce7('0x5')]();var auth=require(_0x1ce7('0x6'));var interaction=require(_0x1ce7('0x7'));var config=require('../../config/environment');var controller=require(_0x1ce7('0x8'));router['get']('/',auth['isAuthenticated'](),controller[_0x1ce7('0x9')]);router[_0x1ce7('0xa')]('/:id',auth[_0x1ce7('0xb')](),controller[_0x1ce7('0xc')]);router[_0x1ce7('0xd')]('/',auth[_0x1ce7('0xb')](),controller[_0x1ce7('0xe')]);router[_0x1ce7('0xf')](_0x1ce7('0x10'),auth[_0x1ce7('0xb')](),controller[_0x1ce7('0x11')]);router['delete'](_0x1ce7('0x10'),auth[_0x1ce7('0xb')](),controller[_0x1ce7('0x12')]);module[_0x1ce7('0x13')]=router; \ No newline at end of file +var _0xd4e7=['connect-timeout','express','../../components/auth/service','../../config/environment','./intDeskField.controller','get','isAuthenticated','index','/:id','show','post','create','put','update','destroy','multer','util','path'];(function(_0x5e2c70,_0x108e64){var _0x1e6cbc=function(_0x46e5fd){while(--_0x46e5fd){_0x5e2c70['push'](_0x5e2c70['shift']());}};_0x1e6cbc(++_0x108e64);}(_0xd4e7,0x8d));var _0x7d4e=function(_0x46a533,_0x5dcce4){_0x46a533=_0x46a533-0x0;var _0x3cb28f=_0xd4e7[_0x46a533];return _0x3cb28f;};'use strict';var multer=require(_0x7d4e('0x0'));var util=require(_0x7d4e('0x1'));var path=require(_0x7d4e('0x2'));var timeout=require(_0x7d4e('0x3'));var express=require(_0x7d4e('0x4'));var router=express['Router']();var auth=require(_0x7d4e('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x7d4e('0x6'));var controller=require(_0x7d4e('0x7'));router[_0x7d4e('0x8')]('/',auth[_0x7d4e('0x9')](),controller[_0x7d4e('0xa')]);router['get'](_0x7d4e('0xb'),auth[_0x7d4e('0x9')](),controller[_0x7d4e('0xc')]);router[_0x7d4e('0xd')]('/',auth[_0x7d4e('0x9')](),controller[_0x7d4e('0xe')]);router[_0x7d4e('0xf')](_0x7d4e('0xb'),auth[_0x7d4e('0x9')](),controller[_0x7d4e('0x10')]);router['delete']('/:id',auth[_0x7d4e('0x9')](),controller[_0x7d4e('0x11')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.attributes.js b/server/api/intDeskField/intDeskField.attributes.js index c2eeb84..8554ac6 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 _0x61ba=['ENUM','variable','BOOLEAN','sequelize','string','customVariable','keyValue','STRING'];(function(_0xcd15de,_0x4de4a8){var _0x3d87a0=function(_0x4037a0){while(--_0x4037a0){_0xcd15de['push'](_0xcd15de['shift']());}};_0x3d87a0(++_0x4de4a8);}(_0x61ba,0x163));var _0xa61b=function(_0x3daac,_0x3b5fb5){_0x3daac=_0x3daac-0x0;var _0x4877d1=_0x61ba[_0x3daac];return _0x4877d1;};'use strict';var Sequelize=require(_0xa61b('0x0'));module['exports']={'type':{'type':Sequelize['ENUM'](_0xa61b('0x1'),'variable',_0xa61b('0x2'),_0xa61b('0x3')),'defaultValue':_0xa61b('0x1')},'content':{'type':Sequelize[_0xa61b('0x4')]},'key':{'type':Sequelize[_0xa61b('0x4')]},'keyType':{'type':Sequelize[_0xa61b('0x5')](_0xa61b('0x1'),_0xa61b('0x6'),_0xa61b('0x2'))},'keyContent':{'type':Sequelize[_0xa61b('0x4')]},'idField':{'type':Sequelize[_0xa61b('0x4')]},'nameField':{'type':Sequelize[_0xa61b('0x4')]},'customField':{'type':Sequelize[_0xa61b('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xa61b('0x4')]}}; \ No newline at end of file +var _0xabe5=['ENUM','string','customVariable','STRING','variable','BOOLEAN','exports'];(function(_0x5023b1,_0x43e3e4){var _0x5978a8=function(_0x29a345){while(--_0x29a345){_0x5023b1['push'](_0x5023b1['shift']());}};_0x5978a8(++_0x43e3e4);}(_0xabe5,0x7d));var _0x5abe=function(_0x477c24,_0x37ded2){_0x477c24=_0x477c24-0x0;var _0x9d8cf9=_0xabe5[_0x477c24];return _0x9d8cf9;};'use strict';var Sequelize=require('sequelize');module[_0x5abe('0x0')]={'type':{'type':Sequelize[_0x5abe('0x1')](_0x5abe('0x2'),'variable',_0x5abe('0x3'),'keyValue'),'defaultValue':_0x5abe('0x2')},'content':{'type':Sequelize[_0x5abe('0x4')]},'key':{'type':Sequelize[_0x5abe('0x4')]},'keyType':{'type':Sequelize[_0x5abe('0x1')](_0x5abe('0x2'),_0x5abe('0x5'),_0x5abe('0x3'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0x5abe('0x4')]},'customField':{'type':Sequelize[_0x5abe('0x6')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x5abe('0x4')]}}; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.controller.js b/server/api/intDeskField/intDeskField.controller.js index b122acb..debc247 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 _0x375c=['params','includeAll','find','body','html-pdf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','count','limit','set','Content-Range','json','apply','reject','save','update','destroy','end','sendStatus','error','stack','name','send','index','map','DeskField','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','offset','order','sort','where','pick','merge','VIRTUAL','filter','options','then','include','rows','catch'];(function(_0x54934d,_0x5e4b3a){var _0x37b414=function(_0x505c22){while(--_0x505c22){_0x54934d['push'](_0x54934d['shift']());}};_0x37b414(++_0x5e4b3a);}(_0x375c,0x130));var _0xc375=function(_0x213127,_0x1a0287){_0x213127=_0x213127-0x0;var _0x535b4e=_0x375c[_0x213127];return _0x535b4e;};'use strict';var pdf=require(_0xc375('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xc375('0x1'));var jsonpatch=require(_0xc375('0x2'));var rp=require(_0xc375('0x3'));var moment=require('moment');var BPromise=require(_0xc375('0x4'));var Mustache=require(_0xc375('0x5'));var util=require(_0xc375('0x6'));var path=require(_0xc375('0x7'));var sox=require(_0xc375('0x8'));var csv=require(_0xc375('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0xc375('0xa'));var jsforce=require(_0xc375('0xb'));var deskjs=require(_0xc375('0xc'));var toCsv=require(_0xc375('0x9'));var querystring=require(_0xc375('0xd'));var Papa=require(_0xc375('0xe'));var Redis=require(_0xc375('0xf'));var authService=require(_0xc375('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0xc375('0x11'));var hardwareService=require(_0xc375('0x12'));var logger=require(_0xc375('0x13'))(_0xc375('0x14'));var utils=require(_0xc375('0x15'));var config=require(_0xc375('0x16'));var db=require(_0xc375('0x17'))['db'];function respondWithStatusCode(_0x20acdc,_0x10895d){_0x10895d=_0x10895d||0xcc;return function(_0x1a21ff){if(_0x1a21ff){return _0x20acdc['sendStatus'](_0x10895d);}return _0x20acdc[_0xc375('0x18')](_0x10895d)['end']();};}function respondWithResult(_0x4ecf66,_0x47cab5){_0x47cab5=_0x47cab5||0xc8;return function(_0x2ddbdb){if(_0x2ddbdb){return _0x4ecf66[_0xc375('0x18')](_0x47cab5)['json'](_0x2ddbdb);}};}function respondWithFilteredResult(_0x2a788d,_0x3b5cc0){return function(_0x856eab){if(_0x856eab){var _0x38a3e5=_0x856eab[_0xc375('0x19')],_0x1bc300=_0x3b5cc0['offset'],_0x54dd4a=_0x3b5cc0['offset']+_0x3b5cc0[_0xc375('0x1a')],_0x2fb19c;if(_0x54dd4a>=_0x38a3e5){_0x54dd4a=_0x38a3e5;_0x2fb19c=0xc8;}else{_0x2fb19c=0xce;}_0x2a788d[_0xc375('0x18')](_0x2fb19c);return _0x2a788d[_0xc375('0x1b')](_0xc375('0x1c'),_0x1bc300+'-'+_0x54dd4a+'/'+_0x38a3e5)[_0xc375('0x1d')](_0x856eab);}return null;};}function patchUpdates(_0x1d6e6f){return function(_0x595031){try{jsonpatch[_0xc375('0x1e')](_0x595031,_0x1d6e6f,!![]);}catch(_0x466954){return BPromise[_0xc375('0x1f')](_0x466954);}return _0x595031[_0xc375('0x20')]();};}function saveUpdates(_0x153b42,_0xa2ac87){return function(_0x5b1fc1){if(_0x5b1fc1){return _0x5b1fc1[_0xc375('0x21')](_0x153b42)['then'](function(_0x6b836f){return _0x6b836f;});}return null;};}function removeEntity(_0x3d4e5e,_0x238004){return function(_0x40d8c5){if(_0x40d8c5){return _0x40d8c5[_0xc375('0x22')]()['then'](function(){_0x3d4e5e['status'](0xcc)[_0xc375('0x23')]();});}};}function handleEntityNotFound(_0x1d783d,_0x59ed20){return function(_0x531068){if(!_0x531068){_0x1d783d[_0xc375('0x24')](0x194);}return _0x531068;};}function handleError(_0x3c711c,_0x347cb7){_0x347cb7=_0x347cb7||0x1f4;return function(_0x37280e){logger[_0xc375('0x25')](_0x37280e[_0xc375('0x26')]);if(_0x37280e['name']){delete _0x37280e[_0xc375('0x27')];}_0x3c711c[_0xc375('0x18')](_0x347cb7)[_0xc375('0x28')](_0x37280e);};}exports[_0xc375('0x29')]=function(_0x3f622b,_0x45f3d9){var _0xf061be={},_0x3a9a05={},_0x491fd8={'count':0x0,'rows':[]};var _0x6c7d2e=_[_0xc375('0x2a')](db[_0xc375('0x2b')][_0xc375('0x2c')],function(_0x2648e6){return{'name':_0x2648e6[_0xc375('0x2d')],'type':_0x2648e6[_0xc375('0x2e')][_0xc375('0x2f')]};});_0x3a9a05[_0xc375('0x30')]=_[_0xc375('0x2a')](_0x6c7d2e,'name');_0x3a9a05[_0xc375('0x31')]=_[_0xc375('0x32')](_0x3f622b[_0xc375('0x31')]);_0x3a9a05[_0xc375('0x33')]=_[_0xc375('0x34')](_0x3a9a05[_0xc375('0x30')],_0x3a9a05['query']);_0xf061be[_0xc375('0x35')]=_['intersection'](_0x3a9a05['model'],qs[_0xc375('0x36')](_0x3f622b[_0xc375('0x31')]['fields']));_0xf061be['attributes']=_0xf061be[_0xc375('0x35')][_0xc375('0x37')]?_0xf061be['attributes']:_0x3a9a05['model'];if(!_0x3f622b['query'][_0xc375('0x38')](_0xc375('0x39'))){_0xf061be[_0xc375('0x1a')]=qs[_0xc375('0x1a')](_0x3f622b[_0xc375('0x31')][_0xc375('0x1a')]);_0xf061be['offset']=qs[_0xc375('0x3a')](_0x3f622b[_0xc375('0x31')][_0xc375('0x3a')]);}_0xf061be[_0xc375('0x3b')]=qs[_0xc375('0x3c')](_0x3f622b[_0xc375('0x31')][_0xc375('0x3c')]);_0xf061be[_0xc375('0x3d')]=qs['filters'](_[_0xc375('0x3e')](_0x3f622b[_0xc375('0x31')],_0x3a9a05[_0xc375('0x33')]),_0x6c7d2e);if(_0x3f622b[_0xc375('0x31')]['filter']){_0xf061be[_0xc375('0x3d')]=_[_0xc375('0x3f')](_0xf061be[_0xc375('0x3d')],{'$or':_[_0xc375('0x2a')](_0x6c7d2e,function(_0x217de9){if(_0x217de9[_0xc375('0x2e')]!==_0xc375('0x40')){var _0x1d9f8b={};_0x1d9f8b[_0x217de9[_0xc375('0x27')]]={'$like':'%'+_0x3f622b[_0xc375('0x31')][_0xc375('0x41')]+'%'};return _0x1d9f8b;}})});}_0xf061be=_[_0xc375('0x3f')]({},_0xf061be,_0x3f622b[_0xc375('0x42')]);var _0x56ae6f={'where':_0xf061be[_0xc375('0x3d')]};return db[_0xc375('0x2b')]['count'](_0x56ae6f)[_0xc375('0x43')](function(_0x2e2a68){_0x491fd8[_0xc375('0x19')]=_0x2e2a68;if(_0x3f622b[_0xc375('0x31')]['includeAll']){_0xf061be[_0xc375('0x44')]=[{'all':!![]}];}return db['DeskField']['findAll'](_0xf061be);})[_0xc375('0x43')](function(_0x3896f9){_0x491fd8[_0xc375('0x45')]=_0x3896f9;return _0x491fd8;})[_0xc375('0x43')](respondWithFilteredResult(_0x45f3d9,_0xf061be))[_0xc375('0x46')](handleError(_0x45f3d9,null));};exports['show']=function(_0xc64849,_0x43144b){var _0x164860={'raw':!![],'where':{'id':_0xc64849[_0xc375('0x47')]['id']}},_0x4edf81={};_0x4edf81[_0xc375('0x30')]=_[_0xc375('0x32')](db[_0xc375('0x2b')][_0xc375('0x2c')]);_0x4edf81[_0xc375('0x31')]=_['keys'](_0xc64849[_0xc375('0x31')]);_0x4edf81[_0xc375('0x33')]=_['intersection'](_0x4edf81[_0xc375('0x30')],_0x4edf81[_0xc375('0x31')]);_0x164860[_0xc375('0x35')]=_[_0xc375('0x34')](_0x4edf81['model'],qs[_0xc375('0x36')](_0xc64849[_0xc375('0x31')]['fields']));_0x164860['attributes']=_0x164860['attributes'][_0xc375('0x37')]?_0x164860[_0xc375('0x35')]:_0x4edf81[_0xc375('0x30')];if(_0xc64849[_0xc375('0x31')][_0xc375('0x48')]){_0x164860[_0xc375('0x44')]=[{'all':!![]}];}_0x164860=_[_0xc375('0x3f')]({},_0x164860,_0xc64849[_0xc375('0x42')]);return db[_0xc375('0x2b')][_0xc375('0x49')](_0x164860)[_0xc375('0x43')](handleEntityNotFound(_0x43144b,null))[_0xc375('0x43')](respondWithResult(_0x43144b,null))[_0xc375('0x46')](handleError(_0x43144b,null));};exports['create']=function(_0x1fc37e,_0x3b6e5a){return db['DeskField']['create'](_0x1fc37e[_0xc375('0x4a')],{})['then'](respondWithResult(_0x3b6e5a,0xc9))['catch'](handleError(_0x3b6e5a,null));};exports[_0xc375('0x21')]=function(_0x4767e4,_0x1431df){if(_0x4767e4[_0xc375('0x4a')]['id']){delete _0x4767e4[_0xc375('0x4a')]['id'];}return db[_0xc375('0x2b')][_0xc375('0x49')]({'where':{'id':_0x4767e4['params']['id']}})['then'](handleEntityNotFound(_0x1431df,null))[_0xc375('0x43')](saveUpdates(_0x4767e4[_0xc375('0x4a')],null))[_0xc375('0x43')](respondWithResult(_0x1431df,null))['catch'](handleError(_0x1431df,null));};exports[_0xc375('0x22')]=function(_0x56ad54,_0x41197c){return db[_0xc375('0x2b')][_0xc375('0x49')]({'where':{'id':_0x56ad54[_0xc375('0x47')]['id']}})[_0xc375('0x43')](handleEntityNotFound(_0x41197c,null))[_0xc375('0x43')](removeEntity(_0x41197c,null))['catch'](handleError(_0x41197c,null));}; \ No newline at end of file +var _0x1ae2=['papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','count','offset','limit','set','apply','save','update','then','destroy','end','error','stack','name','send','DeskField','rawAttributes','fieldName','type','key','query','keys','intersection','attributes','model','fields','hasOwnProperty','nolimit','sort','where','filters','pick','filter','merge','map','VIRTUAL','options','include','findAll','rows','catch','params','includeAll','find','create','body','eml-format','rimraf','fast-json-patch','moment','bluebird','mustache','util','path','sox','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring'];(function(_0xaa0309,_0x1c8008){var _0x5de7ce=function(_0x3aa6ae){while(--_0x3aa6ae){_0xaa0309['push'](_0xaa0309['shift']());}};_0x5de7ce(++_0x1c8008);}(_0x1ae2,0xd0));var _0x21ae=function(_0x946d03,_0x3beb5a){_0x946d03=_0x946d03-0x0;var _0x564292=_0x1ae2[_0x946d03];return _0x564292;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x21ae('0x0'));var rimraf=require(_0x21ae('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x21ae('0x2'));var rp=require('request-promise');var moment=require(_0x21ae('0x3'));var BPromise=require(_0x21ae('0x4'));var Mustache=require(_0x21ae('0x5'));var util=require(_0x21ae('0x6'));var path=require(_0x21ae('0x7'));var sox=require(_0x21ae('0x8'));var csv=require('to-csv');var ejs=require(_0x21ae('0x9'));var fs=require('fs');var _=require(_0x21ae('0xa'));var squel=require(_0x21ae('0xb'));var crypto=require(_0x21ae('0xc'));var jsforce=require(_0x21ae('0xd'));var deskjs=require(_0x21ae('0xe'));var toCsv=require(_0x21ae('0xf'));var querystring=require(_0x21ae('0x10'));var Papa=require(_0x21ae('0x11'));var Redis=require(_0x21ae('0x12'));var authService=require(_0x21ae('0x13'));var qs=require(_0x21ae('0x14'));var as=require(_0x21ae('0x15'));var hardwareService=require(_0x21ae('0x16'));var logger=require('../../config/logger')(_0x21ae('0x17'));var utils=require(_0x21ae('0x18'));var config=require(_0x21ae('0x19'));var db=require(_0x21ae('0x1a'))['db'];function respondWithStatusCode(_0x7fe681,_0xa77e2a){_0xa77e2a=_0xa77e2a||0xcc;return function(_0x397226){if(_0x397226){return _0x7fe681[_0x21ae('0x1b')](_0xa77e2a);}return _0x7fe681['status'](_0xa77e2a)['end']();};}function respondWithResult(_0x47772e,_0x231ffc){_0x231ffc=_0x231ffc||0xc8;return function(_0x3541e8){if(_0x3541e8){return _0x47772e[_0x21ae('0x1c')](_0x231ffc)[_0x21ae('0x1d')](_0x3541e8);}};}function respondWithFilteredResult(_0x493d4b,_0x20a818){return function(_0x542941){if(_0x542941){var _0x4aa242=_0x542941[_0x21ae('0x1e')],_0x5a3478=_0x20a818[_0x21ae('0x1f')],_0x21bc9e=_0x20a818[_0x21ae('0x1f')]+_0x20a818[_0x21ae('0x20')],_0x57e55c;if(_0x21bc9e>=_0x4aa242){_0x21bc9e=_0x4aa242;_0x57e55c=0xc8;}else{_0x57e55c=0xce;}_0x493d4b[_0x21ae('0x1c')](_0x57e55c);return _0x493d4b[_0x21ae('0x21')]('Content-Range',_0x5a3478+'-'+_0x21bc9e+'/'+_0x4aa242)['json'](_0x542941);}return null;};}function patchUpdates(_0x26bf7c){return function(_0x3d6f0a){try{jsonpatch[_0x21ae('0x22')](_0x3d6f0a,_0x26bf7c,!![]);}catch(_0x4e8f88){return BPromise['reject'](_0x4e8f88);}return _0x3d6f0a[_0x21ae('0x23')]();};}function saveUpdates(_0x4d1ca0,_0x1d3bc2){return function(_0xf6f6fb){if(_0xf6f6fb){return _0xf6f6fb[_0x21ae('0x24')](_0x4d1ca0)[_0x21ae('0x25')](function(_0x46eac6){return _0x46eac6;});}return null;};}function removeEntity(_0x4ae1b1,_0x584043){return function(_0x426632){if(_0x426632){return _0x426632[_0x21ae('0x26')]()[_0x21ae('0x25')](function(){_0x4ae1b1[_0x21ae('0x1c')](0xcc)[_0x21ae('0x27')]();});}};}function handleEntityNotFound(_0x3de78b,_0x12a105){return function(_0x5b7e9e){if(!_0x5b7e9e){_0x3de78b[_0x21ae('0x1b')](0x194);}return _0x5b7e9e;};}function handleError(_0x5d5b0c,_0x45dabd){_0x45dabd=_0x45dabd||0x1f4;return function(_0x331dff){logger[_0x21ae('0x28')](_0x331dff[_0x21ae('0x29')]);if(_0x331dff[_0x21ae('0x2a')]){delete _0x331dff['name'];}_0x5d5b0c[_0x21ae('0x1c')](_0x45dabd)[_0x21ae('0x2b')](_0x331dff);};}exports['index']=function(_0x50112a,_0x452aac){var _0x37e6d5={},_0x182894={},_0x2e86ed={'count':0x0,'rows':[]};var _0x2b2d6d=_['map'](db[_0x21ae('0x2c')][_0x21ae('0x2d')],function(_0x2099b4){return{'name':_0x2099b4[_0x21ae('0x2e')],'type':_0x2099b4[_0x21ae('0x2f')][_0x21ae('0x30')]};});_0x182894['model']=_['map'](_0x2b2d6d,_0x21ae('0x2a'));_0x182894[_0x21ae('0x31')]=_[_0x21ae('0x32')](_0x50112a[_0x21ae('0x31')]);_0x182894['filters']=_[_0x21ae('0x33')](_0x182894['model'],_0x182894[_0x21ae('0x31')]);_0x37e6d5[_0x21ae('0x34')]=_[_0x21ae('0x33')](_0x182894[_0x21ae('0x35')],qs[_0x21ae('0x36')](_0x50112a[_0x21ae('0x31')][_0x21ae('0x36')]));_0x37e6d5['attributes']=_0x37e6d5['attributes']['length']?_0x37e6d5[_0x21ae('0x34')]:_0x182894[_0x21ae('0x35')];if(!_0x50112a[_0x21ae('0x31')][_0x21ae('0x37')](_0x21ae('0x38'))){_0x37e6d5[_0x21ae('0x20')]=qs[_0x21ae('0x20')](_0x50112a[_0x21ae('0x31')][_0x21ae('0x20')]);_0x37e6d5['offset']=qs['offset'](_0x50112a[_0x21ae('0x31')][_0x21ae('0x1f')]);}_0x37e6d5['order']=qs['sort'](_0x50112a[_0x21ae('0x31')][_0x21ae('0x39')]);_0x37e6d5[_0x21ae('0x3a')]=qs[_0x21ae('0x3b')](_[_0x21ae('0x3c')](_0x50112a['query'],_0x182894[_0x21ae('0x3b')]),_0x2b2d6d);if(_0x50112a['query'][_0x21ae('0x3d')]){_0x37e6d5['where']=_[_0x21ae('0x3e')](_0x37e6d5[_0x21ae('0x3a')],{'$or':_[_0x21ae('0x3f')](_0x2b2d6d,function(_0x2bba61){if(_0x2bba61[_0x21ae('0x2f')]!==_0x21ae('0x40')){var _0x398b5b={};_0x398b5b[_0x2bba61[_0x21ae('0x2a')]]={'$like':'%'+_0x50112a[_0x21ae('0x31')][_0x21ae('0x3d')]+'%'};return _0x398b5b;}})});}_0x37e6d5=_[_0x21ae('0x3e')]({},_0x37e6d5,_0x50112a[_0x21ae('0x41')]);var _0x571668={'where':_0x37e6d5[_0x21ae('0x3a')]};return db[_0x21ae('0x2c')]['count'](_0x571668)[_0x21ae('0x25')](function(_0x3ee7ed){_0x2e86ed[_0x21ae('0x1e')]=_0x3ee7ed;if(_0x50112a[_0x21ae('0x31')]['includeAll']){_0x37e6d5[_0x21ae('0x42')]=[{'all':!![]}];}return db['DeskField'][_0x21ae('0x43')](_0x37e6d5);})['then'](function(_0x27a3c4){_0x2e86ed[_0x21ae('0x44')]=_0x27a3c4;return _0x2e86ed;})[_0x21ae('0x25')](respondWithFilteredResult(_0x452aac,_0x37e6d5))[_0x21ae('0x45')](handleError(_0x452aac,null));};exports['show']=function(_0x28116f,_0x322303){var _0x55b7e7={'raw':!![],'where':{'id':_0x28116f[_0x21ae('0x46')]['id']}},_0x459011={};_0x459011[_0x21ae('0x35')]=_[_0x21ae('0x32')](db[_0x21ae('0x2c')][_0x21ae('0x2d')]);_0x459011['query']=_[_0x21ae('0x32')](_0x28116f[_0x21ae('0x31')]);_0x459011[_0x21ae('0x3b')]=_[_0x21ae('0x33')](_0x459011[_0x21ae('0x35')],_0x459011[_0x21ae('0x31')]);_0x55b7e7[_0x21ae('0x34')]=_[_0x21ae('0x33')](_0x459011[_0x21ae('0x35')],qs[_0x21ae('0x36')](_0x28116f[_0x21ae('0x31')][_0x21ae('0x36')]));_0x55b7e7[_0x21ae('0x34')]=_0x55b7e7[_0x21ae('0x34')]['length']?_0x55b7e7[_0x21ae('0x34')]:_0x459011[_0x21ae('0x35')];if(_0x28116f[_0x21ae('0x31')][_0x21ae('0x47')]){_0x55b7e7[_0x21ae('0x42')]=[{'all':!![]}];}_0x55b7e7=_[_0x21ae('0x3e')]({},_0x55b7e7,_0x28116f[_0x21ae('0x41')]);return db[_0x21ae('0x2c')][_0x21ae('0x48')](_0x55b7e7)[_0x21ae('0x25')](handleEntityNotFound(_0x322303,null))[_0x21ae('0x25')](respondWithResult(_0x322303,null))[_0x21ae('0x45')](handleError(_0x322303,null));};exports[_0x21ae('0x49')]=function(_0x597828,_0x231257){return db[_0x21ae('0x2c')]['create'](_0x597828[_0x21ae('0x4a')],{})[_0x21ae('0x25')](respondWithResult(_0x231257,0xc9))[_0x21ae('0x45')](handleError(_0x231257,null));};exports['update']=function(_0x3e519e,_0x47ee69){if(_0x3e519e[_0x21ae('0x4a')]['id']){delete _0x3e519e['body']['id'];}return db['DeskField'][_0x21ae('0x48')]({'where':{'id':_0x3e519e[_0x21ae('0x46')]['id']}})[_0x21ae('0x25')](handleEntityNotFound(_0x47ee69,null))[_0x21ae('0x25')](saveUpdates(_0x3e519e[_0x21ae('0x4a')],null))[_0x21ae('0x25')](respondWithResult(_0x47ee69,null))[_0x21ae('0x45')](handleError(_0x47ee69,null));};exports[_0x21ae('0x26')]=function(_0x558423,_0x59ec58){return db[_0x21ae('0x2c')]['find']({'where':{'id':_0x558423[_0x21ae('0x46')]['id']}})[_0x21ae('0x25')](handleEntityNotFound(_0x59ec58,null))['then'](removeEntity(_0x59ec58,null))[_0x21ae('0x45')](handleError(_0x59ec58,null));}; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.model.js b/server/api/intDeskField/intDeskField.model.js index 9c5775e..6b34443 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 _0xe6fc=['util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intDeskField.attributes','exports','define','DeskField','int_desk_fields','desk_unique_index','idField','FieldId','lodash'];(function(_0x35be5a,_0x510479){var _0x5d9ae4=function(_0x2126c1){while(--_0x2126c1){_0x35be5a['push'](_0x35be5a['shift']());}};_0x5d9ae4(++_0x510479);}(_0xe6fc,0xc5));var _0xce6f=function(_0x234ce0,_0x1a6f59){_0x234ce0=_0x234ce0-0x0;var _0x387486=_0xe6fc[_0x234ce0];return _0x387486;};'use strict';var _=require(_0xce6f('0x0'));var util=require(_0xce6f('0x1'));var logger=require(_0xce6f('0x2'))(_0xce6f('0x3'));var moment=require(_0xce6f('0x4'));var BPromise=require(_0xce6f('0x5'));var rp=require(_0xce6f('0x6'));var fs=require('fs');var path=require(_0xce6f('0x7'));var rimraf=require(_0xce6f('0x8'));var config=require(_0xce6f('0x9'));var attributes=require(_0xce6f('0xa'));module[_0xce6f('0xb')]=function(_0x4cfb8c,_0x2571a7){return _0x4cfb8c[_0xce6f('0xc')](_0xce6f('0xd'),attributes,{'tableName':_0xce6f('0xe'),'paranoid':![],'indexes':[{'name':_0xce6f('0xf'),'fields':[_0xce6f('0x10'),_0xce6f('0x11')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xdaf1=['util','../../config/logger','bluebird','request-promise','rimraf','./intDeskField.attributes','exports','define','int_desk_fields','idField','FieldId','lodash'];(function(_0x3a12c5,_0x205b5c){var _0x1998e7=function(_0x1ea775){while(--_0x1ea775){_0x3a12c5['push'](_0x3a12c5['shift']());}};_0x1998e7(++_0x205b5c);}(_0xdaf1,0x1df));var _0x1daf=function(_0x59a45f,_0x3e530c){_0x59a45f=_0x59a45f-0x0;var _0x9479ea=_0xdaf1[_0x59a45f];return _0x9479ea;};'use strict';var _=require(_0x1daf('0x0'));var util=require(_0x1daf('0x1'));var logger=require(_0x1daf('0x2'))('api');var moment=require('moment');var BPromise=require(_0x1daf('0x3'));var rp=require(_0x1daf('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x1daf('0x5'));var config=require('../../config/environment');var attributes=require(_0x1daf('0x6'));module[_0x1daf('0x7')]=function(_0x217316,_0xf47071){return _0x217316[_0x1daf('0x8')]('DeskField',attributes,{'tableName':_0x1daf('0x9'),'paranoid':![],'indexes':[{'name':'desk_unique_index','fields':[_0x1daf('0xa'),_0x1daf('0xb')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.rpc.js b/server/api/intDeskField/intDeskField.rpc.js index 70e0e2e..e3485b3 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 _0x0068=['bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','DeskField,\x20%s,\x20%s','request\x20sent','debug','DeskField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','lodash','moment'];(function(_0x47b58b,_0x41a189){var _0x46bebe=function(_0x22bbfa){while(--_0x22bbfa){_0x47b58b['push'](_0x47b58b['shift']());}};_0x46bebe(++_0x41a189);}(_0x0068,0x19c));var _0x8006=function(_0x250a41,_0x328b78){_0x250a41=_0x250a41-0x0;var _0x459feb=_0x0068[_0x250a41];return _0x459feb;};'use strict';var _=require(_0x8006('0x0'));var util=require('util');var moment=require(_0x8006('0x1'));var BPromise=require(_0x8006('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8006('0x3'));var db=require(_0x8006('0x4'))['db'];var utils=require(_0x8006('0x5'));var logger=require(_0x8006('0x6'))(_0x8006('0x7'));var config=require(_0x8006('0x8'));var jayson=require(_0x8006('0x9'));var client=jayson[_0x8006('0xa')][_0x8006('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x53b5a5,_0x180baa,_0x1f1bb4){return new BPromise(function(_0x35a468,_0x5f541c){return client['request'](_0x53b5a5,_0x1f1bb4)['then'](function(_0x2c4fef){logger['info'](_0x8006('0xc'),_0x180baa,_0x8006('0xd'));logger[_0x8006('0xe')](_0x8006('0xf'),_0x180baa,_0x8006('0xd'),JSON[_0x8006('0x10')](_0x2c4fef));if(_0x2c4fef[_0x8006('0x11')]){if(_0x2c4fef[_0x8006('0x11')][_0x8006('0x12')]===0x1f4){logger[_0x8006('0x11')](_0x8006('0xc'),_0x180baa,_0x2c4fef[_0x8006('0x11')][_0x8006('0x13')]);return _0x5f541c(_0x2c4fef[_0x8006('0x11')][_0x8006('0x13')]);}logger['error']('DeskField,\x20%s,\x20%s',_0x180baa,_0x2c4fef[_0x8006('0x11')][_0x8006('0x13')]);return _0x35a468(_0x2c4fef[_0x8006('0x11')][_0x8006('0x13')]);}else{logger[_0x8006('0x14')](_0x8006('0xc'),_0x180baa,_0x8006('0xd'));_0x35a468(_0x2c4fef[_0x8006('0x15')]['message']);}})[_0x8006('0x16')](function(_0x38359e){logger['error'](_0x8006('0xc'),_0x180baa,_0x38359e);_0x5f541c(_0x38359e);});});} \ No newline at end of file +var _0x1534=['client','http','then','info','DeskField,\x20%s,\x20%s','request\x20sent','debug','DeskField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment'];(function(_0x51639a,_0x35f006){var _0x3abae4=function(_0x89b35e){while(--_0x89b35e){_0x51639a['push'](_0x51639a['shift']());}};_0x3abae4(++_0x35f006);}(_0x1534,0x188));var _0x4153=function(_0x28cb75,_0x3f187c){_0x28cb75=_0x28cb75-0x0;var _0x4c0f9e=_0x1534[_0x28cb75];return _0x4c0f9e;};'use strict';var _=require(_0x4153('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x4153('0x1'));var rs=require(_0x4153('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x4153('0x3'))['db'];var utils=require(_0x4153('0x4'));var logger=require('../../config/logger')(_0x4153('0x5'));var config=require(_0x4153('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x4153('0x7')][_0x4153('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x1f24ee,_0x37da8b,_0x142fae){return new BPromise(function(_0x7f1577,_0x44df6c){return client['request'](_0x1f24ee,_0x142fae)[_0x4153('0x9')](function(_0xffa2d0){logger[_0x4153('0xa')](_0x4153('0xb'),_0x37da8b,_0x4153('0xc'));logger[_0x4153('0xd')](_0x4153('0xe'),_0x37da8b,_0x4153('0xc'),JSON[_0x4153('0xf')](_0xffa2d0));if(_0xffa2d0[_0x4153('0x10')]){if(_0xffa2d0[_0x4153('0x10')][_0x4153('0x11')]===0x1f4){logger[_0x4153('0x10')]('DeskField,\x20%s,\x20%s',_0x37da8b,_0xffa2d0[_0x4153('0x10')][_0x4153('0x12')]);return _0x44df6c(_0xffa2d0[_0x4153('0x10')][_0x4153('0x12')]);}logger[_0x4153('0x10')](_0x4153('0xb'),_0x37da8b,_0xffa2d0['error'][_0x4153('0x12')]);return _0x7f1577(_0xffa2d0[_0x4153('0x10')]['message']);}else{logger[_0x4153('0xa')]('DeskField,\x20%s,\x20%s',_0x37da8b,_0x4153('0xc'));_0x7f1577(_0xffa2d0[_0x4153('0x13')]['message']);}})[_0x4153('0x14')](function(_0x5ce6e8){logger[_0x4153('0x10')](_0x4153('0xb'),_0x37da8b,_0x5ce6e8);_0x44df6c(_0x5ce6e8);});});} \ No newline at end of file diff --git a/server/api/intDynamics365Account/index.js b/server/api/intDynamics365Account/index.js index ebdc0d3..0d680df 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 _0xf7c0=['post','create','/:id/configurations','addConfiguration','put','update','delete','destroy','exports','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','/:id/fields'];(function(_0x98015,_0x49e6d2){var _0x2a0b96=function(_0x1cf5c3){while(--_0x1cf5c3){_0x98015['push'](_0x98015['shift']());}};_0x2a0b96(++_0x49e6d2);}(_0xf7c0,0x1ab));var _0x0f7c=function(_0x10b8eb,_0x1c30e0){_0x10b8eb=_0x10b8eb-0x0;var _0x2e604d=_0xf7c0[_0x10b8eb];return _0x2e604d;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x0f7c('0x0'));var timeout=require(_0x0f7c('0x1'));var express=require(_0x0f7c('0x2'));var router=express[_0x0f7c('0x3')]();var auth=require(_0x0f7c('0x4'));var interaction=require(_0x0f7c('0x5'));var config=require(_0x0f7c('0x6'));var controller=require('./intDynamics365Account.controller');router[_0x0f7c('0x7')]('/',auth[_0x0f7c('0x8')](),controller[_0x0f7c('0x9')]);router[_0x0f7c('0x7')](_0x0f7c('0xa'),auth[_0x0f7c('0x8')](),controller[_0x0f7c('0xb')]);router[_0x0f7c('0x7')]('/:id/configurations',auth[_0x0f7c('0x8')](),controller['getConfigurations']);router[_0x0f7c('0x7')](_0x0f7c('0xc'),auth[_0x0f7c('0x8')](),controller['getFields']);router[_0x0f7c('0xd')]('/',auth[_0x0f7c('0x8')](),controller[_0x0f7c('0xe')]);router[_0x0f7c('0xd')](_0x0f7c('0xf'),auth[_0x0f7c('0x8')](),controller[_0x0f7c('0x10')]);router[_0x0f7c('0x11')](_0x0f7c('0xa'),auth[_0x0f7c('0x8')](),controller[_0x0f7c('0x12')]);router[_0x0f7c('0x13')]('/:id',auth['isAuthenticated'](),controller[_0x0f7c('0x14')]);module[_0x0f7c('0x15')]=router; \ No newline at end of file +var _0xaf5c=['/:id/configurations','getConfigurations','/:id/fields','getFields','post','addConfiguration','update','delete','destroy','exports','util','path','../../components/interaction/service','../../config/environment','./intDynamics365Account.controller','get','isAuthenticated','index','/:id','show'];(function(_0x18b269,_0x4b9725){var _0x20807b=function(_0x259048){while(--_0x259048){_0x18b269['push'](_0x18b269['shift']());}};_0x20807b(++_0x4b9725);}(_0xaf5c,0x19a));var _0xcaf5=function(_0x111c0a,_0x33d4b9){_0x111c0a=_0x111c0a-0x0;var _0x29d61b=_0xaf5c[_0x111c0a];return _0x29d61b;};'use strict';var multer=require('multer');var util=require(_0xcaf5('0x0'));var path=require(_0xcaf5('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0xcaf5('0x2'));var config=require(_0xcaf5('0x3'));var controller=require(_0xcaf5('0x4'));router[_0xcaf5('0x5')]('/',auth[_0xcaf5('0x6')](),controller[_0xcaf5('0x7')]);router[_0xcaf5('0x5')](_0xcaf5('0x8'),auth[_0xcaf5('0x6')](),controller[_0xcaf5('0x9')]);router['get'](_0xcaf5('0xa'),auth[_0xcaf5('0x6')](),controller[_0xcaf5('0xb')]);router[_0xcaf5('0x5')](_0xcaf5('0xc'),auth[_0xcaf5('0x6')](),controller[_0xcaf5('0xd')]);router[_0xcaf5('0xe')]('/',auth[_0xcaf5('0x6')](),controller['create']);router['post'](_0xcaf5('0xa'),auth['isAuthenticated'](),controller[_0xcaf5('0xf')]);router['put'](_0xcaf5('0x8'),auth[_0xcaf5('0x6')](),controller[_0xcaf5('0x10')]);router[_0xcaf5('0x11')](_0xcaf5('0x8'),auth[_0xcaf5('0x6')](),controller[_0xcaf5('0x12')]);module[_0xcaf5('0x13')]=router; \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.attributes.js b/server/api/intDynamics365Account/intDynamics365Account.attributes.js index 93ba7ed..e1d9392 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 _0x774f=['sequelize','exports','STRING'];(function(_0x2ad4dc,_0x5709e8){var _0x2f0a18=function(_0x335d11){while(--_0x335d11){_0x2ad4dc['push'](_0x2ad4dc['shift']());}};_0x2f0a18(++_0x5709e8);}(_0x774f,0x81));var _0xf774=function(_0x3fd9a9,_0x4629d5){_0x3fd9a9=_0x3fd9a9-0x0;var _0x1fb8de=_0x774f[_0x3fd9a9];return _0x1fb8de;};'use strict';var Sequelize=require(_0xf774('0x0'));module[_0xf774('0x1')]={'name':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0xf774('0x2')]},'password':{'type':Sequelize[_0xf774('0x2')]},'remoteUri':{'type':Sequelize['STRING']},'tenantId':{'type':Sequelize[_0xf774('0x2')]},'clientId':{'type':Sequelize['STRING']},'clientSecret':{'type':Sequelize[_0xf774('0x2')]},'serverUrl':{'type':Sequelize[_0xf774('0x2')]},'description':{'type':Sequelize[_0xf774('0x2')]}}; \ No newline at end of file +var _0x0001=['STRING','sequelize','exports'];(function(_0x31ea7b,_0x52965c){var _0x32d30a=function(_0x418936){while(--_0x418936){_0x31ea7b['push'](_0x31ea7b['shift']());}};_0x32d30a(++_0x52965c);}(_0x0001,0x193));var _0x1000=function(_0x326cdc,_0x49807d){_0x326cdc=_0x326cdc-0x0;var _0x43d037=_0x0001[_0x326cdc];return _0x43d037;};'use strict';var Sequelize=require(_0x1000('0x0'));module[_0x1000('0x1')]={'name':{'type':Sequelize[_0x1000('0x2')]},'username':{'type':Sequelize[_0x1000('0x2')]},'password':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0x1000('0x2')]},'tenantId':{'type':Sequelize[_0x1000('0x2')]},'clientId':{'type':Sequelize['STRING']},'clientSecret':{'type':Sequelize[_0x1000('0x2')]},'serverUrl':{'type':Sequelize[_0x1000('0x2')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.controller.js b/server/api/intDynamics365Account/intDynamics365Account.controller.js index e66f082..9e9e4bb 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 _0x7723=['http','test','Sequelize','ValidationError','then','info','request\x20sent','debug','Dynamics365Account,\x20%s,\x20%s,\x20%s','stringify','error','code','Dynamics365Account,\x20%s,\x20%s','message','result','catch','sendStatus','status','json','count','offset','limit','set','Content-Range','apply','reject','save','update','destroy','end','stack','name','send','map','rawAttributes','key','query','keys','filters','intersection','attributes','model','fields','hasOwnProperty','nolimit','sort','where','pick','filter','merge','options','includeAll','Dynamics365Account','rows','length','include','find','create','body','params','getConfigurations','findOne','order','addConfiguration','AccountId','getSubjects','Descriptions','getDescriptions','channel','type','Dynamics365Configuration','Dynamics365Field','Subjects','getFields','ticketType','Incident','PhoneCall','title','customerid','phonenumber','regardingobjectid','directioncode','phonecall_activity_parties','accountidname','actualserviceunits','billedserviceunits','contactidname','contactidyominame','contractdetailidname','contractidname','createdbyexternalpartyname','createdbyname','createdbyyominame','createdon','createdonbehalfbyname','createdonbehalfbyyominame','customeridname','customeridtype','emailaddress','entitlementidname','entityimage_timestamp','entityimage_url','exchangerate','firstresponsebykpiidname','followupby','importsequencenumber','lastonholdtime','masteridname','modifiedbyexternalpartyname','modifiedbyexternalpartyyominame','modifiedon','modifiedonbehalfbyname','modifiedonbehalfbyyominame','msdyn_incidenttypename','numberofchildincidents','overriddencreatedon','owneridyominame','parentcaseidname','primarycontactidname','primarycontactidyominame','productidname','productserialnumber','resolvebykpiidname','responseby','responsiblecontactidyominame','slainvokedidname','slaname','socialprofileidname','statuscode','subjectidname','ticketnumber','timezoneruleversionnumber','transactioncurrencyidname','versionnumber','concat','username','password','remoteUri','tenantId','clientId','slice','substring','lastIndexOf','format','%s/api/data/v9.0/','POST','https://login.microsoftonline.com/','/oauth2/token','clientSecret','GET','EntityDefinitions?$select=DisplayName,EntitySetName&$filter=SchemaName\x20eq\x20\x27','4.0','value','MetadataId','EntityDefinitions(',')?$select=LogicalName&$expand=Attributes($select=LogicalName)','Bearer\x20','remove','includes','LogicalName','forEach','@odata.type','PicklistAttributeMetadata','isNil','BooleanAttributeMetadata','push','StringAttributeMetadata','IntegerAttributeMetadata','MemoAttributeMetadata','DateTimeAttributeMetadata','EntityNameAttributeMetadata','DecimalAttributeMetadata','all','statusCode','Wrong\x20credentials',')/Attributes(',')/Microsoft.Dynamics.CRM.PicklistAttributeMetadata?','$select=DisplayName,LogicalName&$expand=OptionSet($select=Options)','OptionSet','Label','UserLocalizedLabel','Value',')/Microsoft.Dynamics.CRM.BooleanAttributeMetadata?$select=DisplayName,LogicalName&$expand=OptionSet($select=FalseOption,\x20TrueOption)','true','FalseOption','false','DisplayName',')/Microsoft.Dynamics.CRM.','?$select=DisplayName,LogicalName','zip-dir','request-promise','moment','mustache','util','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','../../components/integrations/configuration','jayson/promise','client'];(function(_0x1b8b8b,_0x4e5883){var _0x33ea1a=function(_0x3f7622){while(--_0x3f7622){_0x1b8b8b['push'](_0x1b8b8b['shift']());}};_0x33ea1a(++_0x4e5883);}(_0x7723,0x191));var _0x3772=function(_0x5cbf77,_0x6baf56){_0x5cbf77=_0x5cbf77-0x0;var _0x5daf67=_0x7723[_0x5cbf77];return _0x5daf67;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x3772('0x0'));var jsonpatch=require('fast-json-patch');var rp=require(_0x3772('0x1'));var moment=require(_0x3772('0x2'));var BPromise=require('bluebird');var Mustache=require(_0x3772('0x3'));var util=require(_0x3772('0x4'));var path=require('path');var sox=require('sox');var csv=require(_0x3772('0x5'));var ejs=require(_0x3772('0x6'));var fs=require('fs');var _=require('lodash');var squel=require(_0x3772('0x7'));var crypto=require(_0x3772('0x8'));var jsforce=require(_0x3772('0x9'));var deskjs=require(_0x3772('0xa'));var toCsv=require(_0x3772('0x5'));var querystring=require(_0x3772('0xb'));var Papa=require('papaparse');var Redis=require(_0x3772('0xc'));var authService=require('../../components/auth/service');var qs=require(_0x3772('0xd'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x3772('0xe'));var logger=require(_0x3772('0xf'))(_0x3772('0x10'));var utils=require(_0x3772('0x11'));var config=require(_0x3772('0x12'));var db=require(_0x3772('0x13'))['db'];var integrations=require(_0x3772('0x14'));var jayson=require(_0x3772('0x15'));var client=jayson[_0x3772('0x16')][_0x3772('0x17')]({'port':0x232a});function checkPasswordPattern(_0x3633ea,_0x121990,_0x4984bb){if(_0x4984bb){var _0x4bcd04=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x4bcd04[_0x3772('0x18')](_0x121990)){return _0x3633ea;}else{throw new db[(_0x3772('0x19'))][(_0x3772('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 _0x3633ea;}}function respondWithRpcPromise(_0x14960d,_0x4f422e,_0x1b53d0,_0x5a60e5){return new BPromise(function(_0x165520,_0x1a0fde){var _0x33484a=_0x5a60e5||client;return _0x33484a['request'](_0x14960d,_0x1b53d0)[_0x3772('0x1b')](function(_0x473ecd){logger[_0x3772('0x1c')]('Dynamics365Account,\x20%s,\x20%s',_0x4f422e,_0x3772('0x1d'));logger[_0x3772('0x1e')](_0x3772('0x1f'),_0x4f422e,_0x3772('0x1d'),JSON[_0x3772('0x20')](_0x473ecd));if(_0x473ecd['error']){if(_0x473ecd[_0x3772('0x21')][_0x3772('0x22')]===0x1f4){logger[_0x3772('0x21')](_0x3772('0x23'),_0x4f422e,_0x473ecd[_0x3772('0x21')]['message']);return _0x1a0fde(_0x473ecd['error'][_0x3772('0x24')]);}logger['error'](_0x3772('0x23'),_0x4f422e,_0x473ecd[_0x3772('0x21')]['message']);return _0x165520(_0x473ecd['error'][_0x3772('0x24')]);}else{logger[_0x3772('0x1c')](_0x3772('0x23'),_0x4f422e,_0x3772('0x1d'));_0x165520(_0x473ecd[_0x3772('0x25')][_0x3772('0x24')]);}})[_0x3772('0x26')](function(_0x30915b){logger[_0x3772('0x21')]('Dynamics365Account,\x20%s,\x20%s',_0x4f422e,_0x30915b);_0x1a0fde(_0x30915b);});});}function respondWithStatusCode(_0x40610f,_0x1a5306){_0x1a5306=_0x1a5306||0xcc;return function(_0x47ff66){if(_0x47ff66){return _0x40610f[_0x3772('0x27')](_0x1a5306);}return _0x40610f[_0x3772('0x28')](_0x1a5306)['end']();};}function respondWithResult(_0x32860e,_0x5a9a69){_0x5a9a69=_0x5a9a69||0xc8;return function(_0x352987){if(_0x352987){return _0x32860e[_0x3772('0x28')](_0x5a9a69)[_0x3772('0x29')](_0x352987);}};}function respondWithFilteredResult(_0x2a80d0,_0x53d747){return function(_0x15230e){if(_0x15230e){var _0x56215c=_0x15230e[_0x3772('0x2a')],_0x391af5=_0x53d747[_0x3772('0x2b')],_0x4ddc24=_0x53d747['offset']+_0x53d747[_0x3772('0x2c')],_0x34c564;if(_0x4ddc24>=_0x56215c){_0x4ddc24=_0x56215c;_0x34c564=0xc8;}else{_0x34c564=0xce;}_0x2a80d0[_0x3772('0x28')](_0x34c564);return _0x2a80d0[_0x3772('0x2d')](_0x3772('0x2e'),_0x391af5+'-'+_0x4ddc24+'/'+_0x56215c)[_0x3772('0x29')](_0x15230e);}return null;};}function patchUpdates(_0x1dbaab){return function(_0x3a8acd){try{jsonpatch[_0x3772('0x2f')](_0x3a8acd,_0x1dbaab,!![]);}catch(_0x123a47){return BPromise[_0x3772('0x30')](_0x123a47);}return _0x3a8acd[_0x3772('0x31')]();};}function saveUpdates(_0x46f94c,_0x550a51){return function(_0x5893ef){if(_0x5893ef){return _0x5893ef[_0x3772('0x32')](_0x46f94c)[_0x3772('0x1b')](function(_0x31fef8){return _0x31fef8;});}return null;};}function removeEntity(_0x9ec19d,_0xcdcb65){return function(_0x52bd2d){if(_0x52bd2d){return _0x52bd2d[_0x3772('0x33')]()[_0x3772('0x1b')](function(){_0x9ec19d[_0x3772('0x28')](0xcc)[_0x3772('0x34')]();});}};}function handleEntityNotFound(_0x2ddee0,_0xc3d09d){return function(_0x463a00){if(!_0x463a00){_0x2ddee0[_0x3772('0x27')](0x194);}return _0x463a00;};}function handleError(_0x52726c,_0x1b2562){_0x1b2562=_0x1b2562||0x1f4;return function(_0xf6cbb2){logger[_0x3772('0x21')](_0xf6cbb2[_0x3772('0x35')]);if(_0xf6cbb2[_0x3772('0x36')]){delete _0xf6cbb2['name'];}_0x52726c[_0x3772('0x28')](_0x1b2562)[_0x3772('0x37')](_0xf6cbb2);};}exports['index']=function(_0x213080,_0x5e9245){var _0x38975e={},_0x34f510={},_0x30c336={'count':0x0,'rows':[]};var _0x2dc478=_[_0x3772('0x38')](db['Dynamics365Account'][_0x3772('0x39')],function(_0x298297){return{'name':_0x298297['fieldName'],'type':_0x298297['type'][_0x3772('0x3a')]};});_0x34f510['model']=_[_0x3772('0x38')](_0x2dc478,'name');_0x34f510[_0x3772('0x3b')]=_[_0x3772('0x3c')](_0x213080['query']);_0x34f510[_0x3772('0x3d')]=_[_0x3772('0x3e')](_0x34f510['model'],_0x34f510[_0x3772('0x3b')]);_0x38975e[_0x3772('0x3f')]=_[_0x3772('0x3e')](_0x34f510[_0x3772('0x40')],qs[_0x3772('0x41')](_0x213080[_0x3772('0x3b')][_0x3772('0x41')]));_0x38975e['attributes']=_0x38975e[_0x3772('0x3f')]['length']?_0x38975e[_0x3772('0x3f')]:_0x34f510[_0x3772('0x40')];if(!_0x213080['query'][_0x3772('0x42')](_0x3772('0x43'))){_0x38975e['limit']=qs[_0x3772('0x2c')](_0x213080[_0x3772('0x3b')][_0x3772('0x2c')]);_0x38975e[_0x3772('0x2b')]=qs['offset'](_0x213080['query'][_0x3772('0x2b')]);}_0x38975e['order']=qs[_0x3772('0x44')](_0x213080[_0x3772('0x3b')]['sort']);_0x38975e[_0x3772('0x45')]=qs[_0x3772('0x3d')](_[_0x3772('0x46')](_0x213080[_0x3772('0x3b')],_0x34f510[_0x3772('0x3d')]),_0x2dc478);if(_0x213080[_0x3772('0x3b')][_0x3772('0x47')]){_0x38975e[_0x3772('0x45')]=_[_0x3772('0x48')](_0x38975e[_0x3772('0x45')],{'$or':_['map'](_0x2dc478,function(_0x5c8cbe){if(_0x5c8cbe['type']!=='VIRTUAL'){var _0x55c627={};_0x55c627[_0x5c8cbe[_0x3772('0x36')]]={'$like':'%'+_0x213080[_0x3772('0x3b')][_0x3772('0x47')]+'%'};return _0x55c627;}})});}_0x38975e=_[_0x3772('0x48')]({},_0x38975e,_0x213080[_0x3772('0x49')]);var _0x593087={'where':_0x38975e[_0x3772('0x45')]};return db['Dynamics365Account']['count'](_0x593087)[_0x3772('0x1b')](function(_0x6230ed){_0x30c336['count']=_0x6230ed;if(_0x213080[_0x3772('0x3b')][_0x3772('0x4a')]){_0x38975e['include']=[{'all':!![]}];}return db[_0x3772('0x4b')]['findAll'](_0x38975e);})[_0x3772('0x1b')](function(_0x342e4d){_0x30c336[_0x3772('0x4c')]=_0x342e4d;return _0x30c336;})[_0x3772('0x1b')](respondWithFilteredResult(_0x5e9245,_0x38975e))['catch'](handleError(_0x5e9245,null));};exports['show']=function(_0x5761ea,_0x4e0ad6){var _0x2876e1={'raw':![],'where':{'id':_0x5761ea['params']['id']}},_0x8a69ec={};_0x8a69ec[_0x3772('0x40')]=_[_0x3772('0x3c')](db[_0x3772('0x4b')]['rawAttributes']);_0x8a69ec[_0x3772('0x3b')]=_[_0x3772('0x3c')](_0x5761ea['query']);_0x8a69ec[_0x3772('0x3d')]=_[_0x3772('0x3e')](_0x8a69ec[_0x3772('0x40')],_0x8a69ec[_0x3772('0x3b')]);_0x2876e1[_0x3772('0x3f')]=_[_0x3772('0x3e')](_0x8a69ec[_0x3772('0x40')],qs[_0x3772('0x41')](_0x5761ea['query']['fields']));_0x2876e1['attributes']=_0x2876e1[_0x3772('0x3f')][_0x3772('0x4d')]?_0x2876e1[_0x3772('0x3f')]:_0x8a69ec['model'];if(_0x5761ea['query'][_0x3772('0x4a')]){_0x2876e1[_0x3772('0x4e')]=[{'all':!![]}];}_0x2876e1=_[_0x3772('0x48')]({},_0x2876e1,_0x5761ea['options']);return db[_0x3772('0x4b')][_0x3772('0x4f')](_0x2876e1)[_0x3772('0x1b')](handleEntityNotFound(_0x4e0ad6,null))[_0x3772('0x1b')](respondWithResult(_0x4e0ad6,null))[_0x3772('0x26')](handleError(_0x4e0ad6,null));};exports['create']=function(_0x4646ad,_0x595a86){return db[_0x3772('0x4b')][_0x3772('0x50')](_0x4646ad[_0x3772('0x51')],{})['then'](respondWithResult(_0x595a86,0xc9))['catch'](handleError(_0x595a86,null));};exports['update']=function(_0x451bc8,_0x23f2c2){if(_0x451bc8[_0x3772('0x51')]['id']){delete _0x451bc8[_0x3772('0x51')]['id'];}return db[_0x3772('0x4b')][_0x3772('0x4f')]({'where':{'id':_0x451bc8[_0x3772('0x52')]['id']}})[_0x3772('0x1b')](handleEntityNotFound(_0x23f2c2,null))['then'](saveUpdates(_0x451bc8['body'],null))['then'](respondWithResult(_0x23f2c2,null))[_0x3772('0x26')](handleError(_0x23f2c2,null));};exports['destroy']=function(_0x420c5a,_0x58bcf2){return db['Dynamics365Account'][_0x3772('0x4f')]({'where':{'id':_0x420c5a[_0x3772('0x52')]['id']}})[_0x3772('0x1b')](handleEntityNotFound(_0x58bcf2,null))[_0x3772('0x1b')](removeEntity(_0x58bcf2,null))[_0x3772('0x26')](handleError(_0x58bcf2,null));};exports[_0x3772('0x53')]=function(_0x51c77f,_0xf97169,_0x7822a2){var _0x2a9372={};var _0x103545={};var _0x1d8879;var _0x20709c;return db[_0x3772('0x4b')][_0x3772('0x54')]({'where':{'id':_0x51c77f['params']['id']}})[_0x3772('0x1b')](handleEntityNotFound(_0xf97169,null))[_0x3772('0x1b')](function(_0x39736f){if(_0x39736f){_0x1d8879=_0x39736f;_0x103545[_0x3772('0x40')]=_['keys'](db['Dynamics365Configuration'][_0x3772('0x39')]);_0x103545[_0x3772('0x3b')]=_[_0x3772('0x3c')](_0x51c77f['query']);_0x103545[_0x3772('0x3d')]=_[_0x3772('0x3e')](_0x103545[_0x3772('0x40')],_0x103545[_0x3772('0x3b')]);_0x2a9372[_0x3772('0x3f')]=_[_0x3772('0x3e')](_0x103545[_0x3772('0x40')],qs[_0x3772('0x41')](_0x51c77f['query'][_0x3772('0x41')]));_0x2a9372[_0x3772('0x3f')]=_0x2a9372[_0x3772('0x3f')]['length']?_0x2a9372['attributes']:_0x103545[_0x3772('0x40')];_0x2a9372[_0x3772('0x55')]=qs[_0x3772('0x44')](_0x51c77f['query'][_0x3772('0x44')]);_0x2a9372[_0x3772('0x45')]=qs['filters'](_[_0x3772('0x46')](_0x51c77f[_0x3772('0x3b')],_0x103545[_0x3772('0x3d')]));if(_0x51c77f['query'][_0x3772('0x47')]){_0x2a9372[_0x3772('0x45')]=_[_0x3772('0x48')](_0x2a9372['where'],{'$or':_['map'](_0x2a9372['attributes'],function(_0x1ba083){var _0x349521={};_0x349521[_0x1ba083]={'$like':'%'+_0x51c77f[_0x3772('0x3b')][_0x3772('0x47')]+'%'};return _0x349521;})});}_0x2a9372=_[_0x3772('0x48')]({},_0x2a9372,_0x51c77f[_0x3772('0x49')]);return _0x1d8879['getConfigurations'](_0x2a9372);}})[_0x3772('0x1b')](function(_0x951be9){if(_0x951be9){_0x20709c=_0x951be9[_0x3772('0x4d')];if(!_0x51c77f['query']['hasOwnProperty'](_0x3772('0x43'))){_0x2a9372[_0x3772('0x2c')]=qs['limit'](_0x51c77f[_0x3772('0x3b')][_0x3772('0x2c')]);_0x2a9372[_0x3772('0x2b')]=qs[_0x3772('0x2b')](_0x51c77f['query'][_0x3772('0x2b')]);}return _0x1d8879['getConfigurations'](_0x2a9372);}})['then'](function(_0x3ce0c9){if(_0x3ce0c9){return _0x3ce0c9?{'count':_0x20709c,'rows':_0x3ce0c9}:null;}})[_0x3772('0x1b')](respondWithResult(_0xf97169,null))[_0x3772('0x26')](handleError(_0xf97169,null));};exports[_0x3772('0x56')]=function(_0x57d95f,_0x52123e,_0x273f9b){if(_0x57d95f[_0x3772('0x51')]['id']){delete _0x57d95f['body']['id'];}return db['Dynamics365Account'][_0x3772('0x54')]({'where':{'id':_0x57d95f[_0x3772('0x52')]['id']}})[_0x3772('0x1b')](handleEntityNotFound(_0x52123e,null))[_0x3772('0x1b')](function(_0x4829dc){if(_0x4829dc){_0x57d95f[_0x3772('0x51')][_0x3772('0x57')]=_0x4829dc['id'];_0x57d95f[_0x3772('0x51')]['Subjects']=integrations[_0x3772('0x58')](_0x57d95f[_0x3772('0x51')]['channel'],_0x57d95f[_0x3772('0x51')]['type']);_0x57d95f['body'][_0x3772('0x59')]=integrations[_0x3772('0x5a')](_0x57d95f['body'][_0x3772('0x5b')],_0x57d95f[_0x3772('0x51')][_0x3772('0x5c')]);return db[_0x3772('0x5d')][_0x3772('0x50')](_0x57d95f[_0x3772('0x51')],{'include':[{'model':db[_0x3772('0x5e')],'as':_0x3772('0x5f')},{'model':db[_0x3772('0x5e')],'as':'Descriptions'}]});}return null;})[_0x3772('0x1b')](respondWithResult(_0x52123e,null))['catch'](handleError(_0x52123e,null));};exports[_0x3772('0x60')]=function(_0x3f4915,_0x1e3d5a,_0x2429e7){var _0x1e2e21=_0x3f4915[_0x3772('0x3b')][_0x3772('0x61')];var _0x15adaf=_0x1e2e21==='incident'?_0x3772('0x62'):_0x3772('0x63');var _0x4c4dbb='';var _0x231916='';var _0xac4726='';var _0x2bb4e5='';var _0x2959c2='';var _0x2e61c9='';var _0x10001c='';var _0x413add='';var _0x23ff59=[_0x3772('0x64'),'description',_0x3772('0x65'),'ownerid','caseorigincode','subject',_0x3772('0x66'),_0x3772('0x67'),_0x3772('0x68'),_0x3772('0x69')];var _0x3e9d96=[_0x3772('0x6a'),'accountidyominame',_0x3772('0x6b'),_0x3772('0x6c'),_0x3772('0x6d'),_0x3772('0x6e'),_0x3772('0x6f'),_0x3772('0x70'),_0x3772('0x71'),'createdbyexternalpartyyominame',_0x3772('0x72'),_0x3772('0x73'),_0x3772('0x74'),_0x3772('0x75'),_0x3772('0x76'),_0x3772('0x77'),_0x3772('0x78'),'customeridyominame',_0x3772('0x79'),_0x3772('0x7a'),_0x3772('0x7b'),_0x3772('0x7c'),'escalatedon',_0x3772('0x7d'),_0x3772('0x7e'),_0x3772('0x7f'),_0x3772('0x80'),'influencescore','kbarticleidname',_0x3772('0x81'),_0x3772('0x82'),_0x3772('0x83'),_0x3772('0x84'),'modifiedbyname','modifiedbyyominame',_0x3772('0x85'),_0x3772('0x86'),_0x3772('0x87'),_0x3772('0x88'),'msdyn_iotalertname',_0x3772('0x89'),'onholdtime',_0x3772('0x8a'),'owneridname','owneridtype',_0x3772('0x8b'),_0x3772('0x8c'),_0x3772('0x8d'),_0x3772('0x8e'),'prioritycodename',_0x3772('0x8f'),_0x3772('0x90'),'resolveby',_0x3772('0x91'),_0x3772('0x92'),'responsiblecontactidname',_0x3772('0x93'),'sentimentvalue',_0x3772('0x94'),_0x3772('0x95'),_0x3772('0x96'),'statecode',_0x3772('0x97'),_0x3772('0x98'),_0x3772('0x99'),_0x3772('0x9a'),_0x3772('0x9b'),'traversedpath','utcconversiontimezonecode',_0x3772('0x9c')];var _0xb44cf3=_0x23ff59[_0x3772('0x9d')](_0x3e9d96);return db['Dynamics365Account'][_0x3772('0x54')]({'where':{'id':_0x3f4915['params']['id']},'attributes':['id',_0x3772('0x9e'),_0x3772('0x9f'),_0x3772('0xa0'),_0x3772('0xa1'),_0x3772('0xa2'),'clientSecret']})[_0x3772('0x1b')](handleEntityNotFound(_0x1e3d5a,null))[_0x3772('0x1b')](function(_0x9f74c7){if(_0x9f74c7){_0x413add=_0x9f74c7[_0x3772('0xa0')];var _0x4a44dc=_0x413add[_0x3772('0xa3')](-0x1);if(_0x4a44dc==='/'){_0x413add=_0x413add[_0x3772('0xa4')](0x0,_0x413add[_0x3772('0xa5')](_0x4a44dc));}_0x10001c=util[_0x3772('0xa6')](_0x3772('0xa7'),_0x413add);var _0x513fcc={'method':_0x3772('0xa8'),'uri':_0x3772('0xa9')+_0x9f74c7['tenantId']+_0x3772('0xaa'),'form':{'client_id':_0x9f74c7[_0x3772('0xa2')],'resource':_0x413add,'username':_0x9f74c7['username'],'password':_0x9f74c7[_0x3772('0x9f')],'grant_type':_0x3772('0x9f'),'client_secret':_0x9f74c7[_0x3772('0xab')]},'json':!![]};return rp(_0x513fcc);}})['then'](function(_0x29acf2){_0x2e61c9=_0x29acf2['access_token'];var _0xfdbcad={'method':_0x3772('0xac'),'uri':encodeURI(_0x10001c+_0x3772('0xad')+_0x15adaf+'\x27'),'headers':{'Authorization':'Bearer\x20'+_0x2e61c9,'If-None-Match':null,'OData-Version':_0x3772('0xae')},'json':!![]};return rp(_0xfdbcad);})['then'](function(_0x31e89f){var _0x25d96d=_0x31e89f[_0x3772('0xaf')][0x0];var _0x72172a=_0x25d96d[_0x3772('0xb0')];var _0x908bd3={'method':_0x3772('0xac'),'uri':_0x10001c+_0x3772('0xb1')+_0x72172a+_0x3772('0xb2'),'headers':{'Authorization':_0x3772('0xb3')+_0x2e61c9,'If-None-Match':null,'OData-Version':_0x3772('0xae')},'json':!![]};return rp(_0x908bd3);})[_0x3772('0x1b')](function(_0x2e5285){_0x4c4dbb=_0x2e5285;_0x231916=_0x4c4dbb['Attributes'];_0x231916=_[_0x3772('0xb4')](_0x231916,function(_0x286136){return!_0xb44cf3[_0x3772('0xb5')](_0x286136[_0x3772('0xb6')]);});var _0x5f338e=[];var _0x9a3c86=[];_0x231916[_0x3772('0xb7')](function(_0x15b943){if(_0x15b943['@odata.type']){var _0x33b469=_0x15b943[_0x3772('0xb8')][_0x3772('0xa4')](_0x15b943['@odata.type'][_0x3772('0xa5')]('.')+0x1);if(_0x33b469===_0x3772('0xb9')){_0x5f338e['push'](getSelectList(_0x10001c,_0x1e2e21,_0x9a3c86,_0x4c4dbb['MetadataId'],_0x15b943[_0x3772('0xb0')],_0x2e61c9));}}});return Promise['all'](_0x5f338e);})[_0x3772('0x1b')](function(_0x602c4d){_0xac4726=_0x602c4d[0x0];var _0x5ac0d0=[];var _0x201a2c=[];_0x231916[_0x3772('0xb7')](function(_0x26ea93){if(!_[_0x3772('0xba')](_0x26ea93[_0x3772('0xb8')])){var _0x2f8da2=_0x26ea93['@odata.type'][_0x3772('0xa4')](_0x26ea93['@odata.type'][_0x3772('0xa5')]('.')+0x1);if(_0x2f8da2===_0x3772('0xbb')){_0x5ac0d0[_0x3772('0xbc')](getBooleanList(_0x10001c,_0x1e2e21,_0x201a2c,_0x4c4dbb[_0x3772('0xb0')],_0x26ea93['MetadataId'],_0x2e61c9));}}});return Promise['all'](_0x5ac0d0);})[_0x3772('0x1b')](function(_0x288a4d){_0x2bb4e5=_0x288a4d[0x0];var _0x576e9d=[];var _0x1d27d6=[];_0x231916['forEach'](function(_0x556837){if(_0x556837[_0x3772('0xb8')]){var _0xfa3305=_0x556837[_0x3772('0xb8')][_0x3772('0xa4')](_0x556837[_0x3772('0xb8')][_0x3772('0xa5')]('.')+0x1);if(_0xfa3305===_0x3772('0xbd')||_0xfa3305==='DoubleAttributeMetadata'||_0xfa3305==='BigIntAttributeMetadata'||_0xfa3305===_0x3772('0xbe')||_0xfa3305===_0x3772('0xbf')||_0xfa3305===_0x3772('0xc0')||_0xfa3305==='StatusAttributeMetadata'||_0xfa3305===_0x3772('0xc1')||_0xfa3305==='StateAttributeMetadata'||_0xfa3305===_0x3772('0xc2')){_0x576e9d[_0x3772('0xbc')](getInputList(_0x10001c,_0x1e2e21,_0xfa3305,_0x1d27d6,_0x4c4dbb[_0x3772('0xb0')],_0x556837[_0x3772('0xb0')],_0x2e61c9));}}});return Promise[_0x3772('0xc3')](_0x576e9d);})[_0x3772('0x1b')](function(_0x3953d4){_0x2959c2=_0x3953d4[0x0];var _0x30f8ad=_0xac4726[_0x3772('0x9d')](_0x2bb4e5)[_0x3772('0x9d')](_0x2959c2);var _0x5ca95a={'count':_0x30f8ad[_0x3772('0x4d')],'rows':_0x30f8ad};return _0x5ca95a;})[_0x3772('0x1b')](respondWithResult(_0x1e3d5a,null))[_0x3772('0x26')](function(_0x28155b){var _0x141578=_0x3f4915[_0x3772('0x3b')][_0x3772('0x18')]?0x1f4:_0x28155b[_0x3772('0xc4')]||0x1f4;logger[_0x3772('0x21')](_0x28155b['stack']);delete _0x28155b[_0x3772('0x36')];if(_0x141578===0x191){_0x141578=0x190;}_0x1e3d5a[_0x3772('0x28')](_0x141578)[_0x3772('0x37')](_0x3f4915[_0x3772('0x3b')][_0x3772('0x18')]?{'message':_0x3772('0xc5'),'statusCode':_0x28155b[_0x3772('0xc4')]}:_0x28155b);});};function getSelectList(_0x1de8c5,_0x47c979,_0x38ea7d,_0x30fcd6,_0x52f438,_0x3503e5){var _0x5330c6={'method':_0x3772('0xac'),'uri':_0x1de8c5+_0x3772('0xb1')+_0x30fcd6+_0x3772('0xc6')+_0x52f438+_0x3772('0xc7')+_0x3772('0xc8'),'headers':{'Authorization':_0x3772('0xb3')+_0x3503e5,'If-None-Match':null,'OData-Version':_0x3772('0xae')},'json':!![]};return rp(_0x5330c6)[_0x3772('0x1b')](function(_0x3fa316){var _0x2cac18=[];var _0x28f0fc=_0x3fa316[_0x3772('0xc9')]['Options'];_0x28f0fc[_0x3772('0xb7')](function(_0x4de829){_0x2cac18[_0x3772('0xbc')]({'name':_0x4de829[_0x3772('0xca')][_0x3772('0xcb')]['Label'],'value':String(_0x4de829[_0x3772('0xcc')])});});var _0x70c8c4={'id':_0x47c979+'_'+_0x3fa316[_0x3772('0xb6')],'name':_0x3fa316['DisplayName']['UserLocalizedLabel'][_0x3772('0xca')],'custom':![],'options':_0x2cac18};_0x38ea7d[_0x3772('0xbc')](_0x70c8c4);return _0x38ea7d;});}function getBooleanList(_0x4f3f29,_0x495e08,_0x2614b1,_0x5369d9,_0x53ca41,_0x2879c6){var _0x15a789={'method':_0x3772('0xac'),'uri':_0x4f3f29+_0x3772('0xb1')+_0x5369d9+_0x3772('0xc6')+_0x53ca41+_0x3772('0xcd'),'headers':{'Authorization':_0x3772('0xb3')+_0x2879c6,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x15a789)[_0x3772('0x1b')](function(_0x5ce061){var _0x4478ab=[];_0x4478ab[_0x3772('0xbc')]({'name':_0x5ce061['OptionSet']['TrueOption'][_0x3772('0xca')][_0x3772('0xcb')]['Label'],'value':_0x3772('0xce')},{'name':_0x5ce061[_0x3772('0xc9')][_0x3772('0xcf')]['Label'][_0x3772('0xcb')][_0x3772('0xca')],'value':_0x3772('0xd0')});var _0xc976ba={'id':_0x495e08+'_'+_0x5ce061[_0x3772('0xb6')],'name':_0x5ce061[_0x3772('0xd1')][_0x3772('0xcb')][_0x3772('0xca')],'custom':![],'options':_0x4478ab};_0x2614b1[_0x3772('0xbc')](_0xc976ba);return _0x2614b1;});}function getInputList(_0x18d889,_0x2143f7,_0x5ab7d7,_0x2234b8,_0x2ef1ac,_0x44d81c,_0x315574){var _0x326841={'method':_0x3772('0xac'),'uri':_0x18d889+_0x3772('0xb1')+_0x2ef1ac+_0x3772('0xc6')+_0x44d81c+_0x3772('0xd2')+_0x5ab7d7+_0x3772('0xd3'),'headers':{'Authorization':'Bearer\x20'+_0x315574,'If-None-Match':null,'OData-Version':_0x3772('0xae')},'json':!![]};return rp(_0x326841)[_0x3772('0x1b')](function(_0x2dec4c){var _0x367b21={'id':_0x2143f7+'_'+_0x2dec4c[_0x3772('0xb6')],'name':_0x2dec4c[_0x3772('0xd1')][_0x3772('0xcb')]?_0x2dec4c[_0x3772('0xd1')][_0x3772('0xcb')][_0x3772('0xca')]:_0x2dec4c[_0x3772('0xb6')],'custom':![],'options':[]};_0x2234b8[_0x3772('0xbc')](_0x367b21);return _0x2234b8;});} \ No newline at end of file +var _0x6462=['contractdetailidname','contractidname','createdbyexternalpartyname','createdbyexternalpartyyominame','createdbyname','createdbyyominame','createdonbehalfbyyominame','customeridtype','emailaddress','entitlementidname','entityimage_timestamp','escalatedon','exchangerate','firstresponsebykpiidname','influencescore','kbarticleidname','lastonholdtime','masteridname','modifiedbyexternalpartyname','modifiedbyyominame','modifiedon','modifiedonbehalfbyname','modifiedonbehalfbyyominame','msdyn_incidenttypename','numberofchildincidents','onholdtime','overriddencreatedon','owneridname','owneridyominame','parentcaseidname','primarycontactidname','primarycontactidyominame','prioritycodename','productidname','productserialnumber','resolveby','resolvebykpiidname','responsiblecontactidyominame','sentimentvalue','slaname','statecode','subjectidname','timezoneruleversionnumber','transactioncurrencyidname','traversedpath','utcconversiontimezonecode','versionnumber','concat','username','password','remoteUri','clientSecret','slice','substring','lastIndexOf','%s/api/data/v9.0/','POST','https://login.microsoftonline.com/','/oauth2/token','access_token','4.0','value','MetadataId','GET','EntityDefinitions(',')?$select=LogicalName&$expand=Attributes($select=LogicalName)','Attributes','remove','includes','LogicalName','forEach','@odata.type','PicklistAttributeMetadata','push','all','isNil','BooleanAttributeMetadata','StringAttributeMetadata','BigIntAttributeMetadata','IntegerAttributeMetadata','MemoAttributeMetadata','DateTimeAttributeMetadata','StatusAttributeMetadata','EntityNameAttributeMetadata','StateAttributeMetadata','DecimalAttributeMetadata','statusCode',')/Attributes(',')/Microsoft.Dynamics.CRM.PicklistAttributeMetadata?','Bearer\x20','OptionSet','Options','Label','Value','UserLocalizedLabel',')/Microsoft.Dynamics.CRM.BooleanAttributeMetadata?$select=DisplayName,LogicalName&$expand=OptionSet($select=FalseOption,\x20TrueOption)','TrueOption','FalseOption','false','DisplayName','?$select=DisplayName,LogicalName','html-pdf','eml-format','rimraf','request-promise','moment','bluebird','mustache','util','path','sox','ejs','squel','crypto','jsforce','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../mysqldb','../../components/integrations/configuration','client','http','test','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','Dynamics365Account,\x20%s,\x20%s','request\x20sent','debug','stringify','code','error','message','info','result','catch','sendStatus','status','end','json','count','offset','limit','Content-Range','apply','reject','save','update','stack','name','send','index','map','rawAttributes','type','key','model','query','keys','filters','attributes','intersection','fields','nolimit','where','pick','filter','merge','VIRTUAL','options','Dynamics365Account','includeAll','include','findAll','rows','params','length','find','create','body','destroy','findOne','Dynamics365Configuration','order','hasOwnProperty','getConfigurations','addConfiguration','Subjects','getSubjects','Descriptions','getDescriptions','channel','getFields','ticketType','incident','Incident','PhoneCall','title','description','customerid','ownerid','caseorigincode','subject','phonenumber','regardingobjectid','directioncode','phonecall_activity_parties','accountidname','contactidyominame'];(function(_0x4c55c2,_0x5dde7e){var _0x469bab=function(_0x28a72f){while(--_0x28a72f){_0x4c55c2['push'](_0x4c55c2['shift']());}};_0x469bab(++_0x5dde7e);}(_0x6462,0x65));var _0x2646=function(_0x4626ad,_0x43f817){_0x4626ad=_0x4626ad-0x0;var _0x2b8b0d=_0x6462[_0x4626ad];return _0x2b8b0d;};'use strict';var pdf=require(_0x2646('0x0'));var emlformat=require(_0x2646('0x1'));var rimraf=require(_0x2646('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x2646('0x3'));var moment=require(_0x2646('0x4'));var BPromise=require(_0x2646('0x5'));var Mustache=require(_0x2646('0x6'));var util=require(_0x2646('0x7'));var path=require(_0x2646('0x8'));var sox=require(_0x2646('0x9'));var csv=require('to-csv');var ejs=require(_0x2646('0xa'));var fs=require('fs');var _=require('lodash');var squel=require(_0x2646('0xb'));var crypto=require(_0x2646('0xc'));var jsforce=require(_0x2646('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x2646('0xe'));var querystring=require(_0x2646('0xf'));var Papa=require(_0x2646('0x10'));var Redis=require(_0x2646('0x11'));var authService=require(_0x2646('0x12'));var qs=require(_0x2646('0x13'));var as=require(_0x2646('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x2646('0x15'));var utils=require(_0x2646('0x16'));var config=require('../../config/environment');var db=require(_0x2646('0x17'))['db'];var integrations=require(_0x2646('0x18'));var jayson=require('jayson/promise');var client=jayson[_0x2646('0x19')][_0x2646('0x1a')]({'port':0x232a});function checkPasswordPattern(_0x44b42d,_0x3ff7ad,_0x1efb7d){if(_0x1efb7d){var _0x341ac7=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x341ac7[_0x2646('0x1b')](_0x3ff7ad)){return _0x44b42d;}else{throw new db['Sequelize'][(_0x2646('0x1c'))](_0x2646('0x1d'));}}else{return _0x44b42d;}}function respondWithRpcPromise(_0x6ed4d3,_0x12dc5f,_0x23d8e0,_0x5541d1){return new BPromise(function(_0x363d6a,_0x38a75c){var _0x439f72=_0x5541d1||client;return _0x439f72[_0x2646('0x1e')](_0x6ed4d3,_0x23d8e0)[_0x2646('0x1f')](function(_0x524002){logger['info'](_0x2646('0x20'),_0x12dc5f,_0x2646('0x21'));logger[_0x2646('0x22')]('Dynamics365Account,\x20%s,\x20%s,\x20%s',_0x12dc5f,_0x2646('0x21'),JSON[_0x2646('0x23')](_0x524002));if(_0x524002['error']){if(_0x524002['error'][_0x2646('0x24')]===0x1f4){logger[_0x2646('0x25')](_0x2646('0x20'),_0x12dc5f,_0x524002[_0x2646('0x25')]['message']);return _0x38a75c(_0x524002[_0x2646('0x25')][_0x2646('0x26')]);}logger[_0x2646('0x25')](_0x2646('0x20'),_0x12dc5f,_0x524002['error'][_0x2646('0x26')]);return _0x363d6a(_0x524002[_0x2646('0x25')][_0x2646('0x26')]);}else{logger[_0x2646('0x27')]('Dynamics365Account,\x20%s,\x20%s',_0x12dc5f,_0x2646('0x21'));_0x363d6a(_0x524002[_0x2646('0x28')][_0x2646('0x26')]);}})[_0x2646('0x29')](function(_0x10bf1b){logger[_0x2646('0x25')](_0x2646('0x20'),_0x12dc5f,_0x10bf1b);_0x38a75c(_0x10bf1b);});});}function respondWithStatusCode(_0xe30a03,_0x1d5368){_0x1d5368=_0x1d5368||0xcc;return function(_0x11bd37){if(_0x11bd37){return _0xe30a03[_0x2646('0x2a')](_0x1d5368);}return _0xe30a03[_0x2646('0x2b')](_0x1d5368)[_0x2646('0x2c')]();};}function respondWithResult(_0x1a87de,_0x356841){_0x356841=_0x356841||0xc8;return function(_0x1e038f){if(_0x1e038f){return _0x1a87de['status'](_0x356841)[_0x2646('0x2d')](_0x1e038f);}};}function respondWithFilteredResult(_0x44fb34,_0x100ca6){return function(_0x37012c){if(_0x37012c){var _0x42f730=_0x37012c[_0x2646('0x2e')],_0xf66307=_0x100ca6[_0x2646('0x2f')],_0x130cda=_0x100ca6[_0x2646('0x2f')]+_0x100ca6[_0x2646('0x30')],_0x22feab;if(_0x130cda>=_0x42f730){_0x130cda=_0x42f730;_0x22feab=0xc8;}else{_0x22feab=0xce;}_0x44fb34[_0x2646('0x2b')](_0x22feab);return _0x44fb34['set'](_0x2646('0x31'),_0xf66307+'-'+_0x130cda+'/'+_0x42f730)[_0x2646('0x2d')](_0x37012c);}return null;};}function patchUpdates(_0x115645){return function(_0x2e0e3f){try{jsonpatch[_0x2646('0x32')](_0x2e0e3f,_0x115645,!![]);}catch(_0x53a949){return BPromise[_0x2646('0x33')](_0x53a949);}return _0x2e0e3f[_0x2646('0x34')]();};}function saveUpdates(_0x400f60,_0x7b239f){return function(_0xd0f920){if(_0xd0f920){return _0xd0f920[_0x2646('0x35')](_0x400f60)[_0x2646('0x1f')](function(_0x53d214){return _0x53d214;});}return null;};}function removeEntity(_0x4f3f7c,_0x2a2b27){return function(_0x2241a8){if(_0x2241a8){return _0x2241a8['destroy']()[_0x2646('0x1f')](function(){_0x4f3f7c[_0x2646('0x2b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x52247c,_0x33fc9a){return function(_0x117b2a){if(!_0x117b2a){_0x52247c[_0x2646('0x2a')](0x194);}return _0x117b2a;};}function handleError(_0x43baa6,_0x20f914){_0x20f914=_0x20f914||0x1f4;return function(_0x3f51eb){logger['error'](_0x3f51eb[_0x2646('0x36')]);if(_0x3f51eb[_0x2646('0x37')]){delete _0x3f51eb['name'];}_0x43baa6['status'](_0x20f914)[_0x2646('0x38')](_0x3f51eb);};}exports[_0x2646('0x39')]=function(_0x5d40a9,_0x484079){var _0x341e0a={},_0x41012e={},_0x1560fc={'count':0x0,'rows':[]};var _0x5e42f2=_[_0x2646('0x3a')](db['Dynamics365Account'][_0x2646('0x3b')],function(_0x58642a){return{'name':_0x58642a['fieldName'],'type':_0x58642a[_0x2646('0x3c')][_0x2646('0x3d')]};});_0x41012e[_0x2646('0x3e')]=_['map'](_0x5e42f2,'name');_0x41012e[_0x2646('0x3f')]=_[_0x2646('0x40')](_0x5d40a9[_0x2646('0x3f')]);_0x41012e[_0x2646('0x41')]=_['intersection'](_0x41012e[_0x2646('0x3e')],_0x41012e[_0x2646('0x3f')]);_0x341e0a[_0x2646('0x42')]=_[_0x2646('0x43')](_0x41012e[_0x2646('0x3e')],qs['fields'](_0x5d40a9[_0x2646('0x3f')][_0x2646('0x44')]));_0x341e0a[_0x2646('0x42')]=_0x341e0a[_0x2646('0x42')]['length']?_0x341e0a[_0x2646('0x42')]:_0x41012e[_0x2646('0x3e')];if(!_0x5d40a9[_0x2646('0x3f')]['hasOwnProperty'](_0x2646('0x45'))){_0x341e0a[_0x2646('0x30')]=qs[_0x2646('0x30')](_0x5d40a9[_0x2646('0x3f')][_0x2646('0x30')]);_0x341e0a[_0x2646('0x2f')]=qs[_0x2646('0x2f')](_0x5d40a9[_0x2646('0x3f')]['offset']);}_0x341e0a['order']=qs['sort'](_0x5d40a9[_0x2646('0x3f')]['sort']);_0x341e0a[_0x2646('0x46')]=qs[_0x2646('0x41')](_[_0x2646('0x47')](_0x5d40a9['query'],_0x41012e[_0x2646('0x41')]),_0x5e42f2);if(_0x5d40a9[_0x2646('0x3f')][_0x2646('0x48')]){_0x341e0a[_0x2646('0x46')]=_[_0x2646('0x49')](_0x341e0a[_0x2646('0x46')],{'$or':_[_0x2646('0x3a')](_0x5e42f2,function(_0x36846a){if(_0x36846a[_0x2646('0x3c')]!==_0x2646('0x4a')){var _0x4e628d={};_0x4e628d[_0x36846a[_0x2646('0x37')]]={'$like':'%'+_0x5d40a9[_0x2646('0x3f')][_0x2646('0x48')]+'%'};return _0x4e628d;}})});}_0x341e0a=_[_0x2646('0x49')]({},_0x341e0a,_0x5d40a9[_0x2646('0x4b')]);var _0x452ab1={'where':_0x341e0a[_0x2646('0x46')]};return db[_0x2646('0x4c')]['count'](_0x452ab1)[_0x2646('0x1f')](function(_0x310d18){_0x1560fc[_0x2646('0x2e')]=_0x310d18;if(_0x5d40a9[_0x2646('0x3f')][_0x2646('0x4d')]){_0x341e0a[_0x2646('0x4e')]=[{'all':!![]}];}return db[_0x2646('0x4c')][_0x2646('0x4f')](_0x341e0a);})[_0x2646('0x1f')](function(_0x208cbe){_0x1560fc[_0x2646('0x50')]=_0x208cbe;return _0x1560fc;})[_0x2646('0x1f')](respondWithFilteredResult(_0x484079,_0x341e0a))['catch'](handleError(_0x484079,null));};exports['show']=function(_0x40547f,_0x116cf9){var _0x1333ea={'raw':![],'where':{'id':_0x40547f[_0x2646('0x51')]['id']}},_0x2801d1={};_0x2801d1[_0x2646('0x3e')]=_[_0x2646('0x40')](db[_0x2646('0x4c')]['rawAttributes']);_0x2801d1[_0x2646('0x3f')]=_[_0x2646('0x40')](_0x40547f[_0x2646('0x3f')]);_0x2801d1['filters']=_['intersection'](_0x2801d1['model'],_0x2801d1[_0x2646('0x3f')]);_0x1333ea['attributes']=_[_0x2646('0x43')](_0x2801d1[_0x2646('0x3e')],qs[_0x2646('0x44')](_0x40547f[_0x2646('0x3f')]['fields']));_0x1333ea[_0x2646('0x42')]=_0x1333ea[_0x2646('0x42')][_0x2646('0x52')]?_0x1333ea['attributes']:_0x2801d1[_0x2646('0x3e')];if(_0x40547f[_0x2646('0x3f')][_0x2646('0x4d')]){_0x1333ea[_0x2646('0x4e')]=[{'all':!![]}];}_0x1333ea=_[_0x2646('0x49')]({},_0x1333ea,_0x40547f[_0x2646('0x4b')]);return db['Dynamics365Account'][_0x2646('0x53')](_0x1333ea)[_0x2646('0x1f')](handleEntityNotFound(_0x116cf9,null))[_0x2646('0x1f')](respondWithResult(_0x116cf9,null))['catch'](handleError(_0x116cf9,null));};exports[_0x2646('0x54')]=function(_0x25bfaa,_0x2ba72a){return db[_0x2646('0x4c')][_0x2646('0x54')](_0x25bfaa[_0x2646('0x55')],{})[_0x2646('0x1f')](respondWithResult(_0x2ba72a,0xc9))[_0x2646('0x29')](handleError(_0x2ba72a,null));};exports[_0x2646('0x35')]=function(_0x5c33d8,_0x5321ea){if(_0x5c33d8['body']['id']){delete _0x5c33d8[_0x2646('0x55')]['id'];}return db[_0x2646('0x4c')][_0x2646('0x53')]({'where':{'id':_0x5c33d8[_0x2646('0x51')]['id']}})['then'](handleEntityNotFound(_0x5321ea,null))[_0x2646('0x1f')](saveUpdates(_0x5c33d8[_0x2646('0x55')],null))[_0x2646('0x1f')](respondWithResult(_0x5321ea,null))['catch'](handleError(_0x5321ea,null));};exports[_0x2646('0x56')]=function(_0x52cb05,_0x68dd9b){return db[_0x2646('0x4c')][_0x2646('0x53')]({'where':{'id':_0x52cb05[_0x2646('0x51')]['id']}})['then'](handleEntityNotFound(_0x68dd9b,null))[_0x2646('0x1f')](removeEntity(_0x68dd9b,null))[_0x2646('0x29')](handleError(_0x68dd9b,null));};exports['getConfigurations']=function(_0x544cbb,_0xe837c,_0xb43f2b){var _0x46f28f={};var _0x2b0f6a={};var _0xe56fdd;var _0x4e0a63;return db[_0x2646('0x4c')][_0x2646('0x57')]({'where':{'id':_0x544cbb[_0x2646('0x51')]['id']}})[_0x2646('0x1f')](handleEntityNotFound(_0xe837c,null))['then'](function(_0x5b4314){if(_0x5b4314){_0xe56fdd=_0x5b4314;_0x2b0f6a[_0x2646('0x3e')]=_[_0x2646('0x40')](db[_0x2646('0x58')][_0x2646('0x3b')]);_0x2b0f6a[_0x2646('0x3f')]=_[_0x2646('0x40')](_0x544cbb[_0x2646('0x3f')]);_0x2b0f6a[_0x2646('0x41')]=_[_0x2646('0x43')](_0x2b0f6a[_0x2646('0x3e')],_0x2b0f6a[_0x2646('0x3f')]);_0x46f28f[_0x2646('0x42')]=_['intersection'](_0x2b0f6a[_0x2646('0x3e')],qs[_0x2646('0x44')](_0x544cbb[_0x2646('0x3f')]['fields']));_0x46f28f['attributes']=_0x46f28f[_0x2646('0x42')]['length']?_0x46f28f[_0x2646('0x42')]:_0x2b0f6a[_0x2646('0x3e')];_0x46f28f[_0x2646('0x59')]=qs['sort'](_0x544cbb[_0x2646('0x3f')]['sort']);_0x46f28f[_0x2646('0x46')]=qs[_0x2646('0x41')](_['pick'](_0x544cbb[_0x2646('0x3f')],_0x2b0f6a[_0x2646('0x41')]));if(_0x544cbb[_0x2646('0x3f')][_0x2646('0x48')]){_0x46f28f[_0x2646('0x46')]=_[_0x2646('0x49')](_0x46f28f['where'],{'$or':_[_0x2646('0x3a')](_0x46f28f[_0x2646('0x42')],function(_0x4a9894){var _0x732cb0={};_0x732cb0[_0x4a9894]={'$like':'%'+_0x544cbb[_0x2646('0x3f')]['filter']+'%'};return _0x732cb0;})});}_0x46f28f=_[_0x2646('0x49')]({},_0x46f28f,_0x544cbb[_0x2646('0x4b')]);return _0xe56fdd['getConfigurations'](_0x46f28f);}})['then'](function(_0x4c2854){if(_0x4c2854){_0x4e0a63=_0x4c2854[_0x2646('0x52')];if(!_0x544cbb[_0x2646('0x3f')][_0x2646('0x5a')](_0x2646('0x45'))){_0x46f28f[_0x2646('0x30')]=qs['limit'](_0x544cbb[_0x2646('0x3f')][_0x2646('0x30')]);_0x46f28f['offset']=qs[_0x2646('0x2f')](_0x544cbb[_0x2646('0x3f')]['offset']);}return _0xe56fdd[_0x2646('0x5b')](_0x46f28f);}})[_0x2646('0x1f')](function(_0x136b79){if(_0x136b79){return _0x136b79?{'count':_0x4e0a63,'rows':_0x136b79}:null;}})[_0x2646('0x1f')](respondWithResult(_0xe837c,null))[_0x2646('0x29')](handleError(_0xe837c,null));};exports[_0x2646('0x5c')]=function(_0x4ea60c,_0x5ef519,_0x35c5e3){if(_0x4ea60c['body']['id']){delete _0x4ea60c[_0x2646('0x55')]['id'];}return db[_0x2646('0x4c')][_0x2646('0x57')]({'where':{'id':_0x4ea60c[_0x2646('0x51')]['id']}})[_0x2646('0x1f')](handleEntityNotFound(_0x5ef519,null))[_0x2646('0x1f')](function(_0x1ca3cf){if(_0x1ca3cf){_0x4ea60c['body']['AccountId']=_0x1ca3cf['id'];_0x4ea60c[_0x2646('0x55')][_0x2646('0x5d')]=integrations[_0x2646('0x5e')](_0x4ea60c[_0x2646('0x55')]['channel'],_0x4ea60c[_0x2646('0x55')][_0x2646('0x3c')]);_0x4ea60c[_0x2646('0x55')][_0x2646('0x5f')]=integrations[_0x2646('0x60')](_0x4ea60c['body'][_0x2646('0x61')],_0x4ea60c[_0x2646('0x55')][_0x2646('0x3c')]);return db[_0x2646('0x58')][_0x2646('0x54')](_0x4ea60c[_0x2646('0x55')],{'include':[{'model':db['Dynamics365Field'],'as':'Subjects'},{'model':db['Dynamics365Field'],'as':_0x2646('0x5f')}]});}return null;})[_0x2646('0x1f')](respondWithResult(_0x5ef519,null))[_0x2646('0x29')](handleError(_0x5ef519,null));};exports[_0x2646('0x62')]=function(_0x4c9b1e,_0x101b60,_0x517917){var _0x2650d2=_0x4c9b1e[_0x2646('0x3f')][_0x2646('0x63')];var _0x162afc=_0x2650d2===_0x2646('0x64')?_0x2646('0x65'):_0x2646('0x66');var _0x3767f3='';var _0x10b96c='';var _0x2f1d6e='';var _0x311442='';var _0xdb7b7d='';var _0x241d79='';var _0x3219ba='';var _0x2ec6d5='';var _0xcc425f=[_0x2646('0x67'),_0x2646('0x68'),_0x2646('0x69'),_0x2646('0x6a'),_0x2646('0x6b'),_0x2646('0x6c'),_0x2646('0x6d'),_0x2646('0x6e'),_0x2646('0x6f'),_0x2646('0x70')];var _0x5234f7=[_0x2646('0x71'),'accountidyominame','actualserviceunits','billedserviceunits','contactidname',_0x2646('0x72'),_0x2646('0x73'),_0x2646('0x74'),_0x2646('0x75'),_0x2646('0x76'),_0x2646('0x77'),_0x2646('0x78'),'createdon','createdonbehalfbyname',_0x2646('0x79'),'customeridname',_0x2646('0x7a'),'customeridyominame',_0x2646('0x7b'),_0x2646('0x7c'),_0x2646('0x7d'),'entityimage_url',_0x2646('0x7e'),_0x2646('0x7f'),_0x2646('0x80'),'followupby','importsequencenumber',_0x2646('0x81'),_0x2646('0x82'),_0x2646('0x83'),_0x2646('0x84'),_0x2646('0x85'),'modifiedbyexternalpartyyominame','modifiedbyname',_0x2646('0x86'),_0x2646('0x87'),_0x2646('0x88'),_0x2646('0x89'),_0x2646('0x8a'),'msdyn_iotalertname',_0x2646('0x8b'),_0x2646('0x8c'),_0x2646('0x8d'),_0x2646('0x8e'),'owneridtype',_0x2646('0x8f'),_0x2646('0x90'),_0x2646('0x91'),_0x2646('0x92'),_0x2646('0x93'),_0x2646('0x94'),_0x2646('0x95'),_0x2646('0x96'),_0x2646('0x97'),'responseby','responsiblecontactidname',_0x2646('0x98'),_0x2646('0x99'),'slainvokedidname',_0x2646('0x9a'),'socialprofileidname',_0x2646('0x9b'),'statuscode',_0x2646('0x9c'),'ticketnumber',_0x2646('0x9d'),_0x2646('0x9e'),_0x2646('0x9f'),_0x2646('0xa0'),_0x2646('0xa1')];var _0x3f028b=_0xcc425f[_0x2646('0xa2')](_0x5234f7);return db[_0x2646('0x4c')]['findOne']({'where':{'id':_0x4c9b1e['params']['id']},'attributes':['id',_0x2646('0xa3'),_0x2646('0xa4'),_0x2646('0xa5'),'tenantId','clientId',_0x2646('0xa6')]})['then'](handleEntityNotFound(_0x101b60,null))['then'](function(_0x20ef86){if(_0x20ef86){_0x2ec6d5=_0x20ef86['remoteUri'];var _0x427925=_0x2ec6d5[_0x2646('0xa7')](-0x1);if(_0x427925==='/'){_0x2ec6d5=_0x2ec6d5[_0x2646('0xa8')](0x0,_0x2ec6d5[_0x2646('0xa9')](_0x427925));}_0x3219ba=util['format'](_0x2646('0xaa'),_0x2ec6d5);var _0x12e1e7={'method':_0x2646('0xab'),'uri':_0x2646('0xac')+_0x20ef86['tenantId']+_0x2646('0xad'),'form':{'client_id':_0x20ef86['clientId'],'resource':_0x2ec6d5,'username':_0x20ef86['username'],'password':_0x20ef86[_0x2646('0xa4')],'grant_type':_0x2646('0xa4'),'client_secret':_0x20ef86[_0x2646('0xa6')]},'json':!![]};return rp(_0x12e1e7);}})[_0x2646('0x1f')](function(_0x1f2fac){_0x241d79=_0x1f2fac[_0x2646('0xae')];var _0x49c016={'method':'GET','uri':encodeURI(_0x3219ba+'EntityDefinitions?$select=DisplayName,EntitySetName&$filter=SchemaName\x20eq\x20\x27'+_0x162afc+'\x27'),'headers':{'Authorization':'Bearer\x20'+_0x241d79,'If-None-Match':null,'OData-Version':_0x2646('0xaf')},'json':!![]};return rp(_0x49c016);})[_0x2646('0x1f')](function(_0x2e49c8){var _0x1bb86d=_0x2e49c8[_0x2646('0xb0')][0x0];var _0x5706e9=_0x1bb86d[_0x2646('0xb1')];var _0x537db6={'method':_0x2646('0xb2'),'uri':_0x3219ba+_0x2646('0xb3')+_0x5706e9+_0x2646('0xb4'),'headers':{'Authorization':'Bearer\x20'+_0x241d79,'If-None-Match':null,'OData-Version':_0x2646('0xaf')},'json':!![]};return rp(_0x537db6);})['then'](function(_0x2219c2){_0x3767f3=_0x2219c2;_0x10b96c=_0x3767f3[_0x2646('0xb5')];_0x10b96c=_[_0x2646('0xb6')](_0x10b96c,function(_0x150552){return!_0x3f028b[_0x2646('0xb7')](_0x150552[_0x2646('0xb8')]);});var _0x1b21e0=[];var _0x300df1=[];_0x10b96c[_0x2646('0xb9')](function(_0x5e3de7){if(_0x5e3de7[_0x2646('0xba')]){var _0x57d58e=_0x5e3de7[_0x2646('0xba')][_0x2646('0xa8')](_0x5e3de7[_0x2646('0xba')][_0x2646('0xa9')]('.')+0x1);if(_0x57d58e===_0x2646('0xbb')){_0x1b21e0[_0x2646('0xbc')](getSelectList(_0x3219ba,_0x2650d2,_0x300df1,_0x3767f3[_0x2646('0xb1')],_0x5e3de7[_0x2646('0xb1')],_0x241d79));}}});return Promise[_0x2646('0xbd')](_0x1b21e0);})[_0x2646('0x1f')](function(_0x130a3f){_0x2f1d6e=_0x130a3f[0x0];var _0x4beb12=[];var _0x20f4fb=[];_0x10b96c['forEach'](function(_0x12e1f7){if(!_[_0x2646('0xbe')](_0x12e1f7['@odata.type'])){var _0x36169c=_0x12e1f7[_0x2646('0xba')]['substring'](_0x12e1f7['@odata.type']['lastIndexOf']('.')+0x1);if(_0x36169c===_0x2646('0xbf')){_0x4beb12[_0x2646('0xbc')](getBooleanList(_0x3219ba,_0x2650d2,_0x20f4fb,_0x3767f3[_0x2646('0xb1')],_0x12e1f7[_0x2646('0xb1')],_0x241d79));}}});return Promise['all'](_0x4beb12);})[_0x2646('0x1f')](function(_0x54d5a2){_0x311442=_0x54d5a2[0x0];var _0x3c6726=[];var _0x582cf4=[];_0x10b96c[_0x2646('0xb9')](function(_0x5822f2){if(_0x5822f2[_0x2646('0xba')]){var _0x18df41=_0x5822f2['@odata.type']['substring'](_0x5822f2[_0x2646('0xba')][_0x2646('0xa9')]('.')+0x1);if(_0x18df41===_0x2646('0xc0')||_0x18df41==='DoubleAttributeMetadata'||_0x18df41===_0x2646('0xc1')||_0x18df41===_0x2646('0xc2')||_0x18df41===_0x2646('0xc3')||_0x18df41===_0x2646('0xc4')||_0x18df41===_0x2646('0xc5')||_0x18df41===_0x2646('0xc6')||_0x18df41===_0x2646('0xc7')||_0x18df41===_0x2646('0xc8')){_0x3c6726[_0x2646('0xbc')](getInputList(_0x3219ba,_0x2650d2,_0x18df41,_0x582cf4,_0x3767f3[_0x2646('0xb1')],_0x5822f2[_0x2646('0xb1')],_0x241d79));}}});return Promise[_0x2646('0xbd')](_0x3c6726);})[_0x2646('0x1f')](function(_0x29e450){_0xdb7b7d=_0x29e450[0x0];var _0x324cde=_0x2f1d6e[_0x2646('0xa2')](_0x311442)[_0x2646('0xa2')](_0xdb7b7d);var _0x128f33={'count':_0x324cde[_0x2646('0x52')],'rows':_0x324cde};return _0x128f33;})[_0x2646('0x1f')](respondWithResult(_0x101b60,null))[_0x2646('0x29')](function(_0x50bab5){var _0x223bd6=_0x4c9b1e[_0x2646('0x3f')][_0x2646('0x1b')]?0x1f4:_0x50bab5[_0x2646('0xc9')]||0x1f4;logger[_0x2646('0x25')](_0x50bab5[_0x2646('0x36')]);delete _0x50bab5['name'];if(_0x223bd6===0x191){_0x223bd6=0x190;}_0x101b60[_0x2646('0x2b')](_0x223bd6)['send'](_0x4c9b1e[_0x2646('0x3f')][_0x2646('0x1b')]?{'message':'Wrong\x20credentials','statusCode':_0x50bab5[_0x2646('0xc9')]}:_0x50bab5);});};function getSelectList(_0x221276,_0x2657f2,_0x4c9715,_0x2bfd2c,_0x51250a,_0x2bfa6f){var _0x4996bc={'method':_0x2646('0xb2'),'uri':_0x221276+_0x2646('0xb3')+_0x2bfd2c+_0x2646('0xca')+_0x51250a+_0x2646('0xcb')+'$select=DisplayName,LogicalName&$expand=OptionSet($select=Options)','headers':{'Authorization':_0x2646('0xcc')+_0x2bfa6f,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x4996bc)[_0x2646('0x1f')](function(_0x382fc6){var _0x18343f=[];var _0xdf5217=_0x382fc6[_0x2646('0xcd')][_0x2646('0xce')];_0xdf5217[_0x2646('0xb9')](function(_0x29d90a){_0x18343f['push']({'name':_0x29d90a[_0x2646('0xcf')]['UserLocalizedLabel'][_0x2646('0xcf')],'value':String(_0x29d90a[_0x2646('0xd0')])});});var _0x2b1c17={'id':_0x2657f2+'_'+_0x382fc6['LogicalName'],'name':_0x382fc6['DisplayName'][_0x2646('0xd1')][_0x2646('0xcf')],'custom':![],'options':_0x18343f};_0x4c9715[_0x2646('0xbc')](_0x2b1c17);return _0x4c9715;});}function getBooleanList(_0x8ff716,_0x23c43f,_0x8cc770,_0x4eb60d,_0x91ef2c,_0x29d72a){var _0xc78985={'method':_0x2646('0xb2'),'uri':_0x8ff716+_0x2646('0xb3')+_0x4eb60d+_0x2646('0xca')+_0x91ef2c+_0x2646('0xd2'),'headers':{'Authorization':_0x2646('0xcc')+_0x29d72a,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0xc78985)[_0x2646('0x1f')](function(_0x4986cd){var _0x27a0b7=[];_0x27a0b7[_0x2646('0xbc')]({'name':_0x4986cd[_0x2646('0xcd')][_0x2646('0xd3')][_0x2646('0xcf')]['UserLocalizedLabel'][_0x2646('0xcf')],'value':'true'},{'name':_0x4986cd[_0x2646('0xcd')][_0x2646('0xd4')]['Label'][_0x2646('0xd1')][_0x2646('0xcf')],'value':_0x2646('0xd5')});var _0x4eec94={'id':_0x23c43f+'_'+_0x4986cd[_0x2646('0xb8')],'name':_0x4986cd[_0x2646('0xd6')][_0x2646('0xd1')][_0x2646('0xcf')],'custom':![],'options':_0x27a0b7};_0x8cc770[_0x2646('0xbc')](_0x4eec94);return _0x8cc770;});}function getInputList(_0x53afb8,_0x471a8d,_0x31f9d1,_0x2b5b0e,_0x34053a,_0x130be9,_0x22c1fa){var _0x22e7a5={'method':_0x2646('0xb2'),'uri':_0x53afb8+_0x2646('0xb3')+_0x34053a+_0x2646('0xca')+_0x130be9+')/Microsoft.Dynamics.CRM.'+_0x31f9d1+_0x2646('0xd7'),'headers':{'Authorization':_0x2646('0xcc')+_0x22c1fa,'If-None-Match':null,'OData-Version':_0x2646('0xaf')},'json':!![]};return rp(_0x22e7a5)[_0x2646('0x1f')](function(_0x325d5a){var _0x34cf74={'id':_0x471a8d+'_'+_0x325d5a[_0x2646('0xb8')],'name':_0x325d5a[_0x2646('0xd6')]['UserLocalizedLabel']?_0x325d5a[_0x2646('0xd6')][_0x2646('0xd1')][_0x2646('0xcf')]:_0x325d5a[_0x2646('0xb8')],'custom':![],'options':[]};_0x2b5b0e[_0x2646('0xbc')](_0x34cf74);return _0x2b5b0e;});} \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.model.js b/server/api/intDynamics365Account/intDynamics365Account.model.js index 01d09fe..e250dbd 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 _0x30e4=['api','bluebird','path','rimraf','../../config/environment','./intDynamics365Account.attributes','../../components/integrations/configuration','exports','define','Dynamics365Account','int_dynamics365_accounts','util','../../config/logger'];(function(_0x255d5b,_0x4f6f35){var _0x3e141a=function(_0x249ee2){while(--_0x249ee2){_0x255d5b['push'](_0x255d5b['shift']());}};_0x3e141a(++_0x4f6f35);}(_0x30e4,0xa7));var _0x430e=function(_0x2227e0,_0x31c0c9){_0x2227e0=_0x2227e0-0x0;var _0x141b72=_0x30e4[_0x2227e0];return _0x141b72;};'use strict';var _=require('lodash');var util=require(_0x430e('0x0'));var logger=require(_0x430e('0x1'))(_0x430e('0x2'));var moment=require('moment');var BPromise=require(_0x430e('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x430e('0x4'));var rimraf=require(_0x430e('0x5'));var config=require(_0x430e('0x6'));var attributes=require(_0x430e('0x7'));var integrations=require(_0x430e('0x8'));module[_0x430e('0x9')]=function(_0x373345,_0x10ae1b){return _0x373345[_0x430e('0xa')](_0x430e('0xb'),attributes,{'tableName':_0x430e('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe20c=['bluebird','rimraf','exports','define','Dynamics365Account','int_dynamics365_accounts','lodash','../../config/logger','moment'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xe20c,0x9f));var _0xce20=function(_0x23adae,_0x200c34){_0x23adae=_0x23adae-0x0;var _0x52a03d=_0xe20c[_0x23adae];return _0x52a03d;};'use strict';var _=require(_0xce20('0x0'));var util=require('util');var logger=require(_0xce20('0x1'))('api');var moment=require(_0xce20('0x2'));var BPromise=require(_0xce20('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xce20('0x4'));var config=require('../../config/environment');var attributes=require('./intDynamics365Account.attributes');var integrations=require('../../components/integrations/configuration');module[_0xce20('0x5')]=function(_0x5a901c,_0x115fae){return _0x5a901c[_0xce20('0x6')](_0xce20('0x7'),attributes,{'tableName':_0xce20('0x8'),'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 da98bba..440f843 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 _0xc1dc=['Dynamics365Account,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','GetDynamics365Account','Dynamics365Account','findAll','options','raw','where','attributes','limit','include','map','model','ShowDynamics365Account','find','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','Dynamics365Account,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x58dc25,_0x49b9d5){var _0x21b0a7=function(_0x38a186){while(--_0x38a186){_0x58dc25['push'](_0x58dc25['shift']());}};_0x21b0a7(++_0x49b9d5);}(_0xc1dc,0x84));var _0xcc1d=function(_0x2c2da2,_0x2155f0){_0x2c2da2=_0x2c2da2-0x0;var _0x253aa8=_0xc1dc[_0x2c2da2];return _0x253aa8;};'use strict';var _=require(_0xcc1d('0x0'));var util=require(_0xcc1d('0x1'));var moment=require(_0xcc1d('0x2'));var BPromise=require('bluebird');var rs=require(_0xcc1d('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xcc1d('0x4'))['db'];var utils=require(_0xcc1d('0x5'));var logger=require('../../config/logger')(_0xcc1d('0x6'));var config=require(_0xcc1d('0x7'));var jayson=require(_0xcc1d('0x8'));var client=jayson[_0xcc1d('0x9')][_0xcc1d('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x597eb8,_0x4dc8ee,_0x23e085){return new BPromise(function(_0x24d561,_0x6e9800){return client[_0xcc1d('0xb')](_0x597eb8,_0x23e085)[_0xcc1d('0xc')](function(_0x171592){logger['info'](_0xcc1d('0xd'),_0x4dc8ee,_0xcc1d('0xe'));logger[_0xcc1d('0xf')](_0xcc1d('0x10'),_0x4dc8ee,_0xcc1d('0xe'),JSON[_0xcc1d('0x11')](_0x171592));if(_0x171592['error']){if(_0x171592[_0xcc1d('0x12')][_0xcc1d('0x13')]===0x1f4){logger['error'](_0xcc1d('0xd'),_0x4dc8ee,_0x171592[_0xcc1d('0x12')][_0xcc1d('0x14')]);return _0x6e9800(_0x171592[_0xcc1d('0x12')][_0xcc1d('0x14')]);}logger[_0xcc1d('0x12')](_0xcc1d('0xd'),_0x4dc8ee,_0x171592['error']['message']);return _0x24d561(_0x171592[_0xcc1d('0x12')]['message']);}else{logger[_0xcc1d('0x15')](_0xcc1d('0xd'),_0x4dc8ee,_0xcc1d('0xe'));_0x24d561(_0x171592[_0xcc1d('0x16')][_0xcc1d('0x14')]);}})[_0xcc1d('0x17')](function(_0x1f9737){logger[_0xcc1d('0x12')](_0xcc1d('0xd'),_0x4dc8ee,_0x1f9737);_0x6e9800(_0x1f9737);});});}exports[_0xcc1d('0x18')]=function(_0x483963){var _0x57a551=this;return new Promise(function(_0x2ee388,_0x536641){return db[_0xcc1d('0x19')][_0xcc1d('0x1a')]({'raw':_0x483963[_0xcc1d('0x1b')]?_0x483963[_0xcc1d('0x1b')][_0xcc1d('0x1c')]===undefined?!![]:![]:!![],'where':_0x483963[_0xcc1d('0x1b')]?_0x483963[_0xcc1d('0x1b')][_0xcc1d('0x1d')]||null:null,'attributes':_0x483963[_0xcc1d('0x1b')]?_0x483963['options'][_0xcc1d('0x1e')]||null:null,'limit':_0x483963['options']?_0x483963[_0xcc1d('0x1b')][_0xcc1d('0x1f')]||null:null,'include':_0x483963[_0xcc1d('0x1b')]?_0x483963['options'][_0xcc1d('0x20')]?_[_0xcc1d('0x21')](_0x483963[_0xcc1d('0x1b')][_0xcc1d('0x20')],function(_0xac9e86){return{'model':db[_0xac9e86['model']],'as':_0xac9e86['as'],'attributes':_0xac9e86[_0xcc1d('0x1e')],'include':_0xac9e86['include']?_[_0xcc1d('0x21')](_0xac9e86[_0xcc1d('0x20')],function(_0x3f8b30){return{'model':db[_0x3f8b30[_0xcc1d('0x22')]],'as':_0x3f8b30['as'],'attributes':_0x3f8b30[_0xcc1d('0x1e')],'include':_0x3f8b30['include']?_[_0xcc1d('0x21')](_0x3f8b30[_0xcc1d('0x20')],function(_0xec0667){return{'model':db[_0xec0667['model']],'as':_0xec0667['as'],'attributes':_0xec0667[_0xcc1d('0x1e')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x2d2b0c){logger['info'](_0xcc1d('0x18'),_0x483963);logger[_0xcc1d('0xf')](_0xcc1d('0x18'),_0x483963,JSON['stringify'](_0x2d2b0c));_0x2ee388(_0x2d2b0c);})[_0xcc1d('0x17')](function(_0x10f5d3){logger[_0xcc1d('0x12')]('GetDynamics365Account',_0x10f5d3[_0xcc1d('0x14')],_0x483963);_0x536641(_0x57a551['error'](0x1f4,_0x10f5d3[_0xcc1d('0x14')]));});});};exports[_0xcc1d('0x23')]=function(_0x14a4d4){var _0x380bd2=this;return new Promise(function(_0x5f70cc,_0x5d9163){return db[_0xcc1d('0x19')][_0xcc1d('0x24')]({'raw':_0x14a4d4['options']?_0x14a4d4[_0xcc1d('0x1b')]['raw']===undefined?!![]:![]:!![],'where':_0x14a4d4[_0xcc1d('0x1b')]?_0x14a4d4['options']['where']||null:null,'attributes':_0x14a4d4[_0xcc1d('0x1b')]?_0x14a4d4['options'][_0xcc1d('0x1e')]||null:null,'include':_0x14a4d4[_0xcc1d('0x1b')]?_0x14a4d4[_0xcc1d('0x1b')][_0xcc1d('0x20')]?_[_0xcc1d('0x21')](_0x14a4d4[_0xcc1d('0x1b')]['include'],function(_0x1610f9){return{'model':db[_0x1610f9['model']],'as':_0x1610f9['as'],'attributes':_0x1610f9[_0xcc1d('0x1e')],'include':_0x1610f9[_0xcc1d('0x20')]?_[_0xcc1d('0x21')](_0x1610f9[_0xcc1d('0x20')],function(_0x5864a9){return{'model':db[_0x5864a9[_0xcc1d('0x22')]],'as':_0x5864a9['as'],'attributes':_0x5864a9[_0xcc1d('0x1e')],'include':_0x5864a9[_0xcc1d('0x20')]?_[_0xcc1d('0x21')](_0x5864a9[_0xcc1d('0x20')],function(_0x26910c){return{'model':db[_0x26910c[_0xcc1d('0x22')]],'as':_0x26910c['as'],'attributes':_0x26910c[_0xcc1d('0x1e')]};}):[]};}):[]};}):[]:[]})[_0xcc1d('0xc')](function(_0x21af60){logger['info']('ShowDynamics365Account',_0x14a4d4);logger[_0xcc1d('0xf')](_0xcc1d('0x23'),_0x14a4d4,JSON['stringify'](_0x21af60));_0x5f70cc(_0x21af60);})['catch'](function(_0x5e2df9){logger[_0xcc1d('0x12')](_0xcc1d('0x23'),_0x5e2df9[_0xcc1d('0x14')],_0x14a4d4);_0x5d9163(_0x380bd2[_0xcc1d('0x12')](0x1f4,_0x5e2df9[_0xcc1d('0x14')]));});});}; \ No newline at end of file +var _0x29eb=['Dynamics365Account,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','result','GetDynamics365Account','Dynamics365Account','findAll','options','raw','attributes','limit','include','model','map','then','catch','ShowDynamics365Account','find','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http','request','info','Dynamics365Account,\x20%s,\x20%s','debug'];(function(_0x2d6763,_0x62f43a){var _0x45c885=function(_0x59bfc0){while(--_0x59bfc0){_0x2d6763['push'](_0x2d6763['shift']());}};_0x45c885(++_0x62f43a);}(_0x29eb,0x1c5));var _0xb29e=function(_0x16fb70,_0x3e97f1){_0x16fb70=_0x16fb70-0x0;var _0x2e1aa1=_0x29eb[_0x16fb70];return _0x2e1aa1;};'use strict';var _=require(_0xb29e('0x0'));var util=require(_0xb29e('0x1'));var moment=require(_0xb29e('0x2'));var BPromise=require('bluebird');var rs=require(_0xb29e('0x3'));var fs=require('fs');var Redis=require(_0xb29e('0x4'));var db=require(_0xb29e('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xb29e('0x6'))('rpc');var config=require(_0xb29e('0x7'));var jayson=require(_0xb29e('0x8'));var client=jayson[_0xb29e('0x9')][_0xb29e('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4dde31,_0x3032c3,_0x5bf1ae){return new BPromise(function(_0x1995ab,_0x29758f){return client[_0xb29e('0xb')](_0x4dde31,_0x5bf1ae)['then'](function(_0x551851){logger[_0xb29e('0xc')](_0xb29e('0xd'),_0x3032c3,'request\x20sent');logger[_0xb29e('0xe')](_0xb29e('0xf'),_0x3032c3,'request\x20sent',JSON[_0xb29e('0x10')](_0x551851));if(_0x551851[_0xb29e('0x11')]){if(_0x551851[_0xb29e('0x11')][_0xb29e('0x12')]===0x1f4){logger[_0xb29e('0x11')]('Dynamics365Account,\x20%s,\x20%s',_0x3032c3,_0x551851[_0xb29e('0x11')]['message']);return _0x29758f(_0x551851['error']['message']);}logger[_0xb29e('0x11')](_0xb29e('0xd'),_0x3032c3,_0x551851[_0xb29e('0x11')][_0xb29e('0x13')]);return _0x1995ab(_0x551851[_0xb29e('0x11')][_0xb29e('0x13')]);}else{logger['info'](_0xb29e('0xd'),_0x3032c3,_0xb29e('0x14'));_0x1995ab(_0x551851[_0xb29e('0x15')][_0xb29e('0x13')]);}})['catch'](function(_0x523341){logger[_0xb29e('0x11')](_0xb29e('0xd'),_0x3032c3,_0x523341);_0x29758f(_0x523341);});});}exports[_0xb29e('0x16')]=function(_0x355521){var _0x6049e=this;return new Promise(function(_0x107fa4,_0x426cfb){return db[_0xb29e('0x17')][_0xb29e('0x18')]({'raw':_0x355521[_0xb29e('0x19')]?_0x355521['options'][_0xb29e('0x1a')]===undefined?!![]:![]:!![],'where':_0x355521[_0xb29e('0x19')]?_0x355521[_0xb29e('0x19')]['where']||null:null,'attributes':_0x355521[_0xb29e('0x19')]?_0x355521['options'][_0xb29e('0x1b')]||null:null,'limit':_0x355521[_0xb29e('0x19')]?_0x355521[_0xb29e('0x19')][_0xb29e('0x1c')]||null:null,'include':_0x355521[_0xb29e('0x19')]?_0x355521[_0xb29e('0x19')][_0xb29e('0x1d')]?_['map'](_0x355521['options'][_0xb29e('0x1d')],function(_0xcb568b){return{'model':db[_0xcb568b[_0xb29e('0x1e')]],'as':_0xcb568b['as'],'attributes':_0xcb568b[_0xb29e('0x1b')],'include':_0xcb568b[_0xb29e('0x1d')]?_[_0xb29e('0x1f')](_0xcb568b[_0xb29e('0x1d')],function(_0x5b8cee){return{'model':db[_0x5b8cee['model']],'as':_0x5b8cee['as'],'attributes':_0x5b8cee[_0xb29e('0x1b')],'include':_0x5b8cee[_0xb29e('0x1d')]?_[_0xb29e('0x1f')](_0x5b8cee['include'],function(_0x58dfdc){return{'model':db[_0x58dfdc['model']],'as':_0x58dfdc['as'],'attributes':_0x58dfdc[_0xb29e('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xb29e('0x20')](function(_0x19a1a9){logger[_0xb29e('0xc')](_0xb29e('0x16'),_0x355521);logger[_0xb29e('0xe')](_0xb29e('0x16'),_0x355521,JSON[_0xb29e('0x10')](_0x19a1a9));_0x107fa4(_0x19a1a9);})[_0xb29e('0x21')](function(_0xc08c05){logger['error'](_0xb29e('0x16'),_0xc08c05[_0xb29e('0x13')],_0x355521);_0x426cfb(_0x6049e[_0xb29e('0x11')](0x1f4,_0xc08c05['message']));});});};exports[_0xb29e('0x22')]=function(_0xd56beb){var _0xc0d1f=this;return new Promise(function(_0x287609,_0x5448df){return db[_0xb29e('0x17')][_0xb29e('0x23')]({'raw':_0xd56beb[_0xb29e('0x19')]?_0xd56beb[_0xb29e('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0xd56beb[_0xb29e('0x19')]?_0xd56beb[_0xb29e('0x19')]['where']||null:null,'attributes':_0xd56beb[_0xb29e('0x19')]?_0xd56beb['options'][_0xb29e('0x1b')]||null:null,'include':_0xd56beb['options']?_0xd56beb[_0xb29e('0x19')]['include']?_[_0xb29e('0x1f')](_0xd56beb['options'][_0xb29e('0x1d')],function(_0x52e051){return{'model':db[_0x52e051[_0xb29e('0x1e')]],'as':_0x52e051['as'],'attributes':_0x52e051['attributes'],'include':_0x52e051[_0xb29e('0x1d')]?_[_0xb29e('0x1f')](_0x52e051['include'],function(_0x4f0ae2){return{'model':db[_0x4f0ae2[_0xb29e('0x1e')]],'as':_0x4f0ae2['as'],'attributes':_0x4f0ae2['attributes'],'include':_0x4f0ae2[_0xb29e('0x1d')]?_[_0xb29e('0x1f')](_0x4f0ae2[_0xb29e('0x1d')],function(_0x524451){return{'model':db[_0x524451['model']],'as':_0x524451['as'],'attributes':_0x524451[_0xb29e('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x14f3bd){logger[_0xb29e('0xc')]('ShowDynamics365Account',_0xd56beb);logger[_0xb29e('0xe')]('ShowDynamics365Account',_0xd56beb,JSON['stringify'](_0x14f3bd));_0x287609(_0x14f3bd);})['catch'](function(_0xca5fde){logger[_0xb29e('0x11')]('ShowDynamics365Account',_0xca5fde[_0xb29e('0x13')],_0xd56beb);_0x5448df(_0xc0d1f[_0xb29e('0x11')](0x1f4,_0xca5fde[_0xb29e('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/index.js b/server/api/intDynamics365Configuration/index.js index 95a34f5..9130141 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 _0x33ce=['exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','/:id','show','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','post','create','put','update','delete','destroy'];(function(_0x4e676e,_0x2a7c6d){var _0x336a3c=function(_0x4767c4){while(--_0x4767c4){_0x4e676e['push'](_0x4e676e['shift']());}};_0x336a3c(++_0x2a7c6d);}(_0x33ce,0x199));var _0xe33c=function(_0x5f2813,_0xc66ba9){_0x5f2813=_0x5f2813-0x0;var _0x2eb408=_0x33ce[_0x5f2813];return _0x2eb408;};'use strict';var multer=require(_0xe33c('0x0'));var util=require(_0xe33c('0x1'));var path=require(_0xe33c('0x2'));var timeout=require(_0xe33c('0x3'));var express=require(_0xe33c('0x4'));var router=express[_0xe33c('0x5')]();var auth=require(_0xe33c('0x6'));var interaction=require(_0xe33c('0x7'));var config=require('../../config/environment');var controller=require('./intDynamics365Configuration.controller');router[_0xe33c('0x8')]('/',auth[_0xe33c('0x9')](),controller[_0xe33c('0xa')]);router['get'](_0xe33c('0xb'),auth[_0xe33c('0x9')](),controller[_0xe33c('0xc')]);router['get']('/:id/fields',auth['isAuthenticated'](),controller['getFields']);router['get'](_0xe33c('0xd'),auth[_0xe33c('0x9')](),controller[_0xe33c('0xe')]);router[_0xe33c('0x8')](_0xe33c('0xf'),auth[_0xe33c('0x9')](),controller[_0xe33c('0x10')]);router[_0xe33c('0x11')]('/',auth['isAuthenticated'](),controller[_0xe33c('0x12')]);router[_0xe33c('0x13')](_0xe33c('0xb'),auth[_0xe33c('0x9')](),controller[_0xe33c('0x14')]);router[_0xe33c('0x15')]('/:id',auth[_0xe33c('0x9')](),controller[_0xe33c('0x16')]);module[_0xe33c('0x17')]=router; \ No newline at end of file +var _0xfbef=['update','delete','destroy','exports','multer','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDynamics365Configuration.controller','get','isAuthenticated','/:id','show','/:id/fields','getFields','getSubjects','/:id/descriptions','getDescriptions','post','put'];(function(_0x10bead,_0x192426){var _0x1f0a31=function(_0x73f138){while(--_0x73f138){_0x10bead['push'](_0x10bead['shift']());}};_0x1f0a31(++_0x192426);}(_0xfbef,0x101));var _0xffbe=function(_0x6436e7,_0x58ff32){_0x6436e7=_0x6436e7-0x0;var _0xcd4ad0=_0xfbef[_0x6436e7];return _0xcd4ad0;};'use strict';var multer=require(_0xffbe('0x0'));var util=require('util');var path=require(_0xffbe('0x1'));var timeout=require('connect-timeout');var express=require(_0xffbe('0x2'));var router=express[_0xffbe('0x3')]();var auth=require(_0xffbe('0x4'));var interaction=require(_0xffbe('0x5'));var config=require(_0xffbe('0x6'));var controller=require(_0xffbe('0x7'));router[_0xffbe('0x8')]('/',auth[_0xffbe('0x9')](),controller['index']);router[_0xffbe('0x8')](_0xffbe('0xa'),auth[_0xffbe('0x9')](),controller[_0xffbe('0xb')]);router[_0xffbe('0x8')](_0xffbe('0xc'),auth[_0xffbe('0x9')](),controller[_0xffbe('0xd')]);router[_0xffbe('0x8')]('/:id/subjects',auth[_0xffbe('0x9')](),controller[_0xffbe('0xe')]);router[_0xffbe('0x8')](_0xffbe('0xf'),auth['isAuthenticated'](),controller[_0xffbe('0x10')]);router[_0xffbe('0x11')]('/',auth['isAuthenticated'](),controller['create']);router[_0xffbe('0x12')](_0xffbe('0xa'),auth[_0xffbe('0x9')](),controller[_0xffbe('0x13')]);router[_0xffbe('0x14')](_0xffbe('0xa'),auth['isAuthenticated'](),controller[_0xffbe('0x15')]);module[_0xffbe('0x16')]=router; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.attributes.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.attributes.js index c0f3e81..68d8eaf 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 _0xe4f7=['incident','phonecall','exports','STRING','ENUM'];(function(_0x477598,_0x4dab5c){var _0x4c7ffb=function(_0x1be044){while(--_0x1be044){_0x477598['push'](_0x477598['shift']());}};_0x4c7ffb(++_0x4dab5c);}(_0xe4f7,0xc5));var _0x7e4f=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0xe4f7[_0x397e5f];return _0x5302b8;};'use strict';var Sequelize=require('sequelize');module[_0x7e4f('0x0')]={'name':{'type':Sequelize[_0x7e4f('0x1')]},'description':{'type':Sequelize[_0x7e4f('0x1')]},'ticketType':{'type':Sequelize[_0x7e4f('0x2')](_0x7e4f('0x3'),_0x7e4f('0x4')),'defaultValue':_0x7e4f('0x3')}}; \ No newline at end of file +var _0x3b72=['STRING','ENUM','incident','phonecall','sequelize','exports'];(function(_0xf3d5a0,_0x4c3828){var _0x1c3150=function(_0x4bb41b){while(--_0x4bb41b){_0xf3d5a0['push'](_0xf3d5a0['shift']());}};_0x1c3150(++_0x4c3828);}(_0x3b72,0x1de));var _0x23b7=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x3b72[_0x2dafbe];return _0x58a45a;};'use strict';var Sequelize=require(_0x23b7('0x0'));module[_0x23b7('0x1')]={'name':{'type':Sequelize[_0x23b7('0x2')]},'description':{'type':Sequelize[_0x23b7('0x2')]},'ticketType':{'type':Sequelize[_0x23b7('0x3')](_0x23b7('0x4'),_0x23b7('0x5')),'defaultValue':_0x23b7('0x4')}}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.controller.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.controller.js index 1775b7f..bbfc95c 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 _0x288b=['catch','sendStatus','status','end','json','count','offset','limit','set','apply','reject','save','update','destroy','then','stack','name','send','index','map','Dynamics365Configuration','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','filter','where','VIRTUAL','merge','options','includeAll','include','findAll','rows','show','params','keys','find','create','body','findOne','Dynamics365Field','length','pick','getFields','getSubjects','getDescriptions','html-pdf','request-promise','bluebird','util','path','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','client','http','test','Sequelize','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','info','debug','Dynamics365Configuration,\x20%s,\x20%s,\x20%s','stringify','error','message','Dynamics365Configuration,\x20%s,\x20%s','request\x20sent'];(function(_0x49f158,_0x5102b0){var _0x334058=function(_0x4a6023){while(--_0x4a6023){_0x49f158['push'](_0x49f158['shift']());}};_0x334058(++_0x5102b0);}(_0x288b,0x95));var _0xb288=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x288b[_0x3dd15e];return _0x231fd0;};'use strict';var pdf=require(_0xb288('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xb288('0x1'));var moment=require('moment');var BPromise=require(_0xb288('0x2'));var Mustache=require('mustache');var util=require(_0xb288('0x3'));var path=require(_0xb288('0x4'));var sox=require(_0xb288('0x5'));var csv=require(_0xb288('0x6'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xb288('0x7'));var squel=require(_0xb288('0x8'));var crypto=require(_0xb288('0x9'));var jsforce=require(_0xb288('0xa'));var deskjs=require(_0xb288('0xb'));var toCsv=require(_0xb288('0x6'));var querystring=require(_0xb288('0xc'));var Papa=require('papaparse');var Redis=require(_0xb288('0xd'));var authService=require(_0xb288('0xe'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xb288('0xf'));var logger=require(_0xb288('0x10'))(_0xb288('0x11'));var utils=require(_0xb288('0x12'));var config=require(_0xb288('0x13'));var db=require(_0xb288('0x14'))['db'];var jayson=require('jayson/promise');var client=jayson[_0xb288('0x15')][_0xb288('0x16')]({'port':0x232a});function checkPasswordPattern(_0x5479a2,_0xb8c9a4,_0x2e0361){if(_0x2e0361){var _0x4a4447=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x4a4447[_0xb288('0x17')](_0xb8c9a4)){return _0x5479a2;}else{throw new db[(_0xb288('0x18'))]['ValidationError'](_0xb288('0x19'));}}else{return _0x5479a2;}}function respondWithRpcPromise(_0x5ae3a9,_0x5a75ab,_0x23e5d4,_0x5093e4){return new BPromise(function(_0x32d70b,_0x516d68){var _0x22ae7a=_0x5093e4||client;return _0x22ae7a[_0xb288('0x1a')](_0x5ae3a9,_0x23e5d4)['then'](function(_0x5a6dc4){logger[_0xb288('0x1b')]('Dynamics365Configuration,\x20%s,\x20%s',_0x5a75ab,'request\x20sent');logger[_0xb288('0x1c')](_0xb288('0x1d'),_0x5a75ab,'request\x20sent',JSON[_0xb288('0x1e')](_0x5a6dc4));if(_0x5a6dc4[_0xb288('0x1f')]){if(_0x5a6dc4['error']['code']===0x1f4){logger[_0xb288('0x1f')]('Dynamics365Configuration,\x20%s,\x20%s',_0x5a75ab,_0x5a6dc4[_0xb288('0x1f')][_0xb288('0x20')]);return _0x516d68(_0x5a6dc4[_0xb288('0x1f')][_0xb288('0x20')]);}logger[_0xb288('0x1f')](_0xb288('0x21'),_0x5a75ab,_0x5a6dc4[_0xb288('0x1f')][_0xb288('0x20')]);return _0x32d70b(_0x5a6dc4[_0xb288('0x1f')][_0xb288('0x20')]);}else{logger[_0xb288('0x1b')](_0xb288('0x21'),_0x5a75ab,_0xb288('0x22'));_0x32d70b(_0x5a6dc4['result'][_0xb288('0x20')]);}})[_0xb288('0x23')](function(_0x8bc3c6){logger[_0xb288('0x1f')](_0xb288('0x21'),_0x5a75ab,_0x8bc3c6);_0x516d68(_0x8bc3c6);});});}function respondWithStatusCode(_0x3cdce8,_0x40d8b8){_0x40d8b8=_0x40d8b8||0xcc;return function(_0x3c7a5d){if(_0x3c7a5d){return _0x3cdce8[_0xb288('0x24')](_0x40d8b8);}return _0x3cdce8[_0xb288('0x25')](_0x40d8b8)[_0xb288('0x26')]();};}function respondWithResult(_0x4a5971,_0x4be60c){_0x4be60c=_0x4be60c||0xc8;return function(_0x4b262e){if(_0x4b262e){return _0x4a5971[_0xb288('0x25')](_0x4be60c)[_0xb288('0x27')](_0x4b262e);}};}function respondWithFilteredResult(_0x7419e1,_0x2d13f1){return function(_0x3c55e0){if(_0x3c55e0){var _0x3116b1=_0x3c55e0[_0xb288('0x28')],_0xa79e11=_0x2d13f1['offset'],_0x4afb2a=_0x2d13f1[_0xb288('0x29')]+_0x2d13f1[_0xb288('0x2a')],_0x159cf8;if(_0x4afb2a>=_0x3116b1){_0x4afb2a=_0x3116b1;_0x159cf8=0xc8;}else{_0x159cf8=0xce;}_0x7419e1[_0xb288('0x25')](_0x159cf8);return _0x7419e1[_0xb288('0x2b')]('Content-Range',_0xa79e11+'-'+_0x4afb2a+'/'+_0x3116b1)[_0xb288('0x27')](_0x3c55e0);}return null;};}function patchUpdates(_0x2f8d36){return function(_0x56d0a9){try{jsonpatch[_0xb288('0x2c')](_0x56d0a9,_0x2f8d36,!![]);}catch(_0x3ee8fb){return BPromise[_0xb288('0x2d')](_0x3ee8fb);}return _0x56d0a9[_0xb288('0x2e')]();};}function saveUpdates(_0xa48881,_0x2bee27){return function(_0x40758e){if(_0x40758e){return _0x40758e[_0xb288('0x2f')](_0xa48881)['then'](function(_0x13d19d){return _0x13d19d;});}return null;};}function removeEntity(_0x55d41e,_0x23fd57){return function(_0x14831d){if(_0x14831d){return _0x14831d[_0xb288('0x30')]()[_0xb288('0x31')](function(){_0x55d41e[_0xb288('0x25')](0xcc)[_0xb288('0x26')]();});}};}function handleEntityNotFound(_0x310646,_0x23405e){return function(_0x31bdb0){if(!_0x31bdb0){_0x310646['sendStatus'](0x194);}return _0x31bdb0;};}function handleError(_0x4b3788,_0x4bbd75){_0x4bbd75=_0x4bbd75||0x1f4;return function(_0x2672e6){logger[_0xb288('0x1f')](_0x2672e6[_0xb288('0x32')]);if(_0x2672e6[_0xb288('0x33')]){delete _0x2672e6['name'];}_0x4b3788['status'](_0x4bbd75)[_0xb288('0x34')](_0x2672e6);};}exports[_0xb288('0x35')]=function(_0x32e130,_0x3b6596){var _0x412157={},_0x4eb06f={},_0x3b3992={'count':0x0,'rows':[]};var _0x1d2672=_[_0xb288('0x36')](db[_0xb288('0x37')][_0xb288('0x38')],function(_0x4fad0a){return{'name':_0x4fad0a[_0xb288('0x39')],'type':_0x4fad0a[_0xb288('0x3a')][_0xb288('0x3b')]};});_0x4eb06f[_0xb288('0x3c')]=_['map'](_0x1d2672,_0xb288('0x33'));_0x4eb06f[_0xb288('0x3d')]=_['keys'](_0x32e130['query']);_0x4eb06f[_0xb288('0x3e')]=_[_0xb288('0x3f')](_0x4eb06f[_0xb288('0x3c')],_0x4eb06f[_0xb288('0x3d')]);_0x412157[_0xb288('0x40')]=_[_0xb288('0x3f')](_0x4eb06f[_0xb288('0x3c')],qs[_0xb288('0x41')](_0x32e130['query'][_0xb288('0x41')]));_0x412157[_0xb288('0x40')]=_0x412157[_0xb288('0x40')]['length']?_0x412157['attributes']:_0x4eb06f[_0xb288('0x3c')];if(!_0x32e130[_0xb288('0x3d')][_0xb288('0x42')](_0xb288('0x43'))){_0x412157[_0xb288('0x2a')]=qs[_0xb288('0x2a')](_0x32e130[_0xb288('0x3d')][_0xb288('0x2a')]);_0x412157['offset']=qs[_0xb288('0x29')](_0x32e130[_0xb288('0x3d')]['offset']);}_0x412157[_0xb288('0x44')]=qs[_0xb288('0x45')](_0x32e130[_0xb288('0x3d')]['sort']);_0x412157['where']=qs[_0xb288('0x3e')](_['pick'](_0x32e130['query'],_0x4eb06f[_0xb288('0x3e')]),_0x1d2672);if(_0x32e130[_0xb288('0x3d')][_0xb288('0x46')]){_0x412157['where']=_['merge'](_0x412157[_0xb288('0x47')],{'$or':_[_0xb288('0x36')](_0x1d2672,function(_0xdbb1f1){if(_0xdbb1f1[_0xb288('0x3a')]!==_0xb288('0x48')){var _0x26bb7b={};_0x26bb7b[_0xdbb1f1[_0xb288('0x33')]]={'$like':'%'+_0x32e130[_0xb288('0x3d')][_0xb288('0x46')]+'%'};return _0x26bb7b;}})});}_0x412157=_[_0xb288('0x49')]({},_0x412157,_0x32e130[_0xb288('0x4a')]);var _0x479404={'where':_0x412157[_0xb288('0x47')]};return db[_0xb288('0x37')][_0xb288('0x28')](_0x479404)[_0xb288('0x31')](function(_0x43ab58){_0x3b3992[_0xb288('0x28')]=_0x43ab58;if(_0x32e130[_0xb288('0x3d')][_0xb288('0x4b')]){_0x412157[_0xb288('0x4c')]=[{'all':!![]}];}return db[_0xb288('0x37')][_0xb288('0x4d')](_0x412157);})[_0xb288('0x31')](function(_0x1ad6d1){_0x3b3992[_0xb288('0x4e')]=_0x1ad6d1;return _0x3b3992;})[_0xb288('0x31')](respondWithFilteredResult(_0x3b6596,_0x412157))[_0xb288('0x23')](handleError(_0x3b6596,null));};exports[_0xb288('0x4f')]=function(_0x5da3d2,_0x4343c6){var _0x3c8af3={'raw':![],'where':{'id':_0x5da3d2[_0xb288('0x50')]['id']}},_0x9ec3b0={};_0x9ec3b0[_0xb288('0x3c')]=_[_0xb288('0x51')](db[_0xb288('0x37')][_0xb288('0x38')]);_0x9ec3b0[_0xb288('0x3d')]=_[_0xb288('0x51')](_0x5da3d2[_0xb288('0x3d')]);_0x9ec3b0[_0xb288('0x3e')]=_['intersection'](_0x9ec3b0[_0xb288('0x3c')],_0x9ec3b0[_0xb288('0x3d')]);_0x3c8af3[_0xb288('0x40')]=_['intersection'](_0x9ec3b0[_0xb288('0x3c')],qs[_0xb288('0x41')](_0x5da3d2[_0xb288('0x3d')][_0xb288('0x41')]));_0x3c8af3['attributes']=_0x3c8af3['attributes']['length']?_0x3c8af3[_0xb288('0x40')]:_0x9ec3b0[_0xb288('0x3c')];if(_0x5da3d2[_0xb288('0x3d')][_0xb288('0x4b')]){_0x3c8af3['include']=[{'all':!![]}];}_0x3c8af3=_['merge']({},_0x3c8af3,_0x5da3d2['options']);return db[_0xb288('0x37')][_0xb288('0x52')](_0x3c8af3)[_0xb288('0x31')](handleEntityNotFound(_0x4343c6,null))[_0xb288('0x31')](respondWithResult(_0x4343c6,null))['catch'](handleError(_0x4343c6,null));};exports[_0xb288('0x53')]=function(_0x168c0a,_0x1b74a7){return db[_0xb288('0x37')]['create'](_0x168c0a[_0xb288('0x54')],{})['then'](respondWithResult(_0x1b74a7,0xc9))['catch'](handleError(_0x1b74a7,null));};exports[_0xb288('0x2f')]=function(_0x5e5db3,_0x526714){if(_0x5e5db3[_0xb288('0x54')]['id']){delete _0x5e5db3[_0xb288('0x54')]['id'];}return db['Dynamics365Configuration'][_0xb288('0x52')]({'where':{'id':_0x5e5db3[_0xb288('0x50')]['id']}})[_0xb288('0x31')](handleEntityNotFound(_0x526714,null))['then'](saveUpdates(_0x5e5db3[_0xb288('0x54')],null))[_0xb288('0x31')](respondWithResult(_0x526714,null))[_0xb288('0x23')](handleError(_0x526714,null));};exports[_0xb288('0x30')]=function(_0xe9d228,_0x5730bd){return db[_0xb288('0x37')][_0xb288('0x52')]({'where':{'id':_0xe9d228[_0xb288('0x50')]['id']}})[_0xb288('0x31')](handleEntityNotFound(_0x5730bd,null))[_0xb288('0x31')](removeEntity(_0x5730bd,null))[_0xb288('0x23')](handleError(_0x5730bd,null));};exports['getFields']=function(_0x28163e,_0x381ed1,_0x44a7f2){var _0xbed8c4={};var _0x57170a={};var _0x20e21f;var _0x27253c;return db[_0xb288('0x37')][_0xb288('0x55')]({'where':{'id':_0x28163e[_0xb288('0x50')]['id']}})[_0xb288('0x31')](handleEntityNotFound(_0x381ed1,null))[_0xb288('0x31')](function(_0x140ac0){if(_0x140ac0){_0x20e21f=_0x140ac0;_0x57170a[_0xb288('0x3c')]=_[_0xb288('0x51')](db[_0xb288('0x56')][_0xb288('0x38')]);_0x57170a[_0xb288('0x3d')]=_['keys'](_0x28163e[_0xb288('0x3d')]);_0x57170a[_0xb288('0x3e')]=_[_0xb288('0x3f')](_0x57170a[_0xb288('0x3c')],_0x57170a[_0xb288('0x3d')]);_0xbed8c4['attributes']=_[_0xb288('0x3f')](_0x57170a[_0xb288('0x3c')],qs['fields'](_0x28163e[_0xb288('0x3d')]['fields']));_0xbed8c4[_0xb288('0x40')]=_0xbed8c4['attributes'][_0xb288('0x57')]?_0xbed8c4[_0xb288('0x40')]:_0x57170a[_0xb288('0x3c')];_0xbed8c4[_0xb288('0x44')]=qs[_0xb288('0x45')](_0x28163e[_0xb288('0x3d')]['sort']);_0xbed8c4[_0xb288('0x47')]=qs[_0xb288('0x3e')](_[_0xb288('0x58')](_0x28163e[_0xb288('0x3d')],_0x57170a[_0xb288('0x3e')]));if(_0x28163e[_0xb288('0x3d')][_0xb288('0x46')]){_0xbed8c4[_0xb288('0x47')]=_[_0xb288('0x49')](_0xbed8c4[_0xb288('0x47')],{'$or':_[_0xb288('0x36')](_0xbed8c4[_0xb288('0x40')],function(_0x109d7f){var _0x337a38={};_0x337a38[_0x109d7f]={'$like':'%'+_0x28163e[_0xb288('0x3d')]['filter']+'%'};return _0x337a38;})});}_0xbed8c4=_[_0xb288('0x49')]({},_0xbed8c4,_0x28163e[_0xb288('0x4a')]);return _0x20e21f[_0xb288('0x59')](_0xbed8c4);}})[_0xb288('0x31')](function(_0xd6f9fe){if(_0xd6f9fe){_0x27253c=_0xd6f9fe[_0xb288('0x57')];if(!_0x28163e[_0xb288('0x3d')][_0xb288('0x42')](_0xb288('0x43'))){_0xbed8c4['limit']=qs[_0xb288('0x2a')](_0x28163e[_0xb288('0x3d')][_0xb288('0x2a')]);_0xbed8c4[_0xb288('0x29')]=qs[_0xb288('0x29')](_0x28163e['query'][_0xb288('0x29')]);}return _0x20e21f[_0xb288('0x59')](_0xbed8c4);}})[_0xb288('0x31')](function(_0x2a8d4d){if(_0x2a8d4d){return _0x2a8d4d?{'count':_0x27253c,'rows':_0x2a8d4d}:null;}})[_0xb288('0x31')](respondWithResult(_0x381ed1,null))[_0xb288('0x23')](handleError(_0x381ed1,null));};exports[_0xb288('0x5a')]=function(_0x5019ab,_0x2a7ab3,_0x25d264){var _0x4c1271={};var _0x395279={};var _0x32baf6;var _0x4c760c;return db[_0xb288('0x37')][_0xb288('0x55')]({'where':{'id':_0x5019ab[_0xb288('0x50')]['id']}})[_0xb288('0x31')](handleEntityNotFound(_0x2a7ab3,null))[_0xb288('0x31')](function(_0x2698c9){if(_0x2698c9){_0x32baf6=_0x2698c9;_0x395279[_0xb288('0x3c')]=_['keys'](db[_0xb288('0x56')][_0xb288('0x38')]);_0x395279['query']=_[_0xb288('0x51')](_0x5019ab[_0xb288('0x3d')]);_0x395279['filters']=_[_0xb288('0x3f')](_0x395279[_0xb288('0x3c')],_0x395279['query']);_0x4c1271['attributes']=_['intersection'](_0x395279['model'],qs[_0xb288('0x41')](_0x5019ab[_0xb288('0x3d')][_0xb288('0x41')]));_0x4c1271[_0xb288('0x40')]=_0x4c1271[_0xb288('0x40')][_0xb288('0x57')]?_0x4c1271[_0xb288('0x40')]:_0x395279['model'];_0x4c1271[_0xb288('0x44')]=qs['sort'](_0x5019ab[_0xb288('0x3d')][_0xb288('0x45')]);_0x4c1271['where']=qs[_0xb288('0x3e')](_[_0xb288('0x58')](_0x5019ab[_0xb288('0x3d')],_0x395279['filters']));if(_0x5019ab[_0xb288('0x3d')][_0xb288('0x46')]){_0x4c1271[_0xb288('0x47')]=_[_0xb288('0x49')](_0x4c1271[_0xb288('0x47')],{'$or':_[_0xb288('0x36')](_0x4c1271[_0xb288('0x40')],function(_0x552559){var _0x18b69d={};_0x18b69d[_0x552559]={'$like':'%'+_0x5019ab[_0xb288('0x3d')][_0xb288('0x46')]+'%'};return _0x18b69d;})});}_0x4c1271=_['merge']({},_0x4c1271,_0x5019ab['options']);return _0x32baf6['getSubjects'](_0x4c1271);}})[_0xb288('0x31')](function(_0x32f17a){if(_0x32f17a){_0x4c760c=_0x32f17a[_0xb288('0x57')];if(!_0x5019ab[_0xb288('0x3d')][_0xb288('0x42')](_0xb288('0x43'))){_0x4c1271['limit']=qs[_0xb288('0x2a')](_0x5019ab['query']['limit']);_0x4c1271[_0xb288('0x29')]=qs[_0xb288('0x29')](_0x5019ab['query'][_0xb288('0x29')]);}return _0x32baf6[_0xb288('0x5a')](_0x4c1271);}})[_0xb288('0x31')](function(_0x38bd86){if(_0x38bd86){return _0x38bd86?{'count':_0x4c760c,'rows':_0x38bd86}:null;}})[_0xb288('0x31')](respondWithResult(_0x2a7ab3,null))[_0xb288('0x23')](handleError(_0x2a7ab3,null));};exports[_0xb288('0x5b')]=function(_0x248b89,_0x33d80c,_0x18fdf9){var _0x51fdc2={};var _0x1544af={};var _0xf8d9dc;var _0x2c2525;return db[_0xb288('0x37')]['findOne']({'where':{'id':_0x248b89[_0xb288('0x50')]['id']}})[_0xb288('0x31')](handleEntityNotFound(_0x33d80c,null))[_0xb288('0x31')](function(_0x29f896){if(_0x29f896){_0xf8d9dc=_0x29f896;_0x1544af['model']=_[_0xb288('0x51')](db[_0xb288('0x56')][_0xb288('0x38')]);_0x1544af[_0xb288('0x3d')]=_[_0xb288('0x51')](_0x248b89[_0xb288('0x3d')]);_0x1544af['filters']=_[_0xb288('0x3f')](_0x1544af['model'],_0x1544af['query']);_0x51fdc2[_0xb288('0x40')]=_[_0xb288('0x3f')](_0x1544af[_0xb288('0x3c')],qs['fields'](_0x248b89[_0xb288('0x3d')][_0xb288('0x41')]));_0x51fdc2['attributes']=_0x51fdc2[_0xb288('0x40')][_0xb288('0x57')]?_0x51fdc2[_0xb288('0x40')]:_0x1544af['model'];_0x51fdc2['order']=qs[_0xb288('0x45')](_0x248b89[_0xb288('0x3d')][_0xb288('0x45')]);_0x51fdc2[_0xb288('0x47')]=qs['filters'](_[_0xb288('0x58')](_0x248b89[_0xb288('0x3d')],_0x1544af['filters']));if(_0x248b89[_0xb288('0x3d')]['filter']){_0x51fdc2[_0xb288('0x47')]=_[_0xb288('0x49')](_0x51fdc2[_0xb288('0x47')],{'$or':_[_0xb288('0x36')](_0x51fdc2[_0xb288('0x40')],function(_0x5125d4){var _0x416943={};_0x416943[_0x5125d4]={'$like':'%'+_0x248b89[_0xb288('0x3d')][_0xb288('0x46')]+'%'};return _0x416943;})});}_0x51fdc2=_['merge']({},_0x51fdc2,_0x248b89['options']);return _0xf8d9dc[_0xb288('0x5b')](_0x51fdc2);}})[_0xb288('0x31')](function(_0x338d3c){if(_0x338d3c){_0x2c2525=_0x338d3c[_0xb288('0x57')];if(!_0x248b89[_0xb288('0x3d')][_0xb288('0x42')](_0xb288('0x43'))){_0x51fdc2[_0xb288('0x2a')]=qs[_0xb288('0x2a')](_0x248b89[_0xb288('0x3d')]['limit']);_0x51fdc2['offset']=qs[_0xb288('0x29')](_0x248b89[_0xb288('0x3d')][_0xb288('0x29')]);}return _0xf8d9dc[_0xb288('0x5b')](_0x51fdc2);}})[_0xb288('0x31')](function(_0x3534bd){if(_0x3534bd){return _0x3534bd?{'count':_0x2c2525,'rows':_0x3534bd}:null;}})[_0xb288('0x31')](respondWithResult(_0x33d80c,null))['catch'](handleError(_0x33d80c,null));}; \ No newline at end of file +var _0xe2ac=['../../config/utils','../../mysqldb','jayson/promise','http','test','Sequelize','ValidationError','request','info','Dynamics365Configuration,\x20%s,\x20%s','request\x20sent','debug','Dynamics365Configuration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','sendStatus','status','json','offset','limit','Content-Range','apply','save','update','then','destroy','end','name','index','map','Dynamics365Configuration','fieldName','key','model','keys','query','filters','intersection','attributes','fields','length','nolimit','order','sort','pick','filter','where','merge','type','VIRTUAL','count','includeAll','findAll','show','params','include','options','find','catch','create','body','findOne','Dynamics365Field','rawAttributes','getFields','hasOwnProperty','getSubjects','getDescriptions','html-pdf','eml-format','zip-dir','bluebird','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api'];(function(_0xe03e58,_0x4e4d7a){var _0xd7b19=function(_0x11ea57){while(--_0x11ea57){_0xe03e58['push'](_0xe03e58['shift']());}};_0xd7b19(++_0x4e4d7a);}(_0xe2ac,0xa0));var _0xce2a=function(_0x80d733,_0x266211){_0x80d733=_0x80d733-0x0;var _0x435868=_0xe2ac[_0x80d733];return _0x435868;};'use strict';var pdf=require(_0xce2a('0x0'));var emlformat=require(_0xce2a('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xce2a('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xce2a('0x3'));var Mustache=require('mustache');var util=require(_0xce2a('0x4'));var path=require(_0xce2a('0x5'));var sox=require(_0xce2a('0x6'));var csv=require(_0xce2a('0x7'));var ejs=require(_0xce2a('0x8'));var fs=require('fs');var _=require(_0xce2a('0x9'));var squel=require(_0xce2a('0xa'));var crypto=require(_0xce2a('0xb'));var jsforce=require(_0xce2a('0xc'));var deskjs=require(_0xce2a('0xd'));var toCsv=require(_0xce2a('0x7'));var querystring=require('querystring');var Papa=require(_0xce2a('0xe'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xce2a('0xf'));var as=require(_0xce2a('0x10'));var hardwareService=require(_0xce2a('0x11'));var logger=require(_0xce2a('0x12'))(_0xce2a('0x13'));var utils=require(_0xce2a('0x14'));var config=require('../../config/environment');var db=require(_0xce2a('0x15'))['db'];var jayson=require(_0xce2a('0x16'));var client=jayson['client'][_0xce2a('0x17')]({'port':0x232a});function checkPasswordPattern(_0x351fea,_0x9e22bc,_0x39b2ad){if(_0x39b2ad){var _0x33c362=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x33c362[_0xce2a('0x18')](_0x9e22bc)){return _0x351fea;}else{throw new db[(_0xce2a('0x19'))][(_0xce2a('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 _0x351fea;}}function respondWithRpcPromise(_0x17772a,_0x434053,_0x4fd806,_0x551600){return new BPromise(function(_0x155352,_0x112cc4){var _0x503859=_0x551600||client;return _0x503859[_0xce2a('0x1b')](_0x17772a,_0x4fd806)['then'](function(_0x165bfb){logger[_0xce2a('0x1c')](_0xce2a('0x1d'),_0x434053,_0xce2a('0x1e'));logger[_0xce2a('0x1f')](_0xce2a('0x20'),_0x434053,'request\x20sent',JSON[_0xce2a('0x21')](_0x165bfb));if(_0x165bfb[_0xce2a('0x22')]){if(_0x165bfb[_0xce2a('0x22')][_0xce2a('0x23')]===0x1f4){logger['error'](_0xce2a('0x1d'),_0x434053,_0x165bfb[_0xce2a('0x22')][_0xce2a('0x24')]);return _0x112cc4(_0x165bfb[_0xce2a('0x22')][_0xce2a('0x24')]);}logger[_0xce2a('0x22')](_0xce2a('0x1d'),_0x434053,_0x165bfb['error'][_0xce2a('0x24')]);return _0x155352(_0x165bfb[_0xce2a('0x22')]['message']);}else{logger[_0xce2a('0x1c')](_0xce2a('0x1d'),_0x434053,'request\x20sent');_0x155352(_0x165bfb['result']['message']);}})['catch'](function(_0x4a8f9c){logger[_0xce2a('0x22')](_0xce2a('0x1d'),_0x434053,_0x4a8f9c);_0x112cc4(_0x4a8f9c);});});}function respondWithStatusCode(_0x3e4a8d,_0x59d38f){_0x59d38f=_0x59d38f||0xcc;return function(_0x4cfa0b){if(_0x4cfa0b){return _0x3e4a8d[_0xce2a('0x25')](_0x59d38f);}return _0x3e4a8d['status'](_0x59d38f)['end']();};}function respondWithResult(_0x3f8b9b,_0x5a39a6){_0x5a39a6=_0x5a39a6||0xc8;return function(_0x11eed6){if(_0x11eed6){return _0x3f8b9b[_0xce2a('0x26')](_0x5a39a6)[_0xce2a('0x27')](_0x11eed6);}};}function respondWithFilteredResult(_0x2baf74,_0x3ca6e2){return function(_0x5270f3){if(_0x5270f3){var _0x4f01f9=_0x5270f3['count'],_0x36f4bb=_0x3ca6e2[_0xce2a('0x28')],_0x2d391b=_0x3ca6e2[_0xce2a('0x28')]+_0x3ca6e2[_0xce2a('0x29')],_0xe11799;if(_0x2d391b>=_0x4f01f9){_0x2d391b=_0x4f01f9;_0xe11799=0xc8;}else{_0xe11799=0xce;}_0x2baf74[_0xce2a('0x26')](_0xe11799);return _0x2baf74['set'](_0xce2a('0x2a'),_0x36f4bb+'-'+_0x2d391b+'/'+_0x4f01f9)[_0xce2a('0x27')](_0x5270f3);}return null;};}function patchUpdates(_0x253969){return function(_0x4f910e){try{jsonpatch[_0xce2a('0x2b')](_0x4f910e,_0x253969,!![]);}catch(_0x532018){return BPromise['reject'](_0x532018);}return _0x4f910e[_0xce2a('0x2c')]();};}function saveUpdates(_0x5aa6a2,_0x4657e1){return function(_0x1b81e7){if(_0x1b81e7){return _0x1b81e7[_0xce2a('0x2d')](_0x5aa6a2)[_0xce2a('0x2e')](function(_0x1b2785){return _0x1b2785;});}return null;};}function removeEntity(_0xbedf2b,_0xf8f1cd){return function(_0x36b9aa){if(_0x36b9aa){return _0x36b9aa[_0xce2a('0x2f')]()['then'](function(){_0xbedf2b['status'](0xcc)[_0xce2a('0x30')]();});}};}function handleEntityNotFound(_0x24c89b,_0x3fd2a3){return function(_0x1003de){if(!_0x1003de){_0x24c89b[_0xce2a('0x25')](0x194);}return _0x1003de;};}function handleError(_0x1fa525,_0x5c4a6a){_0x5c4a6a=_0x5c4a6a||0x1f4;return function(_0x131153){logger[_0xce2a('0x22')](_0x131153['stack']);if(_0x131153[_0xce2a('0x31')]){delete _0x131153[_0xce2a('0x31')];}_0x1fa525[_0xce2a('0x26')](_0x5c4a6a)['send'](_0x131153);};}exports[_0xce2a('0x32')]=function(_0x53a978,_0x226dd6){var _0x62b332={},_0x59d9c5={},_0x71b415={'count':0x0,'rows':[]};var _0x5445e9=_[_0xce2a('0x33')](db[_0xce2a('0x34')]['rawAttributes'],function(_0x26773f){return{'name':_0x26773f[_0xce2a('0x35')],'type':_0x26773f['type'][_0xce2a('0x36')]};});_0x59d9c5[_0xce2a('0x37')]=_[_0xce2a('0x33')](_0x5445e9,_0xce2a('0x31'));_0x59d9c5['query']=_[_0xce2a('0x38')](_0x53a978[_0xce2a('0x39')]);_0x59d9c5[_0xce2a('0x3a')]=_[_0xce2a('0x3b')](_0x59d9c5[_0xce2a('0x37')],_0x59d9c5[_0xce2a('0x39')]);_0x62b332[_0xce2a('0x3c')]=_[_0xce2a('0x3b')](_0x59d9c5[_0xce2a('0x37')],qs[_0xce2a('0x3d')](_0x53a978[_0xce2a('0x39')]['fields']));_0x62b332['attributes']=_0x62b332['attributes'][_0xce2a('0x3e')]?_0x62b332['attributes']:_0x59d9c5[_0xce2a('0x37')];if(!_0x53a978['query']['hasOwnProperty'](_0xce2a('0x3f'))){_0x62b332[_0xce2a('0x29')]=qs[_0xce2a('0x29')](_0x53a978['query'][_0xce2a('0x29')]);_0x62b332['offset']=qs[_0xce2a('0x28')](_0x53a978[_0xce2a('0x39')][_0xce2a('0x28')]);}_0x62b332[_0xce2a('0x40')]=qs[_0xce2a('0x41')](_0x53a978[_0xce2a('0x39')][_0xce2a('0x41')]);_0x62b332['where']=qs[_0xce2a('0x3a')](_[_0xce2a('0x42')](_0x53a978['query'],_0x59d9c5['filters']),_0x5445e9);if(_0x53a978[_0xce2a('0x39')][_0xce2a('0x43')]){_0x62b332[_0xce2a('0x44')]=_[_0xce2a('0x45')](_0x62b332['where'],{'$or':_[_0xce2a('0x33')](_0x5445e9,function(_0x3a4b13){if(_0x3a4b13[_0xce2a('0x46')]!==_0xce2a('0x47')){var _0x4ee26b={};_0x4ee26b[_0x3a4b13[_0xce2a('0x31')]]={'$like':'%'+_0x53a978[_0xce2a('0x39')][_0xce2a('0x43')]+'%'};return _0x4ee26b;}})});}_0x62b332=_[_0xce2a('0x45')]({},_0x62b332,_0x53a978['options']);var _0x165de9={'where':_0x62b332[_0xce2a('0x44')]};return db['Dynamics365Configuration'][_0xce2a('0x48')](_0x165de9)[_0xce2a('0x2e')](function(_0x1ec74a){_0x71b415[_0xce2a('0x48')]=_0x1ec74a;if(_0x53a978['query'][_0xce2a('0x49')]){_0x62b332['include']=[{'all':!![]}];}return db[_0xce2a('0x34')][_0xce2a('0x4a')](_0x62b332);})[_0xce2a('0x2e')](function(_0x3976b2){_0x71b415['rows']=_0x3976b2;return _0x71b415;})['then'](respondWithFilteredResult(_0x226dd6,_0x62b332))['catch'](handleError(_0x226dd6,null));};exports[_0xce2a('0x4b')]=function(_0x2c7f72,_0x2b7222){var _0x431d1c={'raw':![],'where':{'id':_0x2c7f72[_0xce2a('0x4c')]['id']}},_0x2cf442={};_0x2cf442[_0xce2a('0x37')]=_[_0xce2a('0x38')](db['Dynamics365Configuration']['rawAttributes']);_0x2cf442['query']=_[_0xce2a('0x38')](_0x2c7f72[_0xce2a('0x39')]);_0x2cf442[_0xce2a('0x3a')]=_[_0xce2a('0x3b')](_0x2cf442['model'],_0x2cf442[_0xce2a('0x39')]);_0x431d1c[_0xce2a('0x3c')]=_[_0xce2a('0x3b')](_0x2cf442[_0xce2a('0x37')],qs[_0xce2a('0x3d')](_0x2c7f72['query']['fields']));_0x431d1c['attributes']=_0x431d1c[_0xce2a('0x3c')][_0xce2a('0x3e')]?_0x431d1c[_0xce2a('0x3c')]:_0x2cf442[_0xce2a('0x37')];if(_0x2c7f72[_0xce2a('0x39')][_0xce2a('0x49')]){_0x431d1c[_0xce2a('0x4d')]=[{'all':!![]}];}_0x431d1c=_[_0xce2a('0x45')]({},_0x431d1c,_0x2c7f72[_0xce2a('0x4e')]);return db[_0xce2a('0x34')][_0xce2a('0x4f')](_0x431d1c)['then'](handleEntityNotFound(_0x2b7222,null))[_0xce2a('0x2e')](respondWithResult(_0x2b7222,null))[_0xce2a('0x50')](handleError(_0x2b7222,null));};exports[_0xce2a('0x51')]=function(_0x3901c7,_0x2feb06){return db['Dynamics365Configuration'][_0xce2a('0x51')](_0x3901c7[_0xce2a('0x52')],{})[_0xce2a('0x2e')](respondWithResult(_0x2feb06,0xc9))[_0xce2a('0x50')](handleError(_0x2feb06,null));};exports[_0xce2a('0x2d')]=function(_0x4f41dd,_0x4ed31f){if(_0x4f41dd[_0xce2a('0x52')]['id']){delete _0x4f41dd['body']['id'];}return db[_0xce2a('0x34')][_0xce2a('0x4f')]({'where':{'id':_0x4f41dd[_0xce2a('0x4c')]['id']}})[_0xce2a('0x2e')](handleEntityNotFound(_0x4ed31f,null))[_0xce2a('0x2e')](saveUpdates(_0x4f41dd['body'],null))['then'](respondWithResult(_0x4ed31f,null))[_0xce2a('0x50')](handleError(_0x4ed31f,null));};exports[_0xce2a('0x2f')]=function(_0x1d6140,_0x2f07c7){return db[_0xce2a('0x34')]['find']({'where':{'id':_0x1d6140['params']['id']}})['then'](handleEntityNotFound(_0x2f07c7,null))[_0xce2a('0x2e')](removeEntity(_0x2f07c7,null))[_0xce2a('0x50')](handleError(_0x2f07c7,null));};exports['getFields']=function(_0x2f25a8,_0x54625a,_0x16c2e1){var _0xe4e220={};var _0x2dab2f={};var _0x18c18e;var _0x16549a;return db[_0xce2a('0x34')][_0xce2a('0x53')]({'where':{'id':_0x2f25a8[_0xce2a('0x4c')]['id']}})[_0xce2a('0x2e')](handleEntityNotFound(_0x54625a,null))['then'](function(_0x32fcba){if(_0x32fcba){_0x18c18e=_0x32fcba;_0x2dab2f[_0xce2a('0x37')]=_[_0xce2a('0x38')](db[_0xce2a('0x54')][_0xce2a('0x55')]);_0x2dab2f[_0xce2a('0x39')]=_[_0xce2a('0x38')](_0x2f25a8[_0xce2a('0x39')]);_0x2dab2f['filters']=_[_0xce2a('0x3b')](_0x2dab2f[_0xce2a('0x37')],_0x2dab2f['query']);_0xe4e220[_0xce2a('0x3c')]=_[_0xce2a('0x3b')](_0x2dab2f[_0xce2a('0x37')],qs[_0xce2a('0x3d')](_0x2f25a8[_0xce2a('0x39')][_0xce2a('0x3d')]));_0xe4e220[_0xce2a('0x3c')]=_0xe4e220[_0xce2a('0x3c')]['length']?_0xe4e220[_0xce2a('0x3c')]:_0x2dab2f['model'];_0xe4e220['order']=qs[_0xce2a('0x41')](_0x2f25a8['query']['sort']);_0xe4e220[_0xce2a('0x44')]=qs['filters'](_[_0xce2a('0x42')](_0x2f25a8[_0xce2a('0x39')],_0x2dab2f[_0xce2a('0x3a')]));if(_0x2f25a8[_0xce2a('0x39')][_0xce2a('0x43')]){_0xe4e220['where']=_[_0xce2a('0x45')](_0xe4e220[_0xce2a('0x44')],{'$or':_['map'](_0xe4e220[_0xce2a('0x3c')],function(_0x3ba2b8){var _0x41ddd3={};_0x41ddd3[_0x3ba2b8]={'$like':'%'+_0x2f25a8[_0xce2a('0x39')][_0xce2a('0x43')]+'%'};return _0x41ddd3;})});}_0xe4e220=_[_0xce2a('0x45')]({},_0xe4e220,_0x2f25a8[_0xce2a('0x4e')]);return _0x18c18e[_0xce2a('0x56')](_0xe4e220);}})['then'](function(_0x7e990f){if(_0x7e990f){_0x16549a=_0x7e990f[_0xce2a('0x3e')];if(!_0x2f25a8[_0xce2a('0x39')]['hasOwnProperty']('nolimit')){_0xe4e220[_0xce2a('0x29')]=qs[_0xce2a('0x29')](_0x2f25a8[_0xce2a('0x39')][_0xce2a('0x29')]);_0xe4e220['offset']=qs[_0xce2a('0x28')](_0x2f25a8[_0xce2a('0x39')][_0xce2a('0x28')]);}return _0x18c18e[_0xce2a('0x56')](_0xe4e220);}})[_0xce2a('0x2e')](function(_0x4676c8){if(_0x4676c8){return _0x4676c8?{'count':_0x16549a,'rows':_0x4676c8}:null;}})['then'](respondWithResult(_0x54625a,null))[_0xce2a('0x50')](handleError(_0x54625a,null));};exports['getSubjects']=function(_0x18a3ca,_0x22c7b0,_0xe6dc1c){var _0x44c0f2={};var _0x38b6b9={};var _0x20310a;var _0x239855;return db[_0xce2a('0x34')]['findOne']({'where':{'id':_0x18a3ca['params']['id']}})[_0xce2a('0x2e')](handleEntityNotFound(_0x22c7b0,null))['then'](function(_0x170a1f){if(_0x170a1f){_0x20310a=_0x170a1f;_0x38b6b9[_0xce2a('0x37')]=_['keys'](db['Dynamics365Field'][_0xce2a('0x55')]);_0x38b6b9[_0xce2a('0x39')]=_['keys'](_0x18a3ca['query']);_0x38b6b9[_0xce2a('0x3a')]=_[_0xce2a('0x3b')](_0x38b6b9[_0xce2a('0x37')],_0x38b6b9[_0xce2a('0x39')]);_0x44c0f2[_0xce2a('0x3c')]=_[_0xce2a('0x3b')](_0x38b6b9[_0xce2a('0x37')],qs[_0xce2a('0x3d')](_0x18a3ca['query']['fields']));_0x44c0f2['attributes']=_0x44c0f2[_0xce2a('0x3c')][_0xce2a('0x3e')]?_0x44c0f2[_0xce2a('0x3c')]:_0x38b6b9[_0xce2a('0x37')];_0x44c0f2[_0xce2a('0x40')]=qs['sort'](_0x18a3ca['query']['sort']);_0x44c0f2[_0xce2a('0x44')]=qs[_0xce2a('0x3a')](_[_0xce2a('0x42')](_0x18a3ca[_0xce2a('0x39')],_0x38b6b9[_0xce2a('0x3a')]));if(_0x18a3ca['query'][_0xce2a('0x43')]){_0x44c0f2[_0xce2a('0x44')]=_[_0xce2a('0x45')](_0x44c0f2['where'],{'$or':_['map'](_0x44c0f2['attributes'],function(_0x4e9b8c){var _0x5a0b19={};_0x5a0b19[_0x4e9b8c]={'$like':'%'+_0x18a3ca[_0xce2a('0x39')][_0xce2a('0x43')]+'%'};return _0x5a0b19;})});}_0x44c0f2=_[_0xce2a('0x45')]({},_0x44c0f2,_0x18a3ca[_0xce2a('0x4e')]);return _0x20310a['getSubjects'](_0x44c0f2);}})['then'](function(_0x307441){if(_0x307441){_0x239855=_0x307441['length'];if(!_0x18a3ca[_0xce2a('0x39')][_0xce2a('0x57')](_0xce2a('0x3f'))){_0x44c0f2['limit']=qs[_0xce2a('0x29')](_0x18a3ca['query'][_0xce2a('0x29')]);_0x44c0f2[_0xce2a('0x28')]=qs[_0xce2a('0x28')](_0x18a3ca['query'][_0xce2a('0x28')]);}return _0x20310a[_0xce2a('0x58')](_0x44c0f2);}})[_0xce2a('0x2e')](function(_0xffb3de){if(_0xffb3de){return _0xffb3de?{'count':_0x239855,'rows':_0xffb3de}:null;}})[_0xce2a('0x2e')](respondWithResult(_0x22c7b0,null))[_0xce2a('0x50')](handleError(_0x22c7b0,null));};exports[_0xce2a('0x59')]=function(_0x3759bb,_0x2887d2,_0x1bfe23){var _0x35597c={};var _0x5cb2f3={};var _0x4e4f4a;var _0x48efdf;return db[_0xce2a('0x34')][_0xce2a('0x53')]({'where':{'id':_0x3759bb['params']['id']}})['then'](handleEntityNotFound(_0x2887d2,null))['then'](function(_0x1a8bd8){if(_0x1a8bd8){_0x4e4f4a=_0x1a8bd8;_0x5cb2f3[_0xce2a('0x37')]=_[_0xce2a('0x38')](db[_0xce2a('0x54')]['rawAttributes']);_0x5cb2f3[_0xce2a('0x39')]=_[_0xce2a('0x38')](_0x3759bb[_0xce2a('0x39')]);_0x5cb2f3[_0xce2a('0x3a')]=_[_0xce2a('0x3b')](_0x5cb2f3['model'],_0x5cb2f3['query']);_0x35597c[_0xce2a('0x3c')]=_['intersection'](_0x5cb2f3[_0xce2a('0x37')],qs['fields'](_0x3759bb['query'][_0xce2a('0x3d')]));_0x35597c[_0xce2a('0x3c')]=_0x35597c['attributes'][_0xce2a('0x3e')]?_0x35597c[_0xce2a('0x3c')]:_0x5cb2f3['model'];_0x35597c[_0xce2a('0x40')]=qs['sort'](_0x3759bb['query'][_0xce2a('0x41')]);_0x35597c['where']=qs[_0xce2a('0x3a')](_['pick'](_0x3759bb['query'],_0x5cb2f3[_0xce2a('0x3a')]));if(_0x3759bb['query'][_0xce2a('0x43')]){_0x35597c[_0xce2a('0x44')]=_['merge'](_0x35597c[_0xce2a('0x44')],{'$or':_['map'](_0x35597c[_0xce2a('0x3c')],function(_0x2d79ec){var _0x46fddd={};_0x46fddd[_0x2d79ec]={'$like':'%'+_0x3759bb[_0xce2a('0x39')][_0xce2a('0x43')]+'%'};return _0x46fddd;})});}_0x35597c=_['merge']({},_0x35597c,_0x3759bb[_0xce2a('0x4e')]);return _0x4e4f4a['getDescriptions'](_0x35597c);}})[_0xce2a('0x2e')](function(_0x63a6f8){if(_0x63a6f8){_0x48efdf=_0x63a6f8[_0xce2a('0x3e')];if(!_0x3759bb[_0xce2a('0x39')]['hasOwnProperty'](_0xce2a('0x3f'))){_0x35597c[_0xce2a('0x29')]=qs[_0xce2a('0x29')](_0x3759bb[_0xce2a('0x39')]['limit']);_0x35597c[_0xce2a('0x28')]=qs[_0xce2a('0x28')](_0x3759bb[_0xce2a('0x39')]['offset']);}return _0x4e4f4a[_0xce2a('0x59')](_0x35597c);}})['then'](function(_0x34cbcc){if(_0x34cbcc){return _0x34cbcc?{'count':_0x48efdf,'rows':_0x34cbcc}:null;}})[_0xce2a('0x2e')](respondWithResult(_0x2887d2,null))[_0xce2a('0x50')](handleError(_0x2887d2,null));}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.model.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.model.js index 1eb0e78..f771531 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 _0x5d1a=['bluebird','request-promise','path','rimraf','../../config/environment','exports','define','Dynamics365Configuration','int_dynamics365_configurations','lodash','../../config/logger','api','moment'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0x5d1a,0x7e));var _0xa5d1=function(_0x52f1e6,_0xf70489){_0x52f1e6=_0x52f1e6-0x0;var _0x21f104=_0x5d1a[_0x52f1e6];return _0x21f104;};'use strict';var _=require(_0xa5d1('0x0'));var util=require('util');var logger=require(_0xa5d1('0x1'))(_0xa5d1('0x2'));var moment=require(_0xa5d1('0x3'));var BPromise=require(_0xa5d1('0x4'));var rp=require(_0xa5d1('0x5'));var fs=require('fs');var path=require(_0xa5d1('0x6'));var rimraf=require(_0xa5d1('0x7'));var config=require(_0xa5d1('0x8'));var attributes=require('./intDynamics365Configuration.attributes');module[_0xa5d1('0x9')]=function(_0x5dafd9,_0x25e8f0){return _0x5dafd9[_0xa5d1('0xa')](_0xa5d1('0xb'),attributes,{'tableName':_0xa5d1('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf7d7=['int_dynamics365_configurations','lodash','../../config/logger','moment','bluebird','request-promise','rimraf','../../config/environment','./intDynamics365Configuration.attributes'];(function(_0x40c656,_0x27b0fa){var _0x553a28=function(_0x49ce84){while(--_0x49ce84){_0x40c656['push'](_0x40c656['shift']());}};_0x553a28(++_0x27b0fa);}(_0xf7d7,0x160));var _0x7f7d=function(_0x1969a7,_0x5a133a){_0x1969a7=_0x1969a7-0x0;var _0x3d665f=_0xf7d7[_0x1969a7];return _0x3d665f;};'use strict';var _=require(_0x7f7d('0x0'));var util=require('util');var logger=require(_0x7f7d('0x1'))('api');var moment=require(_0x7f7d('0x2'));var BPromise=require(_0x7f7d('0x3'));var rp=require(_0x7f7d('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x7f7d('0x5'));var config=require(_0x7f7d('0x6'));var attributes=require(_0x7f7d('0x7'));module['exports']=function(_0x3389b9,_0x10052b){return _0x3389b9['define']('Dynamics365Configuration',attributes,{'tableName':_0x7f7d('0x8'),'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 5788085..0ed26d5 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 _0x9e7e=['rpc','../../config/environment','jayson/promise','http','request','info','Dynamics365Configuration,\x20%s,\x20%s','debug','request\x20sent','stringify','error','message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x3db97b,_0x3fdb22){var _0x362c74=function(_0xf56b){while(--_0xf56b){_0x3db97b['push'](_0x3db97b['shift']());}};_0x362c74(++_0x3fdb22);}(_0x9e7e,0x16d));var _0xe9e7=function(_0x205e5b,_0x3d9293){_0x205e5b=_0x205e5b-0x0;var _0x2e60db=_0x9e7e[_0x205e5b];return _0x2e60db;};'use strict';var _=require(_0xe9e7('0x0'));var util=require(_0xe9e7('0x1'));var moment=require(_0xe9e7('0x2'));var BPromise=require(_0xe9e7('0x3'));var rs=require(_0xe9e7('0x4'));var fs=require('fs');var Redis=require(_0xe9e7('0x5'));var db=require(_0xe9e7('0x6'))['db'];var utils=require(_0xe9e7('0x7'));var logger=require(_0xe9e7('0x8'))(_0xe9e7('0x9'));var config=require(_0xe9e7('0xa'));var jayson=require(_0xe9e7('0xb'));var client=jayson['client'][_0xe9e7('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x4cac51,_0x217b23,_0x5f1c9b){return new BPromise(function(_0x4ad0bf,_0xd79c8b){return client[_0xe9e7('0xd')](_0x4cac51,_0x5f1c9b)['then'](function(_0x4d14c5){logger[_0xe9e7('0xe')](_0xe9e7('0xf'),_0x217b23,'request\x20sent');logger[_0xe9e7('0x10')]('Dynamics365Configuration,\x20%s,\x20%s,\x20%s',_0x217b23,_0xe9e7('0x11'),JSON[_0xe9e7('0x12')](_0x4d14c5));if(_0x4d14c5['error']){if(_0x4d14c5[_0xe9e7('0x13')]['code']===0x1f4){logger[_0xe9e7('0x13')](_0xe9e7('0xf'),_0x217b23,_0x4d14c5[_0xe9e7('0x13')][_0xe9e7('0x14')]);return _0xd79c8b(_0x4d14c5[_0xe9e7('0x13')][_0xe9e7('0x14')]);}logger[_0xe9e7('0x13')](_0xe9e7('0xf'),_0x217b23,_0x4d14c5[_0xe9e7('0x13')][_0xe9e7('0x14')]);return _0x4ad0bf(_0x4d14c5[_0xe9e7('0x13')][_0xe9e7('0x14')]);}else{logger[_0xe9e7('0xe')](_0xe9e7('0xf'),_0x217b23,_0xe9e7('0x11'));_0x4ad0bf(_0x4d14c5['result'][_0xe9e7('0x14')]);}})[_0xe9e7('0x15')](function(_0x1c2433){logger[_0xe9e7('0x13')](_0xe9e7('0xf'),_0x217b23,_0x1c2433);_0xd79c8b(_0x1c2433);});});} \ No newline at end of file +var _0x346b=['../../config/logger','rpc','../../config/environment','client','then','info','debug','Dynamics365Configuration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','Dynamics365Configuration,\x20%s,\x20%s','message','result','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils'];(function(_0xb5a7ae,_0xafd8c7){var _0x326866=function(_0x3d18ee){while(--_0x3d18ee){_0xb5a7ae['push'](_0xb5a7ae['shift']());}};_0x326866(++_0xafd8c7);}(_0x346b,0xa9));var _0xb346=function(_0x792447,_0x33dd2d){_0x792447=_0x792447-0x0;var _0x332fa7=_0x346b[_0x792447];return _0x332fa7;};'use strict';var _=require(_0xb346('0x0'));var util=require(_0xb346('0x1'));var moment=require(_0xb346('0x2'));var BPromise=require(_0xb346('0x3'));var rs=require(_0xb346('0x4'));var fs=require('fs');var Redis=require(_0xb346('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xb346('0x6'));var logger=require(_0xb346('0x7'))(_0xb346('0x8'));var config=require(_0xb346('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xb346('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x289cb4,_0x400dfb,_0x53e92d){return new BPromise(function(_0x28cdeb,_0x3a87c9){return client['request'](_0x289cb4,_0x53e92d)[_0xb346('0xb')](function(_0x45f000){logger[_0xb346('0xc')]('Dynamics365Configuration,\x20%s,\x20%s',_0x400dfb,'request\x20sent');logger[_0xb346('0xd')](_0xb346('0xe'),_0x400dfb,_0xb346('0xf'),JSON[_0xb346('0x10')](_0x45f000));if(_0x45f000[_0xb346('0x11')]){if(_0x45f000[_0xb346('0x11')][_0xb346('0x12')]===0x1f4){logger[_0xb346('0x11')](_0xb346('0x13'),_0x400dfb,_0x45f000['error'][_0xb346('0x14')]);return _0x3a87c9(_0x45f000[_0xb346('0x11')][_0xb346('0x14')]);}logger[_0xb346('0x11')](_0xb346('0x13'),_0x400dfb,_0x45f000[_0xb346('0x11')][_0xb346('0x14')]);return _0x28cdeb(_0x45f000['error']['message']);}else{logger[_0xb346('0xc')]('Dynamics365Configuration,\x20%s,\x20%s',_0x400dfb,'request\x20sent');_0x28cdeb(_0x45f000[_0xb346('0x15')]['message']);}})['catch'](function(_0x552aa0){logger[_0xb346('0x11')](_0xb346('0x13'),_0x400dfb,_0x552aa0);_0x3a87c9(_0x552aa0);});});} \ No newline at end of file diff --git a/server/api/intDynamics365Field/index.js b/server/api/intDynamics365Field/index.js index 3be1436..56c9fa7 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 _0xbe02=['/:id','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDynamics365Field.controller','get','isAuthenticated','index','show','post','create','put'];(function(_0xb3b452,_0x582e8e){var _0x238983=function(_0x3bc866){while(--_0x3bc866){_0xb3b452['push'](_0xb3b452['shift']());}};_0x238983(++_0x582e8e);}(_0xbe02,0x146));var _0x2be0=function(_0x3bb949,_0x3caa7a){_0x3bb949=_0x3bb949-0x0;var _0x421bb7=_0xbe02[_0x3bb949];return _0x421bb7;};'use strict';var multer=require(_0x2be0('0x0'));var util=require(_0x2be0('0x1'));var path=require(_0x2be0('0x2'));var timeout=require(_0x2be0('0x3'));var express=require('express');var router=express[_0x2be0('0x4')]();var auth=require(_0x2be0('0x5'));var interaction=require(_0x2be0('0x6'));var config=require(_0x2be0('0x7'));var controller=require(_0x2be0('0x8'));router[_0x2be0('0x9')]('/',auth[_0x2be0('0xa')](),controller[_0x2be0('0xb')]);router[_0x2be0('0x9')]('/:id',auth['isAuthenticated'](),controller[_0x2be0('0xc')]);router[_0x2be0('0xd')]('/',auth[_0x2be0('0xa')](),controller[_0x2be0('0xe')]);router[_0x2be0('0xf')](_0x2be0('0x10'),auth['isAuthenticated'](),controller['update']);router['delete']('/:id',auth['isAuthenticated'](),controller['destroy']);module[_0x2be0('0x11')]=router; \ No newline at end of file +var _0x24cd=['create','update','delete','destroy','exports','multer','util','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','./intDynamics365Field.controller','get','index','/:id','isAuthenticated','show','post'];(function(_0x2e7ad1,_0x576131){var _0x30b661=function(_0x1e5f6b){while(--_0x1e5f6b){_0x2e7ad1['push'](_0x2e7ad1['shift']());}};_0x30b661(++_0x576131);}(_0x24cd,0x83));var _0xd24c=function(_0x5ebbfd,_0x44dc4b){_0x5ebbfd=_0x5ebbfd-0x0;var _0x576a7a=_0x24cd[_0x5ebbfd];return _0x576a7a;};'use strict';var multer=require(_0xd24c('0x0'));var util=require(_0xd24c('0x1'));var path=require('path');var timeout=require(_0xd24c('0x2'));var express=require('express');var router=express[_0xd24c('0x3')]();var auth=require(_0xd24c('0x4'));var interaction=require(_0xd24c('0x5'));var config=require('../../config/environment');var controller=require(_0xd24c('0x6'));router[_0xd24c('0x7')]('/',auth['isAuthenticated'](),controller[_0xd24c('0x8')]);router[_0xd24c('0x7')](_0xd24c('0x9'),auth[_0xd24c('0xa')](),controller[_0xd24c('0xb')]);router[_0xd24c('0xc')]('/',auth[_0xd24c('0xa')](),controller[_0xd24c('0xd')]);router['put']('/:id',auth[_0xd24c('0xa')](),controller[_0xd24c('0xe')]);router[_0xd24c('0xf')](_0xd24c('0x9'),auth[_0xd24c('0xa')](),controller[_0xd24c('0x10')]);module[_0xd24c('0x11')]=router; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.attributes.js b/server/api/intDynamics365Field/intDynamics365Field.attributes.js index e21c297..090158f 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 _0xb7e9=['keyValue','STRING','variable','BOOLEAN','sequelize','exports','ENUM','string','customVariable'];(function(_0x5ba9d2,_0x802c3c){var _0x151e37=function(_0x5dc950){while(--_0x5dc950){_0x5ba9d2['push'](_0x5ba9d2['shift']());}};_0x151e37(++_0x802c3c);}(_0xb7e9,0x67));var _0x9b7e=function(_0x4c82af,_0x5ca362){_0x4c82af=_0x4c82af-0x0;var _0x260354=_0xb7e9[_0x4c82af];return _0x260354;};'use strict';var Sequelize=require(_0x9b7e('0x0'));module[_0x9b7e('0x1')]={'type':{'type':Sequelize[_0x9b7e('0x2')](_0x9b7e('0x3'),'variable',_0x9b7e('0x4'),_0x9b7e('0x5')),'defaultValue':'string'},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0x9b7e('0x6')]},'keyType':{'type':Sequelize['ENUM'](_0x9b7e('0x3'),_0x9b7e('0x7'),_0x9b7e('0x4'))},'keyContent':{'type':Sequelize[_0x9b7e('0x6')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0x9b7e('0x6')]},'customField':{'type':Sequelize[_0x9b7e('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x9b7e('0x6')]}}; \ No newline at end of file +var _0x0726=['BOOLEAN','sequelize','exports','ENUM','variable','customVariable','string','STRING'];(function(_0x2542a4,_0x3bd718){var _0x50e701=function(_0xeb3dd3){while(--_0xeb3dd3){_0x2542a4['push'](_0x2542a4['shift']());}};_0x50e701(++_0x3bd718);}(_0x0726,0x131));var _0x6072=function(_0x1bf953,_0x35a003){_0x1bf953=_0x1bf953-0x0;var _0x36c284=_0x0726[_0x1bf953];return _0x36c284;};'use strict';var Sequelize=require(_0x6072('0x0'));module[_0x6072('0x1')]={'type':{'type':Sequelize[_0x6072('0x2')]('string',_0x6072('0x3'),_0x6072('0x4'),'keyValue'),'defaultValue':_0x6072('0x5')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0x6072('0x2')]('string','variable',_0x6072('0x4'))},'keyContent':{'type':Sequelize[_0x6072('0x6')]},'idField':{'type':Sequelize[_0x6072('0x6')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0x6072('0x7')],'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 0ca80b7..b29df99 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 _0x11f7=['include','findAll','rows','catch','params','find','create','body','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','ejs','lodash','crypto','jsforce','desk.js','to-csv','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/environment','../../mysqldb','sendStatus','end','status','json','offset','set','Content-Range','apply','reject','update','then','destroy','error','name','send','index','Dynamics365Field','rawAttributes','fieldName','type','key','map','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','merge','VIRTUAL','filter','count','includeAll'];(function(_0x3933cf,_0x4e07b3){var _0x46e6c9=function(_0xc69c9c){while(--_0xc69c9c){_0x3933cf['push'](_0x3933cf['shift']());}};_0x46e6c9(++_0x4e07b3);}(_0x11f7,0xda));var _0x711f=function(_0x32e82a,_0x588a72){_0x32e82a=_0x32e82a-0x0;var _0x33841d=_0x11f7[_0x32e82a];return _0x33841d;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x711f('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x711f('0x1'));var jsonpatch=require(_0x711f('0x2'));var rp=require(_0x711f('0x3'));var moment=require('moment');var BPromise=require(_0x711f('0x4'));var Mustache=require(_0x711f('0x5'));var util=require('util');var path=require(_0x711f('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x711f('0x7'));var fs=require('fs');var _=require(_0x711f('0x8'));var squel=require('squel');var crypto=require(_0x711f('0x9'));var jsforce=require(_0x711f('0xa'));var deskjs=require(_0x711f('0xb'));var toCsv=require(_0x711f('0xc'));var querystring=require(_0x711f('0xd'));var Papa=require('papaparse');var Redis=require(_0x711f('0xe'));var authService=require('../../components/auth/service');var qs=require(_0x711f('0xf'));var as=require(_0x711f('0x10'));var hardwareService=require(_0x711f('0x11'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0x711f('0x12'));var db=require(_0x711f('0x13'))['db'];function respondWithStatusCode(_0x2a9872,_0x30af98){_0x30af98=_0x30af98||0xcc;return function(_0x1bf550){if(_0x1bf550){return _0x2a9872[_0x711f('0x14')](_0x30af98);}return _0x2a9872['status'](_0x30af98)[_0x711f('0x15')]();};}function respondWithResult(_0x5f5d97,_0x3d7d07){_0x3d7d07=_0x3d7d07||0xc8;return function(_0x2cad23){if(_0x2cad23){return _0x5f5d97[_0x711f('0x16')](_0x3d7d07)[_0x711f('0x17')](_0x2cad23);}};}function respondWithFilteredResult(_0x540dc8,_0x3580cc){return function(_0x3e4216){if(_0x3e4216){var _0x49a9d2=_0x3e4216['count'],_0x619787=_0x3580cc['offset'],_0x2f0928=_0x3580cc[_0x711f('0x18')]+_0x3580cc['limit'],_0x21f474;if(_0x2f0928>=_0x49a9d2){_0x2f0928=_0x49a9d2;_0x21f474=0xc8;}else{_0x21f474=0xce;}_0x540dc8['status'](_0x21f474);return _0x540dc8[_0x711f('0x19')](_0x711f('0x1a'),_0x619787+'-'+_0x2f0928+'/'+_0x49a9d2)[_0x711f('0x17')](_0x3e4216);}return null;};}function patchUpdates(_0x2b56cd){return function(_0x459a0d){try{jsonpatch[_0x711f('0x1b')](_0x459a0d,_0x2b56cd,!![]);}catch(_0x9b2ba2){return BPromise[_0x711f('0x1c')](_0x9b2ba2);}return _0x459a0d['save']();};}function saveUpdates(_0x44fb1a,_0x331ee3){return function(_0x1f384b){if(_0x1f384b){return _0x1f384b[_0x711f('0x1d')](_0x44fb1a)[_0x711f('0x1e')](function(_0x544f37){return _0x544f37;});}return null;};}function removeEntity(_0x20c83d,_0xccdd66){return function(_0x34914e){if(_0x34914e){return _0x34914e[_0x711f('0x1f')]()[_0x711f('0x1e')](function(){_0x20c83d[_0x711f('0x16')](0xcc)[_0x711f('0x15')]();});}};}function handleEntityNotFound(_0x378bd4,_0x59ed0c){return function(_0x590b0d){if(!_0x590b0d){_0x378bd4[_0x711f('0x14')](0x194);}return _0x590b0d;};}function handleError(_0x21b694,_0x3723bf){_0x3723bf=_0x3723bf||0x1f4;return function(_0x3c9dbd){logger[_0x711f('0x20')](_0x3c9dbd['stack']);if(_0x3c9dbd['name']){delete _0x3c9dbd[_0x711f('0x21')];}_0x21b694['status'](_0x3723bf)[_0x711f('0x22')](_0x3c9dbd);};}exports[_0x711f('0x23')]=function(_0x31a25b,_0x227f69){var _0x291687={},_0xa03171={},_0x4e7247={'count':0x0,'rows':[]};var _0x474040=_['map'](db[_0x711f('0x24')][_0x711f('0x25')],function(_0x531f36){return{'name':_0x531f36[_0x711f('0x26')],'type':_0x531f36[_0x711f('0x27')][_0x711f('0x28')]};});_0xa03171['model']=_[_0x711f('0x29')](_0x474040,'name');_0xa03171[_0x711f('0x2a')]=_[_0x711f('0x2b')](_0x31a25b[_0x711f('0x2a')]);_0xa03171[_0x711f('0x2c')]=_[_0x711f('0x2d')](_0xa03171[_0x711f('0x2e')],_0xa03171[_0x711f('0x2a')]);_0x291687[_0x711f('0x2f')]=_[_0x711f('0x2d')](_0xa03171['model'],qs[_0x711f('0x30')](_0x31a25b[_0x711f('0x2a')][_0x711f('0x30')]));_0x291687['attributes']=_0x291687[_0x711f('0x2f')][_0x711f('0x31')]?_0x291687[_0x711f('0x2f')]:_0xa03171['model'];if(!_0x31a25b['query'][_0x711f('0x32')](_0x711f('0x33'))){_0x291687[_0x711f('0x34')]=qs[_0x711f('0x34')](_0x31a25b[_0x711f('0x2a')][_0x711f('0x34')]);_0x291687[_0x711f('0x18')]=qs[_0x711f('0x18')](_0x31a25b['query'][_0x711f('0x18')]);}_0x291687[_0x711f('0x35')]=qs['sort'](_0x31a25b[_0x711f('0x2a')][_0x711f('0x36')]);_0x291687[_0x711f('0x37')]=qs[_0x711f('0x2c')](_[_0x711f('0x38')](_0x31a25b['query'],_0xa03171['filters']),_0x474040);if(_0x31a25b[_0x711f('0x2a')]['filter']){_0x291687[_0x711f('0x37')]=_[_0x711f('0x39')](_0x291687['where'],{'$or':_[_0x711f('0x29')](_0x474040,function(_0x442db4){if(_0x442db4[_0x711f('0x27')]!==_0x711f('0x3a')){var _0x2d61dd={};_0x2d61dd[_0x442db4[_0x711f('0x21')]]={'$like':'%'+_0x31a25b[_0x711f('0x2a')][_0x711f('0x3b')]+'%'};return _0x2d61dd;}})});}_0x291687=_['merge']({},_0x291687,_0x31a25b['options']);var _0x2c67a1={'where':_0x291687[_0x711f('0x37')]};return db['Dynamics365Field'][_0x711f('0x3c')](_0x2c67a1)[_0x711f('0x1e')](function(_0x1c8c13){_0x4e7247[_0x711f('0x3c')]=_0x1c8c13;if(_0x31a25b['query'][_0x711f('0x3d')]){_0x291687[_0x711f('0x3e')]=[{'all':!![]}];}return db[_0x711f('0x24')][_0x711f('0x3f')](_0x291687);})['then'](function(_0x1a698e){_0x4e7247[_0x711f('0x40')]=_0x1a698e;return _0x4e7247;})['then'](respondWithFilteredResult(_0x227f69,_0x291687))[_0x711f('0x41')](handleError(_0x227f69,null));};exports['show']=function(_0x574efe,_0x4c6e31){var _0x147d03={'raw':!![],'where':{'id':_0x574efe[_0x711f('0x42')]['id']}},_0x590e70={};_0x590e70['model']=_['keys'](db['Dynamics365Field'][_0x711f('0x25')]);_0x590e70['query']=_[_0x711f('0x2b')](_0x574efe[_0x711f('0x2a')]);_0x590e70[_0x711f('0x2c')]=_[_0x711f('0x2d')](_0x590e70['model'],_0x590e70['query']);_0x147d03['attributes']=_[_0x711f('0x2d')](_0x590e70['model'],qs[_0x711f('0x30')](_0x574efe[_0x711f('0x2a')][_0x711f('0x30')]));_0x147d03['attributes']=_0x147d03[_0x711f('0x2f')][_0x711f('0x31')]?_0x147d03[_0x711f('0x2f')]:_0x590e70['model'];if(_0x574efe[_0x711f('0x2a')][_0x711f('0x3d')]){_0x147d03[_0x711f('0x3e')]=[{'all':!![]}];}_0x147d03=_[_0x711f('0x39')]({},_0x147d03,_0x574efe['options']);return db[_0x711f('0x24')][_0x711f('0x43')](_0x147d03)[_0x711f('0x1e')](handleEntityNotFound(_0x4c6e31,null))[_0x711f('0x1e')](respondWithResult(_0x4c6e31,null))[_0x711f('0x41')](handleError(_0x4c6e31,null));};exports[_0x711f('0x44')]=function(_0x462096,_0x55255a){return db[_0x711f('0x24')][_0x711f('0x44')](_0x462096['body'],{})[_0x711f('0x1e')](respondWithResult(_0x55255a,0xc9))[_0x711f('0x41')](handleError(_0x55255a,null));};exports[_0x711f('0x1d')]=function(_0x3bcc5c,_0x4049c4){if(_0x3bcc5c[_0x711f('0x45')]['id']){delete _0x3bcc5c[_0x711f('0x45')]['id'];}return db[_0x711f('0x24')][_0x711f('0x43')]({'where':{'id':_0x3bcc5c[_0x711f('0x42')]['id']}})[_0x711f('0x1e')](handleEntityNotFound(_0x4049c4,null))[_0x711f('0x1e')](saveUpdates(_0x3bcc5c['body'],null))['then'](respondWithResult(_0x4049c4,null))[_0x711f('0x41')](handleError(_0x4049c4,null));};exports[_0x711f('0x1f')]=function(_0xb855d,_0x55bdc4){return db[_0x711f('0x24')]['find']({'where':{'id':_0xb855d[_0x711f('0x42')]['id']}})['then'](handleEntityNotFound(_0x55bdc4,null))[_0x711f('0x1e')](removeEntity(_0x55bdc4,null))[_0x711f('0x41')](handleError(_0x55bdc4,null));}; \ No newline at end of file +var _0x616c=['intersection','attributes','hasOwnProperty','nolimit','sort','pick','filter','where','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','show','params','rawAttributes','fields','find','create','body','destroy','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','path','sox','to-csv','ejs','lodash','squel','desk.js','papaparse','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/environment','sendStatus','status','json','count','offset','limit','set','Content-Range','apply','save','update','then','end','error','stack','name','send','Dynamics365Field','fieldName','type','key','model','map','query','keys','filters'];(function(_0x316cc8,_0xe51797){var _0x143cd5=function(_0x6c99b9){while(--_0x6c99b9){_0x316cc8['push'](_0x316cc8['shift']());}};_0x143cd5(++_0xe51797);}(_0x616c,0x1b6));var _0xc616=function(_0x22daae,_0x44e3d2){_0x22daae=_0x22daae-0x0;var _0x17a413=_0x616c[_0x22daae];return _0x17a413;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xc616('0x0'));var rimraf=require(_0xc616('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xc616('0x2'));var rp=require(_0xc616('0x3'));var moment=require(_0xc616('0x4'));var BPromise=require(_0xc616('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0xc616('0x6'));var sox=require(_0xc616('0x7'));var csv=require(_0xc616('0x8'));var ejs=require(_0xc616('0x9'));var fs=require('fs');var _=require(_0xc616('0xa'));var squel=require(_0xc616('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xc616('0xc'));var toCsv=require(_0xc616('0x8'));var querystring=require('querystring');var Papa=require(_0xc616('0xd'));var Redis=require('ioredis');var authService=require(_0xc616('0xe'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xc616('0xf'));var logger=require(_0xc616('0x10'))(_0xc616('0x11'));var utils=require('../../config/utils');var config=require(_0xc616('0x12'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2266e7,_0xb8de2a){_0xb8de2a=_0xb8de2a||0xcc;return function(_0x1fb7a1){if(_0x1fb7a1){return _0x2266e7[_0xc616('0x13')](_0xb8de2a);}return _0x2266e7[_0xc616('0x14')](_0xb8de2a)['end']();};}function respondWithResult(_0x242ee5,_0x5e1993){_0x5e1993=_0x5e1993||0xc8;return function(_0x17e829){if(_0x17e829){return _0x242ee5[_0xc616('0x14')](_0x5e1993)[_0xc616('0x15')](_0x17e829);}};}function respondWithFilteredResult(_0xc013d7,_0x3c0307){return function(_0x5a5393){if(_0x5a5393){var _0xa07335=_0x5a5393[_0xc616('0x16')],_0x1738ff=_0x3c0307[_0xc616('0x17')],_0x3ace46=_0x3c0307['offset']+_0x3c0307[_0xc616('0x18')],_0x739a74;if(_0x3ace46>=_0xa07335){_0x3ace46=_0xa07335;_0x739a74=0xc8;}else{_0x739a74=0xce;}_0xc013d7['status'](_0x739a74);return _0xc013d7[_0xc616('0x19')](_0xc616('0x1a'),_0x1738ff+'-'+_0x3ace46+'/'+_0xa07335)[_0xc616('0x15')](_0x5a5393);}return null;};}function patchUpdates(_0x3ebe9c){return function(_0x51c773){try{jsonpatch[_0xc616('0x1b')](_0x51c773,_0x3ebe9c,!![]);}catch(_0x5809ca){return BPromise['reject'](_0x5809ca);}return _0x51c773[_0xc616('0x1c')]();};}function saveUpdates(_0x28710a,_0x4756e4){return function(_0xf51b1c){if(_0xf51b1c){return _0xf51b1c[_0xc616('0x1d')](_0x28710a)[_0xc616('0x1e')](function(_0x2a7506){return _0x2a7506;});}return null;};}function removeEntity(_0x35a024,_0x1ae9da){return function(_0x461e40){if(_0x461e40){return _0x461e40['destroy']()[_0xc616('0x1e')](function(){_0x35a024['status'](0xcc)[_0xc616('0x1f')]();});}};}function handleEntityNotFound(_0x1696b5,_0x1828f3){return function(_0x229cbd){if(!_0x229cbd){_0x1696b5['sendStatus'](0x194);}return _0x229cbd;};}function handleError(_0x3cff52,_0x10b121){_0x10b121=_0x10b121||0x1f4;return function(_0xe4a1cd){logger[_0xc616('0x20')](_0xe4a1cd[_0xc616('0x21')]);if(_0xe4a1cd['name']){delete _0xe4a1cd[_0xc616('0x22')];}_0x3cff52['status'](_0x10b121)[_0xc616('0x23')](_0xe4a1cd);};}exports['index']=function(_0x246a98,_0x44c71a){var _0x4e18d1={},_0x455eb0={},_0x26df5a={'count':0x0,'rows':[]};var _0x45a71e=_['map'](db[_0xc616('0x24')]['rawAttributes'],function(_0xb1e98a){return{'name':_0xb1e98a[_0xc616('0x25')],'type':_0xb1e98a[_0xc616('0x26')][_0xc616('0x27')]};});_0x455eb0[_0xc616('0x28')]=_[_0xc616('0x29')](_0x45a71e,_0xc616('0x22'));_0x455eb0[_0xc616('0x2a')]=_[_0xc616('0x2b')](_0x246a98['query']);_0x455eb0[_0xc616('0x2c')]=_[_0xc616('0x2d')](_0x455eb0['model'],_0x455eb0[_0xc616('0x2a')]);_0x4e18d1[_0xc616('0x2e')]=_[_0xc616('0x2d')](_0x455eb0[_0xc616('0x28')],qs['fields'](_0x246a98[_0xc616('0x2a')]['fields']));_0x4e18d1['attributes']=_0x4e18d1['attributes']['length']?_0x4e18d1[_0xc616('0x2e')]:_0x455eb0[_0xc616('0x28')];if(!_0x246a98[_0xc616('0x2a')][_0xc616('0x2f')](_0xc616('0x30'))){_0x4e18d1[_0xc616('0x18')]=qs[_0xc616('0x18')](_0x246a98[_0xc616('0x2a')][_0xc616('0x18')]);_0x4e18d1[_0xc616('0x17')]=qs[_0xc616('0x17')](_0x246a98[_0xc616('0x2a')][_0xc616('0x17')]);}_0x4e18d1['order']=qs['sort'](_0x246a98[_0xc616('0x2a')][_0xc616('0x31')]);_0x4e18d1['where']=qs['filters'](_[_0xc616('0x32')](_0x246a98['query'],_0x455eb0['filters']),_0x45a71e);if(_0x246a98['query'][_0xc616('0x33')]){_0x4e18d1[_0xc616('0x34')]=_['merge'](_0x4e18d1['where'],{'$or':_[_0xc616('0x29')](_0x45a71e,function(_0xfcc75){if(_0xfcc75[_0xc616('0x26')]!==_0xc616('0x35')){var _0x4e7a46={};_0x4e7a46[_0xfcc75[_0xc616('0x22')]]={'$like':'%'+_0x246a98[_0xc616('0x2a')]['filter']+'%'};return _0x4e7a46;}})});}_0x4e18d1=_[_0xc616('0x36')]({},_0x4e18d1,_0x246a98[_0xc616('0x37')]);var _0x3e4bc3={'where':_0x4e18d1['where']};return db[_0xc616('0x24')][_0xc616('0x16')](_0x3e4bc3)[_0xc616('0x1e')](function(_0x162280){_0x26df5a[_0xc616('0x16')]=_0x162280;if(_0x246a98[_0xc616('0x2a')][_0xc616('0x38')]){_0x4e18d1[_0xc616('0x39')]=[{'all':!![]}];}return db[_0xc616('0x24')][_0xc616('0x3a')](_0x4e18d1);})[_0xc616('0x1e')](function(_0x2c2638){_0x26df5a[_0xc616('0x3b')]=_0x2c2638;return _0x26df5a;})[_0xc616('0x1e')](respondWithFilteredResult(_0x44c71a,_0x4e18d1))[_0xc616('0x3c')](handleError(_0x44c71a,null));};exports[_0xc616('0x3d')]=function(_0x5194a6,_0x50b701){var _0x3e4ff1={'raw':!![],'where':{'id':_0x5194a6[_0xc616('0x3e')]['id']}},_0x4440a2={};_0x4440a2[_0xc616('0x28')]=_[_0xc616('0x2b')](db[_0xc616('0x24')][_0xc616('0x3f')]);_0x4440a2[_0xc616('0x2a')]=_[_0xc616('0x2b')](_0x5194a6[_0xc616('0x2a')]);_0x4440a2[_0xc616('0x2c')]=_['intersection'](_0x4440a2[_0xc616('0x28')],_0x4440a2[_0xc616('0x2a')]);_0x3e4ff1['attributes']=_[_0xc616('0x2d')](_0x4440a2[_0xc616('0x28')],qs[_0xc616('0x40')](_0x5194a6[_0xc616('0x2a')][_0xc616('0x40')]));_0x3e4ff1[_0xc616('0x2e')]=_0x3e4ff1['attributes']['length']?_0x3e4ff1[_0xc616('0x2e')]:_0x4440a2[_0xc616('0x28')];if(_0x5194a6[_0xc616('0x2a')]['includeAll']){_0x3e4ff1[_0xc616('0x39')]=[{'all':!![]}];}_0x3e4ff1=_[_0xc616('0x36')]({},_0x3e4ff1,_0x5194a6['options']);return db['Dynamics365Field'][_0xc616('0x41')](_0x3e4ff1)[_0xc616('0x1e')](handleEntityNotFound(_0x50b701,null))[_0xc616('0x1e')](respondWithResult(_0x50b701,null))['catch'](handleError(_0x50b701,null));};exports[_0xc616('0x42')]=function(_0x3c0fc0,_0xbbb8bd){return db['Dynamics365Field']['create'](_0x3c0fc0['body'],{})['then'](respondWithResult(_0xbbb8bd,0xc9))[_0xc616('0x3c')](handleError(_0xbbb8bd,null));};exports[_0xc616('0x1d')]=function(_0x42193c,_0x54fff1){if(_0x42193c[_0xc616('0x43')]['id']){delete _0x42193c['body']['id'];}return db['Dynamics365Field'][_0xc616('0x41')]({'where':{'id':_0x42193c[_0xc616('0x3e')]['id']}})['then'](handleEntityNotFound(_0x54fff1,null))[_0xc616('0x1e')](saveUpdates(_0x42193c[_0xc616('0x43')],null))[_0xc616('0x1e')](respondWithResult(_0x54fff1,null))[_0xc616('0x3c')](handleError(_0x54fff1,null));};exports[_0xc616('0x44')]=function(_0x4e3281,_0x2fd069){return db[_0xc616('0x24')][_0xc616('0x41')]({'where':{'id':_0x4e3281[_0xc616('0x3e')]['id']}})['then'](handleEntityNotFound(_0x2fd069,null))[_0xc616('0x1e')](removeEntity(_0x2fd069,null))[_0xc616('0x3c')](handleError(_0x2fd069,null));}; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.model.js b/server/api/intDynamics365Field/intDynamics365Field.model.js index 90ecb6d..f076e87 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 _0xad73=['moment','bluebird','request-promise','rimraf','../../config/environment','./intDynamics365Field.attributes','exports','define','int_dynamics365_fields','dynamics365_unique_index','idField','FieldId','lodash','util','../../config/logger','api'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0xad73,0x1ac));var _0x3ad7=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xad73[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x3ad7('0x0'));var util=require(_0x3ad7('0x1'));var logger=require(_0x3ad7('0x2'))(_0x3ad7('0x3'));var moment=require(_0x3ad7('0x4'));var BPromise=require(_0x3ad7('0x5'));var rp=require(_0x3ad7('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x3ad7('0x7'));var config=require(_0x3ad7('0x8'));var attributes=require(_0x3ad7('0x9'));module[_0x3ad7('0xa')]=function(_0x582ea1,_0x2ad6fd){return _0x582ea1[_0x3ad7('0xb')]('Dynamics365Field',attributes,{'tableName':_0x3ad7('0xc'),'paranoid':![],'indexes':[{'name':_0x3ad7('0xd'),'fields':[_0x3ad7('0xe'),_0x3ad7('0xf')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x72d6=['int_dynamics365_fields','dynamics365_unique_index','idField','util','../../config/logger','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','Dynamics365Field'];(function(_0x4436c1,_0x4e15a7){var _0x2ae479=function(_0x29c431){while(--_0x29c431){_0x4436c1['push'](_0x4436c1['shift']());}};_0x2ae479(++_0x4e15a7);}(_0x72d6,0x12e));var _0x672d=function(_0x4b0114,_0x1c3c3b){_0x4b0114=_0x4b0114-0x0;var _0x32dab9=_0x72d6[_0x4b0114];return _0x32dab9;};'use strict';var _=require('lodash');var util=require(_0x672d('0x0'));var logger=require(_0x672d('0x1'))('api');var moment=require('moment');var BPromise=require(_0x672d('0x2'));var rp=require(_0x672d('0x3'));var fs=require('fs');var path=require(_0x672d('0x4'));var rimraf=require(_0x672d('0x5'));var config=require(_0x672d('0x6'));var attributes=require('./intDynamics365Field.attributes');module[_0x672d('0x7')]=function(_0x2fb2d1,_0x265f6a){return _0x2fb2d1[_0x672d('0x8')](_0x672d('0x9'),attributes,{'tableName':_0x672d('0xa'),'paranoid':![],'indexes':[{'name':_0x672d('0xb'),'fields':[_0x672d('0xc'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.rpc.js b/server/api/intDynamics365Field/intDynamics365Field.rpc.js index 54c1fe0..5d739d6 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 _0xfdcd=['debug','Dynamics365Field,\x20%s,\x20%s,\x20%s','stringify','code','error','message','result','catch','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','Dynamics365Field,\x20%s,\x20%s','request\x20sent'];(function(_0xd0cd54,_0x613e58){var _0x5f3f4f=function(_0x4fb920){while(--_0x4fb920){_0xd0cd54['push'](_0xd0cd54['shift']());}};_0x5f3f4f(++_0x613e58);}(_0xfdcd,0xe9));var _0xdfdc=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xfdcd[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require(_0xdfdc('0x0'));var moment=require(_0xdfdc('0x1'));var BPromise=require(_0xdfdc('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xdfdc('0x3'));var db=require(_0xdfdc('0x4'))['db'];var utils=require(_0xdfdc('0x5'));var logger=require(_0xdfdc('0x6'))(_0xdfdc('0x7'));var config=require(_0xdfdc('0x8'));var jayson=require(_0xdfdc('0x9'));var client=jayson[_0xdfdc('0xa')][_0xdfdc('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1f2529,_0x13ab53,_0x18691e){return new BPromise(function(_0xf45350,_0x580fc7){return client[_0xdfdc('0xc')](_0x1f2529,_0x18691e)[_0xdfdc('0xd')](function(_0x4fb1fd){logger[_0xdfdc('0xe')](_0xdfdc('0xf'),_0x13ab53,_0xdfdc('0x10'));logger[_0xdfdc('0x11')](_0xdfdc('0x12'),_0x13ab53,'request\x20sent',JSON[_0xdfdc('0x13')](_0x4fb1fd));if(_0x4fb1fd['error']){if(_0x4fb1fd['error'][_0xdfdc('0x14')]===0x1f4){logger[_0xdfdc('0x15')](_0xdfdc('0xf'),_0x13ab53,_0x4fb1fd[_0xdfdc('0x15')][_0xdfdc('0x16')]);return _0x580fc7(_0x4fb1fd[_0xdfdc('0x15')][_0xdfdc('0x16')]);}logger['error'](_0xdfdc('0xf'),_0x13ab53,_0x4fb1fd[_0xdfdc('0x15')][_0xdfdc('0x16')]);return _0xf45350(_0x4fb1fd['error'][_0xdfdc('0x16')]);}else{logger[_0xdfdc('0xe')](_0xdfdc('0xf'),_0x13ab53,'request\x20sent');_0xf45350(_0x4fb1fd[_0xdfdc('0x17')]['message']);}})[_0xdfdc('0x18')](function(_0x36aae5){logger['error'](_0xdfdc('0xf'),_0x13ab53,_0x36aae5);_0x580fc7(_0x36aae5);});});} \ No newline at end of file +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(_0x578be3,_0x2d34e3){var _0x13f09c=function(_0x174037){while(--_0x174037){_0x578be3['push'](_0x578be3['shift']());}};_0x13f09c(++_0x2d34e3);}(_0xd2f5,0x144));var _0x5d2f=function(_0x28abff,_0x324278){_0x28abff=_0x28abff-0x0;var _0x385903=_0xd2f5[_0x28abff];return _0x385903;};'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 diff --git a/server/api/intFreshdeskAccount/index.js b/server/api/intFreshdeskAccount/index.js index e03ce6e..388546f 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 _0x4bae=['getFields','post','create','put','update','/:id','destroy','exports','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','./intFreshdeskAccount.controller','get','isAuthenticated','index','show','/:id/configurations','getConfigurations','/:id/fields'];(function(_0x5b2433,_0x55e16e){var _0x43dfe0=function(_0x41bc6c){while(--_0x41bc6c){_0x5b2433['push'](_0x5b2433['shift']());}};_0x43dfe0(++_0x55e16e);}(_0x4bae,0x152));var _0xe4ba=function(_0x31991b,_0xaf75d2){_0x31991b=_0x31991b-0x0;var _0x307304=_0x4bae[_0x31991b];return _0x307304;};'use strict';var multer=require(_0xe4ba('0x0'));var util=require(_0xe4ba('0x1'));var path=require(_0xe4ba('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xe4ba('0x3')]();var auth=require(_0xe4ba('0x4'));var interaction=require(_0xe4ba('0x5'));var config=require('../../config/environment');var controller=require(_0xe4ba('0x6'));router[_0xe4ba('0x7')]('/',auth[_0xe4ba('0x8')](),controller[_0xe4ba('0x9')]);router[_0xe4ba('0x7')]('/:id',auth[_0xe4ba('0x8')](),controller[_0xe4ba('0xa')]);router['get'](_0xe4ba('0xb'),auth[_0xe4ba('0x8')](),controller[_0xe4ba('0xc')]);router[_0xe4ba('0x7')](_0xe4ba('0xd'),auth[_0xe4ba('0x8')](),controller[_0xe4ba('0xe')]);router[_0xe4ba('0xf')]('/',auth[_0xe4ba('0x8')](),controller[_0xe4ba('0x10')]);router[_0xe4ba('0xf')](_0xe4ba('0xb'),auth['isAuthenticated'](),controller['addConfiguration']);router[_0xe4ba('0x11')]('/:id',auth[_0xe4ba('0x8')](),controller[_0xe4ba('0x12')]);router['delete'](_0xe4ba('0x13'),auth[_0xe4ba('0x8')](),controller[_0xe4ba('0x14')]);module[_0xe4ba('0x15')]=router; \ No newline at end of file +var _0xcdaf=['./intFreshdeskAccount.controller','get','index','isAuthenticated','/:id/configurations','getFields','create','post','addConfiguration','put','/:id','update','delete','destroy','multer','path','express','Router','../../components/auth/service','../../config/environment'];(function(_0x5f25b3,_0x35481a){var _0x4ab9bf=function(_0x49baf7){while(--_0x49baf7){_0x5f25b3['push'](_0x5f25b3['shift']());}};_0x4ab9bf(++_0x35481a);}(_0xcdaf,0x19e));var _0xfcda=function(_0x54e4dc,_0x3278c6){_0x54e4dc=_0x54e4dc-0x0;var _0x72c6c=_0xcdaf[_0x54e4dc];return _0x72c6c;};'use strict';var multer=require(_0xfcda('0x0'));var util=require('util');var path=require(_0xfcda('0x1'));var timeout=require('connect-timeout');var express=require(_0xfcda('0x2'));var router=express[_0xfcda('0x3')]();var auth=require(_0xfcda('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xfcda('0x5'));var controller=require(_0xfcda('0x6'));router[_0xfcda('0x7')]('/',auth['isAuthenticated'](),controller[_0xfcda('0x8')]);router[_0xfcda('0x7')]('/:id',auth[_0xfcda('0x9')](),controller['show']);router[_0xfcda('0x7')](_0xfcda('0xa'),auth['isAuthenticated'](),controller['getConfigurations']);router['get']('/:id/fields',auth['isAuthenticated'](),controller[_0xfcda('0xb')]);router['post']('/',auth['isAuthenticated'](),controller[_0xfcda('0xc')]);router[_0xfcda('0xd')](_0xfcda('0xa'),auth['isAuthenticated'](),controller[_0xfcda('0xe')]);router[_0xfcda('0xf')](_0xfcda('0x10'),auth[_0xfcda('0x9')](),controller[_0xfcda('0x11')]);router[_0xfcda('0x12')](_0xfcda('0x10'),auth[_0xfcda('0x9')](),controller[_0xfcda('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 0934167..da38284 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 _0x9666=['STRING','username','sequelize','exports'];(function(_0x148055,_0x10ebf9){var _0x1abbee=function(_0x1f4809){while(--_0x1f4809){_0x148055['push'](_0x148055['shift']());}};_0x1abbee(++_0x10ebf9);}(_0x9666,0x17a));var _0x6966=function(_0x5bc792,_0x362580){_0x5bc792=_0x5bc792-0x0;var _0x4a1970=_0x9666[_0x5bc792];return _0x4a1970;};'use strict';var Sequelize=require(_0x6966('0x0'));module[_0x6966('0x1')]={'name':{'type':Sequelize[_0x6966('0x2')]},'description':{'type':Sequelize[_0x6966('0x2')]},'username':{'type':Sequelize['STRING'],'unique':_0x6966('0x3')},'apiKey':{'type':Sequelize[_0x6966('0x2')]},'remoteUri':{'type':Sequelize[_0x6966('0x2')],'unique':'remoteUri'},'serverUrl':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x6a95=['exports','STRING','username','sequelize'];(function(_0x3d197f,_0x3186d3){var _0x37c656=function(_0x3dcc81){while(--_0x3dcc81){_0x3d197f['push'](_0x3d197f['shift']());}};_0x37c656(++_0x3186d3);}(_0x6a95,0x1db));var _0x56a9=function(_0x2b10c6,_0x185590){_0x2b10c6=_0x2b10c6-0x0;var _0x3789d2=_0x6a95[_0x2b10c6];return _0x3789d2;};'use strict';var Sequelize=require(_0x56a9('0x0'));module[_0x56a9('0x1')]={'name':{'type':Sequelize[_0x56a9('0x2')]},'description':{'type':Sequelize[_0x56a9('0x2')]},'username':{'type':Sequelize[_0x56a9('0x2')],'unique':_0x56a9('0x3')},'apiKey':{'type':Sequelize[_0x56a9('0x2')]},'remoteUri':{'type':Sequelize['STRING'],'unique':'remoteUri'},'serverUrl':{'type':Sequelize[_0x56a9('0x2')]}}; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.controller.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.controller.js index d780043..af74ebc 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 _0xabce=['%s/%s','api/v2/ticket_fields','base64','requester','agent','priority','source','company','remove','includes','custom_text','custom_dropdown','label','default','choices','test','stringify','Wrong\x20credentials','statusCode','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','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','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','../../components/integrations/configuration','jayson/promise','client','http','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','then','info','FreshdeskAccount,\x20%s,\x20%s','request\x20sent','debug','FreshdeskAccount,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','sendStatus','status','end','count','offset','limit','Content-Range','apply','reject','save','update','stack','name','send','FreshdeskAccount','map','query','keys','filters','model','attributes','intersection','length','hasOwnProperty','order','sort','pick','merge','VIRTUAL','filter','options','where','includeAll','include','rows','show','params','rawAttributes','fields','find','create','body','destroy','getConfigurations','findOne','FreshdeskConfiguration','getSubjects','channel','getDescriptions','type','FreshdeskField','Subjects','Descriptions','getFields','remoteUri','slice','substring','GET','format'];(function(_0x2773e9,_0x151bf8){var _0x528097=function(_0x4ba289){while(--_0x4ba289){_0x2773e9['push'](_0x2773e9['shift']());}};_0x528097(++_0x151bf8);}(_0xabce,0x103));var _0xeabc=function(_0x4e1d03,_0x786f3a){_0x4e1d03=_0x4e1d03-0x0;var _0x362d4b=_0xabce[_0x4e1d03];return _0x362d4b;};'use strict';var pdf=require(_0xeabc('0x0'));var emlformat=require(_0xeabc('0x1'));var rimraf=require(_0xeabc('0x2'));var zipdir=require(_0xeabc('0x3'));var jsonpatch=require(_0xeabc('0x4'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xeabc('0x5'));var Mustache=require(_0xeabc('0x6'));var util=require(_0xeabc('0x7'));var path=require('path');var sox=require('sox');var csv=require(_0xeabc('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xeabc('0x9'));var squel=require('squel');var crypto=require(_0xeabc('0xa'));var jsforce=require(_0xeabc('0xb'));var deskjs=require(_0xeabc('0xc'));var toCsv=require('to-csv');var querystring=require(_0xeabc('0xd'));var Papa=require(_0xeabc('0xe'));var Redis=require(_0xeabc('0xf'));var authService=require(_0xeabc('0x10'));var qs=require(_0xeabc('0x11'));var as=require(_0xeabc('0x12'));var hardwareService=require(_0xeabc('0x13'));var logger=require(_0xeabc('0x14'))(_0xeabc('0x15'));var utils=require(_0xeabc('0x16'));var config=require(_0xeabc('0x17'));var db=require(_0xeabc('0x18'))['db'];var integrations=require(_0xeabc('0x19'));var jayson=require(_0xeabc('0x1a'));var client=jayson[_0xeabc('0x1b')][_0xeabc('0x1c')]({'port':0x232a});function checkPasswordPattern(_0x53df9c,_0x235c2d,_0x1319f3){if(_0x1319f3){var _0x3251c6=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x3251c6['test'](_0x235c2d)){return _0x53df9c;}else{throw new db['Sequelize'][(_0xeabc('0x1d'))](_0xeabc('0x1e'));}}else{return _0x53df9c;}}function respondWithRpcPromise(_0x326bac,_0x53d5cb,_0xf913d7,_0x638976){return new BPromise(function(_0x49f2d8,_0x53fe28){var _0x10fa8e=_0x638976||client;return _0x10fa8e['request'](_0x326bac,_0xf913d7)[_0xeabc('0x1f')](function(_0x1b64b9){logger[_0xeabc('0x20')](_0xeabc('0x21'),_0x53d5cb,_0xeabc('0x22'));logger[_0xeabc('0x23')](_0xeabc('0x24'),_0x53d5cb,_0xeabc('0x22'),JSON['stringify'](_0x1b64b9));if(_0x1b64b9[_0xeabc('0x25')]){if(_0x1b64b9['error'][_0xeabc('0x26')]===0x1f4){logger[_0xeabc('0x25')]('FreshdeskAccount,\x20%s,\x20%s',_0x53d5cb,_0x1b64b9[_0xeabc('0x25')][_0xeabc('0x27')]);return _0x53fe28(_0x1b64b9[_0xeabc('0x25')][_0xeabc('0x27')]);}logger[_0xeabc('0x25')]('FreshdeskAccount,\x20%s,\x20%s',_0x53d5cb,_0x1b64b9[_0xeabc('0x25')][_0xeabc('0x27')]);return _0x49f2d8(_0x1b64b9[_0xeabc('0x25')]['message']);}else{logger[_0xeabc('0x20')](_0xeabc('0x21'),_0x53d5cb,_0xeabc('0x22'));_0x49f2d8(_0x1b64b9[_0xeabc('0x28')]['message']);}})[_0xeabc('0x29')](function(_0x480440){logger[_0xeabc('0x25')]('FreshdeskAccount,\x20%s,\x20%s',_0x53d5cb,_0x480440);_0x53fe28(_0x480440);});});}function respondWithStatusCode(_0x811f0d,_0x12acbd){_0x12acbd=_0x12acbd||0xcc;return function(_0x269621){if(_0x269621){return _0x811f0d[_0xeabc('0x2a')](_0x12acbd);}return _0x811f0d[_0xeabc('0x2b')](_0x12acbd)[_0xeabc('0x2c')]();};}function respondWithResult(_0x131722,_0x4c2693){_0x4c2693=_0x4c2693||0xc8;return function(_0x5b2934){if(_0x5b2934){return _0x131722[_0xeabc('0x2b')](_0x4c2693)['json'](_0x5b2934);}};}function respondWithFilteredResult(_0x3c1b5b,_0x2b342c){return function(_0x48fb52){if(_0x48fb52){var _0x2163e6=_0x48fb52[_0xeabc('0x2d')],_0x38572d=_0x2b342c[_0xeabc('0x2e')],_0x2b568f=_0x2b342c[_0xeabc('0x2e')]+_0x2b342c[_0xeabc('0x2f')],_0x2f8633;if(_0x2b568f>=_0x2163e6){_0x2b568f=_0x2163e6;_0x2f8633=0xc8;}else{_0x2f8633=0xce;}_0x3c1b5b[_0xeabc('0x2b')](_0x2f8633);return _0x3c1b5b['set'](_0xeabc('0x30'),_0x38572d+'-'+_0x2b568f+'/'+_0x2163e6)['json'](_0x48fb52);}return null;};}function patchUpdates(_0x2f03e8){return function(_0x2d027e){try{jsonpatch[_0xeabc('0x31')](_0x2d027e,_0x2f03e8,!![]);}catch(_0x3c606a){return BPromise[_0xeabc('0x32')](_0x3c606a);}return _0x2d027e[_0xeabc('0x33')]();};}function saveUpdates(_0x61c0af,_0x545d7f){return function(_0x78510a){if(_0x78510a){return _0x78510a[_0xeabc('0x34')](_0x61c0af)[_0xeabc('0x1f')](function(_0x4918e2){return _0x4918e2;});}return null;};}function removeEntity(_0x1e74ca,_0x3777c1){return function(_0x4492fd){if(_0x4492fd){return _0x4492fd['destroy']()[_0xeabc('0x1f')](function(){_0x1e74ca[_0xeabc('0x2b')](0xcc)[_0xeabc('0x2c')]();});}};}function handleEntityNotFound(_0x521091,_0xf98c7c){return function(_0x286203){if(!_0x286203){_0x521091['sendStatus'](0x194);}return _0x286203;};}function handleError(_0x50cca2,_0x254568){_0x254568=_0x254568||0x1f4;return function(_0x3829a9){logger['error'](_0x3829a9[_0xeabc('0x35')]);if(_0x3829a9[_0xeabc('0x36')]){delete _0x3829a9[_0xeabc('0x36')];}_0x50cca2[_0xeabc('0x2b')](_0x254568)[_0xeabc('0x37')](_0x3829a9);};}exports['index']=function(_0x353e48,_0x5b61fa){var _0x31ee7a={},_0x2bda29={},_0x311291={'count':0x0,'rows':[]};var _0x5b52c4=_['map'](db[_0xeabc('0x38')]['rawAttributes'],function(_0x113d5a){return{'name':_0x113d5a['fieldName'],'type':_0x113d5a['type']['key']};});_0x2bda29['model']=_[_0xeabc('0x39')](_0x5b52c4,'name');_0x2bda29[_0xeabc('0x3a')]=_[_0xeabc('0x3b')](_0x353e48['query']);_0x2bda29[_0xeabc('0x3c')]=_['intersection'](_0x2bda29[_0xeabc('0x3d')],_0x2bda29['query']);_0x31ee7a[_0xeabc('0x3e')]=_[_0xeabc('0x3f')](_0x2bda29[_0xeabc('0x3d')],qs['fields'](_0x353e48['query']['fields']));_0x31ee7a[_0xeabc('0x3e')]=_0x31ee7a[_0xeabc('0x3e')][_0xeabc('0x40')]?_0x31ee7a['attributes']:_0x2bda29['model'];if(!_0x353e48[_0xeabc('0x3a')][_0xeabc('0x41')]('nolimit')){_0x31ee7a[_0xeabc('0x2f')]=qs['limit'](_0x353e48[_0xeabc('0x3a')]['limit']);_0x31ee7a['offset']=qs['offset'](_0x353e48[_0xeabc('0x3a')][_0xeabc('0x2e')]);}_0x31ee7a[_0xeabc('0x42')]=qs[_0xeabc('0x43')](_0x353e48['query'][_0xeabc('0x43')]);_0x31ee7a['where']=qs[_0xeabc('0x3c')](_[_0xeabc('0x44')](_0x353e48[_0xeabc('0x3a')],_0x2bda29[_0xeabc('0x3c')]),_0x5b52c4);if(_0x353e48[_0xeabc('0x3a')]['filter']){_0x31ee7a['where']=_[_0xeabc('0x45')](_0x31ee7a['where'],{'$or':_[_0xeabc('0x39')](_0x5b52c4,function(_0x2cdf59){if(_0x2cdf59['type']!==_0xeabc('0x46')){var _0x2b3c28={};_0x2b3c28[_0x2cdf59[_0xeabc('0x36')]]={'$like':'%'+_0x353e48[_0xeabc('0x3a')][_0xeabc('0x47')]+'%'};return _0x2b3c28;}})});}_0x31ee7a=_[_0xeabc('0x45')]({},_0x31ee7a,_0x353e48[_0xeabc('0x48')]);var _0x4b2fb6={'where':_0x31ee7a[_0xeabc('0x49')]};return db[_0xeabc('0x38')][_0xeabc('0x2d')](_0x4b2fb6)[_0xeabc('0x1f')](function(_0x271f8c){_0x311291[_0xeabc('0x2d')]=_0x271f8c;if(_0x353e48[_0xeabc('0x3a')][_0xeabc('0x4a')]){_0x31ee7a[_0xeabc('0x4b')]=[{'all':!![]}];}return db[_0xeabc('0x38')]['findAll'](_0x31ee7a);})[_0xeabc('0x1f')](function(_0x2e6efb){_0x311291[_0xeabc('0x4c')]=_0x2e6efb;return _0x311291;})[_0xeabc('0x1f')](respondWithFilteredResult(_0x5b61fa,_0x31ee7a))[_0xeabc('0x29')](handleError(_0x5b61fa,null));};exports[_0xeabc('0x4d')]=function(_0x268d95,_0x48df43){var _0x766743={'raw':![],'where':{'id':_0x268d95[_0xeabc('0x4e')]['id']}},_0x32e09b={};_0x32e09b[_0xeabc('0x3d')]=_[_0xeabc('0x3b')](db['FreshdeskAccount'][_0xeabc('0x4f')]);_0x32e09b[_0xeabc('0x3a')]=_[_0xeabc('0x3b')](_0x268d95[_0xeabc('0x3a')]);_0x32e09b['filters']=_[_0xeabc('0x3f')](_0x32e09b[_0xeabc('0x3d')],_0x32e09b['query']);_0x766743[_0xeabc('0x3e')]=_['intersection'](_0x32e09b[_0xeabc('0x3d')],qs['fields'](_0x268d95[_0xeabc('0x3a')][_0xeabc('0x50')]));_0x766743[_0xeabc('0x3e')]=_0x766743[_0xeabc('0x3e')][_0xeabc('0x40')]?_0x766743[_0xeabc('0x3e')]:_0x32e09b[_0xeabc('0x3d')];if(_0x268d95[_0xeabc('0x3a')][_0xeabc('0x4a')]){_0x766743[_0xeabc('0x4b')]=[{'all':!![]}];}_0x766743=_['merge']({},_0x766743,_0x268d95[_0xeabc('0x48')]);return db[_0xeabc('0x38')][_0xeabc('0x51')](_0x766743)[_0xeabc('0x1f')](handleEntityNotFound(_0x48df43,null))['then'](respondWithResult(_0x48df43,null))[_0xeabc('0x29')](handleError(_0x48df43,null));};exports[_0xeabc('0x52')]=function(_0x10d56f,_0x21f972){return db['FreshdeskAccount'][_0xeabc('0x52')](_0x10d56f[_0xeabc('0x53')],{})[_0xeabc('0x1f')](respondWithResult(_0x21f972,0xc9))[_0xeabc('0x29')](handleError(_0x21f972,null));};exports[_0xeabc('0x34')]=function(_0x3b5e94,_0x14c322){if(_0x3b5e94[_0xeabc('0x53')]['id']){delete _0x3b5e94[_0xeabc('0x53')]['id'];}return db['FreshdeskAccount'][_0xeabc('0x51')]({'where':{'id':_0x3b5e94['params']['id']}})['then'](handleEntityNotFound(_0x14c322,null))['then'](saveUpdates(_0x3b5e94[_0xeabc('0x53')],null))[_0xeabc('0x1f')](respondWithResult(_0x14c322,null))[_0xeabc('0x29')](handleError(_0x14c322,null));};exports[_0xeabc('0x54')]=function(_0xe89728,_0x2f78f3){return db['FreshdeskAccount'][_0xeabc('0x51')]({'where':{'id':_0xe89728[_0xeabc('0x4e')]['id']}})[_0xeabc('0x1f')](handleEntityNotFound(_0x2f78f3,null))[_0xeabc('0x1f')](removeEntity(_0x2f78f3,null))[_0xeabc('0x29')](handleError(_0x2f78f3,null));};exports[_0xeabc('0x55')]=function(_0x1750e9,_0x25c728,_0x5820ca){var _0x5b8370={};var _0x180e62={};var _0x340520;var _0x2c0894;return db['FreshdeskAccount'][_0xeabc('0x56')]({'where':{'id':_0x1750e9['params']['id']}})['then'](handleEntityNotFound(_0x25c728,null))[_0xeabc('0x1f')](function(_0x1fca99){if(_0x1fca99){_0x340520=_0x1fca99;_0x180e62[_0xeabc('0x3d')]=_[_0xeabc('0x3b')](db[_0xeabc('0x57')][_0xeabc('0x4f')]);_0x180e62['query']=_[_0xeabc('0x3b')](_0x1750e9[_0xeabc('0x3a')]);_0x180e62[_0xeabc('0x3c')]=_[_0xeabc('0x3f')](_0x180e62[_0xeabc('0x3d')],_0x180e62[_0xeabc('0x3a')]);_0x5b8370['attributes']=_[_0xeabc('0x3f')](_0x180e62[_0xeabc('0x3d')],qs[_0xeabc('0x50')](_0x1750e9[_0xeabc('0x3a')][_0xeabc('0x50')]));_0x5b8370[_0xeabc('0x3e')]=_0x5b8370[_0xeabc('0x3e')][_0xeabc('0x40')]?_0x5b8370[_0xeabc('0x3e')]:_0x180e62['model'];_0x5b8370[_0xeabc('0x42')]=qs['sort'](_0x1750e9[_0xeabc('0x3a')][_0xeabc('0x43')]);_0x5b8370[_0xeabc('0x49')]=qs[_0xeabc('0x3c')](_[_0xeabc('0x44')](_0x1750e9[_0xeabc('0x3a')],_0x180e62[_0xeabc('0x3c')]));if(_0x1750e9[_0xeabc('0x3a')][_0xeabc('0x47')]){_0x5b8370[_0xeabc('0x49')]=_['merge'](_0x5b8370[_0xeabc('0x49')],{'$or':_[_0xeabc('0x39')](_0x5b8370[_0xeabc('0x3e')],function(_0x41cad5){var _0x5b4430={};_0x5b4430[_0x41cad5]={'$like':'%'+_0x1750e9[_0xeabc('0x3a')]['filter']+'%'};return _0x5b4430;})});}_0x5b8370=_['merge']({},_0x5b8370,_0x1750e9[_0xeabc('0x48')]);return _0x340520[_0xeabc('0x55')](_0x5b8370);}})[_0xeabc('0x1f')](function(_0x1c91e4){if(_0x1c91e4){_0x2c0894=_0x1c91e4['length'];if(!_0x1750e9['query'][_0xeabc('0x41')]('nolimit')){_0x5b8370['limit']=qs[_0xeabc('0x2f')](_0x1750e9['query']['limit']);_0x5b8370[_0xeabc('0x2e')]=qs[_0xeabc('0x2e')](_0x1750e9['query']['offset']);}return _0x340520[_0xeabc('0x55')](_0x5b8370);}})['then'](function(_0x238e2d){if(_0x238e2d){return _0x238e2d?{'count':_0x2c0894,'rows':_0x238e2d}:null;}})[_0xeabc('0x1f')](respondWithResult(_0x25c728,null))['catch'](handleError(_0x25c728,null));};exports['addConfiguration']=function(_0x24365a,_0x74f5ac,_0xd86ea7){if(_0x24365a[_0xeabc('0x53')]['id']){delete _0x24365a[_0xeabc('0x53')]['id'];}return db['FreshdeskAccount']['findOne']({'where':{'id':_0x24365a[_0xeabc('0x4e')]['id']}})['then'](handleEntityNotFound(_0x74f5ac,null))[_0xeabc('0x1f')](function(_0x5086c6){if(_0x5086c6){_0x24365a[_0xeabc('0x53')]['AccountId']=_0x5086c6['id'];_0x24365a[_0xeabc('0x53')]['Subjects']=integrations[_0xeabc('0x58')](_0x24365a[_0xeabc('0x53')][_0xeabc('0x59')],_0x24365a[_0xeabc('0x53')]['type']);_0x24365a[_0xeabc('0x53')]['Descriptions']=integrations[_0xeabc('0x5a')](_0x24365a[_0xeabc('0x53')][_0xeabc('0x59')],_0x24365a[_0xeabc('0x53')][_0xeabc('0x5b')]);return db['FreshdeskConfiguration'][_0xeabc('0x52')](_0x24365a[_0xeabc('0x53')],{'include':[{'model':db[_0xeabc('0x5c')],'as':_0xeabc('0x5d')},{'model':db['FreshdeskField'],'as':_0xeabc('0x5e')}]});}return null;})[_0xeabc('0x1f')](respondWithResult(_0x74f5ac,null))[_0xeabc('0x29')](handleError(_0x74f5ac,null));};exports[_0xeabc('0x5f')]=function(_0x5bacbb,_0xb9b460,_0x368cd4){var _0x287f88='';return db[_0xeabc('0x38')]['findOne']({'where':{'id':_0x5bacbb['params']['id']},'attributes':['id',_0xeabc('0x60'),'apiKey']})['then'](handleEntityNotFound(_0xb9b460,null))[_0xeabc('0x1f')](function(_0x460f07){if(_0x460f07){_0x287f88=_0x460f07[_0xeabc('0x60')];var _0x49679d=_0x287f88[_0xeabc('0x61')](-0x1);if(_0x49679d==='/'){_0x287f88=_0x287f88[_0xeabc('0x62')](0x0,_0x287f88['lastIndexOf'](_0x49679d));}return rp({'method':_0xeabc('0x63'),'uri':util[_0xeabc('0x64')](_0xeabc('0x65'),_0x287f88,_0xeabc('0x66')),'headers':{'Authorization':util[_0xeabc('0x64')]('Basic\x20%s',new Buffer(util[_0xeabc('0x64')]('%s:X',_0x460f07['apiKey']))['toString'](_0xeabc('0x67')))},'json':!![]});}})[_0xeabc('0x1f')](function(_0x1b6e9e){if(_0x1b6e9e){var _0x4424ce=[_0xeabc('0x68'),'subject',_0xeabc('0x69'),'description',_0xeabc('0x2b'),_0xeabc('0x6a'),'group',_0xeabc('0x6b'),'ticket_type','group',_0xeabc('0x6c')];_[_0xeabc('0x6d')](_0x1b6e9e,function(_0x439a48){return _0x4424ce[_0xeabc('0x6e')](_0x439a48[_0xeabc('0x36')])||!_0x439a48['default']&&_0x439a48[_0xeabc('0x5b')]!==_0xeabc('0x6f')&&_0x439a48[_0xeabc('0x5b')]!==_0xeabc('0x70');});return{'count':_0x1b6e9e[_0xeabc('0x40')],'rows':_[_0xeabc('0x39')](_0x1b6e9e,function(_0x2d05b4){return{'id':_0x2d05b4[_0xeabc('0x36')],'name':_0x2d05b4[_0xeabc('0x71')],'custom':!_0x2d05b4[_0xeabc('0x72')],'options':_0x2d05b4['choices']?_[_0xeabc('0x39')](_0x2d05b4[_0xeabc('0x73')],function(_0xba29f){return{'name':_['capitalize'](_0xba29f),'value':_0xba29f};}):[]};})};}})['then'](respondWithResult(_0xb9b460,null))[_0xeabc('0x29')](function(_0x273ca5){var _0xe90200=_0x5bacbb[_0xeabc('0x3a')][_0xeabc('0x74')]?0x1f4:_0x273ca5['statusCode']||0x1f4;logger[_0xeabc('0x25')]('getFields,\x20%s,\x20%s,\x20%s','getFields',_0xe90200,JSON[_0xeabc('0x75')](_0x273ca5));delete _0x273ca5[_0xeabc('0x36')];if(_0xe90200===0x191){_0xe90200=0x190;}_0xb9b460['status'](_0xe90200)[_0xeabc('0x37')](_0x5bacbb[_0xeabc('0x3a')][_0xeabc('0x74')]?{'message':_0xeabc('0x76'),'statusCode':_0x273ca5[_0xeabc('0x77')]}:_0x273ca5);});}; \ No newline at end of file +var _0xe14b=['apiKey','slice','substring','lastIndexOf','format','%s/%s','api/v2/ticket_fields','Basic\x20%s','%s:X','base64','requester','subject','agent','priority','group','ticket_type','company','includes','default','custom_text','choices','statusCode','getFields,\x20%s,\x20%s,\x20%s','send','Wrong\x20credentials','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','../../components/integrations/configuration','jayson/promise','client','http','test','Sequelize','request','then','info','FreshdeskAccount,\x20%s,\x20%s','debug','FreshdeskAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','sendStatus','end','json','count','offset','limit','status','set','Content-Range','apply','reject','save','name','index','map','FreshdeskAccount','rawAttributes','fieldName','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','type','merge','options','includeAll','findAll','show','params','include','find','create','body','update','destroy','getConfigurations','findOne','FreshdeskConfiguration','addConfiguration','AccountId','Subjects','getSubjects','Descriptions','getDescriptions','channel','FreshdeskField','getFields','remoteUri'];(function(_0x236b6d,_0x8e2ccf){var _0x594d60=function(_0x1eee4a){while(--_0x1eee4a){_0x236b6d['push'](_0x236b6d['shift']());}};_0x594d60(++_0x8e2ccf);}(_0xe14b,0x93));var _0xbe14=function(_0x277180,_0x3a33c3){_0x277180=_0x277180-0x0;var _0x45cd8f=_0xe14b[_0x277180];return _0x45cd8f;};'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'];var integrations=require(_0xbe14('0x15'));var jayson=require(_0xbe14('0x16'));var client=jayson[_0xbe14('0x17')][_0xbe14('0x18')]({'port':0x232a});function checkPasswordPattern(_0x2850cb,_0x16893f,_0xa2cf72){if(_0xa2cf72){var _0x1e4826=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x1e4826[_0xbe14('0x19')](_0x16893f)){return _0x2850cb;}else{throw new db[(_0xbe14('0x1a'))]['ValidationError']('The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.');}}else{return _0x2850cb;}}function respondWithRpcPromise(_0x3f58f5,_0x3dc4a9,_0xf4ac9,_0x37ce4e){return new BPromise(function(_0x4e8f34,_0x21c789){var _0xe9c3ec=_0x37ce4e||client;return _0xe9c3ec[_0xbe14('0x1b')](_0x3f58f5,_0xf4ac9)[_0xbe14('0x1c')](function(_0x38f1ea){logger[_0xbe14('0x1d')](_0xbe14('0x1e'),_0x3dc4a9,'request\x20sent');logger[_0xbe14('0x1f')](_0xbe14('0x20'),_0x3dc4a9,_0xbe14('0x21'),JSON[_0xbe14('0x22')](_0x38f1ea));if(_0x38f1ea[_0xbe14('0x23')]){if(_0x38f1ea[_0xbe14('0x23')]['code']===0x1f4){logger[_0xbe14('0x23')](_0xbe14('0x1e'),_0x3dc4a9,_0x38f1ea[_0xbe14('0x23')][_0xbe14('0x24')]);return _0x21c789(_0x38f1ea[_0xbe14('0x23')]['message']);}logger[_0xbe14('0x23')]('FreshdeskAccount,\x20%s,\x20%s',_0x3dc4a9,_0x38f1ea[_0xbe14('0x23')]['message']);return _0x4e8f34(_0x38f1ea[_0xbe14('0x23')]['message']);}else{logger[_0xbe14('0x1d')](_0xbe14('0x1e'),_0x3dc4a9,'request\x20sent');_0x4e8f34(_0x38f1ea[_0xbe14('0x25')]['message']);}})[_0xbe14('0x26')](function(_0x4851f8){logger[_0xbe14('0x23')](_0xbe14('0x1e'),_0x3dc4a9,_0x4851f8);_0x21c789(_0x4851f8);});});}function respondWithStatusCode(_0x1ee9c1,_0x39cc81){_0x39cc81=_0x39cc81||0xcc;return function(_0x15ef02){if(_0x15ef02){return _0x1ee9c1[_0xbe14('0x27')](_0x39cc81);}return _0x1ee9c1['status'](_0x39cc81)[_0xbe14('0x28')]();};}function respondWithResult(_0x1ba46a,_0x391556){_0x391556=_0x391556||0xc8;return function(_0x169369){if(_0x169369){return _0x1ba46a['status'](_0x391556)[_0xbe14('0x29')](_0x169369);}};}function respondWithFilteredResult(_0x29fc64,_0x59bf34){return function(_0x3c3613){if(_0x3c3613){var _0x3b3e84=_0x3c3613[_0xbe14('0x2a')],_0x1c7cc7=_0x59bf34[_0xbe14('0x2b')],_0x19252f=_0x59bf34[_0xbe14('0x2b')]+_0x59bf34[_0xbe14('0x2c')],_0x34d648;if(_0x19252f>=_0x3b3e84){_0x19252f=_0x3b3e84;_0x34d648=0xc8;}else{_0x34d648=0xce;}_0x29fc64[_0xbe14('0x2d')](_0x34d648);return _0x29fc64[_0xbe14('0x2e')](_0xbe14('0x2f'),_0x1c7cc7+'-'+_0x19252f+'/'+_0x3b3e84)[_0xbe14('0x29')](_0x3c3613);}return null;};}function patchUpdates(_0x10ae36){return function(_0x223f7a){try{jsonpatch[_0xbe14('0x30')](_0x223f7a,_0x10ae36,!![]);}catch(_0x6ba36c){return BPromise[_0xbe14('0x31')](_0x6ba36c);}return _0x223f7a[_0xbe14('0x32')]();};}function saveUpdates(_0x14e7c4,_0x581e86){return function(_0x2e33e1){if(_0x2e33e1){return _0x2e33e1['update'](_0x14e7c4)['then'](function(_0x46c2d1){return _0x46c2d1;});}return null;};}function removeEntity(_0x4c1e7e,_0x243524){return function(_0x345b0){if(_0x345b0){return _0x345b0['destroy']()['then'](function(){_0x4c1e7e['status'](0xcc)[_0xbe14('0x28')]();});}};}function handleEntityNotFound(_0xa3d24,_0x5f27b6){return function(_0x46c570){if(!_0x46c570){_0xa3d24[_0xbe14('0x27')](0x194);}return _0x46c570;};}function handleError(_0x452635,_0x1aa849){_0x1aa849=_0x1aa849||0x1f4;return function(_0x29c23e){logger['error'](_0x29c23e['stack']);if(_0x29c23e[_0xbe14('0x33')]){delete _0x29c23e['name'];}_0x452635['status'](_0x1aa849)['send'](_0x29c23e);};}exports[_0xbe14('0x34')]=function(_0x393f6b,_0x2bb45){var _0x3dbacb={},_0x172e79={},_0x29356f={'count':0x0,'rows':[]};var _0xcdc50=_[_0xbe14('0x35')](db[_0xbe14('0x36')][_0xbe14('0x37')],function(_0x41652d){return{'name':_0x41652d[_0xbe14('0x38')],'type':_0x41652d['type']['key']};});_0x172e79[_0xbe14('0x39')]=_[_0xbe14('0x35')](_0xcdc50,_0xbe14('0x33'));_0x172e79['query']=_[_0xbe14('0x3a')](_0x393f6b[_0xbe14('0x3b')]);_0x172e79[_0xbe14('0x3c')]=_[_0xbe14('0x3d')](_0x172e79[_0xbe14('0x39')],_0x172e79[_0xbe14('0x3b')]);_0x3dbacb[_0xbe14('0x3e')]=_[_0xbe14('0x3d')](_0x172e79[_0xbe14('0x39')],qs['fields'](_0x393f6b[_0xbe14('0x3b')][_0xbe14('0x3f')]));_0x3dbacb[_0xbe14('0x3e')]=_0x3dbacb[_0xbe14('0x3e')][_0xbe14('0x40')]?_0x3dbacb[_0xbe14('0x3e')]:_0x172e79['model'];if(!_0x393f6b[_0xbe14('0x3b')][_0xbe14('0x41')](_0xbe14('0x42'))){_0x3dbacb[_0xbe14('0x2c')]=qs['limit'](_0x393f6b['query'][_0xbe14('0x2c')]);_0x3dbacb[_0xbe14('0x2b')]=qs[_0xbe14('0x2b')](_0x393f6b['query']['offset']);}_0x3dbacb[_0xbe14('0x43')]=qs['sort'](_0x393f6b['query'][_0xbe14('0x44')]);_0x3dbacb[_0xbe14('0x45')]=qs[_0xbe14('0x3c')](_['pick'](_0x393f6b['query'],_0x172e79['filters']),_0xcdc50);if(_0x393f6b[_0xbe14('0x3b')][_0xbe14('0x46')]){_0x3dbacb[_0xbe14('0x45')]=_['merge'](_0x3dbacb[_0xbe14('0x45')],{'$or':_[_0xbe14('0x35')](_0xcdc50,function(_0x32f22e){if(_0x32f22e[_0xbe14('0x47')]!=='VIRTUAL'){var _0x4a1a4b={};_0x4a1a4b[_0x32f22e[_0xbe14('0x33')]]={'$like':'%'+_0x393f6b[_0xbe14('0x3b')][_0xbe14('0x46')]+'%'};return _0x4a1a4b;}})});}_0x3dbacb=_[_0xbe14('0x48')]({},_0x3dbacb,_0x393f6b[_0xbe14('0x49')]);var _0x4f2d95={'where':_0x3dbacb['where']};return db[_0xbe14('0x36')][_0xbe14('0x2a')](_0x4f2d95)[_0xbe14('0x1c')](function(_0x2a3b35){_0x29356f['count']=_0x2a3b35;if(_0x393f6b[_0xbe14('0x3b')][_0xbe14('0x4a')]){_0x3dbacb['include']=[{'all':!![]}];}return db[_0xbe14('0x36')][_0xbe14('0x4b')](_0x3dbacb);})[_0xbe14('0x1c')](function(_0x36c20c){_0x29356f['rows']=_0x36c20c;return _0x29356f;})['then'](respondWithFilteredResult(_0x2bb45,_0x3dbacb))[_0xbe14('0x26')](handleError(_0x2bb45,null));};exports[_0xbe14('0x4c')]=function(_0x4a1a37,_0x5acf90){var _0xca8cdb={'raw':![],'where':{'id':_0x4a1a37[_0xbe14('0x4d')]['id']}},_0x5d3726={};_0x5d3726[_0xbe14('0x39')]=_[_0xbe14('0x3a')](db[_0xbe14('0x36')][_0xbe14('0x37')]);_0x5d3726['query']=_[_0xbe14('0x3a')](_0x4a1a37[_0xbe14('0x3b')]);_0x5d3726[_0xbe14('0x3c')]=_[_0xbe14('0x3d')](_0x5d3726[_0xbe14('0x39')],_0x5d3726['query']);_0xca8cdb[_0xbe14('0x3e')]=_[_0xbe14('0x3d')](_0x5d3726[_0xbe14('0x39')],qs[_0xbe14('0x3f')](_0x4a1a37[_0xbe14('0x3b')][_0xbe14('0x3f')]));_0xca8cdb['attributes']=_0xca8cdb['attributes'][_0xbe14('0x40')]?_0xca8cdb[_0xbe14('0x3e')]:_0x5d3726[_0xbe14('0x39')];if(_0x4a1a37['query']['includeAll']){_0xca8cdb[_0xbe14('0x4e')]=[{'all':!![]}];}_0xca8cdb=_[_0xbe14('0x48')]({},_0xca8cdb,_0x4a1a37['options']);return db[_0xbe14('0x36')][_0xbe14('0x4f')](_0xca8cdb)['then'](handleEntityNotFound(_0x5acf90,null))[_0xbe14('0x1c')](respondWithResult(_0x5acf90,null))['catch'](handleError(_0x5acf90,null));};exports[_0xbe14('0x50')]=function(_0x410c59,_0x12a9de){return db['FreshdeskAccount'][_0xbe14('0x50')](_0x410c59[_0xbe14('0x51')],{})['then'](respondWithResult(_0x12a9de,0xc9))[_0xbe14('0x26')](handleError(_0x12a9de,null));};exports[_0xbe14('0x52')]=function(_0x2210cc,_0x20c48d){if(_0x2210cc[_0xbe14('0x51')]['id']){delete _0x2210cc['body']['id'];}return db[_0xbe14('0x36')][_0xbe14('0x4f')]({'where':{'id':_0x2210cc[_0xbe14('0x4d')]['id']}})[_0xbe14('0x1c')](handleEntityNotFound(_0x20c48d,null))[_0xbe14('0x1c')](saveUpdates(_0x2210cc[_0xbe14('0x51')],null))[_0xbe14('0x1c')](respondWithResult(_0x20c48d,null))['catch'](handleError(_0x20c48d,null));};exports[_0xbe14('0x53')]=function(_0x1b47a4,_0x941ee2){return db[_0xbe14('0x36')][_0xbe14('0x4f')]({'where':{'id':_0x1b47a4[_0xbe14('0x4d')]['id']}})[_0xbe14('0x1c')](handleEntityNotFound(_0x941ee2,null))[_0xbe14('0x1c')](removeEntity(_0x941ee2,null))[_0xbe14('0x26')](handleError(_0x941ee2,null));};exports[_0xbe14('0x54')]=function(_0x358950,_0x4bccfc,_0x56bcd3){var _0x58dd79={};var _0x10c0bc={};var _0x1bfcbf;var _0x2f4e52;return db[_0xbe14('0x36')][_0xbe14('0x55')]({'where':{'id':_0x358950[_0xbe14('0x4d')]['id']}})[_0xbe14('0x1c')](handleEntityNotFound(_0x4bccfc,null))[_0xbe14('0x1c')](function(_0x31d015){if(_0x31d015){_0x1bfcbf=_0x31d015;_0x10c0bc[_0xbe14('0x39')]=_[_0xbe14('0x3a')](db[_0xbe14('0x56')][_0xbe14('0x37')]);_0x10c0bc[_0xbe14('0x3b')]=_[_0xbe14('0x3a')](_0x358950[_0xbe14('0x3b')]);_0x10c0bc[_0xbe14('0x3c')]=_[_0xbe14('0x3d')](_0x10c0bc[_0xbe14('0x39')],_0x10c0bc[_0xbe14('0x3b')]);_0x58dd79['attributes']=_[_0xbe14('0x3d')](_0x10c0bc[_0xbe14('0x39')],qs[_0xbe14('0x3f')](_0x358950[_0xbe14('0x3b')][_0xbe14('0x3f')]));_0x58dd79[_0xbe14('0x3e')]=_0x58dd79[_0xbe14('0x3e')][_0xbe14('0x40')]?_0x58dd79[_0xbe14('0x3e')]:_0x10c0bc[_0xbe14('0x39')];_0x58dd79['order']=qs[_0xbe14('0x44')](_0x358950[_0xbe14('0x3b')][_0xbe14('0x44')]);_0x58dd79[_0xbe14('0x45')]=qs[_0xbe14('0x3c')](_['pick'](_0x358950[_0xbe14('0x3b')],_0x10c0bc[_0xbe14('0x3c')]));if(_0x358950[_0xbe14('0x3b')][_0xbe14('0x46')]){_0x58dd79[_0xbe14('0x45')]=_['merge'](_0x58dd79[_0xbe14('0x45')],{'$or':_[_0xbe14('0x35')](_0x58dd79[_0xbe14('0x3e')],function(_0x29bb26){var _0xaebce8={};_0xaebce8[_0x29bb26]={'$like':'%'+_0x358950[_0xbe14('0x3b')][_0xbe14('0x46')]+'%'};return _0xaebce8;})});}_0x58dd79=_[_0xbe14('0x48')]({},_0x58dd79,_0x358950['options']);return _0x1bfcbf[_0xbe14('0x54')](_0x58dd79);}})[_0xbe14('0x1c')](function(_0x2fdf5d){if(_0x2fdf5d){_0x2f4e52=_0x2fdf5d[_0xbe14('0x40')];if(!_0x358950[_0xbe14('0x3b')][_0xbe14('0x41')](_0xbe14('0x42'))){_0x58dd79['limit']=qs['limit'](_0x358950[_0xbe14('0x3b')][_0xbe14('0x2c')]);_0x58dd79[_0xbe14('0x2b')]=qs[_0xbe14('0x2b')](_0x358950[_0xbe14('0x3b')][_0xbe14('0x2b')]);}return _0x1bfcbf[_0xbe14('0x54')](_0x58dd79);}})[_0xbe14('0x1c')](function(_0x50e644){if(_0x50e644){return _0x50e644?{'count':_0x2f4e52,'rows':_0x50e644}:null;}})['then'](respondWithResult(_0x4bccfc,null))[_0xbe14('0x26')](handleError(_0x4bccfc,null));};exports[_0xbe14('0x57')]=function(_0x29aa52,_0x57729f,_0x76e91e){if(_0x29aa52[_0xbe14('0x51')]['id']){delete _0x29aa52[_0xbe14('0x51')]['id'];}return db[_0xbe14('0x36')][_0xbe14('0x55')]({'where':{'id':_0x29aa52[_0xbe14('0x4d')]['id']}})[_0xbe14('0x1c')](handleEntityNotFound(_0x57729f,null))['then'](function(_0x43b817){if(_0x43b817){_0x29aa52[_0xbe14('0x51')][_0xbe14('0x58')]=_0x43b817['id'];_0x29aa52[_0xbe14('0x51')][_0xbe14('0x59')]=integrations[_0xbe14('0x5a')](_0x29aa52[_0xbe14('0x51')]['channel'],_0x29aa52[_0xbe14('0x51')][_0xbe14('0x47')]);_0x29aa52[_0xbe14('0x51')][_0xbe14('0x5b')]=integrations[_0xbe14('0x5c')](_0x29aa52[_0xbe14('0x51')][_0xbe14('0x5d')],_0x29aa52[_0xbe14('0x51')]['type']);return db[_0xbe14('0x56')][_0xbe14('0x50')](_0x29aa52[_0xbe14('0x51')],{'include':[{'model':db[_0xbe14('0x5e')],'as':_0xbe14('0x59')},{'model':db[_0xbe14('0x5e')],'as':'Descriptions'}]});}return null;})[_0xbe14('0x1c')](respondWithResult(_0x57729f,null))[_0xbe14('0x26')](handleError(_0x57729f,null));};exports[_0xbe14('0x5f')]=function(_0x1b23a1,_0x508455,_0x7e9e5c){var _0x1578b6='';return db[_0xbe14('0x36')][_0xbe14('0x55')]({'where':{'id':_0x1b23a1[_0xbe14('0x4d')]['id']},'attributes':['id',_0xbe14('0x60'),_0xbe14('0x61')]})['then'](handleEntityNotFound(_0x508455,null))[_0xbe14('0x1c')](function(_0x589197){if(_0x589197){_0x1578b6=_0x589197[_0xbe14('0x60')];var _0x5d85d3=_0x1578b6[_0xbe14('0x62')](-0x1);if(_0x5d85d3==='/'){_0x1578b6=_0x1578b6[_0xbe14('0x63')](0x0,_0x1578b6[_0xbe14('0x64')](_0x5d85d3));}return rp({'method':'GET','uri':util[_0xbe14('0x65')](_0xbe14('0x66'),_0x1578b6,_0xbe14('0x67')),'headers':{'Authorization':util['format'](_0xbe14('0x68'),new Buffer(util[_0xbe14('0x65')](_0xbe14('0x69'),_0x589197[_0xbe14('0x61')]))['toString'](_0xbe14('0x6a')))},'json':!![]});}})[_0xbe14('0x1c')](function(_0x34f90b){if(_0x34f90b){var _0x2b2e0e=[_0xbe14('0x6b'),_0xbe14('0x6c'),_0xbe14('0x6d'),'description',_0xbe14('0x2d'),_0xbe14('0x6e'),_0xbe14('0x6f'),'source',_0xbe14('0x70'),_0xbe14('0x6f'),_0xbe14('0x71')];_['remove'](_0x34f90b,function(_0xa53262){return _0x2b2e0e[_0xbe14('0x72')](_0xa53262['name'])||!_0xa53262[_0xbe14('0x73')]&&_0xa53262['type']!==_0xbe14('0x74')&&_0xa53262[_0xbe14('0x47')]!=='custom_dropdown';});return{'count':_0x34f90b['length'],'rows':_[_0xbe14('0x35')](_0x34f90b,function(_0x3db955){return{'id':_0x3db955[_0xbe14('0x33')],'name':_0x3db955['label'],'custom':!_0x3db955[_0xbe14('0x73')],'options':_0x3db955[_0xbe14('0x75')]?_[_0xbe14('0x35')](_0x3db955[_0xbe14('0x75')],function(_0x5ee624){return{'name':_['capitalize'](_0x5ee624),'value':_0x5ee624};}):[]};})};}})[_0xbe14('0x1c')](respondWithResult(_0x508455,null))[_0xbe14('0x26')](function(_0xc8d0f6){var _0x215d5b=_0x1b23a1[_0xbe14('0x3b')][_0xbe14('0x19')]?0x1f4:_0xc8d0f6[_0xbe14('0x76')]||0x1f4;logger['error'](_0xbe14('0x77'),'getFields',_0x215d5b,JSON[_0xbe14('0x22')](_0xc8d0f6));delete _0xc8d0f6[_0xbe14('0x33')];if(_0x215d5b===0x191){_0x215d5b=0x190;}_0x508455[_0xbe14('0x2d')](_0x215d5b)[_0xbe14('0x78')](_0x1b23a1['query'][_0xbe14('0x19')]?{'message':_0xbe14('0x79'),'statusCode':_0xc8d0f6[_0xbe14('0x76')]}:_0xc8d0f6);});}; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.model.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.model.js index fabf8c1..2bd16ae 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 _0x15af=['lodash','util','../../config/logger','api','path','../../config/environment','./intFreshdeskAccount.attributes','../../components/integrations/configuration','exports','define','int_freshdesk_accounts'];(function(_0x5ebe9e,_0x1bbf95){var _0xe7db7=function(_0x153009){while(--_0x153009){_0x5ebe9e['push'](_0x5ebe9e['shift']());}};_0xe7db7(++_0x1bbf95);}(_0x15af,0x181));var _0xf15a=function(_0x4bc428,_0xf56dd9){_0x4bc428=_0x4bc428-0x0;var _0x3ca37f=_0x15af[_0x4bc428];return _0x3ca37f;};'use strict';var _=require(_0xf15a('0x0'));var util=require(_0xf15a('0x1'));var logger=require(_0xf15a('0x2'))(_0xf15a('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xf15a('0x4'));var rimraf=require('rimraf');var config=require(_0xf15a('0x5'));var attributes=require(_0xf15a('0x6'));var integrations=require(_0xf15a('0x7'));module[_0xf15a('0x8')]=function(_0x3ece23,_0x1bb4bd){return _0x3ece23[_0xf15a('0x9')]('FreshdeskAccount',attributes,{'tableName':_0xf15a('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7cd3=['bluebird','request-promise','path','../../config/environment','./intFreshdeskAccount.attributes','../../components/integrations/configuration','exports','define','FreshdeskAccount','int_freshdesk_accounts','lodash','util','../../config/logger','api','moment'];(function(_0x2261ce,_0x9ed8b6){var _0x524640=function(_0x3cbb90){while(--_0x3cbb90){_0x2261ce['push'](_0x2261ce['shift']());}};_0x524640(++_0x9ed8b6);}(_0x7cd3,0x181));var _0x37cd=function(_0x364b18,_0x395041){_0x364b18=_0x364b18-0x0;var _0x152136=_0x7cd3[_0x364b18];return _0x152136;};'use strict';var _=require(_0x37cd('0x0'));var util=require(_0x37cd('0x1'));var logger=require(_0x37cd('0x2'))(_0x37cd('0x3'));var moment=require(_0x37cd('0x4'));var BPromise=require(_0x37cd('0x5'));var rp=require(_0x37cd('0x6'));var fs=require('fs');var path=require(_0x37cd('0x7'));var rimraf=require('rimraf');var config=require(_0x37cd('0x8'));var attributes=require(_0x37cd('0x9'));var integrations=require(_0x37cd('0xa'));module[_0x37cd('0xb')]=function(_0x4545b2,_0x3642bc){return _0x4545b2[_0x37cd('0xc')](_0x37cd('0xd'),attributes,{'tableName':_0x37cd('0xe'),'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 3d76df6..5cb15e2 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 _0x18d5=['options','raw','where','attributes','limit','include','map','model','debug','GetFreshdeskAccount','stringify','ShowFreshdeskAccount','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','request','then','info','FreshdeskAccount,\x20%s,\x20%s,\x20%s','request\x20sent','error','FreshdeskAccount,\x20%s,\x20%s','message','result','catch','findAll'];(function(_0x538389,_0xe259ea){var _0x4006a5=function(_0x21db8b){while(--_0x21db8b){_0x538389['push'](_0x538389['shift']());}};_0x4006a5(++_0xe259ea);}(_0x18d5,0xb1));var _0x518d=function(_0x2d78c5,_0x215b4e){_0x2d78c5=_0x2d78c5-0x0;var _0x6a419=_0x18d5[_0x2d78c5];return _0x6a419;};'use strict';var _=require(_0x518d('0x0'));var util=require(_0x518d('0x1'));var moment=require(_0x518d('0x2'));var BPromise=require(_0x518d('0x3'));var rs=require(_0x518d('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x518d('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x518d('0x6'))(_0x518d('0x7'));var config=require(_0x518d('0x8'));var jayson=require(_0x518d('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x4ac232,_0x38c85c,_0x399667){return new BPromise(function(_0x21ef47,_0x29c997){return client[_0x518d('0xa')](_0x4ac232,_0x399667)[_0x518d('0xb')](function(_0x142600){logger[_0x518d('0xc')]('FreshdeskAccount,\x20%s,\x20%s',_0x38c85c,'request\x20sent');logger['debug'](_0x518d('0xd'),_0x38c85c,_0x518d('0xe'),JSON['stringify'](_0x142600));if(_0x142600[_0x518d('0xf')]){if(_0x142600[_0x518d('0xf')]['code']===0x1f4){logger['error'](_0x518d('0x10'),_0x38c85c,_0x142600[_0x518d('0xf')][_0x518d('0x11')]);return _0x29c997(_0x142600[_0x518d('0xf')][_0x518d('0x11')]);}logger[_0x518d('0xf')](_0x518d('0x10'),_0x38c85c,_0x142600[_0x518d('0xf')]['message']);return _0x21ef47(_0x142600['error'][_0x518d('0x11')]);}else{logger[_0x518d('0xc')](_0x518d('0x10'),_0x38c85c,_0x518d('0xe'));_0x21ef47(_0x142600[_0x518d('0x12')][_0x518d('0x11')]);}})[_0x518d('0x13')](function(_0x19eba7){logger[_0x518d('0xf')](_0x518d('0x10'),_0x38c85c,_0x19eba7);_0x29c997(_0x19eba7);});});}exports['GetFreshdeskAccount']=function(_0x59825a){var _0x26e7b9=this;return new Promise(function(_0x443f07,_0x2cf89e){return db['FreshdeskAccount'][_0x518d('0x14')]({'raw':_0x59825a[_0x518d('0x15')]?_0x59825a[_0x518d('0x15')][_0x518d('0x16')]===undefined?!![]:![]:!![],'where':_0x59825a[_0x518d('0x15')]?_0x59825a[_0x518d('0x15')][_0x518d('0x17')]||null:null,'attributes':_0x59825a[_0x518d('0x15')]?_0x59825a['options'][_0x518d('0x18')]||null:null,'limit':_0x59825a[_0x518d('0x15')]?_0x59825a[_0x518d('0x15')][_0x518d('0x19')]||null:null,'include':_0x59825a['options']?_0x59825a[_0x518d('0x15')][_0x518d('0x1a')]?_[_0x518d('0x1b')](_0x59825a['options']['include'],function(_0x4fe88f){return{'model':db[_0x4fe88f[_0x518d('0x1c')]],'as':_0x4fe88f['as'],'attributes':_0x4fe88f[_0x518d('0x18')],'include':_0x4fe88f[_0x518d('0x1a')]?_[_0x518d('0x1b')](_0x4fe88f[_0x518d('0x1a')],function(_0x4b307f){return{'model':db[_0x4b307f[_0x518d('0x1c')]],'as':_0x4b307f['as'],'attributes':_0x4b307f[_0x518d('0x18')],'include':_0x4b307f[_0x518d('0x1a')]?_[_0x518d('0x1b')](_0x4b307f[_0x518d('0x1a')],function(_0x9c58f1){return{'model':db[_0x9c58f1[_0x518d('0x1c')]],'as':_0x9c58f1['as'],'attributes':_0x9c58f1['attributes']};}):[]};}):[]};}):[]:[]})[_0x518d('0xb')](function(_0x5415bf){logger[_0x518d('0xc')]('GetFreshdeskAccount',_0x59825a);logger[_0x518d('0x1d')](_0x518d('0x1e'),_0x59825a,JSON[_0x518d('0x1f')](_0x5415bf));_0x443f07(_0x5415bf);})['catch'](function(_0x86e9db){logger[_0x518d('0xf')](_0x518d('0x1e'),_0x86e9db[_0x518d('0x11')],_0x59825a);_0x2cf89e(_0x26e7b9['error'](0x1f4,_0x86e9db[_0x518d('0x11')]));});});};exports[_0x518d('0x20')]=function(_0x4813b1){var _0x2b8194=this;return new Promise(function(_0x40ae7c,_0x2960bd){return db['FreshdeskAccount']['find']({'raw':_0x4813b1[_0x518d('0x15')]?_0x4813b1[_0x518d('0x15')][_0x518d('0x16')]===undefined?!![]:![]:!![],'where':_0x4813b1[_0x518d('0x15')]?_0x4813b1[_0x518d('0x15')]['where']||null:null,'attributes':_0x4813b1[_0x518d('0x15')]?_0x4813b1[_0x518d('0x15')][_0x518d('0x18')]||null:null,'include':_0x4813b1[_0x518d('0x15')]?_0x4813b1[_0x518d('0x15')]['include']?_[_0x518d('0x1b')](_0x4813b1[_0x518d('0x15')]['include'],function(_0x2cfe6b){return{'model':db[_0x2cfe6b[_0x518d('0x1c')]],'as':_0x2cfe6b['as'],'attributes':_0x2cfe6b['attributes'],'include':_0x2cfe6b[_0x518d('0x1a')]?_[_0x518d('0x1b')](_0x2cfe6b[_0x518d('0x1a')],function(_0x5c5e0e){return{'model':db[_0x5c5e0e['model']],'as':_0x5c5e0e['as'],'attributes':_0x5c5e0e[_0x518d('0x18')],'include':_0x5c5e0e[_0x518d('0x1a')]?_[_0x518d('0x1b')](_0x5c5e0e[_0x518d('0x1a')],function(_0x2da571){return{'model':db[_0x2da571[_0x518d('0x1c')]],'as':_0x2da571['as'],'attributes':_0x2da571[_0x518d('0x18')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x3bae38){logger[_0x518d('0xc')](_0x518d('0x20'),_0x4813b1);logger['debug'](_0x518d('0x20'),_0x4813b1,JSON[_0x518d('0x1f')](_0x3bae38));_0x40ae7c(_0x3bae38);})['catch'](function(_0x5afb6e){logger[_0x518d('0xf')](_0x518d('0x20'),_0x5afb6e[_0x518d('0x11')],_0x4813b1);_0x2960bd(_0x2b8194[_0x518d('0xf')](0x1f4,_0x5afb6e['message']));});});}; \ No newline at end of file +var _0x8dec=['ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','request','info','request\x20sent','debug','FreshdeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','FreshdeskAccount,\x20%s,\x20%s','message','result','catch','GetFreshdeskAccount','FreshdeskAccount','findAll','options','raw','where','attributes','limit','include','map','model','ShowFreshdeskAccount','find','then','util','moment','bluebird'];(function(_0x3eff5f,_0x188324){var _0x25b74f=function(_0x21f957){while(--_0x21f957){_0x3eff5f['push'](_0x3eff5f['shift']());}};_0x25b74f(++_0x188324);}(_0x8dec,0xd5));var _0xc8de=function(_0x1c17e3,_0x5995b9){_0x1c17e3=_0x1c17e3-0x0;var _0x54a18b=_0x8dec[_0x1c17e3];return _0x54a18b;};'use strict';var _=require('lodash');var util=require(_0xc8de('0x0'));var moment=require(_0xc8de('0x1'));var BPromise=require(_0xc8de('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xc8de('0x3'));var db=require(_0xc8de('0x4'))['db'];var utils=require(_0xc8de('0x5'));var logger=require('../../config/logger')(_0xc8de('0x6'));var config=require(_0xc8de('0x7'));var jayson=require(_0xc8de('0x8'));var client=jayson[_0xc8de('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0xc4495b,_0x519b86,_0x12eed1){return new BPromise(function(_0x5f39e6,_0x5024a5){return client[_0xc8de('0xa')](_0xc4495b,_0x12eed1)['then'](function(_0x2fa913){logger[_0xc8de('0xb')]('FreshdeskAccount,\x20%s,\x20%s',_0x519b86,_0xc8de('0xc'));logger[_0xc8de('0xd')](_0xc8de('0xe'),_0x519b86,_0xc8de('0xc'),JSON[_0xc8de('0xf')](_0x2fa913));if(_0x2fa913['error']){if(_0x2fa913[_0xc8de('0x10')][_0xc8de('0x11')]===0x1f4){logger[_0xc8de('0x10')](_0xc8de('0x12'),_0x519b86,_0x2fa913['error'][_0xc8de('0x13')]);return _0x5024a5(_0x2fa913['error'][_0xc8de('0x13')]);}logger[_0xc8de('0x10')](_0xc8de('0x12'),_0x519b86,_0x2fa913['error'][_0xc8de('0x13')]);return _0x5f39e6(_0x2fa913[_0xc8de('0x10')]['message']);}else{logger[_0xc8de('0xb')](_0xc8de('0x12'),_0x519b86,_0xc8de('0xc'));_0x5f39e6(_0x2fa913[_0xc8de('0x14')][_0xc8de('0x13')]);}})[_0xc8de('0x15')](function(_0x2897b3){logger['error'](_0xc8de('0x12'),_0x519b86,_0x2897b3);_0x5024a5(_0x2897b3);});});}exports[_0xc8de('0x16')]=function(_0x5a6b9c){var _0x33a596=this;return new Promise(function(_0x55d9a3,_0x32b432){return db[_0xc8de('0x17')][_0xc8de('0x18')]({'raw':_0x5a6b9c[_0xc8de('0x19')]?_0x5a6b9c[_0xc8de('0x19')][_0xc8de('0x1a')]===undefined?!![]:![]:!![],'where':_0x5a6b9c[_0xc8de('0x19')]?_0x5a6b9c['options'][_0xc8de('0x1b')]||null:null,'attributes':_0x5a6b9c['options']?_0x5a6b9c[_0xc8de('0x19')][_0xc8de('0x1c')]||null:null,'limit':_0x5a6b9c[_0xc8de('0x19')]?_0x5a6b9c[_0xc8de('0x19')][_0xc8de('0x1d')]||null:null,'include':_0x5a6b9c[_0xc8de('0x19')]?_0x5a6b9c[_0xc8de('0x19')][_0xc8de('0x1e')]?_['map'](_0x5a6b9c[_0xc8de('0x19')][_0xc8de('0x1e')],function(_0x33cc4d){return{'model':db[_0x33cc4d['model']],'as':_0x33cc4d['as'],'attributes':_0x33cc4d['attributes'],'include':_0x33cc4d[_0xc8de('0x1e')]?_[_0xc8de('0x1f')](_0x33cc4d[_0xc8de('0x1e')],function(_0x323ad1){return{'model':db[_0x323ad1[_0xc8de('0x20')]],'as':_0x323ad1['as'],'attributes':_0x323ad1[_0xc8de('0x1c')],'include':_0x323ad1[_0xc8de('0x1e')]?_['map'](_0x323ad1[_0xc8de('0x1e')],function(_0x2d3e56){return{'model':db[_0x2d3e56[_0xc8de('0x20')]],'as':_0x2d3e56['as'],'attributes':_0x2d3e56['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x35b5d5){logger[_0xc8de('0xb')]('GetFreshdeskAccount',_0x5a6b9c);logger[_0xc8de('0xd')](_0xc8de('0x16'),_0x5a6b9c,JSON[_0xc8de('0xf')](_0x35b5d5));_0x55d9a3(_0x35b5d5);})['catch'](function(_0x3aec63){logger[_0xc8de('0x10')](_0xc8de('0x16'),_0x3aec63[_0xc8de('0x13')],_0x5a6b9c);_0x32b432(_0x33a596[_0xc8de('0x10')](0x1f4,_0x3aec63[_0xc8de('0x13')]));});});};exports[_0xc8de('0x21')]=function(_0x1861da){var _0x17d92b=this;return new Promise(function(_0x493bcc,_0x2ec58d){return db[_0xc8de('0x17')][_0xc8de('0x22')]({'raw':_0x1861da[_0xc8de('0x19')]?_0x1861da[_0xc8de('0x19')][_0xc8de('0x1a')]===undefined?!![]:![]:!![],'where':_0x1861da['options']?_0x1861da[_0xc8de('0x19')][_0xc8de('0x1b')]||null:null,'attributes':_0x1861da[_0xc8de('0x19')]?_0x1861da[_0xc8de('0x19')][_0xc8de('0x1c')]||null:null,'include':_0x1861da['options']?_0x1861da[_0xc8de('0x19')][_0xc8de('0x1e')]?_[_0xc8de('0x1f')](_0x1861da[_0xc8de('0x19')]['include'],function(_0x22dbfa){return{'model':db[_0x22dbfa[_0xc8de('0x20')]],'as':_0x22dbfa['as'],'attributes':_0x22dbfa[_0xc8de('0x1c')],'include':_0x22dbfa[_0xc8de('0x1e')]?_[_0xc8de('0x1f')](_0x22dbfa['include'],function(_0x514a1d){return{'model':db[_0x514a1d['model']],'as':_0x514a1d['as'],'attributes':_0x514a1d[_0xc8de('0x1c')],'include':_0x514a1d[_0xc8de('0x1e')]?_['map'](_0x514a1d[_0xc8de('0x1e')],function(_0xb2092c){return{'model':db[_0xb2092c[_0xc8de('0x20')]],'as':_0xb2092c['as'],'attributes':_0xb2092c['attributes']};}):[]};}):[]};}):[]:[]})[_0xc8de('0x23')](function(_0x2e7110){logger[_0xc8de('0xb')](_0xc8de('0x21'),_0x1861da);logger['debug'](_0xc8de('0x21'),_0x1861da,JSON[_0xc8de('0xf')](_0x2e7110));_0x493bcc(_0x2e7110);})[_0xc8de('0x15')](function(_0x5946a9){logger['error']('ShowFreshdeskAccount',_0x5946a9[_0xc8de('0x13')],_0x1861da);_0x2ec58d(_0x17d92b[_0xc8de('0x10')](0x1f4,_0x5946a9[_0xc8de('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/index.js b/server/api/intFreshdeskConfiguration/index.js index 96ca9e5..ef0bfd2 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 _0xca36=['isAuthenticated','index','/:id','show','get','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','/:id/tags','create','post','put','exports','util','path','express','Router','../../components/auth/service'];(function(_0x4c66d4,_0x40f224){var _0x3f953a=function(_0x37f0e6){while(--_0x37f0e6){_0x4c66d4['push'](_0x4c66d4['shift']());}};_0x3f953a(++_0x40f224);}(_0xca36,0x1e9));var _0x6ca3=function(_0x1f122f,_0x29d11f){_0x1f122f=_0x1f122f-0x0;var _0x2333a0=_0xca36[_0x1f122f];return _0x2333a0;};'use strict';var multer=require('multer');var util=require(_0x6ca3('0x0'));var path=require(_0x6ca3('0x1'));var timeout=require('connect-timeout');var express=require(_0x6ca3('0x2'));var router=express[_0x6ca3('0x3')]();var auth=require(_0x6ca3('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./intFreshdeskConfiguration.controller');router['get']('/',auth[_0x6ca3('0x5')](),controller[_0x6ca3('0x6')]);router['get'](_0x6ca3('0x7'),auth[_0x6ca3('0x5')](),controller[_0x6ca3('0x8')]);router['get']('/:id/fields',auth[_0x6ca3('0x5')](),controller['getFields']);router[_0x6ca3('0x9')](_0x6ca3('0xa'),auth[_0x6ca3('0x5')](),controller[_0x6ca3('0xb')]);router[_0x6ca3('0x9')](_0x6ca3('0xc'),auth[_0x6ca3('0x5')](),controller[_0x6ca3('0xd')]);router['get'](_0x6ca3('0xe'),auth['isAuthenticated'](),controller['getTags']);router['post']('/',auth['isAuthenticated'](),controller[_0x6ca3('0xf')]);router[_0x6ca3('0x10')]('/:id/tags',auth[_0x6ca3('0x5')](),controller['setTags']);router[_0x6ca3('0x11')](_0x6ca3('0x7'),auth['isAuthenticated'](),controller['update']);router['delete'](_0x6ca3('0x7'),auth[_0x6ca3('0x5')](),controller['destroy']);module[_0x6ca3('0x12')]=router; \ No newline at end of file +var _0xbb18=['../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','/:id/fields','getFields','/:id/subjects','/:id/descriptions','getDescriptions','/:id/tags','getTags','create','post','setTags','put','/:id','update','delete','destroy','exports','util','path','express'];(function(_0x9fd887,_0x47f76c){var _0x1a54ab=function(_0xb65c08){while(--_0xb65c08){_0x9fd887['push'](_0x9fd887['shift']());}};_0x1a54ab(++_0x47f76c);}(_0xbb18,0xa5));var _0x8bb1=function(_0x33a21a,_0x22d1a8){_0x33a21a=_0x33a21a-0x0;var _0x4c628e=_0xbb18[_0x33a21a];return _0x4c628e;};'use strict';var multer=require('multer');var util=require(_0x8bb1('0x0'));var path=require(_0x8bb1('0x1'));var timeout=require('connect-timeout');var express=require(_0x8bb1('0x2'));var router=express['Router']();var auth=require(_0x8bb1('0x3'));var interaction=require(_0x8bb1('0x4'));var config=require('../../config/environment');var controller=require('./intFreshdeskConfiguration.controller');router[_0x8bb1('0x5')]('/',auth[_0x8bb1('0x6')](),controller[_0x8bb1('0x7')]);router['get']('/:id',auth[_0x8bb1('0x6')](),controller['show']);router['get'](_0x8bb1('0x8'),auth['isAuthenticated'](),controller[_0x8bb1('0x9')]);router[_0x8bb1('0x5')](_0x8bb1('0xa'),auth[_0x8bb1('0x6')](),controller['getSubjects']);router[_0x8bb1('0x5')](_0x8bb1('0xb'),auth[_0x8bb1('0x6')](),controller[_0x8bb1('0xc')]);router['get'](_0x8bb1('0xd'),auth[_0x8bb1('0x6')](),controller[_0x8bb1('0xe')]);router['post']('/',auth['isAuthenticated'](),controller[_0x8bb1('0xf')]);router[_0x8bb1('0x10')](_0x8bb1('0xd'),auth[_0x8bb1('0x6')](),controller[_0x8bb1('0x11')]);router[_0x8bb1('0x12')](_0x8bb1('0x13'),auth[_0x8bb1('0x6')](),controller[_0x8bb1('0x14')]);router[_0x8bb1('0x15')](_0x8bb1('0x13'),auth[_0x8bb1('0x6')](),controller[_0x8bb1('0x16')]);module[_0x8bb1('0x17')]=router; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.attributes.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.attributes.js index 3563a18..0313fdd 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 _0xa20b=['STRING','sequelize','exports'];(function(_0x71b765,_0x3053f8){var _0x34cb24=function(_0x2dd237){while(--_0x2dd237){_0x71b765['push'](_0x71b765['shift']());}};_0x34cb24(++_0x3053f8);}(_0xa20b,0x18a));var _0xba20=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xa20b[_0x14add3];return _0x4a174f;};'use strict';var Sequelize=require(_0xba20('0x0'));module[_0xba20('0x1')]={'name':{'type':Sequelize[_0xba20('0x2')]},'description':{'type':Sequelize[_0xba20('0x2')]}}; \ No newline at end of file +var _0xace1=['STRING'];(function(_0x58d20c,_0x487de4){var _0x432d05=function(_0x44615c){while(--_0x44615c){_0x58d20c['push'](_0x58d20c['shift']());}};_0x432d05(++_0x487de4);}(_0xace1,0x133));var _0x1ace=function(_0xab3ec4,_0x3432fc){_0xab3ec4=_0xab3ec4-0x0;var _0x584c03=_0xace1[_0xab3ec4];return _0x584c03;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x1ace('0x0')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.controller.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.controller.js index b6d1887..dcc1eef 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 _0x3cd8=['index','FreshdeskConfiguration','rawAttributes','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','pick','where','merge','map','VIRTUAL','includeAll','findAll','show','params','include','find','create','body','getFields','findOne','FreshdeskField','filter','getSubjects','options','getDescriptions','Tag','getTags','setTags','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','jayson/promise','client','http','test','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','info','FreshdeskConfiguration,\x20%s,\x20%s','debug','request\x20sent','stringify','error','message','result','catch','sendStatus','status','end','json','count','offset','limit','Content-Range','reject','update','destroy','name','send'];(function(_0x336a53,_0x3a309b){var _0x2b396a=function(_0x373785){while(--_0x373785){_0x336a53['push'](_0x336a53['shift']());}};_0x2b396a(++_0x3a309b);}(_0x3cd8,0x150));var _0x83cd=function(_0x1a89ca,_0x27394b){_0x1a89ca=_0x1a89ca-0x0;var _0x29cbb2=_0x3cd8[_0x1a89ca];return _0x29cbb2;};'use strict';var pdf=require(_0x83cd('0x0'));var emlformat=require(_0x83cd('0x1'));var rimraf=require(_0x83cd('0x2'));var zipdir=require(_0x83cd('0x3'));var jsonpatch=require(_0x83cd('0x4'));var rp=require(_0x83cd('0x5'));var moment=require(_0x83cd('0x6'));var BPromise=require(_0x83cd('0x7'));var Mustache=require('mustache');var util=require(_0x83cd('0x8'));var path=require(_0x83cd('0x9'));var sox=require(_0x83cd('0xa'));var csv=require(_0x83cd('0xb'));var ejs=require(_0x83cd('0xc'));var fs=require('fs');var _=require(_0x83cd('0xd'));var squel=require(_0x83cd('0xe'));var crypto=require(_0x83cd('0xf'));var jsforce=require(_0x83cd('0x10'));var deskjs=require(_0x83cd('0x11'));var toCsv=require(_0x83cd('0xb'));var querystring=require(_0x83cd('0x12'));var Papa=require(_0x83cd('0x13'));var Redis=require(_0x83cd('0x14'));var authService=require(_0x83cd('0x15'));var qs=require(_0x83cd('0x16'));var as=require(_0x83cd('0x17'));var hardwareService=require(_0x83cd('0x18'));var logger=require(_0x83cd('0x19'))(_0x83cd('0x1a'));var utils=require('../../config/utils');var config=require(_0x83cd('0x1b'));var db=require(_0x83cd('0x1c'))['db'];var jayson=require(_0x83cd('0x1d'));var client=jayson[_0x83cd('0x1e')][_0x83cd('0x1f')]({'port':0x232a});function checkPasswordPattern(_0x1d4114,_0x29e094,_0x1af3f1){if(_0x1af3f1){var _0x4c3ed7=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x4c3ed7[_0x83cd('0x20')](_0x29e094)){return _0x1d4114;}else{throw new db[(_0x83cd('0x21'))][(_0x83cd('0x22'))](_0x83cd('0x23'));}}else{return _0x1d4114;}}function respondWithRpcPromise(_0x2adc87,_0x385166,_0x501688,_0x4df635){return new BPromise(function(_0x268f58,_0x40ba0f){var _0x2eafe7=_0x4df635||client;return _0x2eafe7[_0x83cd('0x24')](_0x2adc87,_0x501688)[_0x83cd('0x25')](function(_0x3d6303){logger[_0x83cd('0x26')](_0x83cd('0x27'),_0x385166,'request\x20sent');logger[_0x83cd('0x28')]('FreshdeskConfiguration,\x20%s,\x20%s,\x20%s',_0x385166,_0x83cd('0x29'),JSON[_0x83cd('0x2a')](_0x3d6303));if(_0x3d6303[_0x83cd('0x2b')]){if(_0x3d6303['error']['code']===0x1f4){logger[_0x83cd('0x2b')]('FreshdeskConfiguration,\x20%s,\x20%s',_0x385166,_0x3d6303[_0x83cd('0x2b')][_0x83cd('0x2c')]);return _0x40ba0f(_0x3d6303['error'][_0x83cd('0x2c')]);}logger[_0x83cd('0x2b')](_0x83cd('0x27'),_0x385166,_0x3d6303[_0x83cd('0x2b')][_0x83cd('0x2c')]);return _0x268f58(_0x3d6303[_0x83cd('0x2b')][_0x83cd('0x2c')]);}else{logger[_0x83cd('0x26')]('FreshdeskConfiguration,\x20%s,\x20%s',_0x385166,'request\x20sent');_0x268f58(_0x3d6303[_0x83cd('0x2d')]['message']);}})[_0x83cd('0x2e')](function(_0x2a99aa){logger[_0x83cd('0x2b')]('FreshdeskConfiguration,\x20%s,\x20%s',_0x385166,_0x2a99aa);_0x40ba0f(_0x2a99aa);});});}function respondWithStatusCode(_0x30c29e,_0x33bb16){_0x33bb16=_0x33bb16||0xcc;return function(_0x3558fa){if(_0x3558fa){return _0x30c29e[_0x83cd('0x2f')](_0x33bb16);}return _0x30c29e[_0x83cd('0x30')](_0x33bb16)[_0x83cd('0x31')]();};}function respondWithResult(_0x14ab2e,_0x40b03d){_0x40b03d=_0x40b03d||0xc8;return function(_0x5a9899){if(_0x5a9899){return _0x14ab2e[_0x83cd('0x30')](_0x40b03d)[_0x83cd('0x32')](_0x5a9899);}};}function respondWithFilteredResult(_0x55f5c6,_0x3e468e){return function(_0x78734f){if(_0x78734f){var _0x9dbb16=_0x78734f[_0x83cd('0x33')],_0x317546=_0x3e468e[_0x83cd('0x34')],_0x1df0ef=_0x3e468e['offset']+_0x3e468e[_0x83cd('0x35')],_0x3eb69c;if(_0x1df0ef>=_0x9dbb16){_0x1df0ef=_0x9dbb16;_0x3eb69c=0xc8;}else{_0x3eb69c=0xce;}_0x55f5c6[_0x83cd('0x30')](_0x3eb69c);return _0x55f5c6['set'](_0x83cd('0x36'),_0x317546+'-'+_0x1df0ef+'/'+_0x9dbb16)[_0x83cd('0x32')](_0x78734f);}return null;};}function patchUpdates(_0x58cbe8){return function(_0x5eede6){try{jsonpatch['apply'](_0x5eede6,_0x58cbe8,!![]);}catch(_0x418452){return BPromise[_0x83cd('0x37')](_0x418452);}return _0x5eede6['save']();};}function saveUpdates(_0xce66f5,_0x3abd40){return function(_0x256984){if(_0x256984){return _0x256984[_0x83cd('0x38')](_0xce66f5)[_0x83cd('0x25')](function(_0x228f82){return _0x228f82;});}return null;};}function removeEntity(_0x1600ca,_0x27a88a){return function(_0x3a7a1e){if(_0x3a7a1e){return _0x3a7a1e[_0x83cd('0x39')]()[_0x83cd('0x25')](function(){_0x1600ca['status'](0xcc)[_0x83cd('0x31')]();});}};}function handleEntityNotFound(_0x1c9785,_0xbe4d9d){return function(_0x3d26c3){if(!_0x3d26c3){_0x1c9785['sendStatus'](0x194);}return _0x3d26c3;};}function handleError(_0x5edb25,_0x513cf0){_0x513cf0=_0x513cf0||0x1f4;return function(_0x4aec79){logger['error'](_0x4aec79['stack']);if(_0x4aec79['name']){delete _0x4aec79[_0x83cd('0x3a')];}_0x5edb25[_0x83cd('0x30')](_0x513cf0)[_0x83cd('0x3b')](_0x4aec79);};}exports[_0x83cd('0x3c')]=function(_0x40f941,_0x2c87aa){var _0x58a782={},_0x8f801a={},_0x3c2bc9={'count':0x0,'rows':[]};var _0xc4c9f6=_['map'](db[_0x83cd('0x3d')][_0x83cd('0x3e')],function(_0x40a206){return{'name':_0x40a206['fieldName'],'type':_0x40a206['type'][_0x83cd('0x3f')]};});_0x8f801a[_0x83cd('0x40')]=_['map'](_0xc4c9f6,_0x83cd('0x3a'));_0x8f801a[_0x83cd('0x41')]=_[_0x83cd('0x42')](_0x40f941[_0x83cd('0x41')]);_0x8f801a[_0x83cd('0x43')]=_['intersection'](_0x8f801a[_0x83cd('0x40')],_0x8f801a['query']);_0x58a782[_0x83cd('0x44')]=_[_0x83cd('0x45')](_0x8f801a[_0x83cd('0x40')],qs[_0x83cd('0x46')](_0x40f941['query'][_0x83cd('0x46')]));_0x58a782[_0x83cd('0x44')]=_0x58a782['attributes'][_0x83cd('0x47')]?_0x58a782[_0x83cd('0x44')]:_0x8f801a['model'];if(!_0x40f941['query'][_0x83cd('0x48')](_0x83cd('0x49'))){_0x58a782[_0x83cd('0x35')]=qs['limit'](_0x40f941[_0x83cd('0x41')][_0x83cd('0x35')]);_0x58a782[_0x83cd('0x34')]=qs['offset'](_0x40f941['query'][_0x83cd('0x34')]);}_0x58a782[_0x83cd('0x4a')]=qs[_0x83cd('0x4b')](_0x40f941[_0x83cd('0x41')]['sort']);_0x58a782['where']=qs[_0x83cd('0x43')](_[_0x83cd('0x4c')](_0x40f941['query'],_0x8f801a[_0x83cd('0x43')]),_0xc4c9f6);if(_0x40f941[_0x83cd('0x41')]['filter']){_0x58a782[_0x83cd('0x4d')]=_[_0x83cd('0x4e')](_0x58a782[_0x83cd('0x4d')],{'$or':_[_0x83cd('0x4f')](_0xc4c9f6,function(_0x241de0){if(_0x241de0['type']!==_0x83cd('0x50')){var _0x48e259={};_0x48e259[_0x241de0['name']]={'$like':'%'+_0x40f941['query']['filter']+'%'};return _0x48e259;}})});}_0x58a782=_[_0x83cd('0x4e')]({},_0x58a782,_0x40f941['options']);var _0x11ecae={'where':_0x58a782['where']};return db['FreshdeskConfiguration'][_0x83cd('0x33')](_0x11ecae)[_0x83cd('0x25')](function(_0x5edb06){_0x3c2bc9['count']=_0x5edb06;if(_0x40f941[_0x83cd('0x41')][_0x83cd('0x51')]){_0x58a782['include']=[{'all':!![]}];}return db['FreshdeskConfiguration'][_0x83cd('0x52')](_0x58a782);})[_0x83cd('0x25')](function(_0x38c9af){_0x3c2bc9['rows']=_0x38c9af;return _0x3c2bc9;})[_0x83cd('0x25')](respondWithFilteredResult(_0x2c87aa,_0x58a782))[_0x83cd('0x2e')](handleError(_0x2c87aa,null));};exports[_0x83cd('0x53')]=function(_0x3d04a1,_0x1df0d4){var _0x1e01af={'raw':![],'where':{'id':_0x3d04a1[_0x83cd('0x54')]['id']}},_0x130222={};_0x130222[_0x83cd('0x40')]=_['keys'](db[_0x83cd('0x3d')][_0x83cd('0x3e')]);_0x130222['query']=_[_0x83cd('0x42')](_0x3d04a1['query']);_0x130222['filters']=_['intersection'](_0x130222[_0x83cd('0x40')],_0x130222[_0x83cd('0x41')]);_0x1e01af[_0x83cd('0x44')]=_['intersection'](_0x130222[_0x83cd('0x40')],qs[_0x83cd('0x46')](_0x3d04a1['query'][_0x83cd('0x46')]));_0x1e01af['attributes']=_0x1e01af['attributes'][_0x83cd('0x47')]?_0x1e01af[_0x83cd('0x44')]:_0x130222[_0x83cd('0x40')];if(_0x3d04a1[_0x83cd('0x41')][_0x83cd('0x51')]){_0x1e01af[_0x83cd('0x55')]=[{'all':!![]}];}_0x1e01af=_[_0x83cd('0x4e')]({},_0x1e01af,_0x3d04a1['options']);return db[_0x83cd('0x3d')][_0x83cd('0x56')](_0x1e01af)[_0x83cd('0x25')](handleEntityNotFound(_0x1df0d4,null))[_0x83cd('0x25')](respondWithResult(_0x1df0d4,null))[_0x83cd('0x2e')](handleError(_0x1df0d4,null));};exports[_0x83cd('0x57')]=function(_0x5e351a,_0x14c335){return db[_0x83cd('0x3d')][_0x83cd('0x57')](_0x5e351a[_0x83cd('0x58')],{})[_0x83cd('0x25')](respondWithResult(_0x14c335,0xc9))[_0x83cd('0x2e')](handleError(_0x14c335,null));};exports['update']=function(_0x672299,_0x41508d){if(_0x672299[_0x83cd('0x58')]['id']){delete _0x672299[_0x83cd('0x58')]['id'];}return db['FreshdeskConfiguration'][_0x83cd('0x56')]({'where':{'id':_0x672299['params']['id']}})[_0x83cd('0x25')](handleEntityNotFound(_0x41508d,null))[_0x83cd('0x25')](saveUpdates(_0x672299[_0x83cd('0x58')],null))[_0x83cd('0x25')](respondWithResult(_0x41508d,null))[_0x83cd('0x2e')](handleError(_0x41508d,null));};exports['destroy']=function(_0x18997c,_0x202c48){return db[_0x83cd('0x3d')][_0x83cd('0x56')]({'where':{'id':_0x18997c[_0x83cd('0x54')]['id']}})[_0x83cd('0x25')](handleEntityNotFound(_0x202c48,null))[_0x83cd('0x25')](removeEntity(_0x202c48,null))[_0x83cd('0x2e')](handleError(_0x202c48,null));};exports[_0x83cd('0x59')]=function(_0x2591c9,_0x171b38,_0x3a247d){var _0x488e59={};var _0x7675ce={};var _0x31cdf5;var _0x4bb33a;return db[_0x83cd('0x3d')][_0x83cd('0x5a')]({'where':{'id':_0x2591c9['params']['id']}})[_0x83cd('0x25')](handleEntityNotFound(_0x171b38,null))['then'](function(_0x2f0d05){if(_0x2f0d05){_0x31cdf5=_0x2f0d05;_0x7675ce[_0x83cd('0x40')]=_['keys'](db[_0x83cd('0x5b')][_0x83cd('0x3e')]);_0x7675ce[_0x83cd('0x41')]=_['keys'](_0x2591c9[_0x83cd('0x41')]);_0x7675ce[_0x83cd('0x43')]=_['intersection'](_0x7675ce[_0x83cd('0x40')],_0x7675ce[_0x83cd('0x41')]);_0x488e59['attributes']=_['intersection'](_0x7675ce[_0x83cd('0x40')],qs['fields'](_0x2591c9['query'][_0x83cd('0x46')]));_0x488e59[_0x83cd('0x44')]=_0x488e59[_0x83cd('0x44')][_0x83cd('0x47')]?_0x488e59[_0x83cd('0x44')]:_0x7675ce[_0x83cd('0x40')];_0x488e59[_0x83cd('0x4a')]=qs[_0x83cd('0x4b')](_0x2591c9[_0x83cd('0x41')][_0x83cd('0x4b')]);_0x488e59[_0x83cd('0x4d')]=qs[_0x83cd('0x43')](_[_0x83cd('0x4c')](_0x2591c9['query'],_0x7675ce[_0x83cd('0x43')]));if(_0x2591c9[_0x83cd('0x41')][_0x83cd('0x5c')]){_0x488e59['where']=_[_0x83cd('0x4e')](_0x488e59[_0x83cd('0x4d')],{'$or':_[_0x83cd('0x4f')](_0x488e59[_0x83cd('0x44')],function(_0x1e9a0a){var _0x319e7a={};_0x319e7a[_0x1e9a0a]={'$like':'%'+_0x2591c9[_0x83cd('0x41')]['filter']+'%'};return _0x319e7a;})});}_0x488e59=_[_0x83cd('0x4e')]({},_0x488e59,_0x2591c9['options']);return _0x31cdf5[_0x83cd('0x59')](_0x488e59);}})[_0x83cd('0x25')](function(_0x35e8d8){if(_0x35e8d8){_0x4bb33a=_0x35e8d8[_0x83cd('0x47')];if(!_0x2591c9[_0x83cd('0x41')]['hasOwnProperty'](_0x83cd('0x49'))){_0x488e59['limit']=qs[_0x83cd('0x35')](_0x2591c9['query'][_0x83cd('0x35')]);_0x488e59[_0x83cd('0x34')]=qs[_0x83cd('0x34')](_0x2591c9[_0x83cd('0x41')]['offset']);}return _0x31cdf5[_0x83cd('0x59')](_0x488e59);}})[_0x83cd('0x25')](function(_0x4e2aef){if(_0x4e2aef){return _0x4e2aef?{'count':_0x4bb33a,'rows':_0x4e2aef}:null;}})[_0x83cd('0x25')](respondWithResult(_0x171b38,null))[_0x83cd('0x2e')](handleError(_0x171b38,null));};exports[_0x83cd('0x5d')]=function(_0x753451,_0x4f3eba,_0x8d3739){var _0x570239={};var _0x558635={};var _0x2281d5;var _0x2259f3;return db[_0x83cd('0x3d')][_0x83cd('0x5a')]({'where':{'id':_0x753451[_0x83cd('0x54')]['id']}})[_0x83cd('0x25')](handleEntityNotFound(_0x4f3eba,null))['then'](function(_0x2faada){if(_0x2faada){_0x2281d5=_0x2faada;_0x558635[_0x83cd('0x40')]=_[_0x83cd('0x42')](db['FreshdeskField']['rawAttributes']);_0x558635[_0x83cd('0x41')]=_[_0x83cd('0x42')](_0x753451[_0x83cd('0x41')]);_0x558635['filters']=_[_0x83cd('0x45')](_0x558635[_0x83cd('0x40')],_0x558635[_0x83cd('0x41')]);_0x570239[_0x83cd('0x44')]=_[_0x83cd('0x45')](_0x558635[_0x83cd('0x40')],qs[_0x83cd('0x46')](_0x753451[_0x83cd('0x41')][_0x83cd('0x46')]));_0x570239['attributes']=_0x570239[_0x83cd('0x44')][_0x83cd('0x47')]?_0x570239[_0x83cd('0x44')]:_0x558635[_0x83cd('0x40')];_0x570239[_0x83cd('0x4a')]=qs['sort'](_0x753451[_0x83cd('0x41')]['sort']);_0x570239['where']=qs[_0x83cd('0x43')](_[_0x83cd('0x4c')](_0x753451[_0x83cd('0x41')],_0x558635[_0x83cd('0x43')]));if(_0x753451[_0x83cd('0x41')][_0x83cd('0x5c')]){_0x570239['where']=_[_0x83cd('0x4e')](_0x570239[_0x83cd('0x4d')],{'$or':_[_0x83cd('0x4f')](_0x570239[_0x83cd('0x44')],function(_0x715c84){var _0xe0afd4={};_0xe0afd4[_0x715c84]={'$like':'%'+_0x753451['query'][_0x83cd('0x5c')]+'%'};return _0xe0afd4;})});}_0x570239=_['merge']({},_0x570239,_0x753451[_0x83cd('0x5e')]);return _0x2281d5['getSubjects'](_0x570239);}})[_0x83cd('0x25')](function(_0xc60887){if(_0xc60887){_0x2259f3=_0xc60887[_0x83cd('0x47')];if(!_0x753451[_0x83cd('0x41')][_0x83cd('0x48')](_0x83cd('0x49'))){_0x570239[_0x83cd('0x35')]=qs[_0x83cd('0x35')](_0x753451[_0x83cd('0x41')][_0x83cd('0x35')]);_0x570239[_0x83cd('0x34')]=qs[_0x83cd('0x34')](_0x753451['query'][_0x83cd('0x34')]);}return _0x2281d5[_0x83cd('0x5d')](_0x570239);}})[_0x83cd('0x25')](function(_0x485824){if(_0x485824){return _0x485824?{'count':_0x2259f3,'rows':_0x485824}:null;}})[_0x83cd('0x25')](respondWithResult(_0x4f3eba,null))[_0x83cd('0x2e')](handleError(_0x4f3eba,null));};exports['getDescriptions']=function(_0xfceed0,_0x343394,_0x31a47d){var _0x5cc770={};var _0x50460b={};var _0x52440d;var _0x18df75;return db['FreshdeskConfiguration'][_0x83cd('0x5a')]({'where':{'id':_0xfceed0[_0x83cd('0x54')]['id']}})[_0x83cd('0x25')](handleEntityNotFound(_0x343394,null))[_0x83cd('0x25')](function(_0x949740){if(_0x949740){_0x52440d=_0x949740;_0x50460b[_0x83cd('0x40')]=_[_0x83cd('0x42')](db[_0x83cd('0x5b')][_0x83cd('0x3e')]);_0x50460b[_0x83cd('0x41')]=_['keys'](_0xfceed0[_0x83cd('0x41')]);_0x50460b[_0x83cd('0x43')]=_[_0x83cd('0x45')](_0x50460b['model'],_0x50460b[_0x83cd('0x41')]);_0x5cc770[_0x83cd('0x44')]=_[_0x83cd('0x45')](_0x50460b[_0x83cd('0x40')],qs['fields'](_0xfceed0[_0x83cd('0x41')][_0x83cd('0x46')]));_0x5cc770[_0x83cd('0x44')]=_0x5cc770[_0x83cd('0x44')][_0x83cd('0x47')]?_0x5cc770['attributes']:_0x50460b[_0x83cd('0x40')];_0x5cc770[_0x83cd('0x4a')]=qs[_0x83cd('0x4b')](_0xfceed0[_0x83cd('0x41')][_0x83cd('0x4b')]);_0x5cc770['where']=qs[_0x83cd('0x43')](_[_0x83cd('0x4c')](_0xfceed0[_0x83cd('0x41')],_0x50460b[_0x83cd('0x43')]));if(_0xfceed0[_0x83cd('0x41')][_0x83cd('0x5c')]){_0x5cc770[_0x83cd('0x4d')]=_[_0x83cd('0x4e')](_0x5cc770[_0x83cd('0x4d')],{'$or':_[_0x83cd('0x4f')](_0x5cc770[_0x83cd('0x44')],function(_0xee9ec2){var _0x4f3424={};_0x4f3424[_0xee9ec2]={'$like':'%'+_0xfceed0[_0x83cd('0x41')][_0x83cd('0x5c')]+'%'};return _0x4f3424;})});}_0x5cc770=_['merge']({},_0x5cc770,_0xfceed0[_0x83cd('0x5e')]);return _0x52440d[_0x83cd('0x5f')](_0x5cc770);}})['then'](function(_0x204b8c){if(_0x204b8c){_0x18df75=_0x204b8c[_0x83cd('0x47')];if(!_0xfceed0[_0x83cd('0x41')]['hasOwnProperty']('nolimit')){_0x5cc770['limit']=qs[_0x83cd('0x35')](_0xfceed0[_0x83cd('0x41')][_0x83cd('0x35')]);_0x5cc770[_0x83cd('0x34')]=qs[_0x83cd('0x34')](_0xfceed0[_0x83cd('0x41')][_0x83cd('0x34')]);}return _0x52440d[_0x83cd('0x5f')](_0x5cc770);}})['then'](function(_0x4a3cbf){if(_0x4a3cbf){return _0x4a3cbf?{'count':_0x18df75,'rows':_0x4a3cbf}:null;}})[_0x83cd('0x25')](respondWithResult(_0x343394,null))[_0x83cd('0x2e')](handleError(_0x343394,null));};exports['getTags']=function(_0x373fc7,_0x1aed0d,_0x29c1d7){var _0x58f4fe={};var _0x21463c={};var _0x38b4f4;var _0x1cd499;return db['FreshdeskConfiguration'][_0x83cd('0x5a')]({'where':{'id':_0x373fc7['params']['id']}})[_0x83cd('0x25')](handleEntityNotFound(_0x1aed0d,null))['then'](function(_0x3ab840){if(_0x3ab840){_0x38b4f4=_0x3ab840;_0x21463c[_0x83cd('0x40')]=_[_0x83cd('0x42')](db[_0x83cd('0x60')][_0x83cd('0x3e')]);_0x21463c[_0x83cd('0x41')]=_['keys'](_0x373fc7[_0x83cd('0x41')]);_0x21463c['filters']=_[_0x83cd('0x45')](_0x21463c[_0x83cd('0x40')],_0x21463c['query']);_0x58f4fe[_0x83cd('0x44')]=_[_0x83cd('0x45')](_0x21463c['model'],qs[_0x83cd('0x46')](_0x373fc7['query'][_0x83cd('0x46')]));_0x58f4fe[_0x83cd('0x44')]=_0x58f4fe[_0x83cd('0x44')][_0x83cd('0x47')]?_0x58f4fe[_0x83cd('0x44')]:_0x21463c[_0x83cd('0x40')];_0x58f4fe[_0x83cd('0x4a')]=qs[_0x83cd('0x4b')](_0x373fc7[_0x83cd('0x41')]['sort']);_0x58f4fe[_0x83cd('0x4d')]=qs[_0x83cd('0x43')](_[_0x83cd('0x4c')](_0x373fc7[_0x83cd('0x41')],_0x21463c['filters']));if(_0x373fc7[_0x83cd('0x41')]['filter']){_0x58f4fe[_0x83cd('0x4d')]=_[_0x83cd('0x4e')](_0x58f4fe[_0x83cd('0x4d')],{'$or':_[_0x83cd('0x4f')](_0x58f4fe[_0x83cd('0x44')],function(_0x17b240){var _0xed0375={};_0xed0375[_0x17b240]={'$like':'%'+_0x373fc7[_0x83cd('0x41')]['filter']+'%'};return _0xed0375;})});}_0x58f4fe=_[_0x83cd('0x4e')]({},_0x58f4fe,_0x373fc7['options']);return _0x38b4f4['getTags'](_0x58f4fe);}})[_0x83cd('0x25')](function(_0x12bafe){if(_0x12bafe){_0x1cd499=_0x12bafe[_0x83cd('0x47')];if(!_0x373fc7['query']['hasOwnProperty'](_0x83cd('0x49'))){_0x58f4fe[_0x83cd('0x35')]=qs[_0x83cd('0x35')](_0x373fc7[_0x83cd('0x41')][_0x83cd('0x35')]);_0x58f4fe['offset']=qs[_0x83cd('0x34')](_0x373fc7[_0x83cd('0x41')][_0x83cd('0x34')]);}return _0x38b4f4[_0x83cd('0x61')](_0x58f4fe);}})[_0x83cd('0x25')](function(_0x31aa33){if(_0x31aa33){return _0x31aa33?{'count':_0x1cd499,'rows':_0x31aa33}:null;}})[_0x83cd('0x25')](respondWithResult(_0x1aed0d,null))['catch'](handleError(_0x1aed0d,null));};exports[_0x83cd('0x62')]=function(_0x1bd2ff,_0x222d4a,_0x56a931){if(_0x1bd2ff[_0x83cd('0x58')]['id']){delete _0x1bd2ff[_0x83cd('0x58')]['id'];}return db[_0x83cd('0x3d')][_0x83cd('0x5a')]({'where':{'id':_0x1bd2ff['params']['id']}})[_0x83cd('0x25')](handleEntityNotFound(_0x222d4a,null))[_0x83cd('0x25')](function(_0x736436){if(_0x736436){return _0x736436[_0x83cd('0x62')](_0x1bd2ff['body']['ids']||[]);}return null;})['then'](respondWithResult(_0x222d4a,null))[_0x83cd('0x2e')](handleError(_0x222d4a,null));}; \ No newline at end of file +var _0x6075=['keys','filters','fields','length','attributes','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','rows','show','intersection','options','find','create','body','destroy','params','getFields','getSubjects','findOne','FreshdeskField','getDescriptions','getTags','Tag','ids','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/utils','../../config/environment','../../mysqldb','client','http','test','Sequelize','ValidationError','request','then','info','FreshdeskConfiguration,\x20%s,\x20%s','request\x20sent','FreshdeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','status','end','json','count','offset','limit','set','save','update','sendStatus','name','index','FreshdeskConfiguration','rawAttributes','fieldName','type','key','model','map','query'];(function(_0x1e7dea,_0x387392){var _0x181ab8=function(_0xe23965){while(--_0xe23965){_0x1e7dea['push'](_0x1e7dea['shift']());}};_0x181ab8(++_0x387392);}(_0x6075,0x191));var _0x5607=function(_0x434e47,_0x530195){_0x434e47=_0x434e47-0x0;var _0x2acbdc=_0x6075[_0x434e47];return _0x2acbdc;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x5607('0x0'));var rimraf=require(_0x5607('0x1'));var zipdir=require(_0x5607('0x2'));var jsonpatch=require(_0x5607('0x3'));var rp=require(_0x5607('0x4'));var moment=require(_0x5607('0x5'));var BPromise=require(_0x5607('0x6'));var Mustache=require(_0x5607('0x7'));var util=require(_0x5607('0x8'));var path=require('path');var sox=require(_0x5607('0x9'));var csv=require(_0x5607('0xa'));var ejs=require(_0x5607('0xb'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0x5607('0xc'));var jsforce=require(_0x5607('0xd'));var deskjs=require(_0x5607('0xe'));var toCsv=require(_0x5607('0xa'));var querystring=require(_0x5607('0xf'));var Papa=require('papaparse');var Redis=require(_0x5607('0x10'));var authService=require(_0x5607('0x11'));var qs=require(_0x5607('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x5607('0x13'));var logger=require('../../config/logger')('api');var utils=require(_0x5607('0x14'));var config=require(_0x5607('0x15'));var db=require(_0x5607('0x16'))['db'];var jayson=require('jayson/promise');var client=jayson[_0x5607('0x17')][_0x5607('0x18')]({'port':0x232a});function checkPasswordPattern(_0xc534bd,_0x39fc33,_0xe6368d){if(_0xe6368d){var _0x33c436=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x33c436[_0x5607('0x19')](_0x39fc33)){return _0xc534bd;}else{throw new db[(_0x5607('0x1a'))][(_0x5607('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 _0xc534bd;}}function respondWithRpcPromise(_0x1b0720,_0x275c5d,_0xe3e004,_0x505b12){return new BPromise(function(_0x556397,_0x3f149e){var _0x50e498=_0x505b12||client;return _0x50e498[_0x5607('0x1c')](_0x1b0720,_0xe3e004)[_0x5607('0x1d')](function(_0x1fa238){logger[_0x5607('0x1e')](_0x5607('0x1f'),_0x275c5d,_0x5607('0x20'));logger['debug'](_0x5607('0x21'),_0x275c5d,'request\x20sent',JSON[_0x5607('0x22')](_0x1fa238));if(_0x1fa238[_0x5607('0x23')]){if(_0x1fa238[_0x5607('0x23')]['code']===0x1f4){logger[_0x5607('0x23')](_0x5607('0x1f'),_0x275c5d,_0x1fa238[_0x5607('0x23')]['message']);return _0x3f149e(_0x1fa238[_0x5607('0x23')][_0x5607('0x24')]);}logger[_0x5607('0x23')]('FreshdeskConfiguration,\x20%s,\x20%s',_0x275c5d,_0x1fa238[_0x5607('0x23')]['message']);return _0x556397(_0x1fa238['error'][_0x5607('0x24')]);}else{logger[_0x5607('0x1e')](_0x5607('0x1f'),_0x275c5d,_0x5607('0x20'));_0x556397(_0x1fa238[_0x5607('0x25')][_0x5607('0x24')]);}})[_0x5607('0x26')](function(_0x20918c){logger[_0x5607('0x23')](_0x5607('0x1f'),_0x275c5d,_0x20918c);_0x3f149e(_0x20918c);});});}function respondWithStatusCode(_0x593df7,_0x20ae60){_0x20ae60=_0x20ae60||0xcc;return function(_0x27e144){if(_0x27e144){return _0x593df7['sendStatus'](_0x20ae60);}return _0x593df7[_0x5607('0x27')](_0x20ae60)[_0x5607('0x28')]();};}function respondWithResult(_0xdb07c8,_0x400827){_0x400827=_0x400827||0xc8;return function(_0x447042){if(_0x447042){return _0xdb07c8[_0x5607('0x27')](_0x400827)[_0x5607('0x29')](_0x447042);}};}function respondWithFilteredResult(_0x3a6e65,_0x570e62){return function(_0xcd4e9f){if(_0xcd4e9f){var _0x309ede=_0xcd4e9f[_0x5607('0x2a')],_0x51b7d5=_0x570e62[_0x5607('0x2b')],_0x5932ae=_0x570e62[_0x5607('0x2b')]+_0x570e62[_0x5607('0x2c')],_0x12f58f;if(_0x5932ae>=_0x309ede){_0x5932ae=_0x309ede;_0x12f58f=0xc8;}else{_0x12f58f=0xce;}_0x3a6e65['status'](_0x12f58f);return _0x3a6e65[_0x5607('0x2d')]('Content-Range',_0x51b7d5+'-'+_0x5932ae+'/'+_0x309ede)[_0x5607('0x29')](_0xcd4e9f);}return null;};}function patchUpdates(_0x15a1a2){return function(_0x2c90e3){try{jsonpatch['apply'](_0x2c90e3,_0x15a1a2,!![]);}catch(_0x326c51){return BPromise['reject'](_0x326c51);}return _0x2c90e3[_0x5607('0x2e')]();};}function saveUpdates(_0x290982,_0x2f9a0a){return function(_0x1e4fee){if(_0x1e4fee){return _0x1e4fee[_0x5607('0x2f')](_0x290982)['then'](function(_0x3def3e){return _0x3def3e;});}return null;};}function removeEntity(_0x4ccf5b,_0x123f2c){return function(_0x284e22){if(_0x284e22){return _0x284e22['destroy']()[_0x5607('0x1d')](function(){_0x4ccf5b[_0x5607('0x27')](0xcc)[_0x5607('0x28')]();});}};}function handleEntityNotFound(_0x5ee39c,_0x26e651){return function(_0x9e21bd){if(!_0x9e21bd){_0x5ee39c[_0x5607('0x30')](0x194);}return _0x9e21bd;};}function handleError(_0x4ef3c3,_0x5d55cf){_0x5d55cf=_0x5d55cf||0x1f4;return function(_0x3478dc){logger[_0x5607('0x23')](_0x3478dc['stack']);if(_0x3478dc[_0x5607('0x31')]){delete _0x3478dc[_0x5607('0x31')];}_0x4ef3c3[_0x5607('0x27')](_0x5d55cf)['send'](_0x3478dc);};}exports[_0x5607('0x32')]=function(_0x540152,_0x2ed4c2){var _0x287430={},_0x2f7a6d={},_0x4b56bb={'count':0x0,'rows':[]};var _0x5f0df4=_['map'](db[_0x5607('0x33')][_0x5607('0x34')],function(_0x341b93){return{'name':_0x341b93[_0x5607('0x35')],'type':_0x341b93[_0x5607('0x36')][_0x5607('0x37')]};});_0x2f7a6d[_0x5607('0x38')]=_[_0x5607('0x39')](_0x5f0df4,'name');_0x2f7a6d[_0x5607('0x3a')]=_[_0x5607('0x3b')](_0x540152[_0x5607('0x3a')]);_0x2f7a6d[_0x5607('0x3c')]=_['intersection'](_0x2f7a6d[_0x5607('0x38')],_0x2f7a6d[_0x5607('0x3a')]);_0x287430['attributes']=_['intersection'](_0x2f7a6d[_0x5607('0x38')],qs[_0x5607('0x3d')](_0x540152[_0x5607('0x3a')]['fields']));_0x287430['attributes']=_0x287430['attributes'][_0x5607('0x3e')]?_0x287430[_0x5607('0x3f')]:_0x2f7a6d[_0x5607('0x38')];if(!_0x540152['query'][_0x5607('0x40')](_0x5607('0x41'))){_0x287430[_0x5607('0x2c')]=qs[_0x5607('0x2c')](_0x540152[_0x5607('0x3a')][_0x5607('0x2c')]);_0x287430[_0x5607('0x2b')]=qs['offset'](_0x540152['query'][_0x5607('0x2b')]);}_0x287430[_0x5607('0x42')]=qs[_0x5607('0x43')](_0x540152['query'][_0x5607('0x43')]);_0x287430[_0x5607('0x44')]=qs['filters'](_[_0x5607('0x45')](_0x540152[_0x5607('0x3a')],_0x2f7a6d['filters']),_0x5f0df4);if(_0x540152['query'][_0x5607('0x46')]){_0x287430[_0x5607('0x44')]=_[_0x5607('0x47')](_0x287430['where'],{'$or':_[_0x5607('0x39')](_0x5f0df4,function(_0x722d16){if(_0x722d16['type']!==_0x5607('0x48')){var _0x19a596={};_0x19a596[_0x722d16['name']]={'$like':'%'+_0x540152[_0x5607('0x3a')][_0x5607('0x46')]+'%'};return _0x19a596;}})});}_0x287430=_[_0x5607('0x47')]({},_0x287430,_0x540152['options']);var _0x2dd1f8={'where':_0x287430[_0x5607('0x44')]};return db[_0x5607('0x33')][_0x5607('0x2a')](_0x2dd1f8)[_0x5607('0x1d')](function(_0x517cc5){_0x4b56bb[_0x5607('0x2a')]=_0x517cc5;if(_0x540152[_0x5607('0x3a')][_0x5607('0x49')]){_0x287430[_0x5607('0x4a')]=[{'all':!![]}];}return db[_0x5607('0x33')]['findAll'](_0x287430);})[_0x5607('0x1d')](function(_0x5c9b68){_0x4b56bb[_0x5607('0x4b')]=_0x5c9b68;return _0x4b56bb;})[_0x5607('0x1d')](respondWithFilteredResult(_0x2ed4c2,_0x287430))[_0x5607('0x26')](handleError(_0x2ed4c2,null));};exports[_0x5607('0x4c')]=function(_0x1b52b3,_0x416060){var _0x4a904b={'raw':![],'where':{'id':_0x1b52b3['params']['id']}},_0x5c0339={};_0x5c0339[_0x5607('0x38')]=_[_0x5607('0x3b')](db['FreshdeskConfiguration'][_0x5607('0x34')]);_0x5c0339[_0x5607('0x3a')]=_[_0x5607('0x3b')](_0x1b52b3[_0x5607('0x3a')]);_0x5c0339[_0x5607('0x3c')]=_[_0x5607('0x4d')](_0x5c0339[_0x5607('0x38')],_0x5c0339[_0x5607('0x3a')]);_0x4a904b[_0x5607('0x3f')]=_[_0x5607('0x4d')](_0x5c0339[_0x5607('0x38')],qs[_0x5607('0x3d')](_0x1b52b3[_0x5607('0x3a')][_0x5607('0x3d')]));_0x4a904b[_0x5607('0x3f')]=_0x4a904b[_0x5607('0x3f')][_0x5607('0x3e')]?_0x4a904b['attributes']:_0x5c0339[_0x5607('0x38')];if(_0x1b52b3['query'][_0x5607('0x49')]){_0x4a904b[_0x5607('0x4a')]=[{'all':!![]}];}_0x4a904b=_[_0x5607('0x47')]({},_0x4a904b,_0x1b52b3[_0x5607('0x4e')]);return db[_0x5607('0x33')][_0x5607('0x4f')](_0x4a904b)['then'](handleEntityNotFound(_0x416060,null))[_0x5607('0x1d')](respondWithResult(_0x416060,null))['catch'](handleError(_0x416060,null));};exports['create']=function(_0x26c892,_0x46a119){return db[_0x5607('0x33')][_0x5607('0x50')](_0x26c892['body'],{})[_0x5607('0x1d')](respondWithResult(_0x46a119,0xc9))['catch'](handleError(_0x46a119,null));};exports[_0x5607('0x2f')]=function(_0x44fb73,_0x87fed5){if(_0x44fb73[_0x5607('0x51')]['id']){delete _0x44fb73['body']['id'];}return db[_0x5607('0x33')][_0x5607('0x4f')]({'where':{'id':_0x44fb73['params']['id']}})[_0x5607('0x1d')](handleEntityNotFound(_0x87fed5,null))['then'](saveUpdates(_0x44fb73[_0x5607('0x51')],null))[_0x5607('0x1d')](respondWithResult(_0x87fed5,null))[_0x5607('0x26')](handleError(_0x87fed5,null));};exports[_0x5607('0x52')]=function(_0x46a44c,_0x4c6785){return db[_0x5607('0x33')][_0x5607('0x4f')]({'where':{'id':_0x46a44c[_0x5607('0x53')]['id']}})[_0x5607('0x1d')](handleEntityNotFound(_0x4c6785,null))['then'](removeEntity(_0x4c6785,null))[_0x5607('0x26')](handleError(_0x4c6785,null));};exports[_0x5607('0x54')]=function(_0x4fdf0e,_0x4da3f9,_0x42bc03){var _0xb679d3={};var _0x2a1c29={};var _0x352f97;var _0x2721f;return db['FreshdeskConfiguration']['findOne']({'where':{'id':_0x4fdf0e[_0x5607('0x53')]['id']}})['then'](handleEntityNotFound(_0x4da3f9,null))[_0x5607('0x1d')](function(_0x50162a){if(_0x50162a){_0x352f97=_0x50162a;_0x2a1c29['model']=_['keys'](db['FreshdeskField'][_0x5607('0x34')]);_0x2a1c29[_0x5607('0x3a')]=_[_0x5607('0x3b')](_0x4fdf0e[_0x5607('0x3a')]);_0x2a1c29[_0x5607('0x3c')]=_[_0x5607('0x4d')](_0x2a1c29[_0x5607('0x38')],_0x2a1c29['query']);_0xb679d3[_0x5607('0x3f')]=_[_0x5607('0x4d')](_0x2a1c29[_0x5607('0x38')],qs['fields'](_0x4fdf0e[_0x5607('0x3a')][_0x5607('0x3d')]));_0xb679d3['attributes']=_0xb679d3[_0x5607('0x3f')]['length']?_0xb679d3[_0x5607('0x3f')]:_0x2a1c29[_0x5607('0x38')];_0xb679d3['order']=qs[_0x5607('0x43')](_0x4fdf0e[_0x5607('0x3a')][_0x5607('0x43')]);_0xb679d3[_0x5607('0x44')]=qs[_0x5607('0x3c')](_[_0x5607('0x45')](_0x4fdf0e[_0x5607('0x3a')],_0x2a1c29['filters']));if(_0x4fdf0e['query'][_0x5607('0x46')]){_0xb679d3[_0x5607('0x44')]=_[_0x5607('0x47')](_0xb679d3[_0x5607('0x44')],{'$or':_[_0x5607('0x39')](_0xb679d3[_0x5607('0x3f')],function(_0x252ce7){var _0x30d982={};_0x30d982[_0x252ce7]={'$like':'%'+_0x4fdf0e[_0x5607('0x3a')][_0x5607('0x46')]+'%'};return _0x30d982;})});}_0xb679d3=_['merge']({},_0xb679d3,_0x4fdf0e[_0x5607('0x4e')]);return _0x352f97['getFields'](_0xb679d3);}})[_0x5607('0x1d')](function(_0x112e71){if(_0x112e71){_0x2721f=_0x112e71[_0x5607('0x3e')];if(!_0x4fdf0e['query']['hasOwnProperty'](_0x5607('0x41'))){_0xb679d3['limit']=qs['limit'](_0x4fdf0e['query']['limit']);_0xb679d3[_0x5607('0x2b')]=qs[_0x5607('0x2b')](_0x4fdf0e[_0x5607('0x3a')][_0x5607('0x2b')]);}return _0x352f97[_0x5607('0x54')](_0xb679d3);}})[_0x5607('0x1d')](function(_0x3aba9c){if(_0x3aba9c){return _0x3aba9c?{'count':_0x2721f,'rows':_0x3aba9c}:null;}})['then'](respondWithResult(_0x4da3f9,null))[_0x5607('0x26')](handleError(_0x4da3f9,null));};exports[_0x5607('0x55')]=function(_0x39ff6b,_0x3c9502,_0x190a13){var _0x5e746c={};var _0x150dcd={};var _0xf440e3;var _0x37308e;return db['FreshdeskConfiguration'][_0x5607('0x56')]({'where':{'id':_0x39ff6b[_0x5607('0x53')]['id']}})[_0x5607('0x1d')](handleEntityNotFound(_0x3c9502,null))['then'](function(_0x345fbd){if(_0x345fbd){_0xf440e3=_0x345fbd;_0x150dcd[_0x5607('0x38')]=_[_0x5607('0x3b')](db[_0x5607('0x57')]['rawAttributes']);_0x150dcd[_0x5607('0x3a')]=_[_0x5607('0x3b')](_0x39ff6b[_0x5607('0x3a')]);_0x150dcd[_0x5607('0x3c')]=_[_0x5607('0x4d')](_0x150dcd[_0x5607('0x38')],_0x150dcd[_0x5607('0x3a')]);_0x5e746c[_0x5607('0x3f')]=_['intersection'](_0x150dcd['model'],qs[_0x5607('0x3d')](_0x39ff6b[_0x5607('0x3a')][_0x5607('0x3d')]));_0x5e746c[_0x5607('0x3f')]=_0x5e746c[_0x5607('0x3f')][_0x5607('0x3e')]?_0x5e746c['attributes']:_0x150dcd[_0x5607('0x38')];_0x5e746c[_0x5607('0x42')]=qs[_0x5607('0x43')](_0x39ff6b[_0x5607('0x3a')][_0x5607('0x43')]);_0x5e746c[_0x5607('0x44')]=qs[_0x5607('0x3c')](_[_0x5607('0x45')](_0x39ff6b['query'],_0x150dcd[_0x5607('0x3c')]));if(_0x39ff6b[_0x5607('0x3a')]['filter']){_0x5e746c['where']=_[_0x5607('0x47')](_0x5e746c['where'],{'$or':_[_0x5607('0x39')](_0x5e746c['attributes'],function(_0x5e9b53){var _0x212564={};_0x212564[_0x5e9b53]={'$like':'%'+_0x39ff6b[_0x5607('0x3a')]['filter']+'%'};return _0x212564;})});}_0x5e746c=_['merge']({},_0x5e746c,_0x39ff6b[_0x5607('0x4e')]);return _0xf440e3['getSubjects'](_0x5e746c);}})['then'](function(_0x27adef){if(_0x27adef){_0x37308e=_0x27adef[_0x5607('0x3e')];if(!_0x39ff6b[_0x5607('0x3a')]['hasOwnProperty'](_0x5607('0x41'))){_0x5e746c['limit']=qs[_0x5607('0x2c')](_0x39ff6b[_0x5607('0x3a')][_0x5607('0x2c')]);_0x5e746c[_0x5607('0x2b')]=qs[_0x5607('0x2b')](_0x39ff6b['query'][_0x5607('0x2b')]);}return _0xf440e3['getSubjects'](_0x5e746c);}})[_0x5607('0x1d')](function(_0x4a2384){if(_0x4a2384){return _0x4a2384?{'count':_0x37308e,'rows':_0x4a2384}:null;}})[_0x5607('0x1d')](respondWithResult(_0x3c9502,null))[_0x5607('0x26')](handleError(_0x3c9502,null));};exports[_0x5607('0x58')]=function(_0x35f3f6,_0x581cee,_0x1470a6){var _0x866192={};var _0x34e1c3={};var _0x462dd5;var _0x357c25;return db[_0x5607('0x33')][_0x5607('0x56')]({'where':{'id':_0x35f3f6[_0x5607('0x53')]['id']}})[_0x5607('0x1d')](handleEntityNotFound(_0x581cee,null))[_0x5607('0x1d')](function(_0x16e5da){if(_0x16e5da){_0x462dd5=_0x16e5da;_0x34e1c3[_0x5607('0x38')]=_[_0x5607('0x3b')](db[_0x5607('0x57')][_0x5607('0x34')]);_0x34e1c3[_0x5607('0x3a')]=_[_0x5607('0x3b')](_0x35f3f6[_0x5607('0x3a')]);_0x34e1c3['filters']=_[_0x5607('0x4d')](_0x34e1c3['model'],_0x34e1c3[_0x5607('0x3a')]);_0x866192['attributes']=_[_0x5607('0x4d')](_0x34e1c3[_0x5607('0x38')],qs[_0x5607('0x3d')](_0x35f3f6[_0x5607('0x3a')][_0x5607('0x3d')]));_0x866192[_0x5607('0x3f')]=_0x866192[_0x5607('0x3f')][_0x5607('0x3e')]?_0x866192[_0x5607('0x3f')]:_0x34e1c3['model'];_0x866192['order']=qs[_0x5607('0x43')](_0x35f3f6[_0x5607('0x3a')][_0x5607('0x43')]);_0x866192[_0x5607('0x44')]=qs[_0x5607('0x3c')](_[_0x5607('0x45')](_0x35f3f6[_0x5607('0x3a')],_0x34e1c3['filters']));if(_0x35f3f6['query'][_0x5607('0x46')]){_0x866192['where']=_['merge'](_0x866192[_0x5607('0x44')],{'$or':_[_0x5607('0x39')](_0x866192[_0x5607('0x3f')],function(_0x1488ec){var _0x5f672c={};_0x5f672c[_0x1488ec]={'$like':'%'+_0x35f3f6[_0x5607('0x3a')][_0x5607('0x46')]+'%'};return _0x5f672c;})});}_0x866192=_[_0x5607('0x47')]({},_0x866192,_0x35f3f6[_0x5607('0x4e')]);return _0x462dd5[_0x5607('0x58')](_0x866192);}})[_0x5607('0x1d')](function(_0x4a638d){if(_0x4a638d){_0x357c25=_0x4a638d[_0x5607('0x3e')];if(!_0x35f3f6[_0x5607('0x3a')][_0x5607('0x40')](_0x5607('0x41'))){_0x866192[_0x5607('0x2c')]=qs[_0x5607('0x2c')](_0x35f3f6[_0x5607('0x3a')][_0x5607('0x2c')]);_0x866192[_0x5607('0x2b')]=qs['offset'](_0x35f3f6['query']['offset']);}return _0x462dd5[_0x5607('0x58')](_0x866192);}})[_0x5607('0x1d')](function(_0xee9c0b){if(_0xee9c0b){return _0xee9c0b?{'count':_0x357c25,'rows':_0xee9c0b}:null;}})[_0x5607('0x1d')](respondWithResult(_0x581cee,null))[_0x5607('0x26')](handleError(_0x581cee,null));};exports[_0x5607('0x59')]=function(_0x321197,_0x4a6072,_0x3a28cd){var _0x3c8b56={};var _0xad467={};var _0x1e9af2;var _0x265fa3;return db[_0x5607('0x33')][_0x5607('0x56')]({'where':{'id':_0x321197[_0x5607('0x53')]['id']}})[_0x5607('0x1d')](handleEntityNotFound(_0x4a6072,null))[_0x5607('0x1d')](function(_0x3a38f4){if(_0x3a38f4){_0x1e9af2=_0x3a38f4;_0xad467['model']=_[_0x5607('0x3b')](db[_0x5607('0x5a')][_0x5607('0x34')]);_0xad467[_0x5607('0x3a')]=_[_0x5607('0x3b')](_0x321197[_0x5607('0x3a')]);_0xad467['filters']=_[_0x5607('0x4d')](_0xad467[_0x5607('0x38')],_0xad467[_0x5607('0x3a')]);_0x3c8b56[_0x5607('0x3f')]=_['intersection'](_0xad467[_0x5607('0x38')],qs[_0x5607('0x3d')](_0x321197['query']['fields']));_0x3c8b56[_0x5607('0x3f')]=_0x3c8b56['attributes'][_0x5607('0x3e')]?_0x3c8b56['attributes']:_0xad467[_0x5607('0x38')];_0x3c8b56[_0x5607('0x42')]=qs['sort'](_0x321197['query'][_0x5607('0x43')]);_0x3c8b56[_0x5607('0x44')]=qs[_0x5607('0x3c')](_['pick'](_0x321197['query'],_0xad467[_0x5607('0x3c')]));if(_0x321197[_0x5607('0x3a')][_0x5607('0x46')]){_0x3c8b56[_0x5607('0x44')]=_[_0x5607('0x47')](_0x3c8b56['where'],{'$or':_['map'](_0x3c8b56[_0x5607('0x3f')],function(_0x204f8d){var _0x20ed37={};_0x20ed37[_0x204f8d]={'$like':'%'+_0x321197[_0x5607('0x3a')]['filter']+'%'};return _0x20ed37;})});}_0x3c8b56=_[_0x5607('0x47')]({},_0x3c8b56,_0x321197['options']);return _0x1e9af2[_0x5607('0x59')](_0x3c8b56);}})[_0x5607('0x1d')](function(_0x1b5e38){if(_0x1b5e38){_0x265fa3=_0x1b5e38['length'];if(!_0x321197[_0x5607('0x3a')][_0x5607('0x40')](_0x5607('0x41'))){_0x3c8b56[_0x5607('0x2c')]=qs[_0x5607('0x2c')](_0x321197[_0x5607('0x3a')][_0x5607('0x2c')]);_0x3c8b56['offset']=qs['offset'](_0x321197['query'][_0x5607('0x2b')]);}return _0x1e9af2[_0x5607('0x59')](_0x3c8b56);}})['then'](function(_0x492d51){if(_0x492d51){return _0x492d51?{'count':_0x265fa3,'rows':_0x492d51}:null;}})[_0x5607('0x1d')](respondWithResult(_0x4a6072,null))[_0x5607('0x26')](handleError(_0x4a6072,null));};exports['setTags']=function(_0x146aa3,_0x4ac325,_0xaebb49){if(_0x146aa3['body']['id']){delete _0x146aa3['body']['id'];}return db[_0x5607('0x33')][_0x5607('0x56')]({'where':{'id':_0x146aa3['params']['id']}})['then'](handleEntityNotFound(_0x4ac325,null))[_0x5607('0x1d')](function(_0xc0add5){if(_0xc0add5){return _0xc0add5['setTags'](_0x146aa3[_0x5607('0x51')][_0x5607('0x5b')]||[]);}return null;})[_0x5607('0x1d')](respondWithResult(_0x4ac325,null))['catch'](handleError(_0x4ac325,null));}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.model.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.model.js index cd94481..8e080bb 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 _0x5fc3=['lodash','util','api','moment','bluebird','request-promise','path','../../config/environment','./intFreshdeskConfiguration.attributes','exports','define','int_freshdesk_configurations'];(function(_0x42609e,_0x327305){var _0x158166=function(_0x5a9647){while(--_0x5a9647){_0x42609e['push'](_0x42609e['shift']());}};_0x158166(++_0x327305);}(_0x5fc3,0xa8));var _0x35fc=function(_0x39ffd1,_0x299703){_0x39ffd1=_0x39ffd1-0x0;var _0x31267e=_0x5fc3[_0x39ffd1];return _0x31267e;};'use strict';var _=require(_0x35fc('0x0'));var util=require(_0x35fc('0x1'));var logger=require('../../config/logger')(_0x35fc('0x2'));var moment=require(_0x35fc('0x3'));var BPromise=require(_0x35fc('0x4'));var rp=require(_0x35fc('0x5'));var fs=require('fs');var path=require(_0x35fc('0x6'));var rimraf=require('rimraf');var config=require(_0x35fc('0x7'));var attributes=require(_0x35fc('0x8'));module[_0x35fc('0x9')]=function(_0x5b85ad,_0x5754be){return _0x5b85ad[_0x35fc('0xa')]('FreshdeskConfiguration',attributes,{'tableName':_0x35fc('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7fbe=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intFreshdeskConfiguration.attributes','exports','define','FreshdeskConfiguration'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0x7fbe,0x1ec));var _0xe7fb=function(_0xc06638,_0x68dc26){_0xc06638=_0xc06638-0x0;var _0x34e96c=_0x7fbe[_0xc06638];return _0x34e96c;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xe7fb('0x0'))(_0xe7fb('0x1'));var moment=require(_0xe7fb('0x2'));var BPromise=require(_0xe7fb('0x3'));var rp=require(_0xe7fb('0x4'));var fs=require('fs');var path=require(_0xe7fb('0x5'));var rimraf=require(_0xe7fb('0x6'));var config=require(_0xe7fb('0x7'));var attributes=require(_0xe7fb('0x8'));module[_0xe7fb('0x9')]=function(_0x290172,_0x12d1b0){return _0x290172[_0xe7fb('0xa')](_0xe7fb('0xb'),attributes,{'tableName':'int_freshdesk_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.rpc.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.rpc.js index cc15f8a..8079966 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 _0xad82=['stringify','error','message','info','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','request','then','FreshdeskConfiguration,\x20%s,\x20%s','FreshdeskConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent'];(function(_0x433971,_0x16e715){var _0x1d48e1=function(_0x1a94f0){while(--_0x1a94f0){_0x433971['push'](_0x433971['shift']());}};_0x1d48e1(++_0x16e715);}(_0xad82,0xec));var _0x2ad8=function(_0x10a889,_0x220612){_0x10a889=_0x10a889-0x0;var _0x3b5ed3=_0xad82[_0x10a889];return _0x3b5ed3;};'use strict';var _=require(_0x2ad8('0x0'));var util=require(_0x2ad8('0x1'));var moment=require(_0x2ad8('0x2'));var BPromise=require(_0x2ad8('0x3'));var rs=require(_0x2ad8('0x4'));var fs=require('fs');var Redis=require(_0x2ad8('0x5'));var db=require(_0x2ad8('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x2ad8('0x7'))(_0x2ad8('0x8'));var config=require('../../config/environment');var jayson=require(_0x2ad8('0x9'));var client=jayson[_0x2ad8('0xa')][_0x2ad8('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4cb14f,_0x5037b5,_0x26273d){return new BPromise(function(_0x5d6298,_0x493939){return client[_0x2ad8('0xc')](_0x4cb14f,_0x26273d)[_0x2ad8('0xd')](function(_0x79e45a){logger['info'](_0x2ad8('0xe'),_0x5037b5,'request\x20sent');logger['debug'](_0x2ad8('0xf'),_0x5037b5,_0x2ad8('0x10'),JSON[_0x2ad8('0x11')](_0x79e45a));if(_0x79e45a['error']){if(_0x79e45a[_0x2ad8('0x12')]['code']===0x1f4){logger['error']('FreshdeskConfiguration,\x20%s,\x20%s',_0x5037b5,_0x79e45a[_0x2ad8('0x12')][_0x2ad8('0x13')]);return _0x493939(_0x79e45a['error'][_0x2ad8('0x13')]);}logger[_0x2ad8('0x12')](_0x2ad8('0xe'),_0x5037b5,_0x79e45a[_0x2ad8('0x12')][_0x2ad8('0x13')]);return _0x5d6298(_0x79e45a['error'][_0x2ad8('0x13')]);}else{logger[_0x2ad8('0x14')](_0x2ad8('0xe'),_0x5037b5,_0x2ad8('0x10'));_0x5d6298(_0x79e45a[_0x2ad8('0x15')][_0x2ad8('0x13')]);}})[_0x2ad8('0x16')](function(_0xbd066){logger[_0x2ad8('0x12')](_0x2ad8('0xe'),_0x5037b5,_0xbd066);_0x493939(_0xbd066);});});} \ No newline at end of file +var _0xa467=['result','catch','moment','bluebird','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','request','info','FreshdeskConfiguration,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message'];(function(_0x29d94e,_0xf386d6){var _0x106237=function(_0x327501){while(--_0x327501){_0x29d94e['push'](_0x29d94e['shift']());}};_0x106237(++_0xf386d6);}(_0xa467,0x87));var _0x7a46=function(_0x31f495,_0x319897){_0x31f495=_0x31f495-0x0;var _0x1370b3=_0xa467[_0x31f495];return _0x1370b3;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x7a46('0x0'));var BPromise=require(_0x7a46('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x7a46('0x2'))['db'];var utils=require(_0x7a46('0x3'));var logger=require('../../config/logger')(_0x7a46('0x4'));var config=require('../../config/environment');var jayson=require(_0x7a46('0x5'));var client=jayson[_0x7a46('0x6')][_0x7a46('0x7')]({'port':0x232a});function respondWithRpcPromise(_0xc88e64,_0x1ccd6e,_0x42ffb5){return new BPromise(function(_0x2fce3b,_0xde1baf){return client[_0x7a46('0x8')](_0xc88e64,_0x42ffb5)['then'](function(_0x59ac81){logger[_0x7a46('0x9')](_0x7a46('0xa'),_0x1ccd6e,'request\x20sent');logger[_0x7a46('0xb')]('FreshdeskConfiguration,\x20%s,\x20%s,\x20%s',_0x1ccd6e,_0x7a46('0xc'),JSON[_0x7a46('0xd')](_0x59ac81));if(_0x59ac81[_0x7a46('0xe')]){if(_0x59ac81[_0x7a46('0xe')][_0x7a46('0xf')]===0x1f4){logger['error']('FreshdeskConfiguration,\x20%s,\x20%s',_0x1ccd6e,_0x59ac81[_0x7a46('0xe')][_0x7a46('0x10')]);return _0xde1baf(_0x59ac81['error'][_0x7a46('0x10')]);}logger[_0x7a46('0xe')](_0x7a46('0xa'),_0x1ccd6e,_0x59ac81[_0x7a46('0xe')][_0x7a46('0x10')]);return _0x2fce3b(_0x59ac81[_0x7a46('0xe')][_0x7a46('0x10')]);}else{logger[_0x7a46('0x9')](_0x7a46('0xa'),_0x1ccd6e,_0x7a46('0xc'));_0x2fce3b(_0x59ac81[_0x7a46('0x11')][_0x7a46('0x10')]);}})[_0x7a46('0x12')](function(_0x58d402){logger[_0x7a46('0xe')](_0x7a46('0xa'),_0x1ccd6e,_0x58d402);_0xde1baf(_0x58d402);});});} \ No newline at end of file diff --git a/server/api/intFreshdeskField/index.js b/server/api/intFreshdeskField/index.js index 75a1c82..9876d9b 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(_0x5db657,_0x2f40b3){var _0x2d6e70=function(_0x358ed2){while(--_0x358ed2){_0x5db657['push'](_0x5db657['shift']());}};_0x2d6e70(++_0x2f40b3);}(_0x34e8,0x12c));var _0x834e=function(_0x57ec9e,_0x55be7f){_0x57ec9e=_0x57ec9e-0x0;var _0x52c2ee=_0x34e8[_0x57ec9e];return _0x52c2ee;};'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 _0xedd9=['util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','post','create','put','delete','/:id','destroy','exports'];(function(_0x47242d,_0x13f993){var _0x30273a=function(_0x322cd2){while(--_0x322cd2){_0x47242d['push'](_0x47242d['shift']());}};_0x30273a(++_0x13f993);}(_0xedd9,0xfc));var _0x9edd=function(_0x143734,_0x98f1aa){_0x143734=_0x143734-0x0;var _0x4313d1=_0xedd9[_0x143734];return _0x4313d1;};'use strict';var multer=require('multer');var util=require(_0x9edd('0x0'));var path=require(_0x9edd('0x1'));var timeout=require(_0x9edd('0x2'));var express=require(_0x9edd('0x3'));var router=express[_0x9edd('0x4')]();var auth=require(_0x9edd('0x5'));var interaction=require(_0x9edd('0x6'));var config=require(_0x9edd('0x7'));var controller=require('./intFreshdeskField.controller');router[_0x9edd('0x8')]('/',auth[_0x9edd('0x9')](),controller[_0x9edd('0xa')]);router[_0x9edd('0x8')]('/:id',auth[_0x9edd('0x9')](),controller['show']);router[_0x9edd('0xb')]('/',auth[_0x9edd('0x9')](),controller[_0x9edd('0xc')]);router[_0x9edd('0xd')]('/:id',auth[_0x9edd('0x9')](),controller['update']);router[_0x9edd('0xe')](_0x9edd('0xf'),auth['isAuthenticated'](),controller[_0x9edd('0x10')]);module[_0x9edd('0x11')]=router; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.attributes.js b/server/api/intFreshdeskField/intFreshdeskField.attributes.js index 82f51ee..8eee9f4 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 _0x2d97=['BOOLEAN','exports','string','variable','keyValue','STRING','ENUM','customVariable'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0x2d97,0x1f1));var _0x72d9=function(_0x37c2f,_0x2d5b93){_0x37c2f=_0x37c2f-0x0;var _0x1e2529=_0x2d97[_0x37c2f];return _0x1e2529;};'use strict';var Sequelize=require('sequelize');module[_0x72d9('0x0')]={'type':{'type':Sequelize['ENUM'](_0x72d9('0x1'),_0x72d9('0x2'),'customVariable',_0x72d9('0x3')),'defaultValue':_0x72d9('0x1')},'content':{'type':Sequelize[_0x72d9('0x4')]},'key':{'type':Sequelize[_0x72d9('0x4')]},'keyType':{'type':Sequelize[_0x72d9('0x5')](_0x72d9('0x1'),'variable',_0x72d9('0x6'))},'keyContent':{'type':Sequelize[_0x72d9('0x4')]},'idField':{'type':Sequelize[_0x72d9('0x4')]},'nameField':{'type':Sequelize[_0x72d9('0x4')]},'customField':{'type':Sequelize[_0x72d9('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xf7df=['variable','customVariable','STRING','BOOLEAN','sequelize','ENUM','string'];(function(_0x5878b3,_0x5239ae){var _0x200ee4=function(_0x5c0906){while(--_0x5c0906){_0x5878b3['push'](_0x5878b3['shift']());}};_0x200ee4(++_0x5239ae);}(_0xf7df,0x10e));var _0xff7d=function(_0x1aa1dc,_0x2ab261){_0x1aa1dc=_0x1aa1dc-0x0;var _0x4130c8=_0xf7df[_0x1aa1dc];return _0x4130c8;};'use strict';var Sequelize=require(_0xff7d('0x0'));module['exports']={'type':{'type':Sequelize[_0xff7d('0x1')](_0xff7d('0x2'),_0xff7d('0x3'),_0xff7d('0x4'),'keyValue'),'defaultValue':_0xff7d('0x2')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0xff7d('0x5')]},'keyType':{'type':Sequelize[_0xff7d('0x1')]('string',_0xff7d('0x3'),'customVariable')},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0xff7d('0x5')]},'nameField':{'type':Sequelize[_0xff7d('0x5')]},'customField':{'type':Sequelize[_0xff7d('0x6')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xff7d('0x5')]}}; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.controller.js b/server/api/intFreshdeskField/intFreshdeskField.controller.js index 8107947..3744440 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 _0x2781=['query','filters','intersection','attributes','fields','model','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','FreshdeskField','findAll','rows','catch','show','params','keys','length','find','create','body','destroy','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','path','ejs','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','count','offset','limit','set','apply','reject','save','update','then','error','stack','name','send','map','fieldName','type','key'];(function(_0x2f7853,_0x3a0b63){var _0x3af417=function(_0x29eb0e){while(--_0x29eb0e){_0x2f7853['push'](_0x2f7853['shift']());}};_0x3af417(++_0x3a0b63);}(_0x2781,0x65));var _0x1278=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0x2781[_0x3ab51d];return _0x29a04e;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x1278('0x0'));var rimraf=require(_0x1278('0x1'));var zipdir=require(_0x1278('0x2'));var jsonpatch=require(_0x1278('0x3'));var rp=require('request-promise');var moment=require(_0x1278('0x4'));var BPromise=require(_0x1278('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0x1278('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x1278('0x7'));var fs=require('fs');var _=require('lodash');var squel=require(_0x1278('0x8'));var crypto=require('crypto');var jsforce=require(_0x1278('0x9'));var deskjs=require(_0x1278('0xa'));var toCsv=require('to-csv');var querystring=require(_0x1278('0xb'));var Papa=require(_0x1278('0xc'));var Redis=require(_0x1278('0xd'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x1278('0xe'));var hardwareService=require(_0x1278('0xf'));var logger=require(_0x1278('0x10'))(_0x1278('0x11'));var utils=require(_0x1278('0x12'));var config=require(_0x1278('0x13'));var db=require(_0x1278('0x14'))['db'];function respondWithStatusCode(_0x73b643,_0x1f6468){_0x1f6468=_0x1f6468||0xcc;return function(_0x4a1460){if(_0x4a1460){return _0x73b643[_0x1278('0x15')](_0x1f6468);}return _0x73b643[_0x1278('0x16')](_0x1f6468)['end']();};}function respondWithResult(_0x280450,_0x3f575c){_0x3f575c=_0x3f575c||0xc8;return function(_0x3a95dc){if(_0x3a95dc){return _0x280450['status'](_0x3f575c)[_0x1278('0x17')](_0x3a95dc);}};}function respondWithFilteredResult(_0x2c42a2,_0x4713b8){return function(_0x326827){if(_0x326827){var _0xf508f3=_0x326827[_0x1278('0x18')],_0x4df5f8=_0x4713b8[_0x1278('0x19')],_0x1d42dc=_0x4713b8['offset']+_0x4713b8[_0x1278('0x1a')],_0x1acaa4;if(_0x1d42dc>=_0xf508f3){_0x1d42dc=_0xf508f3;_0x1acaa4=0xc8;}else{_0x1acaa4=0xce;}_0x2c42a2[_0x1278('0x16')](_0x1acaa4);return _0x2c42a2[_0x1278('0x1b')]('Content-Range',_0x4df5f8+'-'+_0x1d42dc+'/'+_0xf508f3)[_0x1278('0x17')](_0x326827);}return null;};}function patchUpdates(_0x1825c6){return function(_0x265475){try{jsonpatch[_0x1278('0x1c')](_0x265475,_0x1825c6,!![]);}catch(_0x454d1f){return BPromise[_0x1278('0x1d')](_0x454d1f);}return _0x265475[_0x1278('0x1e')]();};}function saveUpdates(_0x9e7b92,_0x256d0f){return function(_0xe466d8){if(_0xe466d8){return _0xe466d8[_0x1278('0x1f')](_0x9e7b92)[_0x1278('0x20')](function(_0x3ddff7){return _0x3ddff7;});}return null;};}function removeEntity(_0x4b9d60,_0x2ac512){return function(_0x47be0e){if(_0x47be0e){return _0x47be0e['destroy']()[_0x1278('0x20')](function(){_0x4b9d60[_0x1278('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x18b101,_0x328360){return function(_0xc841ec){if(!_0xc841ec){_0x18b101[_0x1278('0x15')](0x194);}return _0xc841ec;};}function handleError(_0x5de090,_0x1accdd){_0x1accdd=_0x1accdd||0x1f4;return function(_0x44aeb4){logger[_0x1278('0x21')](_0x44aeb4[_0x1278('0x22')]);if(_0x44aeb4[_0x1278('0x23')]){delete _0x44aeb4[_0x1278('0x23')];}_0x5de090['status'](_0x1accdd)[_0x1278('0x24')](_0x44aeb4);};}exports['index']=function(_0x27b7e0,_0x52470e){var _0x7eb07b={},_0x4b337a={},_0x2e6774={'count':0x0,'rows':[]};var _0x174b4e=_[_0x1278('0x25')](db['FreshdeskField']['rawAttributes'],function(_0x105d3c){return{'name':_0x105d3c[_0x1278('0x26')],'type':_0x105d3c[_0x1278('0x27')][_0x1278('0x28')]};});_0x4b337a['model']=_['map'](_0x174b4e,_0x1278('0x23'));_0x4b337a['query']=_['keys'](_0x27b7e0[_0x1278('0x29')]);_0x4b337a[_0x1278('0x2a')]=_[_0x1278('0x2b')](_0x4b337a['model'],_0x4b337a['query']);_0x7eb07b[_0x1278('0x2c')]=_[_0x1278('0x2b')](_0x4b337a['model'],qs[_0x1278('0x2d')](_0x27b7e0['query'][_0x1278('0x2d')]));_0x7eb07b['attributes']=_0x7eb07b['attributes']['length']?_0x7eb07b['attributes']:_0x4b337a[_0x1278('0x2e')];if(!_0x27b7e0[_0x1278('0x29')][_0x1278('0x2f')](_0x1278('0x30'))){_0x7eb07b['limit']=qs['limit'](_0x27b7e0[_0x1278('0x29')][_0x1278('0x1a')]);_0x7eb07b[_0x1278('0x19')]=qs[_0x1278('0x19')](_0x27b7e0[_0x1278('0x29')][_0x1278('0x19')]);}_0x7eb07b[_0x1278('0x31')]=qs[_0x1278('0x32')](_0x27b7e0[_0x1278('0x29')]['sort']);_0x7eb07b[_0x1278('0x33')]=qs[_0x1278('0x2a')](_[_0x1278('0x34')](_0x27b7e0[_0x1278('0x29')],_0x4b337a[_0x1278('0x2a')]),_0x174b4e);if(_0x27b7e0[_0x1278('0x29')][_0x1278('0x35')]){_0x7eb07b[_0x1278('0x33')]=_[_0x1278('0x36')](_0x7eb07b[_0x1278('0x33')],{'$or':_[_0x1278('0x25')](_0x174b4e,function(_0x5c9b76){if(_0x5c9b76[_0x1278('0x27')]!==_0x1278('0x37')){var _0x8f6656={};_0x8f6656[_0x5c9b76[_0x1278('0x23')]]={'$like':'%'+_0x27b7e0[_0x1278('0x29')]['filter']+'%'};return _0x8f6656;}})});}_0x7eb07b=_['merge']({},_0x7eb07b,_0x27b7e0[_0x1278('0x38')]);var _0x41063b={'where':_0x7eb07b[_0x1278('0x33')]};return db['FreshdeskField'][_0x1278('0x18')](_0x41063b)[_0x1278('0x20')](function(_0x511af3){_0x2e6774['count']=_0x511af3;if(_0x27b7e0[_0x1278('0x29')][_0x1278('0x39')]){_0x7eb07b[_0x1278('0x3a')]=[{'all':!![]}];}return db[_0x1278('0x3b')][_0x1278('0x3c')](_0x7eb07b);})[_0x1278('0x20')](function(_0x3ab5b8){_0x2e6774[_0x1278('0x3d')]=_0x3ab5b8;return _0x2e6774;})[_0x1278('0x20')](respondWithFilteredResult(_0x52470e,_0x7eb07b))[_0x1278('0x3e')](handleError(_0x52470e,null));};exports[_0x1278('0x3f')]=function(_0x3e2cc9,_0x56217a){var _0x133251={'raw':!![],'where':{'id':_0x3e2cc9[_0x1278('0x40')]['id']}},_0x4eaf67={};_0x4eaf67[_0x1278('0x2e')]=_[_0x1278('0x41')](db[_0x1278('0x3b')]['rawAttributes']);_0x4eaf67[_0x1278('0x29')]=_['keys'](_0x3e2cc9[_0x1278('0x29')]);_0x4eaf67[_0x1278('0x2a')]=_[_0x1278('0x2b')](_0x4eaf67[_0x1278('0x2e')],_0x4eaf67[_0x1278('0x29')]);_0x133251[_0x1278('0x2c')]=_[_0x1278('0x2b')](_0x4eaf67[_0x1278('0x2e')],qs['fields'](_0x3e2cc9[_0x1278('0x29')][_0x1278('0x2d')]));_0x133251[_0x1278('0x2c')]=_0x133251['attributes'][_0x1278('0x42')]?_0x133251[_0x1278('0x2c')]:_0x4eaf67[_0x1278('0x2e')];if(_0x3e2cc9[_0x1278('0x29')][_0x1278('0x39')]){_0x133251[_0x1278('0x3a')]=[{'all':!![]}];}_0x133251=_[_0x1278('0x36')]({},_0x133251,_0x3e2cc9[_0x1278('0x38')]);return db[_0x1278('0x3b')][_0x1278('0x43')](_0x133251)[_0x1278('0x20')](handleEntityNotFound(_0x56217a,null))[_0x1278('0x20')](respondWithResult(_0x56217a,null))[_0x1278('0x3e')](handleError(_0x56217a,null));};exports[_0x1278('0x44')]=function(_0x1a79af,_0x72108d){return db['FreshdeskField'][_0x1278('0x44')](_0x1a79af[_0x1278('0x45')],{})[_0x1278('0x20')](respondWithResult(_0x72108d,0xc9))[_0x1278('0x3e')](handleError(_0x72108d,null));};exports[_0x1278('0x1f')]=function(_0x46bba5,_0x186e9d){if(_0x46bba5['body']['id']){delete _0x46bba5[_0x1278('0x45')]['id'];}return db[_0x1278('0x3b')][_0x1278('0x43')]({'where':{'id':_0x46bba5[_0x1278('0x40')]['id']}})[_0x1278('0x20')](handleEntityNotFound(_0x186e9d,null))['then'](saveUpdates(_0x46bba5[_0x1278('0x45')],null))[_0x1278('0x20')](respondWithResult(_0x186e9d,null))[_0x1278('0x3e')](handleError(_0x186e9d,null));};exports[_0x1278('0x46')]=function(_0x20d38c,_0x5c5637){return db[_0x1278('0x3b')][_0x1278('0x43')]({'where':{'id':_0x20d38c[_0x1278('0x40')]['id']}})[_0x1278('0x20')](handleEntityNotFound(_0x5c5637,null))[_0x1278('0x20')](removeEntity(_0x5c5637,null))[_0x1278('0x3e')](handleError(_0x5c5637,null));}; \ No newline at end of file +var _0x380f=['../../mysqldb','sendStatus','status','end','count','offset','limit','set','Content-Range','json','save','then','error','stack','name','send','map','FreshdeskField','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','where','merge','includeAll','include','findAll','rows','show','params','options','find','catch','create','body','update','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','sox','ejs','lodash','squel','crypto','jsforce','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment'];(function(_0x4a747d,_0x3b747f){var _0x3a5b5c=function(_0x4b3e81){while(--_0x4b3e81){_0x4a747d['push'](_0x4a747d['shift']());}};_0x3a5b5c(++_0x3b747f);}(_0x380f,0x1ed));var _0xf380=function(_0x130a1e,_0x3e86d6){_0x130a1e=_0x130a1e-0x0;var _0x1c8e9e=_0x380f[_0x130a1e];return _0x1c8e9e;};'use strict';var pdf=require(_0xf380('0x0'));var emlformat=require(_0xf380('0x1'));var rimraf=require(_0xf380('0x2'));var zipdir=require(_0xf380('0x3'));var jsonpatch=require(_0xf380('0x4'));var rp=require(_0xf380('0x5'));var moment=require('moment');var BPromise=require(_0xf380('0x6'));var Mustache=require(_0xf380('0x7'));var util=require('util');var path=require(_0xf380('0x8'));var sox=require(_0xf380('0x9'));var csv=require('to-csv');var ejs=require(_0xf380('0xa'));var fs=require('fs');var _=require(_0xf380('0xb'));var squel=require(_0xf380('0xc'));var crypto=require(_0xf380('0xd'));var jsforce=require(_0xf380('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xf380('0xf'));var querystring=require(_0xf380('0x10'));var Papa=require(_0xf380('0x11'));var Redis=require('ioredis');var authService=require(_0xf380('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xf380('0x13'));var hardwareService=require(_0xf380('0x14'));var logger=require(_0xf380('0x15'))(_0xf380('0x16'));var utils=require(_0xf380('0x17'));var config=require(_0xf380('0x18'));var db=require(_0xf380('0x19'))['db'];function respondWithStatusCode(_0x2b7e1b,_0xaceb28){_0xaceb28=_0xaceb28||0xcc;return function(_0x395078){if(_0x395078){return _0x2b7e1b[_0xf380('0x1a')](_0xaceb28);}return _0x2b7e1b[_0xf380('0x1b')](_0xaceb28)[_0xf380('0x1c')]();};}function respondWithResult(_0x1ecc11,_0x54a866){_0x54a866=_0x54a866||0xc8;return function(_0x541da5){if(_0x541da5){return _0x1ecc11[_0xf380('0x1b')](_0x54a866)['json'](_0x541da5);}};}function respondWithFilteredResult(_0x5694c8,_0x10da88){return function(_0x24aeaa){if(_0x24aeaa){var _0x435aab=_0x24aeaa[_0xf380('0x1d')],_0xc09eb1=_0x10da88['offset'],_0x1620f3=_0x10da88[_0xf380('0x1e')]+_0x10da88[_0xf380('0x1f')],_0x95a00e;if(_0x1620f3>=_0x435aab){_0x1620f3=_0x435aab;_0x95a00e=0xc8;}else{_0x95a00e=0xce;}_0x5694c8[_0xf380('0x1b')](_0x95a00e);return _0x5694c8[_0xf380('0x20')](_0xf380('0x21'),_0xc09eb1+'-'+_0x1620f3+'/'+_0x435aab)[_0xf380('0x22')](_0x24aeaa);}return null;};}function patchUpdates(_0x8208d5){return function(_0x3968b9){try{jsonpatch['apply'](_0x3968b9,_0x8208d5,!![]);}catch(_0x3df124){return BPromise['reject'](_0x3df124);}return _0x3968b9[_0xf380('0x23')]();};}function saveUpdates(_0x59a0c8,_0x1d4d4e){return function(_0x2246b2){if(_0x2246b2){return _0x2246b2['update'](_0x59a0c8)[_0xf380('0x24')](function(_0x1b6b59){return _0x1b6b59;});}return null;};}function removeEntity(_0x4c9836,_0x5cf849){return function(_0x56ae92){if(_0x56ae92){return _0x56ae92['destroy']()[_0xf380('0x24')](function(){_0x4c9836[_0xf380('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1ff5c3,_0x53c324){return function(_0x2c1562){if(!_0x2c1562){_0x1ff5c3['sendStatus'](0x194);}return _0x2c1562;};}function handleError(_0x138b6b,_0x3e2260){_0x3e2260=_0x3e2260||0x1f4;return function(_0x581b1c){logger[_0xf380('0x25')](_0x581b1c[_0xf380('0x26')]);if(_0x581b1c[_0xf380('0x27')]){delete _0x581b1c['name'];}_0x138b6b['status'](_0x3e2260)[_0xf380('0x28')](_0x581b1c);};}exports['index']=function(_0x57a03a,_0x31eab8){var _0x5f19e9={},_0x23a22e={},_0x1dfbb5={'count':0x0,'rows':[]};var _0x5e414c=_[_0xf380('0x29')](db[_0xf380('0x2a')][_0xf380('0x2b')],function(_0x1aec70){return{'name':_0x1aec70[_0xf380('0x2c')],'type':_0x1aec70[_0xf380('0x2d')][_0xf380('0x2e')]};});_0x23a22e['model']=_[_0xf380('0x29')](_0x5e414c,_0xf380('0x27'));_0x23a22e[_0xf380('0x2f')]=_[_0xf380('0x30')](_0x57a03a['query']);_0x23a22e[_0xf380('0x31')]=_[_0xf380('0x32')](_0x23a22e[_0xf380('0x33')],_0x23a22e[_0xf380('0x2f')]);_0x5f19e9[_0xf380('0x34')]=_[_0xf380('0x32')](_0x23a22e['model'],qs[_0xf380('0x35')](_0x57a03a['query'][_0xf380('0x35')]));_0x5f19e9['attributes']=_0x5f19e9['attributes'][_0xf380('0x36')]?_0x5f19e9[_0xf380('0x34')]:_0x23a22e[_0xf380('0x33')];if(!_0x57a03a[_0xf380('0x2f')][_0xf380('0x37')](_0xf380('0x38'))){_0x5f19e9[_0xf380('0x1f')]=qs[_0xf380('0x1f')](_0x57a03a[_0xf380('0x2f')][_0xf380('0x1f')]);_0x5f19e9[_0xf380('0x1e')]=qs[_0xf380('0x1e')](_0x57a03a['query'][_0xf380('0x1e')]);}_0x5f19e9[_0xf380('0x39')]=qs[_0xf380('0x3a')](_0x57a03a[_0xf380('0x2f')][_0xf380('0x3a')]);_0x5f19e9['where']=qs[_0xf380('0x31')](_[_0xf380('0x3b')](_0x57a03a[_0xf380('0x2f')],_0x23a22e[_0xf380('0x31')]),_0x5e414c);if(_0x57a03a['query']['filter']){_0x5f19e9[_0xf380('0x3c')]=_[_0xf380('0x3d')](_0x5f19e9['where'],{'$or':_[_0xf380('0x29')](_0x5e414c,function(_0x197d3d){if(_0x197d3d[_0xf380('0x2d')]!=='VIRTUAL'){var _0x3c10c0={};_0x3c10c0[_0x197d3d[_0xf380('0x27')]]={'$like':'%'+_0x57a03a[_0xf380('0x2f')]['filter']+'%'};return _0x3c10c0;}})});}_0x5f19e9=_[_0xf380('0x3d')]({},_0x5f19e9,_0x57a03a['options']);var _0x253c28={'where':_0x5f19e9[_0xf380('0x3c')]};return db[_0xf380('0x2a')][_0xf380('0x1d')](_0x253c28)['then'](function(_0x105d8b){_0x1dfbb5['count']=_0x105d8b;if(_0x57a03a[_0xf380('0x2f')][_0xf380('0x3e')]){_0x5f19e9[_0xf380('0x3f')]=[{'all':!![]}];}return db[_0xf380('0x2a')][_0xf380('0x40')](_0x5f19e9);})[_0xf380('0x24')](function(_0x2f3d8f){_0x1dfbb5[_0xf380('0x41')]=_0x2f3d8f;return _0x1dfbb5;})[_0xf380('0x24')](respondWithFilteredResult(_0x31eab8,_0x5f19e9))['catch'](handleError(_0x31eab8,null));};exports[_0xf380('0x42')]=function(_0x1e27a8,_0x9ab3d9){var _0x272d00={'raw':!![],'where':{'id':_0x1e27a8[_0xf380('0x43')]['id']}},_0x4e111d={};_0x4e111d[_0xf380('0x33')]=_[_0xf380('0x30')](db['FreshdeskField']['rawAttributes']);_0x4e111d[_0xf380('0x2f')]=_[_0xf380('0x30')](_0x1e27a8[_0xf380('0x2f')]);_0x4e111d['filters']=_[_0xf380('0x32')](_0x4e111d[_0xf380('0x33')],_0x4e111d[_0xf380('0x2f')]);_0x272d00['attributes']=_['intersection'](_0x4e111d[_0xf380('0x33')],qs['fields'](_0x1e27a8['query'][_0xf380('0x35')]));_0x272d00[_0xf380('0x34')]=_0x272d00[_0xf380('0x34')][_0xf380('0x36')]?_0x272d00[_0xf380('0x34')]:_0x4e111d[_0xf380('0x33')];if(_0x1e27a8[_0xf380('0x2f')][_0xf380('0x3e')]){_0x272d00[_0xf380('0x3f')]=[{'all':!![]}];}_0x272d00=_[_0xf380('0x3d')]({},_0x272d00,_0x1e27a8[_0xf380('0x44')]);return db[_0xf380('0x2a')][_0xf380('0x45')](_0x272d00)['then'](handleEntityNotFound(_0x9ab3d9,null))[_0xf380('0x24')](respondWithResult(_0x9ab3d9,null))[_0xf380('0x46')](handleError(_0x9ab3d9,null));};exports[_0xf380('0x47')]=function(_0x5a2d5d,_0x555a51){return db[_0xf380('0x2a')][_0xf380('0x47')](_0x5a2d5d[_0xf380('0x48')],{})[_0xf380('0x24')](respondWithResult(_0x555a51,0xc9))[_0xf380('0x46')](handleError(_0x555a51,null));};exports[_0xf380('0x49')]=function(_0x2fb8d1,_0x420d23){if(_0x2fb8d1[_0xf380('0x48')]['id']){delete _0x2fb8d1['body']['id'];}return db['FreshdeskField'][_0xf380('0x45')]({'where':{'id':_0x2fb8d1[_0xf380('0x43')]['id']}})[_0xf380('0x24')](handleEntityNotFound(_0x420d23,null))[_0xf380('0x24')](saveUpdates(_0x2fb8d1[_0xf380('0x48')],null))[_0xf380('0x24')](respondWithResult(_0x420d23,null))[_0xf380('0x46')](handleError(_0x420d23,null));};exports['destroy']=function(_0x1411bf,_0x3aeb17){return db[_0xf380('0x2a')]['find']({'where':{'id':_0x1411bf[_0xf380('0x43')]['id']}})[_0xf380('0x24')](handleEntityNotFound(_0x3aeb17,null))[_0xf380('0x24')](removeEntity(_0x3aeb17,null))['catch'](handleError(_0x3aeb17,null));}; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.model.js b/server/api/intFreshdeskField/intFreshdeskField.model.js index 0f204f4..fbc446a 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 _0xf359=['lodash','util','../../config/logger','path','rimraf','../../config/environment','./intFreshdeskField.attributes','define','int_freshdesk_fields','freshdesk_unique_index','FieldId'];(function(_0x1e4360,_0x930b9b){var _0x31e6b4=function(_0x49dd8e){while(--_0x49dd8e){_0x1e4360['push'](_0x1e4360['shift']());}};_0x31e6b4(++_0x930b9b);}(_0xf359,0x129));var _0x9f35=function(_0xbe6e12,_0x42b2d0){_0xbe6e12=_0xbe6e12-0x0;var _0xb41ba9=_0xf359[_0xbe6e12];return _0xb41ba9;};'use strict';var _=require(_0x9f35('0x0'));var util=require(_0x9f35('0x1'));var logger=require(_0x9f35('0x2'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x9f35('0x3'));var rimraf=require(_0x9f35('0x4'));var config=require(_0x9f35('0x5'));var attributes=require(_0x9f35('0x6'));module['exports']=function(_0x403220,_0x2dd35c){return _0x403220[_0x9f35('0x7')]('FreshdeskField',attributes,{'tableName':_0x9f35('0x8'),'paranoid':![],'indexes':[{'name':_0x9f35('0x9'),'fields':['idField',_0x9f35('0xa')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x494e=['lodash','util','../../config/logger','api','path','rimraf','../../config/environment','define','FreshdeskField','int_freshdesk_fields','freshdesk_unique_index','idField'];(function(_0x2d69e7,_0x3bd855){var _0x53cfb6=function(_0x5112c3){while(--_0x5112c3){_0x2d69e7['push'](_0x2d69e7['shift']());}};_0x53cfb6(++_0x3bd855);}(_0x494e,0x138));var _0xe494=function(_0x43446c,_0x23b7a8){_0x43446c=_0x43446c-0x0;var _0x491333=_0x494e[_0x43446c];return _0x491333;};'use strict';var _=require(_0xe494('0x0'));var util=require(_0xe494('0x1'));var logger=require(_0xe494('0x2'))(_0xe494('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xe494('0x4'));var rimraf=require(_0xe494('0x5'));var config=require(_0xe494('0x6'));var attributes=require('./intFreshdeskField.attributes');module['exports']=function(_0xffac36,_0x16ef61){return _0xffac36[_0xe494('0x7')](_0xe494('0x8'),attributes,{'tableName':_0xe494('0x9'),'paranoid':![],'indexes':[{'name':_0xe494('0xa'),'fields':[_0xe494('0xb'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.rpc.js b/server/api/intFreshdeskField/intFreshdeskField.rpc.js index f33b26d..bd1c71c 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(_0x7e029,_0x4e500a){var _0x21912d=function(_0x2f219d){while(--_0x2f219d){_0x7e029['push'](_0x7e029['shift']());}};_0x21912d(++_0x4e500a);}(_0xb10b,0x12a));var _0xbb10=function(_0x4bfab7,_0x1f92fc){_0x4bfab7=_0x4bfab7-0x0;var _0x232fd7=_0xb10b[_0x4bfab7];return _0x232fd7;};'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(_0x5ce23c,_0x3ceb6d){var _0xa819cc=function(_0x2a4020){while(--_0x2a4020){_0x5ce23c['push'](_0x5ce23c['shift']());}};_0xa819cc(++_0x3ceb6d);}(_0xb10b,0x12a));var _0xbb10=function(_0x542f45,_0x37468a){_0x542f45=_0x542f45-0x0;var _0x38c609=_0xb10b[_0x542f45];return _0x38c609;};'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 69a6ba5..1c88074 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 _0x904f=['getFields','post','create','addConfiguration','put','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./intFreshsalesAccount.controller','get','isAuthenticated','/:id','show','/:id/configurations','/:id/fields'];(function(_0x232e16,_0x1328d3){var _0x29719c=function(_0x2b9aa8){while(--_0x2b9aa8){_0x232e16['push'](_0x232e16['shift']());}};_0x29719c(++_0x1328d3);}(_0x904f,0xe3));var _0xf904=function(_0x4db7c2,_0x2b3466){_0x4db7c2=_0x4db7c2-0x0;var _0x136afe=_0x904f[_0x4db7c2];return _0x136afe;};'use strict';var multer=require(_0xf904('0x0'));var util=require(_0xf904('0x1'));var path=require(_0xf904('0x2'));var timeout=require(_0xf904('0x3'));var express=require(_0xf904('0x4'));var router=express[_0xf904('0x5')]();var auth=require(_0xf904('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xf904('0x7'));var controller=require(_0xf904('0x8'));router[_0xf904('0x9')]('/',auth[_0xf904('0xa')](),controller['index']);router['get'](_0xf904('0xb'),auth['isAuthenticated'](),controller[_0xf904('0xc')]);router[_0xf904('0x9')](_0xf904('0xd'),auth[_0xf904('0xa')](),controller['getConfigurations']);router['get'](_0xf904('0xe'),auth[_0xf904('0xa')](),controller[_0xf904('0xf')]);router[_0xf904('0x10')]('/',auth[_0xf904('0xa')](),controller[_0xf904('0x11')]);router[_0xf904('0x10')]('/:id/configurations',auth[_0xf904('0xa')](),controller[_0xf904('0x12')]);router[_0xf904('0x13')](_0xf904('0xb'),auth['isAuthenticated'](),controller['update']);router['delete']('/:id',auth[_0xf904('0xa')](),controller[_0xf904('0x14')]);module[_0xf904('0x15')]=router; \ No newline at end of file +var _0xce74=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshsalesAccount.controller','get','isAuthenticated','index','/:id','show','/:id/configurations','getConfigurations','/:id/fields','getFields','post','addConfiguration','put','update','destroy','exports','multer','path','connect-timeout','express'];(function(_0x44b38b,_0x4daf41){var _0x5b80f7=function(_0x1e8bc5){while(--_0x1e8bc5){_0x44b38b['push'](_0x44b38b['shift']());}};_0x5b80f7(++_0x4daf41);}(_0xce74,0xec));var _0x4ce7=function(_0x618414,_0x1a7a60){_0x618414=_0x618414-0x0;var _0x21c19a=_0xce74[_0x618414];return _0x21c19a;};'use strict';var multer=require(_0x4ce7('0x0'));var util=require('util');var path=require(_0x4ce7('0x1'));var timeout=require(_0x4ce7('0x2'));var express=require(_0x4ce7('0x3'));var router=express[_0x4ce7('0x4')]();var auth=require(_0x4ce7('0x5'));var interaction=require(_0x4ce7('0x6'));var config=require(_0x4ce7('0x7'));var controller=require(_0x4ce7('0x8'));router[_0x4ce7('0x9')]('/',auth[_0x4ce7('0xa')](),controller[_0x4ce7('0xb')]);router[_0x4ce7('0x9')](_0x4ce7('0xc'),auth[_0x4ce7('0xa')](),controller[_0x4ce7('0xd')]);router['get'](_0x4ce7('0xe'),auth[_0x4ce7('0xa')](),controller[_0x4ce7('0xf')]);router['get'](_0x4ce7('0x10'),auth['isAuthenticated'](),controller[_0x4ce7('0x11')]);router[_0x4ce7('0x12')]('/',auth[_0x4ce7('0xa')](),controller['create']);router[_0x4ce7('0x12')](_0x4ce7('0xe'),auth['isAuthenticated'](),controller[_0x4ce7('0x13')]);router[_0x4ce7('0x14')](_0x4ce7('0xc'),auth[_0x4ce7('0xa')](),controller[_0x4ce7('0x15')]);router['delete'](_0x4ce7('0xc'),auth[_0x4ce7('0xa')](),controller[_0x4ce7('0x16')]);module[_0x4ce7('0x17')]=router; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.attributes.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.attributes.js index 73d6595..d600d40 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 _0xa3db=['STRING','username','remoteUri','sequelize','exports'];(function(_0x1f579d,_0x2a8ef4){var _0x424609=function(_0x3b1893){while(--_0x3b1893){_0x1f579d['push'](_0x1f579d['shift']());}};_0x424609(++_0x2a8ef4);}(_0xa3db,0x10c));var _0xba3d=function(_0x204dc5,_0x6130e5){_0x204dc5=_0x204dc5-0x0;var _0x4bfe65=_0xa3db[_0x204dc5];return _0x4bfe65;};'use strict';var Sequelize=require(_0xba3d('0x0'));module[_0xba3d('0x1')]={'name':{'type':Sequelize[_0xba3d('0x2')]},'description':{'type':Sequelize[_0xba3d('0x2')]},'username':{'type':Sequelize[_0xba3d('0x2')],'unique':_0xba3d('0x3')},'apiKey':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize['STRING'],'unique':_0xba3d('0x4')},'serverUrl':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x556a=['username','remoteUri','sequelize','exports','STRING'];(function(_0x41869c,_0x142214){var _0x571b61=function(_0x45b6b8){while(--_0x45b6b8){_0x41869c['push'](_0x41869c['shift']());}};_0x571b61(++_0x142214);}(_0x556a,0x1dd));var _0xa556=function(_0x54d67e,_0x9ba63f){_0x54d67e=_0x54d67e-0x0;var _0x1e3dc2=_0x556a[_0x54d67e];return _0x1e3dc2;};'use strict';var Sequelize=require(_0xa556('0x0'));module[_0xa556('0x1')]={'name':{'type':Sequelize[_0xa556('0x2')]},'description':{'type':Sequelize[_0xa556('0x2')]},'username':{'type':Sequelize[_0xa556('0x2')],'unique':_0xa556('0x3')},'apiKey':{'type':Sequelize[_0xa556('0x2')]},'remoteUri':{'type':Sequelize[_0xa556('0x2')],'unique':_0xa556('0x4')},'serverUrl':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.controller.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.controller.js index 82e3d6d..8a71f34 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 _0xd3eb=['rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','count','includeAll','include','findAll','show','params','find','create','body','getConfigurations','findOne','FreshsalesConfiguration','pick','Subjects','getSubjects','channel','Descriptions','FreshsalesField','username','remoteUri','slice','lastIndexOf','GET','%s%s','/api/selector/owners','apiKey','users','email','Requested\x20Resource\x20not\x20Found','statusCode','getFields,\x20%s,\x20%s,\x20%s','getFields','Wrong\x20credentials','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../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','FreshsalesAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','code','error','message','result','catch','sendStatus','end','status','offset','limit','set','Content-Range','json','apply','update','destroy','stack','name','send','index','map','FreshsalesAccount'];(function(_0x5f128d,_0x50de2b){var _0x245d2=function(_0x4ff92a){while(--_0x4ff92a){_0x5f128d['push'](_0x5f128d['shift']());}};_0x245d2(++_0x50de2b);}(_0xd3eb,0x1f1));var _0xbd3e=function(_0xfd9b19,_0x21d75f){_0xfd9b19=_0xfd9b19-0x0;var _0x514918=_0xd3eb[_0xfd9b19];return _0x514918;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xbd3e('0x0'));var rimraf=require(_0xbd3e('0x1'));var zipdir=require(_0xbd3e('0x2'));var jsonpatch=require(_0xbd3e('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xbd3e('0x4'));var Mustache=require(_0xbd3e('0x5'));var util=require(_0xbd3e('0x6'));var path=require('path');var sox=require(_0xbd3e('0x7'));var csv=require(_0xbd3e('0x8'));var ejs=require(_0xbd3e('0x9'));var fs=require('fs');var _=require(_0xbd3e('0xa'));var squel=require(_0xbd3e('0xb'));var crypto=require(_0xbd3e('0xc'));var jsforce=require(_0xbd3e('0xd'));var deskjs=require(_0xbd3e('0xe'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xbd3e('0xf'));var Redis=require(_0xbd3e('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xbd3e('0x11'));var as=require(_0xbd3e('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xbd3e('0x13'))(_0xbd3e('0x14'));var utils=require(_0xbd3e('0x15'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];var integrations=require(_0xbd3e('0x16'));var jayson=require('jayson/promise');var client=jayson[_0xbd3e('0x17')][_0xbd3e('0x18')]({'port':0x232a});function checkPasswordPattern(_0x16b088,_0x27ea11,_0x5a75da){if(_0x5a75da){var _0x3816a2=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x3816a2[_0xbd3e('0x19')](_0x27ea11)){return _0x16b088;}else{throw new db[(_0xbd3e('0x1a'))][(_0xbd3e('0x1b'))](_0xbd3e('0x1c'));}}else{return _0x16b088;}}function respondWithRpcPromise(_0x16fa15,_0x4235c3,_0x583ba7,_0x15e1da){return new BPromise(function(_0x4541e2,_0xa084ca){var _0x243cab=_0x15e1da||client;return _0x243cab[_0xbd3e('0x1d')](_0x16fa15,_0x583ba7)[_0xbd3e('0x1e')](function(_0x567461){logger[_0xbd3e('0x1f')](_0xbd3e('0x20'),_0x4235c3,_0xbd3e('0x21'));logger[_0xbd3e('0x22')]('FreshsalesAccount,\x20%s,\x20%s,\x20%s',_0x4235c3,_0xbd3e('0x21'),JSON[_0xbd3e('0x23')](_0x567461));if(_0x567461['error']){if(_0x567461['error'][_0xbd3e('0x24')]===0x1f4){logger['error'](_0xbd3e('0x20'),_0x4235c3,_0x567461[_0xbd3e('0x25')]['message']);return _0xa084ca(_0x567461[_0xbd3e('0x25')][_0xbd3e('0x26')]);}logger[_0xbd3e('0x25')](_0xbd3e('0x20'),_0x4235c3,_0x567461['error'][_0xbd3e('0x26')]);return _0x4541e2(_0x567461[_0xbd3e('0x25')][_0xbd3e('0x26')]);}else{logger[_0xbd3e('0x1f')](_0xbd3e('0x20'),_0x4235c3,'request\x20sent');_0x4541e2(_0x567461[_0xbd3e('0x27')][_0xbd3e('0x26')]);}})[_0xbd3e('0x28')](function(_0x399373){logger[_0xbd3e('0x25')]('FreshsalesAccount,\x20%s,\x20%s',_0x4235c3,_0x399373);_0xa084ca(_0x399373);});});}function respondWithStatusCode(_0x2af765,_0x10c528){_0x10c528=_0x10c528||0xcc;return function(_0x5c8059){if(_0x5c8059){return _0x2af765[_0xbd3e('0x29')](_0x10c528);}return _0x2af765['status'](_0x10c528)[_0xbd3e('0x2a')]();};}function respondWithResult(_0x3c3070,_0xfcaf14){_0xfcaf14=_0xfcaf14||0xc8;return function(_0x1eba24){if(_0x1eba24){return _0x3c3070[_0xbd3e('0x2b')](_0xfcaf14)['json'](_0x1eba24);}};}function respondWithFilteredResult(_0x4889d6,_0x43ab0e){return function(_0x4873fd){if(_0x4873fd){var _0x45de3a=_0x4873fd['count'],_0x6162e5=_0x43ab0e[_0xbd3e('0x2c')],_0x23c258=_0x43ab0e[_0xbd3e('0x2c')]+_0x43ab0e[_0xbd3e('0x2d')],_0x18858f;if(_0x23c258>=_0x45de3a){_0x23c258=_0x45de3a;_0x18858f=0xc8;}else{_0x18858f=0xce;}_0x4889d6['status'](_0x18858f);return _0x4889d6[_0xbd3e('0x2e')](_0xbd3e('0x2f'),_0x6162e5+'-'+_0x23c258+'/'+_0x45de3a)[_0xbd3e('0x30')](_0x4873fd);}return null;};}function patchUpdates(_0x5d21a8){return function(_0x41ea83){try{jsonpatch[_0xbd3e('0x31')](_0x41ea83,_0x5d21a8,!![]);}catch(_0x2c8464){return BPromise['reject'](_0x2c8464);}return _0x41ea83['save']();};}function saveUpdates(_0x867cc3,_0x2f4d01){return function(_0x22201c){if(_0x22201c){return _0x22201c[_0xbd3e('0x32')](_0x867cc3)[_0xbd3e('0x1e')](function(_0x56b17c){return _0x56b17c;});}return null;};}function removeEntity(_0x47d8e4,_0x178474){return function(_0x441909){if(_0x441909){return _0x441909[_0xbd3e('0x33')]()['then'](function(){_0x47d8e4[_0xbd3e('0x2b')](0xcc)[_0xbd3e('0x2a')]();});}};}function handleEntityNotFound(_0x44aead,_0x535347){return function(_0x159d49){if(!_0x159d49){_0x44aead[_0xbd3e('0x29')](0x194);}return _0x159d49;};}function handleError(_0x35933b,_0x54e5c3){_0x54e5c3=_0x54e5c3||0x1f4;return function(_0x4d1257){logger['error'](_0x4d1257[_0xbd3e('0x34')]);if(_0x4d1257[_0xbd3e('0x35')]){delete _0x4d1257['name'];}_0x35933b[_0xbd3e('0x2b')](_0x54e5c3)[_0xbd3e('0x36')](_0x4d1257);};}exports[_0xbd3e('0x37')]=function(_0x39f481,_0x16f7cb){var _0xe40f5={},_0x2c731e={},_0x4ed6e1={'count':0x0,'rows':[]};var _0x2c9fee=_[_0xbd3e('0x38')](db[_0xbd3e('0x39')][_0xbd3e('0x3a')],function(_0x9acb21){return{'name':_0x9acb21[_0xbd3e('0x3b')],'type':_0x9acb21[_0xbd3e('0x3c')]['key']};});_0x2c731e[_0xbd3e('0x3d')]=_['map'](_0x2c9fee,_0xbd3e('0x35'));_0x2c731e[_0xbd3e('0x3e')]=_[_0xbd3e('0x3f')](_0x39f481[_0xbd3e('0x3e')]);_0x2c731e[_0xbd3e('0x40')]=_[_0xbd3e('0x41')](_0x2c731e[_0xbd3e('0x3d')],_0x2c731e['query']);_0xe40f5[_0xbd3e('0x42')]=_['intersection'](_0x2c731e[_0xbd3e('0x3d')],qs['fields'](_0x39f481[_0xbd3e('0x3e')][_0xbd3e('0x43')]));_0xe40f5['attributes']=_0xe40f5[_0xbd3e('0x42')][_0xbd3e('0x44')]?_0xe40f5[_0xbd3e('0x42')]:_0x2c731e[_0xbd3e('0x3d')];if(!_0x39f481[_0xbd3e('0x3e')][_0xbd3e('0x45')](_0xbd3e('0x46'))){_0xe40f5['limit']=qs[_0xbd3e('0x2d')](_0x39f481[_0xbd3e('0x3e')][_0xbd3e('0x2d')]);_0xe40f5['offset']=qs[_0xbd3e('0x2c')](_0x39f481[_0xbd3e('0x3e')][_0xbd3e('0x2c')]);}_0xe40f5[_0xbd3e('0x47')]=qs[_0xbd3e('0x48')](_0x39f481[_0xbd3e('0x3e')][_0xbd3e('0x48')]);_0xe40f5[_0xbd3e('0x49')]=qs[_0xbd3e('0x40')](_['pick'](_0x39f481[_0xbd3e('0x3e')],_0x2c731e[_0xbd3e('0x40')]),_0x2c9fee);if(_0x39f481[_0xbd3e('0x3e')][_0xbd3e('0x4a')]){_0xe40f5[_0xbd3e('0x49')]=_[_0xbd3e('0x4b')](_0xe40f5[_0xbd3e('0x49')],{'$or':_['map'](_0x2c9fee,function(_0x317093){if(_0x317093[_0xbd3e('0x3c')]!==_0xbd3e('0x4c')){var _0x17fc24={};_0x17fc24[_0x317093['name']]={'$like':'%'+_0x39f481['query'][_0xbd3e('0x4a')]+'%'};return _0x17fc24;}})});}_0xe40f5=_[_0xbd3e('0x4b')]({},_0xe40f5,_0x39f481[_0xbd3e('0x4d')]);var _0x24ff53={'where':_0xe40f5[_0xbd3e('0x49')]};return db['FreshsalesAccount'][_0xbd3e('0x4e')](_0x24ff53)['then'](function(_0x310541){_0x4ed6e1[_0xbd3e('0x4e')]=_0x310541;if(_0x39f481[_0xbd3e('0x3e')][_0xbd3e('0x4f')]){_0xe40f5[_0xbd3e('0x50')]=[{'all':!![]}];}return db[_0xbd3e('0x39')][_0xbd3e('0x51')](_0xe40f5);})[_0xbd3e('0x1e')](function(_0x2e9805){_0x4ed6e1['rows']=_0x2e9805;return _0x4ed6e1;})[_0xbd3e('0x1e')](respondWithFilteredResult(_0x16f7cb,_0xe40f5))['catch'](handleError(_0x16f7cb,null));};exports[_0xbd3e('0x52')]=function(_0x3844cb,_0x337bc5){var _0x17d08a={'raw':![],'where':{'id':_0x3844cb[_0xbd3e('0x53')]['id']}},_0x42495e={};_0x42495e['model']=_[_0xbd3e('0x3f')](db[_0xbd3e('0x39')]['rawAttributes']);_0x42495e[_0xbd3e('0x3e')]=_[_0xbd3e('0x3f')](_0x3844cb['query']);_0x42495e[_0xbd3e('0x40')]=_[_0xbd3e('0x41')](_0x42495e[_0xbd3e('0x3d')],_0x42495e[_0xbd3e('0x3e')]);_0x17d08a[_0xbd3e('0x42')]=_[_0xbd3e('0x41')](_0x42495e['model'],qs[_0xbd3e('0x43')](_0x3844cb[_0xbd3e('0x3e')]['fields']));_0x17d08a[_0xbd3e('0x42')]=_0x17d08a[_0xbd3e('0x42')][_0xbd3e('0x44')]?_0x17d08a[_0xbd3e('0x42')]:_0x42495e['model'];if(_0x3844cb[_0xbd3e('0x3e')][_0xbd3e('0x4f')]){_0x17d08a[_0xbd3e('0x50')]=[{'all':!![]}];}_0x17d08a=_[_0xbd3e('0x4b')]({},_0x17d08a,_0x3844cb['options']);return db[_0xbd3e('0x39')][_0xbd3e('0x54')](_0x17d08a)[_0xbd3e('0x1e')](handleEntityNotFound(_0x337bc5,null))[_0xbd3e('0x1e')](respondWithResult(_0x337bc5,null))[_0xbd3e('0x28')](handleError(_0x337bc5,null));};exports['create']=function(_0x50f8cd,_0x1c4dbb){return db[_0xbd3e('0x39')][_0xbd3e('0x55')](_0x50f8cd['body'],{})['then'](respondWithResult(_0x1c4dbb,0xc9))[_0xbd3e('0x28')](handleError(_0x1c4dbb,null));};exports[_0xbd3e('0x32')]=function(_0x321f09,_0x112e8e){if(_0x321f09[_0xbd3e('0x56')]['id']){delete _0x321f09[_0xbd3e('0x56')]['id'];}return db[_0xbd3e('0x39')][_0xbd3e('0x54')]({'where':{'id':_0x321f09[_0xbd3e('0x53')]['id']}})[_0xbd3e('0x1e')](handleEntityNotFound(_0x112e8e,null))['then'](saveUpdates(_0x321f09['body'],null))[_0xbd3e('0x1e')](respondWithResult(_0x112e8e,null))[_0xbd3e('0x28')](handleError(_0x112e8e,null));};exports['destroy']=function(_0x2276d0,_0x590960){return db[_0xbd3e('0x39')][_0xbd3e('0x54')]({'where':{'id':_0x2276d0['params']['id']}})[_0xbd3e('0x1e')](handleEntityNotFound(_0x590960,null))[_0xbd3e('0x1e')](removeEntity(_0x590960,null))[_0xbd3e('0x28')](handleError(_0x590960,null));};exports[_0xbd3e('0x57')]=function(_0x40e5dd,_0x54ad6a,_0x4f5d9a){var _0x41c273={};var _0x122339={};var _0x30a690;var _0x356bff;return db[_0xbd3e('0x39')][_0xbd3e('0x58')]({'where':{'id':_0x40e5dd[_0xbd3e('0x53')]['id']}})['then'](handleEntityNotFound(_0x54ad6a,null))[_0xbd3e('0x1e')](function(_0x4f95f3){if(_0x4f95f3){_0x30a690=_0x4f95f3;_0x122339[_0xbd3e('0x3d')]=_[_0xbd3e('0x3f')](db[_0xbd3e('0x59')]['rawAttributes']);_0x122339['query']=_['keys'](_0x40e5dd[_0xbd3e('0x3e')]);_0x122339[_0xbd3e('0x40')]=_[_0xbd3e('0x41')](_0x122339[_0xbd3e('0x3d')],_0x122339[_0xbd3e('0x3e')]);_0x41c273[_0xbd3e('0x42')]=_[_0xbd3e('0x41')](_0x122339['model'],qs[_0xbd3e('0x43')](_0x40e5dd[_0xbd3e('0x3e')][_0xbd3e('0x43')]));_0x41c273[_0xbd3e('0x42')]=_0x41c273[_0xbd3e('0x42')][_0xbd3e('0x44')]?_0x41c273[_0xbd3e('0x42')]:_0x122339[_0xbd3e('0x3d')];_0x41c273[_0xbd3e('0x47')]=qs[_0xbd3e('0x48')](_0x40e5dd[_0xbd3e('0x3e')][_0xbd3e('0x48')]);_0x41c273[_0xbd3e('0x49')]=qs['filters'](_[_0xbd3e('0x5a')](_0x40e5dd[_0xbd3e('0x3e')],_0x122339[_0xbd3e('0x40')]));if(_0x40e5dd[_0xbd3e('0x3e')]['filter']){_0x41c273[_0xbd3e('0x49')]=_[_0xbd3e('0x4b')](_0x41c273['where'],{'$or':_['map'](_0x41c273['attributes'],function(_0x28b65d){var _0xa077aa={};_0xa077aa[_0x28b65d]={'$like':'%'+_0x40e5dd[_0xbd3e('0x3e')][_0xbd3e('0x4a')]+'%'};return _0xa077aa;})});}_0x41c273=_['merge']({},_0x41c273,_0x40e5dd[_0xbd3e('0x4d')]);return _0x30a690[_0xbd3e('0x57')](_0x41c273);}})['then'](function(_0x1640d0){if(_0x1640d0){_0x356bff=_0x1640d0['length'];if(!_0x40e5dd[_0xbd3e('0x3e')][_0xbd3e('0x45')](_0xbd3e('0x46'))){_0x41c273['limit']=qs[_0xbd3e('0x2d')](_0x40e5dd['query']['limit']);_0x41c273['offset']=qs[_0xbd3e('0x2c')](_0x40e5dd[_0xbd3e('0x3e')][_0xbd3e('0x2c')]);}return _0x30a690[_0xbd3e('0x57')](_0x41c273);}})[_0xbd3e('0x1e')](function(_0x1080ee){if(_0x1080ee){return _0x1080ee?{'count':_0x356bff,'rows':_0x1080ee}:null;}})[_0xbd3e('0x1e')](respondWithResult(_0x54ad6a,null))[_0xbd3e('0x28')](handleError(_0x54ad6a,null));};exports['addConfiguration']=function(_0x1b3c83,_0x5f33c1,_0x3c028f){if(_0x1b3c83[_0xbd3e('0x56')]['id']){delete _0x1b3c83[_0xbd3e('0x56')]['id'];}return db[_0xbd3e('0x39')][_0xbd3e('0x58')]({'where':{'id':_0x1b3c83[_0xbd3e('0x53')]['id']}})['then'](handleEntityNotFound(_0x5f33c1,null))[_0xbd3e('0x1e')](function(_0x1eb040){if(_0x1eb040){_0x1b3c83[_0xbd3e('0x56')]['AccountId']=_0x1eb040['id'];_0x1b3c83['body'][_0xbd3e('0x5b')]=integrations[_0xbd3e('0x5c')](_0x1b3c83[_0xbd3e('0x56')][_0xbd3e('0x5d')],_0x1b3c83['body'][_0xbd3e('0x3c')]);_0x1b3c83['body'][_0xbd3e('0x5e')]=integrations['getDescriptions'](_0x1b3c83[_0xbd3e('0x56')]['channel'],_0x1b3c83[_0xbd3e('0x56')][_0xbd3e('0x3c')]);return db['FreshsalesConfiguration'][_0xbd3e('0x55')](_0x1b3c83[_0xbd3e('0x56')],{'include':[{'model':db['FreshsalesField'],'as':_0xbd3e('0x5b')},{'model':db[_0xbd3e('0x5f')],'as':_0xbd3e('0x5e')}]});}return null;})['then'](respondWithResult(_0x5f33c1,null))[_0xbd3e('0x28')](handleError(_0x5f33c1,null));};exports['getFields']=function(_0x1a8633,_0x2ab9b8,_0xec7a66){var _0x19511d='';var _0x2f83d5='';return db[_0xbd3e('0x39')][_0xbd3e('0x58')]({'where':{'id':_0x1a8633[_0xbd3e('0x53')]['id']},'attributes':['id',_0xbd3e('0x60'),_0xbd3e('0x61'),'apiKey']})[_0xbd3e('0x1e')](handleEntityNotFound(_0x2ab9b8,null))[_0xbd3e('0x1e')](function(_0x4a176a){if(_0x4a176a){_0x2f83d5=_0x4a176a[_0xbd3e('0x60')];_0x19511d=_0x4a176a[_0xbd3e('0x61')];var _0x1654a3=_0x4a176a[_0xbd3e('0x61')][_0xbd3e('0x62')](-0x1);if(_0x1654a3==='/'){_0x19511d=_0x19511d['substring'](0x0,_0x19511d[_0xbd3e('0x63')](_0x1654a3));}return rp({'method':_0xbd3e('0x64'),'uri':util['format'](_0xbd3e('0x65'),_0x19511d,_0xbd3e('0x66')),'headers':{'Authorization':'Token\x20token='+_0x4a176a[_0xbd3e('0x67')]},'json':!![]});}})[_0xbd3e('0x1e')](function(_0x4b0b42){if(_0x4b0b42){var _0x4ddfac=_0x4b0b42[_0xbd3e('0x68')];var _0x337416=![];var _0x3a74e2=null;for(_0x3a74e2=0x0;_0x3a74e2<_0x4ddfac['length'];_0x3a74e2++){if(_0x4ddfac[_0x3a74e2][_0xbd3e('0x69')]===_0x2f83d5){_0x337416=!![];}}if(_0x337416){return!![];}else{throw new Error({'statusCode':0x194,'message':_0xbd3e('0x6a')});}}})[_0xbd3e('0x1e')](respondWithResult(_0x2ab9b8,null))[_0xbd3e('0x28')](function(_0x27730d){var _0x26339e=_0x1a8633[_0xbd3e('0x3e')][_0xbd3e('0x19')]?0x1f4:_0x27730d[_0xbd3e('0x6b')]||0x1f4;logger[_0xbd3e('0x25')](_0xbd3e('0x6c'),_0xbd3e('0x6d'),_0x26339e,JSON['stringify'](_0x27730d));delete _0x27730d[_0xbd3e('0x35')];if(_0x26339e===0x191){_0x26339e=0x190;}_0x2ab9b8[_0xbd3e('0x2b')](_0x26339e)[_0xbd3e('0x36')](_0x1a8633[_0xbd3e('0x3e')]['test']?{'message':_0xbd3e('0x6e'),'statusCode':_0x27730d[_0xbd3e('0x6b')]}:_0x27730d);});}; \ No newline at end of file +var _0x7271=['sort','where','pick','filter','VIRTUAL','merge','options','count','include','findAll','rows','show','params','includeAll','find','create','body','getConfigurations','addConfiguration','findOne','AccountId','Subjects','getSubjects','channel','Descriptions','FreshsalesConfiguration','FreshsalesField','getFields','username','remoteUri','slice','substring','%s%s','/api/selector/owners','Token\x20token=','apiKey','users','email','Requested\x20Resource\x20not\x20Found','getFields,\x20%s,\x20%s,\x20%s','Wrong\x20credentials','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../mysqldb','jayson/promise','client','http','test','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','info','FreshsalesAccount,\x20%s,\x20%s','FreshsalesAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','catch','status','end','json','offset','limit','set','Content-Range','apply','reject','save','then','destroy','stack','name','index','FreshsalesAccount','rawAttributes','fieldName','type','key','model','map','keys','filters','intersection','query','attributes','fields','length','hasOwnProperty','nolimit'];(function(_0x32bbb1,_0xa0e27e){var _0x42b415=function(_0x23f4e2){while(--_0x23f4e2){_0x32bbb1['push'](_0x32bbb1['shift']());}};_0x42b415(++_0xa0e27e);}(_0x7271,0x1ed));var _0x1727=function(_0x254f00,_0x50c844){_0x254f00=_0x254f00-0x0;var _0x7ba98e=_0x7271[_0x254f00];return _0x7ba98e;};'use strict';var pdf=require(_0x1727('0x0'));var emlformat=require(_0x1727('0x1'));var rimraf=require(_0x1727('0x2'));var zipdir=require(_0x1727('0x3'));var jsonpatch=require(_0x1727('0x4'));var rp=require('request-promise');var moment=require(_0x1727('0x5'));var BPromise=require(_0x1727('0x6'));var Mustache=require(_0x1727('0x7'));var util=require(_0x1727('0x8'));var path=require(_0x1727('0x9'));var sox=require('sox');var csv=require(_0x1727('0xa'));var ejs=require(_0x1727('0xb'));var fs=require('fs');var _=require(_0x1727('0xc'));var squel=require(_0x1727('0xd'));var crypto=require(_0x1727('0xe'));var jsforce=require(_0x1727('0xf'));var deskjs=require(_0x1727('0x10'));var toCsv=require('to-csv');var querystring=require(_0x1727('0x11'));var Papa=require('papaparse');var Redis=require(_0x1727('0x12'));var authService=require(_0x1727('0x13'));var qs=require(_0x1727('0x14'));var as=require(_0x1727('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x1727('0x16'))(_0x1727('0x17'));var utils=require('../../config/utils');var config=require(_0x1727('0x18'));var db=require(_0x1727('0x19'))['db'];var integrations=require('../../components/integrations/configuration');var jayson=require(_0x1727('0x1a'));var client=jayson[_0x1727('0x1b')][_0x1727('0x1c')]({'port':0x232a});function checkPasswordPattern(_0x191e4b,_0x3e31f0,_0x264166){if(_0x264166){var _0x24fcb3=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x24fcb3[_0x1727('0x1d')](_0x3e31f0)){return _0x191e4b;}else{throw new db['Sequelize'][(_0x1727('0x1e'))](_0x1727('0x1f'));}}else{return _0x191e4b;}}function respondWithRpcPromise(_0x46afbe,_0x14bd62,_0x258ceb,_0x380a73){return new BPromise(function(_0x42ca39,_0x1f69d1){var _0x453d16=_0x380a73||client;return _0x453d16[_0x1727('0x20')](_0x46afbe,_0x258ceb)['then'](function(_0x19699e){logger[_0x1727('0x21')](_0x1727('0x22'),_0x14bd62,'request\x20sent');logger['debug'](_0x1727('0x23'),_0x14bd62,_0x1727('0x24'),JSON[_0x1727('0x25')](_0x19699e));if(_0x19699e[_0x1727('0x26')]){if(_0x19699e[_0x1727('0x26')]['code']===0x1f4){logger[_0x1727('0x26')](_0x1727('0x22'),_0x14bd62,_0x19699e[_0x1727('0x26')][_0x1727('0x27')]);return _0x1f69d1(_0x19699e['error'][_0x1727('0x27')]);}logger[_0x1727('0x26')](_0x1727('0x22'),_0x14bd62,_0x19699e['error'][_0x1727('0x27')]);return _0x42ca39(_0x19699e[_0x1727('0x26')][_0x1727('0x27')]);}else{logger[_0x1727('0x21')](_0x1727('0x22'),_0x14bd62,'request\x20sent');_0x42ca39(_0x19699e['result'][_0x1727('0x27')]);}})[_0x1727('0x28')](function(_0x2c56dd){logger[_0x1727('0x26')](_0x1727('0x22'),_0x14bd62,_0x2c56dd);_0x1f69d1(_0x2c56dd);});});}function respondWithStatusCode(_0x432a8a,_0x5db9ca){_0x5db9ca=_0x5db9ca||0xcc;return function(_0x4eddc9){if(_0x4eddc9){return _0x432a8a['sendStatus'](_0x5db9ca);}return _0x432a8a[_0x1727('0x29')](_0x5db9ca)[_0x1727('0x2a')]();};}function respondWithResult(_0x1b87c2,_0xa41c6b){_0xa41c6b=_0xa41c6b||0xc8;return function(_0xe5e5ec){if(_0xe5e5ec){return _0x1b87c2['status'](_0xa41c6b)[_0x1727('0x2b')](_0xe5e5ec);}};}function respondWithFilteredResult(_0x53ffc6,_0x502db0){return function(_0x493247){if(_0x493247){var _0x3d33de=_0x493247['count'],_0x4ec26a=_0x502db0[_0x1727('0x2c')],_0x2ee20d=_0x502db0[_0x1727('0x2c')]+_0x502db0[_0x1727('0x2d')],_0x5b1977;if(_0x2ee20d>=_0x3d33de){_0x2ee20d=_0x3d33de;_0x5b1977=0xc8;}else{_0x5b1977=0xce;}_0x53ffc6[_0x1727('0x29')](_0x5b1977);return _0x53ffc6[_0x1727('0x2e')](_0x1727('0x2f'),_0x4ec26a+'-'+_0x2ee20d+'/'+_0x3d33de)[_0x1727('0x2b')](_0x493247);}return null;};}function patchUpdates(_0x3e1f68){return function(_0x2b6533){try{jsonpatch[_0x1727('0x30')](_0x2b6533,_0x3e1f68,!![]);}catch(_0x3a5721){return BPromise[_0x1727('0x31')](_0x3a5721);}return _0x2b6533[_0x1727('0x32')]();};}function saveUpdates(_0x41bbbf,_0x547425){return function(_0x3e7044){if(_0x3e7044){return _0x3e7044['update'](_0x41bbbf)[_0x1727('0x33')](function(_0x5a6e3c){return _0x5a6e3c;});}return null;};}function removeEntity(_0x42dc69,_0x57eccf){return function(_0x784f65){if(_0x784f65){return _0x784f65[_0x1727('0x34')]()[_0x1727('0x33')](function(){_0x42dc69[_0x1727('0x29')](0xcc)[_0x1727('0x2a')]();});}};}function handleEntityNotFound(_0x3dcbdd,_0x5a9639){return function(_0x4ef486){if(!_0x4ef486){_0x3dcbdd['sendStatus'](0x194);}return _0x4ef486;};}function handleError(_0x1253f8,_0x32f030){_0x32f030=_0x32f030||0x1f4;return function(_0x28702f){logger[_0x1727('0x26')](_0x28702f[_0x1727('0x35')]);if(_0x28702f[_0x1727('0x36')]){delete _0x28702f[_0x1727('0x36')];}_0x1253f8['status'](_0x32f030)['send'](_0x28702f);};}exports[_0x1727('0x37')]=function(_0x1aa408,_0x31b60d){var _0x3270c2={},_0x386f32={},_0x235402={'count':0x0,'rows':[]};var _0xdd759=_['map'](db[_0x1727('0x38')][_0x1727('0x39')],function(_0x1fbc8a){return{'name':_0x1fbc8a[_0x1727('0x3a')],'type':_0x1fbc8a[_0x1727('0x3b')][_0x1727('0x3c')]};});_0x386f32[_0x1727('0x3d')]=_[_0x1727('0x3e')](_0xdd759,'name');_0x386f32['query']=_[_0x1727('0x3f')](_0x1aa408['query']);_0x386f32[_0x1727('0x40')]=_[_0x1727('0x41')](_0x386f32[_0x1727('0x3d')],_0x386f32[_0x1727('0x42')]);_0x3270c2[_0x1727('0x43')]=_['intersection'](_0x386f32[_0x1727('0x3d')],qs[_0x1727('0x44')](_0x1aa408[_0x1727('0x42')]['fields']));_0x3270c2[_0x1727('0x43')]=_0x3270c2['attributes'][_0x1727('0x45')]?_0x3270c2[_0x1727('0x43')]:_0x386f32[_0x1727('0x3d')];if(!_0x1aa408[_0x1727('0x42')][_0x1727('0x46')](_0x1727('0x47'))){_0x3270c2[_0x1727('0x2d')]=qs[_0x1727('0x2d')](_0x1aa408['query'][_0x1727('0x2d')]);_0x3270c2['offset']=qs[_0x1727('0x2c')](_0x1aa408['query']['offset']);}_0x3270c2['order']=qs[_0x1727('0x48')](_0x1aa408[_0x1727('0x42')][_0x1727('0x48')]);_0x3270c2[_0x1727('0x49')]=qs[_0x1727('0x40')](_[_0x1727('0x4a')](_0x1aa408['query'],_0x386f32[_0x1727('0x40')]),_0xdd759);if(_0x1aa408[_0x1727('0x42')][_0x1727('0x4b')]){_0x3270c2['where']=_['merge'](_0x3270c2[_0x1727('0x49')],{'$or':_[_0x1727('0x3e')](_0xdd759,function(_0x5aa2fd){if(_0x5aa2fd[_0x1727('0x3b')]!==_0x1727('0x4c')){var _0x2f0a92={};_0x2f0a92[_0x5aa2fd[_0x1727('0x36')]]={'$like':'%'+_0x1aa408['query'][_0x1727('0x4b')]+'%'};return _0x2f0a92;}})});}_0x3270c2=_[_0x1727('0x4d')]({},_0x3270c2,_0x1aa408[_0x1727('0x4e')]);var _0xd371bf={'where':_0x3270c2['where']};return db['FreshsalesAccount'][_0x1727('0x4f')](_0xd371bf)[_0x1727('0x33')](function(_0x1b39d1){_0x235402[_0x1727('0x4f')]=_0x1b39d1;if(_0x1aa408[_0x1727('0x42')]['includeAll']){_0x3270c2[_0x1727('0x50')]=[{'all':!![]}];}return db[_0x1727('0x38')][_0x1727('0x51')](_0x3270c2);})[_0x1727('0x33')](function(_0x45dc30){_0x235402[_0x1727('0x52')]=_0x45dc30;return _0x235402;})[_0x1727('0x33')](respondWithFilteredResult(_0x31b60d,_0x3270c2))[_0x1727('0x28')](handleError(_0x31b60d,null));};exports[_0x1727('0x53')]=function(_0x530b9b,_0x902c59){var _0x2435c7={'raw':![],'where':{'id':_0x530b9b[_0x1727('0x54')]['id']}},_0x815dc4={};_0x815dc4[_0x1727('0x3d')]=_[_0x1727('0x3f')](db[_0x1727('0x38')]['rawAttributes']);_0x815dc4[_0x1727('0x42')]=_['keys'](_0x530b9b[_0x1727('0x42')]);_0x815dc4[_0x1727('0x40')]=_['intersection'](_0x815dc4[_0x1727('0x3d')],_0x815dc4[_0x1727('0x42')]);_0x2435c7[_0x1727('0x43')]=_[_0x1727('0x41')](_0x815dc4['model'],qs[_0x1727('0x44')](_0x530b9b[_0x1727('0x42')][_0x1727('0x44')]));_0x2435c7['attributes']=_0x2435c7[_0x1727('0x43')][_0x1727('0x45')]?_0x2435c7[_0x1727('0x43')]:_0x815dc4[_0x1727('0x3d')];if(_0x530b9b[_0x1727('0x42')][_0x1727('0x55')]){_0x2435c7[_0x1727('0x50')]=[{'all':!![]}];}_0x2435c7=_['merge']({},_0x2435c7,_0x530b9b['options']);return db[_0x1727('0x38')][_0x1727('0x56')](_0x2435c7)[_0x1727('0x33')](handleEntityNotFound(_0x902c59,null))[_0x1727('0x33')](respondWithResult(_0x902c59,null))[_0x1727('0x28')](handleError(_0x902c59,null));};exports[_0x1727('0x57')]=function(_0x1ea7f5,_0x384761){return db[_0x1727('0x38')][_0x1727('0x57')](_0x1ea7f5[_0x1727('0x58')],{})[_0x1727('0x33')](respondWithResult(_0x384761,0xc9))[_0x1727('0x28')](handleError(_0x384761,null));};exports['update']=function(_0x25b99b,_0x5b72e3){if(_0x25b99b[_0x1727('0x58')]['id']){delete _0x25b99b[_0x1727('0x58')]['id'];}return db[_0x1727('0x38')]['find']({'where':{'id':_0x25b99b[_0x1727('0x54')]['id']}})[_0x1727('0x33')](handleEntityNotFound(_0x5b72e3,null))[_0x1727('0x33')](saveUpdates(_0x25b99b[_0x1727('0x58')],null))[_0x1727('0x33')](respondWithResult(_0x5b72e3,null))[_0x1727('0x28')](handleError(_0x5b72e3,null));};exports['destroy']=function(_0x36ba88,_0x3fae45){return db[_0x1727('0x38')][_0x1727('0x56')]({'where':{'id':_0x36ba88[_0x1727('0x54')]['id']}})[_0x1727('0x33')](handleEntityNotFound(_0x3fae45,null))[_0x1727('0x33')](removeEntity(_0x3fae45,null))['catch'](handleError(_0x3fae45,null));};exports[_0x1727('0x59')]=function(_0x3166ad,_0x3108a6,_0x5b86de){var _0x2dfdb9={};var _0x4ee735={};var _0x1a1c0d;var _0x31296a;return db[_0x1727('0x38')]['findOne']({'where':{'id':_0x3166ad['params']['id']}})['then'](handleEntityNotFound(_0x3108a6,null))[_0x1727('0x33')](function(_0x4ab5d6){if(_0x4ab5d6){_0x1a1c0d=_0x4ab5d6;_0x4ee735[_0x1727('0x3d')]=_[_0x1727('0x3f')](db['FreshsalesConfiguration']['rawAttributes']);_0x4ee735[_0x1727('0x42')]=_[_0x1727('0x3f')](_0x3166ad[_0x1727('0x42')]);_0x4ee735[_0x1727('0x40')]=_['intersection'](_0x4ee735[_0x1727('0x3d')],_0x4ee735[_0x1727('0x42')]);_0x2dfdb9[_0x1727('0x43')]=_[_0x1727('0x41')](_0x4ee735[_0x1727('0x3d')],qs['fields'](_0x3166ad[_0x1727('0x42')][_0x1727('0x44')]));_0x2dfdb9[_0x1727('0x43')]=_0x2dfdb9[_0x1727('0x43')][_0x1727('0x45')]?_0x2dfdb9[_0x1727('0x43')]:_0x4ee735[_0x1727('0x3d')];_0x2dfdb9['order']=qs[_0x1727('0x48')](_0x3166ad['query'][_0x1727('0x48')]);_0x2dfdb9['where']=qs[_0x1727('0x40')](_[_0x1727('0x4a')](_0x3166ad[_0x1727('0x42')],_0x4ee735[_0x1727('0x40')]));if(_0x3166ad[_0x1727('0x42')][_0x1727('0x4b')]){_0x2dfdb9[_0x1727('0x49')]=_['merge'](_0x2dfdb9['where'],{'$or':_[_0x1727('0x3e')](_0x2dfdb9['attributes'],function(_0x363828){var _0x55da69={};_0x55da69[_0x363828]={'$like':'%'+_0x3166ad['query']['filter']+'%'};return _0x55da69;})});}_0x2dfdb9=_['merge']({},_0x2dfdb9,_0x3166ad[_0x1727('0x4e')]);return _0x1a1c0d[_0x1727('0x59')](_0x2dfdb9);}})[_0x1727('0x33')](function(_0xd137d0){if(_0xd137d0){_0x31296a=_0xd137d0[_0x1727('0x45')];if(!_0x3166ad['query'][_0x1727('0x46')](_0x1727('0x47'))){_0x2dfdb9[_0x1727('0x2d')]=qs[_0x1727('0x2d')](_0x3166ad[_0x1727('0x42')]['limit']);_0x2dfdb9[_0x1727('0x2c')]=qs['offset'](_0x3166ad[_0x1727('0x42')][_0x1727('0x2c')]);}return _0x1a1c0d[_0x1727('0x59')](_0x2dfdb9);}})[_0x1727('0x33')](function(_0x20871b){if(_0x20871b){return _0x20871b?{'count':_0x31296a,'rows':_0x20871b}:null;}})[_0x1727('0x33')](respondWithResult(_0x3108a6,null))[_0x1727('0x28')](handleError(_0x3108a6,null));};exports[_0x1727('0x5a')]=function(_0x2da3e8,_0x4db080,_0x5c1f43){if(_0x2da3e8[_0x1727('0x58')]['id']){delete _0x2da3e8[_0x1727('0x58')]['id'];}return db[_0x1727('0x38')][_0x1727('0x5b')]({'where':{'id':_0x2da3e8[_0x1727('0x54')]['id']}})['then'](handleEntityNotFound(_0x4db080,null))[_0x1727('0x33')](function(_0x3c54f8){if(_0x3c54f8){_0x2da3e8['body'][_0x1727('0x5c')]=_0x3c54f8['id'];_0x2da3e8['body'][_0x1727('0x5d')]=integrations[_0x1727('0x5e')](_0x2da3e8['body'][_0x1727('0x5f')],_0x2da3e8[_0x1727('0x58')][_0x1727('0x3b')]);_0x2da3e8[_0x1727('0x58')][_0x1727('0x60')]=integrations['getDescriptions'](_0x2da3e8['body'][_0x1727('0x5f')],_0x2da3e8[_0x1727('0x58')][_0x1727('0x3b')]);return db[_0x1727('0x61')]['create'](_0x2da3e8[_0x1727('0x58')],{'include':[{'model':db[_0x1727('0x62')],'as':_0x1727('0x5d')},{'model':db[_0x1727('0x62')],'as':_0x1727('0x60')}]});}return null;})[_0x1727('0x33')](respondWithResult(_0x4db080,null))[_0x1727('0x28')](handleError(_0x4db080,null));};exports[_0x1727('0x63')]=function(_0x2973e8,_0x4745d9,_0x582f1e){var _0x24c27c='';var _0x3e1d26='';return db['FreshsalesAccount']['findOne']({'where':{'id':_0x2973e8[_0x1727('0x54')]['id']},'attributes':['id',_0x1727('0x64'),_0x1727('0x65'),'apiKey']})[_0x1727('0x33')](handleEntityNotFound(_0x4745d9,null))[_0x1727('0x33')](function(_0x4f5d29){if(_0x4f5d29){_0x3e1d26=_0x4f5d29[_0x1727('0x64')];_0x24c27c=_0x4f5d29[_0x1727('0x65')];var _0x2a9f65=_0x4f5d29['remoteUri'][_0x1727('0x66')](-0x1);if(_0x2a9f65==='/'){_0x24c27c=_0x24c27c[_0x1727('0x67')](0x0,_0x24c27c['lastIndexOf'](_0x2a9f65));}return rp({'method':'GET','uri':util['format'](_0x1727('0x68'),_0x24c27c,_0x1727('0x69')),'headers':{'Authorization':_0x1727('0x6a')+_0x4f5d29[_0x1727('0x6b')]},'json':!![]});}})[_0x1727('0x33')](function(_0xd6441d){if(_0xd6441d){var _0x14ffab=_0xd6441d[_0x1727('0x6c')];var _0x4f1fd5=![];var _0x22b2f0=null;for(_0x22b2f0=0x0;_0x22b2f0<_0x14ffab[_0x1727('0x45')];_0x22b2f0++){if(_0x14ffab[_0x22b2f0][_0x1727('0x6d')]===_0x3e1d26){_0x4f1fd5=!![];}}if(_0x4f1fd5){return!![];}else{throw new Error({'statusCode':0x194,'message':_0x1727('0x6e')});}}})[_0x1727('0x33')](respondWithResult(_0x4745d9,null))[_0x1727('0x28')](function(_0x444bbd){var _0x463721=_0x2973e8[_0x1727('0x42')][_0x1727('0x1d')]?0x1f4:_0x444bbd['statusCode']||0x1f4;logger[_0x1727('0x26')](_0x1727('0x6f'),_0x1727('0x63'),_0x463721,JSON['stringify'](_0x444bbd));delete _0x444bbd['name'];if(_0x463721===0x191){_0x463721=0x190;}_0x4745d9[_0x1727('0x29')](_0x463721)['send'](_0x2973e8[_0x1727('0x42')][_0x1727('0x1d')]?{'message':_0x1727('0x70'),'statusCode':_0x444bbd['statusCode']}:_0x444bbd);});}; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.model.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.model.js index 9da7694..d223054 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 _0x4bc3=['rimraf','../../config/environment','./intFreshsalesAccount.attributes','../../components/integrations/configuration','exports','int_freshsales_accounts','lodash','util','api','moment','request-promise','path'];(function(_0x24259d,_0x64a194){var _0x5a701=function(_0x204516){while(--_0x204516){_0x24259d['push'](_0x24259d['shift']());}};_0x5a701(++_0x64a194);}(_0x4bc3,0x16e));var _0x34bc=function(_0x3b0731,_0xcf9925){_0x3b0731=_0x3b0731-0x0;var _0x4204d7=_0x4bc3[_0x3b0731];return _0x4204d7;};'use strict';var _=require(_0x34bc('0x0'));var util=require(_0x34bc('0x1'));var logger=require('../../config/logger')(_0x34bc('0x2'));var moment=require(_0x34bc('0x3'));var BPromise=require('bluebird');var rp=require(_0x34bc('0x4'));var fs=require('fs');var path=require(_0x34bc('0x5'));var rimraf=require(_0x34bc('0x6'));var config=require(_0x34bc('0x7'));var attributes=require(_0x34bc('0x8'));var integrations=require(_0x34bc('0x9'));module[_0x34bc('0xa')]=function(_0x4c63a1,_0x21451b){return _0x4c63a1['define']('FreshsalesAccount',attributes,{'tableName':_0x34bc('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4b84=['rimraf','../../config/environment','define','int_freshsales_accounts','lodash','util','moment','path'];(function(_0x25e903,_0x56e206){var _0xd19732=function(_0x21cb8f){while(--_0x21cb8f){_0x25e903['push'](_0x25e903['shift']());}};_0xd19732(++_0x56e206);}(_0x4b84,0x1cc));var _0x44b8=function(_0x45346d,_0xffd56b){_0x45346d=_0x45346d-0x0;var _0x5ce7ca=_0x4b84[_0x45346d];return _0x5ce7ca;};'use strict';var _=require(_0x44b8('0x0'));var util=require(_0x44b8('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x44b8('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x44b8('0x3'));var rimraf=require(_0x44b8('0x4'));var config=require(_0x44b8('0x5'));var attributes=require('./intFreshsalesAccount.attributes');var integrations=require('../../components/integrations/configuration');module['exports']=function(_0x996a8b,_0x54274b){return _0x996a8b[_0x44b8('0x6')]('FreshsalesAccount',attributes,{'tableName':_0x44b8('0x7'),'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 6e495e9..97d03cc 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 _0xafcd=['debug','FreshsalesAccount,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','GetFreshsalesAccount','FreshsalesAccount','findAll','options','raw','where','attributes','map','include','model','stringify','ShowFreshsalesAccount','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','request','then','info','FreshsalesAccount,\x20%s,\x20%s','request\x20sent'];(function(_0x5614cb,_0x523e23){var _0xa68aa1=function(_0x3eac8f){while(--_0x3eac8f){_0x5614cb['push'](_0x5614cb['shift']());}};_0xa68aa1(++_0x523e23);}(_0xafcd,0x157));var _0xdafc=function(_0x37464d,_0x29bf11){_0x37464d=_0x37464d-0x0;var _0x4e7573=_0xafcd[_0x37464d];return _0x4e7573;};'use strict';var _=require(_0xdafc('0x0'));var util=require(_0xdafc('0x1'));var moment=require(_0xdafc('0x2'));var BPromise=require(_0xdafc('0x3'));var rs=require(_0xdafc('0x4'));var fs=require('fs');var Redis=require(_0xdafc('0x5'));var db=require(_0xdafc('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xdafc('0x7'))(_0xdafc('0x8'));var config=require(_0xdafc('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xdafc('0xa')][_0xdafc('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x33adc9,_0x52872c,_0x24f2e7){return new BPromise(function(_0x255125,_0x397db6){return client[_0xdafc('0xc')](_0x33adc9,_0x24f2e7)[_0xdafc('0xd')](function(_0x241787){logger[_0xdafc('0xe')](_0xdafc('0xf'),_0x52872c,_0xdafc('0x10'));logger[_0xdafc('0x11')](_0xdafc('0x12'),_0x52872c,'request\x20sent',JSON['stringify'](_0x241787));if(_0x241787[_0xdafc('0x13')]){if(_0x241787[_0xdafc('0x13')][_0xdafc('0x14')]===0x1f4){logger[_0xdafc('0x13')](_0xdafc('0xf'),_0x52872c,_0x241787['error']['message']);return _0x397db6(_0x241787['error'][_0xdafc('0x15')]);}logger['error'](_0xdafc('0xf'),_0x52872c,_0x241787['error'][_0xdafc('0x15')]);return _0x255125(_0x241787[_0xdafc('0x13')][_0xdafc('0x15')]);}else{logger[_0xdafc('0xe')]('FreshsalesAccount,\x20%s,\x20%s',_0x52872c,'request\x20sent');_0x255125(_0x241787[_0xdafc('0x16')][_0xdafc('0x15')]);}})[_0xdafc('0x17')](function(_0x5bfac1){logger['error'](_0xdafc('0xf'),_0x52872c,_0x5bfac1);_0x397db6(_0x5bfac1);});});}exports[_0xdafc('0x18')]=function(_0xdab843){var _0x2fef1b=this;return new Promise(function(_0x17136e,_0x3d2274){return db[_0xdafc('0x19')][_0xdafc('0x1a')]({'raw':_0xdab843['options']?_0xdab843[_0xdafc('0x1b')][_0xdafc('0x1c')]===undefined?!![]:![]:!![],'where':_0xdab843['options']?_0xdab843[_0xdafc('0x1b')][_0xdafc('0x1d')]||null:null,'attributes':_0xdab843[_0xdafc('0x1b')]?_0xdab843[_0xdafc('0x1b')][_0xdafc('0x1e')]||null:null,'limit':_0xdab843[_0xdafc('0x1b')]?_0xdab843['options']['limit']||null:null,'include':_0xdab843['options']?_0xdab843[_0xdafc('0x1b')]['include']?_[_0xdafc('0x1f')](_0xdab843[_0xdafc('0x1b')][_0xdafc('0x20')],function(_0x17c2f6){return{'model':db[_0x17c2f6['model']],'as':_0x17c2f6['as'],'attributes':_0x17c2f6[_0xdafc('0x1e')],'include':_0x17c2f6[_0xdafc('0x20')]?_['map'](_0x17c2f6[_0xdafc('0x20')],function(_0x320aec){return{'model':db[_0x320aec[_0xdafc('0x21')]],'as':_0x320aec['as'],'attributes':_0x320aec[_0xdafc('0x1e')],'include':_0x320aec[_0xdafc('0x20')]?_[_0xdafc('0x1f')](_0x320aec[_0xdafc('0x20')],function(_0x4a98c5){return{'model':db[_0x4a98c5[_0xdafc('0x21')]],'as':_0x4a98c5['as'],'attributes':_0x4a98c5[_0xdafc('0x1e')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x29b376){logger['info']('GetFreshsalesAccount',_0xdab843);logger[_0xdafc('0x11')]('GetFreshsalesAccount',_0xdab843,JSON[_0xdafc('0x22')](_0x29b376));_0x17136e(_0x29b376);})[_0xdafc('0x17')](function(_0x5d62e1){logger[_0xdafc('0x13')]('GetFreshsalesAccount',_0x5d62e1['message'],_0xdab843);_0x3d2274(_0x2fef1b['error'](0x1f4,_0x5d62e1[_0xdafc('0x15')]));});});};exports[_0xdafc('0x23')]=function(_0x1fe569){var _0x219e1e=this;return new Promise(function(_0x2def88,_0x100ca6){return db[_0xdafc('0x19')]['find']({'raw':_0x1fe569[_0xdafc('0x1b')]?_0x1fe569[_0xdafc('0x1b')]['raw']===undefined?!![]:![]:!![],'where':_0x1fe569['options']?_0x1fe569[_0xdafc('0x1b')][_0xdafc('0x1d')]||null:null,'attributes':_0x1fe569['options']?_0x1fe569['options'][_0xdafc('0x1e')]||null:null,'include':_0x1fe569[_0xdafc('0x1b')]?_0x1fe569['options']['include']?_['map'](_0x1fe569['options'][_0xdafc('0x20')],function(_0x552900){return{'model':db[_0x552900[_0xdafc('0x21')]],'as':_0x552900['as'],'attributes':_0x552900[_0xdafc('0x1e')],'include':_0x552900[_0xdafc('0x20')]?_[_0xdafc('0x1f')](_0x552900['include'],function(_0x301155){return{'model':db[_0x301155[_0xdafc('0x21')]],'as':_0x301155['as'],'attributes':_0x301155[_0xdafc('0x1e')],'include':_0x301155[_0xdafc('0x20')]?_[_0xdafc('0x1f')](_0x301155[_0xdafc('0x20')],function(_0x56c87c){return{'model':db[_0x56c87c[_0xdafc('0x21')]],'as':_0x56c87c['as'],'attributes':_0x56c87c[_0xdafc('0x1e')]};}):[]};}):[]};}):[]:[]})[_0xdafc('0xd')](function(_0x5ca6dc){logger[_0xdafc('0xe')]('ShowFreshsalesAccount',_0x1fe569);logger[_0xdafc('0x11')]('ShowFreshsalesAccount',_0x1fe569,JSON[_0xdafc('0x22')](_0x5ca6dc));_0x2def88(_0x5ca6dc);})[_0xdafc('0x17')](function(_0x1e5ab1){logger[_0xdafc('0x13')](_0xdafc('0x23'),_0x1e5ab1[_0xdafc('0x15')],_0x1fe569);_0x100ca6(_0x219e1e[_0xdafc('0x13')](0x1f4,_0x1e5ab1['message']));});});}; \ No newline at end of file +var _0x68b3=['include','map','model','ShowFreshsalesAccount','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','FreshsalesAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','result','catch','GetFreshsalesAccount','FreshsalesAccount','findAll','options','raw','where','attributes','limit'];(function(_0x5ee90e,_0x21f2bc){var _0x5ec85b=function(_0x4e715b){while(--_0x4e715b){_0x5ee90e['push'](_0x5ee90e['shift']());}};_0x5ec85b(++_0x21f2bc);}(_0x68b3,0x1d8));var _0x368b=function(_0x8c086c,_0x2beb7a){_0x8c086c=_0x8c086c-0x0;var _0x2a5b55=_0x68b3[_0x8c086c];return _0x2a5b55;};'use strict';var _=require(_0x368b('0x0'));var util=require(_0x368b('0x1'));var moment=require(_0x368b('0x2'));var BPromise=require(_0x368b('0x3'));var rs=require(_0x368b('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x368b('0x5'))['db'];var utils=require(_0x368b('0x6'));var logger=require(_0x368b('0x7'))(_0x368b('0x8'));var config=require('../../config/environment');var jayson=require(_0x368b('0x9'));var client=jayson[_0x368b('0xa')][_0x368b('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x23584a,_0x4406c8,_0x127c1e){return new BPromise(function(_0x2dec1c,_0x142d05){return client[_0x368b('0xc')](_0x23584a,_0x127c1e)[_0x368b('0xd')](function(_0x2a7b9f){logger['info'](_0x368b('0xe'),_0x4406c8,_0x368b('0xf'));logger[_0x368b('0x10')]('FreshsalesAccount,\x20%s,\x20%s,\x20%s',_0x4406c8,_0x368b('0xf'),JSON[_0x368b('0x11')](_0x2a7b9f));if(_0x2a7b9f[_0x368b('0x12')]){if(_0x2a7b9f['error'][_0x368b('0x13')]===0x1f4){logger[_0x368b('0x12')]('FreshsalesAccount,\x20%s,\x20%s',_0x4406c8,_0x2a7b9f[_0x368b('0x12')][_0x368b('0x14')]);return _0x142d05(_0x2a7b9f[_0x368b('0x12')][_0x368b('0x14')]);}logger[_0x368b('0x12')]('FreshsalesAccount,\x20%s,\x20%s',_0x4406c8,_0x2a7b9f[_0x368b('0x12')][_0x368b('0x14')]);return _0x2dec1c(_0x2a7b9f['error'][_0x368b('0x14')]);}else{logger[_0x368b('0x15')](_0x368b('0xe'),_0x4406c8,'request\x20sent');_0x2dec1c(_0x2a7b9f[_0x368b('0x16')][_0x368b('0x14')]);}})[_0x368b('0x17')](function(_0x4d6d9d){logger[_0x368b('0x12')](_0x368b('0xe'),_0x4406c8,_0x4d6d9d);_0x142d05(_0x4d6d9d);});});}exports[_0x368b('0x18')]=function(_0x540f57){var _0x5d543e=this;return new Promise(function(_0x3e2e9f,_0x27d2a0){return db[_0x368b('0x19')][_0x368b('0x1a')]({'raw':_0x540f57[_0x368b('0x1b')]?_0x540f57['options'][_0x368b('0x1c')]===undefined?!![]:![]:!![],'where':_0x540f57[_0x368b('0x1b')]?_0x540f57[_0x368b('0x1b')][_0x368b('0x1d')]||null:null,'attributes':_0x540f57[_0x368b('0x1b')]?_0x540f57[_0x368b('0x1b')][_0x368b('0x1e')]||null:null,'limit':_0x540f57[_0x368b('0x1b')]?_0x540f57['options'][_0x368b('0x1f')]||null:null,'include':_0x540f57[_0x368b('0x1b')]?_0x540f57[_0x368b('0x1b')][_0x368b('0x20')]?_[_0x368b('0x21')](_0x540f57['options'][_0x368b('0x20')],function(_0x1ca429){return{'model':db[_0x1ca429[_0x368b('0x22')]],'as':_0x1ca429['as'],'attributes':_0x1ca429[_0x368b('0x1e')],'include':_0x1ca429[_0x368b('0x20')]?_[_0x368b('0x21')](_0x1ca429[_0x368b('0x20')],function(_0x11ea2d){return{'model':db[_0x11ea2d[_0x368b('0x22')]],'as':_0x11ea2d['as'],'attributes':_0x11ea2d[_0x368b('0x1e')],'include':_0x11ea2d[_0x368b('0x20')]?_[_0x368b('0x21')](_0x11ea2d[_0x368b('0x20')],function(_0x376e61){return{'model':db[_0x376e61[_0x368b('0x22')]],'as':_0x376e61['as'],'attributes':_0x376e61[_0x368b('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x368b('0xd')](function(_0x9f192e){logger[_0x368b('0x15')](_0x368b('0x18'),_0x540f57);logger[_0x368b('0x10')](_0x368b('0x18'),_0x540f57,JSON[_0x368b('0x11')](_0x9f192e));_0x3e2e9f(_0x9f192e);})[_0x368b('0x17')](function(_0x5db0b4){logger['error'](_0x368b('0x18'),_0x5db0b4[_0x368b('0x14')],_0x540f57);_0x27d2a0(_0x5d543e[_0x368b('0x12')](0x1f4,_0x5db0b4[_0x368b('0x14')]));});});};exports['ShowFreshsalesAccount']=function(_0x12ae59){var _0x1f3ed3=this;return new Promise(function(_0x3699fe,_0x1c68ca){return db[_0x368b('0x19')]['find']({'raw':_0x12ae59[_0x368b('0x1b')]?_0x12ae59[_0x368b('0x1b')][_0x368b('0x1c')]===undefined?!![]:![]:!![],'where':_0x12ae59[_0x368b('0x1b')]?_0x12ae59['options']['where']||null:null,'attributes':_0x12ae59['options']?_0x12ae59[_0x368b('0x1b')][_0x368b('0x1e')]||null:null,'include':_0x12ae59[_0x368b('0x1b')]?_0x12ae59[_0x368b('0x1b')][_0x368b('0x20')]?_['map'](_0x12ae59[_0x368b('0x1b')][_0x368b('0x20')],function(_0x54e7e5){return{'model':db[_0x54e7e5[_0x368b('0x22')]],'as':_0x54e7e5['as'],'attributes':_0x54e7e5[_0x368b('0x1e')],'include':_0x54e7e5['include']?_[_0x368b('0x21')](_0x54e7e5[_0x368b('0x20')],function(_0x4a3044){return{'model':db[_0x4a3044[_0x368b('0x22')]],'as':_0x4a3044['as'],'attributes':_0x4a3044['attributes'],'include':_0x4a3044['include']?_['map'](_0x4a3044[_0x368b('0x20')],function(_0x4d6f22){return{'model':db[_0x4d6f22[_0x368b('0x22')]],'as':_0x4d6f22['as'],'attributes':_0x4d6f22[_0x368b('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x368b('0xd')](function(_0xd0f23f){logger[_0x368b('0x15')](_0x368b('0x23'),_0x12ae59);logger[_0x368b('0x10')](_0x368b('0x23'),_0x12ae59,JSON['stringify'](_0xd0f23f));_0x3699fe(_0xd0f23f);})[_0x368b('0x17')](function(_0x1f60ea){logger['error'](_0x368b('0x23'),_0x1f60ea[_0x368b('0x14')],_0x12ae59);_0x1c68ca(_0x1f3ed3[_0x368b('0x12')](0x1f4,_0x1f60ea[_0x368b('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/index.js b/server/api/intFreshsalesConfiguration/index.js index ec6b4cb..8795465 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 _0xd885=['isAuthenticated','/:id','/:id/subjects','/:id/descriptions','getDescriptions','/:id/fields','getFields','post','create','put','update','delete','destroy','exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshsalesConfiguration.controller','get'];(function(_0x234d56,_0x4eee01){var _0xd47811=function(_0x52d2e0){while(--_0x52d2e0){_0x234d56['push'](_0x234d56['shift']());}};_0xd47811(++_0x4eee01);}(_0xd885,0x1a6));var _0x5d88=function(_0x442dc9,_0x2ccbe1){_0x442dc9=_0x442dc9-0x0;var _0x30ace6=_0xd885[_0x442dc9];return _0x30ace6;};'use strict';var multer=require(_0x5d88('0x0'));var util=require(_0x5d88('0x1'));var path=require('path');var timeout=require(_0x5d88('0x2'));var express=require(_0x5d88('0x3'));var router=express[_0x5d88('0x4')]();var auth=require(_0x5d88('0x5'));var interaction=require(_0x5d88('0x6'));var config=require(_0x5d88('0x7'));var controller=require(_0x5d88('0x8'));router[_0x5d88('0x9')]('/',auth[_0x5d88('0xa')](),controller['index']);router[_0x5d88('0x9')](_0x5d88('0xb'),auth[_0x5d88('0xa')](),controller['show']);router['get'](_0x5d88('0xc'),auth[_0x5d88('0xa')](),controller['getSubjects']);router[_0x5d88('0x9')](_0x5d88('0xd'),auth[_0x5d88('0xa')](),controller[_0x5d88('0xe')]);router[_0x5d88('0x9')](_0x5d88('0xf'),auth[_0x5d88('0xa')](),controller[_0x5d88('0x10')]);router[_0x5d88('0x11')]('/',auth[_0x5d88('0xa')](),controller[_0x5d88('0x12')]);router[_0x5d88('0x13')](_0x5d88('0xb'),auth[_0x5d88('0xa')](),controller[_0x5d88('0x14')]);router[_0x5d88('0x15')](_0x5d88('0xb'),auth['isAuthenticated'](),controller[_0x5d88('0x16')]);module[_0x5d88('0x17')]=router; \ No newline at end of file +var _0xe2c8=['get','/:id','show','/:id/subjects','getSubjects','/:id/descriptions','/:id/fields','getFields','put','update','delete','destroy','exports','util','connect-timeout','express','../../config/environment','./intFreshsalesConfiguration.controller','isAuthenticated','index'];(function(_0x53410d,_0x25f272){var _0x3d1bc3=function(_0x46f08d){while(--_0x46f08d){_0x53410d['push'](_0x53410d['shift']());}};_0x3d1bc3(++_0x25f272);}(_0xe2c8,0xc1));var _0x8e2c=function(_0x2b7764,_0x2606f1){_0x2b7764=_0x2b7764-0x0;var _0x848dcb=_0xe2c8[_0x2b7764];return _0x848dcb;};'use strict';var multer=require('multer');var util=require(_0x8e2c('0x0'));var path=require('path');var timeout=require(_0x8e2c('0x1'));var express=require(_0x8e2c('0x2'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x8e2c('0x3'));var controller=require(_0x8e2c('0x4'));router['get']('/',auth[_0x8e2c('0x5')](),controller[_0x8e2c('0x6')]);router[_0x8e2c('0x7')](_0x8e2c('0x8'),auth[_0x8e2c('0x5')](),controller[_0x8e2c('0x9')]);router['get'](_0x8e2c('0xa'),auth[_0x8e2c('0x5')](),controller[_0x8e2c('0xb')]);router[_0x8e2c('0x7')](_0x8e2c('0xc'),auth[_0x8e2c('0x5')](),controller['getDescriptions']);router[_0x8e2c('0x7')](_0x8e2c('0xd'),auth['isAuthenticated'](),controller[_0x8e2c('0xe')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0x8e2c('0xf')](_0x8e2c('0x8'),auth[_0x8e2c('0x5')](),controller[_0x8e2c('0x10')]);router[_0x8e2c('0x11')](_0x8e2c('0x8'),auth[_0x8e2c('0x5')](),controller[_0x8e2c('0x12')]);module[_0x8e2c('0x13')]=router; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.attributes.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.attributes.js index 5b95e7b..be1af73 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 _0xd222=['exports','STRING','sequelize'];(function(_0x3997b0,_0x40f471){var _0x85ed2a=function(_0x1ef1c7){while(--_0x1ef1c7){_0x3997b0['push'](_0x3997b0['shift']());}};_0x85ed2a(++_0x40f471);}(_0xd222,0xb6));var _0x2d22=function(_0x134c2e,_0x3573c4){_0x134c2e=_0x134c2e-0x0;var _0x2825db=_0xd222[_0x134c2e];return _0x2825db;};'use strict';var Sequelize=require(_0x2d22('0x0'));module[_0x2d22('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x2d22('0x2')]}}; \ No newline at end of file +var _0x177e=['sequelize','exports','STRING'];(function(_0x9dea41,_0xb3d105){var _0x668640=function(_0x4c38fb){while(--_0x4c38fb){_0x9dea41['push'](_0x9dea41['shift']());}};_0x668640(++_0xb3d105);}(_0x177e,0x78));var _0xe177=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x177e[_0x20a584];return _0x4b41a8;};'use strict';var Sequelize=require(_0xe177('0x0'));module[_0xe177('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xe177('0x2')]}}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.controller.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.controller.js index acccf44..ccf9489 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 _0x098a=['../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','jayson/promise','http','test','Sequelize','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','info','request\x20sent','debug','FreshsalesConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','FreshsalesConfiguration,\x20%s,\x20%s','result','sendStatus','status','end','json','count','offset','limit','set','apply','reject','save','then','stack','send','index','FreshsalesConfiguration','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','sort','pick','filter','where','merge','name','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','update','destroy','findOne','order','getSubjects','nolimit','getDescriptions','FreshsalesField','getFields','html-pdf','eml-format','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','ioredis','../../components/auth/service'];(function(_0x58f112,_0x3d0cbc){var _0x5602d3=function(_0x142d70){while(--_0x142d70){_0x58f112['push'](_0x58f112['shift']());}};_0x5602d3(++_0x3d0cbc);}(_0x098a,0x1ce));var _0xa098=function(_0x4af6c9,_0x4c53fc){_0x4af6c9=_0x4af6c9-0x0;var _0x59074b=_0x098a[_0x4af6c9];return _0x59074b;};'use strict';var pdf=require(_0xa098('0x0'));var emlformat=require(_0xa098('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xa098('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xa098('0x3'));var moment=require(_0xa098('0x4'));var BPromise=require(_0xa098('0x5'));var Mustache=require(_0xa098('0x6'));var util=require(_0xa098('0x7'));var path=require(_0xa098('0x8'));var sox=require(_0xa098('0x9'));var csv=require(_0xa098('0xa'));var ejs=require(_0xa098('0xb'));var fs=require('fs');var _=require(_0xa098('0xc'));var squel=require(_0xa098('0xd'));var crypto=require('crypto');var jsforce=require(_0xa098('0xe'));var deskjs=require(_0xa098('0xf'));var toCsv=require(_0xa098('0xa'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xa098('0x10'));var authService=require(_0xa098('0x11'));var qs=require(_0xa098('0x12'));var as=require(_0xa098('0x13'));var hardwareService=require(_0xa098('0x14'));var logger=require(_0xa098('0x15'))(_0xa098('0x16'));var utils=require('../../config/utils');var config=require(_0xa098('0x17'));var db=require(_0xa098('0x18'))['db'];var jayson=require(_0xa098('0x19'));var client=jayson['client'][_0xa098('0x1a')]({'port':0x232a});function checkPasswordPattern(_0x3ffb0c,_0x70fc68,_0x23505e){if(_0x23505e){var _0x33b0f2=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x33b0f2[_0xa098('0x1b')](_0x70fc68)){return _0x3ffb0c;}else{throw new db[(_0xa098('0x1c'))]['ValidationError'](_0xa098('0x1d'));}}else{return _0x3ffb0c;}}function respondWithRpcPromise(_0x19501a,_0x29d92e,_0x3e078a,_0xd93de8){return new BPromise(function(_0x2a2377,_0x5682d1){var _0x527693=_0xd93de8||client;return _0x527693['request'](_0x19501a,_0x3e078a)['then'](function(_0x504103){logger[_0xa098('0x1e')]('FreshsalesConfiguration,\x20%s,\x20%s',_0x29d92e,_0xa098('0x1f'));logger[_0xa098('0x20')](_0xa098('0x21'),_0x29d92e,'request\x20sent',JSON[_0xa098('0x22')](_0x504103));if(_0x504103[_0xa098('0x23')]){if(_0x504103[_0xa098('0x23')][_0xa098('0x24')]===0x1f4){logger[_0xa098('0x23')]('FreshsalesConfiguration,\x20%s,\x20%s',_0x29d92e,_0x504103[_0xa098('0x23')]['message']);return _0x5682d1(_0x504103[_0xa098('0x23')][_0xa098('0x25')]);}logger[_0xa098('0x23')](_0xa098('0x26'),_0x29d92e,_0x504103[_0xa098('0x23')][_0xa098('0x25')]);return _0x2a2377(_0x504103[_0xa098('0x23')][_0xa098('0x25')]);}else{logger[_0xa098('0x1e')]('FreshsalesConfiguration,\x20%s,\x20%s',_0x29d92e,_0xa098('0x1f'));_0x2a2377(_0x504103[_0xa098('0x27')]['message']);}})['catch'](function(_0x5dcb2f){logger[_0xa098('0x23')](_0xa098('0x26'),_0x29d92e,_0x5dcb2f);_0x5682d1(_0x5dcb2f);});});}function respondWithStatusCode(_0x42aa79,_0x43d13e){_0x43d13e=_0x43d13e||0xcc;return function(_0x56e4f3){if(_0x56e4f3){return _0x42aa79[_0xa098('0x28')](_0x43d13e);}return _0x42aa79[_0xa098('0x29')](_0x43d13e)[_0xa098('0x2a')]();};}function respondWithResult(_0x585cf4,_0x232d35){_0x232d35=_0x232d35||0xc8;return function(_0x36b9b1){if(_0x36b9b1){return _0x585cf4[_0xa098('0x29')](_0x232d35)[_0xa098('0x2b')](_0x36b9b1);}};}function respondWithFilteredResult(_0x4c7816,_0x55a975){return function(_0x289034){if(_0x289034){var _0x46813e=_0x289034[_0xa098('0x2c')],_0x470c91=_0x55a975[_0xa098('0x2d')],_0xb207b8=_0x55a975[_0xa098('0x2d')]+_0x55a975[_0xa098('0x2e')],_0xcdbe3c;if(_0xb207b8>=_0x46813e){_0xb207b8=_0x46813e;_0xcdbe3c=0xc8;}else{_0xcdbe3c=0xce;}_0x4c7816['status'](_0xcdbe3c);return _0x4c7816[_0xa098('0x2f')]('Content-Range',_0x470c91+'-'+_0xb207b8+'/'+_0x46813e)[_0xa098('0x2b')](_0x289034);}return null;};}function patchUpdates(_0xf305be){return function(_0x389e09){try{jsonpatch[_0xa098('0x30')](_0x389e09,_0xf305be,!![]);}catch(_0x430910){return BPromise[_0xa098('0x31')](_0x430910);}return _0x389e09[_0xa098('0x32')]();};}function saveUpdates(_0x22ff30,_0x4968b6){return function(_0x48191a){if(_0x48191a){return _0x48191a['update'](_0x22ff30)[_0xa098('0x33')](function(_0x2d66f3){return _0x2d66f3;});}return null;};}function removeEntity(_0x996fdb,_0x56fd28){return function(_0xa219dd){if(_0xa219dd){return _0xa219dd['destroy']()['then'](function(){_0x996fdb[_0xa098('0x29')](0xcc)['end']();});}};}function handleEntityNotFound(_0x522783,_0x20dce6){return function(_0x5008d1){if(!_0x5008d1){_0x522783[_0xa098('0x28')](0x194);}return _0x5008d1;};}function handleError(_0x25a2b0,_0x52d36d){_0x52d36d=_0x52d36d||0x1f4;return function(_0x526d5f){logger[_0xa098('0x23')](_0x526d5f[_0xa098('0x34')]);if(_0x526d5f['name']){delete _0x526d5f['name'];}_0x25a2b0[_0xa098('0x29')](_0x52d36d)[_0xa098('0x35')](_0x526d5f);};}exports[_0xa098('0x36')]=function(_0x4f7941,_0x35972c){var _0xa4b876={},_0x17cc36={},_0x44e3d3={'count':0x0,'rows':[]};var _0x36c42a=_['map'](db[_0xa098('0x37')][_0xa098('0x38')],function(_0x3513b6){return{'name':_0x3513b6[_0xa098('0x39')],'type':_0x3513b6[_0xa098('0x3a')][_0xa098('0x3b')]};});_0x17cc36[_0xa098('0x3c')]=_[_0xa098('0x3d')](_0x36c42a,'name');_0x17cc36[_0xa098('0x3e')]=_[_0xa098('0x3f')](_0x4f7941[_0xa098('0x3e')]);_0x17cc36[_0xa098('0x40')]=_[_0xa098('0x41')](_0x17cc36['model'],_0x17cc36['query']);_0xa4b876[_0xa098('0x42')]=_[_0xa098('0x41')](_0x17cc36['model'],qs[_0xa098('0x43')](_0x4f7941['query'][_0xa098('0x43')]));_0xa4b876[_0xa098('0x42')]=_0xa4b876[_0xa098('0x42')][_0xa098('0x44')]?_0xa4b876[_0xa098('0x42')]:_0x17cc36[_0xa098('0x3c')];if(!_0x4f7941[_0xa098('0x3e')][_0xa098('0x45')]('nolimit')){_0xa4b876[_0xa098('0x2e')]=qs[_0xa098('0x2e')](_0x4f7941[_0xa098('0x3e')][_0xa098('0x2e')]);_0xa4b876[_0xa098('0x2d')]=qs[_0xa098('0x2d')](_0x4f7941[_0xa098('0x3e')]['offset']);}_0xa4b876['order']=qs[_0xa098('0x46')](_0x4f7941[_0xa098('0x3e')]['sort']);_0xa4b876['where']=qs['filters'](_[_0xa098('0x47')](_0x4f7941[_0xa098('0x3e')],_0x17cc36[_0xa098('0x40')]),_0x36c42a);if(_0x4f7941['query'][_0xa098('0x48')]){_0xa4b876[_0xa098('0x49')]=_[_0xa098('0x4a')](_0xa4b876[_0xa098('0x49')],{'$or':_['map'](_0x36c42a,function(_0x21cb1b){if(_0x21cb1b[_0xa098('0x3a')]!=='VIRTUAL'){var _0x1ba6dc={};_0x1ba6dc[_0x21cb1b[_0xa098('0x4b')]]={'$like':'%'+_0x4f7941[_0xa098('0x3e')][_0xa098('0x48')]+'%'};return _0x1ba6dc;}})});}_0xa4b876=_[_0xa098('0x4a')]({},_0xa4b876,_0x4f7941[_0xa098('0x4c')]);var _0x181711={'where':_0xa4b876[_0xa098('0x49')]};return db[_0xa098('0x37')]['count'](_0x181711)[_0xa098('0x33')](function(_0x22cf40){_0x44e3d3[_0xa098('0x2c')]=_0x22cf40;if(_0x4f7941[_0xa098('0x3e')][_0xa098('0x4d')]){_0xa4b876[_0xa098('0x4e')]=[{'all':!![]}];}return db['FreshsalesConfiguration'][_0xa098('0x4f')](_0xa4b876);})[_0xa098('0x33')](function(_0x489760){_0x44e3d3[_0xa098('0x50')]=_0x489760;return _0x44e3d3;})[_0xa098('0x33')](respondWithFilteredResult(_0x35972c,_0xa4b876))[_0xa098('0x51')](handleError(_0x35972c,null));};exports[_0xa098('0x52')]=function(_0x3e8480,_0x152682){var _0x560014={'raw':![],'where':{'id':_0x3e8480[_0xa098('0x53')]['id']}},_0x4085e6={};_0x4085e6[_0xa098('0x3c')]=_[_0xa098('0x3f')](db[_0xa098('0x37')][_0xa098('0x38')]);_0x4085e6[_0xa098('0x3e')]=_[_0xa098('0x3f')](_0x3e8480[_0xa098('0x3e')]);_0x4085e6['filters']=_[_0xa098('0x41')](_0x4085e6[_0xa098('0x3c')],_0x4085e6[_0xa098('0x3e')]);_0x560014['attributes']=_[_0xa098('0x41')](_0x4085e6[_0xa098('0x3c')],qs[_0xa098('0x43')](_0x3e8480['query'][_0xa098('0x43')]));_0x560014[_0xa098('0x42')]=_0x560014[_0xa098('0x42')][_0xa098('0x44')]?_0x560014['attributes']:_0x4085e6[_0xa098('0x3c')];if(_0x3e8480[_0xa098('0x3e')][_0xa098('0x4d')]){_0x560014[_0xa098('0x4e')]=[{'all':!![]}];}_0x560014=_[_0xa098('0x4a')]({},_0x560014,_0x3e8480[_0xa098('0x4c')]);return db[_0xa098('0x37')][_0xa098('0x54')](_0x560014)[_0xa098('0x33')](handleEntityNotFound(_0x152682,null))[_0xa098('0x33')](respondWithResult(_0x152682,null))[_0xa098('0x51')](handleError(_0x152682,null));};exports[_0xa098('0x55')]=function(_0x4abbcd,_0x5de711){return db['FreshsalesConfiguration']['create'](_0x4abbcd[_0xa098('0x56')],{})[_0xa098('0x33')](respondWithResult(_0x5de711,0xc9))[_0xa098('0x51')](handleError(_0x5de711,null));};exports[_0xa098('0x57')]=function(_0x439e5d,_0x5f3a65){if(_0x439e5d[_0xa098('0x56')]['id']){delete _0x439e5d[_0xa098('0x56')]['id'];}return db[_0xa098('0x37')]['find']({'where':{'id':_0x439e5d[_0xa098('0x53')]['id']}})[_0xa098('0x33')](handleEntityNotFound(_0x5f3a65,null))['then'](saveUpdates(_0x439e5d[_0xa098('0x56')],null))['then'](respondWithResult(_0x5f3a65,null))['catch'](handleError(_0x5f3a65,null));};exports[_0xa098('0x58')]=function(_0x1dc6ea,_0x14dec9){return db['FreshsalesConfiguration']['find']({'where':{'id':_0x1dc6ea[_0xa098('0x53')]['id']}})[_0xa098('0x33')](handleEntityNotFound(_0x14dec9,null))[_0xa098('0x33')](removeEntity(_0x14dec9,null))['catch'](handleError(_0x14dec9,null));};exports['getSubjects']=function(_0x37732b,_0x1b1213,_0x24207c){var _0x466903={};var _0x417e8a={};var _0x486651;var _0x18a5c8;return db[_0xa098('0x37')][_0xa098('0x59')]({'where':{'id':_0x37732b[_0xa098('0x53')]['id']}})[_0xa098('0x33')](handleEntityNotFound(_0x1b1213,null))['then'](function(_0x1cb6c1){if(_0x1cb6c1){_0x486651=_0x1cb6c1;_0x417e8a[_0xa098('0x3c')]=_[_0xa098('0x3f')](db['FreshsalesField'][_0xa098('0x38')]);_0x417e8a[_0xa098('0x3e')]=_[_0xa098('0x3f')](_0x37732b[_0xa098('0x3e')]);_0x417e8a[_0xa098('0x40')]=_[_0xa098('0x41')](_0x417e8a[_0xa098('0x3c')],_0x417e8a[_0xa098('0x3e')]);_0x466903['attributes']=_[_0xa098('0x41')](_0x417e8a['model'],qs[_0xa098('0x43')](_0x37732b[_0xa098('0x3e')]['fields']));_0x466903[_0xa098('0x42')]=_0x466903['attributes'][_0xa098('0x44')]?_0x466903[_0xa098('0x42')]:_0x417e8a['model'];_0x466903[_0xa098('0x5a')]=qs[_0xa098('0x46')](_0x37732b['query']['sort']);_0x466903[_0xa098('0x49')]=qs[_0xa098('0x40')](_[_0xa098('0x47')](_0x37732b[_0xa098('0x3e')],_0x417e8a[_0xa098('0x40')]));if(_0x37732b[_0xa098('0x3e')]['filter']){_0x466903[_0xa098('0x49')]=_[_0xa098('0x4a')](_0x466903[_0xa098('0x49')],{'$or':_[_0xa098('0x3d')](_0x466903['attributes'],function(_0xbc82a7){var _0x44492a={};_0x44492a[_0xbc82a7]={'$like':'%'+_0x37732b[_0xa098('0x3e')][_0xa098('0x48')]+'%'};return _0x44492a;})});}_0x466903=_[_0xa098('0x4a')]({},_0x466903,_0x37732b[_0xa098('0x4c')]);return _0x486651[_0xa098('0x5b')](_0x466903);}})[_0xa098('0x33')](function(_0x382281){if(_0x382281){_0x18a5c8=_0x382281[_0xa098('0x44')];if(!_0x37732b[_0xa098('0x3e')]['hasOwnProperty'](_0xa098('0x5c'))){_0x466903[_0xa098('0x2e')]=qs[_0xa098('0x2e')](_0x37732b[_0xa098('0x3e')][_0xa098('0x2e')]);_0x466903['offset']=qs[_0xa098('0x2d')](_0x37732b[_0xa098('0x3e')]['offset']);}return _0x486651[_0xa098('0x5b')](_0x466903);}})[_0xa098('0x33')](function(_0x10b50f){if(_0x10b50f){return _0x10b50f?{'count':_0x18a5c8,'rows':_0x10b50f}:null;}})[_0xa098('0x33')](respondWithResult(_0x1b1213,null))[_0xa098('0x51')](handleError(_0x1b1213,null));};exports[_0xa098('0x5d')]=function(_0x19e018,_0x412c54,_0x446763){var _0xd1dfd7={};var _0x390c1c={};var _0x295cf4;var _0x328afb;return db[_0xa098('0x37')][_0xa098('0x59')]({'where':{'id':_0x19e018[_0xa098('0x53')]['id']}})[_0xa098('0x33')](handleEntityNotFound(_0x412c54,null))[_0xa098('0x33')](function(_0x16f045){if(_0x16f045){_0x295cf4=_0x16f045;_0x390c1c[_0xa098('0x3c')]=_[_0xa098('0x3f')](db[_0xa098('0x5e')][_0xa098('0x38')]);_0x390c1c[_0xa098('0x3e')]=_[_0xa098('0x3f')](_0x19e018[_0xa098('0x3e')]);_0x390c1c['filters']=_[_0xa098('0x41')](_0x390c1c[_0xa098('0x3c')],_0x390c1c['query']);_0xd1dfd7['attributes']=_[_0xa098('0x41')](_0x390c1c[_0xa098('0x3c')],qs[_0xa098('0x43')](_0x19e018[_0xa098('0x3e')]['fields']));_0xd1dfd7[_0xa098('0x42')]=_0xd1dfd7['attributes'][_0xa098('0x44')]?_0xd1dfd7['attributes']:_0x390c1c[_0xa098('0x3c')];_0xd1dfd7[_0xa098('0x5a')]=qs['sort'](_0x19e018['query'][_0xa098('0x46')]);_0xd1dfd7[_0xa098('0x49')]=qs['filters'](_['pick'](_0x19e018['query'],_0x390c1c[_0xa098('0x40')]));if(_0x19e018[_0xa098('0x3e')][_0xa098('0x48')]){_0xd1dfd7[_0xa098('0x49')]=_[_0xa098('0x4a')](_0xd1dfd7[_0xa098('0x49')],{'$or':_[_0xa098('0x3d')](_0xd1dfd7[_0xa098('0x42')],function(_0x5d5c1f){var _0xd02518={};_0xd02518[_0x5d5c1f]={'$like':'%'+_0x19e018[_0xa098('0x3e')][_0xa098('0x48')]+'%'};return _0xd02518;})});}_0xd1dfd7=_[_0xa098('0x4a')]({},_0xd1dfd7,_0x19e018[_0xa098('0x4c')]);return _0x295cf4[_0xa098('0x5d')](_0xd1dfd7);}})['then'](function(_0x50fcb8){if(_0x50fcb8){_0x328afb=_0x50fcb8['length'];if(!_0x19e018[_0xa098('0x3e')][_0xa098('0x45')]('nolimit')){_0xd1dfd7['limit']=qs[_0xa098('0x2e')](_0x19e018['query'][_0xa098('0x2e')]);_0xd1dfd7[_0xa098('0x2d')]=qs[_0xa098('0x2d')](_0x19e018[_0xa098('0x3e')][_0xa098('0x2d')]);}return _0x295cf4[_0xa098('0x5d')](_0xd1dfd7);}})[_0xa098('0x33')](function(_0x5c5a5f){if(_0x5c5a5f){return _0x5c5a5f?{'count':_0x328afb,'rows':_0x5c5a5f}:null;}})['then'](respondWithResult(_0x412c54,null))[_0xa098('0x51')](handleError(_0x412c54,null));};exports[_0xa098('0x5f')]=function(_0x5d07c9,_0x589aa4,_0x26890e){var _0xcbe7a6={};var _0x5023d2={};var _0x240411;var _0x1a8ae3;return db['FreshsalesConfiguration'][_0xa098('0x59')]({'where':{'id':_0x5d07c9[_0xa098('0x53')]['id']}})[_0xa098('0x33')](handleEntityNotFound(_0x589aa4,null))[_0xa098('0x33')](function(_0x40ee0c){if(_0x40ee0c){_0x240411=_0x40ee0c;_0x5023d2[_0xa098('0x3c')]=_['keys'](db['FreshsalesField'][_0xa098('0x38')]);_0x5023d2[_0xa098('0x3e')]=_['keys'](_0x5d07c9[_0xa098('0x3e')]);_0x5023d2[_0xa098('0x40')]=_['intersection'](_0x5023d2[_0xa098('0x3c')],_0x5023d2['query']);_0xcbe7a6[_0xa098('0x42')]=_[_0xa098('0x41')](_0x5023d2['model'],qs[_0xa098('0x43')](_0x5d07c9['query'][_0xa098('0x43')]));_0xcbe7a6['attributes']=_0xcbe7a6['attributes'][_0xa098('0x44')]?_0xcbe7a6['attributes']:_0x5023d2['model'];_0xcbe7a6['order']=qs[_0xa098('0x46')](_0x5d07c9[_0xa098('0x3e')][_0xa098('0x46')]);_0xcbe7a6[_0xa098('0x49')]=qs[_0xa098('0x40')](_[_0xa098('0x47')](_0x5d07c9[_0xa098('0x3e')],_0x5023d2[_0xa098('0x40')]));if(_0x5d07c9[_0xa098('0x3e')][_0xa098('0x48')]){_0xcbe7a6['where']=_[_0xa098('0x4a')](_0xcbe7a6[_0xa098('0x49')],{'$or':_[_0xa098('0x3d')](_0xcbe7a6[_0xa098('0x42')],function(_0x4d9576){var _0x34e566={};_0x34e566[_0x4d9576]={'$like':'%'+_0x5d07c9[_0xa098('0x3e')][_0xa098('0x48')]+'%'};return _0x34e566;})});}_0xcbe7a6=_[_0xa098('0x4a')]({},_0xcbe7a6,_0x5d07c9[_0xa098('0x4c')]);return _0x240411[_0xa098('0x5f')](_0xcbe7a6);}})[_0xa098('0x33')](function(_0x41b118){if(_0x41b118){_0x1a8ae3=_0x41b118[_0xa098('0x44')];if(!_0x5d07c9[_0xa098('0x3e')][_0xa098('0x45')](_0xa098('0x5c'))){_0xcbe7a6[_0xa098('0x2e')]=qs['limit'](_0x5d07c9[_0xa098('0x3e')][_0xa098('0x2e')]);_0xcbe7a6[_0xa098('0x2d')]=qs['offset'](_0x5d07c9[_0xa098('0x3e')][_0xa098('0x2d')]);}return _0x240411['getFields'](_0xcbe7a6);}})['then'](function(_0x5c64b1){if(_0x5c64b1){return _0x5c64b1?{'count':_0x1a8ae3,'rows':_0x5c64b1}:null;}})[_0xa098('0x33')](respondWithResult(_0x589aa4,null))['catch'](handleError(_0x589aa4,null));}; \ No newline at end of file +var _0x989d=['message','end','status','json','count','offset','limit','set','Content-Range','apply','reject','then','sendStatus','stack','name','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','filter','VIRTUAL','merge','options','include','FreshsalesConfiguration','findAll','rows','catch','show','find','create','body','update','destroy','params','getSubjects','FreshsalesField','pick','hasOwnProperty','getDescriptions','findOne','getFields','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','ejs','squel','jsforce','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/environment','../../mysqldb','jayson/promise','client','test','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','info','FreshsalesConfiguration,\x20%s,\x20%s','request\x20sent','debug','stringify','error'];(function(_0x383801,_0x14052a){var _0x25b7b3=function(_0xf84277){while(--_0xf84277){_0x383801['push'](_0x383801['shift']());}};_0x25b7b3(++_0x14052a);}(_0x989d,0x18b));var _0xd989=function(_0x243b59,_0x3f9495){_0x243b59=_0x243b59-0x0;var _0x3e1676=_0x989d[_0x243b59];return _0x3e1676;};'use strict';var pdf=require(_0xd989('0x0'));var emlformat=require(_0xd989('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xd989('0x2'));var jsonpatch=require(_0xd989('0x3'));var rp=require(_0xd989('0x4'));var moment=require(_0xd989('0x5'));var BPromise=require(_0xd989('0x6'));var Mustache=require(_0xd989('0x7'));var util=require(_0xd989('0x8'));var path=require(_0xd989('0x9'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xd989('0xa'));var fs=require('fs');var _=require('lodash');var squel=require(_0xd989('0xb'));var crypto=require('crypto');var jsforce=require(_0xd989('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xd989('0xd'));var authService=require('../../components/auth/service');var qs=require(_0xd989('0xe'));var as=require(_0xd989('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0xd989('0x10'));var db=require(_0xd989('0x11'))['db'];var jayson=require(_0xd989('0x12'));var client=jayson[_0xd989('0x13')]['http']({'port':0x232a});function checkPasswordPattern(_0x1291f9,_0x25e426,_0x1b08e4){if(_0x1b08e4){var _0x3c27c7=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x3c27c7[_0xd989('0x14')](_0x25e426)){return _0x1291f9;}else{throw new db['Sequelize'][(_0xd989('0x15'))](_0xd989('0x16'));}}else{return _0x1291f9;}}function respondWithRpcPromise(_0x4e134c,_0x3aef8a,_0x2c8ced,_0x145ddc){return new BPromise(function(_0x335a75,_0x1066bf){var _0x53f805=_0x145ddc||client;return _0x53f805[_0xd989('0x17')](_0x4e134c,_0x2c8ced)['then'](function(_0x303b7f){logger[_0xd989('0x18')](_0xd989('0x19'),_0x3aef8a,_0xd989('0x1a'));logger[_0xd989('0x1b')]('FreshsalesConfiguration,\x20%s,\x20%s,\x20%s',_0x3aef8a,_0xd989('0x1a'),JSON[_0xd989('0x1c')](_0x303b7f));if(_0x303b7f[_0xd989('0x1d')]){if(_0x303b7f['error']['code']===0x1f4){logger[_0xd989('0x1d')](_0xd989('0x19'),_0x3aef8a,_0x303b7f[_0xd989('0x1d')]['message']);return _0x1066bf(_0x303b7f[_0xd989('0x1d')][_0xd989('0x1e')]);}logger[_0xd989('0x1d')](_0xd989('0x19'),_0x3aef8a,_0x303b7f[_0xd989('0x1d')][_0xd989('0x1e')]);return _0x335a75(_0x303b7f[_0xd989('0x1d')][_0xd989('0x1e')]);}else{logger['info']('FreshsalesConfiguration,\x20%s,\x20%s',_0x3aef8a,_0xd989('0x1a'));_0x335a75(_0x303b7f['result'][_0xd989('0x1e')]);}})['catch'](function(_0x2ee247){logger[_0xd989('0x1d')](_0xd989('0x19'),_0x3aef8a,_0x2ee247);_0x1066bf(_0x2ee247);});});}function respondWithStatusCode(_0x2aa3c9,_0xdc9b6a){_0xdc9b6a=_0xdc9b6a||0xcc;return function(_0x3a1fc7){if(_0x3a1fc7){return _0x2aa3c9['sendStatus'](_0xdc9b6a);}return _0x2aa3c9['status'](_0xdc9b6a)[_0xd989('0x1f')]();};}function respondWithResult(_0x160340,_0x584062){_0x584062=_0x584062||0xc8;return function(_0x126bd0){if(_0x126bd0){return _0x160340[_0xd989('0x20')](_0x584062)[_0xd989('0x21')](_0x126bd0);}};}function respondWithFilteredResult(_0x4cb6c3,_0xf4ac6c){return function(_0x1b8637){if(_0x1b8637){var _0x52430c=_0x1b8637[_0xd989('0x22')],_0x39a40e=_0xf4ac6c[_0xd989('0x23')],_0x45a386=_0xf4ac6c[_0xd989('0x23')]+_0xf4ac6c[_0xd989('0x24')],_0x4662df;if(_0x45a386>=_0x52430c){_0x45a386=_0x52430c;_0x4662df=0xc8;}else{_0x4662df=0xce;}_0x4cb6c3['status'](_0x4662df);return _0x4cb6c3[_0xd989('0x25')](_0xd989('0x26'),_0x39a40e+'-'+_0x45a386+'/'+_0x52430c)[_0xd989('0x21')](_0x1b8637);}return null;};}function patchUpdates(_0x56f680){return function(_0x3a5812){try{jsonpatch[_0xd989('0x27')](_0x3a5812,_0x56f680,!![]);}catch(_0x24aaff){return BPromise[_0xd989('0x28')](_0x24aaff);}return _0x3a5812['save']();};}function saveUpdates(_0x1c313a,_0x2c8e15){return function(_0x56b53f){if(_0x56b53f){return _0x56b53f['update'](_0x1c313a)[_0xd989('0x29')](function(_0x9fc2fa){return _0x9fc2fa;});}return null;};}function removeEntity(_0x4a18c0,_0x3204ad){return function(_0x4fe8c9){if(_0x4fe8c9){return _0x4fe8c9['destroy']()['then'](function(){_0x4a18c0[_0xd989('0x20')](0xcc)[_0xd989('0x1f')]();});}};}function handleEntityNotFound(_0x340793,_0x486d86){return function(_0x2ff538){if(!_0x2ff538){_0x340793[_0xd989('0x2a')](0x194);}return _0x2ff538;};}function handleError(_0x3f7775,_0x214209){_0x214209=_0x214209||0x1f4;return function(_0x1570c0){logger[_0xd989('0x1d')](_0x1570c0[_0xd989('0x2b')]);if(_0x1570c0[_0xd989('0x2c')]){delete _0x1570c0['name'];}_0x3f7775['status'](_0x214209)['send'](_0x1570c0);};}exports['index']=function(_0x34c164,_0x5ab658){var _0x1b1d44={},_0x4ab1f4={},_0x2205c6={'count':0x0,'rows':[]};var _0x682c3f=_[_0xd989('0x2d')](db['FreshsalesConfiguration'][_0xd989('0x2e')],function(_0x3c365f){return{'name':_0x3c365f[_0xd989('0x2f')],'type':_0x3c365f[_0xd989('0x30')][_0xd989('0x31')]};});_0x4ab1f4[_0xd989('0x32')]=_[_0xd989('0x2d')](_0x682c3f,_0xd989('0x2c'));_0x4ab1f4[_0xd989('0x33')]=_[_0xd989('0x34')](_0x34c164[_0xd989('0x33')]);_0x4ab1f4[_0xd989('0x35')]=_[_0xd989('0x36')](_0x4ab1f4[_0xd989('0x32')],_0x4ab1f4[_0xd989('0x33')]);_0x1b1d44[_0xd989('0x37')]=_[_0xd989('0x36')](_0x4ab1f4[_0xd989('0x32')],qs[_0xd989('0x38')](_0x34c164['query'][_0xd989('0x38')]));_0x1b1d44[_0xd989('0x37')]=_0x1b1d44['attributes'][_0xd989('0x39')]?_0x1b1d44['attributes']:_0x4ab1f4[_0xd989('0x32')];if(!_0x34c164['query']['hasOwnProperty'](_0xd989('0x3a'))){_0x1b1d44[_0xd989('0x24')]=qs[_0xd989('0x24')](_0x34c164[_0xd989('0x33')][_0xd989('0x24')]);_0x1b1d44['offset']=qs[_0xd989('0x23')](_0x34c164[_0xd989('0x33')][_0xd989('0x23')]);}_0x1b1d44[_0xd989('0x3b')]=qs[_0xd989('0x3c')](_0x34c164[_0xd989('0x33')]['sort']);_0x1b1d44[_0xd989('0x3d')]=qs['filters'](_['pick'](_0x34c164[_0xd989('0x33')],_0x4ab1f4[_0xd989('0x35')]),_0x682c3f);if(_0x34c164['query'][_0xd989('0x3e')]){_0x1b1d44[_0xd989('0x3d')]=_['merge'](_0x1b1d44[_0xd989('0x3d')],{'$or':_[_0xd989('0x2d')](_0x682c3f,function(_0x3d8417){if(_0x3d8417['type']!==_0xd989('0x3f')){var _0x4b8a2b={};_0x4b8a2b[_0x3d8417[_0xd989('0x2c')]]={'$like':'%'+_0x34c164[_0xd989('0x33')]['filter']+'%'};return _0x4b8a2b;}})});}_0x1b1d44=_[_0xd989('0x40')]({},_0x1b1d44,_0x34c164[_0xd989('0x41')]);var _0x39da85={'where':_0x1b1d44['where']};return db['FreshsalesConfiguration'][_0xd989('0x22')](_0x39da85)[_0xd989('0x29')](function(_0x1d8044){_0x2205c6['count']=_0x1d8044;if(_0x34c164[_0xd989('0x33')]['includeAll']){_0x1b1d44[_0xd989('0x42')]=[{'all':!![]}];}return db[_0xd989('0x43')][_0xd989('0x44')](_0x1b1d44);})[_0xd989('0x29')](function(_0x4a723e){_0x2205c6[_0xd989('0x45')]=_0x4a723e;return _0x2205c6;})[_0xd989('0x29')](respondWithFilteredResult(_0x5ab658,_0x1b1d44))[_0xd989('0x46')](handleError(_0x5ab658,null));};exports[_0xd989('0x47')]=function(_0x531685,_0x1a1786){var _0x4e787c={'raw':![],'where':{'id':_0x531685['params']['id']}},_0x243ca8={};_0x243ca8[_0xd989('0x32')]=_[_0xd989('0x34')](db[_0xd989('0x43')][_0xd989('0x2e')]);_0x243ca8['query']=_[_0xd989('0x34')](_0x531685[_0xd989('0x33')]);_0x243ca8[_0xd989('0x35')]=_[_0xd989('0x36')](_0x243ca8['model'],_0x243ca8[_0xd989('0x33')]);_0x4e787c[_0xd989('0x37')]=_[_0xd989('0x36')](_0x243ca8[_0xd989('0x32')],qs['fields'](_0x531685[_0xd989('0x33')][_0xd989('0x38')]));_0x4e787c[_0xd989('0x37')]=_0x4e787c['attributes'][_0xd989('0x39')]?_0x4e787c['attributes']:_0x243ca8['model'];if(_0x531685[_0xd989('0x33')]['includeAll']){_0x4e787c['include']=[{'all':!![]}];}_0x4e787c=_[_0xd989('0x40')]({},_0x4e787c,_0x531685['options']);return db[_0xd989('0x43')][_0xd989('0x48')](_0x4e787c)[_0xd989('0x29')](handleEntityNotFound(_0x1a1786,null))[_0xd989('0x29')](respondWithResult(_0x1a1786,null))[_0xd989('0x46')](handleError(_0x1a1786,null));};exports[_0xd989('0x49')]=function(_0x17a1da,_0x403c37){return db[_0xd989('0x43')][_0xd989('0x49')](_0x17a1da[_0xd989('0x4a')],{})[_0xd989('0x29')](respondWithResult(_0x403c37,0xc9))[_0xd989('0x46')](handleError(_0x403c37,null));};exports[_0xd989('0x4b')]=function(_0x56d463,_0x584d26){if(_0x56d463['body']['id']){delete _0x56d463[_0xd989('0x4a')]['id'];}return db[_0xd989('0x43')]['find']({'where':{'id':_0x56d463['params']['id']}})[_0xd989('0x29')](handleEntityNotFound(_0x584d26,null))[_0xd989('0x29')](saveUpdates(_0x56d463[_0xd989('0x4a')],null))['then'](respondWithResult(_0x584d26,null))[_0xd989('0x46')](handleError(_0x584d26,null));};exports[_0xd989('0x4c')]=function(_0x3a2b5d,_0x340b42){return db[_0xd989('0x43')][_0xd989('0x48')]({'where':{'id':_0x3a2b5d[_0xd989('0x4d')]['id']}})['then'](handleEntityNotFound(_0x340b42,null))[_0xd989('0x29')](removeEntity(_0x340b42,null))[_0xd989('0x46')](handleError(_0x340b42,null));};exports[_0xd989('0x4e')]=function(_0x3ae0d2,_0x5d0523,_0x48421f){var _0xd58159={};var _0x88c27c={};var _0x185b47;var _0x5e1e75;return db[_0xd989('0x43')]['findOne']({'where':{'id':_0x3ae0d2[_0xd989('0x4d')]['id']}})[_0xd989('0x29')](handleEntityNotFound(_0x5d0523,null))[_0xd989('0x29')](function(_0x4eda03){if(_0x4eda03){_0x185b47=_0x4eda03;_0x88c27c[_0xd989('0x32')]=_['keys'](db[_0xd989('0x4f')][_0xd989('0x2e')]);_0x88c27c['query']=_[_0xd989('0x34')](_0x3ae0d2[_0xd989('0x33')]);_0x88c27c[_0xd989('0x35')]=_['intersection'](_0x88c27c[_0xd989('0x32')],_0x88c27c[_0xd989('0x33')]);_0xd58159['attributes']=_['intersection'](_0x88c27c[_0xd989('0x32')],qs[_0xd989('0x38')](_0x3ae0d2['query']['fields']));_0xd58159['attributes']=_0xd58159[_0xd989('0x37')][_0xd989('0x39')]?_0xd58159[_0xd989('0x37')]:_0x88c27c['model'];_0xd58159[_0xd989('0x3b')]=qs[_0xd989('0x3c')](_0x3ae0d2['query'][_0xd989('0x3c')]);_0xd58159['where']=qs[_0xd989('0x35')](_[_0xd989('0x50')](_0x3ae0d2[_0xd989('0x33')],_0x88c27c[_0xd989('0x35')]));if(_0x3ae0d2[_0xd989('0x33')][_0xd989('0x3e')]){_0xd58159[_0xd989('0x3d')]=_[_0xd989('0x40')](_0xd58159['where'],{'$or':_['map'](_0xd58159[_0xd989('0x37')],function(_0x1998ae){var _0x4c075a={};_0x4c075a[_0x1998ae]={'$like':'%'+_0x3ae0d2[_0xd989('0x33')][_0xd989('0x3e')]+'%'};return _0x4c075a;})});}_0xd58159=_[_0xd989('0x40')]({},_0xd58159,_0x3ae0d2[_0xd989('0x41')]);return _0x185b47[_0xd989('0x4e')](_0xd58159);}})[_0xd989('0x29')](function(_0x5547ca){if(_0x5547ca){_0x5e1e75=_0x5547ca['length'];if(!_0x3ae0d2['query'][_0xd989('0x51')]('nolimit')){_0xd58159[_0xd989('0x24')]=qs['limit'](_0x3ae0d2[_0xd989('0x33')][_0xd989('0x24')]);_0xd58159[_0xd989('0x23')]=qs['offset'](_0x3ae0d2[_0xd989('0x33')][_0xd989('0x23')]);}return _0x185b47['getSubjects'](_0xd58159);}})[_0xd989('0x29')](function(_0x385e72){if(_0x385e72){return _0x385e72?{'count':_0x5e1e75,'rows':_0x385e72}:null;}})[_0xd989('0x29')](respondWithResult(_0x5d0523,null))[_0xd989('0x46')](handleError(_0x5d0523,null));};exports[_0xd989('0x52')]=function(_0x5ca3f4,_0x14bb2f,_0x2d7d55){var _0x894303={};var _0x1dfc35={};var _0x12e03f;var _0x397e46;return db[_0xd989('0x43')][_0xd989('0x53')]({'where':{'id':_0x5ca3f4[_0xd989('0x4d')]['id']}})[_0xd989('0x29')](handleEntityNotFound(_0x14bb2f,null))[_0xd989('0x29')](function(_0x1489bd){if(_0x1489bd){_0x12e03f=_0x1489bd;_0x1dfc35[_0xd989('0x32')]=_['keys'](db[_0xd989('0x4f')][_0xd989('0x2e')]);_0x1dfc35['query']=_[_0xd989('0x34')](_0x5ca3f4[_0xd989('0x33')]);_0x1dfc35[_0xd989('0x35')]=_[_0xd989('0x36')](_0x1dfc35['model'],_0x1dfc35[_0xd989('0x33')]);_0x894303[_0xd989('0x37')]=_[_0xd989('0x36')](_0x1dfc35[_0xd989('0x32')],qs[_0xd989('0x38')](_0x5ca3f4['query'][_0xd989('0x38')]));_0x894303[_0xd989('0x37')]=_0x894303[_0xd989('0x37')][_0xd989('0x39')]?_0x894303[_0xd989('0x37')]:_0x1dfc35[_0xd989('0x32')];_0x894303['order']=qs[_0xd989('0x3c')](_0x5ca3f4[_0xd989('0x33')][_0xd989('0x3c')]);_0x894303[_0xd989('0x3d')]=qs[_0xd989('0x35')](_[_0xd989('0x50')](_0x5ca3f4['query'],_0x1dfc35[_0xd989('0x35')]));if(_0x5ca3f4[_0xd989('0x33')][_0xd989('0x3e')]){_0x894303[_0xd989('0x3d')]=_[_0xd989('0x40')](_0x894303[_0xd989('0x3d')],{'$or':_[_0xd989('0x2d')](_0x894303[_0xd989('0x37')],function(_0x1cc78a){var _0x5c4ad3={};_0x5c4ad3[_0x1cc78a]={'$like':'%'+_0x5ca3f4[_0xd989('0x33')][_0xd989('0x3e')]+'%'};return _0x5c4ad3;})});}_0x894303=_['merge']({},_0x894303,_0x5ca3f4[_0xd989('0x41')]);return _0x12e03f[_0xd989('0x52')](_0x894303);}})['then'](function(_0x337393){if(_0x337393){_0x397e46=_0x337393[_0xd989('0x39')];if(!_0x5ca3f4['query']['hasOwnProperty'](_0xd989('0x3a'))){_0x894303[_0xd989('0x24')]=qs[_0xd989('0x24')](_0x5ca3f4['query'][_0xd989('0x24')]);_0x894303[_0xd989('0x23')]=qs[_0xd989('0x23')](_0x5ca3f4[_0xd989('0x33')][_0xd989('0x23')]);}return _0x12e03f['getDescriptions'](_0x894303);}})[_0xd989('0x29')](function(_0x2b123c){if(_0x2b123c){return _0x2b123c?{'count':_0x397e46,'rows':_0x2b123c}:null;}})[_0xd989('0x29')](respondWithResult(_0x14bb2f,null))['catch'](handleError(_0x14bb2f,null));};exports[_0xd989('0x54')]=function(_0x26aa67,_0x352adf,_0x55ba4b){var _0x162108={};var _0xcd5b32={};var _0x345a75;var _0x5132cf;return db['FreshsalesConfiguration'][_0xd989('0x53')]({'where':{'id':_0x26aa67[_0xd989('0x4d')]['id']}})[_0xd989('0x29')](handleEntityNotFound(_0x352adf,null))[_0xd989('0x29')](function(_0xfe76e2){if(_0xfe76e2){_0x345a75=_0xfe76e2;_0xcd5b32[_0xd989('0x32')]=_[_0xd989('0x34')](db[_0xd989('0x4f')][_0xd989('0x2e')]);_0xcd5b32['query']=_[_0xd989('0x34')](_0x26aa67['query']);_0xcd5b32['filters']=_['intersection'](_0xcd5b32['model'],_0xcd5b32[_0xd989('0x33')]);_0x162108['attributes']=_[_0xd989('0x36')](_0xcd5b32[_0xd989('0x32')],qs['fields'](_0x26aa67['query'][_0xd989('0x38')]));_0x162108['attributes']=_0x162108[_0xd989('0x37')][_0xd989('0x39')]?_0x162108[_0xd989('0x37')]:_0xcd5b32[_0xd989('0x32')];_0x162108[_0xd989('0x3b')]=qs['sort'](_0x26aa67[_0xd989('0x33')][_0xd989('0x3c')]);_0x162108['where']=qs[_0xd989('0x35')](_[_0xd989('0x50')](_0x26aa67[_0xd989('0x33')],_0xcd5b32[_0xd989('0x35')]));if(_0x26aa67[_0xd989('0x33')]['filter']){_0x162108[_0xd989('0x3d')]=_[_0xd989('0x40')](_0x162108[_0xd989('0x3d')],{'$or':_[_0xd989('0x2d')](_0x162108[_0xd989('0x37')],function(_0x755262){var _0x129422={};_0x129422[_0x755262]={'$like':'%'+_0x26aa67[_0xd989('0x33')][_0xd989('0x3e')]+'%'};return _0x129422;})});}_0x162108=_['merge']({},_0x162108,_0x26aa67['options']);return _0x345a75['getFields'](_0x162108);}})[_0xd989('0x29')](function(_0x99b627){if(_0x99b627){_0x5132cf=_0x99b627['length'];if(!_0x26aa67[_0xd989('0x33')][_0xd989('0x51')]('nolimit')){_0x162108['limit']=qs[_0xd989('0x24')](_0x26aa67[_0xd989('0x33')][_0xd989('0x24')]);_0x162108[_0xd989('0x23')]=qs[_0xd989('0x23')](_0x26aa67[_0xd989('0x33')][_0xd989('0x23')]);}return _0x345a75[_0xd989('0x54')](_0x162108);}})[_0xd989('0x29')](function(_0x3f3ebe){if(_0x3f3ebe){return _0x3f3ebe?{'count':_0x5132cf,'rows':_0x3f3ebe}:null;}})[_0xd989('0x29')](respondWithResult(_0x352adf,null))[_0xd989('0x46')](handleError(_0x352adf,null));}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.model.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.model.js index 7657a36..1d0b02f 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 _0x13a3=['request-promise','path','rimraf','../../config/environment','./intFreshsalesConfiguration.attributes','define','FreshsalesConfiguration','int_freshsales_configurations','lodash','util','../../config/logger','api','moment'];(function(_0x4a6f35,_0x23be71){var _0x5a8861=function(_0x1683cc){while(--_0x1683cc){_0x4a6f35['push'](_0x4a6f35['shift']());}};_0x5a8861(++_0x23be71);}(_0x13a3,0x19b));var _0x313a=function(_0x42466b,_0x127900){_0x42466b=_0x42466b-0x0;var _0x2dae5b=_0x13a3[_0x42466b];return _0x2dae5b;};'use strict';var _=require(_0x313a('0x0'));var util=require(_0x313a('0x1'));var logger=require(_0x313a('0x2'))(_0x313a('0x3'));var moment=require(_0x313a('0x4'));var BPromise=require('bluebird');var rp=require(_0x313a('0x5'));var fs=require('fs');var path=require(_0x313a('0x6'));var rimraf=require(_0x313a('0x7'));var config=require(_0x313a('0x8'));var attributes=require(_0x313a('0x9'));module['exports']=function(_0x2b8040,_0x177059){return _0x2b8040[_0x313a('0xa')](_0x313a('0xb'),attributes,{'tableName':_0x313a('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6bea=['path','../../config/environment','./intFreshsalesConfiguration.attributes','exports','int_freshsales_configurations','lodash','../../config/logger','moment','request-promise'];(function(_0x58cced,_0x37d2cd){var _0x49a8d2=function(_0x60b56a){while(--_0x60b56a){_0x58cced['push'](_0x58cced['shift']());}};_0x49a8d2(++_0x37d2cd);}(_0x6bea,0x149));var _0xa6be=function(_0x3b0c8e,_0x35e752){_0x3b0c8e=_0x3b0c8e-0x0;var _0x57fdee=_0x6bea[_0x3b0c8e];return _0x57fdee;};'use strict';var _=require(_0xa6be('0x0'));var util=require('util');var logger=require(_0xa6be('0x1'))('api');var moment=require(_0xa6be('0x2'));var BPromise=require('bluebird');var rp=require(_0xa6be('0x3'));var fs=require('fs');var path=require(_0xa6be('0x4'));var rimraf=require('rimraf');var config=require(_0xa6be('0x5'));var attributes=require(_0xa6be('0x6'));module[_0xa6be('0x7')]=function(_0x4a528d,_0x20e4da){return _0x4a528d['define']('FreshsalesConfiguration',attributes,{'tableName':_0xa6be('0x8'),'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 fad9d33..16250a1 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 _0xae87=['http','request','then','request\x20sent','debug','error','code','FreshsalesConfiguration,\x20%s,\x20%s','message','info','result','catch','randomstring','ioredis','../../config/utils','../../config/environment','jayson/promise','client'];(function(_0x32fa5f,_0x44198d){var _0x411f12=function(_0x37a087){while(--_0x37a087){_0x32fa5f['push'](_0x32fa5f['shift']());}};_0x411f12(++_0x44198d);}(_0xae87,0x1ce));var _0x7ae8=function(_0x30cc1a,_0x162bbc){_0x30cc1a=_0x30cc1a-0x0;var _0xb3f18f=_0xae87[_0x30cc1a];return _0xb3f18f;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x7ae8('0x0'));var fs=require('fs');var Redis=require(_0x7ae8('0x1'));var db=require('../../mysqldb')['db'];var utils=require(_0x7ae8('0x2'));var logger=require('../../config/logger')('rpc');var config=require(_0x7ae8('0x3'));var jayson=require(_0x7ae8('0x4'));var client=jayson[_0x7ae8('0x5')][_0x7ae8('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x57d2f2,_0xcfe30e,_0x2e195a){return new BPromise(function(_0x26d4bb,_0x2aa2d5){return client[_0x7ae8('0x7')](_0x57d2f2,_0x2e195a)[_0x7ae8('0x8')](function(_0x2138eb){logger['info']('FreshsalesConfiguration,\x20%s,\x20%s',_0xcfe30e,_0x7ae8('0x9'));logger[_0x7ae8('0xa')]('FreshsalesConfiguration,\x20%s,\x20%s,\x20%s',_0xcfe30e,_0x7ae8('0x9'),JSON['stringify'](_0x2138eb));if(_0x2138eb[_0x7ae8('0xb')]){if(_0x2138eb['error'][_0x7ae8('0xc')]===0x1f4){logger['error'](_0x7ae8('0xd'),_0xcfe30e,_0x2138eb[_0x7ae8('0xb')][_0x7ae8('0xe')]);return _0x2aa2d5(_0x2138eb['error'][_0x7ae8('0xe')]);}logger[_0x7ae8('0xb')]('FreshsalesConfiguration,\x20%s,\x20%s',_0xcfe30e,_0x2138eb[_0x7ae8('0xb')][_0x7ae8('0xe')]);return _0x26d4bb(_0x2138eb[_0x7ae8('0xb')][_0x7ae8('0xe')]);}else{logger[_0x7ae8('0xf')](_0x7ae8('0xd'),_0xcfe30e,_0x7ae8('0x9'));_0x26d4bb(_0x2138eb[_0x7ae8('0x10')][_0x7ae8('0xe')]);}})[_0x7ae8('0x11')](function(_0x712147){logger[_0x7ae8('0xb')]('FreshsalesConfiguration,\x20%s,\x20%s',_0xcfe30e,_0x712147);_0x2aa2d5(_0x712147);});});} \ No newline at end of file +var _0x16d2=['../../config/environment','jayson/promise','client','http','request','then','info','FreshsalesConfiguration,\x20%s,\x20%s','request\x20sent','FreshsalesConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0x16d2,0x123));var _0x216d=function(_0x209f41,_0x10d7c3){_0x209f41=_0x209f41-0x0;var _0x323b6f=_0x16d2[_0x209f41];return _0x323b6f;};'use strict';var _=require(_0x216d('0x0'));var util=require(_0x216d('0x1'));var moment=require(_0x216d('0x2'));var BPromise=require(_0x216d('0x3'));var rs=require(_0x216d('0x4'));var fs=require('fs');var Redis=require(_0x216d('0x5'));var db=require(_0x216d('0x6'))['db'];var utils=require(_0x216d('0x7'));var logger=require(_0x216d('0x8'))('rpc');var config=require(_0x216d('0x9'));var jayson=require(_0x216d('0xa'));var client=jayson[_0x216d('0xb')][_0x216d('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x1dd8e2,_0x24c831,_0x3e0ada){return new BPromise(function(_0x28da14,_0x57accc){return client[_0x216d('0xd')](_0x1dd8e2,_0x3e0ada)[_0x216d('0xe')](function(_0x35abcf){logger[_0x216d('0xf')](_0x216d('0x10'),_0x24c831,_0x216d('0x11'));logger['debug'](_0x216d('0x12'),_0x24c831,'request\x20sent',JSON[_0x216d('0x13')](_0x35abcf));if(_0x35abcf[_0x216d('0x14')]){if(_0x35abcf[_0x216d('0x14')][_0x216d('0x15')]===0x1f4){logger[_0x216d('0x14')](_0x216d('0x10'),_0x24c831,_0x35abcf['error'][_0x216d('0x16')]);return _0x57accc(_0x35abcf['error'][_0x216d('0x16')]);}logger[_0x216d('0x14')]('FreshsalesConfiguration,\x20%s,\x20%s',_0x24c831,_0x35abcf[_0x216d('0x14')][_0x216d('0x16')]);return _0x28da14(_0x35abcf['error'][_0x216d('0x16')]);}else{logger['info'](_0x216d('0x10'),_0x24c831,_0x216d('0x11'));_0x28da14(_0x35abcf[_0x216d('0x17')][_0x216d('0x16')]);}})[_0x216d('0x18')](function(_0x304dfa){logger[_0x216d('0x14')](_0x216d('0x10'),_0x24c831,_0x304dfa);_0x57accc(_0x304dfa);});});} \ No newline at end of file diff --git a/server/api/intFreshsalesField/index.js b/server/api/intFreshsalesField/index.js index 44590d1..c3f6892 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 _0xca3f=['Router','../../components/auth/service','../../components/interaction/service','./intFreshsalesField.controller','get','isAuthenticated','index','show','post','create','/:id','update','delete','destroy','multer','util','path','connect-timeout','express'];(function(_0x25e7cb,_0x3579b7){var _0x375d92=function(_0xe8cf3b){while(--_0xe8cf3b){_0x25e7cb['push'](_0x25e7cb['shift']());}};_0x375d92(++_0x3579b7);}(_0xca3f,0xa6));var _0xfca3=function(_0x4e2460,_0x1ab3e3){_0x4e2460=_0x4e2460-0x0;var _0x5cef9b=_0xca3f[_0x4e2460];return _0x5cef9b;};'use strict';var multer=require(_0xfca3('0x0'));var util=require(_0xfca3('0x1'));var path=require(_0xfca3('0x2'));var timeout=require(_0xfca3('0x3'));var express=require(_0xfca3('0x4'));var router=express[_0xfca3('0x5')]();var auth=require(_0xfca3('0x6'));var interaction=require(_0xfca3('0x7'));var config=require('../../config/environment');var controller=require(_0xfca3('0x8'));router[_0xfca3('0x9')]('/',auth[_0xfca3('0xa')](),controller[_0xfca3('0xb')]);router[_0xfca3('0x9')]('/:id',auth[_0xfca3('0xa')](),controller[_0xfca3('0xc')]);router[_0xfca3('0xd')]('/',auth[_0xfca3('0xa')](),controller[_0xfca3('0xe')]);router['put'](_0xfca3('0xf'),auth[_0xfca3('0xa')](),controller[_0xfca3('0x10')]);router[_0xfca3('0x11')](_0xfca3('0xf'),auth[_0xfca3('0xa')](),controller[_0xfca3('0x12')]);module['exports']=router; \ No newline at end of file +var _0x0458=['../../components/interaction/service','../../config/environment','./intFreshsalesField.controller','get','isAuthenticated','index','/:id','show','post','create','put','destroy','exports','multer','util','path','connect-timeout'];(function(_0x4942aa,_0xd6e51){var _0x1f3fac=function(_0x2987f9){while(--_0x2987f9){_0x4942aa['push'](_0x4942aa['shift']());}};_0x1f3fac(++_0xd6e51);}(_0x0458,0x12e));var _0x8045=function(_0x7d818f,_0x58f761){_0x7d818f=_0x7d818f-0x0;var _0x5d2cee=_0x0458[_0x7d818f];return _0x5d2cee;};'use strict';var multer=require(_0x8045('0x0'));var util=require(_0x8045('0x1'));var path=require(_0x8045('0x2'));var timeout=require(_0x8045('0x3'));var express=require('express');var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0x8045('0x4'));var config=require(_0x8045('0x5'));var controller=require(_0x8045('0x6'));router[_0x8045('0x7')]('/',auth[_0x8045('0x8')](),controller[_0x8045('0x9')]);router[_0x8045('0x7')](_0x8045('0xa'),auth[_0x8045('0x8')](),controller[_0x8045('0xb')]);router[_0x8045('0xc')]('/',auth[_0x8045('0x8')](),controller[_0x8045('0xd')]);router[_0x8045('0xe')](_0x8045('0xa'),auth[_0x8045('0x8')](),controller['update']);router['delete'](_0x8045('0xa'),auth[_0x8045('0x8')](),controller[_0x8045('0xf')]);module[_0x8045('0x10')]=router; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.attributes.js b/server/api/intFreshsalesField/intFreshsalesField.attributes.js index 2712f82..451d703 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 _0xccef=['variable','keyValue','STRING','ENUM','customVariable','BOOLEAN','exports','string'];(function(_0x149083,_0x4047b6){var _0x4dc74e=function(_0x1211f9){while(--_0x1211f9){_0x149083['push'](_0x149083['shift']());}};_0x4dc74e(++_0x4047b6);}(_0xccef,0x1ee));var _0xfcce=function(_0x21a9d9,_0x4d5ac8){_0x21a9d9=_0x21a9d9-0x0;var _0x46adce=_0xccef[_0x21a9d9];return _0x46adce;};'use strict';var Sequelize=require('sequelize');module[_0xfcce('0x0')]={'type':{'type':Sequelize['ENUM'](_0xfcce('0x1'),_0xfcce('0x2'),'customVariable',_0xfcce('0x3')),'defaultValue':_0xfcce('0x1')},'content':{'type':Sequelize[_0xfcce('0x4')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0xfcce('0x5')](_0xfcce('0x1'),'variable',_0xfcce('0x6'))},'keyContent':{'type':Sequelize[_0xfcce('0x4')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0xfcce('0x4')]},'customField':{'type':Sequelize[_0xfcce('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xe0da=['string','customVariable','ENUM','STRING','BOOLEAN','sequelize','exports'];(function(_0x4b0d6c,_0x207221){var _0x1be295=function(_0x46048a){while(--_0x46048a){_0x4b0d6c['push'](_0x4b0d6c['shift']());}};_0x1be295(++_0x207221);}(_0xe0da,0xd0));var _0xae0d=function(_0x4df36b,_0x34c82e){_0x4df36b=_0x4df36b-0x0;var _0x31abaa=_0xe0da[_0x4df36b];return _0x31abaa;};'use strict';var Sequelize=require(_0xae0d('0x0'));module[_0xae0d('0x1')]={'type':{'type':Sequelize['ENUM'](_0xae0d('0x2'),'variable',_0xae0d('0x3'),'keyValue'),'defaultValue':_0xae0d('0x2')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0xae0d('0x4')](_0xae0d('0x2'),'variable',_0xae0d('0x3'))},'keyContent':{'type':Sequelize[_0xae0d('0x5')]},'idField':{'type':Sequelize[_0xae0d('0x5')]},'nameField':{'type':Sequelize[_0xae0d('0x5')]},'customField':{'type':Sequelize[_0xae0d('0x6')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xae0d('0x5')]}}; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.controller.js b/server/api/intFreshsalesField/intFreshsalesField.controller.js index f0ac20b..c6cde01 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 _0x1f28=['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','end','status','json','count','offset','limit','Content-Range','apply','reject','save','then','destroy','error','stack','name','send','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','nolimit','where','pick','filter','merge','VIRTUAL','options','FreshsalesField','include','rows','catch','length','find','create','body','update','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','lodash'];(function(_0xd91aea,_0x90202d){var _0xed7cb0=function(_0x325633){while(--_0x325633){_0xd91aea['push'](_0xd91aea['shift']());}};_0xed7cb0(++_0x90202d);}(_0x1f28,0x7e));var _0x81f2=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0x1f28[_0xfae23b];return _0x200640;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x81f2('0x0'));var rimraf=require(_0x81f2('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x81f2('0x2'));var rp=require(_0x81f2('0x3'));var moment=require(_0x81f2('0x4'));var BPromise=require(_0x81f2('0x5'));var Mustache=require('mustache');var util=require(_0x81f2('0x6'));var path=require(_0x81f2('0x7'));var sox=require(_0x81f2('0x8'));var csv=require(_0x81f2('0x9'));var ejs=require(_0x81f2('0xa'));var fs=require('fs');var _=require(_0x81f2('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x81f2('0xc'));var toCsv=require(_0x81f2('0x9'));var querystring=require(_0x81f2('0xd'));var Papa=require('papaparse');var Redis=require(_0x81f2('0xe'));var authService=require(_0x81f2('0xf'));var qs=require(_0x81f2('0x10'));var as=require(_0x81f2('0x11'));var hardwareService=require(_0x81f2('0x12'));var logger=require(_0x81f2('0x13'))(_0x81f2('0x14'));var utils=require(_0x81f2('0x15'));var config=require(_0x81f2('0x16'));var db=require(_0x81f2('0x17'))['db'];function respondWithStatusCode(_0x31e199,_0x1c5673){_0x1c5673=_0x1c5673||0xcc;return function(_0x4ce06c){if(_0x4ce06c){return _0x31e199[_0x81f2('0x18')](_0x1c5673);}return _0x31e199['status'](_0x1c5673)[_0x81f2('0x19')]();};}function respondWithResult(_0x4dcc07,_0x3c8569){_0x3c8569=_0x3c8569||0xc8;return function(_0x17f518){if(_0x17f518){return _0x4dcc07[_0x81f2('0x1a')](_0x3c8569)[_0x81f2('0x1b')](_0x17f518);}};}function respondWithFilteredResult(_0x58ab8d,_0x23e64d){return function(_0x38b8d8){if(_0x38b8d8){var _0x471171=_0x38b8d8[_0x81f2('0x1c')],_0x37ab95=_0x23e64d[_0x81f2('0x1d')],_0x1bf4c4=_0x23e64d['offset']+_0x23e64d[_0x81f2('0x1e')],_0xef6b2a;if(_0x1bf4c4>=_0x471171){_0x1bf4c4=_0x471171;_0xef6b2a=0xc8;}else{_0xef6b2a=0xce;}_0x58ab8d[_0x81f2('0x1a')](_0xef6b2a);return _0x58ab8d['set'](_0x81f2('0x1f'),_0x37ab95+'-'+_0x1bf4c4+'/'+_0x471171)[_0x81f2('0x1b')](_0x38b8d8);}return null;};}function patchUpdates(_0x3ab7b4){return function(_0x54b630){try{jsonpatch[_0x81f2('0x20')](_0x54b630,_0x3ab7b4,!![]);}catch(_0x37fa81){return BPromise[_0x81f2('0x21')](_0x37fa81);}return _0x54b630[_0x81f2('0x22')]();};}function saveUpdates(_0x555977,_0x23b845){return function(_0x393f31){if(_0x393f31){return _0x393f31['update'](_0x555977)[_0x81f2('0x23')](function(_0x5529c4){return _0x5529c4;});}return null;};}function removeEntity(_0x10612a,_0x4f1af5){return function(_0x1c7931){if(_0x1c7931){return _0x1c7931[_0x81f2('0x24')]()[_0x81f2('0x23')](function(){_0x10612a[_0x81f2('0x1a')](0xcc)[_0x81f2('0x19')]();});}};}function handleEntityNotFound(_0x33bc62,_0xe0132e){return function(_0x4311b5){if(!_0x4311b5){_0x33bc62[_0x81f2('0x18')](0x194);}return _0x4311b5;};}function handleError(_0x264abf,_0x51e390){_0x51e390=_0x51e390||0x1f4;return function(_0x36b85d){logger[_0x81f2('0x25')](_0x36b85d[_0x81f2('0x26')]);if(_0x36b85d[_0x81f2('0x27')]){delete _0x36b85d['name'];}_0x264abf[_0x81f2('0x1a')](_0x51e390)[_0x81f2('0x28')](_0x36b85d);};}exports['index']=function(_0x1f93bb,_0x3fa52e){var _0x14d9a2={},_0x28fe20={},_0x478734={'count':0x0,'rows':[]};var _0x2b2d24=_[_0x81f2('0x29')](db['FreshsalesField'][_0x81f2('0x2a')],function(_0x58f971){return{'name':_0x58f971[_0x81f2('0x2b')],'type':_0x58f971[_0x81f2('0x2c')][_0x81f2('0x2d')]};});_0x28fe20[_0x81f2('0x2e')]=_[_0x81f2('0x29')](_0x2b2d24,_0x81f2('0x27'));_0x28fe20[_0x81f2('0x2f')]=_[_0x81f2('0x30')](_0x1f93bb[_0x81f2('0x2f')]);_0x28fe20[_0x81f2('0x31')]=_[_0x81f2('0x32')](_0x28fe20['model'],_0x28fe20[_0x81f2('0x2f')]);_0x14d9a2[_0x81f2('0x33')]=_[_0x81f2('0x32')](_0x28fe20[_0x81f2('0x2e')],qs[_0x81f2('0x34')](_0x1f93bb['query'][_0x81f2('0x34')]));_0x14d9a2[_0x81f2('0x33')]=_0x14d9a2['attributes']['length']?_0x14d9a2[_0x81f2('0x33')]:_0x28fe20['model'];if(!_0x1f93bb[_0x81f2('0x2f')]['hasOwnProperty'](_0x81f2('0x35'))){_0x14d9a2[_0x81f2('0x1e')]=qs[_0x81f2('0x1e')](_0x1f93bb[_0x81f2('0x2f')][_0x81f2('0x1e')]);_0x14d9a2[_0x81f2('0x1d')]=qs[_0x81f2('0x1d')](_0x1f93bb[_0x81f2('0x2f')][_0x81f2('0x1d')]);}_0x14d9a2['order']=qs['sort'](_0x1f93bb[_0x81f2('0x2f')]['sort']);_0x14d9a2[_0x81f2('0x36')]=qs[_0x81f2('0x31')](_[_0x81f2('0x37')](_0x1f93bb[_0x81f2('0x2f')],_0x28fe20[_0x81f2('0x31')]),_0x2b2d24);if(_0x1f93bb['query'][_0x81f2('0x38')]){_0x14d9a2[_0x81f2('0x36')]=_[_0x81f2('0x39')](_0x14d9a2[_0x81f2('0x36')],{'$or':_[_0x81f2('0x29')](_0x2b2d24,function(_0x16d44c){if(_0x16d44c[_0x81f2('0x2c')]!==_0x81f2('0x3a')){var _0xee9225={};_0xee9225[_0x16d44c[_0x81f2('0x27')]]={'$like':'%'+_0x1f93bb[_0x81f2('0x2f')][_0x81f2('0x38')]+'%'};return _0xee9225;}})});}_0x14d9a2=_[_0x81f2('0x39')]({},_0x14d9a2,_0x1f93bb[_0x81f2('0x3b')]);var _0x2e0c2b={'where':_0x14d9a2['where']};return db[_0x81f2('0x3c')][_0x81f2('0x1c')](_0x2e0c2b)[_0x81f2('0x23')](function(_0x219e76){_0x478734[_0x81f2('0x1c')]=_0x219e76;if(_0x1f93bb[_0x81f2('0x2f')]['includeAll']){_0x14d9a2[_0x81f2('0x3d')]=[{'all':!![]}];}return db[_0x81f2('0x3c')]['findAll'](_0x14d9a2);})[_0x81f2('0x23')](function(_0x3c7d74){_0x478734[_0x81f2('0x3e')]=_0x3c7d74;return _0x478734;})[_0x81f2('0x23')](respondWithFilteredResult(_0x3fa52e,_0x14d9a2))[_0x81f2('0x3f')](handleError(_0x3fa52e,null));};exports['show']=function(_0xafd856,_0x44a658){var _0x3a823f={'raw':!![],'where':{'id':_0xafd856['params']['id']}},_0x533bd1={};_0x533bd1[_0x81f2('0x2e')]=_[_0x81f2('0x30')](db[_0x81f2('0x3c')][_0x81f2('0x2a')]);_0x533bd1[_0x81f2('0x2f')]=_['keys'](_0xafd856[_0x81f2('0x2f')]);_0x533bd1['filters']=_[_0x81f2('0x32')](_0x533bd1[_0x81f2('0x2e')],_0x533bd1[_0x81f2('0x2f')]);_0x3a823f[_0x81f2('0x33')]=_['intersection'](_0x533bd1[_0x81f2('0x2e')],qs['fields'](_0xafd856['query'][_0x81f2('0x34')]));_0x3a823f['attributes']=_0x3a823f[_0x81f2('0x33')][_0x81f2('0x40')]?_0x3a823f[_0x81f2('0x33')]:_0x533bd1['model'];if(_0xafd856[_0x81f2('0x2f')]['includeAll']){_0x3a823f[_0x81f2('0x3d')]=[{'all':!![]}];}_0x3a823f=_['merge']({},_0x3a823f,_0xafd856[_0x81f2('0x3b')]);return db[_0x81f2('0x3c')][_0x81f2('0x41')](_0x3a823f)[_0x81f2('0x23')](handleEntityNotFound(_0x44a658,null))['then'](respondWithResult(_0x44a658,null))[_0x81f2('0x3f')](handleError(_0x44a658,null));};exports['create']=function(_0x5ab22b,_0x323fc9){return db[_0x81f2('0x3c')][_0x81f2('0x42')](_0x5ab22b[_0x81f2('0x43')],{})[_0x81f2('0x23')](respondWithResult(_0x323fc9,0xc9))[_0x81f2('0x3f')](handleError(_0x323fc9,null));};exports[_0x81f2('0x44')]=function(_0x766780,_0x39cdc2){if(_0x766780[_0x81f2('0x43')]['id']){delete _0x766780['body']['id'];}return db['FreshsalesField'][_0x81f2('0x41')]({'where':{'id':_0x766780['params']['id']}})[_0x81f2('0x23')](handleEntityNotFound(_0x39cdc2,null))[_0x81f2('0x23')](saveUpdates(_0x766780[_0x81f2('0x43')],null))['then'](respondWithResult(_0x39cdc2,null))[_0x81f2('0x3f')](handleError(_0x39cdc2,null));};exports[_0x81f2('0x24')]=function(_0x74dcec,_0xbfe92){return db['FreshsalesField']['find']({'where':{'id':_0x74dcec['params']['id']}})[_0x81f2('0x23')](handleEntityNotFound(_0xbfe92,null))[_0x81f2('0x23')](removeEntity(_0xbfe92,null))[_0x81f2('0x3f')](handleError(_0xbfe92,null));}; \ No newline at end of file +var _0xe955=['../../config/logger','../../config/utils','../../config/environment','status','end','count','offset','Content-Range','apply','update','then','destroy','sendStatus','error','stack','send','index','rawAttributes','fieldName','type','key','model','map','name','query','filters','attributes','intersection','fields','length','hasOwnProperty','limit','order','sort','where','filter','merge','FreshsalesField','includeAll','include','findAll','rows','params','keys','find','create','body','catch','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','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'];(function(_0x2d719c,_0x59b346){var _0x16c7e8=function(_0x2cd5a8){while(--_0x2cd5a8){_0x2d719c['push'](_0x2d719c['shift']());}};_0x16c7e8(++_0x59b346);}(_0xe955,0x150));var _0x5e95=function(_0x4b5133,_0x30dfca){_0x4b5133=_0x4b5133-0x0;var _0x415ac4=_0xe955[_0x4b5133];return _0x415ac4;};'use strict';var pdf=require(_0x5e95('0x0'));var emlformat=require(_0x5e95('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x5e95('0x2'));var jsonpatch=require(_0x5e95('0x3'));var rp=require(_0x5e95('0x4'));var moment=require(_0x5e95('0x5'));var BPromise=require(_0x5e95('0x6'));var Mustache=require(_0x5e95('0x7'));var util=require(_0x5e95('0x8'));var path=require(_0x5e95('0x9'));var sox=require(_0x5e95('0xa'));var csv=require(_0x5e95('0xb'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x5e95('0xc'));var squel=require(_0x5e95('0xd'));var crypto=require(_0x5e95('0xe'));var jsforce=require(_0x5e95('0xf'));var deskjs=require(_0x5e95('0x10'));var toCsv=require(_0x5e95('0xb'));var querystring=require(_0x5e95('0x11'));var Papa=require(_0x5e95('0x12'));var Redis=require(_0x5e95('0x13'));var authService=require(_0x5e95('0x14'));var qs=require(_0x5e95('0x15'));var as=require(_0x5e95('0x16'));var hardwareService=require(_0x5e95('0x17'));var logger=require(_0x5e95('0x18'))('api');var utils=require(_0x5e95('0x19'));var config=require(_0x5e95('0x1a'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4074eb,_0x3cb638){_0x3cb638=_0x3cb638||0xcc;return function(_0x2051e0){if(_0x2051e0){return _0x4074eb['sendStatus'](_0x3cb638);}return _0x4074eb[_0x5e95('0x1b')](_0x3cb638)[_0x5e95('0x1c')]();};}function respondWithResult(_0x4cec65,_0x2ba4d3){_0x2ba4d3=_0x2ba4d3||0xc8;return function(_0x474578){if(_0x474578){return _0x4cec65[_0x5e95('0x1b')](_0x2ba4d3)['json'](_0x474578);}};}function respondWithFilteredResult(_0x2cc79b,_0x2e93e5){return function(_0x53ca7b){if(_0x53ca7b){var _0x4b85bd=_0x53ca7b[_0x5e95('0x1d')],_0x8ec118=_0x2e93e5[_0x5e95('0x1e')],_0x1c462d=_0x2e93e5[_0x5e95('0x1e')]+_0x2e93e5['limit'],_0x52c014;if(_0x1c462d>=_0x4b85bd){_0x1c462d=_0x4b85bd;_0x52c014=0xc8;}else{_0x52c014=0xce;}_0x2cc79b[_0x5e95('0x1b')](_0x52c014);return _0x2cc79b['set'](_0x5e95('0x1f'),_0x8ec118+'-'+_0x1c462d+'/'+_0x4b85bd)['json'](_0x53ca7b);}return null;};}function patchUpdates(_0x25a1aa){return function(_0x85a799){try{jsonpatch[_0x5e95('0x20')](_0x85a799,_0x25a1aa,!![]);}catch(_0x5ae8a4){return BPromise['reject'](_0x5ae8a4);}return _0x85a799['save']();};}function saveUpdates(_0x10917f,_0x316228){return function(_0x456e30){if(_0x456e30){return _0x456e30[_0x5e95('0x21')](_0x10917f)[_0x5e95('0x22')](function(_0x444374){return _0x444374;});}return null;};}function removeEntity(_0x53bba3,_0x5e9838){return function(_0x5a21f9){if(_0x5a21f9){return _0x5a21f9[_0x5e95('0x23')]()[_0x5e95('0x22')](function(){_0x53bba3[_0x5e95('0x1b')](0xcc)[_0x5e95('0x1c')]();});}};}function handleEntityNotFound(_0x38f3db,_0xead2fe){return function(_0x26891d){if(!_0x26891d){_0x38f3db[_0x5e95('0x24')](0x194);}return _0x26891d;};}function handleError(_0x2ccfb2,_0x18e5fb){_0x18e5fb=_0x18e5fb||0x1f4;return function(_0xbecdcc){logger[_0x5e95('0x25')](_0xbecdcc[_0x5e95('0x26')]);if(_0xbecdcc['name']){delete _0xbecdcc['name'];}_0x2ccfb2[_0x5e95('0x1b')](_0x18e5fb)[_0x5e95('0x27')](_0xbecdcc);};}exports[_0x5e95('0x28')]=function(_0x133013,_0x2dd7d1){var _0x53bcfc={},_0x25da6f={},_0x1228dc={'count':0x0,'rows':[]};var _0x3b9f68=_['map'](db['FreshsalesField'][_0x5e95('0x29')],function(_0x563fb8){return{'name':_0x563fb8[_0x5e95('0x2a')],'type':_0x563fb8[_0x5e95('0x2b')][_0x5e95('0x2c')]};});_0x25da6f[_0x5e95('0x2d')]=_[_0x5e95('0x2e')](_0x3b9f68,_0x5e95('0x2f'));_0x25da6f[_0x5e95('0x30')]=_['keys'](_0x133013[_0x5e95('0x30')]);_0x25da6f[_0x5e95('0x31')]=_['intersection'](_0x25da6f[_0x5e95('0x2d')],_0x25da6f['query']);_0x53bcfc[_0x5e95('0x32')]=_[_0x5e95('0x33')](_0x25da6f[_0x5e95('0x2d')],qs['fields'](_0x133013[_0x5e95('0x30')][_0x5e95('0x34')]));_0x53bcfc['attributes']=_0x53bcfc[_0x5e95('0x32')][_0x5e95('0x35')]?_0x53bcfc[_0x5e95('0x32')]:_0x25da6f[_0x5e95('0x2d')];if(!_0x133013[_0x5e95('0x30')][_0x5e95('0x36')]('nolimit')){_0x53bcfc[_0x5e95('0x37')]=qs[_0x5e95('0x37')](_0x133013[_0x5e95('0x30')][_0x5e95('0x37')]);_0x53bcfc[_0x5e95('0x1e')]=qs[_0x5e95('0x1e')](_0x133013[_0x5e95('0x30')][_0x5e95('0x1e')]);}_0x53bcfc[_0x5e95('0x38')]=qs['sort'](_0x133013['query'][_0x5e95('0x39')]);_0x53bcfc[_0x5e95('0x3a')]=qs[_0x5e95('0x31')](_['pick'](_0x133013[_0x5e95('0x30')],_0x25da6f['filters']),_0x3b9f68);if(_0x133013['query'][_0x5e95('0x3b')]){_0x53bcfc[_0x5e95('0x3a')]=_[_0x5e95('0x3c')](_0x53bcfc[_0x5e95('0x3a')],{'$or':_[_0x5e95('0x2e')](_0x3b9f68,function(_0xe0722d){if(_0xe0722d[_0x5e95('0x2b')]!=='VIRTUAL'){var _0x139c80={};_0x139c80[_0xe0722d[_0x5e95('0x2f')]]={'$like':'%'+_0x133013['query'][_0x5e95('0x3b')]+'%'};return _0x139c80;}})});}_0x53bcfc=_[_0x5e95('0x3c')]({},_0x53bcfc,_0x133013['options']);var _0x393304={'where':_0x53bcfc[_0x5e95('0x3a')]};return db[_0x5e95('0x3d')]['count'](_0x393304)[_0x5e95('0x22')](function(_0x2839fe){_0x1228dc[_0x5e95('0x1d')]=_0x2839fe;if(_0x133013[_0x5e95('0x30')][_0x5e95('0x3e')]){_0x53bcfc[_0x5e95('0x3f')]=[{'all':!![]}];}return db[_0x5e95('0x3d')][_0x5e95('0x40')](_0x53bcfc);})[_0x5e95('0x22')](function(_0x2bf0ea){_0x1228dc[_0x5e95('0x41')]=_0x2bf0ea;return _0x1228dc;})[_0x5e95('0x22')](respondWithFilteredResult(_0x2dd7d1,_0x53bcfc))['catch'](handleError(_0x2dd7d1,null));};exports['show']=function(_0x396cb3,_0xc992a5){var _0x14bf26={'raw':!![],'where':{'id':_0x396cb3[_0x5e95('0x42')]['id']}},_0x4a5a9d={};_0x4a5a9d[_0x5e95('0x2d')]=_[_0x5e95('0x43')](db['FreshsalesField'][_0x5e95('0x29')]);_0x4a5a9d[_0x5e95('0x30')]=_[_0x5e95('0x43')](_0x396cb3[_0x5e95('0x30')]);_0x4a5a9d['filters']=_[_0x5e95('0x33')](_0x4a5a9d[_0x5e95('0x2d')],_0x4a5a9d[_0x5e95('0x30')]);_0x14bf26[_0x5e95('0x32')]=_['intersection'](_0x4a5a9d[_0x5e95('0x2d')],qs[_0x5e95('0x34')](_0x396cb3[_0x5e95('0x30')]['fields']));_0x14bf26[_0x5e95('0x32')]=_0x14bf26[_0x5e95('0x32')][_0x5e95('0x35')]?_0x14bf26['attributes']:_0x4a5a9d[_0x5e95('0x2d')];if(_0x396cb3[_0x5e95('0x30')][_0x5e95('0x3e')]){_0x14bf26[_0x5e95('0x3f')]=[{'all':!![]}];}_0x14bf26=_[_0x5e95('0x3c')]({},_0x14bf26,_0x396cb3['options']);return db[_0x5e95('0x3d')][_0x5e95('0x44')](_0x14bf26)[_0x5e95('0x22')](handleEntityNotFound(_0xc992a5,null))['then'](respondWithResult(_0xc992a5,null))['catch'](handleError(_0xc992a5,null));};exports[_0x5e95('0x45')]=function(_0x2ab55e,_0x4cc8f1){return db[_0x5e95('0x3d')]['create'](_0x2ab55e[_0x5e95('0x46')],{})[_0x5e95('0x22')](respondWithResult(_0x4cc8f1,0xc9))[_0x5e95('0x47')](handleError(_0x4cc8f1,null));};exports[_0x5e95('0x21')]=function(_0x291a60,_0x1db2b8){if(_0x291a60[_0x5e95('0x46')]['id']){delete _0x291a60[_0x5e95('0x46')]['id'];}return db[_0x5e95('0x3d')][_0x5e95('0x44')]({'where':{'id':_0x291a60['params']['id']}})[_0x5e95('0x22')](handleEntityNotFound(_0x1db2b8,null))[_0x5e95('0x22')](saveUpdates(_0x291a60['body'],null))[_0x5e95('0x22')](respondWithResult(_0x1db2b8,null))[_0x5e95('0x47')](handleError(_0x1db2b8,null));};exports[_0x5e95('0x23')]=function(_0x156ae6,_0x17cda7){return db['FreshsalesField']['find']({'where':{'id':_0x156ae6[_0x5e95('0x42')]['id']}})[_0x5e95('0x22')](handleEntityNotFound(_0x17cda7,null))[_0x5e95('0x22')](removeEntity(_0x17cda7,null))[_0x5e95('0x47')](handleError(_0x17cda7,null));}; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.model.js b/server/api/intFreshsalesField/intFreshsalesField.model.js index 17c04a3..49dfc35 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 _0x00d9=['bluebird','request-promise','path','../../config/environment','./intFreshsalesField.attributes','exports','define','FreshsalesField','int_freshsales_fields','freshsales_unique_index','idField','FieldId','lodash','util','../../config/logger','api','moment'];(function(_0x450d4e,_0xcacc3){var _0x300304=function(_0x49ab27){while(--_0x49ab27){_0x450d4e['push'](_0x450d4e['shift']());}};_0x300304(++_0xcacc3);}(_0x00d9,0xa5));var _0x900d=function(_0x2c91e9,_0x2fb965){_0x2c91e9=_0x2c91e9-0x0;var _0x13f0ff=_0x00d9[_0x2c91e9];return _0x13f0ff;};'use strict';var _=require(_0x900d('0x0'));var util=require(_0x900d('0x1'));var logger=require(_0x900d('0x2'))(_0x900d('0x3'));var moment=require(_0x900d('0x4'));var BPromise=require(_0x900d('0x5'));var rp=require(_0x900d('0x6'));var fs=require('fs');var path=require(_0x900d('0x7'));var rimraf=require('rimraf');var config=require(_0x900d('0x8'));var attributes=require(_0x900d('0x9'));module[_0x900d('0xa')]=function(_0x2b7a69,_0x50a371){return _0x2b7a69[_0x900d('0xb')](_0x900d('0xc'),attributes,{'tableName':_0x900d('0xd'),'paranoid':![],'indexes':[{'name':_0x900d('0xe'),'fields':[_0x900d('0xf'),_0x900d('0x10')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x426f=['util','../../config/logger','api','bluebird','request-promise','rimraf','./intFreshsalesField.attributes','exports','int_freshsales_fields','idField','FieldId','lodash'];(function(_0x1477ef,_0x54a5d6){var _0x164acd=function(_0x139149){while(--_0x139149){_0x1477ef['push'](_0x1477ef['shift']());}};_0x164acd(++_0x54a5d6);}(_0x426f,0x77));var _0xf426=function(_0x3f097c,_0x32f99f){_0x3f097c=_0x3f097c-0x0;var _0x524678=_0x426f[_0x3f097c];return _0x524678;};'use strict';var _=require(_0xf426('0x0'));var util=require(_0xf426('0x1'));var logger=require(_0xf426('0x2'))(_0xf426('0x3'));var moment=require('moment');var BPromise=require(_0xf426('0x4'));var rp=require(_0xf426('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xf426('0x6'));var config=require('../../config/environment');var attributes=require(_0xf426('0x7'));module[_0xf426('0x8')]=function(_0x5a003a,_0x42d481){return _0x5a003a['define']('FreshsalesField',attributes,{'tableName':_0xf426('0x9'),'paranoid':![],'indexes':[{'name':'freshsales_unique_index','fields':[_0xf426('0xa'),_0xf426('0xb')],'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 0e941b3..8148adc 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 _0xda27=['FreshsalesField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','request','then','info','FreshsalesField,\x20%s,\x20%s','request\x20sent'];(function(_0x3313e9,_0x57c194){var _0x59acd3=function(_0x306b05){while(--_0x306b05){_0x3313e9['push'](_0x3313e9['shift']());}};_0x59acd3(++_0x57c194);}(_0xda27,0x1cf));var _0x7da2=function(_0x53fbdf,_0x262848){_0x53fbdf=_0x53fbdf-0x0;var _0x16094b=_0xda27[_0x53fbdf];return _0x16094b;};'use strict';var _=require(_0x7da2('0x0'));var util=require(_0x7da2('0x1'));var moment=require(_0x7da2('0x2'));var BPromise=require(_0x7da2('0x3'));var rs=require(_0x7da2('0x4'));var fs=require('fs');var Redis=require(_0x7da2('0x5'));var db=require(_0x7da2('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x7da2('0x7'))(_0x7da2('0x8'));var config=require(_0x7da2('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x7da2('0xa')][_0x7da2('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xb4a9cd,_0x47e1a0,_0x1dea56){return new BPromise(function(_0x17b3dc,_0x52c53b){return client[_0x7da2('0xc')](_0xb4a9cd,_0x1dea56)[_0x7da2('0xd')](function(_0x22bada){logger[_0x7da2('0xe')](_0x7da2('0xf'),_0x47e1a0,_0x7da2('0x10'));logger['debug'](_0x7da2('0x11'),_0x47e1a0,_0x7da2('0x10'),JSON[_0x7da2('0x12')](_0x22bada));if(_0x22bada[_0x7da2('0x13')]){if(_0x22bada[_0x7da2('0x13')][_0x7da2('0x14')]===0x1f4){logger[_0x7da2('0x13')]('FreshsalesField,\x20%s,\x20%s',_0x47e1a0,_0x22bada['error'][_0x7da2('0x15')]);return _0x52c53b(_0x22bada['error']['message']);}logger['error']('FreshsalesField,\x20%s,\x20%s',_0x47e1a0,_0x22bada[_0x7da2('0x13')]['message']);return _0x17b3dc(_0x22bada[_0x7da2('0x13')][_0x7da2('0x15')]);}else{logger[_0x7da2('0xe')]('FreshsalesField,\x20%s,\x20%s',_0x47e1a0,_0x7da2('0x10'));_0x17b3dc(_0x22bada[_0x7da2('0x16')][_0x7da2('0x15')]);}})[_0x7da2('0x17')](function(_0xa33ae9){logger[_0x7da2('0x13')]('FreshsalesField,\x20%s,\x20%s',_0x47e1a0,_0xa33ae9);_0x52c53b(_0xa33ae9);});});} \ No newline at end of file +var _0xb1a5=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http','request','info','FreshsalesField,\x20%s,\x20%s','debug','FreshsalesField,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','lodash'];(function(_0x4cf98e,_0xba4b79){var _0x1623ac=function(_0x459bc0){while(--_0x459bc0){_0x4cf98e['push'](_0x4cf98e['shift']());}};_0x1623ac(++_0xba4b79);}(_0xb1a5,0x1cd));var _0x5b1a=function(_0x1ca9e2,_0x1508b0){_0x1ca9e2=_0x1ca9e2-0x0;var _0x15996c=_0xb1a5[_0x1ca9e2];return _0x15996c;};'use strict';var _=require(_0x5b1a('0x0'));var util=require('util');var moment=require(_0x5b1a('0x1'));var BPromise=require(_0x5b1a('0x2'));var rs=require(_0x5b1a('0x3'));var fs=require('fs');var Redis=require(_0x5b1a('0x4'));var db=require(_0x5b1a('0x5'))['db'];var utils=require(_0x5b1a('0x6'));var logger=require(_0x5b1a('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0x5b1a('0x8'));var client=jayson[_0x5b1a('0x9')][_0x5b1a('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x20ecde,_0x55786e,_0x137a15){return new BPromise(function(_0x3dfb03,_0x2fda43){return client[_0x5b1a('0xb')](_0x20ecde,_0x137a15)['then'](function(_0x474505){logger[_0x5b1a('0xc')](_0x5b1a('0xd'),_0x55786e,'request\x20sent');logger[_0x5b1a('0xe')](_0x5b1a('0xf'),_0x55786e,_0x5b1a('0x10'),JSON[_0x5b1a('0x11')](_0x474505));if(_0x474505[_0x5b1a('0x12')]){if(_0x474505[_0x5b1a('0x12')][_0x5b1a('0x13')]===0x1f4){logger['error'](_0x5b1a('0xd'),_0x55786e,_0x474505['error'][_0x5b1a('0x14')]);return _0x2fda43(_0x474505['error'][_0x5b1a('0x14')]);}logger[_0x5b1a('0x12')](_0x5b1a('0xd'),_0x55786e,_0x474505['error'][_0x5b1a('0x14')]);return _0x3dfb03(_0x474505[_0x5b1a('0x12')][_0x5b1a('0x14')]);}else{logger[_0x5b1a('0xc')]('FreshsalesField,\x20%s,\x20%s',_0x55786e,_0x5b1a('0x10'));_0x3dfb03(_0x474505['result']['message']);}})['catch'](function(_0x48ec6d){logger[_0x5b1a('0x12')](_0x5b1a('0xd'),_0x55786e,_0x48ec6d);_0x2fda43(_0x48ec6d);});});} \ No newline at end of file diff --git a/server/api/intSalesforceAccount/index.js b/server/api/intSalesforceAccount/index.js index 619dbb6..c816997 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 _0xcc7f=['/:id/configurations','getConfigurations','post','create','addConfiguration','put','update','delete','destroy','exports','multer','express','../../components/interaction/service','./intSalesforceAccount.controller','isAuthenticated','get','/:id','show'];(function(_0x58f363,_0x135c64){var _0xcb2c83=function(_0x55d7fd){while(--_0x55d7fd){_0x58f363['push'](_0x58f363['shift']());}};_0xcb2c83(++_0x135c64);}(_0xcc7f,0x1cc));var _0xfcc7=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xcc7f[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0xfcc7('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0xfcc7('0x1'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0xfcc7('0x2'));var config=require('../../config/environment');var controller=require(_0xfcc7('0x3'));router['get']('/',auth[_0xfcc7('0x4')](),controller['index']);router[_0xfcc7('0x5')](_0xfcc7('0x6'),auth[_0xfcc7('0x4')](),controller[_0xfcc7('0x7')]);router[_0xfcc7('0x5')](_0xfcc7('0x8'),auth['isAuthenticated'](),controller[_0xfcc7('0x9')]);router[_0xfcc7('0x5')]('/:id/fields',auth['isAuthenticated'](),controller['getFields']);router[_0xfcc7('0xa')]('/',auth[_0xfcc7('0x4')](),controller[_0xfcc7('0xb')]);router[_0xfcc7('0xa')](_0xfcc7('0x8'),auth[_0xfcc7('0x4')](),controller[_0xfcc7('0xc')]);router[_0xfcc7('0xd')]('/:id',auth['isAuthenticated'](),controller[_0xfcc7('0xe')]);router[_0xfcc7('0xf')](_0xfcc7('0x6'),auth['isAuthenticated'](),controller[_0xfcc7('0x10')]);module[_0xfcc7('0x11')]=router; \ No newline at end of file +var _0xcfab=['addConfiguration','put','delete','destroy','exports','multer','path','express','../../components/auth/service','./intSalesforceAccount.controller','get','isAuthenticated','/:id','show','getConfigurations','/:id/fields','getFields','post','/:id/configurations'];(function(_0x52bed8,_0x28fae3){var _0x2ea74e=function(_0x459068){while(--_0x459068){_0x52bed8['push'](_0x52bed8['shift']());}};_0x2ea74e(++_0x28fae3);}(_0xcfab,0x1e0));var _0xbcfa=function(_0x14e754,_0x5eea21){_0x14e754=_0x14e754-0x0;var _0x9e18a1=_0xcfab[_0x14e754];return _0x9e18a1;};'use strict';var multer=require(_0xbcfa('0x0'));var util=require('util');var path=require(_0xbcfa('0x1'));var timeout=require('connect-timeout');var express=require(_0xbcfa('0x2'));var router=express['Router']();var auth=require(_0xbcfa('0x3'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xbcfa('0x4'));router[_0xbcfa('0x5')]('/',auth[_0xbcfa('0x6')](),controller['index']);router[_0xbcfa('0x5')](_0xbcfa('0x7'),auth[_0xbcfa('0x6')](),controller[_0xbcfa('0x8')]);router['get']('/:id/configurations',auth[_0xbcfa('0x6')](),controller[_0xbcfa('0x9')]);router['get'](_0xbcfa('0xa'),auth['isAuthenticated'](),controller[_0xbcfa('0xb')]);router[_0xbcfa('0xc')]('/',auth[_0xbcfa('0x6')](),controller['create']);router[_0xbcfa('0xc')](_0xbcfa('0xd'),auth['isAuthenticated'](),controller[_0xbcfa('0xe')]);router[_0xbcfa('0xf')]('/:id',auth[_0xbcfa('0x6')](),controller['update']);router[_0xbcfa('0x10')](_0xbcfa('0x7'),auth[_0xbcfa('0x6')](),controller[_0xbcfa('0x11')]);module[_0xbcfa('0x12')]=router; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.attributes.js b/server/api/intSalesforceAccount/intSalesforceAccount.attributes.js index de0c558..2d4b356 100644 --- a/server/api/intSalesforceAccount/intSalesforceAccount.attributes.js +++ b/server/api/intSalesforceAccount/intSalesforceAccount.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5fab=['username','ENUM','integrationTab','sequelize','exports','STRING'];(function(_0x68ae0c,_0x4e44d7){var _0xe0bc00=function(_0x163faa){while(--_0x163faa){_0x68ae0c['push'](_0x68ae0c['shift']());}};_0xe0bc00(++_0x4e44d7);}(_0x5fab,0x177));var _0xb5fa=function(_0x5c68c7,_0x54ba85){_0x5c68c7=_0x5c68c7-0x0;var _0x4a94fc=_0x5fab[_0x5c68c7];return _0x4a94fc;};'use strict';var Sequelize=require(_0xb5fa('0x0'));module[_0xb5fa('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xb5fa('0x2')]},'username':{'type':Sequelize[_0xb5fa('0x2')],'unique':_0xb5fa('0x3')},'remoteUri':{'type':Sequelize[_0xb5fa('0x2')]},'password':{'type':Sequelize[_0xb5fa('0x2')]},'clientId':{'type':Sequelize[_0xb5fa('0x2')]},'clientSecret':{'type':Sequelize[_0xb5fa('0x2')]},'securityToken':{'type':Sequelize[_0xb5fa('0x2')]},'serverUrl':{'type':Sequelize[_0xb5fa('0x2')]},'type':{'type':Sequelize[_0xb5fa('0x4')]('integrationTab','newTab'),'defaultValue':_0xb5fa('0x5')}}; \ No newline at end of file +var _0xc4aa=['STRING','username','ENUM','integrationTab','newTab','sequelize','exports'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x16b9ed,_0x56517a){_0x16b9ed=_0x16b9ed-0x0;var _0x66b1f8=_0xc4aa[_0x16b9ed];return _0x66b1f8;};'use strict';var Sequelize=require(_0xac4a('0x0'));module[_0xac4a('0x1')]={'name':{'type':Sequelize[_0xac4a('0x2')]},'description':{'type':Sequelize[_0xac4a('0x2')]},'username':{'type':Sequelize[_0xac4a('0x2')],'unique':_0xac4a('0x3')},'remoteUri':{'type':Sequelize['STRING']},'password':{'type':Sequelize['STRING']},'clientId':{'type':Sequelize['STRING']},'clientSecret':{'type':Sequelize[_0xac4a('0x2')]},'securityToken':{'type':Sequelize[_0xac4a('0x2')]},'serverUrl':{'type':Sequelize[_0xac4a('0x2')]},'type':{'type':Sequelize[_0xac4a('0x4')](_0xac4a('0x5'),_0xac4a('0x6')),'defaultValue':_0xac4a('0x5')}}; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.controller.js b/server/api/intSalesforceAccount/intSalesforceAccount.controller.js index 803fac1..a509cf3 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 _0x3295=['path','sox','to-csv','ejs','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../components/integrations/configuration','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','SalesforceAccount,\x20%s,\x20%s','request\x20sent','debug','SalesforceAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','sendStatus','end','status','json','offset','limit','apply','update','destroy','stack','name','send','index','SalesforceAccount','rawAttributes','fieldName','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','count','includeAll','include','findAll','show','params','find','create','body','findOne','SalesforceConfiguration','getConfigurations','addConfiguration','AccountId','Subjects','channel','Descriptions','getDescriptions','SalesforceField','getFields','Task','remoteUri','clientSecret','username','password','lastIndexOf','Connection','clientId','login','concat','securityToken','isNil','ticketType','describe','CallDisposition','CallDurationInSeconds','CallObject','CallType','IsArchived','Priority','Status','Type','Case','Reason','IsEscalated','SuppliedName','SuppliedCompany','remove','custom','includes','label','picklistValues','value','boolean','true','False','false','statusCode','getFields,\x20%s,\x20%s,\x20%s','Wrong\x20credentials','eml-format','zip-dir','moment','mustache','util'];(function(_0x4c0622,_0x5dacaf){var _0x1799d8=function(_0x2ba801){while(--_0x2ba801){_0x4c0622['push'](_0x4c0622['shift']());}};_0x1799d8(++_0x5dacaf);}(_0x3295,0x10d));var _0x5329=function(_0x37a79c,_0x2b19f0){_0x37a79c=_0x37a79c-0x0;var _0x561d89=_0x3295[_0x37a79c];return _0x561d89;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x5329('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x5329('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x5329('0x2'));var BPromise=require('bluebird');var Mustache=require(_0x5329('0x3'));var util=require(_0x5329('0x4'));var path=require(_0x5329('0x5'));var sox=require(_0x5329('0x6'));var csv=require(_0x5329('0x7'));var ejs=require(_0x5329('0x8'));var fs=require('fs');var _=require('lodash');var squel=require(_0x5329('0x9'));var crypto=require(_0x5329('0xa'));var jsforce=require('jsforce');var deskjs=require(_0x5329('0xb'));var toCsv=require(_0x5329('0x7'));var querystring=require(_0x5329('0xc'));var Papa=require(_0x5329('0xd'));var Redis=require(_0x5329('0xe'));var authService=require(_0x5329('0xf'));var qs=require(_0x5329('0x10'));var as=require(_0x5329('0x11'));var hardwareService=require(_0x5329('0x12'));var logger=require(_0x5329('0x13'))(_0x5329('0x14'));var utils=require(_0x5329('0x15'));var config=require(_0x5329('0x16'));var db=require('../../mysqldb')['db'];var integrations=require(_0x5329('0x17'));var jayson=require('jayson/promise');var client=jayson[_0x5329('0x18')][_0x5329('0x19')]({'port':0x232a});function checkPasswordPattern(_0x38c8da,_0x293608,_0x1e87cf){if(_0x1e87cf){var _0x3aabf7=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x3aabf7[_0x5329('0x1a')](_0x293608)){return _0x38c8da;}else{throw new db[(_0x5329('0x1b'))]['ValidationError'](_0x5329('0x1c'));}}else{return _0x38c8da;}}function respondWithRpcPromise(_0x5b7f37,_0x506501,_0xbb5430,_0x151073){return new BPromise(function(_0x4ecc45,_0x31b351){var _0x1037ff=_0x151073||client;return _0x1037ff[_0x5329('0x1d')](_0x5b7f37,_0xbb5430)[_0x5329('0x1e')](function(_0x97ed61){logger['info'](_0x5329('0x1f'),_0x506501,_0x5329('0x20'));logger[_0x5329('0x21')](_0x5329('0x22'),_0x506501,_0x5329('0x20'),JSON[_0x5329('0x23')](_0x97ed61));if(_0x97ed61[_0x5329('0x24')]){if(_0x97ed61[_0x5329('0x24')][_0x5329('0x25')]===0x1f4){logger[_0x5329('0x24')](_0x5329('0x1f'),_0x506501,_0x97ed61[_0x5329('0x24')][_0x5329('0x26')]);return _0x31b351(_0x97ed61[_0x5329('0x24')][_0x5329('0x26')]);}logger[_0x5329('0x24')](_0x5329('0x1f'),_0x506501,_0x97ed61[_0x5329('0x24')]['message']);return _0x4ecc45(_0x97ed61[_0x5329('0x24')][_0x5329('0x26')]);}else{logger['info'](_0x5329('0x1f'),_0x506501,_0x5329('0x20'));_0x4ecc45(_0x97ed61['result'][_0x5329('0x26')]);}})[_0x5329('0x27')](function(_0x28fac5){logger['error'](_0x5329('0x1f'),_0x506501,_0x28fac5);_0x31b351(_0x28fac5);});});}function respondWithStatusCode(_0x3ab297,_0xfa56b0){_0xfa56b0=_0xfa56b0||0xcc;return function(_0x1bd460){if(_0x1bd460){return _0x3ab297[_0x5329('0x28')](_0xfa56b0);}return _0x3ab297['status'](_0xfa56b0)[_0x5329('0x29')]();};}function respondWithResult(_0x9e9402,_0x1205b6){_0x1205b6=_0x1205b6||0xc8;return function(_0x242e72){if(_0x242e72){return _0x9e9402[_0x5329('0x2a')](_0x1205b6)[_0x5329('0x2b')](_0x242e72);}};}function respondWithFilteredResult(_0x2bcf8c,_0x4990b3){return function(_0x5f2c4c){if(_0x5f2c4c){var _0x1ee494=_0x5f2c4c['count'],_0x1ee0d1=_0x4990b3[_0x5329('0x2c')],_0x4157ec=_0x4990b3['offset']+_0x4990b3[_0x5329('0x2d')],_0x1190e5;if(_0x4157ec>=_0x1ee494){_0x4157ec=_0x1ee494;_0x1190e5=0xc8;}else{_0x1190e5=0xce;}_0x2bcf8c['status'](_0x1190e5);return _0x2bcf8c['set']('Content-Range',_0x1ee0d1+'-'+_0x4157ec+'/'+_0x1ee494)[_0x5329('0x2b')](_0x5f2c4c);}return null;};}function patchUpdates(_0x1d6ddd){return function(_0x446dbd){try{jsonpatch[_0x5329('0x2e')](_0x446dbd,_0x1d6ddd,!![]);}catch(_0x491013){return BPromise['reject'](_0x491013);}return _0x446dbd['save']();};}function saveUpdates(_0x5df100,_0x416f91){return function(_0x252c49){if(_0x252c49){return _0x252c49[_0x5329('0x2f')](_0x5df100)[_0x5329('0x1e')](function(_0x640631){return _0x640631;});}return null;};}function removeEntity(_0x32a1bb,_0x5b7002){return function(_0x2279e2){if(_0x2279e2){return _0x2279e2[_0x5329('0x30')]()['then'](function(){_0x32a1bb[_0x5329('0x2a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5751e9,_0x19fe9e){return function(_0x1fe7f3){if(!_0x1fe7f3){_0x5751e9[_0x5329('0x28')](0x194);}return _0x1fe7f3;};}function handleError(_0x418989,_0x45f5b9){_0x45f5b9=_0x45f5b9||0x1f4;return function(_0x19d125){logger[_0x5329('0x24')](_0x19d125[_0x5329('0x31')]);if(_0x19d125[_0x5329('0x32')]){delete _0x19d125[_0x5329('0x32')];}_0x418989[_0x5329('0x2a')](_0x45f5b9)[_0x5329('0x33')](_0x19d125);};}exports[_0x5329('0x34')]=function(_0x7ca55d,_0x15034b){var _0x455402={},_0x2fb0bf={},_0x2f80a0={'count':0x0,'rows':[]};var _0x3f4c3e=_['map'](db[_0x5329('0x35')][_0x5329('0x36')],function(_0x43b08d){return{'name':_0x43b08d[_0x5329('0x37')],'type':_0x43b08d['type'][_0x5329('0x38')]};});_0x2fb0bf[_0x5329('0x39')]=_[_0x5329('0x3a')](_0x3f4c3e,_0x5329('0x32'));_0x2fb0bf[_0x5329('0x3b')]=_[_0x5329('0x3c')](_0x7ca55d[_0x5329('0x3b')]);_0x2fb0bf[_0x5329('0x3d')]=_[_0x5329('0x3e')](_0x2fb0bf[_0x5329('0x39')],_0x2fb0bf[_0x5329('0x3b')]);_0x455402[_0x5329('0x3f')]=_['intersection'](_0x2fb0bf[_0x5329('0x39')],qs[_0x5329('0x40')](_0x7ca55d[_0x5329('0x3b')]['fields']));_0x455402[_0x5329('0x3f')]=_0x455402[_0x5329('0x3f')][_0x5329('0x41')]?_0x455402[_0x5329('0x3f')]:_0x2fb0bf[_0x5329('0x39')];if(!_0x7ca55d['query'][_0x5329('0x42')](_0x5329('0x43'))){_0x455402[_0x5329('0x2d')]=qs[_0x5329('0x2d')](_0x7ca55d[_0x5329('0x3b')]['limit']);_0x455402['offset']=qs['offset'](_0x7ca55d[_0x5329('0x3b')][_0x5329('0x2c')]);}_0x455402[_0x5329('0x44')]=qs[_0x5329('0x45')](_0x7ca55d[_0x5329('0x3b')][_0x5329('0x45')]);_0x455402[_0x5329('0x46')]=qs[_0x5329('0x3d')](_[_0x5329('0x47')](_0x7ca55d['query'],_0x2fb0bf[_0x5329('0x3d')]),_0x3f4c3e);if(_0x7ca55d[_0x5329('0x3b')][_0x5329('0x48')]){_0x455402[_0x5329('0x46')]=_[_0x5329('0x49')](_0x455402['where'],{'$or':_[_0x5329('0x3a')](_0x3f4c3e,function(_0x38b331){if(_0x38b331[_0x5329('0x4a')]!==_0x5329('0x4b')){var _0xaaf54e={};_0xaaf54e[_0x38b331[_0x5329('0x32')]]={'$like':'%'+_0x7ca55d[_0x5329('0x3b')]['filter']+'%'};return _0xaaf54e;}})});}_0x455402=_[_0x5329('0x49')]({},_0x455402,_0x7ca55d[_0x5329('0x4c')]);var _0x56139e={'where':_0x455402[_0x5329('0x46')]};return db['SalesforceAccount'][_0x5329('0x4d')](_0x56139e)[_0x5329('0x1e')](function(_0x569d6d){_0x2f80a0[_0x5329('0x4d')]=_0x569d6d;if(_0x7ca55d[_0x5329('0x3b')][_0x5329('0x4e')]){_0x455402[_0x5329('0x4f')]=[{'all':!![]}];}return db[_0x5329('0x35')][_0x5329('0x50')](_0x455402);})[_0x5329('0x1e')](function(_0x5c5722){_0x2f80a0['rows']=_0x5c5722;return _0x2f80a0;})['then'](respondWithFilteredResult(_0x15034b,_0x455402))[_0x5329('0x27')](handleError(_0x15034b,null));};exports[_0x5329('0x51')]=function(_0x169235,_0x1cbc81){var _0x2b3bfe={'raw':![],'where':{'id':_0x169235[_0x5329('0x52')]['id']}},_0x107bea={};_0x107bea[_0x5329('0x39')]=_[_0x5329('0x3c')](db[_0x5329('0x35')][_0x5329('0x36')]);_0x107bea['query']=_[_0x5329('0x3c')](_0x169235[_0x5329('0x3b')]);_0x107bea[_0x5329('0x3d')]=_['intersection'](_0x107bea['model'],_0x107bea[_0x5329('0x3b')]);_0x2b3bfe[_0x5329('0x3f')]=_['intersection'](_0x107bea[_0x5329('0x39')],qs['fields'](_0x169235[_0x5329('0x3b')][_0x5329('0x40')]));_0x2b3bfe['attributes']=_0x2b3bfe[_0x5329('0x3f')][_0x5329('0x41')]?_0x2b3bfe[_0x5329('0x3f')]:_0x107bea[_0x5329('0x39')];if(_0x169235[_0x5329('0x3b')][_0x5329('0x4e')]){_0x2b3bfe[_0x5329('0x4f')]=[{'all':!![]}];}_0x2b3bfe=_[_0x5329('0x49')]({},_0x2b3bfe,_0x169235[_0x5329('0x4c')]);return db[_0x5329('0x35')][_0x5329('0x53')](_0x2b3bfe)['then'](handleEntityNotFound(_0x1cbc81,null))['then'](respondWithResult(_0x1cbc81,null))[_0x5329('0x27')](handleError(_0x1cbc81,null));};exports[_0x5329('0x54')]=function(_0x5c5df9,_0x29b788){return db['SalesforceAccount'][_0x5329('0x54')](_0x5c5df9[_0x5329('0x55')],{})[_0x5329('0x1e')](respondWithResult(_0x29b788,0xc9))[_0x5329('0x27')](handleError(_0x29b788,null));};exports[_0x5329('0x2f')]=function(_0x403f2c,_0x2632c0){if(_0x403f2c[_0x5329('0x55')]['id']){delete _0x403f2c[_0x5329('0x55')]['id'];}return db[_0x5329('0x35')][_0x5329('0x53')]({'where':{'id':_0x403f2c[_0x5329('0x52')]['id']}})[_0x5329('0x1e')](handleEntityNotFound(_0x2632c0,null))[_0x5329('0x1e')](saveUpdates(_0x403f2c[_0x5329('0x55')],null))[_0x5329('0x1e')](respondWithResult(_0x2632c0,null))[_0x5329('0x27')](handleError(_0x2632c0,null));};exports[_0x5329('0x30')]=function(_0x2dfdf1,_0x6aaa4f){return db[_0x5329('0x35')][_0x5329('0x53')]({'where':{'id':_0x2dfdf1[_0x5329('0x52')]['id']}})['then'](handleEntityNotFound(_0x6aaa4f,null))[_0x5329('0x1e')](removeEntity(_0x6aaa4f,null))[_0x5329('0x27')](handleError(_0x6aaa4f,null));};exports['getConfigurations']=function(_0xc4c34b,_0x51176d,_0x40438a){var _0x44b373={};var _0x1e9262={};var _0x2db479;var _0x108ef2;return db[_0x5329('0x35')][_0x5329('0x56')]({'where':{'id':_0xc4c34b[_0x5329('0x52')]['id']}})[_0x5329('0x1e')](handleEntityNotFound(_0x51176d,null))[_0x5329('0x1e')](function(_0x5d89f6){if(_0x5d89f6){_0x2db479=_0x5d89f6;_0x1e9262['model']=_[_0x5329('0x3c')](db[_0x5329('0x57')][_0x5329('0x36')]);_0x1e9262[_0x5329('0x3b')]=_['keys'](_0xc4c34b['query']);_0x1e9262[_0x5329('0x3d')]=_[_0x5329('0x3e')](_0x1e9262['model'],_0x1e9262[_0x5329('0x3b')]);_0x44b373['attributes']=_[_0x5329('0x3e')](_0x1e9262[_0x5329('0x39')],qs[_0x5329('0x40')](_0xc4c34b['query'][_0x5329('0x40')]));_0x44b373['attributes']=_0x44b373[_0x5329('0x3f')][_0x5329('0x41')]?_0x44b373['attributes']:_0x1e9262['model'];_0x44b373[_0x5329('0x44')]=qs[_0x5329('0x45')](_0xc4c34b['query'][_0x5329('0x45')]);_0x44b373['where']=qs['filters'](_[_0x5329('0x47')](_0xc4c34b['query'],_0x1e9262[_0x5329('0x3d')]));if(_0xc4c34b['query'][_0x5329('0x48')]){_0x44b373[_0x5329('0x46')]=_[_0x5329('0x49')](_0x44b373[_0x5329('0x46')],{'$or':_[_0x5329('0x3a')](_0x44b373['attributes'],function(_0x249efd){var _0x1b4add={};_0x1b4add[_0x249efd]={'$like':'%'+_0xc4c34b['query']['filter']+'%'};return _0x1b4add;})});}_0x44b373=_['merge']({},_0x44b373,_0xc4c34b[_0x5329('0x4c')]);return _0x2db479[_0x5329('0x58')](_0x44b373);}})[_0x5329('0x1e')](function(_0x148432){if(_0x148432){_0x108ef2=_0x148432[_0x5329('0x41')];if(!_0xc4c34b[_0x5329('0x3b')][_0x5329('0x42')]('nolimit')){_0x44b373['limit']=qs['limit'](_0xc4c34b[_0x5329('0x3b')][_0x5329('0x2d')]);_0x44b373[_0x5329('0x2c')]=qs[_0x5329('0x2c')](_0xc4c34b['query'][_0x5329('0x2c')]);}return _0x2db479[_0x5329('0x58')](_0x44b373);}})[_0x5329('0x1e')](function(_0x2c6d8a){if(_0x2c6d8a){return _0x2c6d8a?{'count':_0x108ef2,'rows':_0x2c6d8a}:null;}})[_0x5329('0x1e')](respondWithResult(_0x51176d,null))[_0x5329('0x27')](handleError(_0x51176d,null));};exports[_0x5329('0x59')]=function(_0x36b834,_0xe21c3f,_0x373a1e){if(_0x36b834[_0x5329('0x55')]['id']){delete _0x36b834[_0x5329('0x55')]['id'];}return db[_0x5329('0x35')][_0x5329('0x56')]({'where':{'id':_0x36b834['params']['id']}})[_0x5329('0x1e')](handleEntityNotFound(_0xe21c3f,null))[_0x5329('0x1e')](function(_0x1adbdc){if(_0x1adbdc){_0x36b834[_0x5329('0x55')][_0x5329('0x5a')]=_0x1adbdc['id'];_0x36b834[_0x5329('0x55')][_0x5329('0x5b')]=integrations['getSubjects'](_0x36b834[_0x5329('0x55')][_0x5329('0x5c')],_0x36b834[_0x5329('0x55')][_0x5329('0x4a')]);_0x36b834[_0x5329('0x55')][_0x5329('0x5d')]=integrations[_0x5329('0x5e')](_0x36b834['body']['channel'],_0x36b834[_0x5329('0x55')]['type']);return db[_0x5329('0x57')][_0x5329('0x54')](_0x36b834[_0x5329('0x55')],{'include':[{'model':db['SalesforceField'],'as':_0x5329('0x5b')},{'model':db[_0x5329('0x5f')],'as':'Descriptions'}]});}return null;})[_0x5329('0x1e')](respondWithResult(_0xe21c3f,null))[_0x5329('0x27')](handleError(_0xe21c3f,null));};exports[_0x5329('0x60')]=function(_0x125772,_0x44d4ca,_0x413173){var _0x3eccbb;var _0x12623a='';var _0x1d7762=_0x5329('0x61');return db[_0x5329('0x35')][_0x5329('0x56')]({'where':{'id':_0x125772[_0x5329('0x52')]['id']},'attributes':['id',_0x5329('0x62'),'clientId',_0x5329('0x63'),_0x5329('0x64'),_0x5329('0x65'),'securityToken']})[_0x5329('0x1e')](handleEntityNotFound(_0x44d4ca,null))[_0x5329('0x1e')](function(_0x1c7b40){if(_0x1c7b40){_0x12623a=_0x1c7b40[_0x5329('0x62')];var _0x575011=_0x12623a['slice'](-0x1);if(_0x575011==='/'){_0x12623a=_0x12623a['substring'](0x0,_0x12623a[_0x5329('0x66')](_0x575011));}_0x3eccbb=new jsforce[(_0x5329('0x67'))]({'oauth2':{'loginUrl':_0x12623a,'clientId':_0x1c7b40[_0x5329('0x68')],'clientSecret':_0x1c7b40[_0x5329('0x63')]}});return _0x3eccbb[_0x5329('0x69')](_0x1c7b40[_0x5329('0x64')],_0x1c7b40['password'][_0x5329('0x6a')](_0x1c7b40[_0x5329('0x6b')]));}})[_0x5329('0x1e')](function(_0xcccb4){if(_0xcccb4){if(!_[_0x5329('0x6c')](_0x125772['query'][_0x5329('0x6d')])){_0x1d7762=_0x125772['query'][_0x5329('0x6d')];}return _0x3eccbb['sobject'](_0x1d7762)[_0x5329('0x6e')]();}})[_0x5329('0x1e')](function(_0xa38b6e){var _0x1296d9=[_0x5329('0x6f'),_0x5329('0x70'),_0x5329('0x71'),_0x5329('0x72'),_0x5329('0x73'),_0x5329('0x74'),_0x5329('0x75'),_0x5329('0x76')];if(!_[_0x5329('0x6c')](_0x125772['query'][_0x5329('0x6d')])&&_0x125772[_0x5329('0x3b')][_0x5329('0x6d')]===_0x5329('0x77')){_0x1296d9=[_0x5329('0x76'),'Origin',_0x5329('0x78'),_0x5329('0x75'),'Priority',_0x5329('0x79'),_0x5329('0x7a'),_0x5329('0x7b')];}if(_0xa38b6e){_[_0x5329('0x7c')](_0xa38b6e[_0x5329('0x40')],function(_0x401554){return _0x401554[_0x5329('0x7d')]===![]&&!_0x1296d9[_0x5329('0x7e')](_0x401554[_0x5329('0x32')]);});return{'count':_0xa38b6e['fields'][_0x5329('0x41')],'rows':_[_0x5329('0x3a')](_0xa38b6e['fields'],function(_0x5804ec){return{'id':_0x5804ec[_0x5329('0x32')],'name':_0x5804ec[_0x5329('0x7f')],'custom':_0x5804ec[_0x5329('0x7d')],'options':_0x5804ec[_0x5329('0x80')]['length']>0x0?_[_0x5329('0x3a')](_0x5804ec[_0x5329('0x80')],function(_0x4cd1a3){return{'name':_0x4cd1a3['label'],'value':_0x4cd1a3[_0x5329('0x81')]};}):_0x5804ec[_0x5329('0x4a')]==_0x5329('0x82')?[{'name':'True','value':_0x5329('0x83')},{'name':_0x5329('0x84'),'value':_0x5329('0x85')}]:[]};})};}})[_0x5329('0x1e')](respondWithResult(_0x44d4ca,null))[_0x5329('0x27')](function(_0x21a5b1){var _0x5e0ad3=_0x125772[_0x5329('0x3b')][_0x5329('0x1a')]?0x1f4:_0x21a5b1[_0x5329('0x86')]||0x1f4;logger[_0x5329('0x24')](_0x5329('0x87'),_0x5329('0x60'),_0x5e0ad3,JSON['stringify'](_0x21a5b1));delete _0x21a5b1[_0x5329('0x32')];if(_0x5e0ad3===0x191){_0x5e0ad3=0x190;}_0x44d4ca['status'](_0x5e0ad3)['send'](_0x125772[_0x5329('0x3b')]['test']?{'message':_0x5329('0x88'),'statusCode':_0x21a5b1[_0x5329('0x86')]}:_0x21a5b1);});}; \ No newline at end of file +var _0x725a=['test','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','info','SalesforceAccount,\x20%s,\x20%s','request\x20sent','debug','SalesforceAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','end','status','json','offset','set','Content-Range','apply','reject','save','update','destroy','name','send','index','rawAttributes','type','model','map','query','keys','filters','attributes','intersection','fields','length','limit','order','sort','where','pick','merge','filter','count','includeAll','include','SalesforceAccount','findAll','show','params','options','find','create','body','getConfigurations','SalesforceConfiguration','hasOwnProperty','addConfiguration','findOne','AccountId','Subjects','Descriptions','channel','SalesforceField','getFields','Task','clientSecret','password','remoteUri','slice','substring','lastIndexOf','Connection','clientId','login','username','concat','securityToken','isNil','ticketType','sobject','describe','CallDurationInSeconds','CallObject','CallType','IsArchived','Status','Type','Case','Origin','Reason','Priority','IsEscalated','remove','label','custom','picklistValues','value','boolean','True','false','statusCode','Wrong\x20credentials','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','ejs','lodash','squel','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../components/integrations/configuration','jayson/promise','client','http'];(function(_0xf0cb1e,_0x56f865){var _0x3819d9=function(_0x530548){while(--_0x530548){_0xf0cb1e['push'](_0xf0cb1e['shift']());}};_0x3819d9(++_0x56f865);}(_0x725a,0x17e));var _0xa725=function(_0x4851ff,_0x1c9a8d){_0x4851ff=_0x4851ff-0x0;var _0x26773b=_0x725a[_0x4851ff];return _0x26773b;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0xa725('0x0'));var zipdir=require(_0xa725('0x1'));var jsonpatch=require(_0xa725('0x2'));var rp=require(_0xa725('0x3'));var moment=require(_0xa725('0x4'));var BPromise=require(_0xa725('0x5'));var Mustache=require(_0xa725('0x6'));var util=require('util');var path=require(_0xa725('0x7'));var sox=require(_0xa725('0x8'));var csv=require('to-csv');var ejs=require(_0xa725('0x9'));var fs=require('fs');var _=require(_0xa725('0xa'));var squel=require(_0xa725('0xb'));var crypto=require(_0xa725('0xc'));var jsforce=require(_0xa725('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xa725('0xe'));var Papa=require('papaparse');var Redis=require(_0xa725('0xf'));var authService=require(_0xa725('0x10'));var qs=require(_0xa725('0x11'));var as=require(_0xa725('0x12'));var hardwareService=require(_0xa725('0x13'));var logger=require('../../config/logger')(_0xa725('0x14'));var utils=require('../../config/utils');var config=require(_0xa725('0x15'));var db=require('../../mysqldb')['db'];var integrations=require(_0xa725('0x16'));var jayson=require(_0xa725('0x17'));var client=jayson[_0xa725('0x18')][_0xa725('0x19')]({'port':0x232a});function checkPasswordPattern(_0x22e94f,_0x4946d4,_0x1a5701){if(_0x1a5701){var _0x569751=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x569751[_0xa725('0x1a')](_0x4946d4)){return _0x22e94f;}else{throw new db[(_0xa725('0x1b'))][(_0xa725('0x1c'))](_0xa725('0x1d'));}}else{return _0x22e94f;}}function respondWithRpcPromise(_0x9f934b,_0x4e6502,_0x31da58,_0x3a7524){return new BPromise(function(_0x18475f,_0x45007a){var _0x2b8d73=_0x3a7524||client;return _0x2b8d73[_0xa725('0x1e')](_0x9f934b,_0x31da58)[_0xa725('0x1f')](function(_0x3d5846){logger[_0xa725('0x20')](_0xa725('0x21'),_0x4e6502,_0xa725('0x22'));logger[_0xa725('0x23')](_0xa725('0x24'),_0x4e6502,_0xa725('0x22'),JSON[_0xa725('0x25')](_0x3d5846));if(_0x3d5846[_0xa725('0x26')]){if(_0x3d5846[_0xa725('0x26')][_0xa725('0x27')]===0x1f4){logger[_0xa725('0x26')](_0xa725('0x21'),_0x4e6502,_0x3d5846[_0xa725('0x26')][_0xa725('0x28')]);return _0x45007a(_0x3d5846[_0xa725('0x26')][_0xa725('0x28')]);}logger['error'](_0xa725('0x21'),_0x4e6502,_0x3d5846['error'][_0xa725('0x28')]);return _0x18475f(_0x3d5846[_0xa725('0x26')]['message']);}else{logger['info'](_0xa725('0x21'),_0x4e6502,_0xa725('0x22'));_0x18475f(_0x3d5846[_0xa725('0x29')][_0xa725('0x28')]);}})[_0xa725('0x2a')](function(_0x388184){logger[_0xa725('0x26')](_0xa725('0x21'),_0x4e6502,_0x388184);_0x45007a(_0x388184);});});}function respondWithStatusCode(_0x5092f7,_0x2f7d79){_0x2f7d79=_0x2f7d79||0xcc;return function(_0x4d7998){if(_0x4d7998){return _0x5092f7[_0xa725('0x2b')](_0x2f7d79);}return _0x5092f7['status'](_0x2f7d79)[_0xa725('0x2c')]();};}function respondWithResult(_0x4dfdf5,_0x207ee5){_0x207ee5=_0x207ee5||0xc8;return function(_0x43270c){if(_0x43270c){return _0x4dfdf5[_0xa725('0x2d')](_0x207ee5)[_0xa725('0x2e')](_0x43270c);}};}function respondWithFilteredResult(_0x56672f,_0x2b539b){return function(_0x1e9d6e){if(_0x1e9d6e){var _0x9d2908=_0x1e9d6e['count'],_0x410a3c=_0x2b539b[_0xa725('0x2f')],_0x32e306=_0x2b539b[_0xa725('0x2f')]+_0x2b539b['limit'],_0x113157;if(_0x32e306>=_0x9d2908){_0x32e306=_0x9d2908;_0x113157=0xc8;}else{_0x113157=0xce;}_0x56672f[_0xa725('0x2d')](_0x113157);return _0x56672f[_0xa725('0x30')](_0xa725('0x31'),_0x410a3c+'-'+_0x32e306+'/'+_0x9d2908)['json'](_0x1e9d6e);}return null;};}function patchUpdates(_0x3b5e49){return function(_0x50f6ab){try{jsonpatch[_0xa725('0x32')](_0x50f6ab,_0x3b5e49,!![]);}catch(_0x521d89){return BPromise[_0xa725('0x33')](_0x521d89);}return _0x50f6ab[_0xa725('0x34')]();};}function saveUpdates(_0x44322a,_0x406ce8){return function(_0x33f5a7){if(_0x33f5a7){return _0x33f5a7[_0xa725('0x35')](_0x44322a)['then'](function(_0x2ebe39){return _0x2ebe39;});}return null;};}function removeEntity(_0x179900,_0x497dc7){return function(_0x16b931){if(_0x16b931){return _0x16b931[_0xa725('0x36')]()[_0xa725('0x1f')](function(){_0x179900[_0xa725('0x2d')](0xcc)[_0xa725('0x2c')]();});}};}function handleEntityNotFound(_0x95d09f,_0x5051ae){return function(_0x49ef99){if(!_0x49ef99){_0x95d09f[_0xa725('0x2b')](0x194);}return _0x49ef99;};}function handleError(_0x2803b,_0x4a539f){_0x4a539f=_0x4a539f||0x1f4;return function(_0x2c0d2b){logger[_0xa725('0x26')](_0x2c0d2b['stack']);if(_0x2c0d2b[_0xa725('0x37')]){delete _0x2c0d2b[_0xa725('0x37')];}_0x2803b[_0xa725('0x2d')](_0x4a539f)[_0xa725('0x38')](_0x2c0d2b);};}exports[_0xa725('0x39')]=function(_0x34e5d5,_0x1eb096){var _0x414c73={},_0x5e63b7={},_0x365041={'count':0x0,'rows':[]};var _0x8b2a1e=_['map'](db['SalesforceAccount'][_0xa725('0x3a')],function(_0x408a8f){return{'name':_0x408a8f['fieldName'],'type':_0x408a8f[_0xa725('0x3b')]['key']};});_0x5e63b7[_0xa725('0x3c')]=_[_0xa725('0x3d')](_0x8b2a1e,_0xa725('0x37'));_0x5e63b7[_0xa725('0x3e')]=_[_0xa725('0x3f')](_0x34e5d5[_0xa725('0x3e')]);_0x5e63b7[_0xa725('0x40')]=_['intersection'](_0x5e63b7[_0xa725('0x3c')],_0x5e63b7[_0xa725('0x3e')]);_0x414c73[_0xa725('0x41')]=_[_0xa725('0x42')](_0x5e63b7['model'],qs[_0xa725('0x43')](_0x34e5d5[_0xa725('0x3e')][_0xa725('0x43')]));_0x414c73['attributes']=_0x414c73[_0xa725('0x41')][_0xa725('0x44')]?_0x414c73[_0xa725('0x41')]:_0x5e63b7[_0xa725('0x3c')];if(!_0x34e5d5[_0xa725('0x3e')]['hasOwnProperty']('nolimit')){_0x414c73[_0xa725('0x45')]=qs['limit'](_0x34e5d5[_0xa725('0x3e')][_0xa725('0x45')]);_0x414c73[_0xa725('0x2f')]=qs[_0xa725('0x2f')](_0x34e5d5['query'][_0xa725('0x2f')]);}_0x414c73[_0xa725('0x46')]=qs[_0xa725('0x47')](_0x34e5d5['query'][_0xa725('0x47')]);_0x414c73[_0xa725('0x48')]=qs[_0xa725('0x40')](_[_0xa725('0x49')](_0x34e5d5[_0xa725('0x3e')],_0x5e63b7[_0xa725('0x40')]),_0x8b2a1e);if(_0x34e5d5['query']['filter']){_0x414c73[_0xa725('0x48')]=_[_0xa725('0x4a')](_0x414c73['where'],{'$or':_[_0xa725('0x3d')](_0x8b2a1e,function(_0x52d348){if(_0x52d348[_0xa725('0x3b')]!=='VIRTUAL'){var _0x9225e={};_0x9225e[_0x52d348[_0xa725('0x37')]]={'$like':'%'+_0x34e5d5[_0xa725('0x3e')][_0xa725('0x4b')]+'%'};return _0x9225e;}})});}_0x414c73=_['merge']({},_0x414c73,_0x34e5d5['options']);var _0x305e99={'where':_0x414c73['where']};return db['SalesforceAccount'][_0xa725('0x4c')](_0x305e99)[_0xa725('0x1f')](function(_0x2e5de5){_0x365041[_0xa725('0x4c')]=_0x2e5de5;if(_0x34e5d5[_0xa725('0x3e')][_0xa725('0x4d')]){_0x414c73[_0xa725('0x4e')]=[{'all':!![]}];}return db[_0xa725('0x4f')][_0xa725('0x50')](_0x414c73);})['then'](function(_0x3f97b5){_0x365041['rows']=_0x3f97b5;return _0x365041;})[_0xa725('0x1f')](respondWithFilteredResult(_0x1eb096,_0x414c73))['catch'](handleError(_0x1eb096,null));};exports[_0xa725('0x51')]=function(_0x392569,_0x31f142){var _0x17d095={'raw':![],'where':{'id':_0x392569[_0xa725('0x52')]['id']}},_0x241e42={};_0x241e42['model']=_[_0xa725('0x3f')](db['SalesforceAccount'][_0xa725('0x3a')]);_0x241e42[_0xa725('0x3e')]=_[_0xa725('0x3f')](_0x392569['query']);_0x241e42[_0xa725('0x40')]=_[_0xa725('0x42')](_0x241e42[_0xa725('0x3c')],_0x241e42[_0xa725('0x3e')]);_0x17d095[_0xa725('0x41')]=_[_0xa725('0x42')](_0x241e42['model'],qs[_0xa725('0x43')](_0x392569[_0xa725('0x3e')]['fields']));_0x17d095[_0xa725('0x41')]=_0x17d095[_0xa725('0x41')][_0xa725('0x44')]?_0x17d095['attributes']:_0x241e42[_0xa725('0x3c')];if(_0x392569[_0xa725('0x3e')]['includeAll']){_0x17d095['include']=[{'all':!![]}];}_0x17d095=_[_0xa725('0x4a')]({},_0x17d095,_0x392569[_0xa725('0x53')]);return db[_0xa725('0x4f')][_0xa725('0x54')](_0x17d095)[_0xa725('0x1f')](handleEntityNotFound(_0x31f142,null))[_0xa725('0x1f')](respondWithResult(_0x31f142,null))[_0xa725('0x2a')](handleError(_0x31f142,null));};exports[_0xa725('0x55')]=function(_0x2f020d,_0x46cd25){return db[_0xa725('0x4f')]['create'](_0x2f020d[_0xa725('0x56')],{})['then'](respondWithResult(_0x46cd25,0xc9))[_0xa725('0x2a')](handleError(_0x46cd25,null));};exports[_0xa725('0x35')]=function(_0x77afd2,_0x597692){if(_0x77afd2['body']['id']){delete _0x77afd2['body']['id'];}return db['SalesforceAccount'][_0xa725('0x54')]({'where':{'id':_0x77afd2[_0xa725('0x52')]['id']}})[_0xa725('0x1f')](handleEntityNotFound(_0x597692,null))['then'](saveUpdates(_0x77afd2[_0xa725('0x56')],null))['then'](respondWithResult(_0x597692,null))[_0xa725('0x2a')](handleError(_0x597692,null));};exports['destroy']=function(_0x597e93,_0x3e9ab5){return db['SalesforceAccount'][_0xa725('0x54')]({'where':{'id':_0x597e93['params']['id']}})[_0xa725('0x1f')](handleEntityNotFound(_0x3e9ab5,null))[_0xa725('0x1f')](removeEntity(_0x3e9ab5,null))[_0xa725('0x2a')](handleError(_0x3e9ab5,null));};exports[_0xa725('0x57')]=function(_0xcbdd49,_0x5095f2,_0x435f4d){var _0xd7617f={};var _0x180bbb={};var _0x16356a;var _0x5b5093;return db[_0xa725('0x4f')]['findOne']({'where':{'id':_0xcbdd49['params']['id']}})['then'](handleEntityNotFound(_0x5095f2,null))[_0xa725('0x1f')](function(_0x28c8ab){if(_0x28c8ab){_0x16356a=_0x28c8ab;_0x180bbb['model']=_[_0xa725('0x3f')](db[_0xa725('0x58')][_0xa725('0x3a')]);_0x180bbb['query']=_[_0xa725('0x3f')](_0xcbdd49[_0xa725('0x3e')]);_0x180bbb['filters']=_[_0xa725('0x42')](_0x180bbb[_0xa725('0x3c')],_0x180bbb['query']);_0xd7617f[_0xa725('0x41')]=_[_0xa725('0x42')](_0x180bbb[_0xa725('0x3c')],qs[_0xa725('0x43')](_0xcbdd49['query'][_0xa725('0x43')]));_0xd7617f[_0xa725('0x41')]=_0xd7617f[_0xa725('0x41')][_0xa725('0x44')]?_0xd7617f[_0xa725('0x41')]:_0x180bbb['model'];_0xd7617f[_0xa725('0x46')]=qs[_0xa725('0x47')](_0xcbdd49[_0xa725('0x3e')]['sort']);_0xd7617f[_0xa725('0x48')]=qs[_0xa725('0x40')](_['pick'](_0xcbdd49[_0xa725('0x3e')],_0x180bbb[_0xa725('0x40')]));if(_0xcbdd49[_0xa725('0x3e')][_0xa725('0x4b')]){_0xd7617f[_0xa725('0x48')]=_[_0xa725('0x4a')](_0xd7617f['where'],{'$or':_[_0xa725('0x3d')](_0xd7617f[_0xa725('0x41')],function(_0x406fe5){var _0x41ff54={};_0x41ff54[_0x406fe5]={'$like':'%'+_0xcbdd49[_0xa725('0x3e')][_0xa725('0x4b')]+'%'};return _0x41ff54;})});}_0xd7617f=_[_0xa725('0x4a')]({},_0xd7617f,_0xcbdd49['options']);return _0x16356a[_0xa725('0x57')](_0xd7617f);}})[_0xa725('0x1f')](function(_0x4cfa6f){if(_0x4cfa6f){_0x5b5093=_0x4cfa6f[_0xa725('0x44')];if(!_0xcbdd49['query'][_0xa725('0x59')]('nolimit')){_0xd7617f[_0xa725('0x45')]=qs[_0xa725('0x45')](_0xcbdd49[_0xa725('0x3e')][_0xa725('0x45')]);_0xd7617f[_0xa725('0x2f')]=qs[_0xa725('0x2f')](_0xcbdd49[_0xa725('0x3e')][_0xa725('0x2f')]);}return _0x16356a[_0xa725('0x57')](_0xd7617f);}})[_0xa725('0x1f')](function(_0x583644){if(_0x583644){return _0x583644?{'count':_0x5b5093,'rows':_0x583644}:null;}})[_0xa725('0x1f')](respondWithResult(_0x5095f2,null))['catch'](handleError(_0x5095f2,null));};exports[_0xa725('0x5a')]=function(_0x19adbb,_0x3f0b3a,_0x1d758b){if(_0x19adbb[_0xa725('0x56')]['id']){delete _0x19adbb[_0xa725('0x56')]['id'];}return db[_0xa725('0x4f')][_0xa725('0x5b')]({'where':{'id':_0x19adbb[_0xa725('0x52')]['id']}})[_0xa725('0x1f')](handleEntityNotFound(_0x3f0b3a,null))[_0xa725('0x1f')](function(_0x4cfcc3){if(_0x4cfcc3){_0x19adbb[_0xa725('0x56')][_0xa725('0x5c')]=_0x4cfcc3['id'];_0x19adbb[_0xa725('0x56')][_0xa725('0x5d')]=integrations['getSubjects'](_0x19adbb['body']['channel'],_0x19adbb[_0xa725('0x56')]['type']);_0x19adbb['body'][_0xa725('0x5e')]=integrations['getDescriptions'](_0x19adbb[_0xa725('0x56')][_0xa725('0x5f')],_0x19adbb[_0xa725('0x56')]['type']);return db['SalesforceConfiguration'][_0xa725('0x55')](_0x19adbb['body'],{'include':[{'model':db[_0xa725('0x60')],'as':_0xa725('0x5d')},{'model':db[_0xa725('0x60')],'as':_0xa725('0x5e')}]});}return null;})[_0xa725('0x1f')](respondWithResult(_0x3f0b3a,null))[_0xa725('0x2a')](handleError(_0x3f0b3a,null));};exports[_0xa725('0x61')]=function(_0x349b24,_0x233492,_0x5b2b7c){var _0x1de5ff;var _0x5dc24d='';var _0x5753dc=_0xa725('0x62');return db['SalesforceAccount'][_0xa725('0x5b')]({'where':{'id':_0x349b24[_0xa725('0x52')]['id']},'attributes':['id','remoteUri','clientId',_0xa725('0x63'),'username',_0xa725('0x64'),'securityToken']})['then'](handleEntityNotFound(_0x233492,null))['then'](function(_0x264395){if(_0x264395){_0x5dc24d=_0x264395[_0xa725('0x65')];var _0x556e8e=_0x5dc24d[_0xa725('0x66')](-0x1);if(_0x556e8e==='/'){_0x5dc24d=_0x5dc24d[_0xa725('0x67')](0x0,_0x5dc24d[_0xa725('0x68')](_0x556e8e));}_0x1de5ff=new jsforce[(_0xa725('0x69'))]({'oauth2':{'loginUrl':_0x5dc24d,'clientId':_0x264395[_0xa725('0x6a')],'clientSecret':_0x264395[_0xa725('0x63')]}});return _0x1de5ff[_0xa725('0x6b')](_0x264395[_0xa725('0x6c')],_0x264395['password'][_0xa725('0x6d')](_0x264395[_0xa725('0x6e')]));}})['then'](function(_0x266ba6){if(_0x266ba6){if(!_[_0xa725('0x6f')](_0x349b24['query'][_0xa725('0x70')])){_0x5753dc=_0x349b24[_0xa725('0x3e')]['ticketType'];}return _0x1de5ff[_0xa725('0x71')](_0x5753dc)[_0xa725('0x72')]();}})[_0xa725('0x1f')](function(_0x40388c){var _0x349f77=['CallDisposition',_0xa725('0x73'),_0xa725('0x74'),_0xa725('0x75'),_0xa725('0x76'),'Priority',_0xa725('0x77'),_0xa725('0x78')];if(!_['isNil'](_0x349b24[_0xa725('0x3e')][_0xa725('0x70')])&&_0x349b24[_0xa725('0x3e')]['ticketType']===_0xa725('0x79')){_0x349f77=['Type',_0xa725('0x7a'),_0xa725('0x7b'),'Status',_0xa725('0x7c'),_0xa725('0x7d'),'SuppliedName','SuppliedCompany'];}if(_0x40388c){_[_0xa725('0x7e')](_0x40388c[_0xa725('0x43')],function(_0x74f95f){return _0x74f95f['custom']===![]&&!_0x349f77['includes'](_0x74f95f[_0xa725('0x37')]);});return{'count':_0x40388c['fields'][_0xa725('0x44')],'rows':_['map'](_0x40388c[_0xa725('0x43')],function(_0xf71c5d){return{'id':_0xf71c5d['name'],'name':_0xf71c5d[_0xa725('0x7f')],'custom':_0xf71c5d[_0xa725('0x80')],'options':_0xf71c5d[_0xa725('0x81')][_0xa725('0x44')]>0x0?_[_0xa725('0x3d')](_0xf71c5d[_0xa725('0x81')],function(_0x13d4da){return{'name':_0x13d4da[_0xa725('0x7f')],'value':_0x13d4da[_0xa725('0x82')]};}):_0xf71c5d['type']==_0xa725('0x83')?[{'name':_0xa725('0x84'),'value':'true'},{'name':'False','value':_0xa725('0x85')}]:[]};})};}})[_0xa725('0x1f')](respondWithResult(_0x233492,null))[_0xa725('0x2a')](function(_0x30ce7b){var _0x4d106b=_0x349b24[_0xa725('0x3e')]['test']?0x1f4:_0x30ce7b[_0xa725('0x86')]||0x1f4;logger[_0xa725('0x26')]('getFields,\x20%s,\x20%s,\x20%s','getFields',_0x4d106b,JSON[_0xa725('0x25')](_0x30ce7b));delete _0x30ce7b[_0xa725('0x37')];if(_0x4d106b===0x191){_0x4d106b=0x190;}_0x233492['status'](_0x4d106b)['send'](_0x349b24[_0xa725('0x3e')][_0xa725('0x1a')]?{'message':_0xa725('0x87'),'statusCode':_0x30ce7b['statusCode']}:_0x30ce7b);});}; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.model.js b/server/api/intSalesforceAccount/intSalesforceAccount.model.js index 2b6c49b..959ae3a 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 _0x625d=['SalesforceAccount','lodash','util','api','moment','bluebird','path','rimraf','../../config/environment','exports','define'];(function(_0x1af92f,_0x5a448c){var _0x2ce73e=function(_0x198f16){while(--_0x198f16){_0x1af92f['push'](_0x1af92f['shift']());}};_0x2ce73e(++_0x5a448c);}(_0x625d,0x1cf));var _0xd625=function(_0x1eb402,_0x164f02){_0x1eb402=_0x1eb402-0x0;var _0x577f76=_0x625d[_0x1eb402];return _0x577f76;};'use strict';var _=require(_0xd625('0x0'));var util=require(_0xd625('0x1'));var logger=require('../../config/logger')(_0xd625('0x2'));var moment=require(_0xd625('0x3'));var BPromise=require(_0xd625('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xd625('0x5'));var rimraf=require(_0xd625('0x6'));var config=require(_0xd625('0x7'));var attributes=require('./intSalesforceAccount.attributes');var integrations=require('../../components/integrations/configuration');module[_0xd625('0x8')]=function(_0x21a80a,_0x44f4fc){return _0x21a80a[_0xd625('0x9')](_0xd625('0xa'),attributes,{'tableName':'int_salesforce_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x86cc=['bluebird','request-promise','path','../../config/environment','./intSalesforceAccount.attributes','../../components/integrations/configuration','exports','util','../../config/logger','api','moment'];(function(_0x2ff762,_0x342c0b){var _0x158b02=function(_0x13c38e){while(--_0x13c38e){_0x2ff762['push'](_0x2ff762['shift']());}};_0x158b02(++_0x342c0b);}(_0x86cc,0x80));var _0xc86c=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x86cc[_0x20a584];return _0x4b41a8;};'use strict';var _=require('lodash');var util=require(_0xc86c('0x0'));var logger=require(_0xc86c('0x1'))(_0xc86c('0x2'));var moment=require(_0xc86c('0x3'));var BPromise=require(_0xc86c('0x4'));var rp=require(_0xc86c('0x5'));var fs=require('fs');var path=require(_0xc86c('0x6'));var rimraf=require('rimraf');var config=require(_0xc86c('0x7'));var attributes=require(_0xc86c('0x8'));var integrations=require(_0xc86c('0x9'));module[_0xc86c('0xa')]=function(_0x4321fe,_0x5a39dd){return _0x4321fe['define']('SalesforceAccount',attributes,{'tableName':'int_salesforce_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.rpc.js b/server/api/intSalesforceAccount/intSalesforceAccount.rpc.js index edd948b..6fcad69 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 _0x4522=['limit','include','map','model','attributes','info','ShowSalesforceAccount','find','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','request\x20sent','stringify','error','code','SalesforceAccount,\x20%s,\x20%s','message','result','catch','GetSalesforceAccount','SalesforceAccount','options','raw','where'];(function(_0x917152,_0x429f04){var _0x494acf=function(_0x1095ba){while(--_0x1095ba){_0x917152['push'](_0x917152['shift']());}};_0x494acf(++_0x429f04);}(_0x4522,0x1a0));var _0x2452=function(_0x58827a,_0x26e582){_0x58827a=_0x58827a-0x0;var _0x1a54fc=_0x4522[_0x58827a];return _0x1a54fc;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x2452('0x0'));var BPromise=require(_0x2452('0x1'));var rs=require(_0x2452('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x2452('0x3'))['db'];var utils=require(_0x2452('0x4'));var logger=require(_0x2452('0x5'))(_0x2452('0x6'));var config=require(_0x2452('0x7'));var jayson=require(_0x2452('0x8'));var client=jayson[_0x2452('0x9')][_0x2452('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2f0139,_0x149807,_0x3bc193){return new BPromise(function(_0x33b935,_0x24073f){return client[_0x2452('0xb')](_0x2f0139,_0x3bc193)[_0x2452('0xc')](function(_0x2995b5){logger['info']('SalesforceAccount,\x20%s,\x20%s',_0x149807,_0x2452('0xd'));logger['debug']('SalesforceAccount,\x20%s,\x20%s,\x20%s',_0x149807,_0x2452('0xd'),JSON[_0x2452('0xe')](_0x2995b5));if(_0x2995b5[_0x2452('0xf')]){if(_0x2995b5[_0x2452('0xf')][_0x2452('0x10')]===0x1f4){logger[_0x2452('0xf')](_0x2452('0x11'),_0x149807,_0x2995b5[_0x2452('0xf')]['message']);return _0x24073f(_0x2995b5['error']['message']);}logger[_0x2452('0xf')]('SalesforceAccount,\x20%s,\x20%s',_0x149807,_0x2995b5[_0x2452('0xf')]['message']);return _0x33b935(_0x2995b5[_0x2452('0xf')][_0x2452('0x12')]);}else{logger['info'](_0x2452('0x11'),_0x149807,'request\x20sent');_0x33b935(_0x2995b5[_0x2452('0x13')][_0x2452('0x12')]);}})[_0x2452('0x14')](function(_0xdede20){logger['error'](_0x2452('0x11'),_0x149807,_0xdede20);_0x24073f(_0xdede20);});});}exports[_0x2452('0x15')]=function(_0x59d89a){var _0x4802ad=this;return new Promise(function(_0x1bfb44,_0x37c6a6){return db[_0x2452('0x16')]['findAll']({'raw':_0x59d89a[_0x2452('0x17')]?_0x59d89a[_0x2452('0x17')][_0x2452('0x18')]===undefined?!![]:![]:!![],'where':_0x59d89a[_0x2452('0x17')]?_0x59d89a[_0x2452('0x17')][_0x2452('0x19')]||null:null,'attributes':_0x59d89a[_0x2452('0x17')]?_0x59d89a[_0x2452('0x17')]['attributes']||null:null,'limit':_0x59d89a['options']?_0x59d89a[_0x2452('0x17')][_0x2452('0x1a')]||null:null,'include':_0x59d89a['options']?_0x59d89a[_0x2452('0x17')][_0x2452('0x1b')]?_[_0x2452('0x1c')](_0x59d89a[_0x2452('0x17')][_0x2452('0x1b')],function(_0x397f21){return{'model':db[_0x397f21[_0x2452('0x1d')]],'as':_0x397f21['as'],'attributes':_0x397f21['attributes'],'include':_0x397f21[_0x2452('0x1b')]?_[_0x2452('0x1c')](_0x397f21[_0x2452('0x1b')],function(_0x231410){return{'model':db[_0x231410[_0x2452('0x1d')]],'as':_0x231410['as'],'attributes':_0x231410['attributes'],'include':_0x231410['include']?_[_0x2452('0x1c')](_0x231410[_0x2452('0x1b')],function(_0x46fcbb){return{'model':db[_0x46fcbb[_0x2452('0x1d')]],'as':_0x46fcbb['as'],'attributes':_0x46fcbb[_0x2452('0x1e')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x3fba00){logger[_0x2452('0x1f')]('GetSalesforceAccount',_0x59d89a);logger['debug'](_0x2452('0x15'),_0x59d89a,JSON[_0x2452('0xe')](_0x3fba00));_0x1bfb44(_0x3fba00);})[_0x2452('0x14')](function(_0x28e6ea){logger[_0x2452('0xf')](_0x2452('0x15'),_0x28e6ea['message'],_0x59d89a);_0x37c6a6(_0x4802ad['error'](0x1f4,_0x28e6ea[_0x2452('0x12')]));});});};exports[_0x2452('0x20')]=function(_0x130565){var _0x5c36aa=this;return new Promise(function(_0x2fb2ae,_0x586a20){return db['SalesforceAccount'][_0x2452('0x21')]({'raw':_0x130565[_0x2452('0x17')]?_0x130565[_0x2452('0x17')][_0x2452('0x18')]===undefined?!![]:![]:!![],'where':_0x130565[_0x2452('0x17')]?_0x130565[_0x2452('0x17')][_0x2452('0x19')]||null:null,'attributes':_0x130565[_0x2452('0x17')]?_0x130565[_0x2452('0x17')][_0x2452('0x1e')]||null:null,'include':_0x130565[_0x2452('0x17')]?_0x130565[_0x2452('0x17')][_0x2452('0x1b')]?_['map'](_0x130565[_0x2452('0x17')][_0x2452('0x1b')],function(_0x4cd7e2){return{'model':db[_0x4cd7e2[_0x2452('0x1d')]],'as':_0x4cd7e2['as'],'attributes':_0x4cd7e2['attributes'],'include':_0x4cd7e2[_0x2452('0x1b')]?_[_0x2452('0x1c')](_0x4cd7e2['include'],function(_0x645722){return{'model':db[_0x645722[_0x2452('0x1d')]],'as':_0x645722['as'],'attributes':_0x645722[_0x2452('0x1e')],'include':_0x645722['include']?_[_0x2452('0x1c')](_0x645722[_0x2452('0x1b')],function(_0x4ba2ae){return{'model':db[_0x4ba2ae[_0x2452('0x1d')]],'as':_0x4ba2ae['as'],'attributes':_0x4ba2ae[_0x2452('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x2452('0xc')](function(_0x26264f){logger[_0x2452('0x1f')]('ShowSalesforceAccount',_0x130565);logger['debug']('ShowSalesforceAccount',_0x130565,JSON[_0x2452('0xe')](_0x26264f));_0x2fb2ae(_0x26264f);})[_0x2452('0x14')](function(_0x64965c){logger[_0x2452('0xf')](_0x2452('0x20'),_0x64965c['message'],_0x130565);_0x586a20(_0x5c36aa[_0x2452('0xf')](0x1f4,_0x64965c['message']));});});}; \ No newline at end of file +var _0x579c=['error','code','message','catch','GetSalesforceAccount','SalesforceAccount','options','where','attributes','include','map','model','ShowSalesforceAccount','find','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','SalesforceAccount,\x20%s,\x20%s','debug','SalesforceAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify'];(function(_0x3a0b31,_0x189c2b){var _0x11ca69=function(_0x64044c){while(--_0x64044c){_0x3a0b31['push'](_0x3a0b31['shift']());}};_0x11ca69(++_0x189c2b);}(_0x579c,0xda));var _0xc579=function(_0x3dcc23,_0xd0e196){_0x3dcc23=_0x3dcc23-0x0;var _0x10f2a9=_0x579c[_0x3dcc23];return _0x10f2a9;};'use strict';var _=require(_0xc579('0x0'));var util=require(_0xc579('0x1'));var moment=require(_0xc579('0x2'));var BPromise=require(_0xc579('0x3'));var rs=require(_0xc579('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xc579('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xc579('0x6'))(_0xc579('0x7'));var config=require(_0xc579('0x8'));var jayson=require(_0xc579('0x9'));var client=jayson[_0xc579('0xa')][_0xc579('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2e451b,_0x585167,_0x1c6d9c){return new BPromise(function(_0x293c4a,_0x2ce949){return client[_0xc579('0xc')](_0x2e451b,_0x1c6d9c)[_0xc579('0xd')](function(_0x44b151){logger[_0xc579('0xe')](_0xc579('0xf'),_0x585167,'request\x20sent');logger[_0xc579('0x10')](_0xc579('0x11'),_0x585167,_0xc579('0x12'),JSON[_0xc579('0x13')](_0x44b151));if(_0x44b151[_0xc579('0x14')]){if(_0x44b151[_0xc579('0x14')][_0xc579('0x15')]===0x1f4){logger[_0xc579('0x14')](_0xc579('0xf'),_0x585167,_0x44b151[_0xc579('0x14')][_0xc579('0x16')]);return _0x2ce949(_0x44b151['error'][_0xc579('0x16')]);}logger['error'](_0xc579('0xf'),_0x585167,_0x44b151['error'][_0xc579('0x16')]);return _0x293c4a(_0x44b151['error'][_0xc579('0x16')]);}else{logger['info'](_0xc579('0xf'),_0x585167,_0xc579('0x12'));_0x293c4a(_0x44b151['result']['message']);}})[_0xc579('0x17')](function(_0x2abc55){logger[_0xc579('0x14')](_0xc579('0xf'),_0x585167,_0x2abc55);_0x2ce949(_0x2abc55);});});}exports[_0xc579('0x18')]=function(_0x33d341){var _0xbbbe3e=this;return new Promise(function(_0x3da8a1,_0xa41248){return db[_0xc579('0x19')]['findAll']({'raw':_0x33d341[_0xc579('0x1a')]?_0x33d341[_0xc579('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x33d341[_0xc579('0x1a')]?_0x33d341[_0xc579('0x1a')][_0xc579('0x1b')]||null:null,'attributes':_0x33d341[_0xc579('0x1a')]?_0x33d341[_0xc579('0x1a')][_0xc579('0x1c')]||null:null,'limit':_0x33d341[_0xc579('0x1a')]?_0x33d341[_0xc579('0x1a')]['limit']||null:null,'include':_0x33d341[_0xc579('0x1a')]?_0x33d341[_0xc579('0x1a')][_0xc579('0x1d')]?_[_0xc579('0x1e')](_0x33d341[_0xc579('0x1a')]['include'],function(_0x3634f2){return{'model':db[_0x3634f2[_0xc579('0x1f')]],'as':_0x3634f2['as'],'attributes':_0x3634f2[_0xc579('0x1c')],'include':_0x3634f2['include']?_[_0xc579('0x1e')](_0x3634f2['include'],function(_0x4610c2){return{'model':db[_0x4610c2[_0xc579('0x1f')]],'as':_0x4610c2['as'],'attributes':_0x4610c2[_0xc579('0x1c')],'include':_0x4610c2['include']?_[_0xc579('0x1e')](_0x4610c2['include'],function(_0x532b33){return{'model':db[_0x532b33['model']],'as':_0x532b33['as'],'attributes':_0x532b33[_0xc579('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xc579('0xd')](function(_0xfdbb73){logger[_0xc579('0xe')](_0xc579('0x18'),_0x33d341);logger[_0xc579('0x10')](_0xc579('0x18'),_0x33d341,JSON['stringify'](_0xfdbb73));_0x3da8a1(_0xfdbb73);})['catch'](function(_0x4a5f6){logger['error'](_0xc579('0x18'),_0x4a5f6[_0xc579('0x16')],_0x33d341);_0xa41248(_0xbbbe3e[_0xc579('0x14')](0x1f4,_0x4a5f6[_0xc579('0x16')]));});});};exports[_0xc579('0x20')]=function(_0x156bf5){var _0x45e6a3=this;return new Promise(function(_0x133d08,_0x49b48f){return db[_0xc579('0x19')][_0xc579('0x21')]({'raw':_0x156bf5[_0xc579('0x1a')]?_0x156bf5[_0xc579('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x156bf5['options']?_0x156bf5[_0xc579('0x1a')]['where']||null:null,'attributes':_0x156bf5[_0xc579('0x1a')]?_0x156bf5[_0xc579('0x1a')][_0xc579('0x1c')]||null:null,'include':_0x156bf5[_0xc579('0x1a')]?_0x156bf5[_0xc579('0x1a')]['include']?_[_0xc579('0x1e')](_0x156bf5['options'][_0xc579('0x1d')],function(_0x473000){return{'model':db[_0x473000['model']],'as':_0x473000['as'],'attributes':_0x473000[_0xc579('0x1c')],'include':_0x473000[_0xc579('0x1d')]?_['map'](_0x473000['include'],function(_0x37bce9){return{'model':db[_0x37bce9[_0xc579('0x1f')]],'as':_0x37bce9['as'],'attributes':_0x37bce9['attributes'],'include':_0x37bce9[_0xc579('0x1d')]?_[_0xc579('0x1e')](_0x37bce9['include'],function(_0x32589a){return{'model':db[_0x32589a['model']],'as':_0x32589a['as'],'attributes':_0x32589a[_0xc579('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xc579('0xd')](function(_0x5c6f38){logger[_0xc579('0xe')](_0xc579('0x20'),_0x156bf5);logger[_0xc579('0x10')](_0xc579('0x20'),_0x156bf5,JSON[_0xc579('0x13')](_0x5c6f38));_0x133d08(_0x5c6f38);})[_0xc579('0x17')](function(_0x59ae89){logger[_0xc579('0x14')](_0xc579('0x20'),_0x59ae89['message'],_0x156bf5);_0x49b48f(_0x45e6a3[_0xc579('0x14')](0x1f4,_0x59ae89[_0xc579('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/index.js b/server/api/intSalesforceConfiguration/index.js index 59ff8fd..f86e6db 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 _0xf500=['/:id/descriptions','post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','Router','../../config/environment','./intSalesforceConfiguration.controller','get','isAuthenticated','index','/:id','show','/:id/fields','getFields','/:id/subjects'];(function(_0x2bef42,_0x788346){var _0x2f1172=function(_0x5d8e17){while(--_0x5d8e17){_0x2bef42['push'](_0x2bef42['shift']());}};_0x2f1172(++_0x788346);}(_0xf500,0x11c));var _0x0f50=function(_0x1477ef,_0x54a5d6){_0x1477ef=_0x1477ef-0x0;var _0x164acd=_0xf500[_0x1477ef];return _0x164acd;};'use strict';var multer=require(_0x0f50('0x0'));var util=require(_0x0f50('0x1'));var path=require(_0x0f50('0x2'));var timeout=require(_0x0f50('0x3'));var express=require('express');var router=express[_0x0f50('0x4')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x0f50('0x5'));var controller=require(_0x0f50('0x6'));router[_0x0f50('0x7')]('/',auth[_0x0f50('0x8')](),controller[_0x0f50('0x9')]);router['get'](_0x0f50('0xa'),auth[_0x0f50('0x8')](),controller[_0x0f50('0xb')]);router['get'](_0x0f50('0xc'),auth[_0x0f50('0x8')](),controller[_0x0f50('0xd')]);router[_0x0f50('0x7')](_0x0f50('0xe'),auth['isAuthenticated'](),controller['getSubjects']);router[_0x0f50('0x7')](_0x0f50('0xf'),auth[_0x0f50('0x8')](),controller['getDescriptions']);router[_0x0f50('0x10')]('/',auth[_0x0f50('0x8')](),controller[_0x0f50('0x11')]);router[_0x0f50('0x12')]('/:id',auth['isAuthenticated'](),controller[_0x0f50('0x13')]);router[_0x0f50('0x14')](_0x0f50('0xa'),auth[_0x0f50('0x8')](),controller[_0x0f50('0x15')]);module[_0x0f50('0x16')]=router; \ No newline at end of file +var _0x104d=['isAuthenticated','index','/:id/fields','getSubjects','/:id/descriptions','put','delete','/:id','destroy','exports','multer','util','path','Router','../../components/auth/service','../../config/environment','get'];(function(_0x9ad8b,_0xd6b992){var _0x2e8a20=function(_0x2c22b4){while(--_0x2c22b4){_0x9ad8b['push'](_0x9ad8b['shift']());}};_0x2e8a20(++_0xd6b992);}(_0x104d,0x11a));var _0xd104=function(_0x3c7ead,_0x22c422){_0x3c7ead=_0x3c7ead-0x0;var _0x44a340=_0x104d[_0x3c7ead];return _0x44a340;};'use strict';var multer=require(_0xd104('0x0'));var util=require(_0xd104('0x1'));var path=require(_0xd104('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xd104('0x3')]();var auth=require(_0xd104('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xd104('0x5'));var controller=require('./intSalesforceConfiguration.controller');router[_0xd104('0x6')]('/',auth[_0xd104('0x7')](),controller[_0xd104('0x8')]);router[_0xd104('0x6')]('/:id',auth[_0xd104('0x7')](),controller['show']);router[_0xd104('0x6')](_0xd104('0x9'),auth[_0xd104('0x7')](),controller['getFields']);router[_0xd104('0x6')]('/:id/subjects',auth[_0xd104('0x7')](),controller[_0xd104('0xa')]);router[_0xd104('0x6')](_0xd104('0xb'),auth[_0xd104('0x7')](),controller['getDescriptions']);router['post']('/',auth[_0xd104('0x7')](),controller['create']);router[_0xd104('0xc')]('/:id',auth['isAuthenticated'](),controller['update']);router[_0xd104('0xd')](_0xd104('0xe'),auth[_0xd104('0x7')](),controller[_0xd104('0xf')]);module[_0xd104('0x10')]=router; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.attributes.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.attributes.js index e63be73..1a8daf9 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 _0x7d63=['STRING','ENUM','Case','Task','contact','nothing','lead','sequelize'];(function(_0x5c3f6b,_0x2b17e4){var _0x26ece7=function(_0x2c86c6){while(--_0x2c86c6){_0x5c3f6b['push'](_0x5c3f6b['shift']());}};_0x26ece7(++_0x2b17e4);}(_0x7d63,0x97));var _0x37d6=function(_0x21549c,_0x6d64d1){_0x21549c=_0x21549c-0x0;var _0x426cbd=_0x7d63[_0x21549c];return _0x426cbd;};'use strict';var Sequelize=require(_0x37d6('0x0'));module['exports']={'name':{'type':Sequelize[_0x37d6('0x1')]},'description':{'type':Sequelize[_0x37d6('0x1')]},'ticketType':{'type':Sequelize[_0x37d6('0x2')]('Task',_0x37d6('0x3')),'defaultValue':_0x37d6('0x4')},'moduleSearch':{'type':Sequelize[_0x37d6('0x2')]('contact_lead',_0x37d6('0x5'),'lead'),'defaultValue':'contact_lead'},'moduleCreate':{'type':Sequelize[_0x37d6('0x2')](_0x37d6('0x6'),_0x37d6('0x5'),_0x37d6('0x7')),'defaultValue':_0x37d6('0x7')}}; \ No newline at end of file +var _0xe189=['Task','contact','lead','nothing','sequelize','ENUM','Case'];(function(_0x3eac67,_0x59ff3b){var _0x5af74b=function(_0x40d189){while(--_0x40d189){_0x3eac67['push'](_0x3eac67['shift']());}};_0x5af74b(++_0x59ff3b);}(_0xe189,0xcf));var _0x9e18=function(_0x27e621,_0x1168ea){_0x27e621=_0x27e621-0x0;var _0x28e0e0=_0xe189[_0x27e621];return _0x28e0e0;};'use strict';var Sequelize=require(_0x9e18('0x0'));module['exports']={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']},'ticketType':{'type':Sequelize[_0x9e18('0x1')]('Task',_0x9e18('0x2')),'defaultValue':_0x9e18('0x3')},'moduleSearch':{'type':Sequelize[_0x9e18('0x1')]('contact_lead',_0x9e18('0x4'),_0x9e18('0x5')),'defaultValue':'contact_lead'},'moduleCreate':{'type':Sequelize[_0x9e18('0x1')](_0x9e18('0x6'),_0x9e18('0x4'),'lead'),'defaultValue':'lead'}}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.controller.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.controller.js index ebc701a..4611e45 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 _0x4bf4=['debug','stringify','error','code','message','info','result','catch','sendStatus','status','end','count','offset','limit','set','json','apply','reject','save','update','stack','name','send','map','SalesforceConfiguration','rawAttributes','fieldName','type','key','model','query','intersection','attributes','fields','length','nolimit','order','sort','where','filters','pick','merge','filter','options','includeAll','include','rows','keys','create','body','find','params','destroy','findOne','SalesforceField','getFields','getSubjects','hasOwnProperty','getDescriptions','html-pdf','rimraf','request-promise','moment','mustache','util','path','sox','ejs','lodash','squel','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','jayson/promise','client','http','test','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','SalesforceConfiguration,\x20%s,\x20%s'];(function(_0x496a35,_0x49ce17){var _0x9157f0=function(_0x3bd7b1){while(--_0x3bd7b1){_0x496a35['push'](_0x496a35['shift']());}};_0x9157f0(++_0x49ce17);}(_0x4bf4,0xef));var _0x44bf=function(_0x220292,_0x39e38b){_0x220292=_0x220292-0x0;var _0x5534b1=_0x4bf4[_0x220292];return _0x5534b1;};'use strict';var pdf=require(_0x44bf('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x44bf('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x44bf('0x2'));var moment=require(_0x44bf('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x44bf('0x4'));var util=require(_0x44bf('0x5'));var path=require(_0x44bf('0x6'));var sox=require(_0x44bf('0x7'));var csv=require('to-csv');var ejs=require(_0x44bf('0x8'));var fs=require('fs');var _=require(_0x44bf('0x9'));var squel=require(_0x44bf('0xa'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x44bf('0xb'));var querystring=require(_0x44bf('0xc'));var Papa=require('papaparse');var Redis=require(_0x44bf('0xd'));var authService=require(_0x44bf('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0x44bf('0xf'));var hardwareService=require(_0x44bf('0x10'));var logger=require('../../config/logger')(_0x44bf('0x11'));var utils=require(_0x44bf('0x12'));var config=require(_0x44bf('0x13'));var db=require(_0x44bf('0x14'))['db'];var jayson=require(_0x44bf('0x15'));var client=jayson[_0x44bf('0x16')][_0x44bf('0x17')]({'port':0x232a});function checkPasswordPattern(_0x4fd699,_0x483903,_0x3b7d05){if(_0x3b7d05){var _0x3ee676=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x3ee676[_0x44bf('0x18')](_0x483903)){return _0x4fd699;}else{throw new db[(_0x44bf('0x19'))][(_0x44bf('0x1a'))](_0x44bf('0x1b'));}}else{return _0x4fd699;}}function respondWithRpcPromise(_0x19b8da,_0x431d95,_0x2776f8,_0x10d48c){return new BPromise(function(_0x4716fd,_0x424c94){var _0x2a32a7=_0x10d48c||client;return _0x2a32a7[_0x44bf('0x1c')](_0x19b8da,_0x2776f8)[_0x44bf('0x1d')](function(_0x586dbe){logger['info'](_0x44bf('0x1e'),_0x431d95,'request\x20sent');logger[_0x44bf('0x1f')]('SalesforceConfiguration,\x20%s,\x20%s,\x20%s',_0x431d95,'request\x20sent',JSON[_0x44bf('0x20')](_0x586dbe));if(_0x586dbe[_0x44bf('0x21')]){if(_0x586dbe[_0x44bf('0x21')][_0x44bf('0x22')]===0x1f4){logger[_0x44bf('0x21')](_0x44bf('0x1e'),_0x431d95,_0x586dbe[_0x44bf('0x21')][_0x44bf('0x23')]);return _0x424c94(_0x586dbe['error'][_0x44bf('0x23')]);}logger[_0x44bf('0x21')]('SalesforceConfiguration,\x20%s,\x20%s',_0x431d95,_0x586dbe[_0x44bf('0x21')][_0x44bf('0x23')]);return _0x4716fd(_0x586dbe[_0x44bf('0x21')]['message']);}else{logger[_0x44bf('0x24')](_0x44bf('0x1e'),_0x431d95,'request\x20sent');_0x4716fd(_0x586dbe[_0x44bf('0x25')]['message']);}})[_0x44bf('0x26')](function(_0x5d3e07){logger[_0x44bf('0x21')]('SalesforceConfiguration,\x20%s,\x20%s',_0x431d95,_0x5d3e07);_0x424c94(_0x5d3e07);});});}function respondWithStatusCode(_0x493f26,_0x2df029){_0x2df029=_0x2df029||0xcc;return function(_0x2fb9dd){if(_0x2fb9dd){return _0x493f26[_0x44bf('0x27')](_0x2df029);}return _0x493f26[_0x44bf('0x28')](_0x2df029)[_0x44bf('0x29')]();};}function respondWithResult(_0x16bb99,_0x13700f){_0x13700f=_0x13700f||0xc8;return function(_0x146902){if(_0x146902){return _0x16bb99[_0x44bf('0x28')](_0x13700f)['json'](_0x146902);}};}function respondWithFilteredResult(_0x1a89f9,_0x856a30){return function(_0x1f259b){if(_0x1f259b){var _0x662376=_0x1f259b[_0x44bf('0x2a')],_0x40abdf=_0x856a30['offset'],_0x2d2b87=_0x856a30[_0x44bf('0x2b')]+_0x856a30[_0x44bf('0x2c')],_0x5a6205;if(_0x2d2b87>=_0x662376){_0x2d2b87=_0x662376;_0x5a6205=0xc8;}else{_0x5a6205=0xce;}_0x1a89f9[_0x44bf('0x28')](_0x5a6205);return _0x1a89f9[_0x44bf('0x2d')]('Content-Range',_0x40abdf+'-'+_0x2d2b87+'/'+_0x662376)[_0x44bf('0x2e')](_0x1f259b);}return null;};}function patchUpdates(_0x43645e){return function(_0x40708a){try{jsonpatch[_0x44bf('0x2f')](_0x40708a,_0x43645e,!![]);}catch(_0x52ec6e){return BPromise[_0x44bf('0x30')](_0x52ec6e);}return _0x40708a[_0x44bf('0x31')]();};}function saveUpdates(_0x2ab705,_0x2ef248){return function(_0x70f337){if(_0x70f337){return _0x70f337[_0x44bf('0x32')](_0x2ab705)[_0x44bf('0x1d')](function(_0x18daa8){return _0x18daa8;});}return null;};}function removeEntity(_0x2166c9,_0xee5a78){return function(_0x39522f){if(_0x39522f){return _0x39522f['destroy']()[_0x44bf('0x1d')](function(){_0x2166c9[_0x44bf('0x28')](0xcc)[_0x44bf('0x29')]();});}};}function handleEntityNotFound(_0x58af11,_0x302a4){return function(_0x272d05){if(!_0x272d05){_0x58af11['sendStatus'](0x194);}return _0x272d05;};}function handleError(_0x5414be,_0x1f49e9){_0x1f49e9=_0x1f49e9||0x1f4;return function(_0x5997a3){logger['error'](_0x5997a3[_0x44bf('0x33')]);if(_0x5997a3['name']){delete _0x5997a3[_0x44bf('0x34')];}_0x5414be[_0x44bf('0x28')](_0x1f49e9)[_0x44bf('0x35')](_0x5997a3);};}exports['index']=function(_0x187a2d,_0x36729){var _0x544ad3={},_0x2092f9={},_0x28ae97={'count':0x0,'rows':[]};var _0x1765b6=_[_0x44bf('0x36')](db[_0x44bf('0x37')][_0x44bf('0x38')],function(_0x47c805){return{'name':_0x47c805[_0x44bf('0x39')],'type':_0x47c805[_0x44bf('0x3a')][_0x44bf('0x3b')]};});_0x2092f9[_0x44bf('0x3c')]=_[_0x44bf('0x36')](_0x1765b6,_0x44bf('0x34'));_0x2092f9[_0x44bf('0x3d')]=_['keys'](_0x187a2d[_0x44bf('0x3d')]);_0x2092f9['filters']=_[_0x44bf('0x3e')](_0x2092f9[_0x44bf('0x3c')],_0x2092f9[_0x44bf('0x3d')]);_0x544ad3[_0x44bf('0x3f')]=_['intersection'](_0x2092f9[_0x44bf('0x3c')],qs[_0x44bf('0x40')](_0x187a2d[_0x44bf('0x3d')][_0x44bf('0x40')]));_0x544ad3[_0x44bf('0x3f')]=_0x544ad3[_0x44bf('0x3f')][_0x44bf('0x41')]?_0x544ad3[_0x44bf('0x3f')]:_0x2092f9['model'];if(!_0x187a2d[_0x44bf('0x3d')]['hasOwnProperty'](_0x44bf('0x42'))){_0x544ad3[_0x44bf('0x2c')]=qs[_0x44bf('0x2c')](_0x187a2d[_0x44bf('0x3d')][_0x44bf('0x2c')]);_0x544ad3[_0x44bf('0x2b')]=qs[_0x44bf('0x2b')](_0x187a2d['query'][_0x44bf('0x2b')]);}_0x544ad3[_0x44bf('0x43')]=qs[_0x44bf('0x44')](_0x187a2d['query'][_0x44bf('0x44')]);_0x544ad3[_0x44bf('0x45')]=qs[_0x44bf('0x46')](_[_0x44bf('0x47')](_0x187a2d[_0x44bf('0x3d')],_0x2092f9[_0x44bf('0x46')]),_0x1765b6);if(_0x187a2d[_0x44bf('0x3d')]['filter']){_0x544ad3['where']=_[_0x44bf('0x48')](_0x544ad3['where'],{'$or':_[_0x44bf('0x36')](_0x1765b6,function(_0x16e3f2){if(_0x16e3f2['type']!=='VIRTUAL'){var _0x36be0b={};_0x36be0b[_0x16e3f2[_0x44bf('0x34')]]={'$like':'%'+_0x187a2d[_0x44bf('0x3d')][_0x44bf('0x49')]+'%'};return _0x36be0b;}})});}_0x544ad3=_[_0x44bf('0x48')]({},_0x544ad3,_0x187a2d[_0x44bf('0x4a')]);var _0x5d5be9={'where':_0x544ad3[_0x44bf('0x45')]};return db[_0x44bf('0x37')][_0x44bf('0x2a')](_0x5d5be9)[_0x44bf('0x1d')](function(_0x10b6ff){_0x28ae97[_0x44bf('0x2a')]=_0x10b6ff;if(_0x187a2d['query'][_0x44bf('0x4b')]){_0x544ad3[_0x44bf('0x4c')]=[{'all':!![]}];}return db['SalesforceConfiguration']['findAll'](_0x544ad3);})[_0x44bf('0x1d')](function(_0x241ba6){_0x28ae97[_0x44bf('0x4d')]=_0x241ba6;return _0x28ae97;})[_0x44bf('0x1d')](respondWithFilteredResult(_0x36729,_0x544ad3))[_0x44bf('0x26')](handleError(_0x36729,null));};exports['show']=function(_0x3924c2,_0x2306fd){var _0x3f1109={'raw':![],'where':{'id':_0x3924c2['params']['id']}},_0x5a044d={};_0x5a044d[_0x44bf('0x3c')]=_[_0x44bf('0x4e')](db[_0x44bf('0x37')][_0x44bf('0x38')]);_0x5a044d['query']=_['keys'](_0x3924c2[_0x44bf('0x3d')]);_0x5a044d['filters']=_['intersection'](_0x5a044d[_0x44bf('0x3c')],_0x5a044d[_0x44bf('0x3d')]);_0x3f1109[_0x44bf('0x3f')]=_[_0x44bf('0x3e')](_0x5a044d[_0x44bf('0x3c')],qs[_0x44bf('0x40')](_0x3924c2[_0x44bf('0x3d')]['fields']));_0x3f1109[_0x44bf('0x3f')]=_0x3f1109[_0x44bf('0x3f')][_0x44bf('0x41')]?_0x3f1109[_0x44bf('0x3f')]:_0x5a044d[_0x44bf('0x3c')];if(_0x3924c2[_0x44bf('0x3d')][_0x44bf('0x4b')]){_0x3f1109[_0x44bf('0x4c')]=[{'all':!![]}];}_0x3f1109=_[_0x44bf('0x48')]({},_0x3f1109,_0x3924c2[_0x44bf('0x4a')]);return db['SalesforceConfiguration']['find'](_0x3f1109)[_0x44bf('0x1d')](handleEntityNotFound(_0x2306fd,null))[_0x44bf('0x1d')](respondWithResult(_0x2306fd,null))['catch'](handleError(_0x2306fd,null));};exports[_0x44bf('0x4f')]=function(_0x4515f0,_0x191d73){return db['SalesforceConfiguration']['create'](_0x4515f0[_0x44bf('0x50')],{})[_0x44bf('0x1d')](respondWithResult(_0x191d73,0xc9))[_0x44bf('0x26')](handleError(_0x191d73,null));};exports[_0x44bf('0x32')]=function(_0x3fb16b,_0x18f4d1){if(_0x3fb16b['body']['id']){delete _0x3fb16b[_0x44bf('0x50')]['id'];}return db[_0x44bf('0x37')][_0x44bf('0x51')]({'where':{'id':_0x3fb16b[_0x44bf('0x52')]['id']}})[_0x44bf('0x1d')](handleEntityNotFound(_0x18f4d1,null))[_0x44bf('0x1d')](saveUpdates(_0x3fb16b[_0x44bf('0x50')],null))['then'](respondWithResult(_0x18f4d1,null))[_0x44bf('0x26')](handleError(_0x18f4d1,null));};exports[_0x44bf('0x53')]=function(_0x2292eb,_0x383562){return db[_0x44bf('0x37')][_0x44bf('0x51')]({'where':{'id':_0x2292eb[_0x44bf('0x52')]['id']}})[_0x44bf('0x1d')](handleEntityNotFound(_0x383562,null))[_0x44bf('0x1d')](removeEntity(_0x383562,null))['catch'](handleError(_0x383562,null));};exports['getFields']=function(_0x43c862,_0x23ba25,_0x375328){var _0xedbbe2={};var _0x2110c5={};var _0x491dea;var _0x4911cf;return db[_0x44bf('0x37')][_0x44bf('0x54')]({'where':{'id':_0x43c862[_0x44bf('0x52')]['id']}})['then'](handleEntityNotFound(_0x23ba25,null))[_0x44bf('0x1d')](function(_0x3c2bdf){if(_0x3c2bdf){_0x491dea=_0x3c2bdf;_0x2110c5[_0x44bf('0x3c')]=_['keys'](db[_0x44bf('0x55')][_0x44bf('0x38')]);_0x2110c5[_0x44bf('0x3d')]=_[_0x44bf('0x4e')](_0x43c862[_0x44bf('0x3d')]);_0x2110c5[_0x44bf('0x46')]=_[_0x44bf('0x3e')](_0x2110c5[_0x44bf('0x3c')],_0x2110c5[_0x44bf('0x3d')]);_0xedbbe2['attributes']=_[_0x44bf('0x3e')](_0x2110c5[_0x44bf('0x3c')],qs[_0x44bf('0x40')](_0x43c862['query'][_0x44bf('0x40')]));_0xedbbe2['attributes']=_0xedbbe2[_0x44bf('0x3f')][_0x44bf('0x41')]?_0xedbbe2[_0x44bf('0x3f')]:_0x2110c5['model'];_0xedbbe2[_0x44bf('0x43')]=qs[_0x44bf('0x44')](_0x43c862[_0x44bf('0x3d')][_0x44bf('0x44')]);_0xedbbe2['where']=qs['filters'](_['pick'](_0x43c862[_0x44bf('0x3d')],_0x2110c5[_0x44bf('0x46')]));if(_0x43c862[_0x44bf('0x3d')][_0x44bf('0x49')]){_0xedbbe2[_0x44bf('0x45')]=_[_0x44bf('0x48')](_0xedbbe2[_0x44bf('0x45')],{'$or':_[_0x44bf('0x36')](_0xedbbe2[_0x44bf('0x3f')],function(_0x46aa40){var _0x4d0e20={};_0x4d0e20[_0x46aa40]={'$like':'%'+_0x43c862[_0x44bf('0x3d')][_0x44bf('0x49')]+'%'};return _0x4d0e20;})});}_0xedbbe2=_[_0x44bf('0x48')]({},_0xedbbe2,_0x43c862[_0x44bf('0x4a')]);return _0x491dea[_0x44bf('0x56')](_0xedbbe2);}})['then'](function(_0x26ccfa){if(_0x26ccfa){_0x4911cf=_0x26ccfa[_0x44bf('0x41')];if(!_0x43c862[_0x44bf('0x3d')]['hasOwnProperty']('nolimit')){_0xedbbe2['limit']=qs['limit'](_0x43c862[_0x44bf('0x3d')][_0x44bf('0x2c')]);_0xedbbe2[_0x44bf('0x2b')]=qs[_0x44bf('0x2b')](_0x43c862['query'][_0x44bf('0x2b')]);}return _0x491dea[_0x44bf('0x56')](_0xedbbe2);}})['then'](function(_0x1e7c0d){if(_0x1e7c0d){return _0x1e7c0d?{'count':_0x4911cf,'rows':_0x1e7c0d}:null;}})[_0x44bf('0x1d')](respondWithResult(_0x23ba25,null))['catch'](handleError(_0x23ba25,null));};exports[_0x44bf('0x57')]=function(_0x1017c0,_0x17e6ae,_0x1c75c1){var _0x20592d={};var _0x1a8dba={};var _0x5a3eb6;var _0x1820a7;return db['SalesforceConfiguration'][_0x44bf('0x54')]({'where':{'id':_0x1017c0[_0x44bf('0x52')]['id']}})[_0x44bf('0x1d')](handleEntityNotFound(_0x17e6ae,null))[_0x44bf('0x1d')](function(_0x264024){if(_0x264024){_0x5a3eb6=_0x264024;_0x1a8dba['model']=_[_0x44bf('0x4e')](db[_0x44bf('0x55')][_0x44bf('0x38')]);_0x1a8dba['query']=_['keys'](_0x1017c0[_0x44bf('0x3d')]);_0x1a8dba[_0x44bf('0x46')]=_['intersection'](_0x1a8dba['model'],_0x1a8dba[_0x44bf('0x3d')]);_0x20592d['attributes']=_[_0x44bf('0x3e')](_0x1a8dba[_0x44bf('0x3c')],qs[_0x44bf('0x40')](_0x1017c0[_0x44bf('0x3d')]['fields']));_0x20592d['attributes']=_0x20592d[_0x44bf('0x3f')]['length']?_0x20592d[_0x44bf('0x3f')]:_0x1a8dba[_0x44bf('0x3c')];_0x20592d[_0x44bf('0x43')]=qs[_0x44bf('0x44')](_0x1017c0['query']['sort']);_0x20592d[_0x44bf('0x45')]=qs[_0x44bf('0x46')](_[_0x44bf('0x47')](_0x1017c0['query'],_0x1a8dba[_0x44bf('0x46')]));if(_0x1017c0[_0x44bf('0x3d')][_0x44bf('0x49')]){_0x20592d[_0x44bf('0x45')]=_[_0x44bf('0x48')](_0x20592d['where'],{'$or':_[_0x44bf('0x36')](_0x20592d[_0x44bf('0x3f')],function(_0x465cc3){var _0x2e5fa3={};_0x2e5fa3[_0x465cc3]={'$like':'%'+_0x1017c0['query']['filter']+'%'};return _0x2e5fa3;})});}_0x20592d=_['merge']({},_0x20592d,_0x1017c0['options']);return _0x5a3eb6[_0x44bf('0x57')](_0x20592d);}})['then'](function(_0x31286a){if(_0x31286a){_0x1820a7=_0x31286a[_0x44bf('0x41')];if(!_0x1017c0[_0x44bf('0x3d')][_0x44bf('0x58')](_0x44bf('0x42'))){_0x20592d[_0x44bf('0x2c')]=qs[_0x44bf('0x2c')](_0x1017c0[_0x44bf('0x3d')]['limit']);_0x20592d[_0x44bf('0x2b')]=qs[_0x44bf('0x2b')](_0x1017c0[_0x44bf('0x3d')][_0x44bf('0x2b')]);}return _0x5a3eb6[_0x44bf('0x57')](_0x20592d);}})[_0x44bf('0x1d')](function(_0x5e15b8){if(_0x5e15b8){return _0x5e15b8?{'count':_0x1820a7,'rows':_0x5e15b8}:null;}})[_0x44bf('0x1d')](respondWithResult(_0x17e6ae,null))[_0x44bf('0x26')](handleError(_0x17e6ae,null));};exports[_0x44bf('0x59')]=function(_0x3587f0,_0x4a3a2d,_0x5cbab2){var _0x227145={};var _0xd75acc={};var _0x461241;var _0xc43601;return db[_0x44bf('0x37')][_0x44bf('0x54')]({'where':{'id':_0x3587f0[_0x44bf('0x52')]['id']}})[_0x44bf('0x1d')](handleEntityNotFound(_0x4a3a2d,null))['then'](function(_0x1537e6){if(_0x1537e6){_0x461241=_0x1537e6;_0xd75acc[_0x44bf('0x3c')]=_[_0x44bf('0x4e')](db[_0x44bf('0x55')][_0x44bf('0x38')]);_0xd75acc['query']=_[_0x44bf('0x4e')](_0x3587f0[_0x44bf('0x3d')]);_0xd75acc[_0x44bf('0x46')]=_[_0x44bf('0x3e')](_0xd75acc[_0x44bf('0x3c')],_0xd75acc[_0x44bf('0x3d')]);_0x227145[_0x44bf('0x3f')]=_[_0x44bf('0x3e')](_0xd75acc[_0x44bf('0x3c')],qs['fields'](_0x3587f0['query'][_0x44bf('0x40')]));_0x227145[_0x44bf('0x3f')]=_0x227145[_0x44bf('0x3f')][_0x44bf('0x41')]?_0x227145['attributes']:_0xd75acc['model'];_0x227145[_0x44bf('0x43')]=qs[_0x44bf('0x44')](_0x3587f0[_0x44bf('0x3d')][_0x44bf('0x44')]);_0x227145[_0x44bf('0x45')]=qs[_0x44bf('0x46')](_[_0x44bf('0x47')](_0x3587f0[_0x44bf('0x3d')],_0xd75acc[_0x44bf('0x46')]));if(_0x3587f0[_0x44bf('0x3d')]['filter']){_0x227145['where']=_[_0x44bf('0x48')](_0x227145['where'],{'$or':_[_0x44bf('0x36')](_0x227145[_0x44bf('0x3f')],function(_0x15593a){var _0x3e6f2c={};_0x3e6f2c[_0x15593a]={'$like':'%'+_0x3587f0[_0x44bf('0x3d')][_0x44bf('0x49')]+'%'};return _0x3e6f2c;})});}_0x227145=_[_0x44bf('0x48')]({},_0x227145,_0x3587f0[_0x44bf('0x4a')]);return _0x461241[_0x44bf('0x59')](_0x227145);}})[_0x44bf('0x1d')](function(_0x39e4d0){if(_0x39e4d0){_0xc43601=_0x39e4d0[_0x44bf('0x41')];if(!_0x3587f0['query'][_0x44bf('0x58')](_0x44bf('0x42'))){_0x227145['limit']=qs[_0x44bf('0x2c')](_0x3587f0[_0x44bf('0x3d')][_0x44bf('0x2c')]);_0x227145[_0x44bf('0x2b')]=qs[_0x44bf('0x2b')](_0x3587f0[_0x44bf('0x3d')][_0x44bf('0x2b')]);}return _0x461241[_0x44bf('0x59')](_0x227145);}})[_0x44bf('0x1d')](function(_0x22f391){if(_0x22f391){return _0x22f391?{'count':_0xc43601,'rows':_0x22f391}:null;}})['then'](respondWithResult(_0x4a3a2d,null))['catch'](handleError(_0x4a3a2d,null));}; \ No newline at end of file +var _0xe111=['catch','sendStatus','status','end','count','offset','limit','set','json','apply','reject','save','stack','name','map','SalesforceConfiguration','fieldName','type','key','model','keys','query','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','include','rows','show','params','rawAttributes','create','body','update','find','destroy','getFields','length','getSubjects','SalesforceField','getDescriptions','findOne','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','jayson/promise','client','http','test','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','then','info','SalesforceConfiguration,\x20%s,\x20%s','request\x20sent','SalesforceConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result'];(function(_0x316a51,_0x531e7c){var _0x5c57fb=function(_0x9da271){while(--_0x9da271){_0x316a51['push'](_0x316a51['shift']());}};_0x5c57fb(++_0x531e7c);}(_0xe111,0x99));var _0x1e11=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xe111[_0x3dd15e];return _0x231fd0;};'use strict';var pdf=require(_0x1e11('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x1e11('0x1'));var zipdir=require(_0x1e11('0x2'));var jsonpatch=require(_0x1e11('0x3'));var rp=require(_0x1e11('0x4'));var moment=require(_0x1e11('0x5'));var BPromise=require(_0x1e11('0x6'));var Mustache=require(_0x1e11('0x7'));var util=require(_0x1e11('0x8'));var path=require(_0x1e11('0x9'));var sox=require(_0x1e11('0xa'));var csv=require(_0x1e11('0xb'));var ejs=require(_0x1e11('0xc'));var fs=require('fs');var _=require(_0x1e11('0xd'));var squel=require(_0x1e11('0xe'));var crypto=require(_0x1e11('0xf'));var jsforce=require(_0x1e11('0x10'));var deskjs=require(_0x1e11('0x11'));var toCsv=require(_0x1e11('0xb'));var querystring=require(_0x1e11('0x12'));var Papa=require(_0x1e11('0x13'));var Redis=require(_0x1e11('0x14'));var authService=require(_0x1e11('0x15'));var qs=require(_0x1e11('0x16'));var as=require(_0x1e11('0x17'));var hardwareService=require(_0x1e11('0x18'));var logger=require(_0x1e11('0x19'))(_0x1e11('0x1a'));var utils=require(_0x1e11('0x1b'));var config=require(_0x1e11('0x1c'));var db=require(_0x1e11('0x1d'))['db'];var jayson=require(_0x1e11('0x1e'));var client=jayson[_0x1e11('0x1f')][_0x1e11('0x20')]({'port':0x232a});function checkPasswordPattern(_0x4e4fdc,_0x5e056b,_0xc13170){if(_0xc13170){var _0x3bd009=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x3bd009[_0x1e11('0x21')](_0x5e056b)){return _0x4e4fdc;}else{throw new db[(_0x1e11('0x22'))][(_0x1e11('0x23'))](_0x1e11('0x24'));}}else{return _0x4e4fdc;}}function respondWithRpcPromise(_0x2c874b,_0x5a2610,_0x392316,_0x5747a2){return new BPromise(function(_0x211676,_0x5183e1){var _0x532330=_0x5747a2||client;return _0x532330['request'](_0x2c874b,_0x392316)[_0x1e11('0x25')](function(_0x44d068){logger[_0x1e11('0x26')](_0x1e11('0x27'),_0x5a2610,_0x1e11('0x28'));logger['debug'](_0x1e11('0x29'),_0x5a2610,_0x1e11('0x28'),JSON[_0x1e11('0x2a')](_0x44d068));if(_0x44d068[_0x1e11('0x2b')]){if(_0x44d068['error'][_0x1e11('0x2c')]===0x1f4){logger[_0x1e11('0x2b')](_0x1e11('0x27'),_0x5a2610,_0x44d068[_0x1e11('0x2b')][_0x1e11('0x2d')]);return _0x5183e1(_0x44d068[_0x1e11('0x2b')][_0x1e11('0x2d')]);}logger['error'](_0x1e11('0x27'),_0x5a2610,_0x44d068[_0x1e11('0x2b')]['message']);return _0x211676(_0x44d068['error'][_0x1e11('0x2d')]);}else{logger[_0x1e11('0x26')](_0x1e11('0x27'),_0x5a2610,_0x1e11('0x28'));_0x211676(_0x44d068[_0x1e11('0x2e')][_0x1e11('0x2d')]);}})[_0x1e11('0x2f')](function(_0xa39dd){logger['error'](_0x1e11('0x27'),_0x5a2610,_0xa39dd);_0x5183e1(_0xa39dd);});});}function respondWithStatusCode(_0x50b205,_0x5dc61c){_0x5dc61c=_0x5dc61c||0xcc;return function(_0x4c7dd2){if(_0x4c7dd2){return _0x50b205[_0x1e11('0x30')](_0x5dc61c);}return _0x50b205[_0x1e11('0x31')](_0x5dc61c)[_0x1e11('0x32')]();};}function respondWithResult(_0x11a39b,_0x29975f){_0x29975f=_0x29975f||0xc8;return function(_0x43299b){if(_0x43299b){return _0x11a39b[_0x1e11('0x31')](_0x29975f)['json'](_0x43299b);}};}function respondWithFilteredResult(_0xf7c35,_0x3f0767){return function(_0x1a4e0e){if(_0x1a4e0e){var _0xd4ceb0=_0x1a4e0e[_0x1e11('0x33')],_0x2abb28=_0x3f0767[_0x1e11('0x34')],_0x37ebcb=_0x3f0767[_0x1e11('0x34')]+_0x3f0767[_0x1e11('0x35')],_0x52079a;if(_0x37ebcb>=_0xd4ceb0){_0x37ebcb=_0xd4ceb0;_0x52079a=0xc8;}else{_0x52079a=0xce;}_0xf7c35[_0x1e11('0x31')](_0x52079a);return _0xf7c35[_0x1e11('0x36')]('Content-Range',_0x2abb28+'-'+_0x37ebcb+'/'+_0xd4ceb0)[_0x1e11('0x37')](_0x1a4e0e);}return null;};}function patchUpdates(_0x27e61b){return function(_0x404e3f){try{jsonpatch[_0x1e11('0x38')](_0x404e3f,_0x27e61b,!![]);}catch(_0x58d747){return BPromise[_0x1e11('0x39')](_0x58d747);}return _0x404e3f[_0x1e11('0x3a')]();};}function saveUpdates(_0x22c870,_0x5a8bf1){return function(_0x2b50a8){if(_0x2b50a8){return _0x2b50a8['update'](_0x22c870)[_0x1e11('0x25')](function(_0x425d37){return _0x425d37;});}return null;};}function removeEntity(_0x411e66,_0x2a56d9){return function(_0xf8a5ed){if(_0xf8a5ed){return _0xf8a5ed['destroy']()[_0x1e11('0x25')](function(){_0x411e66[_0x1e11('0x31')](0xcc)[_0x1e11('0x32')]();});}};}function handleEntityNotFound(_0x587f5f,_0x190ecd){return function(_0x4e122f){if(!_0x4e122f){_0x587f5f[_0x1e11('0x30')](0x194);}return _0x4e122f;};}function handleError(_0x24ce8a,_0x4ddf7f){_0x4ddf7f=_0x4ddf7f||0x1f4;return function(_0x4ff2e9){logger[_0x1e11('0x2b')](_0x4ff2e9[_0x1e11('0x3b')]);if(_0x4ff2e9['name']){delete _0x4ff2e9[_0x1e11('0x3c')];}_0x24ce8a[_0x1e11('0x31')](_0x4ddf7f)['send'](_0x4ff2e9);};}exports['index']=function(_0x51154b,_0x1710f0){var _0x5ce5c6={},_0x4f5c36={},_0x30894e={'count':0x0,'rows':[]};var _0x3bc488=_[_0x1e11('0x3d')](db[_0x1e11('0x3e')]['rawAttributes'],function(_0x5d74ce){return{'name':_0x5d74ce[_0x1e11('0x3f')],'type':_0x5d74ce[_0x1e11('0x40')][_0x1e11('0x41')]};});_0x4f5c36[_0x1e11('0x42')]=_[_0x1e11('0x3d')](_0x3bc488,_0x1e11('0x3c'));_0x4f5c36['query']=_[_0x1e11('0x43')](_0x51154b[_0x1e11('0x44')]);_0x4f5c36[_0x1e11('0x45')]=_[_0x1e11('0x46')](_0x4f5c36['model'],_0x4f5c36[_0x1e11('0x44')]);_0x5ce5c6['attributes']=_[_0x1e11('0x46')](_0x4f5c36[_0x1e11('0x42')],qs[_0x1e11('0x47')](_0x51154b[_0x1e11('0x44')][_0x1e11('0x47')]));_0x5ce5c6[_0x1e11('0x48')]=_0x5ce5c6['attributes']['length']?_0x5ce5c6[_0x1e11('0x48')]:_0x4f5c36[_0x1e11('0x42')];if(!_0x51154b['query'][_0x1e11('0x49')](_0x1e11('0x4a'))){_0x5ce5c6[_0x1e11('0x35')]=qs['limit'](_0x51154b[_0x1e11('0x44')][_0x1e11('0x35')]);_0x5ce5c6[_0x1e11('0x34')]=qs[_0x1e11('0x34')](_0x51154b[_0x1e11('0x44')]['offset']);}_0x5ce5c6[_0x1e11('0x4b')]=qs[_0x1e11('0x4c')](_0x51154b[_0x1e11('0x44')]['sort']);_0x5ce5c6[_0x1e11('0x4d')]=qs[_0x1e11('0x45')](_[_0x1e11('0x4e')](_0x51154b[_0x1e11('0x44')],_0x4f5c36['filters']),_0x3bc488);if(_0x51154b[_0x1e11('0x44')]['filter']){_0x5ce5c6[_0x1e11('0x4d')]=_[_0x1e11('0x4f')](_0x5ce5c6[_0x1e11('0x4d')],{'$or':_['map'](_0x3bc488,function(_0x239b06){if(_0x239b06[_0x1e11('0x40')]!==_0x1e11('0x50')){var _0x8b3e61={};_0x8b3e61[_0x239b06[_0x1e11('0x3c')]]={'$like':'%'+_0x51154b[_0x1e11('0x44')][_0x1e11('0x51')]+'%'};return _0x8b3e61;}})});}_0x5ce5c6=_[_0x1e11('0x4f')]({},_0x5ce5c6,_0x51154b[_0x1e11('0x52')]);var _0x161387={'where':_0x5ce5c6[_0x1e11('0x4d')]};return db['SalesforceConfiguration'][_0x1e11('0x33')](_0x161387)['then'](function(_0x2758a0){_0x30894e[_0x1e11('0x33')]=_0x2758a0;if(_0x51154b[_0x1e11('0x44')][_0x1e11('0x53')]){_0x5ce5c6[_0x1e11('0x54')]=[{'all':!![]}];}return db['SalesforceConfiguration']['findAll'](_0x5ce5c6);})[_0x1e11('0x25')](function(_0x1c6ff7){_0x30894e[_0x1e11('0x55')]=_0x1c6ff7;return _0x30894e;})[_0x1e11('0x25')](respondWithFilteredResult(_0x1710f0,_0x5ce5c6))[_0x1e11('0x2f')](handleError(_0x1710f0,null));};exports[_0x1e11('0x56')]=function(_0x450edf,_0x5919a6){var _0x49c20d={'raw':![],'where':{'id':_0x450edf[_0x1e11('0x57')]['id']}},_0x5702eb={};_0x5702eb['model']=_[_0x1e11('0x43')](db[_0x1e11('0x3e')][_0x1e11('0x58')]);_0x5702eb[_0x1e11('0x44')]=_[_0x1e11('0x43')](_0x450edf['query']);_0x5702eb[_0x1e11('0x45')]=_['intersection'](_0x5702eb[_0x1e11('0x42')],_0x5702eb[_0x1e11('0x44')]);_0x49c20d[_0x1e11('0x48')]=_[_0x1e11('0x46')](_0x5702eb[_0x1e11('0x42')],qs[_0x1e11('0x47')](_0x450edf[_0x1e11('0x44')][_0x1e11('0x47')]));_0x49c20d[_0x1e11('0x48')]=_0x49c20d[_0x1e11('0x48')]['length']?_0x49c20d[_0x1e11('0x48')]:_0x5702eb[_0x1e11('0x42')];if(_0x450edf[_0x1e11('0x44')][_0x1e11('0x53')]){_0x49c20d['include']=[{'all':!![]}];}_0x49c20d=_[_0x1e11('0x4f')]({},_0x49c20d,_0x450edf['options']);return db[_0x1e11('0x3e')]['find'](_0x49c20d)[_0x1e11('0x25')](handleEntityNotFound(_0x5919a6,null))[_0x1e11('0x25')](respondWithResult(_0x5919a6,null))[_0x1e11('0x2f')](handleError(_0x5919a6,null));};exports[_0x1e11('0x59')]=function(_0x4152b6,_0x1fc03f){return db['SalesforceConfiguration'][_0x1e11('0x59')](_0x4152b6[_0x1e11('0x5a')],{})[_0x1e11('0x25')](respondWithResult(_0x1fc03f,0xc9))[_0x1e11('0x2f')](handleError(_0x1fc03f,null));};exports[_0x1e11('0x5b')]=function(_0x36c0ca,_0x2a6d69){if(_0x36c0ca[_0x1e11('0x5a')]['id']){delete _0x36c0ca[_0x1e11('0x5a')]['id'];}return db['SalesforceConfiguration'][_0x1e11('0x5c')]({'where':{'id':_0x36c0ca[_0x1e11('0x57')]['id']}})[_0x1e11('0x25')](handleEntityNotFound(_0x2a6d69,null))[_0x1e11('0x25')](saveUpdates(_0x36c0ca['body'],null))[_0x1e11('0x25')](respondWithResult(_0x2a6d69,null))[_0x1e11('0x2f')](handleError(_0x2a6d69,null));};exports[_0x1e11('0x5d')]=function(_0x1ce110,_0x5f2e0c){return db[_0x1e11('0x3e')]['find']({'where':{'id':_0x1ce110[_0x1e11('0x57')]['id']}})[_0x1e11('0x25')](handleEntityNotFound(_0x5f2e0c,null))[_0x1e11('0x25')](removeEntity(_0x5f2e0c,null))[_0x1e11('0x2f')](handleError(_0x5f2e0c,null));};exports[_0x1e11('0x5e')]=function(_0x32550d,_0x211f37,_0x55acf8){var _0x5d2175={};var _0x36a31a={};var _0x55f0d8;var _0xd3f722;return db[_0x1e11('0x3e')]['findOne']({'where':{'id':_0x32550d[_0x1e11('0x57')]['id']}})[_0x1e11('0x25')](handleEntityNotFound(_0x211f37,null))[_0x1e11('0x25')](function(_0x3eb99d){if(_0x3eb99d){_0x55f0d8=_0x3eb99d;_0x36a31a[_0x1e11('0x42')]=_[_0x1e11('0x43')](db['SalesforceField'][_0x1e11('0x58')]);_0x36a31a[_0x1e11('0x44')]=_[_0x1e11('0x43')](_0x32550d[_0x1e11('0x44')]);_0x36a31a['filters']=_['intersection'](_0x36a31a[_0x1e11('0x42')],_0x36a31a[_0x1e11('0x44')]);_0x5d2175['attributes']=_[_0x1e11('0x46')](_0x36a31a[_0x1e11('0x42')],qs[_0x1e11('0x47')](_0x32550d[_0x1e11('0x44')][_0x1e11('0x47')]));_0x5d2175[_0x1e11('0x48')]=_0x5d2175['attributes']['length']?_0x5d2175[_0x1e11('0x48')]:_0x36a31a[_0x1e11('0x42')];_0x5d2175['order']=qs[_0x1e11('0x4c')](_0x32550d[_0x1e11('0x44')][_0x1e11('0x4c')]);_0x5d2175[_0x1e11('0x4d')]=qs[_0x1e11('0x45')](_[_0x1e11('0x4e')](_0x32550d[_0x1e11('0x44')],_0x36a31a['filters']));if(_0x32550d[_0x1e11('0x44')][_0x1e11('0x51')]){_0x5d2175['where']=_[_0x1e11('0x4f')](_0x5d2175[_0x1e11('0x4d')],{'$or':_[_0x1e11('0x3d')](_0x5d2175['attributes'],function(_0x1b714d){var _0x57de4f={};_0x57de4f[_0x1b714d]={'$like':'%'+_0x32550d[_0x1e11('0x44')][_0x1e11('0x51')]+'%'};return _0x57de4f;})});}_0x5d2175=_[_0x1e11('0x4f')]({},_0x5d2175,_0x32550d[_0x1e11('0x52')]);return _0x55f0d8[_0x1e11('0x5e')](_0x5d2175);}})[_0x1e11('0x25')](function(_0x29bf3a){if(_0x29bf3a){_0xd3f722=_0x29bf3a[_0x1e11('0x5f')];if(!_0x32550d[_0x1e11('0x44')][_0x1e11('0x49')](_0x1e11('0x4a'))){_0x5d2175['limit']=qs[_0x1e11('0x35')](_0x32550d[_0x1e11('0x44')][_0x1e11('0x35')]);_0x5d2175[_0x1e11('0x34')]=qs['offset'](_0x32550d[_0x1e11('0x44')][_0x1e11('0x34')]);}return _0x55f0d8['getFields'](_0x5d2175);}})[_0x1e11('0x25')](function(_0x30d815){if(_0x30d815){return _0x30d815?{'count':_0xd3f722,'rows':_0x30d815}:null;}})['then'](respondWithResult(_0x211f37,null))[_0x1e11('0x2f')](handleError(_0x211f37,null));};exports[_0x1e11('0x60')]=function(_0x3dcd52,_0x1db35b,_0x516af5){var _0x513b67={};var _0x5d12f9={};var _0x52d2fd;var _0x7b676d;return db[_0x1e11('0x3e')]['findOne']({'where':{'id':_0x3dcd52[_0x1e11('0x57')]['id']}})[_0x1e11('0x25')](handleEntityNotFound(_0x1db35b,null))[_0x1e11('0x25')](function(_0x3ccda6){if(_0x3ccda6){_0x52d2fd=_0x3ccda6;_0x5d12f9[_0x1e11('0x42')]=_['keys'](db[_0x1e11('0x61')]['rawAttributes']);_0x5d12f9[_0x1e11('0x44')]=_[_0x1e11('0x43')](_0x3dcd52[_0x1e11('0x44')]);_0x5d12f9['filters']=_[_0x1e11('0x46')](_0x5d12f9['model'],_0x5d12f9['query']);_0x513b67['attributes']=_['intersection'](_0x5d12f9['model'],qs[_0x1e11('0x47')](_0x3dcd52[_0x1e11('0x44')][_0x1e11('0x47')]));_0x513b67[_0x1e11('0x48')]=_0x513b67['attributes'][_0x1e11('0x5f')]?_0x513b67[_0x1e11('0x48')]:_0x5d12f9[_0x1e11('0x42')];_0x513b67['order']=qs['sort'](_0x3dcd52[_0x1e11('0x44')][_0x1e11('0x4c')]);_0x513b67[_0x1e11('0x4d')]=qs[_0x1e11('0x45')](_[_0x1e11('0x4e')](_0x3dcd52[_0x1e11('0x44')],_0x5d12f9[_0x1e11('0x45')]));if(_0x3dcd52[_0x1e11('0x44')][_0x1e11('0x51')]){_0x513b67['where']=_[_0x1e11('0x4f')](_0x513b67[_0x1e11('0x4d')],{'$or':_[_0x1e11('0x3d')](_0x513b67[_0x1e11('0x48')],function(_0x1b8979){var _0x4da38e={};_0x4da38e[_0x1b8979]={'$like':'%'+_0x3dcd52['query'][_0x1e11('0x51')]+'%'};return _0x4da38e;})});}_0x513b67=_[_0x1e11('0x4f')]({},_0x513b67,_0x3dcd52[_0x1e11('0x52')]);return _0x52d2fd[_0x1e11('0x60')](_0x513b67);}})[_0x1e11('0x25')](function(_0x61c6e0){if(_0x61c6e0){_0x7b676d=_0x61c6e0[_0x1e11('0x5f')];if(!_0x3dcd52[_0x1e11('0x44')][_0x1e11('0x49')](_0x1e11('0x4a'))){_0x513b67['limit']=qs['limit'](_0x3dcd52[_0x1e11('0x44')][_0x1e11('0x35')]);_0x513b67[_0x1e11('0x34')]=qs['offset'](_0x3dcd52[_0x1e11('0x44')]['offset']);}return _0x52d2fd['getSubjects'](_0x513b67);}})['then'](function(_0x137ed3){if(_0x137ed3){return _0x137ed3?{'count':_0x7b676d,'rows':_0x137ed3}:null;}})[_0x1e11('0x25')](respondWithResult(_0x1db35b,null))[_0x1e11('0x2f')](handleError(_0x1db35b,null));};exports[_0x1e11('0x62')]=function(_0x3012db,_0xfe1a15,_0x30c5d5){var _0x46d28a={};var _0xb5d039={};var _0x280d84;var _0x45d8b1;return db[_0x1e11('0x3e')][_0x1e11('0x63')]({'where':{'id':_0x3012db['params']['id']}})[_0x1e11('0x25')](handleEntityNotFound(_0xfe1a15,null))[_0x1e11('0x25')](function(_0x49570d){if(_0x49570d){_0x280d84=_0x49570d;_0xb5d039[_0x1e11('0x42')]=_['keys'](db['SalesforceField'][_0x1e11('0x58')]);_0xb5d039[_0x1e11('0x44')]=_['keys'](_0x3012db[_0x1e11('0x44')]);_0xb5d039['filters']=_[_0x1e11('0x46')](_0xb5d039[_0x1e11('0x42')],_0xb5d039['query']);_0x46d28a[_0x1e11('0x48')]=_[_0x1e11('0x46')](_0xb5d039[_0x1e11('0x42')],qs[_0x1e11('0x47')](_0x3012db[_0x1e11('0x44')]['fields']));_0x46d28a[_0x1e11('0x48')]=_0x46d28a[_0x1e11('0x48')][_0x1e11('0x5f')]?_0x46d28a[_0x1e11('0x48')]:_0xb5d039[_0x1e11('0x42')];_0x46d28a[_0x1e11('0x4b')]=qs[_0x1e11('0x4c')](_0x3012db[_0x1e11('0x44')][_0x1e11('0x4c')]);_0x46d28a[_0x1e11('0x4d')]=qs['filters'](_[_0x1e11('0x4e')](_0x3012db[_0x1e11('0x44')],_0xb5d039[_0x1e11('0x45')]));if(_0x3012db[_0x1e11('0x44')][_0x1e11('0x51')]){_0x46d28a[_0x1e11('0x4d')]=_[_0x1e11('0x4f')](_0x46d28a[_0x1e11('0x4d')],{'$or':_[_0x1e11('0x3d')](_0x46d28a[_0x1e11('0x48')],function(_0x49e314){var _0x48cd9d={};_0x48cd9d[_0x49e314]={'$like':'%'+_0x3012db[_0x1e11('0x44')][_0x1e11('0x51')]+'%'};return _0x48cd9d;})});}_0x46d28a=_[_0x1e11('0x4f')]({},_0x46d28a,_0x3012db['options']);return _0x280d84[_0x1e11('0x62')](_0x46d28a);}})['then'](function(_0x46a470){if(_0x46a470){_0x45d8b1=_0x46a470['length'];if(!_0x3012db['query'][_0x1e11('0x49')]('nolimit')){_0x46d28a['limit']=qs[_0x1e11('0x35')](_0x3012db[_0x1e11('0x44')][_0x1e11('0x35')]);_0x46d28a['offset']=qs[_0x1e11('0x34')](_0x3012db['query'][_0x1e11('0x34')]);}return _0x280d84['getDescriptions'](_0x46d28a);}})[_0x1e11('0x25')](function(_0x414933){if(_0x414933){return _0x414933?{'count':_0x45d8b1,'rows':_0x414933}:null;}})[_0x1e11('0x25')](respondWithResult(_0xfe1a15,null))[_0x1e11('0x2f')](handleError(_0xfe1a15,null));}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.model.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.model.js index 76a73ea..90b79f9 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 _0x3285=['../../config/environment','./intSalesforceConfiguration.attributes','exports','define','SalesforceConfiguration','int_salesforce_configurations','lodash','util','api','moment','bluebird','request-promise','rimraf'];(function(_0x302a64,_0x191bf6){var _0xc4c71e=function(_0xe03a6d){while(--_0xe03a6d){_0x302a64['push'](_0x302a64['shift']());}};_0xc4c71e(++_0x191bf6);}(_0x3285,0x1b3));var _0x5328=function(_0x4b2436,_0x452299){_0x4b2436=_0x4b2436-0x0;var _0x4f5ab2=_0x3285[_0x4b2436];return _0x4f5ab2;};'use strict';var _=require(_0x5328('0x0'));var util=require(_0x5328('0x1'));var logger=require('../../config/logger')(_0x5328('0x2'));var moment=require(_0x5328('0x3'));var BPromise=require(_0x5328('0x4'));var rp=require(_0x5328('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x5328('0x6'));var config=require(_0x5328('0x7'));var attributes=require(_0x5328('0x8'));module[_0x5328('0x9')]=function(_0x59425b,_0x318b2d){return _0x59425b[_0x5328('0xa')](_0x5328('0xb'),attributes,{'tableName':_0x5328('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6182=['path','rimraf','../../config/environment','define','SalesforceConfiguration','int_salesforce_configurations','lodash','util','../../config/logger','api','moment'];(function(_0x1bae8f,_0x426d31){var _0x591da3=function(_0x2facc8){while(--_0x2facc8){_0x1bae8f['push'](_0x1bae8f['shift']());}};_0x591da3(++_0x426d31);}(_0x6182,0x145));var _0x2618=function(_0x2ff273,_0x2f3e29){_0x2ff273=_0x2ff273-0x0;var _0x1a38d5=_0x6182[_0x2ff273];return _0x1a38d5;};'use strict';var _=require(_0x2618('0x0'));var util=require(_0x2618('0x1'));var logger=require(_0x2618('0x2'))(_0x2618('0x3'));var moment=require(_0x2618('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x2618('0x5'));var rimraf=require(_0x2618('0x6'));var config=require(_0x2618('0x7'));var attributes=require('./intSalesforceConfiguration.attributes');module['exports']=function(_0x1727b5,_0x257cbe){return _0x1727b5[_0x2618('0x8')](_0x2618('0x9'),attributes,{'tableName':_0x2618('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.rpc.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.rpc.js index fc7d056..d59e164 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 _0x07ee=['info','request\x20sent','debug','SalesforceConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','SalesforceConfiguration,\x20%s,\x20%s','message','catch','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','then'];(function(_0x4985c5,_0x307430){var _0x7f112a=function(_0x5b47aa){while(--_0x5b47aa){_0x4985c5['push'](_0x4985c5['shift']());}};_0x7f112a(++_0x307430);}(_0x07ee,0x198));var _0xe07e=function(_0x2555d0,_0x4150a6){_0x2555d0=_0x2555d0-0x0;var _0x3bb486=_0x07ee[_0x2555d0];return _0x3bb486;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xe07e('0x0'));var BPromise=require(_0xe07e('0x1'));var rs=require(_0xe07e('0x2'));var fs=require('fs');var Redis=require(_0xe07e('0x3'));var db=require(_0xe07e('0x4'))['db'];var utils=require(_0xe07e('0x5'));var logger=require(_0xe07e('0x6'))(_0xe07e('0x7'));var config=require(_0xe07e('0x8'));var jayson=require(_0xe07e('0x9'));var client=jayson[_0xe07e('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x18e256,_0x3bc3ee,_0x41bcdf){return new BPromise(function(_0x2d8775,_0x5c4d05){return client['request'](_0x18e256,_0x41bcdf)[_0xe07e('0xb')](function(_0x582da4){logger[_0xe07e('0xc')]('SalesforceConfiguration,\x20%s,\x20%s',_0x3bc3ee,_0xe07e('0xd'));logger[_0xe07e('0xe')](_0xe07e('0xf'),_0x3bc3ee,_0xe07e('0xd'),JSON[_0xe07e('0x10')](_0x582da4));if(_0x582da4['error']){if(_0x582da4['error']['code']===0x1f4){logger[_0xe07e('0x11')](_0xe07e('0x12'),_0x3bc3ee,_0x582da4['error'][_0xe07e('0x13')]);return _0x5c4d05(_0x582da4[_0xe07e('0x11')][_0xe07e('0x13')]);}logger['error'](_0xe07e('0x12'),_0x3bc3ee,_0x582da4['error'][_0xe07e('0x13')]);return _0x2d8775(_0x582da4['error'][_0xe07e('0x13')]);}else{logger['info'](_0xe07e('0x12'),_0x3bc3ee,_0xe07e('0xd'));_0x2d8775(_0x582da4['result'][_0xe07e('0x13')]);}})[_0xe07e('0x14')](function(_0xcf752b){logger[_0xe07e('0x11')](_0xe07e('0x12'),_0x3bc3ee,_0xcf752b);_0x5c4d05(_0xcf752b);});});} \ No newline at end of file +var _0xcb4f=['../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request\x20sent','debug','SalesforceConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','SalesforceConfiguration,\x20%s,\x20%s','message','info','result','catch','lodash','util','bluebird','ioredis'];(function(_0x3032d9,_0x3b875d){var _0x348b3a=function(_0x2d73e5){while(--_0x2d73e5){_0x3032d9['push'](_0x3032d9['shift']());}};_0x348b3a(++_0x3b875d);}(_0xcb4f,0xe3));var _0xfcb4=function(_0x5f1391,_0x19c132){_0x5f1391=_0x5f1391-0x0;var _0x50ebe3=_0xcb4f[_0x5f1391];return _0x50ebe3;};'use strict';var _=require(_0xfcb4('0x0'));var util=require(_0xfcb4('0x1'));var moment=require('moment');var BPromise=require(_0xfcb4('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xfcb4('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xfcb4('0x4'));var logger=require(_0xfcb4('0x5'))(_0xfcb4('0x6'));var config=require(_0xfcb4('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xfcb4('0x8')][_0xfcb4('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4853a4,_0x484e0f,_0x4c0e4b){return new BPromise(function(_0x3205ba,_0x5e5ce8){return client['request'](_0x4853a4,_0x4c0e4b)['then'](function(_0x2d511c){logger['info']('SalesforceConfiguration,\x20%s,\x20%s',_0x484e0f,_0xfcb4('0xa'));logger[_0xfcb4('0xb')](_0xfcb4('0xc'),_0x484e0f,_0xfcb4('0xa'),JSON[_0xfcb4('0xd')](_0x2d511c));if(_0x2d511c['error']){if(_0x2d511c[_0xfcb4('0xe')][_0xfcb4('0xf')]===0x1f4){logger[_0xfcb4('0xe')](_0xfcb4('0x10'),_0x484e0f,_0x2d511c[_0xfcb4('0xe')][_0xfcb4('0x11')]);return _0x5e5ce8(_0x2d511c[_0xfcb4('0xe')]['message']);}logger[_0xfcb4('0xe')](_0xfcb4('0x10'),_0x484e0f,_0x2d511c[_0xfcb4('0xe')]['message']);return _0x3205ba(_0x2d511c['error'][_0xfcb4('0x11')]);}else{logger[_0xfcb4('0x12')](_0xfcb4('0x10'),_0x484e0f,_0xfcb4('0xa'));_0x3205ba(_0x2d511c[_0xfcb4('0x13')][_0xfcb4('0x11')]);}})[_0xfcb4('0x14')](function(_0x5baaee){logger[_0xfcb4('0xe')](_0xfcb4('0x10'),_0x484e0f,_0x5baaee);_0x5e5ce8(_0x5baaee);});});} \ No newline at end of file diff --git a/server/api/intSalesforceField/index.js b/server/api/intSalesforceField/index.js index e092396..a67b5bd 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 _0x81c6=['index','/:id','create','put','update','destroy','exports','util','Router','../../components/auth/service','../../components/interaction/service','./intSalesforceField.controller','get','isAuthenticated'];(function(_0xf34109,_0x380779){var _0x570bfc=function(_0x1ad086){while(--_0x1ad086){_0xf34109['push'](_0xf34109['shift']());}};_0x570bfc(++_0x380779);}(_0x81c6,0x1d5));var _0x681c=function(_0x46399a,_0x108f44){_0x46399a=_0x46399a-0x0;var _0x3f97ca=_0x81c6[_0x46399a];return _0x3f97ca;};'use strict';var multer=require('multer');var util=require(_0x681c('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x681c('0x1')]();var auth=require(_0x681c('0x2'));var interaction=require(_0x681c('0x3'));var config=require('../../config/environment');var controller=require(_0x681c('0x4'));router[_0x681c('0x5')]('/',auth[_0x681c('0x6')](),controller[_0x681c('0x7')]);router['get'](_0x681c('0x8'),auth[_0x681c('0x6')](),controller['show']);router['post']('/',auth[_0x681c('0x6')](),controller[_0x681c('0x9')]);router[_0x681c('0xa')]('/:id',auth['isAuthenticated'](),controller[_0x681c('0xb')]);router['delete'](_0x681c('0x8'),auth[_0x681c('0x6')](),controller[_0x681c('0xc')]);module[_0x681c('0xd')]=router; \ No newline at end of file +var _0x687b=['post','put','update','delete','destroy','exports','multer','util','path','connect-timeout','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSalesforceField.controller','get','isAuthenticated','index','/:id'];(function(_0x110c3d,_0x12ee06){var _0x226d67=function(_0x1fb6e1){while(--_0x1fb6e1){_0x110c3d['push'](_0x110c3d['shift']());}};_0x226d67(++_0x12ee06);}(_0x687b,0x14a));var _0xb687=function(_0x3f0b30,_0x159bc8){_0x3f0b30=_0x3f0b30-0x0;var _0x2748a5=_0x687b[_0x3f0b30];return _0x2748a5;};'use strict';var multer=require(_0xb687('0x0'));var util=require(_0xb687('0x1'));var path=require(_0xb687('0x2'));var timeout=require(_0xb687('0x3'));var express=require('express');var router=express['Router']();var auth=require(_0xb687('0x4'));var interaction=require(_0xb687('0x5'));var config=require(_0xb687('0x6'));var controller=require(_0xb687('0x7'));router[_0xb687('0x8')]('/',auth[_0xb687('0x9')](),controller[_0xb687('0xa')]);router[_0xb687('0x8')](_0xb687('0xb'),auth[_0xb687('0x9')](),controller['show']);router[_0xb687('0xc')]('/',auth[_0xb687('0x9')](),controller['create']);router[_0xb687('0xd')](_0xb687('0xb'),auth[_0xb687('0x9')](),controller[_0xb687('0xe')]);router[_0xb687('0xf')](_0xb687('0xb'),auth[_0xb687('0x9')](),controller[_0xb687('0x10')]);module[_0xb687('0x11')]=router; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.attributes.js b/server/api/intSalesforceField/intSalesforceField.attributes.js index 4c28241..c98b9bf 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 _0x140a=['variable','customVariable','keyValue','STRING','sequelize','exports','ENUM','string'];(function(_0x33911e,_0x538136){var _0x20e249=function(_0x503b1b){while(--_0x503b1b){_0x33911e['push'](_0x33911e['shift']());}};_0x20e249(++_0x538136);}(_0x140a,0x1f4));var _0xa140=function(_0x166742,_0x55520c){_0x166742=_0x166742-0x0;var _0xb7814a=_0x140a[_0x166742];return _0xb7814a;};'use strict';var Sequelize=require(_0xa140('0x0'));module[_0xa140('0x1')]={'type':{'type':Sequelize[_0xa140('0x2')](_0xa140('0x3'),_0xa140('0x4'),_0xa140('0x5'),_0xa140('0x6')),'defaultValue':_0xa140('0x3')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0xa140('0x2')](_0xa140('0x3'),'variable',_0xa140('0x5'))},'keyContent':{'type':Sequelize[_0xa140('0x7')]},'idField':{'type':Sequelize[_0xa140('0x7')]},'variableName':{'type':Sequelize[_0xa140('0x7')]}}; \ No newline at end of file +var _0x2215=['ENUM','variable','string','STRING','customVariable'];(function(_0x31bc44,_0x4d32e2){var _0x40307c=function(_0x16c3f9){while(--_0x16c3f9){_0x31bc44['push'](_0x31bc44['shift']());}};_0x40307c(++_0x4d32e2);}(_0x2215,0x1ae));var _0x5221=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x2215[_0x20a584];return _0x4b41a8;};'use strict';var Sequelize=require('sequelize');module['exports']={'type':{'type':Sequelize[_0x5221('0x0')]('string',_0x5221('0x1'),'customVariable','keyValue'),'defaultValue':_0x5221('0x2')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0x5221('0x3')]},'keyType':{'type':Sequelize[_0x5221('0x0')](_0x5221('0x2'),_0x5221('0x1'),_0x5221('0x4'))},'keyContent':{'type':Sequelize[_0x5221('0x3')]},'idField':{'type':Sequelize[_0x5221('0x3')]},'variableName':{'type':Sequelize[_0x5221('0x3')]}}; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.controller.js b/server/api/intSalesforceField/intSalesforceField.controller.js index 8a6f1ed..066638e 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 _0xdebb=['json','offset','limit','set','Content-Range','apply','reject','save','update','then','error','name','index','SalesforceField','rawAttributes','fieldName','type','key','map','keys','filters','intersection','query','attributes','fields','length','model','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','include','findAll','rows','show','params','includeAll','options','find','create','body','catch','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/environment','../../mysqldb','sendStatus','status'];(function(_0x1b828b,_0x344400){var _0x98da1a=function(_0x1a0f5b){while(--_0x1a0f5b){_0x1b828b['push'](_0x1b828b['shift']());}};_0x98da1a(++_0x344400);}(_0xdebb,0x14f));var _0xbdeb=function(_0x3c80e8,_0x2bb4ff){_0x3c80e8=_0x3c80e8-0x0;var _0xe57191=_0xdebb[_0x3c80e8];return _0xe57191;};'use strict';var pdf=require(_0xbdeb('0x0'));var emlformat=require(_0xbdeb('0x1'));var rimraf=require(_0xbdeb('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0xbdeb('0x3'));var rp=require(_0xbdeb('0x4'));var moment=require(_0xbdeb('0x5'));var BPromise=require(_0xbdeb('0x6'));var Mustache=require(_0xbdeb('0x7'));var util=require(_0xbdeb('0x8'));var path=require(_0xbdeb('0x9'));var sox=require(_0xbdeb('0xa'));var csv=require(_0xbdeb('0xb'));var ejs=require(_0xbdeb('0xc'));var fs=require('fs');var _=require(_0xbdeb('0xd'));var squel=require(_0xbdeb('0xe'));var crypto=require('crypto');var jsforce=require(_0xbdeb('0xf'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xbdeb('0x10'));var Redis=require(_0xbdeb('0x11'));var authService=require(_0xbdeb('0x12'));var qs=require(_0xbdeb('0x13'));var as=require(_0xbdeb('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0xbdeb('0x15'));var db=require(_0xbdeb('0x16'))['db'];function respondWithStatusCode(_0x3ba532,_0x56ab3e){_0x56ab3e=_0x56ab3e||0xcc;return function(_0x2f0d65){if(_0x2f0d65){return _0x3ba532[_0xbdeb('0x17')](_0x56ab3e);}return _0x3ba532['status'](_0x56ab3e)['end']();};}function respondWithResult(_0x575fb2,_0x5c2d59){_0x5c2d59=_0x5c2d59||0xc8;return function(_0x31d4be){if(_0x31d4be){return _0x575fb2[_0xbdeb('0x18')](_0x5c2d59)[_0xbdeb('0x19')](_0x31d4be);}};}function respondWithFilteredResult(_0x48ec95,_0x4e45ce){return function(_0xd55b26){if(_0xd55b26){var _0x173c3c=_0xd55b26['count'],_0x352724=_0x4e45ce[_0xbdeb('0x1a')],_0x4fc420=_0x4e45ce[_0xbdeb('0x1a')]+_0x4e45ce[_0xbdeb('0x1b')],_0x176cc1;if(_0x4fc420>=_0x173c3c){_0x4fc420=_0x173c3c;_0x176cc1=0xc8;}else{_0x176cc1=0xce;}_0x48ec95[_0xbdeb('0x18')](_0x176cc1);return _0x48ec95[_0xbdeb('0x1c')](_0xbdeb('0x1d'),_0x352724+'-'+_0x4fc420+'/'+_0x173c3c)[_0xbdeb('0x19')](_0xd55b26);}return null;};}function patchUpdates(_0x9ce239){return function(_0x12d5dd){try{jsonpatch[_0xbdeb('0x1e')](_0x12d5dd,_0x9ce239,!![]);}catch(_0x3b485f){return BPromise[_0xbdeb('0x1f')](_0x3b485f);}return _0x12d5dd[_0xbdeb('0x20')]();};}function saveUpdates(_0x5dbf96,_0x207da6){return function(_0x38fc11){if(_0x38fc11){return _0x38fc11[_0xbdeb('0x21')](_0x5dbf96)[_0xbdeb('0x22')](function(_0x431263){return _0x431263;});}return null;};}function removeEntity(_0x3f1e79,_0x57a2e7){return function(_0x26eafa){if(_0x26eafa){return _0x26eafa['destroy']()[_0xbdeb('0x22')](function(){_0x3f1e79['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x2bc444,_0x40a3d5){return function(_0x2ccb8b){if(!_0x2ccb8b){_0x2bc444[_0xbdeb('0x17')](0x194);}return _0x2ccb8b;};}function handleError(_0x2f3203,_0x3e93bb){_0x3e93bb=_0x3e93bb||0x1f4;return function(_0x7ddce5){logger[_0xbdeb('0x23')](_0x7ddce5['stack']);if(_0x7ddce5[_0xbdeb('0x24')]){delete _0x7ddce5[_0xbdeb('0x24')];}_0x2f3203[_0xbdeb('0x18')](_0x3e93bb)['send'](_0x7ddce5);};}exports[_0xbdeb('0x25')]=function(_0x3a64ba,_0x5ba809){var _0x46e433={},_0x46290b={},_0x5f1250={'count':0x0,'rows':[]};var _0x75ca1=_['map'](db[_0xbdeb('0x26')][_0xbdeb('0x27')],function(_0x3efeb8){return{'name':_0x3efeb8[_0xbdeb('0x28')],'type':_0x3efeb8[_0xbdeb('0x29')][_0xbdeb('0x2a')]};});_0x46290b['model']=_[_0xbdeb('0x2b')](_0x75ca1,'name');_0x46290b['query']=_[_0xbdeb('0x2c')](_0x3a64ba['query']);_0x46290b[_0xbdeb('0x2d')]=_[_0xbdeb('0x2e')](_0x46290b['model'],_0x46290b[_0xbdeb('0x2f')]);_0x46e433[_0xbdeb('0x30')]=_[_0xbdeb('0x2e')](_0x46290b['model'],qs[_0xbdeb('0x31')](_0x3a64ba[_0xbdeb('0x2f')][_0xbdeb('0x31')]));_0x46e433['attributes']=_0x46e433[_0xbdeb('0x30')][_0xbdeb('0x32')]?_0x46e433[_0xbdeb('0x30')]:_0x46290b[_0xbdeb('0x33')];if(!_0x3a64ba[_0xbdeb('0x2f')][_0xbdeb('0x34')](_0xbdeb('0x35'))){_0x46e433[_0xbdeb('0x1b')]=qs[_0xbdeb('0x1b')](_0x3a64ba[_0xbdeb('0x2f')][_0xbdeb('0x1b')]);_0x46e433['offset']=qs[_0xbdeb('0x1a')](_0x3a64ba[_0xbdeb('0x2f')][_0xbdeb('0x1a')]);}_0x46e433[_0xbdeb('0x36')]=qs[_0xbdeb('0x37')](_0x3a64ba[_0xbdeb('0x2f')][_0xbdeb('0x37')]);_0x46e433[_0xbdeb('0x38')]=qs[_0xbdeb('0x2d')](_[_0xbdeb('0x39')](_0x3a64ba[_0xbdeb('0x2f')],_0x46290b[_0xbdeb('0x2d')]),_0x75ca1);if(_0x3a64ba[_0xbdeb('0x2f')]['filter']){_0x46e433['where']=_[_0xbdeb('0x3a')](_0x46e433[_0xbdeb('0x38')],{'$or':_['map'](_0x75ca1,function(_0x428d9d){if(_0x428d9d[_0xbdeb('0x29')]!==_0xbdeb('0x3b')){var _0x5aa950={};_0x5aa950[_0x428d9d['name']]={'$like':'%'+_0x3a64ba[_0xbdeb('0x2f')][_0xbdeb('0x3c')]+'%'};return _0x5aa950;}})});}_0x46e433=_[_0xbdeb('0x3a')]({},_0x46e433,_0x3a64ba['options']);var _0xa44aee={'where':_0x46e433['where']};return db[_0xbdeb('0x26')]['count'](_0xa44aee)[_0xbdeb('0x22')](function(_0x279d5){_0x5f1250['count']=_0x279d5;if(_0x3a64ba[_0xbdeb('0x2f')]['includeAll']){_0x46e433[_0xbdeb('0x3d')]=[{'all':!![]}];}return db[_0xbdeb('0x26')][_0xbdeb('0x3e')](_0x46e433);})['then'](function(_0xe11003){_0x5f1250[_0xbdeb('0x3f')]=_0xe11003;return _0x5f1250;})[_0xbdeb('0x22')](respondWithFilteredResult(_0x5ba809,_0x46e433))['catch'](handleError(_0x5ba809,null));};exports[_0xbdeb('0x40')]=function(_0x1935b8,_0x4a3807){var _0x3c0719={'raw':!![],'where':{'id':_0x1935b8[_0xbdeb('0x41')]['id']}},_0x4aed62={};_0x4aed62[_0xbdeb('0x33')]=_[_0xbdeb('0x2c')](db['SalesforceField'][_0xbdeb('0x27')]);_0x4aed62['query']=_['keys'](_0x1935b8[_0xbdeb('0x2f')]);_0x4aed62['filters']=_['intersection'](_0x4aed62[_0xbdeb('0x33')],_0x4aed62[_0xbdeb('0x2f')]);_0x3c0719[_0xbdeb('0x30')]=_[_0xbdeb('0x2e')](_0x4aed62[_0xbdeb('0x33')],qs[_0xbdeb('0x31')](_0x1935b8[_0xbdeb('0x2f')][_0xbdeb('0x31')]));_0x3c0719[_0xbdeb('0x30')]=_0x3c0719['attributes']['length']?_0x3c0719[_0xbdeb('0x30')]:_0x4aed62[_0xbdeb('0x33')];if(_0x1935b8[_0xbdeb('0x2f')][_0xbdeb('0x42')]){_0x3c0719['include']=[{'all':!![]}];}_0x3c0719=_[_0xbdeb('0x3a')]({},_0x3c0719,_0x1935b8[_0xbdeb('0x43')]);return db[_0xbdeb('0x26')][_0xbdeb('0x44')](_0x3c0719)[_0xbdeb('0x22')](handleEntityNotFound(_0x4a3807,null))[_0xbdeb('0x22')](respondWithResult(_0x4a3807,null))['catch'](handleError(_0x4a3807,null));};exports['create']=function(_0x43108f,_0x10e11f){return db[_0xbdeb('0x26')][_0xbdeb('0x45')](_0x43108f[_0xbdeb('0x46')],{})['then'](respondWithResult(_0x10e11f,0xc9))[_0xbdeb('0x47')](handleError(_0x10e11f,null));};exports[_0xbdeb('0x21')]=function(_0x431b18,_0x1b5dd7){if(_0x431b18[_0xbdeb('0x46')]['id']){delete _0x431b18['body']['id'];}return db[_0xbdeb('0x26')][_0xbdeb('0x44')]({'where':{'id':_0x431b18[_0xbdeb('0x41')]['id']}})[_0xbdeb('0x22')](handleEntityNotFound(_0x1b5dd7,null))['then'](saveUpdates(_0x431b18[_0xbdeb('0x46')],null))[_0xbdeb('0x22')](respondWithResult(_0x1b5dd7,null))['catch'](handleError(_0x1b5dd7,null));};exports['destroy']=function(_0x292c54,_0x4ac8c0){return db[_0xbdeb('0x26')]['find']({'where':{'id':_0x292c54[_0xbdeb('0x41')]['id']}})[_0xbdeb('0x22')](handleEntityNotFound(_0x4ac8c0,null))[_0xbdeb('0x22')](removeEntity(_0x4ac8c0,null))[_0xbdeb('0x47')](handleError(_0x4ac8c0,null));}; \ No newline at end of file +var _0x3576=['keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','type','VIRTUAL','options','count','includeAll','include','findAll','rows','catch','show','params','find','create','body','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','to-csv','ejs','squel','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','end','status','offset','limit','apply','reject','save','update','then','destroy','sendStatus','stack','name','send','index','map','SalesforceField','rawAttributes','model'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x3576,0x128));var _0x6357=function(_0x551b79,_0x4cb4b5){_0x551b79=_0x551b79-0x0;var _0x160fe7=_0x3576[_0x551b79];return _0x160fe7;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x6357('0x0'));var jsonpatch=require(_0x6357('0x1'));var rp=require(_0x6357('0x2'));var moment=require('moment');var BPromise=require(_0x6357('0x3'));var Mustache=require(_0x6357('0x4'));var util=require(_0x6357('0x5'));var path=require(_0x6357('0x6'));var sox=require('sox');var csv=require(_0x6357('0x7'));var ejs=require(_0x6357('0x8'));var fs=require('fs');var _=require('lodash');var squel=require(_0x6357('0x9'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x6357('0xa'));var toCsv=require('to-csv');var querystring=require(_0x6357('0xb'));var Papa=require(_0x6357('0xc'));var Redis=require('ioredis');var authService=require(_0x6357('0xd'));var qs=require(_0x6357('0xe'));var as=require(_0x6357('0xf'));var hardwareService=require(_0x6357('0x10'));var logger=require(_0x6357('0x11'))(_0x6357('0x12'));var utils=require(_0x6357('0x13'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1833e9,_0x5efbde){_0x5efbde=_0x5efbde||0xcc;return function(_0x27fea0){if(_0x27fea0){return _0x1833e9['sendStatus'](_0x5efbde);}return _0x1833e9['status'](_0x5efbde)[_0x6357('0x14')]();};}function respondWithResult(_0x23d970,_0x133e5c){_0x133e5c=_0x133e5c||0xc8;return function(_0x181980){if(_0x181980){return _0x23d970[_0x6357('0x15')](_0x133e5c)['json'](_0x181980);}};}function respondWithFilteredResult(_0xe15006,_0x47a02b){return function(_0x1aeade){if(_0x1aeade){var _0x2b0ff2=_0x1aeade['count'],_0x5c0ac8=_0x47a02b[_0x6357('0x16')],_0xe5dbea=_0x47a02b[_0x6357('0x16')]+_0x47a02b[_0x6357('0x17')],_0x401cdd;if(_0xe5dbea>=_0x2b0ff2){_0xe5dbea=_0x2b0ff2;_0x401cdd=0xc8;}else{_0x401cdd=0xce;}_0xe15006['status'](_0x401cdd);return _0xe15006['set']('Content-Range',_0x5c0ac8+'-'+_0xe5dbea+'/'+_0x2b0ff2)['json'](_0x1aeade);}return null;};}function patchUpdates(_0x46240a){return function(_0x5b9785){try{jsonpatch[_0x6357('0x18')](_0x5b9785,_0x46240a,!![]);}catch(_0xa6d382){return BPromise[_0x6357('0x19')](_0xa6d382);}return _0x5b9785[_0x6357('0x1a')]();};}function saveUpdates(_0x498d75,_0x3643f7){return function(_0x4b03f3){if(_0x4b03f3){return _0x4b03f3[_0x6357('0x1b')](_0x498d75)[_0x6357('0x1c')](function(_0x33d0fe){return _0x33d0fe;});}return null;};}function removeEntity(_0x4b1848,_0x3d4fac){return function(_0x15e8b9){if(_0x15e8b9){return _0x15e8b9[_0x6357('0x1d')]()['then'](function(){_0x4b1848[_0x6357('0x15')](0xcc)[_0x6357('0x14')]();});}};}function handleEntityNotFound(_0x35826f,_0xbe95a3){return function(_0x3c7abe){if(!_0x3c7abe){_0x35826f[_0x6357('0x1e')](0x194);}return _0x3c7abe;};}function handleError(_0x268bb7,_0x5257b0){_0x5257b0=_0x5257b0||0x1f4;return function(_0x5ca7cf){logger['error'](_0x5ca7cf[_0x6357('0x1f')]);if(_0x5ca7cf['name']){delete _0x5ca7cf[_0x6357('0x20')];}_0x268bb7[_0x6357('0x15')](_0x5257b0)[_0x6357('0x21')](_0x5ca7cf);};}exports[_0x6357('0x22')]=function(_0x51dd6d,_0x3a44bf){var _0x80b55c={},_0x422a8c={},_0x234afc={'count':0x0,'rows':[]};var _0x4bf136=_[_0x6357('0x23')](db[_0x6357('0x24')][_0x6357('0x25')],function(_0x27ae94){return{'name':_0x27ae94['fieldName'],'type':_0x27ae94['type']['key']};});_0x422a8c[_0x6357('0x26')]=_[_0x6357('0x23')](_0x4bf136,_0x6357('0x20'));_0x422a8c['query']=_[_0x6357('0x27')](_0x51dd6d[_0x6357('0x28')]);_0x422a8c[_0x6357('0x29')]=_[_0x6357('0x2a')](_0x422a8c['model'],_0x422a8c['query']);_0x80b55c['attributes']=_[_0x6357('0x2a')](_0x422a8c[_0x6357('0x26')],qs[_0x6357('0x2b')](_0x51dd6d['query'][_0x6357('0x2b')]));_0x80b55c[_0x6357('0x2c')]=_0x80b55c[_0x6357('0x2c')][_0x6357('0x2d')]?_0x80b55c[_0x6357('0x2c')]:_0x422a8c[_0x6357('0x26')];if(!_0x51dd6d[_0x6357('0x28')][_0x6357('0x2e')](_0x6357('0x2f'))){_0x80b55c[_0x6357('0x17')]=qs[_0x6357('0x17')](_0x51dd6d[_0x6357('0x28')][_0x6357('0x17')]);_0x80b55c['offset']=qs['offset'](_0x51dd6d[_0x6357('0x28')][_0x6357('0x16')]);}_0x80b55c['order']=qs[_0x6357('0x30')](_0x51dd6d[_0x6357('0x28')][_0x6357('0x30')]);_0x80b55c[_0x6357('0x31')]=qs['filters'](_[_0x6357('0x32')](_0x51dd6d[_0x6357('0x28')],_0x422a8c[_0x6357('0x29')]),_0x4bf136);if(_0x51dd6d[_0x6357('0x28')][_0x6357('0x33')]){_0x80b55c['where']=_[_0x6357('0x34')](_0x80b55c['where'],{'$or':_[_0x6357('0x23')](_0x4bf136,function(_0xf26b63){if(_0xf26b63[_0x6357('0x35')]!==_0x6357('0x36')){var _0x34537b={};_0x34537b[_0xf26b63[_0x6357('0x20')]]={'$like':'%'+_0x51dd6d[_0x6357('0x28')][_0x6357('0x33')]+'%'};return _0x34537b;}})});}_0x80b55c=_['merge']({},_0x80b55c,_0x51dd6d[_0x6357('0x37')]);var _0x13db95={'where':_0x80b55c['where']};return db['SalesforceField'][_0x6357('0x38')](_0x13db95)[_0x6357('0x1c')](function(_0x49f540){_0x234afc[_0x6357('0x38')]=_0x49f540;if(_0x51dd6d[_0x6357('0x28')][_0x6357('0x39')]){_0x80b55c[_0x6357('0x3a')]=[{'all':!![]}];}return db[_0x6357('0x24')][_0x6357('0x3b')](_0x80b55c);})[_0x6357('0x1c')](function(_0x296663){_0x234afc[_0x6357('0x3c')]=_0x296663;return _0x234afc;})[_0x6357('0x1c')](respondWithFilteredResult(_0x3a44bf,_0x80b55c))[_0x6357('0x3d')](handleError(_0x3a44bf,null));};exports[_0x6357('0x3e')]=function(_0x2fd211,_0x42cb9f){var _0x38c8eb={'raw':!![],'where':{'id':_0x2fd211[_0x6357('0x3f')]['id']}},_0x2770b9={};_0x2770b9[_0x6357('0x26')]=_[_0x6357('0x27')](db[_0x6357('0x24')]['rawAttributes']);_0x2770b9['query']=_[_0x6357('0x27')](_0x2fd211[_0x6357('0x28')]);_0x2770b9[_0x6357('0x29')]=_[_0x6357('0x2a')](_0x2770b9[_0x6357('0x26')],_0x2770b9[_0x6357('0x28')]);_0x38c8eb[_0x6357('0x2c')]=_[_0x6357('0x2a')](_0x2770b9[_0x6357('0x26')],qs[_0x6357('0x2b')](_0x2fd211[_0x6357('0x28')][_0x6357('0x2b')]));_0x38c8eb[_0x6357('0x2c')]=_0x38c8eb[_0x6357('0x2c')][_0x6357('0x2d')]?_0x38c8eb['attributes']:_0x2770b9[_0x6357('0x26')];if(_0x2fd211['query'][_0x6357('0x39')]){_0x38c8eb['include']=[{'all':!![]}];}_0x38c8eb=_[_0x6357('0x34')]({},_0x38c8eb,_0x2fd211[_0x6357('0x37')]);return db[_0x6357('0x24')][_0x6357('0x40')](_0x38c8eb)[_0x6357('0x1c')](handleEntityNotFound(_0x42cb9f,null))[_0x6357('0x1c')](respondWithResult(_0x42cb9f,null))[_0x6357('0x3d')](handleError(_0x42cb9f,null));};exports['create']=function(_0x353753,_0x38013b){return db[_0x6357('0x24')][_0x6357('0x41')](_0x353753[_0x6357('0x42')],{})[_0x6357('0x1c')](respondWithResult(_0x38013b,0xc9))['catch'](handleError(_0x38013b,null));};exports[_0x6357('0x1b')]=function(_0x16547e,_0x43325c){if(_0x16547e[_0x6357('0x42')]['id']){delete _0x16547e[_0x6357('0x42')]['id'];}return db['SalesforceField'][_0x6357('0x40')]({'where':{'id':_0x16547e[_0x6357('0x3f')]['id']}})[_0x6357('0x1c')](handleEntityNotFound(_0x43325c,null))['then'](saveUpdates(_0x16547e[_0x6357('0x42')],null))[_0x6357('0x1c')](respondWithResult(_0x43325c,null))['catch'](handleError(_0x43325c,null));};exports[_0x6357('0x1d')]=function(_0x451a76,_0x510de9){return db[_0x6357('0x24')][_0x6357('0x40')]({'where':{'id':_0x451a76[_0x6357('0x3f')]['id']}})['then'](handleEntityNotFound(_0x510de9,null))[_0x6357('0x1c')](removeEntity(_0x510de9,null))[_0x6357('0x3d')](handleError(_0x510de9,null));}; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.model.js b/server/api/intSalesforceField/intSalesforceField.model.js index f30dc65..6598f2b 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 _0x68a5=['util','../../config/logger','api','moment','path','rimraf','../../config/environment','./intSalesforceField.attributes','define','int_salesforce_fields','salesforce_unique_index','idField','FieldId','lodash'];(function(_0x3c3ad0,_0x43a8fc){var _0x45593d=function(_0x2679f3){while(--_0x2679f3){_0x3c3ad0['push'](_0x3c3ad0['shift']());}};_0x45593d(++_0x43a8fc);}(_0x68a5,0x6f));var _0x568a=function(_0x33eb70,_0x317a3e){_0x33eb70=_0x33eb70-0x0;var _0x437854=_0x68a5[_0x33eb70];return _0x437854;};'use strict';var _=require(_0x568a('0x0'));var util=require(_0x568a('0x1'));var logger=require(_0x568a('0x2'))(_0x568a('0x3'));var moment=require(_0x568a('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x568a('0x5'));var rimraf=require(_0x568a('0x6'));var config=require(_0x568a('0x7'));var attributes=require(_0x568a('0x8'));module['exports']=function(_0x401c54,_0x279f3c){return _0x401c54[_0x568a('0x9')]('SalesforceField',attributes,{'tableName':_0x568a('0xa'),'paranoid':![],'indexes':[{'name':_0x568a('0xb'),'fields':[_0x568a('0xc'),_0x568a('0xd')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xe053=['define','SalesforceField','salesforce_unique_index','idField','lodash','../../config/logger','api','moment','bluebird','request-promise','./intSalesforceField.attributes','exports'];(function(_0x4b055c,_0x4b870b){var _0x4b62bb=function(_0x4884c2){while(--_0x4884c2){_0x4b055c['push'](_0x4b055c['shift']());}};_0x4b62bb(++_0x4b870b);}(_0xe053,0xac));var _0x3e05=function(_0x25701b,_0x2a6976){_0x25701b=_0x25701b-0x0;var _0x3a8a2c=_0xe053[_0x25701b];return _0x3a8a2c;};'use strict';var _=require(_0x3e05('0x0'));var util=require('util');var logger=require(_0x3e05('0x1'))(_0x3e05('0x2'));var moment=require(_0x3e05('0x3'));var BPromise=require(_0x3e05('0x4'));var rp=require(_0x3e05('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x3e05('0x6'));module[_0x3e05('0x7')]=function(_0x5b5bad,_0x4c44e4){return _0x5b5bad[_0x3e05('0x8')](_0x3e05('0x9'),attributes,{'tableName':'int_salesforce_fields','paranoid':![],'indexes':[{'name':_0x3e05('0xa'),'fields':[_0x3e05('0xb'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.rpc.js b/server/api/intSalesforceField/intSalesforceField.rpc.js index 28a449b..47fd4b0 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 _0x878f=['../../config/logger','rpc','../../config/environment','jayson/promise','request','info','SalesforceField,\x20%s,\x20%s','request\x20sent','SalesforceField,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x5b4726,_0x49938a){var _0x2a2a83=function(_0x218d3e){while(--_0x218d3e){_0x5b4726['push'](_0x5b4726['shift']());}};_0x2a2a83(++_0x49938a);}(_0x878f,0x173));var _0xf878=function(_0xcbf769,_0x39f134){_0xcbf769=_0xcbf769-0x0;var _0x255f33=_0x878f[_0xcbf769];return _0x255f33;};'use strict';var _=require('lodash');var util=require(_0xf878('0x0'));var moment=require(_0xf878('0x1'));var BPromise=require(_0xf878('0x2'));var rs=require(_0xf878('0x3'));var fs=require('fs');var Redis=require(_0xf878('0x4'));var db=require(_0xf878('0x5'))['db'];var utils=require(_0xf878('0x6'));var logger=require(_0xf878('0x7'))(_0xf878('0x8'));var config=require(_0xf878('0x9'));var jayson=require(_0xf878('0xa'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x3c5f5c,_0x62b420,_0x59e564){return new BPromise(function(_0x52851e,_0x530767){return client[_0xf878('0xb')](_0x3c5f5c,_0x59e564)['then'](function(_0x4a9d79){logger[_0xf878('0xc')](_0xf878('0xd'),_0x62b420,_0xf878('0xe'));logger['debug'](_0xf878('0xf'),_0x62b420,_0xf878('0xe'),JSON['stringify'](_0x4a9d79));if(_0x4a9d79[_0xf878('0x10')]){if(_0x4a9d79['error'][_0xf878('0x11')]===0x1f4){logger[_0xf878('0x10')](_0xf878('0xd'),_0x62b420,_0x4a9d79['error'][_0xf878('0x12')]);return _0x530767(_0x4a9d79[_0xf878('0x10')][_0xf878('0x12')]);}logger['error'](_0xf878('0xd'),_0x62b420,_0x4a9d79[_0xf878('0x10')][_0xf878('0x12')]);return _0x52851e(_0x4a9d79['error']['message']);}else{logger[_0xf878('0xc')](_0xf878('0xd'),_0x62b420,_0xf878('0xe'));_0x52851e(_0x4a9d79[_0xf878('0x13')][_0xf878('0x12')]);}})[_0xf878('0x14')](function(_0x415056){logger[_0xf878('0x10')](_0xf878('0xd'),_0x62b420,_0x415056);_0x530767(_0x415056);});});} \ No newline at end of file +var _0x5b02=['client','then','info','request\x20sent','debug','SalesforceField,\x20%s,\x20%s,\x20%s','stringify','error','code','SalesforceField,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x3c42ff,_0x45ee1f){var _0x4c0f6d=function(_0x3ec265){while(--_0x3ec265){_0x3c42ff['push'](_0x3c42ff['shift']());}};_0x4c0f6d(++_0x45ee1f);}(_0x5b02,0xe9));var _0x25b0=function(_0x53c44e,_0x559a30){_0x53c44e=_0x53c44e-0x0;var _0x12bb0e=_0x5b02[_0x53c44e];return _0x12bb0e;};'use strict';var _=require(_0x25b0('0x0'));var util=require(_0x25b0('0x1'));var moment=require(_0x25b0('0x2'));var BPromise=require(_0x25b0('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x25b0('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x25b0('0x5'))(_0x25b0('0x6'));var config=require(_0x25b0('0x7'));var jayson=require(_0x25b0('0x8'));var client=jayson[_0x25b0('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1d82c6,_0xd8276d,_0x49ef3a){return new BPromise(function(_0x412954,_0x4d3e71){return client['request'](_0x1d82c6,_0x49ef3a)[_0x25b0('0xa')](function(_0x45429b){logger[_0x25b0('0xb')]('SalesforceField,\x20%s,\x20%s',_0xd8276d,_0x25b0('0xc'));logger[_0x25b0('0xd')](_0x25b0('0xe'),_0xd8276d,_0x25b0('0xc'),JSON[_0x25b0('0xf')](_0x45429b));if(_0x45429b[_0x25b0('0x10')]){if(_0x45429b[_0x25b0('0x10')][_0x25b0('0x11')]===0x1f4){logger[_0x25b0('0x10')](_0x25b0('0x12'),_0xd8276d,_0x45429b[_0x25b0('0x10')][_0x25b0('0x13')]);return _0x4d3e71(_0x45429b[_0x25b0('0x10')][_0x25b0('0x13')]);}logger[_0x25b0('0x10')](_0x25b0('0x12'),_0xd8276d,_0x45429b[_0x25b0('0x10')][_0x25b0('0x13')]);return _0x412954(_0x45429b[_0x25b0('0x10')][_0x25b0('0x13')]);}else{logger[_0x25b0('0xb')]('SalesforceField,\x20%s,\x20%s',_0xd8276d,'request\x20sent');_0x412954(_0x45429b[_0x25b0('0x14')]['message']);}})[_0x25b0('0x15')](function(_0x1d009f){logger[_0x25b0('0x10')](_0x25b0('0x12'),_0xd8276d,_0x1d009f);_0x4d3e71(_0x1d009f);});});} \ No newline at end of file diff --git a/server/api/intServicenowAccount/index.js b/server/api/intServicenowAccount/index.js index 1e91d5c..599ddee 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 _0x57d4=['multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intServicenowAccount.controller','get','isAuthenticated','index','show','getConfigurations','post','create','/:id/configurations','addConfiguration','put','/:id','update','delete','destroy','exports'];(function(_0x56a7dd,_0x3fd9ae){var _0xc7b980=function(_0x34221b){while(--_0x34221b){_0x56a7dd['push'](_0x56a7dd['shift']());}};_0xc7b980(++_0x3fd9ae);}(_0x57d4,0x78));var _0x457d=function(_0x3ae400,_0x1fa29f){_0x3ae400=_0x3ae400-0x0;var _0xbfaa3e=_0x57d4[_0x3ae400];return _0xbfaa3e;};'use strict';var multer=require(_0x457d('0x0'));var util=require(_0x457d('0x1'));var path=require('path');var timeout=require(_0x457d('0x2'));var express=require(_0x457d('0x3'));var router=express[_0x457d('0x4')]();var auth=require(_0x457d('0x5'));var interaction=require(_0x457d('0x6'));var config=require(_0x457d('0x7'));var controller=require(_0x457d('0x8'));router[_0x457d('0x9')]('/',auth[_0x457d('0xa')](),controller[_0x457d('0xb')]);router[_0x457d('0x9')]('/:id',auth[_0x457d('0xa')](),controller[_0x457d('0xc')]);router['get']('/:id/configurations',auth[_0x457d('0xa')](),controller[_0x457d('0xd')]);router[_0x457d('0x9')]('/:id/fields',auth['isAuthenticated'](),controller['getFields']);router[_0x457d('0xe')]('/',auth[_0x457d('0xa')](),controller[_0x457d('0xf')]);router[_0x457d('0xe')](_0x457d('0x10'),auth[_0x457d('0xa')](),controller[_0x457d('0x11')]);router[_0x457d('0x12')](_0x457d('0x13'),auth['isAuthenticated'](),controller[_0x457d('0x14')]);router[_0x457d('0x15')]('/:id',auth['isAuthenticated'](),controller[_0x457d('0x16')]);module[_0x457d('0x17')]=router; \ No newline at end of file +var _0xc3b5=['exports','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intServicenowAccount.controller','isAuthenticated','index','/:id','show','get','getConfigurations','/:id/fields','getFields','post','create','addConfiguration','delete','destroy'];(function(_0x3429c4,_0x4560ea){var _0x10048c=function(_0x21ce51){while(--_0x21ce51){_0x3429c4['push'](_0x3429c4['shift']());}};_0x10048c(++_0x4560ea);}(_0xc3b5,0x6f));var _0x5c3b=function(_0x28e38b,_0x8faa02){_0x28e38b=_0x28e38b-0x0;var _0x5a8d5d=_0xc3b5[_0x28e38b];return _0x5a8d5d;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x5c3b('0x0'));var timeout=require(_0x5c3b('0x1'));var express=require(_0x5c3b('0x2'));var router=express[_0x5c3b('0x3')]();var auth=require(_0x5c3b('0x4'));var interaction=require(_0x5c3b('0x5'));var config=require(_0x5c3b('0x6'));var controller=require(_0x5c3b('0x7'));router['get']('/',auth[_0x5c3b('0x8')](),controller[_0x5c3b('0x9')]);router['get'](_0x5c3b('0xa'),auth[_0x5c3b('0x8')](),controller[_0x5c3b('0xb')]);router[_0x5c3b('0xc')]('/:id/configurations',auth[_0x5c3b('0x8')](),controller[_0x5c3b('0xd')]);router[_0x5c3b('0xc')](_0x5c3b('0xe'),auth['isAuthenticated'](),controller[_0x5c3b('0xf')]);router[_0x5c3b('0x10')]('/',auth[_0x5c3b('0x8')](),controller[_0x5c3b('0x11')]);router[_0x5c3b('0x10')]('/:id/configurations',auth[_0x5c3b('0x8')](),controller[_0x5c3b('0x12')]);router['put'](_0x5c3b('0xa'),auth[_0x5c3b('0x8')](),controller['update']);router[_0x5c3b('0x13')](_0x5c3b('0xa'),auth[_0x5c3b('0x8')](),controller[_0x5c3b('0x14')]);module[_0x5c3b('0x15')]=router; \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.attributes.js b/server/api/intServicenowAccount/intServicenowAccount.attributes.js index 5351eeb..539da81 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 _0xf3d2=['exports','STRING','username','remoteUri'];(function(_0x5e1e25,_0xdc1421){var _0x548e5f=function(_0x576360){while(--_0x576360){_0x5e1e25['push'](_0x5e1e25['shift']());}};_0x548e5f(++_0xdc1421);}(_0xf3d2,0x13c));var _0x2f3d=function(_0x5a6de2,_0x5c8b10){_0x5a6de2=_0x5a6de2-0x0;var _0x2c0525=_0xf3d2[_0x5a6de2];return _0x2c0525;};'use strict';var Sequelize=require('sequelize');module[_0x2f3d('0x0')]={'name':{'type':Sequelize[_0x2f3d('0x1')]},'description':{'type':Sequelize[_0x2f3d('0x1')]},'username':{'type':Sequelize[_0x2f3d('0x1')],'unique':_0x2f3d('0x2')},'password':{'type':Sequelize[_0x2f3d('0x1')]},'email':{'type':Sequelize[_0x2f3d('0x1')]},'remoteUri':{'type':Sequelize[_0x2f3d('0x1')],'unique':_0x2f3d('0x3')},'serverUrl':{'type':Sequelize[_0x2f3d('0x1')]}}; \ No newline at end of file +var _0xd40a=['STRING','username','sequelize'];(function(_0x4521d2,_0x2afd4f){var _0xdf24e3=function(_0x27c807){while(--_0x27c807){_0x4521d2['push'](_0x4521d2['shift']());}};_0xdf24e3(++_0x2afd4f);}(_0xd40a,0x176));var _0xad40=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd40a[_0x20a584];return _0x4b41a8;};'use strict';var Sequelize=require(_0xad40('0x0'));module['exports']={'name':{'type':Sequelize[_0xad40('0x1')]},'description':{'type':Sequelize[_0xad40('0x1')]},'username':{'type':Sequelize[_0xad40('0x1')],'unique':_0xad40('0x2')},'password':{'type':Sequelize[_0xad40('0x1')]},'email':{'type':Sequelize[_0xad40('0x1')]},'remoteUri':{'type':Sequelize[_0xad40('0x1')],'unique':'remoteUri'},'serverUrl':{'type':Sequelize[_0xad40('0x1')]}}; \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.controller.js b/server/api/intServicenowAccount/intServicenowAccount.controller.js index a0c2565..d5ff073 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 _0x177d=['true','False','false','GET','sys_choice?sysparm_query=name=incident^element=','inactive','value','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','util','path','sox','ejs','squel','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','http','test','Sequelize','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','info','ServicenowAccount,\x20%s,\x20%s','request\x20sent','debug','ServicenowAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','destroy','name','send','index','map','ServicenowAccount','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','show','params','rawAttributes','find','create','body','getConfigurations','findOne','ServicenowConfiguration','order','hasOwnProperty','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','ServicenowField','getFields','made_sla','knowledge','notify','incident_state','severity','category','parent','caused_by','watch_list','upon_reject','child_incidents','hold_reason','approval_history','number','resolved_by','sys_updated_by','opened_by','user_input','sys_domain','state','sys_created_by','calendar_stc','closed_at','cmdb_ci','delivery_plan','impact','business_service','priority','rfc','time_worked','expected_start','work_end','reopened_time','caller_id','subcategory','work_notes','close_code','correlation_display','delivery_task','work_start','business_stc','additional_assignee_list','calendar_duration','sys_class_name','close_notes','closed_by','follow_up','parent_incident','sys_id','contact_type','reopened_by','problem_id','company','reassignment_count','activity_due','assigned_to','comments','approval','comments_and_work_notes','due_date','sys_mod_count','reopen_count','sys_tags','escalation','upon_approval','location','username','password','email','serverUrl','substring','format','%s/api/now/table/','incident?sysparm_display_value=all','log','assign','remove','includes','forEach','label','push','all','TCL:\x20_object','TCL:\x20exports.getEntityFields\x20->\x20_objectsCustom','internalType','concat','ServiceNow\x20error:\x20','stack','Wrong\x20credentials','statusCode','boolean'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0x177d,0xcd));var _0xd177=function(_0x54bdc1,_0x1f4673){_0x54bdc1=_0x54bdc1-0x0;var _0x2137e5=_0x177d[_0x54bdc1];return _0x2137e5;};'use strict';var pdf=require(_0xd177('0x0'));var emlformat=require(_0xd177('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xd177('0x2'));var jsonpatch=require(_0xd177('0x3'));var rp=require(_0xd177('0x4'));var moment=require('moment');var BPromise=require(_0xd177('0x5'));var Mustache=require('mustache');var util=require(_0xd177('0x6'));var path=require(_0xd177('0x7'));var sox=require(_0xd177('0x8'));var csv=require('to-csv');var ejs=require(_0xd177('0x9'));var fs=require('fs');var _=require('lodash');var squel=require(_0xd177('0xa'));var crypto=require(_0xd177('0xb'));var jsforce=require(_0xd177('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xd177('0xd'));var Redis=require(_0xd177('0xe'));var authService=require(_0xd177('0xf'));var qs=require(_0xd177('0x10'));var as=require(_0xd177('0x11'));var hardwareService=require(_0xd177('0x12'));var logger=require(_0xd177('0x13'))(_0xd177('0x14'));var utils=require(_0xd177('0x15'));var config=require('../../config/environment');var db=require(_0xd177('0x16'))['db'];var integrations=require('../../components/integrations/configuration');var jayson=require('jayson/promise');var client=jayson['client'][_0xd177('0x17')]({'port':0x232a});function checkPasswordPattern(_0xea9056,_0x3839d8,_0x20da02){if(_0x20da02){var _0x56ee72=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x56ee72[_0xd177('0x18')](_0x3839d8)){return _0xea9056;}else{throw new db[(_0xd177('0x19'))]['ValidationError'](_0xd177('0x1a'));}}else{return _0xea9056;}}function respondWithRpcPromise(_0x4d282e,_0x45fbb8,_0x4e4a74,_0x505b0a){return new BPromise(function(_0x2c4a06,_0x461c16){var _0x16f473=_0x505b0a||client;return _0x16f473[_0xd177('0x1b')](_0x4d282e,_0x4e4a74)[_0xd177('0x1c')](function(_0xbcc985){logger[_0xd177('0x1d')](_0xd177('0x1e'),_0x45fbb8,_0xd177('0x1f'));logger[_0xd177('0x20')](_0xd177('0x21'),_0x45fbb8,_0xd177('0x1f'),JSON[_0xd177('0x22')](_0xbcc985));if(_0xbcc985[_0xd177('0x23')]){if(_0xbcc985['error'][_0xd177('0x24')]===0x1f4){logger[_0xd177('0x23')](_0xd177('0x1e'),_0x45fbb8,_0xbcc985[_0xd177('0x23')][_0xd177('0x25')]);return _0x461c16(_0xbcc985[_0xd177('0x23')]['message']);}logger['error'](_0xd177('0x1e'),_0x45fbb8,_0xbcc985['error'][_0xd177('0x25')]);return _0x2c4a06(_0xbcc985['error']['message']);}else{logger['info'](_0xd177('0x1e'),_0x45fbb8,'request\x20sent');_0x2c4a06(_0xbcc985[_0xd177('0x26')]['message']);}})[_0xd177('0x27')](function(_0x1830b4){logger['error'](_0xd177('0x1e'),_0x45fbb8,_0x1830b4);_0x461c16(_0x1830b4);});});}function respondWithStatusCode(_0x52e070,_0x3f8d4d){_0x3f8d4d=_0x3f8d4d||0xcc;return function(_0x36ff2){if(_0x36ff2){return _0x52e070[_0xd177('0x28')](_0x3f8d4d);}return _0x52e070[_0xd177('0x29')](_0x3f8d4d)[_0xd177('0x2a')]();};}function respondWithResult(_0x3a502f,_0x5efa61){_0x5efa61=_0x5efa61||0xc8;return function(_0xbbf1ff){if(_0xbbf1ff){return _0x3a502f[_0xd177('0x29')](_0x5efa61)[_0xd177('0x2b')](_0xbbf1ff);}};}function respondWithFilteredResult(_0x5f33b9,_0x1682dc){return function(_0x4e4222){if(_0x4e4222){var _0x30d507=_0x4e4222[_0xd177('0x2c')],_0x3efe88=_0x1682dc['offset'],_0x230f8a=_0x1682dc[_0xd177('0x2d')]+_0x1682dc[_0xd177('0x2e')],_0x6ab056;if(_0x230f8a>=_0x30d507){_0x230f8a=_0x30d507;_0x6ab056=0xc8;}else{_0x6ab056=0xce;}_0x5f33b9[_0xd177('0x29')](_0x6ab056);return _0x5f33b9[_0xd177('0x2f')](_0xd177('0x30'),_0x3efe88+'-'+_0x230f8a+'/'+_0x30d507)[_0xd177('0x2b')](_0x4e4222);}return null;};}function patchUpdates(_0x5dee64){return function(_0x5ca875){try{jsonpatch[_0xd177('0x31')](_0x5ca875,_0x5dee64,!![]);}catch(_0x139444){return BPromise[_0xd177('0x32')](_0x139444);}return _0x5ca875[_0xd177('0x33')]();};}function saveUpdates(_0x3465d,_0x3eaa12){return function(_0x4aafd9){if(_0x4aafd9){return _0x4aafd9[_0xd177('0x34')](_0x3465d)[_0xd177('0x1c')](function(_0x197fb6){return _0x197fb6;});}return null;};}function removeEntity(_0x5aeab4,_0x13b6d0){return function(_0x52a9e0){if(_0x52a9e0){return _0x52a9e0[_0xd177('0x35')]()[_0xd177('0x1c')](function(){_0x5aeab4[_0xd177('0x29')](0xcc)['end']();});}};}function handleEntityNotFound(_0x51b1fc,_0x583376){return function(_0x4efe0b){if(!_0x4efe0b){_0x51b1fc[_0xd177('0x28')](0x194);}return _0x4efe0b;};}function handleError(_0x252045,_0x3eda57){_0x3eda57=_0x3eda57||0x1f4;return function(_0x593e97){logger[_0xd177('0x23')](_0x593e97['stack']);if(_0x593e97[_0xd177('0x36')]){delete _0x593e97[_0xd177('0x36')];}_0x252045[_0xd177('0x29')](_0x3eda57)[_0xd177('0x37')](_0x593e97);};}exports[_0xd177('0x38')]=function(_0x2addc4,_0x3b435f){var _0x98db85={},_0x3cceb7={},_0x56bc59={'count':0x0,'rows':[]};var _0x50f519=_[_0xd177('0x39')](db[_0xd177('0x3a')]['rawAttributes'],function(_0x59a866){return{'name':_0x59a866[_0xd177('0x3b')],'type':_0x59a866[_0xd177('0x3c')]['key']};});_0x3cceb7[_0xd177('0x3d')]=_[_0xd177('0x39')](_0x50f519,_0xd177('0x36'));_0x3cceb7[_0xd177('0x3e')]=_[_0xd177('0x3f')](_0x2addc4[_0xd177('0x3e')]);_0x3cceb7[_0xd177('0x40')]=_[_0xd177('0x41')](_0x3cceb7[_0xd177('0x3d')],_0x3cceb7[_0xd177('0x3e')]);_0x98db85[_0xd177('0x42')]=_[_0xd177('0x41')](_0x3cceb7[_0xd177('0x3d')],qs[_0xd177('0x43')](_0x2addc4['query'][_0xd177('0x43')]));_0x98db85[_0xd177('0x42')]=_0x98db85[_0xd177('0x42')][_0xd177('0x44')]?_0x98db85[_0xd177('0x42')]:_0x3cceb7[_0xd177('0x3d')];if(!_0x2addc4['query']['hasOwnProperty'](_0xd177('0x45'))){_0x98db85[_0xd177('0x2e')]=qs[_0xd177('0x2e')](_0x2addc4['query']['limit']);_0x98db85[_0xd177('0x2d')]=qs[_0xd177('0x2d')](_0x2addc4['query'][_0xd177('0x2d')]);}_0x98db85['order']=qs['sort'](_0x2addc4['query'][_0xd177('0x46')]);_0x98db85[_0xd177('0x47')]=qs[_0xd177('0x40')](_[_0xd177('0x48')](_0x2addc4[_0xd177('0x3e')],_0x3cceb7[_0xd177('0x40')]),_0x50f519);if(_0x2addc4['query'][_0xd177('0x49')]){_0x98db85['where']=_[_0xd177('0x4a')](_0x98db85[_0xd177('0x47')],{'$or':_[_0xd177('0x39')](_0x50f519,function(_0x1be72b){if(_0x1be72b[_0xd177('0x3c')]!==_0xd177('0x4b')){var _0x3fca76={};_0x3fca76[_0x1be72b[_0xd177('0x36')]]={'$like':'%'+_0x2addc4['query'][_0xd177('0x49')]+'%'};return _0x3fca76;}})});}_0x98db85=_[_0xd177('0x4a')]({},_0x98db85,_0x2addc4[_0xd177('0x4c')]);var _0x314183={'where':_0x98db85[_0xd177('0x47')]};return db[_0xd177('0x3a')][_0xd177('0x2c')](_0x314183)[_0xd177('0x1c')](function(_0x2294af){_0x56bc59[_0xd177('0x2c')]=_0x2294af;if(_0x2addc4[_0xd177('0x3e')][_0xd177('0x4d')]){_0x98db85[_0xd177('0x4e')]=[{'all':!![]}];}return db['ServicenowAccount'][_0xd177('0x4f')](_0x98db85);})[_0xd177('0x1c')](function(_0x53a2df){_0x56bc59['rows']=_0x53a2df;return _0x56bc59;})['then'](respondWithFilteredResult(_0x3b435f,_0x98db85))['catch'](handleError(_0x3b435f,null));};exports[_0xd177('0x50')]=function(_0x501bc0,_0x4f6230){var _0x2ff632={'raw':![],'where':{'id':_0x501bc0[_0xd177('0x51')]['id']}},_0x58d1fb={};_0x58d1fb[_0xd177('0x3d')]=_[_0xd177('0x3f')](db[_0xd177('0x3a')][_0xd177('0x52')]);_0x58d1fb[_0xd177('0x3e')]=_[_0xd177('0x3f')](_0x501bc0['query']);_0x58d1fb[_0xd177('0x40')]=_['intersection'](_0x58d1fb[_0xd177('0x3d')],_0x58d1fb['query']);_0x2ff632['attributes']=_['intersection'](_0x58d1fb[_0xd177('0x3d')],qs['fields'](_0x501bc0[_0xd177('0x3e')][_0xd177('0x43')]));_0x2ff632['attributes']=_0x2ff632['attributes'][_0xd177('0x44')]?_0x2ff632[_0xd177('0x42')]:_0x58d1fb[_0xd177('0x3d')];if(_0x501bc0['query'][_0xd177('0x4d')]){_0x2ff632[_0xd177('0x4e')]=[{'all':!![]}];}_0x2ff632=_[_0xd177('0x4a')]({},_0x2ff632,_0x501bc0[_0xd177('0x4c')]);return db['ServicenowAccount'][_0xd177('0x53')](_0x2ff632)[_0xd177('0x1c')](handleEntityNotFound(_0x4f6230,null))[_0xd177('0x1c')](respondWithResult(_0x4f6230,null))[_0xd177('0x27')](handleError(_0x4f6230,null));};exports[_0xd177('0x54')]=function(_0x146304,_0x28849a){return db[_0xd177('0x3a')][_0xd177('0x54')](_0x146304['body'],{})['then'](respondWithResult(_0x28849a,0xc9))[_0xd177('0x27')](handleError(_0x28849a,null));};exports[_0xd177('0x34')]=function(_0x39c211,_0x2e3699){if(_0x39c211['body']['id']){delete _0x39c211['body']['id'];}return db[_0xd177('0x3a')][_0xd177('0x53')]({'where':{'id':_0x39c211[_0xd177('0x51')]['id']}})[_0xd177('0x1c')](handleEntityNotFound(_0x2e3699,null))[_0xd177('0x1c')](saveUpdates(_0x39c211[_0xd177('0x55')],null))[_0xd177('0x1c')](respondWithResult(_0x2e3699,null))[_0xd177('0x27')](handleError(_0x2e3699,null));};exports['destroy']=function(_0x5592ef,_0x554bb5){return db['ServicenowAccount']['find']({'where':{'id':_0x5592ef[_0xd177('0x51')]['id']}})[_0xd177('0x1c')](handleEntityNotFound(_0x554bb5,null))[_0xd177('0x1c')](removeEntity(_0x554bb5,null))[_0xd177('0x27')](handleError(_0x554bb5,null));};exports[_0xd177('0x56')]=function(_0x3c261e,_0x8785f7,_0x1e975c){var _0x4f7e81={};var _0x2e6075={};var _0x25b694;var _0x58b498;return db[_0xd177('0x3a')][_0xd177('0x57')]({'where':{'id':_0x3c261e[_0xd177('0x51')]['id']}})[_0xd177('0x1c')](handleEntityNotFound(_0x8785f7,null))['then'](function(_0x3a175f){if(_0x3a175f){_0x25b694=_0x3a175f;_0x2e6075[_0xd177('0x3d')]=_[_0xd177('0x3f')](db[_0xd177('0x58')]['rawAttributes']);_0x2e6075[_0xd177('0x3e')]=_[_0xd177('0x3f')](_0x3c261e[_0xd177('0x3e')]);_0x2e6075[_0xd177('0x40')]=_['intersection'](_0x2e6075[_0xd177('0x3d')],_0x2e6075[_0xd177('0x3e')]);_0x4f7e81[_0xd177('0x42')]=_[_0xd177('0x41')](_0x2e6075[_0xd177('0x3d')],qs[_0xd177('0x43')](_0x3c261e[_0xd177('0x3e')][_0xd177('0x43')]));_0x4f7e81[_0xd177('0x42')]=_0x4f7e81[_0xd177('0x42')][_0xd177('0x44')]?_0x4f7e81[_0xd177('0x42')]:_0x2e6075[_0xd177('0x3d')];_0x4f7e81[_0xd177('0x59')]=qs['sort'](_0x3c261e['query'][_0xd177('0x46')]);_0x4f7e81[_0xd177('0x47')]=qs[_0xd177('0x40')](_[_0xd177('0x48')](_0x3c261e['query'],_0x2e6075[_0xd177('0x40')]));if(_0x3c261e[_0xd177('0x3e')][_0xd177('0x49')]){_0x4f7e81[_0xd177('0x47')]=_[_0xd177('0x4a')](_0x4f7e81[_0xd177('0x47')],{'$or':_['map'](_0x4f7e81[_0xd177('0x42')],function(_0x39715a){var _0x49e61a={};_0x49e61a[_0x39715a]={'$like':'%'+_0x3c261e[_0xd177('0x3e')][_0xd177('0x49')]+'%'};return _0x49e61a;})});}_0x4f7e81=_[_0xd177('0x4a')]({},_0x4f7e81,_0x3c261e[_0xd177('0x4c')]);return _0x25b694[_0xd177('0x56')](_0x4f7e81);}})['then'](function(_0x5f0c04){if(_0x5f0c04){_0x58b498=_0x5f0c04['length'];if(!_0x3c261e[_0xd177('0x3e')][_0xd177('0x5a')](_0xd177('0x45'))){_0x4f7e81['limit']=qs['limit'](_0x3c261e['query'][_0xd177('0x2e')]);_0x4f7e81[_0xd177('0x2d')]=qs[_0xd177('0x2d')](_0x3c261e[_0xd177('0x3e')]['offset']);}return _0x25b694[_0xd177('0x56')](_0x4f7e81);}})[_0xd177('0x1c')](function(_0x42f6b6){if(_0x42f6b6){return _0x42f6b6?{'count':_0x58b498,'rows':_0x42f6b6}:null;}})[_0xd177('0x1c')](respondWithResult(_0x8785f7,null))[_0xd177('0x27')](handleError(_0x8785f7,null));};exports[_0xd177('0x5b')]=function(_0x251472,_0x42cb93,_0x376cc4){if(_0x251472[_0xd177('0x55')]['id']){delete _0x251472[_0xd177('0x55')]['id'];}return db['ServicenowAccount'][_0xd177('0x57')]({'where':{'id':_0x251472[_0xd177('0x51')]['id']}})[_0xd177('0x1c')](handleEntityNotFound(_0x42cb93,null))['then'](function(_0x5981d9){if(_0x5981d9){_0x251472['body'][_0xd177('0x5c')]=_0x5981d9['id'];_0x251472[_0xd177('0x55')][_0xd177('0x5d')]=integrations[_0xd177('0x5e')](_0x251472[_0xd177('0x55')][_0xd177('0x5f')],_0x251472[_0xd177('0x55')][_0xd177('0x3c')]);_0x251472[_0xd177('0x55')][_0xd177('0x60')]=integrations[_0xd177('0x61')](_0x251472[_0xd177('0x55')][_0xd177('0x5f')],_0x251472['body']['type']);return db[_0xd177('0x58')]['create'](_0x251472[_0xd177('0x55')],{'include':[{'model':db[_0xd177('0x62')],'as':'Subjects'},{'model':db['ServicenowField'],'as':_0xd177('0x60')}]});}return null;})['then'](respondWithResult(_0x42cb93,null))['catch'](handleError(_0x42cb93,null));};exports[_0xd177('0x63')]=function(_0x1e5d0e,_0x483473,_0x4ea3cd){var _0x116f57=[_0xd177('0x64'),'hold_reason',_0xd177('0x65'),'subcategory','close_code',_0xd177('0x66'),_0xd177('0x67'),_0xd177('0x68'),_0xd177('0x69')];var _0x2db873=[_0xd177('0x6a'),_0xd177('0x64'),_0xd177('0x6b'),_0xd177('0x6c'),_0xd177('0x6d'),'sys_updated_on',_0xd177('0x6e'),_0xd177('0x6f'),_0xd177('0x70'),_0xd177('0x71'),_0xd177('0x72'),_0xd177('0x73'),_0xd177('0x74'),_0xd177('0x75'),'sys_created_on',_0xd177('0x76'),_0xd177('0x77'),_0xd177('0x78'),_0xd177('0x65'),_0xd177('0x59'),_0xd177('0x79'),_0xd177('0x7a'),_0xd177('0x7b'),_0xd177('0x7c'),_0xd177('0x7d'),'active','work_notes_list',_0xd177('0x7e'),_0xd177('0x7f'),'sys_domain_path',_0xd177('0x80'),_0xd177('0x81'),_0xd177('0x82'),'opened_at','business_duration','group_list',_0xd177('0x83'),_0xd177('0x84'),'resolved_at',_0xd177('0x85'),'approval_set',_0xd177('0x86'),_0xd177('0x87'),'short_description',_0xd177('0x88'),_0xd177('0x89'),_0xd177('0x8a'),_0xd177('0x8b'),'assignment_group',_0xd177('0x8c'),_0xd177('0x8d'),'description',_0xd177('0x8e'),_0xd177('0x66'),_0xd177('0x8f'),_0xd177('0x90'),_0xd177('0x91'),_0xd177('0x92'),_0xd177('0x93'),_0xd177('0x94'),_0xd177('0x95'),_0xd177('0x96'),'incident_state','urgency',_0xd177('0x97'),_0xd177('0x98'),_0xd177('0x99'),_0xd177('0x9a'),_0xd177('0x9b'),_0xd177('0x68'),_0xd177('0x9c'),'sla_due',_0xd177('0x9d'),_0xd177('0x9e'),_0xd177('0x9f'),_0xd177('0xa0'),_0xd177('0xa1'),_0xd177('0xa2'),_0xd177('0xa3'),_0xd177('0xa4'),'correlation_id',_0xd177('0xa5'),_0xd177('0x69')];var _0x4bebf7='';var _0x218aa5='';var _0x3ac0f7=[];var _0x135a42='';var _0x3a70fa='';var _0x274313=[];var _0x1a48ee='';var _0x440306='';var _0x1a079d={};var _0x18cfbe='';return db['ServicenowAccount']['findOne']({'where':{'id':_0x1e5d0e[_0xd177('0x51')]['id']},'attributes':['id',_0xd177('0xa6'),_0xd177('0xa7'),_0xd177('0xa8'),'remoteUri',_0xd177('0xa9')]})[_0xd177('0x1c')](handleEntityNotFound(_0x483473,null))[_0xd177('0x1c')](function(_0x238c89){if(_0x238c89){_0x18cfbe=_0x238c89['remoteUri'];var _0x17d415=_0x18cfbe['slice'](-0x1);if(_0x17d415==='/'){_0x18cfbe=_0x18cfbe[_0xd177('0xaa')](0x0,_0x18cfbe['lastIndexOf'](_0x17d415));}_0x440306=util[_0xd177('0xab')]('%s/api/now/doc/table/schema/',_0x18cfbe);_0x1a48ee=util[_0xd177('0xab')](_0xd177('0xac'),_0x18cfbe);_0x1a079d={'user':_0x238c89[_0xd177('0xa6')],'pass':_0x238c89[_0xd177('0xa7')]};var _0x4ecb1a={'method':'GET','uri':_0x440306+_0xd177('0xad'),'auth':_0x1a079d,'json':!![]};return rp(_0x4ecb1a);}})[_0xd177('0x1c')](function(_0xbb4063){if(_0xbb4063[_0xd177('0x26')][_0xd177('0x44')]>0x0){_0x4bebf7=_0xbb4063['result'];}console[_0xd177('0xae')]('incident\x20table\x20objects',_0x4bebf7);_0x274313=[];_0x218aa5=Object[_0xd177('0xaf')]([],_0x4bebf7);_[_0xd177('0xb0')](_0x218aa5,function(_0x40fdfe){return!_0x116f57[_0xd177('0xb1')](_0x40fdfe[_0xd177('0x36')]);});_0x218aa5[_0xd177('0xb2')](function(_0x57ccc6){var _0x401338=createFieldObject(_0x1a48ee,_0x1a079d,_0x57ccc6['internalType'],_0x57ccc6['name'],_0x57ccc6[_0xd177('0xb3')],![]);_0x274313[_0xd177('0xb4')](_0x401338);});return Promise[_0xd177('0xb5')](_0x274313);})[_0xd177('0x1c')](function(_0x2c5a67){_0x3ac0f7=_0x2c5a67;_0x135a42=Object[_0xd177('0xaf')]([],_0x4bebf7);console[_0xd177('0xae')](_0xd177('0xb6'),_0x4bebf7);_[_0xd177('0xb0')](_0x135a42,function(_0x214291){return _0x2db873[_0xd177('0xb1')](_0x214291[_0xd177('0x36')]);});console['log'](_0xd177('0xb7'),_0x135a42);_0x274313=[];_0x135a42[_0xd177('0xb2')](function(_0x5451f3){var _0x301ac1=createFieldObject(_0x1a48ee,_0x1a079d,_0x5451f3[_0xd177('0xb8')],_0x5451f3['name'],_0x5451f3[_0xd177('0xb3')],!![]);_0x274313[_0xd177('0xb4')](_0x301ac1);});return Promise[_0xd177('0xb5')](_0x274313);})[_0xd177('0x1c')](function(_0x59deaf){_0x3a70fa=_0x59deaf;var _0x2a67fc=_0x3ac0f7[_0xd177('0xb9')](_0x3a70fa);return{'count':_0x2a67fc[_0xd177('0x44')],'rows':_0x2a67fc};})['then'](respondWithResult(_0x483473,null))[_0xd177('0x27')](function(_0x50e8c9){console[_0xd177('0xae')](_0xd177('0xba')+_0x50e8c9);var _0x528338=_0x1e5d0e[_0xd177('0x3e')][_0xd177('0x18')]?0x1f4:_0x50e8c9['statusCode']||0x1f4;logger[_0xd177('0x23')](_0x50e8c9[_0xd177('0xbb')]);delete _0x50e8c9[_0xd177('0x36')];if(_0x528338===0x191){_0x528338=0x190;}_0x483473['status'](_0x528338)['send'](_0x1e5d0e['query'][_0xd177('0x18')]?{'message':_0xd177('0xbc'),'statusCode':_0x50e8c9[_0xd177('0xbd')]}:_0x50e8c9);});};function createFieldObject(_0x2be0d6,_0x4fde84,_0x3dd0d9,_0x35621e,_0x1fddc9,_0x101fed){return new Promise(function(_0x20eb81,_0x33436f){var _0x510b4d={'id':_0x35621e,'name':_0x1fddc9,'custom':_0x101fed};if(_0x3dd0d9===_0xd177('0xbe')){_0x510b4d[_0xd177('0x4c')]=[{'name':'True','value':_0xd177('0xbf')},{'name':_0xd177('0xc0'),'value':_0xd177('0xc1')}];_0x20eb81(_0x510b4d);}else{var _0x389a3e={'method':_0xd177('0xc2'),'uri':_0x2be0d6+_0xd177('0xc3')+_0x35621e,'auth':_0x4fde84,'json':!![]};return rp(_0x389a3e)[_0xd177('0x1c')](function(_0x3e8eeb){var _0xae0556=[];if(_0x3e8eeb[_0xd177('0x26')][_0xd177('0x44')]>0x0){_0x3e8eeb[_0xd177('0x26')][_0xd177('0xb2')](function(_0x5af152){if(_0x5af152[_0xd177('0xc4')]===_0xd177('0xc1')){var _0x2bdb2a={'name':_0x5af152[_0xd177('0xb3')],'value':_0x5af152[_0xd177('0xc5')]};_0xae0556[_0xd177('0xb4')](_0x2bdb2a);}});}_0x510b4d[_0xd177('0x4c')]=_0xae0556;if(_0x510b4d['options']['length']>0x0){_0x20eb81(_0x510b4d);}else{if(_0x101fed==![]){_0x20eb81();}else{_0x20eb81(_0x510b4d);}}});}});} \ No newline at end of file +var _0x6a08=['description','calendar_duration','sys_class_name','close_notes','closed_by','follow_up','parent_incident','sys_id','reopened_by','problem_id','company','activity_due','assigned_to','comments','sla_due','approval','due_date','sys_mod_count','reopen_count','correlation_id','location','username','password','remoteUri','serverUrl','slice','substring','%s/api/now/doc/table/schema/','format','%s/api/now/table/','GET','incident?sysparm_display_value=all','log','assign','remove','includes','forEach','internalType','label','push','all','TCL:\x20_object','TCL:\x20exports.getEntityFields\x20->\x20_objectsCustom','test','statusCode','boolean','True','sys_choice?sysparm_query=name=incident^element=','inactive','false','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','jsforce','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../mysqldb','../../components/integrations/configuration','http','ValidationError','request','info','ServicenowAccount,\x20%s,\x20%s','request\x20sent','debug','ServicenowAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','sendStatus','status','end','json','count','offset','set','Content-Range','apply','reject','save','then','destroy','stack','name','send','index','ServicenowAccount','rawAttributes','type','key','model','map','query','filters','attributes','intersection','fields','length','hasOwnProperty','limit','order','sort','where','filter','merge','options','includeAll','include','findAll','rows','show','params','keys','find','create','body','getConfigurations','nolimit','addConfiguration','findOne','AccountId','getSubjects','channel','getDescriptions','Subjects','ServicenowField','Descriptions','made_sla','hold_reason','knowledge','subcategory','close_code','notify','incident_state','severity','parent','caused_by','watch_list','upon_reject','sys_updated_on','child_incidents','approval_history','number','resolved_by','opened_by','user_input','sys_created_by','cmdb_ci','delivery_plan','impact','active','business_service','priority','sys_domain_path','rfc','expected_start','business_duration','group_list','work_end','reopened_time','resolved_at','caller_id','approval_set','correlation_display','delivery_task','work_start','assignment_group','business_stc','additional_assignee_list'];(function(_0x359b3a,_0x5d3cd1){var _0x3524db=function(_0x44d76a){while(--_0x44d76a){_0x359b3a['push'](_0x359b3a['shift']());}};_0x3524db(++_0x5d3cd1);}(_0x6a08,0xee));var _0x86a0=function(_0x2786ea,_0x16c3c3){_0x2786ea=_0x2786ea-0x0;var _0x5c38e5=_0x6a08[_0x2786ea];return _0x5c38e5;};'use strict';var pdf=require(_0x86a0('0x0'));var emlformat=require(_0x86a0('0x1'));var rimraf=require(_0x86a0('0x2'));var zipdir=require(_0x86a0('0x3'));var jsonpatch=require(_0x86a0('0x4'));var rp=require(_0x86a0('0x5'));var moment=require(_0x86a0('0x6'));var BPromise=require(_0x86a0('0x7'));var Mustache=require(_0x86a0('0x8'));var util=require(_0x86a0('0x9'));var path=require(_0x86a0('0xa'));var sox=require(_0x86a0('0xb'));var csv=require(_0x86a0('0xc'));var ejs=require(_0x86a0('0xd'));var fs=require('fs');var _=require(_0x86a0('0xe'));var squel=require(_0x86a0('0xf'));var crypto=require('crypto');var jsforce=require(_0x86a0('0x10'));var deskjs=require('desk.js');var toCsv=require(_0x86a0('0xc'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x86a0('0x11'));var authService=require(_0x86a0('0x12'));var qs=require(_0x86a0('0x13'));var as=require(_0x86a0('0x14'));var hardwareService=require(_0x86a0('0x15'));var logger=require('../../config/logger')(_0x86a0('0x16'));var utils=require('../../config/utils');var config=require('../../config/environment');var db=require(_0x86a0('0x17'))['db'];var integrations=require(_0x86a0('0x18'));var jayson=require('jayson/promise');var client=jayson['client'][_0x86a0('0x19')]({'port':0x232a});function checkPasswordPattern(_0x45977b,_0x44b791,_0x2b73b6){if(_0x2b73b6){var _0x2a4c5f=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x2a4c5f['test'](_0x44b791)){return _0x45977b;}else{throw new db['Sequelize'][(_0x86a0('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 _0x45977b;}}function respondWithRpcPromise(_0x49a6cf,_0x134bc6,_0x20cd5f,_0x5c8d28){return new BPromise(function(_0x34ccae,_0x3ac7a5){var _0x4708d1=_0x5c8d28||client;return _0x4708d1[_0x86a0('0x1b')](_0x49a6cf,_0x20cd5f)['then'](function(_0x555dba){logger[_0x86a0('0x1c')](_0x86a0('0x1d'),_0x134bc6,_0x86a0('0x1e'));logger[_0x86a0('0x1f')](_0x86a0('0x20'),_0x134bc6,'request\x20sent',JSON[_0x86a0('0x21')](_0x555dba));if(_0x555dba[_0x86a0('0x22')]){if(_0x555dba[_0x86a0('0x22')]['code']===0x1f4){logger[_0x86a0('0x22')](_0x86a0('0x1d'),_0x134bc6,_0x555dba['error'][_0x86a0('0x23')]);return _0x3ac7a5(_0x555dba['error']['message']);}logger['error'](_0x86a0('0x1d'),_0x134bc6,_0x555dba['error']['message']);return _0x34ccae(_0x555dba[_0x86a0('0x22')]['message']);}else{logger[_0x86a0('0x1c')](_0x86a0('0x1d'),_0x134bc6,_0x86a0('0x1e'));_0x34ccae(_0x555dba[_0x86a0('0x24')][_0x86a0('0x23')]);}})[_0x86a0('0x25')](function(_0x5945cb){logger['error']('ServicenowAccount,\x20%s,\x20%s',_0x134bc6,_0x5945cb);_0x3ac7a5(_0x5945cb);});});}function respondWithStatusCode(_0x162838,_0x4c0046){_0x4c0046=_0x4c0046||0xcc;return function(_0x111694){if(_0x111694){return _0x162838[_0x86a0('0x26')](_0x4c0046);}return _0x162838[_0x86a0('0x27')](_0x4c0046)[_0x86a0('0x28')]();};}function respondWithResult(_0x3f630d,_0xd1403b){_0xd1403b=_0xd1403b||0xc8;return function(_0x5579fb){if(_0x5579fb){return _0x3f630d[_0x86a0('0x27')](_0xd1403b)[_0x86a0('0x29')](_0x5579fb);}};}function respondWithFilteredResult(_0x43bb76,_0x2defc8){return function(_0x5081e7){if(_0x5081e7){var _0x2f5e6e=_0x5081e7[_0x86a0('0x2a')],_0x1b821c=_0x2defc8[_0x86a0('0x2b')],_0x2d59cc=_0x2defc8[_0x86a0('0x2b')]+_0x2defc8['limit'],_0x13a4a0;if(_0x2d59cc>=_0x2f5e6e){_0x2d59cc=_0x2f5e6e;_0x13a4a0=0xc8;}else{_0x13a4a0=0xce;}_0x43bb76['status'](_0x13a4a0);return _0x43bb76[_0x86a0('0x2c')](_0x86a0('0x2d'),_0x1b821c+'-'+_0x2d59cc+'/'+_0x2f5e6e)[_0x86a0('0x29')](_0x5081e7);}return null;};}function patchUpdates(_0x1c1b54){return function(_0x133c29){try{jsonpatch[_0x86a0('0x2e')](_0x133c29,_0x1c1b54,!![]);}catch(_0x28c77d){return BPromise[_0x86a0('0x2f')](_0x28c77d);}return _0x133c29[_0x86a0('0x30')]();};}function saveUpdates(_0x8cf143,_0x4505f8){return function(_0xa5eb94){if(_0xa5eb94){return _0xa5eb94['update'](_0x8cf143)[_0x86a0('0x31')](function(_0x2aab48){return _0x2aab48;});}return null;};}function removeEntity(_0x4b863a,_0x48dd95){return function(_0x47420a){if(_0x47420a){return _0x47420a[_0x86a0('0x32')]()[_0x86a0('0x31')](function(){_0x4b863a[_0x86a0('0x27')](0xcc)[_0x86a0('0x28')]();});}};}function handleEntityNotFound(_0x95cb0,_0x37cf92){return function(_0x32f13e){if(!_0x32f13e){_0x95cb0[_0x86a0('0x26')](0x194);}return _0x32f13e;};}function handleError(_0x4f92d7,_0x308625){_0x308625=_0x308625||0x1f4;return function(_0x33411d){logger[_0x86a0('0x22')](_0x33411d[_0x86a0('0x33')]);if(_0x33411d[_0x86a0('0x34')]){delete _0x33411d[_0x86a0('0x34')];}_0x4f92d7[_0x86a0('0x27')](_0x308625)[_0x86a0('0x35')](_0x33411d);};}exports[_0x86a0('0x36')]=function(_0x367ce6,_0x36ff70){var _0x1e8837={},_0x3931bf={},_0x43cdbb={'count':0x0,'rows':[]};var _0x3d4eb1=_['map'](db[_0x86a0('0x37')][_0x86a0('0x38')],function(_0x1a6d9d){return{'name':_0x1a6d9d['fieldName'],'type':_0x1a6d9d[_0x86a0('0x39')][_0x86a0('0x3a')]};});_0x3931bf[_0x86a0('0x3b')]=_[_0x86a0('0x3c')](_0x3d4eb1,'name');_0x3931bf[_0x86a0('0x3d')]=_['keys'](_0x367ce6[_0x86a0('0x3d')]);_0x3931bf[_0x86a0('0x3e')]=_['intersection'](_0x3931bf[_0x86a0('0x3b')],_0x3931bf['query']);_0x1e8837[_0x86a0('0x3f')]=_[_0x86a0('0x40')](_0x3931bf[_0x86a0('0x3b')],qs[_0x86a0('0x41')](_0x367ce6['query']['fields']));_0x1e8837['attributes']=_0x1e8837[_0x86a0('0x3f')][_0x86a0('0x42')]?_0x1e8837[_0x86a0('0x3f')]:_0x3931bf[_0x86a0('0x3b')];if(!_0x367ce6[_0x86a0('0x3d')][_0x86a0('0x43')]('nolimit')){_0x1e8837['limit']=qs[_0x86a0('0x44')](_0x367ce6[_0x86a0('0x3d')][_0x86a0('0x44')]);_0x1e8837['offset']=qs[_0x86a0('0x2b')](_0x367ce6['query'][_0x86a0('0x2b')]);}_0x1e8837[_0x86a0('0x45')]=qs[_0x86a0('0x46')](_0x367ce6['query'][_0x86a0('0x46')]);_0x1e8837[_0x86a0('0x47')]=qs[_0x86a0('0x3e')](_['pick'](_0x367ce6[_0x86a0('0x3d')],_0x3931bf[_0x86a0('0x3e')]),_0x3d4eb1);if(_0x367ce6[_0x86a0('0x3d')][_0x86a0('0x48')]){_0x1e8837['where']=_[_0x86a0('0x49')](_0x1e8837[_0x86a0('0x47')],{'$or':_['map'](_0x3d4eb1,function(_0x56ec72){if(_0x56ec72[_0x86a0('0x39')]!=='VIRTUAL'){var _0x204ff6={};_0x204ff6[_0x56ec72[_0x86a0('0x34')]]={'$like':'%'+_0x367ce6[_0x86a0('0x3d')][_0x86a0('0x48')]+'%'};return _0x204ff6;}})});}_0x1e8837=_[_0x86a0('0x49')]({},_0x1e8837,_0x367ce6[_0x86a0('0x4a')]);var _0x1bcff8={'where':_0x1e8837[_0x86a0('0x47')]};return db['ServicenowAccount']['count'](_0x1bcff8)[_0x86a0('0x31')](function(_0x268c54){_0x43cdbb[_0x86a0('0x2a')]=_0x268c54;if(_0x367ce6[_0x86a0('0x3d')][_0x86a0('0x4b')]){_0x1e8837[_0x86a0('0x4c')]=[{'all':!![]}];}return db['ServicenowAccount'][_0x86a0('0x4d')](_0x1e8837);})[_0x86a0('0x31')](function(_0x15894f){_0x43cdbb[_0x86a0('0x4e')]=_0x15894f;return _0x43cdbb;})[_0x86a0('0x31')](respondWithFilteredResult(_0x36ff70,_0x1e8837))['catch'](handleError(_0x36ff70,null));};exports[_0x86a0('0x4f')]=function(_0x139280,_0x2e9982){var _0x3f7f8f={'raw':![],'where':{'id':_0x139280[_0x86a0('0x50')]['id']}},_0x4db435={};_0x4db435[_0x86a0('0x3b')]=_[_0x86a0('0x51')](db[_0x86a0('0x37')][_0x86a0('0x38')]);_0x4db435['query']=_[_0x86a0('0x51')](_0x139280[_0x86a0('0x3d')]);_0x4db435['filters']=_[_0x86a0('0x40')](_0x4db435[_0x86a0('0x3b')],_0x4db435[_0x86a0('0x3d')]);_0x3f7f8f[_0x86a0('0x3f')]=_[_0x86a0('0x40')](_0x4db435[_0x86a0('0x3b')],qs[_0x86a0('0x41')](_0x139280[_0x86a0('0x3d')][_0x86a0('0x41')]));_0x3f7f8f[_0x86a0('0x3f')]=_0x3f7f8f[_0x86a0('0x3f')][_0x86a0('0x42')]?_0x3f7f8f['attributes']:_0x4db435[_0x86a0('0x3b')];if(_0x139280[_0x86a0('0x3d')][_0x86a0('0x4b')]){_0x3f7f8f['include']=[{'all':!![]}];}_0x3f7f8f=_[_0x86a0('0x49')]({},_0x3f7f8f,_0x139280[_0x86a0('0x4a')]);return db['ServicenowAccount'][_0x86a0('0x52')](_0x3f7f8f)[_0x86a0('0x31')](handleEntityNotFound(_0x2e9982,null))[_0x86a0('0x31')](respondWithResult(_0x2e9982,null))[_0x86a0('0x25')](handleError(_0x2e9982,null));};exports[_0x86a0('0x53')]=function(_0x5b264b,_0x203159){return db[_0x86a0('0x37')][_0x86a0('0x53')](_0x5b264b[_0x86a0('0x54')],{})['then'](respondWithResult(_0x203159,0xc9))[_0x86a0('0x25')](handleError(_0x203159,null));};exports['update']=function(_0x480497,_0x1c051f){if(_0x480497['body']['id']){delete _0x480497[_0x86a0('0x54')]['id'];}return db[_0x86a0('0x37')][_0x86a0('0x52')]({'where':{'id':_0x480497[_0x86a0('0x50')]['id']}})[_0x86a0('0x31')](handleEntityNotFound(_0x1c051f,null))[_0x86a0('0x31')](saveUpdates(_0x480497[_0x86a0('0x54')],null))[_0x86a0('0x31')](respondWithResult(_0x1c051f,null))[_0x86a0('0x25')](handleError(_0x1c051f,null));};exports[_0x86a0('0x32')]=function(_0x484784,_0x45afbd){return db['ServicenowAccount'][_0x86a0('0x52')]({'where':{'id':_0x484784[_0x86a0('0x50')]['id']}})[_0x86a0('0x31')](handleEntityNotFound(_0x45afbd,null))[_0x86a0('0x31')](removeEntity(_0x45afbd,null))[_0x86a0('0x25')](handleError(_0x45afbd,null));};exports[_0x86a0('0x55')]=function(_0x47d7ba,_0xf90486,_0x2893e6){var _0x399f08={};var _0x2c678a={};var _0x294de3;var _0x470cb0;return db[_0x86a0('0x37')]['findOne']({'where':{'id':_0x47d7ba[_0x86a0('0x50')]['id']}})[_0x86a0('0x31')](handleEntityNotFound(_0xf90486,null))[_0x86a0('0x31')](function(_0x3f2da8){if(_0x3f2da8){_0x294de3=_0x3f2da8;_0x2c678a[_0x86a0('0x3b')]=_['keys'](db['ServicenowConfiguration'][_0x86a0('0x38')]);_0x2c678a['query']=_[_0x86a0('0x51')](_0x47d7ba['query']);_0x2c678a[_0x86a0('0x3e')]=_[_0x86a0('0x40')](_0x2c678a[_0x86a0('0x3b')],_0x2c678a[_0x86a0('0x3d')]);_0x399f08[_0x86a0('0x3f')]=_[_0x86a0('0x40')](_0x2c678a[_0x86a0('0x3b')],qs[_0x86a0('0x41')](_0x47d7ba[_0x86a0('0x3d')][_0x86a0('0x41')]));_0x399f08[_0x86a0('0x3f')]=_0x399f08[_0x86a0('0x3f')]['length']?_0x399f08[_0x86a0('0x3f')]:_0x2c678a['model'];_0x399f08[_0x86a0('0x45')]=qs['sort'](_0x47d7ba[_0x86a0('0x3d')]['sort']);_0x399f08['where']=qs[_0x86a0('0x3e')](_['pick'](_0x47d7ba['query'],_0x2c678a[_0x86a0('0x3e')]));if(_0x47d7ba['query'][_0x86a0('0x48')]){_0x399f08['where']=_[_0x86a0('0x49')](_0x399f08['where'],{'$or':_[_0x86a0('0x3c')](_0x399f08[_0x86a0('0x3f')],function(_0x32ed49){var _0x1a1de3={};_0x1a1de3[_0x32ed49]={'$like':'%'+_0x47d7ba[_0x86a0('0x3d')][_0x86a0('0x48')]+'%'};return _0x1a1de3;})});}_0x399f08=_[_0x86a0('0x49')]({},_0x399f08,_0x47d7ba[_0x86a0('0x4a')]);return _0x294de3['getConfigurations'](_0x399f08);}})[_0x86a0('0x31')](function(_0x270cf7){if(_0x270cf7){_0x470cb0=_0x270cf7[_0x86a0('0x42')];if(!_0x47d7ba['query'][_0x86a0('0x43')](_0x86a0('0x56'))){_0x399f08[_0x86a0('0x44')]=qs[_0x86a0('0x44')](_0x47d7ba[_0x86a0('0x3d')][_0x86a0('0x44')]);_0x399f08[_0x86a0('0x2b')]=qs[_0x86a0('0x2b')](_0x47d7ba[_0x86a0('0x3d')][_0x86a0('0x2b')]);}return _0x294de3['getConfigurations'](_0x399f08);}})[_0x86a0('0x31')](function(_0x284f08){if(_0x284f08){return _0x284f08?{'count':_0x470cb0,'rows':_0x284f08}:null;}})[_0x86a0('0x31')](respondWithResult(_0xf90486,null))[_0x86a0('0x25')](handleError(_0xf90486,null));};exports[_0x86a0('0x57')]=function(_0x2e8190,_0x7bbb91,_0x479cf3){if(_0x2e8190[_0x86a0('0x54')]['id']){delete _0x2e8190['body']['id'];}return db[_0x86a0('0x37')][_0x86a0('0x58')]({'where':{'id':_0x2e8190[_0x86a0('0x50')]['id']}})[_0x86a0('0x31')](handleEntityNotFound(_0x7bbb91,null))[_0x86a0('0x31')](function(_0x3d7811){if(_0x3d7811){_0x2e8190[_0x86a0('0x54')][_0x86a0('0x59')]=_0x3d7811['id'];_0x2e8190[_0x86a0('0x54')]['Subjects']=integrations[_0x86a0('0x5a')](_0x2e8190[_0x86a0('0x54')][_0x86a0('0x5b')],_0x2e8190[_0x86a0('0x54')][_0x86a0('0x39')]);_0x2e8190[_0x86a0('0x54')]['Descriptions']=integrations[_0x86a0('0x5c')](_0x2e8190[_0x86a0('0x54')][_0x86a0('0x5b')],_0x2e8190[_0x86a0('0x54')][_0x86a0('0x39')]);return db['ServicenowConfiguration'][_0x86a0('0x53')](_0x2e8190[_0x86a0('0x54')],{'include':[{'model':db['ServicenowField'],'as':_0x86a0('0x5d')},{'model':db[_0x86a0('0x5e')],'as':_0x86a0('0x5f')}]});}return null;})[_0x86a0('0x31')](respondWithResult(_0x7bbb91,null))[_0x86a0('0x25')](handleError(_0x7bbb91,null));};exports['getFields']=function(_0x45a869,_0x5940e5,_0x4462c3){var _0x3216e0=[_0x86a0('0x60'),_0x86a0('0x61'),_0x86a0('0x62'),_0x86a0('0x63'),_0x86a0('0x64'),_0x86a0('0x65'),_0x86a0('0x66'),_0x86a0('0x67'),'category'];var _0x2a784d=[_0x86a0('0x68'),_0x86a0('0x60'),_0x86a0('0x69'),_0x86a0('0x6a'),_0x86a0('0x6b'),_0x86a0('0x6c'),_0x86a0('0x6d'),_0x86a0('0x61'),_0x86a0('0x6e'),_0x86a0('0x6f'),_0x86a0('0x70'),'sys_updated_by',_0x86a0('0x71'),_0x86a0('0x72'),'sys_created_on','sys_domain','state',_0x86a0('0x73'),_0x86a0('0x62'),_0x86a0('0x45'),'calendar_stc','closed_at',_0x86a0('0x74'),_0x86a0('0x75'),_0x86a0('0x76'),_0x86a0('0x77'),'work_notes_list',_0x86a0('0x78'),_0x86a0('0x79'),_0x86a0('0x7a'),_0x86a0('0x7b'),'time_worked',_0x86a0('0x7c'),'opened_at',_0x86a0('0x7d'),_0x86a0('0x7e'),_0x86a0('0x7f'),_0x86a0('0x80'),_0x86a0('0x81'),_0x86a0('0x82'),_0x86a0('0x83'),_0x86a0('0x63'),'work_notes','short_description',_0x86a0('0x64'),_0x86a0('0x84'),_0x86a0('0x85'),_0x86a0('0x86'),_0x86a0('0x87'),_0x86a0('0x88'),_0x86a0('0x89'),_0x86a0('0x8a'),_0x86a0('0x8b'),_0x86a0('0x65'),_0x86a0('0x8c'),_0x86a0('0x8d'),_0x86a0('0x8e'),_0x86a0('0x8f'),_0x86a0('0x90'),_0x86a0('0x91'),'contact_type',_0x86a0('0x92'),_0x86a0('0x66'),'urgency',_0x86a0('0x93'),_0x86a0('0x94'),'reassignment_count',_0x86a0('0x95'),_0x86a0('0x96'),_0x86a0('0x67'),_0x86a0('0x97'),_0x86a0('0x98'),_0x86a0('0x99'),'comments_and_work_notes',_0x86a0('0x9a'),_0x86a0('0x9b'),_0x86a0('0x9c'),'sys_tags','escalation','upon_approval',_0x86a0('0x9d'),_0x86a0('0x9e'),'category'];var _0xec001a='';var _0x5597f8='';var _0x23ad30=[];var _0x342aef='';var _0x404d7d='';var _0x21d410=[];var _0x70baa8='';var _0x48d44d='';var _0x57290f={};var _0x3efcaf='';return db[_0x86a0('0x37')][_0x86a0('0x58')]({'where':{'id':_0x45a869[_0x86a0('0x50')]['id']},'attributes':['id',_0x86a0('0x9f'),_0x86a0('0xa0'),'email',_0x86a0('0xa1'),_0x86a0('0xa2')]})[_0x86a0('0x31')](handleEntityNotFound(_0x5940e5,null))[_0x86a0('0x31')](function(_0x1d8391){if(_0x1d8391){_0x3efcaf=_0x1d8391['remoteUri'];var _0x3c7113=_0x3efcaf[_0x86a0('0xa3')](-0x1);if(_0x3c7113==='/'){_0x3efcaf=_0x3efcaf[_0x86a0('0xa4')](0x0,_0x3efcaf['lastIndexOf'](_0x3c7113));}_0x48d44d=util['format'](_0x86a0('0xa5'),_0x3efcaf);_0x70baa8=util[_0x86a0('0xa6')](_0x86a0('0xa7'),_0x3efcaf);_0x57290f={'user':_0x1d8391[_0x86a0('0x9f')],'pass':_0x1d8391[_0x86a0('0xa0')]};var _0x30d37e={'method':_0x86a0('0xa8'),'uri':_0x48d44d+_0x86a0('0xa9'),'auth':_0x57290f,'json':!![]};return rp(_0x30d37e);}})[_0x86a0('0x31')](function(_0x4c59ab){if(_0x4c59ab['result']['length']>0x0){_0xec001a=_0x4c59ab['result'];}console[_0x86a0('0xaa')]('incident\x20table\x20objects',_0xec001a);_0x21d410=[];_0x5597f8=Object[_0x86a0('0xab')]([],_0xec001a);_[_0x86a0('0xac')](_0x5597f8,function(_0x3045f9){return!_0x3216e0[_0x86a0('0xad')](_0x3045f9[_0x86a0('0x34')]);});_0x5597f8[_0x86a0('0xae')](function(_0x37ba01){var _0x5197b8=createFieldObject(_0x70baa8,_0x57290f,_0x37ba01[_0x86a0('0xaf')],_0x37ba01[_0x86a0('0x34')],_0x37ba01[_0x86a0('0xb0')],![]);_0x21d410[_0x86a0('0xb1')](_0x5197b8);});return Promise[_0x86a0('0xb2')](_0x21d410);})[_0x86a0('0x31')](function(_0x4ab47c){_0x23ad30=_0x4ab47c;_0x342aef=Object[_0x86a0('0xab')]([],_0xec001a);console['log'](_0x86a0('0xb3'),_0xec001a);_[_0x86a0('0xac')](_0x342aef,function(_0x50db66){return _0x2a784d[_0x86a0('0xad')](_0x50db66[_0x86a0('0x34')]);});console[_0x86a0('0xaa')](_0x86a0('0xb4'),_0x342aef);_0x21d410=[];_0x342aef['forEach'](function(_0xbd72fc){var _0x44f845=createFieldObject(_0x70baa8,_0x57290f,_0xbd72fc[_0x86a0('0xaf')],_0xbd72fc[_0x86a0('0x34')],_0xbd72fc['label'],!![]);_0x21d410[_0x86a0('0xb1')](_0x44f845);});return Promise[_0x86a0('0xb2')](_0x21d410);})['then'](function(_0xe6d12f){_0x404d7d=_0xe6d12f;var _0x196a26=_0x23ad30['concat'](_0x404d7d);return{'count':_0x196a26[_0x86a0('0x42')],'rows':_0x196a26};})[_0x86a0('0x31')](respondWithResult(_0x5940e5,null))[_0x86a0('0x25')](function(_0x506384){console['log']('ServiceNow\x20error:\x20'+_0x506384);var _0x5f3213=_0x45a869[_0x86a0('0x3d')][_0x86a0('0xb5')]?0x1f4:_0x506384['statusCode']||0x1f4;logger[_0x86a0('0x22')](_0x506384[_0x86a0('0x33')]);delete _0x506384[_0x86a0('0x34')];if(_0x5f3213===0x191){_0x5f3213=0x190;}_0x5940e5[_0x86a0('0x27')](_0x5f3213)['send'](_0x45a869['query'][_0x86a0('0xb5')]?{'message':'Wrong\x20credentials','statusCode':_0x506384[_0x86a0('0xb6')]}:_0x506384);});};function createFieldObject(_0xef4a83,_0x2fa35b,_0x2c08bf,_0x371e8d,_0x23edbf,_0x2912c2){return new Promise(function(_0x269c50,_0xd70653){var _0x9d00a2={'id':_0x371e8d,'name':_0x23edbf,'custom':_0x2912c2};if(_0x2c08bf===_0x86a0('0xb7')){_0x9d00a2['options']=[{'name':_0x86a0('0xb8'),'value':'true'},{'name':'False','value':'false'}];_0x269c50(_0x9d00a2);}else{var _0x4a04fe={'method':_0x86a0('0xa8'),'uri':_0xef4a83+_0x86a0('0xb9')+_0x371e8d,'auth':_0x2fa35b,'json':!![]};return rp(_0x4a04fe)[_0x86a0('0x31')](function(_0x531be4){var _0x4ff578=[];if(_0x531be4[_0x86a0('0x24')]['length']>0x0){_0x531be4['result']['forEach'](function(_0x1ce7c0){if(_0x1ce7c0[_0x86a0('0xba')]===_0x86a0('0xbb')){var _0x49c507={'name':_0x1ce7c0[_0x86a0('0xb0')],'value':_0x1ce7c0['value']};_0x4ff578[_0x86a0('0xb1')](_0x49c507);}});}_0x9d00a2[_0x86a0('0x4a')]=_0x4ff578;if(_0x9d00a2[_0x86a0('0x4a')]['length']>0x0){_0x269c50(_0x9d00a2);}else{if(_0x2912c2==![]){_0x269c50();}else{_0x269c50(_0x9d00a2);}}});}});} \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.model.js b/server/api/intServicenowAccount/intServicenowAccount.model.js index 2e6cbd6..5712c8c 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 _0x1045=['lodash','../../config/logger','api','moment','bluebird','request-promise','rimraf','./intServicenowAccount.attributes','../../components/integrations/configuration','define','ServicenowAccount','int_servicenow_accounts'];(function(_0x450b00,_0x1cc659){var _0x219b54=function(_0x46fd91){while(--_0x46fd91){_0x450b00['push'](_0x450b00['shift']());}};_0x219b54(++_0x1cc659);}(_0x1045,0xb4));var _0x5104=function(_0x5d0db2,_0x29d33f){_0x5d0db2=_0x5d0db2-0x0;var _0x2d6bdf=_0x1045[_0x5d0db2];return _0x2d6bdf;};'use strict';var _=require(_0x5104('0x0'));var util=require('util');var logger=require(_0x5104('0x1'))(_0x5104('0x2'));var moment=require(_0x5104('0x3'));var BPromise=require(_0x5104('0x4'));var rp=require(_0x5104('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x5104('0x6'));var config=require('../../config/environment');var attributes=require(_0x5104('0x7'));var integrations=require(_0x5104('0x8'));module['exports']=function(_0xfb896b,_0x1c9ad4){return _0xfb896b[_0x5104('0x9')](_0x5104('0xa'),attributes,{'tableName':_0x5104('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xbad8=['../../config/environment','./intServicenowAccount.attributes','exports','define','int_servicenow_accounts','lodash','util','api','moment','bluebird','path','rimraf'];(function(_0xa400b2,_0x59f736){var _0x326df3=function(_0x414c5a){while(--_0x414c5a){_0xa400b2['push'](_0xa400b2['shift']());}};_0x326df3(++_0x59f736);}(_0xbad8,0x179));var _0x8bad=function(_0x3c2666,_0x15fd23){_0x3c2666=_0x3c2666-0x0;var _0x10c814=_0xbad8[_0x3c2666];return _0x10c814;};'use strict';var _=require(_0x8bad('0x0'));var util=require(_0x8bad('0x1'));var logger=require('../../config/logger')(_0x8bad('0x2'));var moment=require(_0x8bad('0x3'));var BPromise=require(_0x8bad('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x8bad('0x5'));var rimraf=require(_0x8bad('0x6'));var config=require(_0x8bad('0x7'));var attributes=require(_0x8bad('0x8'));var integrations=require('../../components/integrations/configuration');module[_0x8bad('0x9')]=function(_0x55c261,_0x58bd57){return _0x55c261[_0x8bad('0xa')]('ServicenowAccount',attributes,{'tableName':_0x8bad('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.rpc.js b/server/api/intServicenowAccount/intServicenowAccount.rpc.js index b81b325..c4806cb 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 _0x2acd=['findAll','options','raw','where','attributes','include','map','model','debug','ShowServicenowAccount','find','lodash','util','moment','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','client','request','then','info','ServicenowAccount,\x20%s,\x20%s','request\x20sent','ServicenowAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','GetServicenowAccount','ServicenowAccount'];(function(_0x5b3820,_0x51889c){var _0x442af8=function(_0x597ee1){while(--_0x597ee1){_0x5b3820['push'](_0x5b3820['shift']());}};_0x442af8(++_0x51889c);}(_0x2acd,0xeb));var _0xd2ac=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0x2acd[_0x4b369d];return _0x571a98;};'use strict';var _=require(_0xd2ac('0x0'));var util=require(_0xd2ac('0x1'));var moment=require(_0xd2ac('0x2'));var BPromise=require('bluebird');var rs=require(_0xd2ac('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xd2ac('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xd2ac('0x5'))(_0xd2ac('0x6'));var config=require(_0xd2ac('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xd2ac('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1d9aa7,_0x44de04,_0x374075){return new BPromise(function(_0x3c1b76,_0x550609){return client[_0xd2ac('0x9')](_0x1d9aa7,_0x374075)[_0xd2ac('0xa')](function(_0x4a3884){logger[_0xd2ac('0xb')](_0xd2ac('0xc'),_0x44de04,_0xd2ac('0xd'));logger['debug'](_0xd2ac('0xe'),_0x44de04,_0xd2ac('0xd'),JSON[_0xd2ac('0xf')](_0x4a3884));if(_0x4a3884[_0xd2ac('0x10')]){if(_0x4a3884[_0xd2ac('0x10')]['code']===0x1f4){logger[_0xd2ac('0x10')]('ServicenowAccount,\x20%s,\x20%s',_0x44de04,_0x4a3884[_0xd2ac('0x10')][_0xd2ac('0x11')]);return _0x550609(_0x4a3884[_0xd2ac('0x10')][_0xd2ac('0x11')]);}logger[_0xd2ac('0x10')](_0xd2ac('0xc'),_0x44de04,_0x4a3884[_0xd2ac('0x10')][_0xd2ac('0x11')]);return _0x3c1b76(_0x4a3884[_0xd2ac('0x10')]['message']);}else{logger[_0xd2ac('0xb')]('ServicenowAccount,\x20%s,\x20%s',_0x44de04,_0xd2ac('0xd'));_0x3c1b76(_0x4a3884['result'][_0xd2ac('0x11')]);}})[_0xd2ac('0x12')](function(_0x3fc239){logger['error'](_0xd2ac('0xc'),_0x44de04,_0x3fc239);_0x550609(_0x3fc239);});});}exports[_0xd2ac('0x13')]=function(_0x5b16e9){var _0x434158=this;return new Promise(function(_0x3262bc,_0x4e4d2a){return db[_0xd2ac('0x14')][_0xd2ac('0x15')]({'raw':_0x5b16e9[_0xd2ac('0x16')]?_0x5b16e9[_0xd2ac('0x16')][_0xd2ac('0x17')]===undefined?!![]:![]:!![],'where':_0x5b16e9[_0xd2ac('0x16')]?_0x5b16e9[_0xd2ac('0x16')][_0xd2ac('0x18')]||null:null,'attributes':_0x5b16e9['options']?_0x5b16e9[_0xd2ac('0x16')][_0xd2ac('0x19')]||null:null,'limit':_0x5b16e9[_0xd2ac('0x16')]?_0x5b16e9[_0xd2ac('0x16')]['limit']||null:null,'include':_0x5b16e9[_0xd2ac('0x16')]?_0x5b16e9[_0xd2ac('0x16')][_0xd2ac('0x1a')]?_['map'](_0x5b16e9[_0xd2ac('0x16')]['include'],function(_0x185df2){return{'model':db[_0x185df2['model']],'as':_0x185df2['as'],'attributes':_0x185df2['attributes'],'include':_0x185df2[_0xd2ac('0x1a')]?_[_0xd2ac('0x1b')](_0x185df2[_0xd2ac('0x1a')],function(_0x5d93cf){return{'model':db[_0x5d93cf[_0xd2ac('0x1c')]],'as':_0x5d93cf['as'],'attributes':_0x5d93cf[_0xd2ac('0x19')],'include':_0x5d93cf[_0xd2ac('0x1a')]?_[_0xd2ac('0x1b')](_0x5d93cf['include'],function(_0x560957){return{'model':db[_0x560957[_0xd2ac('0x1c')]],'as':_0x560957['as'],'attributes':_0x560957[_0xd2ac('0x19')]};}):[]};}):[]};}):[]:[]})[_0xd2ac('0xa')](function(_0x4b32b4){logger[_0xd2ac('0xb')](_0xd2ac('0x13'),_0x5b16e9);logger[_0xd2ac('0x1d')](_0xd2ac('0x13'),_0x5b16e9,JSON['stringify'](_0x4b32b4));_0x3262bc(_0x4b32b4);})[_0xd2ac('0x12')](function(_0x589567){logger[_0xd2ac('0x10')](_0xd2ac('0x13'),_0x589567[_0xd2ac('0x11')],_0x5b16e9);_0x4e4d2a(_0x434158[_0xd2ac('0x10')](0x1f4,_0x589567['message']));});});};exports[_0xd2ac('0x1e')]=function(_0x338e3d){var _0x404a88=this;return new Promise(function(_0x36e430,_0x3258f8){return db[_0xd2ac('0x14')][_0xd2ac('0x1f')]({'raw':_0x338e3d[_0xd2ac('0x16')]?_0x338e3d[_0xd2ac('0x16')]['raw']===undefined?!![]:![]:!![],'where':_0x338e3d['options']?_0x338e3d[_0xd2ac('0x16')][_0xd2ac('0x18')]||null:null,'attributes':_0x338e3d['options']?_0x338e3d[_0xd2ac('0x16')][_0xd2ac('0x19')]||null:null,'include':_0x338e3d[_0xd2ac('0x16')]?_0x338e3d['options'][_0xd2ac('0x1a')]?_[_0xd2ac('0x1b')](_0x338e3d[_0xd2ac('0x16')]['include'],function(_0x513f2c){return{'model':db[_0x513f2c[_0xd2ac('0x1c')]],'as':_0x513f2c['as'],'attributes':_0x513f2c['attributes'],'include':_0x513f2c[_0xd2ac('0x1a')]?_[_0xd2ac('0x1b')](_0x513f2c[_0xd2ac('0x1a')],function(_0x397f87){return{'model':db[_0x397f87[_0xd2ac('0x1c')]],'as':_0x397f87['as'],'attributes':_0x397f87['attributes'],'include':_0x397f87[_0xd2ac('0x1a')]?_[_0xd2ac('0x1b')](_0x397f87[_0xd2ac('0x1a')],function(_0x39b1a5){return{'model':db[_0x39b1a5[_0xd2ac('0x1c')]],'as':_0x39b1a5['as'],'attributes':_0x39b1a5[_0xd2ac('0x19')]};}):[]};}):[]};}):[]:[]})[_0xd2ac('0xa')](function(_0x313679){logger['info'](_0xd2ac('0x1e'),_0x338e3d);logger['debug'](_0xd2ac('0x1e'),_0x338e3d,JSON['stringify'](_0x313679));_0x36e430(_0x313679);})[_0xd2ac('0x12')](function(_0x5e813e){logger[_0xd2ac('0x10')](_0xd2ac('0x1e'),_0x5e813e[_0xd2ac('0x11')],_0x338e3d);_0x3258f8(_0x404a88[_0xd2ac('0x10')](0x1f4,_0x5e813e['message']));});});}; \ No newline at end of file +var _0x1ad6=['message','result','GetServicenowAccount','ServicenowAccount','findAll','options','where','attributes','include','map','model','catch','ShowServicenowAccount','find','util','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','debug','ServicenowAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','ServicenowAccount,\x20%s,\x20%s'];(function(_0x4519f4,_0x5312fc){var _0x39cff9=function(_0x134199){while(--_0x134199){_0x4519f4['push'](_0x4519f4['shift']());}};_0x39cff9(++_0x5312fc);}(_0x1ad6,0x1dc));var _0x61ad=function(_0xa024b0,_0x104860){_0xa024b0=_0xa024b0-0x0;var _0x351d71=_0x1ad6[_0xa024b0];return _0x351d71;};'use strict';var _=require('lodash');var util=require(_0x61ad('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x61ad('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x61ad('0x2'))['db'];var utils=require(_0x61ad('0x3'));var logger=require(_0x61ad('0x4'))(_0x61ad('0x5'));var config=require(_0x61ad('0x6'));var jayson=require(_0x61ad('0x7'));var client=jayson[_0x61ad('0x8')][_0x61ad('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x32b347,_0x4dc97c,_0x27ac8b){return new BPromise(function(_0x5c8584,_0xd076cd){return client[_0x61ad('0xa')](_0x32b347,_0x27ac8b)[_0x61ad('0xb')](function(_0x572358){logger[_0x61ad('0xc')]('ServicenowAccount,\x20%s,\x20%s',_0x4dc97c,'request\x20sent');logger[_0x61ad('0xd')](_0x61ad('0xe'),_0x4dc97c,_0x61ad('0xf'),JSON[_0x61ad('0x10')](_0x572358));if(_0x572358[_0x61ad('0x11')]){if(_0x572358[_0x61ad('0x11')]['code']===0x1f4){logger[_0x61ad('0x11')](_0x61ad('0x12'),_0x4dc97c,_0x572358[_0x61ad('0x11')][_0x61ad('0x13')]);return _0xd076cd(_0x572358[_0x61ad('0x11')][_0x61ad('0x13')]);}logger[_0x61ad('0x11')](_0x61ad('0x12'),_0x4dc97c,_0x572358[_0x61ad('0x11')][_0x61ad('0x13')]);return _0x5c8584(_0x572358[_0x61ad('0x11')][_0x61ad('0x13')]);}else{logger[_0x61ad('0xc')](_0x61ad('0x12'),_0x4dc97c,_0x61ad('0xf'));_0x5c8584(_0x572358[_0x61ad('0x14')]['message']);}})['catch'](function(_0x23b08c){logger[_0x61ad('0x11')]('ServicenowAccount,\x20%s,\x20%s',_0x4dc97c,_0x23b08c);_0xd076cd(_0x23b08c);});});}exports[_0x61ad('0x15')]=function(_0x201a4b){var _0x31a4ed=this;return new Promise(function(_0x54b4fa,_0x1f449f){return db[_0x61ad('0x16')][_0x61ad('0x17')]({'raw':_0x201a4b[_0x61ad('0x18')]?_0x201a4b[_0x61ad('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x201a4b['options']?_0x201a4b[_0x61ad('0x18')][_0x61ad('0x19')]||null:null,'attributes':_0x201a4b[_0x61ad('0x18')]?_0x201a4b[_0x61ad('0x18')][_0x61ad('0x1a')]||null:null,'limit':_0x201a4b['options']?_0x201a4b[_0x61ad('0x18')]['limit']||null:null,'include':_0x201a4b['options']?_0x201a4b['options'][_0x61ad('0x1b')]?_[_0x61ad('0x1c')](_0x201a4b['options']['include'],function(_0x2a9fc2){return{'model':db[_0x2a9fc2[_0x61ad('0x1d')]],'as':_0x2a9fc2['as'],'attributes':_0x2a9fc2[_0x61ad('0x1a')],'include':_0x2a9fc2['include']?_[_0x61ad('0x1c')](_0x2a9fc2[_0x61ad('0x1b')],function(_0x47cdfd){return{'model':db[_0x47cdfd[_0x61ad('0x1d')]],'as':_0x47cdfd['as'],'attributes':_0x47cdfd[_0x61ad('0x1a')],'include':_0x47cdfd[_0x61ad('0x1b')]?_[_0x61ad('0x1c')](_0x47cdfd[_0x61ad('0x1b')],function(_0x1fe6f6){return{'model':db[_0x1fe6f6[_0x61ad('0x1d')]],'as':_0x1fe6f6['as'],'attributes':_0x1fe6f6[_0x61ad('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x61ad('0xb')](function(_0x2dc490){logger['info'](_0x61ad('0x15'),_0x201a4b);logger[_0x61ad('0xd')]('GetServicenowAccount',_0x201a4b,JSON[_0x61ad('0x10')](_0x2dc490));_0x54b4fa(_0x2dc490);})[_0x61ad('0x1e')](function(_0x5ed3f7){logger['error'](_0x61ad('0x15'),_0x5ed3f7['message'],_0x201a4b);_0x1f449f(_0x31a4ed[_0x61ad('0x11')](0x1f4,_0x5ed3f7[_0x61ad('0x13')]));});});};exports[_0x61ad('0x1f')]=function(_0x32f65c){var _0x595c57=this;return new Promise(function(_0x293b40,_0x167a02){return db[_0x61ad('0x16')][_0x61ad('0x20')]({'raw':_0x32f65c['options']?_0x32f65c[_0x61ad('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x32f65c[_0x61ad('0x18')]?_0x32f65c[_0x61ad('0x18')][_0x61ad('0x19')]||null:null,'attributes':_0x32f65c[_0x61ad('0x18')]?_0x32f65c[_0x61ad('0x18')][_0x61ad('0x1a')]||null:null,'include':_0x32f65c['options']?_0x32f65c[_0x61ad('0x18')][_0x61ad('0x1b')]?_[_0x61ad('0x1c')](_0x32f65c[_0x61ad('0x18')][_0x61ad('0x1b')],function(_0x4fc64){return{'model':db[_0x4fc64[_0x61ad('0x1d')]],'as':_0x4fc64['as'],'attributes':_0x4fc64[_0x61ad('0x1a')],'include':_0x4fc64[_0x61ad('0x1b')]?_['map'](_0x4fc64[_0x61ad('0x1b')],function(_0x118aaf){return{'model':db[_0x118aaf[_0x61ad('0x1d')]],'as':_0x118aaf['as'],'attributes':_0x118aaf[_0x61ad('0x1a')],'include':_0x118aaf[_0x61ad('0x1b')]?_['map'](_0x118aaf[_0x61ad('0x1b')],function(_0x24ca70){return{'model':db[_0x24ca70[_0x61ad('0x1d')]],'as':_0x24ca70['as'],'attributes':_0x24ca70[_0x61ad('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x61ad('0xb')](function(_0x3d7aca){logger[_0x61ad('0xc')](_0x61ad('0x1f'),_0x32f65c);logger[_0x61ad('0xd')](_0x61ad('0x1f'),_0x32f65c,JSON[_0x61ad('0x10')](_0x3d7aca));_0x293b40(_0x3d7aca);})[_0x61ad('0x1e')](function(_0x3c815c){logger[_0x61ad('0x11')](_0x61ad('0x1f'),_0x3c815c[_0x61ad('0x13')],_0x32f65c);_0x167a02(_0x595c57[_0x61ad('0x11')](0x1f4,_0x3c815c[_0x61ad('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/index.js b/server/api/intServicenowConfiguration/index.js index a49c5ef..c2e1add 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 _0x58c6=['connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./intServicenowConfiguration.controller','get','index','/:id','isAuthenticated','show','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','post','create','exports','multer','path'];(function(_0x484d70,_0x25cde6){var _0x310b44=function(_0x1d3e41){while(--_0x1d3e41){_0x484d70['push'](_0x484d70['shift']());}};_0x310b44(++_0x25cde6);}(_0x58c6,0xbb));var _0x658c=function(_0x329d13,_0x1aff27){_0x329d13=_0x329d13-0x0;var _0x33efd9=_0x58c6[_0x329d13];return _0x33efd9;};'use strict';var multer=require(_0x658c('0x0'));var util=require('util');var path=require(_0x658c('0x1'));var timeout=require(_0x658c('0x2'));var express=require(_0x658c('0x3'));var router=express['Router']();var auth=require(_0x658c('0x4'));var interaction=require(_0x658c('0x5'));var config=require(_0x658c('0x6'));var controller=require(_0x658c('0x7'));router[_0x658c('0x8')]('/',auth['isAuthenticated'](),controller[_0x658c('0x9')]);router[_0x658c('0x8')](_0x658c('0xa'),auth[_0x658c('0xb')](),controller[_0x658c('0xc')]);router['get']('/:id/fields',auth['isAuthenticated'](),controller[_0x658c('0xd')]);router[_0x658c('0x8')](_0x658c('0xe'),auth[_0x658c('0xb')](),controller[_0x658c('0xf')]);router[_0x658c('0x8')](_0x658c('0x10'),auth[_0x658c('0xb')](),controller[_0x658c('0x11')]);router[_0x658c('0x12')]('/',auth['isAuthenticated'](),controller[_0x658c('0x13')]);router['put'](_0x658c('0xa'),auth[_0x658c('0xb')](),controller['update']);router['delete'](_0x658c('0xa'),auth['isAuthenticated'](),controller['destroy']);module[_0x658c('0x14')]=router; \ No newline at end of file +var _0x2faa=['/:id','show','/:id/fields','getFields','/:id/subjects','getDescriptions','post','create','put','update','delete','destroy','multer','util','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./intServicenowConfiguration.controller','get','isAuthenticated'];(function(_0x107d12,_0x1fc016){var _0x4ecd5b=function(_0x5db5c2){while(--_0x5db5c2){_0x107d12['push'](_0x107d12['shift']());}};_0x4ecd5b(++_0x1fc016);}(_0x2faa,0xb4));var _0xa2fa=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0x2faa[_0x3ab51d];return _0x29a04e;};'use strict';var multer=require(_0xa2fa('0x0'));var util=require(_0xa2fa('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xa2fa('0x2'));var router=express['Router']();var auth=require(_0xa2fa('0x3'));var interaction=require(_0xa2fa('0x4'));var config=require(_0xa2fa('0x5'));var controller=require(_0xa2fa('0x6'));router[_0xa2fa('0x7')]('/',auth[_0xa2fa('0x8')](),controller['index']);router[_0xa2fa('0x7')](_0xa2fa('0x9'),auth[_0xa2fa('0x8')](),controller[_0xa2fa('0xa')]);router[_0xa2fa('0x7')](_0xa2fa('0xb'),auth[_0xa2fa('0x8')](),controller[_0xa2fa('0xc')]);router['get'](_0xa2fa('0xd'),auth[_0xa2fa('0x8')](),controller['getSubjects']);router[_0xa2fa('0x7')]('/:id/descriptions',auth[_0xa2fa('0x8')](),controller[_0xa2fa('0xe')]);router[_0xa2fa('0xf')]('/',auth[_0xa2fa('0x8')](),controller[_0xa2fa('0x10')]);router[_0xa2fa('0x11')](_0xa2fa('0x9'),auth[_0xa2fa('0x8')](),controller[_0xa2fa('0x12')]);router[_0xa2fa('0x13')](_0xa2fa('0x9'),auth[_0xa2fa('0x8')](),controller[_0xa2fa('0x14')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.attributes.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.attributes.js index f7b98ab..a33ca27 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 _0xe937=['exports'];(function(_0x5853c4,_0x50f8b2){var _0x32c6cf=function(_0x44eefd){while(--_0x44eefd){_0x5853c4['push'](_0x5853c4['shift']());}};_0x32c6cf(++_0x50f8b2);}(_0xe937,0xbc));var _0x7e93=function(_0x3c67cc,_0x4c6c00){_0x3c67cc=_0x3c67cc-0x0;var _0x265be5=_0xe937[_0x3c67cc];return _0x265be5;};'use strict';var Sequelize=require('sequelize');module[_0x7e93('0x0')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x2717=['STRING','sequelize','exports'];(function(_0x592ef9,_0x5ee38e){var _0x2b2ef4=function(_0x416d69){while(--_0x416d69){_0x592ef9['push'](_0x592ef9['shift']());}};_0x2b2ef4(++_0x5ee38e);}(_0x2717,0xd6));var _0x7271=function(_0x45840d,_0x361695){_0x45840d=_0x45840d-0x0;var _0x58a8f2=_0x2717[_0x45840d];return _0x58a8f2;};'use strict';var Sequelize=require(_0x7271('0x0'));module[_0x7271('0x1')]={'name':{'type':Sequelize[_0x7271('0x2')]},'description':{'type':Sequelize[_0x7271('0x2')]}}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.controller.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.controller.js index eea2aa3..8e41bca 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 _0xb10b=['ServicenowConfiguration','findAll','show','params','find','create','body','destroy','getFields','findOne','order','pick','hasOwnProperty','getSubjects','ServicenowField','getDescriptions','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','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','ServicenowConfiguration,\x20%s,\x20%s','request\x20sent','debug','ServicenowConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','status','end','json','count','offset','Content-Range','apply','save','update','stack','name','send','map','rawAttributes','model','keys','query','filters','attributes','intersection','fields','length','nolimit','limit','sort','filter','where','merge','type','VIRTUAL','options','includeAll','include'];(function(_0x305cd6,_0xf1a23a){var _0x42fbc7=function(_0x1c2f8a){while(--_0x1c2f8a){_0x305cd6['push'](_0x305cd6['shift']());}};_0x42fbc7(++_0xf1a23a);}(_0xb10b,0x12a));var _0xbb10=function(_0x895358,_0x32f914){_0x895358=_0x895358-0x0;var _0x26e26e=_0xb10b[_0x895358];return _0x26e26e;};'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'];var jayson=require(_0xbb10('0x18'));var client=jayson[_0xbb10('0x19')][_0xbb10('0x1a')]({'port':0x232a});function checkPasswordPattern(_0x193a27,_0x442548,_0x147230){if(_0x147230){var _0x58a612=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x58a612[_0xbb10('0x1b')](_0x442548)){return _0x193a27;}else{throw new db[(_0xbb10('0x1c'))][(_0xbb10('0x1d'))](_0xbb10('0x1e'));}}else{return _0x193a27;}}function respondWithRpcPromise(_0x3df17b,_0x2f2ebf,_0x24a57b,_0x36b5e8){return new BPromise(function(_0x3e26f4,_0x2b184e){var _0x4a2bfc=_0x36b5e8||client;return _0x4a2bfc[_0xbb10('0x1f')](_0x3df17b,_0x24a57b)[_0xbb10('0x20')](function(_0x133ac2){logger[_0xbb10('0x21')](_0xbb10('0x22'),_0x2f2ebf,_0xbb10('0x23'));logger[_0xbb10('0x24')](_0xbb10('0x25'),_0x2f2ebf,_0xbb10('0x23'),JSON[_0xbb10('0x26')](_0x133ac2));if(_0x133ac2['error']){if(_0x133ac2[_0xbb10('0x27')][_0xbb10('0x28')]===0x1f4){logger[_0xbb10('0x27')](_0xbb10('0x22'),_0x2f2ebf,_0x133ac2[_0xbb10('0x27')][_0xbb10('0x29')]);return _0x2b184e(_0x133ac2['error'][_0xbb10('0x29')]);}logger[_0xbb10('0x27')]('ServicenowConfiguration,\x20%s,\x20%s',_0x2f2ebf,_0x133ac2['error'][_0xbb10('0x29')]);return _0x3e26f4(_0x133ac2[_0xbb10('0x27')][_0xbb10('0x29')]);}else{logger[_0xbb10('0x21')](_0xbb10('0x22'),_0x2f2ebf,_0xbb10('0x23'));_0x3e26f4(_0x133ac2[_0xbb10('0x2a')][_0xbb10('0x29')]);}})[_0xbb10('0x2b')](function(_0x395404){logger[_0xbb10('0x27')](_0xbb10('0x22'),_0x2f2ebf,_0x395404);_0x2b184e(_0x395404);});});}function respondWithStatusCode(_0x537898,_0x4fedac){_0x4fedac=_0x4fedac||0xcc;return function(_0x4fb5e0){if(_0x4fb5e0){return _0x537898[_0xbb10('0x2c')](_0x4fedac);}return _0x537898[_0xbb10('0x2d')](_0x4fedac)[_0xbb10('0x2e')]();};}function respondWithResult(_0x4e25ff,_0x2fdde9){_0x2fdde9=_0x2fdde9||0xc8;return function(_0x24d586){if(_0x24d586){return _0x4e25ff[_0xbb10('0x2d')](_0x2fdde9)[_0xbb10('0x2f')](_0x24d586);}};}function respondWithFilteredResult(_0x1acce9,_0x20d946){return function(_0x2a0e8b){if(_0x2a0e8b){var _0x4aabb9=_0x2a0e8b[_0xbb10('0x30')],_0x3796c7=_0x20d946[_0xbb10('0x31')],_0x21ac54=_0x20d946[_0xbb10('0x31')]+_0x20d946['limit'],_0xfc3595;if(_0x21ac54>=_0x4aabb9){_0x21ac54=_0x4aabb9;_0xfc3595=0xc8;}else{_0xfc3595=0xce;}_0x1acce9[_0xbb10('0x2d')](_0xfc3595);return _0x1acce9['set'](_0xbb10('0x32'),_0x3796c7+'-'+_0x21ac54+'/'+_0x4aabb9)['json'](_0x2a0e8b);}return null;};}function patchUpdates(_0x16ad2a){return function(_0x1dcc9c){try{jsonpatch[_0xbb10('0x33')](_0x1dcc9c,_0x16ad2a,!![]);}catch(_0x491db4){return BPromise['reject'](_0x491db4);}return _0x1dcc9c[_0xbb10('0x34')]();};}function saveUpdates(_0x34f65e,_0x4f590d){return function(_0x359ad4){if(_0x359ad4){return _0x359ad4[_0xbb10('0x35')](_0x34f65e)[_0xbb10('0x20')](function(_0x1c0b57){return _0x1c0b57;});}return null;};}function removeEntity(_0x37a83f,_0x138bc6){return function(_0xf85197){if(_0xf85197){return _0xf85197['destroy']()[_0xbb10('0x20')](function(){_0x37a83f[_0xbb10('0x2d')](0xcc)[_0xbb10('0x2e')]();});}};}function handleEntityNotFound(_0x8c1ce6,_0xfb2c5e){return function(_0x9de708){if(!_0x9de708){_0x8c1ce6[_0xbb10('0x2c')](0x194);}return _0x9de708;};}function handleError(_0x10202c,_0x3c8d7d){_0x3c8d7d=_0x3c8d7d||0x1f4;return function(_0x56943c){logger[_0xbb10('0x27')](_0x56943c[_0xbb10('0x36')]);if(_0x56943c[_0xbb10('0x37')]){delete _0x56943c[_0xbb10('0x37')];}_0x10202c['status'](_0x3c8d7d)[_0xbb10('0x38')](_0x56943c);};}exports['index']=function(_0x4e2754,_0x3eb3cc){var _0x40c164={},_0x26e76a={},_0x120d21={'count':0x0,'rows':[]};var _0x15d895=_[_0xbb10('0x39')](db['ServicenowConfiguration'][_0xbb10('0x3a')],function(_0x25d72f){return{'name':_0x25d72f['fieldName'],'type':_0x25d72f['type']['key']};});_0x26e76a[_0xbb10('0x3b')]=_[_0xbb10('0x39')](_0x15d895,_0xbb10('0x37'));_0x26e76a['query']=_[_0xbb10('0x3c')](_0x4e2754[_0xbb10('0x3d')]);_0x26e76a[_0xbb10('0x3e')]=_['intersection'](_0x26e76a[_0xbb10('0x3b')],_0x26e76a[_0xbb10('0x3d')]);_0x40c164[_0xbb10('0x3f')]=_[_0xbb10('0x40')](_0x26e76a['model'],qs[_0xbb10('0x41')](_0x4e2754[_0xbb10('0x3d')]['fields']));_0x40c164[_0xbb10('0x3f')]=_0x40c164[_0xbb10('0x3f')][_0xbb10('0x42')]?_0x40c164[_0xbb10('0x3f')]:_0x26e76a[_0xbb10('0x3b')];if(!_0x4e2754[_0xbb10('0x3d')]['hasOwnProperty'](_0xbb10('0x43'))){_0x40c164[_0xbb10('0x44')]=qs[_0xbb10('0x44')](_0x4e2754[_0xbb10('0x3d')]['limit']);_0x40c164[_0xbb10('0x31')]=qs[_0xbb10('0x31')](_0x4e2754[_0xbb10('0x3d')][_0xbb10('0x31')]);}_0x40c164['order']=qs[_0xbb10('0x45')](_0x4e2754[_0xbb10('0x3d')]['sort']);_0x40c164['where']=qs[_0xbb10('0x3e')](_['pick'](_0x4e2754[_0xbb10('0x3d')],_0x26e76a[_0xbb10('0x3e')]),_0x15d895);if(_0x4e2754['query'][_0xbb10('0x46')]){_0x40c164[_0xbb10('0x47')]=_[_0xbb10('0x48')](_0x40c164['where'],{'$or':_[_0xbb10('0x39')](_0x15d895,function(_0xebd70c){if(_0xebd70c[_0xbb10('0x49')]!==_0xbb10('0x4a')){var _0x36e1fa={};_0x36e1fa[_0xebd70c[_0xbb10('0x37')]]={'$like':'%'+_0x4e2754[_0xbb10('0x3d')][_0xbb10('0x46')]+'%'};return _0x36e1fa;}})});}_0x40c164=_[_0xbb10('0x48')]({},_0x40c164,_0x4e2754[_0xbb10('0x4b')]);var _0x197871={'where':_0x40c164[_0xbb10('0x47')]};return db['ServicenowConfiguration'][_0xbb10('0x30')](_0x197871)[_0xbb10('0x20')](function(_0x4a1248){_0x120d21[_0xbb10('0x30')]=_0x4a1248;if(_0x4e2754[_0xbb10('0x3d')][_0xbb10('0x4c')]){_0x40c164[_0xbb10('0x4d')]=[{'all':!![]}];}return db[_0xbb10('0x4e')][_0xbb10('0x4f')](_0x40c164);})[_0xbb10('0x20')](function(_0x5be85e){_0x120d21['rows']=_0x5be85e;return _0x120d21;})[_0xbb10('0x20')](respondWithFilteredResult(_0x3eb3cc,_0x40c164))[_0xbb10('0x2b')](handleError(_0x3eb3cc,null));};exports[_0xbb10('0x50')]=function(_0x57d2c0,_0x5f0c12){var _0x3cd6f3={'raw':![],'where':{'id':_0x57d2c0[_0xbb10('0x51')]['id']}},_0x34cf4e={};_0x34cf4e[_0xbb10('0x3b')]=_[_0xbb10('0x3c')](db[_0xbb10('0x4e')][_0xbb10('0x3a')]);_0x34cf4e[_0xbb10('0x3d')]=_[_0xbb10('0x3c')](_0x57d2c0[_0xbb10('0x3d')]);_0x34cf4e['filters']=_['intersection'](_0x34cf4e[_0xbb10('0x3b')],_0x34cf4e[_0xbb10('0x3d')]);_0x3cd6f3[_0xbb10('0x3f')]=_[_0xbb10('0x40')](_0x34cf4e[_0xbb10('0x3b')],qs[_0xbb10('0x41')](_0x57d2c0[_0xbb10('0x3d')][_0xbb10('0x41')]));_0x3cd6f3[_0xbb10('0x3f')]=_0x3cd6f3[_0xbb10('0x3f')][_0xbb10('0x42')]?_0x3cd6f3[_0xbb10('0x3f')]:_0x34cf4e[_0xbb10('0x3b')];if(_0x57d2c0[_0xbb10('0x3d')][_0xbb10('0x4c')]){_0x3cd6f3['include']=[{'all':!![]}];}_0x3cd6f3=_[_0xbb10('0x48')]({},_0x3cd6f3,_0x57d2c0['options']);return db[_0xbb10('0x4e')][_0xbb10('0x52')](_0x3cd6f3)[_0xbb10('0x20')](handleEntityNotFound(_0x5f0c12,null))[_0xbb10('0x20')](respondWithResult(_0x5f0c12,null))[_0xbb10('0x2b')](handleError(_0x5f0c12,null));};exports[_0xbb10('0x53')]=function(_0x2e3326,_0x44eec1){return db[_0xbb10('0x4e')][_0xbb10('0x53')](_0x2e3326[_0xbb10('0x54')],{})[_0xbb10('0x20')](respondWithResult(_0x44eec1,0xc9))[_0xbb10('0x2b')](handleError(_0x44eec1,null));};exports[_0xbb10('0x35')]=function(_0x4475e1,_0x5de0cc){if(_0x4475e1[_0xbb10('0x54')]['id']){delete _0x4475e1[_0xbb10('0x54')]['id'];}return db[_0xbb10('0x4e')][_0xbb10('0x52')]({'where':{'id':_0x4475e1[_0xbb10('0x51')]['id']}})[_0xbb10('0x20')](handleEntityNotFound(_0x5de0cc,null))['then'](saveUpdates(_0x4475e1[_0xbb10('0x54')],null))[_0xbb10('0x20')](respondWithResult(_0x5de0cc,null))[_0xbb10('0x2b')](handleError(_0x5de0cc,null));};exports[_0xbb10('0x55')]=function(_0x432728,_0x22de7f){return db[_0xbb10('0x4e')][_0xbb10('0x52')]({'where':{'id':_0x432728[_0xbb10('0x51')]['id']}})[_0xbb10('0x20')](handleEntityNotFound(_0x22de7f,null))[_0xbb10('0x20')](removeEntity(_0x22de7f,null))[_0xbb10('0x2b')](handleError(_0x22de7f,null));};exports[_0xbb10('0x56')]=function(_0x4e7fac,_0x4ea1a6,_0x16272d){var _0x3e6338={};var _0x3d0cb7={};var _0x8b0a7d;var _0x5573bb;return db['ServicenowConfiguration'][_0xbb10('0x57')]({'where':{'id':_0x4e7fac[_0xbb10('0x51')]['id']}})[_0xbb10('0x20')](handleEntityNotFound(_0x4ea1a6,null))[_0xbb10('0x20')](function(_0x412f13){if(_0x412f13){_0x8b0a7d=_0x412f13;_0x3d0cb7[_0xbb10('0x3b')]=_[_0xbb10('0x3c')](db['ServicenowField'][_0xbb10('0x3a')]);_0x3d0cb7[_0xbb10('0x3d')]=_['keys'](_0x4e7fac['query']);_0x3d0cb7['filters']=_[_0xbb10('0x40')](_0x3d0cb7[_0xbb10('0x3b')],_0x3d0cb7[_0xbb10('0x3d')]);_0x3e6338['attributes']=_['intersection'](_0x3d0cb7['model'],qs[_0xbb10('0x41')](_0x4e7fac[_0xbb10('0x3d')][_0xbb10('0x41')]));_0x3e6338['attributes']=_0x3e6338[_0xbb10('0x3f')][_0xbb10('0x42')]?_0x3e6338['attributes']:_0x3d0cb7['model'];_0x3e6338[_0xbb10('0x58')]=qs[_0xbb10('0x45')](_0x4e7fac[_0xbb10('0x3d')][_0xbb10('0x45')]);_0x3e6338['where']=qs[_0xbb10('0x3e')](_[_0xbb10('0x59')](_0x4e7fac[_0xbb10('0x3d')],_0x3d0cb7['filters']));if(_0x4e7fac[_0xbb10('0x3d')][_0xbb10('0x46')]){_0x3e6338[_0xbb10('0x47')]=_['merge'](_0x3e6338[_0xbb10('0x47')],{'$or':_[_0xbb10('0x39')](_0x3e6338[_0xbb10('0x3f')],function(_0x37b65f){var _0x5e4a6e={};_0x5e4a6e[_0x37b65f]={'$like':'%'+_0x4e7fac[_0xbb10('0x3d')][_0xbb10('0x46')]+'%'};return _0x5e4a6e;})});}_0x3e6338=_[_0xbb10('0x48')]({},_0x3e6338,_0x4e7fac[_0xbb10('0x4b')]);return _0x8b0a7d['getFields'](_0x3e6338);}})[_0xbb10('0x20')](function(_0x277fe7){if(_0x277fe7){_0x5573bb=_0x277fe7[_0xbb10('0x42')];if(!_0x4e7fac[_0xbb10('0x3d')][_0xbb10('0x5a')](_0xbb10('0x43'))){_0x3e6338[_0xbb10('0x44')]=qs['limit'](_0x4e7fac['query']['limit']);_0x3e6338[_0xbb10('0x31')]=qs[_0xbb10('0x31')](_0x4e7fac[_0xbb10('0x3d')]['offset']);}return _0x8b0a7d['getFields'](_0x3e6338);}})[_0xbb10('0x20')](function(_0x1b11c0){if(_0x1b11c0){return _0x1b11c0?{'count':_0x5573bb,'rows':_0x1b11c0}:null;}})[_0xbb10('0x20')](respondWithResult(_0x4ea1a6,null))[_0xbb10('0x2b')](handleError(_0x4ea1a6,null));};exports[_0xbb10('0x5b')]=function(_0x1ad2ed,_0x4cf2f3,_0x1a5ca5){var _0x15fae2={};var _0x270fdb={};var _0x14f16b;var _0x2aaaa6;return db['ServicenowConfiguration']['findOne']({'where':{'id':_0x1ad2ed['params']['id']}})[_0xbb10('0x20')](handleEntityNotFound(_0x4cf2f3,null))[_0xbb10('0x20')](function(_0x36917f){if(_0x36917f){_0x14f16b=_0x36917f;_0x270fdb[_0xbb10('0x3b')]=_[_0xbb10('0x3c')](db[_0xbb10('0x5c')]['rawAttributes']);_0x270fdb[_0xbb10('0x3d')]=_['keys'](_0x1ad2ed['query']);_0x270fdb['filters']=_[_0xbb10('0x40')](_0x270fdb[_0xbb10('0x3b')],_0x270fdb[_0xbb10('0x3d')]);_0x15fae2[_0xbb10('0x3f')]=_['intersection'](_0x270fdb[_0xbb10('0x3b')],qs['fields'](_0x1ad2ed['query'][_0xbb10('0x41')]));_0x15fae2[_0xbb10('0x3f')]=_0x15fae2[_0xbb10('0x3f')][_0xbb10('0x42')]?_0x15fae2[_0xbb10('0x3f')]:_0x270fdb['model'];_0x15fae2[_0xbb10('0x58')]=qs[_0xbb10('0x45')](_0x1ad2ed[_0xbb10('0x3d')][_0xbb10('0x45')]);_0x15fae2[_0xbb10('0x47')]=qs[_0xbb10('0x3e')](_[_0xbb10('0x59')](_0x1ad2ed['query'],_0x270fdb[_0xbb10('0x3e')]));if(_0x1ad2ed[_0xbb10('0x3d')][_0xbb10('0x46')]){_0x15fae2[_0xbb10('0x47')]=_[_0xbb10('0x48')](_0x15fae2[_0xbb10('0x47')],{'$or':_[_0xbb10('0x39')](_0x15fae2[_0xbb10('0x3f')],function(_0x5a4429){var _0x428146={};_0x428146[_0x5a4429]={'$like':'%'+_0x1ad2ed[_0xbb10('0x3d')][_0xbb10('0x46')]+'%'};return _0x428146;})});}_0x15fae2=_['merge']({},_0x15fae2,_0x1ad2ed['options']);return _0x14f16b['getSubjects'](_0x15fae2);}})[_0xbb10('0x20')](function(_0x5a3c44){if(_0x5a3c44){_0x2aaaa6=_0x5a3c44['length'];if(!_0x1ad2ed[_0xbb10('0x3d')][_0xbb10('0x5a')](_0xbb10('0x43'))){_0x15fae2[_0xbb10('0x44')]=qs[_0xbb10('0x44')](_0x1ad2ed[_0xbb10('0x3d')][_0xbb10('0x44')]);_0x15fae2[_0xbb10('0x31')]=qs[_0xbb10('0x31')](_0x1ad2ed['query'][_0xbb10('0x31')]);}return _0x14f16b[_0xbb10('0x5b')](_0x15fae2);}})[_0xbb10('0x20')](function(_0x35b811){if(_0x35b811){return _0x35b811?{'count':_0x2aaaa6,'rows':_0x35b811}:null;}})['then'](respondWithResult(_0x4cf2f3,null))['catch'](handleError(_0x4cf2f3,null));};exports[_0xbb10('0x5d')]=function(_0x2280bd,_0x30f0a4,_0x32bb25){var _0x5ee705={};var _0x17d596={};var _0x275bce;var _0x3f0d74;return db[_0xbb10('0x4e')][_0xbb10('0x57')]({'where':{'id':_0x2280bd['params']['id']}})['then'](handleEntityNotFound(_0x30f0a4,null))[_0xbb10('0x20')](function(_0x53c698){if(_0x53c698){_0x275bce=_0x53c698;_0x17d596[_0xbb10('0x3b')]=_['keys'](db[_0xbb10('0x5c')][_0xbb10('0x3a')]);_0x17d596['query']=_['keys'](_0x2280bd[_0xbb10('0x3d')]);_0x17d596[_0xbb10('0x3e')]=_[_0xbb10('0x40')](_0x17d596['model'],_0x17d596[_0xbb10('0x3d')]);_0x5ee705[_0xbb10('0x3f')]=_[_0xbb10('0x40')](_0x17d596[_0xbb10('0x3b')],qs[_0xbb10('0x41')](_0x2280bd[_0xbb10('0x3d')][_0xbb10('0x41')]));_0x5ee705[_0xbb10('0x3f')]=_0x5ee705[_0xbb10('0x3f')]['length']?_0x5ee705[_0xbb10('0x3f')]:_0x17d596[_0xbb10('0x3b')];_0x5ee705[_0xbb10('0x58')]=qs[_0xbb10('0x45')](_0x2280bd[_0xbb10('0x3d')][_0xbb10('0x45')]);_0x5ee705[_0xbb10('0x47')]=qs[_0xbb10('0x3e')](_[_0xbb10('0x59')](_0x2280bd[_0xbb10('0x3d')],_0x17d596[_0xbb10('0x3e')]));if(_0x2280bd[_0xbb10('0x3d')]['filter']){_0x5ee705['where']=_[_0xbb10('0x48')](_0x5ee705[_0xbb10('0x47')],{'$or':_[_0xbb10('0x39')](_0x5ee705[_0xbb10('0x3f')],function(_0x238c7a){var _0x4a717a={};_0x4a717a[_0x238c7a]={'$like':'%'+_0x2280bd[_0xbb10('0x3d')][_0xbb10('0x46')]+'%'};return _0x4a717a;})});}_0x5ee705=_[_0xbb10('0x48')]({},_0x5ee705,_0x2280bd[_0xbb10('0x4b')]);return _0x275bce[_0xbb10('0x5d')](_0x5ee705);}})[_0xbb10('0x20')](function(_0x546db5){if(_0x546db5){_0x3f0d74=_0x546db5[_0xbb10('0x42')];if(!_0x2280bd[_0xbb10('0x3d')]['hasOwnProperty'](_0xbb10('0x43'))){_0x5ee705['limit']=qs[_0xbb10('0x44')](_0x2280bd[_0xbb10('0x3d')][_0xbb10('0x44')]);_0x5ee705[_0xbb10('0x31')]=qs[_0xbb10('0x31')](_0x2280bd['query'][_0xbb10('0x31')]);}return _0x275bce['getDescriptions'](_0x5ee705);}})[_0xbb10('0x20')](function(_0x37ec93){if(_0x37ec93){return _0x37ec93?{'count':_0x3f0d74,'rows':_0x37ec93}:null;}})['then'](respondWithResult(_0x30f0a4,null))['catch'](handleError(_0x30f0a4,null));}; \ No newline at end of file +var _0xd8b0=['papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','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~!@#$%^&-_=+[{]}.','then','info','ServicenowConfiguration,\x20%s,\x20%s','request\x20sent','debug','ServicenowConfiguration,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','sendStatus','end','json','offset','limit','set','Content-Range','save','update','destroy','status','stack','name','send','ServicenowConfiguration','fieldName','type','key','model','map','keys','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','sort','where','merge','VIRTUAL','filter','count','includeAll','include','findAll','rows','show','params','rawAttributes','find','create','body','findOne','length','order','pick','options','getFields','ServicenowField','getSubjects','getDescriptions','html-pdf','eml-format','request-promise','moment','bluebird','mustache','util','to-csv','ejs','lodash','crypto','jsforce','querystring'];(function(_0x26d1c1,_0x143bcd){var _0x2f7b9d=function(_0x4d3548){while(--_0x4d3548){_0x26d1c1['push'](_0x26d1c1['shift']());}};_0x2f7b9d(++_0x143bcd);}(_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'];var jayson=require(_0x0d8b('0x16'));var client=jayson[_0x0d8b('0x17')][_0x0d8b('0x18')]({'port':0x232a});function checkPasswordPattern(_0x32bb1a,_0x15dd0f,_0x31a8cc){if(_0x31a8cc){var _0x1d4bbc=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x1d4bbc[_0x0d8b('0x19')](_0x15dd0f)){return _0x32bb1a;}else{throw new db[(_0x0d8b('0x1a'))][(_0x0d8b('0x1b'))](_0x0d8b('0x1c'));}}else{return _0x32bb1a;}}function respondWithRpcPromise(_0x2d4e1c,_0x4f6f21,_0x23eb7b,_0xa86349){return new BPromise(function(_0x17f7df,_0xe2e167){var _0x2cb03c=_0xa86349||client;return _0x2cb03c['request'](_0x2d4e1c,_0x23eb7b)[_0x0d8b('0x1d')](function(_0x4586c2){logger[_0x0d8b('0x1e')](_0x0d8b('0x1f'),_0x4f6f21,_0x0d8b('0x20'));logger[_0x0d8b('0x21')](_0x0d8b('0x22'),_0x4f6f21,_0x0d8b('0x20'),JSON['stringify'](_0x4586c2));if(_0x4586c2[_0x0d8b('0x23')]){if(_0x4586c2[_0x0d8b('0x23')][_0x0d8b('0x24')]===0x1f4){logger[_0x0d8b('0x23')](_0x0d8b('0x1f'),_0x4f6f21,_0x4586c2[_0x0d8b('0x23')][_0x0d8b('0x25')]);return _0xe2e167(_0x4586c2[_0x0d8b('0x23')]['message']);}logger['error'](_0x0d8b('0x1f'),_0x4f6f21,_0x4586c2['error']['message']);return _0x17f7df(_0x4586c2['error'][_0x0d8b('0x25')]);}else{logger[_0x0d8b('0x1e')](_0x0d8b('0x1f'),_0x4f6f21,_0x0d8b('0x20'));_0x17f7df(_0x4586c2[_0x0d8b('0x26')][_0x0d8b('0x25')]);}})[_0x0d8b('0x27')](function(_0x4562cb){logger[_0x0d8b('0x23')]('ServicenowConfiguration,\x20%s,\x20%s',_0x4f6f21,_0x4562cb);_0xe2e167(_0x4562cb);});});}function respondWithStatusCode(_0xe8bbee,_0x4463ee){_0x4463ee=_0x4463ee||0xcc;return function(_0x5363e3){if(_0x5363e3){return _0xe8bbee[_0x0d8b('0x28')](_0x4463ee);}return _0xe8bbee['status'](_0x4463ee)[_0x0d8b('0x29')]();};}function respondWithResult(_0x234bdd,_0xa2af02){_0xa2af02=_0xa2af02||0xc8;return function(_0x4fe6f9){if(_0x4fe6f9){return _0x234bdd['status'](_0xa2af02)[_0x0d8b('0x2a')](_0x4fe6f9);}};}function respondWithFilteredResult(_0x3ef745,_0x4c05ee){return function(_0xcbc4ac){if(_0xcbc4ac){var _0x59aa83=_0xcbc4ac['count'],_0x1b2b59=_0x4c05ee[_0x0d8b('0x2b')],_0x4b59e5=_0x4c05ee['offset']+_0x4c05ee[_0x0d8b('0x2c')],_0x97050a;if(_0x4b59e5>=_0x59aa83){_0x4b59e5=_0x59aa83;_0x97050a=0xc8;}else{_0x97050a=0xce;}_0x3ef745['status'](_0x97050a);return _0x3ef745[_0x0d8b('0x2d')](_0x0d8b('0x2e'),_0x1b2b59+'-'+_0x4b59e5+'/'+_0x59aa83)[_0x0d8b('0x2a')](_0xcbc4ac);}return null;};}function patchUpdates(_0x56120a){return function(_0x4c80a2){try{jsonpatch['apply'](_0x4c80a2,_0x56120a,!![]);}catch(_0x4e8992){return BPromise['reject'](_0x4e8992);}return _0x4c80a2[_0x0d8b('0x2f')]();};}function saveUpdates(_0x54f6f3,_0x5d05fc){return function(_0x36017a){if(_0x36017a){return _0x36017a[_0x0d8b('0x30')](_0x54f6f3)[_0x0d8b('0x1d')](function(_0xdeee5d){return _0xdeee5d;});}return null;};}function removeEntity(_0x183220,_0xeaa769){return function(_0x4a99d3){if(_0x4a99d3){return _0x4a99d3[_0x0d8b('0x31')]()['then'](function(){_0x183220[_0x0d8b('0x32')](0xcc)[_0x0d8b('0x29')]();});}};}function handleEntityNotFound(_0x4b3ea0,_0xb18586){return function(_0x23f7f6){if(!_0x23f7f6){_0x4b3ea0[_0x0d8b('0x28')](0x194);}return _0x23f7f6;};}function handleError(_0x4f2ed2,_0x113318){_0x113318=_0x113318||0x1f4;return function(_0x2c507e){logger[_0x0d8b('0x23')](_0x2c507e[_0x0d8b('0x33')]);if(_0x2c507e[_0x0d8b('0x34')]){delete _0x2c507e['name'];}_0x4f2ed2[_0x0d8b('0x32')](_0x113318)[_0x0d8b('0x35')](_0x2c507e);};}exports['index']=function(_0x1180ac,_0x3cc3ee){var _0x188af2={},_0x974b9b={},_0x373544={'count':0x0,'rows':[]};var _0x519088=_['map'](db[_0x0d8b('0x36')]['rawAttributes'],function(_0x531c55){return{'name':_0x531c55[_0x0d8b('0x37')],'type':_0x531c55[_0x0d8b('0x38')][_0x0d8b('0x39')]};});_0x974b9b[_0x0d8b('0x3a')]=_[_0x0d8b('0x3b')](_0x519088,_0x0d8b('0x34'));_0x974b9b['query']=_[_0x0d8b('0x3c')](_0x1180ac[_0x0d8b('0x3d')]);_0x974b9b[_0x0d8b('0x3e')]=_[_0x0d8b('0x3f')](_0x974b9b[_0x0d8b('0x3a')],_0x974b9b[_0x0d8b('0x3d')]);_0x188af2[_0x0d8b('0x40')]=_['intersection'](_0x974b9b[_0x0d8b('0x3a')],qs[_0x0d8b('0x41')](_0x1180ac[_0x0d8b('0x3d')][_0x0d8b('0x41')]));_0x188af2['attributes']=_0x188af2[_0x0d8b('0x40')]['length']?_0x188af2[_0x0d8b('0x40')]:_0x974b9b[_0x0d8b('0x3a')];if(!_0x1180ac[_0x0d8b('0x3d')][_0x0d8b('0x42')](_0x0d8b('0x43'))){_0x188af2[_0x0d8b('0x2c')]=qs[_0x0d8b('0x2c')](_0x1180ac[_0x0d8b('0x3d')][_0x0d8b('0x2c')]);_0x188af2[_0x0d8b('0x2b')]=qs['offset'](_0x1180ac['query']['offset']);}_0x188af2['order']=qs['sort'](_0x1180ac[_0x0d8b('0x3d')][_0x0d8b('0x44')]);_0x188af2[_0x0d8b('0x45')]=qs['filters'](_['pick'](_0x1180ac[_0x0d8b('0x3d')],_0x974b9b[_0x0d8b('0x3e')]),_0x519088);if(_0x1180ac[_0x0d8b('0x3d')]['filter']){_0x188af2[_0x0d8b('0x45')]=_[_0x0d8b('0x46')](_0x188af2['where'],{'$or':_['map'](_0x519088,function(_0x372740){if(_0x372740['type']!==_0x0d8b('0x47')){var _0x5a96b1={};_0x5a96b1[_0x372740['name']]={'$like':'%'+_0x1180ac[_0x0d8b('0x3d')][_0x0d8b('0x48')]+'%'};return _0x5a96b1;}})});}_0x188af2=_['merge']({},_0x188af2,_0x1180ac['options']);var _0x59b8e9={'where':_0x188af2['where']};return db[_0x0d8b('0x36')][_0x0d8b('0x49')](_0x59b8e9)[_0x0d8b('0x1d')](function(_0x490eda){_0x373544[_0x0d8b('0x49')]=_0x490eda;if(_0x1180ac[_0x0d8b('0x3d')][_0x0d8b('0x4a')]){_0x188af2[_0x0d8b('0x4b')]=[{'all':!![]}];}return db[_0x0d8b('0x36')][_0x0d8b('0x4c')](_0x188af2);})[_0x0d8b('0x1d')](function(_0x1d5067){_0x373544[_0x0d8b('0x4d')]=_0x1d5067;return _0x373544;})[_0x0d8b('0x1d')](respondWithFilteredResult(_0x3cc3ee,_0x188af2))[_0x0d8b('0x27')](handleError(_0x3cc3ee,null));};exports[_0x0d8b('0x4e')]=function(_0x84ef1c,_0x3e569b){var _0x570af8={'raw':![],'where':{'id':_0x84ef1c[_0x0d8b('0x4f')]['id']}},_0xdfcf32={};_0xdfcf32[_0x0d8b('0x3a')]=_[_0x0d8b('0x3c')](db['ServicenowConfiguration'][_0x0d8b('0x50')]);_0xdfcf32['query']=_['keys'](_0x84ef1c[_0x0d8b('0x3d')]);_0xdfcf32[_0x0d8b('0x3e')]=_[_0x0d8b('0x3f')](_0xdfcf32[_0x0d8b('0x3a')],_0xdfcf32['query']);_0x570af8[_0x0d8b('0x40')]=_[_0x0d8b('0x3f')](_0xdfcf32[_0x0d8b('0x3a')],qs[_0x0d8b('0x41')](_0x84ef1c[_0x0d8b('0x3d')]['fields']));_0x570af8['attributes']=_0x570af8['attributes']['length']?_0x570af8[_0x0d8b('0x40')]:_0xdfcf32[_0x0d8b('0x3a')];if(_0x84ef1c['query']['includeAll']){_0x570af8[_0x0d8b('0x4b')]=[{'all':!![]}];}_0x570af8=_[_0x0d8b('0x46')]({},_0x570af8,_0x84ef1c['options']);return db['ServicenowConfiguration'][_0x0d8b('0x51')](_0x570af8)[_0x0d8b('0x1d')](handleEntityNotFound(_0x3e569b,null))[_0x0d8b('0x1d')](respondWithResult(_0x3e569b,null))[_0x0d8b('0x27')](handleError(_0x3e569b,null));};exports[_0x0d8b('0x52')]=function(_0x506a79,_0x2de903){return db[_0x0d8b('0x36')]['create'](_0x506a79['body'],{})[_0x0d8b('0x1d')](respondWithResult(_0x2de903,0xc9))[_0x0d8b('0x27')](handleError(_0x2de903,null));};exports['update']=function(_0x55a489,_0xb8be3b){if(_0x55a489[_0x0d8b('0x53')]['id']){delete _0x55a489[_0x0d8b('0x53')]['id'];}return db[_0x0d8b('0x36')]['find']({'where':{'id':_0x55a489[_0x0d8b('0x4f')]['id']}})['then'](handleEntityNotFound(_0xb8be3b,null))['then'](saveUpdates(_0x55a489[_0x0d8b('0x53')],null))[_0x0d8b('0x1d')](respondWithResult(_0xb8be3b,null))['catch'](handleError(_0xb8be3b,null));};exports['destroy']=function(_0x44ed23,_0x3d7161){return db[_0x0d8b('0x36')][_0x0d8b('0x51')]({'where':{'id':_0x44ed23[_0x0d8b('0x4f')]['id']}})[_0x0d8b('0x1d')](handleEntityNotFound(_0x3d7161,null))[_0x0d8b('0x1d')](removeEntity(_0x3d7161,null))[_0x0d8b('0x27')](handleError(_0x3d7161,null));};exports['getFields']=function(_0x24a859,_0x37dc9f,_0x3a3d33){var _0x3c7efb={};var _0x3fb9ea={};var _0x47104e;var _0x70c8c4;return db[_0x0d8b('0x36')][_0x0d8b('0x54')]({'where':{'id':_0x24a859['params']['id']}})[_0x0d8b('0x1d')](handleEntityNotFound(_0x37dc9f,null))[_0x0d8b('0x1d')](function(_0x180b7b){if(_0x180b7b){_0x47104e=_0x180b7b;_0x3fb9ea[_0x0d8b('0x3a')]=_[_0x0d8b('0x3c')](db['ServicenowField'][_0x0d8b('0x50')]);_0x3fb9ea[_0x0d8b('0x3d')]=_[_0x0d8b('0x3c')](_0x24a859[_0x0d8b('0x3d')]);_0x3fb9ea[_0x0d8b('0x3e')]=_['intersection'](_0x3fb9ea['model'],_0x3fb9ea[_0x0d8b('0x3d')]);_0x3c7efb[_0x0d8b('0x40')]=_[_0x0d8b('0x3f')](_0x3fb9ea[_0x0d8b('0x3a')],qs['fields'](_0x24a859[_0x0d8b('0x3d')][_0x0d8b('0x41')]));_0x3c7efb[_0x0d8b('0x40')]=_0x3c7efb['attributes'][_0x0d8b('0x55')]?_0x3c7efb['attributes']:_0x3fb9ea[_0x0d8b('0x3a')];_0x3c7efb[_0x0d8b('0x56')]=qs[_0x0d8b('0x44')](_0x24a859[_0x0d8b('0x3d')][_0x0d8b('0x44')]);_0x3c7efb[_0x0d8b('0x45')]=qs['filters'](_[_0x0d8b('0x57')](_0x24a859['query'],_0x3fb9ea[_0x0d8b('0x3e')]));if(_0x24a859[_0x0d8b('0x3d')][_0x0d8b('0x48')]){_0x3c7efb[_0x0d8b('0x45')]=_['merge'](_0x3c7efb[_0x0d8b('0x45')],{'$or':_[_0x0d8b('0x3b')](_0x3c7efb[_0x0d8b('0x40')],function(_0x2332fc){var _0x2ccdae={};_0x2ccdae[_0x2332fc]={'$like':'%'+_0x24a859[_0x0d8b('0x3d')][_0x0d8b('0x48')]+'%'};return _0x2ccdae;})});}_0x3c7efb=_[_0x0d8b('0x46')]({},_0x3c7efb,_0x24a859[_0x0d8b('0x58')]);return _0x47104e[_0x0d8b('0x59')](_0x3c7efb);}})['then'](function(_0x4ee1e8){if(_0x4ee1e8){_0x70c8c4=_0x4ee1e8[_0x0d8b('0x55')];if(!_0x24a859[_0x0d8b('0x3d')]['hasOwnProperty'](_0x0d8b('0x43'))){_0x3c7efb['limit']=qs['limit'](_0x24a859[_0x0d8b('0x3d')][_0x0d8b('0x2c')]);_0x3c7efb['offset']=qs['offset'](_0x24a859[_0x0d8b('0x3d')][_0x0d8b('0x2b')]);}return _0x47104e[_0x0d8b('0x59')](_0x3c7efb);}})[_0x0d8b('0x1d')](function(_0x2ab72b){if(_0x2ab72b){return _0x2ab72b?{'count':_0x70c8c4,'rows':_0x2ab72b}:null;}})[_0x0d8b('0x1d')](respondWithResult(_0x37dc9f,null))[_0x0d8b('0x27')](handleError(_0x37dc9f,null));};exports['getSubjects']=function(_0x1ca60c,_0x5878c2,_0x1a203e){var _0x2c6242={};var _0x2bb690={};var _0x14a34b;var _0x49f610;return db[_0x0d8b('0x36')]['findOne']({'where':{'id':_0x1ca60c[_0x0d8b('0x4f')]['id']}})[_0x0d8b('0x1d')](handleEntityNotFound(_0x5878c2,null))[_0x0d8b('0x1d')](function(_0x2ebea3){if(_0x2ebea3){_0x14a34b=_0x2ebea3;_0x2bb690[_0x0d8b('0x3a')]=_[_0x0d8b('0x3c')](db[_0x0d8b('0x5a')][_0x0d8b('0x50')]);_0x2bb690[_0x0d8b('0x3d')]=_[_0x0d8b('0x3c')](_0x1ca60c['query']);_0x2bb690[_0x0d8b('0x3e')]=_['intersection'](_0x2bb690[_0x0d8b('0x3a')],_0x2bb690[_0x0d8b('0x3d')]);_0x2c6242['attributes']=_[_0x0d8b('0x3f')](_0x2bb690['model'],qs[_0x0d8b('0x41')](_0x1ca60c[_0x0d8b('0x3d')][_0x0d8b('0x41')]));_0x2c6242[_0x0d8b('0x40')]=_0x2c6242[_0x0d8b('0x40')][_0x0d8b('0x55')]?_0x2c6242[_0x0d8b('0x40')]:_0x2bb690[_0x0d8b('0x3a')];_0x2c6242['order']=qs[_0x0d8b('0x44')](_0x1ca60c[_0x0d8b('0x3d')]['sort']);_0x2c6242[_0x0d8b('0x45')]=qs[_0x0d8b('0x3e')](_[_0x0d8b('0x57')](_0x1ca60c[_0x0d8b('0x3d')],_0x2bb690[_0x0d8b('0x3e')]));if(_0x1ca60c[_0x0d8b('0x3d')][_0x0d8b('0x48')]){_0x2c6242[_0x0d8b('0x45')]=_[_0x0d8b('0x46')](_0x2c6242[_0x0d8b('0x45')],{'$or':_[_0x0d8b('0x3b')](_0x2c6242[_0x0d8b('0x40')],function(_0x50c0ff){var _0x1ece98={};_0x1ece98[_0x50c0ff]={'$like':'%'+_0x1ca60c[_0x0d8b('0x3d')][_0x0d8b('0x48')]+'%'};return _0x1ece98;})});}_0x2c6242=_['merge']({},_0x2c6242,_0x1ca60c['options']);return _0x14a34b[_0x0d8b('0x5b')](_0x2c6242);}})[_0x0d8b('0x1d')](function(_0x2c55bc){if(_0x2c55bc){_0x49f610=_0x2c55bc['length'];if(!_0x1ca60c['query'][_0x0d8b('0x42')](_0x0d8b('0x43'))){_0x2c6242[_0x0d8b('0x2c')]=qs[_0x0d8b('0x2c')](_0x1ca60c[_0x0d8b('0x3d')][_0x0d8b('0x2c')]);_0x2c6242[_0x0d8b('0x2b')]=qs[_0x0d8b('0x2b')](_0x1ca60c[_0x0d8b('0x3d')][_0x0d8b('0x2b')]);}return _0x14a34b[_0x0d8b('0x5b')](_0x2c6242);}})[_0x0d8b('0x1d')](function(_0x3b060e){if(_0x3b060e){return _0x3b060e?{'count':_0x49f610,'rows':_0x3b060e}:null;}})['then'](respondWithResult(_0x5878c2,null))[_0x0d8b('0x27')](handleError(_0x5878c2,null));};exports[_0x0d8b('0x5c')]=function(_0x48c965,_0x51c41b,_0x1a1029){var _0x1dad9f={};var _0x3573b4={};var _0x14b1b8;var _0x23e2e0;return db[_0x0d8b('0x36')]['findOne']({'where':{'id':_0x48c965['params']['id']}})['then'](handleEntityNotFound(_0x51c41b,null))[_0x0d8b('0x1d')](function(_0xce759e){if(_0xce759e){_0x14b1b8=_0xce759e;_0x3573b4[_0x0d8b('0x3a')]=_[_0x0d8b('0x3c')](db[_0x0d8b('0x5a')][_0x0d8b('0x50')]);_0x3573b4['query']=_[_0x0d8b('0x3c')](_0x48c965[_0x0d8b('0x3d')]);_0x3573b4['filters']=_[_0x0d8b('0x3f')](_0x3573b4['model'],_0x3573b4[_0x0d8b('0x3d')]);_0x1dad9f[_0x0d8b('0x40')]=_[_0x0d8b('0x3f')](_0x3573b4[_0x0d8b('0x3a')],qs[_0x0d8b('0x41')](_0x48c965[_0x0d8b('0x3d')][_0x0d8b('0x41')]));_0x1dad9f[_0x0d8b('0x40')]=_0x1dad9f[_0x0d8b('0x40')][_0x0d8b('0x55')]?_0x1dad9f[_0x0d8b('0x40')]:_0x3573b4[_0x0d8b('0x3a')];_0x1dad9f['order']=qs['sort'](_0x48c965[_0x0d8b('0x3d')][_0x0d8b('0x44')]);_0x1dad9f[_0x0d8b('0x45')]=qs[_0x0d8b('0x3e')](_[_0x0d8b('0x57')](_0x48c965[_0x0d8b('0x3d')],_0x3573b4[_0x0d8b('0x3e')]));if(_0x48c965['query'][_0x0d8b('0x48')]){_0x1dad9f['where']=_[_0x0d8b('0x46')](_0x1dad9f['where'],{'$or':_['map'](_0x1dad9f[_0x0d8b('0x40')],function(_0x460a36){var _0x25d99f={};_0x25d99f[_0x460a36]={'$like':'%'+_0x48c965[_0x0d8b('0x3d')][_0x0d8b('0x48')]+'%'};return _0x25d99f;})});}_0x1dad9f=_[_0x0d8b('0x46')]({},_0x1dad9f,_0x48c965[_0x0d8b('0x58')]);return _0x14b1b8[_0x0d8b('0x5c')](_0x1dad9f);}})[_0x0d8b('0x1d')](function(_0x20a8b6){if(_0x20a8b6){_0x23e2e0=_0x20a8b6[_0x0d8b('0x55')];if(!_0x48c965[_0x0d8b('0x3d')]['hasOwnProperty'](_0x0d8b('0x43'))){_0x1dad9f[_0x0d8b('0x2c')]=qs[_0x0d8b('0x2c')](_0x48c965['query']['limit']);_0x1dad9f[_0x0d8b('0x2b')]=qs[_0x0d8b('0x2b')](_0x48c965[_0x0d8b('0x3d')][_0x0d8b('0x2b')]);}return _0x14b1b8[_0x0d8b('0x5c')](_0x1dad9f);}})[_0x0d8b('0x1d')](function(_0x5648eb){if(_0x5648eb){return _0x5648eb?{'count':_0x23e2e0,'rows':_0x5648eb}:null;}})[_0x0d8b('0x1d')](respondWithResult(_0x51c41b,null))[_0x0d8b('0x27')](handleError(_0x51c41b,null));}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.model.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.model.js index c38a2cb..cdc01cf 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 _0x9632=['./intServicenowConfiguration.attributes','exports','define','ServicenowConfiguration','int_servicenow_configurations','lodash','util','../../config/logger','api','moment','bluebird','request-promise','../../config/environment'];(function(_0x39321a,_0x35d871){var _0x58afa3=function(_0xf79959){while(--_0xf79959){_0x39321a['push'](_0x39321a['shift']());}};_0x58afa3(++_0x35d871);}(_0x9632,0x109));var _0x2963=function(_0x5bbe0c,_0x369181){_0x5bbe0c=_0x5bbe0c-0x0;var _0x2ba2b1=_0x9632[_0x5bbe0c];return _0x2ba2b1;};'use strict';var _=require(_0x2963('0x0'));var util=require(_0x2963('0x1'));var logger=require(_0x2963('0x2'))(_0x2963('0x3'));var moment=require(_0x2963('0x4'));var BPromise=require(_0x2963('0x5'));var rp=require(_0x2963('0x6'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x2963('0x7'));var attributes=require(_0x2963('0x8'));module[_0x2963('0x9')]=function(_0x2fc42a,_0x9621dc){return _0x2fc42a[_0x2963('0xa')](_0x2963('0xb'),attributes,{'tableName':_0x2963('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0f1c=['request-promise','path','../../config/environment','int_servicenow_configurations','lodash','../../config/logger','api','moment'];(function(_0x49710d,_0x561fb5){var _0x464572=function(_0x3f3df8){while(--_0x3f3df8){_0x49710d['push'](_0x49710d['shift']());}};_0x464572(++_0x561fb5);}(_0x0f1c,0x17c));var _0xc0f1=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0f1c[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xc0f1('0x0'));var util=require('util');var logger=require(_0xc0f1('0x1'))(_0xc0f1('0x2'));var moment=require(_0xc0f1('0x3'));var BPromise=require('bluebird');var rp=require(_0xc0f1('0x4'));var fs=require('fs');var path=require(_0xc0f1('0x5'));var rimraf=require('rimraf');var config=require(_0xc0f1('0x6'));var attributes=require('./intServicenowConfiguration.attributes');module['exports']=function(_0x22f099,_0x2658d4){return _0x22f099['define']('ServicenowConfiguration',attributes,{'tableName':_0xc0f1('0x7'),'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 760620c..2b30ccd 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 _0x3a5b=['info','ServicenowConfiguration,\x20%s,\x20%s','request\x20sent','debug','ServicenowConfiguration,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then'];(function(_0xc79980,_0x5a7c1e){var _0x9cce53=function(_0xf1eae5){while(--_0xf1eae5){_0xc79980['push'](_0xc79980['shift']());}};_0x9cce53(++_0x5a7c1e);}(_0x3a5b,0xf4));var _0xb3a5=function(_0x11ed52,_0xe2c31f){_0x11ed52=_0x11ed52-0x0;var _0xeee5ea=_0x3a5b[_0x11ed52];return _0xeee5ea;};'use strict';var _=require(_0xb3a5('0x0'));var util=require(_0xb3a5('0x1'));var moment=require(_0xb3a5('0x2'));var BPromise=require(_0xb3a5('0x3'));var rs=require(_0xb3a5('0x4'));var fs=require('fs');var Redis=require(_0xb3a5('0x5'));var db=require(_0xb3a5('0x6'))['db'];var utils=require(_0xb3a5('0x7'));var logger=require(_0xb3a5('0x8'))(_0xb3a5('0x9'));var config=require(_0xb3a5('0xa'));var jayson=require(_0xb3a5('0xb'));var client=jayson[_0xb3a5('0xc')][_0xb3a5('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x320ceb,_0x551ca5,_0x58d7f4){return new BPromise(function(_0x195fc4,_0x104af3){return client[_0xb3a5('0xe')](_0x320ceb,_0x58d7f4)[_0xb3a5('0xf')](function(_0x572ad8){logger[_0xb3a5('0x10')](_0xb3a5('0x11'),_0x551ca5,_0xb3a5('0x12'));logger[_0xb3a5('0x13')](_0xb3a5('0x14'),_0x551ca5,_0xb3a5('0x12'),JSON['stringify'](_0x572ad8));if(_0x572ad8[_0xb3a5('0x15')]){if(_0x572ad8[_0xb3a5('0x15')][_0xb3a5('0x16')]===0x1f4){logger[_0xb3a5('0x15')](_0xb3a5('0x11'),_0x551ca5,_0x572ad8[_0xb3a5('0x15')][_0xb3a5('0x17')]);return _0x104af3(_0x572ad8[_0xb3a5('0x15')][_0xb3a5('0x17')]);}logger[_0xb3a5('0x15')](_0xb3a5('0x11'),_0x551ca5,_0x572ad8[_0xb3a5('0x15')][_0xb3a5('0x17')]);return _0x195fc4(_0x572ad8[_0xb3a5('0x15')][_0xb3a5('0x17')]);}else{logger[_0xb3a5('0x10')](_0xb3a5('0x11'),_0x551ca5,_0xb3a5('0x12'));_0x195fc4(_0x572ad8[_0xb3a5('0x18')][_0xb3a5('0x17')]);}})[_0xb3a5('0x19')](function(_0x426e9b){logger[_0xb3a5('0x15')](_0xb3a5('0x11'),_0x551ca5,_0x426e9b);_0x104af3(_0x426e9b);});});} \ No newline at end of file +var _0x6470=['message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','info','request\x20sent','debug','stringify','error','code','ServicenowConfiguration,\x20%s,\x20%s'];(function(_0x4a9a58,_0x8671ee){var _0x5c6e6f=function(_0x62d046){while(--_0x62d046){_0x4a9a58['push'](_0x4a9a58['shift']());}};_0x5c6e6f(++_0x8671ee);}(_0x6470,0x76));var _0x0647=function(_0x416d32,_0x1c3ecb){_0x416d32=_0x416d32-0x0;var _0x267982=_0x6470[_0x416d32];return _0x267982;};'use strict';var _=require(_0x0647('0x0'));var util=require('util');var moment=require(_0x0647('0x1'));var BPromise=require(_0x0647('0x2'));var rs=require(_0x0647('0x3'));var fs=require('fs');var Redis=require(_0x0647('0x4'));var db=require(_0x0647('0x5'))['db'];var utils=require(_0x0647('0x6'));var logger=require(_0x0647('0x7'))(_0x0647('0x8'));var config=require(_0x0647('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x0647('0xa')][_0x0647('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1c4fcb,_0x214ecd,_0x4b7e0f){return new BPromise(function(_0x4b9bc2,_0x3065c4){return client[_0x0647('0xc')](_0x1c4fcb,_0x4b7e0f)['then'](function(_0x37f74a){logger[_0x0647('0xd')]('ServicenowConfiguration,\x20%s,\x20%s',_0x214ecd,_0x0647('0xe'));logger[_0x0647('0xf')]('ServicenowConfiguration,\x20%s,\x20%s,\x20%s',_0x214ecd,_0x0647('0xe'),JSON[_0x0647('0x10')](_0x37f74a));if(_0x37f74a['error']){if(_0x37f74a[_0x0647('0x11')][_0x0647('0x12')]===0x1f4){logger[_0x0647('0x11')](_0x0647('0x13'),_0x214ecd,_0x37f74a[_0x0647('0x11')][_0x0647('0x14')]);return _0x3065c4(_0x37f74a[_0x0647('0x11')][_0x0647('0x14')]);}logger[_0x0647('0x11')](_0x0647('0x13'),_0x214ecd,_0x37f74a[_0x0647('0x11')][_0x0647('0x14')]);return _0x4b9bc2(_0x37f74a['error'][_0x0647('0x14')]);}else{logger[_0x0647('0xd')]('ServicenowConfiguration,\x20%s,\x20%s',_0x214ecd,_0x0647('0xe'));_0x4b9bc2(_0x37f74a[_0x0647('0x15')][_0x0647('0x14')]);}})[_0x0647('0x16')](function(_0x545f6a){logger[_0x0647('0x11')](_0x0647('0x13'),_0x214ecd,_0x545f6a);_0x3065c4(_0x545f6a);});});} \ No newline at end of file diff --git a/server/api/intServicenowField/index.js b/server/api/intServicenowField/index.js index 65938fb..3aca06f 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 _0xd3bc=['post','create','put','/:id','update','destroy','exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./intServicenowField.controller','isAuthenticated','index','get','show'];(function(_0x2e8418,_0x58c529){var _0x548fe6=function(_0x2b2877){while(--_0x2b2877){_0x2e8418['push'](_0x2e8418['shift']());}};_0x548fe6(++_0x58c529);}(_0xd3bc,0x1e2));var _0xcd3b=function(_0x34ee5e,_0x5b46ad){_0x34ee5e=_0x34ee5e-0x0;var _0xb0bfbb=_0xd3bc[_0x34ee5e];return _0xb0bfbb;};'use strict';var multer=require(_0xcd3b('0x0'));var util=require(_0xcd3b('0x1'));var path=require('path');var timeout=require(_0xcd3b('0x2'));var express=require(_0xcd3b('0x3'));var router=express[_0xcd3b('0x4')]();var auth=require(_0xcd3b('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xcd3b('0x6'));var controller=require(_0xcd3b('0x7'));router['get']('/',auth[_0xcd3b('0x8')](),controller[_0xcd3b('0x9')]);router[_0xcd3b('0xa')]('/:id',auth[_0xcd3b('0x8')](),controller[_0xcd3b('0xb')]);router[_0xcd3b('0xc')]('/',auth[_0xcd3b('0x8')](),controller[_0xcd3b('0xd')]);router[_0xcd3b('0xe')](_0xcd3b('0xf'),auth[_0xcd3b('0x8')](),controller[_0xcd3b('0x10')]);router['delete'](_0xcd3b('0xf'),auth[_0xcd3b('0x8')](),controller[_0xcd3b('0x11')]);module[_0xcd3b('0x12')]=router; \ No newline at end of file +var _0xe60b=['multer','util','path','connect-timeout','../../config/environment','get','index','show','post','isAuthenticated','create','put','/:id','update','delete','destroy'];(function(_0x22590f,_0x16dcf5){var _0x374208=function(_0x143f67){while(--_0x143f67){_0x22590f['push'](_0x22590f['shift']());}};_0x374208(++_0x16dcf5);}(_0xe60b,0x100));var _0xbe60=function(_0x4bee59,_0x3c5751){_0x4bee59=_0x4bee59-0x0;var _0x1b9d18=_0xe60b[_0x4bee59];return _0x1b9d18;};'use strict';var multer=require(_0xbe60('0x0'));var util=require(_0xbe60('0x1'));var path=require(_0xbe60('0x2'));var timeout=require(_0xbe60('0x3'));var express=require('express');var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xbe60('0x4'));var controller=require('./intServicenowField.controller');router[_0xbe60('0x5')]('/',auth['isAuthenticated'](),controller[_0xbe60('0x6')]);router[_0xbe60('0x5')]('/:id',auth['isAuthenticated'](),controller[_0xbe60('0x7')]);router[_0xbe60('0x8')]('/',auth[_0xbe60('0x9')](),controller[_0xbe60('0xa')]);router[_0xbe60('0xb')](_0xbe60('0xc'),auth['isAuthenticated'](),controller[_0xbe60('0xd')]);router[_0xbe60('0xe')](_0xbe60('0xc'),auth[_0xbe60('0x9')](),controller[_0xbe60('0xf')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.attributes.js b/server/api/intServicenowField/intServicenowField.attributes.js index a04cae6..f41a306 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 _0x5d89=['sequelize','exports','ENUM','variable','string','STRING','customVariable','BOOLEAN'];(function(_0x37f9e,_0x5b7424){var _0x2a79f9=function(_0x37b9d0){while(--_0x37b9d0){_0x37f9e['push'](_0x37f9e['shift']());}};_0x2a79f9(++_0x5b7424);}(_0x5d89,0x1e8));var _0x95d8=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x5d89[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x95d8('0x0'));module[_0x95d8('0x1')]={'type':{'type':Sequelize[_0x95d8('0x2')]('string',_0x95d8('0x3'),'customVariable','keyValue'),'defaultValue':_0x95d8('0x4')},'content':{'type':Sequelize[_0x95d8('0x5')]},'key':{'type':Sequelize[_0x95d8('0x5')]},'keyType':{'type':Sequelize['ENUM'](_0x95d8('0x4'),_0x95d8('0x3'),_0x95d8('0x6'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0x95d8('0x5')]},'nameField':{'type':Sequelize[_0x95d8('0x5')]},'customField':{'type':Sequelize[_0x95d8('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x95d8('0x5')]}}; \ No newline at end of file +var _0xf26a=['customVariable','BOOLEAN','sequelize','exports','variable','keyValue','string','STRING','ENUM'];(function(_0x2aea4f,_0x5b6f9b){var _0x2648bf=function(_0x8e4b93){while(--_0x8e4b93){_0x2aea4f['push'](_0x2aea4f['shift']());}};_0x2648bf(++_0x5b6f9b);}(_0xf26a,0x158));var _0xaf26=function(_0x289572,_0x16fcf8){_0x289572=_0x289572-0x0;var _0x5851f1=_0xf26a[_0x289572];return _0x5851f1;};'use strict';var Sequelize=require(_0xaf26('0x0'));module[_0xaf26('0x1')]={'type':{'type':Sequelize['ENUM']('string',_0xaf26('0x2'),'customVariable',_0xaf26('0x3')),'defaultValue':_0xaf26('0x4')},'content':{'type':Sequelize[_0xaf26('0x5')]},'key':{'type':Sequelize[_0xaf26('0x5')]},'keyType':{'type':Sequelize[_0xaf26('0x6')](_0xaf26('0x4'),_0xaf26('0x2'),_0xaf26('0x7'))},'keyContent':{'type':Sequelize[_0xaf26('0x5')]},'idField':{'type':Sequelize[_0xaf26('0x5')]},'nameField':{'type':Sequelize[_0xaf26('0x5')]},'customField':{'type':Sequelize[_0xaf26('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xaf26('0x5')]}}; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.controller.js b/server/api/intServicenowField/intServicenowField.controller.js index d19c48c..917ab6f 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(_0xc76f3,_0x14dd17){var _0x5b6354=function(_0x42dafd){while(--_0x42dafd){_0xc76f3['push'](_0xc76f3['shift']());}};_0x5b6354(++_0x14dd17);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5037ab,_0x43209e){_0x5037ab=_0x5037ab-0x0;var _0x512adb=_0xa9e0[_0x5037ab];return _0x512adb;};'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(_0x5774be,_0x2259d3){var _0x4914b4=function(_0x1eebc3){while(--_0x1eebc3){_0x5774be['push'](_0x5774be['shift']());}};_0x4914b4(++_0x2259d3);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4e1d03,_0x786f3a){_0x4e1d03=_0x4e1d03-0x0;var _0x362d4b=_0xa9e0[_0x4e1d03];return _0x362d4b;};'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 2bda2c8..8763f33 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 _0x9d47=['./intServicenowField.attributes','exports','define','ServicenowField','int_servicenow_fields','idField','FieldId','lodash','api','moment','bluebird','path','rimraf','../../config/environment'];(function(_0x2f37e0,_0x393ef9){var _0x43ccce=function(_0x318b51){while(--_0x318b51){_0x2f37e0['push'](_0x2f37e0['shift']());}};_0x43ccce(++_0x393ef9);}(_0x9d47,0x77));var _0x79d4=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0x9d47[_0x3bf83f];return _0x22c4a9;};'use strict';var _=require(_0x79d4('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x79d4('0x1'));var moment=require(_0x79d4('0x2'));var BPromise=require(_0x79d4('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x79d4('0x4'));var rimraf=require(_0x79d4('0x5'));var config=require(_0x79d4('0x6'));var attributes=require(_0x79d4('0x7'));module[_0x79d4('0x8')]=function(_0x48711e,_0x5299e0){return _0x48711e[_0x79d4('0x9')](_0x79d4('0xa'),attributes,{'tableName':_0x79d4('0xb'),'paranoid':![],'indexes':[{'name':'servicenow_unique_index','fields':[_0x79d4('0xc'),_0x79d4('0xd')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xe840=['rimraf','./intServicenowField.attributes','exports','int_servicenow_fields','servicenow_unique_index','idField','FieldId','util','../../config/logger','api','moment','request-promise','path'];(function(_0x39b482,_0x1924b2){var _0x3cf423=function(_0x3e5746){while(--_0x3e5746){_0x39b482['push'](_0x39b482['shift']());}};_0x3cf423(++_0x1924b2);}(_0xe840,0x1b4));var _0x0e84=function(_0x4eb8cc,_0x4ee1dc){_0x4eb8cc=_0x4eb8cc-0x0;var _0x2f59ee=_0xe840[_0x4eb8cc];return _0x2f59ee;};'use strict';var _=require('lodash');var util=require(_0x0e84('0x0'));var logger=require(_0x0e84('0x1'))(_0x0e84('0x2'));var moment=require(_0x0e84('0x3'));var BPromise=require('bluebird');var rp=require(_0x0e84('0x4'));var fs=require('fs');var path=require(_0x0e84('0x5'));var rimraf=require(_0x0e84('0x6'));var config=require('../../config/environment');var attributes=require(_0x0e84('0x7'));module[_0x0e84('0x8')]=function(_0x1d46e0,_0x528b82){return _0x1d46e0['define']('ServicenowField',attributes,{'tableName':_0x0e84('0x9'),'paranoid':![],'indexes':[{'name':_0x0e84('0xa'),'fields':[_0x0e84('0xb'),_0x0e84('0xc')],'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 ba4bc3e..9e672ea 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 _0x14ac=['request','then','info','ServicenowField,\x20%s,\x20%s','request\x20sent','debug','ServicenowField,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http'];(function(_0x5670cb,_0xe6e20d){var _0x11dc29=function(_0x42305b){while(--_0x42305b){_0x5670cb['push'](_0x5670cb['shift']());}};_0x11dc29(++_0xe6e20d);}(_0x14ac,0x140));var _0xc14a=function(_0x51302c,_0x376113){_0x51302c=_0x51302c-0x0;var _0x20f6c1=_0x14ac[_0x51302c];return _0x20f6c1;};'use strict';var _=require(_0xc14a('0x0'));var util=require(_0xc14a('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xc14a('0x2'));var fs=require('fs');var Redis=require(_0xc14a('0x3'));var db=require(_0xc14a('0x4'))['db'];var utils=require(_0xc14a('0x5'));var logger=require(_0xc14a('0x6'))(_0xc14a('0x7'));var config=require('../../config/environment');var jayson=require(_0xc14a('0x8'));var client=jayson['client'][_0xc14a('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4d0e0e,_0x995eba,_0x5f54b4){return new BPromise(function(_0x2e9747,_0x4a4c73){return client[_0xc14a('0xa')](_0x4d0e0e,_0x5f54b4)[_0xc14a('0xb')](function(_0x5e4c2f){logger[_0xc14a('0xc')](_0xc14a('0xd'),_0x995eba,_0xc14a('0xe'));logger[_0xc14a('0xf')](_0xc14a('0x10'),_0x995eba,'request\x20sent',JSON[_0xc14a('0x11')](_0x5e4c2f));if(_0x5e4c2f[_0xc14a('0x12')]){if(_0x5e4c2f[_0xc14a('0x12')]['code']===0x1f4){logger['error'](_0xc14a('0xd'),_0x995eba,_0x5e4c2f[_0xc14a('0x12')][_0xc14a('0x13')]);return _0x4a4c73(_0x5e4c2f['error'][_0xc14a('0x13')]);}logger[_0xc14a('0x12')](_0xc14a('0xd'),_0x995eba,_0x5e4c2f[_0xc14a('0x12')][_0xc14a('0x13')]);return _0x2e9747(_0x5e4c2f[_0xc14a('0x12')][_0xc14a('0x13')]);}else{logger[_0xc14a('0xc')](_0xc14a('0xd'),_0x995eba,_0xc14a('0xe'));_0x2e9747(_0x5e4c2f[_0xc14a('0x14')][_0xc14a('0x13')]);}})[_0xc14a('0x15')](function(_0x24c098){logger['error'](_0xc14a('0xd'),_0x995eba,_0x24c098);_0x4a4c73(_0x24c098);});});} \ No newline at end of file +var _0xaa01=['request\x20sent','debug','ServicenowField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','request','then','info','ServicenowField,\x20%s,\x20%s'];(function(_0x47aa64,_0xfb8a07){var _0x549c7a=function(_0x266165){while(--_0x266165){_0x47aa64['push'](_0x47aa64['shift']());}};_0x549c7a(++_0xfb8a07);}(_0xaa01,0x17f));var _0x1aa0=function(_0x3d9956,_0x1cdb82){_0x3d9956=_0x3d9956-0x0;var _0x33fa56=_0xaa01[_0x3d9956];return _0x33fa56;};'use strict';var _=require('lodash');var util=require(_0x1aa0('0x0'));var moment=require(_0x1aa0('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x1aa0('0x2'));var db=require(_0x1aa0('0x3'))['db'];var utils=require(_0x1aa0('0x4'));var logger=require(_0x1aa0('0x5'))(_0x1aa0('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x1aa0('0x7')][_0x1aa0('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x399e62,_0x131013,_0x3d1161){return new BPromise(function(_0x2694ba,_0x448a37){return client[_0x1aa0('0x9')](_0x399e62,_0x3d1161)[_0x1aa0('0xa')](function(_0x3abfd3){logger[_0x1aa0('0xb')](_0x1aa0('0xc'),_0x131013,_0x1aa0('0xd'));logger[_0x1aa0('0xe')](_0x1aa0('0xf'),_0x131013,'request\x20sent',JSON[_0x1aa0('0x10')](_0x3abfd3));if(_0x3abfd3[_0x1aa0('0x11')]){if(_0x3abfd3['error'][_0x1aa0('0x12')]===0x1f4){logger[_0x1aa0('0x11')]('ServicenowField,\x20%s,\x20%s',_0x131013,_0x3abfd3[_0x1aa0('0x11')]['message']);return _0x448a37(_0x3abfd3[_0x1aa0('0x11')]['message']);}logger[_0x1aa0('0x11')](_0x1aa0('0xc'),_0x131013,_0x3abfd3[_0x1aa0('0x11')][_0x1aa0('0x13')]);return _0x2694ba(_0x3abfd3['error'][_0x1aa0('0x13')]);}else{logger['info'](_0x1aa0('0xc'),_0x131013,_0x1aa0('0xd'));_0x2694ba(_0x3abfd3[_0x1aa0('0x14')][_0x1aa0('0x13')]);}})[_0x1aa0('0x15')](function(_0x31a2d7){logger[_0x1aa0('0x11')](_0x1aa0('0xc'),_0x131013,_0x31a2d7);_0x448a37(_0x31a2d7);});});} \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/index.js b/server/api/intSugarcrmAccount/index.js index e5068ec..59a9cec 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 _0x5f3a=['multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSugarcrmAccount.controller','get','isAuthenticated','show','/:id/configurations','getFields','create','post','addConfiguration','/:id','update','delete','destroy'];(function(_0x2b791d,_0x24010d){var _0x444c21=function(_0x5afa48){while(--_0x5afa48){_0x2b791d['push'](_0x2b791d['shift']());}};_0x444c21(++_0x24010d);}(_0x5f3a,0x14a));var _0xa5f3=function(_0x395742,_0x5c07a8){_0x395742=_0x395742-0x0;var _0x416a94=_0x5f3a[_0x395742];return _0x416a94;};'use strict';var multer=require(_0xa5f3('0x0'));var util=require(_0xa5f3('0x1'));var path=require(_0xa5f3('0x2'));var timeout=require(_0xa5f3('0x3'));var express=require(_0xa5f3('0x4'));var router=express[_0xa5f3('0x5')]();var auth=require(_0xa5f3('0x6'));var interaction=require(_0xa5f3('0x7'));var config=require(_0xa5f3('0x8'));var controller=require(_0xa5f3('0x9'));router[_0xa5f3('0xa')]('/',auth[_0xa5f3('0xb')](),controller['index']);router[_0xa5f3('0xa')]('/:id',auth[_0xa5f3('0xb')](),controller[_0xa5f3('0xc')]);router[_0xa5f3('0xa')](_0xa5f3('0xd'),auth[_0xa5f3('0xb')](),controller['getConfigurations']);router[_0xa5f3('0xa')]('/:id/fields',auth[_0xa5f3('0xb')](),controller[_0xa5f3('0xe')]);router['post']('/',auth[_0xa5f3('0xb')](),controller[_0xa5f3('0xf')]);router[_0xa5f3('0x10')](_0xa5f3('0xd'),auth['isAuthenticated'](),controller[_0xa5f3('0x11')]);router['put'](_0xa5f3('0x12'),auth[_0xa5f3('0xb')](),controller[_0xa5f3('0x13')]);router[_0xa5f3('0x14')](_0xa5f3('0x12'),auth['isAuthenticated'](),controller[_0xa5f3('0x15')]);module['exports']=router; \ No newline at end of file +var _0xa132=['isAuthenticated','show','/:id/configurations','getConfigurations','/:id/fields','getFields','post','create','addConfiguration','put','update','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSugarcrmAccount.controller','get','index','/:id'];(function(_0x5ae715,_0x379a3e){var _0x407d2d=function(_0x5e2964){while(--_0x5e2964){_0x5ae715['push'](_0x5ae715['shift']());}};_0x407d2d(++_0x379a3e);}(_0xa132,0x1e1));var _0x2a13=function(_0x1ade91,_0x48f178){_0x1ade91=_0x1ade91-0x0;var _0x2c35d2=_0xa132[_0x1ade91];return _0x2c35d2;};'use strict';var multer=require(_0x2a13('0x0'));var util=require(_0x2a13('0x1'));var path=require(_0x2a13('0x2'));var timeout=require(_0x2a13('0x3'));var express=require(_0x2a13('0x4'));var router=express[_0x2a13('0x5')]();var auth=require(_0x2a13('0x6'));var interaction=require(_0x2a13('0x7'));var config=require(_0x2a13('0x8'));var controller=require(_0x2a13('0x9'));router[_0x2a13('0xa')]('/',auth['isAuthenticated'](),controller[_0x2a13('0xb')]);router['get'](_0x2a13('0xc'),auth[_0x2a13('0xd')](),controller[_0x2a13('0xe')]);router[_0x2a13('0xa')](_0x2a13('0xf'),auth[_0x2a13('0xd')](),controller[_0x2a13('0x10')]);router[_0x2a13('0xa')](_0x2a13('0x11'),auth[_0x2a13('0xd')](),controller[_0x2a13('0x12')]);router[_0x2a13('0x13')]('/',auth[_0x2a13('0xd')](),controller[_0x2a13('0x14')]);router[_0x2a13('0x13')]('/:id/configurations',auth[_0x2a13('0xd')](),controller[_0x2a13('0x15')]);router[_0x2a13('0x16')](_0x2a13('0xc'),auth[_0x2a13('0xd')](),controller[_0x2a13('0x17')]);router['delete'](_0x2a13('0xc'),auth[_0x2a13('0xd')](),controller[_0x2a13('0x18')]);module[_0x2a13('0x19')]=router; \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/intSugarcrmAccount.attributes.js b/server/api/intSugarcrmAccount/intSugarcrmAccount.attributes.js index a41d331..8057813 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 _0xe57d=['STRING','remoteUri','sequelize'];(function(_0x312b06,_0x5ad05e){var _0x54dd60=function(_0x837599){while(--_0x837599){_0x312b06['push'](_0x312b06['shift']());}};_0x54dd60(++_0x5ad05e);}(_0xe57d,0xd7));var _0xde57=function(_0x2071cc,_0x5d728e){_0x2071cc=_0x2071cc-0x0;var _0x31aa5d=_0xe57d[_0x2071cc];return _0x31aa5d;};'use strict';var Sequelize=require(_0xde57('0x0'));module['exports']={'name':{'type':Sequelize[_0xde57('0x1')]},'description':{'type':Sequelize[_0xde57('0x1')]},'username':{'type':Sequelize['STRING'],'unique':'username'},'password':{'type':Sequelize[_0xde57('0x1')]},'remoteUri':{'type':Sequelize[_0xde57('0x1')],'unique':_0xde57('0x2')},'serverUrl':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xdcf4=['exports','STRING','username','remoteUri','sequelize'];(function(_0x4824c1,_0x12548d){var _0x1972f0=function(_0x1940c2){while(--_0x1940c2){_0x4824c1['push'](_0x4824c1['shift']());}};_0x1972f0(++_0x12548d);}(_0xdcf4,0x126));var _0x4dcf=function(_0x268ea7,_0x2e2dcf){_0x268ea7=_0x268ea7-0x0;var _0x5d9117=_0xdcf4[_0x268ea7];return _0x5d9117;};'use strict';var Sequelize=require(_0x4dcf('0x0'));module[_0x4dcf('0x1')]={'name':{'type':Sequelize[_0x4dcf('0x2')]},'description':{'type':Sequelize[_0x4dcf('0x2')]},'username':{'type':Sequelize[_0x4dcf('0x2')],'unique':_0x4dcf('0x3')},'password':{'type':Sequelize[_0x4dcf('0x2')]},'remoteUri':{'type':Sequelize['STRING'],'unique':_0x4dcf('0x4')},'serverUrl':{'type':Sequelize[_0x4dcf('0x2')]}}; \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/intSugarcrmAccount.controller.js b/server/api/intSugarcrmAccount/intSugarcrmAccount.controller.js index e5be591..91a3360 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 _0x43b8=['SugarcrmConfiguration','order','pick','nolimit','addConfiguration','AccountId','getSubjects','channel','Descriptions','getDescriptions','SugarcrmField','Subjects','getFields','assigned_user_id','created_by','date_start','duration_hours','duration_minutes','parent_id','parent_type','parent_name','username','password','remoteUri','slice','substring','lastIndexOf','format','%s%s','login','JSON','stringify','xCALLY\x20Motion\x20Integration','Invalid\x20Login','POST','/service/v4_1/rest.php','values','module_fields','remove','includes','label','value','getFields,\x20%s,\x20%s,\x20%s','send','Wrong\x20credentials','statusCode','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','lodash','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','../../components/integrations/configuration','jayson/promise','http','test','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','then','SugarcrmAccount,\x20%s,\x20%s','request\x20sent','debug','SugarcrmAccount,\x20%s,\x20%s,\x20%s','error','code','message','info','result','catch','sendStatus','status','end','json','offset','limit','apply','reject','save','update','destroy','name','index','map','rawAttributes','type','key','model','query','intersection','attributes','fields','length','hasOwnProperty','sort','where','filters','filter','merge','VIRTUAL','SugarcrmAccount','count','includeAll','include','findAll','rows','show','params','keys','options','find','create','body','getConfigurations','findOne'];(function(_0x1b2255,_0x3de34f){var _0x33e57d=function(_0x2f9cce){while(--_0x2f9cce){_0x1b2255['push'](_0x1b2255['shift']());}};_0x33e57d(++_0x3de34f);}(_0x43b8,0x1bd));var _0x843b=function(_0x27ea81,_0x12a73f){_0x27ea81=_0x27ea81-0x0;var _0x57ccc0=_0x43b8[_0x27ea81];return _0x57ccc0;};'use strict';var pdf=require(_0x843b('0x0'));var emlformat=require(_0x843b('0x1'));var rimraf=require(_0x843b('0x2'));var zipdir=require(_0x843b('0x3'));var jsonpatch=require(_0x843b('0x4'));var rp=require(_0x843b('0x5'));var moment=require(_0x843b('0x6'));var BPromise=require('bluebird');var Mustache=require(_0x843b('0x7'));var util=require(_0x843b('0x8'));var path=require('path');var sox=require(_0x843b('0x9'));var csv=require(_0x843b('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x843b('0xb'));var squel=require('squel');var crypto=require(_0x843b('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x843b('0xd'));var toCsv=require(_0x843b('0xa'));var querystring=require(_0x843b('0xe'));var Papa=require(_0x843b('0xf'));var Redis=require(_0x843b('0x10'));var authService=require(_0x843b('0x11'));var qs=require(_0x843b('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x843b('0x13'));var logger=require('../../config/logger')(_0x843b('0x14'));var utils=require(_0x843b('0x15'));var config=require(_0x843b('0x16'));var db=require(_0x843b('0x17'))['db'];var integrations=require(_0x843b('0x18'));var jayson=require(_0x843b('0x19'));var client=jayson['client'][_0x843b('0x1a')]({'port':0x232a});function checkPasswordPattern(_0x71a10e,_0x28bc58,_0x408c53){if(_0x408c53){var _0x50d51c=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x50d51c[_0x843b('0x1b')](_0x28bc58)){return _0x71a10e;}else{throw new db[(_0x843b('0x1c'))][(_0x843b('0x1d'))](_0x843b('0x1e'));}}else{return _0x71a10e;}}function respondWithRpcPromise(_0x48bb5c,_0x5f3b76,_0x28f84e,_0x269e26){return new BPromise(function(_0x536132,_0x1034c9){var _0x1eef97=_0x269e26||client;return _0x1eef97['request'](_0x48bb5c,_0x28f84e)[_0x843b('0x1f')](function(_0x434e15){logger['info'](_0x843b('0x20'),_0x5f3b76,_0x843b('0x21'));logger[_0x843b('0x22')](_0x843b('0x23'),_0x5f3b76,_0x843b('0x21'),JSON['stringify'](_0x434e15));if(_0x434e15[_0x843b('0x24')]){if(_0x434e15[_0x843b('0x24')][_0x843b('0x25')]===0x1f4){logger[_0x843b('0x24')](_0x843b('0x20'),_0x5f3b76,_0x434e15[_0x843b('0x24')][_0x843b('0x26')]);return _0x1034c9(_0x434e15[_0x843b('0x24')][_0x843b('0x26')]);}logger['error'](_0x843b('0x20'),_0x5f3b76,_0x434e15[_0x843b('0x24')][_0x843b('0x26')]);return _0x536132(_0x434e15[_0x843b('0x24')]['message']);}else{logger[_0x843b('0x27')]('SugarcrmAccount,\x20%s,\x20%s',_0x5f3b76,_0x843b('0x21'));_0x536132(_0x434e15[_0x843b('0x28')][_0x843b('0x26')]);}})[_0x843b('0x29')](function(_0x395860){logger[_0x843b('0x24')](_0x843b('0x20'),_0x5f3b76,_0x395860);_0x1034c9(_0x395860);});});}function respondWithStatusCode(_0x460a4b,_0x34fcbd){_0x34fcbd=_0x34fcbd||0xcc;return function(_0x44f6ae){if(_0x44f6ae){return _0x460a4b[_0x843b('0x2a')](_0x34fcbd);}return _0x460a4b[_0x843b('0x2b')](_0x34fcbd)[_0x843b('0x2c')]();};}function respondWithResult(_0x46474e,_0x461e21){_0x461e21=_0x461e21||0xc8;return function(_0x124ef4){if(_0x124ef4){return _0x46474e[_0x843b('0x2b')](_0x461e21)[_0x843b('0x2d')](_0x124ef4);}};}function respondWithFilteredResult(_0x2733c3,_0x5cd72f){return function(_0x328234){if(_0x328234){var _0x370048=_0x328234['count'],_0x2106d2=_0x5cd72f[_0x843b('0x2e')],_0x3060b3=_0x5cd72f[_0x843b('0x2e')]+_0x5cd72f[_0x843b('0x2f')],_0x4744f3;if(_0x3060b3>=_0x370048){_0x3060b3=_0x370048;_0x4744f3=0xc8;}else{_0x4744f3=0xce;}_0x2733c3['status'](_0x4744f3);return _0x2733c3['set']('Content-Range',_0x2106d2+'-'+_0x3060b3+'/'+_0x370048)[_0x843b('0x2d')](_0x328234);}return null;};}function patchUpdates(_0x374ba4){return function(_0x57744e){try{jsonpatch[_0x843b('0x30')](_0x57744e,_0x374ba4,!![]);}catch(_0x3726d1){return BPromise[_0x843b('0x31')](_0x3726d1);}return _0x57744e[_0x843b('0x32')]();};}function saveUpdates(_0xf24fea,_0x126df9){return function(_0x3319b1){if(_0x3319b1){return _0x3319b1[_0x843b('0x33')](_0xf24fea)[_0x843b('0x1f')](function(_0x3b4639){return _0x3b4639;});}return null;};}function removeEntity(_0x801623,_0x3fa1cf){return function(_0x360206){if(_0x360206){return _0x360206[_0x843b('0x34')]()[_0x843b('0x1f')](function(){_0x801623[_0x843b('0x2b')](0xcc)[_0x843b('0x2c')]();});}};}function handleEntityNotFound(_0x1df5bf,_0x1e891e){return function(_0x4adf2a){if(!_0x4adf2a){_0x1df5bf[_0x843b('0x2a')](0x194);}return _0x4adf2a;};}function handleError(_0x599c27,_0x512a2a){_0x512a2a=_0x512a2a||0x1f4;return function(_0x3a55fc){logger[_0x843b('0x24')](_0x3a55fc['stack']);if(_0x3a55fc['name']){delete _0x3a55fc[_0x843b('0x35')];}_0x599c27[_0x843b('0x2b')](_0x512a2a)['send'](_0x3a55fc);};}exports[_0x843b('0x36')]=function(_0x2a6a6e,_0x1e4182){var _0x5e6c86={},_0x374b3e={},_0x390dd3={'count':0x0,'rows':[]};var _0x726ab3=_[_0x843b('0x37')](db['SugarcrmAccount'][_0x843b('0x38')],function(_0x2a5ef3){return{'name':_0x2a5ef3['fieldName'],'type':_0x2a5ef3[_0x843b('0x39')][_0x843b('0x3a')]};});_0x374b3e[_0x843b('0x3b')]=_[_0x843b('0x37')](_0x726ab3,_0x843b('0x35'));_0x374b3e[_0x843b('0x3c')]=_['keys'](_0x2a6a6e[_0x843b('0x3c')]);_0x374b3e['filters']=_[_0x843b('0x3d')](_0x374b3e[_0x843b('0x3b')],_0x374b3e[_0x843b('0x3c')]);_0x5e6c86[_0x843b('0x3e')]=_['intersection'](_0x374b3e['model'],qs[_0x843b('0x3f')](_0x2a6a6e[_0x843b('0x3c')][_0x843b('0x3f')]));_0x5e6c86[_0x843b('0x3e')]=_0x5e6c86['attributes'][_0x843b('0x40')]?_0x5e6c86[_0x843b('0x3e')]:_0x374b3e[_0x843b('0x3b')];if(!_0x2a6a6e[_0x843b('0x3c')][_0x843b('0x41')]('nolimit')){_0x5e6c86[_0x843b('0x2f')]=qs[_0x843b('0x2f')](_0x2a6a6e[_0x843b('0x3c')][_0x843b('0x2f')]);_0x5e6c86[_0x843b('0x2e')]=qs[_0x843b('0x2e')](_0x2a6a6e[_0x843b('0x3c')]['offset']);}_0x5e6c86['order']=qs[_0x843b('0x42')](_0x2a6a6e[_0x843b('0x3c')][_0x843b('0x42')]);_0x5e6c86[_0x843b('0x43')]=qs[_0x843b('0x44')](_['pick'](_0x2a6a6e['query'],_0x374b3e['filters']),_0x726ab3);if(_0x2a6a6e[_0x843b('0x3c')][_0x843b('0x45')]){_0x5e6c86['where']=_[_0x843b('0x46')](_0x5e6c86[_0x843b('0x43')],{'$or':_[_0x843b('0x37')](_0x726ab3,function(_0x289574){if(_0x289574[_0x843b('0x39')]!==_0x843b('0x47')){var _0x424d4d={};_0x424d4d[_0x289574['name']]={'$like':'%'+_0x2a6a6e[_0x843b('0x3c')][_0x843b('0x45')]+'%'};return _0x424d4d;}})});}_0x5e6c86=_[_0x843b('0x46')]({},_0x5e6c86,_0x2a6a6e['options']);var _0x23e104={'where':_0x5e6c86[_0x843b('0x43')]};return db[_0x843b('0x48')][_0x843b('0x49')](_0x23e104)[_0x843b('0x1f')](function(_0x14342a){_0x390dd3[_0x843b('0x49')]=_0x14342a;if(_0x2a6a6e[_0x843b('0x3c')][_0x843b('0x4a')]){_0x5e6c86[_0x843b('0x4b')]=[{'all':!![]}];}return db[_0x843b('0x48')][_0x843b('0x4c')](_0x5e6c86);})['then'](function(_0x31beb2){_0x390dd3[_0x843b('0x4d')]=_0x31beb2;return _0x390dd3;})[_0x843b('0x1f')](respondWithFilteredResult(_0x1e4182,_0x5e6c86))[_0x843b('0x29')](handleError(_0x1e4182,null));};exports[_0x843b('0x4e')]=function(_0x42faa9,_0x2b90f6){var _0x54f5aa={'raw':![],'where':{'id':_0x42faa9[_0x843b('0x4f')]['id']}},_0x89e933={};_0x89e933[_0x843b('0x3b')]=_[_0x843b('0x50')](db[_0x843b('0x48')][_0x843b('0x38')]);_0x89e933[_0x843b('0x3c')]=_['keys'](_0x42faa9[_0x843b('0x3c')]);_0x89e933['filters']=_[_0x843b('0x3d')](_0x89e933[_0x843b('0x3b')],_0x89e933[_0x843b('0x3c')]);_0x54f5aa[_0x843b('0x3e')]=_[_0x843b('0x3d')](_0x89e933[_0x843b('0x3b')],qs[_0x843b('0x3f')](_0x42faa9['query'][_0x843b('0x3f')]));_0x54f5aa['attributes']=_0x54f5aa[_0x843b('0x3e')]['length']?_0x54f5aa[_0x843b('0x3e')]:_0x89e933['model'];if(_0x42faa9[_0x843b('0x3c')]['includeAll']){_0x54f5aa['include']=[{'all':!![]}];}_0x54f5aa=_[_0x843b('0x46')]({},_0x54f5aa,_0x42faa9[_0x843b('0x51')]);return db[_0x843b('0x48')][_0x843b('0x52')](_0x54f5aa)['then'](handleEntityNotFound(_0x2b90f6,null))['then'](respondWithResult(_0x2b90f6,null))[_0x843b('0x29')](handleError(_0x2b90f6,null));};exports[_0x843b('0x53')]=function(_0x25efda,_0x1aeee3){return db['SugarcrmAccount']['create'](_0x25efda['body'],{})[_0x843b('0x1f')](respondWithResult(_0x1aeee3,0xc9))['catch'](handleError(_0x1aeee3,null));};exports[_0x843b('0x33')]=function(_0x4272c8,_0x572dbf){if(_0x4272c8[_0x843b('0x54')]['id']){delete _0x4272c8[_0x843b('0x54')]['id'];}return db[_0x843b('0x48')][_0x843b('0x52')]({'where':{'id':_0x4272c8[_0x843b('0x4f')]['id']}})[_0x843b('0x1f')](handleEntityNotFound(_0x572dbf,null))[_0x843b('0x1f')](saveUpdates(_0x4272c8[_0x843b('0x54')],null))[_0x843b('0x1f')](respondWithResult(_0x572dbf,null))['catch'](handleError(_0x572dbf,null));};exports['destroy']=function(_0x118bca,_0x179d5e){return db[_0x843b('0x48')]['find']({'where':{'id':_0x118bca['params']['id']}})[_0x843b('0x1f')](handleEntityNotFound(_0x179d5e,null))['then'](removeEntity(_0x179d5e,null))[_0x843b('0x29')](handleError(_0x179d5e,null));};exports[_0x843b('0x55')]=function(_0x5510ea,_0xdbf0b2,_0x15e469){var _0x2622a1={};var _0x171ad6={};var _0x1199fa;var _0x592879;return db[_0x843b('0x48')][_0x843b('0x56')]({'where':{'id':_0x5510ea[_0x843b('0x4f')]['id']}})[_0x843b('0x1f')](handleEntityNotFound(_0xdbf0b2,null))[_0x843b('0x1f')](function(_0x4f5b36){if(_0x4f5b36){_0x1199fa=_0x4f5b36;_0x171ad6['model']=_['keys'](db[_0x843b('0x57')][_0x843b('0x38')]);_0x171ad6[_0x843b('0x3c')]=_[_0x843b('0x50')](_0x5510ea[_0x843b('0x3c')]);_0x171ad6[_0x843b('0x44')]=_[_0x843b('0x3d')](_0x171ad6[_0x843b('0x3b')],_0x171ad6[_0x843b('0x3c')]);_0x2622a1[_0x843b('0x3e')]=_['intersection'](_0x171ad6[_0x843b('0x3b')],qs['fields'](_0x5510ea[_0x843b('0x3c')][_0x843b('0x3f')]));_0x2622a1[_0x843b('0x3e')]=_0x2622a1[_0x843b('0x3e')][_0x843b('0x40')]?_0x2622a1['attributes']:_0x171ad6[_0x843b('0x3b')];_0x2622a1[_0x843b('0x58')]=qs['sort'](_0x5510ea[_0x843b('0x3c')][_0x843b('0x42')]);_0x2622a1[_0x843b('0x43')]=qs[_0x843b('0x44')](_[_0x843b('0x59')](_0x5510ea[_0x843b('0x3c')],_0x171ad6[_0x843b('0x44')]));if(_0x5510ea['query'][_0x843b('0x45')]){_0x2622a1[_0x843b('0x43')]=_['merge'](_0x2622a1['where'],{'$or':_['map'](_0x2622a1[_0x843b('0x3e')],function(_0x268d3e){var _0x49691c={};_0x49691c[_0x268d3e]={'$like':'%'+_0x5510ea[_0x843b('0x3c')][_0x843b('0x45')]+'%'};return _0x49691c;})});}_0x2622a1=_[_0x843b('0x46')]({},_0x2622a1,_0x5510ea[_0x843b('0x51')]);return _0x1199fa[_0x843b('0x55')](_0x2622a1);}})[_0x843b('0x1f')](function(_0x5eec3f){if(_0x5eec3f){_0x592879=_0x5eec3f[_0x843b('0x40')];if(!_0x5510ea[_0x843b('0x3c')][_0x843b('0x41')](_0x843b('0x5a'))){_0x2622a1[_0x843b('0x2f')]=qs['limit'](_0x5510ea['query'][_0x843b('0x2f')]);_0x2622a1[_0x843b('0x2e')]=qs[_0x843b('0x2e')](_0x5510ea[_0x843b('0x3c')][_0x843b('0x2e')]);}return _0x1199fa[_0x843b('0x55')](_0x2622a1);}})[_0x843b('0x1f')](function(_0x3f1b13){if(_0x3f1b13){return _0x3f1b13?{'count':_0x592879,'rows':_0x3f1b13}:null;}})['then'](respondWithResult(_0xdbf0b2,null))['catch'](handleError(_0xdbf0b2,null));};exports[_0x843b('0x5b')]=function(_0x3fe345,_0x11d7a6,_0x282a43){if(_0x3fe345[_0x843b('0x54')]['id']){delete _0x3fe345['body']['id'];}return db['SugarcrmAccount'][_0x843b('0x56')]({'where':{'id':_0x3fe345[_0x843b('0x4f')]['id']}})[_0x843b('0x1f')](handleEntityNotFound(_0x11d7a6,null))['then'](function(_0x5c18c3){if(_0x5c18c3){_0x3fe345[_0x843b('0x54')][_0x843b('0x5c')]=_0x5c18c3['id'];_0x3fe345[_0x843b('0x54')]['Subjects']=integrations[_0x843b('0x5d')](_0x3fe345[_0x843b('0x54')][_0x843b('0x5e')],_0x3fe345['body'][_0x843b('0x39')]);_0x3fe345[_0x843b('0x54')][_0x843b('0x5f')]=integrations[_0x843b('0x60')](_0x3fe345['body']['channel'],_0x3fe345['body'][_0x843b('0x39')]);return db[_0x843b('0x57')][_0x843b('0x53')](_0x3fe345['body'],{'include':[{'model':db[_0x843b('0x61')],'as':_0x843b('0x62')},{'model':db[_0x843b('0x61')],'as':_0x843b('0x5f')}]});}return null;})['then'](respondWithResult(_0x11d7a6,null))['catch'](handleError(_0x11d7a6,null));};exports[_0x843b('0x63')]=function(_0x333cca,_0x221054,_0x3bd8b8){var _0x2abed8='';var _0x2efcf1=['id',_0x843b('0x35'),_0x843b('0x64'),_0x843b('0x65'),'description',_0x843b('0x66'),_0x843b('0x67'),_0x843b('0x68'),_0x843b('0x69'),_0x843b('0x6a'),_0x843b('0x6b'),'direction'];return db[_0x843b('0x48')][_0x843b('0x56')]({'where':{'id':_0x333cca['params']['id']},'attributes':['id',_0x843b('0x6c'),_0x843b('0x6d'),_0x843b('0x6e')]})[_0x843b('0x1f')](handleEntityNotFound(_0x221054,null))['then'](function(_0x3f721b){if(_0x3f721b){_0x2abed8=_0x3f721b[_0x843b('0x6e')];var _0x4bb1bc=_0x2abed8[_0x843b('0x6f')](-0x1);if(_0x4bb1bc==='/'){_0x2abed8=_0x2abed8[_0x843b('0x70')](0x0,_0x2abed8[_0x843b('0x71')](_0x4bb1bc));}return rp({'method':'POST','uri':util[_0x843b('0x72')](_0x843b('0x73'),_0x2abed8,'/service/v4_1/rest.php'),'json':!![],'form':{'method':_0x843b('0x74'),'input_type':_0x843b('0x75'),'response_type':_0x843b('0x75'),'rest_data':JSON[_0x843b('0x76')]({'user_auth':{'user_name':_0x3f721b[_0x843b('0x6c')],'password':_0x3f721b[_0x843b('0x6d')],'encryption':'PLAIN'},'application':_0x843b('0x77')})}});}})[_0x843b('0x1f')](function(_0x479248){if(_0x479248&&_0x479248[_0x843b('0x35')]!==_0x843b('0x78')&&_0x479248[_0x843b('0x35')]!=='Password\x20Expired'){return rp({'method':_0x843b('0x79'),'uri':util[_0x843b('0x72')](_0x843b('0x73'),_0x2abed8,_0x843b('0x7a')),'json':!![],'form':{'method':'get_module_fields','input_type':_0x843b('0x75'),'response_type':_0x843b('0x75'),'rest_data':JSON['stringify']({'session':_0x479248['id'],'module_name':'Calls'})}})['then'](function(_0x36b196){if(_0x36b196){var _0x16dc52=_[_0x843b('0x7b')](_0x36b196[_0x843b('0x7c')]);_[_0x843b('0x7d')](_0x16dc52,function(_0x341463){return _0x2efcf1[_0x843b('0x7e')](_0x341463[_0x843b('0x35')]);});return{'count':_0x16dc52[_0x843b('0x40')],'rows':_[_0x843b('0x37')](_0x16dc52,function(_0x256059){return{'id':_0x256059[_0x843b('0x35')],'name':_0x256059[_0x843b('0x7f')],'custom':_['endsWith'](_0x256059[_0x843b('0x35')],'_c')?!![]:![],'options':_0x256059[_0x843b('0x51')]?_[_0x843b('0x37')](_[_0x843b('0x7b')](_0x256059[_0x843b('0x51')]),function(_0x17b9d7){return{'name':_0x17b9d7[_0x843b('0x80')],'value':_0x17b9d7[_0x843b('0x35')]};}):[]};})};}})[_0x843b('0x1f')](respondWithResult(_0x221054,null))[_0x843b('0x29')](function(_0x4dff31){var _0x53099c=_0x333cca[_0x843b('0x3c')]['test']?0x1f4:_0x4dff31['statusCode']||0x1f4;logger[_0x843b('0x24')](_0x843b('0x81'),'getFields',_0x53099c,JSON[_0x843b('0x76')](_0x4dff31));delete _0x4dff31[_0x843b('0x35')];if(_0x53099c===0x191){_0x53099c=0x190;}_0x221054[_0x843b('0x2b')](_0x53099c)[_0x843b('0x82')](_0x333cca[_0x843b('0x3c')][_0x843b('0x1b')]?{'message':_0x843b('0x83'),'statusCode':_0x4dff31[_0x843b('0x84')]}:_0x4dff31);});}else{var _0x545ad5=0x1f4;_0x221054['status'](_0x545ad5)['send']({'message':'Wrong\x20credentials','statusCode':0x190});}});}; \ No newline at end of file +var _0x05b6=['status','end','count','offset','Content-Range','json','apply','reject','save','update','destroy','stack','name','send','index','map','SugarcrmAccount','rawAttributes','type','key','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','rows','show','params','length','create','body','find','findOne','SugarcrmConfiguration','getConfigurations','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','SugarcrmField','getFields','assigned_user_id','created_by','description','duration_hours','duration_minutes','parent_id','parent_type','parent_name','direction','username','password','remoteUri','slice','substring','POST','%s%s','/service/v4_1/rest.php','login','JSON','PLAIN','xCALLY\x20Motion\x20Integration','Invalid\x20Login','get_module_fields','Calls','module_fields','label','endsWith','values','test','getFields,\x20%s,\x20%s,\x20%s','Wrong\x20credentials','statusCode','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','../../components/integrations/configuration','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','SugarcrmAccount,\x20%s,\x20%s','request\x20sent','debug','SugarcrmAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','sendStatus'];(function(_0xae7c2f,_0xf31e04){var _0x5d7001=function(_0x4eeadb){while(--_0x4eeadb){_0xae7c2f['push'](_0xae7c2f['shift']());}};_0x5d7001(++_0xf31e04);}(_0x05b6,0x168));var _0x605b=function(_0x5cce5a,_0x298d54){_0x5cce5a=_0x5cce5a-0x0;var _0x354e33=_0x05b6[_0x5cce5a];return _0x354e33;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x605b('0x0'));var rimraf=require(_0x605b('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x605b('0x2'));var rp=require(_0x605b('0x3'));var moment=require(_0x605b('0x4'));var BPromise=require(_0x605b('0x5'));var Mustache=require('mustache');var util=require(_0x605b('0x6'));var path=require(_0x605b('0x7'));var sox=require(_0x605b('0x8'));var csv=require(_0x605b('0x9'));var ejs=require(_0x605b('0xa'));var fs=require('fs');var _=require(_0x605b('0xb'));var squel=require(_0x605b('0xc'));var crypto=require(_0x605b('0xd'));var jsforce=require(_0x605b('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x605b('0xf'));var Papa=require(_0x605b('0x10'));var Redis=require(_0x605b('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x605b('0x12'));var as=require(_0x605b('0x13'));var hardwareService=require(_0x605b('0x14'));var logger=require(_0x605b('0x15'))('api');var utils=require(_0x605b('0x16'));var config=require(_0x605b('0x17'));var db=require(_0x605b('0x18'))['db'];var integrations=require(_0x605b('0x19'));var jayson=require(_0x605b('0x1a'));var client=jayson[_0x605b('0x1b')][_0x605b('0x1c')]({'port':0x232a});function checkPasswordPattern(_0x572a44,_0x7e9e21,_0x1f5e14){if(_0x1f5e14){var _0xdb3dc4=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0xdb3dc4['test'](_0x7e9e21)){return _0x572a44;}else{throw new db[(_0x605b('0x1d'))]['ValidationError'](_0x605b('0x1e'));}}else{return _0x572a44;}}function respondWithRpcPromise(_0x4aa544,_0x10d90b,_0x8fc191,_0x41e21f){return new BPromise(function(_0x433b85,_0x3da235){var _0x3849b2=_0x41e21f||client;return _0x3849b2[_0x605b('0x1f')](_0x4aa544,_0x8fc191)[_0x605b('0x20')](function(_0x1a6ef5){logger['info'](_0x605b('0x21'),_0x10d90b,_0x605b('0x22'));logger[_0x605b('0x23')](_0x605b('0x24'),_0x10d90b,'request\x20sent',JSON[_0x605b('0x25')](_0x1a6ef5));if(_0x1a6ef5[_0x605b('0x26')]){if(_0x1a6ef5[_0x605b('0x26')][_0x605b('0x27')]===0x1f4){logger[_0x605b('0x26')](_0x605b('0x21'),_0x10d90b,_0x1a6ef5[_0x605b('0x26')][_0x605b('0x28')]);return _0x3da235(_0x1a6ef5[_0x605b('0x26')][_0x605b('0x28')]);}logger[_0x605b('0x26')](_0x605b('0x21'),_0x10d90b,_0x1a6ef5['error'][_0x605b('0x28')]);return _0x433b85(_0x1a6ef5[_0x605b('0x26')][_0x605b('0x28')]);}else{logger[_0x605b('0x29')]('SugarcrmAccount,\x20%s,\x20%s',_0x10d90b,_0x605b('0x22'));_0x433b85(_0x1a6ef5[_0x605b('0x2a')][_0x605b('0x28')]);}})[_0x605b('0x2b')](function(_0x1d732a){logger['error']('SugarcrmAccount,\x20%s,\x20%s',_0x10d90b,_0x1d732a);_0x3da235(_0x1d732a);});});}function respondWithStatusCode(_0xcfa230,_0x1b5496){_0x1b5496=_0x1b5496||0xcc;return function(_0x3dba78){if(_0x3dba78){return _0xcfa230[_0x605b('0x2c')](_0x1b5496);}return _0xcfa230[_0x605b('0x2d')](_0x1b5496)[_0x605b('0x2e')]();};}function respondWithResult(_0x12f1e,_0x218540){_0x218540=_0x218540||0xc8;return function(_0x551926){if(_0x551926){return _0x12f1e[_0x605b('0x2d')](_0x218540)['json'](_0x551926);}};}function respondWithFilteredResult(_0xe8cf13,_0x4fb6cb){return function(_0x2b049b){if(_0x2b049b){var _0x4647c8=_0x2b049b[_0x605b('0x2f')],_0x3b32c5=_0x4fb6cb[_0x605b('0x30')],_0x3cf470=_0x4fb6cb['offset']+_0x4fb6cb['limit'],_0x4090d8;if(_0x3cf470>=_0x4647c8){_0x3cf470=_0x4647c8;_0x4090d8=0xc8;}else{_0x4090d8=0xce;}_0xe8cf13['status'](_0x4090d8);return _0xe8cf13['set'](_0x605b('0x31'),_0x3b32c5+'-'+_0x3cf470+'/'+_0x4647c8)[_0x605b('0x32')](_0x2b049b);}return null;};}function patchUpdates(_0x5ed6a5){return function(_0x15dfdf){try{jsonpatch[_0x605b('0x33')](_0x15dfdf,_0x5ed6a5,!![]);}catch(_0x2ba960){return BPromise[_0x605b('0x34')](_0x2ba960);}return _0x15dfdf[_0x605b('0x35')]();};}function saveUpdates(_0x3c8029,_0x5c1b43){return function(_0x397264){if(_0x397264){return _0x397264[_0x605b('0x36')](_0x3c8029)[_0x605b('0x20')](function(_0x2bd0b9){return _0x2bd0b9;});}return null;};}function removeEntity(_0x4581ec,_0xe3d35a){return function(_0x16a5ed){if(_0x16a5ed){return _0x16a5ed[_0x605b('0x37')]()['then'](function(){_0x4581ec['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x203237,_0x4320df){return function(_0x48d6a9){if(!_0x48d6a9){_0x203237[_0x605b('0x2c')](0x194);}return _0x48d6a9;};}function handleError(_0x2c2324,_0x54c8bd){_0x54c8bd=_0x54c8bd||0x1f4;return function(_0x1114af){logger[_0x605b('0x26')](_0x1114af[_0x605b('0x38')]);if(_0x1114af[_0x605b('0x39')]){delete _0x1114af[_0x605b('0x39')];}_0x2c2324[_0x605b('0x2d')](_0x54c8bd)[_0x605b('0x3a')](_0x1114af);};}exports[_0x605b('0x3b')]=function(_0x2788e0,_0x423891){var _0x40529c={},_0x160689={},_0x242df1={'count':0x0,'rows':[]};var _0x360591=_[_0x605b('0x3c')](db[_0x605b('0x3d')][_0x605b('0x3e')],function(_0x185236){return{'name':_0x185236['fieldName'],'type':_0x185236[_0x605b('0x3f')][_0x605b('0x40')]};});_0x160689[_0x605b('0x41')]=_[_0x605b('0x3c')](_0x360591,_0x605b('0x39'));_0x160689[_0x605b('0x42')]=_[_0x605b('0x43')](_0x2788e0['query']);_0x160689[_0x605b('0x44')]=_[_0x605b('0x45')](_0x160689['model'],_0x160689[_0x605b('0x42')]);_0x40529c['attributes']=_[_0x605b('0x45')](_0x160689[_0x605b('0x41')],qs['fields'](_0x2788e0[_0x605b('0x42')][_0x605b('0x46')]));_0x40529c[_0x605b('0x47')]=_0x40529c[_0x605b('0x47')]['length']?_0x40529c[_0x605b('0x47')]:_0x160689[_0x605b('0x41')];if(!_0x2788e0[_0x605b('0x42')][_0x605b('0x48')](_0x605b('0x49'))){_0x40529c[_0x605b('0x4a')]=qs[_0x605b('0x4a')](_0x2788e0[_0x605b('0x42')][_0x605b('0x4a')]);_0x40529c[_0x605b('0x30')]=qs[_0x605b('0x30')](_0x2788e0[_0x605b('0x42')][_0x605b('0x30')]);}_0x40529c[_0x605b('0x4b')]=qs[_0x605b('0x4c')](_0x2788e0[_0x605b('0x42')][_0x605b('0x4c')]);_0x40529c[_0x605b('0x4d')]=qs[_0x605b('0x44')](_[_0x605b('0x4e')](_0x2788e0['query'],_0x160689['filters']),_0x360591);if(_0x2788e0['query'][_0x605b('0x4f')]){_0x40529c['where']=_[_0x605b('0x50')](_0x40529c['where'],{'$or':_[_0x605b('0x3c')](_0x360591,function(_0x1f8d51){if(_0x1f8d51[_0x605b('0x3f')]!==_0x605b('0x51')){var _0x51cc57={};_0x51cc57[_0x1f8d51[_0x605b('0x39')]]={'$like':'%'+_0x2788e0['query'][_0x605b('0x4f')]+'%'};return _0x51cc57;}})});}_0x40529c=_[_0x605b('0x50')]({},_0x40529c,_0x2788e0[_0x605b('0x52')]);var _0x58b50b={'where':_0x40529c[_0x605b('0x4d')]};return db[_0x605b('0x3d')][_0x605b('0x2f')](_0x58b50b)['then'](function(_0x5bfb80){_0x242df1[_0x605b('0x2f')]=_0x5bfb80;if(_0x2788e0[_0x605b('0x42')][_0x605b('0x53')]){_0x40529c[_0x605b('0x54')]=[{'all':!![]}];}return db[_0x605b('0x3d')]['findAll'](_0x40529c);})['then'](function(_0x37e92f){_0x242df1[_0x605b('0x55')]=_0x37e92f;return _0x242df1;})['then'](respondWithFilteredResult(_0x423891,_0x40529c))['catch'](handleError(_0x423891,null));};exports[_0x605b('0x56')]=function(_0x1c1cfe,_0x35d934){var _0x487f32={'raw':![],'where':{'id':_0x1c1cfe[_0x605b('0x57')]['id']}},_0x50e431={};_0x50e431[_0x605b('0x41')]=_[_0x605b('0x43')](db[_0x605b('0x3d')][_0x605b('0x3e')]);_0x50e431[_0x605b('0x42')]=_[_0x605b('0x43')](_0x1c1cfe[_0x605b('0x42')]);_0x50e431['filters']=_[_0x605b('0x45')](_0x50e431['model'],_0x50e431['query']);_0x487f32[_0x605b('0x47')]=_[_0x605b('0x45')](_0x50e431['model'],qs['fields'](_0x1c1cfe['query'][_0x605b('0x46')]));_0x487f32[_0x605b('0x47')]=_0x487f32['attributes'][_0x605b('0x58')]?_0x487f32['attributes']:_0x50e431[_0x605b('0x41')];if(_0x1c1cfe['query']['includeAll']){_0x487f32['include']=[{'all':!![]}];}_0x487f32=_[_0x605b('0x50')]({},_0x487f32,_0x1c1cfe[_0x605b('0x52')]);return db[_0x605b('0x3d')]['find'](_0x487f32)[_0x605b('0x20')](handleEntityNotFound(_0x35d934,null))[_0x605b('0x20')](respondWithResult(_0x35d934,null))['catch'](handleError(_0x35d934,null));};exports[_0x605b('0x59')]=function(_0x21197b,_0x1c5d6b){return db[_0x605b('0x3d')][_0x605b('0x59')](_0x21197b[_0x605b('0x5a')],{})[_0x605b('0x20')](respondWithResult(_0x1c5d6b,0xc9))['catch'](handleError(_0x1c5d6b,null));};exports['update']=function(_0x7ab35a,_0x52a646){if(_0x7ab35a[_0x605b('0x5a')]['id']){delete _0x7ab35a[_0x605b('0x5a')]['id'];}return db[_0x605b('0x3d')][_0x605b('0x5b')]({'where':{'id':_0x7ab35a[_0x605b('0x57')]['id']}})[_0x605b('0x20')](handleEntityNotFound(_0x52a646,null))[_0x605b('0x20')](saveUpdates(_0x7ab35a[_0x605b('0x5a')],null))['then'](respondWithResult(_0x52a646,null))[_0x605b('0x2b')](handleError(_0x52a646,null));};exports[_0x605b('0x37')]=function(_0x56d159,_0x384f24){return db[_0x605b('0x3d')][_0x605b('0x5b')]({'where':{'id':_0x56d159[_0x605b('0x57')]['id']}})['then'](handleEntityNotFound(_0x384f24,null))['then'](removeEntity(_0x384f24,null))[_0x605b('0x2b')](handleError(_0x384f24,null));};exports['getConfigurations']=function(_0x14a085,_0x997da,_0x37de25){var _0x16437f={};var _0x319239={};var _0x19b37f;var _0x36cddf;return db[_0x605b('0x3d')][_0x605b('0x5c')]({'where':{'id':_0x14a085[_0x605b('0x57')]['id']}})[_0x605b('0x20')](handleEntityNotFound(_0x997da,null))['then'](function(_0x29972c){if(_0x29972c){_0x19b37f=_0x29972c;_0x319239[_0x605b('0x41')]=_[_0x605b('0x43')](db[_0x605b('0x5d')][_0x605b('0x3e')]);_0x319239[_0x605b('0x42')]=_[_0x605b('0x43')](_0x14a085[_0x605b('0x42')]);_0x319239[_0x605b('0x44')]=_[_0x605b('0x45')](_0x319239['model'],_0x319239[_0x605b('0x42')]);_0x16437f[_0x605b('0x47')]=_[_0x605b('0x45')](_0x319239['model'],qs[_0x605b('0x46')](_0x14a085['query']['fields']));_0x16437f[_0x605b('0x47')]=_0x16437f[_0x605b('0x47')][_0x605b('0x58')]?_0x16437f[_0x605b('0x47')]:_0x319239[_0x605b('0x41')];_0x16437f[_0x605b('0x4b')]=qs['sort'](_0x14a085['query']['sort']);_0x16437f['where']=qs['filters'](_[_0x605b('0x4e')](_0x14a085[_0x605b('0x42')],_0x319239[_0x605b('0x44')]));if(_0x14a085[_0x605b('0x42')]['filter']){_0x16437f[_0x605b('0x4d')]=_[_0x605b('0x50')](_0x16437f[_0x605b('0x4d')],{'$or':_[_0x605b('0x3c')](_0x16437f[_0x605b('0x47')],function(_0x595894){var _0xf24c78={};_0xf24c78[_0x595894]={'$like':'%'+_0x14a085[_0x605b('0x42')]['filter']+'%'};return _0xf24c78;})});}_0x16437f=_['merge']({},_0x16437f,_0x14a085[_0x605b('0x52')]);return _0x19b37f[_0x605b('0x5e')](_0x16437f);}})['then'](function(_0x3847ae){if(_0x3847ae){_0x36cddf=_0x3847ae[_0x605b('0x58')];if(!_0x14a085[_0x605b('0x42')][_0x605b('0x48')](_0x605b('0x49'))){_0x16437f[_0x605b('0x4a')]=qs[_0x605b('0x4a')](_0x14a085['query'][_0x605b('0x4a')]);_0x16437f[_0x605b('0x30')]=qs[_0x605b('0x30')](_0x14a085['query'][_0x605b('0x30')]);}return _0x19b37f[_0x605b('0x5e')](_0x16437f);}})[_0x605b('0x20')](function(_0x2e8a22){if(_0x2e8a22){return _0x2e8a22?{'count':_0x36cddf,'rows':_0x2e8a22}:null;}})['then'](respondWithResult(_0x997da,null))[_0x605b('0x2b')](handleError(_0x997da,null));};exports[_0x605b('0x5f')]=function(_0x2732f4,_0x23342f,_0x5f1c29){if(_0x2732f4[_0x605b('0x5a')]['id']){delete _0x2732f4[_0x605b('0x5a')]['id'];}return db[_0x605b('0x3d')][_0x605b('0x5c')]({'where':{'id':_0x2732f4[_0x605b('0x57')]['id']}})['then'](handleEntityNotFound(_0x23342f,null))[_0x605b('0x20')](function(_0x3f9e81){if(_0x3f9e81){_0x2732f4[_0x605b('0x5a')][_0x605b('0x60')]=_0x3f9e81['id'];_0x2732f4[_0x605b('0x5a')][_0x605b('0x61')]=integrations[_0x605b('0x62')](_0x2732f4['body'][_0x605b('0x63')],_0x2732f4['body']['type']);_0x2732f4[_0x605b('0x5a')][_0x605b('0x64')]=integrations['getDescriptions'](_0x2732f4[_0x605b('0x5a')][_0x605b('0x63')],_0x2732f4[_0x605b('0x5a')][_0x605b('0x3f')]);return db['SugarcrmConfiguration'][_0x605b('0x59')](_0x2732f4[_0x605b('0x5a')],{'include':[{'model':db['SugarcrmField'],'as':_0x605b('0x61')},{'model':db[_0x605b('0x65')],'as':_0x605b('0x64')}]});}return null;})['then'](respondWithResult(_0x23342f,null))['catch'](handleError(_0x23342f,null));};exports[_0x605b('0x66')]=function(_0x56aeea,_0x415df6,_0x8bcec9){var _0x320e97='';var _0x316e56=['id',_0x605b('0x39'),_0x605b('0x67'),_0x605b('0x68'),_0x605b('0x69'),'date_start',_0x605b('0x6a'),_0x605b('0x6b'),_0x605b('0x6c'),_0x605b('0x6d'),_0x605b('0x6e'),_0x605b('0x6f')];return db[_0x605b('0x3d')][_0x605b('0x5c')]({'where':{'id':_0x56aeea[_0x605b('0x57')]['id']},'attributes':['id',_0x605b('0x70'),_0x605b('0x71'),'remoteUri']})[_0x605b('0x20')](handleEntityNotFound(_0x415df6,null))[_0x605b('0x20')](function(_0x4f1ea3){if(_0x4f1ea3){_0x320e97=_0x4f1ea3[_0x605b('0x72')];var _0x3aee29=_0x320e97[_0x605b('0x73')](-0x1);if(_0x3aee29==='/'){_0x320e97=_0x320e97[_0x605b('0x74')](0x0,_0x320e97['lastIndexOf'](_0x3aee29));}return rp({'method':_0x605b('0x75'),'uri':util['format'](_0x605b('0x76'),_0x320e97,_0x605b('0x77')),'json':!![],'form':{'method':_0x605b('0x78'),'input_type':_0x605b('0x79'),'response_type':'JSON','rest_data':JSON[_0x605b('0x25')]({'user_auth':{'user_name':_0x4f1ea3[_0x605b('0x70')],'password':_0x4f1ea3[_0x605b('0x71')],'encryption':_0x605b('0x7a')},'application':_0x605b('0x7b')})}});}})[_0x605b('0x20')](function(_0xaea776){if(_0xaea776&&_0xaea776[_0x605b('0x39')]!==_0x605b('0x7c')&&_0xaea776[_0x605b('0x39')]!=='Password\x20Expired'){return rp({'method':_0x605b('0x75'),'uri':util['format'](_0x605b('0x76'),_0x320e97,_0x605b('0x77')),'json':!![],'form':{'method':_0x605b('0x7d'),'input_type':'JSON','response_type':_0x605b('0x79'),'rest_data':JSON[_0x605b('0x25')]({'session':_0xaea776['id'],'module_name':_0x605b('0x7e')})}})[_0x605b('0x20')](function(_0xd00b0){if(_0xd00b0){var _0x42fb8d=_['values'](_0xd00b0[_0x605b('0x7f')]);_['remove'](_0x42fb8d,function(_0x10d766){return _0x316e56['includes'](_0x10d766[_0x605b('0x39')]);});return{'count':_0x42fb8d[_0x605b('0x58')],'rows':_[_0x605b('0x3c')](_0x42fb8d,function(_0x6b538b){return{'id':_0x6b538b[_0x605b('0x39')],'name':_0x6b538b[_0x605b('0x80')],'custom':_[_0x605b('0x81')](_0x6b538b[_0x605b('0x39')],'_c')?!![]:![],'options':_0x6b538b['options']?_[_0x605b('0x3c')](_[_0x605b('0x82')](_0x6b538b[_0x605b('0x52')]),function(_0x19d39b){return{'name':_0x19d39b['value'],'value':_0x19d39b['name']};}):[]};})};}})[_0x605b('0x20')](respondWithResult(_0x415df6,null))['catch'](function(_0x1261de){var _0x39ec16=_0x56aeea[_0x605b('0x42')][_0x605b('0x83')]?0x1f4:_0x1261de['statusCode']||0x1f4;logger[_0x605b('0x26')](_0x605b('0x84'),_0x605b('0x66'),_0x39ec16,JSON[_0x605b('0x25')](_0x1261de));delete _0x1261de['name'];if(_0x39ec16===0x191){_0x39ec16=0x190;}_0x415df6[_0x605b('0x2d')](_0x39ec16)['send'](_0x56aeea[_0x605b('0x42')][_0x605b('0x83')]?{'message':_0x605b('0x85'),'statusCode':_0x1261de[_0x605b('0x86')]}:_0x1261de);});}else{var _0x295481=0x1f4;_0x415df6[_0x605b('0x2d')](_0x295481)[_0x605b('0x3a')]({'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 002e150..b08d242 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 _0x52a5=['api','bluebird','request-promise','path','rimraf','./intSugarcrmAccount.attributes','../../components/integrations/configuration','exports','define','SugarcrmAccount','lodash','util','../../config/logger'];(function(_0x4687df,_0x12099c){var _0x32eaef=function(_0x2387db){while(--_0x2387db){_0x4687df['push'](_0x4687df['shift']());}};_0x32eaef(++_0x12099c);}(_0x52a5,0x1d1));var _0x552a=function(_0x353e2d,_0x2117ee){_0x353e2d=_0x353e2d-0x0;var _0x52e4f2=_0x52a5[_0x353e2d];return _0x52e4f2;};'use strict';var _=require(_0x552a('0x0'));var util=require(_0x552a('0x1'));var logger=require(_0x552a('0x2'))(_0x552a('0x3'));var moment=require('moment');var BPromise=require(_0x552a('0x4'));var rp=require(_0x552a('0x5'));var fs=require('fs');var path=require(_0x552a('0x6'));var rimraf=require(_0x552a('0x7'));var config=require('../../config/environment');var attributes=require(_0x552a('0x8'));var integrations=require(_0x552a('0x9'));module[_0x552a('0xa')]=function(_0x4f10f1,_0x39c6f7){return _0x4f10f1[_0x552a('0xb')](_0x552a('0xc'),attributes,{'tableName':'int_sugarcrm_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x57df=['rimraf','../../config/environment','./intSugarcrmAccount.attributes','exports','SugarcrmAccount','int_sugarcrm_accounts','lodash','util','../../config/logger','api','bluebird','request-promise','path'];(function(_0xe6f321,_0x172136){var _0x4fc9f7=function(_0x2a2093){while(--_0x2a2093){_0xe6f321['push'](_0xe6f321['shift']());}};_0x4fc9f7(++_0x172136);}(_0x57df,0x17f));var _0xf57d=function(_0x400e1a,_0x3290d1){_0x400e1a=_0x400e1a-0x0;var _0xca5554=_0x57df[_0x400e1a];return _0xca5554;};'use strict';var _=require(_0xf57d('0x0'));var util=require(_0xf57d('0x1'));var logger=require(_0xf57d('0x2'))(_0xf57d('0x3'));var moment=require('moment');var BPromise=require(_0xf57d('0x4'));var rp=require(_0xf57d('0x5'));var fs=require('fs');var path=require(_0xf57d('0x6'));var rimraf=require(_0xf57d('0x7'));var config=require(_0xf57d('0x8'));var attributes=require(_0xf57d('0x9'));var integrations=require('../../components/integrations/configuration');module[_0xf57d('0xa')]=function(_0x30ec7c,_0x3b08cd){return _0x30ec7c['define'](_0xf57d('0xb'),attributes,{'tableName':_0xf57d('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/intSugarcrmAccount.rpc.js b/server/api/intSugarcrmAccount/intSugarcrmAccount.rpc.js index 53aac03..c3f2135 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 _0x2a95=['code','message','result','catch','GetSugarcrmAccount','SugarcrmAccount','findAll','options','raw','limit','include','map','model','attributes','stringify','find','where','ShowSugarcrmAccount','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','SugarcrmAccount,\x20%s,\x20%s','request\x20sent','debug','SugarcrmAccount,\x20%s,\x20%s,\x20%s','error'];(function(_0x40036a,_0xcc1cd8){var _0x4d99f3=function(_0x25cb95){while(--_0x25cb95){_0x40036a['push'](_0x40036a['shift']());}};_0x4d99f3(++_0xcc1cd8);}(_0x2a95,0xf6));var _0x52a9=function(_0x1aab22,_0x46c71f){_0x1aab22=_0x1aab22-0x0;var _0x12b243=_0x2a95[_0x1aab22];return _0x12b243;};'use strict';var _=require(_0x52a9('0x0'));var util=require(_0x52a9('0x1'));var moment=require(_0x52a9('0x2'));var BPromise=require(_0x52a9('0x3'));var rs=require(_0x52a9('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x52a9('0x5'))['db'];var utils=require(_0x52a9('0x6'));var logger=require(_0x52a9('0x7'))(_0x52a9('0x8'));var config=require(_0x52a9('0x9'));var jayson=require(_0x52a9('0xa'));var client=jayson['client'][_0x52a9('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2ed962,_0xf4eec6,_0x36b69e){return new BPromise(function(_0x4a9935,_0x5446fb){return client[_0x52a9('0xc')](_0x2ed962,_0x36b69e)[_0x52a9('0xd')](function(_0x4bb50b){logger[_0x52a9('0xe')](_0x52a9('0xf'),_0xf4eec6,_0x52a9('0x10'));logger[_0x52a9('0x11')](_0x52a9('0x12'),_0xf4eec6,_0x52a9('0x10'),JSON['stringify'](_0x4bb50b));if(_0x4bb50b[_0x52a9('0x13')]){if(_0x4bb50b[_0x52a9('0x13')][_0x52a9('0x14')]===0x1f4){logger[_0x52a9('0x13')](_0x52a9('0xf'),_0xf4eec6,_0x4bb50b[_0x52a9('0x13')][_0x52a9('0x15')]);return _0x5446fb(_0x4bb50b[_0x52a9('0x13')][_0x52a9('0x15')]);}logger[_0x52a9('0x13')](_0x52a9('0xf'),_0xf4eec6,_0x4bb50b[_0x52a9('0x13')][_0x52a9('0x15')]);return _0x4a9935(_0x4bb50b['error']['message']);}else{logger[_0x52a9('0xe')](_0x52a9('0xf'),_0xf4eec6,_0x52a9('0x10'));_0x4a9935(_0x4bb50b[_0x52a9('0x16')][_0x52a9('0x15')]);}})[_0x52a9('0x17')](function(_0x46e0f9){logger[_0x52a9('0x13')](_0x52a9('0xf'),_0xf4eec6,_0x46e0f9);_0x5446fb(_0x46e0f9);});});}exports[_0x52a9('0x18')]=function(_0x33011c){var _0x1bfbb9=this;return new Promise(function(_0x41350c,_0x488454){return db[_0x52a9('0x19')][_0x52a9('0x1a')]({'raw':_0x33011c[_0x52a9('0x1b')]?_0x33011c[_0x52a9('0x1b')][_0x52a9('0x1c')]===undefined?!![]:![]:!![],'where':_0x33011c[_0x52a9('0x1b')]?_0x33011c[_0x52a9('0x1b')]['where']||null:null,'attributes':_0x33011c['options']?_0x33011c['options']['attributes']||null:null,'limit':_0x33011c[_0x52a9('0x1b')]?_0x33011c[_0x52a9('0x1b')][_0x52a9('0x1d')]||null:null,'include':_0x33011c[_0x52a9('0x1b')]?_0x33011c[_0x52a9('0x1b')][_0x52a9('0x1e')]?_[_0x52a9('0x1f')](_0x33011c[_0x52a9('0x1b')][_0x52a9('0x1e')],function(_0x54de35){return{'model':db[_0x54de35[_0x52a9('0x20')]],'as':_0x54de35['as'],'attributes':_0x54de35[_0x52a9('0x21')],'include':_0x54de35['include']?_[_0x52a9('0x1f')](_0x54de35[_0x52a9('0x1e')],function(_0x7b81fb){return{'model':db[_0x7b81fb['model']],'as':_0x7b81fb['as'],'attributes':_0x7b81fb['attributes'],'include':_0x7b81fb[_0x52a9('0x1e')]?_['map'](_0x7b81fb['include'],function(_0x10804c){return{'model':db[_0x10804c[_0x52a9('0x20')]],'as':_0x10804c['as'],'attributes':_0x10804c[_0x52a9('0x21')]};}):[]};}):[]};}):[]:[]})[_0x52a9('0xd')](function(_0x5420dc){logger[_0x52a9('0xe')](_0x52a9('0x18'),_0x33011c);logger['debug']('GetSugarcrmAccount',_0x33011c,JSON[_0x52a9('0x22')](_0x5420dc));_0x41350c(_0x5420dc);})[_0x52a9('0x17')](function(_0x2ef35d){logger[_0x52a9('0x13')]('GetSugarcrmAccount',_0x2ef35d[_0x52a9('0x15')],_0x33011c);_0x488454(_0x1bfbb9[_0x52a9('0x13')](0x1f4,_0x2ef35d[_0x52a9('0x15')]));});});};exports['ShowSugarcrmAccount']=function(_0x44aa0a){var _0x144d80=this;return new Promise(function(_0xce1f44,_0x72890b){return db['SugarcrmAccount'][_0x52a9('0x23')]({'raw':_0x44aa0a[_0x52a9('0x1b')]?_0x44aa0a['options'][_0x52a9('0x1c')]===undefined?!![]:![]:!![],'where':_0x44aa0a[_0x52a9('0x1b')]?_0x44aa0a[_0x52a9('0x1b')][_0x52a9('0x24')]||null:null,'attributes':_0x44aa0a['options']?_0x44aa0a['options'][_0x52a9('0x21')]||null:null,'include':_0x44aa0a[_0x52a9('0x1b')]?_0x44aa0a[_0x52a9('0x1b')][_0x52a9('0x1e')]?_[_0x52a9('0x1f')](_0x44aa0a[_0x52a9('0x1b')][_0x52a9('0x1e')],function(_0x2d94e1){return{'model':db[_0x2d94e1[_0x52a9('0x20')]],'as':_0x2d94e1['as'],'attributes':_0x2d94e1[_0x52a9('0x21')],'include':_0x2d94e1[_0x52a9('0x1e')]?_[_0x52a9('0x1f')](_0x2d94e1['include'],function(_0x2c6341){return{'model':db[_0x2c6341[_0x52a9('0x20')]],'as':_0x2c6341['as'],'attributes':_0x2c6341[_0x52a9('0x21')],'include':_0x2c6341[_0x52a9('0x1e')]?_[_0x52a9('0x1f')](_0x2c6341[_0x52a9('0x1e')],function(_0x226981){return{'model':db[_0x226981['model']],'as':_0x226981['as'],'attributes':_0x226981[_0x52a9('0x21')]};}):[]};}):[]};}):[]:[]})[_0x52a9('0xd')](function(_0x58e4b9){logger[_0x52a9('0xe')]('ShowSugarcrmAccount',_0x44aa0a);logger[_0x52a9('0x11')]('ShowSugarcrmAccount',_0x44aa0a,JSON[_0x52a9('0x22')](_0x58e4b9));_0xce1f44(_0x58e4b9);})['catch'](function(_0x56bbec){logger[_0x52a9('0x13')](_0x52a9('0x25'),_0x56bbec[_0x52a9('0x15')],_0x44aa0a);_0x72890b(_0x144d80[_0x52a9('0x13')](0x1f4,_0x56bbec[_0x52a9('0x15')]));});});}; \ No newline at end of file +var _0x1588=['model','ShowSugarcrmAccount','find','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','request','then','info','SugarcrmAccount,\x20%s,\x20%s','debug','SugarcrmAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','GetSugarcrmAccount','SugarcrmAccount','options','raw','where','attributes','limit','include','map'];(function(_0x5f2327,_0x123bcd){var _0x304698=function(_0x5eb594){while(--_0x5eb594){_0x5f2327['push'](_0x5f2327['shift']());}};_0x304698(++_0x123bcd);}(_0x1588,0x1bd));var _0x8158=function(_0x297b73,_0x3c58ef){_0x297b73=_0x297b73-0x0;var _0x2c5cda=_0x1588[_0x297b73];return _0x2c5cda;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0x8158('0x0'));var rs=require(_0x8158('0x1'));var fs=require('fs');var Redis=require(_0x8158('0x2'));var db=require(_0x8158('0x3'))['db'];var utils=require(_0x8158('0x4'));var logger=require(_0x8158('0x5'))('rpc');var config=require(_0x8158('0x6'));var jayson=require(_0x8158('0x7'));var client=jayson['client'][_0x8158('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x569df0,_0x15b445,_0x584e66){return new BPromise(function(_0x4400b4,_0x377cd1){return client[_0x8158('0x9')](_0x569df0,_0x584e66)[_0x8158('0xa')](function(_0x5b089d){logger[_0x8158('0xb')](_0x8158('0xc'),_0x15b445,'request\x20sent');logger[_0x8158('0xd')](_0x8158('0xe'),_0x15b445,_0x8158('0xf'),JSON[_0x8158('0x10')](_0x5b089d));if(_0x5b089d[_0x8158('0x11')]){if(_0x5b089d[_0x8158('0x11')][_0x8158('0x12')]===0x1f4){logger['error'](_0x8158('0xc'),_0x15b445,_0x5b089d['error']['message']);return _0x377cd1(_0x5b089d[_0x8158('0x11')]['message']);}logger['error'](_0x8158('0xc'),_0x15b445,_0x5b089d[_0x8158('0x11')][_0x8158('0x13')]);return _0x4400b4(_0x5b089d['error'][_0x8158('0x13')]);}else{logger[_0x8158('0xb')](_0x8158('0xc'),_0x15b445,'request\x20sent');_0x4400b4(_0x5b089d[_0x8158('0x14')][_0x8158('0x13')]);}})[_0x8158('0x15')](function(_0x175de3){logger[_0x8158('0x11')](_0x8158('0xc'),_0x15b445,_0x175de3);_0x377cd1(_0x175de3);});});}exports[_0x8158('0x16')]=function(_0x1a86e0){var _0x5b97b0=this;return new Promise(function(_0x999559,_0x23093e){return db[_0x8158('0x17')]['findAll']({'raw':_0x1a86e0[_0x8158('0x18')]?_0x1a86e0[_0x8158('0x18')][_0x8158('0x19')]===undefined?!![]:![]:!![],'where':_0x1a86e0[_0x8158('0x18')]?_0x1a86e0['options'][_0x8158('0x1a')]||null:null,'attributes':_0x1a86e0[_0x8158('0x18')]?_0x1a86e0[_0x8158('0x18')][_0x8158('0x1b')]||null:null,'limit':_0x1a86e0[_0x8158('0x18')]?_0x1a86e0[_0x8158('0x18')][_0x8158('0x1c')]||null:null,'include':_0x1a86e0[_0x8158('0x18')]?_0x1a86e0[_0x8158('0x18')][_0x8158('0x1d')]?_[_0x8158('0x1e')](_0x1a86e0[_0x8158('0x18')][_0x8158('0x1d')],function(_0x2474d2){return{'model':db[_0x2474d2['model']],'as':_0x2474d2['as'],'attributes':_0x2474d2[_0x8158('0x1b')],'include':_0x2474d2[_0x8158('0x1d')]?_[_0x8158('0x1e')](_0x2474d2[_0x8158('0x1d')],function(_0x362dbe){return{'model':db[_0x362dbe[_0x8158('0x1f')]],'as':_0x362dbe['as'],'attributes':_0x362dbe[_0x8158('0x1b')],'include':_0x362dbe[_0x8158('0x1d')]?_[_0x8158('0x1e')](_0x362dbe['include'],function(_0x87656f){return{'model':db[_0x87656f[_0x8158('0x1f')]],'as':_0x87656f['as'],'attributes':_0x87656f['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x5998f0){logger[_0x8158('0xb')](_0x8158('0x16'),_0x1a86e0);logger[_0x8158('0xd')](_0x8158('0x16'),_0x1a86e0,JSON[_0x8158('0x10')](_0x5998f0));_0x999559(_0x5998f0);})[_0x8158('0x15')](function(_0x1b5a14){logger['error'](_0x8158('0x16'),_0x1b5a14['message'],_0x1a86e0);_0x23093e(_0x5b97b0[_0x8158('0x11')](0x1f4,_0x1b5a14[_0x8158('0x13')]));});});};exports[_0x8158('0x20')]=function(_0x4cd8c1){var _0x488c21=this;return new Promise(function(_0x5734fe,_0x176ed8){return db[_0x8158('0x17')][_0x8158('0x21')]({'raw':_0x4cd8c1['options']?_0x4cd8c1['options'][_0x8158('0x19')]===undefined?!![]:![]:!![],'where':_0x4cd8c1[_0x8158('0x18')]?_0x4cd8c1[_0x8158('0x18')][_0x8158('0x1a')]||null:null,'attributes':_0x4cd8c1[_0x8158('0x18')]?_0x4cd8c1['options']['attributes']||null:null,'include':_0x4cd8c1[_0x8158('0x18')]?_0x4cd8c1['options'][_0x8158('0x1d')]?_[_0x8158('0x1e')](_0x4cd8c1['options'][_0x8158('0x1d')],function(_0x15de3e){return{'model':db[_0x15de3e[_0x8158('0x1f')]],'as':_0x15de3e['as'],'attributes':_0x15de3e['attributes'],'include':_0x15de3e[_0x8158('0x1d')]?_[_0x8158('0x1e')](_0x15de3e[_0x8158('0x1d')],function(_0xacfcbb){return{'model':db[_0xacfcbb[_0x8158('0x1f')]],'as':_0xacfcbb['as'],'attributes':_0xacfcbb['attributes'],'include':_0xacfcbb['include']?_[_0x8158('0x1e')](_0xacfcbb[_0x8158('0x1d')],function(_0x3742ba){return{'model':db[_0x3742ba['model']],'as':_0x3742ba['as'],'attributes':_0x3742ba[_0x8158('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x8158('0xa')](function(_0xde6780){logger['info'](_0x8158('0x20'),_0x4cd8c1);logger[_0x8158('0xd')](_0x8158('0x20'),_0x4cd8c1,JSON['stringify'](_0xde6780));_0x5734fe(_0xde6780);})[_0x8158('0x15')](function(_0x131841){logger[_0x8158('0x11')](_0x8158('0x20'),_0x131841['message'],_0x4cd8c1);_0x176ed8(_0x488c21[_0x8158('0x11')](0x1f4,_0x131841[_0x8158('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/index.js b/server/api/intSugarcrmConfiguration/index.js index 0335e01..e0bd2b9 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 _0x8898=['exports','multer','path','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSugarcrmConfiguration.controller','isAuthenticated','index','get','/:id','show','/:id/fields','getFields','/:id/subjects','getDescriptions','create','put','update','delete','destroy'];(function(_0x2deb38,_0xe86ff8){var _0x560599=function(_0x2c8e37){while(--_0x2c8e37){_0x2deb38['push'](_0x2deb38['shift']());}};_0x560599(++_0xe86ff8);}(_0x8898,0xc7));var _0x8889=function(_0xe83032,_0x2c2509){_0xe83032=_0xe83032-0x0;var _0x303ab6=_0x8898[_0xe83032];return _0x303ab6;};'use strict';var multer=require(_0x8889('0x0'));var util=require('util');var path=require(_0x8889('0x1'));var timeout=require('connect-timeout');var express=require(_0x8889('0x2'));var router=express['Router']();var auth=require(_0x8889('0x3'));var interaction=require(_0x8889('0x4'));var config=require(_0x8889('0x5'));var controller=require(_0x8889('0x6'));router['get']('/',auth[_0x8889('0x7')](),controller[_0x8889('0x8')]);router[_0x8889('0x9')](_0x8889('0xa'),auth['isAuthenticated'](),controller[_0x8889('0xb')]);router[_0x8889('0x9')](_0x8889('0xc'),auth['isAuthenticated'](),controller[_0x8889('0xd')]);router['get'](_0x8889('0xe'),auth[_0x8889('0x7')](),controller['getSubjects']);router[_0x8889('0x9')]('/:id/descriptions',auth[_0x8889('0x7')](),controller[_0x8889('0xf')]);router['post']('/',auth[_0x8889('0x7')](),controller[_0x8889('0x10')]);router[_0x8889('0x11')](_0x8889('0xa'),auth[_0x8889('0x7')](),controller[_0x8889('0x12')]);router[_0x8889('0x13')](_0x8889('0xa'),auth['isAuthenticated'](),controller[_0x8889('0x14')]);module[_0x8889('0x15')]=router; \ No newline at end of file +var _0x2c7a=['./intSugarcrmConfiguration.controller','get','isAuthenticated','index','/:id','show','getFields','/:id/subjects','/:id/descriptions','create','put','update','delete','destroy','exports','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x59c942,_0x4779f2){var _0x4091a0=function(_0x5e97ac){while(--_0x5e97ac){_0x59c942['push'](_0x59c942['shift']());}};_0x4091a0(++_0x4779f2);}(_0x2c7a,0xd5));var _0xa2c7=function(_0xf88794,_0x34ab04){_0xf88794=_0xf88794-0x0;var _0x53e972=_0x2c7a[_0xf88794];return _0x53e972;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xa2c7('0x0'));var timeout=require(_0xa2c7('0x1'));var express=require(_0xa2c7('0x2'));var router=express[_0xa2c7('0x3')]();var auth=require(_0xa2c7('0x4'));var interaction=require(_0xa2c7('0x5'));var config=require(_0xa2c7('0x6'));var controller=require(_0xa2c7('0x7'));router[_0xa2c7('0x8')]('/',auth[_0xa2c7('0x9')](),controller[_0xa2c7('0xa')]);router[_0xa2c7('0x8')](_0xa2c7('0xb'),auth[_0xa2c7('0x9')](),controller[_0xa2c7('0xc')]);router[_0xa2c7('0x8')]('/:id/fields',auth['isAuthenticated'](),controller[_0xa2c7('0xd')]);router[_0xa2c7('0x8')](_0xa2c7('0xe'),auth[_0xa2c7('0x9')](),controller['getSubjects']);router[_0xa2c7('0x8')](_0xa2c7('0xf'),auth[_0xa2c7('0x9')](),controller['getDescriptions']);router['post']('/',auth['isAuthenticated'](),controller[_0xa2c7('0x10')]);router[_0xa2c7('0x11')]('/:id',auth[_0xa2c7('0x9')](),controller[_0xa2c7('0x12')]);router[_0xa2c7('0x13')](_0xa2c7('0xb'),auth['isAuthenticated'](),controller[_0xa2c7('0x14')]);module[_0xa2c7('0x15')]=router; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.attributes.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.attributes.js index fc774bf..1079aaa 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 _0x54b7=['STRING','sequelize'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x54b7,0xdb));var _0x754b=function(_0x29f170,_0x11ceee){_0x29f170=_0x29f170-0x0;var _0x3d91db=_0x54b7[_0x29f170];return _0x3d91db;};'use strict';var Sequelize=require(_0x754b('0x0'));module['exports']={'name':{'type':Sequelize[_0x754b('0x1')]},'description':{'type':Sequelize[_0x754b('0x1')]}}; \ No newline at end of file +var _0xa9a6=['STRING','sequelize','exports'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xa9a6,0x1de));var _0x6a9a=function(_0x622b5f,_0x3f99d0){_0x622b5f=_0x622b5f-0x0;var _0x596bcf=_0xa9a6[_0x622b5f];return _0x596bcf;};'use strict';var Sequelize=require(_0x6a9a('0x0'));module[_0x6a9a('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x6a9a('0x2')]}}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.controller.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.controller.js index f917c02..6f99c26 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 _0xa1c4=['info','catch','status','end','json','count','offset','limit','Content-Range','reject','save','destroy','sendStatus','stack','name','send','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','where','merge','VIRTUAL','filter','options','SugarcrmConfiguration','includeAll','include','findAll','create','body','update','find','params','getFields','getSubjects','SugarcrmField','getDescriptions','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../mysqldb','jayson/promise','client','test','Sequelize','request','then','SugarcrmConfiguration,\x20%s,\x20%s','request\x20sent','debug','SugarcrmConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x355c21,_0x31c30d){var _0x1102d5=function(_0x3968d0){while(--_0x3968d0){_0x355c21['push'](_0x355c21['shift']());}};_0x1102d5(++_0x31c30d);}(_0xa1c4,0x91));var _0x4a1c=function(_0x393bf5,_0x225cac){_0x393bf5=_0x393bf5-0x0;var _0xcb023=_0xa1c4[_0x393bf5];return _0xcb023;};'use strict';var pdf=require(_0x4a1c('0x0'));var emlformat=require(_0x4a1c('0x1'));var rimraf=require(_0x4a1c('0x2'));var zipdir=require(_0x4a1c('0x3'));var jsonpatch=require(_0x4a1c('0x4'));var rp=require(_0x4a1c('0x5'));var moment=require(_0x4a1c('0x6'));var BPromise=require(_0x4a1c('0x7'));var Mustache=require(_0x4a1c('0x8'));var util=require(_0x4a1c('0x9'));var path=require(_0x4a1c('0xa'));var sox=require(_0x4a1c('0xb'));var csv=require(_0x4a1c('0xc'));var ejs=require(_0x4a1c('0xd'));var fs=require('fs');var _=require(_0x4a1c('0xe'));var squel=require('squel');var crypto=require(_0x4a1c('0xf'));var jsforce=require(_0x4a1c('0x10'));var deskjs=require(_0x4a1c('0x11'));var toCsv=require(_0x4a1c('0xc'));var querystring=require(_0x4a1c('0x12'));var Papa=require(_0x4a1c('0x13'));var Redis=require('ioredis');var authService=require(_0x4a1c('0x14'));var qs=require(_0x4a1c('0x15'));var as=require(_0x4a1c('0x16'));var hardwareService=require(_0x4a1c('0x17'));var logger=require(_0x4a1c('0x18'))('api');var utils=require(_0x4a1c('0x19'));var config=require('../../config/environment');var db=require(_0x4a1c('0x1a'))['db'];var jayson=require(_0x4a1c('0x1b'));var client=jayson[_0x4a1c('0x1c')]['http']({'port':0x232a});function checkPasswordPattern(_0x2ab10d,_0x206011,_0x2c8ca0){if(_0x2c8ca0){var _0x106c61=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x106c61[_0x4a1c('0x1d')](_0x206011)){return _0x2ab10d;}else{throw new db[(_0x4a1c('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 _0x2ab10d;}}function respondWithRpcPromise(_0x21e2a7,_0x3628a9,_0x36a191,_0x5d5863){return new BPromise(function(_0x2418f7,_0x216eac){var _0x2bb934=_0x5d5863||client;return _0x2bb934[_0x4a1c('0x1f')](_0x21e2a7,_0x36a191)[_0x4a1c('0x20')](function(_0x17cc13){logger['info'](_0x4a1c('0x21'),_0x3628a9,_0x4a1c('0x22'));logger[_0x4a1c('0x23')](_0x4a1c('0x24'),_0x3628a9,_0x4a1c('0x22'),JSON[_0x4a1c('0x25')](_0x17cc13));if(_0x17cc13['error']){if(_0x17cc13[_0x4a1c('0x26')][_0x4a1c('0x27')]===0x1f4){logger[_0x4a1c('0x26')]('SugarcrmConfiguration,\x20%s,\x20%s',_0x3628a9,_0x17cc13[_0x4a1c('0x26')][_0x4a1c('0x28')]);return _0x216eac(_0x17cc13[_0x4a1c('0x26')][_0x4a1c('0x28')]);}logger['error'](_0x4a1c('0x21'),_0x3628a9,_0x17cc13[_0x4a1c('0x26')][_0x4a1c('0x28')]);return _0x2418f7(_0x17cc13[_0x4a1c('0x26')][_0x4a1c('0x28')]);}else{logger[_0x4a1c('0x29')]('SugarcrmConfiguration,\x20%s,\x20%s',_0x3628a9,_0x4a1c('0x22'));_0x2418f7(_0x17cc13['result'][_0x4a1c('0x28')]);}})[_0x4a1c('0x2a')](function(_0x184de5){logger[_0x4a1c('0x26')](_0x4a1c('0x21'),_0x3628a9,_0x184de5);_0x216eac(_0x184de5);});});}function respondWithStatusCode(_0x8905f3,_0x29ecb6){_0x29ecb6=_0x29ecb6||0xcc;return function(_0x4b3004){if(_0x4b3004){return _0x8905f3['sendStatus'](_0x29ecb6);}return _0x8905f3[_0x4a1c('0x2b')](_0x29ecb6)[_0x4a1c('0x2c')]();};}function respondWithResult(_0x115bd8,_0x3a158d){_0x3a158d=_0x3a158d||0xc8;return function(_0x3f50c1){if(_0x3f50c1){return _0x115bd8[_0x4a1c('0x2b')](_0x3a158d)[_0x4a1c('0x2d')](_0x3f50c1);}};}function respondWithFilteredResult(_0xf8f22b,_0x937e82){return function(_0xf6e4fc){if(_0xf6e4fc){var _0x4b3b08=_0xf6e4fc[_0x4a1c('0x2e')],_0x17bc54=_0x937e82[_0x4a1c('0x2f')],_0x34b04a=_0x937e82[_0x4a1c('0x2f')]+_0x937e82[_0x4a1c('0x30')],_0x289ed1;if(_0x34b04a>=_0x4b3b08){_0x34b04a=_0x4b3b08;_0x289ed1=0xc8;}else{_0x289ed1=0xce;}_0xf8f22b['status'](_0x289ed1);return _0xf8f22b['set'](_0x4a1c('0x31'),_0x17bc54+'-'+_0x34b04a+'/'+_0x4b3b08)[_0x4a1c('0x2d')](_0xf6e4fc);}return null;};}function patchUpdates(_0x5af5a4){return function(_0x43607d){try{jsonpatch['apply'](_0x43607d,_0x5af5a4,!![]);}catch(_0x369f8f){return BPromise[_0x4a1c('0x32')](_0x369f8f);}return _0x43607d[_0x4a1c('0x33')]();};}function saveUpdates(_0x3d0ace,_0x121d37){return function(_0x32f5c3){if(_0x32f5c3){return _0x32f5c3['update'](_0x3d0ace)[_0x4a1c('0x20')](function(_0xf4e32c){return _0xf4e32c;});}return null;};}function removeEntity(_0x35229d,_0x5eedb6){return function(_0x43386f){if(_0x43386f){return _0x43386f[_0x4a1c('0x34')]()[_0x4a1c('0x20')](function(){_0x35229d['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x2950b7,_0xcbd132){return function(_0x12c00c){if(!_0x12c00c){_0x2950b7[_0x4a1c('0x35')](0x194);}return _0x12c00c;};}function handleError(_0x33c129,_0x35ca41){_0x35ca41=_0x35ca41||0x1f4;return function(_0x4bd79f){logger['error'](_0x4bd79f[_0x4a1c('0x36')]);if(_0x4bd79f['name']){delete _0x4bd79f[_0x4a1c('0x37')];}_0x33c129[_0x4a1c('0x2b')](_0x35ca41)[_0x4a1c('0x38')](_0x4bd79f);};}exports['index']=function(_0x4fd249,_0x18df86){var _0x38d05b={},_0x1e3c52={},_0x58fda0={'count':0x0,'rows':[]};var _0x570f60=_['map'](db['SugarcrmConfiguration'][_0x4a1c('0x39')],function(_0x15de16){return{'name':_0x15de16[_0x4a1c('0x3a')],'type':_0x15de16[_0x4a1c('0x3b')][_0x4a1c('0x3c')]};});_0x1e3c52[_0x4a1c('0x3d')]=_[_0x4a1c('0x3e')](_0x570f60,_0x4a1c('0x37'));_0x1e3c52[_0x4a1c('0x3f')]=_[_0x4a1c('0x40')](_0x4fd249['query']);_0x1e3c52[_0x4a1c('0x41')]=_[_0x4a1c('0x42')](_0x1e3c52[_0x4a1c('0x3d')],_0x1e3c52[_0x4a1c('0x3f')]);_0x38d05b[_0x4a1c('0x43')]=_[_0x4a1c('0x42')](_0x1e3c52[_0x4a1c('0x3d')],qs[_0x4a1c('0x44')](_0x4fd249['query'][_0x4a1c('0x44')]));_0x38d05b['attributes']=_0x38d05b[_0x4a1c('0x43')][_0x4a1c('0x45')]?_0x38d05b[_0x4a1c('0x43')]:_0x1e3c52[_0x4a1c('0x3d')];if(!_0x4fd249[_0x4a1c('0x3f')][_0x4a1c('0x46')](_0x4a1c('0x47'))){_0x38d05b[_0x4a1c('0x30')]=qs[_0x4a1c('0x30')](_0x4fd249['query']['limit']);_0x38d05b['offset']=qs[_0x4a1c('0x2f')](_0x4fd249['query']['offset']);}_0x38d05b[_0x4a1c('0x48')]=qs[_0x4a1c('0x49')](_0x4fd249[_0x4a1c('0x3f')][_0x4a1c('0x49')]);_0x38d05b['where']=qs[_0x4a1c('0x41')](_[_0x4a1c('0x4a')](_0x4fd249[_0x4a1c('0x3f')],_0x1e3c52[_0x4a1c('0x41')]),_0x570f60);if(_0x4fd249['query']['filter']){_0x38d05b[_0x4a1c('0x4b')]=_[_0x4a1c('0x4c')](_0x38d05b[_0x4a1c('0x4b')],{'$or':_[_0x4a1c('0x3e')](_0x570f60,function(_0x1b4106){if(_0x1b4106[_0x4a1c('0x3b')]!==_0x4a1c('0x4d')){var _0x259762={};_0x259762[_0x1b4106[_0x4a1c('0x37')]]={'$like':'%'+_0x4fd249[_0x4a1c('0x3f')][_0x4a1c('0x4e')]+'%'};return _0x259762;}})});}_0x38d05b=_[_0x4a1c('0x4c')]({},_0x38d05b,_0x4fd249[_0x4a1c('0x4f')]);var _0x1b66e8={'where':_0x38d05b['where']};return db[_0x4a1c('0x50')][_0x4a1c('0x2e')](_0x1b66e8)[_0x4a1c('0x20')](function(_0x19c0f9){_0x58fda0['count']=_0x19c0f9;if(_0x4fd249['query'][_0x4a1c('0x51')]){_0x38d05b[_0x4a1c('0x52')]=[{'all':!![]}];}return db['SugarcrmConfiguration'][_0x4a1c('0x53')](_0x38d05b);})[_0x4a1c('0x20')](function(_0x837098){_0x58fda0['rows']=_0x837098;return _0x58fda0;})[_0x4a1c('0x20')](respondWithFilteredResult(_0x18df86,_0x38d05b))[_0x4a1c('0x2a')](handleError(_0x18df86,null));};exports['show']=function(_0x2654e9,_0x40505e){var _0x2fa670={'raw':![],'where':{'id':_0x2654e9['params']['id']}},_0x64fa82={};_0x64fa82[_0x4a1c('0x3d')]=_[_0x4a1c('0x40')](db[_0x4a1c('0x50')]['rawAttributes']);_0x64fa82[_0x4a1c('0x3f')]=_[_0x4a1c('0x40')](_0x2654e9['query']);_0x64fa82[_0x4a1c('0x41')]=_[_0x4a1c('0x42')](_0x64fa82[_0x4a1c('0x3d')],_0x64fa82[_0x4a1c('0x3f')]);_0x2fa670['attributes']=_[_0x4a1c('0x42')](_0x64fa82[_0x4a1c('0x3d')],qs['fields'](_0x2654e9[_0x4a1c('0x3f')][_0x4a1c('0x44')]));_0x2fa670[_0x4a1c('0x43')]=_0x2fa670[_0x4a1c('0x43')]['length']?_0x2fa670[_0x4a1c('0x43')]:_0x64fa82[_0x4a1c('0x3d')];if(_0x2654e9[_0x4a1c('0x3f')][_0x4a1c('0x51')]){_0x2fa670[_0x4a1c('0x52')]=[{'all':!![]}];}_0x2fa670=_[_0x4a1c('0x4c')]({},_0x2fa670,_0x2654e9[_0x4a1c('0x4f')]);return db[_0x4a1c('0x50')]['find'](_0x2fa670)[_0x4a1c('0x20')](handleEntityNotFound(_0x40505e,null))[_0x4a1c('0x20')](respondWithResult(_0x40505e,null))[_0x4a1c('0x2a')](handleError(_0x40505e,null));};exports[_0x4a1c('0x54')]=function(_0x6ad717,_0x227157){return db[_0x4a1c('0x50')][_0x4a1c('0x54')](_0x6ad717[_0x4a1c('0x55')],{})[_0x4a1c('0x20')](respondWithResult(_0x227157,0xc9))[_0x4a1c('0x2a')](handleError(_0x227157,null));};exports[_0x4a1c('0x56')]=function(_0x580990,_0x1ec36d){if(_0x580990[_0x4a1c('0x55')]['id']){delete _0x580990[_0x4a1c('0x55')]['id'];}return db[_0x4a1c('0x50')][_0x4a1c('0x57')]({'where':{'id':_0x580990[_0x4a1c('0x58')]['id']}})[_0x4a1c('0x20')](handleEntityNotFound(_0x1ec36d,null))['then'](saveUpdates(_0x580990[_0x4a1c('0x55')],null))['then'](respondWithResult(_0x1ec36d,null))[_0x4a1c('0x2a')](handleError(_0x1ec36d,null));};exports['destroy']=function(_0x353fd1,_0x4e7379){return db['SugarcrmConfiguration'][_0x4a1c('0x57')]({'where':{'id':_0x353fd1[_0x4a1c('0x58')]['id']}})[_0x4a1c('0x20')](handleEntityNotFound(_0x4e7379,null))['then'](removeEntity(_0x4e7379,null))['catch'](handleError(_0x4e7379,null));};exports[_0x4a1c('0x59')]=function(_0x591f33,_0x3be85a,_0x463b2c){var _0x239412={};var _0x3b7af7={};var _0x2c2fa9;var _0x514821;return db[_0x4a1c('0x50')]['findOne']({'where':{'id':_0x591f33[_0x4a1c('0x58')]['id']}})['then'](handleEntityNotFound(_0x3be85a,null))[_0x4a1c('0x20')](function(_0x22d921){if(_0x22d921){_0x2c2fa9=_0x22d921;_0x3b7af7[_0x4a1c('0x3d')]=_[_0x4a1c('0x40')](db['SugarcrmField'][_0x4a1c('0x39')]);_0x3b7af7['query']=_[_0x4a1c('0x40')](_0x591f33[_0x4a1c('0x3f')]);_0x3b7af7[_0x4a1c('0x41')]=_[_0x4a1c('0x42')](_0x3b7af7[_0x4a1c('0x3d')],_0x3b7af7[_0x4a1c('0x3f')]);_0x239412['attributes']=_[_0x4a1c('0x42')](_0x3b7af7[_0x4a1c('0x3d')],qs['fields'](_0x591f33['query'][_0x4a1c('0x44')]));_0x239412[_0x4a1c('0x43')]=_0x239412[_0x4a1c('0x43')][_0x4a1c('0x45')]?_0x239412['attributes']:_0x3b7af7[_0x4a1c('0x3d')];_0x239412[_0x4a1c('0x48')]=qs[_0x4a1c('0x49')](_0x591f33['query'][_0x4a1c('0x49')]);_0x239412[_0x4a1c('0x4b')]=qs[_0x4a1c('0x41')](_['pick'](_0x591f33[_0x4a1c('0x3f')],_0x3b7af7[_0x4a1c('0x41')]));if(_0x591f33[_0x4a1c('0x3f')]['filter']){_0x239412[_0x4a1c('0x4b')]=_[_0x4a1c('0x4c')](_0x239412[_0x4a1c('0x4b')],{'$or':_[_0x4a1c('0x3e')](_0x239412[_0x4a1c('0x43')],function(_0x5e9768){var _0x236d5a={};_0x236d5a[_0x5e9768]={'$like':'%'+_0x591f33[_0x4a1c('0x3f')][_0x4a1c('0x4e')]+'%'};return _0x236d5a;})});}_0x239412=_[_0x4a1c('0x4c')]({},_0x239412,_0x591f33['options']);return _0x2c2fa9['getFields'](_0x239412);}})[_0x4a1c('0x20')](function(_0x515899){if(_0x515899){_0x514821=_0x515899[_0x4a1c('0x45')];if(!_0x591f33[_0x4a1c('0x3f')][_0x4a1c('0x46')](_0x4a1c('0x47'))){_0x239412[_0x4a1c('0x30')]=qs['limit'](_0x591f33[_0x4a1c('0x3f')][_0x4a1c('0x30')]);_0x239412[_0x4a1c('0x2f')]=qs[_0x4a1c('0x2f')](_0x591f33[_0x4a1c('0x3f')][_0x4a1c('0x2f')]);}return _0x2c2fa9['getFields'](_0x239412);}})['then'](function(_0x2423f9){if(_0x2423f9){return _0x2423f9?{'count':_0x514821,'rows':_0x2423f9}:null;}})[_0x4a1c('0x20')](respondWithResult(_0x3be85a,null))[_0x4a1c('0x2a')](handleError(_0x3be85a,null));};exports[_0x4a1c('0x5a')]=function(_0x472c5c,_0x407810,_0x237080){var _0x287b43={};var _0x553059={};var _0x4b8358;var _0x55de44;return db['SugarcrmConfiguration']['findOne']({'where':{'id':_0x472c5c[_0x4a1c('0x58')]['id']}})['then'](handleEntityNotFound(_0x407810,null))[_0x4a1c('0x20')](function(_0x4fe951){if(_0x4fe951){_0x4b8358=_0x4fe951;_0x553059['model']=_['keys'](db[_0x4a1c('0x5b')]['rawAttributes']);_0x553059[_0x4a1c('0x3f')]=_[_0x4a1c('0x40')](_0x472c5c['query']);_0x553059[_0x4a1c('0x41')]=_[_0x4a1c('0x42')](_0x553059[_0x4a1c('0x3d')],_0x553059[_0x4a1c('0x3f')]);_0x287b43[_0x4a1c('0x43')]=_[_0x4a1c('0x42')](_0x553059[_0x4a1c('0x3d')],qs[_0x4a1c('0x44')](_0x472c5c[_0x4a1c('0x3f')]['fields']));_0x287b43[_0x4a1c('0x43')]=_0x287b43['attributes'][_0x4a1c('0x45')]?_0x287b43[_0x4a1c('0x43')]:_0x553059[_0x4a1c('0x3d')];_0x287b43[_0x4a1c('0x48')]=qs[_0x4a1c('0x49')](_0x472c5c[_0x4a1c('0x3f')][_0x4a1c('0x49')]);_0x287b43[_0x4a1c('0x4b')]=qs[_0x4a1c('0x41')](_[_0x4a1c('0x4a')](_0x472c5c[_0x4a1c('0x3f')],_0x553059['filters']));if(_0x472c5c['query']['filter']){_0x287b43[_0x4a1c('0x4b')]=_[_0x4a1c('0x4c')](_0x287b43[_0x4a1c('0x4b')],{'$or':_[_0x4a1c('0x3e')](_0x287b43[_0x4a1c('0x43')],function(_0x4071eb){var _0x52128d={};_0x52128d[_0x4071eb]={'$like':'%'+_0x472c5c[_0x4a1c('0x3f')][_0x4a1c('0x4e')]+'%'};return _0x52128d;})});}_0x287b43=_[_0x4a1c('0x4c')]({},_0x287b43,_0x472c5c[_0x4a1c('0x4f')]);return _0x4b8358['getSubjects'](_0x287b43);}})['then'](function(_0xa6356f){if(_0xa6356f){_0x55de44=_0xa6356f[_0x4a1c('0x45')];if(!_0x472c5c[_0x4a1c('0x3f')]['hasOwnProperty'](_0x4a1c('0x47'))){_0x287b43[_0x4a1c('0x30')]=qs[_0x4a1c('0x30')](_0x472c5c[_0x4a1c('0x3f')][_0x4a1c('0x30')]);_0x287b43[_0x4a1c('0x2f')]=qs[_0x4a1c('0x2f')](_0x472c5c[_0x4a1c('0x3f')]['offset']);}return _0x4b8358['getSubjects'](_0x287b43);}})[_0x4a1c('0x20')](function(_0x72d909){if(_0x72d909){return _0x72d909?{'count':_0x55de44,'rows':_0x72d909}:null;}})[_0x4a1c('0x20')](respondWithResult(_0x407810,null))[_0x4a1c('0x2a')](handleError(_0x407810,null));};exports[_0x4a1c('0x5c')]=function(_0x555eb4,_0x96ef9a,_0x1f1bb6){var _0x3cc958={};var _0x7026e0={};var _0x320d09;var _0x7e535c;return db['SugarcrmConfiguration']['findOne']({'where':{'id':_0x555eb4['params']['id']}})[_0x4a1c('0x20')](handleEntityNotFound(_0x96ef9a,null))['then'](function(_0x275ada){if(_0x275ada){_0x320d09=_0x275ada;_0x7026e0[_0x4a1c('0x3d')]=_[_0x4a1c('0x40')](db[_0x4a1c('0x5b')]['rawAttributes']);_0x7026e0[_0x4a1c('0x3f')]=_['keys'](_0x555eb4['query']);_0x7026e0[_0x4a1c('0x41')]=_['intersection'](_0x7026e0[_0x4a1c('0x3d')],_0x7026e0['query']);_0x3cc958['attributes']=_[_0x4a1c('0x42')](_0x7026e0[_0x4a1c('0x3d')],qs[_0x4a1c('0x44')](_0x555eb4['query'][_0x4a1c('0x44')]));_0x3cc958[_0x4a1c('0x43')]=_0x3cc958['attributes']['length']?_0x3cc958[_0x4a1c('0x43')]:_0x7026e0[_0x4a1c('0x3d')];_0x3cc958[_0x4a1c('0x48')]=qs[_0x4a1c('0x49')](_0x555eb4['query'][_0x4a1c('0x49')]);_0x3cc958[_0x4a1c('0x4b')]=qs[_0x4a1c('0x41')](_[_0x4a1c('0x4a')](_0x555eb4['query'],_0x7026e0[_0x4a1c('0x41')]));if(_0x555eb4['query']['filter']){_0x3cc958[_0x4a1c('0x4b')]=_['merge'](_0x3cc958['where'],{'$or':_[_0x4a1c('0x3e')](_0x3cc958[_0x4a1c('0x43')],function(_0x5a3698){var _0x23f7c6={};_0x23f7c6[_0x5a3698]={'$like':'%'+_0x555eb4[_0x4a1c('0x3f')][_0x4a1c('0x4e')]+'%'};return _0x23f7c6;})});}_0x3cc958=_[_0x4a1c('0x4c')]({},_0x3cc958,_0x555eb4[_0x4a1c('0x4f')]);return _0x320d09[_0x4a1c('0x5c')](_0x3cc958);}})[_0x4a1c('0x20')](function(_0x397624){if(_0x397624){_0x7e535c=_0x397624['length'];if(!_0x555eb4[_0x4a1c('0x3f')][_0x4a1c('0x46')](_0x4a1c('0x47'))){_0x3cc958[_0x4a1c('0x30')]=qs['limit'](_0x555eb4[_0x4a1c('0x3f')][_0x4a1c('0x30')]);_0x3cc958[_0x4a1c('0x2f')]=qs[_0x4a1c('0x2f')](_0x555eb4['query'][_0x4a1c('0x2f')]);}return _0x320d09[_0x4a1c('0x5c')](_0x3cc958);}})[_0x4a1c('0x20')](function(_0x2a6585){if(_0x2a6585){return _0x2a6585?{'count':_0x7e535c,'rows':_0x2a6585}:null;}})[_0x4a1c('0x20')](respondWithResult(_0x96ef9a,null))[_0x4a1c('0x2a')](handleError(_0x96ef9a,null));}; \ No newline at end of file +var _0x9b70=['attributes','fields','length','limit','order','sort','where','pick','merge','type','VIRTUAL','filter','options','includeAll','include','findAll','rows','show','find','create','body','params','getFields','SugarcrmField','hasOwnProperty','nolimit','getSubjects','findOne','getDescriptions','html-pdf','rimraf','zip-dir','request-promise','moment','bluebird','mustache','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../mysqldb','jayson/promise','http','test','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','SugarcrmConfiguration,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','sendStatus','status','end','json','count','offset','set','Content-Range','apply','reject','update','then','destroy','stack','name','send','map','SugarcrmConfiguration','rawAttributes','key','query','keys','filters','intersection','model'];(function(_0x32945c,_0x4a8553){var _0x7d896d=function(_0x1cf76e){while(--_0x1cf76e){_0x32945c['push'](_0x32945c['shift']());}};_0x7d896d(++_0x4a8553);}(_0x9b70,0x1f3));var _0x09b7=function(_0x426ab0,_0x13c67d){_0x426ab0=_0x426ab0-0x0;var _0x3bdb3d=_0x9b70[_0x426ab0];return _0x3bdb3d;};'use strict';var pdf=require(_0x09b7('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x09b7('0x1'));var zipdir=require(_0x09b7('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x09b7('0x3'));var moment=require(_0x09b7('0x4'));var BPromise=require(_0x09b7('0x5'));var Mustache=require(_0x09b7('0x6'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x09b7('0x7'));var fs=require('fs');var _=require(_0x09b7('0x8'));var squel=require(_0x09b7('0x9'));var crypto=require(_0x09b7('0xa'));var jsforce=require(_0x09b7('0xb'));var deskjs=require(_0x09b7('0xc'));var toCsv=require(_0x09b7('0xd'));var querystring=require(_0x09b7('0xe'));var Papa=require(_0x09b7('0xf'));var Redis=require(_0x09b7('0x10'));var authService=require(_0x09b7('0x11'));var qs=require(_0x09b7('0x12'));var as=require(_0x09b7('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x09b7('0x14'))(_0x09b7('0x15'));var utils=require(_0x09b7('0x16'));var config=require('../../config/environment');var db=require(_0x09b7('0x17'))['db'];var jayson=require(_0x09b7('0x18'));var client=jayson['client'][_0x09b7('0x19')]({'port':0x232a});function checkPasswordPattern(_0x18382a,_0x4dca65,_0x1db241){if(_0x1db241){var _0x23de42=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x23de42[_0x09b7('0x1a')](_0x4dca65)){return _0x18382a;}else{throw new db[(_0x09b7('0x1b'))][(_0x09b7('0x1c'))](_0x09b7('0x1d'));}}else{return _0x18382a;}}function respondWithRpcPromise(_0x77d3dc,_0x49a73f,_0x1dcc7c,_0x376bf9){return new BPromise(function(_0x52410f,_0x59e666){var _0x2b70eb=_0x376bf9||client;return _0x2b70eb[_0x09b7('0x1e')](_0x77d3dc,_0x1dcc7c)['then'](function(_0x54a39e){logger['info'](_0x09b7('0x1f'),_0x49a73f,_0x09b7('0x20'));logger[_0x09b7('0x21')]('SugarcrmConfiguration,\x20%s,\x20%s,\x20%s',_0x49a73f,_0x09b7('0x20'),JSON[_0x09b7('0x22')](_0x54a39e));if(_0x54a39e[_0x09b7('0x23')]){if(_0x54a39e[_0x09b7('0x23')][_0x09b7('0x24')]===0x1f4){logger[_0x09b7('0x23')](_0x09b7('0x1f'),_0x49a73f,_0x54a39e[_0x09b7('0x23')][_0x09b7('0x25')]);return _0x59e666(_0x54a39e[_0x09b7('0x23')][_0x09b7('0x25')]);}logger['error'](_0x09b7('0x1f'),_0x49a73f,_0x54a39e[_0x09b7('0x23')][_0x09b7('0x25')]);return _0x52410f(_0x54a39e[_0x09b7('0x23')][_0x09b7('0x25')]);}else{logger['info'](_0x09b7('0x1f'),_0x49a73f,_0x09b7('0x20'));_0x52410f(_0x54a39e[_0x09b7('0x26')]['message']);}})[_0x09b7('0x27')](function(_0xce8ae8){logger[_0x09b7('0x23')](_0x09b7('0x1f'),_0x49a73f,_0xce8ae8);_0x59e666(_0xce8ae8);});});}function respondWithStatusCode(_0x20aaa4,_0x5c0d96){_0x5c0d96=_0x5c0d96||0xcc;return function(_0xfa986e){if(_0xfa986e){return _0x20aaa4[_0x09b7('0x28')](_0x5c0d96);}return _0x20aaa4[_0x09b7('0x29')](_0x5c0d96)[_0x09b7('0x2a')]();};}function respondWithResult(_0x21dd51,_0x16b48d){_0x16b48d=_0x16b48d||0xc8;return function(_0x42195b){if(_0x42195b){return _0x21dd51['status'](_0x16b48d)[_0x09b7('0x2b')](_0x42195b);}};}function respondWithFilteredResult(_0x21c4ef,_0x27b181){return function(_0x1a94b6){if(_0x1a94b6){var _0x538cd3=_0x1a94b6[_0x09b7('0x2c')],_0x11e804=_0x27b181[_0x09b7('0x2d')],_0x52c5e7=_0x27b181[_0x09b7('0x2d')]+_0x27b181['limit'],_0x23a2ba;if(_0x52c5e7>=_0x538cd3){_0x52c5e7=_0x538cd3;_0x23a2ba=0xc8;}else{_0x23a2ba=0xce;}_0x21c4ef[_0x09b7('0x29')](_0x23a2ba);return _0x21c4ef[_0x09b7('0x2e')](_0x09b7('0x2f'),_0x11e804+'-'+_0x52c5e7+'/'+_0x538cd3)['json'](_0x1a94b6);}return null;};}function patchUpdates(_0x247e77){return function(_0x1b2b86){try{jsonpatch[_0x09b7('0x30')](_0x1b2b86,_0x247e77,!![]);}catch(_0x198cc8){return BPromise[_0x09b7('0x31')](_0x198cc8);}return _0x1b2b86['save']();};}function saveUpdates(_0x35315c,_0xaabf5c){return function(_0x2df63d){if(_0x2df63d){return _0x2df63d[_0x09b7('0x32')](_0x35315c)[_0x09b7('0x33')](function(_0x2fc1ad){return _0x2fc1ad;});}return null;};}function removeEntity(_0x1cd5ce,_0x48fcaf){return function(_0x1d6d5c){if(_0x1d6d5c){return _0x1d6d5c[_0x09b7('0x34')]()[_0x09b7('0x33')](function(){_0x1cd5ce[_0x09b7('0x29')](0xcc)['end']();});}};}function handleEntityNotFound(_0x7e3fe3,_0xc49430){return function(_0x39b3b7){if(!_0x39b3b7){_0x7e3fe3[_0x09b7('0x28')](0x194);}return _0x39b3b7;};}function handleError(_0x2ff8c4,_0xffdf19){_0xffdf19=_0xffdf19||0x1f4;return function(_0x7f1481){logger[_0x09b7('0x23')](_0x7f1481[_0x09b7('0x35')]);if(_0x7f1481[_0x09b7('0x36')]){delete _0x7f1481[_0x09b7('0x36')];}_0x2ff8c4[_0x09b7('0x29')](_0xffdf19)[_0x09b7('0x37')](_0x7f1481);};}exports['index']=function(_0x5397d3,_0xdca0af){var _0x403f4a={},_0xfe09a1={},_0x4d0722={'count':0x0,'rows':[]};var _0x3ca0b5=_[_0x09b7('0x38')](db[_0x09b7('0x39')][_0x09b7('0x3a')],function(_0x2a9004){return{'name':_0x2a9004['fieldName'],'type':_0x2a9004['type'][_0x09b7('0x3b')]};});_0xfe09a1['model']=_[_0x09b7('0x38')](_0x3ca0b5,'name');_0xfe09a1[_0x09b7('0x3c')]=_[_0x09b7('0x3d')](_0x5397d3[_0x09b7('0x3c')]);_0xfe09a1[_0x09b7('0x3e')]=_[_0x09b7('0x3f')](_0xfe09a1[_0x09b7('0x40')],_0xfe09a1['query']);_0x403f4a[_0x09b7('0x41')]=_[_0x09b7('0x3f')](_0xfe09a1[_0x09b7('0x40')],qs[_0x09b7('0x42')](_0x5397d3[_0x09b7('0x3c')][_0x09b7('0x42')]));_0x403f4a[_0x09b7('0x41')]=_0x403f4a['attributes'][_0x09b7('0x43')]?_0x403f4a['attributes']:_0xfe09a1[_0x09b7('0x40')];if(!_0x5397d3['query']['hasOwnProperty']('nolimit')){_0x403f4a[_0x09b7('0x44')]=qs['limit'](_0x5397d3[_0x09b7('0x3c')][_0x09b7('0x44')]);_0x403f4a[_0x09b7('0x2d')]=qs[_0x09b7('0x2d')](_0x5397d3[_0x09b7('0x3c')][_0x09b7('0x2d')]);}_0x403f4a[_0x09b7('0x45')]=qs[_0x09b7('0x46')](_0x5397d3['query']['sort']);_0x403f4a[_0x09b7('0x47')]=qs[_0x09b7('0x3e')](_[_0x09b7('0x48')](_0x5397d3[_0x09b7('0x3c')],_0xfe09a1[_0x09b7('0x3e')]),_0x3ca0b5);if(_0x5397d3[_0x09b7('0x3c')]['filter']){_0x403f4a[_0x09b7('0x47')]=_[_0x09b7('0x49')](_0x403f4a[_0x09b7('0x47')],{'$or':_[_0x09b7('0x38')](_0x3ca0b5,function(_0x57bc0f){if(_0x57bc0f[_0x09b7('0x4a')]!==_0x09b7('0x4b')){var _0x4ebb0b={};_0x4ebb0b[_0x57bc0f[_0x09b7('0x36')]]={'$like':'%'+_0x5397d3[_0x09b7('0x3c')][_0x09b7('0x4c')]+'%'};return _0x4ebb0b;}})});}_0x403f4a=_[_0x09b7('0x49')]({},_0x403f4a,_0x5397d3[_0x09b7('0x4d')]);var _0x986e12={'where':_0x403f4a[_0x09b7('0x47')]};return db[_0x09b7('0x39')][_0x09b7('0x2c')](_0x986e12)['then'](function(_0x16d6b5){_0x4d0722[_0x09b7('0x2c')]=_0x16d6b5;if(_0x5397d3[_0x09b7('0x3c')][_0x09b7('0x4e')]){_0x403f4a[_0x09b7('0x4f')]=[{'all':!![]}];}return db['SugarcrmConfiguration'][_0x09b7('0x50')](_0x403f4a);})[_0x09b7('0x33')](function(_0x494c8f){_0x4d0722[_0x09b7('0x51')]=_0x494c8f;return _0x4d0722;})['then'](respondWithFilteredResult(_0xdca0af,_0x403f4a))['catch'](handleError(_0xdca0af,null));};exports[_0x09b7('0x52')]=function(_0x354ea4,_0x3d931){var _0x4c95df={'raw':![],'where':{'id':_0x354ea4['params']['id']}},_0x5b2a42={};_0x5b2a42[_0x09b7('0x40')]=_[_0x09b7('0x3d')](db[_0x09b7('0x39')][_0x09b7('0x3a')]);_0x5b2a42['query']=_['keys'](_0x354ea4['query']);_0x5b2a42['filters']=_[_0x09b7('0x3f')](_0x5b2a42[_0x09b7('0x40')],_0x5b2a42['query']);_0x4c95df[_0x09b7('0x41')]=_[_0x09b7('0x3f')](_0x5b2a42[_0x09b7('0x40')],qs[_0x09b7('0x42')](_0x354ea4[_0x09b7('0x3c')][_0x09b7('0x42')]));_0x4c95df[_0x09b7('0x41')]=_0x4c95df[_0x09b7('0x41')][_0x09b7('0x43')]?_0x4c95df['attributes']:_0x5b2a42[_0x09b7('0x40')];if(_0x354ea4[_0x09b7('0x3c')][_0x09b7('0x4e')]){_0x4c95df[_0x09b7('0x4f')]=[{'all':!![]}];}_0x4c95df=_['merge']({},_0x4c95df,_0x354ea4[_0x09b7('0x4d')]);return db[_0x09b7('0x39')][_0x09b7('0x53')](_0x4c95df)['then'](handleEntityNotFound(_0x3d931,null))[_0x09b7('0x33')](respondWithResult(_0x3d931,null))['catch'](handleError(_0x3d931,null));};exports[_0x09b7('0x54')]=function(_0x2849b5,_0x46d3ed){return db[_0x09b7('0x39')][_0x09b7('0x54')](_0x2849b5[_0x09b7('0x55')],{})[_0x09b7('0x33')](respondWithResult(_0x46d3ed,0xc9))[_0x09b7('0x27')](handleError(_0x46d3ed,null));};exports[_0x09b7('0x32')]=function(_0x593333,_0x2f0db6){if(_0x593333[_0x09b7('0x55')]['id']){delete _0x593333[_0x09b7('0x55')]['id'];}return db['SugarcrmConfiguration'][_0x09b7('0x53')]({'where':{'id':_0x593333[_0x09b7('0x56')]['id']}})['then'](handleEntityNotFound(_0x2f0db6,null))[_0x09b7('0x33')](saveUpdates(_0x593333[_0x09b7('0x55')],null))[_0x09b7('0x33')](respondWithResult(_0x2f0db6,null))[_0x09b7('0x27')](handleError(_0x2f0db6,null));};exports[_0x09b7('0x34')]=function(_0x446a75,_0x413583){return db[_0x09b7('0x39')][_0x09b7('0x53')]({'where':{'id':_0x446a75[_0x09b7('0x56')]['id']}})['then'](handleEntityNotFound(_0x413583,null))[_0x09b7('0x33')](removeEntity(_0x413583,null))['catch'](handleError(_0x413583,null));};exports[_0x09b7('0x57')]=function(_0x3f7ba5,_0x5885cf,_0x48e0a6){var _0x4e91d4={};var _0x4dc01e={};var _0x209c44;var _0x18d50e;return db['SugarcrmConfiguration']['findOne']({'where':{'id':_0x3f7ba5[_0x09b7('0x56')]['id']}})[_0x09b7('0x33')](handleEntityNotFound(_0x5885cf,null))[_0x09b7('0x33')](function(_0x19ed21){if(_0x19ed21){_0x209c44=_0x19ed21;_0x4dc01e['model']=_['keys'](db[_0x09b7('0x58')][_0x09b7('0x3a')]);_0x4dc01e[_0x09b7('0x3c')]=_['keys'](_0x3f7ba5[_0x09b7('0x3c')]);_0x4dc01e[_0x09b7('0x3e')]=_[_0x09b7('0x3f')](_0x4dc01e[_0x09b7('0x40')],_0x4dc01e[_0x09b7('0x3c')]);_0x4e91d4[_0x09b7('0x41')]=_['intersection'](_0x4dc01e[_0x09b7('0x40')],qs['fields'](_0x3f7ba5['query'][_0x09b7('0x42')]));_0x4e91d4[_0x09b7('0x41')]=_0x4e91d4[_0x09b7('0x41')][_0x09b7('0x43')]?_0x4e91d4['attributes']:_0x4dc01e[_0x09b7('0x40')];_0x4e91d4[_0x09b7('0x45')]=qs['sort'](_0x3f7ba5[_0x09b7('0x3c')]['sort']);_0x4e91d4[_0x09b7('0x47')]=qs[_0x09b7('0x3e')](_[_0x09b7('0x48')](_0x3f7ba5['query'],_0x4dc01e[_0x09b7('0x3e')]));if(_0x3f7ba5[_0x09b7('0x3c')]['filter']){_0x4e91d4[_0x09b7('0x47')]=_[_0x09b7('0x49')](_0x4e91d4[_0x09b7('0x47')],{'$or':_['map'](_0x4e91d4['attributes'],function(_0x1cdef1){var _0x3dfef0={};_0x3dfef0[_0x1cdef1]={'$like':'%'+_0x3f7ba5[_0x09b7('0x3c')][_0x09b7('0x4c')]+'%'};return _0x3dfef0;})});}_0x4e91d4=_[_0x09b7('0x49')]({},_0x4e91d4,_0x3f7ba5['options']);return _0x209c44[_0x09b7('0x57')](_0x4e91d4);}})['then'](function(_0x22102e){if(_0x22102e){_0x18d50e=_0x22102e['length'];if(!_0x3f7ba5[_0x09b7('0x3c')][_0x09b7('0x59')](_0x09b7('0x5a'))){_0x4e91d4[_0x09b7('0x44')]=qs[_0x09b7('0x44')](_0x3f7ba5[_0x09b7('0x3c')][_0x09b7('0x44')]);_0x4e91d4[_0x09b7('0x2d')]=qs[_0x09b7('0x2d')](_0x3f7ba5[_0x09b7('0x3c')][_0x09b7('0x2d')]);}return _0x209c44[_0x09b7('0x57')](_0x4e91d4);}})[_0x09b7('0x33')](function(_0x22d065){if(_0x22d065){return _0x22d065?{'count':_0x18d50e,'rows':_0x22d065}:null;}})['then'](respondWithResult(_0x5885cf,null))[_0x09b7('0x27')](handleError(_0x5885cf,null));};exports[_0x09b7('0x5b')]=function(_0x4cd01b,_0x4646f0,_0x57def3){var _0x46be0a={};var _0x303b4b={};var _0x4113d5;var _0x27fd40;return db[_0x09b7('0x39')][_0x09b7('0x5c')]({'where':{'id':_0x4cd01b[_0x09b7('0x56')]['id']}})[_0x09b7('0x33')](handleEntityNotFound(_0x4646f0,null))[_0x09b7('0x33')](function(_0x1a1d94){if(_0x1a1d94){_0x4113d5=_0x1a1d94;_0x303b4b[_0x09b7('0x40')]=_[_0x09b7('0x3d')](db['SugarcrmField']['rawAttributes']);_0x303b4b[_0x09b7('0x3c')]=_[_0x09b7('0x3d')](_0x4cd01b['query']);_0x303b4b['filters']=_[_0x09b7('0x3f')](_0x303b4b['model'],_0x303b4b[_0x09b7('0x3c')]);_0x46be0a[_0x09b7('0x41')]=_[_0x09b7('0x3f')](_0x303b4b[_0x09b7('0x40')],qs[_0x09b7('0x42')](_0x4cd01b['query'][_0x09b7('0x42')]));_0x46be0a[_0x09b7('0x41')]=_0x46be0a[_0x09b7('0x41')]['length']?_0x46be0a[_0x09b7('0x41')]:_0x303b4b[_0x09b7('0x40')];_0x46be0a[_0x09b7('0x45')]=qs[_0x09b7('0x46')](_0x4cd01b[_0x09b7('0x3c')][_0x09b7('0x46')]);_0x46be0a['where']=qs[_0x09b7('0x3e')](_[_0x09b7('0x48')](_0x4cd01b['query'],_0x303b4b[_0x09b7('0x3e')]));if(_0x4cd01b[_0x09b7('0x3c')][_0x09b7('0x4c')]){_0x46be0a[_0x09b7('0x47')]=_[_0x09b7('0x49')](_0x46be0a[_0x09b7('0x47')],{'$or':_['map'](_0x46be0a[_0x09b7('0x41')],function(_0x48743e){var _0x558079={};_0x558079[_0x48743e]={'$like':'%'+_0x4cd01b['query'][_0x09b7('0x4c')]+'%'};return _0x558079;})});}_0x46be0a=_[_0x09b7('0x49')]({},_0x46be0a,_0x4cd01b[_0x09b7('0x4d')]);return _0x4113d5[_0x09b7('0x5b')](_0x46be0a);}})[_0x09b7('0x33')](function(_0x12d212){if(_0x12d212){_0x27fd40=_0x12d212['length'];if(!_0x4cd01b[_0x09b7('0x3c')][_0x09b7('0x59')](_0x09b7('0x5a'))){_0x46be0a[_0x09b7('0x44')]=qs['limit'](_0x4cd01b[_0x09b7('0x3c')][_0x09b7('0x44')]);_0x46be0a['offset']=qs[_0x09b7('0x2d')](_0x4cd01b['query']['offset']);}return _0x4113d5[_0x09b7('0x5b')](_0x46be0a);}})[_0x09b7('0x33')](function(_0x6e4343){if(_0x6e4343){return _0x6e4343?{'count':_0x27fd40,'rows':_0x6e4343}:null;}})[_0x09b7('0x33')](respondWithResult(_0x4646f0,null))[_0x09b7('0x27')](handleError(_0x4646f0,null));};exports[_0x09b7('0x5d')]=function(_0x28c73a,_0x2d0b0b,_0x820abd){var _0x109407={};var _0x50d136={};var _0x4ba32c;var _0x2a90a0;return db[_0x09b7('0x39')]['findOne']({'where':{'id':_0x28c73a[_0x09b7('0x56')]['id']}})['then'](handleEntityNotFound(_0x2d0b0b,null))['then'](function(_0x475812){if(_0x475812){_0x4ba32c=_0x475812;_0x50d136['model']=_['keys'](db[_0x09b7('0x58')]['rawAttributes']);_0x50d136[_0x09b7('0x3c')]=_[_0x09b7('0x3d')](_0x28c73a[_0x09b7('0x3c')]);_0x50d136['filters']=_[_0x09b7('0x3f')](_0x50d136[_0x09b7('0x40')],_0x50d136['query']);_0x109407[_0x09b7('0x41')]=_[_0x09b7('0x3f')](_0x50d136[_0x09b7('0x40')],qs[_0x09b7('0x42')](_0x28c73a[_0x09b7('0x3c')][_0x09b7('0x42')]));_0x109407[_0x09b7('0x41')]=_0x109407['attributes']['length']?_0x109407[_0x09b7('0x41')]:_0x50d136[_0x09b7('0x40')];_0x109407[_0x09b7('0x45')]=qs[_0x09b7('0x46')](_0x28c73a['query'][_0x09b7('0x46')]);_0x109407[_0x09b7('0x47')]=qs['filters'](_[_0x09b7('0x48')](_0x28c73a['query'],_0x50d136['filters']));if(_0x28c73a['query'][_0x09b7('0x4c')]){_0x109407[_0x09b7('0x47')]=_[_0x09b7('0x49')](_0x109407[_0x09b7('0x47')],{'$or':_[_0x09b7('0x38')](_0x109407[_0x09b7('0x41')],function(_0x377a01){var _0x29dd2e={};_0x29dd2e[_0x377a01]={'$like':'%'+_0x28c73a[_0x09b7('0x3c')]['filter']+'%'};return _0x29dd2e;})});}_0x109407=_[_0x09b7('0x49')]({},_0x109407,_0x28c73a[_0x09b7('0x4d')]);return _0x4ba32c['getDescriptions'](_0x109407);}})[_0x09b7('0x33')](function(_0x3d3af9){if(_0x3d3af9){_0x2a90a0=_0x3d3af9[_0x09b7('0x43')];if(!_0x28c73a[_0x09b7('0x3c')][_0x09b7('0x59')](_0x09b7('0x5a'))){_0x109407['limit']=qs[_0x09b7('0x44')](_0x28c73a[_0x09b7('0x3c')][_0x09b7('0x44')]);_0x109407[_0x09b7('0x2d')]=qs[_0x09b7('0x2d')](_0x28c73a[_0x09b7('0x3c')][_0x09b7('0x2d')]);}return _0x4ba32c['getDescriptions'](_0x109407);}})[_0x09b7('0x33')](function(_0x34dce2){if(_0x34dce2){return _0x34dce2?{'count':_0x2a90a0,'rows':_0x34dce2}:null;}})[_0x09b7('0x33')](respondWithResult(_0x2d0b0b,null))[_0x09b7('0x27')](handleError(_0x2d0b0b,null));}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.model.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.model.js index 68647e6..2734965 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 _0x56ec=['moment','rimraf','../../config/environment','exports','define','lodash','../../config/logger','api'];(function(_0x2db235,_0x290bda){var _0x5bfc18=function(_0x47f8d6){while(--_0x47f8d6){_0x2db235['push'](_0x2db235['shift']());}};_0x5bfc18(++_0x290bda);}(_0x56ec,0x1ed));var _0xc56e=function(_0xc6af00,_0x5b3a27){_0xc6af00=_0xc6af00-0x0;var _0x787dae=_0x56ec[_0xc6af00];return _0x787dae;};'use strict';var _=require(_0xc56e('0x0'));var util=require('util');var logger=require(_0xc56e('0x1'))(_0xc56e('0x2'));var moment=require(_0xc56e('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xc56e('0x4'));var config=require(_0xc56e('0x5'));var attributes=require('./intSugarcrmConfiguration.attributes');module[_0xc56e('0x6')]=function(_0x268f82,_0x526111){return _0x268f82[_0xc56e('0x7')]('SugarcrmConfiguration',attributes,{'tableName':'int_sugarcrm_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb76e=['bluebird','request-promise','path','rimraf','../../config/environment','./intSugarcrmConfiguration.attributes','exports','SugarcrmConfiguration','lodash','util','api'];(function(_0x3d3345,_0x16e522){var _0x2684b2=function(_0x4c46f){while(--_0x4c46f){_0x3d3345['push'](_0x3d3345['shift']());}};_0x2684b2(++_0x16e522);}(_0xb76e,0xb8));var _0xeb76=function(_0x41be1a,_0x152cf2){_0x41be1a=_0x41be1a-0x0;var _0x4c9cad=_0xb76e[_0x41be1a];return _0x4c9cad;};'use strict';var _=require(_0xeb76('0x0'));var util=require(_0xeb76('0x1'));var logger=require('../../config/logger')(_0xeb76('0x2'));var moment=require('moment');var BPromise=require(_0xeb76('0x3'));var rp=require(_0xeb76('0x4'));var fs=require('fs');var path=require(_0xeb76('0x5'));var rimraf=require(_0xeb76('0x6'));var config=require(_0xeb76('0x7'));var attributes=require(_0xeb76('0x8'));module[_0xeb76('0x9')]=function(_0x5d49ed,_0x397e00){return _0x5d49ed['define'](_0xeb76('0xa'),attributes,{'tableName':'int_sugarcrm_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.rpc.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.rpc.js index 8f8a0c2..bb03ac8 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 _0xe73a=['moment','ioredis','../../config/utils','rpc','jayson/promise','client','http','request','info','debug','SugarcrmConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','SugarcrmConfiguration,\x20%s,\x20%s','message','result','util'];(function(_0xac384a,_0x932349){var _0x5aecae=function(_0x3e6df1){while(--_0x3e6df1){_0xac384a['push'](_0xac384a['shift']());}};_0x5aecae(++_0x932349);}(_0xe73a,0x97));var _0xae73=function(_0x4c9393,_0x20e6de){_0x4c9393=_0x4c9393-0x0;var _0x580eda=_0xe73a[_0x4c9393];return _0x580eda;};'use strict';var _=require('lodash');var util=require(_0xae73('0x0'));var moment=require(_0xae73('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xae73('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0xae73('0x3'));var logger=require('../../config/logger')(_0xae73('0x4'));var config=require('../../config/environment');var jayson=require(_0xae73('0x5'));var client=jayson[_0xae73('0x6')][_0xae73('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x56547b,_0x4276e8,_0x5df3d3){return new BPromise(function(_0x251489,_0x36dc39){return client[_0xae73('0x8')](_0x56547b,_0x5df3d3)['then'](function(_0x558f84){logger[_0xae73('0x9')]('SugarcrmConfiguration,\x20%s,\x20%s',_0x4276e8,'request\x20sent');logger[_0xae73('0xa')](_0xae73('0xb'),_0x4276e8,_0xae73('0xc'),JSON[_0xae73('0xd')](_0x558f84));if(_0x558f84[_0xae73('0xe')]){if(_0x558f84['error'][_0xae73('0xf')]===0x1f4){logger[_0xae73('0xe')](_0xae73('0x10'),_0x4276e8,_0x558f84['error'][_0xae73('0x11')]);return _0x36dc39(_0x558f84['error'][_0xae73('0x11')]);}logger['error'](_0xae73('0x10'),_0x4276e8,_0x558f84[_0xae73('0xe')]['message']);return _0x251489(_0x558f84[_0xae73('0xe')]['message']);}else{logger[_0xae73('0x9')]('SugarcrmConfiguration,\x20%s,\x20%s',_0x4276e8,_0xae73('0xc'));_0x251489(_0x558f84[_0xae73('0x12')][_0xae73('0x11')]);}})['catch'](function(_0x211bfa){logger[_0xae73('0xe')]('SugarcrmConfiguration,\x20%s,\x20%s',_0x4276e8,_0x211bfa);_0x36dc39(_0x211bfa);});});} \ No newline at end of file +var _0xf73e=['message','catch','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info','SugarcrmConfiguration,\x20%s,\x20%s','request\x20sent','debug','SugarcrmConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0xc69fda,_0x367f93){var _0x721842=function(_0x521bf7){while(--_0x521bf7){_0xc69fda['push'](_0xc69fda['shift']());}};_0x721842(++_0x367f93);}(_0xf73e,0x10a));var _0xef73=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xf73e[_0x14add3];return _0x4a174f;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xef73('0x0'));var BPromise=require(_0xef73('0x1'));var rs=require(_0xef73('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xef73('0x3'))['db'];var utils=require(_0xef73('0x4'));var logger=require(_0xef73('0x5'))(_0xef73('0x6'));var config=require(_0xef73('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xef73('0x8')][_0xef73('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x420a1f,_0x379897,_0x930f9a){return new BPromise(function(_0x5943f6,_0x501552){return client[_0xef73('0xa')](_0x420a1f,_0x930f9a)[_0xef73('0xb')](function(_0x3e638c){logger[_0xef73('0xc')](_0xef73('0xd'),_0x379897,_0xef73('0xe'));logger[_0xef73('0xf')](_0xef73('0x10'),_0x379897,_0xef73('0xe'),JSON[_0xef73('0x11')](_0x3e638c));if(_0x3e638c['error']){if(_0x3e638c[_0xef73('0x12')][_0xef73('0x13')]===0x1f4){logger[_0xef73('0x12')](_0xef73('0xd'),_0x379897,_0x3e638c[_0xef73('0x12')][_0xef73('0x14')]);return _0x501552(_0x3e638c[_0xef73('0x12')][_0xef73('0x14')]);}logger['error'](_0xef73('0xd'),_0x379897,_0x3e638c[_0xef73('0x12')]['message']);return _0x5943f6(_0x3e638c[_0xef73('0x12')][_0xef73('0x14')]);}else{logger[_0xef73('0xc')]('SugarcrmConfiguration,\x20%s,\x20%s',_0x379897,_0xef73('0xe'));_0x5943f6(_0x3e638c['result'][_0xef73('0x14')]);}})[_0xef73('0x15')](function(_0x2a6971){logger[_0xef73('0x12')](_0xef73('0xd'),_0x379897,_0x2a6971);_0x501552(_0x2a6971);});});} \ No newline at end of file diff --git a/server/api/intSugarcrmField/index.js b/server/api/intSugarcrmField/index.js index 214a5f6..db94ba1 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 _0x3c01=['/:id','show','post','create','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./intSugarcrmField.controller','isAuthenticated','index'];(function(_0x179c86,_0x4a2006){var _0x5abd7e=function(_0x1068e7){while(--_0x1068e7){_0x179c86['push'](_0x179c86['shift']());}};_0x5abd7e(++_0x4a2006);}(_0x3c01,0x1bd));var _0x13c0=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x3c01[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0x13c0('0x0'));var util=require(_0x13c0('0x1'));var path=require(_0x13c0('0x2'));var timeout=require(_0x13c0('0x3'));var express=require(_0x13c0('0x4'));var router=express[_0x13c0('0x5')]();var auth=require(_0x13c0('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x13c0('0x7'));var controller=require(_0x13c0('0x8'));router['get']('/',auth[_0x13c0('0x9')](),controller[_0x13c0('0xa')]);router['get'](_0x13c0('0xb'),auth[_0x13c0('0x9')](),controller[_0x13c0('0xc')]);router[_0x13c0('0xd')]('/',auth[_0x13c0('0x9')](),controller[_0x13c0('0xe')]);router['put'](_0x13c0('0xb'),auth['isAuthenticated'](),controller[_0x13c0('0xf')]);router[_0x13c0('0x10')](_0x13c0('0xb'),auth[_0x13c0('0x9')](),controller[_0x13c0('0x11')]);module[_0x13c0('0x12')]=router; \ No newline at end of file +var _0xa34f=['../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/:id','show','post','create','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router'];(function(_0x88ba09,_0xd9c21b){var _0x173410=function(_0x13c200){while(--_0x13c200){_0x88ba09['push'](_0x88ba09['shift']());}};_0x173410(++_0xd9c21b);}(_0xa34f,0x189));var _0xfa34=function(_0x57d2bd,_0x57664d){_0x57d2bd=_0x57d2bd-0x0;var _0x3e58ff=_0xa34f[_0x57d2bd];return _0x3e58ff;};'use strict';var multer=require(_0xfa34('0x0'));var util=require(_0xfa34('0x1'));var path=require(_0xfa34('0x2'));var timeout=require(_0xfa34('0x3'));var express=require(_0xfa34('0x4'));var router=express[_0xfa34('0x5')]();var auth=require(_0xfa34('0x6'));var interaction=require(_0xfa34('0x7'));var config=require(_0xfa34('0x8'));var controller=require('./intSugarcrmField.controller');router[_0xfa34('0x9')]('/',auth[_0xfa34('0xa')](),controller['index']);router[_0xfa34('0x9')](_0xfa34('0xb'),auth['isAuthenticated'](),controller[_0xfa34('0xc')]);router[_0xfa34('0xd')]('/',auth['isAuthenticated'](),controller[_0xfa34('0xe')]);router['put'](_0xfa34('0xb'),auth[_0xfa34('0xa')](),controller[_0xfa34('0xf')]);router[_0xfa34('0x10')](_0xfa34('0xb'),auth[_0xfa34('0xa')](),controller[_0xfa34('0x11')]);module[_0xfa34('0x12')]=router; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.attributes.js b/server/api/intSugarcrmField/intSugarcrmField.attributes.js index 5c98102..1c44100 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 _0x6a93=['string','variable','BOOLEAN','sequelize','exports','ENUM','customVariable','keyValue','STRING'];(function(_0x5bfdb4,_0x221ba8){var _0x1ee09b=function(_0x4b6ef5){while(--_0x4b6ef5){_0x5bfdb4['push'](_0x5bfdb4['shift']());}};_0x1ee09b(++_0x221ba8);}(_0x6a93,0x1d7));var _0x36a9=function(_0x41a00c,_0x5d6050){_0x41a00c=_0x41a00c-0x0;var _0x2f41c3=_0x6a93[_0x41a00c];return _0x2f41c3;};'use strict';var Sequelize=require(_0x36a9('0x0'));module[_0x36a9('0x1')]={'type':{'type':Sequelize[_0x36a9('0x2')]('string','variable',_0x36a9('0x3'),_0x36a9('0x4')),'defaultValue':'string'},'content':{'type':Sequelize[_0x36a9('0x5')]},'key':{'type':Sequelize[_0x36a9('0x5')]},'keyType':{'type':Sequelize[_0x36a9('0x2')](_0x36a9('0x6'),_0x36a9('0x7'),_0x36a9('0x3'))},'keyContent':{'type':Sequelize[_0x36a9('0x5')]},'idField':{'type':Sequelize[_0x36a9('0x5')]},'nameField':{'type':Sequelize[_0x36a9('0x5')]},'customField':{'type':Sequelize[_0x36a9('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x36a9('0x5')]}}; \ No newline at end of file +var _0x7fb0=['exports','ENUM','string','variable','STRING','BOOLEAN','sequelize'];(function(_0x59c7a7,_0x5798f4){var _0x1ac66e=function(_0x4a8801){while(--_0x4a8801){_0x59c7a7['push'](_0x59c7a7['shift']());}};_0x1ac66e(++_0x5798f4);}(_0x7fb0,0x99));var _0x07fb=function(_0x49cc8c,_0x48a839){_0x49cc8c=_0x49cc8c-0x0;var _0x30eb9e=_0x7fb0[_0x49cc8c];return _0x30eb9e;};'use strict';var Sequelize=require(_0x07fb('0x0'));module[_0x07fb('0x1')]={'type':{'type':Sequelize[_0x07fb('0x2')](_0x07fb('0x3'),_0x07fb('0x4'),'customVariable','keyValue'),'defaultValue':_0x07fb('0x3')},'content':{'type':Sequelize[_0x07fb('0x5')]},'key':{'type':Sequelize[_0x07fb('0x5')]},'keyType':{'type':Sequelize[_0x07fb('0x2')](_0x07fb('0x3'),_0x07fb('0x4'),'customVariable')},'keyContent':{'type':Sequelize[_0x07fb('0x5')]},'idField':{'type':Sequelize[_0x07fb('0x5')]},'nameField':{'type':Sequelize[_0x07fb('0x5')]},'customField':{'type':Sequelize[_0x07fb('0x6')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x07fb('0x5')]}}; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.controller.js b/server/api/intSugarcrmField/intSugarcrmField.controller.js index bbdf5c8..c76d228 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 _0x9990=['includeAll','include','findAll','catch','show','length','create','body','find','params','html-pdf','eml-format','zip-dir','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','crypto','desk.js','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','json','offset','limit','Content-Range','apply','reject','save','destroy','stack','name','send','map','SugarcrmField','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','then'];(function(_0x2d3506,_0x48fdbb){var _0x5af527=function(_0x12c87a){while(--_0x12c87a){_0x2d3506['push'](_0x2d3506['shift']());}};_0x5af527(++_0x48fdbb);}(_0x9990,0x11a));var _0x0999=function(_0x525445,_0x4f8f42){_0x525445=_0x525445-0x0;var _0x48b600=_0x9990[_0x525445];return _0x48b600;};'use strict';var pdf=require(_0x0999('0x0'));var emlformat=require(_0x0999('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x0999('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x0999('0x3'));var moment=require(_0x0999('0x4'));var BPromise=require(_0x0999('0x5'));var Mustache=require(_0x0999('0x6'));var util=require('util');var path=require(_0x0999('0x7'));var sox=require(_0x0999('0x8'));var csv=require(_0x0999('0x9'));var ejs=require(_0x0999('0xa'));var fs=require('fs');var _=require(_0x0999('0xb'));var squel=require(_0x0999('0xc'));var crypto=require(_0x0999('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x0999('0xe'));var toCsv=require(_0x0999('0x9'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x0999('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x0999('0x10'));var hardwareService=require(_0x0999('0x11'));var logger=require(_0x0999('0x12'))(_0x0999('0x13'));var utils=require(_0x0999('0x14'));var config=require(_0x0999('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5a65aa,_0x2dc6da){_0x2dc6da=_0x2dc6da||0xcc;return function(_0x5ab590){if(_0x5ab590){return _0x5a65aa[_0x0999('0x16')](_0x2dc6da);}return _0x5a65aa[_0x0999('0x17')](_0x2dc6da)['end']();};}function respondWithResult(_0x36964c,_0x2477d0){_0x2477d0=_0x2477d0||0xc8;return function(_0x375365){if(_0x375365){return _0x36964c[_0x0999('0x17')](_0x2477d0)[_0x0999('0x18')](_0x375365);}};}function respondWithFilteredResult(_0x44bf84,_0x3946a4){return function(_0x3d27a3){if(_0x3d27a3){var _0x288258=_0x3d27a3['count'],_0x1b5522=_0x3946a4[_0x0999('0x19')],_0x4fa3da=_0x3946a4['offset']+_0x3946a4[_0x0999('0x1a')],_0x5ec8ad;if(_0x4fa3da>=_0x288258){_0x4fa3da=_0x288258;_0x5ec8ad=0xc8;}else{_0x5ec8ad=0xce;}_0x44bf84[_0x0999('0x17')](_0x5ec8ad);return _0x44bf84['set'](_0x0999('0x1b'),_0x1b5522+'-'+_0x4fa3da+'/'+_0x288258)[_0x0999('0x18')](_0x3d27a3);}return null;};}function patchUpdates(_0xb395d9){return function(_0x18405f){try{jsonpatch[_0x0999('0x1c')](_0x18405f,_0xb395d9,!![]);}catch(_0x22153f){return BPromise[_0x0999('0x1d')](_0x22153f);}return _0x18405f[_0x0999('0x1e')]();};}function saveUpdates(_0x180ca7,_0x313153){return function(_0x14dada){if(_0x14dada){return _0x14dada['update'](_0x180ca7)['then'](function(_0x526bb2){return _0x526bb2;});}return null;};}function removeEntity(_0x2f9f02,_0x463131){return function(_0x420329){if(_0x420329){return _0x420329[_0x0999('0x1f')]()['then'](function(){_0x2f9f02[_0x0999('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x95664a,_0x237089){return function(_0x2e8a0a){if(!_0x2e8a0a){_0x95664a[_0x0999('0x16')](0x194);}return _0x2e8a0a;};}function handleError(_0x3c6b7f,_0x5b66b5){_0x5b66b5=_0x5b66b5||0x1f4;return function(_0x11b8a0){logger['error'](_0x11b8a0[_0x0999('0x20')]);if(_0x11b8a0[_0x0999('0x21')]){delete _0x11b8a0[_0x0999('0x21')];}_0x3c6b7f['status'](_0x5b66b5)[_0x0999('0x22')](_0x11b8a0);};}exports['index']=function(_0x30c7a8,_0x125431){var _0x33ff27={},_0x2ed0a4={},_0x55ffb2={'count':0x0,'rows':[]};var _0x34386d=_[_0x0999('0x23')](db[_0x0999('0x24')][_0x0999('0x25')],function(_0x52f97c){return{'name':_0x52f97c[_0x0999('0x26')],'type':_0x52f97c[_0x0999('0x27')][_0x0999('0x28')]};});_0x2ed0a4[_0x0999('0x29')]=_[_0x0999('0x23')](_0x34386d,'name');_0x2ed0a4[_0x0999('0x2a')]=_[_0x0999('0x2b')](_0x30c7a8[_0x0999('0x2a')]);_0x2ed0a4[_0x0999('0x2c')]=_[_0x0999('0x2d')](_0x2ed0a4[_0x0999('0x29')],_0x2ed0a4['query']);_0x33ff27[_0x0999('0x2e')]=_['intersection'](_0x2ed0a4[_0x0999('0x29')],qs[_0x0999('0x2f')](_0x30c7a8['query'][_0x0999('0x2f')]));_0x33ff27[_0x0999('0x2e')]=_0x33ff27[_0x0999('0x2e')]['length']?_0x33ff27[_0x0999('0x2e')]:_0x2ed0a4['model'];if(!_0x30c7a8[_0x0999('0x2a')][_0x0999('0x30')](_0x0999('0x31'))){_0x33ff27['limit']=qs[_0x0999('0x1a')](_0x30c7a8[_0x0999('0x2a')][_0x0999('0x1a')]);_0x33ff27['offset']=qs[_0x0999('0x19')](_0x30c7a8['query'][_0x0999('0x19')]);}_0x33ff27[_0x0999('0x32')]=qs[_0x0999('0x33')](_0x30c7a8[_0x0999('0x2a')][_0x0999('0x33')]);_0x33ff27[_0x0999('0x34')]=qs[_0x0999('0x2c')](_['pick'](_0x30c7a8[_0x0999('0x2a')],_0x2ed0a4['filters']),_0x34386d);if(_0x30c7a8[_0x0999('0x2a')][_0x0999('0x35')]){_0x33ff27[_0x0999('0x34')]=_[_0x0999('0x36')](_0x33ff27[_0x0999('0x34')],{'$or':_[_0x0999('0x23')](_0x34386d,function(_0x5c7e7e){if(_0x5c7e7e[_0x0999('0x27')]!==_0x0999('0x37')){var _0xaaa8e3={};_0xaaa8e3[_0x5c7e7e[_0x0999('0x21')]]={'$like':'%'+_0x30c7a8[_0x0999('0x2a')][_0x0999('0x35')]+'%'};return _0xaaa8e3;}})});}_0x33ff27=_[_0x0999('0x36')]({},_0x33ff27,_0x30c7a8[_0x0999('0x38')]);var _0x2e5c9a={'where':_0x33ff27[_0x0999('0x34')]};return db[_0x0999('0x24')]['count'](_0x2e5c9a)[_0x0999('0x39')](function(_0x3525cc){_0x55ffb2['count']=_0x3525cc;if(_0x30c7a8[_0x0999('0x2a')][_0x0999('0x3a')]){_0x33ff27[_0x0999('0x3b')]=[{'all':!![]}];}return db[_0x0999('0x24')][_0x0999('0x3c')](_0x33ff27);})[_0x0999('0x39')](function(_0x5019e1){_0x55ffb2['rows']=_0x5019e1;return _0x55ffb2;})[_0x0999('0x39')](respondWithFilteredResult(_0x125431,_0x33ff27))[_0x0999('0x3d')](handleError(_0x125431,null));};exports[_0x0999('0x3e')]=function(_0x28fd18,_0x148de2){var _0x37a8cb={'raw':!![],'where':{'id':_0x28fd18['params']['id']}},_0x5d24cc={};_0x5d24cc[_0x0999('0x29')]=_[_0x0999('0x2b')](db[_0x0999('0x24')][_0x0999('0x25')]);_0x5d24cc['query']=_['keys'](_0x28fd18[_0x0999('0x2a')]);_0x5d24cc[_0x0999('0x2c')]=_[_0x0999('0x2d')](_0x5d24cc[_0x0999('0x29')],_0x5d24cc[_0x0999('0x2a')]);_0x37a8cb[_0x0999('0x2e')]=_['intersection'](_0x5d24cc['model'],qs['fields'](_0x28fd18[_0x0999('0x2a')][_0x0999('0x2f')]));_0x37a8cb[_0x0999('0x2e')]=_0x37a8cb[_0x0999('0x2e')][_0x0999('0x3f')]?_0x37a8cb[_0x0999('0x2e')]:_0x5d24cc['model'];if(_0x28fd18[_0x0999('0x2a')][_0x0999('0x3a')]){_0x37a8cb[_0x0999('0x3b')]=[{'all':!![]}];}_0x37a8cb=_['merge']({},_0x37a8cb,_0x28fd18['options']);return db[_0x0999('0x24')]['find'](_0x37a8cb)['then'](handleEntityNotFound(_0x148de2,null))[_0x0999('0x39')](respondWithResult(_0x148de2,null))[_0x0999('0x3d')](handleError(_0x148de2,null));};exports[_0x0999('0x40')]=function(_0x1a40b0,_0x4d0603){return db[_0x0999('0x24')][_0x0999('0x40')](_0x1a40b0['body'],{})[_0x0999('0x39')](respondWithResult(_0x4d0603,0xc9))[_0x0999('0x3d')](handleError(_0x4d0603,null));};exports['update']=function(_0x4de4c0,_0x281532){if(_0x4de4c0[_0x0999('0x41')]['id']){delete _0x4de4c0[_0x0999('0x41')]['id'];}return db[_0x0999('0x24')][_0x0999('0x42')]({'where':{'id':_0x4de4c0[_0x0999('0x43')]['id']}})['then'](handleEntityNotFound(_0x281532,null))['then'](saveUpdates(_0x4de4c0[_0x0999('0x41')],null))[_0x0999('0x39')](respondWithResult(_0x281532,null))[_0x0999('0x3d')](handleError(_0x281532,null));};exports[_0x0999('0x1f')]=function(_0x2a4119,_0xc796ad){return db['SugarcrmField'][_0x0999('0x42')]({'where':{'id':_0x2a4119['params']['id']}})[_0x0999('0x39')](handleEntityNotFound(_0xc796ad,null))[_0x0999('0x39')](removeEntity(_0xc796ad,null))[_0x0999('0x3d')](handleError(_0xc796ad,null));}; \ No newline at end of file +var _0x67fa=['options','find','create','body','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','path','sox','lodash','squel','desk.js','to-csv','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','reject','save','update','then','destroy','error','name','send','index','map','SugarcrmField','rawAttributes','fieldName','type','key','query','keys','intersection','attributes','model','fields','hasOwnProperty','nolimit','order','sort','where','filters','filter','merge','VIRTUAL','includeAll','findAll','catch','show','params','length','include'];(function(_0x389a61,_0x20216c){var _0x1acde9=function(_0x3c72d3){while(--_0x3c72d3){_0x389a61['push'](_0x389a61['shift']());}};_0x1acde9(++_0x20216c);}(_0x67fa,0xd6));var _0xa67f=function(_0x44263c,_0x430afa){_0x44263c=_0x44263c-0x0;var _0x54e798=_0x67fa[_0x44263c];return _0x54e798;};'use strict';var pdf=require(_0xa67f('0x0'));var emlformat=require(_0xa67f('0x1'));var rimraf=require(_0xa67f('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0xa67f('0x3'));var rp=require(_0xa67f('0x4'));var moment=require('moment');var BPromise=require(_0xa67f('0x5'));var Mustache=require(_0xa67f('0x6'));var util=require('util');var path=require(_0xa67f('0x7'));var sox=require(_0xa67f('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0xa67f('0x9'));var squel=require(_0xa67f('0xa'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xa67f('0xb'));var toCsv=require(_0xa67f('0xc'));var querystring=require('querystring');var Papa=require(_0xa67f('0xd'));var Redis=require(_0xa67f('0xe'));var authService=require('../../components/auth/service');var qs=require(_0xa67f('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xa67f('0x10'));var logger=require('../../config/logger')(_0xa67f('0x11'));var utils=require(_0xa67f('0x12'));var config=require(_0xa67f('0x13'));var db=require(_0xa67f('0x14'))['db'];function respondWithStatusCode(_0x493695,_0x4f2f59){_0x4f2f59=_0x4f2f59||0xcc;return function(_0x196643){if(_0x196643){return _0x493695[_0xa67f('0x15')](_0x4f2f59);}return _0x493695[_0xa67f('0x16')](_0x4f2f59)[_0xa67f('0x17')]();};}function respondWithResult(_0x1b651b,_0x46479e){_0x46479e=_0x46479e||0xc8;return function(_0x41e0bc){if(_0x41e0bc){return _0x1b651b[_0xa67f('0x16')](_0x46479e)[_0xa67f('0x18')](_0x41e0bc);}};}function respondWithFilteredResult(_0x5c048c,_0x3f6073){return function(_0xb85cc1){if(_0xb85cc1){var _0x74bece=_0xb85cc1[_0xa67f('0x19')],_0x2bfa1a=_0x3f6073[_0xa67f('0x1a')],_0x3b0ac5=_0x3f6073[_0xa67f('0x1a')]+_0x3f6073[_0xa67f('0x1b')],_0x3aa44f;if(_0x3b0ac5>=_0x74bece){_0x3b0ac5=_0x74bece;_0x3aa44f=0xc8;}else{_0x3aa44f=0xce;}_0x5c048c[_0xa67f('0x16')](_0x3aa44f);return _0x5c048c[_0xa67f('0x1c')]('Content-Range',_0x2bfa1a+'-'+_0x3b0ac5+'/'+_0x74bece)[_0xa67f('0x18')](_0xb85cc1);}return null;};}function patchUpdates(_0x4de50d){return function(_0x4a9bc){try{jsonpatch['apply'](_0x4a9bc,_0x4de50d,!![]);}catch(_0x3e2a1d){return BPromise[_0xa67f('0x1d')](_0x3e2a1d);}return _0x4a9bc[_0xa67f('0x1e')]();};}function saveUpdates(_0x45e330,_0x3259c8){return function(_0x33b8b5){if(_0x33b8b5){return _0x33b8b5[_0xa67f('0x1f')](_0x45e330)[_0xa67f('0x20')](function(_0x3f5323){return _0x3f5323;});}return null;};}function removeEntity(_0x47a22e,_0x4bc39c){return function(_0x1f8ca0){if(_0x1f8ca0){return _0x1f8ca0[_0xa67f('0x21')]()[_0xa67f('0x20')](function(){_0x47a22e[_0xa67f('0x16')](0xcc)[_0xa67f('0x17')]();});}};}function handleEntityNotFound(_0x327679,_0x3b9873){return function(_0x5abf8c){if(!_0x5abf8c){_0x327679[_0xa67f('0x15')](0x194);}return _0x5abf8c;};}function handleError(_0x12fdbd,_0x1fb473){_0x1fb473=_0x1fb473||0x1f4;return function(_0x19a321){logger[_0xa67f('0x22')](_0x19a321['stack']);if(_0x19a321[_0xa67f('0x23')]){delete _0x19a321[_0xa67f('0x23')];}_0x12fdbd[_0xa67f('0x16')](_0x1fb473)[_0xa67f('0x24')](_0x19a321);};}exports[_0xa67f('0x25')]=function(_0x227469,_0x55ab41){var _0x2d5971={},_0x1ea111={},_0x58689b={'count':0x0,'rows':[]};var _0x4ddf39=_[_0xa67f('0x26')](db[_0xa67f('0x27')][_0xa67f('0x28')],function(_0x224574){return{'name':_0x224574[_0xa67f('0x29')],'type':_0x224574[_0xa67f('0x2a')][_0xa67f('0x2b')]};});_0x1ea111['model']=_[_0xa67f('0x26')](_0x4ddf39,_0xa67f('0x23'));_0x1ea111[_0xa67f('0x2c')]=_[_0xa67f('0x2d')](_0x227469[_0xa67f('0x2c')]);_0x1ea111['filters']=_[_0xa67f('0x2e')](_0x1ea111['model'],_0x1ea111[_0xa67f('0x2c')]);_0x2d5971[_0xa67f('0x2f')]=_[_0xa67f('0x2e')](_0x1ea111[_0xa67f('0x30')],qs[_0xa67f('0x31')](_0x227469[_0xa67f('0x2c')]['fields']));_0x2d5971[_0xa67f('0x2f')]=_0x2d5971['attributes']['length']?_0x2d5971[_0xa67f('0x2f')]:_0x1ea111['model'];if(!_0x227469[_0xa67f('0x2c')][_0xa67f('0x32')](_0xa67f('0x33'))){_0x2d5971[_0xa67f('0x1b')]=qs['limit'](_0x227469[_0xa67f('0x2c')][_0xa67f('0x1b')]);_0x2d5971[_0xa67f('0x1a')]=qs[_0xa67f('0x1a')](_0x227469['query']['offset']);}_0x2d5971[_0xa67f('0x34')]=qs[_0xa67f('0x35')](_0x227469['query'][_0xa67f('0x35')]);_0x2d5971[_0xa67f('0x36')]=qs[_0xa67f('0x37')](_['pick'](_0x227469[_0xa67f('0x2c')],_0x1ea111['filters']),_0x4ddf39);if(_0x227469[_0xa67f('0x2c')][_0xa67f('0x38')]){_0x2d5971[_0xa67f('0x36')]=_[_0xa67f('0x39')](_0x2d5971[_0xa67f('0x36')],{'$or':_[_0xa67f('0x26')](_0x4ddf39,function(_0x4bfb35){if(_0x4bfb35[_0xa67f('0x2a')]!==_0xa67f('0x3a')){var _0x232882={};_0x232882[_0x4bfb35['name']]={'$like':'%'+_0x227469[_0xa67f('0x2c')][_0xa67f('0x38')]+'%'};return _0x232882;}})});}_0x2d5971=_['merge']({},_0x2d5971,_0x227469['options']);var _0x10714a={'where':_0x2d5971[_0xa67f('0x36')]};return db['SugarcrmField'][_0xa67f('0x19')](_0x10714a)[_0xa67f('0x20')](function(_0x32cc41){_0x58689b[_0xa67f('0x19')]=_0x32cc41;if(_0x227469['query'][_0xa67f('0x3b')]){_0x2d5971['include']=[{'all':!![]}];}return db['SugarcrmField'][_0xa67f('0x3c')](_0x2d5971);})[_0xa67f('0x20')](function(_0x28575c){_0x58689b['rows']=_0x28575c;return _0x58689b;})['then'](respondWithFilteredResult(_0x55ab41,_0x2d5971))[_0xa67f('0x3d')](handleError(_0x55ab41,null));};exports[_0xa67f('0x3e')]=function(_0x1113ad,_0xe62382){var _0x435512={'raw':!![],'where':{'id':_0x1113ad[_0xa67f('0x3f')]['id']}},_0x2d01a7={};_0x2d01a7[_0xa67f('0x30')]=_[_0xa67f('0x2d')](db[_0xa67f('0x27')][_0xa67f('0x28')]);_0x2d01a7[_0xa67f('0x2c')]=_[_0xa67f('0x2d')](_0x1113ad[_0xa67f('0x2c')]);_0x2d01a7[_0xa67f('0x37')]=_[_0xa67f('0x2e')](_0x2d01a7[_0xa67f('0x30')],_0x2d01a7[_0xa67f('0x2c')]);_0x435512[_0xa67f('0x2f')]=_[_0xa67f('0x2e')](_0x2d01a7[_0xa67f('0x30')],qs['fields'](_0x1113ad['query'][_0xa67f('0x31')]));_0x435512[_0xa67f('0x2f')]=_0x435512[_0xa67f('0x2f')][_0xa67f('0x40')]?_0x435512[_0xa67f('0x2f')]:_0x2d01a7['model'];if(_0x1113ad[_0xa67f('0x2c')][_0xa67f('0x3b')]){_0x435512[_0xa67f('0x41')]=[{'all':!![]}];}_0x435512=_[_0xa67f('0x39')]({},_0x435512,_0x1113ad[_0xa67f('0x42')]);return db[_0xa67f('0x27')][_0xa67f('0x43')](_0x435512)[_0xa67f('0x20')](handleEntityNotFound(_0xe62382,null))['then'](respondWithResult(_0xe62382,null))[_0xa67f('0x3d')](handleError(_0xe62382,null));};exports['create']=function(_0x2630f2,_0x207e76){return db[_0xa67f('0x27')][_0xa67f('0x44')](_0x2630f2[_0xa67f('0x45')],{})[_0xa67f('0x20')](respondWithResult(_0x207e76,0xc9))[_0xa67f('0x3d')](handleError(_0x207e76,null));};exports[_0xa67f('0x1f')]=function(_0x28fdb6,_0x561e63){if(_0x28fdb6[_0xa67f('0x45')]['id']){delete _0x28fdb6[_0xa67f('0x45')]['id'];}return db[_0xa67f('0x27')][_0xa67f('0x43')]({'where':{'id':_0x28fdb6[_0xa67f('0x3f')]['id']}})[_0xa67f('0x20')](handleEntityNotFound(_0x561e63,null))[_0xa67f('0x20')](saveUpdates(_0x28fdb6[_0xa67f('0x45')],null))[_0xa67f('0x20')](respondWithResult(_0x561e63,null))[_0xa67f('0x3d')](handleError(_0x561e63,null));};exports[_0xa67f('0x21')]=function(_0x4b90e8,_0x38749b){return db[_0xa67f('0x27')][_0xa67f('0x43')]({'where':{'id':_0x4b90e8['params']['id']}})[_0xa67f('0x20')](handleEntityNotFound(_0x38749b,null))['then'](removeEntity(_0x38749b,null))[_0xa67f('0x3d')](handleError(_0x38749b,null));}; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.model.js b/server/api/intSugarcrmField/intSugarcrmField.model.js index b99f0c6..ff99af3 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 _0x866c=['exports','define','SugarcrmField','int_sugarcrm_fields','FieldId','../../config/logger','api','moment','path','../../config/environment'];(function(_0x32bab2,_0x2f912e){var _0x19efa7=function(_0x5e1898){while(--_0x5e1898){_0x32bab2['push'](_0x32bab2['shift']());}};_0x19efa7(++_0x2f912e);}(_0x866c,0x1bd));var _0xc866=function(_0xb869c3,_0x2989ea){_0xb869c3=_0xb869c3-0x0;var _0x42f9eb=_0x866c[_0xb869c3];return _0x42f9eb;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xc866('0x0'))(_0xc866('0x1'));var moment=require(_0xc866('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xc866('0x3'));var rimraf=require('rimraf');var config=require(_0xc866('0x4'));var attributes=require('./intSugarcrmField.attributes');module[_0xc866('0x5')]=function(_0x3021bc,_0xbda486){return _0x3021bc[_0xc866('0x6')](_0xc866('0x7'),attributes,{'tableName':_0xc866('0x8'),'paranoid':![],'indexes':[{'name':'sugarcrm_unique_index','fields':['idField',_0xc866('0x9')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x260c=['api','request-promise','rimraf','../../config/environment','./intSugarcrmField.attributes','exports','sugarcrm_unique_index','idField','FieldId','lodash','util','../../config/logger'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x260c,0xe1));var _0xc260=function(_0x410b42,_0x11e633){_0x410b42=_0x410b42-0x0;var _0x22d0e8=_0x260c[_0x410b42];return _0x22d0e8;};'use strict';var _=require(_0xc260('0x0'));var util=require(_0xc260('0x1'));var logger=require(_0xc260('0x2'))(_0xc260('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xc260('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xc260('0x5'));var config=require(_0xc260('0x6'));var attributes=require(_0xc260('0x7'));module[_0xc260('0x8')]=function(_0x309025,_0x4f9196){return _0x309025['define']('SugarcrmField',attributes,{'tableName':'int_sugarcrm_fields','paranoid':![],'indexes':[{'name':_0xc260('0x9'),'fields':[_0xc260('0xa'),_0xc260('0xb')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.rpc.js b/server/api/intSugarcrmField/intSugarcrmField.rpc.js index af7276f..2bf424b 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 _0x8603=['message','info','result','catch','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','then','SugarcrmField,\x20%s,\x20%s','request\x20sent','SugarcrmField,\x20%s,\x20%s,\x20%s','error'];(function(_0x465028,_0x4570ac){var _0xb783d4=function(_0x5458c5){while(--_0x5458c5){_0x465028['push'](_0x465028['shift']());}};_0xb783d4(++_0x4570ac);}(_0x8603,0x190));var _0x3860=function(_0x3a9468,_0x2b6266){_0x3a9468=_0x3a9468-0x0;var _0x1d2345=_0x8603[_0x3a9468];return _0x1d2345;};'use strict';var _=require('lodash');var util=require(_0x3860('0x0'));var moment=require(_0x3860('0x1'));var BPromise=require(_0x3860('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x3860('0x3'))['db'];var utils=require(_0x3860('0x4'));var logger=require(_0x3860('0x5'))('rpc');var config=require(_0x3860('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x3860('0x7')][_0x3860('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x1eca44,_0xd3ce26,_0x472bf2){return new BPromise(function(_0x4aba10,_0x5c7350){return client['request'](_0x1eca44,_0x472bf2)[_0x3860('0x9')](function(_0x441dc4){logger['info'](_0x3860('0xa'),_0xd3ce26,_0x3860('0xb'));logger['debug'](_0x3860('0xc'),_0xd3ce26,_0x3860('0xb'),JSON['stringify'](_0x441dc4));if(_0x441dc4[_0x3860('0xd')]){if(_0x441dc4[_0x3860('0xd')]['code']===0x1f4){logger[_0x3860('0xd')](_0x3860('0xa'),_0xd3ce26,_0x441dc4[_0x3860('0xd')][_0x3860('0xe')]);return _0x5c7350(_0x441dc4[_0x3860('0xd')][_0x3860('0xe')]);}logger[_0x3860('0xd')](_0x3860('0xa'),_0xd3ce26,_0x441dc4[_0x3860('0xd')][_0x3860('0xe')]);return _0x4aba10(_0x441dc4['error'][_0x3860('0xe')]);}else{logger[_0x3860('0xf')](_0x3860('0xa'),_0xd3ce26,_0x3860('0xb'));_0x4aba10(_0x441dc4[_0x3860('0x10')][_0x3860('0xe')]);}})[_0x3860('0x11')](function(_0x378305){logger[_0x3860('0xd')](_0x3860('0xa'),_0xd3ce26,_0x378305);_0x5c7350(_0x378305);});});} \ No newline at end of file +var _0x0b0e=['SugarcrmField,\x20%s,\x20%s,\x20%s','stringify','error','message','request\x20sent','result','catch','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','SugarcrmField,\x20%s,\x20%s','debug'];(function(_0x4914ad,_0x551a18){var _0x3cd61f=function(_0x2a773e){while(--_0x2a773e){_0x4914ad['push'](_0x4914ad['shift']());}};_0x3cd61f(++_0x551a18);}(_0x0b0e,0x187));var _0xe0b0=function(_0x39157f,_0x3d8c1e){_0x39157f=_0x39157f-0x0;var _0x1ae4e2=_0x0b0e[_0x39157f];return _0x1ae4e2;};'use strict';var _=require(_0xe0b0('0x0'));var util=require('util');var moment=require(_0xe0b0('0x1'));var BPromise=require('bluebird');var rs=require(_0xe0b0('0x2'));var fs=require('fs');var Redis=require(_0xe0b0('0x3'));var db=require(_0xe0b0('0x4'))['db'];var utils=require(_0xe0b0('0x5'));var logger=require(_0xe0b0('0x6'))(_0xe0b0('0x7'));var config=require(_0xe0b0('0x8'));var jayson=require(_0xe0b0('0x9'));var client=jayson[_0xe0b0('0xa')][_0xe0b0('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x219b1c,_0x5cf9cc,_0x50be7f){return new BPromise(function(_0x11effc,_0x435060){return client[_0xe0b0('0xc')](_0x219b1c,_0x50be7f)[_0xe0b0('0xd')](function(_0x4c24f9){logger[_0xe0b0('0xe')](_0xe0b0('0xf'),_0x5cf9cc,'request\x20sent');logger[_0xe0b0('0x10')](_0xe0b0('0x11'),_0x5cf9cc,'request\x20sent',JSON[_0xe0b0('0x12')](_0x4c24f9));if(_0x4c24f9[_0xe0b0('0x13')]){if(_0x4c24f9[_0xe0b0('0x13')]['code']===0x1f4){logger[_0xe0b0('0x13')](_0xe0b0('0xf'),_0x5cf9cc,_0x4c24f9[_0xe0b0('0x13')][_0xe0b0('0x14')]);return _0x435060(_0x4c24f9[_0xe0b0('0x13')]['message']);}logger[_0xe0b0('0x13')](_0xe0b0('0xf'),_0x5cf9cc,_0x4c24f9[_0xe0b0('0x13')][_0xe0b0('0x14')]);return _0x11effc(_0x4c24f9[_0xe0b0('0x13')]['message']);}else{logger[_0xe0b0('0xe')]('SugarcrmField,\x20%s,\x20%s',_0x5cf9cc,_0xe0b0('0x15'));_0x11effc(_0x4c24f9[_0xe0b0('0x16')]['message']);}})[_0xe0b0('0x17')](function(_0x4a4cc0){logger[_0xe0b0('0x13')](_0xe0b0('0xf'),_0x5cf9cc,_0x4a4cc0);_0x435060(_0x4a4cc0);});});} \ No newline at end of file diff --git a/server/api/intVtigerAccount/index.js b/server/api/intVtigerAccount/index.js index 803c5e7..8aee629 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 _0x2b98=['../../components/auth/service','../../config/environment','./intVtigerAccount.controller','get','/:id','show','/:id/configurations','getConfigurations','/:id/fields','isAuthenticated','getFields','post','put','update','delete','exports','util','path','connect-timeout','Router'];(function(_0x730350,_0x5a48fd){var _0x24baeb=function(_0x2e59ea){while(--_0x2e59ea){_0x730350['push'](_0x730350['shift']());}};_0x24baeb(++_0x5a48fd);}(_0x2b98,0xd8));var _0x82b9=function(_0x1b828b,_0x344400){_0x1b828b=_0x1b828b-0x0;var _0x98da1a=_0x2b98[_0x1b828b];return _0x98da1a;};'use strict';var multer=require('multer');var util=require(_0x82b9('0x0'));var path=require(_0x82b9('0x1'));var timeout=require(_0x82b9('0x2'));var express=require('express');var router=express[_0x82b9('0x3')]();var auth=require(_0x82b9('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x82b9('0x5'));var controller=require(_0x82b9('0x6'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0x82b9('0x7')](_0x82b9('0x8'),auth['isAuthenticated'](),controller[_0x82b9('0x9')]);router[_0x82b9('0x7')](_0x82b9('0xa'),auth['isAuthenticated'](),controller[_0x82b9('0xb')]);router[_0x82b9('0x7')](_0x82b9('0xc'),auth[_0x82b9('0xd')](),controller[_0x82b9('0xe')]);router[_0x82b9('0xf')]('/',auth[_0x82b9('0xd')](),controller['create']);router['post'](_0x82b9('0xa'),auth[_0x82b9('0xd')](),controller['addConfiguration']);router[_0x82b9('0x10')](_0x82b9('0x8'),auth[_0x82b9('0xd')](),controller[_0x82b9('0x11')]);router[_0x82b9('0x12')](_0x82b9('0x8'),auth[_0x82b9('0xd')](),controller['destroy']);module[_0x82b9('0x13')]=router; \ No newline at end of file +var _0xb3e7=['show','/:id/fields','getFields','post','create','/:id/configurations','addConfiguration','put','/:id','update','delete','destroy','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./intVtigerAccount.controller','get','isAuthenticated'];(function(_0x1957d0,_0x152fc8){var _0x53d6dc=function(_0x51c7a5){while(--_0x51c7a5){_0x1957d0['push'](_0x1957d0['shift']());}};_0x53d6dc(++_0x152fc8);}(_0xb3e7,0xc4));var _0x7b3e=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0xb3e7[_0x397e5f];return _0x5302b8;};'use strict';var multer=require(_0x7b3e('0x0'));var util=require(_0x7b3e('0x1'));var path=require(_0x7b3e('0x2'));var timeout=require(_0x7b3e('0x3'));var express=require(_0x7b3e('0x4'));var router=express[_0x7b3e('0x5')]();var auth=require(_0x7b3e('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x7b3e('0x7'));var controller=require(_0x7b3e('0x8'));router[_0x7b3e('0x9')]('/',auth[_0x7b3e('0xa')](),controller['index']);router[_0x7b3e('0x9')]('/:id',auth[_0x7b3e('0xa')](),controller[_0x7b3e('0xb')]);router[_0x7b3e('0x9')]('/:id/configurations',auth[_0x7b3e('0xa')](),controller['getConfigurations']);router[_0x7b3e('0x9')](_0x7b3e('0xc'),auth[_0x7b3e('0xa')](),controller[_0x7b3e('0xd')]);router[_0x7b3e('0xe')]('/',auth[_0x7b3e('0xa')](),controller[_0x7b3e('0xf')]);router[_0x7b3e('0xe')](_0x7b3e('0x10'),auth[_0x7b3e('0xa')](),controller[_0x7b3e('0x11')]);router[_0x7b3e('0x12')](_0x7b3e('0x13'),auth[_0x7b3e('0xa')](),controller[_0x7b3e('0x14')]);router[_0x7b3e('0x15')]('/:id',auth[_0x7b3e('0xa')](),controller[_0x7b3e('0x16')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.attributes.js b/server/api/intVtigerAccount/intVtigerAccount.attributes.js index 7607217..3cb886d 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 _0x786f=['sequelize','exports','STRING','HelpDesk'];(function(_0x427513,_0x22a741){var _0x454000=function(_0x36d69a){while(--_0x36d69a){_0x427513['push'](_0x427513['shift']());}};_0x454000(++_0x22a741);}(_0x786f,0x10c));var _0xf786=function(_0x4c445a,_0x4ee80f){_0x4c445a=_0x4c445a-0x0;var _0x2f611c=_0x786f[_0x4c445a];return _0x2f611c;};'use strict';var Sequelize=require(_0xf786('0x0'));module[_0xf786('0x1')]={'name':{'type':Sequelize[_0xf786('0x2')],'allowNull':![]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize['STRING'],'allowNull':![]},'moduleName':{'type':Sequelize[_0xf786('0x2')],'allowNull':![],'defaultValue':_0xf786('0x3')},'remoteUri':{'type':Sequelize['STRING'],'allowNull':![]},'serverUrl':{'type':Sequelize['STRING']},'accessKey':{'type':Sequelize['STRING'],'allowNull':![]}}; \ No newline at end of file +var _0xa676=['STRING','HelpDesk','sequelize'];(function(_0x4d9b75,_0x345223){var _0x17aed5=function(_0x4e5ade){while(--_0x4e5ade){_0x4d9b75['push'](_0x4d9b75['shift']());}};_0x17aed5(++_0x345223);}(_0xa676,0x18e));var _0x6a67=function(_0xa186c6,_0x40b25b){_0xa186c6=_0xa186c6-0x0;var _0x2d4693=_0xa676[_0xa186c6];return _0x2d4693;};'use strict';var Sequelize=require(_0x6a67('0x0'));module['exports']={'name':{'type':Sequelize[_0x6a67('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0x6a67('0x1')]},'username':{'type':Sequelize['STRING'],'allowNull':![]},'moduleName':{'type':Sequelize[_0x6a67('0x1')],'allowNull':![],'defaultValue':_0x6a67('0x2')},'remoteUri':{'type':Sequelize[_0x6a67('0x1')],'allowNull':![]},'serverUrl':{'type':Sequelize[_0x6a67('0x1')]},'accessKey':{'type':Sequelize[_0x6a67('0x1')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.controller.js b/server/api/intVtigerAccount/intVtigerAccount.controller.js index fe458c8..5eeb795 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 _0x3f43=['getFields','description','serverUrl','accessKey','username','remoteUri','lastIndexOf','format','%s/webservice.php','GET','getchallenge','POST','result','token','sessionName','success','autogenerated','reference','owner','remove','editable','false','label','cf_','picklist','map','picklistValues','value','log','vTiger\x20error:\x20','statusCode','getFields,\x20%s,\x20%s,\x20%s','send','Wrong\x20credentials','html-pdf','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','path','sox','to-csv','lodash','squel','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../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~!@#$%^&-_=+[{]}.','info','VtigerAccount,\x20%s,\x20%s','request\x20sent','debug','VtigerAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','status','end','json','count','offset','limit','set','Content-Range','apply','save','update','then','destroy','stack','name','index','rawAttributes','type','key','model','keys','attributes','fields','query','length','nolimit','order','sort','where','filters','pick','filter','VIRTUAL','merge','options','includeAll','include','VtigerAccount','rows','show','params','intersection','find','create','body','findOne','VtigerConfiguration','getConfigurations','hasOwnProperty','addConfiguration','AccountId','channel','Descriptions','getDescriptions','VtigerField','Subjects','md5'];(function(_0x10c56b,_0x297995){var _0x5c3889=function(_0x590a77){while(--_0x590a77){_0x10c56b['push'](_0x10c56b['shift']());}};_0x5c3889(++_0x297995);}(_0x3f43,0xa8));var _0x33f4=function(_0x6e2a63,_0x2473e3){_0x6e2a63=_0x6e2a63-0x0;var _0x56952a=_0x3f43[_0x6e2a63];return _0x56952a;};'use strict';var pdf=require(_0x33f4('0x0'));var emlformat=require(_0x33f4('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x33f4('0x2'));var jsonpatch=require(_0x33f4('0x3'));var rp=require('request-promise');var moment=require(_0x33f4('0x4'));var BPromise=require(_0x33f4('0x5'));var Mustache=require(_0x33f4('0x6'));var util=require('util');var path=require(_0x33f4('0x7'));var sox=require(_0x33f4('0x8'));var csv=require(_0x33f4('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x33f4('0xa'));var squel=require(_0x33f4('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x33f4('0xc'));var toCsv=require(_0x33f4('0x9'));var querystring=require(_0x33f4('0xd'));var Papa=require(_0x33f4('0xe'));var Redis=require(_0x33f4('0xf'));var authService=require(_0x33f4('0x10'));var qs=require(_0x33f4('0x11'));var as=require(_0x33f4('0x12'));var hardwareService=require(_0x33f4('0x13'));var logger=require(_0x33f4('0x14'))(_0x33f4('0x15'));var utils=require(_0x33f4('0x16'));var config=require(_0x33f4('0x17'));var db=require(_0x33f4('0x18'))['db'];var integrations=require(_0x33f4('0x19'));var jayson=require(_0x33f4('0x1a'));var client=jayson[_0x33f4('0x1b')][_0x33f4('0x1c')]({'port':0x232a});function checkPasswordPattern(_0x42c3f5,_0x16b624,_0x182261){if(_0x182261){var _0x245b50=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x245b50[_0x33f4('0x1d')](_0x16b624)){return _0x42c3f5;}else{throw new db[(_0x33f4('0x1e'))][(_0x33f4('0x1f'))](_0x33f4('0x20'));}}else{return _0x42c3f5;}}function respondWithRpcPromise(_0x3f5d91,_0x93df11,_0x466bea,_0x326a15){return new BPromise(function(_0x5109c2,_0x19094a){var _0x5530cb=_0x326a15||client;return _0x5530cb['request'](_0x3f5d91,_0x466bea)['then'](function(_0x380b9e){logger[_0x33f4('0x21')](_0x33f4('0x22'),_0x93df11,_0x33f4('0x23'));logger[_0x33f4('0x24')](_0x33f4('0x25'),_0x93df11,_0x33f4('0x23'),JSON[_0x33f4('0x26')](_0x380b9e));if(_0x380b9e[_0x33f4('0x27')]){if(_0x380b9e[_0x33f4('0x27')][_0x33f4('0x28')]===0x1f4){logger[_0x33f4('0x27')]('VtigerAccount,\x20%s,\x20%s',_0x93df11,_0x380b9e[_0x33f4('0x27')]['message']);return _0x19094a(_0x380b9e[_0x33f4('0x27')][_0x33f4('0x29')]);}logger['error']('VtigerAccount,\x20%s,\x20%s',_0x93df11,_0x380b9e[_0x33f4('0x27')][_0x33f4('0x29')]);return _0x5109c2(_0x380b9e[_0x33f4('0x27')][_0x33f4('0x29')]);}else{logger['info'](_0x33f4('0x22'),_0x93df11,_0x33f4('0x23'));_0x5109c2(_0x380b9e['result'][_0x33f4('0x29')]);}})[_0x33f4('0x2a')](function(_0x177ff3){logger[_0x33f4('0x27')]('VtigerAccount,\x20%s,\x20%s',_0x93df11,_0x177ff3);_0x19094a(_0x177ff3);});});}function respondWithStatusCode(_0x1408a2,_0x435441){_0x435441=_0x435441||0xcc;return function(_0x4c0131){if(_0x4c0131){return _0x1408a2['sendStatus'](_0x435441);}return _0x1408a2[_0x33f4('0x2b')](_0x435441)[_0x33f4('0x2c')]();};}function respondWithResult(_0x964cae,_0x47f465){_0x47f465=_0x47f465||0xc8;return function(_0x4b575b){if(_0x4b575b){return _0x964cae[_0x33f4('0x2b')](_0x47f465)[_0x33f4('0x2d')](_0x4b575b);}};}function respondWithFilteredResult(_0x5b0b2e,_0x2eca08){return function(_0x83e380){if(_0x83e380){var _0x40fc54=_0x83e380[_0x33f4('0x2e')],_0x5ef118=_0x2eca08['offset'],_0x486609=_0x2eca08[_0x33f4('0x2f')]+_0x2eca08[_0x33f4('0x30')],_0x7c3436;if(_0x486609>=_0x40fc54){_0x486609=_0x40fc54;_0x7c3436=0xc8;}else{_0x7c3436=0xce;}_0x5b0b2e['status'](_0x7c3436);return _0x5b0b2e[_0x33f4('0x31')](_0x33f4('0x32'),_0x5ef118+'-'+_0x486609+'/'+_0x40fc54)[_0x33f4('0x2d')](_0x83e380);}return null;};}function patchUpdates(_0x3a5189){return function(_0x2549a9){try{jsonpatch[_0x33f4('0x33')](_0x2549a9,_0x3a5189,!![]);}catch(_0x4864f1){return BPromise['reject'](_0x4864f1);}return _0x2549a9[_0x33f4('0x34')]();};}function saveUpdates(_0x37c3cb,_0x1b9732){return function(_0x24eeb8){if(_0x24eeb8){return _0x24eeb8[_0x33f4('0x35')](_0x37c3cb)[_0x33f4('0x36')](function(_0x57c72a){return _0x57c72a;});}return null;};}function removeEntity(_0x1e20ce,_0xd40edc){return function(_0x450186){if(_0x450186){return _0x450186[_0x33f4('0x37')]()['then'](function(){_0x1e20ce[_0x33f4('0x2b')](0xcc)[_0x33f4('0x2c')]();});}};}function handleEntityNotFound(_0x461aa1,_0x3c3a17){return function(_0x55c5c7){if(!_0x55c5c7){_0x461aa1['sendStatus'](0x194);}return _0x55c5c7;};}function handleError(_0x2c14b7,_0x2d82f5){_0x2d82f5=_0x2d82f5||0x1f4;return function(_0x5d8764){logger['error'](_0x5d8764[_0x33f4('0x38')]);if(_0x5d8764[_0x33f4('0x39')]){delete _0x5d8764[_0x33f4('0x39')];}_0x2c14b7['status'](_0x2d82f5)['send'](_0x5d8764);};}exports[_0x33f4('0x3a')]=function(_0x48eae7,_0x3e9b57){var _0x580751={},_0x1f55a2={},_0x2d8dfd={'count':0x0,'rows':[]};var _0x417f98=_['map'](db['VtigerAccount'][_0x33f4('0x3b')],function(_0x2d38ae){return{'name':_0x2d38ae['fieldName'],'type':_0x2d38ae[_0x33f4('0x3c')][_0x33f4('0x3d')]};});_0x1f55a2[_0x33f4('0x3e')]=_['map'](_0x417f98,'name');_0x1f55a2['query']=_[_0x33f4('0x3f')](_0x48eae7['query']);_0x1f55a2['filters']=_['intersection'](_0x1f55a2[_0x33f4('0x3e')],_0x1f55a2['query']);_0x580751[_0x33f4('0x40')]=_['intersection'](_0x1f55a2[_0x33f4('0x3e')],qs[_0x33f4('0x41')](_0x48eae7[_0x33f4('0x42')][_0x33f4('0x41')]));_0x580751['attributes']=_0x580751[_0x33f4('0x40')][_0x33f4('0x43')]?_0x580751[_0x33f4('0x40')]:_0x1f55a2[_0x33f4('0x3e')];if(!_0x48eae7[_0x33f4('0x42')]['hasOwnProperty'](_0x33f4('0x44'))){_0x580751[_0x33f4('0x30')]=qs[_0x33f4('0x30')](_0x48eae7[_0x33f4('0x42')][_0x33f4('0x30')]);_0x580751[_0x33f4('0x2f')]=qs['offset'](_0x48eae7[_0x33f4('0x42')][_0x33f4('0x2f')]);}_0x580751[_0x33f4('0x45')]=qs[_0x33f4('0x46')](_0x48eae7[_0x33f4('0x42')][_0x33f4('0x46')]);_0x580751[_0x33f4('0x47')]=qs[_0x33f4('0x48')](_[_0x33f4('0x49')](_0x48eae7[_0x33f4('0x42')],_0x1f55a2[_0x33f4('0x48')]),_0x417f98);if(_0x48eae7[_0x33f4('0x42')][_0x33f4('0x4a')]){_0x580751[_0x33f4('0x47')]=_['merge'](_0x580751[_0x33f4('0x47')],{'$or':_['map'](_0x417f98,function(_0x23a401){if(_0x23a401[_0x33f4('0x3c')]!==_0x33f4('0x4b')){var _0x24de5c={};_0x24de5c[_0x23a401[_0x33f4('0x39')]]={'$like':'%'+_0x48eae7[_0x33f4('0x42')][_0x33f4('0x4a')]+'%'};return _0x24de5c;}})});}_0x580751=_[_0x33f4('0x4c')]({},_0x580751,_0x48eae7[_0x33f4('0x4d')]);var _0x130b3d={'where':_0x580751[_0x33f4('0x47')]};return db['VtigerAccount']['count'](_0x130b3d)[_0x33f4('0x36')](function(_0x5bed34){_0x2d8dfd[_0x33f4('0x2e')]=_0x5bed34;if(_0x48eae7[_0x33f4('0x42')][_0x33f4('0x4e')]){_0x580751[_0x33f4('0x4f')]=[{'all':!![]}];}return db[_0x33f4('0x50')]['findAll'](_0x580751);})['then'](function(_0x1ea566){_0x2d8dfd[_0x33f4('0x51')]=_0x1ea566;return _0x2d8dfd;})['then'](respondWithFilteredResult(_0x3e9b57,_0x580751))[_0x33f4('0x2a')](handleError(_0x3e9b57,null));};exports[_0x33f4('0x52')]=function(_0x182be4,_0x17a7db){var _0x62df2c={'raw':![],'where':{'id':_0x182be4[_0x33f4('0x53')]['id']}},_0x36918f={};_0x36918f[_0x33f4('0x3e')]=_[_0x33f4('0x3f')](db['VtigerAccount'][_0x33f4('0x3b')]);_0x36918f[_0x33f4('0x42')]=_[_0x33f4('0x3f')](_0x182be4['query']);_0x36918f[_0x33f4('0x48')]=_[_0x33f4('0x54')](_0x36918f[_0x33f4('0x3e')],_0x36918f[_0x33f4('0x42')]);_0x62df2c['attributes']=_[_0x33f4('0x54')](_0x36918f[_0x33f4('0x3e')],qs['fields'](_0x182be4[_0x33f4('0x42')]['fields']));_0x62df2c['attributes']=_0x62df2c[_0x33f4('0x40')][_0x33f4('0x43')]?_0x62df2c['attributes']:_0x36918f[_0x33f4('0x3e')];if(_0x182be4[_0x33f4('0x42')]['includeAll']){_0x62df2c[_0x33f4('0x4f')]=[{'all':!![]}];}_0x62df2c=_[_0x33f4('0x4c')]({},_0x62df2c,_0x182be4[_0x33f4('0x4d')]);return db[_0x33f4('0x50')][_0x33f4('0x55')](_0x62df2c)[_0x33f4('0x36')](handleEntityNotFound(_0x17a7db,null))['then'](respondWithResult(_0x17a7db,null))[_0x33f4('0x2a')](handleError(_0x17a7db,null));};exports[_0x33f4('0x56')]=function(_0x28de5c,_0x41088c){return db[_0x33f4('0x50')]['create'](_0x28de5c[_0x33f4('0x57')],{})[_0x33f4('0x36')](respondWithResult(_0x41088c,0xc9))['catch'](handleError(_0x41088c,null));};exports[_0x33f4('0x35')]=function(_0x478415,_0x109334){if(_0x478415['body']['id']){delete _0x478415[_0x33f4('0x57')]['id'];}return db[_0x33f4('0x50')][_0x33f4('0x55')]({'where':{'id':_0x478415[_0x33f4('0x53')]['id']}})['then'](handleEntityNotFound(_0x109334,null))[_0x33f4('0x36')](saveUpdates(_0x478415[_0x33f4('0x57')],null))[_0x33f4('0x36')](respondWithResult(_0x109334,null))[_0x33f4('0x2a')](handleError(_0x109334,null));};exports[_0x33f4('0x37')]=function(_0x540155,_0x35dc5f){return db['VtigerAccount'][_0x33f4('0x55')]({'where':{'id':_0x540155['params']['id']}})[_0x33f4('0x36')](handleEntityNotFound(_0x35dc5f,null))[_0x33f4('0x36')](removeEntity(_0x35dc5f,null))['catch'](handleError(_0x35dc5f,null));};exports['getConfigurations']=function(_0x3ccfcc,_0x569166,_0x16314d){var _0x22acb8={};var _0x24dc41={};var _0x558503;var _0xdbacbd;return db['VtigerAccount'][_0x33f4('0x58')]({'where':{'id':_0x3ccfcc[_0x33f4('0x53')]['id']}})['then'](handleEntityNotFound(_0x569166,null))[_0x33f4('0x36')](function(_0x32e105){if(_0x32e105){_0x558503=_0x32e105;_0x24dc41[_0x33f4('0x3e')]=_[_0x33f4('0x3f')](db[_0x33f4('0x59')][_0x33f4('0x3b')]);_0x24dc41['query']=_[_0x33f4('0x3f')](_0x3ccfcc[_0x33f4('0x42')]);_0x24dc41[_0x33f4('0x48')]=_[_0x33f4('0x54')](_0x24dc41[_0x33f4('0x3e')],_0x24dc41['query']);_0x22acb8[_0x33f4('0x40')]=_[_0x33f4('0x54')](_0x24dc41[_0x33f4('0x3e')],qs[_0x33f4('0x41')](_0x3ccfcc[_0x33f4('0x42')][_0x33f4('0x41')]));_0x22acb8[_0x33f4('0x40')]=_0x22acb8[_0x33f4('0x40')][_0x33f4('0x43')]?_0x22acb8[_0x33f4('0x40')]:_0x24dc41[_0x33f4('0x3e')];_0x22acb8[_0x33f4('0x45')]=qs[_0x33f4('0x46')](_0x3ccfcc[_0x33f4('0x42')][_0x33f4('0x46')]);_0x22acb8['where']=qs['filters'](_[_0x33f4('0x49')](_0x3ccfcc[_0x33f4('0x42')],_0x24dc41[_0x33f4('0x48')]));if(_0x3ccfcc[_0x33f4('0x42')][_0x33f4('0x4a')]){_0x22acb8[_0x33f4('0x47')]=_['merge'](_0x22acb8[_0x33f4('0x47')],{'$or':_['map'](_0x22acb8[_0x33f4('0x40')],function(_0x34c7e5){var _0x48c0be={};_0x48c0be[_0x34c7e5]={'$like':'%'+_0x3ccfcc[_0x33f4('0x42')][_0x33f4('0x4a')]+'%'};return _0x48c0be;})});}_0x22acb8=_[_0x33f4('0x4c')]({},_0x22acb8,_0x3ccfcc['options']);return _0x558503[_0x33f4('0x5a')](_0x22acb8);}})[_0x33f4('0x36')](function(_0x5427ed){if(_0x5427ed){_0xdbacbd=_0x5427ed[_0x33f4('0x43')];if(!_0x3ccfcc['query'][_0x33f4('0x5b')](_0x33f4('0x44'))){_0x22acb8['limit']=qs['limit'](_0x3ccfcc[_0x33f4('0x42')][_0x33f4('0x30')]);_0x22acb8['offset']=qs[_0x33f4('0x2f')](_0x3ccfcc[_0x33f4('0x42')][_0x33f4('0x2f')]);}return _0x558503[_0x33f4('0x5a')](_0x22acb8);}})[_0x33f4('0x36')](function(_0x391e92){if(_0x391e92){return _0x391e92?{'count':_0xdbacbd,'rows':_0x391e92}:null;}})['then'](respondWithResult(_0x569166,null))['catch'](handleError(_0x569166,null));};exports[_0x33f4('0x5c')]=function(_0x1577c1,_0x2e9ad1,_0x566860){if(_0x1577c1[_0x33f4('0x57')]['id']){delete _0x1577c1[_0x33f4('0x57')]['id'];}return db[_0x33f4('0x50')]['findOne']({'where':{'id':_0x1577c1[_0x33f4('0x53')]['id']}})['then'](handleEntityNotFound(_0x2e9ad1,null))['then'](function(_0x2ce987){if(_0x2ce987){_0x1577c1[_0x33f4('0x57')][_0x33f4('0x5d')]=_0x2ce987['id'];_0x1577c1['body']['Subjects']=integrations['getSubjects'](_0x1577c1['body'][_0x33f4('0x5e')],_0x1577c1[_0x33f4('0x57')][_0x33f4('0x3c')]);_0x1577c1[_0x33f4('0x57')][_0x33f4('0x5f')]=integrations[_0x33f4('0x60')](_0x1577c1[_0x33f4('0x57')][_0x33f4('0x5e')],_0x1577c1['body']['type']);return db['VtigerConfiguration']['create'](_0x1577c1['body'],{'include':[{'model':db[_0x33f4('0x61')],'as':_0x33f4('0x62')},{'model':db['VtigerField'],'as':_0x33f4('0x5f')}]});}return null;})[_0x33f4('0x36')](respondWithResult(_0x2e9ad1,null))[_0x33f4('0x2a')](handleError(_0x2e9ad1,null));};var md5=require(_0x33f4('0x63'));exports[_0x33f4('0x64')]=function(_0x501230,_0x12ecbb,_0x58ddc0){var _0x1a0090=null;var _0x1b8358=null;var _0x35785b=null;var _0x476c5f=null;var _0x2f9117='';return db['VtigerAccount'][_0x33f4('0x58')]({'where':{'id':_0x501230[_0x33f4('0x53')]['id']},'attributes':['id','name','username',_0x33f4('0x65'),'moduleName','remoteUri',_0x33f4('0x66'),_0x33f4('0x67')]})['then'](handleEntityNotFound(_0x12ecbb,null))[_0x33f4('0x36')](function(_0x494937){if(_0x494937){_0x1a0090=_0x494937[_0x33f4('0x68')];_0x1b8358=_0x494937['accessKey'];_0x35785b=_0x494937['moduleName'];_0x2f9117=_0x494937[_0x33f4('0x69')];var _0x42a1cc=_0x2f9117['slice'](-0x1);if(_0x42a1cc==='/'){_0x2f9117=_0x2f9117['substring'](0x0,_0x2f9117[_0x33f4('0x6a')](_0x42a1cc));}_0x476c5f=util[_0x33f4('0x6b')](_0x33f4('0x6c'),_0x2f9117);var _0x2a4f73={'method':_0x33f4('0x6d'),'uri':_0x476c5f,'qs':{'operation':_0x33f4('0x6e'),'username':_0x494937[_0x33f4('0x68')]},'json':!![]};return rp(_0x2a4f73);}})[_0x33f4('0x36')](function(_0xbe1724){if(_0xbe1724['success']){var _0x276bdd={'method':_0x33f4('0x6f'),'uri':_0x476c5f,'form':{'operation':'login','username':_0x1a0090,'accessKey':md5(_0xbe1724[_0x33f4('0x70')][_0x33f4('0x71')]+_0x1b8358)},'json':!![]};return rp(_0x276bdd);}})[_0x33f4('0x36')](function(_0x39380e){if(_0x39380e['success']){var _0x1e9c29={'method':_0x33f4('0x6d'),'uri':_0x476c5f,'qs':{'operation':'describe','username':_0x1a0090,'sessionName':_0x39380e[_0x33f4('0x70')][_0x33f4('0x72')],'elementType':_0x35785b},'json':!![]};return rp(_0x1e9c29);}})[_0x33f4('0x36')](function(_0x4b1ff7){if(_0x4b1ff7[_0x33f4('0x73')]){var _0x3b5fe2=[_0x33f4('0x74'),_0x33f4('0x75'),_0x33f4('0x76')];_[_0x33f4('0x77')](_0x4b1ff7['result']['fields'],function(_0x359e3c){return _0x3b5fe2['includes'](_0x359e3c[_0x33f4('0x3c')]['name']);});_[_0x33f4('0x77')](_0x4b1ff7[_0x33f4('0x70')][_0x33f4('0x41')],function(_0xdf466b){return _0xdf466b[_0x33f4('0x78')]===_0x33f4('0x79');});return{'count':_0x4b1ff7[_0x33f4('0x70')][_0x33f4('0x41')]['length'],'rows':_['map'](_0x4b1ff7[_0x33f4('0x70')][_0x33f4('0x41')],function(_0x579e9c){return{'id':_0x579e9c[_0x33f4('0x39')],'name':_0x579e9c[_0x33f4('0x7a')],'custom':_['startsWith'](_0x579e9c['name'],_0x33f4('0x7b'))?!![]:![],'options':_0x579e9c[_0x33f4('0x3c')][_0x33f4('0x39')]===_0x33f4('0x7c')&&_0x579e9c[_0x33f4('0x3c')]['picklistValues'][_0x33f4('0x43')]>0x0?_[_0x33f4('0x7d')](_0x579e9c[_0x33f4('0x3c')][_0x33f4('0x7e')],function(_0x236b54){return{'name':_0x236b54['label'],'value':_0x236b54[_0x33f4('0x7f')]};}):[]};})};}})[_0x33f4('0x36')](respondWithResult(_0x12ecbb,null))[_0x33f4('0x2a')](function(_0xe30032){console[_0x33f4('0x80')](_0x33f4('0x81')+_0xe30032);var _0x28a85a=_0x501230[_0x33f4('0x42')][_0x33f4('0x1d')]?0x1f4:_0xe30032[_0x33f4('0x82')]||0x1f4;logger[_0x33f4('0x27')](_0x33f4('0x83'),_0x33f4('0x64'),_0x28a85a,JSON[_0x33f4('0x26')](_0xe30032));delete _0xe30032[_0x33f4('0x39')];if(_0x28a85a===0x191){_0x28a85a=0x190;}_0x12ecbb[_0x33f4('0x2b')](_0x28a85a)[_0x33f4('0x84')](_0x501230[_0x33f4('0x42')][_0x33f4('0x1d')]?{'message':_0x33f4('0x85'),'statusCode':_0xe30032[_0x33f4('0x82')]}:_0xe30032);});}; \ No newline at end of file +var _0x66d4=['../../mysqldb','../../components/integrations/configuration','jayson/promise','client','http','test','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','info','VtigerAccount,\x20%s,\x20%s','request\x20sent','VtigerAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','status','offset','limit','set','Content-Range','apply','reject','save','destroy','sendStatus','name','send','index','map','VtigerAccount','type','key','model','query','keys','filters','intersection','attributes','fields','length','sort','where','pick','filter','merge','VIRTUAL','options','count','findAll','rows','show','params','create','body','update','find','getConfigurations','rawAttributes','order','addConfiguration','findOne','AccountId','Subjects','channel','Descriptions','getDescriptions','VtigerConfiguration','md5','getFields','username','description','remoteUri','serverUrl','accessKey','moduleName','slice','substring','format','%s/webservice.php','getchallenge','login','success','describe','sessionName','reference','owner','includes','picklist','picklistValues','label','value','statusCode','getFields,\x20%s,\x20%s,\x20%s','rimraf','request-promise','moment','mustache','path','to-csv','lodash','squel','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment'];(function(_0xc0c398,_0x2175df){var _0x3ed77c=function(_0x570628){while(--_0x570628){_0xc0c398['push'](_0xc0c398['shift']());}};_0x3ed77c(++_0x2175df);}(_0x66d4,0xd5));var _0x466d=function(_0x209ec9,_0x30378c){_0x209ec9=_0x209ec9-0x0;var _0x129b1b=_0x66d4[_0x209ec9];return _0x129b1b;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0x466d('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x466d('0x1'));var moment=require(_0x466d('0x2'));var BPromise=require('bluebird');var Mustache=require(_0x466d('0x3'));var util=require('util');var path=require(_0x466d('0x4'));var sox=require('sox');var csv=require(_0x466d('0x5'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x466d('0x6'));var squel=require(_0x466d('0x7'));var crypto=require(_0x466d('0x8'));var jsforce=require(_0x466d('0x9'));var deskjs=require(_0x466d('0xa'));var toCsv=require(_0x466d('0x5'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x466d('0xb'));var authService=require(_0x466d('0xc'));var qs=require('../../components/parsers/qs');var as=require(_0x466d('0xd'));var hardwareService=require(_0x466d('0xe'));var logger=require(_0x466d('0xf'))('api');var utils=require('../../config/utils');var config=require(_0x466d('0x10'));var db=require(_0x466d('0x11'))['db'];var integrations=require(_0x466d('0x12'));var jayson=require(_0x466d('0x13'));var client=jayson[_0x466d('0x14')][_0x466d('0x15')]({'port':0x232a});function checkPasswordPattern(_0x2c3c3f,_0x5c7c86,_0x3c08a9){if(_0x3c08a9){var _0x2ba1f0=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x2ba1f0[_0x466d('0x16')](_0x5c7c86)){return _0x2c3c3f;}else{throw new db['Sequelize'][(_0x466d('0x17'))](_0x466d('0x18'));}}else{return _0x2c3c3f;}}function respondWithRpcPromise(_0x4a6c5a,_0x5bbf2f,_0x3b9e4b,_0x1305c6){return new BPromise(function(_0xcc40f4,_0x3ce831){var _0x2e1971=_0x1305c6||client;return _0x2e1971[_0x466d('0x19')](_0x4a6c5a,_0x3b9e4b)[_0x466d('0x1a')](function(_0x3bcdb0){logger[_0x466d('0x1b')](_0x466d('0x1c'),_0x5bbf2f,_0x466d('0x1d'));logger['debug'](_0x466d('0x1e'),_0x5bbf2f,'request\x20sent',JSON[_0x466d('0x1f')](_0x3bcdb0));if(_0x3bcdb0[_0x466d('0x20')]){if(_0x3bcdb0[_0x466d('0x20')][_0x466d('0x21')]===0x1f4){logger[_0x466d('0x20')](_0x466d('0x1c'),_0x5bbf2f,_0x3bcdb0[_0x466d('0x20')][_0x466d('0x22')]);return _0x3ce831(_0x3bcdb0[_0x466d('0x20')][_0x466d('0x22')]);}logger[_0x466d('0x20')](_0x466d('0x1c'),_0x5bbf2f,_0x3bcdb0[_0x466d('0x20')][_0x466d('0x22')]);return _0xcc40f4(_0x3bcdb0[_0x466d('0x20')][_0x466d('0x22')]);}else{logger[_0x466d('0x1b')]('VtigerAccount,\x20%s,\x20%s',_0x5bbf2f,_0x466d('0x1d'));_0xcc40f4(_0x3bcdb0[_0x466d('0x23')][_0x466d('0x22')]);}})[_0x466d('0x24')](function(_0x2bb8e0){logger[_0x466d('0x20')](_0x466d('0x1c'),_0x5bbf2f,_0x2bb8e0);_0x3ce831(_0x2bb8e0);});});}function respondWithStatusCode(_0x1f20fc,_0x24a9a8){_0x24a9a8=_0x24a9a8||0xcc;return function(_0x5d2437){if(_0x5d2437){return _0x1f20fc['sendStatus'](_0x24a9a8);}return _0x1f20fc['status'](_0x24a9a8)['end']();};}function respondWithResult(_0x2a95c1,_0x58f201){_0x58f201=_0x58f201||0xc8;return function(_0x300041){if(_0x300041){return _0x2a95c1[_0x466d('0x25')](_0x58f201)['json'](_0x300041);}};}function respondWithFilteredResult(_0xe9518b,_0x1a6aab){return function(_0x435fb8){if(_0x435fb8){var _0x5c7489=_0x435fb8['count'],_0x2934be=_0x1a6aab[_0x466d('0x26')],_0x49e3fa=_0x1a6aab[_0x466d('0x26')]+_0x1a6aab[_0x466d('0x27')],_0x4e0540;if(_0x49e3fa>=_0x5c7489){_0x49e3fa=_0x5c7489;_0x4e0540=0xc8;}else{_0x4e0540=0xce;}_0xe9518b[_0x466d('0x25')](_0x4e0540);return _0xe9518b[_0x466d('0x28')](_0x466d('0x29'),_0x2934be+'-'+_0x49e3fa+'/'+_0x5c7489)['json'](_0x435fb8);}return null;};}function patchUpdates(_0x59e1e5){return function(_0x237b0c){try{jsonpatch[_0x466d('0x2a')](_0x237b0c,_0x59e1e5,!![]);}catch(_0x5d430b){return BPromise[_0x466d('0x2b')](_0x5d430b);}return _0x237b0c[_0x466d('0x2c')]();};}function saveUpdates(_0x25cca9,_0x235b13){return function(_0x20fe84){if(_0x20fe84){return _0x20fe84['update'](_0x25cca9)[_0x466d('0x1a')](function(_0x511116){return _0x511116;});}return null;};}function removeEntity(_0xd8a22e,_0x39d57a){return function(_0x136bba){if(_0x136bba){return _0x136bba[_0x466d('0x2d')]()[_0x466d('0x1a')](function(){_0xd8a22e[_0x466d('0x25')](0xcc)['end']();});}};}function handleEntityNotFound(_0xf8a746,_0x1066f7){return function(_0x7a2e90){if(!_0x7a2e90){_0xf8a746[_0x466d('0x2e')](0x194);}return _0x7a2e90;};}function handleError(_0x531fb4,_0x216189){_0x216189=_0x216189||0x1f4;return function(_0x4071b9){logger['error'](_0x4071b9['stack']);if(_0x4071b9[_0x466d('0x2f')]){delete _0x4071b9[_0x466d('0x2f')];}_0x531fb4[_0x466d('0x25')](_0x216189)[_0x466d('0x30')](_0x4071b9);};}exports[_0x466d('0x31')]=function(_0x542945,_0x54ede){var _0x1cf9db={},_0x58fa9e={},_0x53ff91={'count':0x0,'rows':[]};var _0x596e70=_[_0x466d('0x32')](db[_0x466d('0x33')]['rawAttributes'],function(_0x3d34c5){return{'name':_0x3d34c5['fieldName'],'type':_0x3d34c5[_0x466d('0x34')][_0x466d('0x35')]};});_0x58fa9e[_0x466d('0x36')]=_[_0x466d('0x32')](_0x596e70,'name');_0x58fa9e[_0x466d('0x37')]=_[_0x466d('0x38')](_0x542945[_0x466d('0x37')]);_0x58fa9e[_0x466d('0x39')]=_[_0x466d('0x3a')](_0x58fa9e[_0x466d('0x36')],_0x58fa9e[_0x466d('0x37')]);_0x1cf9db[_0x466d('0x3b')]=_['intersection'](_0x58fa9e['model'],qs[_0x466d('0x3c')](_0x542945[_0x466d('0x37')]['fields']));_0x1cf9db['attributes']=_0x1cf9db[_0x466d('0x3b')][_0x466d('0x3d')]?_0x1cf9db[_0x466d('0x3b')]:_0x58fa9e['model'];if(!_0x542945['query']['hasOwnProperty']('nolimit')){_0x1cf9db['limit']=qs['limit'](_0x542945[_0x466d('0x37')]['limit']);_0x1cf9db[_0x466d('0x26')]=qs['offset'](_0x542945[_0x466d('0x37')]['offset']);}_0x1cf9db['order']=qs['sort'](_0x542945['query'][_0x466d('0x3e')]);_0x1cf9db[_0x466d('0x3f')]=qs[_0x466d('0x39')](_[_0x466d('0x40')](_0x542945['query'],_0x58fa9e['filters']),_0x596e70);if(_0x542945[_0x466d('0x37')][_0x466d('0x41')]){_0x1cf9db['where']=_[_0x466d('0x42')](_0x1cf9db[_0x466d('0x3f')],{'$or':_[_0x466d('0x32')](_0x596e70,function(_0x26d7de){if(_0x26d7de[_0x466d('0x34')]!==_0x466d('0x43')){var _0x2607e0={};_0x2607e0[_0x26d7de[_0x466d('0x2f')]]={'$like':'%'+_0x542945[_0x466d('0x37')][_0x466d('0x41')]+'%'};return _0x2607e0;}})});}_0x1cf9db=_[_0x466d('0x42')]({},_0x1cf9db,_0x542945[_0x466d('0x44')]);var _0x6b0b4f={'where':_0x1cf9db['where']};return db['VtigerAccount'][_0x466d('0x45')](_0x6b0b4f)[_0x466d('0x1a')](function(_0xc87bdd){_0x53ff91[_0x466d('0x45')]=_0xc87bdd;if(_0x542945[_0x466d('0x37')]['includeAll']){_0x1cf9db['include']=[{'all':!![]}];}return db[_0x466d('0x33')][_0x466d('0x46')](_0x1cf9db);})[_0x466d('0x1a')](function(_0x1e50a0){_0x53ff91[_0x466d('0x47')]=_0x1e50a0;return _0x53ff91;})[_0x466d('0x1a')](respondWithFilteredResult(_0x54ede,_0x1cf9db))['catch'](handleError(_0x54ede,null));};exports[_0x466d('0x48')]=function(_0x2ef420,_0x75b2ea){var _0x481961={'raw':![],'where':{'id':_0x2ef420[_0x466d('0x49')]['id']}},_0x20d897={};_0x20d897[_0x466d('0x36')]=_['keys'](db[_0x466d('0x33')]['rawAttributes']);_0x20d897[_0x466d('0x37')]=_[_0x466d('0x38')](_0x2ef420[_0x466d('0x37')]);_0x20d897[_0x466d('0x39')]=_[_0x466d('0x3a')](_0x20d897[_0x466d('0x36')],_0x20d897[_0x466d('0x37')]);_0x481961[_0x466d('0x3b')]=_[_0x466d('0x3a')](_0x20d897[_0x466d('0x36')],qs[_0x466d('0x3c')](_0x2ef420[_0x466d('0x37')][_0x466d('0x3c')]));_0x481961[_0x466d('0x3b')]=_0x481961[_0x466d('0x3b')]['length']?_0x481961[_0x466d('0x3b')]:_0x20d897[_0x466d('0x36')];if(_0x2ef420[_0x466d('0x37')]['includeAll']){_0x481961['include']=[{'all':!![]}];}_0x481961=_['merge']({},_0x481961,_0x2ef420[_0x466d('0x44')]);return db[_0x466d('0x33')]['find'](_0x481961)[_0x466d('0x1a')](handleEntityNotFound(_0x75b2ea,null))[_0x466d('0x1a')](respondWithResult(_0x75b2ea,null))[_0x466d('0x24')](handleError(_0x75b2ea,null));};exports[_0x466d('0x4a')]=function(_0x141111,_0x145f08){return db[_0x466d('0x33')][_0x466d('0x4a')](_0x141111[_0x466d('0x4b')],{})['then'](respondWithResult(_0x145f08,0xc9))[_0x466d('0x24')](handleError(_0x145f08,null));};exports[_0x466d('0x4c')]=function(_0x4d3a48,_0x224f54){if(_0x4d3a48[_0x466d('0x4b')]['id']){delete _0x4d3a48[_0x466d('0x4b')]['id'];}return db[_0x466d('0x33')][_0x466d('0x4d')]({'where':{'id':_0x4d3a48[_0x466d('0x49')]['id']}})[_0x466d('0x1a')](handleEntityNotFound(_0x224f54,null))[_0x466d('0x1a')](saveUpdates(_0x4d3a48[_0x466d('0x4b')],null))[_0x466d('0x1a')](respondWithResult(_0x224f54,null))['catch'](handleError(_0x224f54,null));};exports['destroy']=function(_0x1091c9,_0x1ff354){return db['VtigerAccount']['find']({'where':{'id':_0x1091c9[_0x466d('0x49')]['id']}})[_0x466d('0x1a')](handleEntityNotFound(_0x1ff354,null))[_0x466d('0x1a')](removeEntity(_0x1ff354,null))['catch'](handleError(_0x1ff354,null));};exports[_0x466d('0x4e')]=function(_0x4e6c17,_0x4b2482,_0x527598){var _0x468fb1={};var _0x14b752={};var _0x5151f5;var _0x579705;return db[_0x466d('0x33')]['findOne']({'where':{'id':_0x4e6c17['params']['id']}})['then'](handleEntityNotFound(_0x4b2482,null))[_0x466d('0x1a')](function(_0x453982){if(_0x453982){_0x5151f5=_0x453982;_0x14b752['model']=_['keys'](db['VtigerConfiguration'][_0x466d('0x4f')]);_0x14b752['query']=_[_0x466d('0x38')](_0x4e6c17[_0x466d('0x37')]);_0x14b752[_0x466d('0x39')]=_[_0x466d('0x3a')](_0x14b752[_0x466d('0x36')],_0x14b752['query']);_0x468fb1[_0x466d('0x3b')]=_['intersection'](_0x14b752[_0x466d('0x36')],qs[_0x466d('0x3c')](_0x4e6c17[_0x466d('0x37')]['fields']));_0x468fb1[_0x466d('0x3b')]=_0x468fb1['attributes'][_0x466d('0x3d')]?_0x468fb1[_0x466d('0x3b')]:_0x14b752[_0x466d('0x36')];_0x468fb1[_0x466d('0x50')]=qs[_0x466d('0x3e')](_0x4e6c17['query'][_0x466d('0x3e')]);_0x468fb1[_0x466d('0x3f')]=qs['filters'](_['pick'](_0x4e6c17[_0x466d('0x37')],_0x14b752['filters']));if(_0x4e6c17[_0x466d('0x37')][_0x466d('0x41')]){_0x468fb1[_0x466d('0x3f')]=_[_0x466d('0x42')](_0x468fb1[_0x466d('0x3f')],{'$or':_[_0x466d('0x32')](_0x468fb1[_0x466d('0x3b')],function(_0x2d57a2){var _0x2c44c2={};_0x2c44c2[_0x2d57a2]={'$like':'%'+_0x4e6c17['query'][_0x466d('0x41')]+'%'};return _0x2c44c2;})});}_0x468fb1=_['merge']({},_0x468fb1,_0x4e6c17['options']);return _0x5151f5['getConfigurations'](_0x468fb1);}})['then'](function(_0x1db206){if(_0x1db206){_0x579705=_0x1db206[_0x466d('0x3d')];if(!_0x4e6c17['query']['hasOwnProperty']('nolimit')){_0x468fb1['limit']=qs[_0x466d('0x27')](_0x4e6c17[_0x466d('0x37')][_0x466d('0x27')]);_0x468fb1['offset']=qs[_0x466d('0x26')](_0x4e6c17[_0x466d('0x37')][_0x466d('0x26')]);}return _0x5151f5[_0x466d('0x4e')](_0x468fb1);}})['then'](function(_0x1879e4){if(_0x1879e4){return _0x1879e4?{'count':_0x579705,'rows':_0x1879e4}:null;}})[_0x466d('0x1a')](respondWithResult(_0x4b2482,null))[_0x466d('0x24')](handleError(_0x4b2482,null));};exports[_0x466d('0x51')]=function(_0x27f767,_0x384062,_0x117442){if(_0x27f767['body']['id']){delete _0x27f767['body']['id'];}return db[_0x466d('0x33')][_0x466d('0x52')]({'where':{'id':_0x27f767[_0x466d('0x49')]['id']}})[_0x466d('0x1a')](handleEntityNotFound(_0x384062,null))['then'](function(_0x1fd968){if(_0x1fd968){_0x27f767['body'][_0x466d('0x53')]=_0x1fd968['id'];_0x27f767['body'][_0x466d('0x54')]=integrations['getSubjects'](_0x27f767['body'][_0x466d('0x55')],_0x27f767['body'][_0x466d('0x34')]);_0x27f767[_0x466d('0x4b')][_0x466d('0x56')]=integrations[_0x466d('0x57')](_0x27f767[_0x466d('0x4b')][_0x466d('0x55')],_0x27f767[_0x466d('0x4b')][_0x466d('0x34')]);return db[_0x466d('0x58')][_0x466d('0x4a')](_0x27f767[_0x466d('0x4b')],{'include':[{'model':db['VtigerField'],'as':_0x466d('0x54')},{'model':db['VtigerField'],'as':'Descriptions'}]});}return null;})['then'](respondWithResult(_0x384062,null))[_0x466d('0x24')](handleError(_0x384062,null));};var md5=require(_0x466d('0x59'));exports[_0x466d('0x5a')]=function(_0x498b7a,_0x1f272f,_0x1fe8c4){var _0x5886c4=null;var _0x719891=null;var _0xefdfe9=null;var _0x61eb2=null;var _0x384d2e='';return db[_0x466d('0x33')][_0x466d('0x52')]({'where':{'id':_0x498b7a['params']['id']},'attributes':['id',_0x466d('0x2f'),_0x466d('0x5b'),_0x466d('0x5c'),'moduleName',_0x466d('0x5d'),_0x466d('0x5e'),_0x466d('0x5f')]})[_0x466d('0x1a')](handleEntityNotFound(_0x1f272f,null))[_0x466d('0x1a')](function(_0x2c844){if(_0x2c844){_0x5886c4=_0x2c844[_0x466d('0x5b')];_0x719891=_0x2c844[_0x466d('0x5f')];_0xefdfe9=_0x2c844[_0x466d('0x60')];_0x384d2e=_0x2c844['remoteUri'];var _0x9efbea=_0x384d2e[_0x466d('0x61')](-0x1);if(_0x9efbea==='/'){_0x384d2e=_0x384d2e[_0x466d('0x62')](0x0,_0x384d2e['lastIndexOf'](_0x9efbea));}_0x61eb2=util[_0x466d('0x63')](_0x466d('0x64'),_0x384d2e);var _0x484978={'method':'GET','uri':_0x61eb2,'qs':{'operation':_0x466d('0x65'),'username':_0x2c844[_0x466d('0x5b')]},'json':!![]};return rp(_0x484978);}})['then'](function(_0x138de1){if(_0x138de1['success']){var _0x15a696={'method':'POST','uri':_0x61eb2,'form':{'operation':_0x466d('0x66'),'username':_0x5886c4,'accessKey':md5(_0x138de1[_0x466d('0x23')]['token']+_0x719891)},'json':!![]};return rp(_0x15a696);}})['then'](function(_0x189653){if(_0x189653[_0x466d('0x67')]){var _0xfd32e7={'method':'GET','uri':_0x61eb2,'qs':{'operation':_0x466d('0x68'),'username':_0x5886c4,'sessionName':_0x189653[_0x466d('0x23')][_0x466d('0x69')],'elementType':_0xefdfe9},'json':!![]};return rp(_0xfd32e7);}})[_0x466d('0x1a')](function(_0x73fc8){if(_0x73fc8['success']){var _0x2e1151=['autogenerated',_0x466d('0x6a'),_0x466d('0x6b')];_['remove'](_0x73fc8[_0x466d('0x23')][_0x466d('0x3c')],function(_0x3305c7){return _0x2e1151[_0x466d('0x6c')](_0x3305c7['type'][_0x466d('0x2f')]);});_['remove'](_0x73fc8[_0x466d('0x23')]['fields'],function(_0x24af72){return _0x24af72['editable']==='false';});return{'count':_0x73fc8[_0x466d('0x23')][_0x466d('0x3c')][_0x466d('0x3d')],'rows':_[_0x466d('0x32')](_0x73fc8[_0x466d('0x23')][_0x466d('0x3c')],function(_0x544e8a){return{'id':_0x544e8a[_0x466d('0x2f')],'name':_0x544e8a['label'],'custom':_['startsWith'](_0x544e8a['name'],'cf_')?!![]:![],'options':_0x544e8a['type'][_0x466d('0x2f')]===_0x466d('0x6d')&&_0x544e8a['type'][_0x466d('0x6e')][_0x466d('0x3d')]>0x0?_[_0x466d('0x32')](_0x544e8a[_0x466d('0x34')][_0x466d('0x6e')],function(_0x483e43){return{'name':_0x483e43[_0x466d('0x6f')],'value':_0x483e43[_0x466d('0x70')]};}):[]};})};}})[_0x466d('0x1a')](respondWithResult(_0x1f272f,null))[_0x466d('0x24')](function(_0x4eb86a){console['log']('vTiger\x20error:\x20'+_0x4eb86a);var _0x35d28f=_0x498b7a[_0x466d('0x37')]['test']?0x1f4:_0x4eb86a[_0x466d('0x71')]||0x1f4;logger[_0x466d('0x20')](_0x466d('0x72'),_0x466d('0x5a'),_0x35d28f,JSON['stringify'](_0x4eb86a));delete _0x4eb86a[_0x466d('0x2f')];if(_0x35d28f===0x191){_0x35d28f=0x190;}_0x1f272f['status'](_0x35d28f)[_0x466d('0x30')](_0x498b7a[_0x466d('0x37')]['test']?{'message':'Wrong\x20credentials','statusCode':_0x4eb86a['statusCode']}:_0x4eb86a);});}; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.model.js b/server/api/intVtigerAccount/intVtigerAccount.model.js index 4876bde..af833f4 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 _0x21a2=['rimraf','../../config/environment','./intVtigerAccount.attributes','../../components/integrations/configuration','exports','define','VtigerAccount','int_vtiger_accounts','lodash','util','api','moment','bluebird','request-promise','path'];(function(_0x15b7a0,_0x5c6b96){var _0x3da336=function(_0x4af0c7){while(--_0x4af0c7){_0x15b7a0['push'](_0x15b7a0['shift']());}};_0x3da336(++_0x5c6b96);}(_0x21a2,0xf8));var _0x221a=function(_0x3ab9ee,_0x4a74b8){_0x3ab9ee=_0x3ab9ee-0x0;var _0x82ee88=_0x21a2[_0x3ab9ee];return _0x82ee88;};'use strict';var _=require(_0x221a('0x0'));var util=require(_0x221a('0x1'));var logger=require('../../config/logger')(_0x221a('0x2'));var moment=require(_0x221a('0x3'));var BPromise=require(_0x221a('0x4'));var rp=require(_0x221a('0x5'));var fs=require('fs');var path=require(_0x221a('0x6'));var rimraf=require(_0x221a('0x7'));var config=require(_0x221a('0x8'));var attributes=require(_0x221a('0x9'));var integrations=require(_0x221a('0xa'));module[_0x221a('0xb')]=function(_0x127366,_0x2b4499){return _0x127366[_0x221a('0xc')](_0x221a('0xd'),attributes,{'tableName':_0x221a('0xe'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd1e7=['lodash','util','../../config/logger','api','moment','request-promise','rimraf','../../config/environment','./intVtigerAccount.attributes','../../components/integrations/configuration','exports','VtigerAccount'];(function(_0x569dc7,_0x32e487){var _0x2f7c48=function(_0x2e4d2d){while(--_0x2e4d2d){_0x569dc7['push'](_0x569dc7['shift']());}};_0x2f7c48(++_0x32e487);}(_0xd1e7,0x1d4));var _0x7d1e=function(_0x250fb1,_0x69bfe0){_0x250fb1=_0x250fb1-0x0;var _0x4e05d5=_0xd1e7[_0x250fb1];return _0x4e05d5;};'use strict';var _=require(_0x7d1e('0x0'));var util=require(_0x7d1e('0x1'));var logger=require(_0x7d1e('0x2'))(_0x7d1e('0x3'));var moment=require(_0x7d1e('0x4'));var BPromise=require('bluebird');var rp=require(_0x7d1e('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x7d1e('0x6'));var config=require(_0x7d1e('0x7'));var attributes=require(_0x7d1e('0x8'));var integrations=require(_0x7d1e('0x9'));module[_0x7d1e('0xa')]=function(_0x52cde9,_0x59a23a){return _0x52cde9['define'](_0x7d1e('0xb'),attributes,{'tableName':'int_vtiger_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.rpc.js b/server/api/intVtigerAccount/intVtigerAccount.rpc.js index 3fcb189..0b87104 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 _0x5c12=['moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','then','info','VtigerAccount,\x20%s,\x20%s','request\x20sent','debug','VtigerAccount,\x20%s,\x20%s,\x20%s','stringify','code','error','message','result','catch','GetVtigerAccount','findAll','options','attributes','map','include','model','ShowVtigerAccount','find','raw','where','lodash','util'];(function(_0x211632,_0x378e2e){var _0x5a1da1=function(_0x44aff2){while(--_0x44aff2){_0x211632['push'](_0x211632['shift']());}};_0x5a1da1(++_0x378e2e);}(_0x5c12,0x1a2));var _0x25c1=function(_0xe2c95e,_0x3e6545){_0xe2c95e=_0xe2c95e-0x0;var _0x42ce6f=_0x5c12[_0xe2c95e];return _0x42ce6f;};'use strict';var _=require(_0x25c1('0x0'));var util=require(_0x25c1('0x1'));var moment=require(_0x25c1('0x2'));var BPromise=require(_0x25c1('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x25c1('0x4'));var db=require(_0x25c1('0x5'))['db'];var utils=require(_0x25c1('0x6'));var logger=require(_0x25c1('0x7'))(_0x25c1('0x8'));var config=require(_0x25c1('0x9'));var jayson=require(_0x25c1('0xa'));var client=jayson['client'][_0x25c1('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3d7c4d,_0x2fe90c,_0x3c0f9c){return new BPromise(function(_0x4c7f09,_0xe6628d){return client['request'](_0x3d7c4d,_0x3c0f9c)[_0x25c1('0xc')](function(_0x4350f7){logger[_0x25c1('0xd')](_0x25c1('0xe'),_0x2fe90c,_0x25c1('0xf'));logger[_0x25c1('0x10')](_0x25c1('0x11'),_0x2fe90c,_0x25c1('0xf'),JSON[_0x25c1('0x12')](_0x4350f7));if(_0x4350f7['error']){if(_0x4350f7['error'][_0x25c1('0x13')]===0x1f4){logger[_0x25c1('0x14')]('VtigerAccount,\x20%s,\x20%s',_0x2fe90c,_0x4350f7['error'][_0x25c1('0x15')]);return _0xe6628d(_0x4350f7[_0x25c1('0x14')]['message']);}logger[_0x25c1('0x14')]('VtigerAccount,\x20%s,\x20%s',_0x2fe90c,_0x4350f7['error'][_0x25c1('0x15')]);return _0x4c7f09(_0x4350f7[_0x25c1('0x14')][_0x25c1('0x15')]);}else{logger[_0x25c1('0xd')](_0x25c1('0xe'),_0x2fe90c,_0x25c1('0xf'));_0x4c7f09(_0x4350f7[_0x25c1('0x16')][_0x25c1('0x15')]);}})[_0x25c1('0x17')](function(_0x488f8c){logger[_0x25c1('0x14')](_0x25c1('0xe'),_0x2fe90c,_0x488f8c);_0xe6628d(_0x488f8c);});});}exports[_0x25c1('0x18')]=function(_0x47e73e){var _0x112fb4=this;return new Promise(function(_0x553d7c,_0x28678d){return db['VtigerAccount'][_0x25c1('0x19')]({'raw':_0x47e73e['options']?_0x47e73e[_0x25c1('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x47e73e[_0x25c1('0x1a')]?_0x47e73e[_0x25c1('0x1a')]['where']||null:null,'attributes':_0x47e73e['options']?_0x47e73e[_0x25c1('0x1a')][_0x25c1('0x1b')]||null:null,'limit':_0x47e73e[_0x25c1('0x1a')]?_0x47e73e['options']['limit']||null:null,'include':_0x47e73e['options']?_0x47e73e[_0x25c1('0x1a')]['include']?_[_0x25c1('0x1c')](_0x47e73e[_0x25c1('0x1a')]['include'],function(_0x236a35){return{'model':db[_0x236a35['model']],'as':_0x236a35['as'],'attributes':_0x236a35['attributes'],'include':_0x236a35[_0x25c1('0x1d')]?_[_0x25c1('0x1c')](_0x236a35[_0x25c1('0x1d')],function(_0x1b12d7){return{'model':db[_0x1b12d7[_0x25c1('0x1e')]],'as':_0x1b12d7['as'],'attributes':_0x1b12d7[_0x25c1('0x1b')],'include':_0x1b12d7[_0x25c1('0x1d')]?_[_0x25c1('0x1c')](_0x1b12d7[_0x25c1('0x1d')],function(_0xce872d){return{'model':db[_0xce872d[_0x25c1('0x1e')]],'as':_0xce872d['as'],'attributes':_0xce872d[_0x25c1('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x25c1('0xc')](function(_0x3f9e02){logger[_0x25c1('0xd')](_0x25c1('0x18'),_0x47e73e);logger['debug'](_0x25c1('0x18'),_0x47e73e,JSON['stringify'](_0x3f9e02));_0x553d7c(_0x3f9e02);})[_0x25c1('0x17')](function(_0x2ad670){logger[_0x25c1('0x14')](_0x25c1('0x18'),_0x2ad670[_0x25c1('0x15')],_0x47e73e);_0x28678d(_0x112fb4['error'](0x1f4,_0x2ad670[_0x25c1('0x15')]));});});};exports[_0x25c1('0x1f')]=function(_0x315d3d){var _0x588fdb=this;return new Promise(function(_0x1243f7,_0x2983d3){return db['VtigerAccount'][_0x25c1('0x20')]({'raw':_0x315d3d[_0x25c1('0x1a')]?_0x315d3d[_0x25c1('0x1a')][_0x25c1('0x21')]===undefined?!![]:![]:!![],'where':_0x315d3d[_0x25c1('0x1a')]?_0x315d3d[_0x25c1('0x1a')][_0x25c1('0x22')]||null:null,'attributes':_0x315d3d[_0x25c1('0x1a')]?_0x315d3d['options'][_0x25c1('0x1b')]||null:null,'include':_0x315d3d[_0x25c1('0x1a')]?_0x315d3d[_0x25c1('0x1a')][_0x25c1('0x1d')]?_[_0x25c1('0x1c')](_0x315d3d[_0x25c1('0x1a')][_0x25c1('0x1d')],function(_0x6170ec){return{'model':db[_0x6170ec[_0x25c1('0x1e')]],'as':_0x6170ec['as'],'attributes':_0x6170ec['attributes'],'include':_0x6170ec['include']?_['map'](_0x6170ec[_0x25c1('0x1d')],function(_0xee426b){return{'model':db[_0xee426b[_0x25c1('0x1e')]],'as':_0xee426b['as'],'attributes':_0xee426b[_0x25c1('0x1b')],'include':_0xee426b['include']?_[_0x25c1('0x1c')](_0xee426b[_0x25c1('0x1d')],function(_0x4f5e6a){return{'model':db[_0x4f5e6a[_0x25c1('0x1e')]],'as':_0x4f5e6a['as'],'attributes':_0x4f5e6a[_0x25c1('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x4c5f50){logger[_0x25c1('0xd')](_0x25c1('0x1f'),_0x315d3d);logger[_0x25c1('0x10')](_0x25c1('0x1f'),_0x315d3d,JSON[_0x25c1('0x12')](_0x4c5f50));_0x1243f7(_0x4c5f50);})[_0x25c1('0x17')](function(_0x242afd){logger[_0x25c1('0x14')](_0x25c1('0x1f'),_0x242afd[_0x25c1('0x15')],_0x315d3d);_0x2983d3(_0x588fdb[_0x25c1('0x14')](0x1f4,_0x242afd['message']));});});}; \ No newline at end of file +var _0xfb7c=['map','attributes','model','ShowVtigerAccount','VtigerAccount','find','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','VtigerAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','catch','GetVtigerAccount','findAll','raw','options','where','limit','include'];(function(_0x492b8b,_0x47a69f){var _0x1b0bea=function(_0x5476e7){while(--_0x5476e7){_0x492b8b['push'](_0x492b8b['shift']());}};_0x1b0bea(++_0x47a69f);}(_0xfb7c,0x178));var _0xcfb7=function(_0x12a451,_0x4dfa3d){_0x12a451=_0x12a451-0x0;var _0x55c4fa=_0xfb7c[_0x12a451];return _0x55c4fa;};'use strict';var _=require(_0xcfb7('0x0'));var util=require(_0xcfb7('0x1'));var moment=require(_0xcfb7('0x2'));var BPromise=require(_0xcfb7('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xcfb7('0x4'));var db=require(_0xcfb7('0x5'))['db'];var utils=require(_0xcfb7('0x6'));var logger=require(_0xcfb7('0x7'))(_0xcfb7('0x8'));var config=require(_0xcfb7('0x9'));var jayson=require(_0xcfb7('0xa'));var client=jayson[_0xcfb7('0xb')][_0xcfb7('0xc')]({'port':0x232a});function respondWithRpcPromise(_0xe4463a,_0xa8a7e5,_0xac314b){return new BPromise(function(_0x3b9d94,_0x4c8fbd){return client[_0xcfb7('0xd')](_0xe4463a,_0xac314b)[_0xcfb7('0xe')](function(_0x1ae21e){logger[_0xcfb7('0xf')](_0xcfb7('0x10'),_0xa8a7e5,_0xcfb7('0x11'));logger[_0xcfb7('0x12')]('VtigerAccount,\x20%s,\x20%s,\x20%s',_0xa8a7e5,_0xcfb7('0x11'),JSON[_0xcfb7('0x13')](_0x1ae21e));if(_0x1ae21e[_0xcfb7('0x14')]){if(_0x1ae21e['error']['code']===0x1f4){logger[_0xcfb7('0x14')](_0xcfb7('0x10'),_0xa8a7e5,_0x1ae21e[_0xcfb7('0x14')][_0xcfb7('0x15')]);return _0x4c8fbd(_0x1ae21e[_0xcfb7('0x14')][_0xcfb7('0x15')]);}logger[_0xcfb7('0x14')]('VtigerAccount,\x20%s,\x20%s',_0xa8a7e5,_0x1ae21e['error'][_0xcfb7('0x15')]);return _0x3b9d94(_0x1ae21e[_0xcfb7('0x14')]['message']);}else{logger[_0xcfb7('0xf')](_0xcfb7('0x10'),_0xa8a7e5,'request\x20sent');_0x3b9d94(_0x1ae21e[_0xcfb7('0x16')][_0xcfb7('0x15')]);}})[_0xcfb7('0x17')](function(_0x54a2e6){logger['error']('VtigerAccount,\x20%s,\x20%s',_0xa8a7e5,_0x54a2e6);_0x4c8fbd(_0x54a2e6);});});}exports[_0xcfb7('0x18')]=function(_0x49b458){var _0xbbc516=this;return new Promise(function(_0x4ca167,_0x21b308){return db['VtigerAccount'][_0xcfb7('0x19')]({'raw':_0x49b458['options']?_0x49b458['options'][_0xcfb7('0x1a')]===undefined?!![]:![]:!![],'where':_0x49b458['options']?_0x49b458[_0xcfb7('0x1b')][_0xcfb7('0x1c')]||null:null,'attributes':_0x49b458[_0xcfb7('0x1b')]?_0x49b458[_0xcfb7('0x1b')]['attributes']||null:null,'limit':_0x49b458['options']?_0x49b458[_0xcfb7('0x1b')][_0xcfb7('0x1d')]||null:null,'include':_0x49b458[_0xcfb7('0x1b')]?_0x49b458['options'][_0xcfb7('0x1e')]?_[_0xcfb7('0x1f')](_0x49b458[_0xcfb7('0x1b')][_0xcfb7('0x1e')],function(_0x2b13f4){return{'model':db[_0x2b13f4['model']],'as':_0x2b13f4['as'],'attributes':_0x2b13f4[_0xcfb7('0x20')],'include':_0x2b13f4[_0xcfb7('0x1e')]?_[_0xcfb7('0x1f')](_0x2b13f4[_0xcfb7('0x1e')],function(_0x142b30){return{'model':db[_0x142b30[_0xcfb7('0x21')]],'as':_0x142b30['as'],'attributes':_0x142b30[_0xcfb7('0x20')],'include':_0x142b30[_0xcfb7('0x1e')]?_[_0xcfb7('0x1f')](_0x142b30[_0xcfb7('0x1e')],function(_0x53cfa7){return{'model':db[_0x53cfa7[_0xcfb7('0x21')]],'as':_0x53cfa7['as'],'attributes':_0x53cfa7[_0xcfb7('0x20')]};}):[]};}):[]};}):[]:[]})[_0xcfb7('0xe')](function(_0x54b9b1){logger[_0xcfb7('0xf')](_0xcfb7('0x18'),_0x49b458);logger[_0xcfb7('0x12')](_0xcfb7('0x18'),_0x49b458,JSON[_0xcfb7('0x13')](_0x54b9b1));_0x4ca167(_0x54b9b1);})[_0xcfb7('0x17')](function(_0x381c43){logger[_0xcfb7('0x14')](_0xcfb7('0x18'),_0x381c43['message'],_0x49b458);_0x21b308(_0xbbc516[_0xcfb7('0x14')](0x1f4,_0x381c43[_0xcfb7('0x15')]));});});};exports[_0xcfb7('0x22')]=function(_0x32d39b){var _0xeb360e=this;return new Promise(function(_0x40495c,_0x1caacd){return db[_0xcfb7('0x23')][_0xcfb7('0x24')]({'raw':_0x32d39b[_0xcfb7('0x1b')]?_0x32d39b['options'][_0xcfb7('0x1a')]===undefined?!![]:![]:!![],'where':_0x32d39b['options']?_0x32d39b[_0xcfb7('0x1b')]['where']||null:null,'attributes':_0x32d39b[_0xcfb7('0x1b')]?_0x32d39b[_0xcfb7('0x1b')][_0xcfb7('0x20')]||null:null,'include':_0x32d39b[_0xcfb7('0x1b')]?_0x32d39b['options'][_0xcfb7('0x1e')]?_[_0xcfb7('0x1f')](_0x32d39b[_0xcfb7('0x1b')]['include'],function(_0x40aeaa){return{'model':db[_0x40aeaa[_0xcfb7('0x21')]],'as':_0x40aeaa['as'],'attributes':_0x40aeaa[_0xcfb7('0x20')],'include':_0x40aeaa[_0xcfb7('0x1e')]?_[_0xcfb7('0x1f')](_0x40aeaa[_0xcfb7('0x1e')],function(_0x369f83){return{'model':db[_0x369f83[_0xcfb7('0x21')]],'as':_0x369f83['as'],'attributes':_0x369f83['attributes'],'include':_0x369f83[_0xcfb7('0x1e')]?_[_0xcfb7('0x1f')](_0x369f83['include'],function(_0x1dee1a){return{'model':db[_0x1dee1a[_0xcfb7('0x21')]],'as':_0x1dee1a['as'],'attributes':_0x1dee1a[_0xcfb7('0x20')]};}):[]};}):[]};}):[]:[]})[_0xcfb7('0xe')](function(_0x2f210d){logger[_0xcfb7('0xf')](_0xcfb7('0x22'),_0x32d39b);logger['debug'](_0xcfb7('0x22'),_0x32d39b,JSON[_0xcfb7('0x13')](_0x2f210d));_0x40495c(_0x2f210d);})[_0xcfb7('0x17')](function(_0x32a539){logger[_0xcfb7('0x14')](_0xcfb7('0x22'),_0x32a539[_0xcfb7('0x15')],_0x32d39b);_0x1caacd(_0xeb360e[_0xcfb7('0x14')](0x1f4,_0x32a539[_0xcfb7('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/index.js b/server/api/intVtigerConfiguration/index.js index 78dddf0..68ec766 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(_0xbeda41,_0x26ba7c){var _0x3637b8=function(_0x2ae016){while(--_0x2ae016){_0xbeda41['push'](_0xbeda41['shift']());}};_0x3637b8(++_0x26ba7c);}(_0xb10b,0x12a));var _0xbb10=function(_0x446e61,_0x27e680){_0x446e61=_0x446e61-0x0;var _0x4160a8=_0xb10b[_0x446e61];return _0x4160a8;};'use strict';var multer=require(_0xbb10('0x0'));var util=require('util');var path=require(_0xbb10('0x1'));var timeout=require(_0xbb10('0x2'));var express=require(_0xbb10('0x3'));var router=express['Router']();var auth=require(_0xbb10('0x4'));var interaction=require(_0xbb10('0x5'));var config=require(_0xbb10('0x6'));var controller=require(_0xbb10('0x7'));router[_0xbb10('0x8')]('/',auth[_0xbb10('0x9')](),controller['index']);router[_0xbb10('0x8')](_0xbb10('0xa'),auth['isAuthenticated'](),controller[_0xbb10('0xb')]);router[_0xbb10('0x8')](_0xbb10('0xc'),auth[_0xbb10('0x9')](),controller[_0xbb10('0xd')]);router[_0xbb10('0x8')](_0xbb10('0xe'),auth[_0xbb10('0x9')](),controller['getSubjects']);router['get'](_0xbb10('0xf'),auth[_0xbb10('0x9')](),controller[_0xbb10('0x10')]);router['post']('/',auth[_0xbb10('0x9')](),controller['create']);router[_0xbb10('0x11')](_0xbb10('0xa'),auth[_0xbb10('0x9')](),controller[_0xbb10('0x12')]);router[_0xbb10('0x13')](_0xbb10('0xa'),auth['isAuthenticated'](),controller[_0xbb10('0x14')]);module[_0xbb10('0x15')]=router; \ No newline at end of file +var _0xb10b=['/:id','show','/:id/fields','getFields','/:id/subjects','/:id/descriptions','getDescriptions','put','update','delete','destroy','exports','multer','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./intVtigerConfiguration.controller','get','isAuthenticated'];(function(_0x2a3ba0,_0x292f24){var _0x38846e=function(_0x3affec){while(--_0x3affec){_0x2a3ba0['push'](_0x2a3ba0['shift']());}};_0x38846e(++_0x292f24);}(_0xb10b,0x12a));var _0xbb10=function(_0x3f670b,_0x10f414){_0x3f670b=_0x3f670b-0x0;var _0x1c0978=_0xb10b[_0x3f670b];return _0x1c0978;};'use strict';var multer=require(_0xbb10('0x0'));var util=require('util');var path=require(_0xbb10('0x1'));var timeout=require(_0xbb10('0x2'));var express=require(_0xbb10('0x3'));var router=express['Router']();var auth=require(_0xbb10('0x4'));var interaction=require(_0xbb10('0x5'));var config=require(_0xbb10('0x6'));var controller=require(_0xbb10('0x7'));router[_0xbb10('0x8')]('/',auth[_0xbb10('0x9')](),controller['index']);router[_0xbb10('0x8')](_0xbb10('0xa'),auth['isAuthenticated'](),controller[_0xbb10('0xb')]);router[_0xbb10('0x8')](_0xbb10('0xc'),auth[_0xbb10('0x9')](),controller[_0xbb10('0xd')]);router[_0xbb10('0x8')](_0xbb10('0xe'),auth[_0xbb10('0x9')](),controller['getSubjects']);router['get'](_0xbb10('0xf'),auth[_0xbb10('0x9')](),controller[_0xbb10('0x10')]);router['post']('/',auth[_0xbb10('0x9')](),controller['create']);router[_0xbb10('0x11')](_0xbb10('0xa'),auth[_0xbb10('0x9')](),controller[_0xbb10('0x12')]);router[_0xbb10('0x13')](_0xbb10('0xa'),auth['isAuthenticated'](),controller[_0xbb10('0x14')]);module[_0xbb10('0x15')]=router; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.attributes.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.attributes.js index 34cffdf..e933ab0 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 _0x8af6=['exports','STRING'];(function(_0x220dbb,_0x99328d){var _0x2b77de=function(_0x15e966){while(--_0x15e966){_0x220dbb['push'](_0x220dbb['shift']());}};_0x2b77de(++_0x99328d);}(_0x8af6,0xd6));var _0x68af=function(_0x19bff3,_0x173d8c){_0x19bff3=_0x19bff3-0x0;var _0x473b1c=_0x8af6[_0x19bff3];return _0x473b1c;};'use strict';var Sequelize=require('sequelize');module[_0x68af('0x0')]={'name':{'type':Sequelize[_0x68af('0x1')]},'description':{'type':Sequelize[_0x68af('0x1')]}}; \ No newline at end of file +var _0x4c0e=['sequelize','exports'];(function(_0x426465,_0x434114){var _0x16e021=function(_0x21399f){while(--_0x21399f){_0x426465['push'](_0x426465['shift']());}};_0x16e021(++_0x434114);}(_0x4c0e,0x134));var _0xe4c0=function(_0x214d54,_0x133c72){_0x214d54=_0x214d54-0x0;var _0x44ca46=_0x4c0e[_0x214d54];return _0x44ca46;};'use strict';var Sequelize=require(_0xe4c0('0x0'));module[_0xe4c0('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.controller.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.controller.js index c1ed83f..4dba15f 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 _0xb945=['findOne','VtigerField','order','getSubjects','pick','getDescriptions','html-pdf','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../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~!@#$%^&-_=+[{]}.','VtigerConfiguration,\x20%s,\x20%s','debug','VtigerConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','catch','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','stack','name','send','index','map','VtigerConfiguration','rawAttributes','type','model','query','keys','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','filters','filter','where','merge','VIRTUAL','options','include','findAll','rows','show','params','includeAll','find','create','body','destroy','getFields'];(function(_0x2cdebe,_0x476f93){var _0x33a6ec=function(_0x3273d7){while(--_0x3273d7){_0x2cdebe['push'](_0x2cdebe['shift']());}};_0x33a6ec(++_0x476f93);}(_0xb945,0x120));var _0x5b94=function(_0x503c5c,_0x38e24d){_0x503c5c=_0x503c5c-0x0;var _0x894667=_0xb945[_0x503c5c];return _0x894667;};'use strict';var pdf=require(_0x5b94('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x5b94('0x1'));var zipdir=require(_0x5b94('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x5b94('0x3'));var moment=require(_0x5b94('0x4'));var BPromise=require(_0x5b94('0x5'));var Mustache=require(_0x5b94('0x6'));var util=require(_0x5b94('0x7'));var path=require(_0x5b94('0x8'));var sox=require('sox');var csv=require(_0x5b94('0x9'));var ejs=require(_0x5b94('0xa'));var fs=require('fs');var _=require(_0x5b94('0xb'));var squel=require(_0x5b94('0xc'));var crypto=require(_0x5b94('0xd'));var jsforce=require(_0x5b94('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x5b94('0x9'));var querystring=require(_0x5b94('0xf'));var Papa=require(_0x5b94('0x10'));var Redis=require(_0x5b94('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x5b94('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x5b94('0x13'));var logger=require(_0x5b94('0x14'))(_0x5b94('0x15'));var utils=require(_0x5b94('0x16'));var config=require('../../config/environment');var db=require(_0x5b94('0x17'))['db'];var jayson=require(_0x5b94('0x18'));var client=jayson[_0x5b94('0x19')][_0x5b94('0x1a')]({'port':0x232a});function checkPasswordPattern(_0x15b021,_0x1e1083,_0x54a9b0){if(_0x54a9b0){var _0x2babae=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x2babae[_0x5b94('0x1b')](_0x1e1083)){return _0x15b021;}else{throw new db[(_0x5b94('0x1c'))]['ValidationError'](_0x5b94('0x1d'));}}else{return _0x15b021;}}function respondWithRpcPromise(_0x6aae31,_0x39c47b,_0x387d16,_0x1f8589){return new BPromise(function(_0x4efecf,_0x46bfaa){var _0x126f6e=_0x1f8589||client;return _0x126f6e['request'](_0x6aae31,_0x387d16)['then'](function(_0x212d98){logger['info'](_0x5b94('0x1e'),_0x39c47b,'request\x20sent');logger[_0x5b94('0x1f')](_0x5b94('0x20'),_0x39c47b,'request\x20sent',JSON[_0x5b94('0x21')](_0x212d98));if(_0x212d98[_0x5b94('0x22')]){if(_0x212d98[_0x5b94('0x22')][_0x5b94('0x23')]===0x1f4){logger['error']('VtigerConfiguration,\x20%s,\x20%s',_0x39c47b,_0x212d98[_0x5b94('0x22')][_0x5b94('0x24')]);return _0x46bfaa(_0x212d98[_0x5b94('0x22')][_0x5b94('0x24')]);}logger[_0x5b94('0x22')]('VtigerConfiguration,\x20%s,\x20%s',_0x39c47b,_0x212d98[_0x5b94('0x22')][_0x5b94('0x24')]);return _0x4efecf(_0x212d98[_0x5b94('0x22')][_0x5b94('0x24')]);}else{logger['info'](_0x5b94('0x1e'),_0x39c47b,_0x5b94('0x25'));_0x4efecf(_0x212d98['result'][_0x5b94('0x24')]);}})[_0x5b94('0x26')](function(_0x2af526){logger[_0x5b94('0x22')](_0x5b94('0x1e'),_0x39c47b,_0x2af526);_0x46bfaa(_0x2af526);});});}function respondWithStatusCode(_0x1567d3,_0x20ee89){_0x20ee89=_0x20ee89||0xcc;return function(_0x168548){if(_0x168548){return _0x1567d3[_0x5b94('0x27')](_0x20ee89);}return _0x1567d3[_0x5b94('0x28')](_0x20ee89)[_0x5b94('0x29')]();};}function respondWithResult(_0x587075,_0x5d445a){_0x5d445a=_0x5d445a||0xc8;return function(_0xb8d786){if(_0xb8d786){return _0x587075[_0x5b94('0x28')](_0x5d445a)[_0x5b94('0x2a')](_0xb8d786);}};}function respondWithFilteredResult(_0x3eeaff,_0x3b571d){return function(_0x301e6d){if(_0x301e6d){var _0x1a325c=_0x301e6d[_0x5b94('0x2b')],_0x39444e=_0x3b571d[_0x5b94('0x2c')],_0x45665a=_0x3b571d[_0x5b94('0x2c')]+_0x3b571d[_0x5b94('0x2d')],_0x576712;if(_0x45665a>=_0x1a325c){_0x45665a=_0x1a325c;_0x576712=0xc8;}else{_0x576712=0xce;}_0x3eeaff[_0x5b94('0x28')](_0x576712);return _0x3eeaff[_0x5b94('0x2e')](_0x5b94('0x2f'),_0x39444e+'-'+_0x45665a+'/'+_0x1a325c)['json'](_0x301e6d);}return null;};}function patchUpdates(_0x521f62){return function(_0x34fb5e){try{jsonpatch[_0x5b94('0x30')](_0x34fb5e,_0x521f62,!![]);}catch(_0x3e236b){return BPromise[_0x5b94('0x31')](_0x3e236b);}return _0x34fb5e[_0x5b94('0x32')]();};}function saveUpdates(_0x5af0ce,_0xcb9410){return function(_0x1f9a71){if(_0x1f9a71){return _0x1f9a71[_0x5b94('0x33')](_0x5af0ce)[_0x5b94('0x34')](function(_0x4581b4){return _0x4581b4;});}return null;};}function removeEntity(_0x37b37d,_0x2b9921){return function(_0x5907e4){if(_0x5907e4){return _0x5907e4['destroy']()[_0x5b94('0x34')](function(){_0x37b37d['status'](0xcc)[_0x5b94('0x29')]();});}};}function handleEntityNotFound(_0x21377d,_0x10bc87){return function(_0x59dd86){if(!_0x59dd86){_0x21377d[_0x5b94('0x27')](0x194);}return _0x59dd86;};}function handleError(_0x1c9aa1,_0x4864fb){_0x4864fb=_0x4864fb||0x1f4;return function(_0x433ef9){logger[_0x5b94('0x22')](_0x433ef9[_0x5b94('0x35')]);if(_0x433ef9[_0x5b94('0x36')]){delete _0x433ef9['name'];}_0x1c9aa1[_0x5b94('0x28')](_0x4864fb)[_0x5b94('0x37')](_0x433ef9);};}exports[_0x5b94('0x38')]=function(_0x4b29c6,_0x28c940){var _0x5cccda={},_0x125629={},_0x4578d3={'count':0x0,'rows':[]};var _0x2b7b87=_[_0x5b94('0x39')](db[_0x5b94('0x3a')][_0x5b94('0x3b')],function(_0x15fe37){return{'name':_0x15fe37['fieldName'],'type':_0x15fe37[_0x5b94('0x3c')]['key']};});_0x125629[_0x5b94('0x3d')]=_[_0x5b94('0x39')](_0x2b7b87,_0x5b94('0x36'));_0x125629[_0x5b94('0x3e')]=_[_0x5b94('0x3f')](_0x4b29c6[_0x5b94('0x3e')]);_0x125629['filters']=_['intersection'](_0x125629[_0x5b94('0x3d')],_0x125629[_0x5b94('0x3e')]);_0x5cccda[_0x5b94('0x40')]=_[_0x5b94('0x41')](_0x125629[_0x5b94('0x3d')],qs[_0x5b94('0x42')](_0x4b29c6[_0x5b94('0x3e')][_0x5b94('0x42')]));_0x5cccda[_0x5b94('0x40')]=_0x5cccda['attributes'][_0x5b94('0x43')]?_0x5cccda['attributes']:_0x125629[_0x5b94('0x3d')];if(!_0x4b29c6[_0x5b94('0x3e')][_0x5b94('0x44')](_0x5b94('0x45'))){_0x5cccda[_0x5b94('0x2d')]=qs[_0x5b94('0x2d')](_0x4b29c6['query'][_0x5b94('0x2d')]);_0x5cccda[_0x5b94('0x2c')]=qs[_0x5b94('0x2c')](_0x4b29c6[_0x5b94('0x3e')]['offset']);}_0x5cccda['order']=qs[_0x5b94('0x46')](_0x4b29c6[_0x5b94('0x3e')][_0x5b94('0x46')]);_0x5cccda['where']=qs[_0x5b94('0x47')](_['pick'](_0x4b29c6['query'],_0x125629['filters']),_0x2b7b87);if(_0x4b29c6[_0x5b94('0x3e')][_0x5b94('0x48')]){_0x5cccda[_0x5b94('0x49')]=_[_0x5b94('0x4a')](_0x5cccda[_0x5b94('0x49')],{'$or':_[_0x5b94('0x39')](_0x2b7b87,function(_0x14ddd4){if(_0x14ddd4[_0x5b94('0x3c')]!==_0x5b94('0x4b')){var _0x3019ce={};_0x3019ce[_0x14ddd4[_0x5b94('0x36')]]={'$like':'%'+_0x4b29c6[_0x5b94('0x3e')][_0x5b94('0x48')]+'%'};return _0x3019ce;}})});}_0x5cccda=_[_0x5b94('0x4a')]({},_0x5cccda,_0x4b29c6[_0x5b94('0x4c')]);var _0x469d43={'where':_0x5cccda[_0x5b94('0x49')]};return db[_0x5b94('0x3a')][_0x5b94('0x2b')](_0x469d43)[_0x5b94('0x34')](function(_0x3d652f){_0x4578d3[_0x5b94('0x2b')]=_0x3d652f;if(_0x4b29c6['query']['includeAll']){_0x5cccda[_0x5b94('0x4d')]=[{'all':!![]}];}return db[_0x5b94('0x3a')][_0x5b94('0x4e')](_0x5cccda);})[_0x5b94('0x34')](function(_0x4e913e){_0x4578d3[_0x5b94('0x4f')]=_0x4e913e;return _0x4578d3;})[_0x5b94('0x34')](respondWithFilteredResult(_0x28c940,_0x5cccda))[_0x5b94('0x26')](handleError(_0x28c940,null));};exports[_0x5b94('0x50')]=function(_0x1be9c5,_0x39ef14){var _0x2583d1={'raw':![],'where':{'id':_0x1be9c5[_0x5b94('0x51')]['id']}},_0xe89946={};_0xe89946['model']=_[_0x5b94('0x3f')](db['VtigerConfiguration']['rawAttributes']);_0xe89946[_0x5b94('0x3e')]=_[_0x5b94('0x3f')](_0x1be9c5[_0x5b94('0x3e')]);_0xe89946[_0x5b94('0x47')]=_['intersection'](_0xe89946[_0x5b94('0x3d')],_0xe89946['query']);_0x2583d1[_0x5b94('0x40')]=_['intersection'](_0xe89946[_0x5b94('0x3d')],qs[_0x5b94('0x42')](_0x1be9c5[_0x5b94('0x3e')][_0x5b94('0x42')]));_0x2583d1[_0x5b94('0x40')]=_0x2583d1[_0x5b94('0x40')]['length']?_0x2583d1[_0x5b94('0x40')]:_0xe89946[_0x5b94('0x3d')];if(_0x1be9c5[_0x5b94('0x3e')][_0x5b94('0x52')]){_0x2583d1[_0x5b94('0x4d')]=[{'all':!![]}];}_0x2583d1=_[_0x5b94('0x4a')]({},_0x2583d1,_0x1be9c5[_0x5b94('0x4c')]);return db[_0x5b94('0x3a')][_0x5b94('0x53')](_0x2583d1)[_0x5b94('0x34')](handleEntityNotFound(_0x39ef14,null))['then'](respondWithResult(_0x39ef14,null))[_0x5b94('0x26')](handleError(_0x39ef14,null));};exports[_0x5b94('0x54')]=function(_0x30a38c,_0x8a9cf){return db[_0x5b94('0x3a')][_0x5b94('0x54')](_0x30a38c[_0x5b94('0x55')],{})[_0x5b94('0x34')](respondWithResult(_0x8a9cf,0xc9))['catch'](handleError(_0x8a9cf,null));};exports[_0x5b94('0x33')]=function(_0x39b1b4,_0x144783){if(_0x39b1b4[_0x5b94('0x55')]['id']){delete _0x39b1b4['body']['id'];}return db[_0x5b94('0x3a')][_0x5b94('0x53')]({'where':{'id':_0x39b1b4['params']['id']}})[_0x5b94('0x34')](handleEntityNotFound(_0x144783,null))[_0x5b94('0x34')](saveUpdates(_0x39b1b4[_0x5b94('0x55')],null))[_0x5b94('0x34')](respondWithResult(_0x144783,null))[_0x5b94('0x26')](handleError(_0x144783,null));};exports[_0x5b94('0x56')]=function(_0x387b8a,_0x34899e){return db[_0x5b94('0x3a')]['find']({'where':{'id':_0x387b8a[_0x5b94('0x51')]['id']}})[_0x5b94('0x34')](handleEntityNotFound(_0x34899e,null))[_0x5b94('0x34')](removeEntity(_0x34899e,null))['catch'](handleError(_0x34899e,null));};exports[_0x5b94('0x57')]=function(_0x175387,_0xedf7ae,_0x2d0875){var _0x1ec18a={};var _0x35570e={};var _0x592833;var _0x3c1edf;return db[_0x5b94('0x3a')][_0x5b94('0x58')]({'where':{'id':_0x175387[_0x5b94('0x51')]['id']}})[_0x5b94('0x34')](handleEntityNotFound(_0xedf7ae,null))['then'](function(_0x4557b5){if(_0x4557b5){_0x592833=_0x4557b5;_0x35570e[_0x5b94('0x3d')]=_[_0x5b94('0x3f')](db[_0x5b94('0x59')][_0x5b94('0x3b')]);_0x35570e[_0x5b94('0x3e')]=_[_0x5b94('0x3f')](_0x175387[_0x5b94('0x3e')]);_0x35570e[_0x5b94('0x47')]=_['intersection'](_0x35570e['model'],_0x35570e[_0x5b94('0x3e')]);_0x1ec18a[_0x5b94('0x40')]=_['intersection'](_0x35570e[_0x5b94('0x3d')],qs[_0x5b94('0x42')](_0x175387[_0x5b94('0x3e')][_0x5b94('0x42')]));_0x1ec18a['attributes']=_0x1ec18a[_0x5b94('0x40')][_0x5b94('0x43')]?_0x1ec18a[_0x5b94('0x40')]:_0x35570e[_0x5b94('0x3d')];_0x1ec18a[_0x5b94('0x5a')]=qs[_0x5b94('0x46')](_0x175387[_0x5b94('0x3e')][_0x5b94('0x46')]);_0x1ec18a[_0x5b94('0x49')]=qs[_0x5b94('0x47')](_['pick'](_0x175387[_0x5b94('0x3e')],_0x35570e[_0x5b94('0x47')]));if(_0x175387[_0x5b94('0x3e')][_0x5b94('0x48')]){_0x1ec18a[_0x5b94('0x49')]=_[_0x5b94('0x4a')](_0x1ec18a[_0x5b94('0x49')],{'$or':_[_0x5b94('0x39')](_0x1ec18a[_0x5b94('0x40')],function(_0x5b36a0){var _0x54578f={};_0x54578f[_0x5b36a0]={'$like':'%'+_0x175387[_0x5b94('0x3e')][_0x5b94('0x48')]+'%'};return _0x54578f;})});}_0x1ec18a=_[_0x5b94('0x4a')]({},_0x1ec18a,_0x175387['options']);return _0x592833['getFields'](_0x1ec18a);}})['then'](function(_0x40a5ad){if(_0x40a5ad){_0x3c1edf=_0x40a5ad[_0x5b94('0x43')];if(!_0x175387[_0x5b94('0x3e')]['hasOwnProperty']('nolimit')){_0x1ec18a[_0x5b94('0x2d')]=qs['limit'](_0x175387['query'][_0x5b94('0x2d')]);_0x1ec18a[_0x5b94('0x2c')]=qs['offset'](_0x175387[_0x5b94('0x3e')]['offset']);}return _0x592833[_0x5b94('0x57')](_0x1ec18a);}})['then'](function(_0x1428fe){if(_0x1428fe){return _0x1428fe?{'count':_0x3c1edf,'rows':_0x1428fe}:null;}})['then'](respondWithResult(_0xedf7ae,null))['catch'](handleError(_0xedf7ae,null));};exports[_0x5b94('0x5b')]=function(_0x326e75,_0x348ae1,_0x12f888){var _0x34a05e={};var _0x5ef1b6={};var _0x15be7f;var _0xf93941;return db[_0x5b94('0x3a')]['findOne']({'where':{'id':_0x326e75['params']['id']}})[_0x5b94('0x34')](handleEntityNotFound(_0x348ae1,null))[_0x5b94('0x34')](function(_0x39baf1){if(_0x39baf1){_0x15be7f=_0x39baf1;_0x5ef1b6[_0x5b94('0x3d')]=_[_0x5b94('0x3f')](db[_0x5b94('0x59')][_0x5b94('0x3b')]);_0x5ef1b6[_0x5b94('0x3e')]=_[_0x5b94('0x3f')](_0x326e75['query']);_0x5ef1b6[_0x5b94('0x47')]=_[_0x5b94('0x41')](_0x5ef1b6[_0x5b94('0x3d')],_0x5ef1b6[_0x5b94('0x3e')]);_0x34a05e[_0x5b94('0x40')]=_[_0x5b94('0x41')](_0x5ef1b6[_0x5b94('0x3d')],qs['fields'](_0x326e75[_0x5b94('0x3e')][_0x5b94('0x42')]));_0x34a05e[_0x5b94('0x40')]=_0x34a05e[_0x5b94('0x40')][_0x5b94('0x43')]?_0x34a05e[_0x5b94('0x40')]:_0x5ef1b6['model'];_0x34a05e[_0x5b94('0x5a')]=qs[_0x5b94('0x46')](_0x326e75[_0x5b94('0x3e')][_0x5b94('0x46')]);_0x34a05e[_0x5b94('0x49')]=qs[_0x5b94('0x47')](_[_0x5b94('0x5c')](_0x326e75[_0x5b94('0x3e')],_0x5ef1b6[_0x5b94('0x47')]));if(_0x326e75[_0x5b94('0x3e')]['filter']){_0x34a05e[_0x5b94('0x49')]=_[_0x5b94('0x4a')](_0x34a05e[_0x5b94('0x49')],{'$or':_[_0x5b94('0x39')](_0x34a05e[_0x5b94('0x40')],function(_0x464800){var _0x7703f4={};_0x7703f4[_0x464800]={'$like':'%'+_0x326e75[_0x5b94('0x3e')][_0x5b94('0x48')]+'%'};return _0x7703f4;})});}_0x34a05e=_[_0x5b94('0x4a')]({},_0x34a05e,_0x326e75['options']);return _0x15be7f[_0x5b94('0x5b')](_0x34a05e);}})[_0x5b94('0x34')](function(_0x48fdb7){if(_0x48fdb7){_0xf93941=_0x48fdb7[_0x5b94('0x43')];if(!_0x326e75[_0x5b94('0x3e')][_0x5b94('0x44')](_0x5b94('0x45'))){_0x34a05e['limit']=qs[_0x5b94('0x2d')](_0x326e75['query'][_0x5b94('0x2d')]);_0x34a05e[_0x5b94('0x2c')]=qs[_0x5b94('0x2c')](_0x326e75[_0x5b94('0x3e')][_0x5b94('0x2c')]);}return _0x15be7f[_0x5b94('0x5b')](_0x34a05e);}})[_0x5b94('0x34')](function(_0x32edc6){if(_0x32edc6){return _0x32edc6?{'count':_0xf93941,'rows':_0x32edc6}:null;}})['then'](respondWithResult(_0x348ae1,null))[_0x5b94('0x26')](handleError(_0x348ae1,null));};exports['getDescriptions']=function(_0x1e421b,_0x2970fc,_0x45e953){var _0x5dc501={};var _0x314858={};var _0x132fea;var _0x3e6eec;return db[_0x5b94('0x3a')][_0x5b94('0x58')]({'where':{'id':_0x1e421b[_0x5b94('0x51')]['id']}})[_0x5b94('0x34')](handleEntityNotFound(_0x2970fc,null))[_0x5b94('0x34')](function(_0x1441e3){if(_0x1441e3){_0x132fea=_0x1441e3;_0x314858[_0x5b94('0x3d')]=_[_0x5b94('0x3f')](db[_0x5b94('0x59')][_0x5b94('0x3b')]);_0x314858[_0x5b94('0x3e')]=_['keys'](_0x1e421b['query']);_0x314858[_0x5b94('0x47')]=_[_0x5b94('0x41')](_0x314858[_0x5b94('0x3d')],_0x314858['query']);_0x5dc501[_0x5b94('0x40')]=_[_0x5b94('0x41')](_0x314858[_0x5b94('0x3d')],qs['fields'](_0x1e421b[_0x5b94('0x3e')][_0x5b94('0x42')]));_0x5dc501[_0x5b94('0x40')]=_0x5dc501[_0x5b94('0x40')][_0x5b94('0x43')]?_0x5dc501['attributes']:_0x314858['model'];_0x5dc501[_0x5b94('0x5a')]=qs['sort'](_0x1e421b[_0x5b94('0x3e')][_0x5b94('0x46')]);_0x5dc501[_0x5b94('0x49')]=qs[_0x5b94('0x47')](_[_0x5b94('0x5c')](_0x1e421b['query'],_0x314858[_0x5b94('0x47')]));if(_0x1e421b[_0x5b94('0x3e')][_0x5b94('0x48')]){_0x5dc501['where']=_[_0x5b94('0x4a')](_0x5dc501[_0x5b94('0x49')],{'$or':_[_0x5b94('0x39')](_0x5dc501[_0x5b94('0x40')],function(_0x17ee32){var _0x560f9c={};_0x560f9c[_0x17ee32]={'$like':'%'+_0x1e421b['query']['filter']+'%'};return _0x560f9c;})});}_0x5dc501=_['merge']({},_0x5dc501,_0x1e421b[_0x5b94('0x4c')]);return _0x132fea[_0x5b94('0x5d')](_0x5dc501);}})[_0x5b94('0x34')](function(_0xbb5365){if(_0xbb5365){_0x3e6eec=_0xbb5365[_0x5b94('0x43')];if(!_0x1e421b[_0x5b94('0x3e')]['hasOwnProperty'](_0x5b94('0x45'))){_0x5dc501[_0x5b94('0x2d')]=qs[_0x5b94('0x2d')](_0x1e421b[_0x5b94('0x3e')]['limit']);_0x5dc501[_0x5b94('0x2c')]=qs[_0x5b94('0x2c')](_0x1e421b[_0x5b94('0x3e')]['offset']);}return _0x132fea['getDescriptions'](_0x5dc501);}})[_0x5b94('0x34')](function(_0x3221e6){if(_0x3221e6){return _0x3221e6?{'count':_0x3e6eec,'rows':_0x3221e6}:null;}})[_0x5b94('0x34')](respondWithResult(_0x2970fc,null))[_0x5b94('0x26')](handleError(_0x2970fc,null));}; \ No newline at end of file +var _0x8443=['bluebird','path','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','papaparse','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','jayson/promise','http','test','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','info','VtigerConfiguration,\x20%s,\x20%s','request\x20sent','VtigerConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','sendStatus','status','json','count','offset','limit','set','Content-Range','apply','reject','save','update','stack','name','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','VtigerConfiguration','includeAll','include','findAll','rows','params','find','create','body','destroy','getFields','findOne','order','getSubjects','getDescriptions','html-pdf','eml-format','fast-json-patch','moment'];(function(_0xf3c8e2,_0x317530){var _0x3372a3=function(_0xca45eb){while(--_0xca45eb){_0xf3c8e2['push'](_0xf3c8e2['shift']());}};_0x3372a3(++_0x317530);}(_0x8443,0x101));var _0x3844=function(_0xcc8729,_0x57b762){_0xcc8729=_0xcc8729-0x0;var _0xbbcdba=_0x8443[_0xcc8729];return _0xbbcdba;};'use strict';var pdf=require(_0x3844('0x0'));var emlformat=require(_0x3844('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x3844('0x2'));var rp=require('request-promise');var moment=require(_0x3844('0x3'));var BPromise=require(_0x3844('0x4'));var Mustache=require('mustache');var util=require('util');var path=require(_0x3844('0x5'));var sox=require('sox');var csv=require(_0x3844('0x6'));var ejs=require(_0x3844('0x7'));var fs=require('fs');var _=require(_0x3844('0x8'));var squel=require(_0x3844('0x9'));var crypto=require(_0x3844('0xa'));var jsforce=require(_0x3844('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x3844('0x6'));var querystring=require(_0x3844('0xc'));var Papa=require(_0x3844('0xd'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x3844('0xe'));var hardwareService=require(_0x3844('0xf'));var logger=require('../../config/logger')(_0x3844('0x10'));var utils=require(_0x3844('0x11'));var config=require(_0x3844('0x12'));var db=require('../../mysqldb')['db'];var jayson=require(_0x3844('0x13'));var client=jayson['client'][_0x3844('0x14')]({'port':0x232a});function checkPasswordPattern(_0x2d094c,_0x1bebe6,_0x3ec62c){if(_0x3ec62c){var _0x42c6de=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x42c6de[_0x3844('0x15')](_0x1bebe6)){return _0x2d094c;}else{throw new db[(_0x3844('0x16'))][(_0x3844('0x17'))](_0x3844('0x18'));}}else{return _0x2d094c;}}function respondWithRpcPromise(_0x2d679a,_0x21f8ce,_0x1e3152,_0x2a1ed4){return new BPromise(function(_0xc6b803,_0x5666d8){var _0x374954=_0x2a1ed4||client;return _0x374954[_0x3844('0x19')](_0x2d679a,_0x1e3152)[_0x3844('0x1a')](function(_0x4ebfd6){logger[_0x3844('0x1b')](_0x3844('0x1c'),_0x21f8ce,_0x3844('0x1d'));logger['debug'](_0x3844('0x1e'),_0x21f8ce,_0x3844('0x1d'),JSON[_0x3844('0x1f')](_0x4ebfd6));if(_0x4ebfd6[_0x3844('0x20')]){if(_0x4ebfd6[_0x3844('0x20')]['code']===0x1f4){logger[_0x3844('0x20')]('VtigerConfiguration,\x20%s,\x20%s',_0x21f8ce,_0x4ebfd6[_0x3844('0x20')]['message']);return _0x5666d8(_0x4ebfd6[_0x3844('0x20')][_0x3844('0x21')]);}logger[_0x3844('0x20')]('VtigerConfiguration,\x20%s,\x20%s',_0x21f8ce,_0x4ebfd6[_0x3844('0x20')]['message']);return _0xc6b803(_0x4ebfd6[_0x3844('0x20')]['message']);}else{logger[_0x3844('0x1b')](_0x3844('0x1c'),_0x21f8ce,'request\x20sent');_0xc6b803(_0x4ebfd6[_0x3844('0x22')][_0x3844('0x21')]);}})[_0x3844('0x23')](function(_0x4d6265){logger['error'](_0x3844('0x1c'),_0x21f8ce,_0x4d6265);_0x5666d8(_0x4d6265);});});}function respondWithStatusCode(_0x531fa3,_0xf8a6a){_0xf8a6a=_0xf8a6a||0xcc;return function(_0x479ee8){if(_0x479ee8){return _0x531fa3[_0x3844('0x24')](_0xf8a6a);}return _0x531fa3[_0x3844('0x25')](_0xf8a6a)['end']();};}function respondWithResult(_0x5e30ab,_0x434b81){_0x434b81=_0x434b81||0xc8;return function(_0x2fa2ff){if(_0x2fa2ff){return _0x5e30ab[_0x3844('0x25')](_0x434b81)[_0x3844('0x26')](_0x2fa2ff);}};}function respondWithFilteredResult(_0x1fa521,_0x4da78a){return function(_0x4c0731){if(_0x4c0731){var _0x13c285=_0x4c0731[_0x3844('0x27')],_0x567f20=_0x4da78a[_0x3844('0x28')],_0x592947=_0x4da78a[_0x3844('0x28')]+_0x4da78a[_0x3844('0x29')],_0x40bf24;if(_0x592947>=_0x13c285){_0x592947=_0x13c285;_0x40bf24=0xc8;}else{_0x40bf24=0xce;}_0x1fa521[_0x3844('0x25')](_0x40bf24);return _0x1fa521[_0x3844('0x2a')](_0x3844('0x2b'),_0x567f20+'-'+_0x592947+'/'+_0x13c285)[_0x3844('0x26')](_0x4c0731);}return null;};}function patchUpdates(_0x8abc42){return function(_0x4f0c17){try{jsonpatch[_0x3844('0x2c')](_0x4f0c17,_0x8abc42,!![]);}catch(_0xece6cd){return BPromise[_0x3844('0x2d')](_0xece6cd);}return _0x4f0c17[_0x3844('0x2e')]();};}function saveUpdates(_0xcba2cc,_0xbfc6b6){return function(_0x38eb97){if(_0x38eb97){return _0x38eb97[_0x3844('0x2f')](_0xcba2cc)[_0x3844('0x1a')](function(_0x31939e){return _0x31939e;});}return null;};}function removeEntity(_0x595c12,_0x2fe6eb){return function(_0x5ac749){if(_0x5ac749){return _0x5ac749['destroy']()[_0x3844('0x1a')](function(){_0x595c12[_0x3844('0x25')](0xcc)['end']();});}};}function handleEntityNotFound(_0xcba253,_0x4a0f05){return function(_0x14fa93){if(!_0x14fa93){_0xcba253[_0x3844('0x24')](0x194);}return _0x14fa93;};}function handleError(_0x520edb,_0x1f1515){_0x1f1515=_0x1f1515||0x1f4;return function(_0x5a77d4){logger[_0x3844('0x20')](_0x5a77d4[_0x3844('0x30')]);if(_0x5a77d4[_0x3844('0x31')]){delete _0x5a77d4[_0x3844('0x31')];}_0x520edb[_0x3844('0x25')](_0x1f1515)['send'](_0x5a77d4);};}exports[_0x3844('0x32')]=function(_0x1793f6,_0xa29b2){var _0x133e6b={},_0x539cf8={},_0x1eb4a2={'count':0x0,'rows':[]};var _0x13987a=_[_0x3844('0x33')](db['VtigerConfiguration'][_0x3844('0x34')],function(_0x55145f){return{'name':_0x55145f[_0x3844('0x35')],'type':_0x55145f[_0x3844('0x36')][_0x3844('0x37')]};});_0x539cf8[_0x3844('0x38')]=_['map'](_0x13987a,_0x3844('0x31'));_0x539cf8[_0x3844('0x39')]=_[_0x3844('0x3a')](_0x1793f6[_0x3844('0x39')]);_0x539cf8[_0x3844('0x3b')]=_[_0x3844('0x3c')](_0x539cf8[_0x3844('0x38')],_0x539cf8['query']);_0x133e6b[_0x3844('0x3d')]=_[_0x3844('0x3c')](_0x539cf8['model'],qs[_0x3844('0x3e')](_0x1793f6[_0x3844('0x39')][_0x3844('0x3e')]));_0x133e6b['attributes']=_0x133e6b['attributes'][_0x3844('0x3f')]?_0x133e6b[_0x3844('0x3d')]:_0x539cf8[_0x3844('0x38')];if(!_0x1793f6['query']['hasOwnProperty'](_0x3844('0x40'))){_0x133e6b['limit']=qs[_0x3844('0x29')](_0x1793f6[_0x3844('0x39')]['limit']);_0x133e6b[_0x3844('0x28')]=qs[_0x3844('0x28')](_0x1793f6[_0x3844('0x39')]['offset']);}_0x133e6b['order']=qs['sort'](_0x1793f6['query'][_0x3844('0x41')]);_0x133e6b[_0x3844('0x42')]=qs[_0x3844('0x3b')](_[_0x3844('0x43')](_0x1793f6[_0x3844('0x39')],_0x539cf8[_0x3844('0x3b')]),_0x13987a);if(_0x1793f6[_0x3844('0x39')][_0x3844('0x44')]){_0x133e6b[_0x3844('0x42')]=_[_0x3844('0x45')](_0x133e6b[_0x3844('0x42')],{'$or':_[_0x3844('0x33')](_0x13987a,function(_0x45132a){if(_0x45132a['type']!==_0x3844('0x46')){var _0x8284b7={};_0x8284b7[_0x45132a[_0x3844('0x31')]]={'$like':'%'+_0x1793f6[_0x3844('0x39')][_0x3844('0x44')]+'%'};return _0x8284b7;}})});}_0x133e6b=_[_0x3844('0x45')]({},_0x133e6b,_0x1793f6[_0x3844('0x47')]);var _0x33f243={'where':_0x133e6b[_0x3844('0x42')]};return db[_0x3844('0x48')][_0x3844('0x27')](_0x33f243)[_0x3844('0x1a')](function(_0x25a9b){_0x1eb4a2[_0x3844('0x27')]=_0x25a9b;if(_0x1793f6['query'][_0x3844('0x49')]){_0x133e6b[_0x3844('0x4a')]=[{'all':!![]}];}return db[_0x3844('0x48')][_0x3844('0x4b')](_0x133e6b);})[_0x3844('0x1a')](function(_0x16e402){_0x1eb4a2[_0x3844('0x4c')]=_0x16e402;return _0x1eb4a2;})[_0x3844('0x1a')](respondWithFilteredResult(_0xa29b2,_0x133e6b))[_0x3844('0x23')](handleError(_0xa29b2,null));};exports['show']=function(_0x12bd05,_0x47193c){var _0x41acff={'raw':![],'where':{'id':_0x12bd05[_0x3844('0x4d')]['id']}},_0x8ea6c5={};_0x8ea6c5[_0x3844('0x38')]=_['keys'](db[_0x3844('0x48')][_0x3844('0x34')]);_0x8ea6c5[_0x3844('0x39')]=_[_0x3844('0x3a')](_0x12bd05[_0x3844('0x39')]);_0x8ea6c5[_0x3844('0x3b')]=_[_0x3844('0x3c')](_0x8ea6c5[_0x3844('0x38')],_0x8ea6c5[_0x3844('0x39')]);_0x41acff[_0x3844('0x3d')]=_[_0x3844('0x3c')](_0x8ea6c5[_0x3844('0x38')],qs[_0x3844('0x3e')](_0x12bd05[_0x3844('0x39')][_0x3844('0x3e')]));_0x41acff['attributes']=_0x41acff[_0x3844('0x3d')][_0x3844('0x3f')]?_0x41acff[_0x3844('0x3d')]:_0x8ea6c5[_0x3844('0x38')];if(_0x12bd05['query']['includeAll']){_0x41acff[_0x3844('0x4a')]=[{'all':!![]}];}_0x41acff=_[_0x3844('0x45')]({},_0x41acff,_0x12bd05['options']);return db[_0x3844('0x48')][_0x3844('0x4e')](_0x41acff)[_0x3844('0x1a')](handleEntityNotFound(_0x47193c,null))[_0x3844('0x1a')](respondWithResult(_0x47193c,null))[_0x3844('0x23')](handleError(_0x47193c,null));};exports[_0x3844('0x4f')]=function(_0x3532da,_0x172848){return db[_0x3844('0x48')][_0x3844('0x4f')](_0x3532da['body'],{})[_0x3844('0x1a')](respondWithResult(_0x172848,0xc9))['catch'](handleError(_0x172848,null));};exports[_0x3844('0x2f')]=function(_0x4d1c09,_0x3c56e8){if(_0x4d1c09[_0x3844('0x50')]['id']){delete _0x4d1c09[_0x3844('0x50')]['id'];}return db[_0x3844('0x48')]['find']({'where':{'id':_0x4d1c09['params']['id']}})['then'](handleEntityNotFound(_0x3c56e8,null))[_0x3844('0x1a')](saveUpdates(_0x4d1c09[_0x3844('0x50')],null))[_0x3844('0x1a')](respondWithResult(_0x3c56e8,null))[_0x3844('0x23')](handleError(_0x3c56e8,null));};exports[_0x3844('0x51')]=function(_0x46c848,_0x4f9cc0){return db[_0x3844('0x48')][_0x3844('0x4e')]({'where':{'id':_0x46c848['params']['id']}})[_0x3844('0x1a')](handleEntityNotFound(_0x4f9cc0,null))[_0x3844('0x1a')](removeEntity(_0x4f9cc0,null))['catch'](handleError(_0x4f9cc0,null));};exports[_0x3844('0x52')]=function(_0x538d2b,_0x5ba770,_0x2c4edc){var _0x4c32e2={};var _0x5ce1e8={};var _0x86169f;var _0x166afd;return db[_0x3844('0x48')][_0x3844('0x53')]({'where':{'id':_0x538d2b[_0x3844('0x4d')]['id']}})[_0x3844('0x1a')](handleEntityNotFound(_0x5ba770,null))['then'](function(_0x44772b){if(_0x44772b){_0x86169f=_0x44772b;_0x5ce1e8[_0x3844('0x38')]=_['keys'](db['VtigerField']['rawAttributes']);_0x5ce1e8['query']=_[_0x3844('0x3a')](_0x538d2b[_0x3844('0x39')]);_0x5ce1e8['filters']=_[_0x3844('0x3c')](_0x5ce1e8['model'],_0x5ce1e8[_0x3844('0x39')]);_0x4c32e2[_0x3844('0x3d')]=_[_0x3844('0x3c')](_0x5ce1e8[_0x3844('0x38')],qs[_0x3844('0x3e')](_0x538d2b[_0x3844('0x39')][_0x3844('0x3e')]));_0x4c32e2[_0x3844('0x3d')]=_0x4c32e2[_0x3844('0x3d')][_0x3844('0x3f')]?_0x4c32e2[_0x3844('0x3d')]:_0x5ce1e8[_0x3844('0x38')];_0x4c32e2[_0x3844('0x54')]=qs[_0x3844('0x41')](_0x538d2b['query'][_0x3844('0x41')]);_0x4c32e2[_0x3844('0x42')]=qs[_0x3844('0x3b')](_[_0x3844('0x43')](_0x538d2b[_0x3844('0x39')],_0x5ce1e8[_0x3844('0x3b')]));if(_0x538d2b[_0x3844('0x39')][_0x3844('0x44')]){_0x4c32e2[_0x3844('0x42')]=_[_0x3844('0x45')](_0x4c32e2[_0x3844('0x42')],{'$or':_['map'](_0x4c32e2['attributes'],function(_0x118878){var _0x171e9e={};_0x171e9e[_0x118878]={'$like':'%'+_0x538d2b[_0x3844('0x39')][_0x3844('0x44')]+'%'};return _0x171e9e;})});}_0x4c32e2=_[_0x3844('0x45')]({},_0x4c32e2,_0x538d2b[_0x3844('0x47')]);return _0x86169f['getFields'](_0x4c32e2);}})[_0x3844('0x1a')](function(_0x11ddb6){if(_0x11ddb6){_0x166afd=_0x11ddb6[_0x3844('0x3f')];if(!_0x538d2b[_0x3844('0x39')]['hasOwnProperty'](_0x3844('0x40'))){_0x4c32e2[_0x3844('0x29')]=qs['limit'](_0x538d2b[_0x3844('0x39')][_0x3844('0x29')]);_0x4c32e2['offset']=qs['offset'](_0x538d2b[_0x3844('0x39')]['offset']);}return _0x86169f[_0x3844('0x52')](_0x4c32e2);}})['then'](function(_0x918e7f){if(_0x918e7f){return _0x918e7f?{'count':_0x166afd,'rows':_0x918e7f}:null;}})['then'](respondWithResult(_0x5ba770,null))[_0x3844('0x23')](handleError(_0x5ba770,null));};exports['getSubjects']=function(_0xc74f0f,_0x276ffa,_0x17755b){var _0x380d47={};var _0x4f52f5={};var _0x558d96;var _0x29def9;return db[_0x3844('0x48')][_0x3844('0x53')]({'where':{'id':_0xc74f0f[_0x3844('0x4d')]['id']}})[_0x3844('0x1a')](handleEntityNotFound(_0x276ffa,null))[_0x3844('0x1a')](function(_0x4a9403){if(_0x4a9403){_0x558d96=_0x4a9403;_0x4f52f5['model']=_[_0x3844('0x3a')](db['VtigerField']['rawAttributes']);_0x4f52f5[_0x3844('0x39')]=_[_0x3844('0x3a')](_0xc74f0f['query']);_0x4f52f5[_0x3844('0x3b')]=_[_0x3844('0x3c')](_0x4f52f5[_0x3844('0x38')],_0x4f52f5['query']);_0x380d47['attributes']=_[_0x3844('0x3c')](_0x4f52f5[_0x3844('0x38')],qs[_0x3844('0x3e')](_0xc74f0f['query']['fields']));_0x380d47[_0x3844('0x3d')]=_0x380d47[_0x3844('0x3d')]['length']?_0x380d47[_0x3844('0x3d')]:_0x4f52f5[_0x3844('0x38')];_0x380d47[_0x3844('0x54')]=qs[_0x3844('0x41')](_0xc74f0f[_0x3844('0x39')][_0x3844('0x41')]);_0x380d47['where']=qs['filters'](_['pick'](_0xc74f0f[_0x3844('0x39')],_0x4f52f5[_0x3844('0x3b')]));if(_0xc74f0f['query'][_0x3844('0x44')]){_0x380d47['where']=_[_0x3844('0x45')](_0x380d47['where'],{'$or':_[_0x3844('0x33')](_0x380d47[_0x3844('0x3d')],function(_0x2980ec){var _0x582f02={};_0x582f02[_0x2980ec]={'$like':'%'+_0xc74f0f['query'][_0x3844('0x44')]+'%'};return _0x582f02;})});}_0x380d47=_['merge']({},_0x380d47,_0xc74f0f[_0x3844('0x47')]);return _0x558d96[_0x3844('0x55')](_0x380d47);}})['then'](function(_0x5c6640){if(_0x5c6640){_0x29def9=_0x5c6640['length'];if(!_0xc74f0f['query']['hasOwnProperty'](_0x3844('0x40'))){_0x380d47[_0x3844('0x29')]=qs['limit'](_0xc74f0f[_0x3844('0x39')][_0x3844('0x29')]);_0x380d47[_0x3844('0x28')]=qs[_0x3844('0x28')](_0xc74f0f[_0x3844('0x39')][_0x3844('0x28')]);}return _0x558d96[_0x3844('0x55')](_0x380d47);}})['then'](function(_0xde7c89){if(_0xde7c89){return _0xde7c89?{'count':_0x29def9,'rows':_0xde7c89}:null;}})[_0x3844('0x1a')](respondWithResult(_0x276ffa,null))[_0x3844('0x23')](handleError(_0x276ffa,null));};exports[_0x3844('0x56')]=function(_0x402a7c,_0x205fd5,_0x272c09){var _0x16907f={};var _0x195ed1={};var _0x4d042c;var _0x179f77;return db[_0x3844('0x48')]['findOne']({'where':{'id':_0x402a7c['params']['id']}})[_0x3844('0x1a')](handleEntityNotFound(_0x205fd5,null))[_0x3844('0x1a')](function(_0x3563a2){if(_0x3563a2){_0x4d042c=_0x3563a2;_0x195ed1[_0x3844('0x38')]=_[_0x3844('0x3a')](db['VtigerField'][_0x3844('0x34')]);_0x195ed1[_0x3844('0x39')]=_[_0x3844('0x3a')](_0x402a7c[_0x3844('0x39')]);_0x195ed1[_0x3844('0x3b')]=_[_0x3844('0x3c')](_0x195ed1[_0x3844('0x38')],_0x195ed1['query']);_0x16907f['attributes']=_[_0x3844('0x3c')](_0x195ed1[_0x3844('0x38')],qs['fields'](_0x402a7c[_0x3844('0x39')][_0x3844('0x3e')]));_0x16907f[_0x3844('0x3d')]=_0x16907f['attributes'][_0x3844('0x3f')]?_0x16907f[_0x3844('0x3d')]:_0x195ed1['model'];_0x16907f['order']=qs[_0x3844('0x41')](_0x402a7c['query'][_0x3844('0x41')]);_0x16907f[_0x3844('0x42')]=qs[_0x3844('0x3b')](_[_0x3844('0x43')](_0x402a7c['query'],_0x195ed1[_0x3844('0x3b')]));if(_0x402a7c[_0x3844('0x39')][_0x3844('0x44')]){_0x16907f[_0x3844('0x42')]=_[_0x3844('0x45')](_0x16907f[_0x3844('0x42')],{'$or':_[_0x3844('0x33')](_0x16907f['attributes'],function(_0x129a20){var _0x1057af={};_0x1057af[_0x129a20]={'$like':'%'+_0x402a7c[_0x3844('0x39')][_0x3844('0x44')]+'%'};return _0x1057af;})});}_0x16907f=_['merge']({},_0x16907f,_0x402a7c['options']);return _0x4d042c[_0x3844('0x56')](_0x16907f);}})[_0x3844('0x1a')](function(_0x3993b5){if(_0x3993b5){_0x179f77=_0x3993b5[_0x3844('0x3f')];if(!_0x402a7c['query']['hasOwnProperty'](_0x3844('0x40'))){_0x16907f[_0x3844('0x29')]=qs[_0x3844('0x29')](_0x402a7c[_0x3844('0x39')]['limit']);_0x16907f['offset']=qs[_0x3844('0x28')](_0x402a7c[_0x3844('0x39')]['offset']);}return _0x4d042c[_0x3844('0x56')](_0x16907f);}})[_0x3844('0x1a')](function(_0x42b2d0){if(_0x42b2d0){return _0x42b2d0?{'count':_0x179f77,'rows':_0x42b2d0}:null;}})['then'](respondWithResult(_0x205fd5,null))[_0x3844('0x23')](handleError(_0x205fd5,null));}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.model.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.model.js index ba4333a..c92ef98 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 _0xe1a1=['path','rimraf','../../config/environment','./intVtigerConfiguration.attributes','VtigerConfiguration','int_vtiger_configurations','lodash','util','../../config/logger','api'];(function(_0x493bda,_0x459212){var _0x40615a=function(_0x5a1aa6){while(--_0x5a1aa6){_0x493bda['push'](_0x493bda['shift']());}};_0x40615a(++_0x459212);}(_0xe1a1,0xa6));var _0x1e1a=function(_0x178e48,_0x3c9509){_0x178e48=_0x178e48-0x0;var _0x440d7e=_0xe1a1[_0x178e48];return _0x440d7e;};'use strict';var _=require(_0x1e1a('0x0'));var util=require(_0x1e1a('0x1'));var logger=require(_0x1e1a('0x2'))(_0x1e1a('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x1e1a('0x4'));var rimraf=require(_0x1e1a('0x5'));var config=require(_0x1e1a('0x6'));var attributes=require(_0x1e1a('0x7'));module['exports']=function(_0x4197b1,_0x1639e0){return _0x4197b1['define'](_0x1e1a('0x8'),attributes,{'tableName':_0x1e1a('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8da7=['exports','define','VtigerConfiguration','int_vtiger_configurations','lodash','util','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intVtigerConfiguration.attributes'];(function(_0x4f3f68,_0x1ddcfe){var _0x5d157b=function(_0x1a0438){while(--_0x1a0438){_0x4f3f68['push'](_0x4f3f68['shift']());}};_0x5d157b(++_0x1ddcfe);}(_0x8da7,0xba));var _0x78da=function(_0x2abd63,_0x18f09d){_0x2abd63=_0x2abd63-0x0;var _0x35568c=_0x8da7[_0x2abd63];return _0x35568c;};'use strict';var _=require(_0x78da('0x0'));var util=require(_0x78da('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x78da('0x2'));var BPromise=require(_0x78da('0x3'));var rp=require(_0x78da('0x4'));var fs=require('fs');var path=require(_0x78da('0x5'));var rimraf=require(_0x78da('0x6'));var config=require(_0x78da('0x7'));var attributes=require(_0x78da('0x8'));module[_0x78da('0x9')]=function(_0x5c5fcc,_0x1fb4b0){return _0x5c5fcc[_0x78da('0xa')](_0x78da('0xb'),attributes,{'tableName':_0x78da('0xc'),'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 cf38e1b..538ab3b 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 _0x9d3d=['VtigerConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','request','then','info','VtigerConfiguration,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x57bb05,_0x3b64fc){var _0x2a1cb1=function(_0x2c63e1){while(--_0x2c63e1){_0x57bb05['push'](_0x57bb05['shift']());}};_0x2a1cb1(++_0x3b64fc);}(_0x9d3d,0x1a4));var _0xd9d3=function(_0xe71b01,_0x354f02){_0xe71b01=_0xe71b01-0x0;var _0x32d60c=_0x9d3d[_0xe71b01];return _0x32d60c;};'use strict';var _=require(_0xd9d3('0x0'));var util=require(_0xd9d3('0x1'));var moment=require(_0xd9d3('0x2'));var BPromise=require('bluebird');var rs=require(_0xd9d3('0x3'));var fs=require('fs');var Redis=require(_0xd9d3('0x4'));var db=require(_0xd9d3('0x5'))['db'];var utils=require(_0xd9d3('0x6'));var logger=require(_0xd9d3('0x7'))('rpc');var config=require(_0xd9d3('0x8'));var jayson=require(_0xd9d3('0x9'));var client=jayson['client'][_0xd9d3('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4554a5,_0x19fba9,_0x33bd98){return new BPromise(function(_0x264c67,_0x3fa81c){return client[_0xd9d3('0xb')](_0x4554a5,_0x33bd98)[_0xd9d3('0xc')](function(_0x7f8e69){logger[_0xd9d3('0xd')](_0xd9d3('0xe'),_0x19fba9,_0xd9d3('0xf'));logger[_0xd9d3('0x10')](_0xd9d3('0x11'),_0x19fba9,_0xd9d3('0xf'),JSON[_0xd9d3('0x12')](_0x7f8e69));if(_0x7f8e69[_0xd9d3('0x13')]){if(_0x7f8e69['error'][_0xd9d3('0x14')]===0x1f4){logger[_0xd9d3('0x13')](_0xd9d3('0xe'),_0x19fba9,_0x7f8e69[_0xd9d3('0x13')]['message']);return _0x3fa81c(_0x7f8e69['error'][_0xd9d3('0x15')]);}logger['error'](_0xd9d3('0xe'),_0x19fba9,_0x7f8e69[_0xd9d3('0x13')][_0xd9d3('0x15')]);return _0x264c67(_0x7f8e69[_0xd9d3('0x13')][_0xd9d3('0x15')]);}else{logger[_0xd9d3('0xd')](_0xd9d3('0xe'),_0x19fba9,'request\x20sent');_0x264c67(_0x7f8e69[_0xd9d3('0x16')]['message']);}})['catch'](function(_0x31ff32){logger[_0xd9d3('0x13')](_0xd9d3('0xe'),_0x19fba9,_0x31ff32);_0x3fa81c(_0x31ff32);});});} \ No newline at end of file +var _0xea8f=['info','VtigerConfiguration,\x20%s,\x20%s','request\x20sent','VtigerConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','message','result','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','client','http','then'];(function(_0x299818,_0xc31e75){var _0x10aad3=function(_0x158dac){while(--_0x158dac){_0x299818['push'](_0x299818['shift']());}};_0x10aad3(++_0xc31e75);}(_0xea8f,0x171));var _0xfea8=function(_0x4b4931,_0x133090){_0x4b4931=_0x4b4931-0x0;var _0x295a54=_0xea8f[_0x4b4931];return _0x295a54;};'use strict';var _=require(_0xfea8('0x0'));var util=require('util');var moment=require(_0xfea8('0x1'));var BPromise=require(_0xfea8('0x2'));var rs=require(_0xfea8('0x3'));var fs=require('fs');var Redis=require(_0xfea8('0x4'));var db=require(_0xfea8('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xfea8('0x6'))(_0xfea8('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xfea8('0x8')][_0xfea8('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1fc2a7,_0xbc750d,_0x29bc5e){return new BPromise(function(_0x30caf6,_0x4c82a2){return client['request'](_0x1fc2a7,_0x29bc5e)[_0xfea8('0xa')](function(_0x4ba64e){logger[_0xfea8('0xb')](_0xfea8('0xc'),_0xbc750d,_0xfea8('0xd'));logger['debug'](_0xfea8('0xe'),_0xbc750d,'request\x20sent',JSON[_0xfea8('0xf')](_0x4ba64e));if(_0x4ba64e[_0xfea8('0x10')]){if(_0x4ba64e[_0xfea8('0x10')]['code']===0x1f4){logger[_0xfea8('0x10')]('VtigerConfiguration,\x20%s,\x20%s',_0xbc750d,_0x4ba64e[_0xfea8('0x10')][_0xfea8('0x11')]);return _0x4c82a2(_0x4ba64e[_0xfea8('0x10')][_0xfea8('0x11')]);}logger['error'](_0xfea8('0xc'),_0xbc750d,_0x4ba64e[_0xfea8('0x10')][_0xfea8('0x11')]);return _0x30caf6(_0x4ba64e[_0xfea8('0x10')][_0xfea8('0x11')]);}else{logger['info']('VtigerConfiguration,\x20%s,\x20%s',_0xbc750d,'request\x20sent');_0x30caf6(_0x4ba64e[_0xfea8('0x12')][_0xfea8('0x11')]);}})['catch'](function(_0x1cd130){logger[_0xfea8('0x10')](_0xfea8('0xc'),_0xbc750d,_0x1cd130);_0x4c82a2(_0x1cd130);});});} \ No newline at end of file diff --git a/server/api/intVtigerField/index.js b/server/api/intVtigerField/index.js index 0be15a2..119323c 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 _0x794d=['delete','destroy','exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intVtigerField.controller','get','/:id','isAuthenticated','post','create','update'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x794d,0x17d));var _0xd794=function(_0x33f2fa,_0x1411d5){_0x33f2fa=_0x33f2fa-0x0;var _0xe5b3b3=_0x794d[_0x33f2fa];return _0xe5b3b3;};'use strict';var multer=require('multer');var util=require(_0xd794('0x0'));var path=require(_0xd794('0x1'));var timeout=require(_0xd794('0x2'));var express=require(_0xd794('0x3'));var router=express[_0xd794('0x4')]();var auth=require(_0xd794('0x5'));var interaction=require(_0xd794('0x6'));var config=require(_0xd794('0x7'));var controller=require(_0xd794('0x8'));router[_0xd794('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0xd794('0x9')](_0xd794('0xa'),auth[_0xd794('0xb')](),controller['show']);router[_0xd794('0xc')]('/',auth[_0xd794('0xb')](),controller[_0xd794('0xd')]);router['put'](_0xd794('0xa'),auth[_0xd794('0xb')](),controller[_0xd794('0xe')]);router[_0xd794('0xf')](_0xd794('0xa'),auth[_0xd794('0xb')](),controller[_0xd794('0x10')]);module[_0xd794('0x11')]=router; \ No newline at end of file +var _0x84e5=['isAuthenticated','show','post','create','put','/:id','update','delete','destroy','multer','util','path','express','Router','../../components/interaction/service','../../config/environment','./intVtigerField.controller'];(function(_0x49bf38,_0x42c116){var _0xb76377=function(_0x4284b4){while(--_0x4284b4){_0x49bf38['push'](_0x49bf38['shift']());}};_0xb76377(++_0x42c116);}(_0x84e5,0xc4));var _0x584e=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0x84e5[_0x4565bf];return _0x5610ba;};'use strict';var multer=require(_0x584e('0x0'));var util=require(_0x584e('0x1'));var path=require(_0x584e('0x2'));var timeout=require('connect-timeout');var express=require(_0x584e('0x3'));var router=express[_0x584e('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x584e('0x5'));var config=require(_0x584e('0x6'));var controller=require(_0x584e('0x7'));router['get']('/',auth[_0x584e('0x8')](),controller['index']);router['get']('/:id',auth[_0x584e('0x8')](),controller[_0x584e('0x9')]);router[_0x584e('0xa')]('/',auth['isAuthenticated'](),controller[_0x584e('0xb')]);router[_0x584e('0xc')](_0x584e('0xd'),auth[_0x584e('0x8')](),controller[_0x584e('0xe')]);router[_0x584e('0xf')](_0x584e('0xd'),auth[_0x584e('0x8')](),controller[_0x584e('0x10')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.attributes.js b/server/api/intVtigerField/intVtigerField.attributes.js index bc94ba8..659b3a3 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 _0x8734=['customVariable','STRING','sequelize','ENUM','string','variable'];(function(_0x3cd5e6,_0x3400d8){var _0x567671=function(_0xb77110){while(--_0xb77110){_0x3cd5e6['push'](_0x3cd5e6['shift']());}};_0x567671(++_0x3400d8);}(_0x8734,0x134));var _0x4873=function(_0x3ad737,_0x300131){_0x3ad737=_0x3ad737-0x0;var _0x16c1e2=_0x8734[_0x3ad737];return _0x16c1e2;};'use strict';var Sequelize=require(_0x4873('0x0'));module['exports']={'type':{'type':Sequelize[_0x4873('0x1')](_0x4873('0x2'),_0x4873('0x3'),_0x4873('0x4'),'keyValue'),'defaultValue':_0x4873('0x2')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0x4873('0x5')]},'keyType':{'type':Sequelize[_0x4873('0x1')]('string',_0x4873('0x3'),'customVariable')},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0x4873('0x5')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x4873('0x5')]}}; \ No newline at end of file +var _0x4d33=['keyValue','STRING','ENUM','variable','BOOLEAN','exports','string'];(function(_0x5b644e,_0x2e5e07){var _0x49c6bf=function(_0x3032d9){while(--_0x3032d9){_0x5b644e['push'](_0x5b644e['shift']());}};_0x49c6bf(++_0x2e5e07);}(_0x4d33,0x1cc));var _0x34d3=function(_0x16bb4b,_0x5fe431){_0x16bb4b=_0x16bb4b-0x0;var _0x8aeb84=_0x4d33[_0x16bb4b];return _0x8aeb84;};'use strict';var Sequelize=require('sequelize');module[_0x34d3('0x0')]={'type':{'type':Sequelize['ENUM'](_0x34d3('0x1'),'variable','customVariable',_0x34d3('0x2')),'defaultValue':_0x34d3('0x1')},'content':{'type':Sequelize[_0x34d3('0x3')]},'key':{'type':Sequelize[_0x34d3('0x3')]},'keyType':{'type':Sequelize[_0x34d3('0x4')](_0x34d3('0x1'),_0x34d3('0x5'),'customVariable')},'keyContent':{'type':Sequelize[_0x34d3('0x3')]},'idField':{'type':Sequelize[_0x34d3('0x3')]},'nameField':{'type':Sequelize[_0x34d3('0x3')]},'customField':{'type':Sequelize[_0x34d3('0x6')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.controller.js b/server/api/intVtigerField/intVtigerField.controller.js index 252467c..132ffe0 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 _0xa0ad=['rimraf','fast-json-patch','request-promise','moment','mustache','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/utils','sendStatus','status','end','json','offset','limit','Content-Range','apply','save','update','then','error','stack','name','send','index','map','rawAttributes','fieldName','key','model','keys','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','filter','options','VtigerField','count','rows','includeAll','find','catch','create','body','params','destroy','html-pdf','eml-format'];(function(_0x2827d2,_0x5e4c47){var _0x306e07=function(_0x2130dc){while(--_0x2130dc){_0x2827d2['push'](_0x2827d2['shift']());}};_0x306e07(++_0x5e4c47);}(_0xa0ad,0x14d));var _0xda0a=function(_0xea343d,_0x311197){_0xea343d=_0xea343d-0x0;var _0x2c6e9c=_0xa0ad[_0xea343d];return _0x2c6e9c;};'use strict';var pdf=require(_0xda0a('0x0'));var emlformat=require(_0xda0a('0x1'));var rimraf=require(_0xda0a('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0xda0a('0x3'));var rp=require(_0xda0a('0x4'));var moment=require(_0xda0a('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xda0a('0x6'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0xda0a('0x7'));var ejs=require(_0xda0a('0x8'));var fs=require('fs');var _=require(_0xda0a('0x9'));var squel=require(_0xda0a('0xa'));var crypto=require(_0xda0a('0xb'));var jsforce=require(_0xda0a('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xda0a('0x7'));var querystring=require(_0xda0a('0xd'));var Papa=require(_0xda0a('0xe'));var Redis=require(_0xda0a('0xf'));var authService=require(_0xda0a('0x10'));var qs=require(_0xda0a('0x11'));var as=require(_0xda0a('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0xda0a('0x13'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x10a850,_0x46d59c){_0x46d59c=_0x46d59c||0xcc;return function(_0x2354c9){if(_0x2354c9){return _0x10a850[_0xda0a('0x14')](_0x46d59c);}return _0x10a850[_0xda0a('0x15')](_0x46d59c)[_0xda0a('0x16')]();};}function respondWithResult(_0x4644a1,_0xeece82){_0xeece82=_0xeece82||0xc8;return function(_0x3f37e2){if(_0x3f37e2){return _0x4644a1['status'](_0xeece82)[_0xda0a('0x17')](_0x3f37e2);}};}function respondWithFilteredResult(_0x20a9d2,_0x10d6db){return function(_0x3855fb){if(_0x3855fb){var _0xf8c5b7=_0x3855fb['count'],_0x22bd0f=_0x10d6db[_0xda0a('0x18')],_0x4d2757=_0x10d6db[_0xda0a('0x18')]+_0x10d6db[_0xda0a('0x19')],_0x2d4fed;if(_0x4d2757>=_0xf8c5b7){_0x4d2757=_0xf8c5b7;_0x2d4fed=0xc8;}else{_0x2d4fed=0xce;}_0x20a9d2['status'](_0x2d4fed);return _0x20a9d2['set'](_0xda0a('0x1a'),_0x22bd0f+'-'+_0x4d2757+'/'+_0xf8c5b7)[_0xda0a('0x17')](_0x3855fb);}return null;};}function patchUpdates(_0x449294){return function(_0x3d968a){try{jsonpatch[_0xda0a('0x1b')](_0x3d968a,_0x449294,!![]);}catch(_0x2fa84a){return BPromise['reject'](_0x2fa84a);}return _0x3d968a[_0xda0a('0x1c')]();};}function saveUpdates(_0x134c19,_0x50d32a){return function(_0x1ca7fb){if(_0x1ca7fb){return _0x1ca7fb[_0xda0a('0x1d')](_0x134c19)['then'](function(_0x5b6280){return _0x5b6280;});}return null;};}function removeEntity(_0x289afb,_0x428921){return function(_0x1dc1cd){if(_0x1dc1cd){return _0x1dc1cd['destroy']()[_0xda0a('0x1e')](function(){_0x289afb[_0xda0a('0x15')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3ec418,_0x4a8254){return function(_0x38e34d){if(!_0x38e34d){_0x3ec418[_0xda0a('0x14')](0x194);}return _0x38e34d;};}function handleError(_0x141079,_0x16ba50){_0x16ba50=_0x16ba50||0x1f4;return function(_0x5def8f){logger[_0xda0a('0x1f')](_0x5def8f[_0xda0a('0x20')]);if(_0x5def8f[_0xda0a('0x21')]){delete _0x5def8f[_0xda0a('0x21')];}_0x141079[_0xda0a('0x15')](_0x16ba50)[_0xda0a('0x22')](_0x5def8f);};}exports[_0xda0a('0x23')]=function(_0x41b26a,_0x53fe90){var _0x42b52a={},_0x57d4bf={},_0x2e04ee={'count':0x0,'rows':[]};var _0x582a14=_[_0xda0a('0x24')](db['VtigerField'][_0xda0a('0x25')],function(_0x5f4593){return{'name':_0x5f4593[_0xda0a('0x26')],'type':_0x5f4593['type'][_0xda0a('0x27')]};});_0x57d4bf[_0xda0a('0x28')]=_[_0xda0a('0x24')](_0x582a14,_0xda0a('0x21'));_0x57d4bf['query']=_[_0xda0a('0x29')](_0x41b26a[_0xda0a('0x2a')]);_0x57d4bf[_0xda0a('0x2b')]=_['intersection'](_0x57d4bf[_0xda0a('0x28')],_0x57d4bf['query']);_0x42b52a[_0xda0a('0x2c')]=_[_0xda0a('0x2d')](_0x57d4bf[_0xda0a('0x28')],qs[_0xda0a('0x2e')](_0x41b26a[_0xda0a('0x2a')][_0xda0a('0x2e')]));_0x42b52a['attributes']=_0x42b52a[_0xda0a('0x2c')][_0xda0a('0x2f')]?_0x42b52a[_0xda0a('0x2c')]:_0x57d4bf[_0xda0a('0x28')];if(!_0x41b26a[_0xda0a('0x2a')][_0xda0a('0x30')](_0xda0a('0x31'))){_0x42b52a['limit']=qs[_0xda0a('0x19')](_0x41b26a[_0xda0a('0x2a')][_0xda0a('0x19')]);_0x42b52a['offset']=qs[_0xda0a('0x18')](_0x41b26a['query'][_0xda0a('0x18')]);}_0x42b52a[_0xda0a('0x32')]=qs['sort'](_0x41b26a[_0xda0a('0x2a')][_0xda0a('0x33')]);_0x42b52a[_0xda0a('0x34')]=qs['filters'](_[_0xda0a('0x35')](_0x41b26a[_0xda0a('0x2a')],_0x57d4bf[_0xda0a('0x2b')]),_0x582a14);if(_0x41b26a[_0xda0a('0x2a')]['filter']){_0x42b52a['where']=_[_0xda0a('0x36')](_0x42b52a[_0xda0a('0x34')],{'$or':_[_0xda0a('0x24')](_0x582a14,function(_0x1f9eca){if(_0x1f9eca['type']!=='VIRTUAL'){var _0x5b3fb7={};_0x5b3fb7[_0x1f9eca[_0xda0a('0x21')]]={'$like':'%'+_0x41b26a[_0xda0a('0x2a')][_0xda0a('0x37')]+'%'};return _0x5b3fb7;}})});}_0x42b52a=_[_0xda0a('0x36')]({},_0x42b52a,_0x41b26a[_0xda0a('0x38')]);var _0x48f6ad={'where':_0x42b52a[_0xda0a('0x34')]};return db[_0xda0a('0x39')][_0xda0a('0x3a')](_0x48f6ad)[_0xda0a('0x1e')](function(_0x14e2bb){_0x2e04ee[_0xda0a('0x3a')]=_0x14e2bb;if(_0x41b26a['query']['includeAll']){_0x42b52a['include']=[{'all':!![]}];}return db['VtigerField']['findAll'](_0x42b52a);})['then'](function(_0x27acf6){_0x2e04ee[_0xda0a('0x3b')]=_0x27acf6;return _0x2e04ee;})[_0xda0a('0x1e')](respondWithFilteredResult(_0x53fe90,_0x42b52a))['catch'](handleError(_0x53fe90,null));};exports['show']=function(_0x51abb3,_0x38e94b){var _0x175864={'raw':!![],'where':{'id':_0x51abb3['params']['id']}},_0x727f6={};_0x727f6[_0xda0a('0x28')]=_[_0xda0a('0x29')](db[_0xda0a('0x39')][_0xda0a('0x25')]);_0x727f6['query']=_[_0xda0a('0x29')](_0x51abb3[_0xda0a('0x2a')]);_0x727f6['filters']=_[_0xda0a('0x2d')](_0x727f6[_0xda0a('0x28')],_0x727f6[_0xda0a('0x2a')]);_0x175864[_0xda0a('0x2c')]=_['intersection'](_0x727f6[_0xda0a('0x28')],qs['fields'](_0x51abb3['query'][_0xda0a('0x2e')]));_0x175864[_0xda0a('0x2c')]=_0x175864[_0xda0a('0x2c')][_0xda0a('0x2f')]?_0x175864[_0xda0a('0x2c')]:_0x727f6[_0xda0a('0x28')];if(_0x51abb3[_0xda0a('0x2a')][_0xda0a('0x3c')]){_0x175864['include']=[{'all':!![]}];}_0x175864=_[_0xda0a('0x36')]({},_0x175864,_0x51abb3['options']);return db[_0xda0a('0x39')][_0xda0a('0x3d')](_0x175864)[_0xda0a('0x1e')](handleEntityNotFound(_0x38e94b,null))[_0xda0a('0x1e')](respondWithResult(_0x38e94b,null))[_0xda0a('0x3e')](handleError(_0x38e94b,null));};exports[_0xda0a('0x3f')]=function(_0x21fbdd,_0x1afb16){return db[_0xda0a('0x39')][_0xda0a('0x3f')](_0x21fbdd['body'],{})[_0xda0a('0x1e')](respondWithResult(_0x1afb16,0xc9))[_0xda0a('0x3e')](handleError(_0x1afb16,null));};exports[_0xda0a('0x1d')]=function(_0xb93326,_0x42f63a){if(_0xb93326[_0xda0a('0x40')]['id']){delete _0xb93326[_0xda0a('0x40')]['id'];}return db[_0xda0a('0x39')][_0xda0a('0x3d')]({'where':{'id':_0xb93326[_0xda0a('0x41')]['id']}})[_0xda0a('0x1e')](handleEntityNotFound(_0x42f63a,null))['then'](saveUpdates(_0xb93326[_0xda0a('0x40')],null))['then'](respondWithResult(_0x42f63a,null))[_0xda0a('0x3e')](handleError(_0x42f63a,null));};exports[_0xda0a('0x42')]=function(_0x4df65d,_0x3dab3f){return db[_0xda0a('0x39')][_0xda0a('0x3d')]({'where':{'id':_0x4df65d[_0xda0a('0x41')]['id']}})['then'](handleEntityNotFound(_0x3dab3f,null))[_0xda0a('0x1e')](removeEntity(_0x3dab3f,null))['catch'](handleError(_0x3dab3f,null));}; \ No newline at end of file +var _0xbcc3=['to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','end','json','count','offset','limit','save','update','then','destroy','error','stack','name','send','map','VtigerField','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','include','rows','catch','show','includeAll','find','create','body','params','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','path','sox'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0xbcc3,0x86));var _0x3bcc=function(_0x43026b,_0x928d8c){_0x43026b=_0x43026b-0x0;var _0x4a96cd=_0xbcc3[_0x43026b];return _0x4a96cd;};'use strict';var pdf=require(_0x3bcc('0x0'));var emlformat=require(_0x3bcc('0x1'));var rimraf=require(_0x3bcc('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x3bcc('0x3'));var rp=require(_0x3bcc('0x4'));var moment=require('moment');var BPromise=require(_0x3bcc('0x5'));var Mustache=require(_0x3bcc('0x6'));var util=require(_0x3bcc('0x7'));var path=require(_0x3bcc('0x8'));var sox=require(_0x3bcc('0x9'));var csv=require(_0x3bcc('0xa'));var ejs=require(_0x3bcc('0xb'));var fs=require('fs');var _=require(_0x3bcc('0xc'));var squel=require(_0x3bcc('0xd'));var crypto=require('crypto');var jsforce=require(_0x3bcc('0xe'));var deskjs=require(_0x3bcc('0xf'));var toCsv=require('to-csv');var querystring=require(_0x3bcc('0x10'));var Papa=require(_0x3bcc('0x11'));var Redis=require(_0x3bcc('0x12'));var authService=require(_0x3bcc('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x3bcc('0x14'));var hardwareService=require(_0x3bcc('0x15'));var logger=require(_0x3bcc('0x16'))(_0x3bcc('0x17'));var utils=require(_0x3bcc('0x18'));var config=require('../../config/environment');var db=require(_0x3bcc('0x19'))['db'];function respondWithStatusCode(_0x39a685,_0x1a476f){_0x1a476f=_0x1a476f||0xcc;return function(_0x5474ee){if(_0x5474ee){return _0x39a685[_0x3bcc('0x1a')](_0x1a476f);}return _0x39a685[_0x3bcc('0x1b')](_0x1a476f)[_0x3bcc('0x1c')]();};}function respondWithResult(_0x442b08,_0x525bc6){_0x525bc6=_0x525bc6||0xc8;return function(_0x396e29){if(_0x396e29){return _0x442b08[_0x3bcc('0x1b')](_0x525bc6)[_0x3bcc('0x1d')](_0x396e29);}};}function respondWithFilteredResult(_0x54fe83,_0x5291f8){return function(_0x5f04d1){if(_0x5f04d1){var _0x507859=_0x5f04d1[_0x3bcc('0x1e')],_0x213f15=_0x5291f8['offset'],_0x33e5c5=_0x5291f8[_0x3bcc('0x1f')]+_0x5291f8[_0x3bcc('0x20')],_0x16681e;if(_0x33e5c5>=_0x507859){_0x33e5c5=_0x507859;_0x16681e=0xc8;}else{_0x16681e=0xce;}_0x54fe83[_0x3bcc('0x1b')](_0x16681e);return _0x54fe83['set']('Content-Range',_0x213f15+'-'+_0x33e5c5+'/'+_0x507859)[_0x3bcc('0x1d')](_0x5f04d1);}return null;};}function patchUpdates(_0x3d69da){return function(_0x60957a){try{jsonpatch['apply'](_0x60957a,_0x3d69da,!![]);}catch(_0x505b85){return BPromise['reject'](_0x505b85);}return _0x60957a[_0x3bcc('0x21')]();};}function saveUpdates(_0x26fce1,_0x1b3f1a){return function(_0x15f93a){if(_0x15f93a){return _0x15f93a[_0x3bcc('0x22')](_0x26fce1)[_0x3bcc('0x23')](function(_0x16fbd1){return _0x16fbd1;});}return null;};}function removeEntity(_0x9c25bc,_0x47f3ae){return function(_0x1529f3){if(_0x1529f3){return _0x1529f3[_0x3bcc('0x24')]()['then'](function(){_0x9c25bc[_0x3bcc('0x1b')](0xcc)[_0x3bcc('0x1c')]();});}};}function handleEntityNotFound(_0x1a0723,_0x43beca){return function(_0x187401){if(!_0x187401){_0x1a0723[_0x3bcc('0x1a')](0x194);}return _0x187401;};}function handleError(_0x22298b,_0x2a428b){_0x2a428b=_0x2a428b||0x1f4;return function(_0x2ddb22){logger[_0x3bcc('0x25')](_0x2ddb22[_0x3bcc('0x26')]);if(_0x2ddb22[_0x3bcc('0x27')]){delete _0x2ddb22['name'];}_0x22298b['status'](_0x2a428b)[_0x3bcc('0x28')](_0x2ddb22);};}exports['index']=function(_0x51a492,_0x55fe5a){var _0x2af150={},_0xce4e3b={},_0x5ebbe4={'count':0x0,'rows':[]};var _0x22006c=_[_0x3bcc('0x29')](db[_0x3bcc('0x2a')][_0x3bcc('0x2b')],function(_0xe10252){return{'name':_0xe10252[_0x3bcc('0x2c')],'type':_0xe10252['type'][_0x3bcc('0x2d')]};});_0xce4e3b[_0x3bcc('0x2e')]=_['map'](_0x22006c,'name');_0xce4e3b[_0x3bcc('0x2f')]=_[_0x3bcc('0x30')](_0x51a492[_0x3bcc('0x2f')]);_0xce4e3b[_0x3bcc('0x31')]=_[_0x3bcc('0x32')](_0xce4e3b[_0x3bcc('0x2e')],_0xce4e3b[_0x3bcc('0x2f')]);_0x2af150[_0x3bcc('0x33')]=_[_0x3bcc('0x32')](_0xce4e3b[_0x3bcc('0x2e')],qs[_0x3bcc('0x34')](_0x51a492[_0x3bcc('0x2f')]['fields']));_0x2af150[_0x3bcc('0x33')]=_0x2af150[_0x3bcc('0x33')][_0x3bcc('0x35')]?_0x2af150[_0x3bcc('0x33')]:_0xce4e3b[_0x3bcc('0x2e')];if(!_0x51a492[_0x3bcc('0x2f')][_0x3bcc('0x36')](_0x3bcc('0x37'))){_0x2af150[_0x3bcc('0x20')]=qs[_0x3bcc('0x20')](_0x51a492[_0x3bcc('0x2f')][_0x3bcc('0x20')]);_0x2af150[_0x3bcc('0x1f')]=qs['offset'](_0x51a492['query'][_0x3bcc('0x1f')]);}_0x2af150[_0x3bcc('0x38')]=qs[_0x3bcc('0x39')](_0x51a492[_0x3bcc('0x2f')][_0x3bcc('0x39')]);_0x2af150[_0x3bcc('0x3a')]=qs[_0x3bcc('0x31')](_['pick'](_0x51a492[_0x3bcc('0x2f')],_0xce4e3b[_0x3bcc('0x31')]),_0x22006c);if(_0x51a492[_0x3bcc('0x2f')][_0x3bcc('0x3b')]){_0x2af150[_0x3bcc('0x3a')]=_[_0x3bcc('0x3c')](_0x2af150[_0x3bcc('0x3a')],{'$or':_[_0x3bcc('0x29')](_0x22006c,function(_0x11789b){if(_0x11789b['type']!==_0x3bcc('0x3d')){var _0x74af1e={};_0x74af1e[_0x11789b[_0x3bcc('0x27')]]={'$like':'%'+_0x51a492[_0x3bcc('0x2f')][_0x3bcc('0x3b')]+'%'};return _0x74af1e;}})});}_0x2af150=_[_0x3bcc('0x3c')]({},_0x2af150,_0x51a492[_0x3bcc('0x3e')]);var _0x1ca79b={'where':_0x2af150['where']};return db[_0x3bcc('0x2a')][_0x3bcc('0x1e')](_0x1ca79b)[_0x3bcc('0x23')](function(_0x3e61b3){_0x5ebbe4[_0x3bcc('0x1e')]=_0x3e61b3;if(_0x51a492[_0x3bcc('0x2f')]['includeAll']){_0x2af150[_0x3bcc('0x3f')]=[{'all':!![]}];}return db['VtigerField']['findAll'](_0x2af150);})[_0x3bcc('0x23')](function(_0x3e4e37){_0x5ebbe4[_0x3bcc('0x40')]=_0x3e4e37;return _0x5ebbe4;})[_0x3bcc('0x23')](respondWithFilteredResult(_0x55fe5a,_0x2af150))[_0x3bcc('0x41')](handleError(_0x55fe5a,null));};exports[_0x3bcc('0x42')]=function(_0x2ed8bf,_0x5efcb7){var _0x5a5c23={'raw':!![],'where':{'id':_0x2ed8bf['params']['id']}},_0x20094f={};_0x20094f[_0x3bcc('0x2e')]=_['keys'](db['VtigerField'][_0x3bcc('0x2b')]);_0x20094f[_0x3bcc('0x2f')]=_['keys'](_0x2ed8bf[_0x3bcc('0x2f')]);_0x20094f[_0x3bcc('0x31')]=_[_0x3bcc('0x32')](_0x20094f['model'],_0x20094f[_0x3bcc('0x2f')]);_0x5a5c23[_0x3bcc('0x33')]=_['intersection'](_0x20094f[_0x3bcc('0x2e')],qs[_0x3bcc('0x34')](_0x2ed8bf['query'][_0x3bcc('0x34')]));_0x5a5c23['attributes']=_0x5a5c23[_0x3bcc('0x33')][_0x3bcc('0x35')]?_0x5a5c23['attributes']:_0x20094f[_0x3bcc('0x2e')];if(_0x2ed8bf[_0x3bcc('0x2f')][_0x3bcc('0x43')]){_0x5a5c23[_0x3bcc('0x3f')]=[{'all':!![]}];}_0x5a5c23=_['merge']({},_0x5a5c23,_0x2ed8bf[_0x3bcc('0x3e')]);return db[_0x3bcc('0x2a')][_0x3bcc('0x44')](_0x5a5c23)[_0x3bcc('0x23')](handleEntityNotFound(_0x5efcb7,null))[_0x3bcc('0x23')](respondWithResult(_0x5efcb7,null))[_0x3bcc('0x41')](handleError(_0x5efcb7,null));};exports[_0x3bcc('0x45')]=function(_0x486be6,_0x5b7f7f){return db[_0x3bcc('0x2a')][_0x3bcc('0x45')](_0x486be6[_0x3bcc('0x46')],{})[_0x3bcc('0x23')](respondWithResult(_0x5b7f7f,0xc9))[_0x3bcc('0x41')](handleError(_0x5b7f7f,null));};exports[_0x3bcc('0x22')]=function(_0x46fe47,_0x84cb0){if(_0x46fe47[_0x3bcc('0x46')]['id']){delete _0x46fe47[_0x3bcc('0x46')]['id'];}return db[_0x3bcc('0x2a')][_0x3bcc('0x44')]({'where':{'id':_0x46fe47['params']['id']}})[_0x3bcc('0x23')](handleEntityNotFound(_0x84cb0,null))[_0x3bcc('0x23')](saveUpdates(_0x46fe47[_0x3bcc('0x46')],null))['then'](respondWithResult(_0x84cb0,null))[_0x3bcc('0x41')](handleError(_0x84cb0,null));};exports[_0x3bcc('0x24')]=function(_0x552f52,_0x3255c7){return db['VtigerField']['find']({'where':{'id':_0x552f52[_0x3bcc('0x47')]['id']}})[_0x3bcc('0x23')](handleEntityNotFound(_0x3255c7,null))[_0x3bcc('0x23')](removeEntity(_0x3255c7,null))[_0x3bcc('0x41')](handleError(_0x3255c7,null));}; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.model.js b/server/api/intVtigerField/intVtigerField.model.js index 0b35a98..e519c85 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(_0x42b7b4,_0x1e0f4e){var _0xd17514=function(_0x1f8201){while(--_0x1f8201){_0x42b7b4['push'](_0x42b7b4['shift']());}};_0xd17514(++_0x1e0f4e);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4c7fb5,_0x2548ef){_0x4c7fb5=_0x4c7fb5-0x0;var _0x2e10ac=_0xa9e0[_0x4c7fb5];return _0x2e10ac;};'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 _0xf3cd=['int_vtiger_fields','idField','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','exports','define','VtigerField'];(function(_0x1aba25,_0x1faed1){var _0x47d997=function(_0x4f9e11){while(--_0x4f9e11){_0x1aba25['push'](_0x1aba25['shift']());}};_0x47d997(++_0x1faed1);}(_0xf3cd,0xfe));var _0xdf3c=function(_0x51b19b,_0x5015d2){_0x51b19b=_0x51b19b-0x0;var _0x1a3cd6=_0xf3cd[_0x51b19b];return _0x1a3cd6;};'use strict';var _=require(_0xdf3c('0x0'));var util=require(_0xdf3c('0x1'));var logger=require(_0xdf3c('0x2'))(_0xdf3c('0x3'));var moment=require(_0xdf3c('0x4'));var BPromise=require(_0xdf3c('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xdf3c('0x6'));var rimraf=require(_0xdf3c('0x7'));var config=require(_0xdf3c('0x8'));var attributes=require('./intVtigerField.attributes');module[_0xdf3c('0x9')]=function(_0x17d42a,_0x1313d5){return _0x17d42a[_0xdf3c('0xa')](_0xdf3c('0xb'),attributes,{'tableName':_0xdf3c('0xc'),'paranoid':![],'indexes':[{'name':'vtiger_unique_index','fields':[_0xdf3c('0xd'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.rpc.js b/server/api/intVtigerField/intVtigerField.rpc.js index 58565ba..6f04ce2 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 _0x1f81=['message','result','catch','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','VtigerField,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code'];(function(_0xd09668,_0x1435b2){var _0x68726=function(_0x54a030){while(--_0x54a030){_0xd09668['push'](_0xd09668['shift']());}};_0x68726(++_0x1435b2);}(_0x1f81,0xab));var _0x11f8=function(_0x2b5513,_0x3fe5cd){_0x2b5513=_0x2b5513-0x0;var _0x578fd2=_0x1f81[_0x2b5513];return _0x578fd2;};'use strict';var _=require(_0x11f8('0x0'));var util=require(_0x11f8('0x1'));var moment=require('moment');var BPromise=require(_0x11f8('0x2'));var rs=require(_0x11f8('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x11f8('0x4'))['db'];var utils=require(_0x11f8('0x5'));var logger=require(_0x11f8('0x6'))(_0x11f8('0x7'));var config=require(_0x11f8('0x8'));var jayson=require(_0x11f8('0x9'));var client=jayson[_0x11f8('0xa')][_0x11f8('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4fd0cf,_0x1d899d,_0x8009d7){return new BPromise(function(_0x1cecbe,_0x1bc74d){return client[_0x11f8('0xc')](_0x4fd0cf,_0x8009d7)[_0x11f8('0xd')](function(_0x5ec20c){logger[_0x11f8('0xe')](_0x11f8('0xf'),_0x1d899d,_0x11f8('0x10'));logger[_0x11f8('0x11')]('VtigerField,\x20%s,\x20%s,\x20%s',_0x1d899d,_0x11f8('0x10'),JSON[_0x11f8('0x12')](_0x5ec20c));if(_0x5ec20c[_0x11f8('0x13')]){if(_0x5ec20c[_0x11f8('0x13')][_0x11f8('0x14')]===0x1f4){logger[_0x11f8('0x13')]('VtigerField,\x20%s,\x20%s',_0x1d899d,_0x5ec20c[_0x11f8('0x13')][_0x11f8('0x15')]);return _0x1bc74d(_0x5ec20c[_0x11f8('0x13')]['message']);}logger[_0x11f8('0x13')](_0x11f8('0xf'),_0x1d899d,_0x5ec20c[_0x11f8('0x13')][_0x11f8('0x15')]);return _0x1cecbe(_0x5ec20c['error'][_0x11f8('0x15')]);}else{logger[_0x11f8('0xe')](_0x11f8('0xf'),_0x1d899d,_0x11f8('0x10'));_0x1cecbe(_0x5ec20c[_0x11f8('0x16')]['message']);}})[_0x11f8('0x17')](function(_0x3e7fb3){logger['error'](_0x11f8('0xf'),_0x1d899d,_0x3e7fb3);_0x1bc74d(_0x3e7fb3);});});} \ No newline at end of file +var _0x5454=['stringify','error','code','message','result','bluebird','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info','VtigerField,\x20%s,\x20%s','request\x20sent','VtigerField,\x20%s,\x20%s,\x20%s'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x5454,0x15b));var _0x4545=function(_0x38796c,_0x1fd608){_0x38796c=_0x38796c-0x0;var _0x53683a=_0x5454[_0x38796c];return _0x53683a;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0x4545('0x0'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x4545('0x1'));var logger=require(_0x4545('0x2'))(_0x4545('0x3'));var config=require(_0x4545('0x4'));var jayson=require('jayson/promise');var client=jayson[_0x4545('0x5')][_0x4545('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x6fd3bb,_0xc79c57,_0x3f1134){return new BPromise(function(_0x1fd7e5,_0x1c5649){return client[_0x4545('0x7')](_0x6fd3bb,_0x3f1134)[_0x4545('0x8')](function(_0x3e2526){logger[_0x4545('0x9')](_0x4545('0xa'),_0xc79c57,_0x4545('0xb'));logger['debug'](_0x4545('0xc'),_0xc79c57,_0x4545('0xb'),JSON[_0x4545('0xd')](_0x3e2526));if(_0x3e2526[_0x4545('0xe')]){if(_0x3e2526[_0x4545('0xe')][_0x4545('0xf')]===0x1f4){logger['error'](_0x4545('0xa'),_0xc79c57,_0x3e2526[_0x4545('0xe')][_0x4545('0x10')]);return _0x1c5649(_0x3e2526[_0x4545('0xe')][_0x4545('0x10')]);}logger[_0x4545('0xe')](_0x4545('0xa'),_0xc79c57,_0x3e2526[_0x4545('0xe')][_0x4545('0x10')]);return _0x1fd7e5(_0x3e2526[_0x4545('0xe')][_0x4545('0x10')]);}else{logger['info'](_0x4545('0xa'),_0xc79c57,_0x4545('0xb'));_0x1fd7e5(_0x3e2526[_0x4545('0x11')][_0x4545('0x10')]);}})['catch'](function(_0x4a5bdf){logger[_0x4545('0xe')](_0x4545('0xa'),_0xc79c57,_0x4a5bdf);_0x1c5649(_0x4a5bdf);});});} \ No newline at end of file diff --git a/server/api/intZendeskAccount/index.js b/server/api/intZendeskAccount/index.js index d4d8a56..0fb3bd2 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 _0x48a5=['multer','connect-timeout','../../components/auth/service','../../components/interaction/service','./intZendeskAccount.controller','isAuthenticated','index','get','/:id','/:id/configurations','getConfigurations','/:id/fields','post','create','addConfiguration','put','update','delete','destroy','exports'];(function(_0x284718,_0x36e15a){var _0xbe7d41=function(_0x4903be){while(--_0x4903be){_0x284718['push'](_0x284718['shift']());}};_0xbe7d41(++_0x36e15a);}(_0x48a5,0xb4));var _0x548a=function(_0x40dc15,_0x434092){_0x40dc15=_0x40dc15-0x0;var _0x4f1a5c=_0x48a5[_0x40dc15];return _0x4f1a5c;};'use strict';var multer=require(_0x548a('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x548a('0x1'));var express=require('express');var router=express['Router']();var auth=require(_0x548a('0x2'));var interaction=require(_0x548a('0x3'));var config=require('../../config/environment');var controller=require(_0x548a('0x4'));router['get']('/',auth[_0x548a('0x5')](),controller[_0x548a('0x6')]);router[_0x548a('0x7')](_0x548a('0x8'),auth[_0x548a('0x5')](),controller['show']);router['get'](_0x548a('0x9'),auth[_0x548a('0x5')](),controller[_0x548a('0xa')]);router[_0x548a('0x7')](_0x548a('0xb'),auth[_0x548a('0x5')](),controller['getFields']);router[_0x548a('0xc')]('/',auth[_0x548a('0x5')](),controller[_0x548a('0xd')]);router[_0x548a('0xc')](_0x548a('0x9'),auth[_0x548a('0x5')](),controller[_0x548a('0xe')]);router[_0x548a('0xf')](_0x548a('0x8'),auth['isAuthenticated'](),controller[_0x548a('0x10')]);router[_0x548a('0x11')]('/:id',auth[_0x548a('0x5')](),controller[_0x548a('0x12')]);module[_0x548a('0x13')]=router; \ No newline at end of file +var _0xa04b=['isAuthenticated','show','/:id/configurations','getConfigurations','/:id/fields','getFields','post','addConfiguration','put','/:id','destroy','multer','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./intZendeskAccount.controller','get'];(function(_0x2158eb,_0x398886){var _0xaa3a7a=function(_0x4b339e){while(--_0x4b339e){_0x2158eb['push'](_0x2158eb['shift']());}};_0xaa3a7a(++_0x398886);}(_0xa04b,0x15f));var _0xba04=function(_0x29d39d,_0x49425c){_0x29d39d=_0x29d39d-0x0;var _0x4beb88=_0xa04b[_0x29d39d];return _0x4beb88;};'use strict';var multer=require(_0xba04('0x0'));var util=require('util');var path=require(_0xba04('0x1'));var timeout=require(_0xba04('0x2'));var express=require(_0xba04('0x3'));var router=express[_0xba04('0x4')]();var auth=require(_0xba04('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xba04('0x6'));var controller=require(_0xba04('0x7'));router[_0xba04('0x8')]('/',auth[_0xba04('0x9')](),controller['index']);router[_0xba04('0x8')]('/:id',auth['isAuthenticated'](),controller[_0xba04('0xa')]);router[_0xba04('0x8')](_0xba04('0xb'),auth[_0xba04('0x9')](),controller[_0xba04('0xc')]);router[_0xba04('0x8')](_0xba04('0xd'),auth[_0xba04('0x9')](),controller[_0xba04('0xe')]);router[_0xba04('0xf')]('/',auth[_0xba04('0x9')](),controller['create']);router[_0xba04('0xf')]('/:id/configurations',auth[_0xba04('0x9')](),controller[_0xba04('0x10')]);router[_0xba04('0x11')](_0xba04('0x12'),auth[_0xba04('0x9')](),controller['update']);router['delete'](_0xba04('0x12'),auth['isAuthenticated'](),controller[_0xba04('0x13')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.attributes.js b/server/api/intZendeskAccount/intZendeskAccount.attributes.js index 39f286f..ee2ed75 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 _0xc29e=['sequelize','exports','STRING','username','remoteUri','ENUM','token','password','integrationTab','newTab'];(function(_0x3d6252,_0x52589a){var _0x4c3b36=function(_0x53308c){while(--_0x53308c){_0x3d6252['push'](_0x3d6252['shift']());}};_0x4c3b36(++_0x52589a);}(_0xc29e,0x82));var _0xec29=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xc29e[_0xa464c9];return _0x3d73c4;};'use strict';var Sequelize=require(_0xec29('0x0'));module[_0xec29('0x1')]={'name':{'type':Sequelize[_0xec29('0x2')]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize['STRING'],'unique':_0xec29('0x3')},'password':{'type':Sequelize[_0xec29('0x2')]},'token':{'type':Sequelize[_0xec29('0x2')]},'remoteUri':{'type':Sequelize[_0xec29('0x2')],'unique':_0xec29('0x4')},'authType':{'type':Sequelize[_0xec29('0x5')]('password',_0xec29('0x6')),'defaultValue':_0xec29('0x7')},'serverUrl':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0xec29('0x5')](_0xec29('0x8'),_0xec29('0x9')),'defaultValue':_0xec29('0x8')}}; \ No newline at end of file +var _0xb0f7=['username','ENUM','password','token','integrationTab','newTab','STRING'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xb0f7,0xae));var _0x7b0f=function(_0x545b34,_0x261f32){_0x545b34=_0x545b34-0x0;var _0x544fe3=_0xb0f7[_0x545b34];return _0x544fe3;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x7b0f('0x0')]},'description':{'type':Sequelize[_0x7b0f('0x0')]},'username':{'type':Sequelize['STRING'],'unique':_0x7b0f('0x1')},'password':{'type':Sequelize[_0x7b0f('0x0')]},'token':{'type':Sequelize[_0x7b0f('0x0')]},'remoteUri':{'type':Sequelize['STRING'],'unique':'remoteUri'},'authType':{'type':Sequelize[_0x7b0f('0x2')](_0x7b0f('0x3'),_0x7b0f('0x4')),'defaultValue':_0x7b0f('0x3')},'serverUrl':{'type':Sequelize[_0x7b0f('0x0')]},'type':{'type':Sequelize[_0x7b0f('0x2')](_0x7b0f('0x5'),_0x7b0f('0x6')),'defaultValue':_0x7b0f('0x5')}}; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.controller.js b/server/api/intZendeskAccount/intZendeskAccount.controller.js index 2454e1b..c7f1390 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 _0xa9cd=['base64','headers','Basic\x20%s','%s/token:%s','token','toString','Sequelize','Unknown\x20authentication\x20type','subject','description','assignee','remove','includes','position','title','system_field_options','custom_field_options','statusCode','Wrong\x20credentials','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','jayson/promise','test','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','then','info','request\x20sent','debug','stringify','error','code','message','catch','sendStatus','status','end','json','count','offset','set','Content-Range','apply','reject','destroy','stack','name','send','index','map','ZendeskAccount','rawAttributes','fieldName','type','key','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','merge','options','includeAll','include','findAll','rows','show','keys','find','create','body','params','getConfigurations','ZendeskConfiguration','addConfiguration','findOne','AccountId','Subjects','getSubjects','channel','getDescriptions','ZendeskField','Descriptions','getFields','username','password','remoteUri','substring','lastIndexOf','GET','format','%s/%s','ticket_fields','%s:%s'];(function(_0x44dc7f,_0x1e6e7d){var _0x7bada7=function(_0x469b89){while(--_0x469b89){_0x44dc7f['push'](_0x44dc7f['shift']());}};_0x7bada7(++_0x1e6e7d);}(_0xa9cd,0x93));var _0xda9c=function(_0x1768b8,_0x434585){_0x1768b8=_0x1768b8-0x0;var _0x3c5784=_0xa9cd[_0x1768b8];return _0x3c5784;};'use strict';var pdf=require(_0xda9c('0x0'));var emlformat=require(_0xda9c('0x1'));var rimraf=require(_0xda9c('0x2'));var zipdir=require(_0xda9c('0x3'));var jsonpatch=require(_0xda9c('0x4'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xda9c('0x5'));var Mustache=require(_0xda9c('0x6'));var util=require(_0xda9c('0x7'));var path=require('path');var sox=require(_0xda9c('0x8'));var csv=require(_0xda9c('0x9'));var ejs=require(_0xda9c('0xa'));var fs=require('fs');var _=require(_0xda9c('0xb'));var squel=require(_0xda9c('0xc'));var crypto=require(_0xda9c('0xd'));var jsforce=require(_0xda9c('0xe'));var deskjs=require(_0xda9c('0xf'));var toCsv=require('to-csv');var querystring=require(_0xda9c('0x10'));var Papa=require(_0xda9c('0x11'));var Redis=require(_0xda9c('0x12'));var authService=require(_0xda9c('0x13'));var qs=require(_0xda9c('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xda9c('0x15'));var logger=require(_0xda9c('0x16'))('api');var utils=require(_0xda9c('0x17'));var config=require(_0xda9c('0x18'));var db=require(_0xda9c('0x19'))['db'];var integrations=require('../../components/integrations/configuration');var jayson=require(_0xda9c('0x1a'));var client=jayson['client']['http']({'port':0x232a});function checkPasswordPattern(_0x32de38,_0x29b1a2,_0x4da961){if(_0x4da961){var _0x4ef9e7=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x4ef9e7[_0xda9c('0x1b')](_0x29b1a2)){return _0x32de38;}else{throw new db['Sequelize'][(_0xda9c('0x1c'))](_0xda9c('0x1d'));}}else{return _0x32de38;}}function respondWithRpcPromise(_0x1197a1,_0x10a6b6,_0x323b14,_0x206775){return new BPromise(function(_0x35dbf1,_0x4d76db){var _0x3cdd86=_0x206775||client;return _0x3cdd86['request'](_0x1197a1,_0x323b14)[_0xda9c('0x1e')](function(_0x30cbf7){logger[_0xda9c('0x1f')]('ZendeskAccount,\x20%s,\x20%s',_0x10a6b6,_0xda9c('0x20'));logger[_0xda9c('0x21')]('ZendeskAccount,\x20%s,\x20%s,\x20%s',_0x10a6b6,_0xda9c('0x20'),JSON[_0xda9c('0x22')](_0x30cbf7));if(_0x30cbf7[_0xda9c('0x23')]){if(_0x30cbf7[_0xda9c('0x23')][_0xda9c('0x24')]===0x1f4){logger[_0xda9c('0x23')]('ZendeskAccount,\x20%s,\x20%s',_0x10a6b6,_0x30cbf7[_0xda9c('0x23')]['message']);return _0x4d76db(_0x30cbf7[_0xda9c('0x23')][_0xda9c('0x25')]);}logger['error']('ZendeskAccount,\x20%s,\x20%s',_0x10a6b6,_0x30cbf7[_0xda9c('0x23')][_0xda9c('0x25')]);return _0x35dbf1(_0x30cbf7['error']['message']);}else{logger[_0xda9c('0x1f')]('ZendeskAccount,\x20%s,\x20%s',_0x10a6b6,_0xda9c('0x20'));_0x35dbf1(_0x30cbf7['result'][_0xda9c('0x25')]);}})[_0xda9c('0x26')](function(_0x1b4156){logger['error']('ZendeskAccount,\x20%s,\x20%s',_0x10a6b6,_0x1b4156);_0x4d76db(_0x1b4156);});});}function respondWithStatusCode(_0x2077db,_0x38badd){_0x38badd=_0x38badd||0xcc;return function(_0x59aa54){if(_0x59aa54){return _0x2077db[_0xda9c('0x27')](_0x38badd);}return _0x2077db[_0xda9c('0x28')](_0x38badd)[_0xda9c('0x29')]();};}function respondWithResult(_0x30a4cf,_0x316734){_0x316734=_0x316734||0xc8;return function(_0x3140d3){if(_0x3140d3){return _0x30a4cf[_0xda9c('0x28')](_0x316734)[_0xda9c('0x2a')](_0x3140d3);}};}function respondWithFilteredResult(_0x634bad,_0x3c3eac){return function(_0x33a4c4){if(_0x33a4c4){var _0x38598d=_0x33a4c4[_0xda9c('0x2b')],_0x3d34eb=_0x3c3eac[_0xda9c('0x2c')],_0x2cfeb5=_0x3c3eac['offset']+_0x3c3eac['limit'],_0x49a31d;if(_0x2cfeb5>=_0x38598d){_0x2cfeb5=_0x38598d;_0x49a31d=0xc8;}else{_0x49a31d=0xce;}_0x634bad[_0xda9c('0x28')](_0x49a31d);return _0x634bad[_0xda9c('0x2d')](_0xda9c('0x2e'),_0x3d34eb+'-'+_0x2cfeb5+'/'+_0x38598d)[_0xda9c('0x2a')](_0x33a4c4);}return null;};}function patchUpdates(_0x1bd32a){return function(_0x49ff5a){try{jsonpatch[_0xda9c('0x2f')](_0x49ff5a,_0x1bd32a,!![]);}catch(_0x1e854b){return BPromise[_0xda9c('0x30')](_0x1e854b);}return _0x49ff5a['save']();};}function saveUpdates(_0x160aa2,_0x3d8614){return function(_0x1d7273){if(_0x1d7273){return _0x1d7273['update'](_0x160aa2)[_0xda9c('0x1e')](function(_0x4d64ee){return _0x4d64ee;});}return null;};}function removeEntity(_0x19535e,_0x104058){return function(_0x4cb936){if(_0x4cb936){return _0x4cb936[_0xda9c('0x31')]()[_0xda9c('0x1e')](function(){_0x19535e[_0xda9c('0x28')](0xcc)[_0xda9c('0x29')]();});}};}function handleEntityNotFound(_0x318259,_0x552f07){return function(_0x506197){if(!_0x506197){_0x318259['sendStatus'](0x194);}return _0x506197;};}function handleError(_0x33ffec,_0x4af494){_0x4af494=_0x4af494||0x1f4;return function(_0x1c4112){logger['error'](_0x1c4112[_0xda9c('0x32')]);if(_0x1c4112[_0xda9c('0x33')]){delete _0x1c4112['name'];}_0x33ffec[_0xda9c('0x28')](_0x4af494)[_0xda9c('0x34')](_0x1c4112);};}exports[_0xda9c('0x35')]=function(_0x2ab7e0,_0x3c1440){var _0x1b7ccd={},_0x3e9325={},_0x1cb234={'count':0x0,'rows':[]};var _0x35db19=_[_0xda9c('0x36')](db[_0xda9c('0x37')][_0xda9c('0x38')],function(_0xe7c021){return{'name':_0xe7c021[_0xda9c('0x39')],'type':_0xe7c021[_0xda9c('0x3a')][_0xda9c('0x3b')]};});_0x3e9325['model']=_[_0xda9c('0x36')](_0x35db19,'name');_0x3e9325[_0xda9c('0x3c')]=_['keys'](_0x2ab7e0['query']);_0x3e9325[_0xda9c('0x3d')]=_[_0xda9c('0x3e')](_0x3e9325[_0xda9c('0x3f')],_0x3e9325['query']);_0x1b7ccd[_0xda9c('0x40')]=_['intersection'](_0x3e9325[_0xda9c('0x3f')],qs[_0xda9c('0x41')](_0x2ab7e0[_0xda9c('0x3c')][_0xda9c('0x41')]));_0x1b7ccd['attributes']=_0x1b7ccd['attributes'][_0xda9c('0x42')]?_0x1b7ccd[_0xda9c('0x40')]:_0x3e9325[_0xda9c('0x3f')];if(!_0x2ab7e0[_0xda9c('0x3c')][_0xda9c('0x43')](_0xda9c('0x44'))){_0x1b7ccd[_0xda9c('0x45')]=qs['limit'](_0x2ab7e0['query'][_0xda9c('0x45')]);_0x1b7ccd[_0xda9c('0x2c')]=qs[_0xda9c('0x2c')](_0x2ab7e0[_0xda9c('0x3c')]['offset']);}_0x1b7ccd[_0xda9c('0x46')]=qs[_0xda9c('0x47')](_0x2ab7e0[_0xda9c('0x3c')][_0xda9c('0x47')]);_0x1b7ccd[_0xda9c('0x48')]=qs[_0xda9c('0x3d')](_[_0xda9c('0x49')](_0x2ab7e0[_0xda9c('0x3c')],_0x3e9325[_0xda9c('0x3d')]),_0x35db19);if(_0x2ab7e0[_0xda9c('0x3c')][_0xda9c('0x4a')]){_0x1b7ccd['where']=_['merge'](_0x1b7ccd[_0xda9c('0x48')],{'$or':_[_0xda9c('0x36')](_0x35db19,function(_0x16c756){if(_0x16c756['type']!=='VIRTUAL'){var _0x448baf={};_0x448baf[_0x16c756[_0xda9c('0x33')]]={'$like':'%'+_0x2ab7e0[_0xda9c('0x3c')][_0xda9c('0x4a')]+'%'};return _0x448baf;}})});}_0x1b7ccd=_[_0xda9c('0x4b')]({},_0x1b7ccd,_0x2ab7e0[_0xda9c('0x4c')]);var _0x5a6ba1={'where':_0x1b7ccd[_0xda9c('0x48')]};return db[_0xda9c('0x37')][_0xda9c('0x2b')](_0x5a6ba1)['then'](function(_0x26e28a){_0x1cb234['count']=_0x26e28a;if(_0x2ab7e0['query'][_0xda9c('0x4d')]){_0x1b7ccd[_0xda9c('0x4e')]=[{'all':!![]}];}return db[_0xda9c('0x37')][_0xda9c('0x4f')](_0x1b7ccd);})[_0xda9c('0x1e')](function(_0x799ded){_0x1cb234[_0xda9c('0x50')]=_0x799ded;return _0x1cb234;})[_0xda9c('0x1e')](respondWithFilteredResult(_0x3c1440,_0x1b7ccd))['catch'](handleError(_0x3c1440,null));};exports[_0xda9c('0x51')]=function(_0x566b6d,_0x4a2ceb){var _0x253b42={'raw':![],'where':{'id':_0x566b6d['params']['id']}},_0x5e801b={};_0x5e801b[_0xda9c('0x3f')]=_[_0xda9c('0x52')](db['ZendeskAccount']['rawAttributes']);_0x5e801b[_0xda9c('0x3c')]=_[_0xda9c('0x52')](_0x566b6d[_0xda9c('0x3c')]);_0x5e801b[_0xda9c('0x3d')]=_[_0xda9c('0x3e')](_0x5e801b[_0xda9c('0x3f')],_0x5e801b[_0xda9c('0x3c')]);_0x253b42[_0xda9c('0x40')]=_[_0xda9c('0x3e')](_0x5e801b[_0xda9c('0x3f')],qs[_0xda9c('0x41')](_0x566b6d['query']['fields']));_0x253b42[_0xda9c('0x40')]=_0x253b42[_0xda9c('0x40')][_0xda9c('0x42')]?_0x253b42[_0xda9c('0x40')]:_0x5e801b[_0xda9c('0x3f')];if(_0x566b6d[_0xda9c('0x3c')][_0xda9c('0x4d')]){_0x253b42['include']=[{'all':!![]}];}_0x253b42=_[_0xda9c('0x4b')]({},_0x253b42,_0x566b6d[_0xda9c('0x4c')]);return db[_0xda9c('0x37')][_0xda9c('0x53')](_0x253b42)[_0xda9c('0x1e')](handleEntityNotFound(_0x4a2ceb,null))[_0xda9c('0x1e')](respondWithResult(_0x4a2ceb,null))['catch'](handleError(_0x4a2ceb,null));};exports[_0xda9c('0x54')]=function(_0x19af99,_0x3cb0a8){return db[_0xda9c('0x37')]['create'](_0x19af99['body'],{})['then'](respondWithResult(_0x3cb0a8,0xc9))[_0xda9c('0x26')](handleError(_0x3cb0a8,null));};exports['update']=function(_0x26e784,_0x240de2){if(_0x26e784[_0xda9c('0x55')]['id']){delete _0x26e784['body']['id'];}return db[_0xda9c('0x37')]['find']({'where':{'id':_0x26e784[_0xda9c('0x56')]['id']}})[_0xda9c('0x1e')](handleEntityNotFound(_0x240de2,null))[_0xda9c('0x1e')](saveUpdates(_0x26e784[_0xda9c('0x55')],null))[_0xda9c('0x1e')](respondWithResult(_0x240de2,null))[_0xda9c('0x26')](handleError(_0x240de2,null));};exports[_0xda9c('0x31')]=function(_0x18622a,_0x4fad78){return db['ZendeskAccount'][_0xda9c('0x53')]({'where':{'id':_0x18622a[_0xda9c('0x56')]['id']}})['then'](handleEntityNotFound(_0x4fad78,null))['then'](removeEntity(_0x4fad78,null))[_0xda9c('0x26')](handleError(_0x4fad78,null));};exports[_0xda9c('0x57')]=function(_0x50d35b,_0x31bce6,_0x4b3c4b){var _0x4e8881={};var _0x2048c3={};var _0x48b025;var _0x4c649f;return db[_0xda9c('0x37')]['findOne']({'where':{'id':_0x50d35b['params']['id']}})[_0xda9c('0x1e')](handleEntityNotFound(_0x31bce6,null))[_0xda9c('0x1e')](function(_0x5a2433){if(_0x5a2433){_0x48b025=_0x5a2433;_0x2048c3[_0xda9c('0x3f')]=_[_0xda9c('0x52')](db[_0xda9c('0x58')][_0xda9c('0x38')]);_0x2048c3['query']=_[_0xda9c('0x52')](_0x50d35b[_0xda9c('0x3c')]);_0x2048c3[_0xda9c('0x3d')]=_['intersection'](_0x2048c3[_0xda9c('0x3f')],_0x2048c3[_0xda9c('0x3c')]);_0x4e8881[_0xda9c('0x40')]=_[_0xda9c('0x3e')](_0x2048c3[_0xda9c('0x3f')],qs[_0xda9c('0x41')](_0x50d35b[_0xda9c('0x3c')][_0xda9c('0x41')]));_0x4e8881[_0xda9c('0x40')]=_0x4e8881[_0xda9c('0x40')][_0xda9c('0x42')]?_0x4e8881[_0xda9c('0x40')]:_0x2048c3[_0xda9c('0x3f')];_0x4e8881['order']=qs[_0xda9c('0x47')](_0x50d35b['query'][_0xda9c('0x47')]);_0x4e8881['where']=qs[_0xda9c('0x3d')](_['pick'](_0x50d35b['query'],_0x2048c3['filters']));if(_0x50d35b['query'][_0xda9c('0x4a')]){_0x4e8881[_0xda9c('0x48')]=_[_0xda9c('0x4b')](_0x4e8881[_0xda9c('0x48')],{'$or':_['map'](_0x4e8881[_0xda9c('0x40')],function(_0xa28e29){var _0x7bf09={};_0x7bf09[_0xa28e29]={'$like':'%'+_0x50d35b['query'][_0xda9c('0x4a')]+'%'};return _0x7bf09;})});}_0x4e8881=_[_0xda9c('0x4b')]({},_0x4e8881,_0x50d35b['options']);return _0x48b025[_0xda9c('0x57')](_0x4e8881);}})['then'](function(_0x540910){if(_0x540910){_0x4c649f=_0x540910[_0xda9c('0x42')];if(!_0x50d35b['query'][_0xda9c('0x43')](_0xda9c('0x44'))){_0x4e8881[_0xda9c('0x45')]=qs[_0xda9c('0x45')](_0x50d35b[_0xda9c('0x3c')][_0xda9c('0x45')]);_0x4e8881['offset']=qs[_0xda9c('0x2c')](_0x50d35b['query'][_0xda9c('0x2c')]);}return _0x48b025[_0xda9c('0x57')](_0x4e8881);}})[_0xda9c('0x1e')](function(_0x258402){if(_0x258402){return _0x258402?{'count':_0x4c649f,'rows':_0x258402}:null;}})[_0xda9c('0x1e')](respondWithResult(_0x31bce6,null))['catch'](handleError(_0x31bce6,null));};exports[_0xda9c('0x59')]=function(_0x2e898e,_0x52d767,_0x586aec){if(_0x2e898e[_0xda9c('0x55')]['id']){delete _0x2e898e[_0xda9c('0x55')]['id'];}return db[_0xda9c('0x37')][_0xda9c('0x5a')]({'where':{'id':_0x2e898e[_0xda9c('0x56')]['id']}})[_0xda9c('0x1e')](handleEntityNotFound(_0x52d767,null))[_0xda9c('0x1e')](function(_0x296aa3){if(_0x296aa3){_0x2e898e[_0xda9c('0x55')][_0xda9c('0x5b')]=_0x296aa3['id'];_0x2e898e[_0xda9c('0x55')][_0xda9c('0x5c')]=integrations[_0xda9c('0x5d')](_0x2e898e[_0xda9c('0x55')][_0xda9c('0x5e')],_0x2e898e[_0xda9c('0x55')]['type']);_0x2e898e['body']['Descriptions']=integrations[_0xda9c('0x5f')](_0x2e898e[_0xda9c('0x55')]['channel'],_0x2e898e['body']['type']);return db['ZendeskConfiguration'][_0xda9c('0x54')](_0x2e898e[_0xda9c('0x55')],{'include':[{'model':db[_0xda9c('0x60')],'as':'Subjects'},{'model':db[_0xda9c('0x60')],'as':_0xda9c('0x61')}]});}return null;})[_0xda9c('0x1e')](respondWithResult(_0x52d767,null))[_0xda9c('0x26')](handleError(_0x52d767,null));};exports[_0xda9c('0x62')]=function(_0x137311,_0x2f0b96,_0x3ba927){var _0x277d94='';return db[_0xda9c('0x37')]['findOne']({'where':{'id':_0x137311[_0xda9c('0x56')]['id']},'attributes':['id',_0xda9c('0x63'),_0xda9c('0x64'),'token','authType','remoteUri']})[_0xda9c('0x1e')](handleEntityNotFound(_0x2f0b96,null))[_0xda9c('0x1e')](function(_0x2e139d){if(_0x2e139d){_0x277d94=_0x2e139d[_0xda9c('0x65')];var _0x3cee20=_0x277d94['slice'](-0x1);if(_0x3cee20==='/'){_0x277d94=_0x277d94[_0xda9c('0x66')](0x0,_0x277d94[_0xda9c('0x67')](_0x3cee20));}var _0x20dadd={'method':_0xda9c('0x68'),'uri':util[_0xda9c('0x69')](_0xda9c('0x6a'),_0x277d94,_0xda9c('0x6b')),'json':!![]};switch(_0x2e139d['authType']){case _0xda9c('0x64'):_0x20dadd['headers']={'Authorization':util[_0xda9c('0x69')]('Basic\x20%s',new Buffer(util[_0xda9c('0x69')](_0xda9c('0x6c'),_0x2e139d['username'],_0x2e139d['password']))['toString'](_0xda9c('0x6d')))};break;case'token':_0x20dadd[_0xda9c('0x6e')]={'Authorization':util['format'](_0xda9c('0x6f'),new Buffer(util['format'](_0xda9c('0x70'),_0x2e139d[_0xda9c('0x63')],_0x2e139d[_0xda9c('0x71')]))[_0xda9c('0x72')]('base64'))};break;default:throw new db[(_0xda9c('0x73'))][(_0xda9c('0x1c'))](_0xda9c('0x74'));}return rp(_0x20dadd);}})['then'](function(_0x3eb6cc){if(_0x3eb6cc){var _0x5802ff=[_0xda9c('0x75'),_0xda9c('0x76'),'group',_0xda9c('0x77')];_[_0xda9c('0x78')](_0x3eb6cc['ticket_fields'],function(_0x19bdb3){return _0x5802ff[_0xda9c('0x79')](_0x19bdb3[_0xda9c('0x3a')]);});return{'count':_0x3eb6cc['ticket_fields']['length'],'rows':_[_0xda9c('0x36')](_0x3eb6cc[_0xda9c('0x6b')],function(_0x5b501c){return{'id':_0x5b501c['id'],'name':_0x5b501c[_0xda9c('0x7a')]>0x7?_0x5b501c[_0xda9c('0x7b')]:_0x5b501c['type'],'custom':_0x5b501c['position']>0x7?!![]:![],'options':_0x5b501c[_0xda9c('0x7c')]?_0x5b501c['system_field_options']:_0x5b501c[_0xda9c('0x7d')]?_0x5b501c[_0xda9c('0x7d')]:[]};})};}})[_0xda9c('0x1e')](respondWithResult(_0x2f0b96,null))[_0xda9c('0x26')](function(_0x5a31c0){var _0x51ce97=_0x137311['query'][_0xda9c('0x1b')]?0x1f4:_0x5a31c0[_0xda9c('0x7e')]||0x1f4;logger[_0xda9c('0x23')]('getFields,\x20%s,\x20%s,\x20%s',_0xda9c('0x62'),_0x51ce97,JSON[_0xda9c('0x22')](_0x5a31c0));delete _0x5a31c0[_0xda9c('0x33')];if(_0x51ce97===0x191){_0x51ce97=0x190;}_0x2f0b96['status'](_0x51ce97)[_0xda9c('0x34')](_0x137311[_0xda9c('0x3c')][_0xda9c('0x1b')]?{'message':_0xda9c('0x7f'),'statusCode':_0x5a31c0[_0xda9c('0x7e')]}:_0x5a31c0);});}; \ No newline at end of file +var _0x7550=['send','index','map','ZendeskAccount','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','includeAll','include','rows','show','params','find','create','body','findOne','ZendeskConfiguration','rawAttributes','pick','getConfigurations','addConfiguration','AccountId','Subjects','getSubjects','Descriptions','getDescriptions','channel','ZendeskField','getFields','username','password','token','remoteUri','slice','substring','GET','format','%s/%s','authType','headers','Basic\x20%s','toString','base64','Unknown\x20authentication\x20type','subject','group','assignee','remove','ticket_fields','includes','position','title','system_field_options','custom_field_options','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','Wrong\x20credentials','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','util','path','sox','to-csv','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','../../components/integrations/configuration','jayson/promise','client','http','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','info','request\x20sent','debug','ZendeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','ZendeskAccount,\x20%s,\x20%s','result','catch','status','end','json','offset','limit','set','Content-Range','apply','reject','save','update','destroy','then','sendStatus','name'];(function(_0x333965,_0x16e0f5){var _0x50290e=function(_0x1e7c60){while(--_0x1e7c60){_0x333965['push'](_0x333965['shift']());}};_0x50290e(++_0x16e0f5);}(_0x7550,0x155));var _0x0755=function(_0x4cdeed,_0x22eda2){_0x4cdeed=_0x4cdeed-0x0;var _0x3e7fec=_0x7550[_0x4cdeed];return _0x3e7fec;};'use strict';var pdf=require(_0x0755('0x0'));var emlformat=require(_0x0755('0x1'));var rimraf=require(_0x0755('0x2'));var zipdir=require(_0x0755('0x3'));var jsonpatch=require(_0x0755('0x4'));var rp=require(_0x0755('0x5'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x0755('0x6'));var path=require(_0x0755('0x7'));var sox=require(_0x0755('0x8'));var csv=require(_0x0755('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0x0755('0xa'));var crypto=require(_0x0755('0xb'));var jsforce=require(_0x0755('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x0755('0x9'));var querystring=require('querystring');var Papa=require(_0x0755('0xd'));var Redis=require(_0x0755('0xe'));var authService=require(_0x0755('0xf'));var qs=require(_0x0755('0x10'));var as=require(_0x0755('0x11'));var hardwareService=require(_0x0755('0x12'));var logger=require(_0x0755('0x13'))(_0x0755('0x14'));var utils=require(_0x0755('0x15'));var config=require(_0x0755('0x16'));var db=require(_0x0755('0x17'))['db'];var integrations=require(_0x0755('0x18'));var jayson=require(_0x0755('0x19'));var client=jayson[_0x0755('0x1a')][_0x0755('0x1b')]({'port':0x232a});function checkPasswordPattern(_0x3629fa,_0x36ea9a,_0x22eb49){if(_0x22eb49){var _0x45c196=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x45c196['test'](_0x36ea9a)){return _0x3629fa;}else{throw new db[(_0x0755('0x1c'))][(_0x0755('0x1d'))](_0x0755('0x1e'));}}else{return _0x3629fa;}}function respondWithRpcPromise(_0x11f549,_0x3bd4e3,_0x2ceb7e,_0x512308){return new BPromise(function(_0x110472,_0x33dec3){var _0x11064d=_0x512308||client;return _0x11064d[_0x0755('0x1f')](_0x11f549,_0x2ceb7e)['then'](function(_0x548e80){logger[_0x0755('0x20')]('ZendeskAccount,\x20%s,\x20%s',_0x3bd4e3,_0x0755('0x21'));logger[_0x0755('0x22')](_0x0755('0x23'),_0x3bd4e3,_0x0755('0x21'),JSON[_0x0755('0x24')](_0x548e80));if(_0x548e80[_0x0755('0x25')]){if(_0x548e80[_0x0755('0x25')][_0x0755('0x26')]===0x1f4){logger[_0x0755('0x25')]('ZendeskAccount,\x20%s,\x20%s',_0x3bd4e3,_0x548e80[_0x0755('0x25')]['message']);return _0x33dec3(_0x548e80['error'][_0x0755('0x27')]);}logger['error'](_0x0755('0x28'),_0x3bd4e3,_0x548e80[_0x0755('0x25')]['message']);return _0x110472(_0x548e80[_0x0755('0x25')][_0x0755('0x27')]);}else{logger[_0x0755('0x20')](_0x0755('0x28'),_0x3bd4e3,'request\x20sent');_0x110472(_0x548e80[_0x0755('0x29')][_0x0755('0x27')]);}})[_0x0755('0x2a')](function(_0x4127d1){logger[_0x0755('0x25')]('ZendeskAccount,\x20%s,\x20%s',_0x3bd4e3,_0x4127d1);_0x33dec3(_0x4127d1);});});}function respondWithStatusCode(_0x162b50,_0x570708){_0x570708=_0x570708||0xcc;return function(_0x4cf328){if(_0x4cf328){return _0x162b50['sendStatus'](_0x570708);}return _0x162b50[_0x0755('0x2b')](_0x570708)[_0x0755('0x2c')]();};}function respondWithResult(_0x56d476,_0x384ac3){_0x384ac3=_0x384ac3||0xc8;return function(_0x4cca52){if(_0x4cca52){return _0x56d476[_0x0755('0x2b')](_0x384ac3)[_0x0755('0x2d')](_0x4cca52);}};}function respondWithFilteredResult(_0x9759da,_0x42a236){return function(_0x3e5aed){if(_0x3e5aed){var _0x45b7f2=_0x3e5aed['count'],_0x33687c=_0x42a236[_0x0755('0x2e')],_0xa4d81e=_0x42a236[_0x0755('0x2e')]+_0x42a236[_0x0755('0x2f')],_0x313801;if(_0xa4d81e>=_0x45b7f2){_0xa4d81e=_0x45b7f2;_0x313801=0xc8;}else{_0x313801=0xce;}_0x9759da[_0x0755('0x2b')](_0x313801);return _0x9759da[_0x0755('0x30')](_0x0755('0x31'),_0x33687c+'-'+_0xa4d81e+'/'+_0x45b7f2)['json'](_0x3e5aed);}return null;};}function patchUpdates(_0x4ef082){return function(_0xea4315){try{jsonpatch[_0x0755('0x32')](_0xea4315,_0x4ef082,!![]);}catch(_0x2f00c9){return BPromise[_0x0755('0x33')](_0x2f00c9);}return _0xea4315[_0x0755('0x34')]();};}function saveUpdates(_0x5d63a4,_0x21bcbf){return function(_0x5835b7){if(_0x5835b7){return _0x5835b7[_0x0755('0x35')](_0x5d63a4)['then'](function(_0xc45577){return _0xc45577;});}return null;};}function removeEntity(_0x117e8a,_0x4a024e){return function(_0x11a84d){if(_0x11a84d){return _0x11a84d[_0x0755('0x36')]()[_0x0755('0x37')](function(){_0x117e8a['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x3d51eb,_0x191e00){return function(_0x4edb46){if(!_0x4edb46){_0x3d51eb[_0x0755('0x38')](0x194);}return _0x4edb46;};}function handleError(_0x48e86a,_0x46f9f2){_0x46f9f2=_0x46f9f2||0x1f4;return function(_0x4e9292){logger[_0x0755('0x25')](_0x4e9292['stack']);if(_0x4e9292['name']){delete _0x4e9292[_0x0755('0x39')];}_0x48e86a['status'](_0x46f9f2)[_0x0755('0x3a')](_0x4e9292);};}exports[_0x0755('0x3b')]=function(_0x10ffd0,_0x40a407){var _0x1f8abe={},_0x447a91={},_0x6ba7dd={'count':0x0,'rows':[]};var _0x12ad35=_[_0x0755('0x3c')](db[_0x0755('0x3d')]['rawAttributes'],function(_0x443178){return{'name':_0x443178[_0x0755('0x3e')],'type':_0x443178[_0x0755('0x3f')][_0x0755('0x40')]};});_0x447a91[_0x0755('0x41')]=_['map'](_0x12ad35,_0x0755('0x39'));_0x447a91[_0x0755('0x42')]=_[_0x0755('0x43')](_0x10ffd0[_0x0755('0x42')]);_0x447a91[_0x0755('0x44')]=_[_0x0755('0x45')](_0x447a91[_0x0755('0x41')],_0x447a91[_0x0755('0x42')]);_0x1f8abe[_0x0755('0x46')]=_[_0x0755('0x45')](_0x447a91[_0x0755('0x41')],qs[_0x0755('0x47')](_0x10ffd0[_0x0755('0x42')][_0x0755('0x47')]));_0x1f8abe['attributes']=_0x1f8abe[_0x0755('0x46')][_0x0755('0x48')]?_0x1f8abe[_0x0755('0x46')]:_0x447a91['model'];if(!_0x10ffd0[_0x0755('0x42')][_0x0755('0x49')](_0x0755('0x4a'))){_0x1f8abe[_0x0755('0x2f')]=qs[_0x0755('0x2f')](_0x10ffd0[_0x0755('0x42')][_0x0755('0x2f')]);_0x1f8abe['offset']=qs[_0x0755('0x2e')](_0x10ffd0[_0x0755('0x42')][_0x0755('0x2e')]);}_0x1f8abe[_0x0755('0x4b')]=qs[_0x0755('0x4c')](_0x10ffd0['query']['sort']);_0x1f8abe[_0x0755('0x4d')]=qs['filters'](_['pick'](_0x10ffd0[_0x0755('0x42')],_0x447a91[_0x0755('0x44')]),_0x12ad35);if(_0x10ffd0[_0x0755('0x42')][_0x0755('0x4e')]){_0x1f8abe[_0x0755('0x4d')]=_[_0x0755('0x4f')](_0x1f8abe['where'],{'$or':_['map'](_0x12ad35,function(_0x54e7af){if(_0x54e7af[_0x0755('0x3f')]!==_0x0755('0x50')){var _0x2f7d8b={};_0x2f7d8b[_0x54e7af['name']]={'$like':'%'+_0x10ffd0[_0x0755('0x42')]['filter']+'%'};return _0x2f7d8b;}})});}_0x1f8abe=_['merge']({},_0x1f8abe,_0x10ffd0[_0x0755('0x51')]);var _0xcee10a={'where':_0x1f8abe[_0x0755('0x4d')]};return db[_0x0755('0x3d')]['count'](_0xcee10a)['then'](function(_0xf64ecd){_0x6ba7dd['count']=_0xf64ecd;if(_0x10ffd0[_0x0755('0x42')][_0x0755('0x52')]){_0x1f8abe[_0x0755('0x53')]=[{'all':!![]}];}return db[_0x0755('0x3d')]['findAll'](_0x1f8abe);})['then'](function(_0x2ab643){_0x6ba7dd[_0x0755('0x54')]=_0x2ab643;return _0x6ba7dd;})[_0x0755('0x37')](respondWithFilteredResult(_0x40a407,_0x1f8abe))[_0x0755('0x2a')](handleError(_0x40a407,null));};exports[_0x0755('0x55')]=function(_0x4f2ac3,_0x489ca6){var _0xacf217={'raw':![],'where':{'id':_0x4f2ac3[_0x0755('0x56')]['id']}},_0x4321cb={};_0x4321cb['model']=_[_0x0755('0x43')](db[_0x0755('0x3d')]['rawAttributes']);_0x4321cb[_0x0755('0x42')]=_[_0x0755('0x43')](_0x4f2ac3['query']);_0x4321cb[_0x0755('0x44')]=_[_0x0755('0x45')](_0x4321cb['model'],_0x4321cb['query']);_0xacf217[_0x0755('0x46')]=_[_0x0755('0x45')](_0x4321cb[_0x0755('0x41')],qs[_0x0755('0x47')](_0x4f2ac3[_0x0755('0x42')][_0x0755('0x47')]));_0xacf217['attributes']=_0xacf217[_0x0755('0x46')][_0x0755('0x48')]?_0xacf217[_0x0755('0x46')]:_0x4321cb['model'];if(_0x4f2ac3[_0x0755('0x42')]['includeAll']){_0xacf217[_0x0755('0x53')]=[{'all':!![]}];}_0xacf217=_[_0x0755('0x4f')]({},_0xacf217,_0x4f2ac3[_0x0755('0x51')]);return db[_0x0755('0x3d')][_0x0755('0x57')](_0xacf217)[_0x0755('0x37')](handleEntityNotFound(_0x489ca6,null))[_0x0755('0x37')](respondWithResult(_0x489ca6,null))['catch'](handleError(_0x489ca6,null));};exports['create']=function(_0x212631,_0x347ba5){return db[_0x0755('0x3d')][_0x0755('0x58')](_0x212631[_0x0755('0x59')],{})[_0x0755('0x37')](respondWithResult(_0x347ba5,0xc9))[_0x0755('0x2a')](handleError(_0x347ba5,null));};exports[_0x0755('0x35')]=function(_0x24ae8c,_0x30b1a){if(_0x24ae8c[_0x0755('0x59')]['id']){delete _0x24ae8c[_0x0755('0x59')]['id'];}return db[_0x0755('0x3d')][_0x0755('0x57')]({'where':{'id':_0x24ae8c[_0x0755('0x56')]['id']}})['then'](handleEntityNotFound(_0x30b1a,null))[_0x0755('0x37')](saveUpdates(_0x24ae8c[_0x0755('0x59')],null))[_0x0755('0x37')](respondWithResult(_0x30b1a,null))[_0x0755('0x2a')](handleError(_0x30b1a,null));};exports[_0x0755('0x36')]=function(_0x5f17ca,_0x231886){return db[_0x0755('0x3d')][_0x0755('0x57')]({'where':{'id':_0x5f17ca['params']['id']}})[_0x0755('0x37')](handleEntityNotFound(_0x231886,null))[_0x0755('0x37')](removeEntity(_0x231886,null))[_0x0755('0x2a')](handleError(_0x231886,null));};exports['getConfigurations']=function(_0x23500a,_0x4a02b0,_0x4e79ce){var _0x4545ac={};var _0x19daed={};var _0x1ff01b;var _0x43b9f4;return db['ZendeskAccount'][_0x0755('0x5a')]({'where':{'id':_0x23500a[_0x0755('0x56')]['id']}})[_0x0755('0x37')](handleEntityNotFound(_0x4a02b0,null))[_0x0755('0x37')](function(_0x347a93){if(_0x347a93){_0x1ff01b=_0x347a93;_0x19daed['model']=_[_0x0755('0x43')](db[_0x0755('0x5b')][_0x0755('0x5c')]);_0x19daed['query']=_[_0x0755('0x43')](_0x23500a[_0x0755('0x42')]);_0x19daed[_0x0755('0x44')]=_[_0x0755('0x45')](_0x19daed[_0x0755('0x41')],_0x19daed[_0x0755('0x42')]);_0x4545ac[_0x0755('0x46')]=_['intersection'](_0x19daed[_0x0755('0x41')],qs['fields'](_0x23500a[_0x0755('0x42')]['fields']));_0x4545ac['attributes']=_0x4545ac[_0x0755('0x46')]['length']?_0x4545ac[_0x0755('0x46')]:_0x19daed[_0x0755('0x41')];_0x4545ac[_0x0755('0x4b')]=qs[_0x0755('0x4c')](_0x23500a[_0x0755('0x42')][_0x0755('0x4c')]);_0x4545ac['where']=qs[_0x0755('0x44')](_[_0x0755('0x5d')](_0x23500a[_0x0755('0x42')],_0x19daed[_0x0755('0x44')]));if(_0x23500a[_0x0755('0x42')][_0x0755('0x4e')]){_0x4545ac['where']=_[_0x0755('0x4f')](_0x4545ac[_0x0755('0x4d')],{'$or':_[_0x0755('0x3c')](_0x4545ac[_0x0755('0x46')],function(_0x19bb71){var _0x2e39e0={};_0x2e39e0[_0x19bb71]={'$like':'%'+_0x23500a[_0x0755('0x42')]['filter']+'%'};return _0x2e39e0;})});}_0x4545ac=_[_0x0755('0x4f')]({},_0x4545ac,_0x23500a[_0x0755('0x51')]);return _0x1ff01b[_0x0755('0x5e')](_0x4545ac);}})[_0x0755('0x37')](function(_0x54b905){if(_0x54b905){_0x43b9f4=_0x54b905['length'];if(!_0x23500a[_0x0755('0x42')][_0x0755('0x49')]('nolimit')){_0x4545ac[_0x0755('0x2f')]=qs[_0x0755('0x2f')](_0x23500a['query'][_0x0755('0x2f')]);_0x4545ac[_0x0755('0x2e')]=qs[_0x0755('0x2e')](_0x23500a[_0x0755('0x42')][_0x0755('0x2e')]);}return _0x1ff01b['getConfigurations'](_0x4545ac);}})['then'](function(_0xade233){if(_0xade233){return _0xade233?{'count':_0x43b9f4,'rows':_0xade233}:null;}})[_0x0755('0x37')](respondWithResult(_0x4a02b0,null))[_0x0755('0x2a')](handleError(_0x4a02b0,null));};exports[_0x0755('0x5f')]=function(_0x578091,_0x501c6f,_0x5e5c75){if(_0x578091['body']['id']){delete _0x578091[_0x0755('0x59')]['id'];}return db[_0x0755('0x3d')]['findOne']({'where':{'id':_0x578091[_0x0755('0x56')]['id']}})[_0x0755('0x37')](handleEntityNotFound(_0x501c6f,null))[_0x0755('0x37')](function(_0x35e959){if(_0x35e959){_0x578091[_0x0755('0x59')][_0x0755('0x60')]=_0x35e959['id'];_0x578091[_0x0755('0x59')][_0x0755('0x61')]=integrations[_0x0755('0x62')](_0x578091[_0x0755('0x59')]['channel'],_0x578091[_0x0755('0x59')][_0x0755('0x3f')]);_0x578091[_0x0755('0x59')][_0x0755('0x63')]=integrations[_0x0755('0x64')](_0x578091['body'][_0x0755('0x65')],_0x578091['body'][_0x0755('0x3f')]);return db[_0x0755('0x5b')][_0x0755('0x58')](_0x578091[_0x0755('0x59')],{'include':[{'model':db[_0x0755('0x66')],'as':'Subjects'},{'model':db[_0x0755('0x66')],'as':_0x0755('0x63')}]});}return null;})['then'](respondWithResult(_0x501c6f,null))[_0x0755('0x2a')](handleError(_0x501c6f,null));};exports[_0x0755('0x67')]=function(_0x14461a,_0x2a3ca9,_0x14f4c9){var _0x42ad3e='';return db['ZendeskAccount']['findOne']({'where':{'id':_0x14461a['params']['id']},'attributes':['id',_0x0755('0x68'),_0x0755('0x69'),_0x0755('0x6a'),'authType',_0x0755('0x6b')]})[_0x0755('0x37')](handleEntityNotFound(_0x2a3ca9,null))['then'](function(_0x56f257){if(_0x56f257){_0x42ad3e=_0x56f257[_0x0755('0x6b')];var _0x169cc4=_0x42ad3e[_0x0755('0x6c')](-0x1);if(_0x169cc4==='/'){_0x42ad3e=_0x42ad3e[_0x0755('0x6d')](0x0,_0x42ad3e['lastIndexOf'](_0x169cc4));}var _0x10abd8={'method':_0x0755('0x6e'),'uri':util[_0x0755('0x6f')](_0x0755('0x70'),_0x42ad3e,'ticket_fields'),'json':!![]};switch(_0x56f257[_0x0755('0x71')]){case _0x0755('0x69'):_0x10abd8[_0x0755('0x72')]={'Authorization':util[_0x0755('0x6f')](_0x0755('0x73'),new Buffer(util[_0x0755('0x6f')]('%s:%s',_0x56f257[_0x0755('0x68')],_0x56f257[_0x0755('0x69')]))[_0x0755('0x74')]('base64'))};break;case _0x0755('0x6a'):_0x10abd8[_0x0755('0x72')]={'Authorization':util[_0x0755('0x6f')](_0x0755('0x73'),new Buffer(util[_0x0755('0x6f')]('%s/token:%s',_0x56f257['username'],_0x56f257[_0x0755('0x6a')]))[_0x0755('0x74')](_0x0755('0x75')))};break;default:throw new db[(_0x0755('0x1c'))][(_0x0755('0x1d'))](_0x0755('0x76'));}return rp(_0x10abd8);}})[_0x0755('0x37')](function(_0x38840e){if(_0x38840e){var _0x4e2f80=[_0x0755('0x77'),'description',_0x0755('0x78'),_0x0755('0x79')];_[_0x0755('0x7a')](_0x38840e[_0x0755('0x7b')],function(_0x357db5){return _0x4e2f80[_0x0755('0x7c')](_0x357db5['type']);});return{'count':_0x38840e[_0x0755('0x7b')]['length'],'rows':_[_0x0755('0x3c')](_0x38840e[_0x0755('0x7b')],function(_0x5cf28e){return{'id':_0x5cf28e['id'],'name':_0x5cf28e[_0x0755('0x7d')]>0x7?_0x5cf28e[_0x0755('0x7e')]:_0x5cf28e[_0x0755('0x3f')],'custom':_0x5cf28e[_0x0755('0x7d')]>0x7?!![]:![],'options':_0x5cf28e[_0x0755('0x7f')]?_0x5cf28e[_0x0755('0x7f')]:_0x5cf28e['custom_field_options']?_0x5cf28e[_0x0755('0x80')]:[]};})};}})[_0x0755('0x37')](respondWithResult(_0x2a3ca9,null))[_0x0755('0x2a')](function(_0x9a60c1){var _0x32da32=_0x14461a[_0x0755('0x42')][_0x0755('0x81')]?0x1f4:_0x9a60c1[_0x0755('0x82')]||0x1f4;logger[_0x0755('0x25')](_0x0755('0x83'),_0x0755('0x67'),_0x32da32,JSON[_0x0755('0x24')](_0x9a60c1));delete _0x9a60c1[_0x0755('0x39')];if(_0x32da32===0x191){_0x32da32=0x190;}_0x2a3ca9['status'](_0x32da32)[_0x0755('0x3a')](_0x14461a['query'][_0x0755('0x81')]?{'message':_0x0755('0x84'),'statusCode':_0x9a60c1[_0x0755('0x82')]}:_0x9a60c1);});}; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.model.js b/server/api/intZendeskAccount/intZendeskAccount.model.js index 4ae1c9f..1171853 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 _0x031a=['../../config/environment','../../components/integrations/configuration','exports','define','ZendeskAccount','int_zendesk_accounts','lodash','util','../../config/logger','moment','bluebird','path','rimraf'];(function(_0x3493e8,_0x50e613){var _0x23c1dc=function(_0x14ce4){while(--_0x14ce4){_0x3493e8['push'](_0x3493e8['shift']());}};_0x23c1dc(++_0x50e613);}(_0x031a,0x13e));var _0xa031=function(_0x344281,_0x209ab1){_0x344281=_0x344281-0x0;var _0x5e7acf=_0x031a[_0x344281];return _0x5e7acf;};'use strict';var _=require(_0xa031('0x0'));var util=require(_0xa031('0x1'));var logger=require(_0xa031('0x2'))('api');var moment=require(_0xa031('0x3'));var BPromise=require(_0xa031('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xa031('0x5'));var rimraf=require(_0xa031('0x6'));var config=require(_0xa031('0x7'));var attributes=require('./intZendeskAccount.attributes');var integrations=require(_0xa031('0x8'));module[_0xa031('0x9')]=function(_0x6f4a60,_0x191c62){return _0x6f4a60[_0xa031('0xa')](_0xa031('0xb'),attributes,{'tableName':_0xa031('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd5e3=['lodash','util','moment','bluebird','request-promise','rimraf','./intZendeskAccount.attributes','../../components/integrations/configuration','exports','ZendeskAccount','int_zendesk_accounts'];(function(_0x5c4ab,_0x311273){var _0x548e81=function(_0x41bf1a){while(--_0x41bf1a){_0x5c4ab['push'](_0x5c4ab['shift']());}};_0x548e81(++_0x311273);}(_0xd5e3,0x1c3));var _0x3d5e=function(_0xa24ba1,_0x57892c){_0xa24ba1=_0xa24ba1-0x0;var _0x2e2e59=_0xd5e3[_0xa24ba1];return _0x2e2e59;};'use strict';var _=require(_0x3d5e('0x0'));var util=require(_0x3d5e('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x3d5e('0x2'));var BPromise=require(_0x3d5e('0x3'));var rp=require(_0x3d5e('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x3d5e('0x5'));var config=require('../../config/environment');var attributes=require(_0x3d5e('0x6'));var integrations=require(_0x3d5e('0x7'));module[_0x3d5e('0x8')]=function(_0x735939,_0x32fad4){return _0x735939['define'](_0x3d5e('0x9'),attributes,{'tableName':_0x3d5e('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.rpc.js b/server/api/intZendeskAccount/intZendeskAccount.rpc.js index 0eed6b5..5395fab 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 _0xbaf0=['ZendeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','GetZendeskAccount','ZendeskAccount','findAll','options','where','attributes','limit','include','model','map','ShowZendeskAccount','find','raw','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','ZendeskAccount,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x256b72,_0x340985){var _0x2183e3=function(_0xf7fd37){while(--_0xf7fd37){_0x256b72['push'](_0x256b72['shift']());}};_0x2183e3(++_0x340985);}(_0xbaf0,0x12a));var _0x0baf=function(_0x2b4411,_0x2625ed){_0x2b4411=_0x2b4411-0x0;var _0x8e41ef=_0xbaf0[_0x2b4411];return _0x8e41ef;};'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')]('ZendeskAccount,\x20%s,\x20%s',_0x2dcaac,_0x2c7442[_0x0baf('0x13')][_0x0baf('0x14')]);return _0x5f5030(_0x2c7442[_0x0baf('0x13')][_0x0baf('0x14')]);}else{logger[_0x0baf('0xd')](_0x0baf('0xe'),_0x2dcaac,'request\x20sent');_0x5f5030(_0x2c7442['result'][_0x0baf('0x14')]);}})[_0x0baf('0x15')](function(_0x283408){logger[_0x0baf('0x13')](_0x0baf('0xe'),_0x2dcaac,_0x283408);_0x11b947(_0x283408);});});}exports[_0x0baf('0x16')]=function(_0x53c338){var _0x63c820=this;return new Promise(function(_0xfbecec,_0x1ef0e5){return db[_0x0baf('0x17')][_0x0baf('0x18')]({'raw':_0x53c338[_0x0baf('0x19')]?_0x53c338['options']['raw']===undefined?!![]:![]:!![],'where':_0x53c338[_0x0baf('0x19')]?_0x53c338[_0x0baf('0x19')][_0x0baf('0x1a')]||null:null,'attributes':_0x53c338[_0x0baf('0x19')]?_0x53c338[_0x0baf('0x19')][_0x0baf('0x1b')]||null:null,'limit':_0x53c338[_0x0baf('0x19')]?_0x53c338[_0x0baf('0x19')][_0x0baf('0x1c')]||null:null,'include':_0x53c338[_0x0baf('0x19')]?_0x53c338['options'][_0x0baf('0x1d')]?_['map'](_0x53c338[_0x0baf('0x19')]['include'],function(_0x4de74c){return{'model':db[_0x4de74c[_0x0baf('0x1e')]],'as':_0x4de74c['as'],'attributes':_0x4de74c['attributes'],'include':_0x4de74c['include']?_[_0x0baf('0x1f')](_0x4de74c[_0x0baf('0x1d')],function(_0x34e264){return{'model':db[_0x34e264[_0x0baf('0x1e')]],'as':_0x34e264['as'],'attributes':_0x34e264[_0x0baf('0x1b')],'include':_0x34e264['include']?_[_0x0baf('0x1f')](_0x34e264[_0x0baf('0x1d')],function(_0x1ca35a){return{'model':db[_0x1ca35a[_0x0baf('0x1e')]],'as':_0x1ca35a['as'],'attributes':_0x1ca35a[_0x0baf('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x0baf('0xc')](function(_0x453525){logger['info'](_0x0baf('0x16'),_0x53c338);logger[_0x0baf('0x10')](_0x0baf('0x16'),_0x53c338,JSON[_0x0baf('0x12')](_0x453525));_0xfbecec(_0x453525);})['catch'](function(_0x29dbdf){logger[_0x0baf('0x13')]('GetZendeskAccount',_0x29dbdf[_0x0baf('0x14')],_0x53c338);_0x1ef0e5(_0x63c820[_0x0baf('0x13')](0x1f4,_0x29dbdf[_0x0baf('0x14')]));});});};exports[_0x0baf('0x20')]=function(_0xd14f0f){var _0x366924=this;return new Promise(function(_0x213a6a,_0x57476f){return db[_0x0baf('0x17')][_0x0baf('0x21')]({'raw':_0xd14f0f[_0x0baf('0x19')]?_0xd14f0f[_0x0baf('0x19')][_0x0baf('0x22')]===undefined?!![]:![]:!![],'where':_0xd14f0f[_0x0baf('0x19')]?_0xd14f0f[_0x0baf('0x19')][_0x0baf('0x1a')]||null:null,'attributes':_0xd14f0f[_0x0baf('0x19')]?_0xd14f0f[_0x0baf('0x19')][_0x0baf('0x1b')]||null:null,'include':_0xd14f0f[_0x0baf('0x19')]?_0xd14f0f[_0x0baf('0x19')][_0x0baf('0x1d')]?_['map'](_0xd14f0f[_0x0baf('0x19')]['include'],function(_0x1aa474){return{'model':db[_0x1aa474[_0x0baf('0x1e')]],'as':_0x1aa474['as'],'attributes':_0x1aa474[_0x0baf('0x1b')],'include':_0x1aa474[_0x0baf('0x1d')]?_['map'](_0x1aa474[_0x0baf('0x1d')],function(_0x1d6575){return{'model':db[_0x1d6575['model']],'as':_0x1d6575['as'],'attributes':_0x1d6575[_0x0baf('0x1b')],'include':_0x1d6575[_0x0baf('0x1d')]?_[_0x0baf('0x1f')](_0x1d6575[_0x0baf('0x1d')],function(_0x1f60bd){return{'model':db[_0x1f60bd[_0x0baf('0x1e')]],'as':_0x1f60bd['as'],'attributes':_0x1f60bd[_0x0baf('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x0baf('0xc')](function(_0x4aa6ed){logger[_0x0baf('0xd')](_0x0baf('0x20'),_0xd14f0f);logger['debug'](_0x0baf('0x20'),_0xd14f0f,JSON['stringify'](_0x4aa6ed));_0x213a6a(_0x4aa6ed);})['catch'](function(_0x11bc49){logger[_0x0baf('0x13')]('ShowZendeskAccount',_0x11bc49['message'],_0xd14f0f);_0x57476f(_0x366924[_0x0baf('0x13')](0x1f4,_0x11bc49[_0x0baf('0x14')]));});});}; \ No newline at end of file +var _0x0713=['findAll','options','raw','attributes','limit','include','map','model','ShowZendeskAccount','where','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','ZendeskAccount,\x20%s,\x20%s','request\x20sent','debug','ZendeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetZendeskAccount','ZendeskAccount'];(function(_0x5c10c0,_0xc824a5){var _0x22fa42=function(_0x4e1dc4){while(--_0x4e1dc4){_0x5c10c0['push'](_0x5c10c0['shift']());}};_0x22fa42(++_0xc824a5);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x3071('0x0'));var BPromise=require(_0x3071('0x1'));var rs=require(_0x3071('0x2'));var fs=require('fs');var Redis=require(_0x3071('0x3'));var db=require(_0x3071('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x3071('0x5'))(_0x3071('0x6'));var config=require(_0x3071('0x7'));var jayson=require(_0x3071('0x8'));var client=jayson[_0x3071('0x9')][_0x3071('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1d3dd6,_0x2f1e87,_0xbd737f){return new BPromise(function(_0x22274c,_0x3e9a5e){return client[_0x3071('0xb')](_0x1d3dd6,_0xbd737f)[_0x3071('0xc')](function(_0x4a36ec){logger[_0x3071('0xd')](_0x3071('0xe'),_0x2f1e87,_0x3071('0xf'));logger[_0x3071('0x10')](_0x3071('0x11'),_0x2f1e87,'request\x20sent',JSON[_0x3071('0x12')](_0x4a36ec));if(_0x4a36ec[_0x3071('0x13')]){if(_0x4a36ec[_0x3071('0x13')][_0x3071('0x14')]===0x1f4){logger[_0x3071('0x13')]('ZendeskAccount,\x20%s,\x20%s',_0x2f1e87,_0x4a36ec['error'][_0x3071('0x15')]);return _0x3e9a5e(_0x4a36ec['error'][_0x3071('0x15')]);}logger[_0x3071('0x13')]('ZendeskAccount,\x20%s,\x20%s',_0x2f1e87,_0x4a36ec[_0x3071('0x13')]['message']);return _0x22274c(_0x4a36ec[_0x3071('0x13')][_0x3071('0x15')]);}else{logger[_0x3071('0xd')](_0x3071('0xe'),_0x2f1e87,_0x3071('0xf'));_0x22274c(_0x4a36ec[_0x3071('0x16')][_0x3071('0x15')]);}})[_0x3071('0x17')](function(_0x21aad3){logger[_0x3071('0x13')]('ZendeskAccount,\x20%s,\x20%s',_0x2f1e87,_0x21aad3);_0x3e9a5e(_0x21aad3);});});}exports[_0x3071('0x18')]=function(_0x17dbda){var _0x1068d9=this;return new Promise(function(_0x108a83,_0x3acf0e){return db[_0x3071('0x19')][_0x3071('0x1a')]({'raw':_0x17dbda[_0x3071('0x1b')]?_0x17dbda['options'][_0x3071('0x1c')]===undefined?!![]:![]:!![],'where':_0x17dbda[_0x3071('0x1b')]?_0x17dbda[_0x3071('0x1b')]['where']||null:null,'attributes':_0x17dbda[_0x3071('0x1b')]?_0x17dbda['options'][_0x3071('0x1d')]||null:null,'limit':_0x17dbda[_0x3071('0x1b')]?_0x17dbda[_0x3071('0x1b')][_0x3071('0x1e')]||null:null,'include':_0x17dbda[_0x3071('0x1b')]?_0x17dbda[_0x3071('0x1b')][_0x3071('0x1f')]?_[_0x3071('0x20')](_0x17dbda['options']['include'],function(_0x2ce48a){return{'model':db[_0x2ce48a[_0x3071('0x21')]],'as':_0x2ce48a['as'],'attributes':_0x2ce48a[_0x3071('0x1d')],'include':_0x2ce48a[_0x3071('0x1f')]?_[_0x3071('0x20')](_0x2ce48a[_0x3071('0x1f')],function(_0x7a4cb4){return{'model':db[_0x7a4cb4[_0x3071('0x21')]],'as':_0x7a4cb4['as'],'attributes':_0x7a4cb4[_0x3071('0x1d')],'include':_0x7a4cb4['include']?_[_0x3071('0x20')](_0x7a4cb4[_0x3071('0x1f')],function(_0x177138){return{'model':db[_0x177138['model']],'as':_0x177138['as'],'attributes':_0x177138[_0x3071('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x3071('0xc')](function(_0x163604){logger[_0x3071('0xd')](_0x3071('0x18'),_0x17dbda);logger[_0x3071('0x10')](_0x3071('0x18'),_0x17dbda,JSON[_0x3071('0x12')](_0x163604));_0x108a83(_0x163604);})[_0x3071('0x17')](function(_0x292205){logger[_0x3071('0x13')]('GetZendeskAccount',_0x292205['message'],_0x17dbda);_0x3acf0e(_0x1068d9[_0x3071('0x13')](0x1f4,_0x292205[_0x3071('0x15')]));});});};exports[_0x3071('0x22')]=function(_0x40be95){var _0x3f6d90=this;return new Promise(function(_0x29538c,_0x32b6b1){return db[_0x3071('0x19')]['find']({'raw':_0x40be95['options']?_0x40be95['options'][_0x3071('0x1c')]===undefined?!![]:![]:!![],'where':_0x40be95[_0x3071('0x1b')]?_0x40be95['options'][_0x3071('0x23')]||null:null,'attributes':_0x40be95[_0x3071('0x1b')]?_0x40be95[_0x3071('0x1b')][_0x3071('0x1d')]||null:null,'include':_0x40be95['options']?_0x40be95[_0x3071('0x1b')][_0x3071('0x1f')]?_[_0x3071('0x20')](_0x40be95[_0x3071('0x1b')][_0x3071('0x1f')],function(_0x2068ce){return{'model':db[_0x2068ce[_0x3071('0x21')]],'as':_0x2068ce['as'],'attributes':_0x2068ce[_0x3071('0x1d')],'include':_0x2068ce['include']?_[_0x3071('0x20')](_0x2068ce['include'],function(_0x4fb1ec){return{'model':db[_0x4fb1ec[_0x3071('0x21')]],'as':_0x4fb1ec['as'],'attributes':_0x4fb1ec[_0x3071('0x1d')],'include':_0x4fb1ec['include']?_[_0x3071('0x20')](_0x4fb1ec[_0x3071('0x1f')],function(_0x265d76){return{'model':db[_0x265d76[_0x3071('0x21')]],'as':_0x265d76['as'],'attributes':_0x265d76[_0x3071('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x3071('0xc')](function(_0x5610ab){logger[_0x3071('0xd')](_0x3071('0x22'),_0x40be95);logger['debug'](_0x3071('0x22'),_0x40be95,JSON['stringify'](_0x5610ab));_0x29538c(_0x5610ab);})[_0x3071('0x17')](function(_0x43133a){logger['error']('ShowZendeskAccount',_0x43133a[_0x3071('0x15')],_0x40be95);_0x32b6b1(_0x3f6d90[_0x3071('0x13')](0x1f4,_0x43133a[_0x3071('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/index.js b/server/api/intZendeskConfiguration/index.js index 9514f97..985c9ea 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 _0x271b=['connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./intZendeskConfiguration.controller','get','isAuthenticated','index','getFields','getSubjects','/:id/descriptions','getDescriptions','/:id/tags','post','create','put','/:id','update','delete','util','path'];(function(_0x56c7c0,_0x463d97){var _0x666b9a=function(_0x56e4a5){while(--_0x56e4a5){_0x56c7c0['push'](_0x56c7c0['shift']());}};_0x666b9a(++_0x463d97);}(_0x271b,0x6c));var _0xb271=function(_0x5b561d,_0x422b7c){_0x5b561d=_0x5b561d-0x0;var _0x431060=_0x271b[_0x5b561d];return _0x431060;};'use strict';var multer=require('multer');var util=require(_0xb271('0x0'));var path=require(_0xb271('0x1'));var timeout=require(_0xb271('0x2'));var express=require(_0xb271('0x3'));var router=express[_0xb271('0x4')]();var auth=require(_0xb271('0x5'));var interaction=require(_0xb271('0x6'));var config=require('../../config/environment');var controller=require(_0xb271('0x7'));router[_0xb271('0x8')]('/',auth[_0xb271('0x9')](),controller[_0xb271('0xa')]);router[_0xb271('0x8')]('/:id',auth[_0xb271('0x9')](),controller['show']);router['get']('/:id/fields',auth[_0xb271('0x9')](),controller[_0xb271('0xb')]);router[_0xb271('0x8')]('/:id/subjects',auth[_0xb271('0x9')](),controller[_0xb271('0xc')]);router[_0xb271('0x8')](_0xb271('0xd'),auth['isAuthenticated'](),controller[_0xb271('0xe')]);router[_0xb271('0x8')](_0xb271('0xf'),auth[_0xb271('0x9')](),controller['getTags']);router[_0xb271('0x10')]('/',auth[_0xb271('0x9')](),controller[_0xb271('0x11')]);router[_0xb271('0x10')]('/:id/tags',auth['isAuthenticated'](),controller['setTags']);router[_0xb271('0x12')](_0xb271('0x13'),auth[_0xb271('0x9')](),controller[_0xb271('0x14')]);router[_0xb271('0x15')]('/:id',auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x50ee=['/:id','isAuthenticated','show','get','getFields','getSubjects','/:id/descriptions','getDescriptions','/:id/tags','getTags','post','put','delete','exports','path','Router','../../components/auth/service','../../components/interaction/service','./intZendeskConfiguration.controller','index'];(function(_0x4cb40d,_0x3ef2c1){var _0x55879f=function(_0x502967){while(--_0x502967){_0x4cb40d['push'](_0x4cb40d['shift']());}};_0x55879f(++_0x3ef2c1);}(_0x50ee,0xea));var _0xe50e=function(_0x143a91,_0x235332){_0x143a91=_0x143a91-0x0;var _0x1906f5=_0x50ee[_0x143a91];return _0x1906f5;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xe50e('0x0'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xe50e('0x1')]();var auth=require(_0xe50e('0x2'));var interaction=require(_0xe50e('0x3'));var config=require('../../config/environment');var controller=require(_0xe50e('0x4'));router['get']('/',auth['isAuthenticated'](),controller[_0xe50e('0x5')]);router['get'](_0xe50e('0x6'),auth[_0xe50e('0x7')](),controller[_0xe50e('0x8')]);router[_0xe50e('0x9')]('/:id/fields',auth[_0xe50e('0x7')](),controller[_0xe50e('0xa')]);router['get']('/:id/subjects',auth['isAuthenticated'](),controller[_0xe50e('0xb')]);router[_0xe50e('0x9')](_0xe50e('0xc'),auth[_0xe50e('0x7')](),controller[_0xe50e('0xd')]);router['get'](_0xe50e('0xe'),auth[_0xe50e('0x7')](),controller[_0xe50e('0xf')]);router[_0xe50e('0x10')]('/',auth[_0xe50e('0x7')](),controller['create']);router[_0xe50e('0x10')](_0xe50e('0xe'),auth[_0xe50e('0x7')](),controller['setTags']);router[_0xe50e('0x11')](_0xe50e('0x6'),auth[_0xe50e('0x7')](),controller['update']);router[_0xe50e('0x12')]('/:id',auth['isAuthenticated'](),controller['destroy']);module[_0xe50e('0x13')]=router; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.attributes.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.attributes.js index 4027b8d..639109b 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 _0xc6f2=['sequelize','STRING'];(function(_0x27214c,_0x491dd3){var _0x33a218=function(_0x2d3f98){while(--_0x2d3f98){_0x27214c['push'](_0x27214c['shift']());}};_0x33a218(++_0x491dd3);}(_0xc6f2,0x16e));var _0x2c6f=function(_0x2ead3e,_0x20d65c){_0x2ead3e=_0x2ead3e-0x0;var _0x2618ed=_0xc6f2[_0x2ead3e];return _0x2618ed;};'use strict';var Sequelize=require(_0x2c6f('0x0'));module['exports']={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x2c6f('0x1')]}}; \ No newline at end of file +var _0x87db=['sequelize','exports','STRING'];(function(_0x31d602,_0x517a3e){var _0x41d439=function(_0x1552dd){while(--_0x1552dd){_0x31d602['push'](_0x31d602['shift']());}};_0x41d439(++_0x517a3e);}(_0x87db,0x17a));var _0xb87d=function(_0x365665,_0x29fd6f){_0x365665=_0x365665-0x0;var _0x42195c=_0x87db[_0x365665];return _0x42195c;};'use strict';var Sequelize=require(_0xb87d('0x0'));module[_0xb87d('0x1')]={'name':{'type':Sequelize[_0xb87d('0x2')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.controller.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.controller.js index ac157db..0b01bc2 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 _0xf3f7=['fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','papaparse','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','jayson/promise','http','test','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','info','ZendeskConfiguration,\x20%s,\x20%s','request\x20sent','ZendeskConfiguration,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','destroy','name','send','index','map','ZendeskConfiguration','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','where','pick','filter','merge','options','includeAll','include','findAll','show','params','length','find','create','body','getFields','findOne','sort','getSubjects','getDescriptions','getTags','setTags','ids','html-pdf','eml-format','zip-dir'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0xf3f7,0x179));var _0x7f3f=function(_0x2d2613,_0x1c51c2){_0x2d2613=_0x2d2613-0x0;var _0x5638b3=_0xf3f7[_0x2d2613];return _0x5638b3;};'use strict';var pdf=require(_0x7f3f('0x0'));var emlformat=require(_0x7f3f('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x7f3f('0x2'));var jsonpatch=require(_0x7f3f('0x3'));var rp=require(_0x7f3f('0x4'));var moment=require('moment');var BPromise=require(_0x7f3f('0x5'));var Mustache=require(_0x7f3f('0x6'));var util=require(_0x7f3f('0x7'));var path=require(_0x7f3f('0x8'));var sox=require(_0x7f3f('0x9'));var csv=require(_0x7f3f('0xa'));var ejs=require(_0x7f3f('0xb'));var fs=require('fs');var _=require(_0x7f3f('0xc'));var squel=require(_0x7f3f('0xd'));var crypto=require(_0x7f3f('0xe'));var jsforce=require(_0x7f3f('0xf'));var deskjs=require(_0x7f3f('0x10'));var toCsv=require(_0x7f3f('0xa'));var querystring=require('querystring');var Papa=require(_0x7f3f('0x11'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x7f3f('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x7f3f('0x13'));var logger=require(_0x7f3f('0x14'))(_0x7f3f('0x15'));var utils=require(_0x7f3f('0x16'));var config=require(_0x7f3f('0x17'));var db=require('../../mysqldb')['db'];var jayson=require(_0x7f3f('0x18'));var client=jayson['client'][_0x7f3f('0x19')]({'port':0x232a});function checkPasswordPattern(_0x14a3d8,_0x43ad1f,_0x3bd4ab){if(_0x3bd4ab){var _0x24e8a0=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x24e8a0[_0x7f3f('0x1a')](_0x43ad1f)){return _0x14a3d8;}else{throw new db[(_0x7f3f('0x1b'))][(_0x7f3f('0x1c'))](_0x7f3f('0x1d'));}}else{return _0x14a3d8;}}function respondWithRpcPromise(_0x8931cc,_0x56f8d4,_0x3542ab,_0x307400){return new BPromise(function(_0x4968f9,_0x36720c){var _0x5d3e59=_0x307400||client;return _0x5d3e59[_0x7f3f('0x1e')](_0x8931cc,_0x3542ab)[_0x7f3f('0x1f')](function(_0x2ce60c){logger[_0x7f3f('0x20')](_0x7f3f('0x21'),_0x56f8d4,_0x7f3f('0x22'));logger['debug'](_0x7f3f('0x23'),_0x56f8d4,_0x7f3f('0x22'),JSON['stringify'](_0x2ce60c));if(_0x2ce60c[_0x7f3f('0x24')]){if(_0x2ce60c[_0x7f3f('0x24')][_0x7f3f('0x25')]===0x1f4){logger[_0x7f3f('0x24')](_0x7f3f('0x21'),_0x56f8d4,_0x2ce60c[_0x7f3f('0x24')][_0x7f3f('0x26')]);return _0x36720c(_0x2ce60c[_0x7f3f('0x24')][_0x7f3f('0x26')]);}logger[_0x7f3f('0x24')]('ZendeskConfiguration,\x20%s,\x20%s',_0x56f8d4,_0x2ce60c[_0x7f3f('0x24')]['message']);return _0x4968f9(_0x2ce60c[_0x7f3f('0x24')]['message']);}else{logger['info'](_0x7f3f('0x21'),_0x56f8d4,_0x7f3f('0x22'));_0x4968f9(_0x2ce60c[_0x7f3f('0x27')][_0x7f3f('0x26')]);}})[_0x7f3f('0x28')](function(_0x584eb8){logger['error'](_0x7f3f('0x21'),_0x56f8d4,_0x584eb8);_0x36720c(_0x584eb8);});});}function respondWithStatusCode(_0x16c1c1,_0x2c6b68){_0x2c6b68=_0x2c6b68||0xcc;return function(_0x2196a3){if(_0x2196a3){return _0x16c1c1[_0x7f3f('0x29')](_0x2c6b68);}return _0x16c1c1[_0x7f3f('0x2a')](_0x2c6b68)[_0x7f3f('0x2b')]();};}function respondWithResult(_0x2c49d9,_0x38bd21){_0x38bd21=_0x38bd21||0xc8;return function(_0x2a7d2a){if(_0x2a7d2a){return _0x2c49d9[_0x7f3f('0x2a')](_0x38bd21)[_0x7f3f('0x2c')](_0x2a7d2a);}};}function respondWithFilteredResult(_0x4c0d8d,_0x388bb3){return function(_0x32ad55){if(_0x32ad55){var _0x10226e=_0x32ad55[_0x7f3f('0x2d')],_0x6b855=_0x388bb3[_0x7f3f('0x2e')],_0x32c88a=_0x388bb3[_0x7f3f('0x2e')]+_0x388bb3[_0x7f3f('0x2f')],_0x480347;if(_0x32c88a>=_0x10226e){_0x32c88a=_0x10226e;_0x480347=0xc8;}else{_0x480347=0xce;}_0x4c0d8d[_0x7f3f('0x2a')](_0x480347);return _0x4c0d8d[_0x7f3f('0x30')](_0x7f3f('0x31'),_0x6b855+'-'+_0x32c88a+'/'+_0x10226e)['json'](_0x32ad55);}return null;};}function patchUpdates(_0xda656b){return function(_0x341b8d){try{jsonpatch[_0x7f3f('0x32')](_0x341b8d,_0xda656b,!![]);}catch(_0x3d59f4){return BPromise[_0x7f3f('0x33')](_0x3d59f4);}return _0x341b8d[_0x7f3f('0x34')]();};}function saveUpdates(_0xeacef1,_0x2b8532){return function(_0x38c7c1){if(_0x38c7c1){return _0x38c7c1[_0x7f3f('0x35')](_0xeacef1)[_0x7f3f('0x1f')](function(_0x439e06){return _0x439e06;});}return null;};}function removeEntity(_0x1913c1,_0x2db444){return function(_0xe1a34b){if(_0xe1a34b){return _0xe1a34b[_0x7f3f('0x36')]()[_0x7f3f('0x1f')](function(){_0x1913c1[_0x7f3f('0x2a')](0xcc)[_0x7f3f('0x2b')]();});}};}function handleEntityNotFound(_0x4fb289,_0x26c33c){return function(_0x337c4a){if(!_0x337c4a){_0x4fb289[_0x7f3f('0x29')](0x194);}return _0x337c4a;};}function handleError(_0xd14a4b,_0x5bed10){_0x5bed10=_0x5bed10||0x1f4;return function(_0xb0cce8){logger[_0x7f3f('0x24')](_0xb0cce8['stack']);if(_0xb0cce8[_0x7f3f('0x37')]){delete _0xb0cce8[_0x7f3f('0x37')];}_0xd14a4b[_0x7f3f('0x2a')](_0x5bed10)[_0x7f3f('0x38')](_0xb0cce8);};}exports[_0x7f3f('0x39')]=function(_0x514a86,_0xea2d76){var _0x28dd87={},_0x11f570={},_0x240737={'count':0x0,'rows':[]};var _0x27d8fd=_[_0x7f3f('0x3a')](db[_0x7f3f('0x3b')][_0x7f3f('0x3c')],function(_0x2d0f77){return{'name':_0x2d0f77[_0x7f3f('0x3d')],'type':_0x2d0f77[_0x7f3f('0x3e')]['key']};});_0x11f570[_0x7f3f('0x3f')]=_[_0x7f3f('0x3a')](_0x27d8fd,_0x7f3f('0x37'));_0x11f570[_0x7f3f('0x40')]=_[_0x7f3f('0x41')](_0x514a86['query']);_0x11f570[_0x7f3f('0x42')]=_[_0x7f3f('0x43')](_0x11f570[_0x7f3f('0x3f')],_0x11f570[_0x7f3f('0x40')]);_0x28dd87[_0x7f3f('0x44')]=_[_0x7f3f('0x43')](_0x11f570[_0x7f3f('0x3f')],qs[_0x7f3f('0x45')](_0x514a86[_0x7f3f('0x40')]['fields']));_0x28dd87['attributes']=_0x28dd87['attributes']['length']?_0x28dd87[_0x7f3f('0x44')]:_0x11f570[_0x7f3f('0x3f')];if(!_0x514a86[_0x7f3f('0x40')][_0x7f3f('0x46')](_0x7f3f('0x47'))){_0x28dd87[_0x7f3f('0x2f')]=qs['limit'](_0x514a86[_0x7f3f('0x40')][_0x7f3f('0x2f')]);_0x28dd87['offset']=qs[_0x7f3f('0x2e')](_0x514a86['query']['offset']);}_0x28dd87[_0x7f3f('0x48')]=qs['sort'](_0x514a86[_0x7f3f('0x40')]['sort']);_0x28dd87[_0x7f3f('0x49')]=qs[_0x7f3f('0x42')](_[_0x7f3f('0x4a')](_0x514a86[_0x7f3f('0x40')],_0x11f570[_0x7f3f('0x42')]),_0x27d8fd);if(_0x514a86[_0x7f3f('0x40')][_0x7f3f('0x4b')]){_0x28dd87[_0x7f3f('0x49')]=_['merge'](_0x28dd87[_0x7f3f('0x49')],{'$or':_['map'](_0x27d8fd,function(_0x53de81){if(_0x53de81[_0x7f3f('0x3e')]!=='VIRTUAL'){var _0x5a4844={};_0x5a4844[_0x53de81[_0x7f3f('0x37')]]={'$like':'%'+_0x514a86['query']['filter']+'%'};return _0x5a4844;}})});}_0x28dd87=_[_0x7f3f('0x4c')]({},_0x28dd87,_0x514a86[_0x7f3f('0x4d')]);var _0x4a228f={'where':_0x28dd87['where']};return db[_0x7f3f('0x3b')][_0x7f3f('0x2d')](_0x4a228f)[_0x7f3f('0x1f')](function(_0x1c419e){_0x240737['count']=_0x1c419e;if(_0x514a86[_0x7f3f('0x40')][_0x7f3f('0x4e')]){_0x28dd87[_0x7f3f('0x4f')]=[{'all':!![]}];}return db[_0x7f3f('0x3b')][_0x7f3f('0x50')](_0x28dd87);})[_0x7f3f('0x1f')](function(_0x117890){_0x240737['rows']=_0x117890;return _0x240737;})[_0x7f3f('0x1f')](respondWithFilteredResult(_0xea2d76,_0x28dd87))[_0x7f3f('0x28')](handleError(_0xea2d76,null));};exports[_0x7f3f('0x51')]=function(_0xc1ca7d,_0x5d3f2b){var _0x2057d8={'raw':![],'where':{'id':_0xc1ca7d[_0x7f3f('0x52')]['id']}},_0xfb669c={};_0xfb669c[_0x7f3f('0x3f')]=_[_0x7f3f('0x41')](db[_0x7f3f('0x3b')]['rawAttributes']);_0xfb669c[_0x7f3f('0x40')]=_[_0x7f3f('0x41')](_0xc1ca7d[_0x7f3f('0x40')]);_0xfb669c[_0x7f3f('0x42')]=_[_0x7f3f('0x43')](_0xfb669c[_0x7f3f('0x3f')],_0xfb669c[_0x7f3f('0x40')]);_0x2057d8[_0x7f3f('0x44')]=_[_0x7f3f('0x43')](_0xfb669c[_0x7f3f('0x3f')],qs[_0x7f3f('0x45')](_0xc1ca7d[_0x7f3f('0x40')]['fields']));_0x2057d8[_0x7f3f('0x44')]=_0x2057d8['attributes'][_0x7f3f('0x53')]?_0x2057d8[_0x7f3f('0x44')]:_0xfb669c['model'];if(_0xc1ca7d[_0x7f3f('0x40')][_0x7f3f('0x4e')]){_0x2057d8[_0x7f3f('0x4f')]=[{'all':!![]}];}_0x2057d8=_[_0x7f3f('0x4c')]({},_0x2057d8,_0xc1ca7d[_0x7f3f('0x4d')]);return db[_0x7f3f('0x3b')][_0x7f3f('0x54')](_0x2057d8)[_0x7f3f('0x1f')](handleEntityNotFound(_0x5d3f2b,null))['then'](respondWithResult(_0x5d3f2b,null))[_0x7f3f('0x28')](handleError(_0x5d3f2b,null));};exports[_0x7f3f('0x55')]=function(_0x287865,_0x324d12){return db[_0x7f3f('0x3b')]['create'](_0x287865[_0x7f3f('0x56')],{})[_0x7f3f('0x1f')](respondWithResult(_0x324d12,0xc9))[_0x7f3f('0x28')](handleError(_0x324d12,null));};exports[_0x7f3f('0x35')]=function(_0x3e8b60,_0x32e9f7){if(_0x3e8b60[_0x7f3f('0x56')]['id']){delete _0x3e8b60['body']['id'];}return db[_0x7f3f('0x3b')][_0x7f3f('0x54')]({'where':{'id':_0x3e8b60[_0x7f3f('0x52')]['id']}})[_0x7f3f('0x1f')](handleEntityNotFound(_0x32e9f7,null))[_0x7f3f('0x1f')](saveUpdates(_0x3e8b60[_0x7f3f('0x56')],null))[_0x7f3f('0x1f')](respondWithResult(_0x32e9f7,null))[_0x7f3f('0x28')](handleError(_0x32e9f7,null));};exports[_0x7f3f('0x36')]=function(_0x161b05,_0x2f7f48){return db[_0x7f3f('0x3b')][_0x7f3f('0x54')]({'where':{'id':_0x161b05[_0x7f3f('0x52')]['id']}})[_0x7f3f('0x1f')](handleEntityNotFound(_0x2f7f48,null))[_0x7f3f('0x1f')](removeEntity(_0x2f7f48,null))[_0x7f3f('0x28')](handleError(_0x2f7f48,null));};exports[_0x7f3f('0x57')]=function(_0xe7f281,_0x1f185c,_0x3af28f){var _0x3a6b5a={};var _0x325d42={};var _0x335f1a;var _0x1a93a0;return db[_0x7f3f('0x3b')][_0x7f3f('0x58')]({'where':{'id':_0xe7f281['params']['id']}})[_0x7f3f('0x1f')](handleEntityNotFound(_0x1f185c,null))[_0x7f3f('0x1f')](function(_0x150a2a){if(_0x150a2a){_0x335f1a=_0x150a2a;_0x325d42[_0x7f3f('0x3f')]=_['keys'](db['ZendeskField'][_0x7f3f('0x3c')]);_0x325d42[_0x7f3f('0x40')]=_['keys'](_0xe7f281[_0x7f3f('0x40')]);_0x325d42[_0x7f3f('0x42')]=_[_0x7f3f('0x43')](_0x325d42[_0x7f3f('0x3f')],_0x325d42[_0x7f3f('0x40')]);_0x3a6b5a['attributes']=_['intersection'](_0x325d42[_0x7f3f('0x3f')],qs[_0x7f3f('0x45')](_0xe7f281['query'][_0x7f3f('0x45')]));_0x3a6b5a[_0x7f3f('0x44')]=_0x3a6b5a['attributes'][_0x7f3f('0x53')]?_0x3a6b5a['attributes']:_0x325d42[_0x7f3f('0x3f')];_0x3a6b5a[_0x7f3f('0x48')]=qs[_0x7f3f('0x59')](_0xe7f281['query'][_0x7f3f('0x59')]);_0x3a6b5a[_0x7f3f('0x49')]=qs[_0x7f3f('0x42')](_[_0x7f3f('0x4a')](_0xe7f281['query'],_0x325d42[_0x7f3f('0x42')]));if(_0xe7f281[_0x7f3f('0x40')][_0x7f3f('0x4b')]){_0x3a6b5a['where']=_[_0x7f3f('0x4c')](_0x3a6b5a[_0x7f3f('0x49')],{'$or':_['map'](_0x3a6b5a['attributes'],function(_0x13c6e8){var _0x5e20ce={};_0x5e20ce[_0x13c6e8]={'$like':'%'+_0xe7f281['query']['filter']+'%'};return _0x5e20ce;})});}_0x3a6b5a=_[_0x7f3f('0x4c')]({},_0x3a6b5a,_0xe7f281[_0x7f3f('0x4d')]);return _0x335f1a[_0x7f3f('0x57')](_0x3a6b5a);}})[_0x7f3f('0x1f')](function(_0x2e943b){if(_0x2e943b){_0x1a93a0=_0x2e943b[_0x7f3f('0x53')];if(!_0xe7f281[_0x7f3f('0x40')][_0x7f3f('0x46')](_0x7f3f('0x47'))){_0x3a6b5a[_0x7f3f('0x2f')]=qs[_0x7f3f('0x2f')](_0xe7f281[_0x7f3f('0x40')]['limit']);_0x3a6b5a['offset']=qs[_0x7f3f('0x2e')](_0xe7f281[_0x7f3f('0x40')][_0x7f3f('0x2e')]);}return _0x335f1a[_0x7f3f('0x57')](_0x3a6b5a);}})[_0x7f3f('0x1f')](function(_0xf24624){if(_0xf24624){return _0xf24624?{'count':_0x1a93a0,'rows':_0xf24624}:null;}})[_0x7f3f('0x1f')](respondWithResult(_0x1f185c,null))[_0x7f3f('0x28')](handleError(_0x1f185c,null));};exports[_0x7f3f('0x5a')]=function(_0x5109df,_0xe6bb5,_0x30d346){var _0x38db21={};var _0x41eb6f={};var _0x48986a;var _0x1b1d81;return db[_0x7f3f('0x3b')][_0x7f3f('0x58')]({'where':{'id':_0x5109df['params']['id']}})[_0x7f3f('0x1f')](handleEntityNotFound(_0xe6bb5,null))[_0x7f3f('0x1f')](function(_0x2fa896){if(_0x2fa896){_0x48986a=_0x2fa896;_0x41eb6f[_0x7f3f('0x3f')]=_[_0x7f3f('0x41')](db['ZendeskField'][_0x7f3f('0x3c')]);_0x41eb6f[_0x7f3f('0x40')]=_['keys'](_0x5109df[_0x7f3f('0x40')]);_0x41eb6f['filters']=_[_0x7f3f('0x43')](_0x41eb6f['model'],_0x41eb6f[_0x7f3f('0x40')]);_0x38db21['attributes']=_['intersection'](_0x41eb6f[_0x7f3f('0x3f')],qs[_0x7f3f('0x45')](_0x5109df[_0x7f3f('0x40')][_0x7f3f('0x45')]));_0x38db21[_0x7f3f('0x44')]=_0x38db21['attributes']['length']?_0x38db21['attributes']:_0x41eb6f[_0x7f3f('0x3f')];_0x38db21[_0x7f3f('0x48')]=qs['sort'](_0x5109df[_0x7f3f('0x40')][_0x7f3f('0x59')]);_0x38db21[_0x7f3f('0x49')]=qs['filters'](_[_0x7f3f('0x4a')](_0x5109df['query'],_0x41eb6f[_0x7f3f('0x42')]));if(_0x5109df[_0x7f3f('0x40')][_0x7f3f('0x4b')]){_0x38db21[_0x7f3f('0x49')]=_[_0x7f3f('0x4c')](_0x38db21[_0x7f3f('0x49')],{'$or':_[_0x7f3f('0x3a')](_0x38db21[_0x7f3f('0x44')],function(_0x3b81a0){var _0x515896={};_0x515896[_0x3b81a0]={'$like':'%'+_0x5109df['query'][_0x7f3f('0x4b')]+'%'};return _0x515896;})});}_0x38db21=_[_0x7f3f('0x4c')]({},_0x38db21,_0x5109df[_0x7f3f('0x4d')]);return _0x48986a[_0x7f3f('0x5a')](_0x38db21);}})[_0x7f3f('0x1f')](function(_0x2da4b4){if(_0x2da4b4){_0x1b1d81=_0x2da4b4[_0x7f3f('0x53')];if(!_0x5109df['query'][_0x7f3f('0x46')](_0x7f3f('0x47'))){_0x38db21[_0x7f3f('0x2f')]=qs[_0x7f3f('0x2f')](_0x5109df[_0x7f3f('0x40')][_0x7f3f('0x2f')]);_0x38db21['offset']=qs[_0x7f3f('0x2e')](_0x5109df[_0x7f3f('0x40')]['offset']);}return _0x48986a['getSubjects'](_0x38db21);}})[_0x7f3f('0x1f')](function(_0x2ffdda){if(_0x2ffdda){return _0x2ffdda?{'count':_0x1b1d81,'rows':_0x2ffdda}:null;}})['then'](respondWithResult(_0xe6bb5,null))[_0x7f3f('0x28')](handleError(_0xe6bb5,null));};exports[_0x7f3f('0x5b')]=function(_0x5e1dd5,_0x17e583,_0x57968a){var _0x18dc3c={};var _0x3a142c={};var _0x5907f6;var _0x149821;return db['ZendeskConfiguration']['findOne']({'where':{'id':_0x5e1dd5[_0x7f3f('0x52')]['id']}})['then'](handleEntityNotFound(_0x17e583,null))[_0x7f3f('0x1f')](function(_0x6e11f0){if(_0x6e11f0){_0x5907f6=_0x6e11f0;_0x3a142c[_0x7f3f('0x3f')]=_[_0x7f3f('0x41')](db['ZendeskField'][_0x7f3f('0x3c')]);_0x3a142c[_0x7f3f('0x40')]=_[_0x7f3f('0x41')](_0x5e1dd5[_0x7f3f('0x40')]);_0x3a142c[_0x7f3f('0x42')]=_[_0x7f3f('0x43')](_0x3a142c[_0x7f3f('0x3f')],_0x3a142c[_0x7f3f('0x40')]);_0x18dc3c[_0x7f3f('0x44')]=_[_0x7f3f('0x43')](_0x3a142c[_0x7f3f('0x3f')],qs[_0x7f3f('0x45')](_0x5e1dd5[_0x7f3f('0x40')][_0x7f3f('0x45')]));_0x18dc3c[_0x7f3f('0x44')]=_0x18dc3c['attributes'][_0x7f3f('0x53')]?_0x18dc3c[_0x7f3f('0x44')]:_0x3a142c[_0x7f3f('0x3f')];_0x18dc3c[_0x7f3f('0x48')]=qs['sort'](_0x5e1dd5['query']['sort']);_0x18dc3c['where']=qs[_0x7f3f('0x42')](_[_0x7f3f('0x4a')](_0x5e1dd5[_0x7f3f('0x40')],_0x3a142c['filters']));if(_0x5e1dd5['query'][_0x7f3f('0x4b')]){_0x18dc3c[_0x7f3f('0x49')]=_[_0x7f3f('0x4c')](_0x18dc3c[_0x7f3f('0x49')],{'$or':_[_0x7f3f('0x3a')](_0x18dc3c[_0x7f3f('0x44')],function(_0x28eab2){var _0x262176={};_0x262176[_0x28eab2]={'$like':'%'+_0x5e1dd5[_0x7f3f('0x40')]['filter']+'%'};return _0x262176;})});}_0x18dc3c=_[_0x7f3f('0x4c')]({},_0x18dc3c,_0x5e1dd5[_0x7f3f('0x4d')]);return _0x5907f6[_0x7f3f('0x5b')](_0x18dc3c);}})[_0x7f3f('0x1f')](function(_0x2d9645){if(_0x2d9645){_0x149821=_0x2d9645[_0x7f3f('0x53')];if(!_0x5e1dd5['query'][_0x7f3f('0x46')](_0x7f3f('0x47'))){_0x18dc3c[_0x7f3f('0x2f')]=qs['limit'](_0x5e1dd5[_0x7f3f('0x40')][_0x7f3f('0x2f')]);_0x18dc3c['offset']=qs[_0x7f3f('0x2e')](_0x5e1dd5['query']['offset']);}return _0x5907f6[_0x7f3f('0x5b')](_0x18dc3c);}})[_0x7f3f('0x1f')](function(_0x429099){if(_0x429099){return _0x429099?{'count':_0x149821,'rows':_0x429099}:null;}})[_0x7f3f('0x1f')](respondWithResult(_0x17e583,null))[_0x7f3f('0x28')](handleError(_0x17e583,null));};exports[_0x7f3f('0x5c')]=function(_0x5a00cd,_0x36b1e0,_0x30c90d){var _0x346a57={};var _0x271044={};var _0x3ac774;var _0x11ed52;return db['ZendeskConfiguration'][_0x7f3f('0x58')]({'where':{'id':_0x5a00cd[_0x7f3f('0x52')]['id']}})[_0x7f3f('0x1f')](handleEntityNotFound(_0x36b1e0,null))[_0x7f3f('0x1f')](function(_0x5a89f3){if(_0x5a89f3){_0x3ac774=_0x5a89f3;_0x271044[_0x7f3f('0x3f')]=_[_0x7f3f('0x41')](db['Tag'][_0x7f3f('0x3c')]);_0x271044[_0x7f3f('0x40')]=_[_0x7f3f('0x41')](_0x5a00cd[_0x7f3f('0x40')]);_0x271044[_0x7f3f('0x42')]=_['intersection'](_0x271044[_0x7f3f('0x3f')],_0x271044['query']);_0x346a57['attributes']=_[_0x7f3f('0x43')](_0x271044['model'],qs[_0x7f3f('0x45')](_0x5a00cd['query']['fields']));_0x346a57['attributes']=_0x346a57[_0x7f3f('0x44')]['length']?_0x346a57[_0x7f3f('0x44')]:_0x271044[_0x7f3f('0x3f')];_0x346a57[_0x7f3f('0x48')]=qs['sort'](_0x5a00cd[_0x7f3f('0x40')][_0x7f3f('0x59')]);_0x346a57[_0x7f3f('0x49')]=qs[_0x7f3f('0x42')](_[_0x7f3f('0x4a')](_0x5a00cd[_0x7f3f('0x40')],_0x271044['filters']));if(_0x5a00cd['query'][_0x7f3f('0x4b')]){_0x346a57[_0x7f3f('0x49')]=_[_0x7f3f('0x4c')](_0x346a57[_0x7f3f('0x49')],{'$or':_['map'](_0x346a57['attributes'],function(_0x3ac4b0){var _0x1bcb19={};_0x1bcb19[_0x3ac4b0]={'$like':'%'+_0x5a00cd[_0x7f3f('0x40')]['filter']+'%'};return _0x1bcb19;})});}_0x346a57=_[_0x7f3f('0x4c')]({},_0x346a57,_0x5a00cd[_0x7f3f('0x4d')]);return _0x3ac774[_0x7f3f('0x5c')](_0x346a57);}})[_0x7f3f('0x1f')](function(_0x1c1152){if(_0x1c1152){_0x11ed52=_0x1c1152[_0x7f3f('0x53')];if(!_0x5a00cd[_0x7f3f('0x40')][_0x7f3f('0x46')]('nolimit')){_0x346a57[_0x7f3f('0x2f')]=qs[_0x7f3f('0x2f')](_0x5a00cd[_0x7f3f('0x40')][_0x7f3f('0x2f')]);_0x346a57[_0x7f3f('0x2e')]=qs[_0x7f3f('0x2e')](_0x5a00cd[_0x7f3f('0x40')][_0x7f3f('0x2e')]);}return _0x3ac774[_0x7f3f('0x5c')](_0x346a57);}})['then'](function(_0x4b2e2a){if(_0x4b2e2a){return _0x4b2e2a?{'count':_0x11ed52,'rows':_0x4b2e2a}:null;}})['then'](respondWithResult(_0x36b1e0,null))[_0x7f3f('0x28')](handleError(_0x36b1e0,null));};exports[_0x7f3f('0x5d')]=function(_0x2def82,_0x45b3fc,_0x1f3159){if(_0x2def82['body']['id']){delete _0x2def82[_0x7f3f('0x56')]['id'];}return db[_0x7f3f('0x3b')][_0x7f3f('0x58')]({'where':{'id':_0x2def82[_0x7f3f('0x52')]['id']}})[_0x7f3f('0x1f')](handleEntityNotFound(_0x45b3fc,null))['then'](function(_0x5a2b48){if(_0x5a2b48){return _0x5a2b48[_0x7f3f('0x5d')](_0x2def82[_0x7f3f('0x56')][_0x7f3f('0x5e')]||[]);}return null;})[_0x7f3f('0x1f')](respondWithResult(_0x45b3fc,null))[_0x7f3f('0x28')](handleError(_0x45b3fc,null));}; \ No newline at end of file +var _0x519a=['params','includeAll','find','catch','create','body','getFields','findOne','rawAttributes','getSubjects','order','getDescriptions','ZendeskField','getTags','Tag','setTags','ids','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','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','ZendeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','ZendeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','sendStatus','status','end','count','limit','set','Content-Range','json','reject','save','destroy','stack','send','ZendeskConfiguration','fieldName','type','key','model','map','name','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','offset','sort','pick','filter','where','VIRTUAL','merge','options','include','findAll','rows'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x519a,0x128));var _0xa519=function(_0x4fde08,_0x463a36){_0x4fde08=_0x4fde08-0x0;var _0x12e725=_0x519a[_0x4fde08];return _0x12e725;};'use strict';var pdf=require(_0xa519('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xa519('0x1'));var zipdir=require(_0xa519('0x2'));var jsonpatch=require(_0xa519('0x3'));var rp=require(_0xa519('0x4'));var moment=require(_0xa519('0x5'));var BPromise=require(_0xa519('0x6'));var Mustache=require('mustache');var util=require(_0xa519('0x7'));var path=require(_0xa519('0x8'));var sox=require(_0xa519('0x9'));var csv=require(_0xa519('0xa'));var ejs=require(_0xa519('0xb'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xa519('0xa'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xa519('0xc'));var authService=require(_0xa519('0xd'));var qs=require(_0xa519('0xe'));var as=require(_0xa519('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xa519('0x10'))(_0xa519('0x11'));var utils=require(_0xa519('0x12'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];var jayson=require('jayson/promise');var client=jayson['client'][_0xa519('0x13')]({'port':0x232a});function checkPasswordPattern(_0x282d6d,_0x53f507,_0xbccc25){if(_0xbccc25){var _0x15a6e0=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x15a6e0[_0xa519('0x14')](_0x53f507)){return _0x282d6d;}else{throw new db[(_0xa519('0x15'))][(_0xa519('0x16'))](_0xa519('0x17'));}}else{return _0x282d6d;}}function respondWithRpcPromise(_0xed661c,_0x2e5404,_0x2ad6f,_0x501c6a){return new BPromise(function(_0x2c0b15,_0xde0e1b){var _0x37916a=_0x501c6a||client;return _0x37916a[_0xa519('0x18')](_0xed661c,_0x2ad6f)[_0xa519('0x19')](function(_0x13cacb){logger[_0xa519('0x1a')](_0xa519('0x1b'),_0x2e5404,_0xa519('0x1c'));logger[_0xa519('0x1d')](_0xa519('0x1e'),_0x2e5404,'request\x20sent',JSON[_0xa519('0x1f')](_0x13cacb));if(_0x13cacb['error']){if(_0x13cacb[_0xa519('0x20')][_0xa519('0x21')]===0x1f4){logger[_0xa519('0x20')](_0xa519('0x1b'),_0x2e5404,_0x13cacb['error']['message']);return _0xde0e1b(_0x13cacb['error'][_0xa519('0x22')]);}logger[_0xa519('0x20')](_0xa519('0x1b'),_0x2e5404,_0x13cacb[_0xa519('0x20')]['message']);return _0x2c0b15(_0x13cacb[_0xa519('0x20')][_0xa519('0x22')]);}else{logger['info'](_0xa519('0x1b'),_0x2e5404,_0xa519('0x1c'));_0x2c0b15(_0x13cacb[_0xa519('0x23')][_0xa519('0x22')]);}})['catch'](function(_0x58d62d){logger[_0xa519('0x20')](_0xa519('0x1b'),_0x2e5404,_0x58d62d);_0xde0e1b(_0x58d62d);});});}function respondWithStatusCode(_0x210107,_0x96ab5f){_0x96ab5f=_0x96ab5f||0xcc;return function(_0x439bb7){if(_0x439bb7){return _0x210107[_0xa519('0x24')](_0x96ab5f);}return _0x210107[_0xa519('0x25')](_0x96ab5f)[_0xa519('0x26')]();};}function respondWithResult(_0x528441,_0xc6c185){_0xc6c185=_0xc6c185||0xc8;return function(_0x25581f){if(_0x25581f){return _0x528441['status'](_0xc6c185)['json'](_0x25581f);}};}function respondWithFilteredResult(_0x6c04c2,_0x2aeb16){return function(_0x198338){if(_0x198338){var _0x59e81c=_0x198338[_0xa519('0x27')],_0xb0a3e3=_0x2aeb16['offset'],_0x160445=_0x2aeb16['offset']+_0x2aeb16[_0xa519('0x28')],_0x2e0ae0;if(_0x160445>=_0x59e81c){_0x160445=_0x59e81c;_0x2e0ae0=0xc8;}else{_0x2e0ae0=0xce;}_0x6c04c2[_0xa519('0x25')](_0x2e0ae0);return _0x6c04c2[_0xa519('0x29')](_0xa519('0x2a'),_0xb0a3e3+'-'+_0x160445+'/'+_0x59e81c)[_0xa519('0x2b')](_0x198338);}return null;};}function patchUpdates(_0x2c05e2){return function(_0x141bc5){try{jsonpatch['apply'](_0x141bc5,_0x2c05e2,!![]);}catch(_0x4c24be){return BPromise[_0xa519('0x2c')](_0x4c24be);}return _0x141bc5[_0xa519('0x2d')]();};}function saveUpdates(_0x550be7,_0x2a9a8a){return function(_0x10a317){if(_0x10a317){return _0x10a317['update'](_0x550be7)[_0xa519('0x19')](function(_0x78c0fe){return _0x78c0fe;});}return null;};}function removeEntity(_0x396aaf,_0x73e19a){return function(_0x488ea4){if(_0x488ea4){return _0x488ea4[_0xa519('0x2e')]()[_0xa519('0x19')](function(){_0x396aaf[_0xa519('0x25')](0xcc)[_0xa519('0x26')]();});}};}function handleEntityNotFound(_0x13fb6e,_0x46ac42){return function(_0x3cf158){if(!_0x3cf158){_0x13fb6e[_0xa519('0x24')](0x194);}return _0x3cf158;};}function handleError(_0x16ed7d,_0x2fd2e7){_0x2fd2e7=_0x2fd2e7||0x1f4;return function(_0x2a94de){logger[_0xa519('0x20')](_0x2a94de[_0xa519('0x2f')]);if(_0x2a94de['name']){delete _0x2a94de['name'];}_0x16ed7d[_0xa519('0x25')](_0x2fd2e7)[_0xa519('0x30')](_0x2a94de);};}exports['index']=function(_0xdf5bdb,_0x5353b3){var _0x12f91a={},_0x58822d={},_0x53227d={'count':0x0,'rows':[]};var _0x24d27e=_['map'](db[_0xa519('0x31')]['rawAttributes'],function(_0x57b764){return{'name':_0x57b764[_0xa519('0x32')],'type':_0x57b764[_0xa519('0x33')][_0xa519('0x34')]};});_0x58822d[_0xa519('0x35')]=_[_0xa519('0x36')](_0x24d27e,_0xa519('0x37'));_0x58822d[_0xa519('0x38')]=_[_0xa519('0x39')](_0xdf5bdb[_0xa519('0x38')]);_0x58822d[_0xa519('0x3a')]=_['intersection'](_0x58822d[_0xa519('0x35')],_0x58822d[_0xa519('0x38')]);_0x12f91a['attributes']=_[_0xa519('0x3b')](_0x58822d[_0xa519('0x35')],qs[_0xa519('0x3c')](_0xdf5bdb[_0xa519('0x38')]['fields']));_0x12f91a[_0xa519('0x3d')]=_0x12f91a['attributes'][_0xa519('0x3e')]?_0x12f91a[_0xa519('0x3d')]:_0x58822d[_0xa519('0x35')];if(!_0xdf5bdb['query'][_0xa519('0x3f')](_0xa519('0x40'))){_0x12f91a['limit']=qs[_0xa519('0x28')](_0xdf5bdb['query']['limit']);_0x12f91a[_0xa519('0x41')]=qs[_0xa519('0x41')](_0xdf5bdb[_0xa519('0x38')][_0xa519('0x41')]);}_0x12f91a['order']=qs['sort'](_0xdf5bdb['query'][_0xa519('0x42')]);_0x12f91a['where']=qs[_0xa519('0x3a')](_[_0xa519('0x43')](_0xdf5bdb[_0xa519('0x38')],_0x58822d[_0xa519('0x3a')]),_0x24d27e);if(_0xdf5bdb[_0xa519('0x38')][_0xa519('0x44')]){_0x12f91a['where']=_['merge'](_0x12f91a[_0xa519('0x45')],{'$or':_[_0xa519('0x36')](_0x24d27e,function(_0x78dcbf){if(_0x78dcbf['type']!==_0xa519('0x46')){var _0x2b6748={};_0x2b6748[_0x78dcbf[_0xa519('0x37')]]={'$like':'%'+_0xdf5bdb['query'][_0xa519('0x44')]+'%'};return _0x2b6748;}})});}_0x12f91a=_[_0xa519('0x47')]({},_0x12f91a,_0xdf5bdb[_0xa519('0x48')]);var _0x5b10db={'where':_0x12f91a[_0xa519('0x45')]};return db[_0xa519('0x31')][_0xa519('0x27')](_0x5b10db)[_0xa519('0x19')](function(_0x462296){_0x53227d[_0xa519('0x27')]=_0x462296;if(_0xdf5bdb[_0xa519('0x38')]['includeAll']){_0x12f91a[_0xa519('0x49')]=[{'all':!![]}];}return db[_0xa519('0x31')][_0xa519('0x4a')](_0x12f91a);})['then'](function(_0x17eb37){_0x53227d[_0xa519('0x4b')]=_0x17eb37;return _0x53227d;})[_0xa519('0x19')](respondWithFilteredResult(_0x5353b3,_0x12f91a))['catch'](handleError(_0x5353b3,null));};exports['show']=function(_0x5eca2c,_0x178f9e){var _0x3e54b5={'raw':![],'where':{'id':_0x5eca2c[_0xa519('0x4c')]['id']}},_0x502b2e={};_0x502b2e['model']=_['keys'](db[_0xa519('0x31')]['rawAttributes']);_0x502b2e[_0xa519('0x38')]=_[_0xa519('0x39')](_0x5eca2c['query']);_0x502b2e[_0xa519('0x3a')]=_[_0xa519('0x3b')](_0x502b2e['model'],_0x502b2e[_0xa519('0x38')]);_0x3e54b5[_0xa519('0x3d')]=_[_0xa519('0x3b')](_0x502b2e[_0xa519('0x35')],qs['fields'](_0x5eca2c[_0xa519('0x38')][_0xa519('0x3c')]));_0x3e54b5[_0xa519('0x3d')]=_0x3e54b5[_0xa519('0x3d')][_0xa519('0x3e')]?_0x3e54b5[_0xa519('0x3d')]:_0x502b2e[_0xa519('0x35')];if(_0x5eca2c[_0xa519('0x38')][_0xa519('0x4d')]){_0x3e54b5[_0xa519('0x49')]=[{'all':!![]}];}_0x3e54b5=_[_0xa519('0x47')]({},_0x3e54b5,_0x5eca2c[_0xa519('0x48')]);return db[_0xa519('0x31')][_0xa519('0x4e')](_0x3e54b5)[_0xa519('0x19')](handleEntityNotFound(_0x178f9e,null))[_0xa519('0x19')](respondWithResult(_0x178f9e,null))[_0xa519('0x4f')](handleError(_0x178f9e,null));};exports[_0xa519('0x50')]=function(_0x10a939,_0x1ef4e8){return db[_0xa519('0x31')]['create'](_0x10a939[_0xa519('0x51')],{})[_0xa519('0x19')](respondWithResult(_0x1ef4e8,0xc9))[_0xa519('0x4f')](handleError(_0x1ef4e8,null));};exports['update']=function(_0x38986f,_0x5ad0cc){if(_0x38986f['body']['id']){delete _0x38986f[_0xa519('0x51')]['id'];}return db[_0xa519('0x31')][_0xa519('0x4e')]({'where':{'id':_0x38986f[_0xa519('0x4c')]['id']}})['then'](handleEntityNotFound(_0x5ad0cc,null))['then'](saveUpdates(_0x38986f['body'],null))[_0xa519('0x19')](respondWithResult(_0x5ad0cc,null))[_0xa519('0x4f')](handleError(_0x5ad0cc,null));};exports['destroy']=function(_0x1795ed,_0x58fdb3){return db['ZendeskConfiguration'][_0xa519('0x4e')]({'where':{'id':_0x1795ed[_0xa519('0x4c')]['id']}})['then'](handleEntityNotFound(_0x58fdb3,null))[_0xa519('0x19')](removeEntity(_0x58fdb3,null))[_0xa519('0x4f')](handleError(_0x58fdb3,null));};exports[_0xa519('0x52')]=function(_0x1bdd38,_0x56fc9c,_0x15fbd7){var _0x442139={};var _0x1e066d={};var _0x2b6cfa;var _0x573b88;return db[_0xa519('0x31')][_0xa519('0x53')]({'where':{'id':_0x1bdd38[_0xa519('0x4c')]['id']}})[_0xa519('0x19')](handleEntityNotFound(_0x56fc9c,null))[_0xa519('0x19')](function(_0x5e93d9){if(_0x5e93d9){_0x2b6cfa=_0x5e93d9;_0x1e066d['model']=_[_0xa519('0x39')](db['ZendeskField'][_0xa519('0x54')]);_0x1e066d[_0xa519('0x38')]=_['keys'](_0x1bdd38[_0xa519('0x38')]);_0x1e066d[_0xa519('0x3a')]=_['intersection'](_0x1e066d[_0xa519('0x35')],_0x1e066d[_0xa519('0x38')]);_0x442139[_0xa519('0x3d')]=_[_0xa519('0x3b')](_0x1e066d[_0xa519('0x35')],qs[_0xa519('0x3c')](_0x1bdd38[_0xa519('0x38')]['fields']));_0x442139[_0xa519('0x3d')]=_0x442139[_0xa519('0x3d')][_0xa519('0x3e')]?_0x442139[_0xa519('0x3d')]:_0x1e066d['model'];_0x442139['order']=qs['sort'](_0x1bdd38[_0xa519('0x38')][_0xa519('0x42')]);_0x442139['where']=qs['filters'](_[_0xa519('0x43')](_0x1bdd38[_0xa519('0x38')],_0x1e066d['filters']));if(_0x1bdd38['query'][_0xa519('0x44')]){_0x442139[_0xa519('0x45')]=_[_0xa519('0x47')](_0x442139[_0xa519('0x45')],{'$or':_[_0xa519('0x36')](_0x442139[_0xa519('0x3d')],function(_0x3089d4){var _0x234d3e={};_0x234d3e[_0x3089d4]={'$like':'%'+_0x1bdd38[_0xa519('0x38')][_0xa519('0x44')]+'%'};return _0x234d3e;})});}_0x442139=_[_0xa519('0x47')]({},_0x442139,_0x1bdd38['options']);return _0x2b6cfa[_0xa519('0x52')](_0x442139);}})[_0xa519('0x19')](function(_0x551239){if(_0x551239){_0x573b88=_0x551239[_0xa519('0x3e')];if(!_0x1bdd38[_0xa519('0x38')][_0xa519('0x3f')]('nolimit')){_0x442139[_0xa519('0x28')]=qs['limit'](_0x1bdd38[_0xa519('0x38')]['limit']);_0x442139[_0xa519('0x41')]=qs['offset'](_0x1bdd38[_0xa519('0x38')][_0xa519('0x41')]);}return _0x2b6cfa[_0xa519('0x52')](_0x442139);}})[_0xa519('0x19')](function(_0x4fff2b){if(_0x4fff2b){return _0x4fff2b?{'count':_0x573b88,'rows':_0x4fff2b}:null;}})['then'](respondWithResult(_0x56fc9c,null))['catch'](handleError(_0x56fc9c,null));};exports[_0xa519('0x55')]=function(_0x16d46a,_0x3cd5c3,_0x2b29fb){var _0x26d19e={};var _0x3f9ec2={};var _0xe261e;var _0x3939de;return db[_0xa519('0x31')][_0xa519('0x53')]({'where':{'id':_0x16d46a[_0xa519('0x4c')]['id']}})[_0xa519('0x19')](handleEntityNotFound(_0x3cd5c3,null))[_0xa519('0x19')](function(_0x3dc3bd){if(_0x3dc3bd){_0xe261e=_0x3dc3bd;_0x3f9ec2[_0xa519('0x35')]=_[_0xa519('0x39')](db['ZendeskField'][_0xa519('0x54')]);_0x3f9ec2['query']=_[_0xa519('0x39')](_0x16d46a['query']);_0x3f9ec2[_0xa519('0x3a')]=_[_0xa519('0x3b')](_0x3f9ec2[_0xa519('0x35')],_0x3f9ec2[_0xa519('0x38')]);_0x26d19e['attributes']=_[_0xa519('0x3b')](_0x3f9ec2[_0xa519('0x35')],qs[_0xa519('0x3c')](_0x16d46a[_0xa519('0x38')]['fields']));_0x26d19e['attributes']=_0x26d19e[_0xa519('0x3d')][_0xa519('0x3e')]?_0x26d19e[_0xa519('0x3d')]:_0x3f9ec2['model'];_0x26d19e[_0xa519('0x56')]=qs['sort'](_0x16d46a['query'][_0xa519('0x42')]);_0x26d19e[_0xa519('0x45')]=qs['filters'](_['pick'](_0x16d46a['query'],_0x3f9ec2[_0xa519('0x3a')]));if(_0x16d46a[_0xa519('0x38')][_0xa519('0x44')]){_0x26d19e[_0xa519('0x45')]=_['merge'](_0x26d19e[_0xa519('0x45')],{'$or':_['map'](_0x26d19e[_0xa519('0x3d')],function(_0x4655f5){var _0x168e87={};_0x168e87[_0x4655f5]={'$like':'%'+_0x16d46a['query'][_0xa519('0x44')]+'%'};return _0x168e87;})});}_0x26d19e=_[_0xa519('0x47')]({},_0x26d19e,_0x16d46a[_0xa519('0x48')]);return _0xe261e[_0xa519('0x55')](_0x26d19e);}})[_0xa519('0x19')](function(_0x3a7bd6){if(_0x3a7bd6){_0x3939de=_0x3a7bd6[_0xa519('0x3e')];if(!_0x16d46a[_0xa519('0x38')][_0xa519('0x3f')](_0xa519('0x40'))){_0x26d19e['limit']=qs[_0xa519('0x28')](_0x16d46a[_0xa519('0x38')]['limit']);_0x26d19e[_0xa519('0x41')]=qs[_0xa519('0x41')](_0x16d46a[_0xa519('0x38')][_0xa519('0x41')]);}return _0xe261e[_0xa519('0x55')](_0x26d19e);}})[_0xa519('0x19')](function(_0x2b29cf){if(_0x2b29cf){return _0x2b29cf?{'count':_0x3939de,'rows':_0x2b29cf}:null;}})['then'](respondWithResult(_0x3cd5c3,null))['catch'](handleError(_0x3cd5c3,null));};exports[_0xa519('0x57')]=function(_0x227dbc,_0x3864fd,_0x6a9ab1){var _0xf9448e={};var _0x5e4a4d={};var _0x1bff97;var _0x1f3b12;return db['ZendeskConfiguration'][_0xa519('0x53')]({'where':{'id':_0x227dbc[_0xa519('0x4c')]['id']}})['then'](handleEntityNotFound(_0x3864fd,null))[_0xa519('0x19')](function(_0x260c8e){if(_0x260c8e){_0x1bff97=_0x260c8e;_0x5e4a4d[_0xa519('0x35')]=_[_0xa519('0x39')](db[_0xa519('0x58')][_0xa519('0x54')]);_0x5e4a4d[_0xa519('0x38')]=_[_0xa519('0x39')](_0x227dbc[_0xa519('0x38')]);_0x5e4a4d['filters']=_['intersection'](_0x5e4a4d[_0xa519('0x35')],_0x5e4a4d[_0xa519('0x38')]);_0xf9448e[_0xa519('0x3d')]=_[_0xa519('0x3b')](_0x5e4a4d[_0xa519('0x35')],qs[_0xa519('0x3c')](_0x227dbc[_0xa519('0x38')]['fields']));_0xf9448e['attributes']=_0xf9448e['attributes'][_0xa519('0x3e')]?_0xf9448e[_0xa519('0x3d')]:_0x5e4a4d[_0xa519('0x35')];_0xf9448e[_0xa519('0x56')]=qs['sort'](_0x227dbc['query'][_0xa519('0x42')]);_0xf9448e[_0xa519('0x45')]=qs[_0xa519('0x3a')](_[_0xa519('0x43')](_0x227dbc[_0xa519('0x38')],_0x5e4a4d[_0xa519('0x3a')]));if(_0x227dbc['query'][_0xa519('0x44')]){_0xf9448e['where']=_[_0xa519('0x47')](_0xf9448e[_0xa519('0x45')],{'$or':_[_0xa519('0x36')](_0xf9448e[_0xa519('0x3d')],function(_0x4cf523){var _0x102b15={};_0x102b15[_0x4cf523]={'$like':'%'+_0x227dbc[_0xa519('0x38')][_0xa519('0x44')]+'%'};return _0x102b15;})});}_0xf9448e=_['merge']({},_0xf9448e,_0x227dbc[_0xa519('0x48')]);return _0x1bff97[_0xa519('0x57')](_0xf9448e);}})[_0xa519('0x19')](function(_0x598c1e){if(_0x598c1e){_0x1f3b12=_0x598c1e[_0xa519('0x3e')];if(!_0x227dbc[_0xa519('0x38')][_0xa519('0x3f')](_0xa519('0x40'))){_0xf9448e['limit']=qs[_0xa519('0x28')](_0x227dbc['query'][_0xa519('0x28')]);_0xf9448e[_0xa519('0x41')]=qs[_0xa519('0x41')](_0x227dbc[_0xa519('0x38')][_0xa519('0x41')]);}return _0x1bff97['getDescriptions'](_0xf9448e);}})[_0xa519('0x19')](function(_0x20626c){if(_0x20626c){return _0x20626c?{'count':_0x1f3b12,'rows':_0x20626c}:null;}})[_0xa519('0x19')](respondWithResult(_0x3864fd,null))[_0xa519('0x4f')](handleError(_0x3864fd,null));};exports[_0xa519('0x59')]=function(_0x5dc98f,_0x1d110b,_0x4cb426){var _0x17aebb={};var _0x4bbba8={};var _0x4eb61d;var _0x53c136;return db[_0xa519('0x31')][_0xa519('0x53')]({'where':{'id':_0x5dc98f[_0xa519('0x4c')]['id']}})[_0xa519('0x19')](handleEntityNotFound(_0x1d110b,null))[_0xa519('0x19')](function(_0x593a92){if(_0x593a92){_0x4eb61d=_0x593a92;_0x4bbba8[_0xa519('0x35')]=_['keys'](db[_0xa519('0x5a')][_0xa519('0x54')]);_0x4bbba8[_0xa519('0x38')]=_[_0xa519('0x39')](_0x5dc98f[_0xa519('0x38')]);_0x4bbba8['filters']=_[_0xa519('0x3b')](_0x4bbba8[_0xa519('0x35')],_0x4bbba8[_0xa519('0x38')]);_0x17aebb[_0xa519('0x3d')]=_[_0xa519('0x3b')](_0x4bbba8[_0xa519('0x35')],qs[_0xa519('0x3c')](_0x5dc98f[_0xa519('0x38')][_0xa519('0x3c')]));_0x17aebb[_0xa519('0x3d')]=_0x17aebb[_0xa519('0x3d')][_0xa519('0x3e')]?_0x17aebb[_0xa519('0x3d')]:_0x4bbba8['model'];_0x17aebb['order']=qs[_0xa519('0x42')](_0x5dc98f[_0xa519('0x38')][_0xa519('0x42')]);_0x17aebb[_0xa519('0x45')]=qs[_0xa519('0x3a')](_[_0xa519('0x43')](_0x5dc98f[_0xa519('0x38')],_0x4bbba8[_0xa519('0x3a')]));if(_0x5dc98f['query'][_0xa519('0x44')]){_0x17aebb[_0xa519('0x45')]=_[_0xa519('0x47')](_0x17aebb[_0xa519('0x45')],{'$or':_[_0xa519('0x36')](_0x17aebb['attributes'],function(_0x2cd638){var _0x129080={};_0x129080[_0x2cd638]={'$like':'%'+_0x5dc98f['query'][_0xa519('0x44')]+'%'};return _0x129080;})});}_0x17aebb=_['merge']({},_0x17aebb,_0x5dc98f['options']);return _0x4eb61d[_0xa519('0x59')](_0x17aebb);}})[_0xa519('0x19')](function(_0x1993c1){if(_0x1993c1){_0x53c136=_0x1993c1[_0xa519('0x3e')];if(!_0x5dc98f[_0xa519('0x38')][_0xa519('0x3f')](_0xa519('0x40'))){_0x17aebb[_0xa519('0x28')]=qs['limit'](_0x5dc98f[_0xa519('0x38')]['limit']);_0x17aebb[_0xa519('0x41')]=qs[_0xa519('0x41')](_0x5dc98f['query']['offset']);}return _0x4eb61d['getTags'](_0x17aebb);}})['then'](function(_0x2197d4){if(_0x2197d4){return _0x2197d4?{'count':_0x53c136,'rows':_0x2197d4}:null;}})[_0xa519('0x19')](respondWithResult(_0x1d110b,null))[_0xa519('0x4f')](handleError(_0x1d110b,null));};exports[_0xa519('0x5b')]=function(_0x37403c,_0x5d2fea,_0x2ca4d3){if(_0x37403c[_0xa519('0x51')]['id']){delete _0x37403c[_0xa519('0x51')]['id'];}return db[_0xa519('0x31')][_0xa519('0x53')]({'where':{'id':_0x37403c[_0xa519('0x4c')]['id']}})['then'](handleEntityNotFound(_0x5d2fea,null))[_0xa519('0x19')](function(_0x3bd00c){if(_0x3bd00c){return _0x3bd00c[_0xa519('0x5b')](_0x37403c['body'][_0xa519('0x5c')]||[]);}return null;})[_0xa519('0x19')](respondWithResult(_0x5d2fea,null))['catch'](handleError(_0x5d2fea,null));}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.model.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.model.js index 16d9bfa..4514c96 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 _0x615a=['ZendeskConfiguration','int_zendesk_configurations','lodash','util','api','moment','bluebird','path','rimraf','../../config/environment','./intZendeskConfiguration.attributes','define'];(function(_0x574774,_0x21e068){var _0x34673c=function(_0x982008){while(--_0x982008){_0x574774['push'](_0x574774['shift']());}};_0x34673c(++_0x21e068);}(_0x615a,0x6e));var _0xa615=function(_0x55291a,_0x814018){_0x55291a=_0x55291a-0x0;var _0x3c870c=_0x615a[_0x55291a];return _0x3c870c;};'use strict';var _=require(_0xa615('0x0'));var util=require(_0xa615('0x1'));var logger=require('../../config/logger')(_0xa615('0x2'));var moment=require(_0xa615('0x3'));var BPromise=require(_0xa615('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xa615('0x5'));var rimraf=require(_0xa615('0x6'));var config=require(_0xa615('0x7'));var attributes=require(_0xa615('0x8'));module['exports']=function(_0x225fd8,_0x5bd3ed){return _0x225fd8[_0xa615('0x9')](_0xa615('0xa'),attributes,{'tableName':_0xa615('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2ddf=['define','ZendeskConfiguration','int_zendesk_configurations','lodash','moment','request-promise','path','rimraf','./intZendeskConfiguration.attributes','exports'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x2ddf,0x175));var _0xf2dd=function(_0x413bd2,_0x1b28f7){_0x413bd2=_0x413bd2-0x0;var _0xbf0d0e=_0x2ddf[_0x413bd2];return _0xbf0d0e;};'use strict';var _=require(_0xf2dd('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0xf2dd('0x1'));var BPromise=require('bluebird');var rp=require(_0xf2dd('0x2'));var fs=require('fs');var path=require(_0xf2dd('0x3'));var rimraf=require(_0xf2dd('0x4'));var config=require('../../config/environment');var attributes=require(_0xf2dd('0x5'));module[_0xf2dd('0x6')]=function(_0x13b335,_0x4c6318){return _0x13b335[_0xf2dd('0x7')](_0xf2dd('0x8'),attributes,{'tableName':_0xf2dd('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.rpc.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.rpc.js index 4ca77f3..2d36781 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 _0xe912=['ZendeskConfiguration,\x20%s,\x20%s','message','result','catch','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','request','then','info','request\x20sent','debug','stringify','code','error'];(function(_0x5d4276,_0x37e98f){var _0x4b21ee=function(_0x522474){while(--_0x522474){_0x5d4276['push'](_0x5d4276['shift']());}};_0x4b21ee(++_0x37e98f);}(_0xe912,0xc1));var _0x2e91=function(_0x2d8d5b,_0x294df8){_0x2d8d5b=_0x2d8d5b-0x0;var _0x332c9c=_0xe912[_0x2d8d5b];return _0x332c9c;};'use strict';var _=require(_0x2e91('0x0'));var util=require(_0x2e91('0x1'));var moment=require(_0x2e91('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2e91('0x3'));var db=require(_0x2e91('0x4'))['db'];var utils=require(_0x2e91('0x5'));var logger=require(_0x2e91('0x6'))(_0x2e91('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x2e91('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x59f97b,_0x34fc44,_0x14918c){return new BPromise(function(_0x63f97d,_0x3bb341){return client[_0x2e91('0x9')](_0x59f97b,_0x14918c)[_0x2e91('0xa')](function(_0x4567a5){logger[_0x2e91('0xb')]('ZendeskConfiguration,\x20%s,\x20%s',_0x34fc44,_0x2e91('0xc'));logger[_0x2e91('0xd')]('ZendeskConfiguration,\x20%s,\x20%s,\x20%s',_0x34fc44,_0x2e91('0xc'),JSON[_0x2e91('0xe')](_0x4567a5));if(_0x4567a5['error']){if(_0x4567a5['error'][_0x2e91('0xf')]===0x1f4){logger[_0x2e91('0x10')]('ZendeskConfiguration,\x20%s,\x20%s',_0x34fc44,_0x4567a5['error']['message']);return _0x3bb341(_0x4567a5['error']['message']);}logger[_0x2e91('0x10')](_0x2e91('0x11'),_0x34fc44,_0x4567a5[_0x2e91('0x10')][_0x2e91('0x12')]);return _0x63f97d(_0x4567a5[_0x2e91('0x10')][_0x2e91('0x12')]);}else{logger['info'](_0x2e91('0x11'),_0x34fc44,'request\x20sent');_0x63f97d(_0x4567a5[_0x2e91('0x13')][_0x2e91('0x12')]);}})[_0x2e91('0x14')](function(_0x16639b){logger[_0x2e91('0x10')](_0x2e91('0x11'),_0x34fc44,_0x16639b);_0x3bb341(_0x16639b);});});} \ No newline at end of file +var _0x4eb8=['http','info','request\x20sent','debug','stringify','error','ZendeskConfiguration,\x20%s,\x20%s','message','util','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x3e6c66,_0x247d46){var _0x478d53=function(_0x493351){while(--_0x493351){_0x3e6c66['push'](_0x3e6c66['shift']());}};_0x478d53(++_0x247d46);}(_0x4eb8,0x14c));var _0x84eb=function(_0x4ac761,_0x228735){_0x4ac761=_0x4ac761-0x0;var _0x4de38d=_0x4eb8[_0x4ac761];return _0x4de38d;};'use strict';var _=require('lodash');var util=require(_0x84eb('0x0'));var moment=require(_0x84eb('0x1'));var BPromise=require(_0x84eb('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x84eb('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x84eb('0x4'));var logger=require(_0x84eb('0x5'))(_0x84eb('0x6'));var config=require(_0x84eb('0x7'));var jayson=require(_0x84eb('0x8'));var client=jayson[_0x84eb('0x9')][_0x84eb('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x47ec6a,_0x1ac448,_0x3ddf15){return new BPromise(function(_0x15ff08,_0x2be528){return client['request'](_0x47ec6a,_0x3ddf15)['then'](function(_0x56d183){logger[_0x84eb('0xb')]('ZendeskConfiguration,\x20%s,\x20%s',_0x1ac448,_0x84eb('0xc'));logger[_0x84eb('0xd')]('ZendeskConfiguration,\x20%s,\x20%s,\x20%s',_0x1ac448,_0x84eb('0xc'),JSON[_0x84eb('0xe')](_0x56d183));if(_0x56d183[_0x84eb('0xf')]){if(_0x56d183[_0x84eb('0xf')]['code']===0x1f4){logger['error'](_0x84eb('0x10'),_0x1ac448,_0x56d183[_0x84eb('0xf')][_0x84eb('0x11')]);return _0x2be528(_0x56d183['error'][_0x84eb('0x11')]);}logger[_0x84eb('0xf')](_0x84eb('0x10'),_0x1ac448,_0x56d183[_0x84eb('0xf')][_0x84eb('0x11')]);return _0x15ff08(_0x56d183[_0x84eb('0xf')]['message']);}else{logger[_0x84eb('0xb')]('ZendeskConfiguration,\x20%s,\x20%s',_0x1ac448,_0x84eb('0xc'));_0x15ff08(_0x56d183['result']['message']);}})['catch'](function(_0x5de2ad){logger['error'](_0x84eb('0x10'),_0x1ac448,_0x5de2ad);_0x2be528(_0x5de2ad);});});} \ No newline at end of file diff --git a/server/api/intZendeskField/index.js b/server/api/intZendeskField/index.js index 46c615d..cfdf0f3 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 _0xe9ff=['Router','../../components/auth/service','../../config/environment','./intZendeskField.controller','get','isAuthenticated','index','/:id','post','create','put','update','delete','exports','multer','path','connect-timeout','express'];(function(_0x47fb00,_0x288858){var _0x30f079=function(_0x4f4911){while(--_0x4f4911){_0x47fb00['push'](_0x47fb00['shift']());}};_0x30f079(++_0x288858);}(_0xe9ff,0x19a));var _0xfe9f=function(_0x3dd047,_0x46e37e){_0x3dd047=_0x3dd047-0x0;var _0x13006f=_0xe9ff[_0x3dd047];return _0x13006f;};'use strict';var multer=require(_0xfe9f('0x0'));var util=require('util');var path=require(_0xfe9f('0x1'));var timeout=require(_0xfe9f('0x2'));var express=require(_0xfe9f('0x3'));var router=express[_0xfe9f('0x4')]();var auth=require(_0xfe9f('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xfe9f('0x6'));var controller=require(_0xfe9f('0x7'));router[_0xfe9f('0x8')]('/',auth[_0xfe9f('0x9')](),controller[_0xfe9f('0xa')]);router[_0xfe9f('0x8')](_0xfe9f('0xb'),auth[_0xfe9f('0x9')](),controller['show']);router[_0xfe9f('0xc')]('/',auth[_0xfe9f('0x9')](),controller[_0xfe9f('0xd')]);router[_0xfe9f('0xe')]('/:id',auth[_0xfe9f('0x9')](),controller[_0xfe9f('0xf')]);router[_0xfe9f('0x10')]('/:id',auth['isAuthenticated'](),controller['destroy']);module[_0xfe9f('0x11')]=router; \ No newline at end of file +var _0xb845=['../../components/interaction/service','../../config/environment','./intZendeskField.controller','get','isAuthenticated','index','/:id','show','post','create','put','update','delete','destroy','exports','util','path','connect-timeout','Router','../../components/auth/service'];(function(_0x56d117,_0x530489){var _0x2c7514=function(_0x1ce23c){while(--_0x1ce23c){_0x56d117['push'](_0x56d117['shift']());}};_0x2c7514(++_0x530489);}(_0xb845,0x18b));var _0x5b84=function(_0x500785,_0x15e5ff){_0x500785=_0x500785-0x0;var _0x1f8bcc=_0xb845[_0x500785];return _0x1f8bcc;};'use strict';var multer=require('multer');var util=require(_0x5b84('0x0'));var path=require(_0x5b84('0x1'));var timeout=require(_0x5b84('0x2'));var express=require('express');var router=express[_0x5b84('0x3')]();var auth=require(_0x5b84('0x4'));var interaction=require(_0x5b84('0x5'));var config=require(_0x5b84('0x6'));var controller=require(_0x5b84('0x7'));router[_0x5b84('0x8')]('/',auth[_0x5b84('0x9')](),controller[_0x5b84('0xa')]);router[_0x5b84('0x8')](_0x5b84('0xb'),auth[_0x5b84('0x9')](),controller[_0x5b84('0xc')]);router[_0x5b84('0xd')]('/',auth[_0x5b84('0x9')](),controller[_0x5b84('0xe')]);router[_0x5b84('0xf')](_0x5b84('0xb'),auth[_0x5b84('0x9')](),controller[_0x5b84('0x10')]);router[_0x5b84('0x11')](_0x5b84('0xb'),auth['isAuthenticated'](),controller[_0x5b84('0x12')]);module[_0x5b84('0x13')]=router; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.attributes.js b/server/api/intZendeskField/intZendeskField.attributes.js index a9be6fc..2a1fa2e 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 _0x1580=['customVariable','keyValue','STRING','BOOLEAN','sequelize','exports','ENUM','string','variable'];(function(_0x49800e,_0x9dd2e0){var _0x440134=function(_0x43cbef){while(--_0x43cbef){_0x49800e['push'](_0x49800e['shift']());}};_0x440134(++_0x9dd2e0);}(_0x1580,0x15a));var _0x0158=function(_0x3bc798,_0x1ee6b4){_0x3bc798=_0x3bc798-0x0;var _0x13321c=_0x1580[_0x3bc798];return _0x13321c;};'use strict';var Sequelize=require(_0x0158('0x0'));module[_0x0158('0x1')]={'type':{'type':Sequelize[_0x0158('0x2')](_0x0158('0x3'),_0x0158('0x4'),_0x0158('0x5'),_0x0158('0x6')),'defaultValue':'string'},'content':{'type':Sequelize[_0x0158('0x7')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0x0158('0x2')](_0x0158('0x3'),'variable',_0x0158('0x5'))},'keyContent':{'type':Sequelize[_0x0158('0x7')]},'idField':{'type':Sequelize[_0x0158('0x7')]},'nameField':{'type':Sequelize[_0x0158('0x7')]},'customField':{'type':Sequelize[_0x0158('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xf987=['customVariable','keyValue','STRING','variable','ENUM','string'];(function(_0x22ecde,_0x1a7fb0){var _0xfcc99e=function(_0x106c89){while(--_0x106c89){_0x22ecde['push'](_0x22ecde['shift']());}};_0xfcc99e(++_0x1a7fb0);}(_0xf987,0x18a));var _0x7f98=function(_0x52c606,_0x94600e){_0x52c606=_0x52c606-0x0;var _0x44cd99=_0xf987[_0x52c606];return _0x44cd99;};'use strict';var Sequelize=require('sequelize');module['exports']={'type':{'type':Sequelize[_0x7f98('0x0')](_0x7f98('0x1'),'variable',_0x7f98('0x2'),_0x7f98('0x3')),'defaultValue':_0x7f98('0x1')},'content':{'type':Sequelize[_0x7f98('0x4')]},'key':{'type':Sequelize[_0x7f98('0x4')]},'keyType':{'type':Sequelize[_0x7f98('0x0')](_0x7f98('0x1'),_0x7f98('0x5'),_0x7f98('0x2'))},'keyContent':{'type':Sequelize[_0x7f98('0x4')]},'idField':{'type':Sequelize[_0x7f98('0x4')]},'nameField':{'type':Sequelize[_0x7f98('0x4')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x7f98('0x4')]}}; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.controller.js b/server/api/intZendeskField/intZendeskField.controller.js index b426b68..3fb89c1 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 _0xa7be=['VIRTUAL','options','include','ZendeskField','rows','catch','show','params','keys','includeAll','create','body','destroy','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','lodash','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','end','json','count','offset','limit','set','apply','reject','save','update','then','error','stack','name','send','map','rawAttributes','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','filter','merge'];(function(_0x12c7e5,_0x4f82a7){var _0x266fe0=function(_0xe76c9){while(--_0xe76c9){_0x12c7e5['push'](_0x12c7e5['shift']());}};_0x266fe0(++_0x4f82a7);}(_0xa7be,0x170));var _0xea7b=function(_0x5ef89e,_0x4421bd){_0x5ef89e=_0x5ef89e-0x0;var _0x52fd3f=_0xa7be[_0x5ef89e];return _0x52fd3f;};'use strict';var pdf=require(_0xea7b('0x0'));var emlformat=require(_0xea7b('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xea7b('0x2'));var jsonpatch=require(_0xea7b('0x3'));var rp=require(_0xea7b('0x4'));var moment=require(_0xea7b('0x5'));var BPromise=require(_0xea7b('0x6'));var Mustache=require(_0xea7b('0x7'));var util=require(_0xea7b('0x8'));var path=require(_0xea7b('0x9'));var sox=require('sox');var csv=require(_0xea7b('0xa'));var ejs=require(_0xea7b('0xb'));var fs=require('fs');var _=require(_0xea7b('0xc'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xea7b('0xd'));var deskjs=require(_0xea7b('0xe'));var toCsv=require('to-csv');var querystring=require(_0xea7b('0xf'));var Papa=require(_0xea7b('0x10'));var Redis=require(_0xea7b('0x11'));var authService=require('../../components/auth/service');var qs=require(_0xea7b('0x12'));var as=require(_0xea7b('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xea7b('0x14'))(_0xea7b('0x15'));var utils=require(_0xea7b('0x16'));var config=require(_0xea7b('0x17'));var db=require(_0xea7b('0x18'))['db'];function respondWithStatusCode(_0x596670,_0x145647){_0x145647=_0x145647||0xcc;return function(_0xaa5924){if(_0xaa5924){return _0x596670['sendStatus'](_0x145647);}return _0x596670[_0xea7b('0x19')](_0x145647)[_0xea7b('0x1a')]();};}function respondWithResult(_0x331870,_0x12a131){_0x12a131=_0x12a131||0xc8;return function(_0x3e0f74){if(_0x3e0f74){return _0x331870[_0xea7b('0x19')](_0x12a131)[_0xea7b('0x1b')](_0x3e0f74);}};}function respondWithFilteredResult(_0x48184f,_0x480eed){return function(_0x2bc237){if(_0x2bc237){var _0x13918f=_0x2bc237[_0xea7b('0x1c')],_0x4133c6=_0x480eed[_0xea7b('0x1d')],_0x140ebf=_0x480eed[_0xea7b('0x1d')]+_0x480eed[_0xea7b('0x1e')],_0x2f887c;if(_0x140ebf>=_0x13918f){_0x140ebf=_0x13918f;_0x2f887c=0xc8;}else{_0x2f887c=0xce;}_0x48184f[_0xea7b('0x19')](_0x2f887c);return _0x48184f[_0xea7b('0x1f')]('Content-Range',_0x4133c6+'-'+_0x140ebf+'/'+_0x13918f)[_0xea7b('0x1b')](_0x2bc237);}return null;};}function patchUpdates(_0x45f077){return function(_0x18267d){try{jsonpatch[_0xea7b('0x20')](_0x18267d,_0x45f077,!![]);}catch(_0x11f0d8){return BPromise[_0xea7b('0x21')](_0x11f0d8);}return _0x18267d[_0xea7b('0x22')]();};}function saveUpdates(_0x402de9,_0x2a5247){return function(_0x5781e4){if(_0x5781e4){return _0x5781e4[_0xea7b('0x23')](_0x402de9)[_0xea7b('0x24')](function(_0x259374){return _0x259374;});}return null;};}function removeEntity(_0x2c7c8d,_0x67f1f2){return function(_0x225506){if(_0x225506){return _0x225506['destroy']()[_0xea7b('0x24')](function(){_0x2c7c8d[_0xea7b('0x19')](0xcc)[_0xea7b('0x1a')]();});}};}function handleEntityNotFound(_0x48eb1f,_0xd2e57a){return function(_0x3df867){if(!_0x3df867){_0x48eb1f['sendStatus'](0x194);}return _0x3df867;};}function handleError(_0xd5e960,_0x2d02d2){_0x2d02d2=_0x2d02d2||0x1f4;return function(_0x196017){logger[_0xea7b('0x25')](_0x196017[_0xea7b('0x26')]);if(_0x196017[_0xea7b('0x27')]){delete _0x196017[_0xea7b('0x27')];}_0xd5e960[_0xea7b('0x19')](_0x2d02d2)[_0xea7b('0x28')](_0x196017);};}exports['index']=function(_0x1c3814,_0x41ea49){var _0x4c9e3a={},_0x5b5e9c={},_0x148bf4={'count':0x0,'rows':[]};var _0x4240c5=_[_0xea7b('0x29')](db['ZendeskField'][_0xea7b('0x2a')],function(_0x185340){return{'name':_0x185340['fieldName'],'type':_0x185340[_0xea7b('0x2b')][_0xea7b('0x2c')]};});_0x5b5e9c[_0xea7b('0x2d')]=_[_0xea7b('0x29')](_0x4240c5,_0xea7b('0x27'));_0x5b5e9c[_0xea7b('0x2e')]=_['keys'](_0x1c3814[_0xea7b('0x2e')]);_0x5b5e9c[_0xea7b('0x2f')]=_[_0xea7b('0x30')](_0x5b5e9c[_0xea7b('0x2d')],_0x5b5e9c[_0xea7b('0x2e')]);_0x4c9e3a[_0xea7b('0x31')]=_['intersection'](_0x5b5e9c['model'],qs[_0xea7b('0x32')](_0x1c3814['query'][_0xea7b('0x32')]));_0x4c9e3a[_0xea7b('0x31')]=_0x4c9e3a[_0xea7b('0x31')][_0xea7b('0x33')]?_0x4c9e3a[_0xea7b('0x31')]:_0x5b5e9c[_0xea7b('0x2d')];if(!_0x1c3814[_0xea7b('0x2e')][_0xea7b('0x34')]('nolimit')){_0x4c9e3a[_0xea7b('0x1e')]=qs[_0xea7b('0x1e')](_0x1c3814[_0xea7b('0x2e')][_0xea7b('0x1e')]);_0x4c9e3a[_0xea7b('0x1d')]=qs[_0xea7b('0x1d')](_0x1c3814['query']['offset']);}_0x4c9e3a[_0xea7b('0x35')]=qs['sort'](_0x1c3814['query'][_0xea7b('0x36')]);_0x4c9e3a[_0xea7b('0x37')]=qs[_0xea7b('0x2f')](_['pick'](_0x1c3814[_0xea7b('0x2e')],_0x5b5e9c[_0xea7b('0x2f')]),_0x4240c5);if(_0x1c3814[_0xea7b('0x2e')][_0xea7b('0x38')]){_0x4c9e3a[_0xea7b('0x37')]=_[_0xea7b('0x39')](_0x4c9e3a['where'],{'$or':_[_0xea7b('0x29')](_0x4240c5,function(_0x3d0d47){if(_0x3d0d47['type']!==_0xea7b('0x3a')){var _0x5b752e={};_0x5b752e[_0x3d0d47[_0xea7b('0x27')]]={'$like':'%'+_0x1c3814[_0xea7b('0x2e')][_0xea7b('0x38')]+'%'};return _0x5b752e;}})});}_0x4c9e3a=_['merge']({},_0x4c9e3a,_0x1c3814[_0xea7b('0x3b')]);var _0x397181={'where':_0x4c9e3a[_0xea7b('0x37')]};return db['ZendeskField'][_0xea7b('0x1c')](_0x397181)['then'](function(_0x516855){_0x148bf4[_0xea7b('0x1c')]=_0x516855;if(_0x1c3814['query']['includeAll']){_0x4c9e3a[_0xea7b('0x3c')]=[{'all':!![]}];}return db[_0xea7b('0x3d')]['findAll'](_0x4c9e3a);})[_0xea7b('0x24')](function(_0x1dc617){_0x148bf4[_0xea7b('0x3e')]=_0x1dc617;return _0x148bf4;})['then'](respondWithFilteredResult(_0x41ea49,_0x4c9e3a))[_0xea7b('0x3f')](handleError(_0x41ea49,null));};exports[_0xea7b('0x40')]=function(_0xb8e8c3,_0x54dad6){var _0x2c6ab8={'raw':!![],'where':{'id':_0xb8e8c3[_0xea7b('0x41')]['id']}},_0xcd30be={};_0xcd30be[_0xea7b('0x2d')]=_[_0xea7b('0x42')](db[_0xea7b('0x3d')][_0xea7b('0x2a')]);_0xcd30be[_0xea7b('0x2e')]=_[_0xea7b('0x42')](_0xb8e8c3[_0xea7b('0x2e')]);_0xcd30be[_0xea7b('0x2f')]=_[_0xea7b('0x30')](_0xcd30be[_0xea7b('0x2d')],_0xcd30be[_0xea7b('0x2e')]);_0x2c6ab8['attributes']=_['intersection'](_0xcd30be['model'],qs[_0xea7b('0x32')](_0xb8e8c3[_0xea7b('0x2e')][_0xea7b('0x32')]));_0x2c6ab8[_0xea7b('0x31')]=_0x2c6ab8[_0xea7b('0x31')][_0xea7b('0x33')]?_0x2c6ab8['attributes']:_0xcd30be[_0xea7b('0x2d')];if(_0xb8e8c3[_0xea7b('0x2e')][_0xea7b('0x43')]){_0x2c6ab8[_0xea7b('0x3c')]=[{'all':!![]}];}_0x2c6ab8=_[_0xea7b('0x39')]({},_0x2c6ab8,_0xb8e8c3['options']);return db[_0xea7b('0x3d')]['find'](_0x2c6ab8)[_0xea7b('0x24')](handleEntityNotFound(_0x54dad6,null))[_0xea7b('0x24')](respondWithResult(_0x54dad6,null))['catch'](handleError(_0x54dad6,null));};exports[_0xea7b('0x44')]=function(_0x11f6dc,_0xd30e65){return db[_0xea7b('0x3d')][_0xea7b('0x44')](_0x11f6dc['body'],{})[_0xea7b('0x24')](respondWithResult(_0xd30e65,0xc9))[_0xea7b('0x3f')](handleError(_0xd30e65,null));};exports['update']=function(_0xe0e59e,_0x2e369e){if(_0xe0e59e[_0xea7b('0x45')]['id']){delete _0xe0e59e[_0xea7b('0x45')]['id'];}return db['ZendeskField']['find']({'where':{'id':_0xe0e59e['params']['id']}})[_0xea7b('0x24')](handleEntityNotFound(_0x2e369e,null))[_0xea7b('0x24')](saveUpdates(_0xe0e59e[_0xea7b('0x45')],null))[_0xea7b('0x24')](respondWithResult(_0x2e369e,null))[_0xea7b('0x3f')](handleError(_0x2e369e,null));};exports[_0xea7b('0x46')]=function(_0x3f63c4,_0x36b9b2){return db[_0xea7b('0x3d')]['find']({'where':{'id':_0x3f63c4[_0xea7b('0x41')]['id']}})[_0xea7b('0x24')](handleEntityNotFound(_0x36b9b2,null))['then'](removeEntity(_0x36b9b2,null))[_0xea7b('0x3f')](handleError(_0x36b9b2,null));}; \ No newline at end of file +var _0xab84=['desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','status','json','count','offset','limit','set','reject','save','update','then','destroy','end','error','stack','name','send','index','map','ZendeskField','rawAttributes','fieldName','type','key','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','includeAll','findAll','rows','catch','show','keys','include','create','body','find','params','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','jsforce'];(function(_0x5bf4ad,_0x26d392){var _0x357aab=function(_0x45ff3c){while(--_0x45ff3c){_0x5bf4ad['push'](_0x5bf4ad['shift']());}};_0x357aab(++_0x26d392);}(_0xab84,0x169));var _0x4ab8=function(_0x10e485,_0x4ee577){_0x10e485=_0x10e485-0x0;var _0x540f38=_0xab84[_0x10e485];return _0x540f38;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0x4ab8('0x0'));var zipdir=require(_0x4ab8('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x4ab8('0x2'));var moment=require(_0x4ab8('0x3'));var BPromise=require(_0x4ab8('0x4'));var Mustache=require(_0x4ab8('0x5'));var util=require(_0x4ab8('0x6'));var path=require(_0x4ab8('0x7'));var sox=require(_0x4ab8('0x8'));var csv=require(_0x4ab8('0x9'));var ejs=require(_0x4ab8('0xa'));var fs=require('fs');var _=require(_0x4ab8('0xb'));var squel=require(_0x4ab8('0xc'));var crypto=require('crypto');var jsforce=require(_0x4ab8('0xd'));var deskjs=require(_0x4ab8('0xe'));var toCsv=require('to-csv');var querystring=require(_0x4ab8('0xf'));var Papa=require(_0x4ab8('0x10'));var Redis=require('ioredis');var authService=require(_0x4ab8('0x11'));var qs=require(_0x4ab8('0x12'));var as=require(_0x4ab8('0x13'));var hardwareService=require(_0x4ab8('0x14'));var logger=require(_0x4ab8('0x15'))(_0x4ab8('0x16'));var utils=require(_0x4ab8('0x17'));var config=require('../../config/environment');var db=require(_0x4ab8('0x18'))['db'];function respondWithStatusCode(_0x636320,_0x2def03){_0x2def03=_0x2def03||0xcc;return function(_0x2fd8cf){if(_0x2fd8cf){return _0x636320['sendStatus'](_0x2def03);}return _0x636320[_0x4ab8('0x19')](_0x2def03)['end']();};}function respondWithResult(_0x4c342e,_0x188664){_0x188664=_0x188664||0xc8;return function(_0x1307a6){if(_0x1307a6){return _0x4c342e[_0x4ab8('0x19')](_0x188664)[_0x4ab8('0x1a')](_0x1307a6);}};}function respondWithFilteredResult(_0x146784,_0x22d641){return function(_0x3aba42){if(_0x3aba42){var _0xfb981b=_0x3aba42[_0x4ab8('0x1b')],_0x50dede=_0x22d641[_0x4ab8('0x1c')],_0x1bc003=_0x22d641['offset']+_0x22d641[_0x4ab8('0x1d')],_0x2f128e;if(_0x1bc003>=_0xfb981b){_0x1bc003=_0xfb981b;_0x2f128e=0xc8;}else{_0x2f128e=0xce;}_0x146784[_0x4ab8('0x19')](_0x2f128e);return _0x146784[_0x4ab8('0x1e')]('Content-Range',_0x50dede+'-'+_0x1bc003+'/'+_0xfb981b)[_0x4ab8('0x1a')](_0x3aba42);}return null;};}function patchUpdates(_0x27c633){return function(_0x3f34b2){try{jsonpatch['apply'](_0x3f34b2,_0x27c633,!![]);}catch(_0x118756){return BPromise[_0x4ab8('0x1f')](_0x118756);}return _0x3f34b2[_0x4ab8('0x20')]();};}function saveUpdates(_0xcd770c,_0x1c9daa){return function(_0x5ac5ac){if(_0x5ac5ac){return _0x5ac5ac[_0x4ab8('0x21')](_0xcd770c)[_0x4ab8('0x22')](function(_0x1c5408){return _0x1c5408;});}return null;};}function removeEntity(_0x36e820,_0x442dd7){return function(_0x11221e){if(_0x11221e){return _0x11221e[_0x4ab8('0x23')]()[_0x4ab8('0x22')](function(){_0x36e820[_0x4ab8('0x19')](0xcc)[_0x4ab8('0x24')]();});}};}function handleEntityNotFound(_0x1e3771,_0x3c66fe){return function(_0x494d46){if(!_0x494d46){_0x1e3771['sendStatus'](0x194);}return _0x494d46;};}function handleError(_0x56637c,_0x35c74f){_0x35c74f=_0x35c74f||0x1f4;return function(_0x5e3acd){logger[_0x4ab8('0x25')](_0x5e3acd[_0x4ab8('0x26')]);if(_0x5e3acd['name']){delete _0x5e3acd[_0x4ab8('0x27')];}_0x56637c[_0x4ab8('0x19')](_0x35c74f)[_0x4ab8('0x28')](_0x5e3acd);};}exports[_0x4ab8('0x29')]=function(_0x2ba53a,_0xa725bf){var _0x126c3f={},_0x337fd1={},_0x6fd6de={'count':0x0,'rows':[]};var _0x2c9e7d=_[_0x4ab8('0x2a')](db[_0x4ab8('0x2b')][_0x4ab8('0x2c')],function(_0x546427){return{'name':_0x546427[_0x4ab8('0x2d')],'type':_0x546427[_0x4ab8('0x2e')][_0x4ab8('0x2f')]};});_0x337fd1['model']=_[_0x4ab8('0x2a')](_0x2c9e7d,_0x4ab8('0x27'));_0x337fd1[_0x4ab8('0x30')]=_['keys'](_0x2ba53a[_0x4ab8('0x30')]);_0x337fd1[_0x4ab8('0x31')]=_[_0x4ab8('0x32')](_0x337fd1[_0x4ab8('0x33')],_0x337fd1[_0x4ab8('0x30')]);_0x126c3f[_0x4ab8('0x34')]=_[_0x4ab8('0x32')](_0x337fd1[_0x4ab8('0x33')],qs[_0x4ab8('0x35')](_0x2ba53a['query'][_0x4ab8('0x35')]));_0x126c3f[_0x4ab8('0x34')]=_0x126c3f[_0x4ab8('0x34')][_0x4ab8('0x36')]?_0x126c3f[_0x4ab8('0x34')]:_0x337fd1[_0x4ab8('0x33')];if(!_0x2ba53a[_0x4ab8('0x30')][_0x4ab8('0x37')](_0x4ab8('0x38'))){_0x126c3f[_0x4ab8('0x1d')]=qs[_0x4ab8('0x1d')](_0x2ba53a['query']['limit']);_0x126c3f['offset']=qs['offset'](_0x2ba53a['query'][_0x4ab8('0x1c')]);}_0x126c3f[_0x4ab8('0x39')]=qs['sort'](_0x2ba53a[_0x4ab8('0x30')][_0x4ab8('0x3a')]);_0x126c3f[_0x4ab8('0x3b')]=qs[_0x4ab8('0x31')](_[_0x4ab8('0x3c')](_0x2ba53a[_0x4ab8('0x30')],_0x337fd1[_0x4ab8('0x31')]),_0x2c9e7d);if(_0x2ba53a['query'][_0x4ab8('0x3d')]){_0x126c3f[_0x4ab8('0x3b')]=_[_0x4ab8('0x3e')](_0x126c3f['where'],{'$or':_[_0x4ab8('0x2a')](_0x2c9e7d,function(_0x35c373){if(_0x35c373[_0x4ab8('0x2e')]!=='VIRTUAL'){var _0x5beec5={};_0x5beec5[_0x35c373['name']]={'$like':'%'+_0x2ba53a[_0x4ab8('0x30')][_0x4ab8('0x3d')]+'%'};return _0x5beec5;}})});}_0x126c3f=_[_0x4ab8('0x3e')]({},_0x126c3f,_0x2ba53a[_0x4ab8('0x3f')]);var _0x3bef4c={'where':_0x126c3f[_0x4ab8('0x3b')]};return db[_0x4ab8('0x2b')]['count'](_0x3bef4c)[_0x4ab8('0x22')](function(_0xd87d7f){_0x6fd6de['count']=_0xd87d7f;if(_0x2ba53a['query'][_0x4ab8('0x40')]){_0x126c3f['include']=[{'all':!![]}];}return db[_0x4ab8('0x2b')][_0x4ab8('0x41')](_0x126c3f);})['then'](function(_0x14f0c6){_0x6fd6de[_0x4ab8('0x42')]=_0x14f0c6;return _0x6fd6de;})[_0x4ab8('0x22')](respondWithFilteredResult(_0xa725bf,_0x126c3f))[_0x4ab8('0x43')](handleError(_0xa725bf,null));};exports[_0x4ab8('0x44')]=function(_0xeea8d2,_0xcf232c){var _0x3be7a3={'raw':!![],'where':{'id':_0xeea8d2['params']['id']}},_0x3baf09={};_0x3baf09[_0x4ab8('0x33')]=_['keys'](db[_0x4ab8('0x2b')][_0x4ab8('0x2c')]);_0x3baf09[_0x4ab8('0x30')]=_[_0x4ab8('0x45')](_0xeea8d2[_0x4ab8('0x30')]);_0x3baf09[_0x4ab8('0x31')]=_[_0x4ab8('0x32')](_0x3baf09[_0x4ab8('0x33')],_0x3baf09['query']);_0x3be7a3['attributes']=_[_0x4ab8('0x32')](_0x3baf09[_0x4ab8('0x33')],qs[_0x4ab8('0x35')](_0xeea8d2[_0x4ab8('0x30')][_0x4ab8('0x35')]));_0x3be7a3['attributes']=_0x3be7a3[_0x4ab8('0x34')][_0x4ab8('0x36')]?_0x3be7a3[_0x4ab8('0x34')]:_0x3baf09[_0x4ab8('0x33')];if(_0xeea8d2[_0x4ab8('0x30')][_0x4ab8('0x40')]){_0x3be7a3[_0x4ab8('0x46')]=[{'all':!![]}];}_0x3be7a3=_[_0x4ab8('0x3e')]({},_0x3be7a3,_0xeea8d2['options']);return db[_0x4ab8('0x2b')]['find'](_0x3be7a3)[_0x4ab8('0x22')](handleEntityNotFound(_0xcf232c,null))[_0x4ab8('0x22')](respondWithResult(_0xcf232c,null))[_0x4ab8('0x43')](handleError(_0xcf232c,null));};exports[_0x4ab8('0x47')]=function(_0x4ea891,_0x193f4b){return db[_0x4ab8('0x2b')][_0x4ab8('0x47')](_0x4ea891[_0x4ab8('0x48')],{})['then'](respondWithResult(_0x193f4b,0xc9))['catch'](handleError(_0x193f4b,null));};exports[_0x4ab8('0x21')]=function(_0x2504f7,_0x434e91){if(_0x2504f7[_0x4ab8('0x48')]['id']){delete _0x2504f7['body']['id'];}return db[_0x4ab8('0x2b')][_0x4ab8('0x49')]({'where':{'id':_0x2504f7[_0x4ab8('0x4a')]['id']}})[_0x4ab8('0x22')](handleEntityNotFound(_0x434e91,null))[_0x4ab8('0x22')](saveUpdates(_0x2504f7['body'],null))[_0x4ab8('0x22')](respondWithResult(_0x434e91,null))[_0x4ab8('0x43')](handleError(_0x434e91,null));};exports['destroy']=function(_0x617f7f,_0x3f8ffc){return db['ZendeskField'][_0x4ab8('0x49')]({'where':{'id':_0x617f7f['params']['id']}})['then'](handleEntityNotFound(_0x3f8ffc,null))[_0x4ab8('0x22')](removeEntity(_0x3f8ffc,null))[_0x4ab8('0x43')](handleError(_0x3f8ffc,null));}; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.model.js b/server/api/intZendeskField/intZendeskField.model.js index 83373cc..a469bbe 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 _0x263f=['path','rimraf','../../config/environment','exports','ZendeskField','int_zendesk_fields','zendesk_unique_index','idField','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x3efaa5,_0x3f7cdf){var _0x3d8c29=function(_0xc9e0e3){while(--_0xc9e0e3){_0x3efaa5['push'](_0x3efaa5['shift']());}};_0x3d8c29(++_0x3f7cdf);}(_0x263f,0x182));var _0xf263=function(_0x36c560,_0x4595f7){_0x36c560=_0x36c560-0x0;var _0x534f4f=_0x263f[_0x36c560];return _0x534f4f;};'use strict';var _=require(_0xf263('0x0'));var util=require(_0xf263('0x1'));var logger=require(_0xf263('0x2'))(_0xf263('0x3'));var moment=require(_0xf263('0x4'));var BPromise=require(_0xf263('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xf263('0x6'));var rimraf=require(_0xf263('0x7'));var config=require(_0xf263('0x8'));var attributes=require('./intZendeskField.attributes');module[_0xf263('0x9')]=function(_0xdb2fc1,_0x4c7ab2){return _0xdb2fc1['define'](_0xf263('0xa'),attributes,{'tableName':_0xf263('0xb'),'paranoid':![],'indexes':[{'name':_0xf263('0xc'),'fields':[_0xf263('0xd'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xb574=['api','moment','request-promise','path','rimraf','../../config/environment','./intZendeskField.attributes','idField','FieldId','lodash','util'];(function(_0x4f1a5b,_0x53c5f7){var _0x2a0e3a=function(_0x1fdffc){while(--_0x1fdffc){_0x4f1a5b['push'](_0x4f1a5b['shift']());}};_0x2a0e3a(++_0x53c5f7);}(_0xb574,0x106));var _0x4b57=function(_0x7d8b42,_0x48c0d5){_0x7d8b42=_0x7d8b42-0x0;var _0x1e5464=_0xb574[_0x7d8b42];return _0x1e5464;};'use strict';var _=require(_0x4b57('0x0'));var util=require(_0x4b57('0x1'));var logger=require('../../config/logger')(_0x4b57('0x2'));var moment=require(_0x4b57('0x3'));var BPromise=require('bluebird');var rp=require(_0x4b57('0x4'));var fs=require('fs');var path=require(_0x4b57('0x5'));var rimraf=require(_0x4b57('0x6'));var config=require(_0x4b57('0x7'));var attributes=require(_0x4b57('0x8'));module['exports']=function(_0x4eb019,_0x1c97e5){return _0x4eb019['define']('ZendeskField',attributes,{'tableName':'int_zendesk_fields','paranoid':![],'indexes':[{'name':'zendesk_unique_index','fields':[_0x4b57('0x9'),_0x4b57('0xa')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.rpc.js b/server/api/intZendeskField/intZendeskField.rpc.js index 74f93ce..5f999f8 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 _0x6442=['catch','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','info','ZendeskField,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result'];(function(_0x2fc9bd,_0x2d5cf2){var _0x565c7d=function(_0xaa1074){while(--_0xaa1074){_0x2fc9bd['push'](_0x2fc9bd['shift']());}};_0x565c7d(++_0x2d5cf2);}(_0x6442,0x1f1));var _0x2644=function(_0x3510c2,_0x396bf6){_0x3510c2=_0x3510c2-0x0;var _0x191fb0=_0x6442[_0x3510c2];return _0x191fb0;};'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(_0x2644('0x0'));var db=require('../../mysqldb')['db'];var utils=require(_0x2644('0x1'));var logger=require(_0x2644('0x2'))('rpc');var config=require(_0x2644('0x3'));var jayson=require(_0x2644('0x4'));var client=jayson[_0x2644('0x5')][_0x2644('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x303db9,_0x4a4677,_0x1b4c62){return new BPromise(function(_0x353d76,_0x578c08){return client['request'](_0x303db9,_0x1b4c62)['then'](function(_0x4b732f){logger[_0x2644('0x7')](_0x2644('0x8'),_0x4a4677,_0x2644('0x9'));logger['debug']('ZendeskField,\x20%s,\x20%s,\x20%s',_0x4a4677,'request\x20sent',JSON[_0x2644('0xa')](_0x4b732f));if(_0x4b732f[_0x2644('0xb')]){if(_0x4b732f[_0x2644('0xb')][_0x2644('0xc')]===0x1f4){logger[_0x2644('0xb')](_0x2644('0x8'),_0x4a4677,_0x4b732f[_0x2644('0xb')][_0x2644('0xd')]);return _0x578c08(_0x4b732f['error']['message']);}logger[_0x2644('0xb')](_0x2644('0x8'),_0x4a4677,_0x4b732f[_0x2644('0xb')][_0x2644('0xd')]);return _0x353d76(_0x4b732f['error'][_0x2644('0xd')]);}else{logger[_0x2644('0x7')](_0x2644('0x8'),_0x4a4677,_0x2644('0x9'));_0x353d76(_0x4b732f[_0x2644('0xe')][_0x2644('0xd')]);}})[_0x2644('0xf')](function(_0x2564b6){logger['error'](_0x2644('0x8'),_0x4a4677,_0x2564b6);_0x578c08(_0x2564b6);});});} \ No newline at end of file +var _0x2c2e=['rpc','jayson/promise','http','request','then','ZendeskField,\x20%s,\x20%s','debug','ZendeskField,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','info','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x36ec2b,_0x4ffe29){var _0x32bfb9=function(_0x4db3a1){while(--_0x4db3a1){_0x36ec2b['push'](_0x36ec2b['shift']());}};_0x32bfb9(++_0x4ffe29);}(_0x2c2e,0x1b0));var _0xe2c2=function(_0x1d8e6d,_0x5a4761){_0x1d8e6d=_0x1d8e6d-0x0;var _0x3a7e3b=_0x2c2e[_0x1d8e6d];return _0x3a7e3b;};'use strict';var _=require(_0xe2c2('0x0'));var util=require('util');var moment=require(_0xe2c2('0x1'));var BPromise=require(_0xe2c2('0x2'));var rs=require(_0xe2c2('0x3'));var fs=require('fs');var Redis=require(_0xe2c2('0x4'));var db=require(_0xe2c2('0x5'))['db'];var utils=require(_0xe2c2('0x6'));var logger=require(_0xe2c2('0x7'))(_0xe2c2('0x8'));var config=require('../../config/environment');var jayson=require(_0xe2c2('0x9'));var client=jayson['client'][_0xe2c2('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3a921b,_0x14bd31,_0x497dc7){return new BPromise(function(_0xc1fe45,_0x39fc64){return client[_0xe2c2('0xb')](_0x3a921b,_0x497dc7)[_0xe2c2('0xc')](function(_0x2cbffa){logger['info'](_0xe2c2('0xd'),_0x14bd31,'request\x20sent');logger[_0xe2c2('0xe')](_0xe2c2('0xf'),_0x14bd31,_0xe2c2('0x10'),JSON['stringify'](_0x2cbffa));if(_0x2cbffa['error']){if(_0x2cbffa[_0xe2c2('0x11')][_0xe2c2('0x12')]===0x1f4){logger[_0xe2c2('0x11')](_0xe2c2('0xd'),_0x14bd31,_0x2cbffa[_0xe2c2('0x11')]['message']);return _0x39fc64(_0x2cbffa['error']['message']);}logger[_0xe2c2('0x11')](_0xe2c2('0xd'),_0x14bd31,_0x2cbffa[_0xe2c2('0x11')][_0xe2c2('0x13')]);return _0xc1fe45(_0x2cbffa['error']['message']);}else{logger[_0xe2c2('0x14')](_0xe2c2('0xd'),_0x14bd31,_0xe2c2('0x10'));_0xc1fe45(_0x2cbffa['result'][_0xe2c2('0x13')]);}})[_0xe2c2('0x15')](function(_0x303f31){logger[_0xe2c2('0x11')](_0xe2c2('0xd'),_0x14bd31,_0x303f31);_0x39fc64(_0x303f31);});});} \ No newline at end of file diff --git a/server/api/intZohoAccount/index.js b/server/api/intZohoAccount/index.js index 42429d6..5c38495 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 _0x3297=['create','addConfiguration','update','delete','destroy','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','/:id','isAuthenticated','show','get','/:id/configurations','getConfigurations','/:id/fields','getFields','post'];(function(_0x779496,_0x9b0b0b){var _0x472493=function(_0x18db79){while(--_0x18db79){_0x779496['push'](_0x779496['shift']());}};_0x472493(++_0x9b0b0b);}(_0x3297,0x1a7));var _0x7329=function(_0xbb091,_0x3fe7ee){_0xbb091=_0xbb091-0x0;var _0x467a04=_0x3297[_0xbb091];return _0x467a04;};'use strict';var multer=require(_0x7329('0x0'));var util=require(_0x7329('0x1'));var path=require('path');var timeout=require(_0x7329('0x2'));var express=require(_0x7329('0x3'));var router=express[_0x7329('0x4')]();var auth=require(_0x7329('0x5'));var interaction=require(_0x7329('0x6'));var config=require(_0x7329('0x7'));var controller=require('./intZohoAccount.controller');router['get']('/',auth['isAuthenticated'](),controller['index']);router['get'](_0x7329('0x8'),auth[_0x7329('0x9')](),controller[_0x7329('0xa')]);router[_0x7329('0xb')](_0x7329('0xc'),auth['isAuthenticated'](),controller[_0x7329('0xd')]);router[_0x7329('0xb')](_0x7329('0xe'),auth['isAuthenticated'](),controller[_0x7329('0xf')]);router[_0x7329('0x10')]('/',auth[_0x7329('0x9')](),controller[_0x7329('0x11')]);router[_0x7329('0x10')](_0x7329('0xc'),auth[_0x7329('0x9')](),controller[_0x7329('0x12')]);router['put']('/:id',auth[_0x7329('0x9')](),controller[_0x7329('0x13')]);router[_0x7329('0x14')]('/:id',auth['isAuthenticated'](),controller[_0x7329('0x15')]);module['exports']=router; \ No newline at end of file +var _0x478d=['path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','/:id','show','/:id/configurations','getFields','post','addConfiguration','put','delete','destroy','exports','multer'];(function(_0x1df698,_0x4e8a9a){var _0x471850=function(_0x176001){while(--_0x176001){_0x1df698['push'](_0x1df698['shift']());}};_0x471850(++_0x4e8a9a);}(_0x478d,0x155));var _0xd478=function(_0x258196,_0x235f4e){_0x258196=_0x258196-0x0;var _0x3df790=_0x478d[_0x258196];return _0x3df790;};'use strict';var multer=require(_0xd478('0x0'));var util=require('util');var path=require(_0xd478('0x1'));var timeout=require(_0xd478('0x2'));var express=require(_0xd478('0x3'));var router=express['Router']();var auth=require(_0xd478('0x4'));var interaction=require(_0xd478('0x5'));var config=require('../../config/environment');var controller=require('./intZohoAccount.controller');router[_0xd478('0x6')]('/',auth[_0xd478('0x7')](),controller[_0xd478('0x8')]);router[_0xd478('0x6')](_0xd478('0x9'),auth['isAuthenticated'](),controller[_0xd478('0xa')]);router['get'](_0xd478('0xb'),auth[_0xd478('0x7')](),controller['getConfigurations']);router[_0xd478('0x6')]('/:id/fields',auth[_0xd478('0x7')](),controller[_0xd478('0xc')]);router['post']('/',auth[_0xd478('0x7')](),controller['create']);router[_0xd478('0xd')](_0xd478('0xb'),auth[_0xd478('0x7')](),controller[_0xd478('0xe')]);router[_0xd478('0xf')](_0xd478('0x9'),auth[_0xd478('0x7')](),controller['update']);router[_0xd478('0x10')]('/:id',auth[_0xd478('0x7')](),controller[_0xd478('0x11')]);module[_0xd478('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 bb3d4e7..539ce7b 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 _0x67b6=['STRING'];(function(_0x21a54a,_0x2ef697){var _0x24fc96=function(_0x581166){while(--_0x581166){_0x21a54a['push'](_0x21a54a['shift']());}};_0x24fc96(++_0x2ef697);}(_0x67b6,0x141));var _0x667b=function(_0x554d0d,_0x23c674){_0x554d0d=_0x554d0d-0x0;var _0x9115fb=_0x67b6[_0x554d0d];return _0x9115fb;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x667b('0x0')]},'description':{'type':Sequelize[_0x667b('0x0')]},'host':{'type':Sequelize[_0x667b('0x0')]},'zone':{'type':Sequelize[_0x667b('0x0')]},'clientId':{'type':Sequelize[_0x667b('0x0')]},'clientSecret':{'type':Sequelize['STRING']},'serverUrl':{'type':Sequelize['STRING']},'code':{'type':Sequelize['STRING']},'refreshToken':{'type':Sequelize[_0x667b('0x0')]}}; \ No newline at end of file +var _0x02c6=['exports','STRING','sequelize'];(function(_0x4b001e,_0x261680){var _0x1e22de=function(_0x3b2bd5){while(--_0x3b2bd5){_0x4b001e['push'](_0x4b001e['shift']());}};_0x1e22de(++_0x261680);}(_0x02c6,0x7a));var _0x602c=function(_0x3890f8,_0x1b39df){_0x3890f8=_0x3890f8-0x0;var _0x40713e=_0x02c6[_0x3890f8];return _0x40713e;};'use strict';var Sequelize=require(_0x602c('0x0'));module[_0x602c('0x1')]={'name':{'type':Sequelize[_0x602c('0x2')]},'description':{'type':Sequelize['STRING']},'host':{'type':Sequelize[_0x602c('0x2')]},'zone':{'type':Sequelize[_0x602c('0x2')]},'clientId':{'type':Sequelize[_0x602c('0x2')]},'clientSecret':{'type':Sequelize['STRING']},'serverUrl':{'type':Sequelize[_0x602c('0x2')]},'code':{'type':Sequelize[_0x602c('0x2')]},'refreshToken':{'type':Sequelize[_0x602c('0x2')]}}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.controller.js b/server/api/intZohoAccount/intZohoAccount.controller.js index f58a54a..5877105 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 _0x91e0=['show','params','find','create','body','ZohoConfiguration','pick','getConfigurations','addConfiguration','findOne','AccountId','Subjects','getSubjects','channel','getDescriptions','Descriptions','https://accounts.zoho.com','https://accounts.zoho.eu','https://accounts.zoho.in','POST','/oauth/v2/token','clientId','clientSecret','refresh_token','access_token','getFields','host','zone','serverUrl','refreshToken','zoho.eu','com','substring','lastIndexOf','GET','format','Zoho-oauthtoken\x20','response','Owner','Subject','Description','WhoId','Call_Result','Call_Start_Time','Call_Type','remove','includes','system_mandatory','push','display_label','data_type','picklist','pick_list_values','statusCode','Wrong\x20credentials','html-pdf','zip-dir','request-promise','moment','mustache','util','path','sox','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../mysqldb','../../components/integrations/configuration','jayson/promise','client','test','Sequelize','request','info','ZohoAccount,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','result','catch','sendStatus','end','status','json','count','offset','Content-Range','apply','reject','save','update','destroy','stack','name','send','index','map','ZohoAccount','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','then'];(function(_0x31c217,_0xc88f1b){var _0x42cc6d=function(_0x5a073b){while(--_0x5a073b){_0x31c217['push'](_0x31c217['shift']());}};_0x42cc6d(++_0xc88f1b);}(_0x91e0,0x1d2));var _0x091e=function(_0x3c2daa,_0x34e50c){_0x3c2daa=_0x3c2daa-0x0;var _0x2fbe50=_0x91e0[_0x3c2daa];return _0x2fbe50;};'use strict';var pdf=require(_0x091e('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x091e('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x091e('0x2'));var moment=require(_0x091e('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x091e('0x4'));var util=require(_0x091e('0x5'));var path=require(_0x091e('0x6'));var sox=require(_0x091e('0x7'));var csv=require('to-csv');var ejs=require(_0x091e('0x8'));var fs=require('fs');var _=require(_0x091e('0x9'));var squel=require(_0x091e('0xa'));var crypto=require(_0x091e('0xb'));var jsforce=require(_0x091e('0xc'));var deskjs=require(_0x091e('0xd'));var toCsv=require(_0x091e('0xe'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x091e('0xf'));var authService=require(_0x091e('0x10'));var qs=require(_0x091e('0x11'));var as=require(_0x091e('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x091e('0x13'));var utils=require(_0x091e('0x14'));var config=require('../../config/environment');var db=require(_0x091e('0x15'))['db'];var integrations=require(_0x091e('0x16'));var jayson=require(_0x091e('0x17'));var client=jayson[_0x091e('0x18')]['http']({'port':0x232a});function checkPasswordPattern(_0x16eadf,_0xa8024d,_0x209503){if(_0x209503){var _0x20a051=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x20a051[_0x091e('0x19')](_0xa8024d)){return _0x16eadf;}else{throw new db[(_0x091e('0x1a'))]['ValidationError']('The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.');}}else{return _0x16eadf;}}function respondWithRpcPromise(_0x4016e0,_0x1570ef,_0x1953db,_0x4b0e3d){return new BPromise(function(_0x12909c,_0x1c5655){var _0x458b51=_0x4b0e3d||client;return _0x458b51[_0x091e('0x1b')](_0x4016e0,_0x1953db)['then'](function(_0x5f0e19){logger[_0x091e('0x1c')](_0x091e('0x1d'),_0x1570ef,'request\x20sent');logger[_0x091e('0x1e')]('ZohoAccount,\x20%s,\x20%s,\x20%s',_0x1570ef,_0x091e('0x1f'),JSON[_0x091e('0x20')](_0x5f0e19));if(_0x5f0e19[_0x091e('0x21')]){if(_0x5f0e19[_0x091e('0x21')][_0x091e('0x22')]===0x1f4){logger[_0x091e('0x21')](_0x091e('0x1d'),_0x1570ef,_0x5f0e19[_0x091e('0x21')]['message']);return _0x1c5655(_0x5f0e19[_0x091e('0x21')]['message']);}logger['error']('ZohoAccount,\x20%s,\x20%s',_0x1570ef,_0x5f0e19[_0x091e('0x21')][_0x091e('0x23')]);return _0x12909c(_0x5f0e19['error'][_0x091e('0x23')]);}else{logger[_0x091e('0x1c')](_0x091e('0x1d'),_0x1570ef,'request\x20sent');_0x12909c(_0x5f0e19[_0x091e('0x24')]['message']);}})[_0x091e('0x25')](function(_0x261b04){logger[_0x091e('0x21')](_0x091e('0x1d'),_0x1570ef,_0x261b04);_0x1c5655(_0x261b04);});});}function respondWithStatusCode(_0x3673b5,_0x9d92e9){_0x9d92e9=_0x9d92e9||0xcc;return function(_0x28bcad){if(_0x28bcad){return _0x3673b5[_0x091e('0x26')](_0x9d92e9);}return _0x3673b5['status'](_0x9d92e9)[_0x091e('0x27')]();};}function respondWithResult(_0xaf8601,_0x49abdc){_0x49abdc=_0x49abdc||0xc8;return function(_0x2b898b){if(_0x2b898b){return _0xaf8601[_0x091e('0x28')](_0x49abdc)[_0x091e('0x29')](_0x2b898b);}};}function respondWithFilteredResult(_0x5ec295,_0x2abbfe){return function(_0x33a7fd){if(_0x33a7fd){var _0xeb9f2c=_0x33a7fd[_0x091e('0x2a')],_0x2eb52f=_0x2abbfe[_0x091e('0x2b')],_0x5cce30=_0x2abbfe[_0x091e('0x2b')]+_0x2abbfe['limit'],_0x430ff1;if(_0x5cce30>=_0xeb9f2c){_0x5cce30=_0xeb9f2c;_0x430ff1=0xc8;}else{_0x430ff1=0xce;}_0x5ec295[_0x091e('0x28')](_0x430ff1);return _0x5ec295['set'](_0x091e('0x2c'),_0x2eb52f+'-'+_0x5cce30+'/'+_0xeb9f2c)[_0x091e('0x29')](_0x33a7fd);}return null;};}function patchUpdates(_0xb6686a){return function(_0x4f9a22){try{jsonpatch[_0x091e('0x2d')](_0x4f9a22,_0xb6686a,!![]);}catch(_0x1b70d6){return BPromise[_0x091e('0x2e')](_0x1b70d6);}return _0x4f9a22[_0x091e('0x2f')]();};}function saveUpdates(_0x4a7779,_0x169958){return function(_0xea282d){if(_0xea282d){return _0xea282d[_0x091e('0x30')](_0x4a7779)['then'](function(_0x3c0ced){return _0x3c0ced;});}return null;};}function removeEntity(_0x5e5913,_0x4a5c70){return function(_0xae7422){if(_0xae7422){return _0xae7422[_0x091e('0x31')]()['then'](function(){_0x5e5913[_0x091e('0x28')](0xcc)[_0x091e('0x27')]();});}};}function handleEntityNotFound(_0x268fc0,_0x3b7363){return function(_0x19d4ba){if(!_0x19d4ba){_0x268fc0[_0x091e('0x26')](0x194);}return _0x19d4ba;};}function handleError(_0x10a2a7,_0x471984){_0x471984=_0x471984||0x1f4;return function(_0x331641){logger[_0x091e('0x21')](_0x331641[_0x091e('0x32')]);if(_0x331641['name']){delete _0x331641[_0x091e('0x33')];}_0x10a2a7[_0x091e('0x28')](_0x471984)[_0x091e('0x34')](_0x331641);};}exports[_0x091e('0x35')]=function(_0x522cb3,_0x37e74e){var _0x4774fb={},_0x2dcbdb={},_0xe63b49={'count':0x0,'rows':[]};var _0x1a0589=_[_0x091e('0x36')](db[_0x091e('0x37')][_0x091e('0x38')],function(_0x4c9331){return{'name':_0x4c9331[_0x091e('0x39')],'type':_0x4c9331[_0x091e('0x3a')]['key']};});_0x2dcbdb[_0x091e('0x3b')]=_['map'](_0x1a0589,_0x091e('0x33'));_0x2dcbdb[_0x091e('0x3c')]=_[_0x091e('0x3d')](_0x522cb3['query']);_0x2dcbdb[_0x091e('0x3e')]=_[_0x091e('0x3f')](_0x2dcbdb[_0x091e('0x3b')],_0x2dcbdb[_0x091e('0x3c')]);_0x4774fb[_0x091e('0x40')]=_[_0x091e('0x3f')](_0x2dcbdb[_0x091e('0x3b')],qs[_0x091e('0x41')](_0x522cb3[_0x091e('0x3c')]['fields']));_0x4774fb['attributes']=_0x4774fb[_0x091e('0x40')][_0x091e('0x42')]?_0x4774fb['attributes']:_0x2dcbdb[_0x091e('0x3b')];if(!_0x522cb3[_0x091e('0x3c')][_0x091e('0x43')](_0x091e('0x44'))){_0x4774fb[_0x091e('0x45')]=qs[_0x091e('0x45')](_0x522cb3['query'][_0x091e('0x45')]);_0x4774fb[_0x091e('0x2b')]=qs[_0x091e('0x2b')](_0x522cb3[_0x091e('0x3c')]['offset']);}_0x4774fb[_0x091e('0x46')]=qs[_0x091e('0x47')](_0x522cb3[_0x091e('0x3c')][_0x091e('0x47')]);_0x4774fb[_0x091e('0x48')]=qs[_0x091e('0x3e')](_['pick'](_0x522cb3['query'],_0x2dcbdb['filters']),_0x1a0589);if(_0x522cb3[_0x091e('0x3c')][_0x091e('0x49')]){_0x4774fb[_0x091e('0x48')]=_[_0x091e('0x4a')](_0x4774fb['where'],{'$or':_['map'](_0x1a0589,function(_0x12a4eb){if(_0x12a4eb[_0x091e('0x3a')]!==_0x091e('0x4b')){var _0xf77b03={};_0xf77b03[_0x12a4eb[_0x091e('0x33')]]={'$like':'%'+_0x522cb3[_0x091e('0x3c')][_0x091e('0x49')]+'%'};return _0xf77b03;}})});}_0x4774fb=_['merge']({},_0x4774fb,_0x522cb3[_0x091e('0x4c')]);var _0x1f1a1a={'where':_0x4774fb[_0x091e('0x48')]};return db[_0x091e('0x37')][_0x091e('0x2a')](_0x1f1a1a)['then'](function(_0xafda49){_0xe63b49[_0x091e('0x2a')]=_0xafda49;if(_0x522cb3[_0x091e('0x3c')][_0x091e('0x4d')]){_0x4774fb[_0x091e('0x4e')]=[{'all':!![]}];}return db['ZohoAccount'][_0x091e('0x4f')](_0x4774fb);})['then'](function(_0x2d0db1){_0xe63b49[_0x091e('0x50')]=_0x2d0db1;return _0xe63b49;})[_0x091e('0x51')](respondWithFilteredResult(_0x37e74e,_0x4774fb))[_0x091e('0x25')](handleError(_0x37e74e,null));};exports[_0x091e('0x52')]=function(_0x3b52d,_0x5565e8){var _0x266904={'raw':![],'where':{'id':_0x3b52d[_0x091e('0x53')]['id']}},_0x5917d3={};_0x5917d3[_0x091e('0x3b')]=_[_0x091e('0x3d')](db['ZohoAccount'][_0x091e('0x38')]);_0x5917d3['query']=_['keys'](_0x3b52d[_0x091e('0x3c')]);_0x5917d3['filters']=_[_0x091e('0x3f')](_0x5917d3[_0x091e('0x3b')],_0x5917d3[_0x091e('0x3c')]);_0x266904[_0x091e('0x40')]=_[_0x091e('0x3f')](_0x5917d3['model'],qs['fields'](_0x3b52d[_0x091e('0x3c')]['fields']));_0x266904[_0x091e('0x40')]=_0x266904[_0x091e('0x40')][_0x091e('0x42')]?_0x266904[_0x091e('0x40')]:_0x5917d3[_0x091e('0x3b')];if(_0x3b52d[_0x091e('0x3c')]['includeAll']){_0x266904['include']=[{'all':!![]}];}_0x266904=_['merge']({},_0x266904,_0x3b52d[_0x091e('0x4c')]);return db[_0x091e('0x37')][_0x091e('0x54')](_0x266904)[_0x091e('0x51')](handleEntityNotFound(_0x5565e8,null))[_0x091e('0x51')](respondWithResult(_0x5565e8,null))[_0x091e('0x25')](handleError(_0x5565e8,null));};exports[_0x091e('0x55')]=function(_0x5bfba0,_0x150f90){return db['ZohoAccount'][_0x091e('0x55')](_0x5bfba0[_0x091e('0x56')],{})[_0x091e('0x51')](respondWithResult(_0x150f90,0xc9))['catch'](handleError(_0x150f90,null));};exports[_0x091e('0x30')]=function(_0xb92fb9,_0x88536d){if(_0xb92fb9[_0x091e('0x56')]['id']){delete _0xb92fb9[_0x091e('0x56')]['id'];}return db[_0x091e('0x37')][_0x091e('0x54')]({'where':{'id':_0xb92fb9[_0x091e('0x53')]['id']}})[_0x091e('0x51')](handleEntityNotFound(_0x88536d,null))['then'](saveUpdates(_0xb92fb9[_0x091e('0x56')],null))[_0x091e('0x51')](respondWithResult(_0x88536d,null))['catch'](handleError(_0x88536d,null));};exports[_0x091e('0x31')]=function(_0x45df9,_0x345a0d){return db['ZohoAccount']['find']({'where':{'id':_0x45df9[_0x091e('0x53')]['id']}})['then'](handleEntityNotFound(_0x345a0d,null))['then'](removeEntity(_0x345a0d,null))['catch'](handleError(_0x345a0d,null));};exports['getConfigurations']=function(_0x5719a2,_0x111fb5,_0x3c0155){var _0x2a47a9={};var _0x41cbbf={};var _0x59f2c5;var _0x14a9e7;return db[_0x091e('0x37')]['findOne']({'where':{'id':_0x5719a2[_0x091e('0x53')]['id']}})[_0x091e('0x51')](handleEntityNotFound(_0x111fb5,null))[_0x091e('0x51')](function(_0xd8f55b){if(_0xd8f55b){_0x59f2c5=_0xd8f55b;_0x41cbbf['model']=_[_0x091e('0x3d')](db[_0x091e('0x57')]['rawAttributes']);_0x41cbbf[_0x091e('0x3c')]=_[_0x091e('0x3d')](_0x5719a2[_0x091e('0x3c')]);_0x41cbbf[_0x091e('0x3e')]=_['intersection'](_0x41cbbf['model'],_0x41cbbf[_0x091e('0x3c')]);_0x2a47a9[_0x091e('0x40')]=_[_0x091e('0x3f')](_0x41cbbf[_0x091e('0x3b')],qs[_0x091e('0x41')](_0x5719a2[_0x091e('0x3c')][_0x091e('0x41')]));_0x2a47a9['attributes']=_0x2a47a9[_0x091e('0x40')][_0x091e('0x42')]?_0x2a47a9[_0x091e('0x40')]:_0x41cbbf[_0x091e('0x3b')];_0x2a47a9[_0x091e('0x46')]=qs['sort'](_0x5719a2[_0x091e('0x3c')][_0x091e('0x47')]);_0x2a47a9['where']=qs[_0x091e('0x3e')](_[_0x091e('0x58')](_0x5719a2[_0x091e('0x3c')],_0x41cbbf['filters']));if(_0x5719a2[_0x091e('0x3c')][_0x091e('0x49')]){_0x2a47a9[_0x091e('0x48')]=_[_0x091e('0x4a')](_0x2a47a9[_0x091e('0x48')],{'$or':_[_0x091e('0x36')](_0x2a47a9['attributes'],function(_0x26ea93){var _0x263eb1={};_0x263eb1[_0x26ea93]={'$like':'%'+_0x5719a2['query']['filter']+'%'};return _0x263eb1;})});}_0x2a47a9=_[_0x091e('0x4a')]({},_0x2a47a9,_0x5719a2[_0x091e('0x4c')]);return _0x59f2c5[_0x091e('0x59')](_0x2a47a9);}})['then'](function(_0x1d90c4){if(_0x1d90c4){_0x14a9e7=_0x1d90c4['length'];if(!_0x5719a2[_0x091e('0x3c')]['hasOwnProperty'](_0x091e('0x44'))){_0x2a47a9['limit']=qs['limit'](_0x5719a2[_0x091e('0x3c')]['limit']);_0x2a47a9[_0x091e('0x2b')]=qs[_0x091e('0x2b')](_0x5719a2[_0x091e('0x3c')][_0x091e('0x2b')]);}return _0x59f2c5[_0x091e('0x59')](_0x2a47a9);}})['then'](function(_0x1a8c98){if(_0x1a8c98){return _0x1a8c98?{'count':_0x14a9e7,'rows':_0x1a8c98}:null;}})[_0x091e('0x51')](respondWithResult(_0x111fb5,null))[_0x091e('0x25')](handleError(_0x111fb5,null));};exports[_0x091e('0x5a')]=function(_0x15d1f0,_0x47f07c,_0x430830){if(_0x15d1f0[_0x091e('0x56')]['id']){delete _0x15d1f0['body']['id'];}return db[_0x091e('0x37')][_0x091e('0x5b')]({'where':{'id':_0x15d1f0[_0x091e('0x53')]['id']}})[_0x091e('0x51')](handleEntityNotFound(_0x47f07c,null))[_0x091e('0x51')](function(_0x4246d5){if(_0x4246d5){_0x15d1f0['body'][_0x091e('0x5c')]=_0x4246d5['id'];_0x15d1f0[_0x091e('0x56')][_0x091e('0x5d')]=integrations[_0x091e('0x5e')](_0x15d1f0[_0x091e('0x56')][_0x091e('0x5f')],_0x15d1f0['body']['type']);_0x15d1f0[_0x091e('0x56')]['Descriptions']=integrations[_0x091e('0x60')](_0x15d1f0['body']['channel'],_0x15d1f0[_0x091e('0x56')][_0x091e('0x3a')]);return db['ZohoConfiguration'][_0x091e('0x55')](_0x15d1f0[_0x091e('0x56')],{'include':[{'model':db['ZohoField'],'as':_0x091e('0x5d')},{'model':db['ZohoField'],'as':_0x091e('0x61')}]});}return null;})['then'](respondWithResult(_0x47f07c,null))[_0x091e('0x25')](handleError(_0x47f07c,null));};function getAccessToken(_0x288419){return new Promise(function(_0x10b9c9,_0x39c815){var _0x39785a;switch(_0x288419['zone']){case'US':_0x39785a=_0x091e('0x62');break;case'AU':_0x39785a='https://accounts.zoho.com.au';break;case'EU':_0x39785a=_0x091e('0x63');break;case'IN':_0x39785a=_0x091e('0x64');break;case'CN':_0x39785a='https://accounts.zoho.com.cn';break;default:_0x39785a=_0x091e('0x63');break;}var _0x449a64={'method':_0x091e('0x65'),'uri':_0x39785a+_0x091e('0x66'),'qs':{'refresh_token':_0x288419['refreshToken'],'client_id':_0x288419[_0x091e('0x67')],'client_secret':_0x288419[_0x091e('0x68')],'grant_type':_0x091e('0x69')},'json':!![]};return rp(_0x449a64)[_0x091e('0x51')](function(_0x46fd15){if(_0x46fd15[_0x091e('0x6a')]){_0x10b9c9(_0x46fd15[_0x091e('0x6a')]);}else{_0x39c815('Unable\x20to\x20retrieve\x20the\x20access\x20token');}})['catch'](function(_0x16b563){_0x39c815(_0x16b563);});});}exports[_0x091e('0x6b')]=function(_0x2c272c,_0x53ad5e,_0x125418){var _0x3ff7bc,_0xa38309,_0x54b8aa,_0xf1eb21,_0x4be4fc;return db[_0x091e('0x37')][_0x091e('0x5b')]({'where':{'id':_0x2c272c[_0x091e('0x53')]['id']},'attributes':['id',_0x091e('0x6c'),_0x091e('0x6d'),_0x091e('0x67'),_0x091e('0x68'),_0x091e('0x6e'),_0x091e('0x22'),_0x091e('0x6f')]})[_0x091e('0x51')](handleEntityNotFound(_0x53ad5e,null))[_0x091e('0x51')](function(_0x17aa8c){_0x4be4fc=_0x17aa8c;_0x3ff7bc=_0x4be4fc[_0x091e('0x6c')];_0xa38309=_0x3ff7bc===_0x091e('0x70')?'eu':_0x091e('0x71');_0x54b8aa=_0x4be4fc['serverUrl'];var _0x29bd42=_0x54b8aa['slice'](-0x1);if(_0x29bd42==='/'||_0x29bd42==='\x5c'||_0x29bd42===':'){_0x54b8aa=_0x54b8aa[_0x091e('0x72')](0x0,_0x54b8aa[_0x091e('0x73')](_0x29bd42));}if(!_0x4be4fc['refreshToken']){throw new Error('Refresh\x20Token\x20not\x20available\x20for\x20the\x20account');}return getAccessToken(_0x4be4fc);})[_0x091e('0x51')](function(_0x4acfd8){if(_0x4acfd8){return rp({'method':_0x091e('0x74'),'uri':util[_0x091e('0x75')]('https://www.zohoapis.%s/crm/v2/settings/fields',_0xa38309),'qs':{'module':'Calls'},'headers':{'Authorization':_0x091e('0x76')+_0x4acfd8},'json':!![]});}})[_0x091e('0x51')](function(_0x1f0223){if(_0x1f0223){if(_0x1f0223['response']&&_0x1f0223[_0x091e('0x77')][_0x091e('0x21')]){throw new Error(_0x1f0223['response'][_0x091e('0x21')][_0x091e('0x23')]);}var _0x46b9f1=[];var _0x2eea13=[];var _0x5e4e14=[_0x091e('0x78'),_0x091e('0x79'),_0x091e('0x7a'),_0x091e('0x7b'),'Call_Duration',_0x091e('0x7c'),_0x091e('0x7d'),_0x091e('0x7e')];_0x2eea13=_[_0x091e('0x7f')](_0x1f0223[_0x091e('0x41')],function(_0x58e2fb){return _0x5e4e14[_0x091e('0x80')](_0x58e2fb['api_name']);});for(var _0xab6688=0x0;_0xab6688<_0x2eea13[_0x091e('0x42')];_0xab6688++){if(_0x2eea13[_0xab6688][_0x091e('0x81')]===![]){_0x46b9f1[_0x091e('0x82')]({'id':_0x2eea13[_0xab6688]['id'],'name':_0x2eea13[_0xab6688][_0x091e('0x83')],'custom':_0x2eea13[_0xab6688]['custom_field'],'options':_0x2eea13[_0xab6688][_0x091e('0x84')]===_0x091e('0x85')&&_0x2eea13[_0xab6688][_0x091e('0x86')][_0x091e('0x42')]>-0x1?_[_0x091e('0x36')](_0x2eea13[_0xab6688]['pick_list_values'],function(_0x58312){return{'name':_0x58312,'value':_0x58312};}):[]});}}return{'count':_0x46b9f1['length'],'rows':_0x46b9f1};}else{return{'count':0x0,'rows':[]};}})[_0x091e('0x51')](respondWithResult(_0x53ad5e,null))[_0x091e('0x25')](function(_0x2ba992){var _0x4c061e=_0x2c272c[_0x091e('0x3c')][_0x091e('0x19')]?0x1f4:_0x2ba992[_0x091e('0x87')]||0x1f4;logger[_0x091e('0x21')]('getFields,\x20%s,\x20%s,\x20%s',_0x091e('0x6b'),_0x4c061e,JSON[_0x091e('0x20')](_0x2ba992));delete _0x2ba992[_0x091e('0x33')];if(_0x4c061e===0x191){_0x4c061e=0x190;}_0x53ad5e['status'](_0x4c061e)[_0x091e('0x34')](_0x2c272c[_0x091e('0x3c')][_0x091e('0x19')]?{'message':_0x091e('0x88'),'statusCode':_0x2ba992['statusCode']}:_0x2ba992);});}; \ No newline at end of file +var _0xa22a=['merge','VIRTUAL','options','includeAll','include','findAll','rows','show','params','rawAttributes','find','catch','create','body','getConfigurations','findOne','ZohoConfiguration','addConfiguration','getSubjects','Descriptions','getDescriptions','channel','ZohoField','Subjects','https://accounts.zoho.com','https://accounts.zoho.eu','https://accounts.zoho.com.cn','POST','/oauth/v2/token','clientId','access_token','Unable\x20to\x20retrieve\x20the\x20access\x20token','getFields','zone','clientSecret','serverUrl','refreshToken','host','zoho.eu','com','substring','lastIndexOf','GET','https://www.zohoapis.%s/crm/v2/settings/fields','response','Subject','Description','WhoId','Call_Duration','Call_Result','Call_Start_Time','remove','includes','api_name','system_mandatory','push','display_label','custom_field','data_type','picklist','Wrong\x20credentials','statusCode','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../mysqldb','../../components/integrations/configuration','client','test','Sequelize','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','info','ZohoAccount,\x20%s,\x20%s','request\x20sent','debug','ZohoAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','sendStatus','status','json','count','offset','set','apply','update','destroy','end','stack','name','index','map','ZohoAccount','type','key','keys','query','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','limit','order','sort','where','filters','pick','filter'];(function(_0x1ab54c,_0x302a5a){var _0x1f1ca4=function(_0x4e8faa){while(--_0x4e8faa){_0x1ab54c['push'](_0x1ab54c['shift']());}};_0x1f1ca4(++_0x302a5a);}(_0xa22a,0x1d3));var _0xaa22=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0xa22a[_0x501510];return _0x1e6ee5;};'use strict';var pdf=require(_0xaa22('0x0'));var emlformat=require(_0xaa22('0x1'));var rimraf=require(_0xaa22('0x2'));var zipdir=require(_0xaa22('0x3'));var jsonpatch=require(_0xaa22('0x4'));var rp=require(_0xaa22('0x5'));var moment=require('moment');var BPromise=require(_0xaa22('0x6'));var Mustache=require(_0xaa22('0x7'));var util=require('util');var path=require(_0xaa22('0x8'));var sox=require(_0xaa22('0x9'));var csv=require(_0xaa22('0xa'));var ejs=require(_0xaa22('0xb'));var fs=require('fs');var _=require(_0xaa22('0xc'));var squel=require(_0xaa22('0xd'));var crypto=require('crypto');var jsforce=require(_0xaa22('0xe'));var deskjs=require(_0xaa22('0xf'));var toCsv=require(_0xaa22('0xa'));var querystring=require('querystring');var Papa=require(_0xaa22('0x10'));var Redis=require(_0xaa22('0x11'));var authService=require(_0xaa22('0x12'));var qs=require(_0xaa22('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xaa22('0x14'));var logger=require('../../config/logger')(_0xaa22('0x15'));var utils=require(_0xaa22('0x16'));var config=require('../../config/environment');var db=require(_0xaa22('0x17'))['db'];var integrations=require(_0xaa22('0x18'));var jayson=require('jayson/promise');var client=jayson[_0xaa22('0x19')]['http']({'port':0x232a});function checkPasswordPattern(_0x59ce25,_0x285399,_0x385fb0){if(_0x385fb0){var _0x110b86=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x110b86[_0xaa22('0x1a')](_0x285399)){return _0x59ce25;}else{throw new db[(_0xaa22('0x1b'))]['ValidationError'](_0xaa22('0x1c'));}}else{return _0x59ce25;}}function respondWithRpcPromise(_0x2396f4,_0x5c2969,_0x31a645,_0x3b4f71){return new BPromise(function(_0x206bae,_0x10fcc){var _0x4221c0=_0x3b4f71||client;return _0x4221c0[_0xaa22('0x1d')](_0x2396f4,_0x31a645)[_0xaa22('0x1e')](function(_0x35aa36){logger[_0xaa22('0x1f')](_0xaa22('0x20'),_0x5c2969,_0xaa22('0x21'));logger[_0xaa22('0x22')](_0xaa22('0x23'),_0x5c2969,_0xaa22('0x21'),JSON[_0xaa22('0x24')](_0x35aa36));if(_0x35aa36['error']){if(_0x35aa36[_0xaa22('0x25')][_0xaa22('0x26')]===0x1f4){logger['error']('ZohoAccount,\x20%s,\x20%s',_0x5c2969,_0x35aa36[_0xaa22('0x25')][_0xaa22('0x27')]);return _0x10fcc(_0x35aa36[_0xaa22('0x25')][_0xaa22('0x27')]);}logger['error'](_0xaa22('0x20'),_0x5c2969,_0x35aa36[_0xaa22('0x25')][_0xaa22('0x27')]);return _0x206bae(_0x35aa36[_0xaa22('0x25')]['message']);}else{logger[_0xaa22('0x1f')](_0xaa22('0x20'),_0x5c2969,_0xaa22('0x21'));_0x206bae(_0x35aa36['result'][_0xaa22('0x27')]);}})['catch'](function(_0x944fc8){logger[_0xaa22('0x25')](_0xaa22('0x20'),_0x5c2969,_0x944fc8);_0x10fcc(_0x944fc8);});});}function respondWithStatusCode(_0x438e1a,_0x2b0997){_0x2b0997=_0x2b0997||0xcc;return function(_0x303cb1){if(_0x303cb1){return _0x438e1a[_0xaa22('0x28')](_0x2b0997);}return _0x438e1a[_0xaa22('0x29')](_0x2b0997)['end']();};}function respondWithResult(_0x2da23c,_0x2c2846){_0x2c2846=_0x2c2846||0xc8;return function(_0x5e1a54){if(_0x5e1a54){return _0x2da23c['status'](_0x2c2846)[_0xaa22('0x2a')](_0x5e1a54);}};}function respondWithFilteredResult(_0x5934cd,_0x65550c){return function(_0x333b46){if(_0x333b46){var _0x5a867b=_0x333b46[_0xaa22('0x2b')],_0x237ede=_0x65550c[_0xaa22('0x2c')],_0x42df71=_0x65550c[_0xaa22('0x2c')]+_0x65550c['limit'],_0x344b0a;if(_0x42df71>=_0x5a867b){_0x42df71=_0x5a867b;_0x344b0a=0xc8;}else{_0x344b0a=0xce;}_0x5934cd[_0xaa22('0x29')](_0x344b0a);return _0x5934cd[_0xaa22('0x2d')]('Content-Range',_0x237ede+'-'+_0x42df71+'/'+_0x5a867b)[_0xaa22('0x2a')](_0x333b46);}return null;};}function patchUpdates(_0x38b0cb){return function(_0x4c3fb7){try{jsonpatch[_0xaa22('0x2e')](_0x4c3fb7,_0x38b0cb,!![]);}catch(_0x5a9a91){return BPromise['reject'](_0x5a9a91);}return _0x4c3fb7['save']();};}function saveUpdates(_0x138e7a,_0x4d0e52){return function(_0x2f418f){if(_0x2f418f){return _0x2f418f[_0xaa22('0x2f')](_0x138e7a)[_0xaa22('0x1e')](function(_0x50235a){return _0x50235a;});}return null;};}function removeEntity(_0xc545e0,_0x25c906){return function(_0x38cdef){if(_0x38cdef){return _0x38cdef[_0xaa22('0x30')]()[_0xaa22('0x1e')](function(){_0xc545e0['status'](0xcc)[_0xaa22('0x31')]();});}};}function handleEntityNotFound(_0x436623,_0x2a71d9){return function(_0x1c8096){if(!_0x1c8096){_0x436623[_0xaa22('0x28')](0x194);}return _0x1c8096;};}function handleError(_0x106e82,_0x9db529){_0x9db529=_0x9db529||0x1f4;return function(_0x589666){logger[_0xaa22('0x25')](_0x589666[_0xaa22('0x32')]);if(_0x589666[_0xaa22('0x33')]){delete _0x589666['name'];}_0x106e82[_0xaa22('0x29')](_0x9db529)['send'](_0x589666);};}exports[_0xaa22('0x34')]=function(_0x59cbd8,_0x31bc28){var _0x4c02fe={},_0x2dbaf5={},_0x2b07fc={'count':0x0,'rows':[]};var _0x2196c0=_[_0xaa22('0x35')](db[_0xaa22('0x36')]['rawAttributes'],function(_0x56b366){return{'name':_0x56b366['fieldName'],'type':_0x56b366[_0xaa22('0x37')][_0xaa22('0x38')]};});_0x2dbaf5['model']=_['map'](_0x2196c0,'name');_0x2dbaf5['query']=_[_0xaa22('0x39')](_0x59cbd8[_0xaa22('0x3a')]);_0x2dbaf5['filters']=_[_0xaa22('0x3b')](_0x2dbaf5[_0xaa22('0x3c')],_0x2dbaf5[_0xaa22('0x3a')]);_0x4c02fe['attributes']=_[_0xaa22('0x3b')](_0x2dbaf5['model'],qs[_0xaa22('0x3d')](_0x59cbd8[_0xaa22('0x3a')][_0xaa22('0x3d')]));_0x4c02fe['attributes']=_0x4c02fe[_0xaa22('0x3e')][_0xaa22('0x3f')]?_0x4c02fe[_0xaa22('0x3e')]:_0x2dbaf5[_0xaa22('0x3c')];if(!_0x59cbd8[_0xaa22('0x3a')][_0xaa22('0x40')](_0xaa22('0x41'))){_0x4c02fe[_0xaa22('0x42')]=qs[_0xaa22('0x42')](_0x59cbd8['query'][_0xaa22('0x42')]);_0x4c02fe['offset']=qs['offset'](_0x59cbd8[_0xaa22('0x3a')]['offset']);}_0x4c02fe[_0xaa22('0x43')]=qs[_0xaa22('0x44')](_0x59cbd8[_0xaa22('0x3a')][_0xaa22('0x44')]);_0x4c02fe[_0xaa22('0x45')]=qs[_0xaa22('0x46')](_[_0xaa22('0x47')](_0x59cbd8[_0xaa22('0x3a')],_0x2dbaf5[_0xaa22('0x46')]),_0x2196c0);if(_0x59cbd8['query'][_0xaa22('0x48')]){_0x4c02fe[_0xaa22('0x45')]=_[_0xaa22('0x49')](_0x4c02fe['where'],{'$or':_['map'](_0x2196c0,function(_0x4e2f76){if(_0x4e2f76[_0xaa22('0x37')]!==_0xaa22('0x4a')){var _0x4bff23={};_0x4bff23[_0x4e2f76[_0xaa22('0x33')]]={'$like':'%'+_0x59cbd8['query'][_0xaa22('0x48')]+'%'};return _0x4bff23;}})});}_0x4c02fe=_[_0xaa22('0x49')]({},_0x4c02fe,_0x59cbd8[_0xaa22('0x4b')]);var _0x415dc8={'where':_0x4c02fe['where']};return db[_0xaa22('0x36')][_0xaa22('0x2b')](_0x415dc8)[_0xaa22('0x1e')](function(_0x106d34){_0x2b07fc['count']=_0x106d34;if(_0x59cbd8[_0xaa22('0x3a')][_0xaa22('0x4c')]){_0x4c02fe[_0xaa22('0x4d')]=[{'all':!![]}];}return db['ZohoAccount'][_0xaa22('0x4e')](_0x4c02fe);})['then'](function(_0x3b5ed8){_0x2b07fc[_0xaa22('0x4f')]=_0x3b5ed8;return _0x2b07fc;})[_0xaa22('0x1e')](respondWithFilteredResult(_0x31bc28,_0x4c02fe))['catch'](handleError(_0x31bc28,null));};exports[_0xaa22('0x50')]=function(_0x52e6a1,_0x41ca8f){var _0xc88005={'raw':![],'where':{'id':_0x52e6a1[_0xaa22('0x51')]['id']}},_0x446626={};_0x446626[_0xaa22('0x3c')]=_[_0xaa22('0x39')](db[_0xaa22('0x36')][_0xaa22('0x52')]);_0x446626[_0xaa22('0x3a')]=_[_0xaa22('0x39')](_0x52e6a1[_0xaa22('0x3a')]);_0x446626[_0xaa22('0x46')]=_[_0xaa22('0x3b')](_0x446626[_0xaa22('0x3c')],_0x446626[_0xaa22('0x3a')]);_0xc88005[_0xaa22('0x3e')]=_[_0xaa22('0x3b')](_0x446626[_0xaa22('0x3c')],qs['fields'](_0x52e6a1[_0xaa22('0x3a')][_0xaa22('0x3d')]));_0xc88005[_0xaa22('0x3e')]=_0xc88005['attributes'][_0xaa22('0x3f')]?_0xc88005[_0xaa22('0x3e')]:_0x446626[_0xaa22('0x3c')];if(_0x52e6a1[_0xaa22('0x3a')][_0xaa22('0x4c')]){_0xc88005[_0xaa22('0x4d')]=[{'all':!![]}];}_0xc88005=_[_0xaa22('0x49')]({},_0xc88005,_0x52e6a1[_0xaa22('0x4b')]);return db[_0xaa22('0x36')][_0xaa22('0x53')](_0xc88005)[_0xaa22('0x1e')](handleEntityNotFound(_0x41ca8f,null))[_0xaa22('0x1e')](respondWithResult(_0x41ca8f,null))[_0xaa22('0x54')](handleError(_0x41ca8f,null));};exports['create']=function(_0x2085c4,_0x11204d){return db[_0xaa22('0x36')][_0xaa22('0x55')](_0x2085c4['body'],{})[_0xaa22('0x1e')](respondWithResult(_0x11204d,0xc9))[_0xaa22('0x54')](handleError(_0x11204d,null));};exports[_0xaa22('0x2f')]=function(_0x5a7f7c,_0x319339){if(_0x5a7f7c[_0xaa22('0x56')]['id']){delete _0x5a7f7c[_0xaa22('0x56')]['id'];}return db['ZohoAccount'][_0xaa22('0x53')]({'where':{'id':_0x5a7f7c[_0xaa22('0x51')]['id']}})[_0xaa22('0x1e')](handleEntityNotFound(_0x319339,null))[_0xaa22('0x1e')](saveUpdates(_0x5a7f7c[_0xaa22('0x56')],null))[_0xaa22('0x1e')](respondWithResult(_0x319339,null))[_0xaa22('0x54')](handleError(_0x319339,null));};exports[_0xaa22('0x30')]=function(_0x44aefe,_0x3d3e5e){return db['ZohoAccount'][_0xaa22('0x53')]({'where':{'id':_0x44aefe[_0xaa22('0x51')]['id']}})[_0xaa22('0x1e')](handleEntityNotFound(_0x3d3e5e,null))[_0xaa22('0x1e')](removeEntity(_0x3d3e5e,null))['catch'](handleError(_0x3d3e5e,null));};exports[_0xaa22('0x57')]=function(_0x204d83,_0xf289a1,_0x2578c1){var _0x3bca61={};var _0x57ce33={};var _0xee952b;var _0x49ed30;return db['ZohoAccount'][_0xaa22('0x58')]({'where':{'id':_0x204d83[_0xaa22('0x51')]['id']}})[_0xaa22('0x1e')](handleEntityNotFound(_0xf289a1,null))[_0xaa22('0x1e')](function(_0x57bca4){if(_0x57bca4){_0xee952b=_0x57bca4;_0x57ce33[_0xaa22('0x3c')]=_[_0xaa22('0x39')](db[_0xaa22('0x59')]['rawAttributes']);_0x57ce33[_0xaa22('0x3a')]=_[_0xaa22('0x39')](_0x204d83[_0xaa22('0x3a')]);_0x57ce33[_0xaa22('0x46')]=_[_0xaa22('0x3b')](_0x57ce33[_0xaa22('0x3c')],_0x57ce33[_0xaa22('0x3a')]);_0x3bca61[_0xaa22('0x3e')]=_[_0xaa22('0x3b')](_0x57ce33[_0xaa22('0x3c')],qs[_0xaa22('0x3d')](_0x204d83['query'][_0xaa22('0x3d')]));_0x3bca61['attributes']=_0x3bca61['attributes'][_0xaa22('0x3f')]?_0x3bca61[_0xaa22('0x3e')]:_0x57ce33[_0xaa22('0x3c')];_0x3bca61[_0xaa22('0x43')]=qs['sort'](_0x204d83[_0xaa22('0x3a')][_0xaa22('0x44')]);_0x3bca61[_0xaa22('0x45')]=qs['filters'](_[_0xaa22('0x47')](_0x204d83[_0xaa22('0x3a')],_0x57ce33[_0xaa22('0x46')]));if(_0x204d83['query'][_0xaa22('0x48')]){_0x3bca61[_0xaa22('0x45')]=_[_0xaa22('0x49')](_0x3bca61[_0xaa22('0x45')],{'$or':_[_0xaa22('0x35')](_0x3bca61[_0xaa22('0x3e')],function(_0xe20f10){var _0x4746e5={};_0x4746e5[_0xe20f10]={'$like':'%'+_0x204d83[_0xaa22('0x3a')][_0xaa22('0x48')]+'%'};return _0x4746e5;})});}_0x3bca61=_[_0xaa22('0x49')]({},_0x3bca61,_0x204d83[_0xaa22('0x4b')]);return _0xee952b['getConfigurations'](_0x3bca61);}})[_0xaa22('0x1e')](function(_0x4ad21a){if(_0x4ad21a){_0x49ed30=_0x4ad21a[_0xaa22('0x3f')];if(!_0x204d83[_0xaa22('0x3a')]['hasOwnProperty'](_0xaa22('0x41'))){_0x3bca61[_0xaa22('0x42')]=qs[_0xaa22('0x42')](_0x204d83[_0xaa22('0x3a')][_0xaa22('0x42')]);_0x3bca61[_0xaa22('0x2c')]=qs[_0xaa22('0x2c')](_0x204d83[_0xaa22('0x3a')]['offset']);}return _0xee952b[_0xaa22('0x57')](_0x3bca61);}})[_0xaa22('0x1e')](function(_0x123d07){if(_0x123d07){return _0x123d07?{'count':_0x49ed30,'rows':_0x123d07}:null;}})[_0xaa22('0x1e')](respondWithResult(_0xf289a1,null))[_0xaa22('0x54')](handleError(_0xf289a1,null));};exports[_0xaa22('0x5a')]=function(_0xa14f99,_0x40e8ed,_0x4cc317){if(_0xa14f99['body']['id']){delete _0xa14f99[_0xaa22('0x56')]['id'];}return db[_0xaa22('0x36')]['findOne']({'where':{'id':_0xa14f99[_0xaa22('0x51')]['id']}})['then'](handleEntityNotFound(_0x40e8ed,null))['then'](function(_0x5b295b){if(_0x5b295b){_0xa14f99[_0xaa22('0x56')]['AccountId']=_0x5b295b['id'];_0xa14f99[_0xaa22('0x56')]['Subjects']=integrations[_0xaa22('0x5b')](_0xa14f99[_0xaa22('0x56')]['channel'],_0xa14f99[_0xaa22('0x56')][_0xaa22('0x37')]);_0xa14f99[_0xaa22('0x56')][_0xaa22('0x5c')]=integrations[_0xaa22('0x5d')](_0xa14f99[_0xaa22('0x56')][_0xaa22('0x5e')],_0xa14f99['body']['type']);return db['ZohoConfiguration'][_0xaa22('0x55')](_0xa14f99[_0xaa22('0x56')],{'include':[{'model':db[_0xaa22('0x5f')],'as':_0xaa22('0x60')},{'model':db[_0xaa22('0x5f')],'as':'Descriptions'}]});}return null;})['then'](respondWithResult(_0x40e8ed,null))[_0xaa22('0x54')](handleError(_0x40e8ed,null));};function getAccessToken(_0x29710d){return new Promise(function(_0x563a5f,_0x3e5fc0){var _0x20270c;switch(_0x29710d['zone']){case'US':_0x20270c=_0xaa22('0x61');break;case'AU':_0x20270c='https://accounts.zoho.com.au';break;case'EU':_0x20270c=_0xaa22('0x62');break;case'IN':_0x20270c='https://accounts.zoho.in';break;case'CN':_0x20270c=_0xaa22('0x63');break;default:_0x20270c=_0xaa22('0x62');break;}var _0x402aea={'method':_0xaa22('0x64'),'uri':_0x20270c+_0xaa22('0x65'),'qs':{'refresh_token':_0x29710d['refreshToken'],'client_id':_0x29710d[_0xaa22('0x66')],'client_secret':_0x29710d['clientSecret'],'grant_type':'refresh_token'},'json':!![]};return rp(_0x402aea)[_0xaa22('0x1e')](function(_0x5f352e){if(_0x5f352e['access_token']){_0x563a5f(_0x5f352e[_0xaa22('0x67')]);}else{_0x3e5fc0(_0xaa22('0x68'));}})['catch'](function(_0x109004){_0x3e5fc0(_0x109004);});});}exports[_0xaa22('0x69')]=function(_0x47bd29,_0x147e52,_0x5d3a87){var _0xb053e5,_0x1602a0,_0x661fbc,_0x1b1c78,_0x2614c8;return db[_0xaa22('0x36')][_0xaa22('0x58')]({'where':{'id':_0x47bd29['params']['id']},'attributes':['id','host',_0xaa22('0x6a'),_0xaa22('0x66'),_0xaa22('0x6b'),_0xaa22('0x6c'),_0xaa22('0x26'),_0xaa22('0x6d')]})['then'](handleEntityNotFound(_0x147e52,null))[_0xaa22('0x1e')](function(_0x494060){_0x2614c8=_0x494060;_0xb053e5=_0x2614c8[_0xaa22('0x6e')];_0x1602a0=_0xb053e5===_0xaa22('0x6f')?'eu':_0xaa22('0x70');_0x661fbc=_0x2614c8[_0xaa22('0x6c')];var _0x8d8638=_0x661fbc['slice'](-0x1);if(_0x8d8638==='/'||_0x8d8638==='\x5c'||_0x8d8638===':'){_0x661fbc=_0x661fbc[_0xaa22('0x71')](0x0,_0x661fbc[_0xaa22('0x72')](_0x8d8638));}if(!_0x2614c8[_0xaa22('0x6d')]){throw new Error('Refresh\x20Token\x20not\x20available\x20for\x20the\x20account');}return getAccessToken(_0x2614c8);})[_0xaa22('0x1e')](function(_0x185f57){if(_0x185f57){return rp({'method':_0xaa22('0x73'),'uri':util['format'](_0xaa22('0x74'),_0x1602a0),'qs':{'module':'Calls'},'headers':{'Authorization':'Zoho-oauthtoken\x20'+_0x185f57},'json':!![]});}})[_0xaa22('0x1e')](function(_0x3e4859){if(_0x3e4859){if(_0x3e4859[_0xaa22('0x75')]&&_0x3e4859[_0xaa22('0x75')]['error']){throw new Error(_0x3e4859['response'][_0xaa22('0x25')][_0xaa22('0x27')]);}var _0x32c950=[];var _0x508a06=[];var _0x2a3a85=['Owner',_0xaa22('0x76'),_0xaa22('0x77'),_0xaa22('0x78'),_0xaa22('0x79'),_0xaa22('0x7a'),_0xaa22('0x7b'),'Call_Type'];_0x508a06=_[_0xaa22('0x7c')](_0x3e4859[_0xaa22('0x3d')],function(_0x65be1c){return _0x2a3a85[_0xaa22('0x7d')](_0x65be1c[_0xaa22('0x7e')]);});for(var _0x417eca=0x0;_0x417eca<_0x508a06[_0xaa22('0x3f')];_0x417eca++){if(_0x508a06[_0x417eca][_0xaa22('0x7f')]===![]){_0x32c950[_0xaa22('0x80')]({'id':_0x508a06[_0x417eca]['id'],'name':_0x508a06[_0x417eca][_0xaa22('0x81')],'custom':_0x508a06[_0x417eca][_0xaa22('0x82')],'options':_0x508a06[_0x417eca][_0xaa22('0x83')]===_0xaa22('0x84')&&_0x508a06[_0x417eca]['pick_list_values'][_0xaa22('0x3f')]>-0x1?_[_0xaa22('0x35')](_0x508a06[_0x417eca]['pick_list_values'],function(_0x52d636){return{'name':_0x52d636,'value':_0x52d636};}):[]});}}return{'count':_0x32c950[_0xaa22('0x3f')],'rows':_0x32c950};}else{return{'count':0x0,'rows':[]};}})[_0xaa22('0x1e')](respondWithResult(_0x147e52,null))[_0xaa22('0x54')](function(_0x3afa47){var _0x407deb=_0x47bd29[_0xaa22('0x3a')][_0xaa22('0x1a')]?0x1f4:_0x3afa47['statusCode']||0x1f4;logger[_0xaa22('0x25')]('getFields,\x20%s,\x20%s,\x20%s',_0xaa22('0x69'),_0x407deb,JSON['stringify'](_0x3afa47));delete _0x3afa47[_0xaa22('0x33')];if(_0x407deb===0x191){_0x407deb=0x190;}_0x147e52['status'](_0x407deb)['send'](_0x47bd29[_0xaa22('0x3a')]['test']?{'message':_0xaa22('0x85'),'statusCode':_0x3afa47[_0xaa22('0x86')]}:_0x3afa47);});}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.model.js b/server/api/intZohoAccount/intZohoAccount.model.js index 7e979e9..cc15caf 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 _0x1602=['https://accounts.zoho.eu','application/x-www-form-urlencoded','inspect','lodash','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./intZohoAccount.attributes','exports','define','ZohoAccount','int_zoho_accounts','changed','zone','clientId','clientSecret','code','host','serverUrl','slice','substring','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.in','https://accounts.zoho.com.cn','POST','/oauth/v2/token','authorization_code','parse','refreshToken','refresh_token','format','ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d','name','error','ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d','catch'];(function(_0x142805,_0x25c54d){var _0x14d943=function(_0xdf2e18){while(--_0xdf2e18){_0x142805['push'](_0x142805['shift']());}};_0x14d943(++_0x25c54d);}(_0x1602,0xa7));var _0x2160=function(_0x167cc1,_0x56ef5a){_0x167cc1=_0x167cc1-0x0;var _0x10bc4b=_0x1602[_0x167cc1];return _0x10bc4b;};'use strict';var _=require(_0x2160('0x0'));var util=require('util');var logger=require(_0x2160('0x1'))(_0x2160('0x2'));var moment=require('moment');var BPromise=require(_0x2160('0x3'));var rp=require(_0x2160('0x4'));var fs=require('fs');var path=require(_0x2160('0x5'));var rimraf=require(_0x2160('0x6'));var config=require(_0x2160('0x7'));var attributes=require(_0x2160('0x8'));var integrations=require('../../components/integrations/configuration');module[_0x2160('0x9')]=function(_0x481a59,_0x3afc1b){return _0x481a59[_0x2160('0xa')](_0x2160('0xb'),attributes,{'tableName':_0x2160('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeCreate':function(_0x1ac7da,_0x41092d,_0x53296f){if(_0x1ac7da[_0x2160('0xd')](_0x2160('0xe'))||_0x1ac7da[_0x2160('0xd')]('serverUrl')||_0x1ac7da[_0x2160('0xd')](_0x2160('0xf'))||_0x1ac7da[_0x2160('0xd')](_0x2160('0x10'))||_0x1ac7da[_0x2160('0xd')](_0x2160('0x11'))||_0x1ac7da['changed'](_0x2160('0x12'))){var _0x3480cd,_0x338ed0;_0x3480cd=_0x1ac7da[_0x2160('0x13')];var _0x15dc66=_0x3480cd[_0x2160('0x14')](-0x1);if(_0x15dc66==='/'||_0x15dc66==='\x5c'||_0x15dc66===':'){_0x3480cd=_0x3480cd[_0x2160('0x15')](0x0,_0x3480cd['lastIndexOf'](_0x15dc66));}switch(_0x1ac7da['zone']){case'US':_0x338ed0=_0x2160('0x16');break;case'AU':_0x338ed0=_0x2160('0x17');break;case'IN':_0x338ed0=_0x2160('0x18');break;case'CN':_0x338ed0=_0x2160('0x19');break;default:_0x338ed0='https://accounts.zoho.eu';break;}var _0x278ed9={'method':_0x2160('0x1a'),'uri':_0x338ed0+_0x2160('0x1b'),'form':{'grant_type':_0x2160('0x1c'),'client_id':_0x1ac7da['clientId'],'client_secret':_0x1ac7da[_0x2160('0x10')],'redirect_uri':_0x1ac7da[_0x2160('0x13')],'code':_0x1ac7da[_0x2160('0x11')]},'headers':{'Content-Type':'application/x-www-form-urlencoded'}};return rp(_0x278ed9)['then'](function(_0x3e95c6){var _0x53aeb4=JSON[_0x2160('0x1d')](_0x3e95c6);if(_0x53aeb4['refresh_token']){_0x1ac7da[_0x2160('0x1e')]=_0x53aeb4[_0x2160('0x1f')];logger['info'](util[_0x2160('0x20')](_0x2160('0x21'),_0x1ac7da[_0x2160('0x22')],_0x1ac7da['id']));}else{logger[_0x2160('0x23')](util['format'](_0x2160('0x24'),_0x1ac7da['name'],_0x1ac7da['id']),util['inspect'](_0x53aeb4,{'showHidden':![],'depth':null}));}return _0x53296f(null,_0x41092d);})[_0x2160('0x25')](function(_0x5664d2){logger['error'](util[_0x2160('0x20')](_0x2160('0x24'),_0x1ac7da['name'],_0x1ac7da['id']),util['inspect'](parsedResult,{'showHidden':![],'depth':null}));return _0x53296f(_0x5664d2);});}else{return _0x53296f(null,_0x41092d);}},'beforeUpdate':function(_0x296ff5,_0x2804bb,_0x141039){if(_0x296ff5[_0x2160('0xd')](_0x2160('0xe'))||_0x296ff5['changed'](_0x2160('0x13'))||_0x296ff5['changed'](_0x2160('0xf'))||_0x296ff5[_0x2160('0xd')](_0x2160('0x10'))||_0x296ff5[_0x2160('0xd')](_0x2160('0x11'))||_0x296ff5['changed']('host')){var _0x36ab39,_0x32593e;_0x36ab39=_0x296ff5['serverUrl'];var _0x45a9b4=_0x36ab39[_0x2160('0x14')](-0x1);if(_0x45a9b4==='/'||_0x45a9b4==='\x5c'||_0x45a9b4===':'){_0x36ab39=_0x36ab39['substring'](0x0,_0x36ab39['lastIndexOf'](_0x45a9b4));}switch(_0x296ff5['zone']){case'US':_0x32593e=_0x2160('0x16');break;case'AU':_0x32593e='https://accounts.zoho.com.au';break;case'IN':_0x32593e=_0x2160('0x18');break;case'CN':_0x32593e=_0x2160('0x19');break;default:_0x32593e=_0x2160('0x26');break;}var _0x270cdb={'method':_0x2160('0x1a'),'uri':_0x32593e+_0x2160('0x1b'),'form':{'grant_type':'authorization_code','client_id':_0x296ff5[_0x2160('0xf')],'client_secret':_0x296ff5['clientSecret'],'redirect_uri':_0x296ff5[_0x2160('0x13')],'code':_0x296ff5[_0x2160('0x11')]},'headers':{'Content-Type':_0x2160('0x27')}};return rp(_0x270cdb)['then'](function(_0x35b432){var _0x53611a=JSON[_0x2160('0x1d')](_0x35b432);if(_0x53611a['refresh_token']){_0x296ff5[_0x2160('0x1e')]=_0x53611a[_0x2160('0x1f')];logger['info'](util[_0x2160('0x20')]('ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d',_0x296ff5['name'],_0x296ff5['id']));}else{logger[_0x2160('0x23')](util[_0x2160('0x20')](_0x2160('0x24'),_0x296ff5[_0x2160('0x22')],_0x296ff5['id']),util['inspect'](_0x53611a,{'showHidden':![],'depth':null}));}return _0x141039(null,_0x2804bb);})[_0x2160('0x25')](function(_0x25ad56){logger[_0x2160('0x23')](util['format']('ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d',_0x296ff5[_0x2160('0x22')],_0x296ff5['id']),util[_0x2160('0x28')](parsedResult,{'showHidden':![],'depth':null}));return _0x141039(_0x25ad56);});}else{return _0x141039(null,_0x2804bb);}}}});}; \ No newline at end of file +var _0xdc38=['catch','ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d','name','https://accounts.zoho.com.cn','lodash','../../config/logger','api','moment','bluebird','path','rimraf','./intZohoAccount.attributes','exports','define','ZohoAccount','int_zoho_accounts','changed','zone','serverUrl','clientId','clientSecret','host','slice','substring','lastIndexOf','https://accounts.zoho.com.au','https://accounts.zoho.in','https://accounts.zoho.eu','POST','authorization_code','code','application/x-www-form-urlencoded','then','parse','refresh_token','refreshToken','info','format','ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d','error','inspect'];(function(_0x4eafed,_0x26e2bc){var _0x159c85=function(_0x6f129f){while(--_0x6f129f){_0x4eafed['push'](_0x4eafed['shift']());}};_0x159c85(++_0x26e2bc);}(_0xdc38,0x1c7));var _0x8dc3=function(_0x5a2963,_0x48ec63){_0x5a2963=_0x5a2963-0x0;var _0x24ffb6=_0xdc38[_0x5a2963];return _0x24ffb6;};'use strict';var _=require(_0x8dc3('0x0'));var util=require('util');var logger=require(_0x8dc3('0x1'))(_0x8dc3('0x2'));var moment=require(_0x8dc3('0x3'));var BPromise=require(_0x8dc3('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x8dc3('0x5'));var rimraf=require(_0x8dc3('0x6'));var config=require('../../config/environment');var attributes=require(_0x8dc3('0x7'));var integrations=require('../../components/integrations/configuration');module[_0x8dc3('0x8')]=function(_0x4663a0,_0x100fbb){return _0x4663a0[_0x8dc3('0x9')](_0x8dc3('0xa'),attributes,{'tableName':_0x8dc3('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeCreate':function(_0x4a37b3,_0x2192bd,_0x168720){if(_0x4a37b3[_0x8dc3('0xc')](_0x8dc3('0xd'))||_0x4a37b3[_0x8dc3('0xc')](_0x8dc3('0xe'))||_0x4a37b3[_0x8dc3('0xc')](_0x8dc3('0xf'))||_0x4a37b3[_0x8dc3('0xc')](_0x8dc3('0x10'))||_0x4a37b3[_0x8dc3('0xc')]('code')||_0x4a37b3['changed'](_0x8dc3('0x11'))){var _0x3dd607,_0x4f269c;_0x3dd607=_0x4a37b3[_0x8dc3('0xe')];var _0x18d934=_0x3dd607[_0x8dc3('0x12')](-0x1);if(_0x18d934==='/'||_0x18d934==='\x5c'||_0x18d934===':'){_0x3dd607=_0x3dd607[_0x8dc3('0x13')](0x0,_0x3dd607[_0x8dc3('0x14')](_0x18d934));}switch(_0x4a37b3[_0x8dc3('0xd')]){case'US':_0x4f269c='https://accounts.zoho.com';break;case'AU':_0x4f269c=_0x8dc3('0x15');break;case'IN':_0x4f269c=_0x8dc3('0x16');break;case'CN':_0x4f269c='https://accounts.zoho.com.cn';break;default:_0x4f269c=_0x8dc3('0x17');break;}var _0x117be2={'method':_0x8dc3('0x18'),'uri':_0x4f269c+'/oauth/v2/token','form':{'grant_type':_0x8dc3('0x19'),'client_id':_0x4a37b3[_0x8dc3('0xf')],'client_secret':_0x4a37b3['clientSecret'],'redirect_uri':_0x4a37b3[_0x8dc3('0xe')],'code':_0x4a37b3[_0x8dc3('0x1a')]},'headers':{'Content-Type':_0x8dc3('0x1b')}};return rp(_0x117be2)[_0x8dc3('0x1c')](function(_0xc07d6a){var _0x5913a1=JSON[_0x8dc3('0x1d')](_0xc07d6a);if(_0x5913a1[_0x8dc3('0x1e')]){_0x4a37b3[_0x8dc3('0x1f')]=_0x5913a1[_0x8dc3('0x1e')];logger[_0x8dc3('0x20')](util[_0x8dc3('0x21')](_0x8dc3('0x22'),_0x4a37b3['name'],_0x4a37b3['id']));}else{logger[_0x8dc3('0x23')](util[_0x8dc3('0x21')]('ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d',_0x4a37b3['name'],_0x4a37b3['id']),util[_0x8dc3('0x24')](_0x5913a1,{'showHidden':![],'depth':null}));}return _0x168720(null,_0x2192bd);})[_0x8dc3('0x25')](function(_0x4c44f4){logger[_0x8dc3('0x23')](util[_0x8dc3('0x21')](_0x8dc3('0x26'),_0x4a37b3[_0x8dc3('0x27')],_0x4a37b3['id']),util[_0x8dc3('0x24')](parsedResult,{'showHidden':![],'depth':null}));return _0x168720(_0x4c44f4);});}else{return _0x168720(null,_0x2192bd);}},'beforeUpdate':function(_0x14a70e,_0x2805d0,_0x4d41c9){if(_0x14a70e[_0x8dc3('0xc')](_0x8dc3('0xd'))||_0x14a70e[_0x8dc3('0xc')](_0x8dc3('0xe'))||_0x14a70e[_0x8dc3('0xc')](_0x8dc3('0xf'))||_0x14a70e['changed'](_0x8dc3('0x10'))||_0x14a70e[_0x8dc3('0xc')](_0x8dc3('0x1a'))||_0x14a70e[_0x8dc3('0xc')](_0x8dc3('0x11'))){var _0x930206,_0x70904a;_0x930206=_0x14a70e[_0x8dc3('0xe')];var _0x53ce71=_0x930206['slice'](-0x1);if(_0x53ce71==='/'||_0x53ce71==='\x5c'||_0x53ce71===':'){_0x930206=_0x930206[_0x8dc3('0x13')](0x0,_0x930206[_0x8dc3('0x14')](_0x53ce71));}switch(_0x14a70e[_0x8dc3('0xd')]){case'US':_0x70904a='https://accounts.zoho.com';break;case'AU':_0x70904a=_0x8dc3('0x15');break;case'IN':_0x70904a=_0x8dc3('0x16');break;case'CN':_0x70904a=_0x8dc3('0x28');break;default:_0x70904a='https://accounts.zoho.eu';break;}var _0x1c10bd={'method':_0x8dc3('0x18'),'uri':_0x70904a+'/oauth/v2/token','form':{'grant_type':_0x8dc3('0x19'),'client_id':_0x14a70e[_0x8dc3('0xf')],'client_secret':_0x14a70e[_0x8dc3('0x10')],'redirect_uri':_0x14a70e[_0x8dc3('0xe')],'code':_0x14a70e[_0x8dc3('0x1a')]},'headers':{'Content-Type':_0x8dc3('0x1b')}};return rp(_0x1c10bd)[_0x8dc3('0x1c')](function(_0x54448a){var _0x13ec49=JSON[_0x8dc3('0x1d')](_0x54448a);if(_0x13ec49[_0x8dc3('0x1e')]){_0x14a70e['refreshToken']=_0x13ec49[_0x8dc3('0x1e')];logger[_0x8dc3('0x20')](util[_0x8dc3('0x21')]('ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d',_0x14a70e[_0x8dc3('0x27')],_0x14a70e['id']));}else{logger['error'](util[_0x8dc3('0x21')]('ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d',_0x14a70e[_0x8dc3('0x27')],_0x14a70e['id']),util[_0x8dc3('0x24')](_0x13ec49,{'showHidden':![],'depth':null}));}return _0x4d41c9(null,_0x2805d0);})[_0x8dc3('0x25')](function(_0x4053ef){logger[_0x8dc3('0x23')](util[_0x8dc3('0x21')](_0x8dc3('0x26'),_0x14a70e['name'],_0x14a70e['id']),util[_0x8dc3('0x24')](parsedResult,{'showHidden':![],'depth':null}));return _0x4d41c9(_0x4053ef);});}else{return _0x4d41c9(null,_0x2805d0);}}}});}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.rpc.js b/server/api/intZohoAccount/intZohoAccount.rpc.js index 3c53e0f..f103dc1 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 _0x33cd=['ZohoAccount','findAll','options','raw','where','attributes','limit','map','include','model','then','catch','ShowZohoAccount','find','lodash','util','moment','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','info','request\x20sent','debug','ZohoAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','ZohoAccount,\x20%s,\x20%s','message','result','GetZohoAccount'];(function(_0x5f3dff,_0x39ccb3){var _0x469529=function(_0x114f5b){while(--_0x114f5b){_0x5f3dff['push'](_0x5f3dff['shift']());}};_0x469529(++_0x39ccb3);}(_0x33cd,0x180));var _0xd33c=function(_0x2aec04,_0x2df9bd){_0x2aec04=_0x2aec04-0x0;var _0x4d2324=_0x33cd[_0x2aec04];return _0x4d2324;};'use strict';var _=require(_0xd33c('0x0'));var util=require(_0xd33c('0x1'));var moment=require(_0xd33c('0x2'));var BPromise=require(_0xd33c('0x3'));var rs=require(_0xd33c('0x4'));var fs=require('fs');var Redis=require(_0xd33c('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xd33c('0x6'))(_0xd33c('0x7'));var config=require(_0xd33c('0x8'));var jayson=require(_0xd33c('0x9'));var client=jayson[_0xd33c('0xa')][_0xd33c('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xb90a48,_0x2f6c7d,_0x389e89){return new BPromise(function(_0x12202e,_0x1ca40e){return client['request'](_0xb90a48,_0x389e89)['then'](function(_0xe48b2e){logger[_0xd33c('0xc')]('ZohoAccount,\x20%s,\x20%s',_0x2f6c7d,_0xd33c('0xd'));logger[_0xd33c('0xe')](_0xd33c('0xf'),_0x2f6c7d,_0xd33c('0xd'),JSON[_0xd33c('0x10')](_0xe48b2e));if(_0xe48b2e[_0xd33c('0x11')]){if(_0xe48b2e[_0xd33c('0x11')][_0xd33c('0x12')]===0x1f4){logger[_0xd33c('0x11')](_0xd33c('0x13'),_0x2f6c7d,_0xe48b2e[_0xd33c('0x11')][_0xd33c('0x14')]);return _0x1ca40e(_0xe48b2e['error'][_0xd33c('0x14')]);}logger[_0xd33c('0x11')]('ZohoAccount,\x20%s,\x20%s',_0x2f6c7d,_0xe48b2e[_0xd33c('0x11')][_0xd33c('0x14')]);return _0x12202e(_0xe48b2e[_0xd33c('0x11')][_0xd33c('0x14')]);}else{logger['info'](_0xd33c('0x13'),_0x2f6c7d,_0xd33c('0xd'));_0x12202e(_0xe48b2e[_0xd33c('0x15')][_0xd33c('0x14')]);}})['catch'](function(_0x5bce71){logger[_0xd33c('0x11')](_0xd33c('0x13'),_0x2f6c7d,_0x5bce71);_0x1ca40e(_0x5bce71);});});}exports[_0xd33c('0x16')]=function(_0x140c79){var _0xd3f9ff=this;return new Promise(function(_0x41b39a,_0x153a8a){return db[_0xd33c('0x17')][_0xd33c('0x18')]({'raw':_0x140c79[_0xd33c('0x19')]?_0x140c79[_0xd33c('0x19')][_0xd33c('0x1a')]===undefined?!![]:![]:!![],'where':_0x140c79['options']?_0x140c79[_0xd33c('0x19')][_0xd33c('0x1b')]||null:null,'attributes':_0x140c79[_0xd33c('0x19')]?_0x140c79[_0xd33c('0x19')][_0xd33c('0x1c')]||null:null,'limit':_0x140c79['options']?_0x140c79['options'][_0xd33c('0x1d')]||null:null,'include':_0x140c79[_0xd33c('0x19')]?_0x140c79[_0xd33c('0x19')]['include']?_[_0xd33c('0x1e')](_0x140c79[_0xd33c('0x19')][_0xd33c('0x1f')],function(_0x23ed07){return{'model':db[_0x23ed07[_0xd33c('0x20')]],'as':_0x23ed07['as'],'attributes':_0x23ed07['attributes'],'include':_0x23ed07[_0xd33c('0x1f')]?_['map'](_0x23ed07[_0xd33c('0x1f')],function(_0x18a68c){return{'model':db[_0x18a68c[_0xd33c('0x20')]],'as':_0x18a68c['as'],'attributes':_0x18a68c[_0xd33c('0x1c')],'include':_0x18a68c[_0xd33c('0x1f')]?_[_0xd33c('0x1e')](_0x18a68c[_0xd33c('0x1f')],function(_0x327e17){return{'model':db[_0x327e17[_0xd33c('0x20')]],'as':_0x327e17['as'],'attributes':_0x327e17[_0xd33c('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xd33c('0x21')](function(_0x2ecb27){logger['info'](_0xd33c('0x16'),_0x140c79);logger[_0xd33c('0xe')](_0xd33c('0x16'),_0x140c79,JSON[_0xd33c('0x10')](_0x2ecb27));_0x41b39a(_0x2ecb27);})[_0xd33c('0x22')](function(_0x414dd1){logger[_0xd33c('0x11')](_0xd33c('0x16'),_0x414dd1[_0xd33c('0x14')],_0x140c79);_0x153a8a(_0xd3f9ff['error'](0x1f4,_0x414dd1['message']));});});};exports[_0xd33c('0x23')]=function(_0x164db4){var _0x633d29=this;return new Promise(function(_0x59074a,_0x355126){return db['ZohoAccount'][_0xd33c('0x24')]({'raw':_0x164db4['options']?_0x164db4[_0xd33c('0x19')][_0xd33c('0x1a')]===undefined?!![]:![]:!![],'where':_0x164db4[_0xd33c('0x19')]?_0x164db4['options']['where']||null:null,'attributes':_0x164db4[_0xd33c('0x19')]?_0x164db4[_0xd33c('0x19')]['attributes']||null:null,'include':_0x164db4[_0xd33c('0x19')]?_0x164db4[_0xd33c('0x19')][_0xd33c('0x1f')]?_[_0xd33c('0x1e')](_0x164db4[_0xd33c('0x19')][_0xd33c('0x1f')],function(_0x441cca){return{'model':db[_0x441cca[_0xd33c('0x20')]],'as':_0x441cca['as'],'attributes':_0x441cca['attributes'],'include':_0x441cca['include']?_[_0xd33c('0x1e')](_0x441cca[_0xd33c('0x1f')],function(_0x1b892e){return{'model':db[_0x1b892e[_0xd33c('0x20')]],'as':_0x1b892e['as'],'attributes':_0x1b892e[_0xd33c('0x1c')],'include':_0x1b892e[_0xd33c('0x1f')]?_[_0xd33c('0x1e')](_0x1b892e[_0xd33c('0x1f')],function(_0x4eebd6){return{'model':db[_0x4eebd6[_0xd33c('0x20')]],'as':_0x4eebd6['as'],'attributes':_0x4eebd6[_0xd33c('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xd33c('0x21')](function(_0x57b383){logger[_0xd33c('0xc')](_0xd33c('0x23'),_0x164db4);logger[_0xd33c('0xe')](_0xd33c('0x23'),_0x164db4,JSON[_0xd33c('0x10')](_0x57b383));_0x59074a(_0x57b383);})[_0xd33c('0x22')](function(_0x441d84){logger[_0xd33c('0x11')](_0xd33c('0x23'),_0x441d84['message'],_0x164db4);_0x355126(_0x633d29[_0xd33c('0x11')](0x1f4,_0x441d84[_0xd33c('0x14')]));});});}; \ No newline at end of file +var _0xa4a9=['map','model','ZohoAccount','find','raw','ShowZohoAccount','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','stringify','error','code','message','ZohoAccount,\x20%s,\x20%s','result','GetZohoAccount','findAll','options','where','include','attributes'];(function(_0x53746a,_0x36ccf5){var _0x2942a0=function(_0x54a4be){while(--_0x54a4be){_0x53746a['push'](_0x53746a['shift']());}};_0x2942a0(++_0x36ccf5);}(_0xa4a9,0x126));var _0x9a4a=function(_0x1f1a97,_0xadfc15){_0x1f1a97=_0x1f1a97-0x0;var _0x29fc6a=_0xa4a9[_0x1f1a97];return _0x29fc6a;};'use strict';var _=require(_0x9a4a('0x0'));var util=require(_0x9a4a('0x1'));var moment=require('moment');var BPromise=require(_0x9a4a('0x2'));var rs=require(_0x9a4a('0x3'));var fs=require('fs');var Redis=require(_0x9a4a('0x4'));var db=require(_0x9a4a('0x5'))['db'];var utils=require(_0x9a4a('0x6'));var logger=require(_0x9a4a('0x7'))(_0x9a4a('0x8'));var config=require(_0x9a4a('0x9'));var jayson=require(_0x9a4a('0xa'));var client=jayson[_0x9a4a('0xb')][_0x9a4a('0xc')]({'port':0x232a});function respondWithRpcPromise(_0xde25d1,_0x32026b,_0x1e5a1e){return new BPromise(function(_0x35cb55,_0x264a23){return client[_0x9a4a('0xd')](_0xde25d1,_0x1e5a1e)[_0x9a4a('0xe')](function(_0x2d9cec){logger[_0x9a4a('0xf')]('ZohoAccount,\x20%s,\x20%s',_0x32026b,_0x9a4a('0x10'));logger[_0x9a4a('0x11')]('ZohoAccount,\x20%s,\x20%s,\x20%s',_0x32026b,'request\x20sent',JSON[_0x9a4a('0x12')](_0x2d9cec));if(_0x2d9cec[_0x9a4a('0x13')]){if(_0x2d9cec['error'][_0x9a4a('0x14')]===0x1f4){logger[_0x9a4a('0x13')]('ZohoAccount,\x20%s,\x20%s',_0x32026b,_0x2d9cec[_0x9a4a('0x13')][_0x9a4a('0x15')]);return _0x264a23(_0x2d9cec['error'][_0x9a4a('0x15')]);}logger[_0x9a4a('0x13')](_0x9a4a('0x16'),_0x32026b,_0x2d9cec[_0x9a4a('0x13')][_0x9a4a('0x15')]);return _0x35cb55(_0x2d9cec[_0x9a4a('0x13')][_0x9a4a('0x15')]);}else{logger[_0x9a4a('0xf')](_0x9a4a('0x16'),_0x32026b,'request\x20sent');_0x35cb55(_0x2d9cec[_0x9a4a('0x17')]['message']);}})['catch'](function(_0x56008f){logger['error']('ZohoAccount,\x20%s,\x20%s',_0x32026b,_0x56008f);_0x264a23(_0x56008f);});});}exports[_0x9a4a('0x18')]=function(_0x1c9f55){var _0x1aec20=this;return new Promise(function(_0x1008f3,_0xa1225a){return db['ZohoAccount'][_0x9a4a('0x19')]({'raw':_0x1c9f55[_0x9a4a('0x1a')]?_0x1c9f55['options']['raw']===undefined?!![]:![]:!![],'where':_0x1c9f55['options']?_0x1c9f55['options'][_0x9a4a('0x1b')]||null:null,'attributes':_0x1c9f55[_0x9a4a('0x1a')]?_0x1c9f55[_0x9a4a('0x1a')]['attributes']||null:null,'limit':_0x1c9f55[_0x9a4a('0x1a')]?_0x1c9f55[_0x9a4a('0x1a')]['limit']||null:null,'include':_0x1c9f55[_0x9a4a('0x1a')]?_0x1c9f55['options'][_0x9a4a('0x1c')]?_['map'](_0x1c9f55[_0x9a4a('0x1a')][_0x9a4a('0x1c')],function(_0x47a8a9){return{'model':db[_0x47a8a9['model']],'as':_0x47a8a9['as'],'attributes':_0x47a8a9[_0x9a4a('0x1d')],'include':_0x47a8a9[_0x9a4a('0x1c')]?_[_0x9a4a('0x1e')](_0x47a8a9['include'],function(_0x385018){return{'model':db[_0x385018[_0x9a4a('0x1f')]],'as':_0x385018['as'],'attributes':_0x385018[_0x9a4a('0x1d')],'include':_0x385018['include']?_[_0x9a4a('0x1e')](_0x385018[_0x9a4a('0x1c')],function(_0x5ac4cf){return{'model':db[_0x5ac4cf[_0x9a4a('0x1f')]],'as':_0x5ac4cf['as'],'attributes':_0x5ac4cf['attributes']};}):[]};}):[]};}):[]:[]})[_0x9a4a('0xe')](function(_0x52ccdd){logger['info'](_0x9a4a('0x18'),_0x1c9f55);logger[_0x9a4a('0x11')]('GetZohoAccount',_0x1c9f55,JSON['stringify'](_0x52ccdd));_0x1008f3(_0x52ccdd);})['catch'](function(_0x96528a){logger[_0x9a4a('0x13')]('GetZohoAccount',_0x96528a[_0x9a4a('0x15')],_0x1c9f55);_0xa1225a(_0x1aec20[_0x9a4a('0x13')](0x1f4,_0x96528a[_0x9a4a('0x15')]));});});};exports['ShowZohoAccount']=function(_0x30bd16){var _0x29c8dd=this;return new Promise(function(_0x5525b6,_0x55a513){return db[_0x9a4a('0x20')][_0x9a4a('0x21')]({'raw':_0x30bd16['options']?_0x30bd16[_0x9a4a('0x1a')][_0x9a4a('0x22')]===undefined?!![]:![]:!![],'where':_0x30bd16[_0x9a4a('0x1a')]?_0x30bd16[_0x9a4a('0x1a')][_0x9a4a('0x1b')]||null:null,'attributes':_0x30bd16['options']?_0x30bd16[_0x9a4a('0x1a')][_0x9a4a('0x1d')]||null:null,'include':_0x30bd16['options']?_0x30bd16['options'][_0x9a4a('0x1c')]?_[_0x9a4a('0x1e')](_0x30bd16[_0x9a4a('0x1a')]['include'],function(_0x3621e7){return{'model':db[_0x3621e7[_0x9a4a('0x1f')]],'as':_0x3621e7['as'],'attributes':_0x3621e7[_0x9a4a('0x1d')],'include':_0x3621e7['include']?_[_0x9a4a('0x1e')](_0x3621e7['include'],function(_0x1a7108){return{'model':db[_0x1a7108[_0x9a4a('0x1f')]],'as':_0x1a7108['as'],'attributes':_0x1a7108[_0x9a4a('0x1d')],'include':_0x1a7108['include']?_[_0x9a4a('0x1e')](_0x1a7108[_0x9a4a('0x1c')],function(_0x403b68){return{'model':db[_0x403b68['model']],'as':_0x403b68['as'],'attributes':_0x403b68['attributes']};}):[]};}):[]};}):[]:[]})[_0x9a4a('0xe')](function(_0x1b5537){logger[_0x9a4a('0xf')](_0x9a4a('0x23'),_0x30bd16);logger[_0x9a4a('0x11')](_0x9a4a('0x23'),_0x30bd16,JSON[_0x9a4a('0x12')](_0x1b5537));_0x5525b6(_0x1b5537);})['catch'](function(_0xd207f1){logger['error'](_0x9a4a('0x23'),_0xd207f1['message'],_0x30bd16);_0x55a513(_0x29c8dd['error'](0x1f4,_0xd207f1[_0x9a4a('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/index.js b/server/api/intZohoConfiguration/index.js index cee8437..32f10bd 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 _0xd10f=['../../components/interaction/service','get','isAuthenticated','index','/:id','show','getFields','/:id/subjects','getSubjects','getDescriptions','post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','../../components/auth/service'];(function(_0x18ba37,_0x451ca4){var _0x4105d8=function(_0x13e7e8){while(--_0x13e7e8){_0x18ba37['push'](_0x18ba37['shift']());}};_0x4105d8(++_0x451ca4);}(_0xd10f,0x198));var _0xfd10=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xd10f[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0xfd10('0x0'));var util=require(_0xfd10('0x1'));var path=require(_0xfd10('0x2'));var timeout=require(_0xfd10('0x3'));var express=require(_0xfd10('0x4'));var router=express['Router']();var auth=require(_0xfd10('0x5'));var interaction=require(_0xfd10('0x6'));var config=require('../../config/environment');var controller=require('./intZohoConfiguration.controller');router[_0xfd10('0x7')]('/',auth[_0xfd10('0x8')](),controller[_0xfd10('0x9')]);router[_0xfd10('0x7')](_0xfd10('0xa'),auth[_0xfd10('0x8')](),controller[_0xfd10('0xb')]);router[_0xfd10('0x7')]('/:id/fields',auth[_0xfd10('0x8')](),controller[_0xfd10('0xc')]);router['get'](_0xfd10('0xd'),auth[_0xfd10('0x8')](),controller[_0xfd10('0xe')]);router[_0xfd10('0x7')]('/:id/descriptions',auth['isAuthenticated'](),controller[_0xfd10('0xf')]);router[_0xfd10('0x10')]('/',auth['isAuthenticated'](),controller[_0xfd10('0x11')]);router[_0xfd10('0x12')](_0xfd10('0xa'),auth[_0xfd10('0x8')](),controller[_0xfd10('0x13')]);router[_0xfd10('0x14')](_0xfd10('0xa'),auth[_0xfd10('0x8')](),controller[_0xfd10('0x15')]);module[_0xfd10('0x16')]=router; \ No newline at end of file +var _0x980c=['express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZohoConfiguration.controller','get','index','/:id','isAuthenticated','show','/:id/fields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','post','put','update','delete','destroy','exports','multer','util','path','connect-timeout'];(function(_0x16c8bd,_0x1db58e){var _0x257855=function(_0x4521d1){while(--_0x4521d1){_0x16c8bd['push'](_0x16c8bd['shift']());}};_0x257855(++_0x1db58e);}(_0x980c,0x100));var _0xc980=function(_0x597e21,_0x1373c9){_0x597e21=_0x597e21-0x0;var _0x152802=_0x980c[_0x597e21];return _0x152802;};'use strict';var multer=require(_0xc980('0x0'));var util=require(_0xc980('0x1'));var path=require(_0xc980('0x2'));var timeout=require(_0xc980('0x3'));var express=require(_0xc980('0x4'));var router=express[_0xc980('0x5')]();var auth=require(_0xc980('0x6'));var interaction=require(_0xc980('0x7'));var config=require(_0xc980('0x8'));var controller=require(_0xc980('0x9'));router[_0xc980('0xa')]('/',auth['isAuthenticated'](),controller[_0xc980('0xb')]);router[_0xc980('0xa')](_0xc980('0xc'),auth[_0xc980('0xd')](),controller[_0xc980('0xe')]);router[_0xc980('0xa')](_0xc980('0xf'),auth['isAuthenticated'](),controller['getFields']);router['get'](_0xc980('0x10'),auth['isAuthenticated'](),controller[_0xc980('0x11')]);router[_0xc980('0xa')](_0xc980('0x12'),auth['isAuthenticated'](),controller[_0xc980('0x13')]);router[_0xc980('0x14')]('/',auth[_0xc980('0xd')](),controller['create']);router[_0xc980('0x15')](_0xc980('0xc'),auth[_0xc980('0xd')](),controller[_0xc980('0x16')]);router[_0xc980('0x17')](_0xc980('0xc'),auth[_0xc980('0xd')](),controller[_0xc980('0x18')]);module[_0xc980('0x19')]=router; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.attributes.js b/server/api/intZohoConfiguration/intZohoConfiguration.attributes.js index 0707e8f..4ee7b39 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 _0xd892=['contact_lead','exports','STRING','ENUM','lead','contact','nothing'];(function(_0xdea41a,_0x552987){var _0x15d0d8=function(_0x1e0d0b){while(--_0x1e0d0b){_0xdea41a['push'](_0xdea41a['shift']());}};_0x15d0d8(++_0x552987);}(_0xd892,0x135));var _0x2d89=function(_0x513aa5,_0x1fba79){_0x513aa5=_0x513aa5-0x0;var _0x1a1a7c=_0xd892[_0x513aa5];return _0x1a1a7c;};'use strict';var Sequelize=require('sequelize');module[_0x2d89('0x0')]={'name':{'type':Sequelize[_0x2d89('0x1')]},'moduleCreate':{'type':Sequelize[_0x2d89('0x2')](_0x2d89('0x3'),_0x2d89('0x4'),_0x2d89('0x5')),'defaultValue':'lead'},'moduleSearch':{'type':Sequelize[_0x2d89('0x2')](_0x2d89('0x6'),_0x2d89('0x4'),_0x2d89('0x3')),'defaultValue':_0x2d89('0x6')},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x702c=['contact_lead','STRING','sequelize','ENUM','lead','contact','nothing'];(function(_0x1326ea,_0x409dd9){var _0x4b3537=function(_0x589dd8){while(--_0x589dd8){_0x1326ea['push'](_0x1326ea['shift']());}};_0x4b3537(++_0x409dd9);}(_0x702c,0xe9));var _0xc702=function(_0x5427f4,_0x2ee354){_0x5427f4=_0x5427f4-0x0;var _0x38bbf4=_0x702c[_0x5427f4];return _0x38bbf4;};'use strict';var Sequelize=require(_0xc702('0x0'));module['exports']={'name':{'type':Sequelize['STRING']},'moduleCreate':{'type':Sequelize[_0xc702('0x1')](_0xc702('0x2'),_0xc702('0x3'),_0xc702('0x4')),'defaultValue':_0xc702('0x2')},'moduleSearch':{'type':Sequelize[_0xc702('0x1')]('contact_lead',_0xc702('0x3'),_0xc702('0x2')),'defaultValue':_0xc702('0x5')},'description':{'type':Sequelize[_0xc702('0x6')]}}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.controller.js b/server/api/intZohoConfiguration/intZohoConfiguration.controller.js index cde76dc..682f08f 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 _0x070d=['getDescriptions','eml-format','rimraf','fast-json-patch','bluebird','mustache','path','sox','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','client','http','test','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','ZohoConfiguration,\x20%s,\x20%s','debug','ZohoConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','info','result','catch','sendStatus','status','end','count','offset','set','Content-Range','json','apply','reject','save','update','destroy','stack','name','send','map','ZohoConfiguration','rawAttributes','type','model','query','filters','intersection','fields','attributes','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','VIRTUAL','merge','includeAll','findAll','show','params','keys','length','find','create','body','findOne','ZohoField','options','getFields','getSubjects'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x070d,0x109));var _0xd070=function(_0x31c19c,_0xbe4b70){_0x31c19c=_0x31c19c-0x0;var _0x1a87f7=_0x070d[_0x31c19c];return _0x1a87f7;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xd070('0x0'));var rimraf=require(_0xd070('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xd070('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xd070('0x3'));var Mustache=require(_0xd070('0x4'));var util=require('util');var path=require(_0xd070('0x5'));var sox=require(_0xd070('0x6'));var csv=require(_0xd070('0x7'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xd070('0x7'));var querystring=require(_0xd070('0x8'));var Papa=require(_0xd070('0x9'));var Redis=require(_0xd070('0xa'));var authService=require(_0xd070('0xb'));var qs=require('../../components/parsers/qs');var as=require(_0xd070('0xc'));var hardwareService=require(_0xd070('0xd'));var logger=require(_0xd070('0xe'))(_0xd070('0xf'));var utils=require(_0xd070('0x10'));var config=require(_0xd070('0x11'));var db=require(_0xd070('0x12'))['db'];var jayson=require('jayson/promise');var client=jayson[_0xd070('0x13')][_0xd070('0x14')]({'port':0x232a});function checkPasswordPattern(_0x4dba6a,_0x4bdec5,_0x2851b8){if(_0x2851b8){var _0x41f20e=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x41f20e[_0xd070('0x15')](_0x4bdec5)){return _0x4dba6a;}else{throw new db[(_0xd070('0x16'))][(_0xd070('0x17'))](_0xd070('0x18'));}}else{return _0x4dba6a;}}function respondWithRpcPromise(_0x1e06e6,_0x4f0ef8,_0x4bf63b,_0xb3fcc8){return new BPromise(function(_0x537af5,_0xd1fe06){var _0x4de058=_0xb3fcc8||client;return _0x4de058[_0xd070('0x19')](_0x1e06e6,_0x4bf63b)[_0xd070('0x1a')](function(_0x1d3e06){logger['info'](_0xd070('0x1b'),_0x4f0ef8,'request\x20sent');logger[_0xd070('0x1c')](_0xd070('0x1d'),_0x4f0ef8,_0xd070('0x1e'),JSON[_0xd070('0x1f')](_0x1d3e06));if(_0x1d3e06[_0xd070('0x20')]){if(_0x1d3e06[_0xd070('0x20')]['code']===0x1f4){logger[_0xd070('0x20')](_0xd070('0x1b'),_0x4f0ef8,_0x1d3e06[_0xd070('0x20')][_0xd070('0x21')]);return _0xd1fe06(_0x1d3e06[_0xd070('0x20')][_0xd070('0x21')]);}logger['error'](_0xd070('0x1b'),_0x4f0ef8,_0x1d3e06[_0xd070('0x20')][_0xd070('0x21')]);return _0x537af5(_0x1d3e06['error'][_0xd070('0x21')]);}else{logger[_0xd070('0x22')](_0xd070('0x1b'),_0x4f0ef8,_0xd070('0x1e'));_0x537af5(_0x1d3e06[_0xd070('0x23')][_0xd070('0x21')]);}})[_0xd070('0x24')](function(_0x37f452){logger[_0xd070('0x20')](_0xd070('0x1b'),_0x4f0ef8,_0x37f452);_0xd1fe06(_0x37f452);});});}function respondWithStatusCode(_0x146a04,_0x4d74c6){_0x4d74c6=_0x4d74c6||0xcc;return function(_0x158433){if(_0x158433){return _0x146a04[_0xd070('0x25')](_0x4d74c6);}return _0x146a04[_0xd070('0x26')](_0x4d74c6)[_0xd070('0x27')]();};}function respondWithResult(_0x61b71a,_0x521271){_0x521271=_0x521271||0xc8;return function(_0xb44096){if(_0xb44096){return _0x61b71a[_0xd070('0x26')](_0x521271)['json'](_0xb44096);}};}function respondWithFilteredResult(_0x37a0ca,_0x4515a4){return function(_0x2fb40d){if(_0x2fb40d){var _0x5487fb=_0x2fb40d[_0xd070('0x28')],_0x3561ad=_0x4515a4[_0xd070('0x29')],_0x49dbbd=_0x4515a4['offset']+_0x4515a4['limit'],_0x21dbe2;if(_0x49dbbd>=_0x5487fb){_0x49dbbd=_0x5487fb;_0x21dbe2=0xc8;}else{_0x21dbe2=0xce;}_0x37a0ca[_0xd070('0x26')](_0x21dbe2);return _0x37a0ca[_0xd070('0x2a')](_0xd070('0x2b'),_0x3561ad+'-'+_0x49dbbd+'/'+_0x5487fb)[_0xd070('0x2c')](_0x2fb40d);}return null;};}function patchUpdates(_0x4db2a2){return function(_0x531643){try{jsonpatch[_0xd070('0x2d')](_0x531643,_0x4db2a2,!![]);}catch(_0x558eb7){return BPromise[_0xd070('0x2e')](_0x558eb7);}return _0x531643[_0xd070('0x2f')]();};}function saveUpdates(_0x483e3d,_0x35e1cc){return function(_0x26ff68){if(_0x26ff68){return _0x26ff68[_0xd070('0x30')](_0x483e3d)['then'](function(_0x4201b6){return _0x4201b6;});}return null;};}function removeEntity(_0x4e3619,_0x26530f){return function(_0x5ebb6d){if(_0x5ebb6d){return _0x5ebb6d[_0xd070('0x31')]()[_0xd070('0x1a')](function(){_0x4e3619[_0xd070('0x26')](0xcc)[_0xd070('0x27')]();});}};}function handleEntityNotFound(_0x30eafb,_0x28723d){return function(_0x264c74){if(!_0x264c74){_0x30eafb[_0xd070('0x25')](0x194);}return _0x264c74;};}function handleError(_0x2e9f39,_0x2f0741){_0x2f0741=_0x2f0741||0x1f4;return function(_0x2c19dc){logger[_0xd070('0x20')](_0x2c19dc[_0xd070('0x32')]);if(_0x2c19dc[_0xd070('0x33')]){delete _0x2c19dc[_0xd070('0x33')];}_0x2e9f39[_0xd070('0x26')](_0x2f0741)[_0xd070('0x34')](_0x2c19dc);};}exports['index']=function(_0x54a6c9,_0x4e3dca){var _0x8aff0e={},_0x5a7e05={},_0x15ba93={'count':0x0,'rows':[]};var _0x32e491=_[_0xd070('0x35')](db[_0xd070('0x36')][_0xd070('0x37')],function(_0x2f09ed){return{'name':_0x2f09ed['fieldName'],'type':_0x2f09ed[_0xd070('0x38')]['key']};});_0x5a7e05[_0xd070('0x39')]=_[_0xd070('0x35')](_0x32e491,_0xd070('0x33'));_0x5a7e05[_0xd070('0x3a')]=_['keys'](_0x54a6c9[_0xd070('0x3a')]);_0x5a7e05[_0xd070('0x3b')]=_[_0xd070('0x3c')](_0x5a7e05['model'],_0x5a7e05[_0xd070('0x3a')]);_0x8aff0e['attributes']=_['intersection'](_0x5a7e05[_0xd070('0x39')],qs[_0xd070('0x3d')](_0x54a6c9['query'][_0xd070('0x3d')]));_0x8aff0e['attributes']=_0x8aff0e[_0xd070('0x3e')]['length']?_0x8aff0e['attributes']:_0x5a7e05[_0xd070('0x39')];if(!_0x54a6c9[_0xd070('0x3a')][_0xd070('0x3f')](_0xd070('0x40'))){_0x8aff0e[_0xd070('0x41')]=qs['limit'](_0x54a6c9[_0xd070('0x3a')]['limit']);_0x8aff0e[_0xd070('0x29')]=qs[_0xd070('0x29')](_0x54a6c9[_0xd070('0x3a')][_0xd070('0x29')]);}_0x8aff0e[_0xd070('0x42')]=qs[_0xd070('0x43')](_0x54a6c9[_0xd070('0x3a')][_0xd070('0x43')]);_0x8aff0e[_0xd070('0x44')]=qs['filters'](_[_0xd070('0x45')](_0x54a6c9[_0xd070('0x3a')],_0x5a7e05['filters']),_0x32e491);if(_0x54a6c9[_0xd070('0x3a')][_0xd070('0x46')]){_0x8aff0e['where']=_['merge'](_0x8aff0e['where'],{'$or':_[_0xd070('0x35')](_0x32e491,function(_0x1781d0){if(_0x1781d0['type']!==_0xd070('0x47')){var _0x4229c3={};_0x4229c3[_0x1781d0[_0xd070('0x33')]]={'$like':'%'+_0x54a6c9[_0xd070('0x3a')][_0xd070('0x46')]+'%'};return _0x4229c3;}})});}_0x8aff0e=_[_0xd070('0x48')]({},_0x8aff0e,_0x54a6c9['options']);var _0x26cd91={'where':_0x8aff0e[_0xd070('0x44')]};return db[_0xd070('0x36')][_0xd070('0x28')](_0x26cd91)[_0xd070('0x1a')](function(_0x45af89){_0x15ba93[_0xd070('0x28')]=_0x45af89;if(_0x54a6c9[_0xd070('0x3a')][_0xd070('0x49')]){_0x8aff0e['include']=[{'all':!![]}];}return db[_0xd070('0x36')][_0xd070('0x4a')](_0x8aff0e);})[_0xd070('0x1a')](function(_0x496e0f){_0x15ba93['rows']=_0x496e0f;return _0x15ba93;})[_0xd070('0x1a')](respondWithFilteredResult(_0x4e3dca,_0x8aff0e))[_0xd070('0x24')](handleError(_0x4e3dca,null));};exports[_0xd070('0x4b')]=function(_0x1edf18,_0x5485ee){var _0x357f9d={'raw':![],'where':{'id':_0x1edf18[_0xd070('0x4c')]['id']}},_0x20a8af={};_0x20a8af[_0xd070('0x39')]=_[_0xd070('0x4d')](db[_0xd070('0x36')][_0xd070('0x37')]);_0x20a8af['query']=_['keys'](_0x1edf18[_0xd070('0x3a')]);_0x20a8af[_0xd070('0x3b')]=_['intersection'](_0x20a8af['model'],_0x20a8af[_0xd070('0x3a')]);_0x357f9d['attributes']=_[_0xd070('0x3c')](_0x20a8af[_0xd070('0x39')],qs['fields'](_0x1edf18['query'][_0xd070('0x3d')]));_0x357f9d['attributes']=_0x357f9d['attributes'][_0xd070('0x4e')]?_0x357f9d[_0xd070('0x3e')]:_0x20a8af[_0xd070('0x39')];if(_0x1edf18['query'][_0xd070('0x49')]){_0x357f9d['include']=[{'all':!![]}];}_0x357f9d=_['merge']({},_0x357f9d,_0x1edf18['options']);return db[_0xd070('0x36')][_0xd070('0x4f')](_0x357f9d)['then'](handleEntityNotFound(_0x5485ee,null))['then'](respondWithResult(_0x5485ee,null))[_0xd070('0x24')](handleError(_0x5485ee,null));};exports['create']=function(_0xb09aee,_0x1980a4){return db[_0xd070('0x36')][_0xd070('0x50')](_0xb09aee['body'],{})[_0xd070('0x1a')](respondWithResult(_0x1980a4,0xc9))[_0xd070('0x24')](handleError(_0x1980a4,null));};exports[_0xd070('0x30')]=function(_0x14a64e,_0x104fa5){if(_0x14a64e['body']['id']){delete _0x14a64e[_0xd070('0x51')]['id'];}return db['ZohoConfiguration']['find']({'where':{'id':_0x14a64e['params']['id']}})[_0xd070('0x1a')](handleEntityNotFound(_0x104fa5,null))[_0xd070('0x1a')](saveUpdates(_0x14a64e['body'],null))[_0xd070('0x1a')](respondWithResult(_0x104fa5,null))[_0xd070('0x24')](handleError(_0x104fa5,null));};exports[_0xd070('0x31')]=function(_0x34129c,_0x4f1bae){return db[_0xd070('0x36')][_0xd070('0x4f')]({'where':{'id':_0x34129c['params']['id']}})[_0xd070('0x1a')](handleEntityNotFound(_0x4f1bae,null))[_0xd070('0x1a')](removeEntity(_0x4f1bae,null))[_0xd070('0x24')](handleError(_0x4f1bae,null));};exports['getFields']=function(_0x81f903,_0x5df99b,_0x57dc53){var _0x54f95e={};var _0x29b8ab={};var _0x3393cb;var _0x92b543;return db['ZohoConfiguration'][_0xd070('0x52')]({'where':{'id':_0x81f903['params']['id']}})[_0xd070('0x1a')](handleEntityNotFound(_0x5df99b,null))[_0xd070('0x1a')](function(_0x41e393){if(_0x41e393){_0x3393cb=_0x41e393;_0x29b8ab[_0xd070('0x39')]=_[_0xd070('0x4d')](db[_0xd070('0x53')][_0xd070('0x37')]);_0x29b8ab[_0xd070('0x3a')]=_[_0xd070('0x4d')](_0x81f903[_0xd070('0x3a')]);_0x29b8ab[_0xd070('0x3b')]=_[_0xd070('0x3c')](_0x29b8ab[_0xd070('0x39')],_0x29b8ab[_0xd070('0x3a')]);_0x54f95e[_0xd070('0x3e')]=_[_0xd070('0x3c')](_0x29b8ab[_0xd070('0x39')],qs[_0xd070('0x3d')](_0x81f903['query'][_0xd070('0x3d')]));_0x54f95e['attributes']=_0x54f95e[_0xd070('0x3e')][_0xd070('0x4e')]?_0x54f95e['attributes']:_0x29b8ab[_0xd070('0x39')];_0x54f95e[_0xd070('0x42')]=qs[_0xd070('0x43')](_0x81f903[_0xd070('0x3a')][_0xd070('0x43')]);_0x54f95e[_0xd070('0x44')]=qs[_0xd070('0x3b')](_[_0xd070('0x45')](_0x81f903['query'],_0x29b8ab[_0xd070('0x3b')]));if(_0x81f903[_0xd070('0x3a')][_0xd070('0x46')]){_0x54f95e['where']=_[_0xd070('0x48')](_0x54f95e[_0xd070('0x44')],{'$or':_[_0xd070('0x35')](_0x54f95e[_0xd070('0x3e')],function(_0xe0626){var _0x447076={};_0x447076[_0xe0626]={'$like':'%'+_0x81f903[_0xd070('0x3a')][_0xd070('0x46')]+'%'};return _0x447076;})});}_0x54f95e=_['merge']({},_0x54f95e,_0x81f903[_0xd070('0x54')]);return _0x3393cb[_0xd070('0x55')](_0x54f95e);}})['then'](function(_0x19c53a){if(_0x19c53a){_0x92b543=_0x19c53a[_0xd070('0x4e')];if(!_0x81f903['query']['hasOwnProperty'](_0xd070('0x40'))){_0x54f95e[_0xd070('0x41')]=qs[_0xd070('0x41')](_0x81f903[_0xd070('0x3a')][_0xd070('0x41')]);_0x54f95e[_0xd070('0x29')]=qs['offset'](_0x81f903['query']['offset']);}return _0x3393cb['getFields'](_0x54f95e);}})[_0xd070('0x1a')](function(_0x53ec9d){if(_0x53ec9d){return _0x53ec9d?{'count':_0x92b543,'rows':_0x53ec9d}:null;}})[_0xd070('0x1a')](respondWithResult(_0x5df99b,null))[_0xd070('0x24')](handleError(_0x5df99b,null));};exports[_0xd070('0x56')]=function(_0x276d1b,_0x4cdc8c,_0x10cf3a){var _0x42aed7={};var _0x5cf8aa={};var _0x347934;var _0x9727a0;return db[_0xd070('0x36')][_0xd070('0x52')]({'where':{'id':_0x276d1b[_0xd070('0x4c')]['id']}})['then'](handleEntityNotFound(_0x4cdc8c,null))[_0xd070('0x1a')](function(_0x3cc789){if(_0x3cc789){_0x347934=_0x3cc789;_0x5cf8aa[_0xd070('0x39')]=_['keys'](db[_0xd070('0x53')][_0xd070('0x37')]);_0x5cf8aa['query']=_[_0xd070('0x4d')](_0x276d1b[_0xd070('0x3a')]);_0x5cf8aa['filters']=_[_0xd070('0x3c')](_0x5cf8aa[_0xd070('0x39')],_0x5cf8aa[_0xd070('0x3a')]);_0x42aed7[_0xd070('0x3e')]=_[_0xd070('0x3c')](_0x5cf8aa[_0xd070('0x39')],qs[_0xd070('0x3d')](_0x276d1b['query']['fields']));_0x42aed7[_0xd070('0x3e')]=_0x42aed7[_0xd070('0x3e')][_0xd070('0x4e')]?_0x42aed7[_0xd070('0x3e')]:_0x5cf8aa[_0xd070('0x39')];_0x42aed7[_0xd070('0x42')]=qs[_0xd070('0x43')](_0x276d1b['query']['sort']);_0x42aed7[_0xd070('0x44')]=qs[_0xd070('0x3b')](_['pick'](_0x276d1b[_0xd070('0x3a')],_0x5cf8aa[_0xd070('0x3b')]));if(_0x276d1b[_0xd070('0x3a')]['filter']){_0x42aed7[_0xd070('0x44')]=_['merge'](_0x42aed7[_0xd070('0x44')],{'$or':_[_0xd070('0x35')](_0x42aed7[_0xd070('0x3e')],function(_0x2253c0){var _0x371286={};_0x371286[_0x2253c0]={'$like':'%'+_0x276d1b[_0xd070('0x3a')]['filter']+'%'};return _0x371286;})});}_0x42aed7=_[_0xd070('0x48')]({},_0x42aed7,_0x276d1b['options']);return _0x347934[_0xd070('0x56')](_0x42aed7);}})[_0xd070('0x1a')](function(_0x25d1e4){if(_0x25d1e4){_0x9727a0=_0x25d1e4[_0xd070('0x4e')];if(!_0x276d1b[_0xd070('0x3a')][_0xd070('0x3f')]('nolimit')){_0x42aed7[_0xd070('0x41')]=qs[_0xd070('0x41')](_0x276d1b[_0xd070('0x3a')][_0xd070('0x41')]);_0x42aed7['offset']=qs[_0xd070('0x29')](_0x276d1b[_0xd070('0x3a')][_0xd070('0x29')]);}return _0x347934[_0xd070('0x56')](_0x42aed7);}})[_0xd070('0x1a')](function(_0x1a216a){if(_0x1a216a){return _0x1a216a?{'count':_0x9727a0,'rows':_0x1a216a}:null;}})[_0xd070('0x1a')](respondWithResult(_0x4cdc8c,null))[_0xd070('0x24')](handleError(_0x4cdc8c,null));};exports[_0xd070('0x57')]=function(_0x4f84b8,_0x66b793,_0x1b4b69){var _0x35b9f2={};var _0x2663d8={};var _0x291749;var _0x47497b;return db['ZohoConfiguration'][_0xd070('0x52')]({'where':{'id':_0x4f84b8['params']['id']}})['then'](handleEntityNotFound(_0x66b793,null))['then'](function(_0x241d81){if(_0x241d81){_0x291749=_0x241d81;_0x2663d8[_0xd070('0x39')]=_[_0xd070('0x4d')](db[_0xd070('0x53')][_0xd070('0x37')]);_0x2663d8['query']=_[_0xd070('0x4d')](_0x4f84b8[_0xd070('0x3a')]);_0x2663d8[_0xd070('0x3b')]=_[_0xd070('0x3c')](_0x2663d8['model'],_0x2663d8[_0xd070('0x3a')]);_0x35b9f2[_0xd070('0x3e')]=_[_0xd070('0x3c')](_0x2663d8[_0xd070('0x39')],qs[_0xd070('0x3d')](_0x4f84b8[_0xd070('0x3a')][_0xd070('0x3d')]));_0x35b9f2[_0xd070('0x3e')]=_0x35b9f2[_0xd070('0x3e')]['length']?_0x35b9f2[_0xd070('0x3e')]:_0x2663d8[_0xd070('0x39')];_0x35b9f2['order']=qs[_0xd070('0x43')](_0x4f84b8[_0xd070('0x3a')][_0xd070('0x43')]);_0x35b9f2[_0xd070('0x44')]=qs[_0xd070('0x3b')](_[_0xd070('0x45')](_0x4f84b8[_0xd070('0x3a')],_0x2663d8[_0xd070('0x3b')]));if(_0x4f84b8[_0xd070('0x3a')][_0xd070('0x46')]){_0x35b9f2[_0xd070('0x44')]=_['merge'](_0x35b9f2['where'],{'$or':_[_0xd070('0x35')](_0x35b9f2[_0xd070('0x3e')],function(_0x4910c6){var _0x14ac0e={};_0x14ac0e[_0x4910c6]={'$like':'%'+_0x4f84b8['query'][_0xd070('0x46')]+'%'};return _0x14ac0e;})});}_0x35b9f2=_[_0xd070('0x48')]({},_0x35b9f2,_0x4f84b8[_0xd070('0x54')]);return _0x291749[_0xd070('0x57')](_0x35b9f2);}})[_0xd070('0x1a')](function(_0x2d59eb){if(_0x2d59eb){_0x47497b=_0x2d59eb[_0xd070('0x4e')];if(!_0x4f84b8[_0xd070('0x3a')][_0xd070('0x3f')](_0xd070('0x40'))){_0x35b9f2['limit']=qs['limit'](_0x4f84b8['query'][_0xd070('0x41')]);_0x35b9f2[_0xd070('0x29')]=qs[_0xd070('0x29')](_0x4f84b8[_0xd070('0x3a')]['offset']);}return _0x291749['getDescriptions'](_0x35b9f2);}})[_0xd070('0x1a')](function(_0x7f3950){if(_0x7f3950){return _0x7f3950?{'count':_0x47497b,'rows':_0x7f3950}:null;}})[_0xd070('0x1a')](respondWithResult(_0x66b793,null))['catch'](handleError(_0x66b793,null));}; \ No newline at end of file +var _0xc666=['apply','reject','save','update','destroy','sendStatus','name','send','index','ZohoConfiguration','rawAttributes','fieldName','type','key','map','query','filters','intersection','model','fields','attributes','limit','sort','where','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','params','keys','find','create','body','getFields','findOne','ZohoField','order','pick','length','hasOwnProperty','nolimit','getSubjects','getDescriptions','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','squel','crypto','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../mysqldb','jayson/promise','client','test','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','info','request\x20sent','debug','stringify','error','code','ZohoConfiguration,\x20%s,\x20%s','message','result','catch','status','end','json','count','offset'];(function(_0x232ec4,_0x59ec26){var _0x1c14a0=function(_0x254f63){while(--_0x254f63){_0x232ec4['push'](_0x232ec4['shift']());}};_0x1c14a0(++_0x59ec26);}(_0xc666,0xe8));var _0x6c66=function(_0x2d5459,_0x4448f8){_0x2d5459=_0x2d5459-0x0;var _0x3129d3=_0xc666[_0x2d5459];return _0x3129d3;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x6c66('0x0'));var rimraf=require(_0x6c66('0x1'));var zipdir=require(_0x6c66('0x2'));var jsonpatch=require(_0x6c66('0x3'));var rp=require(_0x6c66('0x4'));var moment=require(_0x6c66('0x5'));var BPromise=require(_0x6c66('0x6'));var Mustache=require(_0x6c66('0x7'));var util=require(_0x6c66('0x8'));var path=require(_0x6c66('0x9'));var sox=require(_0x6c66('0xa'));var csv=require('to-csv');var ejs=require(_0x6c66('0xb'));var fs=require('fs');var _=require('lodash');var squel=require(_0x6c66('0xc'));var crypto=require(_0x6c66('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x6c66('0xe'));var Papa=require(_0x6c66('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x6c66('0x10'));var as=require(_0x6c66('0x11'));var hardwareService=require(_0x6c66('0x12'));var logger=require('../../config/logger')('api');var utils=require(_0x6c66('0x13'));var config=require(_0x6c66('0x14'));var db=require(_0x6c66('0x15'))['db'];var jayson=require(_0x6c66('0x16'));var client=jayson[_0x6c66('0x17')]['http']({'port':0x232a});function checkPasswordPattern(_0x4d8109,_0x4db968,_0x5b1f8e){if(_0x5b1f8e){var _0x4c2293=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x4c2293[_0x6c66('0x18')](_0x4db968)){return _0x4d8109;}else{throw new db['Sequelize'][(_0x6c66('0x19'))](_0x6c66('0x1a'));}}else{return _0x4d8109;}}function respondWithRpcPromise(_0x440939,_0x5b22a4,_0x5dc63e,_0x5e9d12){return new BPromise(function(_0x234441,_0x1ac5c5){var _0x1fddbe=_0x5e9d12||client;return _0x1fddbe[_0x6c66('0x1b')](_0x440939,_0x5dc63e)[_0x6c66('0x1c')](function(_0x452627){logger[_0x6c66('0x1d')]('ZohoConfiguration,\x20%s,\x20%s',_0x5b22a4,_0x6c66('0x1e'));logger[_0x6c66('0x1f')]('ZohoConfiguration,\x20%s,\x20%s,\x20%s',_0x5b22a4,'request\x20sent',JSON[_0x6c66('0x20')](_0x452627));if(_0x452627[_0x6c66('0x21')]){if(_0x452627[_0x6c66('0x21')][_0x6c66('0x22')]===0x1f4){logger[_0x6c66('0x21')](_0x6c66('0x23'),_0x5b22a4,_0x452627[_0x6c66('0x21')][_0x6c66('0x24')]);return _0x1ac5c5(_0x452627[_0x6c66('0x21')][_0x6c66('0x24')]);}logger[_0x6c66('0x21')](_0x6c66('0x23'),_0x5b22a4,_0x452627[_0x6c66('0x21')]['message']);return _0x234441(_0x452627[_0x6c66('0x21')]['message']);}else{logger[_0x6c66('0x1d')](_0x6c66('0x23'),_0x5b22a4,'request\x20sent');_0x234441(_0x452627[_0x6c66('0x25')]['message']);}})[_0x6c66('0x26')](function(_0x29d596){logger[_0x6c66('0x21')](_0x6c66('0x23'),_0x5b22a4,_0x29d596);_0x1ac5c5(_0x29d596);});});}function respondWithStatusCode(_0x50b639,_0x22f39e){_0x22f39e=_0x22f39e||0xcc;return function(_0x565460){if(_0x565460){return _0x50b639['sendStatus'](_0x22f39e);}return _0x50b639[_0x6c66('0x27')](_0x22f39e)[_0x6c66('0x28')]();};}function respondWithResult(_0x51d544,_0xf52455){_0xf52455=_0xf52455||0xc8;return function(_0xcac241){if(_0xcac241){return _0x51d544[_0x6c66('0x27')](_0xf52455)[_0x6c66('0x29')](_0xcac241);}};}function respondWithFilteredResult(_0x33618c,_0x19b24a){return function(_0x5adc42){if(_0x5adc42){var _0xc4f3ea=_0x5adc42[_0x6c66('0x2a')],_0x21c6a5=_0x19b24a['offset'],_0x3054e8=_0x19b24a[_0x6c66('0x2b')]+_0x19b24a['limit'],_0x533f4f;if(_0x3054e8>=_0xc4f3ea){_0x3054e8=_0xc4f3ea;_0x533f4f=0xc8;}else{_0x533f4f=0xce;}_0x33618c[_0x6c66('0x27')](_0x533f4f);return _0x33618c['set']('Content-Range',_0x21c6a5+'-'+_0x3054e8+'/'+_0xc4f3ea)['json'](_0x5adc42);}return null;};}function patchUpdates(_0xc766da){return function(_0xef4f0d){try{jsonpatch[_0x6c66('0x2c')](_0xef4f0d,_0xc766da,!![]);}catch(_0x5438fe){return BPromise[_0x6c66('0x2d')](_0x5438fe);}return _0xef4f0d[_0x6c66('0x2e')]();};}function saveUpdates(_0x43ec69,_0x254faa){return function(_0x58f824){if(_0x58f824){return _0x58f824[_0x6c66('0x2f')](_0x43ec69)[_0x6c66('0x1c')](function(_0x3aa057){return _0x3aa057;});}return null;};}function removeEntity(_0x1e46e0,_0x3936db){return function(_0x749677){if(_0x749677){return _0x749677[_0x6c66('0x30')]()[_0x6c66('0x1c')](function(){_0x1e46e0[_0x6c66('0x27')](0xcc)['end']();});}};}function handleEntityNotFound(_0x48fda7,_0x15e84e){return function(_0xaccf5c){if(!_0xaccf5c){_0x48fda7[_0x6c66('0x31')](0x194);}return _0xaccf5c;};}function handleError(_0xdbf582,_0x22c705){_0x22c705=_0x22c705||0x1f4;return function(_0x40410e){logger[_0x6c66('0x21')](_0x40410e['stack']);if(_0x40410e['name']){delete _0x40410e[_0x6c66('0x32')];}_0xdbf582[_0x6c66('0x27')](_0x22c705)[_0x6c66('0x33')](_0x40410e);};}exports[_0x6c66('0x34')]=function(_0x2af61b,_0xc428c3){var _0x2ece7b={},_0x228968={},_0x1c46d0={'count':0x0,'rows':[]};var _0x9a15df=_['map'](db[_0x6c66('0x35')][_0x6c66('0x36')],function(_0x245052){return{'name':_0x245052[_0x6c66('0x37')],'type':_0x245052[_0x6c66('0x38')][_0x6c66('0x39')]};});_0x228968['model']=_[_0x6c66('0x3a')](_0x9a15df,_0x6c66('0x32'));_0x228968[_0x6c66('0x3b')]=_['keys'](_0x2af61b['query']);_0x228968[_0x6c66('0x3c')]=_['intersection'](_0x228968['model'],_0x228968[_0x6c66('0x3b')]);_0x2ece7b['attributes']=_[_0x6c66('0x3d')](_0x228968[_0x6c66('0x3e')],qs[_0x6c66('0x3f')](_0x2af61b[_0x6c66('0x3b')]['fields']));_0x2ece7b['attributes']=_0x2ece7b[_0x6c66('0x40')]['length']?_0x2ece7b[_0x6c66('0x40')]:_0x228968['model'];if(!_0x2af61b[_0x6c66('0x3b')]['hasOwnProperty']('nolimit')){_0x2ece7b[_0x6c66('0x41')]=qs['limit'](_0x2af61b['query'][_0x6c66('0x41')]);_0x2ece7b[_0x6c66('0x2b')]=qs[_0x6c66('0x2b')](_0x2af61b['query']['offset']);}_0x2ece7b['order']=qs[_0x6c66('0x42')](_0x2af61b[_0x6c66('0x3b')][_0x6c66('0x42')]);_0x2ece7b[_0x6c66('0x43')]=qs['filters'](_['pick'](_0x2af61b['query'],_0x228968[_0x6c66('0x3c')]),_0x9a15df);if(_0x2af61b[_0x6c66('0x3b')][_0x6c66('0x44')]){_0x2ece7b[_0x6c66('0x43')]=_[_0x6c66('0x45')](_0x2ece7b[_0x6c66('0x43')],{'$or':_[_0x6c66('0x3a')](_0x9a15df,function(_0x285cd2){if(_0x285cd2['type']!==_0x6c66('0x46')){var _0x1b468c={};_0x1b468c[_0x285cd2[_0x6c66('0x32')]]={'$like':'%'+_0x2af61b[_0x6c66('0x3b')]['filter']+'%'};return _0x1b468c;}})});}_0x2ece7b=_[_0x6c66('0x45')]({},_0x2ece7b,_0x2af61b[_0x6c66('0x47')]);var _0x2c0c72={'where':_0x2ece7b[_0x6c66('0x43')]};return db[_0x6c66('0x35')]['count'](_0x2c0c72)[_0x6c66('0x1c')](function(_0x39a619){_0x1c46d0[_0x6c66('0x2a')]=_0x39a619;if(_0x2af61b[_0x6c66('0x3b')][_0x6c66('0x48')]){_0x2ece7b[_0x6c66('0x49')]=[{'all':!![]}];}return db[_0x6c66('0x35')][_0x6c66('0x4a')](_0x2ece7b);})[_0x6c66('0x1c')](function(_0x326e63){_0x1c46d0[_0x6c66('0x4b')]=_0x326e63;return _0x1c46d0;})[_0x6c66('0x1c')](respondWithFilteredResult(_0xc428c3,_0x2ece7b))[_0x6c66('0x26')](handleError(_0xc428c3,null));};exports[_0x6c66('0x4c')]=function(_0x34c899,_0x1e340b){var _0x543e34={'raw':![],'where':{'id':_0x34c899[_0x6c66('0x4d')]['id']}},_0x56e363={};_0x56e363['model']=_[_0x6c66('0x4e')](db[_0x6c66('0x35')][_0x6c66('0x36')]);_0x56e363[_0x6c66('0x3b')]=_[_0x6c66('0x4e')](_0x34c899['query']);_0x56e363[_0x6c66('0x3c')]=_['intersection'](_0x56e363[_0x6c66('0x3e')],_0x56e363['query']);_0x543e34[_0x6c66('0x40')]=_[_0x6c66('0x3d')](_0x56e363['model'],qs[_0x6c66('0x3f')](_0x34c899[_0x6c66('0x3b')][_0x6c66('0x3f')]));_0x543e34['attributes']=_0x543e34[_0x6c66('0x40')]['length']?_0x543e34[_0x6c66('0x40')]:_0x56e363[_0x6c66('0x3e')];if(_0x34c899[_0x6c66('0x3b')][_0x6c66('0x48')]){_0x543e34['include']=[{'all':!![]}];}_0x543e34=_[_0x6c66('0x45')]({},_0x543e34,_0x34c899[_0x6c66('0x47')]);return db[_0x6c66('0x35')][_0x6c66('0x4f')](_0x543e34)[_0x6c66('0x1c')](handleEntityNotFound(_0x1e340b,null))[_0x6c66('0x1c')](respondWithResult(_0x1e340b,null))[_0x6c66('0x26')](handleError(_0x1e340b,null));};exports['create']=function(_0x1b4c85,_0x469ccb){return db[_0x6c66('0x35')][_0x6c66('0x50')](_0x1b4c85[_0x6c66('0x51')],{})['then'](respondWithResult(_0x469ccb,0xc9))[_0x6c66('0x26')](handleError(_0x469ccb,null));};exports[_0x6c66('0x2f')]=function(_0x13aae7,_0x2a84d6){if(_0x13aae7['body']['id']){delete _0x13aae7[_0x6c66('0x51')]['id'];}return db[_0x6c66('0x35')][_0x6c66('0x4f')]({'where':{'id':_0x13aae7['params']['id']}})[_0x6c66('0x1c')](handleEntityNotFound(_0x2a84d6,null))[_0x6c66('0x1c')](saveUpdates(_0x13aae7['body'],null))[_0x6c66('0x1c')](respondWithResult(_0x2a84d6,null))[_0x6c66('0x26')](handleError(_0x2a84d6,null));};exports['destroy']=function(_0x5c50c3,_0xd6a30a){return db[_0x6c66('0x35')]['find']({'where':{'id':_0x5c50c3[_0x6c66('0x4d')]['id']}})['then'](handleEntityNotFound(_0xd6a30a,null))[_0x6c66('0x1c')](removeEntity(_0xd6a30a,null))[_0x6c66('0x26')](handleError(_0xd6a30a,null));};exports[_0x6c66('0x52')]=function(_0x1961f8,_0x373129,_0x214aab){var _0x7a311a={};var _0x5b0900={};var _0x3c1ea2;var _0x1f5c42;return db[_0x6c66('0x35')][_0x6c66('0x53')]({'where':{'id':_0x1961f8[_0x6c66('0x4d')]['id']}})[_0x6c66('0x1c')](handleEntityNotFound(_0x373129,null))['then'](function(_0x23955e){if(_0x23955e){_0x3c1ea2=_0x23955e;_0x5b0900[_0x6c66('0x3e')]=_[_0x6c66('0x4e')](db[_0x6c66('0x54')][_0x6c66('0x36')]);_0x5b0900[_0x6c66('0x3b')]=_[_0x6c66('0x4e')](_0x1961f8[_0x6c66('0x3b')]);_0x5b0900[_0x6c66('0x3c')]=_['intersection'](_0x5b0900[_0x6c66('0x3e')],_0x5b0900[_0x6c66('0x3b')]);_0x7a311a[_0x6c66('0x40')]=_[_0x6c66('0x3d')](_0x5b0900[_0x6c66('0x3e')],qs[_0x6c66('0x3f')](_0x1961f8['query'][_0x6c66('0x3f')]));_0x7a311a[_0x6c66('0x40')]=_0x7a311a['attributes']['length']?_0x7a311a[_0x6c66('0x40')]:_0x5b0900['model'];_0x7a311a[_0x6c66('0x55')]=qs[_0x6c66('0x42')](_0x1961f8['query'][_0x6c66('0x42')]);_0x7a311a[_0x6c66('0x43')]=qs[_0x6c66('0x3c')](_[_0x6c66('0x56')](_0x1961f8[_0x6c66('0x3b')],_0x5b0900['filters']));if(_0x1961f8[_0x6c66('0x3b')][_0x6c66('0x44')]){_0x7a311a[_0x6c66('0x43')]=_[_0x6c66('0x45')](_0x7a311a[_0x6c66('0x43')],{'$or':_[_0x6c66('0x3a')](_0x7a311a[_0x6c66('0x40')],function(_0x4bb3ba){var _0x5b1574={};_0x5b1574[_0x4bb3ba]={'$like':'%'+_0x1961f8[_0x6c66('0x3b')][_0x6c66('0x44')]+'%'};return _0x5b1574;})});}_0x7a311a=_[_0x6c66('0x45')]({},_0x7a311a,_0x1961f8[_0x6c66('0x47')]);return _0x3c1ea2[_0x6c66('0x52')](_0x7a311a);}})[_0x6c66('0x1c')](function(_0x16630e){if(_0x16630e){_0x1f5c42=_0x16630e[_0x6c66('0x57')];if(!_0x1961f8['query'][_0x6c66('0x58')](_0x6c66('0x59'))){_0x7a311a[_0x6c66('0x41')]=qs[_0x6c66('0x41')](_0x1961f8[_0x6c66('0x3b')]['limit']);_0x7a311a[_0x6c66('0x2b')]=qs[_0x6c66('0x2b')](_0x1961f8[_0x6c66('0x3b')][_0x6c66('0x2b')]);}return _0x3c1ea2['getFields'](_0x7a311a);}})['then'](function(_0x1c8ac8){if(_0x1c8ac8){return _0x1c8ac8?{'count':_0x1f5c42,'rows':_0x1c8ac8}:null;}})[_0x6c66('0x1c')](respondWithResult(_0x373129,null))[_0x6c66('0x26')](handleError(_0x373129,null));};exports[_0x6c66('0x5a')]=function(_0x4b7547,_0x212145,_0x3fa13c){var _0x179ca3={};var _0x5d7db8={};var _0x364879;var _0x1ef746;return db[_0x6c66('0x35')][_0x6c66('0x53')]({'where':{'id':_0x4b7547[_0x6c66('0x4d')]['id']}})[_0x6c66('0x1c')](handleEntityNotFound(_0x212145,null))['then'](function(_0x105b1c){if(_0x105b1c){_0x364879=_0x105b1c;_0x5d7db8['model']=_[_0x6c66('0x4e')](db[_0x6c66('0x54')][_0x6c66('0x36')]);_0x5d7db8[_0x6c66('0x3b')]=_[_0x6c66('0x4e')](_0x4b7547['query']);_0x5d7db8[_0x6c66('0x3c')]=_[_0x6c66('0x3d')](_0x5d7db8[_0x6c66('0x3e')],_0x5d7db8[_0x6c66('0x3b')]);_0x179ca3[_0x6c66('0x40')]=_[_0x6c66('0x3d')](_0x5d7db8['model'],qs[_0x6c66('0x3f')](_0x4b7547[_0x6c66('0x3b')][_0x6c66('0x3f')]));_0x179ca3[_0x6c66('0x40')]=_0x179ca3['attributes']['length']?_0x179ca3[_0x6c66('0x40')]:_0x5d7db8[_0x6c66('0x3e')];_0x179ca3[_0x6c66('0x55')]=qs[_0x6c66('0x42')](_0x4b7547[_0x6c66('0x3b')]['sort']);_0x179ca3[_0x6c66('0x43')]=qs[_0x6c66('0x3c')](_['pick'](_0x4b7547['query'],_0x5d7db8['filters']));if(_0x4b7547['query']['filter']){_0x179ca3['where']=_[_0x6c66('0x45')](_0x179ca3[_0x6c66('0x43')],{'$or':_[_0x6c66('0x3a')](_0x179ca3[_0x6c66('0x40')],function(_0x820b8e){var _0x33ab00={};_0x33ab00[_0x820b8e]={'$like':'%'+_0x4b7547[_0x6c66('0x3b')][_0x6c66('0x44')]+'%'};return _0x33ab00;})});}_0x179ca3=_[_0x6c66('0x45')]({},_0x179ca3,_0x4b7547[_0x6c66('0x47')]);return _0x364879['getSubjects'](_0x179ca3);}})[_0x6c66('0x1c')](function(_0x34cef7){if(_0x34cef7){_0x1ef746=_0x34cef7[_0x6c66('0x57')];if(!_0x4b7547[_0x6c66('0x3b')][_0x6c66('0x58')](_0x6c66('0x59'))){_0x179ca3[_0x6c66('0x41')]=qs[_0x6c66('0x41')](_0x4b7547['query'][_0x6c66('0x41')]);_0x179ca3[_0x6c66('0x2b')]=qs[_0x6c66('0x2b')](_0x4b7547[_0x6c66('0x3b')][_0x6c66('0x2b')]);}return _0x364879['getSubjects'](_0x179ca3);}})[_0x6c66('0x1c')](function(_0x1cb763){if(_0x1cb763){return _0x1cb763?{'count':_0x1ef746,'rows':_0x1cb763}:null;}})[_0x6c66('0x1c')](respondWithResult(_0x212145,null))[_0x6c66('0x26')](handleError(_0x212145,null));};exports[_0x6c66('0x5b')]=function(_0x44df18,_0x57da65,_0x1022ab){var _0x531c95={};var _0x37bbf7={};var _0x447ba2;var _0x34acaf;return db[_0x6c66('0x35')][_0x6c66('0x53')]({'where':{'id':_0x44df18[_0x6c66('0x4d')]['id']}})[_0x6c66('0x1c')](handleEntityNotFound(_0x57da65,null))[_0x6c66('0x1c')](function(_0xda33de){if(_0xda33de){_0x447ba2=_0xda33de;_0x37bbf7['model']=_['keys'](db[_0x6c66('0x54')][_0x6c66('0x36')]);_0x37bbf7[_0x6c66('0x3b')]=_[_0x6c66('0x4e')](_0x44df18['query']);_0x37bbf7[_0x6c66('0x3c')]=_[_0x6c66('0x3d')](_0x37bbf7[_0x6c66('0x3e')],_0x37bbf7[_0x6c66('0x3b')]);_0x531c95['attributes']=_['intersection'](_0x37bbf7[_0x6c66('0x3e')],qs[_0x6c66('0x3f')](_0x44df18[_0x6c66('0x3b')][_0x6c66('0x3f')]));_0x531c95['attributes']=_0x531c95[_0x6c66('0x40')][_0x6c66('0x57')]?_0x531c95[_0x6c66('0x40')]:_0x37bbf7[_0x6c66('0x3e')];_0x531c95[_0x6c66('0x55')]=qs['sort'](_0x44df18[_0x6c66('0x3b')][_0x6c66('0x42')]);_0x531c95[_0x6c66('0x43')]=qs['filters'](_['pick'](_0x44df18[_0x6c66('0x3b')],_0x37bbf7[_0x6c66('0x3c')]));if(_0x44df18[_0x6c66('0x3b')][_0x6c66('0x44')]){_0x531c95[_0x6c66('0x43')]=_[_0x6c66('0x45')](_0x531c95[_0x6c66('0x43')],{'$or':_['map'](_0x531c95[_0x6c66('0x40')],function(_0x9f5d4d){var _0x260355={};_0x260355[_0x9f5d4d]={'$like':'%'+_0x44df18[_0x6c66('0x3b')]['filter']+'%'};return _0x260355;})});}_0x531c95=_[_0x6c66('0x45')]({},_0x531c95,_0x44df18[_0x6c66('0x47')]);return _0x447ba2['getDescriptions'](_0x531c95);}})[_0x6c66('0x1c')](function(_0x3ad678){if(_0x3ad678){_0x34acaf=_0x3ad678[_0x6c66('0x57')];if(!_0x44df18['query'][_0x6c66('0x58')](_0x6c66('0x59'))){_0x531c95[_0x6c66('0x41')]=qs[_0x6c66('0x41')](_0x44df18[_0x6c66('0x3b')][_0x6c66('0x41')]);_0x531c95[_0x6c66('0x2b')]=qs[_0x6c66('0x2b')](_0x44df18[_0x6c66('0x3b')][_0x6c66('0x2b')]);}return _0x447ba2['getDescriptions'](_0x531c95);}})[_0x6c66('0x1c')](function(_0x467c73){if(_0x467c73){return _0x467c73?{'count':_0x34acaf,'rows':_0x467c73}:null;}})[_0x6c66('0x1c')](respondWithResult(_0x57da65,null))[_0x6c66('0x26')](handleError(_0x57da65,null));}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.model.js b/server/api/intZohoConfiguration/intZohoConfiguration.model.js index 3e2d5db..7c5dc5a 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 _0x497e=['path','../../config/environment','./intZohoConfiguration.attributes','exports','define','ZohoConfiguration','api','moment','request-promise'];(function(_0x41915c,_0x469bc1){var _0x382d19=function(_0x4d85a0){while(--_0x4d85a0){_0x41915c['push'](_0x41915c['shift']());}};_0x382d19(++_0x469bc1);}(_0x497e,0x1da));var _0xe497=function(_0x480cea,_0x2b3cd0){_0x480cea=_0x480cea-0x0;var _0x3e5cc9=_0x497e[_0x480cea];return _0x3e5cc9;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0xe497('0x0'));var moment=require(_0xe497('0x1'));var BPromise=require('bluebird');var rp=require(_0xe497('0x2'));var fs=require('fs');var path=require(_0xe497('0x3'));var rimraf=require('rimraf');var config=require(_0xe497('0x4'));var attributes=require(_0xe497('0x5'));module[_0xe497('0x6')]=function(_0x45421d,_0x35bf11){return _0x45421d[_0xe497('0x7')](_0xe497('0x8'),attributes,{'tableName':'int_zoho_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb28f=['../../config/environment','./intZohoConfiguration.attributes','define','ZohoConfiguration','int_zoho_configurations','lodash','util','../../config/logger','request-promise','path','rimraf'];(function(_0x54dc38,_0x493609){var _0xa45247=function(_0x493231){while(--_0x493231){_0x54dc38['push'](_0x54dc38['shift']());}};_0xa45247(++_0x493609);}(_0xb28f,0x10d));var _0xfb28=function(_0x3aaf0a,_0x450970){_0x3aaf0a=_0x3aaf0a-0x0;var _0x33e6bc=_0xb28f[_0x3aaf0a];return _0x33e6bc;};'use strict';var _=require(_0xfb28('0x0'));var util=require(_0xfb28('0x1'));var logger=require(_0xfb28('0x2'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xfb28('0x3'));var fs=require('fs');var path=require(_0xfb28('0x4'));var rimraf=require(_0xfb28('0x5'));var config=require(_0xfb28('0x6'));var attributes=require(_0xfb28('0x7'));module['exports']=function(_0x393f90,_0x2bb3ff){return _0x393f90[_0xfb28('0x8')](_0xfb28('0x9'),attributes,{'tableName':_0xfb28('0xa'),'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 217713a..c887c66 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 _0x2399=['moment','bluebird','randomstring','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','request','ZohoConfiguration,\x20%s,\x20%s','request\x20sent','debug','ZohoConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','lodash'];(function(_0x50c9cc,_0x21337c){var _0x49d2e7=function(_0x6487be){while(--_0x6487be){_0x50c9cc['push'](_0x50c9cc['shift']());}};_0x49d2e7(++_0x21337c);}(_0x2399,0x92));var _0x9239=function(_0x32088f,_0x538e0a){_0x32088f=_0x32088f-0x0;var _0x43abf1=_0x2399[_0x32088f];return _0x43abf1;};'use strict';var _=require(_0x9239('0x0'));var util=require('util');var moment=require(_0x9239('0x1'));var BPromise=require(_0x9239('0x2'));var rs=require(_0x9239('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x9239('0x4'));var logger=require(_0x9239('0x5'))('rpc');var config=require(_0x9239('0x6'));var jayson=require(_0x9239('0x7'));var client=jayson['client'][_0x9239('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x331228,_0x5a2c33,_0x44251a){return new BPromise(function(_0x1c7252,_0x4d8738){return client[_0x9239('0x9')](_0x331228,_0x44251a)['then'](function(_0xacfa34){logger['info'](_0x9239('0xa'),_0x5a2c33,_0x9239('0xb'));logger[_0x9239('0xc')](_0x9239('0xd'),_0x5a2c33,_0x9239('0xb'),JSON[_0x9239('0xe')](_0xacfa34));if(_0xacfa34[_0x9239('0xf')]){if(_0xacfa34['error'][_0x9239('0x10')]===0x1f4){logger[_0x9239('0xf')](_0x9239('0xa'),_0x5a2c33,_0xacfa34[_0x9239('0xf')][_0x9239('0x11')]);return _0x4d8738(_0xacfa34[_0x9239('0xf')][_0x9239('0x11')]);}logger[_0x9239('0xf')](_0x9239('0xa'),_0x5a2c33,_0xacfa34['error'][_0x9239('0x11')]);return _0x1c7252(_0xacfa34[_0x9239('0xf')][_0x9239('0x11')]);}else{logger[_0x9239('0x12')]('ZohoConfiguration,\x20%s,\x20%s',_0x5a2c33,_0x9239('0xb'));_0x1c7252(_0xacfa34[_0x9239('0x13')][_0x9239('0x11')]);}})[_0x9239('0x14')](function(_0x1baaa7){logger[_0x9239('0xf')]('ZohoConfiguration,\x20%s,\x20%s',_0x5a2c33,_0x1baaa7);_0x4d8738(_0x1baaa7);});});} \ No newline at end of file +var _0xf424=['ZohoConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','ZohoConfiguration,\x20%s,\x20%s','result','catch','lodash','util','moment','bluebird','ioredis','../../config/utils','../../config/logger','../../config/environment','client','http','request','then','info','request\x20sent','debug'];(function(_0x11d0bc,_0x17d093){var _0x2bf7d4=function(_0x2efaef){while(--_0x2efaef){_0x11d0bc['push'](_0x11d0bc['shift']());}};_0x2bf7d4(++_0x17d093);}(_0xf424,0x92));var _0x4f42=function(_0x488163,_0x51204f){_0x488163=_0x488163-0x0;var _0x1ba13b=_0xf424[_0x488163];return _0x1ba13b;};'use strict';var _=require(_0x4f42('0x0'));var util=require(_0x4f42('0x1'));var moment=require(_0x4f42('0x2'));var BPromise=require(_0x4f42('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x4f42('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x4f42('0x5'));var logger=require(_0x4f42('0x6'))('rpc');var config=require(_0x4f42('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x4f42('0x8')][_0x4f42('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x342138,_0x281107,_0xaa5089){return new BPromise(function(_0x3c5400,_0x54b1a7){return client[_0x4f42('0xa')](_0x342138,_0xaa5089)[_0x4f42('0xb')](function(_0x5421c6){logger[_0x4f42('0xc')]('ZohoConfiguration,\x20%s,\x20%s',_0x281107,_0x4f42('0xd'));logger[_0x4f42('0xe')](_0x4f42('0xf'),_0x281107,_0x4f42('0xd'),JSON[_0x4f42('0x10')](_0x5421c6));if(_0x5421c6[_0x4f42('0x11')]){if(_0x5421c6[_0x4f42('0x11')][_0x4f42('0x12')]===0x1f4){logger[_0x4f42('0x11')]('ZohoConfiguration,\x20%s,\x20%s',_0x281107,_0x5421c6[_0x4f42('0x11')][_0x4f42('0x13')]);return _0x54b1a7(_0x5421c6[_0x4f42('0x11')]['message']);}logger['error']('ZohoConfiguration,\x20%s,\x20%s',_0x281107,_0x5421c6[_0x4f42('0x11')][_0x4f42('0x13')]);return _0x3c5400(_0x5421c6[_0x4f42('0x11')][_0x4f42('0x13')]);}else{logger['info'](_0x4f42('0x14'),_0x281107,_0x4f42('0xd'));_0x3c5400(_0x5421c6[_0x4f42('0x15')][_0x4f42('0x13')]);}})[_0x4f42('0x16')](function(_0x1d6486){logger[_0x4f42('0x11')](_0x4f42('0x14'),_0x281107,_0x1d6486);_0x54b1a7(_0x1d6486);});});} \ No newline at end of file diff --git a/server/api/intZohoField/index.js b/server/api/intZohoField/index.js index 3978db8..d857d84 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 _0xf2e3=['show','post','create','put','update','delete','destroy','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZohoField.controller','get','index','/:id','isAuthenticated'];(function(_0x3cf3fd,_0x2d387d){var _0x27b83b=function(_0x1cc54b){while(--_0x1cc54b){_0x3cf3fd['push'](_0x3cf3fd['shift']());}};_0x27b83b(++_0x2d387d);}(_0xf2e3,0x9b));var _0x3f2e=function(_0x56916d,_0x37b935){_0x56916d=_0x56916d-0x0;var _0x2b7f1f=_0xf2e3[_0x56916d];return _0x2b7f1f;};'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('0xe')]('/',auth[_0x3f2e('0xc')](),controller[_0x3f2e('0xf')]);router[_0x3f2e('0x10')](_0x3f2e('0xb'),auth[_0x3f2e('0xc')](),controller[_0x3f2e('0x11')]);router[_0x3f2e('0x12')](_0x3f2e('0xb'),auth[_0x3f2e('0xc')](),controller[_0x3f2e('0x13')]);module[_0x3f2e('0x14')]=router; \ No newline at end of file +var _0x5b12=['index','isAuthenticated','show','post','create','put','/:id','delete','destroy','exports','multer','util','path','express','../../components/auth/service','../../components/interaction/service','./intZohoField.controller'];(function(_0x19f727,_0x28224e){var _0x412836=function(_0x40634f){while(--_0x40634f){_0x19f727['push'](_0x19f727['shift']());}};_0x412836(++_0x28224e);}(_0x5b12,0xa3));var _0x25b1=function(_0x194351,_0x8a1121){_0x194351=_0x194351-0x0;var _0x377821=_0x5b12[_0x194351];return _0x377821;};'use strict';var multer=require(_0x25b1('0x0'));var util=require(_0x25b1('0x1'));var path=require(_0x25b1('0x2'));var timeout=require('connect-timeout');var express=require(_0x25b1('0x3'));var router=express['Router']();var auth=require(_0x25b1('0x4'));var interaction=require(_0x25b1('0x5'));var config=require('../../config/environment');var controller=require(_0x25b1('0x6'));router['get']('/',auth['isAuthenticated'](),controller[_0x25b1('0x7')]);router['get']('/:id',auth[_0x25b1('0x8')](),controller[_0x25b1('0x9')]);router[_0x25b1('0xa')]('/',auth[_0x25b1('0x8')](),controller[_0x25b1('0xb')]);router[_0x25b1('0xc')](_0x25b1('0xd'),auth[_0x25b1('0x8')](),controller['update']);router[_0x25b1('0xe')](_0x25b1('0xd'),auth[_0x25b1('0x8')](),controller[_0x25b1('0xf')]);module[_0x25b1('0x10')]=router; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.attributes.js b/server/api/intZohoField/intZohoField.attributes.js index 13e4d86..13ebb36 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 _0x58f4=['STRING','BOOLEAN','exports','ENUM','string','variable','customVariable','keyValue'];(function(_0x2a1ab3,_0xe92f95){var _0x21b0fc=function(_0x1e3184){while(--_0x1e3184){_0x2a1ab3['push'](_0x2a1ab3['shift']());}};_0x21b0fc(++_0xe92f95);}(_0x58f4,0x1b2));var _0x458f=function(_0x24914d,_0x5c47e7){_0x24914d=_0x24914d-0x0;var _0x3f59da=_0x58f4[_0x24914d];return _0x3f59da;};'use strict';var Sequelize=require('sequelize');module[_0x458f('0x0')]={'type':{'type':Sequelize[_0x458f('0x1')](_0x458f('0x2'),_0x458f('0x3'),_0x458f('0x4'),_0x458f('0x5')),'defaultValue':_0x458f('0x2')},'content':{'type':Sequelize[_0x458f('0x6')]},'key':{'type':Sequelize[_0x458f('0x6')]},'keyType':{'type':Sequelize[_0x458f('0x1')](_0x458f('0x2'),_0x458f('0x3'),'customVariable')},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0x458f('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x458f('0x6')]}}; \ No newline at end of file +var _0xcabc=['customVariable','STRING','exports','ENUM','string','variable'];(function(_0x37f330,_0x30ef70){var _0x4fab68=function(_0x43b392){while(--_0x43b392){_0x37f330['push'](_0x37f330['shift']());}};_0x4fab68(++_0x30ef70);}(_0xcabc,0x16a));var _0xccab=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0xcabc[_0x42cae2];return _0x5f256f;};'use strict';var Sequelize=require('sequelize');module[_0xccab('0x0')]={'type':{'type':Sequelize[_0xccab('0x1')](_0xccab('0x2'),_0xccab('0x3'),_0xccab('0x4'),'keyValue'),'defaultValue':_0xccab('0x2')},'content':{'type':Sequelize[_0xccab('0x5')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0xccab('0x1')](_0xccab('0x2'),_0xccab('0x3'),'customVariable')},'keyContent':{'type':Sequelize[_0xccab('0x5')]},'idField':{'type':Sequelize[_0xccab('0x5')]},'nameField':{'type':Sequelize[_0xccab('0x5')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xccab('0x5')]}}; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.controller.js b/server/api/intZohoField/intZohoField.controller.js index b009d2b..524d8aa 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(_0x168057,_0x18fae0){var _0x470c2f=function(_0x540df1){while(--_0x540df1){_0x168057['push'](_0x168057['shift']());}};_0x470c2f(++_0x18fae0);}(_0xa9e0,0x123));var _0x0a9e=function(_0x30ae5e,_0x391fc4){_0x30ae5e=_0x30ae5e-0x0;var _0x1f2e93=_0xa9e0[_0x30ae5e];return _0x1f2e93;};'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(_0x329e45,_0x2a09db){var _0x25c632=function(_0x257b65){while(--_0x257b65){_0x329e45['push'](_0x329e45['shift']());}};_0x25c632(++_0x2a09db);}(_0xa9e0,0x123));var _0x0a9e=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0xa9e0[_0x6131cd];return _0x47e916;};'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 4b43d4a..667878a 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 _0x5c4c=['api','moment','bluebird','request-promise','path','../../config/environment','./intZohoField.attributes','exports','define','ZohoField','int_zoho_fields','zoho_unique_index','idField','FieldId','lodash','util','../../config/logger'];(function(_0x19ce40,_0x468ef4){var _0x3e0d9e=function(_0x186930){while(--_0x186930){_0x19ce40['push'](_0x19ce40['shift']());}};_0x3e0d9e(++_0x468ef4);}(_0x5c4c,0x1b7));var _0xc5c4=function(_0x4e67c1,_0x22a567){_0x4e67c1=_0x4e67c1-0x0;var _0x379a39=_0x5c4c[_0x4e67c1];return _0x379a39;};'use strict';var _=require(_0xc5c4('0x0'));var util=require(_0xc5c4('0x1'));var logger=require(_0xc5c4('0x2'))(_0xc5c4('0x3'));var moment=require(_0xc5c4('0x4'));var BPromise=require(_0xc5c4('0x5'));var rp=require(_0xc5c4('0x6'));var fs=require('fs');var path=require(_0xc5c4('0x7'));var rimraf=require('rimraf');var config=require(_0xc5c4('0x8'));var attributes=require(_0xc5c4('0x9'));module[_0xc5c4('0xa')]=function(_0x5f38d0,_0x3a1ae0){return _0x5f38d0[_0xc5c4('0xb')](_0xc5c4('0xc'),attributes,{'tableName':_0xc5c4('0xd'),'paranoid':![],'indexes':[{'name':_0xc5c4('0xe'),'fields':[_0xc5c4('0xf'),_0xc5c4('0x10')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x43e6=['../../config/environment','./intZohoField.attributes','exports','define','ZohoField','int_zoho_fields','zoho_unique_index','idField','FieldId','lodash','util','../../config/logger','bluebird','request-promise','path','rimraf'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0x43e6,0x139));var _0x643e=function(_0x32a0de,_0x423fd0){_0x32a0de=_0x32a0de-0x0;var _0x1ff5cd=_0x43e6[_0x32a0de];return _0x1ff5cd;};'use strict';var _=require(_0x643e('0x0'));var util=require(_0x643e('0x1'));var logger=require(_0x643e('0x2'))('api');var moment=require('moment');var BPromise=require(_0x643e('0x3'));var rp=require(_0x643e('0x4'));var fs=require('fs');var path=require(_0x643e('0x5'));var rimraf=require(_0x643e('0x6'));var config=require(_0x643e('0x7'));var attributes=require(_0x643e('0x8'));module[_0x643e('0x9')]=function(_0x2568d6,_0x517898){return _0x2568d6[_0x643e('0xa')](_0x643e('0xb'),attributes,{'tableName':_0x643e('0xc'),'paranoid':![],'indexes':[{'name':_0x643e('0xd'),'fields':[_0x643e('0xe'),_0x643e('0xf')],'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 632be3a..ad124b0 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 _0x4bc3=['bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','debug','ZohoField,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','ZohoField,\x20%s,\x20%s','message','result','catch','lodash','util'];(function(_0x560417,_0x413aee){var _0x21ab82=function(_0x99b562){while(--_0x99b562){_0x560417['push'](_0x560417['shift']());}};_0x21ab82(++_0x413aee);}(_0x4bc3,0x16e));var _0x34bc=function(_0x255d5b,_0x4f6f35){_0x255d5b=_0x255d5b-0x0;var _0x3e141a=_0x4bc3[_0x255d5b];return _0x3e141a;};'use strict';var _=require(_0x34bc('0x0'));var util=require(_0x34bc('0x1'));var moment=require('moment');var BPromise=require(_0x34bc('0x2'));var rs=require(_0x34bc('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x34bc('0x4'))['db'];var utils=require(_0x34bc('0x5'));var logger=require(_0x34bc('0x6'))(_0x34bc('0x7'));var config=require(_0x34bc('0x8'));var jayson=require(_0x34bc('0x9'));var client=jayson[_0x34bc('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x21451b,_0x50320d,_0x502087){return new BPromise(function(_0x18a01c,_0x474108){return client[_0x34bc('0xb')](_0x21451b,_0x502087)[_0x34bc('0xc')](function(_0x409105){logger[_0x34bc('0xd')]('ZohoField,\x20%s,\x20%s',_0x50320d,'request\x20sent');logger[_0x34bc('0xe')](_0x34bc('0xf'),_0x50320d,_0x34bc('0x10'),JSON['stringify'](_0x409105));if(_0x409105[_0x34bc('0x11')]){if(_0x409105['error'][_0x34bc('0x12')]===0x1f4){logger[_0x34bc('0x11')](_0x34bc('0x13'),_0x50320d,_0x409105['error'][_0x34bc('0x14')]);return _0x474108(_0x409105['error'][_0x34bc('0x14')]);}logger[_0x34bc('0x11')](_0x34bc('0x13'),_0x50320d,_0x409105['error']['message']);return _0x18a01c(_0x409105[_0x34bc('0x11')]['message']);}else{logger[_0x34bc('0xd')](_0x34bc('0x13'),_0x50320d,_0x34bc('0x10'));_0x18a01c(_0x409105[_0x34bc('0x15')][_0x34bc('0x14')]);}})[_0x34bc('0x16')](function(_0x5e132d){logger['error']('ZohoField,\x20%s,\x20%s',_0x50320d,_0x5e132d);_0x474108(_0x5e132d);});});} \ No newline at end of file +var _0xf2ca=['../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','ZohoField,\x20%s,\x20%s','request\x20sent','debug','ZohoField,\x20%s,\x20%s,\x20%s','error','code','message','info','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb'];(function(_0x643b2,_0x14e495){var _0x2e5346=function(_0x3ed065){while(--_0x3ed065){_0x643b2['push'](_0x643b2['shift']());}};_0x2e5346(++_0x14e495);}(_0xf2ca,0x16a));var _0xaf2c=function(_0x556927,_0x34b53f){_0x556927=_0x556927-0x0;var _0x5f1235=_0xf2ca[_0x556927];return _0x5f1235;};'use strict';var _=require(_0xaf2c('0x0'));var util=require(_0xaf2c('0x1'));var moment=require(_0xaf2c('0x2'));var BPromise=require('bluebird');var rs=require(_0xaf2c('0x3'));var fs=require('fs');var Redis=require(_0xaf2c('0x4'));var db=require(_0xaf2c('0x5'))['db'];var utils=require(_0xaf2c('0x6'));var logger=require(_0xaf2c('0x7'))(_0xaf2c('0x8'));var config=require('../../config/environment');var jayson=require(_0xaf2c('0x9'));var client=jayson[_0xaf2c('0xa')][_0xaf2c('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1f9531,_0x58351f,_0x37fedd){return new BPromise(function(_0x3c0421,_0x4a7397){return client[_0xaf2c('0xc')](_0x1f9531,_0x37fedd)['then'](function(_0x439ca3){logger['info'](_0xaf2c('0xd'),_0x58351f,_0xaf2c('0xe'));logger[_0xaf2c('0xf')](_0xaf2c('0x10'),_0x58351f,'request\x20sent',JSON['stringify'](_0x439ca3));if(_0x439ca3[_0xaf2c('0x11')]){if(_0x439ca3[_0xaf2c('0x11')][_0xaf2c('0x12')]===0x1f4){logger[_0xaf2c('0x11')](_0xaf2c('0xd'),_0x58351f,_0x439ca3['error']['message']);return _0x4a7397(_0x439ca3[_0xaf2c('0x11')][_0xaf2c('0x13')]);}logger[_0xaf2c('0x11')](_0xaf2c('0xd'),_0x58351f,_0x439ca3[_0xaf2c('0x11')][_0xaf2c('0x13')]);return _0x3c0421(_0x439ca3[_0xaf2c('0x11')][_0xaf2c('0x13')]);}else{logger[_0xaf2c('0x14')](_0xaf2c('0xd'),_0x58351f,_0xaf2c('0xe'));_0x3c0421(_0x439ca3[_0xaf2c('0x15')][_0xaf2c('0x13')]);}})[_0xaf2c('0x16')](function(_0x705d09){logger['error'](_0xaf2c('0xd'),_0x58351f,_0x705d09);_0x4a7397(_0x705d09);});});} \ No newline at end of file diff --git a/server/api/integration/index.js b/server/api/integration/index.js index 8a18eec..9a9761d 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 _0xe1e2=['../../components/interaction/service','../../config/environment','exports','util','path','connect-timeout','express','Router'];(function(_0xd95fd8,_0x48f977){var _0x4142ea=function(_0x29f62c){while(--_0x29f62c){_0xd95fd8['push'](_0xd95fd8['shift']());}};_0x4142ea(++_0x48f977);}(_0xe1e2,0x1e3));var _0x2e1e=function(_0x1e636c,_0x233cdf){_0x1e636c=_0x1e636c-0x0;var _0x566127=_0xe1e2[_0x1e636c];return _0x566127;};'use strict';var multer=require('multer');var util=require(_0x2e1e('0x0'));var path=require(_0x2e1e('0x1'));var timeout=require(_0x2e1e('0x2'));var express=require(_0x2e1e('0x3'));var router=express[_0x2e1e('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x2e1e('0x5'));var config=require(_0x2e1e('0x6'));module[_0x2e1e('0x7')]=router; \ No newline at end of file +var _0x85b1=['express','Router','../../components/auth/service','../../components/interaction/service','exports','multer','path','connect-timeout'];(function(_0xb89645,_0x55d7cf){var _0x474232=function(_0x57f483){while(--_0x57f483){_0xb89645['push'](_0xb89645['shift']());}};_0x474232(++_0x55d7cf);}(_0x85b1,0x165));var _0x185b=function(_0x26462c,_0xd20a35){_0x26462c=_0x26462c-0x0;var _0x509a42=_0x85b1[_0x26462c];return _0x509a42;};'use strict';var multer=require(_0x185b('0x0'));var util=require('util');var path=require(_0x185b('0x1'));var timeout=require(_0x185b('0x2'));var express=require(_0x185b('0x3'));var router=express[_0x185b('0x4')]();var auth=require(_0x185b('0x5'));var interaction=require(_0x185b('0x6'));var config=require('../../config/environment');module[_0x185b('0x7')]=router; \ No newline at end of file diff --git a/server/api/integration/integration.attributes.js b/server/api/integration/integration.attributes.js index f643e0c..2229a57 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 _0x0dbb=['STRING','unique_name_and_version','app.js','INTEGER','BOOLEAN','state','sequelize','exports'];(function(_0x2e702c,_0x49b529){var _0x1bee63=function(_0x82a81e){while(--_0x82a81e){_0x2e702c['push'](_0x2e702c['shift']());}};_0x1bee63(++_0x49b529);}(_0x0dbb,0x196));var _0xb0db=function(_0x72e72b,_0x1ec2ca){_0x72e72b=_0x72e72b-0x0;var _0x307667=_0x0dbb[_0x72e72b];return _0x307667;};'use strict';var Sequelize=require(_0xb0db('0x0'));module[_0xb0db('0x1')]={'name':{'type':Sequelize[_0xb0db('0x2')],'allowNull':![],'unique':_0xb0db('0x3')},'version':{'type':Sequelize[_0xb0db('0x2')],'allowNull':![],'unique':_0xb0db('0x3')},'main':{'type':Sequelize[_0xb0db('0x2')],'defaultValue':_0xb0db('0x4')},'filename':{'type':Sequelize[_0xb0db('0x2')]},'path':{'type':Sequelize[_0xb0db('0x2')]},'type':{'type':Sequelize[_0xb0db('0x2')]},'size':{'type':Sequelize[_0xb0db('0x5')]},'active':{'type':Sequelize[_0xb0db('0x6')],'defaultValue':![]},'author':{'type':Sequelize[_0xb0db('0x2')]},'logo':{'type':Sequelize['STRING']},'state':{'type':Sequelize[_0xb0db('0x2')],'unique':_0xb0db('0x7')},'description':{'type':Sequelize[_0xb0db('0x2')]},'title':{'type':Sequelize[_0xb0db('0x2')]},'remoteUri':{'type':Sequelize[_0xb0db('0x2')]},'link':{'type':Sequelize[_0xb0db('0x2')],'defaultValue':'#'}}; \ No newline at end of file +var _0xd043=['unique_name_and_version','app.js','INTEGER','BOOLEAN','exports','STRING'];(function(_0x531a19,_0x43e019){var _0x4845d2=function(_0x4c9b62){while(--_0x4c9b62){_0x531a19['push'](_0x531a19['shift']());}};_0x4845d2(++_0x43e019);}(_0xd043,0x100));var _0x3d04=function(_0x4371a8,_0x3ac39){_0x4371a8=_0x4371a8-0x0;var _0x110901=_0xd043[_0x4371a8];return _0x110901;};'use strict';var Sequelize=require('sequelize');module[_0x3d04('0x0')]={'name':{'type':Sequelize[_0x3d04('0x1')],'allowNull':![],'unique':_0x3d04('0x2')},'version':{'type':Sequelize[_0x3d04('0x1')],'allowNull':![],'unique':_0x3d04('0x2')},'main':{'type':Sequelize[_0x3d04('0x1')],'defaultValue':_0x3d04('0x3')},'filename':{'type':Sequelize['STRING']},'path':{'type':Sequelize[_0x3d04('0x1')]},'type':{'type':Sequelize[_0x3d04('0x1')]},'size':{'type':Sequelize[_0x3d04('0x4')]},'active':{'type':Sequelize[_0x3d04('0x5')],'defaultValue':![]},'author':{'type':Sequelize[_0x3d04('0x1')]},'logo':{'type':Sequelize['STRING']},'state':{'type':Sequelize[_0x3d04('0x1')],'unique':'state'},'description':{'type':Sequelize[_0x3d04('0x1')]},'title':{'type':Sequelize[_0x3d04('0x1')]},'remoteUri':{'type':Sequelize[_0x3d04('0x1')]},'link':{'type':Sequelize[_0x3d04('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 bfa078f..84ed9ae 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 _0x617c=['length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','Integration','includeAll','include','findAll','rows','catch','show','params','fields','create','body','find','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','sendStatus','status','end','json','count','offset','limit','set','apply','reject','save','update','then','destroy','error','name','send','map','rawAttributes','type','key','model','query','keys','filters','intersection','attributes'];(function(_0x53ccf2,_0x13cb67){var _0x5a2964=function(_0x3b0514){while(--_0x3b0514){_0x53ccf2['push'](_0x53ccf2['shift']());}};_0x5a2964(++_0x13cb67);}(_0x617c,0x179));var _0xc617=function(_0x422be2,_0x1c439e){_0x422be2=_0x422be2-0x0;var _0x1b820e=_0x617c[_0x422be2];return _0x1b820e;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xc617('0x0'));var rimraf=require(_0xc617('0x1'));var zipdir=require(_0xc617('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xc617('0x3'));var moment=require(_0xc617('0x4'));var BPromise=require(_0xc617('0x5'));var Mustache=require(_0xc617('0x6'));var util=require(_0xc617('0x7'));var path=require(_0xc617('0x8'));var sox=require(_0xc617('0x9'));var csv=require(_0xc617('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xc617('0xb'));var squel=require(_0xc617('0xc'));var crypto=require('crypto');var jsforce=require(_0xc617('0xd'));var deskjs=require(_0xc617('0xe'));var toCsv=require(_0xc617('0xa'));var querystring=require(_0xc617('0xf'));var Papa=require(_0xc617('0x10'));var Redis=require(_0xc617('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xc617('0x12'));var hardwareService=require(_0xc617('0x13'));var logger=require(_0xc617('0x14'))(_0xc617('0x15'));var utils=require('../../config/utils');var config=require('../../config/environment');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1a219e,_0x1b65c8){_0x1b65c8=_0x1b65c8||0xcc;return function(_0x5018a2){if(_0x5018a2){return _0x1a219e[_0xc617('0x16')](_0x1b65c8);}return _0x1a219e[_0xc617('0x17')](_0x1b65c8)[_0xc617('0x18')]();};}function respondWithResult(_0x29b740,_0x5c1a62){_0x5c1a62=_0x5c1a62||0xc8;return function(_0x5da3c7){if(_0x5da3c7){return _0x29b740[_0xc617('0x17')](_0x5c1a62)[_0xc617('0x19')](_0x5da3c7);}};}function respondWithFilteredResult(_0x52e14d,_0x5e9d6e){return function(_0x22f7cf){if(_0x22f7cf){var _0x1f9c33=_0x22f7cf[_0xc617('0x1a')],_0x291429=_0x5e9d6e['offset'],_0x2f6490=_0x5e9d6e[_0xc617('0x1b')]+_0x5e9d6e[_0xc617('0x1c')],_0x17af73;if(_0x2f6490>=_0x1f9c33){_0x2f6490=_0x1f9c33;_0x17af73=0xc8;}else{_0x17af73=0xce;}_0x52e14d['status'](_0x17af73);return _0x52e14d[_0xc617('0x1d')]('Content-Range',_0x291429+'-'+_0x2f6490+'/'+_0x1f9c33)[_0xc617('0x19')](_0x22f7cf);}return null;};}function patchUpdates(_0x11a4e9){return function(_0x31cbbb){try{jsonpatch[_0xc617('0x1e')](_0x31cbbb,_0x11a4e9,!![]);}catch(_0x811ee8){return BPromise[_0xc617('0x1f')](_0x811ee8);}return _0x31cbbb[_0xc617('0x20')]();};}function saveUpdates(_0x25f017,_0x282e37){return function(_0xd22d4c){if(_0xd22d4c){return _0xd22d4c[_0xc617('0x21')](_0x25f017)[_0xc617('0x22')](function(_0x3cc5e1){return _0x3cc5e1;});}return null;};}function removeEntity(_0x2da796,_0x3d1a25){return function(_0x4143f6){if(_0x4143f6){return _0x4143f6[_0xc617('0x23')]()[_0xc617('0x22')](function(){_0x2da796[_0xc617('0x17')](0xcc)[_0xc617('0x18')]();});}};}function handleEntityNotFound(_0x5ed255,_0x2807d2){return function(_0x5024e8){if(!_0x5024e8){_0x5ed255[_0xc617('0x16')](0x194);}return _0x5024e8;};}function handleError(_0x457adb,_0x5baf48){_0x5baf48=_0x5baf48||0x1f4;return function(_0xf49f96){logger[_0xc617('0x24')](_0xf49f96['stack']);if(_0xf49f96[_0xc617('0x25')]){delete _0xf49f96[_0xc617('0x25')];}_0x457adb[_0xc617('0x17')](_0x5baf48)[_0xc617('0x26')](_0xf49f96);};}exports['index']=function(_0x108f23,_0x2874cb){var _0x458144={},_0x2a75e1={},_0x4ad15e={'count':0x0,'rows':[]};var _0x497deb=_[_0xc617('0x27')](db['Integration'][_0xc617('0x28')],function(_0x2f0c3b){return{'name':_0x2f0c3b['fieldName'],'type':_0x2f0c3b[_0xc617('0x29')][_0xc617('0x2a')]};});_0x2a75e1[_0xc617('0x2b')]=_['map'](_0x497deb,_0xc617('0x25'));_0x2a75e1[_0xc617('0x2c')]=_[_0xc617('0x2d')](_0x108f23[_0xc617('0x2c')]);_0x2a75e1[_0xc617('0x2e')]=_[_0xc617('0x2f')](_0x2a75e1[_0xc617('0x2b')],_0x2a75e1[_0xc617('0x2c')]);_0x458144[_0xc617('0x30')]=_[_0xc617('0x2f')](_0x2a75e1[_0xc617('0x2b')],qs['fields'](_0x108f23[_0xc617('0x2c')]['fields']));_0x458144['attributes']=_0x458144[_0xc617('0x30')][_0xc617('0x31')]?_0x458144[_0xc617('0x30')]:_0x2a75e1[_0xc617('0x2b')];if(!_0x108f23[_0xc617('0x2c')][_0xc617('0x32')]('nolimit')){_0x458144['limit']=qs[_0xc617('0x1c')](_0x108f23['query'][_0xc617('0x1c')]);_0x458144['offset']=qs[_0xc617('0x1b')](_0x108f23[_0xc617('0x2c')][_0xc617('0x1b')]);}_0x458144[_0xc617('0x33')]=qs[_0xc617('0x34')](_0x108f23['query']['sort']);_0x458144[_0xc617('0x35')]=qs[_0xc617('0x2e')](_[_0xc617('0x36')](_0x108f23[_0xc617('0x2c')],_0x2a75e1[_0xc617('0x2e')]),_0x497deb);if(_0x108f23[_0xc617('0x2c')][_0xc617('0x37')]){_0x458144['where']=_[_0xc617('0x38')](_0x458144['where'],{'$or':_[_0xc617('0x27')](_0x497deb,function(_0x611f59){if(_0x611f59[_0xc617('0x29')]!==_0xc617('0x39')){var _0x40833d={};_0x40833d[_0x611f59['name']]={'$like':'%'+_0x108f23[_0xc617('0x2c')]['filter']+'%'};return _0x40833d;}})});}_0x458144=_[_0xc617('0x38')]({},_0x458144,_0x108f23[_0xc617('0x3a')]);var _0x1caf81={'where':_0x458144[_0xc617('0x35')]};return db[_0xc617('0x3b')][_0xc617('0x1a')](_0x1caf81)['then'](function(_0x39d7d3){_0x4ad15e[_0xc617('0x1a')]=_0x39d7d3;if(_0x108f23['query'][_0xc617('0x3c')]){_0x458144[_0xc617('0x3d')]=[{'all':!![]}];}return db[_0xc617('0x3b')][_0xc617('0x3e')](_0x458144);})[_0xc617('0x22')](function(_0x56a0f1){_0x4ad15e[_0xc617('0x3f')]=_0x56a0f1;return _0x4ad15e;})[_0xc617('0x22')](respondWithFilteredResult(_0x2874cb,_0x458144))[_0xc617('0x40')](handleError(_0x2874cb,null));};exports[_0xc617('0x41')]=function(_0x54a13f,_0x1503ee){var _0x12f879={'raw':![],'where':{'id':_0x54a13f[_0xc617('0x42')]['id']}},_0x50ba6e={};_0x50ba6e[_0xc617('0x2b')]=_[_0xc617('0x2d')](db[_0xc617('0x3b')][_0xc617('0x28')]);_0x50ba6e[_0xc617('0x2c')]=_[_0xc617('0x2d')](_0x54a13f['query']);_0x50ba6e[_0xc617('0x2e')]=_['intersection'](_0x50ba6e[_0xc617('0x2b')],_0x50ba6e[_0xc617('0x2c')]);_0x12f879[_0xc617('0x30')]=_[_0xc617('0x2f')](_0x50ba6e['model'],qs[_0xc617('0x43')](_0x54a13f[_0xc617('0x2c')][_0xc617('0x43')]));_0x12f879[_0xc617('0x30')]=_0x12f879[_0xc617('0x30')][_0xc617('0x31')]?_0x12f879[_0xc617('0x30')]:_0x50ba6e[_0xc617('0x2b')];if(_0x54a13f[_0xc617('0x2c')][_0xc617('0x3c')]){_0x12f879[_0xc617('0x3d')]=[{'all':!![]}];}_0x12f879=_[_0xc617('0x38')]({},_0x12f879,_0x54a13f[_0xc617('0x3a')]);return db[_0xc617('0x3b')]['find'](_0x12f879)[_0xc617('0x22')](handleEntityNotFound(_0x1503ee,null))[_0xc617('0x22')](respondWithResult(_0x1503ee,null))[_0xc617('0x40')](handleError(_0x1503ee,null));};exports[_0xc617('0x44')]=function(_0x218a42,_0x479637){return db[_0xc617('0x3b')][_0xc617('0x44')](_0x218a42[_0xc617('0x45')],{})[_0xc617('0x22')](respondWithResult(_0x479637,0xc9))[_0xc617('0x40')](handleError(_0x479637,null));};exports[_0xc617('0x21')]=function(_0xeee539,_0x1a6c34){if(_0xeee539[_0xc617('0x45')]['id']){delete _0xeee539[_0xc617('0x45')]['id'];}return db[_0xc617('0x3b')][_0xc617('0x46')]({'where':{'id':_0xeee539[_0xc617('0x42')]['id']}})[_0xc617('0x22')](handleEntityNotFound(_0x1a6c34,null))[_0xc617('0x22')](saveUpdates(_0xeee539['body'],null))[_0xc617('0x22')](respondWithResult(_0x1a6c34,null))['catch'](handleError(_0x1a6c34,null));};exports['destroy']=function(_0x699916,_0xa3cd19){return db[_0xc617('0x3b')][_0xc617('0x46')]({'where':{'id':_0x699916['params']['id']}})[_0xc617('0x22')](handleEntityNotFound(_0xa3cd19,null))[_0xc617('0x22')](removeEntity(_0xa3cd19,null))[_0xc617('0x40')](handleError(_0xa3cd19,null));}; \ No newline at end of file +var _0xf228=['../../config/utils','../../mysqldb','status','end','count','offset','set','Content-Range','json','apply','reject','save','update','then','destroy','sendStatus','error','stack','name','send','index','map','Integration','rawAttributes','fieldName','key','keys','query','intersection','model','attributes','fields','hasOwnProperty','nolimit','limit','order','sort','where','filters','pick','filter','merge','type','VIRTUAL','options','includeAll','include','rows','catch','show','params','length','find','create','body','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','to-csv','ejs','lodash','squel','jsforce','querystring','papaparse','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api'];(function(_0x1fd0d6,_0x1be60f){var _0x28afa7=function(_0x5eb61f){while(--_0x5eb61f){_0x1fd0d6['push'](_0x1fd0d6['shift']());}};_0x28afa7(++_0x1be60f);}(_0xf228,0x1a4));var _0x8f22=function(_0x61d8d9,_0x110a01){_0x61d8d9=_0x61d8d9-0x0;var _0x53296a=_0xf228[_0x61d8d9];return _0x53296a;};'use strict';var pdf=require(_0x8f22('0x0'));var emlformat=require(_0x8f22('0x1'));var rimraf=require(_0x8f22('0x2'));var zipdir=require(_0x8f22('0x3'));var jsonpatch=require(_0x8f22('0x4'));var rp=require('request-promise');var moment=require(_0x8f22('0x5'));var BPromise=require(_0x8f22('0x6'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0x8f22('0x7'));var ejs=require(_0x8f22('0x8'));var fs=require('fs');var _=require(_0x8f22('0x9'));var squel=require(_0x8f22('0xa'));var crypto=require('crypto');var jsforce=require(_0x8f22('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x8f22('0x7'));var querystring=require(_0x8f22('0xc'));var Papa=require(_0x8f22('0xd'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x8f22('0xe'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x8f22('0xf'));var logger=require(_0x8f22('0x10'))(_0x8f22('0x11'));var utils=require(_0x8f22('0x12'));var config=require('../../config/environment');var db=require(_0x8f22('0x13'))['db'];function respondWithStatusCode(_0x4b9fea,_0x16a8a1){_0x16a8a1=_0x16a8a1||0xcc;return function(_0x98c2e4){if(_0x98c2e4){return _0x4b9fea['sendStatus'](_0x16a8a1);}return _0x4b9fea[_0x8f22('0x14')](_0x16a8a1)[_0x8f22('0x15')]();};}function respondWithResult(_0x42ab63,_0x2e37b9){_0x2e37b9=_0x2e37b9||0xc8;return function(_0x2d4bbc){if(_0x2d4bbc){return _0x42ab63[_0x8f22('0x14')](_0x2e37b9)['json'](_0x2d4bbc);}};}function respondWithFilteredResult(_0x21a7cf,_0x1736a4){return function(_0x454287){if(_0x454287){var _0xccf805=_0x454287[_0x8f22('0x16')],_0x3f2155=_0x1736a4[_0x8f22('0x17')],_0x30b13c=_0x1736a4[_0x8f22('0x17')]+_0x1736a4['limit'],_0x20c73b;if(_0x30b13c>=_0xccf805){_0x30b13c=_0xccf805;_0x20c73b=0xc8;}else{_0x20c73b=0xce;}_0x21a7cf[_0x8f22('0x14')](_0x20c73b);return _0x21a7cf[_0x8f22('0x18')](_0x8f22('0x19'),_0x3f2155+'-'+_0x30b13c+'/'+_0xccf805)[_0x8f22('0x1a')](_0x454287);}return null;};}function patchUpdates(_0x2984ca){return function(_0x3a5ea1){try{jsonpatch[_0x8f22('0x1b')](_0x3a5ea1,_0x2984ca,!![]);}catch(_0x33a2c9){return BPromise[_0x8f22('0x1c')](_0x33a2c9);}return _0x3a5ea1[_0x8f22('0x1d')]();};}function saveUpdates(_0xd457db,_0x51a8a4){return function(_0x23e22d){if(_0x23e22d){return _0x23e22d[_0x8f22('0x1e')](_0xd457db)[_0x8f22('0x1f')](function(_0x445cbd){return _0x445cbd;});}return null;};}function removeEntity(_0x45d776,_0x38f632){return function(_0x562f27){if(_0x562f27){return _0x562f27[_0x8f22('0x20')]()[_0x8f22('0x1f')](function(){_0x45d776['status'](0xcc)[_0x8f22('0x15')]();});}};}function handleEntityNotFound(_0x4d7fb6,_0x10d9bb){return function(_0x452d4d){if(!_0x452d4d){_0x4d7fb6[_0x8f22('0x21')](0x194);}return _0x452d4d;};}function handleError(_0x4506b6,_0x3c430e){_0x3c430e=_0x3c430e||0x1f4;return function(_0x23a92c){logger[_0x8f22('0x22')](_0x23a92c[_0x8f22('0x23')]);if(_0x23a92c[_0x8f22('0x24')]){delete _0x23a92c[_0x8f22('0x24')];}_0x4506b6['status'](_0x3c430e)[_0x8f22('0x25')](_0x23a92c);};}exports[_0x8f22('0x26')]=function(_0x49614c,_0x10ece1){var _0x11fe0e={},_0x4c02={},_0x300951={'count':0x0,'rows':[]};var _0x10b772=_[_0x8f22('0x27')](db[_0x8f22('0x28')][_0x8f22('0x29')],function(_0x1c42c4){return{'name':_0x1c42c4[_0x8f22('0x2a')],'type':_0x1c42c4['type'][_0x8f22('0x2b')]};});_0x4c02['model']=_['map'](_0x10b772,'name');_0x4c02['query']=_[_0x8f22('0x2c')](_0x49614c[_0x8f22('0x2d')]);_0x4c02['filters']=_[_0x8f22('0x2e')](_0x4c02[_0x8f22('0x2f')],_0x4c02['query']);_0x11fe0e[_0x8f22('0x30')]=_[_0x8f22('0x2e')](_0x4c02[_0x8f22('0x2f')],qs[_0x8f22('0x31')](_0x49614c[_0x8f22('0x2d')][_0x8f22('0x31')]));_0x11fe0e[_0x8f22('0x30')]=_0x11fe0e['attributes']['length']?_0x11fe0e['attributes']:_0x4c02['model'];if(!_0x49614c['query'][_0x8f22('0x32')](_0x8f22('0x33'))){_0x11fe0e['limit']=qs['limit'](_0x49614c[_0x8f22('0x2d')][_0x8f22('0x34')]);_0x11fe0e[_0x8f22('0x17')]=qs[_0x8f22('0x17')](_0x49614c[_0x8f22('0x2d')]['offset']);}_0x11fe0e[_0x8f22('0x35')]=qs[_0x8f22('0x36')](_0x49614c[_0x8f22('0x2d')]['sort']);_0x11fe0e[_0x8f22('0x37')]=qs[_0x8f22('0x38')](_[_0x8f22('0x39')](_0x49614c[_0x8f22('0x2d')],_0x4c02[_0x8f22('0x38')]),_0x10b772);if(_0x49614c[_0x8f22('0x2d')][_0x8f22('0x3a')]){_0x11fe0e['where']=_[_0x8f22('0x3b')](_0x11fe0e[_0x8f22('0x37')],{'$or':_[_0x8f22('0x27')](_0x10b772,function(_0x56f123){if(_0x56f123[_0x8f22('0x3c')]!==_0x8f22('0x3d')){var _0x1029dd={};_0x1029dd[_0x56f123[_0x8f22('0x24')]]={'$like':'%'+_0x49614c[_0x8f22('0x2d')]['filter']+'%'};return _0x1029dd;}})});}_0x11fe0e=_[_0x8f22('0x3b')]({},_0x11fe0e,_0x49614c[_0x8f22('0x3e')]);var _0x47a515={'where':_0x11fe0e['where']};return db['Integration'][_0x8f22('0x16')](_0x47a515)[_0x8f22('0x1f')](function(_0x1fc1a1){_0x300951[_0x8f22('0x16')]=_0x1fc1a1;if(_0x49614c[_0x8f22('0x2d')][_0x8f22('0x3f')]){_0x11fe0e[_0x8f22('0x40')]=[{'all':!![]}];}return db[_0x8f22('0x28')]['findAll'](_0x11fe0e);})['then'](function(_0x3db3d6){_0x300951[_0x8f22('0x41')]=_0x3db3d6;return _0x300951;})[_0x8f22('0x1f')](respondWithFilteredResult(_0x10ece1,_0x11fe0e))[_0x8f22('0x42')](handleError(_0x10ece1,null));};exports[_0x8f22('0x43')]=function(_0x44dc8b,_0x51c682){var _0x25d17e={'raw':![],'where':{'id':_0x44dc8b[_0x8f22('0x44')]['id']}},_0x3745d0={};_0x3745d0[_0x8f22('0x2f')]=_['keys'](db['Integration'][_0x8f22('0x29')]);_0x3745d0['query']=_[_0x8f22('0x2c')](_0x44dc8b[_0x8f22('0x2d')]);_0x3745d0[_0x8f22('0x38')]=_['intersection'](_0x3745d0[_0x8f22('0x2f')],_0x3745d0[_0x8f22('0x2d')]);_0x25d17e['attributes']=_[_0x8f22('0x2e')](_0x3745d0[_0x8f22('0x2f')],qs['fields'](_0x44dc8b[_0x8f22('0x2d')][_0x8f22('0x31')]));_0x25d17e['attributes']=_0x25d17e['attributes'][_0x8f22('0x45')]?_0x25d17e[_0x8f22('0x30')]:_0x3745d0[_0x8f22('0x2f')];if(_0x44dc8b[_0x8f22('0x2d')][_0x8f22('0x3f')]){_0x25d17e[_0x8f22('0x40')]=[{'all':!![]}];}_0x25d17e=_['merge']({},_0x25d17e,_0x44dc8b[_0x8f22('0x3e')]);return db['Integration'][_0x8f22('0x46')](_0x25d17e)[_0x8f22('0x1f')](handleEntityNotFound(_0x51c682,null))['then'](respondWithResult(_0x51c682,null))['catch'](handleError(_0x51c682,null));};exports[_0x8f22('0x47')]=function(_0x2f993d,_0x25438e){return db[_0x8f22('0x28')][_0x8f22('0x47')](_0x2f993d[_0x8f22('0x48')],{})[_0x8f22('0x1f')](respondWithResult(_0x25438e,0xc9))[_0x8f22('0x42')](handleError(_0x25438e,null));};exports[_0x8f22('0x1e')]=function(_0xdf2bb,_0x1b3e45){if(_0xdf2bb[_0x8f22('0x48')]['id']){delete _0xdf2bb[_0x8f22('0x48')]['id'];}return db[_0x8f22('0x28')][_0x8f22('0x46')]({'where':{'id':_0xdf2bb[_0x8f22('0x44')]['id']}})['then'](handleEntityNotFound(_0x1b3e45,null))[_0x8f22('0x1f')](saveUpdates(_0xdf2bb['body'],null))[_0x8f22('0x1f')](respondWithResult(_0x1b3e45,null))['catch'](handleError(_0x1b3e45,null));};exports[_0x8f22('0x20')]=function(_0x4cca5c,_0x29cec2){return db[_0x8f22('0x28')][_0x8f22('0x46')]({'where':{'id':_0x4cca5c[_0x8f22('0x44')]['id']}})['then'](handleEntityNotFound(_0x29cec2,null))['then'](removeEntity(_0x29cec2,null))[_0x8f22('0x42')](handleError(_0x29cec2,null));}; \ No newline at end of file diff --git a/server/api/integration/integration.model.js b/server/api/integration/integration.model.js index c9cedef..55c3acc 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 _0x44b5=['../../config/environment','./integration.attributes','define','Integration','integrations','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x12f7d1,_0xea85b3){var _0x17a408=function(_0x38e09a){while(--_0x38e09a){_0x12f7d1['push'](_0x12f7d1['shift']());}};_0x17a408(++_0xea85b3);}(_0x44b5,0x1d9));var _0x544b=function(_0x41aa5d,_0x171a81){_0x41aa5d=_0x41aa5d-0x0;var _0x546166=_0x44b5[_0x41aa5d];return _0x546166;};'use strict';var _=require('lodash');var util=require(_0x544b('0x0'));var logger=require(_0x544b('0x1'))(_0x544b('0x2'));var moment=require(_0x544b('0x3'));var BPromise=require(_0x544b('0x4'));var rp=require(_0x544b('0x5'));var fs=require('fs');var path=require(_0x544b('0x6'));var rimraf=require(_0x544b('0x7'));var config=require(_0x544b('0x8'));var attributes=require(_0x544b('0x9'));module['exports']=function(_0x3acadf,_0x12c101){return _0x3acadf[_0x544b('0xa')](_0x544b('0xb'),attributes,{'tableName':_0x544b('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xebfa=['../../config/environment','./integration.attributes','exports','define','integrations','lodash','util','../../config/logger','api','request-promise','path'];(function(_0x4c6959,_0x56b8c1){var _0x27fd86=function(_0x250dd8){while(--_0x250dd8){_0x4c6959['push'](_0x4c6959['shift']());}};_0x27fd86(++_0x56b8c1);}(_0xebfa,0x73));var _0xaebf=function(_0x5f09c5,_0x2bfca0){_0x5f09c5=_0x5f09c5-0x0;var _0x426ad9=_0xebfa[_0x5f09c5];return _0x426ad9;};'use strict';var _=require(_0xaebf('0x0'));var util=require(_0xaebf('0x1'));var logger=require(_0xaebf('0x2'))(_0xaebf('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xaebf('0x4'));var fs=require('fs');var path=require(_0xaebf('0x5'));var rimraf=require('rimraf');var config=require(_0xaebf('0x6'));var attributes=require(_0xaebf('0x7'));module[_0xaebf('0x8')]=function(_0x4f832c,_0x57a77f){return _0x4f832c[_0xaebf('0x9')]('Integration',attributes,{'tableName':_0xaebf('0xa'),'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 f4fd9b2..ee12dd6 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 _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(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xbd50,0x196));var _0x0bd5=function(_0x2de095,_0x801aff){_0x2de095=_0x2de095-0x0;var _0x1d9a32=_0xbd50[_0x2de095];return _0x1d9a32;};'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 +var _0x3a32=['Integration,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','Integration,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','client','request','info','debug'];(function(_0x53cf8e,_0x3d290f){var _0x459197=function(_0x67073c){while(--_0x67073c){_0x53cf8e['push'](_0x53cf8e['shift']());}};_0x459197(++_0x3d290f);}(_0x3a32,0x9b));var _0x23a3=function(_0x47b58b,_0x41a189){_0x47b58b=_0x47b58b-0x0;var _0x46bebe=_0x3a32[_0x47b58b];return _0x46bebe;};'use strict';var _=require(_0x23a3('0x0'));var util=require(_0x23a3('0x1'));var moment=require(_0x23a3('0x2'));var BPromise=require(_0x23a3('0x3'));var rs=require(_0x23a3('0x4'));var fs=require('fs');var Redis=require(_0x23a3('0x5'));var db=require(_0x23a3('0x6'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x23a3('0x7'));var config=require(_0x23a3('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x23a3('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x103499,_0x256bcf,_0xd4e907){return new BPromise(function(_0x2562bc,_0x11d423){return client[_0x23a3('0xa')](_0x103499,_0xd4e907)['then'](function(_0x233b17){logger[_0x23a3('0xb')]('Integration,\x20%s,\x20%s',_0x256bcf,'request\x20sent');logger[_0x23a3('0xc')](_0x23a3('0xd'),_0x256bcf,_0x23a3('0xe'),JSON['stringify'](_0x233b17));if(_0x233b17[_0x23a3('0xf')]){if(_0x233b17['error'][_0x23a3('0x10')]===0x1f4){logger[_0x23a3('0xf')](_0x23a3('0x11'),_0x256bcf,_0x233b17['error'][_0x23a3('0x12')]);return _0x11d423(_0x233b17[_0x23a3('0xf')][_0x23a3('0x12')]);}logger[_0x23a3('0xf')](_0x23a3('0x11'),_0x256bcf,_0x233b17['error'][_0x23a3('0x12')]);return _0x2562bc(_0x233b17[_0x23a3('0xf')]['message']);}else{logger[_0x23a3('0xb')](_0x23a3('0x11'),_0x256bcf,'request\x20sent');_0x2562bc(_0x233b17[_0x23a3('0x13')][_0x23a3('0x12')]);}})[_0x23a3('0x14')](function(_0x3e3cc1){logger[_0x23a3('0xf')](_0x23a3('0x11'),_0x256bcf,_0x3e3cc1);_0x11d423(_0x3e3cc1);});});} \ No newline at end of file diff --git a/server/api/integrationReport/index.js b/server/api/integrationReport/index.js index 825ea51..b40b8ee 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 _0xd099=['../../components/auth/service','../../components/interaction/service','../../config/environment','./integrationReport.controller','isAuthenticated','get','/describe','describe','/:id','show','post','put','update','multer','util','path','connect-timeout','Router'];(function(_0xad6d46,_0x3f6d68){var _0x1a12a9=function(_0x1d4b62){while(--_0x1d4b62){_0xad6d46['push'](_0xad6d46['shift']());}};_0x1a12a9(++_0x3f6d68);}(_0xd099,0x1bd));var _0x9d09=function(_0x16cb4b,_0x481b00){_0x16cb4b=_0x16cb4b-0x0;var _0x2e1bd8=_0xd099[_0x16cb4b];return _0x2e1bd8;};'use strict';var multer=require(_0x9d09('0x0'));var util=require(_0x9d09('0x1'));var path=require(_0x9d09('0x2'));var timeout=require(_0x9d09('0x3'));var express=require('express');var router=express[_0x9d09('0x4')]();var auth=require(_0x9d09('0x5'));var interaction=require(_0x9d09('0x6'));var config=require(_0x9d09('0x7'));var controller=require(_0x9d09('0x8'));router['get']('/',auth[_0x9d09('0x9')](),controller['index']);router[_0x9d09('0xa')](_0x9d09('0xb'),auth[_0x9d09('0x9')](),controller[_0x9d09('0xc')]);router['get'](_0x9d09('0xd'),auth['isAuthenticated'](),controller[_0x9d09('0xe')]);router[_0x9d09('0xf')]('/',auth[_0x9d09('0x9')](),controller['create']);router[_0x9d09('0x10')](_0x9d09('0xd'),auth[_0x9d09('0x9')](),controller[_0x9d09('0x11')]);router['delete'](_0x9d09('0xd'),auth[_0x9d09('0x9')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x67ee=['Router','../../components/auth/service','../../components/interaction/service','./integrationReport.controller','isAuthenticated','index','get','/describe','describe','/:id','create','put','update','delete','destroy','multer','util','path','connect-timeout','express'];(function(_0x183a0f,_0x59955c){var _0x508639=function(_0x3057a3){while(--_0x3057a3){_0x183a0f['push'](_0x183a0f['shift']());}};_0x508639(++_0x59955c);}(_0x67ee,0x9b));var _0xe67e=function(_0x474829,_0x463fce){_0x474829=_0x474829-0x0;var _0x3002cd=_0x67ee[_0x474829];return _0x3002cd;};'use strict';var multer=require(_0xe67e('0x0'));var util=require(_0xe67e('0x1'));var path=require(_0xe67e('0x2'));var timeout=require(_0xe67e('0x3'));var express=require(_0xe67e('0x4'));var router=express[_0xe67e('0x5')]();var auth=require(_0xe67e('0x6'));var interaction=require(_0xe67e('0x7'));var config=require('../../config/environment');var controller=require(_0xe67e('0x8'));router['get']('/',auth[_0xe67e('0x9')](),controller[_0xe67e('0xa')]);router[_0xe67e('0xb')](_0xe67e('0xc'),auth[_0xe67e('0x9')](),controller[_0xe67e('0xd')]);router['get'](_0xe67e('0xe'),auth[_0xe67e('0x9')](),controller['show']);router['post']('/',auth[_0xe67e('0x9')](),controller[_0xe67e('0xf')]);router[_0xe67e('0x10')]('/:id',auth[_0xe67e('0x9')](),controller[_0xe67e('0x11')]);router[_0xe67e('0x12')](_0xe67e('0xe'),auth[_0xe67e('0x9')](),controller[_0xe67e('0x13')]);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 059c9b8..80bd31c 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 _0xa390=['ENUM','SENT','SENDING','RECEIVED','FAILED','sequelize','STRING','INTEGER','DATE','BOOLEAN','TEXT'];(function(_0x26c7bb,_0x4f432b){var _0x4a7bad=function(_0x50e727){while(--_0x50e727){_0x26c7bb['push'](_0x26c7bb['shift']());}};_0x4a7bad(++_0x4f432b);}(_0xa390,0xf7));var _0x0a39=function(_0x2730b7,_0x369f8b){_0x2730b7=_0x2730b7-0x0;var _0x28f1f4=_0xa390[_0x2730b7];return _0x28f1f4;};'use strict';var Sequelize=require(_0x0a39('0x0'));module['exports']={'integration':{'type':Sequelize['STRING']},'eventChannel':{'type':Sequelize['STRING']},'exitStatus':{'type':Sequelize[_0x0a39('0x1')]},'ticketId':{'type':Sequelize['STRING']},'integrationId':{'type':Sequelize[_0x0a39('0x2')]},'contacts':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize[_0x0a39('0x1')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x0a39('0x1')]},'queue':{'type':Sequelize[_0x0a39('0x1')]},'interface':{'type':Sequelize['STRING']},'membername':{'type':Sequelize['STRING']},'agentcalledAt':{'type':Sequelize[_0x0a39('0x3')]},'agentconnectAt':{'type':Sequelize['DATE']},'holdtime':{'type':Sequelize[_0x0a39('0x2')]},'agentcomplete':{'type':Sequelize[_0x0a39('0x4')],'defaultValue':![]},'agentcompleteAt':{'type':Sequelize[_0x0a39('0x3')]},'talktime':{'type':Sequelize[_0x0a39('0x2')]},'agentacw':{'type':Sequelize[_0x0a39('0x4')],'defaultValue':![]},'acwtime':{'type':Sequelize[_0x0a39('0x2')]},'reason':{'type':Sequelize[_0x0a39('0x1')]},'agentringnoanswer':{'type':Sequelize[_0x0a39('0x4')],'defaultValue':![]},'agentringnoanswerAt':{'type':Sequelize[_0x0a39('0x3')]},'agentdump':{'type':Sequelize[_0x0a39('0x4')],'defaultValue':![]},'agentdumpAt':{'type':Sequelize[_0x0a39('0x3')]},'lastevent':{'type':Sequelize[_0x0a39('0x1')]},'channel':{'type':Sequelize[_0x0a39('0x1')]},'channelstate':{'type':Sequelize[_0x0a39('0x2')]},'channelstatedesc':{'type':Sequelize[_0x0a39('0x1')]},'connectedlinenum':{'type':Sequelize[_0x0a39('0x1')]},'connectedlinename':{'type':Sequelize[_0x0a39('0x1')]},'language':{'type':Sequelize[_0x0a39('0x1')]},'accountcode':{'type':Sequelize[_0x0a39('0x1')]},'context':{'type':Sequelize[_0x0a39('0x1')]},'exten':{'type':Sequelize[_0x0a39('0x1')]},'priority':{'type':Sequelize[_0x0a39('0x1')]},'destchannel':{'type':Sequelize[_0x0a39('0x1')]},'destchannelstate':{'type':Sequelize[_0x0a39('0x2')]},'destchannelstatedesc':{'type':Sequelize[_0x0a39('0x1')]},'destcalleridnum':{'type':Sequelize['STRING']},'destcalleridname':{'type':Sequelize[_0x0a39('0x1')]},'destconnectedlinenum':{'type':Sequelize['STRING']},'destconnectedlinename':{'type':Sequelize[_0x0a39('0x1')]},'destlanguage':{'type':Sequelize[_0x0a39('0x1')]},'destaccountcode':{'type':Sequelize[_0x0a39('0x1')]},'destcontext':{'type':Sequelize['STRING']},'destexten':{'type':Sequelize[_0x0a39('0x1')]},'destpriority':{'type':Sequelize[_0x0a39('0x1')]},'destuniqueid':{'type':Sequelize[_0x0a39('0x1')]},'messageId':{'type':Sequelize[_0x0a39('0x1')]},'inReplyTo':{'type':Sequelize['STRING']},'subject':{'type':Sequelize['STRING']},'from':{'type':Sequelize[_0x0a39('0x1')]},'to':{'type':Sequelize[_0x0a39('0x1')]},'cc':{'type':Sequelize[_0x0a39('0x1')]},'attachment':{'type':Sequelize[_0x0a39('0x5')]},'html':{'type':Sequelize[_0x0a39('0x5')]},'text':{'type':Sequelize[_0x0a39('0x5')]},'status':{'type':Sequelize[_0x0a39('0x6')](_0x0a39('0x7'),_0x0a39('0x8'),_0x0a39('0x9'),_0x0a39('0xa'))},'url':{'type':Sequelize[_0x0a39('0x1')]},'app':{'type':Sequelize[_0x0a39('0x1')]},'appdata':{'type':Sequelize[_0x0a39('0x1')]},'projectId':{'type':Sequelize[_0x0a39('0x2')]}}; \ No newline at end of file +var _0x4b3d=['INTEGER','DATE','BOOLEAN','TEXT','ENUM','SENT','SENDING','RECEIVED','sequelize','exports','STRING'];(function(_0x12e09,_0x213b18){var _0x594e27=function(_0x16e73c){while(--_0x16e73c){_0x12e09['push'](_0x12e09['shift']());}};_0x594e27(++_0x213b18);}(_0x4b3d,0x173));var _0xd4b3=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x4b3d[_0x20a584];return _0x4b41a8;};'use strict';var Sequelize=require(_0xd4b3('0x0'));module[_0xd4b3('0x1')]={'integration':{'type':Sequelize[_0xd4b3('0x2')]},'eventChannel':{'type':Sequelize[_0xd4b3('0x2')]},'exitStatus':{'type':Sequelize[_0xd4b3('0x2')]},'ticketId':{'type':Sequelize[_0xd4b3('0x2')]},'integrationId':{'type':Sequelize[_0xd4b3('0x3')]},'contacts':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize[_0xd4b3('0x2')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0xd4b3('0x2')]},'queue':{'type':Sequelize[_0xd4b3('0x2')]},'interface':{'type':Sequelize[_0xd4b3('0x2')]},'membername':{'type':Sequelize[_0xd4b3('0x2')]},'agentcalledAt':{'type':Sequelize[_0xd4b3('0x4')]},'agentconnectAt':{'type':Sequelize[_0xd4b3('0x4')]},'holdtime':{'type':Sequelize[_0xd4b3('0x3')]},'agentcomplete':{'type':Sequelize[_0xd4b3('0x5')],'defaultValue':![]},'agentcompleteAt':{'type':Sequelize['DATE']},'talktime':{'type':Sequelize[_0xd4b3('0x3')]},'agentacw':{'type':Sequelize[_0xd4b3('0x5')],'defaultValue':![]},'acwtime':{'type':Sequelize[_0xd4b3('0x3')]},'reason':{'type':Sequelize['STRING']},'agentringnoanswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentringnoanswerAt':{'type':Sequelize[_0xd4b3('0x4')]},'agentdump':{'type':Sequelize[_0xd4b3('0x5')],'defaultValue':![]},'agentdumpAt':{'type':Sequelize['DATE']},'lastevent':{'type':Sequelize[_0xd4b3('0x2')]},'channel':{'type':Sequelize['STRING']},'channelstate':{'type':Sequelize[_0xd4b3('0x3')]},'channelstatedesc':{'type':Sequelize[_0xd4b3('0x2')]},'connectedlinenum':{'type':Sequelize[_0xd4b3('0x2')]},'connectedlinename':{'type':Sequelize[_0xd4b3('0x2')]},'language':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0xd4b3('0x2')]},'context':{'type':Sequelize[_0xd4b3('0x2')]},'exten':{'type':Sequelize[_0xd4b3('0x2')]},'priority':{'type':Sequelize[_0xd4b3('0x2')]},'destchannel':{'type':Sequelize['STRING']},'destchannelstate':{'type':Sequelize[_0xd4b3('0x3')]},'destchannelstatedesc':{'type':Sequelize[_0xd4b3('0x2')]},'destcalleridnum':{'type':Sequelize['STRING']},'destcalleridname':{'type':Sequelize[_0xd4b3('0x2')]},'destconnectedlinenum':{'type':Sequelize[_0xd4b3('0x2')]},'destconnectedlinename':{'type':Sequelize['STRING']},'destlanguage':{'type':Sequelize[_0xd4b3('0x2')]},'destaccountcode':{'type':Sequelize[_0xd4b3('0x2')]},'destcontext':{'type':Sequelize[_0xd4b3('0x2')]},'destexten':{'type':Sequelize[_0xd4b3('0x2')]},'destpriority':{'type':Sequelize[_0xd4b3('0x2')]},'destuniqueid':{'type':Sequelize['STRING']},'messageId':{'type':Sequelize['STRING']},'inReplyTo':{'type':Sequelize['STRING']},'subject':{'type':Sequelize[_0xd4b3('0x2')]},'from':{'type':Sequelize['STRING']},'to':{'type':Sequelize['STRING']},'cc':{'type':Sequelize[_0xd4b3('0x2')]},'attachment':{'type':Sequelize[_0xd4b3('0x6')]},'html':{'type':Sequelize[_0xd4b3('0x6')]},'text':{'type':Sequelize[_0xd4b3('0x6')]},'status':{'type':Sequelize[_0xd4b3('0x7')](_0xd4b3('0x8'),_0xd4b3('0x9'),_0xd4b3('0xa'),'FAILED')},'url':{'type':Sequelize[_0xd4b3('0x2')]},'app':{'type':Sequelize[_0xd4b3('0x2')]},'appdata':{'type':Sequelize[_0xd4b3('0x2')]},'projectId':{'type':Sequelize[_0xd4b3('0x3')]}}; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.controller.js b/server/api/integrationReport/integrationReport.controller.js index cacf32a..78fea8c 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 _0xd619=['html-pdf','eml-format','moment','bluebird','mustache','sox','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','sendStatus','status','json','offset','limit','set','apply','reject','save','update','then','destroy','end','error','stack','name','send','index','IntegrationReport','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','map','VIRTUAL','count','includeAll','include','findAll','rows','rawAttributes','options','catch','create','body','find','params','describe'];(function(_0x1fb1c1,_0x4ebe69){var _0x1622df=function(_0x52b793){while(--_0x52b793){_0x1fb1c1['push'](_0x1fb1c1['shift']());}};_0x1622df(++_0x4ebe69);}(_0xd619,0x1f1));var _0x9d61=function(_0x599f41,_0x4db732){_0x599f41=_0x599f41-0x0;var _0x2e4d58=_0xd619[_0x599f41];return _0x2e4d58;};'use strict';var pdf=require(_0x9d61('0x0'));var emlformat=require(_0x9d61('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x9d61('0x2'));var BPromise=require(_0x9d61('0x3'));var Mustache=require(_0x9d61('0x4'));var util=require('util');var path=require('path');var sox=require(_0x9d61('0x5'));var csv=require('to-csv');var ejs=require(_0x9d61('0x6'));var fs=require('fs');var _=require(_0x9d61('0x7'));var squel=require(_0x9d61('0x8'));var crypto=require(_0x9d61('0x9'));var jsforce=require(_0x9d61('0xa'));var deskjs=require(_0x9d61('0xb'));var toCsv=require(_0x9d61('0xc'));var querystring=require(_0x9d61('0xd'));var Papa=require(_0x9d61('0xe'));var Redis=require(_0x9d61('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x9d61('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x9d61('0x11'));var logger=require('../../config/logger')(_0x9d61('0x12'));var utils=require(_0x9d61('0x13'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x484bbc,_0x19d774){_0x19d774=_0x19d774||0xcc;return function(_0x4e87d0){if(_0x4e87d0){return _0x484bbc[_0x9d61('0x14')](_0x19d774);}return _0x484bbc[_0x9d61('0x15')](_0x19d774)['end']();};}function respondWithResult(_0x4cbe2f,_0x219c61){_0x219c61=_0x219c61||0xc8;return function(_0x2c5c19){if(_0x2c5c19){return _0x4cbe2f[_0x9d61('0x15')](_0x219c61)[_0x9d61('0x16')](_0x2c5c19);}};}function respondWithFilteredResult(_0x94baaa,_0x251b80){return function(_0x359ed5){if(_0x359ed5){var _0x40478e=_0x359ed5['count'],_0x959292=_0x251b80[_0x9d61('0x17')],_0x5509c9=_0x251b80[_0x9d61('0x17')]+_0x251b80[_0x9d61('0x18')],_0x2fd07b;if(_0x5509c9>=_0x40478e){_0x5509c9=_0x40478e;_0x2fd07b=0xc8;}else{_0x2fd07b=0xce;}_0x94baaa[_0x9d61('0x15')](_0x2fd07b);return _0x94baaa[_0x9d61('0x19')]('Content-Range',_0x959292+'-'+_0x5509c9+'/'+_0x40478e)[_0x9d61('0x16')](_0x359ed5);}return null;};}function patchUpdates(_0xde1507){return function(_0x5ec76f){try{jsonpatch[_0x9d61('0x1a')](_0x5ec76f,_0xde1507,!![]);}catch(_0x499455){return BPromise[_0x9d61('0x1b')](_0x499455);}return _0x5ec76f[_0x9d61('0x1c')]();};}function saveUpdates(_0x4adaf9,_0x10267e){return function(_0x458a98){if(_0x458a98){return _0x458a98[_0x9d61('0x1d')](_0x4adaf9)[_0x9d61('0x1e')](function(_0x239a06){return _0x239a06;});}return null;};}function removeEntity(_0x378aae,_0x24b73d){return function(_0x566a18){if(_0x566a18){return _0x566a18[_0x9d61('0x1f')]()[_0x9d61('0x1e')](function(){_0x378aae[_0x9d61('0x15')](0xcc)[_0x9d61('0x20')]();});}};}function handleEntityNotFound(_0x187dee,_0x2e33b8){return function(_0x22b725){if(!_0x22b725){_0x187dee[_0x9d61('0x14')](0x194);}return _0x22b725;};}function handleError(_0x58a3b8,_0x11f666){_0x11f666=_0x11f666||0x1f4;return function(_0x18dadc){logger[_0x9d61('0x21')](_0x18dadc[_0x9d61('0x22')]);if(_0x18dadc[_0x9d61('0x23')]){delete _0x18dadc['name'];}_0x58a3b8[_0x9d61('0x15')](_0x11f666)[_0x9d61('0x24')](_0x18dadc);};}exports[_0x9d61('0x25')]=function(_0x398b5f,_0x5cebe7){var _0x2b2c2b={},_0x3d7068={},_0x21b041={'count':0x0,'rows':[]};var _0x268e11=_['map'](db[_0x9d61('0x26')]['rawAttributes'],function(_0x49aceb){return{'name':_0x49aceb[_0x9d61('0x27')],'type':_0x49aceb[_0x9d61('0x28')]['key']};});_0x3d7068[_0x9d61('0x29')]=_['map'](_0x268e11,_0x9d61('0x23'));_0x3d7068[_0x9d61('0x2a')]=_[_0x9d61('0x2b')](_0x398b5f[_0x9d61('0x2a')]);_0x3d7068[_0x9d61('0x2c')]=_[_0x9d61('0x2d')](_0x3d7068['model'],_0x3d7068[_0x9d61('0x2a')]);_0x2b2c2b[_0x9d61('0x2e')]=_['intersection'](_0x3d7068[_0x9d61('0x29')],qs[_0x9d61('0x2f')](_0x398b5f[_0x9d61('0x2a')][_0x9d61('0x2f')]));_0x2b2c2b[_0x9d61('0x2e')]=_0x2b2c2b[_0x9d61('0x2e')][_0x9d61('0x30')]?_0x2b2c2b[_0x9d61('0x2e')]:_0x3d7068[_0x9d61('0x29')];if(!_0x398b5f[_0x9d61('0x2a')][_0x9d61('0x31')]('nolimit')){_0x2b2c2b[_0x9d61('0x18')]=qs[_0x9d61('0x18')](_0x398b5f[_0x9d61('0x2a')][_0x9d61('0x18')]);_0x2b2c2b[_0x9d61('0x17')]=qs[_0x9d61('0x17')](_0x398b5f['query'][_0x9d61('0x17')]);}_0x2b2c2b[_0x9d61('0x32')]=qs[_0x9d61('0x33')](_0x398b5f[_0x9d61('0x2a')][_0x9d61('0x33')]);_0x2b2c2b[_0x9d61('0x34')]=qs['filters'](_[_0x9d61('0x35')](_0x398b5f[_0x9d61('0x2a')],_0x3d7068[_0x9d61('0x2c')]),_0x268e11);if(_0x398b5f[_0x9d61('0x2a')][_0x9d61('0x36')]){_0x2b2c2b[_0x9d61('0x34')]=_[_0x9d61('0x37')](_0x2b2c2b[_0x9d61('0x34')],{'$or':_[_0x9d61('0x38')](_0x268e11,function(_0x23377c){if(_0x23377c[_0x9d61('0x28')]!==_0x9d61('0x39')){var _0x46b37b={};_0x46b37b[_0x23377c['name']]={'$like':'%'+_0x398b5f[_0x9d61('0x2a')]['filter']+'%'};return _0x46b37b;}})});}_0x2b2c2b=_[_0x9d61('0x37')]({},_0x2b2c2b,_0x398b5f['options']);var _0xaf6fb3={'where':_0x2b2c2b[_0x9d61('0x34')]};return db[_0x9d61('0x26')][_0x9d61('0x3a')](_0xaf6fb3)[_0x9d61('0x1e')](function(_0x4e06ed){_0x21b041[_0x9d61('0x3a')]=_0x4e06ed;if(_0x398b5f[_0x9d61('0x2a')][_0x9d61('0x3b')]){_0x2b2c2b[_0x9d61('0x3c')]=[{'all':!![]}];}return db[_0x9d61('0x26')][_0x9d61('0x3d')](_0x2b2c2b);})[_0x9d61('0x1e')](function(_0x2e519b){_0x21b041[_0x9d61('0x3e')]=_0x2e519b;return _0x21b041;})[_0x9d61('0x1e')](respondWithFilteredResult(_0x5cebe7,_0x2b2c2b))['catch'](handleError(_0x5cebe7,null));};exports['show']=function(_0x60f7a6,_0x5655d7){var _0x147e86={'raw':![],'where':{'id':_0x60f7a6['params']['id']}},_0x18e0f4={};_0x18e0f4[_0x9d61('0x29')]=_[_0x9d61('0x2b')](db[_0x9d61('0x26')][_0x9d61('0x3f')]);_0x18e0f4[_0x9d61('0x2a')]=_[_0x9d61('0x2b')](_0x60f7a6[_0x9d61('0x2a')]);_0x18e0f4[_0x9d61('0x2c')]=_[_0x9d61('0x2d')](_0x18e0f4[_0x9d61('0x29')],_0x18e0f4[_0x9d61('0x2a')]);_0x147e86[_0x9d61('0x2e')]=_['intersection'](_0x18e0f4[_0x9d61('0x29')],qs[_0x9d61('0x2f')](_0x60f7a6[_0x9d61('0x2a')][_0x9d61('0x2f')]));_0x147e86['attributes']=_0x147e86[_0x9d61('0x2e')][_0x9d61('0x30')]?_0x147e86[_0x9d61('0x2e')]:_0x18e0f4[_0x9d61('0x29')];if(_0x60f7a6['query'][_0x9d61('0x3b')]){_0x147e86[_0x9d61('0x3c')]=[{'all':!![]}];}_0x147e86=_[_0x9d61('0x37')]({},_0x147e86,_0x60f7a6[_0x9d61('0x40')]);return db[_0x9d61('0x26')]['find'](_0x147e86)[_0x9d61('0x1e')](handleEntityNotFound(_0x5655d7,null))['then'](respondWithResult(_0x5655d7,null))[_0x9d61('0x41')](handleError(_0x5655d7,null));};exports['create']=function(_0x47c1c,_0x2f5ee4){return db[_0x9d61('0x26')][_0x9d61('0x42')](_0x47c1c[_0x9d61('0x43')],{})['then'](respondWithResult(_0x2f5ee4,0xc9))['catch'](handleError(_0x2f5ee4,null));};exports[_0x9d61('0x1d')]=function(_0x4fd95b,_0x100b32){if(_0x4fd95b[_0x9d61('0x43')]['id']){delete _0x4fd95b[_0x9d61('0x43')]['id'];}return db[_0x9d61('0x26')][_0x9d61('0x44')]({'where':{'id':_0x4fd95b[_0x9d61('0x45')]['id']}})[_0x9d61('0x1e')](handleEntityNotFound(_0x100b32,null))[_0x9d61('0x1e')](saveUpdates(_0x4fd95b[_0x9d61('0x43')],null))[_0x9d61('0x1e')](respondWithResult(_0x100b32,null))['catch'](handleError(_0x100b32,null));};exports['destroy']=function(_0x51e9fe,_0x2184d6){return db[_0x9d61('0x26')][_0x9d61('0x44')]({'where':{'id':_0x51e9fe['params']['id']}})[_0x9d61('0x1e')](handleEntityNotFound(_0x2184d6,null))[_0x9d61('0x1e')](removeEntity(_0x2184d6,null))[_0x9d61('0x41')](handleError(_0x2184d6,null));};exports[_0x9d61('0x46')]=function(_0x2a0f09,_0x538b09){return db[_0x9d61('0x26')][_0x9d61('0x46')]()[_0x9d61('0x1e')](respondWithResult(_0x538b09,null))[_0x9d61('0x41')](handleError(_0x538b09,null));}; \ No newline at end of file +var _0x5e42=['options','IntegrationReport','catch','show','includeAll','include','find','create','body','destroy','params','describe','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','to-csv','ejs','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','count','offset','limit','Content-Range','reject','save','update','then','stack','name','send','index','map','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','filter','where','VIRTUAL','merge'];(function(_0x5061b1,_0x426a56){var _0x2996b0=function(_0x15a3f1){while(--_0x15a3f1){_0x5061b1['push'](_0x5061b1['shift']());}};_0x2996b0(++_0x426a56);}(_0x5e42,0xdb));var _0x25e4=function(_0x5b8310,_0x77ea6f){_0x5b8310=_0x5b8310-0x0;var _0xd3ebc1=_0x5e42[_0x5b8310];return _0xd3ebc1;};'use strict';var pdf=require(_0x25e4('0x0'));var emlformat=require(_0x25e4('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x25e4('0x2'));var jsonpatch=require(_0x25e4('0x3'));var rp=require(_0x25e4('0x4'));var moment=require(_0x25e4('0x5'));var BPromise=require(_0x25e4('0x6'));var Mustache=require(_0x25e4('0x7'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0x25e4('0x8'));var ejs=require(_0x25e4('0x9'));var fs=require('fs');var _=require('lodash');var squel=require(_0x25e4('0xa'));var crypto=require(_0x25e4('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x25e4('0xc'));var toCsv=require(_0x25e4('0x8'));var querystring=require(_0x25e4('0xd'));var Papa=require(_0x25e4('0xe'));var Redis=require(_0x25e4('0xf'));var authService=require(_0x25e4('0x10'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x25e4('0x11'));var logger=require(_0x25e4('0x12'))('api');var utils=require(_0x25e4('0x13'));var config=require(_0x25e4('0x14'));var db=require(_0x25e4('0x15'))['db'];function respondWithStatusCode(_0x421b2c,_0xd6f205){_0xd6f205=_0xd6f205||0xcc;return function(_0x53f93f){if(_0x53f93f){return _0x421b2c[_0x25e4('0x16')](_0xd6f205);}return _0x421b2c['status'](_0xd6f205)['end']();};}function respondWithResult(_0x3eb21d,_0x55d7e6){_0x55d7e6=_0x55d7e6||0xc8;return function(_0x3bddbd){if(_0x3bddbd){return _0x3eb21d[_0x25e4('0x17')](_0x55d7e6)[_0x25e4('0x18')](_0x3bddbd);}};}function respondWithFilteredResult(_0x1ba896,_0x1eec62){return function(_0x5b6ebf){if(_0x5b6ebf){var _0x5c3c7a=_0x5b6ebf[_0x25e4('0x19')],_0xf4db71=_0x1eec62[_0x25e4('0x1a')],_0x3058dd=_0x1eec62[_0x25e4('0x1a')]+_0x1eec62[_0x25e4('0x1b')],_0x1c9767;if(_0x3058dd>=_0x5c3c7a){_0x3058dd=_0x5c3c7a;_0x1c9767=0xc8;}else{_0x1c9767=0xce;}_0x1ba896[_0x25e4('0x17')](_0x1c9767);return _0x1ba896['set'](_0x25e4('0x1c'),_0xf4db71+'-'+_0x3058dd+'/'+_0x5c3c7a)[_0x25e4('0x18')](_0x5b6ebf);}return null;};}function patchUpdates(_0x59a2f9){return function(_0xba4448){try{jsonpatch['apply'](_0xba4448,_0x59a2f9,!![]);}catch(_0x57f8f1){return BPromise[_0x25e4('0x1d')](_0x57f8f1);}return _0xba4448[_0x25e4('0x1e')]();};}function saveUpdates(_0x915aa6,_0x14eb1b){return function(_0x1e94c4){if(_0x1e94c4){return _0x1e94c4[_0x25e4('0x1f')](_0x915aa6)[_0x25e4('0x20')](function(_0x2ac29f){return _0x2ac29f;});}return null;};}function removeEntity(_0x2f41ba,_0x28fb38){return function(_0x47a2cb){if(_0x47a2cb){return _0x47a2cb['destroy']()['then'](function(){_0x2f41ba[_0x25e4('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4107d8,_0x3a4014){return function(_0x160982){if(!_0x160982){_0x4107d8[_0x25e4('0x16')](0x194);}return _0x160982;};}function handleError(_0x3ce245,_0x58cc5b){_0x58cc5b=_0x58cc5b||0x1f4;return function(_0x1a6bc8){logger['error'](_0x1a6bc8[_0x25e4('0x21')]);if(_0x1a6bc8['name']){delete _0x1a6bc8[_0x25e4('0x22')];}_0x3ce245[_0x25e4('0x17')](_0x58cc5b)[_0x25e4('0x23')](_0x1a6bc8);};}exports[_0x25e4('0x24')]=function(_0x12a330,_0x52d35d){var _0x1cd2a9={},_0x115023={},_0x276edf={'count':0x0,'rows':[]};var _0x14ec43=_[_0x25e4('0x25')](db['IntegrationReport'][_0x25e4('0x26')],function(_0x381c72){return{'name':_0x381c72[_0x25e4('0x27')],'type':_0x381c72[_0x25e4('0x28')][_0x25e4('0x29')]};});_0x115023['model']=_[_0x25e4('0x25')](_0x14ec43,_0x25e4('0x22'));_0x115023[_0x25e4('0x2a')]=_[_0x25e4('0x2b')](_0x12a330[_0x25e4('0x2a')]);_0x115023[_0x25e4('0x2c')]=_[_0x25e4('0x2d')](_0x115023['model'],_0x115023[_0x25e4('0x2a')]);_0x1cd2a9['attributes']=_['intersection'](_0x115023[_0x25e4('0x2e')],qs[_0x25e4('0x2f')](_0x12a330[_0x25e4('0x2a')][_0x25e4('0x2f')]));_0x1cd2a9[_0x25e4('0x30')]=_0x1cd2a9[_0x25e4('0x30')][_0x25e4('0x31')]?_0x1cd2a9[_0x25e4('0x30')]:_0x115023['model'];if(!_0x12a330[_0x25e4('0x2a')][_0x25e4('0x32')](_0x25e4('0x33'))){_0x1cd2a9[_0x25e4('0x1b')]=qs['limit'](_0x12a330['query'][_0x25e4('0x1b')]);_0x1cd2a9[_0x25e4('0x1a')]=qs[_0x25e4('0x1a')](_0x12a330['query'][_0x25e4('0x1a')]);}_0x1cd2a9[_0x25e4('0x34')]=qs['sort'](_0x12a330['query']['sort']);_0x1cd2a9['where']=qs[_0x25e4('0x2c')](_['pick'](_0x12a330[_0x25e4('0x2a')],_0x115023[_0x25e4('0x2c')]),_0x14ec43);if(_0x12a330[_0x25e4('0x2a')][_0x25e4('0x35')]){_0x1cd2a9['where']=_['merge'](_0x1cd2a9[_0x25e4('0x36')],{'$or':_['map'](_0x14ec43,function(_0x1af44b){if(_0x1af44b['type']!==_0x25e4('0x37')){var _0x3dda18={};_0x3dda18[_0x1af44b[_0x25e4('0x22')]]={'$like':'%'+_0x12a330[_0x25e4('0x2a')]['filter']+'%'};return _0x3dda18;}})});}_0x1cd2a9=_[_0x25e4('0x38')]({},_0x1cd2a9,_0x12a330[_0x25e4('0x39')]);var _0x28b118={'where':_0x1cd2a9[_0x25e4('0x36')]};return db[_0x25e4('0x3a')][_0x25e4('0x19')](_0x28b118)['then'](function(_0xbb9907){_0x276edf['count']=_0xbb9907;if(_0x12a330[_0x25e4('0x2a')]['includeAll']){_0x1cd2a9['include']=[{'all':!![]}];}return db[_0x25e4('0x3a')]['findAll'](_0x1cd2a9);})[_0x25e4('0x20')](function(_0x521722){_0x276edf['rows']=_0x521722;return _0x276edf;})[_0x25e4('0x20')](respondWithFilteredResult(_0x52d35d,_0x1cd2a9))[_0x25e4('0x3b')](handleError(_0x52d35d,null));};exports[_0x25e4('0x3c')]=function(_0x1bb71e,_0x5f0257){var _0x98b230={'raw':![],'where':{'id':_0x1bb71e['params']['id']}},_0x5341af={};_0x5341af[_0x25e4('0x2e')]=_[_0x25e4('0x2b')](db[_0x25e4('0x3a')]['rawAttributes']);_0x5341af[_0x25e4('0x2a')]=_[_0x25e4('0x2b')](_0x1bb71e[_0x25e4('0x2a')]);_0x5341af['filters']=_[_0x25e4('0x2d')](_0x5341af[_0x25e4('0x2e')],_0x5341af['query']);_0x98b230[_0x25e4('0x30')]=_[_0x25e4('0x2d')](_0x5341af[_0x25e4('0x2e')],qs['fields'](_0x1bb71e[_0x25e4('0x2a')][_0x25e4('0x2f')]));_0x98b230[_0x25e4('0x30')]=_0x98b230[_0x25e4('0x30')]['length']?_0x98b230[_0x25e4('0x30')]:_0x5341af[_0x25e4('0x2e')];if(_0x1bb71e['query'][_0x25e4('0x3d')]){_0x98b230[_0x25e4('0x3e')]=[{'all':!![]}];}_0x98b230=_[_0x25e4('0x38')]({},_0x98b230,_0x1bb71e['options']);return db[_0x25e4('0x3a')][_0x25e4('0x3f')](_0x98b230)[_0x25e4('0x20')](handleEntityNotFound(_0x5f0257,null))[_0x25e4('0x20')](respondWithResult(_0x5f0257,null))['catch'](handleError(_0x5f0257,null));};exports[_0x25e4('0x40')]=function(_0x1aa4be,_0xe3cc86){return db[_0x25e4('0x3a')][_0x25e4('0x40')](_0x1aa4be[_0x25e4('0x41')],{})[_0x25e4('0x20')](respondWithResult(_0xe3cc86,0xc9))['catch'](handleError(_0xe3cc86,null));};exports[_0x25e4('0x1f')]=function(_0x4f6d2c,_0x3e671d){if(_0x4f6d2c[_0x25e4('0x41')]['id']){delete _0x4f6d2c[_0x25e4('0x41')]['id'];}return db[_0x25e4('0x3a')][_0x25e4('0x3f')]({'where':{'id':_0x4f6d2c['params']['id']}})['then'](handleEntityNotFound(_0x3e671d,null))[_0x25e4('0x20')](saveUpdates(_0x4f6d2c[_0x25e4('0x41')],null))[_0x25e4('0x20')](respondWithResult(_0x3e671d,null))[_0x25e4('0x3b')](handleError(_0x3e671d,null));};exports[_0x25e4('0x42')]=function(_0x2be975,_0xd7ffb6){return db[_0x25e4('0x3a')][_0x25e4('0x3f')]({'where':{'id':_0x2be975[_0x25e4('0x43')]['id']}})['then'](handleEntityNotFound(_0xd7ffb6,null))[_0x25e4('0x20')](removeEntity(_0xd7ffb6,null))['catch'](handleError(_0xd7ffb6,null));};exports[_0x25e4('0x44')]=function(_0x49cfdc,_0x55e492){return db[_0x25e4('0x3a')]['describe']()[_0x25e4('0x20')](respondWithResult(_0x55e492,null))[_0x25e4('0x3b')](handleError(_0x55e492,null));}; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.model.js b/server/api/integrationReport/integrationReport.model.js index 01a0e62..6e43f0a 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 _0x04aa=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./integrationReport.attributes','exports','define','lodash','util'];(function(_0x1ed513,_0x3d0381){var _0x250dc6=function(_0x2ac936){while(--_0x2ac936){_0x1ed513['push'](_0x1ed513['shift']());}};_0x250dc6(++_0x3d0381);}(_0x04aa,0x8d));var _0xa04a=function(_0x267092,_0x177b40){_0x267092=_0x267092-0x0;var _0xb37392=_0x04aa[_0x267092];return _0xb37392;};'use strict';var _=require(_0xa04a('0x0'));var util=require(_0xa04a('0x1'));var logger=require(_0xa04a('0x2'))(_0xa04a('0x3'));var moment=require(_0xa04a('0x4'));var BPromise=require(_0xa04a('0x5'));var rp=require(_0xa04a('0x6'));var fs=require('fs');var path=require(_0xa04a('0x7'));var rimraf=require(_0xa04a('0x8'));var config=require(_0xa04a('0x9'));var attributes=require(_0xa04a('0xa'));module[_0xa04a('0xb')]=function(_0x4a3a5b,_0x3be790){return _0x4a3a5b[_0xa04a('0xc')]('IntegrationReport',attributes,{'tableName':'report_integration','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6434=['util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./integrationReport.attributes','exports','define','report_integration'];(function(_0x4b5d3b,_0x49be21){var _0x48ec2a=function(_0x126feb){while(--_0x126feb){_0x4b5d3b['push'](_0x4b5d3b['shift']());}};_0x48ec2a(++_0x49be21);}(_0x6434,0x1a4));var _0x4643=function(_0x118df4,_0x4c268d){_0x118df4=_0x118df4-0x0;var _0x53201a=_0x6434[_0x118df4];return _0x53201a;};'use strict';var _=require('lodash');var util=require(_0x4643('0x0'));var logger=require(_0x4643('0x1'))(_0x4643('0x2'));var moment=require(_0x4643('0x3'));var BPromise=require(_0x4643('0x4'));var rp=require(_0x4643('0x5'));var fs=require('fs');var path=require(_0x4643('0x6'));var rimraf=require(_0x4643('0x7'));var config=require('../../config/environment');var attributes=require(_0x4643('0x8'));module[_0x4643('0x9')]=function(_0x1f78e5,_0x16442b){return _0x1f78e5[_0x4643('0xa')]('IntegrationReport',attributes,{'tableName':_0x4643('0xb'),'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 69d9510..d7579cc 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 _0x0b0e=['IntegrationReport,\x20%s,\x20%s,\x20%s','stringify','error','message','request\x20sent','result','catch','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','IntegrationReport,\x20%s,\x20%s','debug'];(function(_0x4d79bc,_0x32c905){var _0x4b4760=function(_0x212302){while(--_0x212302){_0x4d79bc['push'](_0x4d79bc['shift']());}};_0x4b4760(++_0x32c905);}(_0x0b0e,0x187));var _0xe0b0=function(_0x41c88c,_0x381f8d){_0x41c88c=_0x41c88c-0x0;var _0x2c97ea=_0x0b0e[_0x41c88c];return _0x2c97ea;};'use strict';var _=require(_0xe0b0('0x0'));var util=require('util');var moment=require(_0xe0b0('0x1'));var BPromise=require('bluebird');var rs=require(_0xe0b0('0x2'));var fs=require('fs');var Redis=require(_0xe0b0('0x3'));var db=require(_0xe0b0('0x4'))['db'];var utils=require(_0xe0b0('0x5'));var logger=require(_0xe0b0('0x6'))(_0xe0b0('0x7'));var config=require(_0xe0b0('0x8'));var jayson=require(_0xe0b0('0x9'));var client=jayson[_0xe0b0('0xa')][_0xe0b0('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x219b1c,_0x5cf9cc,_0x50be7f){return new BPromise(function(_0x11effc,_0x435060){return client[_0xe0b0('0xc')](_0x219b1c,_0x50be7f)[_0xe0b0('0xd')](function(_0x4c24f9){logger[_0xe0b0('0xe')](_0xe0b0('0xf'),_0x5cf9cc,'request\x20sent');logger[_0xe0b0('0x10')](_0xe0b0('0x11'),_0x5cf9cc,'request\x20sent',JSON[_0xe0b0('0x12')](_0x4c24f9));if(_0x4c24f9[_0xe0b0('0x13')]){if(_0x4c24f9[_0xe0b0('0x13')]['code']===0x1f4){logger[_0xe0b0('0x13')](_0xe0b0('0xf'),_0x5cf9cc,_0x4c24f9[_0xe0b0('0x13')][_0xe0b0('0x14')]);return _0x435060(_0x4c24f9[_0xe0b0('0x13')]['message']);}logger[_0xe0b0('0x13')](_0xe0b0('0xf'),_0x5cf9cc,_0x4c24f9[_0xe0b0('0x13')][_0xe0b0('0x14')]);return _0x11effc(_0x4c24f9[_0xe0b0('0x13')]['message']);}else{logger[_0xe0b0('0xe')]('IntegrationReport,\x20%s,\x20%s',_0x5cf9cc,_0xe0b0('0x15'));_0x11effc(_0x4c24f9[_0xe0b0('0x16')]['message']);}})[_0xe0b0('0x17')](function(_0x4a4cc0){logger[_0xe0b0('0x13')](_0xe0b0('0xf'),_0x5cf9cc,_0x4a4cc0);_0x435060(_0x4a4cc0);});});} \ No newline at end of file +var _0x8603=['message','info','result','catch','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','then','IntegrationReport,\x20%s,\x20%s','request\x20sent','IntegrationReport,\x20%s,\x20%s,\x20%s','error'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x8603,0x190));var _0x3860=function(_0x45725b,_0x6f132e){_0x45725b=_0x45725b-0x0;var _0x2f65a0=_0x8603[_0x45725b];return _0x2f65a0;};'use strict';var _=require('lodash');var util=require(_0x3860('0x0'));var moment=require(_0x3860('0x1'));var BPromise=require(_0x3860('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x3860('0x3'))['db'];var utils=require(_0x3860('0x4'));var logger=require(_0x3860('0x5'))('rpc');var config=require(_0x3860('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x3860('0x7')][_0x3860('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x1eca44,_0xd3ce26,_0x472bf2){return new BPromise(function(_0x4aba10,_0x5c7350){return client['request'](_0x1eca44,_0x472bf2)[_0x3860('0x9')](function(_0x441dc4){logger['info'](_0x3860('0xa'),_0xd3ce26,_0x3860('0xb'));logger['debug'](_0x3860('0xc'),_0xd3ce26,_0x3860('0xb'),JSON['stringify'](_0x441dc4));if(_0x441dc4[_0x3860('0xd')]){if(_0x441dc4[_0x3860('0xd')]['code']===0x1f4){logger[_0x3860('0xd')](_0x3860('0xa'),_0xd3ce26,_0x441dc4[_0x3860('0xd')][_0x3860('0xe')]);return _0x5c7350(_0x441dc4[_0x3860('0xd')][_0x3860('0xe')]);}logger[_0x3860('0xd')](_0x3860('0xa'),_0xd3ce26,_0x441dc4[_0x3860('0xd')][_0x3860('0xe')]);return _0x4aba10(_0x441dc4['error'][_0x3860('0xe')]);}else{logger[_0x3860('0xf')](_0x3860('0xa'),_0xd3ce26,_0x3860('0xb'));_0x4aba10(_0x441dc4[_0x3860('0x10')][_0x3860('0xe')]);}})[_0x3860('0x11')](function(_0x378305){logger[_0x3860('0xd')](_0x3860('0xa'),_0xd3ce26,_0x378305);_0x5c7350(_0x378305);});});} \ No newline at end of file diff --git a/server/api/interval/index.js b/server/api/interval/index.js index f5bfa7f..27079e9 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 _0x34e8=['./interval.controller','get','isAuthenticated','show','/:id/sub_intervals','getIntervals','post','create','addInterval','/:id/sub_intervals/create_many','addIntervals','/:id','delete','destroy','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x1b9f3a,_0x43ff84){var _0x1c7c64=function(_0x29ebc9){while(--_0x29ebc9){_0x1b9f3a['push'](_0x1b9f3a['shift']());}};_0x1c7c64(++_0x43ff84);}(_0x34e8,0x12c));var _0x834e=function(_0x5deefe,_0x3e83e1){_0x5deefe=_0x5deefe-0x0;var _0x11f269=_0x34e8[_0x5deefe];return _0x11f269;};'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('0x9')](_0x834e('0xc'),auth[_0x834e('0xa')](),controller[_0x834e('0xd')]);router[_0x834e('0xe')]('/',auth[_0x834e('0xa')](),controller[_0x834e('0xf')]);router[_0x834e('0xe')](_0x834e('0xc'),auth[_0x834e('0xa')](),controller[_0x834e('0x10')]);router[_0x834e('0xe')](_0x834e('0x11'),auth[_0x834e('0xa')](),controller[_0x834e('0x12')]);router['put'](_0x834e('0x13'),auth[_0x834e('0xa')](),controller['update']);router[_0x834e('0x14')](_0x834e('0x13'),auth[_0x834e('0xa')](),controller[_0x834e('0x15')]);module['exports']=router; \ No newline at end of file +var _0x7217=['multer','path','connect-timeout','express','Router','../../components/auth/service','./interval.controller','get','isAuthenticated','index','/:id','show','/:id/sub_intervals','getIntervals','post','create','addInterval','/:id/sub_intervals/create_many','addIntervals','put','update','destroy','exports'];(function(_0x2fe5b9,_0x127e48){var _0x6f874=function(_0x23f8e7){while(--_0x23f8e7){_0x2fe5b9['push'](_0x2fe5b9['shift']());}};_0x6f874(++_0x127e48);}(_0x7217,0x19e));var _0x7721=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x7217[_0x5b644e];return _0x49c6bf;};'use strict';var multer=require(_0x7721('0x0'));var util=require('util');var path=require(_0x7721('0x1'));var timeout=require(_0x7721('0x2'));var express=require(_0x7721('0x3'));var router=express[_0x7721('0x4')]();var auth=require(_0x7721('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x7721('0x6'));router[_0x7721('0x7')]('/',auth[_0x7721('0x8')](),controller[_0x7721('0x9')]);router[_0x7721('0x7')](_0x7721('0xa'),auth[_0x7721('0x8')](),controller[_0x7721('0xb')]);router[_0x7721('0x7')](_0x7721('0xc'),auth[_0x7721('0x8')](),controller[_0x7721('0xd')]);router[_0x7721('0xe')]('/',auth[_0x7721('0x8')](),controller[_0x7721('0xf')]);router['post'](_0x7721('0xc'),auth[_0x7721('0x8')](),controller[_0x7721('0x10')]);router[_0x7721('0xe')](_0x7721('0x11'),auth[_0x7721('0x8')](),controller[_0x7721('0x12')]);router[_0x7721('0x13')]('/:id',auth[_0x7721('0x8')](),controller[_0x7721('0x14')]);router['delete'](_0x7721('0xa'),auth[_0x7721('0x8')](),controller[_0x7721('0x15')]);module[_0x7721('0x16')]=router; \ No newline at end of file diff --git a/server/api/interval/interval.attributes.js b/server/api/interval/interval.attributes.js index 873451e..9fafade 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 _0xf411=['exports','STRING'];(function(_0x10e5ff,_0x5eabdb){var _0xf66a50=function(_0x3da0b3){while(--_0x3da0b3){_0x10e5ff['push'](_0x10e5ff['shift']());}};_0xf66a50(++_0x5eabdb);}(_0xf411,0x16e));var _0x1f41=function(_0x2290d4,_0x43d284){_0x2290d4=_0x2290d4-0x0;var _0x1f68ee=_0xf411[_0x2290d4];return _0x1f68ee;};'use strict';var Sequelize=require('sequelize');module[_0x1f41('0x0')]={'name':{'type':Sequelize[_0x1f41('0x1')]},'description':{'type':Sequelize[_0x1f41('0x1')]},'interval':{'type':Sequelize[_0x1f41('0x1')],'allowNull':!![]}}; \ No newline at end of file +var _0xea85=['sequelize','STRING'];(function(_0x5aa5be,_0x390b1f){var _0x1d67ff=function(_0xf19e6){while(--_0xf19e6){_0x5aa5be['push'](_0x5aa5be['shift']());}};_0x1d67ff(++_0x390b1f);}(_0xea85,0x13e));var _0x5ea8=function(_0x444067,_0x4f7f38){_0x444067=_0x444067-0x0;var _0x3c995c=_0xea85[_0x444067];return _0x3c995c;};'use strict';var Sequelize=require(_0x5ea8('0x0'));module['exports']={'name':{'type':Sequelize[_0x5ea8('0x1')]},'description':{'type':Sequelize[_0x5ea8('0x1')]},'interval':{'type':Sequelize[_0x5ea8('0x1')],'allowNull':!![]}}; \ No newline at end of file diff --git a/server/api/interval/interval.controller.js b/server/api/interval/interval.controller.js index b872395..eae8486 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 _0x2db2=['UserProfileResource','sendStatus','stack','name','send','index','map','rawAttributes','type','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','options','Interval','includeAll','include','findAll','params','find','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','autoAssociation','error','addInterval','IntervalId','findOne','order','getIntervals','addIntervals','sequelize','transaction','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','ejs','lodash','crypto','jsforce','desk.js','to-csv','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','status','end','json','count','offset','limit','set','Content-Range','apply','reject','update','then','destroy','get','Intervals'];(function(_0x438dd9,_0x2012f4){var _0x58d206=function(_0x550058){while(--_0x550058){_0x438dd9['push'](_0x438dd9['shift']());}};_0x58d206(++_0x2012f4);}(_0x2db2,0x1ed));var _0x22db=function(_0x2dce9f,_0x1d1880){_0x2dce9f=_0x2dce9f-0x0;var _0x1cd454=_0x2db2[_0x2dce9f];return _0x1cd454;};'use strict';var pdf=require(_0x22db('0x0'));var emlformat=require(_0x22db('0x1'));var rimraf=require(_0x22db('0x2'));var zipdir=require(_0x22db('0x3'));var jsonpatch=require(_0x22db('0x4'));var rp=require(_0x22db('0x5'));var moment=require('moment');var BPromise=require(_0x22db('0x6'));var Mustache=require(_0x22db('0x7'));var util=require(_0x22db('0x8'));var path=require(_0x22db('0x9'));var sox=require(_0x22db('0xa'));var csv=require('to-csv');var ejs=require(_0x22db('0xb'));var fs=require('fs');var _=require(_0x22db('0xc'));var squel=require('squel');var crypto=require(_0x22db('0xd'));var jsforce=require(_0x22db('0xe'));var deskjs=require(_0x22db('0xf'));var toCsv=require(_0x22db('0x10'));var querystring=require(_0x22db('0x11'));var Papa=require('papaparse');var Redis=require(_0x22db('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x22db('0x13'));var as=require(_0x22db('0x14'));var hardwareService=require(_0x22db('0x15'));var logger=require(_0x22db('0x16'))(_0x22db('0x17'));var utils=require('../../config/utils');var config=require(_0x22db('0x18'));var db=require(_0x22db('0x19'))['db'];var extensions=require('../../components/extensions/rewrite');function respondWithStatusCode(_0xf525d3,_0x534859){_0x534859=_0x534859||0xcc;return function(_0x5d141f){if(_0x5d141f){return _0xf525d3['sendStatus'](_0x534859);}return _0xf525d3[_0x22db('0x1a')](_0x534859)[_0x22db('0x1b')]();};}function respondWithResult(_0x1559c0,_0x19e77f){_0x19e77f=_0x19e77f||0xc8;return function(_0x4f6a2a){if(_0x4f6a2a){return _0x1559c0[_0x22db('0x1a')](_0x19e77f)[_0x22db('0x1c')](_0x4f6a2a);}};}function respondWithFilteredResult(_0x477c54,_0x257d11){return function(_0x5396ef){if(_0x5396ef){var _0x12cef6=_0x5396ef[_0x22db('0x1d')],_0x45771d=_0x257d11[_0x22db('0x1e')],_0x503b3a=_0x257d11[_0x22db('0x1e')]+_0x257d11[_0x22db('0x1f')],_0x5dcdad;if(_0x503b3a>=_0x12cef6){_0x503b3a=_0x12cef6;_0x5dcdad=0xc8;}else{_0x5dcdad=0xce;}_0x477c54[_0x22db('0x1a')](_0x5dcdad);return _0x477c54[_0x22db('0x20')](_0x22db('0x21'),_0x45771d+'-'+_0x503b3a+'/'+_0x12cef6)[_0x22db('0x1c')](_0x5396ef);}return null;};}function patchUpdates(_0x150e19){return function(_0x222b00){try{jsonpatch[_0x22db('0x22')](_0x222b00,_0x150e19,!![]);}catch(_0x4140b4){return BPromise[_0x22db('0x23')](_0x4140b4);}return _0x222b00['save']();};}function saveUpdates(_0x505739,_0x18e7de){return function(_0x1a2983){if(_0x1a2983){return _0x1a2983[_0x22db('0x24')](_0x505739)[_0x22db('0x25')](function(_0x19fc9f){return _0x19fc9f;});}return null;};}function removeEntity(_0x1d9d7e,_0x5cbfd7){return function(_0x2a5cdf){if(_0x2a5cdf){return _0x2a5cdf[_0x22db('0x26')]()['then'](function(){var _0xca490d=_0x2a5cdf[_0x22db('0x27')]({'plain':!![]});var _0x1994c9=_0x22db('0x28');return db[_0x22db('0x29')][_0x22db('0x26')]({'where':{'type':_0x1994c9,'resourceId':_0xca490d['id']}})[_0x22db('0x25')](function(){return _0x2a5cdf;});})[_0x22db('0x25')](function(){_0x1d9d7e[_0x22db('0x1a')](0xcc)[_0x22db('0x1b')]();});}};}function handleEntityNotFound(_0x24c591,_0xa34d59){return function(_0x387ea4){if(!_0x387ea4){_0x24c591[_0x22db('0x2a')](0x194);}return _0x387ea4;};}function handleError(_0x43059b,_0x3fd832){_0x3fd832=_0x3fd832||0x1f4;return function(_0x20dc15){logger['error'](_0x20dc15[_0x22db('0x2b')]);if(_0x20dc15[_0x22db('0x2c')]){delete _0x20dc15['name'];}_0x43059b['status'](_0x3fd832)[_0x22db('0x2d')](_0x20dc15);};}exports[_0x22db('0x2e')]=function(_0x374f0f,_0x45a94f){var _0x2f23cd={},_0x58a797={},_0x6ac124={'count':0x0,'rows':[]};var _0x1c8807=_[_0x22db('0x2f')](db['Interval'][_0x22db('0x30')],function(_0x2a5a79){return{'name':_0x2a5a79['fieldName'],'type':_0x2a5a79[_0x22db('0x31')][_0x22db('0x32')]};});_0x58a797['model']=_[_0x22db('0x2f')](_0x1c8807,'name');_0x58a797[_0x22db('0x33')]=_[_0x22db('0x34')](_0x374f0f[_0x22db('0x33')]);_0x58a797[_0x22db('0x35')]=_[_0x22db('0x36')](_0x58a797[_0x22db('0x37')],_0x58a797[_0x22db('0x33')]);_0x2f23cd[_0x22db('0x38')]=_['intersection'](_0x58a797[_0x22db('0x37')],qs[_0x22db('0x39')](_0x374f0f[_0x22db('0x33')][_0x22db('0x39')]));_0x2f23cd['attributes']=_0x2f23cd[_0x22db('0x38')][_0x22db('0x3a')]?_0x2f23cd[_0x22db('0x38')]:_0x58a797[_0x22db('0x37')];if(!_0x374f0f[_0x22db('0x33')][_0x22db('0x3b')](_0x22db('0x3c'))){_0x2f23cd[_0x22db('0x1f')]=qs[_0x22db('0x1f')](_0x374f0f[_0x22db('0x33')][_0x22db('0x1f')]);_0x2f23cd[_0x22db('0x1e')]=qs[_0x22db('0x1e')](_0x374f0f['query'][_0x22db('0x1e')]);}_0x2f23cd['order']=qs[_0x22db('0x3d')](_0x374f0f[_0x22db('0x33')][_0x22db('0x3d')]);_0x2f23cd[_0x22db('0x3e')]=qs[_0x22db('0x35')](_[_0x22db('0x3f')](_0x374f0f[_0x22db('0x33')],_0x58a797[_0x22db('0x35')]),_0x1c8807);if(_0x374f0f[_0x22db('0x33')]['filter']){_0x2f23cd[_0x22db('0x3e')]=_['merge'](_0x2f23cd[_0x22db('0x3e')],{'$or':_[_0x22db('0x2f')](_0x1c8807,function(_0x3a3674){if(_0x3a3674[_0x22db('0x31')]!=='VIRTUAL'){var _0x50e72b={};_0x50e72b[_0x3a3674[_0x22db('0x2c')]]={'$like':'%'+_0x374f0f[_0x22db('0x33')][_0x22db('0x40')]+'%'};return _0x50e72b;}})});}_0x2f23cd=_[_0x22db('0x41')]({},_0x2f23cd,_0x374f0f[_0x22db('0x42')]);var _0x454290={'where':_0x2f23cd['where']};return db[_0x22db('0x43')][_0x22db('0x1d')](_0x454290)[_0x22db('0x25')](function(_0x19b141){_0x6ac124[_0x22db('0x1d')]=_0x19b141;if(_0x374f0f[_0x22db('0x33')][_0x22db('0x44')]){_0x2f23cd[_0x22db('0x45')]=[{'all':!![]}];}return db[_0x22db('0x43')][_0x22db('0x46')](_0x2f23cd);})['then'](function(_0x1556ee){_0x6ac124['rows']=_0x1556ee;return _0x6ac124;})[_0x22db('0x25')](respondWithFilteredResult(_0x45a94f,_0x2f23cd))['catch'](handleError(_0x45a94f,null));};exports['show']=function(_0x553ed1,_0x2f73c5){var _0x11649a={'raw':!![],'where':{'id':_0x553ed1[_0x22db('0x47')]['id']}},_0x4cfe3f={};_0x4cfe3f[_0x22db('0x37')]=_[_0x22db('0x34')](db[_0x22db('0x43')][_0x22db('0x30')]);_0x4cfe3f['query']=_[_0x22db('0x34')](_0x553ed1[_0x22db('0x33')]);_0x4cfe3f[_0x22db('0x35')]=_[_0x22db('0x36')](_0x4cfe3f['model'],_0x4cfe3f[_0x22db('0x33')]);_0x11649a[_0x22db('0x38')]=_[_0x22db('0x36')](_0x4cfe3f[_0x22db('0x37')],qs[_0x22db('0x39')](_0x553ed1[_0x22db('0x33')][_0x22db('0x39')]));_0x11649a[_0x22db('0x38')]=_0x11649a['attributes'][_0x22db('0x3a')]?_0x11649a[_0x22db('0x38')]:_0x4cfe3f[_0x22db('0x37')];if(_0x553ed1[_0x22db('0x33')]['includeAll']){_0x11649a[_0x22db('0x45')]=[{'all':!![]}];}_0x11649a=_[_0x22db('0x41')]({},_0x11649a,_0x553ed1['options']);return db[_0x22db('0x43')][_0x22db('0x48')](_0x11649a)['then'](handleEntityNotFound(_0x2f73c5,null))[_0x22db('0x25')](respondWithResult(_0x2f73c5,null))[_0x22db('0x49')](handleError(_0x2f73c5,null));};exports[_0x22db('0x4a')]=function(_0x59501f,_0x5354a9){return db[_0x22db('0x43')][_0x22db('0x4a')](_0x59501f[_0x22db('0x4b')],{})[_0x22db('0x25')](function(_0x3305c0){var _0x4aa37f=_0x59501f[_0x22db('0x4c')][_0x22db('0x27')]({'plain':!![]});if(!_0x4aa37f)throw new Error(_0x22db('0x4d'));if(_0x4aa37f['role']==='user'){var _0x508138=_0x3305c0[_0x22db('0x27')]({'plain':!![]});var _0x11f931=_0x22db('0x28');return db[_0x22db('0x4e')][_0x22db('0x48')]({'where':{'name':_0x11f931,'userProfileId':_0x4aa37f['userProfileId']},'raw':!![]})['then'](function(_0xa8ea2){if(_0xa8ea2&&_0xa8ea2[_0x22db('0x4f')]===0x0){return db[_0x22db('0x29')][_0x22db('0x4a')]({'name':_0x508138[_0x22db('0x2c')],'resourceId':_0x508138['id'],'type':_0xa8ea2[_0x22db('0x2c')],'sectionId':_0xa8ea2['id']},{})[_0x22db('0x25')](function(){return _0x3305c0;});}else{return _0x3305c0;}})[_0x22db('0x49')](function(_0x3693eb){logger[_0x22db('0x50')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x3693eb);throw _0x3693eb;});}return _0x3305c0;})[_0x22db('0x25')](respondWithResult(_0x5354a9,0xc9))[_0x22db('0x49')](handleError(_0x5354a9,null));};exports[_0x22db('0x24')]=function(_0x302c46,_0x3c92e8){if(_0x302c46[_0x22db('0x4b')]['id']){delete _0x302c46[_0x22db('0x4b')]['id'];}return db['Interval']['find']({'where':{'id':_0x302c46[_0x22db('0x47')]['id']}})[_0x22db('0x25')](handleEntityNotFound(_0x3c92e8,null))[_0x22db('0x25')](saveUpdates(_0x302c46[_0x22db('0x4b')],null))[_0x22db('0x25')](respondWithResult(_0x3c92e8,null))[_0x22db('0x49')](handleError(_0x3c92e8,null));};exports[_0x22db('0x26')]=function(_0x34b4e8,_0x4930c2){return db[_0x22db('0x43')]['find']({'where':{'id':_0x34b4e8[_0x22db('0x47')]['id']}})[_0x22db('0x25')](handleEntityNotFound(_0x4930c2,null))[_0x22db('0x25')](removeEntity(_0x4930c2,null))[_0x22db('0x49')](handleError(_0x4930c2,null));};exports[_0x22db('0x51')]=function(_0x3509c0,_0x55143a,_0x388cd2){if(_0x3509c0['body']['id']){delete _0x3509c0[_0x22db('0x4b')]['id'];}return db[_0x22db('0x43')][_0x22db('0x48')]({'where':{'id':_0x3509c0['params']['id']}})[_0x22db('0x25')](handleEntityNotFound(_0x55143a,null))['then'](function(_0x4ac650){if(_0x4ac650){_0x3509c0['body'][_0x22db('0x52')]=_0x4ac650['id'];return db[_0x22db('0x43')][_0x22db('0x4a')](_0x3509c0[_0x22db('0x4b')]);}})['then'](respondWithResult(_0x55143a,null))[_0x22db('0x49')](handleError(_0x55143a,null));};exports['getIntervals']=function(_0x13a651,_0x90133b,_0x2ae74b){var _0x2497ce={};var _0x252246={};var _0x33d530;var _0x4f9325;return db[_0x22db('0x43')][_0x22db('0x53')]({'where':{'id':_0x13a651[_0x22db('0x47')]['id']}})[_0x22db('0x25')](handleEntityNotFound(_0x90133b,null))[_0x22db('0x25')](function(_0x2f013d){if(_0x2f013d){_0x33d530=_0x2f013d;_0x252246['model']=_[_0x22db('0x34')](db[_0x22db('0x43')]['rawAttributes']);_0x252246[_0x22db('0x33')]=_[_0x22db('0x34')](_0x13a651[_0x22db('0x33')]);_0x252246[_0x22db('0x35')]=_[_0x22db('0x36')](_0x252246[_0x22db('0x37')],_0x252246[_0x22db('0x33')]);_0x2497ce[_0x22db('0x38')]=_['intersection'](_0x252246[_0x22db('0x37')],qs[_0x22db('0x39')](_0x13a651[_0x22db('0x33')][_0x22db('0x39')]));_0x2497ce[_0x22db('0x38')]=_0x2497ce[_0x22db('0x38')]['length']?_0x2497ce[_0x22db('0x38')]:_0x252246[_0x22db('0x37')];_0x2497ce[_0x22db('0x54')]=qs[_0x22db('0x3d')](_0x13a651[_0x22db('0x33')][_0x22db('0x3d')]);_0x2497ce[_0x22db('0x3e')]=qs[_0x22db('0x35')](_[_0x22db('0x3f')](_0x13a651[_0x22db('0x33')],_0x252246[_0x22db('0x35')]));if(_0x13a651[_0x22db('0x33')][_0x22db('0x40')]){_0x2497ce[_0x22db('0x3e')]=_['merge'](_0x2497ce[_0x22db('0x3e')],{'$or':_[_0x22db('0x2f')](_0x2497ce['attributes'],function(_0x5102e9){var _0x47a13d={};_0x47a13d[_0x5102e9]={'$like':'%'+_0x13a651[_0x22db('0x33')][_0x22db('0x40')]+'%'};return _0x47a13d;})});}_0x2497ce=_[_0x22db('0x41')]({},_0x2497ce,_0x13a651['options']);return _0x33d530[_0x22db('0x55')](_0x2497ce);}})['then'](function(_0x5f5443){if(_0x5f5443){_0x4f9325=_0x5f5443[_0x22db('0x3a')];if(!_0x13a651[_0x22db('0x33')][_0x22db('0x3b')](_0x22db('0x3c'))){_0x2497ce['limit']=qs[_0x22db('0x1f')](_0x13a651['query'][_0x22db('0x1f')]);_0x2497ce[_0x22db('0x1e')]=qs[_0x22db('0x1e')](_0x13a651[_0x22db('0x33')]['offset']);}return _0x33d530[_0x22db('0x55')](_0x2497ce);}})[_0x22db('0x25')](function(_0xebbf64){if(_0xebbf64){return _0xebbf64?{'count':_0x4f9325,'rows':_0xebbf64}:null;}})[_0x22db('0x25')](respondWithResult(_0x90133b,null))[_0x22db('0x49')](handleError(_0x90133b,null));};exports[_0x22db('0x56')]=function(_0x1cf184,_0x22f588,_0x1c7334){return db['Interval'][_0x22db('0x53')]({'where':{'id':_0x1cf184[_0x22db('0x47')]['id']}})['then'](handleEntityNotFound(_0x22f588,null))[_0x22db('0x25')](function(_0x153606){if(_0x153606){return db[_0x22db('0x57')][_0x22db('0x58')](function(_0x3b2582){return db[_0x22db('0x43')]['destroy']({'where':{'IntervalId':_0x1cf184[_0x22db('0x47')]['id']},'transaction':_0x3b2582})['then'](function(_0x167a13){var _0x4e74f7=_['map'](_0x1cf184['body'],function(_0x5b1230){delete _0x5b1230['id'];_0x5b1230[_0x22db('0x52')]=_0x1cf184[_0x22db('0x47')]['id'];return _0x5b1230;});return db[_0x22db('0x43')]['bulkCreate'](_0x4e74f7,{'transaction':_0x3b2582});});})[_0x22db('0x25')](function(){return db[_0x22db('0x43')][_0x22db('0x46')]({'where':{'IntervalId':_0x1cf184[_0x22db('0x47')]['id']}});});}})[_0x22db('0x25')](respondWithResult(_0x22f588,null))[_0x22db('0x49')](handleError(_0x22f588,null));}; \ No newline at end of file +var _0x6ccc=['params','length','includeAll','options','find','create','body','user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','addInterval','IntervalId','getIntervals','findOne','nolimit','addIntervals','sequelize','transaction','bulkCreate','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','path','sox','to-csv','ejs','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','Content-Range','apply','reject','save','then','destroy','get','Intervals','UserProfileResource','error','stack','name','send','index','map','Interval','rawAttributes','model','query','keys','filters','intersection','attributes','fields','limit','order','sort','where','pick','merge','type','filter','findAll','rows','catch','show'];(function(_0x29e722,_0x33e8a7){var _0x5231ca=function(_0xdeada8){while(--_0xdeada8){_0x29e722['push'](_0x29e722['shift']());}};_0x5231ca(++_0x33e8a7);}(_0x6ccc,0x6f));var _0xc6cc=function(_0x259aaf,_0x5dbec1){_0x259aaf=_0x259aaf-0x0;var _0x366663=_0x6ccc[_0x259aaf];return _0x366663;};'use strict';var pdf=require(_0xc6cc('0x0'));var emlformat=require(_0xc6cc('0x1'));var rimraf=require(_0xc6cc('0x2'));var zipdir=require(_0xc6cc('0x3'));var jsonpatch=require(_0xc6cc('0x4'));var rp=require('request-promise');var moment=require(_0xc6cc('0x5'));var BPromise=require(_0xc6cc('0x6'));var Mustache=require('mustache');var util=require('util');var path=require(_0xc6cc('0x7'));var sox=require(_0xc6cc('0x8'));var csv=require(_0xc6cc('0x9'));var ejs=require(_0xc6cc('0xa'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0xc6cc('0xb'));var jsforce=require(_0xc6cc('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xc6cc('0x9'));var querystring=require(_0xc6cc('0xd'));var Papa=require(_0xc6cc('0xe'));var Redis=require(_0xc6cc('0xf'));var authService=require(_0xc6cc('0x10'));var qs=require(_0xc6cc('0x11'));var as=require(_0xc6cc('0x12'));var hardwareService=require(_0xc6cc('0x13'));var logger=require(_0xc6cc('0x14'))(_0xc6cc('0x15'));var utils=require(_0xc6cc('0x16'));var config=require(_0xc6cc('0x17'));var db=require(_0xc6cc('0x18'))['db'];var extensions=require('../../components/extensions/rewrite');function respondWithStatusCode(_0x1ffb47,_0x11c4ac){_0x11c4ac=_0x11c4ac||0xcc;return function(_0x1186ae){if(_0x1186ae){return _0x1ffb47[_0xc6cc('0x19')](_0x11c4ac);}return _0x1ffb47[_0xc6cc('0x1a')](_0x11c4ac)[_0xc6cc('0x1b')]();};}function respondWithResult(_0x927a1b,_0x4b3034){_0x4b3034=_0x4b3034||0xc8;return function(_0x29e286){if(_0x29e286){return _0x927a1b['status'](_0x4b3034)[_0xc6cc('0x1c')](_0x29e286);}};}function respondWithFilteredResult(_0x34e5f0,_0x5adb8c){return function(_0x292465){if(_0x292465){var _0x363b5f=_0x292465[_0xc6cc('0x1d')],_0x204f21=_0x5adb8c[_0xc6cc('0x1e')],_0x292b87=_0x5adb8c[_0xc6cc('0x1e')]+_0x5adb8c['limit'],_0x2dfc58;if(_0x292b87>=_0x363b5f){_0x292b87=_0x363b5f;_0x2dfc58=0xc8;}else{_0x2dfc58=0xce;}_0x34e5f0[_0xc6cc('0x1a')](_0x2dfc58);return _0x34e5f0['set'](_0xc6cc('0x1f'),_0x204f21+'-'+_0x292b87+'/'+_0x363b5f)[_0xc6cc('0x1c')](_0x292465);}return null;};}function patchUpdates(_0xd802ef){return function(_0x83408b){try{jsonpatch[_0xc6cc('0x20')](_0x83408b,_0xd802ef,!![]);}catch(_0x828690){return BPromise[_0xc6cc('0x21')](_0x828690);}return _0x83408b[_0xc6cc('0x22')]();};}function saveUpdates(_0x2efd8f,_0x59af47){return function(_0x10692e){if(_0x10692e){return _0x10692e['update'](_0x2efd8f)[_0xc6cc('0x23')](function(_0x2fe50e){return _0x2fe50e;});}return null;};}function removeEntity(_0xe3d269,_0x4074f2){return function(_0x2eff8f){if(_0x2eff8f){return _0x2eff8f[_0xc6cc('0x24')]()[_0xc6cc('0x23')](function(){var _0x4f389c=_0x2eff8f[_0xc6cc('0x25')]({'plain':!![]});var _0x145da5=_0xc6cc('0x26');return db[_0xc6cc('0x27')][_0xc6cc('0x24')]({'where':{'type':_0x145da5,'resourceId':_0x4f389c['id']}})['then'](function(){return _0x2eff8f;});})[_0xc6cc('0x23')](function(){_0xe3d269[_0xc6cc('0x1a')](0xcc)[_0xc6cc('0x1b')]();});}};}function handleEntityNotFound(_0x524fa6,_0x205ba1){return function(_0x351578){if(!_0x351578){_0x524fa6[_0xc6cc('0x19')](0x194);}return _0x351578;};}function handleError(_0x50b2fb,_0x471a4a){_0x471a4a=_0x471a4a||0x1f4;return function(_0x368efc){logger[_0xc6cc('0x28')](_0x368efc[_0xc6cc('0x29')]);if(_0x368efc[_0xc6cc('0x2a')]){delete _0x368efc[_0xc6cc('0x2a')];}_0x50b2fb[_0xc6cc('0x1a')](_0x471a4a)[_0xc6cc('0x2b')](_0x368efc);};}exports[_0xc6cc('0x2c')]=function(_0x51e47b,_0x292bee){var _0x2c9200={},_0x5a1608={},_0x4d9b9d={'count':0x0,'rows':[]};var _0x316619=_[_0xc6cc('0x2d')](db[_0xc6cc('0x2e')][_0xc6cc('0x2f')],function(_0x33385f){return{'name':_0x33385f['fieldName'],'type':_0x33385f['type']['key']};});_0x5a1608[_0xc6cc('0x30')]=_['map'](_0x316619,'name');_0x5a1608[_0xc6cc('0x31')]=_[_0xc6cc('0x32')](_0x51e47b[_0xc6cc('0x31')]);_0x5a1608[_0xc6cc('0x33')]=_[_0xc6cc('0x34')](_0x5a1608['model'],_0x5a1608['query']);_0x2c9200[_0xc6cc('0x35')]=_[_0xc6cc('0x34')](_0x5a1608[_0xc6cc('0x30')],qs[_0xc6cc('0x36')](_0x51e47b[_0xc6cc('0x31')][_0xc6cc('0x36')]));_0x2c9200[_0xc6cc('0x35')]=_0x2c9200[_0xc6cc('0x35')]['length']?_0x2c9200[_0xc6cc('0x35')]:_0x5a1608['model'];if(!_0x51e47b[_0xc6cc('0x31')]['hasOwnProperty']('nolimit')){_0x2c9200[_0xc6cc('0x37')]=qs[_0xc6cc('0x37')](_0x51e47b[_0xc6cc('0x31')][_0xc6cc('0x37')]);_0x2c9200[_0xc6cc('0x1e')]=qs[_0xc6cc('0x1e')](_0x51e47b[_0xc6cc('0x31')][_0xc6cc('0x1e')]);}_0x2c9200[_0xc6cc('0x38')]=qs[_0xc6cc('0x39')](_0x51e47b[_0xc6cc('0x31')][_0xc6cc('0x39')]);_0x2c9200[_0xc6cc('0x3a')]=qs[_0xc6cc('0x33')](_[_0xc6cc('0x3b')](_0x51e47b[_0xc6cc('0x31')],_0x5a1608[_0xc6cc('0x33')]),_0x316619);if(_0x51e47b[_0xc6cc('0x31')]['filter']){_0x2c9200[_0xc6cc('0x3a')]=_[_0xc6cc('0x3c')](_0x2c9200[_0xc6cc('0x3a')],{'$or':_[_0xc6cc('0x2d')](_0x316619,function(_0x3b75f6){if(_0x3b75f6[_0xc6cc('0x3d')]!=='VIRTUAL'){var _0x306a87={};_0x306a87[_0x3b75f6[_0xc6cc('0x2a')]]={'$like':'%'+_0x51e47b['query'][_0xc6cc('0x3e')]+'%'};return _0x306a87;}})});}_0x2c9200=_[_0xc6cc('0x3c')]({},_0x2c9200,_0x51e47b['options']);var _0x60e0d7={'where':_0x2c9200['where']};return db[_0xc6cc('0x2e')]['count'](_0x60e0d7)[_0xc6cc('0x23')](function(_0x284758){_0x4d9b9d['count']=_0x284758;if(_0x51e47b['query']['includeAll']){_0x2c9200['include']=[{'all':!![]}];}return db[_0xc6cc('0x2e')][_0xc6cc('0x3f')](_0x2c9200);})[_0xc6cc('0x23')](function(_0x421203){_0x4d9b9d[_0xc6cc('0x40')]=_0x421203;return _0x4d9b9d;})[_0xc6cc('0x23')](respondWithFilteredResult(_0x292bee,_0x2c9200))[_0xc6cc('0x41')](handleError(_0x292bee,null));};exports[_0xc6cc('0x42')]=function(_0x1a9136,_0x1f8b2c){var _0x4d3608={'raw':!![],'where':{'id':_0x1a9136[_0xc6cc('0x43')]['id']}},_0x4b15eb={};_0x4b15eb[_0xc6cc('0x30')]=_['keys'](db[_0xc6cc('0x2e')][_0xc6cc('0x2f')]);_0x4b15eb['query']=_[_0xc6cc('0x32')](_0x1a9136[_0xc6cc('0x31')]);_0x4b15eb[_0xc6cc('0x33')]=_[_0xc6cc('0x34')](_0x4b15eb[_0xc6cc('0x30')],_0x4b15eb[_0xc6cc('0x31')]);_0x4d3608[_0xc6cc('0x35')]=_[_0xc6cc('0x34')](_0x4b15eb[_0xc6cc('0x30')],qs['fields'](_0x1a9136[_0xc6cc('0x31')][_0xc6cc('0x36')]));_0x4d3608[_0xc6cc('0x35')]=_0x4d3608[_0xc6cc('0x35')][_0xc6cc('0x44')]?_0x4d3608['attributes']:_0x4b15eb[_0xc6cc('0x30')];if(_0x1a9136[_0xc6cc('0x31')][_0xc6cc('0x45')]){_0x4d3608['include']=[{'all':!![]}];}_0x4d3608=_[_0xc6cc('0x3c')]({},_0x4d3608,_0x1a9136[_0xc6cc('0x46')]);return db['Interval'][_0xc6cc('0x47')](_0x4d3608)[_0xc6cc('0x23')](handleEntityNotFound(_0x1f8b2c,null))[_0xc6cc('0x23')](respondWithResult(_0x1f8b2c,null))[_0xc6cc('0x41')](handleError(_0x1f8b2c,null));};exports[_0xc6cc('0x48')]=function(_0x51f235,_0x1e3574){return db[_0xc6cc('0x2e')][_0xc6cc('0x48')](_0x51f235[_0xc6cc('0x49')],{})[_0xc6cc('0x23')](function(_0x239c35){var _0x3cacf5=_0x51f235[_0xc6cc('0x4a')][_0xc6cc('0x25')]({'plain':!![]});if(!_0x3cacf5)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x3cacf5['role']==='user'){var _0x3a7e90=_0x239c35[_0xc6cc('0x25')]({'plain':!![]});var _0x453a97=_0xc6cc('0x26');return db[_0xc6cc('0x4b')]['find']({'where':{'name':_0x453a97,'userProfileId':_0x3cacf5[_0xc6cc('0x4c')]},'raw':!![]})[_0xc6cc('0x23')](function(_0x1b12ff){if(_0x1b12ff&&_0x1b12ff[_0xc6cc('0x4d')]===0x0){return db[_0xc6cc('0x27')][_0xc6cc('0x48')]({'name':_0x3a7e90[_0xc6cc('0x2a')],'resourceId':_0x3a7e90['id'],'type':_0x1b12ff[_0xc6cc('0x2a')],'sectionId':_0x1b12ff['id']},{})[_0xc6cc('0x23')](function(){return _0x239c35;});}else{return _0x239c35;}})[_0xc6cc('0x41')](function(_0x3d1a61){logger['error'](_0xc6cc('0x4e'),_0x3d1a61);throw _0x3d1a61;});}return _0x239c35;})[_0xc6cc('0x23')](respondWithResult(_0x1e3574,0xc9))[_0xc6cc('0x41')](handleError(_0x1e3574,null));};exports[_0xc6cc('0x4f')]=function(_0x429adb,_0x31e265){if(_0x429adb[_0xc6cc('0x49')]['id']){delete _0x429adb['body']['id'];}return db[_0xc6cc('0x2e')][_0xc6cc('0x47')]({'where':{'id':_0x429adb['params']['id']}})[_0xc6cc('0x23')](handleEntityNotFound(_0x31e265,null))[_0xc6cc('0x23')](saveUpdates(_0x429adb[_0xc6cc('0x49')],null))[_0xc6cc('0x23')](respondWithResult(_0x31e265,null))[_0xc6cc('0x41')](handleError(_0x31e265,null));};exports[_0xc6cc('0x24')]=function(_0x133bf7,_0x12b7a5){return db[_0xc6cc('0x2e')]['find']({'where':{'id':_0x133bf7[_0xc6cc('0x43')]['id']}})['then'](handleEntityNotFound(_0x12b7a5,null))[_0xc6cc('0x23')](removeEntity(_0x12b7a5,null))['catch'](handleError(_0x12b7a5,null));};exports[_0xc6cc('0x50')]=function(_0x5de6b8,_0x59a698,_0x1e5e75){if(_0x5de6b8[_0xc6cc('0x49')]['id']){delete _0x5de6b8[_0xc6cc('0x49')]['id'];}return db['Interval'][_0xc6cc('0x47')]({'where':{'id':_0x5de6b8['params']['id']}})['then'](handleEntityNotFound(_0x59a698,null))['then'](function(_0x194f27){if(_0x194f27){_0x5de6b8[_0xc6cc('0x49')][_0xc6cc('0x51')]=_0x194f27['id'];return db[_0xc6cc('0x2e')][_0xc6cc('0x48')](_0x5de6b8[_0xc6cc('0x49')]);}})[_0xc6cc('0x23')](respondWithResult(_0x59a698,null))[_0xc6cc('0x41')](handleError(_0x59a698,null));};exports[_0xc6cc('0x52')]=function(_0x50bb86,_0x1f916a,_0x5ad65b){var _0x4ceb0f={};var _0x44e57d={};var _0x445f41;var _0x43e03a;return db['Interval'][_0xc6cc('0x53')]({'where':{'id':_0x50bb86['params']['id']}})[_0xc6cc('0x23')](handleEntityNotFound(_0x1f916a,null))['then'](function(_0x3e4504){if(_0x3e4504){_0x445f41=_0x3e4504;_0x44e57d['model']=_[_0xc6cc('0x32')](db[_0xc6cc('0x2e')]['rawAttributes']);_0x44e57d['query']=_[_0xc6cc('0x32')](_0x50bb86[_0xc6cc('0x31')]);_0x44e57d['filters']=_['intersection'](_0x44e57d[_0xc6cc('0x30')],_0x44e57d['query']);_0x4ceb0f['attributes']=_[_0xc6cc('0x34')](_0x44e57d[_0xc6cc('0x30')],qs[_0xc6cc('0x36')](_0x50bb86['query'][_0xc6cc('0x36')]));_0x4ceb0f[_0xc6cc('0x35')]=_0x4ceb0f['attributes'][_0xc6cc('0x44')]?_0x4ceb0f[_0xc6cc('0x35')]:_0x44e57d[_0xc6cc('0x30')];_0x4ceb0f['order']=qs['sort'](_0x50bb86['query'][_0xc6cc('0x39')]);_0x4ceb0f[_0xc6cc('0x3a')]=qs['filters'](_['pick'](_0x50bb86[_0xc6cc('0x31')],_0x44e57d['filters']));if(_0x50bb86[_0xc6cc('0x31')][_0xc6cc('0x3e')]){_0x4ceb0f[_0xc6cc('0x3a')]=_[_0xc6cc('0x3c')](_0x4ceb0f[_0xc6cc('0x3a')],{'$or':_[_0xc6cc('0x2d')](_0x4ceb0f[_0xc6cc('0x35')],function(_0x58db00){var _0x3c6f70={};_0x3c6f70[_0x58db00]={'$like':'%'+_0x50bb86[_0xc6cc('0x31')][_0xc6cc('0x3e')]+'%'};return _0x3c6f70;})});}_0x4ceb0f=_['merge']({},_0x4ceb0f,_0x50bb86[_0xc6cc('0x46')]);return _0x445f41[_0xc6cc('0x52')](_0x4ceb0f);}})[_0xc6cc('0x23')](function(_0xe0ad14){if(_0xe0ad14){_0x43e03a=_0xe0ad14[_0xc6cc('0x44')];if(!_0x50bb86['query']['hasOwnProperty'](_0xc6cc('0x54'))){_0x4ceb0f[_0xc6cc('0x37')]=qs['limit'](_0x50bb86[_0xc6cc('0x31')][_0xc6cc('0x37')]);_0x4ceb0f[_0xc6cc('0x1e')]=qs[_0xc6cc('0x1e')](_0x50bb86['query'][_0xc6cc('0x1e')]);}return _0x445f41[_0xc6cc('0x52')](_0x4ceb0f);}})[_0xc6cc('0x23')](function(_0x329a51){if(_0x329a51){return _0x329a51?{'count':_0x43e03a,'rows':_0x329a51}:null;}})['then'](respondWithResult(_0x1f916a,null))[_0xc6cc('0x41')](handleError(_0x1f916a,null));};exports[_0xc6cc('0x55')]=function(_0x5812dc,_0xbbec8,_0x70e883){return db['Interval'][_0xc6cc('0x53')]({'where':{'id':_0x5812dc[_0xc6cc('0x43')]['id']}})['then'](handleEntityNotFound(_0xbbec8,null))['then'](function(_0x14524c){if(_0x14524c){return db[_0xc6cc('0x56')][_0xc6cc('0x57')](function(_0x3c8527){return db[_0xc6cc('0x2e')][_0xc6cc('0x24')]({'where':{'IntervalId':_0x5812dc[_0xc6cc('0x43')]['id']},'transaction':_0x3c8527})['then'](function(_0x3973da){var _0xe336f6=_['map'](_0x5812dc['body'],function(_0x451157){delete _0x451157['id'];_0x451157['IntervalId']=_0x5812dc[_0xc6cc('0x43')]['id'];return _0x451157;});return db[_0xc6cc('0x2e')][_0xc6cc('0x58')](_0xe336f6,{'transaction':_0x3c8527});});})[_0xc6cc('0x23')](function(){return db[_0xc6cc('0x2e')][_0xc6cc('0x3f')]({'where':{'IntervalId':_0x5812dc[_0xc6cc('0x43')]['id']}});});}})[_0xc6cc('0x23')](respondWithResult(_0xbbec8,null))[_0xc6cc('0x41')](handleError(_0xbbec8,null));}; \ No newline at end of file diff --git a/server/api/interval/interval.model.js b/server/api/interval/interval.model.js index 429fec1..42b07d0 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 _0x3a79=['./interval.attributes','exports','define','Interval','tools_intervals','rewrite','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x21e83c,_0x113560){var _0x4dbd97=function(_0x542396){while(--_0x542396){_0x21e83c['push'](_0x21e83c['shift']());}};_0x4dbd97(++_0x113560);}(_0x3a79,0xca));var _0x93a7=function(_0x4a85f1,_0x4c0410){_0x4a85f1=_0x4a85f1-0x0;var _0x1e0c20=_0x3a79[_0x4a85f1];return _0x1e0c20;};'use strict';var _=require('lodash');var util=require(_0x93a7('0x0'));var logger=require(_0x93a7('0x1'))('api');var moment=require(_0x93a7('0x2'));var BPromise=require(_0x93a7('0x3'));var rp=require(_0x93a7('0x4'));var fs=require('fs');var path=require(_0x93a7('0x5'));var rimraf=require(_0x93a7('0x6'));var config=require(_0x93a7('0x7'));var attributes=require(_0x93a7('0x8'));var extensions=require('../../components/extensions/rewrite');module[_0x93a7('0x9')]=function(_0x4efb20,_0x2579e5){return _0x4efb20[_0x93a7('0xa')](_0x93a7('0xb'),attributes,{'tableName':_0x93a7('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x3a512b,_0x30f781){extensions['rewrite'](_0x4efb20,_0x3a512b);},'afterBulkCreate':function(_0x2996db,_0x5e0abe,_0x49a374){_0x49a374();extensions[_0x93a7('0xd')](_0x4efb20,_0x2996db[0x0]);},'afterUpdate':function(_0x3484a0,_0x329e8d){extensions['rewrite'](_0x4efb20,_0x3484a0);},'afterDestroy':function(_0x5374ae,_0x119f25){extensions[_0x93a7('0xd')](_0x4efb20,_0x5374ae);}}});}; \ No newline at end of file +var _0xc1c4=['rimraf','../../config/environment','./interval.attributes','../../components/extensions/rewrite','Interval','tools_intervals','rewrite','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x12208b,_0x3a5446){var _0x1d546c=function(_0x158d5b){while(--_0x158d5b){_0x12208b['push'](_0x12208b['shift']());}};_0x1d546c(++_0x3a5446);}(_0xc1c4,0x1c7));var _0x4c1c=function(_0x13b5b8,_0x188bad){_0x13b5b8=_0x13b5b8-0x0;var _0x469c77=_0xc1c4[_0x13b5b8];return _0x469c77;};'use strict';var _=require(_0x4c1c('0x0'));var util=require(_0x4c1c('0x1'));var logger=require(_0x4c1c('0x2'))(_0x4c1c('0x3'));var moment=require(_0x4c1c('0x4'));var BPromise=require(_0x4c1c('0x5'));var rp=require(_0x4c1c('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x4c1c('0x7'));var config=require(_0x4c1c('0x8'));var attributes=require(_0x4c1c('0x9'));var extensions=require(_0x4c1c('0xa'));module['exports']=function(_0xaa5184,_0x4f5a4f){return _0xaa5184['define'](_0x4c1c('0xb'),attributes,{'tableName':_0x4c1c('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x486065,_0x13cb7b){extensions[_0x4c1c('0xd')](_0xaa5184,_0x486065);},'afterBulkCreate':function(_0x445441,_0x28c8f4,_0x1ac32d){_0x1ac32d();extensions['rewrite'](_0xaa5184,_0x445441[0x0]);},'afterUpdate':function(_0x5cf2d1,_0x3b577d){extensions[_0x4c1c('0xd')](_0xaa5184,_0x5cf2d1);},'afterDestroy':function(_0x41278a,_0x132319){extensions[_0x4c1c('0xd')](_0xaa5184,_0x41278a);}}});}; \ No newline at end of file diff --git a/server/api/interval/interval.rpc.js b/server/api/interval/interval.rpc.js index 3f5373f..1c1b649 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 _0xa973=['raw','attributes','limit','include','map','then','ShowInterval','find','model','lodash','util','moment','bluebird','randomstring','../../mysqldb','rpc','../../config/environment','jayson/promise','http','request','info','Interval,\x20%s,\x20%s','request\x20sent','debug','Interval,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetInterval','Interval','findAll','options'];(function(_0x3dead1,_0x3f2f00){var _0x2f278c=function(_0x36bd36){while(--_0x36bd36){_0x3dead1['push'](_0x3dead1['shift']());}};_0x2f278c(++_0x3f2f00);}(_0xa973,0x1d0));var _0x3a97=function(_0x3c60fc,_0x593ef5){_0x3c60fc=_0x3c60fc-0x0;var _0x495fd2=_0xa973[_0x3c60fc];return _0x495fd2;};'use strict';var _=require(_0x3a97('0x0'));var util=require(_0x3a97('0x1'));var moment=require(_0x3a97('0x2'));var BPromise=require(_0x3a97('0x3'));var rs=require(_0x3a97('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x3a97('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x3a97('0x6'));var config=require(_0x3a97('0x7'));var jayson=require(_0x3a97('0x8'));var client=jayson['client'][_0x3a97('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x445d91,_0x906ae,_0x36fa96){return new BPromise(function(_0x2f8472,_0x468ca5){return client[_0x3a97('0xa')](_0x445d91,_0x36fa96)['then'](function(_0x3c7083){logger[_0x3a97('0xb')](_0x3a97('0xc'),_0x906ae,_0x3a97('0xd'));logger[_0x3a97('0xe')](_0x3a97('0xf'),_0x906ae,_0x3a97('0xd'),JSON[_0x3a97('0x10')](_0x3c7083));if(_0x3c7083[_0x3a97('0x11')]){if(_0x3c7083[_0x3a97('0x11')][_0x3a97('0x12')]===0x1f4){logger['error'](_0x3a97('0xc'),_0x906ae,_0x3c7083['error'][_0x3a97('0x13')]);return _0x468ca5(_0x3c7083[_0x3a97('0x11')][_0x3a97('0x13')]);}logger[_0x3a97('0x11')](_0x3a97('0xc'),_0x906ae,_0x3c7083[_0x3a97('0x11')]['message']);return _0x2f8472(_0x3c7083[_0x3a97('0x11')][_0x3a97('0x13')]);}else{logger['info'](_0x3a97('0xc'),_0x906ae,_0x3a97('0xd'));_0x2f8472(_0x3c7083[_0x3a97('0x14')][_0x3a97('0x13')]);}})[_0x3a97('0x15')](function(_0xa568e3){logger['error'](_0x3a97('0xc'),_0x906ae,_0xa568e3);_0x468ca5(_0xa568e3);});});}exports[_0x3a97('0x16')]=function(_0x4a154a){var _0x2cd80f=this;return new Promise(function(_0x2995f2,_0x48cfc4){return db[_0x3a97('0x17')][_0x3a97('0x18')]({'raw':_0x4a154a[_0x3a97('0x19')]?_0x4a154a['options'][_0x3a97('0x1a')]===undefined?!![]:![]:!![],'where':_0x4a154a[_0x3a97('0x19')]?_0x4a154a[_0x3a97('0x19')]['where']||null:null,'attributes':_0x4a154a[_0x3a97('0x19')]?_0x4a154a[_0x3a97('0x19')][_0x3a97('0x1b')]||null:null,'limit':_0x4a154a['options']?_0x4a154a[_0x3a97('0x19')][_0x3a97('0x1c')]||null:null,'include':_0x4a154a[_0x3a97('0x19')]?_0x4a154a[_0x3a97('0x19')][_0x3a97('0x1d')]?_[_0x3a97('0x1e')](_0x4a154a['options'][_0x3a97('0x1d')],function(_0x55383b){return{'model':db[_0x55383b['model']],'as':_0x55383b['as'],'attributes':_0x55383b[_0x3a97('0x1b')],'include':_0x55383b[_0x3a97('0x1d')]?_[_0x3a97('0x1e')](_0x55383b['include'],function(_0x241699){return{'model':db[_0x241699['model']],'as':_0x241699['as'],'attributes':_0x241699['attributes'],'include':_0x241699['include']?_[_0x3a97('0x1e')](_0x241699[_0x3a97('0x1d')],function(_0x434413){return{'model':db[_0x434413['model']],'as':_0x434413['as'],'attributes':_0x434413[_0x3a97('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x3a97('0x1f')](function(_0x501694){logger[_0x3a97('0xb')](_0x3a97('0x16'),_0x4a154a);logger[_0x3a97('0xe')]('GetInterval',_0x4a154a,JSON[_0x3a97('0x10')](_0x501694));_0x2995f2(_0x501694);})[_0x3a97('0x15')](function(_0x55eadb){logger[_0x3a97('0x11')]('GetInterval',_0x55eadb[_0x3a97('0x13')],_0x4a154a);_0x48cfc4(_0x2cd80f['error'](0x1f4,_0x55eadb[_0x3a97('0x13')]));});});};exports[_0x3a97('0x20')]=function(_0x252cda){var _0x45a45e=this;return new Promise(function(_0x2d7d34,_0x4664ec){return db['Interval'][_0x3a97('0x21')]({'raw':_0x252cda[_0x3a97('0x19')]?_0x252cda[_0x3a97('0x19')][_0x3a97('0x1a')]===undefined?!![]:![]:!![],'where':_0x252cda[_0x3a97('0x19')]?_0x252cda['options']['where']||null:null,'attributes':_0x252cda[_0x3a97('0x19')]?_0x252cda[_0x3a97('0x19')]['attributes']||null:null,'include':_0x252cda[_0x3a97('0x19')]?_0x252cda[_0x3a97('0x19')][_0x3a97('0x1d')]?_[_0x3a97('0x1e')](_0x252cda['options'][_0x3a97('0x1d')],function(_0x33d7ee){return{'model':db[_0x33d7ee[_0x3a97('0x22')]],'as':_0x33d7ee['as'],'attributes':_0x33d7ee[_0x3a97('0x1b')],'include':_0x33d7ee[_0x3a97('0x1d')]?_[_0x3a97('0x1e')](_0x33d7ee[_0x3a97('0x1d')],function(_0x51ec88){return{'model':db[_0x51ec88[_0x3a97('0x22')]],'as':_0x51ec88['as'],'attributes':_0x51ec88[_0x3a97('0x1b')],'include':_0x51ec88[_0x3a97('0x1d')]?_[_0x3a97('0x1e')](_0x51ec88['include'],function(_0x39d7a4){return{'model':db[_0x39d7a4[_0x3a97('0x22')]],'as':_0x39d7a4['as'],'attributes':_0x39d7a4[_0x3a97('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x3a97('0x1f')](function(_0x3bee4d){logger[_0x3a97('0xb')]('ShowInterval',_0x252cda);logger[_0x3a97('0xe')](_0x3a97('0x20'),_0x252cda,JSON[_0x3a97('0x10')](_0x3bee4d));_0x2d7d34(_0x3bee4d);})[_0x3a97('0x15')](function(_0x39fed5){logger[_0x3a97('0x11')]('ShowInterval',_0x39fed5['message'],_0x252cda);_0x4664ec(_0x45a45e[_0x3a97('0x11')](0x1f4,_0x39fed5[_0x3a97('0x13')]));});});}; \ No newline at end of file +var _0x20ad=['http','request','then','request\x20sent','debug','Interval,\x20%s,\x20%s,\x20%s','stringify','error','code','Interval,\x20%s,\x20%s','message','info','result','catch','GetInterval','Interval','findAll','options','where','limit','include','model','attributes','map','ShowInterval','lodash','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client'];(function(_0x261f2b,_0x540a59){var _0x49b52c=function(_0x4093e2){while(--_0x4093e2){_0x261f2b['push'](_0x261f2b['shift']());}};_0x49b52c(++_0x540a59);}(_0x20ad,0x121));var _0xd20a=function(_0x363ef8,_0x4ecb1a){_0x363ef8=_0x363ef8-0x0;var _0x148822=_0x20ad[_0x363ef8];return _0x148822;};'use strict';var _=require(_0xd20a('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xd20a('0x1'));var fs=require('fs');var Redis=require(_0xd20a('0x2'));var db=require(_0xd20a('0x3'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xd20a('0x4'));var config=require(_0xd20a('0x5'));var jayson=require(_0xd20a('0x6'));var client=jayson[_0xd20a('0x7')][_0xd20a('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x5241ad,_0x3eec49,_0x64b5e1){return new BPromise(function(_0x13efba,_0x137981){return client[_0xd20a('0x9')](_0x5241ad,_0x64b5e1)[_0xd20a('0xa')](function(_0x119188){logger['info']('Interval,\x20%s,\x20%s',_0x3eec49,_0xd20a('0xb'));logger[_0xd20a('0xc')](_0xd20a('0xd'),_0x3eec49,_0xd20a('0xb'),JSON[_0xd20a('0xe')](_0x119188));if(_0x119188[_0xd20a('0xf')]){if(_0x119188[_0xd20a('0xf')][_0xd20a('0x10')]===0x1f4){logger[_0xd20a('0xf')](_0xd20a('0x11'),_0x3eec49,_0x119188[_0xd20a('0xf')][_0xd20a('0x12')]);return _0x137981(_0x119188[_0xd20a('0xf')][_0xd20a('0x12')]);}logger[_0xd20a('0xf')](_0xd20a('0x11'),_0x3eec49,_0x119188[_0xd20a('0xf')][_0xd20a('0x12')]);return _0x13efba(_0x119188['error'][_0xd20a('0x12')]);}else{logger[_0xd20a('0x13')]('Interval,\x20%s,\x20%s',_0x3eec49,_0xd20a('0xb'));_0x13efba(_0x119188[_0xd20a('0x14')][_0xd20a('0x12')]);}})[_0xd20a('0x15')](function(_0x30a917){logger[_0xd20a('0xf')](_0xd20a('0x11'),_0x3eec49,_0x30a917);_0x137981(_0x30a917);});});}exports[_0xd20a('0x16')]=function(_0x522890){var _0x444b99=this;return new Promise(function(_0x56ec4b,_0x4b1de1){return db[_0xd20a('0x17')][_0xd20a('0x18')]({'raw':_0x522890[_0xd20a('0x19')]?_0x522890[_0xd20a('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x522890[_0xd20a('0x19')]?_0x522890['options'][_0xd20a('0x1a')]||null:null,'attributes':_0x522890[_0xd20a('0x19')]?_0x522890[_0xd20a('0x19')]['attributes']||null:null,'limit':_0x522890[_0xd20a('0x19')]?_0x522890[_0xd20a('0x19')][_0xd20a('0x1b')]||null:null,'include':_0x522890[_0xd20a('0x19')]?_0x522890[_0xd20a('0x19')][_0xd20a('0x1c')]?_['map'](_0x522890[_0xd20a('0x19')][_0xd20a('0x1c')],function(_0x10beba){return{'model':db[_0x10beba[_0xd20a('0x1d')]],'as':_0x10beba['as'],'attributes':_0x10beba[_0xd20a('0x1e')],'include':_0x10beba[_0xd20a('0x1c')]?_[_0xd20a('0x1f')](_0x10beba[_0xd20a('0x1c')],function(_0x50b9fd){return{'model':db[_0x50b9fd[_0xd20a('0x1d')]],'as':_0x50b9fd['as'],'attributes':_0x50b9fd[_0xd20a('0x1e')],'include':_0x50b9fd['include']?_[_0xd20a('0x1f')](_0x50b9fd[_0xd20a('0x1c')],function(_0xcd7fc1){return{'model':db[_0xcd7fc1[_0xd20a('0x1d')]],'as':_0xcd7fc1['as'],'attributes':_0xcd7fc1['attributes']};}):[]};}):[]};}):[]:[]})[_0xd20a('0xa')](function(_0x258f71){logger[_0xd20a('0x13')](_0xd20a('0x16'),_0x522890);logger[_0xd20a('0xc')](_0xd20a('0x16'),_0x522890,JSON[_0xd20a('0xe')](_0x258f71));_0x56ec4b(_0x258f71);})[_0xd20a('0x15')](function(_0x2f08a6){logger[_0xd20a('0xf')](_0xd20a('0x16'),_0x2f08a6[_0xd20a('0x12')],_0x522890);_0x4b1de1(_0x444b99[_0xd20a('0xf')](0x1f4,_0x2f08a6[_0xd20a('0x12')]));});});};exports['ShowInterval']=function(_0x38bcb2){var _0x1e91ff=this;return new Promise(function(_0x321da0,_0x3cb539){return db[_0xd20a('0x17')]['find']({'raw':_0x38bcb2[_0xd20a('0x19')]?_0x38bcb2[_0xd20a('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x38bcb2[_0xd20a('0x19')]?_0x38bcb2[_0xd20a('0x19')][_0xd20a('0x1a')]||null:null,'attributes':_0x38bcb2[_0xd20a('0x19')]?_0x38bcb2[_0xd20a('0x19')][_0xd20a('0x1e')]||null:null,'include':_0x38bcb2[_0xd20a('0x19')]?_0x38bcb2[_0xd20a('0x19')][_0xd20a('0x1c')]?_[_0xd20a('0x1f')](_0x38bcb2[_0xd20a('0x19')]['include'],function(_0x31d4f7){return{'model':db[_0x31d4f7['model']],'as':_0x31d4f7['as'],'attributes':_0x31d4f7[_0xd20a('0x1e')],'include':_0x31d4f7[_0xd20a('0x1c')]?_[_0xd20a('0x1f')](_0x31d4f7['include'],function(_0x1c8d90){return{'model':db[_0x1c8d90[_0xd20a('0x1d')]],'as':_0x1c8d90['as'],'attributes':_0x1c8d90['attributes'],'include':_0x1c8d90[_0xd20a('0x1c')]?_[_0xd20a('0x1f')](_0x1c8d90[_0xd20a('0x1c')],function(_0x3f2993){return{'model':db[_0x3f2993[_0xd20a('0x1d')]],'as':_0x3f2993['as'],'attributes':_0x3f2993[_0xd20a('0x1e')]};}):[]};}):[]};}):[]:[]})[_0xd20a('0xa')](function(_0x1fa327){logger[_0xd20a('0x13')]('ShowInterval',_0x38bcb2);logger[_0xd20a('0xc')](_0xd20a('0x20'),_0x38bcb2,JSON[_0xd20a('0xe')](_0x1fa327));_0x321da0(_0x1fa327);})[_0xd20a('0x15')](function(_0xf85d3e){logger['error'](_0xd20a('0x20'),_0xf85d3e['message'],_0x38bcb2);_0x3cb539(_0x1e91ff['error'](0x1f4,_0xf85d3e[_0xd20a('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/jira/index.js b/server/api/jira/index.js index 05a0fef..4616022 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 _0x43ce=['isAuthenticated','exports','express','Router','../../components/auth/service','./jira.controller','post'];(function(_0x14a0f0,_0x6b06b6){var _0x24bef0=function(_0x2bafdd){while(--_0x2bafdd){_0x14a0f0['push'](_0x14a0f0['shift']());}};_0x24bef0(++_0x6b06b6);}(_0x43ce,0x14b));var _0xe43c=function(_0x67c1e6,_0x46ee1f){_0x67c1e6=_0x67c1e6-0x0;var _0x2673fd=_0x43ce[_0x67c1e6];return _0x2673fd;};'use strict';var express=require(_0xe43c('0x0'));var router=express[_0xe43c('0x1')]();var auth=require(_0xe43c('0x2'));var controller=require(_0xe43c('0x3'));router[_0xe43c('0x4')]('/',auth[_0xe43c('0x5')](),controller['send']);module[_0xe43c('0x6')]=router; \ No newline at end of file +var _0x5b6b=['express','../../components/auth/service','./jira.controller','isAuthenticated','exports'];(function(_0x239182,_0x2fdbdd){var _0x529f0c=function(_0x5677b0){while(--_0x5677b0){_0x239182['push'](_0x239182['shift']());}};_0x529f0c(++_0x2fdbdd);}(_0x5b6b,0xdc));var _0xb5b6=function(_0x52f890,_0x4766c1){_0x52f890=_0x52f890-0x0;var _0x4fd947=_0x5b6b[_0x52f890];return _0x4fd947;};'use strict';var express=require(_0xb5b6('0x0'));var router=express['Router']();var auth=require(_0xb5b6('0x1'));var controller=require(_0xb5b6('0x2'));router['post']('/',auth[_0xb5b6('0x3')](),controller['send']);module[_0xb5b6('0x4')]=router; \ No newline at end of file diff --git a/server/api/jira/jira.controller.js b/server/api/jira/jira.controller.js index 134056e..3a3cad7 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 _0x7be6=['../../config/logger','api','support','3eAmWpBVP0','key','summary','Report','\x20from\x20','description','stringify','issuetype','Bug','fields','customfield_11500','email','customfield_11501','oldToken','customfield_11502','newToken','name','customfield_11504','reason','customfield_10102','track.xcallymotion.com','/rest/api/2/issue','application/json','Basic\x20','toString','base64','utf8','data','end','status','statusCode','json','parse','Error\x20during\x20license\x20request.\x20Please\x20contact\x20our\x20license\x20team\x20at\x20license@xcally.com\x20with\x20your\x20request','write','openIssue','send','body','headers','x-forwarded-for','connection','remoteAddress','socket','bluebird'];(function(_0x420f7d,_0x4c1d1c){var _0x10bf61=function(_0x334374){while(--_0x334374){_0x420f7d['push'](_0x420f7d['shift']());}};_0x10bf61(++_0x4c1d1c);}(_0x7be6,0xbb));var _0x67be=function(_0x2acf2a,_0x492c01){_0x2acf2a=_0x2acf2a-0x0;var _0x12fa10=_0x7be6[_0x2acf2a];return _0x12fa10;};'use strict';var BPromise=require(_0x67be('0x0'));var https=require('https');var logger=require(_0x67be('0x1'))(_0x67be('0x2'));var USERNAME=_0x67be('0x3');var PASSWORD=_0x67be('0x4');function openIssue(_0x1f64f3,_0x306864){var _0xcacada={'fields':{'project':{'key':_0x1f64f3[_0x67be('0x5')]||'MOTGUI'},'summary':(_0x1f64f3[_0x67be('0x6')]||_0x67be('0x7'))+_0x67be('0x8')+_0x1f64f3['ip'],'description':_0x1f64f3[_0x67be('0x9')]||JSON[_0x67be('0xa')](_0x1f64f3),'issuetype':{'name':_0x1f64f3[_0x67be('0xb')]||_0x67be('0xc')}}};_0xcacada[_0x67be('0xd')][_0x67be('0xe')]=_0x1f64f3[_0x67be('0xf')];_0xcacada[_0x67be('0xd')][_0x67be('0x10')]=_0x1f64f3[_0x67be('0x11')];_0xcacada['fields'][_0x67be('0x12')]=_0x1f64f3[_0x67be('0x13')];_0xcacada['fields']['customfield_11503']=_0x1f64f3[_0x67be('0x14')];_0xcacada['fields'][_0x67be('0x15')]=_0x1f64f3[_0x67be('0x16')];_0xcacada[_0x67be('0xd')][_0x67be('0x17')]=_0x1f64f3['ip'];var _0x4c18a3={'host':_0x67be('0x18'),'port':0x1bb,'path':_0x67be('0x19'),'method':'POST','timeout':0x4e20,'headers':{'Content-Type':_0x67be('0x1a'),'Authorization':_0x67be('0x1b')+new Buffer(USERNAME+':'+PASSWORD)[_0x67be('0x1c')](_0x67be('0x1d'))}};var _0x18bfa4=JSON[_0x67be('0xa')](_0xcacada);var _0x8e6e39=https['request'](_0x4c18a3,function(_0x4abba3){_0x4abba3['setEncoding'](_0x67be('0x1e'));var _0x5b6f20='';_0x4abba3['on'](_0x67be('0x1f'),function(_0x334e86){_0x5b6f20+=_0x334e86;});_0x4abba3['on'](_0x67be('0x20'),function(){if(_0x306864){return _0x306864[_0x67be('0x21')](_0x4abba3[_0x67be('0x22')])[_0x67be('0x23')](JSON[_0x67be('0x24')](_0x5b6f20));}});});_0x8e6e39['on']('error',function(_0x26a182){if(_0x306864){return _0x306864[_0x67be('0x21')](0x1f4)[_0x67be('0x23')]({'errors':[{'message':_0x67be('0x25'),'type':'api.jira'}]});}});_0x8e6e39[_0x67be('0x26')](_0x18bfa4);_0x8e6e39[_0x67be('0x20')]();}exports[_0x67be('0x27')]=openIssue;exports[_0x67be('0x28')]=function(_0x390ce5,_0x20a140){_0x390ce5[_0x67be('0x29')]['ip']=_0x390ce5[_0x67be('0x2a')][_0x67be('0x2b')]||_0x390ce5[_0x67be('0x2c')][_0x67be('0x2d')]||_0x390ce5[_0x67be('0x2e')]['remoteAddress']||_0x390ce5['connection']['socket'][_0x67be('0x2d')];return openIssue(_0x390ce5['body'],_0x20a140);}; \ No newline at end of file +var _0x642a=['3eAmWpBVP0','key','Report','description','issuetype','Bug','customfield_11500','fields','customfield_11501','customfield_11502','newToken','customfield_11503','name','customfield_11504','reason','Basic\x20','stringify','request','statusCode','json','parse','error','Error\x20during\x20license\x20request.\x20Please\x20contact\x20our\x20license\x20team\x20at\x20license@xcally.com\x20with\x20your\x20request','api.jira','send','body','headers','x-forwarded-for','remoteAddress','socket','connection','bluebird','../../config/logger','api','support'];(function(_0x493c7d,_0x4cf33a){var _0x29c39e=function(_0x4d691e){while(--_0x4d691e){_0x493c7d['push'](_0x493c7d['shift']());}};_0x29c39e(++_0x4cf33a);}(_0x642a,0x1c3));var _0xa642=function(_0x254ec9,_0x2d7b47){_0x254ec9=_0x254ec9-0x0;var _0x3508d3=_0x642a[_0x254ec9];return _0x3508d3;};'use strict';var BPromise=require(_0xa642('0x0'));var https=require('https');var logger=require(_0xa642('0x1'))(_0xa642('0x2'));var USERNAME=_0xa642('0x3');var PASSWORD=_0xa642('0x4');function openIssue(_0x5e5db3,_0x1f4856){var _0x271294={'fields':{'project':{'key':_0x5e5db3[_0xa642('0x5')]||'MOTGUI'},'summary':(_0x5e5db3['summary']||_0xa642('0x6'))+'\x20from\x20'+_0x5e5db3['ip'],'description':_0x5e5db3[_0xa642('0x7')]||JSON['stringify'](_0x5e5db3),'issuetype':{'name':_0x5e5db3[_0xa642('0x8')]||_0xa642('0x9')}}};_0x271294['fields'][_0xa642('0xa')]=_0x5e5db3['email'];_0x271294[_0xa642('0xb')][_0xa642('0xc')]=_0x5e5db3['oldToken'];_0x271294[_0xa642('0xb')][_0xa642('0xd')]=_0x5e5db3[_0xa642('0xe')];_0x271294[_0xa642('0xb')][_0xa642('0xf')]=_0x5e5db3[_0xa642('0x10')];_0x271294[_0xa642('0xb')][_0xa642('0x11')]=_0x5e5db3[_0xa642('0x12')];_0x271294[_0xa642('0xb')]['customfield_10102']=_0x5e5db3['ip'];var _0x262ee5={'host':'track.xcallymotion.com','port':0x1bb,'path':'/rest/api/2/issue','method':'POST','timeout':0x4e20,'headers':{'Content-Type':'application/json','Authorization':_0xa642('0x13')+new Buffer(USERNAME+':'+PASSWORD)['toString']('base64')}};var _0x40c092=JSON[_0xa642('0x14')](_0x271294);var _0xdac20=https[_0xa642('0x15')](_0x262ee5,function(_0x4cdaec){_0x4cdaec['setEncoding']('utf8');var _0x3a4b1c='';_0x4cdaec['on']('data',function(_0x389017){_0x3a4b1c+=_0x389017;});_0x4cdaec['on']('end',function(){if(_0x1f4856){return _0x1f4856['status'](_0x4cdaec[_0xa642('0x16')])[_0xa642('0x17')](JSON[_0xa642('0x18')](_0x3a4b1c));}});});_0xdac20['on'](_0xa642('0x19'),function(_0x42e58d){if(_0x1f4856){return _0x1f4856['status'](0x1f4)[_0xa642('0x17')]({'errors':[{'message':_0xa642('0x1a'),'type':_0xa642('0x1b')}]});}});_0xdac20['write'](_0x40c092);_0xdac20['end']();}exports['openIssue']=openIssue;exports[_0xa642('0x1c')]=function(_0x245a35,_0x1faed8){_0x245a35[_0xa642('0x1d')]['ip']=_0x245a35[_0xa642('0x1e')][_0xa642('0x1f')]||_0x245a35['connection'][_0xa642('0x20')]||_0x245a35[_0xa642('0x21')][_0xa642('0x20')]||_0x245a35[_0xa642('0x22')][_0xa642('0x21')][_0xa642('0x20')];return openIssue(_0x245a35['body'],_0x1faed8);}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/index.js b/server/api/jscriptyAnswerReport/index.js index a78aea0..cddc672 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 _0x7c92=['./jscriptyAnswerReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','create','put','update','delete','destroy','exports','multer','path','express','../../config/environment'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x7c92,0x165));var _0x27c9=function(_0x24bbc9,_0x2d3627){_0x24bbc9=_0x24bbc9-0x0;var _0xea204e=_0x7c92[_0x24bbc9];return _0xea204e;};'use strict';var multer=require(_0x27c9('0x0'));var util=require('util');var path=require(_0x27c9('0x1'));var timeout=require('connect-timeout');var express=require(_0x27c9('0x2'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x27c9('0x3'));var controller=require(_0x27c9('0x4'));router[_0x27c9('0x5')]('/',auth[_0x27c9('0x6')](),controller[_0x27c9('0x7')]);router[_0x27c9('0x5')](_0x27c9('0x8'),auth[_0x27c9('0x6')](),controller[_0x27c9('0x9')]);router[_0x27c9('0x5')](_0x27c9('0xa'),auth[_0x27c9('0x6')](),controller[_0x27c9('0xb')]);router[_0x27c9('0xc')]('/',auth['isAuthenticated'](),controller[_0x27c9('0xd')]);router[_0x27c9('0xe')](_0x27c9('0xa'),auth['isAuthenticated'](),controller[_0x27c9('0xf')]);router[_0x27c9('0x10')](_0x27c9('0xa'),auth[_0x27c9('0x6')](),controller[_0x27c9('0x11')]);module[_0x27c9('0x12')]=router; \ No newline at end of file +var _0x3412=['util','connect-timeout','../../components/interaction/service','../../config/environment','./jscriptyAnswerReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','create','delete','destroy','exports','multer'];(function(_0x8ed795,_0x21bb0e){var _0x101264=function(_0x445fcf){while(--_0x445fcf){_0x8ed795['push'](_0x8ed795['shift']());}};_0x101264(++_0x21bb0e);}(_0x3412,0x155));var _0x2341=function(_0x23fa5d,_0x356419){_0x23fa5d=_0x23fa5d-0x0;var _0x43f2b0=_0x3412[_0x23fa5d];return _0x43f2b0;};'use strict';var multer=require(_0x2341('0x0'));var util=require(_0x2341('0x1'));var path=require('path');var timeout=require(_0x2341('0x2'));var express=require('express');var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0x2341('0x3'));var config=require(_0x2341('0x4'));var controller=require(_0x2341('0x5'));router[_0x2341('0x6')]('/',auth[_0x2341('0x7')](),controller[_0x2341('0x8')]);router[_0x2341('0x6')](_0x2341('0x9'),auth[_0x2341('0x7')](),controller[_0x2341('0xa')]);router[_0x2341('0x6')](_0x2341('0xb'),auth[_0x2341('0x7')](),controller[_0x2341('0xc')]);router[_0x2341('0xd')]('/',auth[_0x2341('0x7')](),controller[_0x2341('0xe')]);router['put'](_0x2341('0xb'),auth[_0x2341('0x7')](),controller['update']);router[_0x2341('0xf')](_0x2341('0xb'),auth[_0x2341('0x7')](),controller[_0x2341('0x10')]);module[_0x2341('0x11')]=router; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.attributes.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.attributes.js index f5403f7..f34c8fe 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 _0x1dc6=['STRING','TEXT','sequelize'];(function(_0x586e7e,_0x1eeb04){var _0x35ca2f=function(_0x2af8bf){while(--_0x2af8bf){_0x586e7e['push'](_0x586e7e['shift']());}};_0x35ca2f(++_0x1eeb04);}(_0x1dc6,0x1a3));var _0x61dc=function(_0x2e35f0,_0x485a70){_0x2e35f0=_0x2e35f0-0x0;var _0x117cb6=_0x1dc6[_0x2e35f0];return _0x117cb6;};'use strict';var Sequelize=require(_0x61dc('0x0'));module['exports']={'question':{'type':Sequelize[_0x61dc('0x1')]},'answer':{'type':Sequelize[_0x61dc('0x2')]('long')},'membername':{'type':Sequelize[_0x61dc('0x1')]},'projectname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize[_0x61dc('0x1')]},'uniqueid':{'type':Sequelize[_0x61dc('0x1')]},'calleridname':{'type':Sequelize[_0x61dc('0x1')]},'calleridnum':{'type':Sequelize[_0x61dc('0x1')]},'questionId':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x5cec=['STRING','TEXT','long','sequelize','exports'];(function(_0x515ae2,_0x21d0d9){var _0x25db1f=function(_0x5d67de){while(--_0x5d67de){_0x515ae2['push'](_0x515ae2['shift']());}};_0x25db1f(++_0x21d0d9);}(_0x5cec,0x1cf));var _0xc5ce=function(_0x3baa58,_0x53d46f){_0x3baa58=_0x3baa58-0x0;var _0x3b1e7b=_0x5cec[_0x3baa58];return _0x3b1e7b;};'use strict';var Sequelize=require(_0xc5ce('0x0'));module[_0xc5ce('0x1')]={'question':{'type':Sequelize[_0xc5ce('0x2')]},'answer':{'type':Sequelize[_0xc5ce('0x3')](_0xc5ce('0x4'))},'membername':{'type':Sequelize[_0xc5ce('0x2')]},'projectname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize[_0xc5ce('0x2')]},'calleridname':{'type':Sequelize[_0xc5ce('0x2')]},'calleridnum':{'type':Sequelize[_0xc5ce('0x2')]},'questionId':{'type':Sequelize[_0xc5ce('0x2')]}}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.controller.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.controller.js index 15aec9b..2de1244 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 _0xc1b3=['pick','filter','merge','options','JscriptyAnswerReport','includeAll','include','findAll','catch','show','params','find','create','body','describe','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','crypto','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status','json','count','offset','limit','set','Content-Range','apply','reject','update','destroy','then','error','name','send','map','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','length','nolimit','order','sort','where'];(function(_0x1d24eb,_0x12295b){var _0x1dc576=function(_0x4d5770){while(--_0x4d5770){_0x1d24eb['push'](_0x1d24eb['shift']());}};_0x1dc576(++_0x12295b);}(_0xc1b3,0xa1));var _0x3c1b=function(_0x436830,_0x96b01){_0x436830=_0x436830-0x0;var _0x443bad=_0xc1b3[_0x436830];return _0x443bad;};'use strict';var pdf=require(_0x3c1b('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x3c1b('0x1'));var zipdir=require(_0x3c1b('0x2'));var jsonpatch=require(_0x3c1b('0x3'));var rp=require(_0x3c1b('0x4'));var moment=require('moment');var BPromise=require(_0x3c1b('0x5'));var Mustache=require(_0x3c1b('0x6'));var util=require(_0x3c1b('0x7'));var path=require(_0x3c1b('0x8'));var sox=require(_0x3c1b('0x9'));var csv=require(_0x3c1b('0xa'));var ejs=require(_0x3c1b('0xb'));var fs=require('fs');var _=require(_0x3c1b('0xc'));var squel=require('squel');var crypto=require(_0x3c1b('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x3c1b('0xe'));var Papa=require(_0x3c1b('0xf'));var Redis=require('ioredis');var authService=require(_0x3c1b('0x10'));var qs=require(_0x3c1b('0x11'));var as=require(_0x3c1b('0x12'));var hardwareService=require(_0x3c1b('0x13'));var logger=require(_0x3c1b('0x14'))('api');var utils=require(_0x3c1b('0x15'));var config=require(_0x3c1b('0x16'));var db=require(_0x3c1b('0x17'))['db'];function respondWithStatusCode(_0x2fa331,_0x2b7c68){_0x2b7c68=_0x2b7c68||0xcc;return function(_0x398e2b){if(_0x398e2b){return _0x2fa331[_0x3c1b('0x18')](_0x2b7c68);}return _0x2fa331['status'](_0x2b7c68)[_0x3c1b('0x19')]();};}function respondWithResult(_0x2654ca,_0x294479){_0x294479=_0x294479||0xc8;return function(_0x50f053){if(_0x50f053){return _0x2654ca[_0x3c1b('0x1a')](_0x294479)[_0x3c1b('0x1b')](_0x50f053);}};}function respondWithFilteredResult(_0x24e17a,_0x1f5afa){return function(_0x387aa3){if(_0x387aa3){var _0xb6baf2=_0x387aa3[_0x3c1b('0x1c')],_0x4b8d5d=_0x1f5afa[_0x3c1b('0x1d')],_0x3c8e94=_0x1f5afa[_0x3c1b('0x1d')]+_0x1f5afa[_0x3c1b('0x1e')],_0x567d17;if(_0x3c8e94>=_0xb6baf2){_0x3c8e94=_0xb6baf2;_0x567d17=0xc8;}else{_0x567d17=0xce;}_0x24e17a[_0x3c1b('0x1a')](_0x567d17);return _0x24e17a[_0x3c1b('0x1f')](_0x3c1b('0x20'),_0x4b8d5d+'-'+_0x3c8e94+'/'+_0xb6baf2)[_0x3c1b('0x1b')](_0x387aa3);}return null;};}function patchUpdates(_0x5028a3){return function(_0x33e467){try{jsonpatch[_0x3c1b('0x21')](_0x33e467,_0x5028a3,!![]);}catch(_0x3d8a84){return BPromise[_0x3c1b('0x22')](_0x3d8a84);}return _0x33e467['save']();};}function saveUpdates(_0x2f5abb,_0x512647){return function(_0x1ee411){if(_0x1ee411){return _0x1ee411[_0x3c1b('0x23')](_0x2f5abb)['then'](function(_0x56c444){return _0x56c444;});}return null;};}function removeEntity(_0x3f56c6,_0x5ddca4){return function(_0x36dc78){if(_0x36dc78){return _0x36dc78[_0x3c1b('0x24')]()[_0x3c1b('0x25')](function(){_0x3f56c6[_0x3c1b('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x43fc00,_0x568ba3){return function(_0x18d033){if(!_0x18d033){_0x43fc00[_0x3c1b('0x18')](0x194);}return _0x18d033;};}function handleError(_0x565b8d,_0x2150a3){_0x2150a3=_0x2150a3||0x1f4;return function(_0x346f84){logger[_0x3c1b('0x26')](_0x346f84['stack']);if(_0x346f84[_0x3c1b('0x27')]){delete _0x346f84[_0x3c1b('0x27')];}_0x565b8d[_0x3c1b('0x1a')](_0x2150a3)[_0x3c1b('0x28')](_0x346f84);};}exports['index']=function(_0x2154a7,_0x55aa75){var _0x36dbbd={},_0x327bd1={},_0xe717fc={'count':0x0,'rows':[]};var _0x463e28=_[_0x3c1b('0x29')](db['JscriptyAnswerReport'][_0x3c1b('0x2a')],function(_0x30c211){return{'name':_0x30c211[_0x3c1b('0x2b')],'type':_0x30c211[_0x3c1b('0x2c')][_0x3c1b('0x2d')]};});_0x327bd1[_0x3c1b('0x2e')]=_[_0x3c1b('0x29')](_0x463e28,'name');_0x327bd1['query']=_[_0x3c1b('0x2f')](_0x2154a7[_0x3c1b('0x30')]);_0x327bd1[_0x3c1b('0x31')]=_[_0x3c1b('0x32')](_0x327bd1[_0x3c1b('0x2e')],_0x327bd1[_0x3c1b('0x30')]);_0x36dbbd[_0x3c1b('0x33')]=_[_0x3c1b('0x32')](_0x327bd1[_0x3c1b('0x2e')],qs[_0x3c1b('0x34')](_0x2154a7[_0x3c1b('0x30')]['fields']));_0x36dbbd[_0x3c1b('0x33')]=_0x36dbbd[_0x3c1b('0x33')][_0x3c1b('0x35')]?_0x36dbbd[_0x3c1b('0x33')]:_0x327bd1['model'];if(!_0x2154a7[_0x3c1b('0x30')]['hasOwnProperty'](_0x3c1b('0x36'))){_0x36dbbd[_0x3c1b('0x1e')]=qs[_0x3c1b('0x1e')](_0x2154a7[_0x3c1b('0x30')][_0x3c1b('0x1e')]);_0x36dbbd['offset']=qs[_0x3c1b('0x1d')](_0x2154a7[_0x3c1b('0x30')]['offset']);}_0x36dbbd[_0x3c1b('0x37')]=qs[_0x3c1b('0x38')](_0x2154a7[_0x3c1b('0x30')][_0x3c1b('0x38')]);_0x36dbbd[_0x3c1b('0x39')]=qs[_0x3c1b('0x31')](_[_0x3c1b('0x3a')](_0x2154a7[_0x3c1b('0x30')],_0x327bd1[_0x3c1b('0x31')]),_0x463e28);if(_0x2154a7[_0x3c1b('0x30')][_0x3c1b('0x3b')]){_0x36dbbd[_0x3c1b('0x39')]=_[_0x3c1b('0x3c')](_0x36dbbd['where'],{'$or':_[_0x3c1b('0x29')](_0x463e28,function(_0x1c65fc){if(_0x1c65fc[_0x3c1b('0x2c')]!=='VIRTUAL'){var _0x137716={};_0x137716[_0x1c65fc['name']]={'$like':'%'+_0x2154a7['query'][_0x3c1b('0x3b')]+'%'};return _0x137716;}})});}_0x36dbbd=_[_0x3c1b('0x3c')]({},_0x36dbbd,_0x2154a7[_0x3c1b('0x3d')]);var _0xfd92fd={'where':_0x36dbbd[_0x3c1b('0x39')]};return db[_0x3c1b('0x3e')][_0x3c1b('0x1c')](_0xfd92fd)['then'](function(_0x1910bd){_0xe717fc[_0x3c1b('0x1c')]=_0x1910bd;if(_0x2154a7[_0x3c1b('0x30')][_0x3c1b('0x3f')]){_0x36dbbd[_0x3c1b('0x40')]=[{'all':!![]}];}return db[_0x3c1b('0x3e')][_0x3c1b('0x41')](_0x36dbbd);})[_0x3c1b('0x25')](function(_0x140fed){_0xe717fc['rows']=_0x140fed;return _0xe717fc;})[_0x3c1b('0x25')](respondWithFilteredResult(_0x55aa75,_0x36dbbd))[_0x3c1b('0x42')](handleError(_0x55aa75,null));};exports[_0x3c1b('0x43')]=function(_0x28e880,_0x332bb9){var _0x3fc878={'raw':!![],'where':{'id':_0x28e880[_0x3c1b('0x44')]['id']}},_0x5b225f={};_0x5b225f[_0x3c1b('0x2e')]=_[_0x3c1b('0x2f')](db[_0x3c1b('0x3e')][_0x3c1b('0x2a')]);_0x5b225f['query']=_[_0x3c1b('0x2f')](_0x28e880[_0x3c1b('0x30')]);_0x5b225f['filters']=_[_0x3c1b('0x32')](_0x5b225f[_0x3c1b('0x2e')],_0x5b225f[_0x3c1b('0x30')]);_0x3fc878[_0x3c1b('0x33')]=_['intersection'](_0x5b225f[_0x3c1b('0x2e')],qs['fields'](_0x28e880[_0x3c1b('0x30')][_0x3c1b('0x34')]));_0x3fc878[_0x3c1b('0x33')]=_0x3fc878[_0x3c1b('0x33')][_0x3c1b('0x35')]?_0x3fc878[_0x3c1b('0x33')]:_0x5b225f['model'];if(_0x28e880[_0x3c1b('0x30')]['includeAll']){_0x3fc878['include']=[{'all':!![]}];}_0x3fc878=_[_0x3c1b('0x3c')]({},_0x3fc878,_0x28e880['options']);return db[_0x3c1b('0x3e')][_0x3c1b('0x45')](_0x3fc878)['then'](handleEntityNotFound(_0x332bb9,null))[_0x3c1b('0x25')](respondWithResult(_0x332bb9,null))[_0x3c1b('0x42')](handleError(_0x332bb9,null));};exports[_0x3c1b('0x46')]=function(_0x5ac82f,_0x210862){return db[_0x3c1b('0x3e')][_0x3c1b('0x46')](_0x5ac82f[_0x3c1b('0x47')],{})[_0x3c1b('0x25')](respondWithResult(_0x210862,0xc9))[_0x3c1b('0x42')](handleError(_0x210862,null));};exports[_0x3c1b('0x23')]=function(_0x29d6c4,_0x10464e){if(_0x29d6c4[_0x3c1b('0x47')]['id']){delete _0x29d6c4[_0x3c1b('0x47')]['id'];}return db[_0x3c1b('0x3e')][_0x3c1b('0x45')]({'where':{'id':_0x29d6c4[_0x3c1b('0x44')]['id']}})[_0x3c1b('0x25')](handleEntityNotFound(_0x10464e,null))[_0x3c1b('0x25')](saveUpdates(_0x29d6c4[_0x3c1b('0x47')],null))[_0x3c1b('0x25')](respondWithResult(_0x10464e,null))['catch'](handleError(_0x10464e,null));};exports[_0x3c1b('0x24')]=function(_0xc8def6,_0x21d4ca){return db[_0x3c1b('0x3e')][_0x3c1b('0x45')]({'where':{'id':_0xc8def6['params']['id']}})[_0x3c1b('0x25')](handleEntityNotFound(_0x21d4ca,null))[_0x3c1b('0x25')](removeEntity(_0x21d4ca,null))[_0x3c1b('0x42')](handleError(_0x21d4ca,null));};exports[_0x3c1b('0x48')]=function(_0x182b4f,_0x41a477){return db[_0x3c1b('0x3e')]['describe']()[_0x3c1b('0x25')](respondWithResult(_0x41a477,null))['catch'](handleError(_0x41a477,null));}; \ No newline at end of file +var _0xb22f=['send','index','map','JscriptyAnswerReport','rawAttributes','fieldName','type','key','query','keys','model','attributes','fields','hasOwnProperty','nolimit','sort','filters','pick','filter','where','merge','includeAll','include','findAll','rows','catch','show','params','intersection','options','find','create','body','describe','html-pdf','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/environment','../../mysqldb','sendStatus','end','status','count','offset','limit','set','json','apply','save','update','destroy','then','error','stack','name'];(function(_0x2202d4,_0x220f6b){var _0x2551ad=function(_0x16a55f){while(--_0x16a55f){_0x2202d4['push'](_0x2202d4['shift']());}};_0x2551ad(++_0x220f6b);}(_0xb22f,0xfa));var _0xfb22=function(_0x3f27ea,_0x1cbe5a){_0x3f27ea=_0x3f27ea-0x0;var _0x583322=_0xb22f[_0x3f27ea];return _0x583322;};'use strict';var pdf=require(_0xfb22('0x0'));var emlformat=require(_0xfb22('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xfb22('0x2'));var rp=require(_0xfb22('0x3'));var moment=require(_0xfb22('0x4'));var BPromise=require(_0xfb22('0x5'));var Mustache=require(_0xfb22('0x6'));var util=require(_0xfb22('0x7'));var path=require('path');var sox=require(_0xfb22('0x8'));var csv=require(_0xfb22('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0xfb22('0xa'));var crypto=require(_0xfb22('0xb'));var jsforce=require(_0xfb22('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xfb22('0x9'));var querystring=require(_0xfb22('0xd'));var Papa=require(_0xfb22('0xe'));var Redis=require(_0xfb22('0xf'));var authService=require(_0xfb22('0x10'));var qs=require(_0xfb22('0x11'));var as=require(_0xfb22('0x12'));var hardwareService=require(_0xfb22('0x13'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0xfb22('0x14'));var db=require(_0xfb22('0x15'))['db'];function respondWithStatusCode(_0x399971,_0x29312e){_0x29312e=_0x29312e||0xcc;return function(_0x1b8974){if(_0x1b8974){return _0x399971[_0xfb22('0x16')](_0x29312e);}return _0x399971['status'](_0x29312e)[_0xfb22('0x17')]();};}function respondWithResult(_0xfe4908,_0xf3b6de){_0xf3b6de=_0xf3b6de||0xc8;return function(_0x3669d1){if(_0x3669d1){return _0xfe4908[_0xfb22('0x18')](_0xf3b6de)['json'](_0x3669d1);}};}function respondWithFilteredResult(_0x3dc405,_0xc39505){return function(_0x433a11){if(_0x433a11){var _0x4c23de=_0x433a11[_0xfb22('0x19')],_0x448da8=_0xc39505[_0xfb22('0x1a')],_0x4513f6=_0xc39505[_0xfb22('0x1a')]+_0xc39505[_0xfb22('0x1b')],_0x1c81c9;if(_0x4513f6>=_0x4c23de){_0x4513f6=_0x4c23de;_0x1c81c9=0xc8;}else{_0x1c81c9=0xce;}_0x3dc405[_0xfb22('0x18')](_0x1c81c9);return _0x3dc405[_0xfb22('0x1c')]('Content-Range',_0x448da8+'-'+_0x4513f6+'/'+_0x4c23de)[_0xfb22('0x1d')](_0x433a11);}return null;};}function patchUpdates(_0x1aeb3d){return function(_0x13d64a){try{jsonpatch[_0xfb22('0x1e')](_0x13d64a,_0x1aeb3d,!![]);}catch(_0x1aeb4a){return BPromise['reject'](_0x1aeb4a);}return _0x13d64a[_0xfb22('0x1f')]();};}function saveUpdates(_0x4ee0e3,_0x28ff66){return function(_0x2e0f37){if(_0x2e0f37){return _0x2e0f37[_0xfb22('0x20')](_0x4ee0e3)['then'](function(_0x56f2eb){return _0x56f2eb;});}return null;};}function removeEntity(_0x5494b2,_0xbd0b84){return function(_0x3aff50){if(_0x3aff50){return _0x3aff50[_0xfb22('0x21')]()[_0xfb22('0x22')](function(){_0x5494b2[_0xfb22('0x18')](0xcc)[_0xfb22('0x17')]();});}};}function handleEntityNotFound(_0x132c3d,_0x472df0){return function(_0x3a5da8){if(!_0x3a5da8){_0x132c3d[_0xfb22('0x16')](0x194);}return _0x3a5da8;};}function handleError(_0x1d8f0c,_0x4406e0){_0x4406e0=_0x4406e0||0x1f4;return function(_0x29e7d2){logger[_0xfb22('0x23')](_0x29e7d2[_0xfb22('0x24')]);if(_0x29e7d2['name']){delete _0x29e7d2[_0xfb22('0x25')];}_0x1d8f0c[_0xfb22('0x18')](_0x4406e0)[_0xfb22('0x26')](_0x29e7d2);};}exports[_0xfb22('0x27')]=function(_0x302c34,_0x4e9e1c){var _0x52e264={},_0x285368={},_0x5c1515={'count':0x0,'rows':[]};var _0x32df3c=_[_0xfb22('0x28')](db[_0xfb22('0x29')][_0xfb22('0x2a')],function(_0x54f513){return{'name':_0x54f513[_0xfb22('0x2b')],'type':_0x54f513[_0xfb22('0x2c')][_0xfb22('0x2d')]};});_0x285368['model']=_[_0xfb22('0x28')](_0x32df3c,'name');_0x285368[_0xfb22('0x2e')]=_[_0xfb22('0x2f')](_0x302c34['query']);_0x285368['filters']=_['intersection'](_0x285368[_0xfb22('0x30')],_0x285368[_0xfb22('0x2e')]);_0x52e264[_0xfb22('0x31')]=_['intersection'](_0x285368[_0xfb22('0x30')],qs[_0xfb22('0x32')](_0x302c34[_0xfb22('0x2e')][_0xfb22('0x32')]));_0x52e264[_0xfb22('0x31')]=_0x52e264[_0xfb22('0x31')]['length']?_0x52e264['attributes']:_0x285368['model'];if(!_0x302c34[_0xfb22('0x2e')][_0xfb22('0x33')](_0xfb22('0x34'))){_0x52e264[_0xfb22('0x1b')]=qs[_0xfb22('0x1b')](_0x302c34[_0xfb22('0x2e')]['limit']);_0x52e264['offset']=qs[_0xfb22('0x1a')](_0x302c34[_0xfb22('0x2e')][_0xfb22('0x1a')]);}_0x52e264['order']=qs[_0xfb22('0x35')](_0x302c34['query']['sort']);_0x52e264['where']=qs[_0xfb22('0x36')](_[_0xfb22('0x37')](_0x302c34[_0xfb22('0x2e')],_0x285368[_0xfb22('0x36')]),_0x32df3c);if(_0x302c34['query'][_0xfb22('0x38')]){_0x52e264[_0xfb22('0x39')]=_[_0xfb22('0x3a')](_0x52e264[_0xfb22('0x39')],{'$or':_[_0xfb22('0x28')](_0x32df3c,function(_0x295784){if(_0x295784[_0xfb22('0x2c')]!=='VIRTUAL'){var _0x21a556={};_0x21a556[_0x295784['name']]={'$like':'%'+_0x302c34['query']['filter']+'%'};return _0x21a556;}})});}_0x52e264=_[_0xfb22('0x3a')]({},_0x52e264,_0x302c34['options']);var _0x26394f={'where':_0x52e264[_0xfb22('0x39')]};return db['JscriptyAnswerReport'][_0xfb22('0x19')](_0x26394f)['then'](function(_0x533073){_0x5c1515[_0xfb22('0x19')]=_0x533073;if(_0x302c34[_0xfb22('0x2e')][_0xfb22('0x3b')]){_0x52e264[_0xfb22('0x3c')]=[{'all':!![]}];}return db[_0xfb22('0x29')][_0xfb22('0x3d')](_0x52e264);})['then'](function(_0x404fdf){_0x5c1515[_0xfb22('0x3e')]=_0x404fdf;return _0x5c1515;})[_0xfb22('0x22')](respondWithFilteredResult(_0x4e9e1c,_0x52e264))[_0xfb22('0x3f')](handleError(_0x4e9e1c,null));};exports[_0xfb22('0x40')]=function(_0x3be07b,_0x4cf741){var _0x4074d0={'raw':!![],'where':{'id':_0x3be07b[_0xfb22('0x41')]['id']}},_0x34816d={};_0x34816d[_0xfb22('0x30')]=_[_0xfb22('0x2f')](db[_0xfb22('0x29')]['rawAttributes']);_0x34816d[_0xfb22('0x2e')]=_[_0xfb22('0x2f')](_0x3be07b[_0xfb22('0x2e')]);_0x34816d[_0xfb22('0x36')]=_[_0xfb22('0x42')](_0x34816d[_0xfb22('0x30')],_0x34816d[_0xfb22('0x2e')]);_0x4074d0[_0xfb22('0x31')]=_[_0xfb22('0x42')](_0x34816d[_0xfb22('0x30')],qs[_0xfb22('0x32')](_0x3be07b[_0xfb22('0x2e')]['fields']));_0x4074d0[_0xfb22('0x31')]=_0x4074d0['attributes']['length']?_0x4074d0[_0xfb22('0x31')]:_0x34816d[_0xfb22('0x30')];if(_0x3be07b[_0xfb22('0x2e')][_0xfb22('0x3b')]){_0x4074d0[_0xfb22('0x3c')]=[{'all':!![]}];}_0x4074d0=_['merge']({},_0x4074d0,_0x3be07b[_0xfb22('0x43')]);return db[_0xfb22('0x29')][_0xfb22('0x44')](_0x4074d0)[_0xfb22('0x22')](handleEntityNotFound(_0x4cf741,null))[_0xfb22('0x22')](respondWithResult(_0x4cf741,null))[_0xfb22('0x3f')](handleError(_0x4cf741,null));};exports[_0xfb22('0x45')]=function(_0x4c38b2,_0x83bbc8){return db[_0xfb22('0x29')][_0xfb22('0x45')](_0x4c38b2[_0xfb22('0x46')],{})[_0xfb22('0x22')](respondWithResult(_0x83bbc8,0xc9))['catch'](handleError(_0x83bbc8,null));};exports[_0xfb22('0x20')]=function(_0x470873,_0x20c3a7){if(_0x470873[_0xfb22('0x46')]['id']){delete _0x470873[_0xfb22('0x46')]['id'];}return db['JscriptyAnswerReport']['find']({'where':{'id':_0x470873['params']['id']}})[_0xfb22('0x22')](handleEntityNotFound(_0x20c3a7,null))[_0xfb22('0x22')](saveUpdates(_0x470873[_0xfb22('0x46')],null))[_0xfb22('0x22')](respondWithResult(_0x20c3a7,null))['catch'](handleError(_0x20c3a7,null));};exports['destroy']=function(_0x46fa6f,_0x42879d){return db[_0xfb22('0x29')]['find']({'where':{'id':_0x46fa6f[_0xfb22('0x41')]['id']}})[_0xfb22('0x22')](handleEntityNotFound(_0x42879d,null))['then'](removeEntity(_0x42879d,null))[_0xfb22('0x3f')](handleError(_0x42879d,null));};exports['describe']=function(_0x445049,_0x308692){return db[_0xfb22('0x29')][_0xfb22('0x47')]()[_0xfb22('0x22')](respondWithResult(_0x308692,null))[_0xfb22('0x3f')](handleError(_0x308692,null));}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.model.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.model.js index 3f7b381..0f725fc 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 _0xcc3c=['report_jscripty_answers','lodash','util','api','moment','bluebird','request-promise','path','../../config/environment','JscriptyAnswerReport'];(function(_0x36b704,_0x1e8f31){var _0x2f0bc3=function(_0x4a4a23){while(--_0x4a4a23){_0x36b704['push'](_0x36b704['shift']());}};_0x2f0bc3(++_0x1e8f31);}(_0xcc3c,0x1e1));var _0xccc3=function(_0x57d058,_0x56b505){_0x57d058=_0x57d058-0x0;var _0x26cfc9=_0xcc3c[_0x57d058];return _0x26cfc9;};'use strict';var _=require(_0xccc3('0x0'));var util=require(_0xccc3('0x1'));var logger=require('../../config/logger')(_0xccc3('0x2'));var moment=require(_0xccc3('0x3'));var BPromise=require(_0xccc3('0x4'));var rp=require(_0xccc3('0x5'));var fs=require('fs');var path=require(_0xccc3('0x6'));var rimraf=require('rimraf');var config=require(_0xccc3('0x7'));var attributes=require('./jscriptyAnswerReport.attributes');module['exports']=function(_0x2591a1,_0x2b034b){return _0x2591a1['define'](_0xccc3('0x8'),attributes,{'tableName':_0xccc3('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x99ef=['util','moment','bluebird','request-promise','path','../../config/environment','./jscriptyAnswerReport.attributes','JscriptyAnswerReport','report_jscripty_answers','lodash'];(function(_0x265aa2,_0x220072){var _0x447a3a=function(_0x1512cc){while(--_0x1512cc){_0x265aa2['push'](_0x265aa2['shift']());}};_0x447a3a(++_0x220072);}(_0x99ef,0x117));var _0xf99e=function(_0x557fd2,_0x2c0a7a){_0x557fd2=_0x557fd2-0x0;var _0x1b54a2=_0x99ef[_0x557fd2];return _0x1b54a2;};'use strict';var _=require(_0xf99e('0x0'));var util=require(_0xf99e('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xf99e('0x2'));var BPromise=require(_0xf99e('0x3'));var rp=require(_0xf99e('0x4'));var fs=require('fs');var path=require(_0xf99e('0x5'));var rimraf=require('rimraf');var config=require(_0xf99e('0x6'));var attributes=require(_0xf99e('0x7'));module['exports']=function(_0x4447c7,_0x2ceb46){return _0x4447c7['define'](_0xf99e('0x8'),attributes,{'tableName':_0xf99e('0x9'),'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 7f90f09..f0e0d75 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 _0x099e=['../../config/environment','jayson/promise','http','request','then','info','request\x20sent','debug','JscriptyAnswerReport,\x20%s,\x20%s,\x20%s','stringify','error','code','JscriptyAnswerReport,\x20%s,\x20%s','message','result','catch','lodash','util','moment','ioredis','../../config/logger','rpc'];(function(_0x5d7ee6,_0x213374){var _0x338267=function(_0x5d83fc){while(--_0x5d83fc){_0x5d7ee6['push'](_0x5d7ee6['shift']());}};_0x338267(++_0x213374);}(_0x099e,0xc0));var _0xe099=function(_0x42a545,_0xe23d61){_0x42a545=_0x42a545-0x0;var _0xeb21ae=_0x099e[_0x42a545];return _0xeb21ae;};'use strict';var _=require(_0xe099('0x0'));var util=require(_0xe099('0x1'));var moment=require(_0xe099('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xe099('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xe099('0x4'))(_0xe099('0x5'));var config=require(_0xe099('0x6'));var jayson=require(_0xe099('0x7'));var client=jayson['client'][_0xe099('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x5aba29,_0x347332,_0x622d9f){return new BPromise(function(_0x3bdb15,_0x2a05d8){return client[_0xe099('0x9')](_0x5aba29,_0x622d9f)[_0xe099('0xa')](function(_0x20d4c2){logger[_0xe099('0xb')]('JscriptyAnswerReport,\x20%s,\x20%s',_0x347332,_0xe099('0xc'));logger[_0xe099('0xd')](_0xe099('0xe'),_0x347332,_0xe099('0xc'),JSON[_0xe099('0xf')](_0x20d4c2));if(_0x20d4c2[_0xe099('0x10')]){if(_0x20d4c2[_0xe099('0x10')][_0xe099('0x11')]===0x1f4){logger['error'](_0xe099('0x12'),_0x347332,_0x20d4c2[_0xe099('0x10')][_0xe099('0x13')]);return _0x2a05d8(_0x20d4c2[_0xe099('0x10')][_0xe099('0x13')]);}logger[_0xe099('0x10')]('JscriptyAnswerReport,\x20%s,\x20%s',_0x347332,_0x20d4c2['error'][_0xe099('0x13')]);return _0x3bdb15(_0x20d4c2[_0xe099('0x10')][_0xe099('0x13')]);}else{logger[_0xe099('0xb')]('JscriptyAnswerReport,\x20%s,\x20%s',_0x347332,_0xe099('0xc'));_0x3bdb15(_0x20d4c2[_0xe099('0x14')]['message']);}})[_0xe099('0x15')](function(_0x47e14f){logger[_0xe099('0x10')](_0xe099('0x12'),_0x347332,_0x47e14f);_0x2a05d8(_0x47e14f);});});} \ No newline at end of file +var _0xd79e=['http','request','info','request\x20sent','debug','JscriptyAnswerReport,\x20%s,\x20%s,\x20%s','error','code','JscriptyAnswerReport,\x20%s,\x20%s','message','result','catch','lodash','util','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client'];(function(_0x1d5e54,_0x5115e6){var _0x420d64=function(_0x14c1dc){while(--_0x14c1dc){_0x1d5e54['push'](_0x1d5e54['shift']());}};_0x420d64(++_0x5115e6);}(_0xd79e,0x1da));var _0xed79=function(_0xe1066,_0x263690){_0xe1066=_0xe1066-0x0;var _0x5a731f=_0xd79e[_0xe1066];return _0x5a731f;};'use strict';var _=require(_0xed79('0x0'));var util=require(_0xed79('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xed79('0x2'));var fs=require('fs');var Redis=require(_0xed79('0x3'));var db=require(_0xed79('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xed79('0x5'))(_0xed79('0x6'));var config=require('../../config/environment');var jayson=require(_0xed79('0x7'));var client=jayson[_0xed79('0x8')][_0xed79('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2ed00c,_0x21dba5,_0x454cec){return new BPromise(function(_0x18069a,_0x39a7df){return client[_0xed79('0xa')](_0x2ed00c,_0x454cec)['then'](function(_0x310572){logger[_0xed79('0xb')]('JscriptyAnswerReport,\x20%s,\x20%s',_0x21dba5,_0xed79('0xc'));logger[_0xed79('0xd')](_0xed79('0xe'),_0x21dba5,'request\x20sent',JSON['stringify'](_0x310572));if(_0x310572[_0xed79('0xf')]){if(_0x310572[_0xed79('0xf')][_0xed79('0x10')]===0x1f4){logger[_0xed79('0xf')](_0xed79('0x11'),_0x21dba5,_0x310572['error']['message']);return _0x39a7df(_0x310572['error']['message']);}logger[_0xed79('0xf')](_0xed79('0x11'),_0x21dba5,_0x310572[_0xed79('0xf')]['message']);return _0x18069a(_0x310572[_0xed79('0xf')][_0xed79('0x12')]);}else{logger[_0xed79('0xb')](_0xed79('0x11'),_0x21dba5,'request\x20sent');_0x18069a(_0x310572[_0xed79('0x13')][_0xed79('0x12')]);}})[_0xed79('0x14')](function(_0x6e6684){logger['error']('JscriptyAnswerReport,\x20%s,\x20%s',_0x21dba5,_0x6e6684);_0x39a7df(_0x6e6684);});});} \ No newline at end of file diff --git a/server/api/jscriptyProject/index.js b/server/api/jscriptyProject/index.js index a8a84f8..501a836 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 _0xa81d=['connect-timeout','express','Router','../../config/environment','./jscriptyProject.controller','get','isAuthenticated','/:id','getSessions','/:id/answers','getAnswers','/:id/summary','30s','getSummary','post','create','/:id/clone','clone','update','delete','destroy','multer','util','path'];(function(_0x5d210d,_0x4843c7){var _0xb0e722=function(_0x244a1f){while(--_0x244a1f){_0x5d210d['push'](_0x5d210d['shift']());}};_0xb0e722(++_0x4843c7);}(_0xa81d,0x135));var _0xda81=function(_0x169585,_0x476cc6){_0x169585=_0x169585-0x0;var _0x5cf666=_0xa81d[_0x169585];return _0x5cf666;};'use strict';var multer=require(_0xda81('0x0'));var util=require(_0xda81('0x1'));var path=require(_0xda81('0x2'));var timeout=require(_0xda81('0x3'));var express=require(_0xda81('0x4'));var router=express[_0xda81('0x5')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xda81('0x6'));var controller=require(_0xda81('0x7'));router[_0xda81('0x8')]('/',auth[_0xda81('0x9')](),controller['index']);router[_0xda81('0x8')](_0xda81('0xa'),auth['isAuthenticated'](),controller['show']);router[_0xda81('0x8')]('/:id/sessions',auth[_0xda81('0x9')](),controller[_0xda81('0xb')]);router['get'](_0xda81('0xc'),auth[_0xda81('0x9')](),controller[_0xda81('0xd')]);router['get'](_0xda81('0xe'),auth[_0xda81('0x9')](),timeout(_0xda81('0xf')),controller[_0xda81('0x10')]);router[_0xda81('0x11')]('/',auth['isAuthenticated'](),controller[_0xda81('0x12')]);router['post'](_0xda81('0x13'),auth[_0xda81('0x9')](),controller[_0xda81('0x14')]);router['put']('/:id',auth[_0xda81('0x9')](),controller[_0xda81('0x15')]);router[_0xda81('0x16')](_0xda81('0xa'),auth[_0xda81('0x9')](),controller[_0xda81('0x17')]);module['exports']=router; \ No newline at end of file +var _0x8291=['isAuthenticated','index','show','getSessions','/:id/answers','getAnswers','/:id/summary','30s','getSummary','post','create','/:id/clone','put','/:id','update','destroy','exports','util','express','Router','../../config/environment','./jscriptyProject.controller','get'];(function(_0x17e597,_0x2843bd){var _0x329bf4=function(_0x1d5892){while(--_0x1d5892){_0x17e597['push'](_0x17e597['shift']());}};_0x329bf4(++_0x2843bd);}(_0x8291,0x1af));var _0x1829=function(_0x192cc3,_0x5edef6){_0x192cc3=_0x192cc3-0x0;var _0x4f1774=_0x8291[_0x192cc3];return _0x4f1774;};'use strict';var multer=require('multer');var util=require(_0x1829('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x1829('0x1'));var router=express[_0x1829('0x2')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x1829('0x3'));var controller=require(_0x1829('0x4'));router[_0x1829('0x5')]('/',auth[_0x1829('0x6')](),controller[_0x1829('0x7')]);router['get']('/:id',auth[_0x1829('0x6')](),controller[_0x1829('0x8')]);router[_0x1829('0x5')]('/:id/sessions',auth[_0x1829('0x6')](),controller[_0x1829('0x9')]);router['get'](_0x1829('0xa'),auth[_0x1829('0x6')](),controller[_0x1829('0xb')]);router[_0x1829('0x5')](_0x1829('0xc'),auth['isAuthenticated'](),timeout(_0x1829('0xd')),controller[_0x1829('0xe')]);router[_0x1829('0xf')]('/',auth[_0x1829('0x6')](),controller[_0x1829('0x10')]);router[_0x1829('0xf')](_0x1829('0x11'),auth[_0x1829('0x6')](),controller['clone']);router[_0x1829('0x12')](_0x1829('0x13'),auth['isAuthenticated'](),controller[_0x1829('0x14')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0x1829('0x15')]);module[_0x1829('0x16')]=router; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.attributes.js b/server/api/jscriptyProject/jscriptyProject.attributes.js index 17a1924..0b22cf8 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 _0x2cdd=['formData','format','{\x22name\x22:\x22%s\x22,\x22description\x22:\x22%s\x22,\x22pages\x22:[]}','getDataValue','description','BOOLEAN','sequelize','exports','STRING','TEXT','isObjectLike','setDataValue'];(function(_0x1e05c1,_0x3cffa3){var _0x15f1ca=function(_0x3a9594){while(--_0x3a9594){_0x1e05c1['push'](_0x1e05c1['shift']());}};_0x15f1ca(++_0x3cffa3);}(_0x2cdd,0x186));var _0xd2cd=function(_0x500419,_0x549162){_0x500419=_0x500419-0x0;var _0x241c1a=_0x2cdd[_0x500419];return _0x241c1a;};'use strict';var Sequelize=require(_0xd2cd('0x0'));var _=require('lodash');var util=require('util');module[_0xd2cd('0x1')]={'name':{'type':Sequelize[_0xd2cd('0x2')],'unique':'name'},'description':{'type':Sequelize[_0xd2cd('0x2')]},'formData':{'type':Sequelize[_0xd2cd('0x3')]('long'),'set':function(_0x3ca902){if(_[_0xd2cd('0x4')](_0x3ca902)){this[_0xd2cd('0x5')](_0xd2cd('0x6'),JSON['stringify'](_0x3ca902));}else if(_['isString'](_0x3ca902)){this[_0xd2cd('0x5')](_0xd2cd('0x6'),_0x3ca902);}else{this[_0xd2cd('0x5')]('formData',util[_0xd2cd('0x7')](_0xd2cd('0x8'),this[_0xd2cd('0x9')]('name')||'',this[_0xd2cd('0x9')](_0xd2cd('0xa'))||''));}}},'enableUncompleteSave':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'sendUnpauseOnSubmit':{'type':Sequelize[_0xd2cd('0xb')],'defaultValue':![]}}; \ No newline at end of file +var _0x620b=['setDataValue','formData','stringify','isString','format','BOOLEAN','lodash','util','STRING','TEXT'];(function(_0x47fb14,_0x182dcb){var _0x3e7cc5=function(_0x3c1c76){while(--_0x3c1c76){_0x47fb14['push'](_0x47fb14['shift']());}};_0x3e7cc5(++_0x182dcb);}(_0x620b,0x1dc));var _0xb620=function(_0x20ccf8,_0x130b88){_0x20ccf8=_0x20ccf8-0x0;var _0x13950a=_0x620b[_0x20ccf8];return _0x13950a;};'use strict';var Sequelize=require('sequelize');var _=require(_0xb620('0x0'));var util=require(_0xb620('0x1'));module['exports']={'name':{'type':Sequelize[_0xb620('0x2')],'unique':'name'},'description':{'type':Sequelize[_0xb620('0x2')]},'formData':{'type':Sequelize[_0xb620('0x3')]('long'),'set':function(_0x37bbaa){if(_['isObjectLike'](_0x37bbaa)){this[_0xb620('0x4')](_0xb620('0x5'),JSON[_0xb620('0x6')](_0x37bbaa));}else if(_[_0xb620('0x7')](_0x37bbaa)){this[_0xb620('0x4')](_0xb620('0x5'),_0x37bbaa);}else{this['setDataValue'](_0xb620('0x5'),util[_0xb620('0x8')]('{\x22name\x22:\x22%s\x22,\x22description\x22:\x22%s\x22,\x22pages\x22:[]}',this['getDataValue']('name')||'',this['getDataValue']('description')||''));}}},'enableUncompleteSave':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'sendUnpauseOnSubmit':{'type':Sequelize[_0xb620('0x9')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.controller.js b/server/api/jscriptyProject/jscriptyProject.controller.js index 9c8698e..ba1992e 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 _0x021b=['../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../mysqldb','sendStatus','status','end','json','count','offset','limit','apply','save','update','then','destroy','get','Projects','UserProfileResource','error','stack','name','index','map','JscriptyProject','rawAttributes','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','show','keys','find','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','clone','params','omit','createdAt','updatedAt','UserProfileSection','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getSessions','JscriptySessionReport','order','ProjectId','getAnswers','findOne','JscriptyAnswerReport','pick','indexOf','toString','replace','getSummary','startTime','starttime','JscriptyQuestionReport','-createdAt','questionId','question','format','answer','push','now','writeFileSync','/tmp/Jscripty_Project_%d_Summary_%s.csv','Content-disposition','attachment;\x20filename=','Jscripty_Project_%d_Summary_%s.csv','setHeader','Content-type','text/csv','download','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service'];(function(_0x25662e,_0x4cec68){var _0x59b7bc=function(_0xafb159){while(--_0xafb159){_0x25662e['push'](_0x25662e['shift']());}};_0x59b7bc(++_0x4cec68);}(_0x021b,0x14c));var _0xb021=function(_0x514144,_0x1471ff){_0x514144=_0x514144-0x0;var _0x47b650=_0x021b[_0x514144];return _0x47b650;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xb021('0x0'));var rimraf=require(_0xb021('0x1'));var zipdir=require(_0xb021('0x2'));var jsonpatch=require(_0xb021('0x3'));var rp=require(_0xb021('0x4'));var moment=require('moment');var BPromise=require(_0xb021('0x5'));var Mustache=require(_0xb021('0x6'));var util=require(_0xb021('0x7'));var path=require(_0xb021('0x8'));var sox=require(_0xb021('0x9'));var csv=require(_0xb021('0xa'));var ejs=require(_0xb021('0xb'));var fs=require('fs');var _=require(_0xb021('0xc'));var squel=require('squel');var crypto=require(_0xb021('0xd'));var jsforce=require(_0xb021('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xb021('0xa'));var querystring=require(_0xb021('0xf'));var Papa=require(_0xb021('0x10'));var Redis=require(_0xb021('0x11'));var authService=require(_0xb021('0x12'));var qs=require(_0xb021('0x13'));var as=require(_0xb021('0x14'));var hardwareService=require(_0xb021('0x15'));var logger=require(_0xb021('0x16'))(_0xb021('0x17'));var utils=require('../../config/utils');var config=require('../../config/environment');var db=require(_0xb021('0x18'))['db'];function respondWithStatusCode(_0x5188b9,_0x39a316){_0x39a316=_0x39a316||0xcc;return function(_0x25063d){if(_0x25063d){return _0x5188b9[_0xb021('0x19')](_0x39a316);}return _0x5188b9[_0xb021('0x1a')](_0x39a316)[_0xb021('0x1b')]();};}function respondWithResult(_0x2a6e33,_0x1f6c19){_0x1f6c19=_0x1f6c19||0xc8;return function(_0x18a4c7){if(_0x18a4c7){return _0x2a6e33[_0xb021('0x1a')](_0x1f6c19)[_0xb021('0x1c')](_0x18a4c7);}};}function respondWithFilteredResult(_0xc1259,_0x1486ef){return function(_0x4448f2){if(_0x4448f2){var _0x1ef5bc=_0x4448f2[_0xb021('0x1d')],_0x38f785=_0x1486ef['offset'],_0x57824f=_0x1486ef[_0xb021('0x1e')]+_0x1486ef[_0xb021('0x1f')],_0x39a54c;if(_0x57824f>=_0x1ef5bc){_0x57824f=_0x1ef5bc;_0x39a54c=0xc8;}else{_0x39a54c=0xce;}_0xc1259[_0xb021('0x1a')](_0x39a54c);return _0xc1259['set']('Content-Range',_0x38f785+'-'+_0x57824f+'/'+_0x1ef5bc)[_0xb021('0x1c')](_0x4448f2);}return null;};}function patchUpdates(_0x184e96){return function(_0x34448f){try{jsonpatch[_0xb021('0x20')](_0x34448f,_0x184e96,!![]);}catch(_0x2b1b9a){return BPromise['reject'](_0x2b1b9a);}return _0x34448f[_0xb021('0x21')]();};}function saveUpdates(_0x3d61db,_0x2e7c5e){return function(_0xf127d4){if(_0xf127d4){return _0xf127d4[_0xb021('0x22')](_0x3d61db)[_0xb021('0x23')](function(_0x4ff8ef){return _0x4ff8ef;});}return null;};}function removeEntity(_0x3f1e05,_0x3b31ac){return function(_0x142a8c){if(_0x142a8c){return _0x142a8c[_0xb021('0x24')]()['then'](function(){var _0x18e7b9=_0x142a8c[_0xb021('0x25')]({'plain':!![]});var _0x54da5d=_0xb021('0x26');return db[_0xb021('0x27')]['destroy']({'where':{'type':_0x54da5d,'resourceId':_0x18e7b9['id']}})['then'](function(){return _0x142a8c;});})[_0xb021('0x23')](function(){_0x3f1e05[_0xb021('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x465ec5,_0x1fadf9){return function(_0x3b659a){if(!_0x3b659a){_0x465ec5['sendStatus'](0x194);}return _0x3b659a;};}function handleError(_0x4372c0,_0xacd022){_0xacd022=_0xacd022||0x1f4;return function(_0x25bf11){logger[_0xb021('0x28')](_0x25bf11[_0xb021('0x29')]);if(_0x25bf11[_0xb021('0x2a')]){delete _0x25bf11[_0xb021('0x2a')];}_0x4372c0[_0xb021('0x1a')](_0xacd022)['send'](_0x25bf11);};}exports[_0xb021('0x2b')]=function(_0x598f5c,_0x57e70f){var _0x5bdd8d={},_0x5c7384={},_0x1e82a5={'count':0x0,'rows':[]};var _0x242e51=_[_0xb021('0x2c')](db[_0xb021('0x2d')][_0xb021('0x2e')],function(_0x52874b){return{'name':_0x52874b['fieldName'],'type':_0x52874b['type'][_0xb021('0x2f')]};});_0x5c7384[_0xb021('0x30')]=_[_0xb021('0x2c')](_0x242e51,_0xb021('0x2a'));_0x5c7384['query']=_['keys'](_0x598f5c[_0xb021('0x31')]);_0x5c7384[_0xb021('0x32')]=_[_0xb021('0x33')](_0x5c7384[_0xb021('0x30')],_0x5c7384['query']);_0x5bdd8d[_0xb021('0x34')]=_[_0xb021('0x33')](_0x5c7384[_0xb021('0x30')],qs['fields'](_0x598f5c[_0xb021('0x31')][_0xb021('0x35')]));_0x5bdd8d[_0xb021('0x34')]=_0x5bdd8d[_0xb021('0x34')][_0xb021('0x36')]?_0x5bdd8d[_0xb021('0x34')]:_0x5c7384[_0xb021('0x30')];if(!_0x598f5c[_0xb021('0x31')][_0xb021('0x37')](_0xb021('0x38'))){_0x5bdd8d[_0xb021('0x1f')]=qs['limit'](_0x598f5c[_0xb021('0x31')]['limit']);_0x5bdd8d[_0xb021('0x1e')]=qs[_0xb021('0x1e')](_0x598f5c['query']['offset']);}_0x5bdd8d['order']=qs[_0xb021('0x39')](_0x598f5c[_0xb021('0x31')][_0xb021('0x39')]);_0x5bdd8d[_0xb021('0x3a')]=qs[_0xb021('0x32')](_['pick'](_0x598f5c[_0xb021('0x31')],_0x5c7384['filters']),_0x242e51);if(_0x598f5c[_0xb021('0x31')][_0xb021('0x3b')]){_0x5bdd8d[_0xb021('0x3a')]=_[_0xb021('0x3c')](_0x5bdd8d[_0xb021('0x3a')],{'$or':_['map'](_0x242e51,function(_0x340a50){if(_0x340a50[_0xb021('0x3d')]!==_0xb021('0x3e')){var _0x116b0b={};_0x116b0b[_0x340a50[_0xb021('0x2a')]]={'$like':'%'+_0x598f5c[_0xb021('0x31')][_0xb021('0x3b')]+'%'};return _0x116b0b;}})});}_0x5bdd8d=_[_0xb021('0x3c')]({},_0x5bdd8d,_0x598f5c[_0xb021('0x3f')]);var _0x168ba2={'where':_0x5bdd8d['where']};return db[_0xb021('0x2d')][_0xb021('0x1d')](_0x168ba2)[_0xb021('0x23')](function(_0x5940eb){_0x1e82a5[_0xb021('0x1d')]=_0x5940eb;if(_0x598f5c[_0xb021('0x31')][_0xb021('0x40')]){_0x5bdd8d[_0xb021('0x41')]=[{'all':!![]}];}return db[_0xb021('0x2d')][_0xb021('0x42')](_0x5bdd8d);})['then'](function(_0x59e552){_0x1e82a5[_0xb021('0x43')]=_0x59e552;return _0x1e82a5;})['then'](respondWithFilteredResult(_0x57e70f,_0x5bdd8d))['catch'](handleError(_0x57e70f,null));};exports[_0xb021('0x44')]=function(_0x147368,_0x2fc0ef){var _0x5540f5={'raw':![],'where':{'id':_0x147368['params']['id']}},_0x4d8296={};_0x4d8296['model']=_['keys'](db[_0xb021('0x2d')][_0xb021('0x2e')]);_0x4d8296[_0xb021('0x31')]=_[_0xb021('0x45')](_0x147368[_0xb021('0x31')]);_0x4d8296[_0xb021('0x32')]=_[_0xb021('0x33')](_0x4d8296[_0xb021('0x30')],_0x4d8296[_0xb021('0x31')]);_0x5540f5[_0xb021('0x34')]=_[_0xb021('0x33')](_0x4d8296[_0xb021('0x30')],qs['fields'](_0x147368[_0xb021('0x31')][_0xb021('0x35')]));_0x5540f5[_0xb021('0x34')]=_0x5540f5[_0xb021('0x34')][_0xb021('0x36')]?_0x5540f5[_0xb021('0x34')]:_0x4d8296[_0xb021('0x30')];if(_0x147368[_0xb021('0x31')]['includeAll']){_0x5540f5[_0xb021('0x41')]=[{'all':!![]}];}_0x5540f5=_[_0xb021('0x3c')]({},_0x5540f5,_0x147368[_0xb021('0x3f')]);return db['JscriptyProject'][_0xb021('0x46')](_0x5540f5)['then'](handleEntityNotFound(_0x2fc0ef,null))[_0xb021('0x23')](respondWithResult(_0x2fc0ef,null))[_0xb021('0x47')](handleError(_0x2fc0ef,null));};exports['create']=function(_0x1aae5d,_0x727f34){return db[_0xb021('0x2d')][_0xb021('0x48')](_0x1aae5d[_0xb021('0x49')],{})[_0xb021('0x23')](function(_0x33ece4){var _0x4e1828=_0x1aae5d[_0xb021('0x4a')][_0xb021('0x25')]({'plain':!![]});if(!_0x4e1828)throw new Error(_0xb021('0x4b'));if(_0x4e1828[_0xb021('0x4c')]===_0xb021('0x4a')){var _0x5bfbd6=_0x33ece4[_0xb021('0x25')]({'plain':!![]});var _0x50afef='Projects';return db['UserProfileSection'][_0xb021('0x46')]({'where':{'name':_0x50afef,'userProfileId':_0x4e1828[_0xb021('0x4d')]},'raw':!![]})[_0xb021('0x23')](function(_0x624ad){if(_0x624ad&&_0x624ad[_0xb021('0x4e')]===0x0){return db['UserProfileResource']['create']({'name':_0x5bfbd6[_0xb021('0x2a')],'resourceId':_0x5bfbd6['id'],'type':_0x624ad[_0xb021('0x2a')],'sectionId':_0x624ad['id']},{})[_0xb021('0x23')](function(){return _0x33ece4;});}else{return _0x33ece4;}})[_0xb021('0x47')](function(_0x109515){logger[_0xb021('0x28')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x109515);throw _0x109515;});}return _0x33ece4;})[_0xb021('0x23')](respondWithResult(_0x727f34,0xc9))['catch'](handleError(_0x727f34,null));};exports[_0xb021('0x4f')]=function(_0x5ca3cf,_0x50ed4f){var _0x30c4ab={'where':{'id':_0x5ca3cf[_0xb021('0x50')]['id']}},_0x525cd8={};_0x525cd8[_0xb021('0x30')]=_['keys'](db[_0xb021('0x2d')][_0xb021('0x2e')]);_0x30c4ab[_0xb021('0x34')]=_['intersection'](_0x525cd8[_0xb021('0x30')],qs[_0xb021('0x35')](_0x5ca3cf[_0xb021('0x31')][_0xb021('0x35')]));_0x30c4ab[_0xb021('0x34')]=_0x30c4ab[_0xb021('0x34')][_0xb021('0x36')]?_0x30c4ab[_0xb021('0x34')]:_0x525cd8['model'];if(_0x5ca3cf['query'][_0xb021('0x40')]){_0x30c4ab[_0xb021('0x41')]=[{'all':!![]}];}_0x30c4ab=_[_0xb021('0x3c')]({},_0x30c4ab,_0x5ca3cf['options']);return db[_0xb021('0x2d')][_0xb021('0x46')](_0x30c4ab)['then'](handleEntityNotFound(_0x50ed4f,null))[_0xb021('0x23')](function(_0x2dc697){if(_0x2dc697){var _0x4edc21=_0x2dc697[_0xb021('0x25')]({'plain':!![]});_0x4edc21=qs[_0xb021('0x51')](_0x4edc21,['id',_0xb021('0x52'),_0xb021('0x53')]);_0x5ca3cf[_0xb021('0x49')]=_[_0xb021('0x51')](_0x5ca3cf['body'],['id',_0xb021('0x52'),_0xb021('0x53')]);return db[_0xb021('0x2d')][_0xb021('0x48')](_['merge'](_0x4edc21,_0x5ca3cf[_0xb021('0x49')]),{'include':_0x5ca3cf[_0xb021('0x31')][_0xb021('0x40')]?[{'all':!![]}]:undefined})[_0xb021('0x23')](function(_0x1c06af){var _0x42dc1d=_0x5ca3cf['user']['get']({'plain':!![]});if(!_0x42dc1d)throw new Error(_0xb021('0x4b'));if(_0x42dc1d['role']===_0xb021('0x4a')){var _0x394e03=_0x1c06af[_0xb021('0x25')]({'plain':!![]});var _0x217249=_0xb021('0x26');return db[_0xb021('0x54')][_0xb021('0x46')]({'where':{'name':_0x217249,'userProfileId':_0x42dc1d[_0xb021('0x4d')]},'raw':!![]})['then'](function(_0x10a332){if(_0x10a332&&_0x10a332[_0xb021('0x4e')]===0x0){return db[_0xb021('0x27')][_0xb021('0x48')]({'name':_0x394e03[_0xb021('0x2a')],'resourceId':_0x394e03['id'],'type':_0x10a332[_0xb021('0x2a')],'sectionId':_0x10a332['id']},{})[_0xb021('0x23')](function(){return _0x1c06af;});}else{return _0x1c06af;}})[_0xb021('0x47')](function(_0xbfb2f8){logger[_0xb021('0x28')](_0xb021('0x55'),_0xbfb2f8);throw _0xbfb2f8;});}return _0x1c06af;});}})[_0xb021('0x23')](respondWithResult(_0x50ed4f,0xc9))[_0xb021('0x47')](handleError(_0x50ed4f,null));};exports[_0xb021('0x22')]=function(_0x354362,_0x5bc12b){if(_0x354362[_0xb021('0x49')]['id']){delete _0x354362['body']['id'];}return db[_0xb021('0x2d')][_0xb021('0x46')]({'where':{'id':_0x354362[_0xb021('0x50')]['id']}})[_0xb021('0x23')](handleEntityNotFound(_0x5bc12b,null))[_0xb021('0x23')](saveUpdates(_0x354362['body'],null))['then'](respondWithResult(_0x5bc12b,null))['catch'](handleError(_0x5bc12b,null));};exports['destroy']=function(_0x5d3336,_0x107a2c){return db[_0xb021('0x2d')][_0xb021('0x46')]({'where':{'id':_0x5d3336[_0xb021('0x50')]['id']}})[_0xb021('0x23')](handleEntityNotFound(_0x107a2c,null))[_0xb021('0x23')](removeEntity(_0x107a2c,null))[_0xb021('0x47')](handleError(_0x107a2c,null));};exports[_0xb021('0x56')]=function(_0x53d490,_0x177a11,_0x138714){var _0x495e1e={'raw':!![],'where':{}};var _0x3d0baf={};var _0x426bc9={'count':0x0,'rows':[]};return db['JscriptyProject']['findOne']({'where':{'id':_0x53d490[_0xb021('0x50')]['id']}})['then'](handleEntityNotFound(_0x177a11,null))[_0xb021('0x23')](function(_0x4a6c58){if(_0x4a6c58){_0x3d0baf['model']=_[_0xb021('0x45')](db[_0xb021('0x57')]['rawAttributes']);_0x3d0baf['query']=_[_0xb021('0x45')](_0x53d490['query']);_0x3d0baf[_0xb021('0x32')]=_['intersection'](_0x3d0baf[_0xb021('0x30')],_0x3d0baf[_0xb021('0x31')]);_0x495e1e[_0xb021('0x34')]=_[_0xb021('0x33')](_0x3d0baf['model'],qs[_0xb021('0x35')](_0x53d490[_0xb021('0x31')][_0xb021('0x35')]));_0x495e1e[_0xb021('0x34')]=_0x495e1e[_0xb021('0x34')][_0xb021('0x36')]?_0x495e1e[_0xb021('0x34')]:_0x3d0baf['model'];if(!_0x53d490['query'][_0xb021('0x37')](_0xb021('0x38'))){_0x495e1e[_0xb021('0x1f')]=qs[_0xb021('0x1f')](_0x53d490[_0xb021('0x31')][_0xb021('0x1f')]);_0x495e1e[_0xb021('0x1e')]=qs[_0xb021('0x1e')](_0x53d490[_0xb021('0x31')][_0xb021('0x1e')]);}_0x495e1e[_0xb021('0x58')]=qs[_0xb021('0x39')](_0x53d490[_0xb021('0x31')][_0xb021('0x39')]);_0x495e1e[_0xb021('0x3a')]=qs['filters'](_['pick'](_0x53d490[_0xb021('0x31')],_0x3d0baf[_0xb021('0x32')]));_0x495e1e[_0xb021('0x3a')][_0xb021('0x59')]=_0x4a6c58['id'];if(_0x53d490[_0xb021('0x31')][_0xb021('0x3b')]){_0x495e1e['where']=_[_0xb021('0x3c')](_0x495e1e['where'],{'$or':_[_0xb021('0x2c')](_0x495e1e[_0xb021('0x34')],function(_0x134284){var _0x6daed0={};_0x6daed0[_0x134284]={'$like':'%'+_0x53d490['query'][_0xb021('0x3b')]+'%'};return _0x6daed0;})});}_0x495e1e=_[_0xb021('0x3c')]({},_0x495e1e,_0x53d490[_0xb021('0x3f')]);return db[_0xb021('0x57')]['count']({'where':_0x495e1e[_0xb021('0x3a')]})[_0xb021('0x23')](function(_0x1bf6de){_0x426bc9[_0xb021('0x1d')]=_0x1bf6de;if(_0x53d490[_0xb021('0x31')]['includeAll']){_0x495e1e['include']=[{'all':!![]}];}return db[_0xb021('0x57')][_0xb021('0x42')](_0x495e1e);})[_0xb021('0x23')](function(_0x3dd7ca){_0x426bc9['rows']=_0x3dd7ca;return _0x426bc9;});}})[_0xb021('0x23')](respondWithFilteredResult(_0x177a11,_0x495e1e))[_0xb021('0x47')](handleError(_0x177a11,null));};exports[_0xb021('0x5a')]=function(_0x32b9bc,_0x8053a0,_0x4c8c41){var _0x13ce4c={'raw':!![],'where':{}};var _0x192a2f={};var _0x1bdaea={'count':0x0,'rows':[]};return db[_0xb021('0x2d')][_0xb021('0x5b')]({'where':{'id':_0x32b9bc['params']['id']}})[_0xb021('0x23')](handleEntityNotFound(_0x8053a0,null))[_0xb021('0x23')](function(_0x1660d8){if(_0x1660d8){_0x192a2f[_0xb021('0x30')]=_['keys'](db[_0xb021('0x5c')][_0xb021('0x2e')]);_0x192a2f[_0xb021('0x31')]=_[_0xb021('0x45')](_0x32b9bc['query']);_0x192a2f['filters']=_['intersection'](_0x192a2f['model'],_0x192a2f[_0xb021('0x31')]);_0x13ce4c[_0xb021('0x34')]=_['intersection'](_0x192a2f['model'],qs[_0xb021('0x35')](_0x32b9bc['query'][_0xb021('0x35')]));_0x13ce4c[_0xb021('0x34')]=_0x13ce4c[_0xb021('0x34')][_0xb021('0x36')]?_0x13ce4c[_0xb021('0x34')]:_0x192a2f[_0xb021('0x30')];if(!_0x32b9bc[_0xb021('0x31')][_0xb021('0x37')](_0xb021('0x38'))){_0x13ce4c['limit']=qs[_0xb021('0x1f')](_0x32b9bc[_0xb021('0x31')][_0xb021('0x1f')]);_0x13ce4c[_0xb021('0x1e')]=qs[_0xb021('0x1e')](_0x32b9bc[_0xb021('0x31')][_0xb021('0x1e')]);}_0x13ce4c[_0xb021('0x58')]=qs[_0xb021('0x39')](_0x32b9bc[_0xb021('0x31')][_0xb021('0x39')]);_0x13ce4c['where']=qs['filters'](_[_0xb021('0x5d')](_0x32b9bc[_0xb021('0x31')],_0x192a2f[_0xb021('0x32')]));_0x13ce4c[_0xb021('0x3a')]['ProjectId']=_0x1660d8['id'];if(_0x32b9bc[_0xb021('0x31')][_0xb021('0x3b')]){_0x13ce4c[_0xb021('0x3a')]=_[_0xb021('0x3c')](_0x13ce4c[_0xb021('0x3a')],{'$or':_[_0xb021('0x2c')](_0x13ce4c[_0xb021('0x34')],function(_0x5cca65){var _0x2493a3={};_0x2493a3[_0x5cca65]={'$like':'%'+_0x32b9bc[_0xb021('0x31')][_0xb021('0x3b')]+'%'};return _0x2493a3;})});}_0x13ce4c=_[_0xb021('0x3c')]({},_0x13ce4c,_0x32b9bc[_0xb021('0x3f')]);return db[_0xb021('0x5c')][_0xb021('0x1d')]({'where':_0x13ce4c['where']})[_0xb021('0x23')](function(_0x415969){_0x1bdaea[_0xb021('0x1d')]=_0x415969;if(_0x32b9bc[_0xb021('0x31')][_0xb021('0x40')]){_0x13ce4c['include']=[{'all':!![]}];}return db[_0xb021('0x5c')][_0xb021('0x42')](_0x13ce4c);})[_0xb021('0x23')](function(_0x5c8037){_0x1bdaea['rows']=_0x5c8037;return _0x1bdaea;});}})[_0xb021('0x23')](respondWithFilteredResult(_0x8053a0,_0x13ce4c))[_0xb021('0x47')](handleError(_0x8053a0,null));};function char(_0x57b3e2){return'number'===typeof _0x57b3e2?String['fromCharCode'][_0xb021('0x20')](null,arguments):_0x57b3e2;}function needsEncapsulation(_0x1f874f){return!!_0x1f874f&&(_0x1f874f['toString']()[_0xb021('0x5e')](char(0xd))>=0x0||_0x1f874f[_0xb021('0x5f')]()[_0xb021('0x5e')](char(0xa))>=0x0||_0x1f874f[_0xb021('0x5f')]()[_0xb021('0x5e')](char(0x2c))>=0x0||_0x1f874f['toString']()[_0xb021('0x5e')](char(0x22))>=0x0);}function encapsulate(_0xc05d9c){var _0x1835fc=char(0x22),_0x1612e1='\x5c'+char(0x22),_0x507656=_0xc05d9c[_0xb021('0x5f')]()[_0xb021('0x60')](new RegExp(_0x1835fc,'g'),_0x1612e1);return _0x1835fc+_0x507656+_0x1835fc;}exports[_0xb021('0x61')]=function(_0x11ac71,_0x5f572e,_0x5e4468){var _0x4463b4,_0x4efb48;var _0x259a13={'where':{'ProjectId':_0x11ac71[_0xb021('0x50')]['id']}};if(_0x11ac71[_0xb021('0x31')][_0xb021('0x62')]){_0x259a13[_0xb021('0x3a')][_0xb021('0x63')]=JSON['parse'](_0x11ac71[_0xb021('0x31')][_0xb021('0x62')]);}return db[_0xb021('0x57')][_0xb021('0x42')](_0x259a13)['then'](handleEntityNotFound(_0x5f572e,null))[_0xb021('0x23')](function(_0x3f3927){if(_0x3f3927){_0x4463b4=_0x3f3927;return db[_0xb021('0x64')]['findAll']({'where':{'SessionId':{'$in':_[_0xb021('0x2c')](_0x4463b4,'id')},'ProjectId':_0x11ac71['params']['id']},'order':_0xb021('0x65')});}})[_0xb021('0x23')](handleEntityNotFound(_0x5f572e,null))[_0xb021('0x23')](function(_0x3440bc){if(_0x3440bc){_0x4efb48=_0x3440bc;var _0x948485={};for(var _0x9fd524=0x0,_0x1f8190=_0x4efb48[_0xb021('0x36')];_0x9fd524<_0x1f8190;_0x9fd524++){if(!_0x948485[_0xb021('0x37')](_0x4efb48[_0x9fd524]['questionId'])){_0x948485[_0x4efb48[_0x9fd524][_0xb021('0x66')]]=needsEncapsulation(_0x4efb48[_0x9fd524]['question'])?encapsulate(_0x4efb48[_0x9fd524][_0xb021('0x67')]):_0x4efb48[_0x9fd524][_0xb021('0x67')];}}var _0x4b51a8=[],_0x509c87={};for(var _0x1011f8=0x0,_0x46a1e1=_0x4463b4[_0xb021('0x36')];_0x1011f8<_0x46a1e1;_0x1011f8++){_0x509c87={'ProjectId':_0x11ac71[_0xb021('0x50')]['id'],'SessionId':_0x4463b4[_0x1011f8]['id'],'StartTime':moment(_0x4463b4[_0x1011f8][_0xb021('0x63')])[_0xb021('0x68')]('YYYY-MM-DD\x20HH:mm:ss')};for(var _0x243cec=0x0,_0x15564d=_0x4efb48[_0xb021('0x36')];_0x243cec<_0x15564d;_0x243cec++){if(_0x4efb48[_0x243cec]['SessionId']==_0x4463b4[_0x1011f8]['id']&&_0x948485[_0xb021('0x37')](_0x4efb48[_0x243cec][_0xb021('0x66')])){_0x509c87[_0x948485[_0x4efb48[_0x243cec]['questionId']]]=_0x4efb48[_0x243cec][_0xb021('0x69')];}}for(var _0x13cb51 in _0x948485){if(!_0x509c87[_0xb021('0x37')](_0x948485[_0x13cb51])){_0x509c87[_0x948485[_0x13cb51]]=null;}}_0x4b51a8[_0xb021('0x6a')](_0x509c87);}return _0x4b51a8;}})[_0xb021('0x23')](function(_0x7daa10){if(!_['isEmpty'](_0x7daa10)){var _0x8a8423=toCsv(_0x7daa10);var _0x18cb75=Date[_0xb021('0x6b')]();fs[_0xb021('0x6c')](util[_0xb021('0x68')](_0xb021('0x6d'),_0x11ac71[_0xb021('0x50')]['id'],_0x18cb75),_0x8a8423);_0x5f572e['setHeader'](_0xb021('0x6e'),_0xb021('0x6f')+util['format'](_0xb021('0x70'),_0x11ac71['params']['id'],_0x18cb75));_0x5f572e[_0xb021('0x71')](_0xb021('0x72'),_0xb021('0x73'));return _0x5f572e[_0xb021('0x74')](util[_0xb021('0x68')](_0xb021('0x6d'),_0x11ac71['params']['id'],_0x18cb75));}else{return _0x5f572e[_0xb021('0x19')](0xcc);}})[_0xb021('0x47')](handleError(_0x5f572e,null));}; \ No newline at end of file +var _0x367b=['attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','VIRTUAL','merge','options','findAll','catch','params','rawAttributes','includeAll','include','find','create','body','role','user','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','omit','createdAt','updatedAt','Unable\x20to\x20retrieve\x20the\x20current\x20user','Projects','UserProfileSection','getSessions','findOne','JscriptySessionReport','nolimit','ProjectId','rows','getAnswers','JscriptyAnswerReport','fromCharCode','toString','indexOf','replace','getSummary','startTime','parse','JscriptyQuestionReport','-createdAt','questionId','question','starttime','YYYY-MM-DD\x20HH:mm:ss','SessionId','answer','push','isEmpty','now','writeFileSync','format','/tmp/Jscripty_Project_%d_Summary_%s.csv','setHeader','Jscripty_Project_%d_Summary_%s.csv','Content-type','text/csv','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','ejs','lodash','squel','jsforce','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','update','then','destroy','get','UserProfileResource','stack','name','send','index','map','JscriptyProject','fieldName','type','key','model','query','keys','filters','intersection'];(function(_0x2c347c,_0x51fb3c){var _0x2248ee=function(_0x1c1122){while(--_0x1c1122){_0x2c347c['push'](_0x2c347c['shift']());}};_0x2248ee(++_0x51fb3c);}(_0x367b,0x1b0));var _0xb367=function(_0x3d0ce2,_0x104494){_0x3d0ce2=_0x3d0ce2-0x0;var _0x5ede07=_0x367b[_0x3d0ce2];return _0x5ede07;};'use strict';var pdf=require(_0xb367('0x0'));var emlformat=require(_0xb367('0x1'));var rimraf=require(_0xb367('0x2'));var zipdir=require(_0xb367('0x3'));var jsonpatch=require(_0xb367('0x4'));var rp=require(_0xb367('0x5'));var moment=require(_0xb367('0x6'));var BPromise=require(_0xb367('0x7'));var Mustache=require(_0xb367('0x8'));var util=require('util');var path=require(_0xb367('0x9'));var sox=require(_0xb367('0xa'));var csv=require('to-csv');var ejs=require(_0xb367('0xb'));var fs=require('fs');var _=require(_0xb367('0xc'));var squel=require(_0xb367('0xd'));var crypto=require('crypto');var jsforce=require(_0xb367('0xe'));var deskjs=require(_0xb367('0xf'));var toCsv=require(_0xb367('0x10'));var querystring=require(_0xb367('0x11'));var Papa=require(_0xb367('0x12'));var Redis=require('ioredis');var authService=require(_0xb367('0x13'));var qs=require(_0xb367('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xb367('0x15'))(_0xb367('0x16'));var utils=require(_0xb367('0x17'));var config=require(_0xb367('0x18'));var db=require(_0xb367('0x19'))['db'];function respondWithStatusCode(_0x3e7c83,_0x4042c0){_0x4042c0=_0x4042c0||0xcc;return function(_0x24dde4){if(_0x24dde4){return _0x3e7c83[_0xb367('0x1a')](_0x4042c0);}return _0x3e7c83[_0xb367('0x1b')](_0x4042c0)[_0xb367('0x1c')]();};}function respondWithResult(_0x3b7a5b,_0x12f2ee){_0x12f2ee=_0x12f2ee||0xc8;return function(_0x43bc7f){if(_0x43bc7f){return _0x3b7a5b[_0xb367('0x1b')](_0x12f2ee)[_0xb367('0x1d')](_0x43bc7f);}};}function respondWithFilteredResult(_0x3c0f3c,_0x390e1b){return function(_0xc13f48){if(_0xc13f48){var _0x5c8a18=_0xc13f48[_0xb367('0x1e')],_0x14652e=_0x390e1b[_0xb367('0x1f')],_0x2e0475=_0x390e1b[_0xb367('0x1f')]+_0x390e1b[_0xb367('0x20')],_0x5607b3;if(_0x2e0475>=_0x5c8a18){_0x2e0475=_0x5c8a18;_0x5607b3=0xc8;}else{_0x5607b3=0xce;}_0x3c0f3c[_0xb367('0x1b')](_0x5607b3);return _0x3c0f3c[_0xb367('0x21')](_0xb367('0x22'),_0x14652e+'-'+_0x2e0475+'/'+_0x5c8a18)[_0xb367('0x1d')](_0xc13f48);}return null;};}function patchUpdates(_0x2ce56c){return function(_0x147173){try{jsonpatch[_0xb367('0x23')](_0x147173,_0x2ce56c,!![]);}catch(_0x5643c7){return BPromise[_0xb367('0x24')](_0x5643c7);}return _0x147173['save']();};}function saveUpdates(_0x54851e,_0x10cc6c){return function(_0x58dcc4){if(_0x58dcc4){return _0x58dcc4[_0xb367('0x25')](_0x54851e)[_0xb367('0x26')](function(_0x106817){return _0x106817;});}return null;};}function removeEntity(_0x365bec,_0x15341f){return function(_0x50a926){if(_0x50a926){return _0x50a926[_0xb367('0x27')]()['then'](function(){var _0x479c6b=_0x50a926[_0xb367('0x28')]({'plain':!![]});var _0x480a63='Projects';return db[_0xb367('0x29')][_0xb367('0x27')]({'where':{'type':_0x480a63,'resourceId':_0x479c6b['id']}})[_0xb367('0x26')](function(){return _0x50a926;});})[_0xb367('0x26')](function(){_0x365bec['status'](0xcc)[_0xb367('0x1c')]();});}};}function handleEntityNotFound(_0x162d11,_0x491053){return function(_0xb27796){if(!_0xb27796){_0x162d11[_0xb367('0x1a')](0x194);}return _0xb27796;};}function handleError(_0x5dbe68,_0x848bc6){_0x848bc6=_0x848bc6||0x1f4;return function(_0x8e7f09){logger['error'](_0x8e7f09[_0xb367('0x2a')]);if(_0x8e7f09[_0xb367('0x2b')]){delete _0x8e7f09[_0xb367('0x2b')];}_0x5dbe68[_0xb367('0x1b')](_0x848bc6)[_0xb367('0x2c')](_0x8e7f09);};}exports[_0xb367('0x2d')]=function(_0x37cd5d,_0x3cf8bd){var _0x41840a={},_0x3d6dd2={},_0x199407={'count':0x0,'rows':[]};var _0x2ab8b0=_[_0xb367('0x2e')](db[_0xb367('0x2f')]['rawAttributes'],function(_0x5eab02){return{'name':_0x5eab02[_0xb367('0x30')],'type':_0x5eab02[_0xb367('0x31')][_0xb367('0x32')]};});_0x3d6dd2[_0xb367('0x33')]=_[_0xb367('0x2e')](_0x2ab8b0,'name');_0x3d6dd2[_0xb367('0x34')]=_[_0xb367('0x35')](_0x37cd5d[_0xb367('0x34')]);_0x3d6dd2[_0xb367('0x36')]=_[_0xb367('0x37')](_0x3d6dd2[_0xb367('0x33')],_0x3d6dd2[_0xb367('0x34')]);_0x41840a[_0xb367('0x38')]=_[_0xb367('0x37')](_0x3d6dd2[_0xb367('0x33')],qs['fields'](_0x37cd5d['query'][_0xb367('0x39')]));_0x41840a[_0xb367('0x38')]=_0x41840a[_0xb367('0x38')][_0xb367('0x3a')]?_0x41840a[_0xb367('0x38')]:_0x3d6dd2[_0xb367('0x33')];if(!_0x37cd5d['query'][_0xb367('0x3b')]('nolimit')){_0x41840a[_0xb367('0x20')]=qs[_0xb367('0x20')](_0x37cd5d['query'][_0xb367('0x20')]);_0x41840a['offset']=qs[_0xb367('0x1f')](_0x37cd5d[_0xb367('0x34')][_0xb367('0x1f')]);}_0x41840a[_0xb367('0x3c')]=qs[_0xb367('0x3d')](_0x37cd5d['query'][_0xb367('0x3d')]);_0x41840a[_0xb367('0x3e')]=qs[_0xb367('0x36')](_[_0xb367('0x3f')](_0x37cd5d[_0xb367('0x34')],_0x3d6dd2[_0xb367('0x36')]),_0x2ab8b0);if(_0x37cd5d['query'][_0xb367('0x40')]){_0x41840a[_0xb367('0x3e')]=_['merge'](_0x41840a['where'],{'$or':_[_0xb367('0x2e')](_0x2ab8b0,function(_0xe21236){if(_0xe21236[_0xb367('0x31')]!==_0xb367('0x41')){var _0x57e750={};_0x57e750[_0xe21236[_0xb367('0x2b')]]={'$like':'%'+_0x37cd5d['query'][_0xb367('0x40')]+'%'};return _0x57e750;}})});}_0x41840a=_[_0xb367('0x42')]({},_0x41840a,_0x37cd5d[_0xb367('0x43')]);var _0x3f64d5={'where':_0x41840a[_0xb367('0x3e')]};return db[_0xb367('0x2f')][_0xb367('0x1e')](_0x3f64d5)[_0xb367('0x26')](function(_0x508da7){_0x199407['count']=_0x508da7;if(_0x37cd5d[_0xb367('0x34')]['includeAll']){_0x41840a['include']=[{'all':!![]}];}return db[_0xb367('0x2f')][_0xb367('0x44')](_0x41840a);})[_0xb367('0x26')](function(_0x213e32){_0x199407['rows']=_0x213e32;return _0x199407;})['then'](respondWithFilteredResult(_0x3cf8bd,_0x41840a))[_0xb367('0x45')](handleError(_0x3cf8bd,null));};exports['show']=function(_0x4fb92b,_0x2d3559){var _0x143965={'raw':![],'where':{'id':_0x4fb92b[_0xb367('0x46')]['id']}},_0x13337a={};_0x13337a[_0xb367('0x33')]=_[_0xb367('0x35')](db[_0xb367('0x2f')][_0xb367('0x47')]);_0x13337a[_0xb367('0x34')]=_[_0xb367('0x35')](_0x4fb92b[_0xb367('0x34')]);_0x13337a[_0xb367('0x36')]=_[_0xb367('0x37')](_0x13337a['model'],_0x13337a[_0xb367('0x34')]);_0x143965[_0xb367('0x38')]=_[_0xb367('0x37')](_0x13337a[_0xb367('0x33')],qs['fields'](_0x4fb92b[_0xb367('0x34')]['fields']));_0x143965['attributes']=_0x143965[_0xb367('0x38')]['length']?_0x143965[_0xb367('0x38')]:_0x13337a[_0xb367('0x33')];if(_0x4fb92b[_0xb367('0x34')][_0xb367('0x48')]){_0x143965[_0xb367('0x49')]=[{'all':!![]}];}_0x143965=_[_0xb367('0x42')]({},_0x143965,_0x4fb92b[_0xb367('0x43')]);return db[_0xb367('0x2f')][_0xb367('0x4a')](_0x143965)[_0xb367('0x26')](handleEntityNotFound(_0x2d3559,null))['then'](respondWithResult(_0x2d3559,null))['catch'](handleError(_0x2d3559,null));};exports[_0xb367('0x4b')]=function(_0x28fbfe,_0x3ac7bb){return db['JscriptyProject'][_0xb367('0x4b')](_0x28fbfe[_0xb367('0x4c')],{})[_0xb367('0x26')](function(_0x554c25){var _0x292525=_0x28fbfe['user'][_0xb367('0x28')]({'plain':!![]});if(!_0x292525)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x292525[_0xb367('0x4d')]===_0xb367('0x4e')){var _0x94f197=_0x554c25[_0xb367('0x28')]({'plain':!![]});var _0x11ec12='Projects';return db['UserProfileSection'][_0xb367('0x4a')]({'where':{'name':_0x11ec12,'userProfileId':_0x292525[_0xb367('0x4f')]},'raw':!![]})[_0xb367('0x26')](function(_0x3a78e5){if(_0x3a78e5&&_0x3a78e5[_0xb367('0x50')]===0x0){return db[_0xb367('0x29')][_0xb367('0x4b')]({'name':_0x94f197[_0xb367('0x2b')],'resourceId':_0x94f197['id'],'type':_0x3a78e5['name'],'sectionId':_0x3a78e5['id']},{})[_0xb367('0x26')](function(){return _0x554c25;});}else{return _0x554c25;}})[_0xb367('0x45')](function(_0x2388f6){logger[_0xb367('0x51')](_0xb367('0x52'),_0x2388f6);throw _0x2388f6;});}return _0x554c25;})[_0xb367('0x26')](respondWithResult(_0x3ac7bb,0xc9))[_0xb367('0x45')](handleError(_0x3ac7bb,null));};exports['clone']=function(_0x3df1ab,_0x49e029){var _0x180892={'where':{'id':_0x3df1ab[_0xb367('0x46')]['id']}},_0x5ef5e9={};_0x5ef5e9[_0xb367('0x33')]=_[_0xb367('0x35')](db['JscriptyProject'][_0xb367('0x47')]);_0x180892['attributes']=_[_0xb367('0x37')](_0x5ef5e9[_0xb367('0x33')],qs['fields'](_0x3df1ab['query'][_0xb367('0x39')]));_0x180892[_0xb367('0x38')]=_0x180892[_0xb367('0x38')]['length']?_0x180892['attributes']:_0x5ef5e9[_0xb367('0x33')];if(_0x3df1ab['query'][_0xb367('0x48')]){_0x180892[_0xb367('0x49')]=[{'all':!![]}];}_0x180892=_[_0xb367('0x42')]({},_0x180892,_0x3df1ab[_0xb367('0x43')]);return db[_0xb367('0x2f')]['find'](_0x180892)[_0xb367('0x26')](handleEntityNotFound(_0x49e029,null))[_0xb367('0x26')](function(_0x3db08d){if(_0x3db08d){var _0x446bba=_0x3db08d['get']({'plain':!![]});_0x446bba=qs[_0xb367('0x53')](_0x446bba,['id',_0xb367('0x54'),_0xb367('0x55')]);_0x3df1ab[_0xb367('0x4c')]=_[_0xb367('0x53')](_0x3df1ab[_0xb367('0x4c')],['id',_0xb367('0x54'),_0xb367('0x55')]);return db[_0xb367('0x2f')][_0xb367('0x4b')](_[_0xb367('0x42')](_0x446bba,_0x3df1ab[_0xb367('0x4c')]),{'include':_0x3df1ab[_0xb367('0x34')][_0xb367('0x48')]?[{'all':!![]}]:undefined})[_0xb367('0x26')](function(_0x30616a){var _0x255ca0=_0x3df1ab[_0xb367('0x4e')]['get']({'plain':!![]});if(!_0x255ca0)throw new Error(_0xb367('0x56'));if(_0x255ca0[_0xb367('0x4d')]==='user'){var _0x17f3af=_0x30616a[_0xb367('0x28')]({'plain':!![]});var _0xcf6f81=_0xb367('0x57');return db[_0xb367('0x58')]['find']({'where':{'name':_0xcf6f81,'userProfileId':_0x255ca0[_0xb367('0x4f')]},'raw':!![]})['then'](function(_0x27eade){if(_0x27eade&&_0x27eade[_0xb367('0x50')]===0x0){return db['UserProfileResource']['create']({'name':_0x17f3af[_0xb367('0x2b')],'resourceId':_0x17f3af['id'],'type':_0x27eade[_0xb367('0x2b')],'sectionId':_0x27eade['id']},{})['then'](function(){return _0x30616a;});}else{return _0x30616a;}})['catch'](function(_0x5b0744){logger[_0xb367('0x51')](_0xb367('0x52'),_0x5b0744);throw _0x5b0744;});}return _0x30616a;});}})[_0xb367('0x26')](respondWithResult(_0x49e029,0xc9))[_0xb367('0x45')](handleError(_0x49e029,null));};exports[_0xb367('0x25')]=function(_0x5c1523,_0x1fb446){if(_0x5c1523[_0xb367('0x4c')]['id']){delete _0x5c1523[_0xb367('0x4c')]['id'];}return db[_0xb367('0x2f')][_0xb367('0x4a')]({'where':{'id':_0x5c1523[_0xb367('0x46')]['id']}})['then'](handleEntityNotFound(_0x1fb446,null))[_0xb367('0x26')](saveUpdates(_0x5c1523[_0xb367('0x4c')],null))[_0xb367('0x26')](respondWithResult(_0x1fb446,null))[_0xb367('0x45')](handleError(_0x1fb446,null));};exports[_0xb367('0x27')]=function(_0x2529f2,_0x25a2de){return db[_0xb367('0x2f')][_0xb367('0x4a')]({'where':{'id':_0x2529f2['params']['id']}})[_0xb367('0x26')](handleEntityNotFound(_0x25a2de,null))[_0xb367('0x26')](removeEntity(_0x25a2de,null))[_0xb367('0x45')](handleError(_0x25a2de,null));};exports[_0xb367('0x59')]=function(_0x5a442d,_0x2c2337,_0x208ffa){var _0x4facc9={'raw':!![],'where':{}};var _0x157983={};var _0x159ad9={'count':0x0,'rows':[]};return db['JscriptyProject'][_0xb367('0x5a')]({'where':{'id':_0x5a442d[_0xb367('0x46')]['id']}})[_0xb367('0x26')](handleEntityNotFound(_0x2c2337,null))['then'](function(_0x524b9c){if(_0x524b9c){_0x157983['model']=_['keys'](db[_0xb367('0x5b')][_0xb367('0x47')]);_0x157983[_0xb367('0x34')]=_['keys'](_0x5a442d[_0xb367('0x34')]);_0x157983[_0xb367('0x36')]=_['intersection'](_0x157983['model'],_0x157983[_0xb367('0x34')]);_0x4facc9[_0xb367('0x38')]=_[_0xb367('0x37')](_0x157983[_0xb367('0x33')],qs[_0xb367('0x39')](_0x5a442d['query'][_0xb367('0x39')]));_0x4facc9[_0xb367('0x38')]=_0x4facc9[_0xb367('0x38')][_0xb367('0x3a')]?_0x4facc9[_0xb367('0x38')]:_0x157983['model'];if(!_0x5a442d[_0xb367('0x34')][_0xb367('0x3b')](_0xb367('0x5c'))){_0x4facc9[_0xb367('0x20')]=qs[_0xb367('0x20')](_0x5a442d[_0xb367('0x34')]['limit']);_0x4facc9['offset']=qs[_0xb367('0x1f')](_0x5a442d[_0xb367('0x34')][_0xb367('0x1f')]);}_0x4facc9[_0xb367('0x3c')]=qs[_0xb367('0x3d')](_0x5a442d['query'][_0xb367('0x3d')]);_0x4facc9[_0xb367('0x3e')]=qs[_0xb367('0x36')](_[_0xb367('0x3f')](_0x5a442d['query'],_0x157983['filters']));_0x4facc9[_0xb367('0x3e')][_0xb367('0x5d')]=_0x524b9c['id'];if(_0x5a442d[_0xb367('0x34')]['filter']){_0x4facc9[_0xb367('0x3e')]=_[_0xb367('0x42')](_0x4facc9[_0xb367('0x3e')],{'$or':_[_0xb367('0x2e')](_0x4facc9['attributes'],function(_0x1edc42){var _0x575fa2={};_0x575fa2[_0x1edc42]={'$like':'%'+_0x5a442d['query']['filter']+'%'};return _0x575fa2;})});}_0x4facc9=_['merge']({},_0x4facc9,_0x5a442d[_0xb367('0x43')]);return db['JscriptySessionReport']['count']({'where':_0x4facc9[_0xb367('0x3e')]})[_0xb367('0x26')](function(_0x47aa66){_0x159ad9[_0xb367('0x1e')]=_0x47aa66;if(_0x5a442d['query'][_0xb367('0x48')]){_0x4facc9[_0xb367('0x49')]=[{'all':!![]}];}return db[_0xb367('0x5b')][_0xb367('0x44')](_0x4facc9);})[_0xb367('0x26')](function(_0x530a32){_0x159ad9[_0xb367('0x5e')]=_0x530a32;return _0x159ad9;});}})[_0xb367('0x26')](respondWithFilteredResult(_0x2c2337,_0x4facc9))[_0xb367('0x45')](handleError(_0x2c2337,null));};exports[_0xb367('0x5f')]=function(_0x5a0d0b,_0x2f4abc,_0x34e733){var _0x57cdc9={'raw':!![],'where':{}};var _0x4b2fea={};var _0x3912e2={'count':0x0,'rows':[]};return db[_0xb367('0x2f')][_0xb367('0x5a')]({'where':{'id':_0x5a0d0b[_0xb367('0x46')]['id']}})[_0xb367('0x26')](handleEntityNotFound(_0x2f4abc,null))[_0xb367('0x26')](function(_0x5e0e49){if(_0x5e0e49){_0x4b2fea[_0xb367('0x33')]=_[_0xb367('0x35')](db['JscriptyAnswerReport']['rawAttributes']);_0x4b2fea[_0xb367('0x34')]=_[_0xb367('0x35')](_0x5a0d0b[_0xb367('0x34')]);_0x4b2fea[_0xb367('0x36')]=_[_0xb367('0x37')](_0x4b2fea[_0xb367('0x33')],_0x4b2fea[_0xb367('0x34')]);_0x57cdc9[_0xb367('0x38')]=_[_0xb367('0x37')](_0x4b2fea['model'],qs[_0xb367('0x39')](_0x5a0d0b[_0xb367('0x34')]['fields']));_0x57cdc9[_0xb367('0x38')]=_0x57cdc9[_0xb367('0x38')][_0xb367('0x3a')]?_0x57cdc9[_0xb367('0x38')]:_0x4b2fea[_0xb367('0x33')];if(!_0x5a0d0b[_0xb367('0x34')]['hasOwnProperty'](_0xb367('0x5c'))){_0x57cdc9[_0xb367('0x20')]=qs['limit'](_0x5a0d0b[_0xb367('0x34')]['limit']);_0x57cdc9[_0xb367('0x1f')]=qs[_0xb367('0x1f')](_0x5a0d0b[_0xb367('0x34')]['offset']);}_0x57cdc9[_0xb367('0x3c')]=qs['sort'](_0x5a0d0b[_0xb367('0x34')][_0xb367('0x3d')]);_0x57cdc9[_0xb367('0x3e')]=qs[_0xb367('0x36')](_['pick'](_0x5a0d0b[_0xb367('0x34')],_0x4b2fea[_0xb367('0x36')]));_0x57cdc9[_0xb367('0x3e')][_0xb367('0x5d')]=_0x5e0e49['id'];if(_0x5a0d0b[_0xb367('0x34')][_0xb367('0x40')]){_0x57cdc9[_0xb367('0x3e')]=_[_0xb367('0x42')](_0x57cdc9[_0xb367('0x3e')],{'$or':_[_0xb367('0x2e')](_0x57cdc9['attributes'],function(_0x201030){var _0x534b12={};_0x534b12[_0x201030]={'$like':'%'+_0x5a0d0b[_0xb367('0x34')][_0xb367('0x40')]+'%'};return _0x534b12;})});}_0x57cdc9=_[_0xb367('0x42')]({},_0x57cdc9,_0x5a0d0b['options']);return db[_0xb367('0x60')][_0xb367('0x1e')]({'where':_0x57cdc9[_0xb367('0x3e')]})[_0xb367('0x26')](function(_0x28a3ab){_0x3912e2[_0xb367('0x1e')]=_0x28a3ab;if(_0x5a0d0b[_0xb367('0x34')][_0xb367('0x48')]){_0x57cdc9['include']=[{'all':!![]}];}return db[_0xb367('0x60')]['findAll'](_0x57cdc9);})['then'](function(_0x4b5a0e){_0x3912e2[_0xb367('0x5e')]=_0x4b5a0e;return _0x3912e2;});}})[_0xb367('0x26')](respondWithFilteredResult(_0x2f4abc,_0x57cdc9))['catch'](handleError(_0x2f4abc,null));};function char(_0x3a6fad){return'number'===typeof _0x3a6fad?String[_0xb367('0x61')]['apply'](null,arguments):_0x3a6fad;}function needsEncapsulation(_0x319cda){return!!_0x319cda&&(_0x319cda[_0xb367('0x62')]()[_0xb367('0x63')](char(0xd))>=0x0||_0x319cda[_0xb367('0x62')]()[_0xb367('0x63')](char(0xa))>=0x0||_0x319cda[_0xb367('0x62')]()[_0xb367('0x63')](char(0x2c))>=0x0||_0x319cda[_0xb367('0x62')]()[_0xb367('0x63')](char(0x22))>=0x0);}function encapsulate(_0x56f34a){var _0x3e4b06=char(0x22),_0xdfcd70='\x5c'+char(0x22),_0x299cde=_0x56f34a[_0xb367('0x62')]()[_0xb367('0x64')](new RegExp(_0x3e4b06,'g'),_0xdfcd70);return _0x3e4b06+_0x299cde+_0x3e4b06;}exports[_0xb367('0x65')]=function(_0x225947,_0x5b8744,_0xe642ea){var _0x259eb8,_0x2a4671;var _0x5ba328={'where':{'ProjectId':_0x225947[_0xb367('0x46')]['id']}};if(_0x225947['query'][_0xb367('0x66')]){_0x5ba328[_0xb367('0x3e')]['starttime']=JSON[_0xb367('0x67')](_0x225947['query'][_0xb367('0x66')]);}return db[_0xb367('0x5b')][_0xb367('0x44')](_0x5ba328)[_0xb367('0x26')](handleEntityNotFound(_0x5b8744,null))[_0xb367('0x26')](function(_0x1a351e){if(_0x1a351e){_0x259eb8=_0x1a351e;return db[_0xb367('0x68')][_0xb367('0x44')]({'where':{'SessionId':{'$in':_[_0xb367('0x2e')](_0x259eb8,'id')},'ProjectId':_0x225947[_0xb367('0x46')]['id']},'order':_0xb367('0x69')});}})[_0xb367('0x26')](handleEntityNotFound(_0x5b8744,null))['then'](function(_0x236562){if(_0x236562){_0x2a4671=_0x236562;var _0x229f97={};for(var _0x28f859=0x0,_0x336a57=_0x2a4671['length'];_0x28f859<_0x336a57;_0x28f859++){if(!_0x229f97[_0xb367('0x3b')](_0x2a4671[_0x28f859]['questionId'])){_0x229f97[_0x2a4671[_0x28f859][_0xb367('0x6a')]]=needsEncapsulation(_0x2a4671[_0x28f859][_0xb367('0x6b')])?encapsulate(_0x2a4671[_0x28f859]['question']):_0x2a4671[_0x28f859][_0xb367('0x6b')];}}var _0x658f4a=[],_0x4b6e45={};for(var _0x5cfb43=0x0,_0x13bc09=_0x259eb8['length'];_0x5cfb43<_0x13bc09;_0x5cfb43++){_0x4b6e45={'ProjectId':_0x225947[_0xb367('0x46')]['id'],'SessionId':_0x259eb8[_0x5cfb43]['id'],'StartTime':moment(_0x259eb8[_0x5cfb43][_0xb367('0x6c')])['format'](_0xb367('0x6d'))};for(var _0x2a41df=0x0,_0x6ade34=_0x2a4671[_0xb367('0x3a')];_0x2a41df<_0x6ade34;_0x2a41df++){if(_0x2a4671[_0x2a41df][_0xb367('0x6e')]==_0x259eb8[_0x5cfb43]['id']&&_0x229f97[_0xb367('0x3b')](_0x2a4671[_0x2a41df][_0xb367('0x6a')])){_0x4b6e45[_0x229f97[_0x2a4671[_0x2a41df]['questionId']]]=_0x2a4671[_0x2a41df][_0xb367('0x6f')];}}for(var _0x45e9a2 in _0x229f97){if(!_0x4b6e45[_0xb367('0x3b')](_0x229f97[_0x45e9a2])){_0x4b6e45[_0x229f97[_0x45e9a2]]=null;}}_0x658f4a[_0xb367('0x70')](_0x4b6e45);}return _0x658f4a;}})[_0xb367('0x26')](function(_0x3ad1f2){if(!_[_0xb367('0x71')](_0x3ad1f2)){var _0x400f56=toCsv(_0x3ad1f2);var _0x3269ae=Date[_0xb367('0x72')]();fs[_0xb367('0x73')](util[_0xb367('0x74')](_0xb367('0x75'),_0x225947[_0xb367('0x46')]['id'],_0x3269ae),_0x400f56);_0x5b8744[_0xb367('0x76')]('Content-disposition','attachment;\x20filename='+util[_0xb367('0x74')](_0xb367('0x77'),_0x225947[_0xb367('0x46')]['id'],_0x3269ae));_0x5b8744[_0xb367('0x76')](_0xb367('0x78'),_0xb367('0x79'));return _0x5b8744['download'](util[_0xb367('0x74')](_0xb367('0x75'),_0x225947[_0xb367('0x46')]['id'],_0x3269ae));}else{return _0x5b8744[_0xb367('0x1a')](0xcc);}})[_0xb367('0x45')](handleError(_0x5b8744,null));}; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.model.js b/server/api/jscriptyProject/jscriptyProject.model.js index c2d4729..e16802a 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 _0xf920=['../../config/environment','exports','JscriptyProject','util','../../config/logger','api','moment','bluebird','request-promise','rimraf'];(function(_0x31a671,_0x3490ce){var _0x3cbeee=function(_0x2bf0ab){while(--_0x2bf0ab){_0x31a671['push'](_0x31a671['shift']());}};_0x3cbeee(++_0x3490ce);}(_0xf920,0x1a7));var _0x0f92=function(_0x279b1a,_0x2bb6df){_0x279b1a=_0x279b1a-0x0;var _0x316364=_0xf920[_0x279b1a];return _0x316364;};'use strict';var _=require('lodash');var util=require(_0x0f92('0x0'));var logger=require(_0x0f92('0x1'))(_0x0f92('0x2'));var moment=require(_0x0f92('0x3'));var BPromise=require(_0x0f92('0x4'));var rp=require(_0x0f92('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x0f92('0x6'));var config=require(_0x0f92('0x7'));var attributes=require('./jscriptyProject.attributes');module[_0x0f92('0x8')]=function(_0x5489a7,_0x49b9b5){return _0x5489a7['define'](_0x0f92('0x9'),attributes,{'tableName':'jscripty_projects','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3b61=['JscriptyProject','jscripty_projects','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','exports','define'];(function(_0x50d5b6,_0x46c4c9){var _0x10e1df=function(_0x23e8c5){while(--_0x23e8c5){_0x50d5b6['push'](_0x50d5b6['shift']());}};_0x10e1df(++_0x46c4c9);}(_0x3b61,0x1c5));var _0x13b6=function(_0x5a1baa,_0x12e00a){_0x5a1baa=_0x5a1baa-0x0;var _0x15c41f=_0x3b61[_0x5a1baa];return _0x15c41f;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x13b6('0x0'))(_0x13b6('0x1'));var moment=require(_0x13b6('0x2'));var BPromise=require(_0x13b6('0x3'));var rp=require(_0x13b6('0x4'));var fs=require('fs');var path=require(_0x13b6('0x5'));var rimraf=require('rimraf');var config=require(_0x13b6('0x6'));var attributes=require('./jscriptyProject.attributes');module[_0x13b6('0x7')]=function(_0x5e351b,_0x4246a6){return _0x5e351b[_0x13b6('0x8')](_0x13b6('0x9'),attributes,{'tableName':_0x13b6('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.rpc.js b/server/api/jscriptyProject/jscriptyProject.rpc.js index 9b7ba05..f23f268 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 _0x90e2=['../../config/environment','client','http','info','JscriptyProject,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','lodash','util','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x282999,_0x4df660){var _0x30681f=function(_0x50e926){while(--_0x50e926){_0x282999['push'](_0x282999['shift']());}};_0x30681f(++_0x4df660);}(_0x90e2,0x9b));var _0x290e=function(_0x281d76,_0x1486a5){_0x281d76=_0x281d76-0x0;var _0x438f44=_0x90e2[_0x281d76];return _0x438f44;};'use strict';var _=require(_0x290e('0x0'));var util=require(_0x290e('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x290e('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x290e('0x3'))['db'];var utils=require(_0x290e('0x4'));var logger=require(_0x290e('0x5'))(_0x290e('0x6'));var config=require(_0x290e('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x290e('0x8')][_0x290e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x7826e8,_0xecc065,_0x2df1dd){return new BPromise(function(_0x3991f9,_0x5c0d4f){return client['request'](_0x7826e8,_0x2df1dd)['then'](function(_0x57b377){logger[_0x290e('0xa')](_0x290e('0xb'),_0xecc065,_0x290e('0xc'));logger[_0x290e('0xd')]('JscriptyProject,\x20%s,\x20%s,\x20%s',_0xecc065,_0x290e('0xc'),JSON['stringify'](_0x57b377));if(_0x57b377[_0x290e('0xe')]){if(_0x57b377['error'][_0x290e('0xf')]===0x1f4){logger['error'](_0x290e('0xb'),_0xecc065,_0x57b377['error'][_0x290e('0x10')]);return _0x5c0d4f(_0x57b377[_0x290e('0xe')]['message']);}logger['error'](_0x290e('0xb'),_0xecc065,_0x57b377[_0x290e('0xe')][_0x290e('0x10')]);return _0x3991f9(_0x57b377[_0x290e('0xe')][_0x290e('0x10')]);}else{logger['info'](_0x290e('0xb'),_0xecc065,_0x290e('0xc'));_0x3991f9(_0x57b377[_0x290e('0x11')][_0x290e('0x10')]);}})['catch'](function(_0x19c686){logger[_0x290e('0xe')](_0x290e('0xb'),_0xecc065,_0x19c686);_0x5c0d4f(_0x19c686);});});} \ No newline at end of file +var _0x243e=['catch','lodash','util','bluebird','randomstring','ioredis','rpc','../../config/environment','jayson/promise','http','request','info','request\x20sent','debug','JscriptyProject,\x20%s,\x20%s,\x20%s','stringify','error','code','JscriptyProject,\x20%s,\x20%s','message','result'];(function(_0x10dbf6,_0x3ff964){var _0x452147=function(_0x7476e0){while(--_0x7476e0){_0x10dbf6['push'](_0x10dbf6['shift']());}};_0x452147(++_0x3ff964);}(_0x243e,0x166));var _0xe243=function(_0xbe8c88,_0x30159f){_0xbe8c88=_0xbe8c88-0x0;var _0x40a5f9=_0x243e[_0xbe8c88];return _0x40a5f9;};'use strict';var _=require(_0xe243('0x0'));var util=require(_0xe243('0x1'));var moment=require('moment');var BPromise=require(_0xe243('0x2'));var rs=require(_0xe243('0x3'));var fs=require('fs');var Redis=require(_0xe243('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xe243('0x5'));var config=require(_0xe243('0x6'));var jayson=require(_0xe243('0x7'));var client=jayson['client'][_0xe243('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x1f18e6,_0x128c32,_0x4bdd39){return new BPromise(function(_0x280cc6,_0xd84c18){return client[_0xe243('0x9')](_0x1f18e6,_0x4bdd39)['then'](function(_0x1e071d){logger[_0xe243('0xa')]('JscriptyProject,\x20%s,\x20%s',_0x128c32,_0xe243('0xb'));logger[_0xe243('0xc')](_0xe243('0xd'),_0x128c32,_0xe243('0xb'),JSON[_0xe243('0xe')](_0x1e071d));if(_0x1e071d['error']){if(_0x1e071d[_0xe243('0xf')][_0xe243('0x10')]===0x1f4){logger[_0xe243('0xf')]('JscriptyProject,\x20%s,\x20%s',_0x128c32,_0x1e071d[_0xe243('0xf')]['message']);return _0xd84c18(_0x1e071d[_0xe243('0xf')]['message']);}logger[_0xe243('0xf')](_0xe243('0x11'),_0x128c32,_0x1e071d['error']['message']);return _0x280cc6(_0x1e071d[_0xe243('0xf')][_0xe243('0x12')]);}else{logger[_0xe243('0xa')](_0xe243('0x11'),_0x128c32,_0xe243('0xb'));_0x280cc6(_0x1e071d[_0xe243('0x13')]['message']);}})[_0xe243('0x14')](function(_0x5ec408){logger[_0xe243('0xf')](_0xe243('0x11'),_0x128c32,_0x5ec408);_0xd84c18(_0x5ec408);});});} \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/index.js b/server/api/jscriptyQuestionReport/index.js index 4b64299..f6442d3 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 _0x685b=['post','create','put','/:id','update','delete','destroy','exports','util','express','Router','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','show'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x685b,0x15e));var _0xb685=function(_0xa63ea3,_0x4367ff){_0xa63ea3=_0xa63ea3-0x0;var _0x2aa5ff=_0x685b[_0xa63ea3];return _0x2aa5ff;};'use strict';var multer=require('multer');var util=require(_0xb685('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xb685('0x1'));var router=express[_0xb685('0x2')]();var auth=require('../../components/auth/service');var interaction=require(_0xb685('0x3'));var config=require(_0xb685('0x4'));var controller=require('./jscriptyQuestionReport.controller');router[_0xb685('0x5')]('/',auth[_0xb685('0x6')](),controller[_0xb685('0x7')]);router[_0xb685('0x5')](_0xb685('0x8'),auth['isAuthenticated'](),controller[_0xb685('0x9')]);router[_0xb685('0x5')]('/:id',auth[_0xb685('0x6')](),controller[_0xb685('0xa')]);router[_0xb685('0xb')]('/',auth[_0xb685('0x6')](),controller[_0xb685('0xc')]);router[_0xb685('0xd')](_0xb685('0xe'),auth[_0xb685('0x6')](),controller[_0xb685('0xf')]);router[_0xb685('0x10')](_0xb685('0xe'),auth[_0xb685('0x6')](),controller[_0xb685('0x11')]);module[_0xb685('0x12')]=router; \ No newline at end of file +var _0xb0f7=['../../components/interaction/service','./jscriptyQuestionReport.controller','get','isAuthenticated','describe','/:id','show','post','create','update','destroy','exports','multer','path','connect-timeout','express'];(function(_0x4a701f,_0x3074b9){var _0x316cfc=function(_0x24f521){while(--_0x24f521){_0x4a701f['push'](_0x4a701f['shift']());}};_0x316cfc(++_0x3074b9);}(_0xb0f7,0x17c));var _0x7b0f=function(_0x40b19e,_0x51f6ec){_0x40b19e=_0x40b19e-0x0;var _0x423c2f=_0xb0f7[_0x40b19e];return _0x423c2f;};'use strict';var multer=require(_0x7b0f('0x0'));var util=require('util');var path=require(_0x7b0f('0x1'));var timeout=require(_0x7b0f('0x2'));var express=require(_0x7b0f('0x3'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0x7b0f('0x4'));var config=require('../../config/environment');var controller=require(_0x7b0f('0x5'));router[_0x7b0f('0x6')]('/',auth[_0x7b0f('0x7')](),controller['index']);router[_0x7b0f('0x6')]('/describe',auth['isAuthenticated'](),controller[_0x7b0f('0x8')]);router['get'](_0x7b0f('0x9'),auth['isAuthenticated'](),controller[_0x7b0f('0xa')]);router[_0x7b0f('0xb')]('/',auth[_0x7b0f('0x7')](),controller[_0x7b0f('0xc')]);router['put']('/:id',auth['isAuthenticated'](),controller[_0x7b0f('0xd')]);router['delete']('/:id',auth[_0x7b0f('0x7')](),controller[_0x7b0f('0xe')]);module[_0x7b0f('0xf')]=router; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.attributes.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.attributes.js index ede3cfd..ab317d0 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 _0x4760=['STRING','TEXT','long','sequelize','exports'];(function(_0x4e9628,_0x250573){var _0x27bc8c=function(_0xb3b7ae){while(--_0xb3b7ae){_0x4e9628['push'](_0x4e9628['shift']());}};_0x27bc8c(++_0x250573);}(_0x4760,0xee));var _0x0476=function(_0x59a6ce,_0x33c4f5){_0x59a6ce=_0x59a6ce-0x0;var _0x401941=_0x4760[_0x59a6ce];return _0x401941;};'use strict';var Sequelize=require(_0x0476('0x0'));module[_0x0476('0x1')]={'question':{'type':Sequelize[_0x0476('0x2')]},'answer':{'type':Sequelize[_0x0476('0x3')](_0x0476('0x4'))},'membername':{'type':Sequelize[_0x0476('0x2')]},'projectname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize[_0x0476('0x2')]},'uniqueid':{'type':Sequelize[_0x0476('0x2')]},'calleridname':{'type':Sequelize[_0x0476('0x2')]},'calleridnum':{'type':Sequelize[_0x0476('0x2')]},'questionId':{'type':Sequelize[_0x0476('0x2')]}}; \ No newline at end of file +var _0x9f97=['exports','long','STRING','sequelize'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x9f97,0x1c3));var _0x79f9=function(_0x2650e9,_0xb91cc){_0x2650e9=_0x2650e9-0x0;var _0x3511c8=_0x9f97[_0x2650e9];return _0x3511c8;};'use strict';var Sequelize=require(_0x79f9('0x0'));module[_0x79f9('0x1')]={'question':{'type':Sequelize['STRING']},'answer':{'type':Sequelize['TEXT'](_0x79f9('0x2'))},'membername':{'type':Sequelize[_0x79f9('0x3')]},'projectname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize[_0x79f9('0x3')]},'uniqueid':{'type':Sequelize[_0x79f9('0x3')]},'calleridname':{'type':Sequelize[_0x79f9('0x3')]},'calleridnum':{'type':Sequelize[_0x79f9('0x3')]},'questionId':{'type':Sequelize[_0x79f9('0x3')]}}; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.controller.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.controller.js index 4a5ad1a..d3a970f 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 _0x8920=['hasOwnProperty','order','sort','where','filters','pick','filter','merge','VIRTUAL','includeAll','include','rows','catch','show','rawAttributes','options','find','create','body','params','html-pdf','eml-format','rimraf','zip-dir','bluebird','util','to-csv','ejs','lodash','squel','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','sendStatus','status','count','offset','limit','Content-Range','json','apply','reject','save','update','then','error','stack','name','send','index','JscriptyQuestionReport','fieldName','type','key','model','query','keys','intersection','attributes','fields','length'];(function(_0xefd519,_0xc62635){var _0x4bb882=function(_0x37e0a1){while(--_0x37e0a1){_0xefd519['push'](_0xefd519['shift']());}};_0x4bb882(++_0xc62635);}(_0x8920,0x1f0));var _0x0892=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x8920[_0x5b644e];return _0x49c6bf;};'use strict';var pdf=require(_0x0892('0x0'));var emlformat=require(_0x0892('0x1'));var rimraf=require(_0x0892('0x2'));var zipdir=require(_0x0892('0x3'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x0892('0x4'));var Mustache=require('mustache');var util=require(_0x0892('0x5'));var path=require('path');var sox=require('sox');var csv=require(_0x0892('0x6'));var ejs=require(_0x0892('0x7'));var fs=require('fs');var _=require(_0x0892('0x8'));var squel=require(_0x0892('0x9'));var crypto=require('crypto');var jsforce=require(_0x0892('0xa'));var deskjs=require('desk.js');var toCsv=require(_0x0892('0x6'));var querystring=require(_0x0892('0xb'));var Papa=require(_0x0892('0xc'));var Redis=require(_0x0892('0xd'));var authService=require(_0x0892('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0x0892('0xf'));var hardwareService=require(_0x0892('0x10'));var logger=require(_0x0892('0x11'))('api');var utils=require(_0x0892('0x12'));var config=require(_0x0892('0x13'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x17ae32,_0x43315e){_0x43315e=_0x43315e||0xcc;return function(_0x36d8bf){if(_0x36d8bf){return _0x17ae32[_0x0892('0x14')](_0x43315e);}return _0x17ae32[_0x0892('0x15')](_0x43315e)['end']();};}function respondWithResult(_0x22fd1e,_0x395ca2){_0x395ca2=_0x395ca2||0xc8;return function(_0x58ad38){if(_0x58ad38){return _0x22fd1e['status'](_0x395ca2)['json'](_0x58ad38);}};}function respondWithFilteredResult(_0x5351c7,_0x4714b3){return function(_0x3203de){if(_0x3203de){var _0x5417a3=_0x3203de[_0x0892('0x16')],_0x4b1b43=_0x4714b3['offset'],_0x59021a=_0x4714b3[_0x0892('0x17')]+_0x4714b3[_0x0892('0x18')],_0x47c24d;if(_0x59021a>=_0x5417a3){_0x59021a=_0x5417a3;_0x47c24d=0xc8;}else{_0x47c24d=0xce;}_0x5351c7[_0x0892('0x15')](_0x47c24d);return _0x5351c7['set'](_0x0892('0x19'),_0x4b1b43+'-'+_0x59021a+'/'+_0x5417a3)[_0x0892('0x1a')](_0x3203de);}return null;};}function patchUpdates(_0x141bd9){return function(_0x4a44e7){try{jsonpatch[_0x0892('0x1b')](_0x4a44e7,_0x141bd9,!![]);}catch(_0x2ce371){return BPromise[_0x0892('0x1c')](_0x2ce371);}return _0x4a44e7[_0x0892('0x1d')]();};}function saveUpdates(_0x4a100c,_0x4518df){return function(_0x21b8aa){if(_0x21b8aa){return _0x21b8aa[_0x0892('0x1e')](_0x4a100c)[_0x0892('0x1f')](function(_0xd795fb){return _0xd795fb;});}return null;};}function removeEntity(_0x2c7ad8,_0x413096){return function(_0x46a228){if(_0x46a228){return _0x46a228['destroy']()[_0x0892('0x1f')](function(){_0x2c7ad8['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x5e1044,_0x173ac3){return function(_0x24461c){if(!_0x24461c){_0x5e1044[_0x0892('0x14')](0x194);}return _0x24461c;};}function handleError(_0x26ff05,_0x4aa05d){_0x4aa05d=_0x4aa05d||0x1f4;return function(_0x153115){logger[_0x0892('0x20')](_0x153115[_0x0892('0x21')]);if(_0x153115[_0x0892('0x22')]){delete _0x153115['name'];}_0x26ff05[_0x0892('0x15')](_0x4aa05d)[_0x0892('0x23')](_0x153115);};}exports[_0x0892('0x24')]=function(_0x33b220,_0x598568){var _0x18cff4={},_0x121e9e={},_0x18c712={'count':0x0,'rows':[]};var _0x4014ea=_['map'](db[_0x0892('0x25')]['rawAttributes'],function(_0x170d6a){return{'name':_0x170d6a[_0x0892('0x26')],'type':_0x170d6a[_0x0892('0x27')][_0x0892('0x28')]};});_0x121e9e[_0x0892('0x29')]=_['map'](_0x4014ea,_0x0892('0x22'));_0x121e9e[_0x0892('0x2a')]=_[_0x0892('0x2b')](_0x33b220[_0x0892('0x2a')]);_0x121e9e['filters']=_[_0x0892('0x2c')](_0x121e9e[_0x0892('0x29')],_0x121e9e[_0x0892('0x2a')]);_0x18cff4[_0x0892('0x2d')]=_[_0x0892('0x2c')](_0x121e9e[_0x0892('0x29')],qs[_0x0892('0x2e')](_0x33b220[_0x0892('0x2a')][_0x0892('0x2e')]));_0x18cff4[_0x0892('0x2d')]=_0x18cff4[_0x0892('0x2d')][_0x0892('0x2f')]?_0x18cff4[_0x0892('0x2d')]:_0x121e9e[_0x0892('0x29')];if(!_0x33b220[_0x0892('0x2a')][_0x0892('0x30')]('nolimit')){_0x18cff4[_0x0892('0x18')]=qs[_0x0892('0x18')](_0x33b220[_0x0892('0x2a')]['limit']);_0x18cff4[_0x0892('0x17')]=qs['offset'](_0x33b220[_0x0892('0x2a')][_0x0892('0x17')]);}_0x18cff4[_0x0892('0x31')]=qs[_0x0892('0x32')](_0x33b220[_0x0892('0x2a')][_0x0892('0x32')]);_0x18cff4[_0x0892('0x33')]=qs[_0x0892('0x34')](_[_0x0892('0x35')](_0x33b220['query'],_0x121e9e[_0x0892('0x34')]),_0x4014ea);if(_0x33b220[_0x0892('0x2a')][_0x0892('0x36')]){_0x18cff4[_0x0892('0x33')]=_[_0x0892('0x37')](_0x18cff4[_0x0892('0x33')],{'$or':_['map'](_0x4014ea,function(_0x32c2f4){if(_0x32c2f4[_0x0892('0x27')]!==_0x0892('0x38')){var _0x1e694f={};_0x1e694f[_0x32c2f4[_0x0892('0x22')]]={'$like':'%'+_0x33b220['query']['filter']+'%'};return _0x1e694f;}})});}_0x18cff4=_[_0x0892('0x37')]({},_0x18cff4,_0x33b220['options']);var _0x3b19a9={'where':_0x18cff4['where']};return db['JscriptyQuestionReport']['count'](_0x3b19a9)[_0x0892('0x1f')](function(_0x591e5d){_0x18c712[_0x0892('0x16')]=_0x591e5d;if(_0x33b220[_0x0892('0x2a')][_0x0892('0x39')]){_0x18cff4[_0x0892('0x3a')]=[{'all':!![]}];}return db[_0x0892('0x25')]['findAll'](_0x18cff4);})['then'](function(_0x207f77){_0x18c712[_0x0892('0x3b')]=_0x207f77;return _0x18c712;})['then'](respondWithFilteredResult(_0x598568,_0x18cff4))[_0x0892('0x3c')](handleError(_0x598568,null));};exports[_0x0892('0x3d')]=function(_0x42ff57,_0x22b377){var _0x2ce8c4={'raw':!![],'where':{'id':_0x42ff57['params']['id']}},_0x528ce6={};_0x528ce6[_0x0892('0x29')]=_[_0x0892('0x2b')](db['JscriptyQuestionReport'][_0x0892('0x3e')]);_0x528ce6['query']=_['keys'](_0x42ff57[_0x0892('0x2a')]);_0x528ce6[_0x0892('0x34')]=_[_0x0892('0x2c')](_0x528ce6[_0x0892('0x29')],_0x528ce6['query']);_0x2ce8c4[_0x0892('0x2d')]=_[_0x0892('0x2c')](_0x528ce6[_0x0892('0x29')],qs[_0x0892('0x2e')](_0x42ff57['query'][_0x0892('0x2e')]));_0x2ce8c4['attributes']=_0x2ce8c4[_0x0892('0x2d')][_0x0892('0x2f')]?_0x2ce8c4[_0x0892('0x2d')]:_0x528ce6['model'];if(_0x42ff57['query']['includeAll']){_0x2ce8c4[_0x0892('0x3a')]=[{'all':!![]}];}_0x2ce8c4=_[_0x0892('0x37')]({},_0x2ce8c4,_0x42ff57[_0x0892('0x3f')]);return db[_0x0892('0x25')][_0x0892('0x40')](_0x2ce8c4)[_0x0892('0x1f')](handleEntityNotFound(_0x22b377,null))['then'](respondWithResult(_0x22b377,null))[_0x0892('0x3c')](handleError(_0x22b377,null));};exports[_0x0892('0x41')]=function(_0x1a8944,_0x400d59){return db['JscriptyQuestionReport'][_0x0892('0x41')](_0x1a8944[_0x0892('0x42')],{})[_0x0892('0x1f')](respondWithResult(_0x400d59,0xc9))[_0x0892('0x3c')](handleError(_0x400d59,null));};exports[_0x0892('0x1e')]=function(_0x29b1fe,_0x4b1523){if(_0x29b1fe[_0x0892('0x42')]['id']){delete _0x29b1fe[_0x0892('0x42')]['id'];}return db['JscriptyQuestionReport'][_0x0892('0x40')]({'where':{'id':_0x29b1fe[_0x0892('0x43')]['id']}})['then'](handleEntityNotFound(_0x4b1523,null))[_0x0892('0x1f')](saveUpdates(_0x29b1fe['body'],null))[_0x0892('0x1f')](respondWithResult(_0x4b1523,null))['catch'](handleError(_0x4b1523,null));};exports['destroy']=function(_0x26d2d7,_0x516b18){return db[_0x0892('0x25')]['find']({'where':{'id':_0x26d2d7['params']['id']}})[_0x0892('0x1f')](handleEntityNotFound(_0x516b18,null))[_0x0892('0x1f')](removeEntity(_0x516b18,null))[_0x0892('0x3c')](handleError(_0x516b18,null));};exports['describe']=function(_0x3c50f8,_0x24486c){return db[_0x0892('0x25')]['describe']()[_0x0892('0x1f')](respondWithResult(_0x24486c,null))[_0x0892('0x3c')](handleError(_0x24486c,null));}; \ No newline at end of file +var _0xc0d6=['json','count','offset','limit','set','Content-Range','apply','save','update','then','destroy','sendStatus','stack','send','index','map','JscriptyQuestionReport','rawAttributes','key','model','name','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','describe','html-pdf','rimraf','fast-json-patch','moment','mustache','util','path','sox','to-csv','ejs','squel','crypto','jsforce','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../mysqldb','end','status'];(function(_0x317ada,_0x246987){var _0x520c36=function(_0x3ade01){while(--_0x3ade01){_0x317ada['push'](_0x317ada['shift']());}};_0x520c36(++_0x246987);}(_0xc0d6,0x1da));var _0x6c0d=function(_0x5b9f2e,_0x32ebb4){_0x5b9f2e=_0x5b9f2e-0x0;var _0x4c38fa=_0xc0d6[_0x5b9f2e];return _0x4c38fa;};'use strict';var pdf=require(_0x6c0d('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x6c0d('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x6c0d('0x2'));var rp=require('request-promise');var moment=require(_0x6c0d('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x6c0d('0x4'));var util=require(_0x6c0d('0x5'));var path=require(_0x6c0d('0x6'));var sox=require(_0x6c0d('0x7'));var csv=require(_0x6c0d('0x8'));var ejs=require(_0x6c0d('0x9'));var fs=require('fs');var _=require('lodash');var squel=require(_0x6c0d('0xa'));var crypto=require(_0x6c0d('0xb'));var jsforce=require(_0x6c0d('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x6c0d('0x8'));var querystring=require('querystring');var Papa=require(_0x6c0d('0xd'));var Redis=require(_0x6c0d('0xe'));var authService=require('../../components/auth/service');var qs=require(_0x6c0d('0xf'));var as=require(_0x6c0d('0x10'));var hardwareService=require(_0x6c0d('0x11'));var logger=require('../../config/logger')(_0x6c0d('0x12'));var utils=require(_0x6c0d('0x13'));var config=require('../../config/environment');var db=require(_0x6c0d('0x14'))['db'];function respondWithStatusCode(_0x5c6ed8,_0xf9450e){_0xf9450e=_0xf9450e||0xcc;return function(_0x614be8){if(_0x614be8){return _0x5c6ed8['sendStatus'](_0xf9450e);}return _0x5c6ed8['status'](_0xf9450e)[_0x6c0d('0x15')]();};}function respondWithResult(_0x5146d2,_0x438d50){_0x438d50=_0x438d50||0xc8;return function(_0x43f13f){if(_0x43f13f){return _0x5146d2[_0x6c0d('0x16')](_0x438d50)[_0x6c0d('0x17')](_0x43f13f);}};}function respondWithFilteredResult(_0x269aee,_0x353cb2){return function(_0x5d20fd){if(_0x5d20fd){var _0x15c12c=_0x5d20fd[_0x6c0d('0x18')],_0x56abc7=_0x353cb2[_0x6c0d('0x19')],_0x27ae35=_0x353cb2['offset']+_0x353cb2[_0x6c0d('0x1a')],_0xbb34f2;if(_0x27ae35>=_0x15c12c){_0x27ae35=_0x15c12c;_0xbb34f2=0xc8;}else{_0xbb34f2=0xce;}_0x269aee['status'](_0xbb34f2);return _0x269aee[_0x6c0d('0x1b')](_0x6c0d('0x1c'),_0x56abc7+'-'+_0x27ae35+'/'+_0x15c12c)['json'](_0x5d20fd);}return null;};}function patchUpdates(_0x1e13e5){return function(_0x97bebb){try{jsonpatch[_0x6c0d('0x1d')](_0x97bebb,_0x1e13e5,!![]);}catch(_0x256593){return BPromise['reject'](_0x256593);}return _0x97bebb[_0x6c0d('0x1e')]();};}function saveUpdates(_0x43abd7,_0x2edce0){return function(_0x540f78){if(_0x540f78){return _0x540f78[_0x6c0d('0x1f')](_0x43abd7)[_0x6c0d('0x20')](function(_0x60ce50){return _0x60ce50;});}return null;};}function removeEntity(_0x1b1910,_0x2d625e){return function(_0x774a4e){if(_0x774a4e){return _0x774a4e[_0x6c0d('0x21')]()['then'](function(){_0x1b1910['status'](0xcc)[_0x6c0d('0x15')]();});}};}function handleEntityNotFound(_0x2c9deb,_0x4d982b){return function(_0x3ef484){if(!_0x3ef484){_0x2c9deb[_0x6c0d('0x22')](0x194);}return _0x3ef484;};}function handleError(_0x5bd6f6,_0x1e965f){_0x1e965f=_0x1e965f||0x1f4;return function(_0x190e0a){logger['error'](_0x190e0a[_0x6c0d('0x23')]);if(_0x190e0a['name']){delete _0x190e0a['name'];}_0x5bd6f6['status'](_0x1e965f)[_0x6c0d('0x24')](_0x190e0a);};}exports[_0x6c0d('0x25')]=function(_0x5b8bd8,_0x439afe){var _0x23e268={},_0x51b190={},_0x28791c={'count':0x0,'rows':[]};var _0xe30903=_[_0x6c0d('0x26')](db[_0x6c0d('0x27')][_0x6c0d('0x28')],function(_0x55efe3){return{'name':_0x55efe3['fieldName'],'type':_0x55efe3['type'][_0x6c0d('0x29')]};});_0x51b190[_0x6c0d('0x2a')]=_[_0x6c0d('0x26')](_0xe30903,_0x6c0d('0x2b'));_0x51b190[_0x6c0d('0x2c')]=_[_0x6c0d('0x2d')](_0x5b8bd8[_0x6c0d('0x2c')]);_0x51b190[_0x6c0d('0x2e')]=_[_0x6c0d('0x2f')](_0x51b190[_0x6c0d('0x2a')],_0x51b190[_0x6c0d('0x2c')]);_0x23e268[_0x6c0d('0x30')]=_[_0x6c0d('0x2f')](_0x51b190[_0x6c0d('0x2a')],qs['fields'](_0x5b8bd8[_0x6c0d('0x2c')][_0x6c0d('0x31')]));_0x23e268[_0x6c0d('0x30')]=_0x23e268['attributes'][_0x6c0d('0x32')]?_0x23e268[_0x6c0d('0x30')]:_0x51b190[_0x6c0d('0x2a')];if(!_0x5b8bd8[_0x6c0d('0x2c')][_0x6c0d('0x33')]('nolimit')){_0x23e268[_0x6c0d('0x1a')]=qs[_0x6c0d('0x1a')](_0x5b8bd8[_0x6c0d('0x2c')][_0x6c0d('0x1a')]);_0x23e268[_0x6c0d('0x19')]=qs[_0x6c0d('0x19')](_0x5b8bd8['query'][_0x6c0d('0x19')]);}_0x23e268[_0x6c0d('0x34')]=qs[_0x6c0d('0x35')](_0x5b8bd8[_0x6c0d('0x2c')][_0x6c0d('0x35')]);_0x23e268[_0x6c0d('0x36')]=qs[_0x6c0d('0x2e')](_[_0x6c0d('0x37')](_0x5b8bd8[_0x6c0d('0x2c')],_0x51b190[_0x6c0d('0x2e')]),_0xe30903);if(_0x5b8bd8[_0x6c0d('0x2c')]['filter']){_0x23e268['where']=_[_0x6c0d('0x38')](_0x23e268[_0x6c0d('0x36')],{'$or':_[_0x6c0d('0x26')](_0xe30903,function(_0xabdece){if(_0xabdece['type']!==_0x6c0d('0x39')){var _0x302638={};_0x302638[_0xabdece[_0x6c0d('0x2b')]]={'$like':'%'+_0x5b8bd8['query'][_0x6c0d('0x3a')]+'%'};return _0x302638;}})});}_0x23e268=_[_0x6c0d('0x38')]({},_0x23e268,_0x5b8bd8[_0x6c0d('0x3b')]);var _0x3ba1bd={'where':_0x23e268[_0x6c0d('0x36')]};return db['JscriptyQuestionReport'][_0x6c0d('0x18')](_0x3ba1bd)[_0x6c0d('0x20')](function(_0x2b2f4d){_0x28791c['count']=_0x2b2f4d;if(_0x5b8bd8[_0x6c0d('0x2c')][_0x6c0d('0x3c')]){_0x23e268[_0x6c0d('0x3d')]=[{'all':!![]}];}return db[_0x6c0d('0x27')][_0x6c0d('0x3e')](_0x23e268);})[_0x6c0d('0x20')](function(_0x275dec){_0x28791c[_0x6c0d('0x3f')]=_0x275dec;return _0x28791c;})[_0x6c0d('0x20')](respondWithFilteredResult(_0x439afe,_0x23e268))[_0x6c0d('0x40')](handleError(_0x439afe,null));};exports[_0x6c0d('0x41')]=function(_0x4b7b91,_0x1be6a7){var _0x6cacd7={'raw':!![],'where':{'id':_0x4b7b91[_0x6c0d('0x42')]['id']}},_0x5929a6={};_0x5929a6[_0x6c0d('0x2a')]=_['keys'](db[_0x6c0d('0x27')]['rawAttributes']);_0x5929a6[_0x6c0d('0x2c')]=_[_0x6c0d('0x2d')](_0x4b7b91[_0x6c0d('0x2c')]);_0x5929a6[_0x6c0d('0x2e')]=_[_0x6c0d('0x2f')](_0x5929a6[_0x6c0d('0x2a')],_0x5929a6[_0x6c0d('0x2c')]);_0x6cacd7[_0x6c0d('0x30')]=_[_0x6c0d('0x2f')](_0x5929a6[_0x6c0d('0x2a')],qs[_0x6c0d('0x31')](_0x4b7b91[_0x6c0d('0x2c')][_0x6c0d('0x31')]));_0x6cacd7[_0x6c0d('0x30')]=_0x6cacd7[_0x6c0d('0x30')][_0x6c0d('0x32')]?_0x6cacd7[_0x6c0d('0x30')]:_0x5929a6[_0x6c0d('0x2a')];if(_0x4b7b91[_0x6c0d('0x2c')]['includeAll']){_0x6cacd7[_0x6c0d('0x3d')]=[{'all':!![]}];}_0x6cacd7=_[_0x6c0d('0x38')]({},_0x6cacd7,_0x4b7b91[_0x6c0d('0x3b')]);return db[_0x6c0d('0x27')][_0x6c0d('0x43')](_0x6cacd7)['then'](handleEntityNotFound(_0x1be6a7,null))[_0x6c0d('0x20')](respondWithResult(_0x1be6a7,null))['catch'](handleError(_0x1be6a7,null));};exports[_0x6c0d('0x44')]=function(_0x12485f,_0x194da0){return db[_0x6c0d('0x27')]['create'](_0x12485f[_0x6c0d('0x45')],{})[_0x6c0d('0x20')](respondWithResult(_0x194da0,0xc9))['catch'](handleError(_0x194da0,null));};exports[_0x6c0d('0x1f')]=function(_0x27e51f,_0x5d30c3){if(_0x27e51f[_0x6c0d('0x45')]['id']){delete _0x27e51f[_0x6c0d('0x45')]['id'];}return db[_0x6c0d('0x27')][_0x6c0d('0x43')]({'where':{'id':_0x27e51f[_0x6c0d('0x42')]['id']}})[_0x6c0d('0x20')](handleEntityNotFound(_0x5d30c3,null))[_0x6c0d('0x20')](saveUpdates(_0x27e51f[_0x6c0d('0x45')],null))[_0x6c0d('0x20')](respondWithResult(_0x5d30c3,null))[_0x6c0d('0x40')](handleError(_0x5d30c3,null));};exports[_0x6c0d('0x21')]=function(_0x5a5469,_0x56886d){return db[_0x6c0d('0x27')][_0x6c0d('0x43')]({'where':{'id':_0x5a5469[_0x6c0d('0x42')]['id']}})['then'](handleEntityNotFound(_0x56886d,null))[_0x6c0d('0x20')](removeEntity(_0x56886d,null))[_0x6c0d('0x40')](handleError(_0x56886d,null));};exports[_0x6c0d('0x46')]=function(_0x5d8a8f,_0x414923){return db[_0x6c0d('0x27')][_0x6c0d('0x46')]()[_0x6c0d('0x20')](respondWithResult(_0x414923,null))[_0x6c0d('0x40')](handleError(_0x414923,null));}; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.model.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.model.js index 53a0abb..f08f59a 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 _0x7655=['moment','request-promise','path','rimraf','./jscriptyQuestionReport.attributes','exports','define','report_jscripty_questions','lodash','../../config/logger','api'];(function(_0x20e7e3,_0x1529be){var _0x14b9de=function(_0xa82925){while(--_0xa82925){_0x20e7e3['push'](_0x20e7e3['shift']());}};_0x14b9de(++_0x1529be);}(_0x7655,0x168));var _0x5765=function(_0x4de98a,_0x24aac8){_0x4de98a=_0x4de98a-0x0;var _0x4ea391=_0x7655[_0x4de98a];return _0x4ea391;};'use strict';var _=require(_0x5765('0x0'));var util=require('util');var logger=require(_0x5765('0x1'))(_0x5765('0x2'));var moment=require(_0x5765('0x3'));var BPromise=require('bluebird');var rp=require(_0x5765('0x4'));var fs=require('fs');var path=require(_0x5765('0x5'));var rimraf=require(_0x5765('0x6'));var config=require('../../config/environment');var attributes=require(_0x5765('0x7'));module[_0x5765('0x8')]=function(_0x3f3586,_0x1f0938){return _0x3f3586[_0x5765('0x9')]('JscriptyQuestionReport',attributes,{'tableName':_0x5765('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6e4b=['../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./jscriptyQuestionReport.attributes','JscriptyQuestionReport','report_jscripty_questions','lodash'];(function(_0x2257bb,_0x37d0d3){var _0x26dc39=function(_0x2908aa){while(--_0x2908aa){_0x2257bb['push'](_0x2257bb['shift']());}};_0x26dc39(++_0x37d0d3);}(_0x6e4b,0x78));var _0xb6e4=function(_0x55991f,_0x4dae2b){_0x55991f=_0x55991f-0x0;var _0x35aa41=_0x6e4b[_0x55991f];return _0x35aa41;};'use strict';var _=require(_0xb6e4('0x0'));var util=require('util');var logger=require(_0xb6e4('0x1'))(_0xb6e4('0x2'));var moment=require(_0xb6e4('0x3'));var BPromise=require(_0xb6e4('0x4'));var rp=require(_0xb6e4('0x5'));var fs=require('fs');var path=require(_0xb6e4('0x6'));var rimraf=require('rimraf');var config=require(_0xb6e4('0x7'));var attributes=require(_0xb6e4('0x8'));module['exports']=function(_0x5d95d8,_0x39e3b3){return _0x5d95d8['define'](_0xb6e4('0x9'),attributes,{'tableName':_0xb6e4('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 f1bcf34..31539d9 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 _0x8545=['jayson/promise','http','request','then','info','JscriptyQuestionReport,\x20%s,\x20%s','JscriptyQuestionReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','util','../../config/logger','rpc'];(function(_0x57601c,_0x2e2620){var _0x5eff7a=function(_0x45c6e8){while(--_0x45c6e8){_0x57601c['push'](_0x57601c['shift']());}};_0x5eff7a(++_0x2e2620);}(_0x8545,0x12e));var _0x5854=function(_0x2d2c16,_0x4e88b6){_0x2d2c16=_0x2d2c16-0x0;var _0x53f2fb=_0x8545[_0x2d2c16];return _0x53f2fb;};'use strict';var _=require(_0x5854('0x0'));var util=require(_0x5854('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x5854('0x2'))(_0x5854('0x3'));var config=require('../../config/environment');var jayson=require(_0x5854('0x4'));var client=jayson['client'][_0x5854('0x5')]({'port':0x232a});function respondWithRpcPromise(_0x852358,_0x491c1a,_0x3f3c9d){return new BPromise(function(_0x258e49,_0x32cb59){return client[_0x5854('0x6')](_0x852358,_0x3f3c9d)[_0x5854('0x7')](function(_0x171773){logger[_0x5854('0x8')](_0x5854('0x9'),_0x491c1a,'request\x20sent');logger['debug'](_0x5854('0xa'),_0x491c1a,_0x5854('0xb'),JSON[_0x5854('0xc')](_0x171773));if(_0x171773[_0x5854('0xd')]){if(_0x171773[_0x5854('0xd')][_0x5854('0xe')]===0x1f4){logger[_0x5854('0xd')](_0x5854('0x9'),_0x491c1a,_0x171773[_0x5854('0xd')][_0x5854('0xf')]);return _0x32cb59(_0x171773[_0x5854('0xd')]['message']);}logger[_0x5854('0xd')]('JscriptyQuestionReport,\x20%s,\x20%s',_0x491c1a,_0x171773['error'][_0x5854('0xf')]);return _0x258e49(_0x171773['error'][_0x5854('0xf')]);}else{logger[_0x5854('0x8')](_0x5854('0x9'),_0x491c1a,'request\x20sent');_0x258e49(_0x171773[_0x5854('0x10')]['message']);}})[_0x5854('0x11')](function(_0x16db2f){logger[_0x5854('0xd')](_0x5854('0x9'),_0x491c1a,_0x16db2f);_0x32cb59(_0x16db2f);});});} \ No newline at end of file +var _0x9523=['catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','JscriptyQuestionReport,\x20%s,\x20%s','debug','JscriptyQuestionReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result'];(function(_0x5d8c8e,_0x19031e){var _0x2d4ff1=function(_0x5c98ee){while(--_0x5c98ee){_0x5d8c8e['push'](_0x5d8c8e['shift']());}};_0x2d4ff1(++_0x19031e);}(_0x9523,0xe2));var _0x3952=function(_0x270411,_0x251347){_0x270411=_0x270411-0x0;var _0x3dec5f=_0x9523[_0x270411];return _0x3dec5f;};'use strict';var _=require('lodash');var util=require(_0x3952('0x0'));var moment=require(_0x3952('0x1'));var BPromise=require(_0x3952('0x2'));var rs=require(_0x3952('0x3'));var fs=require('fs');var Redis=require(_0x3952('0x4'));var db=require(_0x3952('0x5'))['db'];var utils=require(_0x3952('0x6'));var logger=require(_0x3952('0x7'))(_0x3952('0x8'));var config=require(_0x3952('0x9'));var jayson=require(_0x3952('0xa'));var client=jayson[_0x3952('0xb')][_0x3952('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x1739b6,_0x5ab5eb,_0x5d4a51){return new BPromise(function(_0x14eb57,_0x1f510a){return client[_0x3952('0xd')](_0x1739b6,_0x5d4a51)['then'](function(_0x3b60ad){logger[_0x3952('0xe')](_0x3952('0xf'),_0x5ab5eb,'request\x20sent');logger[_0x3952('0x10')](_0x3952('0x11'),_0x5ab5eb,_0x3952('0x12'),JSON[_0x3952('0x13')](_0x3b60ad));if(_0x3b60ad[_0x3952('0x14')]){if(_0x3b60ad['error'][_0x3952('0x15')]===0x1f4){logger['error'](_0x3952('0xf'),_0x5ab5eb,_0x3b60ad['error'][_0x3952('0x16')]);return _0x1f510a(_0x3b60ad[_0x3952('0x14')]['message']);}logger[_0x3952('0x14')]('JscriptyQuestionReport,\x20%s,\x20%s',_0x5ab5eb,_0x3b60ad['error'][_0x3952('0x16')]);return _0x14eb57(_0x3b60ad[_0x3952('0x14')][_0x3952('0x16')]);}else{logger[_0x3952('0xe')](_0x3952('0xf'),_0x5ab5eb,_0x3952('0x12'));_0x14eb57(_0x3b60ad[_0x3952('0x17')][_0x3952('0x16')]);}})[_0x3952('0x18')](function(_0x428949){logger[_0x3952('0x14')](_0x3952('0xf'),_0x5ab5eb,_0x428949);_0x1f510a(_0x428949);});});} \ No newline at end of file diff --git a/server/api/jscriptySessionReport/index.js b/server/api/jscriptySessionReport/index.js index 0f9edf4..ebfd643 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 _0xe181=['../../components/interaction/service','../../config/environment','get','/describe','isAuthenticated','describe','/:id','show','/:id/questions','getQuestions','post','create','put','update','delete','exports','multer','path','connect-timeout','express','Router','../../components/auth/service'];(function(_0x4e0417,_0x574fd4){var _0x5d6909=function(_0x54e5d3){while(--_0x54e5d3){_0x4e0417['push'](_0x4e0417['shift']());}};_0x5d6909(++_0x574fd4);}(_0xe181,0x68));var _0x1e18=function(_0xc8069a,_0x2968fc){_0xc8069a=_0xc8069a-0x0;var _0x16bc69=_0xe181[_0xc8069a];return _0x16bc69;};'use strict';var multer=require(_0x1e18('0x0'));var util=require('util');var path=require(_0x1e18('0x1'));var timeout=require(_0x1e18('0x2'));var express=require(_0x1e18('0x3'));var router=express[_0x1e18('0x4')]();var auth=require(_0x1e18('0x5'));var interaction=require(_0x1e18('0x6'));var config=require(_0x1e18('0x7'));var controller=require('./jscriptySessionReport.controller');router[_0x1e18('0x8')]('/',auth['isAuthenticated'](),controller['index']);router[_0x1e18('0x8')](_0x1e18('0x9'),auth[_0x1e18('0xa')](),controller[_0x1e18('0xb')]);router[_0x1e18('0x8')](_0x1e18('0xc'),auth['isAuthenticated'](),controller[_0x1e18('0xd')]);router[_0x1e18('0x8')](_0x1e18('0xe'),auth[_0x1e18('0xa')](),controller[_0x1e18('0xf')]);router[_0x1e18('0x10')]('/',auth['isAuthenticated'](),controller[_0x1e18('0x11')]);router[_0x1e18('0x12')](_0x1e18('0xc'),auth[_0x1e18('0xa')](),controller[_0x1e18('0x13')]);router[_0x1e18('0x14')](_0x1e18('0xc'),auth[_0x1e18('0xa')](),controller['destroy']);module[_0x1e18('0x15')]=router; \ No newline at end of file +var _0x165d=['/describe','/:id','isAuthenticated','show','/:id/questions','getQuestions','create','put','delete','destroy','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./jscriptySessionReport.controller','get'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x165d,0x14a));var _0xd165=function(_0x2592db,_0x3b30e9){_0x2592db=_0x2592db-0x0;var _0x4e6792=_0x165d[_0x2592db];return _0x4e6792;};'use strict';var multer=require(_0xd165('0x0'));var util=require(_0xd165('0x1'));var path=require(_0xd165('0x2'));var timeout=require(_0xd165('0x3'));var express=require(_0xd165('0x4'));var router=express[_0xd165('0x5')]();var auth=require(_0xd165('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xd165('0x7'));var controller=require(_0xd165('0x8'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0xd165('0x9')](_0xd165('0xa'),auth['isAuthenticated'](),controller['describe']);router[_0xd165('0x9')](_0xd165('0xb'),auth[_0xd165('0xc')](),controller[_0xd165('0xd')]);router[_0xd165('0x9')](_0xd165('0xe'),auth[_0xd165('0xc')](),controller[_0xd165('0xf')]);router['post']('/',auth[_0xd165('0xc')](),controller[_0xd165('0x10')]);router[_0xd165('0x11')]('/:id',auth[_0xd165('0xc')](),controller['update']);router[_0xd165('0x12')](_0xd165('0xb'),auth[_0xd165('0xc')](),controller[_0xd165('0x13')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.attributes.js b/server/api/jscriptySessionReport/jscriptySessionReport.attributes.js index 508c083..b0a88ec 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 _0xe5a0=['format','YYYY-MM-DD\x20HH:mm:ss','DATE','STRING','BOOLEAN','sequelize','exports','setDataValue','endtime'];(function(_0x1eaa14,_0x156244){var _0x35f007=function(_0x10f884){while(--_0x10f884){_0x1eaa14['push'](_0x1eaa14['shift']());}};_0x35f007(++_0x156244);}(_0xe5a0,0x17f));var _0x0e5a=function(_0x4365c6,_0xd05198){_0x4365c6=_0x4365c6-0x0;var _0x1082e1=_0xe5a0[_0x4365c6];return _0x1082e1;};'use strict';var moment=require('moment');var Sequelize=require(_0x0e5a('0x0'));module[_0x0e5a('0x1')]={'starttime':{'type':Sequelize['DATE'],'set':function(_0x19818b){this[_0x0e5a('0x2')]('starttime',_0x19818b);this['setDataValue'](_0x0e5a('0x3'),moment()[_0x0e5a('0x4')](_0x0e5a('0x5')));}},'endtime':{'type':Sequelize[_0x0e5a('0x6')]},'membername':{'type':Sequelize['STRING']},'projectname':{'type':Sequelize[_0x0e5a('0x7')]},'queue':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x0e5a('0x7')]},'calleridnum':{'type':Sequelize[_0x0e5a('0x7')]},'completed':{'type':Sequelize[_0x0e5a('0x8')],'defaultValue':![]}}; \ No newline at end of file +var _0x8104=['starttime','endtime','format','STRING','BOOLEAN','moment','sequelize','exports','DATE','setDataValue'];(function(_0x521239,_0x51976f){var _0x3ca36f=function(_0x1398f5){while(--_0x1398f5){_0x521239['push'](_0x521239['shift']());}};_0x3ca36f(++_0x51976f);}(_0x8104,0x1a9));var _0x4810=function(_0x902290,_0x1aaa75){_0x902290=_0x902290-0x0;var _0x3f753f=_0x8104[_0x902290];return _0x3f753f;};'use strict';var moment=require(_0x4810('0x0'));var Sequelize=require(_0x4810('0x1'));module[_0x4810('0x2')]={'starttime':{'type':Sequelize[_0x4810('0x3')],'set':function(_0x3fd6dc){this[_0x4810('0x4')](_0x4810('0x5'),_0x3fd6dc);this['setDataValue'](_0x4810('0x6'),moment()[_0x4810('0x7')]('YYYY-MM-DD\x20HH:mm:ss'));}},'endtime':{'type':Sequelize[_0x4810('0x3')]},'membername':{'type':Sequelize[_0x4810('0x8')]},'projectname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize[_0x4810('0x8')]},'uniqueid':{'type':Sequelize[_0x4810('0x8')]},'calleridname':{'type':Sequelize[_0x4810('0x8')]},'calleridnum':{'type':Sequelize['STRING']},'completed':{'type':Sequelize[_0x4810('0x9')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.controller.js b/server/api/jscriptySessionReport/jscriptySessionReport.controller.js index f491256..1a6cd42 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 _0x810a=['json','count','offset','apply','reject','save','update','destroy','then','sendStatus','error','name','index','map','JscriptySessionReport','rawAttributes','fieldName','type','key','model','keys','intersection','query','fields','attributes','length','hasOwnProperty','limit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','params','find','catch','create','body','describe','getQuestions','JscriptyQuestionReport','SessionId','html-pdf','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','lodash','squel','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','end'];(function(_0x358806,_0x322b66){var _0x19fdcb=function(_0xe01b8d){while(--_0xe01b8d){_0x358806['push'](_0x358806['shift']());}};_0x19fdcb(++_0x322b66);}(_0x810a,0x16f));var _0xa810=function(_0x4899ee,_0x5f35a2){_0x4899ee=_0x4899ee-0x0;var _0x1c5a0e=_0x810a[_0x4899ee];return _0x1c5a0e;};'use strict';var pdf=require(_0xa810('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xa810('0x1'));var zipdir=require(_0xa810('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xa810('0x3'));var moment=require(_0xa810('0x4'));var BPromise=require(_0xa810('0x5'));var Mustache=require(_0xa810('0x6'));var util=require(_0xa810('0x7'));var path=require(_0xa810('0x8'));var sox=require('sox');var csv=require(_0xa810('0x9'));var ejs=require(_0xa810('0xa'));var fs=require('fs');var _=require(_0xa810('0xb'));var squel=require(_0xa810('0xc'));var crypto=require('crypto');var jsforce=require(_0xa810('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xa810('0x9'));var querystring=require(_0xa810('0xe'));var Papa=require(_0xa810('0xf'));var Redis=require(_0xa810('0x10'));var authService=require(_0xa810('0x11'));var qs=require(_0xa810('0x12'));var as=require(_0xa810('0x13'));var hardwareService=require(_0xa810('0x14'));var logger=require(_0xa810('0x15'))(_0xa810('0x16'));var utils=require(_0xa810('0x17'));var config=require(_0xa810('0x18'));var db=require(_0xa810('0x19'))['db'];function respondWithStatusCode(_0x1166d1,_0x348515){_0x348515=_0x348515||0xcc;return function(_0x4fc4b9){if(_0x4fc4b9){return _0x1166d1['sendStatus'](_0x348515);}return _0x1166d1[_0xa810('0x1a')](_0x348515)[_0xa810('0x1b')]();};}function respondWithResult(_0x298c53,_0x3ffe74){_0x3ffe74=_0x3ffe74||0xc8;return function(_0x43a998){if(_0x43a998){return _0x298c53[_0xa810('0x1a')](_0x3ffe74)[_0xa810('0x1c')](_0x43a998);}};}function respondWithFilteredResult(_0x3b6ee8,_0x32a286){return function(_0x370e19){if(_0x370e19){var _0x55e2af=_0x370e19[_0xa810('0x1d')],_0x1530b4=_0x32a286[_0xa810('0x1e')],_0x3d5f9d=_0x32a286[_0xa810('0x1e')]+_0x32a286['limit'],_0x23aca5;if(_0x3d5f9d>=_0x55e2af){_0x3d5f9d=_0x55e2af;_0x23aca5=0xc8;}else{_0x23aca5=0xce;}_0x3b6ee8['status'](_0x23aca5);return _0x3b6ee8['set']('Content-Range',_0x1530b4+'-'+_0x3d5f9d+'/'+_0x55e2af)['json'](_0x370e19);}return null;};}function patchUpdates(_0xfcf96c){return function(_0x112069){try{jsonpatch[_0xa810('0x1f')](_0x112069,_0xfcf96c,!![]);}catch(_0x3d20ac){return BPromise[_0xa810('0x20')](_0x3d20ac);}return _0x112069[_0xa810('0x21')]();};}function saveUpdates(_0x2c6f60,_0x38a741){return function(_0x2262bd){if(_0x2262bd){return _0x2262bd[_0xa810('0x22')](_0x2c6f60)['then'](function(_0x58eed0){return _0x58eed0;});}return null;};}function removeEntity(_0x256fc4,_0x377a4c){return function(_0x57e7ae){if(_0x57e7ae){return _0x57e7ae[_0xa810('0x23')]()[_0xa810('0x24')](function(){_0x256fc4[_0xa810('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0xe96563,_0x4ad4fd){return function(_0x4c9a90){if(!_0x4c9a90){_0xe96563[_0xa810('0x25')](0x194);}return _0x4c9a90;};}function handleError(_0x58b69a,_0x50aaa5){_0x50aaa5=_0x50aaa5||0x1f4;return function(_0x2c17e6){logger[_0xa810('0x26')](_0x2c17e6['stack']);if(_0x2c17e6[_0xa810('0x27')]){delete _0x2c17e6[_0xa810('0x27')];}_0x58b69a['status'](_0x50aaa5)['send'](_0x2c17e6);};}exports[_0xa810('0x28')]=function(_0x152dd5,_0x570c11){var _0x4cbcc0={},_0x19fb20={},_0x1ee063={'count':0x0,'rows':[]};var _0xe20156=_[_0xa810('0x29')](db[_0xa810('0x2a')][_0xa810('0x2b')],function(_0x194924){return{'name':_0x194924[_0xa810('0x2c')],'type':_0x194924[_0xa810('0x2d')][_0xa810('0x2e')]};});_0x19fb20[_0xa810('0x2f')]=_[_0xa810('0x29')](_0xe20156,_0xa810('0x27'));_0x19fb20['query']=_[_0xa810('0x30')](_0x152dd5['query']);_0x19fb20['filters']=_[_0xa810('0x31')](_0x19fb20['model'],_0x19fb20[_0xa810('0x32')]);_0x4cbcc0['attributes']=_['intersection'](_0x19fb20[_0xa810('0x2f')],qs[_0xa810('0x33')](_0x152dd5[_0xa810('0x32')][_0xa810('0x33')]));_0x4cbcc0[_0xa810('0x34')]=_0x4cbcc0['attributes'][_0xa810('0x35')]?_0x4cbcc0[_0xa810('0x34')]:_0x19fb20[_0xa810('0x2f')];if(!_0x152dd5[_0xa810('0x32')][_0xa810('0x36')]('nolimit')){_0x4cbcc0[_0xa810('0x37')]=qs['limit'](_0x152dd5[_0xa810('0x32')]['limit']);_0x4cbcc0[_0xa810('0x1e')]=qs[_0xa810('0x1e')](_0x152dd5[_0xa810('0x32')][_0xa810('0x1e')]);}_0x4cbcc0[_0xa810('0x38')]=qs['sort'](_0x152dd5[_0xa810('0x32')][_0xa810('0x39')]);_0x4cbcc0[_0xa810('0x3a')]=qs[_0xa810('0x3b')](_[_0xa810('0x3c')](_0x152dd5[_0xa810('0x32')],_0x19fb20[_0xa810('0x3b')]),_0xe20156);if(_0x152dd5[_0xa810('0x32')][_0xa810('0x3d')]){_0x4cbcc0['where']=_[_0xa810('0x3e')](_0x4cbcc0['where'],{'$or':_[_0xa810('0x29')](_0xe20156,function(_0x365de4){if(_0x365de4[_0xa810('0x2d')]!==_0xa810('0x3f')){var _0x11d581={};_0x11d581[_0x365de4['name']]={'$like':'%'+_0x152dd5['query'][_0xa810('0x3d')]+'%'};return _0x11d581;}})});}_0x4cbcc0=_[_0xa810('0x3e')]({},_0x4cbcc0,_0x152dd5[_0xa810('0x40')]);var _0x17894f={'where':_0x4cbcc0[_0xa810('0x3a')]};return db['JscriptySessionReport'][_0xa810('0x1d')](_0x17894f)[_0xa810('0x24')](function(_0x1836b0){_0x1ee063['count']=_0x1836b0;if(_0x152dd5[_0xa810('0x32')][_0xa810('0x41')]){_0x4cbcc0[_0xa810('0x42')]=[{'all':!![]}];}return db[_0xa810('0x2a')][_0xa810('0x43')](_0x4cbcc0);})[_0xa810('0x24')](function(_0x1f04b9){_0x1ee063[_0xa810('0x44')]=_0x1f04b9;return _0x1ee063;})[_0xa810('0x24')](respondWithFilteredResult(_0x570c11,_0x4cbcc0))['catch'](handleError(_0x570c11,null));};exports[_0xa810('0x45')]=function(_0x3f5d6d,_0x51d447){var _0x1611b0={'raw':!![],'where':{'id':_0x3f5d6d[_0xa810('0x46')]['id']}},_0x509039={};_0x509039[_0xa810('0x2f')]=_[_0xa810('0x30')](db[_0xa810('0x2a')][_0xa810('0x2b')]);_0x509039[_0xa810('0x32')]=_[_0xa810('0x30')](_0x3f5d6d[_0xa810('0x32')]);_0x509039['filters']=_[_0xa810('0x31')](_0x509039['model'],_0x509039[_0xa810('0x32')]);_0x1611b0[_0xa810('0x34')]=_[_0xa810('0x31')](_0x509039[_0xa810('0x2f')],qs[_0xa810('0x33')](_0x3f5d6d[_0xa810('0x32')][_0xa810('0x33')]));_0x1611b0[_0xa810('0x34')]=_0x1611b0[_0xa810('0x34')][_0xa810('0x35')]?_0x1611b0['attributes']:_0x509039[_0xa810('0x2f')];if(_0x3f5d6d[_0xa810('0x32')][_0xa810('0x41')]){_0x1611b0['include']=[{'all':!![]}];}_0x1611b0=_[_0xa810('0x3e')]({},_0x1611b0,_0x3f5d6d[_0xa810('0x40')]);return db[_0xa810('0x2a')][_0xa810('0x47')](_0x1611b0)['then'](handleEntityNotFound(_0x51d447,null))[_0xa810('0x24')](respondWithResult(_0x51d447,null))[_0xa810('0x48')](handleError(_0x51d447,null));};exports[_0xa810('0x49')]=function(_0x54ae86,_0x18818c){return db[_0xa810('0x2a')]['create'](_0x54ae86[_0xa810('0x4a')],{})[_0xa810('0x24')](respondWithResult(_0x18818c,0xc9))[_0xa810('0x48')](handleError(_0x18818c,null));};exports[_0xa810('0x22')]=function(_0x5a6daf,_0x5eb62c){if(_0x5a6daf[_0xa810('0x4a')]['id']){delete _0x5a6daf[_0xa810('0x4a')]['id'];}return db[_0xa810('0x2a')][_0xa810('0x47')]({'where':{'id':_0x5a6daf['params']['id']}})[_0xa810('0x24')](handleEntityNotFound(_0x5eb62c,null))[_0xa810('0x24')](saveUpdates(_0x5a6daf['body'],null))[_0xa810('0x24')](respondWithResult(_0x5eb62c,null))[_0xa810('0x48')](handleError(_0x5eb62c,null));};exports[_0xa810('0x23')]=function(_0x214c00,_0x33709f){return db[_0xa810('0x2a')][_0xa810('0x47')]({'where':{'id':_0x214c00[_0xa810('0x46')]['id']}})['then'](handleEntityNotFound(_0x33709f,null))[_0xa810('0x24')](removeEntity(_0x33709f,null))['catch'](handleError(_0x33709f,null));};exports[_0xa810('0x4b')]=function(_0x551e85,_0xacf231){return db[_0xa810('0x2a')][_0xa810('0x4b')]()[_0xa810('0x24')](respondWithResult(_0xacf231,null))[_0xa810('0x48')](handleError(_0xacf231,null));};exports[_0xa810('0x4c')]=function(_0x45b64b,_0xe7cb,_0x1ac9ca){var _0x58035a={'raw':!![],'where':{}};var _0x1881aa={};var _0x52922b={'count':0x0,'rows':[]};return db[_0xa810('0x2a')]['findOne']({'where':{'id':_0x45b64b['params']['id']}})[_0xa810('0x24')](handleEntityNotFound(_0xe7cb,null))[_0xa810('0x24')](function(_0x2c39ee){if(_0x2c39ee){_0x1881aa[_0xa810('0x2f')]=_[_0xa810('0x30')](db[_0xa810('0x4d')][_0xa810('0x2b')]);_0x1881aa[_0xa810('0x32')]=_['keys'](_0x45b64b['query']);_0x1881aa[_0xa810('0x3b')]=_['intersection'](_0x1881aa[_0xa810('0x2f')],_0x1881aa[_0xa810('0x32')]);_0x58035a[_0xa810('0x34')]=_[_0xa810('0x31')](_0x1881aa[_0xa810('0x2f')],qs[_0xa810('0x33')](_0x45b64b['query'][_0xa810('0x33')]));_0x58035a[_0xa810('0x34')]=_0x58035a[_0xa810('0x34')][_0xa810('0x35')]?_0x58035a[_0xa810('0x34')]:_0x1881aa[_0xa810('0x2f')];if(!_0x45b64b[_0xa810('0x32')][_0xa810('0x36')]('nolimit')){_0x58035a[_0xa810('0x37')]=qs[_0xa810('0x37')](_0x45b64b[_0xa810('0x32')]['limit']);_0x58035a[_0xa810('0x1e')]=qs[_0xa810('0x1e')](_0x45b64b[_0xa810('0x32')][_0xa810('0x1e')]);}_0x58035a[_0xa810('0x38')]=qs[_0xa810('0x39')](_0x45b64b[_0xa810('0x32')][_0xa810('0x39')]);_0x58035a[_0xa810('0x3a')]=qs[_0xa810('0x3b')](_['pick'](_0x45b64b[_0xa810('0x32')],_0x1881aa[_0xa810('0x3b')]));_0x58035a[_0xa810('0x3a')][_0xa810('0x4e')]=_0x2c39ee['id'];if(_0x45b64b[_0xa810('0x32')][_0xa810('0x3d')]){_0x58035a[_0xa810('0x3a')]=_[_0xa810('0x3e')](_0x58035a[_0xa810('0x3a')],{'$or':_['map'](_0x58035a[_0xa810('0x34')],function(_0x580b85){var _0x39b15f={};_0x39b15f[_0x580b85]={'$like':'%'+_0x45b64b[_0xa810('0x32')]['filter']+'%'};return _0x39b15f;})});}_0x58035a=_[_0xa810('0x3e')]({},_0x58035a,_0x45b64b[_0xa810('0x40')]);return db['JscriptyQuestionReport'][_0xa810('0x1d')]({'where':_0x58035a[_0xa810('0x3a')]})[_0xa810('0x24')](function(_0x3961c6){_0x52922b[_0xa810('0x1d')]=_0x3961c6;if(_0x45b64b[_0xa810('0x32')][_0xa810('0x41')]){_0x58035a[_0xa810('0x42')]=[{'all':!![]}];}return db[_0xa810('0x4d')][_0xa810('0x43')](_0x58035a);})[_0xa810('0x24')](function(_0x4f7e26){_0x52922b[_0xa810('0x44')]=_0x4f7e26;return _0x52922b;});}})[_0xa810('0x24')](respondWithFilteredResult(_0xe7cb,_0x58035a))[_0xa810('0x48')](handleError(_0xe7cb,null));}; \ No newline at end of file +var _0xcefc=['error','stack','name','send','map','JscriptySessionReport','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','order','sort','where','merge','VIRTUAL','filter','includeAll','include','findAll','params','options','body','catch','find','describe','getQuestions','findOne','JscriptyQuestionReport','nolimit','pick','rows','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','sox','to-csv','ejs','lodash','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','sendStatus','status','end','count','offset','limit','set','Content-Range','reject','save','update','then','destroy'];(function(_0x46421d,_0x174e32){var _0xf1c684=function(_0x831b88){while(--_0x831b88){_0x46421d['push'](_0x46421d['shift']());}};_0xf1c684(++_0x174e32);}(_0xcefc,0xc0));var _0xccef=function(_0x5eb7c2,_0x5402fa){_0x5eb7c2=_0x5eb7c2-0x0;var _0x21467a=_0xcefc[_0x5eb7c2];return _0x21467a;};'use strict';var pdf=require(_0xccef('0x0'));var emlformat=require(_0xccef('0x1'));var rimraf=require(_0xccef('0x2'));var zipdir=require(_0xccef('0x3'));var jsonpatch=require(_0xccef('0x4'));var rp=require('request-promise');var moment=require(_0xccef('0x5'));var BPromise=require(_0xccef('0x6'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0xccef('0x7'));var csv=require(_0xccef('0x8'));var ejs=require(_0xccef('0x9'));var fs=require('fs');var _=require(_0xccef('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xccef('0xb'));var deskjs=require(_0xccef('0xc'));var toCsv=require(_0xccef('0x8'));var querystring=require(_0xccef('0xd'));var Papa=require(_0xccef('0xe'));var Redis=require(_0xccef('0xf'));var authService=require(_0xccef('0x10'));var qs=require(_0xccef('0x11'));var as=require(_0xccef('0x12'));var hardwareService=require(_0xccef('0x13'));var logger=require(_0xccef('0x14'))(_0xccef('0x15'));var utils=require('../../config/utils');var config=require(_0xccef('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3ef8ad,_0x33f990){_0x33f990=_0x33f990||0xcc;return function(_0x279f33){if(_0x279f33){return _0x3ef8ad[_0xccef('0x17')](_0x33f990);}return _0x3ef8ad[_0xccef('0x18')](_0x33f990)[_0xccef('0x19')]();};}function respondWithResult(_0x3d4815,_0x75639d){_0x75639d=_0x75639d||0xc8;return function(_0xda23ea){if(_0xda23ea){return _0x3d4815[_0xccef('0x18')](_0x75639d)['json'](_0xda23ea);}};}function respondWithFilteredResult(_0x36209d,_0x2f32df){return function(_0x4cd9dd){if(_0x4cd9dd){var _0x57b164=_0x4cd9dd[_0xccef('0x1a')],_0xe3d2fb=_0x2f32df[_0xccef('0x1b')],_0x239c0b=_0x2f32df[_0xccef('0x1b')]+_0x2f32df[_0xccef('0x1c')],_0x490bff;if(_0x239c0b>=_0x57b164){_0x239c0b=_0x57b164;_0x490bff=0xc8;}else{_0x490bff=0xce;}_0x36209d[_0xccef('0x18')](_0x490bff);return _0x36209d[_0xccef('0x1d')](_0xccef('0x1e'),_0xe3d2fb+'-'+_0x239c0b+'/'+_0x57b164)['json'](_0x4cd9dd);}return null;};}function patchUpdates(_0x207b12){return function(_0x581051){try{jsonpatch['apply'](_0x581051,_0x207b12,!![]);}catch(_0x2bd099){return BPromise[_0xccef('0x1f')](_0x2bd099);}return _0x581051[_0xccef('0x20')]();};}function saveUpdates(_0x2bced8,_0x2c19fd){return function(_0x4d786d){if(_0x4d786d){return _0x4d786d[_0xccef('0x21')](_0x2bced8)[_0xccef('0x22')](function(_0x453f6a){return _0x453f6a;});}return null;};}function removeEntity(_0x490035,_0x5145be){return function(_0x1d84a8){if(_0x1d84a8){return _0x1d84a8[_0xccef('0x23')]()[_0xccef('0x22')](function(){_0x490035[_0xccef('0x18')](0xcc)[_0xccef('0x19')]();});}};}function handleEntityNotFound(_0x4cd58c,_0x31d057){return function(_0x2c98ce){if(!_0x2c98ce){_0x4cd58c[_0xccef('0x17')](0x194);}return _0x2c98ce;};}function handleError(_0x1a6cec,_0x3cb266){_0x3cb266=_0x3cb266||0x1f4;return function(_0x3552d6){logger[_0xccef('0x24')](_0x3552d6[_0xccef('0x25')]);if(_0x3552d6[_0xccef('0x26')]){delete _0x3552d6[_0xccef('0x26')];}_0x1a6cec[_0xccef('0x18')](_0x3cb266)[_0xccef('0x27')](_0x3552d6);};}exports['index']=function(_0x1d4d98,_0x231d13){var _0x4091ac={},_0x38181a={},_0x47098e={'count':0x0,'rows':[]};var _0x54011d=_[_0xccef('0x28')](db[_0xccef('0x29')][_0xccef('0x2a')],function(_0x19cc38){return{'name':_0x19cc38[_0xccef('0x2b')],'type':_0x19cc38[_0xccef('0x2c')][_0xccef('0x2d')]};});_0x38181a[_0xccef('0x2e')]=_[_0xccef('0x28')](_0x54011d,_0xccef('0x26'));_0x38181a['query']=_[_0xccef('0x2f')](_0x1d4d98[_0xccef('0x30')]);_0x38181a[_0xccef('0x31')]=_[_0xccef('0x32')](_0x38181a[_0xccef('0x2e')],_0x38181a['query']);_0x4091ac['attributes']=_[_0xccef('0x32')](_0x38181a[_0xccef('0x2e')],qs[_0xccef('0x33')](_0x1d4d98[_0xccef('0x30')]['fields']));_0x4091ac[_0xccef('0x34')]=_0x4091ac['attributes'][_0xccef('0x35')]?_0x4091ac[_0xccef('0x34')]:_0x38181a[_0xccef('0x2e')];if(!_0x1d4d98[_0xccef('0x30')][_0xccef('0x36')]('nolimit')){_0x4091ac['limit']=qs[_0xccef('0x1c')](_0x1d4d98['query'][_0xccef('0x1c')]);_0x4091ac['offset']=qs[_0xccef('0x1b')](_0x1d4d98[_0xccef('0x30')][_0xccef('0x1b')]);}_0x4091ac[_0xccef('0x37')]=qs[_0xccef('0x38')](_0x1d4d98['query'][_0xccef('0x38')]);_0x4091ac[_0xccef('0x39')]=qs[_0xccef('0x31')](_['pick'](_0x1d4d98['query'],_0x38181a[_0xccef('0x31')]),_0x54011d);if(_0x1d4d98[_0xccef('0x30')]['filter']){_0x4091ac[_0xccef('0x39')]=_[_0xccef('0x3a')](_0x4091ac[_0xccef('0x39')],{'$or':_[_0xccef('0x28')](_0x54011d,function(_0x34a7ae){if(_0x34a7ae['type']!==_0xccef('0x3b')){var _0x38cfa2={};_0x38cfa2[_0x34a7ae[_0xccef('0x26')]]={'$like':'%'+_0x1d4d98['query'][_0xccef('0x3c')]+'%'};return _0x38cfa2;}})});}_0x4091ac=_[_0xccef('0x3a')]({},_0x4091ac,_0x1d4d98['options']);var _0x1074f8={'where':_0x4091ac[_0xccef('0x39')]};return db['JscriptySessionReport'][_0xccef('0x1a')](_0x1074f8)[_0xccef('0x22')](function(_0x22482f){_0x47098e[_0xccef('0x1a')]=_0x22482f;if(_0x1d4d98[_0xccef('0x30')][_0xccef('0x3d')]){_0x4091ac[_0xccef('0x3e')]=[{'all':!![]}];}return db['JscriptySessionReport'][_0xccef('0x3f')](_0x4091ac);})[_0xccef('0x22')](function(_0x4de0f0){_0x47098e['rows']=_0x4de0f0;return _0x47098e;})['then'](respondWithFilteredResult(_0x231d13,_0x4091ac))['catch'](handleError(_0x231d13,null));};exports['show']=function(_0x28d66f,_0x2152cc){var _0x6e7a71={'raw':!![],'where':{'id':_0x28d66f[_0xccef('0x40')]['id']}},_0x3062ac={};_0x3062ac[_0xccef('0x2e')]=_['keys'](db[_0xccef('0x29')][_0xccef('0x2a')]);_0x3062ac[_0xccef('0x30')]=_[_0xccef('0x2f')](_0x28d66f[_0xccef('0x30')]);_0x3062ac[_0xccef('0x31')]=_['intersection'](_0x3062ac[_0xccef('0x2e')],_0x3062ac['query']);_0x6e7a71['attributes']=_[_0xccef('0x32')](_0x3062ac[_0xccef('0x2e')],qs[_0xccef('0x33')](_0x28d66f[_0xccef('0x30')][_0xccef('0x33')]));_0x6e7a71[_0xccef('0x34')]=_0x6e7a71['attributes'][_0xccef('0x35')]?_0x6e7a71['attributes']:_0x3062ac['model'];if(_0x28d66f['query'][_0xccef('0x3d')]){_0x6e7a71[_0xccef('0x3e')]=[{'all':!![]}];}_0x6e7a71=_[_0xccef('0x3a')]({},_0x6e7a71,_0x28d66f[_0xccef('0x41')]);return db['JscriptySessionReport']['find'](_0x6e7a71)['then'](handleEntityNotFound(_0x2152cc,null))['then'](respondWithResult(_0x2152cc,null))['catch'](handleError(_0x2152cc,null));};exports['create']=function(_0x103106,_0x1161f3){return db['JscriptySessionReport']['create'](_0x103106[_0xccef('0x42')],{})[_0xccef('0x22')](respondWithResult(_0x1161f3,0xc9))[_0xccef('0x43')](handleError(_0x1161f3,null));};exports[_0xccef('0x21')]=function(_0x139f7b,_0x3341c7){if(_0x139f7b[_0xccef('0x42')]['id']){delete _0x139f7b['body']['id'];}return db[_0xccef('0x29')][_0xccef('0x44')]({'where':{'id':_0x139f7b[_0xccef('0x40')]['id']}})['then'](handleEntityNotFound(_0x3341c7,null))[_0xccef('0x22')](saveUpdates(_0x139f7b[_0xccef('0x42')],null))['then'](respondWithResult(_0x3341c7,null))[_0xccef('0x43')](handleError(_0x3341c7,null));};exports[_0xccef('0x23')]=function(_0x391fcc,_0x4daa46){return db[_0xccef('0x29')]['find']({'where':{'id':_0x391fcc['params']['id']}})[_0xccef('0x22')](handleEntityNotFound(_0x4daa46,null))[_0xccef('0x22')](removeEntity(_0x4daa46,null))[_0xccef('0x43')](handleError(_0x4daa46,null));};exports[_0xccef('0x45')]=function(_0x31eb4c,_0x272318){return db['JscriptySessionReport'][_0xccef('0x45')]()[_0xccef('0x22')](respondWithResult(_0x272318,null))[_0xccef('0x43')](handleError(_0x272318,null));};exports[_0xccef('0x46')]=function(_0x1d7d29,_0x27b0c9,_0x2e2443){var _0x4ac652={'raw':!![],'where':{}};var _0x215808={};var _0x5df07a={'count':0x0,'rows':[]};return db['JscriptySessionReport'][_0xccef('0x47')]({'where':{'id':_0x1d7d29[_0xccef('0x40')]['id']}})[_0xccef('0x22')](handleEntityNotFound(_0x27b0c9,null))['then'](function(_0x4885ea){if(_0x4885ea){_0x215808[_0xccef('0x2e')]=_[_0xccef('0x2f')](db[_0xccef('0x48')][_0xccef('0x2a')]);_0x215808['query']=_[_0xccef('0x2f')](_0x1d7d29['query']);_0x215808['filters']=_[_0xccef('0x32')](_0x215808[_0xccef('0x2e')],_0x215808[_0xccef('0x30')]);_0x4ac652['attributes']=_['intersection'](_0x215808[_0xccef('0x2e')],qs['fields'](_0x1d7d29[_0xccef('0x30')][_0xccef('0x33')]));_0x4ac652[_0xccef('0x34')]=_0x4ac652[_0xccef('0x34')]['length']?_0x4ac652[_0xccef('0x34')]:_0x215808[_0xccef('0x2e')];if(!_0x1d7d29['query'][_0xccef('0x36')](_0xccef('0x49'))){_0x4ac652[_0xccef('0x1c')]=qs[_0xccef('0x1c')](_0x1d7d29[_0xccef('0x30')][_0xccef('0x1c')]);_0x4ac652[_0xccef('0x1b')]=qs[_0xccef('0x1b')](_0x1d7d29[_0xccef('0x30')]['offset']);}_0x4ac652[_0xccef('0x37')]=qs[_0xccef('0x38')](_0x1d7d29['query'][_0xccef('0x38')]);_0x4ac652['where']=qs[_0xccef('0x31')](_[_0xccef('0x4a')](_0x1d7d29['query'],_0x215808[_0xccef('0x31')]));_0x4ac652[_0xccef('0x39')]['SessionId']=_0x4885ea['id'];if(_0x1d7d29[_0xccef('0x30')]['filter']){_0x4ac652[_0xccef('0x39')]=_[_0xccef('0x3a')](_0x4ac652[_0xccef('0x39')],{'$or':_[_0xccef('0x28')](_0x4ac652[_0xccef('0x34')],function(_0x44533e){var _0x87f475={};_0x87f475[_0x44533e]={'$like':'%'+_0x1d7d29[_0xccef('0x30')][_0xccef('0x3c')]+'%'};return _0x87f475;})});}_0x4ac652=_[_0xccef('0x3a')]({},_0x4ac652,_0x1d7d29[_0xccef('0x41')]);return db[_0xccef('0x48')]['count']({'where':_0x4ac652['where']})[_0xccef('0x22')](function(_0x2169c9){_0x5df07a[_0xccef('0x1a')]=_0x2169c9;if(_0x1d7d29[_0xccef('0x30')][_0xccef('0x3d')]){_0x4ac652[_0xccef('0x3e')]=[{'all':!![]}];}return db['JscriptyQuestionReport'][_0xccef('0x3f')](_0x4ac652);})[_0xccef('0x22')](function(_0x35e454){_0x5df07a[_0xccef('0x4b')]=_0x35e454;return _0x5df07a;});}})[_0xccef('0x22')](respondWithFilteredResult(_0x27b0c9,_0x4ac652))[_0xccef('0x43')](handleError(_0x27b0c9,null));}; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.model.js b/server/api/jscriptySessionReport/jscriptySessionReport.model.js index 6d3b919..88e26b0 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 _0xf61e=['bluebird','request-promise','path','rimraf','../../config/environment','./jscriptySessionReport.attributes','exports','define','report_jscripty_sessions','lodash','util','../../config/logger','api','moment'];(function(_0xfc8838,_0x121ac2){var _0xb02824=function(_0x375527){while(--_0x375527){_0xfc8838['push'](_0xfc8838['shift']());}};_0xb02824(++_0x121ac2);}(_0xf61e,0x191));var _0xef61=function(_0x594786,_0x4866f2){_0x594786=_0x594786-0x0;var _0x5833ca=_0xf61e[_0x594786];return _0x5833ca;};'use strict';var _=require(_0xef61('0x0'));var util=require(_0xef61('0x1'));var logger=require(_0xef61('0x2'))(_0xef61('0x3'));var moment=require(_0xef61('0x4'));var BPromise=require(_0xef61('0x5'));var rp=require(_0xef61('0x6'));var fs=require('fs');var path=require(_0xef61('0x7'));var rimraf=require(_0xef61('0x8'));var config=require(_0xef61('0x9'));var attributes=require(_0xef61('0xa'));module[_0xef61('0xb')]=function(_0x5b00b2,_0x9e17f4){return _0x5b00b2[_0xef61('0xc')]('JscriptySessionReport',attributes,{'tableName':_0xef61('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc9c3=['path','rimraf','../../config/environment','./jscriptySessionReport.attributes','define','JscriptySessionReport','report_jscripty_sessions','../../config/logger','moment','bluebird','request-promise'];(function(_0x54de5d,_0x1f8b26){var _0x1b349e=function(_0xe199cc){while(--_0xe199cc){_0x54de5d['push'](_0x54de5d['shift']());}};_0x1b349e(++_0x1f8b26);}(_0xc9c3,0x96));var _0x3c9c=function(_0x297771,_0x383ac3){_0x297771=_0x297771-0x0;var _0x5ea1f4=_0xc9c3[_0x297771];return _0x5ea1f4;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x3c9c('0x0'))('api');var moment=require(_0x3c9c('0x1'));var BPromise=require(_0x3c9c('0x2'));var rp=require(_0x3c9c('0x3'));var fs=require('fs');var path=require(_0x3c9c('0x4'));var rimraf=require(_0x3c9c('0x5'));var config=require(_0x3c9c('0x6'));var attributes=require(_0x3c9c('0x7'));module['exports']=function(_0x48b219,_0x5c86bd){return _0x48b219[_0x3c9c('0x8')](_0x3c9c('0x9'),attributes,{'tableName':_0x3c9c('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.rpc.js b/server/api/jscriptySessionReport/jscriptySessionReport.rpc.js index d17cf8e..2b4b53d 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 _0x81c1=['moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','request','info','request\x20sent','debug','JscriptySessionReport,\x20%s,\x20%s,\x20%s','stringify','error','code','JscriptySessionReport,\x20%s,\x20%s','message','result','catch','lodash','util'];(function(_0x3ae84a,_0x44bb5a){var _0x3fab58=function(_0x2e9208){while(--_0x2e9208){_0x3ae84a['push'](_0x3ae84a['shift']());}};_0x3fab58(++_0x44bb5a);}(_0x81c1,0x129));var _0x181c=function(_0x16767e,_0x44a9e4){_0x16767e=_0x16767e-0x0;var _0x38ab9d=_0x81c1[_0x16767e];return _0x38ab9d;};'use strict';var _=require(_0x181c('0x0'));var util=require(_0x181c('0x1'));var moment=require(_0x181c('0x2'));var BPromise=require(_0x181c('0x3'));var rs=require(_0x181c('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x181c('0x5'))['db'];var utils=require(_0x181c('0x6'));var logger=require('../../config/logger')(_0x181c('0x7'));var config=require('../../config/environment');var jayson=require(_0x181c('0x8'));var client=jayson[_0x181c('0x9')][_0x181c('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x459580,_0x3dfa55,_0x540609){return new BPromise(function(_0x461e06,_0x2f4fd7){return client[_0x181c('0xb')](_0x459580,_0x540609)['then'](function(_0x15d8cf){logger[_0x181c('0xc')]('JscriptySessionReport,\x20%s,\x20%s',_0x3dfa55,_0x181c('0xd'));logger[_0x181c('0xe')](_0x181c('0xf'),_0x3dfa55,_0x181c('0xd'),JSON[_0x181c('0x10')](_0x15d8cf));if(_0x15d8cf[_0x181c('0x11')]){if(_0x15d8cf[_0x181c('0x11')][_0x181c('0x12')]===0x1f4){logger[_0x181c('0x11')](_0x181c('0x13'),_0x3dfa55,_0x15d8cf['error'][_0x181c('0x14')]);return _0x2f4fd7(_0x15d8cf['error'][_0x181c('0x14')]);}logger['error'](_0x181c('0x13'),_0x3dfa55,_0x15d8cf[_0x181c('0x11')][_0x181c('0x14')]);return _0x461e06(_0x15d8cf['error'][_0x181c('0x14')]);}else{logger[_0x181c('0xc')](_0x181c('0x13'),_0x3dfa55,_0x181c('0xd'));_0x461e06(_0x15d8cf[_0x181c('0x15')][_0x181c('0x14')]);}})[_0x181c('0x16')](function(_0x7c9975){logger[_0x181c('0x11')]('JscriptySessionReport,\x20%s,\x20%s',_0x3dfa55,_0x7c9975);_0x2f4fd7(_0x7c9975);});});} \ No newline at end of file +var _0x22c4=['lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','../../config/environment','request','then','info','JscriptySessionReport,\x20%s,\x20%s','debug','JscriptySessionReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch'];(function(_0x18f2c2,_0x435947){var _0xdabd28=function(_0x43d194){while(--_0x43d194){_0x18f2c2['push'](_0x18f2c2['shift']());}};_0xdabd28(++_0x435947);}(_0x22c4,0x1b8));var _0x422c=function(_0x1162f9,_0x35f87c){_0x1162f9=_0x1162f9-0x0;var _0x75257c=_0x22c4[_0x1162f9];return _0x75257c;};'use strict';var _=require(_0x422c('0x0'));var util=require(_0x422c('0x1'));var moment=require(_0x422c('0x2'));var BPromise=require(_0x422c('0x3'));var rs=require(_0x422c('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x422c('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x422c('0x6'))('rpc');var config=require(_0x422c('0x7'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x7659f1,_0x79cbb2,_0x2bb16f){return new BPromise(function(_0x17db21,_0x51e1df){return client[_0x422c('0x8')](_0x7659f1,_0x2bb16f)[_0x422c('0x9')](function(_0x437349){logger[_0x422c('0xa')](_0x422c('0xb'),_0x79cbb2,'request\x20sent');logger[_0x422c('0xc')](_0x422c('0xd'),_0x79cbb2,_0x422c('0xe'),JSON[_0x422c('0xf')](_0x437349));if(_0x437349[_0x422c('0x10')]){if(_0x437349[_0x422c('0x10')]['code']===0x1f4){logger[_0x422c('0x10')](_0x422c('0xb'),_0x79cbb2,_0x437349[_0x422c('0x10')][_0x422c('0x11')]);return _0x51e1df(_0x437349['error']['message']);}logger[_0x422c('0x10')](_0x422c('0xb'),_0x79cbb2,_0x437349[_0x422c('0x10')][_0x422c('0x11')]);return _0x17db21(_0x437349[_0x422c('0x10')][_0x422c('0x11')]);}else{logger[_0x422c('0xa')](_0x422c('0xb'),_0x79cbb2,_0x422c('0xe'));_0x17db21(_0x437349[_0x422c('0x12')][_0x422c('0x11')]);}})[_0x422c('0x13')](function(_0x542882){logger[_0x422c('0x10')](_0x422c('0xb'),_0x79cbb2,_0x542882);_0x51e1df(_0x542882);});});} \ No newline at end of file diff --git a/server/api/license/index.js b/server/api/license/index.js index b2176aa..b43ce8e 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 _0x556f=['../../components/interaction/service','../../config/environment','./license.controller','get','put','/:id','isAuthenticated','exports','multer','util','path','express'];(function(_0x399d0c,_0x3d4ce){var _0x1a5462=function(_0x2a5f24){while(--_0x2a5f24){_0x399d0c['push'](_0x399d0c['shift']());}};_0x1a5462(++_0x3d4ce);}(_0x556f,0x68));var _0xf556=function(_0x1a60d6,_0x35134b){_0x1a60d6=_0x1a60d6-0x0;var _0x215786=_0x556f[_0x1a60d6];return _0x215786;};'use strict';var multer=require(_0xf556('0x0'));var util=require(_0xf556('0x1'));var path=require(_0xf556('0x2'));var timeout=require('connect-timeout');var express=require(_0xf556('0x3'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0xf556('0x4'));var config=require(_0xf556('0x5'));var controller=require(_0xf556('0x6'));router[_0xf556('0x7')]('/',controller['index']);router[_0xf556('0x8')](_0xf556('0x9'),auth[_0xf556('0xa')](),controller['update']);module[_0xf556('0xb')]=router; \ No newline at end of file +var _0xc0ba=['/:id','isAuthenticated','update','exports','util','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./license.controller','index','put'];(function(_0x342baa,_0x4a110f){var _0x1208f3=function(_0x56a645){while(--_0x56a645){_0x342baa['push'](_0x342baa['shift']());}};_0x1208f3(++_0x4a110f);}(_0xc0ba,0x6c));var _0xac0b=function(_0x27ab58,_0x48c638){_0x27ab58=_0x27ab58-0x0;var _0x3daff0=_0xc0ba[_0x27ab58];return _0x3daff0;};'use strict';var multer=require('multer');var util=require(_0xac0b('0x0'));var path=require('path');var timeout=require(_0xac0b('0x1'));var express=require(_0xac0b('0x2'));var router=express[_0xac0b('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0xac0b('0x4'));var config=require(_0xac0b('0x5'));var controller=require(_0xac0b('0x6'));router['get']('/',controller[_0xac0b('0x7')]);router[_0xac0b('0x8')](_0xac0b('0x9'),auth[_0xac0b('0xa')](),controller[_0xac0b('0xb')]);module[_0xac0b('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 47999f1..3cb67b0 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 _0x46ed=['sequelize','exports','STRING','INTEGER'];(function(_0x2a238a,_0x1d5054){var _0xeef802=function(_0x583637){while(--_0x583637){_0x2a238a['push'](_0x2a238a['shift']());}};_0xeef802(++_0x1d5054);}(_0x46ed,0x168));var _0xd46e=function(_0x29d94e,_0xf386d6){_0x29d94e=_0x29d94e-0x0;var _0x106237=_0x46ed[_0x29d94e];return _0x106237;};'use strict';var Sequelize=require(_0xd46e('0x0'));module[_0xd46e('0x1')]={'license':{'type':Sequelize['TEXT']},'data1':{'type':Sequelize[_0xd46e('0x2')]},'data2':{'type':Sequelize[_0xd46e('0x2')]},'chatLicenseExceeded':{'type':Sequelize[_0xd46e('0x3')],'defaultValue':0x0}}; \ No newline at end of file +var _0x4819=['INTEGER','exports','TEXT','STRING'];(function(_0x424d86,_0x3d932e){var _0x25f529=function(_0x308e45){while(--_0x308e45){_0x424d86['push'](_0x424d86['shift']());}};_0x25f529(++_0x3d932e);}(_0x4819,0xcd));var _0x9481=function(_0x1c1913,_0x1d1b59){_0x1c1913=_0x1c1913-0x0;var _0x3b352a=_0x4819[_0x1c1913];return _0x3b352a;};'use strict';var Sequelize=require('sequelize');module[_0x9481('0x0')]={'license':{'type':Sequelize[_0x9481('0x1')]},'data1':{'type':Sequelize[_0x9481('0x2')]},'data2':{'type':Sequelize[_0x9481('0x2')]},'chatLicenseExceeded':{'type':Sequelize[_0x9481('0x3')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/license/license.controller.js b/server/api/license/license.controller.js index 51a91c6..9cea694 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 _0xe738=['papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','then','stack','name','send','index','model','rawAttributes','filters','attributes','intersection','fields','query','merge','options','getLicense','catch','update','body','License','find','get','checkLicense','key','demo','rimraf','zip-dir','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring'];(function(_0x42245d,_0x51758f){var _0x4b211a=function(_0x2634e){while(--_0x2634e){_0x42245d['push'](_0x42245d['shift']());}};_0x4b211a(++_0x51758f);}(_0xe738,0xa7));var _0x8e73=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0xe738[_0xfae23b];return _0x200640;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0x8e73('0x0'));var zipdir=require(_0x8e73('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x8e73('0x2'));var moment=require(_0x8e73('0x3'));var BPromise=require(_0x8e73('0x4'));var Mustache=require('mustache');var util=require(_0x8e73('0x5'));var path=require(_0x8e73('0x6'));var sox=require(_0x8e73('0x7'));var csv=require(_0x8e73('0x8'));var ejs=require(_0x8e73('0x9'));var fs=require('fs');var _=require(_0x8e73('0xa'));var squel=require(_0x8e73('0xb'));var crypto=require(_0x8e73('0xc'));var jsforce=require(_0x8e73('0xd'));var deskjs=require(_0x8e73('0xe'));var toCsv=require(_0x8e73('0x8'));var querystring=require(_0x8e73('0xf'));var Papa=require(_0x8e73('0x10'));var Redis=require(_0x8e73('0x11'));var authService=require(_0x8e73('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x8e73('0x13'));var hardwareService=require(_0x8e73('0x14'));var logger=require(_0x8e73('0x15'))(_0x8e73('0x16'));var utils=require(_0x8e73('0x17'));var config=require(_0x8e73('0x18'));var db=require(_0x8e73('0x19'))['db'];function respondWithStatusCode(_0x10ac01,_0x1f4770){_0x1f4770=_0x1f4770||0xcc;return function(_0x7b929c){if(_0x7b929c){return _0x10ac01[_0x8e73('0x1a')](_0x1f4770);}return _0x10ac01[_0x8e73('0x1b')](_0x1f4770)[_0x8e73('0x1c')]();};}function respondWithResult(_0x51342d,_0x28618f){_0x28618f=_0x28618f||0xc8;return function(_0x10e4e6){if(_0x10e4e6){return _0x51342d[_0x8e73('0x1b')](_0x28618f)[_0x8e73('0x1d')](_0x10e4e6);}};}function respondWithFilteredResult(_0x5b373e,_0x4a29d0){return function(_0x9a2b69){if(_0x9a2b69){var _0x4a2953=_0x9a2b69[_0x8e73('0x1e')],_0x53b208=_0x4a29d0[_0x8e73('0x1f')],_0x1a80cc=_0x4a29d0[_0x8e73('0x1f')]+_0x4a29d0[_0x8e73('0x20')],_0x20f1fa;if(_0x1a80cc>=_0x4a2953){_0x1a80cc=_0x4a2953;_0x20f1fa=0xc8;}else{_0x20f1fa=0xce;}_0x5b373e['status'](_0x20f1fa);return _0x5b373e[_0x8e73('0x21')](_0x8e73('0x22'),_0x53b208+'-'+_0x1a80cc+'/'+_0x4a2953)[_0x8e73('0x1d')](_0x9a2b69);}return null;};}function patchUpdates(_0x25dd15){return function(_0x2649a9){try{jsonpatch[_0x8e73('0x23')](_0x2649a9,_0x25dd15,!![]);}catch(_0x6c6a08){return BPromise[_0x8e73('0x24')](_0x6c6a08);}return _0x2649a9['save']();};}function saveUpdates(_0x1df420,_0x4452){return function(_0xc414e6){if(_0xc414e6){return _0xc414e6['update'](_0x1df420)[_0x8e73('0x25')](function(_0xda5c11){return _0xda5c11;});}return null;};}function removeEntity(_0x46d152,_0x12d9df){return function(_0x45cf2a){if(_0x45cf2a){return _0x45cf2a['destroy']()[_0x8e73('0x25')](function(){_0x46d152[_0x8e73('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1a0424,_0x24024c){return function(_0x312757){if(!_0x312757){_0x1a0424[_0x8e73('0x1a')](0x194);}return _0x312757;};}function handleError(_0x18d2c2,_0x43a891){_0x43a891=_0x43a891||0x1f4;return function(_0x21f3ad){logger['error'](_0x21f3ad[_0x8e73('0x26')]);if(_0x21f3ad[_0x8e73('0x27')]){delete _0x21f3ad[_0x8e73('0x27')];}_0x18d2c2['status'](_0x43a891)[_0x8e73('0x28')](_0x21f3ad);};}var utilLicense=require('../../config/license/util');exports[_0x8e73('0x29')]=function(_0x21e007,_0x3de51d){var _0x5c02f7={'raw':!![],'where':{'id':0x1}},_0x54fde2={};_0x54fde2[_0x8e73('0x2a')]=_['keys'](db['License'][_0x8e73('0x2b')]);_0x54fde2['query']=_['keys'](_0x21e007['query']);_0x54fde2[_0x8e73('0x2c')]=_['intersection'](_0x54fde2[_0x8e73('0x2a')],_0x54fde2['query']);_0x5c02f7[_0x8e73('0x2d')]=_[_0x8e73('0x2e')](_0x54fde2[_0x8e73('0x2a')],qs[_0x8e73('0x2f')](_0x21e007[_0x8e73('0x30')][_0x8e73('0x2f')]));_0x5c02f7[_0x8e73('0x2d')]=_0x5c02f7[_0x8e73('0x2d')]['length']?_0x5c02f7['attributes']:_0x54fde2[_0x8e73('0x2a')];_0x5c02f7=_[_0x8e73('0x31')]({},_0x5c02f7,_0x21e007[_0x8e73('0x32')]);return utilLicense[_0x8e73('0x33')](_0x5c02f7)['then'](respondWithResult(_0x3de51d,null))[_0x8e73('0x34')](handleError(_0x3de51d,null));};exports[_0x8e73('0x35')]=function(_0x43e1f5,_0x56692f){if(_0x43e1f5[_0x8e73('0x36')]['id']){delete _0x43e1f5[_0x8e73('0x36')]['id'];}return db[_0x8e73('0x37')][_0x8e73('0x38')]({'where':{'id':_0x43e1f5['params']['id']}})[_0x8e73('0x25')](handleEntityNotFound(_0x56692f,null))[_0x8e73('0x25')](function(_0x2310fa){var _0x24d80e=_0x2310fa[_0x8e73('0x39')]({'plain':!![]});return utilLicense[_0x8e73('0x3a')](_0x24d80e,_0x43e1f5[_0x8e73('0x36')][_0x8e73('0x3b')]);})['then'](function(_0x487921){if(!_0x487921[_0x8e73('0x3c')]){return saveUpdates(_0x43e1f5[_0x8e73('0x36')],null);}return _0x487921;})[_0x8e73('0x25')](respondWithResult(_0x56692f,null))['catch'](handleError(_0x56692f,null));}; \ No newline at end of file +var _0xa711=['destroy','stack','name','send','../../config/license/util','index','model','keys','rawAttributes','query','filters','intersection','fields','attributes','merge','options','getLicense','catch','body','params','get','checkLicense','key','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','util','sox','to-csv','ejs','squel','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../mysqldb','sendStatus','end','count','offset','status','set','json','apply','reject','save','update','then'];(function(_0x828470,_0x7c21c6){var _0x149f7c=function(_0x5d0497){while(--_0x5d0497){_0x828470['push'](_0x828470['shift']());}};_0x149f7c(++_0x7c21c6);}(_0xa711,0xbf));var _0x1a71=function(_0x2731d3,_0x3ead2b){_0x2731d3=_0x2731d3-0x0;var _0x397f85=_0xa711[_0x2731d3];return _0x397f85;};'use strict';var pdf=require(_0x1a71('0x0'));var emlformat=require(_0x1a71('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x1a71('0x2'));var jsonpatch=require(_0x1a71('0x3'));var rp=require(_0x1a71('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x1a71('0x5'));var path=require('path');var sox=require(_0x1a71('0x6'));var csv=require(_0x1a71('0x7'));var ejs=require(_0x1a71('0x8'));var fs=require('fs');var _=require('lodash');var squel=require(_0x1a71('0x9'));var crypto=require(_0x1a71('0xa'));var jsforce=require(_0x1a71('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x1a71('0x7'));var querystring=require('querystring');var Papa=require(_0x1a71('0xc'));var Redis=require(_0x1a71('0xd'));var authService=require(_0x1a71('0xe'));var qs=require(_0x1a71('0xf'));var as=require(_0x1a71('0x10'));var hardwareService=require(_0x1a71('0x11'));var logger=require(_0x1a71('0x12'))('api');var utils=require('../../config/utils');var config=require(_0x1a71('0x13'));var db=require(_0x1a71('0x14'))['db'];function respondWithStatusCode(_0x456497,_0x2cb088){_0x2cb088=_0x2cb088||0xcc;return function(_0x392120){if(_0x392120){return _0x456497[_0x1a71('0x15')](_0x2cb088);}return _0x456497['status'](_0x2cb088)[_0x1a71('0x16')]();};}function respondWithResult(_0x150dc7,_0x1359b2){_0x1359b2=_0x1359b2||0xc8;return function(_0x13a380){if(_0x13a380){return _0x150dc7['status'](_0x1359b2)['json'](_0x13a380);}};}function respondWithFilteredResult(_0x3e73d2,_0x5b3fde){return function(_0x46b91f){if(_0x46b91f){var _0x3a8b25=_0x46b91f[_0x1a71('0x17')],_0x4971da=_0x5b3fde['offset'],_0x147189=_0x5b3fde[_0x1a71('0x18')]+_0x5b3fde['limit'],_0x4188b3;if(_0x147189>=_0x3a8b25){_0x147189=_0x3a8b25;_0x4188b3=0xc8;}else{_0x4188b3=0xce;}_0x3e73d2[_0x1a71('0x19')](_0x4188b3);return _0x3e73d2[_0x1a71('0x1a')]('Content-Range',_0x4971da+'-'+_0x147189+'/'+_0x3a8b25)[_0x1a71('0x1b')](_0x46b91f);}return null;};}function patchUpdates(_0x52a659){return function(_0x24d2ea){try{jsonpatch[_0x1a71('0x1c')](_0x24d2ea,_0x52a659,!![]);}catch(_0x436da3){return BPromise[_0x1a71('0x1d')](_0x436da3);}return _0x24d2ea[_0x1a71('0x1e')]();};}function saveUpdates(_0x4b8a06,_0x5a1bb9){return function(_0x452115){if(_0x452115){return _0x452115[_0x1a71('0x1f')](_0x4b8a06)[_0x1a71('0x20')](function(_0x4c2129){return _0x4c2129;});}return null;};}function removeEntity(_0x3dae70,_0x1d59e5){return function(_0xd40dd0){if(_0xd40dd0){return _0xd40dd0[_0x1a71('0x21')]()[_0x1a71('0x20')](function(){_0x3dae70[_0x1a71('0x19')](0xcc)[_0x1a71('0x16')]();});}};}function handleEntityNotFound(_0x1e5d55,_0x20060f){return function(_0x170213){if(!_0x170213){_0x1e5d55[_0x1a71('0x15')](0x194);}return _0x170213;};}function handleError(_0x3f1ebf,_0x2fdbee){_0x2fdbee=_0x2fdbee||0x1f4;return function(_0x5bfac3){logger['error'](_0x5bfac3[_0x1a71('0x22')]);if(_0x5bfac3[_0x1a71('0x23')]){delete _0x5bfac3[_0x1a71('0x23')];}_0x3f1ebf['status'](_0x2fdbee)[_0x1a71('0x24')](_0x5bfac3);};}var utilLicense=require(_0x1a71('0x25'));exports[_0x1a71('0x26')]=function(_0xfabbd9,_0x427413){var _0x2551de={'raw':!![],'where':{'id':0x1}},_0x4e84ac={};_0x4e84ac[_0x1a71('0x27')]=_[_0x1a71('0x28')](db['License'][_0x1a71('0x29')]);_0x4e84ac[_0x1a71('0x2a')]=_[_0x1a71('0x28')](_0xfabbd9[_0x1a71('0x2a')]);_0x4e84ac[_0x1a71('0x2b')]=_[_0x1a71('0x2c')](_0x4e84ac[_0x1a71('0x27')],_0x4e84ac['query']);_0x2551de['attributes']=_[_0x1a71('0x2c')](_0x4e84ac[_0x1a71('0x27')],qs[_0x1a71('0x2d')](_0xfabbd9['query'][_0x1a71('0x2d')]));_0x2551de[_0x1a71('0x2e')]=_0x2551de[_0x1a71('0x2e')]['length']?_0x2551de[_0x1a71('0x2e')]:_0x4e84ac['model'];_0x2551de=_[_0x1a71('0x2f')]({},_0x2551de,_0xfabbd9[_0x1a71('0x30')]);return utilLicense[_0x1a71('0x31')](_0x2551de)[_0x1a71('0x20')](respondWithResult(_0x427413,null))[_0x1a71('0x32')](handleError(_0x427413,null));};exports[_0x1a71('0x1f')]=function(_0x1ceb42,_0x34d8db){if(_0x1ceb42[_0x1a71('0x33')]['id']){delete _0x1ceb42[_0x1a71('0x33')]['id'];}return db['License']['find']({'where':{'id':_0x1ceb42[_0x1a71('0x34')]['id']}})['then'](handleEntityNotFound(_0x34d8db,null))['then'](function(_0x194a40){var _0x4a740d=_0x194a40[_0x1a71('0x35')]({'plain':!![]});return utilLicense[_0x1a71('0x36')](_0x4a740d,_0x1ceb42['body'][_0x1a71('0x37')]);})[_0x1a71('0x20')](function(_0x1957a6){if(!_0x1957a6['demo']){return saveUpdates(_0x1ceb42[_0x1a71('0x33')],null);}return _0x1957a6;})[_0x1a71('0x20')](respondWithResult(_0x34d8db,null))['catch'](handleError(_0x34d8db,null));}; \ No newline at end of file diff --git a/server/api/license/license.model.js b/server/api/license/license.model.js index d8a1cba..395e9d5 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(_0x2ebcd9,_0xbb38b5){var _0x2cf27f=function(_0x26bc9f){while(--_0x26bc9f){_0x2ebcd9['push'](_0x2ebcd9['shift']());}};_0x2cf27f(++_0xbb38b5);}(_0xd8b0,0xad));var _0x0d8b=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xd8b0[_0x122ef9];return _0x42fba0;};'use strict';var _=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x0d8b('0x2'));var rp=require(_0x0d8b('0x3'));var fs=require('fs');var path=require(_0x0d8b('0x4'));var rimraf=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));var attributes=require('./license.attributes');module['exports']=function(_0x3f8b6f,_0x227c63){return _0x3f8b6f[_0x0d8b('0x7')]('License',attributes,{'tableName':_0x0d8b('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb10b=['api','moment','request-promise','path','rimraf','../../config/environment','./license.attributes','exports','define','license','lodash','../../config/logger'];(function(_0x4a53d,_0x58a95e){var _0x27410e=function(_0x38fc90){while(--_0x38fc90){_0x4a53d['push'](_0x4a53d['shift']());}};_0x27410e(++_0x58a95e);}(_0xb10b,0x12a));var _0xbb10=function(_0x33711e,_0x57999f){_0x33711e=_0x33711e-0x0;var _0x5816e3=_0xb10b[_0x33711e];return _0x5816e3;};'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 5418b1a..d11c084 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 _0x3a79=['rpc','../../config/environment','client','request','request\x20sent','debug','License,\x20%s,\x20%s,\x20%s','error','code','message','License,\x20%s,\x20%s','info','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x414b1b,_0x549bf5){var _0x49bf3a=function(_0x43e94c){while(--_0x43e94c){_0x414b1b['push'](_0x414b1b['shift']());}};_0x49bf3a(++_0x549bf5);}(_0x3a79,0xca));var _0x93a7=function(_0x4afe2c,_0x306521){_0x4afe2c=_0x4afe2c-0x0;var _0x2e83ee=_0x3a79[_0x4afe2c];return _0x2e83ee;};'use strict';var _=require('lodash');var util=require(_0x93a7('0x0'));var moment=require(_0x93a7('0x1'));var BPromise=require('bluebird');var rs=require(_0x93a7('0x2'));var fs=require('fs');var Redis=require(_0x93a7('0x3'));var db=require(_0x93a7('0x4'))['db'];var utils=require(_0x93a7('0x5'));var logger=require(_0x93a7('0x6'))(_0x93a7('0x7'));var config=require(_0x93a7('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x93a7('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2579e5,_0x4690bb,_0x1b59d1){return new BPromise(function(_0x2417da,_0x3a512b){return client[_0x93a7('0xa')](_0x2579e5,_0x1b59d1)['then'](function(_0x2996db){logger['info']('License,\x20%s,\x20%s',_0x4690bb,_0x93a7('0xb'));logger[_0x93a7('0xc')](_0x93a7('0xd'),_0x4690bb,'request\x20sent',JSON['stringify'](_0x2996db));if(_0x2996db[_0x93a7('0xe')]){if(_0x2996db[_0x93a7('0xe')][_0x93a7('0xf')]===0x1f4){logger['error']('License,\x20%s,\x20%s',_0x4690bb,_0x2996db[_0x93a7('0xe')]['message']);return _0x3a512b(_0x2996db[_0x93a7('0xe')][_0x93a7('0x10')]);}logger[_0x93a7('0xe')](_0x93a7('0x11'),_0x4690bb,_0x2996db[_0x93a7('0xe')][_0x93a7('0x10')]);return _0x2417da(_0x2996db[_0x93a7('0xe')]['message']);}else{logger[_0x93a7('0x12')](_0x93a7('0x11'),_0x4690bb,'request\x20sent');_0x2417da(_0x2996db['result'][_0x93a7('0x10')]);}})['catch'](function(_0xfac49d){logger[_0x93a7('0xe')](_0x93a7('0x11'),_0x4690bb,_0xfac49d);_0x3a512b(_0xfac49d);});});} \ No newline at end of file +var _0x93e6=['error','code','message','info','result','catch','lodash','bluebird','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','License,\x20%s,\x20%s','debug','request\x20sent'];(function(_0x820307,_0x33406b){var _0x551324=function(_0x1f1e54){while(--_0x1f1e54){_0x820307['push'](_0x820307['shift']());}};_0x551324(++_0x33406b);}(_0x93e6,0x11e));var _0x693e=function(_0x503d00,_0x323df1){_0x503d00=_0x503d00-0x0;var _0x2263d8=_0x93e6[_0x503d00];return _0x2263d8;};'use strict';var _=require(_0x693e('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x693e('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x693e('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0x693e('0x3'));var logger=require(_0x693e('0x4'))(_0x693e('0x5'));var config=require('../../config/environment');var jayson=require(_0x693e('0x6'));var client=jayson[_0x693e('0x7')][_0x693e('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x520113,_0x577dcb,_0x57897c){return new BPromise(function(_0x155601,_0x4b30f6){return client[_0x693e('0x9')](_0x520113,_0x57897c)[_0x693e('0xa')](function(_0x14b901){logger['info'](_0x693e('0xb'),_0x577dcb,'request\x20sent');logger[_0x693e('0xc')]('License,\x20%s,\x20%s,\x20%s',_0x577dcb,_0x693e('0xd'),JSON['stringify'](_0x14b901));if(_0x14b901['error']){if(_0x14b901[_0x693e('0xe')][_0x693e('0xf')]===0x1f4){logger[_0x693e('0xe')](_0x693e('0xb'),_0x577dcb,_0x14b901['error'][_0x693e('0x10')]);return _0x4b30f6(_0x14b901[_0x693e('0xe')][_0x693e('0x10')]);}logger[_0x693e('0xe')](_0x693e('0xb'),_0x577dcb,_0x14b901[_0x693e('0xe')][_0x693e('0x10')]);return _0x155601(_0x14b901['error'][_0x693e('0x10')]);}else{logger[_0x693e('0x11')](_0x693e('0xb'),_0x577dcb,'request\x20sent');_0x155601(_0x14b901[_0x693e('0x12')][_0x693e('0x10')]);}})[_0x693e('0x13')](function(_0xb3a90a){logger[_0x693e('0xe')](_0x693e('0xb'),_0x577dcb,_0xb3a90a);_0x4b30f6(_0xb3a90a);});});} \ No newline at end of file diff --git a/server/api/mailAccount/index.js b/server/api/mailAccount/index.js index c6597a6..675f58a 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 _0xb407=['index','/describe','show','/:id/canned_answers','/:id/in_servers','getImap','getSmtp','getInteractions','/:id/applications','getApplications','/:id/messages','getMessages','verifySmtp','/:id/users','getAgents','/:id/dispositions','addDisposition','post','addAnswer','create','addImap','/:id/out_servers','addInteraction','addApplications','/:id/send','send','addAgents','/:id','delete','removeDispositions','removeAnswers','removeImap','removeSmtp','removeAgents','exports','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailAccount.controller','get','isAuthenticated'];(function(_0x1974a1,_0x347db8){var _0x415789=function(_0x325524){while(--_0x325524){_0x1974a1['push'](_0x1974a1['shift']());}};_0x415789(++_0x347db8);}(_0xb407,0x1c1));var _0x7b40=function(_0x3fad78,_0x1d8cc9){_0x3fad78=_0x3fad78-0x0;var _0x5a4009=_0xb407[_0x3fad78];return _0x5a4009;};'use strict';var multer=require(_0x7b40('0x0'));var util=require(_0x7b40('0x1'));var path=require(_0x7b40('0x2'));var timeout=require(_0x7b40('0x3'));var express=require(_0x7b40('0x4'));var router=express['Router']();var auth=require(_0x7b40('0x5'));var interaction=require(_0x7b40('0x6'));var config=require(_0x7b40('0x7'));var controller=require(_0x7b40('0x8'));router[_0x7b40('0x9')]('/',auth[_0x7b40('0xa')](),controller[_0x7b40('0xb')]);router[_0x7b40('0x9')](_0x7b40('0xc'),auth[_0x7b40('0xa')](),controller['describe']);router[_0x7b40('0x9')]('/:id',auth['isAuthenticated'](),controller[_0x7b40('0xd')]);router[_0x7b40('0x9')]('/:id/dispositions',auth[_0x7b40('0xa')](),controller['getDispositions']);router[_0x7b40('0x9')](_0x7b40('0xe'),auth[_0x7b40('0xa')](),controller['getAnswers']);router[_0x7b40('0x9')](_0x7b40('0xf'),auth['isAuthenticated'](),controller[_0x7b40('0x10')]);router[_0x7b40('0x9')]('/:id/out_servers',auth[_0x7b40('0xa')](),controller[_0x7b40('0x11')]);router[_0x7b40('0x9')]('/:id/interactions',auth[_0x7b40('0xa')](),controller[_0x7b40('0x12')]);router['get'](_0x7b40('0x13'),auth[_0x7b40('0xa')](),controller[_0x7b40('0x14')]);router[_0x7b40('0x9')](_0x7b40('0x15'),auth[_0x7b40('0xa')](),controller[_0x7b40('0x16')]);router[_0x7b40('0x9')]('/:id/verify',auth[_0x7b40('0xa')](),controller[_0x7b40('0x17')]);router['get'](_0x7b40('0x18'),auth['isAuthenticated'](),controller[_0x7b40('0x19')]);router['post'](_0x7b40('0x1a'),auth[_0x7b40('0xa')](),controller[_0x7b40('0x1b')]);router[_0x7b40('0x1c')](_0x7b40('0xe'),auth[_0x7b40('0xa')](),controller[_0x7b40('0x1d')]);router['post']('/',auth['isAuthenticated'](),controller[_0x7b40('0x1e')]);router['post'](_0x7b40('0xf'),auth['isAuthenticated'](),controller[_0x7b40('0x1f')]);router[_0x7b40('0x1c')](_0x7b40('0x20'),auth[_0x7b40('0xa')](),controller['addSmtp']);router[_0x7b40('0x1c')]('/:id/interactions',auth[_0x7b40('0xa')](),controller[_0x7b40('0x21')]);router['post'](_0x7b40('0x13'),auth[_0x7b40('0xa')](),controller[_0x7b40('0x22')]);router[_0x7b40('0x1c')](_0x7b40('0x23'),auth[_0x7b40('0xa')](),controller[_0x7b40('0x24')]);router[_0x7b40('0x1c')](_0x7b40('0x18'),auth[_0x7b40('0xa')](),controller[_0x7b40('0x25')]);router['put'](_0x7b40('0x26'),auth[_0x7b40('0xa')](),controller['update']);router[_0x7b40('0x27')](_0x7b40('0x1a'),auth[_0x7b40('0xa')](),controller[_0x7b40('0x28')]);router[_0x7b40('0x27')](_0x7b40('0xe'),auth['isAuthenticated'](),controller[_0x7b40('0x29')]);router['delete'](_0x7b40('0xf'),auth[_0x7b40('0xa')](),controller[_0x7b40('0x2a')]);router['delete'](_0x7b40('0x20'),auth[_0x7b40('0xa')](),controller[_0x7b40('0x2b')]);router[_0x7b40('0x27')](_0x7b40('0x26'),auth['isAuthenticated'](),controller['destroy']);router[_0x7b40('0x27')](_0x7b40('0x18'),auth[_0x7b40('0xa')](),controller[_0x7b40('0x2c')]);module[_0x7b40('0x2d')]=router; \ No newline at end of file +var _0x7fbd=['../../components/auth/service','../../components/interaction/service','../../config/environment','./mailAccount.controller','get','isAuthenticated','index','show','getDispositions','/:id/canned_answers','getAnswers','/:id/in_servers','getImap','/:id/out_servers','getInteractions','getApplications','/:id/messages','/:id/verify','/:id/users','getAgents','post','/:id/dispositions','addDisposition','create','addSmtp','/:id/interactions','addInteraction','addApplications','/:id/send','addAgents','put','update','delete','removeDispositions','removeAnswers','removeImap','removeAgents','exports','util','path','connect-timeout','express','Router'];(function(_0x467cb0,_0x303070){var _0x2153f7=function(_0x51775a){while(--_0x51775a){_0x467cb0['push'](_0x467cb0['shift']());}};_0x2153f7(++_0x303070);}(_0x7fbd,0xa7));var _0xd7fb=function(_0x2eab1d,_0x54edd4){_0x2eab1d=_0x2eab1d-0x0;var _0x37cfed=_0x7fbd[_0x2eab1d];return _0x37cfed;};'use strict';var multer=require('multer');var util=require(_0xd7fb('0x0'));var path=require(_0xd7fb('0x1'));var timeout=require(_0xd7fb('0x2'));var express=require(_0xd7fb('0x3'));var router=express[_0xd7fb('0x4')]();var auth=require(_0xd7fb('0x5'));var interaction=require(_0xd7fb('0x6'));var config=require(_0xd7fb('0x7'));var controller=require(_0xd7fb('0x8'));router[_0xd7fb('0x9')]('/',auth[_0xd7fb('0xa')](),controller[_0xd7fb('0xb')]);router['get']('/describe',auth[_0xd7fb('0xa')](),controller['describe']);router[_0xd7fb('0x9')]('/:id',auth['isAuthenticated'](),controller[_0xd7fb('0xc')]);router[_0xd7fb('0x9')]('/:id/dispositions',auth[_0xd7fb('0xa')](),controller[_0xd7fb('0xd')]);router[_0xd7fb('0x9')](_0xd7fb('0xe'),auth[_0xd7fb('0xa')](),controller[_0xd7fb('0xf')]);router[_0xd7fb('0x9')](_0xd7fb('0x10'),auth[_0xd7fb('0xa')](),controller[_0xd7fb('0x11')]);router[_0xd7fb('0x9')](_0xd7fb('0x12'),auth[_0xd7fb('0xa')](),controller['getSmtp']);router[_0xd7fb('0x9')]('/:id/interactions',auth[_0xd7fb('0xa')](),controller[_0xd7fb('0x13')]);router[_0xd7fb('0x9')]('/:id/applications',auth[_0xd7fb('0xa')](),controller[_0xd7fb('0x14')]);router['get'](_0xd7fb('0x15'),auth[_0xd7fb('0xa')](),controller['getMessages']);router[_0xd7fb('0x9')](_0xd7fb('0x16'),auth[_0xd7fb('0xa')](),controller['verifySmtp']);router[_0xd7fb('0x9')](_0xd7fb('0x17'),auth[_0xd7fb('0xa')](),controller[_0xd7fb('0x18')]);router[_0xd7fb('0x19')](_0xd7fb('0x1a'),auth['isAuthenticated'](),controller[_0xd7fb('0x1b')]);router[_0xd7fb('0x19')](_0xd7fb('0xe'),auth['isAuthenticated'](),controller['addAnswer']);router[_0xd7fb('0x19')]('/',auth[_0xd7fb('0xa')](),controller[_0xd7fb('0x1c')]);router[_0xd7fb('0x19')](_0xd7fb('0x10'),auth[_0xd7fb('0xa')](),controller['addImap']);router[_0xd7fb('0x19')](_0xd7fb('0x12'),auth[_0xd7fb('0xa')](),controller[_0xd7fb('0x1d')]);router[_0xd7fb('0x19')](_0xd7fb('0x1e'),auth[_0xd7fb('0xa')](),controller[_0xd7fb('0x1f')]);router[_0xd7fb('0x19')]('/:id/applications',auth['isAuthenticated'](),controller[_0xd7fb('0x20')]);router[_0xd7fb('0x19')](_0xd7fb('0x21'),auth[_0xd7fb('0xa')](),controller['send']);router[_0xd7fb('0x19')](_0xd7fb('0x17'),auth[_0xd7fb('0xa')](),controller[_0xd7fb('0x22')]);router[_0xd7fb('0x23')]('/:id',auth[_0xd7fb('0xa')](),controller[_0xd7fb('0x24')]);router[_0xd7fb('0x25')](_0xd7fb('0x1a'),auth[_0xd7fb('0xa')](),controller[_0xd7fb('0x26')]);router[_0xd7fb('0x25')](_0xd7fb('0xe'),auth[_0xd7fb('0xa')](),controller[_0xd7fb('0x27')]);router[_0xd7fb('0x25')](_0xd7fb('0x10'),auth['isAuthenticated'](),controller[_0xd7fb('0x28')]);router[_0xd7fb('0x25')]('/:id/out_servers',auth[_0xd7fb('0xa')](),controller['removeSmtp']);router[_0xd7fb('0x25')]('/:id',auth[_0xd7fb('0xa')](),controller['destroy']);router[_0xd7fb('0x25')](_0xd7fb('0x17'),auth[_0xd7fb('0xa')](),controller[_0xd7fb('0x29')]);module[_0xd7fb('0x2a')]=router; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.attributes.js b/server/api/mailAccount/mailAccount.attributes.js index 2e74d1b..e945a7d 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 _0x08d8=['Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','sequelize','STRING','BOOLEAN','Arial,Helvetica,sans-serif','INTEGER','UNSIGNED','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}
Subject\x20:\x20{{message.subject}}'];(function(_0x567d21,_0x3e8d95){var _0x4a443a=function(_0x1c87c0){while(--_0x1c87c0){_0x567d21['push'](_0x567d21['shift']());}};_0x4a443a(++_0x3e8d95);}(_0x08d8,0xa0));var _0x808d=function(_0x34919b,_0x1e409a){_0x34919b=_0x34919b-0x0;var _0x505b56=_0x08d8[_0x34919b];return _0x505b56;};'use strict';var Sequelize=require(_0x808d('0x0'));module['exports']={'description':{'type':Sequelize[_0x808d('0x1')]},'name':{'type':Sequelize[_0x808d('0x1')],'allowNull':![]},'service':{'type':Sequelize[_0x808d('0x2')],'defaultValue':![]},'email':{'type':Sequelize[_0x808d('0x1')],'validate':{'isEmail':!![]}},'active':{'type':Sequelize[_0x808d('0x2')],'defaultValue':!![]},'key':{'type':Sequelize[_0x808d('0x1')],'allowNull':![]},'template':{'type':Sequelize['TEXT']},'markAsUnread':{'type':Sequelize[_0x808d('0x2')],'defaultValue':![]},'fontFamily':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x808d('0x3')},'fontSize':{'type':Sequelize[_0x808d('0x4')](0x2)[_0x808d('0x5')],'defaultValue':0xd,'validate':{'min':0x8,'max':0x48}},'notificationTemplate':{'type':Sequelize[_0x808d('0x6')],'defaultValue':function(){return _0x808d('0x7');}},'notificationSound':{'type':Sequelize[_0x808d('0x2')],'defaultValue':!![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x808d('0x4')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x808d('0x2')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x808d('0x4')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x808d('0x2')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x808d('0x4')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x808d('0x4')],'allowNull':!![],'defaultValue':null,'comment':_0x808d('0x8')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0x808d('0x9'),'set':function(_0x53f6df){if(!_0x53f6df)this[_0x808d('0xa')](_0x808d('0xb'),null);this[_0x808d('0xa')]('mandatoryDisposition',_0x53f6df);}}}; \ No newline at end of file +var _0xb945=['Arial,Helvetica,sans-serif','INTEGER','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','setDataValue','mandatoryDisposition','sequelize','exports','STRING','BOOLEAN','TEXT'];(function(_0x56e160,_0xd392b2){var _0x51ce6c=function(_0x31cd9b){while(--_0x31cd9b){_0x56e160['push'](_0x56e160['shift']());}};_0x51ce6c(++_0xd392b2);}(_0xb945,0x8a));var _0x5b94=function(_0x12b8a3,_0x1e7210){_0x12b8a3=_0x12b8a3-0x0;var _0x21f317=_0xb945[_0x12b8a3];return _0x21f317;};'use strict';var Sequelize=require(_0x5b94('0x0'));module[_0x5b94('0x1')]={'description':{'type':Sequelize[_0x5b94('0x2')]},'name':{'type':Sequelize[_0x5b94('0x2')],'allowNull':![]},'service':{'type':Sequelize[_0x5b94('0x3')],'defaultValue':![]},'email':{'type':Sequelize[_0x5b94('0x2')],'validate':{'isEmail':!![]}},'active':{'type':Sequelize[_0x5b94('0x3')],'defaultValue':!![]},'key':{'type':Sequelize['STRING'],'allowNull':![]},'template':{'type':Sequelize[_0x5b94('0x4')]},'markAsUnread':{'type':Sequelize[_0x5b94('0x3')],'defaultValue':![]},'fontFamily':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x5b94('0x5')},'fontSize':{'type':Sequelize[_0x5b94('0x6')](0x2)['UNSIGNED'],'defaultValue':0xd,'validate':{'min':0x8,'max':0x48}},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return _0x5b94('0x7');}},'notificationSound':{'type':Sequelize[_0x5b94('0x3')],'defaultValue':!![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x5b94('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x5b94('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x5b94('0x3')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'allowNull':!![],'defaultValue':null,'comment':_0x5b94('0x8')},'mandatoryDisposition':{'type':Sequelize[_0x5b94('0x3')],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x30af36){if(!_0x30af36)this['setDataValue']('mandatoryDispositionPauseId',null);this[_0x5b94('0x9')](_0x5b94('0xa'),_0x30af36);}}}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.controller.js b/server/api/mailAccount/mailAccount.controller.js index c5def87..36e1ea1 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 _0x3804=['split','format','YYYY-MM-DD\x20HH:mm:ss','CmList','List','Contacts','updatedAt','from','%s\x20<%s>','attachments','join','server/files/attachments','secure','SendMail','sendMail','List\x20not\x20found','messageId','subject','out','Interaction','Messages','verifySmtp','auth','VerifySmtp','ValidationError','You\x20can\x27t\x20remove\x20the\x20mail\x20service\x20account','addAgents','omit','spread','userMailAccount:save','removeAgents','isArray','emit','getAgents','html-pdf','rimraf','zip-dir','bluebird','mustache','util','path','sox','to-csv','ejs','crypto','querystring','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','./mailAccount.socket','jayson/promise','http','test','Sequelize','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','then','info','MailAccount,\x20%s,\x20%s','request\x20sent','debug','MailAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','destroy','get','MailAccounts','UserProfileResource','stack','name','send','index','Imap','Smtp','Pause','map','MailAccount','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','sort','where','pick','filter','merge','includeAll','findAll','params','MailServerIn','include','options','find','body','MailServerOut','mandatoryDispositionPause','describe','addDisposition','MailAccountId','Disposition','create','getDispositions','findOne','rows','removeDispositions','addAnswer','getAnswers','CannedAnswer','nolimit','order','removeAnswers','ids','email','ListId','isNil','active','description','cauthentication','user','cuser','password','pass','cpassword','authentication','host','port','service','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','getImap','addImap','removeImap','getSmtp','addSmtp','removeSmtp','setSmtp','addInteraction','MailInteraction','getInteractions','CmContact','User','Owner','fullname','internal','Tag','color','tag','addApplications','sequelize','transaction','MailApplication','bulkCreate','findAndCountAll','priority','getApplications','getMessages','MailMessage','$gte'];(function(_0x4b69fc,_0x56c171){var _0x1cd766=function(_0x369b22){while(--_0x369b22){_0x4b69fc['push'](_0x4b69fc['shift']());}};_0x1cd766(++_0x56c171);}(_0x3804,0x1ac));var _0x4380=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3804[_0x3dd15e];return _0x231fd0;};'use strict';var pdf=require(_0x4380('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x4380('0x1'));var zipdir=require(_0x4380('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x4380('0x3'));var Mustache=require(_0x4380('0x4'));var util=require(_0x4380('0x5'));var path=require(_0x4380('0x6'));var sox=require(_0x4380('0x7'));var csv=require(_0x4380('0x8'));var ejs=require(_0x4380('0x9'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0x4380('0xa'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x4380('0x8'));var querystring=require(_0x4380('0xb'));var Papa=require('papaparse');var Redis=require(_0x4380('0xc'));var authService=require(_0x4380('0xd'));var qs=require(_0x4380('0xe'));var as=require(_0x4380('0xf'));var hardwareService=require(_0x4380('0x10'));var logger=require(_0x4380('0x11'))(_0x4380('0x12'));var utils=require(_0x4380('0x13'));var config=require(_0x4380('0x14'));var db=require(_0x4380('0x15'))['db'];config[_0x4380('0x16')]=_[_0x4380('0x17')](config[_0x4380('0x16')],{'host':_0x4380('0x18'),'port':0x18eb});var socket=require(_0x4380('0x19'))(new Redis(config['redis']));require(_0x4380('0x1a'))['register'](socket);var jayson=require(_0x4380('0x1b'));var client=jayson['client'][_0x4380('0x1c')]({'port':0x232b});function checkPasswordPattern(_0x5ec604,_0x34961e,_0x14c17f){if(_0x14c17f){var _0x538228=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x538228[_0x4380('0x1d')](_0x34961e)){return _0x5ec604;}else{throw new db[(_0x4380('0x1e'))]['ValidationError'](_0x4380('0x1f'));}}else{return _0x5ec604;}}function respondWithRpcPromise(_0xb0669d,_0x238bd1,_0x3ce28e,_0x58b923){return new BPromise(function(_0x3443b1,_0x5a8256){var _0x58b194=_0x58b923||client;return _0x58b194['request'](_0xb0669d,_0x3ce28e)[_0x4380('0x20')](function(_0x3de71b){logger[_0x4380('0x21')](_0x4380('0x22'),_0x238bd1,_0x4380('0x23'));logger[_0x4380('0x24')](_0x4380('0x25'),_0x238bd1,_0x4380('0x23'),JSON[_0x4380('0x26')](_0x3de71b));if(_0x3de71b['error']){if(_0x3de71b[_0x4380('0x27')][_0x4380('0x28')]===0x1f4){logger[_0x4380('0x27')]('MailAccount,\x20%s,\x20%s',_0x238bd1,_0x3de71b['error'][_0x4380('0x29')]);return _0x5a8256(_0x3de71b[_0x4380('0x27')][_0x4380('0x29')]);}logger[_0x4380('0x27')]('MailAccount,\x20%s,\x20%s',_0x238bd1,_0x3de71b[_0x4380('0x27')][_0x4380('0x29')]);return _0x3443b1(_0x3de71b[_0x4380('0x27')][_0x4380('0x29')]);}else{logger[_0x4380('0x21')](_0x4380('0x22'),_0x238bd1,_0x4380('0x23'));_0x3443b1(_0x3de71b[_0x4380('0x2a')]['message']);}})[_0x4380('0x2b')](function(_0x2a7de9){logger['error'](_0x4380('0x22'),_0x238bd1,_0x2a7de9);_0x5a8256(_0x2a7de9);});});}function respondWithStatusCode(_0x279ec1,_0x23498f){_0x23498f=_0x23498f||0xcc;return function(_0x82f3a4){if(_0x82f3a4){return _0x279ec1[_0x4380('0x2c')](_0x23498f);}return _0x279ec1[_0x4380('0x2d')](_0x23498f)[_0x4380('0x2e')]();};}function respondWithResult(_0x142e43,_0x468532){_0x468532=_0x468532||0xc8;return function(_0xc8fee){if(_0xc8fee){return _0x142e43[_0x4380('0x2d')](_0x468532)[_0x4380('0x2f')](_0xc8fee);}};}function respondWithFilteredResult(_0x2143d1,_0x5941fc){return function(_0x2f2fff){if(_0x2f2fff){var _0x4d4560=_0x2f2fff[_0x4380('0x30')],_0x24e9a4=_0x5941fc[_0x4380('0x31')],_0x1c08db=_0x5941fc['offset']+_0x5941fc[_0x4380('0x32')],_0x730914;if(_0x1c08db>=_0x4d4560){_0x1c08db=_0x4d4560;_0x730914=0xc8;}else{_0x730914=0xce;}_0x2143d1[_0x4380('0x2d')](_0x730914);return _0x2143d1[_0x4380('0x33')](_0x4380('0x34'),_0x24e9a4+'-'+_0x1c08db+'/'+_0x4d4560)[_0x4380('0x2f')](_0x2f2fff);}return null;};}function patchUpdates(_0x4a554f){return function(_0xedf371){try{jsonpatch[_0x4380('0x35')](_0xedf371,_0x4a554f,!![]);}catch(_0x51150a){return BPromise[_0x4380('0x36')](_0x51150a);}return _0xedf371[_0x4380('0x37')]();};}function saveUpdates(_0x28dca7,_0x7b4929){return function(_0x376630){if(_0x376630){return _0x376630[_0x4380('0x38')](_0x28dca7)[_0x4380('0x20')](function(_0x28a009){return _0x28a009;});}return null;};}function removeEntity(_0x173efb,_0x3e5f20){return function(_0x39608e){if(_0x39608e){return _0x39608e[_0x4380('0x39')]()[_0x4380('0x20')](function(){var _0x512b48=_0x39608e[_0x4380('0x3a')]({'plain':!![]});var _0x5aabca=_0x4380('0x3b');return db[_0x4380('0x3c')][_0x4380('0x39')]({'where':{'type':_0x5aabca,'resourceId':_0x512b48['id']}})[_0x4380('0x20')](function(){return _0x39608e;});})['then'](function(){_0x173efb[_0x4380('0x2d')](0xcc)[_0x4380('0x2e')]();});}};}function handleEntityNotFound(_0x11fcf2,_0x456bd0){return function(_0x368f37){if(!_0x368f37){_0x11fcf2[_0x4380('0x2c')](0x194);}return _0x368f37;};}function handleError(_0x9e4e29,_0x35355d){_0x35355d=_0x35355d||0x1f4;return function(_0x5b5dde){logger[_0x4380('0x27')](_0x5b5dde[_0x4380('0x3d')]);if(_0x5b5dde['name']){delete _0x5b5dde[_0x4380('0x3e')];}_0x9e4e29[_0x4380('0x2d')](_0x35355d)[_0x4380('0x3f')](_0x5b5dde);};}exports[_0x4380('0x40')]=function(_0x2e04dc,_0x2cc492){var _0x3bede1={'include':[{'model':db['MailServerIn'],'as':_0x4380('0x41')},{'model':db['MailServerOut'],'as':_0x4380('0x42')},{'model':db[_0x4380('0x43')],'as':'mandatoryDispositionPause'}]},_0x216021={},_0x550af6={'count':0x0,'rows':[]};var _0x2f8a82=_[_0x4380('0x44')](db[_0x4380('0x45')][_0x4380('0x46')],function(_0x438884){return{'name':_0x438884[_0x4380('0x47')],'type':_0x438884[_0x4380('0x48')][_0x4380('0x49')]};});_0x216021[_0x4380('0x4a')]=_['map'](_0x2f8a82,'name');_0x216021[_0x4380('0x4b')]=_[_0x4380('0x4c')](_0x2e04dc[_0x4380('0x4b')]);_0x216021[_0x4380('0x4d')]=_['intersection'](_0x216021[_0x4380('0x4a')],_0x216021[_0x4380('0x4b')]);_0x3bede1[_0x4380('0x4e')]=_[_0x4380('0x4f')](_0x216021[_0x4380('0x4a')],qs[_0x4380('0x50')](_0x2e04dc['query']['fields']));_0x3bede1['attributes']=_0x3bede1[_0x4380('0x4e')][_0x4380('0x51')]?_0x3bede1[_0x4380('0x4e')]:_0x216021[_0x4380('0x4a')];if(!_0x2e04dc[_0x4380('0x4b')][_0x4380('0x52')]('nolimit')){_0x3bede1['limit']=qs[_0x4380('0x32')](_0x2e04dc[_0x4380('0x4b')][_0x4380('0x32')]);_0x3bede1['offset']=qs[_0x4380('0x31')](_0x2e04dc[_0x4380('0x4b')]['offset']);}_0x3bede1['order']=qs[_0x4380('0x53')](_0x2e04dc['query'][_0x4380('0x53')]);_0x3bede1[_0x4380('0x54')]=qs[_0x4380('0x4d')](_[_0x4380('0x55')](_0x2e04dc[_0x4380('0x4b')],_0x216021[_0x4380('0x4d')]),_0x2f8a82);if(_0x2e04dc[_0x4380('0x4b')][_0x4380('0x56')]){_0x3bede1[_0x4380('0x54')]=_[_0x4380('0x57')](_0x3bede1['where'],{'$or':_[_0x4380('0x44')](_0x2f8a82,function(_0x42e05a){if(_0x42e05a[_0x4380('0x48')]!=='VIRTUAL'){var _0x533b4c={};_0x533b4c[_0x42e05a[_0x4380('0x3e')]]={'$like':'%'+_0x2e04dc[_0x4380('0x4b')][_0x4380('0x56')]+'%'};return _0x533b4c;}})});}_0x3bede1=_[_0x4380('0x57')]({},_0x3bede1,_0x2e04dc['options']);var _0x47ea3e={'where':_0x3bede1[_0x4380('0x54')]};return db[_0x4380('0x45')][_0x4380('0x30')](_0x47ea3e)[_0x4380('0x20')](function(_0x1e6d7c){_0x550af6['count']=_0x1e6d7c;if(_0x2e04dc[_0x4380('0x4b')][_0x4380('0x58')]){_0x3bede1['include']=[{'all':!![]}];}return db[_0x4380('0x45')][_0x4380('0x59')](_0x3bede1);})[_0x4380('0x20')](function(_0x4ba5ce){_0x550af6['rows']=_0x4ba5ce;return _0x550af6;})[_0x4380('0x20')](respondWithFilteredResult(_0x2cc492,_0x3bede1))[_0x4380('0x2b')](handleError(_0x2cc492,null));};exports['show']=function(_0x55e6c8,_0xfcef1e){var _0x3fa1e6={'raw':![],'where':{'id':_0x55e6c8[_0x4380('0x5a')]['id']},'include':[{'model':db[_0x4380('0x5b')],'as':_0x4380('0x41')},{'model':db['MailServerOut'],'as':_0x4380('0x42')},{'model':db['Pause'],'as':'mandatoryDispositionPause'}]},_0x1e5cf6={};_0x1e5cf6[_0x4380('0x4a')]=_[_0x4380('0x4c')](db[_0x4380('0x45')][_0x4380('0x46')]);_0x1e5cf6[_0x4380('0x4b')]=_['keys'](_0x55e6c8[_0x4380('0x4b')]);_0x1e5cf6[_0x4380('0x4d')]=_[_0x4380('0x4f')](_0x1e5cf6['model'],_0x1e5cf6[_0x4380('0x4b')]);_0x3fa1e6[_0x4380('0x4e')]=_[_0x4380('0x4f')](_0x1e5cf6[_0x4380('0x4a')],qs[_0x4380('0x50')](_0x55e6c8['query'][_0x4380('0x50')]));_0x3fa1e6['attributes']=_0x3fa1e6[_0x4380('0x4e')]['length']?_0x3fa1e6[_0x4380('0x4e')]:_0x1e5cf6['model'];if(_0x55e6c8[_0x4380('0x4b')][_0x4380('0x58')]){_0x3fa1e6[_0x4380('0x5c')]=[{'all':!![]}];}_0x3fa1e6=_[_0x4380('0x57')]({},_0x3fa1e6,_0x55e6c8[_0x4380('0x5d')]);return db[_0x4380('0x45')][_0x4380('0x5e')](_0x3fa1e6)[_0x4380('0x20')](handleEntityNotFound(_0xfcef1e,null))['then'](respondWithResult(_0xfcef1e,null))[_0x4380('0x2b')](handleError(_0xfcef1e,null));};exports['update']=function(_0x246c11,_0x446e04){if(_0x246c11[_0x4380('0x5f')]['id']){delete _0x246c11[_0x4380('0x5f')]['id'];}return db[_0x4380('0x45')]['find']({'where':{'id':_0x246c11[_0x4380('0x5a')]['id']},'include':[{'model':db[_0x4380('0x5b')],'as':_0x4380('0x41')},{'model':db[_0x4380('0x60')],'as':_0x4380('0x42')},{'model':db[_0x4380('0x43')],'as':_0x4380('0x61')}]})['then'](handleEntityNotFound(_0x446e04,null))[_0x4380('0x20')](saveUpdates(_0x246c11[_0x4380('0x5f')],null))[_0x4380('0x20')](function(_0x4d3e5f){if(_0x4d3e5f&&_0x246c11[_0x4380('0x5f')][_0x4380('0x41')]){return db['MailServerIn'][_0x4380('0x38')](_0x246c11[_0x4380('0x5f')][_0x4380('0x41')],{'where':{'MailAccountId':_0x4d3e5f['id']}})[_0x4380('0x20')](function(){return _0x4d3e5f;});}return _0x4d3e5f;})[_0x4380('0x20')](function(_0xcd02cb){if(_0xcd02cb&&_0x246c11[_0x4380('0x5f')]['Smtp']){return db[_0x4380('0x60')][_0x4380('0x38')](_0x246c11[_0x4380('0x5f')][_0x4380('0x42')],{'where':{'MailAccountId':_0xcd02cb['id']}})[_0x4380('0x20')](function(){return _0xcd02cb;});}return _0xcd02cb;})['then'](respondWithResult(_0x446e04,null))[_0x4380('0x2b')](handleError(_0x446e04,null));};exports[_0x4380('0x62')]=function(_0xdc32f8,_0x9e26fb){return db[_0x4380('0x45')][_0x4380('0x62')]()['then'](respondWithResult(_0x9e26fb,null))[_0x4380('0x2b')](handleError(_0x9e26fb,null));};exports[_0x4380('0x63')]=function(_0x57e575,_0x58eae5,_0x102123){if(_0x57e575[_0x4380('0x5f')]['id']){delete _0x57e575[_0x4380('0x5f')]['id'];}return db[_0x4380('0x45')][_0x4380('0x5e')]({'where':{'id':_0x57e575['params']['id']}})['then'](handleEntityNotFound(_0x58eae5,null))[_0x4380('0x20')](function(_0x231782){if(_0x231782){_0x57e575[_0x4380('0x5f')][_0x4380('0x64')]=_0x231782['id'];return db[_0x4380('0x65')][_0x4380('0x66')](_0x57e575[_0x4380('0x5f')]);}})['then'](respondWithResult(_0x58eae5,null))[_0x4380('0x2b')](handleError(_0x58eae5,null));};exports[_0x4380('0x67')]=function(_0x380a1b,_0x2aefe5,_0xdc081b){var _0x5312f1={'raw':![],'where':{}};var _0x1b4148={};var _0x309bfa={'count':0x0,'rows':[]};return db['MailAccount'][_0x4380('0x68')]({'where':{'id':_0x380a1b[_0x4380('0x5a')]['id']}})[_0x4380('0x20')](handleEntityNotFound(_0x2aefe5,null))[_0x4380('0x20')](function(_0xac518e){if(_0xac518e){_0x1b4148[_0x4380('0x4a')]=_[_0x4380('0x4c')](db[_0x4380('0x65')][_0x4380('0x46')]);_0x1b4148['query']=_[_0x4380('0x4c')](_0x380a1b[_0x4380('0x4b')]);_0x1b4148[_0x4380('0x4d')]=_[_0x4380('0x4f')](_0x1b4148[_0x4380('0x4a')],_0x1b4148[_0x4380('0x4b')]);_0x5312f1[_0x4380('0x4e')]=_[_0x4380('0x4f')](_0x1b4148['model'],qs[_0x4380('0x50')](_0x380a1b[_0x4380('0x4b')][_0x4380('0x50')]));_0x5312f1['attributes']=_0x5312f1[_0x4380('0x4e')][_0x4380('0x51')]?_0x5312f1[_0x4380('0x4e')]:_0x1b4148[_0x4380('0x4a')];if(!_0x380a1b[_0x4380('0x4b')][_0x4380('0x52')]('nolimit')){_0x5312f1[_0x4380('0x32')]=qs['limit'](_0x380a1b['query'][_0x4380('0x32')]);_0x5312f1[_0x4380('0x31')]=qs['offset'](_0x380a1b[_0x4380('0x4b')][_0x4380('0x31')]);}_0x5312f1['order']=qs['sort'](_0x380a1b[_0x4380('0x4b')]['sort']);_0x5312f1[_0x4380('0x54')]=qs[_0x4380('0x4d')](_[_0x4380('0x55')](_0x380a1b[_0x4380('0x4b')],_0x1b4148['filters']));_0x5312f1[_0x4380('0x54')][_0x4380('0x64')]=_0xac518e['id'];if(_0x380a1b[_0x4380('0x4b')]['filter']){_0x5312f1[_0x4380('0x54')]=_[_0x4380('0x57')](_0x5312f1['where'],{'$or':_[_0x4380('0x44')](_0x5312f1[_0x4380('0x4e')],function(_0x5ce988){var _0x20c7a9={};_0x20c7a9[_0x5ce988]={'$like':'%'+_0x380a1b[_0x4380('0x4b')][_0x4380('0x56')]+'%'};return _0x20c7a9;})});}_0x5312f1=_[_0x4380('0x57')]({},_0x5312f1,_0x380a1b['options']);return db[_0x4380('0x65')]['count']({'where':_0x5312f1[_0x4380('0x54')]})[_0x4380('0x20')](function(_0x267bdd){_0x309bfa[_0x4380('0x30')]=_0x267bdd;if(_0x380a1b[_0x4380('0x4b')][_0x4380('0x58')]){_0x5312f1[_0x4380('0x5c')]=[{'all':!![]}];}return db[_0x4380('0x65')][_0x4380('0x59')](_0x5312f1);})[_0x4380('0x20')](function(_0x29f846){_0x309bfa[_0x4380('0x69')]=_0x29f846;return _0x309bfa;});}})[_0x4380('0x20')](respondWithFilteredResult(_0x2aefe5,_0x5312f1))['catch'](handleError(_0x2aefe5,null));};exports['removeDispositions']=function(_0x3a557d,_0x40864a,_0xa8546d){return db[_0x4380('0x45')][_0x4380('0x5e')]({'where':{'id':_0x3a557d[_0x4380('0x5a')]['id']}})[_0x4380('0x20')](handleEntityNotFound(_0x40864a,null))[_0x4380('0x20')](function(_0x49d568){if(_0x49d568){return _0x49d568[_0x4380('0x6a')](_0x3a557d['query']['ids']);}})[_0x4380('0x20')](respondWithStatusCode(_0x40864a,null))[_0x4380('0x2b')](handleError(_0x40864a,null));};exports[_0x4380('0x6b')]=function(_0x7077,_0x525a93,_0x40fa7a){if(_0x7077[_0x4380('0x5f')]['id']){delete _0x7077['body']['id'];}return db['MailAccount'][_0x4380('0x5e')]({'where':{'id':_0x7077[_0x4380('0x5a')]['id']}})[_0x4380('0x20')](handleEntityNotFound(_0x525a93,null))['then'](function(_0x30c89f){if(_0x30c89f){_0x7077[_0x4380('0x5f')][_0x4380('0x64')]=_0x30c89f['id'];return db['CannedAnswer'][_0x4380('0x66')](_0x7077[_0x4380('0x5f')]);}})['then'](respondWithResult(_0x525a93,null))['catch'](handleError(_0x525a93,null));};exports[_0x4380('0x6c')]=function(_0x337638,_0x4eb479,_0x2e3638){var _0x2c9c5d={'raw':![],'where':{}};var _0x191e6d={};var _0x61c2d7={'count':0x0,'rows':[]};return db[_0x4380('0x45')][_0x4380('0x68')]({'where':{'id':_0x337638[_0x4380('0x5a')]['id']}})[_0x4380('0x20')](handleEntityNotFound(_0x4eb479,null))['then'](function(_0x4cdc2c){if(_0x4cdc2c){_0x191e6d[_0x4380('0x4a')]=_['keys'](db[_0x4380('0x6d')][_0x4380('0x46')]);_0x191e6d[_0x4380('0x4b')]=_[_0x4380('0x4c')](_0x337638[_0x4380('0x4b')]);_0x191e6d[_0x4380('0x4d')]=_['intersection'](_0x191e6d[_0x4380('0x4a')],_0x191e6d['query']);_0x2c9c5d[_0x4380('0x4e')]=_[_0x4380('0x4f')](_0x191e6d[_0x4380('0x4a')],qs[_0x4380('0x50')](_0x337638['query']['fields']));_0x2c9c5d['attributes']=_0x2c9c5d['attributes']['length']?_0x2c9c5d[_0x4380('0x4e')]:_0x191e6d[_0x4380('0x4a')];if(!_0x337638[_0x4380('0x4b')]['hasOwnProperty'](_0x4380('0x6e'))){_0x2c9c5d[_0x4380('0x32')]=qs['limit'](_0x337638['query'][_0x4380('0x32')]);_0x2c9c5d[_0x4380('0x31')]=qs[_0x4380('0x31')](_0x337638[_0x4380('0x4b')][_0x4380('0x31')]);}_0x2c9c5d[_0x4380('0x6f')]=qs[_0x4380('0x53')](_0x337638[_0x4380('0x4b')][_0x4380('0x53')]);_0x2c9c5d[_0x4380('0x54')]=qs[_0x4380('0x4d')](_['pick'](_0x337638[_0x4380('0x4b')],_0x191e6d['filters']));_0x2c9c5d[_0x4380('0x54')]['MailAccountId']=_0x4cdc2c['id'];if(_0x337638[_0x4380('0x4b')][_0x4380('0x56')]){_0x2c9c5d[_0x4380('0x54')]=_['merge'](_0x2c9c5d[_0x4380('0x54')],{'$or':_['map'](_0x2c9c5d[_0x4380('0x4e')],function(_0x424532){var _0x4150ca={};_0x4150ca[_0x424532]={'$like':'%'+_0x337638['query'][_0x4380('0x56')]+'%'};return _0x4150ca;})});}_0x2c9c5d=_[_0x4380('0x57')]({},_0x2c9c5d,_0x337638[_0x4380('0x5d')]);return db[_0x4380('0x6d')]['count']({'where':_0x2c9c5d[_0x4380('0x54')]})[_0x4380('0x20')](function(_0x4a2431){_0x61c2d7['count']=_0x4a2431;if(_0x337638['query'][_0x4380('0x58')]){_0x2c9c5d[_0x4380('0x5c')]=[{'all':!![]}];}return db['CannedAnswer'][_0x4380('0x59')](_0x2c9c5d);})[_0x4380('0x20')](function(_0x1bdb8a){_0x61c2d7[_0x4380('0x69')]=_0x1bdb8a;return _0x61c2d7;});}})[_0x4380('0x20')](respondWithFilteredResult(_0x4eb479,_0x2c9c5d))[_0x4380('0x2b')](handleError(_0x4eb479,null));};exports['removeAnswers']=function(_0x1ca07a,_0x3b4531,_0x38cd3a){return db['MailAccount'][_0x4380('0x5e')]({'where':{'id':_0x1ca07a[_0x4380('0x5a')]['id']}})[_0x4380('0x20')](handleEntityNotFound(_0x3b4531,null))[_0x4380('0x20')](function(_0x1dc473){if(_0x1dc473){return _0x1dc473[_0x4380('0x70')](_0x1ca07a['query'][_0x4380('0x71')]);}})['then'](respondWithStatusCode(_0x3b4531,null))[_0x4380('0x2b')](handleError(_0x3b4531,null));};exports[_0x4380('0x66')]=function(_0x14c732,_0x3d2c12){var _0x5e97da={'name':_0x14c732[_0x4380('0x5f')][_0x4380('0x3e')],'key':_0x14c732['body'][_0x4380('0x49')],'email':_0x14c732['body'][_0x4380('0x72')],'ListId':_0x14c732['body'][_0x4380('0x73')],'active':!_[_0x4380('0x74')](_0x14c732[_0x4380('0x5f')][_0x4380('0x75')])?_0x14c732[_0x4380('0x5f')][_0x4380('0x75')]:!![],'description':_0x14c732[_0x4380('0x5f')][_0x4380('0x76')]||null,'Imap':{},'Smtp':{}};if(_[_0x4380('0x74')](_0x14c732[_0x4380('0x5f')]['cservice'])){if(_0x14c732[_0x4380('0x5f')][_0x4380('0x77')]){_0x5e97da[_0x4380('0x41')][_0x4380('0x78')]=_0x5e97da[_0x4380('0x42')]['user']=_0x14c732['body'][_0x4380('0x79')];_0x5e97da[_0x4380('0x41')][_0x4380('0x7a')]=_0x5e97da['Smtp'][_0x4380('0x7b')]=_0x14c732[_0x4380('0x5f')][_0x4380('0x7c')];}else{_0x5e97da['Imap'][_0x4380('0x7d')]=_0x5e97da[_0x4380('0x42')][_0x4380('0x7d')]=![];}_0x5e97da['Imap'][_0x4380('0x7e')]=_0x14c732[_0x4380('0x5f')]['Imap'][_0x4380('0x7e')];_0x5e97da[_0x4380('0x41')]['port']=_0x14c732[_0x4380('0x5f')][_0x4380('0x41')][_0x4380('0x7f')];_0x5e97da['Smtp'][_0x4380('0x7e')]=_0x14c732[_0x4380('0x5f')][_0x4380('0x42')]['host'];_0x5e97da['Smtp'][_0x4380('0x7f')]=_0x14c732[_0x4380('0x5f')][_0x4380('0x42')]['port'];}else{_0x5e97da[_0x4380('0x41')][_0x4380('0x80')]=_0x5e97da[_0x4380('0x42')][_0x4380('0x80')]=_0x14c732[_0x4380('0x5f')]['cservice'];_0x5e97da[_0x4380('0x41')][_0x4380('0x78')]=_0x5e97da[_0x4380('0x42')][_0x4380('0x78')]=_0x14c732[_0x4380('0x5f')][_0x4380('0x79')];_0x5e97da[_0x4380('0x41')][_0x4380('0x7a')]=_0x5e97da[_0x4380('0x42')][_0x4380('0x7b')]=_0x14c732['body'][_0x4380('0x7c')];}return db[_0x4380('0x45')][_0x4380('0x66')](_0x5e97da,{'include':[{'model':db['MailServerOut'],'as':_0x4380('0x42')},{'model':db['MailServerIn'],'as':_0x4380('0x41')}]})['then'](function(_0x4ea38c){var _0x3d7f5e=_0x14c732[_0x4380('0x78')][_0x4380('0x3a')]({'plain':!![]});if(!_0x3d7f5e)throw new Error(_0x4380('0x81'));if(_0x3d7f5e[_0x4380('0x82')]===_0x4380('0x78')){var _0x497af7=_0x4ea38c[_0x4380('0x3a')]({'plain':!![]});return db[_0x4380('0x83')][_0x4380('0x5e')]({'where':{'name':_0x4380('0x3b'),'userProfileId':_0x3d7f5e[_0x4380('0x84')]},'raw':!![]})[_0x4380('0x20')](function(_0x3a2b72){if(_0x3a2b72&&_0x3a2b72[_0x4380('0x85')]===0x0){return db[_0x4380('0x3c')][_0x4380('0x66')]({'name':_0x497af7[_0x4380('0x3e')],'resourceId':_0x497af7['id'],'type':_0x3a2b72['name'],'sectionId':_0x3a2b72['id']},{})[_0x4380('0x20')](function(){return _0x4ea38c;});}else{return _0x4ea38c;}})[_0x4380('0x2b')](function(_0x5abdc5){logger[_0x4380('0x27')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x5abdc5);throw _0x5abdc5;});}return _0x4ea38c;})[_0x4380('0x20')](respondWithResult(_0x3d2c12,0xc9))[_0x4380('0x2b')](handleError(_0x3d2c12,null));};exports[_0x4380('0x86')]=function(_0x48387e,_0x12a21a,_0x242c8f){return db[_0x4380('0x45')][_0x4380('0x68')]({'where':{'id':_0x48387e[_0x4380('0x5a')]['id']}})[_0x4380('0x20')](handleEntityNotFound(_0x12a21a,null))['then'](function(_0x119759){if(_0x119759){return _0x119759['getImap']();}return null;})[_0x4380('0x20')](respondWithResult(_0x12a21a,null))[_0x4380('0x2b')](handleError(_0x12a21a,null));};exports[_0x4380('0x87')]=function(_0x2c195c,_0x552f55,_0x132c20){if(_0x2c195c[_0x4380('0x5f')]['id']){delete _0x2c195c[_0x4380('0x5f')]['id'];}return db[_0x4380('0x45')][_0x4380('0x5e')]({'where':{'id':_0x2c195c[_0x4380('0x5a')]['id']}})[_0x4380('0x20')](handleEntityNotFound(_0x552f55,null))[_0x4380('0x20')](function(_0x3319c0){if(_0x3319c0){_0x2c195c[_0x4380('0x5f')][_0x4380('0x64')]=_0x3319c0['id'];return db[_0x4380('0x5b')][_0x4380('0x66')](_0x2c195c[_0x4380('0x5f')]);}})[_0x4380('0x20')](respondWithResult(_0x552f55,null))[_0x4380('0x2b')](handleError(_0x552f55,null));};exports[_0x4380('0x88')]=function(_0xb2aa9,_0x49dbfe,_0x11da8f){return db[_0x4380('0x45')][_0x4380('0x68')]({'where':{'id':_0xb2aa9[_0x4380('0x5a')]['id']}})[_0x4380('0x20')](handleEntityNotFound(_0x49dbfe,null))[_0x4380('0x20')](function(_0x2f1b9c){if(_0x2f1b9c){return _0x2f1b9c['setImap'](null);}return null;})[_0x4380('0x20')](respondWithStatusCode(_0x49dbfe,null))[_0x4380('0x2b')](handleError(_0x49dbfe,null));};exports[_0x4380('0x89')]=function(_0x4ca00f,_0x1da0d8,_0x59f1b4){return db[_0x4380('0x45')][_0x4380('0x68')]({'where':{'id':_0x4ca00f[_0x4380('0x5a')]['id']}})[_0x4380('0x20')](handleEntityNotFound(_0x1da0d8,null))['then'](function(_0x2f53a2){if(_0x2f53a2){return _0x2f53a2[_0x4380('0x89')]();}return null;})[_0x4380('0x20')](respondWithResult(_0x1da0d8,null))[_0x4380('0x2b')](handleError(_0x1da0d8,null));};exports[_0x4380('0x8a')]=function(_0x5cd1a2,_0x56db52,_0x5126f0){if(_0x5cd1a2[_0x4380('0x5f')]['id']){delete _0x5cd1a2['body']['id'];}return db[_0x4380('0x45')][_0x4380('0x5e')]({'where':{'id':_0x5cd1a2[_0x4380('0x5a')]['id']}})[_0x4380('0x20')](handleEntityNotFound(_0x56db52,null))[_0x4380('0x20')](function(_0x39954c){if(_0x39954c){_0x5cd1a2['body'][_0x4380('0x64')]=_0x39954c['id'];return db[_0x4380('0x60')]['create'](_0x5cd1a2[_0x4380('0x5f')]);}})[_0x4380('0x20')](respondWithResult(_0x56db52,null))['catch'](handleError(_0x56db52,null));};exports[_0x4380('0x8b')]=function(_0x21513f,_0x18c821,_0x58dc48){return db[_0x4380('0x45')]['findOne']({'where':{'id':_0x21513f[_0x4380('0x5a')]['id']}})[_0x4380('0x20')](handleEntityNotFound(_0x18c821,null))[_0x4380('0x20')](function(_0x28924c){if(_0x28924c){return _0x28924c[_0x4380('0x8c')](null);}return null;})[_0x4380('0x20')](respondWithStatusCode(_0x18c821,null))[_0x4380('0x2b')](handleError(_0x18c821,null));};exports[_0x4380('0x8d')]=function(_0x50dcad,_0x38a207,_0x5d0da6){return db[_0x4380('0x8e')][_0x4380('0x5e')]({'where':{'id':_0x50dcad[_0x4380('0x5a')]['id']}})[_0x4380('0x20')](handleEntityNotFound(_0x38a207,null))[_0x4380('0x20')](function(_0x44e303){if(_0x44e303){return _0x44e303['addInteraction'](_0x50dcad[_0x4380('0x5f')]['ids'],_['omit'](_0x50dcad['body'],[_0x4380('0x71'),'id'])||{});}})[_0x4380('0x20')](respondWithResult(_0x38a207,null))[_0x4380('0x2b')](handleError(_0x38a207,null));};exports[_0x4380('0x8f')]=function(_0x9d897f,_0x1ebb55,_0x1dfa37){var _0x12d94d={'raw':![],'where':{}};var _0x1bbe76={};var _0x3be565={'count':0x0,'rows':[]};return db[_0x4380('0x45')][_0x4380('0x68')]({'where':{'id':_0x9d897f[_0x4380('0x5a')]['id']}})[_0x4380('0x20')](handleEntityNotFound(_0x1ebb55,null))[_0x4380('0x20')](function(_0x2e5b11){if(_0x2e5b11){_0x1bbe76[_0x4380('0x4a')]=_[_0x4380('0x4c')](db['MailInteraction'][_0x4380('0x46')]);_0x1bbe76[_0x4380('0x4b')]=_[_0x4380('0x4c')](_0x9d897f[_0x4380('0x4b')]);_0x1bbe76[_0x4380('0x4d')]=_['intersection'](_0x1bbe76[_0x4380('0x4a')],_0x1bbe76[_0x4380('0x4b')]);_0x12d94d[_0x4380('0x4e')]=_['intersection'](_0x1bbe76[_0x4380('0x4a')],qs[_0x4380('0x50')](_0x9d897f[_0x4380('0x4b')]['fields']));_0x12d94d['attributes']=_0x12d94d['attributes']['length']?_0x12d94d[_0x4380('0x4e')]:_0x1bbe76[_0x4380('0x4a')];if(!_0x9d897f[_0x4380('0x4b')]['hasOwnProperty']('nolimit')){_0x12d94d[_0x4380('0x32')]=qs[_0x4380('0x32')](_0x9d897f[_0x4380('0x4b')][_0x4380('0x32')]);_0x12d94d[_0x4380('0x31')]=qs[_0x4380('0x31')](_0x9d897f[_0x4380('0x4b')][_0x4380('0x31')]);}_0x12d94d['order']=qs[_0x4380('0x53')](_0x9d897f[_0x4380('0x4b')][_0x4380('0x53')]);_0x12d94d[_0x4380('0x54')]=qs[_0x4380('0x4d')](_[_0x4380('0x55')](_0x9d897f[_0x4380('0x4b')],_0x1bbe76[_0x4380('0x4d')]));_0x12d94d[_0x4380('0x54')][_0x4380('0x64')]=_0x2e5b11['id'];if(_0x9d897f[_0x4380('0x4b')][_0x4380('0x56')]){_0x12d94d[_0x4380('0x54')]=_['merge'](_0x12d94d[_0x4380('0x54')],{'$or':_[_0x4380('0x44')](_0x12d94d['attributes'],function(_0xdb2044){var _0x1aa305={};_0x1aa305[_0xdb2044]={'$like':'%'+_0x9d897f[_0x4380('0x4b')][_0x4380('0x56')]+'%'};return _0x1aa305;})});}_0x12d94d=_[_0x4380('0x57')]({},_0x12d94d,_0x9d897f[_0x4380('0x5d')]);return db['MailInteraction'][_0x4380('0x30')]({'where':_0x12d94d[_0x4380('0x54')]})[_0x4380('0x20')](function(_0x30b9e7){_0x3be565[_0x4380('0x30')]=_0x30b9e7;if(_0x9d897f[_0x4380('0x4b')][_0x4380('0x58')]){_0x12d94d[_0x4380('0x5c')]=[{'model':db[_0x4380('0x90')],'as':'Contact','required':![]},{'model':db[_0x4380('0x91')],'as':_0x4380('0x92'),'attributes':[_0x4380('0x3e'),_0x4380('0x93'),_0x4380('0x94')],'required':![]},{'model':db[_0x4380('0x95')],'as':'Tags','attributes':['id',_0x4380('0x3e'),_0x4380('0x96')],'where':_0x9d897f[_0x4380('0x4b')][_0x4380('0x97')]?{'id':_0x9d897f['query']['tag']}:undefined,'required':_0x9d897f[_0x4380('0x4b')]['tag']?!![]:![]}];}return db['MailInteraction'][_0x4380('0x59')](_0x12d94d);})['then'](function(_0x11ff8d){_0x3be565[_0x4380('0x69')]=_0x11ff8d;return _0x3be565;});}})[_0x4380('0x20')](respondWithFilteredResult(_0x1ebb55,_0x12d94d))[_0x4380('0x2b')](handleError(_0x1ebb55,null));};exports[_0x4380('0x98')]=function(_0x290529,_0x437352,_0x18957f){return db[_0x4380('0x45')][_0x4380('0x68')]({'where':{'id':_0x290529['params']['id']}})['then'](handleEntityNotFound(_0x437352,null))[_0x4380('0x20')](function(_0x3f7fe0){if(_0x3f7fe0){return db[_0x4380('0x99')][_0x4380('0x9a')](function(_0x562adf){return db[_0x4380('0x9b')][_0x4380('0x39')]({'where':{'MailAccountId':_0x290529[_0x4380('0x5a')]['id']},'transaction':_0x562adf})[_0x4380('0x20')](function(_0x4b1fb3){var _0xec4486=_[_0x4380('0x44')](_0x290529[_0x4380('0x5f')],function(_0x36b55f){_0x36b55f['MailAccountId']=_0x290529[_0x4380('0x5a')]['id'];return _0x36b55f;});return db[_0x4380('0x9b')][_0x4380('0x9c')](_0xec4486,{'transaction':_0x562adf});});})[_0x4380('0x20')](function(){return db[_0x4380('0x9b')][_0x4380('0x9d')]({'where':{'MailAccountId':_0x290529['params']['id']},'order':_0x4380('0x9e')});});}})['then'](respondWithResult(_0x437352,null))[_0x4380('0x2b')](handleError(_0x437352,null));};exports['getApplications']=function(_0xc22828,_0x5e8015,_0x23271b){var _0x5326d2={};var _0x5edf2c={};var _0x589c7f;var _0x45e096;return db[_0x4380('0x45')][_0x4380('0x68')]({'where':{'id':_0xc22828[_0x4380('0x5a')]['id']}})[_0x4380('0x20')](handleEntityNotFound(_0x5e8015,null))[_0x4380('0x20')](function(_0x2c1699){if(_0x2c1699){_0x589c7f=_0x2c1699;_0x5edf2c[_0x4380('0x4a')]=_[_0x4380('0x4c')](db[_0x4380('0x9b')][_0x4380('0x46')]);_0x5edf2c['query']=_['keys'](_0xc22828[_0x4380('0x4b')]);_0x5edf2c[_0x4380('0x4d')]=_[_0x4380('0x4f')](_0x5edf2c[_0x4380('0x4a')],_0x5edf2c['query']);_0x5326d2[_0x4380('0x4e')]=_[_0x4380('0x4f')](_0x5edf2c[_0x4380('0x4a')],qs[_0x4380('0x50')](_0xc22828[_0x4380('0x4b')][_0x4380('0x50')]));_0x5326d2['attributes']=_0x5326d2[_0x4380('0x4e')][_0x4380('0x51')]?_0x5326d2[_0x4380('0x4e')]:_0x5edf2c[_0x4380('0x4a')];_0x5326d2[_0x4380('0x6f')]=qs['sort'](_0xc22828[_0x4380('0x4b')][_0x4380('0x53')]);_0x5326d2[_0x4380('0x54')]=qs[_0x4380('0x4d')](_[_0x4380('0x55')](_0xc22828[_0x4380('0x4b')],_0x5edf2c['filters']));if(_0xc22828[_0x4380('0x4b')]['filter']){_0x5326d2[_0x4380('0x54')]=_['merge'](_0x5326d2[_0x4380('0x54')],{'$or':_[_0x4380('0x44')](_0x5326d2[_0x4380('0x4e')],function(_0x595c8d){var _0x2133ba={};_0x2133ba[_0x595c8d]={'$like':'%'+_0xc22828[_0x4380('0x4b')][_0x4380('0x56')]+'%'};return _0x2133ba;})});}_0x5326d2=_[_0x4380('0x57')]({},_0x5326d2,_0xc22828[_0x4380('0x5d')]);return _0x589c7f['getApplications'](_0x5326d2);}})[_0x4380('0x20')](function(_0x4a1cbd){if(_0x4a1cbd){_0x45e096=_0x4a1cbd[_0x4380('0x51')];if(!_0xc22828[_0x4380('0x4b')][_0x4380('0x52')](_0x4380('0x6e'))){_0x5326d2[_0x4380('0x32')]=qs[_0x4380('0x32')](_0xc22828[_0x4380('0x4b')][_0x4380('0x32')]);_0x5326d2[_0x4380('0x31')]=qs[_0x4380('0x31')](_0xc22828[_0x4380('0x4b')][_0x4380('0x31')]);}return _0x589c7f[_0x4380('0x9f')](_0x5326d2);}})[_0x4380('0x20')](function(_0x369f97){if(_0x369f97){return _0x369f97?{'count':_0x45e096,'rows':_0x369f97}:null;}})[_0x4380('0x20')](respondWithResult(_0x5e8015,null))[_0x4380('0x2b')](handleError(_0x5e8015,null));};exports[_0x4380('0xa0')]=function(_0x33493c,_0x4719a0,_0x8e5d8f){var _0x2bbf69={'raw':!![],'where':{}};var _0xa775b3={};var _0x42cefd={'count':0x0,'rows':[]};return db['MailAccount'][_0x4380('0x68')]({'where':{'id':_0x33493c[_0x4380('0x5a')]['id']}})[_0x4380('0x20')](handleEntityNotFound(_0x4719a0,null))[_0x4380('0x20')](function(_0x188ab0){if(_0x188ab0){_0xa775b3[_0x4380('0x4a')]=_[_0x4380('0x4c')](db[_0x4380('0xa1')][_0x4380('0x46')]);_0xa775b3['query']=_['keys'](_0x33493c['query']);_0xa775b3[_0x4380('0x4d')]=_[_0x4380('0x4f')](_0xa775b3[_0x4380('0x4a')],_0xa775b3[_0x4380('0x4b')]);_0x2bbf69[_0x4380('0x4e')]=_[_0x4380('0x4f')](_0xa775b3[_0x4380('0x4a')],qs[_0x4380('0x50')](_0x33493c[_0x4380('0x4b')]['fields']));_0x2bbf69[_0x4380('0x4e')]=_0x2bbf69[_0x4380('0x4e')][_0x4380('0x51')]?_0x2bbf69[_0x4380('0x4e')]:_0xa775b3['model'];if(!_0x33493c[_0x4380('0x4b')][_0x4380('0x52')](_0x4380('0x6e'))){_0x2bbf69[_0x4380('0x32')]=qs[_0x4380('0x32')](_0x33493c[_0x4380('0x4b')][_0x4380('0x32')]);_0x2bbf69['offset']=qs[_0x4380('0x31')](_0x33493c[_0x4380('0x4b')][_0x4380('0x31')]);}_0x2bbf69[_0x4380('0x6f')]=qs[_0x4380('0x53')](_0x33493c['query']['sort']);_0x2bbf69[_0x4380('0x54')]=qs[_0x4380('0x4d')](_[_0x4380('0x55')](_0x33493c[_0x4380('0x4b')],_0xa775b3[_0x4380('0x4d')]));_0x2bbf69[_0x4380('0x54')][_0x4380('0x64')]=_0x188ab0['id'];if(_0x33493c[_0x4380('0x4b')]['filter']){_0x2bbf69['where']=_[_0x4380('0x57')](_0x2bbf69[_0x4380('0x54')],{'$or':_['map'](_0x2bbf69[_0x4380('0x4e')],function(_0x4ab3f6){var _0x5465d1={};_0x5465d1[_0x4ab3f6]={'$like':'%'+_0x33493c[_0x4380('0x4b')][_0x4380('0x56')]+'%'};return _0x5465d1;})});}if(_0x33493c[_0x4380('0x4b')][_0x4380('0xa2')]){var _0x4786e9=_0x33493c[_0x4380('0x4b')][_0x4380('0xa2')][_0x4380('0xa3')](',');var _0x1a72f6={};_0x1a72f6[_0x4786e9[0x0]]={'$gte':moment(_0x4786e9[0x1])[_0x4380('0xa4')](_0x4380('0xa5'))};_0x2bbf69[_0x4380('0x54')]=_[_0x4380('0x57')](_0x2bbf69['where'],_0x1a72f6);}_0x2bbf69=_[_0x4380('0x57')]({},_0x2bbf69,_0x33493c['options']);return db[_0x4380('0xa1')][_0x4380('0x30')]({'where':_0x2bbf69[_0x4380('0x54')]})['then'](function(_0x4978d1){_0x42cefd[_0x4380('0x30')]=_0x4978d1;if(_0x33493c[_0x4380('0x4b')][_0x4380('0x58')]){_0x2bbf69[_0x4380('0x5c')]=[{'all':!![]}];}return db['MailMessage'][_0x4380('0x59')](_0x2bbf69);})[_0x4380('0x20')](function(_0x405e61){_0x42cefd[_0x4380('0x69')]=_0x405e61;return _0x42cefd;});}})['then'](respondWithFilteredResult(_0x4719a0,_0x2bbf69))[_0x4380('0x2b')](handleError(_0x4719a0,null));};exports[_0x4380('0x3f')]=function(_0x43d5e0,_0x278bd2,_0x2ce365){var _0x15bce6,_0xdd271={},_0x53640f;if(_0x43d5e0[_0x4380('0x5f')]['to']){_0x53640f=_0x43d5e0['body']['to'][_0x4380('0xa3')](',')[0x0];}return db['MailAccount'][_0x4380('0x5e')]({'where':{'id':_0x43d5e0[_0x4380('0x5a')]['id']},'include':[{'model':db[_0x4380('0xa6')],'as':_0x4380('0xa7'),'include':[{'model':db[_0x4380('0x90')],'as':_0x4380('0xa8'),'where':{'email':_0x53640f},'limit':0x1,'order':[[_0x4380('0xa9'),'DESC']]}]},{'model':db['MailServerOut'],'as':_0x4380('0x42'),'raw':!![]}]})[_0x4380('0x20')](handleEntityNotFound(_0x278bd2,null))['then'](function(_0x3f1293){if(_0x3f1293){_0x15bce6=_0x3f1293;if(_0x3f1293[_0x4380('0x42')]){if(_[_0x4380('0x74')](_0x43d5e0['body']['from'])){_0x43d5e0['body'][_0x4380('0xaa')]=util[_0x4380('0xa4')](_0x4380('0xab'),_0x3f1293[_0x4380('0x3e')],_0x3f1293[_0x4380('0x72')]||_0x3f1293['Smtp']['user']);}if(_0x43d5e0[_0x4380('0x5f')][_0x4380('0xac')]&&_0x43d5e0['body'][_0x4380('0xac')][_0x4380('0x51')]){for(var _0xb2bcd0=0x0;_0xb2bcd0<_0x43d5e0[_0x4380('0x5f')][_0x4380('0xac')][_0x4380('0x51')];_0xb2bcd0+=0x1){_0x43d5e0['body'][_0x4380('0xac')][_0xb2bcd0]={'filename':_0x43d5e0[_0x4380('0x5f')][_0x4380('0xac')][_0xb2bcd0][_0x4380('0x3e')],'path':path[_0x4380('0xad')](config['root'],_0x4380('0xae'),_0x43d5e0[_0x4380('0x5f')][_0x4380('0xac')][_0xb2bcd0]['basename'])};}}var _0x4c2ec0={'tls':{'rejectUnauthorized':![]}};if(_[_0x4380('0x74')](_0x3f1293[_0x4380('0x42')][_0x4380('0x80')])){if(_0x3f1293['Smtp'][_0x4380('0x7d')]){_0x4c2ec0['auth']={'user':_0x3f1293['Smtp'][_0x4380('0x78')],'pass':_0x3f1293[_0x4380('0x42')][_0x4380('0x7b')]};}_0x4c2ec0[_0x4380('0x7e')]=_0x3f1293[_0x4380('0x42')][_0x4380('0x7e')];_0x4c2ec0[_0x4380('0x7f')]=_0x3f1293[_0x4380('0x42')][_0x4380('0x7f')];_0x4c2ec0[_0x4380('0xaf')]=_0x3f1293['Smtp']['secure'];}else{_0x4c2ec0['service']=_0x3f1293['Smtp'][_0x4380('0x80')];_0x4c2ec0['auth']={'user':_0x3f1293[_0x4380('0x42')][_0x4380('0x78')],'pass':_0x3f1293[_0x4380('0x42')][_0x4380('0x7b')]};}return respondWithRpcPromise(_0x4380('0xb0'),_0x4380('0xb1'),{'account':_0x4c2ec0,'message':_0x43d5e0[_0x4380('0x5f')]});}else{throw new Error(_0x4380('0xb2'));}}})[_0x4380('0x20')](function(_0x1022bf){if(_0x1022bf){_0xdd271=_0x1022bf;if(_0x15bce6[_0x4380('0xa7')]){if(_0x15bce6[_0x4380('0xa7')][_0x4380('0xa8')]['length']){return _0x15bce6[_0x4380('0xa7')][_0x4380('0xa8')][0x0];}else{return db[_0x4380('0x90')][_0x4380('0x66')](_[_0x4380('0x17')](_0x43d5e0[_0x4380('0x5f')],{'firstName':_0x43d5e0[_0x4380('0x5f')]['to'],'email':_0x43d5e0[_0x4380('0x5f')]['to'],'phone':_0x43d5e0[_0x4380('0x5f')]['to'],'ListId':_0x15bce6[_0x4380('0x73')]}));}}else{throw new Error('List\x20not\x20found');}}})[_0x4380('0x20')](function(_0x438a1f){if(_0x438a1f){var _0x4b6882={'UserId':_0x43d5e0[_0x4380('0x78')]['id'],'ContactId':_0x438a1f['id'],'MailAccountId':_0x15bce6['id'],'inReplyTo':_0xdd271[_0x4380('0xb3')],'to':_0x43d5e0['body'][_0x4380('0xaa')],'cc':_0x43d5e0[_0x4380('0x5f')]['cc'],'subject':_0x43d5e0[_0x4380('0x5f')][_0x4380('0xb4')],'attach':_0x43d5e0[_0x4380('0x5f')]['attach'],'firstMsgDirection':_0x4380('0xb5'),'lastMsgAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'lastMsgDirection':_0x4380('0xb5'),'lastMsgBody':_0x43d5e0['body'][_0x4380('0x5f')],'Messages':[_['merge'](_0x43d5e0[_0x4380('0x5f')],{'messageId':_0xdd271[_0x4380('0xb3')],'sentAt':moment()[_0x4380('0xa4')](_0x4380('0xa5')),'read':!![],'MailAccountId':_0x15bce6['id'],'UserId':_0x43d5e0[_0x4380('0x78')]['id'],'ContactId':_0x438a1f['id']})]};if(_0x43d5e0['body'][_0x4380('0xb6')]){_0x4b6882=_[_0x4380('0x57')](_0x4b6882,_0x43d5e0['body'][_0x4380('0xb6')]);}return db[_0x4380('0x8e')]['create'](_0x4b6882,{'include':[{'model':db[_0x4380('0xa1')],'as':_0x4380('0xb7')}]});}})[_0x4380('0x20')](respondWithResult(_0x278bd2,null))[_0x4380('0x2b')](handleError(_0x278bd2,null));};exports[_0x4380('0xb8')]=function(_0x49ae68,_0x31eb98,_0x158edc){return db[_0x4380('0x45')]['find']({'where':{'id':_0x49ae68[_0x4380('0x5a')]['id']},'include':[{'model':db[_0x4380('0x60')],'as':_0x4380('0x42'),'raw':!![]}]})[_0x4380('0x20')](handleEntityNotFound(_0x31eb98,null))[_0x4380('0x20')](function(_0x5b78b0){if(_0x5b78b0&&_0x5b78b0[_0x4380('0x42')]){var _0x3edb88={'id':_0x5b78b0['id'],'tls':{'rejectUnauthorized':![]}};if(_0x5b78b0[_0x4380('0x42')]['service']){_0x3edb88[_0x4380('0x80')]=_0x5b78b0[_0x4380('0x42')]['service'];}else{_0x3edb88[_0x4380('0x7e')]=_0x5b78b0[_0x4380('0x42')][_0x4380('0x7e')];_0x3edb88[_0x4380('0x7f')]=_0x5b78b0['Smtp'][_0x4380('0x7f')];_0x3edb88['secure']=_0x5b78b0['Smtp'][_0x4380('0xaf')];}if(_0x5b78b0['Smtp'][_0x4380('0x7d')]){_0x3edb88[_0x4380('0xb9')]={'user':_0x5b78b0[_0x4380('0x42')]['user'],'pass':_0x5b78b0['Smtp'][_0x4380('0x7b')]};}return respondWithRpcPromise(_0x4380('0xba'),_0x4380('0xb8'),{'account':_0x3edb88});}})[_0x4380('0x20')](respondWithResult(_0x31eb98,null))[_0x4380('0x2b')](handleError(_0x31eb98,null));};exports['destroy']=function(_0x36f44a,_0x15294c){return db[_0x4380('0x45')][_0x4380('0x5e')]({'where':{'id':_0x36f44a[_0x4380('0x5a')]['id']}})[_0x4380('0x20')](handleEntityNotFound(_0x15294c,null))[_0x4380('0x20')](function(_0xa1006e){if(_0xa1006e&&_0xa1006e['service']){throw new db[(_0x4380('0x1e'))][(_0x4380('0xbb'))](_0x4380('0xbc'));}return _0xa1006e;})[_0x4380('0x20')](removeEntity(_0x15294c,null))[_0x4380('0x2b')](handleError(_0x15294c,null));};exports[_0x4380('0xbd')]=function(_0x4936e7,_0x441213,_0x5a58ea){return db[_0x4380('0x45')]['find']({'where':{'id':_0x4936e7['params']['id']}})[_0x4380('0x20')](handleEntityNotFound(_0x441213,null))['then'](function(_0x39c4c3){if(_0x39c4c3){return _0x39c4c3[_0x4380('0xbd')](_0x4936e7['body'][_0x4380('0x71')],_[_0x4380('0xbe')](_0x4936e7[_0x4380('0x5f')],['ids','id'])||{})[_0x4380('0xbf')](function(_0x371d54){for(var _0x31d269=0x0;_0x31d269<_0x4936e7[_0x4380('0x5f')][_0x4380('0x71')]['length'];_0x31d269+=0x1){socket['emit'](_0x4380('0xc0'),{'UserId':_0x4936e7[_0x4380('0x5f')]['ids'][_0x31d269],'MailAccountId':_0x4936e7[_0x4380('0x5a')]['id']});}return _0x371d54;});}})[_0x4380('0x20')](respondWithResult(_0x441213,null))[_0x4380('0x2b')](handleError(_0x441213,null));};exports[_0x4380('0xc1')]=function(_0x275b17,_0x46d69f,_0x48af5c){return db[_0x4380('0x45')][_0x4380('0x5e')]({'where':{'id':_0x275b17['params']['id']}})[_0x4380('0x20')](handleEntityNotFound(_0x46d69f,null))['then'](function(_0x20310f){if(_0x20310f){return _0x20310f['removeAgents'](_0x275b17[_0x4380('0x4b')][_0x4380('0x71')])[_0x4380('0x20')](function(){if(_[_0x4380('0xc2')](_0x275b17['query'][_0x4380('0x71')])){for(var _0x33c3c9=0x0;_0x33c3c9<_0x275b17[_0x4380('0x4b')][_0x4380('0x71')][_0x4380('0x51')];_0x33c3c9+=0x1){socket[_0x4380('0xc3')]('userMailAccount:remove',{'UserId':Number(_0x275b17[_0x4380('0x4b')][_0x4380('0x71')][_0x33c3c9]),'MailAccountId':Number(_0x275b17[_0x4380('0x5a')]['id'])});}}else{socket[_0x4380('0xc3')]('userMailAccount:remove',{'UserId':Number(_0x275b17['query']['ids']),'MailAccountId':Number(_0x275b17[_0x4380('0x5a')]['id'])});}});}})[_0x4380('0x20')](respondWithStatusCode(_0x46d69f,null))[_0x4380('0x2b')](handleError(_0x46d69f,null));};exports[_0x4380('0xc4')]=function(_0x23a726,_0x1bcb79,_0x176f52){var _0x4c5748={};var _0x28b845={};var _0x4bd2ac;var _0x58ac79;return db[_0x4380('0x45')][_0x4380('0x68')]({'where':{'id':_0x23a726[_0x4380('0x5a')]['id']}})[_0x4380('0x20')](handleEntityNotFound(_0x1bcb79,null))[_0x4380('0x20')](function(_0x5cc371){if(_0x5cc371){_0x4bd2ac=_0x5cc371;_0x28b845['model']=_[_0x4380('0x4c')](db['User'][_0x4380('0x46')]);_0x28b845[_0x4380('0x4b')]=_[_0x4380('0x4c')](_0x23a726[_0x4380('0x4b')]);_0x28b845[_0x4380('0x4d')]=_[_0x4380('0x4f')](_0x28b845[_0x4380('0x4a')],_0x28b845['query']);_0x4c5748[_0x4380('0x4e')]=_[_0x4380('0x4f')](_0x28b845[_0x4380('0x4a')],qs[_0x4380('0x50')](_0x23a726[_0x4380('0x4b')][_0x4380('0x50')]));_0x4c5748[_0x4380('0x4e')]=_0x4c5748[_0x4380('0x4e')][_0x4380('0x51')]?_0x4c5748[_0x4380('0x4e')]:_0x28b845['model'];_0x4c5748[_0x4380('0x6f')]=qs['sort'](_0x23a726[_0x4380('0x4b')]['sort']);_0x4c5748[_0x4380('0x54')]=qs['filters'](_[_0x4380('0x55')](_0x23a726[_0x4380('0x4b')],_0x28b845[_0x4380('0x4d')]));if(_0x23a726[_0x4380('0x4b')][_0x4380('0x56')]){_0x4c5748[_0x4380('0x54')]=_[_0x4380('0x57')](_0x4c5748['where'],{'$or':_[_0x4380('0x44')](_0x4c5748[_0x4380('0x4e')],function(_0x2da06c){var _0x56f073={};_0x56f073[_0x2da06c]={'$like':'%'+_0x23a726[_0x4380('0x4b')][_0x4380('0x56')]+'%'};return _0x56f073;})});}_0x4c5748=_[_0x4380('0x57')]({},_0x4c5748,_0x23a726[_0x4380('0x5d')]);return _0x4bd2ac['getAgents'](_0x4c5748);}})[_0x4380('0x20')](function(_0x3015c2){if(_0x3015c2){_0x58ac79=_0x3015c2[_0x4380('0x51')];if(!_0x23a726['query'][_0x4380('0x52')](_0x4380('0x6e'))){_0x4c5748['limit']=qs[_0x4380('0x32')](_0x23a726[_0x4380('0x4b')][_0x4380('0x32')]);_0x4c5748[_0x4380('0x31')]=qs['offset'](_0x23a726[_0x4380('0x4b')]['offset']);}return _0x4bd2ac['getAgents'](_0x4c5748);}})['then'](function(_0x17a514){if(_0x17a514){return _0x17a514?{'count':_0x58ac79,'rows':_0x17a514}:null;}})[_0x4380('0x20')](respondWithResult(_0x1bcb79,null))[_0x4380('0x2b')](handleError(_0x1bcb79,null));}; \ No newline at end of file +var _0x6188=['bulkCreate','findAndCountAll','getApplications','getMessages','MailMessage','$gte','split','format','CmList','List','Contacts','DESC','from','%s\x20<%s>','email','attachments','join','root','server/files/attachments','basename','auth','secure','SendMail','List\x20not\x20found','messageId','attach','YYYY-MM-DD\x20HH:mm:ss','Interaction','Messages','VerifySmtp','verifySmtp','Sequelize','You\x20can\x27t\x20remove\x20the\x20mail\x20service\x20account','addAgents','spread','emit','userMailAccount:save','removeAgents','isArray','userMailAccount:remove','getAgents','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','path','sox','to-csv','ejs','lodash','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','redis','defaults','localhost','socket.io-emitter','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','info','MailAccount,\x20%s,\x20%s','request\x20sent','debug','MailAccount,\x20%s,\x20%s,\x20%s','error','code','message','catch','sendStatus','end','status','json','count','offset','limit','set','Content-Range','apply','reject','update','then','destroy','get','MailAccounts','UserProfileResource','name','send','MailServerIn','Imap','Smtp','Pause','mandatoryDispositionPause','map','MailAccount','rawAttributes','fieldName','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','order','sort','pick','filter','where','merge','type','VIRTUAL','options','includeAll','findAll','rows','show','params','MailServerOut','include','find','body','describe','MailAccountId','Disposition','create','getDispositions','findOne','nolimit','removeDispositions','addAnswer','CannedAnswer','getAnswers','removeAnswers','ids','ListId','isNil','active','description','cservice','user','cuser','pass','cpassword','authentication','host','port','service','password','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getImap','addImap','removeImap','setImap','getSmtp','removeSmtp','setSmtp','addInteraction','omit','getInteractions','MailInteraction','CmContact','Contact','User','Owner','internal','Tag','Tags','color','tag','sequelize','transaction','MailApplication'];(function(_0x4c6a7f,_0x452cf6){var _0x1a5474=function(_0x5531ee){while(--_0x5531ee){_0x4c6a7f['push'](_0x4c6a7f['shift']());}};_0x1a5474(++_0x452cf6);}(_0x6188,0x1af));var _0x8618=function(_0x5db313,_0x3c8f0c){_0x5db313=_0x5db313-0x0;var _0x36d503=_0x6188[_0x5db313];return _0x36d503;};'use strict';var pdf=require(_0x8618('0x0'));var emlformat=require(_0x8618('0x1'));var rimraf=require(_0x8618('0x2'));var zipdir=require(_0x8618('0x3'));var jsonpatch=require(_0x8618('0x4'));var rp=require(_0x8618('0x5'));var moment=require(_0x8618('0x6'));var BPromise=require('bluebird');var Mustache=require(_0x8618('0x7'));var util=require('util');var path=require(_0x8618('0x8'));var sox=require(_0x8618('0x9'));var csv=require(_0x8618('0xa'));var ejs=require(_0x8618('0xb'));var fs=require('fs');var _=require(_0x8618('0xc'));var squel=require('squel');var crypto=require(_0x8618('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x8618('0xe'));var toCsv=require(_0x8618('0xa'));var querystring=require(_0x8618('0xf'));var Papa=require('papaparse');var Redis=require(_0x8618('0x10'));var authService=require(_0x8618('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x8618('0x12'));var hardwareService=require(_0x8618('0x13'));var logger=require('../../config/logger')(_0x8618('0x14'));var utils=require('../../config/utils');var config=require(_0x8618('0x15'));var db=require('../../mysqldb')['db'];config[_0x8618('0x16')]=_[_0x8618('0x17')](config[_0x8618('0x16')],{'host':_0x8618('0x18'),'port':0x18eb});var socket=require(_0x8618('0x19'))(new Redis(config[_0x8618('0x16')]));require('./mailAccount.socket')[_0x8618('0x1a')](socket);var jayson=require(_0x8618('0x1b'));var client=jayson[_0x8618('0x1c')][_0x8618('0x1d')]({'port':0x232b});function checkPasswordPattern(_0x5cca72,_0x4a4c7b,_0x28b8e5){if(_0x28b8e5){var _0xa38bec=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0xa38bec['test'](_0x4a4c7b)){return _0x5cca72;}else{throw new db['Sequelize'][(_0x8618('0x1e'))](_0x8618('0x1f'));}}else{return _0x5cca72;}}function respondWithRpcPromise(_0x581341,_0x1ed17c,_0x33c301,_0x2fa10a){return new BPromise(function(_0xcb9890,_0x341b12){var _0x356341=_0x2fa10a||client;return _0x356341[_0x8618('0x20')](_0x581341,_0x33c301)['then'](function(_0x52c683){logger[_0x8618('0x21')](_0x8618('0x22'),_0x1ed17c,_0x8618('0x23'));logger[_0x8618('0x24')](_0x8618('0x25'),_0x1ed17c,_0x8618('0x23'),JSON['stringify'](_0x52c683));if(_0x52c683[_0x8618('0x26')]){if(_0x52c683[_0x8618('0x26')][_0x8618('0x27')]===0x1f4){logger[_0x8618('0x26')](_0x8618('0x22'),_0x1ed17c,_0x52c683[_0x8618('0x26')][_0x8618('0x28')]);return _0x341b12(_0x52c683['error'][_0x8618('0x28')]);}logger[_0x8618('0x26')](_0x8618('0x22'),_0x1ed17c,_0x52c683['error']['message']);return _0xcb9890(_0x52c683['error'][_0x8618('0x28')]);}else{logger[_0x8618('0x21')]('MailAccount,\x20%s,\x20%s',_0x1ed17c,_0x8618('0x23'));_0xcb9890(_0x52c683['result'][_0x8618('0x28')]);}})[_0x8618('0x29')](function(_0x5e6731){logger[_0x8618('0x26')](_0x8618('0x22'),_0x1ed17c,_0x5e6731);_0x341b12(_0x5e6731);});});}function respondWithStatusCode(_0x522330,_0x24d4c9){_0x24d4c9=_0x24d4c9||0xcc;return function(_0x57ca4d){if(_0x57ca4d){return _0x522330[_0x8618('0x2a')](_0x24d4c9);}return _0x522330['status'](_0x24d4c9)[_0x8618('0x2b')]();};}function respondWithResult(_0x44c5f6,_0x31a64a){_0x31a64a=_0x31a64a||0xc8;return function(_0x3f931c){if(_0x3f931c){return _0x44c5f6[_0x8618('0x2c')](_0x31a64a)[_0x8618('0x2d')](_0x3f931c);}};}function respondWithFilteredResult(_0x3dd2d3,_0x397655){return function(_0x304c38){if(_0x304c38){var _0x50acd7=_0x304c38[_0x8618('0x2e')],_0xacc0df=_0x397655[_0x8618('0x2f')],_0x10187f=_0x397655['offset']+_0x397655[_0x8618('0x30')],_0x221ee7;if(_0x10187f>=_0x50acd7){_0x10187f=_0x50acd7;_0x221ee7=0xc8;}else{_0x221ee7=0xce;}_0x3dd2d3[_0x8618('0x2c')](_0x221ee7);return _0x3dd2d3[_0x8618('0x31')](_0x8618('0x32'),_0xacc0df+'-'+_0x10187f+'/'+_0x50acd7)[_0x8618('0x2d')](_0x304c38);}return null;};}function patchUpdates(_0x3d64f8){return function(_0x1a0033){try{jsonpatch[_0x8618('0x33')](_0x1a0033,_0x3d64f8,!![]);}catch(_0x22fc10){return BPromise[_0x8618('0x34')](_0x22fc10);}return _0x1a0033['save']();};}function saveUpdates(_0x23868c,_0x4b93f9){return function(_0x2604bc){if(_0x2604bc){return _0x2604bc[_0x8618('0x35')](_0x23868c)[_0x8618('0x36')](function(_0x9f8542){return _0x9f8542;});}return null;};}function removeEntity(_0xcd6ef6,_0x928b35){return function(_0x414036){if(_0x414036){return _0x414036[_0x8618('0x37')]()[_0x8618('0x36')](function(){var _0x2b01e9=_0x414036[_0x8618('0x38')]({'plain':!![]});var _0x4e7f90=_0x8618('0x39');return db[_0x8618('0x3a')][_0x8618('0x37')]({'where':{'type':_0x4e7f90,'resourceId':_0x2b01e9['id']}})[_0x8618('0x36')](function(){return _0x414036;});})[_0x8618('0x36')](function(){_0xcd6ef6[_0x8618('0x2c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4658ba,_0x306c96){return function(_0xd86587){if(!_0xd86587){_0x4658ba[_0x8618('0x2a')](0x194);}return _0xd86587;};}function handleError(_0x386c26,_0x1c67e7){_0x1c67e7=_0x1c67e7||0x1f4;return function(_0x26f2e6){logger[_0x8618('0x26')](_0x26f2e6['stack']);if(_0x26f2e6[_0x8618('0x3b')]){delete _0x26f2e6[_0x8618('0x3b')];}_0x386c26[_0x8618('0x2c')](_0x1c67e7)[_0x8618('0x3c')](_0x26f2e6);};}exports['index']=function(_0x270a5f,_0x40855d){var _0xa6d8cc={'include':[{'model':db[_0x8618('0x3d')],'as':_0x8618('0x3e')},{'model':db['MailServerOut'],'as':_0x8618('0x3f')},{'model':db[_0x8618('0x40')],'as':_0x8618('0x41')}]},_0x21b6e3={},_0x3b79cd={'count':0x0,'rows':[]};var _0x545611=_[_0x8618('0x42')](db[_0x8618('0x43')][_0x8618('0x44')],function(_0x2f1268){return{'name':_0x2f1268[_0x8618('0x45')],'type':_0x2f1268['type'][_0x8618('0x46')]};});_0x21b6e3[_0x8618('0x47')]=_[_0x8618('0x42')](_0x545611,_0x8618('0x3b'));_0x21b6e3[_0x8618('0x48')]=_[_0x8618('0x49')](_0x270a5f[_0x8618('0x48')]);_0x21b6e3[_0x8618('0x4a')]=_['intersection'](_0x21b6e3[_0x8618('0x47')],_0x21b6e3['query']);_0xa6d8cc[_0x8618('0x4b')]=_[_0x8618('0x4c')](_0x21b6e3[_0x8618('0x47')],qs[_0x8618('0x4d')](_0x270a5f[_0x8618('0x48')][_0x8618('0x4d')]));_0xa6d8cc[_0x8618('0x4b')]=_0xa6d8cc[_0x8618('0x4b')][_0x8618('0x4e')]?_0xa6d8cc[_0x8618('0x4b')]:_0x21b6e3[_0x8618('0x47')];if(!_0x270a5f['query'][_0x8618('0x4f')]('nolimit')){_0xa6d8cc[_0x8618('0x30')]=qs['limit'](_0x270a5f[_0x8618('0x48')][_0x8618('0x30')]);_0xa6d8cc[_0x8618('0x2f')]=qs[_0x8618('0x2f')](_0x270a5f['query']['offset']);}_0xa6d8cc[_0x8618('0x50')]=qs['sort'](_0x270a5f[_0x8618('0x48')][_0x8618('0x51')]);_0xa6d8cc['where']=qs[_0x8618('0x4a')](_[_0x8618('0x52')](_0x270a5f[_0x8618('0x48')],_0x21b6e3[_0x8618('0x4a')]),_0x545611);if(_0x270a5f[_0x8618('0x48')][_0x8618('0x53')]){_0xa6d8cc[_0x8618('0x54')]=_[_0x8618('0x55')](_0xa6d8cc[_0x8618('0x54')],{'$or':_[_0x8618('0x42')](_0x545611,function(_0x365804){if(_0x365804[_0x8618('0x56')]!==_0x8618('0x57')){var _0x567764={};_0x567764[_0x365804[_0x8618('0x3b')]]={'$like':'%'+_0x270a5f['query'][_0x8618('0x53')]+'%'};return _0x567764;}})});}_0xa6d8cc=_['merge']({},_0xa6d8cc,_0x270a5f[_0x8618('0x58')]);var _0x10abea={'where':_0xa6d8cc[_0x8618('0x54')]};return db['MailAccount'][_0x8618('0x2e')](_0x10abea)[_0x8618('0x36')](function(_0x32d722){_0x3b79cd['count']=_0x32d722;if(_0x270a5f[_0x8618('0x48')][_0x8618('0x59')]){_0xa6d8cc['include']=[{'all':!![]}];}return db[_0x8618('0x43')][_0x8618('0x5a')](_0xa6d8cc);})[_0x8618('0x36')](function(_0x1d3a70){_0x3b79cd[_0x8618('0x5b')]=_0x1d3a70;return _0x3b79cd;})[_0x8618('0x36')](respondWithFilteredResult(_0x40855d,_0xa6d8cc))[_0x8618('0x29')](handleError(_0x40855d,null));};exports[_0x8618('0x5c')]=function(_0xd4f6a8,_0x38b02a){var _0x4b9115={'raw':![],'where':{'id':_0xd4f6a8[_0x8618('0x5d')]['id']},'include':[{'model':db['MailServerIn'],'as':_0x8618('0x3e')},{'model':db[_0x8618('0x5e')],'as':_0x8618('0x3f')},{'model':db['Pause'],'as':'mandatoryDispositionPause'}]},_0x2df023={};_0x2df023['model']=_[_0x8618('0x49')](db['MailAccount'][_0x8618('0x44')]);_0x2df023[_0x8618('0x48')]=_[_0x8618('0x49')](_0xd4f6a8[_0x8618('0x48')]);_0x2df023[_0x8618('0x4a')]=_[_0x8618('0x4c')](_0x2df023['model'],_0x2df023[_0x8618('0x48')]);_0x4b9115[_0x8618('0x4b')]=_[_0x8618('0x4c')](_0x2df023[_0x8618('0x47')],qs['fields'](_0xd4f6a8[_0x8618('0x48')]['fields']));_0x4b9115[_0x8618('0x4b')]=_0x4b9115[_0x8618('0x4b')]['length']?_0x4b9115[_0x8618('0x4b')]:_0x2df023[_0x8618('0x47')];if(_0xd4f6a8[_0x8618('0x48')][_0x8618('0x59')]){_0x4b9115[_0x8618('0x5f')]=[{'all':!![]}];}_0x4b9115=_['merge']({},_0x4b9115,_0xd4f6a8[_0x8618('0x58')]);return db['MailAccount'][_0x8618('0x60')](_0x4b9115)[_0x8618('0x36')](handleEntityNotFound(_0x38b02a,null))[_0x8618('0x36')](respondWithResult(_0x38b02a,null))[_0x8618('0x29')](handleError(_0x38b02a,null));};exports[_0x8618('0x35')]=function(_0x349abe,_0x481c60){if(_0x349abe[_0x8618('0x61')]['id']){delete _0x349abe[_0x8618('0x61')]['id'];}return db[_0x8618('0x43')][_0x8618('0x60')]({'where':{'id':_0x349abe[_0x8618('0x5d')]['id']},'include':[{'model':db['MailServerIn'],'as':_0x8618('0x3e')},{'model':db[_0x8618('0x5e')],'as':_0x8618('0x3f')},{'model':db['Pause'],'as':_0x8618('0x41')}]})['then'](handleEntityNotFound(_0x481c60,null))[_0x8618('0x36')](saveUpdates(_0x349abe[_0x8618('0x61')],null))[_0x8618('0x36')](function(_0x2990a3){if(_0x2990a3&&_0x349abe['body']['Imap']){return db['MailServerIn'][_0x8618('0x35')](_0x349abe['body']['Imap'],{'where':{'MailAccountId':_0x2990a3['id']}})[_0x8618('0x36')](function(){return _0x2990a3;});}return _0x2990a3;})[_0x8618('0x36')](function(_0x1efe3f){if(_0x1efe3f&&_0x349abe[_0x8618('0x61')][_0x8618('0x3f')]){return db[_0x8618('0x5e')][_0x8618('0x35')](_0x349abe['body'][_0x8618('0x3f')],{'where':{'MailAccountId':_0x1efe3f['id']}})['then'](function(){return _0x1efe3f;});}return _0x1efe3f;})['then'](respondWithResult(_0x481c60,null))[_0x8618('0x29')](handleError(_0x481c60,null));};exports['describe']=function(_0x303259,_0x445107){return db[_0x8618('0x43')][_0x8618('0x62')]()[_0x8618('0x36')](respondWithResult(_0x445107,null))[_0x8618('0x29')](handleError(_0x445107,null));};exports['addDisposition']=function(_0x27c70b,_0x107edd,_0x2a6169){if(_0x27c70b[_0x8618('0x61')]['id']){delete _0x27c70b[_0x8618('0x61')]['id'];}return db[_0x8618('0x43')][_0x8618('0x60')]({'where':{'id':_0x27c70b[_0x8618('0x5d')]['id']}})['then'](handleEntityNotFound(_0x107edd,null))[_0x8618('0x36')](function(_0x317e4d){if(_0x317e4d){_0x27c70b[_0x8618('0x61')][_0x8618('0x63')]=_0x317e4d['id'];return db[_0x8618('0x64')][_0x8618('0x65')](_0x27c70b[_0x8618('0x61')]);}})[_0x8618('0x36')](respondWithResult(_0x107edd,null))[_0x8618('0x29')](handleError(_0x107edd,null));};exports[_0x8618('0x66')]=function(_0x286500,_0x1431ad,_0x3b5211){var _0xfe8299={'raw':![],'where':{}};var _0x58f9b6={};var _0x434cd7={'count':0x0,'rows':[]};return db[_0x8618('0x43')][_0x8618('0x67')]({'where':{'id':_0x286500['params']['id']}})[_0x8618('0x36')](handleEntityNotFound(_0x1431ad,null))[_0x8618('0x36')](function(_0x3775ef){if(_0x3775ef){_0x58f9b6[_0x8618('0x47')]=_['keys'](db[_0x8618('0x64')][_0x8618('0x44')]);_0x58f9b6[_0x8618('0x48')]=_[_0x8618('0x49')](_0x286500[_0x8618('0x48')]);_0x58f9b6[_0x8618('0x4a')]=_['intersection'](_0x58f9b6[_0x8618('0x47')],_0x58f9b6[_0x8618('0x48')]);_0xfe8299[_0x8618('0x4b')]=_[_0x8618('0x4c')](_0x58f9b6[_0x8618('0x47')],qs[_0x8618('0x4d')](_0x286500[_0x8618('0x48')]['fields']));_0xfe8299[_0x8618('0x4b')]=_0xfe8299['attributes']['length']?_0xfe8299[_0x8618('0x4b')]:_0x58f9b6[_0x8618('0x47')];if(!_0x286500[_0x8618('0x48')][_0x8618('0x4f')](_0x8618('0x68'))){_0xfe8299[_0x8618('0x30')]=qs[_0x8618('0x30')](_0x286500[_0x8618('0x48')][_0x8618('0x30')]);_0xfe8299[_0x8618('0x2f')]=qs[_0x8618('0x2f')](_0x286500[_0x8618('0x48')]['offset']);}_0xfe8299[_0x8618('0x50')]=qs['sort'](_0x286500[_0x8618('0x48')][_0x8618('0x51')]);_0xfe8299['where']=qs[_0x8618('0x4a')](_[_0x8618('0x52')](_0x286500[_0x8618('0x48')],_0x58f9b6[_0x8618('0x4a')]));_0xfe8299[_0x8618('0x54')]['MailAccountId']=_0x3775ef['id'];if(_0x286500[_0x8618('0x48')][_0x8618('0x53')]){_0xfe8299[_0x8618('0x54')]=_[_0x8618('0x55')](_0xfe8299['where'],{'$or':_[_0x8618('0x42')](_0xfe8299[_0x8618('0x4b')],function(_0x517db6){var _0x3b2eed={};_0x3b2eed[_0x517db6]={'$like':'%'+_0x286500[_0x8618('0x48')][_0x8618('0x53')]+'%'};return _0x3b2eed;})});}_0xfe8299=_[_0x8618('0x55')]({},_0xfe8299,_0x286500[_0x8618('0x58')]);return db[_0x8618('0x64')][_0x8618('0x2e')]({'where':_0xfe8299[_0x8618('0x54')]})[_0x8618('0x36')](function(_0x460ad1){_0x434cd7[_0x8618('0x2e')]=_0x460ad1;if(_0x286500[_0x8618('0x48')][_0x8618('0x59')]){_0xfe8299['include']=[{'all':!![]}];}return db[_0x8618('0x64')][_0x8618('0x5a')](_0xfe8299);})[_0x8618('0x36')](function(_0x47aa5c){_0x434cd7[_0x8618('0x5b')]=_0x47aa5c;return _0x434cd7;});}})[_0x8618('0x36')](respondWithFilteredResult(_0x1431ad,_0xfe8299))[_0x8618('0x29')](handleError(_0x1431ad,null));};exports[_0x8618('0x69')]=function(_0x394f93,_0x77eab3,_0x165cce){return db[_0x8618('0x43')][_0x8618('0x60')]({'where':{'id':_0x394f93['params']['id']}})[_0x8618('0x36')](handleEntityNotFound(_0x77eab3,null))['then'](function(_0x5bd456){if(_0x5bd456){return _0x5bd456[_0x8618('0x69')](_0x394f93['query']['ids']);}})['then'](respondWithStatusCode(_0x77eab3,null))[_0x8618('0x29')](handleError(_0x77eab3,null));};exports[_0x8618('0x6a')]=function(_0x142e33,_0x566a8a,_0x37cf7d){if(_0x142e33[_0x8618('0x61')]['id']){delete _0x142e33[_0x8618('0x61')]['id'];}return db['MailAccount'][_0x8618('0x60')]({'where':{'id':_0x142e33[_0x8618('0x5d')]['id']}})['then'](handleEntityNotFound(_0x566a8a,null))[_0x8618('0x36')](function(_0xe63f34){if(_0xe63f34){_0x142e33[_0x8618('0x61')][_0x8618('0x63')]=_0xe63f34['id'];return db[_0x8618('0x6b')]['create'](_0x142e33[_0x8618('0x61')]);}})[_0x8618('0x36')](respondWithResult(_0x566a8a,null))[_0x8618('0x29')](handleError(_0x566a8a,null));};exports[_0x8618('0x6c')]=function(_0x5ef577,_0xfa247e,_0x32d836){var _0x1a8d70={'raw':![],'where':{}};var _0x5e4c4b={};var _0x55c9ff={'count':0x0,'rows':[]};return db[_0x8618('0x43')][_0x8618('0x67')]({'where':{'id':_0x5ef577['params']['id']}})['then'](handleEntityNotFound(_0xfa247e,null))['then'](function(_0x2d6c86){if(_0x2d6c86){_0x5e4c4b['model']=_['keys'](db[_0x8618('0x6b')]['rawAttributes']);_0x5e4c4b[_0x8618('0x48')]=_[_0x8618('0x49')](_0x5ef577[_0x8618('0x48')]);_0x5e4c4b[_0x8618('0x4a')]=_[_0x8618('0x4c')](_0x5e4c4b[_0x8618('0x47')],_0x5e4c4b[_0x8618('0x48')]);_0x1a8d70[_0x8618('0x4b')]=_[_0x8618('0x4c')](_0x5e4c4b[_0x8618('0x47')],qs['fields'](_0x5ef577[_0x8618('0x48')][_0x8618('0x4d')]));_0x1a8d70[_0x8618('0x4b')]=_0x1a8d70[_0x8618('0x4b')][_0x8618('0x4e')]?_0x1a8d70[_0x8618('0x4b')]:_0x5e4c4b[_0x8618('0x47')];if(!_0x5ef577['query']['hasOwnProperty']('nolimit')){_0x1a8d70[_0x8618('0x30')]=qs[_0x8618('0x30')](_0x5ef577['query']['limit']);_0x1a8d70[_0x8618('0x2f')]=qs['offset'](_0x5ef577[_0x8618('0x48')][_0x8618('0x2f')]);}_0x1a8d70[_0x8618('0x50')]=qs['sort'](_0x5ef577[_0x8618('0x48')][_0x8618('0x51')]);_0x1a8d70[_0x8618('0x54')]=qs[_0x8618('0x4a')](_['pick'](_0x5ef577['query'],_0x5e4c4b[_0x8618('0x4a')]));_0x1a8d70['where']['MailAccountId']=_0x2d6c86['id'];if(_0x5ef577[_0x8618('0x48')][_0x8618('0x53')]){_0x1a8d70[_0x8618('0x54')]=_[_0x8618('0x55')](_0x1a8d70[_0x8618('0x54')],{'$or':_[_0x8618('0x42')](_0x1a8d70[_0x8618('0x4b')],function(_0x3426da){var _0x267b14={};_0x267b14[_0x3426da]={'$like':'%'+_0x5ef577[_0x8618('0x48')][_0x8618('0x53')]+'%'};return _0x267b14;})});}_0x1a8d70=_[_0x8618('0x55')]({},_0x1a8d70,_0x5ef577[_0x8618('0x58')]);return db[_0x8618('0x6b')][_0x8618('0x2e')]({'where':_0x1a8d70[_0x8618('0x54')]})[_0x8618('0x36')](function(_0x3eae8a){_0x55c9ff['count']=_0x3eae8a;if(_0x5ef577[_0x8618('0x48')][_0x8618('0x59')]){_0x1a8d70[_0x8618('0x5f')]=[{'all':!![]}];}return db['CannedAnswer'][_0x8618('0x5a')](_0x1a8d70);})[_0x8618('0x36')](function(_0x49deac){_0x55c9ff[_0x8618('0x5b')]=_0x49deac;return _0x55c9ff;});}})['then'](respondWithFilteredResult(_0xfa247e,_0x1a8d70))['catch'](handleError(_0xfa247e,null));};exports[_0x8618('0x6d')]=function(_0x5446ac,_0x4f0206,_0x218c0b){return db['MailAccount'][_0x8618('0x60')]({'where':{'id':_0x5446ac['params']['id']}})[_0x8618('0x36')](handleEntityNotFound(_0x4f0206,null))['then'](function(_0x249b00){if(_0x249b00){return _0x249b00[_0x8618('0x6d')](_0x5446ac[_0x8618('0x48')][_0x8618('0x6e')]);}})[_0x8618('0x36')](respondWithStatusCode(_0x4f0206,null))['catch'](handleError(_0x4f0206,null));};exports['create']=function(_0x277f3e,_0xf14388){var _0x4ff124={'name':_0x277f3e[_0x8618('0x61')][_0x8618('0x3b')],'key':_0x277f3e['body'][_0x8618('0x46')],'email':_0x277f3e[_0x8618('0x61')]['email'],'ListId':_0x277f3e[_0x8618('0x61')][_0x8618('0x6f')],'active':!_[_0x8618('0x70')](_0x277f3e[_0x8618('0x61')][_0x8618('0x71')])?_0x277f3e['body'][_0x8618('0x71')]:!![],'description':_0x277f3e[_0x8618('0x61')][_0x8618('0x72')]||null,'Imap':{},'Smtp':{}};if(_[_0x8618('0x70')](_0x277f3e[_0x8618('0x61')][_0x8618('0x73')])){if(_0x277f3e[_0x8618('0x61')]['cauthentication']){_0x4ff124[_0x8618('0x3e')][_0x8618('0x74')]=_0x4ff124[_0x8618('0x3f')][_0x8618('0x74')]=_0x277f3e[_0x8618('0x61')][_0x8618('0x75')];_0x4ff124[_0x8618('0x3e')]['password']=_0x4ff124[_0x8618('0x3f')][_0x8618('0x76')]=_0x277f3e[_0x8618('0x61')][_0x8618('0x77')];}else{_0x4ff124[_0x8618('0x3e')][_0x8618('0x78')]=_0x4ff124[_0x8618('0x3f')][_0x8618('0x78')]=![];}_0x4ff124[_0x8618('0x3e')][_0x8618('0x79')]=_0x277f3e[_0x8618('0x61')]['Imap'][_0x8618('0x79')];_0x4ff124[_0x8618('0x3e')][_0x8618('0x7a')]=_0x277f3e['body'][_0x8618('0x3e')][_0x8618('0x7a')];_0x4ff124[_0x8618('0x3f')][_0x8618('0x79')]=_0x277f3e['body']['Smtp'][_0x8618('0x79')];_0x4ff124[_0x8618('0x3f')][_0x8618('0x7a')]=_0x277f3e[_0x8618('0x61')][_0x8618('0x3f')]['port'];}else{_0x4ff124[_0x8618('0x3e')][_0x8618('0x7b')]=_0x4ff124['Smtp'][_0x8618('0x7b')]=_0x277f3e['body'][_0x8618('0x73')];_0x4ff124['Imap'][_0x8618('0x74')]=_0x4ff124[_0x8618('0x3f')][_0x8618('0x74')]=_0x277f3e['body'][_0x8618('0x75')];_0x4ff124[_0x8618('0x3e')][_0x8618('0x7c')]=_0x4ff124[_0x8618('0x3f')][_0x8618('0x76')]=_0x277f3e[_0x8618('0x61')]['cpassword'];}return db[_0x8618('0x43')][_0x8618('0x65')](_0x4ff124,{'include':[{'model':db['MailServerOut'],'as':_0x8618('0x3f')},{'model':db[_0x8618('0x3d')],'as':_0x8618('0x3e')}]})[_0x8618('0x36')](function(_0x210700){var _0x1e8482=_0x277f3e[_0x8618('0x74')][_0x8618('0x38')]({'plain':!![]});if(!_0x1e8482)throw new Error(_0x8618('0x7d'));if(_0x1e8482[_0x8618('0x7e')]==='user'){var _0x2d0e45=_0x210700[_0x8618('0x38')]({'plain':!![]});return db[_0x8618('0x7f')][_0x8618('0x60')]({'where':{'name':_0x8618('0x39'),'userProfileId':_0x1e8482[_0x8618('0x80')]},'raw':!![]})[_0x8618('0x36')](function(_0x157268){if(_0x157268&&_0x157268[_0x8618('0x81')]===0x0){return db[_0x8618('0x3a')][_0x8618('0x65')]({'name':_0x2d0e45['name'],'resourceId':_0x2d0e45['id'],'type':_0x157268['name'],'sectionId':_0x157268['id']},{})[_0x8618('0x36')](function(){return _0x210700;});}else{return _0x210700;}})[_0x8618('0x29')](function(_0x4703a4){logger[_0x8618('0x26')](_0x8618('0x82'),_0x4703a4);throw _0x4703a4;});}return _0x210700;})[_0x8618('0x36')](respondWithResult(_0xf14388,0xc9))[_0x8618('0x29')](handleError(_0xf14388,null));};exports[_0x8618('0x83')]=function(_0x1b09c9,_0x33d424,_0x4e59f7){return db[_0x8618('0x43')]['findOne']({'where':{'id':_0x1b09c9[_0x8618('0x5d')]['id']}})[_0x8618('0x36')](handleEntityNotFound(_0x33d424,null))['then'](function(_0x286439){if(_0x286439){return _0x286439[_0x8618('0x83')]();}return null;})['then'](respondWithResult(_0x33d424,null))[_0x8618('0x29')](handleError(_0x33d424,null));};exports[_0x8618('0x84')]=function(_0x4b1ef8,_0x412431,_0x4dc16d){if(_0x4b1ef8[_0x8618('0x61')]['id']){delete _0x4b1ef8[_0x8618('0x61')]['id'];}return db['MailAccount'][_0x8618('0x60')]({'where':{'id':_0x4b1ef8[_0x8618('0x5d')]['id']}})[_0x8618('0x36')](handleEntityNotFound(_0x412431,null))[_0x8618('0x36')](function(_0xc954f0){if(_0xc954f0){_0x4b1ef8[_0x8618('0x61')][_0x8618('0x63')]=_0xc954f0['id'];return db[_0x8618('0x3d')][_0x8618('0x65')](_0x4b1ef8[_0x8618('0x61')]);}})[_0x8618('0x36')](respondWithResult(_0x412431,null))['catch'](handleError(_0x412431,null));};exports[_0x8618('0x85')]=function(_0x251755,_0x2e24ed,_0xe30db6){return db['MailAccount']['findOne']({'where':{'id':_0x251755[_0x8618('0x5d')]['id']}})[_0x8618('0x36')](handleEntityNotFound(_0x2e24ed,null))[_0x8618('0x36')](function(_0x151db7){if(_0x151db7){return _0x151db7[_0x8618('0x86')](null);}return null;})[_0x8618('0x36')](respondWithStatusCode(_0x2e24ed,null))[_0x8618('0x29')](handleError(_0x2e24ed,null));};exports[_0x8618('0x87')]=function(_0x48917f,_0x840fa9,_0x5725df){return db[_0x8618('0x43')]['findOne']({'where':{'id':_0x48917f['params']['id']}})[_0x8618('0x36')](handleEntityNotFound(_0x840fa9,null))[_0x8618('0x36')](function(_0x405146){if(_0x405146){return _0x405146[_0x8618('0x87')]();}return null;})[_0x8618('0x36')](respondWithResult(_0x840fa9,null))[_0x8618('0x29')](handleError(_0x840fa9,null));};exports['addSmtp']=function(_0xf9d2f2,_0x189a96,_0x3224cd){if(_0xf9d2f2[_0x8618('0x61')]['id']){delete _0xf9d2f2[_0x8618('0x61')]['id'];}return db['MailAccount'][_0x8618('0x60')]({'where':{'id':_0xf9d2f2[_0x8618('0x5d')]['id']}})['then'](handleEntityNotFound(_0x189a96,null))['then'](function(_0x34a8d7){if(_0x34a8d7){_0xf9d2f2[_0x8618('0x61')][_0x8618('0x63')]=_0x34a8d7['id'];return db['MailServerOut'][_0x8618('0x65')](_0xf9d2f2[_0x8618('0x61')]);}})['then'](respondWithResult(_0x189a96,null))['catch'](handleError(_0x189a96,null));};exports[_0x8618('0x88')]=function(_0x4e6f67,_0x193981,_0x531516){return db['MailAccount'][_0x8618('0x67')]({'where':{'id':_0x4e6f67['params']['id']}})[_0x8618('0x36')](handleEntityNotFound(_0x193981,null))[_0x8618('0x36')](function(_0x5368b5){if(_0x5368b5){return _0x5368b5[_0x8618('0x89')](null);}return null;})[_0x8618('0x36')](respondWithStatusCode(_0x193981,null))[_0x8618('0x29')](handleError(_0x193981,null));};exports[_0x8618('0x8a')]=function(_0x24412a,_0x3a1def,_0x14c7c2){return db['MailInteraction'][_0x8618('0x60')]({'where':{'id':_0x24412a[_0x8618('0x5d')]['id']}})[_0x8618('0x36')](handleEntityNotFound(_0x3a1def,null))[_0x8618('0x36')](function(_0x170f5c){if(_0x170f5c){return _0x170f5c[_0x8618('0x8a')](_0x24412a['body'][_0x8618('0x6e')],_[_0x8618('0x8b')](_0x24412a[_0x8618('0x61')],[_0x8618('0x6e'),'id'])||{});}})[_0x8618('0x36')](respondWithResult(_0x3a1def,null))[_0x8618('0x29')](handleError(_0x3a1def,null));};exports[_0x8618('0x8c')]=function(_0x4f1aa0,_0x3be370,_0xaf3717){var _0xfa906={'raw':![],'where':{}};var _0x221505={};var _0x5392b3={'count':0x0,'rows':[]};return db[_0x8618('0x43')][_0x8618('0x67')]({'where':{'id':_0x4f1aa0[_0x8618('0x5d')]['id']}})['then'](handleEntityNotFound(_0x3be370,null))['then'](function(_0x423d3e){if(_0x423d3e){_0x221505[_0x8618('0x47')]=_[_0x8618('0x49')](db['MailInteraction'][_0x8618('0x44')]);_0x221505[_0x8618('0x48')]=_[_0x8618('0x49')](_0x4f1aa0['query']);_0x221505[_0x8618('0x4a')]=_['intersection'](_0x221505[_0x8618('0x47')],_0x221505[_0x8618('0x48')]);_0xfa906[_0x8618('0x4b')]=_[_0x8618('0x4c')](_0x221505[_0x8618('0x47')],qs[_0x8618('0x4d')](_0x4f1aa0[_0x8618('0x48')][_0x8618('0x4d')]));_0xfa906['attributes']=_0xfa906[_0x8618('0x4b')][_0x8618('0x4e')]?_0xfa906['attributes']:_0x221505[_0x8618('0x47')];if(!_0x4f1aa0['query'][_0x8618('0x4f')](_0x8618('0x68'))){_0xfa906[_0x8618('0x30')]=qs[_0x8618('0x30')](_0x4f1aa0[_0x8618('0x48')][_0x8618('0x30')]);_0xfa906[_0x8618('0x2f')]=qs['offset'](_0x4f1aa0['query'][_0x8618('0x2f')]);}_0xfa906[_0x8618('0x50')]=qs[_0x8618('0x51')](_0x4f1aa0[_0x8618('0x48')][_0x8618('0x51')]);_0xfa906[_0x8618('0x54')]=qs[_0x8618('0x4a')](_[_0x8618('0x52')](_0x4f1aa0['query'],_0x221505[_0x8618('0x4a')]));_0xfa906[_0x8618('0x54')]['MailAccountId']=_0x423d3e['id'];if(_0x4f1aa0[_0x8618('0x48')][_0x8618('0x53')]){_0xfa906[_0x8618('0x54')]=_['merge'](_0xfa906[_0x8618('0x54')],{'$or':_[_0x8618('0x42')](_0xfa906[_0x8618('0x4b')],function(_0x547dd4){var _0x3989f7={};_0x3989f7[_0x547dd4]={'$like':'%'+_0x4f1aa0[_0x8618('0x48')][_0x8618('0x53')]+'%'};return _0x3989f7;})});}_0xfa906=_['merge']({},_0xfa906,_0x4f1aa0[_0x8618('0x58')]);return db[_0x8618('0x8d')][_0x8618('0x2e')]({'where':_0xfa906[_0x8618('0x54')]})[_0x8618('0x36')](function(_0x4ac510){_0x5392b3[_0x8618('0x2e')]=_0x4ac510;if(_0x4f1aa0[_0x8618('0x48')]['includeAll']){_0xfa906[_0x8618('0x5f')]=[{'model':db[_0x8618('0x8e')],'as':_0x8618('0x8f'),'required':![]},{'model':db[_0x8618('0x90')],'as':_0x8618('0x91'),'attributes':[_0x8618('0x3b'),'fullname',_0x8618('0x92')],'required':![]},{'model':db[_0x8618('0x93')],'as':_0x8618('0x94'),'attributes':['id',_0x8618('0x3b'),_0x8618('0x95')],'where':_0x4f1aa0[_0x8618('0x48')][_0x8618('0x96')]?{'id':_0x4f1aa0[_0x8618('0x48')]['tag']}:undefined,'required':_0x4f1aa0['query']['tag']?!![]:![]}];}return db['MailInteraction'][_0x8618('0x5a')](_0xfa906);})[_0x8618('0x36')](function(_0x43d137){_0x5392b3[_0x8618('0x5b')]=_0x43d137;return _0x5392b3;});}})[_0x8618('0x36')](respondWithFilteredResult(_0x3be370,_0xfa906))[_0x8618('0x29')](handleError(_0x3be370,null));};exports['addApplications']=function(_0x5578ae,_0x594044,_0x2954d8){return db[_0x8618('0x43')][_0x8618('0x67')]({'where':{'id':_0x5578ae[_0x8618('0x5d')]['id']}})[_0x8618('0x36')](handleEntityNotFound(_0x594044,null))['then'](function(_0x3daa44){if(_0x3daa44){return db[_0x8618('0x97')][_0x8618('0x98')](function(_0x1aa423){return db['MailApplication'][_0x8618('0x37')]({'where':{'MailAccountId':_0x5578ae[_0x8618('0x5d')]['id']},'transaction':_0x1aa423})[_0x8618('0x36')](function(_0x422a86){var _0x73d4bf=_[_0x8618('0x42')](_0x5578ae[_0x8618('0x61')],function(_0x57a6ba){_0x57a6ba[_0x8618('0x63')]=_0x5578ae[_0x8618('0x5d')]['id'];return _0x57a6ba;});return db[_0x8618('0x99')][_0x8618('0x9a')](_0x73d4bf,{'transaction':_0x1aa423});});})[_0x8618('0x36')](function(){return db[_0x8618('0x99')][_0x8618('0x9b')]({'where':{'MailAccountId':_0x5578ae[_0x8618('0x5d')]['id']},'order':'priority'});});}})['then'](respondWithResult(_0x594044,null))[_0x8618('0x29')](handleError(_0x594044,null));};exports['getApplications']=function(_0xe24766,_0x561ec6,_0x17c2f5){var _0x48722d={};var _0x1c9142={};var _0x3ca33e;var _0x4c2c92;return db[_0x8618('0x43')][_0x8618('0x67')]({'where':{'id':_0xe24766[_0x8618('0x5d')]['id']}})['then'](handleEntityNotFound(_0x561ec6,null))['then'](function(_0x225cac){if(_0x225cac){_0x3ca33e=_0x225cac;_0x1c9142[_0x8618('0x47')]=_[_0x8618('0x49')](db[_0x8618('0x99')][_0x8618('0x44')]);_0x1c9142['query']=_[_0x8618('0x49')](_0xe24766['query']);_0x1c9142['filters']=_[_0x8618('0x4c')](_0x1c9142[_0x8618('0x47')],_0x1c9142[_0x8618('0x48')]);_0x48722d[_0x8618('0x4b')]=_[_0x8618('0x4c')](_0x1c9142[_0x8618('0x47')],qs[_0x8618('0x4d')](_0xe24766[_0x8618('0x48')][_0x8618('0x4d')]));_0x48722d[_0x8618('0x4b')]=_0x48722d[_0x8618('0x4b')][_0x8618('0x4e')]?_0x48722d[_0x8618('0x4b')]:_0x1c9142[_0x8618('0x47')];_0x48722d[_0x8618('0x50')]=qs[_0x8618('0x51')](_0xe24766[_0x8618('0x48')][_0x8618('0x51')]);_0x48722d[_0x8618('0x54')]=qs[_0x8618('0x4a')](_[_0x8618('0x52')](_0xe24766[_0x8618('0x48')],_0x1c9142[_0x8618('0x4a')]));if(_0xe24766[_0x8618('0x48')][_0x8618('0x53')]){_0x48722d[_0x8618('0x54')]=_[_0x8618('0x55')](_0x48722d['where'],{'$or':_[_0x8618('0x42')](_0x48722d[_0x8618('0x4b')],function(_0x5c68fa){var _0x379e91={};_0x379e91[_0x5c68fa]={'$like':'%'+_0xe24766[_0x8618('0x48')][_0x8618('0x53')]+'%'};return _0x379e91;})});}_0x48722d=_[_0x8618('0x55')]({},_0x48722d,_0xe24766[_0x8618('0x58')]);return _0x3ca33e['getApplications'](_0x48722d);}})[_0x8618('0x36')](function(_0x159385){if(_0x159385){_0x4c2c92=_0x159385[_0x8618('0x4e')];if(!_0xe24766[_0x8618('0x48')]['hasOwnProperty']('nolimit')){_0x48722d['limit']=qs[_0x8618('0x30')](_0xe24766[_0x8618('0x48')][_0x8618('0x30')]);_0x48722d[_0x8618('0x2f')]=qs[_0x8618('0x2f')](_0xe24766['query']['offset']);}return _0x3ca33e[_0x8618('0x9c')](_0x48722d);}})[_0x8618('0x36')](function(_0x5da621){if(_0x5da621){return _0x5da621?{'count':_0x4c2c92,'rows':_0x5da621}:null;}})['then'](respondWithResult(_0x561ec6,null))['catch'](handleError(_0x561ec6,null));};exports[_0x8618('0x9d')]=function(_0x21a7b8,_0x50a04a,_0x5d55d8){var _0x206783={'raw':!![],'where':{}};var _0x520b31={};var _0x316ed9={'count':0x0,'rows':[]};return db[_0x8618('0x43')]['findOne']({'where':{'id':_0x21a7b8[_0x8618('0x5d')]['id']}})['then'](handleEntityNotFound(_0x50a04a,null))[_0x8618('0x36')](function(_0x51cd61){if(_0x51cd61){_0x520b31['model']=_[_0x8618('0x49')](db[_0x8618('0x9e')][_0x8618('0x44')]);_0x520b31['query']=_[_0x8618('0x49')](_0x21a7b8[_0x8618('0x48')]);_0x520b31[_0x8618('0x4a')]=_[_0x8618('0x4c')](_0x520b31[_0x8618('0x47')],_0x520b31[_0x8618('0x48')]);_0x206783[_0x8618('0x4b')]=_['intersection'](_0x520b31['model'],qs['fields'](_0x21a7b8[_0x8618('0x48')][_0x8618('0x4d')]));_0x206783[_0x8618('0x4b')]=_0x206783[_0x8618('0x4b')][_0x8618('0x4e')]?_0x206783[_0x8618('0x4b')]:_0x520b31[_0x8618('0x47')];if(!_0x21a7b8['query'][_0x8618('0x4f')]('nolimit')){_0x206783[_0x8618('0x30')]=qs[_0x8618('0x30')](_0x21a7b8[_0x8618('0x48')][_0x8618('0x30')]);_0x206783[_0x8618('0x2f')]=qs[_0x8618('0x2f')](_0x21a7b8[_0x8618('0x48')][_0x8618('0x2f')]);}_0x206783[_0x8618('0x50')]=qs[_0x8618('0x51')](_0x21a7b8[_0x8618('0x48')][_0x8618('0x51')]);_0x206783[_0x8618('0x54')]=qs[_0x8618('0x4a')](_[_0x8618('0x52')](_0x21a7b8['query'],_0x520b31[_0x8618('0x4a')]));_0x206783['where'][_0x8618('0x63')]=_0x51cd61['id'];if(_0x21a7b8[_0x8618('0x48')][_0x8618('0x53')]){_0x206783['where']=_[_0x8618('0x55')](_0x206783[_0x8618('0x54')],{'$or':_[_0x8618('0x42')](_0x206783[_0x8618('0x4b')],function(_0xdd8bd3){var _0x5596ba={};_0x5596ba[_0xdd8bd3]={'$like':'%'+_0x21a7b8['query'][_0x8618('0x53')]+'%'};return _0x5596ba;})});}if(_0x21a7b8[_0x8618('0x48')][_0x8618('0x9f')]){var _0x13c1f7=_0x21a7b8[_0x8618('0x48')][_0x8618('0x9f')][_0x8618('0xa0')](',');var _0xea1a4b={};_0xea1a4b[_0x13c1f7[0x0]]={'$gte':moment(_0x13c1f7[0x1])[_0x8618('0xa1')]('YYYY-MM-DD\x20HH:mm:ss')};_0x206783[_0x8618('0x54')]=_[_0x8618('0x55')](_0x206783[_0x8618('0x54')],_0xea1a4b);}_0x206783=_[_0x8618('0x55')]({},_0x206783,_0x21a7b8[_0x8618('0x58')]);return db['MailMessage'][_0x8618('0x2e')]({'where':_0x206783['where']})[_0x8618('0x36')](function(_0xeddc8f){_0x316ed9[_0x8618('0x2e')]=_0xeddc8f;if(_0x21a7b8[_0x8618('0x48')][_0x8618('0x59')]){_0x206783[_0x8618('0x5f')]=[{'all':!![]}];}return db['MailMessage'][_0x8618('0x5a')](_0x206783);})[_0x8618('0x36')](function(_0x1581d0){_0x316ed9['rows']=_0x1581d0;return _0x316ed9;});}})[_0x8618('0x36')](respondWithFilteredResult(_0x50a04a,_0x206783))[_0x8618('0x29')](handleError(_0x50a04a,null));};exports[_0x8618('0x3c')]=function(_0x4b66ff,_0x16d06c,_0x166aba){var _0x2961f2,_0x354e15={},_0x5b66d7;if(_0x4b66ff[_0x8618('0x61')]['to']){_0x5b66d7=_0x4b66ff[_0x8618('0x61')]['to']['split'](',')[0x0];}return db[_0x8618('0x43')][_0x8618('0x60')]({'where':{'id':_0x4b66ff['params']['id']},'include':[{'model':db[_0x8618('0xa2')],'as':_0x8618('0xa3'),'include':[{'model':db['CmContact'],'as':_0x8618('0xa4'),'where':{'email':_0x5b66d7},'limit':0x1,'order':[['updatedAt',_0x8618('0xa5')]]}]},{'model':db['MailServerOut'],'as':_0x8618('0x3f'),'raw':!![]}]})[_0x8618('0x36')](handleEntityNotFound(_0x16d06c,null))[_0x8618('0x36')](function(_0x125ae1){if(_0x125ae1){_0x2961f2=_0x125ae1;if(_0x125ae1[_0x8618('0x3f')]){if(_[_0x8618('0x70')](_0x4b66ff['body'][_0x8618('0xa6')])){_0x4b66ff[_0x8618('0x61')]['from']=util['format'](_0x8618('0xa7'),_0x125ae1[_0x8618('0x3b')],_0x125ae1[_0x8618('0xa8')]||_0x125ae1[_0x8618('0x3f')][_0x8618('0x74')]);}if(_0x4b66ff['body'][_0x8618('0xa9')]&&_0x4b66ff[_0x8618('0x61')][_0x8618('0xa9')][_0x8618('0x4e')]){for(var _0x3a672b=0x0;_0x3a672b<_0x4b66ff[_0x8618('0x61')]['attachments'][_0x8618('0x4e')];_0x3a672b+=0x1){_0x4b66ff[_0x8618('0x61')][_0x8618('0xa9')][_0x3a672b]={'filename':_0x4b66ff[_0x8618('0x61')][_0x8618('0xa9')][_0x3a672b][_0x8618('0x3b')],'path':path[_0x8618('0xaa')](config[_0x8618('0xab')],_0x8618('0xac'),_0x4b66ff['body'][_0x8618('0xa9')][_0x3a672b][_0x8618('0xad')])};}}var _0x419a86={'tls':{'rejectUnauthorized':![]}};if(_[_0x8618('0x70')](_0x125ae1[_0x8618('0x3f')][_0x8618('0x7b')])){if(_0x125ae1['Smtp'][_0x8618('0x78')]){_0x419a86[_0x8618('0xae')]={'user':_0x125ae1[_0x8618('0x3f')][_0x8618('0x74')],'pass':_0x125ae1['Smtp']['pass']};}_0x419a86[_0x8618('0x79')]=_0x125ae1['Smtp'][_0x8618('0x79')];_0x419a86['port']=_0x125ae1[_0x8618('0x3f')][_0x8618('0x7a')];_0x419a86[_0x8618('0xaf')]=_0x125ae1[_0x8618('0x3f')]['secure'];}else{_0x419a86[_0x8618('0x7b')]=_0x125ae1[_0x8618('0x3f')]['service'];_0x419a86[_0x8618('0xae')]={'user':_0x125ae1['Smtp'][_0x8618('0x74')],'pass':_0x125ae1['Smtp']['pass']};}return respondWithRpcPromise(_0x8618('0xb0'),'sendMail',{'account':_0x419a86,'message':_0x4b66ff[_0x8618('0x61')]});}else{throw new Error('List\x20not\x20found');}}})['then'](function(_0x525d6f){if(_0x525d6f){_0x354e15=_0x525d6f;if(_0x2961f2[_0x8618('0xa3')]){if(_0x2961f2[_0x8618('0xa3')][_0x8618('0xa4')][_0x8618('0x4e')]){return _0x2961f2[_0x8618('0xa3')]['Contacts'][0x0];}else{return db[_0x8618('0x8e')][_0x8618('0x65')](_[_0x8618('0x17')](_0x4b66ff['body'],{'firstName':_0x4b66ff[_0x8618('0x61')]['to'],'email':_0x4b66ff[_0x8618('0x61')]['to'],'phone':_0x4b66ff[_0x8618('0x61')]['to'],'ListId':_0x2961f2['ListId']}));}}else{throw new Error(_0x8618('0xb1'));}}})['then'](function(_0x49b40b){if(_0x49b40b){var _0x2eea3f={'UserId':_0x4b66ff['user']['id'],'ContactId':_0x49b40b['id'],'MailAccountId':_0x2961f2['id'],'inReplyTo':_0x354e15[_0x8618('0xb2')],'to':_0x4b66ff[_0x8618('0x61')][_0x8618('0xa6')],'cc':_0x4b66ff[_0x8618('0x61')]['cc'],'subject':_0x4b66ff[_0x8618('0x61')]['subject'],'attach':_0x4b66ff['body'][_0x8618('0xb3')],'firstMsgDirection':'out','lastMsgAt':moment()[_0x8618('0xa1')](_0x8618('0xb4')),'lastMsgDirection':'out','lastMsgBody':_0x4b66ff[_0x8618('0x61')][_0x8618('0x61')],'Messages':[_['merge'](_0x4b66ff[_0x8618('0x61')],{'messageId':_0x354e15[_0x8618('0xb2')],'sentAt':moment()['format'](_0x8618('0xb4')),'read':!![],'MailAccountId':_0x2961f2['id'],'UserId':_0x4b66ff[_0x8618('0x74')]['id'],'ContactId':_0x49b40b['id']})]};if(_0x4b66ff['body'][_0x8618('0xb5')]){_0x2eea3f=_[_0x8618('0x55')](_0x2eea3f,_0x4b66ff[_0x8618('0x61')][_0x8618('0xb5')]);}return db['MailInteraction'][_0x8618('0x65')](_0x2eea3f,{'include':[{'model':db[_0x8618('0x9e')],'as':_0x8618('0xb6')}]});}})[_0x8618('0x36')](respondWithResult(_0x16d06c,null))[_0x8618('0x29')](handleError(_0x16d06c,null));};exports['verifySmtp']=function(_0x418b53,_0x5b025f,_0x4c05eb){return db[_0x8618('0x43')]['find']({'where':{'id':_0x418b53[_0x8618('0x5d')]['id']},'include':[{'model':db[_0x8618('0x5e')],'as':'Smtp','raw':!![]}]})[_0x8618('0x36')](handleEntityNotFound(_0x5b025f,null))[_0x8618('0x36')](function(_0x2cfcc0){if(_0x2cfcc0&&_0x2cfcc0[_0x8618('0x3f')]){var _0x367a90={'id':_0x2cfcc0['id'],'tls':{'rejectUnauthorized':![]}};if(_0x2cfcc0[_0x8618('0x3f')]['service']){_0x367a90[_0x8618('0x7b')]=_0x2cfcc0[_0x8618('0x3f')][_0x8618('0x7b')];}else{_0x367a90['host']=_0x2cfcc0[_0x8618('0x3f')]['host'];_0x367a90[_0x8618('0x7a')]=_0x2cfcc0[_0x8618('0x3f')][_0x8618('0x7a')];_0x367a90['secure']=_0x2cfcc0[_0x8618('0x3f')][_0x8618('0xaf')];}if(_0x2cfcc0[_0x8618('0x3f')][_0x8618('0x78')]){_0x367a90[_0x8618('0xae')]={'user':_0x2cfcc0['Smtp'][_0x8618('0x74')],'pass':_0x2cfcc0[_0x8618('0x3f')][_0x8618('0x76')]};}return respondWithRpcPromise(_0x8618('0xb7'),_0x8618('0xb8'),{'account':_0x367a90});}})[_0x8618('0x36')](respondWithResult(_0x5b025f,null))['catch'](handleError(_0x5b025f,null));};exports['destroy']=function(_0x3750f5,_0x4dfb44){return db[_0x8618('0x43')][_0x8618('0x60')]({'where':{'id':_0x3750f5[_0x8618('0x5d')]['id']}})[_0x8618('0x36')](handleEntityNotFound(_0x4dfb44,null))[_0x8618('0x36')](function(_0x1418e5){if(_0x1418e5&&_0x1418e5[_0x8618('0x7b')]){throw new db[(_0x8618('0xb9'))]['ValidationError'](_0x8618('0xba'));}return _0x1418e5;})['then'](removeEntity(_0x4dfb44,null))['catch'](handleError(_0x4dfb44,null));};exports[_0x8618('0xbb')]=function(_0x452b12,_0x5bf237,_0x32e4c4){return db['MailAccount'][_0x8618('0x60')]({'where':{'id':_0x452b12[_0x8618('0x5d')]['id']}})[_0x8618('0x36')](handleEntityNotFound(_0x5bf237,null))[_0x8618('0x36')](function(_0x8420f){if(_0x8420f){return _0x8420f['addAgents'](_0x452b12[_0x8618('0x61')][_0x8618('0x6e')],_[_0x8618('0x8b')](_0x452b12[_0x8618('0x61')],[_0x8618('0x6e'),'id'])||{})[_0x8618('0xbc')](function(_0x12aebd){for(var _0x24ae87=0x0;_0x24ae87<_0x452b12[_0x8618('0x61')][_0x8618('0x6e')]['length'];_0x24ae87+=0x1){socket[_0x8618('0xbd')](_0x8618('0xbe'),{'UserId':_0x452b12[_0x8618('0x61')][_0x8618('0x6e')][_0x24ae87],'MailAccountId':_0x452b12[_0x8618('0x5d')]['id']});}return _0x12aebd;});}})[_0x8618('0x36')](respondWithResult(_0x5bf237,null))['catch'](handleError(_0x5bf237,null));};exports['removeAgents']=function(_0x3c910d,_0x4d73cf,_0x356d23){return db[_0x8618('0x43')]['find']({'where':{'id':_0x3c910d['params']['id']}})['then'](handleEntityNotFound(_0x4d73cf,null))[_0x8618('0x36')](function(_0x5c3843){if(_0x5c3843){return _0x5c3843[_0x8618('0xbf')](_0x3c910d[_0x8618('0x48')][_0x8618('0x6e')])[_0x8618('0x36')](function(){if(_[_0x8618('0xc0')](_0x3c910d['query']['ids'])){for(var _0x3c2999=0x0;_0x3c2999<_0x3c910d[_0x8618('0x48')][_0x8618('0x6e')]['length'];_0x3c2999+=0x1){socket[_0x8618('0xbd')](_0x8618('0xc1'),{'UserId':Number(_0x3c910d['query'][_0x8618('0x6e')][_0x3c2999]),'MailAccountId':Number(_0x3c910d[_0x8618('0x5d')]['id'])});}}else{socket[_0x8618('0xbd')](_0x8618('0xc1'),{'UserId':Number(_0x3c910d[_0x8618('0x48')][_0x8618('0x6e')]),'MailAccountId':Number(_0x3c910d[_0x8618('0x5d')]['id'])});}});}})[_0x8618('0x36')](respondWithStatusCode(_0x4d73cf,null))[_0x8618('0x29')](handleError(_0x4d73cf,null));};exports[_0x8618('0xc2')]=function(_0x4ab38b,_0x1b6690,_0x82b8f0){var _0x233f9c={};var _0x5da48e={};var _0x1ece8f;var _0xf6ed37;return db[_0x8618('0x43')][_0x8618('0x67')]({'where':{'id':_0x4ab38b['params']['id']}})[_0x8618('0x36')](handleEntityNotFound(_0x1b6690,null))[_0x8618('0x36')](function(_0xc956e3){if(_0xc956e3){_0x1ece8f=_0xc956e3;_0x5da48e[_0x8618('0x47')]=_[_0x8618('0x49')](db[_0x8618('0x90')][_0x8618('0x44')]);_0x5da48e['query']=_[_0x8618('0x49')](_0x4ab38b[_0x8618('0x48')]);_0x5da48e[_0x8618('0x4a')]=_[_0x8618('0x4c')](_0x5da48e[_0x8618('0x47')],_0x5da48e[_0x8618('0x48')]);_0x233f9c['attributes']=_[_0x8618('0x4c')](_0x5da48e[_0x8618('0x47')],qs[_0x8618('0x4d')](_0x4ab38b[_0x8618('0x48')][_0x8618('0x4d')]));_0x233f9c[_0x8618('0x4b')]=_0x233f9c['attributes']['length']?_0x233f9c['attributes']:_0x5da48e[_0x8618('0x47')];_0x233f9c[_0x8618('0x50')]=qs[_0x8618('0x51')](_0x4ab38b[_0x8618('0x48')][_0x8618('0x51')]);_0x233f9c['where']=qs[_0x8618('0x4a')](_[_0x8618('0x52')](_0x4ab38b[_0x8618('0x48')],_0x5da48e[_0x8618('0x4a')]));if(_0x4ab38b[_0x8618('0x48')][_0x8618('0x53')]){_0x233f9c[_0x8618('0x54')]=_[_0x8618('0x55')](_0x233f9c[_0x8618('0x54')],{'$or':_[_0x8618('0x42')](_0x233f9c[_0x8618('0x4b')],function(_0x4e36b8){var _0x41896b={};_0x41896b[_0x4e36b8]={'$like':'%'+_0x4ab38b[_0x8618('0x48')][_0x8618('0x53')]+'%'};return _0x41896b;})});}_0x233f9c=_['merge']({},_0x233f9c,_0x4ab38b[_0x8618('0x58')]);return _0x1ece8f[_0x8618('0xc2')](_0x233f9c);}})[_0x8618('0x36')](function(_0x4f6ec0){if(_0x4f6ec0){_0xf6ed37=_0x4f6ec0[_0x8618('0x4e')];if(!_0x4ab38b[_0x8618('0x48')][_0x8618('0x4f')](_0x8618('0x68'))){_0x233f9c[_0x8618('0x30')]=qs[_0x8618('0x30')](_0x4ab38b[_0x8618('0x48')][_0x8618('0x30')]);_0x233f9c['offset']=qs[_0x8618('0x2f')](_0x4ab38b[_0x8618('0x48')][_0x8618('0x2f')]);}return _0x1ece8f[_0x8618('0xc2')](_0x233f9c);}})[_0x8618('0x36')](function(_0x24eb65){if(_0x24eb65){return _0x24eb65?{'count':_0xf6ed37,'rows':_0x24eb65}:null;}})[_0x8618('0x36')](respondWithResult(_0x1b6690,null))[_0x8618('0x29')](handleError(_0x1b6690,null));}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.events.js b/server/api/mailAccount/mailAccount.events.js index d1cb938..74e1fec 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 _0xb6f5=['update','emit','hasOwnProperty','exports','events','../../mysqldb','setMaxListeners'];(function(_0x3b0b2c,_0x548b67){var _0x12d357=function(_0x3e8a1c){while(--_0x3e8a1c){_0x3b0b2c['push'](_0x3b0b2c['shift']());}};_0x12d357(++_0x548b67);}(_0xb6f5,0x10e));var _0x5b6f=function(_0x27714d,_0x457b53){_0x27714d=_0x27714d-0x0;var _0x18e2fb=_0xb6f5[_0x27714d];return _0x18e2fb;};'use strict';var EventEmitter=require(_0x5b6f('0x0'));var MailAccount=require(_0x5b6f('0x1'))['db']['MailAccount'];var MailAccountEvents=new EventEmitter();MailAccountEvents[_0x5b6f('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x5b6f('0x3'),'afterDestroy':'remove'};function emitEvent(_0x3857ac){return function(_0x365e9a,_0x514bfc,_0x4b4dd2){MailAccountEvents['emit'](_0x3857ac+':'+_0x365e9a['id'],_0x365e9a);MailAccountEvents[_0x5b6f('0x4')](_0x3857ac,_0x365e9a);_0x4b4dd2(null);};}for(var e in events){if(events[_0x5b6f('0x5')](e)){var event=events[e];MailAccount['hook'](e,emitEvent(event));}}module[_0x5b6f('0x6')]=MailAccountEvents; \ No newline at end of file +var _0x1dea=['exports','events','../../mysqldb','setMaxListeners','update','remove','emit','hasOwnProperty','hook'];(function(_0x340380,_0x4bd2a8){var _0x49ce1c=function(_0x4cb9e2){while(--_0x4cb9e2){_0x340380['push'](_0x340380['shift']());}};_0x49ce1c(++_0x4bd2a8);}(_0x1dea,0xfd));var _0xa1de=function(_0x433dbe,_0x2412bc){_0x433dbe=_0x433dbe-0x0;var _0x3c147b=_0x1dea[_0x433dbe];return _0x3c147b;};'use strict';var EventEmitter=require(_0xa1de('0x0'));var MailAccount=require(_0xa1de('0x1'))['db']['MailAccount'];var MailAccountEvents=new EventEmitter();MailAccountEvents[_0xa1de('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0xa1de('0x3'),'afterDestroy':_0xa1de('0x4')};function emitEvent(_0x3c35b2){return function(_0x1649c1,_0x12bb5d,_0x21ace8){MailAccountEvents[_0xa1de('0x5')](_0x3c35b2+':'+_0x1649c1['id'],_0x1649c1);MailAccountEvents[_0xa1de('0x5')](_0x3c35b2,_0x1649c1);_0x21ace8(null);};}for(var e in events){if(events[_0xa1de('0x6')](e)){var event=events[e];MailAccount[_0xa1de('0x7')](e,emitEvent(event));}}module[_0xa1de('0x8')]=MailAccountEvents; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.model.js b/server/api/mailAccount/mailAccount.model.js index 08062f5..c3e3dae 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 _0x00c5=['MailAccount','mail_accounts','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./mailAccount.attributes','exports','define'];(function(_0x1b8c71,_0x41d8ab){var _0x539905=function(_0x395edd){while(--_0x395edd){_0x1b8c71['push'](_0x1b8c71['shift']());}};_0x539905(++_0x41d8ab);}(_0x00c5,0x8e));var _0x500c=function(_0x1b2618,_0x44a931){_0x1b2618=_0x1b2618-0x0;var _0x58cd7b=_0x00c5[_0x1b2618];return _0x58cd7b;};'use strict';var _=require(_0x500c('0x0'));var util=require('util');var logger=require(_0x500c('0x1'))(_0x500c('0x2'));var moment=require(_0x500c('0x3'));var BPromise=require(_0x500c('0x4'));var rp=require(_0x500c('0x5'));var fs=require('fs');var path=require(_0x500c('0x6'));var rimraf=require(_0x500c('0x7'));var config=require(_0x500c('0x8'));var attributes=require(_0x500c('0x9'));module[_0x500c('0xa')]=function(_0x3edbc4,_0x169c9d){return _0x3edbc4[_0x500c('0xb')](_0x500c('0xc'),attributes,{'tableName':_0x500c('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x003a=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./mailAccount.attributes','exports','lodash','util'];(function(_0x3995dc,_0x1f14a9){var _0x4647c7=function(_0xf41e04){while(--_0xf41e04){_0x3995dc['push'](_0x3995dc['shift']());}};_0x4647c7(++_0x1f14a9);}(_0x003a,0xca));var _0xa003=function(_0x1316be,_0x5edf66){_0x1316be=_0x1316be-0x0;var _0x2c9864=_0x003a[_0x1316be];return _0x2c9864;};'use strict';var _=require(_0xa003('0x0'));var util=require(_0xa003('0x1'));var logger=require(_0xa003('0x2'))(_0xa003('0x3'));var moment=require(_0xa003('0x4'));var BPromise=require(_0xa003('0x5'));var rp=require(_0xa003('0x6'));var fs=require('fs');var path=require(_0xa003('0x7'));var rimraf=require(_0xa003('0x8'));var config=require(_0xa003('0x9'));var attributes=require(_0xa003('0xa'));module[_0xa003('0xb')]=function(_0x1734d0,_0x13f52e){return _0x1734d0['define']('MailAccount',attributes,{'tableName':'mail_accounts','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 804e68a..ce58a6c 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 _0xa62c=['contact','originTo','originCc','bcc','Attachment','Attachments','UserId','name','unshift','agent','waitForTheAssignedAgent','startRouting','Start','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','register','request','then','info','MailAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','catch','GetMailAccount','MailAccount','raw','options','where','attributes','include','map','model','ShowMailAccount','find','NotifyMailAccount','body','difference','keys','CmContact','createdAt','updatedAt','isNil','mapKey','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','from','CmList','List','Contacts','DESC','MailApplication','Applications','MailServerOut','Smtp','get','omit','applications','orderBy','priority','account','autoclose','push','length','close','*,*,*,*','ListId','create','messageId','generate','subject','format','YYYY-MM-DD\x20HH:mm:ss','MailInteraction','MailMessage','Messages','inReplyTo','Contact\x20not\x20found','update','attach','interaction'];(function(_0x2dc725,_0x42ea65){var _0x173e5f=function(_0x26c2aa){while(--_0x26c2aa){_0x2dc725['push'](_0x2dc725['shift']());}};_0x173e5f(++_0x42ea65);}(_0xa62c,0x70));var _0xca62=function(_0x29c261,_0x3af39a){_0x29c261=_0x29c261-0x0;var _0x1a9335=_0xa62c[_0x29c261];return _0x1a9335;};'use strict';var _=require(_0xca62('0x0'));var util=require(_0xca62('0x1'));var moment=require(_0xca62('0x2'));var BPromise=require(_0xca62('0x3'));var rs=require(_0xca62('0x4'));var fs=require('fs');var Redis=require(_0xca62('0x5'));var db=require(_0xca62('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xca62('0x7'))(_0xca62('0x8'));var config=require(_0xca62('0x9'));var jayson=require(_0xca62('0xa'));var client=jayson[_0xca62('0xb')][_0xca62('0xc')]({'port':0x232c});config[_0xca62('0xd')]=_[_0xca62('0xe')](config['redis'],{'host':_0xca62('0xf'),'port':0x18eb});var socket=require(_0xca62('0x10'))(new Redis(config[_0xca62('0xd')]));require('./mailAccount.socket')[_0xca62('0x11')](socket);function respondWithRpcPromise(_0x3dd26b,_0x254a7b,_0x5bcb2d){return new BPromise(function(_0x2da5ad,_0x3baba5){return client[_0xca62('0x12')](_0x3dd26b,_0x5bcb2d)[_0xca62('0x13')](function(_0x10d507){logger[_0xca62('0x14')](_0xca62('0x15'),_0x254a7b,_0xca62('0x16'));logger[_0xca62('0x17')]('MailAccount,\x20%s,\x20%s,\x20%s',_0x254a7b,_0xca62('0x16'),JSON[_0xca62('0x18')](_0x10d507));if(_0x10d507[_0xca62('0x19')]){if(_0x10d507['error']['code']===0x1f4){logger['error'](_0xca62('0x15'),_0x254a7b,_0x10d507['error'][_0xca62('0x1a')]);return _0x3baba5(_0x10d507[_0xca62('0x19')]['message']);}logger['error'](_0xca62('0x15'),_0x254a7b,_0x10d507[_0xca62('0x19')][_0xca62('0x1a')]);return _0x2da5ad(_0x10d507['error'][_0xca62('0x1a')]);}else{logger[_0xca62('0x14')](_0xca62('0x15'),_0x254a7b,'request\x20sent');_0x2da5ad(_0x10d507[_0xca62('0x1b')][_0xca62('0x1a')]);}})[_0xca62('0x1c')](function(_0x11cfa1){logger[_0xca62('0x19')](_0xca62('0x15'),_0x254a7b,_0x11cfa1);_0x3baba5(_0x11cfa1);});});}exports[_0xca62('0x1d')]=function(_0x27c97b){var _0x3e4465=this;return new Promise(function(_0x94f92,_0x133132){return db[_0xca62('0x1e')]['findAll']({'raw':_0x27c97b['options']?_0x27c97b['options'][_0xca62('0x1f')]===undefined?!![]:![]:!![],'where':_0x27c97b[_0xca62('0x20')]?_0x27c97b[_0xca62('0x20')][_0xca62('0x21')]||null:null,'attributes':_0x27c97b[_0xca62('0x20')]?_0x27c97b[_0xca62('0x20')][_0xca62('0x22')]||null:null,'limit':_0x27c97b[_0xca62('0x20')]?_0x27c97b['options']['limit']||null:null,'include':_0x27c97b[_0xca62('0x20')]?_0x27c97b['options'][_0xca62('0x23')]?_[_0xca62('0x24')](_0x27c97b[_0xca62('0x20')][_0xca62('0x23')],function(_0x20e970){return{'model':db[_0x20e970[_0xca62('0x25')]],'as':_0x20e970['as'],'attributes':_0x20e970['attributes'],'include':_0x20e970['include']?_[_0xca62('0x24')](_0x20e970[_0xca62('0x23')],function(_0x53f5fb){return{'model':db[_0x53f5fb['model']],'as':_0x53f5fb['as'],'attributes':_0x53f5fb[_0xca62('0x22')],'include':_0x53f5fb['include']?_[_0xca62('0x24')](_0x53f5fb[_0xca62('0x23')],function(_0x1ed588){return{'model':db[_0x1ed588[_0xca62('0x25')]],'as':_0x1ed588['as'],'attributes':_0x1ed588[_0xca62('0x22')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x4958d7){logger[_0xca62('0x14')](_0xca62('0x1d'),_0x27c97b);logger['debug'](_0xca62('0x1d'),_0x27c97b,JSON[_0xca62('0x18')](_0x4958d7));_0x94f92(_0x4958d7);})[_0xca62('0x1c')](function(_0xf58a90){logger[_0xca62('0x19')](_0xca62('0x1d'),_0xf58a90[_0xca62('0x1a')],_0x27c97b);_0x133132(_0x3e4465[_0xca62('0x19')](0x1f4,_0xf58a90[_0xca62('0x1a')]));});});};exports[_0xca62('0x26')]=function(_0x2de1e7){var _0x1fa7cd=this;return new Promise(function(_0x290736,_0x2cb805){return db[_0xca62('0x1e')][_0xca62('0x27')]({'raw':_0x2de1e7[_0xca62('0x20')]?_0x2de1e7[_0xca62('0x20')][_0xca62('0x1f')]===undefined?!![]:![]:!![],'where':_0x2de1e7[_0xca62('0x20')]?_0x2de1e7['options']['where']||null:null,'attributes':_0x2de1e7[_0xca62('0x20')]?_0x2de1e7[_0xca62('0x20')]['attributes']||null:null,'include':_0x2de1e7['options']?_0x2de1e7[_0xca62('0x20')][_0xca62('0x23')]?_[_0xca62('0x24')](_0x2de1e7[_0xca62('0x20')]['include'],function(_0x1d22ed){return{'model':db[_0x1d22ed[_0xca62('0x25')]],'as':_0x1d22ed['as'],'attributes':_0x1d22ed['attributes'],'include':_0x1d22ed['include']?_['map'](_0x1d22ed[_0xca62('0x23')],function(_0x5d2332){return{'model':db[_0x5d2332[_0xca62('0x25')]],'as':_0x5d2332['as'],'attributes':_0x5d2332[_0xca62('0x22')],'include':_0x5d2332[_0xca62('0x23')]?_[_0xca62('0x24')](_0x5d2332[_0xca62('0x23')],function(_0x14d0e3){return{'model':db[_0x14d0e3[_0xca62('0x25')]],'as':_0x14d0e3['as'],'attributes':_0x14d0e3['attributes']};}):[]};}):[]};}):[]:[]})[_0xca62('0x13')](function(_0x1c1d53){logger[_0xca62('0x14')](_0xca62('0x26'),_0x2de1e7);logger[_0xca62('0x17')](_0xca62('0x26'),_0x2de1e7,JSON[_0xca62('0x18')](_0x1c1d53));_0x290736(_0x1c1d53);})[_0xca62('0x1c')](function(_0x5629de){logger[_0xca62('0x19')](_0xca62('0x26'),_0x5629de['message'],_0x2de1e7);_0x2cb805(_0x1fa7cd['error'](0x1f4,_0x5629de[_0xca62('0x1a')]));});});};exports[_0xca62('0x28')]=function(_0x14645c){var _0x3b0af6=this;return new Promise(function(_0x4fad4b,_0x4c8a89){var _0x39991f={'body':_0x14645c[_0xca62('0x29')],'channel':'mail'};var _0x2cc33a=_[_0xca62('0x2a')](_[_0xca62('0x2b')](db[_0xca62('0x2c')]['rawAttributes']),[_0xca62('0x2d'),_0xca62('0x2e'),'CompanyId','ListId']);var _0x285133=![];if(_0x14645c[_0xca62('0x29')]['id']){delete _0x14645c[_0xca62('0x29')]['id'];}if(_[_0xca62('0x2f')](_0x14645c[_0xca62('0x29')]['from'])){return _0x4c8a89(_0x3b0af6[_0xca62('0x19')](0x1f4,'from\x20is\x20mandatory'));}if(_[_0xca62('0x2f')](_0x14645c[_0xca62('0x29')][_0xca62('0x29')])||_0x14645c[_0xca62('0x29')][_0xca62('0x29')]===''){return _0x4c8a89(_0x3b0af6[_0xca62('0x19')](0x1f4,'body\x20is\x20mandatory\x20and\x20not\x20empty'));}if(_['isNil'](_0x14645c['body'][_0xca62('0x30')])){return _0x4c8a89(_0x3b0af6[_0xca62('0x19')](0x1f4,'mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x2cc33a));}if(!_[_0xca62('0x31')](_0x2cc33a,_0x14645c['body'][_0xca62('0x30')])){return _0x4c8a89(_0x3b0af6[_0xca62('0x19')](0x1f4,_0xca62('0x32')+_0x2cc33a));}var _0x5640a0={};_0x5640a0[_0x14645c['body'][_0xca62('0x30')]]=_0x14645c[_0xca62('0x29')][_0xca62('0x33')];return db['MailAccount'][_0xca62('0x27')]({'where':{'id':_0x14645c['account']['id']},'include':[{'model':db[_0xca62('0x34')],'as':_0xca62('0x35'),'include':[{'model':db[_0xca62('0x2c')],'as':_0xca62('0x36'),'where':_0x5640a0,'limit':0x1,'order':[[_0xca62('0x2e'),_0xca62('0x37')]]}]},{'model':db[_0xca62('0x38')],'as':_0xca62('0x39')},{'model':db[_0xca62('0x3a')],'as':_0xca62('0x3b')}]})[_0xca62('0x13')](function(_0x2c72e2){if(_0x2c72e2&&_0x2c72e2[_0xca62('0x35')]){var _0x45ed60=_0x2c72e2[_0xca62('0x3c')]({'plain':!![]});_0x39991f['account']=_[_0xca62('0x3d')](_0x45ed60,[_0xca62('0x39'),_0xca62('0x35')]);_0x39991f[_0xca62('0x3e')]=_0x45ed60['Applications'];_0x39991f['list']=_0x45ed60['List'];_0x39991f[_0xca62('0x3e')]=_[_0xca62('0x3f')](_0x39991f[_0xca62('0x3e')],[_0xca62('0x40')],['asc']);if(_0x39991f[_0xca62('0x41')]&&_0x39991f[_0xca62('0x41')][_0xca62('0x42')]){_0x39991f[_0xca62('0x3e')][_0xca62('0x43')]({'id':0x0,'priority':_0x39991f[_0xca62('0x3e')][_0xca62('0x44')]+0x1,'app':_0xca62('0x45'),'appdata':_0xca62('0x42'),'interval':_0xca62('0x46')});}if(_0x39991f[_0xca62('0x41')][_0xca62('0x39')]){delete _0x39991f[_0xca62('0x41')][_0xca62('0x39')];}if(_0x39991f['account']['List']){delete _0x39991f[_0xca62('0x41')]['List'];}if(_0x45ed60[_0xca62('0x35')][_0xca62('0x36')][_0xca62('0x44')]){return _0x45ed60['List'][_0xca62('0x36')][0x0];}var _0x2ebc11=_[_0xca62('0xe')](_0x14645c[_0xca62('0x29')],{'firstName':_0x14645c['body'][_0xca62('0x33')],'ListId':_0x45ed60[_0xca62('0x47')]});_0x2ebc11[_0x14645c[_0xca62('0x29')][_0xca62('0x30')]]=_0x14645c[_0xca62('0x29')][_0xca62('0x33')];return db[_0xca62('0x2c')][_0xca62('0x48')](_0x2ebc11);}else{throw new Error('List\x20not\x20found');}})[_0xca62('0x13')](function(_0x18e79d){_0x39991f['contact']=_0x18e79d;if(_0x18e79d){if(!_0x14645c['body']['message']['messageId']){_0x14645c['body'][_0xca62('0x1a')][_0xca62('0x49')]=rs[_0xca62('0x4a')]()+'\x20'+_0x14645c[_0xca62('0x29')][_0xca62('0x1a')][_0xca62('0x33')];}var _0x4c0a5e={'ContactId':_0x18e79d['id'],'MailAccountId':_0x14645c['account']['id'],'inReplyTo':_0x14645c[_0xca62('0x29')][_0xca62('0x1a')]['messageId'],'to':_0x14645c[_0xca62('0x29')][_0xca62('0x1a')][_0xca62('0x33')],'cc':_0x14645c[_0xca62('0x29')][_0xca62('0x1a')]['cc'],'subject':_0x14645c['body'][_0xca62('0x1a')][_0xca62('0x4b')],'attach':_0x14645c[_0xca62('0x29')][_0xca62('0x1a')]['attach'],'lastMsgAt':moment()[_0xca62('0x4c')](_0xca62('0x4d')),'lastMsgDirection':'in','lastMsgBody':_0x14645c[_0xca62('0x29')]['body']};return db[_0xca62('0x4e')]['find']({'where':{'closed':![],'MailAccountId':_0x14645c[_0xca62('0x41')]['id']},'include':[{'model':db[_0xca62('0x4f')],'as':_0xca62('0x50'),'attributes':[_0xca62('0x49')],'where':{'messageId':_0x14645c[_0xca62('0x29')]['message'][_0xca62('0x51')]}}]})[_0xca62('0x13')](function(_0xd05bd4){if(_0xd05bd4){return[_0xd05bd4,![]];}return db[_0xca62('0x4e')][_0xca62('0x48')](_0x4c0a5e)[_0xca62('0x13')](function(_0x4f8936){return[_0x4f8936,!![]];});});}else{throw new Error(_0xca62('0x52'));}})['spread'](function(_0x55addd,_0xa012c9){if(_0x55addd){_0x285133=_0xa012c9;if(!_0xa012c9){return _0x55addd[_0xca62('0x53')]({'inReplyTo':_0x14645c['body'][_0xca62('0x1a')][_0xca62('0x49')],'to':_0x14645c[_0xca62('0x29')]['message']['from'],'cc':_0x14645c[_0xca62('0x29')][_0xca62('0x1a')]['cc'],'subject':_0x14645c['body']['message'][_0xca62('0x4b')],'attach':_0x55addd[_0xca62('0x54')]?_0x55addd[_0xca62('0x54')]:_0x14645c['body'][_0xca62('0x1a')][_0xca62('0x54')],'substatus':null,'substatusAt':moment()[_0xca62('0x4c')](_0xca62('0x4d')),'lastMsgAt':moment()[_0xca62('0x4c')](_0xca62('0x4d')),'lastMsgDirection':'in','lastMsgBody':_0x14645c[_0xca62('0x29')][_0xca62('0x29')]});}else{return _0x55addd;}}})[_0xca62('0x13')](function(_0x3368bd){_0x39991f['interaction']=_0x3368bd[_0xca62('0x3c')]({'plain':!![]});_0x39991f[_0xca62('0x55')]['created']=_0x285133;return db[_0xca62('0x4f')][_0xca62('0x48')]({'body':_0x14645c[_0xca62('0x29')][_0xca62('0x29')],'MailAccountId':_0x14645c['account']['id'],'MailInteractionId':_0x3368bd['id'],'direction':'in','ContactId':_0x39991f[_0xca62('0x56')]['id'],'messageId':_0x14645c[_0xca62('0x29')][_0xca62('0x1a')][_0xca62('0x49')],'from':_0x14645c['body'][_0xca62('0x1a')][_0xca62('0x33')],'to':_0x14645c[_0xca62('0x29')][_0xca62('0x1a')]['to'],'cc':_0x14645c[_0xca62('0x29')][_0xca62('0x1a')]['cc'],'subject':_0x14645c[_0xca62('0x29')][_0xca62('0x1a')][_0xca62('0x4b')],'attach':_0x14645c[_0xca62('0x29')][_0xca62('0x1a')][_0xca62('0x54')],'Attachments':_0x14645c[_0xca62('0x29')][_0xca62('0x1a')]['attachments'],'originTo':_0x14645c[_0xca62('0x29')][_0xca62('0x1a')][_0xca62('0x57')],'originCc':_0x14645c['body'][_0xca62('0x1a')][_0xca62('0x58')],'bcc':_0x14645c[_0xca62('0x29')]['message'][_0xca62('0x59')]},{'include':[{'model':db[_0xca62('0x5a')],'as':_0xca62('0x5b')}]});})['then'](function(_0x1fa237){_0x39991f[_0xca62('0x1a')]=_0x1fa237;if(_0x39991f[_0xca62('0x55')][_0xca62('0x5c')]){return db['User'][_0xca62('0x27')]({'attributes':['id',_0xca62('0x5d')],'where':{'id':_0x39991f[_0xca62('0x55')][_0xca62('0x5c')]}})[_0xca62('0x13')](function(_0x243af3){if(_0x243af3){_0x39991f['applications'][_0xca62('0x5e')]({'id':0x0,'priority':0x0,'app':_0xca62('0x5f'),'appdata':_0x243af3['name']+','+(_0x39991f[_0xca62('0x41')][_0xca62('0x60')]||0xa),'interval':_0xca62('0x46')});}return respondWithRpcPromise('Start',_0xca62('0x61'),_0x39991f);});}return respondWithRpcPromise(_0xca62('0x62'),_0xca62('0x61'),_0x39991f);})[_0xca62('0x13')](function(_0x5c18e1){_0x4fad4b(_0x5c18e1);})[_0xca62('0x1c')](function(_0x204411){_0x4c8a89(_0x3b0af6[_0xca62('0x19')](0x1f4,_0x204411[_0xca62('0x1a')]));});});}; \ No newline at end of file +var _0xa3b9=['where','attributes','limit','include','model','map','info','GetMailAccount','debug','ShowMailAccount','NotifyMailAccount','body','mail','difference','keys','CmContact','rawAttributes','updatedAt','CompanyId','ListId','isNil','from','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','account','CmList','List','Contacts','Applications','Smtp','get','omit','applications','list','priority','asc','autoclose','push','length','close','*,*,*,*','create','messageId','generate','subject','attach','format','YYYY-MM-DD\x20HH:mm:ss','MailInteraction','find','Messages','inReplyTo','update','interaction','created','MailMessage','contact','attachments','originTo','originCc','bcc','Attachments','UserId','User','unshift','agent','Start','startRouting','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','redis','defaults','localhost','socket.io-emitter','./mailAccount.socket','request','then','request\x20sent','stringify','error','MailAccount,\x20%s,\x20%s','message','result','catch','MailAccount','findAll','options','raw'];(function(_0x341df2,_0x5eabfe){var _0x141e56=function(_0x3e4a1a){while(--_0x3e4a1a){_0x341df2['push'](_0x341df2['shift']());}};_0x141e56(++_0x5eabfe);}(_0xa3b9,0x112));var _0x9a3b=function(_0x341e95,_0x18ab0c){_0x341e95=_0x341e95-0x0;var _0x2af873=_0xa3b9[_0x341e95];return _0x2af873;};'use strict';var _=require(_0x9a3b('0x0'));var util=require(_0x9a3b('0x1'));var moment=require(_0x9a3b('0x2'));var BPromise=require(_0x9a3b('0x3'));var rs=require(_0x9a3b('0x4'));var fs=require('fs');var Redis=require(_0x9a3b('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x9a3b('0x6'));var logger=require(_0x9a3b('0x7'))(_0x9a3b('0x8'));var config=require(_0x9a3b('0x9'));var jayson=require(_0x9a3b('0xa'));var client=jayson['client']['http']({'port':0x232c});config[_0x9a3b('0xb')]=_[_0x9a3b('0xc')](config[_0x9a3b('0xb')],{'host':_0x9a3b('0xd'),'port':0x18eb});var socket=require(_0x9a3b('0xe'))(new Redis(config[_0x9a3b('0xb')]));require(_0x9a3b('0xf'))['register'](socket);function respondWithRpcPromise(_0x15ba19,_0x1beb32,_0x3dacdf){return new BPromise(function(_0x3e5858,_0x4a4161){return client[_0x9a3b('0x10')](_0x15ba19,_0x3dacdf)[_0x9a3b('0x11')](function(_0x3457e5){logger['info']('MailAccount,\x20%s,\x20%s',_0x1beb32,_0x9a3b('0x12'));logger['debug']('MailAccount,\x20%s,\x20%s,\x20%s',_0x1beb32,_0x9a3b('0x12'),JSON[_0x9a3b('0x13')](_0x3457e5));if(_0x3457e5['error']){if(_0x3457e5[_0x9a3b('0x14')]['code']===0x1f4){logger[_0x9a3b('0x14')](_0x9a3b('0x15'),_0x1beb32,_0x3457e5[_0x9a3b('0x14')]['message']);return _0x4a4161(_0x3457e5['error'][_0x9a3b('0x16')]);}logger['error'](_0x9a3b('0x15'),_0x1beb32,_0x3457e5[_0x9a3b('0x14')][_0x9a3b('0x16')]);return _0x3e5858(_0x3457e5[_0x9a3b('0x14')][_0x9a3b('0x16')]);}else{logger['info']('MailAccount,\x20%s,\x20%s',_0x1beb32,_0x9a3b('0x12'));_0x3e5858(_0x3457e5[_0x9a3b('0x17')]['message']);}})[_0x9a3b('0x18')](function(_0x32b520){logger[_0x9a3b('0x14')]('MailAccount,\x20%s,\x20%s',_0x1beb32,_0x32b520);_0x4a4161(_0x32b520);});});}exports['GetMailAccount']=function(_0x6ee019){var _0x55c97c=this;return new Promise(function(_0x4960ab,_0x34665e){return db[_0x9a3b('0x19')][_0x9a3b('0x1a')]({'raw':_0x6ee019[_0x9a3b('0x1b')]?_0x6ee019[_0x9a3b('0x1b')][_0x9a3b('0x1c')]===undefined?!![]:![]:!![],'where':_0x6ee019['options']?_0x6ee019[_0x9a3b('0x1b')][_0x9a3b('0x1d')]||null:null,'attributes':_0x6ee019[_0x9a3b('0x1b')]?_0x6ee019[_0x9a3b('0x1b')][_0x9a3b('0x1e')]||null:null,'limit':_0x6ee019[_0x9a3b('0x1b')]?_0x6ee019[_0x9a3b('0x1b')][_0x9a3b('0x1f')]||null:null,'include':_0x6ee019['options']?_0x6ee019[_0x9a3b('0x1b')][_0x9a3b('0x20')]?_['map'](_0x6ee019['options'][_0x9a3b('0x20')],function(_0x23f0e2){return{'model':db[_0x23f0e2[_0x9a3b('0x21')]],'as':_0x23f0e2['as'],'attributes':_0x23f0e2[_0x9a3b('0x1e')],'include':_0x23f0e2['include']?_[_0x9a3b('0x22')](_0x23f0e2[_0x9a3b('0x20')],function(_0x9daa08){return{'model':db[_0x9daa08[_0x9a3b('0x21')]],'as':_0x9daa08['as'],'attributes':_0x9daa08[_0x9a3b('0x1e')],'include':_0x9daa08[_0x9a3b('0x20')]?_['map'](_0x9daa08[_0x9a3b('0x20')],function(_0x4eeb4b){return{'model':db[_0x4eeb4b[_0x9a3b('0x21')]],'as':_0x4eeb4b['as'],'attributes':_0x4eeb4b[_0x9a3b('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x9a3b('0x11')](function(_0x504b44){logger[_0x9a3b('0x23')](_0x9a3b('0x24'),_0x6ee019);logger[_0x9a3b('0x25')](_0x9a3b('0x24'),_0x6ee019,JSON[_0x9a3b('0x13')](_0x504b44));_0x4960ab(_0x504b44);})[_0x9a3b('0x18')](function(_0x4f1abe){logger['error'](_0x9a3b('0x24'),_0x4f1abe[_0x9a3b('0x16')],_0x6ee019);_0x34665e(_0x55c97c[_0x9a3b('0x14')](0x1f4,_0x4f1abe[_0x9a3b('0x16')]));});});};exports[_0x9a3b('0x26')]=function(_0x4ea56c){var _0x5b446c=this;return new Promise(function(_0x5b30c7,_0x38d06e){return db[_0x9a3b('0x19')]['find']({'raw':_0x4ea56c[_0x9a3b('0x1b')]?_0x4ea56c[_0x9a3b('0x1b')][_0x9a3b('0x1c')]===undefined?!![]:![]:!![],'where':_0x4ea56c['options']?_0x4ea56c['options'][_0x9a3b('0x1d')]||null:null,'attributes':_0x4ea56c['options']?_0x4ea56c[_0x9a3b('0x1b')]['attributes']||null:null,'include':_0x4ea56c[_0x9a3b('0x1b')]?_0x4ea56c['options'][_0x9a3b('0x20')]?_[_0x9a3b('0x22')](_0x4ea56c[_0x9a3b('0x1b')][_0x9a3b('0x20')],function(_0x3f5ab6){return{'model':db[_0x3f5ab6['model']],'as':_0x3f5ab6['as'],'attributes':_0x3f5ab6[_0x9a3b('0x1e')],'include':_0x3f5ab6['include']?_[_0x9a3b('0x22')](_0x3f5ab6[_0x9a3b('0x20')],function(_0x119044){return{'model':db[_0x119044[_0x9a3b('0x21')]],'as':_0x119044['as'],'attributes':_0x119044[_0x9a3b('0x1e')],'include':_0x119044[_0x9a3b('0x20')]?_['map'](_0x119044['include'],function(_0x3f06b6){return{'model':db[_0x3f06b6[_0x9a3b('0x21')]],'as':_0x3f06b6['as'],'attributes':_0x3f06b6[_0x9a3b('0x1e')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x2819fa){logger['info'](_0x9a3b('0x26'),_0x4ea56c);logger[_0x9a3b('0x25')](_0x9a3b('0x26'),_0x4ea56c,JSON['stringify'](_0x2819fa));_0x5b30c7(_0x2819fa);})[_0x9a3b('0x18')](function(_0x1ca18a){logger[_0x9a3b('0x14')](_0x9a3b('0x26'),_0x1ca18a[_0x9a3b('0x16')],_0x4ea56c);_0x38d06e(_0x5b446c[_0x9a3b('0x14')](0x1f4,_0x1ca18a['message']));});});};exports[_0x9a3b('0x27')]=function(_0x33f136){var _0x3ba059=this;return new Promise(function(_0x493632,_0x341e7e){var _0x38b040={'body':_0x33f136[_0x9a3b('0x28')],'channel':_0x9a3b('0x29')};var _0x18a959=_[_0x9a3b('0x2a')](_[_0x9a3b('0x2b')](db[_0x9a3b('0x2c')][_0x9a3b('0x2d')]),['createdAt',_0x9a3b('0x2e'),_0x9a3b('0x2f'),_0x9a3b('0x30')]);var _0x1caec6=![];if(_0x33f136[_0x9a3b('0x28')]['id']){delete _0x33f136[_0x9a3b('0x28')]['id'];}if(_[_0x9a3b('0x31')](_0x33f136[_0x9a3b('0x28')][_0x9a3b('0x32')])){return _0x341e7e(_0x3ba059[_0x9a3b('0x14')](0x1f4,_0x9a3b('0x33')));}if(_[_0x9a3b('0x31')](_0x33f136[_0x9a3b('0x28')][_0x9a3b('0x28')])||_0x33f136[_0x9a3b('0x28')][_0x9a3b('0x28')]===''){return _0x341e7e(_0x3ba059[_0x9a3b('0x14')](0x1f4,_0x9a3b('0x34')));}if(_[_0x9a3b('0x31')](_0x33f136[_0x9a3b('0x28')]['mapKey'])){return _0x341e7e(_0x3ba059[_0x9a3b('0x14')](0x1f4,_0x9a3b('0x35')+_0x18a959));}if(!_[_0x9a3b('0x36')](_0x18a959,_0x33f136[_0x9a3b('0x28')][_0x9a3b('0x37')])){return _0x341e7e(_0x3ba059[_0x9a3b('0x14')](0x1f4,_0x9a3b('0x38')+_0x18a959));}var _0x149df1={};_0x149df1[_0x33f136[_0x9a3b('0x28')][_0x9a3b('0x37')]]=_0x33f136[_0x9a3b('0x28')][_0x9a3b('0x32')];return db[_0x9a3b('0x19')]['find']({'where':{'id':_0x33f136[_0x9a3b('0x39')]['id']},'include':[{'model':db[_0x9a3b('0x3a')],'as':_0x9a3b('0x3b'),'include':[{'model':db[_0x9a3b('0x2c')],'as':_0x9a3b('0x3c'),'where':_0x149df1,'limit':0x1,'order':[[_0x9a3b('0x2e'),'DESC']]}]},{'model':db['MailApplication'],'as':_0x9a3b('0x3d')},{'model':db['MailServerOut'],'as':_0x9a3b('0x3e')}]})[_0x9a3b('0x11')](function(_0x1e23ef){if(_0x1e23ef&&_0x1e23ef[_0x9a3b('0x3b')]){var _0xbc13b3=_0x1e23ef[_0x9a3b('0x3f')]({'plain':!![]});_0x38b040[_0x9a3b('0x39')]=_[_0x9a3b('0x40')](_0xbc13b3,[_0x9a3b('0x3d'),_0x9a3b('0x3b')]);_0x38b040[_0x9a3b('0x41')]=_0xbc13b3[_0x9a3b('0x3d')];_0x38b040[_0x9a3b('0x42')]=_0xbc13b3[_0x9a3b('0x3b')];_0x38b040[_0x9a3b('0x41')]=_['orderBy'](_0x38b040[_0x9a3b('0x41')],[_0x9a3b('0x43')],[_0x9a3b('0x44')]);if(_0x38b040['account']&&_0x38b040[_0x9a3b('0x39')][_0x9a3b('0x45')]){_0x38b040['applications'][_0x9a3b('0x46')]({'id':0x0,'priority':_0x38b040[_0x9a3b('0x41')][_0x9a3b('0x47')]+0x1,'app':_0x9a3b('0x48'),'appdata':_0x9a3b('0x45'),'interval':_0x9a3b('0x49')});}if(_0x38b040[_0x9a3b('0x39')][_0x9a3b('0x3d')]){delete _0x38b040[_0x9a3b('0x39')][_0x9a3b('0x3d')];}if(_0x38b040[_0x9a3b('0x39')][_0x9a3b('0x3b')]){delete _0x38b040[_0x9a3b('0x39')][_0x9a3b('0x3b')];}if(_0xbc13b3[_0x9a3b('0x3b')][_0x9a3b('0x3c')][_0x9a3b('0x47')]){return _0xbc13b3[_0x9a3b('0x3b')][_0x9a3b('0x3c')][0x0];}var _0x5488de=_['defaults'](_0x33f136[_0x9a3b('0x28')],{'firstName':_0x33f136[_0x9a3b('0x28')][_0x9a3b('0x32')],'ListId':_0xbc13b3[_0x9a3b('0x30')]});_0x5488de[_0x33f136['body'][_0x9a3b('0x37')]]=_0x33f136[_0x9a3b('0x28')]['from'];return db[_0x9a3b('0x2c')][_0x9a3b('0x4a')](_0x5488de);}else{throw new Error('List\x20not\x20found');}})['then'](function(_0x5ea313){_0x38b040['contact']=_0x5ea313;if(_0x5ea313){if(!_0x33f136['body']['message'][_0x9a3b('0x4b')]){_0x33f136[_0x9a3b('0x28')][_0x9a3b('0x16')]['messageId']=rs[_0x9a3b('0x4c')]()+'\x20'+_0x33f136[_0x9a3b('0x28')][_0x9a3b('0x16')][_0x9a3b('0x32')];}var _0x3a1082={'ContactId':_0x5ea313['id'],'MailAccountId':_0x33f136[_0x9a3b('0x39')]['id'],'inReplyTo':_0x33f136['body']['message'][_0x9a3b('0x4b')],'to':_0x33f136[_0x9a3b('0x28')][_0x9a3b('0x16')][_0x9a3b('0x32')],'cc':_0x33f136['body']['message']['cc'],'subject':_0x33f136[_0x9a3b('0x28')]['message'][_0x9a3b('0x4d')],'attach':_0x33f136[_0x9a3b('0x28')][_0x9a3b('0x16')][_0x9a3b('0x4e')],'lastMsgAt':moment()[_0x9a3b('0x4f')](_0x9a3b('0x50')),'lastMsgDirection':'in','lastMsgBody':_0x33f136[_0x9a3b('0x28')][_0x9a3b('0x28')]};return db[_0x9a3b('0x51')][_0x9a3b('0x52')]({'where':{'closed':![],'MailAccountId':_0x33f136[_0x9a3b('0x39')]['id']},'include':[{'model':db['MailMessage'],'as':_0x9a3b('0x53'),'attributes':['messageId'],'where':{'messageId':_0x33f136[_0x9a3b('0x28')][_0x9a3b('0x16')][_0x9a3b('0x54')]}}]})[_0x9a3b('0x11')](function(_0x41411d){if(_0x41411d){return[_0x41411d,![]];}return db[_0x9a3b('0x51')]['create'](_0x3a1082)[_0x9a3b('0x11')](function(_0x1ba863){return[_0x1ba863,!![]];});});}else{throw new Error('Contact\x20not\x20found');}})['spread'](function(_0x2a0e88,_0x5e56ae){if(_0x2a0e88){_0x1caec6=_0x5e56ae;if(!_0x5e56ae){return _0x2a0e88[_0x9a3b('0x55')]({'inReplyTo':_0x33f136[_0x9a3b('0x28')]['message'][_0x9a3b('0x4b')],'to':_0x33f136[_0x9a3b('0x28')][_0x9a3b('0x16')]['from'],'cc':_0x33f136[_0x9a3b('0x28')]['message']['cc'],'subject':_0x33f136[_0x9a3b('0x28')][_0x9a3b('0x16')]['subject'],'attach':_0x2a0e88['attach']?_0x2a0e88[_0x9a3b('0x4e')]:_0x33f136[_0x9a3b('0x28')][_0x9a3b('0x16')]['attach'],'substatus':null,'substatusAt':moment()[_0x9a3b('0x4f')](_0x9a3b('0x50')),'lastMsgAt':moment()['format'](_0x9a3b('0x50')),'lastMsgDirection':'in','lastMsgBody':_0x33f136[_0x9a3b('0x28')][_0x9a3b('0x28')]});}else{return _0x2a0e88;}}})['then'](function(_0x52d5c4){_0x38b040['interaction']=_0x52d5c4['get']({'plain':!![]});_0x38b040[_0x9a3b('0x56')][_0x9a3b('0x57')]=_0x1caec6;return db[_0x9a3b('0x58')][_0x9a3b('0x4a')]({'body':_0x33f136[_0x9a3b('0x28')][_0x9a3b('0x28')],'MailAccountId':_0x33f136[_0x9a3b('0x39')]['id'],'MailInteractionId':_0x52d5c4['id'],'direction':'in','ContactId':_0x38b040[_0x9a3b('0x59')]['id'],'messageId':_0x33f136[_0x9a3b('0x28')][_0x9a3b('0x16')][_0x9a3b('0x4b')],'from':_0x33f136[_0x9a3b('0x28')][_0x9a3b('0x16')][_0x9a3b('0x32')],'to':_0x33f136['body'][_0x9a3b('0x16')]['to'],'cc':_0x33f136[_0x9a3b('0x28')][_0x9a3b('0x16')]['cc'],'subject':_0x33f136['body']['message']['subject'],'attach':_0x33f136[_0x9a3b('0x28')][_0x9a3b('0x16')][_0x9a3b('0x4e')],'Attachments':_0x33f136[_0x9a3b('0x28')]['message'][_0x9a3b('0x5a')],'originTo':_0x33f136['body'][_0x9a3b('0x16')][_0x9a3b('0x5b')],'originCc':_0x33f136[_0x9a3b('0x28')][_0x9a3b('0x16')][_0x9a3b('0x5c')],'bcc':_0x33f136[_0x9a3b('0x28')][_0x9a3b('0x16')][_0x9a3b('0x5d')]},{'include':[{'model':db['Attachment'],'as':_0x9a3b('0x5e')}]});})[_0x9a3b('0x11')](function(_0x5ad314){_0x38b040[_0x9a3b('0x16')]=_0x5ad314;if(_0x38b040[_0x9a3b('0x56')][_0x9a3b('0x5f')]){return db[_0x9a3b('0x60')][_0x9a3b('0x52')]({'attributes':['id','name'],'where':{'id':_0x38b040['interaction'][_0x9a3b('0x5f')]}})[_0x9a3b('0x11')](function(_0x24781b){if(_0x24781b){_0x38b040['applications'][_0x9a3b('0x61')]({'id':0x0,'priority':0x0,'app':_0x9a3b('0x62'),'appdata':_0x24781b['name']+','+(_0x38b040['account']['waitForTheAssignedAgent']||0xa),'interval':'*,*,*,*'});}return respondWithRpcPromise(_0x9a3b('0x63'),_0x9a3b('0x64'),_0x38b040);});}return respondWithRpcPromise('Start','startRouting',_0x38b040);})[_0x9a3b('0x11')](function(_0x54c675){_0x493632(_0x54c675);})['catch'](function(_0x574b82){_0x341e7e(_0x3ba059[_0x9a3b('0x14')](0x1f4,_0x574b82[_0x9a3b('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.socket.js b/server/api/mailAccount/mailAccount.socket.js index 9b09514..0155b19 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 _0x960c=['remove','mailAccount:','./mailAccount.events'];(function(_0x19b84f,_0x48765e){var _0x18067b=function(_0x1c69aa){while(--_0x1c69aa){_0x19b84f['push'](_0x19b84f['shift']());}};_0x18067b(++_0x48765e);}(_0x960c,0x113));var _0xc960=function(_0x57c01b,_0x249651){_0x57c01b=_0x57c01b-0x0;var _0x2c216e=_0x960c[_0x57c01b];return _0x2c216e;};'use strict';var MailAccountEvents=require(_0xc960('0x0'));var events=['save',_0xc960('0x1'),'update'];function createListener(_0x39a88a,_0x3334e7){return function(_0x265faf){_0x3334e7['emit'](_0x39a88a,_0x265faf);};}function removeListener(_0x1b54d7,_0x3ff69d){return function(){MailAccountEvents['removeListener'](_0x1b54d7,_0x3ff69d);};}exports['register']=function(_0x2bb9df){for(var _0x2beb88=0x0,_0x2cd4c9=events['length'];_0x2beb88<_0x2cd4c9;_0x2beb88++){var _0x513f9c=events[_0x2beb88];var _0x2934b2=createListener(_0xc960('0x2')+_0x513f9c,_0x2bb9df);MailAccountEvents['on'](_0x513f9c,_0x2934b2);}}; \ No newline at end of file +var _0x85d0=['emit','register','length','mailAccount:'];(function(_0x33faa3,_0x3b6e21){var _0x4abf73=function(_0x4bbc5f){while(--_0x4bbc5f){_0x33faa3['push'](_0x33faa3['shift']());}};_0x4abf73(++_0x3b6e21);}(_0x85d0,0x164));var _0x085d=function(_0x37e3f1,_0xee95c6){_0x37e3f1=_0x37e3f1-0x0;var _0x42c77b=_0x85d0[_0x37e3f1];return _0x42c77b;};'use strict';var MailAccountEvents=require('./mailAccount.events');var events=['save','remove','update'];function createListener(_0x297001,_0x1716e5){return function(_0xfd8773){_0x1716e5[_0x085d('0x0')](_0x297001,_0xfd8773);};}function removeListener(_0x231765,_0x19ae4c){return function(){MailAccountEvents['removeListener'](_0x231765,_0x19ae4c);};}exports[_0x085d('0x1')]=function(_0x5c917f){for(var _0x364f09=0x0,_0x9acc97=events[_0x085d('0x2')];_0x364f09<_0x9acc97;_0x364f09++){var _0x4a12b7=events[_0x364f09];var _0xf65d01=createListener(_0x085d('0x3')+_0x4a12b7,_0x5c917f);MailAccountEvents['on'](_0x4a12b7,_0xf65d01);}}; \ No newline at end of file diff --git a/server/api/mailApplication/index.js b/server/api/mailApplication/index.js index 51b879e..dececb4 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 _0xc788=['update','delete','destroy','exports','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailApplication.controller','/:id','isAuthenticated','show','put'];(function(_0x5df61d,_0x158640){var _0x24cc4c=function(_0x2de006){while(--_0x2de006){_0x5df61d['push'](_0x5df61d['shift']());}};_0x24cc4c(++_0x158640);}(_0xc788,0xc4));var _0x8c78=function(_0x215e5f,_0x321e4f){_0x215e5f=_0x215e5f-0x0;var _0x4ba505=_0xc788[_0x215e5f];return _0x4ba505;};'use strict';var multer=require(_0x8c78('0x0'));var util=require(_0x8c78('0x1'));var path=require(_0x8c78('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x8c78('0x3')]();var auth=require(_0x8c78('0x4'));var interaction=require(_0x8c78('0x5'));var config=require(_0x8c78('0x6'));var controller=require(_0x8c78('0x7'));router['get'](_0x8c78('0x8'),auth[_0x8c78('0x9')](),controller[_0x8c78('0xa')]);router[_0x8c78('0xb')](_0x8c78('0x8'),auth['isAuthenticated'](),controller[_0x8c78('0xc')]);router[_0x8c78('0xd')](_0x8c78('0x8'),auth[_0x8c78('0x9')](),controller[_0x8c78('0xe')]);module[_0x8c78('0xf')]=router; \ No newline at end of file +var _0x4483=['update','destroy','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','/:id','isAuthenticated','show','put'];(function(_0x1a08cf,_0x186382){var _0x4174b7=function(_0x263861){while(--_0x263861){_0x1a08cf['push'](_0x1a08cf['shift']());}};_0x4174b7(++_0x186382);}(_0x4483,0x1a3));var _0x3448=function(_0x3577ea,_0x64b30e){_0x3577ea=_0x3577ea-0x0;var _0x5f4cd9=_0x4483[_0x3577ea];return _0x5f4cd9;};'use strict';var multer=require(_0x3448('0x0'));var util=require(_0x3448('0x1'));var path=require(_0x3448('0x2'));var timeout=require('connect-timeout');var express=require(_0x3448('0x3'));var router=express[_0x3448('0x4')]();var auth=require(_0x3448('0x5'));var interaction=require(_0x3448('0x6'));var config=require(_0x3448('0x7'));var controller=require('./mailApplication.controller');router[_0x3448('0x8')](_0x3448('0x9'),auth[_0x3448('0xa')](),controller[_0x3448('0xb')]);router[_0x3448('0xc')](_0x3448('0x9'),auth[_0x3448('0xa')](),controller[_0x3448('0xd')]);router['delete']('/:id',auth[_0x3448('0xa')](),controller[_0x3448('0xe')]);module[_0x3448('0xf')]=router; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.attributes.js b/server/api/mailApplication/mailApplication.attributes.js index 3036a9c..a7657fd 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 _0x1fca=['sequelize','exports','INTEGER','STRING','noop','TEXT'];(function(_0x266d63,_0x1c1e64){var _0x1bf903=function(_0x18521d){while(--_0x18521d){_0x266d63['push'](_0x266d63['shift']());}};_0x1bf903(++_0x1c1e64);}(_0x1fca,0x108));var _0xa1fc=function(_0x4b5d99,_0x5aa754){_0x4b5d99=_0x4b5d99-0x0;var _0x1d79d7=_0x1fca[_0x4b5d99];return _0x1d79d7;};'use strict';var Sequelize=require(_0xa1fc('0x0'));module[_0xa1fc('0x1')]={'priority':{'type':Sequelize[_0xa1fc('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0xa1fc('0x3')],'allowNull':![],'defaultValue':_0xa1fc('0x4')},'appdata':{'type':Sequelize[_0xa1fc('0x5')]()},'description':{'type':Sequelize[_0xa1fc('0x3')]},'interval':{'type':Sequelize[_0xa1fc('0x3')],'defaultValue':'*,*,*,*'}}; \ No newline at end of file +var _0xd232=['TEXT','*,*,*,*','sequelize','exports','INTEGER','STRING','noop'];(function(_0x5cb97e,_0x132a39){var _0x1714b4=function(_0x384210){while(--_0x384210){_0x5cb97e['push'](_0x5cb97e['shift']());}};_0x1714b4(++_0x132a39);}(_0xd232,0x183));var _0x2d23=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xd232[_0x321bb2];return _0x9c12ed;};'use strict';var Sequelize=require(_0x2d23('0x0'));module[_0x2d23('0x1')]={'priority':{'type':Sequelize[_0x2d23('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0x2d23('0x3')],'allowNull':![],'defaultValue':_0x2d23('0x4')},'appdata':{'type':Sequelize[_0x2d23('0x5')]()},'description':{'type':Sequelize[_0x2d23('0x3')]},'interval':{'type':Sequelize[_0x2d23('0x3')],'defaultValue':_0x2d23('0x6')}}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.controller.js b/server/api/mailApplication/mailApplication.controller.js index 3d0dcfe..beda334 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 _0x44aa=['status','end','json','count','offset','limit','Content-Range','reject','save','update','then','destroy','stack','name','params','model','keys','rawAttributes','query','filters','intersection','fields','attributes','length','includeAll','include','merge','options','MailApplication','find','catch','body','html-pdf','rimraf','fast-json-patch','request-promise','moment','bluebird','util','sox','to-csv','ejs','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus'];(function(_0x3264d8,_0x2a5eeb){var _0x48f17f=function(_0x3a1c50){while(--_0x3a1c50){_0x3264d8['push'](_0x3264d8['shift']());}};_0x48f17f(++_0x2a5eeb);}(_0x44aa,0x100));var _0xa44a=function(_0x4775cd,_0x50b374){_0x4775cd=_0x4775cd-0x0;var _0x55a6b1=_0x44aa[_0x4775cd];return _0x55a6b1;};'use strict';var pdf=require(_0xa44a('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xa44a('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xa44a('0x2'));var rp=require(_0xa44a('0x3'));var moment=require(_0xa44a('0x4'));var BPromise=require(_0xa44a('0x5'));var Mustache=require('mustache');var util=require(_0xa44a('0x6'));var path=require('path');var sox=require(_0xa44a('0x7'));var csv=require(_0xa44a('0x8'));var ejs=require(_0xa44a('0x9'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xa44a('0xa'));var deskjs=require(_0xa44a('0xb'));var toCsv=require('to-csv');var querystring=require(_0xa44a('0xc'));var Papa=require(_0xa44a('0xd'));var Redis=require(_0xa44a('0xe'));var authService=require(_0xa44a('0xf'));var qs=require(_0xa44a('0x10'));var as=require(_0xa44a('0x11'));var hardwareService=require(_0xa44a('0x12'));var logger=require(_0xa44a('0x13'))(_0xa44a('0x14'));var utils=require('../../config/utils');var config=require(_0xa44a('0x15'));var db=require(_0xa44a('0x16'))['db'];function respondWithStatusCode(_0x5c46e9,_0x24113f){_0x24113f=_0x24113f||0xcc;return function(_0x2c23b4){if(_0x2c23b4){return _0x5c46e9[_0xa44a('0x17')](_0x24113f);}return _0x5c46e9[_0xa44a('0x18')](_0x24113f)[_0xa44a('0x19')]();};}function respondWithResult(_0x43ab3c,_0xfc0953){_0xfc0953=_0xfc0953||0xc8;return function(_0x60aaa5){if(_0x60aaa5){return _0x43ab3c[_0xa44a('0x18')](_0xfc0953)[_0xa44a('0x1a')](_0x60aaa5);}};}function respondWithFilteredResult(_0x1585fa,_0x20edeb){return function(_0x59e9e7){if(_0x59e9e7){var _0x44ebaf=_0x59e9e7[_0xa44a('0x1b')],_0x342431=_0x20edeb[_0xa44a('0x1c')],_0x27d5c1=_0x20edeb[_0xa44a('0x1c')]+_0x20edeb[_0xa44a('0x1d')],_0x21f1b3;if(_0x27d5c1>=_0x44ebaf){_0x27d5c1=_0x44ebaf;_0x21f1b3=0xc8;}else{_0x21f1b3=0xce;}_0x1585fa['status'](_0x21f1b3);return _0x1585fa['set'](_0xa44a('0x1e'),_0x342431+'-'+_0x27d5c1+'/'+_0x44ebaf)['json'](_0x59e9e7);}return null;};}function patchUpdates(_0x2d1e53){return function(_0x2b9e15){try{jsonpatch['apply'](_0x2b9e15,_0x2d1e53,!![]);}catch(_0x29988){return BPromise[_0xa44a('0x1f')](_0x29988);}return _0x2b9e15[_0xa44a('0x20')]();};}function saveUpdates(_0xe813a5,_0x3099df){return function(_0x10381a){if(_0x10381a){return _0x10381a[_0xa44a('0x21')](_0xe813a5)[_0xa44a('0x22')](function(_0x2cb7f9){return _0x2cb7f9;});}return null;};}function removeEntity(_0x589def,_0x3f14fc){return function(_0x20e182){if(_0x20e182){return _0x20e182[_0xa44a('0x23')]()[_0xa44a('0x22')](function(){_0x589def[_0xa44a('0x18')](0xcc)[_0xa44a('0x19')]();});}};}function handleEntityNotFound(_0x59a07b,_0x1b1c27){return function(_0x5b9f41){if(!_0x5b9f41){_0x59a07b[_0xa44a('0x17')](0x194);}return _0x5b9f41;};}function handleError(_0x2c25dc,_0x56829a){_0x56829a=_0x56829a||0x1f4;return function(_0x51d850){logger['error'](_0x51d850[_0xa44a('0x24')]);if(_0x51d850['name']){delete _0x51d850[_0xa44a('0x25')];}_0x2c25dc[_0xa44a('0x18')](_0x56829a)['send'](_0x51d850);};}exports['show']=function(_0x55b0b6,_0x15a0e9){var _0xa9b4a5={'raw':!![],'where':{'id':_0x55b0b6[_0xa44a('0x26')]['id']}},_0x1a5609={};_0x1a5609[_0xa44a('0x27')]=_[_0xa44a('0x28')](db['MailApplication'][_0xa44a('0x29')]);_0x1a5609[_0xa44a('0x2a')]=_[_0xa44a('0x28')](_0x55b0b6[_0xa44a('0x2a')]);_0x1a5609[_0xa44a('0x2b')]=_[_0xa44a('0x2c')](_0x1a5609['model'],_0x1a5609[_0xa44a('0x2a')]);_0xa9b4a5['attributes']=_[_0xa44a('0x2c')](_0x1a5609[_0xa44a('0x27')],qs[_0xa44a('0x2d')](_0x55b0b6[_0xa44a('0x2a')][_0xa44a('0x2d')]));_0xa9b4a5[_0xa44a('0x2e')]=_0xa9b4a5[_0xa44a('0x2e')][_0xa44a('0x2f')]?_0xa9b4a5[_0xa44a('0x2e')]:_0x1a5609[_0xa44a('0x27')];if(_0x55b0b6[_0xa44a('0x2a')][_0xa44a('0x30')]){_0xa9b4a5[_0xa44a('0x31')]=[{'all':!![]}];}_0xa9b4a5=_[_0xa44a('0x32')]({},_0xa9b4a5,_0x55b0b6[_0xa44a('0x33')]);return db[_0xa44a('0x34')][_0xa44a('0x35')](_0xa9b4a5)['then'](handleEntityNotFound(_0x15a0e9,null))['then'](respondWithResult(_0x15a0e9,null))[_0xa44a('0x36')](handleError(_0x15a0e9,null));};exports[_0xa44a('0x21')]=function(_0x495a5b,_0x20bd70){if(_0x495a5b[_0xa44a('0x37')]['id']){delete _0x495a5b[_0xa44a('0x37')]['id'];}return db[_0xa44a('0x34')]['find']({'where':{'id':_0x495a5b[_0xa44a('0x26')]['id']}})[_0xa44a('0x22')](handleEntityNotFound(_0x20bd70,null))['then'](saveUpdates(_0x495a5b[_0xa44a('0x37')],null))[_0xa44a('0x22')](respondWithResult(_0x20bd70,null))[_0xa44a('0x36')](handleError(_0x20bd70,null));};exports[_0xa44a('0x23')]=function(_0x482d2c,_0x12f11b){return db[_0xa44a('0x34')]['find']({'where':{'id':_0x482d2c[_0xa44a('0x26')]['id']}})[_0xa44a('0x22')](handleEntityNotFound(_0x12f11b,null))[_0xa44a('0x22')](removeEntity(_0x12f11b,null))[_0xa44a('0x36')](handleError(_0x12f11b,null));}; \ No newline at end of file +var _0xc777=['save','then','end','error','stack','name','show','params','model','keys','rawAttributes','query','intersection','fields','attributes','length','includeAll','include','merge','options','MailApplication','find','catch','update','body','destroy','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','sox','to-csv','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../mysqldb','sendStatus','status','json','count','offset','limit','set','Content-Range','apply','reject'];(function(_0x2f60e5,_0x55394e){var _0x42ad55=function(_0x3bbb09){while(--_0x3bbb09){_0x2f60e5['push'](_0x2f60e5['shift']());}};_0x42ad55(++_0x55394e);}(_0xc777,0x1b7));var _0x7c77=function(_0x434152,_0x3c7399){_0x434152=_0x434152-0x0;var _0xa6ee48=_0xc777[_0x434152];return _0xa6ee48;};'use strict';var pdf=require(_0x7c77('0x0'));var emlformat=require(_0x7c77('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x7c77('0x2'));var jsonpatch=require(_0x7c77('0x3'));var rp=require(_0x7c77('0x4'));var moment=require(_0x7c77('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x7c77('0x6'));var util=require('util');var path=require('path');var sox=require(_0x7c77('0x7'));var csv=require(_0x7c77('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x7c77('0x9'));var squel=require(_0x7c77('0xa'));var crypto=require(_0x7c77('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x7c77('0xc'));var toCsv=require('to-csv');var querystring=require(_0x7c77('0xd'));var Papa=require(_0x7c77('0xe'));var Redis=require(_0x7c77('0xf'));var authService=require(_0x7c77('0x10'));var qs=require(_0x7c77('0x11'));var as=require(_0x7c77('0x12'));var hardwareService=require(_0x7c77('0x13'));var logger=require(_0x7c77('0x14'))('api');var utils=require(_0x7c77('0x15'));var config=require('../../config/environment');var db=require(_0x7c77('0x16'))['db'];function respondWithStatusCode(_0x31c18b,_0x58bdac){_0x58bdac=_0x58bdac||0xcc;return function(_0x65ef3f){if(_0x65ef3f){return _0x31c18b[_0x7c77('0x17')](_0x58bdac);}return _0x31c18b[_0x7c77('0x18')](_0x58bdac)['end']();};}function respondWithResult(_0xb0997b,_0x5f3e20){_0x5f3e20=_0x5f3e20||0xc8;return function(_0x5ce14e){if(_0x5ce14e){return _0xb0997b['status'](_0x5f3e20)[_0x7c77('0x19')](_0x5ce14e);}};}function respondWithFilteredResult(_0x26e781,_0x5d9836){return function(_0x200ab7){if(_0x200ab7){var _0x31fe7a=_0x200ab7[_0x7c77('0x1a')],_0x109946=_0x5d9836[_0x7c77('0x1b')],_0x909bb8=_0x5d9836[_0x7c77('0x1b')]+_0x5d9836[_0x7c77('0x1c')],_0x74612b;if(_0x909bb8>=_0x31fe7a){_0x909bb8=_0x31fe7a;_0x74612b=0xc8;}else{_0x74612b=0xce;}_0x26e781[_0x7c77('0x18')](_0x74612b);return _0x26e781[_0x7c77('0x1d')](_0x7c77('0x1e'),_0x109946+'-'+_0x909bb8+'/'+_0x31fe7a)[_0x7c77('0x19')](_0x200ab7);}return null;};}function patchUpdates(_0x23ee8a){return function(_0x140c1b){try{jsonpatch[_0x7c77('0x1f')](_0x140c1b,_0x23ee8a,!![]);}catch(_0x573803){return BPromise[_0x7c77('0x20')](_0x573803);}return _0x140c1b[_0x7c77('0x21')]();};}function saveUpdates(_0xb5b2fa,_0xa8b179){return function(_0x41363c){if(_0x41363c){return _0x41363c['update'](_0xb5b2fa)['then'](function(_0x4640ad){return _0x4640ad;});}return null;};}function removeEntity(_0x5f03bc,_0x2a610d){return function(_0x4c43b2){if(_0x4c43b2){return _0x4c43b2['destroy']()[_0x7c77('0x22')](function(){_0x5f03bc[_0x7c77('0x18')](0xcc)[_0x7c77('0x23')]();});}};}function handleEntityNotFound(_0x3a8c5a,_0xa88589){return function(_0x99a617){if(!_0x99a617){_0x3a8c5a[_0x7c77('0x17')](0x194);}return _0x99a617;};}function handleError(_0x56ca14,_0x5494b1){_0x5494b1=_0x5494b1||0x1f4;return function(_0x3b848c){logger[_0x7c77('0x24')](_0x3b848c[_0x7c77('0x25')]);if(_0x3b848c[_0x7c77('0x26')]){delete _0x3b848c[_0x7c77('0x26')];}_0x56ca14[_0x7c77('0x18')](_0x5494b1)['send'](_0x3b848c);};}exports[_0x7c77('0x27')]=function(_0x3df5de,_0xa7293b){var _0x19f1ac={'raw':!![],'where':{'id':_0x3df5de[_0x7c77('0x28')]['id']}},_0x1370a9={};_0x1370a9[_0x7c77('0x29')]=_[_0x7c77('0x2a')](db['MailApplication'][_0x7c77('0x2b')]);_0x1370a9[_0x7c77('0x2c')]=_[_0x7c77('0x2a')](_0x3df5de['query']);_0x1370a9['filters']=_[_0x7c77('0x2d')](_0x1370a9['model'],_0x1370a9[_0x7c77('0x2c')]);_0x19f1ac['attributes']=_[_0x7c77('0x2d')](_0x1370a9[_0x7c77('0x29')],qs['fields'](_0x3df5de[_0x7c77('0x2c')][_0x7c77('0x2e')]));_0x19f1ac[_0x7c77('0x2f')]=_0x19f1ac[_0x7c77('0x2f')][_0x7c77('0x30')]?_0x19f1ac[_0x7c77('0x2f')]:_0x1370a9['model'];if(_0x3df5de[_0x7c77('0x2c')][_0x7c77('0x31')]){_0x19f1ac[_0x7c77('0x32')]=[{'all':!![]}];}_0x19f1ac=_[_0x7c77('0x33')]({},_0x19f1ac,_0x3df5de[_0x7c77('0x34')]);return db[_0x7c77('0x35')][_0x7c77('0x36')](_0x19f1ac)[_0x7c77('0x22')](handleEntityNotFound(_0xa7293b,null))[_0x7c77('0x22')](respondWithResult(_0xa7293b,null))[_0x7c77('0x37')](handleError(_0xa7293b,null));};exports[_0x7c77('0x38')]=function(_0x33f07e,_0xa979cf){if(_0x33f07e[_0x7c77('0x39')]['id']){delete _0x33f07e[_0x7c77('0x39')]['id'];}return db[_0x7c77('0x35')][_0x7c77('0x36')]({'where':{'id':_0x33f07e[_0x7c77('0x28')]['id']}})['then'](handleEntityNotFound(_0xa979cf,null))['then'](saveUpdates(_0x33f07e[_0x7c77('0x39')],null))[_0x7c77('0x22')](respondWithResult(_0xa979cf,null))[_0x7c77('0x37')](handleError(_0xa979cf,null));};exports[_0x7c77('0x3a')]=function(_0x4b580d,_0x46eab1){return db[_0x7c77('0x35')][_0x7c77('0x36')]({'where':{'id':_0x4b580d['params']['id']}})[_0x7c77('0x22')](handleEntityNotFound(_0x46eab1,null))[_0x7c77('0x22')](removeEntity(_0x46eab1,null))['catch'](handleError(_0x46eab1,null));}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.model.js b/server/api/mailApplication/mailApplication.model.js index c5b9262..12f57cc 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 _0x0b28=['utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','./mailApplication.attributes','mail_applications','utf8mb4'];(function(_0x192752,_0x109ba7){var _0x320d73=function(_0x324b3b){while(--_0x324b3b){_0x192752['push'](_0x192752['shift']());}};_0x320d73(++_0x109ba7);}(_0x0b28,0xe7));var _0x80b2=function(_0x561f25,_0x2d95c1){_0x561f25=_0x561f25-0x0;var _0x150e4c=_0x0b28[_0x561f25];return _0x150e4c;};'use strict';var _=require(_0x80b2('0x0'));var util=require(_0x80b2('0x1'));var logger=require(_0x80b2('0x2'))(_0x80b2('0x3'));var moment=require(_0x80b2('0x4'));var BPromise=require(_0x80b2('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(_0x80b2('0x6'));module['exports']=function(_0x237dbd,_0x30f7e2){return _0x237dbd['define']('MailApplication',attributes,{'tableName':_0x80b2('0x7'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x80b2('0x8'),'collate':_0x80b2('0x9')});}; \ No newline at end of file +var _0x25ec=['utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','bluebird','request-promise','rimraf','../../config/environment','./mailApplication.attributes','define','mail_applications'];(function(_0x547da9,_0x452b5b){var _0x56b3a7=function(_0x5d1924){while(--_0x5d1924){_0x547da9['push'](_0x547da9['shift']());}};_0x56b3a7(++_0x452b5b);}(_0x25ec,0xb8));var _0xc25e=function(_0x525da2,_0xc20be5){_0x525da2=_0x525da2-0x0;var _0x12562f=_0x25ec[_0x525da2];return _0x12562f;};'use strict';var _=require(_0xc25e('0x0'));var util=require(_0xc25e('0x1'));var logger=require(_0xc25e('0x2'))(_0xc25e('0x3'));var moment=require('moment');var BPromise=require(_0xc25e('0x4'));var rp=require(_0xc25e('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xc25e('0x6'));var config=require(_0xc25e('0x7'));var attributes=require(_0xc25e('0x8'));module['exports']=function(_0x1c7dca,_0x379d12){return _0x1c7dca[_0xc25e('0x9')]('MailApplication',attributes,{'tableName':_0xc25e('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xc25e('0xb'),'collate':_0xc25e('0xc')});}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.rpc.js b/server/api/mailApplication/mailApplication.rpc.js index 698d24a..cfc157a 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 _0xfb54=['MailApplication,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','catch','UpdateMailApplication','update','body','options','raw','attributes','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','request','then','info'];(function(_0x22e47a,_0x4ea10c){var _0x15a12a=function(_0x4a097f){while(--_0x4a097f){_0x22e47a['push'](_0x22e47a['shift']());}};_0x15a12a(++_0x4ea10c);}(_0xfb54,0xee));var _0x4fb5=function(_0x637e59,_0x3af14f){_0x637e59=_0x637e59-0x0;var _0x22d914=_0xfb54[_0x637e59];return _0x22d914;};'use strict';var _=require(_0x4fb5('0x0'));var util=require(_0x4fb5('0x1'));var moment=require(_0x4fb5('0x2'));var BPromise=require(_0x4fb5('0x3'));var rs=require(_0x4fb5('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x4fb5('0x5'))['db'];var utils=require(_0x4fb5('0x6'));var logger=require(_0x4fb5('0x7'))('rpc');var config=require(_0x4fb5('0x8'));var jayson=require(_0x4fb5('0x9'));var client=jayson[_0x4fb5('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0xb9b636,_0xb61291,_0x3fbec1){return new BPromise(function(_0x50a146,_0x15ec9f){return client[_0x4fb5('0xb')](_0xb9b636,_0x3fbec1)[_0x4fb5('0xc')](function(_0x596ab6){logger[_0x4fb5('0xd')](_0x4fb5('0xe'),_0xb61291,_0x4fb5('0xf'));logger[_0x4fb5('0x10')]('MailApplication,\x20%s,\x20%s,\x20%s',_0xb61291,_0x4fb5('0xf'),JSON[_0x4fb5('0x11')](_0x596ab6));if(_0x596ab6[_0x4fb5('0x12')]){if(_0x596ab6[_0x4fb5('0x12')]['code']===0x1f4){logger['error'](_0x4fb5('0xe'),_0xb61291,_0x596ab6[_0x4fb5('0x12')][_0x4fb5('0x13')]);return _0x15ec9f(_0x596ab6['error'][_0x4fb5('0x13')]);}logger[_0x4fb5('0x12')](_0x4fb5('0xe'),_0xb61291,_0x596ab6[_0x4fb5('0x12')][_0x4fb5('0x13')]);return _0x50a146(_0x596ab6[_0x4fb5('0x12')][_0x4fb5('0x13')]);}else{logger[_0x4fb5('0xd')](_0x4fb5('0xe'),_0xb61291,_0x4fb5('0xf'));_0x50a146(_0x596ab6[_0x4fb5('0x14')][_0x4fb5('0x13')]);}})[_0x4fb5('0x15')](function(_0x238a5c){logger['error'](_0x4fb5('0xe'),_0xb61291,_0x238a5c);_0x15ec9f(_0x238a5c);});});}exports[_0x4fb5('0x16')]=function(_0x333227){var _0x3c9a02=this;return new Promise(function(_0x5359fd,_0x503a47){return db['MailApplication'][_0x4fb5('0x17')](_0x333227[_0x4fb5('0x18')],{'raw':_0x333227[_0x4fb5('0x19')]?_0x333227[_0x4fb5('0x19')][_0x4fb5('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x333227[_0x4fb5('0x19')]?_0x333227['options']['where']||null:null,'attributes':_0x333227[_0x4fb5('0x19')]?_0x333227['options'][_0x4fb5('0x1b')]||null:null,'limit':_0x333227[_0x4fb5('0x19')]?_0x333227[_0x4fb5('0x19')]['limit']||null:null})[_0x4fb5('0xc')](function(_0x5443f8){logger[_0x4fb5('0xd')]('UpdateMailApplication',_0x333227);logger[_0x4fb5('0x10')](_0x4fb5('0x16'),_0x333227,JSON[_0x4fb5('0x11')](_0x5443f8));_0x5359fd(_0x5443f8);})[_0x4fb5('0x15')](function(_0x6da93b){logger[_0x4fb5('0x12')](_0x4fb5('0x16'),_0x6da93b[_0x4fb5('0x13')],_0x333227);_0x503a47(_0x3c9a02[_0x4fb5('0x12')](0x1f4,_0x6da93b['message']));});});}; \ No newline at end of file +var _0x54ae=['info','MailApplication,\x20%s,\x20%s','debug','MailApplication,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','UpdateMailApplication','update','body','options','raw','where','attributes','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','then'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x54ae,0x18b));var _0xe54a=function(_0x466bc5,_0x3a0f2a){_0x466bc5=_0x466bc5-0x0;var _0x138952=_0x54ae[_0x466bc5];return _0x138952;};'use strict';var _=require(_0xe54a('0x0'));var util=require(_0xe54a('0x1'));var moment=require(_0xe54a('0x2'));var BPromise=require(_0xe54a('0x3'));var rs=require(_0xe54a('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xe54a('0x5'))['db'];var utils=require(_0xe54a('0x6'));var logger=require(_0xe54a('0x7'))(_0xe54a('0x8'));var config=require('../../config/environment');var jayson=require(_0xe54a('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x43df22,_0x20e097,_0xb78bbf){return new BPromise(function(_0x27fe7f,_0x4a4191){return client['request'](_0x43df22,_0xb78bbf)[_0xe54a('0xa')](function(_0x30460b){logger[_0xe54a('0xb')](_0xe54a('0xc'),_0x20e097,'request\x20sent');logger[_0xe54a('0xd')](_0xe54a('0xe'),_0x20e097,_0xe54a('0xf'),JSON[_0xe54a('0x10')](_0x30460b));if(_0x30460b[_0xe54a('0x11')]){if(_0x30460b[_0xe54a('0x11')][_0xe54a('0x12')]===0x1f4){logger[_0xe54a('0x11')](_0xe54a('0xc'),_0x20e097,_0x30460b[_0xe54a('0x11')][_0xe54a('0x13')]);return _0x4a4191(_0x30460b[_0xe54a('0x11')][_0xe54a('0x13')]);}logger['error'](_0xe54a('0xc'),_0x20e097,_0x30460b[_0xe54a('0x11')][_0xe54a('0x13')]);return _0x27fe7f(_0x30460b['error']['message']);}else{logger[_0xe54a('0xb')](_0xe54a('0xc'),_0x20e097,_0xe54a('0xf'));_0x27fe7f(_0x30460b[_0xe54a('0x14')]['message']);}})[_0xe54a('0x15')](function(_0x2c970d){logger[_0xe54a('0x11')](_0xe54a('0xc'),_0x20e097,_0x2c970d);_0x4a4191(_0x2c970d);});});}exports[_0xe54a('0x16')]=function(_0x555399){var _0x59cd41=this;return new Promise(function(_0x4e4e78,_0xf1a494){return db['MailApplication'][_0xe54a('0x17')](_0x555399[_0xe54a('0x18')],{'raw':_0x555399[_0xe54a('0x19')]?_0x555399['options'][_0xe54a('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x555399['options']?_0x555399[_0xe54a('0x19')][_0xe54a('0x1b')]||null:null,'attributes':_0x555399[_0xe54a('0x19')]?_0x555399[_0xe54a('0x19')][_0xe54a('0x1c')]||null:null,'limit':_0x555399[_0xe54a('0x19')]?_0x555399['options']['limit']||null:null})[_0xe54a('0xa')](function(_0x3630a4){logger[_0xe54a('0xb')]('UpdateMailApplication',_0x555399);logger[_0xe54a('0xd')](_0xe54a('0x16'),_0x555399,JSON['stringify'](_0x3630a4));_0x4e4e78(_0x3630a4);})[_0xe54a('0x15')](function(_0x3f70b5){logger[_0xe54a('0x11')]('UpdateMailApplication',_0x3f70b5['message'],_0x555399);_0xf1a494(_0x59cd41[_0xe54a('0x11')](0x1f4,_0x3f70b5[_0xe54a('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/mailInteraction/index.js b/server/api/mailInteraction/index.js index 424509e..7e1ad1c 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 _0x7952=['delete','destroy','removeTags','exports','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailInteraction.controller','get','isAuthenticated','describe','/:id','/:id/messages','getMessages','/:id/download','download','post','create','addMessage','tracked','mail','mailinteraction:addtags','addTags','mailinteraction:update','update'];(function(_0x5a1734,_0x420117){var _0x40e2cd=function(_0x20f1c3){while(--_0x20f1c3){_0x5a1734['push'](_0x5a1734['shift']());}};_0x40e2cd(++_0x420117);}(_0x7952,0xec));var _0x2795=function(_0x244862,_0x3da79e){_0x244862=_0x244862-0x0;var _0x2bce23=_0x7952[_0x244862];return _0x2bce23;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x2795('0x0'));var timeout=require(_0x2795('0x1'));var express=require(_0x2795('0x2'));var router=express[_0x2795('0x3')]();var auth=require(_0x2795('0x4'));var interaction=require(_0x2795('0x5'));var config=require(_0x2795('0x6'));var controller=require(_0x2795('0x7'));router[_0x2795('0x8')]('/',auth[_0x2795('0x9')](),controller['index']);router[_0x2795('0x8')]('/describe',auth[_0x2795('0x9')](),controller[_0x2795('0xa')]);router['get'](_0x2795('0xb'),auth[_0x2795('0x9')](),controller['show']);router[_0x2795('0x8')](_0x2795('0xc'),auth[_0x2795('0x9')](),controller[_0x2795('0xd')]);router[_0x2795('0x8')](_0x2795('0xe'),auth[_0x2795('0x9')](),controller[_0x2795('0xf')]);router[_0x2795('0x10')]('/',auth[_0x2795('0x9')](),controller[_0x2795('0x11')]);router[_0x2795('0x10')]('/:id/messages',auth[_0x2795('0x9')](),controller[_0x2795('0x12')]);router[_0x2795('0x10')]('/:id/tags',auth['isAuthenticated'](),interaction[_0x2795('0x13')](_0x2795('0x14'),_0x2795('0x15')),controller[_0x2795('0x16')]);router['put'](_0x2795('0xb'),auth[_0x2795('0x9')](),interaction[_0x2795('0x13')](_0x2795('0x14'),_0x2795('0x17')),controller[_0x2795('0x18')]);router[_0x2795('0x19')](_0x2795('0xb'),auth[_0x2795('0x9')](),interaction[_0x2795('0x13')](_0x2795('0x14'),'mailinteraction:destroy'),controller[_0x2795('0x1a')]);router[_0x2795('0x19')]('/:id/tags',auth['isAuthenticated'](),controller[_0x2795('0x1b')]);module[_0x2795('0x1c')]=router; \ No newline at end of file +var _0x3248=['create','tracked','mail','mailinteraction:addtags','put','mailinteraction:update','update','delete','mailinteraction:destroy','destroy','removeTags','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','./mailInteraction.controller','get','index','/describe','isAuthenticated','describe','/:id','show','getMessages','download','post'];(function(_0x28a351,_0x4c5fd4){var _0x24c03a=function(_0x37b5e7){while(--_0x37b5e7){_0x28a351['push'](_0x28a351['shift']());}};_0x24c03a(++_0x4c5fd4);}(_0x3248,0x1b0));var _0x8324=function(_0x2bb943,_0x67ea62){_0x2bb943=_0x2bb943-0x0;var _0x1d481c=_0x3248[_0x2bb943];return _0x1d481c;};'use strict';var multer=require(_0x8324('0x0'));var util=require(_0x8324('0x1'));var path=require(_0x8324('0x2'));var timeout=require(_0x8324('0x3'));var express=require(_0x8324('0x4'));var router=express[_0x8324('0x5')]();var auth=require(_0x8324('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x8324('0x7'));router[_0x8324('0x8')]('/',auth['isAuthenticated'](),controller[_0x8324('0x9')]);router[_0x8324('0x8')](_0x8324('0xa'),auth[_0x8324('0xb')](),controller[_0x8324('0xc')]);router['get'](_0x8324('0xd'),auth[_0x8324('0xb')](),controller[_0x8324('0xe')]);router['get']('/:id/messages',auth[_0x8324('0xb')](),controller[_0x8324('0xf')]);router[_0x8324('0x8')]('/:id/download',auth[_0x8324('0xb')](),controller[_0x8324('0x10')]);router[_0x8324('0x11')]('/',auth[_0x8324('0xb')](),controller[_0x8324('0x12')]);router[_0x8324('0x11')]('/:id/messages',auth['isAuthenticated'](),controller['addMessage']);router[_0x8324('0x11')]('/:id/tags',auth['isAuthenticated'](),interaction[_0x8324('0x13')](_0x8324('0x14'),_0x8324('0x15')),controller['addTags']);router[_0x8324('0x16')](_0x8324('0xd'),auth[_0x8324('0xb')](),interaction['tracked'](_0x8324('0x14'),_0x8324('0x17')),controller[_0x8324('0x18')]);router[_0x8324('0x19')](_0x8324('0xd'),auth[_0x8324('0xb')](),interaction['tracked']('mail',_0x8324('0x1a')),controller[_0x8324('0x1b')]);router[_0x8324('0x19')]('/:id/tags',auth[_0x8324('0xb')](),controller[_0x8324('0x1c')]);module[_0x8324('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 0b60ff8..b9e5c16 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 _0x408e=['TEXT','long','DATE','ENUM','out','sequelize','STRING'];(function(_0x49b813,_0xbb0127){var _0x40ae70=function(_0x373e50){while(--_0x373e50){_0x49b813['push'](_0x49b813['shift']());}};_0x40ae70(++_0xbb0127);}(_0x408e,0x194));var _0xe408=function(_0x304bf7,_0x4fcafc){_0x304bf7=_0x304bf7-0x0;var _0x5036cd=_0x408e[_0x304bf7];return _0x5036cd;};'use strict';var Sequelize=require(_0xe408('0x0'));var iconv=require('iconv');module['exports']={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0xe408('0x1')]},'inReplyTo':{'type':Sequelize[_0xe408('0x1')](0x1fe)},'to':{'type':Sequelize[_0xe408('0x1')]},'cc':{'type':Sequelize[_0xe408('0x2')](_0xe408('0x3'))},'subject':{'type':Sequelize[_0xe408('0x2')]()},'attach':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'read1stAt':{'type':Sequelize[_0xe408('0x4')]},'substatus':{'type':Sequelize[_0xe408('0x1')](0x3c)},'substatusAt':{'type':Sequelize[_0xe408('0x4')]},'firstMsgDirection':{'type':Sequelize[_0xe408('0x5')]('in',_0xe408('0x6')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize[_0xe408('0x5')]('in',_0xe408('0x6')),'defaultValue':'in','allowNull':![]},'lastMsgBody':{'type':Sequelize[_0xe408('0x2')](_0xe408('0x3'))},'lastMsgText':{'type':Sequelize[_0xe408('0x2')](_0xe408('0x3'))}}; \ No newline at end of file +var _0x092b=['ENUM','out','sequelize','iconv','exports','DATE','STRING','TEXT','long','BOOLEAN'];(function(_0x3d2f6a,_0x3e4923){var _0x5c4851=function(_0x213ba1){while(--_0x213ba1){_0x3d2f6a['push'](_0x3d2f6a['shift']());}};_0x5c4851(++_0x3e4923);}(_0x092b,0x19c));var _0xb092=function(_0x347eed,_0x12af42){_0x347eed=_0x347eed-0x0;var _0x2cf2f0=_0x092b[_0x347eed];return _0x2cf2f0;};'use strict';var Sequelize=require(_0xb092('0x0'));var iconv=require(_0xb092('0x1'));module[_0xb092('0x2')]={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xb092('0x3')]},'disposition':{'type':Sequelize[_0xb092('0x4')]},'note':{'type':Sequelize['STRING']},'inReplyTo':{'type':Sequelize[_0xb092('0x4')](0x1fe)},'to':{'type':Sequelize[_0xb092('0x4')]},'cc':{'type':Sequelize[_0xb092('0x5')](_0xb092('0x6'))},'subject':{'type':Sequelize[_0xb092('0x5')]()},'attach':{'type':Sequelize[_0xb092('0x7')],'defaultValue':![]},'read1stAt':{'type':Sequelize['DATE']},'substatus':{'type':Sequelize[_0xb092('0x4')](0x3c)},'substatusAt':{'type':Sequelize['DATE']},'firstMsgDirection':{'type':Sequelize[_0xb092('0x8')]('in',_0xb092('0x9')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize[_0xb092('0x8')]('in','out'),'defaultValue':'in','allowNull':![]},'lastMsgBody':{'type':Sequelize[_0xb092('0x5')]('long')},'lastMsgText':{'type':Sequelize[_0xb092('0x5')](_0xb092('0x6'))}}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.controller.js b/server/api/mailInteraction/mailInteraction.controller.js index 2e18e65..d3ab214 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(_0x46df24,_0x44ea54){var _0x2106b7=function(_0x22184c){while(--_0x22184c){_0x46df24['push'](_0x46df24['shift']());}};_0x2106b7(++_0x44ea54);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0xa9e0[_0x2dafbe];return _0x58a45a;};'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(_0x1a1315,_0x1b65b7){var _0x14b1ba=function(_0x11eaf8){while(--_0x11eaf8){_0x1a1315['push'](_0x1a1315['shift']());}};_0x14b1ba(++_0x1b65b7);}(_0xa9e0,0x123));var _0x0a9e=function(_0x54d4fe,_0x55e869){_0x54d4fe=_0x54d4fe-0x0;var _0x1ab5bb=_0xa9e0[_0x54d4fe];return _0x1ab5bb;};'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 ba03239..b9ceade 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 _0x793f=['remove','getUsers','then','setDataValue','findAll','unreadMessages','length','emit','catch','../../mysqldb','MailInteraction','setMaxListeners','save','update'];(function(_0x28947d,_0x4cc9c6){var _0x12d2ee=function(_0x3f38fc){while(--_0x3f38fc){_0x28947d['push'](_0x28947d['shift']());}};_0x12d2ee(++_0x4cc9c6);}(_0x793f,0xa3));var _0xf793=function(_0x177350,_0x219bdb){_0x177350=_0x177350-0x0;var _0x32bc81=_0x793f[_0x177350];return _0x32bc81;};'use strict';var EventEmitter=require('events');var MailInteraction=require(_0xf793('0x0'))['db'][_0xf793('0x1')];var MailMessage=require(_0xf793('0x0'))['db']['MailMessage'];var MailInteractionEvents=new EventEmitter();MailInteractionEvents[_0xf793('0x2')](0x0);var events={'afterCreate':_0xf793('0x3'),'afterUpdate':_0xf793('0x4'),'afterDestroy':_0xf793('0x5')};function emitEvent(_0x39e826){return function(_0x2712b5,_0x29d1c7,_0x567398){_0x2712b5[_0xf793('0x6')]({'attributes':['id'],'raw':!![]})[_0xf793('0x7')](function(_0x5aceb0){_0x2712b5[_0xf793('0x8')]('Users',_0x5aceb0['map'](function(_0x51158f){return{'id':_0x51158f['id']};}));return MailMessage[_0xf793('0x9')]({'where':{'MailInteractionId':_0x2712b5['id'],'direction':'in','read':![]},'raw':!![]});})[_0xf793('0x7')](function(_0x1c3722){_0x2712b5[_0xf793('0x8')](_0xf793('0xa'),_0x1c3722[_0xf793('0xb')]);MailInteractionEvents['emit'](_0x39e826+':'+_0x2712b5['id'],_0x2712b5);MailInteractionEvents[_0xf793('0xc')](_0x39e826,_0x2712b5);_0x567398(null);})[_0xf793('0xd')](_0x567398(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];MailInteraction['hook'](e,emitEvent(event));}}module['exports']=MailInteractionEvents; \ No newline at end of file +var _0x62f0=['remove','then','findAll','setDataValue','unreadMessages','length','catch','hook','events','../../mysqldb','MailInteraction','save','update'];(function(_0x17ce02,_0x5ce6fa){var _0x326356=function(_0x1423cc){while(--_0x1423cc){_0x17ce02['push'](_0x17ce02['shift']());}};_0x326356(++_0x5ce6fa);}(_0x62f0,0xd8));var _0x062f=function(_0x188c88,_0x210793){_0x188c88=_0x188c88-0x0;var _0x4e4c38=_0x62f0[_0x188c88];return _0x4e4c38;};'use strict';var EventEmitter=require(_0x062f('0x0'));var MailInteraction=require(_0x062f('0x1'))['db'][_0x062f('0x2')];var MailMessage=require(_0x062f('0x1'))['db']['MailMessage'];var MailInteractionEvents=new EventEmitter();MailInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x062f('0x3'),'afterUpdate':_0x062f('0x4'),'afterDestroy':_0x062f('0x5')};function emitEvent(_0x54b7f7){return function(_0x571a56,_0x1b6f51,_0x3d28b5){_0x571a56['getUsers']({'attributes':['id'],'raw':!![]})[_0x062f('0x6')](function(_0x52f10f){_0x571a56['setDataValue']('Users',_0x52f10f['map'](function(_0x21e722){return{'id':_0x21e722['id']};}));return MailMessage[_0x062f('0x7')]({'where':{'MailInteractionId':_0x571a56['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x4cf373){_0x571a56[_0x062f('0x8')](_0x062f('0x9'),_0x4cf373[_0x062f('0xa')]);MailInteractionEvents['emit'](_0x54b7f7+':'+_0x571a56['id'],_0x571a56);MailInteractionEvents['emit'](_0x54b7f7,_0x571a56);_0x3d28b5(null);})[_0x062f('0xb')](_0x3d28b5(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];MailInteraction[_0x062f('0xc')](e,emitEvent(event));}}module['exports']=MailInteractionEvents; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.model.js b/server/api/mailInteraction/mailInteraction.model.js index ff6b460..ba0d27c 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(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x3e74,0x175));var _0x43e7=function(_0x5b2e87,_0x54e206){_0x5b2e87=_0x5b2e87-0x0;var _0xdf7aae=_0x3e74[_0x5b2e87];return _0xdf7aae;};'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 _0x55ca=['changed','models','get','update','then','catch','utf8mb4','utf8mb4_unicode_ci','lodash','util','bluebird','request-promise','rimraf','../../config/environment','./mailInteraction.attributes','exports','define','mail_interactions','fti_mail_interactions','FULLTEXT','substatus','substatusAt','format','YYYY-MM-DD\x20HH:mm:ss','closed','closedAt'];(function(_0x5199af,_0x1eb67c){var _0x381974=function(_0x456a88){while(--_0x456a88){_0x5199af['push'](_0x5199af['shift']());}};_0x381974(++_0x1eb67c);}(_0x55ca,0x126));var _0xa55c=function(_0x205b46,_0x3ca65b){_0x205b46=_0x205b46-0x0;var _0x2b6ae8=_0x55ca[_0x205b46];return _0x2b6ae8;};'use strict';var _=require(_0xa55c('0x0'));var util=require(_0xa55c('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0xa55c('0x2'));var rp=require(_0xa55c('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0xa55c('0x4'));var config=require(_0xa55c('0x5'));var attributes=require(_0xa55c('0x6'));module[_0xa55c('0x7')]=function(_0x3c97c8,_0x279caa){return _0x3c97c8[_0xa55c('0x8')]('MailInteraction',attributes,{'tableName':_0xa55c('0x9'),'paranoid':![],'indexes':[{'name':_0xa55c('0xa'),'fields':['subject','to'],'type':_0xa55c('0xb')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x290d28,_0x52a3bc,_0x5849ad){if(_0x290d28[_0xa55c('0xc')]){_0x290d28[_0xa55c('0xd')]=moment()[_0xa55c('0xe')](_0xa55c('0xf'));}if(_0x290d28[_0xa55c('0x10')]){_0x290d28[_0xa55c('0x11')]=moment()[_0xa55c('0xe')](_0xa55c('0xf'));}_0x5849ad(null,_0x52a3bc);},'beforeUpdate':function(_0x3998f7,_0x15eec8,_0x5d47ff){if(_0x3998f7['changed'](_0xa55c('0xc'))){_0x3998f7['substatusAt']=_0x3998f7['substatus']?moment()['format'](_0xa55c('0xf')):null;}if(_0x3998f7[_0xa55c('0x12')](_0xa55c('0x10'))){_0x3998f7[_0xa55c('0x11')]=moment()[_0xa55c('0xe')](_0xa55c('0xf'));_0x3998f7['substatus']=null;_0x3998f7[_0xa55c('0xd')]=null;}_0x5d47ff(null,_0x3998f7);},'afterUpdate':function(_0x3dcf4f,_0x25934f,_0x31e10d){var _0x1c4cfd=_0x3c97c8[_0xa55c('0x13')];var _0x51590e=_0x3dcf4f[_0xa55c('0x14')]({'plain':!![]});if(_0x51590e[_0xa55c('0x10')]){return _0x1c4cfd['MailMessage'][_0xa55c('0x15')]({'read':!![]},{'where':{'MailInteractionId':_0x51590e['id']}})[_0xa55c('0x16')](function(){_0x31e10d();})[_0xa55c('0x17')](function(_0x358b61){_0x31e10d(_0x358b61);});}else{_0x31e10d();}}},'charset':_0xa55c('0x18'),'collate':_0xa55c('0x19')});}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.rpc.js b/server/api/mailInteraction/mailInteraction.rpc.js index c8118fd..d355266 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 _0x2948=['spread','catch','AddTags','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','redis','./mailInteraction.socket','request','info','MailInteraction,\x20%s,\x20%s','request\x20sent','debug','MailInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','UpdateMailInteraction','MailInteraction','body','options','raw','where','attributes','limit','then','AddTagsToMailInteraction','find','ids','omit'];(function(_0x3bae41,_0x5561de){var _0x5a2203=function(_0xf1d224){while(--_0xf1d224){_0x3bae41['push'](_0x3bae41['shift']());}};_0x5a2203(++_0x5561de);}(_0x2948,0xcb));var _0x8294=function(_0x588378,_0x4765d7){_0x588378=_0x588378-0x0;var _0x15298d=_0x2948[_0x588378];return _0x15298d;};'use strict';var _=require(_0x8294('0x0'));var util=require(_0x8294('0x1'));var moment=require(_0x8294('0x2'));var BPromise=require(_0x8294('0x3'));var rs=require(_0x8294('0x4'));var fs=require('fs');var Redis=require(_0x8294('0x5'));var db=require(_0x8294('0x6'))['db'];var utils=require(_0x8294('0x7'));var logger=require(_0x8294('0x8'))('rpc');var config=require(_0x8294('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x8294('0xa')][_0x8294('0xb')]({'port':0x232a});config[_0x8294('0xc')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x8294('0xc')]));require(_0x8294('0xd'))['register'](socket);function respondWithRpcPromise(_0x35aa7a,_0x3e7ac4,_0x266d88){return new BPromise(function(_0x82e937,_0x3e5d4a){return client[_0x8294('0xe')](_0x35aa7a,_0x266d88)['then'](function(_0x179208){logger[_0x8294('0xf')](_0x8294('0x10'),_0x3e7ac4,_0x8294('0x11'));logger[_0x8294('0x12')](_0x8294('0x13'),_0x3e7ac4,_0x8294('0x11'),JSON[_0x8294('0x14')](_0x179208));if(_0x179208['error']){if(_0x179208[_0x8294('0x15')][_0x8294('0x16')]===0x1f4){logger[_0x8294('0x15')]('MailInteraction,\x20%s,\x20%s',_0x3e7ac4,_0x179208['error']['message']);return _0x3e5d4a(_0x179208[_0x8294('0x15')][_0x8294('0x17')]);}logger[_0x8294('0x15')](_0x8294('0x10'),_0x3e7ac4,_0x179208[_0x8294('0x15')][_0x8294('0x17')]);return _0x82e937(_0x179208[_0x8294('0x15')][_0x8294('0x17')]);}else{logger[_0x8294('0xf')](_0x8294('0x10'),_0x3e7ac4,_0x8294('0x11'));_0x82e937(_0x179208['result'][_0x8294('0x17')]);}})['catch'](function(_0x470e21){logger[_0x8294('0x15')](_0x8294('0x10'),_0x3e7ac4,_0x470e21);_0x3e5d4a(_0x470e21);});});}exports[_0x8294('0x18')]=function(_0x30f80b){var _0x1edffd=this;return new Promise(function(_0x38380b,_0x27273d){return db[_0x8294('0x19')]['update'](_0x30f80b[_0x8294('0x1a')],{'raw':_0x30f80b[_0x8294('0x1b')]?_0x30f80b['options'][_0x8294('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x30f80b[_0x8294('0x1b')]?_0x30f80b[_0x8294('0x1b')][_0x8294('0x1d')]||null:null,'attributes':_0x30f80b[_0x8294('0x1b')]?_0x30f80b[_0x8294('0x1b')][_0x8294('0x1e')]||null:null,'limit':_0x30f80b[_0x8294('0x1b')]?_0x30f80b[_0x8294('0x1b')][_0x8294('0x1f')]||null:null})[_0x8294('0x20')](function(_0x54fbf3){logger['info'](_0x8294('0x18'),_0x30f80b);logger['debug'](_0x8294('0x18'),_0x30f80b,JSON['stringify'](_0x54fbf3));_0x38380b(_0x54fbf3);})['catch'](function(_0x37601e){logger[_0x8294('0x15')]('UpdateMailInteraction',_0x37601e[_0x8294('0x17')],_0x30f80b);_0x27273d(_0x1edffd[_0x8294('0x15')](0x1f4,_0x37601e[_0x8294('0x17')]));});});};exports[_0x8294('0x21')]=function(_0x58c4d2){return new Promise(function(_0x4ce49e,_0x311e6b){return db[_0x8294('0x19')][_0x8294('0x22')]({'where':_0x58c4d2['options']?_0x58c4d2['options'][_0x8294('0x1d')]||null:null})[_0x8294('0x20')](function(_0x32cb49){if(_0x32cb49){return _0x32cb49['addTags'](_0x58c4d2['body'][_0x8294('0x23')],_[_0x8294('0x24')](_0x58c4d2['body'],[_0x8294('0x23'),'id'])||{});}})[_0x8294('0x25')](function(_0x5808fa){logger[_0x8294('0xf')]('AddTags',_0x58c4d2);logger[_0x8294('0x12')]('AddTags',_0x58c4d2,JSON[_0x8294('0x14')](_0x5808fa));_0x4ce49e(_0x5808fa);})[_0x8294('0x26')](function(_0x35a9cc){logger[_0x8294('0x15')](_0x8294('0x27'),_0x35a9cc[_0x8294('0x17')],_0x58c4d2);_0x311e6b(_this[_0x8294('0x15')](0x1f4,_0x35a9cc['message']));});});}; \ No newline at end of file +var _0xc368=['rpc','../../config/environment','jayson/promise','client','defaults','redis','localhost','socket.io-emitter','./mailInteraction.socket','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','MailInteraction','update','body','options','raw','attributes','limit','AddTagsToMailInteraction','where','addTags','ids','omit','spread','AddTags','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0xdf2d08,_0x47f349){var _0x341245=function(_0x3a7231){while(--_0x3a7231){_0xdf2d08['push'](_0xdf2d08['shift']());}};_0x341245(++_0x47f349);}(_0xc368,0x7b));var _0x8c36=function(_0x3e7b03,_0x29ffa9){_0x3e7b03=_0x3e7b03-0x0;var _0x25a7bb=_0xc368[_0x3e7b03];return _0x25a7bb;};'use strict';var _=require('lodash');var util=require(_0x8c36('0x0'));var moment=require('moment');var BPromise=require(_0x8c36('0x1'));var rs=require(_0x8c36('0x2'));var fs=require('fs');var Redis=require(_0x8c36('0x3'));var db=require(_0x8c36('0x4'))['db'];var utils=require(_0x8c36('0x5'));var logger=require('../../config/logger')(_0x8c36('0x6'));var config=require(_0x8c36('0x7'));var jayson=require(_0x8c36('0x8'));var client=jayson[_0x8c36('0x9')]['http']({'port':0x232a});config['redis']=_[_0x8c36('0xa')](config[_0x8c36('0xb')],{'host':_0x8c36('0xc'),'port':0x18eb});var socket=require(_0x8c36('0xd'))(new Redis(config[_0x8c36('0xb')]));require(_0x8c36('0xe'))['register'](socket);function respondWithRpcPromise(_0x5bfbdd,_0x49f227,_0x116d25){return new BPromise(function(_0x28854e,_0x5132f6){return client[_0x8c36('0xf')](_0x5bfbdd,_0x116d25)[_0x8c36('0x10')](function(_0x1d5c61){logger[_0x8c36('0x11')](_0x8c36('0x12'),_0x49f227,_0x8c36('0x13'));logger[_0x8c36('0x14')](_0x8c36('0x15'),_0x49f227,_0x8c36('0x13'),JSON[_0x8c36('0x16')](_0x1d5c61));if(_0x1d5c61[_0x8c36('0x17')]){if(_0x1d5c61[_0x8c36('0x17')][_0x8c36('0x18')]===0x1f4){logger[_0x8c36('0x17')]('MailInteraction,\x20%s,\x20%s',_0x49f227,_0x1d5c61[_0x8c36('0x17')]['message']);return _0x5132f6(_0x1d5c61[_0x8c36('0x17')][_0x8c36('0x19')]);}logger[_0x8c36('0x17')](_0x8c36('0x12'),_0x49f227,_0x1d5c61[_0x8c36('0x17')][_0x8c36('0x19')]);return _0x28854e(_0x1d5c61[_0x8c36('0x17')][_0x8c36('0x19')]);}else{logger[_0x8c36('0x11')]('MailInteraction,\x20%s,\x20%s',_0x49f227,_0x8c36('0x13'));_0x28854e(_0x1d5c61[_0x8c36('0x1a')][_0x8c36('0x19')]);}})[_0x8c36('0x1b')](function(_0x3ef5ba){logger['error'](_0x8c36('0x12'),_0x49f227,_0x3ef5ba);_0x5132f6(_0x3ef5ba);});});}exports[_0x8c36('0x1c')]=function(_0x2ac843){var _0x137d5c=this;return new Promise(function(_0xc30310,_0x2b07ad){return db[_0x8c36('0x1d')][_0x8c36('0x1e')](_0x2ac843[_0x8c36('0x1f')],{'raw':_0x2ac843[_0x8c36('0x20')]?_0x2ac843[_0x8c36('0x20')][_0x8c36('0x21')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2ac843[_0x8c36('0x20')]?_0x2ac843['options']['where']||null:null,'attributes':_0x2ac843['options']?_0x2ac843['options'][_0x8c36('0x22')]||null:null,'limit':_0x2ac843[_0x8c36('0x20')]?_0x2ac843[_0x8c36('0x20')][_0x8c36('0x23')]||null:null})[_0x8c36('0x10')](function(_0x27c0df){logger['info'](_0x8c36('0x1c'),_0x2ac843);logger['debug'](_0x8c36('0x1c'),_0x2ac843,JSON['stringify'](_0x27c0df));_0xc30310(_0x27c0df);})[_0x8c36('0x1b')](function(_0x1afee4){logger[_0x8c36('0x17')](_0x8c36('0x1c'),_0x1afee4['message'],_0x2ac843);_0x2b07ad(_0x137d5c['error'](0x1f4,_0x1afee4[_0x8c36('0x19')]));});});};exports[_0x8c36('0x24')]=function(_0x5ad933){return new Promise(function(_0x4fc3ba,_0x418663){return db[_0x8c36('0x1d')]['find']({'where':_0x5ad933[_0x8c36('0x20')]?_0x5ad933[_0x8c36('0x20')][_0x8c36('0x25')]||null:null})['then'](function(_0x49b737){if(_0x49b737){return _0x49b737[_0x8c36('0x26')](_0x5ad933[_0x8c36('0x1f')][_0x8c36('0x27')],_[_0x8c36('0x28')](_0x5ad933[_0x8c36('0x1f')],[_0x8c36('0x27'),'id'])||{});}})[_0x8c36('0x29')](function(_0x1a828f){logger[_0x8c36('0x11')](_0x8c36('0x2a'),_0x5ad933);logger[_0x8c36('0x14')](_0x8c36('0x2a'),_0x5ad933,JSON[_0x8c36('0x16')](_0x1a828f));_0x4fc3ba(_0x1a828f);})[_0x8c36('0x1b')](function(_0x103d26){logger[_0x8c36('0x17')](_0x8c36('0x2a'),_0x103d26['message'],_0x5ad933);_0x418663(_this['error'](0x1f4,_0x103d26['message']));});});}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.socket.js b/server/api/mailInteraction/mailInteraction.socket.js index f3cab68..ede3cae 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 _0x2017=['mailInteraction:','save','remove','update','length'];(function(_0x5b644e,_0x2e5e07){var _0x49c6bf=function(_0x3032d9){while(--_0x3032d9){_0x5b644e['push'](_0x5b644e['shift']());}};_0x49c6bf(++_0x2e5e07);}(_0x2017,0xce));var _0x7201=function(_0x1ba43c,_0x5bd2e8){_0x1ba43c=_0x1ba43c-0x0;var _0x2f60eb=_0x2017[_0x1ba43c];return _0x2f60eb;};'use strict';var MailInteractionEvents=require('./mailInteraction.events');var events=[_0x7201('0x0'),_0x7201('0x1'),_0x7201('0x2')];function createListener(_0x1c1588,_0xe93715){return function(_0x33c6c7){_0xe93715['emit'](_0x1c1588,_0x33c6c7);};}function removeListener(_0x40d398,_0x2780ad){return function(){MailInteractionEvents['removeListener'](_0x40d398,_0x2780ad);};}exports['register']=function(_0x2b32ea){for(var _0x4bb14b=0x0,_0x23e37e=events[_0x7201('0x3')];_0x4bb14b<_0x23e37e;_0x4bb14b++){var _0x107c45=events[_0x4bb14b];var _0x40f0c4=createListener(_0x7201('0x4')+_0x107c45,_0x2b32ea);MailInteractionEvents['on'](_0x107c45,_0x40f0c4);}}; \ No newline at end of file +var _0xca9a=['mailInteraction:','./mailInteraction.events','save','remove','emit','removeListener'];(function(_0x4d8dc3,_0x585fd1){var _0x9b03d9=function(_0x7a31d5){while(--_0x7a31d5){_0x4d8dc3['push'](_0x4d8dc3['shift']());}};_0x9b03d9(++_0x585fd1);}(_0xca9a,0xaf));var _0xaca9=function(_0x3af00a,_0x297156){_0x3af00a=_0x3af00a-0x0;var _0x46b573=_0xca9a[_0x3af00a];return _0x46b573;};'use strict';var MailInteractionEvents=require(_0xaca9('0x0'));var events=[_0xaca9('0x1'),_0xaca9('0x2'),'update'];function createListener(_0x3a5dd1,_0x53f2c2){return function(_0x5d1fbe){_0x53f2c2[_0xaca9('0x3')](_0x3a5dd1,_0x5d1fbe);};}function removeListener(_0x113b28,_0x15c86d){return function(){MailInteractionEvents[_0xaca9('0x4')](_0x113b28,_0x15c86d);};}exports['register']=function(_0x3ae8a4){for(var _0x3a35d4=0x0,_0x3f1d89=events['length'];_0x3a35d4<_0x3f1d89;_0x3a35d4++){var _0x548ffa=events[_0x3a35d4];var _0x3688aa=createListener(_0xaca9('0x5')+_0x548ffa,_0x3ae8a4);MailInteractionEvents['on'](_0x548ffa,_0x3688aa);}}; \ No newline at end of file diff --git a/server/api/mailMessage/index.js b/server/api/mailMessage/index.js index e88261d..680a4e2 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 _0x425d=['show','/:id/download','download','post','tracked','mail','mailmessage:create','create','put','update','/:id/accept','accept','/:id/reject','reject','delete','destroy','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','/:id'];(function(_0x2499c8,_0x947ef3){var _0x29f0be=function(_0x38093f){while(--_0x38093f){_0x2499c8['push'](_0x2499c8['shift']());}};_0x29f0be(++_0x947ef3);}(_0x425d,0x1e0));var _0xd425=function(_0x39fdad,_0x1b8980){_0x39fdad=_0x39fdad-0x0;var _0x2089a1=_0x425d[_0x39fdad];return _0x2089a1;};'use strict';var multer=require(_0xd425('0x0'));var util=require('util');var path=require(_0xd425('0x1'));var timeout=require(_0xd425('0x2'));var express=require(_0xd425('0x3'));var router=express[_0xd425('0x4')]();var auth=require(_0xd425('0x5'));var interaction=require(_0xd425('0x6'));var config=require(_0xd425('0x7'));var controller=require('./mailMessage.controller');router[_0xd425('0x8')]('/',auth[_0xd425('0x9')](),controller[_0xd425('0xa')]);router[_0xd425('0x8')](_0xd425('0xb'),auth[_0xd425('0x9')](),controller['describe']);router[_0xd425('0x8')](_0xd425('0xc'),auth[_0xd425('0x9')](),controller[_0xd425('0xd')]);router[_0xd425('0x8')](_0xd425('0xe'),auth[_0xd425('0x9')](),controller[_0xd425('0xf')]);router[_0xd425('0x10')]('/',auth[_0xd425('0x9')](),interaction[_0xd425('0x11')](_0xd425('0x12'),_0xd425('0x13')),controller[_0xd425('0x14')]);router[_0xd425('0x15')](_0xd425('0xc'),auth[_0xd425('0x9')](),controller[_0xd425('0x16')]);router[_0xd425('0x15')](_0xd425('0x17'),auth['isAuthenticated'](),controller[_0xd425('0x18')]);router[_0xd425('0x15')](_0xd425('0x19'),auth['isAuthenticated'](),controller[_0xd425('0x1a')]);router[_0xd425('0x1b')](_0xd425('0xc'),auth[_0xd425('0x9')](),controller[_0xd425('0x1c')]);module['exports']=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(_0x471ff8,_0x5c7fa1){var _0x42bdb5=function(_0x52f28d){while(--_0x52f28d){_0x471ff8['push'](_0x471ff8['shift']());}};_0x42bdb5(++_0x5c7fa1);}(_0x008c,0x188));var _0xc008=function(_0x45c1b7,_0x136e78){_0x45c1b7=_0x45c1b7-0x0;var _0x2ae433=_0x008c[_0x45c1b7];return _0x2ae433;};'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 be9e95d..2957d1d 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 _0xd3c8=['DATE','sequelize','lodash','exports','TEXT','long','medium','BOOLEAN','ENUM','out','STRING'];(function(_0x68f237,_0x208dc1){var _0x390e2e=function(_0x50685b){while(--_0x50685b){_0x68f237['push'](_0x68f237['shift']());}};_0x390e2e(++_0x208dc1);}(_0xd3c8,0x161));var _0x8d3c=function(_0x4ad459,_0x2d602b){_0x4ad459=_0x4ad459-0x0;var _0x5ab5b7=_0xd3c8[_0x4ad459];return _0x5ab5b7;};'use strict';var Sequelize=require(_0x8d3c('0x0'));var _=require(_0x8d3c('0x1'));module[_0x8d3c('0x2')]={'body':{'type':Sequelize[_0x8d3c('0x3')](_0x8d3c('0x4')),'allowNull':![]},'plainBody':{'type':Sequelize['TEXT'](_0x8d3c('0x5'))},'read':{'type':Sequelize[_0x8d3c('0x6')],'defaultValue':![]},'direction':{'type':Sequelize[_0x8d3c('0x7')]('in',_0x8d3c('0x8')),'defaultValue':'out','allowNull':![]},'messageId':{'type':Sequelize[_0x8d3c('0x9')](0x1fe)},'from':{'type':Sequelize[_0x8d3c('0x9')]},'to':{'type':Sequelize[_0x8d3c('0x3')](_0x8d3c('0x4'))},'cc':{'type':Sequelize[_0x8d3c('0x3')](_0x8d3c('0x4'))},'bcc':{'type':Sequelize[_0x8d3c('0x3')](_0x8d3c('0x4'))},'subject':{'type':Sequelize[_0x8d3c('0x3')]},'sentAt':{'type':Sequelize[_0x8d3c('0xa')]},'attach':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'readAt':{'type':Sequelize['DATE']},'originTo':{'type':Sequelize[_0x8d3c('0x3')](_0x8d3c('0x4'))},'originCc':{'type':Sequelize[_0x8d3c('0x3')](_0x8d3c('0x4'))}}; \ No newline at end of file +var _0xd052=['INTEGER','exports','long','BOOLEAN','out','STRING','TEXT','DATE'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0xd052,0x69));var _0x2d05=function(_0x116895,_0xf2457e){_0x116895=_0x116895-0x0;var _0x51b0d9=_0xd052[_0x116895];return _0x51b0d9;};'use strict';var Sequelize=require('sequelize');var _=require('lodash');module[_0x2d05('0x0')]={'body':{'type':Sequelize['TEXT'](_0x2d05('0x1')),'allowNull':![]},'plainBody':{'type':Sequelize['TEXT']('medium')},'read':{'type':Sequelize[_0x2d05('0x2')],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in',_0x2d05('0x3')),'defaultValue':_0x2d05('0x3'),'allowNull':![]},'messageId':{'type':Sequelize['STRING'](0x1fe)},'from':{'type':Sequelize[_0x2d05('0x4')]},'to':{'type':Sequelize[_0x2d05('0x5')](_0x2d05('0x1'))},'cc':{'type':Sequelize[_0x2d05('0x5')](_0x2d05('0x1'))},'bcc':{'type':Sequelize[_0x2d05('0x5')](_0x2d05('0x1'))},'subject':{'type':Sequelize[_0x2d05('0x5')]},'sentAt':{'type':Sequelize[_0x2d05('0x6')]},'attach':{'type':Sequelize[_0x2d05('0x7')],'defaultValue':0x0},'secret':{'type':Sequelize[_0x2d05('0x2')],'defaultValue':![]},'readAt':{'type':Sequelize['DATE']},'originTo':{'type':Sequelize['TEXT']('long')},'originCc':{'type':Sequelize[_0x2d05('0x5')](_0x2d05('0x1'))}}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.controller.js b/server/api/mailMessage/mailMessage.controller.js index 2fcf2e2..9450b5d 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 _0x92bc=['index','MailMessage','rawAttributes','type','key','model','map','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','include','show','params','find','body','describe','direction','secret','split','MailAccount','CmList','Contacts','MailServerOut','Smtp','isNil','service','host','port','secure','auth','user','pass','attachments','join','root','basename','List','CmContact','create','List\x20not\x20found','SendMail','format','YYYY-MM-DD\x20HH:mm:ss','mail-interactions','accept','mail','read','UserId','Contact','get','MailInteraction','MailInteractionId','read1stAt','interaction','[MAILMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','AcceptMessage','acceptMessage','interface','SIP/%s','channel','event','EventManager','acceptmessage','reject','agent','[MAILMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','rejectmessage','server','files','from','bcc','subject','createdAt','headers','Bcc','Attachments','push','readFileSync','writeFileSync','download','log','err','unlinkSync','html-pdf','eml-format','rimraf','request-promise','moment','bluebird','mustache','path','sox','to-csv','squel','crypto','desk.js','querystring','ioredis','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./mailMessage.socket','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','info','request\x20sent','debug','MailMessage,\x20%s,\x20%s,\x20%s','stringify','error','MailMessage,\x20%s,\x20%s','message','result','catch','sendStatus','end','status','json','count','offset','limit','set','save','update','then','destroy','stack','name'];(function(_0x15906f,_0x4a16f0){var _0x2bdfd8=function(_0x5d533a){while(--_0x5d533a){_0x15906f['push'](_0x15906f['shift']());}};_0x2bdfd8(++_0x4a16f0);}(_0x92bc,0x106));var _0xc92b=function(_0x3ed6ed,_0x5f2c5d){_0x3ed6ed=_0x3ed6ed-0x0;var _0x17d676=_0x92bc[_0x3ed6ed];return _0x17d676;};'use strict';var pdf=require(_0xc92b('0x0'));var emlformat=require(_0xc92b('0x1'));var rimraf=require(_0xc92b('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xc92b('0x3'));var moment=require(_0xc92b('0x4'));var BPromise=require(_0xc92b('0x5'));var Mustache=require(_0xc92b('0x6'));var util=require('util');var path=require(_0xc92b('0x7'));var sox=require(_0xc92b('0x8'));var csv=require(_0xc92b('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0xc92b('0xa'));var crypto=require(_0xc92b('0xb'));var jsforce=require('jsforce');var deskjs=require(_0xc92b('0xc'));var toCsv=require(_0xc92b('0x9'));var querystring=require(_0xc92b('0xd'));var Papa=require('papaparse');var Redis=require(_0xc92b('0xe'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xc92b('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xc92b('0x10'))(_0xc92b('0x11'));var utils=require(_0xc92b('0x12'));var config=require(_0xc92b('0x13'));var db=require(_0xc92b('0x14'))['db'];config[_0xc92b('0x15')]=_[_0xc92b('0x16')](config[_0xc92b('0x15')],{'host':_0xc92b('0x17'),'port':0x18eb});var socket=require(_0xc92b('0x18'))(new Redis(config[_0xc92b('0x15')]));require(_0xc92b('0x19'))[_0xc92b('0x1a')](socket);var jayson=require(_0xc92b('0x1b'));var client=jayson['client'][_0xc92b('0x1c')]({'port':0x232c});var client9003=jayson[_0xc92b('0x1d')]['http']({'port':0x232b});var client9002=jayson[_0xc92b('0x1d')][_0xc92b('0x1c')]({'port':0x232a});function checkPasswordPattern(_0x42c85e,_0x18cd4e,_0x2a1e41){if(_0x2a1e41){var _0x38bb69=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x38bb69[_0xc92b('0x1e')](_0x18cd4e)){return _0x42c85e;}else{throw new db['Sequelize'][(_0xc92b('0x1f'))](_0xc92b('0x20'));}}else{return _0x42c85e;}}function respondWithRpcPromise(_0x343042,_0x28b301,_0x74a832,_0x4593c1){return new BPromise(function(_0x56563a,_0x1e6afa){var _0x366a11=_0x4593c1||client;return _0x366a11[_0xc92b('0x21')](_0x343042,_0x74a832)['then'](function(_0x8b280){logger[_0xc92b('0x22')]('MailMessage,\x20%s,\x20%s',_0x28b301,_0xc92b('0x23'));logger[_0xc92b('0x24')](_0xc92b('0x25'),_0x28b301,'request\x20sent',JSON[_0xc92b('0x26')](_0x8b280));if(_0x8b280['error']){if(_0x8b280[_0xc92b('0x27')]['code']===0x1f4){logger[_0xc92b('0x27')](_0xc92b('0x28'),_0x28b301,_0x8b280[_0xc92b('0x27')][_0xc92b('0x29')]);return _0x1e6afa(_0x8b280[_0xc92b('0x27')]['message']);}logger[_0xc92b('0x27')](_0xc92b('0x28'),_0x28b301,_0x8b280[_0xc92b('0x27')][_0xc92b('0x29')]);return _0x56563a(_0x8b280['error'][_0xc92b('0x29')]);}else{logger['info']('MailMessage,\x20%s,\x20%s',_0x28b301,_0xc92b('0x23'));_0x56563a(_0x8b280[_0xc92b('0x2a')]['message']);}})[_0xc92b('0x2b')](function(_0x2bade9){logger['error'](_0xc92b('0x28'),_0x28b301,_0x2bade9);_0x1e6afa(_0x2bade9);});});}function respondWithStatusCode(_0x292af2,_0x57f972){_0x57f972=_0x57f972||0xcc;return function(_0x473eb6){if(_0x473eb6){return _0x292af2[_0xc92b('0x2c')](_0x57f972);}return _0x292af2['status'](_0x57f972)[_0xc92b('0x2d')]();};}function respondWithResult(_0x400196,_0x8db11e){_0x8db11e=_0x8db11e||0xc8;return function(_0x5f4443){if(_0x5f4443){return _0x400196[_0xc92b('0x2e')](_0x8db11e)[_0xc92b('0x2f')](_0x5f4443);}};}function respondWithFilteredResult(_0x1a5b98,_0x24088b){return function(_0x1a32d3){if(_0x1a32d3){var _0x13e55b=_0x1a32d3[_0xc92b('0x30')],_0x1ae1a4=_0x24088b['offset'],_0x592b0c=_0x24088b[_0xc92b('0x31')]+_0x24088b[_0xc92b('0x32')],_0x202559;if(_0x592b0c>=_0x13e55b){_0x592b0c=_0x13e55b;_0x202559=0xc8;}else{_0x202559=0xce;}_0x1a5b98[_0xc92b('0x2e')](_0x202559);return _0x1a5b98[_0xc92b('0x33')]('Content-Range',_0x1ae1a4+'-'+_0x592b0c+'/'+_0x13e55b)[_0xc92b('0x2f')](_0x1a32d3);}return null;};}function patchUpdates(_0x30c307){return function(_0xe875e7){try{jsonpatch['apply'](_0xe875e7,_0x30c307,!![]);}catch(_0x369b10){return BPromise['reject'](_0x369b10);}return _0xe875e7[_0xc92b('0x34')]();};}function saveUpdates(_0x260db8,_0x4e2f90){return function(_0x2be03a){if(_0x2be03a){return _0x2be03a[_0xc92b('0x35')](_0x260db8)[_0xc92b('0x36')](function(_0x1c9bfd){return _0x1c9bfd;});}return null;};}function removeEntity(_0xae6508,_0x608d5a){return function(_0x3acaf0){if(_0x3acaf0){return _0x3acaf0[_0xc92b('0x37')]()[_0xc92b('0x36')](function(){_0xae6508[_0xc92b('0x2e')](0xcc)[_0xc92b('0x2d')]();});}};}function handleEntityNotFound(_0x1d7e7b,_0x59df47){return function(_0x1a362a){if(!_0x1a362a){_0x1d7e7b[_0xc92b('0x2c')](0x194);}return _0x1a362a;};}function handleError(_0x2fa006,_0x5db58f){_0x5db58f=_0x5db58f||0x1f4;return function(_0x353867){logger[_0xc92b('0x27')](_0x353867[_0xc92b('0x38')]);if(_0x353867[_0xc92b('0x39')]){delete _0x353867[_0xc92b('0x39')];}_0x2fa006[_0xc92b('0x2e')](_0x5db58f)['send'](_0x353867);};}exports[_0xc92b('0x3a')]=function(_0x25bfe5,_0x21133f){var _0x170dd5={},_0x346a3f={},_0x1b11bf={'count':0x0,'rows':[]};var _0x238a7b=_['map'](db[_0xc92b('0x3b')][_0xc92b('0x3c')],function(_0x4f4c84){return{'name':_0x4f4c84['fieldName'],'type':_0x4f4c84[_0xc92b('0x3d')][_0xc92b('0x3e')]};});_0x346a3f[_0xc92b('0x3f')]=_[_0xc92b('0x40')](_0x238a7b,_0xc92b('0x39'));_0x346a3f['query']=_[_0xc92b('0x41')](_0x25bfe5[_0xc92b('0x42')]);_0x346a3f[_0xc92b('0x43')]=_[_0xc92b('0x44')](_0x346a3f['model'],_0x346a3f[_0xc92b('0x42')]);_0x170dd5['attributes']=_[_0xc92b('0x44')](_0x346a3f[_0xc92b('0x3f')],qs['fields'](_0x25bfe5[_0xc92b('0x42')][_0xc92b('0x45')]));_0x170dd5[_0xc92b('0x46')]=_0x170dd5[_0xc92b('0x46')][_0xc92b('0x47')]?_0x170dd5[_0xc92b('0x46')]:_0x346a3f[_0xc92b('0x3f')];if(!_0x25bfe5['query'][_0xc92b('0x48')](_0xc92b('0x49'))){_0x170dd5[_0xc92b('0x32')]=qs[_0xc92b('0x32')](_0x25bfe5[_0xc92b('0x42')][_0xc92b('0x32')]);_0x170dd5[_0xc92b('0x31')]=qs[_0xc92b('0x31')](_0x25bfe5['query'][_0xc92b('0x31')]);}_0x170dd5[_0xc92b('0x4a')]=qs[_0xc92b('0x4b')](_0x25bfe5['query'][_0xc92b('0x4b')]);_0x170dd5[_0xc92b('0x4c')]=qs[_0xc92b('0x43')](_[_0xc92b('0x4d')](_0x25bfe5[_0xc92b('0x42')],_0x346a3f[_0xc92b('0x43')]),_0x238a7b);if(_0x25bfe5[_0xc92b('0x42')]['filter']){_0x170dd5[_0xc92b('0x4c')]=_[_0xc92b('0x4e')](_0x170dd5['where'],{'$or':_[_0xc92b('0x40')](_0x238a7b,function(_0x1c9529){if(_0x1c9529['type']!==_0xc92b('0x4f')){var _0x12073b={};_0x12073b[_0x1c9529[_0xc92b('0x39')]]={'$like':'%'+_0x25bfe5[_0xc92b('0x42')][_0xc92b('0x50')]+'%'};return _0x12073b;}})});}_0x170dd5=_[_0xc92b('0x4e')]({},_0x170dd5,_0x25bfe5[_0xc92b('0x51')]);var _0x204c04={'where':_0x170dd5[_0xc92b('0x4c')]};return db[_0xc92b('0x3b')][_0xc92b('0x30')](_0x204c04)[_0xc92b('0x36')](function(_0x132d2e){_0x1b11bf[_0xc92b('0x30')]=_0x132d2e;if(_0x25bfe5[_0xc92b('0x42')][_0xc92b('0x52')]){_0x170dd5[_0xc92b('0x53')]=[{'all':!![]}];}return db['MailMessage']['findAll'](_0x170dd5);})[_0xc92b('0x36')](function(_0x8390db){_0x1b11bf['rows']=_0x8390db;return _0x1b11bf;})['then'](respondWithFilteredResult(_0x21133f,_0x170dd5))[_0xc92b('0x2b')](handleError(_0x21133f,null));};exports[_0xc92b('0x54')]=function(_0x5722fa,_0x30ec8c){var _0x2aadfa={'raw':!![],'where':{'id':_0x5722fa[_0xc92b('0x55')]['id']}},_0x1c4fc8={};_0x1c4fc8[_0xc92b('0x3f')]=_['keys'](db[_0xc92b('0x3b')][_0xc92b('0x3c')]);_0x1c4fc8[_0xc92b('0x42')]=_['keys'](_0x5722fa['query']);_0x1c4fc8[_0xc92b('0x43')]=_[_0xc92b('0x44')](_0x1c4fc8[_0xc92b('0x3f')],_0x1c4fc8[_0xc92b('0x42')]);_0x2aadfa[_0xc92b('0x46')]=_[_0xc92b('0x44')](_0x1c4fc8[_0xc92b('0x3f')],qs[_0xc92b('0x45')](_0x5722fa[_0xc92b('0x42')][_0xc92b('0x45')]));_0x2aadfa[_0xc92b('0x46')]=_0x2aadfa[_0xc92b('0x46')][_0xc92b('0x47')]?_0x2aadfa['attributes']:_0x1c4fc8[_0xc92b('0x3f')];if(_0x5722fa[_0xc92b('0x42')][_0xc92b('0x52')]){_0x2aadfa[_0xc92b('0x53')]=[{'all':!![]}];}_0x2aadfa=_['merge']({},_0x2aadfa,_0x5722fa[_0xc92b('0x51')]);return db[_0xc92b('0x3b')][_0xc92b('0x56')](_0x2aadfa)[_0xc92b('0x36')](handleEntityNotFound(_0x30ec8c,null))[_0xc92b('0x36')](respondWithResult(_0x30ec8c,null))[_0xc92b('0x2b')](handleError(_0x30ec8c,null));};exports[_0xc92b('0x35')]=function(_0x2a1f22,_0x2768f1){if(_0x2a1f22[_0xc92b('0x57')]['id']){delete _0x2a1f22[_0xc92b('0x57')]['id'];}return db[_0xc92b('0x3b')][_0xc92b('0x56')]({'where':{'id':_0x2a1f22[_0xc92b('0x55')]['id']}})['then'](handleEntityNotFound(_0x2768f1,null))[_0xc92b('0x36')](saveUpdates(_0x2a1f22[_0xc92b('0x57')],null))[_0xc92b('0x36')](respondWithResult(_0x2768f1,null))[_0xc92b('0x2b')](handleError(_0x2768f1,null));};exports['destroy']=function(_0x5cf662,_0x112aeb){return db['MailMessage'][_0xc92b('0x56')]({'where':{'id':_0x5cf662[_0xc92b('0x55')]['id']}})[_0xc92b('0x36')](handleEntityNotFound(_0x112aeb,null))[_0xc92b('0x36')](removeEntity(_0x112aeb,null))[_0xc92b('0x2b')](handleError(_0x112aeb,null));};exports[_0xc92b('0x58')]=function(_0x14342c,_0x2b9151){return db[_0xc92b('0x3b')][_0xc92b('0x58')]()[_0xc92b('0x36')](respondWithResult(_0x2b9151,null))[_0xc92b('0x2b')](handleError(_0x2b9151,null));};exports['create']=function(_0x3c6f94,_0x3bb9b6){return db[_0xc92b('0x3b')]['create'](_0x3c6f94[_0xc92b('0x57')])[_0xc92b('0x36')](function(_0x174214){if(_0x174214){if(_0x174214[_0xc92b('0x59')]==='out'&&!_0x174214[_0xc92b('0x5a')]){var _0xb7f0b3,_0x3985e8,_0x2c18a6;if(_0x3c6f94[_0xc92b('0x57')]['to']){_0x3985e8=_0x3c6f94[_0xc92b('0x57')]['to'][_0xc92b('0x5b')](',')[0x0];}return db[_0xc92b('0x5c')]['findOne']({'where':{'id':_0x174214['MailAccountId']},'include':[{'model':db[_0xc92b('0x5d')],'as':'List','include':[{'model':db['CmContact'],'as':_0xc92b('0x5e'),'where':{'email':_0x3985e8},'limit':0x1,'order':[['updatedAt','DESC']]}]},{'model':db[_0xc92b('0x5f')],'as':_0xc92b('0x60'),'raw':!![]}]})[_0xc92b('0x36')](function(_0x2cc7ed){_0xb7f0b3=_0x2cc7ed;if(_0xb7f0b3&&_0xb7f0b3['Smtp']){var _0x404cee={'tls':{'rejectUnauthorized':![]}};if(_[_0xc92b('0x61')](_0xb7f0b3['Smtp'][_0xc92b('0x62')])){_0x404cee[_0xc92b('0x63')]=_0xb7f0b3[_0xc92b('0x60')][_0xc92b('0x63')];_0x404cee[_0xc92b('0x64')]=_0xb7f0b3['Smtp'][_0xc92b('0x64')];_0x404cee[_0xc92b('0x65')]=_0xb7f0b3[_0xc92b('0x60')][_0xc92b('0x65')];if(_0xb7f0b3[_0xc92b('0x60')]['authentication']){_0x404cee[_0xc92b('0x66')]={'user':_0xb7f0b3['Smtp']['user'],'pass':_0xb7f0b3['Smtp']['pass']};}}else{_0x404cee[_0xc92b('0x62')]=_0xb7f0b3[_0xc92b('0x60')][_0xc92b('0x62')];_0x404cee['auth']={'user':_0xb7f0b3[_0xc92b('0x60')][_0xc92b('0x67')],'pass':_0xb7f0b3[_0xc92b('0x60')][_0xc92b('0x68')]};_0x404cee[_0xc92b('0x65')]=_0xb7f0b3['Smtp']['secure'];}if(_0x3c6f94[_0xc92b('0x57')][_0xc92b('0x69')]&&_0x3c6f94[_0xc92b('0x57')][_0xc92b('0x69')]['length']){for(var _0x2a5adb=0x0;_0x2a5adb<_0x3c6f94[_0xc92b('0x57')][_0xc92b('0x69')][_0xc92b('0x47')];_0x2a5adb+=0x1){_0x3c6f94[_0xc92b('0x57')][_0xc92b('0x69')][_0x2a5adb]={'filename':_0x3c6f94['body'][_0xc92b('0x69')][_0x2a5adb][_0xc92b('0x39')],'path':path[_0xc92b('0x6a')](config[_0xc92b('0x6b')],'server/files/attachments',_0x3c6f94[_0xc92b('0x57')][_0xc92b('0x69')][_0x2a5adb][_0xc92b('0x6c')])};}}_0x2c18a6={'account':_0x404cee,'message':_0x3c6f94[_0xc92b('0x57')]};return;}})[_0xc92b('0x36')](function(){if(_0xb7f0b3['List']){if(_0xb7f0b3['List'][_0xc92b('0x5e')][_0xc92b('0x47')]){return _0xb7f0b3[_0xc92b('0x6d')][_0xc92b('0x5e')][0x0];}else{return db[_0xc92b('0x6e')][_0xc92b('0x6f')](_[_0xc92b('0x16')](_0x3c6f94['body'],{'firstName':_0x3c6f94[_0xc92b('0x57')]['to'],'email':_0x3c6f94[_0xc92b('0x57')]['to'],'phone':_0x3c6f94['body']['to'],'ListId':_0xb7f0b3['ListId']}));}}else{throw new Error(_0xc92b('0x70'));}})[_0xc92b('0x36')](function(){if(_0x2c18a6){return respondWithRpcPromise(_0xc92b('0x71'),'sendMail',_0x2c18a6,client9003)[_0xc92b('0x36')](function(_0x493d3c){return _0x174214[_0xc92b('0x35')]({'read':!![],'messageId':_0x493d3c['messageId'],'sentAt':moment()[_0xc92b('0x72')](_0xc92b('0x73'))});})[_0xc92b('0x2b')](function(_0x586dad){logger[_0xc92b('0x27')]('%s',JSON[_0xc92b('0x26')](_0x586dad));return _0x174214;});}return _0x174214;});}return _0x174214;}})[_0xc92b('0x36')](respondWithResult(_0x3bb9b6,0xc9))[_0xc92b('0x2b')](handleError(_0x3bb9b6,null));};var interaction_log=require('../../config/logger')(_0xc92b('0x74'));exports[_0xc92b('0x75')]=function(_0x4764d4,_0xc27e4d,_0x3b57c6){var _0x4829cf={'channel':_0xc92b('0x76')};if(_0x4764d4['body']['id']){delete _0x4764d4['body']['id'];}_0x4764d4[_0xc92b('0x57')][_0xc92b('0x77')]=!![];_0x4764d4['body']['readAt']=moment()[_0xc92b('0x72')]('YYYY-MM-DD\x20HH:mm:ss');_0x4764d4[_0xc92b('0x57')][_0xc92b('0x78')]=_0x4764d4[_0xc92b('0x57')][_0xc92b('0x78')]||_0x4764d4[_0xc92b('0x67')]['id'];return db['MailMessage'][_0xc92b('0x56')]({'where':{'id':_0x4764d4[_0xc92b('0x55')]['id'],'UserId':null},'include':[{'model':db[_0xc92b('0x6e')],'as':_0xc92b('0x79')}]})[_0xc92b('0x36')](handleEntityNotFound(_0xc27e4d,null))['then'](saveUpdates(_0x4764d4[_0xc92b('0x57')],null))[_0xc92b('0x36')](function(_0x173573){if(_0x173573){_0x4829cf[_0xc92b('0x29')]=_0x173573[_0xc92b('0x7a')]({'plain':!![]});return db[_0xc92b('0x7b')][_0xc92b('0x56')]({'where':{'id':_0x173573[_0xc92b('0x7c')]}});}return null;})['then'](handleEntityNotFound(_0xc27e4d,null))[_0xc92b('0x36')](function(_0x2cd610){if(_0x2cd610){return _0x2cd610[_0xc92b('0x35')]({'UserId':_0x4764d4['body'][_0xc92b('0x78')],'read1stAt':_[_0xc92b('0x61')](_0x2cd610[_0xc92b('0x7d')])?moment()['format'](_0xc92b('0x73')):undefined});}return null;})[_0xc92b('0x36')](function(_0x2f2a59){if(_0x2f2a59){_0x4829cf[_0xc92b('0x7e')]=_0x2f2a59[_0xc92b('0x7a')]({'plain':!![]});interaction_log[_0xc92b('0x22')](_0xc92b('0x7f'),_0x4764d4['user']['id'],_0x4764d4[_0xc92b('0x67')][_0xc92b('0x39')],_0x4764d4[_0xc92b('0x67')][_0xc92b('0x80')],_0x4829cf['interaction']['id'],_0x4764d4[_0xc92b('0x57')]?JSON['stringify'](_0x4764d4[_0xc92b('0x57')]):_0xc92b('0x81'));return respondWithRpcPromise(_0xc92b('0x82'),_0xc92b('0x83'),_0x4829cf);}return null;})[_0xc92b('0x36')](function(_0x2fdb1a){if(_0x2fdb1a){if(_0x4764d4['body']['manual']){_0x4829cf[_0xc92b('0x29')][_0xc92b('0x84')]=util[_0xc92b('0x72')](_0xc92b('0x85'),_0x4764d4[_0xc92b('0x67')][_0xc92b('0x39')]);_0x4829cf['message'][_0xc92b('0x86')]=_0x4829cf[_0xc92b('0x86')];_0x4829cf[_0xc92b('0x29')][_0xc92b('0x87')]=_0xc92b('0x75');return respondWithRpcPromise('EventManager',_0xc92b('0x88'),{'event':_0xc92b('0x89'),'message':_0x4829cf['message']},client9002)[_0xc92b('0x36')](function(){return _0x4829cf;});}return _0x4829cf;}return null;})[_0xc92b('0x36')](respondWithResult(_0xc27e4d,null))[_0xc92b('0x2b')](handleError(_0xc27e4d,null));};var interaction_log=require(_0xc92b('0x10'))(_0xc92b('0x74'));exports[_0xc92b('0x8a')]=function(_0x50708c,_0x521abe,_0x151c00){var _0x17adfb={'agent':{},'channel':_0xc92b('0x76')};if(_0x50708c['body']['id']){delete _0x50708c[_0xc92b('0x57')]['id'];}_0x50708c[_0xc92b('0x57')]['UserId']=_0x50708c[_0xc92b('0x57')][_0xc92b('0x78')]||_0x50708c['user']['id'];_0x17adfb[_0xc92b('0x8b')]['id']=_0x50708c[_0xc92b('0x57')]['UserId'];return db[_0xc92b('0x3b')][_0xc92b('0x56')]({'where':{'id':_0x50708c[_0xc92b('0x55')]['id'],'UserId':null}})[_0xc92b('0x36')](handleEntityNotFound(_0x521abe,null))[_0xc92b('0x36')](function(_0x5b7a58){if(_0x5b7a58){_0x17adfb[_0xc92b('0x29')]=_0x5b7a58[_0xc92b('0x7a')]({'plain':!![]});return db['MailInteraction'][_0xc92b('0x56')]({'where':{'id':_0x5b7a58[_0xc92b('0x7c')]}});}return null;})[_0xc92b('0x36')](handleEntityNotFound(_0x521abe,null))[_0xc92b('0x36')](function(_0x129238){if(_0x129238){_0x17adfb[_0xc92b('0x7e')]=_0x129238['get']({'plain':!![]});interaction_log[_0xc92b('0x22')](_0xc92b('0x8c'),_0x50708c['user']['id'],_0x50708c['user'][_0xc92b('0x39')],_0x50708c[_0xc92b('0x67')][_0xc92b('0x80')],_0x17adfb['interaction']['id'],_0x50708c[_0xc92b('0x57')]?JSON['stringify'](_0x50708c['body']):_0xc92b('0x81'));return respondWithRpcPromise(_0xc92b('0x8d'),_0xc92b('0x8e'),_0x17adfb);}return null;})['then'](function(_0x11d73e){if(_0x11d73e){_0x11d73e[_0xc92b('0x29')]['interface']=util[_0xc92b('0x72')](_0xc92b('0x85'),_0x50708c[_0xc92b('0x67')][_0xc92b('0x39')]);_0x11d73e[_0xc92b('0x29')][_0xc92b('0x86')]=_0x17adfb['channel'];_0x11d73e['message'][_0xc92b('0x87')]=_0xc92b('0x8a');respondWithRpcPromise('EventManager',_0xc92b('0x88'),{'event':_0xc92b('0x8f'),'message':_0x11d73e['message']},client9002);return _0x17adfb;}return null;})[_0xc92b('0x36')](respondWithResult(_0x521abe,null))['catch'](handleError(_0x521abe,null));};exports['download']=function(_0x348f3a,_0xa27d45){var _0x280b6b=moment()['unix']()['toString']();var _0x3debd9=path[_0xc92b('0x6a')](config[_0xc92b('0x6b')],_0xc92b('0x90'),'files','tmp');var _0x213373=path[_0xc92b('0x6a')](config[_0xc92b('0x6b')],_0xc92b('0x90'),_0xc92b('0x91'),_0xc92b('0x69'));var _0x3a7c62=util['format']('message-%s.eml',_0x280b6b);return db[_0xc92b('0x3b')][_0xc92b('0x56')]({'where':{'id':_0x348f3a['params']['id']},'attributes':['id','body',_0xc92b('0x92'),'to','cc',_0xc92b('0x93'),_0xc92b('0x94'),_0xc92b('0x95')],'include':_0x348f3a[_0xc92b('0x42')][_0xc92b('0x69')]?[{'model':db['Attachment'],'as':'Attachments'}]:undefined})['then'](handleEntityNotFound(_0xa27d45,null))[_0xc92b('0x36')](function(_0x329baf){if(_0x329baf){var _0x47316f=_0x329baf;var _0xa1636d={'from':_0x47316f[_0xc92b('0x92')],'to':_0x47316f['to'],'subject':_0x47316f['subject'],'html':_0x47316f[_0xc92b('0x57')],'headers':{'Date':moment(_0x47316f[_0xc92b('0x95')])[_0xc92b('0x72')]('ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ')},'attachments':[]};if(_0x329baf['cc']){_0xa1636d[_0xc92b('0x96')]['Cc']=_0x329baf['cc'];}if(_0x329baf[_0xc92b('0x93')]){_0xa1636d[_0xc92b('0x96')][_0xc92b('0x97')]=_0x329baf[_0xc92b('0x93')];}return new BPromise(function(_0x55a9b9,_0x2f32a3){if(_0x329baf[_0xc92b('0x98')]){for(var _0x36446a=0x0;_0x36446a<_0x329baf[_0xc92b('0x98')][_0xc92b('0x47')];_0x36446a++){var _0x3329fd=_0x329baf[_0xc92b('0x98')][_0x36446a];var _0x1a0eed=path[_0xc92b('0x6a')](_0x213373,_0x3329fd[_0xc92b('0x6c')]);if(fs['existsSync'](_0x1a0eed)){_0xa1636d[_0xc92b('0x69')][_0xc92b('0x99')]({'name':_0x3329fd[_0xc92b('0x39')],'contentType':_0x3329fd[_0xc92b('0x3d')],'data':fs[_0xc92b('0x9a')](_0x1a0eed)});}}}emlformat['build'](_0xa1636d,function(_0x244cda,_0x1f6179){if(_0x244cda)return _0x2f32a3(_0x244cda);fs[_0xc92b('0x9b')](path[_0xc92b('0x6a')](_0x3debd9,_0x3a7c62),_0x1f6179);return _0x55a9b9(_0x1f6179);});});}})[_0xc92b('0x36')](function(_0x58dd7f){if(_0x58dd7f){return _0xa27d45[_0xc92b('0x9c')](path[_0xc92b('0x6a')](_0x3debd9,_0x3a7c62),_0x3a7c62,function(_0x583308){if(_0x583308){console[_0xc92b('0x9d')](_0xc92b('0x9e'),_0x583308);}else{fs[_0xc92b('0x9f')](path[_0xc92b('0x6a')](_0x3debd9,_0x3a7c62));}});}})[_0xc92b('0x2b')](handleError(_0xa27d45,null));}; \ No newline at end of file +var _0xa992=['acceptmessage','agent','RejectMessage','rejectMessage','interface','channel','rejectmessage','unix','toString','root','files','tmp','server','bcc','Attachment','Attachments','from','subject','createdAt','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','headers','Bcc','basename','push','build','download','log','err','unlinkSync','html-pdf','fast-json-patch','request-promise','bluebird','util','sox','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','jayson/promise','client','http','test','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','MailMessage,\x20%s,\x20%s','request\x20sent','MailMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','sendStatus','status','json','count','offset','limit','Content-Range','apply','reject','save','update','destroy','end','name','send','index','map','MailMessage','rawAttributes','fieldName','type','key','model','query','intersection','fields','attributes','length','nolimit','sort','filters','pick','where','filter','merge','options','includeAll','include','findAll','rows','show','keys','body','find','params','create','direction','out','secret','split','MailAccountId','CmList','CmContact','Contacts','updatedAt','DESC','MailServerOut','Smtp','isNil','service','host','port','secure','authentication','auth','user','attachments','join','server/files/attachments','List','ListId','List\x20not\x20found','SendMail','sendMail','YYYY-MM-DD\x20HH:mm:ss','mail-interactions','accept','mail','readAt','format','UserId','Contact','get','MailInteractionId','read1stAt','interaction','role','acceptMessage','manual','SIP/%s','event','EventManager'];(function(_0x580576,_0x2f107d){var _0x3f55a0=function(_0x2e180b){while(--_0x2e180b){_0x580576['push'](_0x580576['shift']());}};_0x3f55a0(++_0x2f107d);}(_0xa992,0xc4));var _0x2a99=function(_0x181f84,_0xb7048d){_0x181f84=_0x181f84-0x0;var _0x5e45af=_0xa992[_0x181f84];return _0x5e45af;};'use strict';var pdf=require(_0x2a99('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x2a99('0x1'));var rp=require(_0x2a99('0x2'));var moment=require('moment');var BPromise=require(_0x2a99('0x3'));var Mustache=require('mustache');var util=require(_0x2a99('0x4'));var path=require('path');var sox=require(_0x2a99('0x5'));var csv=require('to-csv');var ejs=require(_0x2a99('0x6'));var fs=require('fs');var _=require(_0x2a99('0x7'));var squel=require(_0x2a99('0x8'));var crypto=require(_0x2a99('0x9'));var jsforce=require(_0x2a99('0xa'));var deskjs=require(_0x2a99('0xb'));var toCsv=require(_0x2a99('0xc'));var querystring=require(_0x2a99('0xd'));var Papa=require(_0x2a99('0xe'));var Redis=require(_0x2a99('0xf'));var authService=require(_0x2a99('0x10'));var qs=require(_0x2a99('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x2a99('0x12'));var logger=require(_0x2a99('0x13'))(_0x2a99('0x14'));var utils=require(_0x2a99('0x15'));var config=require(_0x2a99('0x16'));var db=require(_0x2a99('0x17'))['db'];config[_0x2a99('0x18')]=_['defaults'](config[_0x2a99('0x18')],{'host':_0x2a99('0x19'),'port':0x18eb});var socket=require(_0x2a99('0x1a'))(new Redis(config[_0x2a99('0x18')]));require('./mailMessage.socket')['register'](socket);var jayson=require(_0x2a99('0x1b'));var client=jayson[_0x2a99('0x1c')][_0x2a99('0x1d')]({'port':0x232c});var client9003=jayson[_0x2a99('0x1c')]['http']({'port':0x232b});var client9002=jayson['client'][_0x2a99('0x1d')]({'port':0x232a});function checkPasswordPattern(_0x5b3024,_0x3320af,_0x180f75){if(_0x180f75){var _0x22adf3=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x22adf3[_0x2a99('0x1e')](_0x3320af)){return _0x5b3024;}else{throw new db[(_0x2a99('0x1f'))][(_0x2a99('0x20'))](_0x2a99('0x21'));}}else{return _0x5b3024;}}function respondWithRpcPromise(_0x1630b4,_0xf88a7c,_0x3bbe1b,_0x3be6b6){return new BPromise(function(_0x4c793e,_0xa2c95b){var _0x49052c=_0x3be6b6||client;return _0x49052c[_0x2a99('0x22')](_0x1630b4,_0x3bbe1b)[_0x2a99('0x23')](function(_0x426821){logger['info'](_0x2a99('0x24'),_0xf88a7c,_0x2a99('0x25'));logger['debug'](_0x2a99('0x26'),_0xf88a7c,_0x2a99('0x25'),JSON[_0x2a99('0x27')](_0x426821));if(_0x426821['error']){if(_0x426821[_0x2a99('0x28')][_0x2a99('0x29')]===0x1f4){logger['error'](_0x2a99('0x24'),_0xf88a7c,_0x426821[_0x2a99('0x28')][_0x2a99('0x2a')]);return _0xa2c95b(_0x426821['error'][_0x2a99('0x2a')]);}logger[_0x2a99('0x28')](_0x2a99('0x24'),_0xf88a7c,_0x426821[_0x2a99('0x28')]['message']);return _0x4c793e(_0x426821[_0x2a99('0x28')][_0x2a99('0x2a')]);}else{logger[_0x2a99('0x2b')](_0x2a99('0x24'),_0xf88a7c,_0x2a99('0x25'));_0x4c793e(_0x426821[_0x2a99('0x2c')][_0x2a99('0x2a')]);}})[_0x2a99('0x2d')](function(_0x4b34c6){logger[_0x2a99('0x28')](_0x2a99('0x24'),_0xf88a7c,_0x4b34c6);_0xa2c95b(_0x4b34c6);});});}function respondWithStatusCode(_0x479e27,_0x4714d7){_0x4714d7=_0x4714d7||0xcc;return function(_0x2043c4){if(_0x2043c4){return _0x479e27[_0x2a99('0x2e')](_0x4714d7);}return _0x479e27['status'](_0x4714d7)['end']();};}function respondWithResult(_0x5d318f,_0x14f536){_0x14f536=_0x14f536||0xc8;return function(_0x307c53){if(_0x307c53){return _0x5d318f[_0x2a99('0x2f')](_0x14f536)[_0x2a99('0x30')](_0x307c53);}};}function respondWithFilteredResult(_0x3e8ad4,_0x834f3f){return function(_0x23cccd){if(_0x23cccd){var _0xff1ee9=_0x23cccd[_0x2a99('0x31')],_0xd0ddec=_0x834f3f[_0x2a99('0x32')],_0x3029ac=_0x834f3f[_0x2a99('0x32')]+_0x834f3f[_0x2a99('0x33')],_0x2ee9ca;if(_0x3029ac>=_0xff1ee9){_0x3029ac=_0xff1ee9;_0x2ee9ca=0xc8;}else{_0x2ee9ca=0xce;}_0x3e8ad4[_0x2a99('0x2f')](_0x2ee9ca);return _0x3e8ad4['set'](_0x2a99('0x34'),_0xd0ddec+'-'+_0x3029ac+'/'+_0xff1ee9)[_0x2a99('0x30')](_0x23cccd);}return null;};}function patchUpdates(_0x5a5115){return function(_0x3f0d6a){try{jsonpatch[_0x2a99('0x35')](_0x3f0d6a,_0x5a5115,!![]);}catch(_0x4f5bcd){return BPromise[_0x2a99('0x36')](_0x4f5bcd);}return _0x3f0d6a[_0x2a99('0x37')]();};}function saveUpdates(_0x2550ab,_0x4e3a27){return function(_0x4d47b8){if(_0x4d47b8){return _0x4d47b8[_0x2a99('0x38')](_0x2550ab)[_0x2a99('0x23')](function(_0x823054){return _0x823054;});}return null;};}function removeEntity(_0x4f2784,_0x116395){return function(_0x20a3a9){if(_0x20a3a9){return _0x20a3a9[_0x2a99('0x39')]()[_0x2a99('0x23')](function(){_0x4f2784['status'](0xcc)[_0x2a99('0x3a')]();});}};}function handleEntityNotFound(_0xaa9924,_0x3b47cd){return function(_0x2e46a4){if(!_0x2e46a4){_0xaa9924['sendStatus'](0x194);}return _0x2e46a4;};}function handleError(_0x1fce17,_0x15a202){_0x15a202=_0x15a202||0x1f4;return function(_0x341de5){logger[_0x2a99('0x28')](_0x341de5['stack']);if(_0x341de5[_0x2a99('0x3b')]){delete _0x341de5['name'];}_0x1fce17[_0x2a99('0x2f')](_0x15a202)[_0x2a99('0x3c')](_0x341de5);};}exports[_0x2a99('0x3d')]=function(_0x482f1a,_0x455928){var _0x451516={},_0x381725={},_0x2503de={'count':0x0,'rows':[]};var _0x304177=_[_0x2a99('0x3e')](db[_0x2a99('0x3f')][_0x2a99('0x40')],function(_0x217bf9){return{'name':_0x217bf9[_0x2a99('0x41')],'type':_0x217bf9[_0x2a99('0x42')][_0x2a99('0x43')]};});_0x381725[_0x2a99('0x44')]=_[_0x2a99('0x3e')](_0x304177,'name');_0x381725['query']=_['keys'](_0x482f1a[_0x2a99('0x45')]);_0x381725['filters']=_[_0x2a99('0x46')](_0x381725['model'],_0x381725[_0x2a99('0x45')]);_0x451516['attributes']=_['intersection'](_0x381725['model'],qs[_0x2a99('0x47')](_0x482f1a[_0x2a99('0x45')][_0x2a99('0x47')]));_0x451516[_0x2a99('0x48')]=_0x451516[_0x2a99('0x48')][_0x2a99('0x49')]?_0x451516['attributes']:_0x381725['model'];if(!_0x482f1a[_0x2a99('0x45')]['hasOwnProperty'](_0x2a99('0x4a'))){_0x451516['limit']=qs[_0x2a99('0x33')](_0x482f1a[_0x2a99('0x45')]['limit']);_0x451516[_0x2a99('0x32')]=qs[_0x2a99('0x32')](_0x482f1a[_0x2a99('0x45')][_0x2a99('0x32')]);}_0x451516['order']=qs[_0x2a99('0x4b')](_0x482f1a[_0x2a99('0x45')]['sort']);_0x451516['where']=qs[_0x2a99('0x4c')](_[_0x2a99('0x4d')](_0x482f1a['query'],_0x381725[_0x2a99('0x4c')]),_0x304177);if(_0x482f1a[_0x2a99('0x45')]['filter']){_0x451516[_0x2a99('0x4e')]=_['merge'](_0x451516[_0x2a99('0x4e')],{'$or':_['map'](_0x304177,function(_0x209fd2){if(_0x209fd2[_0x2a99('0x42')]!=='VIRTUAL'){var _0x313cf3={};_0x313cf3[_0x209fd2[_0x2a99('0x3b')]]={'$like':'%'+_0x482f1a[_0x2a99('0x45')][_0x2a99('0x4f')]+'%'};return _0x313cf3;}})});}_0x451516=_[_0x2a99('0x50')]({},_0x451516,_0x482f1a[_0x2a99('0x51')]);var _0x2eb5b0={'where':_0x451516['where']};return db[_0x2a99('0x3f')][_0x2a99('0x31')](_0x2eb5b0)[_0x2a99('0x23')](function(_0x273511){_0x2503de[_0x2a99('0x31')]=_0x273511;if(_0x482f1a[_0x2a99('0x45')][_0x2a99('0x52')]){_0x451516[_0x2a99('0x53')]=[{'all':!![]}];}return db[_0x2a99('0x3f')][_0x2a99('0x54')](_0x451516);})[_0x2a99('0x23')](function(_0x319f96){_0x2503de[_0x2a99('0x55')]=_0x319f96;return _0x2503de;})[_0x2a99('0x23')](respondWithFilteredResult(_0x455928,_0x451516))[_0x2a99('0x2d')](handleError(_0x455928,null));};exports[_0x2a99('0x56')]=function(_0x21a111,_0x21e71){var _0x198a58={'raw':!![],'where':{'id':_0x21a111['params']['id']}},_0xfe5737={};_0xfe5737[_0x2a99('0x44')]=_[_0x2a99('0x57')](db['MailMessage'][_0x2a99('0x40')]);_0xfe5737['query']=_[_0x2a99('0x57')](_0x21a111[_0x2a99('0x45')]);_0xfe5737[_0x2a99('0x4c')]=_[_0x2a99('0x46')](_0xfe5737[_0x2a99('0x44')],_0xfe5737[_0x2a99('0x45')]);_0x198a58[_0x2a99('0x48')]=_[_0x2a99('0x46')](_0xfe5737[_0x2a99('0x44')],qs[_0x2a99('0x47')](_0x21a111[_0x2a99('0x45')]['fields']));_0x198a58[_0x2a99('0x48')]=_0x198a58[_0x2a99('0x48')][_0x2a99('0x49')]?_0x198a58['attributes']:_0xfe5737['model'];if(_0x21a111[_0x2a99('0x45')][_0x2a99('0x52')]){_0x198a58[_0x2a99('0x53')]=[{'all':!![]}];}_0x198a58=_[_0x2a99('0x50')]({},_0x198a58,_0x21a111[_0x2a99('0x51')]);return db[_0x2a99('0x3f')]['find'](_0x198a58)[_0x2a99('0x23')](handleEntityNotFound(_0x21e71,null))[_0x2a99('0x23')](respondWithResult(_0x21e71,null))['catch'](handleError(_0x21e71,null));};exports[_0x2a99('0x38')]=function(_0x5e850f,_0x279d75){if(_0x5e850f[_0x2a99('0x58')]['id']){delete _0x5e850f['body']['id'];}return db[_0x2a99('0x3f')][_0x2a99('0x59')]({'where':{'id':_0x5e850f[_0x2a99('0x5a')]['id']}})[_0x2a99('0x23')](handleEntityNotFound(_0x279d75,null))[_0x2a99('0x23')](saveUpdates(_0x5e850f['body'],null))[_0x2a99('0x23')](respondWithResult(_0x279d75,null))[_0x2a99('0x2d')](handleError(_0x279d75,null));};exports[_0x2a99('0x39')]=function(_0x2b1545,_0x41c6e9){return db[_0x2a99('0x3f')]['find']({'where':{'id':_0x2b1545['params']['id']}})[_0x2a99('0x23')](handleEntityNotFound(_0x41c6e9,null))[_0x2a99('0x23')](removeEntity(_0x41c6e9,null))['catch'](handleError(_0x41c6e9,null));};exports['describe']=function(_0x37c7b7,_0x239475){return db[_0x2a99('0x3f')]['describe']()[_0x2a99('0x23')](respondWithResult(_0x239475,null))['catch'](handleError(_0x239475,null));};exports[_0x2a99('0x5b')]=function(_0x4950cb,_0x1b7318){return db['MailMessage'][_0x2a99('0x5b')](_0x4950cb['body'])[_0x2a99('0x23')](function(_0x2607f2){if(_0x2607f2){if(_0x2607f2[_0x2a99('0x5c')]===_0x2a99('0x5d')&&!_0x2607f2[_0x2a99('0x5e')]){var _0x41aeb8,_0x393ba0,_0x18ed23;if(_0x4950cb[_0x2a99('0x58')]['to']){_0x393ba0=_0x4950cb[_0x2a99('0x58')]['to'][_0x2a99('0x5f')](',')[0x0];}return db['MailAccount']['findOne']({'where':{'id':_0x2607f2[_0x2a99('0x60')]},'include':[{'model':db[_0x2a99('0x61')],'as':'List','include':[{'model':db[_0x2a99('0x62')],'as':_0x2a99('0x63'),'where':{'email':_0x393ba0},'limit':0x1,'order':[[_0x2a99('0x64'),_0x2a99('0x65')]]}]},{'model':db[_0x2a99('0x66')],'as':_0x2a99('0x67'),'raw':!![]}]})[_0x2a99('0x23')](function(_0x1c5c7a){_0x41aeb8=_0x1c5c7a;if(_0x41aeb8&&_0x41aeb8[_0x2a99('0x67')]){var _0x4477c8={'tls':{'rejectUnauthorized':![]}};if(_[_0x2a99('0x68')](_0x41aeb8['Smtp'][_0x2a99('0x69')])){_0x4477c8[_0x2a99('0x6a')]=_0x41aeb8[_0x2a99('0x67')][_0x2a99('0x6a')];_0x4477c8[_0x2a99('0x6b')]=_0x41aeb8[_0x2a99('0x67')][_0x2a99('0x6b')];_0x4477c8['secure']=_0x41aeb8['Smtp'][_0x2a99('0x6c')];if(_0x41aeb8[_0x2a99('0x67')][_0x2a99('0x6d')]){_0x4477c8[_0x2a99('0x6e')]={'user':_0x41aeb8[_0x2a99('0x67')][_0x2a99('0x6f')],'pass':_0x41aeb8[_0x2a99('0x67')]['pass']};}}else{_0x4477c8[_0x2a99('0x69')]=_0x41aeb8[_0x2a99('0x67')][_0x2a99('0x69')];_0x4477c8[_0x2a99('0x6e')]={'user':_0x41aeb8['Smtp']['user'],'pass':_0x41aeb8[_0x2a99('0x67')]['pass']};_0x4477c8[_0x2a99('0x6c')]=_0x41aeb8[_0x2a99('0x67')][_0x2a99('0x6c')];}if(_0x4950cb[_0x2a99('0x58')][_0x2a99('0x70')]&&_0x4950cb[_0x2a99('0x58')]['attachments'][_0x2a99('0x49')]){for(var _0x5e68ee=0x0;_0x5e68ee<_0x4950cb[_0x2a99('0x58')][_0x2a99('0x70')][_0x2a99('0x49')];_0x5e68ee+=0x1){_0x4950cb[_0x2a99('0x58')][_0x2a99('0x70')][_0x5e68ee]={'filename':_0x4950cb['body'][_0x2a99('0x70')][_0x5e68ee][_0x2a99('0x3b')],'path':path[_0x2a99('0x71')](config['root'],_0x2a99('0x72'),_0x4950cb[_0x2a99('0x58')][_0x2a99('0x70')][_0x5e68ee]['basename'])};}}_0x18ed23={'account':_0x4477c8,'message':_0x4950cb[_0x2a99('0x58')]};return;}})[_0x2a99('0x23')](function(){if(_0x41aeb8['List']){if(_0x41aeb8[_0x2a99('0x73')][_0x2a99('0x63')][_0x2a99('0x49')]){return _0x41aeb8['List'][_0x2a99('0x63')][0x0];}else{return db['CmContact']['create'](_['defaults'](_0x4950cb['body'],{'firstName':_0x4950cb[_0x2a99('0x58')]['to'],'email':_0x4950cb[_0x2a99('0x58')]['to'],'phone':_0x4950cb['body']['to'],'ListId':_0x41aeb8[_0x2a99('0x74')]}));}}else{throw new Error(_0x2a99('0x75'));}})[_0x2a99('0x23')](function(){if(_0x18ed23){return respondWithRpcPromise(_0x2a99('0x76'),_0x2a99('0x77'),_0x18ed23,client9003)[_0x2a99('0x23')](function(_0x597144){return _0x2607f2[_0x2a99('0x38')]({'read':!![],'messageId':_0x597144['messageId'],'sentAt':moment()['format'](_0x2a99('0x78'))});})[_0x2a99('0x2d')](function(_0x192468){logger[_0x2a99('0x28')]('%s',JSON[_0x2a99('0x27')](_0x192468));return _0x2607f2;});}return _0x2607f2;});}return _0x2607f2;}})[_0x2a99('0x23')](respondWithResult(_0x1b7318,0xc9))['catch'](handleError(_0x1b7318,null));};var interaction_log=require(_0x2a99('0x13'))(_0x2a99('0x79'));exports[_0x2a99('0x7a')]=function(_0x20e89e,_0x5e2113,_0xd1cbc0){var _0x110d9c={'channel':_0x2a99('0x7b')};if(_0x20e89e['body']['id']){delete _0x20e89e[_0x2a99('0x58')]['id'];}_0x20e89e['body']['read']=!![];_0x20e89e[_0x2a99('0x58')][_0x2a99('0x7c')]=moment()[_0x2a99('0x7d')]('YYYY-MM-DD\x20HH:mm:ss');_0x20e89e[_0x2a99('0x58')][_0x2a99('0x7e')]=_0x20e89e[_0x2a99('0x58')]['UserId']||_0x20e89e[_0x2a99('0x6f')]['id'];return db[_0x2a99('0x3f')][_0x2a99('0x59')]({'where':{'id':_0x20e89e[_0x2a99('0x5a')]['id'],'UserId':null},'include':[{'model':db[_0x2a99('0x62')],'as':_0x2a99('0x7f')}]})[_0x2a99('0x23')](handleEntityNotFound(_0x5e2113,null))[_0x2a99('0x23')](saveUpdates(_0x20e89e[_0x2a99('0x58')],null))[_0x2a99('0x23')](function(_0x1db46b){if(_0x1db46b){_0x110d9c['message']=_0x1db46b[_0x2a99('0x80')]({'plain':!![]});return db['MailInteraction'][_0x2a99('0x59')]({'where':{'id':_0x1db46b[_0x2a99('0x81')]}});}return null;})[_0x2a99('0x23')](handleEntityNotFound(_0x5e2113,null))[_0x2a99('0x23')](function(_0x141f52){if(_0x141f52){return _0x141f52[_0x2a99('0x38')]({'UserId':_0x20e89e[_0x2a99('0x58')][_0x2a99('0x7e')],'read1stAt':_[_0x2a99('0x68')](_0x141f52[_0x2a99('0x82')])?moment()['format'](_0x2a99('0x78')):undefined});}return null;})[_0x2a99('0x23')](function(_0x59da49){if(_0x59da49){_0x110d9c[_0x2a99('0x83')]=_0x59da49[_0x2a99('0x80')]({'plain':!![]});interaction_log[_0x2a99('0x2b')]('[MAILMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x20e89e['user']['id'],_0x20e89e[_0x2a99('0x6f')]['name'],_0x20e89e[_0x2a99('0x6f')][_0x2a99('0x84')],_0x110d9c[_0x2a99('0x83')]['id'],_0x20e89e['body']?JSON['stringify'](_0x20e89e['body']):'null');return respondWithRpcPromise('AcceptMessage',_0x2a99('0x85'),_0x110d9c);}return null;})['then'](function(_0x48debf){if(_0x48debf){if(_0x20e89e[_0x2a99('0x58')][_0x2a99('0x86')]){_0x110d9c[_0x2a99('0x2a')]['interface']=util[_0x2a99('0x7d')](_0x2a99('0x87'),_0x20e89e['user'][_0x2a99('0x3b')]);_0x110d9c[_0x2a99('0x2a')]['channel']=_0x110d9c['channel'];_0x110d9c[_0x2a99('0x2a')][_0x2a99('0x88')]=_0x2a99('0x7a');return respondWithRpcPromise(_0x2a99('0x89'),_0x2a99('0x89'),{'event':_0x2a99('0x8a'),'message':_0x110d9c[_0x2a99('0x2a')]},client9002)[_0x2a99('0x23')](function(){return _0x110d9c;});}return _0x110d9c;}return null;})['then'](respondWithResult(_0x5e2113,null))[_0x2a99('0x2d')](handleError(_0x5e2113,null));};var interaction_log=require(_0x2a99('0x13'))(_0x2a99('0x79'));exports['reject']=function(_0x8ed745,_0x3bc2a6,_0x33091f){var _0x5c078f={'agent':{},'channel':_0x2a99('0x7b')};if(_0x8ed745[_0x2a99('0x58')]['id']){delete _0x8ed745['body']['id'];}_0x8ed745[_0x2a99('0x58')][_0x2a99('0x7e')]=_0x8ed745[_0x2a99('0x58')]['UserId']||_0x8ed745['user']['id'];_0x5c078f[_0x2a99('0x8b')]['id']=_0x8ed745['body'][_0x2a99('0x7e')];return db[_0x2a99('0x3f')]['find']({'where':{'id':_0x8ed745['params']['id'],'UserId':null}})[_0x2a99('0x23')](handleEntityNotFound(_0x3bc2a6,null))[_0x2a99('0x23')](function(_0x2b96b3){if(_0x2b96b3){_0x5c078f[_0x2a99('0x2a')]=_0x2b96b3[_0x2a99('0x80')]({'plain':!![]});return db['MailInteraction']['find']({'where':{'id':_0x2b96b3[_0x2a99('0x81')]}});}return null;})[_0x2a99('0x23')](handleEntityNotFound(_0x3bc2a6,null))[_0x2a99('0x23')](function(_0x1a2637){if(_0x1a2637){_0x5c078f[_0x2a99('0x83')]=_0x1a2637[_0x2a99('0x80')]({'plain':!![]});interaction_log[_0x2a99('0x2b')]('[MAILMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x8ed745[_0x2a99('0x6f')]['id'],_0x8ed745[_0x2a99('0x6f')][_0x2a99('0x3b')],_0x8ed745[_0x2a99('0x6f')][_0x2a99('0x84')],_0x5c078f[_0x2a99('0x83')]['id'],_0x8ed745[_0x2a99('0x58')]?JSON['stringify'](_0x8ed745['body']):'null');return respondWithRpcPromise(_0x2a99('0x8c'),_0x2a99('0x8d'),_0x5c078f);}return null;})[_0x2a99('0x23')](function(_0x39febe){if(_0x39febe){_0x39febe[_0x2a99('0x2a')][_0x2a99('0x8e')]=util[_0x2a99('0x7d')]('SIP/%s',_0x8ed745[_0x2a99('0x6f')]['name']);_0x39febe['message'][_0x2a99('0x8f')]=_0x5c078f[_0x2a99('0x8f')];_0x39febe[_0x2a99('0x2a')][_0x2a99('0x88')]=_0x2a99('0x36');respondWithRpcPromise(_0x2a99('0x89'),'EventManager',{'event':_0x2a99('0x90'),'message':_0x39febe[_0x2a99('0x2a')]},client9002);return _0x5c078f;}return null;})['then'](respondWithResult(_0x3bc2a6,null))[_0x2a99('0x2d')](handleError(_0x3bc2a6,null));};exports['download']=function(_0x4ebe84,_0x381f16){var _0x21ed7b=moment()[_0x2a99('0x91')]()[_0x2a99('0x92')]();var _0x388918=path[_0x2a99('0x71')](config[_0x2a99('0x93')],'server',_0x2a99('0x94'),_0x2a99('0x95'));var _0x565837=path[_0x2a99('0x71')](config['root'],_0x2a99('0x96'),'files',_0x2a99('0x70'));var _0x216a38=util[_0x2a99('0x7d')]('message-%s.eml',_0x21ed7b);return db[_0x2a99('0x3f')][_0x2a99('0x59')]({'where':{'id':_0x4ebe84[_0x2a99('0x5a')]['id']},'attributes':['id',_0x2a99('0x58'),'from','to','cc',_0x2a99('0x97'),'subject','createdAt'],'include':_0x4ebe84[_0x2a99('0x45')][_0x2a99('0x70')]?[{'model':db[_0x2a99('0x98')],'as':_0x2a99('0x99')}]:undefined})[_0x2a99('0x23')](handleEntityNotFound(_0x381f16,null))[_0x2a99('0x23')](function(_0x1c2e09){if(_0x1c2e09){var _0x2a43e8=_0x1c2e09;var _0x4f27d8={'from':_0x2a43e8[_0x2a99('0x9a')],'to':_0x2a43e8['to'],'subject':_0x2a43e8[_0x2a99('0x9b')],'html':_0x2a43e8['body'],'headers':{'Date':moment(_0x2a43e8[_0x2a99('0x9c')])[_0x2a99('0x7d')](_0x2a99('0x9d'))},'attachments':[]};if(_0x1c2e09['cc']){_0x4f27d8[_0x2a99('0x9e')]['Cc']=_0x1c2e09['cc'];}if(_0x1c2e09[_0x2a99('0x97')]){_0x4f27d8[_0x2a99('0x9e')][_0x2a99('0x9f')]=_0x1c2e09[_0x2a99('0x97')];}return new BPromise(function(_0x7efe96,_0x4da9bb){if(_0x1c2e09['Attachments']){for(var _0x27434d=0x0;_0x27434d<_0x1c2e09[_0x2a99('0x99')][_0x2a99('0x49')];_0x27434d++){var _0xb5a920=_0x1c2e09[_0x2a99('0x99')][_0x27434d];var _0x23091c=path['join'](_0x565837,_0xb5a920[_0x2a99('0xa0')]);if(fs['existsSync'](_0x23091c)){_0x4f27d8[_0x2a99('0x70')][_0x2a99('0xa1')]({'name':_0xb5a920[_0x2a99('0x3b')],'contentType':_0xb5a920[_0x2a99('0x42')],'data':fs['readFileSync'](_0x23091c)});}}}emlformat[_0x2a99('0xa2')](_0x4f27d8,function(_0x3094be,_0x4be8fc){if(_0x3094be)return _0x4da9bb(_0x3094be);fs['writeFileSync'](path[_0x2a99('0x71')](_0x388918,_0x216a38),_0x4be8fc);return _0x7efe96(_0x4be8fc);});});}})[_0x2a99('0x23')](function(_0x429def){if(_0x429def){return _0x381f16[_0x2a99('0xa3')](path[_0x2a99('0x71')](_0x388918,_0x216a38),_0x216a38,function(_0xe89f23){if(_0xe89f23){console[_0x2a99('0xa4')](_0x2a99('0xa5'),_0xe89f23);}else{fs[_0x2a99('0xa6')](path['join'](_0x388918,_0x216a38));}});}})['catch'](handleError(_0x381f16,null));}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.events.js b/server/api/mailMessage/mailMessage.events.js index 9d3655d..7562208 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 _0x32fc=['emit','hasOwnProperty','hook','events','../../mysqldb','save','update','remove'];(function(_0x427cfe,_0x3c6044){var _0x10ad69=function(_0x354bff){while(--_0x354bff){_0x427cfe['push'](_0x427cfe['shift']());}};_0x10ad69(++_0x3c6044);}(_0x32fc,0x193));var _0xc32f=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x32fc[_0x3dd15e];return _0x231fd0;};'use strict';var EventEmitter=require(_0xc32f('0x0'));var MailMessage=require(_0xc32f('0x1'))['db']['MailMessage'];var MailMessageEvents=new EventEmitter();MailMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xc32f('0x2'),'afterUpdate':_0xc32f('0x3'),'afterDestroy':_0xc32f('0x4')};function emitEvent(_0x33ab8f){return function(_0x4dc011,_0x36a773,_0x44323d){MailMessageEvents[_0xc32f('0x5')](_0x33ab8f+':'+_0x4dc011['id'],_0x4dc011);MailMessageEvents['emit'](_0x33ab8f,_0x4dc011);_0x44323d(null);};}for(var e in events){if(events[_0xc32f('0x6')](e)){var event=events[e];MailMessage[_0xc32f('0x7')](e,emitEvent(event));}}module['exports']=MailMessageEvents; \ No newline at end of file +var _0xe2ee=['update','remove','emit','hasOwnProperty','hook','exports','events','MailMessage','setMaxListeners','save'];(function(_0x332d08,_0x5b1c82){var _0x21e667=function(_0x71d4ca){while(--_0x71d4ca){_0x332d08['push'](_0x332d08['shift']());}};_0x21e667(++_0x5b1c82);}(_0xe2ee,0xc4));var _0xee2e=function(_0x59e821,_0x86c723){_0x59e821=_0x59e821-0x0;var _0x5333f6=_0xe2ee[_0x59e821];return _0x5333f6;};'use strict';var EventEmitter=require(_0xee2e('0x0'));var MailMessage=require('../../mysqldb')['db'][_0xee2e('0x1')];var MailMessageEvents=new EventEmitter();MailMessageEvents[_0xee2e('0x2')](0x0);var events={'afterCreate':_0xee2e('0x3'),'afterUpdate':_0xee2e('0x4'),'afterDestroy':_0xee2e('0x5')};function emitEvent(_0x382602){return function(_0x59ed6d,_0x201b03,_0xa005b0){MailMessageEvents[_0xee2e('0x6')](_0x382602+':'+_0x59ed6d['id'],_0x59ed6d);MailMessageEvents[_0xee2e('0x6')](_0x382602,_0x59ed6d);_0xa005b0(null);};}for(var e in events){if(events[_0xee2e('0x7')](e)){var event=events[e];MailMessage[_0xee2e('0x8')](e,emitEvent(event));}}module[_0xee2e('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 1e5ebb1..9783778 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 _0x4850=['secret','UserId','MailInteraction','findOne','createdAt','catch','error','utf8mb4','lodash','util','../../config/logger','moment','bluebird','path','../../config/environment','exports','define','MailMessage','mail_messages','fti_mail_messages','subject','FULLTEXT','plainBody','fromString','get','direction','toLowerCase','out'];(function(_0x3511d3,_0x4107ae){var _0x5d6321=function(_0x1a23da){while(--_0x1a23da){_0x3511d3['push'](_0x3511d3['shift']());}};_0x5d6321(++_0x4107ae);}(_0x4850,0x1ac));var _0x0485=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0x4850[_0x4b369d];return _0x571a98;};'use strict';var _=require(_0x0485('0x0'));var util=require(_0x0485('0x1'));var logger=require(_0x0485('0x2'))('api');var moment=require(_0x0485('0x3'));var BPromise=require(_0x0485('0x4'));var rp=require('request-promise');var htmlToText=require('html-to-text');var fs=require('fs');var path=require(_0x0485('0x5'));var rimraf=require('rimraf');var config=require(_0x0485('0x6'));var attributes=require('./mailMessage.attributes');module[_0x0485('0x7')]=function(_0x149fac,_0x55b59d){return _0x149fac[_0x0485('0x8')](_0x0485('0x9'),attributes,{'tableName':_0x0485('0xa'),'paranoid':![],'indexes':[{'name':'messageId','fields':['messageId']},{'name':_0x0485('0xb'),'fields':['plainBody',_0x0485('0xc')],'type':_0x0485('0xd')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x24bcc3,_0x2e247d,_0x881ec){if(_0x24bcc3['body']){_0x24bcc3[_0x0485('0xe')]=htmlToText[_0x0485('0xf')](_0x24bcc3['body'],{'preserveNewlines':!![],'singleNewLineParagraphs':!![],'uppercaseHeadings':![],'noLinkBrackets':!![],'ignoreImage':!![]});}_0x881ec(null,_0x2e247d);},'afterCreate':function(_0x8334c8,_0x2ebddf,_0x102462){var _0x85a12=_0x149fac['models'];var _0x50c357=_0x8334c8[_0x0485('0x10')]({'plain':!![]});if(_0x50c357[_0x0485('0x11')][_0x0485('0x12')]()==='in'||_0x50c357['direction'][_0x0485('0x12')]()===_0x0485('0x13')&&!_0x50c357[_0x0485('0x14')]&&!_['isNil'](_0x50c357[_0x0485('0x15')])){_0x85a12[_0x0485('0x16')][_0x0485('0x17')]({'where':{'id':_0x50c357['MailInteractionId']}})['then'](function(_0x4243de){if(_0x4243de){_0x4243de['update']({'lastMsgAt':_0x50c357[_0x0485('0x18')],'lastMsgDirection':_0x50c357[_0x0485('0x11')][_0x0485('0x12')](),'lastMsgBody':_0x50c357['body']});}})[_0x0485('0x19')](function(_0x26ddcf){console[_0x0485('0x1a')](_0x26ddcf);});}_0x102462();}},'charset':_0x0485('0x1b'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0xaa35=['MailInteraction','then','update','createdAt','catch','error','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','request-promise','html-to-text','rimraf','../../config/environment','./mailMessage.attributes','exports','define','MailMessage','messageId','fti_mail_messages','plainBody','subject','FULLTEXT','body','get','direction','toLowerCase','isNil','UserId'];(function(_0x5ec1ec,_0x5f095c){var _0x4c099f=function(_0x5b1a7e){while(--_0x5b1a7e){_0x5ec1ec['push'](_0x5ec1ec['shift']());}};_0x4c099f(++_0x5f095c);}(_0xaa35,0x6b));var _0x5aa3=function(_0x421eeb,_0x3d3e3e){_0x421eeb=_0x421eeb-0x0;var _0x2c7371=_0xaa35[_0x421eeb];return _0x2c7371;};'use strict';var _=require(_0x5aa3('0x0'));var util=require(_0x5aa3('0x1'));var logger=require(_0x5aa3('0x2'))(_0x5aa3('0x3'));var moment=require(_0x5aa3('0x4'));var BPromise=require(_0x5aa3('0x5'));var rp=require(_0x5aa3('0x6'));var htmlToText=require(_0x5aa3('0x7'));var fs=require('fs');var path=require('path');var rimraf=require(_0x5aa3('0x8'));var config=require(_0x5aa3('0x9'));var attributes=require(_0x5aa3('0xa'));module[_0x5aa3('0xb')]=function(_0x26f952,_0x1c4bc5){return _0x26f952[_0x5aa3('0xc')](_0x5aa3('0xd'),attributes,{'tableName':'mail_messages','paranoid':![],'indexes':[{'name':'messageId','fields':[_0x5aa3('0xe')]},{'name':_0x5aa3('0xf'),'fields':[_0x5aa3('0x10'),_0x5aa3('0x11')],'type':_0x5aa3('0x12')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x4ad2c4,_0xac1e67,_0x18828b){if(_0x4ad2c4['body']){_0x4ad2c4[_0x5aa3('0x10')]=htmlToText['fromString'](_0x4ad2c4[_0x5aa3('0x13')],{'preserveNewlines':!![],'singleNewLineParagraphs':!![],'uppercaseHeadings':![],'noLinkBrackets':!![],'ignoreImage':!![]});}_0x18828b(null,_0xac1e67);},'afterCreate':function(_0x3dccb0,_0x48ee4d,_0x27b36a){var _0x2361b1=_0x26f952['models'];var _0x4dcf7d=_0x3dccb0[_0x5aa3('0x14')]({'plain':!![]});if(_0x4dcf7d[_0x5aa3('0x15')][_0x5aa3('0x16')]()==='in'||_0x4dcf7d[_0x5aa3('0x15')][_0x5aa3('0x16')]()==='out'&&!_0x4dcf7d['secret']&&!_[_0x5aa3('0x17')](_0x4dcf7d[_0x5aa3('0x18')])){_0x2361b1[_0x5aa3('0x19')]['findOne']({'where':{'id':_0x4dcf7d['MailInteractionId']}})[_0x5aa3('0x1a')](function(_0xb0ed76){if(_0xb0ed76){_0xb0ed76[_0x5aa3('0x1b')]({'lastMsgAt':_0x4dcf7d[_0x5aa3('0x1c')],'lastMsgDirection':_0x4dcf7d[_0x5aa3('0x15')]['toLowerCase'](),'lastMsgBody':_0x4dcf7d['body']});}})[_0x5aa3('0x1d')](function(_0x343f91){console[_0x5aa3('0x1e')](_0x343f91);});}_0x27b36a();}},'charset':_0x5aa3('0x1f'),'collate':_0x5aa3('0x20')});}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.rpc.js b/server/api/mailMessage/mailMessage.rpc.js index 7da8076..81a3001 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 _0x04f9=['request\x20sent','debug','MailMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','MailMessage','create','options','raw','CreateMailMessage','catch','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','redis','defaults','socket.io-emitter','./mailMessage.socket','request','then','info','MailMessage,\x20%s,\x20%s'];(function(_0x46275e,_0x237ca7){var _0x3da773=function(_0xfb157e){while(--_0xfb157e){_0x46275e['push'](_0x46275e['shift']());}};_0x3da773(++_0x237ca7);}(_0x04f9,0xb3));var _0x904f=function(_0x17376,_0x919577){_0x17376=_0x17376-0x0;var _0x2fedb9=_0x04f9[_0x17376];return _0x2fedb9;};'use strict';var _=require('lodash');var util=require(_0x904f('0x0'));var moment=require(_0x904f('0x1'));var BPromise=require(_0x904f('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x904f('0x3'));var db=require(_0x904f('0x4'))['db'];var utils=require(_0x904f('0x5'));var logger=require(_0x904f('0x6'))(_0x904f('0x7'));var config=require(_0x904f('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x904f('0x9')][_0x904f('0xa')]({'port':0x232a});config[_0x904f('0xb')]=_[_0x904f('0xc')](config[_0x904f('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0x904f('0xd'))(new Redis(config[_0x904f('0xb')]));require(_0x904f('0xe'))['register'](socket);function respondWithRpcPromise(_0xb64c23,_0x1bcfc3,_0x12fbce){return new BPromise(function(_0x3477ae,_0x156ec7){return client[_0x904f('0xf')](_0xb64c23,_0x12fbce)[_0x904f('0x10')](function(_0x31e3e2){logger[_0x904f('0x11')](_0x904f('0x12'),_0x1bcfc3,_0x904f('0x13'));logger[_0x904f('0x14')](_0x904f('0x15'),_0x1bcfc3,_0x904f('0x13'),JSON[_0x904f('0x16')](_0x31e3e2));if(_0x31e3e2[_0x904f('0x17')]){if(_0x31e3e2[_0x904f('0x17')][_0x904f('0x18')]===0x1f4){logger[_0x904f('0x17')](_0x904f('0x12'),_0x1bcfc3,_0x31e3e2[_0x904f('0x17')][_0x904f('0x19')]);return _0x156ec7(_0x31e3e2[_0x904f('0x17')]['message']);}logger['error'](_0x904f('0x12'),_0x1bcfc3,_0x31e3e2[_0x904f('0x17')]['message']);return _0x3477ae(_0x31e3e2['error']['message']);}else{logger[_0x904f('0x11')](_0x904f('0x12'),_0x1bcfc3,'request\x20sent');_0x3477ae(_0x31e3e2[_0x904f('0x1a')]['message']);}})['catch'](function(_0x5d9495){logger['error']('MailMessage,\x20%s,\x20%s',_0x1bcfc3,_0x5d9495);_0x156ec7(_0x5d9495);});});}exports['CreateMailMessage']=function(_0x884767){var _0x3e55b1=this;return new Promise(function(_0x4ab9b3,_0x22b1ba){return db[_0x904f('0x1b')][_0x904f('0x1c')](_0x884767['body'],{'raw':_0x884767[_0x904f('0x1d')]?_0x884767[_0x904f('0x1d')][_0x904f('0x1e')]===undefined?!![]:![]:!![]})[_0x904f('0x10')](function(_0x1f394d){logger[_0x904f('0x11')](_0x904f('0x1f'),_0x884767);logger[_0x904f('0x14')](_0x904f('0x1f'),_0x884767,JSON[_0x904f('0x16')](_0x1f394d));_0x4ab9b3(_0x1f394d);})[_0x904f('0x20')](function(_0x39205c){logger[_0x904f('0x17')](_0x904f('0x1f'),_0x39205c[_0x904f('0x19')],_0x884767);_0x22b1ba(_0x3e55b1['error'](0x1f4,_0x39205c['message']));});});}; \ No newline at end of file +var _0x9303=['request\x20sent','stringify','error','code','message','catch','MailMessage','create','body','options','raw','CreateMailMessage','lodash','bluebird','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','localhost','socket.io-emitter','./mailMessage.socket','request','then','info','MailMessage,\x20%s,\x20%s','debug'];(function(_0x369cbe,_0x2c8bda){var _0x280f8f=function(_0x4fe14a){while(--_0x4fe14a){_0x369cbe['push'](_0x369cbe['shift']());}};_0x280f8f(++_0x2c8bda);}(_0x9303,0xd7));var _0x3930=function(_0x1f15bb,_0x4663fb){_0x1f15bb=_0x1f15bb-0x0;var _0x3a49ef=_0x9303[_0x1f15bb];return _0x3a49ef;};'use strict';var _=require(_0x3930('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x3930('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x3930('0x2'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x3930('0x3'))(_0x3930('0x4'));var config=require(_0x3930('0x5'));var jayson=require(_0x3930('0x6'));var client=jayson['client'][_0x3930('0x7')]({'port':0x232a});config['redis']=_['defaults'](config[_0x3930('0x8')],{'host':_0x3930('0x9'),'port':0x18eb});var socket=require(_0x3930('0xa'))(new Redis(config[_0x3930('0x8')]));require(_0x3930('0xb'))['register'](socket);function respondWithRpcPromise(_0x5d5aef,_0x104088,_0x5c19e3){return new BPromise(function(_0x5269b3,_0x5503a7){return client[_0x3930('0xc')](_0x5d5aef,_0x5c19e3)[_0x3930('0xd')](function(_0x417b9c){logger[_0x3930('0xe')](_0x3930('0xf'),_0x104088,'request\x20sent');logger[_0x3930('0x10')]('MailMessage,\x20%s,\x20%s,\x20%s',_0x104088,_0x3930('0x11'),JSON[_0x3930('0x12')](_0x417b9c));if(_0x417b9c[_0x3930('0x13')]){if(_0x417b9c['error'][_0x3930('0x14')]===0x1f4){logger[_0x3930('0x13')]('MailMessage,\x20%s,\x20%s',_0x104088,_0x417b9c[_0x3930('0x13')][_0x3930('0x15')]);return _0x5503a7(_0x417b9c[_0x3930('0x13')][_0x3930('0x15')]);}logger['error']('MailMessage,\x20%s,\x20%s',_0x104088,_0x417b9c[_0x3930('0x13')]['message']);return _0x5269b3(_0x417b9c[_0x3930('0x13')]['message']);}else{logger[_0x3930('0xe')](_0x3930('0xf'),_0x104088,'request\x20sent');_0x5269b3(_0x417b9c['result']['message']);}})[_0x3930('0x16')](function(_0x1462db){logger[_0x3930('0x13')]('MailMessage,\x20%s,\x20%s',_0x104088,_0x1462db);_0x5503a7(_0x1462db);});});}exports['CreateMailMessage']=function(_0x4f4e2e){var _0x5a2501=this;return new Promise(function(_0x3400f5,_0x2ba9ba){return db[_0x3930('0x17')][_0x3930('0x18')](_0x4f4e2e[_0x3930('0x19')],{'raw':_0x4f4e2e['options']?_0x4f4e2e[_0x3930('0x1a')][_0x3930('0x1b')]===undefined?!![]:![]:!![]})[_0x3930('0xd')](function(_0x4a4307){logger[_0x3930('0xe')](_0x3930('0x1c'),_0x4f4e2e);logger[_0x3930('0x10')](_0x3930('0x1c'),_0x4f4e2e,JSON[_0x3930('0x12')](_0x4a4307));_0x3400f5(_0x4a4307);})[_0x3930('0x16')](function(_0x347d7d){logger[_0x3930('0x13')]('CreateMailMessage',_0x347d7d[_0x3930('0x15')],_0x4f4e2e);_0x2ba9ba(_0x5a2501[_0x3930('0x13')](0x1f4,_0x347d7d[_0x3930('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.socket.js b/server/api/mailMessage/mailMessage.socket.js index ec06d78..5ca8dea 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 _0x1f75=['removeListener','register','length','mailMessage:','./mailMessage.events','save','remove','emit'];(function(_0x1b1f75,_0xeb05ee){var _0x41fa61=function(_0xbd992){while(--_0xbd992){_0x1b1f75['push'](_0x1b1f75['shift']());}};_0x41fa61(++_0xeb05ee);}(_0x1f75,0x12c));var _0x51f7=function(_0x373dee,_0x1a8c45){_0x373dee=_0x373dee-0x0;var _0x46798f=_0x1f75[_0x373dee];return _0x46798f;};'use strict';var MailMessageEvents=require(_0x51f7('0x0'));var events=[_0x51f7('0x1'),_0x51f7('0x2'),'update'];function createListener(_0xc7556d,_0x131535){return function(_0x10fc45){_0x131535[_0x51f7('0x3')](_0xc7556d,_0x10fc45);};}function removeListener(_0x3df27f,_0x4e6fc){return function(){MailMessageEvents[_0x51f7('0x4')](_0x3df27f,_0x4e6fc);};}exports[_0x51f7('0x5')]=function(_0x292480){for(var _0x22fc29=0x0,_0x3eb36d=events[_0x51f7('0x6')];_0x22fc29<_0x3eb36d;_0x22fc29++){var _0x5a1f98=events[_0x22fc29];var _0x2d944f=createListener(_0x51f7('0x7')+_0x5a1f98,_0x292480);MailMessageEvents['on'](_0x5a1f98,_0x2d944f);}}; \ No newline at end of file +var _0x8f9d=['update','emit','removeListener','register','mailMessage:','./mailMessage.events','remove'];(function(_0x281df6,_0x15dc0e){var _0x26c3a4=function(_0x7ccfb){while(--_0x7ccfb){_0x281df6['push'](_0x281df6['shift']());}};_0x26c3a4(++_0x15dc0e);}(_0x8f9d,0x15c));var _0xd8f9=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0x8f9d[_0x42cae2];return _0x5f256f;};'use strict';var MailMessageEvents=require(_0xd8f9('0x0'));var events=['save',_0xd8f9('0x1'),_0xd8f9('0x2')];function createListener(_0x3a8836,_0x4f5115){return function(_0x983c9f){_0x4f5115[_0xd8f9('0x3')](_0x3a8836,_0x983c9f);};}function removeListener(_0x4dd5ec,_0x741d98){return function(){MailMessageEvents[_0xd8f9('0x4')](_0x4dd5ec,_0x741d98);};}exports[_0xd8f9('0x5')]=function(_0x4e4ac2){for(var _0x43b504=0x0,_0x37b181=events['length'];_0x43b504<_0x37b181;_0x43b504++){var _0xf9e9a4=events[_0x43b504];var _0x2ca1ff=createListener(_0xd8f9('0x6')+_0xf9e9a4,_0x4e4ac2);MailMessageEvents['on'](_0xf9e9a4,_0x2ca1ff);}}; \ No newline at end of file diff --git a/server/api/mailQueue/index.js b/server/api/mailQueue/index.js index e5f5e77..83dcc47 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 _0x059a=['exports','multer','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailQueue.controller','get','isAuthenticated','index','/:id','/:id/teams','/:id/users','post','create','addTeams','addAgents','put','update','delete','destroy','removeTeams'];(function(_0x747474,_0x1a06bc){var _0x5be81e=function(_0x162514){while(--_0x162514){_0x747474['push'](_0x747474['shift']());}};_0x5be81e(++_0x1a06bc);}(_0x059a,0x151));var _0xa059=function(_0x317cc5,_0x3b6179){_0x317cc5=_0x317cc5-0x0;var _0x44fe81=_0x059a[_0x317cc5];return _0x44fe81;};'use strict';var multer=require(_0xa059('0x0'));var util=require('util');var path=require(_0xa059('0x1'));var timeout=require('connect-timeout');var express=require(_0xa059('0x2'));var router=express[_0xa059('0x3')]();var auth=require(_0xa059('0x4'));var interaction=require(_0xa059('0x5'));var config=require(_0xa059('0x6'));var controller=require(_0xa059('0x7'));router[_0xa059('0x8')]('/',auth[_0xa059('0x9')](),controller[_0xa059('0xa')]);router[_0xa059('0x8')]('/describe',auth['isAuthenticated'](),controller['describe']);router[_0xa059('0x8')](_0xa059('0xb'),auth['isAuthenticated'](),controller['show']);router['get']('/:id/members',auth['isAuthenticated'](),controller['getMembers']);router[_0xa059('0x8')](_0xa059('0xc'),auth[_0xa059('0x9')](),controller['getTeams']);router[_0xa059('0x8')](_0xa059('0xd'),auth[_0xa059('0x9')](),controller['getAgents']);router[_0xa059('0xe')]('/',auth['isAuthenticated'](),controller[_0xa059('0xf')]);router[_0xa059('0xe')](_0xa059('0xc'),auth[_0xa059('0x9')](),controller[_0xa059('0x10')]);router[_0xa059('0xe')]('/:id/users',auth[_0xa059('0x9')](),controller[_0xa059('0x11')]);router[_0xa059('0x12')](_0xa059('0xb'),auth[_0xa059('0x9')](),controller[_0xa059('0x13')]);router[_0xa059('0x14')](_0xa059('0xb'),auth[_0xa059('0x9')](),controller[_0xa059('0x15')]);router[_0xa059('0x14')]('/:id/teams',auth[_0xa059('0x9')](),controller[_0xa059('0x16')]);router['delete']('/:id/users',auth[_0xa059('0x9')](),controller['removeAgents']);module[_0xa059('0x17')]=router; \ No newline at end of file +var _0xd2c1=['get','isAuthenticated','/describe','describe','/:id/members','getMembers','/:id/teams','getTeams','create','post','addTeams','/:id/users','addAgents','put','/:id','update','delete','removeAgents','exports','multer','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x1c88f9,_0x211646){var _0x1779f7=function(_0x1dc48e){while(--_0x1dc48e){_0x1c88f9['push'](_0x1c88f9['shift']());}};_0x1779f7(++_0x211646);}(_0xd2c1,0x117));var _0x1d2c=function(_0x4f6f84,_0x31e197){_0x4f6f84=_0x4f6f84-0x0;var _0x20d989=_0xd2c1[_0x4f6f84];return _0x20d989;};'use strict';var multer=require(_0x1d2c('0x0'));var util=require('util');var path=require(_0x1d2c('0x1'));var timeout=require('connect-timeout');var express=require(_0x1d2c('0x2'));var router=express[_0x1d2c('0x3')]();var auth=require(_0x1d2c('0x4'));var interaction=require(_0x1d2c('0x5'));var config=require(_0x1d2c('0x6'));var controller=require('./mailQueue.controller');router[_0x1d2c('0x7')]('/',auth[_0x1d2c('0x8')](),controller['index']);router['get'](_0x1d2c('0x9'),auth['isAuthenticated'](),controller[_0x1d2c('0xa')]);router['get']('/:id',auth[_0x1d2c('0x8')](),controller['show']);router['get'](_0x1d2c('0xb'),auth['isAuthenticated'](),controller[_0x1d2c('0xc')]);router[_0x1d2c('0x7')](_0x1d2c('0xd'),auth[_0x1d2c('0x8')](),controller[_0x1d2c('0xe')]);router[_0x1d2c('0x7')]('/:id/users',auth[_0x1d2c('0x8')](),controller['getAgents']);router['post']('/',auth[_0x1d2c('0x8')](),controller[_0x1d2c('0xf')]);router[_0x1d2c('0x10')](_0x1d2c('0xd'),auth[_0x1d2c('0x8')](),controller[_0x1d2c('0x11')]);router[_0x1d2c('0x10')](_0x1d2c('0x12'),auth['isAuthenticated'](),controller[_0x1d2c('0x13')]);router[_0x1d2c('0x14')](_0x1d2c('0x15'),auth[_0x1d2c('0x8')](),controller[_0x1d2c('0x16')]);router[_0x1d2c('0x17')](_0x1d2c('0x15'),auth['isAuthenticated'](),controller['destroy']);router[_0x1d2c('0x17')](_0x1d2c('0xd'),auth[_0x1d2c('0x8')](),controller['removeTeams']);router[_0x1d2c('0x17')]('/:id/users',auth[_0x1d2c('0x8')](),controller[_0x1d2c('0x18')]);module[_0x1d2c('0x19')]=router; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.attributes.js b/server/api/mailQueue/mailQueue.attributes.js index f444fd3..f1909bf 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 _0x1cc1=['INTEGER','beepall','roundrobin','sequelize','exports','STRING','name'];(function(_0x140327,_0x4ff244){var _0x46f126=function(_0x36568c){while(--_0x36568c){_0x140327['push'](_0x140327['shift']());}};_0x46f126(++_0x4ff244);}(_0x1cc1,0x106));var _0x11cc=function(_0x2eb1be,_0x19ff07){_0x2eb1be=_0x2eb1be-0x0;var _0x56d8c2=_0x1cc1[_0x2eb1be];return _0x56d8c2;};'use strict';var Sequelize=require(_0x11cc('0x0'));module[_0x11cc('0x1')]={'name':{'type':Sequelize[_0x11cc('0x2')],'unique':_0x11cc('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x11cc('0x2')]},'timeout':{'type':Sequelize[_0x11cc('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM']('rrmemory',_0x11cc('0x5'),_0x11cc('0x6'))}}; \ No newline at end of file +var _0x5c84=['ENUM','beepall','sequelize','STRING','name','INTEGER'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0x5c84,0x1ca));var _0x45c8=function(_0xbf6d84,_0x1101bc){_0xbf6d84=_0xbf6d84-0x0;var _0x40c3fe=_0x5c84[_0xbf6d84];return _0x40c3fe;};'use strict';var Sequelize=require(_0x45c8('0x0'));module['exports']={'name':{'type':Sequelize[_0x45c8('0x1')],'unique':_0x45c8('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize[_0x45c8('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x45c8('0x4')]('rrmemory',_0x45c8('0x5'),'roundrobin')}}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.controller.js b/server/api/mailQueue/mailQueue.controller.js index e030d28..38208ab 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 _0xc058=['to-csv','ejs','lodash','squel','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../mysqldb','defaults','redis','localhost','socket.io-emitter','register','sendStatus','end','status','json','offset','limit','Content-Range','reject','save','then','destroy','get','UserProfileResource','error','stack','name','index','map','MailQueue','rawAttributes','fieldName','key','query','keys','filters','intersection','model','fields','attributes','length','hasOwnProperty','order','sort','where','pick','merge','type','VIRTUAL','options','count','includeAll','findAll','rows','include','find','catch','create','user','MailQueues','UserProfileSection','autoAssociation','update','body','params','describe','getMembers','findOne','UserMailQueue','nolimit','MailQueueId','filter','User','findAndCountAll','UserId','mailPause','updatedAt','createdAt','format','SIP','Team','getTeams','addTeams','ids','Agents','online','voicePause','interface','flatMap','transaction','findOrCreate','forEach','emit','select','field','from','team_has_mail_queues','join','ut.TeamId\x20=\x20tq.TeamId','MailQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','toString','sequelize','QueryTypes','SELECT','every','TeamId','includes','all','union','compact','isEmpty','removeAgents','userMailQueue:remove','addAgents','spread','userMailQueue:save','isArray','getAgents','html-pdf','zip-dir','request-promise','bluebird','mustache','util','path','sox'];(function(_0x490214,_0x8b5f84){var _0x9c9a46=function(_0x27b206){while(--_0x27b206){_0x490214['push'](_0x490214['shift']());}};_0x9c9a46(++_0x8b5f84);}(_0xc058,0x193));var _0x8c05=function(_0x27af45,_0x1b57aa){_0x27af45=_0x27af45-0x0;var _0x18df21=_0xc058[_0x27af45];return _0x18df21;};'use strict';var pdf=require(_0x8c05('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x8c05('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x8c05('0x2'));var moment=require('moment');var BPromise=require(_0x8c05('0x3'));var Mustache=require(_0x8c05('0x4'));var util=require(_0x8c05('0x5'));var path=require(_0x8c05('0x6'));var sox=require(_0x8c05('0x7'));var csv=require(_0x8c05('0x8'));var ejs=require(_0x8c05('0x9'));var fs=require('fs');var _=require(_0x8c05('0xa'));var squel=require(_0x8c05('0xb'));var crypto=require(_0x8c05('0xc'));var jsforce=require(_0x8c05('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x8c05('0x8'));var querystring=require('querystring');var Papa=require(_0x8c05('0xe'));var Redis=require(_0x8c05('0xf'));var authService=require(_0x8c05('0x10'));var qs=require(_0x8c05('0x11'));var as=require(_0x8c05('0x12'));var hardwareService=require(_0x8c05('0x13'));var logger=require('../../config/logger')(_0x8c05('0x14'));var utils=require('../../config/utils');var config=require('../../config/environment');var db=require(_0x8c05('0x15'))['db'];config['redis']=_[_0x8c05('0x16')](config[_0x8c05('0x17')],{'host':_0x8c05('0x18'),'port':0x18eb});var socket=require(_0x8c05('0x19'))(new Redis(config['redis']));require('./mailQueue.socket')[_0x8c05('0x1a')](socket);function respondWithStatusCode(_0x5007c0,_0x45acee){_0x45acee=_0x45acee||0xcc;return function(_0x3cf14c){if(_0x3cf14c){return _0x5007c0[_0x8c05('0x1b')](_0x45acee);}return _0x5007c0['status'](_0x45acee)[_0x8c05('0x1c')]();};}function respondWithResult(_0x196940,_0x14e713){_0x14e713=_0x14e713||0xc8;return function(_0x2d4d61){if(_0x2d4d61){return _0x196940[_0x8c05('0x1d')](_0x14e713)[_0x8c05('0x1e')](_0x2d4d61);}};}function respondWithFilteredResult(_0x50f590,_0x22bd50){return function(_0x4ea2dc){if(_0x4ea2dc){var _0x40d4d3=_0x4ea2dc['count'],_0x1a4b7b=_0x22bd50[_0x8c05('0x1f')],_0x2c4aa6=_0x22bd50[_0x8c05('0x1f')]+_0x22bd50[_0x8c05('0x20')],_0x37d507;if(_0x2c4aa6>=_0x40d4d3){_0x2c4aa6=_0x40d4d3;_0x37d507=0xc8;}else{_0x37d507=0xce;}_0x50f590[_0x8c05('0x1d')](_0x37d507);return _0x50f590['set'](_0x8c05('0x21'),_0x1a4b7b+'-'+_0x2c4aa6+'/'+_0x40d4d3)['json'](_0x4ea2dc);}return null;};}function patchUpdates(_0x1734e9){return function(_0x40f0f5){try{jsonpatch['apply'](_0x40f0f5,_0x1734e9,!![]);}catch(_0x19a764){return BPromise[_0x8c05('0x22')](_0x19a764);}return _0x40f0f5[_0x8c05('0x23')]();};}function saveUpdates(_0x53966b,_0x293f11){return function(_0x13999b){if(_0x13999b){return _0x13999b['update'](_0x53966b)[_0x8c05('0x24')](function(_0x37b412){return _0x37b412;});}return null;};}function removeEntity(_0x15a110,_0x5d8677){return function(_0x3a9b48){if(_0x3a9b48){return _0x3a9b48[_0x8c05('0x25')]()[_0x8c05('0x24')](function(){var _0x56de9d=_0x3a9b48[_0x8c05('0x26')]({'plain':!![]});var _0x457c67='MailQueues';return db[_0x8c05('0x27')][_0x8c05('0x25')]({'where':{'type':_0x457c67,'resourceId':_0x56de9d['id']}})['then'](function(){return _0x3a9b48;});})[_0x8c05('0x24')](function(){_0x15a110['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x1fb2d1,_0x1b1eb9){return function(_0x47134e){if(!_0x47134e){_0x1fb2d1[_0x8c05('0x1b')](0x194);}return _0x47134e;};}function handleError(_0x435672,_0x584633){_0x584633=_0x584633||0x1f4;return function(_0x2f5ffe){logger[_0x8c05('0x28')](_0x2f5ffe[_0x8c05('0x29')]);if(_0x2f5ffe['name']){delete _0x2f5ffe[_0x8c05('0x2a')];}_0x435672[_0x8c05('0x1d')](_0x584633)['send'](_0x2f5ffe);};}exports[_0x8c05('0x2b')]=function(_0x5a2e83,_0x28479c){var _0x270453={},_0x1fa584={},_0x1154f9={'count':0x0,'rows':[]};var _0x546388=_[_0x8c05('0x2c')](db[_0x8c05('0x2d')][_0x8c05('0x2e')],function(_0x360c02){return{'name':_0x360c02[_0x8c05('0x2f')],'type':_0x360c02['type'][_0x8c05('0x30')]};});_0x1fa584['model']=_[_0x8c05('0x2c')](_0x546388,_0x8c05('0x2a'));_0x1fa584[_0x8c05('0x31')]=_[_0x8c05('0x32')](_0x5a2e83['query']);_0x1fa584[_0x8c05('0x33')]=_[_0x8c05('0x34')](_0x1fa584[_0x8c05('0x35')],_0x1fa584[_0x8c05('0x31')]);_0x270453['attributes']=_[_0x8c05('0x34')](_0x1fa584['model'],qs[_0x8c05('0x36')](_0x5a2e83[_0x8c05('0x31')][_0x8c05('0x36')]));_0x270453[_0x8c05('0x37')]=_0x270453[_0x8c05('0x37')][_0x8c05('0x38')]?_0x270453[_0x8c05('0x37')]:_0x1fa584[_0x8c05('0x35')];if(!_0x5a2e83[_0x8c05('0x31')][_0x8c05('0x39')]('nolimit')){_0x270453[_0x8c05('0x20')]=qs[_0x8c05('0x20')](_0x5a2e83[_0x8c05('0x31')]['limit']);_0x270453[_0x8c05('0x1f')]=qs[_0x8c05('0x1f')](_0x5a2e83[_0x8c05('0x31')][_0x8c05('0x1f')]);}_0x270453[_0x8c05('0x3a')]=qs[_0x8c05('0x3b')](_0x5a2e83[_0x8c05('0x31')][_0x8c05('0x3b')]);_0x270453[_0x8c05('0x3c')]=qs[_0x8c05('0x33')](_[_0x8c05('0x3d')](_0x5a2e83[_0x8c05('0x31')],_0x1fa584['filters']),_0x546388);if(_0x5a2e83[_0x8c05('0x31')]['filter']){_0x270453['where']=_[_0x8c05('0x3e')](_0x270453[_0x8c05('0x3c')],{'$or':_[_0x8c05('0x2c')](_0x546388,function(_0x52fec5){if(_0x52fec5[_0x8c05('0x3f')]!==_0x8c05('0x40')){var _0xbaa7db={};_0xbaa7db[_0x52fec5['name']]={'$like':'%'+_0x5a2e83[_0x8c05('0x31')]['filter']+'%'};return _0xbaa7db;}})});}_0x270453=_[_0x8c05('0x3e')]({},_0x270453,_0x5a2e83[_0x8c05('0x41')]);var _0x483fa8={'where':_0x270453[_0x8c05('0x3c')]};return db['MailQueue'][_0x8c05('0x42')](_0x483fa8)[_0x8c05('0x24')](function(_0x1aaec9){_0x1154f9[_0x8c05('0x42')]=_0x1aaec9;if(_0x5a2e83[_0x8c05('0x31')][_0x8c05('0x43')]){_0x270453['include']=[{'all':!![]}];}return db['MailQueue'][_0x8c05('0x44')](_0x270453);})['then'](function(_0x46ea26){_0x1154f9[_0x8c05('0x45')]=_0x46ea26;return _0x1154f9;})[_0x8c05('0x24')](respondWithFilteredResult(_0x28479c,_0x270453))['catch'](handleError(_0x28479c,null));};exports['show']=function(_0x339da1,_0x24dd82){var _0x2f2ccf={'raw':!![],'where':{'id':_0x339da1['params']['id']}},_0x416cf2={};_0x416cf2['model']=_[_0x8c05('0x32')](db['MailQueue'][_0x8c05('0x2e')]);_0x416cf2[_0x8c05('0x31')]=_[_0x8c05('0x32')](_0x339da1[_0x8c05('0x31')]);_0x416cf2[_0x8c05('0x33')]=_['intersection'](_0x416cf2[_0x8c05('0x35')],_0x416cf2[_0x8c05('0x31')]);_0x2f2ccf[_0x8c05('0x37')]=_[_0x8c05('0x34')](_0x416cf2[_0x8c05('0x35')],qs[_0x8c05('0x36')](_0x339da1[_0x8c05('0x31')][_0x8c05('0x36')]));_0x2f2ccf[_0x8c05('0x37')]=_0x2f2ccf[_0x8c05('0x37')][_0x8c05('0x38')]?_0x2f2ccf[_0x8c05('0x37')]:_0x416cf2[_0x8c05('0x35')];if(_0x339da1[_0x8c05('0x31')][_0x8c05('0x43')]){_0x2f2ccf[_0x8c05('0x46')]=[{'all':!![]}];}_0x2f2ccf=_['merge']({},_0x2f2ccf,_0x339da1['options']);return db[_0x8c05('0x2d')][_0x8c05('0x47')](_0x2f2ccf)['then'](handleEntityNotFound(_0x24dd82,null))[_0x8c05('0x24')](respondWithResult(_0x24dd82,null))[_0x8c05('0x48')](handleError(_0x24dd82,null));};exports[_0x8c05('0x49')]=function(_0x10c640,_0xa4bf72){return db[_0x8c05('0x2d')]['create'](_0x10c640['body'],{})[_0x8c05('0x24')](function(_0x4e85d0){var _0x5ac89a=_0x10c640[_0x8c05('0x4a')][_0x8c05('0x26')]({'plain':!![]});if(!_0x5ac89a)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x5ac89a['role']==='user'){var _0x22ecf0=_0x4e85d0[_0x8c05('0x26')]({'plain':!![]});var _0x72196a=_0x8c05('0x4b');return db[_0x8c05('0x4c')][_0x8c05('0x47')]({'where':{'name':_0x72196a,'userProfileId':_0x5ac89a['userProfileId']},'raw':!![]})[_0x8c05('0x24')](function(_0x55fce8){if(_0x55fce8&&_0x55fce8[_0x8c05('0x4d')]===0x0){return db[_0x8c05('0x27')][_0x8c05('0x49')]({'name':_0x22ecf0['name'],'resourceId':_0x22ecf0['id'],'type':_0x55fce8[_0x8c05('0x2a')],'sectionId':_0x55fce8['id']},{})[_0x8c05('0x24')](function(){return _0x4e85d0;});}else{return _0x4e85d0;}})[_0x8c05('0x48')](function(_0x27c55f){logger[_0x8c05('0x28')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x27c55f);throw _0x27c55f;});}return _0x4e85d0;})[_0x8c05('0x24')](respondWithResult(_0xa4bf72,0xc9))['catch'](handleError(_0xa4bf72,null));};exports[_0x8c05('0x4e')]=function(_0x5750f5,_0x2f0b5a){if(_0x5750f5[_0x8c05('0x4f')]['id']){delete _0x5750f5[_0x8c05('0x4f')]['id'];}return db[_0x8c05('0x2d')][_0x8c05('0x47')]({'where':{'id':_0x5750f5[_0x8c05('0x50')]['id']}})[_0x8c05('0x24')](handleEntityNotFound(_0x2f0b5a,null))[_0x8c05('0x24')](saveUpdates(_0x5750f5[_0x8c05('0x4f')],null))[_0x8c05('0x24')](respondWithResult(_0x2f0b5a,null))[_0x8c05('0x48')](handleError(_0x2f0b5a,null));};exports[_0x8c05('0x25')]=function(_0x105f83,_0x462f0e){return db['MailQueue'][_0x8c05('0x47')]({'where':{'id':_0x105f83[_0x8c05('0x50')]['id']}})[_0x8c05('0x24')](handleEntityNotFound(_0x462f0e,null))['then'](removeEntity(_0x462f0e,null))[_0x8c05('0x48')](handleError(_0x462f0e,null));};exports[_0x8c05('0x51')]=function(_0x42cc4d,_0x4206fe){return db[_0x8c05('0x2d')][_0x8c05('0x51')]()[_0x8c05('0x24')](respondWithResult(_0x4206fe,null))[_0x8c05('0x48')](handleError(_0x4206fe,null));};exports[_0x8c05('0x52')]=function(_0x20ccfb,_0x3b93c0,_0x1e8c19){var _0xf838bd={'raw':!![],'where':{}},_0x1c9ddd={},_0x5bc4f5;return db[_0x8c05('0x2d')][_0x8c05('0x53')]({'where':{'id':_0x20ccfb['params']['id']}})['then'](handleEntityNotFound(_0x3b93c0,null))['then'](function(_0x5249cf){if(_0x5249cf){_0x5bc4f5=_0x5249cf[_0x8c05('0x26')]({'plain':!![]});_0x1c9ddd[_0x8c05('0x35')]=_[_0x8c05('0x32')](db[_0x8c05('0x54')][_0x8c05('0x2e')]);_0x1c9ddd[_0x8c05('0x31')]=_[_0x8c05('0x32')](_0x20ccfb['query']);_0x1c9ddd[_0x8c05('0x33')]=_['intersection'](_0x1c9ddd[_0x8c05('0x35')],_0x1c9ddd[_0x8c05('0x31')]);_0xf838bd['attributes']=_[_0x8c05('0x34')](_0x1c9ddd[_0x8c05('0x35')],qs['fields'](_0x20ccfb[_0x8c05('0x31')][_0x8c05('0x36')]));_0xf838bd[_0x8c05('0x37')]=_0xf838bd[_0x8c05('0x37')][_0x8c05('0x38')]?_0xf838bd[_0x8c05('0x37')]:_0x1c9ddd['model'];if(!_0x20ccfb[_0x8c05('0x31')][_0x8c05('0x39')](_0x8c05('0x55'))){_0xf838bd[_0x8c05('0x20')]=qs[_0x8c05('0x20')](_0x20ccfb['query'][_0x8c05('0x20')]);_0xf838bd[_0x8c05('0x1f')]=qs[_0x8c05('0x1f')](_0x20ccfb['query']['offset']);}_0xf838bd[_0x8c05('0x3a')]=qs[_0x8c05('0x3b')](_0x20ccfb[_0x8c05('0x31')][_0x8c05('0x3b')]);_0xf838bd[_0x8c05('0x3c')]=qs[_0x8c05('0x33')](_[_0x8c05('0x3d')](_0x20ccfb[_0x8c05('0x31')],_0x1c9ddd[_0x8c05('0x33')]));_0xf838bd[_0x8c05('0x3c')][_0x8c05('0x56')]=_0x5249cf['id'];if(_0x20ccfb[_0x8c05('0x31')][_0x8c05('0x57')]){_0xf838bd[_0x8c05('0x3c')]=_[_0x8c05('0x3e')](_0xf838bd[_0x8c05('0x3c')],{'$or':_['map'](_0xf838bd['attributes'],function(_0x228249){var _0x507a50={};_0x507a50[_0x228249]={'$like':'%'+_0x20ccfb['query'][_0x8c05('0x57')]+'%'};return _0x507a50;})});}_0xf838bd=_[_0x8c05('0x3e')]({},_0xf838bd,_0x20ccfb[_0x8c05('0x41')]);return db[_0x8c05('0x54')]['findAll'](_0xf838bd);}})[_0x8c05('0x24')](function(_0x4bbd84){if(_0x4bbd84){return db[_0x8c05('0x58')][_0x8c05('0x59')]({'where':{'id':_[_0x8c05('0x2c')](_0x4bbd84,_0x8c05('0x5a')),'role':'agent'},'attributes':['id','name',_0x8c05('0x5b'),_0x8c05('0x5c'),_0x8c05('0x5d')]});}})[_0x8c05('0x24')](function(_0x57fc33){if(_0x57fc33){return{'count':_0x57fc33[_0x8c05('0x42')],'rows':_[_0x8c05('0x2c')](_0x57fc33[_0x8c05('0x45')],function(_0x23b6d2){return{'membername':_0x23b6d2[_0x8c05('0x2a')],'UserId':_0x23b6d2['id'],'queue_name':_0x5bc4f5[_0x8c05('0x2a')],'MailQueueId':_0x5bc4f5['id'],'interface':util[_0x8c05('0x5e')]('%s/%s',_0x8c05('0x5f'),_0x23b6d2[_0x8c05('0x2a')]),'penalty':0x0,'paused':_0x23b6d2['mailPause'],'createdAt':_0x23b6d2['createdAt'],'updatedAt':_0x23b6d2['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x3b93c0,_0xf838bd))[_0x8c05('0x48')](handleError(_0x3b93c0,null));};exports['getTeams']=function(_0x39fc07,_0x4d5e50,_0x438215){var _0x41a042={};var _0x17dcab={};var _0x3cbb9c;var _0x33ac8d;return db[_0x8c05('0x2d')][_0x8c05('0x53')]({'where':{'id':_0x39fc07[_0x8c05('0x50')]['id']}})[_0x8c05('0x24')](handleEntityNotFound(_0x4d5e50,null))['then'](function(_0x4ddbdd){if(_0x4ddbdd){_0x3cbb9c=_0x4ddbdd;_0x17dcab[_0x8c05('0x35')]=_[_0x8c05('0x32')](db[_0x8c05('0x60')]['rawAttributes']);_0x17dcab[_0x8c05('0x31')]=_[_0x8c05('0x32')](_0x39fc07['query']);_0x17dcab[_0x8c05('0x33')]=_[_0x8c05('0x34')](_0x17dcab[_0x8c05('0x35')],_0x17dcab[_0x8c05('0x31')]);_0x41a042['attributes']=_[_0x8c05('0x34')](_0x17dcab[_0x8c05('0x35')],qs[_0x8c05('0x36')](_0x39fc07[_0x8c05('0x31')][_0x8c05('0x36')]));_0x41a042[_0x8c05('0x37')]=_0x41a042[_0x8c05('0x37')][_0x8c05('0x38')]?_0x41a042['attributes']:_0x17dcab[_0x8c05('0x35')];_0x41a042[_0x8c05('0x3a')]=qs['sort'](_0x39fc07[_0x8c05('0x31')]['sort']);_0x41a042['where']=qs[_0x8c05('0x33')](_[_0x8c05('0x3d')](_0x39fc07[_0x8c05('0x31')],_0x17dcab[_0x8c05('0x33')]));if(_0x39fc07['query'][_0x8c05('0x57')]){_0x41a042[_0x8c05('0x3c')]=_[_0x8c05('0x3e')](_0x41a042['where'],{'$or':_[_0x8c05('0x2c')](_0x41a042[_0x8c05('0x37')],function(_0x439afd){var _0x38c931={};_0x38c931[_0x439afd]={'$like':'%'+_0x39fc07[_0x8c05('0x31')]['filter']+'%'};return _0x38c931;})});}_0x41a042=_[_0x8c05('0x3e')]({},_0x41a042,_0x39fc07['options']);return _0x3cbb9c[_0x8c05('0x61')](_0x41a042);}})['then'](function(_0x3a7233){if(_0x3a7233){_0x33ac8d=_0x3a7233['length'];if(!_0x39fc07['query'][_0x8c05('0x39')](_0x8c05('0x55'))){_0x41a042[_0x8c05('0x20')]=qs[_0x8c05('0x20')](_0x39fc07[_0x8c05('0x31')]['limit']);_0x41a042[_0x8c05('0x1f')]=qs[_0x8c05('0x1f')](_0x39fc07[_0x8c05('0x31')]['offset']);}return _0x3cbb9c[_0x8c05('0x61')](_0x41a042);}})[_0x8c05('0x24')](function(_0x1f74fb){if(_0x1f74fb){return _0x1f74fb?{'count':_0x33ac8d,'rows':_0x1f74fb}:null;}})['then'](respondWithResult(_0x4d5e50,null))[_0x8c05('0x48')](handleError(_0x4d5e50,null));};exports[_0x8c05('0x62')]=function(_0x212690,_0x38476e,_0x8c2de2){var _0xbf2861=_0x212690['body'][_0x8c05('0x63')];return db[_0x8c05('0x60')][_0x8c05('0x44')]({'where':{'id':_0xbf2861},'attributes':['id'],'include':[{'model':db[_0x8c05('0x58')],'as':_0x8c05('0x64'),'attributes':['id','name',_0x8c05('0x65'),_0x8c05('0x66'),_0x8c05('0x67')],'raw':!![]}]})['then'](function(_0x5200b0){if(_0x5200b0){var _0xbc32=_[_0x8c05('0x68')](_0x5200b0,function(_0x57b258){var _0x545682=_0x57b258[_0x8c05('0x26')]({'plain':!![]});return _0x545682[_0x8c05('0x64')];});return db[_0x8c05('0x2d')][_0x8c05('0x47')]({'where':{'id':_0x212690[_0x8c05('0x50')]['id']}})[_0x8c05('0x24')](function(_0x549cbc){return db['sequelize'][_0x8c05('0x69')](function(_0x48b3d3){return _0x549cbc[_0x8c05('0x62')](_0xbf2861,{'transaction':_0x48b3d3})['then'](function(){return BPromise['each'](_0xbc32,function(_0x496c66){return db[_0x8c05('0x54')][_0x8c05('0x6a')]({'where':{'UserId':_0x496c66['id'],'MailQueueId':_0x212690['params']['id']},'transaction':_0x48b3d3});});})[_0x8c05('0x24')](function(){_0xbc32[_0x8c05('0x6b')](function(_0x1e0534){socket[_0x8c05('0x6c')]('userMailQueue:save',{'UserId':_0x1e0534['id'],'MailQueueId':_0x549cbc['id']});});});});});}})[_0x8c05('0x24')](respondWithStatusCode(_0x38476e,null))[_0x8c05('0x48')](handleError(_0x38476e,null));};exports['removeTeams']=function(_0x5bdb11,_0x4015ba,_0x305d5f){return db['Team'][_0x8c05('0x44')]({'where':{'id':_0x5bdb11[_0x8c05('0x31')][_0x8c05('0x63')]},'attributes':['id'],'include':[{'model':db[_0x8c05('0x58')],'as':_0x8c05('0x64'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x4015ba,null))['then'](function(_0x3ec49b){var _0x114784=_[_0x8c05('0x2c')](_0x3ec49b,'id');var _0x1b7427=[];var _0x1a4a44=[];var _0x335de5=squel[_0x8c05('0x6d')]();_0x335de5[_0x8c05('0x6e')]('tq.TeamId')[_0x8c05('0x6f')](_0x8c05('0x70'),'tq')[_0x8c05('0x71')]('user_has_teams','ut',_0x8c05('0x72'))[_0x8c05('0x3c')](_0x8c05('0x73'),_0x5bdb11[_0x8c05('0x50')]['id']);for(var _0x1c3dad=0x0;_0x1c3dad<_0x3ec49b['length'];_0x1c3dad+=0x1){let _0x42b4f5=_0x3ec49b[_0x1c3dad];for(var _0x594f1c=0x0;_0x594f1c<_0x42b4f5['Agents']['length'];_0x594f1c+=0x1){let _0x329a5e=_0x42b4f5[_0x8c05('0x64')][_0x594f1c];var _0x830a45=_0x335de5[_0x8c05('0x74')]();_0x830a45['where'](_0x8c05('0x75'),_0x329a5e['id']);_0x1a4a44[_0x8c05('0x76')](db['sequelize'][_0x8c05('0x31')](_0x830a45[_0x8c05('0x77')](),{'type':db[_0x8c05('0x78')][_0x8c05('0x79')][_0x8c05('0x7a')]})[_0x8c05('0x24')](function(_0x2587e1){if(_0x2587e1[_0x8c05('0x38')]===0x1){return _0x329a5e['id'];}else{var _0x370e44=_[_0x8c05('0x7b')](_[_0x8c05('0x2c')](_0x2587e1,_0x8c05('0x7c')),function(_0x486bea){return _[_0x8c05('0x7d')](_0x114784,_0x486bea);});if(_0x370e44){return _0x329a5e['id'];}}}));}}return BPromise[_0x8c05('0x7e')](_0x1a4a44)['then'](function(_0xd6d312){_0x1b7427=_(_0x1b7427)[_0x8c05('0x7f')](_0xd6d312)[_0x8c05('0x80')]()['value']();return db[_0x8c05('0x2d')]['find']({'where':{'id':_0x5bdb11[_0x8c05('0x50')]['id']}})['then'](function(_0x4b46d0){return db[_0x8c05('0x78')]['transaction'](function(_0x369695){return _0x4b46d0['removeTeams'](_0x5bdb11[_0x8c05('0x31')][_0x8c05('0x63')],{'transaction':_0x369695})['then'](function(){if(!_[_0x8c05('0x81')](_0x1b7427)){return _0x4b46d0[_0x8c05('0x82')](_0x1b7427,{'transaction':_0x369695});}})[_0x8c05('0x24')](function(){_0x1b7427[_0x8c05('0x6b')](function(_0x37d108){socket[_0x8c05('0x6c')](_0x8c05('0x83'),{'UserId':_0x37d108,'MailQueueId':_0x4b46d0['id']});});});});});});})[_0x8c05('0x24')](respondWithStatusCode(_0x4015ba,null))['catch'](handleError(_0x4015ba,null));};exports[_0x8c05('0x84')]=function(_0x1526e3,_0x2abe3e,_0x4d68d2){return db[_0x8c05('0x2d')][_0x8c05('0x47')]({'where':{'id':_0x1526e3['params']['id']}})[_0x8c05('0x24')](handleEntityNotFound(_0x2abe3e,null))['then'](function(_0xa04a66){if(_0xa04a66){return _0xa04a66[_0x8c05('0x84')](_0x1526e3[_0x8c05('0x4f')]['ids'],_['omit'](_0x1526e3['body'],[_0x8c05('0x63'),'id'])||{})[_0x8c05('0x85')](function(_0x4175af){for(var _0x1dfecd=0x0;_0x1dfecd<_0x1526e3[_0x8c05('0x4f')][_0x8c05('0x63')][_0x8c05('0x38')];_0x1dfecd+=0x1){socket[_0x8c05('0x6c')](_0x8c05('0x86'),{'UserId':_0x1526e3[_0x8c05('0x4f')][_0x8c05('0x63')][_0x1dfecd],'MailQueueId':_0x1526e3[_0x8c05('0x50')]['id']});}return _0x4175af;});}})[_0x8c05('0x24')](respondWithResult(_0x2abe3e,null))[_0x8c05('0x48')](handleError(_0x2abe3e,null));};exports['removeAgents']=function(_0x46ab20,_0x517ca4,_0x3ab3ba){return db[_0x8c05('0x2d')][_0x8c05('0x47')]({'where':{'id':_0x46ab20[_0x8c05('0x50')]['id']}})[_0x8c05('0x24')](handleEntityNotFound(_0x517ca4,null))[_0x8c05('0x24')](function(_0x5063b5){if(_0x5063b5){return _0x5063b5[_0x8c05('0x82')](_0x46ab20[_0x8c05('0x31')][_0x8c05('0x63')])[_0x8c05('0x24')](function(){if(_[_0x8c05('0x87')](_0x46ab20['query'][_0x8c05('0x63')])){for(var _0x396907=0x0;_0x396907<_0x46ab20[_0x8c05('0x31')][_0x8c05('0x63')][_0x8c05('0x38')];_0x396907+=0x1){socket['emit'](_0x8c05('0x83'),{'UserId':Number(_0x46ab20['query'][_0x8c05('0x63')][_0x396907]),'MailQueueId':Number(_0x46ab20['params']['id'])});}}else{socket['emit']('userMailQueue:remove',{'UserId':Number(_0x46ab20[_0x8c05('0x31')]['ids']),'MailQueueId':Number(_0x46ab20[_0x8c05('0x50')]['id'])});}});}})[_0x8c05('0x24')](respondWithStatusCode(_0x517ca4,null))[_0x8c05('0x48')](handleError(_0x517ca4,null));};exports[_0x8c05('0x88')]=function(_0x527406,_0x4ce814,_0x19ef2e){var _0x82bce4={};var _0x1851e3={};var _0x5cfa13;var _0x366d3e;return db[_0x8c05('0x2d')][_0x8c05('0x53')]({'where':{'id':_0x527406['params']['id']}})['then'](handleEntityNotFound(_0x4ce814,null))[_0x8c05('0x24')](function(_0x1fff07){if(_0x1fff07){_0x5cfa13=_0x1fff07;_0x1851e3[_0x8c05('0x35')]=_[_0x8c05('0x32')](db[_0x8c05('0x58')][_0x8c05('0x2e')]);_0x1851e3['query']=_[_0x8c05('0x32')](_0x527406[_0x8c05('0x31')]);_0x1851e3[_0x8c05('0x33')]=_[_0x8c05('0x34')](_0x1851e3[_0x8c05('0x35')],_0x1851e3['query']);_0x82bce4[_0x8c05('0x37')]=_[_0x8c05('0x34')](_0x1851e3[_0x8c05('0x35')],qs[_0x8c05('0x36')](_0x527406['query'][_0x8c05('0x36')]));_0x82bce4[_0x8c05('0x37')]=_0x82bce4[_0x8c05('0x37')]['length']?_0x82bce4[_0x8c05('0x37')]:_0x1851e3[_0x8c05('0x35')];_0x82bce4[_0x8c05('0x3a')]=qs[_0x8c05('0x3b')](_0x527406[_0x8c05('0x31')][_0x8c05('0x3b')]);_0x82bce4['where']=qs[_0x8c05('0x33')](_[_0x8c05('0x3d')](_0x527406[_0x8c05('0x31')],_0x1851e3[_0x8c05('0x33')]));if(_0x527406[_0x8c05('0x31')]['filter']){_0x82bce4[_0x8c05('0x3c')]=_[_0x8c05('0x3e')](_0x82bce4[_0x8c05('0x3c')],{'$or':_[_0x8c05('0x2c')](_0x82bce4['attributes'],function(_0x383ca8){var _0x32fcfc={};_0x32fcfc[_0x383ca8]={'$like':'%'+_0x527406['query'][_0x8c05('0x57')]+'%'};return _0x32fcfc;})});}_0x82bce4=_[_0x8c05('0x3e')]({},_0x82bce4,_0x527406['options']);return _0x5cfa13[_0x8c05('0x88')](_0x82bce4);}})[_0x8c05('0x24')](function(_0x557635){if(_0x557635){_0x366d3e=_0x557635[_0x8c05('0x38')];if(!_0x527406[_0x8c05('0x31')]['hasOwnProperty']('nolimit')){_0x82bce4[_0x8c05('0x20')]=qs['limit'](_0x527406[_0x8c05('0x31')][_0x8c05('0x20')]);_0x82bce4['offset']=qs[_0x8c05('0x1f')](_0x527406[_0x8c05('0x31')][_0x8c05('0x1f')]);}return _0x5cfa13[_0x8c05('0x88')](_0x82bce4);}})[_0x8c05('0x24')](function(_0x3ce6c8){if(_0x3ce6c8){return _0x3ce6c8?{'count':_0x366d3e,'rows':_0x3ce6c8}:null;}})['then'](respondWithResult(_0x4ce814,null))['catch'](handleError(_0x4ce814,null));}; \ No newline at end of file +var _0x793e=['rows','catch','rawAttributes','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','body','params','describe','getMembers','findOne','UserMailQueue','findAndCountAll','UserId','agent','format','%s/%s','SIP','createdAt','Team','getTeams','addTeams','User','Agents','voicePause','flatMap','transaction','findOrCreate','emit','userMailQueue:save','removeTeams','ids','select','field','from','team_has_mail_queues','join','ut.TeamId\x20=\x20tq.TeamId','MailQueueId\x20=\x20?','ut.UserId\x20=\x20?','push','sequelize','toString','QueryTypes','SELECT','TeamId','includes','all','union','compact','value','isEmpty','removeAgents','addAgents','omit','spread','isArray','getAgents','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','lodash','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','register','sendStatus','status','count','offset','json','apply','update','destroy','then','get','MailQueues','UserProfileResource','end','error','stack','name','send','MailQueue','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','pick','filter','where','merge','type','options','includeAll','findAll'];(function(_0x5a0d88,_0x2b1805){var _0xb05271=function(_0x28ed36){while(--_0x28ed36){_0x5a0d88['push'](_0x5a0d88['shift']());}};_0xb05271(++_0x2b1805);}(_0x793e,0x13e));var _0xe793=function(_0x4070f8,_0x599ee1){_0x4070f8=_0x4070f8-0x0;var _0x4f1fa6=_0x793e[_0x4070f8];return _0x4f1fa6;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xe793('0x0'));var rimraf=require(_0xe793('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xe793('0x2'));var rp=require(_0xe793('0x3'));var moment=require(_0xe793('0x4'));var BPromise=require(_0xe793('0x5'));var Mustache=require(_0xe793('0x6'));var util=require(_0xe793('0x7'));var path=require(_0xe793('0x8'));var sox=require(_0xe793('0x9'));var csv=require(_0xe793('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xe793('0xb'));var squel=require('squel');var crypto=require(_0xe793('0xc'));var jsforce=require(_0xe793('0xd'));var deskjs=require(_0xe793('0xe'));var toCsv=require(_0xe793('0xa'));var querystring=require('querystring');var Papa=require(_0xe793('0xf'));var Redis=require('ioredis');var authService=require(_0xe793('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0xe793('0x11'));var hardwareService=require(_0xe793('0x12'));var logger=require('../../config/logger')(_0xe793('0x13'));var utils=require('../../config/utils');var config=require(_0xe793('0x14'));var db=require(_0xe793('0x15'))['db'];config['redis']=_['defaults'](config[_0xe793('0x16')],{'host':_0xe793('0x17'),'port':0x18eb});var socket=require(_0xe793('0x18'))(new Redis(config['redis']));require('./mailQueue.socket')[_0xe793('0x19')](socket);function respondWithStatusCode(_0x2f2762,_0xbd4fc0){_0xbd4fc0=_0xbd4fc0||0xcc;return function(_0x352835){if(_0x352835){return _0x2f2762[_0xe793('0x1a')](_0xbd4fc0);}return _0x2f2762[_0xe793('0x1b')](_0xbd4fc0)['end']();};}function respondWithResult(_0x1f2546,_0x5cb695){_0x5cb695=_0x5cb695||0xc8;return function(_0x44b47d){if(_0x44b47d){return _0x1f2546['status'](_0x5cb695)['json'](_0x44b47d);}};}function respondWithFilteredResult(_0x156d1f,_0x161b88){return function(_0x4d83f5){if(_0x4d83f5){var _0x5d268a=_0x4d83f5[_0xe793('0x1c')],_0x1fc24a=_0x161b88[_0xe793('0x1d')],_0x5420c4=_0x161b88['offset']+_0x161b88['limit'],_0x5a83da;if(_0x5420c4>=_0x5d268a){_0x5420c4=_0x5d268a;_0x5a83da=0xc8;}else{_0x5a83da=0xce;}_0x156d1f[_0xe793('0x1b')](_0x5a83da);return _0x156d1f['set']('Content-Range',_0x1fc24a+'-'+_0x5420c4+'/'+_0x5d268a)[_0xe793('0x1e')](_0x4d83f5);}return null;};}function patchUpdates(_0x4ffe43){return function(_0x275b0e){try{jsonpatch[_0xe793('0x1f')](_0x275b0e,_0x4ffe43,!![]);}catch(_0x2551aa){return BPromise['reject'](_0x2551aa);}return _0x275b0e['save']();};}function saveUpdates(_0x540606,_0x43ccc8){return function(_0x420c46){if(_0x420c46){return _0x420c46[_0xe793('0x20')](_0x540606)['then'](function(_0x43a1bb){return _0x43a1bb;});}return null;};}function removeEntity(_0x5ceb76,_0x21733d){return function(_0x31547c){if(_0x31547c){return _0x31547c[_0xe793('0x21')]()[_0xe793('0x22')](function(){var _0x30f166=_0x31547c[_0xe793('0x23')]({'plain':!![]});var _0x53e754=_0xe793('0x24');return db[_0xe793('0x25')][_0xe793('0x21')]({'where':{'type':_0x53e754,'resourceId':_0x30f166['id']}})['then'](function(){return _0x31547c;});})[_0xe793('0x22')](function(){_0x5ceb76['status'](0xcc)[_0xe793('0x26')]();});}};}function handleEntityNotFound(_0x5d16c2,_0x51517a){return function(_0x5ba827){if(!_0x5ba827){_0x5d16c2[_0xe793('0x1a')](0x194);}return _0x5ba827;};}function handleError(_0x10574e,_0x475584){_0x475584=_0x475584||0x1f4;return function(_0xfcb97d){logger[_0xe793('0x27')](_0xfcb97d[_0xe793('0x28')]);if(_0xfcb97d[_0xe793('0x29')]){delete _0xfcb97d[_0xe793('0x29')];}_0x10574e[_0xe793('0x1b')](_0x475584)[_0xe793('0x2a')](_0xfcb97d);};}exports['index']=function(_0x1ece33,_0x41b5fd){var _0x3ab31d={},_0x1ff051={},_0x39c383={'count':0x0,'rows':[]};var _0x19c207=_['map'](db[_0xe793('0x2b')]['rawAttributes'],function(_0x5aa9ad){return{'name':_0x5aa9ad['fieldName'],'type':_0x5aa9ad['type']['key']};});_0x1ff051[_0xe793('0x2c')]=_[_0xe793('0x2d')](_0x19c207,_0xe793('0x29'));_0x1ff051[_0xe793('0x2e')]=_[_0xe793('0x2f')](_0x1ece33[_0xe793('0x2e')]);_0x1ff051[_0xe793('0x30')]=_[_0xe793('0x31')](_0x1ff051[_0xe793('0x2c')],_0x1ff051['query']);_0x3ab31d[_0xe793('0x32')]=_[_0xe793('0x31')](_0x1ff051['model'],qs[_0xe793('0x33')](_0x1ece33[_0xe793('0x2e')][_0xe793('0x33')]));_0x3ab31d[_0xe793('0x32')]=_0x3ab31d['attributes'][_0xe793('0x34')]?_0x3ab31d[_0xe793('0x32')]:_0x1ff051[_0xe793('0x2c')];if(!_0x1ece33[_0xe793('0x2e')][_0xe793('0x35')](_0xe793('0x36'))){_0x3ab31d[_0xe793('0x37')]=qs['limit'](_0x1ece33[_0xe793('0x2e')][_0xe793('0x37')]);_0x3ab31d['offset']=qs['offset'](_0x1ece33[_0xe793('0x2e')][_0xe793('0x1d')]);}_0x3ab31d[_0xe793('0x38')]=qs[_0xe793('0x39')](_0x1ece33['query'][_0xe793('0x39')]);_0x3ab31d['where']=qs[_0xe793('0x30')](_[_0xe793('0x3a')](_0x1ece33['query'],_0x1ff051['filters']),_0x19c207);if(_0x1ece33['query'][_0xe793('0x3b')]){_0x3ab31d[_0xe793('0x3c')]=_[_0xe793('0x3d')](_0x3ab31d[_0xe793('0x3c')],{'$or':_[_0xe793('0x2d')](_0x19c207,function(_0x470638){if(_0x470638[_0xe793('0x3e')]!=='VIRTUAL'){var _0x320cd3={};_0x320cd3[_0x470638['name']]={'$like':'%'+_0x1ece33['query'][_0xe793('0x3b')]+'%'};return _0x320cd3;}})});}_0x3ab31d=_[_0xe793('0x3d')]({},_0x3ab31d,_0x1ece33[_0xe793('0x3f')]);var _0x32ced8={'where':_0x3ab31d[_0xe793('0x3c')]};return db[_0xe793('0x2b')][_0xe793('0x1c')](_0x32ced8)[_0xe793('0x22')](function(_0x45fccb){_0x39c383[_0xe793('0x1c')]=_0x45fccb;if(_0x1ece33[_0xe793('0x2e')][_0xe793('0x40')]){_0x3ab31d['include']=[{'all':!![]}];}return db['MailQueue'][_0xe793('0x41')](_0x3ab31d);})[_0xe793('0x22')](function(_0xd859cd){_0x39c383[_0xe793('0x42')]=_0xd859cd;return _0x39c383;})[_0xe793('0x22')](respondWithFilteredResult(_0x41b5fd,_0x3ab31d))[_0xe793('0x43')](handleError(_0x41b5fd,null));};exports['show']=function(_0x2c55a8,_0x4a187f){var _0x1c1dbf={'raw':!![],'where':{'id':_0x2c55a8['params']['id']}},_0x2a3fcc={};_0x2a3fcc['model']=_[_0xe793('0x2f')](db[_0xe793('0x2b')][_0xe793('0x44')]);_0x2a3fcc['query']=_[_0xe793('0x2f')](_0x2c55a8[_0xe793('0x2e')]);_0x2a3fcc['filters']=_[_0xe793('0x31')](_0x2a3fcc['model'],_0x2a3fcc[_0xe793('0x2e')]);_0x1c1dbf['attributes']=_[_0xe793('0x31')](_0x2a3fcc['model'],qs[_0xe793('0x33')](_0x2c55a8[_0xe793('0x2e')][_0xe793('0x33')]));_0x1c1dbf[_0xe793('0x32')]=_0x1c1dbf[_0xe793('0x32')][_0xe793('0x34')]?_0x1c1dbf[_0xe793('0x32')]:_0x2a3fcc[_0xe793('0x2c')];if(_0x2c55a8['query'][_0xe793('0x40')]){_0x1c1dbf['include']=[{'all':!![]}];}_0x1c1dbf=_[_0xe793('0x3d')]({},_0x1c1dbf,_0x2c55a8['options']);return db['MailQueue'][_0xe793('0x45')](_0x1c1dbf)['then'](handleEntityNotFound(_0x4a187f,null))['then'](respondWithResult(_0x4a187f,null))[_0xe793('0x43')](handleError(_0x4a187f,null));};exports[_0xe793('0x46')]=function(_0x50ccbf,_0x218a6c){return db[_0xe793('0x2b')][_0xe793('0x46')](_0x50ccbf['body'],{})['then'](function(_0x24ba8b){var _0x5b0369=_0x50ccbf[_0xe793('0x47')][_0xe793('0x23')]({'plain':!![]});if(!_0x5b0369)throw new Error(_0xe793('0x48'));if(_0x5b0369[_0xe793('0x49')]===_0xe793('0x47')){var _0x189c76=_0x24ba8b[_0xe793('0x23')]({'plain':!![]});var _0x10c1c2=_0xe793('0x24');return db[_0xe793('0x4a')][_0xe793('0x45')]({'where':{'name':_0x10c1c2,'userProfileId':_0x5b0369[_0xe793('0x4b')]},'raw':!![]})[_0xe793('0x22')](function(_0x4f2192){if(_0x4f2192&&_0x4f2192['autoAssociation']===0x0){return db[_0xe793('0x25')][_0xe793('0x46')]({'name':_0x189c76['name'],'resourceId':_0x189c76['id'],'type':_0x4f2192['name'],'sectionId':_0x4f2192['id']},{})[_0xe793('0x22')](function(){return _0x24ba8b;});}else{return _0x24ba8b;}})['catch'](function(_0x29fc72){logger[_0xe793('0x27')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x29fc72);throw _0x29fc72;});}return _0x24ba8b;})['then'](respondWithResult(_0x218a6c,0xc9))[_0xe793('0x43')](handleError(_0x218a6c,null));};exports['update']=function(_0x30f4f4,_0x2f7758){if(_0x30f4f4['body']['id']){delete _0x30f4f4[_0xe793('0x4c')]['id'];}return db['MailQueue']['find']({'where':{'id':_0x30f4f4[_0xe793('0x4d')]['id']}})[_0xe793('0x22')](handleEntityNotFound(_0x2f7758,null))[_0xe793('0x22')](saveUpdates(_0x30f4f4[_0xe793('0x4c')],null))[_0xe793('0x22')](respondWithResult(_0x2f7758,null))['catch'](handleError(_0x2f7758,null));};exports[_0xe793('0x21')]=function(_0x13df16,_0x3b604f){return db[_0xe793('0x2b')][_0xe793('0x45')]({'where':{'id':_0x13df16[_0xe793('0x4d')]['id']}})[_0xe793('0x22')](handleEntityNotFound(_0x3b604f,null))[_0xe793('0x22')](removeEntity(_0x3b604f,null))['catch'](handleError(_0x3b604f,null));};exports[_0xe793('0x4e')]=function(_0x1cf715,_0x2a3970){return db[_0xe793('0x2b')][_0xe793('0x4e')]()[_0xe793('0x22')](respondWithResult(_0x2a3970,null))[_0xe793('0x43')](handleError(_0x2a3970,null));};exports[_0xe793('0x4f')]=function(_0x1b96af,_0x5c58ba,_0x2b6c67){var _0x4415ad={'raw':!![],'where':{}},_0x3f49c1={},_0x27a0fe;return db[_0xe793('0x2b')][_0xe793('0x50')]({'where':{'id':_0x1b96af[_0xe793('0x4d')]['id']}})[_0xe793('0x22')](handleEntityNotFound(_0x5c58ba,null))[_0xe793('0x22')](function(_0xd690a1){if(_0xd690a1){_0x27a0fe=_0xd690a1[_0xe793('0x23')]({'plain':!![]});_0x3f49c1[_0xe793('0x2c')]=_[_0xe793('0x2f')](db[_0xe793('0x51')][_0xe793('0x44')]);_0x3f49c1[_0xe793('0x2e')]=_[_0xe793('0x2f')](_0x1b96af[_0xe793('0x2e')]);_0x3f49c1[_0xe793('0x30')]=_[_0xe793('0x31')](_0x3f49c1[_0xe793('0x2c')],_0x3f49c1[_0xe793('0x2e')]);_0x4415ad[_0xe793('0x32')]=_[_0xe793('0x31')](_0x3f49c1[_0xe793('0x2c')],qs[_0xe793('0x33')](_0x1b96af[_0xe793('0x2e')][_0xe793('0x33')]));_0x4415ad[_0xe793('0x32')]=_0x4415ad[_0xe793('0x32')][_0xe793('0x34')]?_0x4415ad[_0xe793('0x32')]:_0x3f49c1[_0xe793('0x2c')];if(!_0x1b96af['query'][_0xe793('0x35')](_0xe793('0x36'))){_0x4415ad[_0xe793('0x37')]=qs[_0xe793('0x37')](_0x1b96af[_0xe793('0x2e')][_0xe793('0x37')]);_0x4415ad[_0xe793('0x1d')]=qs[_0xe793('0x1d')](_0x1b96af['query'][_0xe793('0x1d')]);}_0x4415ad[_0xe793('0x38')]=qs[_0xe793('0x39')](_0x1b96af[_0xe793('0x2e')]['sort']);_0x4415ad[_0xe793('0x3c')]=qs[_0xe793('0x30')](_[_0xe793('0x3a')](_0x1b96af[_0xe793('0x2e')],_0x3f49c1[_0xe793('0x30')]));_0x4415ad[_0xe793('0x3c')]['MailQueueId']=_0xd690a1['id'];if(_0x1b96af[_0xe793('0x2e')][_0xe793('0x3b')]){_0x4415ad['where']=_[_0xe793('0x3d')](_0x4415ad[_0xe793('0x3c')],{'$or':_['map'](_0x4415ad[_0xe793('0x32')],function(_0x476847){var _0xb85ca3={};_0xb85ca3[_0x476847]={'$like':'%'+_0x1b96af['query'][_0xe793('0x3b')]+'%'};return _0xb85ca3;})});}_0x4415ad=_[_0xe793('0x3d')]({},_0x4415ad,_0x1b96af[_0xe793('0x3f')]);return db[_0xe793('0x51')][_0xe793('0x41')](_0x4415ad);}})['then'](function(_0x71df4e){if(_0x71df4e){return db['User'][_0xe793('0x52')]({'where':{'id':_[_0xe793('0x2d')](_0x71df4e,_0xe793('0x53')),'role':_0xe793('0x54')},'attributes':['id',_0xe793('0x29'),'mailPause','updatedAt','createdAt']});}})[_0xe793('0x22')](function(_0x1fbc76){if(_0x1fbc76){return{'count':_0x1fbc76[_0xe793('0x1c')],'rows':_['map'](_0x1fbc76['rows'],function(_0x247486){return{'membername':_0x247486['name'],'UserId':_0x247486['id'],'queue_name':_0x27a0fe['name'],'MailQueueId':_0x27a0fe['id'],'interface':util[_0xe793('0x55')](_0xe793('0x56'),_0xe793('0x57'),_0x247486[_0xe793('0x29')]),'penalty':0x0,'paused':_0x247486['mailPause'],'createdAt':_0x247486[_0xe793('0x58')],'updatedAt':_0x247486['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})[_0xe793('0x22')](respondWithFilteredResult(_0x5c58ba,_0x4415ad))[_0xe793('0x43')](handleError(_0x5c58ba,null));};exports['getTeams']=function(_0x3a2e22,_0x5f5d82,_0x11bb7e){var _0x41ec46={};var _0x481090={};var _0x429fac;var _0x3b3064;return db['MailQueue'][_0xe793('0x50')]({'where':{'id':_0x3a2e22['params']['id']}})[_0xe793('0x22')](handleEntityNotFound(_0x5f5d82,null))[_0xe793('0x22')](function(_0x289dfa){if(_0x289dfa){_0x429fac=_0x289dfa;_0x481090[_0xe793('0x2c')]=_[_0xe793('0x2f')](db[_0xe793('0x59')][_0xe793('0x44')]);_0x481090[_0xe793('0x2e')]=_[_0xe793('0x2f')](_0x3a2e22['query']);_0x481090['filters']=_[_0xe793('0x31')](_0x481090['model'],_0x481090[_0xe793('0x2e')]);_0x41ec46[_0xe793('0x32')]=_[_0xe793('0x31')](_0x481090['model'],qs['fields'](_0x3a2e22[_0xe793('0x2e')][_0xe793('0x33')]));_0x41ec46[_0xe793('0x32')]=_0x41ec46[_0xe793('0x32')][_0xe793('0x34')]?_0x41ec46['attributes']:_0x481090[_0xe793('0x2c')];_0x41ec46[_0xe793('0x38')]=qs[_0xe793('0x39')](_0x3a2e22[_0xe793('0x2e')][_0xe793('0x39')]);_0x41ec46['where']=qs['filters'](_['pick'](_0x3a2e22[_0xe793('0x2e')],_0x481090[_0xe793('0x30')]));if(_0x3a2e22[_0xe793('0x2e')][_0xe793('0x3b')]){_0x41ec46[_0xe793('0x3c')]=_[_0xe793('0x3d')](_0x41ec46['where'],{'$or':_[_0xe793('0x2d')](_0x41ec46['attributes'],function(_0x155c78){var _0x1f5ef9={};_0x1f5ef9[_0x155c78]={'$like':'%'+_0x3a2e22[_0xe793('0x2e')]['filter']+'%'};return _0x1f5ef9;})});}_0x41ec46=_[_0xe793('0x3d')]({},_0x41ec46,_0x3a2e22[_0xe793('0x3f')]);return _0x429fac['getTeams'](_0x41ec46);}})[_0xe793('0x22')](function(_0x4edaf4){if(_0x4edaf4){_0x3b3064=_0x4edaf4[_0xe793('0x34')];if(!_0x3a2e22['query']['hasOwnProperty'](_0xe793('0x36'))){_0x41ec46[_0xe793('0x37')]=qs[_0xe793('0x37')](_0x3a2e22[_0xe793('0x2e')]['limit']);_0x41ec46['offset']=qs[_0xe793('0x1d')](_0x3a2e22[_0xe793('0x2e')][_0xe793('0x1d')]);}return _0x429fac[_0xe793('0x5a')](_0x41ec46);}})['then'](function(_0x1ef4fd){if(_0x1ef4fd){return _0x1ef4fd?{'count':_0x3b3064,'rows':_0x1ef4fd}:null;}})[_0xe793('0x22')](respondWithResult(_0x5f5d82,null))[_0xe793('0x43')](handleError(_0x5f5d82,null));};exports[_0xe793('0x5b')]=function(_0x215ef5,_0x1a730b,_0x551dc8){var _0x481e41=_0x215ef5['body']['ids'];return db[_0xe793('0x59')][_0xe793('0x41')]({'where':{'id':_0x481e41},'attributes':['id'],'include':[{'model':db[_0xe793('0x5c')],'as':_0xe793('0x5d'),'attributes':['id',_0xe793('0x29'),'online',_0xe793('0x5e'),'interface'],'raw':!![]}]})[_0xe793('0x22')](function(_0x4fa725){if(_0x4fa725){var _0x2bd932=_[_0xe793('0x5f')](_0x4fa725,function(_0x3fe7cd){var _0x2c6bb0=_0x3fe7cd['get']({'plain':!![]});return _0x2c6bb0[_0xe793('0x5d')];});return db[_0xe793('0x2b')]['find']({'where':{'id':_0x215ef5['params']['id']}})[_0xe793('0x22')](function(_0xfd0b84){return db['sequelize'][_0xe793('0x60')](function(_0x218fcb){return _0xfd0b84[_0xe793('0x5b')](_0x481e41,{'transaction':_0x218fcb})[_0xe793('0x22')](function(){return BPromise['each'](_0x2bd932,function(_0x1c0b3a){return db[_0xe793('0x51')][_0xe793('0x61')]({'where':{'UserId':_0x1c0b3a['id'],'MailQueueId':_0x215ef5['params']['id']},'transaction':_0x218fcb});});})[_0xe793('0x22')](function(){_0x2bd932['forEach'](function(_0x8df66e){socket[_0xe793('0x62')](_0xe793('0x63'),{'UserId':_0x8df66e['id'],'MailQueueId':_0xfd0b84['id']});});});});});}})[_0xe793('0x22')](respondWithStatusCode(_0x1a730b,null))[_0xe793('0x43')](handleError(_0x1a730b,null));};exports[_0xe793('0x64')]=function(_0x32e914,_0x326f9a,_0x532125){return db['Team'][_0xe793('0x41')]({'where':{'id':_0x32e914['query'][_0xe793('0x65')]},'attributes':['id'],'include':[{'model':db[_0xe793('0x5c')],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0xe793('0x22')](handleEntityNotFound(_0x326f9a,null))[_0xe793('0x22')](function(_0x32d3ea){var _0x6c4f99=_[_0xe793('0x2d')](_0x32d3ea,'id');var _0x1cf966=[];var _0x12d639=[];var _0x38620f=squel[_0xe793('0x66')]();_0x38620f[_0xe793('0x67')]('tq.TeamId')[_0xe793('0x68')](_0xe793('0x69'),'tq')[_0xe793('0x6a')]('user_has_teams','ut',_0xe793('0x6b'))['where'](_0xe793('0x6c'),_0x32e914[_0xe793('0x4d')]['id']);for(var _0x28d9f5=0x0;_0x28d9f5<_0x32d3ea['length'];_0x28d9f5+=0x1){let _0x351350=_0x32d3ea[_0x28d9f5];for(var _0x4b1b42=0x0;_0x4b1b42<_0x351350['Agents'][_0xe793('0x34')];_0x4b1b42+=0x1){let _0x16ae79=_0x351350['Agents'][_0x4b1b42];var _0x75f8ae=_0x38620f['clone']();_0x75f8ae[_0xe793('0x3c')](_0xe793('0x6d'),_0x16ae79['id']);_0x12d639[_0xe793('0x6e')](db[_0xe793('0x6f')][_0xe793('0x2e')](_0x75f8ae[_0xe793('0x70')](),{'type':db[_0xe793('0x6f')][_0xe793('0x71')][_0xe793('0x72')]})[_0xe793('0x22')](function(_0x2042bd){if(_0x2042bd[_0xe793('0x34')]===0x1){return _0x16ae79['id'];}else{var _0x9192d4=_['every'](_[_0xe793('0x2d')](_0x2042bd,_0xe793('0x73')),function(_0x5f5a97){return _[_0xe793('0x74')](_0x6c4f99,_0x5f5a97);});if(_0x9192d4){return _0x16ae79['id'];}}}));}}return BPromise[_0xe793('0x75')](_0x12d639)[_0xe793('0x22')](function(_0xaddd01){_0x1cf966=_(_0x1cf966)[_0xe793('0x76')](_0xaddd01)[_0xe793('0x77')]()[_0xe793('0x78')]();return db[_0xe793('0x2b')][_0xe793('0x45')]({'where':{'id':_0x32e914['params']['id']}})[_0xe793('0x22')](function(_0xd32706){return db[_0xe793('0x6f')]['transaction'](function(_0x5b8ad7){return _0xd32706['removeTeams'](_0x32e914[_0xe793('0x2e')][_0xe793('0x65')],{'transaction':_0x5b8ad7})[_0xe793('0x22')](function(){if(!_[_0xe793('0x79')](_0x1cf966)){return _0xd32706[_0xe793('0x7a')](_0x1cf966,{'transaction':_0x5b8ad7});}})[_0xe793('0x22')](function(){_0x1cf966['forEach'](function(_0x1dc85a){socket[_0xe793('0x62')]('userMailQueue:remove',{'UserId':_0x1dc85a,'MailQueueId':_0xd32706['id']});});});});});});})[_0xe793('0x22')](respondWithStatusCode(_0x326f9a,null))[_0xe793('0x43')](handleError(_0x326f9a,null));};exports['addAgents']=function(_0x116992,_0x1560ff,_0x5b11e3){return db['MailQueue'][_0xe793('0x45')]({'where':{'id':_0x116992[_0xe793('0x4d')]['id']}})['then'](handleEntityNotFound(_0x1560ff,null))['then'](function(_0x1dd0e4){if(_0x1dd0e4){return _0x1dd0e4[_0xe793('0x7b')](_0x116992['body']['ids'],_[_0xe793('0x7c')](_0x116992[_0xe793('0x4c')],[_0xe793('0x65'),'id'])||{})[_0xe793('0x7d')](function(_0xe03759){for(var _0x59eb16=0x0;_0x59eb16<_0x116992[_0xe793('0x4c')][_0xe793('0x65')][_0xe793('0x34')];_0x59eb16+=0x1){socket[_0xe793('0x62')](_0xe793('0x63'),{'UserId':_0x116992[_0xe793('0x4c')]['ids'][_0x59eb16],'MailQueueId':_0x116992['params']['id']});}return _0xe03759;});}})[_0xe793('0x22')](respondWithResult(_0x1560ff,null))['catch'](handleError(_0x1560ff,null));};exports[_0xe793('0x7a')]=function(_0x4f5681,_0x238383,_0x5da35f){return db[_0xe793('0x2b')][_0xe793('0x45')]({'where':{'id':_0x4f5681[_0xe793('0x4d')]['id']}})[_0xe793('0x22')](handleEntityNotFound(_0x238383,null))[_0xe793('0x22')](function(_0xa5505f){if(_0xa5505f){return _0xa5505f['removeAgents'](_0x4f5681[_0xe793('0x2e')][_0xe793('0x65')])[_0xe793('0x22')](function(){if(_[_0xe793('0x7e')](_0x4f5681[_0xe793('0x2e')][_0xe793('0x65')])){for(var _0x2aa911=0x0;_0x2aa911<_0x4f5681[_0xe793('0x2e')][_0xe793('0x65')][_0xe793('0x34')];_0x2aa911+=0x1){socket[_0xe793('0x62')]('userMailQueue:remove',{'UserId':Number(_0x4f5681[_0xe793('0x2e')][_0xe793('0x65')][_0x2aa911]),'MailQueueId':Number(_0x4f5681[_0xe793('0x4d')]['id'])});}}else{socket[_0xe793('0x62')]('userMailQueue:remove',{'UserId':Number(_0x4f5681['query'][_0xe793('0x65')]),'MailQueueId':Number(_0x4f5681[_0xe793('0x4d')]['id'])});}});}})['then'](respondWithStatusCode(_0x238383,null))[_0xe793('0x43')](handleError(_0x238383,null));};exports['getAgents']=function(_0x46d2c7,_0x3502a0,_0x469837){var _0x4a74c3={};var _0x30f3d1={};var _0xe0e44a;var _0x3a46b8;return db[_0xe793('0x2b')][_0xe793('0x50')]({'where':{'id':_0x46d2c7[_0xe793('0x4d')]['id']}})[_0xe793('0x22')](handleEntityNotFound(_0x3502a0,null))[_0xe793('0x22')](function(_0x3a07d0){if(_0x3a07d0){_0xe0e44a=_0x3a07d0;_0x30f3d1[_0xe793('0x2c')]=_[_0xe793('0x2f')](db[_0xe793('0x5c')][_0xe793('0x44')]);_0x30f3d1[_0xe793('0x2e')]=_[_0xe793('0x2f')](_0x46d2c7[_0xe793('0x2e')]);_0x30f3d1[_0xe793('0x30')]=_['intersection'](_0x30f3d1[_0xe793('0x2c')],_0x30f3d1[_0xe793('0x2e')]);_0x4a74c3[_0xe793('0x32')]=_[_0xe793('0x31')](_0x30f3d1['model'],qs[_0xe793('0x33')](_0x46d2c7[_0xe793('0x2e')][_0xe793('0x33')]));_0x4a74c3[_0xe793('0x32')]=_0x4a74c3[_0xe793('0x32')]['length']?_0x4a74c3['attributes']:_0x30f3d1[_0xe793('0x2c')];_0x4a74c3[_0xe793('0x38')]=qs[_0xe793('0x39')](_0x46d2c7[_0xe793('0x2e')]['sort']);_0x4a74c3[_0xe793('0x3c')]=qs['filters'](_['pick'](_0x46d2c7[_0xe793('0x2e')],_0x30f3d1[_0xe793('0x30')]));if(_0x46d2c7['query'][_0xe793('0x3b')]){_0x4a74c3[_0xe793('0x3c')]=_[_0xe793('0x3d')](_0x4a74c3[_0xe793('0x3c')],{'$or':_['map'](_0x4a74c3[_0xe793('0x32')],function(_0x27725a){var _0x7fb2bb={};_0x7fb2bb[_0x27725a]={'$like':'%'+_0x46d2c7[_0xe793('0x2e')][_0xe793('0x3b')]+'%'};return _0x7fb2bb;})});}_0x4a74c3=_[_0xe793('0x3d')]({},_0x4a74c3,_0x46d2c7[_0xe793('0x3f')]);return _0xe0e44a[_0xe793('0x7f')](_0x4a74c3);}})[_0xe793('0x22')](function(_0x1d221d){if(_0x1d221d){_0x3a46b8=_0x1d221d[_0xe793('0x34')];if(!_0x46d2c7['query']['hasOwnProperty'](_0xe793('0x36'))){_0x4a74c3['limit']=qs[_0xe793('0x37')](_0x46d2c7['query'][_0xe793('0x37')]);_0x4a74c3[_0xe793('0x1d')]=qs[_0xe793('0x1d')](_0x46d2c7[_0xe793('0x2e')][_0xe793('0x1d')]);}return _0xe0e44a[_0xe793('0x7f')](_0x4a74c3);}})['then'](function(_0x494c4c){if(_0x494c4c){return _0x494c4c?{'count':_0x3a46b8,'rows':_0x494c4c}:null;}})['then'](respondWithResult(_0x3502a0,null))['catch'](handleError(_0x3502a0,null));}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.events.js b/server/api/mailQueue/mailQueue.events.js index 9f5b027..d6517d6 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 _0xe9cf=['save','update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','MailQueue'];(function(_0x1a481d,_0x936239){var _0x2d26c1=function(_0x42249c){while(--_0x42249c){_0x1a481d['push'](_0x1a481d['shift']());}};_0x2d26c1(++_0x936239);}(_0xe9cf,0x9d));var _0xfe9c=function(_0x1a30ea,_0x22bf39){_0x1a30ea=_0x1a30ea-0x0;var _0x36b8f2=_0xe9cf[_0x1a30ea];return _0x36b8f2;};'use strict';var EventEmitter=require(_0xfe9c('0x0'));var MailQueue=require(_0xfe9c('0x1'))['db'][_0xfe9c('0x2')];var MailQueueEvents=new EventEmitter();MailQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xfe9c('0x3'),'afterUpdate':_0xfe9c('0x4'),'afterDestroy':_0xfe9c('0x5')};function emitEvent(_0x1acf61){return function(_0x3825bf,_0x496309,_0x158984){MailQueueEvents[_0xfe9c('0x6')](_0x1acf61+':'+_0x3825bf['id'],_0x3825bf);MailQueueEvents[_0xfe9c('0x6')](_0x1acf61,_0x3825bf);_0x158984(null);};}for(var e in events){if(events[_0xfe9c('0x7')](e)){var event=events[e];MailQueue[_0xfe9c('0x8')](e,emitEvent(event));}}module[_0xfe9c('0x9')]=MailQueueEvents; \ No newline at end of file +var _0xc8ac=['exports','events','../../mysqldb','save','emit','hook'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0xc8ac,0xc1));var _0xcc8a=function(_0x163742,_0x467e36){_0x163742=_0x163742-0x0;var _0x1152ac=_0xc8ac[_0x163742];return _0x1152ac;};'use strict';var EventEmitter=require(_0xcc8a('0x0'));var MailQueue=require(_0xcc8a('0x1'))['db']['MailQueue'];var MailQueueEvents=new EventEmitter();MailQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xcc8a('0x2'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x46bdd9){return function(_0x1eba39,_0x22d493,_0x1c4e24){MailQueueEvents[_0xcc8a('0x3')](_0x46bdd9+':'+_0x1eba39['id'],_0x1eba39);MailQueueEvents[_0xcc8a('0x3')](_0x46bdd9,_0x1eba39);_0x1c4e24(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];MailQueue[_0xcc8a('0x4')](e,emitEvent(event));}}module[_0xcc8a('0x5')]=MailQueueEvents; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.model.js b/server/api/mailQueue/mailQueue.model.js index c3987d6..f4b8298 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 _0xf16e=['util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','MailQueue','mail_queues','lodash'];(function(_0xbcdc01,_0x43b911){var _0x2bd588=function(_0x5f03b7){while(--_0x5f03b7){_0xbcdc01['push'](_0xbcdc01['shift']());}};_0x2bd588(++_0x43b911);}(_0xf16e,0x137));var _0xef16=function(_0x38a7ac,_0x45514b){_0x38a7ac=_0x38a7ac-0x0;var _0x53061a=_0xf16e[_0x38a7ac];return _0x53061a;};'use strict';var _=require(_0xef16('0x0'));var util=require(_0xef16('0x1'));var logger=require(_0xef16('0x2'))('api');var moment=require(_0xef16('0x3'));var BPromise=require(_0xef16('0x4'));var rp=require(_0xef16('0x5'));var fs=require('fs');var path=require(_0xef16('0x6'));var rimraf=require(_0xef16('0x7'));var config=require(_0xef16('0x8'));var attributes=require('./mailQueue.attributes');module[_0xef16('0x9')]=function(_0x598217,_0x20bfa9){return _0x598217[_0xef16('0xa')](_0xef16('0xb'),attributes,{'tableName':_0xef16('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x65e6=['path','rimraf','../../config/environment','./mailQueue.attributes','mail_queues','util','api','bluebird','request-promise'];(function(_0x5678b5,_0x1c4aa8){var _0x4c09a5=function(_0x2aa89a){while(--_0x2aa89a){_0x5678b5['push'](_0x5678b5['shift']());}};_0x4c09a5(++_0x1c4aa8);}(_0x65e6,0x95));var _0x665e=function(_0x58ce95,_0x39c441){_0x58ce95=_0x58ce95-0x0;var _0x1a8d47=_0x65e6[_0x58ce95];return _0x1a8d47;};'use strict';var _=require('lodash');var util=require(_0x665e('0x0'));var logger=require('../../config/logger')(_0x665e('0x1'));var moment=require('moment');var BPromise=require(_0x665e('0x2'));var rp=require(_0x665e('0x3'));var fs=require('fs');var path=require(_0x665e('0x4'));var rimraf=require(_0x665e('0x5'));var config=require(_0x665e('0x6'));var attributes=require(_0x665e('0x7'));module['exports']=function(_0x1508c3,_0x26b375){return _0x1508c3['define']('MailQueue',attributes,{'tableName':_0x665e('0x8'),'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 6c67868..21883e7 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 _0x59af=['lodash','util','moment','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','./mailQueue.socket','register','request','info','MailQueue,\x20%s,\x20%s','request\x20sent','MailQueue,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','MailQueue','findAll','options','raw','where','attributes','limit','include','model','map','then','GetMailQueue','debug','ShowMailQueue','find'];(function(_0x5e8c7c,_0x3429c6){var _0x48f7bd=function(_0x2b8a0f){while(--_0x2b8a0f){_0x5e8c7c['push'](_0x5e8c7c['shift']());}};_0x48f7bd(++_0x3429c6);}(_0x59af,0x168));var _0xf59a=function(_0x505e5f,_0x476a91){_0x505e5f=_0x505e5f-0x0;var _0x4eb1fe=_0x59af[_0x505e5f];return _0x4eb1fe;};'use strict';var _=require(_0xf59a('0x0'));var util=require(_0xf59a('0x1'));var moment=require(_0xf59a('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xf59a('0x3'));var db=require(_0xf59a('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xf59a('0x5'))(_0xf59a('0x6'));var config=require(_0xf59a('0x7'));var jayson=require(_0xf59a('0x8'));var client=jayson[_0xf59a('0x9')][_0xf59a('0xa')]({'port':0x232a});config[_0xf59a('0xb')]=_[_0xf59a('0xc')](config[_0xf59a('0xb')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xf59a('0xb')]));require(_0xf59a('0xd'))[_0xf59a('0xe')](socket);function respondWithRpcPromise(_0x3e8dde,_0x31cf72,_0x32bbdc){return new BPromise(function(_0x1a7a07,_0xa07ad2){return client[_0xf59a('0xf')](_0x3e8dde,_0x32bbdc)['then'](function(_0x800767){logger[_0xf59a('0x10')](_0xf59a('0x11'),_0x31cf72,_0xf59a('0x12'));logger['debug'](_0xf59a('0x13'),_0x31cf72,_0xf59a('0x12'),JSON[_0xf59a('0x14')](_0x800767));if(_0x800767[_0xf59a('0x15')]){if(_0x800767[_0xf59a('0x15')]['code']===0x1f4){logger[_0xf59a('0x15')](_0xf59a('0x11'),_0x31cf72,_0x800767[_0xf59a('0x15')][_0xf59a('0x16')]);return _0xa07ad2(_0x800767[_0xf59a('0x15')][_0xf59a('0x16')]);}logger['error']('MailQueue,\x20%s,\x20%s',_0x31cf72,_0x800767['error'][_0xf59a('0x16')]);return _0x1a7a07(_0x800767[_0xf59a('0x15')][_0xf59a('0x16')]);}else{logger['info'](_0xf59a('0x11'),_0x31cf72,_0xf59a('0x12'));_0x1a7a07(_0x800767[_0xf59a('0x17')][_0xf59a('0x16')]);}})[_0xf59a('0x18')](function(_0x456702){logger[_0xf59a('0x15')](_0xf59a('0x11'),_0x31cf72,_0x456702);_0xa07ad2(_0x456702);});});}exports['GetMailQueue']=function(_0x32de76){var _0x504286=this;return new Promise(function(_0x1cdcef,_0x32d89c){return db[_0xf59a('0x19')][_0xf59a('0x1a')]({'raw':_0x32de76['options']?_0x32de76[_0xf59a('0x1b')][_0xf59a('0x1c')]===undefined?!![]:![]:!![],'where':_0x32de76[_0xf59a('0x1b')]?_0x32de76[_0xf59a('0x1b')][_0xf59a('0x1d')]||null:null,'attributes':_0x32de76['options']?_0x32de76['options'][_0xf59a('0x1e')]||null:null,'limit':_0x32de76[_0xf59a('0x1b')]?_0x32de76[_0xf59a('0x1b')][_0xf59a('0x1f')]||null:null,'include':_0x32de76[_0xf59a('0x1b')]?_0x32de76['options'][_0xf59a('0x20')]?_['map'](_0x32de76['options'][_0xf59a('0x20')],function(_0x42872a){return{'model':db[_0x42872a['model']],'as':_0x42872a['as'],'attributes':_0x42872a[_0xf59a('0x1e')],'include':_0x42872a[_0xf59a('0x20')]?_['map'](_0x42872a[_0xf59a('0x20')],function(_0x2e241a){return{'model':db[_0x2e241a[_0xf59a('0x21')]],'as':_0x2e241a['as'],'attributes':_0x2e241a[_0xf59a('0x1e')],'include':_0x2e241a[_0xf59a('0x20')]?_[_0xf59a('0x22')](_0x2e241a['include'],function(_0x583890){return{'model':db[_0x583890[_0xf59a('0x21')]],'as':_0x583890['as'],'attributes':_0x583890[_0xf59a('0x1e')]};}):[]};}):[]};}):[]:[]})[_0xf59a('0x23')](function(_0x575172){logger[_0xf59a('0x10')](_0xf59a('0x24'),_0x32de76);logger[_0xf59a('0x25')]('GetMailQueue',_0x32de76,JSON[_0xf59a('0x14')](_0x575172));_0x1cdcef(_0x575172);})['catch'](function(_0x1708fc){logger[_0xf59a('0x15')]('GetMailQueue',_0x1708fc['message'],_0x32de76);_0x32d89c(_0x504286[_0xf59a('0x15')](0x1f4,_0x1708fc['message']));});});};exports[_0xf59a('0x26')]=function(_0x205ff4){var _0x5652d1=this;return new Promise(function(_0x6c2015,_0x1c43b0){return db[_0xf59a('0x19')][_0xf59a('0x27')]({'raw':_0x205ff4[_0xf59a('0x1b')]?_0x205ff4['options'][_0xf59a('0x1c')]===undefined?!![]:![]:!![],'where':_0x205ff4['options']?_0x205ff4['options']['where']||null:null,'attributes':_0x205ff4[_0xf59a('0x1b')]?_0x205ff4['options'][_0xf59a('0x1e')]||null:null,'include':_0x205ff4[_0xf59a('0x1b')]?_0x205ff4[_0xf59a('0x1b')][_0xf59a('0x20')]?_['map'](_0x205ff4[_0xf59a('0x1b')][_0xf59a('0x20')],function(_0xfe811){return{'model':db[_0xfe811[_0xf59a('0x21')]],'as':_0xfe811['as'],'attributes':_0xfe811[_0xf59a('0x1e')],'include':_0xfe811[_0xf59a('0x20')]?_['map'](_0xfe811[_0xf59a('0x20')],function(_0x1462b8){return{'model':db[_0x1462b8[_0xf59a('0x21')]],'as':_0x1462b8['as'],'attributes':_0x1462b8['attributes'],'include':_0x1462b8[_0xf59a('0x20')]?_[_0xf59a('0x22')](_0x1462b8[_0xf59a('0x20')],function(_0xd9a90){return{'model':db[_0xd9a90[_0xf59a('0x21')]],'as':_0xd9a90['as'],'attributes':_0xd9a90[_0xf59a('0x1e')]};}):[]};}):[]};}):[]:[]})[_0xf59a('0x23')](function(_0x3d8ded){logger[_0xf59a('0x10')](_0xf59a('0x26'),_0x205ff4);logger['debug'](_0xf59a('0x26'),_0x205ff4,JSON[_0xf59a('0x14')](_0x3d8ded));_0x6c2015(_0x3d8ded);})[_0xf59a('0x18')](function(_0x4f9411){logger[_0xf59a('0x15')](_0xf59a('0x26'),_0x4f9411[_0xf59a('0x16')],_0x205ff4);_0x1c43b0(_0x5652d1[_0xf59a('0x15')](0x1f4,_0x4f9411[_0xf59a('0x16')]));});});}; \ No newline at end of file +var _0x1db0=['map','catch','ShowMailQueue','find','util','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','redis','defaults','localhost','./mailQueue.socket','register','then','MailQueue,\x20%s,\x20%s','debug','MailQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','GetMailQueue','MailQueue','options','raw','where','attributes','limit','include','model'];(function(_0x5d2803,_0xf375bd){var _0xdcad2c=function(_0x3c3a98){while(--_0x3c3a98){_0x5d2803['push'](_0x5d2803['shift']());}};_0xdcad2c(++_0xf375bd);}(_0x1db0,0x107));var _0x01db=function(_0x5377a1,_0x22e1e4){_0x5377a1=_0x5377a1-0x0;var _0x45ff6f=_0x1db0[_0x5377a1];return _0x45ff6f;};'use strict';var _=require('lodash');var util=require(_0x01db('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x01db('0x1'));var db=require(_0x01db('0x2'))['db'];var utils=require(_0x01db('0x3'));var logger=require(_0x01db('0x4'))(_0x01db('0x5'));var config=require('../../config/environment');var jayson=require(_0x01db('0x6'));var client=jayson[_0x01db('0x7')][_0x01db('0x8')]({'port':0x232a});config[_0x01db('0x9')]=_[_0x01db('0xa')](config[_0x01db('0x9')],{'host':_0x01db('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x01db('0x9')]));require(_0x01db('0xc'))[_0x01db('0xd')](socket);function respondWithRpcPromise(_0x26c340,_0x390865,_0x39e280){return new BPromise(function(_0x83ee42,_0x50a735){return client['request'](_0x26c340,_0x39e280)[_0x01db('0xe')](function(_0x3dfad0){logger['info'](_0x01db('0xf'),_0x390865,'request\x20sent');logger[_0x01db('0x10')](_0x01db('0x11'),_0x390865,_0x01db('0x12'),JSON[_0x01db('0x13')](_0x3dfad0));if(_0x3dfad0['error']){if(_0x3dfad0[_0x01db('0x14')][_0x01db('0x15')]===0x1f4){logger[_0x01db('0x14')](_0x01db('0xf'),_0x390865,_0x3dfad0[_0x01db('0x14')][_0x01db('0x16')]);return _0x50a735(_0x3dfad0[_0x01db('0x14')]['message']);}logger['error'](_0x01db('0xf'),_0x390865,_0x3dfad0[_0x01db('0x14')]['message']);return _0x83ee42(_0x3dfad0[_0x01db('0x14')][_0x01db('0x16')]);}else{logger[_0x01db('0x17')](_0x01db('0xf'),_0x390865,'request\x20sent');_0x83ee42(_0x3dfad0['result'][_0x01db('0x16')]);}})['catch'](function(_0x534d4f){logger['error'](_0x01db('0xf'),_0x390865,_0x534d4f);_0x50a735(_0x534d4f);});});}exports[_0x01db('0x18')]=function(_0x17300e){var _0x20858b=this;return new Promise(function(_0x2e59a3,_0x4c1aff){return db[_0x01db('0x19')]['findAll']({'raw':_0x17300e[_0x01db('0x1a')]?_0x17300e[_0x01db('0x1a')][_0x01db('0x1b')]===undefined?!![]:![]:!![],'where':_0x17300e['options']?_0x17300e[_0x01db('0x1a')][_0x01db('0x1c')]||null:null,'attributes':_0x17300e[_0x01db('0x1a')]?_0x17300e[_0x01db('0x1a')][_0x01db('0x1d')]||null:null,'limit':_0x17300e[_0x01db('0x1a')]?_0x17300e[_0x01db('0x1a')][_0x01db('0x1e')]||null:null,'include':_0x17300e[_0x01db('0x1a')]?_0x17300e['options'][_0x01db('0x1f')]?_['map'](_0x17300e[_0x01db('0x1a')][_0x01db('0x1f')],function(_0x319d3e){return{'model':db[_0x319d3e[_0x01db('0x20')]],'as':_0x319d3e['as'],'attributes':_0x319d3e[_0x01db('0x1d')],'include':_0x319d3e[_0x01db('0x1f')]?_[_0x01db('0x21')](_0x319d3e[_0x01db('0x1f')],function(_0x5dfdda){return{'model':db[_0x5dfdda[_0x01db('0x20')]],'as':_0x5dfdda['as'],'attributes':_0x5dfdda[_0x01db('0x1d')],'include':_0x5dfdda[_0x01db('0x1f')]?_[_0x01db('0x21')](_0x5dfdda['include'],function(_0x3959a8){return{'model':db[_0x3959a8[_0x01db('0x20')]],'as':_0x3959a8['as'],'attributes':_0x3959a8[_0x01db('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x01db('0xe')](function(_0x474c40){logger['info'](_0x01db('0x18'),_0x17300e);logger[_0x01db('0x10')]('GetMailQueue',_0x17300e,JSON['stringify'](_0x474c40));_0x2e59a3(_0x474c40);})[_0x01db('0x22')](function(_0x33d616){logger[_0x01db('0x14')]('GetMailQueue',_0x33d616[_0x01db('0x16')],_0x17300e);_0x4c1aff(_0x20858b[_0x01db('0x14')](0x1f4,_0x33d616[_0x01db('0x16')]));});});};exports[_0x01db('0x23')]=function(_0x4d806f){var _0x54430f=this;return new Promise(function(_0x391553,_0x1fcae8){return db[_0x01db('0x19')][_0x01db('0x24')]({'raw':_0x4d806f['options']?_0x4d806f['options'][_0x01db('0x1b')]===undefined?!![]:![]:!![],'where':_0x4d806f[_0x01db('0x1a')]?_0x4d806f[_0x01db('0x1a')][_0x01db('0x1c')]||null:null,'attributes':_0x4d806f[_0x01db('0x1a')]?_0x4d806f[_0x01db('0x1a')][_0x01db('0x1d')]||null:null,'include':_0x4d806f[_0x01db('0x1a')]?_0x4d806f[_0x01db('0x1a')][_0x01db('0x1f')]?_[_0x01db('0x21')](_0x4d806f[_0x01db('0x1a')][_0x01db('0x1f')],function(_0x5698b0){return{'model':db[_0x5698b0[_0x01db('0x20')]],'as':_0x5698b0['as'],'attributes':_0x5698b0[_0x01db('0x1d')],'include':_0x5698b0[_0x01db('0x1f')]?_[_0x01db('0x21')](_0x5698b0[_0x01db('0x1f')],function(_0x59c67f){return{'model':db[_0x59c67f[_0x01db('0x20')]],'as':_0x59c67f['as'],'attributes':_0x59c67f[_0x01db('0x1d')],'include':_0x59c67f[_0x01db('0x1f')]?_['map'](_0x59c67f['include'],function(_0x36a623){return{'model':db[_0x36a623[_0x01db('0x20')]],'as':_0x36a623['as'],'attributes':_0x36a623[_0x01db('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x01db('0xe')](function(_0x162b11){logger[_0x01db('0x17')](_0x01db('0x23'),_0x4d806f);logger['debug'](_0x01db('0x23'),_0x4d806f,JSON[_0x01db('0x13')](_0x162b11));_0x391553(_0x162b11);})[_0x01db('0x22')](function(_0x365396){logger[_0x01db('0x14')](_0x01db('0x23'),_0x365396['message'],_0x4d806f);_0x1fcae8(_0x54430f[_0x01db('0x14')](0x1f4,_0x365396['message']));});});}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.socket.js b/server/api/mailQueue/mailQueue.socket.js index e6c2964..b4872b0 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 _0xad4f=['register','length','mailQueue:','./mailQueue.events','save','remove','update','emit','removeListener'];(function(_0x4f3056,_0xe685f6){var _0x2b8af0=function(_0x3e04c2){while(--_0x3e04c2){_0x4f3056['push'](_0x4f3056['shift']());}};_0x2b8af0(++_0xe685f6);}(_0xad4f,0x123));var _0xfad4=function(_0x4fc9e6,_0xc51915){_0x4fc9e6=_0x4fc9e6-0x0;var _0x551d28=_0xad4f[_0x4fc9e6];return _0x551d28;};'use strict';var MailQueueEvents=require(_0xfad4('0x0'));var events=[_0xfad4('0x1'),_0xfad4('0x2'),_0xfad4('0x3')];function createListener(_0x40345e,_0x42c5ed){return function(_0x475760){_0x42c5ed[_0xfad4('0x4')](_0x40345e,_0x475760);};}function removeListener(_0x2acf02,_0x3dfc46){return function(){MailQueueEvents[_0xfad4('0x5')](_0x2acf02,_0x3dfc46);};}exports[_0xfad4('0x6')]=function(_0x32fa38){for(var _0x129c58=0x0,_0x2a5122=events[_0xfad4('0x7')];_0x129c58<_0x2a5122;_0x129c58++){var _0x2b0281=events[_0x129c58];var _0x3f0d25=createListener(_0xfad4('0x8')+_0x2b0281,_0x32fa38);MailQueueEvents['on'](_0x2b0281,_0x3f0d25);}}; \ No newline at end of file +var _0x697a=['length','./mailQueue.events','remove','update','register'];(function(_0x4292c1,_0x4c13a8){var _0x184785=function(_0x4b3ded){while(--_0x4b3ded){_0x4292c1['push'](_0x4292c1['shift']());}};_0x184785(++_0x4c13a8);}(_0x697a,0x123));var _0xa697=function(_0x373dee,_0x1a8c45){_0x373dee=_0x373dee-0x0;var _0x46798f=_0x697a[_0x373dee];return _0x46798f;};'use strict';var MailQueueEvents=require(_0xa697('0x0'));var events=['save',_0xa697('0x1'),_0xa697('0x2')];function createListener(_0x558668,_0x1bfe7d){return function(_0x2f4664){_0x1bfe7d['emit'](_0x558668,_0x2f4664);};}function removeListener(_0x1d18d7,_0x3ca944){return function(){MailQueueEvents['removeListener'](_0x1d18d7,_0x3ca944);};}exports[_0xa697('0x3')]=function(_0x4bf982){for(var _0x1eb651=0x0,_0x22f393=events[_0xa697('0x4')];_0x1eb651<_0x22f393;_0x1eb651++){var _0x2c733a=events[_0x1eb651];var _0xfd7c5a=createListener('mailQueue:'+_0x2c733a,_0x4bf982);MailQueueEvents['on'](_0x2c733a,_0xfd7c5a);}}; \ No newline at end of file diff --git a/server/api/mailQueueReport/index.js b/server/api/mailQueueReport/index.js index 52a9276..3e912f7 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 _0xd8b7=['index','describe','/:id','show','post','isAuthenticated','delete','destroy','exports','multer','util','connect-timeout','express','../../config/environment','get'];(function(_0x20ef64,_0x4a8fe9){var _0x3707d8=function(_0x5b9a88){while(--_0x5b9a88){_0x20ef64['push'](_0x20ef64['shift']());}};_0x3707d8(++_0x4a8fe9);}(_0xd8b7,0x1cb));var _0x7d8b=function(_0x3fe3bf,_0x245d02){_0x3fe3bf=_0x3fe3bf-0x0;var _0x4a8b92=_0xd8b7[_0x3fe3bf];return _0x4a8b92;};'use strict';var multer=require(_0x7d8b('0x0'));var util=require(_0x7d8b('0x1'));var path=require('path');var timeout=require(_0x7d8b('0x2'));var express=require(_0x7d8b('0x3'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x7d8b('0x4'));var controller=require('./mailQueueReport.controller');router[_0x7d8b('0x5')]('/',auth['isAuthenticated'](),controller[_0x7d8b('0x6')]);router[_0x7d8b('0x5')]('/describe',auth['isAuthenticated'](),controller[_0x7d8b('0x7')]);router[_0x7d8b('0x5')](_0x7d8b('0x8'),auth['isAuthenticated'](),controller[_0x7d8b('0x9')]);router[_0x7d8b('0xa')]('/',auth[_0x7d8b('0xb')](),controller['create']);router['put'](_0x7d8b('0x8'),auth[_0x7d8b('0xb')](),controller['update']);router[_0x7d8b('0xc')](_0x7d8b('0x8'),auth[_0x7d8b('0xb')](),controller[_0x7d8b('0xd')]);module[_0x7d8b('0xe')]=router; \ No newline at end of file +var _0xdd83=['create','put','/:id','update','delete','destroy','exports','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','get','/describe','describe','post'];(function(_0x50d2db,_0x47481f){var _0x1c7e27=function(_0x1f669d){while(--_0x1f669d){_0x50d2db['push'](_0x50d2db['shift']());}};_0x1c7e27(++_0x47481f);}(_0xdd83,0x1e7));var _0x3dd8=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0xdd83[_0xfae23b];return _0x200640;};'use strict';var multer=require(_0x3dd8('0x0'));var util=require(_0x3dd8('0x1'));var path=require(_0x3dd8('0x2'));var timeout=require(_0x3dd8('0x3'));var express=require(_0x3dd8('0x4'));var router=express['Router']();var auth=require(_0x3dd8('0x5'));var interaction=require(_0x3dd8('0x6'));var config=require(_0x3dd8('0x7'));var controller=require('./mailQueueReport.controller');router['get']('/',auth[_0x3dd8('0x8')](),controller['index']);router[_0x3dd8('0x9')](_0x3dd8('0xa'),auth['isAuthenticated'](),controller[_0x3dd8('0xb')]);router[_0x3dd8('0x9')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0x3dd8('0xc')]('/',auth[_0x3dd8('0x8')](),controller[_0x3dd8('0xd')]);router[_0x3dd8('0xe')](_0x3dd8('0xf'),auth[_0x3dd8('0x8')](),controller[_0x3dd8('0x10')]);router[_0x3dd8('0x11')]('/:id',auth[_0x3dd8('0x8')](),controller[_0x3dd8('0x12')]);module[_0x3dd8('0x13')]=router; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.attributes.js b/server/api/mailQueueReport/mailQueueReport.attributes.js index 09d6e78..5f8493e 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 _0xd6da=['DATE','STRING','moment','sequelize','exports'];(function(_0x588044,_0x107ad0){var _0x311f43=function(_0x42416d){while(--_0x42416d){_0x588044['push'](_0x588044['shift']());}};_0x311f43(++_0x107ad0);}(_0xd6da,0xcf));var _0xad6d=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xd6da[_0x3dd15e];return _0x231fd0;};'use strict';var moment=require(_0xad6d('0x0'));var Sequelize=require(_0xad6d('0x1'));module[_0xad6d('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0xad6d('0x3')]},'leaveAt':{'type':Sequelize[_0xad6d('0x3')]},'acceptAt':{'type':Sequelize[_0xad6d('0x3')]},'exitAt':{'type':Sequelize[_0xad6d('0x3')]},'reason':{'type':Sequelize[_0xad6d('0x4')]}}; \ No newline at end of file +var _0xe939=['DATE','moment','sequelize','exports','STRING'];(function(_0x5358cd,_0x293fd6){var _0xc144e2=function(_0x18c1fc){while(--_0x18c1fc){_0x5358cd['push'](_0x5358cd['shift']());}};_0xc144e2(++_0x293fd6);}(_0xe939,0xd8));var _0x9e93=function(_0x3bc414,_0x489e1c){_0x3bc414=_0x3bc414-0x0;var _0x24080d=_0xe939[_0x3bc414];return _0x24080d;};'use strict';var moment=require(_0x9e93('0x0'));var Sequelize=require(_0x9e93('0x1'));module[_0x9e93('0x2')]={'uniqueid':{'type':Sequelize[_0x9e93('0x3')],'allowNull':![]},'from':{'type':Sequelize[_0x9e93('0x3')]},'joinAt':{'type':Sequelize[_0x9e93('0x4')]},'leaveAt':{'type':Sequelize[_0x9e93('0x4')]},'acceptAt':{'type':Sequelize[_0x9e93('0x4')]},'exitAt':{'type':Sequelize['DATE']},'reason':{'type':Sequelize[_0x9e93('0x3')]}}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.controller.js b/server/api/mailQueueReport/mailQueueReport.controller.js index 70a6582..5a1651c 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 _0x0f5d=['squel','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','status','json','count','offset','set','Content-Range','apply','reject','save','update','destroy','then','end','sendStatus','error','stack','name','send','index','rawAttributes','type','key','model','keys','query','filters','intersection','attributes','fields','limit','order','where','merge','map','VIRTUAL','MailQueueReport','includeAll','findAll','rows','show','params','length','include','options','create','body','find','catch','describe','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','to-csv','lodash'];(function(_0x5575cd,_0x73ab7a){var _0x4979a0=function(_0x1ac744){while(--_0x1ac744){_0x5575cd['push'](_0x5575cd['shift']());}};_0x4979a0(++_0x73ab7a);}(_0x0f5d,0x166));var _0xd0f5=function(_0x4a1af2,_0x31131f){_0x4a1af2=_0x4a1af2-0x0;var _0x47dabc=_0x0f5d[_0x4a1af2];return _0x47dabc;};'use strict';var pdf=require(_0xd0f5('0x0'));var emlformat=require(_0xd0f5('0x1'));var rimraf=require(_0xd0f5('0x2'));var zipdir=require(_0xd0f5('0x3'));var jsonpatch=require(_0xd0f5('0x4'));var rp=require('request-promise');var moment=require(_0xd0f5('0x5'));var BPromise=require(_0xd0f5('0x6'));var Mustache=require(_0xd0f5('0x7'));var util=require(_0xd0f5('0x8'));var path=require(_0xd0f5('0x9'));var sox=require('sox');var csv=require(_0xd0f5('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xd0f5('0xb'));var squel=require(_0xd0f5('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xd0f5('0xd'));var toCsv=require('to-csv');var querystring=require(_0xd0f5('0xe'));var Papa=require(_0xd0f5('0xf'));var Redis=require(_0xd0f5('0x10'));var authService=require(_0xd0f5('0x11'));var qs=require(_0xd0f5('0x12'));var as=require(_0xd0f5('0x13'));var hardwareService=require(_0xd0f5('0x14'));var logger=require('../../config/logger')(_0xd0f5('0x15'));var utils=require(_0xd0f5('0x16'));var config=require(_0xd0f5('0x17'));var db=require(_0xd0f5('0x18'))['db'];function respondWithStatusCode(_0x4382bf,_0x3e7539){_0x3e7539=_0x3e7539||0xcc;return function(_0x313273){if(_0x313273){return _0x4382bf['sendStatus'](_0x3e7539);}return _0x4382bf[_0xd0f5('0x19')](_0x3e7539)['end']();};}function respondWithResult(_0x2e6410,_0xc39197){_0xc39197=_0xc39197||0xc8;return function(_0x2727e3){if(_0x2727e3){return _0x2e6410[_0xd0f5('0x19')](_0xc39197)[_0xd0f5('0x1a')](_0x2727e3);}};}function respondWithFilteredResult(_0x5282da,_0xdae4ad){return function(_0x459408){if(_0x459408){var _0x333f46=_0x459408[_0xd0f5('0x1b')],_0x576fb0=_0xdae4ad['offset'],_0x395163=_0xdae4ad[_0xd0f5('0x1c')]+_0xdae4ad['limit'],_0x61f1ff;if(_0x395163>=_0x333f46){_0x395163=_0x333f46;_0x61f1ff=0xc8;}else{_0x61f1ff=0xce;}_0x5282da[_0xd0f5('0x19')](_0x61f1ff);return _0x5282da[_0xd0f5('0x1d')](_0xd0f5('0x1e'),_0x576fb0+'-'+_0x395163+'/'+_0x333f46)[_0xd0f5('0x1a')](_0x459408);}return null;};}function patchUpdates(_0x1ca9ae){return function(_0x40edf1){try{jsonpatch[_0xd0f5('0x1f')](_0x40edf1,_0x1ca9ae,!![]);}catch(_0x5627a8){return BPromise[_0xd0f5('0x20')](_0x5627a8);}return _0x40edf1[_0xd0f5('0x21')]();};}function saveUpdates(_0x441b9b,_0x3161d1){return function(_0x4b2210){if(_0x4b2210){return _0x4b2210[_0xd0f5('0x22')](_0x441b9b)['then'](function(_0x1da7e7){return _0x1da7e7;});}return null;};}function removeEntity(_0x3f8abf,_0xbae3c8){return function(_0x36c2e6){if(_0x36c2e6){return _0x36c2e6[_0xd0f5('0x23')]()[_0xd0f5('0x24')](function(){_0x3f8abf[_0xd0f5('0x19')](0xcc)[_0xd0f5('0x25')]();});}};}function handleEntityNotFound(_0x1c5f1d,_0x2d80d8){return function(_0x8cbab8){if(!_0x8cbab8){_0x1c5f1d[_0xd0f5('0x26')](0x194);}return _0x8cbab8;};}function handleError(_0x16b235,_0x33a885){_0x33a885=_0x33a885||0x1f4;return function(_0x2dd96e){logger[_0xd0f5('0x27')](_0x2dd96e[_0xd0f5('0x28')]);if(_0x2dd96e[_0xd0f5('0x29')]){delete _0x2dd96e['name'];}_0x16b235[_0xd0f5('0x19')](_0x33a885)[_0xd0f5('0x2a')](_0x2dd96e);};}exports[_0xd0f5('0x2b')]=function(_0xc99007,_0x479a5d){var _0x399912={},_0x53bf8e={},_0xc080a={'count':0x0,'rows':[]};var _0x8832b6=_['map'](db['MailQueueReport'][_0xd0f5('0x2c')],function(_0xd9dc){return{'name':_0xd9dc['fieldName'],'type':_0xd9dc[_0xd0f5('0x2d')][_0xd0f5('0x2e')]};});_0x53bf8e[_0xd0f5('0x2f')]=_['map'](_0x8832b6,_0xd0f5('0x29'));_0x53bf8e['query']=_[_0xd0f5('0x30')](_0xc99007[_0xd0f5('0x31')]);_0x53bf8e[_0xd0f5('0x32')]=_[_0xd0f5('0x33')](_0x53bf8e[_0xd0f5('0x2f')],_0x53bf8e[_0xd0f5('0x31')]);_0x399912[_0xd0f5('0x34')]=_['intersection'](_0x53bf8e[_0xd0f5('0x2f')],qs[_0xd0f5('0x35')](_0xc99007[_0xd0f5('0x31')]['fields']));_0x399912[_0xd0f5('0x34')]=_0x399912[_0xd0f5('0x34')]['length']?_0x399912[_0xd0f5('0x34')]:_0x53bf8e[_0xd0f5('0x2f')];if(!_0xc99007['query']['hasOwnProperty']('nolimit')){_0x399912[_0xd0f5('0x36')]=qs[_0xd0f5('0x36')](_0xc99007[_0xd0f5('0x31')][_0xd0f5('0x36')]);_0x399912['offset']=qs[_0xd0f5('0x1c')](_0xc99007[_0xd0f5('0x31')][_0xd0f5('0x1c')]);}_0x399912[_0xd0f5('0x37')]=qs['sort'](_0xc99007[_0xd0f5('0x31')]['sort']);_0x399912[_0xd0f5('0x38')]=qs['filters'](_['pick'](_0xc99007['query'],_0x53bf8e['filters']),_0x8832b6);if(_0xc99007['query']['filter']){_0x399912['where']=_[_0xd0f5('0x39')](_0x399912[_0xd0f5('0x38')],{'$or':_[_0xd0f5('0x3a')](_0x8832b6,function(_0x5278e7){if(_0x5278e7[_0xd0f5('0x2d')]!==_0xd0f5('0x3b')){var _0xe6a524={};_0xe6a524[_0x5278e7[_0xd0f5('0x29')]]={'$like':'%'+_0xc99007[_0xd0f5('0x31')]['filter']+'%'};return _0xe6a524;}})});}_0x399912=_[_0xd0f5('0x39')]({},_0x399912,_0xc99007['options']);var _0x64c61f={'where':_0x399912[_0xd0f5('0x38')]};return db[_0xd0f5('0x3c')][_0xd0f5('0x1b')](_0x64c61f)[_0xd0f5('0x24')](function(_0x29c404){_0xc080a['count']=_0x29c404;if(_0xc99007[_0xd0f5('0x31')][_0xd0f5('0x3d')]){_0x399912['include']=[{'all':!![]}];}return db[_0xd0f5('0x3c')][_0xd0f5('0x3e')](_0x399912);})[_0xd0f5('0x24')](function(_0x370d3c){_0xc080a[_0xd0f5('0x3f')]=_0x370d3c;return _0xc080a;})[_0xd0f5('0x24')](respondWithFilteredResult(_0x479a5d,_0x399912))['catch'](handleError(_0x479a5d,null));};exports[_0xd0f5('0x40')]=function(_0x3d73c7,_0x2e3ca3){var _0x4e7fb0={'raw':!![],'where':{'id':_0x3d73c7[_0xd0f5('0x41')]['id']}},_0x49b183={};_0x49b183[_0xd0f5('0x2f')]=_['keys'](db[_0xd0f5('0x3c')][_0xd0f5('0x2c')]);_0x49b183['query']=_['keys'](_0x3d73c7['query']);_0x49b183[_0xd0f5('0x32')]=_[_0xd0f5('0x33')](_0x49b183['model'],_0x49b183[_0xd0f5('0x31')]);_0x4e7fb0[_0xd0f5('0x34')]=_['intersection'](_0x49b183[_0xd0f5('0x2f')],qs[_0xd0f5('0x35')](_0x3d73c7[_0xd0f5('0x31')]['fields']));_0x4e7fb0['attributes']=_0x4e7fb0[_0xd0f5('0x34')][_0xd0f5('0x42')]?_0x4e7fb0[_0xd0f5('0x34')]:_0x49b183[_0xd0f5('0x2f')];if(_0x3d73c7['query'][_0xd0f5('0x3d')]){_0x4e7fb0[_0xd0f5('0x43')]=[{'all':!![]}];}_0x4e7fb0=_[_0xd0f5('0x39')]({},_0x4e7fb0,_0x3d73c7[_0xd0f5('0x44')]);return db['MailQueueReport']['find'](_0x4e7fb0)[_0xd0f5('0x24')](handleEntityNotFound(_0x2e3ca3,null))[_0xd0f5('0x24')](respondWithResult(_0x2e3ca3,null))['catch'](handleError(_0x2e3ca3,null));};exports[_0xd0f5('0x45')]=function(_0x26d5fe,_0x231b3f){return db['MailQueueReport'][_0xd0f5('0x45')](_0x26d5fe['body'],{})[_0xd0f5('0x24')](respondWithResult(_0x231b3f,0xc9))['catch'](handleError(_0x231b3f,null));};exports[_0xd0f5('0x22')]=function(_0x534b4f,_0x6df035){if(_0x534b4f[_0xd0f5('0x46')]['id']){delete _0x534b4f[_0xd0f5('0x46')]['id'];}return db[_0xd0f5('0x3c')]['find']({'where':{'id':_0x534b4f[_0xd0f5('0x41')]['id']}})[_0xd0f5('0x24')](handleEntityNotFound(_0x6df035,null))['then'](saveUpdates(_0x534b4f[_0xd0f5('0x46')],null))[_0xd0f5('0x24')](respondWithResult(_0x6df035,null))['catch'](handleError(_0x6df035,null));};exports[_0xd0f5('0x23')]=function(_0x35a178,_0x5bfdf0){return db[_0xd0f5('0x3c')][_0xd0f5('0x47')]({'where':{'id':_0x35a178[_0xd0f5('0x41')]['id']}})[_0xd0f5('0x24')](handleEntityNotFound(_0x5bfdf0,null))['then'](removeEntity(_0x5bfdf0,null))[_0xd0f5('0x48')](handleError(_0x5bfdf0,null));};exports[_0xd0f5('0x49')]=function(_0x3f1b69,_0x283482){return db[_0xd0f5('0x3c')]['describe']()['then'](respondWithResult(_0x283482,null))[_0xd0f5('0x48')](handleError(_0x283482,null));}; \ No newline at end of file +var _0xfdb3=['desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','count','offset','limit','Content-Range','json','apply','reject','save','then','error','name','send','index','map','MailQueueReport','rawAttributes','fieldName','model','query','keys','filters','intersection','attributes','fields','length','order','where','pick','merge','type','VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','show','params','create','body','update','find','destroy','describe','html-pdf','eml-format','zip-dir','moment','mustache','util','path','sox','to-csv','lodash','squel','crypto'];(function(_0x1f36bb,_0x8af718){var _0xaf97fa=function(_0xeca489){while(--_0xeca489){_0x1f36bb['push'](_0x1f36bb['shift']());}};_0xaf97fa(++_0x8af718);}(_0xfdb3,0x10c));var _0x3fdb=function(_0x43fc6c,_0x2c40ba){_0x43fc6c=_0x43fc6c-0x0;var _0x276fa2=_0xfdb3[_0x43fc6c];return _0x276fa2;};'use strict';var pdf=require(_0x3fdb('0x0'));var emlformat=require(_0x3fdb('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x3fdb('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x3fdb('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x3fdb('0x4'));var util=require(_0x3fdb('0x5'));var path=require(_0x3fdb('0x6'));var sox=require(_0x3fdb('0x7'));var csv=require(_0x3fdb('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x3fdb('0x9'));var squel=require(_0x3fdb('0xa'));var crypto=require(_0x3fdb('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x3fdb('0xc'));var toCsv=require('to-csv');var querystring=require(_0x3fdb('0xd'));var Papa=require(_0x3fdb('0xe'));var Redis=require(_0x3fdb('0xf'));var authService=require(_0x3fdb('0x10'));var qs=require(_0x3fdb('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0x3fdb('0x12'));var config=require(_0x3fdb('0x13'));var db=require(_0x3fdb('0x14'))['db'];function respondWithStatusCode(_0x45e769,_0x3cc79c){_0x3cc79c=_0x3cc79c||0xcc;return function(_0x41f371){if(_0x41f371){return _0x45e769[_0x3fdb('0x15')](_0x3cc79c);}return _0x45e769[_0x3fdb('0x16')](_0x3cc79c)[_0x3fdb('0x17')]();};}function respondWithResult(_0x1c3972,_0x4eab69){_0x4eab69=_0x4eab69||0xc8;return function(_0x35a660){if(_0x35a660){return _0x1c3972[_0x3fdb('0x16')](_0x4eab69)['json'](_0x35a660);}};}function respondWithFilteredResult(_0x46c906,_0x31cd0e){return function(_0x182635){if(_0x182635){var _0x39c573=_0x182635[_0x3fdb('0x18')],_0x5a9b95=_0x31cd0e[_0x3fdb('0x19')],_0x5f2d00=_0x31cd0e[_0x3fdb('0x19')]+_0x31cd0e[_0x3fdb('0x1a')],_0x52132a;if(_0x5f2d00>=_0x39c573){_0x5f2d00=_0x39c573;_0x52132a=0xc8;}else{_0x52132a=0xce;}_0x46c906[_0x3fdb('0x16')](_0x52132a);return _0x46c906['set'](_0x3fdb('0x1b'),_0x5a9b95+'-'+_0x5f2d00+'/'+_0x39c573)[_0x3fdb('0x1c')](_0x182635);}return null;};}function patchUpdates(_0x45c509){return function(_0x463c6d){try{jsonpatch[_0x3fdb('0x1d')](_0x463c6d,_0x45c509,!![]);}catch(_0x4d9a94){return BPromise[_0x3fdb('0x1e')](_0x4d9a94);}return _0x463c6d[_0x3fdb('0x1f')]();};}function saveUpdates(_0x44c8b2,_0x1bbad7){return function(_0x403f48){if(_0x403f48){return _0x403f48['update'](_0x44c8b2)[_0x3fdb('0x20')](function(_0x4e632b){return _0x4e632b;});}return null;};}function removeEntity(_0x457b90,_0x490744){return function(_0x516440){if(_0x516440){return _0x516440['destroy']()['then'](function(){_0x457b90[_0x3fdb('0x16')](0xcc)[_0x3fdb('0x17')]();});}};}function handleEntityNotFound(_0xaf7c32,_0xac9aac){return function(_0x111cb8){if(!_0x111cb8){_0xaf7c32[_0x3fdb('0x15')](0x194);}return _0x111cb8;};}function handleError(_0x5d7665,_0x4cc898){_0x4cc898=_0x4cc898||0x1f4;return function(_0x1ed7bc){logger[_0x3fdb('0x21')](_0x1ed7bc['stack']);if(_0x1ed7bc[_0x3fdb('0x22')]){delete _0x1ed7bc['name'];}_0x5d7665['status'](_0x4cc898)[_0x3fdb('0x23')](_0x1ed7bc);};}exports[_0x3fdb('0x24')]=function(_0x5734c3,_0x2a634a){var _0x4d9c14={},_0x166ff2={},_0x30c1f0={'count':0x0,'rows':[]};var _0x11db11=_[_0x3fdb('0x25')](db[_0x3fdb('0x26')][_0x3fdb('0x27')],function(_0x442dbc){return{'name':_0x442dbc[_0x3fdb('0x28')],'type':_0x442dbc['type']['key']};});_0x166ff2[_0x3fdb('0x29')]=_[_0x3fdb('0x25')](_0x11db11,_0x3fdb('0x22'));_0x166ff2[_0x3fdb('0x2a')]=_[_0x3fdb('0x2b')](_0x5734c3[_0x3fdb('0x2a')]);_0x166ff2[_0x3fdb('0x2c')]=_[_0x3fdb('0x2d')](_0x166ff2['model'],_0x166ff2[_0x3fdb('0x2a')]);_0x4d9c14[_0x3fdb('0x2e')]=_[_0x3fdb('0x2d')](_0x166ff2[_0x3fdb('0x29')],qs[_0x3fdb('0x2f')](_0x5734c3[_0x3fdb('0x2a')][_0x3fdb('0x2f')]));_0x4d9c14[_0x3fdb('0x2e')]=_0x4d9c14[_0x3fdb('0x2e')][_0x3fdb('0x30')]?_0x4d9c14[_0x3fdb('0x2e')]:_0x166ff2[_0x3fdb('0x29')];if(!_0x5734c3[_0x3fdb('0x2a')]['hasOwnProperty']('nolimit')){_0x4d9c14[_0x3fdb('0x1a')]=qs[_0x3fdb('0x1a')](_0x5734c3[_0x3fdb('0x2a')][_0x3fdb('0x1a')]);_0x4d9c14[_0x3fdb('0x19')]=qs[_0x3fdb('0x19')](_0x5734c3[_0x3fdb('0x2a')][_0x3fdb('0x19')]);}_0x4d9c14[_0x3fdb('0x31')]=qs['sort'](_0x5734c3[_0x3fdb('0x2a')]['sort']);_0x4d9c14[_0x3fdb('0x32')]=qs[_0x3fdb('0x2c')](_[_0x3fdb('0x33')](_0x5734c3['query'],_0x166ff2[_0x3fdb('0x2c')]),_0x11db11);if(_0x5734c3[_0x3fdb('0x2a')]['filter']){_0x4d9c14[_0x3fdb('0x32')]=_[_0x3fdb('0x34')](_0x4d9c14[_0x3fdb('0x32')],{'$or':_[_0x3fdb('0x25')](_0x11db11,function(_0x4978d9){if(_0x4978d9[_0x3fdb('0x35')]!==_0x3fdb('0x36')){var _0x4eacc5={};_0x4eacc5[_0x4978d9[_0x3fdb('0x22')]]={'$like':'%'+_0x5734c3[_0x3fdb('0x2a')][_0x3fdb('0x37')]+'%'};return _0x4eacc5;}})});}_0x4d9c14=_[_0x3fdb('0x34')]({},_0x4d9c14,_0x5734c3[_0x3fdb('0x38')]);var _0x12287c={'where':_0x4d9c14['where']};return db[_0x3fdb('0x26')]['count'](_0x12287c)[_0x3fdb('0x20')](function(_0x23e2c6){_0x30c1f0[_0x3fdb('0x18')]=_0x23e2c6;if(_0x5734c3['query'][_0x3fdb('0x39')]){_0x4d9c14[_0x3fdb('0x3a')]=[{'all':!![]}];}return db[_0x3fdb('0x26')][_0x3fdb('0x3b')](_0x4d9c14);})[_0x3fdb('0x20')](function(_0x3e46a2){_0x30c1f0[_0x3fdb('0x3c')]=_0x3e46a2;return _0x30c1f0;})['then'](respondWithFilteredResult(_0x2a634a,_0x4d9c14))[_0x3fdb('0x3d')](handleError(_0x2a634a,null));};exports[_0x3fdb('0x3e')]=function(_0x583811,_0x31721a){var _0x1da23f={'raw':!![],'where':{'id':_0x583811[_0x3fdb('0x3f')]['id']}},_0x2b5b14={};_0x2b5b14['model']=_[_0x3fdb('0x2b')](db[_0x3fdb('0x26')][_0x3fdb('0x27')]);_0x2b5b14[_0x3fdb('0x2a')]=_['keys'](_0x583811[_0x3fdb('0x2a')]);_0x2b5b14[_0x3fdb('0x2c')]=_[_0x3fdb('0x2d')](_0x2b5b14[_0x3fdb('0x29')],_0x2b5b14[_0x3fdb('0x2a')]);_0x1da23f[_0x3fdb('0x2e')]=_[_0x3fdb('0x2d')](_0x2b5b14[_0x3fdb('0x29')],qs['fields'](_0x583811['query'][_0x3fdb('0x2f')]));_0x1da23f[_0x3fdb('0x2e')]=_0x1da23f[_0x3fdb('0x2e')][_0x3fdb('0x30')]?_0x1da23f[_0x3fdb('0x2e')]:_0x2b5b14[_0x3fdb('0x29')];if(_0x583811[_0x3fdb('0x2a')][_0x3fdb('0x39')]){_0x1da23f[_0x3fdb('0x3a')]=[{'all':!![]}];}_0x1da23f=_[_0x3fdb('0x34')]({},_0x1da23f,_0x583811[_0x3fdb('0x38')]);return db[_0x3fdb('0x26')]['find'](_0x1da23f)[_0x3fdb('0x20')](handleEntityNotFound(_0x31721a,null))[_0x3fdb('0x20')](respondWithResult(_0x31721a,null))['catch'](handleError(_0x31721a,null));};exports[_0x3fdb('0x40')]=function(_0x119600,_0x5d1938){return db[_0x3fdb('0x26')][_0x3fdb('0x40')](_0x119600[_0x3fdb('0x41')],{})['then'](respondWithResult(_0x5d1938,0xc9))[_0x3fdb('0x3d')](handleError(_0x5d1938,null));};exports[_0x3fdb('0x42')]=function(_0x525d45,_0x119386){if(_0x525d45[_0x3fdb('0x41')]['id']){delete _0x525d45[_0x3fdb('0x41')]['id'];}return db[_0x3fdb('0x26')][_0x3fdb('0x43')]({'where':{'id':_0x525d45[_0x3fdb('0x3f')]['id']}})[_0x3fdb('0x20')](handleEntityNotFound(_0x119386,null))[_0x3fdb('0x20')](saveUpdates(_0x525d45[_0x3fdb('0x41')],null))['then'](respondWithResult(_0x119386,null))[_0x3fdb('0x3d')](handleError(_0x119386,null));};exports[_0x3fdb('0x44')]=function(_0x57b0ad,_0x5b7900){return db['MailQueueReport'][_0x3fdb('0x43')]({'where':{'id':_0x57b0ad['params']['id']}})['then'](handleEntityNotFound(_0x5b7900,null))[_0x3fdb('0x20')](removeEntity(_0x5b7900,null))['catch'](handleError(_0x5b7900,null));};exports[_0x3fdb('0x45')]=function(_0x3ac448,_0x4e468a){return db[_0x3fdb('0x26')][_0x3fdb('0x45')]()[_0x3fdb('0x20')](respondWithResult(_0x4e468a,null))['catch'](handleError(_0x4e468a,null));}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.model.js b/server/api/mailQueueReport/mailQueueReport.model.js index fb6cede..496e807 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 _0xba6f=['report_mail_queue','uniqueid','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./mailQueueReport.attributes','exports','define'];(function(_0x37f4a4,_0x34f719){var _0x5c5907=function(_0x39a891){while(--_0x39a891){_0x37f4a4['push'](_0x37f4a4['shift']());}};_0x5c5907(++_0x34f719);}(_0xba6f,0x1d0));var _0xfba6=function(_0x2fc6cf,_0x2bb133){_0x2fc6cf=_0x2fc6cf-0x0;var _0xf2ade3=_0xba6f[_0x2fc6cf];return _0xf2ade3;};'use strict';var _=require(_0xfba6('0x0'));var util=require('util');var logger=require(_0xfba6('0x1'))(_0xfba6('0x2'));var moment=require(_0xfba6('0x3'));var BPromise=require(_0xfba6('0x4'));var rp=require(_0xfba6('0x5'));var fs=require('fs');var path=require(_0xfba6('0x6'));var rimraf=require(_0xfba6('0x7'));var config=require(_0xfba6('0x8'));var attributes=require(_0xfba6('0x9'));module[_0xfba6('0xa')]=function(_0x269363,_0x10310e){return _0x269363[_0xfba6('0xb')]('MailQueueReport',attributes,{'tableName':_0xfba6('0xc'),'paranoid':![],'indexes':[{'name':_0xfba6('0xd'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x7096=['rimraf','../../config/environment','./mailQueueReport.attributes','exports','define','MailQueueReport','report_mail_queue','uniqueid','util','api','bluebird','request-promise','path'];(function(_0x144b4f,_0x3bcfb6){var _0x5ed74b=function(_0x507df6){while(--_0x507df6){_0x144b4f['push'](_0x144b4f['shift']());}};_0x5ed74b(++_0x3bcfb6);}(_0x7096,0x10c));var _0x6709=function(_0x42245d,_0x51758f){_0x42245d=_0x42245d-0x0;var _0x4b211a=_0x7096[_0x42245d];return _0x4b211a;};'use strict';var _=require('lodash');var util=require(_0x6709('0x0'));var logger=require('../../config/logger')(_0x6709('0x1'));var moment=require('moment');var BPromise=require(_0x6709('0x2'));var rp=require(_0x6709('0x3'));var fs=require('fs');var path=require(_0x6709('0x4'));var rimraf=require(_0x6709('0x5'));var config=require(_0x6709('0x6'));var attributes=require(_0x6709('0x7'));module[_0x6709('0x8')]=function(_0x9d630f,_0xa35832){return _0x9d630f[_0x6709('0x9')](_0x6709('0xa'),attributes,{'tableName':_0x6709('0xb'),'paranoid':![],'indexes':[{'name':_0x6709('0xc'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.rpc.js b/server/api/mailQueueReport/mailQueueReport.rpc.js index 2ae5463..3fc653c 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 _0xdb28=['UpdateMailQueueReport','MailQueueReport','update','raw','where','limit','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','request','then','MailQueueReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','catch','CreateMailQueueReport','create','body','options'];(function(_0x37bc8d,_0x686b2c){var _0x5ab9e3=function(_0xc9b63b){while(--_0xc9b63b){_0x37bc8d['push'](_0x37bc8d['shift']());}};_0x5ab9e3(++_0x686b2c);}(_0xdb28,0x106));var _0x8db2=function(_0x5ac6f3,_0x319e21){_0x5ac6f3=_0x5ac6f3-0x0;var _0x636488=_0xdb28[_0x5ac6f3];return _0x636488;};'use strict';var _=require(_0x8db2('0x0'));var util=require(_0x8db2('0x1'));var moment=require(_0x8db2('0x2'));var BPromise=require(_0x8db2('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8db2('0x4'));var db=require(_0x8db2('0x5'))['db'];var utils=require(_0x8db2('0x6'));var logger=require(_0x8db2('0x7'))(_0x8db2('0x8'));var config=require('../../config/environment');var jayson=require(_0x8db2('0x9'));var client=jayson[_0x8db2('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x494b40,_0x477f50,_0x46932f){return new BPromise(function(_0x131537,_0x29f698){return client[_0x8db2('0xb')](_0x494b40,_0x46932f)[_0x8db2('0xc')](function(_0x126c78){logger['info'](_0x8db2('0xd'),_0x477f50,_0x8db2('0xe'));logger[_0x8db2('0xf')]('MailQueueReport,\x20%s,\x20%s,\x20%s',_0x477f50,_0x8db2('0xe'),JSON[_0x8db2('0x10')](_0x126c78));if(_0x126c78['error']){if(_0x126c78[_0x8db2('0x11')][_0x8db2('0x12')]===0x1f4){logger[_0x8db2('0x11')](_0x8db2('0xd'),_0x477f50,_0x126c78[_0x8db2('0x11')]['message']);return _0x29f698(_0x126c78['error'][_0x8db2('0x13')]);}logger[_0x8db2('0x11')](_0x8db2('0xd'),_0x477f50,_0x126c78[_0x8db2('0x11')][_0x8db2('0x13')]);return _0x131537(_0x126c78[_0x8db2('0x11')][_0x8db2('0x13')]);}else{logger[_0x8db2('0x14')](_0x8db2('0xd'),_0x477f50,_0x8db2('0xe'));_0x131537(_0x126c78['result'][_0x8db2('0x13')]);}})[_0x8db2('0x15')](function(_0x48101e){logger[_0x8db2('0x11')](_0x8db2('0xd'),_0x477f50,_0x48101e);_0x29f698(_0x48101e);});});}exports[_0x8db2('0x16')]=function(_0x3fddc2){var _0x2efd06=this;return new Promise(function(_0x46ce14,_0x51d60d){return db['MailQueueReport'][_0x8db2('0x17')](_0x3fddc2[_0x8db2('0x18')],{'raw':_0x3fddc2[_0x8db2('0x19')]?_0x3fddc2[_0x8db2('0x19')]['raw']===undefined?!![]:![]:!![]})[_0x8db2('0xc')](function(_0x36a9ff){logger[_0x8db2('0x14')](_0x8db2('0x16'),_0x3fddc2);logger[_0x8db2('0xf')]('CreateMailQueueReport',_0x3fddc2,JSON[_0x8db2('0x10')](_0x36a9ff));_0x46ce14(_0x36a9ff);})[_0x8db2('0x15')](function(_0x18f69c){logger[_0x8db2('0x11')](_0x8db2('0x16'),_0x18f69c[_0x8db2('0x13')],_0x3fddc2);_0x51d60d(_0x2efd06[_0x8db2('0x11')](0x1f4,_0x18f69c['message']));});});};exports[_0x8db2('0x1a')]=function(_0x4f6516){var _0x5725f0=this;return new Promise(function(_0x52a9ca,_0x4d923c){return db[_0x8db2('0x1b')][_0x8db2('0x1c')](_0x4f6516[_0x8db2('0x18')],{'raw':_0x4f6516[_0x8db2('0x19')]?_0x4f6516[_0x8db2('0x19')][_0x8db2('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4f6516['options']?_0x4f6516[_0x8db2('0x19')][_0x8db2('0x1e')]||null:null,'attributes':_0x4f6516[_0x8db2('0x19')]?_0x4f6516[_0x8db2('0x19')]['attributes']||null:null,'limit':_0x4f6516[_0x8db2('0x19')]?_0x4f6516[_0x8db2('0x19')][_0x8db2('0x1f')]||null:null})[_0x8db2('0xc')](function(_0xbe5ece){logger[_0x8db2('0x14')](_0x8db2('0x1a'),_0x4f6516);logger[_0x8db2('0xf')](_0x8db2('0x1a'),_0x4f6516,JSON['stringify'](_0xbe5ece));_0x52a9ca(_0xbe5ece);})[_0x8db2('0x15')](function(_0x50b28d){logger['error'](_0x8db2('0x1a'),_0x50b28d[_0x8db2('0x13')],_0x4f6516);_0x4d923c(_0x5725f0[_0x8db2('0x11')](0x1f4,_0x50b28d['message']));});});}; \ No newline at end of file +var _0x7a54=['moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','info','MailQueueReport,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch','MailQueueReport','create','body','options','raw','CreateMailQueueReport','UpdateMailQueueReport','update','where','attributes','limit','then','lodash','util'];(function(_0x984e9c,_0x3d8857){var _0x1a4f49=function(_0x34e999){while(--_0x34e999){_0x984e9c['push'](_0x984e9c['shift']());}};_0x1a4f49(++_0x3d8857);}(_0x7a54,0x106));var _0x47a5=function(_0x10b082,_0x1958e9){_0x10b082=_0x10b082-0x0;var _0x57e5d9=_0x7a54[_0x10b082];return _0x57e5d9;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var moment=require(_0x47a5('0x2'));var BPromise=require('bluebird');var rs=require(_0x47a5('0x3'));var fs=require('fs');var Redis=require(_0x47a5('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x47a5('0x5'));var logger=require(_0x47a5('0x6'))(_0x47a5('0x7'));var config=require(_0x47a5('0x8'));var jayson=require(_0x47a5('0x9'));var client=jayson['client'][_0x47a5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x59199c,_0x343372,_0x30e405){return new BPromise(function(_0x506eda,_0x194fb0){return client['request'](_0x59199c,_0x30e405)['then'](function(_0x582352){logger[_0x47a5('0xb')](_0x47a5('0xc'),_0x343372,'request\x20sent');logger[_0x47a5('0xd')]('MailQueueReport,\x20%s,\x20%s,\x20%s',_0x343372,'request\x20sent',JSON[_0x47a5('0xe')](_0x582352));if(_0x582352[_0x47a5('0xf')]){if(_0x582352[_0x47a5('0xf')][_0x47a5('0x10')]===0x1f4){logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')]['message']);return _0x194fb0(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);return _0x506eda(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}else{logger['info'](_0x47a5('0xc'),_0x343372,_0x47a5('0x12'));_0x506eda(_0x582352[_0x47a5('0x13')][_0x47a5('0x11')]);}})[_0x47a5('0x14')](function(_0x574af6){logger['error'](_0x47a5('0xc'),_0x343372,_0x574af6);_0x194fb0(_0x574af6);});});}exports['CreateMailQueueReport']=function(_0x5247fd){var _0x423a81=this;return new Promise(function(_0xaf70a6,_0x2ce454){return db[_0x47a5('0x15')][_0x47a5('0x16')](_0x5247fd[_0x47a5('0x17')],{'raw':_0x5247fd[_0x47a5('0x18')]?_0x5247fd[_0x47a5('0x18')][_0x47a5('0x19')]===undefined?!![]:![]:!![]})['then'](function(_0x1570bc){logger[_0x47a5('0xb')]('CreateMailQueueReport',_0x5247fd);logger[_0x47a5('0xd')](_0x47a5('0x1a'),_0x5247fd,JSON[_0x47a5('0xe')](_0x1570bc));_0xaf70a6(_0x1570bc);})['catch'](function(_0xb8ae6c){logger[_0x47a5('0xf')](_0x47a5('0x1a'),_0xb8ae6c[_0x47a5('0x11')],_0x5247fd);_0x2ce454(_0x423a81['error'](0x1f4,_0xb8ae6c[_0x47a5('0x11')]));});});};exports[_0x47a5('0x1b')]=function(_0x513981){var _0x28747d=this;return new Promise(function(_0xc4cd63,_0x4437f1){return db[_0x47a5('0x15')][_0x47a5('0x1c')](_0x513981['body'],{'raw':_0x513981['options']?_0x513981[_0x47a5('0x18')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x513981[_0x47a5('0x18')]?_0x513981['options'][_0x47a5('0x1d')]||null:null,'attributes':_0x513981[_0x47a5('0x18')]?_0x513981[_0x47a5('0x18')][_0x47a5('0x1e')]||null:null,'limit':_0x513981[_0x47a5('0x18')]?_0x513981[_0x47a5('0x18')][_0x47a5('0x1f')]||null:null})[_0x47a5('0x20')](function(_0x16631f){logger[_0x47a5('0xb')](_0x47a5('0x1b'),_0x513981);logger[_0x47a5('0xd')](_0x47a5('0x1b'),_0x513981,JSON['stringify'](_0x16631f));_0xc4cd63(_0x16631f);})[_0x47a5('0x14')](function(_0x51833b){logger[_0x47a5('0xf')](_0x47a5('0x1b'),_0x51833b[_0x47a5('0x11')],_0x513981);_0x4437f1(_0x28747d['error'](0x1f4,_0x51833b[_0x47a5('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/mailServerIn/index.js b/server/api/mailServerIn/index.js index 92458e9..eb2c156 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 _0xedd3=['multer','util','path','connect-timeout','../../components/auth/service','../../components/interaction/service','../../config/environment','exports'];(function(_0x58b555,_0x5e742f){var _0x1b2f99=function(_0x192bb3){while(--_0x192bb3){_0x58b555['push'](_0x58b555['shift']());}};_0x1b2f99(++_0x5e742f);}(_0xedd3,0xd8));var _0x3edd=function(_0x24061a,_0x1c9f4d){_0x24061a=_0x24061a-0x0;var _0x82054e=_0xedd3[_0x24061a];return _0x82054e;};'use strict';var multer=require(_0x3edd('0x0'));var util=require(_0x3edd('0x1'));var path=require(_0x3edd('0x2'));var timeout=require(_0x3edd('0x3'));var express=require('express');var router=express['Router']();var auth=require(_0x3edd('0x4'));var interaction=require(_0x3edd('0x5'));var config=require(_0x3edd('0x6'));module[_0x3edd('0x7')]=router; \ No newline at end of file +var _0x1757=['exports','util','express','Router','../../components/auth/service','../../config/environment'];(function(_0x3512b2,_0x2cb54a){var _0x16c6e8=function(_0x1698d4){while(--_0x1698d4){_0x3512b2['push'](_0x3512b2['shift']());}};_0x16c6e8(++_0x2cb54a);}(_0x1757,0x11b));var _0x7175=function(_0x1d3b9d,_0xdd459c){_0x1d3b9d=_0x1d3b9d-0x0;var _0x5caef6=_0x1757[_0x1d3b9d];return _0x5caef6;};'use strict';var multer=require('multer');var util=require(_0x7175('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x7175('0x1'));var router=express[_0x7175('0x2')]();var auth=require(_0x7175('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0x7175('0x4'));module[_0x7175('0x5')]=router; \ No newline at end of file diff --git a/server/api/mailServerIn/mailServerIn.attributes.js b/server/api/mailServerIn/mailServerIn.attributes.js index 55b060a..2b52377 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 _0x905d=['BOOLEAN','username','INTEGER','INBOX','sequelize','STRING'];(function(_0x1e05c1,_0x3cffa3){var _0x15f1ca=function(_0x3a9594){while(--_0x3a9594){_0x1e05c1['push'](_0x1e05c1['shift']());}};_0x15f1ca(++_0x3cffa3);}(_0x905d,0xb2));var _0xd905=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x905d[_0x2dafbe];return _0x58a45a;};'use strict';var Sequelize=require(_0xd905('0x0'));module['exports']={'description':{'type':Sequelize[_0xd905('0x1')]},'host':{'type':Sequelize[_0xd905('0x1')]},'authentication':{'type':Sequelize[_0xd905('0x2')],'defaultValue':!![]},'user':{'type':Sequelize['STRING'],'unique':_0xd905('0x3')},'password':{'type':Sequelize['STRING']},'port':{'type':Sequelize[_0xd905('0x4')]},'tls':{'type':Sequelize[_0xd905('0x2')],'defaultValue':!![]},'mailbox':{'type':Sequelize['STRING'],'defaultValue':_0xd905('0x5')},'connTimeout':{'type':Sequelize[_0xd905('0x4')],'defaultValue':0xa},'authTimeout':{'type':Sequelize[_0xd905('0x4')],'defaultValue':0x5},'service':{'type':Sequelize[_0xd905('0x1')]}}; \ No newline at end of file +var _0xba4e=['STRING','BOOLEAN','username','INTEGER','sequelize','exports'];(function(_0x1683b2,_0x3ff310){var _0x45f858=function(_0x208e2e){while(--_0x208e2e){_0x1683b2['push'](_0x1683b2['shift']());}};_0x45f858(++_0x3ff310);}(_0xba4e,0x1a2));var _0xeba4=function(_0x17e0ff,_0x4dbd1e){_0x17e0ff=_0x17e0ff-0x0;var _0x357979=_0xba4e[_0x17e0ff];return _0x357979;};'use strict';var Sequelize=require(_0xeba4('0x0'));module[_0xeba4('0x1')]={'description':{'type':Sequelize['STRING']},'host':{'type':Sequelize[_0xeba4('0x2')]},'authentication':{'type':Sequelize[_0xeba4('0x3')],'defaultValue':!![]},'user':{'type':Sequelize[_0xeba4('0x2')],'unique':_0xeba4('0x4')},'password':{'type':Sequelize['STRING']},'port':{'type':Sequelize[_0xeba4('0x5')]},'tls':{'type':Sequelize[_0xeba4('0x3')],'defaultValue':!![]},'mailbox':{'type':Sequelize[_0xeba4('0x2')],'defaultValue':'INBOX'},'connTimeout':{'type':Sequelize[_0xeba4('0x5')],'defaultValue':0xa},'authTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x5},'service':{'type':Sequelize[_0xeba4('0x2')]}}; \ No newline at end of file diff --git a/server/api/mailServerIn/mailServerIn.model.js b/server/api/mailServerIn/mailServerIn.model.js index 39c8bc2..44d0f2c 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 _0xea1c=['define','MailServerIn','mail_servers_in','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./mailServerIn.attributes','exports'];(function(_0x23f976,_0x5e50e1){var _0x4bde62=function(_0x2a3a41){while(--_0x2a3a41){_0x23f976['push'](_0x23f976['shift']());}};_0x4bde62(++_0x5e50e1);}(_0xea1c,0x117));var _0xcea1=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xea1c[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xcea1('0x0'))(_0xcea1('0x1'));var moment=require(_0xcea1('0x2'));var BPromise=require(_0xcea1('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xcea1('0x4'));var rimraf=require(_0xcea1('0x5'));var config=require(_0xcea1('0x6'));var attributes=require(_0xcea1('0x7'));module[_0xcea1('0x8')]=function(_0x1ff8bf,_0x29732f){return _0x1ff8bf[_0xcea1('0x9')](_0xcea1('0xa'),attributes,{'tableName':_0xcea1('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe4d9=['moment','path','rimraf','./mailServerIn.attributes','exports','define','lodash','util','../../config/logger'];(function(_0xa2a4d8,_0x437e16){var _0x25fec5=function(_0x4493d7){while(--_0x4493d7){_0xa2a4d8['push'](_0xa2a4d8['shift']());}};_0x25fec5(++_0x437e16);}(_0xe4d9,0x141));var _0x9e4d=function(_0x530efe,_0x5d8e0e){_0x530efe=_0x530efe-0x0;var _0x39aca3=_0xe4d9[_0x530efe];return _0x39aca3;};'use strict';var _=require(_0x9e4d('0x0'));var util=require(_0x9e4d('0x1'));var logger=require(_0x9e4d('0x2'))('api');var moment=require(_0x9e4d('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x9e4d('0x4'));var rimraf=require(_0x9e4d('0x5'));var config=require('../../config/environment');var attributes=require(_0x9e4d('0x6'));module[_0x9e4d('0x7')]=function(_0x5a4881,_0x493fb5){return _0x5a4881[_0x9e4d('0x8')]('MailServerIn',attributes,{'tableName':'mail_servers_in','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailServerIn/mailServerIn.rpc.js b/server/api/mailServerIn/mailServerIn.rpc.js index dd3e5eb..81adafa 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 _0x465e=['model','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','debug','MailServerIn,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','MailServerIn,\x20%s,\x20%s','message','info','result','catch','GetMailServerIn','options','raw','attributes','limit','include','map'];(function(_0xc738c5,_0x2792ab){var _0x5aa034=function(_0x2bc299){while(--_0x2bc299){_0xc738c5['push'](_0xc738c5['shift']());}};_0x5aa034(++_0x2792ab);}(_0x465e,0xf1));var _0xe465=function(_0x2e8418,_0x58c529){_0x2e8418=_0x2e8418-0x0;var _0x548fe6=_0x465e[_0x2e8418];return _0x548fe6;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xe465('0x0'));var BPromise=require(_0xe465('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xe465('0x2'));var db=require(_0xe465('0x3'))['db'];var utils=require(_0xe465('0x4'));var logger=require(_0xe465('0x5'))('rpc');var config=require(_0xe465('0x6'));var jayson=require(_0xe465('0x7'));var client=jayson[_0xe465('0x8')][_0xe465('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3a3f5f,_0xa8332a,_0x40fa66){return new BPromise(function(_0x22a441,_0x40e934){return client[_0xe465('0xa')](_0x3a3f5f,_0x40fa66)[_0xe465('0xb')](function(_0x57484b){logger['info']('MailServerIn,\x20%s,\x20%s',_0xa8332a,'request\x20sent');logger[_0xe465('0xc')](_0xe465('0xd'),_0xa8332a,_0xe465('0xe'),JSON['stringify'](_0x57484b));if(_0x57484b['error']){if(_0x57484b[_0xe465('0xf')][_0xe465('0x10')]===0x1f4){logger[_0xe465('0xf')](_0xe465('0x11'),_0xa8332a,_0x57484b[_0xe465('0xf')][_0xe465('0x12')]);return _0x40e934(_0x57484b['error']['message']);}logger[_0xe465('0xf')](_0xe465('0x11'),_0xa8332a,_0x57484b[_0xe465('0xf')][_0xe465('0x12')]);return _0x22a441(_0x57484b[_0xe465('0xf')]['message']);}else{logger[_0xe465('0x13')](_0xe465('0x11'),_0xa8332a,'request\x20sent');_0x22a441(_0x57484b[_0xe465('0x14')][_0xe465('0x12')]);}})[_0xe465('0x15')](function(_0x166f57){logger[_0xe465('0xf')](_0xe465('0x11'),_0xa8332a,_0x166f57);_0x40e934(_0x166f57);});});}exports[_0xe465('0x16')]=function(_0x2e61b8){var _0x130a69=this;return new Promise(function(_0x33d26f,_0x464964){return db['MailServerIn']['findAll']({'raw':_0x2e61b8[_0xe465('0x17')]?_0x2e61b8[_0xe465('0x17')][_0xe465('0x18')]===undefined?!![]:![]:!![],'where':_0x2e61b8[_0xe465('0x17')]?_0x2e61b8[_0xe465('0x17')]['where']||null:null,'attributes':_0x2e61b8[_0xe465('0x17')]?_0x2e61b8['options'][_0xe465('0x19')]||null:null,'limit':_0x2e61b8[_0xe465('0x17')]?_0x2e61b8[_0xe465('0x17')][_0xe465('0x1a')]||null:null,'include':_0x2e61b8['options']?_0x2e61b8[_0xe465('0x17')][_0xe465('0x1b')]?_[_0xe465('0x1c')](_0x2e61b8['options'][_0xe465('0x1b')],function(_0x2ab7d2){return{'model':db[_0x2ab7d2[_0xe465('0x1d')]],'as':_0x2ab7d2['as'],'attributes':_0x2ab7d2[_0xe465('0x19')],'include':_0x2ab7d2[_0xe465('0x1b')]?_[_0xe465('0x1c')](_0x2ab7d2[_0xe465('0x1b')],function(_0xb576dc){return{'model':db[_0xb576dc[_0xe465('0x1d')]],'as':_0xb576dc['as'],'attributes':_0xb576dc['attributes'],'include':_0xb576dc[_0xe465('0x1b')]?_['map'](_0xb576dc[_0xe465('0x1b')],function(_0x22226d){return{'model':db[_0x22226d[_0xe465('0x1d')]],'as':_0x22226d['as'],'attributes':_0x22226d[_0xe465('0x19')]};}):[]};}):[]};}):[]:[]})[_0xe465('0xb')](function(_0x3aece4){logger[_0xe465('0x13')](_0xe465('0x16'),_0x2e61b8);logger[_0xe465('0xc')](_0xe465('0x16'),_0x2e61b8,JSON['stringify'](_0x3aece4));_0x33d26f(_0x3aece4);})['catch'](function(_0x12856d){logger[_0xe465('0xf')](_0xe465('0x16'),_0x12856d[_0xe465('0x12')],_0x2e61b8);_0x464964(_0x130a69[_0xe465('0xf')](0x1f4,_0x12856d[_0xe465('0x12')]));});});}; \ No newline at end of file +var _0xefa1=['MailServerIn,\x20%s,\x20%s,\x20%s','stringify','error','message','MailServerIn','findAll','options','raw','where','attributes','limit','include','map','model','GetMailServerIn','debug','catch','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','http','then','info','MailServerIn,\x20%s,\x20%s','request\x20sent'];(function(_0xbc4d01,_0x383bb7){var _0x5a777c=function(_0x5dd651){while(--_0x5dd651){_0xbc4d01['push'](_0xbc4d01['shift']());}};_0x5a777c(++_0x383bb7);}(_0xefa1,0x13d));var _0x1efa=function(_0x421d67,_0x317375){_0x421d67=_0x421d67-0x0;var _0x2ca984=_0xefa1[_0x421d67];return _0x2ca984;};'use strict';var _=require(_0x1efa('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x1efa('0x1'));var rs=require(_0x1efa('0x2'));var fs=require('fs');var Redis=require(_0x1efa('0x3'));var db=require(_0x1efa('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x1efa('0x5'))(_0x1efa('0x6'));var config=require(_0x1efa('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0x1efa('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x13a4a5,_0x2cf644,_0x60e8ea){return new BPromise(function(_0xa76e44,_0x186045){return client['request'](_0x13a4a5,_0x60e8ea)[_0x1efa('0x9')](function(_0x50dabb){logger[_0x1efa('0xa')](_0x1efa('0xb'),_0x2cf644,_0x1efa('0xc'));logger['debug'](_0x1efa('0xd'),_0x2cf644,'request\x20sent',JSON[_0x1efa('0xe')](_0x50dabb));if(_0x50dabb[_0x1efa('0xf')]){if(_0x50dabb[_0x1efa('0xf')]['code']===0x1f4){logger[_0x1efa('0xf')]('MailServerIn,\x20%s,\x20%s',_0x2cf644,_0x50dabb[_0x1efa('0xf')]['message']);return _0x186045(_0x50dabb['error'][_0x1efa('0x10')]);}logger[_0x1efa('0xf')](_0x1efa('0xb'),_0x2cf644,_0x50dabb['error'][_0x1efa('0x10')]);return _0xa76e44(_0x50dabb[_0x1efa('0xf')][_0x1efa('0x10')]);}else{logger['info']('MailServerIn,\x20%s,\x20%s',_0x2cf644,'request\x20sent');_0xa76e44(_0x50dabb['result'][_0x1efa('0x10')]);}})['catch'](function(_0x11e569){logger['error'](_0x1efa('0xb'),_0x2cf644,_0x11e569);_0x186045(_0x11e569);});});}exports['GetMailServerIn']=function(_0x26a106){var _0x10894c=this;return new Promise(function(_0x368647,_0x389d3e){return db[_0x1efa('0x11')][_0x1efa('0x12')]({'raw':_0x26a106[_0x1efa('0x13')]?_0x26a106[_0x1efa('0x13')][_0x1efa('0x14')]===undefined?!![]:![]:!![],'where':_0x26a106['options']?_0x26a106['options'][_0x1efa('0x15')]||null:null,'attributes':_0x26a106[_0x1efa('0x13')]?_0x26a106[_0x1efa('0x13')][_0x1efa('0x16')]||null:null,'limit':_0x26a106[_0x1efa('0x13')]?_0x26a106['options'][_0x1efa('0x17')]||null:null,'include':_0x26a106[_0x1efa('0x13')]?_0x26a106[_0x1efa('0x13')][_0x1efa('0x18')]?_[_0x1efa('0x19')](_0x26a106[_0x1efa('0x13')][_0x1efa('0x18')],function(_0x2ce759){return{'model':db[_0x2ce759[_0x1efa('0x1a')]],'as':_0x2ce759['as'],'attributes':_0x2ce759[_0x1efa('0x16')],'include':_0x2ce759[_0x1efa('0x18')]?_[_0x1efa('0x19')](_0x2ce759[_0x1efa('0x18')],function(_0x45238a){return{'model':db[_0x45238a['model']],'as':_0x45238a['as'],'attributes':_0x45238a['attributes'],'include':_0x45238a[_0x1efa('0x18')]?_[_0x1efa('0x19')](_0x45238a['include'],function(_0x3d5752){return{'model':db[_0x3d5752[_0x1efa('0x1a')]],'as':_0x3d5752['as'],'attributes':_0x3d5752[_0x1efa('0x16')]};}):[]};}):[]};}):[]:[]})[_0x1efa('0x9')](function(_0x1ffdac){logger[_0x1efa('0xa')](_0x1efa('0x1b'),_0x26a106);logger[_0x1efa('0x1c')](_0x1efa('0x1b'),_0x26a106,JSON['stringify'](_0x1ffdac));_0x368647(_0x1ffdac);})[_0x1efa('0x1d')](function(_0x41abee){logger[_0x1efa('0xf')](_0x1efa('0x1b'),_0x41abee[_0x1efa('0x10')],_0x26a106);_0x389d3e(_0x10894c['error'](0x1f4,_0x41abee[_0x1efa('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/mailServerOut/index.js b/server/api/mailServerOut/index.js index eb41626..745d3ce 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 _0x801d=['post','put','update','delete','destroy','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailServerOut.controller','isAuthenticated','index','/:id'];(function(_0x57965a,_0x3637a3){var _0x5274a5=function(_0x77466a){while(--_0x77466a){_0x57965a['push'](_0x57965a['shift']());}};_0x5274a5(++_0x3637a3);}(_0x801d,0xd5));var _0xd801=function(_0xbe200f,_0x4b50eb){_0xbe200f=_0xbe200f-0x0;var _0x192597=_0x801d[_0xbe200f];return _0x192597;};'use strict';var multer=require(_0xd801('0x0'));var util=require(_0xd801('0x1'));var path=require(_0xd801('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xd801('0x3')]();var auth=require(_0xd801('0x4'));var interaction=require(_0xd801('0x5'));var config=require(_0xd801('0x6'));var controller=require(_0xd801('0x7'));router['get']('/',auth[_0xd801('0x8')](),controller[_0xd801('0x9')]);router['get'](_0xd801('0xa'),auth[_0xd801('0x8')](),controller['show']);router[_0xd801('0xb')]('/',auth['isAuthenticated'](),controller['create']);router[_0xd801('0xc')](_0xd801('0xa'),auth[_0xd801('0x8')](),controller[_0xd801('0xd')]);router[_0xd801('0xe')]('/:id',auth[_0xd801('0x8')](),controller[_0xd801('0xf')]);module['exports']=router; \ No newline at end of file +var _0x95b5=['get','/:id','isAuthenticated','show','create','put','update','delete','destroy','exports','multer','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x1b4909,_0x10b5db){var _0x4efacc=function(_0x2929b5){while(--_0x2929b5){_0x1b4909['push'](_0x1b4909['shift']());}};_0x4efacc(++_0x10b5db);}(_0x95b5,0x14a));var _0x595b=function(_0x2a1bc2,_0x4ad4b9){_0x2a1bc2=_0x2a1bc2-0x0;var _0x2ca785=_0x95b5[_0x2a1bc2];return _0x2ca785;};'use strict';var multer=require(_0x595b('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x595b('0x1'));var express=require('express');var router=express[_0x595b('0x2')]();var auth=require(_0x595b('0x3'));var interaction=require(_0x595b('0x4'));var config=require(_0x595b('0x5'));var controller=require('./mailServerOut.controller');router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0x595b('0x6')](_0x595b('0x7'),auth[_0x595b('0x8')](),controller[_0x595b('0x9')]);router['post']('/',auth['isAuthenticated'](),controller[_0x595b('0xa')]);router[_0x595b('0xb')](_0x595b('0x7'),auth[_0x595b('0x8')](),controller[_0x595b('0xc')]);router[_0x595b('0xd')](_0x595b('0x7'),auth[_0x595b('0x8')](),controller[_0x595b('0xe')]);module[_0x595b('0xf')]=router; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.attributes.js b/server/api/mailServerOut/mailServerOut.attributes.js index 8507b9a..9e0e223 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 _0x2aa3=['BOOLEAN','sequelize','exports','STRING','INTEGER'];(function(_0x5663ee,_0x36485f){var _0x17200d=function(_0x10074e){while(--_0x10074e){_0x5663ee['push'](_0x5663ee['shift']());}};_0x17200d(++_0x36485f);}(_0x2aa3,0x83));var _0x32aa=function(_0x2b4c19,_0x21a59d){_0x2b4c19=_0x2b4c19-0x0;var _0x5c7e2f=_0x2aa3[_0x2b4c19];return _0x5c7e2f;};'use strict';var Sequelize=require(_0x32aa('0x0'));module[_0x32aa('0x1')]={'description':{'type':Sequelize[_0x32aa('0x2')]},'host':{'type':Sequelize[_0x32aa('0x2')]},'user':{'type':Sequelize['STRING']},'pass':{'type':Sequelize['STRING']},'port':{'type':Sequelize[_0x32aa('0x3')]},'secure':{'type':Sequelize[_0x32aa('0x4')],'defaultValue':![]},'service':{'type':Sequelize[_0x32aa('0x2')]},'authentication':{'type':Sequelize[_0x32aa('0x4')],'defaultValue':!![]}}; \ No newline at end of file +var _0x6d19=['INTEGER','BOOLEAN','sequelize','exports','STRING'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0x6d19,0x160));var _0x96d1=function(_0x556bb1,_0x34830d){_0x556bb1=_0x556bb1-0x0;var _0x45455f=_0x6d19[_0x556bb1];return _0x45455f;};'use strict';var Sequelize=require(_0x96d1('0x0'));module[_0x96d1('0x1')]={'description':{'type':Sequelize[_0x96d1('0x2')]},'host':{'type':Sequelize[_0x96d1('0x2')]},'user':{'type':Sequelize[_0x96d1('0x2')]},'pass':{'type':Sequelize[_0x96d1('0x2')]},'port':{'type':Sequelize[_0x96d1('0x3')]},'secure':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'service':{'type':Sequelize[_0x96d1('0x2')]},'authentication':{'type':Sequelize[_0x96d1('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 d762fac..caf98e1 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 _0x76e0=['then','destroy','error','stack','send','index','map','MailServerOut','rawAttributes','fieldName','type','key','model','name','query','keys','intersection','attributes','hasOwnProperty','order','sort','where','filters','filter','merge','options','includeAll','include','rows','show','fields','length','find','catch','update','body','params','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','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/environment','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','apply','save'];(function(_0x4d613c,_0x55f220){var _0x301fe3=function(_0x5eec0b){while(--_0x5eec0b){_0x4d613c['push'](_0x4d613c['shift']());}};_0x301fe3(++_0x55f220);}(_0x76e0,0x18d));var _0x076e=function(_0x8a98cf,_0x586327){_0x8a98cf=_0x8a98cf-0x0;var _0x83afe9=_0x76e0[_0x8a98cf];return _0x83afe9;};'use strict';var pdf=require(_0x076e('0x0'));var emlformat=require(_0x076e('0x1'));var rimraf=require(_0x076e('0x2'));var zipdir=require(_0x076e('0x3'));var jsonpatch=require(_0x076e('0x4'));var rp=require(_0x076e('0x5'));var moment=require(_0x076e('0x6'));var BPromise=require('bluebird');var Mustache=require(_0x076e('0x7'));var util=require(_0x076e('0x8'));var path=require('path');var sox=require('sox');var csv=require(_0x076e('0x9'));var ejs=require(_0x076e('0xa'));var fs=require('fs');var _=require(_0x076e('0xb'));var squel=require(_0x076e('0xc'));var crypto=require('crypto');var jsforce=require(_0x076e('0xd'));var deskjs=require(_0x076e('0xe'));var toCsv=require(_0x076e('0x9'));var querystring=require(_0x076e('0xf'));var Papa=require(_0x076e('0x10'));var Redis=require('ioredis');var authService=require(_0x076e('0x11'));var qs=require(_0x076e('0x12'));var as=require(_0x076e('0x13'));var hardwareService=require(_0x076e('0x14'));var logger=require(_0x076e('0x15'))(_0x076e('0x16'));var utils=require('../../config/utils');var config=require(_0x076e('0x17'));var db=require(_0x076e('0x18'))['db'];function respondWithStatusCode(_0x37229a,_0x5eddb9){_0x5eddb9=_0x5eddb9||0xcc;return function(_0xbe7764){if(_0xbe7764){return _0x37229a[_0x076e('0x19')](_0x5eddb9);}return _0x37229a[_0x076e('0x1a')](_0x5eddb9)[_0x076e('0x1b')]();};}function respondWithResult(_0x880bb,_0x5377b3){_0x5377b3=_0x5377b3||0xc8;return function(_0x358465){if(_0x358465){return _0x880bb[_0x076e('0x1a')](_0x5377b3)[_0x076e('0x1c')](_0x358465);}};}function respondWithFilteredResult(_0x1464a5,_0x5486cd){return function(_0x212796){if(_0x212796){var _0x488bca=_0x212796[_0x076e('0x1d')],_0x1f41d7=_0x5486cd[_0x076e('0x1e')],_0x502f94=_0x5486cd[_0x076e('0x1e')]+_0x5486cd[_0x076e('0x1f')],_0x1b35ee;if(_0x502f94>=_0x488bca){_0x502f94=_0x488bca;_0x1b35ee=0xc8;}else{_0x1b35ee=0xce;}_0x1464a5[_0x076e('0x1a')](_0x1b35ee);return _0x1464a5[_0x076e('0x20')]('Content-Range',_0x1f41d7+'-'+_0x502f94+'/'+_0x488bca)[_0x076e('0x1c')](_0x212796);}return null;};}function patchUpdates(_0x310ff9){return function(_0x2ac6a6){try{jsonpatch[_0x076e('0x21')](_0x2ac6a6,_0x310ff9,!![]);}catch(_0x5e606e){return BPromise['reject'](_0x5e606e);}return _0x2ac6a6[_0x076e('0x22')]();};}function saveUpdates(_0x38c150,_0x5262e9){return function(_0x1235d2){if(_0x1235d2){return _0x1235d2['update'](_0x38c150)[_0x076e('0x23')](function(_0x410693){return _0x410693;});}return null;};}function removeEntity(_0x576797,_0x3245db){return function(_0x4a334b){if(_0x4a334b){return _0x4a334b[_0x076e('0x24')]()[_0x076e('0x23')](function(){_0x576797[_0x076e('0x1a')](0xcc)[_0x076e('0x1b')]();});}};}function handleEntityNotFound(_0xc6ff70,_0x5ef7c){return function(_0x212c57){if(!_0x212c57){_0xc6ff70[_0x076e('0x19')](0x194);}return _0x212c57;};}function handleError(_0x6d5f00,_0x51a116){_0x51a116=_0x51a116||0x1f4;return function(_0x4f2665){logger[_0x076e('0x25')](_0x4f2665[_0x076e('0x26')]);if(_0x4f2665['name']){delete _0x4f2665['name'];}_0x6d5f00[_0x076e('0x1a')](_0x51a116)[_0x076e('0x27')](_0x4f2665);};}exports[_0x076e('0x28')]=function(_0x4ca718,_0x50da4d){var _0xacdaa2={},_0x4ce6b9={},_0x1dcef0={'count':0x0,'rows':[]};var _0x5f312d=_[_0x076e('0x29')](db[_0x076e('0x2a')][_0x076e('0x2b')],function(_0x22fc82){return{'name':_0x22fc82[_0x076e('0x2c')],'type':_0x22fc82[_0x076e('0x2d')][_0x076e('0x2e')]};});_0x4ce6b9[_0x076e('0x2f')]=_['map'](_0x5f312d,_0x076e('0x30'));_0x4ce6b9[_0x076e('0x31')]=_[_0x076e('0x32')](_0x4ca718[_0x076e('0x31')]);_0x4ce6b9['filters']=_[_0x076e('0x33')](_0x4ce6b9[_0x076e('0x2f')],_0x4ce6b9['query']);_0xacdaa2['attributes']=_[_0x076e('0x33')](_0x4ce6b9['model'],qs['fields'](_0x4ca718['query']['fields']));_0xacdaa2[_0x076e('0x34')]=_0xacdaa2[_0x076e('0x34')]['length']?_0xacdaa2[_0x076e('0x34')]:_0x4ce6b9['model'];if(!_0x4ca718['query'][_0x076e('0x35')]('nolimit')){_0xacdaa2['limit']=qs['limit'](_0x4ca718[_0x076e('0x31')][_0x076e('0x1f')]);_0xacdaa2['offset']=qs[_0x076e('0x1e')](_0x4ca718[_0x076e('0x31')][_0x076e('0x1e')]);}_0xacdaa2[_0x076e('0x36')]=qs[_0x076e('0x37')](_0x4ca718[_0x076e('0x31')][_0x076e('0x37')]);_0xacdaa2[_0x076e('0x38')]=qs[_0x076e('0x39')](_['pick'](_0x4ca718['query'],_0x4ce6b9[_0x076e('0x39')]),_0x5f312d);if(_0x4ca718[_0x076e('0x31')][_0x076e('0x3a')]){_0xacdaa2[_0x076e('0x38')]=_[_0x076e('0x3b')](_0xacdaa2[_0x076e('0x38')],{'$or':_['map'](_0x5f312d,function(_0x15c91b){if(_0x15c91b[_0x076e('0x2d')]!=='VIRTUAL'){var _0x22c400={};_0x22c400[_0x15c91b['name']]={'$like':'%'+_0x4ca718['query'][_0x076e('0x3a')]+'%'};return _0x22c400;}})});}_0xacdaa2=_[_0x076e('0x3b')]({},_0xacdaa2,_0x4ca718[_0x076e('0x3c')]);var _0x197013={'where':_0xacdaa2[_0x076e('0x38')]};return db[_0x076e('0x2a')][_0x076e('0x1d')](_0x197013)[_0x076e('0x23')](function(_0x267a34){_0x1dcef0[_0x076e('0x1d')]=_0x267a34;if(_0x4ca718[_0x076e('0x31')][_0x076e('0x3d')]){_0xacdaa2[_0x076e('0x3e')]=[{'all':!![]}];}return db[_0x076e('0x2a')]['findAll'](_0xacdaa2);})['then'](function(_0x47dc69){_0x1dcef0[_0x076e('0x3f')]=_0x47dc69;return _0x1dcef0;})['then'](respondWithFilteredResult(_0x50da4d,_0xacdaa2))['catch'](handleError(_0x50da4d,null));};exports[_0x076e('0x40')]=function(_0x1dc777,_0xf8ddeb){var _0x292346={'raw':!![],'where':{'id':_0x1dc777['params']['id']}},_0x316242={};_0x316242[_0x076e('0x2f')]=_[_0x076e('0x32')](db['MailServerOut']['rawAttributes']);_0x316242['query']=_[_0x076e('0x32')](_0x1dc777[_0x076e('0x31')]);_0x316242['filters']=_[_0x076e('0x33')](_0x316242[_0x076e('0x2f')],_0x316242[_0x076e('0x31')]);_0x292346[_0x076e('0x34')]=_[_0x076e('0x33')](_0x316242[_0x076e('0x2f')],qs[_0x076e('0x41')](_0x1dc777[_0x076e('0x31')][_0x076e('0x41')]));_0x292346[_0x076e('0x34')]=_0x292346['attributes'][_0x076e('0x42')]?_0x292346[_0x076e('0x34')]:_0x316242[_0x076e('0x2f')];if(_0x1dc777[_0x076e('0x31')]['includeAll']){_0x292346['include']=[{'all':!![]}];}_0x292346=_['merge']({},_0x292346,_0x1dc777[_0x076e('0x3c')]);return db[_0x076e('0x2a')][_0x076e('0x43')](_0x292346)[_0x076e('0x23')](handleEntityNotFound(_0xf8ddeb,null))['then'](respondWithResult(_0xf8ddeb,null))[_0x076e('0x44')](handleError(_0xf8ddeb,null));};exports['create']=function(_0x432811,_0x242619){return db[_0x076e('0x2a')]['create'](_0x432811['body'],{})[_0x076e('0x23')](respondWithResult(_0x242619,0xc9))['catch'](handleError(_0x242619,null));};exports[_0x076e('0x45')]=function(_0x537534,_0xb9773b){if(_0x537534[_0x076e('0x46')]['id']){delete _0x537534[_0x076e('0x46')]['id'];}return db[_0x076e('0x2a')][_0x076e('0x43')]({'where':{'id':_0x537534[_0x076e('0x47')]['id']}})[_0x076e('0x23')](handleEntityNotFound(_0xb9773b,null))[_0x076e('0x23')](saveUpdates(_0x537534['body'],null))['then'](respondWithResult(_0xb9773b,null))[_0x076e('0x44')](handleError(_0xb9773b,null));};exports['destroy']=function(_0x1674f7,_0x315476){return db['MailServerOut']['find']({'where':{'id':_0x1674f7[_0x076e('0x47')]['id']}})['then'](handleEntityNotFound(_0x315476,null))[_0x076e('0x23')](removeEntity(_0x315476,null))[_0x076e('0x44')](handleError(_0x315476,null));}; \ No newline at end of file +var _0xbc87=['status','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','end','name','send','MailServerOut','rawAttributes','fieldName','type','key','map','keys','filters','intersection','model','query','attributes','length','sort','where','filter','merge','VIRTUAL','options','includeAll','include','findAll','params','fields','find','create','body','catch','html-pdf','zip-dir','fast-json-patch','request-promise','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus'];(function(_0x243b59,_0x3f9495){var _0x3e1676=function(_0x354052){while(--_0x354052){_0x243b59['push'](_0x243b59['shift']());}};_0x3e1676(++_0x3f9495);}(_0xbc87,0x144));var _0x7bc8=function(_0x26035d,_0xc68032){_0x26035d=_0x26035d-0x0;var _0x18de85=_0xbc87[_0x26035d];return _0x18de85;};'use strict';var pdf=require(_0x7bc8('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x7bc8('0x1'));var jsonpatch=require(_0x7bc8('0x2'));var rp=require(_0x7bc8('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x7bc8('0x4'));var util=require(_0x7bc8('0x5'));var path=require(_0x7bc8('0x6'));var sox=require(_0x7bc8('0x7'));var csv=require(_0x7bc8('0x8'));var ejs=require(_0x7bc8('0x9'));var fs=require('fs');var _=require(_0x7bc8('0xa'));var squel=require(_0x7bc8('0xb'));var crypto=require(_0x7bc8('0xc'));var jsforce=require(_0x7bc8('0xd'));var deskjs=require(_0x7bc8('0xe'));var toCsv=require(_0x7bc8('0x8'));var querystring=require(_0x7bc8('0xf'));var Papa=require(_0x7bc8('0x10'));var Redis=require(_0x7bc8('0x11'));var authService=require(_0x7bc8('0x12'));var qs=require(_0x7bc8('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x7bc8('0x14'));var logger=require('../../config/logger')(_0x7bc8('0x15'));var utils=require(_0x7bc8('0x16'));var config=require(_0x7bc8('0x17'));var db=require(_0x7bc8('0x18'))['db'];function respondWithStatusCode(_0x39d4f8,_0x41a2be){_0x41a2be=_0x41a2be||0xcc;return function(_0x4cd0ff){if(_0x4cd0ff){return _0x39d4f8[_0x7bc8('0x19')](_0x41a2be);}return _0x39d4f8[_0x7bc8('0x1a')](_0x41a2be)['end']();};}function respondWithResult(_0x32d58c,_0x4ebdfe){_0x4ebdfe=_0x4ebdfe||0xc8;return function(_0x11f135){if(_0x11f135){return _0x32d58c[_0x7bc8('0x1a')](_0x4ebdfe)[_0x7bc8('0x1b')](_0x11f135);}};}function respondWithFilteredResult(_0x2a1069,_0x2e0bcd){return function(_0x499417){if(_0x499417){var _0x4270cb=_0x499417[_0x7bc8('0x1c')],_0x47fb8f=_0x2e0bcd[_0x7bc8('0x1d')],_0x3c349d=_0x2e0bcd[_0x7bc8('0x1d')]+_0x2e0bcd[_0x7bc8('0x1e')],_0x5d80fb;if(_0x3c349d>=_0x4270cb){_0x3c349d=_0x4270cb;_0x5d80fb=0xc8;}else{_0x5d80fb=0xce;}_0x2a1069[_0x7bc8('0x1a')](_0x5d80fb);return _0x2a1069[_0x7bc8('0x1f')](_0x7bc8('0x20'),_0x47fb8f+'-'+_0x3c349d+'/'+_0x4270cb)['json'](_0x499417);}return null;};}function patchUpdates(_0x5b4968){return function(_0x381910){try{jsonpatch[_0x7bc8('0x21')](_0x381910,_0x5b4968,!![]);}catch(_0x67c835){return BPromise[_0x7bc8('0x22')](_0x67c835);}return _0x381910[_0x7bc8('0x23')]();};}function saveUpdates(_0x5f15cb,_0x141b48){return function(_0x4a1042){if(_0x4a1042){return _0x4a1042[_0x7bc8('0x24')](_0x5f15cb)[_0x7bc8('0x25')](function(_0x13595d){return _0x13595d;});}return null;};}function removeEntity(_0x42a6d8,_0x1718a2){return function(_0x1ab2a8){if(_0x1ab2a8){return _0x1ab2a8[_0x7bc8('0x26')]()['then'](function(){_0x42a6d8[_0x7bc8('0x1a')](0xcc)[_0x7bc8('0x27')]();});}};}function handleEntityNotFound(_0x242c15,_0x1b6e4b){return function(_0x37828c){if(!_0x37828c){_0x242c15['sendStatus'](0x194);}return _0x37828c;};}function handleError(_0x4f2b53,_0x3130bf){_0x3130bf=_0x3130bf||0x1f4;return function(_0x26e4a5){logger['error'](_0x26e4a5['stack']);if(_0x26e4a5[_0x7bc8('0x28')]){delete _0x26e4a5[_0x7bc8('0x28')];}_0x4f2b53['status'](_0x3130bf)[_0x7bc8('0x29')](_0x26e4a5);};}exports['index']=function(_0x16b2fb,_0x3757fa){var _0x629238={},_0xf943d={},_0x35db77={'count':0x0,'rows':[]};var _0x1e7ca4=_['map'](db[_0x7bc8('0x2a')][_0x7bc8('0x2b')],function(_0x1fdc37){return{'name':_0x1fdc37[_0x7bc8('0x2c')],'type':_0x1fdc37[_0x7bc8('0x2d')][_0x7bc8('0x2e')]};});_0xf943d['model']=_[_0x7bc8('0x2f')](_0x1e7ca4,_0x7bc8('0x28'));_0xf943d['query']=_[_0x7bc8('0x30')](_0x16b2fb['query']);_0xf943d[_0x7bc8('0x31')]=_[_0x7bc8('0x32')](_0xf943d[_0x7bc8('0x33')],_0xf943d[_0x7bc8('0x34')]);_0x629238[_0x7bc8('0x35')]=_[_0x7bc8('0x32')](_0xf943d[_0x7bc8('0x33')],qs['fields'](_0x16b2fb[_0x7bc8('0x34')]['fields']));_0x629238[_0x7bc8('0x35')]=_0x629238[_0x7bc8('0x35')][_0x7bc8('0x36')]?_0x629238['attributes']:_0xf943d['model'];if(!_0x16b2fb[_0x7bc8('0x34')]['hasOwnProperty']('nolimit')){_0x629238[_0x7bc8('0x1e')]=qs[_0x7bc8('0x1e')](_0x16b2fb[_0x7bc8('0x34')][_0x7bc8('0x1e')]);_0x629238[_0x7bc8('0x1d')]=qs['offset'](_0x16b2fb[_0x7bc8('0x34')][_0x7bc8('0x1d')]);}_0x629238['order']=qs[_0x7bc8('0x37')](_0x16b2fb[_0x7bc8('0x34')][_0x7bc8('0x37')]);_0x629238[_0x7bc8('0x38')]=qs[_0x7bc8('0x31')](_['pick'](_0x16b2fb[_0x7bc8('0x34')],_0xf943d['filters']),_0x1e7ca4);if(_0x16b2fb[_0x7bc8('0x34')][_0x7bc8('0x39')]){_0x629238['where']=_[_0x7bc8('0x3a')](_0x629238[_0x7bc8('0x38')],{'$or':_['map'](_0x1e7ca4,function(_0x4fc2ce){if(_0x4fc2ce[_0x7bc8('0x2d')]!==_0x7bc8('0x3b')){var _0x2d5e53={};_0x2d5e53[_0x4fc2ce['name']]={'$like':'%'+_0x16b2fb[_0x7bc8('0x34')]['filter']+'%'};return _0x2d5e53;}})});}_0x629238=_[_0x7bc8('0x3a')]({},_0x629238,_0x16b2fb[_0x7bc8('0x3c')]);var _0x58472e={'where':_0x629238[_0x7bc8('0x38')]};return db[_0x7bc8('0x2a')][_0x7bc8('0x1c')](_0x58472e)[_0x7bc8('0x25')](function(_0x56f8bd){_0x35db77[_0x7bc8('0x1c')]=_0x56f8bd;if(_0x16b2fb[_0x7bc8('0x34')][_0x7bc8('0x3d')]){_0x629238[_0x7bc8('0x3e')]=[{'all':!![]}];}return db['MailServerOut'][_0x7bc8('0x3f')](_0x629238);})[_0x7bc8('0x25')](function(_0x44f829){_0x35db77['rows']=_0x44f829;return _0x35db77;})['then'](respondWithFilteredResult(_0x3757fa,_0x629238))['catch'](handleError(_0x3757fa,null));};exports['show']=function(_0x362d89,_0x3f8770){var _0xc6c9f6={'raw':!![],'where':{'id':_0x362d89[_0x7bc8('0x40')]['id']}},_0x4c673c={};_0x4c673c[_0x7bc8('0x33')]=_[_0x7bc8('0x30')](db[_0x7bc8('0x2a')][_0x7bc8('0x2b')]);_0x4c673c['query']=_['keys'](_0x362d89[_0x7bc8('0x34')]);_0x4c673c[_0x7bc8('0x31')]=_[_0x7bc8('0x32')](_0x4c673c[_0x7bc8('0x33')],_0x4c673c[_0x7bc8('0x34')]);_0xc6c9f6[_0x7bc8('0x35')]=_[_0x7bc8('0x32')](_0x4c673c[_0x7bc8('0x33')],qs[_0x7bc8('0x41')](_0x362d89['query']['fields']));_0xc6c9f6[_0x7bc8('0x35')]=_0xc6c9f6[_0x7bc8('0x35')][_0x7bc8('0x36')]?_0xc6c9f6[_0x7bc8('0x35')]:_0x4c673c[_0x7bc8('0x33')];if(_0x362d89['query'][_0x7bc8('0x3d')]){_0xc6c9f6['include']=[{'all':!![]}];}_0xc6c9f6=_[_0x7bc8('0x3a')]({},_0xc6c9f6,_0x362d89['options']);return db[_0x7bc8('0x2a')][_0x7bc8('0x42')](_0xc6c9f6)[_0x7bc8('0x25')](handleEntityNotFound(_0x3f8770,null))[_0x7bc8('0x25')](respondWithResult(_0x3f8770,null))['catch'](handleError(_0x3f8770,null));};exports['create']=function(_0x37ec7b,_0xa926df){return db[_0x7bc8('0x2a')][_0x7bc8('0x43')](_0x37ec7b[_0x7bc8('0x44')],{})[_0x7bc8('0x25')](respondWithResult(_0xa926df,0xc9))['catch'](handleError(_0xa926df,null));};exports[_0x7bc8('0x24')]=function(_0xd52c63,_0x2595c9){if(_0xd52c63[_0x7bc8('0x44')]['id']){delete _0xd52c63[_0x7bc8('0x44')]['id'];}return db[_0x7bc8('0x2a')][_0x7bc8('0x42')]({'where':{'id':_0xd52c63[_0x7bc8('0x40')]['id']}})[_0x7bc8('0x25')](handleEntityNotFound(_0x2595c9,null))['then'](saveUpdates(_0xd52c63[_0x7bc8('0x44')],null))[_0x7bc8('0x25')](respondWithResult(_0x2595c9,null))[_0x7bc8('0x45')](handleError(_0x2595c9,null));};exports[_0x7bc8('0x26')]=function(_0x5ecd76,_0x395895){return db[_0x7bc8('0x2a')][_0x7bc8('0x42')]({'where':{'id':_0x5ecd76[_0x7bc8('0x40')]['id']}})[_0x7bc8('0x25')](handleEntityNotFound(_0x395895,null))['then'](removeEntity(_0x395895,null))[_0x7bc8('0x45')](handleError(_0x395895,null));}; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.model.js b/server/api/mailServerOut/mailServerOut.model.js index cdf8752..71dbce2 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 _0x650c=['MailServerOut','mail_servers_out','lodash','util','../../config/logger','bluebird','../../config/environment','./mailServerOut.attributes','exports','define'];(function(_0x3103c6,_0x1b1761){var _0x3a0225=function(_0x1d2fa8){while(--_0x1d2fa8){_0x3103c6['push'](_0x3103c6['shift']());}};_0x3a0225(++_0x1b1761);}(_0x650c,0x98));var _0xc650=function(_0x4a56a5,_0xdec7bc){_0x4a56a5=_0x4a56a5-0x0;var _0x12b40e=_0x650c[_0x4a56a5];return _0x12b40e;};'use strict';var _=require(_0xc650('0x0'));var util=require(_0xc650('0x1'));var logger=require(_0xc650('0x2'))('api');var moment=require('moment');var BPromise=require(_0xc650('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xc650('0x4'));var attributes=require(_0xc650('0x5'));module[_0xc650('0x6')]=function(_0x31c6e0,_0x1e8b28){return _0x31c6e0[_0xc650('0x7')](_0xc650('0x8'),attributes,{'tableName':_0xc650('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x41b9=['api','moment','request-promise','path','rimraf','./mailServerOut.attributes','exports','define','MailServerOut','lodash','../../config/logger'];(function(_0x30f6f6,_0x5f0f90){var _0x43b46a=function(_0x10004e){while(--_0x10004e){_0x30f6f6['push'](_0x30f6f6['shift']());}};_0x43b46a(++_0x5f0f90);}(_0x41b9,0xc4));var _0x941b=function(_0x3c3753,_0x47b6e5){_0x3c3753=_0x3c3753-0x0;var _0x482a5d=_0x41b9[_0x3c3753];return _0x482a5d;};'use strict';var _=require(_0x941b('0x0'));var util=require('util');var logger=require(_0x941b('0x1'))(_0x941b('0x2'));var moment=require(_0x941b('0x3'));var BPromise=require('bluebird');var rp=require(_0x941b('0x4'));var fs=require('fs');var path=require(_0x941b('0x5'));var rimraf=require(_0x941b('0x6'));var config=require('../../config/environment');var attributes=require(_0x941b('0x7'));module[_0x941b('0x8')]=function(_0x108061,_0x1796c8){return _0x108061[_0x941b('0x9')](_0x941b('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 4b2c6af..f06dba2 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 _0x5049=['debug','MailServerOut,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','util','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','MailServerOut,\x20%s,\x20%s','request\x20sent'];(function(_0x1ad256,_0x2ccaea){var _0xe1aade=function(_0x1b117d){while(--_0x1b117d){_0x1ad256['push'](_0x1ad256['shift']());}};_0xe1aade(++_0x2ccaea);}(_0x5049,0xf9));var _0x9504=function(_0x4082ab,_0xe15f7b){_0x4082ab=_0x4082ab-0x0;var _0x2286a9=_0x5049[_0x4082ab];return _0x2286a9;};'use strict';var _=require(_0x9504('0x0'));var util=require(_0x9504('0x1'));var moment=require('moment');var BPromise=require(_0x9504('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x9504('0x3'));var db=require(_0x9504('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x9504('0x5'))(_0x9504('0x6'));var config=require(_0x9504('0x7'));var jayson=require(_0x9504('0x8'));var client=jayson[_0x9504('0x9')][_0x9504('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xd66a33,_0x1fdfe9,_0x269989){return new BPromise(function(_0x9e5ced,_0x28a5dc){return client['request'](_0xd66a33,_0x269989)[_0x9504('0xb')](function(_0x49ebb0){logger[_0x9504('0xc')](_0x9504('0xd'),_0x1fdfe9,_0x9504('0xe'));logger[_0x9504('0xf')](_0x9504('0x10'),_0x1fdfe9,'request\x20sent',JSON[_0x9504('0x11')](_0x49ebb0));if(_0x49ebb0[_0x9504('0x12')]){if(_0x49ebb0[_0x9504('0x12')][_0x9504('0x13')]===0x1f4){logger[_0x9504('0x12')]('MailServerOut,\x20%s,\x20%s',_0x1fdfe9,_0x49ebb0[_0x9504('0x12')][_0x9504('0x14')]);return _0x28a5dc(_0x49ebb0['error']['message']);}logger[_0x9504('0x12')](_0x9504('0xd'),_0x1fdfe9,_0x49ebb0[_0x9504('0x12')]['message']);return _0x9e5ced(_0x49ebb0['error']['message']);}else{logger[_0x9504('0xc')](_0x9504('0xd'),_0x1fdfe9,'request\x20sent');_0x9e5ced(_0x49ebb0['result']['message']);}})[_0x9504('0x15')](function(_0x4e0748){logger[_0x9504('0x12')]('MailServerOut,\x20%s,\x20%s',_0x1fdfe9,_0x4e0748);_0x28a5dc(_0x4e0748);});});} \ No newline at end of file +var _0x4c9c=['stringify','error','code','message','info','lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','request','then','MailServerOut,\x20%s,\x20%s','request\x20sent','debug','MailServerOut,\x20%s,\x20%s,\x20%s'];(function(_0x5b1394,_0x17f08d){var _0x483150=function(_0x1d9539){while(--_0x1d9539){_0x5b1394['push'](_0x5b1394['shift']());}};_0x483150(++_0x17f08d);}(_0x4c9c,0x101));var _0xc4c9=function(_0x19b84f,_0x48765e){_0x19b84f=_0x19b84f-0x0;var _0x18067b=_0x4c9c[_0x19b84f];return _0x18067b;};'use strict';var _=require(_0xc4c9('0x0'));var util=require(_0xc4c9('0x1'));var moment=require('moment');var BPromise=require(_0xc4c9('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xc4c9('0x3'));var db=require(_0xc4c9('0x4'))['db'];var utils=require(_0xc4c9('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0xc4c9('0x6'));var jayson=require(_0xc4c9('0x7'));var client=jayson[_0xc4c9('0x8')][_0xc4c9('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1f6f3f,_0x2f8aeb,_0x387a1f){return new BPromise(function(_0x656673,_0x3f466d){return client[_0xc4c9('0xa')](_0x1f6f3f,_0x387a1f)[_0xc4c9('0xb')](function(_0x5588dd){logger['info'](_0xc4c9('0xc'),_0x2f8aeb,_0xc4c9('0xd'));logger[_0xc4c9('0xe')](_0xc4c9('0xf'),_0x2f8aeb,_0xc4c9('0xd'),JSON[_0xc4c9('0x10')](_0x5588dd));if(_0x5588dd[_0xc4c9('0x11')]){if(_0x5588dd[_0xc4c9('0x11')][_0xc4c9('0x12')]===0x1f4){logger['error'](_0xc4c9('0xc'),_0x2f8aeb,_0x5588dd['error'][_0xc4c9('0x13')]);return _0x3f466d(_0x5588dd[_0xc4c9('0x11')][_0xc4c9('0x13')]);}logger[_0xc4c9('0x11')](_0xc4c9('0xc'),_0x2f8aeb,_0x5588dd['error'][_0xc4c9('0x13')]);return _0x656673(_0x5588dd[_0xc4c9('0x11')][_0xc4c9('0x13')]);}else{logger[_0xc4c9('0x14')](_0xc4c9('0xc'),_0x2f8aeb,_0xc4c9('0xd'));_0x656673(_0x5588dd['result']['message']);}})['catch'](function(_0xa43e94){logger[_0xc4c9('0x11')](_0xc4c9('0xc'),_0x2f8aeb,_0xa43e94);_0x3f466d(_0xa43e94);});});} \ No newline at end of file diff --git a/server/api/mailSubstatus/index.js b/server/api/mailSubstatus/index.js index 63f22b6..dfc91b8 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 _0x72e5=['index','/describe','describe','/:id','show','post','create','put','delete','destroy','exports','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailSubstatus.controller','get','isAuthenticated'];(function(_0x5494d7,_0x41b14f){var _0x4c26bb=function(_0x176e69){while(--_0x176e69){_0x5494d7['push'](_0x5494d7['shift']());}};_0x4c26bb(++_0x41b14f);}(_0x72e5,0x146));var _0x572e=function(_0xe5f89b,_0x3d0d86){_0xe5f89b=_0xe5f89b-0x0;var _0x5a2b24=_0x72e5[_0xe5f89b];return _0x5a2b24;};'use strict';var multer=require('multer');var util=require(_0x572e('0x0'));var path=require(_0x572e('0x1'));var timeout=require(_0x572e('0x2'));var express=require(_0x572e('0x3'));var router=express['Router']();var auth=require(_0x572e('0x4'));var interaction=require(_0x572e('0x5'));var config=require(_0x572e('0x6'));var controller=require(_0x572e('0x7'));router[_0x572e('0x8')]('/',auth[_0x572e('0x9')](),controller[_0x572e('0xa')]);router['get'](_0x572e('0xb'),auth[_0x572e('0x9')](),controller[_0x572e('0xc')]);router[_0x572e('0x8')](_0x572e('0xd'),auth[_0x572e('0x9')](),controller[_0x572e('0xe')]);router[_0x572e('0xf')]('/',auth['isAuthenticated'](),controller[_0x572e('0x10')]);router[_0x572e('0x11')]('/:id',auth['isAuthenticated'](),controller['update']);router[_0x572e('0x12')]('/:id',auth[_0x572e('0x9')](),controller[_0x572e('0x13')]);module[_0x572e('0x14')]=router; \ No newline at end of file +var _0x447b=['update','delete','destroy','exports','multer','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','isAuthenticated','index','describe','get','/:id','post','create','put'];(function(_0x5614a3,_0x1ebbb3){var _0x15f60c=function(_0x213c69){while(--_0x213c69){_0x5614a3['push'](_0x5614a3['shift']());}};_0x15f60c(++_0x1ebbb3);}(_0x447b,0xc2));var _0xb447=function(_0x25cc1b,_0x463bba){_0x25cc1b=_0x25cc1b-0x0;var _0x26cf11=_0x447b[_0x25cc1b];return _0x26cf11;};'use strict';var multer=require(_0xb447('0x0'));var util=require('util');var path=require(_0xb447('0x1'));var timeout=require(_0xb447('0x2'));var express=require(_0xb447('0x3'));var router=express[_0xb447('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0xb447('0x5'));var config=require(_0xb447('0x6'));var controller=require('./mailSubstatus.controller');router['get']('/',auth[_0xb447('0x7')](),controller[_0xb447('0x8')]);router['get']('/describe',auth[_0xb447('0x7')](),controller[_0xb447('0x9')]);router[_0xb447('0xa')](_0xb447('0xb'),auth[_0xb447('0x7')](),controller['show']);router[_0xb447('0xc')]('/',auth[_0xb447('0x7')](),controller[_0xb447('0xd')]);router[_0xb447('0xe')]('/:id',auth['isAuthenticated'](),controller[_0xb447('0xf')]);router[_0xb447('0x10')](_0xb447('0xb'),auth[_0xb447('0x7')](),controller[_0xb447('0x11')]);module[_0xb447('0x12')]=router; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.attributes.js b/server/api/mailSubstatus/mailSubstatus.attributes.js index e619051..402f74a 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 _0x1228=['STRING','sequelize'];(function(_0x20cd17,_0x3cc383){var _0x5d1134=function(_0x573fc7){while(--_0x573fc7){_0x20cd17['push'](_0x20cd17['shift']());}};_0x5d1134(++_0x3cc383);}(_0x1228,0x12f));var _0x8122=function(_0x5b7433,_0x300e84){_0x5b7433=_0x5b7433-0x0;var _0x54aa9f=_0x1228[_0x5b7433];return _0x54aa9f;};'use strict';var Sequelize=require(_0x8122('0x0'));module['exports']={'name':{'type':Sequelize[_0x8122('0x1')],'unique':'name','allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x8122('0x1')]}}; \ No newline at end of file +var _0xa5aa=['sequelize','exports','name','STRING'];(function(_0x4aeb1f,_0x135770){var _0x371689=function(_0x2b647b){while(--_0x2b647b){_0x4aeb1f['push'](_0x4aeb1f['shift']());}};_0x371689(++_0x135770);}(_0xa5aa,0x1ac));var _0xaa5a=function(_0x5eb27c,_0x2af03d){_0x5eb27c=_0x5eb27c-0x0;var _0x1be9a9=_0xa5aa[_0x5eb27c];return _0x1be9a9;};'use strict';var Sequelize=require(_0xaa5a('0x0'));module[_0xaa5a('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0xaa5a('0x2'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0xaa5a('0x3')]}}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.controller.js b/server/api/mailSubstatus/mailSubstatus.controller.js index df16113..80663f1 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 _0xb19a=['squel','crypto','desk.js','querystring','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','end','status','json','count','offset','limit','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','MailSubstatus','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','includeAll','include','findAll','catch','show','params','keys','create','body','find','describe','html-pdf','eml-format','zip-dir','request-promise','moment','bluebird','path','sox','to-csv','ejs','lodash'];(function(_0x557ffb,_0x19f752){var _0x10bd59=function(_0x26f5bf){while(--_0x26f5bf){_0x557ffb['push'](_0x557ffb['shift']());}};_0x10bd59(++_0x19f752);}(_0xb19a,0x11d));var _0xab19=function(_0x30ec23,_0x146fee){_0x30ec23=_0x30ec23-0x0;var _0x4a85cd=_0xb19a[_0x30ec23];return _0x4a85cd;};'use strict';var pdf=require(_0xab19('0x0'));var emlformat=require(_0xab19('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xab19('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xab19('0x3'));var moment=require(_0xab19('0x4'));var BPromise=require(_0xab19('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0xab19('0x6'));var sox=require(_0xab19('0x7'));var csv=require(_0xab19('0x8'));var ejs=require(_0xab19('0x9'));var fs=require('fs');var _=require(_0xab19('0xa'));var squel=require(_0xab19('0xb'));var crypto=require(_0xab19('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xab19('0xd'));var toCsv=require('to-csv');var querystring=require(_0xab19('0xe'));var Papa=require('papaparse');var Redis=require(_0xab19('0xf'));var authService=require('../../components/auth/service');var qs=require(_0xab19('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xab19('0x11'));var logger=require(_0xab19('0x12'))(_0xab19('0x13'));var utils=require(_0xab19('0x14'));var config=require(_0xab19('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1a619c,_0x35722f){_0x35722f=_0x35722f||0xcc;return function(_0x1502ec){if(_0x1502ec){return _0x1a619c[_0xab19('0x16')](_0x35722f);}return _0x1a619c['status'](_0x35722f)[_0xab19('0x17')]();};}function respondWithResult(_0xb871af,_0x5c6321){_0x5c6321=_0x5c6321||0xc8;return function(_0x2f59d9){if(_0x2f59d9){return _0xb871af[_0xab19('0x18')](_0x5c6321)[_0xab19('0x19')](_0x2f59d9);}};}function respondWithFilteredResult(_0x335120,_0x31db0f){return function(_0x5d09c1){if(_0x5d09c1){var _0x50ff64=_0x5d09c1[_0xab19('0x1a')],_0x326432=_0x31db0f[_0xab19('0x1b')],_0x20d063=_0x31db0f[_0xab19('0x1b')]+_0x31db0f[_0xab19('0x1c')],_0x329587;if(_0x20d063>=_0x50ff64){_0x20d063=_0x50ff64;_0x329587=0xc8;}else{_0x329587=0xce;}_0x335120[_0xab19('0x18')](_0x329587);return _0x335120['set'](_0xab19('0x1d'),_0x326432+'-'+_0x20d063+'/'+_0x50ff64)[_0xab19('0x19')](_0x5d09c1);}return null;};}function patchUpdates(_0x4703cc){return function(_0x556b8e){try{jsonpatch[_0xab19('0x1e')](_0x556b8e,_0x4703cc,!![]);}catch(_0x13f212){return BPromise[_0xab19('0x1f')](_0x13f212);}return _0x556b8e[_0xab19('0x20')]();};}function saveUpdates(_0x5e457b,_0x55890f){return function(_0x1e0da6){if(_0x1e0da6){return _0x1e0da6[_0xab19('0x21')](_0x5e457b)[_0xab19('0x22')](function(_0x4777e2){return _0x4777e2;});}return null;};}function removeEntity(_0x43a3bd,_0x141157){return function(_0x3028df){if(_0x3028df){return _0x3028df[_0xab19('0x23')]()[_0xab19('0x22')](function(){_0x43a3bd['status'](0xcc)[_0xab19('0x17')]();});}};}function handleEntityNotFound(_0x283375,_0x4ed383){return function(_0x4ab83d){if(!_0x4ab83d){_0x283375['sendStatus'](0x194);}return _0x4ab83d;};}function handleError(_0x56553a,_0xcd4ef6){_0xcd4ef6=_0xcd4ef6||0x1f4;return function(_0x119a50){logger[_0xab19('0x24')](_0x119a50[_0xab19('0x25')]);if(_0x119a50[_0xab19('0x26')]){delete _0x119a50[_0xab19('0x26')];}_0x56553a[_0xab19('0x18')](_0xcd4ef6)[_0xab19('0x27')](_0x119a50);};}exports[_0xab19('0x28')]=function(_0x4b6bff,_0x51c471){var _0x1275f1={},_0x1a9077={},_0x456db9={'count':0x0,'rows':[]};var _0x589667=_[_0xab19('0x29')](db[_0xab19('0x2a')][_0xab19('0x2b')],function(_0x5aa143){return{'name':_0x5aa143[_0xab19('0x2c')],'type':_0x5aa143[_0xab19('0x2d')][_0xab19('0x2e')]};});_0x1a9077[_0xab19('0x2f')]=_[_0xab19('0x29')](_0x589667,_0xab19('0x26'));_0x1a9077[_0xab19('0x30')]=_['keys'](_0x4b6bff[_0xab19('0x30')]);_0x1a9077[_0xab19('0x31')]=_[_0xab19('0x32')](_0x1a9077[_0xab19('0x2f')],_0x1a9077[_0xab19('0x30')]);_0x1275f1[_0xab19('0x33')]=_[_0xab19('0x32')](_0x1a9077['model'],qs[_0xab19('0x34')](_0x4b6bff[_0xab19('0x30')][_0xab19('0x34')]));_0x1275f1[_0xab19('0x33')]=_0x1275f1['attributes'][_0xab19('0x35')]?_0x1275f1['attributes']:_0x1a9077[_0xab19('0x2f')];if(!_0x4b6bff[_0xab19('0x30')][_0xab19('0x36')](_0xab19('0x37'))){_0x1275f1[_0xab19('0x1c')]=qs[_0xab19('0x1c')](_0x4b6bff[_0xab19('0x30')][_0xab19('0x1c')]);_0x1275f1[_0xab19('0x1b')]=qs[_0xab19('0x1b')](_0x4b6bff[_0xab19('0x30')][_0xab19('0x1b')]);}_0x1275f1[_0xab19('0x38')]=qs[_0xab19('0x39')](_0x4b6bff[_0xab19('0x30')][_0xab19('0x39')]);_0x1275f1[_0xab19('0x3a')]=qs['filters'](_[_0xab19('0x3b')](_0x4b6bff[_0xab19('0x30')],_0x1a9077[_0xab19('0x31')]),_0x589667);if(_0x4b6bff['query'][_0xab19('0x3c')]){_0x1275f1[_0xab19('0x3a')]=_[_0xab19('0x3d')](_0x1275f1[_0xab19('0x3a')],{'$or':_[_0xab19('0x29')](_0x589667,function(_0x200011){if(_0x200011[_0xab19('0x2d')]!=='VIRTUAL'){var _0xecd029={};_0xecd029[_0x200011[_0xab19('0x26')]]={'$like':'%'+_0x4b6bff[_0xab19('0x30')][_0xab19('0x3c')]+'%'};return _0xecd029;}})});}_0x1275f1=_[_0xab19('0x3d')]({},_0x1275f1,_0x4b6bff[_0xab19('0x3e')]);var _0x141a1d={'where':_0x1275f1[_0xab19('0x3a')]};return db[_0xab19('0x2a')]['count'](_0x141a1d)['then'](function(_0x149edc){_0x456db9[_0xab19('0x1a')]=_0x149edc;if(_0x4b6bff[_0xab19('0x30')][_0xab19('0x3f')]){_0x1275f1[_0xab19('0x40')]=[{'all':!![]}];}return db[_0xab19('0x2a')][_0xab19('0x41')](_0x1275f1);})['then'](function(_0xb03b77){_0x456db9['rows']=_0xb03b77;return _0x456db9;})[_0xab19('0x22')](respondWithFilteredResult(_0x51c471,_0x1275f1))[_0xab19('0x42')](handleError(_0x51c471,null));};exports[_0xab19('0x43')]=function(_0xb8aa4f,_0xe7f2a4){var _0x159d54={'raw':!![],'where':{'id':_0xb8aa4f[_0xab19('0x44')]['id']}},_0x210549={};_0x210549['model']=_[_0xab19('0x45')](db['MailSubstatus'][_0xab19('0x2b')]);_0x210549[_0xab19('0x30')]=_['keys'](_0xb8aa4f['query']);_0x210549[_0xab19('0x31')]=_['intersection'](_0x210549[_0xab19('0x2f')],_0x210549[_0xab19('0x30')]);_0x159d54[_0xab19('0x33')]=_['intersection'](_0x210549['model'],qs[_0xab19('0x34')](_0xb8aa4f['query'][_0xab19('0x34')]));_0x159d54[_0xab19('0x33')]=_0x159d54[_0xab19('0x33')][_0xab19('0x35')]?_0x159d54[_0xab19('0x33')]:_0x210549[_0xab19('0x2f')];if(_0xb8aa4f[_0xab19('0x30')]['includeAll']){_0x159d54[_0xab19('0x40')]=[{'all':!![]}];}_0x159d54=_['merge']({},_0x159d54,_0xb8aa4f[_0xab19('0x3e')]);return db[_0xab19('0x2a')]['find'](_0x159d54)[_0xab19('0x22')](handleEntityNotFound(_0xe7f2a4,null))[_0xab19('0x22')](respondWithResult(_0xe7f2a4,null))['catch'](handleError(_0xe7f2a4,null));};exports[_0xab19('0x46')]=function(_0x3f5398,_0x41058a){return db[_0xab19('0x2a')][_0xab19('0x46')](_0x3f5398[_0xab19('0x47')],{})[_0xab19('0x22')](respondWithResult(_0x41058a,0xc9))[_0xab19('0x42')](handleError(_0x41058a,null));};exports[_0xab19('0x21')]=function(_0x33608a,_0x4d2597){if(_0x33608a[_0xab19('0x47')]['id']){delete _0x33608a['body']['id'];}return db['MailSubstatus'][_0xab19('0x48')]({'where':{'id':_0x33608a[_0xab19('0x44')]['id']}})[_0xab19('0x22')](handleEntityNotFound(_0x4d2597,null))[_0xab19('0x22')](saveUpdates(_0x33608a[_0xab19('0x47')],null))[_0xab19('0x22')](respondWithResult(_0x4d2597,null))['catch'](handleError(_0x4d2597,null));};exports[_0xab19('0x23')]=function(_0x9636db,_0x3d9aed){return db[_0xab19('0x2a')]['find']({'where':{'id':_0x9636db[_0xab19('0x44')]['id']}})['then'](handleEntityNotFound(_0x3d9aed,null))['then'](removeEntity(_0x3d9aed,null))['catch'](handleError(_0x3d9aed,null));};exports['describe']=function(_0x483a02,_0x2df667){return db[_0xab19('0x2a')][_0xab19('0x49')]()[_0xab19('0x22')](respondWithResult(_0x2df667,null))['catch'](handleError(_0x2df667,null));}; \ No newline at end of file +var _0xe7d9=['send','index','map','MailSubstatus','fieldName','type','key','model','query','keys','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','filter','where','merge','VIRTUAL','includeAll','rows','show','filters','include','options','catch','create','body','find','params','describe','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','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/environment','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','update','destroy','then','stack','name'];(function(_0x32fee3,_0x25d761){var _0x4d560e=function(_0x25b630){while(--_0x25b630){_0x32fee3['push'](_0x32fee3['shift']());}};_0x4d560e(++_0x25d761);}(_0xe7d9,0xbe));var _0x9e7d=function(_0x31669f,_0x51ad35){_0x31669f=_0x31669f-0x0;var _0x33f0fb=_0xe7d9[_0x31669f];return _0x33f0fb;};'use strict';var pdf=require(_0x9e7d('0x0'));var emlformat=require(_0x9e7d('0x1'));var rimraf=require(_0x9e7d('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x9e7d('0x3'));var rp=require(_0x9e7d('0x4'));var moment=require(_0x9e7d('0x5'));var BPromise=require(_0x9e7d('0x6'));var Mustache=require(_0x9e7d('0x7'));var util=require(_0x9e7d('0x8'));var path=require(_0x9e7d('0x9'));var sox=require(_0x9e7d('0xa'));var csv=require(_0x9e7d('0xb'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x9e7d('0xc'));var squel=require(_0x9e7d('0xd'));var crypto=require(_0x9e7d('0xe'));var jsforce=require(_0x9e7d('0xf'));var deskjs=require(_0x9e7d('0x10'));var toCsv=require(_0x9e7d('0xb'));var querystring=require(_0x9e7d('0x11'));var Papa=require(_0x9e7d('0x12'));var Redis=require(_0x9e7d('0x13'));var authService=require(_0x9e7d('0x14'));var qs=require(_0x9e7d('0x15'));var as=require(_0x9e7d('0x16'));var hardwareService=require(_0x9e7d('0x17'));var logger=require(_0x9e7d('0x18'))(_0x9e7d('0x19'));var utils=require('../../config/utils');var config=require(_0x9e7d('0x1a'));var db=require(_0x9e7d('0x1b'))['db'];function respondWithStatusCode(_0x28571c,_0x53c8c9){_0x53c8c9=_0x53c8c9||0xcc;return function(_0x1da418){if(_0x1da418){return _0x28571c[_0x9e7d('0x1c')](_0x53c8c9);}return _0x28571c[_0x9e7d('0x1d')](_0x53c8c9)[_0x9e7d('0x1e')]();};}function respondWithResult(_0x859008,_0xb865c1){_0xb865c1=_0xb865c1||0xc8;return function(_0x5927e6){if(_0x5927e6){return _0x859008['status'](_0xb865c1)[_0x9e7d('0x1f')](_0x5927e6);}};}function respondWithFilteredResult(_0x12a347,_0x40f597){return function(_0x1ef893){if(_0x1ef893){var _0x5949b9=_0x1ef893[_0x9e7d('0x20')],_0x3286aa=_0x40f597[_0x9e7d('0x21')],_0x2312ab=_0x40f597[_0x9e7d('0x21')]+_0x40f597[_0x9e7d('0x22')],_0x1af334;if(_0x2312ab>=_0x5949b9){_0x2312ab=_0x5949b9;_0x1af334=0xc8;}else{_0x1af334=0xce;}_0x12a347[_0x9e7d('0x1d')](_0x1af334);return _0x12a347[_0x9e7d('0x23')](_0x9e7d('0x24'),_0x3286aa+'-'+_0x2312ab+'/'+_0x5949b9)[_0x9e7d('0x1f')](_0x1ef893);}return null;};}function patchUpdates(_0x53c268){return function(_0x4af629){try{jsonpatch[_0x9e7d('0x25')](_0x4af629,_0x53c268,!![]);}catch(_0x2640e0){return BPromise[_0x9e7d('0x26')](_0x2640e0);}return _0x4af629['save']();};}function saveUpdates(_0x1b1508,_0x32da38){return function(_0x2c243e){if(_0x2c243e){return _0x2c243e[_0x9e7d('0x27')](_0x1b1508)['then'](function(_0x5ce19a){return _0x5ce19a;});}return null;};}function removeEntity(_0x3ea187,_0x477bf9){return function(_0x2f7e69){if(_0x2f7e69){return _0x2f7e69[_0x9e7d('0x28')]()[_0x9e7d('0x29')](function(){_0x3ea187[_0x9e7d('0x1d')](0xcc)[_0x9e7d('0x1e')]();});}};}function handleEntityNotFound(_0x12f787,_0x5be604){return function(_0x765c09){if(!_0x765c09){_0x12f787[_0x9e7d('0x1c')](0x194);}return _0x765c09;};}function handleError(_0x3ac256,_0x22586e){_0x22586e=_0x22586e||0x1f4;return function(_0xb80fa4){logger['error'](_0xb80fa4[_0x9e7d('0x2a')]);if(_0xb80fa4[_0x9e7d('0x2b')]){delete _0xb80fa4[_0x9e7d('0x2b')];}_0x3ac256[_0x9e7d('0x1d')](_0x22586e)[_0x9e7d('0x2c')](_0xb80fa4);};}exports[_0x9e7d('0x2d')]=function(_0x3a220c,_0x45f33c){var _0x107f47={},_0x409683={},_0x272495={'count':0x0,'rows':[]};var _0x49915c=_[_0x9e7d('0x2e')](db[_0x9e7d('0x2f')]['rawAttributes'],function(_0x33609b){return{'name':_0x33609b[_0x9e7d('0x30')],'type':_0x33609b[_0x9e7d('0x31')][_0x9e7d('0x32')]};});_0x409683[_0x9e7d('0x33')]=_['map'](_0x49915c,'name');_0x409683[_0x9e7d('0x34')]=_[_0x9e7d('0x35')](_0x3a220c['query']);_0x409683['filters']=_[_0x9e7d('0x36')](_0x409683[_0x9e7d('0x33')],_0x409683[_0x9e7d('0x34')]);_0x107f47['attributes']=_[_0x9e7d('0x36')](_0x409683[_0x9e7d('0x33')],qs[_0x9e7d('0x37')](_0x3a220c['query'][_0x9e7d('0x37')]));_0x107f47[_0x9e7d('0x38')]=_0x107f47[_0x9e7d('0x38')][_0x9e7d('0x39')]?_0x107f47[_0x9e7d('0x38')]:_0x409683[_0x9e7d('0x33')];if(!_0x3a220c[_0x9e7d('0x34')][_0x9e7d('0x3a')](_0x9e7d('0x3b'))){_0x107f47[_0x9e7d('0x22')]=qs[_0x9e7d('0x22')](_0x3a220c[_0x9e7d('0x34')][_0x9e7d('0x22')]);_0x107f47[_0x9e7d('0x21')]=qs[_0x9e7d('0x21')](_0x3a220c[_0x9e7d('0x34')]['offset']);}_0x107f47[_0x9e7d('0x3c')]=qs['sort'](_0x3a220c[_0x9e7d('0x34')][_0x9e7d('0x3d')]);_0x107f47['where']=qs['filters'](_['pick'](_0x3a220c['query'],_0x409683['filters']),_0x49915c);if(_0x3a220c[_0x9e7d('0x34')][_0x9e7d('0x3e')]){_0x107f47[_0x9e7d('0x3f')]=_[_0x9e7d('0x40')](_0x107f47[_0x9e7d('0x3f')],{'$or':_[_0x9e7d('0x2e')](_0x49915c,function(_0x572bc5){if(_0x572bc5[_0x9e7d('0x31')]!==_0x9e7d('0x41')){var _0x1e14ad={};_0x1e14ad[_0x572bc5['name']]={'$like':'%'+_0x3a220c[_0x9e7d('0x34')][_0x9e7d('0x3e')]+'%'};return _0x1e14ad;}})});}_0x107f47=_[_0x9e7d('0x40')]({},_0x107f47,_0x3a220c['options']);var _0x29ee8d={'where':_0x107f47['where']};return db[_0x9e7d('0x2f')][_0x9e7d('0x20')](_0x29ee8d)[_0x9e7d('0x29')](function(_0x23a6de){_0x272495[_0x9e7d('0x20')]=_0x23a6de;if(_0x3a220c['query'][_0x9e7d('0x42')]){_0x107f47['include']=[{'all':!![]}];}return db[_0x9e7d('0x2f')]['findAll'](_0x107f47);})[_0x9e7d('0x29')](function(_0x154a33){_0x272495[_0x9e7d('0x43')]=_0x154a33;return _0x272495;})[_0x9e7d('0x29')](respondWithFilteredResult(_0x45f33c,_0x107f47))['catch'](handleError(_0x45f33c,null));};exports[_0x9e7d('0x44')]=function(_0x13d176,_0x1cd66d){var _0x2ec352={'raw':!![],'where':{'id':_0x13d176['params']['id']}},_0x14fbb9={};_0x14fbb9[_0x9e7d('0x33')]=_[_0x9e7d('0x35')](db[_0x9e7d('0x2f')]['rawAttributes']);_0x14fbb9[_0x9e7d('0x34')]=_[_0x9e7d('0x35')](_0x13d176[_0x9e7d('0x34')]);_0x14fbb9[_0x9e7d('0x45')]=_['intersection'](_0x14fbb9[_0x9e7d('0x33')],_0x14fbb9[_0x9e7d('0x34')]);_0x2ec352[_0x9e7d('0x38')]=_[_0x9e7d('0x36')](_0x14fbb9[_0x9e7d('0x33')],qs[_0x9e7d('0x37')](_0x13d176[_0x9e7d('0x34')][_0x9e7d('0x37')]));_0x2ec352[_0x9e7d('0x38')]=_0x2ec352[_0x9e7d('0x38')]['length']?_0x2ec352['attributes']:_0x14fbb9['model'];if(_0x13d176[_0x9e7d('0x34')][_0x9e7d('0x42')]){_0x2ec352[_0x9e7d('0x46')]=[{'all':!![]}];}_0x2ec352=_[_0x9e7d('0x40')]({},_0x2ec352,_0x13d176[_0x9e7d('0x47')]);return db[_0x9e7d('0x2f')]['find'](_0x2ec352)[_0x9e7d('0x29')](handleEntityNotFound(_0x1cd66d,null))['then'](respondWithResult(_0x1cd66d,null))[_0x9e7d('0x48')](handleError(_0x1cd66d,null));};exports['create']=function(_0x1be751,_0x222872){return db[_0x9e7d('0x2f')][_0x9e7d('0x49')](_0x1be751['body'],{})[_0x9e7d('0x29')](respondWithResult(_0x222872,0xc9))[_0x9e7d('0x48')](handleError(_0x222872,null));};exports[_0x9e7d('0x27')]=function(_0xe342ce,_0x365976){if(_0xe342ce[_0x9e7d('0x4a')]['id']){delete _0xe342ce[_0x9e7d('0x4a')]['id'];}return db['MailSubstatus'][_0x9e7d('0x4b')]({'where':{'id':_0xe342ce[_0x9e7d('0x4c')]['id']}})[_0x9e7d('0x29')](handleEntityNotFound(_0x365976,null))[_0x9e7d('0x29')](saveUpdates(_0xe342ce[_0x9e7d('0x4a')],null))[_0x9e7d('0x29')](respondWithResult(_0x365976,null))[_0x9e7d('0x48')](handleError(_0x365976,null));};exports['destroy']=function(_0x187873,_0x5ee406){return db['MailSubstatus'][_0x9e7d('0x4b')]({'where':{'id':_0x187873[_0x9e7d('0x4c')]['id']}})[_0x9e7d('0x29')](handleEntityNotFound(_0x5ee406,null))[_0x9e7d('0x29')](removeEntity(_0x5ee406,null))[_0x9e7d('0x48')](handleError(_0x5ee406,null));};exports[_0x9e7d('0x4d')]=function(_0x2caaa1,_0x1e3171){return db[_0x9e7d('0x2f')]['describe']()[_0x9e7d('0x29')](respondWithResult(_0x1e3171,null))[_0x9e7d('0x48')](handleError(_0x1e3171,null));}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.model.js b/server/api/mailSubstatus/mailSubstatus.model.js index 2444ce9..487d04a 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 _0x0c65=['bluebird','path','rimraf','../../config/environment','./mailSubstatus.attributes','exports','define','MailSubstatus','lodash','util','../../config/logger','api'];(function(_0x469a3c,_0x5ebc10){var _0x968f4=function(_0x22403b){while(--_0x22403b){_0x469a3c['push'](_0x469a3c['shift']());}};_0x968f4(++_0x5ebc10);}(_0x0c65,0x1a0));var _0x50c6=function(_0x3eb570,_0x489a5a){_0x3eb570=_0x3eb570-0x0;var _0x270bd3=_0x0c65[_0x3eb570];return _0x270bd3;};'use strict';var _=require(_0x50c6('0x0'));var util=require(_0x50c6('0x1'));var logger=require(_0x50c6('0x2'))(_0x50c6('0x3'));var moment=require('moment');var BPromise=require(_0x50c6('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x50c6('0x5'));var rimraf=require(_0x50c6('0x6'));var config=require(_0x50c6('0x7'));var attributes=require(_0x50c6('0x8'));module[_0x50c6('0x9')]=function(_0xcfee2c,_0x87e320){return _0xcfee2c[_0x50c6('0xa')](_0x50c6('0xb'),attributes,{'tableName':'mail_substatuses','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2a1b=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./mailSubstatus.attributes','exports','define','MailSubstatus'];(function(_0x59949c,_0x5c2b77){var _0x3349c7=function(_0x2193f9){while(--_0x2193f9){_0x59949c['push'](_0x59949c['shift']());}};_0x3349c7(++_0x5c2b77);}(_0x2a1b,0xee));var _0xb2a1=function(_0x48001f,_0x1f6fe9){_0x48001f=_0x48001f-0x0;var _0x1a5f6b=_0x2a1b[_0x48001f];return _0x1a5f6b;};'use strict';var _=require(_0xb2a1('0x0'));var util=require(_0xb2a1('0x1'));var logger=require(_0xb2a1('0x2'))(_0xb2a1('0x3'));var moment=require(_0xb2a1('0x4'));var BPromise=require(_0xb2a1('0x5'));var rp=require(_0xb2a1('0x6'));var fs=require('fs');var path=require(_0xb2a1('0x7'));var rimraf=require(_0xb2a1('0x8'));var config=require(_0xb2a1('0x9'));var attributes=require(_0xb2a1('0xa'));module[_0xb2a1('0xb')]=function(_0x320513,_0x231380){return _0x320513[_0xb2a1('0xc')](_0xb2a1('0xd'),attributes,{'tableName':'mail_substatuses','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.rpc.js b/server/api/mailSubstatus/mailSubstatus.rpc.js index 2a61015..2dc7be0 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 _0xcb91=['stringify','error','code','message','catch','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','request','info','MailSubstatus,\x20%s,\x20%s','request\x20sent','debug','MailSubstatus,\x20%s,\x20%s,\x20%s'];(function(_0x341acf,_0x3b91cb){var _0x2c3af4=function(_0x2cb792){while(--_0x2cb792){_0x341acf['push'](_0x341acf['shift']());}};_0x2c3af4(++_0x3b91cb);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x2ed7d1,_0x363741){_0x2ed7d1=_0x2ed7d1-0x0;var _0x38ae3c=_0xcb91[_0x2ed7d1];return _0x38ae3c;};'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')]('MailSubstatus,\x20%s,\x20%s',_0x4ffe20,_0x567139['error']['message']);return _0x59d1be(_0x567139[_0x1cb9('0x10')][_0x1cb9('0x12')]);}logger[_0x1cb9('0x10')](_0x1cb9('0xb'),_0x4ffe20,_0x567139['error'][_0x1cb9('0x12')]);return _0x12567c(_0x567139[_0x1cb9('0x10')][_0x1cb9('0x12')]);}else{logger[_0x1cb9('0xa')](_0x1cb9('0xb'),_0x4ffe20,'request\x20sent');_0x12567c(_0x567139['result'][_0x1cb9('0x12')]);}})[_0x1cb9('0x13')](function(_0x3904b7){logger[_0x1cb9('0x10')](_0x1cb9('0xb'),_0x4ffe20,_0x3904b7);_0x59d1be(_0x3904b7);});});} \ No newline at end of file +var _0x9bde=['code','message','MailSubstatus,\x20%s,\x20%s','result','catch','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','debug','MailSubstatus,\x20%s,\x20%s,\x20%s','request\x20sent','error'];(function(_0x414669,_0x5bc546){var _0xe2b5cd=function(_0x1e65f8){while(--_0x1e65f8){_0x414669['push'](_0x414669['shift']());}};_0xe2b5cd(++_0x5bc546);}(_0x9bde,0xe1));var _0xe9bd=function(_0x1d013c,_0x4f2629){_0x1d013c=_0x1d013c-0x0;var _0x4b6d81=_0x9bde[_0x1d013c];return _0x4b6d81;};'use strict';var _=require('lodash');var util=require(_0xe9bd('0x0'));var moment=require('moment');var BPromise=require(_0xe9bd('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xe9bd('0x2'));var db=require(_0xe9bd('0x3'))['db'];var utils=require(_0xe9bd('0x4'));var logger=require(_0xe9bd('0x5'))(_0xe9bd('0x6'));var config=require(_0xe9bd('0x7'));var jayson=require(_0xe9bd('0x8'));var client=jayson['client'][_0xe9bd('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5f18fe,_0x22a438,_0xa66ae2){return new BPromise(function(_0x2d5c75,_0x3ef9e3){return client[_0xe9bd('0xa')](_0x5f18fe,_0xa66ae2)[_0xe9bd('0xb')](function(_0x439abc){logger[_0xe9bd('0xc')]('MailSubstatus,\x20%s,\x20%s',_0x22a438,'request\x20sent');logger[_0xe9bd('0xd')](_0xe9bd('0xe'),_0x22a438,_0xe9bd('0xf'),JSON['stringify'](_0x439abc));if(_0x439abc[_0xe9bd('0x10')]){if(_0x439abc[_0xe9bd('0x10')][_0xe9bd('0x11')]===0x1f4){logger[_0xe9bd('0x10')]('MailSubstatus,\x20%s,\x20%s',_0x22a438,_0x439abc[_0xe9bd('0x10')]['message']);return _0x3ef9e3(_0x439abc[_0xe9bd('0x10')][_0xe9bd('0x12')]);}logger[_0xe9bd('0x10')]('MailSubstatus,\x20%s,\x20%s',_0x22a438,_0x439abc['error'][_0xe9bd('0x12')]);return _0x2d5c75(_0x439abc[_0xe9bd('0x10')][_0xe9bd('0x12')]);}else{logger[_0xe9bd('0xc')](_0xe9bd('0x13'),_0x22a438,_0xe9bd('0xf'));_0x2d5c75(_0x439abc[_0xe9bd('0x14')]['message']);}})[_0xe9bd('0x15')](function(_0x464a1b){logger[_0xe9bd('0x10')]('MailSubstatus,\x20%s,\x20%s',_0x22a438,_0x464a1b);_0x3ef9e3(_0x464a1b);});});} \ No newline at end of file diff --git a/server/api/mailTransferReport/index.js b/server/api/mailTransferReport/index.js index f72661b..109e620 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 _0xf83b=['isAuthenticated','index','/describe','describe','/:id','show','post','create','put','update','delete','destroy','exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailTransferReport.controller','get'];(function(_0x131016,_0x4bfabe){var _0x2d7dd8=function(_0x19bbcd){while(--_0x19bbcd){_0x131016['push'](_0x131016['shift']());}};_0x2d7dd8(++_0x4bfabe);}(_0xf83b,0x69));var _0xbf83=function(_0x5c0254,_0x213d5c){_0x5c0254=_0x5c0254-0x0;var _0x528897=_0xf83b[_0x5c0254];return _0x528897;};'use strict';var multer=require(_0xbf83('0x0'));var util=require(_0xbf83('0x1'));var path=require('path');var timeout=require(_0xbf83('0x2'));var express=require(_0xbf83('0x3'));var router=express[_0xbf83('0x4')]();var auth=require(_0xbf83('0x5'));var interaction=require(_0xbf83('0x6'));var config=require(_0xbf83('0x7'));var controller=require(_0xbf83('0x8'));router[_0xbf83('0x9')]('/',auth[_0xbf83('0xa')](),controller[_0xbf83('0xb')]);router[_0xbf83('0x9')](_0xbf83('0xc'),auth[_0xbf83('0xa')](),controller[_0xbf83('0xd')]);router[_0xbf83('0x9')](_0xbf83('0xe'),auth[_0xbf83('0xa')](),controller[_0xbf83('0xf')]);router[_0xbf83('0x10')]('/',auth[_0xbf83('0xa')](),controller[_0xbf83('0x11')]);router[_0xbf83('0x12')](_0xbf83('0xe'),auth[_0xbf83('0xa')](),controller[_0xbf83('0x13')]);router[_0xbf83('0x14')](_0xbf83('0xe'),auth['isAuthenticated'](),controller[_0xbf83('0x15')]);module[_0xbf83('0x16')]=router; \ No newline at end of file +var _0xab56=['get','/:id','isAuthenticated','show','post','create','put','delete','destroy','exports','multer','path','connect-timeout','express','../../components/auth/service','../../config/environment'];(function(_0x229461,_0xb8cb9){var _0x3b2d9a=function(_0x12c052){while(--_0x12c052){_0x229461['push'](_0x229461['shift']());}};_0x3b2d9a(++_0xb8cb9);}(_0xab56,0x1ba));var _0x6ab5=function(_0xe66cf2,_0x32ba5f){_0xe66cf2=_0xe66cf2-0x0;var _0x2d84e7=_0xab56[_0xe66cf2];return _0x2d84e7;};'use strict';var multer=require(_0x6ab5('0x0'));var util=require('util');var path=require(_0x6ab5('0x1'));var timeout=require(_0x6ab5('0x2'));var express=require(_0x6ab5('0x3'));var router=express['Router']();var auth=require(_0x6ab5('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x6ab5('0x5'));var controller=require('./mailTransferReport.controller');router[_0x6ab5('0x6')]('/',auth['isAuthenticated'](),controller['index']);router[_0x6ab5('0x6')]('/describe',auth['isAuthenticated'](),controller['describe']);router[_0x6ab5('0x6')](_0x6ab5('0x7'),auth[_0x6ab5('0x8')](),controller[_0x6ab5('0x9')]);router[_0x6ab5('0xa')]('/',auth[_0x6ab5('0x8')](),controller[_0x6ab5('0xb')]);router[_0x6ab5('0xc')]('/:id',auth[_0x6ab5('0x8')](),controller['update']);router[_0x6ab5('0xd')](_0x6ab5('0x7'),auth[_0x6ab5('0x8')](),controller[_0x6ab5('0xe')]);module[_0x6ab5('0xf')]=router; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.attributes.js b/server/api/mailTransferReport/mailTransferReport.attributes.js index 388ec40..cb8078f 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 _0xcebe=['queue','DATE','NOW','moment','sequelize','exports','STRING','account'];(function(_0x3515d3,_0x337e82){var _0x148d18=function(_0x6c455){while(--_0x6c455){_0x3515d3['push'](_0x3515d3['shift']());}};_0x148d18(++_0x337e82);}(_0xcebe,0x14b));var _0xeceb=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0xcebe[_0x6131cd];return _0x47e916;};'use strict';var moment=require(_0xeceb('0x0'));var Sequelize=require(_0xeceb('0x1'));module[_0xeceb('0x2')]={'uniqueid':{'type':Sequelize[_0xeceb('0x3')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0xeceb('0x4'),'agent',_0xeceb('0x5')),'allowNull':![],'defaultValue':_0xeceb('0x5')},'transferredAt':{'type':Sequelize[_0xeceb('0x6')],'allowNull':![],'defaultValue':Sequelize[_0xeceb('0x7')]}}; \ No newline at end of file +var _0x3625=['ENUM','account','agent','queue','moment','sequelize','exports','STRING'];(function(_0x1bf33d,_0x109877){var _0x2528c9=function(_0x32821b){while(--_0x32821b){_0x1bf33d['push'](_0x1bf33d['shift']());}};_0x2528c9(++_0x109877);}(_0x3625,0xa4));var _0x5362=function(_0x3dadf1,_0x4401b0){_0x3dadf1=_0x3dadf1-0x0;var _0x456748=_0x3625[_0x3dadf1];return _0x456748;};'use strict';var moment=require(_0x5362('0x0'));var Sequelize=require(_0x5362('0x1'));module[_0x5362('0x2')]={'uniqueid':{'type':Sequelize[_0x5362('0x3')],'allowNull':![]},'type':{'type':Sequelize[_0x5362('0x4')](_0x5362('0x5'),_0x5362('0x6'),_0x5362('0x7')),'allowNull':![],'defaultValue':'queue'},'transferredAt':{'type':Sequelize['DATE'],'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 47804b9..4d63455 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 _0xbfe2=['where','pick','filter','merge','VIRTUAL','options','includeAll','findAll','catch','show','params','rawAttributes','keys','fields','include','find','create','body','destroy','describe','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../mysqldb','sendStatus','status','json','count','offset','limit','set','Content-Range','reject','save','update','then','end','error','name','index','map','MailTransferReport','fieldName','type','key','model','query','filters','intersection','attributes','length','hasOwnProperty','nolimit','order','sort'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xbfe2,0xac));var _0x2bfe=function(_0x33f53a,_0x292ffc){_0x33f53a=_0x33f53a-0x0;var _0x8871d7=_0xbfe2[_0x33f53a];return _0x8871d7;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0x2bfe('0x0'));var zipdir=require(_0x2bfe('0x1'));var jsonpatch=require(_0x2bfe('0x2'));var rp=require(_0x2bfe('0x3'));var moment=require(_0x2bfe('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x2bfe('0x5'));var util=require(_0x2bfe('0x6'));var path=require(_0x2bfe('0x7'));var sox=require(_0x2bfe('0x8'));var csv=require(_0x2bfe('0x9'));var ejs=require(_0x2bfe('0xa'));var fs=require('fs');var _=require(_0x2bfe('0xb'));var squel=require(_0x2bfe('0xc'));var crypto=require(_0x2bfe('0xd'));var jsforce=require(_0x2bfe('0xe'));var deskjs=require(_0x2bfe('0xf'));var toCsv=require(_0x2bfe('0x9'));var querystring=require(_0x2bfe('0x10'));var Papa=require(_0x2bfe('0x11'));var Redis=require(_0x2bfe('0x12'));var authService=require(_0x2bfe('0x13'));var qs=require(_0x2bfe('0x14'));var as=require(_0x2bfe('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x2bfe('0x16'))('api');var utils=require(_0x2bfe('0x17'));var config=require('../../config/environment');var db=require(_0x2bfe('0x18'))['db'];function respondWithStatusCode(_0x24974a,_0x4e82fc){_0x4e82fc=_0x4e82fc||0xcc;return function(_0x413aab){if(_0x413aab){return _0x24974a[_0x2bfe('0x19')](_0x4e82fc);}return _0x24974a['status'](_0x4e82fc)['end']();};}function respondWithResult(_0xa55702,_0x2a5ed3){_0x2a5ed3=_0x2a5ed3||0xc8;return function(_0x2f6a67){if(_0x2f6a67){return _0xa55702[_0x2bfe('0x1a')](_0x2a5ed3)[_0x2bfe('0x1b')](_0x2f6a67);}};}function respondWithFilteredResult(_0x17be5d,_0x7b7d7b){return function(_0x57e982){if(_0x57e982){var _0x5e7e44=_0x57e982[_0x2bfe('0x1c')],_0x5dc0d3=_0x7b7d7b[_0x2bfe('0x1d')],_0x1c0deb=_0x7b7d7b[_0x2bfe('0x1d')]+_0x7b7d7b[_0x2bfe('0x1e')],_0x2de6c3;if(_0x1c0deb>=_0x5e7e44){_0x1c0deb=_0x5e7e44;_0x2de6c3=0xc8;}else{_0x2de6c3=0xce;}_0x17be5d['status'](_0x2de6c3);return _0x17be5d[_0x2bfe('0x1f')](_0x2bfe('0x20'),_0x5dc0d3+'-'+_0x1c0deb+'/'+_0x5e7e44)['json'](_0x57e982);}return null;};}function patchUpdates(_0x471712){return function(_0x5a7228){try{jsonpatch['apply'](_0x5a7228,_0x471712,!![]);}catch(_0x49e497){return BPromise[_0x2bfe('0x21')](_0x49e497);}return _0x5a7228[_0x2bfe('0x22')]();};}function saveUpdates(_0x172ca3,_0x3022e2){return function(_0x4f26e5){if(_0x4f26e5){return _0x4f26e5[_0x2bfe('0x23')](_0x172ca3)[_0x2bfe('0x24')](function(_0xc9aa6b){return _0xc9aa6b;});}return null;};}function removeEntity(_0x28d1ea,_0x3a4e35){return function(_0x45b4cd){if(_0x45b4cd){return _0x45b4cd['destroy']()[_0x2bfe('0x24')](function(){_0x28d1ea[_0x2bfe('0x1a')](0xcc)[_0x2bfe('0x25')]();});}};}function handleEntityNotFound(_0x2ca081,_0x344978){return function(_0x5266e7){if(!_0x5266e7){_0x2ca081[_0x2bfe('0x19')](0x194);}return _0x5266e7;};}function handleError(_0x1f82ce,_0x2b4203){_0x2b4203=_0x2b4203||0x1f4;return function(_0x464f60){logger[_0x2bfe('0x26')](_0x464f60['stack']);if(_0x464f60[_0x2bfe('0x27')]){delete _0x464f60['name'];}_0x1f82ce[_0x2bfe('0x1a')](_0x2b4203)['send'](_0x464f60);};}exports[_0x2bfe('0x28')]=function(_0x322716,_0xbe1073){var _0x2a6ad6={},_0x1209b3={},_0x218da0={'count':0x0,'rows':[]};var _0x4bff1f=_[_0x2bfe('0x29')](db[_0x2bfe('0x2a')]['rawAttributes'],function(_0x533171){return{'name':_0x533171[_0x2bfe('0x2b')],'type':_0x533171[_0x2bfe('0x2c')][_0x2bfe('0x2d')]};});_0x1209b3[_0x2bfe('0x2e')]=_['map'](_0x4bff1f,_0x2bfe('0x27'));_0x1209b3[_0x2bfe('0x2f')]=_['keys'](_0x322716['query']);_0x1209b3[_0x2bfe('0x30')]=_[_0x2bfe('0x31')](_0x1209b3[_0x2bfe('0x2e')],_0x1209b3[_0x2bfe('0x2f')]);_0x2a6ad6[_0x2bfe('0x32')]=_[_0x2bfe('0x31')](_0x1209b3[_0x2bfe('0x2e')],qs['fields'](_0x322716['query']['fields']));_0x2a6ad6[_0x2bfe('0x32')]=_0x2a6ad6['attributes'][_0x2bfe('0x33')]?_0x2a6ad6['attributes']:_0x1209b3[_0x2bfe('0x2e')];if(!_0x322716[_0x2bfe('0x2f')][_0x2bfe('0x34')](_0x2bfe('0x35'))){_0x2a6ad6[_0x2bfe('0x1e')]=qs['limit'](_0x322716[_0x2bfe('0x2f')][_0x2bfe('0x1e')]);_0x2a6ad6[_0x2bfe('0x1d')]=qs[_0x2bfe('0x1d')](_0x322716[_0x2bfe('0x2f')][_0x2bfe('0x1d')]);}_0x2a6ad6[_0x2bfe('0x36')]=qs[_0x2bfe('0x37')](_0x322716[_0x2bfe('0x2f')][_0x2bfe('0x37')]);_0x2a6ad6[_0x2bfe('0x38')]=qs[_0x2bfe('0x30')](_[_0x2bfe('0x39')](_0x322716[_0x2bfe('0x2f')],_0x1209b3[_0x2bfe('0x30')]),_0x4bff1f);if(_0x322716[_0x2bfe('0x2f')][_0x2bfe('0x3a')]){_0x2a6ad6['where']=_[_0x2bfe('0x3b')](_0x2a6ad6[_0x2bfe('0x38')],{'$or':_[_0x2bfe('0x29')](_0x4bff1f,function(_0x4fca32){if(_0x4fca32[_0x2bfe('0x2c')]!==_0x2bfe('0x3c')){var _0x29d95a={};_0x29d95a[_0x4fca32['name']]={'$like':'%'+_0x322716[_0x2bfe('0x2f')][_0x2bfe('0x3a')]+'%'};return _0x29d95a;}})});}_0x2a6ad6=_[_0x2bfe('0x3b')]({},_0x2a6ad6,_0x322716[_0x2bfe('0x3d')]);var _0x58ee6f={'where':_0x2a6ad6[_0x2bfe('0x38')]};return db[_0x2bfe('0x2a')]['count'](_0x58ee6f)['then'](function(_0x1e271b){_0x218da0[_0x2bfe('0x1c')]=_0x1e271b;if(_0x322716[_0x2bfe('0x2f')][_0x2bfe('0x3e')]){_0x2a6ad6['include']=[{'all':!![]}];}return db[_0x2bfe('0x2a')][_0x2bfe('0x3f')](_0x2a6ad6);})['then'](function(_0x2e7951){_0x218da0['rows']=_0x2e7951;return _0x218da0;})[_0x2bfe('0x24')](respondWithFilteredResult(_0xbe1073,_0x2a6ad6))[_0x2bfe('0x40')](handleError(_0xbe1073,null));};exports[_0x2bfe('0x41')]=function(_0x1874ae,_0x2def84){var _0x469694={'raw':!![],'where':{'id':_0x1874ae[_0x2bfe('0x42')]['id']}},_0x3af81c={};_0x3af81c[_0x2bfe('0x2e')]=_['keys'](db['MailTransferReport'][_0x2bfe('0x43')]);_0x3af81c['query']=_[_0x2bfe('0x44')](_0x1874ae[_0x2bfe('0x2f')]);_0x3af81c[_0x2bfe('0x30')]=_['intersection'](_0x3af81c['model'],_0x3af81c[_0x2bfe('0x2f')]);_0x469694[_0x2bfe('0x32')]=_[_0x2bfe('0x31')](_0x3af81c[_0x2bfe('0x2e')],qs[_0x2bfe('0x45')](_0x1874ae[_0x2bfe('0x2f')][_0x2bfe('0x45')]));_0x469694['attributes']=_0x469694[_0x2bfe('0x32')][_0x2bfe('0x33')]?_0x469694[_0x2bfe('0x32')]:_0x3af81c[_0x2bfe('0x2e')];if(_0x1874ae['query'][_0x2bfe('0x3e')]){_0x469694[_0x2bfe('0x46')]=[{'all':!![]}];}_0x469694=_[_0x2bfe('0x3b')]({},_0x469694,_0x1874ae['options']);return db[_0x2bfe('0x2a')][_0x2bfe('0x47')](_0x469694)[_0x2bfe('0x24')](handleEntityNotFound(_0x2def84,null))[_0x2bfe('0x24')](respondWithResult(_0x2def84,null))['catch'](handleError(_0x2def84,null));};exports[_0x2bfe('0x48')]=function(_0x4550c6,_0x182577){return db['MailTransferReport']['create'](_0x4550c6[_0x2bfe('0x49')],{})['then'](respondWithResult(_0x182577,0xc9))['catch'](handleError(_0x182577,null));};exports[_0x2bfe('0x23')]=function(_0x1f3292,_0x33fe22){if(_0x1f3292[_0x2bfe('0x49')]['id']){delete _0x1f3292['body']['id'];}return db['MailTransferReport'][_0x2bfe('0x47')]({'where':{'id':_0x1f3292[_0x2bfe('0x42')]['id']}})['then'](handleEntityNotFound(_0x33fe22,null))[_0x2bfe('0x24')](saveUpdates(_0x1f3292[_0x2bfe('0x49')],null))[_0x2bfe('0x24')](respondWithResult(_0x33fe22,null))[_0x2bfe('0x40')](handleError(_0x33fe22,null));};exports[_0x2bfe('0x4a')]=function(_0x3178a8,_0x9260f9){return db[_0x2bfe('0x2a')][_0x2bfe('0x47')]({'where':{'id':_0x3178a8[_0x2bfe('0x42')]['id']}})[_0x2bfe('0x24')](handleEntityNotFound(_0x9260f9,null))[_0x2bfe('0x24')](removeEntity(_0x9260f9,null))[_0x2bfe('0x40')](handleError(_0x9260f9,null));};exports[_0x2bfe('0x4b')]=function(_0x427da9,_0x147d42){return db['MailTransferReport'][_0x2bfe('0x4b')]()['then'](respondWithResult(_0x147d42,null))[_0x2bfe('0x40')](handleError(_0x147d42,null));}; \ No newline at end of file +var _0x92f6=['end','json','offset','limit','Content-Range','reject','then','error','stack','name','send','index','map','MailTransferReport','fieldName','key','model','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filters','VIRTUAL','filter','options','count','includeAll','include','rows','catch','show','rawAttributes','keys','merge','create','body','params','destroy','html-pdf','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','ejs','lodash','squel','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status'];(function(_0x2d8674,_0x4ed949){var _0x51486b=function(_0x2c1079){while(--_0x2c1079){_0x2d8674['push'](_0x2d8674['shift']());}};_0x51486b(++_0x4ed949);}(_0x92f6,0xff));var _0x692f=function(_0x48be5e,_0x24f00e){_0x48be5e=_0x48be5e-0x0;var _0x559ffd=_0x92f6[_0x48be5e];return _0x559ffd;};'use strict';var pdf=require(_0x692f('0x0'));var emlformat=require(_0x692f('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x692f('0x2'));var jsonpatch=require(_0x692f('0x3'));var rp=require('request-promise');var moment=require(_0x692f('0x4'));var BPromise=require(_0x692f('0x5'));var Mustache=require(_0x692f('0x6'));var util=require(_0x692f('0x7'));var path=require('path');var sox=require(_0x692f('0x8'));var csv=require(_0x692f('0x9'));var ejs=require(_0x692f('0xa'));var fs=require('fs');var _=require(_0x692f('0xb'));var squel=require(_0x692f('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x692f('0xd'));var toCsv=require(_0x692f('0x9'));var querystring=require(_0x692f('0xe'));var Papa=require(_0x692f('0xf'));var Redis=require('ioredis');var authService=require(_0x692f('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x692f('0x11'));var hardwareService=require(_0x692f('0x12'));var logger=require(_0x692f('0x13'))(_0x692f('0x14'));var utils=require(_0x692f('0x15'));var config=require('../../config/environment');var db=require(_0x692f('0x16'))['db'];function respondWithStatusCode(_0x52f278,_0x3c0914){_0x3c0914=_0x3c0914||0xcc;return function(_0x59650c){if(_0x59650c){return _0x52f278[_0x692f('0x17')](_0x3c0914);}return _0x52f278[_0x692f('0x18')](_0x3c0914)[_0x692f('0x19')]();};}function respondWithResult(_0x49d9a5,_0x1cb898){_0x1cb898=_0x1cb898||0xc8;return function(_0x174983){if(_0x174983){return _0x49d9a5['status'](_0x1cb898)[_0x692f('0x1a')](_0x174983);}};}function respondWithFilteredResult(_0x1626e0,_0x4bd25c){return function(_0x2cd48a){if(_0x2cd48a){var _0x26b35b=_0x2cd48a['count'],_0x8af014=_0x4bd25c[_0x692f('0x1b')],_0x1e87a9=_0x4bd25c[_0x692f('0x1b')]+_0x4bd25c[_0x692f('0x1c')],_0x4a2a48;if(_0x1e87a9>=_0x26b35b){_0x1e87a9=_0x26b35b;_0x4a2a48=0xc8;}else{_0x4a2a48=0xce;}_0x1626e0[_0x692f('0x18')](_0x4a2a48);return _0x1626e0['set'](_0x692f('0x1d'),_0x8af014+'-'+_0x1e87a9+'/'+_0x26b35b)[_0x692f('0x1a')](_0x2cd48a);}return null;};}function patchUpdates(_0x45453c){return function(_0x585188){try{jsonpatch['apply'](_0x585188,_0x45453c,!![]);}catch(_0x173a20){return BPromise[_0x692f('0x1e')](_0x173a20);}return _0x585188['save']();};}function saveUpdates(_0x2beb9f,_0x396290){return function(_0x3a879e){if(_0x3a879e){return _0x3a879e['update'](_0x2beb9f)['then'](function(_0x95ea27){return _0x95ea27;});}return null;};}function removeEntity(_0x4b139c,_0x2a8e67){return function(_0x498066){if(_0x498066){return _0x498066['destroy']()[_0x692f('0x1f')](function(){_0x4b139c[_0x692f('0x18')](0xcc)[_0x692f('0x19')]();});}};}function handleEntityNotFound(_0x50cd21,_0x572a81){return function(_0x156b00){if(!_0x156b00){_0x50cd21[_0x692f('0x17')](0x194);}return _0x156b00;};}function handleError(_0x2995ea,_0x447c93){_0x447c93=_0x447c93||0x1f4;return function(_0x5c2659){logger[_0x692f('0x20')](_0x5c2659[_0x692f('0x21')]);if(_0x5c2659[_0x692f('0x22')]){delete _0x5c2659['name'];}_0x2995ea[_0x692f('0x18')](_0x447c93)[_0x692f('0x23')](_0x5c2659);};}exports[_0x692f('0x24')]=function(_0x4a4ea8,_0x4f15f9){var _0x2501c2={},_0x1f7d6e={},_0x58a2c5={'count':0x0,'rows':[]};var _0x2048ae=_[_0x692f('0x25')](db[_0x692f('0x26')]['rawAttributes'],function(_0x5aea0f){return{'name':_0x5aea0f[_0x692f('0x27')],'type':_0x5aea0f['type'][_0x692f('0x28')]};});_0x1f7d6e[_0x692f('0x29')]=_[_0x692f('0x25')](_0x2048ae,'name');_0x1f7d6e[_0x692f('0x2a')]=_['keys'](_0x4a4ea8[_0x692f('0x2a')]);_0x1f7d6e['filters']=_[_0x692f('0x2b')](_0x1f7d6e['model'],_0x1f7d6e[_0x692f('0x2a')]);_0x2501c2[_0x692f('0x2c')]=_[_0x692f('0x2b')](_0x1f7d6e[_0x692f('0x29')],qs['fields'](_0x4a4ea8['query'][_0x692f('0x2d')]));_0x2501c2[_0x692f('0x2c')]=_0x2501c2[_0x692f('0x2c')][_0x692f('0x2e')]?_0x2501c2[_0x692f('0x2c')]:_0x1f7d6e[_0x692f('0x29')];if(!_0x4a4ea8[_0x692f('0x2a')][_0x692f('0x2f')](_0x692f('0x30'))){_0x2501c2[_0x692f('0x1c')]=qs['limit'](_0x4a4ea8['query']['limit']);_0x2501c2[_0x692f('0x1b')]=qs[_0x692f('0x1b')](_0x4a4ea8['query']['offset']);}_0x2501c2[_0x692f('0x31')]=qs[_0x692f('0x32')](_0x4a4ea8[_0x692f('0x2a')][_0x692f('0x32')]);_0x2501c2[_0x692f('0x33')]=qs['filters'](_[_0x692f('0x34')](_0x4a4ea8[_0x692f('0x2a')],_0x1f7d6e[_0x692f('0x35')]),_0x2048ae);if(_0x4a4ea8[_0x692f('0x2a')]['filter']){_0x2501c2[_0x692f('0x33')]=_['merge'](_0x2501c2[_0x692f('0x33')],{'$or':_[_0x692f('0x25')](_0x2048ae,function(_0x24522f){if(_0x24522f['type']!==_0x692f('0x36')){var _0x4e4fe2={};_0x4e4fe2[_0x24522f['name']]={'$like':'%'+_0x4a4ea8[_0x692f('0x2a')][_0x692f('0x37')]+'%'};return _0x4e4fe2;}})});}_0x2501c2=_['merge']({},_0x2501c2,_0x4a4ea8[_0x692f('0x38')]);var _0x35e1f2={'where':_0x2501c2[_0x692f('0x33')]};return db[_0x692f('0x26')]['count'](_0x35e1f2)[_0x692f('0x1f')](function(_0x2cb224){_0x58a2c5[_0x692f('0x39')]=_0x2cb224;if(_0x4a4ea8[_0x692f('0x2a')][_0x692f('0x3a')]){_0x2501c2[_0x692f('0x3b')]=[{'all':!![]}];}return db['MailTransferReport']['findAll'](_0x2501c2);})[_0x692f('0x1f')](function(_0x3d4f2e){_0x58a2c5[_0x692f('0x3c')]=_0x3d4f2e;return _0x58a2c5;})[_0x692f('0x1f')](respondWithFilteredResult(_0x4f15f9,_0x2501c2))[_0x692f('0x3d')](handleError(_0x4f15f9,null));};exports[_0x692f('0x3e')]=function(_0x4c6ff9,_0xbb2771){var _0x740dff={'raw':!![],'where':{'id':_0x4c6ff9['params']['id']}},_0x354198={};_0x354198['model']=_['keys'](db[_0x692f('0x26')][_0x692f('0x3f')]);_0x354198[_0x692f('0x2a')]=_[_0x692f('0x40')](_0x4c6ff9[_0x692f('0x2a')]);_0x354198['filters']=_[_0x692f('0x2b')](_0x354198['model'],_0x354198[_0x692f('0x2a')]);_0x740dff[_0x692f('0x2c')]=_[_0x692f('0x2b')](_0x354198[_0x692f('0x29')],qs[_0x692f('0x2d')](_0x4c6ff9[_0x692f('0x2a')]['fields']));_0x740dff[_0x692f('0x2c')]=_0x740dff['attributes'][_0x692f('0x2e')]?_0x740dff[_0x692f('0x2c')]:_0x354198[_0x692f('0x29')];if(_0x4c6ff9['query'][_0x692f('0x3a')]){_0x740dff['include']=[{'all':!![]}];}_0x740dff=_[_0x692f('0x41')]({},_0x740dff,_0x4c6ff9['options']);return db[_0x692f('0x26')]['find'](_0x740dff)['then'](handleEntityNotFound(_0xbb2771,null))['then'](respondWithResult(_0xbb2771,null))[_0x692f('0x3d')](handleError(_0xbb2771,null));};exports[_0x692f('0x42')]=function(_0x56aa64,_0x36313d){return db[_0x692f('0x26')][_0x692f('0x42')](_0x56aa64[_0x692f('0x43')],{})[_0x692f('0x1f')](respondWithResult(_0x36313d,0xc9))[_0x692f('0x3d')](handleError(_0x36313d,null));};exports['update']=function(_0x26c870,_0x431d79){if(_0x26c870['body']['id']){delete _0x26c870[_0x692f('0x43')]['id'];}return db['MailTransferReport']['find']({'where':{'id':_0x26c870[_0x692f('0x44')]['id']}})['then'](handleEntityNotFound(_0x431d79,null))['then'](saveUpdates(_0x26c870[_0x692f('0x43')],null))[_0x692f('0x1f')](respondWithResult(_0x431d79,null))['catch'](handleError(_0x431d79,null));};exports[_0x692f('0x45')]=function(_0x3b6b48,_0x5b8df0){return db[_0x692f('0x26')]['find']({'where':{'id':_0x3b6b48[_0x692f('0x44')]['id']}})[_0x692f('0x1f')](handleEntityNotFound(_0x5b8df0,null))[_0x692f('0x1f')](removeEntity(_0x5b8df0,null))[_0x692f('0x3d')](handleError(_0x5b8df0,null));};exports['describe']=function(_0x2439c2,_0x250dac){return db[_0x692f('0x26')]['describe']()[_0x692f('0x1f')](respondWithResult(_0x250dac,null))['catch'](handleError(_0x250dac,null));}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.model.js b/server/api/mailTransferReport/mailTransferReport.model.js index daee511..f19c810 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 _0x2ad4=['util','../../config/logger','moment','request-promise','path','../../config/environment','./mailTransferReport.attributes','exports','define','report_mail_transfer','uniqueid','lodash'];(function(_0x22ecef,_0x5a2a0b){var _0x5ef61f=function(_0xfe8f87){while(--_0xfe8f87){_0x22ecef['push'](_0x22ecef['shift']());}};_0x5ef61f(++_0x5a2a0b);}(_0x2ad4,0xcb));var _0x42ad=function(_0x1ce236,_0xca922e){_0x1ce236=_0x1ce236-0x0;var _0x241819=_0x2ad4[_0x1ce236];return _0x241819;};'use strict';var _=require(_0x42ad('0x0'));var util=require(_0x42ad('0x1'));var logger=require(_0x42ad('0x2'))('api');var moment=require(_0x42ad('0x3'));var BPromise=require('bluebird');var rp=require(_0x42ad('0x4'));var fs=require('fs');var path=require(_0x42ad('0x5'));var rimraf=require('rimraf');var config=require(_0x42ad('0x6'));var attributes=require(_0x42ad('0x7'));module[_0x42ad('0x8')]=function(_0x40fd91,_0x13caba){return _0x40fd91[_0x42ad('0x9')]('MailTransferReport',attributes,{'tableName':_0x42ad('0xa'),'paranoid':![],'indexes':[{'name':_0x42ad('0xb'),'fields':[_0x42ad('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xa1ad=['api','moment','request-promise','rimraf','../../config/environment','exports','MailTransferReport','report_mail_transfer','lodash','util','../../config/logger'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xa1ad,0x1c0));var _0xda1a=function(_0x4bf96c,_0x4d24fd){_0x4bf96c=_0x4bf96c-0x0;var _0x281d09=_0xa1ad[_0x4bf96c];return _0x281d09;};'use strict';var _=require(_0xda1a('0x0'));var util=require(_0xda1a('0x1'));var logger=require(_0xda1a('0x2'))(_0xda1a('0x3'));var moment=require(_0xda1a('0x4'));var BPromise=require('bluebird');var rp=require(_0xda1a('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xda1a('0x6'));var config=require(_0xda1a('0x7'));var attributes=require('./mailTransferReport.attributes');module[_0xda1a('0x8')]=function(_0x386b90,_0x387162){return _0x386b90['define'](_0xda1a('0x9'),attributes,{'tableName':_0xda1a('0xa'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.rpc.js b/server/api/mailTransferReport/mailTransferReport.rpc.js index 7704c12..29c780b 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 _0x8123=['debug','MailTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','MailTransferReport,\x20%s,\x20%s','request\x20sent'];(function(_0x5d69ec,_0x583d1f){var _0x61cb84=function(_0x29ee7a){while(--_0x29ee7a){_0x5d69ec['push'](_0x5d69ec['shift']());}};_0x61cb84(++_0x583d1f);}(_0x8123,0x137));var _0x3812=function(_0x382a62,_0x1baa5e){_0x382a62=_0x382a62-0x0;var _0x490a25=_0x8123[_0x382a62];return _0x490a25;};'use strict';var _=require(_0x3812('0x0'));var util=require(_0x3812('0x1'));var moment=require(_0x3812('0x2'));var BPromise=require(_0x3812('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x3812('0x4'));var db=require(_0x3812('0x5'))['db'];var utils=require(_0x3812('0x6'));var logger=require('../../config/logger')(_0x3812('0x7'));var config=require(_0x3812('0x8'));var jayson=require(_0x3812('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x4b663c,_0x31dad9,_0xb2f492){return new BPromise(function(_0x317d9e,_0x3dac3f){return client['request'](_0x4b663c,_0xb2f492)['then'](function(_0x1a4b38){logger['info'](_0x3812('0xa'),_0x31dad9,_0x3812('0xb'));logger[_0x3812('0xc')](_0x3812('0xd'),_0x31dad9,'request\x20sent',JSON[_0x3812('0xe')](_0x1a4b38));if(_0x1a4b38[_0x3812('0xf')]){if(_0x1a4b38[_0x3812('0xf')]['code']===0x1f4){logger['error'](_0x3812('0xa'),_0x31dad9,_0x1a4b38[_0x3812('0xf')][_0x3812('0x10')]);return _0x3dac3f(_0x1a4b38[_0x3812('0xf')][_0x3812('0x10')]);}logger[_0x3812('0xf')]('MailTransferReport,\x20%s,\x20%s',_0x31dad9,_0x1a4b38[_0x3812('0xf')][_0x3812('0x10')]);return _0x317d9e(_0x1a4b38['error'][_0x3812('0x10')]);}else{logger[_0x3812('0x11')](_0x3812('0xa'),_0x31dad9,_0x3812('0xb'));_0x317d9e(_0x1a4b38[_0x3812('0x12')][_0x3812('0x10')]);}})['catch'](function(_0x177bb9){logger[_0x3812('0xf')]('MailTransferReport,\x20%s,\x20%s',_0x31dad9,_0x177bb9);_0x3dac3f(_0x177bb9);});});} \ No newline at end of file +var _0xd152=['stringify','error','message','result','catch','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','MailTransferReport,\x20%s,\x20%s','debug','MailTransferReport,\x20%s,\x20%s,\x20%s','request\x20sent'];(function(_0x3eca96,_0x1bc1ea){var _0x8ac51f=function(_0xf59098){while(--_0xf59098){_0x3eca96['push'](_0x3eca96['shift']());}};_0x8ac51f(++_0x1bc1ea);}(_0xd152,0x125));var _0x2d15=function(_0x261f31,_0x416a7e){_0x261f31=_0x261f31-0x0;var _0x2db7cf=_0xd152[_0x261f31];return _0x2db7cf;};'use strict';var _=require('lodash');var util=require(_0x2d15('0x0'));var moment=require(_0x2d15('0x1'));var BPromise=require(_0x2d15('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2d15('0x3'));var db=require(_0x2d15('0x4'))['db'];var utils=require(_0x2d15('0x5'));var logger=require(_0x2d15('0x6'))(_0x2d15('0x7'));var config=require(_0x2d15('0x8'));var jayson=require(_0x2d15('0x9'));var client=jayson[_0x2d15('0xa')][_0x2d15('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x26b8fa,_0x6e51fb,_0x464002){return new BPromise(function(_0x4558f6,_0x323694){return client[_0x2d15('0xc')](_0x26b8fa,_0x464002)[_0x2d15('0xd')](function(_0x873ee8){logger[_0x2d15('0xe')](_0x2d15('0xf'),_0x6e51fb,'request\x20sent');logger[_0x2d15('0x10')](_0x2d15('0x11'),_0x6e51fb,_0x2d15('0x12'),JSON[_0x2d15('0x13')](_0x873ee8));if(_0x873ee8[_0x2d15('0x14')]){if(_0x873ee8[_0x2d15('0x14')]['code']===0x1f4){logger['error'](_0x2d15('0xf'),_0x6e51fb,_0x873ee8[_0x2d15('0x14')][_0x2d15('0x15')]);return _0x323694(_0x873ee8[_0x2d15('0x14')][_0x2d15('0x15')]);}logger[_0x2d15('0x14')](_0x2d15('0xf'),_0x6e51fb,_0x873ee8[_0x2d15('0x14')]['message']);return _0x4558f6(_0x873ee8[_0x2d15('0x14')][_0x2d15('0x15')]);}else{logger[_0x2d15('0xe')](_0x2d15('0xf'),_0x6e51fb,_0x2d15('0x12'));_0x4558f6(_0x873ee8[_0x2d15('0x16')][_0x2d15('0x15')]);}})[_0x2d15('0x17')](function(_0x61fdac){logger[_0x2d15('0x14')](_0x2d15('0xf'),_0x6e51fb,_0x61fdac);_0x323694(_0x61fdac);});});} \ No newline at end of file diff --git a/server/api/memberReport/index.js b/server/api/memberReport/index.js index 22551b8..0616cf7 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 _0xfda6=['update','delete','exports','util','path','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','describe','/:id','show','post','create','put'];(function(_0x143ea6,_0x3c9999){var _0xfb14d=function(_0x28149a){while(--_0x28149a){_0x143ea6['push'](_0x143ea6['shift']());}};_0xfb14d(++_0x3c9999);}(_0xfda6,0x123));var _0x6fda=function(_0x24e48c,_0x292459){_0x24e48c=_0x24e48c-0x0;var _0x2a3c76=_0xfda6[_0x24e48c];return _0x2a3c76;};'use strict';var multer=require('multer');var util=require(_0x6fda('0x0'));var path=require(_0x6fda('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0x6fda('0x2'));var config=require(_0x6fda('0x3'));var controller=require('./memberReport.controller');router[_0x6fda('0x4')]('/',auth[_0x6fda('0x5')](),controller[_0x6fda('0x6')]);router['get']('/describe',auth[_0x6fda('0x5')](),controller[_0x6fda('0x7')]);router[_0x6fda('0x4')](_0x6fda('0x8'),auth[_0x6fda('0x5')](),controller[_0x6fda('0x9')]);router[_0x6fda('0xa')]('/',auth[_0x6fda('0x5')](),controller[_0x6fda('0xb')]);router[_0x6fda('0xc')](_0x6fda('0x8'),auth[_0x6fda('0x5')](),controller[_0x6fda('0xd')]);router[_0x6fda('0xe')](_0x6fda('0x8'),auth[_0x6fda('0x5')](),controller['destroy']);module[_0x6fda('0xf')]=router; \ No newline at end of file +var _0x5a84=['path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./memberReport.controller','get','isAuthenticated','index','/describe','describe','show','create','put','/:id','update','delete','destroy','exports','multer','util'];(function(_0x59c558,_0x21dbad){var _0x220bab=function(_0x5bb148){while(--_0x5bb148){_0x59c558['push'](_0x59c558['shift']());}};_0x220bab(++_0x21dbad);}(_0x5a84,0x82));var _0x45a8=function(_0x500bfd,_0x582244){_0x500bfd=_0x500bfd-0x0;var _0x308e7e=_0x5a84[_0x500bfd];return _0x308e7e;};'use strict';var multer=require(_0x45a8('0x0'));var util=require(_0x45a8('0x1'));var path=require(_0x45a8('0x2'));var timeout=require(_0x45a8('0x3'));var express=require(_0x45a8('0x4'));var router=express[_0x45a8('0x5')]();var auth=require(_0x45a8('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x45a8('0x7'));var controller=require(_0x45a8('0x8'));router[_0x45a8('0x9')]('/',auth[_0x45a8('0xa')](),controller[_0x45a8('0xb')]);router[_0x45a8('0x9')](_0x45a8('0xc'),auth[_0x45a8('0xa')](),controller[_0x45a8('0xd')]);router[_0x45a8('0x9')]('/:id',auth[_0x45a8('0xa')](),controller[_0x45a8('0xe')]);router['post']('/',auth['isAuthenticated'](),controller[_0x45a8('0xf')]);router[_0x45a8('0x10')](_0x45a8('0x11'),auth[_0x45a8('0xa')](),controller[_0x45a8('0x12')]);router[_0x45a8('0x13')]('/:id',auth[_0x45a8('0xa')](),controller[_0x45a8('0x14')]);module[_0x45a8('0x15')]=router; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.attributes.js b/server/api/memberReport/memberReport.attributes.js index 47cd7fb..0574ef0 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 _0x7770=['exitAt','duration','talk:[inbound,\x20outbound],\x20pause:[reason]','talk:[start]','talk:[dial\x20string]','sequelize','exports','STRING','DEFAULT\x20PAUSE','LOGIN,\x20PAUSE,\x20TALKING','INTEGER','DATE','getDataValue','enterAt','seconds','setDataValue'];(function(_0x218419,_0x57f42c){var _0xe4f396=function(_0x5a25ee){while(--_0x5a25ee){_0x218419['push'](_0x218419['shift']());}};_0xe4f396(++_0x57f42c);}(_0x7770,0x125));var _0x0777=function(_0x2673f3,_0x5d055){_0x2673f3=_0x2673f3-0x0;var _0x2757f6=_0x7770[_0x2673f3];return _0x2757f6;};'use strict';var Sequelize=require(_0x0777('0x0'));var moment=require('moment');module[_0x0777('0x1')]={'channel':{'type':Sequelize['STRING']},'membername':{'type':Sequelize[_0x0777('0x2')]},'interface':{'type':Sequelize[_0x0777('0x2')]},'type':{'type':Sequelize[_0x0777('0x2')],'defaultValue':_0x0777('0x3'),'comment':_0x0777('0x4')},'duration':{'type':Sequelize[_0x0777('0x5')]},'enterAt':{'type':Sequelize[_0x0777('0x6')]},'exitAt':{'type':Sequelize['DATE'],'set':function(_0x3160f3){var _0x1b3bf4=moment(_0x3160f3);var _0x4ad07e=moment(this[_0x0777('0x7')](_0x0777('0x8')));var _0x2a2348=_0x1b3bf4['diff'](_0x4ad07e,_0x0777('0x9'));this[_0x0777('0xa')](_0x0777('0xb'),_0x3160f3);this['setDataValue'](_0x0777('0xc'),_0x2a2348||null);}},'data1':{'type':Sequelize[_0x0777('0x2')],'comment':_0x0777('0xd')},'data2':{'type':Sequelize[_0x0777('0x2')],'comment':_0x0777('0xe')},'data3':{'type':Sequelize['STRING'],'comment':'talk:[destination]'},'data4':{'type':Sequelize['STRING'],'comment':_0x0777('0xf')},'data5':{'type':Sequelize[_0x0777('0x2')],'comment':'talk:[queue]'},'role':{'type':Sequelize[_0x0777('0x2')]},'internal':{'type':Sequelize[_0x0777('0x5')]},'uniqueid':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x05f8=['getDataValue','diff','setDataValue','duration','talk:[inbound,\x20outbound],\x20pause:[reason]','talk:[destination]','talk:[dial\x20string]','talk:[queue]','INTEGER','sequelize','moment','exports','STRING','DEFAULT\x20PAUSE','LOGIN,\x20PAUSE,\x20TALKING','DATE'];(function(_0x40220a,_0x22feb1){var _0x3903cc=function(_0x33a296){while(--_0x33a296){_0x40220a['push'](_0x40220a['shift']());}};_0x3903cc(++_0x22feb1);}(_0x05f8,0x99));var _0x805f=function(_0x107b08,_0x386169){_0x107b08=_0x107b08-0x0;var _0x4ae685=_0x05f8[_0x107b08];return _0x4ae685;};'use strict';var Sequelize=require(_0x805f('0x0'));var moment=require(_0x805f('0x1'));module[_0x805f('0x2')]={'channel':{'type':Sequelize['STRING']},'membername':{'type':Sequelize[_0x805f('0x3')]},'interface':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0x805f('0x3')],'defaultValue':_0x805f('0x4'),'comment':_0x805f('0x5')},'duration':{'type':Sequelize['INTEGER']},'enterAt':{'type':Sequelize[_0x805f('0x6')]},'exitAt':{'type':Sequelize[_0x805f('0x6')],'set':function(_0x33700f){var _0x15b111=moment(_0x33700f);var _0x33e77b=moment(this[_0x805f('0x7')]('enterAt'));var _0x17bbb1=_0x15b111[_0x805f('0x8')](_0x33e77b,'seconds');this[_0x805f('0x9')]('exitAt',_0x33700f);this[_0x805f('0x9')](_0x805f('0xa'),_0x17bbb1||null);}},'data1':{'type':Sequelize['STRING'],'comment':_0x805f('0xb')},'data2':{'type':Sequelize[_0x805f('0x3')],'comment':'talk:[start]'},'data3':{'type':Sequelize[_0x805f('0x3')],'comment':_0x805f('0xc')},'data4':{'type':Sequelize['STRING'],'comment':_0x805f('0xd')},'data5':{'type':Sequelize[_0x805f('0x3')],'comment':_0x805f('0xe')},'role':{'type':Sequelize[_0x805f('0x3')]},'internal':{'type':Sequelize[_0x805f('0xf')]},'uniqueid':{'type':Sequelize[_0x805f('0x3')]}}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.controller.js b/server/api/memberReport/memberReport.controller.js index f27dac6..7968ba6 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 _0xbc5b=['create','body','update','destroy','describe','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','to-csv','ejs','lodash','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','end','status','json','count','offset','limit','set','Content-Range','apply','reject','save','then','error','stack','name','send','index','map','MemberReport','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','pick','where','merge','type','VIRTUAL','filter','options','includeAll','findAll','catch','show','params','include','find'];(function(_0x1718db,_0x3558c5){var _0x5103a0=function(_0x15722b){while(--_0x15722b){_0x1718db['push'](_0x1718db['shift']());}};_0x5103a0(++_0x3558c5);}(_0xbc5b,0x18b));var _0xbbc5=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0xbc5b[_0x502c7d];return _0x30b7ed;};'use strict';var pdf=require(_0xbbc5('0x0'));var emlformat=require(_0xbbc5('0x1'));var rimraf=require(_0xbbc5('0x2'));var zipdir=require(_0xbbc5('0x3'));var jsonpatch=require(_0xbbc5('0x4'));var rp=require(_0xbbc5('0x5'));var moment=require(_0xbbc5('0x6'));var BPromise=require(_0xbbc5('0x7'));var Mustache=require(_0xbbc5('0x8'));var util=require('util');var path=require(_0xbbc5('0x9'));var sox=require('sox');var csv=require(_0xbbc5('0xa'));var ejs=require(_0xbbc5('0xb'));var fs=require('fs');var _=require(_0xbbc5('0xc'));var squel=require('squel');var crypto=require(_0xbbc5('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xbbc5('0xe'));var toCsv=require(_0xbbc5('0xa'));var querystring=require(_0xbbc5('0xf'));var Papa=require(_0xbbc5('0x10'));var Redis=require(_0xbbc5('0x11'));var authService=require(_0xbbc5('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xbbc5('0x13'));var hardwareService=require(_0xbbc5('0x14'));var logger=require(_0xbbc5('0x15'))(_0xbbc5('0x16'));var utils=require(_0xbbc5('0x17'));var config=require(_0xbbc5('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5e1fda,_0x332d77){_0x332d77=_0x332d77||0xcc;return function(_0x4c1cf7){if(_0x4c1cf7){return _0x5e1fda[_0xbbc5('0x19')](_0x332d77);}return _0x5e1fda['status'](_0x332d77)[_0xbbc5('0x1a')]();};}function respondWithResult(_0x37d3ab,_0x49b632){_0x49b632=_0x49b632||0xc8;return function(_0x6c24c7){if(_0x6c24c7){return _0x37d3ab[_0xbbc5('0x1b')](_0x49b632)[_0xbbc5('0x1c')](_0x6c24c7);}};}function respondWithFilteredResult(_0x189efc,_0x3d0bae){return function(_0x131f71){if(_0x131f71){var _0x2d0d6a=_0x131f71[_0xbbc5('0x1d')],_0x2f3bb=_0x3d0bae[_0xbbc5('0x1e')],_0x10123b=_0x3d0bae[_0xbbc5('0x1e')]+_0x3d0bae[_0xbbc5('0x1f')],_0x2eb041;if(_0x10123b>=_0x2d0d6a){_0x10123b=_0x2d0d6a;_0x2eb041=0xc8;}else{_0x2eb041=0xce;}_0x189efc[_0xbbc5('0x1b')](_0x2eb041);return _0x189efc[_0xbbc5('0x20')](_0xbbc5('0x21'),_0x2f3bb+'-'+_0x10123b+'/'+_0x2d0d6a)[_0xbbc5('0x1c')](_0x131f71);}return null;};}function patchUpdates(_0x4eba6d){return function(_0x23e595){try{jsonpatch[_0xbbc5('0x22')](_0x23e595,_0x4eba6d,!![]);}catch(_0x4d4d8b){return BPromise[_0xbbc5('0x23')](_0x4d4d8b);}return _0x23e595[_0xbbc5('0x24')]();};}function saveUpdates(_0x8a2067,_0xcf8c86){return function(_0x549a6b){if(_0x549a6b){return _0x549a6b['update'](_0x8a2067)[_0xbbc5('0x25')](function(_0x906c4d){return _0x906c4d;});}return null;};}function removeEntity(_0x4a9827,_0x15632a){return function(_0x5cdaec){if(_0x5cdaec){return _0x5cdaec['destroy']()[_0xbbc5('0x25')](function(){_0x4a9827[_0xbbc5('0x1b')](0xcc)[_0xbbc5('0x1a')]();});}};}function handleEntityNotFound(_0x202668,_0xe332da){return function(_0x130224){if(!_0x130224){_0x202668[_0xbbc5('0x19')](0x194);}return _0x130224;};}function handleError(_0x2eff61,_0x51b170){_0x51b170=_0x51b170||0x1f4;return function(_0x5291dd){logger[_0xbbc5('0x26')](_0x5291dd[_0xbbc5('0x27')]);if(_0x5291dd[_0xbbc5('0x28')]){delete _0x5291dd[_0xbbc5('0x28')];}_0x2eff61[_0xbbc5('0x1b')](_0x51b170)[_0xbbc5('0x29')](_0x5291dd);};}exports[_0xbbc5('0x2a')]=function(_0xe2b2cd,_0x226268){var _0x4b1430={},_0x547382={},_0x1aaddc={'count':0x0,'rows':[]};var _0x5aed36=_[_0xbbc5('0x2b')](db[_0xbbc5('0x2c')][_0xbbc5('0x2d')],function(_0x3c78c5){return{'name':_0x3c78c5[_0xbbc5('0x2e')],'type':_0x3c78c5['type'][_0xbbc5('0x2f')]};});_0x547382[_0xbbc5('0x30')]=_[_0xbbc5('0x2b')](_0x5aed36,_0xbbc5('0x28'));_0x547382[_0xbbc5('0x31')]=_[_0xbbc5('0x32')](_0xe2b2cd['query']);_0x547382[_0xbbc5('0x33')]=_[_0xbbc5('0x34')](_0x547382[_0xbbc5('0x30')],_0x547382[_0xbbc5('0x31')]);_0x4b1430[_0xbbc5('0x35')]=_[_0xbbc5('0x34')](_0x547382[_0xbbc5('0x30')],qs[_0xbbc5('0x36')](_0xe2b2cd[_0xbbc5('0x31')]['fields']));_0x4b1430[_0xbbc5('0x35')]=_0x4b1430['attributes']['length']?_0x4b1430[_0xbbc5('0x35')]:_0x547382['model'];if(!_0xe2b2cd[_0xbbc5('0x31')][_0xbbc5('0x37')](_0xbbc5('0x38'))){_0x4b1430[_0xbbc5('0x1f')]=qs['limit'](_0xe2b2cd[_0xbbc5('0x31')]['limit']);_0x4b1430[_0xbbc5('0x1e')]=qs[_0xbbc5('0x1e')](_0xe2b2cd['query'][_0xbbc5('0x1e')]);}_0x4b1430[_0xbbc5('0x39')]=qs[_0xbbc5('0x3a')](_0xe2b2cd[_0xbbc5('0x31')][_0xbbc5('0x3a')]);_0x4b1430['where']=qs[_0xbbc5('0x33')](_[_0xbbc5('0x3b')](_0xe2b2cd['query'],_0x547382[_0xbbc5('0x33')]),_0x5aed36);if(_0xe2b2cd[_0xbbc5('0x31')]['filter']){_0x4b1430[_0xbbc5('0x3c')]=_[_0xbbc5('0x3d')](_0x4b1430[_0xbbc5('0x3c')],{'$or':_[_0xbbc5('0x2b')](_0x5aed36,function(_0x2b1649){if(_0x2b1649[_0xbbc5('0x3e')]!==_0xbbc5('0x3f')){var _0xe50452={};_0xe50452[_0x2b1649[_0xbbc5('0x28')]]={'$like':'%'+_0xe2b2cd[_0xbbc5('0x31')][_0xbbc5('0x40')]+'%'};return _0xe50452;}})});}_0x4b1430=_['merge']({},_0x4b1430,_0xe2b2cd[_0xbbc5('0x41')]);var _0x5f507d={'where':_0x4b1430[_0xbbc5('0x3c')]};return db['MemberReport'][_0xbbc5('0x1d')](_0x5f507d)[_0xbbc5('0x25')](function(_0x674743){_0x1aaddc[_0xbbc5('0x1d')]=_0x674743;if(_0xe2b2cd[_0xbbc5('0x31')][_0xbbc5('0x42')]){_0x4b1430['include']=[{'all':!![]}];}return db[_0xbbc5('0x2c')][_0xbbc5('0x43')](_0x4b1430);})[_0xbbc5('0x25')](function(_0x5a7cd0){_0x1aaddc['rows']=_0x5a7cd0;return _0x1aaddc;})[_0xbbc5('0x25')](respondWithFilteredResult(_0x226268,_0x4b1430))[_0xbbc5('0x44')](handleError(_0x226268,null));};exports[_0xbbc5('0x45')]=function(_0x7a9553,_0x1bb719){var _0xe51eba={'raw':!![],'where':{'id':_0x7a9553[_0xbbc5('0x46')]['id']}},_0x484532={};_0x484532['model']=_['keys'](db['MemberReport'][_0xbbc5('0x2d')]);_0x484532['query']=_[_0xbbc5('0x32')](_0x7a9553[_0xbbc5('0x31')]);_0x484532[_0xbbc5('0x33')]=_[_0xbbc5('0x34')](_0x484532['model'],_0x484532[_0xbbc5('0x31')]);_0xe51eba[_0xbbc5('0x35')]=_[_0xbbc5('0x34')](_0x484532[_0xbbc5('0x30')],qs[_0xbbc5('0x36')](_0x7a9553[_0xbbc5('0x31')]['fields']));_0xe51eba[_0xbbc5('0x35')]=_0xe51eba[_0xbbc5('0x35')]['length']?_0xe51eba[_0xbbc5('0x35')]:_0x484532[_0xbbc5('0x30')];if(_0x7a9553['query'][_0xbbc5('0x42')]){_0xe51eba[_0xbbc5('0x47')]=[{'all':!![]}];}_0xe51eba=_['merge']({},_0xe51eba,_0x7a9553[_0xbbc5('0x41')]);return db['MemberReport'][_0xbbc5('0x48')](_0xe51eba)[_0xbbc5('0x25')](handleEntityNotFound(_0x1bb719,null))[_0xbbc5('0x25')](respondWithResult(_0x1bb719,null))[_0xbbc5('0x44')](handleError(_0x1bb719,null));};exports[_0xbbc5('0x49')]=function(_0x49a2a3,_0x19a94b){return db[_0xbbc5('0x2c')]['create'](_0x49a2a3[_0xbbc5('0x4a')],{})[_0xbbc5('0x25')](respondWithResult(_0x19a94b,0xc9))['catch'](handleError(_0x19a94b,null));};exports[_0xbbc5('0x4b')]=function(_0x1ac4a5,_0x4de923){if(_0x1ac4a5[_0xbbc5('0x4a')]['id']){delete _0x1ac4a5[_0xbbc5('0x4a')]['id'];}return db[_0xbbc5('0x2c')][_0xbbc5('0x48')]({'where':{'id':_0x1ac4a5[_0xbbc5('0x46')]['id']}})[_0xbbc5('0x25')](handleEntityNotFound(_0x4de923,null))[_0xbbc5('0x25')](saveUpdates(_0x1ac4a5[_0xbbc5('0x4a')],null))[_0xbbc5('0x25')](respondWithResult(_0x4de923,null))[_0xbbc5('0x44')](handleError(_0x4de923,null));};exports[_0xbbc5('0x4c')]=function(_0x6ce44a,_0x154e13){return db['MemberReport'][_0xbbc5('0x48')]({'where':{'id':_0x6ce44a[_0xbbc5('0x46')]['id']}})[_0xbbc5('0x25')](handleEntityNotFound(_0x154e13,null))['then'](removeEntity(_0x154e13,null))[_0xbbc5('0x44')](handleError(_0x154e13,null));};exports[_0xbbc5('0x4d')]=function(_0x4f2292,_0x492e8b){return db[_0xbbc5('0x2c')][_0xbbc5('0x4d')]()[_0xbbc5('0x25')](respondWithResult(_0x492e8b,null))[_0xbbc5('0x44')](handleError(_0x492e8b,null));}; \ No newline at end of file +var _0x81c3=['util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','MemberReport','fieldName','type','query','keys','filters','intersection','attributes','model','fields','length','nolimit','order','sort','where','filter','merge','VIRTUAL','options','includeAll','include','rows','show','params','rawAttributes','create','body','catch','find','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird'];(function(_0x2c33f4,_0x25ece0){var _0x51023=function(_0xc2582){while(--_0xc2582){_0x2c33f4['push'](_0x2c33f4['shift']());}};_0x51023(++_0x25ece0);}(_0x81c3,0x1b0));var _0x381c=function(_0x113553,_0x31f370){_0x113553=_0x113553-0x0;var _0x30ae4=_0x81c3[_0x113553];return _0x30ae4;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x381c('0x0'));var rimraf=require(_0x381c('0x1'));var zipdir=require(_0x381c('0x2'));var jsonpatch=require(_0x381c('0x3'));var rp=require('request-promise');var moment=require(_0x381c('0x4'));var BPromise=require(_0x381c('0x5'));var Mustache=require('mustache');var util=require(_0x381c('0x6'));var path=require(_0x381c('0x7'));var sox=require(_0x381c('0x8'));var csv=require(_0x381c('0x9'));var ejs=require(_0x381c('0xa'));var fs=require('fs');var _=require(_0x381c('0xb'));var squel=require(_0x381c('0xc'));var crypto=require(_0x381c('0xd'));var jsforce=require(_0x381c('0xe'));var deskjs=require(_0x381c('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x381c('0x10'));var qs=require(_0x381c('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x381c('0x12'));var logger=require(_0x381c('0x13'))('api');var utils=require(_0x381c('0x14'));var config=require('../../config/environment');var db=require(_0x381c('0x15'))['db'];function respondWithStatusCode(_0x5e3e1c,_0x4abb06){_0x4abb06=_0x4abb06||0xcc;return function(_0x5ee79d){if(_0x5ee79d){return _0x5e3e1c[_0x381c('0x16')](_0x4abb06);}return _0x5e3e1c[_0x381c('0x17')](_0x4abb06)[_0x381c('0x18')]();};}function respondWithResult(_0x2eaaaf,_0x23487c){_0x23487c=_0x23487c||0xc8;return function(_0x30e441){if(_0x30e441){return _0x2eaaaf['status'](_0x23487c)[_0x381c('0x19')](_0x30e441);}};}function respondWithFilteredResult(_0x3ae63d,_0x42a31c){return function(_0x4ecdb9){if(_0x4ecdb9){var _0x7158ef=_0x4ecdb9[_0x381c('0x1a')],_0x234a89=_0x42a31c[_0x381c('0x1b')],_0x3dbfd9=_0x42a31c[_0x381c('0x1b')]+_0x42a31c[_0x381c('0x1c')],_0x219bff;if(_0x3dbfd9>=_0x7158ef){_0x3dbfd9=_0x7158ef;_0x219bff=0xc8;}else{_0x219bff=0xce;}_0x3ae63d[_0x381c('0x17')](_0x219bff);return _0x3ae63d[_0x381c('0x1d')](_0x381c('0x1e'),_0x234a89+'-'+_0x3dbfd9+'/'+_0x7158ef)[_0x381c('0x19')](_0x4ecdb9);}return null;};}function patchUpdates(_0x38fa32){return function(_0x2aef27){try{jsonpatch[_0x381c('0x1f')](_0x2aef27,_0x38fa32,!![]);}catch(_0xd4e098){return BPromise[_0x381c('0x20')](_0xd4e098);}return _0x2aef27[_0x381c('0x21')]();};}function saveUpdates(_0x3564b0,_0x30d89b){return function(_0x5a42ef){if(_0x5a42ef){return _0x5a42ef[_0x381c('0x22')](_0x3564b0)[_0x381c('0x23')](function(_0x308818){return _0x308818;});}return null;};}function removeEntity(_0x109c51,_0x2d0acd){return function(_0xa183bb){if(_0xa183bb){return _0xa183bb[_0x381c('0x24')]()[_0x381c('0x23')](function(){_0x109c51['status'](0xcc)[_0x381c('0x18')]();});}};}function handleEntityNotFound(_0x52bc06,_0x4ed316){return function(_0x37732d){if(!_0x37732d){_0x52bc06[_0x381c('0x16')](0x194);}return _0x37732d;};}function handleError(_0x1abee1,_0x2db0b2){_0x2db0b2=_0x2db0b2||0x1f4;return function(_0x316fa7){logger[_0x381c('0x25')](_0x316fa7[_0x381c('0x26')]);if(_0x316fa7['name']){delete _0x316fa7[_0x381c('0x27')];}_0x1abee1['status'](_0x2db0b2)[_0x381c('0x28')](_0x316fa7);};}exports[_0x381c('0x29')]=function(_0x3a352f,_0x325e4d){var _0x62c4ff={},_0x19fc8b={},_0x585de3={'count':0x0,'rows':[]};var _0x401877=_[_0x381c('0x2a')](db[_0x381c('0x2b')]['rawAttributes'],function(_0x4e0ea0){return{'name':_0x4e0ea0[_0x381c('0x2c')],'type':_0x4e0ea0[_0x381c('0x2d')]['key']};});_0x19fc8b['model']=_['map'](_0x401877,_0x381c('0x27'));_0x19fc8b[_0x381c('0x2e')]=_[_0x381c('0x2f')](_0x3a352f[_0x381c('0x2e')]);_0x19fc8b[_0x381c('0x30')]=_[_0x381c('0x31')](_0x19fc8b['model'],_0x19fc8b[_0x381c('0x2e')]);_0x62c4ff[_0x381c('0x32')]=_['intersection'](_0x19fc8b[_0x381c('0x33')],qs['fields'](_0x3a352f[_0x381c('0x2e')][_0x381c('0x34')]));_0x62c4ff['attributes']=_0x62c4ff[_0x381c('0x32')][_0x381c('0x35')]?_0x62c4ff[_0x381c('0x32')]:_0x19fc8b['model'];if(!_0x3a352f[_0x381c('0x2e')]['hasOwnProperty'](_0x381c('0x36'))){_0x62c4ff[_0x381c('0x1c')]=qs[_0x381c('0x1c')](_0x3a352f[_0x381c('0x2e')][_0x381c('0x1c')]);_0x62c4ff[_0x381c('0x1b')]=qs['offset'](_0x3a352f[_0x381c('0x2e')]['offset']);}_0x62c4ff[_0x381c('0x37')]=qs[_0x381c('0x38')](_0x3a352f[_0x381c('0x2e')]['sort']);_0x62c4ff[_0x381c('0x39')]=qs['filters'](_['pick'](_0x3a352f[_0x381c('0x2e')],_0x19fc8b[_0x381c('0x30')]),_0x401877);if(_0x3a352f[_0x381c('0x2e')][_0x381c('0x3a')]){_0x62c4ff[_0x381c('0x39')]=_[_0x381c('0x3b')](_0x62c4ff[_0x381c('0x39')],{'$or':_[_0x381c('0x2a')](_0x401877,function(_0xbcd4bd){if(_0xbcd4bd[_0x381c('0x2d')]!==_0x381c('0x3c')){var _0xfdd8b6={};_0xfdd8b6[_0xbcd4bd['name']]={'$like':'%'+_0x3a352f[_0x381c('0x2e')][_0x381c('0x3a')]+'%'};return _0xfdd8b6;}})});}_0x62c4ff=_[_0x381c('0x3b')]({},_0x62c4ff,_0x3a352f[_0x381c('0x3d')]);var _0x54f9bc={'where':_0x62c4ff[_0x381c('0x39')]};return db['MemberReport'][_0x381c('0x1a')](_0x54f9bc)[_0x381c('0x23')](function(_0x54ef5){_0x585de3[_0x381c('0x1a')]=_0x54ef5;if(_0x3a352f[_0x381c('0x2e')][_0x381c('0x3e')]){_0x62c4ff[_0x381c('0x3f')]=[{'all':!![]}];}return db[_0x381c('0x2b')]['findAll'](_0x62c4ff);})[_0x381c('0x23')](function(_0xa3d0a4){_0x585de3[_0x381c('0x40')]=_0xa3d0a4;return _0x585de3;})[_0x381c('0x23')](respondWithFilteredResult(_0x325e4d,_0x62c4ff))['catch'](handleError(_0x325e4d,null));};exports[_0x381c('0x41')]=function(_0x415cc6,_0x390a5d){var _0x40be84={'raw':!![],'where':{'id':_0x415cc6[_0x381c('0x42')]['id']}},_0x274f23={};_0x274f23['model']=_[_0x381c('0x2f')](db[_0x381c('0x2b')][_0x381c('0x43')]);_0x274f23['query']=_['keys'](_0x415cc6[_0x381c('0x2e')]);_0x274f23['filters']=_[_0x381c('0x31')](_0x274f23[_0x381c('0x33')],_0x274f23[_0x381c('0x2e')]);_0x40be84[_0x381c('0x32')]=_[_0x381c('0x31')](_0x274f23[_0x381c('0x33')],qs[_0x381c('0x34')](_0x415cc6[_0x381c('0x2e')][_0x381c('0x34')]));_0x40be84[_0x381c('0x32')]=_0x40be84[_0x381c('0x32')][_0x381c('0x35')]?_0x40be84[_0x381c('0x32')]:_0x274f23[_0x381c('0x33')];if(_0x415cc6[_0x381c('0x2e')]['includeAll']){_0x40be84[_0x381c('0x3f')]=[{'all':!![]}];}_0x40be84=_[_0x381c('0x3b')]({},_0x40be84,_0x415cc6[_0x381c('0x3d')]);return db[_0x381c('0x2b')]['find'](_0x40be84)[_0x381c('0x23')](handleEntityNotFound(_0x390a5d,null))[_0x381c('0x23')](respondWithResult(_0x390a5d,null))['catch'](handleError(_0x390a5d,null));};exports['create']=function(_0x3f3e66,_0x1237eb){return db['MemberReport'][_0x381c('0x44')](_0x3f3e66[_0x381c('0x45')],{})['then'](respondWithResult(_0x1237eb,0xc9))[_0x381c('0x46')](handleError(_0x1237eb,null));};exports[_0x381c('0x22')]=function(_0x275722,_0x590f14){if(_0x275722[_0x381c('0x45')]['id']){delete _0x275722['body']['id'];}return db[_0x381c('0x2b')][_0x381c('0x47')]({'where':{'id':_0x275722[_0x381c('0x42')]['id']}})[_0x381c('0x23')](handleEntityNotFound(_0x590f14,null))[_0x381c('0x23')](saveUpdates(_0x275722[_0x381c('0x45')],null))[_0x381c('0x23')](respondWithResult(_0x590f14,null))[_0x381c('0x46')](handleError(_0x590f14,null));};exports[_0x381c('0x24')]=function(_0x462c74,_0x27ba1f){return db[_0x381c('0x2b')][_0x381c('0x47')]({'where':{'id':_0x462c74[_0x381c('0x42')]['id']}})[_0x381c('0x23')](handleEntityNotFound(_0x27ba1f,null))[_0x381c('0x23')](removeEntity(_0x27ba1f,null))['catch'](handleError(_0x27ba1f,null));};exports[_0x381c('0x48')]=function(_0x2203a5,_0x71a7e6){return db[_0x381c('0x2b')]['describe']()['then'](respondWithResult(_0x71a7e6,null))['catch'](handleError(_0x71a7e6,null));}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.model.js b/server/api/memberReport/memberReport.model.js index a864a23..aee57e7 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 _0xe0ae=['membername','../../config/logger','api','bluebird','path','rimraf','./memberReport.attributes','define','MemberReport','report_member'];(function(_0x141cdc,_0xa038e9){var _0x2d7d88=function(_0x5d161f){while(--_0x5d161f){_0x141cdc['push'](_0x141cdc['shift']());}};_0x2d7d88(++_0xa038e9);}(_0xe0ae,0xa1));var _0xee0a=function(_0x3f7598,_0x212e37){_0x3f7598=_0x3f7598-0x0;var _0x51fb16=_0xe0ae[_0x3f7598];return _0x51fb16;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xee0a('0x0'))(_0xee0a('0x1'));var moment=require('moment');var BPromise=require(_0xee0a('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xee0a('0x3'));var rimraf=require(_0xee0a('0x4'));var config=require('../../config/environment');var attributes=require(_0xee0a('0x5'));module['exports']=function(_0x5bef07,_0x39a302){return _0x5bef07[_0xee0a('0x6')](_0xee0a('0x7'),attributes,{'tableName':_0xee0a('0x8'),'paranoid':![],'indexes':[{'name':'membername_interface','fields':[_0xee0a('0x9'),'interface']}],'timestamps':!![]});}; \ No newline at end of file +var _0x8958=['../../config/environment','./memberReport.attributes','define','MemberReport','report_member','membername','interface','util','request-promise','rimraf'];(function(_0x3401e7,_0x496f1b){var _0x5d191c=function(_0x5625d2){while(--_0x5625d2){_0x3401e7['push'](_0x3401e7['shift']());}};_0x5d191c(++_0x496f1b);}(_0x8958,0x93));var _0x8895=function(_0x4305ae,_0x9433a5){_0x4305ae=_0x4305ae-0x0;var _0x46bf2f=_0x8958[_0x4305ae];return _0x46bf2f;};'use strict';var _=require('lodash');var util=require(_0x8895('0x0'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x8895('0x1'));var fs=require('fs');var path=require('path');var rimraf=require(_0x8895('0x2'));var config=require(_0x8895('0x3'));var attributes=require(_0x8895('0x4'));module['exports']=function(_0x22fa52,_0x2f03ad){return _0x22fa52[_0x8895('0x5')](_0x8895('0x6'),attributes,{'tableName':_0x8895('0x7'),'paranoid':![],'indexes':[{'name':'membername_interface','fields':[_0x8895('0x8'),_0x8895('0x9')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.rpc.js b/server/api/memberReport/memberReport.rpc.js index 9fa2776..7372ff4 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 _0x7fae=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','MemberReport,\x20%s,\x20%s','request\x20sent','MemberReport,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','GetMemberReport','MemberReport','findAll','options','raw','attributes','limit','include','model','map','info','debug','create','body','then','CreateMemberReport','stringify','UpdateMemberReport','update','where','util','moment','bluebird','randomstring'];(function(_0x2a24d9,_0x15a0d0){var _0x14c2d3=function(_0x4c6038){while(--_0x4c6038){_0x2a24d9['push'](_0x2a24d9['shift']());}};_0x14c2d3(++_0x15a0d0);}(_0x7fae,0x16d));var _0xe7fa=function(_0x1928c9,_0x13a6d1){_0x1928c9=_0x1928c9-0x0;var _0x51b5fb=_0x7fae[_0x1928c9];return _0x51b5fb;};'use strict';var _=require('lodash');var util=require(_0xe7fa('0x0'));var moment=require(_0xe7fa('0x1'));var BPromise=require(_0xe7fa('0x2'));var rs=require(_0xe7fa('0x3'));var fs=require('fs');var Redis=require(_0xe7fa('0x4'));var db=require(_0xe7fa('0x5'))['db'];var utils=require(_0xe7fa('0x6'));var logger=require(_0xe7fa('0x7'))(_0xe7fa('0x8'));var config=require(_0xe7fa('0x9'));var jayson=require(_0xe7fa('0xa'));var client=jayson['client'][_0xe7fa('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x141040,_0x58d107,_0xa89ae1){return new BPromise(function(_0x4ee0f2,_0x4dc051){return client[_0xe7fa('0xc')](_0x141040,_0xa89ae1)['then'](function(_0x9a0675){logger['info'](_0xe7fa('0xd'),_0x58d107,_0xe7fa('0xe'));logger['debug'](_0xe7fa('0xf'),_0x58d107,_0xe7fa('0xe'),JSON['stringify'](_0x9a0675));if(_0x9a0675[_0xe7fa('0x10')]){if(_0x9a0675[_0xe7fa('0x10')][_0xe7fa('0x11')]===0x1f4){logger[_0xe7fa('0x10')]('MemberReport,\x20%s,\x20%s',_0x58d107,_0x9a0675[_0xe7fa('0x10')][_0xe7fa('0x12')]);return _0x4dc051(_0x9a0675[_0xe7fa('0x10')][_0xe7fa('0x12')]);}logger[_0xe7fa('0x10')](_0xe7fa('0xd'),_0x58d107,_0x9a0675[_0xe7fa('0x10')]['message']);return _0x4ee0f2(_0x9a0675[_0xe7fa('0x10')][_0xe7fa('0x12')]);}else{logger['info'](_0xe7fa('0xd'),_0x58d107,_0xe7fa('0xe'));_0x4ee0f2(_0x9a0675[_0xe7fa('0x13')][_0xe7fa('0x12')]);}})[_0xe7fa('0x14')](function(_0x24203a){logger[_0xe7fa('0x10')]('MemberReport,\x20%s,\x20%s',_0x58d107,_0x24203a);_0x4dc051(_0x24203a);});});}exports[_0xe7fa('0x15')]=function(_0x37d756){var _0x101581=this;return new Promise(function(_0xcde3d0,_0x1d8900){return db[_0xe7fa('0x16')][_0xe7fa('0x17')]({'raw':_0x37d756[_0xe7fa('0x18')]?_0x37d756[_0xe7fa('0x18')][_0xe7fa('0x19')]===undefined?!![]:![]:!![],'where':_0x37d756[_0xe7fa('0x18')]?_0x37d756[_0xe7fa('0x18')]['where']||null:null,'attributes':_0x37d756[_0xe7fa('0x18')]?_0x37d756[_0xe7fa('0x18')][_0xe7fa('0x1a')]||null:null,'limit':_0x37d756[_0xe7fa('0x18')]?_0x37d756['options'][_0xe7fa('0x1b')]||null:null,'include':_0x37d756['options']?_0x37d756[_0xe7fa('0x18')][_0xe7fa('0x1c')]?_['map'](_0x37d756['options']['include'],function(_0x26d2c2){return{'model':db[_0x26d2c2[_0xe7fa('0x1d')]],'as':_0x26d2c2['as'],'attributes':_0x26d2c2[_0xe7fa('0x1a')],'include':_0x26d2c2['include']?_[_0xe7fa('0x1e')](_0x26d2c2[_0xe7fa('0x1c')],function(_0x4556a0){return{'model':db[_0x4556a0[_0xe7fa('0x1d')]],'as':_0x4556a0['as'],'attributes':_0x4556a0[_0xe7fa('0x1a')],'include':_0x4556a0[_0xe7fa('0x1c')]?_[_0xe7fa('0x1e')](_0x4556a0[_0xe7fa('0x1c')],function(_0x436867){return{'model':db[_0x436867['model']],'as':_0x436867['as'],'attributes':_0x436867['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x45da8f){logger[_0xe7fa('0x1f')]('GetMemberReport',_0x37d756);logger[_0xe7fa('0x20')]('GetMemberReport',_0x37d756,JSON['stringify'](_0x45da8f));_0xcde3d0(_0x45da8f);})['catch'](function(_0x53abb8){logger[_0xe7fa('0x10')](_0xe7fa('0x15'),_0x53abb8['message'],_0x37d756);_0x1d8900(_0x101581[_0xe7fa('0x10')](0x1f4,_0x53abb8[_0xe7fa('0x12')]));});});};exports['CreateMemberReport']=function(_0x2478f8){var _0x4833d8=this;return new Promise(function(_0x3f8947,_0x5a1e9e){return db[_0xe7fa('0x16')][_0xe7fa('0x21')](_0x2478f8[_0xe7fa('0x22')],{'raw':_0x2478f8[_0xe7fa('0x18')]?_0x2478f8[_0xe7fa('0x18')][_0xe7fa('0x19')]===undefined?!![]:![]:!![]})[_0xe7fa('0x23')](function(_0xbdebf7){logger[_0xe7fa('0x1f')](_0xe7fa('0x24'),_0x2478f8);logger[_0xe7fa('0x20')]('CreateMemberReport',_0x2478f8,JSON[_0xe7fa('0x25')](_0xbdebf7));_0x3f8947(_0xbdebf7);})[_0xe7fa('0x14')](function(_0x432bb0){logger[_0xe7fa('0x10')]('CreateMemberReport',_0x432bb0[_0xe7fa('0x12')],_0x2478f8);_0x5a1e9e(_0x4833d8[_0xe7fa('0x10')](0x1f4,_0x432bb0[_0xe7fa('0x12')]));});});};exports[_0xe7fa('0x26')]=function(_0x272896){var _0xcae4b6=this;return new Promise(function(_0x58189e,_0x145678){return db[_0xe7fa('0x16')][_0xe7fa('0x27')](_0x272896['body'],{'raw':_0x272896['options']?_0x272896[_0xe7fa('0x18')][_0xe7fa('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x272896[_0xe7fa('0x18')]?_0x272896[_0xe7fa('0x18')][_0xe7fa('0x28')]||null:null,'attributes':_0x272896[_0xe7fa('0x18')]?_0x272896[_0xe7fa('0x18')]['attributes']||null:null,'limit':_0x272896[_0xe7fa('0x18')]?_0x272896[_0xe7fa('0x18')][_0xe7fa('0x1b')]||null:null})['then'](function(_0x1d0b8e){logger[_0xe7fa('0x1f')]('UpdateMemberReport',_0x272896);logger['debug'](_0xe7fa('0x26'),_0x272896,JSON[_0xe7fa('0x25')](_0x1d0b8e));_0x58189e(_0x1d0b8e);})[_0xe7fa('0x14')](function(_0xab577b){logger[_0xe7fa('0x10')](_0xe7fa('0x26'),_0xab577b[_0xe7fa('0x12')],_0x272896);_0x145678(_0xcae4b6[_0xe7fa('0x10')](0x1f4,_0xab577b[_0xe7fa('0x12')]));});});}; \ No newline at end of file +var _0x8911=['body','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info','debug','MemberReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','MemberReport,\x20%s,\x20%s','result','catch','GetMemberReport','MemberReport','findAll','options','where','attributes','limit','include','map','model','CreateMemberReport','UpdateMemberReport','update'];(function(_0x119e3f,_0x24e162){var _0x453d58=function(_0x34ffdb){while(--_0x34ffdb){_0x119e3f['push'](_0x119e3f['shift']());}};_0x453d58(++_0x24e162);}(_0x8911,0x173));var _0x1891=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x8911[_0x14add3];return _0x4a174f;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0x1891('0x0'));var rs=require(_0x1891('0x1'));var fs=require('fs');var Redis=require(_0x1891('0x2'));var db=require(_0x1891('0x3'))['db'];var utils=require(_0x1891('0x4'));var logger=require(_0x1891('0x5'))(_0x1891('0x6'));var config=require(_0x1891('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x1891('0x8')][_0x1891('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3ffcf1,_0x398171,_0x5b98bf){return new BPromise(function(_0x2c0859,_0x58f936){return client[_0x1891('0xa')](_0x3ffcf1,_0x5b98bf)[_0x1891('0xb')](function(_0x4cb230){logger[_0x1891('0xc')]('MemberReport,\x20%s,\x20%s',_0x398171,'request\x20sent');logger[_0x1891('0xd')](_0x1891('0xe'),_0x398171,_0x1891('0xf'),JSON[_0x1891('0x10')](_0x4cb230));if(_0x4cb230[_0x1891('0x11')]){if(_0x4cb230[_0x1891('0x11')][_0x1891('0x12')]===0x1f4){logger['error']('MemberReport,\x20%s,\x20%s',_0x398171,_0x4cb230['error'][_0x1891('0x13')]);return _0x58f936(_0x4cb230[_0x1891('0x11')]['message']);}logger[_0x1891('0x11')](_0x1891('0x14'),_0x398171,_0x4cb230[_0x1891('0x11')][_0x1891('0x13')]);return _0x2c0859(_0x4cb230[_0x1891('0x11')][_0x1891('0x13')]);}else{logger[_0x1891('0xc')](_0x1891('0x14'),_0x398171,_0x1891('0xf'));_0x2c0859(_0x4cb230[_0x1891('0x15')][_0x1891('0x13')]);}})[_0x1891('0x16')](function(_0x572906){logger[_0x1891('0x11')](_0x1891('0x14'),_0x398171,_0x572906);_0x58f936(_0x572906);});});}exports[_0x1891('0x17')]=function(_0x3df026){var _0x21e52c=this;return new Promise(function(_0x2e0f27,_0x3bd415){return db[_0x1891('0x18')][_0x1891('0x19')]({'raw':_0x3df026['options']?_0x3df026[_0x1891('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x3df026[_0x1891('0x1a')]?_0x3df026['options'][_0x1891('0x1b')]||null:null,'attributes':_0x3df026['options']?_0x3df026[_0x1891('0x1a')][_0x1891('0x1c')]||null:null,'limit':_0x3df026['options']?_0x3df026[_0x1891('0x1a')][_0x1891('0x1d')]||null:null,'include':_0x3df026[_0x1891('0x1a')]?_0x3df026[_0x1891('0x1a')][_0x1891('0x1e')]?_[_0x1891('0x1f')](_0x3df026['options'][_0x1891('0x1e')],function(_0x1a3eca){return{'model':db[_0x1a3eca[_0x1891('0x20')]],'as':_0x1a3eca['as'],'attributes':_0x1a3eca[_0x1891('0x1c')],'include':_0x1a3eca[_0x1891('0x1e')]?_[_0x1891('0x1f')](_0x1a3eca[_0x1891('0x1e')],function(_0x1f7440){return{'model':db[_0x1f7440['model']],'as':_0x1f7440['as'],'attributes':_0x1f7440[_0x1891('0x1c')],'include':_0x1f7440[_0x1891('0x1e')]?_[_0x1891('0x1f')](_0x1f7440[_0x1891('0x1e')],function(_0x2a2c5b){return{'model':db[_0x2a2c5b['model']],'as':_0x2a2c5b['as'],'attributes':_0x2a2c5b[_0x1891('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x1891('0xb')](function(_0x23bb97){logger[_0x1891('0xc')](_0x1891('0x17'),_0x3df026);logger[_0x1891('0xd')](_0x1891('0x17'),_0x3df026,JSON['stringify'](_0x23bb97));_0x2e0f27(_0x23bb97);})[_0x1891('0x16')](function(_0x4e115b){logger[_0x1891('0x11')](_0x1891('0x17'),_0x4e115b[_0x1891('0x13')],_0x3df026);_0x3bd415(_0x21e52c['error'](0x1f4,_0x4e115b[_0x1891('0x13')]));});});};exports[_0x1891('0x21')]=function(_0x24b820){var _0x362936=this;return new Promise(function(_0x21ae08,_0x530fc5){return db[_0x1891('0x18')]['create'](_0x24b820['body'],{'raw':_0x24b820[_0x1891('0x1a')]?_0x24b820[_0x1891('0x1a')]['raw']===undefined?!![]:![]:!![]})[_0x1891('0xb')](function(_0xc27b0d){logger[_0x1891('0xc')](_0x1891('0x21'),_0x24b820);logger[_0x1891('0xd')](_0x1891('0x21'),_0x24b820,JSON[_0x1891('0x10')](_0xc27b0d));_0x21ae08(_0xc27b0d);})[_0x1891('0x16')](function(_0x13a67d){logger[_0x1891('0x11')]('CreateMemberReport',_0x13a67d[_0x1891('0x13')],_0x24b820);_0x530fc5(_0x362936[_0x1891('0x11')](0x1f4,_0x13a67d['message']));});});};exports[_0x1891('0x22')]=function(_0x4c10ec){var _0x482dce=this;return new Promise(function(_0x377cf7,_0x35883c){return db[_0x1891('0x18')][_0x1891('0x23')](_0x4c10ec[_0x1891('0x24')],{'raw':_0x4c10ec['options']?_0x4c10ec[_0x1891('0x1a')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4c10ec[_0x1891('0x1a')]?_0x4c10ec['options'][_0x1891('0x1b')]||null:null,'attributes':_0x4c10ec[_0x1891('0x1a')]?_0x4c10ec[_0x1891('0x1a')][_0x1891('0x1c')]||null:null,'limit':_0x4c10ec[_0x1891('0x1a')]?_0x4c10ec[_0x1891('0x1a')][_0x1891('0x1d')]||null:null})[_0x1891('0xb')](function(_0x5d0532){logger[_0x1891('0xc')](_0x1891('0x22'),_0x4c10ec);logger[_0x1891('0xd')]('UpdateMemberReport',_0x4c10ec,JSON[_0x1891('0x10')](_0x5d0532));_0x377cf7(_0x5d0532);})['catch'](function(_0x11a21b){logger[_0x1891('0x11')](_0x1891('0x22'),_0x11a21b[_0x1891('0x13')],_0x4c10ec);_0x35883c(_0x482dce[_0x1891('0x11')](0x1f4,_0x11a21b['message']));});});}; \ No newline at end of file diff --git a/server/api/migration/index.js b/server/api/migration/index.js index 2174443..30a75ae 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 _0x0102=['connect-timeout','express','get','index','exports','util','path'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x0102,0x186));var _0x2010=function(_0x244bdb,_0x1ac118){_0x244bdb=_0x244bdb-0x0;var _0x417115=_0x0102[_0x244bdb];return _0x417115;};'use strict';var multer=require('multer');var util=require(_0x2010('0x0'));var path=require(_0x2010('0x1'));var timeout=require(_0x2010('0x2'));var express=require(_0x2010('0x3'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./migration.controller');router[_0x2010('0x4')]('/',controller[_0x2010('0x5')]);module[_0x2010('0x6')]=router; \ No newline at end of file +var _0x351d=['multer','path','connect-timeout','express','../../components/auth/service','../../config/environment','./migration.controller','index','exports'];(function(_0x352a14,_0x596a71){var _0x416e2a=function(_0xd2fc37){while(--_0xd2fc37){_0x352a14['push'](_0x352a14['shift']());}};_0x416e2a(++_0x596a71);}(_0x351d,0x90));var _0xd351=function(_0x4a9d84,_0x12a68c){_0x4a9d84=_0x4a9d84-0x0;var _0x4d80cf=_0x351d[_0x4a9d84];return _0x4d80cf;};'use strict';var multer=require(_0xd351('0x0'));var util=require('util');var path=require(_0xd351('0x1'));var timeout=require(_0xd351('0x2'));var express=require(_0xd351('0x3'));var router=express['Router']();var auth=require(_0xd351('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xd351('0x5'));var controller=require(_0xd351('0x6'));router['get']('/',controller[_0xd351('0x7')]);module[_0xd351('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 da68fc1..17a33dd 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 _0x6123=['exports','STRING','version'];(function(_0x58e074,_0x41a1ec){var _0x2e937d=function(_0x408979){while(--_0x408979){_0x58e074['push'](_0x58e074['shift']());}};_0x2e937d(++_0x41a1ec);}(_0x6123,0x1d7));var _0x3612=function(_0x11ee71,_0x4eef5c){_0x11ee71=_0x11ee71-0x0;var _0x57ffd6=_0x6123[_0x11ee71];return _0x57ffd6;};'use strict';var Sequelize=require('sequelize');module[_0x3612('0x0')]={'version':{'type':Sequelize[_0x3612('0x1')],'unique':_0x3612('0x2')}}; \ No newline at end of file +var _0x78d3=['version','sequelize','exports','STRING'];(function(_0x4c221d,_0x3bc12f){var _0x203a04=function(_0x5a3a2a){while(--_0x5a3a2a){_0x4c221d['push'](_0x4c221d['shift']());}};_0x203a04(++_0x3bc12f);}(_0x78d3,0xf1));var _0x378d=function(_0x370e1e,_0x3c4bf2){_0x370e1e=_0x370e1e-0x0;var _0x2473d0=_0x78d3[_0x370e1e];return _0x2473d0;};'use strict';var Sequelize=require(_0x378d('0x0'));module[_0x378d('0x1')]={'version':{'type':Sequelize[_0x378d('0x2')],'unique':_0x378d('0x3')}}; \ No newline at end of file diff --git a/server/api/migration/migration.controller.js b/server/api/migration/migration.controller.js index aabbc24..0f624cd 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 _0x70e0=['desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','json','offset','limit','status','set','Content-Range','apply','reject','update','then','destroy','end','stack','send','index','map','Migration','rawAttributes','fieldName','key','model','keys','query','filters','attributes','intersection','length','hasOwnProperty','nolimit','sort','where','filter','type','VIRTUAL','name','merge','options','count','includeAll','findAll','rows','catch','html-pdf','eml-format','rimraf','request-promise','moment','bluebird','mustache','path','to-csv','crypto','jsforce'];(function(_0x268916,_0x1c27e1){var _0x38f8a4=function(_0x5e9ea6){while(--_0x5e9ea6){_0x268916['push'](_0x268916['shift']());}};_0x38f8a4(++_0x1c27e1);}(_0x70e0,0x17b));var _0x070e=function(_0x5255b9,_0x11b5f5){_0x5255b9=_0x5255b9-0x0;var _0x53e23c=_0x70e0[_0x5255b9];return _0x53e23c;};'use strict';var pdf=require(_0x070e('0x0'));var emlformat=require(_0x070e('0x1'));var rimraf=require(_0x070e('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x070e('0x3'));var moment=require(_0x070e('0x4'));var BPromise=require(_0x070e('0x5'));var Mustache=require(_0x070e('0x6'));var util=require('util');var path=require(_0x070e('0x7'));var sox=require('sox');var csv=require(_0x070e('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0x070e('0x9'));var jsforce=require(_0x070e('0xa'));var deskjs=require(_0x070e('0xb'));var toCsv=require(_0x070e('0x8'));var querystring=require(_0x070e('0xc'));var Papa=require(_0x070e('0xd'));var Redis=require(_0x070e('0xe'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x070e('0xf'));var hardwareService=require(_0x070e('0x10'));var logger=require(_0x070e('0x11'))(_0x070e('0x12'));var utils=require(_0x070e('0x13'));var config=require(_0x070e('0x14'));var db=require(_0x070e('0x15'))['db'];function respondWithStatusCode(_0x1baa12,_0x39d2b9){_0x39d2b9=_0x39d2b9||0xcc;return function(_0x5bf079){if(_0x5bf079){return _0x1baa12[_0x070e('0x16')](_0x39d2b9);}return _0x1baa12['status'](_0x39d2b9)['end']();};}function respondWithResult(_0x24baba,_0x56c7ba){_0x56c7ba=_0x56c7ba||0xc8;return function(_0x4a33d2){if(_0x4a33d2){return _0x24baba['status'](_0x56c7ba)[_0x070e('0x17')](_0x4a33d2);}};}function respondWithFilteredResult(_0x14c3fd,_0x51d14d){return function(_0x5d3a38){if(_0x5d3a38){var _0x373d86=_0x5d3a38['count'],_0xeae1a5=_0x51d14d['offset'],_0x180897=_0x51d14d[_0x070e('0x18')]+_0x51d14d[_0x070e('0x19')],_0x19d9da;if(_0x180897>=_0x373d86){_0x180897=_0x373d86;_0x19d9da=0xc8;}else{_0x19d9da=0xce;}_0x14c3fd[_0x070e('0x1a')](_0x19d9da);return _0x14c3fd[_0x070e('0x1b')](_0x070e('0x1c'),_0xeae1a5+'-'+_0x180897+'/'+_0x373d86)['json'](_0x5d3a38);}return null;};}function patchUpdates(_0x3938b5){return function(_0x168dc6){try{jsonpatch[_0x070e('0x1d')](_0x168dc6,_0x3938b5,!![]);}catch(_0x3ea105){return BPromise[_0x070e('0x1e')](_0x3ea105);}return _0x168dc6['save']();};}function saveUpdates(_0x5b2f48,_0x4e958f){return function(_0x9907cf){if(_0x9907cf){return _0x9907cf[_0x070e('0x1f')](_0x5b2f48)[_0x070e('0x20')](function(_0x4be0d7){return _0x4be0d7;});}return null;};}function removeEntity(_0x5b184,_0x5dc5d2){return function(_0xf8dd5d){if(_0xf8dd5d){return _0xf8dd5d[_0x070e('0x21')]()[_0x070e('0x20')](function(){_0x5b184[_0x070e('0x1a')](0xcc)[_0x070e('0x22')]();});}};}function handleEntityNotFound(_0xa86797,_0xe405e){return function(_0x164cdf){if(!_0x164cdf){_0xa86797['sendStatus'](0x194);}return _0x164cdf;};}function handleError(_0x2f8055,_0x270061){_0x270061=_0x270061||0x1f4;return function(_0x4790eb){logger['error'](_0x4790eb[_0x070e('0x23')]);if(_0x4790eb['name']){delete _0x4790eb['name'];}_0x2f8055[_0x070e('0x1a')](_0x270061)[_0x070e('0x24')](_0x4790eb);};}exports[_0x070e('0x25')]=function(_0x1743cc,_0x4763c6){var _0x497f58={},_0x374c54={},_0x219e48={'count':0x0,'rows':[]};var _0x1d72d6=_[_0x070e('0x26')](db[_0x070e('0x27')][_0x070e('0x28')],function(_0x1a1892){return{'name':_0x1a1892[_0x070e('0x29')],'type':_0x1a1892['type'][_0x070e('0x2a')]};});_0x374c54[_0x070e('0x2b')]=_[_0x070e('0x26')](_0x1d72d6,'name');_0x374c54['query']=_[_0x070e('0x2c')](_0x1743cc[_0x070e('0x2d')]);_0x374c54[_0x070e('0x2e')]=_['intersection'](_0x374c54[_0x070e('0x2b')],_0x374c54[_0x070e('0x2d')]);_0x497f58[_0x070e('0x2f')]=_[_0x070e('0x30')](_0x374c54['model'],qs['fields'](_0x1743cc['query']['fields']));_0x497f58[_0x070e('0x2f')]=_0x497f58['attributes'][_0x070e('0x31')]?_0x497f58[_0x070e('0x2f')]:_0x374c54['model'];if(!_0x1743cc['query'][_0x070e('0x32')](_0x070e('0x33'))){_0x497f58['limit']=qs['limit'](_0x1743cc[_0x070e('0x2d')][_0x070e('0x19')]);_0x497f58[_0x070e('0x18')]=qs[_0x070e('0x18')](_0x1743cc[_0x070e('0x2d')]['offset']);}_0x497f58['order']=qs[_0x070e('0x34')](_0x1743cc[_0x070e('0x2d')][_0x070e('0x34')]);_0x497f58[_0x070e('0x35')]=qs[_0x070e('0x2e')](_['pick'](_0x1743cc[_0x070e('0x2d')],_0x374c54[_0x070e('0x2e')]),_0x1d72d6);if(_0x1743cc['query'][_0x070e('0x36')]){_0x497f58[_0x070e('0x35')]=_['merge'](_0x497f58['where'],{'$or':_['map'](_0x1d72d6,function(_0x363bff){if(_0x363bff[_0x070e('0x37')]!==_0x070e('0x38')){var _0x334733={};_0x334733[_0x363bff[_0x070e('0x39')]]={'$like':'%'+_0x1743cc['query'][_0x070e('0x36')]+'%'};return _0x334733;}})});}_0x497f58=_[_0x070e('0x3a')]({},_0x497f58,_0x1743cc[_0x070e('0x3b')]);var _0x487276={'where':_0x497f58[_0x070e('0x35')]};return db[_0x070e('0x27')][_0x070e('0x3c')](_0x487276)['then'](function(_0x13982f){_0x219e48[_0x070e('0x3c')]=_0x13982f;if(_0x1743cc['query'][_0x070e('0x3d')]){_0x497f58['include']=[{'all':!![]}];}return db[_0x070e('0x27')][_0x070e('0x3e')](_0x497f58);})[_0x070e('0x20')](function(_0x30319c){_0x219e48[_0x070e('0x3f')]=_0x30319c;return _0x219e48;})['then'](respondWithFilteredResult(_0x4763c6,_0x497f58))[_0x070e('0x40')](handleError(_0x4763c6,null));}; \ No newline at end of file +var _0x9bde=['index','map','Migration','fieldName','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','type','includeAll','include','findAll','rows','eml-format','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','sendStatus','error','stack','name'];(function(_0x23ffb1,_0x31bed0){var _0x35c70c=function(_0xc52a05){while(--_0xc52a05){_0x23ffb1['push'](_0x23ffb1['shift']());}};_0x35c70c(++_0x31bed0);}(_0x9bde,0xe1));var _0xe9bd=function(_0x63b491,_0x21ee35){_0x63b491=_0x63b491-0x0;var _0x192f8c=_0x9bde[_0x63b491];return _0x192f8c;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xe9bd('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xe9bd('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xe9bd('0x2'));var moment=require(_0xe9bd('0x3'));var BPromise=require(_0xe9bd('0x4'));var Mustache=require(_0xe9bd('0x5'));var util=require(_0xe9bd('0x6'));var path=require(_0xe9bd('0x7'));var sox=require(_0xe9bd('0x8'));var csv=require('to-csv');var ejs=require(_0xe9bd('0x9'));var fs=require('fs');var _=require(_0xe9bd('0xa'));var squel=require(_0xe9bd('0xb'));var crypto=require(_0xe9bd('0xc'));var jsforce=require(_0xe9bd('0xd'));var deskjs=require(_0xe9bd('0xe'));var toCsv=require(_0xe9bd('0xf'));var querystring=require(_0xe9bd('0x10'));var Papa=require(_0xe9bd('0x11'));var Redis=require(_0xe9bd('0x12'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xe9bd('0x13'));var hardwareService=require(_0xe9bd('0x14'));var logger=require(_0xe9bd('0x15'))('api');var utils=require(_0xe9bd('0x16'));var config=require(_0xe9bd('0x17'));var db=require(_0xe9bd('0x18'))['db'];function respondWithStatusCode(_0x141587,_0x5e022a){_0x5e022a=_0x5e022a||0xcc;return function(_0x2c1d98){if(_0x2c1d98){return _0x141587['sendStatus'](_0x5e022a);}return _0x141587[_0xe9bd('0x19')](_0x5e022a)[_0xe9bd('0x1a')]();};}function respondWithResult(_0x3435b4,_0x51109f){_0x51109f=_0x51109f||0xc8;return function(_0x47ba5e){if(_0x47ba5e){return _0x3435b4[_0xe9bd('0x19')](_0x51109f)[_0xe9bd('0x1b')](_0x47ba5e);}};}function respondWithFilteredResult(_0x3a9e5f,_0x46a59b){return function(_0x3360bd){if(_0x3360bd){var _0x389e7b=_0x3360bd[_0xe9bd('0x1c')],_0x45a9f2=_0x46a59b[_0xe9bd('0x1d')],_0x573350=_0x46a59b['offset']+_0x46a59b[_0xe9bd('0x1e')],_0x1d11a0;if(_0x573350>=_0x389e7b){_0x573350=_0x389e7b;_0x1d11a0=0xc8;}else{_0x1d11a0=0xce;}_0x3a9e5f[_0xe9bd('0x19')](_0x1d11a0);return _0x3a9e5f[_0xe9bd('0x1f')](_0xe9bd('0x20'),_0x45a9f2+'-'+_0x573350+'/'+_0x389e7b)['json'](_0x3360bd);}return null;};}function patchUpdates(_0x20ec32){return function(_0x50a5e8){try{jsonpatch[_0xe9bd('0x21')](_0x50a5e8,_0x20ec32,!![]);}catch(_0x55b869){return BPromise[_0xe9bd('0x22')](_0x55b869);}return _0x50a5e8[_0xe9bd('0x23')]();};}function saveUpdates(_0x134c4e,_0x3dda13){return function(_0x1acb82){if(_0x1acb82){return _0x1acb82[_0xe9bd('0x24')](_0x134c4e)[_0xe9bd('0x25')](function(_0x49165b){return _0x49165b;});}return null;};}function removeEntity(_0x133318,_0x28cd17){return function(_0x4ecaf5){if(_0x4ecaf5){return _0x4ecaf5[_0xe9bd('0x26')]()['then'](function(){_0x133318[_0xe9bd('0x19')](0xcc)[_0xe9bd('0x1a')]();});}};}function handleEntityNotFound(_0x36f8c0,_0xf02209){return function(_0x5bc4bf){if(!_0x5bc4bf){_0x36f8c0[_0xe9bd('0x27')](0x194);}return _0x5bc4bf;};}function handleError(_0x1e3cbb,_0x2c9a57){_0x2c9a57=_0x2c9a57||0x1f4;return function(_0x39b206){logger[_0xe9bd('0x28')](_0x39b206[_0xe9bd('0x29')]);if(_0x39b206[_0xe9bd('0x2a')]){delete _0x39b206[_0xe9bd('0x2a')];}_0x1e3cbb[_0xe9bd('0x19')](_0x2c9a57)['send'](_0x39b206);};}exports[_0xe9bd('0x2b')]=function(_0x38fdfa,_0x5ba1d6){var _0x3b13b7={},_0xc25248={},_0x119672={'count':0x0,'rows':[]};var _0x429055=_[_0xe9bd('0x2c')](db[_0xe9bd('0x2d')]['rawAttributes'],function(_0x5b7f1d){return{'name':_0x5b7f1d[_0xe9bd('0x2e')],'type':_0x5b7f1d['type'][_0xe9bd('0x2f')]};});_0xc25248[_0xe9bd('0x30')]=_[_0xe9bd('0x2c')](_0x429055,_0xe9bd('0x2a'));_0xc25248[_0xe9bd('0x31')]=_['keys'](_0x38fdfa['query']);_0xc25248[_0xe9bd('0x32')]=_[_0xe9bd('0x33')](_0xc25248[_0xe9bd('0x30')],_0xc25248[_0xe9bd('0x31')]);_0x3b13b7[_0xe9bd('0x34')]=_[_0xe9bd('0x33')](_0xc25248[_0xe9bd('0x30')],qs[_0xe9bd('0x35')](_0x38fdfa[_0xe9bd('0x31')]['fields']));_0x3b13b7[_0xe9bd('0x34')]=_0x3b13b7[_0xe9bd('0x34')][_0xe9bd('0x36')]?_0x3b13b7['attributes']:_0xc25248['model'];if(!_0x38fdfa[_0xe9bd('0x31')][_0xe9bd('0x37')](_0xe9bd('0x38'))){_0x3b13b7[_0xe9bd('0x1e')]=qs[_0xe9bd('0x1e')](_0x38fdfa[_0xe9bd('0x31')][_0xe9bd('0x1e')]);_0x3b13b7[_0xe9bd('0x1d')]=qs[_0xe9bd('0x1d')](_0x38fdfa[_0xe9bd('0x31')][_0xe9bd('0x1d')]);}_0x3b13b7[_0xe9bd('0x39')]=qs[_0xe9bd('0x3a')](_0x38fdfa[_0xe9bd('0x31')][_0xe9bd('0x3a')]);_0x3b13b7[_0xe9bd('0x3b')]=qs[_0xe9bd('0x32')](_[_0xe9bd('0x3c')](_0x38fdfa['query'],_0xc25248[_0xe9bd('0x32')]),_0x429055);if(_0x38fdfa[_0xe9bd('0x31')]['filter']){_0x3b13b7[_0xe9bd('0x3b')]=_[_0xe9bd('0x3d')](_0x3b13b7['where'],{'$or':_['map'](_0x429055,function(_0x2785e6){if(_0x2785e6[_0xe9bd('0x3e')]!=='VIRTUAL'){var _0x2d1289={};_0x2d1289[_0x2785e6[_0xe9bd('0x2a')]]={'$like':'%'+_0x38fdfa[_0xe9bd('0x31')]['filter']+'%'};return _0x2d1289;}})});}_0x3b13b7=_[_0xe9bd('0x3d')]({},_0x3b13b7,_0x38fdfa['options']);var _0x3c8f7e={'where':_0x3b13b7[_0xe9bd('0x3b')]};return db[_0xe9bd('0x2d')][_0xe9bd('0x1c')](_0x3c8f7e)['then'](function(_0x41f2d4){_0x119672[_0xe9bd('0x1c')]=_0x41f2d4;if(_0x38fdfa[_0xe9bd('0x31')][_0xe9bd('0x3f')]){_0x3b13b7[_0xe9bd('0x40')]=[{'all':!![]}];}return db[_0xe9bd('0x2d')][_0xe9bd('0x41')](_0x3b13b7);})[_0xe9bd('0x25')](function(_0x2b5a71){_0x119672[_0xe9bd('0x42')]=_0x2b5a71;return _0x119672;})['then'](respondWithFilteredResult(_0x5ba1d6,_0x3b13b7))['catch'](handleError(_0x5ba1d6,null));}; \ No newline at end of file diff --git a/server/api/migration/migration.model.js b/server/api/migration/migration.model.js index 69645ac..2e47d67 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 _0x923c=['define','Migration','migrations','lodash','../../config/logger','api','request-promise','../../config/environment','./migration.attributes'];(function(_0x549a64,_0x3c4451){var _0x4dc885=function(_0x241af6){while(--_0x241af6){_0x549a64['push'](_0x549a64['shift']());}};_0x4dc885(++_0x3c4451);}(_0x923c,0x198));var _0xc923=function(_0x45c096,_0x3ca8f3){_0x45c096=_0x45c096-0x0;var _0x5ce684=_0x923c[_0x45c096];return _0x5ce684;};'use strict';var _=require(_0xc923('0x0'));var util=require('util');var logger=require(_0xc923('0x1'))(_0xc923('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xc923('0x3'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xc923('0x4'));var attributes=require(_0xc923('0x5'));module['exports']=function(_0x3a1844,_0xf77b41){return _0x3a1844[_0xc923('0x6')](_0xc923('0x7'),attributes,{'tableName':_0xc923('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xba0b=['request-promise','rimraf','../../config/environment','./migration.attributes','exports','define','Migration','migrations','api','moment','bluebird'];(function(_0x2c7618,_0x26be9c){var _0x5ce3f0=function(_0x1837b3){while(--_0x1837b3){_0x2c7618['push'](_0x2c7618['shift']());}};_0x5ce3f0(++_0x26be9c);}(_0xba0b,0x110));var _0xbba0=function(_0x4b2e21,_0x54ff37){_0x4b2e21=_0x4b2e21-0x0;var _0x2af112=_0xba0b[_0x4b2e21];return _0x2af112;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0xbba0('0x0'));var moment=require(_0xbba0('0x1'));var BPromise=require(_0xbba0('0x2'));var rp=require(_0xbba0('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0xbba0('0x4'));var config=require(_0xbba0('0x5'));var attributes=require(_0xbba0('0x6'));module[_0xbba0('0x7')]=function(_0x203830,_0x5bf3d2){return _0x203830[_0xbba0('0x8')](_0xbba0('0x9'),attributes,{'tableName':_0xbba0('0xa'),'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 52223e3..c1b4a41 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 _0x6f75=['message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','then','info','Migration,\x20%s,\x20%s','request\x20sent','debug','Migration,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x1529a3,_0x529f63){var _0x1a0d4b=function(_0x6f1058){while(--_0x6f1058){_0x1529a3['push'](_0x1529a3['shift']());}};_0x1a0d4b(++_0x529f63);}(_0x6f75,0x71));var _0x56f7=function(_0x393547,_0x2178f8){_0x393547=_0x393547-0x0;var _0x1421be=_0x6f75[_0x393547];return _0x1421be;};'use strict';var _=require(_0x56f7('0x0'));var util=require(_0x56f7('0x1'));var moment=require(_0x56f7('0x2'));var BPromise=require(_0x56f7('0x3'));var rs=require(_0x56f7('0x4'));var fs=require('fs');var Redis=require(_0x56f7('0x5'));var db=require(_0x56f7('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x56f7('0x7'))(_0x56f7('0x8'));var config=require(_0x56f7('0x9'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x137d14,_0xcc51b1,_0x4b5dcc){return new BPromise(function(_0x184bf7,_0x5155ff){return client['request'](_0x137d14,_0x4b5dcc)[_0x56f7('0xa')](function(_0x1e607c){logger[_0x56f7('0xb')](_0x56f7('0xc'),_0xcc51b1,_0x56f7('0xd'));logger[_0x56f7('0xe')](_0x56f7('0xf'),_0xcc51b1,_0x56f7('0xd'),JSON[_0x56f7('0x10')](_0x1e607c));if(_0x1e607c[_0x56f7('0x11')]){if(_0x1e607c[_0x56f7('0x11')][_0x56f7('0x12')]===0x1f4){logger[_0x56f7('0x11')](_0x56f7('0xc'),_0xcc51b1,_0x1e607c['error'][_0x56f7('0x13')]);return _0x5155ff(_0x1e607c[_0x56f7('0x11')][_0x56f7('0x13')]);}logger[_0x56f7('0x11')](_0x56f7('0xc'),_0xcc51b1,_0x1e607c[_0x56f7('0x11')][_0x56f7('0x13')]);return _0x184bf7(_0x1e607c[_0x56f7('0x11')][_0x56f7('0x13')]);}else{logger['info']('Migration,\x20%s,\x20%s',_0xcc51b1,_0x56f7('0xd'));_0x184bf7(_0x1e607c[_0x56f7('0x14')][_0x56f7('0x13')]);}})[_0x56f7('0x15')](function(_0x40fb77){logger[_0x56f7('0x11')]('Migration,\x20%s,\x20%s',_0xcc51b1,_0x40fb77);_0x5155ff(_0x40fb77);});});} \ No newline at end of file +var _0x9c4b=['stringify','error','code','message','lodash','util','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','Migration,\x20%s,\x20%s','request\x20sent','debug','Migration,\x20%s,\x20%s,\x20%s'];(function(_0x310167,_0x4f925b){var _0x42b71f=function(_0x7ae536){while(--_0x7ae536){_0x310167['push'](_0x310167['shift']());}};_0x42b71f(++_0x4f925b);}(_0x9c4b,0x101));var _0xb9c4=function(_0x4fd701,_0x4dd637){_0x4fd701=_0x4fd701-0x0;var _0xb61e42=_0x9c4b[_0x4fd701];return _0xb61e42;};'use strict';var _=require(_0xb9c4('0x0'));var util=require(_0xb9c4('0x1'));var moment=require(_0xb9c4('0x2'));var BPromise=require(_0xb9c4('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xb9c4('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xb9c4('0x5'));var logger=require(_0xb9c4('0x6'))(_0xb9c4('0x7'));var config=require(_0xb9c4('0x8'));var jayson=require(_0xb9c4('0x9'));var client=jayson[_0xb9c4('0xa')][_0xb9c4('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1a72c2,_0xe3072f,_0x471688){return new BPromise(function(_0x2c6b1c,_0x14152d){return client[_0xb9c4('0xc')](_0x1a72c2,_0x471688)[_0xb9c4('0xd')](function(_0x3d65cc){logger[_0xb9c4('0xe')](_0xb9c4('0xf'),_0xe3072f,_0xb9c4('0x10'));logger[_0xb9c4('0x11')](_0xb9c4('0x12'),_0xe3072f,'request\x20sent',JSON[_0xb9c4('0x13')](_0x3d65cc));if(_0x3d65cc[_0xb9c4('0x14')]){if(_0x3d65cc[_0xb9c4('0x14')][_0xb9c4('0x15')]===0x1f4){logger[_0xb9c4('0x14')](_0xb9c4('0xf'),_0xe3072f,_0x3d65cc[_0xb9c4('0x14')][_0xb9c4('0x16')]);return _0x14152d(_0x3d65cc[_0xb9c4('0x14')][_0xb9c4('0x16')]);}logger[_0xb9c4('0x14')](_0xb9c4('0xf'),_0xe3072f,_0x3d65cc[_0xb9c4('0x14')][_0xb9c4('0x16')]);return _0x2c6b1c(_0x3d65cc['error']['message']);}else{logger[_0xb9c4('0xe')](_0xb9c4('0xf'),_0xe3072f,_0xb9c4('0x10'));_0x2c6b1c(_0x3d65cc['result'][_0xb9c4('0x16')]);}})['catch'](function(_0x35f0f3){logger['error'](_0xb9c4('0xf'),_0xe3072f,_0x35f0f3);_0x14152d(_0x35f0f3);});});} \ No newline at end of file diff --git a/server/api/network/index.js b/server/api/network/index.js index 34aec92..4962431 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 _0xdbff=['../../components/interaction/service','./network.controller','get','isAuthenticated','put','/:id','update','delete','exports','multer','path','connect-timeout','express','../../components/auth/service'];(function(_0x35b1ef,_0x4cfa92){var _0x418103=function(_0x460cfa){while(--_0x460cfa){_0x35b1ef['push'](_0x35b1ef['shift']());}};_0x418103(++_0x4cfa92);}(_0xdbff,0x87));var _0xfdbf=function(_0x19159a,_0x1cb5c3){_0x19159a=_0x19159a-0x0;var _0xa677f4=_0xdbff[_0x19159a];return _0xa677f4;};'use strict';var multer=require(_0xfdbf('0x0'));var util=require('util');var path=require(_0xfdbf('0x1'));var timeout=require(_0xfdbf('0x2'));var express=require(_0xfdbf('0x3'));var router=express['Router']();var auth=require(_0xfdbf('0x4'));var interaction=require(_0xfdbf('0x5'));var config=require('../../config/environment');var controller=require(_0xfdbf('0x6'));router[_0xfdbf('0x7')]('/',auth[_0xfdbf('0x8')](),controller['index']);router['get']('/:id',auth[_0xfdbf('0x8')](),controller['show']);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0xfdbf('0x9')](_0xfdbf('0xa'),auth[_0xfdbf('0x8')](),controller[_0xfdbf('0xb')]);router[_0xfdbf('0xc')](_0xfdbf('0xa'),auth['isAuthenticated'](),controller['destroy']);module[_0xfdbf('0xd')]=router; \ No newline at end of file +var _0x78d0=['delete','destroy','exports','multer','util','path','connect-timeout','Router','../../components/interaction/service','../../config/environment','./network.controller','get','index','isAuthenticated','show','post','create','put','/:id'];(function(_0x462ca7,_0x40a1f9){var _0x503899=function(_0x3ff6e5){while(--_0x3ff6e5){_0x462ca7['push'](_0x462ca7['shift']());}};_0x503899(++_0x40a1f9);}(_0x78d0,0x1cb));var _0x078d=function(_0x4895e5,_0x364032){_0x4895e5=_0x4895e5-0x0;var _0x38bf66=_0x78d0[_0x4895e5];return _0x38bf66;};'use strict';var multer=require(_0x078d('0x0'));var util=require(_0x078d('0x1'));var path=require(_0x078d('0x2'));var timeout=require(_0x078d('0x3'));var express=require('express');var router=express[_0x078d('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x078d('0x5'));var config=require(_0x078d('0x6'));var controller=require(_0x078d('0x7'));router[_0x078d('0x8')]('/',auth['isAuthenticated'](),controller[_0x078d('0x9')]);router[_0x078d('0x8')]('/:id',auth[_0x078d('0xa')](),controller[_0x078d('0xb')]);router[_0x078d('0xc')]('/',auth[_0x078d('0xa')](),controller[_0x078d('0xd')]);router[_0x078d('0xe')](_0x078d('0xf'),auth['isAuthenticated'](),controller['update']);router[_0x078d('0x10')](_0x078d('0xf'),auth[_0x078d('0xa')](),controller[_0x078d('0x11')]);module[_0x078d('0x12')]=router; \ No newline at end of file diff --git a/server/api/network/network.attributes.js b/server/api/network/network.attributes.js index c640cd8..b727fb0 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(_0x597295,_0x39c027){var _0x2868c2=function(_0x57eec6){while(--_0x57eec6){_0x597295['push'](_0x597295['shift']());}};_0x2868c2(++_0x39c027);}(_0xa9e0,0x123));var _0x0a9e=function(_0x139a3c,_0x4fc883){_0x139a3c=_0x139a3c-0x0;var _0x2b375b=_0xa9e0[_0x139a3c];return _0x2b375b;};'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(_0x394690,_0x9896bf){var _0x5873f9=function(_0x2d624e){while(--_0x2d624e){_0x394690['push'](_0x394690['shift']());}};_0x5873f9(++_0x9896bf);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4dbaad,_0x730318){_0x4dbaad=_0x4dbaad-0x0;var _0x226c72=_0xa9e0[_0x4dbaad];return _0x226c72;};'use strict';var Sequelize=require(_0x0a9e('0x0'));module[_0x0a9e('0x1')]={'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 738ea1c..81ad447 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 _0xa554=['type','key','model','query','keys','attributes','intersection','length','nolimit','sort','where','filters','pick','filter','merge','VIRTUAL','options','count','includeAll','findAll','rows','show','fields','include','create','sequelize','transaction','body','toUpperCase','STUN','readFileSync','join','root','server/files/templates/stun_multiple.ejs','utf8','render','writeFileSync','/etc/asterisk/stun_xcally.conf','Reload','res_stun_monitor.so','TURN','server/files/templates/turn_multiple.ejs','server/files/templates/network.ejs','format','toLowerCase','find','params','/etc/asterisk/turn_xcally.conf','chan_sip.so','/etc/asterisk/sip_xcally_%s.conf','html-pdf','eml-format','rimraf','zip-dir','moment','mustache','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','jayson/promise','http','test','ValidationError','info','Network,\x20%s,\x20%s','request\x20sent','Network,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','sendStatus','status','end','offset','limit','set','Content-Range','reject','save','update','then','destroy','stack','name','index','map','Network','fieldName'];(function(_0x1694f5,_0x49b7c3){var _0x5b4321=function(_0x58c183){while(--_0x58c183){_0x1694f5['push'](_0x1694f5['shift']());}};_0x5b4321(++_0x49b7c3);}(_0xa554,0x104));var _0x4a55=function(_0x36c3cb,_0x556fd7){_0x36c3cb=_0x36c3cb-0x0;var _0x4a5edc=_0xa554[_0x36c3cb];return _0x4a5edc;};'use strict';var pdf=require(_0x4a55('0x0'));var emlformat=require(_0x4a55('0x1'));var rimraf=require(_0x4a55('0x2'));var zipdir=require(_0x4a55('0x3'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x4a55('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x4a55('0x5'));var util=require('util');var path=require(_0x4a55('0x6'));var sox=require(_0x4a55('0x7'));var csv=require(_0x4a55('0x8'));var ejs=require(_0x4a55('0x9'));var fs=require('fs');var _=require(_0x4a55('0xa'));var squel=require(_0x4a55('0xb'));var crypto=require('crypto');var jsforce=require(_0x4a55('0xc'));var deskjs=require(_0x4a55('0xd'));var toCsv=require(_0x4a55('0x8'));var querystring=require(_0x4a55('0xe'));var Papa=require('papaparse');var Redis=require(_0x4a55('0xf'));var authService=require(_0x4a55('0x10'));var qs=require(_0x4a55('0x11'));var as=require(_0x4a55('0x12'));var hardwareService=require(_0x4a55('0x13'));var logger=require(_0x4a55('0x14'))(_0x4a55('0x15'));var utils=require('../../config/utils');var config=require(_0x4a55('0x16'));var db=require(_0x4a55('0x17'))['db'];var jayson=require(_0x4a55('0x18'));var client=jayson['client'][_0x4a55('0x19')]({'port':0x232a});function checkPasswordPattern(_0x5c6ce1,_0x3ce97a,_0x4a3e67){if(_0x4a3e67){var _0x4b4c01=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x4b4c01[_0x4a55('0x1a')](_0x3ce97a)){return _0x5c6ce1;}else{throw new db['Sequelize'][(_0x4a55('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 _0x5c6ce1;}}function respondWithRpcPromise(_0x2c0f41,_0x121772,_0x3dd79e,_0x4e1465){return new BPromise(function(_0x680446,_0x1b37d6){var _0xdfee66=_0x4e1465||client;return _0xdfee66['request'](_0x2c0f41,_0x3dd79e)['then'](function(_0x17ad38){logger[_0x4a55('0x1c')](_0x4a55('0x1d'),_0x121772,_0x4a55('0x1e'));logger['debug'](_0x4a55('0x1f'),_0x121772,'request\x20sent',JSON[_0x4a55('0x20')](_0x17ad38));if(_0x17ad38[_0x4a55('0x21')]){if(_0x17ad38[_0x4a55('0x21')][_0x4a55('0x22')]===0x1f4){logger[_0x4a55('0x21')](_0x4a55('0x1d'),_0x121772,_0x17ad38[_0x4a55('0x21')][_0x4a55('0x23')]);return _0x1b37d6(_0x17ad38[_0x4a55('0x21')]['message']);}logger[_0x4a55('0x21')](_0x4a55('0x1d'),_0x121772,_0x17ad38[_0x4a55('0x21')][_0x4a55('0x23')]);return _0x680446(_0x17ad38['error'][_0x4a55('0x23')]);}else{logger[_0x4a55('0x1c')](_0x4a55('0x1d'),_0x121772,_0x4a55('0x1e'));_0x680446(_0x17ad38['result'][_0x4a55('0x23')]);}})[_0x4a55('0x24')](function(_0x3c9bb1){logger[_0x4a55('0x21')](_0x4a55('0x1d'),_0x121772,_0x3c9bb1);_0x1b37d6(_0x3c9bb1);});});}function respondWithStatusCode(_0x1ecf95,_0x3dd29b){_0x3dd29b=_0x3dd29b||0xcc;return function(_0x42c847){if(_0x42c847){return _0x1ecf95[_0x4a55('0x25')](_0x3dd29b);}return _0x1ecf95[_0x4a55('0x26')](_0x3dd29b)[_0x4a55('0x27')]();};}function respondWithResult(_0x31c8d5,_0x54aff6){_0x54aff6=_0x54aff6||0xc8;return function(_0x5b1da5){if(_0x5b1da5){return _0x31c8d5['status'](_0x54aff6)['json'](_0x5b1da5);}};}function respondWithFilteredResult(_0x391139,_0x49b737){return function(_0x25d320){if(_0x25d320){var _0x5d6b4f=_0x25d320['count'],_0x25f4c3=_0x49b737[_0x4a55('0x28')],_0x322fb1=_0x49b737['offset']+_0x49b737[_0x4a55('0x29')],_0x19f54b;if(_0x322fb1>=_0x5d6b4f){_0x322fb1=_0x5d6b4f;_0x19f54b=0xc8;}else{_0x19f54b=0xce;}_0x391139[_0x4a55('0x26')](_0x19f54b);return _0x391139[_0x4a55('0x2a')](_0x4a55('0x2b'),_0x25f4c3+'-'+_0x322fb1+'/'+_0x5d6b4f)['json'](_0x25d320);}return null;};}function patchUpdates(_0x2d8010){return function(_0x3f953d){try{jsonpatch['apply'](_0x3f953d,_0x2d8010,!![]);}catch(_0x4b4a91){return BPromise[_0x4a55('0x2c')](_0x4b4a91);}return _0x3f953d[_0x4a55('0x2d')]();};}function saveUpdates(_0x5b3b67,_0x59015b){return function(_0x2387a1){if(_0x2387a1){return _0x2387a1[_0x4a55('0x2e')](_0x5b3b67)[_0x4a55('0x2f')](function(_0x5e94ea){return _0x5e94ea;});}return null;};}function removeEntity(_0x3d81c9,_0x46f7d3){return function(_0x3771d6){if(_0x3771d6){return _0x3771d6[_0x4a55('0x30')]()[_0x4a55('0x2f')](function(){_0x3d81c9[_0x4a55('0x26')](0xcc)[_0x4a55('0x27')]();});}};}function handleEntityNotFound(_0x4a8c1b,_0x4c2f98){return function(_0x37f0a3){if(!_0x37f0a3){_0x4a8c1b[_0x4a55('0x25')](0x194);}return _0x37f0a3;};}function handleError(_0x30edc9,_0x3b3fab){_0x3b3fab=_0x3b3fab||0x1f4;return function(_0x51c826){logger[_0x4a55('0x21')](_0x51c826[_0x4a55('0x31')]);if(_0x51c826[_0x4a55('0x32')]){delete _0x51c826[_0x4a55('0x32')];}_0x30edc9[_0x4a55('0x26')](_0x3b3fab)['send'](_0x51c826);};}exports[_0x4a55('0x33')]=function(_0x11dd2a,_0x23c6e9){var _0x41fdf8={},_0x168c7b={},_0x6a7bb={'count':0x0,'rows':[]};var _0x536277=_[_0x4a55('0x34')](db[_0x4a55('0x35')]['rawAttributes'],function(_0x24d726){return{'name':_0x24d726[_0x4a55('0x36')],'type':_0x24d726[_0x4a55('0x37')][_0x4a55('0x38')]};});_0x168c7b[_0x4a55('0x39')]=_['map'](_0x536277,_0x4a55('0x32'));_0x168c7b[_0x4a55('0x3a')]=_[_0x4a55('0x3b')](_0x11dd2a[_0x4a55('0x3a')]);_0x168c7b['filters']=_['intersection'](_0x168c7b[_0x4a55('0x39')],_0x168c7b[_0x4a55('0x3a')]);_0x41fdf8[_0x4a55('0x3c')]=_[_0x4a55('0x3d')](_0x168c7b['model'],qs['fields'](_0x11dd2a[_0x4a55('0x3a')]['fields']));_0x41fdf8[_0x4a55('0x3c')]=_0x41fdf8[_0x4a55('0x3c')][_0x4a55('0x3e')]?_0x41fdf8[_0x4a55('0x3c')]:_0x168c7b[_0x4a55('0x39')];if(!_0x11dd2a[_0x4a55('0x3a')]['hasOwnProperty'](_0x4a55('0x3f'))){_0x41fdf8['limit']=qs[_0x4a55('0x29')](_0x11dd2a['query'][_0x4a55('0x29')]);_0x41fdf8[_0x4a55('0x28')]=qs[_0x4a55('0x28')](_0x11dd2a[_0x4a55('0x3a')]['offset']);}_0x41fdf8['order']=qs['sort'](_0x11dd2a['query'][_0x4a55('0x40')]);_0x41fdf8[_0x4a55('0x41')]=qs[_0x4a55('0x42')](_[_0x4a55('0x43')](_0x11dd2a['query'],_0x168c7b['filters']),_0x536277);if(_0x11dd2a['query'][_0x4a55('0x44')]){_0x41fdf8[_0x4a55('0x41')]=_[_0x4a55('0x45')](_0x41fdf8[_0x4a55('0x41')],{'$or':_['map'](_0x536277,function(_0x1f2970){if(_0x1f2970['type']!==_0x4a55('0x46')){var _0x37fff3={};_0x37fff3[_0x1f2970[_0x4a55('0x32')]]={'$like':'%'+_0x11dd2a[_0x4a55('0x3a')][_0x4a55('0x44')]+'%'};return _0x37fff3;}})});}_0x41fdf8=_['merge']({},_0x41fdf8,_0x11dd2a[_0x4a55('0x47')]);var _0x2d51c8={'where':_0x41fdf8[_0x4a55('0x41')]};return db[_0x4a55('0x35')][_0x4a55('0x48')](_0x2d51c8)[_0x4a55('0x2f')](function(_0xb42719){_0x6a7bb[_0x4a55('0x48')]=_0xb42719;if(_0x11dd2a[_0x4a55('0x3a')][_0x4a55('0x49')]){_0x41fdf8['include']=[{'all':!![]}];}return db[_0x4a55('0x35')][_0x4a55('0x4a')](_0x41fdf8);})[_0x4a55('0x2f')](function(_0x49c928){_0x6a7bb[_0x4a55('0x4b')]=_0x49c928;return _0x6a7bb;})['then'](respondWithFilteredResult(_0x23c6e9,_0x41fdf8))[_0x4a55('0x24')](handleError(_0x23c6e9,null));};exports[_0x4a55('0x4c')]=function(_0x5b59be,_0x2d7f9a){var _0x1963b3={'raw':!![],'where':{'id':_0x5b59be['params']['id']}},_0x376ac7={};_0x376ac7[_0x4a55('0x39')]=_[_0x4a55('0x3b')](db[_0x4a55('0x35')]['rawAttributes']);_0x376ac7['query']=_[_0x4a55('0x3b')](_0x5b59be[_0x4a55('0x3a')]);_0x376ac7[_0x4a55('0x42')]=_[_0x4a55('0x3d')](_0x376ac7['model'],_0x376ac7[_0x4a55('0x3a')]);_0x1963b3['attributes']=_[_0x4a55('0x3d')](_0x376ac7[_0x4a55('0x39')],qs[_0x4a55('0x4d')](_0x5b59be[_0x4a55('0x3a')][_0x4a55('0x4d')]));_0x1963b3['attributes']=_0x1963b3['attributes'][_0x4a55('0x3e')]?_0x1963b3[_0x4a55('0x3c')]:_0x376ac7['model'];if(_0x5b59be[_0x4a55('0x3a')][_0x4a55('0x49')]){_0x1963b3[_0x4a55('0x4e')]=[{'all':!![]}];}_0x1963b3=_[_0x4a55('0x45')]({},_0x1963b3,_0x5b59be[_0x4a55('0x47')]);return db[_0x4a55('0x35')]['find'](_0x1963b3)[_0x4a55('0x2f')](handleEntityNotFound(_0x2d7f9a,null))[_0x4a55('0x2f')](respondWithResult(_0x2d7f9a,null))[_0x4a55('0x24')](handleError(_0x2d7f9a,null));};exports[_0x4a55('0x4f')]=function(_0x4f01e6,_0x4dd38e,_0x544096){var _0x444adf;return db[_0x4a55('0x50')][_0x4a55('0x51')](function(_0x33758e){return db[_0x4a55('0x35')]['create'](_0x4f01e6[_0x4a55('0x52')],{'raw':!![]})[_0x4a55('0x2f')](function(_0x3ec863){_0x444adf=_0x3ec863;return db[_0x4a55('0x35')][_0x4a55('0x4a')]({'where':{'type':_0x4f01e6[_0x4a55('0x52')][_0x4a55('0x37')]},'raw':!![]});})[_0x4a55('0x2f')](function(_0x2fc90c){if(_0x444adf[_0x4a55('0x37')][_0x4a55('0x53')]()==_0x4a55('0x54')){var _0x873d78=fs[_0x4a55('0x55')](path[_0x4a55('0x56')](config[_0x4a55('0x57')],_0x4a55('0x58')),_0x4a55('0x59'));var _0x23eb33=ejs[_0x4a55('0x5a')](_0x873d78,{'networks':_0x2fc90c||[]});fs[_0x4a55('0x5b')](_0x4a55('0x5c'),_0x23eb33);return respondWithRpcPromise(_0x4a55('0x5d'),'create',{'module':_0x4a55('0x5e')});}else if(_0x444adf[_0x4a55('0x37')][_0x4a55('0x53')]()==_0x4a55('0x5f')){var _0xd67c4e=fs[_0x4a55('0x55')](path['join'](config['root'],_0x4a55('0x60')),_0x4a55('0x59'));var _0x75220f=ejs[_0x4a55('0x5a')](_0xd67c4e,{'networks':_0x2fc90c||[]});fs['writeFileSync']('/etc/asterisk/turn_xcally.conf',_0x75220f);return respondWithRpcPromise(_0x4a55('0x5d'),'create',{'module':_0x4a55('0x5e')});}else{var _0x4fa6fb=fs[_0x4a55('0x55')](path[_0x4a55('0x56')](config[_0x4a55('0x57')],_0x4a55('0x61')),'utf8');var _0x5be279=ejs[_0x4a55('0x5a')](_0x4fa6fb,{'networks':_0x2fc90c||[]});fs[_0x4a55('0x5b')](util[_0x4a55('0x62')]('/etc/asterisk/sip_xcally_%s.conf',_0x4f01e6['body'][_0x4a55('0x37')][_0x4a55('0x63')]()),_0x5be279);return respondWithRpcPromise(_0x4a55('0x5d'),_0x4a55('0x4f'),{'module':'chan_sip.so'});}return null;})[_0x4a55('0x2f')](function(){return _0x444adf;});})['then'](respondWithResult(_0x4dd38e,0xc9))[_0x4a55('0x24')](handleError(_0x4dd38e,null));};exports['update']=function(_0x26e89e,_0x1afa81,_0x47ef2e){var _0x1542a0;return db['sequelize'][_0x4a55('0x51')](function(_0x287c71){return db[_0x4a55('0x35')][_0x4a55('0x64')]({'where':{'id':_0x26e89e[_0x4a55('0x65')]['id']}})['then'](handleEntityNotFound(_0x1afa81,null))['then'](saveUpdates(_0x26e89e['body'],null))[_0x4a55('0x2f')](function(_0x5a1bdd){if(_0x5a1bdd){_0x1542a0=_0x5a1bdd;return db[_0x4a55('0x35')][_0x4a55('0x4a')]({'where':{'type':_0x1542a0['type']},'raw':!![]});}return null;})[_0x4a55('0x2f')](function(_0x49211d){if(_0x1542a0['type'][_0x4a55('0x53')]()==_0x4a55('0x54')){var _0x10eea1=fs[_0x4a55('0x55')](path[_0x4a55('0x56')](config[_0x4a55('0x57')],_0x4a55('0x58')),_0x4a55('0x59'));var _0x10d260=ejs['render'](_0x10eea1,{'networks':_0x49211d||[]});fs['writeFileSync'](_0x4a55('0x5c'),_0x10d260);return respondWithRpcPromise('Reload',_0x4a55('0x2e'),{'module':_0x4a55('0x5e')});}else if(_0x1542a0[_0x4a55('0x37')]['toUpperCase']()==_0x4a55('0x5f')){var _0x4de234=fs[_0x4a55('0x55')](path[_0x4a55('0x56')](config[_0x4a55('0x57')],_0x4a55('0x60')),_0x4a55('0x59'));var _0x24b061=ejs[_0x4a55('0x5a')](_0x4de234,{'networks':_0x49211d||[]});fs[_0x4a55('0x5b')](_0x4a55('0x66'),_0x24b061);return respondWithRpcPromise(_0x4a55('0x5d'),'update',{'module':_0x4a55('0x5e')});}else{var _0x52e31a=fs['readFileSync'](path['join'](config['root'],_0x4a55('0x61')),_0x4a55('0x59'));var _0x2d4754=ejs[_0x4a55('0x5a')](_0x52e31a,{'networks':_0x49211d||[]});fs[_0x4a55('0x5b')](util['format']('/etc/asterisk/sip_xcally_%s.conf',_0x26e89e[_0x4a55('0x52')][_0x4a55('0x37')]['toLowerCase']()),_0x2d4754);return respondWithRpcPromise(_0x4a55('0x5d'),_0x4a55('0x2e'),{'module':_0x4a55('0x67')});}return null;})['then'](function(_0x41ddc2){if(_0x41ddc2){return _0x1542a0;}return null;});})[_0x4a55('0x2f')](respondWithResult(_0x1afa81,null))[_0x4a55('0x24')](handleError(_0x1afa81,null));};exports['destroy']=function(_0x117c90,_0x22ded1,_0x86c25d){var _0x46fc45;return db['Network'][_0x4a55('0x64')]({'where':{'id':_0x117c90['params']['id']}})[_0x4a55('0x2f')](function(_0x592a75){_0x46fc45=_0x592a75;return _0x592a75;})[_0x4a55('0x2f')](handleEntityNotFound(_0x22ded1,null))['then'](removeEntity(_0x22ded1,null))[_0x4a55('0x2f')](function(){if(_0x46fc45){return db[_0x4a55('0x35')][_0x4a55('0x4a')]({'where':{'type':_0x46fc45[_0x4a55('0x37')]},'raw':!![]});}})[_0x4a55('0x2f')](function(_0x140177){if(_0x46fc45[_0x4a55('0x37')]['toUpperCase']()==_0x4a55('0x54')){var _0xaa5fdf=fs[_0x4a55('0x55')](path[_0x4a55('0x56')](config[_0x4a55('0x57')],'server/files/templates/stun_multiple.ejs'),_0x4a55('0x59'));var _0xd25f0e=ejs[_0x4a55('0x5a')](_0xaa5fdf,{'networks':_0x140177||[]});fs[_0x4a55('0x5b')](_0x4a55('0x5c'),_0xd25f0e);return respondWithRpcPromise(_0x4a55('0x5d'),_0x4a55('0x30'),{'module':_0x4a55('0x5e')});}else if(_0x46fc45['type'][_0x4a55('0x53')]()==_0x4a55('0x5f')){var _0x2adfe8=fs[_0x4a55('0x55')](path['join'](config[_0x4a55('0x57')],_0x4a55('0x60')),_0x4a55('0x59'));var _0x95c8bf=ejs[_0x4a55('0x5a')](_0x2adfe8,{'networks':_0x140177||[]});fs[_0x4a55('0x5b')]('/etc/asterisk/turn_xcally.conf',_0x95c8bf);return respondWithRpcPromise(_0x4a55('0x5d'),'destroy',{'module':_0x4a55('0x5e')});}else{var _0x2b162c=fs[_0x4a55('0x55')](path[_0x4a55('0x56')](config['root'],_0x4a55('0x61')),_0x4a55('0x59'));var _0x2990fc=ejs[_0x4a55('0x5a')](_0x2b162c,{'networks':_0x140177||[]});fs[_0x4a55('0x5b')](util[_0x4a55('0x62')](_0x4a55('0x68'),_0x117c90[_0x4a55('0x52')][_0x4a55('0x37')][_0x4a55('0x63')]()),_0x2990fc);return respondWithRpcPromise(_0x4a55('0x5d'),_0x4a55('0x30'),{'module':'chan_sip.so'});}return null;})[_0x4a55('0x24')](handleError(_0x22ded1,null));}; \ No newline at end of file +var _0xd1ab=['include','rows','params','keys','fields','find','catch','create','transaction','body','findAll','type','toUpperCase','STUN','readFileSync','join','server/files/templates/stun_multiple.ejs','utf8','render','res_stun_monitor.so','server/files/templates/turn_multiple.ejs','writeFileSync','/etc/asterisk/turn_xcally.conf','root','format','/etc/asterisk/sip_xcally_%s.conf','toLowerCase','chan_sip.so','sequelize','/etc/asterisk/stun_xcally.conf','Reload','TURN','server/files/templates/network.ejs','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','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','then','info','Network,\x20%s,\x20%s','request\x20sent','debug','Network,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','status','end','count','offset','limit','set','Content-Range','json','apply','reject','save','update','destroy','sendStatus','send','Network','rawAttributes','fieldName','key','model','map','name','query','intersection','attributes','length','nolimit','order','sort','where','filters','filter','merge','VIRTUAL','includeAll'];(function(_0x47254f,_0x415e04){var _0x98ce80=function(_0x951635){while(--_0x951635){_0x47254f['push'](_0x47254f['shift']());}};_0x98ce80(++_0x415e04);}(_0xd1ab,0x101));var _0xbd1a=function(_0x30f638,_0x9718a1){_0x30f638=_0x30f638-0x0;var _0xc3e5ac=_0xd1ab[_0x30f638];return _0xc3e5ac;};'use strict';var pdf=require(_0xbd1a('0x0'));var emlformat=require(_0xbd1a('0x1'));var rimraf=require(_0xbd1a('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0xbd1a('0x3'));var rp=require(_0xbd1a('0x4'));var moment=require(_0xbd1a('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xbd1a('0x6'));var util=require(_0xbd1a('0x7'));var path=require(_0xbd1a('0x8'));var sox=require(_0xbd1a('0x9'));var csv=require(_0xbd1a('0xa'));var ejs=require(_0xbd1a('0xb'));var fs=require('fs');var _=require(_0xbd1a('0xc'));var squel=require(_0xbd1a('0xd'));var crypto=require(_0xbd1a('0xe'));var jsforce=require(_0xbd1a('0xf'));var deskjs=require(_0xbd1a('0x10'));var toCsv=require('to-csv');var querystring=require(_0xbd1a('0x11'));var Papa=require('papaparse');var Redis=require(_0xbd1a('0x12'));var authService=require(_0xbd1a('0x13'));var qs=require(_0xbd1a('0x14'));var as=require(_0xbd1a('0x15'));var hardwareService=require(_0xbd1a('0x16'));var logger=require(_0xbd1a('0x17'))(_0xbd1a('0x18'));var utils=require(_0xbd1a('0x19'));var config=require(_0xbd1a('0x1a'));var db=require(_0xbd1a('0x1b'))['db'];var jayson=require(_0xbd1a('0x1c'));var client=jayson[_0xbd1a('0x1d')]['http']({'port':0x232a});function checkPasswordPattern(_0x473630,_0x71ccbf,_0x2178c0){if(_0x2178c0){var _0x2282a5=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x2282a5[_0xbd1a('0x1e')](_0x71ccbf)){return _0x473630;}else{throw new db[(_0xbd1a('0x1f'))][(_0xbd1a('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 _0x473630;}}function respondWithRpcPromise(_0x4c7392,_0x1a04b8,_0x376fbe,_0x431491){return new BPromise(function(_0x1e39ce,_0x21b899){var _0x2cbaca=_0x431491||client;return _0x2cbaca['request'](_0x4c7392,_0x376fbe)[_0xbd1a('0x21')](function(_0x1d50ce){logger[_0xbd1a('0x22')](_0xbd1a('0x23'),_0x1a04b8,_0xbd1a('0x24'));logger[_0xbd1a('0x25')](_0xbd1a('0x26'),_0x1a04b8,_0xbd1a('0x24'),JSON[_0xbd1a('0x27')](_0x1d50ce));if(_0x1d50ce[_0xbd1a('0x28')]){if(_0x1d50ce[_0xbd1a('0x28')][_0xbd1a('0x29')]===0x1f4){logger[_0xbd1a('0x28')](_0xbd1a('0x23'),_0x1a04b8,_0x1d50ce[_0xbd1a('0x28')][_0xbd1a('0x2a')]);return _0x21b899(_0x1d50ce[_0xbd1a('0x28')][_0xbd1a('0x2a')]);}logger[_0xbd1a('0x28')](_0xbd1a('0x23'),_0x1a04b8,_0x1d50ce['error'][_0xbd1a('0x2a')]);return _0x1e39ce(_0x1d50ce[_0xbd1a('0x28')][_0xbd1a('0x2a')]);}else{logger[_0xbd1a('0x22')]('Network,\x20%s,\x20%s',_0x1a04b8,_0xbd1a('0x24'));_0x1e39ce(_0x1d50ce[_0xbd1a('0x2b')][_0xbd1a('0x2a')]);}})['catch'](function(_0x25b223){logger[_0xbd1a('0x28')](_0xbd1a('0x23'),_0x1a04b8,_0x25b223);_0x21b899(_0x25b223);});});}function respondWithStatusCode(_0x2031d4,_0x386901){_0x386901=_0x386901||0xcc;return function(_0x108911){if(_0x108911){return _0x2031d4['sendStatus'](_0x386901);}return _0x2031d4[_0xbd1a('0x2c')](_0x386901)[_0xbd1a('0x2d')]();};}function respondWithResult(_0x5bd475,_0x2da5c7){_0x2da5c7=_0x2da5c7||0xc8;return function(_0x149867){if(_0x149867){return _0x5bd475[_0xbd1a('0x2c')](_0x2da5c7)['json'](_0x149867);}};}function respondWithFilteredResult(_0x4b02bf,_0x3441a8){return function(_0x22df59){if(_0x22df59){var _0x2ee320=_0x22df59[_0xbd1a('0x2e')],_0x34c804=_0x3441a8['offset'],_0x5f01a8=_0x3441a8[_0xbd1a('0x2f')]+_0x3441a8[_0xbd1a('0x30')],_0x5229a3;if(_0x5f01a8>=_0x2ee320){_0x5f01a8=_0x2ee320;_0x5229a3=0xc8;}else{_0x5229a3=0xce;}_0x4b02bf[_0xbd1a('0x2c')](_0x5229a3);return _0x4b02bf[_0xbd1a('0x31')](_0xbd1a('0x32'),_0x34c804+'-'+_0x5f01a8+'/'+_0x2ee320)[_0xbd1a('0x33')](_0x22df59);}return null;};}function patchUpdates(_0x122b2a){return function(_0x1bd976){try{jsonpatch[_0xbd1a('0x34')](_0x1bd976,_0x122b2a,!![]);}catch(_0x4be266){return BPromise[_0xbd1a('0x35')](_0x4be266);}return _0x1bd976[_0xbd1a('0x36')]();};}function saveUpdates(_0x563720,_0x5878ad){return function(_0x1920ba){if(_0x1920ba){return _0x1920ba[_0xbd1a('0x37')](_0x563720)[_0xbd1a('0x21')](function(_0x372cbd){return _0x372cbd;});}return null;};}function removeEntity(_0x56acff,_0x44f503){return function(_0x51f6e3){if(_0x51f6e3){return _0x51f6e3[_0xbd1a('0x38')]()[_0xbd1a('0x21')](function(){_0x56acff[_0xbd1a('0x2c')](0xcc)[_0xbd1a('0x2d')]();});}};}function handleEntityNotFound(_0x342b06,_0x68c5e8){return function(_0x4c5ed2){if(!_0x4c5ed2){_0x342b06[_0xbd1a('0x39')](0x194);}return _0x4c5ed2;};}function handleError(_0x406a68,_0x37e3e6){_0x37e3e6=_0x37e3e6||0x1f4;return function(_0x234905){logger[_0xbd1a('0x28')](_0x234905['stack']);if(_0x234905['name']){delete _0x234905['name'];}_0x406a68[_0xbd1a('0x2c')](_0x37e3e6)[_0xbd1a('0x3a')](_0x234905);};}exports['index']=function(_0x50ba76,_0x1ca598){var _0x4a4b4c={},_0x464bb7={},_0x1b786d={'count':0x0,'rows':[]};var _0x18f3f9=_['map'](db[_0xbd1a('0x3b')][_0xbd1a('0x3c')],function(_0x21b3c6){return{'name':_0x21b3c6[_0xbd1a('0x3d')],'type':_0x21b3c6['type'][_0xbd1a('0x3e')]};});_0x464bb7[_0xbd1a('0x3f')]=_[_0xbd1a('0x40')](_0x18f3f9,_0xbd1a('0x41'));_0x464bb7[_0xbd1a('0x42')]=_['keys'](_0x50ba76['query']);_0x464bb7['filters']=_[_0xbd1a('0x43')](_0x464bb7['model'],_0x464bb7['query']);_0x4a4b4c[_0xbd1a('0x44')]=_[_0xbd1a('0x43')](_0x464bb7[_0xbd1a('0x3f')],qs['fields'](_0x50ba76[_0xbd1a('0x42')]['fields']));_0x4a4b4c[_0xbd1a('0x44')]=_0x4a4b4c[_0xbd1a('0x44')][_0xbd1a('0x45')]?_0x4a4b4c[_0xbd1a('0x44')]:_0x464bb7[_0xbd1a('0x3f')];if(!_0x50ba76['query']['hasOwnProperty'](_0xbd1a('0x46'))){_0x4a4b4c[_0xbd1a('0x30')]=qs['limit'](_0x50ba76['query']['limit']);_0x4a4b4c[_0xbd1a('0x2f')]=qs[_0xbd1a('0x2f')](_0x50ba76['query'][_0xbd1a('0x2f')]);}_0x4a4b4c[_0xbd1a('0x47')]=qs[_0xbd1a('0x48')](_0x50ba76['query'][_0xbd1a('0x48')]);_0x4a4b4c[_0xbd1a('0x49')]=qs[_0xbd1a('0x4a')](_['pick'](_0x50ba76['query'],_0x464bb7[_0xbd1a('0x4a')]),_0x18f3f9);if(_0x50ba76['query'][_0xbd1a('0x4b')]){_0x4a4b4c[_0xbd1a('0x49')]=_[_0xbd1a('0x4c')](_0x4a4b4c[_0xbd1a('0x49')],{'$or':_[_0xbd1a('0x40')](_0x18f3f9,function(_0x4eb491){if(_0x4eb491['type']!==_0xbd1a('0x4d')){var _0x273d47={};_0x273d47[_0x4eb491[_0xbd1a('0x41')]]={'$like':'%'+_0x50ba76[_0xbd1a('0x42')][_0xbd1a('0x4b')]+'%'};return _0x273d47;}})});}_0x4a4b4c=_[_0xbd1a('0x4c')]({},_0x4a4b4c,_0x50ba76['options']);var _0x4c826b={'where':_0x4a4b4c[_0xbd1a('0x49')]};return db[_0xbd1a('0x3b')][_0xbd1a('0x2e')](_0x4c826b)[_0xbd1a('0x21')](function(_0x2b4d05){_0x1b786d[_0xbd1a('0x2e')]=_0x2b4d05;if(_0x50ba76[_0xbd1a('0x42')][_0xbd1a('0x4e')]){_0x4a4b4c[_0xbd1a('0x4f')]=[{'all':!![]}];}return db[_0xbd1a('0x3b')]['findAll'](_0x4a4b4c);})[_0xbd1a('0x21')](function(_0x85644){_0x1b786d[_0xbd1a('0x50')]=_0x85644;return _0x1b786d;})[_0xbd1a('0x21')](respondWithFilteredResult(_0x1ca598,_0x4a4b4c))['catch'](handleError(_0x1ca598,null));};exports['show']=function(_0x23daae,_0x3240ea){var _0x187036={'raw':!![],'where':{'id':_0x23daae[_0xbd1a('0x51')]['id']}},_0x513980={};_0x513980['model']=_[_0xbd1a('0x52')](db[_0xbd1a('0x3b')][_0xbd1a('0x3c')]);_0x513980[_0xbd1a('0x42')]=_[_0xbd1a('0x52')](_0x23daae[_0xbd1a('0x42')]);_0x513980[_0xbd1a('0x4a')]=_[_0xbd1a('0x43')](_0x513980['model'],_0x513980['query']);_0x187036[_0xbd1a('0x44')]=_['intersection'](_0x513980[_0xbd1a('0x3f')],qs[_0xbd1a('0x53')](_0x23daae['query'][_0xbd1a('0x53')]));_0x187036[_0xbd1a('0x44')]=_0x187036[_0xbd1a('0x44')]['length']?_0x187036[_0xbd1a('0x44')]:_0x513980['model'];if(_0x23daae[_0xbd1a('0x42')][_0xbd1a('0x4e')]){_0x187036['include']=[{'all':!![]}];}_0x187036=_[_0xbd1a('0x4c')]({},_0x187036,_0x23daae['options']);return db['Network'][_0xbd1a('0x54')](_0x187036)[_0xbd1a('0x21')](handleEntityNotFound(_0x3240ea,null))['then'](respondWithResult(_0x3240ea,null))[_0xbd1a('0x55')](handleError(_0x3240ea,null));};exports[_0xbd1a('0x56')]=function(_0x5e6ae7,_0x3dbd9b,_0x6ecae3){var _0x24fc86;return db['sequelize'][_0xbd1a('0x57')](function(_0xd0ab8d){return db['Network']['create'](_0x5e6ae7[_0xbd1a('0x58')],{'raw':!![]})['then'](function(_0x123dd7){_0x24fc86=_0x123dd7;return db[_0xbd1a('0x3b')][_0xbd1a('0x59')]({'where':{'type':_0x5e6ae7[_0xbd1a('0x58')][_0xbd1a('0x5a')]},'raw':!![]});})[_0xbd1a('0x21')](function(_0x50179e){if(_0x24fc86[_0xbd1a('0x5a')][_0xbd1a('0x5b')]()==_0xbd1a('0x5c')){var _0x2775de=fs[_0xbd1a('0x5d')](path[_0xbd1a('0x5e')](config['root'],_0xbd1a('0x5f')),_0xbd1a('0x60'));var _0x398acb=ejs[_0xbd1a('0x61')](_0x2775de,{'networks':_0x50179e||[]});fs['writeFileSync']('/etc/asterisk/stun_xcally.conf',_0x398acb);return respondWithRpcPromise('Reload',_0xbd1a('0x56'),{'module':_0xbd1a('0x62')});}else if(_0x24fc86[_0xbd1a('0x5a')][_0xbd1a('0x5b')]()=='TURN'){var _0x4c488a=fs[_0xbd1a('0x5d')](path[_0xbd1a('0x5e')](config['root'],_0xbd1a('0x63')),_0xbd1a('0x60'));var _0x24be9d=ejs['render'](_0x4c488a,{'networks':_0x50179e||[]});fs[_0xbd1a('0x64')](_0xbd1a('0x65'),_0x24be9d);return respondWithRpcPromise('Reload',_0xbd1a('0x56'),{'module':_0xbd1a('0x62')});}else{var _0x411ad3=fs[_0xbd1a('0x5d')](path[_0xbd1a('0x5e')](config[_0xbd1a('0x66')],'server/files/templates/network.ejs'),_0xbd1a('0x60'));var _0x13d70f=ejs['render'](_0x411ad3,{'networks':_0x50179e||[]});fs['writeFileSync'](util[_0xbd1a('0x67')](_0xbd1a('0x68'),_0x5e6ae7[_0xbd1a('0x58')][_0xbd1a('0x5a')][_0xbd1a('0x69')]()),_0x13d70f);return respondWithRpcPromise('Reload',_0xbd1a('0x56'),{'module':_0xbd1a('0x6a')});}return null;})[_0xbd1a('0x21')](function(){return _0x24fc86;});})[_0xbd1a('0x21')](respondWithResult(_0x3dbd9b,0xc9))[_0xbd1a('0x55')](handleError(_0x3dbd9b,null));};exports[_0xbd1a('0x37')]=function(_0x4f410c,_0x2db716,_0x253558){var _0x2446d4;return db[_0xbd1a('0x6b')][_0xbd1a('0x57')](function(_0x37b7ff){return db[_0xbd1a('0x3b')]['find']({'where':{'id':_0x4f410c['params']['id']}})[_0xbd1a('0x21')](handleEntityNotFound(_0x2db716,null))[_0xbd1a('0x21')](saveUpdates(_0x4f410c[_0xbd1a('0x58')],null))[_0xbd1a('0x21')](function(_0x65e0bd){if(_0x65e0bd){_0x2446d4=_0x65e0bd;return db['Network'][_0xbd1a('0x59')]({'where':{'type':_0x2446d4['type']},'raw':!![]});}return null;})[_0xbd1a('0x21')](function(_0x430888){if(_0x2446d4[_0xbd1a('0x5a')][_0xbd1a('0x5b')]()=='STUN'){var _0x1e05d6=fs[_0xbd1a('0x5d')](path[_0xbd1a('0x5e')](config[_0xbd1a('0x66')],_0xbd1a('0x5f')),_0xbd1a('0x60'));var _0x18817a=ejs['render'](_0x1e05d6,{'networks':_0x430888||[]});fs['writeFileSync'](_0xbd1a('0x6c'),_0x18817a);return respondWithRpcPromise(_0xbd1a('0x6d'),_0xbd1a('0x37'),{'module':_0xbd1a('0x62')});}else if(_0x2446d4[_0xbd1a('0x5a')][_0xbd1a('0x5b')]()==_0xbd1a('0x6e')){var _0x17e494=fs['readFileSync'](path['join'](config['root'],_0xbd1a('0x63')),'utf8');var _0x26a414=ejs[_0xbd1a('0x61')](_0x17e494,{'networks':_0x430888||[]});fs[_0xbd1a('0x64')](_0xbd1a('0x65'),_0x26a414);return respondWithRpcPromise(_0xbd1a('0x6d'),_0xbd1a('0x37'),{'module':_0xbd1a('0x62')});}else{var _0x3c840b=fs['readFileSync'](path['join'](config[_0xbd1a('0x66')],'server/files/templates/network.ejs'),'utf8');var _0x16daa0=ejs[_0xbd1a('0x61')](_0x3c840b,{'networks':_0x430888||[]});fs[_0xbd1a('0x64')](util[_0xbd1a('0x67')]('/etc/asterisk/sip_xcally_%s.conf',_0x4f410c['body']['type'][_0xbd1a('0x69')]()),_0x16daa0);return respondWithRpcPromise(_0xbd1a('0x6d'),_0xbd1a('0x37'),{'module':_0xbd1a('0x6a')});}return null;})[_0xbd1a('0x21')](function(_0x1f4697){if(_0x1f4697){return _0x2446d4;}return null;});})[_0xbd1a('0x21')](respondWithResult(_0x2db716,null))[_0xbd1a('0x55')](handleError(_0x2db716,null));};exports[_0xbd1a('0x38')]=function(_0x2bba7d,_0x444e26,_0x535056){var _0x39999e;return db[_0xbd1a('0x3b')][_0xbd1a('0x54')]({'where':{'id':_0x2bba7d[_0xbd1a('0x51')]['id']}})[_0xbd1a('0x21')](function(_0x264110){_0x39999e=_0x264110;return _0x264110;})['then'](handleEntityNotFound(_0x444e26,null))[_0xbd1a('0x21')](removeEntity(_0x444e26,null))['then'](function(){if(_0x39999e){return db[_0xbd1a('0x3b')][_0xbd1a('0x59')]({'where':{'type':_0x39999e[_0xbd1a('0x5a')]},'raw':!![]});}})[_0xbd1a('0x21')](function(_0x507bcf){if(_0x39999e[_0xbd1a('0x5a')][_0xbd1a('0x5b')]()==_0xbd1a('0x5c')){var _0x2ead9e=fs['readFileSync'](path[_0xbd1a('0x5e')](config['root'],_0xbd1a('0x5f')),_0xbd1a('0x60'));var _0x2aa2b0=ejs['render'](_0x2ead9e,{'networks':_0x507bcf||[]});fs[_0xbd1a('0x64')](_0xbd1a('0x6c'),_0x2aa2b0);return respondWithRpcPromise(_0xbd1a('0x6d'),_0xbd1a('0x38'),{'module':_0xbd1a('0x62')});}else if(_0x39999e['type'][_0xbd1a('0x5b')]()==_0xbd1a('0x6e')){var _0x51d643=fs[_0xbd1a('0x5d')](path[_0xbd1a('0x5e')](config[_0xbd1a('0x66')],_0xbd1a('0x63')),_0xbd1a('0x60'));var _0x1ff877=ejs[_0xbd1a('0x61')](_0x51d643,{'networks':_0x507bcf||[]});fs[_0xbd1a('0x64')](_0xbd1a('0x65'),_0x1ff877);return respondWithRpcPromise(_0xbd1a('0x6d'),_0xbd1a('0x38'),{'module':_0xbd1a('0x62')});}else{var _0x3cc6d8=fs[_0xbd1a('0x5d')](path[_0xbd1a('0x5e')](config[_0xbd1a('0x66')],_0xbd1a('0x6f')),_0xbd1a('0x60'));var _0x4f5e7e=ejs[_0xbd1a('0x61')](_0x3cc6d8,{'networks':_0x507bcf||[]});fs[_0xbd1a('0x64')](util['format'](_0xbd1a('0x68'),_0x2bba7d[_0xbd1a('0x58')][_0xbd1a('0x5a')]['toLowerCase']()),_0x4f5e7e);return respondWithRpcPromise(_0xbd1a('0x6d'),_0xbd1a('0x38'),{'module':'chan_sip.so'});}return null;})[_0xbd1a('0x55')](handleError(_0x444e26,null));}; \ No newline at end of file diff --git a/server/api/network/network.model.js b/server/api/network/network.model.js index 8fba8a7..1460fe3 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 _0x5db8=['lodash','util','../../config/logger','moment','bluebird','request-promise','../../config/environment','./network.attributes','exports','Network','network'];(function(_0x8c43de,_0x90ff31){var _0xa6591b=function(_0x469716){while(--_0x469716){_0x8c43de['push'](_0x8c43de['shift']());}};_0xa6591b(++_0x90ff31);}(_0x5db8,0xbb));var _0x85db=function(_0x3233c3,_0x15e5fa){_0x3233c3=_0x3233c3-0x0;var _0x36029b=_0x5db8[_0x3233c3];return _0x36029b;};'use strict';var _=require(_0x85db('0x0'));var util=require(_0x85db('0x1'));var logger=require(_0x85db('0x2'))('api');var moment=require(_0x85db('0x3'));var BPromise=require(_0x85db('0x4'));var rp=require(_0x85db('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x85db('0x6'));var attributes=require(_0x85db('0x7'));module[_0x85db('0x8')]=function(_0x34d71f,_0x48bf16){return _0x34d71f['define'](_0x85db('0x9'),attributes,{'tableName':_0x85db('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb903=['rimraf','../../config/environment','./network.attributes','exports','network','lodash','util','../../config/logger','api','bluebird','request-promise','path'];(function(_0x81024b,_0x1437bf){var _0x4ee29c=function(_0x3dc297){while(--_0x3dc297){_0x81024b['push'](_0x81024b['shift']());}};_0x4ee29c(++_0x1437bf);}(_0xb903,0x185));var _0x3b90=function(_0xf41281,_0x2fec54){_0xf41281=_0xf41281-0x0;var _0x3756ab=_0xb903[_0xf41281];return _0x3756ab;};'use strict';var _=require(_0x3b90('0x0'));var util=require(_0x3b90('0x1'));var logger=require(_0x3b90('0x2'))(_0x3b90('0x3'));var moment=require('moment');var BPromise=require(_0x3b90('0x4'));var rp=require(_0x3b90('0x5'));var fs=require('fs');var path=require(_0x3b90('0x6'));var rimraf=require(_0x3b90('0x7'));var config=require(_0x3b90('0x8'));var attributes=require(_0x3b90('0x9'));module[_0x3b90('0xa')]=function(_0x5acd76,_0x15b68f){return _0x5acd76['define']('Network',attributes,{'tableName':_0x3b90('0xb'),'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 c6067b4..796fc2c 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 _0x5a2b=['catch','lodash','util','randomstring','ioredis','../../config/logger','../../config/environment','jayson/promise','http','request','Network,\x20%s,\x20%s','debug','Network,\x20%s,\x20%s,\x20%s','request\x20sent','error','message','info'];(function(_0xb82940,_0x530318){var _0x2e152a=function(_0x27bf29){while(--_0x27bf29){_0xb82940['push'](_0xb82940['shift']());}};_0x2e152a(++_0x530318);}(_0x5a2b,0x89));var _0xb5a2=function(_0x89ee59,_0x672185){_0x89ee59=_0x89ee59-0x0;var _0x1f5557=_0x5a2b[_0x89ee59];return _0x1f5557;};'use strict';var _=require(_0xb5a2('0x0'));var util=require(_0xb5a2('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xb5a2('0x2'));var fs=require('fs');var Redis=require(_0xb5a2('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xb5a2('0x4'))('rpc');var config=require(_0xb5a2('0x5'));var jayson=require(_0xb5a2('0x6'));var client=jayson['client'][_0xb5a2('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x4bdaf5,_0x3359f1,_0x101a12){return new BPromise(function(_0x456f79,_0x39d7af){return client[_0xb5a2('0x8')](_0x4bdaf5,_0x101a12)['then'](function(_0x5281de){logger['info'](_0xb5a2('0x9'),_0x3359f1,'request\x20sent');logger[_0xb5a2('0xa')](_0xb5a2('0xb'),_0x3359f1,_0xb5a2('0xc'),JSON['stringify'](_0x5281de));if(_0x5281de[_0xb5a2('0xd')]){if(_0x5281de[_0xb5a2('0xd')]['code']===0x1f4){logger['error'](_0xb5a2('0x9'),_0x3359f1,_0x5281de[_0xb5a2('0xd')][_0xb5a2('0xe')]);return _0x39d7af(_0x5281de[_0xb5a2('0xd')][_0xb5a2('0xe')]);}logger[_0xb5a2('0xd')](_0xb5a2('0x9'),_0x3359f1,_0x5281de[_0xb5a2('0xd')][_0xb5a2('0xe')]);return _0x456f79(_0x5281de[_0xb5a2('0xd')][_0xb5a2('0xe')]);}else{logger[_0xb5a2('0xf')]('Network,\x20%s,\x20%s',_0x3359f1,'request\x20sent');_0x456f79(_0x5281de['result']['message']);}})[_0xb5a2('0x10')](function(_0x35e172){logger[_0xb5a2('0xd')]('Network,\x20%s,\x20%s',_0x3359f1,_0x35e172);_0x39d7af(_0x35e172);});});} \ No newline at end of file +var _0xf9c5=['../../config/environment','client','request','then','Network,\x20%s,\x20%s','request\x20sent','Network,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','util','bluebird','randomstring','ioredis','../../config/logger','rpc'];(function(_0xde1a2a,_0x52b7bc){var _0x43ab09=function(_0x962258){while(--_0x962258){_0xde1a2a['push'](_0xde1a2a['shift']());}};_0x43ab09(++_0x52b7bc);}(_0xf9c5,0x150));var _0x5f9c=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xf9c5[_0x122ef9];return _0x42fba0;};'use strict';var _=require('lodash');var util=require(_0x5f9c('0x0'));var moment=require('moment');var BPromise=require(_0x5f9c('0x1'));var rs=require(_0x5f9c('0x2'));var fs=require('fs');var Redis=require(_0x5f9c('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x5f9c('0x4'))(_0x5f9c('0x5'));var config=require(_0x5f9c('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x5f9c('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0xbd6231,_0xbe0152,_0x5dcabd){return new BPromise(function(_0x386983,_0x4e89b7){return client[_0x5f9c('0x8')](_0xbd6231,_0x5dcabd)[_0x5f9c('0x9')](function(_0x642812){logger['info'](_0x5f9c('0xa'),_0xbe0152,_0x5f9c('0xb'));logger['debug'](_0x5f9c('0xc'),_0xbe0152,'request\x20sent',JSON[_0x5f9c('0xd')](_0x642812));if(_0x642812[_0x5f9c('0xe')]){if(_0x642812[_0x5f9c('0xe')][_0x5f9c('0xf')]===0x1f4){logger[_0x5f9c('0xe')](_0x5f9c('0xa'),_0xbe0152,_0x642812[_0x5f9c('0xe')][_0x5f9c('0x10')]);return _0x4e89b7(_0x642812['error'][_0x5f9c('0x10')]);}logger[_0x5f9c('0xe')](_0x5f9c('0xa'),_0xbe0152,_0x642812['error'][_0x5f9c('0x10')]);return _0x386983(_0x642812['error'][_0x5f9c('0x10')]);}else{logger[_0x5f9c('0x11')](_0x5f9c('0xa'),_0xbe0152,'request\x20sent');_0x386983(_0x642812[_0x5f9c('0x12')][_0x5f9c('0x10')]);}})['catch'](function(_0x133e81){logger[_0x5f9c('0xe')](_0x5f9c('0xa'),_0xbe0152,_0x133e81);_0x4e89b7(_0x133e81);});});} \ No newline at end of file diff --git a/server/api/notification/index.js b/server/api/notification/index.js index ae905c3..aa9509e 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 _0x856b=['../../components/auth/service','../../components/interaction/service','./notification.controller','isAuthenticated','sendNotification','exports','multer','util','connect-timeout','express','Router'];(function(_0x5d2a19,_0xcaa635){var _0x4247d5=function(_0x351b10){while(--_0x351b10){_0x5d2a19['push'](_0x5d2a19['shift']());}};_0x4247d5(++_0xcaa635);}(_0x856b,0x1c9));var _0xb856=function(_0x2ef252,_0x1993fe){_0x2ef252=_0x2ef252-0x0;var _0x1139ca=_0x856b[_0x2ef252];return _0x1139ca;};'use strict';var multer=require(_0xb856('0x0'));var util=require(_0xb856('0x1'));var path=require('path');var timeout=require(_0xb856('0x2'));var express=require(_0xb856('0x3'));var router=express[_0xb856('0x4')]();var auth=require(_0xb856('0x5'));var interaction=require(_0xb856('0x6'));var config=require('../../config/environment');var controller=require(_0xb856('0x7'));router['post']('/',auth[_0xb856('0x8')](),controller[_0xb856('0x9')]);module[_0xb856('0xa')]=router; \ No newline at end of file +var _0x8b8b=['../../config/environment','./notification.controller','post','isAuthenticated','sendNotification','multer','path','express','Router','../../components/auth/service'];(function(_0x347437,_0x55d68e){var _0x27afa4=function(_0xb3fb44){while(--_0xb3fb44){_0x347437['push'](_0x347437['shift']());}};_0x27afa4(++_0x55d68e);}(_0x8b8b,0x73));var _0xb8b8=function(_0x17ca07,_0x43c67f){_0x17ca07=_0x17ca07-0x0;var _0x34b97d=_0x8b8b[_0x17ca07];return _0x34b97d;};'use strict';var multer=require(_0xb8b8('0x0'));var util=require('util');var path=require(_0xb8b8('0x1'));var timeout=require('connect-timeout');var express=require(_0xb8b8('0x2'));var router=express[_0xb8b8('0x3')]();var auth=require(_0xb8b8('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xb8b8('0x5'));var controller=require(_0xb8b8('0x6'));router[_0xb8b8('0x7')]('/',auth[_0xb8b8('0x8')](),controller[_0xb8b8('0x9')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/notification/notification.attributes.js b/server/api/notification/notification.attributes.js index 83d6f59..586952b 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 _0x11b0=['sequelize','exports','TEXT','STRING','BOOLEAN'];(function(_0x2b7908,_0x53b8d5){var _0x4ddbb7=function(_0x299ac5){while(--_0x299ac5){_0x2b7908['push'](_0x2b7908['shift']());}};_0x4ddbb7(++_0x53b8d5);}(_0x11b0,0x122));var _0x011b=function(_0x4494d2,_0x1a7093){_0x4494d2=_0x4494d2-0x0;var _0x3a4e91=_0x11b0[_0x4494d2];return _0x3a4e91;};'use strict';var Sequelize=require(_0x011b('0x0'));module[_0x011b('0x1')]={'body':{'type':Sequelize[_0x011b('0x2')]},'senderName':{'type':Sequelize[_0x011b('0x3')]},'recipientsId':{'type':Sequelize[_0x011b('0x2')]},'recipientsDescription':{'type':Sequelize['STRING']},'beep':{'type':Sequelize[_0x011b('0x4')]}}; \ No newline at end of file +var _0x0df5=['exports','TEXT','STRING','BOOLEAN','sequelize'];(function(_0x497889,_0x36d2e2){var _0x5f6b12=function(_0x4c47dd){while(--_0x4c47dd){_0x497889['push'](_0x497889['shift']());}};_0x5f6b12(++_0x36d2e2);}(_0x0df5,0xbd));var _0x50df=function(_0x525495,_0x4af010){_0x525495=_0x525495-0x0;var _0x9623bf=_0x0df5[_0x525495];return _0x9623bf;};'use strict';var Sequelize=require(_0x50df('0x0'));module[_0x50df('0x1')]={'body':{'type':Sequelize[_0x50df('0x2')]},'senderName':{'type':Sequelize[_0x50df('0x3')]},'recipientsId':{'type':Sequelize[_0x50df('0x2')]},'recipientsDescription':{'type':Sequelize[_0x50df('0x3')]},'beep':{'type':Sequelize[_0x50df('0x4')]}}; \ No newline at end of file diff --git a/server/api/notification/notification.controller.js b/server/api/notification/notification.controller.js index a3bd73b..8527677 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 _0xf9c3=['ejs','lodash','crypto','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','redis','defaults','localhost','./notification.socket','register','sendStatus','end','status','json','offset','limit','set','Content-Range','apply','reject','update','then','error','stack','name','send','sendNotification','body','text','hasOwnProperty','TemplateId','Sequelize','ValidationError','Must\x20specify\x20at\x20least\x20one\x20argument\x20for\x20\x27text\x27\x20or\x20\x27TemplateId\x27','view','Missing\x20\x27view\x27\x20parameter','recipients','Missing\x20\x27recipients\x27\x20parameter','parse','chatqueue','faxqueue','mailqueue','openchannelqueue','voicequeue','whatsappqueue','team','user','some','includes','model','toLowerCase','Invalid\x20model\x20in\x20\x27recipients\x27\x20object','senderName','fullname','recipientsDescription','isEmpty','beep','SenderId','join','sequelize','forEach','recipient','notification:send','Template','findOne','html','Invalid\x20\x27TemplateId\x27\x20parameter','render','catch','startCase','User','ids','queue','replace','push','all','union','flatten','getAgents','map','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv'];(function(_0x15b507,_0xf790a3){var _0x8d4ef6=function(_0x116f4c){while(--_0x116f4c){_0x15b507['push'](_0x15b507['shift']());}};_0x8d4ef6(++_0xf790a3);}(_0xf9c3,0x1ed));var _0x3f9c=function(_0x4171bf,_0x4322f3){_0x4171bf=_0x4171bf-0x0;var _0x18a433=_0xf9c3[_0x4171bf];return _0x18a433;};'use strict';var pdf=require(_0x3f9c('0x0'));var emlformat=require(_0x3f9c('0x1'));var rimraf=require(_0x3f9c('0x2'));var zipdir=require(_0x3f9c('0x3'));var jsonpatch=require(_0x3f9c('0x4'));var rp=require(_0x3f9c('0x5'));var moment=require(_0x3f9c('0x6'));var BPromise=require(_0x3f9c('0x7'));var Mustache=require(_0x3f9c('0x8'));var util=require('util');var path=require(_0x3f9c('0x9'));var sox=require(_0x3f9c('0xa'));var csv=require(_0x3f9c('0xb'));var ejs=require(_0x3f9c('0xc'));var fs=require('fs');var _=require(_0x3f9c('0xd'));var squel=require('squel');var crypto=require(_0x3f9c('0xe'));var jsforce=require(_0x3f9c('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x3f9c('0xb'));var querystring=require(_0x3f9c('0x10'));var Papa=require(_0x3f9c('0x11'));var Redis=require(_0x3f9c('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x3f9c('0x13'));var as=require(_0x3f9c('0x14'));var hardwareService=require(_0x3f9c('0x15'));var logger=require(_0x3f9c('0x16'))(_0x3f9c('0x17'));var utils=require(_0x3f9c('0x18'));var config=require(_0x3f9c('0x19'));var db=require('../../mysqldb')['db'];config[_0x3f9c('0x1a')]=_[_0x3f9c('0x1b')](config['redis'],{'host':_0x3f9c('0x1c'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x3f9c('0x1d'))[_0x3f9c('0x1e')](socket);function respondWithStatusCode(_0x3a8f5a,_0x18cf2e){_0x18cf2e=_0x18cf2e||0xcc;return function(_0x18199c){if(_0x18199c){return _0x3a8f5a[_0x3f9c('0x1f')](_0x18cf2e);}return _0x3a8f5a['status'](_0x18cf2e)[_0x3f9c('0x20')]();};}function respondWithResult(_0x25adfb,_0x21e249){_0x21e249=_0x21e249||0xc8;return function(_0x5c8cb2){if(_0x5c8cb2){return _0x25adfb[_0x3f9c('0x21')](_0x21e249)[_0x3f9c('0x22')](_0x5c8cb2);}};}function respondWithFilteredResult(_0x1b5719,_0xa0720e){return function(_0x4e2981){if(_0x4e2981){var _0x588be5=_0x4e2981['count'],_0x1046b5=_0xa0720e[_0x3f9c('0x23')],_0x2e206a=_0xa0720e['offset']+_0xa0720e[_0x3f9c('0x24')],_0x3d3aeb;if(_0x2e206a>=_0x588be5){_0x2e206a=_0x588be5;_0x3d3aeb=0xc8;}else{_0x3d3aeb=0xce;}_0x1b5719[_0x3f9c('0x21')](_0x3d3aeb);return _0x1b5719[_0x3f9c('0x25')](_0x3f9c('0x26'),_0x1046b5+'-'+_0x2e206a+'/'+_0x588be5)[_0x3f9c('0x22')](_0x4e2981);}return null;};}function patchUpdates(_0x36be10){return function(_0x6360f9){try{jsonpatch[_0x3f9c('0x27')](_0x6360f9,_0x36be10,!![]);}catch(_0x4c277a){return BPromise[_0x3f9c('0x28')](_0x4c277a);}return _0x6360f9['save']();};}function saveUpdates(_0x99110a,_0x350cdd){return function(_0x408623){if(_0x408623){return _0x408623[_0x3f9c('0x29')](_0x99110a)[_0x3f9c('0x2a')](function(_0x314a9f){return _0x314a9f;});}return null;};}function removeEntity(_0x127cd5,_0x3ca972){return function(_0x4c8f1a){if(_0x4c8f1a){return _0x4c8f1a['destroy']()[_0x3f9c('0x2a')](function(){_0x127cd5['status'](0xcc)[_0x3f9c('0x20')]();});}};}function handleEntityNotFound(_0x309f20,_0x2ffa8b){return function(_0x41b57f){if(!_0x41b57f){_0x309f20[_0x3f9c('0x1f')](0x194);}return _0x41b57f;};}function handleError(_0x1a1467,_0x4d5022){_0x4d5022=_0x4d5022||0x1f4;return function(_0x96aba8){logger[_0x3f9c('0x2b')](_0x96aba8[_0x3f9c('0x2c')]);if(_0x96aba8[_0x3f9c('0x2d')]){delete _0x96aba8[_0x3f9c('0x2d')];}_0x1a1467[_0x3f9c('0x21')](_0x4d5022)[_0x3f9c('0x2e')](_0x96aba8);};}exports[_0x3f9c('0x2f')]=function(_0x217d41,_0x1a5bba,_0xa2ebb1){if(!_0x217d41[_0x3f9c('0x30')]['hasOwnProperty'](_0x3f9c('0x31'))&&!_0x217d41[_0x3f9c('0x30')][_0x3f9c('0x32')](_0x3f9c('0x33'))){throw new db[(_0x3f9c('0x34'))][(_0x3f9c('0x35'))](_0x3f9c('0x36'));}else{if(_0x217d41[_0x3f9c('0x30')][_0x3f9c('0x32')](_0x3f9c('0x33'))&&!_0x217d41[_0x3f9c('0x30')][_0x3f9c('0x32')](_0x3f9c('0x37'))){throw new db[(_0x3f9c('0x34'))][(_0x3f9c('0x35'))](_0x3f9c('0x38'));}if(!_0x217d41[_0x3f9c('0x30')][_0x3f9c('0x32')](_0x3f9c('0x39'))){throw new db[(_0x3f9c('0x34'))]['ValidationError'](_0x3f9c('0x3a'));}else{try{var _0x1fe9fa=JSON[_0x3f9c('0x3b')](_0x217d41[_0x3f9c('0x30')][_0x3f9c('0x39')]);}catch(_0x3179d0){logger['error'](_0x3179d0);throw new db['Sequelize']['ValidationError']('Invalid\x20\x27recipients\x27\x20object');}var _0x20ec97=[_0x3f9c('0x3c'),_0x3f9c('0x3d'),_0x3f9c('0x3e'),_0x3f9c('0x3f'),'smsqueue',_0x3f9c('0x40'),_0x3f9c('0x41'),_0x3f9c('0x42'),_0x3f9c('0x43')];if(_[_0x3f9c('0x44')](_0x1fe9fa,function(_0x11a923){return!_[_0x3f9c('0x45')](_0x20ec97,_0x11a923[_0x3f9c('0x46')][_0x3f9c('0x47')]());})){throw new db['Sequelize']['ValidationError'](_0x3f9c('0x48'));}}}var _0x3be1f4={};_0x3be1f4[_0x3f9c('0x49')]=_0x217d41[_0x3f9c('0x30')][_0x3f9c('0x32')]('senderName')?_0x217d41['body'][_0x3f9c('0x49')]:_0x217d41['user'][_0x3f9c('0x4a')];_0x3be1f4[_0x3f9c('0x4b')]=_[_0x3f9c('0x4c')](_0x217d41[_0x3f9c('0x30')][_0x3f9c('0x4b')])?null:_0x217d41[_0x3f9c('0x30')][_0x3f9c('0x4b')];_0x3be1f4[_0x3f9c('0x4d')]=_0x217d41[_0x3f9c('0x30')]['beep']||![];_0x3be1f4[_0x3f9c('0x4e')]=_0x217d41[_0x3f9c('0x43')]['id'];return getContent(_0x217d41[_0x3f9c('0x30')])['then'](function(_0x15bbc6){_0x3be1f4['body']=_0x15bbc6;return getRecipients(_0x1fe9fa);})[_0x3f9c('0x2a')](function(_0x84ac3e){_0x3be1f4['recipientsId']=_['sortBy'](_0x84ac3e)[_0x3f9c('0x4f')](',');return db[_0x3f9c('0x50')]['transaction'](function(_0x3e407f){return db['Notification']['create'](_0x3be1f4,{'raw':!![],'transaction':_0x3e407f})['then'](function(_0x13ec51){var _0x14d08e={'sender':_0x3be1f4['senderName'],'description':_0x3be1f4[_0x3f9c('0x4b')],'content':_0x3be1f4[_0x3f9c('0x30')],'beep':_0x3be1f4[_0x3f9c('0x4d')]};_0x84ac3e[_0x3f9c('0x51')](function(_0x212a29){_0x14d08e[_0x3f9c('0x52')]=_0x212a29;socket['emit'](_0x3f9c('0x53'),_0x14d08e);});return _0x13ec51;});});})[_0x3f9c('0x2a')](respondWithResult(_0x1a5bba,0xc9))['catch'](handleError(_0x1a5bba,null));};function getContent(_0x3c54b9){return new BPromise(function(_0x376102,_0x19b02f){if(_0x3c54b9[_0x3f9c('0x31')]){_0x376102(_0x3c54b9[_0x3f9c('0x31')]);return;}return db[_0x3f9c('0x54')][_0x3f9c('0x55')]({'attributes':[_0x3f9c('0x56')],'where':{'id':_0x3c54b9[_0x3f9c('0x33')]},'raw':!![]})[_0x3f9c('0x2a')](function(_0x30969f){if(!_0x30969f)throw new db[(_0x3f9c('0x34'))][(_0x3f9c('0x35'))](_0x3f9c('0x57'));var _0x1c9c71=Mustache[_0x3f9c('0x58')](_0x30969f[_0x3f9c('0x56')],_0x3c54b9[_0x3f9c('0x37')]);_0x376102(_0x1c9c71);})[_0x3f9c('0x59')](function(_0x5b8226){_0x19b02f(_0x5b8226);});});}function getRecipients(_0x5cd6b9){return new BPromise(function(_0x120919,_0x3f113d){var _0xa8593=[];var _0x459b95=[];_0x5cd6b9[_0x3f9c('0x51')](function(_0x40e28a){var _0x407555=_[_0x3f9c('0x5a')](_0x40e28a['model'][_0x3f9c('0x47')]());if(_0x407555===_0x3f9c('0x5b')){_0xa8593=_['union'](_0xa8593,_0x40e28a[_0x3f9c('0x5c')]);}else{if(_['includes'](_0x407555,_0x3f9c('0x5d')))_0x407555=_0x407555[_0x3f9c('0x5e')](_0x3f9c('0x5d'),'Queue');_0x40e28a[_0x3f9c('0x5c')][_0x3f9c('0x51')](function(_0x5a6ab1){_0x459b95[_0x3f9c('0x5f')](getAgents(_0x407555,_0x5a6ab1));});}});return BPromise[_0x3f9c('0x60')](_0x459b95)[_0x3f9c('0x2a')](function(_0xd3e38c){_0xa8593=_[_0x3f9c('0x61')](_0xa8593,_[_0x3f9c('0x62')](_0xd3e38c));_0x120919(_0xa8593);})['catch'](function(_0x23d5e8){_0x3f113d(_0x23d5e8);});});}function getAgents(_0x4c2e49,_0x3dbcc7){return new BPromise(function(_0x2a2890,_0xd40e6c){return db[_0x4c2e49][_0x3f9c('0x55')]({'where':{'id':_0x3dbcc7}})[_0x3f9c('0x2a')](function(_0x56c3df){return _0x56c3df[_0x3f9c('0x63')]({'attributes':['id'],'raw':!![]})['then'](function(_0x264f90){var _0x4bf54a=_[_0x3f9c('0x64')](_0x264f90,'id');_0x2a2890(_0x4bf54a);});})[_0x3f9c('0x59')](function(_0x46d2fb){_0xd40e6c(_0x46d2fb);});});} \ No newline at end of file +var _0x65ea=['queue','replace','Queue','push','all','flatten','getAgents','map','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','path','sox','ejs','lodash','crypto','jsforce','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','redis','defaults','localhost','socket.io-emitter','./notification.socket','register','status','end','json','count','set','Content-Range','apply','reject','then','error','stack','name','send','sendNotification','body','hasOwnProperty','text','ValidationError','Must\x20specify\x20at\x20least\x20one\x20argument\x20for\x20\x27text\x27\x20or\x20\x27TemplateId\x27','TemplateId','Sequelize','Missing\x20\x27view\x27\x20parameter','recipients','Missing\x20\x27recipients\x27\x20parameter','Invalid\x20\x27recipients\x27\x20object','faxqueue','smsqueue','voicequeue','team','some','model','toLowerCase','Invalid\x20model\x20in\x20\x27recipients\x27\x20object','senderName','user','fullname','recipientsDescription','beep','recipientsId','sequelize','transaction','Notification','create','forEach','emit','notification:send','catch','Template','findOne','html','Invalid\x20\x27TemplateId\x27\x20parameter','render','view','User','union','ids','includes'];(function(_0x106337,_0x5bd12a){var _0x7c867f=function(_0x2d8482){while(--_0x2d8482){_0x106337['push'](_0x106337['shift']());}};_0x7c867f(++_0x5bd12a);}(_0x65ea,0xc4));var _0xa65e=function(_0x740a35,_0x4efde9){_0x740a35=_0x740a35-0x0;var _0x169a91=_0x65ea[_0x740a35];return _0x169a91;};'use strict';var pdf=require(_0xa65e('0x0'));var emlformat=require(_0xa65e('0x1'));var rimraf=require(_0xa65e('0x2'));var zipdir=require(_0xa65e('0x3'));var jsonpatch=require(_0xa65e('0x4'));var rp=require(_0xa65e('0x5'));var moment=require('moment');var BPromise=require(_0xa65e('0x6'));var Mustache=require('mustache');var util=require(_0xa65e('0x7'));var path=require(_0xa65e('0x8'));var sox=require(_0xa65e('0x9'));var csv=require('to-csv');var ejs=require(_0xa65e('0xa'));var fs=require('fs');var _=require(_0xa65e('0xb'));var squel=require('squel');var crypto=require(_0xa65e('0xc'));var jsforce=require(_0xa65e('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xa65e('0xe'));var querystring=require(_0xa65e('0xf'));var Papa=require(_0xa65e('0x10'));var Redis=require(_0xa65e('0x11'));var authService=require(_0xa65e('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xa65e('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xa65e('0x14'))(_0xa65e('0x15'));var utils=require(_0xa65e('0x16'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];config[_0xa65e('0x17')]=_[_0xa65e('0x18')](config[_0xa65e('0x17')],{'host':_0xa65e('0x19'),'port':0x18eb});var socket=require(_0xa65e('0x1a'))(new Redis(config[_0xa65e('0x17')]));require(_0xa65e('0x1b'))[_0xa65e('0x1c')](socket);function respondWithStatusCode(_0x549008,_0x162b2c){_0x162b2c=_0x162b2c||0xcc;return function(_0x558ca8){if(_0x558ca8){return _0x549008['sendStatus'](_0x162b2c);}return _0x549008[_0xa65e('0x1d')](_0x162b2c)[_0xa65e('0x1e')]();};}function respondWithResult(_0x5a4020,_0x4fa6b5){_0x4fa6b5=_0x4fa6b5||0xc8;return function(_0xf3a746){if(_0xf3a746){return _0x5a4020[_0xa65e('0x1d')](_0x4fa6b5)[_0xa65e('0x1f')](_0xf3a746);}};}function respondWithFilteredResult(_0x1b6319,_0x461c16){return function(_0x5ab6b7){if(_0x5ab6b7){var _0x3e8102=_0x5ab6b7[_0xa65e('0x20')],_0x2c8455=_0x461c16['offset'],_0x34c229=_0x461c16['offset']+_0x461c16['limit'],_0x3e92ec;if(_0x34c229>=_0x3e8102){_0x34c229=_0x3e8102;_0x3e92ec=0xc8;}else{_0x3e92ec=0xce;}_0x1b6319[_0xa65e('0x1d')](_0x3e92ec);return _0x1b6319[_0xa65e('0x21')](_0xa65e('0x22'),_0x2c8455+'-'+_0x34c229+'/'+_0x3e8102)[_0xa65e('0x1f')](_0x5ab6b7);}return null;};}function patchUpdates(_0x521181){return function(_0x279e5c){try{jsonpatch[_0xa65e('0x23')](_0x279e5c,_0x521181,!![]);}catch(_0x554cdc){return BPromise[_0xa65e('0x24')](_0x554cdc);}return _0x279e5c['save']();};}function saveUpdates(_0x230ebe,_0x3bd6c2){return function(_0x298f55){if(_0x298f55){return _0x298f55['update'](_0x230ebe)[_0xa65e('0x25')](function(_0x4d4f3b){return _0x4d4f3b;});}return null;};}function removeEntity(_0x2dd81d,_0x132041){return function(_0x442e17){if(_0x442e17){return _0x442e17['destroy']()[_0xa65e('0x25')](function(){_0x2dd81d[_0xa65e('0x1d')](0xcc)[_0xa65e('0x1e')]();});}};}function handleEntityNotFound(_0x5dd2f6,_0x34b715){return function(_0x54088a){if(!_0x54088a){_0x5dd2f6['sendStatus'](0x194);}return _0x54088a;};}function handleError(_0x3178f5,_0x260040){_0x260040=_0x260040||0x1f4;return function(_0x2e9f11){logger[_0xa65e('0x26')](_0x2e9f11[_0xa65e('0x27')]);if(_0x2e9f11[_0xa65e('0x28')]){delete _0x2e9f11['name'];}_0x3178f5[_0xa65e('0x1d')](_0x260040)[_0xa65e('0x29')](_0x2e9f11);};}exports[_0xa65e('0x2a')]=function(_0x1dbe3e,_0x17eabf,_0x2581ca){if(!_0x1dbe3e[_0xa65e('0x2b')][_0xa65e('0x2c')](_0xa65e('0x2d'))&&!_0x1dbe3e[_0xa65e('0x2b')][_0xa65e('0x2c')]('TemplateId')){throw new db['Sequelize'][(_0xa65e('0x2e'))](_0xa65e('0x2f'));}else{if(_0x1dbe3e[_0xa65e('0x2b')][_0xa65e('0x2c')](_0xa65e('0x30'))&&!_0x1dbe3e[_0xa65e('0x2b')]['hasOwnProperty']('view')){throw new db[(_0xa65e('0x31'))][(_0xa65e('0x2e'))](_0xa65e('0x32'));}if(!_0x1dbe3e[_0xa65e('0x2b')][_0xa65e('0x2c')](_0xa65e('0x33'))){throw new db['Sequelize'][(_0xa65e('0x2e'))](_0xa65e('0x34'));}else{try{var _0x499102=JSON['parse'](_0x1dbe3e['body'][_0xa65e('0x33')]);}catch(_0x5f511d){logger[_0xa65e('0x26')](_0x5f511d);throw new db[(_0xa65e('0x31'))][(_0xa65e('0x2e'))](_0xa65e('0x35'));}var _0x209dcf=['chatqueue',_0xa65e('0x36'),'mailqueue','openchannelqueue',_0xa65e('0x37'),_0xa65e('0x38'),'whatsappqueue',_0xa65e('0x39'),'user'];if(_[_0xa65e('0x3a')](_0x499102,function(_0x3d2bb0){return!_['includes'](_0x209dcf,_0x3d2bb0[_0xa65e('0x3b')][_0xa65e('0x3c')]());})){throw new db[(_0xa65e('0x31'))][(_0xa65e('0x2e'))](_0xa65e('0x3d'));}}}var _0x29eef5={};_0x29eef5[_0xa65e('0x3e')]=_0x1dbe3e[_0xa65e('0x2b')][_0xa65e('0x2c')]('senderName')?_0x1dbe3e[_0xa65e('0x2b')][_0xa65e('0x3e')]:_0x1dbe3e[_0xa65e('0x3f')][_0xa65e('0x40')];_0x29eef5[_0xa65e('0x41')]=_['isEmpty'](_0x1dbe3e[_0xa65e('0x2b')][_0xa65e('0x41')])?null:_0x1dbe3e[_0xa65e('0x2b')][_0xa65e('0x41')];_0x29eef5[_0xa65e('0x42')]=_0x1dbe3e[_0xa65e('0x2b')][_0xa65e('0x42')]||![];_0x29eef5['SenderId']=_0x1dbe3e[_0xa65e('0x3f')]['id'];return getContent(_0x1dbe3e[_0xa65e('0x2b')])[_0xa65e('0x25')](function(_0x277fc6){_0x29eef5[_0xa65e('0x2b')]=_0x277fc6;return getRecipients(_0x499102);})['then'](function(_0x582da3){_0x29eef5[_0xa65e('0x43')]=_['sortBy'](_0x582da3)['join'](',');return db[_0xa65e('0x44')][_0xa65e('0x45')](function(_0x5c7059){return db[_0xa65e('0x46')][_0xa65e('0x47')](_0x29eef5,{'raw':!![],'transaction':_0x5c7059})[_0xa65e('0x25')](function(_0x339a77){var _0x51b9c1={'sender':_0x29eef5[_0xa65e('0x3e')],'description':_0x29eef5[_0xa65e('0x41')],'content':_0x29eef5[_0xa65e('0x2b')],'beep':_0x29eef5[_0xa65e('0x42')]};_0x582da3[_0xa65e('0x48')](function(_0x2773e3){_0x51b9c1['recipient']=_0x2773e3;socket[_0xa65e('0x49')](_0xa65e('0x4a'),_0x51b9c1);});return _0x339a77;});});})[_0xa65e('0x25')](respondWithResult(_0x17eabf,0xc9))[_0xa65e('0x4b')](handleError(_0x17eabf,null));};function getContent(_0x2aa51a){return new BPromise(function(_0x535237,_0x1508dc){if(_0x2aa51a['text']){_0x535237(_0x2aa51a[_0xa65e('0x2d')]);return;}return db[_0xa65e('0x4c')][_0xa65e('0x4d')]({'attributes':[_0xa65e('0x4e')],'where':{'id':_0x2aa51a[_0xa65e('0x30')]},'raw':!![]})[_0xa65e('0x25')](function(_0x44f516){if(!_0x44f516)throw new db['Sequelize'][(_0xa65e('0x2e'))](_0xa65e('0x4f'));var _0x1898ba=Mustache[_0xa65e('0x50')](_0x44f516['html'],_0x2aa51a[_0xa65e('0x51')]);_0x535237(_0x1898ba);})['catch'](function(_0x526459){_0x1508dc(_0x526459);});});}function getRecipients(_0x57171b){return new BPromise(function(_0x31d883,_0x52a483){var _0x3b1467=[];var _0xc56aa9=[];_0x57171b[_0xa65e('0x48')](function(_0x493ae0){var _0x4050d7=_['startCase'](_0x493ae0[_0xa65e('0x3b')][_0xa65e('0x3c')]());if(_0x4050d7===_0xa65e('0x52')){_0x3b1467=_[_0xa65e('0x53')](_0x3b1467,_0x493ae0[_0xa65e('0x54')]);}else{if(_[_0xa65e('0x55')](_0x4050d7,_0xa65e('0x56')))_0x4050d7=_0x4050d7[_0xa65e('0x57')](_0xa65e('0x56'),_0xa65e('0x58'));_0x493ae0[_0xa65e('0x54')][_0xa65e('0x48')](function(_0x5cc29d){_0xc56aa9[_0xa65e('0x59')](getAgents(_0x4050d7,_0x5cc29d));});}});return BPromise[_0xa65e('0x5a')](_0xc56aa9)['then'](function(_0x2cd70a){_0x3b1467=_[_0xa65e('0x53')](_0x3b1467,_[_0xa65e('0x5b')](_0x2cd70a));_0x31d883(_0x3b1467);})[_0xa65e('0x4b')](function(_0x4868c0){_0x52a483(_0x4868c0);});});}function getAgents(_0x33e45f,_0x1ead4b){return new BPromise(function(_0x3962e0,_0x5e6fa6){return db[_0x33e45f][_0xa65e('0x4d')]({'where':{'id':_0x1ead4b}})[_0xa65e('0x25')](function(_0xdad1ff){return _0xdad1ff[_0xa65e('0x5c')]({'attributes':['id'],'raw':!![]})[_0xa65e('0x25')](function(_0x305cc5){var _0xf5521f=_[_0xa65e('0x5d')](_0x305cc5,'id');_0x3962e0(_0xf5521f);});})[_0xa65e('0x4b')](function(_0x3bb3f7){_0x5e6fa6(_0x3bb3f7);});});} \ No newline at end of file diff --git a/server/api/notification/notification.events.js b/server/api/notification/notification.events.js index 20f0587..27090aa 100644 --- a/server/api/notification/notification.events.js +++ b/server/api/notification/notification.events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x757a=['../../mysqldb','Notification','remove','emit','hasOwnProperty','hook'];(function(_0x12f8b3,_0x4e2a78){var _0x131881=function(_0x45fa5b){while(--_0x45fa5b){_0x12f8b3['push'](_0x12f8b3['shift']());}};_0x131881(++_0x4e2a78);}(_0x757a,0xde));var _0xa757=function(_0x19921,_0x5a7f8f){_0x19921=_0x19921-0x0;var _0x1201d9=_0x757a[_0x19921];return _0x1201d9;};'use strict';var EventEmitter=require('events');var Notification=require(_0xa757('0x0'))['db'][_0xa757('0x1')];var NotificationEvents=new EventEmitter();NotificationEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0xa757('0x2')};function emitEvent(_0x1721c6){return function(_0x1c2932,_0x453d07,_0x32630d){NotificationEvents[_0xa757('0x3')](_0x1721c6+':'+_0x1c2932['id'],_0x1c2932);NotificationEvents['emit'](_0x1721c6,_0x1c2932);_0x32630d(null);};}for(var e in events){if(events[_0xa757('0x4')](e)){var event=events[e];Notification[_0xa757('0x5')](e,emitEvent(event));}}module['exports']=NotificationEvents; \ No newline at end of file +var _0x5f66=['remove','emit','exports','../../mysqldb','setMaxListeners','save','update'];(function(_0x57336e,_0x5db5b9){var _0x204ae0=function(_0xe65f1b){while(--_0xe65f1b){_0x57336e['push'](_0x57336e['shift']());}};_0x204ae0(++_0x5db5b9);}(_0x5f66,0x1a0));var _0x65f6=function(_0x21a9d9,_0x4d5ac8){_0x21a9d9=_0x21a9d9-0x0;var _0x46adce=_0x5f66[_0x21a9d9];return _0x46adce;};'use strict';var EventEmitter=require('events');var Notification=require(_0x65f6('0x0'))['db']['Notification'];var NotificationEvents=new EventEmitter();NotificationEvents[_0x65f6('0x1')](0x0);var events={'afterCreate':_0x65f6('0x2'),'afterUpdate':_0x65f6('0x3'),'afterDestroy':_0x65f6('0x4')};function emitEvent(_0x1a330c){return function(_0x5eb9ad,_0x3c5029,_0x5150c8){NotificationEvents[_0x65f6('0x5')](_0x1a330c+':'+_0x5eb9ad['id'],_0x5eb9ad);NotificationEvents[_0x65f6('0x5')](_0x1a330c,_0x5eb9ad);_0x5150c8(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];Notification['hook'](e,emitEvent(event));}}module[_0x65f6('0x6')]=NotificationEvents; \ No newline at end of file diff --git a/server/api/notification/notification.model.js b/server/api/notification/notification.model.js index 3bb0c66..fad8dff 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 _0x8603=['util','../../config/logger','api','request-promise','path','rimraf','./notification.attributes','define','Notification','notifications'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0x8603,0x190));var _0x3860=function(_0x321cc3,_0xd7325c){_0x321cc3=_0x321cc3-0x0;var _0x5d4df2=_0x8603[_0x321cc3];return _0x5d4df2;};'use strict';var _=require('lodash');var util=require(_0x3860('0x0'));var logger=require(_0x3860('0x1'))(_0x3860('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x3860('0x3'));var fs=require('fs');var path=require(_0x3860('0x4'));var rimraf=require(_0x3860('0x5'));var config=require('../../config/environment');var attributes=require(_0x3860('0x6'));module['exports']=function(_0xb0fc24,_0x40739b){return _0xb0fc24[_0x3860('0x7')](_0x3860('0x8'),attributes,{'tableName':_0x3860('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0xda3f=['../../config/environment','exports','Notification','notifications','utf8mb4','utf8mb4_unicode_ci','util','../../config/logger','request-promise','rimraf'];(function(_0x1a7bec,_0x31bbd7){var _0x55bf92=function(_0x2de764){while(--_0x2de764){_0x1a7bec['push'](_0x1a7bec['shift']());}};_0x55bf92(++_0x31bbd7);}(_0xda3f,0xec));var _0xfda3=function(_0x6f5206,_0x3d8cfd){_0x6f5206=_0x6f5206-0x0;var _0x1e725c=_0xda3f[_0x6f5206];return _0x1e725c;};'use strict';var _=require('lodash');var util=require(_0xfda3('0x0'));var logger=require(_0xfda3('0x1'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xfda3('0x2'));var fs=require('fs');var path=require('path');var rimraf=require(_0xfda3('0x3'));var config=require(_0xfda3('0x4'));var attributes=require('./notification.attributes');module[_0xfda3('0x5')]=function(_0x43a010,_0x47e7e2){return _0x43a010['define'](_0xfda3('0x6'),attributes,{'tableName':_0xfda3('0x7'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xfda3('0x8'),'collate':_0xfda3('0x9')});}; \ No newline at end of file diff --git a/server/api/notification/notification.rpc.js b/server/api/notification/notification.rpc.js index cb23f4b..afffa53 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 _0x7754=['Notification,\x20%s,\x20%s','request\x20sent','Notification,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','catch','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','socket.io-emitter','redis','./notification.socket','register','request','then'];(function(_0x6942e0,_0x131e6d){var _0xb86490=function(_0x2fd5d7){while(--_0x2fd5d7){_0x6942e0['push'](_0x6942e0['shift']());}};_0xb86490(++_0x131e6d);}(_0x7754,0x189));var _0x4775=function(_0x142ec2,_0x5bb03d){_0x142ec2=_0x142ec2-0x0;var _0x45ef4e=_0x7754[_0x142ec2];return _0x45ef4e;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x4775('0x0'));var BPromise=require('bluebird');var rs=require(_0x4775('0x1'));var fs=require('fs');var Redis=require(_0x4775('0x2'));var db=require(_0x4775('0x3'))['db'];var utils=require(_0x4775('0x4'));var logger=require(_0x4775('0x5'))(_0x4775('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x4775('0x7')][_0x4775('0x8')]({'port':0x232a});config['redis']=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x4775('0x9'))(new Redis(config[_0x4775('0xa')]));require(_0x4775('0xb'))[_0x4775('0xc')](socket);function respondWithRpcPromise(_0x23d808,_0x263b4f,_0x187567){return new BPromise(function(_0x5611e8,_0x53b366){return client[_0x4775('0xd')](_0x23d808,_0x187567)[_0x4775('0xe')](function(_0x13d3d2){logger['info'](_0x4775('0xf'),_0x263b4f,_0x4775('0x10'));logger['debug'](_0x4775('0x11'),_0x263b4f,_0x4775('0x10'),JSON[_0x4775('0x12')](_0x13d3d2));if(_0x13d3d2[_0x4775('0x13')]){if(_0x13d3d2['error']['code']===0x1f4){logger['error']('Notification,\x20%s,\x20%s',_0x263b4f,_0x13d3d2[_0x4775('0x13')][_0x4775('0x14')]);return _0x53b366(_0x13d3d2[_0x4775('0x13')][_0x4775('0x14')]);}logger[_0x4775('0x13')](_0x4775('0xf'),_0x263b4f,_0x13d3d2['error']['message']);return _0x5611e8(_0x13d3d2[_0x4775('0x13')][_0x4775('0x14')]);}else{logger[_0x4775('0x15')](_0x4775('0xf'),_0x263b4f,'request\x20sent');_0x5611e8(_0x13d3d2[_0x4775('0x16')][_0x4775('0x14')]);}})[_0x4775('0x17')](function(_0x3fc6c3){logger['error'](_0x4775('0xf'),_0x263b4f,_0x3fc6c3);_0x53b366(_0x3fc6c3);});});} \ No newline at end of file +var _0x530d=['catch','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','request','info','Notification,\x20%s,\x20%s','request\x20sent','debug','Notification,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result'];(function(_0x303e50,_0x335e8a){var _0x442d97=function(_0x4e61aa){while(--_0x4e61aa){_0x303e50['push'](_0x303e50['shift']());}};_0x442d97(++_0x335e8a);}(_0x530d,0x17b));var _0xd530=function(_0x436634,_0x4fc3fb){_0x436634=_0x436634-0x0;var _0x4cbacd=_0x530d[_0x436634];return _0x4cbacd;};'use strict';var _=require(_0xd530('0x0'));var util=require('util');var moment=require(_0xd530('0x1'));var BPromise=require(_0xd530('0x2'));var rs=require(_0xd530('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xd530('0x4'))['db'];var utils=require(_0xd530('0x5'));var logger=require(_0xd530('0x6'))(_0xd530('0x7'));var config=require(_0xd530('0x8'));var jayson=require(_0xd530('0x9'));var client=jayson[_0xd530('0xa')][_0xd530('0xb')]({'port':0x232a});config[_0xd530('0xc')]=_[_0xd530('0xd')](config['redis'],{'host':_0xd530('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require('./notification.socket')['register'](socket);function respondWithRpcPromise(_0x3fb1c0,_0x219524,_0x22cdc8){return new BPromise(function(_0x234186,_0x1b5e54){return client[_0xd530('0xf')](_0x3fb1c0,_0x22cdc8)['then'](function(_0x58fb85){logger[_0xd530('0x10')](_0xd530('0x11'),_0x219524,_0xd530('0x12'));logger[_0xd530('0x13')](_0xd530('0x14'),_0x219524,'request\x20sent',JSON[_0xd530('0x15')](_0x58fb85));if(_0x58fb85[_0xd530('0x16')]){if(_0x58fb85['error'][_0xd530('0x17')]===0x1f4){logger[_0xd530('0x16')](_0xd530('0x11'),_0x219524,_0x58fb85[_0xd530('0x16')][_0xd530('0x18')]);return _0x1b5e54(_0x58fb85[_0xd530('0x16')][_0xd530('0x18')]);}logger[_0xd530('0x16')](_0xd530('0x11'),_0x219524,_0x58fb85['error'][_0xd530('0x18')]);return _0x234186(_0x58fb85[_0xd530('0x16')]['message']);}else{logger[_0xd530('0x10')](_0xd530('0x11'),_0x219524,_0xd530('0x12'));_0x234186(_0x58fb85[_0xd530('0x19')][_0xd530('0x18')]);}})[_0xd530('0x1a')](function(_0x5be30c){logger[_0xd530('0x16')](_0xd530('0x11'),_0x219524,_0x5be30c);_0x1b5e54(_0x5be30c);});});} \ No newline at end of file diff --git a/server/api/notification/notification.socket.js b/server/api/notification/notification.socket.js index 3297e4d..4f64173 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 _0x2183=['save','remove','update','emit','removeListener','length','./notification.events'];(function(_0xf25f61,_0x2e72b8){var _0x24c68e=function(_0xddabad){while(--_0xddabad){_0xf25f61['push'](_0xf25f61['shift']());}};_0x24c68e(++_0x2e72b8);}(_0x2183,0x1e9));var _0x3218=function(_0xdab2d2,_0x29a184){_0xdab2d2=_0xdab2d2-0x0;var _0x56f37c=_0x2183[_0xdab2d2];return _0x56f37c;};'use strict';var NotificationEvents=require(_0x3218('0x0'));var events=[_0x3218('0x1'),_0x3218('0x2'),_0x3218('0x3')];function createListener(_0x442b10,_0x45b2f7){return function(_0x29645f){_0x45b2f7[_0x3218('0x4')](_0x442b10,_0x29645f);};}function removeListener(_0x5a2acd,_0x4c2c88){return function(){NotificationEvents[_0x3218('0x5')](_0x5a2acd,_0x4c2c88);};}exports['register']=function(_0x40946a){for(var _0x31a077=0x0,_0x50eef1=events[_0x3218('0x6')];_0x31a077<_0x50eef1;_0x31a077++){var _0x5202b6=events[_0x31a077];var _0x778af0=createListener('notification:'+_0x5202b6,_0x40946a);NotificationEvents['on'](_0x5202b6,_0x778af0);}}; \ No newline at end of file +var _0x39da=['notification:','./notification.events','update','removeListener','register','length'];(function(_0x178668,_0x1ec300){var _0x26107d=function(_0x4c0aa8){while(--_0x4c0aa8){_0x178668['push'](_0x178668['shift']());}};_0x26107d(++_0x1ec300);}(_0x39da,0x115));var _0xa39d=function(_0x55f4c3,_0x1e8d70){_0x55f4c3=_0x55f4c3-0x0;var _0x46582c=_0x39da[_0x55f4c3];return _0x46582c;};'use strict';var NotificationEvents=require(_0xa39d('0x0'));var events=['save','remove',_0xa39d('0x1')];function createListener(_0x533867,_0x3c6ec4){return function(_0x3ced4d){_0x3c6ec4['emit'](_0x533867,_0x3ced4d);};}function removeListener(_0x5f552c,_0x41b671){return function(){NotificationEvents[_0xa39d('0x2')](_0x5f552c,_0x41b671);};}exports[_0xa39d('0x3')]=function(_0x43ccdc){for(var _0x413602=0x0,_0x55e850=events[_0xa39d('0x4')];_0x413602<_0x55e850;_0x413602++){var _0x2abfb3=events[_0x413602];var _0x4dec58=createListener(_0xa39d('0x5')+_0x2abfb3,_0x43ccdc);NotificationEvents['on'](_0x2abfb3,_0x4dec58);}}; \ No newline at end of file diff --git a/server/api/openchannelAccount/index.js b/server/api/openchannelAccount/index.js index 6cad5f7..22e9a6c 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 _0xb841=['removeAnswers','removeAgents','exports','multer','connect-timeout','express','../../components/auth/service','../../components/interaction/service','./openchannelAccount.controller','get','isAuthenticated','index','/describe','describe','show','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','getApplications','/:id/interactions','getInteractions','/:id/users','getAgents','create','post','addDisposition','addAnswer','/:id/notify','/:id/applications','addApplications','/:id/send','send','put','/:id','update','destroy','delete'];(function(_0x493e42,_0x2b8d78){var _0x4a3bca=function(_0x12ec18){while(--_0x12ec18){_0x493e42['push'](_0x493e42['shift']());}};_0x4a3bca(++_0x2b8d78);}(_0xb841,0x159));var _0x1b84=function(_0x2b10e7,_0x9837b5){_0x2b10e7=_0x2b10e7-0x0;var _0x3b79b8=_0xb841[_0x2b10e7];return _0x3b79b8;};'use strict';var multer=require(_0x1b84('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x1b84('0x1'));var express=require(_0x1b84('0x2'));var router=express['Router']();var auth=require(_0x1b84('0x3'));var interaction=require(_0x1b84('0x4'));var config=require('../../config/environment');var controller=require(_0x1b84('0x5'));router[_0x1b84('0x6')]('/',auth[_0x1b84('0x7')](),controller[_0x1b84('0x8')]);router[_0x1b84('0x6')](_0x1b84('0x9'),auth['isAuthenticated'](),controller[_0x1b84('0xa')]);router[_0x1b84('0x6')]('/:id',auth[_0x1b84('0x7')](),controller[_0x1b84('0xb')]);router[_0x1b84('0x6')](_0x1b84('0xc'),auth[_0x1b84('0x7')](),controller[_0x1b84('0xd')]);router[_0x1b84('0x6')](_0x1b84('0xe'),auth[_0x1b84('0x7')](),controller[_0x1b84('0xf')]);router[_0x1b84('0x6')]('/:id/applications',auth[_0x1b84('0x7')](),controller[_0x1b84('0x10')]);router[_0x1b84('0x6')](_0x1b84('0x11'),auth[_0x1b84('0x7')](),controller[_0x1b84('0x12')]);router['get'](_0x1b84('0x13'),auth['isAuthenticated'](),controller[_0x1b84('0x14')]);router['post']('/',auth['isAuthenticated'](),controller[_0x1b84('0x15')]);router[_0x1b84('0x16')]('/:id/dispositions',auth[_0x1b84('0x7')](),controller[_0x1b84('0x17')]);router['post'](_0x1b84('0xe'),auth[_0x1b84('0x7')](),controller[_0x1b84('0x18')]);router[_0x1b84('0x16')](_0x1b84('0x19'),controller['notify']);router[_0x1b84('0x16')](_0x1b84('0x1a'),auth[_0x1b84('0x7')](),controller[_0x1b84('0x1b')]);router[_0x1b84('0x16')]('/:id/users',auth[_0x1b84('0x7')](),controller['addAgents']);router[_0x1b84('0x16')](_0x1b84('0x1c'),auth[_0x1b84('0x7')](),controller[_0x1b84('0x1d')]);router[_0x1b84('0x1e')](_0x1b84('0x1f'),auth[_0x1b84('0x7')](),controller[_0x1b84('0x20')]);router['delete']('/:id',auth[_0x1b84('0x7')](),controller[_0x1b84('0x21')]);router[_0x1b84('0x22')](_0x1b84('0xc'),auth[_0x1b84('0x7')](),controller['removeDispositions']);router['delete']('/:id/canned_answers',auth['isAuthenticated'](),controller[_0x1b84('0x23')]);router[_0x1b84('0x22')](_0x1b84('0x13'),auth['isAuthenticated'](),controller[_0x1b84('0x24')]);module[_0x1b84('0x25')]=router; \ No newline at end of file +var _0xd079=['notify','/:id/send','send','put','update','destroy','delete','/:id/dispositions','removeDispositions','removeAnswers','exports','multer','path','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelAccount.controller','index','get','/describe','isAuthenticated','describe','/:id','show','getDispositions','getAnswers','/:id/applications','getApplications','/:id/interactions','getInteractions','/:id/users','getAgents','post','/:id/canned_answers','/:id/notify'];(function(_0x22419f,_0x1ea160){var _0x1e1b68=function(_0x3bb649){while(--_0x3bb649){_0x22419f['push'](_0x22419f['shift']());}};_0x1e1b68(++_0x1ea160);}(_0xd079,0x1bb));var _0x9d07=function(_0x4e020c,_0x46a143){_0x4e020c=_0x4e020c-0x0;var _0x2cec33=_0xd079[_0x4e020c];return _0x2cec33;};'use strict';var multer=require(_0x9d07('0x0'));var util=require('util');var path=require(_0x9d07('0x1'));var timeout=require('connect-timeout');var express=require(_0x9d07('0x2'));var router=express['Router']();var auth=require(_0x9d07('0x3'));var interaction=require(_0x9d07('0x4'));var config=require(_0x9d07('0x5'));var controller=require(_0x9d07('0x6'));router['get']('/',auth['isAuthenticated'](),controller[_0x9d07('0x7')]);router[_0x9d07('0x8')](_0x9d07('0x9'),auth[_0x9d07('0xa')](),controller[_0x9d07('0xb')]);router[_0x9d07('0x8')](_0x9d07('0xc'),auth[_0x9d07('0xa')](),controller[_0x9d07('0xd')]);router['get']('/:id/dispositions',auth[_0x9d07('0xa')](),controller[_0x9d07('0xe')]);router[_0x9d07('0x8')]('/:id/canned_answers',auth[_0x9d07('0xa')](),controller[_0x9d07('0xf')]);router[_0x9d07('0x8')](_0x9d07('0x10'),auth[_0x9d07('0xa')](),controller[_0x9d07('0x11')]);router[_0x9d07('0x8')](_0x9d07('0x12'),auth[_0x9d07('0xa')](),controller[_0x9d07('0x13')]);router[_0x9d07('0x8')](_0x9d07('0x14'),auth[_0x9d07('0xa')](),controller[_0x9d07('0x15')]);router[_0x9d07('0x16')]('/',auth[_0x9d07('0xa')](),controller['create']);router[_0x9d07('0x16')]('/:id/dispositions',auth[_0x9d07('0xa')](),controller['addDisposition']);router[_0x9d07('0x16')](_0x9d07('0x17'),auth['isAuthenticated'](),controller['addAnswer']);router['post'](_0x9d07('0x18'),controller[_0x9d07('0x19')]);router[_0x9d07('0x16')](_0x9d07('0x10'),auth['isAuthenticated'](),controller['addApplications']);router[_0x9d07('0x16')](_0x9d07('0x14'),auth[_0x9d07('0xa')](),controller['addAgents']);router['post'](_0x9d07('0x1a'),auth['isAuthenticated'](),controller[_0x9d07('0x1b')]);router[_0x9d07('0x1c')](_0x9d07('0xc'),auth['isAuthenticated'](),controller[_0x9d07('0x1d')]);router['delete'](_0x9d07('0xc'),auth['isAuthenticated'](),controller[_0x9d07('0x1e')]);router[_0x9d07('0x1f')](_0x9d07('0x20'),auth['isAuthenticated'](),controller[_0x9d07('0x21')]);router[_0x9d07('0x1f')]('/:id/canned_answers',auth['isAuthenticated'](),controller[_0x9d07('0x22')]);router[_0x9d07('0x1f')](_0x9d07('0x14'),auth[_0x9d07('0xa')](),controller['removeAgents']);module[_0x9d07('0x23')]=router; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.attributes.js b/server/api/openchannelAccount/openchannelAccount.attributes.js index 87f8071..693c54c 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 _0x48c1=['INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','setDataValue','exports','STRING','name','generate','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN'];(function(_0x5c4ffe,_0x297f0c){var _0x1808c0=function(_0x5ee93c){while(--_0x5ee93c){_0x5c4ffe['push'](_0x5c4ffe['shift']());}};_0x1808c0(++_0x297f0c);}(_0x48c1,0x191));var _0x148c=function(_0x435044,_0x36ab8e){_0x435044=_0x435044-0x0;var _0x33d4c6=_0x48c1[_0x435044];return _0x33d4c6;};'use strict';var Sequelize=require('sequelize');var rs=require('randomstring');module[_0x148c('0x0')]={'name':{'type':Sequelize[_0x148c('0x1')],'unique':_0x148c('0x2'),'allowNull':![]},'description':{'type':Sequelize['STRING']},'token':{'type':Sequelize[_0x148c('0x1')],'defaultValue':function(){return rs[_0x148c('0x3')]();}},'replyUri':{'type':Sequelize['STRING'],'validate':{'isUrl':!![]}},'key':{'type':Sequelize['STRING'],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0x148c('0x4')],'defaultValue':function(){return _0x148c('0x5');}},'notificationSound':{'type':Sequelize[_0x148c('0x6')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x148c('0x6')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x148c('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'mapKey':{'type':Sequelize[_0x148c('0x1')]},'queueTransfer':{'type':Sequelize[_0x148c('0x6')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x148c('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x148c('0x6')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x148c('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'allowNull':!![],'defaultValue':null,'comment':_0x148c('0x8')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0x148c('0x9'),'set':function(_0x2f71be){if(!_0x2f71be)this['setDataValue'](_0x148c('0xa'),null);this[_0x148c('0xb')]('mandatoryDisposition',_0x2f71be);}}}; \ No newline at end of file +var _0x4f0f=['setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','randomstring','exports','STRING','name','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'];(function(_0x13d07a,_0x41efc3){var _0x5ee0ee=function(_0x4ca94a){while(--_0x4ca94a){_0x13d07a['push'](_0x13d07a['shift']());}};_0x5ee0ee(++_0x41efc3);}(_0x4f0f,0xff));var _0xf4f0=function(_0x2ea4bc,_0xa49f8f){_0x2ea4bc=_0x2ea4bc-0x0;var _0x29dfe2=_0x4f0f[_0x2ea4bc];return _0x29dfe2;};'use strict';var Sequelize=require(_0xf4f0('0x0'));var rs=require(_0xf4f0('0x1'));module[_0xf4f0('0x2')]={'name':{'type':Sequelize[_0xf4f0('0x3')],'unique':_0xf4f0('0x4'),'allowNull':![]},'description':{'type':Sequelize[_0xf4f0('0x3')]},'token':{'type':Sequelize[_0xf4f0('0x3')],'defaultValue':function(){return rs[_0xf4f0('0x5')]();}},'replyUri':{'type':Sequelize[_0xf4f0('0x3')],'validate':{'isUrl':!![]}},'key':{'type':Sequelize['STRING'],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0xf4f0('0x6')],'defaultValue':function(){return _0xf4f0('0x7');}},'notificationSound':{'type':Sequelize[_0xf4f0('0x8')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xf4f0('0x8')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'mapKey':{'type':Sequelize['STRING']},'queueTransfer':{'type':Sequelize[_0xf4f0('0x8')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xf4f0('0x9')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xf4f0('0x8')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0xf4f0('0x9')],'allowNull':!![],'defaultValue':null,'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0xf4f0('0xa'),'set':function(_0x39963f){if(!_0x39963f)this[_0xf4f0('0xb')](_0xf4f0('0xc'),null);this[_0xf4f0('0xb')](_0xf4f0('0xd'),_0x39963f);}}}; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.controller.js b/server/api/openchannelAccount/openchannelAccount.controller.js index 09c064c..04e0ba4 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 _0x36dc=['limit','set','Content-Range','apply','reject','save','destroy','get','OpenchannelAccounts','UserProfileResource','end','name','send','index','Pause','mandatoryDispositionPause','OpenchannelAccount','rawAttributes','key','model','map','query','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','includeAll','include','rows','show','params','keys','length','find','create','user','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','body','describe','addDisposition','OpnechannelAccountId','Disposition','getDispositions','findOne','options','findAll','removeDispositions','ids','OpenchannelAccountId','CannedAnswer','getAnswers','removeAnswers','notify','openchannel','CmContact','difference','updatedAt','ListId','isNil','from','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','Contacts','DESC','Applications','List','applications','priority','asc','account','contact','firstName','lastName','threadId','OpenchannelInteraction','externalUrl','ContactId','spread','messageId','interaction','created','autoclose','push','close','unmanaged','*,*,*,*','OpenchannelMessage','AttachmentId','UserId','User','unshift','waitForTheAssignedAgent','forcedOwnership','Start','startRouting','EventManager','addApplications','transaction','OpenchannelApplication','bulkCreate','findAndCountAll','getApplications','getInteractions','Contact','Owner','internal','Tag','Tags','color','tag','addAgents','emit','userOpenchannelAccount:save','removeAgents','isArray','userOpenchannelAccount:remove','getAgents','CmList','dataValues','Messages','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','client','http','Sequelize','ValidationError','request','then','info','OpenchannelAccount,\x20%s,\x20%s','OpenchannelAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','catch','sendStatus','json','count','offset'];(function(_0x50dadb,_0x116142){var _0x3838ee=function(_0x595aaf){while(--_0x595aaf){_0x50dadb['push'](_0x50dadb['shift']());}};_0x3838ee(++_0x116142);}(_0x36dc,0x87));var _0xc36d=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x36dc[_0x321bb2];return _0x9c12ed;};'use strict';var pdf=require(_0xc36d('0x0'));var emlformat=require(_0xc36d('0x1'));var rimraf=require(_0xc36d('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0xc36d('0x3'));var rp=require(_0xc36d('0x4'));var moment=require(_0xc36d('0x5'));var BPromise=require(_0xc36d('0x6'));var Mustache=require(_0xc36d('0x7'));var util=require(_0xc36d('0x8'));var path=require(_0xc36d('0x9'));var sox=require('sox');var csv=require(_0xc36d('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xc36d('0xb'));var squel=require(_0xc36d('0xc'));var crypto=require(_0xc36d('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xc36d('0xe'));var toCsv=require('to-csv');var querystring=require(_0xc36d('0xf'));var Papa=require(_0xc36d('0x10'));var Redis=require(_0xc36d('0x11'));var authService=require(_0xc36d('0x12'));var qs=require(_0xc36d('0x13'));var as=require(_0xc36d('0x14'));var hardwareService=require(_0xc36d('0x15'));var logger=require(_0xc36d('0x16'))(_0xc36d('0x17'));var utils=require(_0xc36d('0x18'));var config=require(_0xc36d('0x19'));var db=require(_0xc36d('0x1a'))['db'];config[_0xc36d('0x1b')]=_[_0xc36d('0x1c')](config[_0xc36d('0x1b')],{'host':_0xc36d('0x1d'),'port':0x18eb});var socket=require(_0xc36d('0x1e'))(new Redis(config[_0xc36d('0x1b')]));require('./openchannelAccount.socket')['register'](socket);var jayson=require('jayson/promise');var client=jayson[_0xc36d('0x1f')][_0xc36d('0x20')]({'port':0x232c});var client9002=jayson[_0xc36d('0x1f')][_0xc36d('0x20')]({'port':0x232a});function checkPasswordPattern(_0x5200b4,_0x21c545,_0x31f58b){if(_0x31f58b){var _0x47ffda=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x47ffda['test'](_0x21c545)){return _0x5200b4;}else{throw new db[(_0xc36d('0x21'))][(_0xc36d('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 _0x5200b4;}}function respondWithRpcPromise(_0x1b62d7,_0x186655,_0x5856de,_0x2b1afe){return new BPromise(function(_0x55536d,_0x32703d){var _0xac58bc=_0x2b1afe||client;return _0xac58bc[_0xc36d('0x23')](_0x1b62d7,_0x5856de)[_0xc36d('0x24')](function(_0x48eab5){logger[_0xc36d('0x25')](_0xc36d('0x26'),_0x186655,'request\x20sent');logger['debug'](_0xc36d('0x27'),_0x186655,_0xc36d('0x28'),JSON[_0xc36d('0x29')](_0x48eab5));if(_0x48eab5[_0xc36d('0x2a')]){if(_0x48eab5[_0xc36d('0x2a')]['code']===0x1f4){logger[_0xc36d('0x2a')](_0xc36d('0x26'),_0x186655,_0x48eab5[_0xc36d('0x2a')][_0xc36d('0x2b')]);return _0x32703d(_0x48eab5[_0xc36d('0x2a')][_0xc36d('0x2b')]);}logger[_0xc36d('0x2a')]('OpenchannelAccount,\x20%s,\x20%s',_0x186655,_0x48eab5[_0xc36d('0x2a')][_0xc36d('0x2b')]);return _0x55536d(_0x48eab5[_0xc36d('0x2a')]['message']);}else{logger['info'](_0xc36d('0x26'),_0x186655,_0xc36d('0x28'));_0x55536d(_0x48eab5['result'][_0xc36d('0x2b')]);}})[_0xc36d('0x2c')](function(_0x26379f){logger[_0xc36d('0x2a')](_0xc36d('0x26'),_0x186655,_0x26379f);_0x32703d(_0x26379f);});});}function respondWithStatusCode(_0x2b7178,_0x4a6263){_0x4a6263=_0x4a6263||0xcc;return function(_0x528fcd){if(_0x528fcd){return _0x2b7178[_0xc36d('0x2d')](_0x4a6263);}return _0x2b7178['status'](_0x4a6263)['end']();};}function respondWithResult(_0x293181,_0x49ec5b){_0x49ec5b=_0x49ec5b||0xc8;return function(_0x1ac7ee){if(_0x1ac7ee){return _0x293181['status'](_0x49ec5b)[_0xc36d('0x2e')](_0x1ac7ee);}};}function respondWithFilteredResult(_0x33b82e,_0x18371e){return function(_0xd6e57d){if(_0xd6e57d){var _0x563731=_0xd6e57d[_0xc36d('0x2f')],_0x5bcb6e=_0x18371e[_0xc36d('0x30')],_0x1ac392=_0x18371e['offset']+_0x18371e[_0xc36d('0x31')],_0x17e706;if(_0x1ac392>=_0x563731){_0x1ac392=_0x563731;_0x17e706=0xc8;}else{_0x17e706=0xce;}_0x33b82e['status'](_0x17e706);return _0x33b82e[_0xc36d('0x32')](_0xc36d('0x33'),_0x5bcb6e+'-'+_0x1ac392+'/'+_0x563731)[_0xc36d('0x2e')](_0xd6e57d);}return null;};}function patchUpdates(_0x3bd7be){return function(_0x44fc7e){try{jsonpatch[_0xc36d('0x34')](_0x44fc7e,_0x3bd7be,!![]);}catch(_0xa659ee){return BPromise[_0xc36d('0x35')](_0xa659ee);}return _0x44fc7e[_0xc36d('0x36')]();};}function saveUpdates(_0x1f6c23,_0x32fb41){return function(_0x1885b3){if(_0x1885b3){return _0x1885b3['update'](_0x1f6c23)[_0xc36d('0x24')](function(_0x30731e){return _0x30731e;});}return null;};}function removeEntity(_0x34a5e1,_0x4cdb41){return function(_0x51817d){if(_0x51817d){return _0x51817d[_0xc36d('0x37')]()['then'](function(){var _0x1ef98b=_0x51817d[_0xc36d('0x38')]({'plain':!![]});var _0x314662=_0xc36d('0x39');return db[_0xc36d('0x3a')][_0xc36d('0x37')]({'where':{'type':_0x314662,'resourceId':_0x1ef98b['id']}})[_0xc36d('0x24')](function(){return _0x51817d;});})[_0xc36d('0x24')](function(){_0x34a5e1['status'](0xcc)[_0xc36d('0x3b')]();});}};}function handleEntityNotFound(_0x1eb5d6,_0x22f177){return function(_0x4448d6){if(!_0x4448d6){_0x1eb5d6[_0xc36d('0x2d')](0x194);}return _0x4448d6;};}function handleError(_0x5719c3,_0xf75d3f){_0xf75d3f=_0xf75d3f||0x1f4;return function(_0x16b5df){logger[_0xc36d('0x2a')](_0x16b5df['stack']);if(_0x16b5df[_0xc36d('0x3c')]){delete _0x16b5df['name'];}_0x5719c3['status'](_0xf75d3f)[_0xc36d('0x3d')](_0x16b5df);};}exports[_0xc36d('0x3e')]=function(_0x5a290c,_0xb8a5b){var _0x2990cb={'include':[{'model':db[_0xc36d('0x3f')],'as':_0xc36d('0x40')}]},_0xabc857={},_0x7dc2b0={'count':0x0,'rows':[]};var _0x186c6b=_['map'](db[_0xc36d('0x41')][_0xc36d('0x42')],function(_0xb2ab2b){return{'name':_0xb2ab2b['fieldName'],'type':_0xb2ab2b['type'][_0xc36d('0x43')]};});_0xabc857[_0xc36d('0x44')]=_[_0xc36d('0x45')](_0x186c6b,'name');_0xabc857[_0xc36d('0x46')]=_['keys'](_0x5a290c[_0xc36d('0x46')]);_0xabc857[_0xc36d('0x47')]=_[_0xc36d('0x48')](_0xabc857[_0xc36d('0x44')],_0xabc857[_0xc36d('0x46')]);_0x2990cb['attributes']=_['intersection'](_0xabc857['model'],qs[_0xc36d('0x49')](_0x5a290c[_0xc36d('0x46')][_0xc36d('0x49')]));_0x2990cb[_0xc36d('0x4a')]=_0x2990cb[_0xc36d('0x4a')]['length']?_0x2990cb['attributes']:_0xabc857[_0xc36d('0x44')];if(!_0x5a290c[_0xc36d('0x46')][_0xc36d('0x4b')](_0xc36d('0x4c'))){_0x2990cb[_0xc36d('0x31')]=qs[_0xc36d('0x31')](_0x5a290c[_0xc36d('0x46')][_0xc36d('0x31')]);_0x2990cb[_0xc36d('0x30')]=qs['offset'](_0x5a290c['query']['offset']);}_0x2990cb[_0xc36d('0x4d')]=qs[_0xc36d('0x4e')](_0x5a290c[_0xc36d('0x46')][_0xc36d('0x4e')]);_0x2990cb[_0xc36d('0x4f')]=qs[_0xc36d('0x47')](_[_0xc36d('0x50')](_0x5a290c[_0xc36d('0x46')],_0xabc857['filters']),_0x186c6b);if(_0x5a290c['query'][_0xc36d('0x51')]){_0x2990cb['where']=_[_0xc36d('0x52')](_0x2990cb[_0xc36d('0x4f')],{'$or':_['map'](_0x186c6b,function(_0x220869){if(_0x220869[_0xc36d('0x53')]!==_0xc36d('0x54')){var _0x160ecb={};_0x160ecb[_0x220869['name']]={'$like':'%'+_0x5a290c[_0xc36d('0x46')][_0xc36d('0x51')]+'%'};return _0x160ecb;}})});}_0x2990cb=_[_0xc36d('0x52')]({},_0x2990cb,_0x5a290c['options']);var _0x257100={'where':_0x2990cb[_0xc36d('0x4f')]};return db[_0xc36d('0x41')][_0xc36d('0x2f')](_0x257100)[_0xc36d('0x24')](function(_0x569532){_0x7dc2b0['count']=_0x569532;if(_0x5a290c[_0xc36d('0x46')][_0xc36d('0x55')]){_0x2990cb[_0xc36d('0x56')]=[{'all':!![]}];}return db[_0xc36d('0x41')]['findAll'](_0x2990cb);})['then'](function(_0x1e46d7){_0x7dc2b0[_0xc36d('0x57')]=_0x1e46d7;return _0x7dc2b0;})[_0xc36d('0x24')](respondWithFilteredResult(_0xb8a5b,_0x2990cb))[_0xc36d('0x2c')](handleError(_0xb8a5b,null));};exports[_0xc36d('0x58')]=function(_0x14a7ba,_0x45bb4f){var _0x22f1e7={'raw':![],'where':{'id':_0x14a7ba[_0xc36d('0x59')]['id']},'include':[{'model':db[_0xc36d('0x3f')],'as':'mandatoryDispositionPause'}]},_0x5f0bba={};_0x5f0bba[_0xc36d('0x44')]=_[_0xc36d('0x5a')](db[_0xc36d('0x41')][_0xc36d('0x42')]);_0x5f0bba[_0xc36d('0x46')]=_[_0xc36d('0x5a')](_0x14a7ba['query']);_0x5f0bba['filters']=_[_0xc36d('0x48')](_0x5f0bba[_0xc36d('0x44')],_0x5f0bba['query']);_0x22f1e7['attributes']=_[_0xc36d('0x48')](_0x5f0bba['model'],qs['fields'](_0x14a7ba[_0xc36d('0x46')][_0xc36d('0x49')]));_0x22f1e7[_0xc36d('0x4a')]=_0x22f1e7['attributes'][_0xc36d('0x5b')]?_0x22f1e7[_0xc36d('0x4a')]:_0x5f0bba['model'];if(_0x14a7ba[_0xc36d('0x46')]['includeAll']){_0x22f1e7[_0xc36d('0x56')]=[{'all':!![]}];}_0x22f1e7=_[_0xc36d('0x52')]({},_0x22f1e7,_0x14a7ba['options']);return db[_0xc36d('0x41')][_0xc36d('0x5c')](_0x22f1e7)[_0xc36d('0x24')](handleEntityNotFound(_0x45bb4f,null))[_0xc36d('0x24')](respondWithResult(_0x45bb4f,null))[_0xc36d('0x2c')](handleError(_0x45bb4f,null));};exports[_0xc36d('0x5d')]=function(_0x14510d,_0x54ae23){return db[_0xc36d('0x41')][_0xc36d('0x5d')](_0x14510d['body'],{})[_0xc36d('0x24')](function(_0x49fdb6){var _0x223e03=_0x14510d[_0xc36d('0x5e')][_0xc36d('0x38')]({'plain':!![]});if(!_0x223e03)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x223e03['role']==='user'){var _0x446d3d=_0x49fdb6['get']({'plain':!![]});var _0x240b2a=_0xc36d('0x39');return db[_0xc36d('0x5f')]['find']({'where':{'name':_0x240b2a,'userProfileId':_0x223e03[_0xc36d('0x60')]},'raw':!![]})[_0xc36d('0x24')](function(_0x1715cc){if(_0x1715cc&&_0x1715cc['autoAssociation']===0x0){return db[_0xc36d('0x3a')][_0xc36d('0x5d')]({'name':_0x446d3d[_0xc36d('0x3c')],'resourceId':_0x446d3d['id'],'type':_0x1715cc['name'],'sectionId':_0x1715cc['id']},{})[_0xc36d('0x24')](function(){return _0x49fdb6;});}else{return _0x49fdb6;}})[_0xc36d('0x2c')](function(_0xd1c705){logger[_0xc36d('0x2a')](_0xc36d('0x61'),_0xd1c705);throw _0xd1c705;});}return _0x49fdb6;})[_0xc36d('0x24')](respondWithResult(_0x54ae23,0xc9))[_0xc36d('0x2c')](handleError(_0x54ae23,null));};exports[_0xc36d('0x62')]=function(_0x546ab5,_0x1f9d59){if(_0x546ab5[_0xc36d('0x63')]['id']){delete _0x546ab5['body']['id'];}return db[_0xc36d('0x41')][_0xc36d('0x5c')]({'where':{'id':_0x546ab5['params']['id']},'include':[{'model':db[_0xc36d('0x3f')],'as':'mandatoryDispositionPause'}]})['then'](handleEntityNotFound(_0x1f9d59,null))[_0xc36d('0x24')](saveUpdates(_0x546ab5[_0xc36d('0x63')],null))['then'](respondWithResult(_0x1f9d59,null))[_0xc36d('0x2c')](handleError(_0x1f9d59,null));};exports[_0xc36d('0x37')]=function(_0x3f2fc8,_0x24aca0){return db[_0xc36d('0x41')][_0xc36d('0x5c')]({'where':{'id':_0x3f2fc8['params']['id']}})[_0xc36d('0x24')](handleEntityNotFound(_0x24aca0,null))[_0xc36d('0x24')](removeEntity(_0x24aca0,null))[_0xc36d('0x2c')](handleError(_0x24aca0,null));};exports[_0xc36d('0x64')]=function(_0x1476af,_0x44ff64){return db['OpenchannelAccount']['describe']()[_0xc36d('0x24')](respondWithResult(_0x44ff64,null))[_0xc36d('0x2c')](handleError(_0x44ff64,null));};exports[_0xc36d('0x65')]=function(_0x56b8e3,_0x199ae4,_0x438959){if(_0x56b8e3[_0xc36d('0x63')]['id']){delete _0x56b8e3[_0xc36d('0x63')]['id'];}return db['OpenchannelAccount'][_0xc36d('0x5c')]({'where':{'id':_0x56b8e3[_0xc36d('0x59')]['id']}})[_0xc36d('0x24')](handleEntityNotFound(_0x199ae4,null))['then'](function(_0x49b05d){if(_0x49b05d){_0x56b8e3[_0xc36d('0x63')][_0xc36d('0x66')]=_0x49b05d['id'];return db[_0xc36d('0x67')]['create'](_0x56b8e3[_0xc36d('0x63')]);}})[_0xc36d('0x24')](respondWithResult(_0x199ae4,null))['catch'](handleError(_0x199ae4,null));};exports[_0xc36d('0x68')]=function(_0x3ee9fe,_0x5d706f,_0x4d4e68){var _0x49da1f={'raw':![],'where':{}};var _0x42d11f={};var _0x43bc85={'count':0x0,'rows':[]};return db[_0xc36d('0x41')][_0xc36d('0x69')]({'where':{'id':_0x3ee9fe[_0xc36d('0x59')]['id']}})[_0xc36d('0x24')](handleEntityNotFound(_0x5d706f,null))['then'](function(_0x12b55e){if(_0x12b55e){_0x42d11f[_0xc36d('0x44')]=_[_0xc36d('0x5a')](db['Disposition'][_0xc36d('0x42')]);_0x42d11f[_0xc36d('0x46')]=_[_0xc36d('0x5a')](_0x3ee9fe[_0xc36d('0x46')]);_0x42d11f['filters']=_[_0xc36d('0x48')](_0x42d11f[_0xc36d('0x44')],_0x42d11f[_0xc36d('0x46')]);_0x49da1f[_0xc36d('0x4a')]=_[_0xc36d('0x48')](_0x42d11f[_0xc36d('0x44')],qs[_0xc36d('0x49')](_0x3ee9fe[_0xc36d('0x46')][_0xc36d('0x49')]));_0x49da1f[_0xc36d('0x4a')]=_0x49da1f[_0xc36d('0x4a')][_0xc36d('0x5b')]?_0x49da1f[_0xc36d('0x4a')]:_0x42d11f[_0xc36d('0x44')];if(!_0x3ee9fe[_0xc36d('0x46')][_0xc36d('0x4b')](_0xc36d('0x4c'))){_0x49da1f[_0xc36d('0x31')]=qs[_0xc36d('0x31')](_0x3ee9fe[_0xc36d('0x46')][_0xc36d('0x31')]);_0x49da1f[_0xc36d('0x30')]=qs[_0xc36d('0x30')](_0x3ee9fe[_0xc36d('0x46')][_0xc36d('0x30')]);}_0x49da1f[_0xc36d('0x4d')]=qs[_0xc36d('0x4e')](_0x3ee9fe['query'][_0xc36d('0x4e')]);_0x49da1f[_0xc36d('0x4f')]=qs[_0xc36d('0x47')](_['pick'](_0x3ee9fe[_0xc36d('0x46')],_0x42d11f['filters']));_0x49da1f['where']['OpenchannelAccountId']=_0x12b55e['id'];if(_0x3ee9fe[_0xc36d('0x46')][_0xc36d('0x51')]){_0x49da1f[_0xc36d('0x4f')]=_['merge'](_0x49da1f[_0xc36d('0x4f')],{'$or':_['map'](_0x49da1f[_0xc36d('0x4a')],function(_0x482148){var _0x17ff05={};_0x17ff05[_0x482148]={'$like':'%'+_0x3ee9fe[_0xc36d('0x46')]['filter']+'%'};return _0x17ff05;})});}_0x49da1f=_[_0xc36d('0x52')]({},_0x49da1f,_0x3ee9fe[_0xc36d('0x6a')]);return db[_0xc36d('0x67')][_0xc36d('0x2f')]({'where':_0x49da1f[_0xc36d('0x4f')]})[_0xc36d('0x24')](function(_0x202ecc){_0x43bc85['count']=_0x202ecc;if(_0x3ee9fe[_0xc36d('0x46')]['includeAll']){_0x49da1f['include']=[{'all':!![]}];}return db[_0xc36d('0x67')][_0xc36d('0x6b')](_0x49da1f);})[_0xc36d('0x24')](function(_0x4e3631){_0x43bc85[_0xc36d('0x57')]=_0x4e3631;return _0x43bc85;});}})['then'](respondWithFilteredResult(_0x5d706f,_0x49da1f))[_0xc36d('0x2c')](handleError(_0x5d706f,null));};exports[_0xc36d('0x6c')]=function(_0x23402e,_0x479ef7,_0x3e22e2){return db[_0xc36d('0x41')][_0xc36d('0x5c')]({'where':{'id':_0x23402e[_0xc36d('0x59')]['id']}})[_0xc36d('0x24')](handleEntityNotFound(_0x479ef7,null))[_0xc36d('0x24')](function(_0x583ab1){if(_0x583ab1){return _0x583ab1[_0xc36d('0x6c')](_0x23402e[_0xc36d('0x46')][_0xc36d('0x6d')]);}})['then'](respondWithStatusCode(_0x479ef7,null))[_0xc36d('0x2c')](handleError(_0x479ef7,null));};exports['addAnswer']=function(_0xf3a17b,_0x4bb597,_0x4e523a){if(_0xf3a17b[_0xc36d('0x63')]['id']){delete _0xf3a17b['body']['id'];}return db['OpenchannelAccount']['find']({'where':{'id':_0xf3a17b[_0xc36d('0x59')]['id']}})[_0xc36d('0x24')](handleEntityNotFound(_0x4bb597,null))[_0xc36d('0x24')](function(_0xc9463f){if(_0xc9463f){_0xf3a17b[_0xc36d('0x63')][_0xc36d('0x6e')]=_0xc9463f['id'];return db[_0xc36d('0x6f')][_0xc36d('0x5d')](_0xf3a17b[_0xc36d('0x63')]);}})[_0xc36d('0x24')](respondWithResult(_0x4bb597,null))[_0xc36d('0x2c')](handleError(_0x4bb597,null));};exports[_0xc36d('0x70')]=function(_0xd78d99,_0x2a9d21,_0xe72cc8){var _0x5c10bf={'raw':![],'where':{}};var _0x398d8d={};var _0x78fe53={'count':0x0,'rows':[]};return db['OpenchannelAccount'][_0xc36d('0x69')]({'where':{'id':_0xd78d99[_0xc36d('0x59')]['id']}})[_0xc36d('0x24')](handleEntityNotFound(_0x2a9d21,null))[_0xc36d('0x24')](function(_0x2f2ffb){if(_0x2f2ffb){_0x398d8d[_0xc36d('0x44')]=_[_0xc36d('0x5a')](db[_0xc36d('0x6f')][_0xc36d('0x42')]);_0x398d8d[_0xc36d('0x46')]=_['keys'](_0xd78d99[_0xc36d('0x46')]);_0x398d8d['filters']=_[_0xc36d('0x48')](_0x398d8d[_0xc36d('0x44')],_0x398d8d['query']);_0x5c10bf['attributes']=_['intersection'](_0x398d8d[_0xc36d('0x44')],qs[_0xc36d('0x49')](_0xd78d99[_0xc36d('0x46')][_0xc36d('0x49')]));_0x5c10bf[_0xc36d('0x4a')]=_0x5c10bf[_0xc36d('0x4a')][_0xc36d('0x5b')]?_0x5c10bf['attributes']:_0x398d8d[_0xc36d('0x44')];if(!_0xd78d99['query']['hasOwnProperty'](_0xc36d('0x4c'))){_0x5c10bf['limit']=qs[_0xc36d('0x31')](_0xd78d99['query'][_0xc36d('0x31')]);_0x5c10bf[_0xc36d('0x30')]=qs[_0xc36d('0x30')](_0xd78d99[_0xc36d('0x46')][_0xc36d('0x30')]);}_0x5c10bf['order']=qs[_0xc36d('0x4e')](_0xd78d99[_0xc36d('0x46')][_0xc36d('0x4e')]);_0x5c10bf[_0xc36d('0x4f')]=qs['filters'](_[_0xc36d('0x50')](_0xd78d99[_0xc36d('0x46')],_0x398d8d[_0xc36d('0x47')]));_0x5c10bf[_0xc36d('0x4f')][_0xc36d('0x6e')]=_0x2f2ffb['id'];if(_0xd78d99['query'][_0xc36d('0x51')]){_0x5c10bf['where']=_['merge'](_0x5c10bf['where'],{'$or':_[_0xc36d('0x45')](_0x5c10bf[_0xc36d('0x4a')],function(_0x225fd6){var _0x2b5b52={};_0x2b5b52[_0x225fd6]={'$like':'%'+_0xd78d99['query']['filter']+'%'};return _0x2b5b52;})});}_0x5c10bf=_[_0xc36d('0x52')]({},_0x5c10bf,_0xd78d99[_0xc36d('0x6a')]);return db['CannedAnswer'][_0xc36d('0x2f')]({'where':_0x5c10bf['where']})['then'](function(_0x101ac3){_0x78fe53[_0xc36d('0x2f')]=_0x101ac3;if(_0xd78d99[_0xc36d('0x46')][_0xc36d('0x55')]){_0x5c10bf[_0xc36d('0x56')]=[{'all':!![]}];}return db[_0xc36d('0x6f')]['findAll'](_0x5c10bf);})['then'](function(_0x418226){_0x78fe53['rows']=_0x418226;return _0x78fe53;});}})[_0xc36d('0x24')](respondWithFilteredResult(_0x2a9d21,_0x5c10bf))[_0xc36d('0x2c')](handleError(_0x2a9d21,null));};exports['removeAnswers']=function(_0x2eadf0,_0x46f973,_0x1edffe){return db[_0xc36d('0x41')][_0xc36d('0x5c')]({'where':{'id':_0x2eadf0['params']['id']}})['then'](handleEntityNotFound(_0x46f973,null))[_0xc36d('0x24')](function(_0x20ef2c){if(_0x20ef2c){return _0x20ef2c[_0xc36d('0x71')](_0x2eadf0[_0xc36d('0x46')]['ids']);}})['then'](respondWithStatusCode(_0x46f973,null))[_0xc36d('0x2c')](handleError(_0x46f973,null));};exports[_0xc36d('0x72')]=function(_0x216741,_0x2ffb0d,_0x5554df){var _0x10bfd2={'body':_0x216741[_0xc36d('0x63')],'channel':_0xc36d('0x73')};var _0x4efc92=[];var _0x465308=[];var _0x1a40b8={};var _0x26ce84=![];return db[_0xc36d('0x74')][_0xc36d('0x64')]()[_0xc36d('0x24')](function(_0x152375){if(!_0x152375){throw new db['Sequelize']['ValidationError']('no\x20available\x20attributes');}_0x4efc92=_['difference'](_[_0xc36d('0x5a')](_0x152375),['createdAt','updatedAt']);_0x465308=_[_0xc36d('0x75')](_[_0xc36d('0x5a')](_0x152375),['createdAt',_0xc36d('0x76'),'CompanyId',_0xc36d('0x77')]);if(_0x216741[_0xc36d('0x63')]['id']){delete _0x216741['body']['id'];}if(_[_0xc36d('0x78')](_0x216741['body'][_0xc36d('0x79')])){throw new db['Sequelize'][(_0xc36d('0x22'))]('from\x20is\x20mandatory');}if(_[_0xc36d('0x78')](_0x216741[_0xc36d('0x63')][_0xc36d('0x63')])||_0x216741[_0xc36d('0x63')]['body']===''){throw new db[(_0xc36d('0x21'))][(_0xc36d('0x22'))](_0xc36d('0x7a'));}if(_[_0xc36d('0x78')](_0x216741[_0xc36d('0x63')][_0xc36d('0x7b')])){throw new db[(_0xc36d('0x21'))]['ValidationError']('mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x465308);}if(!_[_0xc36d('0x7c')](_0x465308,_0x216741[_0xc36d('0x63')]['mapKey'])){throw new db[(_0xc36d('0x21'))]['ValidationError'](_0xc36d('0x7d')+_0x465308);}_0x1a40b8[_0x216741['body']['mapKey']]=_0x216741[_0xc36d('0x63')][_0xc36d('0x79')];})[_0xc36d('0x24')](function(){return db[_0xc36d('0x41')][_0xc36d('0x5c')]({'where':{'id':_0x216741[_0xc36d('0x59')]['id']},'include':[{'model':db['CmList'],'as':'List','include':[{'model':db['CmContact'],'as':_0xc36d('0x7e'),'where':_0x1a40b8,'limit':0x1,'order':[['updatedAt',_0xc36d('0x7f')]]}]},{'model':db['OpenchannelApplication'],'as':_0xc36d('0x80')}]});})[_0xc36d('0x24')](handleEntityNotFound(_0x2ffb0d,null))[_0xc36d('0x24')](function(_0x2595ce){if(_0x2595ce&&_0x2595ce[_0xc36d('0x81')]){_0x10bfd2['account']=_0x2595ce;_0x10bfd2[_0xc36d('0x82')]=_0x2595ce['Applications'];_0x10bfd2['list']=_0x2595ce['List'];_0x10bfd2[_0xc36d('0x82')]=_['orderBy'](_0x10bfd2[_0xc36d('0x82')],[_0xc36d('0x83')],[_0xc36d('0x84')]);if(_0x10bfd2[_0xc36d('0x85')][_0xc36d('0x80')]){delete _0x10bfd2[_0xc36d('0x85')][_0xc36d('0x80')];}if(_0x10bfd2[_0xc36d('0x85')]['List']&&_0x10bfd2[_0xc36d('0x85')]['List'][_0xc36d('0x7e')][_0xc36d('0x5b')]){return _0x10bfd2['account'][_0xc36d('0x81')][_0xc36d('0x7e')][0x0];}var _0x51ec4a=_[_0xc36d('0x1c')](_0x216741[_0xc36d('0x63')],{'firstName':_0x216741[_0xc36d('0x63')][_0xc36d('0x79')],'ListId':_0x2595ce[_0xc36d('0x77')]});_0x51ec4a[_0x216741[_0xc36d('0x63')][_0xc36d('0x7b')]]=_0x216741[_0xc36d('0x63')][_0xc36d('0x79')];return db[_0xc36d('0x74')][_0xc36d('0x5d')](_0x51ec4a,{'fields':_0x4efc92,'raw':!![]});}})[_0xc36d('0x24')](handleEntityNotFound(_0x2ffb0d,null))[_0xc36d('0x24')](function(_0x36352e){_0x10bfd2[_0xc36d('0x86')]=_0x36352e;if(_0x36352e){var _0x2493e1={'ContactId':_0x36352e['id'],'OpenchannelAccountId':_0x216741[_0xc36d('0x59')]['id'],'from':(_0x36352e[_0xc36d('0x87')]||'')+'\x20'+(_0x36352e[_0xc36d('0x88')]||'')};var _0x56dad2={'OpenchannelAccountId':_0x216741[_0xc36d('0x59')]['id'],'closed':![]};if(_0x216741[_0xc36d('0x63')][_0xc36d('0x89')]){_0x56dad2[_0xc36d('0x89')]=_0x216741[_0xc36d('0x63')]['threadId'];return db[_0xc36d('0x8a')]['find']({'where':_0x56dad2})[_0xc36d('0x24')](function(_0x1aef95){if(_0x1aef95){return[_0x1aef95,![]];}_0x2493e1[_0xc36d('0x89')]=_0x216741[_0xc36d('0x63')][_0xc36d('0x89')];_0x2493e1[_0xc36d('0x8b')]=_0x216741[_0xc36d('0x63')][_0xc36d('0x8b')];return db[_0xc36d('0x8a')][_0xc36d('0x5d')](_0x2493e1)[_0xc36d('0x24')](function(_0x586c01){return[_0x586c01,!![]];});});}else{_0x56dad2[_0xc36d('0x89')]=null;}_0x56dad2[_0xc36d('0x8c')]=_0x36352e['id'];return db[_0xc36d('0x8a')][_0xc36d('0x5c')]({'where':_0x56dad2})['then'](function(_0x5bbbf4){if(_0x5bbbf4){return[_0x5bbbf4,![]];}return db[_0xc36d('0x8a')]['create'](_0x2493e1)[_0xc36d('0x24')](function(_0x3cd70d){return[_0x3cd70d,!![]];});});}})[_0xc36d('0x8d')](function(_0x205d88,_0x485ce6){if(_0x205d88){_0x26ce84=_0x485ce6;if(!_0x485ce6){var _0x25d26b={'from':(_0x10bfd2[_0xc36d('0x86')]['firstName']||'')+'\x20'+(_0x10bfd2[_0xc36d('0x86')]['lastName']||'')};if(_0x216741[_0xc36d('0x63')][_0xc36d('0x89')]&&_0x216741[_0xc36d('0x63')][_0xc36d('0x8e')]&&_0x216741['body']['threadId']!=_0x216741['body']['messageId']){_0x25d26b[_0xc36d('0x89')]=_0x216741['body']['messageId'];}return _0x205d88[_0xc36d('0x62')](_0x25d26b);}else{return _0x205d88;}}})[_0xc36d('0x24')](function(_0xec4627){_0x10bfd2[_0xc36d('0x8f')]=_0xec4627[_0xc36d('0x38')]({'plain':!![]});_0x10bfd2[_0xc36d('0x8f')][_0xc36d('0x90')]=_0x26ce84;if(_0x10bfd2[_0xc36d('0x8f')][_0xc36d('0x90')]){if(_0x10bfd2[_0xc36d('0x85')][_0xc36d('0x91')]){_0x10bfd2[_0xc36d('0x82')][_0xc36d('0x92')]({'id':0x0,'priority':_0x10bfd2['applications'][_0xc36d('0x5b')]+0x1,'app':_0xc36d('0x93'),'appdata':_0xc36d('0x94'),'interval':_0xc36d('0x95')});}}return db[_0xc36d('0x96')][_0xc36d('0x5d')]({'body':_0x216741['body'][_0xc36d('0x63')],'OpenchannelAccountId':_0x216741[_0xc36d('0x59')]['id'],'OpenchannelInteractionId':_0xec4627['id'],'direction':'in','ContactId':_0x10bfd2[_0xc36d('0x86')]['id'],'AttachmentId':_0x216741[_0xc36d('0x63')][_0xc36d('0x97')]});})[_0xc36d('0x24')](function(_0x375ee9){_0x10bfd2[_0xc36d('0x2b')]=_0x375ee9;if(_0x10bfd2[_0xc36d('0x8f')][_0xc36d('0x98')]){return db[_0xc36d('0x99')][_0xc36d('0x5c')]({'attributes':['id',_0xc36d('0x3c')],'where':{'id':_0x10bfd2[_0xc36d('0x8f')][_0xc36d('0x98')]}})['then'](function(_0x1e1b42){if(_0x1e1b42){_0x10bfd2['applications'][_0xc36d('0x9a')]({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x1e1b42[_0xc36d('0x3c')]+','+(_0x10bfd2['account'][_0xc36d('0x9b')]||0xa),'interval':_0xc36d('0x95')});_0x10bfd2[_0xc36d('0x9c')]=![];}return respondWithRpcPromise(_0xc36d('0x9d'),_0xc36d('0x9e'),_0x10bfd2);});}return respondWithRpcPromise(_0xc36d('0x9d'),_0xc36d('0x9e'),_0x10bfd2);})['then'](function(_0x316798){respondWithRpcPromise('EventManager',_0xc36d('0x9f'),{'event':_0xc36d('0x72'),'message':_0x316798},client9002);return _0x316798;})[_0xc36d('0x24')](respondWithResult(_0x2ffb0d,null))[_0xc36d('0x2c')](handleError(_0x2ffb0d,null));};exports[_0xc36d('0xa0')]=function(_0x564ab5,_0x3bfcc4,_0x2ef658){return db[_0xc36d('0x41')][_0xc36d('0x69')]({'where':{'id':_0x564ab5['params']['id']}})[_0xc36d('0x24')](handleEntityNotFound(_0x3bfcc4,null))[_0xc36d('0x24')](function(_0x3f845a){if(_0x3f845a){return db['sequelize'][_0xc36d('0xa1')](function(_0x3a208c){return db[_0xc36d('0xa2')]['destroy']({'where':{'OpenchannelAccountId':_0x564ab5['params']['id']},'transaction':_0x3a208c})[_0xc36d('0x24')](function(_0x52cb44){var _0x5afa5b=_[_0xc36d('0x45')](_0x564ab5[_0xc36d('0x63')],function(_0x46a350){_0x46a350[_0xc36d('0x6e')]=_0x564ab5[_0xc36d('0x59')]['id'];return _0x46a350;});return db['OpenchannelApplication'][_0xc36d('0xa3')](_0x5afa5b,{'transaction':_0x3a208c});});})['then'](function(){return db['OpenchannelApplication'][_0xc36d('0xa4')]({'where':{'OpenchannelAccountId':_0x564ab5['params']['id']},'order':_0xc36d('0x83')});});}})[_0xc36d('0x24')](respondWithResult(_0x3bfcc4,null))[_0xc36d('0x2c')](handleError(_0x3bfcc4,null));};exports[_0xc36d('0xa5')]=function(_0xcc764d,_0x2ea654,_0x1e2a67){var _0x588aa4={};var _0x11d566={};var _0x4ee76c;var _0x59fa1a;return db[_0xc36d('0x41')][_0xc36d('0x69')]({'where':{'id':_0xcc764d[_0xc36d('0x59')]['id']}})[_0xc36d('0x24')](handleEntityNotFound(_0x2ea654,null))[_0xc36d('0x24')](function(_0x214b70){if(_0x214b70){_0x4ee76c=_0x214b70;_0x11d566[_0xc36d('0x44')]=_[_0xc36d('0x5a')](db['OpenchannelApplication'][_0xc36d('0x42')]);_0x11d566[_0xc36d('0x46')]=_[_0xc36d('0x5a')](_0xcc764d[_0xc36d('0x46')]);_0x11d566['filters']=_[_0xc36d('0x48')](_0x11d566[_0xc36d('0x44')],_0x11d566['query']);_0x588aa4[_0xc36d('0x4a')]=_[_0xc36d('0x48')](_0x11d566[_0xc36d('0x44')],qs[_0xc36d('0x49')](_0xcc764d[_0xc36d('0x46')][_0xc36d('0x49')]));_0x588aa4['attributes']=_0x588aa4[_0xc36d('0x4a')][_0xc36d('0x5b')]?_0x588aa4[_0xc36d('0x4a')]:_0x11d566[_0xc36d('0x44')];_0x588aa4[_0xc36d('0x4d')]=qs[_0xc36d('0x4e')](_0xcc764d[_0xc36d('0x46')][_0xc36d('0x4e')]);_0x588aa4[_0xc36d('0x4f')]=qs[_0xc36d('0x47')](_[_0xc36d('0x50')](_0xcc764d[_0xc36d('0x46')],_0x11d566[_0xc36d('0x47')]));if(_0xcc764d['query'][_0xc36d('0x51')]){_0x588aa4[_0xc36d('0x4f')]=_[_0xc36d('0x52')](_0x588aa4[_0xc36d('0x4f')],{'$or':_['map'](_0x588aa4[_0xc36d('0x4a')],function(_0x4209fc){var _0x21213c={};_0x21213c[_0x4209fc]={'$like':'%'+_0xcc764d[_0xc36d('0x46')][_0xc36d('0x51')]+'%'};return _0x21213c;})});}_0x588aa4=_['merge']({},_0x588aa4,_0xcc764d['options']);return _0x4ee76c[_0xc36d('0xa5')](_0x588aa4);}})['then'](function(_0x4f3001){if(_0x4f3001){_0x59fa1a=_0x4f3001['length'];if(!_0xcc764d[_0xc36d('0x46')][_0xc36d('0x4b')](_0xc36d('0x4c'))){_0x588aa4[_0xc36d('0x31')]=qs[_0xc36d('0x31')](_0xcc764d[_0xc36d('0x46')][_0xc36d('0x31')]);_0x588aa4['offset']=qs[_0xc36d('0x30')](_0xcc764d[_0xc36d('0x46')]['offset']);}return _0x4ee76c[_0xc36d('0xa5')](_0x588aa4);}})[_0xc36d('0x24')](function(_0x31af37){if(_0x31af37){return _0x31af37?{'count':_0x59fa1a,'rows':_0x31af37}:null;}})[_0xc36d('0x24')](respondWithResult(_0x2ea654,null))[_0xc36d('0x2c')](handleError(_0x2ea654,null));};exports[_0xc36d('0xa6')]=function(_0x5ab0bc,_0x2276d8,_0x596f14){var _0x24ea3a={'raw':![],'where':{}};var _0x5b252d={};var _0x4339fa={'count':0x0,'rows':[]};return db['OpenchannelAccount']['findOne']({'where':{'id':_0x5ab0bc['params']['id']}})['then'](handleEntityNotFound(_0x2276d8,null))[_0xc36d('0x24')](function(_0x2d046e){if(_0x2d046e){_0x5b252d[_0xc36d('0x44')]=_[_0xc36d('0x5a')](db[_0xc36d('0x8a')][_0xc36d('0x42')]);_0x5b252d[_0xc36d('0x46')]=_[_0xc36d('0x5a')](_0x5ab0bc[_0xc36d('0x46')]);_0x5b252d['filters']=_[_0xc36d('0x48')](_0x5b252d[_0xc36d('0x44')],_0x5b252d[_0xc36d('0x46')]);_0x24ea3a[_0xc36d('0x4a')]=_[_0xc36d('0x48')](_0x5b252d[_0xc36d('0x44')],qs[_0xc36d('0x49')](_0x5ab0bc['query'][_0xc36d('0x49')]));_0x24ea3a[_0xc36d('0x4a')]=_0x24ea3a[_0xc36d('0x4a')][_0xc36d('0x5b')]?_0x24ea3a['attributes']:_0x5b252d['model'];if(!_0x5ab0bc[_0xc36d('0x46')][_0xc36d('0x4b')](_0xc36d('0x4c'))){_0x24ea3a[_0xc36d('0x31')]=qs[_0xc36d('0x31')](_0x5ab0bc[_0xc36d('0x46')][_0xc36d('0x31')]);_0x24ea3a['offset']=qs[_0xc36d('0x30')](_0x5ab0bc[_0xc36d('0x46')][_0xc36d('0x30')]);}_0x24ea3a['order']=qs[_0xc36d('0x4e')](_0x5ab0bc[_0xc36d('0x46')][_0xc36d('0x4e')]);_0x24ea3a[_0xc36d('0x4f')]=qs[_0xc36d('0x47')](_[_0xc36d('0x50')](_0x5ab0bc['query'],_0x5b252d['filters']));_0x24ea3a[_0xc36d('0x4f')][_0xc36d('0x6e')]=_0x2d046e['id'];if(_0x5ab0bc[_0xc36d('0x46')][_0xc36d('0x51')]){_0x24ea3a[_0xc36d('0x4f')]=_['merge'](_0x24ea3a[_0xc36d('0x4f')],{'$or':_[_0xc36d('0x45')](_0x24ea3a['attributes'],function(_0x9a2e85){var _0x21795f={};_0x21795f[_0x9a2e85]={'$like':'%'+_0x5ab0bc[_0xc36d('0x46')]['filter']+'%'};return _0x21795f;})});}_0x24ea3a=_['merge']({},_0x24ea3a,_0x5ab0bc[_0xc36d('0x6a')]);return db['OpenchannelInteraction']['count']({'where':_0x24ea3a['where']})['then'](function(_0xd92463){_0x4339fa[_0xc36d('0x2f')]=_0xd92463;if(_0x5ab0bc[_0xc36d('0x46')]['includeAll']){_0x24ea3a[_0xc36d('0x56')]=[{'model':db[_0xc36d('0x74')],'as':_0xc36d('0xa7'),'required':![]},{'model':db[_0xc36d('0x99')],'as':_0xc36d('0xa8'),'attributes':['name','fullname',_0xc36d('0xa9')],'required':![]},{'model':db[_0xc36d('0xaa')],'as':_0xc36d('0xab'),'attributes':['id','name',_0xc36d('0xac')],'where':_0x5ab0bc[_0xc36d('0x46')][_0xc36d('0xad')]?{'id':_0x5ab0bc[_0xc36d('0x46')][_0xc36d('0xad')]}:undefined,'required':_0x5ab0bc[_0xc36d('0x46')][_0xc36d('0xad')]?!![]:![]}];}return db[_0xc36d('0x8a')][_0xc36d('0x6b')](_0x24ea3a);})[_0xc36d('0x24')](function(_0x1e9c4c){_0x4339fa['rows']=_0x1e9c4c;return _0x4339fa;});}})['then'](respondWithFilteredResult(_0x2276d8,_0x24ea3a))['catch'](handleError(_0x2276d8,null));};exports['addAgents']=function(_0x25511f,_0xf604a1,_0x1c5c0c){return db['OpenchannelAccount']['find']({'where':{'id':_0x25511f[_0xc36d('0x59')]['id']}})['then'](handleEntityNotFound(_0xf604a1,null))[_0xc36d('0x24')](function(_0xaa40b){if(_0xaa40b){return _0xaa40b[_0xc36d('0xae')](_0x25511f[_0xc36d('0x63')][_0xc36d('0x6d')],_['omit'](_0x25511f[_0xc36d('0x63')],[_0xc36d('0x6d'),'id'])||{})['spread'](function(_0x38a659){for(var _0x2daebb=0x0;_0x2daebb<_0x25511f['body'][_0xc36d('0x6d')]['length'];_0x2daebb+=0x1){socket[_0xc36d('0xaf')](_0xc36d('0xb0'),{'UserId':_0x25511f[_0xc36d('0x63')][_0xc36d('0x6d')][_0x2daebb],'OpenchannelAccountId':_0x25511f['params']['id']});}return _0x38a659;});}})['then'](respondWithResult(_0xf604a1,null))[_0xc36d('0x2c')](handleError(_0xf604a1,null));};exports['removeAgents']=function(_0x373f3f,_0x39d4f1,_0x41b4d9){return db[_0xc36d('0x41')][_0xc36d('0x5c')]({'where':{'id':_0x373f3f['params']['id']}})['then'](handleEntityNotFound(_0x39d4f1,null))[_0xc36d('0x24')](function(_0x3f07df){if(_0x3f07df){return _0x3f07df[_0xc36d('0xb1')](_0x373f3f[_0xc36d('0x46')][_0xc36d('0x6d')])[_0xc36d('0x24')](function(){if(_[_0xc36d('0xb2')](_0x373f3f[_0xc36d('0x46')]['ids'])){for(var _0xb22c9b=0x0;_0xb22c9b<_0x373f3f[_0xc36d('0x46')][_0xc36d('0x6d')][_0xc36d('0x5b')];_0xb22c9b+=0x1){socket['emit'](_0xc36d('0xb3'),{'UserId':Number(_0x373f3f[_0xc36d('0x46')][_0xc36d('0x6d')][_0xb22c9b]),'OpenchannelAccountId':Number(_0x373f3f[_0xc36d('0x59')]['id'])});}}else{socket[_0xc36d('0xaf')]('userOpenchannelAccount:remove',{'UserId':Number(_0x373f3f[_0xc36d('0x46')][_0xc36d('0x6d')]),'OpenchannelAccountId':Number(_0x373f3f[_0xc36d('0x59')]['id'])});}});}})['then'](respondWithStatusCode(_0x39d4f1,null))[_0xc36d('0x2c')](handleError(_0x39d4f1,null));};exports[_0xc36d('0xb4')]=function(_0x357f4c,_0x22394c,_0x5b96f6){var _0x5b20ca={};var _0x40ccd9={};var _0x30716c;var _0x8c2571;return db[_0xc36d('0x41')][_0xc36d('0x69')]({'where':{'id':_0x357f4c[_0xc36d('0x59')]['id']}})[_0xc36d('0x24')](handleEntityNotFound(_0x22394c,null))[_0xc36d('0x24')](function(_0x39726e){if(_0x39726e){_0x30716c=_0x39726e;_0x40ccd9[_0xc36d('0x44')]=_[_0xc36d('0x5a')](db['User'][_0xc36d('0x42')]);_0x40ccd9[_0xc36d('0x46')]=_['keys'](_0x357f4c[_0xc36d('0x46')]);_0x40ccd9['filters']=_[_0xc36d('0x48')](_0x40ccd9['model'],_0x40ccd9['query']);_0x5b20ca[_0xc36d('0x4a')]=_['intersection'](_0x40ccd9[_0xc36d('0x44')],qs['fields'](_0x357f4c[_0xc36d('0x46')][_0xc36d('0x49')]));_0x5b20ca[_0xc36d('0x4a')]=_0x5b20ca[_0xc36d('0x4a')]['length']?_0x5b20ca[_0xc36d('0x4a')]:_0x40ccd9[_0xc36d('0x44')];_0x5b20ca[_0xc36d('0x4d')]=qs['sort'](_0x357f4c[_0xc36d('0x46')][_0xc36d('0x4e')]);_0x5b20ca['where']=qs[_0xc36d('0x47')](_['pick'](_0x357f4c[_0xc36d('0x46')],_0x40ccd9[_0xc36d('0x47')]));if(_0x357f4c['query']['filter']){_0x5b20ca[_0xc36d('0x4f')]=_[_0xc36d('0x52')](_0x5b20ca['where'],{'$or':_[_0xc36d('0x45')](_0x5b20ca[_0xc36d('0x4a')],function(_0x34fd0b){var _0x2e9bc0={};_0x2e9bc0[_0x34fd0b]={'$like':'%'+_0x357f4c[_0xc36d('0x46')][_0xc36d('0x51')]+'%'};return _0x2e9bc0;})});}_0x5b20ca=_[_0xc36d('0x52')]({},_0x5b20ca,_0x357f4c[_0xc36d('0x6a')]);return _0x30716c[_0xc36d('0xb4')](_0x5b20ca);}})['then'](function(_0x10ba8c){if(_0x10ba8c){_0x8c2571=_0x10ba8c[_0xc36d('0x5b')];if(!_0x357f4c[_0xc36d('0x46')][_0xc36d('0x4b')](_0xc36d('0x4c'))){_0x5b20ca[_0xc36d('0x31')]=qs[_0xc36d('0x31')](_0x357f4c['query']['limit']);_0x5b20ca[_0xc36d('0x30')]=qs[_0xc36d('0x30')](_0x357f4c['query'][_0xc36d('0x30')]);}return _0x30716c[_0xc36d('0xb4')](_0x5b20ca);}})[_0xc36d('0x24')](function(_0x325e86){if(_0x325e86){return _0x325e86?{'count':_0x8c2571,'rows':_0x325e86}:null;}})[_0xc36d('0x24')](respondWithResult(_0x22394c,null))[_0xc36d('0x2c')](handleError(_0x22394c,null));};exports[_0xc36d('0x3d')]=function(_0x3f012e,_0x34e458,_0x268db7){var _0x43cac5,_0x99dd06,_0xaf656c;if(_['isNil'](_0x3f012e['body']['body'])||_0x3f012e[_0xc36d('0x63')][_0xc36d('0x63')]===''){throw new db['Sequelize'][(_0xc36d('0x22'))](_0xc36d('0x7a'));}if(_[_0xc36d('0x78')](_0x3f012e[_0xc36d('0x63')]['to'])){}_0x43cac5=_0x3f012e[_0xc36d('0x63')]['to'];return db[_0xc36d('0x41')]['findOne']({'where':{'id':_0x3f012e[_0xc36d('0x59')]['id']}})[_0xc36d('0x24')](handleEntityNotFound(_0x34e458,null))[_0xc36d('0x24')](function(_0x36c288){if(_0x36c288){return db[_0xc36d('0x41')][_0xc36d('0x5c')]({'where':{'id':_0x36c288['id']},'include':[{'model':db[_0xc36d('0xb5')],'as':_0xc36d('0x81'),'include':[{'model':db[_0xc36d('0x74')],'as':_0xc36d('0x7e'),'where':{[_0x36c288[_0xc36d('0x7b')]]:_0x43cac5},'limit':0x1,'order':[[_0xc36d('0x76'),_0xc36d('0x7f')]]}]}]})[_0xc36d('0x24')](handleEntityNotFound(_0x34e458,null))[_0xc36d('0x24')](function(_0x231cd3){if(_0x231cd3&&_0x231cd3[_0xc36d('0x81')]){_0x99dd06=_0x231cd3['get']({'plain':!![]});if(_0x99dd06['List']&&_0x99dd06['List'][_0xc36d('0x7e')][_0xc36d('0x5b')]){return _0x99dd06[_0xc36d('0x81')][_0xc36d('0x7e')][0x0];}return db[_0xc36d('0x74')][_0xc36d('0x5d')](_[_0xc36d('0x1c')](_0x3f012e[_0xc36d('0x63')],{'firstName':_0x43cac5,[_0x231cd3['mapKey']]:_0x43cac5,'phone':_0x43cac5,'ListId':_0x99dd06[_0xc36d('0x77')]}));}})['then'](handleEntityNotFound(_0x34e458,null))[_0xc36d('0x24')](function(_0x4068e3){if(_0x4068e3){_0xaf656c=_0x4068e3;return db[_0xc36d('0x8a')][_0xc36d('0x5c')]({'where':{'ContactId':_0xaf656c['id'],'closed':![],'OpenchannelAccountId':_0x99dd06['id']}})['then'](function(_0x46b13a){if(_0x46b13a){return[_0x46b13a,![]];}return db[_0xc36d('0x8a')]['create']({'UserId':_0x3f012e[_0xc36d('0x5e')]['id'],'ContactId':_0xaf656c['id'],'OpenchannelAccountId':_0x99dd06['id'],'lastMsgDirection':'out','Messages':[_[_0xc36d('0x52')](_0x3f012e['body'],{'read':![],'body':_0x3f012e[_0xc36d('0x63')][_0xc36d('0x63')],'OpenchannelAccountId':_0x99dd06['id'],'UserId':_0x3f012e[_0xc36d('0x5e')]['id'],'ContactId':_0xaf656c['id']})]},{'include':[{'model':db[_0xc36d('0x96')],'as':'Messages'}]})['then'](function(_0x20606c){return[_0x20606c,!![]];});});}})['spread'](function(_0x2ac64b,_0x3f35bd){if(_0x3f35bd){return _0x2ac64b;}return db['OpenchannelMessage'][_0xc36d('0x5d')](_[_0xc36d('0x52')](_0x3f012e[_0xc36d('0x63')],{'read':![],'body':_0x3f012e[_0xc36d('0x63')][_0xc36d('0x63')],'OpenchannelAccountId':_0x99dd06['id'],'OpenchannelInteractionId':_0x2ac64b['id'],'UserId':_0x3f012e[_0xc36d('0x5e')]['id'],'ContactId':_0xaf656c['id']}))[_0xc36d('0x24')](function(_0x2c5d38){_0x2ac64b[_0xc36d('0xb6')][_0xc36d('0xb7')]=[];_0x2ac64b['dataValues']['Messages'][_0xc36d('0x92')](_0x2c5d38[_0xc36d('0xb6')]);return _0x2ac64b;});});}})['then'](respondWithResult(_0x34e458,null))[_0xc36d('0x2c')](handleError(_0x34e458,null));}; \ No newline at end of file +var _0x09ac=['get','OpenchannelAccounts','UserProfileResource','stack','name','send','index','Pause','map','rawAttributes','type','key','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','OpenchannelAccount','count','include','findAll','show','params','mandatoryDispositionPause','keys','includeAll','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','addDisposition','OpnechannelAccountId','Disposition','getDispositions','rows','removeDispositions','addAnswer','CannedAnswer','findOne','OpenchannelAccountId','removeAnswers','ids','notify','CmContact','no\x20available\x20attributes','difference','createdAt','updatedAt','ListId','isNil','from','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','DESC','OpenchannelApplication','Applications','List','account','orderBy','applications','asc','contact','firstName','threadId','OpenchannelInteraction','externalUrl','ContactId','spread','messageId','interaction','created','autoclose','push','close','*,*,*,*','OpenchannelMessage','UserId','unshift','waitForTheAssignedAgent','forcedOwnership','Start','startRouting','EventManager','addApplications','sequelize','transaction','destroy','findAndCountAll','getApplications','getInteractions','Contact','User','Owner','fullname','Tags','color','tag','addAgents','omit','userOpenchannelAccount:save','removeAgents','isArray','emit','userOpenchannelAccount:remove','getAgents','defaults','user','Messages','dataValues','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','redis','localhost','socket.io-emitter','./openchannelAccount.socket','register','jayson/promise','client','http','test','Sequelize','ValidationError','then','info','OpenchannelAccount,\x20%s,\x20%s','request\x20sent','OpenchannelAccount,\x20%s,\x20%s,\x20%s','error','message','result','catch','sendStatus','status','end','json','offset','limit','Content-Range','reject','save','update'];(function(_0x1bc762,_0x523eb3){var _0x40f70c=function(_0x3c206e){while(--_0x3c206e){_0x1bc762['push'](_0x1bc762['shift']());}};_0x40f70c(++_0x523eb3);}(_0x09ac,0x81));var _0xc09a=function(_0x24655a,_0x7fa437){_0x24655a=_0x24655a-0x0;var _0x5f4ad4=_0x09ac[_0x24655a];return _0x5f4ad4;};'use strict';var pdf=require(_0xc09a('0x0'));var emlformat=require(_0xc09a('0x1'));var rimraf=require(_0xc09a('0x2'));var zipdir=require(_0xc09a('0x3'));var jsonpatch=require(_0xc09a('0x4'));var rp=require(_0xc09a('0x5'));var moment=require(_0xc09a('0x6'));var BPromise=require(_0xc09a('0x7'));var Mustache=require(_0xc09a('0x8'));var util=require(_0xc09a('0x9'));var path=require(_0xc09a('0xa'));var sox=require(_0xc09a('0xb'));var csv=require(_0xc09a('0xc'));var ejs=require(_0xc09a('0xd'));var fs=require('fs');var _=require('lodash');var squel=require(_0xc09a('0xe'));var crypto=require(_0xc09a('0xf'));var jsforce=require(_0xc09a('0x10'));var deskjs=require(_0xc09a('0x11'));var toCsv=require(_0xc09a('0xc'));var querystring=require(_0xc09a('0x12'));var Papa=require(_0xc09a('0x13'));var Redis=require(_0xc09a('0x14'));var authService=require(_0xc09a('0x15'));var qs=require(_0xc09a('0x16'));var as=require(_0xc09a('0x17'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xc09a('0x18'))(_0xc09a('0x19'));var utils=require('../../config/utils');var config=require(_0xc09a('0x1a'));var db=require('../../mysqldb')['db'];config['redis']=_['defaults'](config[_0xc09a('0x1b')],{'host':_0xc09a('0x1c'),'port':0x18eb});var socket=require(_0xc09a('0x1d'))(new Redis(config[_0xc09a('0x1b')]));require(_0xc09a('0x1e'))[_0xc09a('0x1f')](socket);var jayson=require(_0xc09a('0x20'));var client=jayson[_0xc09a('0x21')][_0xc09a('0x22')]({'port':0x232c});var client9002=jayson[_0xc09a('0x21')][_0xc09a('0x22')]({'port':0x232a});function checkPasswordPattern(_0x54379f,_0x4899d5,_0x3c2b1d){if(_0x3c2b1d){var _0x30d59e=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x30d59e[_0xc09a('0x23')](_0x4899d5)){return _0x54379f;}else{throw new db[(_0xc09a('0x24'))][(_0xc09a('0x25'))]('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 _0x54379f;}}function respondWithRpcPromise(_0x3c10ee,_0x11e036,_0x507c8c,_0x4cc5ca){return new BPromise(function(_0x9bda08,_0xce2192){var _0x407bfc=_0x4cc5ca||client;return _0x407bfc['request'](_0x3c10ee,_0x507c8c)[_0xc09a('0x26')](function(_0x238621){logger[_0xc09a('0x27')](_0xc09a('0x28'),_0x11e036,_0xc09a('0x29'));logger['debug'](_0xc09a('0x2a'),_0x11e036,_0xc09a('0x29'),JSON['stringify'](_0x238621));if(_0x238621[_0xc09a('0x2b')]){if(_0x238621['error']['code']===0x1f4){logger[_0xc09a('0x2b')](_0xc09a('0x28'),_0x11e036,_0x238621[_0xc09a('0x2b')]['message']);return _0xce2192(_0x238621['error'][_0xc09a('0x2c')]);}logger[_0xc09a('0x2b')](_0xc09a('0x28'),_0x11e036,_0x238621[_0xc09a('0x2b')][_0xc09a('0x2c')]);return _0x9bda08(_0x238621[_0xc09a('0x2b')][_0xc09a('0x2c')]);}else{logger[_0xc09a('0x27')](_0xc09a('0x28'),_0x11e036,'request\x20sent');_0x9bda08(_0x238621[_0xc09a('0x2d')][_0xc09a('0x2c')]);}})[_0xc09a('0x2e')](function(_0x43ac09){logger[_0xc09a('0x2b')](_0xc09a('0x28'),_0x11e036,_0x43ac09);_0xce2192(_0x43ac09);});});}function respondWithStatusCode(_0x1d4288,_0x5bd1fd){_0x5bd1fd=_0x5bd1fd||0xcc;return function(_0x2f95c5){if(_0x2f95c5){return _0x1d4288[_0xc09a('0x2f')](_0x5bd1fd);}return _0x1d4288[_0xc09a('0x30')](_0x5bd1fd)[_0xc09a('0x31')]();};}function respondWithResult(_0x36c4f6,_0x1c716b){_0x1c716b=_0x1c716b||0xc8;return function(_0x3aa226){if(_0x3aa226){return _0x36c4f6['status'](_0x1c716b)[_0xc09a('0x32')](_0x3aa226);}};}function respondWithFilteredResult(_0x1094b,_0x3117f2){return function(_0x135748){if(_0x135748){var _0x29d894=_0x135748['count'],_0x47ae36=_0x3117f2['offset'],_0x120f5c=_0x3117f2[_0xc09a('0x33')]+_0x3117f2[_0xc09a('0x34')],_0x4f0d62;if(_0x120f5c>=_0x29d894){_0x120f5c=_0x29d894;_0x4f0d62=0xc8;}else{_0x4f0d62=0xce;}_0x1094b[_0xc09a('0x30')](_0x4f0d62);return _0x1094b['set'](_0xc09a('0x35'),_0x47ae36+'-'+_0x120f5c+'/'+_0x29d894)['json'](_0x135748);}return null;};}function patchUpdates(_0x52351b){return function(_0x4450bf){try{jsonpatch['apply'](_0x4450bf,_0x52351b,!![]);}catch(_0x53adfc){return BPromise[_0xc09a('0x36')](_0x53adfc);}return _0x4450bf[_0xc09a('0x37')]();};}function saveUpdates(_0x42aae4,_0xedc453){return function(_0x3ab22a){if(_0x3ab22a){return _0x3ab22a[_0xc09a('0x38')](_0x42aae4)[_0xc09a('0x26')](function(_0x286da3){return _0x286da3;});}return null;};}function removeEntity(_0x5d48c0,_0x239625){return function(_0x52ca8b){if(_0x52ca8b){return _0x52ca8b['destroy']()[_0xc09a('0x26')](function(){var _0x1c2eba=_0x52ca8b[_0xc09a('0x39')]({'plain':!![]});var _0x41c721=_0xc09a('0x3a');return db[_0xc09a('0x3b')]['destroy']({'where':{'type':_0x41c721,'resourceId':_0x1c2eba['id']}})['then'](function(){return _0x52ca8b;});})[_0xc09a('0x26')](function(){_0x5d48c0[_0xc09a('0x30')](0xcc)[_0xc09a('0x31')]();});}};}function handleEntityNotFound(_0x37aa25,_0x4cd239){return function(_0x19a4aa){if(!_0x19a4aa){_0x37aa25[_0xc09a('0x2f')](0x194);}return _0x19a4aa;};}function handleError(_0x1660fd,_0x1ec12f){_0x1ec12f=_0x1ec12f||0x1f4;return function(_0x5bc433){logger[_0xc09a('0x2b')](_0x5bc433[_0xc09a('0x3c')]);if(_0x5bc433[_0xc09a('0x3d')]){delete _0x5bc433[_0xc09a('0x3d')];}_0x1660fd[_0xc09a('0x30')](_0x1ec12f)[_0xc09a('0x3e')](_0x5bc433);};}exports[_0xc09a('0x3f')]=function(_0x1ff212,_0x2fb18d){var _0x5ec745={'include':[{'model':db[_0xc09a('0x40')],'as':'mandatoryDispositionPause'}]},_0x18e194={},_0x4115e4={'count':0x0,'rows':[]};var _0x33cd3a=_[_0xc09a('0x41')](db['OpenchannelAccount'][_0xc09a('0x42')],function(_0x17d080){return{'name':_0x17d080['fieldName'],'type':_0x17d080[_0xc09a('0x43')][_0xc09a('0x44')]};});_0x18e194[_0xc09a('0x45')]=_[_0xc09a('0x41')](_0x33cd3a,_0xc09a('0x3d'));_0x18e194[_0xc09a('0x46')]=_['keys'](_0x1ff212[_0xc09a('0x46')]);_0x18e194[_0xc09a('0x47')]=_[_0xc09a('0x48')](_0x18e194[_0xc09a('0x45')],_0x18e194['query']);_0x5ec745['attributes']=_[_0xc09a('0x48')](_0x18e194[_0xc09a('0x45')],qs[_0xc09a('0x49')](_0x1ff212[_0xc09a('0x46')][_0xc09a('0x49')]));_0x5ec745[_0xc09a('0x4a')]=_0x5ec745[_0xc09a('0x4a')][_0xc09a('0x4b')]?_0x5ec745[_0xc09a('0x4a')]:_0x18e194[_0xc09a('0x45')];if(!_0x1ff212['query'][_0xc09a('0x4c')](_0xc09a('0x4d'))){_0x5ec745[_0xc09a('0x34')]=qs[_0xc09a('0x34')](_0x1ff212[_0xc09a('0x46')]['limit']);_0x5ec745['offset']=qs[_0xc09a('0x33')](_0x1ff212['query'][_0xc09a('0x33')]);}_0x5ec745[_0xc09a('0x4e')]=qs[_0xc09a('0x4f')](_0x1ff212[_0xc09a('0x46')]['sort']);_0x5ec745[_0xc09a('0x50')]=qs['filters'](_[_0xc09a('0x51')](_0x1ff212[_0xc09a('0x46')],_0x18e194[_0xc09a('0x47')]),_0x33cd3a);if(_0x1ff212[_0xc09a('0x46')][_0xc09a('0x52')]){_0x5ec745[_0xc09a('0x50')]=_['merge'](_0x5ec745[_0xc09a('0x50')],{'$or':_[_0xc09a('0x41')](_0x33cd3a,function(_0x273c25){if(_0x273c25['type']!==_0xc09a('0x53')){var _0x5a9fbd={};_0x5a9fbd[_0x273c25[_0xc09a('0x3d')]]={'$like':'%'+_0x1ff212[_0xc09a('0x46')]['filter']+'%'};return _0x5a9fbd;}})});}_0x5ec745=_[_0xc09a('0x54')]({},_0x5ec745,_0x1ff212[_0xc09a('0x55')]);var _0x2bcf56={'where':_0x5ec745['where']};return db[_0xc09a('0x56')]['count'](_0x2bcf56)[_0xc09a('0x26')](function(_0x8506f3){_0x4115e4[_0xc09a('0x57')]=_0x8506f3;if(_0x1ff212['query']['includeAll']){_0x5ec745[_0xc09a('0x58')]=[{'all':!![]}];}return db['OpenchannelAccount'][_0xc09a('0x59')](_0x5ec745);})[_0xc09a('0x26')](function(_0x516440){_0x4115e4['rows']=_0x516440;return _0x4115e4;})['then'](respondWithFilteredResult(_0x2fb18d,_0x5ec745))['catch'](handleError(_0x2fb18d,null));};exports[_0xc09a('0x5a')]=function(_0x4dbb9b,_0x20166f){var _0x26fac4={'raw':![],'where':{'id':_0x4dbb9b[_0xc09a('0x5b')]['id']},'include':[{'model':db[_0xc09a('0x40')],'as':_0xc09a('0x5c')}]},_0x35ea27={};_0x35ea27[_0xc09a('0x45')]=_[_0xc09a('0x5d')](db[_0xc09a('0x56')][_0xc09a('0x42')]);_0x35ea27[_0xc09a('0x46')]=_[_0xc09a('0x5d')](_0x4dbb9b[_0xc09a('0x46')]);_0x35ea27[_0xc09a('0x47')]=_[_0xc09a('0x48')](_0x35ea27[_0xc09a('0x45')],_0x35ea27['query']);_0x26fac4[_0xc09a('0x4a')]=_['intersection'](_0x35ea27[_0xc09a('0x45')],qs[_0xc09a('0x49')](_0x4dbb9b[_0xc09a('0x46')][_0xc09a('0x49')]));_0x26fac4['attributes']=_0x26fac4['attributes']['length']?_0x26fac4[_0xc09a('0x4a')]:_0x35ea27[_0xc09a('0x45')];if(_0x4dbb9b[_0xc09a('0x46')][_0xc09a('0x5e')]){_0x26fac4[_0xc09a('0x58')]=[{'all':!![]}];}_0x26fac4=_['merge']({},_0x26fac4,_0x4dbb9b[_0xc09a('0x55')]);return db[_0xc09a('0x56')][_0xc09a('0x5f')](_0x26fac4)[_0xc09a('0x26')](handleEntityNotFound(_0x20166f,null))[_0xc09a('0x26')](respondWithResult(_0x20166f,null))['catch'](handleError(_0x20166f,null));};exports[_0xc09a('0x60')]=function(_0x27dd10,_0x59bf34){return db[_0xc09a('0x56')][_0xc09a('0x60')](_0x27dd10[_0xc09a('0x61')],{})['then'](function(_0x544ff2){var _0x134ac7=_0x27dd10['user'][_0xc09a('0x39')]({'plain':!![]});if(!_0x134ac7)throw new Error(_0xc09a('0x62'));if(_0x134ac7['role']==='user'){var _0x2c3cd9=_0x544ff2['get']({'plain':!![]});var _0x24ed09='OpenchannelAccounts';return db['UserProfileSection'][_0xc09a('0x5f')]({'where':{'name':_0x24ed09,'userProfileId':_0x134ac7['userProfileId']},'raw':!![]})[_0xc09a('0x26')](function(_0x2c9167){if(_0x2c9167&&_0x2c9167[_0xc09a('0x63')]===0x0){return db['UserProfileResource'][_0xc09a('0x60')]({'name':_0x2c3cd9[_0xc09a('0x3d')],'resourceId':_0x2c3cd9['id'],'type':_0x2c9167[_0xc09a('0x3d')],'sectionId':_0x2c9167['id']},{})[_0xc09a('0x26')](function(){return _0x544ff2;});}else{return _0x544ff2;}})['catch'](function(_0x2ed65e){logger['error'](_0xc09a('0x64'),_0x2ed65e);throw _0x2ed65e;});}return _0x544ff2;})[_0xc09a('0x26')](respondWithResult(_0x59bf34,0xc9))['catch'](handleError(_0x59bf34,null));};exports[_0xc09a('0x38')]=function(_0x1917e1,_0x2be794){if(_0x1917e1[_0xc09a('0x61')]['id']){delete _0x1917e1['body']['id'];}return db['OpenchannelAccount'][_0xc09a('0x5f')]({'where':{'id':_0x1917e1[_0xc09a('0x5b')]['id']},'include':[{'model':db[_0xc09a('0x40')],'as':_0xc09a('0x5c')}]})[_0xc09a('0x26')](handleEntityNotFound(_0x2be794,null))[_0xc09a('0x26')](saveUpdates(_0x1917e1[_0xc09a('0x61')],null))[_0xc09a('0x26')](respondWithResult(_0x2be794,null))[_0xc09a('0x2e')](handleError(_0x2be794,null));};exports['destroy']=function(_0x560810,_0x2ec6d4){return db[_0xc09a('0x56')][_0xc09a('0x5f')]({'where':{'id':_0x560810[_0xc09a('0x5b')]['id']}})[_0xc09a('0x26')](handleEntityNotFound(_0x2ec6d4,null))[_0xc09a('0x26')](removeEntity(_0x2ec6d4,null))['catch'](handleError(_0x2ec6d4,null));};exports[_0xc09a('0x65')]=function(_0x28f6d4,_0x5ec661){return db[_0xc09a('0x56')][_0xc09a('0x65')]()[_0xc09a('0x26')](respondWithResult(_0x5ec661,null))['catch'](handleError(_0x5ec661,null));};exports[_0xc09a('0x66')]=function(_0x5d69bd,_0x3d9a6d,_0x3b0d00){if(_0x5d69bd[_0xc09a('0x61')]['id']){delete _0x5d69bd[_0xc09a('0x61')]['id'];}return db[_0xc09a('0x56')][_0xc09a('0x5f')]({'where':{'id':_0x5d69bd['params']['id']}})['then'](handleEntityNotFound(_0x3d9a6d,null))[_0xc09a('0x26')](function(_0x332c62){if(_0x332c62){_0x5d69bd['body'][_0xc09a('0x67')]=_0x332c62['id'];return db[_0xc09a('0x68')][_0xc09a('0x60')](_0x5d69bd[_0xc09a('0x61')]);}})[_0xc09a('0x26')](respondWithResult(_0x3d9a6d,null))[_0xc09a('0x2e')](handleError(_0x3d9a6d,null));};exports[_0xc09a('0x69')]=function(_0x552956,_0x1dc2c9,_0xfe5383){var _0xac074e={'raw':![],'where':{}};var _0x26d297={};var _0x6f8c9b={'count':0x0,'rows':[]};return db[_0xc09a('0x56')]['findOne']({'where':{'id':_0x552956[_0xc09a('0x5b')]['id']}})[_0xc09a('0x26')](handleEntityNotFound(_0x1dc2c9,null))[_0xc09a('0x26')](function(_0x475034){if(_0x475034){_0x26d297[_0xc09a('0x45')]=_['keys'](db[_0xc09a('0x68')][_0xc09a('0x42')]);_0x26d297[_0xc09a('0x46')]=_[_0xc09a('0x5d')](_0x552956['query']);_0x26d297[_0xc09a('0x47')]=_[_0xc09a('0x48')](_0x26d297[_0xc09a('0x45')],_0x26d297[_0xc09a('0x46')]);_0xac074e[_0xc09a('0x4a')]=_[_0xc09a('0x48')](_0x26d297[_0xc09a('0x45')],qs[_0xc09a('0x49')](_0x552956[_0xc09a('0x46')][_0xc09a('0x49')]));_0xac074e[_0xc09a('0x4a')]=_0xac074e[_0xc09a('0x4a')][_0xc09a('0x4b')]?_0xac074e[_0xc09a('0x4a')]:_0x26d297[_0xc09a('0x45')];if(!_0x552956[_0xc09a('0x46')][_0xc09a('0x4c')](_0xc09a('0x4d'))){_0xac074e[_0xc09a('0x34')]=qs[_0xc09a('0x34')](_0x552956['query']['limit']);_0xac074e[_0xc09a('0x33')]=qs['offset'](_0x552956['query']['offset']);}_0xac074e['order']=qs[_0xc09a('0x4f')](_0x552956[_0xc09a('0x46')][_0xc09a('0x4f')]);_0xac074e[_0xc09a('0x50')]=qs[_0xc09a('0x47')](_[_0xc09a('0x51')](_0x552956['query'],_0x26d297[_0xc09a('0x47')]));_0xac074e['where']['OpenchannelAccountId']=_0x475034['id'];if(_0x552956['query'][_0xc09a('0x52')]){_0xac074e[_0xc09a('0x50')]=_[_0xc09a('0x54')](_0xac074e['where'],{'$or':_[_0xc09a('0x41')](_0xac074e[_0xc09a('0x4a')],function(_0x5e0893){var _0x3b5115={};_0x3b5115[_0x5e0893]={'$like':'%'+_0x552956[_0xc09a('0x46')][_0xc09a('0x52')]+'%'};return _0x3b5115;})});}_0xac074e=_[_0xc09a('0x54')]({},_0xac074e,_0x552956[_0xc09a('0x55')]);return db[_0xc09a('0x68')]['count']({'where':_0xac074e['where']})[_0xc09a('0x26')](function(_0x5593fe){_0x6f8c9b[_0xc09a('0x57')]=_0x5593fe;if(_0x552956['query'][_0xc09a('0x5e')]){_0xac074e[_0xc09a('0x58')]=[{'all':!![]}];}return db[_0xc09a('0x68')][_0xc09a('0x59')](_0xac074e);})[_0xc09a('0x26')](function(_0x155fc9){_0x6f8c9b[_0xc09a('0x6a')]=_0x155fc9;return _0x6f8c9b;});}})[_0xc09a('0x26')](respondWithFilteredResult(_0x1dc2c9,_0xac074e))['catch'](handleError(_0x1dc2c9,null));};exports[_0xc09a('0x6b')]=function(_0x1225d7,_0x4d1fe5,_0x44d2d1){return db[_0xc09a('0x56')]['find']({'where':{'id':_0x1225d7[_0xc09a('0x5b')]['id']}})['then'](handleEntityNotFound(_0x4d1fe5,null))['then'](function(_0x2c8020){if(_0x2c8020){return _0x2c8020[_0xc09a('0x6b')](_0x1225d7[_0xc09a('0x46')]['ids']);}})[_0xc09a('0x26')](respondWithStatusCode(_0x4d1fe5,null))[_0xc09a('0x2e')](handleError(_0x4d1fe5,null));};exports[_0xc09a('0x6c')]=function(_0x2c8de3,_0x34572b,_0x9973a9){if(_0x2c8de3['body']['id']){delete _0x2c8de3[_0xc09a('0x61')]['id'];}return db['OpenchannelAccount'][_0xc09a('0x5f')]({'where':{'id':_0x2c8de3[_0xc09a('0x5b')]['id']}})[_0xc09a('0x26')](handleEntityNotFound(_0x34572b,null))[_0xc09a('0x26')](function(_0x1a93cb){if(_0x1a93cb){_0x2c8de3['body']['OpenchannelAccountId']=_0x1a93cb['id'];return db[_0xc09a('0x6d')][_0xc09a('0x60')](_0x2c8de3[_0xc09a('0x61')]);}})[_0xc09a('0x26')](respondWithResult(_0x34572b,null))[_0xc09a('0x2e')](handleError(_0x34572b,null));};exports['getAnswers']=function(_0x53803e,_0x43e97c,_0x24a0ab){var _0x577a63={'raw':![],'where':{}};var _0x252890={};var _0x3a31bd={'count':0x0,'rows':[]};return db[_0xc09a('0x56')][_0xc09a('0x6e')]({'where':{'id':_0x53803e[_0xc09a('0x5b')]['id']}})[_0xc09a('0x26')](handleEntityNotFound(_0x43e97c,null))['then'](function(_0x58f1ad){if(_0x58f1ad){_0x252890[_0xc09a('0x45')]=_['keys'](db['CannedAnswer'][_0xc09a('0x42')]);_0x252890[_0xc09a('0x46')]=_[_0xc09a('0x5d')](_0x53803e['query']);_0x252890[_0xc09a('0x47')]=_['intersection'](_0x252890[_0xc09a('0x45')],_0x252890[_0xc09a('0x46')]);_0x577a63['attributes']=_['intersection'](_0x252890[_0xc09a('0x45')],qs[_0xc09a('0x49')](_0x53803e[_0xc09a('0x46')][_0xc09a('0x49')]));_0x577a63[_0xc09a('0x4a')]=_0x577a63[_0xc09a('0x4a')][_0xc09a('0x4b')]?_0x577a63[_0xc09a('0x4a')]:_0x252890[_0xc09a('0x45')];if(!_0x53803e[_0xc09a('0x46')][_0xc09a('0x4c')](_0xc09a('0x4d'))){_0x577a63['limit']=qs[_0xc09a('0x34')](_0x53803e[_0xc09a('0x46')][_0xc09a('0x34')]);_0x577a63[_0xc09a('0x33')]=qs[_0xc09a('0x33')](_0x53803e[_0xc09a('0x46')][_0xc09a('0x33')]);}_0x577a63['order']=qs[_0xc09a('0x4f')](_0x53803e[_0xc09a('0x46')][_0xc09a('0x4f')]);_0x577a63[_0xc09a('0x50')]=qs[_0xc09a('0x47')](_[_0xc09a('0x51')](_0x53803e[_0xc09a('0x46')],_0x252890[_0xc09a('0x47')]));_0x577a63[_0xc09a('0x50')][_0xc09a('0x6f')]=_0x58f1ad['id'];if(_0x53803e[_0xc09a('0x46')][_0xc09a('0x52')]){_0x577a63[_0xc09a('0x50')]=_[_0xc09a('0x54')](_0x577a63['where'],{'$or':_[_0xc09a('0x41')](_0x577a63['attributes'],function(_0x5d5114){var _0x5bc616={};_0x5bc616[_0x5d5114]={'$like':'%'+_0x53803e[_0xc09a('0x46')][_0xc09a('0x52')]+'%'};return _0x5bc616;})});}_0x577a63=_[_0xc09a('0x54')]({},_0x577a63,_0x53803e[_0xc09a('0x55')]);return db[_0xc09a('0x6d')]['count']({'where':_0x577a63[_0xc09a('0x50')]})['then'](function(_0x352c3f){_0x3a31bd[_0xc09a('0x57')]=_0x352c3f;if(_0x53803e[_0xc09a('0x46')][_0xc09a('0x5e')]){_0x577a63[_0xc09a('0x58')]=[{'all':!![]}];}return db[_0xc09a('0x6d')]['findAll'](_0x577a63);})[_0xc09a('0x26')](function(_0x1aaf59){_0x3a31bd[_0xc09a('0x6a')]=_0x1aaf59;return _0x3a31bd;});}})['then'](respondWithFilteredResult(_0x43e97c,_0x577a63))[_0xc09a('0x2e')](handleError(_0x43e97c,null));};exports[_0xc09a('0x70')]=function(_0x5b2504,_0x8aac77,_0x1df847){return db['OpenchannelAccount'][_0xc09a('0x5f')]({'where':{'id':_0x5b2504[_0xc09a('0x5b')]['id']}})[_0xc09a('0x26')](handleEntityNotFound(_0x8aac77,null))['then'](function(_0x1868bf){if(_0x1868bf){return _0x1868bf[_0xc09a('0x70')](_0x5b2504[_0xc09a('0x46')][_0xc09a('0x71')]);}})[_0xc09a('0x26')](respondWithStatusCode(_0x8aac77,null))[_0xc09a('0x2e')](handleError(_0x8aac77,null));};exports[_0xc09a('0x72')]=function(_0x364a03,_0x2a878c,_0x596d43){var _0xa03d9={'body':_0x364a03[_0xc09a('0x61')],'channel':'openchannel'};var _0x53e556=[];var _0x5613f7=[];var _0x14afc2={};var _0x44a032=![];return db[_0xc09a('0x73')][_0xc09a('0x65')]()[_0xc09a('0x26')](function(_0x1e5031){if(!_0x1e5031){throw new db[(_0xc09a('0x24'))][(_0xc09a('0x25'))](_0xc09a('0x74'));}_0x53e556=_[_0xc09a('0x75')](_[_0xc09a('0x5d')](_0x1e5031),[_0xc09a('0x76'),_0xc09a('0x77')]);_0x5613f7=_['difference'](_[_0xc09a('0x5d')](_0x1e5031),[_0xc09a('0x76'),'updatedAt','CompanyId',_0xc09a('0x78')]);if(_0x364a03[_0xc09a('0x61')]['id']){delete _0x364a03[_0xc09a('0x61')]['id'];}if(_[_0xc09a('0x79')](_0x364a03['body'][_0xc09a('0x7a')])){throw new db['Sequelize'][(_0xc09a('0x25'))]('from\x20is\x20mandatory');}if(_[_0xc09a('0x79')](_0x364a03[_0xc09a('0x61')]['body'])||_0x364a03[_0xc09a('0x61')][_0xc09a('0x61')]===''){throw new db[(_0xc09a('0x24'))][(_0xc09a('0x25'))](_0xc09a('0x7b'));}if(_[_0xc09a('0x79')](_0x364a03[_0xc09a('0x61')][_0xc09a('0x7c')])){throw new db['Sequelize']['ValidationError'](_0xc09a('0x7d')+_0x5613f7);}if(!_[_0xc09a('0x7e')](_0x5613f7,_0x364a03['body'][_0xc09a('0x7c')])){throw new db[(_0xc09a('0x24'))][(_0xc09a('0x25'))](_0xc09a('0x7f')+_0x5613f7);}_0x14afc2[_0x364a03[_0xc09a('0x61')][_0xc09a('0x7c')]]=_0x364a03[_0xc09a('0x61')][_0xc09a('0x7a')];})[_0xc09a('0x26')](function(){return db[_0xc09a('0x56')]['find']({'where':{'id':_0x364a03[_0xc09a('0x5b')]['id']},'include':[{'model':db[_0xc09a('0x80')],'as':'List','include':[{'model':db[_0xc09a('0x73')],'as':_0xc09a('0x81'),'where':_0x14afc2,'limit':0x1,'order':[[_0xc09a('0x77'),_0xc09a('0x82')]]}]},{'model':db[_0xc09a('0x83')],'as':_0xc09a('0x84')}]});})[_0xc09a('0x26')](handleEntityNotFound(_0x2a878c,null))[_0xc09a('0x26')](function(_0x2d95b6){if(_0x2d95b6&&_0x2d95b6[_0xc09a('0x85')]){_0xa03d9[_0xc09a('0x86')]=_0x2d95b6;_0xa03d9['applications']=_0x2d95b6[_0xc09a('0x84')];_0xa03d9['list']=_0x2d95b6[_0xc09a('0x85')];_0xa03d9['applications']=_[_0xc09a('0x87')](_0xa03d9[_0xc09a('0x88')],['priority'],[_0xc09a('0x89')]);if(_0xa03d9[_0xc09a('0x86')]['Applications']){delete _0xa03d9[_0xc09a('0x86')]['Applications'];}if(_0xa03d9[_0xc09a('0x86')]['List']&&_0xa03d9[_0xc09a('0x86')][_0xc09a('0x85')][_0xc09a('0x81')][_0xc09a('0x4b')]){return _0xa03d9[_0xc09a('0x86')]['List'][_0xc09a('0x81')][0x0];}var _0x23d4f8=_['defaults'](_0x364a03['body'],{'firstName':_0x364a03[_0xc09a('0x61')][_0xc09a('0x7a')],'ListId':_0x2d95b6[_0xc09a('0x78')]});_0x23d4f8[_0x364a03['body']['mapKey']]=_0x364a03['body']['from'];return db[_0xc09a('0x73')][_0xc09a('0x60')](_0x23d4f8,{'fields':_0x53e556,'raw':!![]});}})[_0xc09a('0x26')](handleEntityNotFound(_0x2a878c,null))['then'](function(_0x5abd04){_0xa03d9[_0xc09a('0x8a')]=_0x5abd04;if(_0x5abd04){var _0x4c2950={'ContactId':_0x5abd04['id'],'OpenchannelAccountId':_0x364a03[_0xc09a('0x5b')]['id'],'from':(_0x5abd04[_0xc09a('0x8b')]||'')+'\x20'+(_0x5abd04['lastName']||'')};var _0xa63056={'OpenchannelAccountId':_0x364a03[_0xc09a('0x5b')]['id'],'closed':![]};if(_0x364a03['body']['threadId']){_0xa63056[_0xc09a('0x8c')]=_0x364a03[_0xc09a('0x61')][_0xc09a('0x8c')];return db[_0xc09a('0x8d')][_0xc09a('0x5f')]({'where':_0xa63056})['then'](function(_0x2a5945){if(_0x2a5945){return[_0x2a5945,![]];}_0x4c2950[_0xc09a('0x8c')]=_0x364a03['body'][_0xc09a('0x8c')];_0x4c2950['externalUrl']=_0x364a03['body'][_0xc09a('0x8e')];return db[_0xc09a('0x8d')][_0xc09a('0x60')](_0x4c2950)[_0xc09a('0x26')](function(_0x5d9903){return[_0x5d9903,!![]];});});}else{_0xa63056['threadId']=null;}_0xa63056[_0xc09a('0x8f')]=_0x5abd04['id'];return db[_0xc09a('0x8d')]['find']({'where':_0xa63056})[_0xc09a('0x26')](function(_0x28b74e){if(_0x28b74e){return[_0x28b74e,![]];}return db[_0xc09a('0x8d')][_0xc09a('0x60')](_0x4c2950)[_0xc09a('0x26')](function(_0x29534d){return[_0x29534d,!![]];});});}})[_0xc09a('0x90')](function(_0x4252c0,_0x5271cb){if(_0x4252c0){_0x44a032=_0x5271cb;if(!_0x5271cb){var _0xc4fe1d={'from':(_0xa03d9[_0xc09a('0x8a')][_0xc09a('0x8b')]||'')+'\x20'+(_0xa03d9[_0xc09a('0x8a')]['lastName']||'')};if(_0x364a03[_0xc09a('0x61')][_0xc09a('0x8c')]&&_0x364a03[_0xc09a('0x61')][_0xc09a('0x91')]&&_0x364a03['body'][_0xc09a('0x8c')]!=_0x364a03['body'][_0xc09a('0x91')]){_0xc4fe1d[_0xc09a('0x8c')]=_0x364a03[_0xc09a('0x61')][_0xc09a('0x91')];}return _0x4252c0[_0xc09a('0x38')](_0xc4fe1d);}else{return _0x4252c0;}}})['then'](function(_0x42e5f1){_0xa03d9[_0xc09a('0x92')]=_0x42e5f1[_0xc09a('0x39')]({'plain':!![]});_0xa03d9[_0xc09a('0x92')][_0xc09a('0x93')]=_0x44a032;if(_0xa03d9[_0xc09a('0x92')]['created']){if(_0xa03d9[_0xc09a('0x86')][_0xc09a('0x94')]){_0xa03d9[_0xc09a('0x88')][_0xc09a('0x95')]({'id':0x0,'priority':_0xa03d9[_0xc09a('0x88')][_0xc09a('0x4b')]+0x1,'app':_0xc09a('0x96'),'appdata':'unmanaged','interval':_0xc09a('0x97')});}}return db[_0xc09a('0x98')][_0xc09a('0x60')]({'body':_0x364a03[_0xc09a('0x61')]['body'],'OpenchannelAccountId':_0x364a03[_0xc09a('0x5b')]['id'],'OpenchannelInteractionId':_0x42e5f1['id'],'direction':'in','ContactId':_0xa03d9[_0xc09a('0x8a')]['id'],'AttachmentId':_0x364a03['body']['AttachmentId']});})[_0xc09a('0x26')](function(_0x4d5a2b){_0xa03d9[_0xc09a('0x2c')]=_0x4d5a2b;if(_0xa03d9[_0xc09a('0x92')][_0xc09a('0x99')]){return db['User'][_0xc09a('0x5f')]({'attributes':['id',_0xc09a('0x3d')],'where':{'id':_0xa03d9[_0xc09a('0x92')][_0xc09a('0x99')]}})[_0xc09a('0x26')](function(_0x48c9d4){if(_0x48c9d4){_0xa03d9['applications'][_0xc09a('0x9a')]({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x48c9d4[_0xc09a('0x3d')]+','+(_0xa03d9[_0xc09a('0x86')][_0xc09a('0x9b')]||0xa),'interval':_0xc09a('0x97')});_0xa03d9[_0xc09a('0x9c')]=![];}return respondWithRpcPromise(_0xc09a('0x9d'),_0xc09a('0x9e'),_0xa03d9);});}return respondWithRpcPromise('Start',_0xc09a('0x9e'),_0xa03d9);})[_0xc09a('0x26')](function(_0x362b02){respondWithRpcPromise(_0xc09a('0x9f'),_0xc09a('0x9f'),{'event':'notify','message':_0x362b02},client9002);return _0x362b02;})[_0xc09a('0x26')](respondWithResult(_0x2a878c,null))[_0xc09a('0x2e')](handleError(_0x2a878c,null));};exports[_0xc09a('0xa0')]=function(_0x14f35a,_0x27e86a,_0x230522){return db[_0xc09a('0x56')]['findOne']({'where':{'id':_0x14f35a[_0xc09a('0x5b')]['id']}})['then'](handleEntityNotFound(_0x27e86a,null))['then'](function(_0x4f5e07){if(_0x4f5e07){return db[_0xc09a('0xa1')][_0xc09a('0xa2')](function(_0x1a294e){return db[_0xc09a('0x83')][_0xc09a('0xa3')]({'where':{'OpenchannelAccountId':_0x14f35a[_0xc09a('0x5b')]['id']},'transaction':_0x1a294e})['then'](function(_0x19a042){var _0x5df186=_[_0xc09a('0x41')](_0x14f35a[_0xc09a('0x61')],function(_0x43ee43){_0x43ee43[_0xc09a('0x6f')]=_0x14f35a['params']['id'];return _0x43ee43;});return db[_0xc09a('0x83')]['bulkCreate'](_0x5df186,{'transaction':_0x1a294e});});})[_0xc09a('0x26')](function(){return db[_0xc09a('0x83')][_0xc09a('0xa4')]({'where':{'OpenchannelAccountId':_0x14f35a[_0xc09a('0x5b')]['id']},'order':'priority'});});}})[_0xc09a('0x26')](respondWithResult(_0x27e86a,null))['catch'](handleError(_0x27e86a,null));};exports[_0xc09a('0xa5')]=function(_0x343ffb,_0x5f44ce,_0xab0077){var _0x4f41eb={};var _0x1a81e7={};var _0xc6adfe;var _0x3e12b9;return db[_0xc09a('0x56')][_0xc09a('0x6e')]({'where':{'id':_0x343ffb['params']['id']}})[_0xc09a('0x26')](handleEntityNotFound(_0x5f44ce,null))[_0xc09a('0x26')](function(_0x6a9ca8){if(_0x6a9ca8){_0xc6adfe=_0x6a9ca8;_0x1a81e7[_0xc09a('0x45')]=_['keys'](db[_0xc09a('0x83')]['rawAttributes']);_0x1a81e7[_0xc09a('0x46')]=_[_0xc09a('0x5d')](_0x343ffb[_0xc09a('0x46')]);_0x1a81e7['filters']=_['intersection'](_0x1a81e7[_0xc09a('0x45')],_0x1a81e7[_0xc09a('0x46')]);_0x4f41eb[_0xc09a('0x4a')]=_['intersection'](_0x1a81e7[_0xc09a('0x45')],qs[_0xc09a('0x49')](_0x343ffb[_0xc09a('0x46')]['fields']));_0x4f41eb[_0xc09a('0x4a')]=_0x4f41eb['attributes'][_0xc09a('0x4b')]?_0x4f41eb[_0xc09a('0x4a')]:_0x1a81e7[_0xc09a('0x45')];_0x4f41eb[_0xc09a('0x4e')]=qs[_0xc09a('0x4f')](_0x343ffb[_0xc09a('0x46')][_0xc09a('0x4f')]);_0x4f41eb['where']=qs[_0xc09a('0x47')](_['pick'](_0x343ffb[_0xc09a('0x46')],_0x1a81e7[_0xc09a('0x47')]));if(_0x343ffb['query'][_0xc09a('0x52')]){_0x4f41eb[_0xc09a('0x50')]=_['merge'](_0x4f41eb[_0xc09a('0x50')],{'$or':_['map'](_0x4f41eb[_0xc09a('0x4a')],function(_0x2378f6){var _0x481bed={};_0x481bed[_0x2378f6]={'$like':'%'+_0x343ffb[_0xc09a('0x46')][_0xc09a('0x52')]+'%'};return _0x481bed;})});}_0x4f41eb=_['merge']({},_0x4f41eb,_0x343ffb[_0xc09a('0x55')]);return _0xc6adfe[_0xc09a('0xa5')](_0x4f41eb);}})[_0xc09a('0x26')](function(_0x58223b){if(_0x58223b){_0x3e12b9=_0x58223b[_0xc09a('0x4b')];if(!_0x343ffb[_0xc09a('0x46')][_0xc09a('0x4c')](_0xc09a('0x4d'))){_0x4f41eb[_0xc09a('0x34')]=qs[_0xc09a('0x34')](_0x343ffb[_0xc09a('0x46')]['limit']);_0x4f41eb[_0xc09a('0x33')]=qs[_0xc09a('0x33')](_0x343ffb['query']['offset']);}return _0xc6adfe[_0xc09a('0xa5')](_0x4f41eb);}})[_0xc09a('0x26')](function(_0x432004){if(_0x432004){return _0x432004?{'count':_0x3e12b9,'rows':_0x432004}:null;}})[_0xc09a('0x26')](respondWithResult(_0x5f44ce,null))[_0xc09a('0x2e')](handleError(_0x5f44ce,null));};exports[_0xc09a('0xa6')]=function(_0x41b2a4,_0x52e80f,_0x62f26f){var _0x1276be={'raw':![],'where':{}};var _0x2c027f={};var _0x39344e={'count':0x0,'rows':[]};return db['OpenchannelAccount']['findOne']({'where':{'id':_0x41b2a4[_0xc09a('0x5b')]['id']}})[_0xc09a('0x26')](handleEntityNotFound(_0x52e80f,null))[_0xc09a('0x26')](function(_0x18e468){if(_0x18e468){_0x2c027f[_0xc09a('0x45')]=_[_0xc09a('0x5d')](db[_0xc09a('0x8d')]['rawAttributes']);_0x2c027f[_0xc09a('0x46')]=_[_0xc09a('0x5d')](_0x41b2a4['query']);_0x2c027f['filters']=_[_0xc09a('0x48')](_0x2c027f[_0xc09a('0x45')],_0x2c027f[_0xc09a('0x46')]);_0x1276be[_0xc09a('0x4a')]=_[_0xc09a('0x48')](_0x2c027f[_0xc09a('0x45')],qs[_0xc09a('0x49')](_0x41b2a4[_0xc09a('0x46')][_0xc09a('0x49')]));_0x1276be[_0xc09a('0x4a')]=_0x1276be[_0xc09a('0x4a')][_0xc09a('0x4b')]?_0x1276be[_0xc09a('0x4a')]:_0x2c027f[_0xc09a('0x45')];if(!_0x41b2a4[_0xc09a('0x46')][_0xc09a('0x4c')](_0xc09a('0x4d'))){_0x1276be[_0xc09a('0x34')]=qs['limit'](_0x41b2a4[_0xc09a('0x46')][_0xc09a('0x34')]);_0x1276be[_0xc09a('0x33')]=qs['offset'](_0x41b2a4[_0xc09a('0x46')][_0xc09a('0x33')]);}_0x1276be['order']=qs[_0xc09a('0x4f')](_0x41b2a4[_0xc09a('0x46')]['sort']);_0x1276be['where']=qs[_0xc09a('0x47')](_[_0xc09a('0x51')](_0x41b2a4['query'],_0x2c027f[_0xc09a('0x47')]));_0x1276be[_0xc09a('0x50')][_0xc09a('0x6f')]=_0x18e468['id'];if(_0x41b2a4[_0xc09a('0x46')][_0xc09a('0x52')]){_0x1276be[_0xc09a('0x50')]=_['merge'](_0x1276be[_0xc09a('0x50')],{'$or':_['map'](_0x1276be[_0xc09a('0x4a')],function(_0x5856f2){var _0x256d02={};_0x256d02[_0x5856f2]={'$like':'%'+_0x41b2a4[_0xc09a('0x46')][_0xc09a('0x52')]+'%'};return _0x256d02;})});}_0x1276be=_[_0xc09a('0x54')]({},_0x1276be,_0x41b2a4[_0xc09a('0x55')]);return db[_0xc09a('0x8d')][_0xc09a('0x57')]({'where':_0x1276be[_0xc09a('0x50')]})['then'](function(_0x48e897){_0x39344e[_0xc09a('0x57')]=_0x48e897;if(_0x41b2a4[_0xc09a('0x46')][_0xc09a('0x5e')]){_0x1276be[_0xc09a('0x58')]=[{'model':db['CmContact'],'as':_0xc09a('0xa7'),'required':![]},{'model':db[_0xc09a('0xa8')],'as':_0xc09a('0xa9'),'attributes':['name',_0xc09a('0xaa'),'internal'],'required':![]},{'model':db['Tag'],'as':_0xc09a('0xab'),'attributes':['id',_0xc09a('0x3d'),_0xc09a('0xac')],'where':_0x41b2a4['query'][_0xc09a('0xad')]?{'id':_0x41b2a4[_0xc09a('0x46')][_0xc09a('0xad')]}:undefined,'required':_0x41b2a4[_0xc09a('0x46')]['tag']?!![]:![]}];}return db[_0xc09a('0x8d')][_0xc09a('0x59')](_0x1276be);})['then'](function(_0x18ff7b){_0x39344e[_0xc09a('0x6a')]=_0x18ff7b;return _0x39344e;});}})['then'](respondWithFilteredResult(_0x52e80f,_0x1276be))[_0xc09a('0x2e')](handleError(_0x52e80f,null));};exports[_0xc09a('0xae')]=function(_0x45647b,_0x54bfc1,_0x59f51a){return db[_0xc09a('0x56')][_0xc09a('0x5f')]({'where':{'id':_0x45647b[_0xc09a('0x5b')]['id']}})['then'](handleEntityNotFound(_0x54bfc1,null))['then'](function(_0x41733e){if(_0x41733e){return _0x41733e[_0xc09a('0xae')](_0x45647b[_0xc09a('0x61')][_0xc09a('0x71')],_[_0xc09a('0xaf')](_0x45647b['body'],['ids','id'])||{})['spread'](function(_0x4db9c4){for(var _0x2b9b64=0x0;_0x2b9b64<_0x45647b['body']['ids'][_0xc09a('0x4b')];_0x2b9b64+=0x1){socket['emit'](_0xc09a('0xb0'),{'UserId':_0x45647b[_0xc09a('0x61')]['ids'][_0x2b9b64],'OpenchannelAccountId':_0x45647b[_0xc09a('0x5b')]['id']});}return _0x4db9c4;});}})[_0xc09a('0x26')](respondWithResult(_0x54bfc1,null))[_0xc09a('0x2e')](handleError(_0x54bfc1,null));};exports['removeAgents']=function(_0x4f355a,_0x566f1c,_0xaa2b87){return db[_0xc09a('0x56')][_0xc09a('0x5f')]({'where':{'id':_0x4f355a[_0xc09a('0x5b')]['id']}})[_0xc09a('0x26')](handleEntityNotFound(_0x566f1c,null))[_0xc09a('0x26')](function(_0x5f0cc7){if(_0x5f0cc7){return _0x5f0cc7[_0xc09a('0xb1')](_0x4f355a[_0xc09a('0x46')][_0xc09a('0x71')])[_0xc09a('0x26')](function(){if(_[_0xc09a('0xb2')](_0x4f355a['query'][_0xc09a('0x71')])){for(var _0x56c248=0x0;_0x56c248<_0x4f355a[_0xc09a('0x46')][_0xc09a('0x71')][_0xc09a('0x4b')];_0x56c248+=0x1){socket[_0xc09a('0xb3')](_0xc09a('0xb4'),{'UserId':Number(_0x4f355a[_0xc09a('0x46')][_0xc09a('0x71')][_0x56c248]),'OpenchannelAccountId':Number(_0x4f355a[_0xc09a('0x5b')]['id'])});}}else{socket[_0xc09a('0xb3')](_0xc09a('0xb4'),{'UserId':Number(_0x4f355a[_0xc09a('0x46')][_0xc09a('0x71')]),'OpenchannelAccountId':Number(_0x4f355a['params']['id'])});}});}})[_0xc09a('0x26')](respondWithStatusCode(_0x566f1c,null))['catch'](handleError(_0x566f1c,null));};exports[_0xc09a('0xb5')]=function(_0x5cc03c,_0x573f35,_0x4b00e0){var _0x48734b={};var _0x86ae51={};var _0x35e82d;var _0xa71fb;return db[_0xc09a('0x56')][_0xc09a('0x6e')]({'where':{'id':_0x5cc03c[_0xc09a('0x5b')]['id']}})[_0xc09a('0x26')](handleEntityNotFound(_0x573f35,null))['then'](function(_0x2feb75){if(_0x2feb75){_0x35e82d=_0x2feb75;_0x86ae51[_0xc09a('0x45')]=_[_0xc09a('0x5d')](db[_0xc09a('0xa8')][_0xc09a('0x42')]);_0x86ae51[_0xc09a('0x46')]=_[_0xc09a('0x5d')](_0x5cc03c[_0xc09a('0x46')]);_0x86ae51[_0xc09a('0x47')]=_['intersection'](_0x86ae51[_0xc09a('0x45')],_0x86ae51[_0xc09a('0x46')]);_0x48734b[_0xc09a('0x4a')]=_[_0xc09a('0x48')](_0x86ae51['model'],qs[_0xc09a('0x49')](_0x5cc03c['query'][_0xc09a('0x49')]));_0x48734b[_0xc09a('0x4a')]=_0x48734b[_0xc09a('0x4a')][_0xc09a('0x4b')]?_0x48734b[_0xc09a('0x4a')]:_0x86ae51[_0xc09a('0x45')];_0x48734b[_0xc09a('0x4e')]=qs[_0xc09a('0x4f')](_0x5cc03c[_0xc09a('0x46')]['sort']);_0x48734b[_0xc09a('0x50')]=qs['filters'](_['pick'](_0x5cc03c['query'],_0x86ae51[_0xc09a('0x47')]));if(_0x5cc03c[_0xc09a('0x46')]['filter']){_0x48734b[_0xc09a('0x50')]=_[_0xc09a('0x54')](_0x48734b[_0xc09a('0x50')],{'$or':_[_0xc09a('0x41')](_0x48734b[_0xc09a('0x4a')],function(_0x1774d7){var _0xe46577={};_0xe46577[_0x1774d7]={'$like':'%'+_0x5cc03c['query'][_0xc09a('0x52')]+'%'};return _0xe46577;})});}_0x48734b=_[_0xc09a('0x54')]({},_0x48734b,_0x5cc03c['options']);return _0x35e82d['getAgents'](_0x48734b);}})[_0xc09a('0x26')](function(_0x16eab4){if(_0x16eab4){_0xa71fb=_0x16eab4['length'];if(!_0x5cc03c[_0xc09a('0x46')]['hasOwnProperty'](_0xc09a('0x4d'))){_0x48734b['limit']=qs[_0xc09a('0x34')](_0x5cc03c['query']['limit']);_0x48734b[_0xc09a('0x33')]=qs[_0xc09a('0x33')](_0x5cc03c['query'][_0xc09a('0x33')]);}return _0x35e82d[_0xc09a('0xb5')](_0x48734b);}})[_0xc09a('0x26')](function(_0x5d4e89){if(_0x5d4e89){return _0x5d4e89?{'count':_0xa71fb,'rows':_0x5d4e89}:null;}})[_0xc09a('0x26')](respondWithResult(_0x573f35,null))[_0xc09a('0x2e')](handleError(_0x573f35,null));};exports[_0xc09a('0x3e')]=function(_0xd78f93,_0x20889e,_0x27ed9d){var _0x577a3d,_0x11fc57,_0x5d3589;if(_[_0xc09a('0x79')](_0xd78f93['body'][_0xc09a('0x61')])||_0xd78f93[_0xc09a('0x61')]['body']===''){throw new db[(_0xc09a('0x24'))]['ValidationError'](_0xc09a('0x7b'));}if(_[_0xc09a('0x79')](_0xd78f93['body']['to'])){}_0x577a3d=_0xd78f93[_0xc09a('0x61')]['to'];return db['OpenchannelAccount']['findOne']({'where':{'id':_0xd78f93['params']['id']}})['then'](handleEntityNotFound(_0x20889e,null))[_0xc09a('0x26')](function(_0x5de7e7){if(_0x5de7e7){return db[_0xc09a('0x56')]['find']({'where':{'id':_0x5de7e7['id']},'include':[{'model':db['CmList'],'as':_0xc09a('0x85'),'include':[{'model':db['CmContact'],'as':'Contacts','where':{[_0x5de7e7[_0xc09a('0x7c')]]:_0x577a3d},'limit':0x1,'order':[['updatedAt',_0xc09a('0x82')]]}]}]})[_0xc09a('0x26')](handleEntityNotFound(_0x20889e,null))[_0xc09a('0x26')](function(_0x4df509){if(_0x4df509&&_0x4df509['List']){_0x11fc57=_0x4df509[_0xc09a('0x39')]({'plain':!![]});if(_0x11fc57[_0xc09a('0x85')]&&_0x11fc57[_0xc09a('0x85')][_0xc09a('0x81')][_0xc09a('0x4b')]){return _0x11fc57[_0xc09a('0x85')][_0xc09a('0x81')][0x0];}return db[_0xc09a('0x73')][_0xc09a('0x60')](_[_0xc09a('0xb6')](_0xd78f93[_0xc09a('0x61')],{'firstName':_0x577a3d,[_0x4df509['mapKey']]:_0x577a3d,'phone':_0x577a3d,'ListId':_0x11fc57[_0xc09a('0x78')]}));}})[_0xc09a('0x26')](handleEntityNotFound(_0x20889e,null))[_0xc09a('0x26')](function(_0x5290b7){if(_0x5290b7){_0x5d3589=_0x5290b7;return db[_0xc09a('0x8d')][_0xc09a('0x5f')]({'where':{'ContactId':_0x5d3589['id'],'closed':![],'OpenchannelAccountId':_0x11fc57['id']}})[_0xc09a('0x26')](function(_0x375f31){if(_0x375f31){return[_0x375f31,![]];}return db[_0xc09a('0x8d')][_0xc09a('0x60')]({'UserId':_0xd78f93[_0xc09a('0xb7')]['id'],'ContactId':_0x5d3589['id'],'OpenchannelAccountId':_0x11fc57['id'],'lastMsgDirection':'out','Messages':[_[_0xc09a('0x54')](_0xd78f93[_0xc09a('0x61')],{'read':![],'body':_0xd78f93[_0xc09a('0x61')][_0xc09a('0x61')],'OpenchannelAccountId':_0x11fc57['id'],'UserId':_0xd78f93['user']['id'],'ContactId':_0x5d3589['id']})]},{'include':[{'model':db[_0xc09a('0x98')],'as':_0xc09a('0xb8')}]})[_0xc09a('0x26')](function(_0x4f82c9){return[_0x4f82c9,!![]];});});}})[_0xc09a('0x90')](function(_0x5907d7,_0x2aaad2){if(_0x2aaad2){return _0x5907d7;}return db[_0xc09a('0x98')][_0xc09a('0x60')](_['merge'](_0xd78f93[_0xc09a('0x61')],{'read':![],'body':_0xd78f93[_0xc09a('0x61')]['body'],'OpenchannelAccountId':_0x11fc57['id'],'OpenchannelInteractionId':_0x5907d7['id'],'UserId':_0xd78f93['user']['id'],'ContactId':_0x5d3589['id']}))['then'](function(_0x22e82d){_0x5907d7[_0xc09a('0xb9')][_0xc09a('0xb8')]=[];_0x5907d7['dataValues'][_0xc09a('0xb8')][_0xc09a('0x95')](_0x22e82d['dataValues']);return _0x5907d7;});});}})['then'](respondWithResult(_0x20889e,null))[_0xc09a('0x2e')](handleError(_0x20889e,null));}; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.events.js b/server/api/openchannelAccount/openchannelAccount.events.js index b8124a0..a5654a7 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 _0x1b36=['hasOwnProperty','hook','events','OpenchannelAccount','setMaxListeners','save','update','emit'];(function(_0x5eb503,_0x573e74){var _0x1e5731=function(_0x5e3b81){while(--_0x5e3b81){_0x5eb503['push'](_0x5eb503['shift']());}};_0x1e5731(++_0x573e74);}(_0x1b36,0x14a));var _0x61b3=function(_0x223d60,_0x28b199){_0x223d60=_0x223d60-0x0;var _0x127026=_0x1b36[_0x223d60];return _0x127026;};'use strict';var EventEmitter=require(_0x61b3('0x0'));var OpenchannelAccount=require('../../mysqldb')['db'][_0x61b3('0x1')];var OpenchannelAccountEvents=new EventEmitter();OpenchannelAccountEvents[_0x61b3('0x2')](0x0);var events={'afterCreate':_0x61b3('0x3'),'afterUpdate':_0x61b3('0x4'),'afterDestroy':'remove'};function emitEvent(_0x486481){return function(_0x43fc4a,_0x4855e0,_0x2ead2d){OpenchannelAccountEvents[_0x61b3('0x5')](_0x486481+':'+_0x43fc4a['id'],_0x43fc4a);OpenchannelAccountEvents[_0x61b3('0x5')](_0x486481,_0x43fc4a);_0x2ead2d(null);};}for(var e in events){if(events[_0x61b3('0x6')](e)){var event=events[e];OpenchannelAccount[_0x61b3('0x7')](e,emitEvent(event));}}module['exports']=OpenchannelAccountEvents; \ No newline at end of file +var _0x9f99=['setMaxListeners','save','remove','emit','hasOwnProperty','hook','exports','events','OpenchannelAccount'];(function(_0xa83d8f,_0xdd617a){var _0x806ff=function(_0x430567){while(--_0x430567){_0xa83d8f['push'](_0xa83d8f['shift']());}};_0x806ff(++_0xdd617a);}(_0x9f99,0x139));var _0x99f9=function(_0x3ad749,_0x4afb5a){_0x3ad749=_0x3ad749-0x0;var _0x338a38=_0x9f99[_0x3ad749];return _0x338a38;};'use strict';var EventEmitter=require(_0x99f9('0x0'));var OpenchannelAccount=require('../../mysqldb')['db'][_0x99f9('0x1')];var OpenchannelAccountEvents=new EventEmitter();OpenchannelAccountEvents[_0x99f9('0x2')](0x0);var events={'afterCreate':_0x99f9('0x3'),'afterUpdate':'update','afterDestroy':_0x99f9('0x4')};function emitEvent(_0x5e3bae){return function(_0x314c9d,_0x2feeec,_0x4ec6bf){OpenchannelAccountEvents['emit'](_0x5e3bae+':'+_0x314c9d['id'],_0x314c9d);OpenchannelAccountEvents[_0x99f9('0x5')](_0x5e3bae,_0x314c9d);_0x4ec6bf(null);};}for(var e in events){if(events[_0x99f9('0x6')](e)){var event=events[e];OpenchannelAccount[_0x99f9('0x7')](e,emitEvent(event));}}module[_0x99f9('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 fcb99a2..14c611c 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 _0x7c4a=['exports','OpenchannelAccount','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./openchannelAccount.attributes'];(function(_0x16dbfd,_0x2f9431){var _0x382254=function(_0x19dade){while(--_0x19dade){_0x16dbfd['push'](_0x16dbfd['shift']());}};_0x382254(++_0x2f9431);}(_0x7c4a,0x91));var _0xa7c4=function(_0x35de8a,_0x7acd4b){_0x35de8a=_0x35de8a-0x0;var _0x9c759d=_0x7c4a[_0x35de8a];return _0x9c759d;};'use strict';var _=require('lodash');var util=require(_0xa7c4('0x0'));var logger=require(_0xa7c4('0x1'))(_0xa7c4('0x2'));var moment=require(_0xa7c4('0x3'));var BPromise=require(_0xa7c4('0x4'));var rp=require(_0xa7c4('0x5'));var fs=require('fs');var path=require(_0xa7c4('0x6'));var rimraf=require(_0xa7c4('0x7'));var config=require('../../config/environment');var attributes=require(_0xa7c4('0x8'));module[_0xa7c4('0x9')]=function(_0x20ad20,_0x199433){return _0x20ad20['define'](_0xa7c4('0xa'),attributes,{'tableName':'openchannel_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x62ac=['OpenchannelAccount','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./openchannelAccount.attributes','define'];(function(_0x5a1a12,_0x426124){var _0x2cf5c0=function(_0x1fb2db){while(--_0x1fb2db){_0x5a1a12['push'](_0x5a1a12['shift']());}};_0x2cf5c0(++_0x426124);}(_0x62ac,0x14b));var _0xc62a=function(_0x13a621,_0x29b45c){_0x13a621=_0x13a621-0x0;var _0x19c55d=_0x62ac[_0x13a621];return _0x19c55d;};'use strict';var _=require('lodash');var util=require(_0xc62a('0x0'));var logger=require(_0xc62a('0x1'))(_0xc62a('0x2'));var moment=require(_0xc62a('0x3'));var BPromise=require(_0xc62a('0x4'));var rp=require(_0xc62a('0x5'));var fs=require('fs');var path=require(_0xc62a('0x6'));var rimraf=require(_0xc62a('0x7'));var config=require('../../config/environment');var attributes=require(_0xc62a('0x8'));module['exports']=function(_0x3bce1e,_0x13e182){return _0x3bce1e[_0xc62a('0x9')](_0xc62a('0xa'),attributes,{'tableName':'openchannel_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.rpc.js b/server/api/openchannelAccount/openchannelAccount.rpc.js index a6b41db..bf0cd4c 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 _0xf40b=['../../config/logger','rpc','jayson/promise','redis','defaults','localhost','./openchannelAccount.socket','register','request','then','info','request\x20sent','debug','OpenchannelAccount,\x20%s,\x20%s,\x20%s','stringify','error','OpenchannelAccount,\x20%s,\x20%s','message','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb'];(function(_0x30867b,_0x33dc11){var _0x2bd3bc=function(_0x25c1f1){while(--_0x25c1f1){_0x30867b['push'](_0x30867b['shift']());}};_0x2bd3bc(++_0x33dc11);}(_0xf40b,0x13f));var _0xbf40=function(_0x543c51,_0xff0084){_0x543c51=_0x543c51-0x0;var _0x360555=_0xf40b[_0x543c51];return _0x360555;};'use strict';var _=require(_0xbf40('0x0'));var util=require(_0xbf40('0x1'));var moment=require(_0xbf40('0x2'));var BPromise=require(_0xbf40('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xbf40('0x4'));var db=require(_0xbf40('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xbf40('0x6'))(_0xbf40('0x7'));var config=require('../../config/environment');var jayson=require(_0xbf40('0x8'));var client=jayson['client']['http']({'port':0x232a});config[_0xbf40('0x9')]=_[_0xbf40('0xa')](config[_0xbf40('0x9')],{'host':_0xbf40('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xbf40('0x9')]));require(_0xbf40('0xc'))[_0xbf40('0xd')](socket);function respondWithRpcPromise(_0x3fa8c6,_0x1a9638,_0x28d664){return new BPromise(function(_0x15e77c,_0x4ef440){return client[_0xbf40('0xe')](_0x3fa8c6,_0x28d664)[_0xbf40('0xf')](function(_0x3b0864){logger[_0xbf40('0x10')]('OpenchannelAccount,\x20%s,\x20%s',_0x1a9638,_0xbf40('0x11'));logger[_0xbf40('0x12')](_0xbf40('0x13'),_0x1a9638,'request\x20sent',JSON[_0xbf40('0x14')](_0x3b0864));if(_0x3b0864[_0xbf40('0x15')]){if(_0x3b0864[_0xbf40('0x15')]['code']===0x1f4){logger[_0xbf40('0x15')]('OpenchannelAccount,\x20%s,\x20%s',_0x1a9638,_0x3b0864['error']['message']);return _0x4ef440(_0x3b0864[_0xbf40('0x15')]['message']);}logger['error'](_0xbf40('0x16'),_0x1a9638,_0x3b0864[_0xbf40('0x15')][_0xbf40('0x17')]);return _0x15e77c(_0x3b0864[_0xbf40('0x15')]['message']);}else{logger[_0xbf40('0x10')](_0xbf40('0x16'),_0x1a9638,'request\x20sent');_0x15e77c(_0x3b0864['result']['message']);}})[_0xbf40('0x18')](function(_0x17adb4){logger['error'](_0xbf40('0x16'),_0x1a9638,_0x17adb4);_0x4ef440(_0x17adb4);});});} \ No newline at end of file +var _0xc190=['bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','redis','defaults','localhost','socket.io-emitter','./openchannelAccount.socket','register','request','info','OpenchannelAccount,\x20%s,\x20%s','request\x20sent','OpenchannelAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util'];(function(_0x199bc4,_0x338105){var _0x136ffb=function(_0x3e7ced){while(--_0x3e7ced){_0x199bc4['push'](_0x199bc4['shift']());}};_0x136ffb(++_0x338105);}(_0xc190,0x85));var _0x0c19=function(_0x47a1c1,_0x27cc80){_0x47a1c1=_0x47a1c1-0x0;var _0x161ae3=_0xc190[_0x47a1c1];return _0x161ae3;};'use strict';var _=require(_0x0c19('0x0'));var util=require(_0x0c19('0x1'));var moment=require('moment');var BPromise=require(_0x0c19('0x2'));var rs=require(_0x0c19('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x0c19('0x4'))['db'];var utils=require(_0x0c19('0x5'));var logger=require('../../config/logger')(_0x0c19('0x6'));var config=require(_0x0c19('0x7'));var jayson=require(_0x0c19('0x8'));var client=jayson[_0x0c19('0x9')]['http']({'port':0x232a});config[_0x0c19('0xa')]=_[_0x0c19('0xb')](config[_0x0c19('0xa')],{'host':_0x0c19('0xc'),'port':0x18eb});var socket=require(_0x0c19('0xd'))(new Redis(config[_0x0c19('0xa')]));require(_0x0c19('0xe'))[_0x0c19('0xf')](socket);function respondWithRpcPromise(_0x2360b6,_0x24f266,_0x368271){return new BPromise(function(_0x4079cf,_0x2d142c){return client[_0x0c19('0x10')](_0x2360b6,_0x368271)['then'](function(_0x23558e){logger[_0x0c19('0x11')](_0x0c19('0x12'),_0x24f266,_0x0c19('0x13'));logger['debug'](_0x0c19('0x14'),_0x24f266,_0x0c19('0x13'),JSON[_0x0c19('0x15')](_0x23558e));if(_0x23558e[_0x0c19('0x16')]){if(_0x23558e[_0x0c19('0x16')][_0x0c19('0x17')]===0x1f4){logger[_0x0c19('0x16')](_0x0c19('0x12'),_0x24f266,_0x23558e[_0x0c19('0x16')][_0x0c19('0x18')]);return _0x2d142c(_0x23558e[_0x0c19('0x16')]['message']);}logger[_0x0c19('0x16')](_0x0c19('0x12'),_0x24f266,_0x23558e['error'][_0x0c19('0x18')]);return _0x4079cf(_0x23558e[_0x0c19('0x16')]['message']);}else{logger['info']('OpenchannelAccount,\x20%s,\x20%s',_0x24f266,_0x0c19('0x13'));_0x4079cf(_0x23558e[_0x0c19('0x19')][_0x0c19('0x18')]);}})[_0x0c19('0x1a')](function(_0x59f2f2){logger[_0x0c19('0x16')](_0x0c19('0x12'),_0x24f266,_0x59f2f2);_0x2d142c(_0x59f2f2);});});} \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.socket.js b/server/api/openchannelAccount/openchannelAccount.socket.js index ce82f84..efde47e 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 _0x4de7=['length','save','remove','update','emit','removeListener','register'];(function(_0x4a8516,_0x2f523b){var _0xee13aa=function(_0x41bfc6){while(--_0x41bfc6){_0x4a8516['push'](_0x4a8516['shift']());}};_0xee13aa(++_0x2f523b);}(_0x4de7,0x1c1));var _0x74de=function(_0x4bfea5,_0x310c8d){_0x4bfea5=_0x4bfea5-0x0;var _0xd41d7c=_0x4de7[_0x4bfea5];return _0xd41d7c;};'use strict';var OpenchannelAccountEvents=require('./openchannelAccount.events');var events=[_0x74de('0x0'),_0x74de('0x1'),_0x74de('0x2')];function createListener(_0x38101c,_0x19f1b1){return function(_0x58c8e0){_0x19f1b1[_0x74de('0x3')](_0x38101c,_0x58c8e0);};}function removeListener(_0x3858a5,_0x5a3386){return function(){OpenchannelAccountEvents[_0x74de('0x4')](_0x3858a5,_0x5a3386);};}exports[_0x74de('0x5')]=function(_0x581a0c){for(var _0x1b4bff=0x0,_0x4eef03=events[_0x74de('0x6')];_0x1b4bff<_0x4eef03;_0x1b4bff++){var _0x1d9507=events[_0x1b4bff];var _0x11c093=createListener('openchannelAccount:'+_0x1d9507,_0x581a0c);OpenchannelAccountEvents['on'](_0x1d9507,_0x11c093);}}; \ No newline at end of file +var _0x7740=['length','./openchannelAccount.events','save','remove','update'];(function(_0x126e2f,_0x3e6c2d){var _0x2bb62f=function(_0x1b498d){while(--_0x1b498d){_0x126e2f['push'](_0x126e2f['shift']());}};_0x2bb62f(++_0x3e6c2d);}(_0x7740,0x12d));var _0x0774=function(_0x1db831,_0x42b7b5){_0x1db831=_0x1db831-0x0;var _0x39ba56=_0x7740[_0x1db831];return _0x39ba56;};'use strict';var OpenchannelAccountEvents=require(_0x0774('0x0'));var events=[_0x0774('0x1'),_0x0774('0x2'),_0x0774('0x3')];function createListener(_0x55fd1a,_0x232476){return function(_0x5e676e){_0x232476['emit'](_0x55fd1a,_0x5e676e);};}function removeListener(_0xbccd25,_0xfd2949){return function(){OpenchannelAccountEvents['removeListener'](_0xbccd25,_0xfd2949);};}exports['register']=function(_0x1a20ea){for(var _0x3163ba=0x0,_0x7866b5=events[_0x0774('0x4')];_0x3163ba<_0x7866b5;_0x3163ba++){var _0x406cb1=events[_0x3163ba];var _0x2ef1aa=createListener('openchannelAccount:'+_0x406cb1,_0x1a20ea);OpenchannelAccountEvents['on'](_0x406cb1,_0x2ef1aa);}}; \ No newline at end of file diff --git a/server/api/openchannelApplication/index.js b/server/api/openchannelApplication/index.js index 9455a0c..f3b0c57 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 _0x5228=['post','create','put','/:id','update','delete','exports','multer','util','path','connect-timeout','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelApplication.controller','isAuthenticated','show'];(function(_0x42bb6d,_0x412255){var _0x1db89b=function(_0x5da43a){while(--_0x5da43a){_0x42bb6d['push'](_0x42bb6d['shift']());}};_0x1db89b(++_0x412255);}(_0x5228,0x17d));var _0x8522=function(_0x1e867a,_0x135291){_0x1e867a=_0x1e867a-0x0;var _0x5ac9a2=_0x5228[_0x1e867a];return _0x5ac9a2;};'use strict';var multer=require(_0x8522('0x0'));var util=require(_0x8522('0x1'));var path=require(_0x8522('0x2'));var timeout=require(_0x8522('0x3'));var express=require('express');var router=express['Router']();var auth=require(_0x8522('0x4'));var interaction=require(_0x8522('0x5'));var config=require(_0x8522('0x6'));var controller=require(_0x8522('0x7'));router['get']('/',auth[_0x8522('0x8')](),controller['index']);router['get']('/:id',auth[_0x8522('0x8')](),controller[_0x8522('0x9')]);router[_0x8522('0xa')]('/',auth[_0x8522('0x8')](),controller[_0x8522('0xb')]);router[_0x8522('0xc')](_0x8522('0xd'),auth[_0x8522('0x8')](),controller[_0x8522('0xe')]);router[_0x8522('0xf')]('/:id',auth[_0x8522('0x8')](),controller['destroy']);module[_0x8522('0x10')]=router; \ No newline at end of file +var _0x5cf7=['path','express','../../components/auth/service','get','index','/:id','show','isAuthenticated','create','put','update','destroy','exports','multer','util'];(function(_0xbf8ebe,_0x3b69a5){var _0x1e25e8=function(_0x40c390){while(--_0x40c390){_0xbf8ebe['push'](_0xbf8ebe['shift']());}};_0x1e25e8(++_0x3b69a5);}(_0x5cf7,0x85));var _0x75cf=function(_0x3ae42b,_0x34399c){_0x3ae42b=_0x3ae42b-0x0;var _0x292eaf=_0x5cf7[_0x3ae42b];return _0x292eaf;};'use strict';var multer=require(_0x75cf('0x0'));var util=require(_0x75cf('0x1'));var path=require(_0x75cf('0x2'));var timeout=require('connect-timeout');var express=require(_0x75cf('0x3'));var router=express['Router']();var auth=require(_0x75cf('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./openchannelApplication.controller');router[_0x75cf('0x5')]('/',auth['isAuthenticated'](),controller[_0x75cf('0x6')]);router['get'](_0x75cf('0x7'),auth['isAuthenticated'](),controller[_0x75cf('0x8')]);router['post']('/',auth[_0x75cf('0x9')](),controller[_0x75cf('0xa')]);router[_0x75cf('0xb')](_0x75cf('0x7'),auth[_0x75cf('0x9')](),controller[_0x75cf('0xc')]);router['delete']('/:id',auth[_0x75cf('0x9')](),controller[_0x75cf('0xd')]);module[_0x75cf('0xe')]=router; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.attributes.js b/server/api/openchannelApplication/openchannelApplication.attributes.js index 51773aa..85f4c05 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 _0xdd4d=['STRING','noop','TEXT','sequelize','exports'];(function(_0x2780de,_0x4738ce){var _0x497dc7=function(_0x3be870){while(--_0x3be870){_0x2780de['push'](_0x2780de['shift']());}};_0x497dc7(++_0x4738ce);}(_0xdd4d,0x17f));var _0xddd4=function(_0x3d21b7,_0x21ccfa){_0x3d21b7=_0x3d21b7-0x0;var _0x219184=_0xdd4d[_0x3d21b7];return _0x219184;};'use strict';var Sequelize=require(_0xddd4('0x0'));module[_0xddd4('0x1')]={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize[_0xddd4('0x2')],'allowNull':![],'defaultValue':_0xddd4('0x3')},'appdata':{'type':Sequelize[_0xddd4('0x4')]()},'description':{'type':Sequelize[_0xddd4('0x2')]},'interval':{'type':Sequelize[_0xddd4('0x2')],'defaultValue':'*,*,*,*'}}; \ No newline at end of file +var _0x5b28=['exports','INTEGER','STRING','noop','TEXT','*,*,*,*','sequelize'];(function(_0x9922e8,_0x4da924){var _0x10e335=function(_0x1c72ab){while(--_0x1c72ab){_0x9922e8['push'](_0x9922e8['shift']());}};_0x10e335(++_0x4da924);}(_0x5b28,0x148));var _0x85b2=function(_0x4d54d3,_0x3169fb){_0x4d54d3=_0x4d54d3-0x0;var _0x4eacc5=_0x5b28[_0x4d54d3];return _0x4eacc5;};'use strict';var Sequelize=require(_0x85b2('0x0'));module[_0x85b2('0x1')]={'priority':{'type':Sequelize[_0x85b2('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0x85b2('0x3')],'allowNull':![],'defaultValue':_0x85b2('0x4')},'appdata':{'type':Sequelize[_0x85b2('0x5')]()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0x85b2('0x3')],'defaultValue':_0x85b2('0x6')}}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.controller.js b/server/api/openchannelApplication/openchannelApplication.controller.js index 2daafe8..79b6c39 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 _0x721c=['merge','type','VIRTUAL','filter','options','includeAll','findAll','rows','show','params','rawAttributes','intersection','include','find','create','body','catch','update','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','path','sox','to-csv','ejs','squel','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','set','Content-Range','apply','save','destroy','then','error','stack','name','send','map','OpenchannelApplication','fieldName','key','model','query','keys','attributes','fields','length','nolimit','limit','sort','where','filters','pick'];(function(_0x409353,_0xe9f04d){var _0x4f4b59=function(_0x64b587){while(--_0x64b587){_0x409353['push'](_0x409353['shift']());}};_0x4f4b59(++_0xe9f04d);}(_0x721c,0x17a));var _0xc721=function(_0xb8f757,_0x20123e){_0xb8f757=_0xb8f757-0x0;var _0x55b846=_0x721c[_0xb8f757];return _0x55b846;};'use strict';var pdf=require(_0xc721('0x0'));var emlformat=require(_0xc721('0x1'));var rimraf=require(_0xc721('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0xc721('0x3'));var rp=require(_0xc721('0x4'));var moment=require(_0xc721('0x5'));var BPromise=require(_0xc721('0x6'));var Mustache=require('mustache');var util=require('util');var path=require(_0xc721('0x7'));var sox=require(_0xc721('0x8'));var csv=require(_0xc721('0x9'));var ejs=require(_0xc721('0xa'));var fs=require('fs');var _=require('lodash');var squel=require(_0xc721('0xb'));var crypto=require(_0xc721('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xc721('0xd'));var Papa=require(_0xc721('0xe'));var Redis=require(_0xc721('0xf'));var authService=require(_0xc721('0x10'));var qs=require(_0xc721('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xc721('0x12'))(_0xc721('0x13'));var utils=require('../../config/utils');var config=require(_0xc721('0x14'));var db=require(_0xc721('0x15'))['db'];function respondWithStatusCode(_0x19e03e,_0x4d557b){_0x4d557b=_0x4d557b||0xcc;return function(_0x3cacc2){if(_0x3cacc2){return _0x19e03e[_0xc721('0x16')](_0x4d557b);}return _0x19e03e[_0xc721('0x17')](_0x4d557b)[_0xc721('0x18')]();};}function respondWithResult(_0x308cfc,_0xa38f2f){_0xa38f2f=_0xa38f2f||0xc8;return function(_0x35baed){if(_0x35baed){return _0x308cfc['status'](_0xa38f2f)[_0xc721('0x19')](_0x35baed);}};}function respondWithFilteredResult(_0x15c8d3,_0x253387){return function(_0x536473){if(_0x536473){var _0x35b045=_0x536473[_0xc721('0x1a')],_0x570a72=_0x253387[_0xc721('0x1b')],_0x177405=_0x253387[_0xc721('0x1b')]+_0x253387['limit'],_0x474070;if(_0x177405>=_0x35b045){_0x177405=_0x35b045;_0x474070=0xc8;}else{_0x474070=0xce;}_0x15c8d3[_0xc721('0x17')](_0x474070);return _0x15c8d3[_0xc721('0x1c')](_0xc721('0x1d'),_0x570a72+'-'+_0x177405+'/'+_0x35b045)[_0xc721('0x19')](_0x536473);}return null;};}function patchUpdates(_0x44a070){return function(_0x2a7779){try{jsonpatch[_0xc721('0x1e')](_0x2a7779,_0x44a070,!![]);}catch(_0x4c8c9a){return BPromise['reject'](_0x4c8c9a);}return _0x2a7779[_0xc721('0x1f')]();};}function saveUpdates(_0x2450b8,_0x145583){return function(_0x3317c8){if(_0x3317c8){return _0x3317c8['update'](_0x2450b8)['then'](function(_0x4da5ff){return _0x4da5ff;});}return null;};}function removeEntity(_0x16ddf0,_0x16bf21){return function(_0x4e635b){if(_0x4e635b){return _0x4e635b[_0xc721('0x20')]()[_0xc721('0x21')](function(){_0x16ddf0[_0xc721('0x17')](0xcc)[_0xc721('0x18')]();});}};}function handleEntityNotFound(_0x265995,_0x277af9){return function(_0x5c69ae){if(!_0x5c69ae){_0x265995['sendStatus'](0x194);}return _0x5c69ae;};}function handleError(_0x3e6e1c,_0x379f0c){_0x379f0c=_0x379f0c||0x1f4;return function(_0x56d380){logger[_0xc721('0x22')](_0x56d380[_0xc721('0x23')]);if(_0x56d380['name']){delete _0x56d380[_0xc721('0x24')];}_0x3e6e1c[_0xc721('0x17')](_0x379f0c)[_0xc721('0x25')](_0x56d380);};}exports['index']=function(_0x47d410,_0x3d6939){var _0x56176d={},_0x5ae99f={},_0x204733={'count':0x0,'rows':[]};var _0x2fb0d9=_[_0xc721('0x26')](db[_0xc721('0x27')]['rawAttributes'],function(_0x3d4ea6){return{'name':_0x3d4ea6[_0xc721('0x28')],'type':_0x3d4ea6['type'][_0xc721('0x29')]};});_0x5ae99f[_0xc721('0x2a')]=_[_0xc721('0x26')](_0x2fb0d9,_0xc721('0x24'));_0x5ae99f[_0xc721('0x2b')]=_[_0xc721('0x2c')](_0x47d410['query']);_0x5ae99f['filters']=_['intersection'](_0x5ae99f[_0xc721('0x2a')],_0x5ae99f['query']);_0x56176d[_0xc721('0x2d')]=_['intersection'](_0x5ae99f[_0xc721('0x2a')],qs[_0xc721('0x2e')](_0x47d410['query'][_0xc721('0x2e')]));_0x56176d[_0xc721('0x2d')]=_0x56176d[_0xc721('0x2d')][_0xc721('0x2f')]?_0x56176d[_0xc721('0x2d')]:_0x5ae99f[_0xc721('0x2a')];if(!_0x47d410[_0xc721('0x2b')]['hasOwnProperty'](_0xc721('0x30'))){_0x56176d[_0xc721('0x31')]=qs['limit'](_0x47d410[_0xc721('0x2b')]['limit']);_0x56176d['offset']=qs[_0xc721('0x1b')](_0x47d410[_0xc721('0x2b')][_0xc721('0x1b')]);}_0x56176d['order']=qs[_0xc721('0x32')](_0x47d410['query'][_0xc721('0x32')]);_0x56176d[_0xc721('0x33')]=qs[_0xc721('0x34')](_[_0xc721('0x35')](_0x47d410[_0xc721('0x2b')],_0x5ae99f[_0xc721('0x34')]),_0x2fb0d9);if(_0x47d410['query']['filter']){_0x56176d['where']=_[_0xc721('0x36')](_0x56176d[_0xc721('0x33')],{'$or':_[_0xc721('0x26')](_0x2fb0d9,function(_0x5a9e63){if(_0x5a9e63[_0xc721('0x37')]!==_0xc721('0x38')){var _0x4713c1={};_0x4713c1[_0x5a9e63['name']]={'$like':'%'+_0x47d410['query'][_0xc721('0x39')]+'%'};return _0x4713c1;}})});}_0x56176d=_[_0xc721('0x36')]({},_0x56176d,_0x47d410[_0xc721('0x3a')]);var _0x33b922={'where':_0x56176d[_0xc721('0x33')]};return db[_0xc721('0x27')]['count'](_0x33b922)['then'](function(_0x3cb9f2){_0x204733[_0xc721('0x1a')]=_0x3cb9f2;if(_0x47d410[_0xc721('0x2b')][_0xc721('0x3b')]){_0x56176d['include']=[{'all':!![]}];}return db[_0xc721('0x27')][_0xc721('0x3c')](_0x56176d);})[_0xc721('0x21')](function(_0x4a512d){_0x204733[_0xc721('0x3d')]=_0x4a512d;return _0x204733;})[_0xc721('0x21')](respondWithFilteredResult(_0x3d6939,_0x56176d))['catch'](handleError(_0x3d6939,null));};exports[_0xc721('0x3e')]=function(_0x3bb77f,_0x2b6f19){var _0x279a67={'raw':!![],'where':{'id':_0x3bb77f[_0xc721('0x3f')]['id']}},_0x57ad29={};_0x57ad29[_0xc721('0x2a')]=_[_0xc721('0x2c')](db[_0xc721('0x27')][_0xc721('0x40')]);_0x57ad29[_0xc721('0x2b')]=_[_0xc721('0x2c')](_0x3bb77f[_0xc721('0x2b')]);_0x57ad29[_0xc721('0x34')]=_['intersection'](_0x57ad29['model'],_0x57ad29[_0xc721('0x2b')]);_0x279a67[_0xc721('0x2d')]=_[_0xc721('0x41')](_0x57ad29[_0xc721('0x2a')],qs[_0xc721('0x2e')](_0x3bb77f['query'][_0xc721('0x2e')]));_0x279a67['attributes']=_0x279a67[_0xc721('0x2d')][_0xc721('0x2f')]?_0x279a67[_0xc721('0x2d')]:_0x57ad29['model'];if(_0x3bb77f['query'][_0xc721('0x3b')]){_0x279a67[_0xc721('0x42')]=[{'all':!![]}];}_0x279a67=_[_0xc721('0x36')]({},_0x279a67,_0x3bb77f[_0xc721('0x3a')]);return db[_0xc721('0x27')][_0xc721('0x43')](_0x279a67)['then'](handleEntityNotFound(_0x2b6f19,null))[_0xc721('0x21')](respondWithResult(_0x2b6f19,null))['catch'](handleError(_0x2b6f19,null));};exports[_0xc721('0x44')]=function(_0x11904c,_0x131789){return db[_0xc721('0x27')][_0xc721('0x44')](_0x11904c[_0xc721('0x45')],{})[_0xc721('0x21')](respondWithResult(_0x131789,0xc9))[_0xc721('0x46')](handleError(_0x131789,null));};exports[_0xc721('0x47')]=function(_0x92c23c,_0x1d269e){if(_0x92c23c['body']['id']){delete _0x92c23c[_0xc721('0x45')]['id'];}return db[_0xc721('0x27')][_0xc721('0x43')]({'where':{'id':_0x92c23c[_0xc721('0x3f')]['id']}})[_0xc721('0x21')](handleEntityNotFound(_0x1d269e,null))[_0xc721('0x21')](saveUpdates(_0x92c23c[_0xc721('0x45')],null))['then'](respondWithResult(_0x1d269e,null))['catch'](handleError(_0x1d269e,null));};exports[_0xc721('0x20')]=function(_0x5144cc,_0x5f0b86){return db['OpenchannelApplication']['find']({'where':{'id':_0x5144cc[_0xc721('0x3f')]['id']}})[_0xc721('0x21')](handleEntityNotFound(_0x5f0b86,null))[_0xc721('0x21')](removeEntity(_0x5f0b86,null))[_0xc721('0x46')](handleError(_0x5f0b86,null));}; \ No newline at end of file +var _0x6e16=['count','offset','limit','set','Content-Range','apply','reject','save','then','error','stack','name','send','index','map','OpenchannelApplication','rawAttributes','fieldName','type','key','query','keys','filters','attributes','fields','model','hasOwnProperty','order','sort','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','show','intersection','find','create','catch','update','body','params','html-pdf','eml-format','fast-json-patch','moment','bluebird','util','to-csv','lodash','squel','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','end'];(function(_0x41c5dd,_0x54e03c){var _0x481bd0=function(_0x165ee1){while(--_0x165ee1){_0x41c5dd['push'](_0x41c5dd['shift']());}};_0x481bd0(++_0x54e03c);}(_0x6e16,0xb7));var _0x66e1=function(_0x1fa83f,_0x4a9e92){_0x1fa83f=_0x1fa83f-0x0;var _0x33599c=_0x6e16[_0x1fa83f];return _0x33599c;};'use strict';var pdf=require(_0x66e1('0x0'));var emlformat=require(_0x66e1('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x66e1('0x2'));var rp=require('request-promise');var moment=require(_0x66e1('0x3'));var BPromise=require(_0x66e1('0x4'));var Mustache=require('mustache');var util=require(_0x66e1('0x5'));var path=require('path');var sox=require('sox');var csv=require(_0x66e1('0x6'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x66e1('0x7'));var squel=require(_0x66e1('0x8'));var crypto=require('crypto');var jsforce=require(_0x66e1('0x9'));var deskjs=require(_0x66e1('0xa'));var toCsv=require(_0x66e1('0x6'));var querystring=require('querystring');var Papa=require(_0x66e1('0xb'));var Redis=require(_0x66e1('0xc'));var authService=require(_0x66e1('0xd'));var qs=require(_0x66e1('0xe'));var as=require(_0x66e1('0xf'));var hardwareService=require(_0x66e1('0x10'));var logger=require(_0x66e1('0x11'))(_0x66e1('0x12'));var utils=require('../../config/utils');var config=require(_0x66e1('0x13'));var db=require(_0x66e1('0x14'))['db'];function respondWithStatusCode(_0x5531fc,_0x3e4917){_0x3e4917=_0x3e4917||0xcc;return function(_0x4e939c){if(_0x4e939c){return _0x5531fc[_0x66e1('0x15')](_0x3e4917);}return _0x5531fc[_0x66e1('0x16')](_0x3e4917)[_0x66e1('0x17')]();};}function respondWithResult(_0x44b831,_0x4d86aa){_0x4d86aa=_0x4d86aa||0xc8;return function(_0x18a0e1){if(_0x18a0e1){return _0x44b831[_0x66e1('0x16')](_0x4d86aa)['json'](_0x18a0e1);}};}function respondWithFilteredResult(_0x135732,_0xde6bd0){return function(_0x262531){if(_0x262531){var _0x345333=_0x262531[_0x66e1('0x18')],_0x8ae8b=_0xde6bd0['offset'],_0x381f56=_0xde6bd0[_0x66e1('0x19')]+_0xde6bd0[_0x66e1('0x1a')],_0x5a0aed;if(_0x381f56>=_0x345333){_0x381f56=_0x345333;_0x5a0aed=0xc8;}else{_0x5a0aed=0xce;}_0x135732[_0x66e1('0x16')](_0x5a0aed);return _0x135732[_0x66e1('0x1b')](_0x66e1('0x1c'),_0x8ae8b+'-'+_0x381f56+'/'+_0x345333)['json'](_0x262531);}return null;};}function patchUpdates(_0x370493){return function(_0x16928c){try{jsonpatch[_0x66e1('0x1d')](_0x16928c,_0x370493,!![]);}catch(_0x4d108a){return BPromise[_0x66e1('0x1e')](_0x4d108a);}return _0x16928c[_0x66e1('0x1f')]();};}function saveUpdates(_0x4bea98,_0x5cb3db){return function(_0x298f45){if(_0x298f45){return _0x298f45['update'](_0x4bea98)[_0x66e1('0x20')](function(_0x128a37){return _0x128a37;});}return null;};}function removeEntity(_0x137431,_0x4c6d21){return function(_0x4122d6){if(_0x4122d6){return _0x4122d6['destroy']()[_0x66e1('0x20')](function(){_0x137431['status'](0xcc)[_0x66e1('0x17')]();});}};}function handleEntityNotFound(_0x5c74a5,_0x323618){return function(_0x16759c){if(!_0x16759c){_0x5c74a5[_0x66e1('0x15')](0x194);}return _0x16759c;};}function handleError(_0x176b02,_0x1a936c){_0x1a936c=_0x1a936c||0x1f4;return function(_0x80b5b6){logger[_0x66e1('0x21')](_0x80b5b6[_0x66e1('0x22')]);if(_0x80b5b6['name']){delete _0x80b5b6[_0x66e1('0x23')];}_0x176b02[_0x66e1('0x16')](_0x1a936c)[_0x66e1('0x24')](_0x80b5b6);};}exports[_0x66e1('0x25')]=function(_0x866f31,_0x5d3e74){var _0x1a1540={},_0x518dd2={},_0x415da5={'count':0x0,'rows':[]};var _0x174556=_[_0x66e1('0x26')](db[_0x66e1('0x27')][_0x66e1('0x28')],function(_0x1ff49c){return{'name':_0x1ff49c[_0x66e1('0x29')],'type':_0x1ff49c[_0x66e1('0x2a')][_0x66e1('0x2b')]};});_0x518dd2['model']=_['map'](_0x174556,_0x66e1('0x23'));_0x518dd2[_0x66e1('0x2c')]=_[_0x66e1('0x2d')](_0x866f31['query']);_0x518dd2[_0x66e1('0x2e')]=_['intersection'](_0x518dd2['model'],_0x518dd2[_0x66e1('0x2c')]);_0x1a1540[_0x66e1('0x2f')]=_['intersection'](_0x518dd2['model'],qs[_0x66e1('0x30')](_0x866f31['query'][_0x66e1('0x30')]));_0x1a1540[_0x66e1('0x2f')]=_0x1a1540[_0x66e1('0x2f')]['length']?_0x1a1540[_0x66e1('0x2f')]:_0x518dd2[_0x66e1('0x31')];if(!_0x866f31[_0x66e1('0x2c')][_0x66e1('0x32')]('nolimit')){_0x1a1540[_0x66e1('0x1a')]=qs[_0x66e1('0x1a')](_0x866f31[_0x66e1('0x2c')][_0x66e1('0x1a')]);_0x1a1540[_0x66e1('0x19')]=qs[_0x66e1('0x19')](_0x866f31[_0x66e1('0x2c')]['offset']);}_0x1a1540[_0x66e1('0x33')]=qs[_0x66e1('0x34')](_0x866f31['query'][_0x66e1('0x34')]);_0x1a1540['where']=qs['filters'](_['pick'](_0x866f31[_0x66e1('0x2c')],_0x518dd2['filters']),_0x174556);if(_0x866f31[_0x66e1('0x2c')][_0x66e1('0x35')]){_0x1a1540[_0x66e1('0x36')]=_[_0x66e1('0x37')](_0x1a1540['where'],{'$or':_[_0x66e1('0x26')](_0x174556,function(_0x160e96){if(_0x160e96[_0x66e1('0x2a')]!==_0x66e1('0x38')){var _0x543976={};_0x543976[_0x160e96[_0x66e1('0x23')]]={'$like':'%'+_0x866f31['query'][_0x66e1('0x35')]+'%'};return _0x543976;}})});}_0x1a1540=_['merge']({},_0x1a1540,_0x866f31[_0x66e1('0x39')]);var _0x5336d1={'where':_0x1a1540[_0x66e1('0x36')]};return db[_0x66e1('0x27')][_0x66e1('0x18')](_0x5336d1)[_0x66e1('0x20')](function(_0x5738f3){_0x415da5[_0x66e1('0x18')]=_0x5738f3;if(_0x866f31[_0x66e1('0x2c')][_0x66e1('0x3a')]){_0x1a1540[_0x66e1('0x3b')]=[{'all':!![]}];}return db[_0x66e1('0x27')][_0x66e1('0x3c')](_0x1a1540);})[_0x66e1('0x20')](function(_0x57119d){_0x415da5['rows']=_0x57119d;return _0x415da5;})[_0x66e1('0x20')](respondWithFilteredResult(_0x5d3e74,_0x1a1540))['catch'](handleError(_0x5d3e74,null));};exports[_0x66e1('0x3d')]=function(_0x3ad2f9,_0x41d0b6){var _0x78a25b={'raw':!![],'where':{'id':_0x3ad2f9['params']['id']}},_0x3e6a7f={};_0x3e6a7f['model']=_['keys'](db[_0x66e1('0x27')][_0x66e1('0x28')]);_0x3e6a7f[_0x66e1('0x2c')]=_[_0x66e1('0x2d')](_0x3ad2f9[_0x66e1('0x2c')]);_0x3e6a7f['filters']=_[_0x66e1('0x3e')](_0x3e6a7f['model'],_0x3e6a7f[_0x66e1('0x2c')]);_0x78a25b[_0x66e1('0x2f')]=_[_0x66e1('0x3e')](_0x3e6a7f[_0x66e1('0x31')],qs[_0x66e1('0x30')](_0x3ad2f9[_0x66e1('0x2c')][_0x66e1('0x30')]));_0x78a25b['attributes']=_0x78a25b[_0x66e1('0x2f')]['length']?_0x78a25b['attributes']:_0x3e6a7f['model'];if(_0x3ad2f9[_0x66e1('0x2c')][_0x66e1('0x3a')]){_0x78a25b[_0x66e1('0x3b')]=[{'all':!![]}];}_0x78a25b=_['merge']({},_0x78a25b,_0x3ad2f9['options']);return db[_0x66e1('0x27')][_0x66e1('0x3f')](_0x78a25b)['then'](handleEntityNotFound(_0x41d0b6,null))['then'](respondWithResult(_0x41d0b6,null))['catch'](handleError(_0x41d0b6,null));};exports[_0x66e1('0x40')]=function(_0x4e021c,_0x13c681){return db[_0x66e1('0x27')][_0x66e1('0x40')](_0x4e021c['body'],{})[_0x66e1('0x20')](respondWithResult(_0x13c681,0xc9))[_0x66e1('0x41')](handleError(_0x13c681,null));};exports[_0x66e1('0x42')]=function(_0x26e579,_0x3f56a9){if(_0x26e579[_0x66e1('0x43')]['id']){delete _0x26e579[_0x66e1('0x43')]['id'];}return db[_0x66e1('0x27')][_0x66e1('0x3f')]({'where':{'id':_0x26e579[_0x66e1('0x44')]['id']}})[_0x66e1('0x20')](handleEntityNotFound(_0x3f56a9,null))[_0x66e1('0x20')](saveUpdates(_0x26e579[_0x66e1('0x43')],null))['then'](respondWithResult(_0x3f56a9,null))[_0x66e1('0x41')](handleError(_0x3f56a9,null));};exports['destroy']=function(_0x6209e9,_0xfabee1){return db[_0x66e1('0x27')][_0x66e1('0x3f')]({'where':{'id':_0x6209e9[_0x66e1('0x44')]['id']}})[_0x66e1('0x20')](handleEntityNotFound(_0xfabee1,null))[_0x66e1('0x20')](removeEntity(_0xfabee1,null))[_0x66e1('0x41')](handleError(_0xfabee1,null));}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.model.js b/server/api/openchannelApplication/openchannelApplication.model.js index 59fcefc..b3e5bb5 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 _0x914d=['bluebird','request-promise','path','rimraf','../../config/environment','./openchannelApplication.attributes','exports','OpenchannelApplication','openchannel_applications','utf8mb4_unicode_ci','lodash','util','api','moment'];(function(_0x25457e,_0x5f556c){var _0x55f128=function(_0x4a38ec){while(--_0x4a38ec){_0x25457e['push'](_0x25457e['shift']());}};_0x55f128(++_0x5f556c);}(_0x914d,0x192));var _0xd914=function(_0x138adb,_0x193fee){_0x138adb=_0x138adb-0x0;var _0x1b27f2=_0x914d[_0x138adb];return _0x1b27f2;};'use strict';var _=require(_0xd914('0x0'));var util=require(_0xd914('0x1'));var logger=require('../../config/logger')(_0xd914('0x2'));var moment=require(_0xd914('0x3'));var BPromise=require(_0xd914('0x4'));var rp=require(_0xd914('0x5'));var fs=require('fs');var path=require(_0xd914('0x6'));var rimraf=require(_0xd914('0x7'));var config=require(_0xd914('0x8'));var attributes=require(_0xd914('0x9'));module[_0xd914('0xa')]=function(_0x1f1b68,_0x14e942){return _0x1f1b68['define'](_0xd914('0xb'),attributes,{'tableName':_0xd914('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0xd914('0xd')});}; \ No newline at end of file +var _0x0cb8=['../../config/logger','api','moment','bluebird','rimraf','define','OpenchannelApplication','openchannel_applications','utf8mb4','lodash','util'];(function(_0x1ee62e,_0x159bb2){var _0x27c6c8=function(_0x31a5d4){while(--_0x31a5d4){_0x1ee62e['push'](_0x1ee62e['shift']());}};_0x27c6c8(++_0x159bb2);}(_0x0cb8,0xae));var _0x80cb=function(_0x4a540a,_0x5f5c99){_0x4a540a=_0x4a540a-0x0;var _0x5e2854=_0x0cb8[_0x4a540a];return _0x5e2854;};'use strict';var _=require(_0x80cb('0x0'));var util=require(_0x80cb('0x1'));var logger=require(_0x80cb('0x2'))(_0x80cb('0x3'));var moment=require(_0x80cb('0x4'));var BPromise=require(_0x80cb('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x80cb('0x6'));var config=require('../../config/environment');var attributes=require('./openchannelApplication.attributes');module['exports']=function(_0x464702,_0x661b7a){return _0x464702[_0x80cb('0x7')](_0x80cb('0x8'),attributes,{'tableName':_0x80cb('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x80cb('0xa'),'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 5ed7d67..6d16b33 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 _0xd8b0=['OpenchannelApplication','body','options','raw','where','lodash','util','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','request','then','info','OpenchannelApplication,\x20%s,\x20%s','request\x20sent','debug','OpenchannelApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','UpdateOpenchannelApplication'];(function(_0xc6be3a,_0x540e05){var _0x56a310=function(_0x50a144){while(--_0x50a144){_0xc6be3a['push'](_0xc6be3a['shift']());}};_0x56a310(++_0x540e05);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0d8b('0x2'));var db=require(_0x0d8b('0x3'))['db'];var utils=require(_0x0d8b('0x4'));var logger=require(_0x0d8b('0x5'))(_0x0d8b('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x0d8b('0x7')][_0x0d8b('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x39f43a,_0x4a4470,_0x413284){return new BPromise(function(_0x284169,_0x58e4e2){return client[_0x0d8b('0x9')](_0x39f43a,_0x413284)[_0x0d8b('0xa')](function(_0x3b027f){logger[_0x0d8b('0xb')](_0x0d8b('0xc'),_0x4a4470,_0x0d8b('0xd'));logger[_0x0d8b('0xe')](_0x0d8b('0xf'),_0x4a4470,'request\x20sent',JSON[_0x0d8b('0x10')](_0x3b027f));if(_0x3b027f['error']){if(_0x3b027f[_0x0d8b('0x11')][_0x0d8b('0x12')]===0x1f4){logger[_0x0d8b('0x11')](_0x0d8b('0xc'),_0x4a4470,_0x3b027f[_0x0d8b('0x11')][_0x0d8b('0x13')]);return _0x58e4e2(_0x3b027f[_0x0d8b('0x11')][_0x0d8b('0x13')]);}logger[_0x0d8b('0x11')](_0x0d8b('0xc'),_0x4a4470,_0x3b027f[_0x0d8b('0x11')][_0x0d8b('0x13')]);return _0x284169(_0x3b027f[_0x0d8b('0x11')][_0x0d8b('0x13')]);}else{logger['info'](_0x0d8b('0xc'),_0x4a4470,_0x0d8b('0xd'));_0x284169(_0x3b027f[_0x0d8b('0x14')][_0x0d8b('0x13')]);}})[_0x0d8b('0x15')](function(_0x5cd485){logger[_0x0d8b('0x11')](_0x0d8b('0xc'),_0x4a4470,_0x5cd485);_0x58e4e2(_0x5cd485);});});}exports[_0x0d8b('0x16')]=function(_0x5fecbd){var _0x333674=this;return new Promise(function(_0x18dd2d,_0x264b39){return db[_0x0d8b('0x17')]['update'](_0x5fecbd[_0x0d8b('0x18')],{'raw':_0x5fecbd[_0x0d8b('0x19')]?_0x5fecbd[_0x0d8b('0x19')][_0x0d8b('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5fecbd[_0x0d8b('0x19')]?_0x5fecbd[_0x0d8b('0x19')][_0x0d8b('0x1b')]||null:null,'attributes':_0x5fecbd[_0x0d8b('0x19')]?_0x5fecbd['options']['attributes']||null:null,'limit':_0x5fecbd[_0x0d8b('0x19')]?_0x5fecbd['options']['limit']||null:null})['then'](function(_0x238728){logger[_0x0d8b('0xb')](_0x0d8b('0x16'),_0x5fecbd);logger[_0x0d8b('0xe')](_0x0d8b('0x16'),_0x5fecbd,JSON[_0x0d8b('0x10')](_0x238728));_0x18dd2d(_0x238728);})[_0x0d8b('0x15')](function(_0x4562cb){logger[_0x0d8b('0x11')]('UpdateOpenchannelApplication',_0x4562cb[_0x0d8b('0x13')],_0x5fecbd);_0x264b39(_0x333674[_0x0d8b('0x11')](0x1f4,_0x4562cb['message']));});});}; \ No newline at end of file +var _0xb10b=['then','info','OpenchannelApplication,\x20%s,\x20%s','OpenchannelApplication,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','UpdateOpenchannelApplication','OpenchannelApplication','update','options','raw','where','attributes','limit','debug','catch','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request'];(function(_0x1d2053,_0x2b2c49){var _0x33f525=function(_0x5ee4b5){while(--_0x5ee4b5){_0x1d2053['push'](_0x1d2053['shift']());}};_0x33f525(++_0x2b2c49);}(_0xb10b,0x12a));var _0xbb10=function(_0x4e7b46,_0x1e5718){_0x4e7b46=_0x4e7b46-0x0;var _0x309599=_0xb10b[_0x4e7b46];return _0x309599;};'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 1cc762f..6e6c0b5 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 _0xc7af=['put','tracked','openchannelinteraction:destroy','destroy','delete','/:id/tags','multer','util','path','connect-timeout','express','../../components/auth/service','../../config/environment','index','/describe','describe','get','/:id','isAuthenticated','/:id/messages','getMessages','download','post','create','openchannel','openchannelinteraction:addtags','addTags'];(function(_0xa22054,_0x464303){var _0x4bee13=function(_0x26b6d7){while(--_0x26b6d7){_0xa22054['push'](_0xa22054['shift']());}};_0x4bee13(++_0x464303);}(_0xc7af,0xa8));var _0xfc7a=function(_0x27ddf5,_0x5a3e18){_0x27ddf5=_0x27ddf5-0x0;var _0x26e74a=_0xc7af[_0x27ddf5];return _0x26e74a;};'use strict';var multer=require(_0xfc7a('0x0'));var util=require(_0xfc7a('0x1'));var path=require(_0xfc7a('0x2'));var timeout=require(_0xfc7a('0x3'));var express=require(_0xfc7a('0x4'));var router=express['Router']();var auth=require(_0xfc7a('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xfc7a('0x6'));var controller=require('./openchannelInteraction.controller');router['get']('/',auth['isAuthenticated'](),controller[_0xfc7a('0x7')]);router['get'](_0xfc7a('0x8'),auth['isAuthenticated'](),controller[_0xfc7a('0x9')]);router[_0xfc7a('0xa')](_0xfc7a('0xb'),auth[_0xfc7a('0xc')](),controller['show']);router[_0xfc7a('0xa')](_0xfc7a('0xd'),auth[_0xfc7a('0xc')](),controller[_0xfc7a('0xe')]);router[_0xfc7a('0xa')]('/:id/download',auth[_0xfc7a('0xc')](),controller[_0xfc7a('0xf')]);router[_0xfc7a('0x10')]('/',auth[_0xfc7a('0xc')](),controller[_0xfc7a('0x11')]);router[_0xfc7a('0x10')](_0xfc7a('0xd'),auth[_0xfc7a('0xc')](),controller['addMessage']);router[_0xfc7a('0x10')]('/:id/tags',auth[_0xfc7a('0xc')](),interaction['tracked'](_0xfc7a('0x12'),_0xfc7a('0x13')),controller[_0xfc7a('0x14')]);router[_0xfc7a('0x15')](_0xfc7a('0xb'),auth[_0xfc7a('0xc')](),interaction[_0xfc7a('0x16')]('openchannel','openchannelinteraction:update'),controller['update']);router['delete'](_0xfc7a('0xb'),auth[_0xfc7a('0xc')](),interaction['tracked'](_0xfc7a('0x12'),_0xfc7a('0x17')),controller[_0xfc7a('0x18')]);router[_0xfc7a('0x19')](_0xfc7a('0x1a'),auth['isAuthenticated'](),controller['removeTags']);module['exports']=router; \ No newline at end of file +var _0xe3d6=['index','get','/describe','describe','show','/:id/messages','getMessages','/:id/download','download','post','create','addMessage','/:id/tags','tracked','openchannelinteraction:addtags','addTags','put','openchannel','openchannelinteraction:update','update','openchannelinteraction:destroy','delete','removeTags','exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelInteraction.controller','isAuthenticated'];(function(_0x5f309e,_0x66e31){var _0x487b5e=function(_0x44f203){while(--_0x44f203){_0x5f309e['push'](_0x5f309e['shift']());}};_0x487b5e(++_0x66e31);}(_0xe3d6,0x128));var _0x6e3d=function(_0x247b1d,_0x36e266){_0x247b1d=_0x247b1d-0x0;var _0x1fdbb6=_0xe3d6[_0x247b1d];return _0x1fdbb6;};'use strict';var multer=require('multer');var util=require(_0x6e3d('0x0'));var path=require(_0x6e3d('0x1'));var timeout=require(_0x6e3d('0x2'));var express=require(_0x6e3d('0x3'));var router=express[_0x6e3d('0x4')]();var auth=require(_0x6e3d('0x5'));var interaction=require(_0x6e3d('0x6'));var config=require(_0x6e3d('0x7'));var controller=require(_0x6e3d('0x8'));router['get']('/',auth[_0x6e3d('0x9')](),controller[_0x6e3d('0xa')]);router[_0x6e3d('0xb')](_0x6e3d('0xc'),auth[_0x6e3d('0x9')](),controller[_0x6e3d('0xd')]);router[_0x6e3d('0xb')]('/:id',auth[_0x6e3d('0x9')](),controller[_0x6e3d('0xe')]);router[_0x6e3d('0xb')](_0x6e3d('0xf'),auth[_0x6e3d('0x9')](),controller[_0x6e3d('0x10')]);router[_0x6e3d('0xb')](_0x6e3d('0x11'),auth['isAuthenticated'](),controller[_0x6e3d('0x12')]);router[_0x6e3d('0x13')]('/',auth[_0x6e3d('0x9')](),controller[_0x6e3d('0x14')]);router[_0x6e3d('0x13')](_0x6e3d('0xf'),auth[_0x6e3d('0x9')](),controller[_0x6e3d('0x15')]);router[_0x6e3d('0x13')](_0x6e3d('0x16'),auth[_0x6e3d('0x9')](),interaction[_0x6e3d('0x17')]('openchannel',_0x6e3d('0x18')),controller[_0x6e3d('0x19')]);router[_0x6e3d('0x1a')]('/:id',auth[_0x6e3d('0x9')](),interaction[_0x6e3d('0x17')](_0x6e3d('0x1b'),_0x6e3d('0x1c')),controller[_0x6e3d('0x1d')]);router['delete']('/:id',auth[_0x6e3d('0x9')](),interaction['tracked'](_0x6e3d('0x1b'),_0x6e3d('0x1e')),controller['destroy']);router[_0x6e3d('0x1f')](_0x6e3d('0x16'),auth['isAuthenticated'](),controller[_0x6e3d('0x20')]);module[_0x6e3d('0x21')]=router; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.attributes.js b/server/api/openchannelInteraction/openchannelInteraction.attributes.js index 965cdbf..3d3e83a 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 _0x7f98=['ENUM','out','sequelize','exports','BOOLEAN','DATE','STRING'];(function(_0x235482,_0x14b833){var _0x5f5bea=function(_0x17a254){while(--_0x17a254){_0x235482['push'](_0x235482['shift']());}};_0x5f5bea(++_0x14b833);}(_0x7f98,0xfe));var _0x87f9=function(_0x487b0c,_0x14ff74){_0x487b0c=_0x487b0c-0x0;var _0x1adbdc=_0x7f98[_0x487b0c];return _0x1adbdc;};'use strict';var Sequelize=require(_0x87f9('0x0'));module[_0x87f9('0x1')]={'closed':{'type':Sequelize[_0x87f9('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x87f9('0x3')]},'disposition':{'type':Sequelize[_0x87f9('0x4')]},'note':{'type':Sequelize[_0x87f9('0x4')]},'read1stAt':{'type':Sequelize[_0x87f9('0x3')]},'threadId':{'type':Sequelize[_0x87f9('0x4')]},'externalUrl':{'type':Sequelize[_0x87f9('0x4')]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize[_0x87f9('0x5')]('in',_0x87f9('0x6')),'defaultValue':'in','allowNull':![]},'from':{'type':Sequelize[_0x87f9('0x4')]}}; \ No newline at end of file +var _0xcd48=['ENUM','out','sequelize','DATE','STRING'];(function(_0x5a4257,_0x3ae34d){var _0x3746a7=function(_0x31fff0){while(--_0x31fff0){_0x5a4257['push'](_0x5a4257['shift']());}};_0x3746a7(++_0x3ae34d);}(_0xcd48,0x93));var _0x8cd4=function(_0x17da60,_0x8b6ded){_0x17da60=_0x17da60-0x0;var _0x4b30b0=_0xcd48[_0x17da60];return _0x4b30b0;};'use strict';var Sequelize=require(_0x8cd4('0x0'));module['exports']={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x8cd4('0x1')]},'disposition':{'type':Sequelize[_0x8cd4('0x2')]},'note':{'type':Sequelize[_0x8cd4('0x2')]},'read1stAt':{'type':Sequelize['DATE']},'threadId':{'type':Sequelize[_0x8cd4('0x2')]},'externalUrl':{'type':Sequelize['STRING']},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize[_0x8cd4('0x3')]('in',_0x8cd4('0x4')),'defaultValue':'in','allowNull':![]},'from':{'type':Sequelize[_0x8cd4('0x2')]}}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.controller.js b/server/api/openchannelInteraction/openchannelInteraction.controller.js index 0f00aa5..2651c75 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 _0xc6ab=['openchannel_interaction_has_tags','t.id\x20=\x20it.TagId','expr','search','parseSearch','sqlOperator','conditions','unreadMessages','`\x20>\x200','$substring','split','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','value','find','ContactId','buildExpression','text','start','Tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','User','operator','UserId','some','compact','isEmpty','OpenchannelAccountId','where','i.OpenchannelAccountId\x20IN\x20?','createdAt','parse','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','read','having','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','isArray','filter','replace','\x27\x27\x27\x27','i.id\x20LIKE\x20?','i.from\x20LIKE\x20?','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','group','Sequelize','QueryTypes','SELECT','i.id','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','DESC','t.id\x20IN\x20?','resolve','journey','i.OpenchannelAccountId\x20IS\x20NOT\x20NULL','user','getOpenchannelAccounts','i.OpenchannelAccountId\x20IS\x20NULL','sequelize','toString','keyBy','merge','OpenchannelInteraction','a.key','Account.key','a.mandatoryDisposition','Account.mandatoryDisposition','i.*','c.firstName','Contact.firstName','Contact.lastName','c.email','Contact.email','c.phone','c.mobile','Contact.mobile','Contact.fax','o.fullname','o.internal','groupBy','OpenchannelInteractionId','all','rows','show','includeAll','include','options','create','body','params','describe','addMessage','OpenchannelMessage','ids','omit','getMessages','$gte','YYYY-MM-DD\x20HH:mm:ss','findAll','addTags','setTags','spread','openchannelInteractionTags:save','removeTags','join','root','server','files','tmp','attachments','format','transcript-%d-%s.zip','fullname','CmContact','firstName','lastName','Attachment','Messages','direction','secret','OpenchannelAccount','Account','get','40px','\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20
Interaction\x20Transcript
\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','%s\x20#%d','Openchannel','Owner','N.A.','closed','disposition','Public','Private','basename','existsSync','pipe','createWriteStream','Contact','renderFile','views','downloadInteraction.html','toFile','transcript-','log','err','unlinkSync','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','path','sox','ejs','lodash','squel','crypto','jsforce','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../mysqldb','redis','defaults','./openchannelInteraction.socket','register','sendStatus','end','status','json','count','offset','limit','set','Content-Range','apply','save','update','destroy','then','error','name','send','Users','Tags','TagIds','forEach','push','catch','index','rawAttributes','fieldName','type','key','model','map','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filters','pick','select','field','color','from','tools_tags','u.id','u.fullname','ui.OpenchannelInteractionId','left_join','users','u.id\x20=\x20ui.UserId','openchannel_interactions','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','openchannel_accounts','openchannel_messages','me.OpenchannelInteractionId\x20=\x20i.id'];(function(_0x50d497,_0x34efff){var _0x2168f5=function(_0x26e2cc){while(--_0x26e2cc){_0x50d497['push'](_0x50d497['shift']());}};_0x2168f5(++_0x34efff);}(_0xc6ab,0x96));var _0xbc6a=function(_0x53c823,_0x204136){_0x53c823=_0x53c823-0x0;var _0x351414=_0xc6ab[_0x53c823];return _0x351414;};'use strict';var pdf=require(_0xbc6a('0x0'));var emlformat=require(_0xbc6a('0x1'));var rimraf=require(_0xbc6a('0x2'));var zipdir=require(_0xbc6a('0x3'));var jsonpatch=require(_0xbc6a('0x4'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xbc6a('0x5'));var Mustache=require(_0xbc6a('0x6'));var util=require(_0xbc6a('0x7'));var path=require(_0xbc6a('0x8'));var sox=require(_0xbc6a('0x9'));var csv=require('to-csv');var ejs=require(_0xbc6a('0xa'));var fs=require('fs');var _=require(_0xbc6a('0xb'));var squel=require(_0xbc6a('0xc'));var crypto=require(_0xbc6a('0xd'));var jsforce=require(_0xbc6a('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xbc6a('0xf'));var Papa=require(_0xbc6a('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xbc6a('0x11'));var as=require(_0xbc6a('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xbc6a('0x13'))(_0xbc6a('0x14'));var utils=require(_0xbc6a('0x15'));var config=require('../../config/environment');var db=require(_0xbc6a('0x16'))['db'];config[_0xbc6a('0x17')]=_[_0xbc6a('0x18')](config[_0xbc6a('0x17')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xbc6a('0x19'))[_0xbc6a('0x1a')](socket);function respondWithStatusCode(_0x48d94a,_0x353a92){_0x353a92=_0x353a92||0xcc;return function(_0x517377){if(_0x517377){return _0x48d94a[_0xbc6a('0x1b')](_0x353a92);}return _0x48d94a['status'](_0x353a92)[_0xbc6a('0x1c')]();};}function respondWithResult(_0x446062,_0xdf0869){_0xdf0869=_0xdf0869||0xc8;return function(_0x3de8f5){if(_0x3de8f5){return _0x446062[_0xbc6a('0x1d')](_0xdf0869)[_0xbc6a('0x1e')](_0x3de8f5);}};}function respondWithFilteredResult(_0x3c9fd3,_0x55134c){return function(_0x5df571){if(_0x5df571){var _0x143f03=_0x5df571[_0xbc6a('0x1f')],_0x2e8b88=_0x55134c[_0xbc6a('0x20')],_0x369a78=_0x55134c[_0xbc6a('0x20')]+_0x55134c[_0xbc6a('0x21')],_0x1730af;if(_0x369a78>=_0x143f03){_0x369a78=_0x143f03;_0x1730af=0xc8;}else{_0x1730af=0xce;}_0x3c9fd3[_0xbc6a('0x1d')](_0x1730af);return _0x3c9fd3[_0xbc6a('0x22')](_0xbc6a('0x23'),_0x2e8b88+'-'+_0x369a78+'/'+_0x143f03)[_0xbc6a('0x1e')](_0x5df571);}return null;};}function patchUpdates(_0x72a13c){return function(_0x5c8ff2){try{jsonpatch[_0xbc6a('0x24')](_0x5c8ff2,_0x72a13c,!![]);}catch(_0x492bfe){return BPromise['reject'](_0x492bfe);}return _0x5c8ff2[_0xbc6a('0x25')]();};}function saveUpdates(_0x5c7c1e,_0x2dc407){return function(_0x4b108d){if(_0x4b108d){return _0x4b108d[_0xbc6a('0x26')](_0x5c7c1e)['then'](function(_0xeaa12d){return _0xeaa12d;});}return null;};}function removeEntity(_0x1f0144,_0x23f6e8){return function(_0x17daf3){if(_0x17daf3){return _0x17daf3[_0xbc6a('0x27')]()[_0xbc6a('0x28')](function(){_0x1f0144[_0xbc6a('0x1d')](0xcc)[_0xbc6a('0x1c')]();});}};}function handleEntityNotFound(_0x3b52ac,_0x2006c5){return function(_0x4c7722){if(!_0x4c7722){_0x3b52ac[_0xbc6a('0x1b')](0x194);}return _0x4c7722;};}function handleError(_0x433376,_0x25c90b){_0x25c90b=_0x25c90b||0x1f4;return function(_0x10d725){logger[_0xbc6a('0x29')](_0x10d725['stack']);if(_0x10d725[_0xbc6a('0x2a')]){delete _0x10d725[_0xbc6a('0x2a')];}_0x433376[_0xbc6a('0x1d')](_0x25c90b)[_0xbc6a('0x2b')](_0x10d725);};}function getInteractionUsers(_0x4356c1,_0x431117){return new BPromise(function(_0x7902e8,_0x17e452){try{if(_0x431117[_0x4356c1['id']]){_0x4356c1[_0xbc6a('0x2c')]=_['map'](_0x431117[_0x4356c1['id']],function(_0x11e841){return{'id':_0x11e841['id'],'fullname':_0x11e841['fullname']};});}}catch(_0x491480){_0x17e452(_0x491480);}_0x7902e8(_0x4356c1);});}function getInteractionTags(_0x5701a8,_0x4e0079){return new BPromise(function(_0x50e809,_0x54ad91){try{if(_0x5701a8['TagIds']){_0x5701a8[_0xbc6a('0x2d')]=[];_0x5701a8[_0xbc6a('0x2e')]['split'](',')[_0xbc6a('0x2f')](function(_0x2e8a55){_0x5701a8[_0xbc6a('0x2d')][_0xbc6a('0x30')](_0x4e0079[_0x2e8a55]);});}delete _0x5701a8[_0xbc6a('0x2e')];}catch(_0x2507a4){_0x54ad91(_0x2507a4);}_0x50e809(_0x5701a8);});}function updateOpenchannelInteraction(_0x2caef9,_0x82f720,_0xe6accf){return new BPromise(function(_0x254ad5,_0x2a3342){return getInteractionUsers(_0x2caef9,_0xe6accf)[_0xbc6a('0x28')](function(_0x316ff3){return getInteractionTags(_0x316ff3,_0x82f720);})[_0xbc6a('0x28')](function(_0x2e4e3e){_0x254ad5(_0x2e4e3e);})[_0xbc6a('0x31')](function(_0x1de815){_0x2a3342(_0x1de815);});});}exports[_0xbc6a('0x32')]=function(_0x5e031a,_0x23e149){var _0x519ed4={},_0x531eb1={},_0x12cf31={'count':0x0,'rows':[]};var _0x197581=_['map'](db['OpenchannelInteraction'][_0xbc6a('0x33')],function(_0x2c314b){return{'name':_0x2c314b[_0xbc6a('0x34')],'type':_0x2c314b[_0xbc6a('0x35')][_0xbc6a('0x36')]};});_0x531eb1[_0xbc6a('0x37')]=_[_0xbc6a('0x38')](_0x197581,_0xbc6a('0x2a'));_0x531eb1[_0xbc6a('0x39')]=_[_0xbc6a('0x3a')](_0x5e031a[_0xbc6a('0x39')]);_0x531eb1['filters']=_[_0xbc6a('0x3b')](_0x531eb1[_0xbc6a('0x37')],_0x531eb1[_0xbc6a('0x39')]);_0x519ed4[_0xbc6a('0x3c')]=_[_0xbc6a('0x3b')](_0x531eb1[_0xbc6a('0x37')],qs['fields'](_0x5e031a[_0xbc6a('0x39')][_0xbc6a('0x3d')]));_0x519ed4['attributes']=_0x519ed4[_0xbc6a('0x3c')][_0xbc6a('0x3e')]?_0x519ed4[_0xbc6a('0x3c')]:_0x531eb1[_0xbc6a('0x37')];if(!_0x5e031a[_0xbc6a('0x39')][_0xbc6a('0x3f')](_0xbc6a('0x40'))){_0x519ed4['limit']=qs['limit'](_0x5e031a['query']['limit']);_0x519ed4[_0xbc6a('0x20')]=qs[_0xbc6a('0x20')](_0x5e031a[_0xbc6a('0x39')]['offset']);}_0x519ed4[_0xbc6a('0x41')]=qs[_0xbc6a('0x42')](_0x5e031a['query'][_0xbc6a('0x42')]);_0x519ed4['where']=qs[_0xbc6a('0x43')](_[_0xbc6a('0x44')](_0x5e031a[_0xbc6a('0x39')],_0x531eb1[_0xbc6a('0x43')]),_0x197581);var _0x274073=[];var _0x574680=squel[_0xbc6a('0x45')]()['field']('id')[_0xbc6a('0x46')](_0xbc6a('0x2a'))[_0xbc6a('0x46')](_0xbc6a('0x47'))[_0xbc6a('0x48')](_0xbc6a('0x49'));var _0x2400c7=squel[_0xbc6a('0x45')]()[_0xbc6a('0x46')](_0xbc6a('0x4a'))[_0xbc6a('0x46')](_0xbc6a('0x4b'))['field'](_0xbc6a('0x4c'))[_0xbc6a('0x48')]('user_has_openchannel_interactions','ui')[_0xbc6a('0x4d')](_0xbc6a('0x4e'),'u',_0xbc6a('0x4f'));var _0x5c0dbd=squel['select']()[_0xbc6a('0x48')](_0xbc6a('0x50'),'i')[_0xbc6a('0x4d')](_0xbc6a('0x51'),'c',_0xbc6a('0x52'))[_0xbc6a('0x4d')](_0xbc6a('0x4e'),'o','o.id\x20=\x20i.UserId')[_0xbc6a('0x4d')](_0xbc6a('0x53'),'a','a.id\x20=\x20i.OpenchannelAccountId')[_0xbc6a('0x4d')](_0xbc6a('0x54'),'me',_0xbc6a('0x55'))[_0xbc6a('0x4d')](_0xbc6a('0x56'),'it','it.OpenchannelInteractionId\x20=\x20i.id')['left_join']('tools_tags','t',_0xbc6a('0x57'));var _0x5dea12=squel[_0xbc6a('0x58')]();var _0x214d80=[];var _0x5b55c8=squel[_0xbc6a('0x58')]();var _0x12f20b;if(_0x5e031a[_0xbc6a('0x39')][_0xbc6a('0x59')]){_0x12f20b=as[_0xbc6a('0x5a')](_0x5e031a[_0xbc6a('0x39')]['search']);var _0x435be6=_0x12f20b[_0xbc6a('0x5b')];for(var _0x264310=0x0;_0x264310<_0x12f20b[_0xbc6a('0x5c')][_0xbc6a('0x3e')];_0x264310++){var _0x496277=_0x12f20b[_0xbc6a('0x5c')][_0x264310];var _0x2e5a76='i';var _0x3d9438=_['find'](_0x197581,['name',_0x496277[_0xbc6a('0x46')]]);if(!_0x3d9438){switch(_0x496277[_0xbc6a('0x46')]){case _0xbc6a('0x5d'):if(_0x496277['value']==0x1){_0x5c0dbd['having']('`'+_0x496277[_0xbc6a('0x46')]+'`\x20=\x200');}else{_0x5c0dbd['having']('`'+_0x496277[_0xbc6a('0x46')]+_0xbc6a('0x5e'));}break;case'Contact':if(_0x496277['operator']===_0xbc6a('0x5f')){if(_0x496277['value'][_0xbc6a('0x60')]('\x20')[_0xbc6a('0x3e')]>0x1){_0x5dea12[_0x435be6](_0xbc6a('0x61'),qs[_0xbc6a('0x62')](_0x496277[_0xbc6a('0x63')]),null);}else{var _0x545843='%'+_0x496277[_0xbc6a('0x63')]+'%';_0x5dea12[_0x435be6]('c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?',_0x545843,_0x545843,_0x545843);}}else{_0x3d9438=_[_0xbc6a('0x64')](_0x197581,[_0xbc6a('0x2a'),_0xbc6a('0x65')]);_0x496277[_0xbc6a('0x46')]=_0xbc6a('0x65');_0x5e7bed=as[_0xbc6a('0x66')](_0x2e5a76,_0x3d9438[_0xbc6a('0x35')],_0x496277);_0x5dea12[_0x435be6](_0x5e7bed[_0xbc6a('0x67')],_0x5e7bed[_0xbc6a('0x63')][_0xbc6a('0x68')],_0x5e7bed[_0xbc6a('0x63')][_0xbc6a('0x1c')]);}break;case _0xbc6a('0x69'):var _0x35855b=_0x496277[_0xbc6a('0x63')][_0xbc6a('0x60')](',')[_0xbc6a('0x38')](function(_0x12bc7a){return Number(_0x12bc7a);});_0x35855b[_0xbc6a('0x2f')](function(_0x1e1615){_0x5b55c8['or'](_0xbc6a('0x6a'),'%,'+_0x1e1615+',%');});_0x214d80=_[_0xbc6a('0x6b')](_0x214d80,_0x35855b);break;case _0xbc6a('0x6c'):if(_0x496277[_0xbc6a('0x6d')]===_0xbc6a('0x5f')){_0x5dea12[_0x435be6]('CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','%'+_0x496277[_0xbc6a('0x63')]+'%',null);}else{_0x3d9438=_['find'](_0x197581,[_0xbc6a('0x2a'),_0xbc6a('0x6e')]);_0x496277[_0xbc6a('0x46')]=_0xbc6a('0x6e');_0x5e7bed=as[_0xbc6a('0x66')](_0x2e5a76,_0x3d9438[_0xbc6a('0x35')],_0x496277);_0x5dea12[_0x435be6](_0x5e7bed[_0xbc6a('0x67')],_0x5e7bed[_0xbc6a('0x63')][_0xbc6a('0x68')],_0x5e7bed[_0xbc6a('0x63')]['end']);}break;case'body':_0x5e7bed=as['buildExpression']('me',null,_0x496277);_0x5dea12[_0x435be6](_0x5e7bed[_0xbc6a('0x67')],_0x5e7bed['value'][_0xbc6a('0x68')],_0x5e7bed['value'][_0xbc6a('0x1c')]);break;}}else{var _0x5e7bed=as['buildExpression'](_0x2e5a76,_0x3d9438['type'],_0x496277);_0x5dea12[_0x435be6](_0x5e7bed[_0xbc6a('0x67')],_0x5e7bed[_0xbc6a('0x63')]['start'],_0x5e7bed[_0xbc6a('0x63')][_0xbc6a('0x1c')]);}}}else{var _0x459758=_(_0x5e031a[_0xbc6a('0x39')])['keys']()[_0xbc6a('0x38')](function(_0x3b4e76){return _[_0xbc6a('0x6f')](_0x197581,[_0xbc6a('0x2a'),_0x3b4e76])?_0x3b4e76:undefined;})[_0xbc6a('0x70')]()[_0xbc6a('0x63')]();if(!_[_0xbc6a('0x71')](_0x459758)){_0x459758[_0xbc6a('0x2f')](function(_0x3321a0){if(_0x3321a0===_0xbc6a('0x72')){_0x5c0dbd[_0xbc6a('0x73')](_0xbc6a('0x74'),[]['concat'](_0x5e031a['query'][_0x3321a0]));}else if(_0x3321a0===_0xbc6a('0x75')){var _0x5c3dd7=JSON['parse'](_0x5e031a[_0xbc6a('0x39')][_0x3321a0])['$gte'];var _0x3da196=JSON[_0xbc6a('0x76')](_0x5e031a['query'][_0x3321a0])['$lte'];_0x5c0dbd[_0xbc6a('0x73')](_0xbc6a('0x77'),_0x5c3dd7,_0x3da196);}else{if(_0x5e031a[_0xbc6a('0x39')][_0x3321a0]===_0xbc6a('0x78')){_0x5c0dbd['where']('i.'+_0x3321a0+_0xbc6a('0x79'));}else{_0x5c0dbd[_0xbc6a('0x73')]('i.'+_0x3321a0+'\x20=\x20?',_0x5e031a[_0xbc6a('0x39')][_0x3321a0]);}}});}if(_0x5e031a['query'][_0xbc6a('0x7a')]){if(_0x5e031a['query'][_0xbc6a('0x7a')]==0x1){_0x5c0dbd[_0xbc6a('0x7b')](_0xbc6a('0x7c'));}else{_0x5c0dbd[_0xbc6a('0x7b')](_0xbc6a('0x7d'));}}if(_0x5e031a[_0xbc6a('0x39')][_0xbc6a('0x7e')]){_0x214d80=_[_0xbc6a('0x7f')](_0x5e031a['query'][_0xbc6a('0x7e')])?_0x5e031a[_0xbc6a('0x39')][_0xbc6a('0x7e')]:new Array(_0x5e031a[_0xbc6a('0x39')]['tag']);_0x214d80['forEach'](function(_0x4da103){_0x5b55c8['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x4da103+',%');});}if(_0x5e031a[_0xbc6a('0x39')][_0xbc6a('0x80')]){var _0x3fa2cf=_0x5e031a[_0xbc6a('0x39')][_0xbc6a('0x80')][_0xbc6a('0x81')]('\x5c','\x5c\x5c')['replace']('\x27\x27',_0xbc6a('0x82'));if(qs['isNumeric'](_0x3fa2cf)){_0x5dea12['or'](_0xbc6a('0x83'),_0x3fa2cf+'%');}else{_0x5dea12['or']('MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0xbc6a('0x62')](_0x3fa2cf))['or'](_0xbc6a('0x84'),_0x3fa2cf+'%')['or'](_0xbc6a('0x85'),_0x3fa2cf+'%');}}}_0x5c0dbd['where'](_0x5dea12);_0x5c0dbd[_0xbc6a('0x86')]('i.id');var _0x44364f={'type':db[_0xbc6a('0x87')][_0xbc6a('0x88')][_0xbc6a('0x89')],'raw':!![]};var _0x4f7de8=_0x5c0dbd['clone']();_0x4f7de8[_0xbc6a('0x46')](_0xbc6a('0x8a'));_0x4f7de8[_0xbc6a('0x46')](_0xbc6a('0x8b'),_0xbc6a('0x5d'));if(_0x519ed4[_0xbc6a('0x41')]){_0x519ed4[_0xbc6a('0x41')][_0xbc6a('0x2f')](function(_0x3edf69){_0x5c0dbd[_0xbc6a('0x41')]('i.'+_0x3edf69[0x0],_0x3edf69[0x1]===_0xbc6a('0x8c')?![]:!![]);});}if(!_[_0xbc6a('0x71')](_0x214d80)){_0x5c0dbd[_0xbc6a('0x7b')](_0x5b55c8);_0x4f7de8[_0xbc6a('0x73')](_0xbc6a('0x8d'),_0x214d80);}BPromise[_0xbc6a('0x8e')]()[_0xbc6a('0x28')](function(){if(!_0x12f20b){if(_0x5e031a[_0xbc6a('0x39')][_0xbc6a('0x72')]||_0x5e031a[_0xbc6a('0x39')][_0xbc6a('0x8f')])return;_0x4f7de8[_0xbc6a('0x73')]('i.OpenchannelAccountId\x20IS\x20NOT\x20NULL');_0x5c0dbd[_0xbc6a('0x73')](_0xbc6a('0x90'));return;}return _0x5e031a[_0xbc6a('0x91')][_0xbc6a('0x92')]({'attributes':['id'],'raw':!![]})[_0xbc6a('0x28')](function(_0x35f063){if(_[_0xbc6a('0x71')](_0x35f063)){_0x4f7de8[_0xbc6a('0x73')](_0xbc6a('0x93'));_0x5c0dbd[_0xbc6a('0x73')](_0xbc6a('0x93'));}else{_0x4f7de8['where'](_0xbc6a('0x74'),_['map'](_0x35f063,'id'));_0x5c0dbd['where'](_0xbc6a('0x74'),_['map'](_0x35f063,'id'));}});})[_0xbc6a('0x28')](function(){db[_0xbc6a('0x94')][_0xbc6a('0x39')](_0x4f7de8['toString'](),_0x44364f)[_0xbc6a('0x28')](function(_0x32d81b){_0x12cf31[_0xbc6a('0x1f')]=_0x32d81b['length'];if(_0x12cf31[_0xbc6a('0x1f')]===0x0)return[];return db['sequelize']['query'](_0x574680[_0xbc6a('0x95')](),_0x44364f)[_0xbc6a('0x28')](function(_0x901076){_0x274073=_[_0xbc6a('0x96')](_0x901076,'id');_0x44364f=_[_0xbc6a('0x97')](_0x44364f,{'model':db[_0xbc6a('0x98')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x5e031a[_0xbc6a('0x39')]['fields']){_0x519ed4[_0xbc6a('0x3c')]['forEach'](function(_0x550767){_0x5c0dbd[_0xbc6a('0x46')]('i.'+_0x550767);});}else{_0x5c0dbd['field'](_0xbc6a('0x8b'),'unreadMessages');_0x5c0dbd[_0xbc6a('0x46')](_0xbc6a('0x99'),_0xbc6a('0x9a'));_0x5c0dbd['field'](_0xbc6a('0x9b'),_0xbc6a('0x9c'));_0x5c0dbd['field'](_0xbc6a('0x9d'));_0x5c0dbd[_0xbc6a('0x46')](_0xbc6a('0x9e'),_0xbc6a('0x9f'));_0x5c0dbd[_0xbc6a('0x46')]('c.lastName',_0xbc6a('0xa0'));_0x5c0dbd['field'](_0xbc6a('0xa1'),_0xbc6a('0xa2'));_0x5c0dbd['field'](_0xbc6a('0xa3'),'Contact.phone');_0x5c0dbd['field'](_0xbc6a('0xa4'),_0xbc6a('0xa5'));_0x5c0dbd[_0xbc6a('0x46')]('c.fax',_0xbc6a('0xa6'));_0x5c0dbd[_0xbc6a('0x46')](_0xbc6a('0xa7'),'Owner.fullname');_0x5c0dbd[_0xbc6a('0x46')](_0xbc6a('0xa8'),'Owner.internal');_0x5c0dbd['field']('GROUP_CONCAT(DISTINCT\x20t.id)',_0xbc6a('0x2e'));}if(_0x519ed4['limit'])_0x5c0dbd[_0xbc6a('0x21')](_0x519ed4[_0xbc6a('0x21')]);if(_0x519ed4[_0xbc6a('0x20')])_0x5c0dbd['offset'](_0x519ed4[_0xbc6a('0x20')]);return db[_0xbc6a('0x94')][_0xbc6a('0x39')](_0x5c0dbd[_0xbc6a('0x95')](),_0x44364f);})['then'](function(_0x14333b){_0x2400c7['where']('ui.OpenchannelInteractionId\x20IN\x20?',_[_0xbc6a('0x38')](_0x14333b,'id'));return db[_0xbc6a('0x94')][_0xbc6a('0x39')](_0x2400c7[_0xbc6a('0x95')](),_0x44364f)[_0xbc6a('0x28')](function(_0xf61a6a){var _0x402f01=_[_0xbc6a('0xa9')](_0xf61a6a,_0xbc6a('0xaa'));var _0x3d253f=[];_0x14333b[_0xbc6a('0x2f')](function(_0x27ec57){_0x3d253f['push'](updateOpenchannelInteraction(_0x27ec57,_0x274073,_0x402f01));});return BPromise[_0xbc6a('0xab')](_0x3d253f);});});})[_0xbc6a('0x28')](function(_0x4813ee){_0x12cf31[_0xbc6a('0xac')]=_0x4813ee;return _0x12cf31;})[_0xbc6a('0x28')](respondWithFilteredResult(_0x23e149,_0x519ed4));})[_0xbc6a('0x31')](handleError(_0x23e149,null));};exports[_0xbc6a('0xad')]=function(_0x569220,_0x4e0fc5){var _0x261446={'raw':![],'where':{'id':_0x569220['params']['id']}},_0x5edc5b={};_0x5edc5b[_0xbc6a('0x37')]=_['keys'](db[_0xbc6a('0x98')][_0xbc6a('0x33')]);_0x5edc5b['query']=_['keys'](_0x569220['query']);_0x5edc5b[_0xbc6a('0x43')]=_['intersection'](_0x5edc5b[_0xbc6a('0x37')],_0x5edc5b[_0xbc6a('0x39')]);_0x261446['attributes']=_[_0xbc6a('0x3b')](_0x5edc5b[_0xbc6a('0x37')],qs['fields'](_0x569220[_0xbc6a('0x39')][_0xbc6a('0x3d')]));_0x261446[_0xbc6a('0x3c')]=_0x261446[_0xbc6a('0x3c')][_0xbc6a('0x3e')]?_0x261446['attributes']:_0x5edc5b[_0xbc6a('0x37')];if(_0x569220['query'][_0xbc6a('0xae')]){_0x261446[_0xbc6a('0xaf')]=[{'all':!![]}];}_0x261446=_[_0xbc6a('0x97')]({},_0x261446,_0x569220[_0xbc6a('0xb0')]);return db[_0xbc6a('0x98')][_0xbc6a('0x64')](_0x261446)[_0xbc6a('0x28')](handleEntityNotFound(_0x4e0fc5,null))[_0xbc6a('0x28')](respondWithResult(_0x4e0fc5,null))[_0xbc6a('0x31')](handleError(_0x4e0fc5,null));};exports[_0xbc6a('0xb1')]=function(_0x364286,_0x395335){return db[_0xbc6a('0x98')]['create'](_0x364286[_0xbc6a('0xb2')],{})[_0xbc6a('0x28')](respondWithResult(_0x395335,0xc9))['catch'](handleError(_0x395335,null));};exports['update']=function(_0x39dfd8,_0x426b1a){if(_0x39dfd8['body']['id']){delete _0x39dfd8[_0xbc6a('0xb2')]['id'];}return db[_0xbc6a('0x98')][_0xbc6a('0x64')]({'where':{'id':_0x39dfd8[_0xbc6a('0xb3')]['id']}})[_0xbc6a('0x28')](handleEntityNotFound(_0x426b1a,null))[_0xbc6a('0x28')](saveUpdates(_0x39dfd8['body'],null))[_0xbc6a('0x28')](respondWithResult(_0x426b1a,null))[_0xbc6a('0x31')](handleError(_0x426b1a,null));};exports[_0xbc6a('0x27')]=function(_0x4f3daa,_0xc43d47){return db['OpenchannelInteraction'][_0xbc6a('0x64')]({'where':{'id':_0x4f3daa['params']['id']}})[_0xbc6a('0x28')](handleEntityNotFound(_0xc43d47,null))[_0xbc6a('0x28')](removeEntity(_0xc43d47,null))['catch'](handleError(_0xc43d47,null));};exports[_0xbc6a('0xb4')]=function(_0x210745,_0x271098){return db[_0xbc6a('0x98')][_0xbc6a('0xb4')]()[_0xbc6a('0x28')](respondWithResult(_0x271098,null))['catch'](handleError(_0x271098,null));};exports[_0xbc6a('0xb5')]=function(_0x3c91e6,_0x2e0e53,_0x4e327c){return db[_0xbc6a('0xb6')]['find']({'where':{'id':_0x3c91e6['params']['id']}})[_0xbc6a('0x28')](handleEntityNotFound(_0x2e0e53,null))[_0xbc6a('0x28')](function(_0x36b885){if(_0x36b885){return _0x36b885[_0xbc6a('0xb5')](_0x3c91e6[_0xbc6a('0xb2')][_0xbc6a('0xb7')],_[_0xbc6a('0xb8')](_0x3c91e6[_0xbc6a('0xb2')],[_0xbc6a('0xb7'),'id'])||{});}})[_0xbc6a('0x28')](respondWithResult(_0x2e0e53,null))['catch'](handleError(_0x2e0e53,null));};exports[_0xbc6a('0xb9')]=function(_0x1ed67b,_0x1091ec,_0xd2aaa0){var _0x5e110e={'raw':![],'where':{}};var _0xca6e74={};var _0x430dd7={'count':0x0,'rows':[]};return db[_0xbc6a('0x98')]['findOne']({'where':{'id':_0x1ed67b[_0xbc6a('0xb3')]['id']}})['then'](handleEntityNotFound(_0x1091ec,null))['then'](function(_0x361bfc){if(_0x361bfc){_0xca6e74[_0xbc6a('0x37')]=_['keys'](db[_0xbc6a('0xb6')][_0xbc6a('0x33')]);_0xca6e74[_0xbc6a('0x39')]=_[_0xbc6a('0x3a')](_0x1ed67b[_0xbc6a('0x39')]);_0xca6e74['filters']=_[_0xbc6a('0x3b')](_0xca6e74['model'],_0xca6e74[_0xbc6a('0x39')]);_0x5e110e['attributes']=_[_0xbc6a('0x3b')](_0xca6e74['model'],qs[_0xbc6a('0x3d')](_0x1ed67b['query'][_0xbc6a('0x3d')]));_0x5e110e['attributes']=_0x5e110e[_0xbc6a('0x3c')][_0xbc6a('0x3e')]?_0x5e110e[_0xbc6a('0x3c')]:_0xca6e74[_0xbc6a('0x37')];if(!_0x1ed67b[_0xbc6a('0x39')]['hasOwnProperty']('nolimit')){_0x5e110e[_0xbc6a('0x21')]=qs['limit'](_0x1ed67b[_0xbc6a('0x39')][_0xbc6a('0x21')]);_0x5e110e['offset']=qs['offset'](_0x1ed67b[_0xbc6a('0x39')][_0xbc6a('0x20')]);}_0x5e110e[_0xbc6a('0x41')]=qs[_0xbc6a('0x42')](_0x1ed67b[_0xbc6a('0x39')][_0xbc6a('0x42')]);_0x5e110e[_0xbc6a('0x73')]=qs['filters'](_[_0xbc6a('0x44')](_0x1ed67b[_0xbc6a('0x39')],_0xca6e74[_0xbc6a('0x43')]));_0x5e110e[_0xbc6a('0x73')][_0xbc6a('0xaa')]=_0x361bfc['id'];if(_0x1ed67b[_0xbc6a('0x39')]['filter']){_0x5e110e[_0xbc6a('0x73')]=_[_0xbc6a('0x97')](_0x5e110e[_0xbc6a('0x73')],{'$or':_[_0xbc6a('0x38')](_0x5e110e[_0xbc6a('0x3c')],function(_0x3f5c91){var _0x2adbfc={};_0x2adbfc[_0x3f5c91]={'$like':'%'+_0x1ed67b['query'][_0xbc6a('0x80')]+'%'};return _0x2adbfc;})});}if(_0x1ed67b[_0xbc6a('0x39')][_0xbc6a('0xba')]){var _0x1c7dfa=_0x1ed67b['query'][_0xbc6a('0xba')]['split'](',');var _0x30a710={};_0x30a710[_0x1c7dfa[0x0]]={'$gte':moment(_0x1c7dfa[0x1])['format'](_0xbc6a('0xbb'))};_0x5e110e[_0xbc6a('0x73')]=_['merge'](_0x5e110e['where'],_0x30a710);}_0x5e110e=_[_0xbc6a('0x97')]({},_0x5e110e,_0x1ed67b[_0xbc6a('0xb0')]);return db['OpenchannelMessage']['count']({'where':_0x5e110e[_0xbc6a('0x73')]})['then'](function(_0x1711b7){_0x430dd7[_0xbc6a('0x1f')]=_0x1711b7;if(_0x1ed67b['query'][_0xbc6a('0xae')]){_0x5e110e[_0xbc6a('0xaf')]=[{'all':!![]}];}return db['OpenchannelMessage'][_0xbc6a('0xbc')](_0x5e110e);})[_0xbc6a('0x28')](function(_0x4b25bd){_0x430dd7[_0xbc6a('0xac')]=_0x4b25bd;return _0x430dd7;});}})[_0xbc6a('0x28')](respondWithFilteredResult(_0x1091ec,_0x5e110e))[_0xbc6a('0x31')](handleError(_0x1091ec,null));};exports[_0xbc6a('0xbd')]=function(_0x5666d7,_0x10ee16,_0x495d5a){return db[_0xbc6a('0x98')][_0xbc6a('0x64')]({'where':{'id':_0x5666d7[_0xbc6a('0xb3')]['id']}})[_0xbc6a('0x28')](handleEntityNotFound(_0x10ee16,null))[_0xbc6a('0x28')](function(_0x504488){if(_0x504488){return _0x504488[_0xbc6a('0xbe')](_0x5666d7['body'][_0xbc6a('0xb7')],_[_0xbc6a('0xb8')](_0x5666d7['body'],[_0xbc6a('0xb7'),'id'])||{})[_0xbc6a('0xbf')](function(){return db[_0xbc6a('0x69')][_0xbc6a('0xbc')]({'attributes':['id','name',_0xbc6a('0x47')],'where':{'id':_0x5666d7[_0xbc6a('0xb2')]['ids']}});})[_0xbc6a('0x28')](function(_0x2781c3){socket['emit'](_0xbc6a('0xc0'),{'id':Number(_0x5666d7[_0xbc6a('0xb3')]['id']),'tags':_0x2781c3||[]});return{'id':Number(_0x5666d7[_0xbc6a('0xb3')]['id']),'tags':_0x2781c3||[]};});}})[_0xbc6a('0x28')](respondWithResult(_0x10ee16,null))[_0xbc6a('0x31')](handleError(_0x10ee16,null));};exports[_0xbc6a('0xc1')]=function(_0x5f3874,_0x89217e,_0x1b7a56){return db[_0xbc6a('0x98')][_0xbc6a('0x64')]({'where':{'id':_0x5f3874[_0xbc6a('0xb3')]['id']}})['then'](handleEntityNotFound(_0x89217e,null))[_0xbc6a('0x28')](function(_0x37f896){if(_0x37f896){return _0x37f896[_0xbc6a('0xc1')](_0x5f3874[_0xbc6a('0x39')]['ids']);}})[_0xbc6a('0x28')](respondWithStatusCode(_0x89217e,null))[_0xbc6a('0x31')](handleError(_0x89217e,null));};exports['download']=function(_0x35207d,_0x171a0d){var _0x435a37=moment()['unix']()[_0xbc6a('0x95')]();var _0x52fff3=path[_0xbc6a('0xc2')](config[_0xbc6a('0xc3')],_0xbc6a('0xc4'),_0xbc6a('0xc5'),_0xbc6a('0xc6'));var _0x41c28f=path['join'](config['root'],_0xbc6a('0xc4'),_0xbc6a('0xc5'),_0xbc6a('0xc7'));var _0x4c89f7=path[_0xbc6a('0xc2')](_0x52fff3,_0x435a37);var _0x2d4266=util[_0xbc6a('0xc8')](_0xbc6a('0xc9'),_0x35207d['params']['id'],_0x435a37);var _0x635eeb=path[_0xbc6a('0xc2')](_0x52fff3,_0x2d4266);var _0x49296e=[];_0x49296e[_0xbc6a('0x30')]({'model':db[_0xbc6a('0x6c')],'as':_0xbc6a('0x6c'),'attributes':['id',_0xbc6a('0xca')],'raw':!![]});_0x49296e[_0xbc6a('0x30')]({'model':db[_0xbc6a('0xcb')],'as':'Contact','attributes':['id',_0xbc6a('0xcc'),_0xbc6a('0xcd')],'raw':!![]});if(_0x35207d['query'][_0xbc6a('0xc7')]){_0x49296e[_0xbc6a('0x30')]({'model':db['Attachment'],'as':_0xbc6a('0xce'),'raw':!![]});}var _0x556206=[{'model':db[_0xbc6a('0xb6')],'as':_0xbc6a('0xcf'),'attributes':['id','body',_0xbc6a('0x75'),_0xbc6a('0xd0'),_0xbc6a('0xd1'),_0xbc6a('0x7a')],'include':_0x49296e}];_0x556206[_0xbc6a('0x30')]({'model':db[_0xbc6a('0xd2')],'as':_0xbc6a('0xd3'),'attributes':['id',_0xbc6a('0x2a')]});_0x556206[_0xbc6a('0x30')]({'model':db[_0xbc6a('0x6c')],'as':'Owner','attributes':['id',_0xbc6a('0xca')]});return db['OpenchannelInteraction'][_0xbc6a('0x64')]({'where':{'id':_0x35207d['params']['id']},'include':_0x556206})[_0xbc6a('0x28')](handleEntityNotFound(_0x171a0d,null))[_0xbc6a('0x28')](function(_0x306850){if(_0x306850){var _0x4fe7be=_0x306850[_0xbc6a('0xd4')]({'plain':!![]});fs['mkdirSync'](_0x4c89f7);var _0x811615={'format':'A4','border':'10px','header':{'height':_0xbc6a('0xd5'),'contents':{'first':_0xbc6a('0xd6')}},'footer':{'height':'30px','contents':{'default':util['format']('\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20%s\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20{{page}}/{{pages}}\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20%s\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',util[_0xbc6a('0xc8')](_0xbc6a('0xd7'),_0xbc6a('0xd8'),_0x4fe7be['id']),moment()['format']('YYYY-MM-DD')['toString']())}}};var _0x34a843={'channel':_0xbc6a('0xd8'),'account':_0x4fe7be[_0xbc6a('0xd3')][_0xbc6a('0x2a')],'agent':_0x4fe7be['Owner']?_0x4fe7be[_0xbc6a('0xd9')][_0xbc6a('0xca')]:_0xbc6a('0xda'),'createdAt':moment(_0x4fe7be[_0xbc6a('0x75')])[_0xbc6a('0xc8')](_0xbc6a('0xbb'))[_0xbc6a('0x95')](),'closedAt':_0x4fe7be[_0xbc6a('0xdb')]?moment(_0x4fe7be['closedAt'])[_0xbc6a('0xc8')](_0xbc6a('0xbb'))[_0xbc6a('0x95')]():'','disposition':_0x4fe7be[_0xbc6a('0xdc')],'visibility':_0x4fe7be['threadId']?_0xbc6a('0xdd'):_0xbc6a('0xde'),'messages':_(_0x4fe7be[_0xbc6a('0xcf')])['filter']({'secret':![]})[_0xbc6a('0x38')](function(_0x500573){if(_0x500573[_0xbc6a('0xce')]){var _0x191b8c=path[_0xbc6a('0xc2')](_0x41c28f,_0x500573['Attachment'][_0xbc6a('0xdf')]);if(fs[_0xbc6a('0xe0')](_0x191b8c)){fs['createReadStream'](_0x191b8c)[_0xbc6a('0xe1')](fs[_0xbc6a('0xe2')](path['join'](_0x4c89f7,_0x500573[_0xbc6a('0xce')][_0xbc6a('0xdf')])));}}return{'date':moment(_0x500573['createdAt'])[_0xbc6a('0xc8')](_0xbc6a('0xbb'))[_0xbc6a('0x95')](),'sender':_0x500573[_0xbc6a('0xd0')]==='out'?_0x500573['User']?_0x500573[_0xbc6a('0x6c')]['fullname']:'System':_0x500573['Contact'][_0xbc6a('0xcc')]+(_0x500573[_0xbc6a('0xe3')]['lastName']?'\x20'+_0x500573['Contact'][_0xbc6a('0xcd')]:''),'body':_0x500573['Attachment']?_0x500573['Attachment'][_0xbc6a('0xdf')]:_0x500573[_0xbc6a('0xb2')],'direction':_0x500573[_0xbc6a('0xd0')]==='out'?'A':'C','secret':_0x500573[_0xbc6a('0xd1')],'read':_0x500573[_0xbc6a('0x7a')],'attachment':_0x500573[_0xbc6a('0xce')]};})[_0xbc6a('0x63')]()};return ejs[_0xbc6a('0xe4')](path[_0xbc6a('0xc2')](config[_0xbc6a('0xc3')],_0xbc6a('0xc4'),_0xbc6a('0xe5'),_0xbc6a('0xe6')),{'interaction':_0x34a843})[_0xbc6a('0x28')](function(_0x5c2848){return new BPromise(function(_0x4952dd,_0x393e6c){pdf[_0xbc6a('0xb1')](_0x5c2848,_0x811615)[_0xbc6a('0xe7')](path[_0xbc6a('0xc2')](_0x4c89f7,_0xbc6a('0xe8')+_0x4fe7be['id']+'-'+_0x435a37+'.pdf'),function(_0x39b068,_0x42ce40){if(_0x39b068)return _0x393e6c(_0x39b068);_0x4952dd(_0x42ce40);});});})[_0xbc6a('0x28')](function(){return new BPromise(function(_0xce8d3e,_0x286717){zipdir(_0x4c89f7,{'saveTo':_0x635eeb},function(_0x4da2c6,_0x33dad5){if(_0x4da2c6)return _0x286717(_0x4da2c6);return _0xce8d3e(_0x33dad5);});})[_0xbc6a('0x28')](function(){return new BPromise(function(_0x56d37d,_0x522522){rimraf(_0x4c89f7,function(_0x9a6c52){if(_0x9a6c52)_0x522522(_0x9a6c52);return _0x56d37d();});});})[_0xbc6a('0x28')](function(){return _0x171a0d['download'](_0x635eeb,_0x2d4266,function(_0x5aa3e1){if(_0x5aa3e1){console[_0xbc6a('0xe9')](_0xbc6a('0xea'),_0x5aa3e1);}else{fs[_0xbc6a('0xeb')](_0x635eeb);}});});});}else{return _0x171a0d['sendStatus'](0xc8);}})['catch'](handleError(_0x171a0d,null));}; \ No newline at end of file +var _0x044c=['../../mysqldb','redis','defaults','localhost','./openchannelInteraction.socket','register','sendStatus','status','count','offset','limit','set','Content-Range','json','reject','save','destroy','then','error','stack','send','Users','map','fullname','TagIds','Tags','split','forEach','push','catch','index','OpenchannelInteraction','rawAttributes','fieldName','type','key','query','intersection','attributes','model','fields','length','hasOwnProperty','order','sort','filters','pick','select','field','name','color','tools_tags','u.fullname','ui.OpenchannelInteractionId','from','user_has_openchannel_interactions','left_join','users','u.id\x20=\x20ui.UserId','cm_contacts','o.id\x20=\x20i.UserId','openchannel_accounts','openchannel_messages','me.OpenchannelInteractionId\x20=\x20i.id','expr','sqlOperator','conditions','unreadMessages','value','having','`\x20>\x200','Contact','operator','$substring','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','find','ContactId','buildExpression','end','Tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','User','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','text','start','keys','some','compact','isEmpty','OpenchannelAccountId','where','i.OpenchannelAccountId\x20IN\x20?','concat','parse','$gte','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','isArray','filter','replace','\x27\x27\x27\x27','i.id\x20LIKE\x20?','getFullTextValue','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','group','i.id','Sequelize','SELECT','DESC','t.id\x20IN\x20?','resolve','i.OpenchannelAccountId\x20IS\x20NOT\x20NULL','getOpenchannelAccounts','i.OpenchannelAccountId\x20IS\x20NULL','sequelize','toString','keyBy','merge','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','Account.key','a.mandatoryDisposition','Account.mandatoryDisposition','i.*','c.firstName','Contact.firstName','c.lastName','Contact.lastName','c.email','Contact.email','Contact.phone','c.mobile','Contact.mobile','c.fax','Contact.fax','o.fullname','Owner.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.OpenchannelInteractionId\x20IN\x20?','OpenchannelInteractionId','rows','params','includeAll','include','options','create','body','update','describe','addMessage','OpenchannelMessage','ids','omit','getMessages','findOne','nolimit','format','YYYY-MM-DD\x20HH:mm:ss','findAll','addTags','setTags','spread','openchannelInteractionTags:save','removeTags','unix','join','server','files','tmp','root','attachments','transcript-%d-%s.zip','CmContact','firstName','Attachment','createdAt','secret','OpenchannelAccount','Owner','get','mkdirSync','10px','40px','\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20
Interaction\x20Transcript
\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','30px','\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20%s\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20{{page}}/{{pages}}\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20%s\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','%s\x20#%d','Openchannel','YYYY-MM-DD','N.A.','closed','disposition','threadId','Private','Messages','basename','createReadStream','createWriteStream','direction','out','lastName','renderFile','views','downloadInteraction.html','toFile','transcript-','.pdf','download','unlinkSync','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','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment'];(function(_0x13191c,_0x562d0f){var _0xdf46ce=function(_0x5803e4){while(--_0x5803e4){_0x13191c['push'](_0x13191c['shift']());}};_0xdf46ce(++_0x562d0f);}(_0x044c,0x1d1));var _0xc044=function(_0x45f193,_0x155044){_0x45f193=_0x45f193-0x0;var _0x556d57=_0x044c[_0x45f193];return _0x556d57;};'use strict';var pdf=require(_0xc044('0x0'));var emlformat=require(_0xc044('0x1'));var rimraf=require(_0xc044('0x2'));var zipdir=require(_0xc044('0x3'));var jsonpatch=require(_0xc044('0x4'));var rp=require(_0xc044('0x5'));var moment=require(_0xc044('0x6'));var BPromise=require(_0xc044('0x7'));var Mustache=require(_0xc044('0x8'));var util=require(_0xc044('0x9'));var path=require(_0xc044('0xa'));var sox=require('sox');var csv=require(_0xc044('0xb'));var ejs=require(_0xc044('0xc'));var fs=require('fs');var _=require(_0xc044('0xd'));var squel=require('squel');var crypto=require(_0xc044('0xe'));var jsforce=require(_0xc044('0xf'));var deskjs=require(_0xc044('0x10'));var toCsv=require(_0xc044('0xb'));var querystring=require(_0xc044('0x11'));var Papa=require(_0xc044('0x12'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xc044('0x13'));var as=require(_0xc044('0x14'));var hardwareService=require(_0xc044('0x15'));var logger=require(_0xc044('0x16'))(_0xc044('0x17'));var utils=require('../../config/utils');var config=require(_0xc044('0x18'));var db=require(_0xc044('0x19'))['db'];config[_0xc044('0x1a')]=_[_0xc044('0x1b')](config[_0xc044('0x1a')],{'host':_0xc044('0x1c'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xc044('0x1a')]));require(_0xc044('0x1d'))[_0xc044('0x1e')](socket);function respondWithStatusCode(_0x3f5397,_0x401456){_0x401456=_0x401456||0xcc;return function(_0x13efd8){if(_0x13efd8){return _0x3f5397[_0xc044('0x1f')](_0x401456);}return _0x3f5397[_0xc044('0x20')](_0x401456)['end']();};}function respondWithResult(_0x641a63,_0x4ca66a){_0x4ca66a=_0x4ca66a||0xc8;return function(_0x57c64b){if(_0x57c64b){return _0x641a63['status'](_0x4ca66a)['json'](_0x57c64b);}};}function respondWithFilteredResult(_0x46b461,_0x466755){return function(_0xdb3663){if(_0xdb3663){var _0x4e4b77=_0xdb3663[_0xc044('0x21')],_0xa9330d=_0x466755[_0xc044('0x22')],_0x42d1b2=_0x466755[_0xc044('0x22')]+_0x466755[_0xc044('0x23')],_0x54a61c;if(_0x42d1b2>=_0x4e4b77){_0x42d1b2=_0x4e4b77;_0x54a61c=0xc8;}else{_0x54a61c=0xce;}_0x46b461[_0xc044('0x20')](_0x54a61c);return _0x46b461[_0xc044('0x24')](_0xc044('0x25'),_0xa9330d+'-'+_0x42d1b2+'/'+_0x4e4b77)[_0xc044('0x26')](_0xdb3663);}return null;};}function patchUpdates(_0x20b44d){return function(_0x287bb9){try{jsonpatch['apply'](_0x287bb9,_0x20b44d,!![]);}catch(_0x8fcf47){return BPromise[_0xc044('0x27')](_0x8fcf47);}return _0x287bb9[_0xc044('0x28')]();};}function saveUpdates(_0x5358fa,_0x2296f2){return function(_0x1e3297){if(_0x1e3297){return _0x1e3297['update'](_0x5358fa)['then'](function(_0x44cd5c){return _0x44cd5c;});}return null;};}function removeEntity(_0x5947e1,_0x4f11cb){return function(_0x2ce093){if(_0x2ce093){return _0x2ce093[_0xc044('0x29')]()[_0xc044('0x2a')](function(){_0x5947e1[_0xc044('0x20')](0xcc)['end']();});}};}function handleEntityNotFound(_0x95767a,_0x3a980b){return function(_0x2a8a22){if(!_0x2a8a22){_0x95767a[_0xc044('0x1f')](0x194);}return _0x2a8a22;};}function handleError(_0x558b0f,_0x3f39e7){_0x3f39e7=_0x3f39e7||0x1f4;return function(_0x5bbe0d){logger[_0xc044('0x2b')](_0x5bbe0d[_0xc044('0x2c')]);if(_0x5bbe0d['name']){delete _0x5bbe0d['name'];}_0x558b0f[_0xc044('0x20')](_0x3f39e7)[_0xc044('0x2d')](_0x5bbe0d);};}function getInteractionUsers(_0xed75fb,_0x37fc35){return new BPromise(function(_0x353635,_0xb2c48b){try{if(_0x37fc35[_0xed75fb['id']]){_0xed75fb[_0xc044('0x2e')]=_[_0xc044('0x2f')](_0x37fc35[_0xed75fb['id']],function(_0x396a8b){return{'id':_0x396a8b['id'],'fullname':_0x396a8b[_0xc044('0x30')]};});}}catch(_0x1b35e4){_0xb2c48b(_0x1b35e4);}_0x353635(_0xed75fb);});}function getInteractionTags(_0x3df610,_0x215489){return new BPromise(function(_0x3f6071,_0x49f6dd){try{if(_0x3df610[_0xc044('0x31')]){_0x3df610[_0xc044('0x32')]=[];_0x3df610['TagIds'][_0xc044('0x33')](',')[_0xc044('0x34')](function(_0x279022){_0x3df610[_0xc044('0x32')][_0xc044('0x35')](_0x215489[_0x279022]);});}delete _0x3df610['TagIds'];}catch(_0x393d44){_0x49f6dd(_0x393d44);}_0x3f6071(_0x3df610);});}function updateOpenchannelInteraction(_0x310c6,_0x143fac,_0x55e473){return new BPromise(function(_0x5c86ac,_0x24698c){return getInteractionUsers(_0x310c6,_0x55e473)['then'](function(_0x23bbfb){return getInteractionTags(_0x23bbfb,_0x143fac);})[_0xc044('0x2a')](function(_0x19d59e){_0x5c86ac(_0x19d59e);})[_0xc044('0x36')](function(_0x317b31){_0x24698c(_0x317b31);});});}exports[_0xc044('0x37')]=function(_0xe1981d,_0x1df1e2){var _0x4dc361={},_0x111863={},_0x3197e0={'count':0x0,'rows':[]};var _0x1904f7=_[_0xc044('0x2f')](db[_0xc044('0x38')][_0xc044('0x39')],function(_0x4e1969){return{'name':_0x4e1969[_0xc044('0x3a')],'type':_0x4e1969[_0xc044('0x3b')][_0xc044('0x3c')]};});_0x111863['model']=_[_0xc044('0x2f')](_0x1904f7,'name');_0x111863[_0xc044('0x3d')]=_['keys'](_0xe1981d[_0xc044('0x3d')]);_0x111863['filters']=_[_0xc044('0x3e')](_0x111863['model'],_0x111863[_0xc044('0x3d')]);_0x4dc361[_0xc044('0x3f')]=_['intersection'](_0x111863[_0xc044('0x40')],qs[_0xc044('0x41')](_0xe1981d['query'][_0xc044('0x41')]));_0x4dc361[_0xc044('0x3f')]=_0x4dc361['attributes'][_0xc044('0x42')]?_0x4dc361[_0xc044('0x3f')]:_0x111863[_0xc044('0x40')];if(!_0xe1981d[_0xc044('0x3d')][_0xc044('0x43')]('nolimit')){_0x4dc361[_0xc044('0x23')]=qs[_0xc044('0x23')](_0xe1981d[_0xc044('0x3d')][_0xc044('0x23')]);_0x4dc361[_0xc044('0x22')]=qs[_0xc044('0x22')](_0xe1981d[_0xc044('0x3d')][_0xc044('0x22')]);}_0x4dc361[_0xc044('0x44')]=qs[_0xc044('0x45')](_0xe1981d[_0xc044('0x3d')][_0xc044('0x45')]);_0x4dc361['where']=qs[_0xc044('0x46')](_[_0xc044('0x47')](_0xe1981d[_0xc044('0x3d')],_0x111863[_0xc044('0x46')]),_0x1904f7);var _0x28fcb5=[];var _0x1bf075=squel[_0xc044('0x48')]()[_0xc044('0x49')]('id')[_0xc044('0x49')](_0xc044('0x4a'))[_0xc044('0x49')](_0xc044('0x4b'))['from'](_0xc044('0x4c'));var _0x15e2b8=squel['select']()[_0xc044('0x49')]('u.id')[_0xc044('0x49')](_0xc044('0x4d'))[_0xc044('0x49')](_0xc044('0x4e'))[_0xc044('0x4f')](_0xc044('0x50'),'ui')[_0xc044('0x51')](_0xc044('0x52'),'u',_0xc044('0x53'));var _0x1aedb7=squel[_0xc044('0x48')]()[_0xc044('0x4f')]('openchannel_interactions','i')['left_join'](_0xc044('0x54'),'c','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL')['left_join']('users','o',_0xc044('0x55'))['left_join'](_0xc044('0x56'),'a','a.id\x20=\x20i.OpenchannelAccountId')[_0xc044('0x51')](_0xc044('0x57'),'me',_0xc044('0x58'))[_0xc044('0x51')]('openchannel_interaction_has_tags','it','it.OpenchannelInteractionId\x20=\x20i.id')[_0xc044('0x51')]('tools_tags','t','t.id\x20=\x20it.TagId');var _0x3ba853=squel[_0xc044('0x59')]();var _0x472745=[];var _0x2f987b=squel[_0xc044('0x59')]();var _0x24dfb3;if(_0xe1981d[_0xc044('0x3d')]['search']){_0x24dfb3=as['parseSearch'](_0xe1981d['query']['search']);var _0x53e159=_0x24dfb3[_0xc044('0x5a')];for(var _0x5da0cc=0x0;_0x5da0cc<_0x24dfb3[_0xc044('0x5b')][_0xc044('0x42')];_0x5da0cc++){var _0x3405f3=_0x24dfb3[_0xc044('0x5b')][_0x5da0cc];var _0x21bfc7='i';var _0x5be7d9=_['find'](_0x1904f7,[_0xc044('0x4a'),_0x3405f3[_0xc044('0x49')]]);if(!_0x5be7d9){switch(_0x3405f3[_0xc044('0x49')]){case _0xc044('0x5c'):if(_0x3405f3[_0xc044('0x5d')]==0x1){_0x1aedb7['having']('`'+_0x3405f3['field']+'`\x20=\x200');}else{_0x1aedb7[_0xc044('0x5e')]('`'+_0x3405f3[_0xc044('0x49')]+_0xc044('0x5f'));}break;case _0xc044('0x60'):if(_0x3405f3[_0xc044('0x61')]===_0xc044('0x62')){if(_0x3405f3[_0xc044('0x5d')][_0xc044('0x33')]('\x20')['length']>0x1){_0x3ba853[_0x53e159](_0xc044('0x63'),qs['getFullTextValue'](_0x3405f3[_0xc044('0x5d')]),null);}else{var _0x15e222='%'+_0x3405f3[_0xc044('0x5d')]+'%';_0x3ba853[_0x53e159](_0xc044('0x64'),_0x15e222,_0x15e222,_0x15e222);}}else{_0x5be7d9=_[_0xc044('0x65')](_0x1904f7,[_0xc044('0x4a'),_0xc044('0x66')]);_0x3405f3[_0xc044('0x49')]=_0xc044('0x66');_0x5ee0a8=as[_0xc044('0x67')](_0x21bfc7,_0x5be7d9[_0xc044('0x3b')],_0x3405f3);_0x3ba853[_0x53e159](_0x5ee0a8['text'],_0x5ee0a8[_0xc044('0x5d')]['start'],_0x5ee0a8[_0xc044('0x5d')][_0xc044('0x68')]);}break;case _0xc044('0x69'):var _0x55870e=_0x3405f3[_0xc044('0x5d')][_0xc044('0x33')](',')[_0xc044('0x2f')](function(_0x231b04){return Number(_0x231b04);});_0x55870e[_0xc044('0x34')](function(_0x158d31){_0x2f987b['or'](_0xc044('0x6a'),'%,'+_0x158d31+',%');});_0x472745=_[_0xc044('0x6b')](_0x472745,_0x55870e);break;case _0xc044('0x6c'):if(_0x3405f3[_0xc044('0x61')]===_0xc044('0x62')){_0x3ba853[_0x53e159](_0xc044('0x6d'),'%'+_0x3405f3['value']+'%',null);}else{_0x5be7d9=_[_0xc044('0x65')](_0x1904f7,[_0xc044('0x4a'),_0xc044('0x6e')]);_0x3405f3['field']=_0xc044('0x6e');_0x5ee0a8=as['buildExpression'](_0x21bfc7,_0x5be7d9[_0xc044('0x3b')],_0x3405f3);_0x3ba853[_0x53e159](_0x5ee0a8[_0xc044('0x6f')],_0x5ee0a8['value'][_0xc044('0x70')],_0x5ee0a8[_0xc044('0x5d')]['end']);}break;case'body':_0x5ee0a8=as[_0xc044('0x67')]('me',null,_0x3405f3);_0x3ba853[_0x53e159](_0x5ee0a8[_0xc044('0x6f')],_0x5ee0a8[_0xc044('0x5d')][_0xc044('0x70')],_0x5ee0a8['value'][_0xc044('0x68')]);break;}}else{var _0x5ee0a8=as[_0xc044('0x67')](_0x21bfc7,_0x5be7d9[_0xc044('0x3b')],_0x3405f3);_0x3ba853[_0x53e159](_0x5ee0a8[_0xc044('0x6f')],_0x5ee0a8['value'][_0xc044('0x70')],_0x5ee0a8[_0xc044('0x5d')][_0xc044('0x68')]);}}}else{var _0x1bd367=_(_0xe1981d[_0xc044('0x3d')])[_0xc044('0x71')]()['map'](function(_0x95ad86){return _[_0xc044('0x72')](_0x1904f7,[_0xc044('0x4a'),_0x95ad86])?_0x95ad86:undefined;})[_0xc044('0x73')]()[_0xc044('0x5d')]();if(!_[_0xc044('0x74')](_0x1bd367)){_0x1bd367[_0xc044('0x34')](function(_0xddd11a){if(_0xddd11a===_0xc044('0x75')){_0x1aedb7[_0xc044('0x76')](_0xc044('0x77'),[][_0xc044('0x78')](_0xe1981d['query'][_0xddd11a]));}else if(_0xddd11a==='createdAt'){var _0x4d5fe2=JSON[_0xc044('0x79')](_0xe1981d[_0xc044('0x3d')][_0xddd11a])[_0xc044('0x7a')];var _0x3bb286=JSON['parse'](_0xe1981d[_0xc044('0x3d')][_0xddd11a])[_0xc044('0x7b')];_0x1aedb7['where'](_0xc044('0x7c'),_0x4d5fe2,_0x3bb286);}else{if(_0xe1981d['query'][_0xddd11a]===_0xc044('0x7d')){_0x1aedb7['where']('i.'+_0xddd11a+_0xc044('0x7e'));}else{_0x1aedb7[_0xc044('0x76')]('i.'+_0xddd11a+_0xc044('0x7f'),_0xe1981d['query'][_0xddd11a]);}}});}if(_0xe1981d[_0xc044('0x3d')][_0xc044('0x80')]){if(_0xe1981d[_0xc044('0x3d')]['read']==0x1){_0x1aedb7[_0xc044('0x5e')](_0xc044('0x81'));}else{_0x1aedb7[_0xc044('0x5e')](_0xc044('0x82'));}}if(_0xe1981d[_0xc044('0x3d')][_0xc044('0x83')]){_0x472745=_[_0xc044('0x84')](_0xe1981d[_0xc044('0x3d')][_0xc044('0x83')])?_0xe1981d[_0xc044('0x3d')]['tag']:new Array(_0xe1981d[_0xc044('0x3d')][_0xc044('0x83')]);_0x472745['forEach'](function(_0x5e597d){_0x2f987b['or'](_0xc044('0x6a'),'%,'+_0x5e597d+',%');});}if(_0xe1981d[_0xc044('0x3d')]['filter']){var _0x47909d=_0xe1981d[_0xc044('0x3d')][_0xc044('0x85')][_0xc044('0x86')]('\x5c','\x5c\x5c')[_0xc044('0x86')]('\x27\x27',_0xc044('0x87'));if(qs['isNumeric'](_0x47909d)){_0x3ba853['or'](_0xc044('0x88'),_0x47909d+'%');}else{_0x3ba853['or']('MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0xc044('0x89')](_0x47909d))['or']('i.from\x20LIKE\x20?',_0x47909d+'%')['or'](_0xc044('0x8a'),_0x47909d+'%');}}}_0x1aedb7[_0xc044('0x76')](_0x3ba853);_0x1aedb7[_0xc044('0x8b')](_0xc044('0x8c'));var _0x3f05ba={'type':db[_0xc044('0x8d')]['QueryTypes'][_0xc044('0x8e')],'raw':!![]};var _0x49c606=_0x1aedb7['clone']();_0x49c606[_0xc044('0x49')](_0xc044('0x8c'));_0x49c606[_0xc044('0x49')]('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0xc044('0x5c'));if(_0x4dc361[_0xc044('0x44')]){_0x4dc361[_0xc044('0x44')][_0xc044('0x34')](function(_0x4ab12d){_0x1aedb7[_0xc044('0x44')]('i.'+_0x4ab12d[0x0],_0x4ab12d[0x1]===_0xc044('0x8f')?![]:!![]);});}if(!_[_0xc044('0x74')](_0x472745)){_0x1aedb7['having'](_0x2f987b);_0x49c606['where'](_0xc044('0x90'),_0x472745);}BPromise[_0xc044('0x91')]()[_0xc044('0x2a')](function(){if(!_0x24dfb3){if(_0xe1981d['query'][_0xc044('0x75')]||_0xe1981d['query']['journey'])return;_0x49c606[_0xc044('0x76')]('i.OpenchannelAccountId\x20IS\x20NOT\x20NULL');_0x1aedb7[_0xc044('0x76')](_0xc044('0x92'));return;}return _0xe1981d['user'][_0xc044('0x93')]({'attributes':['id'],'raw':!![]})[_0xc044('0x2a')](function(_0xf027b7){if(_[_0xc044('0x74')](_0xf027b7)){_0x49c606[_0xc044('0x76')](_0xc044('0x94'));_0x1aedb7[_0xc044('0x76')](_0xc044('0x94'));}else{_0x49c606[_0xc044('0x76')](_0xc044('0x77'),_[_0xc044('0x2f')](_0xf027b7,'id'));_0x1aedb7[_0xc044('0x76')](_0xc044('0x77'),_['map'](_0xf027b7,'id'));}});})[_0xc044('0x2a')](function(){db[_0xc044('0x95')][_0xc044('0x3d')](_0x49c606[_0xc044('0x96')](),_0x3f05ba)[_0xc044('0x2a')](function(_0x39f540){_0x3197e0[_0xc044('0x21')]=_0x39f540[_0xc044('0x42')];if(_0x3197e0[_0xc044('0x21')]===0x0)return[];return db[_0xc044('0x95')][_0xc044('0x3d')](_0x1bf075[_0xc044('0x96')](),_0x3f05ba)['then'](function(_0xa7305){_0x28fcb5=_[_0xc044('0x97')](_0xa7305,'id');_0x3f05ba=_[_0xc044('0x98')](_0x3f05ba,{'model':db[_0xc044('0x38')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0xe1981d[_0xc044('0x3d')][_0xc044('0x41')]){_0x4dc361[_0xc044('0x3f')][_0xc044('0x34')](function(_0x386e7d){_0x1aedb7[_0xc044('0x49')]('i.'+_0x386e7d);});}else{_0x1aedb7[_0xc044('0x49')](_0xc044('0x99'),_0xc044('0x5c'));_0x1aedb7[_0xc044('0x49')]('a.key',_0xc044('0x9a'));_0x1aedb7[_0xc044('0x49')](_0xc044('0x9b'),_0xc044('0x9c'));_0x1aedb7['field'](_0xc044('0x9d'));_0x1aedb7[_0xc044('0x49')](_0xc044('0x9e'),_0xc044('0x9f'));_0x1aedb7[_0xc044('0x49')](_0xc044('0xa0'),_0xc044('0xa1'));_0x1aedb7[_0xc044('0x49')](_0xc044('0xa2'),_0xc044('0xa3'));_0x1aedb7['field']('c.phone',_0xc044('0xa4'));_0x1aedb7[_0xc044('0x49')](_0xc044('0xa5'),_0xc044('0xa6'));_0x1aedb7['field'](_0xc044('0xa7'),_0xc044('0xa8'));_0x1aedb7[_0xc044('0x49')](_0xc044('0xa9'),_0xc044('0xaa'));_0x1aedb7['field'](_0xc044('0xab'),_0xc044('0xac'));_0x1aedb7['field'](_0xc044('0xad'),_0xc044('0x31'));}if(_0x4dc361['limit'])_0x1aedb7[_0xc044('0x23')](_0x4dc361[_0xc044('0x23')]);if(_0x4dc361[_0xc044('0x22')])_0x1aedb7[_0xc044('0x22')](_0x4dc361[_0xc044('0x22')]);return db['sequelize'][_0xc044('0x3d')](_0x1aedb7[_0xc044('0x96')](),_0x3f05ba);})[_0xc044('0x2a')](function(_0x68d132){_0x15e2b8[_0xc044('0x76')](_0xc044('0xae'),_['map'](_0x68d132,'id'));return db[_0xc044('0x95')][_0xc044('0x3d')](_0x15e2b8['toString'](),_0x3f05ba)[_0xc044('0x2a')](function(_0x1cc706){var _0x28e8db=_['groupBy'](_0x1cc706,_0xc044('0xaf'));var _0x538d5e=[];_0x68d132[_0xc044('0x34')](function(_0x207a0a){_0x538d5e[_0xc044('0x35')](updateOpenchannelInteraction(_0x207a0a,_0x28fcb5,_0x28e8db));});return BPromise['all'](_0x538d5e);});});})[_0xc044('0x2a')](function(_0x117151){_0x3197e0[_0xc044('0xb0')]=_0x117151;return _0x3197e0;})[_0xc044('0x2a')](respondWithFilteredResult(_0x1df1e2,_0x4dc361));})[_0xc044('0x36')](handleError(_0x1df1e2,null));};exports['show']=function(_0x361251,_0x1f46b7){var _0x45bba9={'raw':![],'where':{'id':_0x361251[_0xc044('0xb1')]['id']}},_0x45b4e5={};_0x45b4e5['model']=_[_0xc044('0x71')](db[_0xc044('0x38')][_0xc044('0x39')]);_0x45b4e5['query']=_['keys'](_0x361251[_0xc044('0x3d')]);_0x45b4e5[_0xc044('0x46')]=_[_0xc044('0x3e')](_0x45b4e5[_0xc044('0x40')],_0x45b4e5['query']);_0x45bba9['attributes']=_['intersection'](_0x45b4e5[_0xc044('0x40')],qs[_0xc044('0x41')](_0x361251[_0xc044('0x3d')]['fields']));_0x45bba9[_0xc044('0x3f')]=_0x45bba9[_0xc044('0x3f')]['length']?_0x45bba9['attributes']:_0x45b4e5[_0xc044('0x40')];if(_0x361251[_0xc044('0x3d')][_0xc044('0xb2')]){_0x45bba9[_0xc044('0xb3')]=[{'all':!![]}];}_0x45bba9=_[_0xc044('0x98')]({},_0x45bba9,_0x361251[_0xc044('0xb4')]);return db[_0xc044('0x38')]['find'](_0x45bba9)[_0xc044('0x2a')](handleEntityNotFound(_0x1f46b7,null))[_0xc044('0x2a')](respondWithResult(_0x1f46b7,null))[_0xc044('0x36')](handleError(_0x1f46b7,null));};exports[_0xc044('0xb5')]=function(_0x559fc0,_0x435e5f){return db[_0xc044('0x38')][_0xc044('0xb5')](_0x559fc0[_0xc044('0xb6')],{})[_0xc044('0x2a')](respondWithResult(_0x435e5f,0xc9))['catch'](handleError(_0x435e5f,null));};exports[_0xc044('0xb7')]=function(_0x55dfa1,_0x1e590a){if(_0x55dfa1[_0xc044('0xb6')]['id']){delete _0x55dfa1['body']['id'];}return db[_0xc044('0x38')][_0xc044('0x65')]({'where':{'id':_0x55dfa1[_0xc044('0xb1')]['id']}})[_0xc044('0x2a')](handleEntityNotFound(_0x1e590a,null))['then'](saveUpdates(_0x55dfa1[_0xc044('0xb6')],null))[_0xc044('0x2a')](respondWithResult(_0x1e590a,null))[_0xc044('0x36')](handleError(_0x1e590a,null));};exports[_0xc044('0x29')]=function(_0x1f987d,_0x5b511d){return db[_0xc044('0x38')][_0xc044('0x65')]({'where':{'id':_0x1f987d[_0xc044('0xb1')]['id']}})[_0xc044('0x2a')](handleEntityNotFound(_0x5b511d,null))[_0xc044('0x2a')](removeEntity(_0x5b511d,null))[_0xc044('0x36')](handleError(_0x5b511d,null));};exports[_0xc044('0xb8')]=function(_0x4470b8,_0x7fde27){return db['OpenchannelInteraction']['describe']()['then'](respondWithResult(_0x7fde27,null))['catch'](handleError(_0x7fde27,null));};exports[_0xc044('0xb9')]=function(_0x211359,_0x30137e,_0x203e02){return db[_0xc044('0xba')][_0xc044('0x65')]({'where':{'id':_0x211359['params']['id']}})[_0xc044('0x2a')](handleEntityNotFound(_0x30137e,null))[_0xc044('0x2a')](function(_0x3c012d){if(_0x3c012d){return _0x3c012d[_0xc044('0xb9')](_0x211359[_0xc044('0xb6')][_0xc044('0xbb')],_[_0xc044('0xbc')](_0x211359[_0xc044('0xb6')],[_0xc044('0xbb'),'id'])||{});}})['then'](respondWithResult(_0x30137e,null))[_0xc044('0x36')](handleError(_0x30137e,null));};exports[_0xc044('0xbd')]=function(_0x49fd24,_0xb2a515,_0x25e527){var _0x6422bb={'raw':![],'where':{}};var _0x557a37={};var _0x4f4402={'count':0x0,'rows':[]};return db['OpenchannelInteraction'][_0xc044('0xbe')]({'where':{'id':_0x49fd24[_0xc044('0xb1')]['id']}})['then'](handleEntityNotFound(_0xb2a515,null))[_0xc044('0x2a')](function(_0x506ea5){if(_0x506ea5){_0x557a37[_0xc044('0x40')]=_[_0xc044('0x71')](db['OpenchannelMessage'][_0xc044('0x39')]);_0x557a37[_0xc044('0x3d')]=_[_0xc044('0x71')](_0x49fd24[_0xc044('0x3d')]);_0x557a37['filters']=_['intersection'](_0x557a37['model'],_0x557a37[_0xc044('0x3d')]);_0x6422bb[_0xc044('0x3f')]=_[_0xc044('0x3e')](_0x557a37[_0xc044('0x40')],qs['fields'](_0x49fd24[_0xc044('0x3d')]['fields']));_0x6422bb[_0xc044('0x3f')]=_0x6422bb[_0xc044('0x3f')][_0xc044('0x42')]?_0x6422bb[_0xc044('0x3f')]:_0x557a37[_0xc044('0x40')];if(!_0x49fd24['query'][_0xc044('0x43')](_0xc044('0xbf'))){_0x6422bb['limit']=qs[_0xc044('0x23')](_0x49fd24[_0xc044('0x3d')][_0xc044('0x23')]);_0x6422bb['offset']=qs[_0xc044('0x22')](_0x49fd24[_0xc044('0x3d')]['offset']);}_0x6422bb[_0xc044('0x44')]=qs[_0xc044('0x45')](_0x49fd24[_0xc044('0x3d')][_0xc044('0x45')]);_0x6422bb[_0xc044('0x76')]=qs[_0xc044('0x46')](_[_0xc044('0x47')](_0x49fd24[_0xc044('0x3d')],_0x557a37[_0xc044('0x46')]));_0x6422bb[_0xc044('0x76')][_0xc044('0xaf')]=_0x506ea5['id'];if(_0x49fd24[_0xc044('0x3d')][_0xc044('0x85')]){_0x6422bb[_0xc044('0x76')]=_['merge'](_0x6422bb[_0xc044('0x76')],{'$or':_[_0xc044('0x2f')](_0x6422bb['attributes'],function(_0x5d5b50){var _0x5342d9={};_0x5342d9[_0x5d5b50]={'$like':'%'+_0x49fd24['query'][_0xc044('0x85')]+'%'};return _0x5342d9;})});}if(_0x49fd24['query'][_0xc044('0x7a')]){var _0x58db56=_0x49fd24[_0xc044('0x3d')][_0xc044('0x7a')][_0xc044('0x33')](',');var _0xb0d9ca={};_0xb0d9ca[_0x58db56[0x0]]={'$gte':moment(_0x58db56[0x1])[_0xc044('0xc0')](_0xc044('0xc1'))};_0x6422bb[_0xc044('0x76')]=_['merge'](_0x6422bb['where'],_0xb0d9ca);}_0x6422bb=_[_0xc044('0x98')]({},_0x6422bb,_0x49fd24[_0xc044('0xb4')]);return db['OpenchannelMessage'][_0xc044('0x21')]({'where':_0x6422bb[_0xc044('0x76')]})[_0xc044('0x2a')](function(_0xdf2793){_0x4f4402[_0xc044('0x21')]=_0xdf2793;if(_0x49fd24[_0xc044('0x3d')][_0xc044('0xb2')]){_0x6422bb['include']=[{'all':!![]}];}return db['OpenchannelMessage'][_0xc044('0xc2')](_0x6422bb);})['then'](function(_0x5e2ce6){_0x4f4402[_0xc044('0xb0')]=_0x5e2ce6;return _0x4f4402;});}})[_0xc044('0x2a')](respondWithFilteredResult(_0xb2a515,_0x6422bb))[_0xc044('0x36')](handleError(_0xb2a515,null));};exports[_0xc044('0xc3')]=function(_0x1389dd,_0x3c045e,_0x3476b3){return db['OpenchannelInteraction']['find']({'where':{'id':_0x1389dd[_0xc044('0xb1')]['id']}})[_0xc044('0x2a')](handleEntityNotFound(_0x3c045e,null))[_0xc044('0x2a')](function(_0x1760dd){if(_0x1760dd){return _0x1760dd[_0xc044('0xc4')](_0x1389dd[_0xc044('0xb6')][_0xc044('0xbb')],_[_0xc044('0xbc')](_0x1389dd[_0xc044('0xb6')],[_0xc044('0xbb'),'id'])||{})[_0xc044('0xc5')](function(){return db[_0xc044('0x69')][_0xc044('0xc2')]({'attributes':['id',_0xc044('0x4a'),'color'],'where':{'id':_0x1389dd[_0xc044('0xb6')]['ids']}});})[_0xc044('0x2a')](function(_0x28c6a1){socket['emit'](_0xc044('0xc6'),{'id':Number(_0x1389dd[_0xc044('0xb1')]['id']),'tags':_0x28c6a1||[]});return{'id':Number(_0x1389dd[_0xc044('0xb1')]['id']),'tags':_0x28c6a1||[]};});}})[_0xc044('0x2a')](respondWithResult(_0x3c045e,null))[_0xc044('0x36')](handleError(_0x3c045e,null));};exports[_0xc044('0xc7')]=function(_0x22d65d,_0x42a724,_0x315966){return db[_0xc044('0x38')]['find']({'where':{'id':_0x22d65d['params']['id']}})[_0xc044('0x2a')](handleEntityNotFound(_0x42a724,null))[_0xc044('0x2a')](function(_0x4040ab){if(_0x4040ab){return _0x4040ab[_0xc044('0xc7')](_0x22d65d[_0xc044('0x3d')][_0xc044('0xbb')]);}})[_0xc044('0x2a')](respondWithStatusCode(_0x42a724,null))[_0xc044('0x36')](handleError(_0x42a724,null));};exports['download']=function(_0x52460d,_0x2e55a6){var _0x4406a8=moment()[_0xc044('0xc8')]()[_0xc044('0x96')]();var _0x1e9c66=path[_0xc044('0xc9')](config['root'],_0xc044('0xca'),_0xc044('0xcb'),_0xc044('0xcc'));var _0x2f9d39=path[_0xc044('0xc9')](config[_0xc044('0xcd')],'server','files',_0xc044('0xce'));var _0x564742=path[_0xc044('0xc9')](_0x1e9c66,_0x4406a8);var _0x101efa=util[_0xc044('0xc0')](_0xc044('0xcf'),_0x52460d[_0xc044('0xb1')]['id'],_0x4406a8);var _0x100f32=path[_0xc044('0xc9')](_0x1e9c66,_0x101efa);var _0x4fc530=[];_0x4fc530[_0xc044('0x35')]({'model':db[_0xc044('0x6c')],'as':_0xc044('0x6c'),'attributes':['id',_0xc044('0x30')],'raw':!![]});_0x4fc530['push']({'model':db[_0xc044('0xd0')],'as':_0xc044('0x60'),'attributes':['id',_0xc044('0xd1'),'lastName'],'raw':!![]});if(_0x52460d['query']['attachments']){_0x4fc530[_0xc044('0x35')]({'model':db[_0xc044('0xd2')],'as':_0xc044('0xd2'),'raw':!![]});}var _0x3abef1=[{'model':db[_0xc044('0xba')],'as':'Messages','attributes':['id','body',_0xc044('0xd3'),'direction',_0xc044('0xd4'),'read'],'include':_0x4fc530}];_0x3abef1[_0xc044('0x35')]({'model':db[_0xc044('0xd5')],'as':'Account','attributes':['id',_0xc044('0x4a')]});_0x3abef1[_0xc044('0x35')]({'model':db[_0xc044('0x6c')],'as':_0xc044('0xd6'),'attributes':['id',_0xc044('0x30')]});return db['OpenchannelInteraction'][_0xc044('0x65')]({'where':{'id':_0x52460d['params']['id']},'include':_0x3abef1})[_0xc044('0x2a')](handleEntityNotFound(_0x2e55a6,null))[_0xc044('0x2a')](function(_0x3ea6da){if(_0x3ea6da){var _0xc6fc9=_0x3ea6da[_0xc044('0xd7')]({'plain':!![]});fs[_0xc044('0xd8')](_0x564742);var _0x322d1e={'format':'A4','border':_0xc044('0xd9'),'header':{'height':_0xc044('0xda'),'contents':{'first':_0xc044('0xdb')}},'footer':{'height':_0xc044('0xdc'),'contents':{'default':util['format'](_0xc044('0xdd'),util[_0xc044('0xc0')](_0xc044('0xde'),_0xc044('0xdf'),_0xc6fc9['id']),moment()[_0xc044('0xc0')](_0xc044('0xe0'))[_0xc044('0x96')]())}}};var _0x562078={'channel':_0xc044('0xdf'),'account':_0xc6fc9['Account']['name'],'agent':_0xc6fc9[_0xc044('0xd6')]?_0xc6fc9['Owner'][_0xc044('0x30')]:_0xc044('0xe1'),'createdAt':moment(_0xc6fc9[_0xc044('0xd3')])[_0xc044('0xc0')]('YYYY-MM-DD\x20HH:mm:ss')[_0xc044('0x96')](),'closedAt':_0xc6fc9[_0xc044('0xe2')]?moment(_0xc6fc9['closedAt'])['format'](_0xc044('0xc1'))[_0xc044('0x96')]():'','disposition':_0xc6fc9[_0xc044('0xe3')],'visibility':_0xc6fc9[_0xc044('0xe4')]?'Public':_0xc044('0xe5'),'messages':_(_0xc6fc9[_0xc044('0xe6')])[_0xc044('0x85')]({'secret':![]})[_0xc044('0x2f')](function(_0x3b64fc){if(_0x3b64fc[_0xc044('0xd2')]){var _0x3a2b35=path[_0xc044('0xc9')](_0x2f9d39,_0x3b64fc['Attachment'][_0xc044('0xe7')]);if(fs['existsSync'](_0x3a2b35)){fs[_0xc044('0xe8')](_0x3a2b35)['pipe'](fs[_0xc044('0xe9')](path[_0xc044('0xc9')](_0x564742,_0x3b64fc[_0xc044('0xd2')][_0xc044('0xe7')])));}}return{'date':moment(_0x3b64fc[_0xc044('0xd3')])[_0xc044('0xc0')](_0xc044('0xc1'))[_0xc044('0x96')](),'sender':_0x3b64fc[_0xc044('0xea')]===_0xc044('0xeb')?_0x3b64fc['User']?_0x3b64fc[_0xc044('0x6c')][_0xc044('0x30')]:'System':_0x3b64fc[_0xc044('0x60')][_0xc044('0xd1')]+(_0x3b64fc[_0xc044('0x60')][_0xc044('0xec')]?'\x20'+_0x3b64fc[_0xc044('0x60')][_0xc044('0xec')]:''),'body':_0x3b64fc['Attachment']?_0x3b64fc['Attachment'][_0xc044('0xe7')]:_0x3b64fc[_0xc044('0xb6')],'direction':_0x3b64fc[_0xc044('0xea')]===_0xc044('0xeb')?'A':'C','secret':_0x3b64fc[_0xc044('0xd4')],'read':_0x3b64fc[_0xc044('0x80')],'attachment':_0x3b64fc[_0xc044('0xd2')]};})[_0xc044('0x5d')]()};return ejs[_0xc044('0xed')](path[_0xc044('0xc9')](config[_0xc044('0xcd')],_0xc044('0xca'),_0xc044('0xee'),_0xc044('0xef')),{'interaction':_0x562078})['then'](function(_0xf8b37c){return new BPromise(function(_0x13241c,_0x97bd3d){pdf[_0xc044('0xb5')](_0xf8b37c,_0x322d1e)[_0xc044('0xf0')](path[_0xc044('0xc9')](_0x564742,_0xc044('0xf1')+_0xc6fc9['id']+'-'+_0x4406a8+_0xc044('0xf2')),function(_0x544d37,_0x4d7014){if(_0x544d37)return _0x97bd3d(_0x544d37);_0x13241c(_0x4d7014);});});})[_0xc044('0x2a')](function(){return new BPromise(function(_0x109060,_0x3ad650){zipdir(_0x564742,{'saveTo':_0x100f32},function(_0x4388ff,_0x1eb2c0){if(_0x4388ff)return _0x3ad650(_0x4388ff);return _0x109060(_0x1eb2c0);});})[_0xc044('0x2a')](function(){return new BPromise(function(_0x1e941f,_0x239fa7){rimraf(_0x564742,function(_0x4e1faf){if(_0x4e1faf)_0x239fa7(_0x4e1faf);return _0x1e941f();});});})[_0xc044('0x2a')](function(){return _0x2e55a6[_0xc044('0xf3')](_0x100f32,_0x101efa,function(_0x1ac9f3){if(_0x1ac9f3){console['log']('err',_0x1ac9f3);}else{fs[_0xc044('0xf4')](_0x100f32);}});});});}else{return _0x2e55a6[_0xc044('0x1f')](0xc8);}})['catch'](handleError(_0x2e55a6,null));}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.events.js b/server/api/openchannelInteraction/openchannelInteraction.events.js index 734debd..26abb47 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 _0x28c3=['unreadMessages','length','emit','catch','hasOwnProperty','exports','events','../../mysqldb','setMaxListeners','save','remove','getUsers','then','setDataValue','Users','findAll'];(function(_0xce4a66,_0x53e859){var _0x16894f=function(_0x38a2f9){while(--_0x38a2f9){_0xce4a66['push'](_0xce4a66['shift']());}};_0x16894f(++_0x53e859);}(_0x28c3,0xf6));var _0x328c=function(_0x29bdb7,_0x873459){_0x29bdb7=_0x29bdb7-0x0;var _0x1d4eb7=_0x28c3[_0x29bdb7];return _0x1d4eb7;};'use strict';var EventEmitter=require(_0x328c('0x0'));var OpenchannelInteraction=require(_0x328c('0x1'))['db']['OpenchannelInteraction'];var OpenchannelMessage=require(_0x328c('0x1'))['db']['OpenchannelMessage'];var OpenchannelInteractionEvents=new EventEmitter();OpenchannelInteractionEvents[_0x328c('0x2')](0x0);var events={'afterCreate':_0x328c('0x3'),'afterUpdate':'update','afterDestroy':_0x328c('0x4')};function emitEvent(_0x5f10c){return function(_0x271a5e,_0x2cfeb8,_0x11aa6b){_0x271a5e[_0x328c('0x5')]({'attributes':['id'],'raw':!![]})[_0x328c('0x6')](function(_0x7f2a5b){_0x271a5e[_0x328c('0x7')](_0x328c('0x8'),_0x7f2a5b['map'](function(_0x277db9){return{'id':_0x277db9['id']};}));return OpenchannelMessage[_0x328c('0x9')]({'where':{'OpenchannelInteractionId':_0x271a5e['id'],'direction':'in','read':![]},'raw':!![]});})[_0x328c('0x6')](function(_0x1f88d8){_0x271a5e[_0x328c('0x7')](_0x328c('0xa'),_0x1f88d8[_0x328c('0xb')]);OpenchannelInteractionEvents[_0x328c('0xc')](_0x5f10c+':'+_0x271a5e['id'],_0x271a5e);OpenchannelInteractionEvents[_0x328c('0xc')](_0x5f10c,_0x271a5e);_0x11aa6b(null);})[_0x328c('0xd')](_0x11aa6b(null));};}for(var e in events){if(events[_0x328c('0xe')](e)){var event=events[e];OpenchannelInteraction['hook'](e,emitEvent(event));}}module[_0x328c('0xf')]=OpenchannelInteractionEvents; \ No newline at end of file +var _0x528a=['remove','getUsers','then','setDataValue','Users','findAll','unreadMessages','length','emit','catch','hook','events','../../mysqldb','update'];(function(_0x147f97,_0x19f38e){var _0x18ba3b=function(_0x3642e0){while(--_0x3642e0){_0x147f97['push'](_0x147f97['shift']());}};_0x18ba3b(++_0x19f38e);}(_0x528a,0x185));var _0xa528=function(_0x30d4e7,_0x499185){_0x30d4e7=_0x30d4e7-0x0;var _0x2c99a8=_0x528a[_0x30d4e7];return _0x2c99a8;};'use strict';var EventEmitter=require(_0xa528('0x0'));var OpenchannelInteraction=require(_0xa528('0x1'))['db']['OpenchannelInteraction'];var OpenchannelMessage=require('../../mysqldb')['db']['OpenchannelMessage'];var OpenchannelInteractionEvents=new EventEmitter();OpenchannelInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0xa528('0x2'),'afterDestroy':_0xa528('0x3')};function emitEvent(_0x357833){return function(_0x3c1aaa,_0x1748a5,_0x814a51){_0x3c1aaa[_0xa528('0x4')]({'attributes':['id'],'raw':!![]})[_0xa528('0x5')](function(_0x3fb107){_0x3c1aaa[_0xa528('0x6')](_0xa528('0x7'),_0x3fb107['map'](function(_0x1ecd9b){return{'id':_0x1ecd9b['id']};}));return OpenchannelMessage[_0xa528('0x8')]({'where':{'OpenchannelInteractionId':_0x3c1aaa['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x33cffc){_0x3c1aaa[_0xa528('0x6')](_0xa528('0x9'),_0x33cffc[_0xa528('0xa')]);OpenchannelInteractionEvents[_0xa528('0xb')](_0x357833+':'+_0x3c1aaa['id'],_0x3c1aaa);OpenchannelInteractionEvents[_0xa528('0xb')](_0x357833,_0x3c1aaa);_0x814a51(null);})[_0xa528('0xc')](_0x814a51(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];OpenchannelInteraction[_0xa528('0xd')](e,emitEvent(event));}}module['exports']=OpenchannelInteractionEvents; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.model.js b/server/api/openchannelInteraction/openchannelInteraction.model.js index 008a3db..7fbfc2d 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 _0x8398=['util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','define','OpenchannelInteraction','changed','closed','closedAt','format','lodash'];(function(_0x826377,_0x5916ec){var _0x19563b=function(_0x327b00){while(--_0x327b00){_0x826377['push'](_0x826377['shift']());}};_0x19563b(++_0x5916ec);}(_0x8398,0x12b));var _0x8839=function(_0x1203f,_0x554bbc){_0x1203f=_0x1203f-0x0;var _0x365f0a=_0x8398[_0x1203f];return _0x365f0a;};'use strict';var _=require(_0x8839('0x0'));var util=require(_0x8839('0x1'));var logger=require(_0x8839('0x2'))(_0x8839('0x3'));var moment=require('moment');var BPromise=require(_0x8839('0x4'));var rp=require(_0x8839('0x5'));var fs=require('fs');var path=require(_0x8839('0x6'));var rimraf=require(_0x8839('0x7'));var config=require(_0x8839('0x8'));var attributes=require('./openchannelInteraction.attributes');module['exports']=function(_0x15032c,_0x5742d2){return _0x15032c[_0x8839('0x9')](_0x8839('0xa'),attributes,{'tableName':'openchannel_interactions','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x5078dd,_0x35c344,_0x4f5806){if(_0x5078dd[_0x8839('0xb')](_0x8839('0xc'))){_0x5078dd[_0x8839('0xd')]=moment()[_0x8839('0xe')]('YYYY-MM-DD\x20HH:mm:ss');}_0x4f5806(null,_0x5078dd);}}});}; \ No newline at end of file +var _0xa59f=['moment','request-promise','path','exports','define','OpenchannelInteraction','openchannel_interactions','closed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','../../config/logger'];(function(_0xc7cc,_0x233416){var _0x4f4bde=function(_0xf80105){while(--_0xf80105){_0xc7cc['push'](_0xc7cc['shift']());}};_0x4f4bde(++_0x233416);}(_0xa59f,0x83));var _0xfa59=function(_0x58e450,_0x3e21da){_0x58e450=_0x58e450-0x0;var _0x26193d=_0xa59f[_0x58e450];return _0x26193d;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xfa59('0x0'))('api');var moment=require(_0xfa59('0x1'));var BPromise=require('bluebird');var rp=require(_0xfa59('0x2'));var fs=require('fs');var path=require(_0xfa59('0x3'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./openchannelInteraction.attributes');module[_0xfa59('0x4')]=function(_0x307c2f,_0x3c7439){return _0x307c2f[_0xfa59('0x5')](_0xfa59('0x6'),attributes,{'tableName':_0xfa59('0x7'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x1f0349,_0x377db3,_0x362611){if(_0x1f0349['changed'](_0xfa59('0x8'))){_0x1f0349[_0xfa59('0x9')]=moment()[_0xfa59('0xa')](_0xfa59('0xb'));}_0x362611(null,_0x1f0349);}}});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.rpc.js b/server/api/openchannelInteraction/openchannelInteraction.rpc.js index 0e60d16..1fd1345 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 _0xb665=['defaults','localhost','socket.io-emitter','then','info','OpenchannelInteraction,\x20%s,\x20%s','request\x20sent','debug','OpenchannelInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','OpenchannelInteraction','update','body','options','where','attributes','limit','UpdateOpenchannelInteraction','AddTagsToOpenchannelInteraction','addTags','omit','spread','AddTags','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','redis'];(function(_0x4ad0f7,_0x1920b0){var _0x30f5c8=function(_0x2aa6b6){while(--_0x2aa6b6){_0x4ad0f7['push'](_0x4ad0f7['shift']());}};_0x30f5c8(++_0x1920b0);}(_0xb665,0x97));var _0x5b66=function(_0xd0c279,_0x13d61d){_0xd0c279=_0xd0c279-0x0;var _0x5bd6fc=_0xb665[_0xd0c279];return _0x5bd6fc;};'use strict';var _=require('lodash');var util=require(_0x5b66('0x0'));var moment=require(_0x5b66('0x1'));var BPromise=require(_0x5b66('0x2'));var rs=require(_0x5b66('0x3'));var fs=require('fs');var Redis=require(_0x5b66('0x4'));var db=require(_0x5b66('0x5'))['db'];var utils=require(_0x5b66('0x6'));var logger=require(_0x5b66('0x7'))('rpc');var config=require(_0x5b66('0x8'));var jayson=require(_0x5b66('0x9'));var client=jayson[_0x5b66('0xa')][_0x5b66('0xb')]({'port':0x232a});config[_0x5b66('0xc')]=_[_0x5b66('0xd')](config['redis'],{'host':_0x5b66('0xe'),'port':0x18eb});var socket=require(_0x5b66('0xf'))(new Redis(config[_0x5b66('0xc')]));require('./openchannelInteraction.socket')['register'](socket);function respondWithRpcPromise(_0x8a189e,_0x53825c,_0x567904){return new BPromise(function(_0x31cc14,_0x10b880){return client['request'](_0x8a189e,_0x567904)[_0x5b66('0x10')](function(_0x36adc7){logger[_0x5b66('0x11')](_0x5b66('0x12'),_0x53825c,_0x5b66('0x13'));logger[_0x5b66('0x14')](_0x5b66('0x15'),_0x53825c,_0x5b66('0x13'),JSON[_0x5b66('0x16')](_0x36adc7));if(_0x36adc7[_0x5b66('0x17')]){if(_0x36adc7['error'][_0x5b66('0x18')]===0x1f4){logger[_0x5b66('0x17')](_0x5b66('0x12'),_0x53825c,_0x36adc7[_0x5b66('0x17')][_0x5b66('0x19')]);return _0x10b880(_0x36adc7[_0x5b66('0x17')]['message']);}logger[_0x5b66('0x17')](_0x5b66('0x12'),_0x53825c,_0x36adc7[_0x5b66('0x17')][_0x5b66('0x19')]);return _0x31cc14(_0x36adc7[_0x5b66('0x17')][_0x5b66('0x19')]);}else{logger[_0x5b66('0x11')](_0x5b66('0x12'),_0x53825c,_0x5b66('0x13'));_0x31cc14(_0x36adc7[_0x5b66('0x1a')]['message']);}})[_0x5b66('0x1b')](function(_0x40f796){logger[_0x5b66('0x17')](_0x5b66('0x12'),_0x53825c,_0x40f796);_0x10b880(_0x40f796);});});}exports['UpdateOpenchannelInteraction']=function(_0x2e2a4e){var _0x2f4e6f=this;return new Promise(function(_0x2ae65d,_0x2351d8){return db[_0x5b66('0x1c')][_0x5b66('0x1d')](_0x2e2a4e[_0x5b66('0x1e')],{'raw':_0x2e2a4e['options']?_0x2e2a4e['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2e2a4e['options']?_0x2e2a4e[_0x5b66('0x1f')][_0x5b66('0x20')]||null:null,'attributes':_0x2e2a4e[_0x5b66('0x1f')]?_0x2e2a4e[_0x5b66('0x1f')][_0x5b66('0x21')]||null:null,'limit':_0x2e2a4e[_0x5b66('0x1f')]?_0x2e2a4e[_0x5b66('0x1f')][_0x5b66('0x22')]||null:null})[_0x5b66('0x10')](function(_0x1aab6b){logger['info'](_0x5b66('0x23'),_0x2e2a4e);logger['debug']('UpdateOpenchannelInteraction',_0x2e2a4e,JSON[_0x5b66('0x16')](_0x1aab6b));_0x2ae65d(_0x1aab6b);})[_0x5b66('0x1b')](function(_0x57c3d2){logger[_0x5b66('0x17')](_0x5b66('0x23'),_0x57c3d2[_0x5b66('0x19')],_0x2e2a4e);_0x2351d8(_0x2f4e6f[_0x5b66('0x17')](0x1f4,_0x57c3d2[_0x5b66('0x19')]));});});};exports[_0x5b66('0x24')]=function(_0x52e812){return new Promise(function(_0x102d4a,_0x3a4d6c){return db[_0x5b66('0x1c')]['find']({'where':_0x52e812[_0x5b66('0x1f')]?_0x52e812['options']['where']||null:null})[_0x5b66('0x10')](function(_0x712eb2){if(_0x712eb2){return _0x712eb2[_0x5b66('0x25')](_0x52e812[_0x5b66('0x1e')]['ids'],_[_0x5b66('0x26')](_0x52e812['body'],['ids','id'])||{});}})[_0x5b66('0x27')](function(_0x1a5c06){logger[_0x5b66('0x11')](_0x5b66('0x28'),_0x52e812);logger[_0x5b66('0x14')]('AddTags',_0x52e812,JSON[_0x5b66('0x16')](_0x1a5c06));_0x102d4a(_0x1a5c06);})[_0x5b66('0x1b')](function(_0x2b87e8){logger['error'](_0x5b66('0x28'),_0x2b87e8[_0x5b66('0x19')],_0x52e812);_0x3a4d6c(_this['error'](0x1f4,_0x2b87e8[_0x5b66('0x19')]));});});}; \ No newline at end of file +var _0xb9cb=['OpenchannelInteraction,\x20%s,\x20%s','request\x20sent','debug','OpenchannelInteraction,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','UpdateOpenchannelInteraction','OpenchannelInteraction','body','options','raw','where','attributes','stringify','find','ids','spread','AddTags','lodash','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','request','then','info'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xb9cb,0x191));var _0xbb9c=function(_0x2c7618,_0x26be9c){_0x2c7618=_0x2c7618-0x0;var _0x5ce3f0=_0xb9cb[_0x2c7618];return _0x5ce3f0;};'use strict';var _=require(_0xbb9c('0x0'));var util=require(_0xbb9c('0x1'));var moment=require('moment');var BPromise=require(_0xbb9c('0x2'));var rs=require(_0xbb9c('0x3'));var fs=require('fs');var Redis=require(_0xbb9c('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xbb9c('0x5'));var logger=require(_0xbb9c('0x6'))(_0xbb9c('0x7'));var config=require(_0xbb9c('0x8'));var jayson=require(_0xbb9c('0x9'));var client=jayson[_0xbb9c('0xa')][_0xbb9c('0xb')]({'port':0x232a});config[_0xbb9c('0xc')]=_[_0xbb9c('0xd')](config[_0xbb9c('0xc')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xbb9c('0xc')]));require('./openchannelInteraction.socket')['register'](socket);function respondWithRpcPromise(_0x3c9ea0,_0x16cdde,_0x17afe5){return new BPromise(function(_0x50950d,_0xd938e){return client[_0xbb9c('0xe')](_0x3c9ea0,_0x17afe5)[_0xbb9c('0xf')](function(_0x1abc19){logger[_0xbb9c('0x10')](_0xbb9c('0x11'),_0x16cdde,_0xbb9c('0x12'));logger[_0xbb9c('0x13')](_0xbb9c('0x14'),_0x16cdde,'request\x20sent',JSON['stringify'](_0x1abc19));if(_0x1abc19[_0xbb9c('0x15')]){if(_0x1abc19[_0xbb9c('0x15')][_0xbb9c('0x16')]===0x1f4){logger[_0xbb9c('0x15')]('OpenchannelInteraction,\x20%s,\x20%s',_0x16cdde,_0x1abc19[_0xbb9c('0x15')][_0xbb9c('0x17')]);return _0xd938e(_0x1abc19['error'][_0xbb9c('0x17')]);}logger[_0xbb9c('0x15')](_0xbb9c('0x11'),_0x16cdde,_0x1abc19[_0xbb9c('0x15')]['message']);return _0x50950d(_0x1abc19[_0xbb9c('0x15')][_0xbb9c('0x17')]);}else{logger['info'](_0xbb9c('0x11'),_0x16cdde,_0xbb9c('0x12'));_0x50950d(_0x1abc19[_0xbb9c('0x18')][_0xbb9c('0x17')]);}})[_0xbb9c('0x19')](function(_0x38fb93){logger['error']('OpenchannelInteraction,\x20%s,\x20%s',_0x16cdde,_0x38fb93);_0xd938e(_0x38fb93);});});}exports[_0xbb9c('0x1a')]=function(_0x59f2b1){var _0x327b59=this;return new Promise(function(_0x51e609,_0x5cfce3){return db[_0xbb9c('0x1b')]['update'](_0x59f2b1[_0xbb9c('0x1c')],{'raw':_0x59f2b1[_0xbb9c('0x1d')]?_0x59f2b1[_0xbb9c('0x1d')][_0xbb9c('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x59f2b1[_0xbb9c('0x1d')]?_0x59f2b1[_0xbb9c('0x1d')][_0xbb9c('0x1f')]||null:null,'attributes':_0x59f2b1[_0xbb9c('0x1d')]?_0x59f2b1['options'][_0xbb9c('0x20')]||null:null,'limit':_0x59f2b1['options']?_0x59f2b1[_0xbb9c('0x1d')]['limit']||null:null})[_0xbb9c('0xf')](function(_0x1f3c61){logger[_0xbb9c('0x10')](_0xbb9c('0x1a'),_0x59f2b1);logger[_0xbb9c('0x13')](_0xbb9c('0x1a'),_0x59f2b1,JSON[_0xbb9c('0x21')](_0x1f3c61));_0x51e609(_0x1f3c61);})['catch'](function(_0x3d6652){logger[_0xbb9c('0x15')]('UpdateOpenchannelInteraction',_0x3d6652[_0xbb9c('0x17')],_0x59f2b1);_0x5cfce3(_0x327b59['error'](0x1f4,_0x3d6652[_0xbb9c('0x17')]));});});};exports['AddTagsToOpenchannelInteraction']=function(_0x1ed5f2){return new Promise(function(_0x269820,_0x5396c6){return db[_0xbb9c('0x1b')][_0xbb9c('0x22')]({'where':_0x1ed5f2[_0xbb9c('0x1d')]?_0x1ed5f2[_0xbb9c('0x1d')]['where']||null:null})[_0xbb9c('0xf')](function(_0x4b307d){if(_0x4b307d){return _0x4b307d['addTags'](_0x1ed5f2[_0xbb9c('0x1c')][_0xbb9c('0x23')],_['omit'](_0x1ed5f2['body'],['ids','id'])||{});}})[_0xbb9c('0x24')](function(_0x296b8d){logger[_0xbb9c('0x10')]('AddTags',_0x1ed5f2);logger[_0xbb9c('0x13')](_0xbb9c('0x25'),_0x1ed5f2,JSON[_0xbb9c('0x21')](_0x296b8d));_0x269820(_0x296b8d);})[_0xbb9c('0x19')](function(_0x47bebf){logger[_0xbb9c('0x15')](_0xbb9c('0x25'),_0x47bebf[_0xbb9c('0x17')],_0x1ed5f2);_0x5396c6(_this[_0xbb9c('0x15')](0x1f4,_0x47bebf[_0xbb9c('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.socket.js b/server/api/openchannelInteraction/openchannelInteraction.socket.js index 1071746..81021c0 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 _0xed0d=['./openchannelInteraction.events','save','remove','emit','removeListener','length','openchannelInteraction:'];(function(_0x46b579,_0x566d72){var _0x373a12=function(_0xe47070){while(--_0xe47070){_0x46b579['push'](_0x46b579['shift']());}};_0x373a12(++_0x566d72);}(_0xed0d,0x1f1));var _0xded0=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xed0d[_0x3dd15e];return _0x231fd0;};'use strict';var OpenchannelInteractionEvents=require(_0xded0('0x0'));var events=[_0xded0('0x1'),_0xded0('0x2'),'update'];function createListener(_0x25ffcd,_0x157b8a){return function(_0x2064b0){_0x157b8a[_0xded0('0x3')](_0x25ffcd,_0x2064b0);};}function removeListener(_0x462bd3,_0x4f33f3){return function(){OpenchannelInteractionEvents[_0xded0('0x4')](_0x462bd3,_0x4f33f3);};}exports['register']=function(_0x1cb604){for(var _0x45bd62=0x0,_0x89dc4=events[_0xded0('0x5')];_0x45bd62<_0x89dc4;_0x45bd62++){var _0x2b76da=events[_0x45bd62];var _0x4fac2c=createListener(_0xded0('0x6')+_0x2b76da,_0x1cb604);OpenchannelInteractionEvents['on'](_0x2b76da,_0x4fac2c);}}; \ No newline at end of file +var _0x9ada=['./openchannelInteraction.events','save','emit','removeListener','register','length'];(function(_0xdf190a,_0x371a80){var _0x5c402c=function(_0x2b09ce){while(--_0x2b09ce){_0xdf190a['push'](_0xdf190a['shift']());}};_0x5c402c(++_0x371a80);}(_0x9ada,0xd8));var _0xa9ad=function(_0x435de8,_0x1e563d){_0x435de8=_0x435de8-0x0;var _0x2e9e95=_0x9ada[_0x435de8];return _0x2e9e95;};'use strict';var OpenchannelInteractionEvents=require(_0xa9ad('0x0'));var events=[_0xa9ad('0x1'),'remove','update'];function createListener(_0x2a0db3,_0x5b9b9e){return function(_0x2de217){_0x5b9b9e[_0xa9ad('0x2')](_0x2a0db3,_0x2de217);};}function removeListener(_0x1af9eb,_0x52c518){return function(){OpenchannelInteractionEvents[_0xa9ad('0x3')](_0x1af9eb,_0x52c518);};}exports[_0xa9ad('0x4')]=function(_0x3202a5){for(var _0x53432a=0x0,_0x442e62=events[_0xa9ad('0x5')];_0x53432a<_0x442e62;_0x53432a++){var _0x2f4b96=events[_0x53432a];var _0x152563=createListener('openchannelInteraction:'+_0x2f4b96,_0x3202a5);OpenchannelInteractionEvents['on'](_0x2f4b96,_0x152563);}}; \ No newline at end of file diff --git a/server/api/openchannelMessage/index.js b/server/api/openchannelMessage/index.js index faed75e..ef1fb7f 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 _0x74b1=['/:id','isAuthenticated','show','openchannel','openchannelmessage:create','put','update','/:id/accept','accept','/:id/reject','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelMessage.controller','index','get'];(function(_0x27a997,_0x85f149){var _0x5aa288=function(_0x38f03c){while(--_0x38f03c){_0x27a997['push'](_0x27a997['shift']());}};_0x5aa288(++_0x85f149);}(_0x74b1,0x1c2));var _0x174b=function(_0x34f701,_0x37e407){_0x34f701=_0x34f701-0x0;var _0x3e2429=_0x74b1[_0x34f701];return _0x3e2429;};'use strict';var multer=require('multer');var util=require(_0x174b('0x0'));var path=require(_0x174b('0x1'));var timeout=require(_0x174b('0x2'));var express=require('express');var router=express[_0x174b('0x3')]();var auth=require(_0x174b('0x4'));var interaction=require(_0x174b('0x5'));var config=require(_0x174b('0x6'));var controller=require(_0x174b('0x7'));router['get']('/',auth['isAuthenticated'](),controller[_0x174b('0x8')]);router[_0x174b('0x9')]('/describe',auth['isAuthenticated'](),controller['describe']);router[_0x174b('0x9')](_0x174b('0xa'),auth[_0x174b('0xb')](),controller[_0x174b('0xc')]);router['post']('/',auth[_0x174b('0xb')](),interaction['tracked'](_0x174b('0xd'),_0x174b('0xe')),controller['create']);router[_0x174b('0xf')](_0x174b('0xa'),auth[_0x174b('0xb')](),controller[_0x174b('0x10')]);router[_0x174b('0xf')](_0x174b('0x11'),auth[_0x174b('0xb')](),controller[_0x174b('0x12')]);router[_0x174b('0xf')](_0x174b('0x13'),auth['isAuthenticated'](),controller['reject']);router['delete'](_0x174b('0xa'),auth[_0x174b('0xb')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x5551=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','show','post','tracked','openchannel','openchannelmessage:create','put','/:id','update','/:id/accept','accept','/:id/reject','reject','delete','destroy','multer','util','express'];(function(_0x459451,_0x3d0204){var _0x1c6a7f=function(_0x3a0008){while(--_0x3a0008){_0x459451['push'](_0x459451['shift']());}};_0x1c6a7f(++_0x3d0204);}(_0x5551,0x1dd));var _0x1555=function(_0x8dc21c,_0x14de32){_0x8dc21c=_0x8dc21c-0x0;var _0x6b13c3=_0x5551[_0x8dc21c];return _0x6b13c3;};'use strict';var multer=require(_0x1555('0x0'));var util=require(_0x1555('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x1555('0x2'));var router=express[_0x1555('0x3')]();var auth=require(_0x1555('0x4'));var interaction=require(_0x1555('0x5'));var config=require(_0x1555('0x6'));var controller=require('./openchannelMessage.controller');router['get']('/',auth[_0x1555('0x7')](),controller[_0x1555('0x8')]);router[_0x1555('0x9')]('/describe',auth[_0x1555('0x7')](),controller['describe']);router[_0x1555('0x9')]('/:id',auth[_0x1555('0x7')](),controller[_0x1555('0xa')]);router[_0x1555('0xb')]('/',auth[_0x1555('0x7')](),interaction[_0x1555('0xc')](_0x1555('0xd'),_0x1555('0xe')),controller['create']);router[_0x1555('0xf')](_0x1555('0x10'),auth['isAuthenticated'](),controller[_0x1555('0x11')]);router[_0x1555('0xf')](_0x1555('0x12'),auth[_0x1555('0x7')](),controller[_0x1555('0x13')]);router['put'](_0x1555('0x14'),auth['isAuthenticated'](),controller[_0x1555('0x15')]);router[_0x1555('0x16')](_0x1555('0x10'),auth['isAuthenticated'](),controller[_0x1555('0x17')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.attributes.js b/server/api/openchannelMessage/openchannelMessage.attributes.js index a6e9411..0733846 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 _0x3786=['ENUM','out','DATE','sequelize','exports','BOOLEAN'];(function(_0x293767,_0x80f126){var _0x176303=function(_0x592f06){while(--_0x592f06){_0x293767['push'](_0x293767['shift']());}};_0x176303(++_0x80f126);}(_0x3786,0x1a1));var _0x6378=function(_0x4c7285,_0x97e5f8){_0x4c7285=_0x4c7285-0x0;var _0x107ccf=_0x3786[_0x4c7285];return _0x107ccf;};'use strict';var Sequelize=require(_0x6378('0x0'));module[_0x6378('0x1')]={'body':{'type':Sequelize['TEXT']('medium'),'allowNull':![]},'read':{'type':Sequelize[_0x6378('0x2')],'defaultValue':![]},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize[_0x6378('0x3')]('in',_0x6378('0x4')),'defaultValue':_0x6378('0x4'),'allowNull':![]},'readAt':{'type':Sequelize[_0x6378('0x5')]}}; \ No newline at end of file +var _0x6f82=['BOOLEAN','out','DATE','sequelize','medium'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x6f82,0xdf));var _0x26f8=function(_0x1d83db,_0x89d115){_0x1d83db=_0x1d83db-0x0;var _0x2dc1d1=_0x6f82[_0x1d83db];return _0x2dc1d1;};'use strict';var Sequelize=require(_0x26f8('0x0'));module['exports']={'body':{'type':Sequelize['TEXT'](_0x26f8('0x1')),'allowNull':![]},'read':{'type':Sequelize[_0x26f8('0x2')],'defaultValue':![]},'secret':{'type':Sequelize[_0x26f8('0x2')],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in',_0x26f8('0x3')),'defaultValue':_0x26f8('0x3'),'allowNull':![]},'readAt':{'type':Sequelize[_0x26f8('0x4')]}}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.controller.js b/server/api/openchannelMessage/openchannelMessage.controller.js index 712f9e2..889f8a7 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 _0xc44c=['includeAll','findAll','rows','params','keys','length','find','create','body','describe','openchannel-interactions','openchannel','read','readAt','format','UserId','user','CmContact','Contact','OpenchannelInteraction','update','read1stAt','YYYY-MM-DD\x20HH:mm:ss','get','role','null','AcceptMessage','acceptMessage','manual','interface','SIP/%s','channel','event','accept','EventManager','acceptmessage','reject','agent','OpenchannelInteractionId','interaction','[OPENCHANNELMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','rejectmessage','html-pdf','fast-json-patch','request-promise','mustache','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','socket.io-emitter','./openchannelMessage.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~!@#$%^&-_=+[{]}.','info','OpenchannelMessage,\x20%s,\x20%s','request\x20sent','OpenchannelMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','status','end','json','count','offset','limit','set','Content-Range','apply','then','destroy','sendStatus','stack','name','send','index','OpenchannelMessage','rawAttributes','fieldName','key','model','map','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','options'];(function(_0x190955,_0x4e4272){var _0x1fe69b=function(_0x16d5ca){while(--_0x16d5ca){_0x190955['push'](_0x190955['shift']());}};_0x1fe69b(++_0x4e4272);}(_0xc44c,0x192));var _0xcc44=function(_0x520733,_0x45f647){_0x520733=_0x520733-0x0;var _0x58fdf1=_0xc44c[_0x520733];return _0x58fdf1;};'use strict';var pdf=require(_0xcc44('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xcc44('0x1'));var rp=require(_0xcc44('0x2'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xcc44('0x3'));var util=require('util');var path=require(_0xcc44('0x4'));var sox=require(_0xcc44('0x5'));var csv=require(_0xcc44('0x6'));var ejs=require(_0xcc44('0x7'));var fs=require('fs');var _=require(_0xcc44('0x8'));var squel=require(_0xcc44('0x9'));var crypto=require(_0xcc44('0xa'));var jsforce=require(_0xcc44('0xb'));var deskjs=require(_0xcc44('0xc'));var toCsv=require(_0xcc44('0x6'));var querystring=require(_0xcc44('0xd'));var Papa=require(_0xcc44('0xe'));var Redis=require(_0xcc44('0xf'));var authService=require(_0xcc44('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0xcc44('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xcc44('0x12'))(_0xcc44('0x13'));var utils=require(_0xcc44('0x14'));var config=require(_0xcc44('0x15'));var db=require(_0xcc44('0x16'))['db'];config[_0xcc44('0x17')]=_['defaults'](config[_0xcc44('0x17')],{'host':'localhost','port':0x18eb});var socket=require(_0xcc44('0x18'))(new Redis(config[_0xcc44('0x17')]));require(_0xcc44('0x19'))[_0xcc44('0x1a')](socket);var jayson=require(_0xcc44('0x1b'));var client=jayson[_0xcc44('0x1c')][_0xcc44('0x1d')]({'port':0x232c});var client9002=jayson['client'][_0xcc44('0x1d')]({'port':0x232a});function checkPasswordPattern(_0x47ca54,_0x42b9c1,_0x1fb411){if(_0x1fb411){var _0x2a906d=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x2a906d['test'](_0x42b9c1)){return _0x47ca54;}else{throw new db[(_0xcc44('0x1e'))][(_0xcc44('0x1f'))](_0xcc44('0x20'));}}else{return _0x47ca54;}}function respondWithRpcPromise(_0x42f2c7,_0x5ea7e0,_0x25ae62,_0x41ad80){return new BPromise(function(_0x2db47a,_0x5d56b1){var _0x3f6819=_0x41ad80||client;return _0x3f6819['request'](_0x42f2c7,_0x25ae62)['then'](function(_0x4ebbc9){logger[_0xcc44('0x21')](_0xcc44('0x22'),_0x5ea7e0,_0xcc44('0x23'));logger['debug'](_0xcc44('0x24'),_0x5ea7e0,_0xcc44('0x23'),JSON[_0xcc44('0x25')](_0x4ebbc9));if(_0x4ebbc9[_0xcc44('0x26')]){if(_0x4ebbc9[_0xcc44('0x26')][_0xcc44('0x27')]===0x1f4){logger[_0xcc44('0x26')]('OpenchannelMessage,\x20%s,\x20%s',_0x5ea7e0,_0x4ebbc9[_0xcc44('0x26')]['message']);return _0x5d56b1(_0x4ebbc9[_0xcc44('0x26')]['message']);}logger[_0xcc44('0x26')](_0xcc44('0x22'),_0x5ea7e0,_0x4ebbc9[_0xcc44('0x26')][_0xcc44('0x28')]);return _0x2db47a(_0x4ebbc9[_0xcc44('0x26')][_0xcc44('0x28')]);}else{logger[_0xcc44('0x21')](_0xcc44('0x22'),_0x5ea7e0,_0xcc44('0x23'));_0x2db47a(_0x4ebbc9['result']['message']);}})[_0xcc44('0x29')](function(_0x33c3e2){logger['error'](_0xcc44('0x22'),_0x5ea7e0,_0x33c3e2);_0x5d56b1(_0x33c3e2);});});}function respondWithStatusCode(_0x56e8b3,_0x104b21){_0x104b21=_0x104b21||0xcc;return function(_0x295d6c){if(_0x295d6c){return _0x56e8b3['sendStatus'](_0x104b21);}return _0x56e8b3[_0xcc44('0x2a')](_0x104b21)[_0xcc44('0x2b')]();};}function respondWithResult(_0x104d05,_0x43933c){_0x43933c=_0x43933c||0xc8;return function(_0x434f1f){if(_0x434f1f){return _0x104d05['status'](_0x43933c)[_0xcc44('0x2c')](_0x434f1f);}};}function respondWithFilteredResult(_0x171ab2,_0x499ebc){return function(_0x413bea){if(_0x413bea){var _0x5c6fbc=_0x413bea[_0xcc44('0x2d')],_0x152b7c=_0x499ebc[_0xcc44('0x2e')],_0xd35280=_0x499ebc[_0xcc44('0x2e')]+_0x499ebc[_0xcc44('0x2f')],_0x356625;if(_0xd35280>=_0x5c6fbc){_0xd35280=_0x5c6fbc;_0x356625=0xc8;}else{_0x356625=0xce;}_0x171ab2[_0xcc44('0x2a')](_0x356625);return _0x171ab2[_0xcc44('0x30')](_0xcc44('0x31'),_0x152b7c+'-'+_0xd35280+'/'+_0x5c6fbc)[_0xcc44('0x2c')](_0x413bea);}return null;};}function patchUpdates(_0x43e101){return function(_0xc12ad){try{jsonpatch[_0xcc44('0x32')](_0xc12ad,_0x43e101,!![]);}catch(_0x5357e9){return BPromise['reject'](_0x5357e9);}return _0xc12ad['save']();};}function saveUpdates(_0x494388,_0x5d66da){return function(_0x174f78){if(_0x174f78){return _0x174f78['update'](_0x494388)[_0xcc44('0x33')](function(_0x5a8f99){return _0x5a8f99;});}return null;};}function removeEntity(_0x28ca30,_0x23a481){return function(_0x4677be){if(_0x4677be){return _0x4677be[_0xcc44('0x34')]()[_0xcc44('0x33')](function(){_0x28ca30[_0xcc44('0x2a')](0xcc)[_0xcc44('0x2b')]();});}};}function handleEntityNotFound(_0x1fa00a,_0x489480){return function(_0x2183d4){if(!_0x2183d4){_0x1fa00a[_0xcc44('0x35')](0x194);}return _0x2183d4;};}function handleError(_0x6350bb,_0x14fe58){_0x14fe58=_0x14fe58||0x1f4;return function(_0x3586f8){logger[_0xcc44('0x26')](_0x3586f8[_0xcc44('0x36')]);if(_0x3586f8[_0xcc44('0x37')]){delete _0x3586f8['name'];}_0x6350bb[_0xcc44('0x2a')](_0x14fe58)[_0xcc44('0x38')](_0x3586f8);};}exports[_0xcc44('0x39')]=function(_0x1bd675,_0x25d054){var _0x114f63={},_0x28c12f={},_0x48ea32={'count':0x0,'rows':[]};var _0x20db04=_['map'](db[_0xcc44('0x3a')][_0xcc44('0x3b')],function(_0x223ade){return{'name':_0x223ade[_0xcc44('0x3c')],'type':_0x223ade['type'][_0xcc44('0x3d')]};});_0x28c12f[_0xcc44('0x3e')]=_[_0xcc44('0x3f')](_0x20db04,_0xcc44('0x37'));_0x28c12f['query']=_['keys'](_0x1bd675[_0xcc44('0x40')]);_0x28c12f[_0xcc44('0x41')]=_[_0xcc44('0x42')](_0x28c12f[_0xcc44('0x3e')],_0x28c12f[_0xcc44('0x40')]);_0x114f63[_0xcc44('0x43')]=_['intersection'](_0x28c12f[_0xcc44('0x3e')],qs[_0xcc44('0x44')](_0x1bd675[_0xcc44('0x40')][_0xcc44('0x44')]));_0x114f63['attributes']=_0x114f63['attributes']['length']?_0x114f63[_0xcc44('0x43')]:_0x28c12f['model'];if(!_0x1bd675[_0xcc44('0x40')][_0xcc44('0x45')](_0xcc44('0x46'))){_0x114f63['limit']=qs[_0xcc44('0x2f')](_0x1bd675[_0xcc44('0x40')][_0xcc44('0x2f')]);_0x114f63['offset']=qs[_0xcc44('0x2e')](_0x1bd675[_0xcc44('0x40')][_0xcc44('0x2e')]);}_0x114f63[_0xcc44('0x47')]=qs[_0xcc44('0x48')](_0x1bd675['query'][_0xcc44('0x48')]);_0x114f63['where']=qs[_0xcc44('0x41')](_[_0xcc44('0x49')](_0x1bd675['query'],_0x28c12f['filters']),_0x20db04);if(_0x1bd675[_0xcc44('0x40')][_0xcc44('0x4a')]){_0x114f63['where']=_['merge'](_0x114f63[_0xcc44('0x4b')],{'$or':_[_0xcc44('0x3f')](_0x20db04,function(_0x3eec61){if(_0x3eec61['type']!=='VIRTUAL'){var _0xf0b9e4={};_0xf0b9e4[_0x3eec61[_0xcc44('0x37')]]={'$like':'%'+_0x1bd675['query'][_0xcc44('0x4a')]+'%'};return _0xf0b9e4;}})});}_0x114f63=_[_0xcc44('0x4c')]({},_0x114f63,_0x1bd675[_0xcc44('0x4d')]);var _0x4360d3={'where':_0x114f63[_0xcc44('0x4b')]};return db['OpenchannelMessage'][_0xcc44('0x2d')](_0x4360d3)[_0xcc44('0x33')](function(_0x52439d){_0x48ea32[_0xcc44('0x2d')]=_0x52439d;if(_0x1bd675['query'][_0xcc44('0x4e')]){_0x114f63['include']=[{'all':!![]}];}return db[_0xcc44('0x3a')][_0xcc44('0x4f')](_0x114f63);})[_0xcc44('0x33')](function(_0x597067){_0x48ea32[_0xcc44('0x50')]=_0x597067;return _0x48ea32;})[_0xcc44('0x33')](respondWithFilteredResult(_0x25d054,_0x114f63))[_0xcc44('0x29')](handleError(_0x25d054,null));};exports['show']=function(_0x56f359,_0x40a1f1){var _0x412bee={'raw':!![],'where':{'id':_0x56f359[_0xcc44('0x51')]['id']}},_0x513f2f={};_0x513f2f[_0xcc44('0x3e')]=_[_0xcc44('0x52')](db[_0xcc44('0x3a')][_0xcc44('0x3b')]);_0x513f2f['query']=_[_0xcc44('0x52')](_0x56f359[_0xcc44('0x40')]);_0x513f2f[_0xcc44('0x41')]=_[_0xcc44('0x42')](_0x513f2f['model'],_0x513f2f[_0xcc44('0x40')]);_0x412bee[_0xcc44('0x43')]=_[_0xcc44('0x42')](_0x513f2f[_0xcc44('0x3e')],qs[_0xcc44('0x44')](_0x56f359[_0xcc44('0x40')]['fields']));_0x412bee[_0xcc44('0x43')]=_0x412bee[_0xcc44('0x43')][_0xcc44('0x53')]?_0x412bee[_0xcc44('0x43')]:_0x513f2f[_0xcc44('0x3e')];if(_0x56f359[_0xcc44('0x40')]['includeAll']){_0x412bee['include']=[{'all':!![]}];}_0x412bee=_[_0xcc44('0x4c')]({},_0x412bee,_0x56f359[_0xcc44('0x4d')]);return db[_0xcc44('0x3a')][_0xcc44('0x54')](_0x412bee)[_0xcc44('0x33')](handleEntityNotFound(_0x40a1f1,null))[_0xcc44('0x33')](respondWithResult(_0x40a1f1,null))[_0xcc44('0x29')](handleError(_0x40a1f1,null));};exports[_0xcc44('0x55')]=function(_0x12763b,_0x435503){return db['OpenchannelMessage'][_0xcc44('0x55')](_0x12763b['body'],{})[_0xcc44('0x33')](respondWithResult(_0x435503,0xc9))[_0xcc44('0x29')](handleError(_0x435503,null));};exports['update']=function(_0x1c4c5f,_0x174c5f){if(_0x1c4c5f[_0xcc44('0x56')]['id']){delete _0x1c4c5f[_0xcc44('0x56')]['id'];}return db[_0xcc44('0x3a')][_0xcc44('0x54')]({'where':{'id':_0x1c4c5f['params']['id']}})[_0xcc44('0x33')](handleEntityNotFound(_0x174c5f,null))[_0xcc44('0x33')](saveUpdates(_0x1c4c5f[_0xcc44('0x56')],null))[_0xcc44('0x33')](respondWithResult(_0x174c5f,null))['catch'](handleError(_0x174c5f,null));};exports['destroy']=function(_0x8d3cd4,_0x53a57b){return db[_0xcc44('0x3a')]['find']({'where':{'id':_0x8d3cd4[_0xcc44('0x51')]['id']}})[_0xcc44('0x33')](handleEntityNotFound(_0x53a57b,null))[_0xcc44('0x33')](removeEntity(_0x53a57b,null))[_0xcc44('0x29')](handleError(_0x53a57b,null));};exports['describe']=function(_0x5724b2,_0x440ca9){return db[_0xcc44('0x3a')][_0xcc44('0x57')]()[_0xcc44('0x33')](respondWithResult(_0x440ca9,null))[_0xcc44('0x29')](handleError(_0x440ca9,null));};var interaction_log=require('../../config/logger')(_0xcc44('0x58'));exports['accept']=function(_0x54f13e,_0x14fbc2,_0x5d74a6){var _0x16de73={'channel':_0xcc44('0x59')};if(_0x54f13e[_0xcc44('0x56')]['id']){delete _0x54f13e[_0xcc44('0x56')]['id'];}_0x54f13e[_0xcc44('0x56')][_0xcc44('0x5a')]=!![];_0x54f13e[_0xcc44('0x56')][_0xcc44('0x5b')]=moment()[_0xcc44('0x5c')]('YYYY-MM-DD\x20HH:mm:ss');_0x54f13e[_0xcc44('0x56')][_0xcc44('0x5d')]=_0x54f13e['body']['UserId']||_0x54f13e[_0xcc44('0x5e')]['id'];return db[_0xcc44('0x3a')][_0xcc44('0x54')]({'where':{'id':_0x54f13e[_0xcc44('0x51')]['id'],'UserId':null},'include':[{'model':db[_0xcc44('0x5f')],'as':_0xcc44('0x60')}]})[_0xcc44('0x33')](handleEntityNotFound(_0x14fbc2,null))[_0xcc44('0x33')](saveUpdates(_0x54f13e[_0xcc44('0x56')],null))['then'](function(_0x25dcff){if(_0x25dcff){_0x16de73['message']=_0x25dcff['get']({'plain':!![]});return db[_0xcc44('0x61')][_0xcc44('0x54')]({'where':{'id':_0x25dcff['OpenchannelInteractionId']}});}return null;})[_0xcc44('0x33')](handleEntityNotFound(_0x14fbc2,null))['then'](function(_0x5cf134){if(_0x5cf134){return _0x5cf134[_0xcc44('0x62')]({'UserId':_0x54f13e[_0xcc44('0x56')][_0xcc44('0x5d')],'read1stAt':_['isNil'](_0x5cf134[_0xcc44('0x63')])?moment()[_0xcc44('0x5c')](_0xcc44('0x64')):undefined});}return null;})[_0xcc44('0x33')](function(_0x2b7256){if(_0x2b7256){_0x16de73['interaction']=_0x2b7256[_0xcc44('0x65')]({'plain':!![]});interaction_log[_0xcc44('0x21')]('[OPENCHANNELMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x54f13e[_0xcc44('0x5e')]['id'],_0x54f13e[_0xcc44('0x5e')][_0xcc44('0x37')],_0x54f13e[_0xcc44('0x5e')][_0xcc44('0x66')],_0x16de73['interaction']['id'],_0x54f13e[_0xcc44('0x56')]?JSON[_0xcc44('0x25')](_0x54f13e[_0xcc44('0x56')]):_0xcc44('0x67'));return respondWithRpcPromise(_0xcc44('0x68'),_0xcc44('0x69'),_0x16de73);}return null;})[_0xcc44('0x33')](function(_0x38932f){if(_0x38932f){if(_0x54f13e[_0xcc44('0x56')][_0xcc44('0x6a')]){_0x16de73[_0xcc44('0x28')][_0xcc44('0x6b')]=util[_0xcc44('0x5c')](_0xcc44('0x6c'),_0x54f13e[_0xcc44('0x5e')]['name']);_0x16de73[_0xcc44('0x28')]['channel']=_0x16de73[_0xcc44('0x6d')];_0x16de73[_0xcc44('0x28')][_0xcc44('0x6e')]=_0xcc44('0x6f');return respondWithRpcPromise(_0xcc44('0x70'),_0xcc44('0x70'),{'event':_0xcc44('0x71'),'message':_0x16de73[_0xcc44('0x28')]},client9002)[_0xcc44('0x33')](function(){return _0x16de73;});}return _0x16de73;}return null;})[_0xcc44('0x33')](respondWithResult(_0x14fbc2,null))['catch'](handleError(_0x14fbc2,null));};var interaction_log=require('../../config/logger')(_0xcc44('0x58'));exports[_0xcc44('0x72')]=function(_0x25f113,_0x48828e,_0x38451d){var _0x115f45={'agent':{},'channel':_0xcc44('0x59')};if(_0x25f113['body']['id']){delete _0x25f113[_0xcc44('0x56')]['id'];}_0x25f113[_0xcc44('0x56')][_0xcc44('0x5d')]=_0x25f113['body'][_0xcc44('0x5d')]||_0x25f113['user']['id'];_0x115f45[_0xcc44('0x73')]['id']=_0x25f113[_0xcc44('0x56')][_0xcc44('0x5d')];return db[_0xcc44('0x3a')]['find']({'where':{'id':_0x25f113[_0xcc44('0x51')]['id'],'UserId':null}})[_0xcc44('0x33')](handleEntityNotFound(_0x48828e,null))[_0xcc44('0x33')](function(_0x38ecb3){if(_0x38ecb3){_0x115f45[_0xcc44('0x28')]=_0x38ecb3[_0xcc44('0x65')]({'plain':!![]});return db['OpenchannelInteraction'][_0xcc44('0x54')]({'where':{'id':_0x38ecb3[_0xcc44('0x74')]}});}return null;})[_0xcc44('0x33')](handleEntityNotFound(_0x48828e,null))[_0xcc44('0x33')](function(_0x3b08e5){if(_0x3b08e5){_0x115f45[_0xcc44('0x75')]=_0x3b08e5[_0xcc44('0x65')]({'plain':!![]});interaction_log[_0xcc44('0x21')](_0xcc44('0x76'),_0x25f113[_0xcc44('0x5e')]['id'],_0x25f113[_0xcc44('0x5e')][_0xcc44('0x37')],_0x25f113[_0xcc44('0x5e')][_0xcc44('0x66')],_0x115f45[_0xcc44('0x75')]['id'],_0x25f113[_0xcc44('0x56')]?JSON[_0xcc44('0x25')](_0x25f113[_0xcc44('0x56')]):'null');return respondWithRpcPromise('RejectMessage','rejectMessage',_0x115f45);}return null;})[_0xcc44('0x33')](function(_0x1458c8){if(_0x1458c8){_0x1458c8['message'][_0xcc44('0x6b')]=util[_0xcc44('0x5c')](_0xcc44('0x6c'),_0x25f113[_0xcc44('0x5e')][_0xcc44('0x37')]);_0x1458c8['message'][_0xcc44('0x6d')]=_0x115f45[_0xcc44('0x6d')];_0x1458c8['message'][_0xcc44('0x6e')]=_0xcc44('0x72');respondWithRpcPromise(_0xcc44('0x70'),_0xcc44('0x70'),{'event':_0xcc44('0x77'),'message':_0x1458c8[_0xcc44('0x28')]},client9002);return _0x115f45;}return null;})[_0xcc44('0x33')](respondWithResult(_0x48828e,null))['catch'](handleError(_0x48828e,null));}; \ No newline at end of file +var _0x8b69=['code','OpenchannelMessage,\x20%s,\x20%s','message','info','result','catch','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','destroy','sendStatus','name','send','index','map','OpenchannelMessage','rawAttributes','fieldName','type','key','query','keys','filters','intersection','fields','attributes','length','model','hasOwnProperty','order','sort','where','filter','merge','options','includeAll','rows','show','create','body','find','params','describe','openchannel-interactions','accept','openchannel','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','CmContact','Contact','get','OpenchannelInteractionId','isNil','read1stAt','interaction','role','AcceptMessage','acceptMessage','interface','SIP/%s','channel','event','EventManager','acceptmessage','agent','OpenchannelInteraction','null','rejectMessage','rejectmessage','html-pdf','eml-format','zip-dir','fast-json-patch','bluebird','mustache','util','ejs','lodash','crypto','jsforce','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./openchannelMessage.socket','register','jayson/promise','client','http','request','then','request\x20sent','debug','OpenchannelMessage,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x53565a,_0x40648b){var _0x387936=function(_0x4009f2){while(--_0x4009f2){_0x53565a['push'](_0x53565a['shift']());}};_0x387936(++_0x40648b);}(_0x8b69,0x1b7));var _0x98b6=function(_0x5006c9,_0x59f403){_0x5006c9=_0x5006c9-0x0;var _0x4c8ade=_0x8b69[_0x5006c9];return _0x4c8ade;};'use strict';var pdf=require(_0x98b6('0x0'));var emlformat=require(_0x98b6('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x98b6('0x2'));var jsonpatch=require(_0x98b6('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x98b6('0x4'));var Mustache=require(_0x98b6('0x5'));var util=require(_0x98b6('0x6'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x98b6('0x7'));var fs=require('fs');var _=require(_0x98b6('0x8'));var squel=require('squel');var crypto=require(_0x98b6('0x9'));var jsforce=require(_0x98b6('0xa'));var deskjs=require(_0x98b6('0xb'));var toCsv=require(_0x98b6('0xc'));var querystring=require(_0x98b6('0xd'));var Papa=require(_0x98b6('0xe'));var Redis=require('ioredis');var authService=require(_0x98b6('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x98b6('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x98b6('0x11'))('api');var utils=require(_0x98b6('0x12'));var config=require(_0x98b6('0x13'));var db=require(_0x98b6('0x14'))['db'];config['redis']=_[_0x98b6('0x15')](config[_0x98b6('0x16')],{'host':_0x98b6('0x17'),'port':0x18eb});var socket=require(_0x98b6('0x18'))(new Redis(config['redis']));require(_0x98b6('0x19'))[_0x98b6('0x1a')](socket);var jayson=require(_0x98b6('0x1b'));var client=jayson[_0x98b6('0x1c')][_0x98b6('0x1d')]({'port':0x232c});var client9002=jayson[_0x98b6('0x1c')][_0x98b6('0x1d')]({'port':0x232a});function checkPasswordPattern(_0xea574,_0x295f85,_0x4fc08a){if(_0x4fc08a){var _0x29eaaa=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x29eaaa['test'](_0x295f85)){return _0xea574;}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 _0xea574;}}function respondWithRpcPromise(_0x8a4921,_0x1cfea7,_0x1ed91e,_0x167f9e){return new BPromise(function(_0xaa699,_0x54e14a){var _0xe27c84=_0x167f9e||client;return _0xe27c84[_0x98b6('0x1e')](_0x8a4921,_0x1ed91e)[_0x98b6('0x1f')](function(_0x477e1a){logger['info']('OpenchannelMessage,\x20%s,\x20%s',_0x1cfea7,_0x98b6('0x20'));logger[_0x98b6('0x21')](_0x98b6('0x22'),_0x1cfea7,_0x98b6('0x20'),JSON[_0x98b6('0x23')](_0x477e1a));if(_0x477e1a['error']){if(_0x477e1a[_0x98b6('0x24')][_0x98b6('0x25')]===0x1f4){logger[_0x98b6('0x24')](_0x98b6('0x26'),_0x1cfea7,_0x477e1a['error'][_0x98b6('0x27')]);return _0x54e14a(_0x477e1a[_0x98b6('0x24')][_0x98b6('0x27')]);}logger['error'](_0x98b6('0x26'),_0x1cfea7,_0x477e1a[_0x98b6('0x24')][_0x98b6('0x27')]);return _0xaa699(_0x477e1a['error']['message']);}else{logger[_0x98b6('0x28')](_0x98b6('0x26'),_0x1cfea7,_0x98b6('0x20'));_0xaa699(_0x477e1a[_0x98b6('0x29')][_0x98b6('0x27')]);}})[_0x98b6('0x2a')](function(_0x38524a){logger['error'](_0x98b6('0x26'),_0x1cfea7,_0x38524a);_0x54e14a(_0x38524a);});});}function respondWithStatusCode(_0x14e11d,_0x415cef){_0x415cef=_0x415cef||0xcc;return function(_0x5c3852){if(_0x5c3852){return _0x14e11d['sendStatus'](_0x415cef);}return _0x14e11d[_0x98b6('0x2b')](_0x415cef)[_0x98b6('0x2c')]();};}function respondWithResult(_0x2830e9,_0x46a8c9){_0x46a8c9=_0x46a8c9||0xc8;return function(_0x43ccaf){if(_0x43ccaf){return _0x2830e9[_0x98b6('0x2b')](_0x46a8c9)[_0x98b6('0x2d')](_0x43ccaf);}};}function respondWithFilteredResult(_0xd97ef2,_0x347cea){return function(_0xa9ce3){if(_0xa9ce3){var _0x3cc704=_0xa9ce3[_0x98b6('0x2e')],_0x35405d=_0x347cea[_0x98b6('0x2f')],_0x1fd55d=_0x347cea[_0x98b6('0x2f')]+_0x347cea[_0x98b6('0x30')],_0xe0945e;if(_0x1fd55d>=_0x3cc704){_0x1fd55d=_0x3cc704;_0xe0945e=0xc8;}else{_0xe0945e=0xce;}_0xd97ef2[_0x98b6('0x2b')](_0xe0945e);return _0xd97ef2[_0x98b6('0x31')](_0x98b6('0x32'),_0x35405d+'-'+_0x1fd55d+'/'+_0x3cc704)['json'](_0xa9ce3);}return null;};}function patchUpdates(_0x165b61){return function(_0x29d15a){try{jsonpatch[_0x98b6('0x33')](_0x29d15a,_0x165b61,!![]);}catch(_0x2c72c3){return BPromise[_0x98b6('0x34')](_0x2c72c3);}return _0x29d15a[_0x98b6('0x35')]();};}function saveUpdates(_0x3854c1,_0x21a5cb){return function(_0x51a5d0){if(_0x51a5d0){return _0x51a5d0[_0x98b6('0x36')](_0x3854c1)[_0x98b6('0x1f')](function(_0x52c6b6){return _0x52c6b6;});}return null;};}function removeEntity(_0x46060b,_0x4a8bf4){return function(_0x4315c8){if(_0x4315c8){return _0x4315c8[_0x98b6('0x37')]()[_0x98b6('0x1f')](function(){_0x46060b[_0x98b6('0x2b')](0xcc)[_0x98b6('0x2c')]();});}};}function handleEntityNotFound(_0x2c064c,_0x3a875c){return function(_0x47962b){if(!_0x47962b){_0x2c064c[_0x98b6('0x38')](0x194);}return _0x47962b;};}function handleError(_0x3ec5a8,_0x55ec4a){_0x55ec4a=_0x55ec4a||0x1f4;return function(_0x160dcb){logger[_0x98b6('0x24')](_0x160dcb['stack']);if(_0x160dcb[_0x98b6('0x39')]){delete _0x160dcb[_0x98b6('0x39')];}_0x3ec5a8[_0x98b6('0x2b')](_0x55ec4a)[_0x98b6('0x3a')](_0x160dcb);};}exports[_0x98b6('0x3b')]=function(_0x3edc3a,_0x57d7dd){var _0x19ef5b={},_0x1d7ec9={},_0x813b9b={'count':0x0,'rows':[]};var _0x3ef3ae=_[_0x98b6('0x3c')](db[_0x98b6('0x3d')][_0x98b6('0x3e')],function(_0x21abd0){return{'name':_0x21abd0[_0x98b6('0x3f')],'type':_0x21abd0[_0x98b6('0x40')][_0x98b6('0x41')]};});_0x1d7ec9['model']=_[_0x98b6('0x3c')](_0x3ef3ae,_0x98b6('0x39'));_0x1d7ec9[_0x98b6('0x42')]=_[_0x98b6('0x43')](_0x3edc3a[_0x98b6('0x42')]);_0x1d7ec9[_0x98b6('0x44')]=_[_0x98b6('0x45')](_0x1d7ec9['model'],_0x1d7ec9[_0x98b6('0x42')]);_0x19ef5b['attributes']=_['intersection'](_0x1d7ec9['model'],qs[_0x98b6('0x46')](_0x3edc3a[_0x98b6('0x42')][_0x98b6('0x46')]));_0x19ef5b[_0x98b6('0x47')]=_0x19ef5b['attributes'][_0x98b6('0x48')]?_0x19ef5b[_0x98b6('0x47')]:_0x1d7ec9[_0x98b6('0x49')];if(!_0x3edc3a[_0x98b6('0x42')][_0x98b6('0x4a')]('nolimit')){_0x19ef5b[_0x98b6('0x30')]=qs['limit'](_0x3edc3a[_0x98b6('0x42')][_0x98b6('0x30')]);_0x19ef5b[_0x98b6('0x2f')]=qs['offset'](_0x3edc3a[_0x98b6('0x42')][_0x98b6('0x2f')]);}_0x19ef5b[_0x98b6('0x4b')]=qs[_0x98b6('0x4c')](_0x3edc3a[_0x98b6('0x42')][_0x98b6('0x4c')]);_0x19ef5b[_0x98b6('0x4d')]=qs[_0x98b6('0x44')](_['pick'](_0x3edc3a[_0x98b6('0x42')],_0x1d7ec9[_0x98b6('0x44')]),_0x3ef3ae);if(_0x3edc3a[_0x98b6('0x42')][_0x98b6('0x4e')]){_0x19ef5b[_0x98b6('0x4d')]=_['merge'](_0x19ef5b[_0x98b6('0x4d')],{'$or':_[_0x98b6('0x3c')](_0x3ef3ae,function(_0x1268d6){if(_0x1268d6['type']!=='VIRTUAL'){var _0x30b7fa={};_0x30b7fa[_0x1268d6[_0x98b6('0x39')]]={'$like':'%'+_0x3edc3a[_0x98b6('0x42')][_0x98b6('0x4e')]+'%'};return _0x30b7fa;}})});}_0x19ef5b=_[_0x98b6('0x4f')]({},_0x19ef5b,_0x3edc3a[_0x98b6('0x50')]);var _0x138dff={'where':_0x19ef5b[_0x98b6('0x4d')]};return db[_0x98b6('0x3d')][_0x98b6('0x2e')](_0x138dff)[_0x98b6('0x1f')](function(_0xd33792){_0x813b9b['count']=_0xd33792;if(_0x3edc3a[_0x98b6('0x42')][_0x98b6('0x51')]){_0x19ef5b['include']=[{'all':!![]}];}return db['OpenchannelMessage']['findAll'](_0x19ef5b);})['then'](function(_0x2f48d6){_0x813b9b[_0x98b6('0x52')]=_0x2f48d6;return _0x813b9b;})['then'](respondWithFilteredResult(_0x57d7dd,_0x19ef5b))[_0x98b6('0x2a')](handleError(_0x57d7dd,null));};exports[_0x98b6('0x53')]=function(_0x4c54e1,_0x6557ef){var _0x5888c8={'raw':!![],'where':{'id':_0x4c54e1['params']['id']}},_0x26e1b4={};_0x26e1b4['model']=_[_0x98b6('0x43')](db[_0x98b6('0x3d')]['rawAttributes']);_0x26e1b4[_0x98b6('0x42')]=_[_0x98b6('0x43')](_0x4c54e1[_0x98b6('0x42')]);_0x26e1b4[_0x98b6('0x44')]=_[_0x98b6('0x45')](_0x26e1b4[_0x98b6('0x49')],_0x26e1b4[_0x98b6('0x42')]);_0x5888c8[_0x98b6('0x47')]=_['intersection'](_0x26e1b4[_0x98b6('0x49')],qs[_0x98b6('0x46')](_0x4c54e1[_0x98b6('0x42')][_0x98b6('0x46')]));_0x5888c8[_0x98b6('0x47')]=_0x5888c8['attributes']['length']?_0x5888c8[_0x98b6('0x47')]:_0x26e1b4[_0x98b6('0x49')];if(_0x4c54e1[_0x98b6('0x42')][_0x98b6('0x51')]){_0x5888c8['include']=[{'all':!![]}];}_0x5888c8=_[_0x98b6('0x4f')]({},_0x5888c8,_0x4c54e1['options']);return db[_0x98b6('0x3d')]['find'](_0x5888c8)[_0x98b6('0x1f')](handleEntityNotFound(_0x6557ef,null))[_0x98b6('0x1f')](respondWithResult(_0x6557ef,null))[_0x98b6('0x2a')](handleError(_0x6557ef,null));};exports['create']=function(_0xe8ef9d,_0x343cd2){return db[_0x98b6('0x3d')][_0x98b6('0x54')](_0xe8ef9d['body'],{})['then'](respondWithResult(_0x343cd2,0xc9))['catch'](handleError(_0x343cd2,null));};exports['update']=function(_0x55db0d,_0x41fe98){if(_0x55db0d['body']['id']){delete _0x55db0d[_0x98b6('0x55')]['id'];}return db[_0x98b6('0x3d')]['find']({'where':{'id':_0x55db0d['params']['id']}})[_0x98b6('0x1f')](handleEntityNotFound(_0x41fe98,null))[_0x98b6('0x1f')](saveUpdates(_0x55db0d[_0x98b6('0x55')],null))['then'](respondWithResult(_0x41fe98,null))['catch'](handleError(_0x41fe98,null));};exports['destroy']=function(_0x14a8bb,_0x3f1961){return db['OpenchannelMessage'][_0x98b6('0x56')]({'where':{'id':_0x14a8bb[_0x98b6('0x57')]['id']}})[_0x98b6('0x1f')](handleEntityNotFound(_0x3f1961,null))[_0x98b6('0x1f')](removeEntity(_0x3f1961,null))['catch'](handleError(_0x3f1961,null));};exports[_0x98b6('0x58')]=function(_0x12a75e,_0x1d385d){return db[_0x98b6('0x3d')][_0x98b6('0x58')]()['then'](respondWithResult(_0x1d385d,null))[_0x98b6('0x2a')](handleError(_0x1d385d,null));};var interaction_log=require('../../config/logger')(_0x98b6('0x59'));exports[_0x98b6('0x5a')]=function(_0x2c82d6,_0x478c25,_0xafc44a){var _0x4630cb={'channel':_0x98b6('0x5b')};if(_0x2c82d6[_0x98b6('0x55')]['id']){delete _0x2c82d6['body']['id'];}_0x2c82d6['body'][_0x98b6('0x5c')]=!![];_0x2c82d6[_0x98b6('0x55')][_0x98b6('0x5d')]=moment()[_0x98b6('0x5e')](_0x98b6('0x5f'));_0x2c82d6[_0x98b6('0x55')]['UserId']=_0x2c82d6[_0x98b6('0x55')][_0x98b6('0x60')]||_0x2c82d6[_0x98b6('0x61')]['id'];return db[_0x98b6('0x3d')]['find']({'where':{'id':_0x2c82d6['params']['id'],'UserId':null},'include':[{'model':db[_0x98b6('0x62')],'as':_0x98b6('0x63')}]})[_0x98b6('0x1f')](handleEntityNotFound(_0x478c25,null))['then'](saveUpdates(_0x2c82d6[_0x98b6('0x55')],null))['then'](function(_0xa01b41){if(_0xa01b41){_0x4630cb[_0x98b6('0x27')]=_0xa01b41[_0x98b6('0x64')]({'plain':!![]});return db['OpenchannelInteraction']['find']({'where':{'id':_0xa01b41[_0x98b6('0x65')]}});}return null;})[_0x98b6('0x1f')](handleEntityNotFound(_0x478c25,null))[_0x98b6('0x1f')](function(_0x293e57){if(_0x293e57){return _0x293e57[_0x98b6('0x36')]({'UserId':_0x2c82d6['body']['UserId'],'read1stAt':_[_0x98b6('0x66')](_0x293e57[_0x98b6('0x67')])?moment()['format'](_0x98b6('0x5f')):undefined});}return null;})[_0x98b6('0x1f')](function(_0x90e97d){if(_0x90e97d){_0x4630cb[_0x98b6('0x68')]=_0x90e97d['get']({'plain':!![]});interaction_log['info']('[OPENCHANNELMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x2c82d6['user']['id'],_0x2c82d6['user'][_0x98b6('0x39')],_0x2c82d6[_0x98b6('0x61')][_0x98b6('0x69')],_0x4630cb[_0x98b6('0x68')]['id'],_0x2c82d6[_0x98b6('0x55')]?JSON[_0x98b6('0x23')](_0x2c82d6[_0x98b6('0x55')]):'null');return respondWithRpcPromise(_0x98b6('0x6a'),_0x98b6('0x6b'),_0x4630cb);}return null;})[_0x98b6('0x1f')](function(_0x2ea892){if(_0x2ea892){if(_0x2c82d6[_0x98b6('0x55')]['manual']){_0x4630cb['message'][_0x98b6('0x6c')]=util['format'](_0x98b6('0x6d'),_0x2c82d6[_0x98b6('0x61')][_0x98b6('0x39')]);_0x4630cb[_0x98b6('0x27')][_0x98b6('0x6e')]=_0x4630cb[_0x98b6('0x6e')];_0x4630cb[_0x98b6('0x27')][_0x98b6('0x6f')]='accept';return respondWithRpcPromise(_0x98b6('0x70'),_0x98b6('0x70'),{'event':_0x98b6('0x71'),'message':_0x4630cb['message']},client9002)[_0x98b6('0x1f')](function(){return _0x4630cb;});}return _0x4630cb;}return null;})[_0x98b6('0x1f')](respondWithResult(_0x478c25,null))['catch'](handleError(_0x478c25,null));};var interaction_log=require(_0x98b6('0x11'))(_0x98b6('0x59'));exports['reject']=function(_0x50d555,_0x122f6d,_0x3c25cc){var _0x4f6717={'agent':{},'channel':_0x98b6('0x5b')};if(_0x50d555[_0x98b6('0x55')]['id']){delete _0x50d555['body']['id'];}_0x50d555['body'][_0x98b6('0x60')]=_0x50d555[_0x98b6('0x55')][_0x98b6('0x60')]||_0x50d555[_0x98b6('0x61')]['id'];_0x4f6717[_0x98b6('0x72')]['id']=_0x50d555[_0x98b6('0x55')]['UserId'];return db[_0x98b6('0x3d')][_0x98b6('0x56')]({'where':{'id':_0x50d555['params']['id'],'UserId':null}})[_0x98b6('0x1f')](handleEntityNotFound(_0x122f6d,null))[_0x98b6('0x1f')](function(_0x478ba1){if(_0x478ba1){_0x4f6717['message']=_0x478ba1['get']({'plain':!![]});return db[_0x98b6('0x73')][_0x98b6('0x56')]({'where':{'id':_0x478ba1[_0x98b6('0x65')]}});}return null;})[_0x98b6('0x1f')](handleEntityNotFound(_0x122f6d,null))['then'](function(_0x139df8){if(_0x139df8){_0x4f6717[_0x98b6('0x68')]=_0x139df8[_0x98b6('0x64')]({'plain':!![]});interaction_log['info']('[OPENCHANNELMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x50d555[_0x98b6('0x61')]['id'],_0x50d555[_0x98b6('0x61')][_0x98b6('0x39')],_0x50d555['user']['role'],_0x4f6717[_0x98b6('0x68')]['id'],_0x50d555[_0x98b6('0x55')]?JSON[_0x98b6('0x23')](_0x50d555[_0x98b6('0x55')]):_0x98b6('0x74'));return respondWithRpcPromise('RejectMessage',_0x98b6('0x75'),_0x4f6717);}return null;})[_0x98b6('0x1f')](function(_0x1f67a5){if(_0x1f67a5){_0x1f67a5['message'][_0x98b6('0x6c')]=util[_0x98b6('0x5e')](_0x98b6('0x6d'),_0x50d555[_0x98b6('0x61')][_0x98b6('0x39')]);_0x1f67a5[_0x98b6('0x27')]['channel']=_0x4f6717[_0x98b6('0x6e')];_0x1f67a5[_0x98b6('0x27')][_0x98b6('0x6f')]=_0x98b6('0x34');respondWithRpcPromise('EventManager',_0x98b6('0x70'),{'event':_0x98b6('0x76'),'message':_0x1f67a5[_0x98b6('0x27')]},client9002);return _0x4f6717;}return null;})['then'](respondWithResult(_0x122f6d,null))[_0x98b6('0x2a')](handleError(_0x122f6d,null));}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.events.js b/server/api/openchannelMessage/openchannelMessage.events.js index 49cab2c..5be1972 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 _0x6fc3=['update','remove','emit','hasOwnProperty','hook','exports','../../mysqldb','OpenchannelMessage','setMaxListeners'];(function(_0x3c0b16,_0x217b15){var _0x13e003=function(_0x3d39de){while(--_0x3d39de){_0x3c0b16['push'](_0x3c0b16['shift']());}};_0x13e003(++_0x217b15);}(_0x6fc3,0x19b));var _0x36fc=function(_0x3dfcd3,_0x285730){_0x3dfcd3=_0x3dfcd3-0x0;var _0x172bc6=_0x6fc3[_0x3dfcd3];return _0x172bc6;};'use strict';var EventEmitter=require('events');var OpenchannelMessage=require(_0x36fc('0x0'))['db'][_0x36fc('0x1')];var OpenchannelMessageEvents=new EventEmitter();OpenchannelMessageEvents[_0x36fc('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x36fc('0x3'),'afterDestroy':_0x36fc('0x4')};function emitEvent(_0x37d50e){return function(_0x3186ea,_0x504476,_0x43abae){OpenchannelMessageEvents[_0x36fc('0x5')](_0x37d50e+':'+_0x3186ea['id'],_0x3186ea);OpenchannelMessageEvents['emit'](_0x37d50e,_0x3186ea);_0x43abae(null);};}for(var e in events){if(events[_0x36fc('0x6')](e)){var event=events[e];OpenchannelMessage[_0x36fc('0x7')](e,emitEvent(event));}}module[_0x36fc('0x8')]=OpenchannelMessageEvents; \ No newline at end of file +var _0xd26c=['exports','../../mysqldb','OpenchannelMessage','setMaxListeners','save','update','emit','hasOwnProperty','hook'];(function(_0x4206f5,_0x21f338){var _0xa29cf3=function(_0x2d35d7){while(--_0x2d35d7){_0x4206f5['push'](_0x4206f5['shift']());}};_0xa29cf3(++_0x21f338);}(_0xd26c,0x91));var _0xcd26=function(_0x14d801,_0x4d340b){_0x14d801=_0x14d801-0x0;var _0x2ae468=_0xd26c[_0x14d801];return _0x2ae468;};'use strict';var EventEmitter=require('events');var OpenchannelMessage=require(_0xcd26('0x0'))['db'][_0xcd26('0x1')];var OpenchannelMessageEvents=new EventEmitter();OpenchannelMessageEvents[_0xcd26('0x2')](0x0);var events={'afterCreate':_0xcd26('0x3'),'afterUpdate':_0xcd26('0x4'),'afterDestroy':'remove'};function emitEvent(_0x57fbe9){return function(_0x393b99,_0x18e180,_0x3e32cb){OpenchannelMessageEvents[_0xcd26('0x5')](_0x57fbe9+':'+_0x393b99['id'],_0x393b99);OpenchannelMessageEvents[_0xcd26('0x5')](_0x57fbe9,_0x393b99);_0x3e32cb(null);};}for(var e in events){if(events[_0xcd26('0x6')](e)){var event=events[e];OpenchannelMessage[_0xcd26('0x7')](e,emitEvent(event));}}module[_0xcd26('0x8')]=OpenchannelMessageEvents; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.model.js b/server/api/openchannelMessage/openchannelMessage.model.js index aafc52a..af39586 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 _0xea89=['describe','OpenchannelAccount','find','OpenchannelAccountId','Interactions','Contact','keys','replyUri','info','OpenchannelMessage,\x20%s,\x20%s','format','length','Interaction','POST','GET','Message\x20%d\x20forwarded\x20to\x20%s','threadId','catch','afterCreate','inspect','finally','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','request-promise','rimraf','./openchannelMessage.attributes','exports','define','OpenchannelMessage','openchannel_messages','body','FULLTEXT','get','direction','toLowerCase','out','isNil','UserId','OpenchannelInteraction','OpenchannelInteractionId','then','update','createdAt','error','secret','CmContact'];(function(_0x28eedc,_0x176917){var _0x575e59=function(_0x40f58d){while(--_0x40f58d){_0x28eedc['push'](_0x28eedc['shift']());}};_0x575e59(++_0x176917);}(_0xea89,0x1e2));var _0x9ea8=function(_0x5c4599,_0x2cf7e8){_0x5c4599=_0x5c4599-0x0;var _0x385968=_0xea89[_0x5c4599];return _0x385968;};'use strict';var _=require(_0x9ea8('0x0'));var util=require(_0x9ea8('0x1'));var logger=require(_0x9ea8('0x2'))(_0x9ea8('0x3'));var moment=require(_0x9ea8('0x4'));var BPromise=require('bluebird');var rp=require(_0x9ea8('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x9ea8('0x6'));var config=require('../../config/environment');var attributes=require(_0x9ea8('0x7'));module[_0x9ea8('0x8')]=function(_0x2c6e50,_0x184f38){return _0x2c6e50[_0x9ea8('0x9')](_0x9ea8('0xa'),attributes,{'tableName':_0x9ea8('0xb'),'paranoid':![],'indexes':[{'name':'fti_openchannel_messages','fields':[_0x9ea8('0xc')],'type':_0x9ea8('0xd')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x5209b6,_0x436faf,_0x254fe0){var _0x2de710=_0x2c6e50['models'];var _0x251150=_0x5209b6[_0x9ea8('0xe')]({'plain':!![]});if(_0x251150[_0x9ea8('0xf')][_0x9ea8('0x10')]()==='in'||_0x251150[_0x9ea8('0xf')][_0x9ea8('0x10')]()===_0x9ea8('0x11')&&!_0x251150['secret']&&!_[_0x9ea8('0x12')](_0x251150[_0x9ea8('0x13')])){_0x2de710[_0x9ea8('0x14')]['findOne']({'where':{'id':_0x251150[_0x9ea8('0x15')]}})[_0x9ea8('0x16')](function(_0x61f839){if(_0x61f839){_0x61f839[_0x9ea8('0x17')]({'lastMsgAt':_0x251150[_0x9ea8('0x18')],'lastMsgDirection':_0x251150[_0x9ea8('0xf')][_0x9ea8('0x10')]()});}})['catch'](function(_0x5226d5){console[_0x9ea8('0x19')](_0x5226d5);});}if(_0x251150[_0x9ea8('0xf')]==='out'&&!_0x251150[_0x9ea8('0x1a')]){var _0x558869;_0x2de710[_0x9ea8('0x1b')][_0x9ea8('0x1c')]()[_0x9ea8('0x16')](function(_0x475fcf){return _0x2de710[_0x9ea8('0x1d')][_0x9ea8('0x1e')]({'where':{'id':_0x251150[_0x9ea8('0x1f')]},'include':[{'model':_0x2de710['OpenchannelInteraction'],'as':_0x9ea8('0x20'),'where':{'id':_0x251150[_0x9ea8('0x15')]},'limit':0x1,'include':[{'model':_0x2de710[_0x9ea8('0x1b')],'as':_0x9ea8('0x21'),'attributes':_[_0x9ea8('0x22')](_0x475fcf)}]}]});})[_0x9ea8('0x16')](function(_0x7c7190){_0x558869=_0x7c7190[_0x9ea8('0xe')]({'plain':!![]});if(_0x558869&&_0x558869[_0x9ea8('0x23')]){logger[_0x9ea8('0x24')](_0x9ea8('0x25'),'afterCreate',util[_0x9ea8('0x26')]('Forwarding\x20message\x20%d\x20to\x20%s',_0x251150['id'],_0x558869[_0x9ea8('0x23')]));if(_0x558869[_0x9ea8('0x20')]&&_0x558869[_0x9ea8('0x20')][_0x9ea8('0x27')]){_0x251150[_0x9ea8('0x28')]=_['omit'](_0x558869[_0x9ea8('0x20')][0x0],_0x9ea8('0x21'));_0x251150[_0x9ea8('0x21')]=_0x558869[_0x9ea8('0x20')][0x0][_0x9ea8('0x21')];}var _0x436faf={'method':_0x9ea8('0x29'),'uri':encodeURI(_0x558869['replyUri']),'json':!![],'resolveWithFullResponse':!![]};switch(_0x436faf['method']){case _0x9ea8('0x2a'):_0x436faf['qs']=_0x251150;break;case _0x9ea8('0x29'):_0x436faf['body']=_0x251150;break;}return rp(_0x436faf)[_0x9ea8('0x16')](function(_0x30a032){logger[_0x9ea8('0x24')]('OpenchannelMessage,\x20%s,\x20%s','afterCreate',util[_0x9ea8('0x26')](_0x9ea8('0x2b'),_0x251150['id'],_0x558869[_0x9ea8('0x23')]));if(_0x30a032[_0x9ea8('0xc')]['threadId']&&_0x30a032['body'][_0x9ea8('0x2c')]!=_0x251150[_0x9ea8('0x28')][_0x9ea8('0x2c')]){return _0x2de710[_0x9ea8('0x14')][_0x9ea8('0x17')]({'threadId':_0x30a032[_0x9ea8('0xc')]['threadId']},{'logging':!![],'where':{'id':_0x251150[_0x9ea8('0x28')]['id']}});}else{return;}})[_0x9ea8('0x16')](function(){return _0x5209b6[_0x9ea8('0x17')]({'read':!![]});})[_0x9ea8('0x2d')](function(_0x185ee7){logger[_0x9ea8('0x19')](_0x9ea8('0x25'),_0x9ea8('0x2e'),util[_0x9ea8('0x2f')](_0x185ee7,{'showHidden':![],'depth':null}));_0x254fe0();});}else{_0x254fe0();}})[_0x9ea8('0x30')](function(){_0x254fe0();});}else{_0x254fe0();}}},'charset':_0x9ea8('0x31'),'collate':_0x9ea8('0x32')});}; \ No newline at end of file +var _0x158f=['Message\x20%d\x20forwarded\x20to\x20%s','threadId','catch','inspect','utf8mb4','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','exports','define','OpenchannelMessage','openchannel_messages','fti_openchannel_messages','body','FULLTEXT','models','get','direction','toLowerCase','out','secret','isNil','UserId','OpenchannelInteraction','OpenchannelInteractionId','update','createdAt','error','then','OpenchannelAccount','OpenchannelAccountId','CmContact','keys','replyUri','info','OpenchannelMessage,\x20%s,\x20%s','afterCreate','format','Forwarding\x20message\x20%d\x20to\x20%s','Interactions','length','Interaction','omit','Contact','POST','GET'];(function(_0x495b3d,_0x4d3da4){var _0x4cb329=function(_0xdef9f0){while(--_0xdef9f0){_0x495b3d['push'](_0x495b3d['shift']());}};_0x4cb329(++_0x4d3da4);}(_0x158f,0x137));var _0xf158=function(_0xcbf198,_0x17c7df){_0xcbf198=_0xcbf198-0x0;var _0x339705=_0x158f[_0xcbf198];return _0x339705;};'use strict';var _=require('lodash');var util=require(_0xf158('0x0'));var logger=require(_0xf158('0x1'))(_0xf158('0x2'));var moment=require(_0xf158('0x3'));var BPromise=require(_0xf158('0x4'));var rp=require(_0xf158('0x5'));var fs=require('fs');var path=require(_0xf158('0x6'));var rimraf=require('rimraf');var config=require(_0xf158('0x7'));var attributes=require('./openchannelMessage.attributes');module[_0xf158('0x8')]=function(_0xb84ee0,_0x178e85){return _0xb84ee0[_0xf158('0x9')](_0xf158('0xa'),attributes,{'tableName':_0xf158('0xb'),'paranoid':![],'indexes':[{'name':_0xf158('0xc'),'fields':[_0xf158('0xd')],'type':_0xf158('0xe')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x35554e,_0x2a17df,_0x1482d6){var _0x5c232c=_0xb84ee0[_0xf158('0xf')];var _0x421b24=_0x35554e[_0xf158('0x10')]({'plain':!![]});if(_0x421b24[_0xf158('0x11')]['toLowerCase']()==='in'||_0x421b24[_0xf158('0x11')][_0xf158('0x12')]()===_0xf158('0x13')&&!_0x421b24[_0xf158('0x14')]&&!_[_0xf158('0x15')](_0x421b24[_0xf158('0x16')])){_0x5c232c[_0xf158('0x17')]['findOne']({'where':{'id':_0x421b24[_0xf158('0x18')]}})['then'](function(_0x16ae70){if(_0x16ae70){_0x16ae70[_0xf158('0x19')]({'lastMsgAt':_0x421b24[_0xf158('0x1a')],'lastMsgDirection':_0x421b24[_0xf158('0x11')][_0xf158('0x12')]()});}})['catch'](function(_0x34431b){console[_0xf158('0x1b')](_0x34431b);});}if(_0x421b24[_0xf158('0x11')]==='out'&&!_0x421b24[_0xf158('0x14')]){var _0x3bfdf1;_0x5c232c['CmContact']['describe']()[_0xf158('0x1c')](function(_0x15fffe){return _0x5c232c[_0xf158('0x1d')]['find']({'where':{'id':_0x421b24[_0xf158('0x1e')]},'include':[{'model':_0x5c232c['OpenchannelInteraction'],'as':'Interactions','where':{'id':_0x421b24[_0xf158('0x18')]},'limit':0x1,'include':[{'model':_0x5c232c[_0xf158('0x1f')],'as':'Contact','attributes':_[_0xf158('0x20')](_0x15fffe)}]}]});})['then'](function(_0xbf88c9){_0x3bfdf1=_0xbf88c9[_0xf158('0x10')]({'plain':!![]});if(_0x3bfdf1&&_0x3bfdf1[_0xf158('0x21')]){logger[_0xf158('0x22')](_0xf158('0x23'),_0xf158('0x24'),util[_0xf158('0x25')](_0xf158('0x26'),_0x421b24['id'],_0x3bfdf1[_0xf158('0x21')]));if(_0x3bfdf1[_0xf158('0x27')]&&_0x3bfdf1[_0xf158('0x27')][_0xf158('0x28')]){_0x421b24[_0xf158('0x29')]=_[_0xf158('0x2a')](_0x3bfdf1[_0xf158('0x27')][0x0],_0xf158('0x2b'));_0x421b24['Contact']=_0x3bfdf1[_0xf158('0x27')][0x0]['Contact'];}var _0x2a17df={'method':_0xf158('0x2c'),'uri':encodeURI(_0x3bfdf1[_0xf158('0x21')]),'json':!![],'resolveWithFullResponse':!![]};switch(_0x2a17df['method']){case _0xf158('0x2d'):_0x2a17df['qs']=_0x421b24;break;case _0xf158('0x2c'):_0x2a17df[_0xf158('0xd')]=_0x421b24;break;}return rp(_0x2a17df)[_0xf158('0x1c')](function(_0x438bb4){logger[_0xf158('0x22')](_0xf158('0x23'),'afterCreate',util[_0xf158('0x25')](_0xf158('0x2e'),_0x421b24['id'],_0x3bfdf1['replyUri']));if(_0x438bb4[_0xf158('0xd')][_0xf158('0x2f')]&&_0x438bb4[_0xf158('0xd')]['threadId']!=_0x421b24[_0xf158('0x29')][_0xf158('0x2f')]){return _0x5c232c[_0xf158('0x17')][_0xf158('0x19')]({'threadId':_0x438bb4[_0xf158('0xd')]['threadId']},{'logging':!![],'where':{'id':_0x421b24[_0xf158('0x29')]['id']}});}else{return;}})[_0xf158('0x1c')](function(){return _0x35554e[_0xf158('0x19')]({'read':!![]});})[_0xf158('0x30')](function(_0x505dd3){logger[_0xf158('0x1b')](_0xf158('0x23'),'afterCreate',util[_0xf158('0x31')](_0x505dd3,{'showHidden':![],'depth':null}));_0x1482d6();});}else{_0x1482d6();}})['finally'](function(){_0x1482d6();});}else{_0x1482d6();}}},'charset':_0xf158('0x32'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.rpc.js b/server/api/openchannelMessage/openchannelMessage.rpc.js index 8f3fd9c..7bff105 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 _0xf811=['lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','defaults','redis','localhost','./openchannelMessage.socket','request','then','info','OpenchannelMessage,\x20%s,\x20%s','request\x20sent','debug','OpenchannelMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateOpenchannelMessage','OpenchannelMessage','create','body','options','raw'];(function(_0x54b682,_0x11365c){var _0x1461e2=function(_0xf1cae2){while(--_0xf1cae2){_0x54b682['push'](_0x54b682['shift']());}};_0x1461e2(++_0x11365c);}(_0xf811,0x6f));var _0x1f81=function(_0x266618,_0x18f637){_0x266618=_0x266618-0x0;var _0x54dbf5=_0xf811[_0x266618];return _0x54dbf5;};'use strict';var _=require(_0x1f81('0x0'));var util=require(_0x1f81('0x1'));var moment=require(_0x1f81('0x2'));var BPromise=require(_0x1f81('0x3'));var rs=require(_0x1f81('0x4'));var fs=require('fs');var Redis=require(_0x1f81('0x5'));var db=require(_0x1f81('0x6'))['db'];var utils=require(_0x1f81('0x7'));var logger=require(_0x1f81('0x8'))(_0x1f81('0x9'));var config=require(_0x1f81('0xa'));var jayson=require(_0x1f81('0xb'));var client=jayson[_0x1f81('0xc')][_0x1f81('0xd')]({'port':0x232a});config['redis']=_[_0x1f81('0xe')](config[_0x1f81('0xf')],{'host':_0x1f81('0x10'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x1f81('0xf')]));require(_0x1f81('0x11'))['register'](socket);function respondWithRpcPromise(_0x2ce4d7,_0x56b05d,_0x1978e5){return new BPromise(function(_0xf59298,_0x12859d){return client[_0x1f81('0x12')](_0x2ce4d7,_0x1978e5)[_0x1f81('0x13')](function(_0x36ccd8){logger[_0x1f81('0x14')](_0x1f81('0x15'),_0x56b05d,_0x1f81('0x16'));logger[_0x1f81('0x17')](_0x1f81('0x18'),_0x56b05d,_0x1f81('0x16'),JSON[_0x1f81('0x19')](_0x36ccd8));if(_0x36ccd8[_0x1f81('0x1a')]){if(_0x36ccd8[_0x1f81('0x1a')][_0x1f81('0x1b')]===0x1f4){logger['error'](_0x1f81('0x15'),_0x56b05d,_0x36ccd8[_0x1f81('0x1a')]['message']);return _0x12859d(_0x36ccd8['error'][_0x1f81('0x1c')]);}logger[_0x1f81('0x1a')]('OpenchannelMessage,\x20%s,\x20%s',_0x56b05d,_0x36ccd8[_0x1f81('0x1a')][_0x1f81('0x1c')]);return _0xf59298(_0x36ccd8[_0x1f81('0x1a')][_0x1f81('0x1c')]);}else{logger['info']('OpenchannelMessage,\x20%s,\x20%s',_0x56b05d,_0x1f81('0x16'));_0xf59298(_0x36ccd8[_0x1f81('0x1d')]['message']);}})[_0x1f81('0x1e')](function(_0x5310fb){logger[_0x1f81('0x1a')](_0x1f81('0x15'),_0x56b05d,_0x5310fb);_0x12859d(_0x5310fb);});});}exports[_0x1f81('0x1f')]=function(_0x4beeae){var _0x275138=this;return new Promise(function(_0x3f0de8,_0x2d9b8d){return db[_0x1f81('0x20')][_0x1f81('0x21')](_0x4beeae[_0x1f81('0x22')],{'raw':_0x4beeae['options']?_0x4beeae[_0x1f81('0x23')][_0x1f81('0x24')]===undefined?!![]:![]:!![]})[_0x1f81('0x13')](function(_0x4ecfa9){logger['info'](_0x1f81('0x1f'),_0x4beeae);logger['debug'](_0x1f81('0x1f'),_0x4beeae,JSON['stringify'](_0x4ecfa9));_0x3f0de8(_0x4ecfa9);})['catch'](function(_0x34cdbc){logger['error'](_0x1f81('0x1f'),_0x34cdbc['message'],_0x4beeae);_0x2d9b8d(_0x275138[_0x1f81('0x1a')](0x1f4,_0x34cdbc[_0x1f81('0x1c')]));});});}; \ No newline at end of file +var _0xffd6=['./openchannelMessage.socket','register','request','then','OpenchannelMessage,\x20%s,\x20%s','request\x20sent','OpenchannelMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','OpenchannelMessage','create','options','raw','debug','CreateOpenchannelMessage','catch','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','redis','defaults','localhost','socket.io-emitter'];(function(_0x2b6cb8,_0x8baac3){var _0x2e691d=function(_0xe6bc73){while(--_0xe6bc73){_0x2b6cb8['push'](_0x2b6cb8['shift']());}};_0x2e691d(++_0x8baac3);}(_0xffd6,0x97));var _0x6ffd=function(_0x215e65,_0x183f97){_0x215e65=_0x215e65-0x0;var _0xa85842=_0xffd6[_0x215e65];return _0xa85842;};'use strict';var _=require(_0x6ffd('0x0'));var util=require(_0x6ffd('0x1'));var moment=require(_0x6ffd('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6ffd('0x3'));var db=require(_0x6ffd('0x4'))['db'];var utils=require(_0x6ffd('0x5'));var logger=require('../../config/logger')(_0x6ffd('0x6'));var config=require(_0x6ffd('0x7'));var jayson=require(_0x6ffd('0x8'));var client=jayson[_0x6ffd('0x9')]['http']({'port':0x232a});config[_0x6ffd('0xa')]=_[_0x6ffd('0xb')](config[_0x6ffd('0xa')],{'host':_0x6ffd('0xc'),'port':0x18eb});var socket=require(_0x6ffd('0xd'))(new Redis(config['redis']));require(_0x6ffd('0xe'))[_0x6ffd('0xf')](socket);function respondWithRpcPromise(_0x4e57f5,_0x469d0d,_0x38fc68){return new BPromise(function(_0x23f7f2,_0x3dda1e){return client[_0x6ffd('0x10')](_0x4e57f5,_0x38fc68)[_0x6ffd('0x11')](function(_0x836501){logger['info'](_0x6ffd('0x12'),_0x469d0d,_0x6ffd('0x13'));logger['debug'](_0x6ffd('0x14'),_0x469d0d,_0x6ffd('0x13'),JSON[_0x6ffd('0x15')](_0x836501));if(_0x836501[_0x6ffd('0x16')]){if(_0x836501['error'][_0x6ffd('0x17')]===0x1f4){logger['error'](_0x6ffd('0x12'),_0x469d0d,_0x836501['error'][_0x6ffd('0x18')]);return _0x3dda1e(_0x836501[_0x6ffd('0x16')][_0x6ffd('0x18')]);}logger['error'](_0x6ffd('0x12'),_0x469d0d,_0x836501[_0x6ffd('0x16')][_0x6ffd('0x18')]);return _0x23f7f2(_0x836501[_0x6ffd('0x16')][_0x6ffd('0x18')]);}else{logger[_0x6ffd('0x19')](_0x6ffd('0x12'),_0x469d0d,_0x6ffd('0x13'));_0x23f7f2(_0x836501['result'][_0x6ffd('0x18')]);}})['catch'](function(_0x587d0b){logger[_0x6ffd('0x16')](_0x6ffd('0x12'),_0x469d0d,_0x587d0b);_0x3dda1e(_0x587d0b);});});}exports['CreateOpenchannelMessage']=function(_0x34c3c1){var _0x4612a3=this;return new Promise(function(_0x4eeaa2,_0x564a11){return db[_0x6ffd('0x1a')][_0x6ffd('0x1b')](_0x34c3c1['body'],{'raw':_0x34c3c1[_0x6ffd('0x1c')]?_0x34c3c1[_0x6ffd('0x1c')][_0x6ffd('0x1d')]===undefined?!![]:![]:!![]})['then'](function(_0x3ba429){logger[_0x6ffd('0x19')]('CreateOpenchannelMessage',_0x34c3c1);logger[_0x6ffd('0x1e')](_0x6ffd('0x1f'),_0x34c3c1,JSON['stringify'](_0x3ba429));_0x4eeaa2(_0x3ba429);})[_0x6ffd('0x20')](function(_0x35ef16){logger[_0x6ffd('0x16')]('CreateOpenchannelMessage',_0x35ef16[_0x6ffd('0x18')],_0x34c3c1);_0x564a11(_0x4612a3[_0x6ffd('0x16')](0x1f4,_0x35ef16[_0x6ffd('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.socket.js b/server/api/openchannelMessage/openchannelMessage.socket.js index cbceb4c..cb727b6 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 _0xd8b0=['save','emit','./openchannelMessage.events'];(function(_0x3bb7a4,_0x452b1a){var _0x59f56d=function(_0x25061c){while(--_0x25061c){_0x3bb7a4['push'](_0x3bb7a4['shift']());}};_0x59f56d(++_0x452b1a);}(_0xd8b0,0xad));var _0x0d8b=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xd8b0[_0xa464c9];return _0x3d73c4;};'use strict';var OpenchannelMessageEvents=require(_0x0d8b('0x0'));var events=[_0x0d8b('0x1'),'remove','update'];function createListener(_0x4b72b0,_0x3ff8df){return function(_0x5b9b89){_0x3ff8df[_0x0d8b('0x2')](_0x4b72b0,_0x5b9b89);};}function removeListener(_0x364286,_0x8196ed){return function(){OpenchannelMessageEvents['removeListener'](_0x364286,_0x8196ed);};}exports['register']=function(_0x3f8b6f){for(var _0x227c63=0x0,_0x39f43a=events['length'];_0x227c63<_0x39f43a;_0x227c63++){var _0x413284=events[_0x227c63];var _0x284169=createListener('openchannelMessage:'+_0x413284,_0x3f8b6f);OpenchannelMessageEvents['on'](_0x413284,_0x284169);}}; \ No newline at end of file +var _0xbdb7=['openchannelMessage:','./openchannelMessage.events','save','remove','update','emit','removeListener'];(function(_0x4ca6a4,_0x5e9694){var _0x120555=function(_0x56888c){while(--_0x56888c){_0x4ca6a4['push'](_0x4ca6a4['shift']());}};_0x120555(++_0x5e9694);}(_0xbdb7,0x12e));var _0x7bdb=function(_0x1a9390,_0x3339e6){_0x1a9390=_0x1a9390-0x0;var _0x2b4514=_0xbdb7[_0x1a9390];return _0x2b4514;};'use strict';var OpenchannelMessageEvents=require(_0x7bdb('0x0'));var events=[_0x7bdb('0x1'),_0x7bdb('0x2'),_0x7bdb('0x3')];function createListener(_0x23c326,_0x433850){return function(_0x4496ac){_0x433850[_0x7bdb('0x4')](_0x23c326,_0x4496ac);};}function removeListener(_0x46c068,_0x47aec5){return function(){OpenchannelMessageEvents[_0x7bdb('0x5')](_0x46c068,_0x47aec5);};}exports['register']=function(_0x4b5fff){for(var _0xffdc86=0x0,_0x1e23a3=events['length'];_0xffdc86<_0x1e23a3;_0xffdc86++){var _0x513cba=events[_0xffdc86];var _0x468041=createListener(_0x7bdb('0x6')+_0x513cba,_0x4b5fff);OpenchannelMessageEvents['on'](_0x513cba,_0x468041);}}; \ No newline at end of file diff --git a/server/api/openchannelQueue/index.js b/server/api/openchannelQueue/index.js index 8fe29fb..27ed228 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 _0x9b97=['connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','/describe','/:id','show','getMembers','/:id/teams','getTeams','/:id/users','getAgents','post','addAgents','put','update','delete','destroy','multer','path'];(function(_0x453421,_0x417702){var _0x4ee8e5=function(_0x4df9b3){while(--_0x4df9b3){_0x453421['push'](_0x453421['shift']());}};_0x4ee8e5(++_0x417702);}(_0x9b97,0x11e));var _0x79b9=function(_0x56bea1,_0x517ff5){_0x56bea1=_0x56bea1-0x0;var _0x348cb1=_0x9b97[_0x56bea1];return _0x348cb1;};'use strict';var multer=require(_0x79b9('0x0'));var util=require('util');var path=require(_0x79b9('0x1'));var timeout=require(_0x79b9('0x2'));var express=require(_0x79b9('0x3'));var router=express[_0x79b9('0x4')]();var auth=require(_0x79b9('0x5'));var interaction=require(_0x79b9('0x6'));var config=require('../../config/environment');var controller=require('./openchannelQueue.controller');router[_0x79b9('0x7')]('/',auth[_0x79b9('0x8')](),controller[_0x79b9('0x9')]);router['get'](_0x79b9('0xa'),auth[_0x79b9('0x8')](),controller['describe']);router[_0x79b9('0x7')](_0x79b9('0xb'),auth[_0x79b9('0x8')](),controller[_0x79b9('0xc')]);router[_0x79b9('0x7')]('/:id/members',auth['isAuthenticated'](),controller[_0x79b9('0xd')]);router[_0x79b9('0x7')](_0x79b9('0xe'),auth[_0x79b9('0x8')](),controller[_0x79b9('0xf')]);router[_0x79b9('0x7')](_0x79b9('0x10'),auth[_0x79b9('0x8')](),controller[_0x79b9('0x11')]);router[_0x79b9('0x12')]('/',auth[_0x79b9('0x8')](),controller['create']);router[_0x79b9('0x12')](_0x79b9('0xe'),auth['isAuthenticated'](),controller['addTeams']);router['post'](_0x79b9('0x10'),auth[_0x79b9('0x8')](),controller[_0x79b9('0x13')]);router[_0x79b9('0x14')](_0x79b9('0xb'),auth['isAuthenticated'](),controller[_0x79b9('0x15')]);router[_0x79b9('0x16')](_0x79b9('0xb'),auth[_0x79b9('0x8')](),controller[_0x79b9('0x17')]);router[_0x79b9('0x16')](_0x79b9('0xe'),auth[_0x79b9('0x8')](),controller['removeTeams']);router[_0x79b9('0x16')](_0x79b9('0x10'),auth['isAuthenticated'](),controller['removeAgents']);module['exports']=router; \ No newline at end of file +var _0xf9d5=['./openchannelQueue.controller','get','index','/describe','isAuthenticated','/:id','show','/:id/members','getMembers','getTeams','/:id/users','getAgents','post','create','/:id/teams','addTeams','update','delete','removeTeams','removeAgents','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x2c730a,_0x17de0e){var _0x483cbb=function(_0x35cea0){while(--_0x35cea0){_0x2c730a['push'](_0x2c730a['shift']());}};_0x483cbb(++_0x17de0e);}(_0xf9d5,0x122));var _0x5f9d=function(_0x4a468e,_0x4ca999){_0x4a468e=_0x4a468e-0x0;var _0x128c98=_0xf9d5[_0x4a468e];return _0x128c98;};'use strict';var multer=require('multer');var util=require(_0x5f9d('0x0'));var path=require(_0x5f9d('0x1'));var timeout=require('connect-timeout');var express=require(_0x5f9d('0x2'));var router=express[_0x5f9d('0x3')]();var auth=require(_0x5f9d('0x4'));var interaction=require(_0x5f9d('0x5'));var config=require(_0x5f9d('0x6'));var controller=require(_0x5f9d('0x7'));router[_0x5f9d('0x8')]('/',auth['isAuthenticated'](),controller[_0x5f9d('0x9')]);router['get'](_0x5f9d('0xa'),auth[_0x5f9d('0xb')](),controller['describe']);router[_0x5f9d('0x8')](_0x5f9d('0xc'),auth[_0x5f9d('0xb')](),controller[_0x5f9d('0xd')]);router[_0x5f9d('0x8')](_0x5f9d('0xe'),auth['isAuthenticated'](),controller[_0x5f9d('0xf')]);router[_0x5f9d('0x8')]('/:id/teams',auth['isAuthenticated'](),controller[_0x5f9d('0x10')]);router[_0x5f9d('0x8')](_0x5f9d('0x11'),auth['isAuthenticated'](),controller[_0x5f9d('0x12')]);router[_0x5f9d('0x13')]('/',auth[_0x5f9d('0xb')](),controller[_0x5f9d('0x14')]);router['post'](_0x5f9d('0x15'),auth[_0x5f9d('0xb')](),controller[_0x5f9d('0x16')]);router['post'](_0x5f9d('0x11'),auth[_0x5f9d('0xb')](),controller['addAgents']);router['put'](_0x5f9d('0xc'),auth[_0x5f9d('0xb')](),controller[_0x5f9d('0x17')]);router[_0x5f9d('0x18')](_0x5f9d('0xc'),auth['isAuthenticated'](),controller['destroy']);router['delete'](_0x5f9d('0x15'),auth['isAuthenticated'](),controller[_0x5f9d('0x19')]);router['delete'](_0x5f9d('0x11'),auth[_0x5f9d('0xb')](),controller[_0x5f9d('0x1a')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.attributes.js b/server/api/openchannelQueue/openchannelQueue.attributes.js index e1afed4..a63a6f0 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 _0x6c64=['exports','STRING','INTEGER','ENUM','rrmemory','roundrobin','sequelize'];(function(_0x3296bc,_0xca935f){var _0x1e2c6b=function(_0x1778f4){while(--_0x1778f4){_0x3296bc['push'](_0x3296bc['shift']());}};_0x1e2c6b(++_0xca935f);}(_0x6c64,0xdf));var _0x46c6=function(_0x41f50a,_0x5bae61){_0x41f50a=_0x41f50a-0x0;var _0x2e529c=_0x6c64[_0x41f50a];return _0x2e529c;};'use strict';var Sequelize=require(_0x46c6('0x0'));module[_0x46c6('0x1')]={'name':{'type':Sequelize[_0x46c6('0x2')],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize[_0x46c6('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x46c6('0x4')](_0x46c6('0x5'),'beepall',_0x46c6('0x6'))}}; \ No newline at end of file +var _0xd603=['sequelize','STRING','name','INTEGER','ENUM','rrmemory','roundrobin'];(function(_0x3b53b0,_0x23dc58){var _0x4eddc6=function(_0x46254f){while(--_0x46254f){_0x3b53b0['push'](_0x3b53b0['shift']());}};_0x4eddc6(++_0x23dc58);}(_0xd603,0x103));var _0x3d60=function(_0x2d4421,_0x15a84f){_0x2d4421=_0x2d4421-0x0;var _0x2d3b01=_0xd603[_0x2d4421];return _0x2d3b01;};'use strict';var Sequelize=require(_0x3d60('0x0'));module['exports']={'name':{'type':Sequelize[_0x3d60('0x1')],'unique':_0x3d60('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x3d60('0x1')]},'timeout':{'type':Sequelize[_0x3d60('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x3d60('0x4')](_0x3d60('0x5'),'beepall',_0x3d60('0x6'))}}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.controller.js b/server/api/openchannelQueue/openchannelQueue.controller.js index 0210b5c..332fa62 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 _0x6dce=['filter','OpenchannelQueue','includeAll','findAll','rows','catch','params','keys','include','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','describe','getMembers','UserOpenchannelQueue','rawAttributes','pick','OpenchannelQueueId','User','findAndCountAll','UserId','agent','openchannelPause','updatedAt','createdAt','format','%s/%s','SIP','findOne','getTeams','ids','Team','Agents','voicePause','interface','flatMap','transaction','addTeams','each','findOrCreate','userOpenchannelQueue:save','removeTeams','select','field','from','team_has_openchannel_queues','ut.TeamId\x20=\x20tq.TeamId','OpenchannelQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','sequelize','QueryTypes','SELECT','every','TeamId','includes','all','union','compact','value','isEmpty','removeAgents','emit','addAgents','omit','spread','isArray','userOpenchannelQueue:remove','getAgents','order','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','api','../../config/environment','redis','socket.io-emitter','./openchannelQueue.socket','register','sendStatus','status','json','count','offset','limit','set','Content-Range','reject','save','then','get','OpenchannelQueues','UserProfileResource','destroy','end','error','name','send','index','map','fieldName','type','key','query','intersection','attributes','model','fields','length','hasOwnProperty','nolimit','sort','where','filters','merge','VIRTUAL'];(function(_0x3d75da,_0x372212){var _0x1bd83f=function(_0x3908dd){while(--_0x3908dd){_0x3d75da['push'](_0x3d75da['shift']());}};_0x1bd83f(++_0x372212);}(_0x6dce,0x1ef));var _0xe6dc=function(_0x3c5ee9,_0x49b07b){_0x3c5ee9=_0x3c5ee9-0x0;var _0x4e161c=_0x6dce[_0x3c5ee9];return _0x4e161c;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xe6dc('0x0'));var rimraf=require(_0xe6dc('0x1'));var zipdir=require(_0xe6dc('0x2'));var jsonpatch=require(_0xe6dc('0x3'));var rp=require('request-promise');var moment=require(_0xe6dc('0x4'));var BPromise=require(_0xe6dc('0x5'));var Mustache=require(_0xe6dc('0x6'));var util=require(_0xe6dc('0x7'));var path=require(_0xe6dc('0x8'));var sox=require(_0xe6dc('0x9'));var csv=require(_0xe6dc('0xa'));var ejs=require(_0xe6dc('0xb'));var fs=require('fs');var _=require(_0xe6dc('0xc'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xe6dc('0xd'));var deskjs=require(_0xe6dc('0xe'));var toCsv=require(_0xe6dc('0xa'));var querystring=require(_0xe6dc('0xf'));var Papa=require(_0xe6dc('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xe6dc('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xe6dc('0x12'));var utils=require('../../config/utils');var config=require(_0xe6dc('0x13'));var db=require('../../mysqldb')['db'];config['redis']=_['defaults'](config[_0xe6dc('0x14')],{'host':'localhost','port':0x18eb});var socket=require(_0xe6dc('0x15'))(new Redis(config[_0xe6dc('0x14')]));require(_0xe6dc('0x16'))[_0xe6dc('0x17')](socket);function respondWithStatusCode(_0x2c56ce,_0x3ce437){_0x3ce437=_0x3ce437||0xcc;return function(_0x132e8d){if(_0x132e8d){return _0x2c56ce[_0xe6dc('0x18')](_0x3ce437);}return _0x2c56ce[_0xe6dc('0x19')](_0x3ce437)['end']();};}function respondWithResult(_0x1b7372,_0x2b88bd){_0x2b88bd=_0x2b88bd||0xc8;return function(_0x64f6cd){if(_0x64f6cd){return _0x1b7372[_0xe6dc('0x19')](_0x2b88bd)[_0xe6dc('0x1a')](_0x64f6cd);}};}function respondWithFilteredResult(_0x33578c,_0x213f43){return function(_0x27cfa7){if(_0x27cfa7){var _0x1d3f18=_0x27cfa7[_0xe6dc('0x1b')],_0x3af2fc=_0x213f43[_0xe6dc('0x1c')],_0x43eccc=_0x213f43[_0xe6dc('0x1c')]+_0x213f43[_0xe6dc('0x1d')],_0x2691b4;if(_0x43eccc>=_0x1d3f18){_0x43eccc=_0x1d3f18;_0x2691b4=0xc8;}else{_0x2691b4=0xce;}_0x33578c['status'](_0x2691b4);return _0x33578c[_0xe6dc('0x1e')](_0xe6dc('0x1f'),_0x3af2fc+'-'+_0x43eccc+'/'+_0x1d3f18)['json'](_0x27cfa7);}return null;};}function patchUpdates(_0x3deb17){return function(_0x5a19ce){try{jsonpatch['apply'](_0x5a19ce,_0x3deb17,!![]);}catch(_0x1ec648){return BPromise[_0xe6dc('0x20')](_0x1ec648);}return _0x5a19ce[_0xe6dc('0x21')]();};}function saveUpdates(_0x323028,_0x3ce997){return function(_0x25ef6e){if(_0x25ef6e){return _0x25ef6e['update'](_0x323028)[_0xe6dc('0x22')](function(_0x266969){return _0x266969;});}return null;};}function removeEntity(_0x392acd,_0x41b2ca){return function(_0x358248){if(_0x358248){return _0x358248['destroy']()[_0xe6dc('0x22')](function(){var _0x5f3469=_0x358248[_0xe6dc('0x23')]({'plain':!![]});var _0x3d9187=_0xe6dc('0x24');return db[_0xe6dc('0x25')][_0xe6dc('0x26')]({'where':{'type':_0x3d9187,'resourceId':_0x5f3469['id']}})[_0xe6dc('0x22')](function(){return _0x358248;});})[_0xe6dc('0x22')](function(){_0x392acd['status'](0xcc)[_0xe6dc('0x27')]();});}};}function handleEntityNotFound(_0x571773,_0x4d745a){return function(_0x595e92){if(!_0x595e92){_0x571773[_0xe6dc('0x18')](0x194);}return _0x595e92;};}function handleError(_0x5a764e,_0x4ef311){_0x4ef311=_0x4ef311||0x1f4;return function(_0x103d7e){logger[_0xe6dc('0x28')](_0x103d7e['stack']);if(_0x103d7e['name']){delete _0x103d7e[_0xe6dc('0x29')];}_0x5a764e[_0xe6dc('0x19')](_0x4ef311)[_0xe6dc('0x2a')](_0x103d7e);};}exports[_0xe6dc('0x2b')]=function(_0x37d508,_0x3936a3){var _0x47b508={},_0x373988={},_0x4cd77d={'count':0x0,'rows':[]};var _0x3f2218=_[_0xe6dc('0x2c')](db['OpenchannelQueue']['rawAttributes'],function(_0x1df99c){return{'name':_0x1df99c[_0xe6dc('0x2d')],'type':_0x1df99c[_0xe6dc('0x2e')][_0xe6dc('0x2f')]};});_0x373988['model']=_[_0xe6dc('0x2c')](_0x3f2218,_0xe6dc('0x29'));_0x373988[_0xe6dc('0x30')]=_['keys'](_0x37d508['query']);_0x373988['filters']=_[_0xe6dc('0x31')](_0x373988['model'],_0x373988['query']);_0x47b508[_0xe6dc('0x32')]=_['intersection'](_0x373988[_0xe6dc('0x33')],qs[_0xe6dc('0x34')](_0x37d508[_0xe6dc('0x30')]['fields']));_0x47b508[_0xe6dc('0x32')]=_0x47b508[_0xe6dc('0x32')][_0xe6dc('0x35')]?_0x47b508[_0xe6dc('0x32')]:_0x373988['model'];if(!_0x37d508[_0xe6dc('0x30')][_0xe6dc('0x36')](_0xe6dc('0x37'))){_0x47b508[_0xe6dc('0x1d')]=qs[_0xe6dc('0x1d')](_0x37d508[_0xe6dc('0x30')][_0xe6dc('0x1d')]);_0x47b508[_0xe6dc('0x1c')]=qs[_0xe6dc('0x1c')](_0x37d508[_0xe6dc('0x30')][_0xe6dc('0x1c')]);}_0x47b508['order']=qs[_0xe6dc('0x38')](_0x37d508['query']['sort']);_0x47b508[_0xe6dc('0x39')]=qs[_0xe6dc('0x3a')](_['pick'](_0x37d508[_0xe6dc('0x30')],_0x373988['filters']),_0x3f2218);if(_0x37d508[_0xe6dc('0x30')]['filter']){_0x47b508[_0xe6dc('0x39')]=_[_0xe6dc('0x3b')](_0x47b508[_0xe6dc('0x39')],{'$or':_[_0xe6dc('0x2c')](_0x3f2218,function(_0x41545e){if(_0x41545e[_0xe6dc('0x2e')]!==_0xe6dc('0x3c')){var _0x174a7f={};_0x174a7f[_0x41545e[_0xe6dc('0x29')]]={'$like':'%'+_0x37d508[_0xe6dc('0x30')][_0xe6dc('0x3d')]+'%'};return _0x174a7f;}})});}_0x47b508=_['merge']({},_0x47b508,_0x37d508['options']);var _0x3e6c37={'where':_0x47b508['where']};return db[_0xe6dc('0x3e')][_0xe6dc('0x1b')](_0x3e6c37)['then'](function(_0x3656a5){_0x4cd77d['count']=_0x3656a5;if(_0x37d508['query'][_0xe6dc('0x3f')]){_0x47b508['include']=[{'all':!![]}];}return db[_0xe6dc('0x3e')][_0xe6dc('0x40')](_0x47b508);})[_0xe6dc('0x22')](function(_0x42f52e){_0x4cd77d[_0xe6dc('0x41')]=_0x42f52e;return _0x4cd77d;})[_0xe6dc('0x22')](respondWithFilteredResult(_0x3936a3,_0x47b508))[_0xe6dc('0x42')](handleError(_0x3936a3,null));};exports['show']=function(_0x176120,_0x32d4c6){var _0x3e3ade={'raw':!![],'where':{'id':_0x176120[_0xe6dc('0x43')]['id']}},_0x59d20e={};_0x59d20e[_0xe6dc('0x33')]=_[_0xe6dc('0x44')](db[_0xe6dc('0x3e')]['rawAttributes']);_0x59d20e['query']=_[_0xe6dc('0x44')](_0x176120[_0xe6dc('0x30')]);_0x59d20e[_0xe6dc('0x3a')]=_['intersection'](_0x59d20e[_0xe6dc('0x33')],_0x59d20e['query']);_0x3e3ade[_0xe6dc('0x32')]=_[_0xe6dc('0x31')](_0x59d20e[_0xe6dc('0x33')],qs[_0xe6dc('0x34')](_0x176120[_0xe6dc('0x30')]['fields']));_0x3e3ade[_0xe6dc('0x32')]=_0x3e3ade[_0xe6dc('0x32')][_0xe6dc('0x35')]?_0x3e3ade[_0xe6dc('0x32')]:_0x59d20e[_0xe6dc('0x33')];if(_0x176120['query'][_0xe6dc('0x3f')]){_0x3e3ade[_0xe6dc('0x45')]=[{'all':!![]}];}_0x3e3ade=_[_0xe6dc('0x3b')]({},_0x3e3ade,_0x176120[_0xe6dc('0x46')]);return db[_0xe6dc('0x3e')][_0xe6dc('0x47')](_0x3e3ade)[_0xe6dc('0x22')](handleEntityNotFound(_0x32d4c6,null))[_0xe6dc('0x22')](respondWithResult(_0x32d4c6,null))['catch'](handleError(_0x32d4c6,null));};exports[_0xe6dc('0x48')]=function(_0x54deb6,_0x20bc93){return db[_0xe6dc('0x3e')][_0xe6dc('0x48')](_0x54deb6[_0xe6dc('0x49')],{})[_0xe6dc('0x22')](function(_0x327d74){var _0x37dabc=_0x54deb6[_0xe6dc('0x4a')][_0xe6dc('0x23')]({'plain':!![]});if(!_0x37dabc)throw new Error(_0xe6dc('0x4b'));if(_0x37dabc[_0xe6dc('0x4c')]===_0xe6dc('0x4a')){var _0xe34312=_0x327d74['get']({'plain':!![]});var _0x50c440='OpenchannelQueues';return db['UserProfileSection'][_0xe6dc('0x47')]({'where':{'name':_0x50c440,'userProfileId':_0x37dabc[_0xe6dc('0x4d')]},'raw':!![]})[_0xe6dc('0x22')](function(_0x589e6f){if(_0x589e6f&&_0x589e6f['autoAssociation']===0x0){return db[_0xe6dc('0x25')][_0xe6dc('0x48')]({'name':_0xe34312[_0xe6dc('0x29')],'resourceId':_0xe34312['id'],'type':_0x589e6f['name'],'sectionId':_0x589e6f['id']},{})[_0xe6dc('0x22')](function(){return _0x327d74;});}else{return _0x327d74;}})[_0xe6dc('0x42')](function(_0x45cec6){logger[_0xe6dc('0x28')](_0xe6dc('0x4e'),_0x45cec6);throw _0x45cec6;});}return _0x327d74;})[_0xe6dc('0x22')](respondWithResult(_0x20bc93,0xc9))[_0xe6dc('0x42')](handleError(_0x20bc93,null));};exports[_0xe6dc('0x4f')]=function(_0x146bf3,_0x55c2b1){if(_0x146bf3[_0xe6dc('0x49')]['id']){delete _0x146bf3[_0xe6dc('0x49')]['id'];}return db[_0xe6dc('0x3e')][_0xe6dc('0x47')]({'where':{'id':_0x146bf3['params']['id']}})[_0xe6dc('0x22')](handleEntityNotFound(_0x55c2b1,null))[_0xe6dc('0x22')](saveUpdates(_0x146bf3[_0xe6dc('0x49')],null))[_0xe6dc('0x22')](respondWithResult(_0x55c2b1,null))[_0xe6dc('0x42')](handleError(_0x55c2b1,null));};exports['destroy']=function(_0x512741,_0x28ca14){return db[_0xe6dc('0x3e')][_0xe6dc('0x47')]({'where':{'id':_0x512741[_0xe6dc('0x43')]['id']}})['then'](handleEntityNotFound(_0x28ca14,null))[_0xe6dc('0x22')](removeEntity(_0x28ca14,null))[_0xe6dc('0x42')](handleError(_0x28ca14,null));};exports[_0xe6dc('0x50')]=function(_0x5b122b,_0x53442f){return db[_0xe6dc('0x3e')][_0xe6dc('0x50')]()['then'](respondWithResult(_0x53442f,null))[_0xe6dc('0x42')](handleError(_0x53442f,null));};exports[_0xe6dc('0x51')]=function(_0xb15659,_0x2b9079,_0x4d6b00){var _0x2de12f={'raw':!![],'where':{}},_0x32e59a={},_0x4032cf;return db[_0xe6dc('0x3e')]['findOne']({'where':{'id':_0xb15659[_0xe6dc('0x43')]['id']}})[_0xe6dc('0x22')](handleEntityNotFound(_0x2b9079,null))[_0xe6dc('0x22')](function(_0x5535c5){if(_0x5535c5){_0x4032cf=_0x5535c5['get']({'plain':!![]});_0x32e59a[_0xe6dc('0x33')]=_['keys'](db[_0xe6dc('0x52')][_0xe6dc('0x53')]);_0x32e59a['query']=_[_0xe6dc('0x44')](_0xb15659[_0xe6dc('0x30')]);_0x32e59a[_0xe6dc('0x3a')]=_[_0xe6dc('0x31')](_0x32e59a[_0xe6dc('0x33')],_0x32e59a[_0xe6dc('0x30')]);_0x2de12f[_0xe6dc('0x32')]=_[_0xe6dc('0x31')](_0x32e59a[_0xe6dc('0x33')],qs[_0xe6dc('0x34')](_0xb15659[_0xe6dc('0x30')][_0xe6dc('0x34')]));_0x2de12f['attributes']=_0x2de12f['attributes'][_0xe6dc('0x35')]?_0x2de12f[_0xe6dc('0x32')]:_0x32e59a[_0xe6dc('0x33')];if(!_0xb15659[_0xe6dc('0x30')]['hasOwnProperty'](_0xe6dc('0x37'))){_0x2de12f[_0xe6dc('0x1d')]=qs['limit'](_0xb15659[_0xe6dc('0x30')][_0xe6dc('0x1d')]);_0x2de12f[_0xe6dc('0x1c')]=qs['offset'](_0xb15659[_0xe6dc('0x30')]['offset']);}_0x2de12f['order']=qs[_0xe6dc('0x38')](_0xb15659['query'][_0xe6dc('0x38')]);_0x2de12f[_0xe6dc('0x39')]=qs[_0xe6dc('0x3a')](_[_0xe6dc('0x54')](_0xb15659[_0xe6dc('0x30')],_0x32e59a[_0xe6dc('0x3a')]));_0x2de12f['where'][_0xe6dc('0x55')]=_0x5535c5['id'];if(_0xb15659[_0xe6dc('0x30')][_0xe6dc('0x3d')]){_0x2de12f[_0xe6dc('0x39')]=_[_0xe6dc('0x3b')](_0x2de12f[_0xe6dc('0x39')],{'$or':_[_0xe6dc('0x2c')](_0x2de12f[_0xe6dc('0x32')],function(_0x4ef60f){var _0x3490a5={};_0x3490a5[_0x4ef60f]={'$like':'%'+_0xb15659[_0xe6dc('0x30')]['filter']+'%'};return _0x3490a5;})});}_0x2de12f=_[_0xe6dc('0x3b')]({},_0x2de12f,_0xb15659['options']);return db[_0xe6dc('0x52')][_0xe6dc('0x40')](_0x2de12f);}})['then'](function(_0x1526c7){if(_0x1526c7){return db[_0xe6dc('0x56')][_0xe6dc('0x57')]({'where':{'id':_[_0xe6dc('0x2c')](_0x1526c7,_0xe6dc('0x58')),'role':_0xe6dc('0x59')},'attributes':['id','name',_0xe6dc('0x5a'),_0xe6dc('0x5b'),_0xe6dc('0x5c')]});}})[_0xe6dc('0x22')](function(_0x270550){if(_0x270550){return{'count':_0x270550[_0xe6dc('0x1b')],'rows':_[_0xe6dc('0x2c')](_0x270550[_0xe6dc('0x41')],function(_0x44cd17){return{'membername':_0x44cd17[_0xe6dc('0x29')],'UserId':_0x44cd17['id'],'queue_name':_0x4032cf[_0xe6dc('0x29')],'OpenchannelQueueId':_0x4032cf['id'],'interface':util[_0xe6dc('0x5d')](_0xe6dc('0x5e'),_0xe6dc('0x5f'),_0x44cd17['name']),'penalty':0x0,'paused':_0x44cd17[_0xe6dc('0x5a')],'createdAt':_0x44cd17[_0xe6dc('0x5c')],'updatedAt':_0x44cd17[_0xe6dc('0x5b')]};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x2b9079,_0x2de12f))[_0xe6dc('0x42')](handleError(_0x2b9079,null));};exports['getTeams']=function(_0x3163ad,_0x22ed85,_0xec80a7){var _0x390701={};var _0x5f3381={};var _0x1c0956;var _0x31f7a0;return db[_0xe6dc('0x3e')][_0xe6dc('0x60')]({'where':{'id':_0x3163ad[_0xe6dc('0x43')]['id']}})[_0xe6dc('0x22')](handleEntityNotFound(_0x22ed85,null))[_0xe6dc('0x22')](function(_0x19d9f9){if(_0x19d9f9){_0x1c0956=_0x19d9f9;_0x5f3381[_0xe6dc('0x33')]=_['keys'](db['Team'][_0xe6dc('0x53')]);_0x5f3381[_0xe6dc('0x30')]=_['keys'](_0x3163ad['query']);_0x5f3381[_0xe6dc('0x3a')]=_[_0xe6dc('0x31')](_0x5f3381[_0xe6dc('0x33')],_0x5f3381[_0xe6dc('0x30')]);_0x390701[_0xe6dc('0x32')]=_[_0xe6dc('0x31')](_0x5f3381[_0xe6dc('0x33')],qs['fields'](_0x3163ad[_0xe6dc('0x30')]['fields']));_0x390701[_0xe6dc('0x32')]=_0x390701[_0xe6dc('0x32')][_0xe6dc('0x35')]?_0x390701['attributes']:_0x5f3381[_0xe6dc('0x33')];_0x390701['order']=qs[_0xe6dc('0x38')](_0x3163ad[_0xe6dc('0x30')][_0xe6dc('0x38')]);_0x390701[_0xe6dc('0x39')]=qs[_0xe6dc('0x3a')](_[_0xe6dc('0x54')](_0x3163ad[_0xe6dc('0x30')],_0x5f3381[_0xe6dc('0x3a')]));if(_0x3163ad[_0xe6dc('0x30')][_0xe6dc('0x3d')]){_0x390701[_0xe6dc('0x39')]=_['merge'](_0x390701[_0xe6dc('0x39')],{'$or':_[_0xe6dc('0x2c')](_0x390701[_0xe6dc('0x32')],function(_0x24fda4){var _0x537501={};_0x537501[_0x24fda4]={'$like':'%'+_0x3163ad[_0xe6dc('0x30')]['filter']+'%'};return _0x537501;})});}_0x390701=_[_0xe6dc('0x3b')]({},_0x390701,_0x3163ad[_0xe6dc('0x46')]);return _0x1c0956['getTeams'](_0x390701);}})[_0xe6dc('0x22')](function(_0x520171){if(_0x520171){_0x31f7a0=_0x520171[_0xe6dc('0x35')];if(!_0x3163ad[_0xe6dc('0x30')][_0xe6dc('0x36')]('nolimit')){_0x390701[_0xe6dc('0x1d')]=qs[_0xe6dc('0x1d')](_0x3163ad[_0xe6dc('0x30')]['limit']);_0x390701[_0xe6dc('0x1c')]=qs['offset'](_0x3163ad[_0xe6dc('0x30')][_0xe6dc('0x1c')]);}return _0x1c0956[_0xe6dc('0x61')](_0x390701);}})[_0xe6dc('0x22')](function(_0x2eeea1){if(_0x2eeea1){return _0x2eeea1?{'count':_0x31f7a0,'rows':_0x2eeea1}:null;}})[_0xe6dc('0x22')](respondWithResult(_0x22ed85,null))[_0xe6dc('0x42')](handleError(_0x22ed85,null));};exports['addTeams']=function(_0x4fe4b2,_0x5f5ead,_0x7dba0){var _0x11a418=_0x4fe4b2[_0xe6dc('0x49')][_0xe6dc('0x62')];return db[_0xe6dc('0x63')][_0xe6dc('0x40')]({'where':{'id':_0x11a418},'attributes':['id'],'include':[{'model':db['User'],'as':_0xe6dc('0x64'),'attributes':['id',_0xe6dc('0x29'),'online',_0xe6dc('0x65'),_0xe6dc('0x66')],'raw':!![]}]})['then'](function(_0x5a56d2){if(_0x5a56d2){var _0x53f9a1=_[_0xe6dc('0x67')](_0x5a56d2,function(_0x3561fc){var _0x58377e=_0x3561fc[_0xe6dc('0x23')]({'plain':!![]});return _0x58377e['Agents'];});return db[_0xe6dc('0x3e')]['find']({'where':{'id':_0x4fe4b2[_0xe6dc('0x43')]['id']}})['then'](function(_0x433fda){return db['sequelize'][_0xe6dc('0x68')](function(_0x4d5b2c){return _0x433fda[_0xe6dc('0x69')](_0x11a418,{'transaction':_0x4d5b2c})[_0xe6dc('0x22')](function(){return BPromise[_0xe6dc('0x6a')](_0x53f9a1,function(_0x5339d0){return db['UserOpenchannelQueue'][_0xe6dc('0x6b')]({'where':{'UserId':_0x5339d0['id'],'OpenchannelQueueId':_0x4fe4b2[_0xe6dc('0x43')]['id']},'transaction':_0x4d5b2c});});})['then'](function(){_0x53f9a1['forEach'](function(_0x54cd48){socket['emit'](_0xe6dc('0x6c'),{'UserId':_0x54cd48['id'],'OpenchannelQueueId':_0x433fda['id']});});});});});}})[_0xe6dc('0x22')](respondWithStatusCode(_0x5f5ead,null))['catch'](handleError(_0x5f5ead,null));};exports[_0xe6dc('0x6d')]=function(_0x38e148,_0x2dbecd,_0x31b136){return db['Team'][_0xe6dc('0x40')]({'where':{'id':_0x38e148[_0xe6dc('0x30')][_0xe6dc('0x62')]},'attributes':['id'],'include':[{'model':db[_0xe6dc('0x56')],'as':_0xe6dc('0x64'),'attributes':['id'],'raw':!![]}]})[_0xe6dc('0x22')](handleEntityNotFound(_0x2dbecd,null))[_0xe6dc('0x22')](function(_0x500423){var _0x2128af=_[_0xe6dc('0x2c')](_0x500423,'id');var _0x39c958=[];var _0x5ae472=[];var _0x36770c=squel[_0xe6dc('0x6e')]();_0x36770c[_0xe6dc('0x6f')]('tq.TeamId')[_0xe6dc('0x70')](_0xe6dc('0x71'),'tq')['join']('user_has_teams','ut',_0xe6dc('0x72'))['where'](_0xe6dc('0x73'),_0x38e148[_0xe6dc('0x43')]['id']);for(var _0x504723=0x0;_0x504723<_0x500423[_0xe6dc('0x35')];_0x504723+=0x1){let _0x516713=_0x500423[_0x504723];for(var _0x104f58=0x0;_0x104f58<_0x516713['Agents'][_0xe6dc('0x35')];_0x104f58+=0x1){let _0x5d5fc6=_0x516713[_0xe6dc('0x64')][_0x104f58];var _0x5182de=_0x36770c[_0xe6dc('0x74')]();_0x5182de['where'](_0xe6dc('0x75'),_0x5d5fc6['id']);_0x5ae472[_0xe6dc('0x76')](db[_0xe6dc('0x77')]['query'](_0x5182de['toString'](),{'type':db[_0xe6dc('0x77')][_0xe6dc('0x78')][_0xe6dc('0x79')]})['then'](function(_0x22389f){if(_0x22389f[_0xe6dc('0x35')]===0x1){return _0x5d5fc6['id'];}else{var _0x467dd0=_[_0xe6dc('0x7a')](_['map'](_0x22389f,_0xe6dc('0x7b')),function(_0x47ef86){return _[_0xe6dc('0x7c')](_0x2128af,_0x47ef86);});if(_0x467dd0){return _0x5d5fc6['id'];}}}));}}return BPromise[_0xe6dc('0x7d')](_0x5ae472)[_0xe6dc('0x22')](function(_0x348e95){_0x39c958=_(_0x39c958)[_0xe6dc('0x7e')](_0x348e95)[_0xe6dc('0x7f')]()[_0xe6dc('0x80')]();return db[_0xe6dc('0x3e')][_0xe6dc('0x47')]({'where':{'id':_0x38e148['params']['id']}})[_0xe6dc('0x22')](function(_0x37d15e){return db['sequelize'][_0xe6dc('0x68')](function(_0x21f9f4){return _0x37d15e['removeTeams'](_0x38e148['query'][_0xe6dc('0x62')],{'transaction':_0x21f9f4})['then'](function(){if(!_[_0xe6dc('0x81')](_0x39c958)){return _0x37d15e[_0xe6dc('0x82')](_0x39c958,{'transaction':_0x21f9f4});}})[_0xe6dc('0x22')](function(){_0x39c958['forEach'](function(_0x486b79){socket[_0xe6dc('0x83')]('userOpenchannelQueue:remove',{'UserId':_0x486b79,'OpenchannelQueueId':_0x37d15e['id']});});});});});});})[_0xe6dc('0x22')](respondWithStatusCode(_0x2dbecd,null))['catch'](handleError(_0x2dbecd,null));};exports[_0xe6dc('0x84')]=function(_0x162d03,_0x5dbc88,_0x3ae8cf){return db[_0xe6dc('0x3e')][_0xe6dc('0x47')]({'where':{'id':_0x162d03[_0xe6dc('0x43')]['id']}})['then'](handleEntityNotFound(_0x5dbc88,null))[_0xe6dc('0x22')](function(_0x1468b1){if(_0x1468b1){return _0x1468b1[_0xe6dc('0x84')](_0x162d03[_0xe6dc('0x49')][_0xe6dc('0x62')],_[_0xe6dc('0x85')](_0x162d03[_0xe6dc('0x49')],[_0xe6dc('0x62'),'id'])||{})[_0xe6dc('0x86')](function(_0x5533bb){for(var _0x3c4ce3=0x0;_0x3c4ce3<_0x162d03[_0xe6dc('0x49')][_0xe6dc('0x62')][_0xe6dc('0x35')];_0x3c4ce3+=0x1){socket[_0xe6dc('0x83')](_0xe6dc('0x6c'),{'UserId':_0x162d03[_0xe6dc('0x49')][_0xe6dc('0x62')][_0x3c4ce3],'OpenchannelQueueId':_0x162d03['params']['id']});}return _0x5533bb;});}})[_0xe6dc('0x22')](respondWithResult(_0x5dbc88,null))[_0xe6dc('0x42')](handleError(_0x5dbc88,null));};exports['removeAgents']=function(_0x20fe29,_0x84cd82,_0x249eab){return db[_0xe6dc('0x3e')][_0xe6dc('0x47')]({'where':{'id':_0x20fe29[_0xe6dc('0x43')]['id']}})[_0xe6dc('0x22')](handleEntityNotFound(_0x84cd82,null))['then'](function(_0x248c95){if(_0x248c95){return _0x248c95[_0xe6dc('0x82')](_0x20fe29[_0xe6dc('0x30')][_0xe6dc('0x62')])[_0xe6dc('0x22')](function(){if(_[_0xe6dc('0x87')](_0x20fe29[_0xe6dc('0x30')][_0xe6dc('0x62')])){for(var _0x4ac30c=0x0;_0x4ac30c<_0x20fe29['query'][_0xe6dc('0x62')][_0xe6dc('0x35')];_0x4ac30c+=0x1){socket[_0xe6dc('0x83')]('userOpenchannelQueue:remove',{'UserId':Number(_0x20fe29[_0xe6dc('0x30')][_0xe6dc('0x62')][_0x4ac30c]),'OpenchannelQueueId':Number(_0x20fe29[_0xe6dc('0x43')]['id'])});}}else{socket[_0xe6dc('0x83')](_0xe6dc('0x88'),{'UserId':Number(_0x20fe29[_0xe6dc('0x30')][_0xe6dc('0x62')]),'OpenchannelQueueId':Number(_0x20fe29['params']['id'])});}});}})[_0xe6dc('0x22')](respondWithStatusCode(_0x84cd82,null))[_0xe6dc('0x42')](handleError(_0x84cd82,null));};exports[_0xe6dc('0x89')]=function(_0x42df49,_0x6fad,_0x4d1270){var _0x4636c4={};var _0x38db2a={};var _0x3cf18c;var _0x19404f;return db['OpenchannelQueue'][_0xe6dc('0x60')]({'where':{'id':_0x42df49[_0xe6dc('0x43')]['id']}})['then'](handleEntityNotFound(_0x6fad,null))[_0xe6dc('0x22')](function(_0x3c9560){if(_0x3c9560){_0x3cf18c=_0x3c9560;_0x38db2a['model']=_[_0xe6dc('0x44')](db[_0xe6dc('0x56')]['rawAttributes']);_0x38db2a[_0xe6dc('0x30')]=_[_0xe6dc('0x44')](_0x42df49[_0xe6dc('0x30')]);_0x38db2a[_0xe6dc('0x3a')]=_['intersection'](_0x38db2a[_0xe6dc('0x33')],_0x38db2a['query']);_0x4636c4[_0xe6dc('0x32')]=_[_0xe6dc('0x31')](_0x38db2a[_0xe6dc('0x33')],qs['fields'](_0x42df49[_0xe6dc('0x30')][_0xe6dc('0x34')]));_0x4636c4[_0xe6dc('0x32')]=_0x4636c4[_0xe6dc('0x32')][_0xe6dc('0x35')]?_0x4636c4[_0xe6dc('0x32')]:_0x38db2a[_0xe6dc('0x33')];_0x4636c4[_0xe6dc('0x8a')]=qs[_0xe6dc('0x38')](_0x42df49[_0xe6dc('0x30')][_0xe6dc('0x38')]);_0x4636c4['where']=qs[_0xe6dc('0x3a')](_[_0xe6dc('0x54')](_0x42df49['query'],_0x38db2a[_0xe6dc('0x3a')]));if(_0x42df49['query'][_0xe6dc('0x3d')]){_0x4636c4['where']=_['merge'](_0x4636c4[_0xe6dc('0x39')],{'$or':_[_0xe6dc('0x2c')](_0x4636c4['attributes'],function(_0x51786a){var _0xcd8b71={};_0xcd8b71[_0x51786a]={'$like':'%'+_0x42df49['query'][_0xe6dc('0x3d')]+'%'};return _0xcd8b71;})});}_0x4636c4=_[_0xe6dc('0x3b')]({},_0x4636c4,_0x42df49[_0xe6dc('0x46')]);return _0x3cf18c[_0xe6dc('0x89')](_0x4636c4);}})[_0xe6dc('0x22')](function(_0x33f257){if(_0x33f257){_0x19404f=_0x33f257['length'];if(!_0x42df49[_0xe6dc('0x30')][_0xe6dc('0x36')](_0xe6dc('0x37'))){_0x4636c4[_0xe6dc('0x1d')]=qs[_0xe6dc('0x1d')](_0x42df49[_0xe6dc('0x30')][_0xe6dc('0x1d')]);_0x4636c4[_0xe6dc('0x1c')]=qs[_0xe6dc('0x1c')](_0x42df49['query'][_0xe6dc('0x1c')]);}return _0x3cf18c[_0xe6dc('0x89')](_0x4636c4);}})['then'](function(_0x4fa1cd){if(_0x4fa1cd){return _0x4fa1cd?{'count':_0x19404f,'rows':_0x4fa1cd}:null;}})[_0xe6dc('0x22')](respondWithResult(_0x6fad,null))['catch'](handleError(_0x6fad,null));}; \ No newline at end of file +var _0x7583=['bluebird','mustache','util','path','to-csv','ejs','lodash','squel','crypto','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../mysqldb','redis','register','sendStatus','status','end','json','count','offset','limit','apply','reject','save','update','then','destroy','get','OpenchannelQueues','UserProfileResource','error','name','send','index','map','OpenchannelQueue','rawAttributes','fieldName','key','query','filters','model','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','type','options','includeAll','include','findAll','rows','catch','show','params','keys','intersection','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','order','OpenchannelQueueId','UserOpenchannelQueue','User','findAndCountAll','UserId','agent','openchannelPause','updatedAt','createdAt','format','SIP','getTeams','Team','addTeams','ids','Agents','voicePause','flatMap','sequelize','transaction','findOrCreate','forEach','emit','userOpenchannelQueue:save','removeTeams','select','field','tq.TeamId','from','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','OpenchannelQueueId\x20=\x20?','ut.UserId\x20=\x20?','push','toString','QueryTypes','SELECT','includes','all','union','compact','value','userOpenchannelQueue:remove','addAgents','omit','spread','removeAgents','getAgents','html-pdf','eml-format','fast-json-patch','request-promise','moment'];(function(_0x1c394f,_0x29ee09){var _0x3201ec=function(_0x1f6f8a){while(--_0x1f6f8a){_0x1c394f['push'](_0x1c394f['shift']());}};_0x3201ec(++_0x29ee09);}(_0x7583,0x10b));var _0x3758=function(_0xeb6f8d,_0x1138f1){_0xeb6f8d=_0xeb6f8d-0x0;var _0x41f045=_0x7583[_0xeb6f8d];return _0x41f045;};'use strict';var pdf=require(_0x3758('0x0'));var emlformat=require(_0x3758('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x3758('0x2'));var rp=require(_0x3758('0x3'));var moment=require(_0x3758('0x4'));var BPromise=require(_0x3758('0x5'));var Mustache=require(_0x3758('0x6'));var util=require(_0x3758('0x7'));var path=require(_0x3758('0x8'));var sox=require('sox');var csv=require(_0x3758('0x9'));var ejs=require(_0x3758('0xa'));var fs=require('fs');var _=require(_0x3758('0xb'));var squel=require(_0x3758('0xc'));var crypto=require(_0x3758('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x3758('0xe'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x3758('0xf'));var qs=require(_0x3758('0x10'));var as=require(_0x3758('0x11'));var hardwareService=require(_0x3758('0x12'));var logger=require('../../config/logger')('api');var utils=require(_0x3758('0x13'));var config=require(_0x3758('0x14'));var db=require(_0x3758('0x15'))['db'];config[_0x3758('0x16')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require('./openchannelQueue.socket')[_0x3758('0x17')](socket);function respondWithStatusCode(_0x40a978,_0x48fa1d){_0x48fa1d=_0x48fa1d||0xcc;return function(_0x5846eb){if(_0x5846eb){return _0x40a978[_0x3758('0x18')](_0x48fa1d);}return _0x40a978[_0x3758('0x19')](_0x48fa1d)[_0x3758('0x1a')]();};}function respondWithResult(_0x22151e,_0x461137){_0x461137=_0x461137||0xc8;return function(_0x23319d){if(_0x23319d){return _0x22151e[_0x3758('0x19')](_0x461137)[_0x3758('0x1b')](_0x23319d);}};}function respondWithFilteredResult(_0x43257e,_0x489fbb){return function(_0x5d686b){if(_0x5d686b){var _0x13dcbf=_0x5d686b[_0x3758('0x1c')],_0x42a513=_0x489fbb[_0x3758('0x1d')],_0x1da660=_0x489fbb[_0x3758('0x1d')]+_0x489fbb[_0x3758('0x1e')],_0x3a72a2;if(_0x1da660>=_0x13dcbf){_0x1da660=_0x13dcbf;_0x3a72a2=0xc8;}else{_0x3a72a2=0xce;}_0x43257e[_0x3758('0x19')](_0x3a72a2);return _0x43257e['set']('Content-Range',_0x42a513+'-'+_0x1da660+'/'+_0x13dcbf)[_0x3758('0x1b')](_0x5d686b);}return null;};}function patchUpdates(_0x1f00a2){return function(_0x1b1a7d){try{jsonpatch[_0x3758('0x1f')](_0x1b1a7d,_0x1f00a2,!![]);}catch(_0x4821a0){return BPromise[_0x3758('0x20')](_0x4821a0);}return _0x1b1a7d[_0x3758('0x21')]();};}function saveUpdates(_0x3bb2fa,_0x527a4f){return function(_0x32f13c){if(_0x32f13c){return _0x32f13c[_0x3758('0x22')](_0x3bb2fa)[_0x3758('0x23')](function(_0x2a65f0){return _0x2a65f0;});}return null;};}function removeEntity(_0x34c9c8,_0x3c27fe){return function(_0x4edc1f){if(_0x4edc1f){return _0x4edc1f[_0x3758('0x24')]()[_0x3758('0x23')](function(){var _0x5a58e5=_0x4edc1f[_0x3758('0x25')]({'plain':!![]});var _0x2988cd=_0x3758('0x26');return db[_0x3758('0x27')][_0x3758('0x24')]({'where':{'type':_0x2988cd,'resourceId':_0x5a58e5['id']}})[_0x3758('0x23')](function(){return _0x4edc1f;});})[_0x3758('0x23')](function(){_0x34c9c8[_0x3758('0x19')](0xcc)[_0x3758('0x1a')]();});}};}function handleEntityNotFound(_0x5bc094,_0x5b9378){return function(_0x38aca3){if(!_0x38aca3){_0x5bc094[_0x3758('0x18')](0x194);}return _0x38aca3;};}function handleError(_0x111baa,_0x254000){_0x254000=_0x254000||0x1f4;return function(_0x94ab9f){logger[_0x3758('0x28')](_0x94ab9f['stack']);if(_0x94ab9f[_0x3758('0x29')]){delete _0x94ab9f[_0x3758('0x29')];}_0x111baa['status'](_0x254000)[_0x3758('0x2a')](_0x94ab9f);};}exports[_0x3758('0x2b')]=function(_0x326567,_0x1111f6){var _0x2eae18={},_0x491ced={},_0x505958={'count':0x0,'rows':[]};var _0x4c680a=_[_0x3758('0x2c')](db[_0x3758('0x2d')][_0x3758('0x2e')],function(_0x43f74b){return{'name':_0x43f74b[_0x3758('0x2f')],'type':_0x43f74b['type'][_0x3758('0x30')]};});_0x491ced['model']=_[_0x3758('0x2c')](_0x4c680a,_0x3758('0x29'));_0x491ced[_0x3758('0x31')]=_['keys'](_0x326567[_0x3758('0x31')]);_0x491ced[_0x3758('0x32')]=_['intersection'](_0x491ced[_0x3758('0x33')],_0x491ced[_0x3758('0x31')]);_0x2eae18[_0x3758('0x34')]=_['intersection'](_0x491ced[_0x3758('0x33')],qs[_0x3758('0x35')](_0x326567[_0x3758('0x31')][_0x3758('0x35')]));_0x2eae18['attributes']=_0x2eae18[_0x3758('0x34')][_0x3758('0x36')]?_0x2eae18[_0x3758('0x34')]:_0x491ced[_0x3758('0x33')];if(!_0x326567[_0x3758('0x31')][_0x3758('0x37')](_0x3758('0x38'))){_0x2eae18['limit']=qs[_0x3758('0x1e')](_0x326567[_0x3758('0x31')][_0x3758('0x1e')]);_0x2eae18[_0x3758('0x1d')]=qs['offset'](_0x326567[_0x3758('0x31')][_0x3758('0x1d')]);}_0x2eae18['order']=qs[_0x3758('0x39')](_0x326567[_0x3758('0x31')][_0x3758('0x39')]);_0x2eae18[_0x3758('0x3a')]=qs[_0x3758('0x32')](_[_0x3758('0x3b')](_0x326567[_0x3758('0x31')],_0x491ced[_0x3758('0x32')]),_0x4c680a);if(_0x326567[_0x3758('0x31')][_0x3758('0x3c')]){_0x2eae18[_0x3758('0x3a')]=_[_0x3758('0x3d')](_0x2eae18[_0x3758('0x3a')],{'$or':_[_0x3758('0x2c')](_0x4c680a,function(_0xdd7815){if(_0xdd7815[_0x3758('0x3e')]!=='VIRTUAL'){var _0x137762={};_0x137762[_0xdd7815[_0x3758('0x29')]]={'$like':'%'+_0x326567[_0x3758('0x31')][_0x3758('0x3c')]+'%'};return _0x137762;}})});}_0x2eae18=_[_0x3758('0x3d')]({},_0x2eae18,_0x326567[_0x3758('0x3f')]);var _0x4e5438={'where':_0x2eae18[_0x3758('0x3a')]};return db[_0x3758('0x2d')][_0x3758('0x1c')](_0x4e5438)[_0x3758('0x23')](function(_0x1aaeaa){_0x505958[_0x3758('0x1c')]=_0x1aaeaa;if(_0x326567[_0x3758('0x31')][_0x3758('0x40')]){_0x2eae18[_0x3758('0x41')]=[{'all':!![]}];}return db[_0x3758('0x2d')][_0x3758('0x42')](_0x2eae18);})[_0x3758('0x23')](function(_0x41e6a9){_0x505958[_0x3758('0x43')]=_0x41e6a9;return _0x505958;})[_0x3758('0x23')](respondWithFilteredResult(_0x1111f6,_0x2eae18))[_0x3758('0x44')](handleError(_0x1111f6,null));};exports[_0x3758('0x45')]=function(_0xb04e3a,_0x44d5be){var _0xaccc67={'raw':!![],'where':{'id':_0xb04e3a[_0x3758('0x46')]['id']}},_0x3b90ab={};_0x3b90ab['model']=_[_0x3758('0x47')](db[_0x3758('0x2d')][_0x3758('0x2e')]);_0x3b90ab[_0x3758('0x31')]=_['keys'](_0xb04e3a[_0x3758('0x31')]);_0x3b90ab[_0x3758('0x32')]=_[_0x3758('0x48')](_0x3b90ab[_0x3758('0x33')],_0x3b90ab[_0x3758('0x31')]);_0xaccc67['attributes']=_['intersection'](_0x3b90ab[_0x3758('0x33')],qs[_0x3758('0x35')](_0xb04e3a[_0x3758('0x31')][_0x3758('0x35')]));_0xaccc67['attributes']=_0xaccc67['attributes']['length']?_0xaccc67['attributes']:_0x3b90ab[_0x3758('0x33')];if(_0xb04e3a[_0x3758('0x31')][_0x3758('0x40')]){_0xaccc67['include']=[{'all':!![]}];}_0xaccc67=_[_0x3758('0x3d')]({},_0xaccc67,_0xb04e3a[_0x3758('0x3f')]);return db['OpenchannelQueue'][_0x3758('0x49')](_0xaccc67)[_0x3758('0x23')](handleEntityNotFound(_0x44d5be,null))[_0x3758('0x23')](respondWithResult(_0x44d5be,null))['catch'](handleError(_0x44d5be,null));};exports[_0x3758('0x4a')]=function(_0x42b313,_0x2c46f8){return db[_0x3758('0x2d')]['create'](_0x42b313[_0x3758('0x4b')],{})[_0x3758('0x23')](function(_0x489bac){var _0xa55023=_0x42b313['user'][_0x3758('0x25')]({'plain':!![]});if(!_0xa55023)throw new Error(_0x3758('0x4c'));if(_0xa55023[_0x3758('0x4d')]===_0x3758('0x4e')){var _0x222185=_0x489bac[_0x3758('0x25')]({'plain':!![]});var _0x1f3363=_0x3758('0x26');return db[_0x3758('0x4f')][_0x3758('0x49')]({'where':{'name':_0x1f3363,'userProfileId':_0xa55023[_0x3758('0x50')]},'raw':!![]})[_0x3758('0x23')](function(_0x437efb){if(_0x437efb&&_0x437efb[_0x3758('0x51')]===0x0){return db[_0x3758('0x27')]['create']({'name':_0x222185[_0x3758('0x29')],'resourceId':_0x222185['id'],'type':_0x437efb[_0x3758('0x29')],'sectionId':_0x437efb['id']},{})['then'](function(){return _0x489bac;});}else{return _0x489bac;}})['catch'](function(_0x39c6ce){logger[_0x3758('0x28')](_0x3758('0x52'),_0x39c6ce);throw _0x39c6ce;});}return _0x489bac;})[_0x3758('0x23')](respondWithResult(_0x2c46f8,0xc9))[_0x3758('0x44')](handleError(_0x2c46f8,null));};exports[_0x3758('0x22')]=function(_0x4cbb07,_0x435a54){if(_0x4cbb07[_0x3758('0x4b')]['id']){delete _0x4cbb07[_0x3758('0x4b')]['id'];}return db[_0x3758('0x2d')][_0x3758('0x49')]({'where':{'id':_0x4cbb07[_0x3758('0x46')]['id']}})[_0x3758('0x23')](handleEntityNotFound(_0x435a54,null))['then'](saveUpdates(_0x4cbb07[_0x3758('0x4b')],null))[_0x3758('0x23')](respondWithResult(_0x435a54,null))[_0x3758('0x44')](handleError(_0x435a54,null));};exports[_0x3758('0x24')]=function(_0x31d5e1,_0xb74a45){return db[_0x3758('0x2d')][_0x3758('0x49')]({'where':{'id':_0x31d5e1[_0x3758('0x46')]['id']}})['then'](handleEntityNotFound(_0xb74a45,null))[_0x3758('0x23')](removeEntity(_0xb74a45,null))[_0x3758('0x44')](handleError(_0xb74a45,null));};exports['describe']=function(_0x599d60,_0x8ae4f7){return db[_0x3758('0x2d')][_0x3758('0x53')]()[_0x3758('0x23')](respondWithResult(_0x8ae4f7,null))['catch'](handleError(_0x8ae4f7,null));};exports[_0x3758('0x54')]=function(_0xa897f,_0x46bcca,_0x3fe9a3){var _0x141691={'raw':!![],'where':{}},_0x2f3be4={},_0x715bdd;return db[_0x3758('0x2d')][_0x3758('0x55')]({'where':{'id':_0xa897f[_0x3758('0x46')]['id']}})[_0x3758('0x23')](handleEntityNotFound(_0x46bcca,null))[_0x3758('0x23')](function(_0x6c3d4a){if(_0x6c3d4a){_0x715bdd=_0x6c3d4a[_0x3758('0x25')]({'plain':!![]});_0x2f3be4[_0x3758('0x33')]=_[_0x3758('0x47')](db['UserOpenchannelQueue'][_0x3758('0x2e')]);_0x2f3be4[_0x3758('0x31')]=_[_0x3758('0x47')](_0xa897f[_0x3758('0x31')]);_0x2f3be4[_0x3758('0x32')]=_[_0x3758('0x48')](_0x2f3be4[_0x3758('0x33')],_0x2f3be4[_0x3758('0x31')]);_0x141691[_0x3758('0x34')]=_[_0x3758('0x48')](_0x2f3be4[_0x3758('0x33')],qs[_0x3758('0x35')](_0xa897f['query'][_0x3758('0x35')]));_0x141691[_0x3758('0x34')]=_0x141691['attributes'][_0x3758('0x36')]?_0x141691[_0x3758('0x34')]:_0x2f3be4['model'];if(!_0xa897f[_0x3758('0x31')][_0x3758('0x37')](_0x3758('0x38'))){_0x141691[_0x3758('0x1e')]=qs[_0x3758('0x1e')](_0xa897f[_0x3758('0x31')]['limit']);_0x141691['offset']=qs[_0x3758('0x1d')](_0xa897f[_0x3758('0x31')][_0x3758('0x1d')]);}_0x141691[_0x3758('0x56')]=qs[_0x3758('0x39')](_0xa897f[_0x3758('0x31')][_0x3758('0x39')]);_0x141691[_0x3758('0x3a')]=qs[_0x3758('0x32')](_[_0x3758('0x3b')](_0xa897f[_0x3758('0x31')],_0x2f3be4['filters']));_0x141691['where'][_0x3758('0x57')]=_0x6c3d4a['id'];if(_0xa897f['query'][_0x3758('0x3c')]){_0x141691[_0x3758('0x3a')]=_[_0x3758('0x3d')](_0x141691[_0x3758('0x3a')],{'$or':_[_0x3758('0x2c')](_0x141691[_0x3758('0x34')],function(_0x55df90){var _0x480f37={};_0x480f37[_0x55df90]={'$like':'%'+_0xa897f['query'][_0x3758('0x3c')]+'%'};return _0x480f37;})});}_0x141691=_[_0x3758('0x3d')]({},_0x141691,_0xa897f[_0x3758('0x3f')]);return db[_0x3758('0x58')][_0x3758('0x42')](_0x141691);}})[_0x3758('0x23')](function(_0x12fcf5){if(_0x12fcf5){return db[_0x3758('0x59')][_0x3758('0x5a')]({'where':{'id':_[_0x3758('0x2c')](_0x12fcf5,_0x3758('0x5b')),'role':_0x3758('0x5c')},'attributes':['id','name',_0x3758('0x5d'),_0x3758('0x5e'),_0x3758('0x5f')]});}})[_0x3758('0x23')](function(_0x314733){if(_0x314733){return{'count':_0x314733['count'],'rows':_[_0x3758('0x2c')](_0x314733[_0x3758('0x43')],function(_0x17e567){return{'membername':_0x17e567[_0x3758('0x29')],'UserId':_0x17e567['id'],'queue_name':_0x715bdd['name'],'OpenchannelQueueId':_0x715bdd['id'],'interface':util[_0x3758('0x60')]('%s/%s',_0x3758('0x61'),_0x17e567[_0x3758('0x29')]),'penalty':0x0,'paused':_0x17e567['openchannelPause'],'createdAt':_0x17e567[_0x3758('0x5f')],'updatedAt':_0x17e567['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})[_0x3758('0x23')](respondWithFilteredResult(_0x46bcca,_0x141691))[_0x3758('0x44')](handleError(_0x46bcca,null));};exports[_0x3758('0x62')]=function(_0x58ae3e,_0x5363e5,_0x16909c){var _0x439018={};var _0x49a91c={};var _0x5c2d16;var _0x16127e;return db[_0x3758('0x2d')]['findOne']({'where':{'id':_0x58ae3e[_0x3758('0x46')]['id']}})[_0x3758('0x23')](handleEntityNotFound(_0x5363e5,null))[_0x3758('0x23')](function(_0x44132e){if(_0x44132e){_0x5c2d16=_0x44132e;_0x49a91c[_0x3758('0x33')]=_['keys'](db[_0x3758('0x63')]['rawAttributes']);_0x49a91c[_0x3758('0x31')]=_[_0x3758('0x47')](_0x58ae3e[_0x3758('0x31')]);_0x49a91c[_0x3758('0x32')]=_[_0x3758('0x48')](_0x49a91c[_0x3758('0x33')],_0x49a91c[_0x3758('0x31')]);_0x439018[_0x3758('0x34')]=_['intersection'](_0x49a91c[_0x3758('0x33')],qs['fields'](_0x58ae3e['query'][_0x3758('0x35')]));_0x439018[_0x3758('0x34')]=_0x439018[_0x3758('0x34')][_0x3758('0x36')]?_0x439018[_0x3758('0x34')]:_0x49a91c[_0x3758('0x33')];_0x439018['order']=qs[_0x3758('0x39')](_0x58ae3e['query'][_0x3758('0x39')]);_0x439018['where']=qs[_0x3758('0x32')](_[_0x3758('0x3b')](_0x58ae3e[_0x3758('0x31')],_0x49a91c['filters']));if(_0x58ae3e[_0x3758('0x31')]['filter']){_0x439018[_0x3758('0x3a')]=_[_0x3758('0x3d')](_0x439018[_0x3758('0x3a')],{'$or':_[_0x3758('0x2c')](_0x439018[_0x3758('0x34')],function(_0x3f2fc1){var _0x51beb8={};_0x51beb8[_0x3f2fc1]={'$like':'%'+_0x58ae3e[_0x3758('0x31')]['filter']+'%'};return _0x51beb8;})});}_0x439018=_[_0x3758('0x3d')]({},_0x439018,_0x58ae3e[_0x3758('0x3f')]);return _0x5c2d16[_0x3758('0x62')](_0x439018);}})[_0x3758('0x23')](function(_0x3265c9){if(_0x3265c9){_0x16127e=_0x3265c9[_0x3758('0x36')];if(!_0x58ae3e[_0x3758('0x31')]['hasOwnProperty'](_0x3758('0x38'))){_0x439018[_0x3758('0x1e')]=qs[_0x3758('0x1e')](_0x58ae3e[_0x3758('0x31')][_0x3758('0x1e')]);_0x439018['offset']=qs['offset'](_0x58ae3e[_0x3758('0x31')][_0x3758('0x1d')]);}return _0x5c2d16[_0x3758('0x62')](_0x439018);}})[_0x3758('0x23')](function(_0x14667c){if(_0x14667c){return _0x14667c?{'count':_0x16127e,'rows':_0x14667c}:null;}})[_0x3758('0x23')](respondWithResult(_0x5363e5,null))[_0x3758('0x44')](handleError(_0x5363e5,null));};exports[_0x3758('0x64')]=function(_0x2716ac,_0x1cfb08,_0x26ccb4){var _0x2a4c2a=_0x2716ac[_0x3758('0x4b')][_0x3758('0x65')];return db[_0x3758('0x63')]['findAll']({'where':{'id':_0x2a4c2a},'attributes':['id'],'include':[{'model':db[_0x3758('0x59')],'as':_0x3758('0x66'),'attributes':['id',_0x3758('0x29'),'online',_0x3758('0x67'),'interface'],'raw':!![]}]})[_0x3758('0x23')](function(_0x369cbb){if(_0x369cbb){var _0x399776=_[_0x3758('0x68')](_0x369cbb,function(_0x2097c0){var _0x9c4f4=_0x2097c0[_0x3758('0x25')]({'plain':!![]});return _0x9c4f4['Agents'];});return db[_0x3758('0x2d')]['find']({'where':{'id':_0x2716ac['params']['id']}})[_0x3758('0x23')](function(_0x482c28){return db[_0x3758('0x69')][_0x3758('0x6a')](function(_0x47b326){return _0x482c28[_0x3758('0x64')](_0x2a4c2a,{'transaction':_0x47b326})[_0x3758('0x23')](function(){return BPromise['each'](_0x399776,function(_0x30f3cf){return db[_0x3758('0x58')][_0x3758('0x6b')]({'where':{'UserId':_0x30f3cf['id'],'OpenchannelQueueId':_0x2716ac[_0x3758('0x46')]['id']},'transaction':_0x47b326});});})[_0x3758('0x23')](function(){_0x399776[_0x3758('0x6c')](function(_0x6ca76b){socket[_0x3758('0x6d')](_0x3758('0x6e'),{'UserId':_0x6ca76b['id'],'OpenchannelQueueId':_0x482c28['id']});});});});});}})['then'](respondWithStatusCode(_0x1cfb08,null))[_0x3758('0x44')](handleError(_0x1cfb08,null));};exports[_0x3758('0x6f')]=function(_0xe18c67,_0x490168,_0x7ea5eb){return db[_0x3758('0x63')][_0x3758('0x42')]({'where':{'id':_0xe18c67['query'][_0x3758('0x65')]},'attributes':['id'],'include':[{'model':db[_0x3758('0x59')],'as':_0x3758('0x66'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x490168,null))[_0x3758('0x23')](function(_0x25dc07){var _0xc8a0ef=_[_0x3758('0x2c')](_0x25dc07,'id');var _0x24e0d2=[];var _0x3b40df=[];var _0x125411=squel[_0x3758('0x70')]();_0x125411[_0x3758('0x71')](_0x3758('0x72'))[_0x3758('0x73')]('team_has_openchannel_queues','tq')[_0x3758('0x74')](_0x3758('0x75'),'ut',_0x3758('0x76'))[_0x3758('0x3a')](_0x3758('0x77'),_0xe18c67['params']['id']);for(var _0x184cea=0x0;_0x184cea<_0x25dc07[_0x3758('0x36')];_0x184cea+=0x1){let _0x35c7f9=_0x25dc07[_0x184cea];for(var _0x53d7c9=0x0;_0x53d7c9<_0x35c7f9[_0x3758('0x66')][_0x3758('0x36')];_0x53d7c9+=0x1){let _0x25b070=_0x35c7f9[_0x3758('0x66')][_0x53d7c9];var _0x25c360=_0x125411['clone']();_0x25c360[_0x3758('0x3a')](_0x3758('0x78'),_0x25b070['id']);_0x3b40df[_0x3758('0x79')](db['sequelize'][_0x3758('0x31')](_0x25c360[_0x3758('0x7a')](),{'type':db[_0x3758('0x69')][_0x3758('0x7b')][_0x3758('0x7c')]})['then'](function(_0x2d1fba){if(_0x2d1fba[_0x3758('0x36')]===0x1){return _0x25b070['id'];}else{var _0x32837a=_['every'](_[_0x3758('0x2c')](_0x2d1fba,'TeamId'),function(_0x20ea15){return _[_0x3758('0x7d')](_0xc8a0ef,_0x20ea15);});if(_0x32837a){return _0x25b070['id'];}}}));}}return BPromise[_0x3758('0x7e')](_0x3b40df)[_0x3758('0x23')](function(_0x325d84){_0x24e0d2=_(_0x24e0d2)[_0x3758('0x7f')](_0x325d84)[_0x3758('0x80')]()[_0x3758('0x81')]();return db[_0x3758('0x2d')][_0x3758('0x49')]({'where':{'id':_0xe18c67[_0x3758('0x46')]['id']}})['then'](function(_0x2562f4){return db['sequelize'][_0x3758('0x6a')](function(_0x407ab6){return _0x2562f4[_0x3758('0x6f')](_0xe18c67[_0x3758('0x31')]['ids'],{'transaction':_0x407ab6})['then'](function(){if(!_['isEmpty'](_0x24e0d2)){return _0x2562f4['removeAgents'](_0x24e0d2,{'transaction':_0x407ab6});}})[_0x3758('0x23')](function(){_0x24e0d2['forEach'](function(_0x17ba7e){socket['emit'](_0x3758('0x82'),{'UserId':_0x17ba7e,'OpenchannelQueueId':_0x2562f4['id']});});});});});});})[_0x3758('0x23')](respondWithStatusCode(_0x490168,null))[_0x3758('0x44')](handleError(_0x490168,null));};exports['addAgents']=function(_0x2baf9c,_0x2cd178,_0x406de2){return db[_0x3758('0x2d')][_0x3758('0x49')]({'where':{'id':_0x2baf9c[_0x3758('0x46')]['id']}})[_0x3758('0x23')](handleEntityNotFound(_0x2cd178,null))['then'](function(_0x54ff4d){if(_0x54ff4d){return _0x54ff4d[_0x3758('0x83')](_0x2baf9c['body'][_0x3758('0x65')],_[_0x3758('0x84')](_0x2baf9c[_0x3758('0x4b')],[_0x3758('0x65'),'id'])||{})[_0x3758('0x85')](function(_0x314349){for(var _0x549d8c=0x0;_0x549d8c<_0x2baf9c[_0x3758('0x4b')][_0x3758('0x65')]['length'];_0x549d8c+=0x1){socket[_0x3758('0x6d')](_0x3758('0x6e'),{'UserId':_0x2baf9c[_0x3758('0x4b')]['ids'][_0x549d8c],'OpenchannelQueueId':_0x2baf9c[_0x3758('0x46')]['id']});}return _0x314349;});}})['then'](respondWithResult(_0x2cd178,null))['catch'](handleError(_0x2cd178,null));};exports[_0x3758('0x86')]=function(_0x693caf,_0x3db866,_0x257338){return db[_0x3758('0x2d')][_0x3758('0x49')]({'where':{'id':_0x693caf['params']['id']}})[_0x3758('0x23')](handleEntityNotFound(_0x3db866,null))[_0x3758('0x23')](function(_0x299fdc){if(_0x299fdc){return _0x299fdc[_0x3758('0x86')](_0x693caf[_0x3758('0x31')][_0x3758('0x65')])['then'](function(){if(_['isArray'](_0x693caf[_0x3758('0x31')][_0x3758('0x65')])){for(var _0x57fb75=0x0;_0x57fb75<_0x693caf[_0x3758('0x31')][_0x3758('0x65')][_0x3758('0x36')];_0x57fb75+=0x1){socket['emit'](_0x3758('0x82'),{'UserId':Number(_0x693caf['query'][_0x3758('0x65')][_0x57fb75]),'OpenchannelQueueId':Number(_0x693caf['params']['id'])});}}else{socket[_0x3758('0x6d')](_0x3758('0x82'),{'UserId':Number(_0x693caf[_0x3758('0x31')][_0x3758('0x65')]),'OpenchannelQueueId':Number(_0x693caf['params']['id'])});}});}})[_0x3758('0x23')](respondWithStatusCode(_0x3db866,null))[_0x3758('0x44')](handleError(_0x3db866,null));};exports['getAgents']=function(_0x1809dc,_0x14d251,_0x39c0f6){var _0x3e5b0a={};var _0x2b350f={};var _0x2a1d39;var _0x43da2d;return db[_0x3758('0x2d')][_0x3758('0x55')]({'where':{'id':_0x1809dc[_0x3758('0x46')]['id']}})[_0x3758('0x23')](handleEntityNotFound(_0x14d251,null))[_0x3758('0x23')](function(_0xf7d082){if(_0xf7d082){_0x2a1d39=_0xf7d082;_0x2b350f[_0x3758('0x33')]=_[_0x3758('0x47')](db[_0x3758('0x59')][_0x3758('0x2e')]);_0x2b350f[_0x3758('0x31')]=_[_0x3758('0x47')](_0x1809dc[_0x3758('0x31')]);_0x2b350f['filters']=_[_0x3758('0x48')](_0x2b350f[_0x3758('0x33')],_0x2b350f[_0x3758('0x31')]);_0x3e5b0a['attributes']=_['intersection'](_0x2b350f['model'],qs[_0x3758('0x35')](_0x1809dc['query'][_0x3758('0x35')]));_0x3e5b0a[_0x3758('0x34')]=_0x3e5b0a['attributes'][_0x3758('0x36')]?_0x3e5b0a['attributes']:_0x2b350f[_0x3758('0x33')];_0x3e5b0a[_0x3758('0x56')]=qs['sort'](_0x1809dc['query'][_0x3758('0x39')]);_0x3e5b0a[_0x3758('0x3a')]=qs[_0x3758('0x32')](_[_0x3758('0x3b')](_0x1809dc[_0x3758('0x31')],_0x2b350f[_0x3758('0x32')]));if(_0x1809dc[_0x3758('0x31')][_0x3758('0x3c')]){_0x3e5b0a[_0x3758('0x3a')]=_[_0x3758('0x3d')](_0x3e5b0a[_0x3758('0x3a')],{'$or':_[_0x3758('0x2c')](_0x3e5b0a[_0x3758('0x34')],function(_0x52412c){var _0x5aad07={};_0x5aad07[_0x52412c]={'$like':'%'+_0x1809dc[_0x3758('0x31')][_0x3758('0x3c')]+'%'};return _0x5aad07;})});}_0x3e5b0a=_['merge']({},_0x3e5b0a,_0x1809dc[_0x3758('0x3f')]);return _0x2a1d39[_0x3758('0x87')](_0x3e5b0a);}})[_0x3758('0x23')](function(_0x592d84){if(_0x592d84){_0x43da2d=_0x592d84[_0x3758('0x36')];if(!_0x1809dc[_0x3758('0x31')][_0x3758('0x37')](_0x3758('0x38'))){_0x3e5b0a[_0x3758('0x1e')]=qs['limit'](_0x1809dc[_0x3758('0x31')][_0x3758('0x1e')]);_0x3e5b0a[_0x3758('0x1d')]=qs['offset'](_0x1809dc[_0x3758('0x31')][_0x3758('0x1d')]);}return _0x2a1d39[_0x3758('0x87')](_0x3e5b0a);}})[_0x3758('0x23')](function(_0x1b59d5){if(_0x1b59d5){return _0x1b59d5?{'count':_0x43da2d,'rows':_0x1b59d5}:null;}})['then'](respondWithResult(_0x14d251,null))[_0x3758('0x44')](handleError(_0x14d251,null));}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.events.js b/server/api/openchannelQueue/openchannelQueue.events.js index 1300511..5be661c 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 _0x4655=['../../mysqldb','remove','emit','hasOwnProperty','exports','events'];(function(_0x67d85f,_0x69b720){var _0x28f25b=function(_0x19a901){while(--_0x19a901){_0x67d85f['push'](_0x67d85f['shift']());}};_0x28f25b(++_0x69b720);}(_0x4655,0xb9));var _0x5465=function(_0x36a4a8,_0xbba787){_0x36a4a8=_0x36a4a8-0x0;var _0x5ac451=_0x4655[_0x36a4a8];return _0x5ac451;};'use strict';var EventEmitter=require(_0x5465('0x0'));var OpenchannelQueue=require(_0x5465('0x1'))['db']['OpenchannelQueue'];var OpenchannelQueueEvents=new EventEmitter();OpenchannelQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0x5465('0x2')};function emitEvent(_0x2b247b){return function(_0x38bb21,_0x422438,_0x21f04b){OpenchannelQueueEvents[_0x5465('0x3')](_0x2b247b+':'+_0x38bb21['id'],_0x38bb21);OpenchannelQueueEvents[_0x5465('0x3')](_0x2b247b,_0x38bb21);_0x21f04b(null);};}for(var e in events){if(events[_0x5465('0x4')](e)){var event=events[e];OpenchannelQueue['hook'](e,emitEvent(event));}}module[_0x5465('0x5')]=OpenchannelQueueEvents; \ No newline at end of file +var _0xadf0=['remove','emit','hasOwnProperty','hook','exports','events','OpenchannelQueue','setMaxListeners','save','update'];(function(_0x14be10,_0x1afc0d){var _0x422f43=function(_0xde343c){while(--_0xde343c){_0x14be10['push'](_0x14be10['shift']());}};_0x422f43(++_0x1afc0d);}(_0xadf0,0x109));var _0x0adf=function(_0x344126,_0x3d18bc){_0x344126=_0x344126-0x0;var _0x50529e=_0xadf0[_0x344126];return _0x50529e;};'use strict';var EventEmitter=require(_0x0adf('0x0'));var OpenchannelQueue=require('../../mysqldb')['db'][_0x0adf('0x1')];var OpenchannelQueueEvents=new EventEmitter();OpenchannelQueueEvents[_0x0adf('0x2')](0x0);var events={'afterCreate':_0x0adf('0x3'),'afterUpdate':_0x0adf('0x4'),'afterDestroy':_0x0adf('0x5')};function emitEvent(_0x13a138){return function(_0x14052e,_0x35d64c,_0x593018){OpenchannelQueueEvents[_0x0adf('0x6')](_0x13a138+':'+_0x14052e['id'],_0x14052e);OpenchannelQueueEvents[_0x0adf('0x6')](_0x13a138,_0x14052e);_0x593018(null);};}for(var e in events){if(events[_0x0adf('0x7')](e)){var event=events[e];OpenchannelQueue[_0x0adf('0x8')](e,emitEvent(event));}}module[_0x0adf('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 b3259e0..dbdac80 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 _0xaae4=['util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./openchannelQueue.attributes','exports','define','openchannel_queues','lodash'];(function(_0x29e871,_0x330b98){var _0x3380e3=function(_0x26eeae){while(--_0x26eeae){_0x29e871['push'](_0x29e871['shift']());}};_0x3380e3(++_0x330b98);}(_0xaae4,0xc2));var _0x4aae=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0xaae4[_0x3ab51d];return _0x29a04e;};'use strict';var _=require(_0x4aae('0x0'));var util=require(_0x4aae('0x1'));var logger=require('../../config/logger')(_0x4aae('0x2'));var moment=require(_0x4aae('0x3'));var BPromise=require(_0x4aae('0x4'));var rp=require(_0x4aae('0x5'));var fs=require('fs');var path=require(_0x4aae('0x6'));var rimraf=require(_0x4aae('0x7'));var config=require(_0x4aae('0x8'));var attributes=require(_0x4aae('0x9'));module[_0x4aae('0xa')]=function(_0x4d7bcc,_0x36d360){return _0x4d7bcc[_0x4aae('0xb')]('OpenchannelQueue',attributes,{'tableName':_0x4aae('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8e49=['rimraf','./openchannelQueue.attributes','exports','define','OpenchannelQueue','openchannel_queues','lodash','util','api','moment','request-promise','path'];(function(_0x579ff2,_0x22eb5a){var _0x14e555=function(_0x5c7b12){while(--_0x5c7b12){_0x579ff2['push'](_0x579ff2['shift']());}};_0x14e555(++_0x22eb5a);}(_0x8e49,0x8a));var _0x98e4=function(_0x265e0e,_0x38b2bb){_0x265e0e=_0x265e0e-0x0;var _0x518157=_0x8e49[_0x265e0e];return _0x518157;};'use strict';var _=require(_0x98e4('0x0'));var util=require(_0x98e4('0x1'));var logger=require('../../config/logger')(_0x98e4('0x2'));var moment=require(_0x98e4('0x3'));var BPromise=require('bluebird');var rp=require(_0x98e4('0x4'));var fs=require('fs');var path=require(_0x98e4('0x5'));var rimraf=require(_0x98e4('0x6'));var config=require('../../config/environment');var attributes=require(_0x98e4('0x7'));module[_0x98e4('0x8')]=function(_0x1cb7bf,_0x50a705){return _0x1cb7bf[_0x98e4('0x9')](_0x98e4('0xa'),attributes,{'tableName':_0x98e4('0xb'),'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 25539ea..0826964 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 _0x1192=['OpenchannelQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetOpenchannelQueue','OpenchannelQueue','findAll','options','raw','where','attributes','include','map','model','ShowOpenchannelQueue','find','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','defaults','redis','localhost','socket.io-emitter','register','request','then','info','OpenchannelQueue,\x20%s,\x20%s','debug'];(function(_0x5cf04d,_0x59c7c2){var _0x543e95=function(_0x294a6f){while(--_0x294a6f){_0x5cf04d['push'](_0x5cf04d['shift']());}};_0x543e95(++_0x59c7c2);}(_0x1192,0x109));var _0x2119=function(_0x416eed,_0x3a2a24){_0x416eed=_0x416eed-0x0;var _0x325487=_0x1192[_0x416eed];return _0x325487;};'use strict';var _=require(_0x2119('0x0'));var util=require('util');var moment=require(_0x2119('0x1'));var BPromise=require(_0x2119('0x2'));var rs=require(_0x2119('0x3'));var fs=require('fs');var Redis=require(_0x2119('0x4'));var db=require(_0x2119('0x5'))['db'];var utils=require(_0x2119('0x6'));var logger=require(_0x2119('0x7'))('rpc');var config=require(_0x2119('0x8'));var jayson=require(_0x2119('0x9'));var client=jayson[_0x2119('0xa')][_0x2119('0xb')]({'port':0x232a});config['redis']=_[_0x2119('0xc')](config[_0x2119('0xd')],{'host':_0x2119('0xe'),'port':0x18eb});var socket=require(_0x2119('0xf'))(new Redis(config[_0x2119('0xd')]));require('./openchannelQueue.socket')[_0x2119('0x10')](socket);function respondWithRpcPromise(_0x3875ad,_0x2f19ed,_0x1fd40d){return new BPromise(function(_0x5757a6,_0x3c485b){return client[_0x2119('0x11')](_0x3875ad,_0x1fd40d)[_0x2119('0x12')](function(_0x1e1130){logger[_0x2119('0x13')](_0x2119('0x14'),_0x2f19ed,'request\x20sent');logger[_0x2119('0x15')](_0x2119('0x16'),_0x2f19ed,'request\x20sent',JSON[_0x2119('0x17')](_0x1e1130));if(_0x1e1130[_0x2119('0x18')]){if(_0x1e1130['error'][_0x2119('0x19')]===0x1f4){logger[_0x2119('0x18')](_0x2119('0x14'),_0x2f19ed,_0x1e1130['error'][_0x2119('0x1a')]);return _0x3c485b(_0x1e1130['error'][_0x2119('0x1a')]);}logger[_0x2119('0x18')](_0x2119('0x14'),_0x2f19ed,_0x1e1130['error'][_0x2119('0x1a')]);return _0x5757a6(_0x1e1130[_0x2119('0x18')][_0x2119('0x1a')]);}else{logger[_0x2119('0x13')]('OpenchannelQueue,\x20%s,\x20%s',_0x2f19ed,'request\x20sent');_0x5757a6(_0x1e1130[_0x2119('0x1b')]['message']);}})[_0x2119('0x1c')](function(_0x4124e1){logger[_0x2119('0x18')]('OpenchannelQueue,\x20%s,\x20%s',_0x2f19ed,_0x4124e1);_0x3c485b(_0x4124e1);});});}exports[_0x2119('0x1d')]=function(_0x3cac84){var _0x4ceb01=this;return new Promise(function(_0x419efb,_0x72c4d1){return db[_0x2119('0x1e')][_0x2119('0x1f')]({'raw':_0x3cac84['options']?_0x3cac84[_0x2119('0x20')][_0x2119('0x21')]===undefined?!![]:![]:!![],'where':_0x3cac84[_0x2119('0x20')]?_0x3cac84[_0x2119('0x20')][_0x2119('0x22')]||null:null,'attributes':_0x3cac84['options']?_0x3cac84['options']['attributes']||null:null,'limit':_0x3cac84[_0x2119('0x20')]?_0x3cac84[_0x2119('0x20')]['limit']||null:null,'include':_0x3cac84[_0x2119('0x20')]?_0x3cac84[_0x2119('0x20')]['include']?_['map'](_0x3cac84[_0x2119('0x20')]['include'],function(_0x384f62){return{'model':db[_0x384f62['model']],'as':_0x384f62['as'],'attributes':_0x384f62[_0x2119('0x23')],'include':_0x384f62[_0x2119('0x24')]?_[_0x2119('0x25')](_0x384f62[_0x2119('0x24')],function(_0x575a25){return{'model':db[_0x575a25['model']],'as':_0x575a25['as'],'attributes':_0x575a25[_0x2119('0x23')],'include':_0x575a25[_0x2119('0x24')]?_['map'](_0x575a25[_0x2119('0x24')],function(_0x427ebc){return{'model':db[_0x427ebc[_0x2119('0x26')]],'as':_0x427ebc['as'],'attributes':_0x427ebc[_0x2119('0x23')]};}):[]};}):[]};}):[]:[]})[_0x2119('0x12')](function(_0x5e8ef7){logger[_0x2119('0x13')]('GetOpenchannelQueue',_0x3cac84);logger[_0x2119('0x15')](_0x2119('0x1d'),_0x3cac84,JSON[_0x2119('0x17')](_0x5e8ef7));_0x419efb(_0x5e8ef7);})['catch'](function(_0x3ecb49){logger['error'](_0x2119('0x1d'),_0x3ecb49[_0x2119('0x1a')],_0x3cac84);_0x72c4d1(_0x4ceb01[_0x2119('0x18')](0x1f4,_0x3ecb49['message']));});});};exports[_0x2119('0x27')]=function(_0x585ea8){var _0x4cb9c9=this;return new Promise(function(_0x4cc4ad,_0x512455){return db[_0x2119('0x1e')][_0x2119('0x28')]({'raw':_0x585ea8[_0x2119('0x20')]?_0x585ea8[_0x2119('0x20')][_0x2119('0x21')]===undefined?!![]:![]:!![],'where':_0x585ea8['options']?_0x585ea8['options'][_0x2119('0x22')]||null:null,'attributes':_0x585ea8[_0x2119('0x20')]?_0x585ea8[_0x2119('0x20')][_0x2119('0x23')]||null:null,'include':_0x585ea8[_0x2119('0x20')]?_0x585ea8[_0x2119('0x20')][_0x2119('0x24')]?_[_0x2119('0x25')](_0x585ea8[_0x2119('0x20')][_0x2119('0x24')],function(_0x879aa9){return{'model':db[_0x879aa9['model']],'as':_0x879aa9['as'],'attributes':_0x879aa9[_0x2119('0x23')],'include':_0x879aa9[_0x2119('0x24')]?_['map'](_0x879aa9[_0x2119('0x24')],function(_0x5b4470){return{'model':db[_0x5b4470['model']],'as':_0x5b4470['as'],'attributes':_0x5b4470[_0x2119('0x23')],'include':_0x5b4470[_0x2119('0x24')]?_['map'](_0x5b4470[_0x2119('0x24')],function(_0x3c6100){return{'model':db[_0x3c6100[_0x2119('0x26')]],'as':_0x3c6100['as'],'attributes':_0x3c6100[_0x2119('0x23')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x461497){logger[_0x2119('0x13')](_0x2119('0x27'),_0x585ea8);logger[_0x2119('0x15')](_0x2119('0x27'),_0x585ea8,JSON[_0x2119('0x17')](_0x461497));_0x4cc4ad(_0x461497);})[_0x2119('0x1c')](function(_0x247009){logger[_0x2119('0x18')](_0x2119('0x27'),_0x247009[_0x2119('0x1a')],_0x585ea8);_0x512455(_0x4cb9c9[_0x2119('0x18')](0x1f4,_0x247009['message']));});});}; \ No newline at end of file +var _0x2066=['message','result','catch','GetOpenchannelQueue','OpenchannelQueue','findAll','options','raw','where','limit','include','map','attributes','model','find','ShowOpenchannelQueue','lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','redis','defaults','localhost','socket.io-emitter','./openchannelQueue.socket','register','request','then','info','OpenchannelQueue,\x20%s,\x20%s','request\x20sent','debug','OpenchannelQueue,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x104e25,_0x194af3){var _0x763ca3=function(_0x4bd2ac){while(--_0x4bd2ac){_0x104e25['push'](_0x104e25['shift']());}};_0x763ca3(++_0x194af3);}(_0x2066,0xdd));var _0x6206=function(_0x44deef,_0x3857aa){_0x44deef=_0x44deef-0x0;var _0x7b3964=_0x2066[_0x44deef];return _0x7b3964;};'use strict';var _=require(_0x6206('0x0'));var util=require(_0x6206('0x1'));var moment=require('moment');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('../../config/environment');var jayson=require(_0x6206('0x8'));var client=jayson['client']['http']({'port':0x232a});config[_0x6206('0x9')]=_[_0x6206('0xa')](config[_0x6206('0x9')],{'host':_0x6206('0xb'),'port':0x18eb});var socket=require(_0x6206('0xc'))(new Redis(config[_0x6206('0x9')]));require(_0x6206('0xd'))[_0x6206('0xe')](socket);function respondWithRpcPromise(_0x4b3a60,_0x380cce,_0x404fdf){return new BPromise(function(_0xe0ac63,_0x4efd5a){return client[_0x6206('0xf')](_0x4b3a60,_0x404fdf)[_0x6206('0x10')](function(_0x21630a){logger[_0x6206('0x11')](_0x6206('0x12'),_0x380cce,_0x6206('0x13'));logger[_0x6206('0x14')](_0x6206('0x15'),_0x380cce,_0x6206('0x13'),JSON[_0x6206('0x16')](_0x21630a));if(_0x21630a[_0x6206('0x17')]){if(_0x21630a[_0x6206('0x17')][_0x6206('0x18')]===0x1f4){logger[_0x6206('0x17')](_0x6206('0x12'),_0x380cce,_0x21630a['error']['message']);return _0x4efd5a(_0x21630a['error']['message']);}logger[_0x6206('0x17')]('OpenchannelQueue,\x20%s,\x20%s',_0x380cce,_0x21630a[_0x6206('0x17')][_0x6206('0x19')]);return _0xe0ac63(_0x21630a['error'][_0x6206('0x19')]);}else{logger[_0x6206('0x11')](_0x6206('0x12'),_0x380cce,_0x6206('0x13'));_0xe0ac63(_0x21630a[_0x6206('0x1a')][_0x6206('0x19')]);}})[_0x6206('0x1b')](function(_0x8db6bb){logger[_0x6206('0x17')](_0x6206('0x12'),_0x380cce,_0x8db6bb);_0x4efd5a(_0x8db6bb);});});}exports[_0x6206('0x1c')]=function(_0x164810){var _0x3f7e49=this;return new Promise(function(_0x958ec9,_0x43cc54){return db[_0x6206('0x1d')][_0x6206('0x1e')]({'raw':_0x164810['options']?_0x164810[_0x6206('0x1f')][_0x6206('0x20')]===undefined?!![]:![]:!![],'where':_0x164810['options']?_0x164810['options'][_0x6206('0x21')]||null:null,'attributes':_0x164810[_0x6206('0x1f')]?_0x164810[_0x6206('0x1f')]['attributes']||null:null,'limit':_0x164810['options']?_0x164810[_0x6206('0x1f')][_0x6206('0x22')]||null:null,'include':_0x164810[_0x6206('0x1f')]?_0x164810[_0x6206('0x1f')][_0x6206('0x23')]?_[_0x6206('0x24')](_0x164810[_0x6206('0x1f')][_0x6206('0x23')],function(_0x35fe4e){return{'model':db[_0x35fe4e['model']],'as':_0x35fe4e['as'],'attributes':_0x35fe4e[_0x6206('0x25')],'include':_0x35fe4e['include']?_[_0x6206('0x24')](_0x35fe4e[_0x6206('0x23')],function(_0x55af18){return{'model':db[_0x55af18[_0x6206('0x26')]],'as':_0x55af18['as'],'attributes':_0x55af18[_0x6206('0x25')],'include':_0x55af18[_0x6206('0x23')]?_['map'](_0x55af18[_0x6206('0x23')],function(_0x2776d5){return{'model':db[_0x2776d5['model']],'as':_0x2776d5['as'],'attributes':_0x2776d5[_0x6206('0x25')]};}):[]};}):[]};}):[]:[]})[_0x6206('0x10')](function(_0x515f8a){logger['info'](_0x6206('0x1c'),_0x164810);logger[_0x6206('0x14')](_0x6206('0x1c'),_0x164810,JSON[_0x6206('0x16')](_0x515f8a));_0x958ec9(_0x515f8a);})[_0x6206('0x1b')](function(_0x51e0a9){logger[_0x6206('0x17')](_0x6206('0x1c'),_0x51e0a9[_0x6206('0x19')],_0x164810);_0x43cc54(_0x3f7e49[_0x6206('0x17')](0x1f4,_0x51e0a9['message']));});});};exports['ShowOpenchannelQueue']=function(_0x2c8b26){var _0x1dab2f=this;return new Promise(function(_0x5ad05e,_0x173c33){return db['OpenchannelQueue'][_0x6206('0x27')]({'raw':_0x2c8b26['options']?_0x2c8b26[_0x6206('0x1f')][_0x6206('0x20')]===undefined?!![]:![]:!![],'where':_0x2c8b26['options']?_0x2c8b26[_0x6206('0x1f')][_0x6206('0x21')]||null:null,'attributes':_0x2c8b26['options']?_0x2c8b26[_0x6206('0x1f')][_0x6206('0x25')]||null:null,'include':_0x2c8b26['options']?_0x2c8b26[_0x6206('0x1f')][_0x6206('0x23')]?_[_0x6206('0x24')](_0x2c8b26['options']['include'],function(_0xf10771){return{'model':db[_0xf10771['model']],'as':_0xf10771['as'],'attributes':_0xf10771[_0x6206('0x25')],'include':_0xf10771[_0x6206('0x23')]?_[_0x6206('0x24')](_0xf10771[_0x6206('0x23')],function(_0x49d492){return{'model':db[_0x49d492[_0x6206('0x26')]],'as':_0x49d492['as'],'attributes':_0x49d492['attributes'],'include':_0x49d492['include']?_[_0x6206('0x24')](_0x49d492[_0x6206('0x23')],function(_0x56bcaa){return{'model':db[_0x56bcaa[_0x6206('0x26')]],'as':_0x56bcaa['as'],'attributes':_0x56bcaa[_0x6206('0x25')]};}):[]};}):[]};}):[]:[]})[_0x6206('0x10')](function(_0x1f7247){logger[_0x6206('0x11')](_0x6206('0x28'),_0x2c8b26);logger['debug'](_0x6206('0x28'),_0x2c8b26,JSON[_0x6206('0x16')](_0x1f7247));_0x5ad05e(_0x1f7247);})[_0x6206('0x1b')](function(_0x3fd41d){logger['error'](_0x6206('0x28'),_0x3fd41d[_0x6206('0x19')],_0x2c8b26);_0x173c33(_0x1dab2f[_0x6206('0x17')](0x1f4,_0x3fd41d[_0x6206('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.socket.js b/server/api/openchannelQueue/openchannelQueue.socket.js index 3f5a1f0..af90e1d 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 _0x8d45=['update','emit','removeListener','register','length','openchannelQueue:','./openchannelQueue.events','save','remove'];(function(_0x36828e,_0x1e401c){var _0x129fe3=function(_0x43c656){while(--_0x43c656){_0x36828e['push'](_0x36828e['shift']());}};_0x129fe3(++_0x1e401c);}(_0x8d45,0x138));var _0x58d4=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0x8d45[_0x432682];return _0x463d05;};'use strict';var OpenchannelQueueEvents=require(_0x58d4('0x0'));var events=[_0x58d4('0x1'),_0x58d4('0x2'),_0x58d4('0x3')];function createListener(_0x59b447,_0x359693){return function(_0x5c66de){_0x359693[_0x58d4('0x4')](_0x59b447,_0x5c66de);};}function removeListener(_0x1f1dd1,_0x344eb3){return function(){OpenchannelQueueEvents[_0x58d4('0x5')](_0x1f1dd1,_0x344eb3);};}exports[_0x58d4('0x6')]=function(_0x9c5eb2){for(var _0x3d4cdd=0x0,_0xc8cdb1=events[_0x58d4('0x7')];_0x3d4cdd<_0xc8cdb1;_0x3d4cdd++){var _0x235c99=events[_0x3d4cdd];var _0x4345db=createListener(_0x58d4('0x8')+_0x235c99,_0x9c5eb2);OpenchannelQueueEvents['on'](_0x235c99,_0x4345db);}}; \ No newline at end of file +var _0xf3a5=['openchannelQueue:','./openchannelQueue.events','remove','update','emit','length'];(function(_0x28f321,_0x3b1bdf){var _0x2feda4=function(_0x3f6cf5){while(--_0x3f6cf5){_0x28f321['push'](_0x28f321['shift']());}};_0x2feda4(++_0x3b1bdf);}(_0xf3a5,0xcd));var _0x5f3a=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xf3a5[_0x3dd15e];return _0x231fd0;};'use strict';var OpenchannelQueueEvents=require(_0x5f3a('0x0'));var events=['save',_0x5f3a('0x1'),_0x5f3a('0x2')];function createListener(_0x4c1f3f,_0x2f9258){return function(_0x377fcb){_0x2f9258[_0x5f3a('0x3')](_0x4c1f3f,_0x377fcb);};}function removeListener(_0x12589e,_0x25a89e){return function(){OpenchannelQueueEvents['removeListener'](_0x12589e,_0x25a89e);};}exports['register']=function(_0x2a6140){for(var _0xba3b96=0x0,_0x99dc5a=events[_0x5f3a('0x4')];_0xba3b96<_0x99dc5a;_0xba3b96++){var _0x39a7db=events[_0xba3b96];var _0x3fe1a5=createListener(_0x5f3a('0x5')+_0x39a7db,_0x2a6140);OpenchannelQueueEvents['on'](_0x39a7db,_0x3fe1a5);}}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/index.js b/server/api/openchannelQueueReport/index.js index 01e5b2c..5fab1e0 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 _0x7d6a=['express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelQueueReport.controller','index','get','isAuthenticated','describe','/:id','post','create','put','delete','destroy','exports','multer','util','connect-timeout'];(function(_0x26c848,_0x2e36ba){var _0x599488=function(_0x2e886a){while(--_0x2e886a){_0x26c848['push'](_0x26c848['shift']());}};_0x599488(++_0x2e36ba);}(_0x7d6a,0x1a1));var _0xa7d6=function(_0x22079a,_0x45d298){_0x22079a=_0x22079a-0x0;var _0xccd4a=_0x7d6a[_0x22079a];return _0xccd4a;};'use strict';var multer=require(_0xa7d6('0x0'));var util=require(_0xa7d6('0x1'));var path=require('path');var timeout=require(_0xa7d6('0x2'));var express=require(_0xa7d6('0x3'));var router=express[_0xa7d6('0x4')]();var auth=require(_0xa7d6('0x5'));var interaction=require(_0xa7d6('0x6'));var config=require(_0xa7d6('0x7'));var controller=require(_0xa7d6('0x8'));router['get']('/',auth['isAuthenticated'](),controller[_0xa7d6('0x9')]);router[_0xa7d6('0xa')]('/describe',auth[_0xa7d6('0xb')](),controller[_0xa7d6('0xc')]);router['get'](_0xa7d6('0xd'),auth[_0xa7d6('0xb')](),controller['show']);router[_0xa7d6('0xe')]('/',auth[_0xa7d6('0xb')](),controller[_0xa7d6('0xf')]);router[_0xa7d6('0x10')](_0xa7d6('0xd'),auth[_0xa7d6('0xb')](),controller['update']);router[_0xa7d6('0x11')](_0xa7d6('0xd'),auth[_0xa7d6('0xb')](),controller[_0xa7d6('0x12')]);module[_0xa7d6('0x13')]=router; \ No newline at end of file +var _0x73a3=['create','delete','destroy','exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./openchannelQueueReport.controller','get','isAuthenticated','/describe','/:id','post'];(function(_0x38537f,_0x252124){var _0x141e23=function(_0x2809b5){while(--_0x2809b5){_0x38537f['push'](_0x38537f['shift']());}};_0x141e23(++_0x252124);}(_0x73a3,0x17a));var _0x373a=function(_0x2c91e9,_0x2fb965){_0x2c91e9=_0x2c91e9-0x0;var _0x13f0ff=_0x73a3[_0x2c91e9];return _0x13f0ff;};'use strict';var multer=require('multer');var util=require(_0x373a('0x0'));var path=require(_0x373a('0x1'));var timeout=require(_0x373a('0x2'));var express=require(_0x373a('0x3'));var router=express[_0x373a('0x4')]();var auth=require(_0x373a('0x5'));var interaction=require(_0x373a('0x6'));var config=require('../../config/environment');var controller=require(_0x373a('0x7'));router[_0x373a('0x8')]('/',auth[_0x373a('0x9')](),controller['index']);router[_0x373a('0x8')](_0x373a('0xa'),auth[_0x373a('0x9')](),controller['describe']);router['get'](_0x373a('0xb'),auth[_0x373a('0x9')](),controller['show']);router[_0x373a('0xc')]('/',auth[_0x373a('0x9')](),controller[_0x373a('0xd')]);router['put'](_0x373a('0xb'),auth[_0x373a('0x9')](),controller['update']);router[_0x373a('0xe')](_0x373a('0xb'),auth[_0x373a('0x9')](),controller[_0x373a('0xf')]);module[_0x373a('0x10')]=router; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.attributes.js b/server/api/openchannelQueueReport/openchannelQueueReport.attributes.js index 657d050..3200509 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 _0x64cc=['STRING','DATE','moment','sequelize'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x64cc,0x66));var _0xc64c=function(_0x1793e0,_0x3a69fb){_0x1793e0=_0x1793e0-0x0;var _0x4b9e8e=_0x64cc[_0x1793e0];return _0x4b9e8e;};'use strict';var moment=require(_0xc64c('0x0'));var Sequelize=require(_0xc64c('0x1'));module['exports']={'uniqueid':{'type':Sequelize[_0xc64c('0x2')],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0xc64c('0x3')]},'leaveAt':{'type':Sequelize[_0xc64c('0x3')]},'acceptAt':{'type':Sequelize[_0xc64c('0x3')]},'exitAt':{'type':Sequelize[_0xc64c('0x3')]},'reason':{'type':Sequelize[_0xc64c('0x2')]}}; \ No newline at end of file +var _0x7451=['sequelize','exports','STRING','DATE','moment'];(function(_0x502471,_0x29006e){var _0x4414a8=function(_0x3aa44f){while(--_0x3aa44f){_0x502471['push'](_0x502471['shift']());}};_0x4414a8(++_0x29006e);}(_0x7451,0x117));var _0x1745=function(_0x423fe9,_0x23eef8){_0x423fe9=_0x423fe9-0x0;var _0x3cacf8=_0x7451[_0x423fe9];return _0x3cacf8;};'use strict';var moment=require(_0x1745('0x0'));var Sequelize=require(_0x1745('0x1'));module[_0x1745('0x2')]={'uniqueid':{'type':Sequelize[_0x1745('0x3')],'allowNull':![]},'from':{'type':Sequelize[_0x1745('0x3')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0x1745('0x4')]},'acceptAt':{'type':Sequelize[_0x1745('0x4')]},'exitAt':{'type':Sequelize[_0x1745('0x4')]},'reason':{'type':Sequelize[_0x1745('0x3')]}}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.controller.js b/server/api/openchannelQueueReport/openchannelQueueReport.controller.js index 54f6e6e..f9ea520 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 _0x6965=['keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','offset','sort','filter','where','merge','options','includeAll','include','findAll','catch','show','find','create','body','params','describe','html-pdf','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','sendStatus','status','end','json','count','limit','set','Content-Range','apply','reject','update','destroy','then','error','stack','name','send','index','map','OpenchannelQueueReport','rawAttributes','fieldName','type','key','model','query'];(function(_0xe719ec,_0x5a280e){var _0x4842a1=function(_0x59b968){while(--_0x59b968){_0xe719ec['push'](_0xe719ec['shift']());}};_0x4842a1(++_0x5a280e);}(_0x6965,0xa8));var _0x5696=function(_0x361bd6,_0x3c03ee){_0x361bd6=_0x361bd6-0x0;var _0x56956f=_0x6965[_0x361bd6];return _0x56956f;};'use strict';var pdf=require(_0x5696('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x5696('0x1'));var zipdir=require(_0x5696('0x2'));var jsonpatch=require(_0x5696('0x3'));var rp=require('request-promise');var moment=require(_0x5696('0x4'));var BPromise=require(_0x5696('0x5'));var Mustache=require(_0x5696('0x6'));var util=require(_0x5696('0x7'));var path=require(_0x5696('0x8'));var sox=require(_0x5696('0x9'));var csv=require(_0x5696('0xa'));var ejs=require(_0x5696('0xb'));var fs=require('fs');var _=require(_0x5696('0xc'));var squel=require(_0x5696('0xd'));var crypto=require('crypto');var jsforce=require(_0x5696('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x5696('0xa'));var querystring=require('querystring');var Papa=require(_0x5696('0xf'));var Redis=require(_0x5696('0x10'));var authService=require(_0x5696('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x5696('0x12'));var hardwareService=require(_0x5696('0x13'));var logger=require(_0x5696('0x14'))('api');var utils=require('../../config/utils');var config=require(_0x5696('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1c23e6,_0x255746){_0x255746=_0x255746||0xcc;return function(_0x2a9d32){if(_0x2a9d32){return _0x1c23e6[_0x5696('0x16')](_0x255746);}return _0x1c23e6[_0x5696('0x17')](_0x255746)[_0x5696('0x18')]();};}function respondWithResult(_0x3da2d7,_0x3ca9d4){_0x3ca9d4=_0x3ca9d4||0xc8;return function(_0x463886){if(_0x463886){return _0x3da2d7[_0x5696('0x17')](_0x3ca9d4)[_0x5696('0x19')](_0x463886);}};}function respondWithFilteredResult(_0x13546f,_0x3bbdce){return function(_0x18b03a){if(_0x18b03a){var _0x4bf371=_0x18b03a[_0x5696('0x1a')],_0x1e79a2=_0x3bbdce['offset'],_0xd2b266=_0x3bbdce['offset']+_0x3bbdce[_0x5696('0x1b')],_0x1d0251;if(_0xd2b266>=_0x4bf371){_0xd2b266=_0x4bf371;_0x1d0251=0xc8;}else{_0x1d0251=0xce;}_0x13546f['status'](_0x1d0251);return _0x13546f[_0x5696('0x1c')](_0x5696('0x1d'),_0x1e79a2+'-'+_0xd2b266+'/'+_0x4bf371)[_0x5696('0x19')](_0x18b03a);}return null;};}function patchUpdates(_0x19963c){return function(_0x353faf){try{jsonpatch[_0x5696('0x1e')](_0x353faf,_0x19963c,!![]);}catch(_0x48517e){return BPromise[_0x5696('0x1f')](_0x48517e);}return _0x353faf['save']();};}function saveUpdates(_0x20090d,_0x61a588){return function(_0x397f66){if(_0x397f66){return _0x397f66[_0x5696('0x20')](_0x20090d)['then'](function(_0x19fb93){return _0x19fb93;});}return null;};}function removeEntity(_0x17019c,_0x25b956){return function(_0x564b0c){if(_0x564b0c){return _0x564b0c[_0x5696('0x21')]()[_0x5696('0x22')](function(){_0x17019c[_0x5696('0x17')](0xcc)[_0x5696('0x18')]();});}};}function handleEntityNotFound(_0x2156cb,_0x24b194){return function(_0x30089d){if(!_0x30089d){_0x2156cb[_0x5696('0x16')](0x194);}return _0x30089d;};}function handleError(_0x5f47e2,_0x45e439){_0x45e439=_0x45e439||0x1f4;return function(_0x5bafe0){logger[_0x5696('0x23')](_0x5bafe0[_0x5696('0x24')]);if(_0x5bafe0[_0x5696('0x25')]){delete _0x5bafe0[_0x5696('0x25')];}_0x5f47e2[_0x5696('0x17')](_0x45e439)[_0x5696('0x26')](_0x5bafe0);};}exports[_0x5696('0x27')]=function(_0x40df41,_0x5139ce){var _0x1b83bc={},_0x57ea75={},_0x37297c={'count':0x0,'rows':[]};var _0x27ca49=_[_0x5696('0x28')](db[_0x5696('0x29')][_0x5696('0x2a')],function(_0xe6de78){return{'name':_0xe6de78[_0x5696('0x2b')],'type':_0xe6de78[_0x5696('0x2c')][_0x5696('0x2d')]};});_0x57ea75[_0x5696('0x2e')]=_[_0x5696('0x28')](_0x27ca49,'name');_0x57ea75[_0x5696('0x2f')]=_[_0x5696('0x30')](_0x40df41[_0x5696('0x2f')]);_0x57ea75[_0x5696('0x31')]=_[_0x5696('0x32')](_0x57ea75[_0x5696('0x2e')],_0x57ea75[_0x5696('0x2f')]);_0x1b83bc['attributes']=_[_0x5696('0x32')](_0x57ea75[_0x5696('0x2e')],qs[_0x5696('0x33')](_0x40df41['query'][_0x5696('0x33')]));_0x1b83bc['attributes']=_0x1b83bc[_0x5696('0x34')][_0x5696('0x35')]?_0x1b83bc[_0x5696('0x34')]:_0x57ea75[_0x5696('0x2e')];if(!_0x40df41['query'][_0x5696('0x36')](_0x5696('0x37'))){_0x1b83bc[_0x5696('0x1b')]=qs[_0x5696('0x1b')](_0x40df41[_0x5696('0x2f')][_0x5696('0x1b')]);_0x1b83bc[_0x5696('0x38')]=qs['offset'](_0x40df41['query'][_0x5696('0x38')]);}_0x1b83bc['order']=qs['sort'](_0x40df41[_0x5696('0x2f')][_0x5696('0x39')]);_0x1b83bc['where']=qs[_0x5696('0x31')](_['pick'](_0x40df41[_0x5696('0x2f')],_0x57ea75[_0x5696('0x31')]),_0x27ca49);if(_0x40df41[_0x5696('0x2f')][_0x5696('0x3a')]){_0x1b83bc[_0x5696('0x3b')]=_['merge'](_0x1b83bc[_0x5696('0x3b')],{'$or':_['map'](_0x27ca49,function(_0x5931c8){if(_0x5931c8[_0x5696('0x2c')]!=='VIRTUAL'){var _0x47b70c={};_0x47b70c[_0x5931c8[_0x5696('0x25')]]={'$like':'%'+_0x40df41[_0x5696('0x2f')]['filter']+'%'};return _0x47b70c;}})});}_0x1b83bc=_[_0x5696('0x3c')]({},_0x1b83bc,_0x40df41[_0x5696('0x3d')]);var _0x3a6539={'where':_0x1b83bc[_0x5696('0x3b')]};return db[_0x5696('0x29')]['count'](_0x3a6539)[_0x5696('0x22')](function(_0xd68ebc){_0x37297c[_0x5696('0x1a')]=_0xd68ebc;if(_0x40df41[_0x5696('0x2f')][_0x5696('0x3e')]){_0x1b83bc[_0x5696('0x3f')]=[{'all':!![]}];}return db['OpenchannelQueueReport'][_0x5696('0x40')](_0x1b83bc);})[_0x5696('0x22')](function(_0x23cb97){_0x37297c['rows']=_0x23cb97;return _0x37297c;})[_0x5696('0x22')](respondWithFilteredResult(_0x5139ce,_0x1b83bc))[_0x5696('0x41')](handleError(_0x5139ce,null));};exports[_0x5696('0x42')]=function(_0x43785c,_0x2a7bd2){var _0x37ee00={'raw':!![],'where':{'id':_0x43785c['params']['id']}},_0x2da2c8={};_0x2da2c8[_0x5696('0x2e')]=_[_0x5696('0x30')](db['OpenchannelQueueReport'][_0x5696('0x2a')]);_0x2da2c8[_0x5696('0x2f')]=_['keys'](_0x43785c[_0x5696('0x2f')]);_0x2da2c8[_0x5696('0x31')]=_['intersection'](_0x2da2c8[_0x5696('0x2e')],_0x2da2c8[_0x5696('0x2f')]);_0x37ee00['attributes']=_[_0x5696('0x32')](_0x2da2c8[_0x5696('0x2e')],qs['fields'](_0x43785c[_0x5696('0x2f')][_0x5696('0x33')]));_0x37ee00['attributes']=_0x37ee00['attributes'][_0x5696('0x35')]?_0x37ee00[_0x5696('0x34')]:_0x2da2c8[_0x5696('0x2e')];if(_0x43785c[_0x5696('0x2f')][_0x5696('0x3e')]){_0x37ee00[_0x5696('0x3f')]=[{'all':!![]}];}_0x37ee00=_[_0x5696('0x3c')]({},_0x37ee00,_0x43785c[_0x5696('0x3d')]);return db[_0x5696('0x29')][_0x5696('0x43')](_0x37ee00)[_0x5696('0x22')](handleEntityNotFound(_0x2a7bd2,null))['then'](respondWithResult(_0x2a7bd2,null))['catch'](handleError(_0x2a7bd2,null));};exports[_0x5696('0x44')]=function(_0x450769,_0x135f6e){return db[_0x5696('0x29')][_0x5696('0x44')](_0x450769['body'],{})['then'](respondWithResult(_0x135f6e,0xc9))[_0x5696('0x41')](handleError(_0x135f6e,null));};exports[_0x5696('0x20')]=function(_0x1fd570,_0x4289d9){if(_0x1fd570[_0x5696('0x45')]['id']){delete _0x1fd570['body']['id'];}return db['OpenchannelQueueReport'][_0x5696('0x43')]({'where':{'id':_0x1fd570[_0x5696('0x46')]['id']}})['then'](handleEntityNotFound(_0x4289d9,null))['then'](saveUpdates(_0x1fd570[_0x5696('0x45')],null))[_0x5696('0x22')](respondWithResult(_0x4289d9,null))[_0x5696('0x41')](handleError(_0x4289d9,null));};exports[_0x5696('0x21')]=function(_0x3cd2b4,_0x91bdc9){return db[_0x5696('0x29')][_0x5696('0x43')]({'where':{'id':_0x3cd2b4[_0x5696('0x46')]['id']}})[_0x5696('0x22')](handleEntityNotFound(_0x91bdc9,null))[_0x5696('0x22')](removeEntity(_0x91bdc9,null))['catch'](handleError(_0x91bdc9,null));};exports['describe']=function(_0x73574e,_0x13a8c2){return db[_0x5696('0x29')][_0x5696('0x47')]()['then'](respondWithResult(_0x13a8c2,null))['catch'](handleError(_0x13a8c2,null));}; \ No newline at end of file +var _0xb1a6=['stack','name','send','index','map','OpenchannelQueueReport','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','nolimit','sort','where','pick','filter','VIRTUAL','options','then','findAll','catch','params','keys','includeAll','include','find','create','body','describe','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','path','to-csv','ejs','lodash','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','end','count','offset','limit','set','json','apply','reject','update','destroy'];(function(_0xdd827a,_0x482ad2){var _0x2f46f1=function(_0x221046){while(--_0x221046){_0xdd827a['push'](_0xdd827a['shift']());}};_0x2f46f1(++_0x482ad2);}(_0xb1a6,0x143));var _0x6b1a=function(_0x3f1c21,_0x57e1b6){_0x3f1c21=_0x3f1c21-0x0;var _0x10ad4f=_0xb1a6[_0x3f1c21];return _0x10ad4f;};'use strict';var pdf=require(_0x6b1a('0x0'));var emlformat=require(_0x6b1a('0x1'));var rimraf=require(_0x6b1a('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x6b1a('0x3'));var rp=require(_0x6b1a('0x4'));var moment=require('moment');var BPromise=require(_0x6b1a('0x5'));var Mustache=require(_0x6b1a('0x6'));var util=require(_0x6b1a('0x7'));var path=require(_0x6b1a('0x8'));var sox=require('sox');var csv=require(_0x6b1a('0x9'));var ejs=require(_0x6b1a('0xa'));var fs=require('fs');var _=require(_0x6b1a('0xb'));var squel=require('squel');var crypto=require(_0x6b1a('0xc'));var jsforce=require(_0x6b1a('0xd'));var deskjs=require(_0x6b1a('0xe'));var toCsv=require(_0x6b1a('0x9'));var querystring=require('querystring');var Papa=require(_0x6b1a('0xf'));var Redis=require(_0x6b1a('0x10'));var authService=require(_0x6b1a('0x11'));var qs=require(_0x6b1a('0x12'));var as=require(_0x6b1a('0x13'));var hardwareService=require(_0x6b1a('0x14'));var logger=require(_0x6b1a('0x15'))(_0x6b1a('0x16'));var utils=require('../../config/utils');var config=require(_0x6b1a('0x17'));var db=require(_0x6b1a('0x18'))['db'];function respondWithStatusCode(_0x2ce495,_0x5394c0){_0x5394c0=_0x5394c0||0xcc;return function(_0x28109a){if(_0x28109a){return _0x2ce495[_0x6b1a('0x19')](_0x5394c0);}return _0x2ce495[_0x6b1a('0x1a')](_0x5394c0)[_0x6b1a('0x1b')]();};}function respondWithResult(_0x1f1e9b,_0x2c5493){_0x2c5493=_0x2c5493||0xc8;return function(_0x319a5a){if(_0x319a5a){return _0x1f1e9b[_0x6b1a('0x1a')](_0x2c5493)['json'](_0x319a5a);}};}function respondWithFilteredResult(_0x16fddf,_0x4fe902){return function(_0x2a1f84){if(_0x2a1f84){var _0x3df1b5=_0x2a1f84[_0x6b1a('0x1c')],_0x17874b=_0x4fe902[_0x6b1a('0x1d')],_0x43c520=_0x4fe902[_0x6b1a('0x1d')]+_0x4fe902[_0x6b1a('0x1e')],_0x44153a;if(_0x43c520>=_0x3df1b5){_0x43c520=_0x3df1b5;_0x44153a=0xc8;}else{_0x44153a=0xce;}_0x16fddf[_0x6b1a('0x1a')](_0x44153a);return _0x16fddf[_0x6b1a('0x1f')]('Content-Range',_0x17874b+'-'+_0x43c520+'/'+_0x3df1b5)[_0x6b1a('0x20')](_0x2a1f84);}return null;};}function patchUpdates(_0x8b728f){return function(_0x8cfd9){try{jsonpatch[_0x6b1a('0x21')](_0x8cfd9,_0x8b728f,!![]);}catch(_0x55ee4b){return BPromise[_0x6b1a('0x22')](_0x55ee4b);}return _0x8cfd9['save']();};}function saveUpdates(_0x247113,_0x4b3c77){return function(_0x38b92f){if(_0x38b92f){return _0x38b92f[_0x6b1a('0x23')](_0x247113)['then'](function(_0x19179e){return _0x19179e;});}return null;};}function removeEntity(_0x2c4848,_0x329a0d){return function(_0x425591){if(_0x425591){return _0x425591[_0x6b1a('0x24')]()['then'](function(){_0x2c4848['status'](0xcc)[_0x6b1a('0x1b')]();});}};}function handleEntityNotFound(_0x3df786,_0x4fb3bc){return function(_0xfc2861){if(!_0xfc2861){_0x3df786[_0x6b1a('0x19')](0x194);}return _0xfc2861;};}function handleError(_0x4f0b4b,_0x320255){_0x320255=_0x320255||0x1f4;return function(_0x271bfc){logger['error'](_0x271bfc[_0x6b1a('0x25')]);if(_0x271bfc[_0x6b1a('0x26')]){delete _0x271bfc['name'];}_0x4f0b4b[_0x6b1a('0x1a')](_0x320255)[_0x6b1a('0x27')](_0x271bfc);};}exports[_0x6b1a('0x28')]=function(_0x2d7365,_0x11c7a7){var _0x26e167={},_0x3faffd={},_0x127ab9={'count':0x0,'rows':[]};var _0x1b165a=_[_0x6b1a('0x29')](db[_0x6b1a('0x2a')][_0x6b1a('0x2b')],function(_0x54806d){return{'name':_0x54806d[_0x6b1a('0x2c')],'type':_0x54806d[_0x6b1a('0x2d')][_0x6b1a('0x2e')]};});_0x3faffd[_0x6b1a('0x2f')]=_[_0x6b1a('0x29')](_0x1b165a,'name');_0x3faffd[_0x6b1a('0x30')]=_['keys'](_0x2d7365['query']);_0x3faffd[_0x6b1a('0x31')]=_[_0x6b1a('0x32')](_0x3faffd[_0x6b1a('0x2f')],_0x3faffd[_0x6b1a('0x30')]);_0x26e167[_0x6b1a('0x33')]=_[_0x6b1a('0x32')](_0x3faffd[_0x6b1a('0x2f')],qs[_0x6b1a('0x34')](_0x2d7365[_0x6b1a('0x30')][_0x6b1a('0x34')]));_0x26e167[_0x6b1a('0x33')]=_0x26e167[_0x6b1a('0x33')][_0x6b1a('0x35')]?_0x26e167['attributes']:_0x3faffd[_0x6b1a('0x2f')];if(!_0x2d7365[_0x6b1a('0x30')]['hasOwnProperty'](_0x6b1a('0x36'))){_0x26e167['limit']=qs[_0x6b1a('0x1e')](_0x2d7365[_0x6b1a('0x30')][_0x6b1a('0x1e')]);_0x26e167[_0x6b1a('0x1d')]=qs[_0x6b1a('0x1d')](_0x2d7365['query'][_0x6b1a('0x1d')]);}_0x26e167['order']=qs[_0x6b1a('0x37')](_0x2d7365[_0x6b1a('0x30')][_0x6b1a('0x37')]);_0x26e167[_0x6b1a('0x38')]=qs[_0x6b1a('0x31')](_[_0x6b1a('0x39')](_0x2d7365[_0x6b1a('0x30')],_0x3faffd[_0x6b1a('0x31')]),_0x1b165a);if(_0x2d7365[_0x6b1a('0x30')][_0x6b1a('0x3a')]){_0x26e167[_0x6b1a('0x38')]=_['merge'](_0x26e167[_0x6b1a('0x38')],{'$or':_[_0x6b1a('0x29')](_0x1b165a,function(_0x4df3d3){if(_0x4df3d3[_0x6b1a('0x2d')]!==_0x6b1a('0x3b')){var _0x15d46f={};_0x15d46f[_0x4df3d3[_0x6b1a('0x26')]]={'$like':'%'+_0x2d7365[_0x6b1a('0x30')]['filter']+'%'};return _0x15d46f;}})});}_0x26e167=_['merge']({},_0x26e167,_0x2d7365[_0x6b1a('0x3c')]);var _0x45f5f4={'where':_0x26e167[_0x6b1a('0x38')]};return db[_0x6b1a('0x2a')][_0x6b1a('0x1c')](_0x45f5f4)[_0x6b1a('0x3d')](function(_0x502515){_0x127ab9[_0x6b1a('0x1c')]=_0x502515;if(_0x2d7365[_0x6b1a('0x30')]['includeAll']){_0x26e167['include']=[{'all':!![]}];}return db['OpenchannelQueueReport'][_0x6b1a('0x3e')](_0x26e167);})[_0x6b1a('0x3d')](function(_0x2cf020){_0x127ab9['rows']=_0x2cf020;return _0x127ab9;})[_0x6b1a('0x3d')](respondWithFilteredResult(_0x11c7a7,_0x26e167))[_0x6b1a('0x3f')](handleError(_0x11c7a7,null));};exports['show']=function(_0x431338,_0x5d15e7){var _0x599139={'raw':!![],'where':{'id':_0x431338[_0x6b1a('0x40')]['id']}},_0x286674={};_0x286674[_0x6b1a('0x2f')]=_['keys'](db[_0x6b1a('0x2a')][_0x6b1a('0x2b')]);_0x286674['query']=_[_0x6b1a('0x41')](_0x431338[_0x6b1a('0x30')]);_0x286674[_0x6b1a('0x31')]=_[_0x6b1a('0x32')](_0x286674[_0x6b1a('0x2f')],_0x286674['query']);_0x599139[_0x6b1a('0x33')]=_['intersection'](_0x286674[_0x6b1a('0x2f')],qs[_0x6b1a('0x34')](_0x431338[_0x6b1a('0x30')][_0x6b1a('0x34')]));_0x599139[_0x6b1a('0x33')]=_0x599139[_0x6b1a('0x33')][_0x6b1a('0x35')]?_0x599139[_0x6b1a('0x33')]:_0x286674['model'];if(_0x431338[_0x6b1a('0x30')][_0x6b1a('0x42')]){_0x599139[_0x6b1a('0x43')]=[{'all':!![]}];}_0x599139=_['merge']({},_0x599139,_0x431338[_0x6b1a('0x3c')]);return db[_0x6b1a('0x2a')][_0x6b1a('0x44')](_0x599139)[_0x6b1a('0x3d')](handleEntityNotFound(_0x5d15e7,null))[_0x6b1a('0x3d')](respondWithResult(_0x5d15e7,null))[_0x6b1a('0x3f')](handleError(_0x5d15e7,null));};exports['create']=function(_0x12ceee,_0x29c28c){return db['OpenchannelQueueReport'][_0x6b1a('0x45')](_0x12ceee[_0x6b1a('0x46')],{})['then'](respondWithResult(_0x29c28c,0xc9))[_0x6b1a('0x3f')](handleError(_0x29c28c,null));};exports['update']=function(_0x2450ab,_0x38046a){if(_0x2450ab[_0x6b1a('0x46')]['id']){delete _0x2450ab['body']['id'];}return db['OpenchannelQueueReport'][_0x6b1a('0x44')]({'where':{'id':_0x2450ab['params']['id']}})[_0x6b1a('0x3d')](handleEntityNotFound(_0x38046a,null))['then'](saveUpdates(_0x2450ab[_0x6b1a('0x46')],null))[_0x6b1a('0x3d')](respondWithResult(_0x38046a,null))[_0x6b1a('0x3f')](handleError(_0x38046a,null));};exports[_0x6b1a('0x24')]=function(_0x1f8f02,_0x28d17c){return db['OpenchannelQueueReport'][_0x6b1a('0x44')]({'where':{'id':_0x1f8f02[_0x6b1a('0x40')]['id']}})[_0x6b1a('0x3d')](handleEntityNotFound(_0x28d17c,null))[_0x6b1a('0x3d')](removeEntity(_0x28d17c,null))['catch'](handleError(_0x28d17c,null));};exports[_0x6b1a('0x47')]=function(_0x303df9,_0xf9d251){return db[_0x6b1a('0x2a')][_0x6b1a('0x47')]()[_0x6b1a('0x3d')](respondWithResult(_0xf9d251,null))['catch'](handleError(_0xf9d251,null));}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.model.js b/server/api/openchannelQueueReport/openchannelQueueReport.model.js index a99356c..cfa6662 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 _0x171a=['./openchannelQueueReport.attributes','exports','define','OpenchannelQueueReport','report_openchannel_queue','uniqueid','lodash','util','../../config/logger','api','request-promise','path','../../config/environment'];(function(_0x4d1ce8,_0x1a778e){var _0x129384=function(_0x15e43b){while(--_0x15e43b){_0x4d1ce8['push'](_0x4d1ce8['shift']());}};_0x129384(++_0x1a778e);}(_0x171a,0x1f4));var _0xa171=function(_0xa990b7,_0x26c527){_0xa990b7=_0xa990b7-0x0;var _0x52c99c=_0x171a[_0xa990b7];return _0x52c99c;};'use strict';var _=require(_0xa171('0x0'));var util=require(_0xa171('0x1'));var logger=require(_0xa171('0x2'))(_0xa171('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xa171('0x4'));var fs=require('fs');var path=require(_0xa171('0x5'));var rimraf=require('rimraf');var config=require(_0xa171('0x6'));var attributes=require(_0xa171('0x7'));module[_0xa171('0x8')]=function(_0x4dcf81,_0x112591){return _0x4dcf81[_0xa171('0x9')](_0xa171('0xa'),attributes,{'tableName':_0xa171('0xb'),'paranoid':![],'indexes':[{'name':_0xa171('0xc'),'fields':[_0xa171('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x33d8=['./openchannelQueueReport.attributes','exports','define','report_openchannel_queue','uniqueid','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment'];(function(_0x54547c,_0x403953){var _0xea7f23=function(_0x285735){while(--_0x285735){_0x54547c['push'](_0x54547c['shift']());}};_0xea7f23(++_0x403953);}(_0x33d8,0x164));var _0x833d=function(_0x4ff09b,_0x53f67d){_0x4ff09b=_0x4ff09b-0x0;var _0x3f5c2e=_0x33d8[_0x4ff09b];return _0x3f5c2e;};'use strict';var _=require('lodash');var util=require(_0x833d('0x0'));var logger=require(_0x833d('0x1'))(_0x833d('0x2'));var moment=require(_0x833d('0x3'));var BPromise=require(_0x833d('0x4'));var rp=require(_0x833d('0x5'));var fs=require('fs');var path=require(_0x833d('0x6'));var rimraf=require('rimraf');var config=require(_0x833d('0x7'));var attributes=require(_0x833d('0x8'));module[_0x833d('0x9')]=function(_0x49a48e,_0x4b7e06){return _0x49a48e[_0x833d('0xa')]('OpenchannelQueueReport',attributes,{'tableName':_0x833d('0xb'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x833d('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.rpc.js b/server/api/openchannelQueueReport/openchannelQueueReport.rpc.js index ee06947..37511c1 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 _0x0650=['rpc','jayson/promise','request','then','info','OpenchannelQueueReport,\x20%s,\x20%s','debug','OpenchannelQueueReport,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','CreateOpenchannelQueueReport','create','body','options','raw','stringify','UpdateOpenchannelQueueReport','attributes','lodash','moment','bluebird','ioredis','../../config/utils','../../config/logger'];(function(_0x3488f7,_0x254a97){var _0x7d2b7c=function(_0x1dedc2){while(--_0x1dedc2){_0x3488f7['push'](_0x3488f7['shift']());}};_0x7d2b7c(++_0x254a97);}(_0x0650,0xed));var _0x0065=function(_0x520a3f,_0x57eba7){_0x520a3f=_0x520a3f-0x0;var _0x189b9e=_0x0650[_0x520a3f];return _0x189b9e;};'use strict';var _=require(_0x0065('0x0'));var util=require('util');var moment=require(_0x0065('0x1'));var BPromise=require(_0x0065('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0065('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0065('0x4'));var logger=require(_0x0065('0x5'))(_0x0065('0x6'));var config=require('../../config/environment');var jayson=require(_0x0065('0x7'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x59f241,_0x20dd36,_0x415835){return new BPromise(function(_0xefa3cb,_0x3fe697){return client[_0x0065('0x8')](_0x59f241,_0x415835)[_0x0065('0x9')](function(_0x8974f){logger[_0x0065('0xa')](_0x0065('0xb'),_0x20dd36,'request\x20sent');logger[_0x0065('0xc')](_0x0065('0xd'),_0x20dd36,'request\x20sent',JSON['stringify'](_0x8974f));if(_0x8974f['error']){if(_0x8974f[_0x0065('0xe')][_0x0065('0xf')]===0x1f4){logger['error'](_0x0065('0xb'),_0x20dd36,_0x8974f[_0x0065('0xe')]['message']);return _0x3fe697(_0x8974f[_0x0065('0xe')][_0x0065('0x10')]);}logger['error']('OpenchannelQueueReport,\x20%s,\x20%s',_0x20dd36,_0x8974f[_0x0065('0xe')]['message']);return _0xefa3cb(_0x8974f['error'][_0x0065('0x10')]);}else{logger['info'](_0x0065('0xb'),_0x20dd36,'request\x20sent');_0xefa3cb(_0x8974f[_0x0065('0x11')][_0x0065('0x10')]);}})[_0x0065('0x12')](function(_0x2b5df9){logger[_0x0065('0xe')](_0x0065('0xb'),_0x20dd36,_0x2b5df9);_0x3fe697(_0x2b5df9);});});}exports[_0x0065('0x13')]=function(_0x393d6e){var _0x595816=this;return new Promise(function(_0x18bfa1,_0x3f3b56){return db['OpenchannelQueueReport'][_0x0065('0x14')](_0x393d6e[_0x0065('0x15')],{'raw':_0x393d6e[_0x0065('0x16')]?_0x393d6e[_0x0065('0x16')][_0x0065('0x17')]===undefined?!![]:![]:!![]})[_0x0065('0x9')](function(_0x319e7a){logger['info']('CreateOpenchannelQueueReport',_0x393d6e);logger['debug'](_0x0065('0x13'),_0x393d6e,JSON[_0x0065('0x18')](_0x319e7a));_0x18bfa1(_0x319e7a);})['catch'](function(_0x2de3ae){logger['error'](_0x0065('0x13'),_0x2de3ae[_0x0065('0x10')],_0x393d6e);_0x3f3b56(_0x595816[_0x0065('0xe')](0x1f4,_0x2de3ae[_0x0065('0x10')]));});});};exports[_0x0065('0x19')]=function(_0x1efa70){var _0x3503e=this;return new Promise(function(_0x5d9911,_0x7057d1){return db['OpenchannelQueueReport']['update'](_0x1efa70[_0x0065('0x15')],{'raw':_0x1efa70['options']?_0x1efa70[_0x0065('0x16')][_0x0065('0x17')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1efa70['options']?_0x1efa70[_0x0065('0x16')]['where']||null:null,'attributes':_0x1efa70['options']?_0x1efa70[_0x0065('0x16')][_0x0065('0x1a')]||null:null,'limit':_0x1efa70['options']?_0x1efa70['options']['limit']||null:null})[_0x0065('0x9')](function(_0x2e554f){logger[_0x0065('0xa')](_0x0065('0x19'),_0x1efa70);logger[_0x0065('0xc')]('UpdateOpenchannelQueueReport',_0x1efa70,JSON['stringify'](_0x2e554f));_0x5d9911(_0x2e554f);})['catch'](function(_0x3460a2){logger[_0x0065('0xe')](_0x0065('0x19'),_0x3460a2['message'],_0x1efa70);_0x7057d1(_0x3503e[_0x0065('0xe')](0x1f4,_0x3460a2[_0x0065('0x10')]));});});}; \ No newline at end of file +var _0x97e6=['UpdateOpenchannelQueueReport','update','attributes','limit','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','request','then','OpenchannelQueueReport,\x20%s,\x20%s','request\x20sent','debug','OpenchannelQueueReport,\x20%s,\x20%s,\x20%s','error','message','info','result','CreateOpenchannelQueueReport','OpenchannelQueueReport','create','body','options','raw','stringify'];(function(_0xdc7a23,_0x53bae0){var _0x415981=function(_0x546218){while(--_0x546218){_0xdc7a23['push'](_0xdc7a23['shift']());}};_0x415981(++_0x53bae0);}(_0x97e6,0x159));var _0x697e=function(_0x4dd71c,_0x23a24e){_0x4dd71c=_0x4dd71c-0x0;var _0x8e4e36=_0x97e6[_0x4dd71c];return _0x8e4e36;};'use strict';var _=require(_0x697e('0x0'));var util=require('util');var moment=require(_0x697e('0x1'));var BPromise=require(_0x697e('0x2'));var rs=require(_0x697e('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x697e('0x4'))['db'];var utils=require(_0x697e('0x5'));var logger=require('../../config/logger')(_0x697e('0x6'));var config=require('../../config/environment');var jayson=require(_0x697e('0x7'));var client=jayson[_0x697e('0x8')][_0x697e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x546438,_0x371e2f,_0x21b9d5){return new BPromise(function(_0x4cf39f,_0x5670e3){return client[_0x697e('0xa')](_0x546438,_0x21b9d5)[_0x697e('0xb')](function(_0x2499f6){logger['info'](_0x697e('0xc'),_0x371e2f,_0x697e('0xd'));logger[_0x697e('0xe')](_0x697e('0xf'),_0x371e2f,_0x697e('0xd'),JSON['stringify'](_0x2499f6));if(_0x2499f6[_0x697e('0x10')]){if(_0x2499f6['error']['code']===0x1f4){logger[_0x697e('0x10')](_0x697e('0xc'),_0x371e2f,_0x2499f6[_0x697e('0x10')]['message']);return _0x5670e3(_0x2499f6[_0x697e('0x10')][_0x697e('0x11')]);}logger['error']('OpenchannelQueueReport,\x20%s,\x20%s',_0x371e2f,_0x2499f6[_0x697e('0x10')][_0x697e('0x11')]);return _0x4cf39f(_0x2499f6[_0x697e('0x10')][_0x697e('0x11')]);}else{logger[_0x697e('0x12')](_0x697e('0xc'),_0x371e2f,_0x697e('0xd'));_0x4cf39f(_0x2499f6[_0x697e('0x13')][_0x697e('0x11')]);}})['catch'](function(_0x316bdb){logger[_0x697e('0x10')]('OpenchannelQueueReport,\x20%s,\x20%s',_0x371e2f,_0x316bdb);_0x5670e3(_0x316bdb);});});}exports[_0x697e('0x14')]=function(_0x5edd20){var _0x233404=this;return new Promise(function(_0x281216,_0x50da1e){return db[_0x697e('0x15')][_0x697e('0x16')](_0x5edd20[_0x697e('0x17')],{'raw':_0x5edd20[_0x697e('0x18')]?_0x5edd20[_0x697e('0x18')][_0x697e('0x19')]===undefined?!![]:![]:!![]})[_0x697e('0xb')](function(_0x26e3cd){logger[_0x697e('0x12')](_0x697e('0x14'),_0x5edd20);logger[_0x697e('0xe')]('CreateOpenchannelQueueReport',_0x5edd20,JSON[_0x697e('0x1a')](_0x26e3cd));_0x281216(_0x26e3cd);})['catch'](function(_0x179fab){logger[_0x697e('0x10')]('CreateOpenchannelQueueReport',_0x179fab[_0x697e('0x11')],_0x5edd20);_0x50da1e(_0x233404['error'](0x1f4,_0x179fab[_0x697e('0x11')]));});});};exports[_0x697e('0x1b')]=function(_0x1d37ae){var _0x15737b=this;return new Promise(function(_0x11122b,_0x4b4514){return db['OpenchannelQueueReport'][_0x697e('0x1c')](_0x1d37ae[_0x697e('0x17')],{'raw':_0x1d37ae[_0x697e('0x18')]?_0x1d37ae[_0x697e('0x18')][_0x697e('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1d37ae[_0x697e('0x18')]?_0x1d37ae[_0x697e('0x18')]['where']||null:null,'attributes':_0x1d37ae['options']?_0x1d37ae[_0x697e('0x18')][_0x697e('0x1d')]||null:null,'limit':_0x1d37ae[_0x697e('0x18')]?_0x1d37ae[_0x697e('0x18')][_0x697e('0x1e')]||null:null})[_0x697e('0xb')](function(_0x33f4b5){logger['info']('UpdateOpenchannelQueueReport',_0x1d37ae);logger['debug'](_0x697e('0x1b'),_0x1d37ae,JSON['stringify'](_0x33f4b5));_0x11122b(_0x33f4b5);})['catch'](function(_0x5785e5){logger['error'](_0x697e('0x1b'),_0x5785e5[_0x697e('0x11')],_0x1d37ae);_0x4b4514(_0x15737b[_0x697e('0x10')](0x1f4,_0x5785e5[_0x697e('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/index.js b/server/api/openchannelTransferReport/index.js index a2ea3ef..034ab2c 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(_0x5dc03e,_0x54e60c){var _0x466a07=function(_0x2ce0cd){while(--_0x2ce0cd){_0x5dc03e['push'](_0x5dc03e['shift']());}};_0x466a07(++_0x54e60c);}(_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('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(_0x338f73,_0x1945c8){var _0x163fdf=function(_0x4cd033){while(--_0x4cd033){_0x338f73['push'](_0x338f73['shift']());}};_0x163fdf(++_0x1945c8);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4709c0,_0x3396c7){_0x4709c0=_0x4709c0-0x0;var _0x13348b=_0xa9e0[_0x4709c0];return _0x13348b;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0x0a9e('0x4'));var config=require(_0x0a9e('0x5'));var controller=require(_0x0a9e('0x6'));router[_0x0a9e('0x7')]('/',auth[_0x0a9e('0x8')](),controller['index']);router[_0x0a9e('0x7')](_0x0a9e('0x9'),auth[_0x0a9e('0x8')](),controller['describe']);router['get'](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x0a9e('0xb')]('/',auth[_0x0a9e('0x8')](),controller[_0x0a9e('0xc')]);router[_0x0a9e('0xd')](_0x0a9e('0xa'),auth[_0x0a9e('0x8')](),controller['update']);router['delete']('/:id',auth['isAuthenticated'](),controller[_0x0a9e('0xe')]);module[_0x0a9e('0xf')]=router; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.attributes.js b/server/api/openchannelTransferReport/openchannelTransferReport.attributes.js index 666c2e1..4e1793c 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 _0xead8=['sequelize','exports','STRING','ENUM','queue','DATE','NOW','moment'];(function(_0x516a50,_0xcd3a61){var _0xa9fae8=function(_0x1866be){while(--_0x1866be){_0x516a50['push'](_0x516a50['shift']());}};_0xa9fae8(++_0xcd3a61);}(_0xead8,0xbf));var _0x8ead=function(_0x45b479,_0x3e6574){_0x45b479=_0x45b479-0x0;var _0x1c3cbe=_0xead8[_0x45b479];return _0x1c3cbe;};'use strict';var moment=require(_0x8ead('0x0'));var Sequelize=require(_0x8ead('0x1'));module[_0x8ead('0x2')]={'uniqueid':{'type':Sequelize[_0x8ead('0x3')],'allowNull':![]},'type':{'type':Sequelize[_0x8ead('0x4')]('account','agent',_0x8ead('0x5')),'allowNull':![],'defaultValue':'queue'},'transferredAt':{'type':Sequelize[_0x8ead('0x6')],'allowNull':![],'defaultValue':Sequelize[_0x8ead('0x7')]}}; \ No newline at end of file +var _0xb848=['STRING','ENUM','agent','queue','NOW','sequelize','exports'];(function(_0x1821f3,_0xbde01e){var _0x1452d3=function(_0x53083b){while(--_0x53083b){_0x1821f3['push'](_0x1821f3['shift']());}};_0x1452d3(++_0xbde01e);}(_0xb848,0x186));var _0x8b84=function(_0x5d3ed6,_0x30b646){_0x5d3ed6=_0x5d3ed6-0x0;var _0x548252=_0xb848[_0x5d3ed6];return _0x548252;};'use strict';var moment=require('moment');var Sequelize=require(_0x8b84('0x0'));module[_0x8b84('0x1')]={'uniqueid':{'type':Sequelize[_0x8b84('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x8b84('0x3')]('account',_0x8b84('0x4'),'queue'),'allowNull':![],'defaultValue':_0x8b84('0x5')},'transferredAt':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':Sequelize[_0x8b84('0x6')]}}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.controller.js b/server/api/openchannelTransferReport/openchannelTransferReport.controller.js index 5dec6cf..c4a8b49 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 _0x80ce=['reject','save','destroy','then','error','name','index','map','OpenchannelTransferReport','rawAttributes','fieldName','key','model','keys','query','filters','intersection','attributes','length','hasOwnProperty','order','sort','where','pick','merge','type','VIRTUAL','filter','options','findAll','rows','show','params','fields','includeAll','catch','create','body','update','describe','zip-dir','fast-json-patch','moment','bluebird','mustache','to-csv','ejs','lodash','squel','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','count','offset','limit','set','Content-Range','apply'];(function(_0x478414,_0xcf142d){var _0x5eb6b9=function(_0x10e6fe){while(--_0x10e6fe){_0x478414['push'](_0x478414['shift']());}};_0x5eb6b9(++_0xcf142d);}(_0x80ce,0xae));var _0xe80c=function(_0x1cb7f9,_0x2e6b0d){_0x1cb7f9=_0x1cb7f9-0x0;var _0x52d6a4=_0x80ce[_0x1cb7f9];return _0x52d6a4;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xe80c('0x0'));var jsonpatch=require(_0xe80c('0x1'));var rp=require('request-promise');var moment=require(_0xe80c('0x2'));var BPromise=require(_0xe80c('0x3'));var Mustache=require(_0xe80c('0x4'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0xe80c('0x5'));var ejs=require(_0xe80c('0x6'));var fs=require('fs');var _=require(_0xe80c('0x7'));var squel=require(_0xe80c('0x8'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xe80c('0x9'));var toCsv=require(_0xe80c('0x5'));var querystring=require('querystring');var Papa=require(_0xe80c('0xa'));var Redis=require(_0xe80c('0xb'));var authService=require(_0xe80c('0xc'));var qs=require(_0xe80c('0xd'));var as=require(_0xe80c('0xe'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0xe80c('0xf'));var config=require(_0xe80c('0x10'));var db=require(_0xe80c('0x11'))['db'];function respondWithStatusCode(_0x3abe79,_0xfc0809){_0xfc0809=_0xfc0809||0xcc;return function(_0x3cd7ba){if(_0x3cd7ba){return _0x3abe79[_0xe80c('0x12')](_0xfc0809);}return _0x3abe79[_0xe80c('0x13')](_0xfc0809)[_0xe80c('0x14')]();};}function respondWithResult(_0x3665a0,_0x185a51){_0x185a51=_0x185a51||0xc8;return function(_0x46f217){if(_0x46f217){return _0x3665a0[_0xe80c('0x13')](_0x185a51)['json'](_0x46f217);}};}function respondWithFilteredResult(_0x1f3a06,_0x52801b){return function(_0x451535){if(_0x451535){var _0x2a118e=_0x451535[_0xe80c('0x15')],_0x100606=_0x52801b['offset'],_0x532e00=_0x52801b[_0xe80c('0x16')]+_0x52801b[_0xe80c('0x17')],_0x6ff463;if(_0x532e00>=_0x2a118e){_0x532e00=_0x2a118e;_0x6ff463=0xc8;}else{_0x6ff463=0xce;}_0x1f3a06['status'](_0x6ff463);return _0x1f3a06[_0xe80c('0x18')](_0xe80c('0x19'),_0x100606+'-'+_0x532e00+'/'+_0x2a118e)['json'](_0x451535);}return null;};}function patchUpdates(_0x4c431c){return function(_0x1ba731){try{jsonpatch[_0xe80c('0x1a')](_0x1ba731,_0x4c431c,!![]);}catch(_0x1e54a3){return BPromise[_0xe80c('0x1b')](_0x1e54a3);}return _0x1ba731[_0xe80c('0x1c')]();};}function saveUpdates(_0x15003f,_0x534471){return function(_0x5da513){if(_0x5da513){return _0x5da513['update'](_0x15003f)['then'](function(_0x187632){return _0x187632;});}return null;};}function removeEntity(_0x5078f8,_0x39996f){return function(_0x3efad0){if(_0x3efad0){return _0x3efad0[_0xe80c('0x1d')]()[_0xe80c('0x1e')](function(){_0x5078f8[_0xe80c('0x13')](0xcc)[_0xe80c('0x14')]();});}};}function handleEntityNotFound(_0x3fd3a2,_0x360d8b){return function(_0x43d529){if(!_0x43d529){_0x3fd3a2[_0xe80c('0x12')](0x194);}return _0x43d529;};}function handleError(_0x185eb0,_0x1b8227){_0x1b8227=_0x1b8227||0x1f4;return function(_0x4f3cfb){logger[_0xe80c('0x1f')](_0x4f3cfb['stack']);if(_0x4f3cfb[_0xe80c('0x20')]){delete _0x4f3cfb['name'];}_0x185eb0[_0xe80c('0x13')](_0x1b8227)['send'](_0x4f3cfb);};}exports[_0xe80c('0x21')]=function(_0x43f290,_0x54595d){var _0x476b6a={},_0x2808e1={},_0x259eee={'count':0x0,'rows':[]};var _0x404b82=_[_0xe80c('0x22')](db[_0xe80c('0x23')][_0xe80c('0x24')],function(_0x2936bf){return{'name':_0x2936bf[_0xe80c('0x25')],'type':_0x2936bf['type'][_0xe80c('0x26')]};});_0x2808e1[_0xe80c('0x27')]=_['map'](_0x404b82,_0xe80c('0x20'));_0x2808e1['query']=_[_0xe80c('0x28')](_0x43f290[_0xe80c('0x29')]);_0x2808e1[_0xe80c('0x2a')]=_[_0xe80c('0x2b')](_0x2808e1[_0xe80c('0x27')],_0x2808e1[_0xe80c('0x29')]);_0x476b6a[_0xe80c('0x2c')]=_[_0xe80c('0x2b')](_0x2808e1[_0xe80c('0x27')],qs['fields'](_0x43f290['query']['fields']));_0x476b6a[_0xe80c('0x2c')]=_0x476b6a[_0xe80c('0x2c')][_0xe80c('0x2d')]?_0x476b6a[_0xe80c('0x2c')]:_0x2808e1[_0xe80c('0x27')];if(!_0x43f290['query'][_0xe80c('0x2e')]('nolimit')){_0x476b6a['limit']=qs[_0xe80c('0x17')](_0x43f290[_0xe80c('0x29')][_0xe80c('0x17')]);_0x476b6a[_0xe80c('0x16')]=qs[_0xe80c('0x16')](_0x43f290[_0xe80c('0x29')]['offset']);}_0x476b6a[_0xe80c('0x2f')]=qs[_0xe80c('0x30')](_0x43f290[_0xe80c('0x29')][_0xe80c('0x30')]);_0x476b6a[_0xe80c('0x31')]=qs[_0xe80c('0x2a')](_[_0xe80c('0x32')](_0x43f290[_0xe80c('0x29')],_0x2808e1[_0xe80c('0x2a')]),_0x404b82);if(_0x43f290['query']['filter']){_0x476b6a['where']=_[_0xe80c('0x33')](_0x476b6a[_0xe80c('0x31')],{'$or':_[_0xe80c('0x22')](_0x404b82,function(_0x5bb2f5){if(_0x5bb2f5[_0xe80c('0x34')]!==_0xe80c('0x35')){var _0x43b220={};_0x43b220[_0x5bb2f5['name']]={'$like':'%'+_0x43f290[_0xe80c('0x29')][_0xe80c('0x36')]+'%'};return _0x43b220;}})});}_0x476b6a=_[_0xe80c('0x33')]({},_0x476b6a,_0x43f290[_0xe80c('0x37')]);var _0x2e22b0={'where':_0x476b6a[_0xe80c('0x31')]};return db[_0xe80c('0x23')][_0xe80c('0x15')](_0x2e22b0)['then'](function(_0x210e68){_0x259eee[_0xe80c('0x15')]=_0x210e68;if(_0x43f290[_0xe80c('0x29')]['includeAll']){_0x476b6a['include']=[{'all':!![]}];}return db[_0xe80c('0x23')][_0xe80c('0x38')](_0x476b6a);})['then'](function(_0x32a3e0){_0x259eee[_0xe80c('0x39')]=_0x32a3e0;return _0x259eee;})[_0xe80c('0x1e')](respondWithFilteredResult(_0x54595d,_0x476b6a))['catch'](handleError(_0x54595d,null));};exports[_0xe80c('0x3a')]=function(_0x177b29,_0x254a4b){var _0xb45f93={'raw':!![],'where':{'id':_0x177b29[_0xe80c('0x3b')]['id']}},_0x2c9040={};_0x2c9040[_0xe80c('0x27')]=_['keys'](db['OpenchannelTransferReport'][_0xe80c('0x24')]);_0x2c9040[_0xe80c('0x29')]=_[_0xe80c('0x28')](_0x177b29[_0xe80c('0x29')]);_0x2c9040[_0xe80c('0x2a')]=_[_0xe80c('0x2b')](_0x2c9040['model'],_0x2c9040[_0xe80c('0x29')]);_0xb45f93[_0xe80c('0x2c')]=_['intersection'](_0x2c9040['model'],qs[_0xe80c('0x3c')](_0x177b29[_0xe80c('0x29')][_0xe80c('0x3c')]));_0xb45f93['attributes']=_0xb45f93['attributes'][_0xe80c('0x2d')]?_0xb45f93[_0xe80c('0x2c')]:_0x2c9040[_0xe80c('0x27')];if(_0x177b29[_0xe80c('0x29')][_0xe80c('0x3d')]){_0xb45f93['include']=[{'all':!![]}];}_0xb45f93=_['merge']({},_0xb45f93,_0x177b29[_0xe80c('0x37')]);return db[_0xe80c('0x23')]['find'](_0xb45f93)['then'](handleEntityNotFound(_0x254a4b,null))[_0xe80c('0x1e')](respondWithResult(_0x254a4b,null))[_0xe80c('0x3e')](handleError(_0x254a4b,null));};exports[_0xe80c('0x3f')]=function(_0x17f422,_0x46df36){return db['OpenchannelTransferReport'][_0xe80c('0x3f')](_0x17f422[_0xe80c('0x40')],{})[_0xe80c('0x1e')](respondWithResult(_0x46df36,0xc9))[_0xe80c('0x3e')](handleError(_0x46df36,null));};exports[_0xe80c('0x41')]=function(_0x60b823,_0x4ddf5c){if(_0x60b823[_0xe80c('0x40')]['id']){delete _0x60b823[_0xe80c('0x40')]['id'];}return db[_0xe80c('0x23')]['find']({'where':{'id':_0x60b823[_0xe80c('0x3b')]['id']}})[_0xe80c('0x1e')](handleEntityNotFound(_0x4ddf5c,null))['then'](saveUpdates(_0x60b823[_0xe80c('0x40')],null))[_0xe80c('0x1e')](respondWithResult(_0x4ddf5c,null))[_0xe80c('0x3e')](handleError(_0x4ddf5c,null));};exports[_0xe80c('0x1d')]=function(_0x228777,_0x3dc0b1){return db[_0xe80c('0x23')]['find']({'where':{'id':_0x228777[_0xe80c('0x3b')]['id']}})[_0xe80c('0x1e')](handleEntityNotFound(_0x3dc0b1,null))[_0xe80c('0x1e')](removeEntity(_0x3dc0b1,null))[_0xe80c('0x3e')](handleError(_0x3dc0b1,null));};exports[_0xe80c('0x42')]=function(_0x5e1b32,_0x207bd7){return db[_0xe80c('0x23')][_0xe80c('0x42')]()[_0xe80c('0x1e')](respondWithResult(_0x207bd7,null))[_0xe80c('0x3e')](handleError(_0x207bd7,null));}; \ No newline at end of file +var _0xbc5e=['attributes','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','merge','options','count','includeAll','include','findAll','rows','catch','show','params','keys','create','body','find','describe','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','status','end','offset','set','Content-Range','json','apply','reject','update','then','destroy','sendStatus','error','stack','name','send','map','OpenchannelTransferReport','rawAttributes','key','model','query','filters','intersection','fields'];(function(_0x58d48c,_0x5c13f4){var _0x37e0ba=function(_0x221ef5){while(--_0x221ef5){_0x58d48c['push'](_0x58d48c['shift']());}};_0x37e0ba(++_0x5c13f4);}(_0xbc5e,0x65));var _0xebc5=function(_0x35e641,_0x4b5f7e){_0x35e641=_0x35e641-0x0;var _0x24c608=_0xbc5e[_0x35e641];return _0x24c608;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xebc5('0x0'));var rimraf=require(_0xebc5('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xebc5('0x2'));var rp=require(_0xebc5('0x3'));var moment=require(_0xebc5('0x4'));var BPromise=require(_0xebc5('0x5'));var Mustache=require(_0xebc5('0x6'));var util=require(_0xebc5('0x7'));var path=require(_0xebc5('0x8'));var sox=require(_0xebc5('0x9'));var csv=require(_0xebc5('0xa'));var ejs=require(_0xebc5('0xb'));var fs=require('fs');var _=require(_0xebc5('0xc'));var squel=require(_0xebc5('0xd'));var crypto=require(_0xebc5('0xe'));var jsforce=require(_0xebc5('0xf'));var deskjs=require(_0xebc5('0x10'));var toCsv=require('to-csv');var querystring=require(_0xebc5('0x11'));var Papa=require('papaparse');var Redis=require(_0xebc5('0x12'));var authService=require(_0xebc5('0x13'));var qs=require(_0xebc5('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xebc5('0x15'));var logger=require(_0xebc5('0x16'))('api');var utils=require(_0xebc5('0x17'));var config=require(_0xebc5('0x18'));var db=require(_0xebc5('0x19'))['db'];function respondWithStatusCode(_0x561c09,_0x489222){_0x489222=_0x489222||0xcc;return function(_0x146711){if(_0x146711){return _0x561c09['sendStatus'](_0x489222);}return _0x561c09[_0xebc5('0x1a')](_0x489222)[_0xebc5('0x1b')]();};}function respondWithResult(_0xf8c6bc,_0x2c2ee6){_0x2c2ee6=_0x2c2ee6||0xc8;return function(_0x1b8637){if(_0x1b8637){return _0xf8c6bc[_0xebc5('0x1a')](_0x2c2ee6)['json'](_0x1b8637);}};}function respondWithFilteredResult(_0x52d3da,_0x5be60b){return function(_0x2d2020){if(_0x2d2020){var _0x4aecad=_0x2d2020['count'],_0x5a9caf=_0x5be60b[_0xebc5('0x1c')],_0x24048e=_0x5be60b[_0xebc5('0x1c')]+_0x5be60b['limit'],_0x2f943f;if(_0x24048e>=_0x4aecad){_0x24048e=_0x4aecad;_0x2f943f=0xc8;}else{_0x2f943f=0xce;}_0x52d3da[_0xebc5('0x1a')](_0x2f943f);return _0x52d3da[_0xebc5('0x1d')](_0xebc5('0x1e'),_0x5a9caf+'-'+_0x24048e+'/'+_0x4aecad)[_0xebc5('0x1f')](_0x2d2020);}return null;};}function patchUpdates(_0xfe2874){return function(_0x458669){try{jsonpatch[_0xebc5('0x20')](_0x458669,_0xfe2874,!![]);}catch(_0x27f5c4){return BPromise[_0xebc5('0x21')](_0x27f5c4);}return _0x458669['save']();};}function saveUpdates(_0x1579e0,_0x5905d7){return function(_0x27918b){if(_0x27918b){return _0x27918b[_0xebc5('0x22')](_0x1579e0)[_0xebc5('0x23')](function(_0x3078f2){return _0x3078f2;});}return null;};}function removeEntity(_0x1394e1,_0x487f52){return function(_0x1522b0){if(_0x1522b0){return _0x1522b0[_0xebc5('0x24')]()[_0xebc5('0x23')](function(){_0x1394e1[_0xebc5('0x1a')](0xcc)[_0xebc5('0x1b')]();});}};}function handleEntityNotFound(_0x265ba9,_0xa05d87){return function(_0x560ac6){if(!_0x560ac6){_0x265ba9[_0xebc5('0x25')](0x194);}return _0x560ac6;};}function handleError(_0x38c781,_0x27b62a){_0x27b62a=_0x27b62a||0x1f4;return function(_0x5ec1cf){logger[_0xebc5('0x26')](_0x5ec1cf[_0xebc5('0x27')]);if(_0x5ec1cf[_0xebc5('0x28')]){delete _0x5ec1cf[_0xebc5('0x28')];}_0x38c781[_0xebc5('0x1a')](_0x27b62a)[_0xebc5('0x29')](_0x5ec1cf);};}exports['index']=function(_0x1808f2,_0x15b01b){var _0x327611={},_0x4cd9d9={},_0x74fa1f={'count':0x0,'rows':[]};var _0x56bae=_[_0xebc5('0x2a')](db[_0xebc5('0x2b')][_0xebc5('0x2c')],function(_0x132acf){return{'name':_0x132acf['fieldName'],'type':_0x132acf['type'][_0xebc5('0x2d')]};});_0x4cd9d9[_0xebc5('0x2e')]=_[_0xebc5('0x2a')](_0x56bae,'name');_0x4cd9d9[_0xebc5('0x2f')]=_['keys'](_0x1808f2[_0xebc5('0x2f')]);_0x4cd9d9[_0xebc5('0x30')]=_[_0xebc5('0x31')](_0x4cd9d9[_0xebc5('0x2e')],_0x4cd9d9[_0xebc5('0x2f')]);_0x327611['attributes']=_[_0xebc5('0x31')](_0x4cd9d9[_0xebc5('0x2e')],qs[_0xebc5('0x32')](_0x1808f2['query'][_0xebc5('0x32')]));_0x327611['attributes']=_0x327611[_0xebc5('0x33')][_0xebc5('0x34')]?_0x327611['attributes']:_0x4cd9d9[_0xebc5('0x2e')];if(!_0x1808f2[_0xebc5('0x2f')][_0xebc5('0x35')](_0xebc5('0x36'))){_0x327611['limit']=qs[_0xebc5('0x37')](_0x1808f2[_0xebc5('0x2f')][_0xebc5('0x37')]);_0x327611[_0xebc5('0x1c')]=qs[_0xebc5('0x1c')](_0x1808f2['query'][_0xebc5('0x1c')]);}_0x327611[_0xebc5('0x38')]=qs[_0xebc5('0x39')](_0x1808f2[_0xebc5('0x2f')]['sort']);_0x327611[_0xebc5('0x3a')]=qs[_0xebc5('0x30')](_[_0xebc5('0x3b')](_0x1808f2[_0xebc5('0x2f')],_0x4cd9d9['filters']),_0x56bae);if(_0x1808f2[_0xebc5('0x2f')][_0xebc5('0x3c')]){_0x327611[_0xebc5('0x3a')]=_[_0xebc5('0x3d')](_0x327611[_0xebc5('0x3a')],{'$or':_[_0xebc5('0x2a')](_0x56bae,function(_0x1610f6){if(_0x1610f6['type']!=='VIRTUAL'){var _0x2385a5={};_0x2385a5[_0x1610f6[_0xebc5('0x28')]]={'$like':'%'+_0x1808f2[_0xebc5('0x2f')][_0xebc5('0x3c')]+'%'};return _0x2385a5;}})});}_0x327611=_[_0xebc5('0x3d')]({},_0x327611,_0x1808f2[_0xebc5('0x3e')]);var _0xa7a9f8={'where':_0x327611[_0xebc5('0x3a')]};return db[_0xebc5('0x2b')][_0xebc5('0x3f')](_0xa7a9f8)[_0xebc5('0x23')](function(_0x594c3c){_0x74fa1f[_0xebc5('0x3f')]=_0x594c3c;if(_0x1808f2['query'][_0xebc5('0x40')]){_0x327611[_0xebc5('0x41')]=[{'all':!![]}];}return db[_0xebc5('0x2b')][_0xebc5('0x42')](_0x327611);})[_0xebc5('0x23')](function(_0xc1fdf7){_0x74fa1f[_0xebc5('0x43')]=_0xc1fdf7;return _0x74fa1f;})[_0xebc5('0x23')](respondWithFilteredResult(_0x15b01b,_0x327611))[_0xebc5('0x44')](handleError(_0x15b01b,null));};exports[_0xebc5('0x45')]=function(_0x82edd1,_0x413396){var _0x2b4c79={'raw':!![],'where':{'id':_0x82edd1[_0xebc5('0x46')]['id']}},_0x44c7b3={};_0x44c7b3[_0xebc5('0x2e')]=_['keys'](db[_0xebc5('0x2b')][_0xebc5('0x2c')]);_0x44c7b3[_0xebc5('0x2f')]=_[_0xebc5('0x47')](_0x82edd1[_0xebc5('0x2f')]);_0x44c7b3[_0xebc5('0x30')]=_[_0xebc5('0x31')](_0x44c7b3['model'],_0x44c7b3[_0xebc5('0x2f')]);_0x2b4c79[_0xebc5('0x33')]=_['intersection'](_0x44c7b3[_0xebc5('0x2e')],qs[_0xebc5('0x32')](_0x82edd1['query'][_0xebc5('0x32')]));_0x2b4c79[_0xebc5('0x33')]=_0x2b4c79[_0xebc5('0x33')][_0xebc5('0x34')]?_0x2b4c79[_0xebc5('0x33')]:_0x44c7b3[_0xebc5('0x2e')];if(_0x82edd1['query']['includeAll']){_0x2b4c79['include']=[{'all':!![]}];}_0x2b4c79=_[_0xebc5('0x3d')]({},_0x2b4c79,_0x82edd1[_0xebc5('0x3e')]);return db[_0xebc5('0x2b')]['find'](_0x2b4c79)[_0xebc5('0x23')](handleEntityNotFound(_0x413396,null))[_0xebc5('0x23')](respondWithResult(_0x413396,null))[_0xebc5('0x44')](handleError(_0x413396,null));};exports[_0xebc5('0x48')]=function(_0x2b2f5c,_0x383ebc){return db[_0xebc5('0x2b')][_0xebc5('0x48')](_0x2b2f5c[_0xebc5('0x49')],{})['then'](respondWithResult(_0x383ebc,0xc9))[_0xebc5('0x44')](handleError(_0x383ebc,null));};exports[_0xebc5('0x22')]=function(_0x545880,_0x3ce4fb){if(_0x545880['body']['id']){delete _0x545880['body']['id'];}return db['OpenchannelTransferReport'][_0xebc5('0x4a')]({'where':{'id':_0x545880[_0xebc5('0x46')]['id']}})[_0xebc5('0x23')](handleEntityNotFound(_0x3ce4fb,null))[_0xebc5('0x23')](saveUpdates(_0x545880[_0xebc5('0x49')],null))[_0xebc5('0x23')](respondWithResult(_0x3ce4fb,null))[_0xebc5('0x44')](handleError(_0x3ce4fb,null));};exports[_0xebc5('0x24')]=function(_0x119339,_0xd24be2){return db['OpenchannelTransferReport'][_0xebc5('0x4a')]({'where':{'id':_0x119339[_0xebc5('0x46')]['id']}})[_0xebc5('0x23')](handleEntityNotFound(_0xd24be2,null))['then'](removeEntity(_0xd24be2,null))[_0xebc5('0x44')](handleError(_0xd24be2,null));};exports[_0xebc5('0x4b')]=function(_0x1f05d0,_0x27ff06){return db[_0xebc5('0x2b')][_0xebc5('0x4b')]()[_0xebc5('0x23')](respondWithResult(_0x27ff06,null))[_0xebc5('0x44')](handleError(_0x27ff06,null));}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.model.js b/server/api/openchannelTransferReport/openchannelTransferReport.model.js index f93f065..3ea2f64 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 _0xa24d=['uniqueid','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./openchannelTransferReport.attributes','exports','define','report_openchannel_transfer'];(function(_0x1ad6e2,_0xa1460b){var _0x1b2a23=function(_0x3719ef){while(--_0x3719ef){_0x1ad6e2['push'](_0x1ad6e2['shift']());}};_0x1b2a23(++_0xa1460b);}(_0xa24d,0x1c1));var _0xda24=function(_0x9641f8,_0x5c2372){_0x9641f8=_0x9641f8-0x0;var _0x3881b4=_0xa24d[_0x9641f8];return _0x3881b4;};'use strict';var _=require(_0xda24('0x0'));var util=require(_0xda24('0x1'));var logger=require(_0xda24('0x2'))(_0xda24('0x3'));var moment=require(_0xda24('0x4'));var BPromise=require(_0xda24('0x5'));var rp=require(_0xda24('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xda24('0x7'));var config=require(_0xda24('0x8'));var attributes=require(_0xda24('0x9'));module[_0xda24('0xa')]=function(_0x561d74,_0x3557cb){return _0x561d74[_0xda24('0xb')]('OpenchannelTransferReport',attributes,{'tableName':_0xda24('0xc'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0xda24('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x8cad=['util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./openchannelTransferReport.attributes','exports','OpenchannelTransferReport','report_openchannel_transfer','uniqueid','lodash'];(function(_0x1d5ba8,_0x412a52){var _0x1022a2=function(_0x187f11){while(--_0x187f11){_0x1d5ba8['push'](_0x1d5ba8['shift']());}};_0x1022a2(++_0x412a52);}(_0x8cad,0xfe));var _0xd8ca=function(_0x24f31b,_0x44b8f3){_0x24f31b=_0x24f31b-0x0;var _0x488401=_0x8cad[_0x24f31b];return _0x488401;};'use strict';var _=require(_0xd8ca('0x0'));var util=require(_0xd8ca('0x1'));var logger=require(_0xd8ca('0x2'))(_0xd8ca('0x3'));var moment=require(_0xd8ca('0x4'));var BPromise=require(_0xd8ca('0x5'));var rp=require(_0xd8ca('0x6'));var fs=require('fs');var path=require(_0xd8ca('0x7'));var rimraf=require(_0xd8ca('0x8'));var config=require(_0xd8ca('0x9'));var attributes=require(_0xd8ca('0xa'));module[_0xd8ca('0xb')]=function(_0x14c73e,_0x6d5070){return _0x14c73e['define'](_0xd8ca('0xc'),attributes,{'tableName':_0xd8ca('0xd'),'paranoid':![],'indexes':[{'name':_0xd8ca('0xe'),'fields':[_0xd8ca('0xe')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.rpc.js b/server/api/openchannelTransferReport/openchannelTransferReport.rpc.js index 94fcd50..1675f98 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 _0x2aa0=['bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','OpenchannelTransferReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','result','catch','lodash','util'];(function(_0x270b8c,_0x43bf26){var _0x5a76df=function(_0xc35bea){while(--_0xc35bea){_0x270b8c['push'](_0x270b8c['shift']());}};_0x5a76df(++_0x43bf26);}(_0x2aa0,0x6c));var _0x02aa=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0x2aa0[_0x42cae2];return _0x5f256f;};'use strict';var _=require(_0x02aa('0x0'));var util=require(_0x02aa('0x1'));var moment=require('moment');var BPromise=require(_0x02aa('0x2'));var rs=require(_0x02aa('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x02aa('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x02aa('0x5'))(_0x02aa('0x6'));var config=require(_0x02aa('0x7'));var jayson=require(_0x02aa('0x8'));var client=jayson[_0x02aa('0x9')][_0x02aa('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x17e58f,_0x1f3de7,_0x7d53e2){return new BPromise(function(_0x2aef4a,_0xa890a3){return client['request'](_0x17e58f,_0x7d53e2)[_0x02aa('0xb')](function(_0x37e62f){logger['info'](_0x02aa('0xc'),_0x1f3de7,_0x02aa('0xd'));logger[_0x02aa('0xe')]('OpenchannelTransferReport,\x20%s,\x20%s,\x20%s',_0x1f3de7,'request\x20sent',JSON[_0x02aa('0xf')](_0x37e62f));if(_0x37e62f[_0x02aa('0x10')]){if(_0x37e62f[_0x02aa('0x10')][_0x02aa('0x11')]===0x1f4){logger[_0x02aa('0x10')]('OpenchannelTransferReport,\x20%s,\x20%s',_0x1f3de7,_0x37e62f['error']['message']);return _0xa890a3(_0x37e62f[_0x02aa('0x10')][_0x02aa('0x12')]);}logger[_0x02aa('0x10')](_0x02aa('0xc'),_0x1f3de7,_0x37e62f[_0x02aa('0x10')][_0x02aa('0x12')]);return _0x2aef4a(_0x37e62f[_0x02aa('0x10')][_0x02aa('0x12')]);}else{logger[_0x02aa('0x13')](_0x02aa('0xc'),_0x1f3de7,_0x02aa('0xd'));_0x2aef4a(_0x37e62f[_0x02aa('0x14')][_0x02aa('0x12')]);}})[_0x02aa('0x15')](function(_0xe103ef){logger[_0x02aa('0x10')](_0x02aa('0xc'),_0x1f3de7,_0xe103ef);_0xa890a3(_0xe103ef);});});} \ No newline at end of file +var _0xf820=['OpenchannelTransferReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','then'];(function(_0x3d7fe8,_0x5d3250){var _0x9c0ea2=function(_0x44d666){while(--_0x44d666){_0x3d7fe8['push'](_0x3d7fe8['shift']());}};_0x9c0ea2(++_0x5d3250);}(_0xf820,0x86));var _0x0f82=function(_0x24fa28,_0x4abfa4){_0x24fa28=_0x24fa28-0x0;var _0x36025f=_0xf820[_0x24fa28];return _0x36025f;};'use strict';var _=require(_0x0f82('0x0'));var util=require(_0x0f82('0x1'));var moment=require(_0x0f82('0x2'));var BPromise=require('bluebird');var rs=require(_0x0f82('0x3'));var fs=require('fs');var Redis=require(_0x0f82('0x4'));var db=require(_0x0f82('0x5'))['db'];var utils=require(_0x0f82('0x6'));var logger=require(_0x0f82('0x7'))(_0x0f82('0x8'));var config=require(_0x0f82('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x0f82('0xa')][_0x0f82('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x28df65,_0x40f244,_0x552403){return new BPromise(function(_0x4be7cb,_0x41675f){return client['request'](_0x28df65,_0x552403)[_0x0f82('0xc')](function(_0x22a121){logger['info'](_0x0f82('0xd'),_0x40f244,_0x0f82('0xe'));logger[_0x0f82('0xf')]('OpenchannelTransferReport,\x20%s,\x20%s,\x20%s',_0x40f244,_0x0f82('0xe'),JSON[_0x0f82('0x10')](_0x22a121));if(_0x22a121[_0x0f82('0x11')]){if(_0x22a121['error'][_0x0f82('0x12')]===0x1f4){logger[_0x0f82('0x11')]('OpenchannelTransferReport,\x20%s,\x20%s',_0x40f244,_0x22a121[_0x0f82('0x11')]['message']);return _0x41675f(_0x22a121['error'][_0x0f82('0x13')]);}logger[_0x0f82('0x11')](_0x0f82('0xd'),_0x40f244,_0x22a121[_0x0f82('0x11')]['message']);return _0x4be7cb(_0x22a121[_0x0f82('0x11')][_0x0f82('0x13')]);}else{logger['info'](_0x0f82('0xd'),_0x40f244,'request\x20sent');_0x4be7cb(_0x22a121[_0x0f82('0x14')]['message']);}})['catch'](function(_0x3df176){logger['error'](_0x0f82('0xd'),_0x40f244,_0x3df176);_0x41675f(_0x3df176);});});} \ No newline at end of file diff --git a/server/api/pause/index.js b/server/api/pause/index.js index d64a371..f6eab7c 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 _0xa3b1=['create','update','destroy','exports','multer','connect-timeout','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id'];(function(_0x1338f1,_0x2f904d){var _0x38e10f=function(_0x42d8e2){while(--_0x42d8e2){_0x1338f1['push'](_0x1338f1['shift']());}};_0x38e10f(++_0x2f904d);}(_0xa3b1,0x18a));var _0x1a3b=function(_0x523a03,_0x47d6d3){_0x523a03=_0x523a03-0x0;var _0x1f6f00=_0xa3b1[_0x523a03];return _0x1f6f00;};'use strict';var multer=require(_0x1a3b('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x1a3b('0x1'));var express=require('express');var router=express['Router']();var auth=require(_0x1a3b('0x2'));var interaction=require(_0x1a3b('0x3'));var config=require(_0x1a3b('0x4'));var controller=require('./pause.controller');router[_0x1a3b('0x5')]('/',auth[_0x1a3b('0x6')](),controller[_0x1a3b('0x7')]);router[_0x1a3b('0x5')](_0x1a3b('0x8'),auth[_0x1a3b('0x6')](),controller['show']);router['post']('/',auth[_0x1a3b('0x6')](),controller[_0x1a3b('0x9')]);router['put'](_0x1a3b('0x8'),auth['isAuthenticated'](),controller[_0x1a3b('0xa')]);router['delete'](_0x1a3b('0x8'),auth[_0x1a3b('0x6')](),controller[_0x1a3b('0xb')]);module[_0x1a3b('0xc')]=router; \ No newline at end of file +var _0x91d4=['delete','destroy','exports','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','/:id','isAuthenticated','show','post','put','update'];(function(_0xdab3da,_0xc05e3b){var _0x524d1b=function(_0x4d47b5){while(--_0x4d47b5){_0xdab3da['push'](_0xdab3da['shift']());}};_0x524d1b(++_0xc05e3b);}(_0x91d4,0x19b));var _0x491d=function(_0x3fb22d,_0x4d997b){_0x3fb22d=_0x3fb22d-0x0;var _0x42b188=_0x91d4[_0x3fb22d];return _0x42b188;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x491d('0x0'));var timeout=require(_0x491d('0x1'));var express=require(_0x491d('0x2'));var router=express[_0x491d('0x3')]();var auth=require(_0x491d('0x4'));var interaction=require(_0x491d('0x5'));var config=require(_0x491d('0x6'));var controller=require('./pause.controller');router[_0x491d('0x7')]('/',auth['isAuthenticated'](),controller['index']);router['get'](_0x491d('0x8'),auth[_0x491d('0x9')](),controller[_0x491d('0xa')]);router[_0x491d('0xb')]('/',auth[_0x491d('0x9')](),controller['create']);router[_0x491d('0xc')](_0x491d('0x8'),auth['isAuthenticated'](),controller[_0x491d('0xd')]);router[_0x491d('0xe')](_0x491d('0x8'),auth['isAuthenticated'](),controller[_0x491d('0xf')]);module[_0x491d('0x10')]=router; \ No newline at end of file diff --git a/server/api/pause/pause.attributes.js b/server/api/pause/pause.attributes.js index 064838c..03e0e21 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 _0xee15=['exports','STRING','sequelize'];(function(_0x5d672b,_0x28f0e4){var _0x3268fc=function(_0x47aa90){while(--_0x47aa90){_0x5d672b['push'](_0x5d672b['shift']());}};_0x3268fc(++_0x28f0e4);}(_0xee15,0x83));var _0x5ee1=function(_0x64aff8,_0x106082){_0x64aff8=_0x64aff8-0x0;var _0x5488a3=_0xee15[_0x64aff8];return _0x5488a3;};'use strict';var Sequelize=require(_0x5ee1('0x0'));module[_0x5ee1('0x1')]={'name':{'type':Sequelize[_0x5ee1('0x2')],'unique':'name','allowNull':![]},'description':{'type':Sequelize[_0x5ee1('0x2')]}}; \ No newline at end of file +var _0x7075=['STRING','sequelize'];(function(_0xd2b907,_0x1d769b){var _0x2cde42=function(_0x1baddc){while(--_0x1baddc){_0xd2b907['push'](_0xd2b907['shift']());}};_0x2cde42(++_0x1d769b);}(_0x7075,0xd7));var _0x5707=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x7075[_0x20a584];return _0x4b41a8;};'use strict';var Sequelize=require(_0x5707('0x0'));module['exports']={'name':{'type':Sequelize[_0x5707('0x1')],'unique':'name','allowNull':![]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/pause/pause.controller.js b/server/api/pause/pause.controller.js index 7811c48..9a5eed9 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 _0x872b=['send','index','map','rawAttributes','fieldName','type','key','keys','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','VIRTUAL','merge','options','include','Pause','findAll','rows','catch','show','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','html-pdf','eml-format','zip-dir','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','count','offset','limit','Content-Range','apply','reject','save','update','then','destroy','Pauses','UserProfileResource','error','stack','name'];(function(_0x4c7fb5,_0x2548ef){var _0x2e10ac=function(_0xf7e27c){while(--_0xf7e27c){_0x4c7fb5['push'](_0x4c7fb5['shift']());}};_0x2e10ac(++_0x2548ef);}(_0x872b,0x11e));var _0xb872=function(_0x4501aa,_0x1b04c9){_0x4501aa=_0x4501aa-0x0;var _0x44f0ac=_0x872b[_0x4501aa];return _0x44f0ac;};'use strict';var pdf=require(_0xb872('0x0'));var emlformat=require(_0xb872('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xb872('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xb872('0x3'));var moment=require(_0xb872('0x4'));var BPromise=require(_0xb872('0x5'));var Mustache=require('mustache');var util=require(_0xb872('0x6'));var path=require(_0xb872('0x7'));var sox=require(_0xb872('0x8'));var csv=require(_0xb872('0x9'));var ejs=require(_0xb872('0xa'));var fs=require('fs');var _=require(_0xb872('0xb'));var squel=require('squel');var crypto=require(_0xb872('0xc'));var jsforce=require(_0xb872('0xd'));var deskjs=require(_0xb872('0xe'));var toCsv=require(_0xb872('0x9'));var querystring=require('querystring');var Papa=require(_0xb872('0xf'));var Redis=require(_0xb872('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xb872('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xb872('0x12'));var logger=require(_0xb872('0x13'))(_0xb872('0x14'));var utils=require(_0xb872('0x15'));var config=require(_0xb872('0x16'));var db=require(_0xb872('0x17'))['db'];function respondWithStatusCode(_0x3bce9f,_0x2d2405){_0x2d2405=_0x2d2405||0xcc;return function(_0x37d569){if(_0x37d569){return _0x3bce9f[_0xb872('0x18')](_0x2d2405);}return _0x3bce9f[_0xb872('0x19')](_0x2d2405)[_0xb872('0x1a')]();};}function respondWithResult(_0x4ed139,_0x2faa7c){_0x2faa7c=_0x2faa7c||0xc8;return function(_0xf864d6){if(_0xf864d6){return _0x4ed139['status'](_0x2faa7c)['json'](_0xf864d6);}};}function respondWithFilteredResult(_0x527288,_0xbc1d7a){return function(_0x1cb3d0){if(_0x1cb3d0){var _0x54b7=_0x1cb3d0[_0xb872('0x1b')],_0x274252=_0xbc1d7a[_0xb872('0x1c')],_0x3d3807=_0xbc1d7a['offset']+_0xbc1d7a[_0xb872('0x1d')],_0x542fdc;if(_0x3d3807>=_0x54b7){_0x3d3807=_0x54b7;_0x542fdc=0xc8;}else{_0x542fdc=0xce;}_0x527288['status'](_0x542fdc);return _0x527288['set'](_0xb872('0x1e'),_0x274252+'-'+_0x3d3807+'/'+_0x54b7)['json'](_0x1cb3d0);}return null;};}function patchUpdates(_0x19c073){return function(_0x2be901){try{jsonpatch[_0xb872('0x1f')](_0x2be901,_0x19c073,!![]);}catch(_0x21ac41){return BPromise[_0xb872('0x20')](_0x21ac41);}return _0x2be901[_0xb872('0x21')]();};}function saveUpdates(_0x49d78a,_0x3a0873){return function(_0x1fd0b9){if(_0x1fd0b9){return _0x1fd0b9[_0xb872('0x22')](_0x49d78a)[_0xb872('0x23')](function(_0x3c3822){return _0x3c3822;});}return null;};}function removeEntity(_0x45efd4,_0x4a604b){return function(_0x261932){if(_0x261932){return _0x261932[_0xb872('0x24')]()[_0xb872('0x23')](function(){var _0x2746e9=_0x261932['get']({'plain':!![]});var _0x3dab30=_0xb872('0x25');return db[_0xb872('0x26')][_0xb872('0x24')]({'where':{'type':_0x3dab30,'resourceId':_0x2746e9['id']}})[_0xb872('0x23')](function(){return _0x261932;});})[_0xb872('0x23')](function(){_0x45efd4[_0xb872('0x19')](0xcc)[_0xb872('0x1a')]();});}};}function handleEntityNotFound(_0x589aed,_0x3cd93e){return function(_0x276391){if(!_0x276391){_0x589aed[_0xb872('0x18')](0x194);}return _0x276391;};}function handleError(_0x367f56,_0x2c1f4f){_0x2c1f4f=_0x2c1f4f||0x1f4;return function(_0x58f454){logger[_0xb872('0x27')](_0x58f454[_0xb872('0x28')]);if(_0x58f454['name']){delete _0x58f454[_0xb872('0x29')];}_0x367f56[_0xb872('0x19')](_0x2c1f4f)[_0xb872('0x2a')](_0x58f454);};}exports[_0xb872('0x2b')]=function(_0x11f3f7,_0x54879d){var _0x4309b8={},_0x538847={},_0x2ed2b1={'count':0x0,'rows':[]};var _0x51b4c9=_[_0xb872('0x2c')](db['Pause'][_0xb872('0x2d')],function(_0x536f0f){return{'name':_0x536f0f[_0xb872('0x2e')],'type':_0x536f0f[_0xb872('0x2f')][_0xb872('0x30')]};});_0x538847['model']=_['map'](_0x51b4c9,'name');_0x538847['query']=_[_0xb872('0x31')](_0x11f3f7[_0xb872('0x32')]);_0x538847[_0xb872('0x33')]=_[_0xb872('0x34')](_0x538847[_0xb872('0x35')],_0x538847['query']);_0x4309b8[_0xb872('0x36')]=_[_0xb872('0x34')](_0x538847[_0xb872('0x35')],qs['fields'](_0x11f3f7[_0xb872('0x32')][_0xb872('0x37')]));_0x4309b8[_0xb872('0x36')]=_0x4309b8[_0xb872('0x36')][_0xb872('0x38')]?_0x4309b8['attributes']:_0x538847[_0xb872('0x35')];if(!_0x11f3f7[_0xb872('0x32')][_0xb872('0x39')](_0xb872('0x3a'))){_0x4309b8['limit']=qs[_0xb872('0x1d')](_0x11f3f7['query']['limit']);_0x4309b8[_0xb872('0x1c')]=qs[_0xb872('0x1c')](_0x11f3f7[_0xb872('0x32')]['offset']);}_0x4309b8[_0xb872('0x3b')]=qs[_0xb872('0x3c')](_0x11f3f7[_0xb872('0x32')]['sort']);_0x4309b8[_0xb872('0x3d')]=qs['filters'](_['pick'](_0x11f3f7[_0xb872('0x32')],_0x538847[_0xb872('0x33')]),_0x51b4c9);if(_0x11f3f7[_0xb872('0x32')][_0xb872('0x3e')]){_0x4309b8['where']=_['merge'](_0x4309b8['where'],{'$or':_['map'](_0x51b4c9,function(_0x15699d){if(_0x15699d[_0xb872('0x2f')]!==_0xb872('0x3f')){var _0x311576={};_0x311576[_0x15699d['name']]={'$like':'%'+_0x11f3f7['query'][_0xb872('0x3e')]+'%'};return _0x311576;}})});}_0x4309b8=_[_0xb872('0x40')]({},_0x4309b8,_0x11f3f7[_0xb872('0x41')]);var _0x2520b3={'where':_0x4309b8[_0xb872('0x3d')]};return db['Pause'][_0xb872('0x1b')](_0x2520b3)['then'](function(_0x262fe5){_0x2ed2b1['count']=_0x262fe5;if(_0x11f3f7[_0xb872('0x32')]['includeAll']){_0x4309b8[_0xb872('0x42')]=[{'all':!![]}];}return db[_0xb872('0x43')][_0xb872('0x44')](_0x4309b8);})['then'](function(_0x296545){_0x2ed2b1[_0xb872('0x45')]=_0x296545;return _0x2ed2b1;})[_0xb872('0x23')](respondWithFilteredResult(_0x54879d,_0x4309b8))[_0xb872('0x46')](handleError(_0x54879d,null));};exports[_0xb872('0x47')]=function(_0x565e9f,_0x4298e6){var _0x188c47={'raw':!![],'where':{'id':_0x565e9f['params']['id']}},_0x44a8e1={};_0x44a8e1['model']=_[_0xb872('0x31')](db['Pause'][_0xb872('0x2d')]);_0x44a8e1[_0xb872('0x32')]=_[_0xb872('0x31')](_0x565e9f[_0xb872('0x32')]);_0x44a8e1['filters']=_['intersection'](_0x44a8e1[_0xb872('0x35')],_0x44a8e1[_0xb872('0x32')]);_0x188c47[_0xb872('0x36')]=_[_0xb872('0x34')](_0x44a8e1[_0xb872('0x35')],qs[_0xb872('0x37')](_0x565e9f[_0xb872('0x32')]['fields']));_0x188c47[_0xb872('0x36')]=_0x188c47[_0xb872('0x36')][_0xb872('0x38')]?_0x188c47[_0xb872('0x36')]:_0x44a8e1[_0xb872('0x35')];if(_0x565e9f['query']['includeAll']){_0x188c47[_0xb872('0x42')]=[{'all':!![]}];}_0x188c47=_[_0xb872('0x40')]({},_0x188c47,_0x565e9f[_0xb872('0x41')]);return db[_0xb872('0x43')][_0xb872('0x48')](_0x188c47)[_0xb872('0x23')](handleEntityNotFound(_0x4298e6,null))[_0xb872('0x23')](respondWithResult(_0x4298e6,null))[_0xb872('0x46')](handleError(_0x4298e6,null));};exports['create']=function(_0x34117b,_0x38f3bd){return db[_0xb872('0x43')][_0xb872('0x49')](_0x34117b[_0xb872('0x4a')],{})[_0xb872('0x23')](function(_0x4b9bc5){var _0x3133f8=_0x34117b[_0xb872('0x4b')][_0xb872('0x4c')]({'plain':!![]});if(!_0x3133f8)throw new Error(_0xb872('0x4d'));if(_0x3133f8[_0xb872('0x4e')]===_0xb872('0x4b')){var _0x57d8c4=_0x4b9bc5[_0xb872('0x4c')]({'plain':!![]});var _0x20833d=_0xb872('0x25');return db[_0xb872('0x4f')][_0xb872('0x48')]({'where':{'name':_0x20833d,'userProfileId':_0x3133f8['userProfileId']},'raw':!![]})[_0xb872('0x23')](function(_0x4a51c4){if(_0x4a51c4&&_0x4a51c4['autoAssociation']===0x0){return db[_0xb872('0x26')][_0xb872('0x49')]({'name':_0x57d8c4[_0xb872('0x29')],'resourceId':_0x57d8c4['id'],'type':_0x4a51c4[_0xb872('0x29')],'sectionId':_0x4a51c4['id']},{})[_0xb872('0x23')](function(){return _0x4b9bc5;});}else{return _0x4b9bc5;}})['catch'](function(_0x291ecd){logger[_0xb872('0x27')](_0xb872('0x50'),_0x291ecd);throw _0x291ecd;});}return _0x4b9bc5;})['then'](respondWithResult(_0x38f3bd,0xc9))[_0xb872('0x46')](handleError(_0x38f3bd,null));};exports[_0xb872('0x22')]=function(_0x317df6,_0x33d6c9){if(_0x317df6[_0xb872('0x4a')]['id']){delete _0x317df6[_0xb872('0x4a')]['id'];}return db[_0xb872('0x43')][_0xb872('0x48')]({'where':{'id':_0x317df6[_0xb872('0x51')]['id']}})[_0xb872('0x23')](handleEntityNotFound(_0x33d6c9,null))[_0xb872('0x23')](saveUpdates(_0x317df6[_0xb872('0x4a')],null))['then'](respondWithResult(_0x33d6c9,null))[_0xb872('0x46')](handleError(_0x33d6c9,null));};exports[_0xb872('0x24')]=function(_0x1e7cf4,_0x1b988a){return db[_0xb872('0x43')][_0xb872('0x48')]({'where':{'id':_0x1e7cf4[_0xb872('0x51')]['id']}})[_0xb872('0x23')](handleEntityNotFound(_0x1b988a,null))[_0xb872('0x23')](removeEntity(_0x1b988a,null))[_0xb872('0x46')](handleError(_0x1b988a,null));}; \ No newline at end of file +var _0x2ec1=['sort','where','map','VIRTUAL','filter','merge','include','findAll','catch','show','params','keys','includeAll','options','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','util','path','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','end','status','count','offset','limit','Content-Range','json','apply','reject','save','update','then','destroy','get','Pauses','UserProfileResource','sendStatus','error','stack','name','index','Pause','rawAttributes','fieldName','type','model','filters','intersection','attributes','fields','query','length','hasOwnProperty','nolimit','order'];(function(_0xae43d3,_0x5c8e96){var _0x5b6e06=function(_0x401a4d){while(--_0x401a4d){_0xae43d3['push'](_0xae43d3['shift']());}};_0x5b6e06(++_0x5c8e96);}(_0x2ec1,0x1b0));var _0x12ec=function(_0x55f8b4,_0x43f30d){_0x55f8b4=_0x55f8b4-0x0;var _0x2475f9=_0x2ec1[_0x55f8b4];return _0x2475f9;};'use strict';var pdf=require(_0x12ec('0x0'));var emlformat=require(_0x12ec('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x12ec('0x2'));var jsonpatch=require(_0x12ec('0x3'));var rp=require(_0x12ec('0x4'));var moment=require('moment');var BPromise=require(_0x12ec('0x5'));var Mustache=require('mustache');var util=require(_0x12ec('0x6'));var path=require(_0x12ec('0x7'));var sox=require(_0x12ec('0x8'));var csv=require(_0x12ec('0x9'));var ejs=require(_0x12ec('0xa'));var fs=require('fs');var _=require('lodash');var squel=require(_0x12ec('0xb'));var crypto=require(_0x12ec('0xc'));var jsforce=require(_0x12ec('0xd'));var deskjs=require(_0x12ec('0xe'));var toCsv=require(_0x12ec('0x9'));var querystring=require(_0x12ec('0xf'));var Papa=require('papaparse');var Redis=require(_0x12ec('0x10'));var authService=require(_0x12ec('0x11'));var qs=require(_0x12ec('0x12'));var as=require(_0x12ec('0x13'));var hardwareService=require(_0x12ec('0x14'));var logger=require(_0x12ec('0x15'))(_0x12ec('0x16'));var utils=require('../../config/utils');var config=require(_0x12ec('0x17'));var db=require(_0x12ec('0x18'))['db'];function respondWithStatusCode(_0x4a5665,_0x3e9c6b){_0x3e9c6b=_0x3e9c6b||0xcc;return function(_0x2fc0e3){if(_0x2fc0e3){return _0x4a5665['sendStatus'](_0x3e9c6b);}return _0x4a5665['status'](_0x3e9c6b)[_0x12ec('0x19')]();};}function respondWithResult(_0x524e9c,_0x3cec38){_0x3cec38=_0x3cec38||0xc8;return function(_0x5e3940){if(_0x5e3940){return _0x524e9c[_0x12ec('0x1a')](_0x3cec38)['json'](_0x5e3940);}};}function respondWithFilteredResult(_0x30ccdf,_0x79442f){return function(_0x1c554c){if(_0x1c554c){var _0x221fa7=_0x1c554c[_0x12ec('0x1b')],_0x49aa0c=_0x79442f[_0x12ec('0x1c')],_0x36802f=_0x79442f[_0x12ec('0x1c')]+_0x79442f[_0x12ec('0x1d')],_0x58a684;if(_0x36802f>=_0x221fa7){_0x36802f=_0x221fa7;_0x58a684=0xc8;}else{_0x58a684=0xce;}_0x30ccdf[_0x12ec('0x1a')](_0x58a684);return _0x30ccdf['set'](_0x12ec('0x1e'),_0x49aa0c+'-'+_0x36802f+'/'+_0x221fa7)[_0x12ec('0x1f')](_0x1c554c);}return null;};}function patchUpdates(_0x5cf0e9){return function(_0x42fc7d){try{jsonpatch[_0x12ec('0x20')](_0x42fc7d,_0x5cf0e9,!![]);}catch(_0x4f0476){return BPromise[_0x12ec('0x21')](_0x4f0476);}return _0x42fc7d[_0x12ec('0x22')]();};}function saveUpdates(_0x35dd4c,_0x276c19){return function(_0x453603){if(_0x453603){return _0x453603[_0x12ec('0x23')](_0x35dd4c)[_0x12ec('0x24')](function(_0x377024){return _0x377024;});}return null;};}function removeEntity(_0x20fb76,_0x5aa4b8){return function(_0x2e07e4){if(_0x2e07e4){return _0x2e07e4[_0x12ec('0x25')]()['then'](function(){var _0x46deee=_0x2e07e4[_0x12ec('0x26')]({'plain':!![]});var _0x1524f3=_0x12ec('0x27');return db[_0x12ec('0x28')][_0x12ec('0x25')]({'where':{'type':_0x1524f3,'resourceId':_0x46deee['id']}})[_0x12ec('0x24')](function(){return _0x2e07e4;});})[_0x12ec('0x24')](function(){_0x20fb76[_0x12ec('0x1a')](0xcc)[_0x12ec('0x19')]();});}};}function handleEntityNotFound(_0x521e7e,_0x55a635){return function(_0x4f0421){if(!_0x4f0421){_0x521e7e[_0x12ec('0x29')](0x194);}return _0x4f0421;};}function handleError(_0x27c1cd,_0x2ad070){_0x2ad070=_0x2ad070||0x1f4;return function(_0x316571){logger[_0x12ec('0x2a')](_0x316571[_0x12ec('0x2b')]);if(_0x316571[_0x12ec('0x2c')]){delete _0x316571[_0x12ec('0x2c')];}_0x27c1cd[_0x12ec('0x1a')](_0x2ad070)['send'](_0x316571);};}exports[_0x12ec('0x2d')]=function(_0xea1849,_0x199c2a){var _0x2ffecb={},_0x206deb={},_0x450c84={'count':0x0,'rows':[]};var _0x5aa028=_['map'](db[_0x12ec('0x2e')][_0x12ec('0x2f')],function(_0xaffbbd){return{'name':_0xaffbbd[_0x12ec('0x30')],'type':_0xaffbbd[_0x12ec('0x31')]['key']};});_0x206deb[_0x12ec('0x32')]=_['map'](_0x5aa028,'name');_0x206deb['query']=_['keys'](_0xea1849['query']);_0x206deb[_0x12ec('0x33')]=_[_0x12ec('0x34')](_0x206deb[_0x12ec('0x32')],_0x206deb['query']);_0x2ffecb[_0x12ec('0x35')]=_['intersection'](_0x206deb[_0x12ec('0x32')],qs[_0x12ec('0x36')](_0xea1849[_0x12ec('0x37')][_0x12ec('0x36')]));_0x2ffecb[_0x12ec('0x35')]=_0x2ffecb[_0x12ec('0x35')][_0x12ec('0x38')]?_0x2ffecb[_0x12ec('0x35')]:_0x206deb[_0x12ec('0x32')];if(!_0xea1849[_0x12ec('0x37')][_0x12ec('0x39')](_0x12ec('0x3a'))){_0x2ffecb[_0x12ec('0x1d')]=qs['limit'](_0xea1849[_0x12ec('0x37')]['limit']);_0x2ffecb[_0x12ec('0x1c')]=qs['offset'](_0xea1849['query']['offset']);}_0x2ffecb[_0x12ec('0x3b')]=qs[_0x12ec('0x3c')](_0xea1849[_0x12ec('0x37')][_0x12ec('0x3c')]);_0x2ffecb[_0x12ec('0x3d')]=qs[_0x12ec('0x33')](_['pick'](_0xea1849[_0x12ec('0x37')],_0x206deb['filters']),_0x5aa028);if(_0xea1849['query']['filter']){_0x2ffecb[_0x12ec('0x3d')]=_['merge'](_0x2ffecb[_0x12ec('0x3d')],{'$or':_[_0x12ec('0x3e')](_0x5aa028,function(_0x47a7f3){if(_0x47a7f3[_0x12ec('0x31')]!==_0x12ec('0x3f')){var _0x496338={};_0x496338[_0x47a7f3[_0x12ec('0x2c')]]={'$like':'%'+_0xea1849[_0x12ec('0x37')][_0x12ec('0x40')]+'%'};return _0x496338;}})});}_0x2ffecb=_[_0x12ec('0x41')]({},_0x2ffecb,_0xea1849['options']);var _0x3ab218={'where':_0x2ffecb[_0x12ec('0x3d')]};return db[_0x12ec('0x2e')]['count'](_0x3ab218)['then'](function(_0x100702){_0x450c84[_0x12ec('0x1b')]=_0x100702;if(_0xea1849['query']['includeAll']){_0x2ffecb[_0x12ec('0x42')]=[{'all':!![]}];}return db[_0x12ec('0x2e')][_0x12ec('0x43')](_0x2ffecb);})[_0x12ec('0x24')](function(_0x2ebfd8){_0x450c84['rows']=_0x2ebfd8;return _0x450c84;})['then'](respondWithFilteredResult(_0x199c2a,_0x2ffecb))[_0x12ec('0x44')](handleError(_0x199c2a,null));};exports[_0x12ec('0x45')]=function(_0x1e5b02,_0x2a1abe){var _0x16a758={'raw':!![],'where':{'id':_0x1e5b02[_0x12ec('0x46')]['id']}},_0x5c9f9b={};_0x5c9f9b[_0x12ec('0x32')]=_['keys'](db[_0x12ec('0x2e')]['rawAttributes']);_0x5c9f9b[_0x12ec('0x37')]=_[_0x12ec('0x47')](_0x1e5b02[_0x12ec('0x37')]);_0x5c9f9b['filters']=_[_0x12ec('0x34')](_0x5c9f9b[_0x12ec('0x32')],_0x5c9f9b['query']);_0x16a758[_0x12ec('0x35')]=_[_0x12ec('0x34')](_0x5c9f9b[_0x12ec('0x32')],qs[_0x12ec('0x36')](_0x1e5b02['query'][_0x12ec('0x36')]));_0x16a758[_0x12ec('0x35')]=_0x16a758[_0x12ec('0x35')]['length']?_0x16a758[_0x12ec('0x35')]:_0x5c9f9b[_0x12ec('0x32')];if(_0x1e5b02[_0x12ec('0x37')][_0x12ec('0x48')]){_0x16a758[_0x12ec('0x42')]=[{'all':!![]}];}_0x16a758=_[_0x12ec('0x41')]({},_0x16a758,_0x1e5b02[_0x12ec('0x49')]);return db[_0x12ec('0x2e')][_0x12ec('0x4a')](_0x16a758)[_0x12ec('0x24')](handleEntityNotFound(_0x2a1abe,null))[_0x12ec('0x24')](respondWithResult(_0x2a1abe,null))[_0x12ec('0x44')](handleError(_0x2a1abe,null));};exports[_0x12ec('0x4b')]=function(_0x309f2f,_0x10942b){return db[_0x12ec('0x2e')]['create'](_0x309f2f[_0x12ec('0x4c')],{})['then'](function(_0x1fc764){var _0x3f6a3f=_0x309f2f['user'][_0x12ec('0x26')]({'plain':!![]});if(!_0x3f6a3f)throw new Error(_0x12ec('0x4d'));if(_0x3f6a3f['role']==='user'){var _0x1414c1=_0x1fc764[_0x12ec('0x26')]({'plain':!![]});var _0x45c557=_0x12ec('0x27');return db[_0x12ec('0x4e')]['find']({'where':{'name':_0x45c557,'userProfileId':_0x3f6a3f[_0x12ec('0x4f')]},'raw':!![]})['then'](function(_0x33c9c3){if(_0x33c9c3&&_0x33c9c3[_0x12ec('0x50')]===0x0){return db[_0x12ec('0x28')][_0x12ec('0x4b')]({'name':_0x1414c1[_0x12ec('0x2c')],'resourceId':_0x1414c1['id'],'type':_0x33c9c3[_0x12ec('0x2c')],'sectionId':_0x33c9c3['id']},{})[_0x12ec('0x24')](function(){return _0x1fc764;});}else{return _0x1fc764;}})[_0x12ec('0x44')](function(_0x392879){logger[_0x12ec('0x2a')](_0x12ec('0x51'),_0x392879);throw _0x392879;});}return _0x1fc764;})[_0x12ec('0x24')](respondWithResult(_0x10942b,0xc9))[_0x12ec('0x44')](handleError(_0x10942b,null));};exports[_0x12ec('0x23')]=function(_0x5f0ea2,_0x5ca23a){if(_0x5f0ea2[_0x12ec('0x4c')]['id']){delete _0x5f0ea2[_0x12ec('0x4c')]['id'];}return db['Pause'][_0x12ec('0x4a')]({'where':{'id':_0x5f0ea2[_0x12ec('0x46')]['id']}})[_0x12ec('0x24')](handleEntityNotFound(_0x5ca23a,null))['then'](saveUpdates(_0x5f0ea2[_0x12ec('0x4c')],null))['then'](respondWithResult(_0x5ca23a,null))[_0x12ec('0x44')](handleError(_0x5ca23a,null));};exports[_0x12ec('0x25')]=function(_0x37d7ac,_0x22cfae){return db[_0x12ec('0x2e')]['find']({'where':{'id':_0x37d7ac[_0x12ec('0x46')]['id']}})[_0x12ec('0x24')](handleEntityNotFound(_0x22cfae,null))[_0x12ec('0x24')](removeEntity(_0x22cfae,null))['catch'](handleError(_0x22cfae,null));}; \ No newline at end of file diff --git a/server/api/pause/pause.model.js b/server/api/pause/pause.model.js index ad51145..c385fc5 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 _0x3c12=['Pause','tools_pauses','lodash','util','../../config/logger','api','moment','bluebird','path','../../config/environment','./pause.attributes','exports'];(function(_0x46ed68,_0x28f782){var _0x1644ea=function(_0x3fff47){while(--_0x3fff47){_0x46ed68['push'](_0x46ed68['shift']());}};_0x1644ea(++_0x28f782);}(_0x3c12,0xc2));var _0x23c1=function(_0x3f2d02,_0x2c7deb){_0x3f2d02=_0x3f2d02-0x0;var _0x54092b=_0x3c12[_0x3f2d02];return _0x54092b;};'use strict';var _=require(_0x23c1('0x0'));var util=require(_0x23c1('0x1'));var logger=require(_0x23c1('0x2'))(_0x23c1('0x3'));var moment=require(_0x23c1('0x4'));var BPromise=require(_0x23c1('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x23c1('0x6'));var rimraf=require('rimraf');var config=require(_0x23c1('0x7'));var attributes=require(_0x23c1('0x8'));module[_0x23c1('0x9')]=function(_0x36888d,_0x41a7a6){return _0x36888d['define'](_0x23c1('0xa'),attributes,{'tableName':_0x23c1('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5ae8=['rimraf','./pause.attributes','exports','tools_pauses','lodash','util','moment','bluebird','request-promise'];(function(_0x3a9d7b,_0x5c4c90){var _0xdb2023=function(_0x55592a){while(--_0x55592a){_0x3a9d7b['push'](_0x3a9d7b['shift']());}};_0xdb2023(++_0x5c4c90);}(_0x5ae8,0x1ab));var _0x85ae=function(_0x1e500e,_0x2c9d74){_0x1e500e=_0x1e500e-0x0;var _0x10dc5e=_0x5ae8[_0x1e500e];return _0x10dc5e;};'use strict';var _=require(_0x85ae('0x0'));var util=require(_0x85ae('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x85ae('0x2'));var BPromise=require(_0x85ae('0x3'));var rp=require(_0x85ae('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x85ae('0x5'));var config=require('../../config/environment');var attributes=require(_0x85ae('0x6'));module[_0x85ae('0x7')]=function(_0x48e833,_0x247910){return _0x48e833['define']('Pause',attributes,{'tableName':_0x85ae('0x8'),'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 5b157ea..4f9fdef 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 _0x1333=['debug','Pause,\x20%s,\x20%s,\x20%s','stringify','error','code','Pause,\x20%s,\x20%s','message','result','catch','ShowPause','Pause','find','options','raw','where','attributes','include','map','model','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','request','then','info','request\x20sent'];(function(_0x55d972,_0x374696){var _0x413cfb=function(_0x4bbd9a){while(--_0x4bbd9a){_0x55d972['push'](_0x55d972['shift']());}};_0x413cfb(++_0x374696);}(_0x1333,0x167));var _0x3133=function(_0x15c32d,_0x165e1c){_0x15c32d=_0x15c32d-0x0;var _0x590220=_0x1333[_0x15c32d];return _0x590220;};'use strict';var _=require(_0x3133('0x0'));var util=require(_0x3133('0x1'));var moment=require(_0x3133('0x2'));var BPromise=require(_0x3133('0x3'));var rs=require(_0x3133('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x3133('0x5'))['db'];var utils=require(_0x3133('0x6'));var logger=require(_0x3133('0x7'))(_0x3133('0x8'));var config=require('../../config/environment');var jayson=require(_0x3133('0x9'));var client=jayson['client'][_0x3133('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4a92dd,_0x2742ca,_0x514807){return new BPromise(function(_0x433eb1,_0x34c700){return client[_0x3133('0xb')](_0x4a92dd,_0x514807)[_0x3133('0xc')](function(_0xa5048b){logger[_0x3133('0xd')]('Pause,\x20%s,\x20%s',_0x2742ca,_0x3133('0xe'));logger[_0x3133('0xf')](_0x3133('0x10'),_0x2742ca,_0x3133('0xe'),JSON[_0x3133('0x11')](_0xa5048b));if(_0xa5048b[_0x3133('0x12')]){if(_0xa5048b[_0x3133('0x12')][_0x3133('0x13')]===0x1f4){logger[_0x3133('0x12')](_0x3133('0x14'),_0x2742ca,_0xa5048b[_0x3133('0x12')]['message']);return _0x34c700(_0xa5048b['error'][_0x3133('0x15')]);}logger[_0x3133('0x12')](_0x3133('0x14'),_0x2742ca,_0xa5048b[_0x3133('0x12')][_0x3133('0x15')]);return _0x433eb1(_0xa5048b[_0x3133('0x12')][_0x3133('0x15')]);}else{logger[_0x3133('0xd')]('Pause,\x20%s,\x20%s',_0x2742ca,'request\x20sent');_0x433eb1(_0xa5048b[_0x3133('0x16')][_0x3133('0x15')]);}})[_0x3133('0x17')](function(_0x310f3e){logger[_0x3133('0x12')]('Pause,\x20%s,\x20%s',_0x2742ca,_0x310f3e);_0x34c700(_0x310f3e);});});}exports[_0x3133('0x18')]=function(_0x4ae566){var _0x2760e5=this;return new Promise(function(_0x2dae7c,_0x31029a){return db[_0x3133('0x19')][_0x3133('0x1a')]({'raw':_0x4ae566[_0x3133('0x1b')]?_0x4ae566[_0x3133('0x1b')][_0x3133('0x1c')]===undefined?!![]:![]:!![],'where':_0x4ae566[_0x3133('0x1b')]?_0x4ae566[_0x3133('0x1b')][_0x3133('0x1d')]||null:null,'attributes':_0x4ae566[_0x3133('0x1b')]?_0x4ae566[_0x3133('0x1b')][_0x3133('0x1e')]||null:null,'include':_0x4ae566[_0x3133('0x1b')]?_0x4ae566[_0x3133('0x1b')][_0x3133('0x1f')]?_[_0x3133('0x20')](_0x4ae566['options'][_0x3133('0x1f')],function(_0x2fdc14){return{'model':db[_0x2fdc14[_0x3133('0x21')]],'as':_0x2fdc14['as'],'attributes':_0x2fdc14[_0x3133('0x1e')],'include':_0x2fdc14[_0x3133('0x1f')]?_[_0x3133('0x20')](_0x2fdc14[_0x3133('0x1f')],function(_0x33590b){return{'model':db[_0x33590b['model']],'as':_0x33590b['as'],'attributes':_0x33590b['attributes'],'include':_0x33590b['include']?_[_0x3133('0x20')](_0x33590b[_0x3133('0x1f')],function(_0x1f15f2){return{'model':db[_0x1f15f2[_0x3133('0x21')]],'as':_0x1f15f2['as'],'attributes':_0x1f15f2['attributes']};}):[]};}):[]};}):[]:[]})[_0x3133('0xc')](function(_0x52289d){logger['info'](_0x3133('0x18'),_0x4ae566);logger['debug'](_0x3133('0x18'),_0x4ae566,JSON['stringify'](_0x52289d));_0x2dae7c(_0x52289d);})['catch'](function(_0x5543e7){logger[_0x3133('0x12')](_0x3133('0x18'),_0x5543e7[_0x3133('0x15')],_0x4ae566);_0x31029a(_0x2760e5[_0x3133('0x12')](0x1f4,_0x5543e7[_0x3133('0x15')]));});});}; \ No newline at end of file +var _0x98d3=['result','catch','options','raw','where','include','map','attributes','model','then','ShowPause','lodash','util','bluebird','ioredis','../../config/utils','../../config/logger','jayson/promise','client','http','request','info','Pause,\x20%s,\x20%s','request\x20sent','debug','Pause,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x384ffc,_0x90eb09){var _0x2a2f01=function(_0x443695){while(--_0x443695){_0x384ffc['push'](_0x384ffc['shift']());}};_0x2a2f01(++_0x90eb09);}(_0x98d3,0x173));var _0x398d=function(_0xd2bbaf,_0x246a1b){_0xd2bbaf=_0xd2bbaf-0x0;var _0x17e278=_0x98d3[_0xd2bbaf];return _0x17e278;};'use strict';var _=require(_0x398d('0x0'));var util=require(_0x398d('0x1'));var moment=require('moment');var BPromise=require(_0x398d('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x398d('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x398d('0x4'));var logger=require(_0x398d('0x5'))('rpc');var config=require('../../config/environment');var jayson=require(_0x398d('0x6'));var client=jayson[_0x398d('0x7')][_0x398d('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x502652,_0x4ba1a3,_0x391d99){return new BPromise(function(_0x3029f3,_0x399598){return client[_0x398d('0x9')](_0x502652,_0x391d99)['then'](function(_0x3a1934){logger[_0x398d('0xa')](_0x398d('0xb'),_0x4ba1a3,_0x398d('0xc'));logger[_0x398d('0xd')](_0x398d('0xe'),_0x4ba1a3,_0x398d('0xc'),JSON[_0x398d('0xf')](_0x3a1934));if(_0x3a1934['error']){if(_0x3a1934[_0x398d('0x10')][_0x398d('0x11')]===0x1f4){logger[_0x398d('0x10')](_0x398d('0xb'),_0x4ba1a3,_0x3a1934[_0x398d('0x10')][_0x398d('0x12')]);return _0x399598(_0x3a1934[_0x398d('0x10')][_0x398d('0x12')]);}logger[_0x398d('0x10')](_0x398d('0xb'),_0x4ba1a3,_0x3a1934[_0x398d('0x10')]['message']);return _0x3029f3(_0x3a1934['error'][_0x398d('0x12')]);}else{logger[_0x398d('0xa')](_0x398d('0xb'),_0x4ba1a3,_0x398d('0xc'));_0x3029f3(_0x3a1934[_0x398d('0x13')][_0x398d('0x12')]);}})[_0x398d('0x14')](function(_0x3c151a){logger['error'](_0x398d('0xb'),_0x4ba1a3,_0x3c151a);_0x399598(_0x3c151a);});});}exports['ShowPause']=function(_0x673840){var _0x476c36=this;return new Promise(function(_0x297768,_0x5de1be){return db['Pause']['find']({'raw':_0x673840[_0x398d('0x15')]?_0x673840[_0x398d('0x15')][_0x398d('0x16')]===undefined?!![]:![]:!![],'where':_0x673840[_0x398d('0x15')]?_0x673840[_0x398d('0x15')][_0x398d('0x17')]||null:null,'attributes':_0x673840[_0x398d('0x15')]?_0x673840['options']['attributes']||null:null,'include':_0x673840['options']?_0x673840[_0x398d('0x15')][_0x398d('0x18')]?_[_0x398d('0x19')](_0x673840[_0x398d('0x15')][_0x398d('0x18')],function(_0x557df7){return{'model':db[_0x557df7['model']],'as':_0x557df7['as'],'attributes':_0x557df7[_0x398d('0x1a')],'include':_0x557df7[_0x398d('0x18')]?_['map'](_0x557df7[_0x398d('0x18')],function(_0x38d8da){return{'model':db[_0x38d8da['model']],'as':_0x38d8da['as'],'attributes':_0x38d8da['attributes'],'include':_0x38d8da['include']?_[_0x398d('0x19')](_0x38d8da[_0x398d('0x18')],function(_0x24fa2c){return{'model':db[_0x24fa2c[_0x398d('0x1b')]],'as':_0x24fa2c['as'],'attributes':_0x24fa2c[_0x398d('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x398d('0x1c')](function(_0xc9c9b7){logger[_0x398d('0xa')]('ShowPause',_0x673840);logger[_0x398d('0xd')]('ShowPause',_0x673840,JSON['stringify'](_0xc9c9b7));_0x297768(_0xc9c9b7);})[_0x398d('0x14')](function(_0x27bc6e){logger['error'](_0x398d('0x1d'),_0x27bc6e['message'],_0x673840);_0x5de1be(_0x476c36[_0x398d('0x10')](0x1f4,_0x27bc6e[_0x398d('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/plugin/index.js b/server/api/plugin/index.js index fa77bca..fb89705 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 _0xacef=['single','file','upload','post','/webhook','webhookPost','put','update','delete','exports','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./plugin.controller','get','isAuthenticated','index','/:id','show','/:id/download','download','diskStorage','join','root','server/files/plugins','originalname','replace','format','%s-%s%s','basename','extname','now'];(function(_0x11a07a,_0x20407f){var _0x2d00d6=function(_0x36da3b){while(--_0x36da3b){_0x11a07a['push'](_0x11a07a['shift']());}};_0x2d00d6(++_0x20407f);}(_0xacef,0x14e));var _0xface=function(_0x4a7c88,_0x1e69dc){_0x4a7c88=_0x4a7c88-0x0;var _0x1fb4b7=_0xacef[_0x4a7c88];return _0x1fb4b7;};'use strict';var multer=require('multer');var util=require(_0xface('0x0'));var path=require(_0xface('0x1'));var timeout=require(_0xface('0x2'));var express=require(_0xface('0x3'));var router=express['Router']();var auth=require(_0xface('0x4'));var interaction=require(_0xface('0x5'));var config=require(_0xface('0x6'));var controller=require(_0xface('0x7'));router[_0xface('0x8')]('/',auth[_0xface('0x9')](),controller[_0xface('0xa')]);router[_0xface('0x8')]('/webhook',controller['webhookGet']);router[_0xface('0x8')](_0xface('0xb'),auth[_0xface('0x9')](),controller[_0xface('0xc')]);router['get'](_0xface('0xd'),auth[_0xface('0x9')](),controller[_0xface('0xe')]);var upload=multer({'storage':multer[_0xface('0xf')]({'destination':function(_0x44ac0a,_0x233576,_0x1a5cdc){_0x1a5cdc(null,path[_0xface('0x10')](config[_0xface('0x11')],_0xface('0x12')));},'filename':function(_0x175244,_0x4a3470,_0x53e2e6){_0x4a3470[_0xface('0x13')]=_0x4a3470[_0xface('0x13')][_0xface('0x14')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x53e2e6(null,util[_0xface('0x15')](_0xface('0x16'),path[_0xface('0x17')](_0x4a3470[_0xface('0x13')],path[_0xface('0x18')](_0x4a3470[_0xface('0x13')])),Date[_0xface('0x19')](),path[_0xface('0x18')](_0x4a3470[_0xface('0x13')])));}})});router['post']('/',upload[_0xface('0x1a')](_0xface('0x1b')),controller[_0xface('0x1c')]);router[_0xface('0x1d')](_0xface('0x1e'),controller[_0xface('0x1f')]);router[_0xface('0x20')](_0xface('0xb'),auth[_0xface('0x9')](),controller[_0xface('0x21')]);router[_0xface('0x22')](_0xface('0xb'),auth['isAuthenticated'](),controller[_0xface('0x22')]);module[_0xface('0x23')]=router; \ No newline at end of file +var _0x7546=['put','update','delete','exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','/webhook','webhookGet','/:id','/:id/download','isAuthenticated','download','diskStorage','server/files/plugins','originalname','format','%s-%s%s','basename','extname','post','single','webhookPost'];(function(_0x14f06c,_0x45a1ef){var _0x5d44c9=function(_0x244ae7){while(--_0x244ae7){_0x14f06c['push'](_0x14f06c['shift']());}};_0x5d44c9(++_0x45a1ef);}(_0x7546,0x1c6));var _0x6754=function(_0xfaada0,_0x5c3ed0){_0xfaada0=_0xfaada0-0x0;var _0x2f7a85=_0x7546[_0xfaada0];return _0x2f7a85;};'use strict';var multer=require('multer');var util=require(_0x6754('0x0'));var path=require(_0x6754('0x1'));var timeout=require(_0x6754('0x2'));var express=require(_0x6754('0x3'));var router=express[_0x6754('0x4')]();var auth=require(_0x6754('0x5'));var interaction=require(_0x6754('0x6'));var config=require(_0x6754('0x7'));var controller=require('./plugin.controller');router[_0x6754('0x8')]('/',auth['isAuthenticated'](),controller[_0x6754('0x9')]);router[_0x6754('0x8')](_0x6754('0xa'),controller[_0x6754('0xb')]);router[_0x6754('0x8')](_0x6754('0xc'),auth['isAuthenticated'](),controller['show']);router[_0x6754('0x8')](_0x6754('0xd'),auth[_0x6754('0xe')](),controller[_0x6754('0xf')]);var upload=multer({'storage':multer[_0x6754('0x10')]({'destination':function(_0x4dd597,_0x46bf98,_0x410f2f){_0x410f2f(null,path['join'](config['root'],_0x6754('0x11')));},'filename':function(_0x4c0c91,_0x2637e9,_0x9e65a7){_0x2637e9[_0x6754('0x12')]=_0x2637e9[_0x6754('0x12')]['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x9e65a7(null,util[_0x6754('0x13')](_0x6754('0x14'),path[_0x6754('0x15')](_0x2637e9['originalname'],path[_0x6754('0x16')](_0x2637e9[_0x6754('0x12')])),Date['now'](),path[_0x6754('0x16')](_0x2637e9[_0x6754('0x12')])));}})});router[_0x6754('0x17')]('/',upload[_0x6754('0x18')]('file'),controller['upload']);router['post'](_0x6754('0xa'),controller[_0x6754('0x19')]);router[_0x6754('0x1a')]('/:id',auth[_0x6754('0xe')](),controller[_0x6754('0x1b')]);router['delete'](_0x6754('0xc'),auth[_0x6754('0xe')](),controller[_0x6754('0x1c')]);module[_0x6754('0x1d')]=router; \ No newline at end of file diff --git a/server/api/plugin/plugin.attributes.js b/server/api/plugin/plugin.attributes.js index e39691c..1883480 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 _0x6db6=['html','script','TEXT','The\x20physical\x20path\x20where\x20the\x20plugin\x20is\x20stored.','Indicates\x20whether\x20the\x20plugin\x20is\x20installed.\x20Updated\x20when\x20the\x20plugin\x20is\x20installed/uninstalled.','adminOnly','agentOnly','always','exports','STRING','ENUM'];(function(_0x2b2375,_0x31530b){var _0x258f3a=function(_0x1ccd20){while(--_0x1ccd20){_0x2b2375['push'](_0x2b2375['shift']());}};_0x258f3a(++_0x31530b);}(_0x6db6,0x173));var _0x66db=function(_0x3b23dd,_0x49f17d){_0x3b23dd=_0x3b23dd-0x0;var _0x4305e4=_0x6db6[_0x3b23dd];return _0x4305e4;};'use strict';var Sequelize=require('sequelize');module[_0x66db('0x0')]={'name':{'type':Sequelize[_0x66db('0x1')]},'type':{'type':Sequelize[_0x66db('0x2')](_0x66db('0x3'),_0x66db('0x4'))},'description':{'type':Sequelize[_0x66db('0x5')]},'version':{'type':Sequelize[_0x66db('0x5')]},'path':{'type':Sequelize[_0x66db('0x1')],'comment':_0x66db('0x6')},'active':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':_0x66db('0x7')},'sidebar':{'type':Sequelize['ENUM'](_0x66db('0x8'),_0x66db('0x9'),_0x66db('0xa'),'never'),'defaultValue':_0x66db('0xa'),'comment':'Indicates\x20whether\x20to\x20display\x20the\x20plugin\x20in\x20the\x20sidebar.'},'icon':{'type':Sequelize[_0x66db('0x1')]},'adminUrl':{'type':Sequelize[_0x66db('0x1')]},'agentUrl':{'type':Sequelize['STRING']},'scriptName':{'type':Sequelize[_0x66db('0x1')]},'scriptPath':{'type':Sequelize[_0x66db('0x1')]}}; \ No newline at end of file +var _0xf675=['adminOnly','never','always','exports','STRING','ENUM','html','script','BOOLEAN'];(function(_0x29b8ec,_0x40ff5a){var _0xe1b982=function(_0x464e01){while(--_0x464e01){_0x29b8ec['push'](_0x29b8ec['shift']());}};_0xe1b982(++_0x40ff5a);}(_0xf675,0xae));var _0x5f67=function(_0x10df18,_0x13338c){_0x10df18=_0x10df18-0x0;var _0x1f9a1d=_0xf675[_0x10df18];return _0x1f9a1d;};'use strict';var Sequelize=require('sequelize');module[_0x5f67('0x0')]={'name':{'type':Sequelize[_0x5f67('0x1')]},'type':{'type':Sequelize[_0x5f67('0x2')](_0x5f67('0x3'),_0x5f67('0x4'))},'description':{'type':Sequelize['TEXT']},'version':{'type':Sequelize['TEXT']},'path':{'type':Sequelize['STRING'],'comment':'The\x20physical\x20path\x20where\x20the\x20plugin\x20is\x20stored.'},'active':{'type':Sequelize[_0x5f67('0x5')],'defaultValue':0x0,'comment':'Indicates\x20whether\x20the\x20plugin\x20is\x20installed.\x20Updated\x20when\x20the\x20plugin\x20is\x20installed/uninstalled.'},'sidebar':{'type':Sequelize['ENUM'](_0x5f67('0x6'),'agentOnly','always',_0x5f67('0x7')),'defaultValue':_0x5f67('0x8'),'comment':'Indicates\x20whether\x20to\x20display\x20the\x20plugin\x20in\x20the\x20sidebar.'},'icon':{'type':Sequelize[_0x5f67('0x1')]},'adminUrl':{'type':Sequelize[_0x5f67('0x1')]},'agentUrl':{'type':Sequelize[_0x5f67('0x1')]},'scriptName':{'type':Sequelize['STRING']},'scriptPath':{'type':Sequelize[_0x5f67('0x1')]}}; \ No newline at end of file diff --git a/server/api/plugin/plugin.controller.js b/server/api/plugin/plugin.controller.js index b4aef26..b2c75f2 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 _0x804e=['webhookGet','resolve','port','\x27PORT\x27\x20parameter\x20not\x20specified','hostname','encoding','%s%s','headers','content-length','content-type','statusCode','webhookPost','http://localhost:','method','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','papaparse','extract-zip','archiver','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../mysqldb','redis','defaults','localhost','./plugin.socket','register','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','get','Plugins','UserProfileResource','destroy','then','error','stack','name','index','Plugin','rawAttributes','fieldName','type','key','model','map','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','include','findAll','rows','show','params','keys','find','catch','path','join','root','server/files/plugins','format','%s.zip','basename','createWriteStream','zip','warning','code','ENOENT','Sequelize','Error','Error\x20while\x20generating\x20the\x20zip\x20archive','pipe','glob','attachments/**/*','finalize','close','existsSync','Plugin\x20not\x20found','download','Error\x20while\x20downloading\x20the\x20plugin','info','Download\x20completed','Temporary\x20file\x20removed','upload','file','extname','filename','Plugin\x20upload\x20destination:\x20%s','chmodSync','0777','readdirSync','Invalid\x20plugin\x20structure','isDirectory','some','manifest.json','Plugin\x20manifest\x20missing','parse','Invalid\x20manifest:\x20name\x20missing','Invalid\x20manifest:\x20type\x20missing','undefined','version','Invalid\x20manifest:\x20version\x20not\x20specified','parameters','Invalid\x20manifest:\x20parameters\x20missing','html','views','Invalid\x20manifest:\x20views\x20missing','admin','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','test','plugins','Warning:\x20admin\x20view\x20not\x20specified','Warning:\x20agent\x20view\x20not\x20specified','create','body','userProfileId','Unable\x20to\x20retrieve\x20the\x20current\x20user','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','send','unlinkSync','Extracted\x20folder\x20removed','dirname'];(function(_0x59eefb,_0x2151ce){var _0x1a49e8=function(_0x5a758c){while(--_0x5a758c){_0x59eefb['push'](_0x59eefb['shift']());}};_0x1a49e8(++_0x2151ce);}(_0x804e,0xc0));var _0xe804=function(_0x2533e8,_0x11edb7){_0x2533e8=_0x2533e8-0x0;var _0x57637d=_0x804e[_0x2533e8];return _0x57637d;};'use strict';var pdf=require(_0xe804('0x0'));var emlformat=require(_0xe804('0x1'));var rimraf=require(_0xe804('0x2'));var zipdir=require(_0xe804('0x3'));var jsonpatch=require(_0xe804('0x4'));var rp=require(_0xe804('0x5'));var moment=require('moment');var BPromise=require(_0xe804('0x6'));var Mustache=require(_0xe804('0x7'));var util=require(_0xe804('0x8'));var path=require('path');var sox=require('sox');var csv=require(_0xe804('0x9'));var ejs=require(_0xe804('0xa'));var fs=require('fs');var _=require(_0xe804('0xb'));var squel=require(_0xe804('0xc'));var crypto=require(_0xe804('0xd'));var jsforce=require(_0xe804('0xe'));var deskjs=require(_0xe804('0xf'));var toCsv=require(_0xe804('0x9'));var querystring=require('querystring');var Papa=require(_0xe804('0x10'));var extract=require(_0xe804('0x11'));var rimraf=require('rimraf');var archiver=require(_0xe804('0x12'));var Redis=require(_0xe804('0x13'));var authService=require(_0xe804('0x14'));var qs=require(_0xe804('0x15'));var as=require(_0xe804('0x16'));var hardwareService=require(_0xe804('0x17'));var logger=require(_0xe804('0x18'))('api');var utils=require('../../config/utils');var config=require(_0xe804('0x19'));var db=require(_0xe804('0x1a'))['db'];config[_0xe804('0x1b')]=_[_0xe804('0x1c')](config[_0xe804('0x1b')],{'host':_0xe804('0x1d'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xe804('0x1b')]));require(_0xe804('0x1e'))[_0xe804('0x1f')](socket);function respondWithStatusCode(_0x5831d7,_0x5c1ba6){_0x5c1ba6=_0x5c1ba6||0xcc;return function(_0x4cf0e7){if(_0x4cf0e7){return _0x5831d7[_0xe804('0x20')](_0x5c1ba6);}return _0x5831d7[_0xe804('0x21')](_0x5c1ba6)[_0xe804('0x22')]();};}function respondWithResult(_0x43c365,_0x5d2103){_0x5d2103=_0x5d2103||0xc8;return function(_0x5ed320){if(_0x5ed320){return _0x43c365[_0xe804('0x21')](_0x5d2103)[_0xe804('0x23')](_0x5ed320);}};}function respondWithFilteredResult(_0x16ffa4,_0x237e83){return function(_0x11ad8a){if(_0x11ad8a){var _0x440dce=_0x11ad8a[_0xe804('0x24')],_0xd8ddc0=_0x237e83[_0xe804('0x25')],_0x316cd2=_0x237e83['offset']+_0x237e83[_0xe804('0x26')],_0x49963a;if(_0x316cd2>=_0x440dce){_0x316cd2=_0x440dce;_0x49963a=0xc8;}else{_0x49963a=0xce;}_0x16ffa4[_0xe804('0x21')](_0x49963a);return _0x16ffa4[_0xe804('0x27')](_0xe804('0x28'),_0xd8ddc0+'-'+_0x316cd2+'/'+_0x440dce)[_0xe804('0x23')](_0x11ad8a);}return null;};}function patchUpdates(_0x5cf652){return function(_0x3758df){try{jsonpatch[_0xe804('0x29')](_0x3758df,_0x5cf652,!![]);}catch(_0x548714){return BPromise[_0xe804('0x2a')](_0x548714);}return _0x3758df[_0xe804('0x2b')]();};}function saveUpdates(_0x157b29,_0x3706af){return function(_0x4ee6c1){if(_0x4ee6c1){return _0x4ee6c1[_0xe804('0x2c')](_0x157b29)['then'](function(_0x4100cc){return _0x4100cc;});}return null;};}function removeEntity(_0x335fce,_0x22c6d1){return function(_0x23c817){if(_0x23c817){return _0x23c817['destroy']()['then'](function(){var _0x5a91b9=_0x23c817[_0xe804('0x2d')]({'plain':!![]});var _0x3cb9d2=_0xe804('0x2e');return db[_0xe804('0x2f')][_0xe804('0x30')]({'where':{'type':_0x3cb9d2,'resourceId':_0x5a91b9['id']}})[_0xe804('0x31')](function(){return _0x23c817;});})[_0xe804('0x31')](function(){_0x335fce[_0xe804('0x21')](0xcc)[_0xe804('0x22')]();});}};}function handleEntityNotFound(_0x268bfe,_0x1de4f9){return function(_0x5c2623){if(!_0x5c2623){_0x268bfe[_0xe804('0x20')](0x194);}return _0x5c2623;};}function handleError(_0xef06ef,_0x3406e5){_0x3406e5=_0x3406e5||0x1f4;return function(_0x3d532a){logger[_0xe804('0x32')](_0x3d532a[_0xe804('0x33')]);if(_0x3d532a[_0xe804('0x34')]){delete _0x3d532a['name'];}_0xef06ef[_0xe804('0x21')](_0x3406e5)['send'](_0x3d532a);};}exports[_0xe804('0x35')]=function(_0x4dc70f,_0x119cf0){var _0x4ee2c9={},_0x2d627b={},_0x2378b3={'count':0x0,'rows':[]};var _0x51e4be=_['map'](db[_0xe804('0x36')][_0xe804('0x37')],function(_0x58f671){return{'name':_0x58f671[_0xe804('0x38')],'type':_0x58f671[_0xe804('0x39')][_0xe804('0x3a')]};});_0x2d627b[_0xe804('0x3b')]=_[_0xe804('0x3c')](_0x51e4be,'name');_0x2d627b[_0xe804('0x3d')]=_['keys'](_0x4dc70f[_0xe804('0x3d')]);_0x2d627b[_0xe804('0x3e')]=_[_0xe804('0x3f')](_0x2d627b[_0xe804('0x3b')],_0x2d627b[_0xe804('0x3d')]);_0x4ee2c9[_0xe804('0x40')]=_['intersection'](_0x2d627b[_0xe804('0x3b')],qs[_0xe804('0x41')](_0x4dc70f['query']['fields']));_0x4ee2c9[_0xe804('0x40')]=_0x4ee2c9[_0xe804('0x40')][_0xe804('0x42')]?_0x4ee2c9['attributes']:_0x2d627b[_0xe804('0x3b')];if(!_0x4dc70f[_0xe804('0x3d')][_0xe804('0x43')](_0xe804('0x44'))){_0x4ee2c9['limit']=qs['limit'](_0x4dc70f['query'][_0xe804('0x26')]);_0x4ee2c9['offset']=qs[_0xe804('0x25')](_0x4dc70f[_0xe804('0x3d')][_0xe804('0x25')]);}_0x4ee2c9[_0xe804('0x45')]=qs[_0xe804('0x46')](_0x4dc70f[_0xe804('0x3d')][_0xe804('0x46')]);_0x4ee2c9[_0xe804('0x47')]=qs[_0xe804('0x3e')](_[_0xe804('0x48')](_0x4dc70f[_0xe804('0x3d')],_0x2d627b['filters']),_0x51e4be);if(_0x4dc70f[_0xe804('0x3d')][_0xe804('0x49')]){_0x4ee2c9[_0xe804('0x47')]=_['merge'](_0x4ee2c9[_0xe804('0x47')],{'$or':_[_0xe804('0x3c')](_0x51e4be,function(_0x1f58d4){if(_0x1f58d4[_0xe804('0x39')]!==_0xe804('0x4a')){var _0x1b5728={};_0x1b5728[_0x1f58d4[_0xe804('0x34')]]={'$like':'%'+_0x4dc70f[_0xe804('0x3d')][_0xe804('0x49')]+'%'};return _0x1b5728;}})});}_0x4ee2c9=_[_0xe804('0x4b')]({},_0x4ee2c9,_0x4dc70f[_0xe804('0x4c')]);var _0x271b86={'where':_0x4ee2c9[_0xe804('0x47')]};return db[_0xe804('0x36')][_0xe804('0x24')](_0x271b86)[_0xe804('0x31')](function(_0x3f623){_0x2378b3[_0xe804('0x24')]=_0x3f623;if(_0x4dc70f['query'][_0xe804('0x4d')]){_0x4ee2c9[_0xe804('0x4e')]=[{'all':!![]}];}return db[_0xe804('0x36')][_0xe804('0x4f')](_0x4ee2c9);})[_0xe804('0x31')](function(_0x35fe27){_0x2378b3[_0xe804('0x50')]=_0x35fe27;return _0x2378b3;})[_0xe804('0x31')](respondWithFilteredResult(_0x119cf0,_0x4ee2c9))['catch'](handleError(_0x119cf0,null));};exports[_0xe804('0x51')]=function(_0x23e268,_0x7b09d2){var _0x16a080={'raw':!![],'where':{'id':_0x23e268[_0xe804('0x52')]['id']}},_0x145757={};_0x145757[_0xe804('0x3b')]=_[_0xe804('0x53')](db[_0xe804('0x36')][_0xe804('0x37')]);_0x145757[_0xe804('0x3d')]=_[_0xe804('0x53')](_0x23e268['query']);_0x145757['filters']=_[_0xe804('0x3f')](_0x145757[_0xe804('0x3b')],_0x145757[_0xe804('0x3d')]);_0x16a080[_0xe804('0x40')]=_[_0xe804('0x3f')](_0x145757[_0xe804('0x3b')],qs[_0xe804('0x41')](_0x23e268['query'][_0xe804('0x41')]));_0x16a080['attributes']=_0x16a080[_0xe804('0x40')][_0xe804('0x42')]?_0x16a080[_0xe804('0x40')]:_0x145757[_0xe804('0x3b')];if(_0x23e268['query'][_0xe804('0x4d')]){_0x16a080['include']=[{'all':!![]}];}_0x16a080=_[_0xe804('0x4b')]({},_0x16a080,_0x23e268['options']);return db[_0xe804('0x36')][_0xe804('0x54')](_0x16a080)[_0xe804('0x31')](handleEntityNotFound(_0x7b09d2,null))[_0xe804('0x31')](respondWithResult(_0x7b09d2,null))[_0xe804('0x55')](handleError(_0x7b09d2,null));};exports['download']=function(_0x544d97,_0x570aca,_0x56ef85){return db['Plugin']['find']({'where':{'id':_0x544d97[_0xe804('0x52')]['id']},'attributes':['name',_0xe804('0x56')],'raw':!![]})['then'](handleEntityNotFound(_0x570aca,null))[_0xe804('0x31')](function(_0x3e7d87){if(_0x3e7d87){var _0x1bc5b1=path[_0xe804('0x57')](config[_0xe804('0x58')],_0xe804('0x59'),util[_0xe804('0x5a')](_0xe804('0x5b'),path[_0xe804('0x5c')](_0x3e7d87[_0xe804('0x56')])));var _0x36a805=fs[_0xe804('0x5d')](_0x1bc5b1);var _0x17ac20=archiver(_0xe804('0x5e'),{'zlib':{'level':0x9}});_0x17ac20['on'](_0xe804('0x5f'),function(_0x2d0300){if(_0x2d0300[_0xe804('0x60')]===_0xe804('0x61')){logger[_0xe804('0x32')](_0x2d0300);}else{throw new db[(_0xe804('0x62'))][(_0xe804('0x63'))](_0xe804('0x64'));}});_0x17ac20['on']('error',function(_0x1cb39c){throw new db['Sequelize']['Error'](_0xe804('0x64'));});_0x17ac20[_0xe804('0x65')](_0x36a805);_0x17ac20[_0xe804('0x66')]('**/*',{'cwd':path[_0xe804('0x57')](config[_0xe804('0x58')],_0xe804('0x59'),path['dirname'](_0x3e7d87[_0xe804('0x56')])),'ignore':[path[_0xe804('0x57')](path[_0xe804('0x5c')](_0x3e7d87['path']),'node_modules/**/*'),path[_0xe804('0x57')](path[_0xe804('0x5c')](_0x3e7d87[_0xe804('0x56')]),_0xe804('0x67'))],'nodir':!![]})[_0xe804('0x68')]();_0x36a805['on'](_0xe804('0x69'),function(){if(!fs[_0xe804('0x6a')](_0x1bc5b1)){throw new db[(_0xe804('0x62'))][(_0xe804('0x63'))](_0xe804('0x6b'));}return _0x570aca[_0xe804('0x6c')](_0x1bc5b1,util[_0xe804('0x5a')](_0xe804('0x5b'),path['basename'](_0x3e7d87['path'])),function(_0x37ff78){if(_0x37ff78){throw new db[(_0xe804('0x62'))]['Error'](_0xe804('0x6d'));}fs['unlinkSync'](_0x1bc5b1);logger[_0xe804('0x6e')](_0xe804('0x6f'));logger[_0xe804('0x6e')](_0xe804('0x70'));});});}return null;})[_0xe804('0x55')](handleError(_0x570aca,null));};exports[_0xe804('0x71')]=function(_0x2e09d8,_0x12320c,_0x59ad19){var _0x41c716=path[_0xe804('0x5c')](_0x2e09d8[_0xe804('0x72')]['filename'],path[_0xe804('0x73')](_0x2e09d8['file'][_0xe804('0x74')]));var _0x1976d6=path[_0xe804('0x57')](config[_0xe804('0x58')],_0xe804('0x59'),_0x2e09d8['file'][_0xe804('0x74')]);var _0x23d1bd=path['join'](config[_0xe804('0x58')],_0xe804('0x59'),_0x41c716);logger[_0xe804('0x6e')]('Plugin\x20upload\x20filepath:\x20%s',_0x1976d6);logger[_0xe804('0x6e')](_0xe804('0x75'),_0x23d1bd);try{fs[_0xe804('0x76')](_0x1976d6,parseInt(_0xe804('0x77'),0x8));extract(_0x1976d6,{'dir':_0x23d1bd},function(_0xcb935f){if(_0xcb935f){logger['error'](_0xcb935f);handleError(_0xcb935f,!![]);};var _0x15ecda=fs[_0xe804('0x78')](_0x23d1bd);if(_0x15ecda[_0xe804('0x42')]>0x1){removeReferences(_0x1976d6,_0x23d1bd);logger[_0xe804('0x32')](_0xe804('0x79'));return _0x59ad19(new Error(_0xe804('0x79')));}var _0xf63b17=fs['lstatSync'](path[_0xe804('0x57')](_0x23d1bd,_0x15ecda[0x0]));if(_0xf63b17['isFile']()){removeReferences(_0x1976d6,_0x23d1bd);logger[_0xe804('0x32')]('Invalid\x20plugin\x20structure');return _0x59ad19(new Error(_0xe804('0x79')));}if(_0xf63b17[_0xe804('0x7a')]()){var _0x270620=fs[_0xe804('0x78')](path[_0xe804('0x57')](_0x23d1bd,_0x15ecda[0x0]));if(_0x270620[_0xe804('0x42')]===0x0){removeReferences(_0x1976d6,_0x23d1bd);logger[_0xe804('0x32')](_0xe804('0x79'));return _0x59ad19(new Error(_0xe804('0x79')));}var _0x404cc6=_0x270620[_0xe804('0x7b')](function(_0x5885b7){return _0x5885b7===_0xe804('0x7c');});if(!_0x404cc6){return _0x59ad19(new Error(_0xe804('0x7d')));}var _0x27c7d4=fs['readFileSync'](path['join'](_0x23d1bd,_0x15ecda[0x0],_0xe804('0x7c')));var _0x364369=JSON[_0xe804('0x7e')](_0x27c7d4);if('undefined'==typeof _0x364369[_0xe804('0x34')]){return _0x59ad19(new Error(_0xe804('0x7f')));}if('undefined'==typeof _0x364369[_0xe804('0x39')]){return _0x59ad19(new Error(_0xe804('0x80')));}if(_0xe804('0x81')==typeof _0x364369[_0xe804('0x82')]){return _0x59ad19(new Error(_0xe804('0x83')));}if('undefined'==typeof _0x364369[_0xe804('0x84')]){return _0x59ad19(new Error(_0xe804('0x85')));}if(_0x364369[_0xe804('0x39')]===_0xe804('0x86')){if(_0xe804('0x81')==typeof _0x364369[_0xe804('0x84')][_0xe804('0x87')]){return _0x59ad19(new Error(_0xe804('0x88')));}if('undefined'==typeof _0x364369[_0xe804('0x84')][_0xe804('0x87')][_0xe804('0x89')]&&'undefined'==typeof _0x364369[_0xe804('0x84')][_0xe804('0x87')][_0xe804('0x8a')]){return _0x59ad19(new Error(_0xe804('0x8b')));}}else if(_0x364369[_0xe804('0x39')]===_0xe804('0x8c')){if(_0xe804('0x81')==typeof _0x364369[_0xe804('0x84')][_0xe804('0x8d')]){return _0x59ad19(new Error(_0xe804('0x8e')));}if('undefined'==typeof _0x364369[_0xe804('0x84')][_0xe804('0x8f')]){return _0x59ad19(new Error(_0xe804('0x90')));}}else{return _0x59ad19(new Error(_0xe804('0x91')));}var _0x422abe=_0x364369[_0xe804('0x34')];var _0x382345=_0x364369[_0xe804('0x92')];var _0x5a295b=_0x364369['type'];var _0x4ffdb0=_0x364369[_0xe804('0x93')]?_0x364369[_0xe804('0x93')]:_0xe804('0x94');var _0x2b6ed2=_0x364369[_0xe804('0x95')]?_0x364369[_0xe804('0x95')]:'icon-apps';var _0x524262='';var _0x205f1c='';var _0x1b5c23='';var _0x463381='';var _0x4a8bdd=_0x364369[_0xe804('0x82')];if(_0x5a295b===_0xe804('0x86')){if(_0xe804('0x81')!=typeof _0x364369[_0xe804('0x84')][_0xe804('0x87')][_0xe804('0x89')]){var _0x1a01f3=_0x364369[_0xe804('0x84')][_0xe804('0x87')][_0xe804('0x89')];if(!/^(f|ht)tps?:\/\//i[_0xe804('0x96')](_0x1a01f3)){_0x524262=path[_0xe804('0x57')](_0xe804('0x97'),_0x41c716,_0x15ecda[0x0],_0x1a01f3);}else{_0x524262=_0x1a01f3;}}else{logger['info'](_0xe804('0x98'));}if(_0xe804('0x81')!=typeof _0x364369[_0xe804('0x84')]['views'][_0xe804('0x8a')]){var _0x1bdc9a=_0x364369[_0xe804('0x84')][_0xe804('0x87')][_0xe804('0x8a')];if(!/^(f|ht)tps?:\/\//i[_0xe804('0x96')](_0x1bdc9a)){_0x205f1c=path[_0xe804('0x57')](_0xe804('0x97'),_0x41c716,_0x15ecda[0x0],_0x1bdc9a);}else{_0x205f1c=_0x1bdc9a;}}else{logger[_0xe804('0x6e')](_0xe804('0x99'));}}else if(_0x5a295b===_0xe804('0x8c')){_0x1b5c23=_0x364369[_0xe804('0x84')][_0xe804('0x8d')];_0x463381=_0x364369[_0xe804('0x84')][_0xe804('0x8f')];if(_0xe804('0x81')!=typeof _0x364369[_0xe804('0x84')][_0xe804('0x87')]){if('undefined'!=typeof _0x364369['parameters'][_0xe804('0x87')][_0xe804('0x89')]){var _0x1a01f3=_0x364369[_0xe804('0x84')]['views'][_0xe804('0x89')];if(!/^(f|ht)tps?:\/\//i['test'](_0x1a01f3)){_0x524262=path[_0xe804('0x57')]('plugins',_0x41c716,_0x15ecda[0x0],_0x1a01f3);}else{_0x524262=_0x1a01f3;}}if(_0xe804('0x81')!=typeof _0x364369[_0xe804('0x84')]['views']['agent']){var _0x1bdc9a=_0x364369[_0xe804('0x84')]['views'][_0xe804('0x8a')];if(!/^(f|ht)tps?:\/\//i['test'](_0x1bdc9a)){_0x205f1c=path[_0xe804('0x57')](_0xe804('0x97'),_0x41c716,_0x15ecda[0x0],_0x1bdc9a);}else{_0x205f1c=_0x1bdc9a;}}}}var _0x4b3a89={'name':_0x422abe,'description':_0x382345,'path':path['join'](_0x41c716,_0x15ecda[0x0]),'type':_0x5a295b,'sidebar':_0x4ffdb0,'icon':_0x2b6ed2,'adminUrl':_0x524262,'agentUrl':_0x205f1c,'scriptName':_0x1b5c23,'scriptPath':_0x463381,'version':_0x4a8bdd};removeReferences(_0x1976d6,null);return db[_0xe804('0x36')][_0xe804('0x9a')](_0x4b3a89)['then'](function(_0x3dde97){var _0x1daa62={'role':_0x2e09d8[_0xe804('0x9b')]['role'],'userProfileId':_0x2e09d8[_0xe804('0x9b')][_0xe804('0x9c')]};if(!_0x1daa62)throw new Error(_0xe804('0x9d'));if(_0x1daa62['role']==='user'){var _0x114762=_0x3dde97[_0xe804('0x2d')]({'plain':!![]});return db['UserProfileSection']['find']({'where':{'name':_0xe804('0x2e'),'userProfileId':_0x1daa62['userProfileId']},'raw':!![]})[_0xe804('0x31')](function(_0x5e7416){if(_0x5e7416&&_0x5e7416[_0xe804('0x9e')]===0x0){return db[_0xe804('0x2f')][_0xe804('0x9a')]({'name':_0x114762[_0xe804('0x34')],'resourceId':_0x114762['id'],'type':_0x5e7416[_0xe804('0x34')],'sectionId':_0x5e7416['id']},{})[_0xe804('0x31')](function(){return _0x3dde97;});}else{return _0x3dde97;}})[_0xe804('0x55')](function(_0xb73180){logger[_0xe804('0x32')](_0xe804('0x9f'),_0xb73180);throw _0xb73180;});}return _0x3dde97;})[_0xe804('0x31')](respondWithResult(_0x12320c,null))['catch'](handleError(_0x12320c,null));}});}catch(_0x5e4304){_0x12320c[_0xe804('0x21')](0x1f4)[_0xe804('0xa0')](_0x5e4304);}};function removeReferences(_0x28253f,_0x156392){try{if(_0x28253f){fs[_0xe804('0xa1')](_0x28253f);logger[_0xe804('0x6e')]('Zip\x20archive\x20removed');}if(_0x156392){rimraf(_0x156392,function(){});logger[_0xe804('0x6e')](_0xe804('0xa2'));}}catch(_0x18068c){logger['error'](_0x18068c);}}exports[_0xe804('0x2c')]=function(_0xd4d052,_0x1abe9a,_0x1cd70f){return db[_0xe804('0x36')][_0xe804('0x54')]({'where':{'id':_0xd4d052[_0xe804('0x52')]['id']}})[_0xe804('0x31')](handleEntityNotFound(_0x1abe9a,null))[_0xe804('0x31')](saveUpdates(_0xd4d052[_0xe804('0x9b')],null))[_0xe804('0x31')](respondWithResult(_0x1abe9a,null))[_0xe804('0x55')](handleError(_0x1abe9a,null));};exports['delete']=function(_0x45d7a9,_0x34aa58,_0x455900){return db[_0xe804('0x36')][_0xe804('0x54')]({'where':{'id':_0x45d7a9['params']['id']}})['then'](function(_0x5a600e){if(_0x5a600e){return _0x5a600e['destroy']();}})[_0xe804('0x31')](function(_0x1286a8){rimraf(path[_0xe804('0x57')](config['root'],_0xe804('0x59'),path[_0xe804('0xa3')](_0x1286a8[_0xe804('0x56')])),function(){});return _0x1286a8;})['then'](handleEntityNotFound(_0x34aa58,null))[_0xe804('0x31')](respondWithStatusCode(_0x34aa58,null))[_0xe804('0x55')](handleError(_0x34aa58,null));};exports[_0xe804('0xa4')]=function(_0x3f080c,_0x160c39,_0x5c1235){return BPromise[_0xe804('0xa5')]()[_0xe804('0x31')](function(){if(!_0x3f080c['query']['path']){throw new Error('\x27PATH\x27\x20parameter\x20not\x20specified');}if(!_0x3f080c[_0xe804('0x3d')][_0xe804('0xa6')]){throw new Error(_0xe804('0xa7'));}var _0x2cddcf=_0x3f080c[_0xe804('0x3d')][_0xe804('0xa8')]?_0x3f080c[_0xe804('0x3d')]['hostname']+':'+_0x3f080c[_0xe804('0x3d')][_0xe804('0xa6')]:'http://localhost:'+_0x3f080c['query'][_0xe804('0xa6')];var _0x5dfc2a=_0x3f080c[_0xe804('0x3d')][_0xe804('0x23')]?_0x3f080c[_0xe804('0x3d')][_0xe804('0x23')]:!![];var _0x25ade2=_0x3f080c[_0xe804('0x3d')]['encoding']?_0x3f080c[_0xe804('0x3d')][_0xe804('0xa9')]:null;var _0x333b09={'method':_0x3f080c['method'],'uri':util[_0xe804('0x5a')](_0xe804('0xaa'),_0x2cddcf,_0x3f080c[_0xe804('0x3d')]['path']),'json':_0x5dfc2a,'resolveWithFullResponse':!![],'encoding':_0x25ade2,'qs':_0x3f080c['query']};if(_0x3f080c[_0xe804('0xab')]){_0x333b09[_0xe804('0xab')]=_0x3f080c[_0xe804('0xab')];if(_0x333b09[_0xe804('0xab')][_0xe804('0xac')]){delete _0x333b09[_0xe804('0xab')][_0xe804('0xac')];}}if(_0x333b09['headers']['content-type']){delete _0x333b09[_0xe804('0xab')][_0xe804('0xad')];}return rp(_0x333b09);})[_0xe804('0x31')](function(_0x3f3174){if(_0x3f3174){_0x160c39[_0xe804('0x27')](_0x3f3174['headers']);logger[_0xe804('0x6e')](_0x3f3174[_0xe804('0x9b')]);if(_['endsWith'](_0x3f080c[_0xe804('0x3d')]['path'],_0xe804('0x6c'))&&_0x3f3174[_0xe804('0xae')]==0x1f4){return _0x160c39[_0xe804('0x20')](_0x3f3174[_0xe804('0xae')]);}else{return _0x160c39[_0xe804('0x21')](_0x3f3174[_0xe804('0xae')])[_0xe804('0xa0')](_0x3f3174[_0xe804('0x9b')]);}}else{return _0x160c39['sendStatus'](0xc8);}})['catch'](handleError(_0x160c39,null));};exports[_0xe804('0xaf')]=function(_0x1395b9,_0x36654c,_0x510181){return BPromise[_0xe804('0xa5')]()[_0xe804('0x31')](function(){if(!_0x1395b9[_0xe804('0x3d')][_0xe804('0x56')]){throw new Error('\x27PATH\x27\x20parameter\x20not\x20specified');}if(!_0x1395b9['query']['port']){throw new Error(_0xe804('0xa7'));}var _0x526df0=_0x1395b9[_0xe804('0x3d')][_0xe804('0xa8')]?_0x1395b9[_0xe804('0x3d')][_0xe804('0xa8')]+':'+_0x1395b9[_0xe804('0x3d')][_0xe804('0xa6')]:_0xe804('0xb0')+_0x1395b9[_0xe804('0x3d')][_0xe804('0xa6')];var _0x1787cd=_0x1395b9[_0xe804('0x3d')][_0xe804('0x23')]?_0x1395b9[_0xe804('0x3d')]['json']:!![];var _0x4fb9f6=_0x1395b9[_0xe804('0x3d')][_0xe804('0xa9')]?_0x1395b9[_0xe804('0x3d')]['encoding']:null;var _0x29bde1={'method':_0x1395b9[_0xe804('0xb1')],'uri':util[_0xe804('0x5a')]('%s%s',_0x526df0,_0x1395b9[_0xe804('0x3d')]['path']),'json':_0x1787cd,'resolveWithFullResponse':!![],'encoding':_0x4fb9f6,'body':_0x1395b9['body']};if(_0x1395b9[_0xe804('0xab')]){_0x29bde1[_0xe804('0xab')]=_0x1395b9[_0xe804('0xab')];if(_0x29bde1['headers'][_0xe804('0xac')]){delete _0x29bde1['headers']['content-length'];}}if(_0x29bde1['headers'][_0xe804('0xad')]){delete _0x29bde1['headers']['content-type'];}return rp(_0x29bde1);})[_0xe804('0x31')](function(_0x451b28){if(_0x451b28){_0x36654c[_0xe804('0x27')](_0x451b28[_0xe804('0xab')]);logger['info'](_0x451b28[_0xe804('0x9b')]);return _0x36654c[_0xe804('0x21')](_0x451b28[_0xe804('0xae')])[_0xe804('0xa0')](_0x451b28[_0xe804('0x9b')]);}else{return _0x36654c[_0xe804('0x20')](0xc8);}})[_0xe804('0x55')](handleError(_0x36654c,null));}; \ No newline at end of file +var _0x47db=['node_modules/**/*','attachments/**/*','finalize','close','existsSync','format','%s.zip','unlinkSync','info','Download\x20completed','Temporary\x20file\x20removed','upload','file','filename','extname','Plugin\x20upload\x20destination:\x20%s','0777','readdirSync','Invalid\x20plugin\x20structure','lstatSync','isFile','isDirectory','some','Plugin\x20manifest\x20missing','readFileSync','parse','undefined','Invalid\x20manifest:\x20type\x20missing','version','Invalid\x20manifest:\x20version\x20not\x20specified','Invalid\x20manifest:\x20parameters\x20missing','html','views','Invalid\x20manifest:\x20views\x20missing','admin','agent','Invalid\x20manifest:\x20no\x20view\x20specified','script','parameters','scriptName','Invalid\x20manifest:\x20script\x20name\x20missing','Invalid\x20manifest:\x20script\x20path\x20missing','Invalid\x20manifest:\x20invalid\x20type','description','sidebar','always','icon','icon-apps','plugins','Warning:\x20admin\x20view\x20not\x20specified','test','scriptPath','create','role','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','Zip\x20archive\x20removed','Extracted\x20folder\x20removed','delete','dirname','resolve','\x27PATH\x27\x20parameter\x20not\x20specified','hostname','port','http://localhost:','encoding','method','%s%s','headers','content-length','content-type','endsWith','statusCode','webhookPost','\x27PORT\x27\x20parameter\x20not\x20specified','html-pdf','eml-format','rimraf','fast-json-patch','moment','bluebird','mustache','util','path','sox','ejs','lodash','squel','crypto','jsforce','desk.js','papaparse','extract-zip','archiver','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./plugin.socket','register','sendStatus','status','end','json','limit','set','Content-Range','apply','reject','save','update','destroy','then','get','Plugins','UserProfileResource','error','stack','name','send','index','map','Plugin','rawAttributes','key','model','query','filters','attributes','fields','length','nolimit','offset','order','where','filter','merge','type','VIRTUAL','options','count','includeAll','include','rows','catch','show','keys','intersection','find','params','join','root','server/files/plugins','basename','createWriteStream','zip','warning','code','ENOENT','Sequelize','Error','Error\x20while\x20generating\x20the\x20zip\x20archive','pipe','glob','**/*'];(function(_0x47a7d0,_0x4e182d){var _0xb9bd08=function(_0x588ee2){while(--_0x588ee2){_0x47a7d0['push'](_0x47a7d0['shift']());}};_0xb9bd08(++_0x4e182d);}(_0x47db,0xff));var _0xb47d=function(_0x34ab32,_0x1fb698){_0x34ab32=_0x34ab32-0x0;var _0x139be0=_0x47db[_0x34ab32];return _0x139be0;};'use strict';var pdf=require(_0xb47d('0x0'));var emlformat=require(_0xb47d('0x1'));var rimraf=require(_0xb47d('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0xb47d('0x3'));var rp=require('request-promise');var moment=require(_0xb47d('0x4'));var BPromise=require(_0xb47d('0x5'));var Mustache=require(_0xb47d('0x6'));var util=require(_0xb47d('0x7'));var path=require(_0xb47d('0x8'));var sox=require(_0xb47d('0x9'));var csv=require('to-csv');var ejs=require(_0xb47d('0xa'));var fs=require('fs');var _=require(_0xb47d('0xb'));var squel=require(_0xb47d('0xc'));var crypto=require(_0xb47d('0xd'));var jsforce=require(_0xb47d('0xe'));var deskjs=require(_0xb47d('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xb47d('0x10'));var extract=require(_0xb47d('0x11'));var rimraf=require(_0xb47d('0x2'));var archiver=require(_0xb47d('0x12'));var Redis=require(_0xb47d('0x13'));var authService=require(_0xb47d('0x14'));var qs=require(_0xb47d('0x15'));var as=require(_0xb47d('0x16'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xb47d('0x17'))(_0xb47d('0x18'));var utils=require(_0xb47d('0x19'));var config=require(_0xb47d('0x1a'));var db=require(_0xb47d('0x1b'))['db'];config[_0xb47d('0x1c')]=_[_0xb47d('0x1d')](config['redis'],{'host':_0xb47d('0x1e'),'port':0x18eb});var socket=require(_0xb47d('0x1f'))(new Redis(config['redis']));require(_0xb47d('0x20'))[_0xb47d('0x21')](socket);function respondWithStatusCode(_0x16e77a,_0x4cbb81){_0x4cbb81=_0x4cbb81||0xcc;return function(_0x4b8ca1){if(_0x4b8ca1){return _0x16e77a[_0xb47d('0x22')](_0x4cbb81);}return _0x16e77a[_0xb47d('0x23')](_0x4cbb81)[_0xb47d('0x24')]();};}function respondWithResult(_0x456c49,_0x34d96a){_0x34d96a=_0x34d96a||0xc8;return function(_0x1f8d3c){if(_0x1f8d3c){return _0x456c49[_0xb47d('0x23')](_0x34d96a)[_0xb47d('0x25')](_0x1f8d3c);}};}function respondWithFilteredResult(_0x23965b,_0x4f4de5){return function(_0x560300){if(_0x560300){var _0x35c412=_0x560300['count'],_0x2455a6=_0x4f4de5['offset'],_0x56588a=_0x4f4de5['offset']+_0x4f4de5[_0xb47d('0x26')],_0x1f2a69;if(_0x56588a>=_0x35c412){_0x56588a=_0x35c412;_0x1f2a69=0xc8;}else{_0x1f2a69=0xce;}_0x23965b[_0xb47d('0x23')](_0x1f2a69);return _0x23965b[_0xb47d('0x27')](_0xb47d('0x28'),_0x2455a6+'-'+_0x56588a+'/'+_0x35c412)[_0xb47d('0x25')](_0x560300);}return null;};}function patchUpdates(_0x4d27f3){return function(_0x392f93){try{jsonpatch[_0xb47d('0x29')](_0x392f93,_0x4d27f3,!![]);}catch(_0x5bc9cf){return BPromise[_0xb47d('0x2a')](_0x5bc9cf);}return _0x392f93[_0xb47d('0x2b')]();};}function saveUpdates(_0x560ba0,_0x441072){return function(_0x2e603f){if(_0x2e603f){return _0x2e603f[_0xb47d('0x2c')](_0x560ba0)['then'](function(_0x515503){return _0x515503;});}return null;};}function removeEntity(_0x44c088,_0x38db5e){return function(_0x4fb1d5){if(_0x4fb1d5){return _0x4fb1d5[_0xb47d('0x2d')]()[_0xb47d('0x2e')](function(){var _0x1fb1cf=_0x4fb1d5[_0xb47d('0x2f')]({'plain':!![]});var _0x2b783f=_0xb47d('0x30');return db[_0xb47d('0x31')][_0xb47d('0x2d')]({'where':{'type':_0x2b783f,'resourceId':_0x1fb1cf['id']}})[_0xb47d('0x2e')](function(){return _0x4fb1d5;});})['then'](function(){_0x44c088[_0xb47d('0x23')](0xcc)[_0xb47d('0x24')]();});}};}function handleEntityNotFound(_0x27aa06,_0x48f992){return function(_0x3c1ee8){if(!_0x3c1ee8){_0x27aa06[_0xb47d('0x22')](0x194);}return _0x3c1ee8;};}function handleError(_0x9d73cc,_0x5d71a5){_0x5d71a5=_0x5d71a5||0x1f4;return function(_0x3acf7c){logger[_0xb47d('0x32')](_0x3acf7c[_0xb47d('0x33')]);if(_0x3acf7c[_0xb47d('0x34')]){delete _0x3acf7c['name'];}_0x9d73cc[_0xb47d('0x23')](_0x5d71a5)[_0xb47d('0x35')](_0x3acf7c);};}exports[_0xb47d('0x36')]=function(_0x3ea38c,_0x1f9df7){var _0x5194fa={},_0x34a21c={},_0x3c7a59={'count':0x0,'rows':[]};var _0x215465=_[_0xb47d('0x37')](db[_0xb47d('0x38')][_0xb47d('0x39')],function(_0x631724){return{'name':_0x631724['fieldName'],'type':_0x631724['type'][_0xb47d('0x3a')]};});_0x34a21c[_0xb47d('0x3b')]=_[_0xb47d('0x37')](_0x215465,_0xb47d('0x34'));_0x34a21c[_0xb47d('0x3c')]=_['keys'](_0x3ea38c[_0xb47d('0x3c')]);_0x34a21c[_0xb47d('0x3d')]=_['intersection'](_0x34a21c['model'],_0x34a21c[_0xb47d('0x3c')]);_0x5194fa[_0xb47d('0x3e')]=_['intersection'](_0x34a21c[_0xb47d('0x3b')],qs[_0xb47d('0x3f')](_0x3ea38c[_0xb47d('0x3c')][_0xb47d('0x3f')]));_0x5194fa[_0xb47d('0x3e')]=_0x5194fa[_0xb47d('0x3e')][_0xb47d('0x40')]?_0x5194fa[_0xb47d('0x3e')]:_0x34a21c[_0xb47d('0x3b')];if(!_0x3ea38c[_0xb47d('0x3c')]['hasOwnProperty'](_0xb47d('0x41'))){_0x5194fa['limit']=qs[_0xb47d('0x26')](_0x3ea38c[_0xb47d('0x3c')]['limit']);_0x5194fa[_0xb47d('0x42')]=qs[_0xb47d('0x42')](_0x3ea38c[_0xb47d('0x3c')][_0xb47d('0x42')]);}_0x5194fa[_0xb47d('0x43')]=qs['sort'](_0x3ea38c[_0xb47d('0x3c')]['sort']);_0x5194fa[_0xb47d('0x44')]=qs[_0xb47d('0x3d')](_['pick'](_0x3ea38c[_0xb47d('0x3c')],_0x34a21c[_0xb47d('0x3d')]),_0x215465);if(_0x3ea38c[_0xb47d('0x3c')][_0xb47d('0x45')]){_0x5194fa[_0xb47d('0x44')]=_[_0xb47d('0x46')](_0x5194fa[_0xb47d('0x44')],{'$or':_[_0xb47d('0x37')](_0x215465,function(_0x14c2ec){if(_0x14c2ec[_0xb47d('0x47')]!==_0xb47d('0x48')){var _0x3a7135={};_0x3a7135[_0x14c2ec[_0xb47d('0x34')]]={'$like':'%'+_0x3ea38c['query'][_0xb47d('0x45')]+'%'};return _0x3a7135;}})});}_0x5194fa=_[_0xb47d('0x46')]({},_0x5194fa,_0x3ea38c[_0xb47d('0x49')]);var _0x16032c={'where':_0x5194fa['where']};return db['Plugin'][_0xb47d('0x4a')](_0x16032c)[_0xb47d('0x2e')](function(_0xc0ea1c){_0x3c7a59[_0xb47d('0x4a')]=_0xc0ea1c;if(_0x3ea38c[_0xb47d('0x3c')][_0xb47d('0x4b')]){_0x5194fa[_0xb47d('0x4c')]=[{'all':!![]}];}return db[_0xb47d('0x38')]['findAll'](_0x5194fa);})[_0xb47d('0x2e')](function(_0x278bcd){_0x3c7a59[_0xb47d('0x4d')]=_0x278bcd;return _0x3c7a59;})[_0xb47d('0x2e')](respondWithFilteredResult(_0x1f9df7,_0x5194fa))[_0xb47d('0x4e')](handleError(_0x1f9df7,null));};exports[_0xb47d('0x4f')]=function(_0x802569,_0x10ed6d){var _0x113919={'raw':!![],'where':{'id':_0x802569['params']['id']}},_0x4c9e05={};_0x4c9e05[_0xb47d('0x3b')]=_['keys'](db['Plugin']['rawAttributes']);_0x4c9e05[_0xb47d('0x3c')]=_[_0xb47d('0x50')](_0x802569[_0xb47d('0x3c')]);_0x4c9e05[_0xb47d('0x3d')]=_[_0xb47d('0x51')](_0x4c9e05[_0xb47d('0x3b')],_0x4c9e05[_0xb47d('0x3c')]);_0x113919[_0xb47d('0x3e')]=_['intersection'](_0x4c9e05[_0xb47d('0x3b')],qs[_0xb47d('0x3f')](_0x802569['query'][_0xb47d('0x3f')]));_0x113919[_0xb47d('0x3e')]=_0x113919['attributes'][_0xb47d('0x40')]?_0x113919[_0xb47d('0x3e')]:_0x4c9e05[_0xb47d('0x3b')];if(_0x802569['query']['includeAll']){_0x113919[_0xb47d('0x4c')]=[{'all':!![]}];}_0x113919=_['merge']({},_0x113919,_0x802569[_0xb47d('0x49')]);return db[_0xb47d('0x38')][_0xb47d('0x52')](_0x113919)[_0xb47d('0x2e')](handleEntityNotFound(_0x10ed6d,null))[_0xb47d('0x2e')](respondWithResult(_0x10ed6d,null))[_0xb47d('0x4e')](handleError(_0x10ed6d,null));};exports['download']=function(_0x4a1a1e,_0x41d0e2,_0x70f449){return db[_0xb47d('0x38')][_0xb47d('0x52')]({'where':{'id':_0x4a1a1e[_0xb47d('0x53')]['id']},'attributes':[_0xb47d('0x34'),_0xb47d('0x8')],'raw':!![]})[_0xb47d('0x2e')](handleEntityNotFound(_0x41d0e2,null))[_0xb47d('0x2e')](function(_0x6c7d9f){if(_0x6c7d9f){var _0x449d4b=path[_0xb47d('0x54')](config[_0xb47d('0x55')],_0xb47d('0x56'),util['format']('%s.zip',path[_0xb47d('0x57')](_0x6c7d9f[_0xb47d('0x8')])));var _0x5dbf6f=fs[_0xb47d('0x58')](_0x449d4b);var _0x1fd5d2=archiver(_0xb47d('0x59'),{'zlib':{'level':0x9}});_0x1fd5d2['on'](_0xb47d('0x5a'),function(_0x376b53){if(_0x376b53[_0xb47d('0x5b')]===_0xb47d('0x5c')){logger[_0xb47d('0x32')](_0x376b53);}else{throw new db[(_0xb47d('0x5d'))][(_0xb47d('0x5e'))](_0xb47d('0x5f'));}});_0x1fd5d2['on']('error',function(_0x5a5564){throw new db[(_0xb47d('0x5d'))][(_0xb47d('0x5e'))](_0xb47d('0x5f'));});_0x1fd5d2[_0xb47d('0x60')](_0x5dbf6f);_0x1fd5d2[_0xb47d('0x61')](_0xb47d('0x62'),{'cwd':path[_0xb47d('0x54')](config[_0xb47d('0x55')],_0xb47d('0x56'),path['dirname'](_0x6c7d9f[_0xb47d('0x8')])),'ignore':[path['join'](path[_0xb47d('0x57')](_0x6c7d9f[_0xb47d('0x8')]),_0xb47d('0x63')),path[_0xb47d('0x54')](path[_0xb47d('0x57')](_0x6c7d9f[_0xb47d('0x8')]),_0xb47d('0x64'))],'nodir':!![]})[_0xb47d('0x65')]();_0x5dbf6f['on'](_0xb47d('0x66'),function(){if(!fs[_0xb47d('0x67')](_0x449d4b)){throw new db['Sequelize'][(_0xb47d('0x5e'))]('Plugin\x20not\x20found');}return _0x41d0e2['download'](_0x449d4b,util[_0xb47d('0x68')](_0xb47d('0x69'),path[_0xb47d('0x57')](_0x6c7d9f['path'])),function(_0x5706b2){if(_0x5706b2){throw new db[(_0xb47d('0x5d'))][(_0xb47d('0x5e'))]('Error\x20while\x20downloading\x20the\x20plugin');}fs[_0xb47d('0x6a')](_0x449d4b);logger[_0xb47d('0x6b')](_0xb47d('0x6c'));logger[_0xb47d('0x6b')](_0xb47d('0x6d'));});});}return null;})[_0xb47d('0x4e')](handleError(_0x41d0e2,null));};exports[_0xb47d('0x6e')]=function(_0x2862f5,_0x29b345,_0x57b14b){var _0x2c3bfc=path[_0xb47d('0x57')](_0x2862f5[_0xb47d('0x6f')][_0xb47d('0x70')],path[_0xb47d('0x71')](_0x2862f5[_0xb47d('0x6f')]['filename']));var _0x3eb7b6=path[_0xb47d('0x54')](config[_0xb47d('0x55')],_0xb47d('0x56'),_0x2862f5[_0xb47d('0x6f')][_0xb47d('0x70')]);var _0x5307da=path['join'](config[_0xb47d('0x55')],_0xb47d('0x56'),_0x2c3bfc);logger['info']('Plugin\x20upload\x20filepath:\x20%s',_0x3eb7b6);logger[_0xb47d('0x6b')](_0xb47d('0x72'),_0x5307da);try{fs['chmodSync'](_0x3eb7b6,parseInt(_0xb47d('0x73'),0x8));extract(_0x3eb7b6,{'dir':_0x5307da},function(_0x2b7619){if(_0x2b7619){logger[_0xb47d('0x32')](_0x2b7619);handleError(_0x2b7619,!![]);};var _0x1366e1=fs[_0xb47d('0x74')](_0x5307da);if(_0x1366e1[_0xb47d('0x40')]>0x1){removeReferences(_0x3eb7b6,_0x5307da);logger[_0xb47d('0x32')](_0xb47d('0x75'));return _0x57b14b(new Error(_0xb47d('0x75')));}var _0x2f82fa=fs[_0xb47d('0x76')](path['join'](_0x5307da,_0x1366e1[0x0]));if(_0x2f82fa[_0xb47d('0x77')]()){removeReferences(_0x3eb7b6,_0x5307da);logger[_0xb47d('0x32')](_0xb47d('0x75'));return _0x57b14b(new Error(_0xb47d('0x75')));}if(_0x2f82fa[_0xb47d('0x78')]()){var _0x3d6102=fs[_0xb47d('0x74')](path[_0xb47d('0x54')](_0x5307da,_0x1366e1[0x0]));if(_0x3d6102['length']===0x0){removeReferences(_0x3eb7b6,_0x5307da);logger[_0xb47d('0x32')](_0xb47d('0x75'));return _0x57b14b(new Error(_0xb47d('0x75')));}var _0x2b9fe4=_0x3d6102[_0xb47d('0x79')](function(_0x5e41cd){return _0x5e41cd==='manifest.json';});if(!_0x2b9fe4){return _0x57b14b(new Error(_0xb47d('0x7a')));}var _0x2b0676=fs[_0xb47d('0x7b')](path[_0xb47d('0x54')](_0x5307da,_0x1366e1[0x0],'manifest.json'));var _0x45b43b=JSON[_0xb47d('0x7c')](_0x2b0676);if('undefined'==typeof _0x45b43b[_0xb47d('0x34')]){return _0x57b14b(new Error('Invalid\x20manifest:\x20name\x20missing'));}if(_0xb47d('0x7d')==typeof _0x45b43b['type']){return _0x57b14b(new Error(_0xb47d('0x7e')));}if(_0xb47d('0x7d')==typeof _0x45b43b[_0xb47d('0x7f')]){return _0x57b14b(new Error(_0xb47d('0x80')));}if(_0xb47d('0x7d')==typeof _0x45b43b['parameters']){return _0x57b14b(new Error(_0xb47d('0x81')));}if(_0x45b43b[_0xb47d('0x47')]===_0xb47d('0x82')){if(_0xb47d('0x7d')==typeof _0x45b43b['parameters'][_0xb47d('0x83')]){return _0x57b14b(new Error(_0xb47d('0x84')));}if(_0xb47d('0x7d')==typeof _0x45b43b['parameters']['views'][_0xb47d('0x85')]&&'undefined'==typeof _0x45b43b['parameters'][_0xb47d('0x83')][_0xb47d('0x86')]){return _0x57b14b(new Error(_0xb47d('0x87')));}}else if(_0x45b43b[_0xb47d('0x47')]===_0xb47d('0x88')){if(_0xb47d('0x7d')==typeof _0x45b43b[_0xb47d('0x89')][_0xb47d('0x8a')]){return _0x57b14b(new Error(_0xb47d('0x8b')));}if('undefined'==typeof _0x45b43b[_0xb47d('0x89')]['scriptPath']){return _0x57b14b(new Error(_0xb47d('0x8c')));}}else{return _0x57b14b(new Error(_0xb47d('0x8d')));}var _0x4fecaa=_0x45b43b['name'];var _0x14bdbd=_0x45b43b[_0xb47d('0x8e')];var _0x5b831a=_0x45b43b['type'];var _0x40bd77=_0x45b43b[_0xb47d('0x8f')]?_0x45b43b['sidebar']:_0xb47d('0x90');var _0x42085c=_0x45b43b[_0xb47d('0x91')]?_0x45b43b[_0xb47d('0x91')]:_0xb47d('0x92');var _0x24bb0a='';var _0x8a2ec7='';var _0x30c7a8='';var _0xf23cc0='';var _0x1df476=_0x45b43b[_0xb47d('0x7f')];if(_0x5b831a===_0xb47d('0x82')){if(_0xb47d('0x7d')!=typeof _0x45b43b['parameters'][_0xb47d('0x83')]['admin']){var _0x117413=_0x45b43b[_0xb47d('0x89')][_0xb47d('0x83')][_0xb47d('0x85')];if(!/^(f|ht)tps?:\/\//i['test'](_0x117413)){_0x24bb0a=path[_0xb47d('0x54')](_0xb47d('0x93'),_0x2c3bfc,_0x1366e1[0x0],_0x117413);}else{_0x24bb0a=_0x117413;}}else{logger['info'](_0xb47d('0x94'));}if(_0xb47d('0x7d')!=typeof _0x45b43b[_0xb47d('0x89')]['views'][_0xb47d('0x86')]){var _0x370768=_0x45b43b['parameters'][_0xb47d('0x83')][_0xb47d('0x86')];if(!/^(f|ht)tps?:\/\//i[_0xb47d('0x95')](_0x370768)){_0x8a2ec7=path[_0xb47d('0x54')]('plugins',_0x2c3bfc,_0x1366e1[0x0],_0x370768);}else{_0x8a2ec7=_0x370768;}}else{logger[_0xb47d('0x6b')]('Warning:\x20agent\x20view\x20not\x20specified');}}else if(_0x5b831a==='script'){_0x30c7a8=_0x45b43b[_0xb47d('0x89')]['scriptName'];_0xf23cc0=_0x45b43b['parameters'][_0xb47d('0x96')];if(_0xb47d('0x7d')!=typeof _0x45b43b[_0xb47d('0x89')][_0xb47d('0x83')]){if(_0xb47d('0x7d')!=typeof _0x45b43b['parameters']['views'][_0xb47d('0x85')]){var _0x117413=_0x45b43b['parameters'][_0xb47d('0x83')][_0xb47d('0x85')];if(!/^(f|ht)tps?:\/\//i['test'](_0x117413)){_0x24bb0a=path['join'](_0xb47d('0x93'),_0x2c3bfc,_0x1366e1[0x0],_0x117413);}else{_0x24bb0a=_0x117413;}}if(_0xb47d('0x7d')!=typeof _0x45b43b['parameters']['views']['agent']){var _0x370768=_0x45b43b[_0xb47d('0x89')][_0xb47d('0x83')][_0xb47d('0x86')];if(!/^(f|ht)tps?:\/\//i[_0xb47d('0x95')](_0x370768)){_0x8a2ec7=path[_0xb47d('0x54')](_0xb47d('0x93'),_0x2c3bfc,_0x1366e1[0x0],_0x370768);}else{_0x8a2ec7=_0x370768;}}}}var _0x1c46fe={'name':_0x4fecaa,'description':_0x14bdbd,'path':path[_0xb47d('0x54')](_0x2c3bfc,_0x1366e1[0x0]),'type':_0x5b831a,'sidebar':_0x40bd77,'icon':_0x42085c,'adminUrl':_0x24bb0a,'agentUrl':_0x8a2ec7,'scriptName':_0x30c7a8,'scriptPath':_0xf23cc0,'version':_0x1df476};removeReferences(_0x3eb7b6,null);return db['Plugin'][_0xb47d('0x97')](_0x1c46fe)[_0xb47d('0x2e')](function(_0x19577f){var _0x6b9f04={'role':_0x2862f5['body'][_0xb47d('0x98')],'userProfileId':_0x2862f5[_0xb47d('0x99')]['userProfileId']};if(!_0x6b9f04)throw new Error(_0xb47d('0x9a'));if(_0x6b9f04[_0xb47d('0x98')]===_0xb47d('0x9b')){var _0x4c5560=_0x19577f[_0xb47d('0x2f')]({'plain':!![]});return db['UserProfileSection']['find']({'where':{'name':_0xb47d('0x30'),'userProfileId':_0x6b9f04['userProfileId']},'raw':!![]})[_0xb47d('0x2e')](function(_0x3d4fe5){if(_0x3d4fe5&&_0x3d4fe5[_0xb47d('0x9c')]===0x0){return db['UserProfileResource'][_0xb47d('0x97')]({'name':_0x4c5560['name'],'resourceId':_0x4c5560['id'],'type':_0x3d4fe5[_0xb47d('0x34')],'sectionId':_0x3d4fe5['id']},{})[_0xb47d('0x2e')](function(){return _0x19577f;});}else{return _0x19577f;}})['catch'](function(_0x4c8c94){logger[_0xb47d('0x32')](_0xb47d('0x9d'),_0x4c8c94);throw _0x4c8c94;});}return _0x19577f;})['then'](respondWithResult(_0x29b345,null))['catch'](handleError(_0x29b345,null));}});}catch(_0x646c0){_0x29b345[_0xb47d('0x23')](0x1f4)[_0xb47d('0x35')](_0x646c0);}};function removeReferences(_0x45f163,_0x2be44e){try{if(_0x45f163){fs[_0xb47d('0x6a')](_0x45f163);logger['info'](_0xb47d('0x9e'));}if(_0x2be44e){rimraf(_0x2be44e,function(){});logger['info'](_0xb47d('0x9f'));}}catch(_0x290f17){logger[_0xb47d('0x32')](_0x290f17);}}exports[_0xb47d('0x2c')]=function(_0x4d2d2c,_0x1818ed,_0x359147){return db[_0xb47d('0x38')][_0xb47d('0x52')]({'where':{'id':_0x4d2d2c['params']['id']}})[_0xb47d('0x2e')](handleEntityNotFound(_0x1818ed,null))['then'](saveUpdates(_0x4d2d2c[_0xb47d('0x99')],null))[_0xb47d('0x2e')](respondWithResult(_0x1818ed,null))['catch'](handleError(_0x1818ed,null));};exports[_0xb47d('0xa0')]=function(_0x12f5ee,_0x481d36,_0x145061){return db[_0xb47d('0x38')][_0xb47d('0x52')]({'where':{'id':_0x12f5ee[_0xb47d('0x53')]['id']}})[_0xb47d('0x2e')](function(_0x25fbcb){if(_0x25fbcb){return _0x25fbcb[_0xb47d('0x2d')]();}})['then'](function(_0x33a8b5){rimraf(path['join'](config['root'],_0xb47d('0x56'),path[_0xb47d('0xa1')](_0x33a8b5['path'])),function(){});return _0x33a8b5;})[_0xb47d('0x2e')](handleEntityNotFound(_0x481d36,null))['then'](respondWithStatusCode(_0x481d36,null))['catch'](handleError(_0x481d36,null));};exports['webhookGet']=function(_0x3e3644,_0x331dc9,_0x461ae8){return BPromise[_0xb47d('0xa2')]()[_0xb47d('0x2e')](function(){if(!_0x3e3644['query']['path']){throw new Error(_0xb47d('0xa3'));}if(!_0x3e3644[_0xb47d('0x3c')]['port']){throw new Error('\x27PORT\x27\x20parameter\x20not\x20specified');}var _0xa88f25=_0x3e3644[_0xb47d('0x3c')]['hostname']?_0x3e3644[_0xb47d('0x3c')][_0xb47d('0xa4')]+':'+_0x3e3644[_0xb47d('0x3c')][_0xb47d('0xa5')]:_0xb47d('0xa6')+_0x3e3644[_0xb47d('0x3c')]['port'];var _0x1b86af=_0x3e3644[_0xb47d('0x3c')][_0xb47d('0x25')]?_0x3e3644['query'][_0xb47d('0x25')]:!![];var _0x21c627=_0x3e3644['query'][_0xb47d('0xa7')]?_0x3e3644[_0xb47d('0x3c')][_0xb47d('0xa7')]:null;var _0x2c4bd1={'method':_0x3e3644[_0xb47d('0xa8')],'uri':util[_0xb47d('0x68')](_0xb47d('0xa9'),_0xa88f25,_0x3e3644[_0xb47d('0x3c')][_0xb47d('0x8')]),'json':_0x1b86af,'resolveWithFullResponse':!![],'encoding':_0x21c627,'qs':_0x3e3644[_0xb47d('0x3c')]};if(_0x3e3644[_0xb47d('0xaa')]){_0x2c4bd1[_0xb47d('0xaa')]=_0x3e3644[_0xb47d('0xaa')];if(_0x2c4bd1[_0xb47d('0xaa')][_0xb47d('0xab')]){delete _0x2c4bd1[_0xb47d('0xaa')][_0xb47d('0xab')];}}if(_0x2c4bd1['headers'][_0xb47d('0xac')]){delete _0x2c4bd1['headers'][_0xb47d('0xac')];}return rp(_0x2c4bd1);})['then'](function(_0x23f4ae){if(_0x23f4ae){_0x331dc9[_0xb47d('0x27')](_0x23f4ae[_0xb47d('0xaa')]);logger[_0xb47d('0x6b')](_0x23f4ae[_0xb47d('0x99')]);if(_[_0xb47d('0xad')](_0x3e3644[_0xb47d('0x3c')]['path'],'download')&&_0x23f4ae['statusCode']==0x1f4){return _0x331dc9[_0xb47d('0x22')](_0x23f4ae['statusCode']);}else{return _0x331dc9['status'](_0x23f4ae[_0xb47d('0xae')])[_0xb47d('0x35')](_0x23f4ae[_0xb47d('0x99')]);}}else{return _0x331dc9[_0xb47d('0x22')](0xc8);}})[_0xb47d('0x4e')](handleError(_0x331dc9,null));};exports[_0xb47d('0xaf')]=function(_0x3b07b7,_0x207dcd,_0x5da881){return BPromise[_0xb47d('0xa2')]()[_0xb47d('0x2e')](function(){if(!_0x3b07b7[_0xb47d('0x3c')][_0xb47d('0x8')]){throw new Error(_0xb47d('0xa3'));}if(!_0x3b07b7[_0xb47d('0x3c')][_0xb47d('0xa5')]){throw new Error(_0xb47d('0xb0'));}var _0x1a57fc=_0x3b07b7[_0xb47d('0x3c')]['hostname']?_0x3b07b7[_0xb47d('0x3c')][_0xb47d('0xa4')]+':'+_0x3b07b7[_0xb47d('0x3c')]['port']:_0xb47d('0xa6')+_0x3b07b7['query'][_0xb47d('0xa5')];var _0x126bf7=_0x3b07b7[_0xb47d('0x3c')][_0xb47d('0x25')]?_0x3b07b7[_0xb47d('0x3c')][_0xb47d('0x25')]:!![];var _0x5e16ad=_0x3b07b7['query'][_0xb47d('0xa7')]?_0x3b07b7[_0xb47d('0x3c')][_0xb47d('0xa7')]:null;var _0xfe1ff2={'method':_0x3b07b7[_0xb47d('0xa8')],'uri':util[_0xb47d('0x68')](_0xb47d('0xa9'),_0x1a57fc,_0x3b07b7[_0xb47d('0x3c')]['path']),'json':_0x126bf7,'resolveWithFullResponse':!![],'encoding':_0x5e16ad,'body':_0x3b07b7['body']};if(_0x3b07b7[_0xb47d('0xaa')]){_0xfe1ff2[_0xb47d('0xaa')]=_0x3b07b7['headers'];if(_0xfe1ff2[_0xb47d('0xaa')][_0xb47d('0xab')]){delete _0xfe1ff2[_0xb47d('0xaa')]['content-length'];}}if(_0xfe1ff2[_0xb47d('0xaa')][_0xb47d('0xac')]){delete _0xfe1ff2[_0xb47d('0xaa')][_0xb47d('0xac')];}return rp(_0xfe1ff2);})[_0xb47d('0x2e')](function(_0x20fd2f){if(_0x20fd2f){_0x207dcd['set'](_0x20fd2f['headers']);logger[_0xb47d('0x6b')](_0x20fd2f[_0xb47d('0x99')]);return _0x207dcd['status'](_0x20fd2f['statusCode'])[_0xb47d('0x35')](_0x20fd2f[_0xb47d('0x99')]);}else{return _0x207dcd['sendStatus'](0xc8);}})[_0xb47d('0x4e')](handleError(_0x207dcd,null));}; \ No newline at end of file diff --git a/server/api/plugin/plugin.events.js b/server/api/plugin/plugin.events.js index 281a337..773c9bb 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 _0x68b3=['hook','exports','events','../../mysqldb','Plugin','setMaxListeners','save','remove','emit','hasOwnProperty'];(function(_0x48cac2,_0x483396){var _0xd2a59e=function(_0xbdac60){while(--_0xbdac60){_0x48cac2['push'](_0x48cac2['shift']());}};_0xd2a59e(++_0x483396);}(_0x68b3,0x1d8));var _0x368b=function(_0x575cc5,_0x350b68){_0x575cc5=_0x575cc5-0x0;var _0x5f4013=_0x68b3[_0x575cc5];return _0x5f4013;};'use strict';var EventEmitter=require(_0x368b('0x0'));var Plugin=require(_0x368b('0x1'))['db'][_0x368b('0x2')];var PluginEvents=new EventEmitter();PluginEvents[_0x368b('0x3')](0x0);var events={'afterCreate':_0x368b('0x4'),'afterUpdate':'update','afterDestroy':_0x368b('0x5')};function emitEvent(_0x3325ac){return function(_0xc40116,_0x404282,_0x5d68cb){PluginEvents[_0x368b('0x6')](_0x3325ac+':'+_0xc40116['id'],_0xc40116);PluginEvents[_0x368b('0x6')](_0x3325ac,_0xc40116);_0x5d68cb(null);};}for(var e in events){if(events[_0x368b('0x7')](e)){var event=events[e];Plugin[_0x368b('0x8')](e,emitEvent(event));}}module[_0x368b('0x9')]=PluginEvents; \ No newline at end of file +var _0x781d=['hasOwnProperty','exports','events','../../mysqldb','save','update','remove','emit'];(function(_0x51c819,_0xd812db){var _0x15c5d2=function(_0x2977f0){while(--_0x2977f0){_0x51c819['push'](_0x51c819['shift']());}};_0x15c5d2(++_0xd812db);}(_0x781d,0x14a));var _0xd781=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x781d[_0x1facfa];return _0x9ec701;};'use strict';var EventEmitter=require(_0xd781('0x0'));var Plugin=require(_0xd781('0x1'))['db']['Plugin'];var PluginEvents=new EventEmitter();PluginEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xd781('0x2'),'afterUpdate':_0xd781('0x3'),'afterDestroy':_0xd781('0x4')};function emitEvent(_0x1a9f94){return function(_0xfd915d,_0x42258e,_0x446534){PluginEvents[_0xd781('0x5')](_0x1a9f94+':'+_0xfd915d['id'],_0xfd915d);PluginEvents[_0xd781('0x5')](_0x1a9f94,_0xfd915d);_0x446534(null);};}for(var e in events){if(events[_0xd781('0x6')](e)){var event=events[e];Plugin['hook'](e,emitEvent(event));}}module[_0xd781('0x7')]=PluginEvents; \ No newline at end of file diff --git a/server/api/plugin/plugin.model.js b/server/api/plugin/plugin.model.js index 0f98192..0860cfa 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 _0xe602=['util','../../config/logger','moment','bluebird','request-promise','rimraf','../../config/environment','./plugin.attributes','exports','define','Plugin'];(function(_0x4aa741,_0x5134c1){var _0x272370=function(_0x1aa778){while(--_0x1aa778){_0x4aa741['push'](_0x4aa741['shift']());}};_0x272370(++_0x5134c1);}(_0xe602,0xa5));var _0x2e60=function(_0x2466c3,_0x20eb50){_0x2466c3=_0x2466c3-0x0;var _0x3ff6f1=_0xe602[_0x2466c3];return _0x3ff6f1;};'use strict';var _=require('lodash');var util=require(_0x2e60('0x0'));var logger=require(_0x2e60('0x1'))('api');var moment=require(_0x2e60('0x2'));var BPromise=require(_0x2e60('0x3'));var rp=require(_0x2e60('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x2e60('0x5'));var config=require(_0x2e60('0x6'));var attributes=require(_0x2e60('0x7'));module[_0x2e60('0x8')]=function(_0x5dddf7,_0x28a34b){return _0x5dddf7[_0x2e60('0x9')](_0x2e60('0xa'),attributes,{'tableName':'plugins','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc8c8=['../../config/logger','api','moment','bluebird','request-promise','rimraf','./plugin.attributes','exports','define','Plugin','lodash','util'];(function(_0x37756b,_0x24db76){var _0x46efec=function(_0x319807){while(--_0x319807){_0x37756b['push'](_0x37756b['shift']());}};_0x46efec(++_0x24db76);}(_0xc8c8,0xe2));var _0x8c8c=function(_0x501b9d,_0x19ee0e){_0x501b9d=_0x501b9d-0x0;var _0x120ad2=_0xc8c8[_0x501b9d];return _0x120ad2;};'use strict';var _=require(_0x8c8c('0x0'));var util=require(_0x8c8c('0x1'));var logger=require(_0x8c8c('0x2'))(_0x8c8c('0x3'));var moment=require(_0x8c8c('0x4'));var BPromise=require(_0x8c8c('0x5'));var rp=require(_0x8c8c('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x8c8c('0x7'));var config=require('../../config/environment');var attributes=require(_0x8c8c('0x8'));module[_0x8c8c('0x9')]=function(_0x391fe8,_0x268327){return _0x391fe8[_0x8c8c('0xa')](_0x8c8c('0xb'),attributes,{'tableName':'plugins','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/plugin/plugin.rpc.js b/server/api/plugin/plugin.rpc.js index 661dec2..dca4deb 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 _0xa35b=['Plugin,\x20%s,\x20%s','debug','stringify','error','message','request\x20sent','result','create','body','options','then','CreatePlugin','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','redis','defaults','localhost','socket.io-emitter','./plugin.socket','request','info'];(function(_0x2c992d,_0x338f90){var _0xa47a5b=function(_0x2b7eb7){while(--_0x2b7eb7){_0x2c992d['push'](_0x2c992d['shift']());}};_0xa47a5b(++_0x338f90);}(_0xa35b,0x1ed));var _0xba35=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0xa35b[_0x4565bf];return _0x5610ba;};'use strict';var _=require(_0xba35('0x0'));var util=require(_0xba35('0x1'));var moment=require('moment');var BPromise=require(_0xba35('0x2'));var rs=require(_0xba35('0x3'));var fs=require('fs');var Redis=require(_0xba35('0x4'));var db=require(_0xba35('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xba35('0x6'))(_0xba35('0x7'));var config=require(_0xba35('0x8'));var jayson=require(_0xba35('0x9'));var client=jayson['client']['http']({'port':0x232a});config[_0xba35('0xa')]=_[_0xba35('0xb')](config[_0xba35('0xa')],{'host':_0xba35('0xc'),'port':0x18eb});var socket=require(_0xba35('0xd'))(new Redis(config['redis']));require(_0xba35('0xe'))['register'](socket);function respondWithRpcPromise(_0x3aac9b,_0x54d8e1,_0x203aa7){return new BPromise(function(_0xb6ddc6,_0x31bc10){return client[_0xba35('0xf')](_0x3aac9b,_0x203aa7)['then'](function(_0x1327ff){logger[_0xba35('0x10')](_0xba35('0x11'),_0x54d8e1,'request\x20sent');logger[_0xba35('0x12')]('Plugin,\x20%s,\x20%s,\x20%s',_0x54d8e1,'request\x20sent',JSON[_0xba35('0x13')](_0x1327ff));if(_0x1327ff[_0xba35('0x14')]){if(_0x1327ff[_0xba35('0x14')]['code']===0x1f4){logger['error'](_0xba35('0x11'),_0x54d8e1,_0x1327ff[_0xba35('0x14')][_0xba35('0x15')]);return _0x31bc10(_0x1327ff[_0xba35('0x14')]['message']);}logger['error'](_0xba35('0x11'),_0x54d8e1,_0x1327ff[_0xba35('0x14')][_0xba35('0x15')]);return _0xb6ddc6(_0x1327ff[_0xba35('0x14')][_0xba35('0x15')]);}else{logger['info'](_0xba35('0x11'),_0x54d8e1,_0xba35('0x16'));_0xb6ddc6(_0x1327ff[_0xba35('0x17')][_0xba35('0x15')]);}})['catch'](function(_0x435956){logger[_0xba35('0x14')](_0xba35('0x11'),_0x54d8e1,_0x435956);_0x31bc10(_0x435956);});});}exports['CreatePlugin']=function(_0x3f6979){var _0x20d50d=this;return new Promise(function(_0x2ddf21,_0x3a69e6){return db['Plugin'][_0xba35('0x18')](_0x3f6979[_0xba35('0x19')],{'raw':_0x3f6979[_0xba35('0x1a')]?_0x3f6979['options']['raw']===undefined?!![]:![]:!![]})[_0xba35('0x1b')](function(_0x5215b5){logger[_0xba35('0x10')](_0xba35('0x1c'),_0x3f6979);logger[_0xba35('0x12')](_0xba35('0x1c'),_0x3f6979,JSON[_0xba35('0x13')](_0x5215b5));_0x2ddf21(_0x5215b5);})[_0xba35('0x1d')](function(_0x4fa2fc){logger[_0xba35('0x14')](_0xba35('0x1c'),_0x4fa2fc['message'],_0x3f6979);_0x3a69e6(_0x20d50d[_0xba35('0x14')](0x1f4,_0x4fa2fc['message']));});});}; \ No newline at end of file +var _0xe384=['create','body','options','raw','then','debug','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','./plugin.socket','register','info','Plugin,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','CreatePlugin','Plugin'];(function(_0x35edb8,_0x2f1885){var _0x1f0246=function(_0x4ae489){while(--_0x4ae489){_0x35edb8['push'](_0x35edb8['shift']());}};_0x1f0246(++_0x2f1885);}(_0xe384,0x8b));var _0x4e38=function(_0x2a2359,_0x9abb35){_0x2a2359=_0x2a2359-0x0;var _0x342108=_0xe384[_0x2a2359];return _0x342108;};'use strict';var _=require(_0x4e38('0x0'));var util=require(_0x4e38('0x1'));var moment=require(_0x4e38('0x2'));var BPromise=require(_0x4e38('0x3'));var rs=require(_0x4e38('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x4e38('0x5'))['db'];var utils=require(_0x4e38('0x6'));var logger=require('../../config/logger')(_0x4e38('0x7'));var config=require(_0x4e38('0x8'));var jayson=require(_0x4e38('0x9'));var client=jayson[_0x4e38('0xa')][_0x4e38('0xb')]({'port':0x232a});config[_0x4e38('0xc')]=_[_0x4e38('0xd')](config[_0x4e38('0xc')],{'host':_0x4e38('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x4e38('0xc')]));require(_0x4e38('0xf'))[_0x4e38('0x10')](socket);function respondWithRpcPromise(_0x49d842,_0x1d7981,_0x3a047c){return new BPromise(function(_0x398eea,_0x2d2cd2){return client['request'](_0x49d842,_0x3a047c)['then'](function(_0x18c2a1){logger[_0x4e38('0x11')](_0x4e38('0x12'),_0x1d7981,_0x4e38('0x13'));logger['debug']('Plugin,\x20%s,\x20%s,\x20%s',_0x1d7981,'request\x20sent',JSON[_0x4e38('0x14')](_0x18c2a1));if(_0x18c2a1[_0x4e38('0x15')]){if(_0x18c2a1[_0x4e38('0x15')]['code']===0x1f4){logger['error'](_0x4e38('0x12'),_0x1d7981,_0x18c2a1[_0x4e38('0x15')][_0x4e38('0x16')]);return _0x2d2cd2(_0x18c2a1[_0x4e38('0x15')][_0x4e38('0x16')]);}logger[_0x4e38('0x15')]('Plugin,\x20%s,\x20%s',_0x1d7981,_0x18c2a1[_0x4e38('0x15')][_0x4e38('0x16')]);return _0x398eea(_0x18c2a1[_0x4e38('0x15')][_0x4e38('0x16')]);}else{logger[_0x4e38('0x11')](_0x4e38('0x12'),_0x1d7981,_0x4e38('0x13'));_0x398eea(_0x18c2a1[_0x4e38('0x17')][_0x4e38('0x16')]);}})['catch'](function(_0x5ce17e){logger['error'](_0x4e38('0x12'),_0x1d7981,_0x5ce17e);_0x2d2cd2(_0x5ce17e);});});}exports[_0x4e38('0x18')]=function(_0x44d5bf){var _0x2ecf20=this;return new Promise(function(_0x5ce12f,_0x123afb){return db[_0x4e38('0x19')][_0x4e38('0x1a')](_0x44d5bf[_0x4e38('0x1b')],{'raw':_0x44d5bf[_0x4e38('0x1c')]?_0x44d5bf[_0x4e38('0x1c')][_0x4e38('0x1d')]===undefined?!![]:![]:!![]})[_0x4e38('0x1e')](function(_0x14b473){logger[_0x4e38('0x11')](_0x4e38('0x18'),_0x44d5bf);logger[_0x4e38('0x1f')](_0x4e38('0x18'),_0x44d5bf,JSON[_0x4e38('0x14')](_0x14b473));_0x5ce12f(_0x14b473);})[_0x4e38('0x20')](function(_0x1d5811){logger[_0x4e38('0x15')]('CreatePlugin',_0x1d5811[_0x4e38('0x16')],_0x44d5bf);_0x123afb(_0x2ecf20[_0x4e38('0x15')](0x1f4,_0x1d5811[_0x4e38('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/plugin/plugin.socket.js b/server/api/plugin/plugin.socket.js index 422442f..b574181 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 _0xdaa8=['removeListener','register','length','plugin:','./plugin.events','save','remove','update'];(function(_0x4e3e7c,_0x2e090e){var _0x3a94a9=function(_0x292f07){while(--_0x292f07){_0x4e3e7c['push'](_0x4e3e7c['shift']());}};_0x3a94a9(++_0x2e090e);}(_0xdaa8,0xe4));var _0x8daa=function(_0x41e1c0,_0x2172aa){_0x41e1c0=_0x41e1c0-0x0;var _0x581cbd=_0xdaa8[_0x41e1c0];return _0x581cbd;};'use strict';var PluginEvents=require(_0x8daa('0x0'));var events=[_0x8daa('0x1'),_0x8daa('0x2'),_0x8daa('0x3')];function createListener(_0x5a8862,_0x4ce1a9){return function(_0x58f7c0){_0x4ce1a9['emit'](_0x5a8862,_0x58f7c0);};}function removeListener(_0x4d1f23,_0x576670){return function(){PluginEvents[_0x8daa('0x4')](_0x4d1f23,_0x576670);};}exports[_0x8daa('0x5')]=function(_0x46f753){for(var _0x4d2392=0x0,_0x4e8116=events[_0x8daa('0x6')];_0x4d2392<_0x4e8116;_0x4d2392++){var _0x48bf41=events[_0x4d2392];var _0x41de3e=createListener(_0x8daa('0x7')+_0x48bf41,_0x46f753);PluginEvents['on'](_0x48bf41,_0x41de3e);}}; \ No newline at end of file +var _0x4d00=['removeListener','register','length','plugin:','./plugin.events','save','update','emit'];(function(_0x216d45,_0x4989fe){var _0xbaac0b=function(_0x308a41){while(--_0x308a41){_0x216d45['push'](_0x216d45['shift']());}};_0xbaac0b(++_0x4989fe);}(_0x4d00,0x7c));var _0x04d0=function(_0x1d611d,_0x4f1847){_0x1d611d=_0x1d611d-0x0;var _0x4edae6=_0x4d00[_0x1d611d];return _0x4edae6;};'use strict';var PluginEvents=require(_0x04d0('0x0'));var events=[_0x04d0('0x1'),'remove',_0x04d0('0x2')];function createListener(_0x381b73,_0x38c783){return function(_0x3c3f50){_0x38c783[_0x04d0('0x3')](_0x381b73,_0x3c3f50);};}function removeListener(_0x3307ff,_0xe00684){return function(){PluginEvents[_0x04d0('0x4')](_0x3307ff,_0xe00684);};}exports[_0x04d0('0x5')]=function(_0x5d6246){for(var _0x11608c=0x0,_0x1b652a=events[_0x04d0('0x6')];_0x11608c<_0x1b652a;_0x11608c++){var _0xbc896=events[_0x11608c];var _0x5c1cdb=createListener(_0x04d0('0x7')+_0xbc896,_0x5d6246);PluginEvents['on'](_0xbc896,_0x5c1cdb);}}; \ No newline at end of file diff --git a/server/api/pm2/index.js b/server/api/pm2/index.js index a26a56b..03b26d6 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 _0x39f7=['put','update','destroy','exports','Router','../../components/auth/service','./pm2.controller','get','isAuthenticated','index','/:id','show','create'];(function(_0x2aa0e7,_0x4e5145){var _0x1472c0=function(_0x4deaeb){while(--_0x4deaeb){_0x2aa0e7['push'](_0x2aa0e7['shift']());}};_0x1472c0(++_0x4e5145);}(_0x39f7,0x170));var _0x739f=function(_0x1b3564,_0x16c919){_0x1b3564=_0x1b3564-0x0;var _0x504069=_0x39f7[_0x1b3564];return _0x504069;};'use strict';var express=require('express');var router=express[_0x739f('0x0')]();var auth=require(_0x739f('0x1'));var controller=require(_0x739f('0x2'));router[_0x739f('0x3')]('/',auth[_0x739f('0x4')](),controller[_0x739f('0x5')]);router[_0x739f('0x3')](_0x739f('0x6'),auth[_0x739f('0x4')](),controller[_0x739f('0x7')]);router['post']('/',auth[_0x739f('0x4')](),controller[_0x739f('0x8')]);router[_0x739f('0x9')]('/:id',auth[_0x739f('0x4')](),controller[_0x739f('0xa')]);router['delete'](_0x739f('0x6'),auth[_0x739f('0x4')](),controller[_0x739f('0xb')]);module[_0x739f('0xc')]=router; \ No newline at end of file +var _0x6e5f=['index','/:id','post','put','update','delete','destroy','express','Router','../../components/auth/service','./pm2.controller','get','isAuthenticated'];(function(_0x20ac66,_0x242c55){var _0x3b4f46=function(_0x361cee){while(--_0x361cee){_0x20ac66['push'](_0x20ac66['shift']());}};_0x3b4f46(++_0x242c55);}(_0x6e5f,0x1e8));var _0xf6e5=function(_0x59750f,_0x274c1e){_0x59750f=_0x59750f-0x0;var _0x2fbda0=_0x6e5f[_0x59750f];return _0x2fbda0;};'use strict';var express=require(_0xf6e5('0x0'));var router=express[_0xf6e5('0x1')]();var auth=require(_0xf6e5('0x2'));var controller=require(_0xf6e5('0x3'));router[_0xf6e5('0x4')]('/',auth[_0xf6e5('0x5')](),controller[_0xf6e5('0x6')]);router[_0xf6e5('0x4')](_0xf6e5('0x7'),auth[_0xf6e5('0x5')](),controller['show']);router[_0xf6e5('0x8')]('/',auth[_0xf6e5('0x5')](),controller['create']);router[_0xf6e5('0x9')](_0xf6e5('0x7'),auth[_0xf6e5('0x5')](),controller[_0xf6e5('0xa')]);router[_0xf6e5('0xb')](_0xf6e5('0x7'),auth[_0xf6e5('0x5')](),controller[_0xf6e5('0xc')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/pm2/pm2.controller.js b/server/api/pm2/pm2.controller.js index ebd1977..f6d6c0c 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 _0x5abf=['script','join','../../files/plugins','cwd','chdir','dump','Missing\x20name\x20and/or\x20path','stop','params','send','lodash','../../config/pm2','api','path','child_process','bluebird','sendStatus','status','json','error','stack','npm\x20install','info','index','list','reject','name','motion2','length','then','catch','show','describe','create','body'];(function(_0x2a7e04,_0x5369d7){var _0xd2c915=function(_0x9daa1c){while(--_0x9daa1c){_0x2a7e04['push'](_0x2a7e04['shift']());}};_0xd2c915(++_0x5369d7);}(_0x5abf,0x1d1));var _0xf5ab=function(_0xd3d5c3,_0x42d2af){_0xd3d5c3=_0xd3d5c3-0x0;var _0x29a808=_0x5abf[_0xd3d5c3];return _0x29a808;};'use strict';var _=require(_0xf5ab('0x0'));var pm2=require(_0xf5ab('0x1'));var logger=require('../../config/logger')(_0xf5ab('0x2'));var path=require(_0xf5ab('0x3'));var exec=require(_0xf5ab('0x4'))['exec'];var BPromise=require(_0xf5ab('0x5'));function handleEntityNotFound(_0x46e76c,_0x2caaac){return function(_0x2d852e){if(!_0x2d852e){_0x46e76c[_0xf5ab('0x6')](0x194);;}return _0x2d852e;};}function respondWithResult(_0x43c723,_0x229e35){_0x229e35=_0x229e35||0xc8;return function(_0xa91d27){if(_0xa91d27){return _0x43c723[_0xf5ab('0x7')](_0x229e35)[_0xf5ab('0x8')](_0xa91d27);}return null;};}function handleError(_0x46dc38,_0x40ea75){_0x40ea75=_0x40ea75||0x1f4;return function(_0x6b991){logger[_0xf5ab('0x9')](_0x6b991[_0xf5ab('0xa')]);if(_0x6b991['name']){delete _0x6b991['name'];}_0x46dc38[_0xf5ab('0x7')](_0x40ea75)['send'](_0x6b991);};}function execChildProcess(){return new BPromise(function(_0x424074,_0x276fe1){exec(_0xf5ab('0xb'),function(_0x9b03cd,_0x1dbbd4,_0x5b74e0){logger[_0xf5ab('0xc')](_0x1dbbd4);logger[_0xf5ab('0xc')](_0x5b74e0);if(_0x9b03cd){logger['error'](_0x9b03cd);return _0x276fe1(_0x9b03cd);}return _0x424074(_0x1dbbd4);});});}exports[_0xf5ab('0xd')]=function(_0x24e185,_0x5b65af){return pm2[_0xf5ab('0xe')]()['then'](function(_0x163dd4){if(_0x163dd4){var _0x5e4274=_[_0xf5ab('0xf')](_0x163dd4,function(_0x433584){return _0x433584[_0xf5ab('0x10')]==='express'||_0x433584[_0xf5ab('0x10')]===_0xf5ab('0x11');});return{'rows':_0x5e4274,'count':_0x5e4274[_0xf5ab('0x12')]};}return null;})[_0xf5ab('0x13')](respondWithResult(_0x5b65af,null))[_0xf5ab('0x14')](handleError(_0x5b65af,null));};exports[_0xf5ab('0x15')]=function(_0xd2316a,_0x2ecb3c){return pm2[_0xf5ab('0x16')](_0xd2316a['params']['id'])[_0xf5ab('0x13')](respondWithResult(_0x2ecb3c,null))[_0xf5ab('0x13')](handleEntityNotFound(_0x2ecb3c,null))['catch'](handleError(_0x2ecb3c,null));};exports[_0xf5ab('0x17')]=function(_0x569bc1,_0x13a381){if(_0x569bc1['body'][_0xf5ab('0x10')]&&_0x569bc1[_0xf5ab('0x18')][_0xf5ab('0x19')]){var _0x313db5=path[_0xf5ab('0x1a')](__dirname,_0xf5ab('0x1b'),_0x569bc1[_0xf5ab('0x18')]['script']);var _0x581ad5=process[_0xf5ab('0x1c')]();process[_0xf5ab('0x1d')](path['dirname'](_0x313db5));return execChildProcess()['then'](function(_0x161fd2){process['chdir'](_0x581ad5);return pm2['start']({'name':_0x569bc1[_0xf5ab('0x18')][_0xf5ab('0x10')],'script':_0x313db5});})[_0xf5ab('0x13')](function(_0x238665){pm2[_0xf5ab('0x1e')]();return _0x238665[0x0];})[_0xf5ab('0x13')](respondWithResult(_0x13a381,0xc9))[_0xf5ab('0x14')](handleError(_0x13a381,null));}else{return _0x13a381[_0xf5ab('0x7')](0x1f4)['send']({'message':_0xf5ab('0x1f')});}};exports['update']=function(_0x424a9,_0x20b265){if(_0x424a9[_0xf5ab('0x18')]['id']){delete _0x424a9['body']['id'];}var _0x3fd1ef={'online':'restart','stopped':_0xf5ab('0x20')};if(_0x3fd1ef['hasOwnProperty'](_0x424a9[_0xf5ab('0x18')][_0xf5ab('0x7')])){return pm2[_0x3fd1ef[_0x424a9[_0xf5ab('0x18')][_0xf5ab('0x7')]]](_0x424a9[_0xf5ab('0x21')]['id'])[_0xf5ab('0x13')](respondWithResult(_0x20b265,0xc8))[_0xf5ab('0x14')](handleError(_0x20b265,null));}else{return _0x20b265[_0xf5ab('0x7')](0x1f4)[_0xf5ab('0x22')]({'message':'Unknown\x20status'});}};exports['destroy']=function(_0x758baa,_0x1b26d9){if(_0x758baa['body']['id']){delete _0x758baa[_0xf5ab('0x18')]['id'];}if(_0x758baa[_0xf5ab('0x21')]['id']){return pm2['delete'](_0x758baa[_0xf5ab('0x21')]['id'])[_0xf5ab('0x13')](function(_0x2fb549){pm2[_0xf5ab('0x1e')]();return _0x2fb549[0x0];})[_0xf5ab('0x13')](respondWithResult(_0x1b26d9,null))[_0xf5ab('0x14')](handleError(_0x1b26d9,null));}else{return _0x1b26d9[_0xf5ab('0x7')](0x1f4)[_0xf5ab('0x22')]({'message':'Unknown\x20id'});}}; \ No newline at end of file +var _0x4f37=['dirname','start','send','Missing\x20name\x20and/or\x20path','update','stop','hasOwnProperty','Unknown\x20status','destroy','params','Unknown\x20id','../../config/pm2','api','child_process','exec','bluebird','sendStatus','status','json','error','stack','name','npm\x20install','info','index','reject','express','motion2','length','then','show','describe','catch','create','body','../../files/plugins','cwd','chdir'];(function(_0x536c83,_0xe956ca){var _0x2a5945=function(_0x354ab2){while(--_0x354ab2){_0x536c83['push'](_0x536c83['shift']());}};_0x2a5945(++_0xe956ca);}(_0x4f37,0x1d3));var _0x74f3=function(_0x238e43,_0x51d1f0){_0x238e43=_0x238e43-0x0;var _0x38e1be=_0x4f37[_0x238e43];return _0x38e1be;};'use strict';var _=require('lodash');var pm2=require(_0x74f3('0x0'));var logger=require('../../config/logger')(_0x74f3('0x1'));var path=require('path');var exec=require(_0x74f3('0x2'))[_0x74f3('0x3')];var BPromise=require(_0x74f3('0x4'));function handleEntityNotFound(_0x5d3a49,_0x2e6ce1){return function(_0x30604f){if(!_0x30604f){_0x5d3a49[_0x74f3('0x5')](0x194);;}return _0x30604f;};}function respondWithResult(_0x568461,_0x24861c){_0x24861c=_0x24861c||0xc8;return function(_0x51ff33){if(_0x51ff33){return _0x568461[_0x74f3('0x6')](_0x24861c)[_0x74f3('0x7')](_0x51ff33);}return null;};}function handleError(_0x2dd67b,_0x32c6ca){_0x32c6ca=_0x32c6ca||0x1f4;return function(_0x194929){logger[_0x74f3('0x8')](_0x194929[_0x74f3('0x9')]);if(_0x194929[_0x74f3('0xa')]){delete _0x194929[_0x74f3('0xa')];}_0x2dd67b[_0x74f3('0x6')](_0x32c6ca)['send'](_0x194929);};}function execChildProcess(){return new BPromise(function(_0x3b2bf6,_0x2977c5){exec(_0x74f3('0xb'),function(_0x24802a,_0x3645d7,_0xfcc739){logger['info'](_0x3645d7);logger[_0x74f3('0xc')](_0xfcc739);if(_0x24802a){logger[_0x74f3('0x8')](_0x24802a);return _0x2977c5(_0x24802a);}return _0x3b2bf6(_0x3645d7);});});}exports[_0x74f3('0xd')]=function(_0x4ab3df,_0x4f7259){return pm2['list']()['then'](function(_0x5d2377){if(_0x5d2377){var _0x2cad05=_[_0x74f3('0xe')](_0x5d2377,function(_0x17e533){return _0x17e533[_0x74f3('0xa')]===_0x74f3('0xf')||_0x17e533[_0x74f3('0xa')]===_0x74f3('0x10');});return{'rows':_0x2cad05,'count':_0x2cad05[_0x74f3('0x11')]};}return null;})[_0x74f3('0x12')](respondWithResult(_0x4f7259,null))['catch'](handleError(_0x4f7259,null));};exports[_0x74f3('0x13')]=function(_0x2462e3,_0x1c4574){return pm2[_0x74f3('0x14')](_0x2462e3['params']['id'])[_0x74f3('0x12')](respondWithResult(_0x1c4574,null))[_0x74f3('0x12')](handleEntityNotFound(_0x1c4574,null))[_0x74f3('0x15')](handleError(_0x1c4574,null));};exports[_0x74f3('0x16')]=function(_0x4b4d99,_0xe45cd3){if(_0x4b4d99[_0x74f3('0x17')]['name']&&_0x4b4d99[_0x74f3('0x17')]['script']){var _0x51f82f=path['join'](__dirname,_0x74f3('0x18'),_0x4b4d99['body']['script']);var _0x9c29e5=process[_0x74f3('0x19')]();process[_0x74f3('0x1a')](path[_0x74f3('0x1b')](_0x51f82f));return execChildProcess()[_0x74f3('0x12')](function(_0x4ba4ea){process[_0x74f3('0x1a')](_0x9c29e5);return pm2[_0x74f3('0x1c')]({'name':_0x4b4d99[_0x74f3('0x17')]['name'],'script':_0x51f82f});})[_0x74f3('0x12')](function(_0x2430bb){pm2['dump']();return _0x2430bb[0x0];})[_0x74f3('0x12')](respondWithResult(_0xe45cd3,0xc9))['catch'](handleError(_0xe45cd3,null));}else{return _0xe45cd3['status'](0x1f4)[_0x74f3('0x1d')]({'message':_0x74f3('0x1e')});}};exports[_0x74f3('0x1f')]=function(_0x145e2e,_0x1b22b8){if(_0x145e2e[_0x74f3('0x17')]['id']){delete _0x145e2e[_0x74f3('0x17')]['id'];}var _0x5909cd={'online':'restart','stopped':_0x74f3('0x20')};if(_0x5909cd[_0x74f3('0x21')](_0x145e2e['body']['status'])){return pm2[_0x5909cd[_0x145e2e['body'][_0x74f3('0x6')]]](_0x145e2e['params']['id'])[_0x74f3('0x12')](respondWithResult(_0x1b22b8,0xc8))[_0x74f3('0x15')](handleError(_0x1b22b8,null));}else{return _0x1b22b8[_0x74f3('0x6')](0x1f4)[_0x74f3('0x1d')]({'message':_0x74f3('0x22')});}};exports[_0x74f3('0x23')]=function(_0x1d8756,_0x266e2d){if(_0x1d8756[_0x74f3('0x17')]['id']){delete _0x1d8756['body']['id'];}if(_0x1d8756[_0x74f3('0x24')]['id']){return pm2['delete'](_0x1d8756[_0x74f3('0x24')]['id'])[_0x74f3('0x12')](function(_0x4ce3d0){pm2['dump']();return _0x4ce3d0[0x0];})[_0x74f3('0x12')](respondWithResult(_0x266e2d,null))['catch'](handleError(_0x266e2d,null));}else{return _0x266e2d[_0x74f3('0x6')](0x1f4)['send']({'message':_0x74f3('0x25')});}}; \ No newline at end of file diff --git a/server/api/reportAgentPreview/index.js b/server/api/reportAgentPreview/index.js index 09e806e..242d88d 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 _0xf336=['../../config/environment','exports','util','path','connect-timeout','express','Router','../../components/interaction/service'];(function(_0x21ca83,_0x468424){var _0x56d4bb=function(_0x43e25e){while(--_0x43e25e){_0x21ca83['push'](_0x21ca83['shift']());}};_0x56d4bb(++_0x468424);}(_0xf336,0xf2));var _0x6f33=function(_0x5c87d7,_0xc786e0){_0x5c87d7=_0x5c87d7-0x0;var _0xf9533a=_0xf336[_0x5c87d7];return _0xf9533a;};'use strict';var multer=require('multer');var util=require(_0x6f33('0x0'));var path=require(_0x6f33('0x1'));var timeout=require(_0x6f33('0x2'));var express=require(_0x6f33('0x3'));var router=express[_0x6f33('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x6f33('0x5'));var config=require(_0x6f33('0x6'));module[_0x6f33('0x7')]=router; \ No newline at end of file +var _0xf916=['path','connect-timeout','../../components/auth/service','../../components/interaction/service','../../config/environment','multer'];(function(_0x503950,_0x5022eb){var _0x1657a9=function(_0x4c1e8f){while(--_0x4c1e8f){_0x503950['push'](_0x503950['shift']());}};_0x1657a9(++_0x5022eb);}(_0xf916,0xf5));var _0x6f91=function(_0x464b9c,_0x220cd4){_0x464b9c=_0x464b9c-0x0;var _0x801f58=_0xf916[_0x464b9c];return _0x801f58;};'use strict';var multer=require(_0x6f91('0x0'));var util=require('util');var path=require(_0x6f91('0x1'));var timeout=require(_0x6f91('0x2'));var express=require('express');var router=express['Router']();var auth=require(_0x6f91('0x3'));var interaction=require(_0x6f91('0x4'));var config=require(_0x6f91('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 c128d81..7c6ec69 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 _0x89e7=['exports','STRING','DATE','INTEGER','sequelize'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x89e7,0x144));var _0x789e=function(_0x25e7cb,_0x3579b7){_0x25e7cb=_0x25e7cb-0x0;var _0x375d92=_0x89e7[_0x25e7cb];return _0x375d92;};'use strict';var Sequelize=require(_0x789e('0x0'));module[_0x789e('0x1')]={'state':{'type':Sequelize['INTEGER'](0x2)},'statedesc':{'type':Sequelize['STRING']},'scheduledat':{'type':Sequelize['DATE']},'uniqueid':{'type':Sequelize[_0x789e('0x2')]},'starttime':{'type':Sequelize[_0x789e('0x3')]},'responsetime':{'type':Sequelize[_0x789e('0x3')]},'ringtime':{'type':Sequelize[_0x789e('0x4')],'defaultValue':0x0},'campaign':{'type':Sequelize['STRING']},'campaigntype':{'type':Sequelize[_0x789e('0x2')]},'membername':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x7223=['sequelize','exports','STRING','DATE','INTEGER'];(function(_0x9309,_0x1f26ca){var _0x2b0a89=function(_0x341668){while(--_0x341668){_0x9309['push'](_0x9309['shift']());}};_0x2b0a89(++_0x1f26ca);}(_0x7223,0x154));var _0x3722=function(_0x243b2f,_0x30aa15){_0x243b2f=_0x243b2f-0x0;var _0xcb3c2d=_0x7223[_0x243b2f];return _0xcb3c2d;};'use strict';var Sequelize=require(_0x3722('0x0'));module[_0x3722('0x1')]={'state':{'type':Sequelize['INTEGER'](0x2)},'statedesc':{'type':Sequelize[_0x3722('0x2')]},'scheduledat':{'type':Sequelize[_0x3722('0x3')]},'uniqueid':{'type':Sequelize['STRING']},'starttime':{'type':Sequelize['DATE']},'responsetime':{'type':Sequelize[_0x3722('0x3')]},'ringtime':{'type':Sequelize[_0x3722('0x4')],'defaultValue':0x0},'campaign':{'type':Sequelize['STRING']},'campaigntype':{'type':Sequelize[_0x3722('0x2')]},'membername':{'type':Sequelize[_0x3722('0x2')]}}; \ No newline at end of file diff --git a/server/api/reportAgentPreview/reportAgentPreview.model.js b/server/api/reportAgentPreview/reportAgentPreview.model.js index 962495f..9014a5c 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 _0x9453=['lodash','util','api','moment','bluebird','request-promise','path','../../config/environment','./reportAgentPreview.attributes','exports','define'];(function(_0x24b245,_0x1b3508){var _0x56f828=function(_0x21752a){while(--_0x21752a){_0x24b245['push'](_0x24b245['shift']());}};_0x56f828(++_0x1b3508);}(_0x9453,0x1a2));var _0x3945=function(_0x12e86d,_0x49f172){_0x12e86d=_0x12e86d-0x0;var _0x412550=_0x9453[_0x12e86d];return _0x412550;};'use strict';var _=require(_0x3945('0x0'));var util=require(_0x3945('0x1'));var logger=require('../../config/logger')(_0x3945('0x2'));var moment=require(_0x3945('0x3'));var BPromise=require(_0x3945('0x4'));var rp=require(_0x3945('0x5'));var fs=require('fs');var path=require(_0x3945('0x6'));var rimraf=require('rimraf');var config=require(_0x3945('0x7'));var attributes=require(_0x3945('0x8'));module[_0x3945('0x9')]=function(_0x3ab1f0,_0x4a3000){return _0x3ab1f0[_0x3945('0xa')]('ReportAgentPreview',attributes,{'tableName':'report_agent_preview','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd840=['rimraf','./reportAgentPreview.attributes','exports','report_agent_preview','util','../../config/logger','api','moment','request-promise','path'];(function(_0x4b055c,_0x4b870b){var _0x4b62bb=function(_0x4884c2){while(--_0x4884c2){_0x4b055c['push'](_0x4b055c['shift']());}};_0x4b62bb(++_0x4b870b);}(_0xd840,0x14e));var _0x0d84=function(_0x26a46b,_0x54c9c1){_0x26a46b=_0x26a46b-0x0;var _0x226e55=_0xd840[_0x26a46b];return _0x226e55;};'use strict';var _=require('lodash');var util=require(_0x0d84('0x0'));var logger=require(_0x0d84('0x1'))(_0x0d84('0x2'));var moment=require(_0x0d84('0x3'));var BPromise=require('bluebird');var rp=require(_0x0d84('0x4'));var fs=require('fs');var path=require(_0x0d84('0x5'));var rimraf=require(_0x0d84('0x6'));var config=require('../../config/environment');var attributes=require(_0x0d84('0x7'));module[_0x0d84('0x8')]=function(_0x41527c,_0x1c9c88){return _0x41527c['define']('ReportAgentPreview',attributes,{'tableName':_0x0d84('0x9'),'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 2cd2c79..782c896 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 _0x70be=['options','raw','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','jayson/promise','http','request','then','info','ReportAgentPreview,\x20%s,\x20%s','ReportAgentPreview,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','catch','CreateReportAgentPreview','ReportAgentPreview','create'];(function(_0x4f517f,_0x15e66f){var _0x48bc81=function(_0x275f58){while(--_0x275f58){_0x4f517f['push'](_0x4f517f['shift']());}};_0x48bc81(++_0x15e66f);}(_0x70be,0x154));var _0xe70b=function(_0x2d3039,_0x47b955){_0x2d3039=_0x2d3039-0x0;var _0x4c16b7=_0x70be[_0x2d3039];return _0x4c16b7;};'use strict';var _=require(_0xe70b('0x0'));var util=require(_0xe70b('0x1'));var moment=require(_0xe70b('0x2'));var BPromise=require(_0xe70b('0x3'));var rs=require(_0xe70b('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xe70b('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xe70b('0x6'))(_0xe70b('0x7'));var config=require('../../config/environment');var jayson=require(_0xe70b('0x8'));var client=jayson['client'][_0xe70b('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5d9b48,_0x53c0bf,_0x22e8e1){return new BPromise(function(_0x31465c,_0x201332){return client[_0xe70b('0xa')](_0x5d9b48,_0x22e8e1)[_0xe70b('0xb')](function(_0x15ee6f){logger[_0xe70b('0xc')](_0xe70b('0xd'),_0x53c0bf,'request\x20sent');logger['debug'](_0xe70b('0xe'),_0x53c0bf,'request\x20sent',JSON[_0xe70b('0xf')](_0x15ee6f));if(_0x15ee6f[_0xe70b('0x10')]){if(_0x15ee6f[_0xe70b('0x10')][_0xe70b('0x11')]===0x1f4){logger[_0xe70b('0x10')](_0xe70b('0xd'),_0x53c0bf,_0x15ee6f[_0xe70b('0x10')][_0xe70b('0x12')]);return _0x201332(_0x15ee6f[_0xe70b('0x10')][_0xe70b('0x12')]);}logger['error'](_0xe70b('0xd'),_0x53c0bf,_0x15ee6f['error'][_0xe70b('0x12')]);return _0x31465c(_0x15ee6f[_0xe70b('0x10')]['message']);}else{logger[_0xe70b('0xc')](_0xe70b('0xd'),_0x53c0bf,_0xe70b('0x13'));_0x31465c(_0x15ee6f['result'][_0xe70b('0x12')]);}})[_0xe70b('0x14')](function(_0x15c18e){logger['error'](_0xe70b('0xd'),_0x53c0bf,_0x15c18e);_0x201332(_0x15c18e);});});}exports[_0xe70b('0x15')]=function(_0x4fe4ab){var _0x5d69e1=this;return new Promise(function(_0x505ba7,_0x159c93){return db[_0xe70b('0x16')][_0xe70b('0x17')](_0x4fe4ab['body'],{'raw':_0x4fe4ab[_0xe70b('0x18')]?_0x4fe4ab[_0xe70b('0x18')][_0xe70b('0x19')]===undefined?!![]:![]:!![]})[_0xe70b('0xb')](function(_0x1a785f){logger[_0xe70b('0xc')](_0xe70b('0x15'),_0x4fe4ab);logger['debug'](_0xe70b('0x15'),_0x4fe4ab,JSON[_0xe70b('0xf')](_0x1a785f));_0x505ba7(_0x1a785f);})[_0xe70b('0x14')](function(_0x4b8f28){logger[_0xe70b('0x10')](_0xe70b('0x15'),_0x4b8f28[_0xe70b('0x12')],_0x4fe4ab);_0x159c93(_0x5d69e1[_0xe70b('0x10')](0x1f4,_0x4b8f28['message']));});});}; \ No newline at end of file +var _0x7684=['request','then','info','ReportAgentPreview,\x20%s,\x20%s','request\x20sent','debug','ReportAgentPreview,\x20%s,\x20%s,\x20%s','error','code','message','ReportAgentPreview','create','body','options','raw','CreateReportAgentPreview','stringify','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http'];(function(_0x4f1140,_0xdd3e4d){var _0x3e8bbe=function(_0x23d4c9){while(--_0x23d4c9){_0x4f1140['push'](_0x4f1140['shift']());}};_0x3e8bbe(++_0xdd3e4d);}(_0x7684,0x11f));var _0x4768=function(_0x2fe31b,_0x345e28){_0x2fe31b=_0x2fe31b-0x0;var _0x13b946=_0x7684[_0x2fe31b];return _0x13b946;};'use strict';var _=require(_0x4768('0x0'));var util=require('util');var moment=require(_0x4768('0x1'));var BPromise=require(_0x4768('0x2'));var rs=require(_0x4768('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x4768('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x4768('0x5'))('rpc');var config=require(_0x4768('0x6'));var jayson=require(_0x4768('0x7'));var client=jayson[_0x4768('0x8')][_0x4768('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4432da,_0x2b42bf,_0x9ba90c){return new BPromise(function(_0x3fc3b6,_0x5f25e0){return client[_0x4768('0xa')](_0x4432da,_0x9ba90c)[_0x4768('0xb')](function(_0x13689e){logger[_0x4768('0xc')](_0x4768('0xd'),_0x2b42bf,_0x4768('0xe'));logger[_0x4768('0xf')](_0x4768('0x10'),_0x2b42bf,_0x4768('0xe'),JSON['stringify'](_0x13689e));if(_0x13689e[_0x4768('0x11')]){if(_0x13689e[_0x4768('0x11')][_0x4768('0x12')]===0x1f4){logger[_0x4768('0x11')](_0x4768('0xd'),_0x2b42bf,_0x13689e[_0x4768('0x11')][_0x4768('0x13')]);return _0x5f25e0(_0x13689e[_0x4768('0x11')]['message']);}logger[_0x4768('0x11')](_0x4768('0xd'),_0x2b42bf,_0x13689e[_0x4768('0x11')][_0x4768('0x13')]);return _0x3fc3b6(_0x13689e[_0x4768('0x11')][_0x4768('0x13')]);}else{logger[_0x4768('0xc')](_0x4768('0xd'),_0x2b42bf,_0x4768('0xe'));_0x3fc3b6(_0x13689e['result']['message']);}})['catch'](function(_0x1b4b1b){logger[_0x4768('0x11')]('ReportAgentPreview,\x20%s,\x20%s',_0x2b42bf,_0x1b4b1b);_0x5f25e0(_0x1b4b1b);});});}exports['CreateReportAgentPreview']=function(_0x5a083e){var _0x101b7c=this;return new Promise(function(_0x5a98c9,_0x2f82db){return db[_0x4768('0x14')][_0x4768('0x15')](_0x5a083e[_0x4768('0x16')],{'raw':_0x5a083e[_0x4768('0x17')]?_0x5a083e[_0x4768('0x17')][_0x4768('0x18')]===undefined?!![]:![]:!![]})[_0x4768('0xb')](function(_0x8e3635){logger[_0x4768('0xc')]('CreateReportAgentPreview',_0x5a083e);logger['debug'](_0x4768('0x19'),_0x5a083e,JSON[_0x4768('0x1a')](_0x8e3635));_0x5a98c9(_0x8e3635);})['catch'](function(_0x5da0ee){logger[_0x4768('0x11')](_0x4768('0x19'),_0x5da0ee[_0x4768('0x13')],_0x5a083e);_0x2f82db(_0x101b7c['error'](0x1f4,_0x5da0ee['message']));});});}; \ No newline at end of file diff --git a/server/api/rpc/index.js b/server/api/rpc/index.js index 8f4c3c0..563b2d0 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 _0xec2a=['/voice/queues/channels/:uniqueid','voiceQueuesChannelHangup','/voice/queues/channels/:uniqueid/redirect/:exten','voiceQueuesChannelRedirect','/voice/queues/:id','showVoiceQueues','/outbound','outbound','/outbound/channels','outboundChannels','/agents','agents','/agents/:id/capacity','agentCapacity','/telephones','/trunks','trunks','/chat/queues/waitinginteractions','chatQueuesWaitingInteractions','/mail/queues/waitinginteractions','mailQueuesWaitingInteractions','/openchannel/queues/waitinginteractions','openchannelQueuesWaitingInteractions','/sms/queues/waitinginteractions','/whatsapp/queues/waitinginteractions','whatsappQueuesWaitingInteractions','/fax/queues/waitinginteractions','faxQueuesWaitingInteractions','post','/mail/queues/:id/notify','queueNotify','mail','/mail/queues/:id','chat','/chat/queues/:id','fax','/fax/queues/:id','showFaxQueues','/openchannel/queues/:id','/sms/queues/:id/notify','sms','/whatsapp/queues/:id/notify','/sms/queues/:id','showSmsQueues','/whatsapp/queues/:id','agentNotify','exports','util','express','../../components/auth/service','./rpc.controller','get','/voice/channels','isAuthenticated','voiceChannels','/voice/channels/:uniqueid/mixmonitor','/voice/channels/:uniqueid/stopmixmonitor','/voice/queues','/chat/queues','/mail/queues','mailQueues','/mail/accounts','mailAccounts','/openchannel/queues','openchannelQueues','/sms/queues','smsQueues','/whatsapp/queues','whatsappQueues','/fax/queues','faxQueues','/voice/queues/preview/:id','voiceQueuesPreview','/voice/queues/channels','voiceQueuesChannels'];(function(_0x126558,_0x143c9a){var _0x1f6d14=function(_0x2b0eea){while(--_0x2b0eea){_0x126558['push'](_0x126558['shift']());}};_0x1f6d14(++_0x143c9a);}(_0xec2a,0x110));var _0xaec2=function(_0x5c9274,_0x4e849b){_0x5c9274=_0x5c9274-0x0;var _0x1ef7d3=_0xec2a[_0x5c9274];return _0x1ef7d3;};'use strict';var multer=require('multer');var util=require(_0xaec2('0x0'));var path=require('path');var express=require(_0xaec2('0x1'));var router=express['Router']();var auth=require(_0xaec2('0x2'));var controller=require(_0xaec2('0x3'));router[_0xaec2('0x4')](_0xaec2('0x5'),auth[_0xaec2('0x6')](),controller[_0xaec2('0x7')]);router[_0xaec2('0x4')](_0xaec2('0x8'),auth['isAuthenticated'](),controller['voiceChannelMixMonitor']);router[_0xaec2('0x4')](_0xaec2('0x9'),auth[_0xaec2('0x6')](),controller['voiceChannelStopMixMonitor']);router[_0xaec2('0x4')](_0xaec2('0xa'),auth[_0xaec2('0x6')](),controller['voiceQueues']);router[_0xaec2('0x4')](_0xaec2('0xb'),auth[_0xaec2('0x6')](),controller['chatQueues']);router[_0xaec2('0x4')](_0xaec2('0xc'),auth[_0xaec2('0x6')](),controller[_0xaec2('0xd')]);router[_0xaec2('0x4')](_0xaec2('0xe'),auth['isAuthenticated'](),controller[_0xaec2('0xf')]);router[_0xaec2('0x4')](_0xaec2('0x10'),auth[_0xaec2('0x6')](),controller[_0xaec2('0x11')]);router[_0xaec2('0x4')](_0xaec2('0x12'),auth[_0xaec2('0x6')](),controller[_0xaec2('0x13')]);router[_0xaec2('0x4')](_0xaec2('0x14'),auth[_0xaec2('0x6')](),controller[_0xaec2('0x15')]);router[_0xaec2('0x4')](_0xaec2('0x16'),auth[_0xaec2('0x6')](),controller[_0xaec2('0x17')]);router[_0xaec2('0x4')](_0xaec2('0x18'),auth[_0xaec2('0x6')](),controller[_0xaec2('0x19')]);router[_0xaec2('0x4')](_0xaec2('0x1a'),auth[_0xaec2('0x6')](),controller[_0xaec2('0x1b')]);router[_0xaec2('0x4')](_0xaec2('0x1c'),auth[_0xaec2('0x6')](),controller['voiceQueuesChannel']);router[_0xaec2('0x4')]('/voice/queues/channels/:uniqueid/hangup',auth[_0xaec2('0x6')](),controller[_0xaec2('0x1d')]);router[_0xaec2('0x4')](_0xaec2('0x1e'),auth[_0xaec2('0x6')](),controller[_0xaec2('0x1f')]);router['get'](_0xaec2('0x20'),auth[_0xaec2('0x6')](),controller[_0xaec2('0x21')]);router[_0xaec2('0x4')](_0xaec2('0x22'),auth[_0xaec2('0x6')](),controller[_0xaec2('0x23')]);router['get'](_0xaec2('0x24'),auth[_0xaec2('0x6')](),controller[_0xaec2('0x25')]);router[_0xaec2('0x4')](_0xaec2('0x26'),auth['isAuthenticated'](),controller[_0xaec2('0x27')]);router['put'](_0xaec2('0x28'),auth['isAuthenticated'](),controller[_0xaec2('0x29')]);router[_0xaec2('0x4')](_0xaec2('0x2a'),auth['isAuthenticated'](),controller['telephones']);router[_0xaec2('0x4')](_0xaec2('0x2b'),auth[_0xaec2('0x6')](),controller[_0xaec2('0x2c')]);router[_0xaec2('0x4')]('/campaigns',auth[_0xaec2('0x6')](),controller['campaigns']);router['get']('/fax/accounts',auth[_0xaec2('0x6')](),controller['faxAccounts']);router[_0xaec2('0x4')](_0xaec2('0x2d'),auth[_0xaec2('0x6')](),controller[_0xaec2('0x2e')]);router[_0xaec2('0x4')](_0xaec2('0x2f'),auth[_0xaec2('0x6')](),controller[_0xaec2('0x30')]);router[_0xaec2('0x4')](_0xaec2('0x31'),auth[_0xaec2('0x6')](),controller[_0xaec2('0x32')]);router['get'](_0xaec2('0x33'),auth[_0xaec2('0x6')](),controller['smsQueuesWaitingInteractions']);router[_0xaec2('0x4')](_0xaec2('0x34'),auth[_0xaec2('0x6')](),controller[_0xaec2('0x35')]);router['get'](_0xaec2('0x36'),auth[_0xaec2('0x6')](),controller[_0xaec2('0x37')]);router[_0xaec2('0x38')](_0xaec2('0x39'),auth[_0xaec2('0x6')](),controller[_0xaec2('0x3a')](_0xaec2('0x3b')));router[_0xaec2('0x4')](_0xaec2('0x3c'),auth[_0xaec2('0x6')](),controller['showMailQueues']);router[_0xaec2('0x38')]('/chat/queues/:id/notify',auth['isAuthenticated'](),controller['queueNotify'](_0xaec2('0x3d')));router[_0xaec2('0x4')](_0xaec2('0x3e'),auth[_0xaec2('0x6')](),controller['showChatQueues']);router['post']('/fax/queues/:id/notify',auth[_0xaec2('0x6')](),controller[_0xaec2('0x3a')](_0xaec2('0x3f')));router[_0xaec2('0x4')](_0xaec2('0x40'),auth['isAuthenticated'](),controller[_0xaec2('0x41')]);router[_0xaec2('0x38')]('/openchannel/queues/:id/notify',auth[_0xaec2('0x6')](),controller['queueNotify']('openchannel'));router[_0xaec2('0x4')](_0xaec2('0x42'),auth['isAuthenticated'](),controller['showOpenchannelQueues']);router['post'](_0xaec2('0x43'),auth[_0xaec2('0x6')](),controller[_0xaec2('0x3a')](_0xaec2('0x44')));router[_0xaec2('0x38')](_0xaec2('0x45'),auth[_0xaec2('0x6')](),controller['queueNotify']('whatsapp'));router[_0xaec2('0x4')](_0xaec2('0x46'),auth['isAuthenticated'](),controller[_0xaec2('0x47')]);router[_0xaec2('0x4')](_0xaec2('0x48'),auth[_0xaec2('0x6')](),controller['showWhatsappQueues']);router['post']('/agents/:id/notify',auth[_0xaec2('0x6')](),controller[_0xaec2('0x49')]);module[_0xaec2('0x4a')]=router; \ No newline at end of file +var _0xcf8c=['faxQueuesWaitingInteractions','post','/mail/queues/:id/notify','queueNotify','mail','/mail/queues/:id','/chat/queues/:id/notify','chat','showChatQueues','/fax/queues/:id/notify','fax','/fax/queues/:id','showFaxQueues','/openchannel/queues/:id/notify','openchannel','/openchannel/queues/:id','showOpenchannelQueues','/sms/queues/:id/notify','sms','/whatsapp/queues/:id/notify','/sms/queues/:id','/whatsapp/queues/:id','showWhatsappQueues','/agents/:id/notify','agentNotify','exports','multer','util','path','../../components/auth/service','./rpc.controller','get','/voice/channels','isAuthenticated','voiceChannels','/voice/channels/:uniqueid/mixmonitor','voiceChannelMixMonitor','voiceChannelStopMixMonitor','voiceQueues','/chat/queues','chatQueues','/mail/queues','/mail/accounts','mailAccounts','/sms/queues','/whatsapp/queues','faxQueues','/voice/queues/preview/:id','/voice/queues/channels','/voice/queues/channels/:uniqueid','voiceQueuesChannel','/voice/queues/channels/:uniqueid/hangup','voiceQueuesChannelHangup','/voice/queues/channels/:uniqueid/redirect/:exten','voiceQueuesChannelRedirect','showVoiceQueues','/outbound','outbound','/outbound/channels','outboundChannels','/agents','agents','put','/agents/:id/capacity','agentCapacity','/telephones','telephones','/trunks','trunks','campaigns','/fax/accounts','faxAccounts','/chat/queues/waitinginteractions','chatQueuesWaitingInteractions','mailQueuesWaitingInteractions','/openchannel/queues/waitinginteractions','openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','/whatsapp/queues/waitinginteractions','whatsappQueuesWaitingInteractions','/fax/queues/waitinginteractions'];(function(_0x22b8a3,_0x2a79a7){var _0x199a0c=function(_0x544c66){while(--_0x544c66){_0x22b8a3['push'](_0x22b8a3['shift']());}};_0x199a0c(++_0x2a79a7);}(_0xcf8c,0x15e));var _0xccf8=function(_0x239e86,_0xb1d22){_0x239e86=_0x239e86-0x0;var _0x47a428=_0xcf8c[_0x239e86];return _0x47a428;};'use strict';var multer=require(_0xccf8('0x0'));var util=require(_0xccf8('0x1'));var path=require(_0xccf8('0x2'));var express=require('express');var router=express['Router']();var auth=require(_0xccf8('0x3'));var controller=require(_0xccf8('0x4'));router[_0xccf8('0x5')](_0xccf8('0x6'),auth[_0xccf8('0x7')](),controller[_0xccf8('0x8')]);router[_0xccf8('0x5')](_0xccf8('0x9'),auth[_0xccf8('0x7')](),controller[_0xccf8('0xa')]);router['get']('/voice/channels/:uniqueid/stopmixmonitor',auth[_0xccf8('0x7')](),controller[_0xccf8('0xb')]);router['get']('/voice/queues',auth[_0xccf8('0x7')](),controller[_0xccf8('0xc')]);router[_0xccf8('0x5')](_0xccf8('0xd'),auth[_0xccf8('0x7')](),controller[_0xccf8('0xe')]);router[_0xccf8('0x5')](_0xccf8('0xf'),auth[_0xccf8('0x7')](),controller['mailQueues']);router[_0xccf8('0x5')](_0xccf8('0x10'),auth[_0xccf8('0x7')](),controller[_0xccf8('0x11')]);router[_0xccf8('0x5')]('/openchannel/queues',auth[_0xccf8('0x7')](),controller['openchannelQueues']);router[_0xccf8('0x5')](_0xccf8('0x12'),auth[_0xccf8('0x7')](),controller['smsQueues']);router['get'](_0xccf8('0x13'),auth['isAuthenticated'](),controller['whatsappQueues']);router['get']('/fax/queues',auth['isAuthenticated'](),controller[_0xccf8('0x14')]);router[_0xccf8('0x5')](_0xccf8('0x15'),auth[_0xccf8('0x7')](),controller['voiceQueuesPreview']);router[_0xccf8('0x5')](_0xccf8('0x16'),auth[_0xccf8('0x7')](),controller['voiceQueuesChannels']);router[_0xccf8('0x5')](_0xccf8('0x17'),auth['isAuthenticated'](),controller[_0xccf8('0x18')]);router[_0xccf8('0x5')](_0xccf8('0x19'),auth[_0xccf8('0x7')](),controller[_0xccf8('0x1a')]);router[_0xccf8('0x5')](_0xccf8('0x1b'),auth[_0xccf8('0x7')](),controller[_0xccf8('0x1c')]);router[_0xccf8('0x5')]('/voice/queues/:id',auth[_0xccf8('0x7')](),controller[_0xccf8('0x1d')]);router[_0xccf8('0x5')](_0xccf8('0x1e'),auth[_0xccf8('0x7')](),controller[_0xccf8('0x1f')]);router[_0xccf8('0x5')](_0xccf8('0x20'),auth['isAuthenticated'](),controller[_0xccf8('0x21')]);router[_0xccf8('0x5')](_0xccf8('0x22'),auth[_0xccf8('0x7')](),controller[_0xccf8('0x23')]);router[_0xccf8('0x24')](_0xccf8('0x25'),auth[_0xccf8('0x7')](),controller[_0xccf8('0x26')]);router[_0xccf8('0x5')](_0xccf8('0x27'),auth['isAuthenticated'](),controller[_0xccf8('0x28')]);router[_0xccf8('0x5')](_0xccf8('0x29'),auth[_0xccf8('0x7')](),controller[_0xccf8('0x2a')]);router[_0xccf8('0x5')]('/campaigns',auth[_0xccf8('0x7')](),controller[_0xccf8('0x2b')]);router['get'](_0xccf8('0x2c'),auth[_0xccf8('0x7')](),controller[_0xccf8('0x2d')]);router[_0xccf8('0x5')](_0xccf8('0x2e'),auth[_0xccf8('0x7')](),controller[_0xccf8('0x2f')]);router[_0xccf8('0x5')]('/mail/queues/waitinginteractions',auth[_0xccf8('0x7')](),controller[_0xccf8('0x30')]);router[_0xccf8('0x5')](_0xccf8('0x31'),auth[_0xccf8('0x7')](),controller[_0xccf8('0x32')]);router[_0xccf8('0x5')]('/sms/queues/waitinginteractions',auth['isAuthenticated'](),controller[_0xccf8('0x33')]);router[_0xccf8('0x5')](_0xccf8('0x34'),auth[_0xccf8('0x7')](),controller[_0xccf8('0x35')]);router['get'](_0xccf8('0x36'),auth[_0xccf8('0x7')](),controller[_0xccf8('0x37')]);router[_0xccf8('0x38')](_0xccf8('0x39'),auth[_0xccf8('0x7')](),controller[_0xccf8('0x3a')](_0xccf8('0x3b')));router[_0xccf8('0x5')](_0xccf8('0x3c'),auth[_0xccf8('0x7')](),controller['showMailQueues']);router[_0xccf8('0x38')](_0xccf8('0x3d'),auth[_0xccf8('0x7')](),controller['queueNotify'](_0xccf8('0x3e')));router[_0xccf8('0x5')]('/chat/queues/:id',auth[_0xccf8('0x7')](),controller[_0xccf8('0x3f')]);router[_0xccf8('0x38')](_0xccf8('0x40'),auth[_0xccf8('0x7')](),controller[_0xccf8('0x3a')](_0xccf8('0x41')));router[_0xccf8('0x5')](_0xccf8('0x42'),auth['isAuthenticated'](),controller[_0xccf8('0x43')]);router['post'](_0xccf8('0x44'),auth[_0xccf8('0x7')](),controller[_0xccf8('0x3a')](_0xccf8('0x45')));router['get'](_0xccf8('0x46'),auth[_0xccf8('0x7')](),controller[_0xccf8('0x47')]);router[_0xccf8('0x38')](_0xccf8('0x48'),auth[_0xccf8('0x7')](),controller[_0xccf8('0x3a')](_0xccf8('0x49')));router[_0xccf8('0x38')](_0xccf8('0x4a'),auth[_0xccf8('0x7')](),controller[_0xccf8('0x3a')]('whatsapp'));router[_0xccf8('0x5')](_0xccf8('0x4b'),auth['isAuthenticated'](),controller['showSmsQueues']);router[_0xccf8('0x5')](_0xccf8('0x4c'),auth['isAuthenticated'](),controller[_0xccf8('0x4d')]);router[_0xccf8('0x38')](_0xccf8('0x4e'),auth[_0xccf8('0x7')](),controller[_0xccf8('0x4f')]);module[_0xccf8('0x50')]=router; \ No newline at end of file diff --git a/server/api/rpc/rpc.controller.js b/server/api/rpc/rpc.controller.js index 4f5f9f6..0336e44 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 _0xf9e2=['showChatQueues','mailQueues','MailQueues','showMailQueues','MailAccounts','openchannelQueues','OpenchannelQueues','showOpenchannelQueues','smsQueues','SmsQueues','showSmsQueues','whatsappQueues','WhatsappQueues','showWhatsappQueues','faxQueues','FaxQueues','showFaxQueues','chatQueuesWaitingInteractions','ChatQueuesWaitingInteractions','mailQueuesWaitingInteractions','MailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','SmsQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','WhatsappQueuesWaitingInteractions','faxQueuesWaitingInteractions','queueNotify','chat','Account','Queue','findOne','Message','messageId','Interaction','\x20Message\x20not\x20found','update','From','QueueId','TransferReport','create','queue','queueTransferTimeout','channel','capitalize','User','agent','MessageId','InteractionId','Start','agentTransferTimeout','*,*,*,*','bluebird','moment','lodash','util','../../mysqldb','../../config/logger','api','jayson/promise','http','client','request','code','error','message','catch','status','sendStatus','stack','name','send','rows','find','voiceChannels','VoiceChannels','query','then','voiceChannelMixMonitor','VoiceChannelMixMonitor','merge','params','VoiceChannelStopMixMonitor','VoiceQueues','voiceQueuesPreview','VoiceQueuesPreview','voiceQueuesChannels','voiceQueuesChannelHangup','VoiceQueuesChannelHangup','voiceQueuesChannelRedirect','VoiceQueuesChannelRedirect','outbound','Outbound','outboundChannels','OutboundChannels','agents','Agents','agentCapacity','body','interaction','user','hasOwnProperty','MemberReport','findAll','INTERACTION','format','YYYY-MM-DD\x20HH:mm:ss','length','updateAttributes','findOrCreate','isNil','interface','SIP/%s','internal','AgentCapacity','capacity','telephones','Trunks','Campaigns','chatQueues','ChatQueues'];(function(_0x5f2dbe,_0x26437a){var _0x43352e=function(_0x54e888){while(--_0x54e888){_0x5f2dbe['push'](_0x5f2dbe['shift']());}};_0x43352e(++_0x26437a);}(_0xf9e2,0x126));var _0x2f9e=function(_0x2d96ab,_0x334ed7){_0x2d96ab=_0x2d96ab-0x0;var _0x3db2ab=_0xf9e2[_0x2d96ab];return _0x3db2ab;};'use strict';var BPromise=require(_0x2f9e('0x0'));var moment=require(_0x2f9e('0x1'));var _=require(_0x2f9e('0x2'));var util=require(_0x2f9e('0x3'));var db=require(_0x2f9e('0x4'))['db'];var logger=require(_0x2f9e('0x5'))(_0x2f9e('0x6'));var jayson=require(_0x2f9e('0x7'));var amiClient=jayson['client'][_0x2f9e('0x8')]({'port':0x232a});var mailClient=jayson['client'][_0x2f9e('0x8')]({'port':0x232b});var routingClient=jayson[_0x2f9e('0x9')]['http']({'port':0x232c});function respondWithRpcPromise(_0x55a8ba,_0x1d95c5,_0x8292c7){return new BPromise(function(_0x51228d,_0x1afa7d){var _0x56dcc9=_0x8292c7?_0x8292c7:amiClient;return _0x56dcc9[_0x2f9e('0xa')](_0x55a8ba,_0x1d95c5)['then'](function(_0x10b2bd){if(_0x10b2bd['error']){if(_0x10b2bd['error'][_0x2f9e('0xb')]===0x1f4){return _0x1afa7d(_0x10b2bd[_0x2f9e('0xc')][_0x2f9e('0xd')]);}return _0x51228d(_0x10b2bd['error']['message']);}else{_0x51228d(_0x10b2bd['result']);}})[_0x2f9e('0xe')](function(_0x439d24){_0x1afa7d(_0x439d24);});});}function respondWithResult(_0x4e7258,_0x24a3de){_0x24a3de=_0x24a3de||0xc8;return function(_0x431b9b){if(_0x431b9b){return _0x4e7258[_0x2f9e('0xf')](_0x24a3de)['json'](_0x431b9b);}return _0x4e7258[_0x2f9e('0x10')](0x194);};}function handleError(_0x22ea75,_0x367e95){_0x367e95=_0x367e95||0x1f4;return function(_0x24f4e6){logger[_0x2f9e('0xc')](_0x24f4e6[_0x2f9e('0x11')]);if(_0x24f4e6[_0x2f9e('0x12')]){delete _0x24f4e6['name'];}_0x22ea75[_0x2f9e('0xf')](_0x367e95)[_0x2f9e('0x13')](_0x24f4e6);};}function findById(_0x1ccaf3){return function(_0x477e00){if(!_['isNil'](_0x1ccaf3)&&!_['isNil'](_0x477e00)&&!_['isNil'](_0x477e00[_0x2f9e('0x14')])){return _[_0x2f9e('0x15')](_0x477e00[_0x2f9e('0x14')],function(_0xe58fc){return _0xe58fc['id']==_0x1ccaf3;});}return null;};}exports[_0x2f9e('0x16')]=function(_0x4c121a,_0x3e919e){return respondWithRpcPromise(_0x2f9e('0x17'),_0x4c121a[_0x2f9e('0x18')])[_0x2f9e('0x19')](respondWithResult(_0x3e919e,null))[_0x2f9e('0xe')](handleError(_0x3e919e,null));};exports[_0x2f9e('0x1a')]=function(_0x48268b,_0x3e8a05){return respondWithRpcPromise(_0x2f9e('0x1b'),_[_0x2f9e('0x1c')](_0x48268b[_0x2f9e('0x18')],_0x48268b[_0x2f9e('0x1d')]))[_0x2f9e('0x19')](respondWithResult(_0x3e8a05,null))['catch'](handleError(_0x3e8a05,null));};exports['voiceChannelStopMixMonitor']=function(_0x5a5b2a,_0x5c77f2){return respondWithRpcPromise(_0x2f9e('0x1e'),_[_0x2f9e('0x1c')](_0x5a5b2a['query'],_0x5a5b2a[_0x2f9e('0x1d')]))[_0x2f9e('0x19')](respondWithResult(_0x5c77f2,null))['catch'](handleError(_0x5c77f2,null));};exports['voiceQueues']=function(_0x2d17a5,_0x5cc8bc){return respondWithRpcPromise(_0x2f9e('0x1f'),_0x2d17a5[_0x2f9e('0x18')])[_0x2f9e('0x19')](respondWithResult(_0x5cc8bc,null))[_0x2f9e('0xe')](handleError(_0x5cc8bc,null));};exports['showVoiceQueues']=function(_0x5808c4,_0xd823a){return respondWithRpcPromise(_0x2f9e('0x1f'),_0x5808c4[_0x2f9e('0x18')])['then'](findById(_0x5808c4[_0x2f9e('0x1d')]['id']))['then'](respondWithResult(_0xd823a,null))[_0x2f9e('0xe')](handleError(_0xd823a,null));};exports[_0x2f9e('0x20')]=function(_0x5091dd,_0x550e55){return respondWithRpcPromise(_0x2f9e('0x21'),_['merge'](_0x5091dd['query'],_0x5091dd[_0x2f9e('0x1d')]))[_0x2f9e('0x19')](respondWithResult(_0x550e55,null))[_0x2f9e('0xe')](handleError(_0x550e55,null));};exports[_0x2f9e('0x22')]=function(_0x59e774,_0x16d710){return respondWithRpcPromise('VoiceQueuesChannels',_0x59e774[_0x2f9e('0x18')])[_0x2f9e('0x19')](respondWithResult(_0x16d710,null))[_0x2f9e('0xe')](handleError(_0x16d710,null));};exports['voiceQueuesChannel']=function(_0x41b45a,_0x485e6b){return respondWithRpcPromise('VoiceQueuesChannel',_[_0x2f9e('0x1c')](_0x41b45a[_0x2f9e('0x18')],_0x41b45a[_0x2f9e('0x1d')]))[_0x2f9e('0x19')](respondWithResult(_0x485e6b,null))[_0x2f9e('0xe')](handleError(_0x485e6b,null));};exports[_0x2f9e('0x23')]=function(_0x2ef1b1,_0x505acd){return respondWithRpcPromise(_0x2f9e('0x24'),_[_0x2f9e('0x1c')](_0x2ef1b1[_0x2f9e('0x18')],_0x2ef1b1[_0x2f9e('0x1d')]))[_0x2f9e('0x19')](respondWithResult(_0x505acd,null))['catch'](handleError(_0x505acd,null));};exports[_0x2f9e('0x25')]=function(_0x2ff020,_0x26160e){return respondWithRpcPromise(_0x2f9e('0x26'),_[_0x2f9e('0x1c')](_0x2ff020[_0x2f9e('0x18')],_0x2ff020[_0x2f9e('0x1d')]))[_0x2f9e('0x19')](respondWithResult(_0x26160e,null))[_0x2f9e('0xe')](handleError(_0x26160e,null));};exports[_0x2f9e('0x27')]=function(_0x4338df,_0x14dfac){return respondWithRpcPromise(_0x2f9e('0x28'),_0x4338df[_0x2f9e('0x18')])[_0x2f9e('0x19')](respondWithResult(_0x14dfac,null))[_0x2f9e('0xe')](handleError(_0x14dfac,null));};exports[_0x2f9e('0x29')]=function(_0x27687e,_0x1dce1a){return respondWithRpcPromise(_0x2f9e('0x2a'),_0x27687e[_0x2f9e('0x18')])[_0x2f9e('0x19')](respondWithResult(_0x1dce1a,null))[_0x2f9e('0xe')](handleError(_0x1dce1a,null));};exports[_0x2f9e('0x2b')]=function(_0x2d353e,_0x55bedb){var _0x433b63;return respondWithRpcPromise(_0x2f9e('0x2c'),_0x2d353e['query'])[_0x2f9e('0x19')](function(_0x3c477b){_0x433b63=_0x3c477b;return respondWithRpcPromise(_0x2f9e('0x2c'),_0x2d353e[_0x2f9e('0x18')],routingClient);})[_0x2f9e('0x19')](function(_0x271223){return _['merge']({},_0x271223,_0x433b63);})['then'](respondWithResult(_0x55bedb,null))['catch'](handleError(_0x55bedb,null));};exports[_0x2f9e('0x2d')]=function(_0x36d74b,_0xfdd3ec){if(_0x36d74b['body']&&_0x36d74b[_0x2f9e('0x2e')][_0x2f9e('0x2f')]&&_0x36d74b[_0x2f9e('0x30')]&&_0x36d74b[_0x2f9e('0x30')][_0x2f9e('0x12')]){for(var _0x478a3d in _0x36d74b[_0x2f9e('0x2e')][_0x2f9e('0x2f')]){if(_0x36d74b[_0x2f9e('0x2e')]['interaction'][_0x2f9e('0x31')](_0x478a3d)){db[_0x2f9e('0x32')][_0x2f9e('0x33')]({'where':{'channel':_0x478a3d,'membername':_0x36d74b['user'][_0x2f9e('0x12')],'type':_0x2f9e('0x34'),'exitAt':null,'uniqueid':_0x36d74b['body'][_0x2f9e('0x2f')][_0x478a3d]&&_0x36d74b[_0x2f9e('0x2e')][_0x2f9e('0x2f')][_0x478a3d]['length']?{'$notIn':_0x36d74b['body'][_0x2f9e('0x2f')][_0x478a3d]}:{'$ne':null}}})['then'](function(_0x424f8f){var _0x30d9fe=moment()[_0x2f9e('0x35')](_0x2f9e('0x36'));for(var _0x5bf584=0x0,_0x9b8c3d=_0x424f8f[_0x2f9e('0x37')];_0x5bf584<_0x9b8c3d;_0x5bf584+=0x1){_0x424f8f[_0x5bf584][_0x2f9e('0x38')]({'exitAt':_0x30d9fe});}});for(var _0x22d0a1=0x0;_0x22d0a1<_0x36d74b[_0x2f9e('0x2e')][_0x2f9e('0x2f')][_0x478a3d]['length'];_0x22d0a1+=0x1){db[_0x2f9e('0x32')][_0x2f9e('0x39')]({'where':{'channel':_0x478a3d,'membername':_0x36d74b[_0x2f9e('0x30')]['name'],'type':_0x2f9e('0x34'),'uniqueid':_0x36d74b['body'][_0x2f9e('0x2f')][_0x478a3d][_0x22d0a1],'exitAt':null},'defaults':{'channel':_0x478a3d,'membername':_0x36d74b[_0x2f9e('0x30')][_0x2f9e('0x12')],'interface':_[_0x2f9e('0x3a')](_0x36d74b[_0x2f9e('0x30')][_0x2f9e('0x3b')])?util['format'](_0x2f9e('0x3c'),_0x36d74b['user'][_0x2f9e('0x12')]):_0x36d74b[_0x2f9e('0x30')][_0x2f9e('0x3b')],'type':_0x2f9e('0x34'),'enterAt':moment()[_0x2f9e('0x35')](_0x2f9e('0x36')),'role':'agent','internal':_0x36d74b['user'][_0x2f9e('0x3d')],'uniqueid':_0x36d74b[_0x2f9e('0x2e')][_0x2f9e('0x2f')][_0x478a3d][_0x22d0a1]}});}}}}return respondWithRpcPromise(_0x2f9e('0x3e'),{'id':_0x36d74b[_0x2f9e('0x1d')]['id'],'capacity':_0x36d74b[_0x2f9e('0x2e')][_0x2f9e('0x3f')]},routingClient)['then'](respondWithResult(_0xfdd3ec,null))['catch'](handleError(_0xfdd3ec,null));};exports[_0x2f9e('0x40')]=function(_0x2c24ee,_0x2d04fc){return respondWithRpcPromise('Telephones',_0x2c24ee[_0x2f9e('0x18')])[_0x2f9e('0x19')](respondWithResult(_0x2d04fc,null))[_0x2f9e('0xe')](handleError(_0x2d04fc,null));};exports['trunks']=function(_0x2bac31,_0x1c93a0){return respondWithRpcPromise(_0x2f9e('0x41'),_0x2bac31[_0x2f9e('0x18')])[_0x2f9e('0x19')](respondWithResult(_0x1c93a0,null))[_0x2f9e('0xe')](handleError(_0x1c93a0,null));};exports['campaigns']=function(_0x15cb33,_0x293501){return respondWithRpcPromise(_0x2f9e('0x42'),_0x15cb33[_0x2f9e('0x18')])['then'](respondWithResult(_0x293501,null))[_0x2f9e('0xe')](handleError(_0x293501,null));};exports[_0x2f9e('0x43')]=function(_0x36916f,_0xaffaaa){return respondWithRpcPromise(_0x2f9e('0x44'),_0x36916f['query'],routingClient)['then'](respondWithResult(_0xaffaaa,null))[_0x2f9e('0xe')](handleError(_0xaffaaa,null));};exports[_0x2f9e('0x45')]=function(_0x47859b,_0xda56a4){return respondWithRpcPromise(_0x2f9e('0x44'),_0x47859b[_0x2f9e('0x18')],routingClient)['then'](findById(_0x47859b[_0x2f9e('0x1d')]['id']))['then'](respondWithResult(_0xda56a4,null))['catch'](handleError(_0xda56a4,null));};exports[_0x2f9e('0x46')]=function(_0x2e192f,_0x3ca190){return respondWithRpcPromise(_0x2f9e('0x47'),_0x2e192f[_0x2f9e('0x18')],routingClient)[_0x2f9e('0x19')](respondWithResult(_0x3ca190,null))[_0x2f9e('0xe')](handleError(_0x3ca190,null));};exports[_0x2f9e('0x48')]=function(_0x36c504,_0x4b26cd){return respondWithRpcPromise(_0x2f9e('0x47'),_0x36c504['query'],routingClient)[_0x2f9e('0x19')](findById(_0x36c504[_0x2f9e('0x1d')]['id']))['then'](respondWithResult(_0x4b26cd,null))[_0x2f9e('0xe')](handleError(_0x4b26cd,null));};exports['mailAccounts']=function(_0x123de2,_0x2b4afe){return respondWithRpcPromise(_0x2f9e('0x49'),_0x123de2[_0x2f9e('0x18')],mailClient)[_0x2f9e('0x19')](respondWithResult(_0x2b4afe,null))[_0x2f9e('0xe')](handleError(_0x2b4afe,null));};exports[_0x2f9e('0x4a')]=function(_0x1ed1e8,_0x305cf1){return respondWithRpcPromise(_0x2f9e('0x4b'),_0x1ed1e8[_0x2f9e('0x18')],routingClient)[_0x2f9e('0x19')](respondWithResult(_0x305cf1,null))[_0x2f9e('0xe')](handleError(_0x305cf1,null));};exports[_0x2f9e('0x4c')]=function(_0x5d50cb,_0x17f656){return respondWithRpcPromise(_0x2f9e('0x4b'),_0x5d50cb['query'],routingClient)[_0x2f9e('0x19')](findById(_0x5d50cb['params']['id']))['then'](respondWithResult(_0x17f656,null))[_0x2f9e('0xe')](handleError(_0x17f656,null));};exports[_0x2f9e('0x4d')]=function(_0x476c59,_0x5a5705){return respondWithRpcPromise(_0x2f9e('0x4e'),_0x476c59[_0x2f9e('0x18')],routingClient)[_0x2f9e('0x19')](respondWithResult(_0x5a5705,null))['catch'](handleError(_0x5a5705,null));};exports[_0x2f9e('0x4f')]=function(_0x53fe6f,_0xf424e8){return respondWithRpcPromise(_0x2f9e('0x4e'),_0x53fe6f[_0x2f9e('0x18')],routingClient)[_0x2f9e('0x19')](findById(_0x53fe6f[_0x2f9e('0x1d')]['id']))[_0x2f9e('0x19')](respondWithResult(_0xf424e8,null))['catch'](handleError(_0xf424e8,null));};exports[_0x2f9e('0x50')]=function(_0x3bd339,_0x556705){return respondWithRpcPromise(_0x2f9e('0x51'),_0x3bd339['query'],routingClient)['then'](respondWithResult(_0x556705,null))[_0x2f9e('0xe')](handleError(_0x556705,null));};exports[_0x2f9e('0x52')]=function(_0x4e7903,_0xc40d45){return respondWithRpcPromise(_0x2f9e('0x51'),_0x4e7903[_0x2f9e('0x18')],routingClient)[_0x2f9e('0x19')](findById(_0x4e7903[_0x2f9e('0x1d')]['id']))[_0x2f9e('0x19')](respondWithResult(_0xc40d45,null))[_0x2f9e('0xe')](handleError(_0xc40d45,null));};exports[_0x2f9e('0x53')]=function(_0x4c09d0,_0x34f062){return respondWithRpcPromise(_0x2f9e('0x54'),_0x4c09d0[_0x2f9e('0x18')],routingClient)['then'](respondWithResult(_0x34f062,null))['catch'](handleError(_0x34f062,null));};exports[_0x2f9e('0x55')]=function(_0x200dd5,_0x17594f){return respondWithRpcPromise(_0x2f9e('0x54'),_0x200dd5[_0x2f9e('0x18')],routingClient)[_0x2f9e('0x19')](findById(_0x200dd5[_0x2f9e('0x1d')]['id']))[_0x2f9e('0x19')](respondWithResult(_0x17594f,null))[_0x2f9e('0xe')](handleError(_0x17594f,null));};exports['faxAccounts']=function(_0x4e44cb,_0x5ce7d5){return respondWithRpcPromise('FaxAccounts',_0x4e44cb['query'])[_0x2f9e('0x19')](respondWithResult(_0x5ce7d5,null))['catch'](handleError(_0x5ce7d5,null));};exports[_0x2f9e('0x56')]=function(_0x2d251c,_0x4ab651){return respondWithRpcPromise(_0x2f9e('0x57'),_0x2d251c[_0x2f9e('0x18')],routingClient)[_0x2f9e('0x19')](respondWithResult(_0x4ab651,null))[_0x2f9e('0xe')](handleError(_0x4ab651,null));};exports[_0x2f9e('0x58')]=function(_0x4c8511,_0x28b538){return respondWithRpcPromise(_0x2f9e('0x59'),_0x4c8511[_0x2f9e('0x18')],routingClient)[_0x2f9e('0x19')](respondWithResult(_0x28b538,null))[_0x2f9e('0xe')](handleError(_0x28b538,null));};exports[_0x2f9e('0x5a')]=function(_0x32cb2c,_0xe17f80){return respondWithRpcPromise('OpenchannelQueuesWaitingInteractions',_0x32cb2c[_0x2f9e('0x18')],routingClient)[_0x2f9e('0x19')](respondWithResult(_0xe17f80,null))['catch'](handleError(_0xe17f80,null));};exports[_0x2f9e('0x5b')]=function(_0x32eb58,_0x557989){return respondWithRpcPromise(_0x2f9e('0x5c'),_0x32eb58[_0x2f9e('0x18')],routingClient)['then'](respondWithResult(_0x557989,null))[_0x2f9e('0xe')](handleError(_0x557989,null));};exports[_0x2f9e('0x5d')]=function(_0x1d4182,_0x4f5a2c){return respondWithRpcPromise(_0x2f9e('0x5e'),_0x1d4182['query'],routingClient)[_0x2f9e('0x19')](respondWithResult(_0x4f5a2c,null))[_0x2f9e('0xe')](handleError(_0x4f5a2c,null));};exports[_0x2f9e('0x5f')]=function(_0x2c5752,_0x44939e){return respondWithRpcPromise('FaxQueuesWaitingInteractions',_0x2c5752['query'],routingClient)[_0x2f9e('0x19')](respondWithResult(_0x44939e,null))[_0x2f9e('0xe')](handleError(_0x44939e,null));};exports[_0x2f9e('0x60')]=function(_0x330039){return function(_0x2b1b07,_0x1e0782){var _0x4b332b,_0x7ef1e7;var _0x57fd0=_['capitalize'](_0x330039);var _0x37f3bc=_0x330039===_0x2f9e('0x61')?'Website':_0x2f9e('0x62');return db[_0x57fd0+_0x2f9e('0x63')][_0x2f9e('0x64')]({'raw':!![],'where':{'id':_0x2b1b07[_0x2f9e('0x1d')]['id']}})[_0x2f9e('0x19')](function(_0x118b4a){if(_[_0x2f9e('0x3a')](_0x118b4a)){throw new Error(_0x57fd0+'\x20Queue\x20not\x20found');}_0x4b332b=_0x118b4a;return db[_0x57fd0+_0x2f9e('0x65')][_0x2f9e('0x64')]({'where':{'id':_0x2b1b07[_0x2f9e('0x2e')][_0x2f9e('0x66')]},'include':[{'model':db[_0x57fd0+_0x2f9e('0x67')],'as':_0x2f9e('0x67')},{'model':db[_0x57fd0+_0x37f3bc],'as':'Account'}]});})[_0x2f9e('0x19')](function(_0xfb072d){if(_['isNil'](_0xfb072d)){throw new Error(_0x57fd0+_0x2f9e('0x68'));}_0x7ef1e7=_0xfb072d;return _0xfb072d[_0x2f9e('0x69')]({'read':0x0,'readAt':null,'UserId':null});})['then'](function(){var _0x8d54d9={'uniqueid':_0x330039+'.'+_0x7ef1e7['id']+'.'+_0x7ef1e7[_0x2f9e('0x67')]['id'],'FromUserId':_0x2b1b07[_0x2f9e('0x30')]['id'],'type':'queue'};_0x8d54d9[_0x57fd0+'MessageId']=_0x7ef1e7['id'];_0x8d54d9[_0x57fd0+'InteractionId']=_0x7ef1e7[_0x2f9e('0x67')]['id'];_0x8d54d9[_0x2f9e('0x6a')+_0x57fd0+_0x37f3bc+'Id']=_0x7ef1e7[_0x2f9e('0x62')]['id'];_0x8d54d9['To'+_0x57fd0+_0x2f9e('0x6b')]=_0x4b332b['id'];return db[_0x57fd0+_0x2f9e('0x6c')][_0x2f9e('0x6d')](_0x8d54d9);})['then'](function(){return respondWithRpcPromise('Start',{'channel':_0x330039,'interaction':_0x7ef1e7[_0x2f9e('0x67')],'message':_0x7ef1e7,'account':_0x7ef1e7[_0x2f9e('0x62')],'applications':[{'id':0x0,'priority':0x1,'app':_0x2f9e('0x6e'),'appdata':_0x4b332b[_0x2f9e('0x12')]+','+(_0x7ef1e7['Account'][_0x2f9e('0x6f')]||0x12c),'interval':'*,*,*,*'}]},routingClient);})[_0x2f9e('0x19')](respondWithResult(_0x1e0782,null))[_0x2f9e('0xe')](handleError(_0x1e0782,null));};};exports['agentNotify']=function(_0x1dc394,_0x3afbe4){var _0x5c7446,_0x13d29d;if(_[_0x2f9e('0x3a')](_0x1dc394[_0x2f9e('0x2e')]['channel'])){throw new Error('Channel\x20field\x20is\x20mandatory');}var _0x49d18a=_0x1dc394[_0x2f9e('0x2e')][_0x2f9e('0x70')];var _0x16eaf8=_[_0x2f9e('0x71')](_0x49d18a);var _0x18aa19=_0x49d18a===_0x2f9e('0x61')?'Website':_0x2f9e('0x62');return db[_0x2f9e('0x72')][_0x2f9e('0x64')]({'raw':!![],'where':{'id':_0x1dc394['params']['id'],'role':_0x2f9e('0x73')}})['then'](function(_0x3c961c){if(_[_0x2f9e('0x3a')](_0x3c961c)){throw new Error('Agent\x20not\x20found');}_0x5c7446=_0x3c961c;return db[_0x16eaf8+_0x2f9e('0x65')][_0x2f9e('0x64')]({'where':{'id':_0x1dc394['body']['messageId']},'include':[{'model':db[_0x16eaf8+'Interaction'],'as':_0x2f9e('0x67')},{'model':db[_0x16eaf8+_0x18aa19],'as':_0x2f9e('0x62')}]});})[_0x2f9e('0x19')](function(_0x33fbb0){if(_[_0x2f9e('0x3a')](_0x33fbb0)){throw new Error(_0x16eaf8+_0x2f9e('0x68'));}_0x13d29d=_0x33fbb0;return _0x33fbb0[_0x2f9e('0x69')]({'read':0x0,'readAt':null,'UserId':null});})[_0x2f9e('0x19')](function(){var _0x3a9a72={'uniqueid':_0x49d18a+'.'+_0x13d29d['id']+'.'+_0x13d29d['Interaction']['id'],'FromUserId':_0x1dc394['user']['id'],'type':_0x2f9e('0x6e'),'ToUserId':_0x5c7446['id']};_0x3a9a72[_0x16eaf8+_0x2f9e('0x74')]=_0x13d29d['id'];_0x3a9a72[_0x16eaf8+_0x2f9e('0x75')]=_0x13d29d['Interaction']['id'];_0x3a9a72[_0x2f9e('0x6a')+_0x16eaf8+_0x18aa19+'Id']=_0x13d29d[_0x2f9e('0x62')]['id'];return db[_0x16eaf8+_0x2f9e('0x6c')][_0x2f9e('0x6d')](_0x3a9a72);})[_0x2f9e('0x19')](function(){return respondWithRpcPromise(_0x2f9e('0x76'),{'channel':_0x49d18a,'interaction':_0x13d29d[_0x2f9e('0x67')],'message':_0x13d29d,'account':_0x13d29d[_0x2f9e('0x62')],'applications':[{'id':0x0,'priority':0x1,'app':_0x2f9e('0x73'),'appdata':_0x5c7446[_0x2f9e('0x12')]+','+(_0x13d29d[_0x2f9e('0x62')][_0x2f9e('0x77')]||0x12c),'interval':_0x2f9e('0x78')}]},routingClient);})[_0x2f9e('0x19')](respondWithResult(_0x3afbe4,null))[_0x2f9e('0xe')](handleError(_0x3afbe4,null));}; \ No newline at end of file +var _0x8a01=['merge','query','voiceChannelStopMixMonitor','VoiceChannelStopMixMonitor','params','voiceQueues','VoiceQueues','showVoiceQueues','voiceQueuesPreview','voiceQueuesChannels','VoiceQueuesChannels','VoiceQueuesChannel','voiceQueuesChannelHangup','VoiceQueuesChannelHangup','voiceQueuesChannelRedirect','outbound','Outbound','OutboundChannels','agents','Agents','agentCapacity','body','interaction','user','hasOwnProperty','MemberReport','findAll','INTERACTION','length','format','findOrCreate','interface','SIP/%s','YYYY-MM-DD\x20HH:mm:ss','agent','trunks','campaigns','Campaigns','chatQueues','ChatQueues','showChatQueues','mailQueues','MailQueues','showMailQueues','mailAccounts','MailAccounts','OpenchannelQueues','smsQueues','showSmsQueues','SmsQueues','whatsappQueues','WhatsappQueues','showWhatsappQueues','FaxQueues','showFaxQueues','faxAccounts','chatQueuesWaitingInteractions','ChatQueuesWaitingInteractions','mailQueuesWaitingInteractions','MailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','OpenchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','WhatsappQueuesWaitingInteractions','faxQueuesWaitingInteractions','queueNotify','capitalize','Website','Account','\x20Queue\x20not\x20found','Message','findOne','messageId','Interaction','\x20Message\x20not\x20found','update','MessageId','InteractionId','From','QueueId','TransferReport','create','queue','queueTransferTimeout','Channel\x20field\x20is\x20mandatory','User','Agent\x20not\x20found','moment','lodash','util','../../mysqldb','../../config/logger','api','jayson/promise','client','http','request','then','error','message','result','status','json','sendStatus','stack','name','send','isNil','rows','find','voiceChannels','catch','VoiceChannelMixMonitor'];(function(_0x35d4e9,_0x298c61){var _0x5c2770=function(_0x2f326a){while(--_0x2f326a){_0x35d4e9['push'](_0x35d4e9['shift']());}};_0x5c2770(++_0x298c61);}(_0x8a01,0x13c));var _0x18a0=function(_0xac083e,_0x5e192f){_0xac083e=_0xac083e-0x0;var _0x1898a1=_0x8a01[_0xac083e];return _0x1898a1;};'use strict';var BPromise=require('bluebird');var moment=require(_0x18a0('0x0'));var _=require(_0x18a0('0x1'));var util=require(_0x18a0('0x2'));var db=require(_0x18a0('0x3'))['db'];var logger=require(_0x18a0('0x4'))(_0x18a0('0x5'));var jayson=require(_0x18a0('0x6'));var amiClient=jayson[_0x18a0('0x7')][_0x18a0('0x8')]({'port':0x232a});var mailClient=jayson[_0x18a0('0x7')][_0x18a0('0x8')]({'port':0x232b});var routingClient=jayson['client'][_0x18a0('0x8')]({'port':0x232c});function respondWithRpcPromise(_0x297f53,_0x11a8dc,_0x494331){return new BPromise(function(_0x14c039,_0x2c7596){var _0x42dcf6=_0x494331?_0x494331:amiClient;return _0x42dcf6[_0x18a0('0x9')](_0x297f53,_0x11a8dc)[_0x18a0('0xa')](function(_0x119ce0){if(_0x119ce0[_0x18a0('0xb')]){if(_0x119ce0['error']['code']===0x1f4){return _0x2c7596(_0x119ce0['error'][_0x18a0('0xc')]);}return _0x14c039(_0x119ce0['error']['message']);}else{_0x14c039(_0x119ce0[_0x18a0('0xd')]);}})['catch'](function(_0x1552cd){_0x2c7596(_0x1552cd);});});}function respondWithResult(_0x1ef43e,_0x594576){_0x594576=_0x594576||0xc8;return function(_0x4ec803){if(_0x4ec803){return _0x1ef43e[_0x18a0('0xe')](_0x594576)[_0x18a0('0xf')](_0x4ec803);}return _0x1ef43e[_0x18a0('0x10')](0x194);};}function handleError(_0x1d9690,_0x110407){_0x110407=_0x110407||0x1f4;return function(_0x29a397){logger[_0x18a0('0xb')](_0x29a397[_0x18a0('0x11')]);if(_0x29a397[_0x18a0('0x12')]){delete _0x29a397[_0x18a0('0x12')];}_0x1d9690[_0x18a0('0xe')](_0x110407)[_0x18a0('0x13')](_0x29a397);};}function findById(_0x2a6515){return function(_0x54b1dd){if(!_[_0x18a0('0x14')](_0x2a6515)&&!_[_0x18a0('0x14')](_0x54b1dd)&&!_[_0x18a0('0x14')](_0x54b1dd[_0x18a0('0x15')])){return _[_0x18a0('0x16')](_0x54b1dd['rows'],function(_0xc977a7){return _0xc977a7['id']==_0x2a6515;});}return null;};}exports[_0x18a0('0x17')]=function(_0x3dedb7,_0x34bbd0){return respondWithRpcPromise('VoiceChannels',_0x3dedb7['query'])['then'](respondWithResult(_0x34bbd0,null))[_0x18a0('0x18')](handleError(_0x34bbd0,null));};exports['voiceChannelMixMonitor']=function(_0x54ba8,_0x24a8cf){return respondWithRpcPromise(_0x18a0('0x19'),_[_0x18a0('0x1a')](_0x54ba8[_0x18a0('0x1b')],_0x54ba8['params']))['then'](respondWithResult(_0x24a8cf,null))[_0x18a0('0x18')](handleError(_0x24a8cf,null));};exports[_0x18a0('0x1c')]=function(_0x170db2,_0x119192){return respondWithRpcPromise(_0x18a0('0x1d'),_['merge'](_0x170db2[_0x18a0('0x1b')],_0x170db2[_0x18a0('0x1e')]))[_0x18a0('0xa')](respondWithResult(_0x119192,null))['catch'](handleError(_0x119192,null));};exports[_0x18a0('0x1f')]=function(_0x1d0ff4,_0x1e3d85){return respondWithRpcPromise(_0x18a0('0x20'),_0x1d0ff4[_0x18a0('0x1b')])[_0x18a0('0xa')](respondWithResult(_0x1e3d85,null))[_0x18a0('0x18')](handleError(_0x1e3d85,null));};exports[_0x18a0('0x21')]=function(_0x46e642,_0x5205a1){return respondWithRpcPromise(_0x18a0('0x20'),_0x46e642[_0x18a0('0x1b')])['then'](findById(_0x46e642['params']['id']))[_0x18a0('0xa')](respondWithResult(_0x5205a1,null))['catch'](handleError(_0x5205a1,null));};exports[_0x18a0('0x22')]=function(_0x293b48,_0x4344a0){return respondWithRpcPromise('VoiceQueuesPreview',_['merge'](_0x293b48['query'],_0x293b48[_0x18a0('0x1e')]))[_0x18a0('0xa')](respondWithResult(_0x4344a0,null))[_0x18a0('0x18')](handleError(_0x4344a0,null));};exports[_0x18a0('0x23')]=function(_0x2d7242,_0x4ad1cc){return respondWithRpcPromise(_0x18a0('0x24'),_0x2d7242[_0x18a0('0x1b')])[_0x18a0('0xa')](respondWithResult(_0x4ad1cc,null))[_0x18a0('0x18')](handleError(_0x4ad1cc,null));};exports['voiceQueuesChannel']=function(_0x387c66,_0x19c412){return respondWithRpcPromise(_0x18a0('0x25'),_[_0x18a0('0x1a')](_0x387c66[_0x18a0('0x1b')],_0x387c66['params']))[_0x18a0('0xa')](respondWithResult(_0x19c412,null))['catch'](handleError(_0x19c412,null));};exports[_0x18a0('0x26')]=function(_0xea99e4,_0x4ac5f3){return respondWithRpcPromise(_0x18a0('0x27'),_['merge'](_0xea99e4[_0x18a0('0x1b')],_0xea99e4[_0x18a0('0x1e')]))[_0x18a0('0xa')](respondWithResult(_0x4ac5f3,null))[_0x18a0('0x18')](handleError(_0x4ac5f3,null));};exports[_0x18a0('0x28')]=function(_0x2659eb,_0x19c493){return respondWithRpcPromise('VoiceQueuesChannelRedirect',_[_0x18a0('0x1a')](_0x2659eb[_0x18a0('0x1b')],_0x2659eb[_0x18a0('0x1e')]))[_0x18a0('0xa')](respondWithResult(_0x19c493,null))[_0x18a0('0x18')](handleError(_0x19c493,null));};exports[_0x18a0('0x29')]=function(_0x357cb6,_0x592115){return respondWithRpcPromise(_0x18a0('0x2a'),_0x357cb6['query'])[_0x18a0('0xa')](respondWithResult(_0x592115,null))['catch'](handleError(_0x592115,null));};exports['outboundChannels']=function(_0x3a0c2d,_0x3c999f){return respondWithRpcPromise(_0x18a0('0x2b'),_0x3a0c2d['query'])[_0x18a0('0xa')](respondWithResult(_0x3c999f,null))[_0x18a0('0x18')](handleError(_0x3c999f,null));};exports[_0x18a0('0x2c')]=function(_0x25ad5c,_0x185d8d){var _0x2e59a8;return respondWithRpcPromise(_0x18a0('0x2d'),_0x25ad5c['query'])['then'](function(_0x55d7ab){_0x2e59a8=_0x55d7ab;return respondWithRpcPromise(_0x18a0('0x2d'),_0x25ad5c[_0x18a0('0x1b')],routingClient);})[_0x18a0('0xa')](function(_0xd4a5d6){return _[_0x18a0('0x1a')]({},_0xd4a5d6,_0x2e59a8);})['then'](respondWithResult(_0x185d8d,null))[_0x18a0('0x18')](handleError(_0x185d8d,null));};exports[_0x18a0('0x2e')]=function(_0x37321e,_0xd509a1){if(_0x37321e[_0x18a0('0x2f')]&&_0x37321e[_0x18a0('0x2f')][_0x18a0('0x30')]&&_0x37321e[_0x18a0('0x31')]&&_0x37321e['user'][_0x18a0('0x12')]){for(var _0x19ddb1 in _0x37321e['body']['interaction']){if(_0x37321e['body'][_0x18a0('0x30')][_0x18a0('0x32')](_0x19ddb1)){db[_0x18a0('0x33')][_0x18a0('0x34')]({'where':{'channel':_0x19ddb1,'membername':_0x37321e[_0x18a0('0x31')][_0x18a0('0x12')],'type':_0x18a0('0x35'),'exitAt':null,'uniqueid':_0x37321e[_0x18a0('0x2f')][_0x18a0('0x30')][_0x19ddb1]&&_0x37321e[_0x18a0('0x2f')][_0x18a0('0x30')][_0x19ddb1][_0x18a0('0x36')]?{'$notIn':_0x37321e['body']['interaction'][_0x19ddb1]}:{'$ne':null}}})[_0x18a0('0xa')](function(_0x4dc12a){var _0x715a9=moment()[_0x18a0('0x37')]('YYYY-MM-DD\x20HH:mm:ss');for(var _0x13deb3=0x0,_0x358cff=_0x4dc12a[_0x18a0('0x36')];_0x13deb3<_0x358cff;_0x13deb3+=0x1){_0x4dc12a[_0x13deb3]['updateAttributes']({'exitAt':_0x715a9});}});for(var _0x18d989=0x0;_0x18d989<_0x37321e[_0x18a0('0x2f')][_0x18a0('0x30')][_0x19ddb1][_0x18a0('0x36')];_0x18d989+=0x1){db[_0x18a0('0x33')][_0x18a0('0x38')]({'where':{'channel':_0x19ddb1,'membername':_0x37321e[_0x18a0('0x31')][_0x18a0('0x12')],'type':_0x18a0('0x35'),'uniqueid':_0x37321e[_0x18a0('0x2f')]['interaction'][_0x19ddb1][_0x18d989],'exitAt':null},'defaults':{'channel':_0x19ddb1,'membername':_0x37321e[_0x18a0('0x31')][_0x18a0('0x12')],'interface':_[_0x18a0('0x14')](_0x37321e[_0x18a0('0x31')][_0x18a0('0x39')])?util[_0x18a0('0x37')](_0x18a0('0x3a'),_0x37321e[_0x18a0('0x31')][_0x18a0('0x12')]):_0x37321e[_0x18a0('0x31')][_0x18a0('0x39')],'type':'INTERACTION','enterAt':moment()[_0x18a0('0x37')](_0x18a0('0x3b')),'role':_0x18a0('0x3c'),'internal':_0x37321e[_0x18a0('0x31')]['internal'],'uniqueid':_0x37321e[_0x18a0('0x2f')][_0x18a0('0x30')][_0x19ddb1][_0x18d989]}});}}}}return respondWithRpcPromise('AgentCapacity',{'id':_0x37321e['params']['id'],'capacity':_0x37321e[_0x18a0('0x2f')]['capacity']},routingClient)['then'](respondWithResult(_0xd509a1,null))[_0x18a0('0x18')](handleError(_0xd509a1,null));};exports['telephones']=function(_0x1a770c,_0xc67137){return respondWithRpcPromise('Telephones',_0x1a770c['query'])[_0x18a0('0xa')](respondWithResult(_0xc67137,null))[_0x18a0('0x18')](handleError(_0xc67137,null));};exports[_0x18a0('0x3d')]=function(_0x54c07a,_0x150b9f){return respondWithRpcPromise('Trunks',_0x54c07a[_0x18a0('0x1b')])[_0x18a0('0xa')](respondWithResult(_0x150b9f,null))['catch'](handleError(_0x150b9f,null));};exports[_0x18a0('0x3e')]=function(_0x414b0d,_0x68492){return respondWithRpcPromise(_0x18a0('0x3f'),_0x414b0d['query'])[_0x18a0('0xa')](respondWithResult(_0x68492,null))['catch'](handleError(_0x68492,null));};exports[_0x18a0('0x40')]=function(_0x1fe0a0,_0x44ca6f){return respondWithRpcPromise(_0x18a0('0x41'),_0x1fe0a0[_0x18a0('0x1b')],routingClient)[_0x18a0('0xa')](respondWithResult(_0x44ca6f,null))['catch'](handleError(_0x44ca6f,null));};exports[_0x18a0('0x42')]=function(_0x2415af,_0x16eb22){return respondWithRpcPromise(_0x18a0('0x41'),_0x2415af['query'],routingClient)[_0x18a0('0xa')](findById(_0x2415af[_0x18a0('0x1e')]['id']))[_0x18a0('0xa')](respondWithResult(_0x16eb22,null))[_0x18a0('0x18')](handleError(_0x16eb22,null));};exports[_0x18a0('0x43')]=function(_0x5cec4d,_0x455b61){return respondWithRpcPromise(_0x18a0('0x44'),_0x5cec4d['query'],routingClient)[_0x18a0('0xa')](respondWithResult(_0x455b61,null))['catch'](handleError(_0x455b61,null));};exports[_0x18a0('0x45')]=function(_0x35abe4,_0x2be91c){return respondWithRpcPromise(_0x18a0('0x44'),_0x35abe4[_0x18a0('0x1b')],routingClient)[_0x18a0('0xa')](findById(_0x35abe4[_0x18a0('0x1e')]['id']))[_0x18a0('0xa')](respondWithResult(_0x2be91c,null))[_0x18a0('0x18')](handleError(_0x2be91c,null));};exports[_0x18a0('0x46')]=function(_0x39a68c,_0x496ed8){return respondWithRpcPromise(_0x18a0('0x47'),_0x39a68c[_0x18a0('0x1b')],mailClient)[_0x18a0('0xa')](respondWithResult(_0x496ed8,null))[_0x18a0('0x18')](handleError(_0x496ed8,null));};exports['openchannelQueues']=function(_0x5c0d6f,_0x348593){return respondWithRpcPromise(_0x18a0('0x48'),_0x5c0d6f[_0x18a0('0x1b')],routingClient)[_0x18a0('0xa')](respondWithResult(_0x348593,null))[_0x18a0('0x18')](handleError(_0x348593,null));};exports['showOpenchannelQueues']=function(_0x1ba650,_0x5173c4){return respondWithRpcPromise('OpenchannelQueues',_0x1ba650[_0x18a0('0x1b')],routingClient)[_0x18a0('0xa')](findById(_0x1ba650[_0x18a0('0x1e')]['id']))['then'](respondWithResult(_0x5173c4,null))[_0x18a0('0x18')](handleError(_0x5173c4,null));};exports[_0x18a0('0x49')]=function(_0x5a88ae,_0xcde27f){return respondWithRpcPromise('SmsQueues',_0x5a88ae[_0x18a0('0x1b')],routingClient)[_0x18a0('0xa')](respondWithResult(_0xcde27f,null))[_0x18a0('0x18')](handleError(_0xcde27f,null));};exports[_0x18a0('0x4a')]=function(_0x4d3361,_0xb328b6){return respondWithRpcPromise(_0x18a0('0x4b'),_0x4d3361[_0x18a0('0x1b')],routingClient)[_0x18a0('0xa')](findById(_0x4d3361['params']['id']))[_0x18a0('0xa')](respondWithResult(_0xb328b6,null))[_0x18a0('0x18')](handleError(_0xb328b6,null));};exports[_0x18a0('0x4c')]=function(_0x3ae0a8,_0x184b0d){return respondWithRpcPromise(_0x18a0('0x4d'),_0x3ae0a8[_0x18a0('0x1b')],routingClient)[_0x18a0('0xa')](respondWithResult(_0x184b0d,null))[_0x18a0('0x18')](handleError(_0x184b0d,null));};exports[_0x18a0('0x4e')]=function(_0x54dee2,_0x40d3c4){return respondWithRpcPromise(_0x18a0('0x4d'),_0x54dee2[_0x18a0('0x1b')],routingClient)[_0x18a0('0xa')](findById(_0x54dee2['params']['id']))['then'](respondWithResult(_0x40d3c4,null))[_0x18a0('0x18')](handleError(_0x40d3c4,null));};exports['faxQueues']=function(_0x3ee46d,_0x4d41f2){return respondWithRpcPromise(_0x18a0('0x4f'),_0x3ee46d['query'],routingClient)['then'](respondWithResult(_0x4d41f2,null))['catch'](handleError(_0x4d41f2,null));};exports[_0x18a0('0x50')]=function(_0xf18659,_0x12609b){return respondWithRpcPromise(_0x18a0('0x4f'),_0xf18659[_0x18a0('0x1b')],routingClient)['then'](findById(_0xf18659['params']['id']))['then'](respondWithResult(_0x12609b,null))[_0x18a0('0x18')](handleError(_0x12609b,null));};exports[_0x18a0('0x51')]=function(_0x3aa6ad,_0x1288a2){return respondWithRpcPromise('FaxAccounts',_0x3aa6ad[_0x18a0('0x1b')])[_0x18a0('0xa')](respondWithResult(_0x1288a2,null))[_0x18a0('0x18')](handleError(_0x1288a2,null));};exports[_0x18a0('0x52')]=function(_0x42561c,_0x2846a7){return respondWithRpcPromise(_0x18a0('0x53'),_0x42561c['query'],routingClient)['then'](respondWithResult(_0x2846a7,null))[_0x18a0('0x18')](handleError(_0x2846a7,null));};exports[_0x18a0('0x54')]=function(_0x4aede5,_0x28a6fe){return respondWithRpcPromise(_0x18a0('0x55'),_0x4aede5[_0x18a0('0x1b')],routingClient)[_0x18a0('0xa')](respondWithResult(_0x28a6fe,null))[_0x18a0('0x18')](handleError(_0x28a6fe,null));};exports[_0x18a0('0x56')]=function(_0x48737c,_0x19cf8d){return respondWithRpcPromise(_0x18a0('0x57'),_0x48737c[_0x18a0('0x1b')],routingClient)[_0x18a0('0xa')](respondWithResult(_0x19cf8d,null))[_0x18a0('0x18')](handleError(_0x19cf8d,null));};exports[_0x18a0('0x58')]=function(_0x564b9c,_0x27e71c){return respondWithRpcPromise('SmsQueuesWaitingInteractions',_0x564b9c['query'],routingClient)[_0x18a0('0xa')](respondWithResult(_0x27e71c,null))['catch'](handleError(_0x27e71c,null));};exports[_0x18a0('0x59')]=function(_0x302d5e,_0x22f6b8){return respondWithRpcPromise(_0x18a0('0x5a'),_0x302d5e[_0x18a0('0x1b')],routingClient)[_0x18a0('0xa')](respondWithResult(_0x22f6b8,null))[_0x18a0('0x18')](handleError(_0x22f6b8,null));};exports[_0x18a0('0x5b')]=function(_0x5d09d0,_0x4fbd80){return respondWithRpcPromise('FaxQueuesWaitingInteractions',_0x5d09d0[_0x18a0('0x1b')],routingClient)[_0x18a0('0xa')](respondWithResult(_0x4fbd80,null))['catch'](handleError(_0x4fbd80,null));};exports[_0x18a0('0x5c')]=function(_0x5c73c4){return function(_0x440072,_0x37eb01){var _0x4e0ee6,_0x2601d6;var _0x24a186=_[_0x18a0('0x5d')](_0x5c73c4);var _0x371d46=_0x5c73c4==='chat'?_0x18a0('0x5e'):_0x18a0('0x5f');return db[_0x24a186+'Queue']['findOne']({'raw':!![],'where':{'id':_0x440072['params']['id']}})[_0x18a0('0xa')](function(_0x2e9349){if(_[_0x18a0('0x14')](_0x2e9349)){throw new Error(_0x24a186+_0x18a0('0x60'));}_0x4e0ee6=_0x2e9349;return db[_0x24a186+_0x18a0('0x61')][_0x18a0('0x62')]({'where':{'id':_0x440072[_0x18a0('0x2f')][_0x18a0('0x63')]},'include':[{'model':db[_0x24a186+_0x18a0('0x64')],'as':_0x18a0('0x64')},{'model':db[_0x24a186+_0x371d46],'as':_0x18a0('0x5f')}]});})[_0x18a0('0xa')](function(_0x357ef5){if(_['isNil'](_0x357ef5)){throw new Error(_0x24a186+_0x18a0('0x65'));}_0x2601d6=_0x357ef5;return _0x357ef5[_0x18a0('0x66')]({'read':0x0,'readAt':null,'UserId':null});})[_0x18a0('0xa')](function(){var _0x1ea10c={'uniqueid':_0x5c73c4+'.'+_0x2601d6['id']+'.'+_0x2601d6[_0x18a0('0x64')]['id'],'FromUserId':_0x440072['user']['id'],'type':'queue'};_0x1ea10c[_0x24a186+_0x18a0('0x67')]=_0x2601d6['id'];_0x1ea10c[_0x24a186+_0x18a0('0x68')]=_0x2601d6['Interaction']['id'];_0x1ea10c[_0x18a0('0x69')+_0x24a186+_0x371d46+'Id']=_0x2601d6[_0x18a0('0x5f')]['id'];_0x1ea10c['To'+_0x24a186+_0x18a0('0x6a')]=_0x4e0ee6['id'];return db[_0x24a186+_0x18a0('0x6b')][_0x18a0('0x6c')](_0x1ea10c);})[_0x18a0('0xa')](function(){return respondWithRpcPromise('Start',{'channel':_0x5c73c4,'interaction':_0x2601d6[_0x18a0('0x64')],'message':_0x2601d6,'account':_0x2601d6[_0x18a0('0x5f')],'applications':[{'id':0x0,'priority':0x1,'app':_0x18a0('0x6d'),'appdata':_0x4e0ee6[_0x18a0('0x12')]+','+(_0x2601d6[_0x18a0('0x5f')][_0x18a0('0x6e')]||0x12c),'interval':'*,*,*,*'}]},routingClient);})['then'](respondWithResult(_0x37eb01,null))[_0x18a0('0x18')](handleError(_0x37eb01,null));};};exports['agentNotify']=function(_0x474b61,_0x537d2e){var _0x5e781c,_0x1b7810;if(_[_0x18a0('0x14')](_0x474b61['body']['channel'])){throw new Error(_0x18a0('0x6f'));}var _0x11e949=_0x474b61[_0x18a0('0x2f')]['channel'];var _0xa98c11=_[_0x18a0('0x5d')](_0x11e949);var _0x232249=_0x11e949==='chat'?'Website':'Account';return db[_0x18a0('0x70')][_0x18a0('0x62')]({'raw':!![],'where':{'id':_0x474b61[_0x18a0('0x1e')]['id'],'role':'agent'}})[_0x18a0('0xa')](function(_0x5322f6){if(_[_0x18a0('0x14')](_0x5322f6)){throw new Error(_0x18a0('0x71'));}_0x5e781c=_0x5322f6;return db[_0xa98c11+_0x18a0('0x61')][_0x18a0('0x62')]({'where':{'id':_0x474b61[_0x18a0('0x2f')]['messageId']},'include':[{'model':db[_0xa98c11+_0x18a0('0x64')],'as':'Interaction'},{'model':db[_0xa98c11+_0x232249],'as':_0x18a0('0x5f')}]});})['then'](function(_0x1fd43b){if(_[_0x18a0('0x14')](_0x1fd43b)){throw new Error(_0xa98c11+_0x18a0('0x65'));}_0x1b7810=_0x1fd43b;return _0x1fd43b[_0x18a0('0x66')]({'read':0x0,'readAt':null,'UserId':null});})[_0x18a0('0xa')](function(){var _0x1bcb4a={'uniqueid':_0x11e949+'.'+_0x1b7810['id']+'.'+_0x1b7810[_0x18a0('0x64')]['id'],'FromUserId':_0x474b61[_0x18a0('0x31')]['id'],'type':'queue','ToUserId':_0x5e781c['id']};_0x1bcb4a[_0xa98c11+_0x18a0('0x67')]=_0x1b7810['id'];_0x1bcb4a[_0xa98c11+'InteractionId']=_0x1b7810[_0x18a0('0x64')]['id'];_0x1bcb4a[_0x18a0('0x69')+_0xa98c11+_0x232249+'Id']=_0x1b7810[_0x18a0('0x5f')]['id'];return db[_0xa98c11+_0x18a0('0x6b')][_0x18a0('0x6c')](_0x1bcb4a);})[_0x18a0('0xa')](function(){return respondWithRpcPromise('Start',{'channel':_0x11e949,'interaction':_0x1b7810[_0x18a0('0x64')],'message':_0x1b7810,'account':_0x1b7810[_0x18a0('0x5f')],'applications':[{'id':0x0,'priority':0x1,'app':_0x18a0('0x3c'),'appdata':_0x5e781c[_0x18a0('0x12')]+','+(_0x1b7810[_0x18a0('0x5f')]['agentTransferTimeout']||0x12c),'interval':'*,*,*,*'}]},routingClient);})[_0x18a0('0xa')](respondWithResult(_0x537d2e,null))['catch'](handleError(_0x537d2e,null));}; \ No newline at end of file diff --git a/server/api/schedule/index.js b/server/api/schedule/index.js index b549101..e29e460 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 _0x8021=['isAuthenticated','/:id','show','create','put','update','delete','destroy','exports','multer','path','connect-timeout','express','../../components/interaction/service','../../config/environment','./schedule.controller','get'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x8021,0x1c3));var _0x1802=function(_0x524efa,_0xbe406e){_0x524efa=_0x524efa-0x0;var _0x775cd5=_0x8021[_0x524efa];return _0x775cd5;};'use strict';var multer=require(_0x1802('0x0'));var util=require('util');var path=require(_0x1802('0x1'));var timeout=require(_0x1802('0x2'));var express=require(_0x1802('0x3'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0x1802('0x4'));var config=require(_0x1802('0x5'));var controller=require(_0x1802('0x6'));router[_0x1802('0x7')]('/',auth[_0x1802('0x8')](),controller['index']);router[_0x1802('0x7')](_0x1802('0x9'),auth[_0x1802('0x8')](),controller[_0x1802('0xa')]);router['get']('/:id/run',auth[_0x1802('0x8')](),controller['run']);router['post']('/',auth[_0x1802('0x8')](),controller[_0x1802('0xb')]);router[_0x1802('0xc')]('/:id',auth[_0x1802('0x8')](),controller[_0x1802('0xd')]);router[_0x1802('0xe')]('/:id',auth[_0x1802('0x8')](),controller[_0x1802('0xf')]);module[_0x1802('0x10')]=router; \ No newline at end of file +var _0xcc45=['../../config/environment','./schedule.controller','get','isAuthenticated','index','/:id','show','/:id/run','post','put','update','delete','destroy','exports','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x49b78e,_0x2fa935){var _0x4f155d=function(_0x4b91ea){while(--_0x4b91ea){_0x49b78e['push'](_0x49b78e['shift']());}};_0x4f155d(++_0x2fa935);}(_0xcc45,0x177));var _0x5cc4=function(_0x44c741,_0xae9d9c){_0x44c741=_0x44c741-0x0;var _0x4b247f=_0xcc45[_0x44c741];return _0x4b247f;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0x5cc4('0x0'));var express=require(_0x5cc4('0x1'));var router=express[_0x5cc4('0x2')]();var auth=require(_0x5cc4('0x3'));var interaction=require(_0x5cc4('0x4'));var config=require(_0x5cc4('0x5'));var controller=require(_0x5cc4('0x6'));router[_0x5cc4('0x7')]('/',auth[_0x5cc4('0x8')](),controller[_0x5cc4('0x9')]);router['get'](_0x5cc4('0xa'),auth[_0x5cc4('0x8')](),controller[_0x5cc4('0xb')]);router['get'](_0x5cc4('0xc'),auth[_0x5cc4('0x8')](),controller['run']);router[_0x5cc4('0xd')]('/',auth[_0x5cc4('0x8')](),controller['create']);router[_0x5cc4('0xe')](_0x5cc4('0xa'),auth['isAuthenticated'](),controller[_0x5cc4('0xf')]);router[_0x5cc4('0x10')](_0x5cc4('0xa'),auth[_0x5cc4('0x8')](),controller[_0x5cc4('0x11')]);module[_0x5cc4('0x12')]=router; \ No newline at end of file diff --git a/server/api/schedule/schedule.attributes.js b/server/api/schedule/schedule.attributes.js index 11579eb..0acd321 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 _0x4753=['ENUM','csv','pdf','xlsx','default','custom','TEXT','sequelize','exports','STRING','BOOLEAN','DATE','quarters','months','days','hours','minutes'];(function(_0x51904f,_0x2af5bf){var _0x4d9eb=function(_0x17da1a){while(--_0x17da1a){_0x51904f['push'](_0x51904f['shift']());}};_0x4d9eb(++_0x2af5bf);}(_0x4753,0x1f4));var _0x3475=function(_0x53525e,_0x388b24){_0x53525e=_0x53525e-0x0;var _0x2a5361=_0x4753[_0x53525e];return _0x2a5361;};'use strict';var Sequelize=require(_0x3475('0x0'));module[_0x3475('0x1')]={'name':{'type':Sequelize[_0x3475('0x2')],'allowNull':![]},'description':{'type':Sequelize['STRING']},'active':{'type':Sequelize[_0x3475('0x3')],'allowNull':![],'defaultValue':![]},'cron':{'type':Sequelize[_0x3475('0x2')],'allowNull':![],'defaultValue':'0\x200\x20*\x20*\x20*'},'startAt':{'type':Sequelize[_0x3475('0x4')],'allowNull':![]},'endAt':{'type':Sequelize['DATE'],'allowNull':![]},'subtractNumber':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x1,'validate':{'min':0x1}},'subtractUnit':{'type':Sequelize['ENUM']('years',_0x3475('0x5'),_0x3475('0x6'),'weeks',_0x3475('0x7'),_0x3475('0x8'),_0x3475('0x9')),'allowNull':![],'defaultValue':_0x3475('0x7')},'output':{'type':Sequelize[_0x3475('0xa')](_0x3475('0xb'),_0x3475('0xc'),_0x3475('0xd')),'allowNull':![],'defaultValue':_0x3475('0xb')},'type':{'type':Sequelize[_0x3475('0xa')]('custom',_0x3475('0xe')),'allowNull':![],'defaultValue':_0x3475('0xf')},'sendMail':{'type':Sequelize[_0x3475('0x3')],'defaultValue':![]},'email':{'type':Sequelize['STRING']},'cc':{'type':Sequelize[_0x3475('0x10')]},'bcc':{'type':Sequelize[_0x3475('0x10')]},'sendIfEmpty':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]}}; \ No newline at end of file +var _0xb2ad=['months','hours','minutes','days','csv','pdf','custom','TEXT','exports','STRING','BOOLEAN','0\x200\x20*\x20*\x20*','DATE','INTEGER','ENUM','years','quarters'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xb2ad,0x16d));var _0xdb2a=function(_0xb85b75,_0x339655){_0xb85b75=_0xb85b75-0x0;var _0x49ea49=_0xb2ad[_0xb85b75];return _0x49ea49;};'use strict';var Sequelize=require('sequelize');module[_0xdb2a('0x0')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize[_0xdb2a('0x1')]},'active':{'type':Sequelize[_0xdb2a('0x2')],'allowNull':![],'defaultValue':![]},'cron':{'type':Sequelize[_0xdb2a('0x1')],'allowNull':![],'defaultValue':_0xdb2a('0x3')},'startAt':{'type':Sequelize[_0xdb2a('0x4')],'allowNull':![]},'endAt':{'type':Sequelize['DATE'],'allowNull':![]},'subtractNumber':{'type':Sequelize[_0xdb2a('0x5')],'allowNull':![],'defaultValue':0x1,'validate':{'min':0x1}},'subtractUnit':{'type':Sequelize[_0xdb2a('0x6')](_0xdb2a('0x7'),_0xdb2a('0x8'),_0xdb2a('0x9'),'weeks','days',_0xdb2a('0xa'),_0xdb2a('0xb')),'allowNull':![],'defaultValue':_0xdb2a('0xc')},'output':{'type':Sequelize['ENUM'](_0xdb2a('0xd'),_0xdb2a('0xe'),'xlsx'),'allowNull':![],'defaultValue':_0xdb2a('0xd')},'type':{'type':Sequelize[_0xdb2a('0x6')]('custom','default'),'allowNull':![],'defaultValue':_0xdb2a('0xf')},'sendMail':{'type':Sequelize[_0xdb2a('0x2')],'defaultValue':![]},'email':{'type':Sequelize[_0xdb2a('0x1')]},'cc':{'type':Sequelize['TEXT']},'bcc':{'type':Sequelize[_0xdb2a('0x10')]},'sendIfEmpty':{'type':Sequelize[_0xdb2a('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 77440f7..8e80c0a 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 _0x5262=['VIRTUAL','options','includeAll','include','rows','catch','show','params','rawAttributes','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','run','../../config/schedule','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','util','path','sox','to-csv','lodash','squel','crypto','jsforce','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','set','Content-Range','apply','reject','save','update','then','destroy','get','Scheduler','UserProfileResource','stack','name','send','index','map','Schedule','key','keys','query','filters','intersection','model','fields','attributes','length','hasOwnProperty','order','sort','where','pick','filter','merge'];(function(_0x4b91c4,_0x23f35f){var _0x25cb80=function(_0x48e283){while(--_0x48e283){_0x4b91c4['push'](_0x4b91c4['shift']());}};_0x25cb80(++_0x23f35f);}(_0x5262,0xc2));var _0x2526=function(_0x2aa046,_0xe7b01e){_0x2aa046=_0x2aa046-0x0;var _0x1a182d=_0x5262[_0x2aa046];return _0x1a182d;};'use strict';var pdf=require(_0x2526('0x0'));var emlformat=require(_0x2526('0x1'));var rimraf=require(_0x2526('0x2'));var zipdir=require(_0x2526('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x2526('0x4'));var moment=require(_0x2526('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x2526('0x6'));var path=require(_0x2526('0x7'));var sox=require(_0x2526('0x8'));var csv=require(_0x2526('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x2526('0xa'));var squel=require(_0x2526('0xb'));var crypto=require(_0x2526('0xc'));var jsforce=require(_0x2526('0xd'));var deskjs=require(_0x2526('0xe'));var toCsv=require('to-csv');var querystring=require(_0x2526('0xf'));var Papa=require('papaparse');var Redis=require(_0x2526('0x10'));var authService=require(_0x2526('0x11'));var qs=require(_0x2526('0x12'));var as=require(_0x2526('0x13'));var hardwareService=require(_0x2526('0x14'));var logger=require(_0x2526('0x15'))(_0x2526('0x16'));var utils=require('../../config/utils');var config=require(_0x2526('0x17'));var db=require(_0x2526('0x18'))['db'];function respondWithStatusCode(_0xeb75d8,_0x2c80c2){_0x2c80c2=_0x2c80c2||0xcc;return function(_0x411ae9){if(_0x411ae9){return _0xeb75d8[_0x2526('0x19')](_0x2c80c2);}return _0xeb75d8['status'](_0x2c80c2)['end']();};}function respondWithResult(_0x4fe9cd,_0x4ab2cd){_0x4ab2cd=_0x4ab2cd||0xc8;return function(_0x216996){if(_0x216996){return _0x4fe9cd[_0x2526('0x1a')](_0x4ab2cd)[_0x2526('0x1b')](_0x216996);}};}function respondWithFilteredResult(_0x44da9a,_0x8a260c){return function(_0x3bb13d){if(_0x3bb13d){var _0x258dff=_0x3bb13d[_0x2526('0x1c')],_0x589524=_0x8a260c[_0x2526('0x1d')],_0x5ca5ae=_0x8a260c[_0x2526('0x1d')]+_0x8a260c[_0x2526('0x1e')],_0x574e90;if(_0x5ca5ae>=_0x258dff){_0x5ca5ae=_0x258dff;_0x574e90=0xc8;}else{_0x574e90=0xce;}_0x44da9a[_0x2526('0x1a')](_0x574e90);return _0x44da9a[_0x2526('0x1f')](_0x2526('0x20'),_0x589524+'-'+_0x5ca5ae+'/'+_0x258dff)['json'](_0x3bb13d);}return null;};}function patchUpdates(_0x5c4bc3){return function(_0x4f4dc5){try{jsonpatch[_0x2526('0x21')](_0x4f4dc5,_0x5c4bc3,!![]);}catch(_0x34bdfb){return BPromise[_0x2526('0x22')](_0x34bdfb);}return _0x4f4dc5[_0x2526('0x23')]();};}function saveUpdates(_0x4ae638,_0x26abcb){return function(_0x3a2a2e){if(_0x3a2a2e){return _0x3a2a2e[_0x2526('0x24')](_0x4ae638)[_0x2526('0x25')](function(_0xeb3147){return _0xeb3147;});}return null;};}function removeEntity(_0x35db8c,_0x1c425c){return function(_0x21130b){if(_0x21130b){return _0x21130b[_0x2526('0x26')]()[_0x2526('0x25')](function(){var _0x395fa0=_0x21130b[_0x2526('0x27')]({'plain':!![]});var _0x48928e=_0x2526('0x28');return db[_0x2526('0x29')][_0x2526('0x26')]({'where':{'type':_0x48928e,'resourceId':_0x395fa0['id']}})['then'](function(){return _0x21130b;});})['then'](function(){_0x35db8c[_0x2526('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x484ea7,_0x548a5e){return function(_0x2761a3){if(!_0x2761a3){_0x484ea7[_0x2526('0x19')](0x194);}return _0x2761a3;};}function handleError(_0x2db1a3,_0xe147bc){_0xe147bc=_0xe147bc||0x1f4;return function(_0x58ced4){logger['error'](_0x58ced4[_0x2526('0x2a')]);if(_0x58ced4[_0x2526('0x2b')]){delete _0x58ced4[_0x2526('0x2b')];}_0x2db1a3['status'](_0xe147bc)[_0x2526('0x2c')](_0x58ced4);};}exports[_0x2526('0x2d')]=function(_0x1c4c42,_0xcc455){var _0x54b8ac={},_0x5e2ac4={},_0x5c7c6a={'count':0x0,'rows':[]};var _0x590974=_[_0x2526('0x2e')](db[_0x2526('0x2f')]['rawAttributes'],function(_0x1faecd){return{'name':_0x1faecd['fieldName'],'type':_0x1faecd['type'][_0x2526('0x30')]};});_0x5e2ac4['model']=_['map'](_0x590974,'name');_0x5e2ac4['query']=_[_0x2526('0x31')](_0x1c4c42[_0x2526('0x32')]);_0x5e2ac4[_0x2526('0x33')]=_[_0x2526('0x34')](_0x5e2ac4['model'],_0x5e2ac4['query']);_0x54b8ac['attributes']=_[_0x2526('0x34')](_0x5e2ac4[_0x2526('0x35')],qs[_0x2526('0x36')](_0x1c4c42['query'][_0x2526('0x36')]));_0x54b8ac[_0x2526('0x37')]=_0x54b8ac['attributes'][_0x2526('0x38')]?_0x54b8ac[_0x2526('0x37')]:_0x5e2ac4['model'];if(!_0x1c4c42[_0x2526('0x32')][_0x2526('0x39')]('nolimit')){_0x54b8ac[_0x2526('0x1e')]=qs[_0x2526('0x1e')](_0x1c4c42[_0x2526('0x32')][_0x2526('0x1e')]);_0x54b8ac[_0x2526('0x1d')]=qs['offset'](_0x1c4c42[_0x2526('0x32')][_0x2526('0x1d')]);}_0x54b8ac[_0x2526('0x3a')]=qs[_0x2526('0x3b')](_0x1c4c42[_0x2526('0x32')][_0x2526('0x3b')]);_0x54b8ac[_0x2526('0x3c')]=qs[_0x2526('0x33')](_[_0x2526('0x3d')](_0x1c4c42['query'],_0x5e2ac4[_0x2526('0x33')]),_0x590974);if(_0x1c4c42[_0x2526('0x32')][_0x2526('0x3e')]){_0x54b8ac['where']=_[_0x2526('0x3f')](_0x54b8ac[_0x2526('0x3c')],{'$or':_[_0x2526('0x2e')](_0x590974,function(_0x232d70){if(_0x232d70['type']!==_0x2526('0x40')){var _0x3249f2={};_0x3249f2[_0x232d70[_0x2526('0x2b')]]={'$like':'%'+_0x1c4c42[_0x2526('0x32')][_0x2526('0x3e')]+'%'};return _0x3249f2;}})});}_0x54b8ac=_[_0x2526('0x3f')]({},_0x54b8ac,_0x1c4c42[_0x2526('0x41')]);var _0x12b9fb={'where':_0x54b8ac['where']};return db[_0x2526('0x2f')]['count'](_0x12b9fb)[_0x2526('0x25')](function(_0x5e5ea1){_0x5c7c6a[_0x2526('0x1c')]=_0x5e5ea1;if(_0x1c4c42[_0x2526('0x32')][_0x2526('0x42')]){_0x54b8ac[_0x2526('0x43')]=[{'all':!![]}];}return db[_0x2526('0x2f')]['findAll'](_0x54b8ac);})[_0x2526('0x25')](function(_0xe11988){_0x5c7c6a[_0x2526('0x44')]=_0xe11988;return _0x5c7c6a;})[_0x2526('0x25')](respondWithFilteredResult(_0xcc455,_0x54b8ac))[_0x2526('0x45')](handleError(_0xcc455,null));};exports[_0x2526('0x46')]=function(_0x1b58f1,_0x5ade4d){var _0x212d64={'raw':![],'where':{'id':_0x1b58f1[_0x2526('0x47')]['id']}},_0xd055fe={};_0xd055fe[_0x2526('0x35')]=_['keys'](db['Schedule'][_0x2526('0x48')]);_0xd055fe[_0x2526('0x32')]=_[_0x2526('0x31')](_0x1b58f1[_0x2526('0x32')]);_0xd055fe[_0x2526('0x33')]=_[_0x2526('0x34')](_0xd055fe[_0x2526('0x35')],_0xd055fe['query']);_0x212d64[_0x2526('0x37')]=_[_0x2526('0x34')](_0xd055fe[_0x2526('0x35')],qs['fields'](_0x1b58f1['query'][_0x2526('0x36')]));_0x212d64[_0x2526('0x37')]=_0x212d64[_0x2526('0x37')][_0x2526('0x38')]?_0x212d64[_0x2526('0x37')]:_0xd055fe['model'];if(_0x1b58f1[_0x2526('0x32')][_0x2526('0x42')]){_0x212d64[_0x2526('0x43')]=[{'all':!![]}];}_0x212d64=_['merge']({},_0x212d64,_0x1b58f1[_0x2526('0x41')]);return db[_0x2526('0x2f')][_0x2526('0x49')](_0x212d64)['then'](handleEntityNotFound(_0x5ade4d,null))[_0x2526('0x25')](respondWithResult(_0x5ade4d,null))[_0x2526('0x45')](handleError(_0x5ade4d,null));};exports[_0x2526('0x4a')]=function(_0x296742,_0x41353f){return db['Schedule']['create'](_0x296742['body'],{})[_0x2526('0x25')](function(_0xf09ed){var _0x551771=_0x296742[_0x2526('0x4b')][_0x2526('0x27')]({'plain':!![]});if(!_0x551771)throw new Error(_0x2526('0x4c'));if(_0x551771[_0x2526('0x4d')]==='user'){var _0x2a7498=_0xf09ed[_0x2526('0x27')]({'plain':!![]});var _0x493968=_0x2526('0x28');return db[_0x2526('0x4e')][_0x2526('0x49')]({'where':{'name':_0x493968,'userProfileId':_0x551771[_0x2526('0x4f')]},'raw':!![]})[_0x2526('0x25')](function(_0x5bd270){if(_0x5bd270&&_0x5bd270[_0x2526('0x50')]===0x0){return db[_0x2526('0x29')][_0x2526('0x4a')]({'name':_0x2a7498[_0x2526('0x2b')],'resourceId':_0x2a7498['id'],'type':_0x5bd270['name'],'sectionId':_0x5bd270['id']},{})[_0x2526('0x25')](function(){return _0xf09ed;});}else{return _0xf09ed;}})[_0x2526('0x45')](function(_0x17b84a){logger[_0x2526('0x51')](_0x2526('0x52'),_0x17b84a);throw _0x17b84a;});}return _0xf09ed;})['then'](respondWithResult(_0x41353f,0xc9))[_0x2526('0x45')](handleError(_0x41353f,null));};exports['update']=function(_0x39ceee,_0x5a31f8){if(_0x39ceee[_0x2526('0x53')]['id']){delete _0x39ceee['body']['id'];}return db['Schedule'][_0x2526('0x49')]({'where':{'id':_0x39ceee[_0x2526('0x47')]['id']}})[_0x2526('0x25')](handleEntityNotFound(_0x5a31f8,null))[_0x2526('0x25')](saveUpdates(_0x39ceee[_0x2526('0x53')],null))[_0x2526('0x25')](respondWithResult(_0x5a31f8,null))[_0x2526('0x45')](handleError(_0x5a31f8,null));};exports[_0x2526('0x26')]=function(_0xbe1a74,_0x318f62){return db[_0x2526('0x2f')]['find']({'where':{'id':_0xbe1a74[_0x2526('0x47')]['id']}})[_0x2526('0x25')](handleEntityNotFound(_0x318f62,null))[_0x2526('0x25')](removeEntity(_0x318f62,null))['catch'](handleError(_0x318f62,null));};exports[_0x2526('0x54')]=function(_0x1ac036,_0x51d946,_0x4ba3fd){var _0x889d95=require(_0x2526('0x55'));return db[_0x2526('0x2f')][_0x2526('0x49')]({'where':{'id':_0x1ac036[_0x2526('0x47')]['id']},'raw':!![]})[_0x2526('0x25')](handleEntityNotFound(_0x51d946,null))[_0x2526('0x25')](function(){_0x889d95[_0x2526('0x54')](_0x1ac036[_0x2526('0x47')]['id']);})['then'](respondWithStatusCode(_0x51d946,null))[_0x2526('0x45')](handleError(_0x51d946,null));}; \ No newline at end of file +var _0x5229=['count','offset','limit','set','Content-Range','apply','reject','save','then','destroy','Scheduler','UserProfileResource','stack','name','send','index','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','map','VIRTUAL','merge','options','Schedule','includeAll','include','findAll','rows','catch','params','find','create','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','body','../../config/schedule','run','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','sendStatus','status','end','json'];(function(_0x52c0a2,_0x57edc9){var _0x3824bd=function(_0x17f8c4){while(--_0x17f8c4){_0x52c0a2['push'](_0x52c0a2['shift']());}};_0x3824bd(++_0x57edc9);}(_0x5229,0x1de));var _0x9522=function(_0x2cfc7d,_0x5a7577){_0x2cfc7d=_0x2cfc7d-0x0;var _0x2dced9=_0x5229[_0x2cfc7d];return _0x2dced9;};'use strict';var pdf=require(_0x9522('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x9522('0x1'));var zipdir=require(_0x9522('0x2'));var jsonpatch=require(_0x9522('0x3'));var rp=require(_0x9522('0x4'));var moment=require(_0x9522('0x5'));var BPromise=require(_0x9522('0x6'));var Mustache=require('mustache');var util=require(_0x9522('0x7'));var path=require('path');var sox=require(_0x9522('0x8'));var csv=require(_0x9522('0x9'));var ejs=require(_0x9522('0xa'));var fs=require('fs');var _=require(_0x9522('0xb'));var squel=require(_0x9522('0xc'));var crypto=require('crypto');var jsforce=require(_0x9522('0xd'));var deskjs=require(_0x9522('0xe'));var toCsv=require(_0x9522('0x9'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x9522('0xf'));var authService=require(_0x9522('0x10'));var qs=require(_0x9522('0x11'));var as=require(_0x9522('0x12'));var hardwareService=require(_0x9522('0x13'));var logger=require(_0x9522('0x14'))(_0x9522('0x15'));var utils=require('../../config/utils');var config=require('../../config/environment');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x57c17f,_0x157559){_0x157559=_0x157559||0xcc;return function(_0x23d199){if(_0x23d199){return _0x57c17f[_0x9522('0x16')](_0x157559);}return _0x57c17f[_0x9522('0x17')](_0x157559)[_0x9522('0x18')]();};}function respondWithResult(_0x2f9fa4,_0x570428){_0x570428=_0x570428||0xc8;return function(_0x58ded0){if(_0x58ded0){return _0x2f9fa4[_0x9522('0x17')](_0x570428)[_0x9522('0x19')](_0x58ded0);}};}function respondWithFilteredResult(_0x44086a,_0x59b0cb){return function(_0x5e6647){if(_0x5e6647){var _0x46b5f1=_0x5e6647[_0x9522('0x1a')],_0x4accdd=_0x59b0cb[_0x9522('0x1b')],_0x273007=_0x59b0cb[_0x9522('0x1b')]+_0x59b0cb[_0x9522('0x1c')],_0x4f1e28;if(_0x273007>=_0x46b5f1){_0x273007=_0x46b5f1;_0x4f1e28=0xc8;}else{_0x4f1e28=0xce;}_0x44086a[_0x9522('0x17')](_0x4f1e28);return _0x44086a[_0x9522('0x1d')](_0x9522('0x1e'),_0x4accdd+'-'+_0x273007+'/'+_0x46b5f1)[_0x9522('0x19')](_0x5e6647);}return null;};}function patchUpdates(_0x2107f5){return function(_0xdc931d){try{jsonpatch[_0x9522('0x1f')](_0xdc931d,_0x2107f5,!![]);}catch(_0x416794){return BPromise[_0x9522('0x20')](_0x416794);}return _0xdc931d[_0x9522('0x21')]();};}function saveUpdates(_0x6b77b8,_0x528ead){return function(_0x122458){if(_0x122458){return _0x122458['update'](_0x6b77b8)[_0x9522('0x22')](function(_0x115ce4){return _0x115ce4;});}return null;};}function removeEntity(_0x5c2744,_0x505453){return function(_0x4d6133){if(_0x4d6133){return _0x4d6133[_0x9522('0x23')]()[_0x9522('0x22')](function(){var _0x19bc2f=_0x4d6133['get']({'plain':!![]});var _0x29a2d7=_0x9522('0x24');return db[_0x9522('0x25')][_0x9522('0x23')]({'where':{'type':_0x29a2d7,'resourceId':_0x19bc2f['id']}})[_0x9522('0x22')](function(){return _0x4d6133;});})['then'](function(){_0x5c2744[_0x9522('0x17')](0xcc)[_0x9522('0x18')]();});}};}function handleEntityNotFound(_0x241f17,_0x426cd0){return function(_0x44b034){if(!_0x44b034){_0x241f17['sendStatus'](0x194);}return _0x44b034;};}function handleError(_0x2d9c7b,_0x24a29e){_0x24a29e=_0x24a29e||0x1f4;return function(_0x390d66){logger['error'](_0x390d66[_0x9522('0x26')]);if(_0x390d66[_0x9522('0x27')]){delete _0x390d66[_0x9522('0x27')];}_0x2d9c7b[_0x9522('0x17')](_0x24a29e)[_0x9522('0x28')](_0x390d66);};}exports[_0x9522('0x29')]=function(_0x16b1d5,_0x23c281){var _0x3277de={},_0x34e366={},_0x59e49d={'count':0x0,'rows':[]};var _0x2b72ab=_['map'](db['Schedule'][_0x9522('0x2a')],function(_0x646a9f){return{'name':_0x646a9f[_0x9522('0x2b')],'type':_0x646a9f[_0x9522('0x2c')][_0x9522('0x2d')]};});_0x34e366[_0x9522('0x2e')]=_['map'](_0x2b72ab,_0x9522('0x27'));_0x34e366['query']=_[_0x9522('0x2f')](_0x16b1d5[_0x9522('0x30')]);_0x34e366[_0x9522('0x31')]=_[_0x9522('0x32')](_0x34e366[_0x9522('0x2e')],_0x34e366[_0x9522('0x30')]);_0x3277de[_0x9522('0x33')]=_['intersection'](_0x34e366[_0x9522('0x2e')],qs[_0x9522('0x34')](_0x16b1d5[_0x9522('0x30')]['fields']));_0x3277de[_0x9522('0x33')]=_0x3277de[_0x9522('0x33')]['length']?_0x3277de[_0x9522('0x33')]:_0x34e366[_0x9522('0x2e')];if(!_0x16b1d5['query'][_0x9522('0x35')](_0x9522('0x36'))){_0x3277de['limit']=qs[_0x9522('0x1c')](_0x16b1d5[_0x9522('0x30')][_0x9522('0x1c')]);_0x3277de[_0x9522('0x1b')]=qs[_0x9522('0x1b')](_0x16b1d5['query'][_0x9522('0x1b')]);}_0x3277de[_0x9522('0x37')]=qs[_0x9522('0x38')](_0x16b1d5[_0x9522('0x30')][_0x9522('0x38')]);_0x3277de[_0x9522('0x39')]=qs['filters'](_[_0x9522('0x3a')](_0x16b1d5['query'],_0x34e366['filters']),_0x2b72ab);if(_0x16b1d5[_0x9522('0x30')][_0x9522('0x3b')]){_0x3277de['where']=_['merge'](_0x3277de[_0x9522('0x39')],{'$or':_[_0x9522('0x3c')](_0x2b72ab,function(_0x585946){if(_0x585946[_0x9522('0x2c')]!==_0x9522('0x3d')){var _0x4a640e={};_0x4a640e[_0x585946[_0x9522('0x27')]]={'$like':'%'+_0x16b1d5[_0x9522('0x30')]['filter']+'%'};return _0x4a640e;}})});}_0x3277de=_[_0x9522('0x3e')]({},_0x3277de,_0x16b1d5[_0x9522('0x3f')]);var _0x7c55a1={'where':_0x3277de[_0x9522('0x39')]};return db[_0x9522('0x40')][_0x9522('0x1a')](_0x7c55a1)['then'](function(_0x10f628){_0x59e49d[_0x9522('0x1a')]=_0x10f628;if(_0x16b1d5['query'][_0x9522('0x41')]){_0x3277de[_0x9522('0x42')]=[{'all':!![]}];}return db['Schedule'][_0x9522('0x43')](_0x3277de);})[_0x9522('0x22')](function(_0x2fd2ae){_0x59e49d[_0x9522('0x44')]=_0x2fd2ae;return _0x59e49d;})[_0x9522('0x22')](respondWithFilteredResult(_0x23c281,_0x3277de))[_0x9522('0x45')](handleError(_0x23c281,null));};exports['show']=function(_0x44ca08,_0x2ea574){var _0xe685ea={'raw':![],'where':{'id':_0x44ca08[_0x9522('0x46')]['id']}},_0x13f4e8={};_0x13f4e8['model']=_[_0x9522('0x2f')](db['Schedule'][_0x9522('0x2a')]);_0x13f4e8[_0x9522('0x30')]=_[_0x9522('0x2f')](_0x44ca08[_0x9522('0x30')]);_0x13f4e8[_0x9522('0x31')]=_[_0x9522('0x32')](_0x13f4e8[_0x9522('0x2e')],_0x13f4e8['query']);_0xe685ea[_0x9522('0x33')]=_['intersection'](_0x13f4e8['model'],qs[_0x9522('0x34')](_0x44ca08[_0x9522('0x30')][_0x9522('0x34')]));_0xe685ea[_0x9522('0x33')]=_0xe685ea[_0x9522('0x33')]['length']?_0xe685ea[_0x9522('0x33')]:_0x13f4e8[_0x9522('0x2e')];if(_0x44ca08['query'][_0x9522('0x41')]){_0xe685ea[_0x9522('0x42')]=[{'all':!![]}];}_0xe685ea=_[_0x9522('0x3e')]({},_0xe685ea,_0x44ca08['options']);return db[_0x9522('0x40')][_0x9522('0x47')](_0xe685ea)[_0x9522('0x22')](handleEntityNotFound(_0x2ea574,null))[_0x9522('0x22')](respondWithResult(_0x2ea574,null))['catch'](handleError(_0x2ea574,null));};exports[_0x9522('0x48')]=function(_0x34b649,_0x31a658){return db[_0x9522('0x40')]['create'](_0x34b649['body'],{})[_0x9522('0x22')](function(_0xea086c){var _0x30fe6b=_0x34b649[_0x9522('0x49')][_0x9522('0x4a')]({'plain':!![]});if(!_0x30fe6b)throw new Error(_0x9522('0x4b'));if(_0x30fe6b[_0x9522('0x4c')]==='user'){var _0x2b2048=_0xea086c['get']({'plain':!![]});var _0x4c293d=_0x9522('0x24');return db[_0x9522('0x4d')][_0x9522('0x47')]({'where':{'name':_0x4c293d,'userProfileId':_0x30fe6b['userProfileId']},'raw':!![]})['then'](function(_0x1dde3b){if(_0x1dde3b&&_0x1dde3b['autoAssociation']===0x0){return db[_0x9522('0x25')][_0x9522('0x48')]({'name':_0x2b2048[_0x9522('0x27')],'resourceId':_0x2b2048['id'],'type':_0x1dde3b[_0x9522('0x27')],'sectionId':_0x1dde3b['id']},{})[_0x9522('0x22')](function(){return _0xea086c;});}else{return _0xea086c;}})[_0x9522('0x45')](function(_0x3c8273){logger[_0x9522('0x4e')](_0x9522('0x4f'),_0x3c8273);throw _0x3c8273;});}return _0xea086c;})[_0x9522('0x22')](respondWithResult(_0x31a658,0xc9))['catch'](handleError(_0x31a658,null));};exports[_0x9522('0x50')]=function(_0xde1f7,_0x1d7128){if(_0xde1f7[_0x9522('0x51')]['id']){delete _0xde1f7[_0x9522('0x51')]['id'];}return db['Schedule']['find']({'where':{'id':_0xde1f7[_0x9522('0x46')]['id']}})[_0x9522('0x22')](handleEntityNotFound(_0x1d7128,null))[_0x9522('0x22')](saveUpdates(_0xde1f7[_0x9522('0x51')],null))[_0x9522('0x22')](respondWithResult(_0x1d7128,null))[_0x9522('0x45')](handleError(_0x1d7128,null));};exports[_0x9522('0x23')]=function(_0x1b56bc,_0x2f41be){return db['Schedule'][_0x9522('0x47')]({'where':{'id':_0x1b56bc[_0x9522('0x46')]['id']}})[_0x9522('0x22')](handleEntityNotFound(_0x2f41be,null))[_0x9522('0x22')](removeEntity(_0x2f41be,null))[_0x9522('0x45')](handleError(_0x2f41be,null));};exports['run']=function(_0x5b7ff4,_0x3af32a,_0xe8943){var _0x1d35c3=require(_0x9522('0x52'));return db[_0x9522('0x40')][_0x9522('0x47')]({'where':{'id':_0x5b7ff4[_0x9522('0x46')]['id']},'raw':!![]})['then'](handleEntityNotFound(_0x3af32a,null))['then'](function(){_0x1d35c3[_0x9522('0x53')](_0x5b7ff4[_0x9522('0x46')]['id']);})[_0x9522('0x22')](respondWithStatusCode(_0x3af32a,null))['catch'](handleError(_0x3af32a,null));}; \ No newline at end of file diff --git a/server/api/schedule/schedule.model.js b/server/api/schedule/schedule.model.js index 54f20c0..217365f 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 _0xcf01=['tools_schedules','lodash','../../config/logger','bluebird','request-promise','./schedule.attributes','define','Schedule'];(function(_0x5442ab,_0x3e4b10){var _0x1be600=function(_0x1ae936){while(--_0x1ae936){_0x5442ab['push'](_0x5442ab['shift']());}};_0x1be600(++_0x3e4b10);}(_0xcf01,0x141));var _0x1cf0=function(_0x4e221e,_0x22329a){_0x4e221e=_0x4e221e-0x0;var _0x2297eb=_0xcf01[_0x4e221e];return _0x2297eb;};'use strict';var _=require(_0x1cf0('0x0'));var util=require('util');var logger=require(_0x1cf0('0x1'))('api');var moment=require('moment');var BPromise=require(_0x1cf0('0x2'));var rp=require(_0x1cf0('0x3'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x1cf0('0x4'));module['exports']=function(_0x5e52e3,_0x2390a9){return _0x5e52e3[_0x1cf0('0x5')](_0x1cf0('0x6'),attributes,{'tableName':_0x1cf0('0x7'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9c3f=['Schedule','tools_schedules','lodash','util','api','bluebird','request-promise','rimraf','../../config/environment','./schedule.attributes','exports','define'];(function(_0xc01d2,_0x29f146){var _0x17f297=function(_0x24703f){while(--_0x24703f){_0xc01d2['push'](_0xc01d2['shift']());}};_0x17f297(++_0x29f146);}(_0x9c3f,0x116));var _0xf9c3=function(_0x403f5a,_0x2a32ec){_0x403f5a=_0x403f5a-0x0;var _0x384bef=_0x9c3f[_0x403f5a];return _0x384bef;};'use strict';var _=require(_0xf9c3('0x0'));var util=require(_0xf9c3('0x1'));var logger=require('../../config/logger')(_0xf9c3('0x2'));var moment=require('moment');var BPromise=require(_0xf9c3('0x3'));var rp=require(_0xf9c3('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xf9c3('0x5'));var config=require(_0xf9c3('0x6'));var attributes=require(_0xf9c3('0x7'));module[_0xf9c3('0x8')]=function(_0x2e1838,_0x63fc71){return _0x2e1838[_0xf9c3('0x9')](_0xf9c3('0xa'),attributes,{'tableName':_0xf9c3('0xb'),'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 e385c73..f4b8eca 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 _0xb564=['result','catch','util','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','Schedule,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message'];(function(_0x49a333,_0xacaf36){var _0x483dd4=function(_0x332e31){while(--_0x332e31){_0x49a333['push'](_0x49a333['shift']());}};_0x483dd4(++_0xacaf36);}(_0xb564,0x13d));var _0x4b56=function(_0x27d750,_0x288159){_0x27d750=_0x27d750-0x0;var _0x3d5934=_0xb564[_0x27d750];return _0x3d5934;};'use strict';var _=require('lodash');var util=require(_0x4b56('0x0'));var moment=require('moment');var BPromise=require(_0x4b56('0x1'));var rs=require(_0x4b56('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x4b56('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x4b56('0x4'))(_0x4b56('0x5'));var config=require(_0x4b56('0x6'));var jayson=require(_0x4b56('0x7'));var client=jayson[_0x4b56('0x8')][_0x4b56('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x30cfda,_0x29fc94,_0x234cdf){return new BPromise(function(_0x47fe30,_0xe2e5dd){return client[_0x4b56('0xa')](_0x30cfda,_0x234cdf)[_0x4b56('0xb')](function(_0x28baee){logger[_0x4b56('0xc')](_0x4b56('0xd'),_0x29fc94,_0x4b56('0xe'));logger[_0x4b56('0xf')]('Schedule,\x20%s,\x20%s,\x20%s',_0x29fc94,'request\x20sent',JSON[_0x4b56('0x10')](_0x28baee));if(_0x28baee[_0x4b56('0x11')]){if(_0x28baee[_0x4b56('0x11')]['code']===0x1f4){logger[_0x4b56('0x11')](_0x4b56('0xd'),_0x29fc94,_0x28baee['error'][_0x4b56('0x12')]);return _0xe2e5dd(_0x28baee[_0x4b56('0x11')][_0x4b56('0x12')]);}logger[_0x4b56('0x11')](_0x4b56('0xd'),_0x29fc94,_0x28baee['error'][_0x4b56('0x12')]);return _0x47fe30(_0x28baee['error'][_0x4b56('0x12')]);}else{logger[_0x4b56('0xc')]('Schedule,\x20%s,\x20%s',_0x29fc94,_0x4b56('0xe'));_0x47fe30(_0x28baee[_0x4b56('0x13')][_0x4b56('0x12')]);}})[_0x4b56('0x14')](function(_0x571226){logger['error'](_0x4b56('0xd'),_0x29fc94,_0x571226);_0xe2e5dd(_0x571226);});});} \ No newline at end of file +var _0x63b8=['Schedule,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','info','Schedule,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x1ce3f6,_0x3b922a){var _0x3a63b7=function(_0x2752f3){while(--_0x2752f3){_0x1ce3f6['push'](_0x1ce3f6['shift']());}};_0x3a63b7(++_0x3b922a);}(_0x63b8,0x99));var _0x863b=function(_0x561f10,_0x581c75){_0x561f10=_0x561f10-0x0;var _0x31150c=_0x63b8[_0x561f10];return _0x31150c;};'use strict';var _=require(_0x863b('0x0'));var util=require(_0x863b('0x1'));var moment=require('moment');var BPromise=require(_0x863b('0x2'));var rs=require(_0x863b('0x3'));var fs=require('fs');var Redis=require(_0x863b('0x4'));var db=require(_0x863b('0x5'))['db'];var utils=require(_0x863b('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0x863b('0x7'));var jayson=require(_0x863b('0x8'));var client=jayson[_0x863b('0x9')][_0x863b('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x58acdb,_0x296ad3,_0x3480db){return new BPromise(function(_0x2dece7,_0x2418ae){return client['request'](_0x58acdb,_0x3480db)['then'](function(_0x173001){logger[_0x863b('0xb')](_0x863b('0xc'),_0x296ad3,_0x863b('0xd'));logger[_0x863b('0xe')](_0x863b('0xf'),_0x296ad3,'request\x20sent',JSON[_0x863b('0x10')](_0x173001));if(_0x173001[_0x863b('0x11')]){if(_0x173001[_0x863b('0x11')][_0x863b('0x12')]===0x1f4){logger[_0x863b('0x11')](_0x863b('0xc'),_0x296ad3,_0x173001['error'][_0x863b('0x13')]);return _0x2418ae(_0x173001[_0x863b('0x11')]['message']);}logger[_0x863b('0x11')](_0x863b('0xc'),_0x296ad3,_0x173001[_0x863b('0x11')][_0x863b('0x13')]);return _0x2dece7(_0x173001['error'][_0x863b('0x13')]);}else{logger[_0x863b('0xb')](_0x863b('0xc'),_0x296ad3,_0x863b('0xd'));_0x2dece7(_0x173001[_0x863b('0x14')]['message']);}})['catch'](function(_0x1421dd){logger[_0x863b('0x11')](_0x863b('0xc'),_0x296ad3,_0x1421dd);_0x2418ae(_0x1421dd);});});} \ No newline at end of file diff --git a/server/api/screenRecording/index.js b/server/api/screenRecording/index.js index 8c323c8..8cd147a 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 _0x3535=['describe','/:id','/:id/download','post','update','destroy','exports','multer','util','Router','./screenRecording.controller','isAuthenticated','index','get','/describe'];(function(_0x54cda0,_0x3bf6e9){var _0x26f2c2=function(_0x18761f){while(--_0x18761f){_0x54cda0['push'](_0x54cda0['shift']());}};_0x26f2c2(++_0x3bf6e9);}(_0x3535,0x9d));var _0x5353=function(_0x424b89,_0x15cef3){_0x424b89=_0x424b89-0x0;var _0x48dc2e=_0x3535[_0x424b89];return _0x48dc2e;};'use strict';var multer=require(_0x5353('0x0'));var util=require(_0x5353('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x5353('0x2')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x5353('0x3'));router['get']('/',auth[_0x5353('0x4')](),controller[_0x5353('0x5')]);router[_0x5353('0x6')](_0x5353('0x7'),auth[_0x5353('0x4')](),controller[_0x5353('0x8')]);router[_0x5353('0x6')](_0x5353('0x9'),auth[_0x5353('0x4')](),controller['show']);router[_0x5353('0x6')](_0x5353('0xa'),auth[_0x5353('0x4')](),controller['download']);router[_0x5353('0xb')]('/',auth[_0x5353('0x4')](),controller['create']);router['put'](_0x5353('0x9'),auth[_0x5353('0x4')](),controller[_0x5353('0xc')]);router['delete'](_0x5353('0x9'),auth[_0x5353('0x4')](),controller[_0x5353('0xd')]);module[_0x5353('0xe')]=router; \ No newline at end of file +var _0x396e=['connect-timeout','express','../../config/environment','./screenRecording.controller','get','/describe','isAuthenticated','describe','/:id','show','/:id/download','download','post','create','update','destroy','exports','multer','util'];(function(_0x1452ac,_0x960b27){var _0x3d0060=function(_0x48de7b){while(--_0x48de7b){_0x1452ac['push'](_0x1452ac['shift']());}};_0x3d0060(++_0x960b27);}(_0x396e,0xcf));var _0xe396=function(_0x11db1b,_0x46f212){_0x11db1b=_0x11db1b-0x0;var _0x36394b=_0x396e[_0x11db1b];return _0x36394b;};'use strict';var multer=require(_0xe396('0x0'));var util=require(_0xe396('0x1'));var path=require('path');var timeout=require(_0xe396('0x2'));var express=require(_0xe396('0x3'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xe396('0x4'));var controller=require(_0xe396('0x5'));router[_0xe396('0x6')]('/',auth['isAuthenticated'](),controller['index']);router[_0xe396('0x6')](_0xe396('0x7'),auth[_0xe396('0x8')](),controller[_0xe396('0x9')]);router[_0xe396('0x6')](_0xe396('0xa'),auth[_0xe396('0x8')](),controller[_0xe396('0xb')]);router['get'](_0xe396('0xc'),auth[_0xe396('0x8')](),controller[_0xe396('0xd')]);router[_0xe396('0xe')]('/',auth[_0xe396('0x8')](),controller[_0xe396('0xf')]);router['put'](_0xe396('0xa'),auth['isAuthenticated'](),controller[_0xe396('0x10')]);router['delete']('/:id',auth[_0xe396('0x8')](),controller[_0xe396('0x11')]);module[_0xe396('0x12')]=router; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.attributes.js b/server/api/screenRecording/screenRecording.attributes.js index 6ec2224..070d21f 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 _0x17ba=['MM-DD-YYYY\x20HH:mm','toString','createdAt','sequelize','moment','../../config/environment','exports','VIRTUAL','getDataValue','value','extname','STRING','replace','setDataValue','INTEGER','startedAt','subtract','closedAt','duration','DATE','format'];(function(_0x26e949,_0x4de8bc){var _0x33cd65=function(_0x4a001b){while(--_0x4a001b){_0x26e949['push'](_0x26e949['shift']());}};_0x33cd65(++_0x4de8bc);}(_0x17ba,0xab));var _0xa17b=function(_0x5f39f8,_0x5f24cb){_0x5f39f8=_0x5f39f8-0x0;var _0x567915=_0x17ba[_0x5f39f8];return _0x567915;};'use strict';var Sequelize=require(_0xa17b('0x0'));var moment=require(_0xa17b('0x1'));var path=require('path');var config=require(_0xa17b('0x2'));module[_0xa17b('0x3')]={'format':{'type':Sequelize[_0xa17b('0x4')],'get':function(){return this[_0xa17b('0x5')](_0xa17b('0x6'))?path[_0xa17b('0x7')](this[_0xa17b('0x5')](_0xa17b('0x6'))):undefined;}},'interactionid':{'type':Sequelize[_0xa17b('0x8')]},'channel':{'type':Sequelize[_0xa17b('0x8')]},'value':{'type':Sequelize[_0xa17b('0x8')],'set':function(_0x2e3d43){var _0x1957be=_0x2e3d43[_0xa17b('0x9')](/\\/g,'/');this[_0xa17b('0xa')](_0xa17b('0x6'),_0x1957be);}},'rating':{'type':Sequelize[_0xa17b('0xb')],'validate':{'max':0x5,'min':0x0}},'duration':{'type':Sequelize[_0xa17b('0xb')],'set':function(_0x15bdfc){this['setDataValue'](_0xa17b('0xc'),moment()[_0xa17b('0xd')](_0x15bdfc,'ms'));this[_0xa17b('0xa')](_0xa17b('0xe'),moment());this[_0xa17b('0xa')](_0xa17b('0xf'),_0x15bdfc);}},'startedAt':{'type':Sequelize[_0xa17b('0x10')],'get':function(){return moment(this['getDataValue'](_0xa17b('0xc')))[_0xa17b('0x11')](_0xa17b('0x12'))['toString']();}},'closedAt':{'type':Sequelize[_0xa17b('0x10')],'get':function(){return moment(this[_0xa17b('0x5')](_0xa17b('0xe')))[_0xa17b('0x11')]('MM-DD-YYYY\x20HH:mm')[_0xa17b('0x13')]();}},'createdAt':{'type':Sequelize['DATE'],'get':function(){return moment(this[_0xa17b('0x5')](_0xa17b('0x14')))['format'](_0xa17b('0x12'))[_0xa17b('0x13')]();}},'updatedAt':{'type':Sequelize[_0xa17b('0x10')],'get':function(){return moment(this[_0xa17b('0x5')]('updatedAt'))[_0xa17b('0x11')]('MM-DD-YYYY\x20HH:mm')['toString']();}}}; \ No newline at end of file +var _0x4b84=['createdAt','sequelize','moment','exports','value','extname','getDataValue','STRING','setDataValue','INTEGER','subtract','closedAt','duration','DATE','format','MM-DD-YYYY\x20HH:mm','toString'];(function(_0x3fbb10,_0x15e109){var _0x3d063c=function(_0x2ed91f){while(--_0x2ed91f){_0x3fbb10['push'](_0x3fbb10['shift']());}};_0x3d063c(++_0x15e109);}(_0x4b84,0x1cc));var _0x44b8=function(_0x350aeb,_0x3d265a){_0x350aeb=_0x350aeb-0x0;var _0x3c5273=_0x4b84[_0x350aeb];return _0x3c5273;};'use strict';var Sequelize=require(_0x44b8('0x0'));var moment=require(_0x44b8('0x1'));var path=require('path');var config=require('../../config/environment');module[_0x44b8('0x2')]={'format':{'type':Sequelize['VIRTUAL'],'get':function(){return this['getDataValue'](_0x44b8('0x3'))?path[_0x44b8('0x4')](this[_0x44b8('0x5')]('value')):undefined;}},'interactionid':{'type':Sequelize['STRING']},'channel':{'type':Sequelize['STRING']},'value':{'type':Sequelize[_0x44b8('0x6')],'set':function(_0x54274b){var _0x327f59=_0x54274b['replace'](/\\/g,'/');this[_0x44b8('0x7')]('value',_0x327f59);}},'rating':{'type':Sequelize['INTEGER'],'validate':{'max':0x5,'min':0x0}},'duration':{'type':Sequelize[_0x44b8('0x8')],'set':function(_0x42319d){this[_0x44b8('0x7')]('startedAt',moment()[_0x44b8('0x9')](_0x42319d,'ms'));this[_0x44b8('0x7')](_0x44b8('0xa'),moment());this[_0x44b8('0x7')](_0x44b8('0xb'),_0x42319d);}},'startedAt':{'type':Sequelize[_0x44b8('0xc')],'get':function(){return moment(this[_0x44b8('0x5')]('startedAt'))[_0x44b8('0xd')](_0x44b8('0xe'))['toString']();}},'closedAt':{'type':Sequelize[_0x44b8('0xc')],'get':function(){return moment(this['getDataValue'](_0x44b8('0xa')))[_0x44b8('0xd')]('MM-DD-YYYY\x20HH:mm')[_0x44b8('0xf')]();}},'createdAt':{'type':Sequelize['DATE'],'get':function(){return moment(this['getDataValue'](_0x44b8('0x10')))[_0x44b8('0xd')](_0x44b8('0xe'))[_0x44b8('0xf')]();}},'updatedAt':{'type':Sequelize['DATE'],'get':function(){return moment(this['getDataValue']('updatedAt'))[_0x44b8('0xd')]('MM-DD-YYYY\x20HH:mm')[_0x44b8('0xf')]();}}}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.controller.js b/server/api/screenRecording/screenRecording.controller.js index a7fd7ff..52993da 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 _0x035c=['name','send','index','map','ScreenRecording','fieldName','type','key','model','format','keys','query','filters','intersection','attributes','fields','length','limit','sort','where','pick','filter','merge','VIRTUAL','options','count','includeAll','findAll','show','params','rawAttributes','include','catch','create','body','duration','createdAt','closedAt','value','find','describe','download','../../components/encryptor','uniqueid','join','server/files/screen_recordings','decryptFile','secrets','root','existsSync','Sequelize','ScreenRecording\x20not\x20found','filename','extname','unlink','message','Not\x20found','Entity\x20not\x20found','info','cancellazione\x20fisica\x20documento\x20%s','isNil','File:\x20\x22','unlinkSync','.cypher','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','Content-Range','apply','reject','save','update','then','error','stack'];(function(_0x4176da,_0x4ff6a2){var _0x10d01d=function(_0xa75ce1){while(--_0xa75ce1){_0x4176da['push'](_0x4176da['shift']());}};_0x10d01d(++_0x4ff6a2);}(_0x035c,0xa8));var _0xc035=function(_0x3a40d2,_0xbccdd1){_0x3a40d2=_0x3a40d2-0x0;var _0x97209b=_0x035c[_0x3a40d2];return _0x97209b;};'use strict';var pdf=require(_0xc035('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xc035('0x1'));var zipdir=require(_0xc035('0x2'));var jsonpatch=require(_0xc035('0x3'));var rp=require(_0xc035('0x4'));var moment=require(_0xc035('0x5'));var BPromise=require(_0xc035('0x6'));var Mustache=require(_0xc035('0x7'));var util=require(_0xc035('0x8'));var path=require(_0xc035('0x9'));var sox=require('sox');var csv=require(_0xc035('0xa'));var ejs=require(_0xc035('0xb'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0xc035('0xc'));var jsforce=require(_0xc035('0xd'));var deskjs=require(_0xc035('0xe'));var toCsv=require(_0xc035('0xa'));var querystring=require(_0xc035('0xf'));var Papa=require(_0xc035('0x10'));var Redis=require(_0xc035('0x11'));var authService=require(_0xc035('0x12'));var qs=require(_0xc035('0x13'));var as=require(_0xc035('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xc035('0x15'))('api');var utils=require(_0xc035('0x16'));var config=require(_0xc035('0x17'));var db=require(_0xc035('0x18'))['db'];function respondWithStatusCode(_0x4ae8dd,_0x63a5cf){_0x63a5cf=_0x63a5cf||0xcc;return function(_0xab2ae4){if(_0xab2ae4){return _0x4ae8dd[_0xc035('0x19')](_0x63a5cf);}return _0x4ae8dd[_0xc035('0x1a')](_0x63a5cf)[_0xc035('0x1b')]();};}function respondWithResult(_0x1c822a,_0x341c84){_0x341c84=_0x341c84||0xc8;return function(_0x4d18a1){if(_0x4d18a1){return _0x1c822a[_0xc035('0x1a')](_0x341c84)[_0xc035('0x1c')](_0x4d18a1);}};}function respondWithFilteredResult(_0x14ae35,_0x4c8d79){return function(_0x4d9913){if(_0x4d9913){var _0x4ec5ab=_0x4d9913['count'],_0x3fb8b5=_0x4c8d79[_0xc035('0x1d')],_0x57cf2a=_0x4c8d79[_0xc035('0x1d')]+_0x4c8d79['limit'],_0x581a1d;if(_0x57cf2a>=_0x4ec5ab){_0x57cf2a=_0x4ec5ab;_0x581a1d=0xc8;}else{_0x581a1d=0xce;}_0x14ae35[_0xc035('0x1a')](_0x581a1d);return _0x14ae35['set'](_0xc035('0x1e'),_0x3fb8b5+'-'+_0x57cf2a+'/'+_0x4ec5ab)[_0xc035('0x1c')](_0x4d9913);}return null;};}function patchUpdates(_0x1a8017){return function(_0x49721d){try{jsonpatch[_0xc035('0x1f')](_0x49721d,_0x1a8017,!![]);}catch(_0x3b7df8){return BPromise[_0xc035('0x20')](_0x3b7df8);}return _0x49721d[_0xc035('0x21')]();};}function saveUpdates(_0x8a7387,_0x2ca2b9){return function(_0x2d1533){if(_0x2d1533){return _0x2d1533[_0xc035('0x22')](_0x8a7387)[_0xc035('0x23')](function(_0x12a737){return _0x12a737;});}return null;};}function removeEntity(_0x28cfab,_0x51d35f){return function(_0x50624e){if(_0x50624e){return _0x50624e['destroy']()[_0xc035('0x23')](function(){_0x28cfab[_0xc035('0x1a')](0xcc)[_0xc035('0x1b')]();});}};}function handleEntityNotFound(_0x3999c9,_0xc2b31a){return function(_0x4394dd){if(!_0x4394dd){_0x3999c9['sendStatus'](0x194);}return _0x4394dd;};}function handleError(_0x3597c3,_0x3e68cb){_0x3e68cb=_0x3e68cb||0x1f4;return function(_0x37af17){logger[_0xc035('0x24')](_0x37af17[_0xc035('0x25')]);if(_0x37af17[_0xc035('0x26')]){delete _0x37af17[_0xc035('0x26')];}_0x3597c3[_0xc035('0x1a')](_0x3e68cb)[_0xc035('0x27')](_0x37af17);};}exports[_0xc035('0x28')]=function(_0x326214,_0xf9ef4e){var _0x575e96={},_0x168d3e={},_0x390321={'count':0x0,'rows':[]};var _0x41dcc8=_[_0xc035('0x29')](db[_0xc035('0x2a')]['rawAttributes'],function(_0x162573){return{'name':_0x162573[_0xc035('0x2b')],'type':_0x162573[_0xc035('0x2c')][_0xc035('0x2d')]};});_0x168d3e[_0xc035('0x2e')]=_['differenceBy'](_[_0xc035('0x29')](_0x41dcc8,'name'),[_0xc035('0x2f')]);_0x168d3e['query']=_[_0xc035('0x30')](_0x326214[_0xc035('0x31')]);_0x168d3e[_0xc035('0x32')]=_[_0xc035('0x33')](_0x168d3e[_0xc035('0x2e')],_0x168d3e['query']);_0x575e96[_0xc035('0x34')]=_['intersection'](_0x168d3e[_0xc035('0x2e')],qs[_0xc035('0x35')](_0x326214['query'][_0xc035('0x35')]));_0x575e96[_0xc035('0x34')]=_0x575e96[_0xc035('0x34')][_0xc035('0x36')]?_0x575e96[_0xc035('0x34')]:_0x168d3e[_0xc035('0x2e')];if(!_0x326214[_0xc035('0x31')]['hasOwnProperty']('nolimit')){_0x575e96[_0xc035('0x37')]=qs['limit'](_0x326214[_0xc035('0x31')][_0xc035('0x37')]);_0x575e96['offset']=qs[_0xc035('0x1d')](_0x326214['query']['offset']);}_0x575e96['order']=qs[_0xc035('0x38')](_0x326214[_0xc035('0x31')][_0xc035('0x38')]);_0x575e96[_0xc035('0x39')]=qs[_0xc035('0x32')](_[_0xc035('0x3a')](_0x326214[_0xc035('0x31')],_0x168d3e[_0xc035('0x32')]),_0x41dcc8);if(_0x326214[_0xc035('0x31')][_0xc035('0x3b')]){_0x575e96[_0xc035('0x39')]=_[_0xc035('0x3c')](_0x575e96[_0xc035('0x39')],{'$or':_[_0xc035('0x29')](_0x41dcc8,function(_0x482e71){if(_0x482e71[_0xc035('0x2c')]!==_0xc035('0x3d')){var _0x2890cb={};_0x2890cb[_0x482e71[_0xc035('0x26')]]={'$like':'%'+_0x326214[_0xc035('0x31')][_0xc035('0x3b')]+'%'};return _0x2890cb;}})});}_0x575e96=_[_0xc035('0x3c')]({},_0x575e96,_0x326214[_0xc035('0x3e')]);var _0xa7a171={'where':_0x575e96[_0xc035('0x39')]};return db[_0xc035('0x2a')][_0xc035('0x3f')](_0xa7a171)[_0xc035('0x23')](function(_0x729b7){_0x390321[_0xc035('0x3f')]=_0x729b7;if(_0x326214['query'][_0xc035('0x40')]){_0x575e96['include']=[{'all':!![]}];}return db['ScreenRecording'][_0xc035('0x41')](_0x575e96);})[_0xc035('0x23')](function(_0xdcef81){_0x390321['rows']=_0xdcef81;return _0x390321;})[_0xc035('0x23')](respondWithFilteredResult(_0xf9ef4e,_0x575e96))['catch'](handleError(_0xf9ef4e,null));};exports[_0xc035('0x42')]=function(_0x32af12,_0xd0583){var _0x1fb7cd={'raw':![],'where':{'id':_0x32af12[_0xc035('0x43')]['id']}},_0x5477a4={};_0x5477a4[_0xc035('0x2e')]=_[_0xc035('0x30')](db[_0xc035('0x2a')][_0xc035('0x44')]);_0x5477a4['query']=_[_0xc035('0x30')](_0x32af12[_0xc035('0x31')]);_0x5477a4[_0xc035('0x32')]=_[_0xc035('0x33')](_0x5477a4['model'],_0x5477a4[_0xc035('0x31')]);_0x1fb7cd['attributes']=_[_0xc035('0x33')](_0x5477a4[_0xc035('0x2e')],qs['fields'](_0x32af12[_0xc035('0x31')][_0xc035('0x35')]));_0x1fb7cd[_0xc035('0x34')]=_0x1fb7cd[_0xc035('0x34')][_0xc035('0x36')]?_0x1fb7cd[_0xc035('0x34')]:_0x5477a4[_0xc035('0x2e')];if(_0x32af12[_0xc035('0x31')][_0xc035('0x40')]){_0x1fb7cd[_0xc035('0x45')]=[{'all':!![]}];}_0x1fb7cd=_[_0xc035('0x3c')]({},_0x1fb7cd,_0x32af12[_0xc035('0x3e')]);return db[_0xc035('0x2a')]['find'](_0x1fb7cd)[_0xc035('0x23')](handleEntityNotFound(_0xd0583,null))['then'](respondWithResult(_0xd0583,null))[_0xc035('0x46')](handleError(_0xd0583,null));};exports[_0xc035('0x47')]=function(_0x4691c0,_0x18749b){return db[_0xc035('0x2a')]['create'](_0x4691c0[_0xc035('0x48')],{})[_0xc035('0x23')](respondWithResult(_0x18749b,0xc9))['catch'](handleError(_0x18749b,null));};exports[_0xc035('0x22')]=function(_0x1a68d9,_0x219c51){if(_0x1a68d9[_0xc035('0x48')]['id']){delete _0x1a68d9[_0xc035('0x48')]['id'];}delete _0x1a68d9['body'][_0xc035('0x49')];delete _0x1a68d9[_0xc035('0x48')][_0xc035('0x4a')];delete _0x1a68d9['body'][_0xc035('0x4b')];delete _0x1a68d9['body'][_0xc035('0x4c')];return db[_0xc035('0x2a')][_0xc035('0x4d')]({'where':{'id':_0x1a68d9[_0xc035('0x43')]['id']}})[_0xc035('0x23')](handleEntityNotFound(_0x219c51,null))[_0xc035('0x23')](saveUpdates(_0x1a68d9[_0xc035('0x48')],null))[_0xc035('0x23')](respondWithResult(_0x219c51,null))[_0xc035('0x46')](handleError(_0x219c51,null));};exports[_0xc035('0x4e')]=function(_0x1f7321,_0x14d4d3){return db['ScreenRecording'][_0xc035('0x4e')]()[_0xc035('0x23')](respondWithResult(_0x14d4d3,null))[_0xc035('0x46')](handleError(_0x14d4d3,null));};exports[_0xc035('0x4f')]=function(_0x487dfb,_0x1b1e58,_0x3592aa){var _0x35bf30=require(_0xc035('0x50'));var _0x91ea8b=![];var _0x55d005={};if(_0x487dfb[_0xc035('0x31')][_0xc035('0x2c')]&&_0x487dfb[_0xc035('0x31')][_0xc035('0x2c')]===_0xc035('0x51')){_0x55d005[_0xc035('0x51')]=_0x487dfb[_0xc035('0x43')]['id'];}else{_0x55d005['id']=_0x487dfb[_0xc035('0x43')]['id'];}return db[_0xc035('0x2a')][_0xc035('0x4d')]({'where':_0x55d005,'attributes':['id',_0xc035('0x4c')],'raw':!![]})[_0xc035('0x23')](handleEntityNotFound(_0x1b1e58,null))[_0xc035('0x23')](function(_0x42a48d){if(_0x42a48d){var _0x36dc5e=path[_0xc035('0x52')](config['root'],_0xc035('0x53'),_0x42a48d['value']);var _0x583d7f=util['format']('%s.cypher',_0x36dc5e);if(fs['existsSync'](_0x583d7f)){_0x91ea8b=!![];return _0x35bf30[_0xc035('0x54')](_0x583d7f,_0x36dc5e,config[_0xc035('0x55')]['recording'])[_0xc035('0x23')](function(){return _0x42a48d;});}return _0x42a48d;}})[_0xc035('0x23')](function(_0x4102fa){if(_0x4102fa){var _0x1553a9=path['join'](config[_0xc035('0x56')],_0xc035('0x53'),_0x4102fa[_0xc035('0x4c')]);if(!fs[_0xc035('0x57')](_0x1553a9)){throw new db[(_0xc035('0x58'))]['ValidationError'](_0xc035('0x59'));}if(_0x4102fa[_0xc035('0x5a')]){return _0x1b1e58[_0xc035('0x4f')](_0x1553a9,_0x4102fa[_0xc035('0x5a')]+path[_0xc035('0x5b')](_0x1553a9),function(){if(_0x91ea8b){fs[_0xc035('0x5c')](_0x1553a9);}});}else{return _0x1b1e58[_0xc035('0x4f')](_0x1553a9,function(_0x2f078d){if(_0x91ea8b){fs[_0xc035('0x5c')](_0x1553a9);}});}}})[_0xc035('0x46')](function(_0x504676){if(_0x504676[_0xc035('0x5d')]===_0xc035('0x59')){_0x1b1e58[_0xc035('0x1a')](0x194)['send'](_0xc035('0x5e'));}else{return handleError(_0x1b1e58,null);}});};exports['destroy']=function(_0x35d638,_0x126ba6){return db[_0xc035('0x2a')][_0xc035('0x4d')]({'where':{'id':_0x35d638[_0xc035('0x43')]['id']}})[_0xc035('0x23')](function(_0x169c86){if(!_0x169c86)throw new ReferenceError(_0xc035('0x5f'));return _0x169c86;})[_0xc035('0x23')](function(_0x43f64e){var _0x5b46d8=path['join'](config['root'],_0xc035('0x53'),_0x43f64e[_0xc035('0x4c')]);logger[_0xc035('0x60')](_0xc035('0x61'),_0x5b46d8);if(!_[_0xc035('0x62')](_0x43f64e[_0xc035('0x4c')])&&fs[_0xc035('0x57')](_0x5b46d8)){logger[_0xc035('0x60')](_0xc035('0x63')+_0x5b46d8+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs[_0xc035('0x64')](_0x5b46d8);}_0x5b46d8=_0x5b46d8+_0xc035('0x65');if(!_['isNil'](_0x43f64e[_0xc035('0x4c')])&&fs[_0xc035('0x57')](_0x5b46d8)){logger['info'](_0xc035('0x63')+_0x5b46d8+_0xc035('0x66'));fs[_0xc035('0x64')](_0x5b46d8);}return _0x43f64e;})['then'](function(_0x255a32){if(!_0x255a32)throw new InternalError();return _0x255a32['destroy']();})[_0xc035('0x23')](function(){_0x126ba6[_0xc035('0x1a')](0xcc)[_0xc035('0x1b')]();})[_0xc035('0x46')](handleError(_0x126ba6,null));}; \ No newline at end of file +var _0xeb5d=['format','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','offset','order','sort','where','pick','filter','merge','type','VIRTUAL','include','findAll','catch','show','params','includeAll','options','find','body','duration','createdAt','closedAt','describe','download','uniqueid','value','join','root','decryptFile','secrets','recording','server/files/screen_recordings','existsSync','Sequelize','ValidationError','ScreenRecording\x20not\x20found','filename','extname','unlink','Entity\x20not\x20found','info','isNil','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','.cypher','eml-format','rimraf','zip-dir','fast-json-patch','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','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status','json','count','limit','set','Content-Range','reject','save','update','then','destroy','error','stack','name','send','index','ScreenRecording','fieldName','model','differenceBy','map'];(function(_0x37fd56,_0x1528a7){var _0x22adc8=function(_0x4d87ab){while(--_0x4d87ab){_0x37fd56['push'](_0x37fd56['shift']());}};_0x22adc8(++_0x1528a7);}(_0xeb5d,0x16b));var _0xdeb5=function(_0x4e676e,_0x2a7c6d){_0x4e676e=_0x4e676e-0x0;var _0x336a3c=_0xeb5d[_0x4e676e];return _0x336a3c;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xdeb5('0x0'));var rimraf=require(_0xdeb5('0x1'));var zipdir=require(_0xdeb5('0x2'));var jsonpatch=require(_0xdeb5('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xdeb5('0x4'));var Mustache=require(_0xdeb5('0x5'));var util=require('util');var path=require(_0xdeb5('0x6'));var sox=require(_0xdeb5('0x7'));var csv=require(_0xdeb5('0x8'));var ejs=require(_0xdeb5('0x9'));var fs=require('fs');var _=require(_0xdeb5('0xa'));var squel=require(_0xdeb5('0xb'));var crypto=require(_0xdeb5('0xc'));var jsforce=require(_0xdeb5('0xd'));var deskjs=require(_0xdeb5('0xe'));var toCsv=require(_0xdeb5('0x8'));var querystring=require(_0xdeb5('0xf'));var Papa=require(_0xdeb5('0x10'));var Redis=require(_0xdeb5('0x11'));var authService=require(_0xdeb5('0x12'));var qs=require(_0xdeb5('0x13'));var as=require(_0xdeb5('0x14'));var hardwareService=require(_0xdeb5('0x15'));var logger=require('../../config/logger')(_0xdeb5('0x16'));var utils=require(_0xdeb5('0x17'));var config=require(_0xdeb5('0x18'));var db=require(_0xdeb5('0x19'))['db'];function respondWithStatusCode(_0x188747,_0x298927){_0x298927=_0x298927||0xcc;return function(_0x2fe452){if(_0x2fe452){return _0x188747[_0xdeb5('0x1a')](_0x298927);}return _0x188747['status'](_0x298927)[_0xdeb5('0x1b')]();};}function respondWithResult(_0x5e2853,_0xe648c0){_0xe648c0=_0xe648c0||0xc8;return function(_0x11d83a){if(_0x11d83a){return _0x5e2853[_0xdeb5('0x1c')](_0xe648c0)[_0xdeb5('0x1d')](_0x11d83a);}};}function respondWithFilteredResult(_0x2633aa,_0x57e4e7){return function(_0x82d3ba){if(_0x82d3ba){var _0x384145=_0x82d3ba[_0xdeb5('0x1e')],_0x5caec0=_0x57e4e7['offset'],_0x17312b=_0x57e4e7['offset']+_0x57e4e7[_0xdeb5('0x1f')],_0x835c99;if(_0x17312b>=_0x384145){_0x17312b=_0x384145;_0x835c99=0xc8;}else{_0x835c99=0xce;}_0x2633aa['status'](_0x835c99);return _0x2633aa[_0xdeb5('0x20')](_0xdeb5('0x21'),_0x5caec0+'-'+_0x17312b+'/'+_0x384145)[_0xdeb5('0x1d')](_0x82d3ba);}return null;};}function patchUpdates(_0x5c1785){return function(_0x13c9fe){try{jsonpatch['apply'](_0x13c9fe,_0x5c1785,!![]);}catch(_0x20ac22){return BPromise[_0xdeb5('0x22')](_0x20ac22);}return _0x13c9fe[_0xdeb5('0x23')]();};}function saveUpdates(_0xb3e5a1,_0x3f7eff){return function(_0x540300){if(_0x540300){return _0x540300[_0xdeb5('0x24')](_0xb3e5a1)[_0xdeb5('0x25')](function(_0x4ef4d5){return _0x4ef4d5;});}return null;};}function removeEntity(_0x51f458,_0x5c8601){return function(_0x1ca65d){if(_0x1ca65d){return _0x1ca65d[_0xdeb5('0x26')]()[_0xdeb5('0x25')](function(){_0x51f458['status'](0xcc)[_0xdeb5('0x1b')]();});}};}function handleEntityNotFound(_0x5cdf41,_0x37d039){return function(_0x30e5c3){if(!_0x30e5c3){_0x5cdf41[_0xdeb5('0x1a')](0x194);}return _0x30e5c3;};}function handleError(_0x25d677,_0x31684a){_0x31684a=_0x31684a||0x1f4;return function(_0x364c90){logger[_0xdeb5('0x27')](_0x364c90[_0xdeb5('0x28')]);if(_0x364c90[_0xdeb5('0x29')]){delete _0x364c90[_0xdeb5('0x29')];}_0x25d677['status'](_0x31684a)[_0xdeb5('0x2a')](_0x364c90);};}exports[_0xdeb5('0x2b')]=function(_0x427302,_0x26d04d){var _0x546f86={},_0x484d6e={},_0x25e2f0={'count':0x0,'rows':[]};var _0x2d3f85=_['map'](db[_0xdeb5('0x2c')]['rawAttributes'],function(_0x41bf2b){return{'name':_0x41bf2b[_0xdeb5('0x2d')],'type':_0x41bf2b['type']['key']};});_0x484d6e[_0xdeb5('0x2e')]=_[_0xdeb5('0x2f')](_[_0xdeb5('0x30')](_0x2d3f85,_0xdeb5('0x29')),[_0xdeb5('0x31')]);_0x484d6e['query']=_[_0xdeb5('0x32')](_0x427302[_0xdeb5('0x33')]);_0x484d6e[_0xdeb5('0x34')]=_[_0xdeb5('0x35')](_0x484d6e[_0xdeb5('0x2e')],_0x484d6e[_0xdeb5('0x33')]);_0x546f86[_0xdeb5('0x36')]=_[_0xdeb5('0x35')](_0x484d6e[_0xdeb5('0x2e')],qs[_0xdeb5('0x37')](_0x427302[_0xdeb5('0x33')][_0xdeb5('0x37')]));_0x546f86[_0xdeb5('0x36')]=_0x546f86['attributes'][_0xdeb5('0x38')]?_0x546f86['attributes']:_0x484d6e[_0xdeb5('0x2e')];if(!_0x427302[_0xdeb5('0x33')][_0xdeb5('0x39')]('nolimit')){_0x546f86[_0xdeb5('0x1f')]=qs['limit'](_0x427302['query'][_0xdeb5('0x1f')]);_0x546f86['offset']=qs[_0xdeb5('0x3a')](_0x427302[_0xdeb5('0x33')][_0xdeb5('0x3a')]);}_0x546f86[_0xdeb5('0x3b')]=qs[_0xdeb5('0x3c')](_0x427302[_0xdeb5('0x33')][_0xdeb5('0x3c')]);_0x546f86[_0xdeb5('0x3d')]=qs['filters'](_[_0xdeb5('0x3e')](_0x427302['query'],_0x484d6e[_0xdeb5('0x34')]),_0x2d3f85);if(_0x427302[_0xdeb5('0x33')][_0xdeb5('0x3f')]){_0x546f86[_0xdeb5('0x3d')]=_[_0xdeb5('0x40')](_0x546f86[_0xdeb5('0x3d')],{'$or':_[_0xdeb5('0x30')](_0x2d3f85,function(_0x614555){if(_0x614555[_0xdeb5('0x41')]!==_0xdeb5('0x42')){var _0x243515={};_0x243515[_0x614555[_0xdeb5('0x29')]]={'$like':'%'+_0x427302[_0xdeb5('0x33')][_0xdeb5('0x3f')]+'%'};return _0x243515;}})});}_0x546f86=_[_0xdeb5('0x40')]({},_0x546f86,_0x427302['options']);var _0x45f6fe={'where':_0x546f86['where']};return db[_0xdeb5('0x2c')][_0xdeb5('0x1e')](_0x45f6fe)[_0xdeb5('0x25')](function(_0x415e99){_0x25e2f0[_0xdeb5('0x1e')]=_0x415e99;if(_0x427302['query']['includeAll']){_0x546f86[_0xdeb5('0x43')]=[{'all':!![]}];}return db[_0xdeb5('0x2c')][_0xdeb5('0x44')](_0x546f86);})['then'](function(_0x3fee4f){_0x25e2f0['rows']=_0x3fee4f;return _0x25e2f0;})[_0xdeb5('0x25')](respondWithFilteredResult(_0x26d04d,_0x546f86))[_0xdeb5('0x45')](handleError(_0x26d04d,null));};exports[_0xdeb5('0x46')]=function(_0x58e52b,_0x450bbc){var _0x3bab95={'raw':![],'where':{'id':_0x58e52b[_0xdeb5('0x47')]['id']}},_0xe858e2={};_0xe858e2['model']=_[_0xdeb5('0x32')](db[_0xdeb5('0x2c')]['rawAttributes']);_0xe858e2[_0xdeb5('0x33')]=_[_0xdeb5('0x32')](_0x58e52b[_0xdeb5('0x33')]);_0xe858e2[_0xdeb5('0x34')]=_[_0xdeb5('0x35')](_0xe858e2[_0xdeb5('0x2e')],_0xe858e2[_0xdeb5('0x33')]);_0x3bab95[_0xdeb5('0x36')]=_[_0xdeb5('0x35')](_0xe858e2[_0xdeb5('0x2e')],qs['fields'](_0x58e52b[_0xdeb5('0x33')][_0xdeb5('0x37')]));_0x3bab95[_0xdeb5('0x36')]=_0x3bab95[_0xdeb5('0x36')][_0xdeb5('0x38')]?_0x3bab95[_0xdeb5('0x36')]:_0xe858e2[_0xdeb5('0x2e')];if(_0x58e52b[_0xdeb5('0x33')][_0xdeb5('0x48')]){_0x3bab95['include']=[{'all':!![]}];}_0x3bab95=_[_0xdeb5('0x40')]({},_0x3bab95,_0x58e52b[_0xdeb5('0x49')]);return db['ScreenRecording'][_0xdeb5('0x4a')](_0x3bab95)[_0xdeb5('0x25')](handleEntityNotFound(_0x450bbc,null))[_0xdeb5('0x25')](respondWithResult(_0x450bbc,null))[_0xdeb5('0x45')](handleError(_0x450bbc,null));};exports['create']=function(_0x3fec09,_0x29d898){return db['ScreenRecording']['create'](_0x3fec09[_0xdeb5('0x4b')],{})[_0xdeb5('0x25')](respondWithResult(_0x29d898,0xc9))[_0xdeb5('0x45')](handleError(_0x29d898,null));};exports[_0xdeb5('0x24')]=function(_0x1ae0ba,_0x4a3d96){if(_0x1ae0ba[_0xdeb5('0x4b')]['id']){delete _0x1ae0ba[_0xdeb5('0x4b')]['id'];}delete _0x1ae0ba[_0xdeb5('0x4b')][_0xdeb5('0x4c')];delete _0x1ae0ba[_0xdeb5('0x4b')][_0xdeb5('0x4d')];delete _0x1ae0ba[_0xdeb5('0x4b')][_0xdeb5('0x4e')];delete _0x1ae0ba[_0xdeb5('0x4b')]['value'];return db[_0xdeb5('0x2c')]['find']({'where':{'id':_0x1ae0ba[_0xdeb5('0x47')]['id']}})['then'](handleEntityNotFound(_0x4a3d96,null))[_0xdeb5('0x25')](saveUpdates(_0x1ae0ba[_0xdeb5('0x4b')],null))[_0xdeb5('0x25')](respondWithResult(_0x4a3d96,null))[_0xdeb5('0x45')](handleError(_0x4a3d96,null));};exports[_0xdeb5('0x4f')]=function(_0x1f52eb,_0x1adb14){return db[_0xdeb5('0x2c')][_0xdeb5('0x4f')]()[_0xdeb5('0x25')](respondWithResult(_0x1adb14,null))[_0xdeb5('0x45')](handleError(_0x1adb14,null));};exports[_0xdeb5('0x50')]=function(_0x481961,_0x14e8fc,_0x180b7f){var _0x3f2fd2=require('../../components/encryptor');var _0x3bca2e=![];var _0x45914d={};if(_0x481961[_0xdeb5('0x33')]['type']&&_0x481961[_0xdeb5('0x33')][_0xdeb5('0x41')]===_0xdeb5('0x51')){_0x45914d[_0xdeb5('0x51')]=_0x481961['params']['id'];}else{_0x45914d['id']=_0x481961[_0xdeb5('0x47')]['id'];}return db['ScreenRecording'][_0xdeb5('0x4a')]({'where':_0x45914d,'attributes':['id',_0xdeb5('0x52')],'raw':!![]})['then'](handleEntityNotFound(_0x14e8fc,null))[_0xdeb5('0x25')](function(_0xd9101a){if(_0xd9101a){var _0x4235fe=path[_0xdeb5('0x53')](config[_0xdeb5('0x54')],'server/files/screen_recordings',_0xd9101a['value']);var _0x878408=util[_0xdeb5('0x31')]('%s.cypher',_0x4235fe);if(fs['existsSync'](_0x878408)){_0x3bca2e=!![];return _0x3f2fd2[_0xdeb5('0x55')](_0x878408,_0x4235fe,config[_0xdeb5('0x56')][_0xdeb5('0x57')])['then'](function(){return _0xd9101a;});}return _0xd9101a;}})['then'](function(_0x571d61){if(_0x571d61){var _0x1f1171=path[_0xdeb5('0x53')](config[_0xdeb5('0x54')],_0xdeb5('0x58'),_0x571d61[_0xdeb5('0x52')]);if(!fs[_0xdeb5('0x59')](_0x1f1171)){throw new db[(_0xdeb5('0x5a'))][(_0xdeb5('0x5b'))](_0xdeb5('0x5c'));}if(_0x571d61[_0xdeb5('0x5d')]){return _0x14e8fc['download'](_0x1f1171,_0x571d61[_0xdeb5('0x5d')]+path[_0xdeb5('0x5e')](_0x1f1171),function(){if(_0x3bca2e){fs[_0xdeb5('0x5f')](_0x1f1171);}});}else{return _0x14e8fc[_0xdeb5('0x50')](_0x1f1171,function(_0x50282c){if(_0x3bca2e){fs[_0xdeb5('0x5f')](_0x1f1171);}});}}})[_0xdeb5('0x45')](function(_0x17e099){if(_0x17e099['message']===_0xdeb5('0x5c')){_0x14e8fc[_0xdeb5('0x1c')](0x194)['send']('Not\x20found');}else{return handleError(_0x14e8fc,null);}});};exports[_0xdeb5('0x26')]=function(_0x398498,_0x2f6194){return db[_0xdeb5('0x2c')][_0xdeb5('0x4a')]({'where':{'id':_0x398498['params']['id']}})[_0xdeb5('0x25')](function(_0x555ed9){if(!_0x555ed9)throw new ReferenceError(_0xdeb5('0x60'));return _0x555ed9;})[_0xdeb5('0x25')](function(_0x449445){var _0x51e3d8=path['join'](config[_0xdeb5('0x54')],'server/files/screen_recordings',_0x449445[_0xdeb5('0x52')]);logger[_0xdeb5('0x61')]('cancellazione\x20fisica\x20documento\x20%s',_0x51e3d8);if(!_[_0xdeb5('0x62')](_0x449445[_0xdeb5('0x52')])&&fs[_0xdeb5('0x59')](_0x51e3d8)){logger[_0xdeb5('0x61')](_0xdeb5('0x63')+_0x51e3d8+_0xdeb5('0x64'));fs[_0xdeb5('0x65')](_0x51e3d8);}_0x51e3d8=_0x51e3d8+_0xdeb5('0x66');if(!_['isNil'](_0x449445['value'])&&fs[_0xdeb5('0x59')](_0x51e3d8)){logger[_0xdeb5('0x61')](_0xdeb5('0x63')+_0x51e3d8+_0xdeb5('0x64'));fs[_0xdeb5('0x65')](_0x51e3d8);}return _0x449445;})['then'](function(_0x408824){if(!_0x408824)throw new InternalError();return _0x408824[_0xdeb5('0x26')]();})[_0xdeb5('0x25')](function(){_0x2f6194[_0xdeb5('0x1c')](0xcc)[_0xdeb5('0x1b')]();})['catch'](handleError(_0x2f6194,null));}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.model.js b/server/api/screenRecording/screenRecording.model.js index 9e21f64..d404f6f 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 _0x26fb=['moment','bluebird','request-promise','path','../../config/environment','./screenRecording.attributes','exports','ScreenRecording','screen_recordings','interactionid','lodash','util','../../config/logger','api'];(function(_0x2d4355,_0x208b01){var _0x5b42f6=function(_0x2def86){while(--_0x2def86){_0x2d4355['push'](_0x2d4355['shift']());}};_0x5b42f6(++_0x208b01);}(_0x26fb,0x1f4));var _0xb26f=function(_0xe7c78b,_0x1d1dba){_0xe7c78b=_0xe7c78b-0x0;var _0x3a25e4=_0x26fb[_0xe7c78b];return _0x3a25e4;};'use strict';var _=require(_0xb26f('0x0'));var util=require(_0xb26f('0x1'));var logger=require(_0xb26f('0x2'))(_0xb26f('0x3'));var moment=require(_0xb26f('0x4'));var BPromise=require(_0xb26f('0x5'));var rp=require(_0xb26f('0x6'));var fs=require('fs');var path=require(_0xb26f('0x7'));var rimraf=require('rimraf');var config=require(_0xb26f('0x8'));var attributes=require(_0xb26f('0x9'));module[_0xb26f('0xa')]=function(_0x12186c,_0x227c7f){return _0x12186c['define'](_0xb26f('0xb'),attributes,{'tableName':_0xb26f('0xc'),'paranoid':![],'indexes':[{'name':_0xb26f('0xd'),'fields':[_0xb26f('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x1a9d=['exports','define','screen_recordings','interactionid','lodash','../../config/logger','moment','request-promise','path','rimraf','../../config/environment'];(function(_0x3d67fd,_0x72c8b8){var _0x4e1164=function(_0x49bbfa){while(--_0x49bbfa){_0x3d67fd['push'](_0x3d67fd['shift']());}};_0x4e1164(++_0x72c8b8);}(_0x1a9d,0x16f));var _0xd1a9=function(_0x351283,_0x5966a6){_0x351283=_0x351283-0x0;var _0x122685=_0x1a9d[_0x351283];return _0x122685;};'use strict';var _=require(_0xd1a9('0x0'));var util=require('util');var logger=require(_0xd1a9('0x1'))('api');var moment=require(_0xd1a9('0x2'));var BPromise=require('bluebird');var rp=require(_0xd1a9('0x3'));var fs=require('fs');var path=require(_0xd1a9('0x4'));var rimraf=require(_0xd1a9('0x5'));var config=require(_0xd1a9('0x6'));var attributes=require('./screenRecording.attributes');module[_0xd1a9('0x7')]=function(_0x11d430,_0x275728){return _0x11d430[_0xd1a9('0x8')]('ScreenRecording',attributes,{'tableName':_0xd1a9('0x9'),'paranoid':![],'indexes':[{'name':_0xd1a9('0xa'),'fields':[_0xd1a9('0xa')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.rpc.js b/server/api/screenRecording/screenRecording.rpc.js index 81474d6..41c0f65 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(_0x48b86f,_0x21c9d6){var _0x5e97f3=function(_0x4567f6){while(--_0x4567f6){_0x48b86f['push'](_0x48b86f['shift']());}};_0x5e97f3(++_0x21c9d6);}(_0xa9e0,0x123));var _0x0a9e=function(_0x173d7e,_0x3242fd){_0x173d7e=_0x173d7e-0x0;var _0x2220d6=_0xa9e0[_0x173d7e];return _0x2220d6;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a9e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var config=require(_0x0a9e('0x7'));var jayson=require(_0x0a9e('0x8'));var client=jayson['client'][_0x0a9e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x441e3a,_0x2cc193,_0x5f41ea){return new BPromise(function(_0x503809,_0xe42b77){return client['request'](_0x441e3a,_0x5f41ea)['then'](function(_0x39753a){logger[_0x0a9e('0xa')](_0x0a9e('0xb'),_0x2cc193,_0x0a9e('0xc'));logger[_0x0a9e('0xd')](_0x0a9e('0xe'),_0x2cc193,'request\x20sent',JSON['stringify'](_0x39753a));if(_0x39753a['error']){if(_0x39753a['error'][_0x0a9e('0xf')]===0x1f4){logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0xe42b77(_0x39753a[_0x0a9e('0x10')]['message']);}logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0x503809(_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);}else{logger['info'](_0x0a9e('0xb'),_0x2cc193,'request\x20sent');_0x503809(_0x39753a[_0x0a9e('0x12')]['message']);}})[_0x0a9e('0x13')](function(_0x12066b){logger['error'](_0x0a9e('0xb'),_0x2cc193,_0x12066b);_0xe42b77(_0x12066b);});});} \ No newline at end of file +var _0xa9e0=['http','info','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(_0xed5b9e,_0x4abf96){var _0x48e6a9=function(_0x1b8410){while(--_0x1b8410){_0xed5b9e['push'](_0xed5b9e['shift']());}};_0x48e6a9(++_0x4abf96);}(_0xa9e0,0x123));var _0x0a9e=function(_0x311c35,_0x534915){_0x311c35=_0x311c35-0x0;var _0x5cc50c=_0xa9e0[_0x311c35];return _0x5cc50c;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var 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 541f7ac..53f0b85 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 _0x2b8b=['server/files/images/logos/','format','%s%s','logo','post','file','addLogo','diskStorage','logologin','extname','originalname','/:id/logo_login','addLogoLogin','preferred','addPreferred','addFavicon','put','/:id','update','multer','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./setting.controller','get','isAuthenticated','index','show','/:id/logo','getLogo','getLogoLogin','gdpr','/:id/preferred','getPreferred','/:id/favicon','getFavicon','join','root'];(function(_0x3ab6cb,_0x591249){var _0x108ae5=function(_0x54be0c){while(--_0x54be0c){_0x3ab6cb['push'](_0x3ab6cb['shift']());}};_0x108ae5(++_0x591249);}(_0x2b8b,0x163));var _0xb2b8=function(_0x1035c1,_0x2d8583){_0x1035c1=_0x1035c1-0x0;var _0x308d67=_0x2b8b[_0x1035c1];return _0x308d67;};'use strict';var multer=require(_0xb2b8('0x0'));var util=require(_0xb2b8('0x1'));var path=require(_0xb2b8('0x2'));var timeout=require(_0xb2b8('0x3'));var express=require(_0xb2b8('0x4'));var router=express[_0xb2b8('0x5')]();var auth=require('../../components/auth/service');var interaction=require(_0xb2b8('0x6'));var config=require(_0xb2b8('0x7'));var controller=require(_0xb2b8('0x8'));router[_0xb2b8('0x9')]('/',auth[_0xb2b8('0xa')](),controller[_0xb2b8('0xb')]);router[_0xb2b8('0x9')]('/:id',controller[_0xb2b8('0xc')]);router[_0xb2b8('0x9')](_0xb2b8('0xd'),controller[_0xb2b8('0xe')]);router[_0xb2b8('0x9')]('/:id/logo_login',controller[_0xb2b8('0xf')]);router[_0xb2b8('0x9')]('/:id/gdpr',controller[_0xb2b8('0x10')]);router['get'](_0xb2b8('0x11'),controller[_0xb2b8('0x12')]);router[_0xb2b8('0x9')](_0xb2b8('0x13'),controller[_0xb2b8('0x14')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x3159bc,_0x2dbdc3,_0x1c24ef){_0x1c24ef(null,path[_0xb2b8('0x15')](config[_0xb2b8('0x16')],_0xb2b8('0x17')));},'filename':function(_0x2e55f0,_0x4fe810,_0x4d17c8){_0x4d17c8(null,util[_0xb2b8('0x18')](_0xb2b8('0x19'),_0xb2b8('0x1a'),path['extname'](_0x4fe810['originalname'])));}})});router[_0xb2b8('0x1b')]('/:id/logo',upload['single'](_0xb2b8('0x1c')),controller[_0xb2b8('0x1d')]);var upload=multer({'storage':multer[_0xb2b8('0x1e')]({'destination':function(_0x5483a8,_0x44ecc8,_0x2129dd){_0x2129dd(null,path[_0xb2b8('0x15')](config[_0xb2b8('0x16')],_0xb2b8('0x17')));},'filename':function(_0x3f542c,_0x380660,_0x103cb8){_0x103cb8(null,util[_0xb2b8('0x18')]('%s%s',_0xb2b8('0x1f'),path[_0xb2b8('0x20')](_0x380660[_0xb2b8('0x21')])));}})});router[_0xb2b8('0x1b')](_0xb2b8('0x22'),upload['single'](_0xb2b8('0x1c')),controller[_0xb2b8('0x23')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x3bf1e0,_0x112b95,_0x51ddea){_0x51ddea(null,path[_0xb2b8('0x15')](config[_0xb2b8('0x16')],_0xb2b8('0x17')));},'filename':function(_0x19f700,_0x4864b8,_0x175157){_0x175157(null,util[_0xb2b8('0x18')](_0xb2b8('0x19'),_0xb2b8('0x24'),path[_0xb2b8('0x20')](_0x4864b8[_0xb2b8('0x21')])));}})});router[_0xb2b8('0x1b')](_0xb2b8('0x11'),upload['single'](_0xb2b8('0x1c')),controller[_0xb2b8('0x25')]);var upload=multer({'storage':multer[_0xb2b8('0x1e')]({'destination':function(_0x74a162,_0x16646b,_0x3ce1b0){_0x3ce1b0(null,path[_0xb2b8('0x15')](config['root'],_0xb2b8('0x17')));},'filename':function(_0x22e5e7,_0x575aef,_0x337241){_0x337241(null,util[_0xb2b8('0x18')]('%s%s','favicon',path[_0xb2b8('0x20')](_0x575aef[_0xb2b8('0x21')])));}})});router[_0xb2b8('0x1b')]('/:id/favicon',upload['single'](_0xb2b8('0x1c')),controller[_0xb2b8('0x26')]);router[_0xb2b8('0x27')](_0xb2b8('0x28'),auth[_0xb2b8('0xa')](),controller[_0xb2b8('0x29')]);module['exports']=router; \ No newline at end of file +var _0x681b=['Router','../../components/auth/service','../../components/interaction/service','./setting.controller','get','isAuthenticated','index','/:id','show','getLogo','/:id/logo_login','gdpr','/:id/preferred','getPreferred','/:id/favicon','getFavicon','join','root','server/files/images/logos/','format','%s%s','logo','extname','originalname','single','file','addLogo','diskStorage','logologin','addLogoLogin','addPreferred','favicon','post','addFavicon','put','update','exports','multer','util','path','connect-timeout','express'];(function(_0x2088b6,_0x3ca4ae){var _0x4f80c0=function(_0x18dba0){while(--_0x18dba0){_0x2088b6['push'](_0x2088b6['shift']());}};_0x4f80c0(++_0x3ca4ae);}(_0x681b,0x175));var _0xb681=function(_0x458904,_0x45398f){_0x458904=_0x458904-0x0;var _0x1dced6=_0x681b[_0x458904];return _0x1dced6;};'use strict';var multer=require(_0xb681('0x0'));var util=require(_0xb681('0x1'));var path=require(_0xb681('0x2'));var timeout=require(_0xb681('0x3'));var express=require(_0xb681('0x4'));var router=express[_0xb681('0x5')]();var auth=require(_0xb681('0x6'));var interaction=require(_0xb681('0x7'));var config=require('../../config/environment');var controller=require(_0xb681('0x8'));router[_0xb681('0x9')]('/',auth[_0xb681('0xa')](),controller[_0xb681('0xb')]);router[_0xb681('0x9')](_0xb681('0xc'),controller[_0xb681('0xd')]);router[_0xb681('0x9')]('/:id/logo',controller[_0xb681('0xe')]);router['get'](_0xb681('0xf'),controller['getLogoLogin']);router[_0xb681('0x9')]('/:id/gdpr',controller[_0xb681('0x10')]);router[_0xb681('0x9')](_0xb681('0x11'),controller[_0xb681('0x12')]);router[_0xb681('0x9')](_0xb681('0x13'),controller[_0xb681('0x14')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x49e58f,_0x5a395e,_0x232465){_0x232465(null,path[_0xb681('0x15')](config[_0xb681('0x16')],_0xb681('0x17')));},'filename':function(_0x495a1c,_0x432f1d,_0xf83360){_0xf83360(null,util[_0xb681('0x18')](_0xb681('0x19'),_0xb681('0x1a'),path[_0xb681('0x1b')](_0x432f1d[_0xb681('0x1c')])));}})});router['post']('/:id/logo',upload[_0xb681('0x1d')](_0xb681('0x1e')),controller[_0xb681('0x1f')]);var upload=multer({'storage':multer[_0xb681('0x20')]({'destination':function(_0x9880e1,_0x43eb7c,_0xadb69c){_0xadb69c(null,path['join'](config[_0xb681('0x16')],'server/files/images/logos/'));},'filename':function(_0x398dbd,_0x20b6b0,_0x17900f){_0x17900f(null,util[_0xb681('0x18')](_0xb681('0x19'),_0xb681('0x21'),path[_0xb681('0x1b')](_0x20b6b0[_0xb681('0x1c')])));}})});router['post']('/:id/logo_login',upload['single']('file'),controller[_0xb681('0x22')]);var upload=multer({'storage':multer[_0xb681('0x20')]({'destination':function(_0x5306d8,_0x247f4a,_0x23c07e){_0x23c07e(null,path['join'](config['root'],'server/files/images/logos/'));},'filename':function(_0x5bb1ec,_0xb4d9fd,_0x165e25){_0x165e25(null,util[_0xb681('0x18')](_0xb681('0x19'),'preferred',path[_0xb681('0x1b')](_0xb4d9fd['originalname'])));}})});router['post']('/:id/preferred',upload[_0xb681('0x1d')](_0xb681('0x1e')),controller[_0xb681('0x23')]);var upload=multer({'storage':multer[_0xb681('0x20')]({'destination':function(_0x392d7b,_0x5a7367,_0x4da85d){_0x4da85d(null,path[_0xb681('0x15')](config['root'],_0xb681('0x17')));},'filename':function(_0x1283fe,_0x652ea0,_0xa0f8e6){_0xa0f8e6(null,util[_0xb681('0x18')](_0xb681('0x19'),_0xb681('0x24'),path[_0xb681('0x1b')](_0x652ea0['originalname'])));}})});router[_0xb681('0x25')](_0xb681('0x13'),upload[_0xb681('0x1d')](_0xb681('0x1e')),controller[_0xb681('0x26')]);router[_0xb681('0x27')](_0xb681('0xc'),auth[_0xb681('0xa')](),controller[_0xb681('0x28')]);module[_0xb681('0x29')]=router; \ No newline at end of file diff --git a/server/api/setting/setting.attributes.js b/server/api/setting/setting.attributes.js index 4bb3029..fec7037 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 _0x5ef5=['INTEGER','min_internal','min_mailbox','STRING','/var/opt/motion2/server/files/sounds/converted','BOOLEAN','https://www.xcally.com/bar/phonebar/autoupdater.xml','exports'];(function(_0x14aff6,_0x215a80){var _0x3dba28=function(_0x1a3e68){while(--_0x1a3e68){_0x14aff6['push'](_0x14aff6['shift']());}};_0x3dba28(++_0x215a80);}(_0x5ef5,0x147));var _0x55ef=function(_0x1da9a5,_0x1e08c5){_0x1da9a5=_0x1da9a5-0x0;var _0x149571=_0x5ef5[_0x1da9a5];return _0x149571;};'use strict';var Sequelize=require('sequelize');module[_0x55ef('0x0')]={'min_internal':{'type':Sequelize[_0x55ef('0x1')](0xb),'unique':_0x55ef('0x2'),'defaultValue':0x3e8},'min_mailbox':{'type':Sequelize[_0x55ef('0x1')](0xb),'unique':_0x55ef('0x3'),'defaultValue':0x3e8},'agi_port':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x11dd},'soundPath':{'type':Sequelize[_0x55ef('0x4')],'defaultValue':_0x55ef('0x5')},'logo':{'type':Sequelize[_0x55ef('0x4')]},'defaultLogo':{'type':Sequelize[_0x55ef('0x6')],'defaultValue':!![]},'loginLogo':{'type':Sequelize[_0x55ef('0x4')]},'defaultLoginLogo':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'headerWhiteLabel':{'type':Sequelize[_0x55ef('0x4')]},'defaultHeaderWhiteLabel':{'type':Sequelize[_0x55ef('0x6')],'defaultValue':!![]},'securePassword':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'firstSetup':{'type':Sequelize[_0x55ef('0x6')],'defaultValue':!![]},'stunaddr':{'type':Sequelize[_0x55ef('0x4')]},'turnaddr':{'type':Sequelize[_0x55ef('0x4')]},'turnusername':{'type':Sequelize[_0x55ef('0x4')]},'turnpassword':{'type':Sequelize[_0x55ef('0x4')]},'pageTitle':{'type':Sequelize[_0x55ef('0x4')]},'defaultPageTitle':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'callRecordingEncryption':{'type':Sequelize[_0x55ef('0x6')],'defaultValue':![]},'passwordExpiresDays':{'type':Sequelize[_0x55ef('0x1')](0xb),'defaultValue':0x5a},'phoneBarAutoUpdater':{'type':Sequelize[_0x55ef('0x6')],'defaultValue':!![]},'phoneBarAutoUpdaterUrl':{'type':Sequelize[_0x55ef('0x4')],'defaultValue':_0x55ef('0x7')},'enableEmailPreview':{'type':Sequelize[_0x55ef('0x6')],'defaultValue':![]},'split':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'splitSizeCsv':{'type':Sequelize['INTEGER'],'defaultValue':0x1388},'splitSizePdf':{'type':Sequelize['INTEGER'],'defaultValue':0x1388},'splitSizeXlsx':{'type':Sequelize['INTEGER'],'defaultValue':0x1388},'messagesAlignment':{'type':Sequelize['STRING'],'defaultValue':'alternate'},'chatTimeout':{'type':Sequelize[_0x55ef('0x1')],'defaultValue':0x1e},'phoneBarRememberMeEnabled':{'type':Sequelize[_0x55ef('0x6')],'defaultValue':!![]},'preferred':{'type':Sequelize[_0x55ef('0x4')]},'defaultPreferred':{'type':Sequelize[_0x55ef('0x6')],'defaultValue':!![]},'rtlSupport':{'type':Sequelize[_0x55ef('0x6')],'defaultValue':![]},'defaultScreenRecordingPath':{'type':Sequelize[_0x55ef('0x4')]},'allowedLoginAttempts':{'type':Sequelize['INTEGER'],'defaultValue':0x5},'blockDuration':{'type':Sequelize[_0x55ef('0x1')],'defaultValue':0xa},'favicon':{'type':Sequelize['STRING']},'defaultFavicon':{'type':Sequelize[_0x55ef('0x6')],'defaultValue':!![]},'loginMailFrequency':{'type':Sequelize[_0x55ef('0x1')],'defaultValue':0xa,'validate':{'min':0xa}},'transcribe':{'type':Sequelize[_0x55ef('0x6')],'defaultValue':![]},'automaticTranscribe':{'type':Sequelize[_0x55ef('0x6')],'defaultValue':![]},'transcribeAccountId':{'type':Sequelize[_0x55ef('0x1')]},'transcribeRegion':{'type':Sequelize[_0x55ef('0x4')]},'sentiment':{'type':Sequelize[_0x55ef('0x6')],'defaultValue':![]},'automaticSentiment':{'type':Sequelize[_0x55ef('0x6')],'defaultValue':![]},'sentimentAccountId':{'type':Sequelize[_0x55ef('0x1')]},'sentimentRegion':{'type':Sequelize[_0x55ef('0x4')]},'language':{'type':Sequelize[_0x55ef('0x4')]},'bucket':{'type':Sequelize[_0x55ef('0x4')]},'googleSsoEnabled':{'type':Sequelize[_0x55ef('0x6')],'defaultValue':![]}}; \ No newline at end of file +var _0x4702=['min_internal','INTEGER','min_mailbox','STRING','BOOLEAN','https://www.xcally.com/bar/phonebar/autoupdater.xml','sequelize','exports'];(function(_0xd28cc,_0x2f8927){var _0x1f3e28=function(_0x35876a){while(--_0x35876a){_0xd28cc['push'](_0xd28cc['shift']());}};_0x1f3e28(++_0x2f8927);}(_0x4702,0x96));var _0x2470=function(_0x153b4e,_0x436b13){_0x153b4e=_0x153b4e-0x0;var _0x2aabc0=_0x4702[_0x153b4e];return _0x2aabc0;};'use strict';var Sequelize=require(_0x2470('0x0'));module[_0x2470('0x1')]={'min_internal':{'type':Sequelize['INTEGER'](0xb),'unique':_0x2470('0x2'),'defaultValue':0x3e8},'min_mailbox':{'type':Sequelize[_0x2470('0x3')](0xb),'unique':_0x2470('0x4'),'defaultValue':0x3e8},'agi_port':{'type':Sequelize[_0x2470('0x3')](0xb),'defaultValue':0x11dd},'soundPath':{'type':Sequelize[_0x2470('0x5')],'defaultValue':'/var/opt/motion2/server/files/sounds/converted'},'logo':{'type':Sequelize['STRING']},'defaultLogo':{'type':Sequelize[_0x2470('0x6')],'defaultValue':!![]},'loginLogo':{'type':Sequelize[_0x2470('0x5')]},'defaultLoginLogo':{'type':Sequelize[_0x2470('0x6')],'defaultValue':!![]},'headerWhiteLabel':{'type':Sequelize[_0x2470('0x5')]},'defaultHeaderWhiteLabel':{'type':Sequelize[_0x2470('0x6')],'defaultValue':!![]},'securePassword':{'type':Sequelize[_0x2470('0x6')],'defaultValue':!![]},'firstSetup':{'type':Sequelize[_0x2470('0x6')],'defaultValue':!![]},'stunaddr':{'type':Sequelize[_0x2470('0x5')]},'turnaddr':{'type':Sequelize[_0x2470('0x5')]},'turnusername':{'type':Sequelize['STRING']},'turnpassword':{'type':Sequelize[_0x2470('0x5')]},'pageTitle':{'type':Sequelize[_0x2470('0x5')]},'defaultPageTitle':{'type':Sequelize[_0x2470('0x6')],'defaultValue':!![]},'callRecordingEncryption':{'type':Sequelize[_0x2470('0x6')],'defaultValue':![]},'passwordExpiresDays':{'type':Sequelize[_0x2470('0x3')](0xb),'defaultValue':0x5a},'phoneBarAutoUpdater':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'phoneBarAutoUpdaterUrl':{'type':Sequelize[_0x2470('0x5')],'defaultValue':_0x2470('0x7')},'enableEmailPreview':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'split':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'splitSizeCsv':{'type':Sequelize[_0x2470('0x3')],'defaultValue':0x1388},'splitSizePdf':{'type':Sequelize['INTEGER'],'defaultValue':0x1388},'splitSizeXlsx':{'type':Sequelize['INTEGER'],'defaultValue':0x1388},'messagesAlignment':{'type':Sequelize[_0x2470('0x5')],'defaultValue':'alternate'},'chatTimeout':{'type':Sequelize[_0x2470('0x3')],'defaultValue':0x1e},'phoneBarRememberMeEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'preferred':{'type':Sequelize['STRING']},'defaultPreferred':{'type':Sequelize[_0x2470('0x6')],'defaultValue':!![]},'rtlSupport':{'type':Sequelize[_0x2470('0x6')],'defaultValue':![]},'defaultScreenRecordingPath':{'type':Sequelize[_0x2470('0x5')]},'allowedLoginAttempts':{'type':Sequelize[_0x2470('0x3')],'defaultValue':0x5},'blockDuration':{'type':Sequelize[_0x2470('0x3')],'defaultValue':0xa},'favicon':{'type':Sequelize[_0x2470('0x5')]},'defaultFavicon':{'type':Sequelize[_0x2470('0x6')],'defaultValue':!![]},'loginMailFrequency':{'type':Sequelize['INTEGER'],'defaultValue':0xa,'validate':{'min':0xa}},'transcribe':{'type':Sequelize[_0x2470('0x6')],'defaultValue':![]},'automaticTranscribe':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'transcribeAccountId':{'type':Sequelize[_0x2470('0x3')]},'transcribeRegion':{'type':Sequelize[_0x2470('0x5')]},'sentiment':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'automaticSentiment':{'type':Sequelize[_0x2470('0x6')],'defaultValue':![]},'sentimentAccountId':{'type':Sequelize['INTEGER']},'sentimentRegion':{'type':Sequelize[_0x2470('0x5')]},'language':{'type':Sequelize[_0x2470('0x5')]},'bucket':{'type':Sequelize[_0x2470('0x5')]},'googleSsoEnabled':{'type':Sequelize[_0x2470('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 f508ba0..9ccba19 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 _0xbbe6=['default_favicon.ico','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','ejs','lodash','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','jayson/promise','http','test','Sequelize','ValidationError','then','info','Setting,\x20%s,\x20%s','request\x20sent','debug','Setting,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','stack','name','map','rawAttributes','key','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','type','VIRTUAL','options','Setting','includeAll','include','findAll','rows','show','keys','find','update','params','body','addLogo','file','logo','filename','addLogoLogin','loginLogo','getLogo','server/files/images/logos','preferred','favicon','defaultLoginLogo','defaultPreferred','defaultFavicon','existsSync','join','toLower','root','default_logo.svg','default','custom','upperFirst','\x20not\x20found','../../config/license/util','getLogoLogin','getLicense','defaultLogo','default_loginLogo.svg','download','gdpr','securePassword','addPreferred','getPreferred','default_preferred.png','addFavicon','getFavicon'];(function(_0x2af2ae,_0x2e8edf){var _0x4df976=function(_0xcb49b){while(--_0xcb49b){_0x2af2ae['push'](_0x2af2ae['shift']());}};_0x4df976(++_0x2e8edf);}(_0xbbe6,0x175));var _0x6bbe=function(_0x5123b8,_0x29dfdc){_0x5123b8=_0x5123b8-0x0;var _0x3da0d5=_0xbbe6[_0x5123b8];return _0x3da0d5;};'use strict';var pdf=require(_0x6bbe('0x0'));var emlformat=require(_0x6bbe('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x6bbe('0x2'));var jsonpatch=require(_0x6bbe('0x3'));var rp=require(_0x6bbe('0x4'));var moment=require(_0x6bbe('0x5'));var BPromise=require(_0x6bbe('0x6'));var Mustache=require(_0x6bbe('0x7'));var util=require(_0x6bbe('0x8'));var path=require('path');var sox=require(_0x6bbe('0x9'));var csv=require('to-csv');var ejs=require(_0x6bbe('0xa'));var fs=require('fs');var _=require(_0x6bbe('0xb'));var squel=require('squel');var crypto=require(_0x6bbe('0xc'));var jsforce=require(_0x6bbe('0xd'));var deskjs=require(_0x6bbe('0xe'));var toCsv=require(_0x6bbe('0xf'));var querystring=require(_0x6bbe('0x10'));var Papa=require(_0x6bbe('0x11'));var Redis=require(_0x6bbe('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x6bbe('0x13'));var as=require(_0x6bbe('0x14'));var hardwareService=require(_0x6bbe('0x15'));var logger=require('../../config/logger')(_0x6bbe('0x16'));var utils=require(_0x6bbe('0x17'));var config=require(_0x6bbe('0x18'));var db=require(_0x6bbe('0x19'))['db'];var jayson=require(_0x6bbe('0x1a'));var client=jayson['client'][_0x6bbe('0x1b')]({'port':0x232a});function checkPasswordPattern(_0x487f02,_0x5bdc41,_0x481413){if(_0x481413){var _0x409c60=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x409c60[_0x6bbe('0x1c')](_0x5bdc41)){return _0x487f02;}else{throw new db[(_0x6bbe('0x1d'))][(_0x6bbe('0x1e'))]('The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.');}}else{return _0x487f02;}}function respondWithRpcPromise(_0xcb4014,_0x4a73f7,_0x521191,_0x5b958a){return new BPromise(function(_0x1a591e,_0x103ea6){var _0x5ad4b7=_0x5b958a||client;return _0x5ad4b7['request'](_0xcb4014,_0x521191)[_0x6bbe('0x1f')](function(_0xb2e80){logger[_0x6bbe('0x20')](_0x6bbe('0x21'),_0x4a73f7,_0x6bbe('0x22'));logger[_0x6bbe('0x23')](_0x6bbe('0x24'),_0x4a73f7,_0x6bbe('0x22'),JSON[_0x6bbe('0x25')](_0xb2e80));if(_0xb2e80[_0x6bbe('0x26')]){if(_0xb2e80[_0x6bbe('0x26')][_0x6bbe('0x27')]===0x1f4){logger[_0x6bbe('0x26')]('Setting,\x20%s,\x20%s',_0x4a73f7,_0xb2e80[_0x6bbe('0x26')][_0x6bbe('0x28')]);return _0x103ea6(_0xb2e80[_0x6bbe('0x26')][_0x6bbe('0x28')]);}logger[_0x6bbe('0x26')]('Setting,\x20%s,\x20%s',_0x4a73f7,_0xb2e80[_0x6bbe('0x26')][_0x6bbe('0x28')]);return _0x1a591e(_0xb2e80[_0x6bbe('0x26')]['message']);}else{logger[_0x6bbe('0x20')](_0x6bbe('0x21'),_0x4a73f7,_0x6bbe('0x22'));_0x1a591e(_0xb2e80[_0x6bbe('0x29')][_0x6bbe('0x28')]);}})[_0x6bbe('0x2a')](function(_0x5153ac){logger[_0x6bbe('0x26')]('Setting,\x20%s,\x20%s',_0x4a73f7,_0x5153ac);_0x103ea6(_0x5153ac);});});}function respondWithStatusCode(_0x527965,_0x542123){_0x542123=_0x542123||0xcc;return function(_0x114e68){if(_0x114e68){return _0x527965[_0x6bbe('0x2b')](_0x542123);}return _0x527965[_0x6bbe('0x2c')](_0x542123)[_0x6bbe('0x2d')]();};}function respondWithResult(_0x792875,_0x2cde98){_0x2cde98=_0x2cde98||0xc8;return function(_0x4f6cfb){if(_0x4f6cfb){return _0x792875[_0x6bbe('0x2c')](_0x2cde98)[_0x6bbe('0x2e')](_0x4f6cfb);}};}function respondWithFilteredResult(_0x558959,_0x945c21){return function(_0x46c8e1){if(_0x46c8e1){var _0x54728c=_0x46c8e1[_0x6bbe('0x2f')],_0x2cb78d=_0x945c21[_0x6bbe('0x30')],_0x3246d1=_0x945c21[_0x6bbe('0x30')]+_0x945c21[_0x6bbe('0x31')],_0x2cd563;if(_0x3246d1>=_0x54728c){_0x3246d1=_0x54728c;_0x2cd563=0xc8;}else{_0x2cd563=0xce;}_0x558959[_0x6bbe('0x2c')](_0x2cd563);return _0x558959[_0x6bbe('0x32')](_0x6bbe('0x33'),_0x2cb78d+'-'+_0x3246d1+'/'+_0x54728c)[_0x6bbe('0x2e')](_0x46c8e1);}return null;};}function patchUpdates(_0x1630ae){return function(_0x4f93aa){try{jsonpatch[_0x6bbe('0x34')](_0x4f93aa,_0x1630ae,!![]);}catch(_0x28c8e4){return BPromise[_0x6bbe('0x35')](_0x28c8e4);}return _0x4f93aa[_0x6bbe('0x36')]();};}function saveUpdates(_0x303132,_0x443b50){return function(_0x5b8af5){if(_0x5b8af5){return _0x5b8af5['update'](_0x303132)[_0x6bbe('0x1f')](function(_0x3878b5){return _0x3878b5;});}return null;};}function removeEntity(_0x2c81b4,_0x4e1540){return function(_0x5dcdc8){if(_0x5dcdc8){return _0x5dcdc8['destroy']()[_0x6bbe('0x1f')](function(){_0x2c81b4[_0x6bbe('0x2c')](0xcc)[_0x6bbe('0x2d')]();});}};}function handleEntityNotFound(_0x3455b8,_0x5b5178){return function(_0x476257){if(!_0x476257){_0x3455b8[_0x6bbe('0x2b')](0x194);}return _0x476257;};}function handleError(_0x1b18d1,_0x21dcea){_0x21dcea=_0x21dcea||0x1f4;return function(_0x3ee85f){logger[_0x6bbe('0x26')](_0x3ee85f[_0x6bbe('0x37')]);if(_0x3ee85f[_0x6bbe('0x38')]){delete _0x3ee85f[_0x6bbe('0x38')];}_0x1b18d1[_0x6bbe('0x2c')](_0x21dcea)['send'](_0x3ee85f);};}exports['index']=function(_0x1ab2db,_0x322beb){var _0x3893cd={},_0x2a5b4f={},_0x5ce650={'count':0x0,'rows':[]};var _0x4c58a2=_[_0x6bbe('0x39')](db['Setting'][_0x6bbe('0x3a')],function(_0x1c6450){return{'name':_0x1c6450['fieldName'],'type':_0x1c6450['type'][_0x6bbe('0x3b')]};});_0x2a5b4f['model']=_[_0x6bbe('0x39')](_0x4c58a2,_0x6bbe('0x38'));_0x2a5b4f['query']=_['keys'](_0x1ab2db[_0x6bbe('0x3c')]);_0x2a5b4f[_0x6bbe('0x3d')]=_[_0x6bbe('0x3e')](_0x2a5b4f[_0x6bbe('0x3f')],_0x2a5b4f[_0x6bbe('0x3c')]);_0x3893cd[_0x6bbe('0x40')]=_[_0x6bbe('0x3e')](_0x2a5b4f[_0x6bbe('0x3f')],qs[_0x6bbe('0x41')](_0x1ab2db['query'][_0x6bbe('0x41')]));_0x3893cd['attributes']=_0x3893cd[_0x6bbe('0x40')][_0x6bbe('0x42')]?_0x3893cd['attributes']:_0x2a5b4f[_0x6bbe('0x3f')];if(!_0x1ab2db['query'][_0x6bbe('0x43')](_0x6bbe('0x44'))){_0x3893cd['limit']=qs[_0x6bbe('0x31')](_0x1ab2db[_0x6bbe('0x3c')][_0x6bbe('0x31')]);_0x3893cd[_0x6bbe('0x30')]=qs[_0x6bbe('0x30')](_0x1ab2db[_0x6bbe('0x3c')][_0x6bbe('0x30')]);}_0x3893cd[_0x6bbe('0x45')]=qs[_0x6bbe('0x46')](_0x1ab2db['query']['sort']);_0x3893cd[_0x6bbe('0x47')]=qs[_0x6bbe('0x3d')](_['pick'](_0x1ab2db[_0x6bbe('0x3c')],_0x2a5b4f[_0x6bbe('0x3d')]),_0x4c58a2);if(_0x1ab2db[_0x6bbe('0x3c')][_0x6bbe('0x48')]){_0x3893cd[_0x6bbe('0x47')]=_[_0x6bbe('0x49')](_0x3893cd[_0x6bbe('0x47')],{'$or':_['map'](_0x4c58a2,function(_0x53e906){if(_0x53e906[_0x6bbe('0x4a')]!==_0x6bbe('0x4b')){var _0x242d4d={};_0x242d4d[_0x53e906[_0x6bbe('0x38')]]={'$like':'%'+_0x1ab2db[_0x6bbe('0x3c')][_0x6bbe('0x48')]+'%'};return _0x242d4d;}})});}_0x3893cd=_['merge']({},_0x3893cd,_0x1ab2db[_0x6bbe('0x4c')]);var _0x36e437={'where':_0x3893cd[_0x6bbe('0x47')]};return db[_0x6bbe('0x4d')][_0x6bbe('0x2f')](_0x36e437)[_0x6bbe('0x1f')](function(_0x3265ff){_0x5ce650[_0x6bbe('0x2f')]=_0x3265ff;if(_0x1ab2db[_0x6bbe('0x3c')][_0x6bbe('0x4e')]){_0x3893cd[_0x6bbe('0x4f')]=[{'all':!![]}];}return db[_0x6bbe('0x4d')][_0x6bbe('0x50')](_0x3893cd);})[_0x6bbe('0x1f')](function(_0xa655a0){_0x5ce650[_0x6bbe('0x51')]=_0xa655a0;return _0x5ce650;})['then'](respondWithFilteredResult(_0x322beb,_0x3893cd))[_0x6bbe('0x2a')](handleError(_0x322beb,null));};exports[_0x6bbe('0x52')]=function(_0x200789,_0x3fc428){var _0x1e01e2={'raw':![],'where':{'id':_0x200789['params']['id']}},_0x29bfd0={};_0x29bfd0[_0x6bbe('0x3f')]=_[_0x6bbe('0x53')](db[_0x6bbe('0x4d')]['rawAttributes']);_0x29bfd0[_0x6bbe('0x3c')]=_['keys'](_0x200789[_0x6bbe('0x3c')]);_0x29bfd0[_0x6bbe('0x3d')]=_[_0x6bbe('0x3e')](_0x29bfd0['model'],_0x29bfd0[_0x6bbe('0x3c')]);_0x1e01e2['attributes']=_[_0x6bbe('0x3e')](_0x29bfd0[_0x6bbe('0x3f')],qs[_0x6bbe('0x41')](_0x200789[_0x6bbe('0x3c')]['fields']));_0x1e01e2[_0x6bbe('0x40')]=_0x1e01e2[_0x6bbe('0x40')][_0x6bbe('0x42')]?_0x1e01e2[_0x6bbe('0x40')]:_0x29bfd0[_0x6bbe('0x3f')];if(_0x200789[_0x6bbe('0x3c')][_0x6bbe('0x4e')]){_0x1e01e2[_0x6bbe('0x4f')]=[{'all':!![]}];}_0x1e01e2=_[_0x6bbe('0x49')]({},_0x1e01e2,_0x200789['options']);return db[_0x6bbe('0x4d')][_0x6bbe('0x54')](_0x1e01e2)[_0x6bbe('0x1f')](handleEntityNotFound(_0x3fc428,null))['then'](respondWithResult(_0x3fc428,null))[_0x6bbe('0x2a')](handleError(_0x3fc428,null));};exports[_0x6bbe('0x55')]=function(_0x32f753,_0x4d9ac0){if(_0x32f753['body']['id']){delete _0x32f753['body']['id'];}return db[_0x6bbe('0x4d')][_0x6bbe('0x54')]({'where':{'id':_0x32f753[_0x6bbe('0x56')]['id']}})['then'](handleEntityNotFound(_0x4d9ac0,null))['then'](saveUpdates(_0x32f753[_0x6bbe('0x57')],null))[_0x6bbe('0x1f')](respondWithResult(_0x4d9ac0,null))[_0x6bbe('0x2a')](handleError(_0x4d9ac0,null));};exports[_0x6bbe('0x58')]=function(_0x5ea729,_0x498bb7,_0x2ceeda){if(_0x5ea729[_0x6bbe('0x59')]&&_0x5ea729[_0x6bbe('0x59')]['filename']){_0x5ea729[_0x6bbe('0x57')][_0x6bbe('0x5a')]=_0x5ea729[_0x6bbe('0x59')][_0x6bbe('0x5b')];}return db[_0x6bbe('0x4d')][_0x6bbe('0x54')]({'where':{'id':_0x5ea729[_0x6bbe('0x56')]['id']}})[_0x6bbe('0x1f')](handleEntityNotFound(_0x498bb7,null))[_0x6bbe('0x1f')](saveUpdates(_0x5ea729[_0x6bbe('0x57')],null))[_0x6bbe('0x1f')](respondWithResult(_0x498bb7,null))[_0x6bbe('0x2a')](handleError(_0x498bb7,null));};exports[_0x6bbe('0x5c')]=function(_0x34501a,_0x2bd1b5,_0x499c5d){if(_0x34501a[_0x6bbe('0x59')]&&_0x34501a[_0x6bbe('0x59')]['filename']){_0x34501a['body'][_0x6bbe('0x5d')]=_0x34501a[_0x6bbe('0x59')][_0x6bbe('0x5b')];}return db[_0x6bbe('0x4d')][_0x6bbe('0x54')]({'where':{'id':_0x34501a[_0x6bbe('0x56')]['id']}})[_0x6bbe('0x1f')](handleEntityNotFound(_0x2bd1b5,null))[_0x6bbe('0x1f')](saveUpdates(_0x34501a[_0x6bbe('0x57')],null))[_0x6bbe('0x1f')](respondWithResult(_0x2bd1b5,null))[_0x6bbe('0x2a')](handleError(_0x2bd1b5,null));};var utilLicense=require('../../config/license/util');exports[_0x6bbe('0x5e')]=function(_0x25c34a,_0x3e8694,_0x56aafa){var _0x434f16=_0x6bbe('0x5f');var _0x1f641f={'custom':![]};return utilLicense['getLicense']()[_0x6bbe('0x1f')](function(_0x77d0db){if(_0x77d0db){_0x1f641f=_0x77d0db;}return db[_0x6bbe('0x4d')][_0x6bbe('0x54')]({'where':{'id':_0x25c34a[_0x6bbe('0x56')]['id']},'attributes':[_0x6bbe('0x5a'),_0x6bbe('0x5d'),_0x6bbe('0x60'),_0x6bbe('0x61'),'defaultLogo',_0x6bbe('0x62'),_0x6bbe('0x63'),_0x6bbe('0x64')],'raw':!![]});})[_0x6bbe('0x1f')](handleEntityNotFound(_0x3e8694,null))[_0x6bbe('0x1f')](function(_0x46ccbb){if(_0x46ccbb){var _0xff48bf=_0x46ccbb[_0x6bbe('0x5a')]&&fs[_0x6bbe('0x65')](path[_0x6bbe('0x66')](config['root'],_0x434f16,_[_0x6bbe('0x67')](_0x46ccbb[_0x6bbe('0x5a')])))?path[_0x6bbe('0x66')](config[_0x6bbe('0x68')],_0x434f16,_[_0x6bbe('0x67')](_0x46ccbb[_0x6bbe('0x5a')])):path[_0x6bbe('0x66')](config[_0x6bbe('0x68')],_0x434f16,_[_0x6bbe('0x67')](_0x6bbe('0x69')));var _0x46aae3=_0x6bbe('0x6a')+_['upperFirst'](_0x6bbe('0x5a'));if(_0x46ccbb[_0x46aae3]||!_0x1f641f[_0x6bbe('0x6b')]){_0xff48bf=path[_0x6bbe('0x66')](config[_0x6bbe('0x68')],_0x434f16,_[_0x6bbe('0x67')](_0x6bbe('0x69')));}if(!fs['existsSync'](_0xff48bf)){throw new db['Sequelize'][(_0x6bbe('0x1e'))](_[_0x6bbe('0x6c')](_0x6bbe('0x5a'))+_0x6bbe('0x6d'));}return _0x3e8694['download'](_0xff48bf);}})[_0x6bbe('0x2a')](handleError(_0x3e8694,null));};var utilLicense=require(_0x6bbe('0x6e'));exports[_0x6bbe('0x6f')]=function(_0x111a71,_0x5acadc,_0x22e1f0){var _0x14e9bc=_0x6bbe('0x5f');var _0x333eb3={'custom':![]};return utilLicense[_0x6bbe('0x70')]()[_0x6bbe('0x1f')](function(_0x33029a){if(_0x33029a){_0x333eb3=_0x33029a;}return db[_0x6bbe('0x4d')][_0x6bbe('0x54')]({'where':{'id':_0x111a71[_0x6bbe('0x56')]['id']},'attributes':[_0x6bbe('0x5a'),_0x6bbe('0x5d'),_0x6bbe('0x60'),_0x6bbe('0x61'),_0x6bbe('0x71'),'defaultLoginLogo',_0x6bbe('0x63'),_0x6bbe('0x64')],'raw':!![]});})[_0x6bbe('0x1f')](handleEntityNotFound(_0x5acadc,null))[_0x6bbe('0x1f')](function(_0x999654){if(_0x999654){var _0x4c8acc=_0x999654[_0x6bbe('0x5d')]&&fs[_0x6bbe('0x65')](path[_0x6bbe('0x66')](config[_0x6bbe('0x68')],_0x14e9bc,_[_0x6bbe('0x67')](_0x999654[_0x6bbe('0x5d')])))?path[_0x6bbe('0x66')](config['root'],_0x14e9bc,_['toLower'](_0x999654[_0x6bbe('0x5d')])):path[_0x6bbe('0x66')](config[_0x6bbe('0x68')],_0x14e9bc,_[_0x6bbe('0x67')]('default_loginLogo.svg'));var _0x8a5906=_0x6bbe('0x6a')+_['upperFirst']('loginLogo');if(_0x999654[_0x8a5906]||!_0x333eb3[_0x6bbe('0x6b')]){_0x4c8acc=path[_0x6bbe('0x66')](config['root'],_0x14e9bc,_[_0x6bbe('0x67')](_0x6bbe('0x72')));}if(!fs['existsSync'](_0x4c8acc)){throw new db['Sequelize'][(_0x6bbe('0x1e'))](_[_0x6bbe('0x6c')](_0x6bbe('0x5d'))+'\x20not\x20found');}return _0x5acadc[_0x6bbe('0x73')](_0x4c8acc);}})[_0x6bbe('0x2a')](handleError(_0x5acadc,null));};exports[_0x6bbe('0x74')]=function(_0xf6142c,_0x433098){return db[_0x6bbe('0x4d')][_0x6bbe('0x54')]({'where':{'id':_0xf6142c[_0x6bbe('0x56')]['id']},'attributes':[_0x6bbe('0x75')]})['then'](respondWithResult(_0x433098,null))[_0x6bbe('0x2a')](handleError(_0x433098,null));};exports[_0x6bbe('0x76')]=function(_0xd576cb,_0xbca365,_0x36ed76){if(_0xd576cb[_0x6bbe('0x59')]&&_0xd576cb[_0x6bbe('0x59')][_0x6bbe('0x5b')]){_0xd576cb[_0x6bbe('0x57')][_0x6bbe('0x60')]=_0xd576cb[_0x6bbe('0x59')][_0x6bbe('0x5b')];}return db[_0x6bbe('0x4d')]['find']({'where':{'id':_0xd576cb['params']['id']}})[_0x6bbe('0x1f')](handleEntityNotFound(_0xbca365,null))['then'](saveUpdates(_0xd576cb['body'],null))[_0x6bbe('0x1f')](respondWithResult(_0xbca365,null))[_0x6bbe('0x2a')](handleError(_0xbca365,null));};var utilLicense=require(_0x6bbe('0x6e'));exports[_0x6bbe('0x77')]=function(_0x2e2bfc,_0x2870d7,_0x434ab1){var _0x47094e='server/files/images/logos';var _0x82e536={'custom':![]};return utilLicense[_0x6bbe('0x70')]()['then'](function(_0xa5f672){if(_0xa5f672){_0x82e536=_0xa5f672;}return db[_0x6bbe('0x4d')]['find']({'where':{'id':_0x2e2bfc[_0x6bbe('0x56')]['id']},'attributes':['logo',_0x6bbe('0x5d'),'preferred',_0x6bbe('0x61'),_0x6bbe('0x71'),_0x6bbe('0x62'),_0x6bbe('0x63'),_0x6bbe('0x64')],'raw':!![]});})[_0x6bbe('0x1f')](handleEntityNotFound(_0x2870d7,null))[_0x6bbe('0x1f')](function(_0xf83a66){if(_0xf83a66){var _0x52f178=_0xf83a66[_0x6bbe('0x60')]&&fs['existsSync'](path[_0x6bbe('0x66')](config['root'],_0x47094e,_[_0x6bbe('0x67')](_0xf83a66[_0x6bbe('0x60')])))?path[_0x6bbe('0x66')](config[_0x6bbe('0x68')],_0x47094e,_[_0x6bbe('0x67')](_0xf83a66[_0x6bbe('0x60')])):path[_0x6bbe('0x66')](config[_0x6bbe('0x68')],_0x47094e,_[_0x6bbe('0x67')]('default_preferred.png'));var _0x37ab46=_0x6bbe('0x6a')+_['upperFirst']('preferred');if(_0xf83a66[_0x37ab46]||!_0x82e536[_0x6bbe('0x6b')]||!_0x82e536[_0x6bbe('0x60')]){_0x52f178=path[_0x6bbe('0x66')](config['root'],_0x47094e,_['toLower'](_0x6bbe('0x78')));}if(!fs[_0x6bbe('0x65')](_0x52f178)){throw new db[(_0x6bbe('0x1d'))]['ValidationError'](_[_0x6bbe('0x6c')](_0x6bbe('0x60'))+_0x6bbe('0x6d'));}return _0x2870d7['download'](_0x52f178);}})['catch'](handleError(_0x2870d7,null));};exports[_0x6bbe('0x79')]=function(_0x1f4f8b,_0x43cbbb,_0x363ce6){if(_0x1f4f8b['file']&&_0x1f4f8b[_0x6bbe('0x59')]['filename']){_0x1f4f8b[_0x6bbe('0x57')]['favicon']=_0x1f4f8b[_0x6bbe('0x59')][_0x6bbe('0x5b')];}return db[_0x6bbe('0x4d')][_0x6bbe('0x54')]({'where':{'id':_0x1f4f8b[_0x6bbe('0x56')]['id']}})[_0x6bbe('0x1f')](handleEntityNotFound(_0x43cbbb,null))[_0x6bbe('0x1f')](saveUpdates(_0x1f4f8b[_0x6bbe('0x57')],null))['then'](respondWithResult(_0x43cbbb,null))[_0x6bbe('0x2a')](handleError(_0x43cbbb,null));};var utilLicense=require(_0x6bbe('0x6e'));exports[_0x6bbe('0x7a')]=function(_0x54af39,_0x5bdb81,_0x3b8add){var _0x144140=_0x6bbe('0x5f');var _0x3835d4={'custom':![]};return utilLicense['getLicense']()[_0x6bbe('0x1f')](function(_0x12b918){if(_0x12b918){_0x3835d4=_0x12b918;}return db[_0x6bbe('0x4d')][_0x6bbe('0x54')]({'where':{'id':_0x54af39[_0x6bbe('0x56')]['id']},'attributes':[_0x6bbe('0x5a'),_0x6bbe('0x5d'),_0x6bbe('0x60'),'favicon',_0x6bbe('0x71'),_0x6bbe('0x62'),_0x6bbe('0x63'),_0x6bbe('0x64')],'raw':!![]});})[_0x6bbe('0x1f')](handleEntityNotFound(_0x5bdb81,null))[_0x6bbe('0x1f')](function(_0x51b2bf){if(_0x51b2bf){var _0x5ecc4d=_0x51b2bf[_0x6bbe('0x61')]&&fs[_0x6bbe('0x65')](path['join'](config[_0x6bbe('0x68')],_0x144140,_[_0x6bbe('0x67')](_0x51b2bf[_0x6bbe('0x61')])))?path['join'](config[_0x6bbe('0x68')],_0x144140,_['toLower'](_0x51b2bf[_0x6bbe('0x61')])):path[_0x6bbe('0x66')](config['root'],_0x144140,_['toLower'](_0x6bbe('0x7b')));var _0x831fe2=_0x6bbe('0x6a')+_[_0x6bbe('0x6c')](_0x6bbe('0x61'));if(_0x51b2bf[_0x831fe2]||!_0x3835d4['custom']){_0x5ecc4d=path['join'](config[_0x6bbe('0x68')],_0x144140,_[_0x6bbe('0x67')](_0x6bbe('0x7b')));}if(!fs[_0x6bbe('0x65')](_0x5ecc4d)){throw new db[(_0x6bbe('0x1d'))][(_0x6bbe('0x1e'))](_['upperFirst'](_0x6bbe('0x61'))+_0x6bbe('0x6d'));}return _0x5bdb81[_0x6bbe('0x73')](_0x5ecc4d);}})[_0x6bbe('0x2a')](handleError(_0x5bdb81,null));}; \ No newline at end of file +var _0x5d62=['set','apply','reject','save','destroy','stack','name','send','index','map','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','limit','sort','where','pick','filter','VIRTUAL','merge','options','count','include','Setting','findAll','rows','show','params','includeAll','find','update','body','file','filename','logo','addLogoLogin','loginLogo','getLogo','server/files/images/logos','getLicense','preferred','defaultLogo','defaultPreferred','defaultFavicon','existsSync','join','root','default','upperFirst','custom','toLower','default_logo.svg','\x20not\x20found','download','../../config/license/util','getLogoLogin','favicon','default_loginLogo.svg','gdpr','securePassword','addPreferred','defaultLoginLogo','default_preferred.png','addFavicon','default_favicon.ico','html-pdf','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','jayson/promise','client','http','test','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','info','request\x20sent','Setting,\x20%s,\x20%s,\x20%s','stringify','error','code','message','Setting,\x20%s,\x20%s','result','catch','sendStatus','status','end','json','offset'];(function(_0x52cd78,_0x15135f){var _0x101ee1=function(_0x4aede5){while(--_0x4aede5){_0x52cd78['push'](_0x52cd78['shift']());}};_0x101ee1(++_0x15135f);}(_0x5d62,0x1b8));var _0x25d6=function(_0x15fa77,_0x93eaff){_0x15fa77=_0x15fa77-0x0;var _0x1385ff=_0x5d62[_0x15fa77];return _0x1385ff;};'use strict';var pdf=require(_0x25d6('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x25d6('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x25d6('0x2'));var rp=require(_0x25d6('0x3'));var moment=require(_0x25d6('0x4'));var BPromise=require(_0x25d6('0x5'));var Mustache=require(_0x25d6('0x6'));var util=require(_0x25d6('0x7'));var path=require(_0x25d6('0x8'));var sox=require(_0x25d6('0x9'));var csv=require(_0x25d6('0xa'));var ejs=require(_0x25d6('0xb'));var fs=require('fs');var _=require(_0x25d6('0xc'));var squel=require(_0x25d6('0xd'));var crypto=require('crypto');var jsforce=require(_0x25d6('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x25d6('0xa'));var querystring=require(_0x25d6('0xf'));var Papa=require(_0x25d6('0x10'));var Redis=require('ioredis');var authService=require(_0x25d6('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x25d6('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x25d6('0x13'))(_0x25d6('0x14'));var utils=require(_0x25d6('0x15'));var config=require(_0x25d6('0x16'));var db=require(_0x25d6('0x17'))['db'];var jayson=require(_0x25d6('0x18'));var client=jayson[_0x25d6('0x19')][_0x25d6('0x1a')]({'port':0x232a});function checkPasswordPattern(_0x1c7e94,_0x1e2bb4,_0x6eed52){if(_0x6eed52){var _0x27f131=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x27f131[_0x25d6('0x1b')](_0x1e2bb4)){return _0x1c7e94;}else{throw new db[(_0x25d6('0x1c'))][(_0x25d6('0x1d'))](_0x25d6('0x1e'));}}else{return _0x1c7e94;}}function respondWithRpcPromise(_0x5d6f4d,_0x221525,_0x4f1079,_0x4bf46e){return new BPromise(function(_0x1d70c0,_0x4568f2){var _0xa6f946=_0x4bf46e||client;return _0xa6f946[_0x25d6('0x1f')](_0x5d6f4d,_0x4f1079)[_0x25d6('0x20')](function(_0x4b125b){logger[_0x25d6('0x21')]('Setting,\x20%s,\x20%s',_0x221525,_0x25d6('0x22'));logger['debug'](_0x25d6('0x23'),_0x221525,'request\x20sent',JSON[_0x25d6('0x24')](_0x4b125b));if(_0x4b125b[_0x25d6('0x25')]){if(_0x4b125b['error'][_0x25d6('0x26')]===0x1f4){logger['error']('Setting,\x20%s,\x20%s',_0x221525,_0x4b125b[_0x25d6('0x25')][_0x25d6('0x27')]);return _0x4568f2(_0x4b125b[_0x25d6('0x25')][_0x25d6('0x27')]);}logger[_0x25d6('0x25')](_0x25d6('0x28'),_0x221525,_0x4b125b[_0x25d6('0x25')]['message']);return _0x1d70c0(_0x4b125b[_0x25d6('0x25')][_0x25d6('0x27')]);}else{logger[_0x25d6('0x21')](_0x25d6('0x28'),_0x221525,_0x25d6('0x22'));_0x1d70c0(_0x4b125b[_0x25d6('0x29')][_0x25d6('0x27')]);}})[_0x25d6('0x2a')](function(_0x3fec65){logger[_0x25d6('0x25')]('Setting,\x20%s,\x20%s',_0x221525,_0x3fec65);_0x4568f2(_0x3fec65);});});}function respondWithStatusCode(_0x2beb4b,_0x4f0030){_0x4f0030=_0x4f0030||0xcc;return function(_0x39d88b){if(_0x39d88b){return _0x2beb4b[_0x25d6('0x2b')](_0x4f0030);}return _0x2beb4b[_0x25d6('0x2c')](_0x4f0030)[_0x25d6('0x2d')]();};}function respondWithResult(_0x1c2b5e,_0x6bd56a){_0x6bd56a=_0x6bd56a||0xc8;return function(_0x5e369e){if(_0x5e369e){return _0x1c2b5e[_0x25d6('0x2c')](_0x6bd56a)[_0x25d6('0x2e')](_0x5e369e);}};}function respondWithFilteredResult(_0x47e92a,_0x139686){return function(_0x121a8a){if(_0x121a8a){var _0x9b2ea8=_0x121a8a['count'],_0x48cc41=_0x139686[_0x25d6('0x2f')],_0x10c71a=_0x139686[_0x25d6('0x2f')]+_0x139686['limit'],_0x4e6c87;if(_0x10c71a>=_0x9b2ea8){_0x10c71a=_0x9b2ea8;_0x4e6c87=0xc8;}else{_0x4e6c87=0xce;}_0x47e92a[_0x25d6('0x2c')](_0x4e6c87);return _0x47e92a[_0x25d6('0x30')]('Content-Range',_0x48cc41+'-'+_0x10c71a+'/'+_0x9b2ea8)[_0x25d6('0x2e')](_0x121a8a);}return null;};}function patchUpdates(_0x2c1989){return function(_0x26846f){try{jsonpatch[_0x25d6('0x31')](_0x26846f,_0x2c1989,!![]);}catch(_0x4a2869){return BPromise[_0x25d6('0x32')](_0x4a2869);}return _0x26846f[_0x25d6('0x33')]();};}function saveUpdates(_0x446b2f,_0x447000){return function(_0x587771){if(_0x587771){return _0x587771['update'](_0x446b2f)['then'](function(_0x508181){return _0x508181;});}return null;};}function removeEntity(_0x233ac0,_0x1d16b5){return function(_0x3c3dc1){if(_0x3c3dc1){return _0x3c3dc1[_0x25d6('0x34')]()['then'](function(){_0x233ac0['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x42d9e2,_0x100e3d){return function(_0x52aed0){if(!_0x52aed0){_0x42d9e2[_0x25d6('0x2b')](0x194);}return _0x52aed0;};}function handleError(_0x587101,_0x3463da){_0x3463da=_0x3463da||0x1f4;return function(_0x47159b){logger[_0x25d6('0x25')](_0x47159b[_0x25d6('0x35')]);if(_0x47159b['name']){delete _0x47159b[_0x25d6('0x36')];}_0x587101[_0x25d6('0x2c')](_0x3463da)[_0x25d6('0x37')](_0x47159b);};}exports[_0x25d6('0x38')]=function(_0x48f92b,_0x52f738){var _0x2bf3eb={},_0x41f06a={},_0x25fe3a={'count':0x0,'rows':[]};var _0x443624=_[_0x25d6('0x39')](db['Setting']['rawAttributes'],function(_0x34628b){return{'name':_0x34628b[_0x25d6('0x3a')],'type':_0x34628b[_0x25d6('0x3b')][_0x25d6('0x3c')]};});_0x41f06a[_0x25d6('0x3d')]=_['map'](_0x443624,_0x25d6('0x36'));_0x41f06a[_0x25d6('0x3e')]=_[_0x25d6('0x3f')](_0x48f92b['query']);_0x41f06a[_0x25d6('0x40')]=_['intersection'](_0x41f06a[_0x25d6('0x3d')],_0x41f06a['query']);_0x2bf3eb[_0x25d6('0x41')]=_[_0x25d6('0x42')](_0x41f06a[_0x25d6('0x3d')],qs['fields'](_0x48f92b[_0x25d6('0x3e')][_0x25d6('0x43')]));_0x2bf3eb['attributes']=_0x2bf3eb[_0x25d6('0x41')][_0x25d6('0x44')]?_0x2bf3eb['attributes']:_0x41f06a[_0x25d6('0x3d')];if(!_0x48f92b['query'][_0x25d6('0x45')]('nolimit')){_0x2bf3eb[_0x25d6('0x46')]=qs['limit'](_0x48f92b[_0x25d6('0x3e')][_0x25d6('0x46')]);_0x2bf3eb[_0x25d6('0x2f')]=qs[_0x25d6('0x2f')](_0x48f92b[_0x25d6('0x3e')][_0x25d6('0x2f')]);}_0x2bf3eb['order']=qs['sort'](_0x48f92b[_0x25d6('0x3e')][_0x25d6('0x47')]);_0x2bf3eb[_0x25d6('0x48')]=qs[_0x25d6('0x40')](_[_0x25d6('0x49')](_0x48f92b['query'],_0x41f06a[_0x25d6('0x40')]),_0x443624);if(_0x48f92b[_0x25d6('0x3e')][_0x25d6('0x4a')]){_0x2bf3eb[_0x25d6('0x48')]=_['merge'](_0x2bf3eb[_0x25d6('0x48')],{'$or':_[_0x25d6('0x39')](_0x443624,function(_0x30b6e9){if(_0x30b6e9['type']!==_0x25d6('0x4b')){var _0x362d3a={};_0x362d3a[_0x30b6e9[_0x25d6('0x36')]]={'$like':'%'+_0x48f92b[_0x25d6('0x3e')][_0x25d6('0x4a')]+'%'};return _0x362d3a;}})});}_0x2bf3eb=_[_0x25d6('0x4c')]({},_0x2bf3eb,_0x48f92b[_0x25d6('0x4d')]);var _0x702927={'where':_0x2bf3eb['where']};return db['Setting'][_0x25d6('0x4e')](_0x702927)[_0x25d6('0x20')](function(_0x30eb60){_0x25fe3a['count']=_0x30eb60;if(_0x48f92b['query']['includeAll']){_0x2bf3eb[_0x25d6('0x4f')]=[{'all':!![]}];}return db[_0x25d6('0x50')][_0x25d6('0x51')](_0x2bf3eb);})[_0x25d6('0x20')](function(_0x49d55d){_0x25fe3a[_0x25d6('0x52')]=_0x49d55d;return _0x25fe3a;})[_0x25d6('0x20')](respondWithFilteredResult(_0x52f738,_0x2bf3eb))[_0x25d6('0x2a')](handleError(_0x52f738,null));};exports[_0x25d6('0x53')]=function(_0x4f5f89,_0x38eafa){var _0x33f76e={'raw':![],'where':{'id':_0x4f5f89[_0x25d6('0x54')]['id']}},_0x4429a4={};_0x4429a4['model']=_[_0x25d6('0x3f')](db[_0x25d6('0x50')]['rawAttributes']);_0x4429a4[_0x25d6('0x3e')]=_[_0x25d6('0x3f')](_0x4f5f89[_0x25d6('0x3e')]);_0x4429a4[_0x25d6('0x40')]=_['intersection'](_0x4429a4[_0x25d6('0x3d')],_0x4429a4[_0x25d6('0x3e')]);_0x33f76e[_0x25d6('0x41')]=_[_0x25d6('0x42')](_0x4429a4[_0x25d6('0x3d')],qs[_0x25d6('0x43')](_0x4f5f89['query']['fields']));_0x33f76e[_0x25d6('0x41')]=_0x33f76e[_0x25d6('0x41')][_0x25d6('0x44')]?_0x33f76e[_0x25d6('0x41')]:_0x4429a4[_0x25d6('0x3d')];if(_0x4f5f89[_0x25d6('0x3e')][_0x25d6('0x55')]){_0x33f76e[_0x25d6('0x4f')]=[{'all':!![]}];}_0x33f76e=_[_0x25d6('0x4c')]({},_0x33f76e,_0x4f5f89[_0x25d6('0x4d')]);return db[_0x25d6('0x50')][_0x25d6('0x56')](_0x33f76e)['then'](handleEntityNotFound(_0x38eafa,null))[_0x25d6('0x20')](respondWithResult(_0x38eafa,null))[_0x25d6('0x2a')](handleError(_0x38eafa,null));};exports[_0x25d6('0x57')]=function(_0x14c82a,_0x26048d){if(_0x14c82a['body']['id']){delete _0x14c82a[_0x25d6('0x58')]['id'];}return db[_0x25d6('0x50')]['find']({'where':{'id':_0x14c82a[_0x25d6('0x54')]['id']}})['then'](handleEntityNotFound(_0x26048d,null))[_0x25d6('0x20')](saveUpdates(_0x14c82a[_0x25d6('0x58')],null))[_0x25d6('0x20')](respondWithResult(_0x26048d,null))[_0x25d6('0x2a')](handleError(_0x26048d,null));};exports['addLogo']=function(_0x2fe89f,_0x1f83ed,_0x3d5c9c){if(_0x2fe89f[_0x25d6('0x59')]&&_0x2fe89f[_0x25d6('0x59')][_0x25d6('0x5a')]){_0x2fe89f['body'][_0x25d6('0x5b')]=_0x2fe89f[_0x25d6('0x59')][_0x25d6('0x5a')];}return db['Setting']['find']({'where':{'id':_0x2fe89f[_0x25d6('0x54')]['id']}})[_0x25d6('0x20')](handleEntityNotFound(_0x1f83ed,null))['then'](saveUpdates(_0x2fe89f[_0x25d6('0x58')],null))[_0x25d6('0x20')](respondWithResult(_0x1f83ed,null))[_0x25d6('0x2a')](handleError(_0x1f83ed,null));};exports[_0x25d6('0x5c')]=function(_0x22bb4e,_0x5a7d32,_0x2a137e){if(_0x22bb4e[_0x25d6('0x59')]&&_0x22bb4e[_0x25d6('0x59')][_0x25d6('0x5a')]){_0x22bb4e[_0x25d6('0x58')][_0x25d6('0x5d')]=_0x22bb4e[_0x25d6('0x59')][_0x25d6('0x5a')];}return db[_0x25d6('0x50')][_0x25d6('0x56')]({'where':{'id':_0x22bb4e[_0x25d6('0x54')]['id']}})['then'](handleEntityNotFound(_0x5a7d32,null))['then'](saveUpdates(_0x22bb4e['body'],null))[_0x25d6('0x20')](respondWithResult(_0x5a7d32,null))['catch'](handleError(_0x5a7d32,null));};var utilLicense=require('../../config/license/util');exports[_0x25d6('0x5e')]=function(_0x1b4069,_0x1427e4,_0x2ef3fd){var _0x51f830=_0x25d6('0x5f');var _0x1f9f68={'custom':![]};return utilLicense[_0x25d6('0x60')]()[_0x25d6('0x20')](function(_0x406893){if(_0x406893){_0x1f9f68=_0x406893;}return db[_0x25d6('0x50')][_0x25d6('0x56')]({'where':{'id':_0x1b4069[_0x25d6('0x54')]['id']},'attributes':['logo',_0x25d6('0x5d'),_0x25d6('0x61'),'favicon',_0x25d6('0x62'),'defaultLoginLogo',_0x25d6('0x63'),_0x25d6('0x64')],'raw':!![]});})[_0x25d6('0x20')](handleEntityNotFound(_0x1427e4,null))[_0x25d6('0x20')](function(_0x192127){if(_0x192127){var _0x102b45=_0x192127['logo']&&fs[_0x25d6('0x65')](path[_0x25d6('0x66')](config[_0x25d6('0x67')],_0x51f830,_['toLower'](_0x192127['logo'])))?path[_0x25d6('0x66')](config['root'],_0x51f830,_['toLower'](_0x192127[_0x25d6('0x5b')])):path[_0x25d6('0x66')](config[_0x25d6('0x67')],_0x51f830,_['toLower']('default_logo.svg'));var _0x5f1e69=_0x25d6('0x68')+_[_0x25d6('0x69')]('logo');if(_0x192127[_0x5f1e69]||!_0x1f9f68[_0x25d6('0x6a')]){_0x102b45=path['join'](config[_0x25d6('0x67')],_0x51f830,_[_0x25d6('0x6b')](_0x25d6('0x6c')));}if(!fs[_0x25d6('0x65')](_0x102b45)){throw new db['Sequelize'][(_0x25d6('0x1d'))](_[_0x25d6('0x69')]('logo')+_0x25d6('0x6d'));}return _0x1427e4[_0x25d6('0x6e')](_0x102b45);}})[_0x25d6('0x2a')](handleError(_0x1427e4,null));};var utilLicense=require(_0x25d6('0x6f'));exports[_0x25d6('0x70')]=function(_0x3c1dfd,_0x22a9e3,_0x14e597){var _0x464bcb=_0x25d6('0x5f');var _0x50ca78={'custom':![]};return utilLicense['getLicense']()['then'](function(_0x1f141a){if(_0x1f141a){_0x50ca78=_0x1f141a;}return db[_0x25d6('0x50')][_0x25d6('0x56')]({'where':{'id':_0x3c1dfd[_0x25d6('0x54')]['id']},'attributes':[_0x25d6('0x5b'),_0x25d6('0x5d'),_0x25d6('0x61'),_0x25d6('0x71'),'defaultLogo','defaultLoginLogo',_0x25d6('0x63'),'defaultFavicon'],'raw':!![]});})[_0x25d6('0x20')](handleEntityNotFound(_0x22a9e3,null))[_0x25d6('0x20')](function(_0x5b9277){if(_0x5b9277){var _0x124294=_0x5b9277[_0x25d6('0x5d')]&&fs[_0x25d6('0x65')](path[_0x25d6('0x66')](config[_0x25d6('0x67')],_0x464bcb,_[_0x25d6('0x6b')](_0x5b9277[_0x25d6('0x5d')])))?path[_0x25d6('0x66')](config[_0x25d6('0x67')],_0x464bcb,_['toLower'](_0x5b9277[_0x25d6('0x5d')])):path['join'](config['root'],_0x464bcb,_[_0x25d6('0x6b')](_0x25d6('0x72')));var _0xbfe17d=_0x25d6('0x68')+_[_0x25d6('0x69')](_0x25d6('0x5d'));if(_0x5b9277[_0xbfe17d]||!_0x50ca78['custom']){_0x124294=path[_0x25d6('0x66')](config[_0x25d6('0x67')],_0x464bcb,_['toLower']('default_loginLogo.svg'));}if(!fs[_0x25d6('0x65')](_0x124294)){throw new db['Sequelize']['ValidationError'](_[_0x25d6('0x69')](_0x25d6('0x5d'))+'\x20not\x20found');}return _0x22a9e3[_0x25d6('0x6e')](_0x124294);}})[_0x25d6('0x2a')](handleError(_0x22a9e3,null));};exports[_0x25d6('0x73')]=function(_0x4c5c84,_0x3bd10a){return db[_0x25d6('0x50')][_0x25d6('0x56')]({'where':{'id':_0x4c5c84[_0x25d6('0x54')]['id']},'attributes':[_0x25d6('0x74')]})[_0x25d6('0x20')](respondWithResult(_0x3bd10a,null))[_0x25d6('0x2a')](handleError(_0x3bd10a,null));};exports[_0x25d6('0x75')]=function(_0x2798a5,_0x1dec07,_0x2bd7ca){if(_0x2798a5['file']&&_0x2798a5['file']['filename']){_0x2798a5[_0x25d6('0x58')]['preferred']=_0x2798a5[_0x25d6('0x59')][_0x25d6('0x5a')];}return db[_0x25d6('0x50')][_0x25d6('0x56')]({'where':{'id':_0x2798a5[_0x25d6('0x54')]['id']}})[_0x25d6('0x20')](handleEntityNotFound(_0x1dec07,null))['then'](saveUpdates(_0x2798a5[_0x25d6('0x58')],null))[_0x25d6('0x20')](respondWithResult(_0x1dec07,null))[_0x25d6('0x2a')](handleError(_0x1dec07,null));};var utilLicense=require(_0x25d6('0x6f'));exports['getPreferred']=function(_0x5d2ccc,_0x4b29a8,_0x58000d){var _0x150fd5=_0x25d6('0x5f');var _0x221d40={'custom':![]};return utilLicense['getLicense']()[_0x25d6('0x20')](function(_0x298704){if(_0x298704){_0x221d40=_0x298704;}return db[_0x25d6('0x50')][_0x25d6('0x56')]({'where':{'id':_0x5d2ccc[_0x25d6('0x54')]['id']},'attributes':[_0x25d6('0x5b'),_0x25d6('0x5d'),_0x25d6('0x61'),_0x25d6('0x71'),_0x25d6('0x62'),_0x25d6('0x76'),'defaultPreferred',_0x25d6('0x64')],'raw':!![]});})[_0x25d6('0x20')](handleEntityNotFound(_0x4b29a8,null))[_0x25d6('0x20')](function(_0x59d12c){if(_0x59d12c){var _0x496a10=_0x59d12c[_0x25d6('0x61')]&&fs[_0x25d6('0x65')](path[_0x25d6('0x66')](config[_0x25d6('0x67')],_0x150fd5,_[_0x25d6('0x6b')](_0x59d12c[_0x25d6('0x61')])))?path[_0x25d6('0x66')](config['root'],_0x150fd5,_[_0x25d6('0x6b')](_0x59d12c['preferred'])):path['join'](config[_0x25d6('0x67')],_0x150fd5,_[_0x25d6('0x6b')](_0x25d6('0x77')));var _0x571708=_0x25d6('0x68')+_[_0x25d6('0x69')](_0x25d6('0x61'));if(_0x59d12c[_0x571708]||!_0x221d40[_0x25d6('0x6a')]||!_0x221d40[_0x25d6('0x61')]){_0x496a10=path[_0x25d6('0x66')](config[_0x25d6('0x67')],_0x150fd5,_['toLower'](_0x25d6('0x77')));}if(!fs[_0x25d6('0x65')](_0x496a10)){throw new db[(_0x25d6('0x1c'))][(_0x25d6('0x1d'))](_['upperFirst'](_0x25d6('0x61'))+_0x25d6('0x6d'));}return _0x4b29a8[_0x25d6('0x6e')](_0x496a10);}})['catch'](handleError(_0x4b29a8,null));};exports[_0x25d6('0x78')]=function(_0x57c47c,_0x2dbb0d,_0x4c58f2){if(_0x57c47c['file']&&_0x57c47c[_0x25d6('0x59')]['filename']){_0x57c47c[_0x25d6('0x58')][_0x25d6('0x71')]=_0x57c47c['file'][_0x25d6('0x5a')];}return db[_0x25d6('0x50')][_0x25d6('0x56')]({'where':{'id':_0x57c47c['params']['id']}})[_0x25d6('0x20')](handleEntityNotFound(_0x2dbb0d,null))[_0x25d6('0x20')](saveUpdates(_0x57c47c[_0x25d6('0x58')],null))[_0x25d6('0x20')](respondWithResult(_0x2dbb0d,null))[_0x25d6('0x2a')](handleError(_0x2dbb0d,null));};var utilLicense=require('../../config/license/util');exports['getFavicon']=function(_0x3c038f,_0x4c30d9,_0x69ea64){var _0x5221dd=_0x25d6('0x5f');var _0xf2dfb7={'custom':![]};return utilLicense[_0x25d6('0x60')]()['then'](function(_0x2f1a72){if(_0x2f1a72){_0xf2dfb7=_0x2f1a72;}return db[_0x25d6('0x50')][_0x25d6('0x56')]({'where':{'id':_0x3c038f[_0x25d6('0x54')]['id']},'attributes':['logo',_0x25d6('0x5d'),'preferred',_0x25d6('0x71'),_0x25d6('0x62'),_0x25d6('0x76'),_0x25d6('0x63'),_0x25d6('0x64')],'raw':!![]});})[_0x25d6('0x20')](handleEntityNotFound(_0x4c30d9,null))[_0x25d6('0x20')](function(_0x2e48b7){if(_0x2e48b7){var _0x3e55d6=_0x2e48b7[_0x25d6('0x71')]&&fs[_0x25d6('0x65')](path[_0x25d6('0x66')](config[_0x25d6('0x67')],_0x5221dd,_[_0x25d6('0x6b')](_0x2e48b7['favicon'])))?path[_0x25d6('0x66')](config[_0x25d6('0x67')],_0x5221dd,_[_0x25d6('0x6b')](_0x2e48b7[_0x25d6('0x71')])):path[_0x25d6('0x66')](config[_0x25d6('0x67')],_0x5221dd,_[_0x25d6('0x6b')](_0x25d6('0x79')));var _0x5cbae1=_0x25d6('0x68')+_['upperFirst']('favicon');if(_0x2e48b7[_0x5cbae1]||!_0xf2dfb7[_0x25d6('0x6a')]){_0x3e55d6=path[_0x25d6('0x66')](config['root'],_0x5221dd,_[_0x25d6('0x6b')]('default_favicon.ico'));}if(!fs[_0x25d6('0x65')](_0x3e55d6)){throw new db['Sequelize'][(_0x25d6('0x1d'))](_[_0x25d6('0x69')](_0x25d6('0x71'))+_0x25d6('0x6d'));}return _0x4c30d9[_0x25d6('0x6e')](_0x3e55d6);}})[_0x25d6('0x2a')](handleError(_0x4c30d9,null));}; \ No newline at end of file diff --git a/server/api/setting/setting.model.js b/server/api/setting/setting.model.js index 547f5b5..c1330fc 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 _0x3033=['../../config/logger','api','bluebird','path','rimraf','../../config/environment','./setting.attributes','Setting','settings','lodash'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0x3033,0x1cb));var _0x3303=function(_0x435636,_0x4879d9){_0x435636=_0x435636-0x0;var _0x3ea40e=_0x3033[_0x435636];return _0x3ea40e;};'use strict';var _=require(_0x3303('0x0'));var util=require('util');var logger=require(_0x3303('0x1'))(_0x3303('0x2'));var moment=require('moment');var BPromise=require(_0x3303('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x3303('0x4'));var rimraf=require(_0x3303('0x5'));var config=require(_0x3303('0x6'));var attributes=require(_0x3303('0x7'));module['exports']=function(_0x16d8f7,_0x468de5){return _0x16d8f7['define'](_0x3303('0x8'),attributes,{'tableName':_0x3303('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd0ef=['api','bluebird','request-promise','rimraf','./setting.attributes','Setting','lodash','util'];(function(_0x315a8a,_0x4ffb71){var _0x3f71ab=function(_0x4b051e){while(--_0x4b051e){_0x315a8a['push'](_0x315a8a['shift']());}};_0x3f71ab(++_0x4ffb71);}(_0xd0ef,0xce));var _0xfd0e=function(_0x29fe2b,_0x1db754){_0x29fe2b=_0x29fe2b-0x0;var _0x53c526=_0xd0ef[_0x29fe2b];return _0x53c526;};'use strict';var _=require(_0xfd0e('0x0'));var util=require(_0xfd0e('0x1'));var logger=require('../../config/logger')(_0xfd0e('0x2'));var moment=require('moment');var BPromise=require(_0xfd0e('0x3'));var rp=require(_0xfd0e('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xfd0e('0x5'));var config=require('../../config/environment');var attributes=require(_0xfd0e('0x6'));module['exports']=function(_0x18c4aa,_0x4c64ec){return _0x18c4aa['define'](_0xfd0e('0x7'),attributes,{'tableName':'settings','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/setting/setting.rpc.js b/server/api/setting/setting.rpc.js index 15c6ee8..26ea4c2 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 _0x17a8=['catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','Setting,\x20%s,\x20%s,\x20%s','stringify','error','code','Setting,\x20%s,\x20%s','message'];(function(_0x7efe31,_0x1b42d3){var _0x59ea5a=function(_0x299f73){while(--_0x299f73){_0x7efe31['push'](_0x7efe31['shift']());}};_0x59ea5a(++_0x1b42d3);}(_0x17a8,0x1aa));var _0x817a=function(_0x34c825,_0x44cad4){_0x34c825=_0x34c825-0x0;var _0x2fde13=_0x17a8[_0x34c825];return _0x2fde13;};'use strict';var _=require(_0x817a('0x0'));var util=require('util');var moment=require(_0x817a('0x1'));var BPromise=require(_0x817a('0x2'));var rs=require(_0x817a('0x3'));var fs=require('fs');var Redis=require(_0x817a('0x4'));var db=require(_0x817a('0x5'))['db'];var utils=require(_0x817a('0x6'));var logger=require(_0x817a('0x7'))(_0x817a('0x8'));var config=require(_0x817a('0x9'));var jayson=require(_0x817a('0xa'));var client=jayson[_0x817a('0xb')][_0x817a('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x2b1392,_0xa17b23,_0x39dd66){return new BPromise(function(_0x3e98d9,_0x805923){return client[_0x817a('0xd')](_0x2b1392,_0x39dd66)[_0x817a('0xe')](function(_0x23eb6d){logger[_0x817a('0xf')]('Setting,\x20%s,\x20%s',_0xa17b23,_0x817a('0x10'));logger[_0x817a('0x11')](_0x817a('0x12'),_0xa17b23,_0x817a('0x10'),JSON[_0x817a('0x13')](_0x23eb6d));if(_0x23eb6d['error']){if(_0x23eb6d[_0x817a('0x14')][_0x817a('0x15')]===0x1f4){logger['error'](_0x817a('0x16'),_0xa17b23,_0x23eb6d[_0x817a('0x14')][_0x817a('0x17')]);return _0x805923(_0x23eb6d[_0x817a('0x14')]['message']);}logger['error'](_0x817a('0x16'),_0xa17b23,_0x23eb6d[_0x817a('0x14')][_0x817a('0x17')]);return _0x3e98d9(_0x23eb6d['error'][_0x817a('0x17')]);}else{logger[_0x817a('0xf')](_0x817a('0x16'),_0xa17b23,_0x817a('0x10'));_0x3e98d9(_0x23eb6d['result'][_0x817a('0x17')]);}})[_0x817a('0x18')](function(_0x1e19ae){logger[_0x817a('0x14')](_0x817a('0x16'),_0xa17b23,_0x1e19ae);_0x805923(_0x1e19ae);});});} \ No newline at end of file +var _0x50ef=['client','http','request','then','info','request\x20sent','debug','stringify','error','Setting,\x20%s,\x20%s','message','result','catch','util','moment','bluebird','randomstring','../../config/utils','rpc','jayson/promise'];(function(_0x8ba19a,_0x1d2b2b){var _0x2bd8b4=function(_0xee823f){while(--_0xee823f){_0x8ba19a['push'](_0x8ba19a['shift']());}};_0x2bd8b4(++_0x1d2b2b);}(_0x50ef,0x1c5));var _0xf50e=function(_0x407fc5,_0x1e8028){_0x407fc5=_0x407fc5-0x0;var _0x35b8c5=_0x50ef[_0x407fc5];return _0x35b8c5;};'use strict';var _=require('lodash');var util=require(_0xf50e('0x0'));var moment=require(_0xf50e('0x1'));var BPromise=require(_0xf50e('0x2'));var rs=require(_0xf50e('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xf50e('0x4'));var logger=require('../../config/logger')(_0xf50e('0x5'));var config=require('../../config/environment');var jayson=require(_0xf50e('0x6'));var client=jayson[_0xf50e('0x7')][_0xf50e('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x13682c,_0x322c81,_0x3f19a4){return new BPromise(function(_0x52031a,_0x5d2edd){return client[_0xf50e('0x9')](_0x13682c,_0x3f19a4)[_0xf50e('0xa')](function(_0x24ae91){logger[_0xf50e('0xb')]('Setting,\x20%s,\x20%s',_0x322c81,_0xf50e('0xc'));logger[_0xf50e('0xd')]('Setting,\x20%s,\x20%s,\x20%s',_0x322c81,_0xf50e('0xc'),JSON[_0xf50e('0xe')](_0x24ae91));if(_0x24ae91[_0xf50e('0xf')]){if(_0x24ae91[_0xf50e('0xf')]['code']===0x1f4){logger[_0xf50e('0xf')](_0xf50e('0x10'),_0x322c81,_0x24ae91[_0xf50e('0xf')][_0xf50e('0x11')]);return _0x5d2edd(_0x24ae91[_0xf50e('0xf')][_0xf50e('0x11')]);}logger[_0xf50e('0xf')](_0xf50e('0x10'),_0x322c81,_0x24ae91[_0xf50e('0xf')][_0xf50e('0x11')]);return _0x52031a(_0x24ae91['error'][_0xf50e('0x11')]);}else{logger['info']('Setting,\x20%s,\x20%s',_0x322c81,_0xf50e('0xc'));_0x52031a(_0x24ae91[_0xf50e('0x12')][_0xf50e('0x11')]);}})[_0xf50e('0x13')](function(_0x553419){logger['error'](_0xf50e('0x10'),_0x322c81,_0x553419);_0x5d2edd(_0x553419);});});} \ No newline at end of file diff --git a/server/api/smsAccount/index.js b/server/api/smsAccount/index.js index 51b0682..3528c0b 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 _0xdd01=['getAgents','post','create','/:id/dispositions','addAnswer','/:id/notify','addApplications','/:id/send','send','addAgents','put','delete','removeDispositions','exports','util','connect-timeout','express','Router','./smsAccount.controller','get','/describe','isAuthenticated','describe','/:id/canned_answers','getAnswers','/:id/applications','getApplications','/:id/interactions','getInteractions','/:id/status','statusGet','/:id/users'];(function(_0x42bd25,_0x4f49ca){var _0xf56d63=function(_0x2cc6ec){while(--_0x2cc6ec){_0x42bd25['push'](_0x42bd25['shift']());}};_0xf56d63(++_0x4f49ca);}(_0xdd01,0x1ce));var _0x1dd0=function(_0x2dadb9,_0x42cfe6){_0x2dadb9=_0x2dadb9-0x0;var _0x2f0097=_0xdd01[_0x2dadb9];return _0x2f0097;};'use strict';var multer=require('multer');var util=require(_0x1dd0('0x0'));var path=require('path');var timeout=require(_0x1dd0('0x1'));var express=require(_0x1dd0('0x2'));var router=express[_0x1dd0('0x3')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x1dd0('0x4'));router[_0x1dd0('0x5')]('/',auth['isAuthenticated'](),controller['index']);router[_0x1dd0('0x5')](_0x1dd0('0x6'),auth[_0x1dd0('0x7')](),controller[_0x1dd0('0x8')]);router[_0x1dd0('0x5')]('/:id',auth[_0x1dd0('0x7')](),controller['show']);router['get']('/:id/dispositions',auth[_0x1dd0('0x7')](),controller['getDispositions']);router['get'](_0x1dd0('0x9'),auth[_0x1dd0('0x7')](),controller[_0x1dd0('0xa')]);router[_0x1dd0('0x5')](_0x1dd0('0xb'),auth[_0x1dd0('0x7')](),controller[_0x1dd0('0xc')]);router['get'](_0x1dd0('0xd'),auth[_0x1dd0('0x7')](),controller[_0x1dd0('0xe')]);router[_0x1dd0('0x5')](_0x1dd0('0xf'),controller[_0x1dd0('0x10')]);router[_0x1dd0('0x5')](_0x1dd0('0x11'),auth[_0x1dd0('0x7')](),controller[_0x1dd0('0x12')]);router[_0x1dd0('0x13')]('/',auth[_0x1dd0('0x7')](),controller[_0x1dd0('0x14')]);router[_0x1dd0('0x13')](_0x1dd0('0x15'),auth['isAuthenticated'](),controller['addDisposition']);router['post'](_0x1dd0('0x9'),auth['isAuthenticated'](),controller[_0x1dd0('0x16')]);router['post'](_0x1dd0('0x17'),controller['notify']);router[_0x1dd0('0x13')](_0x1dd0('0xb'),auth[_0x1dd0('0x7')](),controller[_0x1dd0('0x18')]);router[_0x1dd0('0x13')](_0x1dd0('0x19'),auth['isAuthenticated'](),controller[_0x1dd0('0x1a')]);router[_0x1dd0('0x13')]('/:id/status',controller['status']);router[_0x1dd0('0x13')](_0x1dd0('0x11'),auth[_0x1dd0('0x7')](),controller[_0x1dd0('0x1b')]);router[_0x1dd0('0x1c')]('/:id',auth[_0x1dd0('0x7')](),controller['update']);router[_0x1dd0('0x1d')]('/:id',auth[_0x1dd0('0x7')](),controller['destroy']);router['delete'](_0x1dd0('0x15'),auth['isAuthenticated'](),controller[_0x1dd0('0x1e')]);router[_0x1dd0('0x1d')](_0x1dd0('0x9'),auth[_0x1dd0('0x7')](),controller['removeAnswers']);router[_0x1dd0('0x1d')](_0x1dd0('0x11'),auth[_0x1dd0('0x7')](),controller['removeAgents']);module[_0x1dd0('0x1f')]=router; \ No newline at end of file +var _0xd446=['/:id/status','statusGet','/:id/users','getAgents','create','post','addAnswer','/:id/applications','addApplications','/:id/send','status','put','update','delete','/:id','destroy','removeDispositions','removeAnswers','exports','path','Router','../../components/auth/service','../../components/interaction/service','./smsAccount.controller','get','isAuthenticated','index','/describe','show','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','getApplications','/:id/interactions'];(function(_0x4d18f3,_0x57d0cd){var _0x414acd=function(_0x5c5a89){while(--_0x5c5a89){_0x4d18f3['push'](_0x4d18f3['shift']());}};_0x414acd(++_0x57d0cd);}(_0xd446,0xc2));var _0x6d44=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xd446[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x6d44('0x0'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x6d44('0x1')]();var auth=require(_0x6d44('0x2'));var interaction=require(_0x6d44('0x3'));var config=require('../../config/environment');var controller=require(_0x6d44('0x4'));router[_0x6d44('0x5')]('/',auth[_0x6d44('0x6')](),controller[_0x6d44('0x7')]);router[_0x6d44('0x5')](_0x6d44('0x8'),auth[_0x6d44('0x6')](),controller['describe']);router['get']('/:id',auth[_0x6d44('0x6')](),controller[_0x6d44('0x9')]);router[_0x6d44('0x5')](_0x6d44('0xa'),auth[_0x6d44('0x6')](),controller[_0x6d44('0xb')]);router[_0x6d44('0x5')](_0x6d44('0xc'),auth[_0x6d44('0x6')](),controller[_0x6d44('0xd')]);router[_0x6d44('0x5')]('/:id/applications',auth['isAuthenticated'](),controller[_0x6d44('0xe')]);router[_0x6d44('0x5')](_0x6d44('0xf'),auth['isAuthenticated'](),controller['getInteractions']);router[_0x6d44('0x5')](_0x6d44('0x10'),controller[_0x6d44('0x11')]);router[_0x6d44('0x5')](_0x6d44('0x12'),auth[_0x6d44('0x6')](),controller[_0x6d44('0x13')]);router['post']('/',auth[_0x6d44('0x6')](),controller[_0x6d44('0x14')]);router['post'](_0x6d44('0xa'),auth[_0x6d44('0x6')](),controller['addDisposition']);router[_0x6d44('0x15')](_0x6d44('0xc'),auth['isAuthenticated'](),controller[_0x6d44('0x16')]);router['post']('/:id/notify',controller['notify']);router[_0x6d44('0x15')](_0x6d44('0x17'),auth['isAuthenticated'](),controller[_0x6d44('0x18')]);router[_0x6d44('0x15')](_0x6d44('0x19'),auth['isAuthenticated'](),controller['send']);router[_0x6d44('0x15')](_0x6d44('0x10'),controller[_0x6d44('0x1a')]);router[_0x6d44('0x15')]('/:id/users',auth[_0x6d44('0x6')](),controller['addAgents']);router[_0x6d44('0x1b')]('/:id',auth['isAuthenticated'](),controller[_0x6d44('0x1c')]);router[_0x6d44('0x1d')](_0x6d44('0x1e'),auth[_0x6d44('0x6')](),controller[_0x6d44('0x1f')]);router[_0x6d44('0x1d')](_0x6d44('0xa'),auth[_0x6d44('0x6')](),controller[_0x6d44('0x20')]);router['delete'](_0x6d44('0xc'),auth[_0x6d44('0x6')](),controller[_0x6d44('0x21')]);router[_0x6d44('0x1d')]('/:id/users',auth['isAuthenticated'](),controller['removeAgents']);module[_0x6d44('0x22')]=router; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.attributes.js b/server/api/smsAccount/smsAccount.attributes.js index 6d299d2..502b1b7 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 _0x2821=['clickatell','infobip','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','randomstring','exports','STRING','name','generate','ENUM','twilio','skebby','connectel','clicksend','plivo'];(function(_0x9d58e0,_0x5ee515){var _0x5eab07=function(_0x177eb4){while(--_0x177eb4){_0x9d58e0['push'](_0x9d58e0['shift']());}};_0x5eab07(++_0x5ee515);}(_0x2821,0xc3));var _0x1282=function(_0x431d19,_0x2e40e0){_0x431d19=_0x431d19-0x0;var _0x3534bb=_0x2821[_0x431d19];return _0x3534bb;};'use strict';var Sequelize=require(_0x1282('0x0'));var rs=require(_0x1282('0x1'));module[_0x1282('0x2')]={'name':{'type':Sequelize[_0x1282('0x3')],'unique':_0x1282('0x4'),'allowNull':![]},'key':{'type':Sequelize[_0x1282('0x3')],'allowNull':![]},'remote':{'type':Sequelize['STRING'],'allowNull':![]},'token':{'type':Sequelize[_0x1282('0x3')],'defaultValue':function(){return rs[_0x1282('0x5')]();}},'phone':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0x1282('0x6')](_0x1282('0x7'),_0x1282('0x8'),_0x1282('0x9'),_0x1282('0xa'),_0x1282('0xb'),_0x1282('0xc'),'csc',_0x1282('0xd'),'intelepeer')},'accountSid':{'type':Sequelize['STRING']},'authId':{'type':Sequelize['STRING']},'authToken':{'type':Sequelize[_0x1282('0x3')]},'smsMethod':{'type':Sequelize[_0x1282('0x6')]('SI','TI','GP')},'username':{'type':Sequelize[_0x1282('0x3')]},'password':{'type':Sequelize['STRING']},'apiKey':{'type':Sequelize[_0x1282('0x3')]},'senderString':{'type':Sequelize[_0x1282('0x3')]},'deliveryReport':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'description':{'type':Sequelize['STRING']},'notificationTemplate':{'type':Sequelize[_0x1282('0xe')],'defaultValue':function(){return _0x1282('0xf');}},'notificationSound':{'type':Sequelize[_0x1282('0x10')],'defaultValue':!![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x1282('0x10')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x1282('0x11')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x1282('0x11')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'baseUrl':{'type':Sequelize[_0x1282('0x3')]},'mandatoryDispositionPauseId':{'type':Sequelize[_0x1282('0x11')],'comment':_0x1282('0x12')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0x1282('0x13'),'set':function(_0x5a16bf){if(!_0x5a16bf)this[_0x1282('0x14')](_0x1282('0x15'),null);this['setDataValue'](_0x1282('0x16'),_0x5a16bf);}}}; \ No newline at end of file +var _0xa2c5=['generate','ENUM','twilio','connectel','clicksend','plivo','clickatell','infobip','BOOLEAN','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','randomstring','exports','STRING','name'];(function(_0x3f0f2e,_0xf2b92d){var _0x49fc6f=function(_0x4a2274){while(--_0x4a2274){_0x3f0f2e['push'](_0x3f0f2e['shift']());}};_0x49fc6f(++_0xf2b92d);}(_0xa2c5,0x175));var _0x5a2c=function(_0x47fd36,_0x41535d){_0x47fd36=_0x47fd36-0x0;var _0x21a0fc=_0xa2c5[_0x47fd36];return _0x21a0fc;};'use strict';var Sequelize=require(_0x5a2c('0x0'));var rs=require(_0x5a2c('0x1'));module[_0x5a2c('0x2')]={'name':{'type':Sequelize[_0x5a2c('0x3')],'unique':_0x5a2c('0x4'),'allowNull':![]},'key':{'type':Sequelize[_0x5a2c('0x3')],'allowNull':![]},'remote':{'type':Sequelize[_0x5a2c('0x3')],'allowNull':![]},'token':{'type':Sequelize[_0x5a2c('0x3')],'defaultValue':function(){return rs[_0x5a2c('0x5')]();}},'phone':{'type':Sequelize[_0x5a2c('0x3')]},'type':{'type':Sequelize[_0x5a2c('0x6')](_0x5a2c('0x7'),'skebby',_0x5a2c('0x8'),_0x5a2c('0x9'),_0x5a2c('0xa'),_0x5a2c('0xb'),'csc',_0x5a2c('0xc'),'intelepeer')},'accountSid':{'type':Sequelize['STRING']},'authId':{'type':Sequelize[_0x5a2c('0x3')]},'authToken':{'type':Sequelize[_0x5a2c('0x3')]},'smsMethod':{'type':Sequelize[_0x5a2c('0x6')]('SI','TI','GP')},'username':{'type':Sequelize['STRING']},'password':{'type':Sequelize['STRING']},'apiKey':{'type':Sequelize['STRING']},'senderString':{'type':Sequelize[_0x5a2c('0x3')]},'deliveryReport':{'type':Sequelize[_0x5a2c('0xd')],'defaultValue':![]},'description':{'type':Sequelize[_0x5a2c('0x3')]},'notificationTemplate':{'type':Sequelize[_0x5a2c('0xe')],'defaultValue':function(){return _0x5a2c('0xf');}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x5a2c('0x10')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x5a2c('0x10')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x5a2c('0xd')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x5a2c('0x10')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'baseUrl':{'type':Sequelize['STRING']},'mandatoryDispositionPauseId':{'type':Sequelize[_0x5a2c('0x10')],'comment':_0x5a2c('0x11')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x30030b){if(!_0x30030b)this[_0x5a2c('0x12')](_0x5a2c('0x13'),null);this['setDataValue'](_0x5a2c('0x14'),_0x30030b);}}}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.controller.js b/server/api/smsAccount/smsAccount.controller.js index 1e69877..4c1699c 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(_0x456292,_0x3c6ebd){var _0x54c65d=function(_0x53a746){while(--_0x53a746){_0x456292['push'](_0x456292['shift']());}};_0x54c65d(++_0x3c6ebd);}(_0x7a54,0x106));var _0x47a5=function(_0x15b403,_0x2fa90c){_0x15b403=_0x15b403-0x0;var _0xf70258=_0x7a54[_0x15b403];return _0xf70258;};'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(_0x3e6cc3,_0x280576){var _0x1dc514=function(_0x647aa8){while(--_0x647aa8){_0x3e6cc3['push'](_0x3e6cc3['shift']());}};_0x1dc514(++_0x280576);}(_0x7a54,0x106));var _0x47a5=function(_0x50be58,_0xd3c00f){_0x50be58=_0x50be58-0x0;var _0x19bb22=_0x7a54[_0x50be58];return _0x19bb22;};'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 9610914..b0bf018 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 _0x14b4=['setMaxListeners','save','remove','emit','hook','exports','SmsAccount'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0x14b4,0x8b));var _0x414b=function(_0x21a314,_0xbe022b){_0x21a314=_0x21a314-0x0;var _0x3eb9f6=_0x14b4[_0x21a314];return _0x3eb9f6;};'use strict';var EventEmitter=require('events');var SmsAccount=require('../../mysqldb')['db'][_0x414b('0x0')];var SmsAccountEvents=new EventEmitter();SmsAccountEvents[_0x414b('0x1')](0x0);var events={'afterCreate':_0x414b('0x2'),'afterUpdate':'update','afterDestroy':_0x414b('0x3')};function emitEvent(_0x421a47){return function(_0x3de4a6,_0x56c935,_0xc2e30a){SmsAccountEvents[_0x414b('0x4')](_0x421a47+':'+_0x3de4a6['id'],_0x3de4a6);SmsAccountEvents[_0x414b('0x4')](_0x421a47,_0x3de4a6);_0xc2e30a(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SmsAccount[_0x414b('0x5')](e,emitEvent(event));}}module[_0x414b('0x6')]=SmsAccountEvents; \ No newline at end of file +var _0x85ba=['save','emit','hasOwnProperty','exports','events','../../mysqldb','SmsAccount','setMaxListeners'];(function(_0x3e9ef3,_0x21a7e4){var _0x333748=function(_0x3e7c45){while(--_0x3e7c45){_0x3e9ef3['push'](_0x3e9ef3['shift']());}};_0x333748(++_0x21a7e4);}(_0x85ba,0x164));var _0xa85b=function(_0x218bf6,_0x3322d6){_0x218bf6=_0x218bf6-0x0;var _0xe0cd25=_0x85ba[_0x218bf6];return _0xe0cd25;};'use strict';var EventEmitter=require(_0xa85b('0x0'));var SmsAccount=require(_0xa85b('0x1'))['db'][_0xa85b('0x2')];var SmsAccountEvents=new EventEmitter();SmsAccountEvents[_0xa85b('0x3')](0x0);var events={'afterCreate':_0xa85b('0x4'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x55220a){return function(_0x548a41,_0xc9fd90,_0x689eef){SmsAccountEvents[_0xa85b('0x5')](_0x55220a+':'+_0x548a41['id'],_0x548a41);SmsAccountEvents[_0xa85b('0x5')](_0x55220a,_0x548a41);_0x689eef(null);};}for(var e in events){if(events[_0xa85b('0x6')](e)){var event=events[e];SmsAccount['hook'](e,emitEvent(event));}}module[_0xa85b('0x7')]=SmsAccountEvents; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.model.js b/server/api/smsAccount/smsAccount.model.js index e4a7540..c4c5a29 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(_0x4ed4a9,_0xaeac11){var _0x1bfd5e=function(_0x43cbc2){while(--_0x43cbc2){_0x4ed4a9['push'](_0x4ed4a9['shift']());}};_0x1bfd5e(++_0xaeac11);}(_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 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(_0x4a87dc,_0x2742f9){var _0x5ec6a6=function(_0xaf7790){while(--_0xaf7790){_0x4a87dc['push'](_0x4a87dc['shift']());}};_0x5ec6a6(++_0x2742f9);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3c4737,_0x2329ec){_0x3c4737=_0x3c4737-0x0;var _0x2bb926=_0xa9e0[_0x3c4737];return _0x2bb926;};'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 e105bfc..cef3241 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 _0x57ea=['redis','localhost','./smsAccount.socket','register','request','then','SmsAccount,\x20%s,\x20%s','request\x20sent','debug','SmsAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','ShowSmsAccount','find','options','raw','where','attributes','map','include','model','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client'];(function(_0x1c9383,_0x4af635){var _0x12c94b=function(_0x457012){while(--_0x457012){_0x1c9383['push'](_0x1c9383['shift']());}};_0x12c94b(++_0x4af635);}(_0x57ea,0x1ee));var _0xa57e=function(_0x2605dc,_0x50cf7e){_0x2605dc=_0x2605dc-0x0;var _0x4568c9=_0x57ea[_0x2605dc];return _0x4568c9;};'use strict';var _=require(_0xa57e('0x0'));var util=require('util');var moment=require(_0xa57e('0x1'));var BPromise=require(_0xa57e('0x2'));var rs=require(_0xa57e('0x3'));var fs=require('fs');var Redis=require(_0xa57e('0x4'));var db=require(_0xa57e('0x5'))['db'];var utils=require(_0xa57e('0x6'));var logger=require('../../config/logger')(_0xa57e('0x7'));var config=require(_0xa57e('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xa57e('0x9')]['http']({'port':0x232a});config[_0xa57e('0xa')]=_['defaults'](config[_0xa57e('0xa')],{'host':_0xa57e('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xa57e('0xa')]));require(_0xa57e('0xc'))[_0xa57e('0xd')](socket);function respondWithRpcPromise(_0x5ce061,_0x5a39aa,_0x6a0183){return new BPromise(function(_0x31202f,_0x3c14ed){return client[_0xa57e('0xe')](_0x5ce061,_0x6a0183)[_0xa57e('0xf')](function(_0x30867d){logger['info'](_0xa57e('0x10'),_0x5a39aa,_0xa57e('0x11'));logger[_0xa57e('0x12')](_0xa57e('0x13'),_0x5a39aa,_0xa57e('0x11'),JSON[_0xa57e('0x14')](_0x30867d));if(_0x30867d['error']){if(_0x30867d[_0xa57e('0x15')][_0xa57e('0x16')]===0x1f4){logger[_0xa57e('0x15')](_0xa57e('0x10'),_0x5a39aa,_0x30867d['error'][_0xa57e('0x17')]);return _0x3c14ed(_0x30867d['error'][_0xa57e('0x17')]);}logger['error'](_0xa57e('0x10'),_0x5a39aa,_0x30867d['error'][_0xa57e('0x17')]);return _0x31202f(_0x30867d['error'][_0xa57e('0x17')]);}else{logger[_0xa57e('0x18')](_0xa57e('0x10'),_0x5a39aa,_0xa57e('0x11'));_0x31202f(_0x30867d[_0xa57e('0x19')][_0xa57e('0x17')]);}})[_0xa57e('0x1a')](function(_0x280386){logger[_0xa57e('0x15')]('SmsAccount,\x20%s,\x20%s',_0x5a39aa,_0x280386);_0x3c14ed(_0x280386);});});}exports[_0xa57e('0x1b')]=function(_0x3d744c){var _0x17f6da=this;return new Promise(function(_0x47279d,_0x48fa7b){return db['SmsAccount'][_0xa57e('0x1c')]({'raw':_0x3d744c['options']?_0x3d744c[_0xa57e('0x1d')][_0xa57e('0x1e')]===undefined?!![]:![]:!![],'where':_0x3d744c['options']?_0x3d744c[_0xa57e('0x1d')][_0xa57e('0x1f')]||null:null,'attributes':_0x3d744c[_0xa57e('0x1d')]?_0x3d744c[_0xa57e('0x1d')][_0xa57e('0x20')]||null:null,'include':_0x3d744c[_0xa57e('0x1d')]?_0x3d744c[_0xa57e('0x1d')]['include']?_[_0xa57e('0x21')](_0x3d744c['options'][_0xa57e('0x22')],function(_0x22dcb7){return{'model':db[_0x22dcb7[_0xa57e('0x23')]],'as':_0x22dcb7['as'],'attributes':_0x22dcb7[_0xa57e('0x20')],'include':_0x22dcb7['include']?_['map'](_0x22dcb7[_0xa57e('0x22')],function(_0x52846b){return{'model':db[_0x52846b[_0xa57e('0x23')]],'as':_0x52846b['as'],'attributes':_0x52846b[_0xa57e('0x20')],'include':_0x52846b[_0xa57e('0x22')]?_[_0xa57e('0x21')](_0x52846b[_0xa57e('0x22')],function(_0x5b3c54){return{'model':db[_0x5b3c54[_0xa57e('0x23')]],'as':_0x5b3c54['as'],'attributes':_0x5b3c54[_0xa57e('0x20')]};}):[]};}):[]};}):[]:[]})[_0xa57e('0xf')](function(_0x484db8){logger[_0xa57e('0x18')](_0xa57e('0x1b'),_0x3d744c);logger[_0xa57e('0x12')](_0xa57e('0x1b'),_0x3d744c,JSON[_0xa57e('0x14')](_0x484db8));_0x47279d(_0x484db8);})[_0xa57e('0x1a')](function(_0x330bbc){logger[_0xa57e('0x15')](_0xa57e('0x1b'),_0x330bbc[_0xa57e('0x17')],_0x3d744c);_0x48fa7b(_0x17f6da[_0xa57e('0x15')](0x1f4,_0x330bbc[_0xa57e('0x17')]));});});}; \ No newline at end of file +var _0x2f34=['where','map','include','attributes','model','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','defaults','redis','localhost','socket.io-emitter','./smsAccount.socket','register','request','then','SmsAccount,\x20%s,\x20%s','request\x20sent','debug','SmsAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','ShowSmsAccount','find','options'];(function(_0x1b5c18,_0x6eb76d){var _0x2d34c9=function(_0x455fc2){while(--_0x455fc2){_0x1b5c18['push'](_0x1b5c18['shift']());}};_0x2d34c9(++_0x6eb76d);}(_0x2f34,0x135));var _0x42f3=function(_0x2b4411,_0x2625ed){_0x2b4411=_0x2b4411-0x0;var _0x8e41ef=_0x2f34[_0x2b4411];return _0x8e41ef;};'use strict';var _=require('lodash');var util=require(_0x42f3('0x0'));var moment=require(_0x42f3('0x1'));var BPromise=require('bluebird');var rs=require(_0x42f3('0x2'));var fs=require('fs');var Redis=require(_0x42f3('0x3'));var db=require(_0x42f3('0x4'))['db'];var utils=require(_0x42f3('0x5'));var logger=require(_0x42f3('0x6'))(_0x42f3('0x7'));var config=require(_0x42f3('0x8'));var jayson=require(_0x42f3('0x9'));var client=jayson[_0x42f3('0xa')]['http']({'port':0x232a});config['redis']=_[_0x42f3('0xb')](config[_0x42f3('0xc')],{'host':_0x42f3('0xd'),'port':0x18eb});var socket=require(_0x42f3('0xe'))(new Redis(config[_0x42f3('0xc')]));require(_0x42f3('0xf'))[_0x42f3('0x10')](socket);function respondWithRpcPromise(_0x2df2e1,_0x310305,_0x5b4640){return new BPromise(function(_0x119cc8,_0x433ae6){return client[_0x42f3('0x11')](_0x2df2e1,_0x5b4640)[_0x42f3('0x12')](function(_0x469302){logger['info'](_0x42f3('0x13'),_0x310305,_0x42f3('0x14'));logger[_0x42f3('0x15')](_0x42f3('0x16'),_0x310305,_0x42f3('0x14'),JSON[_0x42f3('0x17')](_0x469302));if(_0x469302[_0x42f3('0x18')]){if(_0x469302[_0x42f3('0x18')][_0x42f3('0x19')]===0x1f4){logger['error']('SmsAccount,\x20%s,\x20%s',_0x310305,_0x469302[_0x42f3('0x18')][_0x42f3('0x1a')]);return _0x433ae6(_0x469302[_0x42f3('0x18')]['message']);}logger['error']('SmsAccount,\x20%s,\x20%s',_0x310305,_0x469302['error'][_0x42f3('0x1a')]);return _0x119cc8(_0x469302[_0x42f3('0x18')][_0x42f3('0x1a')]);}else{logger[_0x42f3('0x1b')]('SmsAccount,\x20%s,\x20%s',_0x310305,_0x42f3('0x14'));_0x119cc8(_0x469302[_0x42f3('0x1c')][_0x42f3('0x1a')]);}})[_0x42f3('0x1d')](function(_0xcfcd84){logger[_0x42f3('0x18')](_0x42f3('0x13'),_0x310305,_0xcfcd84);_0x433ae6(_0xcfcd84);});});}exports[_0x42f3('0x1e')]=function(_0x33f05d){var _0x1df60e=this;return new Promise(function(_0x526b61,_0x3b857a){return db['SmsAccount'][_0x42f3('0x1f')]({'raw':_0x33f05d[_0x42f3('0x20')]?_0x33f05d[_0x42f3('0x20')]['raw']===undefined?!![]:![]:!![],'where':_0x33f05d[_0x42f3('0x20')]?_0x33f05d[_0x42f3('0x20')][_0x42f3('0x21')]||null:null,'attributes':_0x33f05d[_0x42f3('0x20')]?_0x33f05d[_0x42f3('0x20')]['attributes']||null:null,'include':_0x33f05d[_0x42f3('0x20')]?_0x33f05d[_0x42f3('0x20')]['include']?_[_0x42f3('0x22')](_0x33f05d[_0x42f3('0x20')][_0x42f3('0x23')],function(_0x542cd6){return{'model':db[_0x542cd6['model']],'as':_0x542cd6['as'],'attributes':_0x542cd6[_0x42f3('0x24')],'include':_0x542cd6['include']?_[_0x42f3('0x22')](_0x542cd6['include'],function(_0x1774cc){return{'model':db[_0x1774cc[_0x42f3('0x25')]],'as':_0x1774cc['as'],'attributes':_0x1774cc[_0x42f3('0x24')],'include':_0x1774cc[_0x42f3('0x23')]?_[_0x42f3('0x22')](_0x1774cc[_0x42f3('0x23')],function(_0x5c9983){return{'model':db[_0x5c9983[_0x42f3('0x25')]],'as':_0x5c9983['as'],'attributes':_0x5c9983['attributes']};}):[]};}):[]};}):[]:[]})[_0x42f3('0x12')](function(_0x2e1e80){logger[_0x42f3('0x1b')]('ShowSmsAccount',_0x33f05d);logger[_0x42f3('0x15')](_0x42f3('0x1e'),_0x33f05d,JSON[_0x42f3('0x17')](_0x2e1e80));_0x526b61(_0x2e1e80);})[_0x42f3('0x1d')](function(_0x397c63){logger['error'](_0x42f3('0x1e'),_0x397c63[_0x42f3('0x1a')],_0x33f05d);_0x3b857a(_0x1df60e[_0x42f3('0x18')](0x1f4,_0x397c63['message']));});});}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.socket.js b/server/api/smsAccount/smsAccount.socket.js index 66ca8f3..36b8c27 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 _0x2162=['./smsAccount.events','save','register'];(function(_0x591129,_0x4ecb02){var _0x3736cc=function(_0x397b3d){while(--_0x397b3d){_0x591129['push'](_0x591129['shift']());}};_0x3736cc(++_0x4ecb02);}(_0x2162,0x1d1));var _0x2216=function(_0x55e2f4,_0x715c55){_0x55e2f4=_0x55e2f4-0x0;var _0x53e0f3=_0x2162[_0x55e2f4];return _0x53e0f3;};'use strict';var SmsAccountEvents=require(_0x2216('0x0'));var events=[_0x2216('0x1'),'remove','update'];function createListener(_0x3d116c,_0x58197b){return function(_0x5391da){_0x58197b['emit'](_0x3d116c,_0x5391da);};}function removeListener(_0x2785b6,_0x401fbf){return function(){SmsAccountEvents['removeListener'](_0x2785b6,_0x401fbf);};}exports[_0x2216('0x2')]=function(_0x57f66e){for(var _0x193990=0x0,_0x173f80=events['length'];_0x193990<_0x173f80;_0x193990++){var _0x4684ab=events[_0x193990];var _0x330af5=createListener('smsAccount:'+_0x4684ab,_0x57f66e);SmsAccountEvents['on'](_0x4684ab,_0x330af5);}}; \ No newline at end of file +var _0x91a0=['removeListener','register','length','./smsAccount.events','remove','update','emit'];(function(_0x1a78d7,_0x1d0145){var _0x4f1a0a=function(_0x156b86){while(--_0x156b86){_0x1a78d7['push'](_0x1a78d7['shift']());}};_0x4f1a0a(++_0x1d0145);}(_0x91a0,0x1df));var _0x091a=function(_0x161f03,_0x5d141b){_0x161f03=_0x161f03-0x0;var _0x2f396f=_0x91a0[_0x161f03];return _0x2f396f;};'use strict';var SmsAccountEvents=require(_0x091a('0x0'));var events=['save',_0x091a('0x1'),_0x091a('0x2')];function createListener(_0xa436bc,_0x2ba2bb){return function(_0x127629){_0x2ba2bb[_0x091a('0x3')](_0xa436bc,_0x127629);};}function removeListener(_0x420d1b,_0x25cdc3){return function(){SmsAccountEvents[_0x091a('0x4')](_0x420d1b,_0x25cdc3);};}exports[_0x091a('0x5')]=function(_0x5dc3d6){for(var _0x456e69=0x0,_0x49dadf=events[_0x091a('0x6')];_0x456e69<_0x49dadf;_0x456e69++){var _0x3b3240=events[_0x456e69];var _0x430c18=createListener('smsAccount:'+_0x3b3240,_0x5dc3d6);SmsAccountEvents['on'](_0x3b3240,_0x430c18);}}; \ No newline at end of file diff --git a/server/api/smsApplication/index.js b/server/api/smsApplication/index.js index cb1938c..f817740 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 _0x442d=['path','express','Router','../../components/interaction/service','./smsApplication.controller','get','index','/:id','isAuthenticated','create','put','update','delete','exports'];(function(_0x1f22e0,_0x32e6a1){var _0x31d7ee=function(_0x2c4bb0){while(--_0x2c4bb0){_0x1f22e0['push'](_0x1f22e0['shift']());}};_0x31d7ee(++_0x32e6a1);}(_0x442d,0x126));var _0xd442=function(_0x22cc16,_0x1f4fa2){_0x22cc16=_0x22cc16-0x0;var _0x399b70=_0x442d[_0x22cc16];return _0x399b70;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xd442('0x0'));var timeout=require('connect-timeout');var express=require(_0xd442('0x1'));var router=express[_0xd442('0x2')]();var auth=require('../../components/auth/service');var interaction=require(_0xd442('0x3'));var config=require('../../config/environment');var controller=require(_0xd442('0x4'));router[_0xd442('0x5')]('/',auth['isAuthenticated'](),controller[_0xd442('0x6')]);router['get'](_0xd442('0x7'),auth[_0xd442('0x8')](),controller['show']);router['post']('/',auth[_0xd442('0x8')](),controller[_0xd442('0x9')]);router[_0xd442('0xa')]('/:id',auth['isAuthenticated'](),controller[_0xd442('0xb')]);router[_0xd442('0xc')]('/:id',auth[_0xd442('0x8')](),controller['destroy']);module[_0xd442('0xd')]=router; \ No newline at end of file +var _0xe5c8=['get','isAuthenticated','index','/:id','create','update','delete','exports','multer','connect-timeout','../../config/environment','./smsApplication.controller'];(function(_0x4bb66f,_0x3cd682){var _0xf2772f=function(_0x2e3698){while(--_0x2e3698){_0x4bb66f['push'](_0x4bb66f['shift']());}};_0xf2772f(++_0x3cd682);}(_0xe5c8,0xb0));var _0x8e5c=function(_0x410275,_0x345360){_0x410275=_0x410275-0x0;var _0x17d0bf=_0xe5c8[_0x410275];return _0x17d0bf;};'use strict';var multer=require(_0x8e5c('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x8e5c('0x1'));var express=require('express');var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x8e5c('0x2'));var controller=require(_0x8e5c('0x3'));router[_0x8e5c('0x4')]('/',auth[_0x8e5c('0x5')](),controller[_0x8e5c('0x6')]);router['get'](_0x8e5c('0x7'),auth[_0x8e5c('0x5')](),controller['show']);router['post']('/',auth[_0x8e5c('0x5')](),controller[_0x8e5c('0x8')]);router['put']('/:id',auth[_0x8e5c('0x5')](),controller[_0x8e5c('0x9')]);router[_0x8e5c('0xa')](_0x8e5c('0x7'),auth[_0x8e5c('0x5')](),controller['destroy']);module[_0x8e5c('0xb')]=router; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.attributes.js b/server/api/smsApplication/smsApplication.attributes.js index 8bd5eee..dfea889 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 _0x8372=['*,*,*,*','sequelize','exports','INTEGER','STRING','noop'];(function(_0x36884e,_0x48008f){var _0x1cc367=function(_0x388a78){while(--_0x388a78){_0x36884e['push'](_0x36884e['shift']());}};_0x1cc367(++_0x48008f);}(_0x8372,0xb5));var _0x2837=function(_0x3f8cff,_0x4d2e6e){_0x3f8cff=_0x3f8cff-0x0;var _0x2cf465=_0x8372[_0x3f8cff];return _0x2cf465;};'use strict';var Sequelize=require(_0x2837('0x0'));module[_0x2837('0x1')]={'priority':{'type':Sequelize[_0x2837('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0x2837('0x3')],'allowNull':![],'defaultValue':_0x2837('0x4')},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize[_0x2837('0x3')]},'interval':{'type':Sequelize['STRING'],'defaultValue':_0x2837('0x5')}}; \ No newline at end of file +var _0xddcb=['noop','TEXT','*,*,*,*','exports','INTEGER','STRING'];(function(_0x934425,_0x5af72f){var _0x31d596=function(_0x219869){while(--_0x219869){_0x934425['push'](_0x934425['shift']());}};_0x31d596(++_0x5af72f);}(_0xddcb,0x12f));var _0xbddc=function(_0x5a7e49,_0x18f802){_0x5a7e49=_0x5a7e49-0x0;var _0x5c5e1b=_0xddcb[_0x5a7e49];return _0x5c5e1b;};'use strict';var Sequelize=require('sequelize');module[_0xbddc('0x0')]={'priority':{'type':Sequelize[_0xbddc('0x1')],'allowNull':![]},'app':{'type':Sequelize[_0xbddc('0x2')],'allowNull':![],'defaultValue':_0xbddc('0x3')},'appdata':{'type':Sequelize[_0xbddc('0x4')]()},'description':{'type':Sequelize[_0xbddc('0x2')]},'interval':{'type':Sequelize[_0xbddc('0x2')],'defaultValue':_0xbddc('0x5')}}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.controller.js b/server/api/smsApplication/smsApplication.controller.js index a315a00..42a4e70 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 _0x25e7=['send','map','rawAttributes','type','key','model','keys','query','filters','intersection','attributes','fields','nolimit','order','sort','pick','where','merge','VIRTUAL','filter','options','count','includeAll','SmsApplication','findAll','catch','show','length','find','create','body','params','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','to-csv','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','status','end','json','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','sendStatus','error','stack','name'];(function(_0x113573,_0x4f8649){var _0x31601a=function(_0x33ab51){while(--_0x33ab51){_0x113573['push'](_0x113573['shift']());}};_0x31601a(++_0x4f8649);}(_0x25e7,0x1d6));var _0x725e=function(_0x23f2a7,_0x3bc14f){_0x23f2a7=_0x23f2a7-0x0;var _0x547933=_0x25e7[_0x23f2a7];return _0x547933;};'use strict';var pdf=require(_0x725e('0x0'));var emlformat=require(_0x725e('0x1'));var rimraf=require(_0x725e('0x2'));var zipdir=require(_0x725e('0x3'));var jsonpatch=require(_0x725e('0x4'));var rp=require(_0x725e('0x5'));var moment=require(_0x725e('0x6'));var BPromise=require(_0x725e('0x7'));var Mustache=require(_0x725e('0x8'));var util=require(_0x725e('0x9'));var path=require('path');var sox=require('sox');var csv=require(_0x725e('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0x725e('0xb'));var crypto=require(_0x725e('0xc'));var jsforce=require(_0x725e('0xd'));var deskjs=require(_0x725e('0xe'));var toCsv=require(_0x725e('0xa'));var querystring=require(_0x725e('0xf'));var Papa=require(_0x725e('0x10'));var Redis=require(_0x725e('0x11'));var authService=require(_0x725e('0x12'));var qs=require(_0x725e('0x13'));var as=require(_0x725e('0x14'));var hardwareService=require(_0x725e('0x15'));var logger=require('../../config/logger')('api');var utils=require(_0x725e('0x16'));var config=require(_0x725e('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5bdf3a,_0x11916d){_0x11916d=_0x11916d||0xcc;return function(_0x14218e){if(_0x14218e){return _0x5bdf3a['sendStatus'](_0x11916d);}return _0x5bdf3a[_0x725e('0x18')](_0x11916d)[_0x725e('0x19')]();};}function respondWithResult(_0x2f1ae4,_0x4e0515){_0x4e0515=_0x4e0515||0xc8;return function(_0x3f8052){if(_0x3f8052){return _0x2f1ae4[_0x725e('0x18')](_0x4e0515)[_0x725e('0x1a')](_0x3f8052);}};}function respondWithFilteredResult(_0x2e78d2,_0x24c3c1){return function(_0x13fbfe){if(_0x13fbfe){var _0x523422=_0x13fbfe['count'],_0x156b99=_0x24c3c1[_0x725e('0x1b')],_0x268312=_0x24c3c1[_0x725e('0x1b')]+_0x24c3c1[_0x725e('0x1c')],_0x297bb7;if(_0x268312>=_0x523422){_0x268312=_0x523422;_0x297bb7=0xc8;}else{_0x297bb7=0xce;}_0x2e78d2[_0x725e('0x18')](_0x297bb7);return _0x2e78d2[_0x725e('0x1d')](_0x725e('0x1e'),_0x156b99+'-'+_0x268312+'/'+_0x523422)['json'](_0x13fbfe);}return null;};}function patchUpdates(_0x22fba5){return function(_0x3ec8b3){try{jsonpatch[_0x725e('0x1f')](_0x3ec8b3,_0x22fba5,!![]);}catch(_0x338a1d){return BPromise[_0x725e('0x20')](_0x338a1d);}return _0x3ec8b3[_0x725e('0x21')]();};}function saveUpdates(_0x540802,_0x2fc416){return function(_0xd30de9){if(_0xd30de9){return _0xd30de9[_0x725e('0x22')](_0x540802)[_0x725e('0x23')](function(_0x63193e){return _0x63193e;});}return null;};}function removeEntity(_0x251328,_0x127c99){return function(_0x262b01){if(_0x262b01){return _0x262b01[_0x725e('0x24')]()['then'](function(){_0x251328[_0x725e('0x18')](0xcc)[_0x725e('0x19')]();});}};}function handleEntityNotFound(_0x389668,_0x3facae){return function(_0x5a8191){if(!_0x5a8191){_0x389668[_0x725e('0x25')](0x194);}return _0x5a8191;};}function handleError(_0x5268c8,_0x49a3a6){_0x49a3a6=_0x49a3a6||0x1f4;return function(_0x4e6b3e){logger[_0x725e('0x26')](_0x4e6b3e[_0x725e('0x27')]);if(_0x4e6b3e[_0x725e('0x28')]){delete _0x4e6b3e['name'];}_0x5268c8[_0x725e('0x18')](_0x49a3a6)[_0x725e('0x29')](_0x4e6b3e);};}exports['index']=function(_0x14e9e0,_0x339a58){var _0x4b0d0c={},_0x378ace={},_0x5daa2d={'count':0x0,'rows':[]};var _0x561656=_[_0x725e('0x2a')](db['SmsApplication'][_0x725e('0x2b')],function(_0x4cc4ad){return{'name':_0x4cc4ad['fieldName'],'type':_0x4cc4ad[_0x725e('0x2c')][_0x725e('0x2d')]};});_0x378ace[_0x725e('0x2e')]=_['map'](_0x561656,_0x725e('0x28'));_0x378ace['query']=_[_0x725e('0x2f')](_0x14e9e0[_0x725e('0x30')]);_0x378ace[_0x725e('0x31')]=_[_0x725e('0x32')](_0x378ace[_0x725e('0x2e')],_0x378ace[_0x725e('0x30')]);_0x4b0d0c[_0x725e('0x33')]=_[_0x725e('0x32')](_0x378ace[_0x725e('0x2e')],qs[_0x725e('0x34')](_0x14e9e0[_0x725e('0x30')]['fields']));_0x4b0d0c[_0x725e('0x33')]=_0x4b0d0c[_0x725e('0x33')]['length']?_0x4b0d0c[_0x725e('0x33')]:_0x378ace['model'];if(!_0x14e9e0[_0x725e('0x30')]['hasOwnProperty'](_0x725e('0x35'))){_0x4b0d0c[_0x725e('0x1c')]=qs[_0x725e('0x1c')](_0x14e9e0[_0x725e('0x30')][_0x725e('0x1c')]);_0x4b0d0c[_0x725e('0x1b')]=qs['offset'](_0x14e9e0['query'][_0x725e('0x1b')]);}_0x4b0d0c[_0x725e('0x36')]=qs[_0x725e('0x37')](_0x14e9e0['query'][_0x725e('0x37')]);_0x4b0d0c['where']=qs[_0x725e('0x31')](_[_0x725e('0x38')](_0x14e9e0[_0x725e('0x30')],_0x378ace[_0x725e('0x31')]),_0x561656);if(_0x14e9e0['query']['filter']){_0x4b0d0c[_0x725e('0x39')]=_[_0x725e('0x3a')](_0x4b0d0c[_0x725e('0x39')],{'$or':_['map'](_0x561656,function(_0x172fe){if(_0x172fe[_0x725e('0x2c')]!==_0x725e('0x3b')){var _0x4b4380={};_0x4b4380[_0x172fe[_0x725e('0x28')]]={'$like':'%'+_0x14e9e0['query'][_0x725e('0x3c')]+'%'};return _0x4b4380;}})});}_0x4b0d0c=_[_0x725e('0x3a')]({},_0x4b0d0c,_0x14e9e0[_0x725e('0x3d')]);var _0x46a0de={'where':_0x4b0d0c[_0x725e('0x39')]};return db['SmsApplication']['count'](_0x46a0de)[_0x725e('0x23')](function(_0x253caa){_0x5daa2d[_0x725e('0x3e')]=_0x253caa;if(_0x14e9e0['query'][_0x725e('0x3f')]){_0x4b0d0c['include']=[{'all':!![]}];}return db[_0x725e('0x40')][_0x725e('0x41')](_0x4b0d0c);})[_0x725e('0x23')](function(_0x3a29ae){_0x5daa2d['rows']=_0x3a29ae;return _0x5daa2d;})[_0x725e('0x23')](respondWithFilteredResult(_0x339a58,_0x4b0d0c))[_0x725e('0x42')](handleError(_0x339a58,null));};exports[_0x725e('0x43')]=function(_0x4366bc,_0x1ec4fe){var _0x19ed0a={'raw':!![],'where':{'id':_0x4366bc['params']['id']}},_0x3e5460={};_0x3e5460[_0x725e('0x2e')]=_[_0x725e('0x2f')](db['SmsApplication'][_0x725e('0x2b')]);_0x3e5460[_0x725e('0x30')]=_['keys'](_0x4366bc['query']);_0x3e5460['filters']=_['intersection'](_0x3e5460[_0x725e('0x2e')],_0x3e5460[_0x725e('0x30')]);_0x19ed0a[_0x725e('0x33')]=_['intersection'](_0x3e5460[_0x725e('0x2e')],qs['fields'](_0x4366bc['query'][_0x725e('0x34')]));_0x19ed0a[_0x725e('0x33')]=_0x19ed0a[_0x725e('0x33')][_0x725e('0x44')]?_0x19ed0a[_0x725e('0x33')]:_0x3e5460[_0x725e('0x2e')];if(_0x4366bc['query'][_0x725e('0x3f')]){_0x19ed0a['include']=[{'all':!![]}];}_0x19ed0a=_[_0x725e('0x3a')]({},_0x19ed0a,_0x4366bc[_0x725e('0x3d')]);return db['SmsApplication'][_0x725e('0x45')](_0x19ed0a)['then'](handleEntityNotFound(_0x1ec4fe,null))[_0x725e('0x23')](respondWithResult(_0x1ec4fe,null))[_0x725e('0x42')](handleError(_0x1ec4fe,null));};exports['create']=function(_0x5ae92c,_0xd323d4){return db['SmsApplication'][_0x725e('0x46')](_0x5ae92c['body'],{})['then'](respondWithResult(_0xd323d4,0xc9))['catch'](handleError(_0xd323d4,null));};exports[_0x725e('0x22')]=function(_0x38a81f,_0x4a4b6b){if(_0x38a81f[_0x725e('0x47')]['id']){delete _0x38a81f[_0x725e('0x47')]['id'];}return db['SmsApplication'][_0x725e('0x45')]({'where':{'id':_0x38a81f[_0x725e('0x48')]['id']}})[_0x725e('0x23')](handleEntityNotFound(_0x4a4b6b,null))[_0x725e('0x23')](saveUpdates(_0x38a81f[_0x725e('0x47')],null))[_0x725e('0x23')](respondWithResult(_0x4a4b6b,null))[_0x725e('0x42')](handleError(_0x4a4b6b,null));};exports[_0x725e('0x24')]=function(_0x432285,_0x3fdbfd){return db[_0x725e('0x40')][_0x725e('0x45')]({'where':{'id':_0x432285[_0x725e('0x48')]['id']}})['then'](handleEntityNotFound(_0x3fdbfd,null))[_0x725e('0x23')](removeEntity(_0x3fdbfd,null))['catch'](handleError(_0x3fdbfd,null));}; \ No newline at end of file +var _0x1c7c=['json','count','offset','limit','set','Content-Range','apply','save','destroy','then','error','stack','name','index','map','SmsApplication','rawAttributes','fieldName','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','type','VIRTUAL','includeAll','include','findAll','rows','catch','show','params','options','create','body','update','find','html-pdf','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','sendStatus','status','end'];(function(_0x42f331,_0x33905b){var _0x43e6ad=function(_0xed4e2c){while(--_0xed4e2c){_0x42f331['push'](_0x42f331['shift']());}};_0x43e6ad(++_0x33905b);}(_0x1c7c,0x164));var _0xc1c7=function(_0x543cc3,_0x187df5){_0x543cc3=_0x543cc3-0x0;var _0x504019=_0x1c7c[_0x543cc3];return _0x504019;};'use strict';var pdf=require(_0xc1c7('0x0'));var emlformat=require(_0xc1c7('0x1'));var rimraf=require(_0xc1c7('0x2'));var zipdir=require(_0xc1c7('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0xc1c7('0x4'));var moment=require('moment');var BPromise=require(_0xc1c7('0x5'));var Mustache=require(_0xc1c7('0x6'));var util=require(_0xc1c7('0x7'));var path=require(_0xc1c7('0x8'));var sox=require(_0xc1c7('0x9'));var csv=require(_0xc1c7('0xa'));var ejs=require(_0xc1c7('0xb'));var fs=require('fs');var _=require(_0xc1c7('0xc'));var squel=require(_0xc1c7('0xd'));var crypto=require(_0xc1c7('0xe'));var jsforce=require(_0xc1c7('0xf'));var deskjs=require(_0xc1c7('0x10'));var toCsv=require(_0xc1c7('0xa'));var querystring=require(_0xc1c7('0x11'));var Papa=require(_0xc1c7('0x12'));var Redis=require(_0xc1c7('0x13'));var authService=require(_0xc1c7('0x14'));var qs=require('../../components/parsers/qs');var as=require(_0xc1c7('0x15'));var hardwareService=require(_0xc1c7('0x16'));var logger=require('../../config/logger')(_0xc1c7('0x17'));var utils=require(_0xc1c7('0x18'));var config=require(_0xc1c7('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x473248,_0x44bf88){_0x44bf88=_0x44bf88||0xcc;return function(_0x376cab){if(_0x376cab){return _0x473248[_0xc1c7('0x1a')](_0x44bf88);}return _0x473248[_0xc1c7('0x1b')](_0x44bf88)[_0xc1c7('0x1c')]();};}function respondWithResult(_0x40c313,_0x1b57ab){_0x1b57ab=_0x1b57ab||0xc8;return function(_0xdfc7d9){if(_0xdfc7d9){return _0x40c313[_0xc1c7('0x1b')](_0x1b57ab)[_0xc1c7('0x1d')](_0xdfc7d9);}};}function respondWithFilteredResult(_0x34d392,_0x49576d){return function(_0x3e1f0e){if(_0x3e1f0e){var _0x335600=_0x3e1f0e[_0xc1c7('0x1e')],_0x21911c=_0x49576d[_0xc1c7('0x1f')],_0x555b59=_0x49576d[_0xc1c7('0x1f')]+_0x49576d[_0xc1c7('0x20')],_0x94678a;if(_0x555b59>=_0x335600){_0x555b59=_0x335600;_0x94678a=0xc8;}else{_0x94678a=0xce;}_0x34d392[_0xc1c7('0x1b')](_0x94678a);return _0x34d392[_0xc1c7('0x21')](_0xc1c7('0x22'),_0x21911c+'-'+_0x555b59+'/'+_0x335600)['json'](_0x3e1f0e);}return null;};}function patchUpdates(_0x37d748){return function(_0x17fd22){try{jsonpatch[_0xc1c7('0x23')](_0x17fd22,_0x37d748,!![]);}catch(_0x1bc9d){return BPromise['reject'](_0x1bc9d);}return _0x17fd22[_0xc1c7('0x24')]();};}function saveUpdates(_0x4d6171,_0x5e7e4a){return function(_0x195c5f){if(_0x195c5f){return _0x195c5f['update'](_0x4d6171)['then'](function(_0x2d006f){return _0x2d006f;});}return null;};}function removeEntity(_0x17a265,_0x2f1b87){return function(_0x4c6b34){if(_0x4c6b34){return _0x4c6b34[_0xc1c7('0x25')]()[_0xc1c7('0x26')](function(){_0x17a265[_0xc1c7('0x1b')](0xcc)[_0xc1c7('0x1c')]();});}};}function handleEntityNotFound(_0x2e64c4,_0x3a2483){return function(_0x3180fd){if(!_0x3180fd){_0x2e64c4[_0xc1c7('0x1a')](0x194);}return _0x3180fd;};}function handleError(_0x22b654,_0x1540c1){_0x1540c1=_0x1540c1||0x1f4;return function(_0x29cf97){logger[_0xc1c7('0x27')](_0x29cf97[_0xc1c7('0x28')]);if(_0x29cf97[_0xc1c7('0x29')]){delete _0x29cf97[_0xc1c7('0x29')];}_0x22b654[_0xc1c7('0x1b')](_0x1540c1)['send'](_0x29cf97);};}exports[_0xc1c7('0x2a')]=function(_0x13a1f9,_0x4e1721){var _0x52a1d5={},_0x352f24={},_0x539931={'count':0x0,'rows':[]};var _0x544fbb=_[_0xc1c7('0x2b')](db[_0xc1c7('0x2c')][_0xc1c7('0x2d')],function(_0x243450){return{'name':_0x243450[_0xc1c7('0x2e')],'type':_0x243450['type']['key']};});_0x352f24[_0xc1c7('0x2f')]=_[_0xc1c7('0x2b')](_0x544fbb,_0xc1c7('0x29'));_0x352f24[_0xc1c7('0x30')]=_[_0xc1c7('0x31')](_0x13a1f9['query']);_0x352f24['filters']=_[_0xc1c7('0x32')](_0x352f24[_0xc1c7('0x2f')],_0x352f24['query']);_0x52a1d5[_0xc1c7('0x33')]=_[_0xc1c7('0x32')](_0x352f24[_0xc1c7('0x2f')],qs[_0xc1c7('0x34')](_0x13a1f9[_0xc1c7('0x30')][_0xc1c7('0x34')]));_0x52a1d5[_0xc1c7('0x33')]=_0x52a1d5['attributes'][_0xc1c7('0x35')]?_0x52a1d5[_0xc1c7('0x33')]:_0x352f24[_0xc1c7('0x2f')];if(!_0x13a1f9[_0xc1c7('0x30')][_0xc1c7('0x36')](_0xc1c7('0x37'))){_0x52a1d5[_0xc1c7('0x20')]=qs[_0xc1c7('0x20')](_0x13a1f9[_0xc1c7('0x30')]['limit']);_0x52a1d5['offset']=qs[_0xc1c7('0x1f')](_0x13a1f9[_0xc1c7('0x30')][_0xc1c7('0x1f')]);}_0x52a1d5[_0xc1c7('0x38')]=qs[_0xc1c7('0x39')](_0x13a1f9[_0xc1c7('0x30')][_0xc1c7('0x39')]);_0x52a1d5[_0xc1c7('0x3a')]=qs[_0xc1c7('0x3b')](_[_0xc1c7('0x3c')](_0x13a1f9[_0xc1c7('0x30')],_0x352f24[_0xc1c7('0x3b')]),_0x544fbb);if(_0x13a1f9[_0xc1c7('0x30')][_0xc1c7('0x3d')]){_0x52a1d5[_0xc1c7('0x3a')]=_[_0xc1c7('0x3e')](_0x52a1d5[_0xc1c7('0x3a')],{'$or':_[_0xc1c7('0x2b')](_0x544fbb,function(_0x2f9e9a){if(_0x2f9e9a[_0xc1c7('0x3f')]!==_0xc1c7('0x40')){var _0x49e9ac={};_0x49e9ac[_0x2f9e9a['name']]={'$like':'%'+_0x13a1f9['query'][_0xc1c7('0x3d')]+'%'};return _0x49e9ac;}})});}_0x52a1d5=_['merge']({},_0x52a1d5,_0x13a1f9['options']);var _0x17ae8e={'where':_0x52a1d5[_0xc1c7('0x3a')]};return db[_0xc1c7('0x2c')][_0xc1c7('0x1e')](_0x17ae8e)['then'](function(_0x5cd9ff){_0x539931[_0xc1c7('0x1e')]=_0x5cd9ff;if(_0x13a1f9[_0xc1c7('0x30')][_0xc1c7('0x41')]){_0x52a1d5[_0xc1c7('0x42')]=[{'all':!![]}];}return db[_0xc1c7('0x2c')][_0xc1c7('0x43')](_0x52a1d5);})[_0xc1c7('0x26')](function(_0x1d4621){_0x539931[_0xc1c7('0x44')]=_0x1d4621;return _0x539931;})[_0xc1c7('0x26')](respondWithFilteredResult(_0x4e1721,_0x52a1d5))[_0xc1c7('0x45')](handleError(_0x4e1721,null));};exports[_0xc1c7('0x46')]=function(_0x5409d2,_0xbbf96d){var _0x412520={'raw':!![],'where':{'id':_0x5409d2[_0xc1c7('0x47')]['id']}},_0x508b32={};_0x508b32[_0xc1c7('0x2f')]=_[_0xc1c7('0x31')](db[_0xc1c7('0x2c')][_0xc1c7('0x2d')]);_0x508b32[_0xc1c7('0x30')]=_[_0xc1c7('0x31')](_0x5409d2[_0xc1c7('0x30')]);_0x508b32[_0xc1c7('0x3b')]=_[_0xc1c7('0x32')](_0x508b32['model'],_0x508b32[_0xc1c7('0x30')]);_0x412520[_0xc1c7('0x33')]=_['intersection'](_0x508b32['model'],qs[_0xc1c7('0x34')](_0x5409d2[_0xc1c7('0x30')][_0xc1c7('0x34')]));_0x412520[_0xc1c7('0x33')]=_0x412520[_0xc1c7('0x33')]['length']?_0x412520[_0xc1c7('0x33')]:_0x508b32[_0xc1c7('0x2f')];if(_0x5409d2['query']['includeAll']){_0x412520['include']=[{'all':!![]}];}_0x412520=_[_0xc1c7('0x3e')]({},_0x412520,_0x5409d2[_0xc1c7('0x48')]);return db[_0xc1c7('0x2c')]['find'](_0x412520)[_0xc1c7('0x26')](handleEntityNotFound(_0xbbf96d,null))[_0xc1c7('0x26')](respondWithResult(_0xbbf96d,null))['catch'](handleError(_0xbbf96d,null));};exports[_0xc1c7('0x49')]=function(_0xce8ab9,_0x32e38e){return db[_0xc1c7('0x2c')][_0xc1c7('0x49')](_0xce8ab9[_0xc1c7('0x4a')],{})[_0xc1c7('0x26')](respondWithResult(_0x32e38e,0xc9))[_0xc1c7('0x45')](handleError(_0x32e38e,null));};exports[_0xc1c7('0x4b')]=function(_0x3ec5de,_0xa49f73){if(_0x3ec5de[_0xc1c7('0x4a')]['id']){delete _0x3ec5de[_0xc1c7('0x4a')]['id'];}return db[_0xc1c7('0x2c')][_0xc1c7('0x4c')]({'where':{'id':_0x3ec5de[_0xc1c7('0x47')]['id']}})[_0xc1c7('0x26')](handleEntityNotFound(_0xa49f73,null))[_0xc1c7('0x26')](saveUpdates(_0x3ec5de['body'],null))[_0xc1c7('0x26')](respondWithResult(_0xa49f73,null))['catch'](handleError(_0xa49f73,null));};exports[_0xc1c7('0x25')]=function(_0x23f42f,_0x2840a3){return db['SmsApplication'][_0xc1c7('0x4c')]({'where':{'id':_0x23f42f[_0xc1c7('0x47')]['id']}})['then'](handleEntityNotFound(_0x2840a3,null))['then'](removeEntity(_0x2840a3,null))['catch'](handleError(_0x2840a3,null));}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.model.js b/server/api/smsApplication/smsApplication.model.js index 0768695..8bc8e1e 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 _0x46a3=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./smsApplication.attributes','exports','define','SmsApplication','sms_applications','lodash','util','../../config/logger','api'];(function(_0x5c63c8,_0x2496cd){var _0x11d213=function(_0x55e2cd){while(--_0x55e2cd){_0x5c63c8['push'](_0x5c63c8['shift']());}};_0x11d213(++_0x2496cd);}(_0x46a3,0x83));var _0x346a=function(_0x5ab089,_0x1365f8){_0x5ab089=_0x5ab089-0x0;var _0x3ea4e4=_0x46a3[_0x5ab089];return _0x3ea4e4;};'use strict';var _=require(_0x346a('0x0'));var util=require(_0x346a('0x1'));var logger=require(_0x346a('0x2'))(_0x346a('0x3'));var moment=require(_0x346a('0x4'));var BPromise=require(_0x346a('0x5'));var rp=require(_0x346a('0x6'));var fs=require('fs');var path=require(_0x346a('0x7'));var rimraf=require(_0x346a('0x8'));var config=require(_0x346a('0x9'));var attributes=require(_0x346a('0xa'));module[_0x346a('0xb')]=function(_0x185dc2,_0x1e410c){return _0x185dc2[_0x346a('0xc')](_0x346a('0xd'),attributes,{'tableName':_0x346a('0xe'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x983a=['sms_applications','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','moment','bluebird','../../config/environment','exports','define','SmsApplication'];(function(_0x29ab2c,_0x249491){var _0x1b8724=function(_0x116a94){while(--_0x116a94){_0x29ab2c['push'](_0x29ab2c['shift']());}};_0x1b8724(++_0x249491);}(_0x983a,0x93));var _0xa983=function(_0x462d8a,_0x495d12){_0x462d8a=_0x462d8a-0x0;var _0x15b114=_0x983a[_0x462d8a];return _0x15b114;};'use strict';var _=require(_0xa983('0x0'));var util=require(_0xa983('0x1'));var logger=require(_0xa983('0x2'))('api');var moment=require(_0xa983('0x3'));var BPromise=require(_0xa983('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xa983('0x5'));var attributes=require('./smsApplication.attributes');module[_0xa983('0x6')]=function(_0x32dd50,_0x8c9b41){return _0x32dd50[_0xa983('0x7')](_0xa983('0x8'),attributes,{'tableName':_0xa983('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xa983('0xa'),'collate':_0xa983('0xb')});}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.rpc.js b/server/api/smsApplication/smsApplication.rpc.js index 5d3d513..43ce2b8 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 _0xeb0d=['SmsApplication,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','SmsApplication,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x349148,_0x31eabb){var _0x2f2b0f=function(_0x44726e){while(--_0x44726e){_0x349148['push'](_0x349148['shift']());}};_0x2f2b0f(++_0x31eabb);}(_0xeb0d,0xe2));var _0xdeb0=function(_0x533984,_0x55d0c4){_0x533984=_0x533984-0x0;var _0x533873=_0xeb0d[_0x533984];return _0x533873;};'use strict';var _=require(_0xdeb0('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xdeb0('0x1'));var fs=require('fs');var Redis=require(_0xdeb0('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0xdeb0('0x3'));var logger=require(_0xdeb0('0x4'))(_0xdeb0('0x5'));var config=require(_0xdeb0('0x6'));var jayson=require(_0xdeb0('0x7'));var client=jayson[_0xdeb0('0x8')][_0xdeb0('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x27ebaa,_0x55ffce,_0x28a1a4){return new BPromise(function(_0x16b36b,_0x541d8b){return client[_0xdeb0('0xa')](_0x27ebaa,_0x28a1a4)[_0xdeb0('0xb')](function(_0x3336a6){logger[_0xdeb0('0xc')](_0xdeb0('0xd'),_0x55ffce,_0xdeb0('0xe'));logger[_0xdeb0('0xf')](_0xdeb0('0x10'),_0x55ffce,'request\x20sent',JSON['stringify'](_0x3336a6));if(_0x3336a6[_0xdeb0('0x11')]){if(_0x3336a6['error'][_0xdeb0('0x12')]===0x1f4){logger[_0xdeb0('0x11')](_0xdeb0('0xd'),_0x55ffce,_0x3336a6[_0xdeb0('0x11')][_0xdeb0('0x13')]);return _0x541d8b(_0x3336a6[_0xdeb0('0x11')][_0xdeb0('0x13')]);}logger[_0xdeb0('0x11')](_0xdeb0('0xd'),_0x55ffce,_0x3336a6['error'][_0xdeb0('0x13')]);return _0x16b36b(_0x3336a6[_0xdeb0('0x11')][_0xdeb0('0x13')]);}else{logger[_0xdeb0('0xc')](_0xdeb0('0xd'),_0x55ffce,'request\x20sent');_0x16b36b(_0x3336a6[_0xdeb0('0x14')]['message']);}})[_0xdeb0('0x15')](function(_0x473fb9){logger[_0xdeb0('0x11')]('SmsApplication,\x20%s,\x20%s',_0x55ffce,_0x473fb9);_0x541d8b(_0x473fb9);});});} \ No newline at end of file +var _0x0f3c=['rpc','../../config/environment','jayson/promise','client','then','info','SmsApplication,\x20%s,\x20%s','request\x20sent','debug','SmsApplication,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x4a30a7,_0x1f3b34){var _0x479a14=function(_0x110d32){while(--_0x110d32){_0x4a30a7['push'](_0x4a30a7['shift']());}};_0x479a14(++_0x1f3b34);}(_0x0f3c,0x189));var _0xc0f3=function(_0x5f52f6,_0x8ea39c){_0x5f52f6=_0x5f52f6-0x0;var _0x3291e5=_0x0f3c[_0x5f52f6];return _0x3291e5;};'use strict';var _=require(_0xc0f3('0x0'));var util=require(_0xc0f3('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xc0f3('0x2'));var db=require(_0xc0f3('0x3'))['db'];var utils=require(_0xc0f3('0x4'));var logger=require(_0xc0f3('0x5'))(_0xc0f3('0x6'));var config=require(_0xc0f3('0x7'));var jayson=require(_0xc0f3('0x8'));var client=jayson[_0xc0f3('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x37d939,_0x2c517e,_0x48fc5d){return new BPromise(function(_0x435864,_0x399c29){return client['request'](_0x37d939,_0x48fc5d)[_0xc0f3('0xa')](function(_0x31ddbe){logger[_0xc0f3('0xb')](_0xc0f3('0xc'),_0x2c517e,_0xc0f3('0xd'));logger[_0xc0f3('0xe')](_0xc0f3('0xf'),_0x2c517e,'request\x20sent',JSON[_0xc0f3('0x10')](_0x31ddbe));if(_0x31ddbe[_0xc0f3('0x11')]){if(_0x31ddbe[_0xc0f3('0x11')]['code']===0x1f4){logger[_0xc0f3('0x11')](_0xc0f3('0xc'),_0x2c517e,_0x31ddbe[_0xc0f3('0x11')][_0xc0f3('0x12')]);return _0x399c29(_0x31ddbe['error'][_0xc0f3('0x12')]);}logger[_0xc0f3('0x11')](_0xc0f3('0xc'),_0x2c517e,_0x31ddbe[_0xc0f3('0x11')][_0xc0f3('0x12')]);return _0x435864(_0x31ddbe[_0xc0f3('0x11')][_0xc0f3('0x12')]);}else{logger[_0xc0f3('0xb')](_0xc0f3('0xc'),_0x2c517e,_0xc0f3('0xd'));_0x435864(_0x31ddbe[_0xc0f3('0x13')][_0xc0f3('0x12')]);}})[_0xc0f3('0x14')](function(_0x5b2d71){logger[_0xc0f3('0x11')](_0xc0f3('0xc'),_0x2c517e,_0x5b2d71);_0x399c29(_0x5b2d71);});});} \ No newline at end of file diff --git a/server/api/smsInteraction/index.js b/server/api/smsInteraction/index.js index 557c89c..2fa7ae8 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 _0x30cb=['/:id/download','download','post','create','addMessage','/:id/tags','tracked','sms','smsinteraction:addtags','addTags','put','smsinteraction:update','delete','smsinteraction:destroy','destroy','removeTags','exports','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','show'];(function(_0x3740fe,_0x6c543c){var _0x55492b=function(_0x1f851f){while(--_0x1f851f){_0x3740fe['push'](_0x3740fe['shift']());}};_0x55492b(++_0x6c543c);}(_0x30cb,0x1f1));var _0xb30c=function(_0x4618c5,_0x458d6e){_0x4618c5=_0x4618c5-0x0;var _0x1e63f0=_0x30cb[_0x4618c5];return _0x1e63f0;};'use strict';var multer=require(_0xb30c('0x0'));var util=require(_0xb30c('0x1'));var path=require(_0xb30c('0x2'));var timeout=require(_0xb30c('0x3'));var express=require(_0xb30c('0x4'));var router=express['Router']();var auth=require(_0xb30c('0x5'));var interaction=require(_0xb30c('0x6'));var config=require(_0xb30c('0x7'));var controller=require('./smsInteraction.controller');router[_0xb30c('0x8')]('/',auth[_0xb30c('0x9')](),controller[_0xb30c('0xa')]);router[_0xb30c('0x8')](_0xb30c('0xb'),auth[_0xb30c('0x9')](),controller[_0xb30c('0xc')]);router[_0xb30c('0x8')](_0xb30c('0xd'),auth[_0xb30c('0x9')](),controller[_0xb30c('0xe')]);router['get']('/:id/messages',auth['isAuthenticated'](),controller['getMessages']);router[_0xb30c('0x8')](_0xb30c('0xf'),auth[_0xb30c('0x9')](),controller[_0xb30c('0x10')]);router[_0xb30c('0x11')]('/',auth['isAuthenticated'](),controller[_0xb30c('0x12')]);router[_0xb30c('0x11')]('/:id/messages',auth['isAuthenticated'](),controller[_0xb30c('0x13')]);router[_0xb30c('0x11')](_0xb30c('0x14'),auth[_0xb30c('0x9')](),interaction[_0xb30c('0x15')](_0xb30c('0x16'),_0xb30c('0x17')),controller[_0xb30c('0x18')]);router[_0xb30c('0x19')]('/:id',auth['isAuthenticated'](),interaction[_0xb30c('0x15')](_0xb30c('0x16'),_0xb30c('0x1a')),controller['update']);router[_0xb30c('0x1b')]('/:id',auth['isAuthenticated'](),interaction[_0xb30c('0x15')]('sms',_0xb30c('0x1c')),controller[_0xb30c('0x1d')]);router['delete'](_0xb30c('0x14'),auth[_0xb30c('0x9')](),controller[_0xb30c('0x1e')]);module[_0xb30c('0x1f')]=router; \ No newline at end of file +var _0x9f89=['express','Router','../../components/auth/service','../../components/interaction/service','./smsInteraction.controller','get','isAuthenticated','index','/describe','/:id','show','/:id/messages','getMessages','download','post','create','addMessage','/:id/tags','tracked','sms','smsinteraction:addtags','addTags','put','smsinteraction:update','update','smsinteraction:destroy','exports','util','connect-timeout'];(function(_0x487b0c,_0x14ff74){var _0x1adbdc=function(_0x2e7b9d){while(--_0x2e7b9d){_0x487b0c['push'](_0x487b0c['shift']());}};_0x1adbdc(++_0x14ff74);}(_0x9f89,0x13d));var _0x99f8=function(_0xf7831f,_0x1c6188){_0xf7831f=_0xf7831f-0x0;var _0x3f88e7=_0x9f89[_0xf7831f];return _0x3f88e7;};'use strict';var multer=require('multer');var util=require(_0x99f8('0x0'));var path=require('path');var timeout=require(_0x99f8('0x1'));var express=require(_0x99f8('0x2'));var router=express[_0x99f8('0x3')]();var auth=require(_0x99f8('0x4'));var interaction=require(_0x99f8('0x5'));var config=require('../../config/environment');var controller=require(_0x99f8('0x6'));router[_0x99f8('0x7')]('/',auth[_0x99f8('0x8')](),controller[_0x99f8('0x9')]);router[_0x99f8('0x7')](_0x99f8('0xa'),auth[_0x99f8('0x8')](),controller['describe']);router[_0x99f8('0x7')](_0x99f8('0xb'),auth[_0x99f8('0x8')](),controller[_0x99f8('0xc')]);router['get'](_0x99f8('0xd'),auth[_0x99f8('0x8')](),controller[_0x99f8('0xe')]);router[_0x99f8('0x7')]('/:id/download',auth[_0x99f8('0x8')](),controller[_0x99f8('0xf')]);router[_0x99f8('0x10')]('/',auth[_0x99f8('0x8')](),controller[_0x99f8('0x11')]);router[_0x99f8('0x10')](_0x99f8('0xd'),auth[_0x99f8('0x8')](),controller[_0x99f8('0x12')]);router[_0x99f8('0x10')](_0x99f8('0x13'),auth['isAuthenticated'](),interaction[_0x99f8('0x14')](_0x99f8('0x15'),_0x99f8('0x16')),controller[_0x99f8('0x17')]);router[_0x99f8('0x18')](_0x99f8('0xb'),auth[_0x99f8('0x8')](),interaction[_0x99f8('0x14')](_0x99f8('0x15'),_0x99f8('0x19')),controller[_0x99f8('0x1a')]);router['delete'](_0x99f8('0xb'),auth[_0x99f8('0x8')](),interaction['tracked'](_0x99f8('0x15'),_0x99f8('0x1b')),controller['destroy']);router['delete'](_0x99f8('0x13'),auth[_0x99f8('0x8')](),controller['removeTags']);module[_0x99f8('0x1c')]=router; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.attributes.js b/server/api/smsInteraction/smsInteraction.attributes.js index d6df925..0f48f71 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(_0x42f009,_0x5e27b1){var _0x22a1e0=function(_0x297993){while(--_0x297993){_0x42f009['push'](_0x42f009['shift']());}};_0x22a1e0(++_0x5e27b1);}(_0xd8b0,0xad));var _0x0d8b=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xd8b0[_0xa464c9];return _0x3d73c4;};'use strict';var Sequelize=require(_0x0d8b('0x0'));var moment=require(_0x0d8b('0x1'));module['exports']={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize[_0x0d8b('0x2')]},'note':{'type':Sequelize[_0x0d8b('0x2')]},'phone':{'type':Sequelize[_0x0d8b('0x2')]},'read1stAt':{'type':Sequelize[_0x0d8b('0x3')]},'firstMsgDirection':{'type':Sequelize[_0x0d8b('0x4')]('in','out'),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize[_0x0d8b('0x4')]('in',_0x0d8b('0x5')),'defaultValue':'in','allowNull':![]}}; \ No newline at end of file +var _0xbaf0=['DATE','STRING','ENUM','out','moment','exports','BOOLEAN'];(function(_0x359c17,_0x23aa00){var _0x7d9532=function(_0x35ad31){while(--_0x35ad31){_0x359c17['push'](_0x359c17['shift']());}};_0x7d9532(++_0x23aa00);}(_0xbaf0,0x12a));var _0x0baf=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0xbaf0[_0x2f5ac5];return _0x37c9a8;};'use strict';var Sequelize=require('sequelize');var moment=require(_0x0baf('0x0'));module[_0x0baf('0x1')]={'closed':{'type':Sequelize[_0x0baf('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x0baf('0x3')]},'disposition':{'type':Sequelize[_0x0baf('0x4')]},'note':{'type':Sequelize[_0x0baf('0x4')]},'phone':{'type':Sequelize['STRING']},'read1stAt':{'type':Sequelize[_0x0baf('0x3')]},'firstMsgDirection':{'type':Sequelize[_0x0baf('0x5')]('in',_0x0baf('0x6')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x0baf('0x3')]},'lastMsgDirection':{'type':Sequelize[_0x0baf('0x5')]('in',_0x0baf('0x6')),'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 bf0bdb2..47f8fab 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 _0xe13a=['t.id\x20=\x20it.TagId','expr','parseSearch','search','sqlOperator','conditions','length','unreadMessages','having','`\x20>\x200','Contact','operator','$substring','value','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','find','ContactId','text','start','Tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','UserId','some','compact','isEmpty','SmsAccountId','concat','$gte','parse','$lte','null','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20>\x200','tag','isArray','filter','replace','\x27\x27\x27\x27','isNumeric','i.id\x20LIKE\x20?','i.phone\x20LIKE\x20?','getFullTextValue','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','group','i.id','Sequelize','QueryTypes','SELECT','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','t.id\x20IN\x20?','resolve','user','getSmsAccounts','i.SmsAccountId\x20IS\x20NULL','toString','sequelize','keyBy','merge','Account.key','Account.mandatoryDisposition','c.firstName','c.lastName','Contact.lastName','Contact.email','c.phone','Contact.mobile','c.fax','Contact.fax','o.fullname','Owner.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.SmsInteractionId\x20IN\x20?','groupBy','SmsInteractionId','push','all','rows','show','params','options','create','body','destroy','describe','SmsMessage','ids','getMessages','findOne','nolimit','format','includeAll','include','findAll','setTags','omit','spread','emit','smsInteractionTags:save','removeTags','download','unix','join','root','server','files','attachments','transcript-%d-%s.zip','User','CmContact','firstName','lastName','createdAt','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','\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20%s\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20{{page}}/{{pages}}\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20%s\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','%s\x20#%d','Sms','Owner','N.A.','YYYY-MM-DD\x20HH:mm:ss','closed','closedAt','disposition','Messages','out','renderFile','views','toFile','transcript-','log','err','unlinkSync','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','localhost','sendStatus','status','end','json','count','offset','set','apply','reject','then','error','stack','name','send','Users','map','fullname','TagIds','Tags','split','forEach','catch','index','SmsInteraction','rawAttributes','fieldName','type','key','model','query','keys','attributes','intersection','fields','hasOwnProperty','limit','order','sort','where','pick','filters','field','from','tools_tags','select','u.id','u.fullname','ui.SmsInteractionId','user_has_sms_interactions','left_join','users','u.id\x20=\x20ui.UserId','sms_interactions','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','sms_accounts','sms_messages','me.SmsInteractionId\x20=\x20i.id','sms_interaction_has_tags'];(function(_0x5ba808,_0x35c466){var _0x59abf9=function(_0x2cf5a5){while(--_0x2cf5a5){_0x5ba808['push'](_0x5ba808['shift']());}};_0x59abf9(++_0x35c466);}(_0xe13a,0x178));var _0xae13=function(_0x493458,_0xf0d19c){_0x493458=_0x493458-0x0;var _0x2579a9=_0xe13a[_0x493458];return _0x2579a9;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xae13('0x0'));var rimraf=require(_0xae13('0x1'));var zipdir=require(_0xae13('0x2'));var jsonpatch=require(_0xae13('0x3'));var rp=require('request-promise');var moment=require(_0xae13('0x4'));var BPromise=require(_0xae13('0x5'));var Mustache=require(_0xae13('0x6'));var util=require(_0xae13('0x7'));var path=require(_0xae13('0x8'));var sox=require(_0xae13('0x9'));var csv=require(_0xae13('0xa'));var ejs=require(_0xae13('0xb'));var fs=require('fs');var _=require(_0xae13('0xc'));var squel=require('squel');var crypto=require(_0xae13('0xd'));var jsforce=require(_0xae13('0xe'));var deskjs=require(_0xae13('0xf'));var toCsv=require(_0xae13('0xa'));var querystring=require(_0xae13('0x10'));var Papa=require(_0xae13('0x11'));var Redis=require(_0xae13('0x12'));var authService=require(_0xae13('0x13'));var qs=require(_0xae13('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xae13('0x15'));var logger=require(_0xae13('0x16'))(_0xae13('0x17'));var utils=require(_0xae13('0x18'));var config=require(_0xae13('0x19'));var db=require(_0xae13('0x1a'))['db'];config[_0xae13('0x1b')]=_['defaults'](config[_0xae13('0x1b')],{'host':_0xae13('0x1c'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require('./smsInteraction.socket')['register'](socket);function respondWithStatusCode(_0x52484b,_0x26ff3e){_0x26ff3e=_0x26ff3e||0xcc;return function(_0x148186){if(_0x148186){return _0x52484b[_0xae13('0x1d')](_0x26ff3e);}return _0x52484b[_0xae13('0x1e')](_0x26ff3e)[_0xae13('0x1f')]();};}function respondWithResult(_0x2912a2,_0x5c25a4){_0x5c25a4=_0x5c25a4||0xc8;return function(_0x3c488f){if(_0x3c488f){return _0x2912a2['status'](_0x5c25a4)[_0xae13('0x20')](_0x3c488f);}};}function respondWithFilteredResult(_0x16764b,_0x207363){return function(_0x118e52){if(_0x118e52){var _0x1a9c07=_0x118e52[_0xae13('0x21')],_0x1b33b7=_0x207363['offset'],_0x32dcbe=_0x207363[_0xae13('0x22')]+_0x207363['limit'],_0x326471;if(_0x32dcbe>=_0x1a9c07){_0x32dcbe=_0x1a9c07;_0x326471=0xc8;}else{_0x326471=0xce;}_0x16764b[_0xae13('0x1e')](_0x326471);return _0x16764b[_0xae13('0x23')]('Content-Range',_0x1b33b7+'-'+_0x32dcbe+'/'+_0x1a9c07)[_0xae13('0x20')](_0x118e52);}return null;};}function patchUpdates(_0x39d41c){return function(_0x3e4bc8){try{jsonpatch[_0xae13('0x24')](_0x3e4bc8,_0x39d41c,!![]);}catch(_0x184375){return BPromise[_0xae13('0x25')](_0x184375);}return _0x3e4bc8['save']();};}function saveUpdates(_0x520692,_0x149eda){return function(_0x290fb9){if(_0x290fb9){return _0x290fb9['update'](_0x520692)[_0xae13('0x26')](function(_0x519a37){return _0x519a37;});}return null;};}function removeEntity(_0x13c2de,_0x194437){return function(_0x3f12b0){if(_0x3f12b0){return _0x3f12b0['destroy']()['then'](function(){_0x13c2de['status'](0xcc)[_0xae13('0x1f')]();});}};}function handleEntityNotFound(_0xc5e6a7,_0x17ce58){return function(_0x55a39b){if(!_0x55a39b){_0xc5e6a7[_0xae13('0x1d')](0x194);}return _0x55a39b;};}function handleError(_0x517e71,_0x3d0d60){_0x3d0d60=_0x3d0d60||0x1f4;return function(_0x5de054){logger[_0xae13('0x27')](_0x5de054[_0xae13('0x28')]);if(_0x5de054['name']){delete _0x5de054[_0xae13('0x29')];}_0x517e71[_0xae13('0x1e')](_0x3d0d60)[_0xae13('0x2a')](_0x5de054);};}function getInteractionUsers(_0x306dfb,_0x578e99){return new BPromise(function(_0x41ceb7,_0x27b737){try{if(_0x578e99[_0x306dfb['id']]){_0x306dfb[_0xae13('0x2b')]=_[_0xae13('0x2c')](_0x578e99[_0x306dfb['id']],function(_0x742759){return{'id':_0x742759['id'],'fullname':_0x742759[_0xae13('0x2d')]};});}}catch(_0x277b69){_0x27b737(_0x277b69);}_0x41ceb7(_0x306dfb);});}function getInteractionTags(_0x5bd0ee,_0x133481){return new BPromise(function(_0x591f94,_0xf6289c){try{if(_0x5bd0ee[_0xae13('0x2e')]){_0x5bd0ee[_0xae13('0x2f')]=[];_0x5bd0ee[_0xae13('0x2e')][_0xae13('0x30')](',')[_0xae13('0x31')](function(_0x11c2ba){_0x5bd0ee['Tags']['push'](_0x133481[_0x11c2ba]);});}delete _0x5bd0ee[_0xae13('0x2e')];}catch(_0x233896){_0xf6289c(_0x233896);}_0x591f94(_0x5bd0ee);});}function updateSmsInteraction(_0xb3764d,_0x3710d6,_0x3d4ffd){return new BPromise(function(_0xfac8e7,_0x126686){return getInteractionUsers(_0xb3764d,_0x3d4ffd)[_0xae13('0x26')](function(_0x1fda10){return getInteractionTags(_0x1fda10,_0x3710d6);})[_0xae13('0x26')](function(_0x5f1aeb){_0xfac8e7(_0x5f1aeb);})[_0xae13('0x32')](function(_0x116270){_0x126686(_0x116270);});});}exports[_0xae13('0x33')]=function(_0x597001,_0x53b5f6){var _0x587b6f={},_0x5ba0a8={},_0x5b4060={'count':0x0,'rows':[]};var _0x5ee151=_[_0xae13('0x2c')](db[_0xae13('0x34')][_0xae13('0x35')],function(_0x5bb32a){return{'name':_0x5bb32a[_0xae13('0x36')],'type':_0x5bb32a[_0xae13('0x37')][_0xae13('0x38')]};});_0x5ba0a8[_0xae13('0x39')]=_[_0xae13('0x2c')](_0x5ee151,'name');_0x5ba0a8[_0xae13('0x3a')]=_[_0xae13('0x3b')](_0x597001[_0xae13('0x3a')]);_0x5ba0a8['filters']=_['intersection'](_0x5ba0a8[_0xae13('0x39')],_0x5ba0a8[_0xae13('0x3a')]);_0x587b6f[_0xae13('0x3c')]=_[_0xae13('0x3d')](_0x5ba0a8['model'],qs[_0xae13('0x3e')](_0x597001[_0xae13('0x3a')]['fields']));_0x587b6f[_0xae13('0x3c')]=_0x587b6f[_0xae13('0x3c')]['length']?_0x587b6f[_0xae13('0x3c')]:_0x5ba0a8[_0xae13('0x39')];if(!_0x597001[_0xae13('0x3a')][_0xae13('0x3f')]('nolimit')){_0x587b6f[_0xae13('0x40')]=qs[_0xae13('0x40')](_0x597001[_0xae13('0x3a')][_0xae13('0x40')]);_0x587b6f['offset']=qs[_0xae13('0x22')](_0x597001[_0xae13('0x3a')][_0xae13('0x22')]);}_0x587b6f[_0xae13('0x41')]=qs['sort'](_0x597001['query'][_0xae13('0x42')]);_0x587b6f[_0xae13('0x43')]=qs['filters'](_[_0xae13('0x44')](_0x597001['query'],_0x5ba0a8[_0xae13('0x45')]),_0x5ee151);var _0x230ba6=[];var _0x3fca0a=squel['select']()[_0xae13('0x46')]('id')[_0xae13('0x46')](_0xae13('0x29'))[_0xae13('0x46')]('color')[_0xae13('0x47')](_0xae13('0x48'));var _0x133f00=squel[_0xae13('0x49')]()[_0xae13('0x46')](_0xae13('0x4a'))[_0xae13('0x46')](_0xae13('0x4b'))['field'](_0xae13('0x4c'))['from'](_0xae13('0x4d'),'ui')[_0xae13('0x4e')](_0xae13('0x4f'),'u',_0xae13('0x50'));var _0x51cbcc=squel[_0xae13('0x49')]()['from'](_0xae13('0x51'),'i')[_0xae13('0x4e')]('cm_contacts','c',_0xae13('0x52'))[_0xae13('0x4e')](_0xae13('0x4f'),'o',_0xae13('0x53'))[_0xae13('0x4e')](_0xae13('0x54'),'a','a.id\x20=\x20i.SmsAccountId')[_0xae13('0x4e')](_0xae13('0x55'),'me',_0xae13('0x56'))[_0xae13('0x4e')](_0xae13('0x57'),'it','it.SmsInteractionId\x20=\x20i.id')[_0xae13('0x4e')](_0xae13('0x48'),'t',_0xae13('0x58'));var _0x551ed6=squel['expr']();var _0x498db2=[];var _0x566692=squel[_0xae13('0x59')]();var _0x552efd;if(_0x597001[_0xae13('0x3a')]['search']){_0x552efd=as[_0xae13('0x5a')](_0x597001[_0xae13('0x3a')][_0xae13('0x5b')]);var _0x4029dc=_0x552efd[_0xae13('0x5c')];for(var _0x53d341=0x0;_0x53d341<_0x552efd[_0xae13('0x5d')][_0xae13('0x5e')];_0x53d341++){var _0x5eb0ec=_0x552efd[_0xae13('0x5d')][_0x53d341];var _0x41913a='i';var _0x49c43a=_['find'](_0x5ee151,['name',_0x5eb0ec['field']]);if(!_0x49c43a){switch(_0x5eb0ec[_0xae13('0x46')]){case _0xae13('0x5f'):if(_0x5eb0ec['value']==0x1){_0x51cbcc[_0xae13('0x60')]('`'+_0x5eb0ec[_0xae13('0x46')]+'`\x20=\x200');}else{_0x51cbcc[_0xae13('0x60')]('`'+_0x5eb0ec[_0xae13('0x46')]+_0xae13('0x61'));}break;case _0xae13('0x62'):if(_0x5eb0ec[_0xae13('0x63')]===_0xae13('0x64')){if(_0x5eb0ec[_0xae13('0x65')][_0xae13('0x30')]('\x20')[_0xae13('0x5e')]>0x1){_0x551ed6[_0x4029dc](_0xae13('0x66'),qs['getFullTextValue'](_0x5eb0ec[_0xae13('0x65')]),null);}else{var _0xb8beec='%'+_0x5eb0ec[_0xae13('0x65')]+'%';_0x551ed6[_0x4029dc]('c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?',_0xb8beec,_0xb8beec,_0xb8beec);}}else{_0x49c43a=_[_0xae13('0x67')](_0x5ee151,['name',_0xae13('0x68')]);_0x5eb0ec[_0xae13('0x46')]=_0xae13('0x68');_0x43e176=as['buildExpression'](_0x41913a,_0x49c43a['type'],_0x5eb0ec);_0x551ed6[_0x4029dc](_0x43e176[_0xae13('0x69')],_0x43e176[_0xae13('0x65')][_0xae13('0x6a')],_0x43e176[_0xae13('0x65')][_0xae13('0x1f')]);}break;case _0xae13('0x6b'):var _0x3b9840=_0x5eb0ec['value'][_0xae13('0x30')](',')[_0xae13('0x2c')](function(_0x1cf135){return Number(_0x1cf135);});_0x3b9840[_0xae13('0x31')](function(_0xcbac5b){_0x566692['or'](_0xae13('0x6c'),'%,'+_0xcbac5b+',%');});_0x498db2=_[_0xae13('0x6d')](_0x498db2,_0x3b9840);break;case'User':if(_0x5eb0ec[_0xae13('0x63')]===_0xae13('0x64')){_0x551ed6[_0x4029dc]('CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','%'+_0x5eb0ec[_0xae13('0x65')]+'%',null);}else{_0x49c43a=_[_0xae13('0x67')](_0x5ee151,[_0xae13('0x29'),'UserId']);_0x5eb0ec[_0xae13('0x46')]=_0xae13('0x6e');_0x43e176=as['buildExpression'](_0x41913a,_0x49c43a[_0xae13('0x37')],_0x5eb0ec);_0x551ed6[_0x4029dc](_0x43e176[_0xae13('0x69')],_0x43e176[_0xae13('0x65')][_0xae13('0x6a')],_0x43e176[_0xae13('0x65')][_0xae13('0x1f')]);}break;case'body':_0x43e176=as['buildExpression']('me',null,_0x5eb0ec);_0x551ed6[_0x4029dc](_0x43e176[_0xae13('0x69')],_0x43e176[_0xae13('0x65')][_0xae13('0x6a')],_0x43e176[_0xae13('0x65')][_0xae13('0x1f')]);break;}}else{var _0x43e176=as['buildExpression'](_0x41913a,_0x49c43a[_0xae13('0x37')],_0x5eb0ec);_0x551ed6[_0x4029dc](_0x43e176[_0xae13('0x69')],_0x43e176['value']['start'],_0x43e176['value'][_0xae13('0x1f')]);}}}else{var _0xf998e5=_(_0x597001[_0xae13('0x3a')])[_0xae13('0x3b')]()[_0xae13('0x2c')](function(_0x2754e0){return _[_0xae13('0x6f')](_0x5ee151,[_0xae13('0x29'),_0x2754e0])?_0x2754e0:undefined;})[_0xae13('0x70')]()[_0xae13('0x65')]();if(!_[_0xae13('0x71')](_0xf998e5)){_0xf998e5[_0xae13('0x31')](function(_0x177e9e){if(_0x177e9e===_0xae13('0x72')){_0x51cbcc[_0xae13('0x43')]('i.SmsAccountId\x20IN\x20?',[][_0xae13('0x73')](_0x597001[_0xae13('0x3a')][_0x177e9e]));}else if(_0x177e9e==='createdAt'){var _0x37dcdd=JSON['parse'](_0x597001['query'][_0x177e9e])[_0xae13('0x74')];var _0x25cc60=JSON[_0xae13('0x75')](_0x597001[_0xae13('0x3a')][_0x177e9e])[_0xae13('0x76')];_0x51cbcc[_0xae13('0x43')]('i.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x37dcdd,_0x25cc60);}else{if(_0x597001['query'][_0x177e9e]===_0xae13('0x77')){_0x51cbcc[_0xae13('0x43')]('i.'+_0x177e9e+_0xae13('0x78'));}else{_0x51cbcc['where']('i.'+_0x177e9e+_0xae13('0x79'),_0x597001['query'][_0x177e9e]);}}});}if(_0x597001[_0xae13('0x3a')][_0xae13('0x7a')]){if(_0x597001[_0xae13('0x3a')][_0xae13('0x7a')]==0x1){_0x51cbcc[_0xae13('0x60')]('`unreadMessages`\x20=\x200');}else{_0x51cbcc[_0xae13('0x60')](_0xae13('0x7b'));}}if(_0x597001['query'][_0xae13('0x7c')]){_0x498db2=_[_0xae13('0x7d')](_0x597001[_0xae13('0x3a')][_0xae13('0x7c')])?_0x597001[_0xae13('0x3a')][_0xae13('0x7c')]:new Array(_0x597001['query'][_0xae13('0x7c')]);_0x498db2['forEach'](function(_0x272e3c){_0x566692['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x272e3c+',%');});}if(_0x597001[_0xae13('0x3a')][_0xae13('0x7e')]){var _0x5b1880=_0x597001[_0xae13('0x3a')][_0xae13('0x7e')][_0xae13('0x7f')]('\x5c','\x5c\x5c')[_0xae13('0x7f')]('\x27\x27',_0xae13('0x80'));if(qs[_0xae13('0x81')](_0x5b1880)){_0x551ed6['or'](_0xae13('0x82'),_0x5b1880+'%')['or'](_0xae13('0x83'),_0x5b1880+'%');}else{_0x551ed6['or']('MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0xae13('0x84')](_0x5b1880))['or'](_0xae13('0x85'),_0x5b1880+'%');}}}_0x51cbcc[_0xae13('0x43')](_0x551ed6);_0x51cbcc[_0xae13('0x86')](_0xae13('0x87'));var _0x13c1f3={'type':db[_0xae13('0x88')][_0xae13('0x89')][_0xae13('0x8a')],'raw':!![]};var _0x471f64=_0x51cbcc['clone']();_0x471f64[_0xae13('0x46')]('i.id');_0x471f64['field'](_0xae13('0x8b'),_0xae13('0x5f'));if(_0x587b6f[_0xae13('0x41')]){_0x587b6f['order'][_0xae13('0x31')](function(_0x5d1b1c){_0x51cbcc[_0xae13('0x41')]('i.'+_0x5d1b1c[0x0],_0x5d1b1c[0x1]==='DESC'?![]:!![]);});}if(!_[_0xae13('0x71')](_0x498db2)){_0x51cbcc[_0xae13('0x60')](_0x566692);_0x471f64['where'](_0xae13('0x8c'),_0x498db2);}BPromise[_0xae13('0x8d')]()['then'](function(){if(!_0x552efd){if(_0x597001['query'][_0xae13('0x72')]||_0x597001['query']['journey'])return;_0x471f64[_0xae13('0x43')]('i.SmsAccountId\x20IS\x20NOT\x20NULL');_0x51cbcc[_0xae13('0x43')]('i.SmsAccountId\x20IS\x20NOT\x20NULL');return;}return _0x597001[_0xae13('0x8e')][_0xae13('0x8f')]({'attributes':['id'],'raw':!![]})[_0xae13('0x26')](function(_0x88d31){if(_[_0xae13('0x71')](_0x88d31)){_0x471f64[_0xae13('0x43')]('i.SmsAccountId\x20IS\x20NULL');_0x51cbcc[_0xae13('0x43')](_0xae13('0x90'));}else{_0x471f64['where']('i.SmsAccountId\x20IN\x20?',_['map'](_0x88d31,'id'));_0x51cbcc[_0xae13('0x43')]('i.SmsAccountId\x20IN\x20?',_[_0xae13('0x2c')](_0x88d31,'id'));}});})['then'](function(){db['sequelize'][_0xae13('0x3a')](_0x471f64[_0xae13('0x91')](),_0x13c1f3)[_0xae13('0x26')](function(_0x2cfdc4){_0x5b4060[_0xae13('0x21')]=_0x2cfdc4[_0xae13('0x5e')];if(_0x5b4060['count']===0x0)return[];return db[_0xae13('0x92')][_0xae13('0x3a')](_0x3fca0a[_0xae13('0x91')](),_0x13c1f3)[_0xae13('0x26')](function(_0x4ea1f4){_0x230ba6=_[_0xae13('0x93')](_0x4ea1f4,'id');_0x13c1f3=_[_0xae13('0x94')](_0x13c1f3,{'model':db[_0xae13('0x34')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x597001['query']['fields']){_0x587b6f[_0xae13('0x3c')][_0xae13('0x31')](function(_0x405cc2){_0x51cbcc[_0xae13('0x46')]('i.'+_0x405cc2);});}else{_0x51cbcc[_0xae13('0x46')](_0xae13('0x8b'),_0xae13('0x5f'));_0x51cbcc[_0xae13('0x46')]('a.key',_0xae13('0x95'));_0x51cbcc[_0xae13('0x46')]('a.mandatoryDisposition',_0xae13('0x96'));_0x51cbcc[_0xae13('0x46')]('i.*');_0x51cbcc[_0xae13('0x46')](_0xae13('0x97'),'Contact.firstName');_0x51cbcc[_0xae13('0x46')](_0xae13('0x98'),_0xae13('0x99'));_0x51cbcc['field']('c.email',_0xae13('0x9a'));_0x51cbcc[_0xae13('0x46')](_0xae13('0x9b'),'Contact.phone');_0x51cbcc[_0xae13('0x46')]('c.mobile',_0xae13('0x9c'));_0x51cbcc[_0xae13('0x46')](_0xae13('0x9d'),_0xae13('0x9e'));_0x51cbcc[_0xae13('0x46')](_0xae13('0x9f'),_0xae13('0xa0'));_0x51cbcc[_0xae13('0x46')](_0xae13('0xa1'),_0xae13('0xa2'));_0x51cbcc['field'](_0xae13('0xa3'),'TagIds');}if(_0x587b6f[_0xae13('0x40')])_0x51cbcc[_0xae13('0x40')](_0x587b6f[_0xae13('0x40')]);if(_0x587b6f[_0xae13('0x22')])_0x51cbcc[_0xae13('0x22')](_0x587b6f[_0xae13('0x22')]);return db[_0xae13('0x92')][_0xae13('0x3a')](_0x51cbcc[_0xae13('0x91')](),_0x13c1f3);})[_0xae13('0x26')](function(_0x58c874){_0x133f00[_0xae13('0x43')](_0xae13('0xa4'),_[_0xae13('0x2c')](_0x58c874,'id'));return db[_0xae13('0x92')][_0xae13('0x3a')](_0x133f00[_0xae13('0x91')](),_0x13c1f3)[_0xae13('0x26')](function(_0x360b1a){var _0x544f6d=_[_0xae13('0xa5')](_0x360b1a,_0xae13('0xa6'));var _0x3a02c3=[];_0x58c874[_0xae13('0x31')](function(_0x2e8e14){_0x3a02c3[_0xae13('0xa7')](updateSmsInteraction(_0x2e8e14,_0x230ba6,_0x544f6d));});return BPromise[_0xae13('0xa8')](_0x3a02c3);});});})['then'](function(_0x2eaf8b){_0x5b4060[_0xae13('0xa9')]=_0x2eaf8b;return _0x5b4060;})[_0xae13('0x26')](respondWithFilteredResult(_0x53b5f6,_0x587b6f));})[_0xae13('0x32')](handleError(_0x53b5f6,null));};exports[_0xae13('0xaa')]=function(_0x2ced73,_0x4a5551){var _0xbcae23={'raw':![],'where':{'id':_0x2ced73[_0xae13('0xab')]['id']}},_0x17c277={};_0x17c277[_0xae13('0x39')]=_[_0xae13('0x3b')](db[_0xae13('0x34')][_0xae13('0x35')]);_0x17c277[_0xae13('0x3a')]=_[_0xae13('0x3b')](_0x2ced73[_0xae13('0x3a')]);_0x17c277[_0xae13('0x45')]=_['intersection'](_0x17c277[_0xae13('0x39')],_0x17c277[_0xae13('0x3a')]);_0xbcae23[_0xae13('0x3c')]=_[_0xae13('0x3d')](_0x17c277[_0xae13('0x39')],qs[_0xae13('0x3e')](_0x2ced73['query']['fields']));_0xbcae23[_0xae13('0x3c')]=_0xbcae23['attributes'][_0xae13('0x5e')]?_0xbcae23[_0xae13('0x3c')]:_0x17c277[_0xae13('0x39')];if(_0x2ced73[_0xae13('0x3a')]['includeAll']){_0xbcae23['include']=[{'all':!![]}];}_0xbcae23=_[_0xae13('0x94')]({},_0xbcae23,_0x2ced73[_0xae13('0xac')]);return db[_0xae13('0x34')]['find'](_0xbcae23)['then'](handleEntityNotFound(_0x4a5551,null))[_0xae13('0x26')](respondWithResult(_0x4a5551,null))[_0xae13('0x32')](handleError(_0x4a5551,null));};exports[_0xae13('0xad')]=function(_0x22bb08,_0x34276a){return db[_0xae13('0x34')]['create'](_0x22bb08[_0xae13('0xae')],{})[_0xae13('0x26')](respondWithResult(_0x34276a,0xc9))[_0xae13('0x32')](handleError(_0x34276a,null));};exports['update']=function(_0x4d1a9b,_0x1bceda){if(_0x4d1a9b[_0xae13('0xae')]['id']){delete _0x4d1a9b[_0xae13('0xae')]['id'];}return db[_0xae13('0x34')][_0xae13('0x67')]({'where':{'id':_0x4d1a9b[_0xae13('0xab')]['id']}})[_0xae13('0x26')](handleEntityNotFound(_0x1bceda,null))['then'](saveUpdates(_0x4d1a9b[_0xae13('0xae')],null))[_0xae13('0x26')](respondWithResult(_0x1bceda,null))[_0xae13('0x32')](handleError(_0x1bceda,null));};exports[_0xae13('0xaf')]=function(_0x51ff57,_0x388389){return db[_0xae13('0x34')][_0xae13('0x67')]({'where':{'id':_0x51ff57[_0xae13('0xab')]['id']}})[_0xae13('0x26')](handleEntityNotFound(_0x388389,null))[_0xae13('0x26')](removeEntity(_0x388389,null))[_0xae13('0x32')](handleError(_0x388389,null));};exports[_0xae13('0xb0')]=function(_0x54af8f,_0xbf1893){return db[_0xae13('0x34')][_0xae13('0xb0')]()[_0xae13('0x26')](respondWithResult(_0xbf1893,null))[_0xae13('0x32')](handleError(_0xbf1893,null));};exports['addMessage']=function(_0x5e6a58,_0x11360b,_0x1954fb){return db[_0xae13('0xb1')][_0xae13('0x67')]({'where':{'id':_0x5e6a58[_0xae13('0xab')]['id']}})[_0xae13('0x26')](handleEntityNotFound(_0x11360b,null))[_0xae13('0x26')](function(_0x175c32){if(_0x175c32){return _0x175c32['addMessage'](_0x5e6a58['body']['ids'],_['omit'](_0x5e6a58['body'],[_0xae13('0xb2'),'id'])||{});}})[_0xae13('0x26')](respondWithResult(_0x11360b,null))['catch'](handleError(_0x11360b,null));};exports[_0xae13('0xb3')]=function(_0x2c28c7,_0x5c6c94,_0x487cd2){var _0x1b7a07={'raw':![],'where':{}};var _0x4965e8={};var _0x25ac7d={'count':0x0,'rows':[]};return db['SmsInteraction'][_0xae13('0xb4')]({'where':{'id':_0x2c28c7[_0xae13('0xab')]['id']}})[_0xae13('0x26')](handleEntityNotFound(_0x5c6c94,null))[_0xae13('0x26')](function(_0x503e97){if(_0x503e97){_0x4965e8['model']=_[_0xae13('0x3b')](db['SmsMessage'][_0xae13('0x35')]);_0x4965e8[_0xae13('0x3a')]=_['keys'](_0x2c28c7[_0xae13('0x3a')]);_0x4965e8[_0xae13('0x45')]=_[_0xae13('0x3d')](_0x4965e8[_0xae13('0x39')],_0x4965e8['query']);_0x1b7a07[_0xae13('0x3c')]=_['intersection'](_0x4965e8[_0xae13('0x39')],qs[_0xae13('0x3e')](_0x2c28c7[_0xae13('0x3a')][_0xae13('0x3e')]));_0x1b7a07['attributes']=_0x1b7a07['attributes'][_0xae13('0x5e')]?_0x1b7a07[_0xae13('0x3c')]:_0x4965e8['model'];if(!_0x2c28c7[_0xae13('0x3a')]['hasOwnProperty'](_0xae13('0xb5'))){_0x1b7a07['limit']=qs[_0xae13('0x40')](_0x2c28c7[_0xae13('0x3a')]['limit']);_0x1b7a07[_0xae13('0x22')]=qs['offset'](_0x2c28c7['query'][_0xae13('0x22')]);}_0x1b7a07[_0xae13('0x41')]=qs[_0xae13('0x42')](_0x2c28c7[_0xae13('0x3a')][_0xae13('0x42')]);_0x1b7a07[_0xae13('0x43')]=qs[_0xae13('0x45')](_['pick'](_0x2c28c7[_0xae13('0x3a')],_0x4965e8[_0xae13('0x45')]));_0x1b7a07[_0xae13('0x43')][_0xae13('0xa6')]=_0x503e97['id'];if(_0x2c28c7[_0xae13('0x3a')][_0xae13('0x7e')]){_0x1b7a07[_0xae13('0x43')]=_[_0xae13('0x94')](_0x1b7a07[_0xae13('0x43')],{'$or':_[_0xae13('0x2c')](_0x1b7a07[_0xae13('0x3c')],function(_0x47bc0f){var _0x4b5f0e={};_0x4b5f0e[_0x47bc0f]={'$like':'%'+_0x2c28c7['query'][_0xae13('0x7e')]+'%'};return _0x4b5f0e;})});}if(_0x2c28c7[_0xae13('0x3a')][_0xae13('0x74')]){var _0x188883=_0x2c28c7[_0xae13('0x3a')][_0xae13('0x74')]['split'](',');var _0x2da9e2={};_0x2da9e2[_0x188883[0x0]]={'$gte':moment(_0x188883[0x1])[_0xae13('0xb6')]('YYYY-MM-DD\x20HH:mm:ss')};_0x1b7a07['where']=_[_0xae13('0x94')](_0x1b7a07['where'],_0x2da9e2);}_0x1b7a07=_[_0xae13('0x94')]({},_0x1b7a07,_0x2c28c7[_0xae13('0xac')]);return db[_0xae13('0xb1')][_0xae13('0x21')]({'where':_0x1b7a07['where']})[_0xae13('0x26')](function(_0x52f5e1){_0x25ac7d['count']=_0x52f5e1;if(_0x2c28c7['query'][_0xae13('0xb7')]){_0x1b7a07[_0xae13('0xb8')]=[{'all':!![]}];}return db[_0xae13('0xb1')][_0xae13('0xb9')](_0x1b7a07);})[_0xae13('0x26')](function(_0x1403b9){_0x25ac7d[_0xae13('0xa9')]=_0x1403b9;return _0x25ac7d;});}})[_0xae13('0x26')](respondWithFilteredResult(_0x5c6c94,_0x1b7a07))[_0xae13('0x32')](handleError(_0x5c6c94,null));};exports['addTags']=function(_0x393ee9,_0x2c159a,_0x1cfc6d){return db[_0xae13('0x34')][_0xae13('0x67')]({'where':{'id':_0x393ee9[_0xae13('0xab')]['id']}})[_0xae13('0x26')](handleEntityNotFound(_0x2c159a,null))[_0xae13('0x26')](function(_0x1d155e){if(_0x1d155e){return _0x1d155e[_0xae13('0xba')](_0x393ee9[_0xae13('0xae')]['ids'],_[_0xae13('0xbb')](_0x393ee9[_0xae13('0xae')],[_0xae13('0xb2'),'id'])||{})[_0xae13('0xbc')](function(){return db[_0xae13('0x6b')][_0xae13('0xb9')]({'attributes':['id','name','color'],'where':{'id':_0x393ee9[_0xae13('0xae')][_0xae13('0xb2')]}});})[_0xae13('0x26')](function(_0x4955e5){socket[_0xae13('0xbd')](_0xae13('0xbe'),{'id':Number(_0x393ee9[_0xae13('0xab')]['id']),'tags':_0x4955e5||[]});return{'id':Number(_0x393ee9[_0xae13('0xab')]['id']),'tags':_0x4955e5||[]};});}})[_0xae13('0x26')](respondWithResult(_0x2c159a,null))['catch'](handleError(_0x2c159a,null));};exports[_0xae13('0xbf')]=function(_0x25c841,_0x295bb8,_0x4e7fe4){return db[_0xae13('0x34')][_0xae13('0x67')]({'where':{'id':_0x25c841[_0xae13('0xab')]['id']}})[_0xae13('0x26')](handleEntityNotFound(_0x295bb8,null))[_0xae13('0x26')](function(_0x33f6b3){if(_0x33f6b3){return _0x33f6b3[_0xae13('0xbf')](_0x25c841[_0xae13('0x3a')][_0xae13('0xb2')]);}})['then'](respondWithStatusCode(_0x295bb8,null))[_0xae13('0x32')](handleError(_0x295bb8,null));};exports[_0xae13('0xc0')]=function(_0x299bd4,_0x221b23){var _0x21b2d2=moment()[_0xae13('0xc1')]()['toString']();var _0x3f441c=path[_0xae13('0xc2')](config[_0xae13('0xc3')],_0xae13('0xc4'),_0xae13('0xc5'),'tmp');var _0xa0a63b=path['join'](config['root'],_0xae13('0xc4'),_0xae13('0xc5'),_0xae13('0xc6'));var _0x47674a=path[_0xae13('0xc2')](_0x3f441c,_0x21b2d2);var _0x173a07=util[_0xae13('0xb6')](_0xae13('0xc7'),_0x299bd4[_0xae13('0xab')]['id'],_0x21b2d2);var _0x70899a=path['join'](_0x3f441c,_0x173a07);var _0xce2ef=[];_0xce2ef['push']({'model':db[_0xae13('0xc8')],'as':_0xae13('0xc8'),'attributes':['id',_0xae13('0x2d')],'raw':!![]});_0xce2ef[_0xae13('0xa7')]({'model':db[_0xae13('0xc9')],'as':'Contact','attributes':['id',_0xae13('0xca'),_0xae13('0xcb')],'raw':!![]});var _0x41aea2=[{'model':db[_0xae13('0xb1')],'as':'Messages','attributes':['id',_0xae13('0xae'),_0xae13('0xcc'),_0xae13('0xcd'),_0xae13('0xce'),_0xae13('0x7a')],'include':_0xce2ef}];_0x41aea2[_0xae13('0xa7')]({'model':db['SmsAccount'],'as':_0xae13('0xcf'),'attributes':['id','name']});_0x41aea2[_0xae13('0xa7')]({'model':db[_0xae13('0xc8')],'as':'Owner','attributes':['id',_0xae13('0x2d')]});return db[_0xae13('0x34')][_0xae13('0x67')]({'where':{'id':_0x299bd4[_0xae13('0xab')]['id']},'include':_0x41aea2})[_0xae13('0x26')](handleEntityNotFound(_0x221b23,null))[_0xae13('0x26')](function(_0x563dd8){if(_0x563dd8){var _0x5620cd=_0x563dd8[_0xae13('0xd0')]({'plain':!![]});fs[_0xae13('0xd1')](_0x47674a);var _0x2a33e8={'format':'A4','border':_0xae13('0xd2'),'header':{'height':_0xae13('0xd3'),'contents':{'first':_0xae13('0xd4')}},'footer':{'height':_0xae13('0xd5'),'contents':{'default':util[_0xae13('0xb6')](_0xae13('0xd6'),util['format'](_0xae13('0xd7'),_0xae13('0xd8'),_0x5620cd['id']),moment()[_0xae13('0xb6')]('YYYY-MM-DD')[_0xae13('0x91')]())}}};var _0x55f6fa={'channel':_0xae13('0xd8'),'account':_0x5620cd['Account'][_0xae13('0x29')],'agent':_0x5620cd[_0xae13('0xd9')]?_0x5620cd[_0xae13('0xd9')][_0xae13('0x2d')]:_0xae13('0xda'),'createdAt':moment(_0x5620cd[_0xae13('0xcc')])['format'](_0xae13('0xdb'))['toString'](),'closedAt':_0x5620cd[_0xae13('0xdc')]?moment(_0x5620cd[_0xae13('0xdd')])[_0xae13('0xb6')](_0xae13('0xdb'))[_0xae13('0x91')]():'','disposition':_0x5620cd[_0xae13('0xde')],'messages':_(_0x5620cd[_0xae13('0xdf')])[_0xae13('0x7e')]({'secret':![]})[_0xae13('0x2c')](function(_0x5ded79){return{'date':moment(_0x5ded79['createdAt'])['format'](_0xae13('0xdb'))[_0xae13('0x91')](),'sender':_0x5ded79['direction']==='out'?_0x5ded79[_0xae13('0xc8')]?_0x5ded79[_0xae13('0xc8')][_0xae13('0x2d')]:'System':_0x5ded79['Contact']['firstName']+(_0x5ded79[_0xae13('0x62')][_0xae13('0xcb')]?'\x20'+_0x5ded79[_0xae13('0x62')]['lastName']:''),'body':_0x5ded79[_0xae13('0xae')],'direction':_0x5ded79[_0xae13('0xcd')]===_0xae13('0xe0')?'A':'C','secret':_0x5ded79['secret'],'read':_0x5ded79[_0xae13('0x7a')]};})[_0xae13('0x65')]()};return ejs[_0xae13('0xe1')](path[_0xae13('0xc2')](config['root'],'server',_0xae13('0xe2'),'downloadInteraction.html'),{'interaction':_0x55f6fa})[_0xae13('0x26')](function(_0x234810){return new BPromise(function(_0x5274c1,_0x46adf0){pdf[_0xae13('0xad')](_0x234810,_0x2a33e8)[_0xae13('0xe3')](path[_0xae13('0xc2')](_0x47674a,_0xae13('0xe4')+_0x5620cd['id']+'-'+_0x21b2d2+'.pdf'),function(_0xadfa9a,_0x39aa9c){if(_0xadfa9a)return _0x46adf0(_0xadfa9a);_0x5274c1(_0x39aa9c);});});})['then'](function(){return new BPromise(function(_0xd92578,_0x18f155){zipdir(_0x47674a,{'saveTo':_0x70899a},function(_0x415cfc,_0x166fc3){if(_0x415cfc)return _0x18f155(_0x415cfc);return _0xd92578(_0x166fc3);});})['then'](function(){return new BPromise(function(_0xaf3d6e,_0x233af8){rimraf(_0x47674a,function(_0x424a2c){if(_0x424a2c)_0x233af8(_0x424a2c);return _0xaf3d6e();});});})[_0xae13('0x26')](function(){return _0x221b23['download'](_0x70899a,_0x173a07,function(_0x4a1d38){if(_0x4a1d38){console[_0xae13('0xe5')](_0xae13('0xe6'),_0x4a1d38);}else{fs[_0xae13('0xe7')](_0x70899a);}});});});}else{return _0x221b23[_0xae13('0x1d')](0xc8);}})[_0xae13('0x32')](handleError(_0x221b23,null));}; \ No newline at end of file +var _0x9354=['sms_interactions','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','tools_tags','t.id\x20=\x20it.TagId','search','parseSearch','sqlOperator','conditions','find','unreadMessages','value','having','`\x20=\x200','`\x20>\x200','Contact','$substring','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','text','Tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','User','operator','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','start','buildExpression','some','compact','isEmpty','forEach','i.SmsAccountId\x20IN\x20?','concat','createdAt','parse','$gte','$lte','null','\x20IS\x20NULL','read','`unreadMessages`\x20>\x200','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)','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','group','Sequelize','QueryTypes','i.id','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','DESC','t.id\x20IN\x20?','resolve','SmsAccountId','journey','user','getSmsAccounts','i.SmsAccountId\x20IS\x20NULL','sequelize','toString','count','keyBy','Account.key','a.mandatoryDisposition','Account.mandatoryDisposition','i.*','Contact.firstName','c.lastName','Contact.lastName','c.email','Contact.email','c.phone','Contact.phone','Contact.mobile','c.fax','Contact.fax','Owner.fullname','Owner.internal','ui.SmsInteractionId\x20IN\x20?','groupBy','SmsInteractionId','all','catch','show','params','include','merge','options','create','body','describe','addMessage','omit','findOne','SmsMessage','nolimit','format','findAll','addTags','setTags','ids','emit','removeTags','download','unix','join','server','files','tmp','attachments','transcript-%d-%s.zip','CmContact','firstName','lastName','Messages','direction','secret','SmsAccount','Account','Owner','get','10px','40px','\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20
Interaction\x20Transcript
\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','%s\x20#%d','Sms','YYYY-MM-DD','YYYY-MM-DD\x20HH:mm:ss','closed','closedAt','out','renderFile','root','downloadInteraction.html','toFile','transcript-','log','unlinkSync','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','redis','defaults','localhost','socket.io-emitter','./smsInteraction.socket','register','sendStatus','status','end','json','offset','limit','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','Users','map','fullname','TagIds','split','Tags','push','index','SmsInteraction','rawAttributes','type','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','field','color','from','select','u.id','u.fullname','ui.SmsInteractionId','user_has_sms_interactions','left_join','users','u.id\x20=\x20ui.UserId'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x9354,0x96));var _0x4935=function(_0x7148a3,_0x1c6652){_0x7148a3=_0x7148a3-0x0;var _0x52f31d=_0x9354[_0x7148a3];return _0x52f31d;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x4935('0x0'));var rimraf=require(_0x4935('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x4935('0x2'));var rp=require(_0x4935('0x3'));var moment=require(_0x4935('0x4'));var BPromise=require(_0x4935('0x5'));var Mustache=require('mustache');var util=require(_0x4935('0x6'));var path=require(_0x4935('0x7'));var sox=require(_0x4935('0x8'));var csv=require(_0x4935('0x9'));var ejs=require(_0x4935('0xa'));var fs=require('fs');var _=require(_0x4935('0xb'));var squel=require(_0x4935('0xc'));var crypto=require(_0x4935('0xd'));var jsforce=require(_0x4935('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x4935('0x9'));var querystring=require('querystring');var Papa=require(_0x4935('0xf'));var Redis=require(_0x4935('0x10'));var authService=require(_0x4935('0x11'));var qs=require(_0x4935('0x12'));var as=require(_0x4935('0x13'));var hardwareService=require(_0x4935('0x14'));var logger=require('../../config/logger')('api');var utils=require(_0x4935('0x15'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];config[_0x4935('0x16')]=_[_0x4935('0x17')](config[_0x4935('0x16')],{'host':_0x4935('0x18'),'port':0x18eb});var socket=require(_0x4935('0x19'))(new Redis(config[_0x4935('0x16')]));require(_0x4935('0x1a'))[_0x4935('0x1b')](socket);function respondWithStatusCode(_0x57549f,_0x237e28){_0x237e28=_0x237e28||0xcc;return function(_0x1ce1ba){if(_0x1ce1ba){return _0x57549f[_0x4935('0x1c')](_0x237e28);}return _0x57549f[_0x4935('0x1d')](_0x237e28)[_0x4935('0x1e')]();};}function respondWithResult(_0x24cc99,_0x395a43){_0x395a43=_0x395a43||0xc8;return function(_0x57d7ed){if(_0x57d7ed){return _0x24cc99[_0x4935('0x1d')](_0x395a43)[_0x4935('0x1f')](_0x57d7ed);}};}function respondWithFilteredResult(_0x165ed3,_0x123300){return function(_0x1f0e81){if(_0x1f0e81){var _0x429ef3=_0x1f0e81['count'],_0x4ebc63=_0x123300[_0x4935('0x20')],_0xd70eff=_0x123300[_0x4935('0x20')]+_0x123300[_0x4935('0x21')],_0x145277;if(_0xd70eff>=_0x429ef3){_0xd70eff=_0x429ef3;_0x145277=0xc8;}else{_0x145277=0xce;}_0x165ed3['status'](_0x145277);return _0x165ed3['set'](_0x4935('0x22'),_0x4ebc63+'-'+_0xd70eff+'/'+_0x429ef3)[_0x4935('0x1f')](_0x1f0e81);}return null;};}function patchUpdates(_0x1ae059){return function(_0x388422){try{jsonpatch[_0x4935('0x23')](_0x388422,_0x1ae059,!![]);}catch(_0x16ab7c){return BPromise[_0x4935('0x24')](_0x16ab7c);}return _0x388422[_0x4935('0x25')]();};}function saveUpdates(_0x58b2f3,_0x2f520a){return function(_0x320d81){if(_0x320d81){return _0x320d81[_0x4935('0x26')](_0x58b2f3)[_0x4935('0x27')](function(_0x52c65a){return _0x52c65a;});}return null;};}function removeEntity(_0x53530f,_0x4dc1f5){return function(_0x36e76a){if(_0x36e76a){return _0x36e76a[_0x4935('0x28')]()[_0x4935('0x27')](function(){_0x53530f[_0x4935('0x1d')](0xcc)[_0x4935('0x1e')]();});}};}function handleEntityNotFound(_0x1c37ba,_0x3784f9){return function(_0x1d53a7){if(!_0x1d53a7){_0x1c37ba[_0x4935('0x1c')](0x194);}return _0x1d53a7;};}function handleError(_0xf4abb2,_0x1d08b5){_0x1d08b5=_0x1d08b5||0x1f4;return function(_0x39d07b){logger[_0x4935('0x29')](_0x39d07b[_0x4935('0x2a')]);if(_0x39d07b[_0x4935('0x2b')]){delete _0x39d07b['name'];}_0xf4abb2['status'](_0x1d08b5)['send'](_0x39d07b);};}function getInteractionUsers(_0x1fc218,_0x76ea7d){return new BPromise(function(_0x4f1163,_0x3f0707){try{if(_0x76ea7d[_0x1fc218['id']]){_0x1fc218[_0x4935('0x2c')]=_[_0x4935('0x2d')](_0x76ea7d[_0x1fc218['id']],function(_0x9fe9f6){return{'id':_0x9fe9f6['id'],'fullname':_0x9fe9f6[_0x4935('0x2e')]};});}}catch(_0x24262e){_0x3f0707(_0x24262e);}_0x4f1163(_0x1fc218);});}function getInteractionTags(_0x28afc2,_0x2fe6da){return new BPromise(function(_0x5b3c8e,_0xb7fe2a){try{if(_0x28afc2[_0x4935('0x2f')]){_0x28afc2['Tags']=[];_0x28afc2['TagIds'][_0x4935('0x30')](',')['forEach'](function(_0x2e8cb1){_0x28afc2[_0x4935('0x31')][_0x4935('0x32')](_0x2fe6da[_0x2e8cb1]);});}delete _0x28afc2['TagIds'];}catch(_0x4bb012){_0xb7fe2a(_0x4bb012);}_0x5b3c8e(_0x28afc2);});}function updateSmsInteraction(_0x415260,_0x2eab83,_0x4fabea){return new BPromise(function(_0x47003b,_0x3260d2){return getInteractionUsers(_0x415260,_0x4fabea)[_0x4935('0x27')](function(_0xb2ce85){return getInteractionTags(_0xb2ce85,_0x2eab83);})[_0x4935('0x27')](function(_0x4a69bc){_0x47003b(_0x4a69bc);})['catch'](function(_0x3d8795){_0x3260d2(_0x3d8795);});});}exports[_0x4935('0x33')]=function(_0x512b7b,_0x4945a7){var _0xb3d934={},_0x51f49b={},_0x7b45d1={'count':0x0,'rows':[]};var _0x3f32fb=_[_0x4935('0x2d')](db[_0x4935('0x34')][_0x4935('0x35')],function(_0x36d0b9){return{'name':_0x36d0b9['fieldName'],'type':_0x36d0b9[_0x4935('0x36')]['key']};});_0x51f49b[_0x4935('0x37')]=_['map'](_0x3f32fb,_0x4935('0x2b'));_0x51f49b['query']=_[_0x4935('0x38')](_0x512b7b[_0x4935('0x39')]);_0x51f49b[_0x4935('0x3a')]=_[_0x4935('0x3b')](_0x51f49b[_0x4935('0x37')],_0x51f49b[_0x4935('0x39')]);_0xb3d934[_0x4935('0x3c')]=_['intersection'](_0x51f49b['model'],qs[_0x4935('0x3d')](_0x512b7b['query']['fields']));_0xb3d934[_0x4935('0x3c')]=_0xb3d934['attributes'][_0x4935('0x3e')]?_0xb3d934[_0x4935('0x3c')]:_0x51f49b[_0x4935('0x37')];if(!_0x512b7b[_0x4935('0x39')][_0x4935('0x3f')]('nolimit')){_0xb3d934['limit']=qs[_0x4935('0x21')](_0x512b7b[_0x4935('0x39')][_0x4935('0x21')]);_0xb3d934[_0x4935('0x20')]=qs[_0x4935('0x20')](_0x512b7b[_0x4935('0x39')][_0x4935('0x20')]);}_0xb3d934[_0x4935('0x40')]=qs['sort'](_0x512b7b['query'][_0x4935('0x41')]);_0xb3d934[_0x4935('0x42')]=qs['filters'](_[_0x4935('0x43')](_0x512b7b[_0x4935('0x39')],_0x51f49b[_0x4935('0x3a')]),_0x3f32fb);var _0xe5c9f5=[];var _0x52ab0c=squel['select']()[_0x4935('0x44')]('id')[_0x4935('0x44')]('name')[_0x4935('0x44')](_0x4935('0x45'))[_0x4935('0x46')]('tools_tags');var _0x1a93c8=squel[_0x4935('0x47')]()[_0x4935('0x44')](_0x4935('0x48'))[_0x4935('0x44')](_0x4935('0x49'))[_0x4935('0x44')](_0x4935('0x4a'))[_0x4935('0x46')](_0x4935('0x4b'),'ui')[_0x4935('0x4c')](_0x4935('0x4d'),'u',_0x4935('0x4e'));var _0xf4e847=squel[_0x4935('0x47')]()[_0x4935('0x46')](_0x4935('0x4f'),'i')[_0x4935('0x4c')]('cm_contacts','c',_0x4935('0x50'))['left_join'](_0x4935('0x4d'),'o',_0x4935('0x51'))[_0x4935('0x4c')](_0x4935('0x52'),'a','a.id\x20=\x20i.SmsAccountId')[_0x4935('0x4c')](_0x4935('0x53'),'me',_0x4935('0x54'))[_0x4935('0x4c')](_0x4935('0x55'),'it',_0x4935('0x56'))[_0x4935('0x4c')](_0x4935('0x57'),'t',_0x4935('0x58'));var _0x392cba=squel['expr']();var _0x2e001b=[];var _0x1c3d9c=squel['expr']();var _0x447a64;if(_0x512b7b[_0x4935('0x39')][_0x4935('0x59')]){_0x447a64=as[_0x4935('0x5a')](_0x512b7b[_0x4935('0x39')][_0x4935('0x59')]);var _0x289c5e=_0x447a64[_0x4935('0x5b')];for(var _0x4b9c70=0x0;_0x4b9c70<_0x447a64[_0x4935('0x5c')]['length'];_0x4b9c70++){var _0x561fa3=_0x447a64[_0x4935('0x5c')][_0x4b9c70];var _0x189071='i';var _0x41c6d0=_[_0x4935('0x5d')](_0x3f32fb,[_0x4935('0x2b'),_0x561fa3['field']]);if(!_0x41c6d0){switch(_0x561fa3[_0x4935('0x44')]){case _0x4935('0x5e'):if(_0x561fa3[_0x4935('0x5f')]==0x1){_0xf4e847[_0x4935('0x60')]('`'+_0x561fa3[_0x4935('0x44')]+_0x4935('0x61'));}else{_0xf4e847[_0x4935('0x60')]('`'+_0x561fa3[_0x4935('0x44')]+_0x4935('0x62'));}break;case _0x4935('0x63'):if(_0x561fa3['operator']===_0x4935('0x64')){if(_0x561fa3['value'][_0x4935('0x30')]('\x20')[_0x4935('0x3e')]>0x1){_0x392cba[_0x289c5e]('MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0x4935('0x65')](_0x561fa3['value']),null);}else{var _0x58a89b='%'+_0x561fa3['value']+'%';_0x392cba[_0x289c5e](_0x4935('0x66'),_0x58a89b,_0x58a89b,_0x58a89b);}}else{_0x41c6d0=_[_0x4935('0x5d')](_0x3f32fb,[_0x4935('0x2b'),_0x4935('0x67')]);_0x561fa3[_0x4935('0x44')]='ContactId';_0x3003a6=as['buildExpression'](_0x189071,_0x41c6d0[_0x4935('0x36')],_0x561fa3);_0x392cba[_0x289c5e](_0x3003a6[_0x4935('0x68')],_0x3003a6[_0x4935('0x5f')]['start'],_0x3003a6[_0x4935('0x5f')][_0x4935('0x1e')]);}break;case _0x4935('0x69'):var _0xc92288=_0x561fa3['value'][_0x4935('0x30')](',')['map'](function(_0x5093a5){return Number(_0x5093a5);});_0xc92288['forEach'](function(_0x24d870){_0x1c3d9c['or'](_0x4935('0x6a'),'%,'+_0x24d870+',%');});_0x2e001b=_['union'](_0x2e001b,_0xc92288);break;case _0x4935('0x6b'):if(_0x561fa3[_0x4935('0x6c')]==='$substring'){_0x392cba[_0x289c5e](_0x4935('0x6d'),'%'+_0x561fa3[_0x4935('0x5f')]+'%',null);}else{_0x41c6d0=_[_0x4935('0x5d')](_0x3f32fb,[_0x4935('0x2b'),_0x4935('0x6e')]);_0x561fa3[_0x4935('0x44')]=_0x4935('0x6e');_0x3003a6=as['buildExpression'](_0x189071,_0x41c6d0[_0x4935('0x36')],_0x561fa3);_0x392cba[_0x289c5e](_0x3003a6['text'],_0x3003a6['value'][_0x4935('0x6f')],_0x3003a6[_0x4935('0x5f')]['end']);}break;case'body':_0x3003a6=as[_0x4935('0x70')]('me',null,_0x561fa3);_0x392cba[_0x289c5e](_0x3003a6[_0x4935('0x68')],_0x3003a6[_0x4935('0x5f')]['start'],_0x3003a6[_0x4935('0x5f')]['end']);break;}}else{var _0x3003a6=as[_0x4935('0x70')](_0x189071,_0x41c6d0[_0x4935('0x36')],_0x561fa3);_0x392cba[_0x289c5e](_0x3003a6[_0x4935('0x68')],_0x3003a6[_0x4935('0x5f')]['start'],_0x3003a6[_0x4935('0x5f')][_0x4935('0x1e')]);}}}else{var _0x5aef06=_(_0x512b7b[_0x4935('0x39')])[_0x4935('0x38')]()[_0x4935('0x2d')](function(_0x2046b2){return _[_0x4935('0x71')](_0x3f32fb,[_0x4935('0x2b'),_0x2046b2])?_0x2046b2:undefined;})[_0x4935('0x72')]()[_0x4935('0x5f')]();if(!_[_0x4935('0x73')](_0x5aef06)){_0x5aef06[_0x4935('0x74')](function(_0x44d6a0){if(_0x44d6a0==='SmsAccountId'){_0xf4e847[_0x4935('0x42')](_0x4935('0x75'),[][_0x4935('0x76')](_0x512b7b[_0x4935('0x39')][_0x44d6a0]));}else if(_0x44d6a0===_0x4935('0x77')){var _0x95da52=JSON[_0x4935('0x78')](_0x512b7b[_0x4935('0x39')][_0x44d6a0])[_0x4935('0x79')];var _0x19d5d0=JSON[_0x4935('0x78')](_0x512b7b[_0x4935('0x39')][_0x44d6a0])[_0x4935('0x7a')];_0xf4e847['where']('i.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x95da52,_0x19d5d0);}else{if(_0x512b7b[_0x4935('0x39')][_0x44d6a0]===_0x4935('0x7b')){_0xf4e847['where']('i.'+_0x44d6a0+_0x4935('0x7c'));}else{_0xf4e847[_0x4935('0x42')]('i.'+_0x44d6a0+'\x20=\x20?',_0x512b7b['query'][_0x44d6a0]);}}});}if(_0x512b7b[_0x4935('0x39')][_0x4935('0x7d')]){if(_0x512b7b[_0x4935('0x39')][_0x4935('0x7d')]==0x1){_0xf4e847[_0x4935('0x60')]('`unreadMessages`\x20=\x200');}else{_0xf4e847[_0x4935('0x60')](_0x4935('0x7e'));}}if(_0x512b7b[_0x4935('0x39')][_0x4935('0x7f')]){_0x2e001b=_['isArray'](_0x512b7b[_0x4935('0x39')]['tag'])?_0x512b7b['query'][_0x4935('0x7f')]:new Array(_0x512b7b[_0x4935('0x39')]['tag']);_0x2e001b[_0x4935('0x74')](function(_0x22d594){_0x1c3d9c['or'](_0x4935('0x6a'),'%,'+_0x22d594+',%');});}if(_0x512b7b['query'][_0x4935('0x80')]){var _0x4ac1b8=_0x512b7b['query'][_0x4935('0x80')][_0x4935('0x81')]('\x5c','\x5c\x5c')[_0x4935('0x81')]('\x27\x27',_0x4935('0x82'));if(qs[_0x4935('0x83')](_0x4ac1b8)){_0x392cba['or'](_0x4935('0x84'),_0x4ac1b8+'%')['or'](_0x4935('0x85'),_0x4ac1b8+'%');}else{_0x392cba['or'](_0x4935('0x86'),qs['getFullTextValue'](_0x4ac1b8))['or'](_0x4935('0x87'),_0x4ac1b8+'%');}}}_0xf4e847[_0x4935('0x42')](_0x392cba);_0xf4e847[_0x4935('0x88')]('i.id');var _0x47f144={'type':db[_0x4935('0x89')][_0x4935('0x8a')]['SELECT'],'raw':!![]};var _0x2f47bc=_0xf4e847['clone']();_0x2f47bc['field'](_0x4935('0x8b'));_0x2f47bc[_0x4935('0x44')](_0x4935('0x8c'),'unreadMessages');if(_0xb3d934['order']){_0xb3d934[_0x4935('0x40')]['forEach'](function(_0x3b9fa6){_0xf4e847['order']('i.'+_0x3b9fa6[0x0],_0x3b9fa6[0x1]===_0x4935('0x8d')?![]:!![]);});}if(!_[_0x4935('0x73')](_0x2e001b)){_0xf4e847[_0x4935('0x60')](_0x1c3d9c);_0x2f47bc[_0x4935('0x42')](_0x4935('0x8e'),_0x2e001b);}BPromise[_0x4935('0x8f')]()[_0x4935('0x27')](function(){if(!_0x447a64){if(_0x512b7b['query'][_0x4935('0x90')]||_0x512b7b['query'][_0x4935('0x91')])return;_0x2f47bc[_0x4935('0x42')]('i.SmsAccountId\x20IS\x20NOT\x20NULL');_0xf4e847[_0x4935('0x42')]('i.SmsAccountId\x20IS\x20NOT\x20NULL');return;}return _0x512b7b[_0x4935('0x92')][_0x4935('0x93')]({'attributes':['id'],'raw':!![]})['then'](function(_0x582a2c){if(_['isEmpty'](_0x582a2c)){_0x2f47bc[_0x4935('0x42')]('i.SmsAccountId\x20IS\x20NULL');_0xf4e847['where'](_0x4935('0x94'));}else{_0x2f47bc['where'](_0x4935('0x75'),_['map'](_0x582a2c,'id'));_0xf4e847['where']('i.SmsAccountId\x20IN\x20?',_[_0x4935('0x2d')](_0x582a2c,'id'));}});})['then'](function(){db[_0x4935('0x95')][_0x4935('0x39')](_0x2f47bc[_0x4935('0x96')](),_0x47f144)[_0x4935('0x27')](function(_0x32495e){_0x7b45d1['count']=_0x32495e[_0x4935('0x3e')];if(_0x7b45d1[_0x4935('0x97')]===0x0)return[];return db['sequelize'][_0x4935('0x39')](_0x52ab0c[_0x4935('0x96')](),_0x47f144)['then'](function(_0x1ffef1){_0xe5c9f5=_[_0x4935('0x98')](_0x1ffef1,'id');_0x47f144=_['merge'](_0x47f144,{'model':db[_0x4935('0x34')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x512b7b['query'][_0x4935('0x3d')]){_0xb3d934[_0x4935('0x3c')]['forEach'](function(_0x3515c9){_0xf4e847[_0x4935('0x44')]('i.'+_0x3515c9);});}else{_0xf4e847['field']('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0x4935('0x5e'));_0xf4e847[_0x4935('0x44')]('a.key',_0x4935('0x99'));_0xf4e847[_0x4935('0x44')](_0x4935('0x9a'),_0x4935('0x9b'));_0xf4e847['field'](_0x4935('0x9c'));_0xf4e847[_0x4935('0x44')]('c.firstName',_0x4935('0x9d'));_0xf4e847[_0x4935('0x44')](_0x4935('0x9e'),_0x4935('0x9f'));_0xf4e847[_0x4935('0x44')](_0x4935('0xa0'),_0x4935('0xa1'));_0xf4e847[_0x4935('0x44')](_0x4935('0xa2'),_0x4935('0xa3'));_0xf4e847[_0x4935('0x44')]('c.mobile',_0x4935('0xa4'));_0xf4e847[_0x4935('0x44')](_0x4935('0xa5'),_0x4935('0xa6'));_0xf4e847[_0x4935('0x44')]('o.fullname',_0x4935('0xa7'));_0xf4e847[_0x4935('0x44')]('o.internal',_0x4935('0xa8'));_0xf4e847[_0x4935('0x44')]('GROUP_CONCAT(DISTINCT\x20t.id)',_0x4935('0x2f'));}if(_0xb3d934[_0x4935('0x21')])_0xf4e847[_0x4935('0x21')](_0xb3d934['limit']);if(_0xb3d934[_0x4935('0x20')])_0xf4e847[_0x4935('0x20')](_0xb3d934[_0x4935('0x20')]);return db[_0x4935('0x95')][_0x4935('0x39')](_0xf4e847['toString'](),_0x47f144);})[_0x4935('0x27')](function(_0x39901d){_0x1a93c8[_0x4935('0x42')](_0x4935('0xa9'),_[_0x4935('0x2d')](_0x39901d,'id'));return db[_0x4935('0x95')]['query'](_0x1a93c8[_0x4935('0x96')](),_0x47f144)[_0x4935('0x27')](function(_0x60bb5f){var _0x13ca4f=_[_0x4935('0xaa')](_0x60bb5f,_0x4935('0xab'));var _0x23fd89=[];_0x39901d['forEach'](function(_0x107897){_0x23fd89[_0x4935('0x32')](updateSmsInteraction(_0x107897,_0xe5c9f5,_0x13ca4f));});return BPromise[_0x4935('0xac')](_0x23fd89);});});})[_0x4935('0x27')](function(_0x35a451){_0x7b45d1['rows']=_0x35a451;return _0x7b45d1;})['then'](respondWithFilteredResult(_0x4945a7,_0xb3d934));})[_0x4935('0xad')](handleError(_0x4945a7,null));};exports[_0x4935('0xae')]=function(_0x463226,_0xe3bc97){var _0x190aa0={'raw':![],'where':{'id':_0x463226[_0x4935('0xaf')]['id']}},_0x515506={};_0x515506[_0x4935('0x37')]=_[_0x4935('0x38')](db['SmsInteraction'][_0x4935('0x35')]);_0x515506[_0x4935('0x39')]=_[_0x4935('0x38')](_0x463226[_0x4935('0x39')]);_0x515506[_0x4935('0x3a')]=_[_0x4935('0x3b')](_0x515506[_0x4935('0x37')],_0x515506['query']);_0x190aa0[_0x4935('0x3c')]=_['intersection'](_0x515506[_0x4935('0x37')],qs['fields'](_0x463226['query'][_0x4935('0x3d')]));_0x190aa0['attributes']=_0x190aa0['attributes'][_0x4935('0x3e')]?_0x190aa0[_0x4935('0x3c')]:_0x515506['model'];if(_0x463226[_0x4935('0x39')]['includeAll']){_0x190aa0[_0x4935('0xb0')]=[{'all':!![]}];}_0x190aa0=_[_0x4935('0xb1')]({},_0x190aa0,_0x463226[_0x4935('0xb2')]);return db[_0x4935('0x34')][_0x4935('0x5d')](_0x190aa0)[_0x4935('0x27')](handleEntityNotFound(_0xe3bc97,null))['then'](respondWithResult(_0xe3bc97,null))[_0x4935('0xad')](handleError(_0xe3bc97,null));};exports[_0x4935('0xb3')]=function(_0xce134a,_0x5d53e6){return db[_0x4935('0x34')][_0x4935('0xb3')](_0xce134a[_0x4935('0xb4')],{})['then'](respondWithResult(_0x5d53e6,0xc9))[_0x4935('0xad')](handleError(_0x5d53e6,null));};exports[_0x4935('0x26')]=function(_0x401ea7,_0x23b6eb){if(_0x401ea7[_0x4935('0xb4')]['id']){delete _0x401ea7['body']['id'];}return db[_0x4935('0x34')]['find']({'where':{'id':_0x401ea7[_0x4935('0xaf')]['id']}})['then'](handleEntityNotFound(_0x23b6eb,null))[_0x4935('0x27')](saveUpdates(_0x401ea7['body'],null))[_0x4935('0x27')](respondWithResult(_0x23b6eb,null))[_0x4935('0xad')](handleError(_0x23b6eb,null));};exports[_0x4935('0x28')]=function(_0x5d9398,_0x31d209){return db[_0x4935('0x34')][_0x4935('0x5d')]({'where':{'id':_0x5d9398[_0x4935('0xaf')]['id']}})[_0x4935('0x27')](handleEntityNotFound(_0x31d209,null))[_0x4935('0x27')](removeEntity(_0x31d209,null))[_0x4935('0xad')](handleError(_0x31d209,null));};exports[_0x4935('0xb5')]=function(_0xc4ce1d,_0x575ca2){return db[_0x4935('0x34')][_0x4935('0xb5')]()[_0x4935('0x27')](respondWithResult(_0x575ca2,null))[_0x4935('0xad')](handleError(_0x575ca2,null));};exports[_0x4935('0xb6')]=function(_0x203750,_0x3f2d82,_0x5107d4){return db['SmsMessage'][_0x4935('0x5d')]({'where':{'id':_0x203750['params']['id']}})['then'](handleEntityNotFound(_0x3f2d82,null))[_0x4935('0x27')](function(_0x3a4266){if(_0x3a4266){return _0x3a4266[_0x4935('0xb6')](_0x203750[_0x4935('0xb4')]['ids'],_[_0x4935('0xb7')](_0x203750[_0x4935('0xb4')],['ids','id'])||{});}})['then'](respondWithResult(_0x3f2d82,null))['catch'](handleError(_0x3f2d82,null));};exports['getMessages']=function(_0x4d0933,_0x38c352,_0x14d6b8){var _0x5ec439={'raw':![],'where':{}};var _0x492bfb={};var _0x5665bf={'count':0x0,'rows':[]};return db[_0x4935('0x34')][_0x4935('0xb8')]({'where':{'id':_0x4d0933[_0x4935('0xaf')]['id']}})['then'](handleEntityNotFound(_0x38c352,null))['then'](function(_0x598350){if(_0x598350){_0x492bfb[_0x4935('0x37')]=_[_0x4935('0x38')](db[_0x4935('0xb9')][_0x4935('0x35')]);_0x492bfb['query']=_[_0x4935('0x38')](_0x4d0933[_0x4935('0x39')]);_0x492bfb[_0x4935('0x3a')]=_['intersection'](_0x492bfb['model'],_0x492bfb[_0x4935('0x39')]);_0x5ec439[_0x4935('0x3c')]=_[_0x4935('0x3b')](_0x492bfb[_0x4935('0x37')],qs[_0x4935('0x3d')](_0x4d0933[_0x4935('0x39')][_0x4935('0x3d')]));_0x5ec439[_0x4935('0x3c')]=_0x5ec439[_0x4935('0x3c')]['length']?_0x5ec439[_0x4935('0x3c')]:_0x492bfb[_0x4935('0x37')];if(!_0x4d0933['query']['hasOwnProperty'](_0x4935('0xba'))){_0x5ec439['limit']=qs[_0x4935('0x21')](_0x4d0933[_0x4935('0x39')]['limit']);_0x5ec439[_0x4935('0x20')]=qs['offset'](_0x4d0933[_0x4935('0x39')][_0x4935('0x20')]);}_0x5ec439['order']=qs['sort'](_0x4d0933[_0x4935('0x39')][_0x4935('0x41')]);_0x5ec439[_0x4935('0x42')]=qs[_0x4935('0x3a')](_[_0x4935('0x43')](_0x4d0933[_0x4935('0x39')],_0x492bfb[_0x4935('0x3a')]));_0x5ec439[_0x4935('0x42')]['SmsInteractionId']=_0x598350['id'];if(_0x4d0933['query'][_0x4935('0x80')]){_0x5ec439[_0x4935('0x42')]=_[_0x4935('0xb1')](_0x5ec439[_0x4935('0x42')],{'$or':_[_0x4935('0x2d')](_0x5ec439[_0x4935('0x3c')],function(_0x3f13d7){var _0x26c2f9={};_0x26c2f9[_0x3f13d7]={'$like':'%'+_0x4d0933['query'][_0x4935('0x80')]+'%'};return _0x26c2f9;})});}if(_0x4d0933['query'][_0x4935('0x79')]){var _0x52a661=_0x4d0933[_0x4935('0x39')][_0x4935('0x79')][_0x4935('0x30')](',');var _0x409d86={};_0x409d86[_0x52a661[0x0]]={'$gte':moment(_0x52a661[0x1])[_0x4935('0xbb')]('YYYY-MM-DD\x20HH:mm:ss')};_0x5ec439[_0x4935('0x42')]=_[_0x4935('0xb1')](_0x5ec439[_0x4935('0x42')],_0x409d86);}_0x5ec439=_['merge']({},_0x5ec439,_0x4d0933['options']);return db[_0x4935('0xb9')]['count']({'where':_0x5ec439[_0x4935('0x42')]})[_0x4935('0x27')](function(_0x3faf56){_0x5665bf[_0x4935('0x97')]=_0x3faf56;if(_0x4d0933[_0x4935('0x39')]['includeAll']){_0x5ec439[_0x4935('0xb0')]=[{'all':!![]}];}return db[_0x4935('0xb9')][_0x4935('0xbc')](_0x5ec439);})[_0x4935('0x27')](function(_0x46eebd){_0x5665bf['rows']=_0x46eebd;return _0x5665bf;});}})[_0x4935('0x27')](respondWithFilteredResult(_0x38c352,_0x5ec439))[_0x4935('0xad')](handleError(_0x38c352,null));};exports[_0x4935('0xbd')]=function(_0x19aa4e,_0x51a95e,_0x4aa286){return db['SmsInteraction']['find']({'where':{'id':_0x19aa4e[_0x4935('0xaf')]['id']}})[_0x4935('0x27')](handleEntityNotFound(_0x51a95e,null))[_0x4935('0x27')](function(_0x41cab4){if(_0x41cab4){return _0x41cab4[_0x4935('0xbe')](_0x19aa4e[_0x4935('0xb4')][_0x4935('0xbf')],_[_0x4935('0xb7')](_0x19aa4e[_0x4935('0xb4')],[_0x4935('0xbf'),'id'])||{})['spread'](function(){return db[_0x4935('0x69')][_0x4935('0xbc')]({'attributes':['id',_0x4935('0x2b'),_0x4935('0x45')],'where':{'id':_0x19aa4e[_0x4935('0xb4')][_0x4935('0xbf')]}});})[_0x4935('0x27')](function(_0x1da775){socket[_0x4935('0xc0')]('smsInteractionTags:save',{'id':Number(_0x19aa4e['params']['id']),'tags':_0x1da775||[]});return{'id':Number(_0x19aa4e[_0x4935('0xaf')]['id']),'tags':_0x1da775||[]};});}})[_0x4935('0x27')](respondWithResult(_0x51a95e,null))[_0x4935('0xad')](handleError(_0x51a95e,null));};exports[_0x4935('0xc1')]=function(_0x181fa8,_0x161f14,_0x1c55ad){return db[_0x4935('0x34')]['find']({'where':{'id':_0x181fa8[_0x4935('0xaf')]['id']}})[_0x4935('0x27')](handleEntityNotFound(_0x161f14,null))['then'](function(_0x46f309){if(_0x46f309){return _0x46f309['removeTags'](_0x181fa8[_0x4935('0x39')][_0x4935('0xbf')]);}})[_0x4935('0x27')](respondWithStatusCode(_0x161f14,null))[_0x4935('0xad')](handleError(_0x161f14,null));};exports[_0x4935('0xc2')]=function(_0x37a095,_0x70c9b6){var _0x379b5e=moment()[_0x4935('0xc3')]()[_0x4935('0x96')]();var _0x4ace12=path[_0x4935('0xc4')](config['root'],_0x4935('0xc5'),_0x4935('0xc6'),_0x4935('0xc7'));var _0x3b66fe=path[_0x4935('0xc4')](config['root'],_0x4935('0xc5'),_0x4935('0xc6'),_0x4935('0xc8'));var _0x1ac8bc=path[_0x4935('0xc4')](_0x4ace12,_0x379b5e);var _0x260829=util[_0x4935('0xbb')](_0x4935('0xc9'),_0x37a095[_0x4935('0xaf')]['id'],_0x379b5e);var _0x37ea56=path[_0x4935('0xc4')](_0x4ace12,_0x260829);var _0xdd0d0b=[];_0xdd0d0b['push']({'model':db[_0x4935('0x6b')],'as':_0x4935('0x6b'),'attributes':['id',_0x4935('0x2e')],'raw':!![]});_0xdd0d0b['push']({'model':db[_0x4935('0xca')],'as':'Contact','attributes':['id',_0x4935('0xcb'),_0x4935('0xcc')],'raw':!![]});var _0x216ef8=[{'model':db[_0x4935('0xb9')],'as':_0x4935('0xcd'),'attributes':['id','body',_0x4935('0x77'),_0x4935('0xce'),_0x4935('0xcf'),_0x4935('0x7d')],'include':_0xdd0d0b}];_0x216ef8['push']({'model':db[_0x4935('0xd0')],'as':_0x4935('0xd1'),'attributes':['id',_0x4935('0x2b')]});_0x216ef8[_0x4935('0x32')]({'model':db[_0x4935('0x6b')],'as':_0x4935('0xd2'),'attributes':['id',_0x4935('0x2e')]});return db[_0x4935('0x34')]['find']({'where':{'id':_0x37a095[_0x4935('0xaf')]['id']},'include':_0x216ef8})[_0x4935('0x27')](handleEntityNotFound(_0x70c9b6,null))[_0x4935('0x27')](function(_0x50a224){if(_0x50a224){var _0x3d508b=_0x50a224[_0x4935('0xd3')]({'plain':!![]});fs['mkdirSync'](_0x1ac8bc);var _0x50c9da={'format':'A4','border':_0x4935('0xd4'),'header':{'height':_0x4935('0xd5'),'contents':{'first':_0x4935('0xd6')}},'footer':{'height':'30px','contents':{'default':util['format']('\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20%s\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20{{page}}/{{pages}}\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20%s\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',util[_0x4935('0xbb')](_0x4935('0xd7'),_0x4935('0xd8'),_0x3d508b['id']),moment()[_0x4935('0xbb')](_0x4935('0xd9'))['toString']())}}};var _0x15c87c={'channel':'Sms','account':_0x3d508b['Account']['name'],'agent':_0x3d508b[_0x4935('0xd2')]?_0x3d508b[_0x4935('0xd2')][_0x4935('0x2e')]:'N.A.','createdAt':moment(_0x3d508b[_0x4935('0x77')])[_0x4935('0xbb')](_0x4935('0xda'))['toString'](),'closedAt':_0x3d508b[_0x4935('0xdb')]?moment(_0x3d508b[_0x4935('0xdc')])['format']('YYYY-MM-DD\x20HH:mm:ss')[_0x4935('0x96')]():'','disposition':_0x3d508b['disposition'],'messages':_(_0x3d508b[_0x4935('0xcd')])[_0x4935('0x80')]({'secret':![]})['map'](function(_0x2b4cb9){return{'date':moment(_0x2b4cb9['createdAt'])['format'](_0x4935('0xda'))[_0x4935('0x96')](),'sender':_0x2b4cb9[_0x4935('0xce')]===_0x4935('0xdd')?_0x2b4cb9[_0x4935('0x6b')]?_0x2b4cb9[_0x4935('0x6b')][_0x4935('0x2e')]:'System':_0x2b4cb9[_0x4935('0x63')]['firstName']+(_0x2b4cb9[_0x4935('0x63')][_0x4935('0xcc')]?'\x20'+_0x2b4cb9[_0x4935('0x63')][_0x4935('0xcc')]:''),'body':_0x2b4cb9[_0x4935('0xb4')],'direction':_0x2b4cb9[_0x4935('0xce')]==='out'?'A':'C','secret':_0x2b4cb9['secret'],'read':_0x2b4cb9[_0x4935('0x7d')]};})[_0x4935('0x5f')]()};return ejs[_0x4935('0xde')](path[_0x4935('0xc4')](config[_0x4935('0xdf')],_0x4935('0xc5'),'views',_0x4935('0xe0')),{'interaction':_0x15c87c})[_0x4935('0x27')](function(_0x407dd5){return new BPromise(function(_0x5457c7,_0x5d2d94){pdf[_0x4935('0xb3')](_0x407dd5,_0x50c9da)[_0x4935('0xe1')](path[_0x4935('0xc4')](_0x1ac8bc,_0x4935('0xe2')+_0x3d508b['id']+'-'+_0x379b5e+'.pdf'),function(_0x5aeff4,_0x47402d){if(_0x5aeff4)return _0x5d2d94(_0x5aeff4);_0x5457c7(_0x47402d);});});})[_0x4935('0x27')](function(){return new BPromise(function(_0x538fa5,_0x4b9633){zipdir(_0x1ac8bc,{'saveTo':_0x37ea56},function(_0x2e057d,_0x362ef8){if(_0x2e057d)return _0x4b9633(_0x2e057d);return _0x538fa5(_0x362ef8);});})['then'](function(){return new BPromise(function(_0x4a382c,_0x242c6d){rimraf(_0x1ac8bc,function(_0x20d00f){if(_0x20d00f)_0x242c6d(_0x20d00f);return _0x4a382c();});});})[_0x4935('0x27')](function(){return _0x70c9b6[_0x4935('0xc2')](_0x37ea56,_0x260829,function(_0x27feac){if(_0x27feac){console[_0x4935('0xe3')]('err',_0x27feac);}else{fs[_0x4935('0xe4')](_0x37ea56);}});});});}else{return _0x70c9b6[_0x4935('0x1c')](0xc8);}})[_0x4935('0xad')](handleError(_0x70c9b6,null));}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.events.js b/server/api/smsInteraction/smsInteraction.events.js index 36a9da8..c8dd27e 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 _0x24ca=['remove','getUsers','then','setDataValue','map','findAll','unreadMessages','length','emit','catch','hasOwnProperty','hook','events','SmsInteraction','../../mysqldb','SmsMessage','save','update'];(function(_0x1c8c28,_0x3ee093){var _0x1f59b4=function(_0x29bcc0){while(--_0x29bcc0){_0x1c8c28['push'](_0x1c8c28['shift']());}};_0x1f59b4(++_0x3ee093);}(_0x24ca,0x1bc));var _0xa24c=function(_0x3a1ea5,_0x349f01){_0x3a1ea5=_0x3a1ea5-0x0;var _0xfac9b2=_0x24ca[_0x3a1ea5];return _0xfac9b2;};'use strict';var EventEmitter=require(_0xa24c('0x0'));var SmsInteraction=require('../../mysqldb')['db'][_0xa24c('0x1')];var SmsMessage=require(_0xa24c('0x2'))['db'][_0xa24c('0x3')];var SmsInteractionEvents=new EventEmitter();SmsInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xa24c('0x4'),'afterUpdate':_0xa24c('0x5'),'afterDestroy':_0xa24c('0x6')};function emitEvent(_0x28aa2f){return function(_0xe76a30,_0x15a5cd,_0xf0511){_0xe76a30[_0xa24c('0x7')]({'attributes':['id'],'raw':!![]})[_0xa24c('0x8')](function(_0x257264){_0xe76a30[_0xa24c('0x9')]('Users',_0x257264[_0xa24c('0xa')](function(_0x3a5727){return{'id':_0x3a5727['id']};}));return SmsMessage[_0xa24c('0xb')]({'where':{'SmsInteractionId':_0xe76a30['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x399f32){_0xe76a30[_0xa24c('0x9')](_0xa24c('0xc'),_0x399f32[_0xa24c('0xd')]);SmsInteractionEvents[_0xa24c('0xe')](_0x28aa2f+':'+_0xe76a30['id'],_0xe76a30);SmsInteractionEvents[_0xa24c('0xe')](_0x28aa2f,_0xe76a30);_0xf0511(null);})[_0xa24c('0xf')](_0xf0511(null));};}for(var e in events){if(events[_0xa24c('0x10')](e)){var event=events[e];SmsInteraction[_0xa24c('0x11')](e,emitEvent(event));}}module['exports']=SmsInteractionEvents; \ No newline at end of file +var _0x885a=['then','Users','map','setDataValue','unreadMessages','length','emit','hasOwnProperty','hook','exports','../../mysqldb','SmsInteraction','SmsMessage','save','update','remove','getUsers'];(function(_0x4d7046,_0x49fe7e){var _0x4c8c53=function(_0x51d2ed){while(--_0x51d2ed){_0x4d7046['push'](_0x4d7046['shift']());}};_0x4c8c53(++_0x49fe7e);}(_0x885a,0x180));var _0xa885=function(_0x59ee6f,_0x450239){_0x59ee6f=_0x59ee6f-0x0;var _0x4c0979=_0x885a[_0x59ee6f];return _0x4c0979;};'use strict';var EventEmitter=require('events');var SmsInteraction=require(_0xa885('0x0'))['db'][_0xa885('0x1')];var SmsMessage=require(_0xa885('0x0'))['db'][_0xa885('0x2')];var SmsInteractionEvents=new EventEmitter();SmsInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xa885('0x3'),'afterUpdate':_0xa885('0x4'),'afterDestroy':_0xa885('0x5')};function emitEvent(_0x106e16){return function(_0x108285,_0x33f18b,_0x5dfd7e){_0x108285[_0xa885('0x6')]({'attributes':['id'],'raw':!![]})[_0xa885('0x7')](function(_0x31fd77){_0x108285['setDataValue'](_0xa885('0x8'),_0x31fd77[_0xa885('0x9')](function(_0x38df93){return{'id':_0x38df93['id']};}));return SmsMessage['findAll']({'where':{'SmsInteractionId':_0x108285['id'],'direction':'in','read':![]},'raw':!![]});})[_0xa885('0x7')](function(_0x299f57){_0x108285[_0xa885('0xa')](_0xa885('0xb'),_0x299f57[_0xa885('0xc')]);SmsInteractionEvents[_0xa885('0xd')](_0x106e16+':'+_0x108285['id'],_0x108285);SmsInteractionEvents[_0xa885('0xd')](_0x106e16,_0x108285);_0x5dfd7e(null);})['catch'](_0x5dfd7e(null));};}for(var e in events){if(events[_0xa885('0xe')](e)){var event=events[e];SmsInteraction[_0xa885('0xf')](e,emitEvent(event));}}module[_0xa885('0x10')]=SmsInteractionEvents; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.model.js b/server/api/smsInteraction/smsInteraction.model.js index f2b9323..7ec4a39 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 _0xa91b=['../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./smsInteraction.attributes','exports','define','SmsInteraction','sms_interactions','closed','format','YYYY-MM-DD\x20HH:mm:ss','lodash','util'];(function(_0x486ace,_0x2acf99){var _0x236c9b=function(_0x344ea8){while(--_0x344ea8){_0x486ace['push'](_0x486ace['shift']());}};_0x236c9b(++_0x2acf99);}(_0xa91b,0x185));var _0xba91=function(_0x6da540,_0xe10677){_0x6da540=_0x6da540-0x0;var _0x5b3d09=_0xa91b[_0x6da540];return _0x5b3d09;};'use strict';var _=require(_0xba91('0x0'));var util=require(_0xba91('0x1'));var logger=require(_0xba91('0x2'))('api');var moment=require(_0xba91('0x3'));var BPromise=require(_0xba91('0x4'));var rp=require(_0xba91('0x5'));var fs=require('fs');var path=require(_0xba91('0x6'));var rimraf=require(_0xba91('0x7'));var config=require(_0xba91('0x8'));var attributes=require(_0xba91('0x9'));module[_0xba91('0xa')]=function(_0x54b370,_0xe7fe31){return _0x54b370[_0xba91('0xb')](_0xba91('0xc'),attributes,{'tableName':_0xba91('0xd'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x3d1dbe,_0x35eb0b,_0x2b14d9){if(_0x3d1dbe['changed'](_0xba91('0xe'))){_0x3d1dbe['closedAt']=moment()[_0xba91('0xf')](_0xba91('0x10'));}_0x2b14d9(null,_0x3d1dbe);}}});}; \ No newline at end of file +var _0xe4c7=['define','SmsInteraction','sms_interactions','changed','closed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','lodash','../../config/logger','api','moment','rimraf','../../config/environment','./smsInteraction.attributes'];(function(_0x3fa04e,_0x20fe59){var _0x72dedf=function(_0x4212a0){while(--_0x4212a0){_0x3fa04e['push'](_0x3fa04e['shift']());}};_0x72dedf(++_0x20fe59);}(_0xe4c7,0xe9));var _0x7e4c=function(_0x673ea4,_0x449076){_0x673ea4=_0x673ea4-0x0;var _0x3e5938=_0xe4c7[_0x673ea4];return _0x3e5938;};'use strict';var _=require(_0x7e4c('0x0'));var util=require('util');var logger=require(_0x7e4c('0x1'))(_0x7e4c('0x2'));var moment=require(_0x7e4c('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x7e4c('0x4'));var config=require(_0x7e4c('0x5'));var attributes=require(_0x7e4c('0x6'));module['exports']=function(_0x977016,_0x2c6c5b){return _0x977016[_0x7e4c('0x7')](_0x7e4c('0x8'),attributes,{'tableName':_0x7e4c('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x350c41,_0x3104cb,_0x4a171c){if(_0x350c41[_0x7e4c('0xa')](_0x7e4c('0xb'))){_0x350c41[_0x7e4c('0xc')]=moment()[_0x7e4c('0xd')](_0x7e4c('0xe'));}_0x4a171c(null,_0x350c41);}}});}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.rpc.js b/server/api/smsInteraction/smsInteraction.rpc.js index d9ed328..42d02da 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 _0xdd7b=['result','catch','UpdateSmsInteraction','SmsInteraction','update','options','raw','where','limit','info','AddTagsToSmsInteraction','find','addTags','body','omit','AddTags','util','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','http','redis','defaults','localhost','socket.io-emitter','./smsInteraction.socket','request','then','SmsInteraction,\x20%s,\x20%s','debug','SmsInteraction,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message'];(function(_0x3531d0,_0x2d7fa6){var _0x5edec8=function(_0xb8f213){while(--_0xb8f213){_0x3531d0['push'](_0x3531d0['shift']());}};_0x5edec8(++_0x2d7fa6);}(_0xdd7b,0x178));var _0xbdd7=function(_0x45a20d,_0xf544f4){_0x45a20d=_0x45a20d-0x0;var _0x48688c=_0xdd7b[_0x45a20d];return _0x48688c;};'use strict';var _=require('lodash');var util=require(_0xbdd7('0x0'));var moment=require(_0xbdd7('0x1'));var BPromise=require('bluebird');var rs=require(_0xbdd7('0x2'));var fs=require('fs');var Redis=require(_0xbdd7('0x3'));var db=require(_0xbdd7('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xbdd7('0x5'))(_0xbdd7('0x6'));var config=require(_0xbdd7('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0xbdd7('0x8')]({'port':0x232a});config[_0xbdd7('0x9')]=_[_0xbdd7('0xa')](config[_0xbdd7('0x9')],{'host':_0xbdd7('0xb'),'port':0x18eb});var socket=require(_0xbdd7('0xc'))(new Redis(config[_0xbdd7('0x9')]));require(_0xbdd7('0xd'))['register'](socket);function respondWithRpcPromise(_0x2bc4b1,_0x55dd1f,_0x4d56ce){return new BPromise(function(_0x4d1adf,_0x4c1d82){return client[_0xbdd7('0xe')](_0x2bc4b1,_0x4d56ce)[_0xbdd7('0xf')](function(_0x278f65){logger['info'](_0xbdd7('0x10'),_0x55dd1f,'request\x20sent');logger[_0xbdd7('0x11')](_0xbdd7('0x12'),_0x55dd1f,_0xbdd7('0x13'),JSON[_0xbdd7('0x14')](_0x278f65));if(_0x278f65['error']){if(_0x278f65[_0xbdd7('0x15')][_0xbdd7('0x16')]===0x1f4){logger[_0xbdd7('0x15')](_0xbdd7('0x10'),_0x55dd1f,_0x278f65['error']['message']);return _0x4c1d82(_0x278f65['error']['message']);}logger[_0xbdd7('0x15')](_0xbdd7('0x10'),_0x55dd1f,_0x278f65['error'][_0xbdd7('0x17')]);return _0x4d1adf(_0x278f65[_0xbdd7('0x15')]['message']);}else{logger['info'](_0xbdd7('0x10'),_0x55dd1f,_0xbdd7('0x13'));_0x4d1adf(_0x278f65[_0xbdd7('0x18')][_0xbdd7('0x17')]);}})[_0xbdd7('0x19')](function(_0x529fbb){logger['error']('SmsInteraction,\x20%s,\x20%s',_0x55dd1f,_0x529fbb);_0x4c1d82(_0x529fbb);});});}exports[_0xbdd7('0x1a')]=function(_0x25930a){var _0x40b685=this;return new Promise(function(_0x3d081d,_0x5c084c){return db[_0xbdd7('0x1b')][_0xbdd7('0x1c')](_0x25930a['body'],{'raw':_0x25930a[_0xbdd7('0x1d')]?_0x25930a[_0xbdd7('0x1d')][_0xbdd7('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x25930a['options']?_0x25930a[_0xbdd7('0x1d')][_0xbdd7('0x1f')]||null:null,'attributes':_0x25930a[_0xbdd7('0x1d')]?_0x25930a['options']['attributes']||null:null,'limit':_0x25930a[_0xbdd7('0x1d')]?_0x25930a[_0xbdd7('0x1d')][_0xbdd7('0x20')]||null:null})['then'](function(_0x29d2b0){logger[_0xbdd7('0x21')](_0xbdd7('0x1a'),_0x25930a);logger['debug']('UpdateSmsInteraction',_0x25930a,JSON[_0xbdd7('0x14')](_0x29d2b0));_0x3d081d(_0x29d2b0);})[_0xbdd7('0x19')](function(_0x59bfd8){logger['error']('UpdateSmsInteraction',_0x59bfd8[_0xbdd7('0x17')],_0x25930a);_0x5c084c(_0x40b685['error'](0x1f4,_0x59bfd8[_0xbdd7('0x17')]));});});};exports[_0xbdd7('0x22')]=function(_0x465734){return new Promise(function(_0x38ed8a,_0x3b164d){return db[_0xbdd7('0x1b')][_0xbdd7('0x23')]({'where':_0x465734[_0xbdd7('0x1d')]?_0x465734[_0xbdd7('0x1d')][_0xbdd7('0x1f')]||null:null})[_0xbdd7('0xf')](function(_0xc48023){if(_0xc48023){return _0xc48023[_0xbdd7('0x24')](_0x465734[_0xbdd7('0x25')]['ids'],_[_0xbdd7('0x26')](_0x465734[_0xbdd7('0x25')],['ids','id'])||{});}})['spread'](function(_0x37b234){logger['info']('AddTags',_0x465734);logger[_0xbdd7('0x11')](_0xbdd7('0x27'),_0x465734,JSON[_0xbdd7('0x14')](_0x37b234));_0x38ed8a(_0x37b234);})[_0xbdd7('0x19')](function(_0x187357){logger[_0xbdd7('0x15')](_0xbdd7('0x27'),_0x187357[_0xbdd7('0x17')],_0x465734);_0x3b164d(_this[_0xbdd7('0x15')](0x1f4,_0x187357[_0xbdd7('0x17')]));});});}; \ No newline at end of file +var _0xe0cc=['body','options','raw','where','attributes','limit','debug','AddTagsToSmsInteraction','find','addTags','ids','omit','spread','AddTags','lodash','util','../../mysqldb','rpc','../../config/environment','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','./smsInteraction.socket','then','info','SmsInteraction,\x20%s,\x20%s','request\x20sent','SmsInteraction,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','UpdateSmsInteraction','SmsInteraction','update'];(function(_0x361bd6,_0x3c03ee){var _0x56956f=function(_0xe37e03){while(--_0xe37e03){_0x361bd6['push'](_0x361bd6['shift']());}};_0x56956f(++_0x3c03ee);}(_0xe0cc,0x164));var _0xce0c=function(_0x2ea404,_0x2dc68f){_0x2ea404=_0x2ea404-0x0;var _0x4fe5ab=_0xe0cc[_0x2ea404];return _0x4fe5ab;};'use strict';var _=require(_0xce0c('0x0'));var util=require(_0xce0c('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xce0c('0x2'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xce0c('0x3'));var config=require(_0xce0c('0x4'));var jayson=require(_0xce0c('0x5'));var client=jayson['client'][_0xce0c('0x6')]({'port':0x232a});config[_0xce0c('0x7')]=_[_0xce0c('0x8')](config['redis'],{'host':_0xce0c('0x9'),'port':0x18eb});var socket=require(_0xce0c('0xa'))(new Redis(config['redis']));require(_0xce0c('0xb'))['register'](socket);function respondWithRpcPromise(_0x3702c4,_0x58c45c,_0x233389){return new BPromise(function(_0x2b0f54,_0x3c236f){return client['request'](_0x3702c4,_0x233389)[_0xce0c('0xc')](function(_0x5895e6){logger[_0xce0c('0xd')](_0xce0c('0xe'),_0x58c45c,_0xce0c('0xf'));logger['debug'](_0xce0c('0x10'),_0x58c45c,_0xce0c('0xf'),JSON[_0xce0c('0x11')](_0x5895e6));if(_0x5895e6[_0xce0c('0x12')]){if(_0x5895e6[_0xce0c('0x12')]['code']===0x1f4){logger['error']('SmsInteraction,\x20%s,\x20%s',_0x58c45c,_0x5895e6[_0xce0c('0x12')][_0xce0c('0x13')]);return _0x3c236f(_0x5895e6['error'][_0xce0c('0x13')]);}logger[_0xce0c('0x12')]('SmsInteraction,\x20%s,\x20%s',_0x58c45c,_0x5895e6[_0xce0c('0x12')][_0xce0c('0x13')]);return _0x2b0f54(_0x5895e6[_0xce0c('0x12')][_0xce0c('0x13')]);}else{logger[_0xce0c('0xd')](_0xce0c('0xe'),_0x58c45c,_0xce0c('0xf'));_0x2b0f54(_0x5895e6['result'][_0xce0c('0x13')]);}})[_0xce0c('0x14')](function(_0x41caae){logger[_0xce0c('0x12')](_0xce0c('0xe'),_0x58c45c,_0x41caae);_0x3c236f(_0x41caae);});});}exports[_0xce0c('0x15')]=function(_0x325eaf){var _0x20bc90=this;return new Promise(function(_0x542ba1,_0xfcae73){return db[_0xce0c('0x16')][_0xce0c('0x17')](_0x325eaf[_0xce0c('0x18')],{'raw':_0x325eaf[_0xce0c('0x19')]?_0x325eaf[_0xce0c('0x19')][_0xce0c('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x325eaf[_0xce0c('0x19')]?_0x325eaf[_0xce0c('0x19')][_0xce0c('0x1b')]||null:null,'attributes':_0x325eaf['options']?_0x325eaf[_0xce0c('0x19')][_0xce0c('0x1c')]||null:null,'limit':_0x325eaf['options']?_0x325eaf[_0xce0c('0x19')][_0xce0c('0x1d')]||null:null})[_0xce0c('0xc')](function(_0x3c56c2){logger[_0xce0c('0xd')]('UpdateSmsInteraction',_0x325eaf);logger[_0xce0c('0x1e')](_0xce0c('0x15'),_0x325eaf,JSON[_0xce0c('0x11')](_0x3c56c2));_0x542ba1(_0x3c56c2);})[_0xce0c('0x14')](function(_0x4f5492){logger[_0xce0c('0x12')](_0xce0c('0x15'),_0x4f5492['message'],_0x325eaf);_0xfcae73(_0x20bc90[_0xce0c('0x12')](0x1f4,_0x4f5492[_0xce0c('0x13')]));});});};exports[_0xce0c('0x1f')]=function(_0xabe983){return new Promise(function(_0x128a07,_0xb62185){return db[_0xce0c('0x16')][_0xce0c('0x20')]({'where':_0xabe983[_0xce0c('0x19')]?_0xabe983['options']['where']||null:null})[_0xce0c('0xc')](function(_0x37004e){if(_0x37004e){return _0x37004e[_0xce0c('0x21')](_0xabe983[_0xce0c('0x18')][_0xce0c('0x22')],_[_0xce0c('0x23')](_0xabe983[_0xce0c('0x18')],[_0xce0c('0x22'),'id'])||{});}})[_0xce0c('0x24')](function(_0x4c2d2b){logger['info'](_0xce0c('0x25'),_0xabe983);logger[_0xce0c('0x1e')](_0xce0c('0x25'),_0xabe983,JSON[_0xce0c('0x11')](_0x4c2d2b));_0x128a07(_0x4c2d2b);})['catch'](function(_0x16fcbb){logger[_0xce0c('0x12')](_0xce0c('0x25'),_0x16fcbb[_0xce0c('0x13')],_0xabe983);_0xb62185(_this[_0xce0c('0x12')](0x1f4,_0x16fcbb['message']));});});}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.socket.js b/server/api/smsInteraction/smsInteraction.socket.js index 0c9c5c5..b01f0c9 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 _0x0b0e=['smsInteraction:','./smsInteraction.events','remove','emit','removeListener','register'];(function(_0x420a0f,_0x43f997){var _0x9cab42=function(_0x3c839b){while(--_0x3c839b){_0x420a0f['push'](_0x420a0f['shift']());}};_0x9cab42(++_0x43f997);}(_0x0b0e,0x187));var _0xe0b0=function(_0x29632e,_0x5ecba4){_0x29632e=_0x29632e-0x0;var _0x426e04=_0x0b0e[_0x29632e];return _0x426e04;};'use strict';var SmsInteractionEvents=require(_0xe0b0('0x0'));var events=['save',_0xe0b0('0x1'),'update'];function createListener(_0x7e5a8a,_0xdf715e){return function(_0x3b5e2b){_0xdf715e[_0xe0b0('0x2')](_0x7e5a8a,_0x3b5e2b);};}function removeListener(_0x28040c,_0x38a058){return function(){SmsInteractionEvents[_0xe0b0('0x3')](_0x28040c,_0x38a058);};}exports[_0xe0b0('0x4')]=function(_0x30e20d){for(var _0x28e40f=0x0,_0x219b1c=events['length'];_0x28e40f<_0x219b1c;_0x28e40f++){var _0x50be7f=events[_0x28e40f];var _0x11effc=createListener(_0xe0b0('0x5')+_0x50be7f,_0x30e20d);SmsInteractionEvents['on'](_0x50be7f,_0x11effc);}}; \ No newline at end of file +var _0xb7e7=['remove','removeListener','length','smsInteraction:','./smsInteraction.events'];(function(_0x241f6b,_0x2af41b){var _0xfa096f=function(_0x424537){while(--_0x424537){_0x241f6b['push'](_0x241f6b['shift']());}};_0xfa096f(++_0x2af41b);}(_0xb7e7,0x121));var _0x7b7e=function(_0x243b2f,_0x30aa15){_0x243b2f=_0x243b2f-0x0;var _0xcb3c2d=_0xb7e7[_0x243b2f];return _0xcb3c2d;};'use strict';var SmsInteractionEvents=require(_0x7b7e('0x0'));var events=['save',_0x7b7e('0x1'),'update'];function createListener(_0x1b7cc7,_0x54a37f){return function(_0x3f5804){_0x54a37f['emit'](_0x1b7cc7,_0x3f5804);};}function removeListener(_0x31d0ed,_0x118577){return function(){SmsInteractionEvents[_0x7b7e('0x2')](_0x31d0ed,_0x118577);};}exports['register']=function(_0x53ed64){for(var _0x333fa4=0x0,_0x372bde=events[_0x7b7e('0x3')];_0x333fa4<_0x372bde;_0x333fa4++){var _0x55ce81=events[_0x333fa4];var _0x42b871=createListener(_0x7b7e('0x4')+_0x55ce81,_0x53ed64);SmsInteractionEvents['on'](_0x55ce81,_0x42b871);}}; \ No newline at end of file diff --git a/server/api/smsMessage/index.js b/server/api/smsMessage/index.js index cfe1e24..db8ca43 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 _0x6ae4=['util','path','Router','../../components/interaction/service','../../config/environment','get','isAuthenticated','/describe','/:id','show','tracked','sms','smsmessage:create','create','post','/:id/status','status','put','/:id/accept','accept','/:id/reject','delete','destroy','multer'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x6ae4,0x17f));var _0x46ae=function(_0x520480,_0x516d6a){_0x520480=_0x520480-0x0;var _0x32083e=_0x6ae4[_0x520480];return _0x32083e;};'use strict';var multer=require(_0x46ae('0x0'));var util=require(_0x46ae('0x1'));var path=require(_0x46ae('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x46ae('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0x46ae('0x4'));var config=require(_0x46ae('0x5'));var controller=require('./smsMessage.controller');router[_0x46ae('0x6')]('/',auth[_0x46ae('0x7')](),controller['index']);router['get'](_0x46ae('0x8'),auth['isAuthenticated'](),controller['describe']);router[_0x46ae('0x6')](_0x46ae('0x9'),auth[_0x46ae('0x7')](),controller[_0x46ae('0xa')]);router['post']('/',auth[_0x46ae('0x7')](),interaction[_0x46ae('0xb')](_0x46ae('0xc'),_0x46ae('0xd')),controller[_0x46ae('0xe')]);router[_0x46ae('0xf')](_0x46ae('0x10'),controller[_0x46ae('0x11')]);router[_0x46ae('0x12')]('/:id',auth[_0x46ae('0x7')](),controller['update']);router[_0x46ae('0x12')](_0x46ae('0x13'),auth['isAuthenticated'](),controller[_0x46ae('0x14')]);router['put'](_0x46ae('0x15'),auth[_0x46ae('0x7')](),controller['reject']);router[_0x46ae('0x16')](_0x46ae('0x9'),auth[_0x46ae('0x7')](),controller[_0x46ae('0x17')]);module['exports']=router; \ No newline at end of file +var _0x8a06=['isAuthenticated','/describe','describe','/:id','show','post','tracked','sms','smsmessage:create','create','/:id/status','status','put','update','/:id/accept','accept','reject','delete','exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./smsMessage.controller','get'];(function(_0x1899ae,_0x5b5ad6){var _0x243c83=function(_0x3688e5){while(--_0x3688e5){_0x1899ae['push'](_0x1899ae['shift']());}};_0x243c83(++_0x5b5ad6);}(_0x8a06,0xbb));var _0x68a0=function(_0x8c6164,_0x1dc7db){_0x8c6164=_0x8c6164-0x0;var _0x1ca172=_0x8a06[_0x8c6164];return _0x1ca172;};'use strict';var multer=require('multer');var util=require(_0x68a0('0x0'));var path=require(_0x68a0('0x1'));var timeout=require(_0x68a0('0x2'));var express=require(_0x68a0('0x3'));var router=express[_0x68a0('0x4')]();var auth=require(_0x68a0('0x5'));var interaction=require(_0x68a0('0x6'));var config=require('../../config/environment');var controller=require(_0x68a0('0x7'));router[_0x68a0('0x8')]('/',auth[_0x68a0('0x9')](),controller['index']);router[_0x68a0('0x8')](_0x68a0('0xa'),auth[_0x68a0('0x9')](),controller[_0x68a0('0xb')]);router['get'](_0x68a0('0xc'),auth['isAuthenticated'](),controller[_0x68a0('0xd')]);router[_0x68a0('0xe')]('/',auth[_0x68a0('0x9')](),interaction[_0x68a0('0xf')](_0x68a0('0x10'),_0x68a0('0x11')),controller[_0x68a0('0x12')]);router[_0x68a0('0xe')](_0x68a0('0x13'),controller[_0x68a0('0x14')]);router[_0x68a0('0x15')](_0x68a0('0xc'),auth['isAuthenticated'](),controller[_0x68a0('0x16')]);router[_0x68a0('0x15')](_0x68a0('0x17'),auth['isAuthenticated'](),controller[_0x68a0('0x18')]);router[_0x68a0('0x15')]('/:id/reject',auth[_0x68a0('0x9')](),controller[_0x68a0('0x19')]);router[_0x68a0('0x1a')](_0x68a0('0xc'),auth[_0x68a0('0x9')](),controller['destroy']);module[_0x68a0('0x1b')]=router; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.attributes.js b/server/api/smsMessage/smsMessage.attributes.js index 6dac36d..1796e53 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 _0x0628=['out','STRING','DATE','sequelize','exports','TEXT','BOOLEAN','ENUM'];(function(_0x42310a,_0x51c9c2){var _0x47d074=function(_0x49d387){while(--_0x49d387){_0x42310a['push'](_0x42310a['shift']());}};_0x47d074(++_0x51c9c2);}(_0x0628,0x173));var _0x8062=function(_0x27fce9,_0x55a249){_0x27fce9=_0x27fce9-0x0;var _0x28ce11=_0x0628[_0x27fce9];return _0x28ce11;};'use strict';var Sequelize=require(_0x8062('0x0'));module[_0x8062('0x1')]={'body':{'type':Sequelize[_0x8062('0x2')]('medium'),'allowNull':![]},'read':{'type':Sequelize[_0x8062('0x3')],'defaultValue':![]},'direction':{'type':Sequelize[_0x8062('0x4')]('in',_0x8062('0x5')),'defaultValue':_0x8062('0x5'),'allowNull':![]},'messageId':{'type':Sequelize[_0x8062('0x6')](0xbe)},'phone':{'type':Sequelize[_0x8062('0x6')]},'readAt':{'type':Sequelize[_0x8062('0x7')]},'secret':{'type':Sequelize[_0x8062('0x3')],'defaultValue':![]}}; \ No newline at end of file +var _0xa239=['exports','out','STRING','DATE','BOOLEAN','sequelize'];(function(_0x5a95fa,_0x4a2fc9){var _0x1a61b8=function(_0x59f119){while(--_0x59f119){_0x5a95fa['push'](_0x5a95fa['shift']());}};_0x1a61b8(++_0x4a2fc9);}(_0xa239,0x7d));var _0x9a23=function(_0x46e392,_0x4032e0){_0x46e392=_0x46e392-0x0;var _0x5cfe9c=_0xa239[_0x46e392];return _0x5cfe9c;};'use strict';var Sequelize=require(_0x9a23('0x0'));module[_0x9a23('0x1')]={'body':{'type':Sequelize['TEXT']('medium'),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in',_0x9a23('0x2')),'defaultValue':_0x9a23('0x2'),'allowNull':![]},'messageId':{'type':Sequelize[_0x9a23('0x3')](0xbe)},'phone':{'type':Sequelize[_0x9a23('0x3')]},'readAt':{'type':Sequelize[_0x9a23('0x4')]},'secret':{'type':Sequelize[_0x9a23('0x5')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.controller.js b/server/api/smsMessage/smsMessage.controller.js index fa1732d..7980473 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 _0x8ce8=['keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','include','findAll','params','find','create','body','update','describe','sms-interactions','sms','read','format','YYYY-MM-DD\x20HH:mm:ss','user','SmsInteractionId','UserId','isNil','read1stAt','get','[SMSMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','interaction','null','AcceptMessage','acceptMessage','manual','SIP/%s','channel','event','SmsInteraction','[SMSMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','interface','EventManager','rejectmessage','SmsAccount','received\x20delivery\x20report\x20from','type','MessageSid','twilio','plivo','MessageUUID','messageId','sent','delivered','Status','SmsAccount,\x20%s,\x20%s,\x20%s','plivio','inspect','infobip','results','groupName','DELIVERED','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','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','defaults','redis','./smsMessage.socket','register','jayson/promise','client','http','test','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','info','SmsMessage,\x20%s,\x20%s','request\x20sent','debug','SmsMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','destroy','name','send','SmsMessage','rawAttributes','fieldName','key','model','map'];(function(_0x616290,_0x280b7f){var _0x453879=function(_0x27bda7){while(--_0x27bda7){_0x616290['push'](_0x616290['shift']());}};_0x453879(++_0x280b7f);}(_0x8ce8,0xd3));var _0x88ce=function(_0x3592f0,_0x56b8b9){_0x3592f0=_0x3592f0-0x0;var _0x4c13ac=_0x8ce8[_0x3592f0];return _0x4c13ac;};'use strict';var pdf=require(_0x88ce('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x88ce('0x1'));var zipdir=require(_0x88ce('0x2'));var jsonpatch=require(_0x88ce('0x3'));var rp=require(_0x88ce('0x4'));var moment=require(_0x88ce('0x5'));var BPromise=require(_0x88ce('0x6'));var Mustache=require(_0x88ce('0x7'));var util=require(_0x88ce('0x8'));var path=require(_0x88ce('0x9'));var sox=require(_0x88ce('0xa'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0x88ce('0xb'));var squel=require(_0x88ce('0xc'));var crypto=require(_0x88ce('0xd'));var jsforce=require(_0x88ce('0xe'));var deskjs=require(_0x88ce('0xf'));var toCsv=require('to-csv');var querystring=require(_0x88ce('0x10'));var Papa=require('papaparse');var Redis=require(_0x88ce('0x11'));var authService=require(_0x88ce('0x12'));var qs=require(_0x88ce('0x13'));var as=require(_0x88ce('0x14'));var hardwareService=require(_0x88ce('0x15'));var logger=require(_0x88ce('0x16'))(_0x88ce('0x17'));var utils=require(_0x88ce('0x18'));var config=require('../../config/environment');var db=require(_0x88ce('0x19'))['db'];config['redis']=_[_0x88ce('0x1a')](config[_0x88ce('0x1b')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x88ce('0x1b')]));require(_0x88ce('0x1c'))[_0x88ce('0x1d')](socket);var jayson=require(_0x88ce('0x1e'));var client=jayson[_0x88ce('0x1f')][_0x88ce('0x20')]({'port':0x232c});var client9002=jayson[_0x88ce('0x1f')]['http']({'port':0x232a});function checkPasswordPattern(_0x3460e5,_0x5bcd5a,_0x3da93e){if(_0x3da93e){var _0x58d3da=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x58d3da[_0x88ce('0x21')](_0x5bcd5a)){return _0x3460e5;}else{throw new db[(_0x88ce('0x22'))][(_0x88ce('0x23'))](_0x88ce('0x24'));}}else{return _0x3460e5;}}function respondWithRpcPromise(_0x509a84,_0x50c9df,_0xdb0d1f,_0x65fa81){return new BPromise(function(_0x404df9,_0x338eff){var _0xa60138=_0x65fa81||client;return _0xa60138[_0x88ce('0x25')](_0x509a84,_0xdb0d1f)[_0x88ce('0x26')](function(_0x2fa7ac){logger[_0x88ce('0x27')](_0x88ce('0x28'),_0x50c9df,_0x88ce('0x29'));logger[_0x88ce('0x2a')](_0x88ce('0x2b'),_0x50c9df,_0x88ce('0x29'),JSON[_0x88ce('0x2c')](_0x2fa7ac));if(_0x2fa7ac[_0x88ce('0x2d')]){if(_0x2fa7ac['error'][_0x88ce('0x2e')]===0x1f4){logger[_0x88ce('0x2d')](_0x88ce('0x28'),_0x50c9df,_0x2fa7ac[_0x88ce('0x2d')][_0x88ce('0x2f')]);return _0x338eff(_0x2fa7ac['error']['message']);}logger['error'](_0x88ce('0x28'),_0x50c9df,_0x2fa7ac[_0x88ce('0x2d')][_0x88ce('0x2f')]);return _0x404df9(_0x2fa7ac['error']['message']);}else{logger[_0x88ce('0x27')](_0x88ce('0x28'),_0x50c9df,_0x88ce('0x29'));_0x404df9(_0x2fa7ac[_0x88ce('0x30')][_0x88ce('0x2f')]);}})[_0x88ce('0x31')](function(_0x19f00f){logger[_0x88ce('0x2d')](_0x88ce('0x28'),_0x50c9df,_0x19f00f);_0x338eff(_0x19f00f);});});}function respondWithStatusCode(_0x40aa83,_0x4209bc){_0x4209bc=_0x4209bc||0xcc;return function(_0x11ef49){if(_0x11ef49){return _0x40aa83[_0x88ce('0x32')](_0x4209bc);}return _0x40aa83[_0x88ce('0x33')](_0x4209bc)[_0x88ce('0x34')]();};}function respondWithResult(_0x1814d1,_0x47bbff){_0x47bbff=_0x47bbff||0xc8;return function(_0x4f4205){if(_0x4f4205){return _0x1814d1['status'](_0x47bbff)[_0x88ce('0x35')](_0x4f4205);}};}function respondWithFilteredResult(_0x4221c1,_0x6ea7e0){return function(_0x2fe609){if(_0x2fe609){var _0x544be7=_0x2fe609[_0x88ce('0x36')],_0x28e7a4=_0x6ea7e0[_0x88ce('0x37')],_0x2c9027=_0x6ea7e0[_0x88ce('0x37')]+_0x6ea7e0[_0x88ce('0x38')],_0x326ebe;if(_0x2c9027>=_0x544be7){_0x2c9027=_0x544be7;_0x326ebe=0xc8;}else{_0x326ebe=0xce;}_0x4221c1['status'](_0x326ebe);return _0x4221c1[_0x88ce('0x39')](_0x88ce('0x3a'),_0x28e7a4+'-'+_0x2c9027+'/'+_0x544be7)['json'](_0x2fe609);}return null;};}function patchUpdates(_0x404e3e){return function(_0x19775d){try{jsonpatch[_0x88ce('0x3b')](_0x19775d,_0x404e3e,!![]);}catch(_0x24fbbe){return BPromise[_0x88ce('0x3c')](_0x24fbbe);}return _0x19775d[_0x88ce('0x3d')]();};}function saveUpdates(_0x21e585,_0x12bcfa){return function(_0x410b52){if(_0x410b52){return _0x410b52['update'](_0x21e585)[_0x88ce('0x26')](function(_0x1da20a){return _0x1da20a;});}return null;};}function removeEntity(_0x1b1275,_0x4e6d98){return function(_0x3a51da){if(_0x3a51da){return _0x3a51da[_0x88ce('0x3e')]()['then'](function(){_0x1b1275['status'](0xcc)[_0x88ce('0x34')]();});}};}function handleEntityNotFound(_0x274e20,_0x19d91c){return function(_0x1e25ca){if(!_0x1e25ca){_0x274e20[_0x88ce('0x32')](0x194);}return _0x1e25ca;};}function handleError(_0x3639b8,_0x5140bd){_0x5140bd=_0x5140bd||0x1f4;return function(_0x79e5fb){logger[_0x88ce('0x2d')](_0x79e5fb['stack']);if(_0x79e5fb[_0x88ce('0x3f')]){delete _0x79e5fb[_0x88ce('0x3f')];}_0x3639b8['status'](_0x5140bd)[_0x88ce('0x40')](_0x79e5fb);};}exports['index']=function(_0x4149ff,_0x2268a6){var _0x3fa24f={},_0x2c2ec1={},_0x378436={'count':0x0,'rows':[]};var _0x96f54c=_['map'](db[_0x88ce('0x41')][_0x88ce('0x42')],function(_0x24172a){return{'name':_0x24172a[_0x88ce('0x43')],'type':_0x24172a['type'][_0x88ce('0x44')]};});_0x2c2ec1[_0x88ce('0x45')]=_[_0x88ce('0x46')](_0x96f54c,'name');_0x2c2ec1['query']=_[_0x88ce('0x47')](_0x4149ff[_0x88ce('0x48')]);_0x2c2ec1[_0x88ce('0x49')]=_['intersection'](_0x2c2ec1[_0x88ce('0x45')],_0x2c2ec1[_0x88ce('0x48')]);_0x3fa24f['attributes']=_[_0x88ce('0x4a')](_0x2c2ec1[_0x88ce('0x45')],qs[_0x88ce('0x4b')](_0x4149ff[_0x88ce('0x48')][_0x88ce('0x4b')]));_0x3fa24f['attributes']=_0x3fa24f[_0x88ce('0x4c')][_0x88ce('0x4d')]?_0x3fa24f[_0x88ce('0x4c')]:_0x2c2ec1[_0x88ce('0x45')];if(!_0x4149ff[_0x88ce('0x48')][_0x88ce('0x4e')](_0x88ce('0x4f'))){_0x3fa24f['limit']=qs[_0x88ce('0x38')](_0x4149ff[_0x88ce('0x48')]['limit']);_0x3fa24f[_0x88ce('0x37')]=qs[_0x88ce('0x37')](_0x4149ff['query']['offset']);}_0x3fa24f['order']=qs[_0x88ce('0x50')](_0x4149ff[_0x88ce('0x48')][_0x88ce('0x50')]);_0x3fa24f[_0x88ce('0x51')]=qs[_0x88ce('0x49')](_[_0x88ce('0x52')](_0x4149ff[_0x88ce('0x48')],_0x2c2ec1['filters']),_0x96f54c);if(_0x4149ff[_0x88ce('0x48')]['filter']){_0x3fa24f[_0x88ce('0x51')]=_[_0x88ce('0x53')](_0x3fa24f[_0x88ce('0x51')],{'$or':_['map'](_0x96f54c,function(_0x32e0c0){if(_0x32e0c0['type']!==_0x88ce('0x54')){var _0x44b75c={};_0x44b75c[_0x32e0c0[_0x88ce('0x3f')]]={'$like':'%'+_0x4149ff[_0x88ce('0x48')][_0x88ce('0x55')]+'%'};return _0x44b75c;}})});}_0x3fa24f=_[_0x88ce('0x53')]({},_0x3fa24f,_0x4149ff[_0x88ce('0x56')]);var _0x530800={'where':_0x3fa24f[_0x88ce('0x51')]};return db[_0x88ce('0x41')][_0x88ce('0x36')](_0x530800)[_0x88ce('0x26')](function(_0x4a3836){_0x378436['count']=_0x4a3836;if(_0x4149ff[_0x88ce('0x48')][_0x88ce('0x57')]){_0x3fa24f[_0x88ce('0x58')]=[{'all':!![]}];}return db[_0x88ce('0x41')][_0x88ce('0x59')](_0x3fa24f);})[_0x88ce('0x26')](function(_0x4e4933){_0x378436['rows']=_0x4e4933;return _0x378436;})['then'](respondWithFilteredResult(_0x2268a6,_0x3fa24f))[_0x88ce('0x31')](handleError(_0x2268a6,null));};exports['show']=function(_0x5c2231,_0x47d0c7){var _0x13e84f={'raw':!![],'where':{'id':_0x5c2231[_0x88ce('0x5a')]['id']}},_0x53dcf9={};_0x53dcf9[_0x88ce('0x45')]=_[_0x88ce('0x47')](db[_0x88ce('0x41')][_0x88ce('0x42')]);_0x53dcf9[_0x88ce('0x48')]=_['keys'](_0x5c2231['query']);_0x53dcf9[_0x88ce('0x49')]=_[_0x88ce('0x4a')](_0x53dcf9[_0x88ce('0x45')],_0x53dcf9[_0x88ce('0x48')]);_0x13e84f['attributes']=_['intersection'](_0x53dcf9[_0x88ce('0x45')],qs[_0x88ce('0x4b')](_0x5c2231[_0x88ce('0x48')][_0x88ce('0x4b')]));_0x13e84f[_0x88ce('0x4c')]=_0x13e84f[_0x88ce('0x4c')][_0x88ce('0x4d')]?_0x13e84f[_0x88ce('0x4c')]:_0x53dcf9[_0x88ce('0x45')];if(_0x5c2231[_0x88ce('0x48')][_0x88ce('0x57')]){_0x13e84f[_0x88ce('0x58')]=[{'all':!![]}];}_0x13e84f=_[_0x88ce('0x53')]({},_0x13e84f,_0x5c2231['options']);return db[_0x88ce('0x41')][_0x88ce('0x5b')](_0x13e84f)[_0x88ce('0x26')](handleEntityNotFound(_0x47d0c7,null))[_0x88ce('0x26')](respondWithResult(_0x47d0c7,null))[_0x88ce('0x31')](handleError(_0x47d0c7,null));};exports[_0x88ce('0x5c')]=function(_0x59ba17,_0x16bba0){return db['SmsMessage'][_0x88ce('0x5c')](_0x59ba17[_0x88ce('0x5d')],{})[_0x88ce('0x26')](respondWithResult(_0x16bba0,0xc9))[_0x88ce('0x31')](handleError(_0x16bba0,null));};exports[_0x88ce('0x5e')]=function(_0x4ab8da,_0x39432f){if(_0x4ab8da[_0x88ce('0x5d')]['id']){delete _0x4ab8da['body']['id'];}return db[_0x88ce('0x41')]['find']({'where':{'id':_0x4ab8da[_0x88ce('0x5a')]['id']}})[_0x88ce('0x26')](handleEntityNotFound(_0x39432f,null))[_0x88ce('0x26')](saveUpdates(_0x4ab8da['body'],null))[_0x88ce('0x26')](respondWithResult(_0x39432f,null))[_0x88ce('0x31')](handleError(_0x39432f,null));};exports[_0x88ce('0x3e')]=function(_0x1988ab,_0x317321){return db[_0x88ce('0x41')][_0x88ce('0x5b')]({'where':{'id':_0x1988ab[_0x88ce('0x5a')]['id']}})[_0x88ce('0x26')](handleEntityNotFound(_0x317321,null))['then'](removeEntity(_0x317321,null))['catch'](handleError(_0x317321,null));};exports[_0x88ce('0x5f')]=function(_0x1d213d,_0x25f269){return db['SmsMessage'][_0x88ce('0x5f')]()['then'](respondWithResult(_0x25f269,null))['catch'](handleError(_0x25f269,null));};var interaction_log=require('../../config/logger')(_0x88ce('0x60'));exports['accept']=function(_0xaf4625,_0xe02ae1,_0x1fbf55){var _0x4a6af7={'channel':_0x88ce('0x61')};if(_0xaf4625['body']['id']){delete _0xaf4625[_0x88ce('0x5d')]['id'];}_0xaf4625[_0x88ce('0x5d')][_0x88ce('0x62')]=!![];_0xaf4625[_0x88ce('0x5d')]['readAt']=moment()[_0x88ce('0x63')](_0x88ce('0x64'));_0xaf4625[_0x88ce('0x5d')]['UserId']=_0xaf4625['body']['UserId']||_0xaf4625[_0x88ce('0x65')]['id'];return db[_0x88ce('0x41')][_0x88ce('0x5b')]({'where':{'id':_0xaf4625[_0x88ce('0x5a')]['id'],'UserId':null},'include':[{'model':db['CmContact'],'as':'Contact'}]})['then'](handleEntityNotFound(_0xe02ae1,null))[_0x88ce('0x26')](saveUpdates(_0xaf4625[_0x88ce('0x5d')],null))[_0x88ce('0x26')](function(_0x1e7487){if(_0x1e7487){_0x4a6af7[_0x88ce('0x2f')]=_0x1e7487['get']({'plain':!![]});return db['SmsInteraction'][_0x88ce('0x5b')]({'where':{'id':_0x1e7487[_0x88ce('0x66')]}});}return null;})[_0x88ce('0x26')](handleEntityNotFound(_0xe02ae1,null))[_0x88ce('0x26')](function(_0x385288){if(_0x385288){return _0x385288['update']({'UserId':_0xaf4625['body'][_0x88ce('0x67')],'read1stAt':_[_0x88ce('0x68')](_0x385288[_0x88ce('0x69')])?moment()[_0x88ce('0x63')]('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})[_0x88ce('0x26')](function(_0x4e8c71){if(_0x4e8c71){_0x4a6af7['interaction']=_0x4e8c71[_0x88ce('0x6a')]({'plain':!![]});interaction_log[_0x88ce('0x27')](_0x88ce('0x6b'),_0xaf4625[_0x88ce('0x65')]['id'],_0xaf4625[_0x88ce('0x65')][_0x88ce('0x3f')],_0xaf4625[_0x88ce('0x65')][_0x88ce('0x6c')],_0x4a6af7[_0x88ce('0x6d')]['id'],_0xaf4625[_0x88ce('0x5d')]?JSON[_0x88ce('0x2c')](_0xaf4625[_0x88ce('0x5d')]):_0x88ce('0x6e'));return respondWithRpcPromise(_0x88ce('0x6f'),_0x88ce('0x70'),_0x4a6af7);}return null;})[_0x88ce('0x26')](function(_0xde1b4f){if(_0xde1b4f){if(_0xaf4625[_0x88ce('0x5d')][_0x88ce('0x71')]){_0x4a6af7['message']['interface']=util[_0x88ce('0x63')](_0x88ce('0x72'),_0xaf4625[_0x88ce('0x65')]['name']);_0x4a6af7[_0x88ce('0x2f')]['channel']=_0x4a6af7[_0x88ce('0x73')];_0x4a6af7[_0x88ce('0x2f')][_0x88ce('0x74')]='accept';return respondWithRpcPromise('EventManager','EventManager',{'event':'acceptmessage','message':_0x4a6af7['message']},client9002)['then'](function(){return _0x4a6af7;});}return _0x4a6af7;}return null;})[_0x88ce('0x26')](respondWithResult(_0xe02ae1,null))[_0x88ce('0x31')](handleError(_0xe02ae1,null));};var interaction_log=require('../../config/logger')(_0x88ce('0x60'));exports[_0x88ce('0x3c')]=function(_0x46b254,_0x13092e,_0x3878e7){var _0x363992={'agent':{},'channel':_0x88ce('0x61')};if(_0x46b254[_0x88ce('0x5d')]['id']){delete _0x46b254[_0x88ce('0x5d')]['id'];}_0x46b254[_0x88ce('0x5d')][_0x88ce('0x67')]=_0x46b254[_0x88ce('0x5d')][_0x88ce('0x67')]||_0x46b254['user']['id'];_0x363992['agent']['id']=_0x46b254[_0x88ce('0x5d')][_0x88ce('0x67')];return db[_0x88ce('0x41')][_0x88ce('0x5b')]({'where':{'id':_0x46b254['params']['id'],'UserId':null}})[_0x88ce('0x26')](handleEntityNotFound(_0x13092e,null))[_0x88ce('0x26')](function(_0x8bec41){if(_0x8bec41){_0x363992['message']=_0x8bec41['get']({'plain':!![]});return db[_0x88ce('0x75')][_0x88ce('0x5b')]({'where':{'id':_0x8bec41[_0x88ce('0x66')]}});}return null;})[_0x88ce('0x26')](handleEntityNotFound(_0x13092e,null))['then'](function(_0x44f25a){if(_0x44f25a){_0x363992[_0x88ce('0x6d')]=_0x44f25a[_0x88ce('0x6a')]({'plain':!![]});interaction_log[_0x88ce('0x27')](_0x88ce('0x76'),_0x46b254[_0x88ce('0x65')]['id'],_0x46b254[_0x88ce('0x65')][_0x88ce('0x3f')],_0x46b254[_0x88ce('0x65')][_0x88ce('0x6c')],_0x363992[_0x88ce('0x6d')]['id'],_0x46b254['body']?JSON[_0x88ce('0x2c')](_0x46b254[_0x88ce('0x5d')]):_0x88ce('0x6e'));return respondWithRpcPromise(_0x88ce('0x77'),'rejectMessage',_0x363992);}return null;})[_0x88ce('0x26')](function(_0x19ba1b){if(_0x19ba1b){_0x19ba1b['message'][_0x88ce('0x78')]=util[_0x88ce('0x63')](_0x88ce('0x72'),_0x46b254[_0x88ce('0x65')][_0x88ce('0x3f')]);_0x19ba1b[_0x88ce('0x2f')]['channel']=_0x363992['channel'];_0x19ba1b[_0x88ce('0x2f')][_0x88ce('0x74')]='reject';respondWithRpcPromise('EventManager',_0x88ce('0x79'),{'event':_0x88ce('0x7a'),'message':_0x19ba1b[_0x88ce('0x2f')]},client9002);return _0x363992;}return null;})[_0x88ce('0x26')](respondWithResult(_0x13092e,null))[_0x88ce('0x31')](handleError(_0x13092e,null));};exports[_0x88ce('0x33')]=function(_0x1ea61b,_0x1c613d,_0x5a3566){if(_0x1ea61b[_0x88ce('0x5d')]['id']){delete _0x1ea61b[_0x88ce('0x5d')]['id'];}var _0x2b00ec;return db[_0x88ce('0x41')][_0x88ce('0x5b')]({'where':{'id':_0x1ea61b['params']['id']}})[_0x88ce('0x26')](handleEntityNotFound(_0x1c613d,null))[_0x88ce('0x26')](function(_0x2523d8){if(_0x2523d8){_0x2b00ec=_0x2523d8;return db[_0x88ce('0x7b')]['find']({'where':{'id':_0x2523d8['SmsAccountId']}});}})[_0x88ce('0x26')](handleEntityNotFound(_0x1c613d,null))[_0x88ce('0x26')](function(_0x1c5849){if(_0x1c5849){logger[_0x88ce('0x2a')](_0x88ce('0x2b'),_0x88ce('0x33'),_0x88ce('0x7c'),_0x1c5849[_0x88ce('0x7d')],util['inspect'](_0x1ea61b[_0x88ce('0x5d')],{'showHidden':![],'depth':null}));switch(_0x1c5849[_0x88ce('0x7d')]){case'twilio':if(_0x1ea61b['body'][_0x88ce('0x7e')]&&_0x1ea61b[_0x88ce('0x5d')]['MessageSid']===_0x2b00ec['messageId']){return _0x2b00ec['update']({'read':!![]});}else{logger[_0x88ce('0x2d')]('SmsAccount,\x20%s,\x20%s,\x20%s','status',_0x88ce('0x7f'),util['inspect'](_0x1ea61b[_0x88ce('0x5d')],{'showHidden':![],'depth':null}));}break;case _0x88ce('0x80'):if(_0x1ea61b[_0x88ce('0x5d')][_0x88ce('0x81')]&&_0x1ea61b[_0x88ce('0x5d')][_0x88ce('0x81')]===_0x2b00ec[_0x88ce('0x82')]&&_['indexOf']([_0x88ce('0x83'),_0x88ce('0x84')],_0x1ea61b['body'][_0x88ce('0x85')])>=0x0){return _0x2b00ec[_0x88ce('0x5e')]({'read':!![]});}else{logger[_0x88ce('0x2d')](_0x88ce('0x86'),_0x88ce('0x33'),_0x88ce('0x87'),util[_0x88ce('0x88')](_0x1ea61b['body'],{'showHidden':![],'depth':null}));}break;case _0x88ce('0x89'):var _0x45f901=_0x1ea61b[_0x88ce('0x5d')][_0x88ce('0x8a')][0x0];if(_0x45f901[_0x88ce('0x33')][_0x88ce('0x8b')]===_0x88ce('0x8c')){return _0x2b00ec[_0x88ce('0x5e')]({'read':!![]});}else{logger['error'](_0x88ce('0x86'),_0x88ce('0x33'),_0x88ce('0x89'),util[_0x88ce('0x88')](_0x1ea61b['body'],{'showHidden':![],'depth':null}));}break;}return _0x2b00ec;}})[_0x88ce('0x26')](respondWithResult(_0x1c613d,null))[_0x88ce('0x31')](handleError(_0x1c613d,null));}; \ No newline at end of file +var _0xbfa6=['describe','sms-interactions','sms','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','Contact','get','SmsInteraction','SmsInteractionId','isNil','read1stAt','interaction','[SMSMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','null','AcceptMessage','manual','interface','SIP/%s','channel','event','accept','acceptmessage','agent','[SMSMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','RejectMessage','rejectMessage','SmsAccount','SmsAccountId','received\x20delivery\x20report\x20from','inspect','twilio','MessageSid','SmsAccount,\x20%s,\x20%s,\x20%s','plivo','MessageUUID','messageId','indexOf','delivered','plivio','infobip','groupName','DELIVERED','html-pdf','eml-format','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','lodash','squel','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','./smsMessage.socket','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~!@#$%^&-_=+[{]}.','SmsMessage,\x20%s,\x20%s','request\x20sent','debug','SmsMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','sendStatus','status','end','json','count','offset','set','Content-Range','apply','reject','update','destroy','then','stack','name','send','index','map','SmsMessage','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','fields','attributes','nolimit','limit','order','where','pick','filter','merge','options','includeAll','include','findAll','rows','catch','show','params','find','create','body'];(function(_0x5a4c25,_0x2b4761){var _0x3bdeff=function(_0x54266a){while(--_0x54266a){_0x5a4c25['push'](_0x5a4c25['shift']());}};_0x3bdeff(++_0x2b4761);}(_0xbfa6,0x1d0));var _0x6bfa=function(_0x9e55f6,_0x5df434){_0x9e55f6=_0x9e55f6-0x0;var _0x220e55=_0xbfa6[_0x9e55f6];return _0x220e55;};'use strict';var pdf=require(_0x6bfa('0x0'));var emlformat=require(_0x6bfa('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x6bfa('0x2'));var moment=require(_0x6bfa('0x3'));var BPromise=require(_0x6bfa('0x4'));var Mustache=require('mustache');var util=require(_0x6bfa('0x5'));var path=require(_0x6bfa('0x6'));var sox=require(_0x6bfa('0x7'));var csv=require(_0x6bfa('0x8'));var ejs=require(_0x6bfa('0x9'));var fs=require('fs');var _=require(_0x6bfa('0xa'));var squel=require(_0x6bfa('0xb'));var crypto=require('crypto');var jsforce=require(_0x6bfa('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x6bfa('0x8'));var querystring=require(_0x6bfa('0xd'));var Papa=require(_0x6bfa('0xe'));var Redis=require(_0x6bfa('0xf'));var authService=require(_0x6bfa('0x10'));var qs=require(_0x6bfa('0x11'));var as=require(_0x6bfa('0x12'));var hardwareService=require(_0x6bfa('0x13'));var logger=require(_0x6bfa('0x14'))(_0x6bfa('0x15'));var utils=require('../../config/utils');var config=require(_0x6bfa('0x16'));var db=require(_0x6bfa('0x17'))['db'];config[_0x6bfa('0x18')]=_['defaults'](config[_0x6bfa('0x18')],{'host':_0x6bfa('0x19'),'port':0x18eb});var socket=require(_0x6bfa('0x1a'))(new Redis(config[_0x6bfa('0x18')]));require(_0x6bfa('0x1b'))['register'](socket);var jayson=require(_0x6bfa('0x1c'));var client=jayson['client'][_0x6bfa('0x1d')]({'port':0x232c});var client9002=jayson[_0x6bfa('0x1e')][_0x6bfa('0x1d')]({'port':0x232a});function checkPasswordPattern(_0x305210,_0x2c4944,_0x2a11ac){if(_0x2a11ac){var _0x331351=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x331351[_0x6bfa('0x1f')](_0x2c4944)){return _0x305210;}else{throw new db[(_0x6bfa('0x20'))]['ValidationError'](_0x6bfa('0x21'));}}else{return _0x305210;}}function respondWithRpcPromise(_0x49a835,_0x1b4c11,_0xa99566,_0x23db95){return new BPromise(function(_0x1affa5,_0x5ef6d0){var _0x508196=_0x23db95||client;return _0x508196['request'](_0x49a835,_0xa99566)['then'](function(_0x21760a){logger['info'](_0x6bfa('0x22'),_0x1b4c11,_0x6bfa('0x23'));logger[_0x6bfa('0x24')](_0x6bfa('0x25'),_0x1b4c11,_0x6bfa('0x23'),JSON[_0x6bfa('0x26')](_0x21760a));if(_0x21760a[_0x6bfa('0x27')]){if(_0x21760a[_0x6bfa('0x27')][_0x6bfa('0x28')]===0x1f4){logger[_0x6bfa('0x27')](_0x6bfa('0x22'),_0x1b4c11,_0x21760a[_0x6bfa('0x27')][_0x6bfa('0x29')]);return _0x5ef6d0(_0x21760a[_0x6bfa('0x27')][_0x6bfa('0x29')]);}logger[_0x6bfa('0x27')]('SmsMessage,\x20%s,\x20%s',_0x1b4c11,_0x21760a[_0x6bfa('0x27')][_0x6bfa('0x29')]);return _0x1affa5(_0x21760a['error'][_0x6bfa('0x29')]);}else{logger[_0x6bfa('0x2a')](_0x6bfa('0x22'),_0x1b4c11,_0x6bfa('0x23'));_0x1affa5(_0x21760a[_0x6bfa('0x2b')][_0x6bfa('0x29')]);}})['catch'](function(_0x4c0b26){logger[_0x6bfa('0x27')](_0x6bfa('0x22'),_0x1b4c11,_0x4c0b26);_0x5ef6d0(_0x4c0b26);});});}function respondWithStatusCode(_0xcf2b43,_0x2b0171){_0x2b0171=_0x2b0171||0xcc;return function(_0x4291e6){if(_0x4291e6){return _0xcf2b43[_0x6bfa('0x2c')](_0x2b0171);}return _0xcf2b43[_0x6bfa('0x2d')](_0x2b0171)[_0x6bfa('0x2e')]();};}function respondWithResult(_0x243c94,_0x2154f0){_0x2154f0=_0x2154f0||0xc8;return function(_0x2a550b){if(_0x2a550b){return _0x243c94['status'](_0x2154f0)[_0x6bfa('0x2f')](_0x2a550b);}};}function respondWithFilteredResult(_0x1bf435,_0x5633d0){return function(_0x340eaa){if(_0x340eaa){var _0x498683=_0x340eaa[_0x6bfa('0x30')],_0x15cd72=_0x5633d0[_0x6bfa('0x31')],_0x47845d=_0x5633d0[_0x6bfa('0x31')]+_0x5633d0['limit'],_0x38be66;if(_0x47845d>=_0x498683){_0x47845d=_0x498683;_0x38be66=0xc8;}else{_0x38be66=0xce;}_0x1bf435[_0x6bfa('0x2d')](_0x38be66);return _0x1bf435[_0x6bfa('0x32')](_0x6bfa('0x33'),_0x15cd72+'-'+_0x47845d+'/'+_0x498683)[_0x6bfa('0x2f')](_0x340eaa);}return null;};}function patchUpdates(_0x986408){return function(_0x14f446){try{jsonpatch[_0x6bfa('0x34')](_0x14f446,_0x986408,!![]);}catch(_0x3a5b8b){return BPromise[_0x6bfa('0x35')](_0x3a5b8b);}return _0x14f446['save']();};}function saveUpdates(_0x18bcb3,_0x28a34e){return function(_0x537d3c){if(_0x537d3c){return _0x537d3c[_0x6bfa('0x36')](_0x18bcb3)['then'](function(_0x14fef5){return _0x14fef5;});}return null;};}function removeEntity(_0x46f197,_0x346e7e){return function(_0x5a2785){if(_0x5a2785){return _0x5a2785[_0x6bfa('0x37')]()[_0x6bfa('0x38')](function(){_0x46f197[_0x6bfa('0x2d')](0xcc)[_0x6bfa('0x2e')]();});}};}function handleEntityNotFound(_0x4aaf62,_0x1a5a4e){return function(_0x140020){if(!_0x140020){_0x4aaf62[_0x6bfa('0x2c')](0x194);}return _0x140020;};}function handleError(_0x40049b,_0x3e94d2){_0x3e94d2=_0x3e94d2||0x1f4;return function(_0x2f6ec7){logger['error'](_0x2f6ec7[_0x6bfa('0x39')]);if(_0x2f6ec7[_0x6bfa('0x3a')]){delete _0x2f6ec7[_0x6bfa('0x3a')];}_0x40049b[_0x6bfa('0x2d')](_0x3e94d2)[_0x6bfa('0x3b')](_0x2f6ec7);};}exports[_0x6bfa('0x3c')]=function(_0x235b45,_0x4c27a0){var _0x50cc25={},_0x496295={},_0x1084e7={'count':0x0,'rows':[]};var _0x4d06ec=_[_0x6bfa('0x3d')](db[_0x6bfa('0x3e')][_0x6bfa('0x3f')],function(_0x4a72a9){return{'name':_0x4a72a9[_0x6bfa('0x40')],'type':_0x4a72a9[_0x6bfa('0x41')][_0x6bfa('0x42')]};});_0x496295['model']=_[_0x6bfa('0x3d')](_0x4d06ec,_0x6bfa('0x3a'));_0x496295[_0x6bfa('0x43')]=_[_0x6bfa('0x44')](_0x235b45[_0x6bfa('0x43')]);_0x496295[_0x6bfa('0x45')]=_[_0x6bfa('0x46')](_0x496295[_0x6bfa('0x47')],_0x496295[_0x6bfa('0x43')]);_0x50cc25['attributes']=_[_0x6bfa('0x46')](_0x496295[_0x6bfa('0x47')],qs[_0x6bfa('0x48')](_0x235b45[_0x6bfa('0x43')]['fields']));_0x50cc25[_0x6bfa('0x49')]=_0x50cc25[_0x6bfa('0x49')]['length']?_0x50cc25[_0x6bfa('0x49')]:_0x496295['model'];if(!_0x235b45[_0x6bfa('0x43')]['hasOwnProperty'](_0x6bfa('0x4a'))){_0x50cc25['limit']=qs[_0x6bfa('0x4b')](_0x235b45[_0x6bfa('0x43')][_0x6bfa('0x4b')]);_0x50cc25['offset']=qs[_0x6bfa('0x31')](_0x235b45['query'][_0x6bfa('0x31')]);}_0x50cc25[_0x6bfa('0x4c')]=qs['sort'](_0x235b45[_0x6bfa('0x43')]['sort']);_0x50cc25[_0x6bfa('0x4d')]=qs[_0x6bfa('0x45')](_[_0x6bfa('0x4e')](_0x235b45[_0x6bfa('0x43')],_0x496295[_0x6bfa('0x45')]),_0x4d06ec);if(_0x235b45[_0x6bfa('0x43')][_0x6bfa('0x4f')]){_0x50cc25[_0x6bfa('0x4d')]=_[_0x6bfa('0x50')](_0x50cc25[_0x6bfa('0x4d')],{'$or':_[_0x6bfa('0x3d')](_0x4d06ec,function(_0x18516b){if(_0x18516b['type']!=='VIRTUAL'){var _0x4dc69c={};_0x4dc69c[_0x18516b[_0x6bfa('0x3a')]]={'$like':'%'+_0x235b45[_0x6bfa('0x43')][_0x6bfa('0x4f')]+'%'};return _0x4dc69c;}})});}_0x50cc25=_['merge']({},_0x50cc25,_0x235b45[_0x6bfa('0x51')]);var _0x438d60={'where':_0x50cc25[_0x6bfa('0x4d')]};return db['SmsMessage'][_0x6bfa('0x30')](_0x438d60)[_0x6bfa('0x38')](function(_0x5529aa){_0x1084e7['count']=_0x5529aa;if(_0x235b45[_0x6bfa('0x43')][_0x6bfa('0x52')]){_0x50cc25[_0x6bfa('0x53')]=[{'all':!![]}];}return db[_0x6bfa('0x3e')][_0x6bfa('0x54')](_0x50cc25);})[_0x6bfa('0x38')](function(_0x3ce909){_0x1084e7[_0x6bfa('0x55')]=_0x3ce909;return _0x1084e7;})[_0x6bfa('0x38')](respondWithFilteredResult(_0x4c27a0,_0x50cc25))[_0x6bfa('0x56')](handleError(_0x4c27a0,null));};exports[_0x6bfa('0x57')]=function(_0x234f7e,_0x43f025){var _0x3068c0={'raw':!![],'where':{'id':_0x234f7e[_0x6bfa('0x58')]['id']}},_0x6ef173={};_0x6ef173[_0x6bfa('0x47')]=_[_0x6bfa('0x44')](db[_0x6bfa('0x3e')]['rawAttributes']);_0x6ef173[_0x6bfa('0x43')]=_[_0x6bfa('0x44')](_0x234f7e[_0x6bfa('0x43')]);_0x6ef173['filters']=_[_0x6bfa('0x46')](_0x6ef173[_0x6bfa('0x47')],_0x6ef173['query']);_0x3068c0[_0x6bfa('0x49')]=_['intersection'](_0x6ef173['model'],qs[_0x6bfa('0x48')](_0x234f7e['query'][_0x6bfa('0x48')]));_0x3068c0[_0x6bfa('0x49')]=_0x3068c0[_0x6bfa('0x49')]['length']?_0x3068c0['attributes']:_0x6ef173[_0x6bfa('0x47')];if(_0x234f7e['query'][_0x6bfa('0x52')]){_0x3068c0[_0x6bfa('0x53')]=[{'all':!![]}];}_0x3068c0=_['merge']({},_0x3068c0,_0x234f7e['options']);return db[_0x6bfa('0x3e')][_0x6bfa('0x59')](_0x3068c0)[_0x6bfa('0x38')](handleEntityNotFound(_0x43f025,null))['then'](respondWithResult(_0x43f025,null))['catch'](handleError(_0x43f025,null));};exports[_0x6bfa('0x5a')]=function(_0x9e461,_0x1d5a1b){return db[_0x6bfa('0x3e')][_0x6bfa('0x5a')](_0x9e461[_0x6bfa('0x5b')],{})[_0x6bfa('0x38')](respondWithResult(_0x1d5a1b,0xc9))[_0x6bfa('0x56')](handleError(_0x1d5a1b,null));};exports[_0x6bfa('0x36')]=function(_0x136453,_0x407a73){if(_0x136453[_0x6bfa('0x5b')]['id']){delete _0x136453['body']['id'];}return db[_0x6bfa('0x3e')]['find']({'where':{'id':_0x136453['params']['id']}})[_0x6bfa('0x38')](handleEntityNotFound(_0x407a73,null))[_0x6bfa('0x38')](saveUpdates(_0x136453[_0x6bfa('0x5b')],null))[_0x6bfa('0x38')](respondWithResult(_0x407a73,null))['catch'](handleError(_0x407a73,null));};exports[_0x6bfa('0x37')]=function(_0x5c3b54,_0x1d15d5){return db[_0x6bfa('0x3e')][_0x6bfa('0x59')]({'where':{'id':_0x5c3b54['params']['id']}})[_0x6bfa('0x38')](handleEntityNotFound(_0x1d15d5,null))['then'](removeEntity(_0x1d15d5,null))['catch'](handleError(_0x1d15d5,null));};exports[_0x6bfa('0x5c')]=function(_0x78a9c3,_0x26aecf){return db['SmsMessage'][_0x6bfa('0x5c')]()[_0x6bfa('0x38')](respondWithResult(_0x26aecf,null))['catch'](handleError(_0x26aecf,null));};var interaction_log=require(_0x6bfa('0x14'))(_0x6bfa('0x5d'));exports['accept']=function(_0x772ad2,_0x1458c2,_0x35cced){var _0x126360={'channel':_0x6bfa('0x5e')};if(_0x772ad2['body']['id']){delete _0x772ad2[_0x6bfa('0x5b')]['id'];}_0x772ad2['body'][_0x6bfa('0x5f')]=!![];_0x772ad2[_0x6bfa('0x5b')][_0x6bfa('0x60')]=moment()[_0x6bfa('0x61')](_0x6bfa('0x62'));_0x772ad2[_0x6bfa('0x5b')]['UserId']=_0x772ad2[_0x6bfa('0x5b')][_0x6bfa('0x63')]||_0x772ad2[_0x6bfa('0x64')]['id'];return db[_0x6bfa('0x3e')][_0x6bfa('0x59')]({'where':{'id':_0x772ad2[_0x6bfa('0x58')]['id'],'UserId':null},'include':[{'model':db['CmContact'],'as':_0x6bfa('0x65')}]})[_0x6bfa('0x38')](handleEntityNotFound(_0x1458c2,null))[_0x6bfa('0x38')](saveUpdates(_0x772ad2[_0x6bfa('0x5b')],null))[_0x6bfa('0x38')](function(_0x2e45f4){if(_0x2e45f4){_0x126360[_0x6bfa('0x29')]=_0x2e45f4[_0x6bfa('0x66')]({'plain':!![]});return db[_0x6bfa('0x67')]['find']({'where':{'id':_0x2e45f4[_0x6bfa('0x68')]}});}return null;})['then'](handleEntityNotFound(_0x1458c2,null))['then'](function(_0x1f5e4f){if(_0x1f5e4f){return _0x1f5e4f[_0x6bfa('0x36')]({'UserId':_0x772ad2[_0x6bfa('0x5b')][_0x6bfa('0x63')],'read1stAt':_[_0x6bfa('0x69')](_0x1f5e4f[_0x6bfa('0x6a')])?moment()[_0x6bfa('0x61')](_0x6bfa('0x62')):undefined});}return null;})['then'](function(_0x5b05a8){if(_0x5b05a8){_0x126360[_0x6bfa('0x6b')]=_0x5b05a8[_0x6bfa('0x66')]({'plain':!![]});interaction_log[_0x6bfa('0x2a')](_0x6bfa('0x6c'),_0x772ad2['user']['id'],_0x772ad2[_0x6bfa('0x64')][_0x6bfa('0x3a')],_0x772ad2['user']['role'],_0x126360[_0x6bfa('0x6b')]['id'],_0x772ad2[_0x6bfa('0x5b')]?JSON[_0x6bfa('0x26')](_0x772ad2['body']):_0x6bfa('0x6d'));return respondWithRpcPromise(_0x6bfa('0x6e'),'acceptMessage',_0x126360);}return null;})[_0x6bfa('0x38')](function(_0x188040){if(_0x188040){if(_0x772ad2[_0x6bfa('0x5b')][_0x6bfa('0x6f')]){_0x126360[_0x6bfa('0x29')][_0x6bfa('0x70')]=util[_0x6bfa('0x61')](_0x6bfa('0x71'),_0x772ad2[_0x6bfa('0x64')]['name']);_0x126360[_0x6bfa('0x29')][_0x6bfa('0x72')]=_0x126360[_0x6bfa('0x72')];_0x126360[_0x6bfa('0x29')][_0x6bfa('0x73')]=_0x6bfa('0x74');return respondWithRpcPromise('EventManager','EventManager',{'event':_0x6bfa('0x75'),'message':_0x126360[_0x6bfa('0x29')]},client9002)['then'](function(){return _0x126360;});}return _0x126360;}return null;})[_0x6bfa('0x38')](respondWithResult(_0x1458c2,null))[_0x6bfa('0x56')](handleError(_0x1458c2,null));};var interaction_log=require(_0x6bfa('0x14'))('sms-interactions');exports[_0x6bfa('0x35')]=function(_0x52bc7c,_0x5a3158,_0x4cd72e){var _0x90203f={'agent':{},'channel':_0x6bfa('0x5e')};if(_0x52bc7c['body']['id']){delete _0x52bc7c[_0x6bfa('0x5b')]['id'];}_0x52bc7c[_0x6bfa('0x5b')]['UserId']=_0x52bc7c['body'][_0x6bfa('0x63')]||_0x52bc7c[_0x6bfa('0x64')]['id'];_0x90203f[_0x6bfa('0x76')]['id']=_0x52bc7c[_0x6bfa('0x5b')][_0x6bfa('0x63')];return db['SmsMessage'][_0x6bfa('0x59')]({'where':{'id':_0x52bc7c[_0x6bfa('0x58')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x5a3158,null))[_0x6bfa('0x38')](function(_0x285c68){if(_0x285c68){_0x90203f['message']=_0x285c68[_0x6bfa('0x66')]({'plain':!![]});return db[_0x6bfa('0x67')][_0x6bfa('0x59')]({'where':{'id':_0x285c68['SmsInteractionId']}});}return null;})[_0x6bfa('0x38')](handleEntityNotFound(_0x5a3158,null))[_0x6bfa('0x38')](function(_0x649385){if(_0x649385){_0x90203f[_0x6bfa('0x6b')]=_0x649385[_0x6bfa('0x66')]({'plain':!![]});interaction_log[_0x6bfa('0x2a')](_0x6bfa('0x77'),_0x52bc7c[_0x6bfa('0x64')]['id'],_0x52bc7c['user'][_0x6bfa('0x3a')],_0x52bc7c['user'][_0x6bfa('0x78')],_0x90203f[_0x6bfa('0x6b')]['id'],_0x52bc7c[_0x6bfa('0x5b')]?JSON[_0x6bfa('0x26')](_0x52bc7c[_0x6bfa('0x5b')]):_0x6bfa('0x6d'));return respondWithRpcPromise(_0x6bfa('0x79'),_0x6bfa('0x7a'),_0x90203f);}return null;})[_0x6bfa('0x38')](function(_0x9c54fb){if(_0x9c54fb){_0x9c54fb[_0x6bfa('0x29')][_0x6bfa('0x70')]=util[_0x6bfa('0x61')](_0x6bfa('0x71'),_0x52bc7c[_0x6bfa('0x64')][_0x6bfa('0x3a')]);_0x9c54fb[_0x6bfa('0x29')][_0x6bfa('0x72')]=_0x90203f[_0x6bfa('0x72')];_0x9c54fb[_0x6bfa('0x29')][_0x6bfa('0x73')]=_0x6bfa('0x35');respondWithRpcPromise('EventManager','EventManager',{'event':'rejectmessage','message':_0x9c54fb['message']},client9002);return _0x90203f;}return null;})[_0x6bfa('0x38')](respondWithResult(_0x5a3158,null))[_0x6bfa('0x56')](handleError(_0x5a3158,null));};exports[_0x6bfa('0x2d')]=function(_0x3888fb,_0x536a28,_0x2466b6){if(_0x3888fb[_0x6bfa('0x5b')]['id']){delete _0x3888fb[_0x6bfa('0x5b')]['id'];}var _0x3a22fb;return db['SmsMessage'][_0x6bfa('0x59')]({'where':{'id':_0x3888fb[_0x6bfa('0x58')]['id']}})[_0x6bfa('0x38')](handleEntityNotFound(_0x536a28,null))[_0x6bfa('0x38')](function(_0x9db255){if(_0x9db255){_0x3a22fb=_0x9db255;return db[_0x6bfa('0x7b')][_0x6bfa('0x59')]({'where':{'id':_0x9db255[_0x6bfa('0x7c')]}});}})[_0x6bfa('0x38')](handleEntityNotFound(_0x536a28,null))[_0x6bfa('0x38')](function(_0x4dc7c6){if(_0x4dc7c6){logger[_0x6bfa('0x24')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x6bfa('0x2d'),_0x6bfa('0x7d'),_0x4dc7c6[_0x6bfa('0x41')],util[_0x6bfa('0x7e')](_0x3888fb[_0x6bfa('0x5b')],{'showHidden':![],'depth':null}));switch(_0x4dc7c6['type']){case _0x6bfa('0x7f'):if(_0x3888fb[_0x6bfa('0x5b')][_0x6bfa('0x80')]&&_0x3888fb[_0x6bfa('0x5b')][_0x6bfa('0x80')]===_0x3a22fb['messageId']){return _0x3a22fb[_0x6bfa('0x36')]({'read':!![]});}else{logger['error'](_0x6bfa('0x81'),_0x6bfa('0x2d'),_0x6bfa('0x7f'),util[_0x6bfa('0x7e')](_0x3888fb['body'],{'showHidden':![],'depth':null}));}break;case _0x6bfa('0x82'):if(_0x3888fb['body']['MessageUUID']&&_0x3888fb['body'][_0x6bfa('0x83')]===_0x3a22fb[_0x6bfa('0x84')]&&_[_0x6bfa('0x85')](['sent',_0x6bfa('0x86')],_0x3888fb['body']['Status'])>=0x0){return _0x3a22fb[_0x6bfa('0x36')]({'read':!![]});}else{logger[_0x6bfa('0x27')](_0x6bfa('0x81'),'status',_0x6bfa('0x87'),util[_0x6bfa('0x7e')](_0x3888fb[_0x6bfa('0x5b')],{'showHidden':![],'depth':null}));}break;case _0x6bfa('0x88'):var _0x445589=_0x3888fb['body']['results'][0x0];if(_0x445589['status'][_0x6bfa('0x89')]===_0x6bfa('0x8a')){return _0x3a22fb[_0x6bfa('0x36')]({'read':!![]});}else{logger['error'](_0x6bfa('0x81'),_0x6bfa('0x2d'),_0x6bfa('0x88'),util['inspect'](_0x3888fb['body'],{'showHidden':![],'depth':null}));}break;}return _0x3a22fb;}})[_0x6bfa('0x38')](respondWithResult(_0x536a28,null))[_0x6bfa('0x56')](handleError(_0x536a28,null));}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.events.js b/server/api/smsMessage/smsMessage.events.js index 339c674..60e55fe 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 _0xade8=['save','update','emit','hasOwnProperty','hook','exports','../../mysqldb','SmsMessage','setMaxListeners'];(function(_0x1a1bda,_0xbe013f){var _0x3a0a4e=function(_0x32fffd){while(--_0x32fffd){_0x1a1bda['push'](_0x1a1bda['shift']());}};_0x3a0a4e(++_0xbe013f);}(_0xade8,0x114));var _0x8ade=function(_0x242ca0,_0x2a0b03){_0x242ca0=_0x242ca0-0x0;var _0x3cf902=_0xade8[_0x242ca0];return _0x3cf902;};'use strict';var EventEmitter=require('events');var SmsMessage=require(_0x8ade('0x0'))['db'][_0x8ade('0x1')];var SmsMessageEvents=new EventEmitter();SmsMessageEvents[_0x8ade('0x2')](0x0);var events={'afterCreate':_0x8ade('0x3'),'afterUpdate':_0x8ade('0x4'),'afterDestroy':'remove'};function emitEvent(_0x44030a){return function(_0x560a65,_0x34e71a,_0x4a3dfe){SmsMessageEvents[_0x8ade('0x5')](_0x44030a+':'+_0x560a65['id'],_0x560a65);SmsMessageEvents[_0x8ade('0x5')](_0x44030a,_0x560a65);_0x4a3dfe(null);};}for(var e in events){if(events[_0x8ade('0x6')](e)){var event=events[e];SmsMessage[_0x8ade('0x7')](e,emitEvent(event));}}module[_0x8ade('0x8')]=SmsMessageEvents; \ No newline at end of file +var _0x379f=['events','../../mysqldb','SmsMessage','setMaxListeners','save','update','emit','exports'];(function(_0x18c506,_0x5f4ca3){var _0x4ab39f=function(_0x1a6e5c){while(--_0x1a6e5c){_0x18c506['push'](_0x18c506['shift']());}};_0x4ab39f(++_0x5f4ca3);}(_0x379f,0xe0));var _0xf379=function(_0x35acf5,_0x1f6c96){_0x35acf5=_0x35acf5-0x0;var _0x29c02b=_0x379f[_0x35acf5];return _0x29c02b;};'use strict';var EventEmitter=require(_0xf379('0x0'));var SmsMessage=require(_0xf379('0x1'))['db'][_0xf379('0x2')];var SmsMessageEvents=new EventEmitter();SmsMessageEvents[_0xf379('0x3')](0x0);var events={'afterCreate':_0xf379('0x4'),'afterUpdate':_0xf379('0x5'),'afterDestroy':'remove'};function emitEvent(_0x455e7b){return function(_0x314771,_0x2be9ef,_0x222d3a){SmsMessageEvents[_0xf379('0x6')](_0x455e7b+':'+_0x314771['id'],_0x314771);SmsMessageEvents[_0xf379('0x6')](_0x455e7b,_0x314771);_0x222d3a(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SmsMessage['hook'](e,emitEvent(event));}}module[_0xf379('0x7')]=SmsMessageEvents; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.model.js b/server/api/smsMessage/smsMessage.model.js index 6be98bf..d415bd3 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 _0xa5ef=['code','https://api.intelepeer.com/_rest/v4/app/sms/mdr','refid','status','message','intelepeer','Token\x20not\x20received','finally','utf8mb4','utf8mb4_unicode_ci','../../config/logger','api','moment','request-promise','rimraf','../../config/environment','exports','SmsMessage','sms_messages','messageId','body','FULLTEXT','models','get','direction','out','secret','isNil','SmsInteraction','findOne','update','createdAt','toLowerCase','catch','error','SmsAccount','find','then','type','twilio','accountSid','authToken','phone','create','remote','/status?token=','sid','SmsMessage,\x20%s,\x20%s,\x20%s','inspect','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','skebby','https://api.skebby.it/API/v1.0/REST/','username','password','smsMethod','sender','login?username=','&password=','split','sms','POST','session_key','total_sent','internal_order_id','read','afterCreate','Missing\x20parameters:\x20username,\x20password','connectel','deliveryReport','Missing\x20parameters:\x20authToken','clicksend','xCALLY\x20Motion','format','%s:%s','https://rest.clicksend.com/v3/sms/send','Basic\x20%s','toString','base64','http_code','data','queued_count','message_id','clickSend','plivo','authId','senderString','/api/sms/messages/','https://api.plivo.com/v1/Account/%s/Message/','message_uuid','Missing\x20parameters:\x20authId,\x20authToken','infobip','baseUrl','/auth/1/session','/sms/2/text/advanced','IBSSO\x20','messages','Missing\x20parameters:\x20base_url','crypto','timestamp','sort','length','md5','digest','hex','signature=','/external/get/send.php?','keys','id_sms','csc','Missing\x20parameters:\x20apiKey','clickatell','apiKey','uuid','UTF-8','apiMessageId','https://api.intelepeer.com/_rest/v4/app/sms/send','Bearer\x20','application/json'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0xa5ef,0x1e2));var _0xfa5e=function(_0xc4c142,_0x392430){_0xc4c142=_0xc4c142-0x0;var _0x2c825e=_0xa5ef[_0xc4c142];return _0x2c825e;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xfa5e('0x0'))(_0xfa5e('0x1'));var moment=require(_0xfa5e('0x2'));var BPromise=require('bluebird');var rp=require(_0xfa5e('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0xfa5e('0x4'));var config=require(_0xfa5e('0x5'));var attributes=require('./smsMessage.attributes');module[_0xfa5e('0x6')]=function(_0xf314f,_0x67b75){return _0xf314f['define'](_0xfa5e('0x7'),attributes,{'tableName':_0xfa5e('0x8'),'paranoid':![],'indexes':[{'name':_0xfa5e('0x9'),'fields':[_0xfa5e('0x9')]},{'name':'fti_sms_messages','fields':[_0xfa5e('0xa')],'type':_0xfa5e('0xb')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x2f528a,_0x3c02aa,_0x5dc7ed){var _0x411f93=_0xf314f[_0xfa5e('0xc')];var _0x20e9ea=_0x2f528a[_0xfa5e('0xd')]({'plain':!![]});if(_0x20e9ea['direction']['toLowerCase']()==='in'||_0x20e9ea[_0xfa5e('0xe')]['toLowerCase']()===_0xfa5e('0xf')&&!_0x20e9ea[_0xfa5e('0x10')]&&!_[_0xfa5e('0x11')](_0x20e9ea['UserId'])){_0x411f93[_0xfa5e('0x12')][_0xfa5e('0x13')]({'where':{'id':_0x20e9ea['SmsInteractionId']}})['then'](function(_0x5d84e9){if(_0x5d84e9){_0x5d84e9[_0xfa5e('0x14')]({'lastMsgAt':_0x20e9ea[_0xfa5e('0x15')],'lastMsgDirection':_0x20e9ea['direction'][_0xfa5e('0x16')]()});}})[_0xfa5e('0x17')](function(_0xce32df){console[_0xfa5e('0x18')](_0xce32df);});}if(_0x20e9ea[_0xfa5e('0xe')]==='out'&&!_0x20e9ea['secret']){var _0x1e54d4;_0x411f93[_0xfa5e('0x19')][_0xfa5e('0x1a')]({'where':{'id':_0x20e9ea['SmsAccountId']},'raw':!![]})[_0xfa5e('0x1b')](function(_0x3dc1b1){_0x1e54d4=_0x3dc1b1;if(_0x1e54d4&&_0x1e54d4[_0xfa5e('0x1c')]){switch(_0x1e54d4[_0xfa5e('0x1c')]){case _0xfa5e('0x1d'):var _0x28b597=require(_0xfa5e('0x1d'));if(_0x1e54d4[_0xfa5e('0x1e')]&&_0x1e54d4[_0xfa5e('0x1f')]&&_0x1e54d4[_0xfa5e('0x20')]){var _0xc2225a=new _0x28b597(_0x1e54d4['accountSid'],_0x1e54d4[_0xfa5e('0x1f')]);_0xc2225a['messages'][_0xfa5e('0x21')]({'body':_0x20e9ea[_0xfa5e('0xa')],'to':_0x20e9ea['phone'],'from':_0x1e54d4[_0xfa5e('0x20')],'statusCallback':_0x1e54d4[_0xfa5e('0x22')]+'/api/sms/messages/'+_0x20e9ea['id']+_0xfa5e('0x23')+_0x1e54d4['token']})[_0xfa5e('0x1b')](function(_0x532a8b){if(_0x532a8b[_0xfa5e('0x24')]){return _0x2f528a[_0xfa5e('0x14')]({'messageId':_0x532a8b['sid']});}})[_0xfa5e('0x17')](function(_0x5bb653){logger[_0xfa5e('0x18')](_0xfa5e('0x25'),'afterCreate','twilio',util[_0xfa5e('0x26')](_0x5bb653,{'showHidden':![],'depth':null}));});}else{logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0xfa5e('0x1d'),_0xfa5e('0x27'));}break;case _0xfa5e('0x28'):var _0x21d842=_0xfa5e('0x29');if(_0x1e54d4[_0xfa5e('0x2a')]&&_0x1e54d4[_0xfa5e('0x2b')]){var _0x23c3ea={'recipient':[_0x20e9ea[_0xfa5e('0x20')]],'message':_0x20e9ea[_0xfa5e('0xa')],'message_type':_0x1e54d4[_0xfa5e('0x2c')]};if(_0x1e54d4[_0xfa5e('0x2c')]&&_0x1e54d4[_0xfa5e('0x2c')]!=='SI'){_0x23c3ea[_0xfa5e('0x2d')]=_0x1e54d4[_0xfa5e('0x20')];}var _0x2b1335={'url':_0x21d842+_0xfa5e('0x2e')+_0x1e54d4[_0xfa5e('0x2a')]+_0xfa5e('0x2f')+_0x1e54d4[_0xfa5e('0x2b')],'method':'GET'};rp(_0x2b1335)[_0xfa5e('0x1b')](function(_0x3e0802){var _0x337f0c=_0x3e0802[_0xfa5e('0x30')](';');var _0x3554b5={'user_key':_0x337f0c[0x0],'session_key':_0x337f0c[0x1]};_0x2b1335={'url':_0x21d842+_0xfa5e('0x31'),'method':_0xfa5e('0x32'),'headers':{'user_key':_0x3554b5['user_key'],'Session_key':_0x3554b5[_0xfa5e('0x33')]},'json':!![],'body':_0x23c3ea};return rp(_0x2b1335);})[_0xfa5e('0x1b')](function(_0xb117bc){if(_0xb117bc[_0xfa5e('0x34')]>=0x1){var _0x5a9aa9={'messageId':_0xb117bc[_0xfa5e('0x35')]};if(_0x1e54d4[_0xfa5e('0x2c')]!=='GP'||!_0x1e54d4['deliveryReport']){_0x5a9aa9[_0xfa5e('0x36')]=!![];}return _0x2f528a[_0xfa5e('0x14')](_0x5a9aa9);}else{return logger[_0xfa5e('0x18')](_0xfa5e('0x25'),_0xfa5e('0x37'),'skebby',util['inspect'](_0xb117bc,{'showHidden':![],'depth':null}));}})['catch'](function(_0x369ecf){return logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0xfa5e('0x37'),_0xfa5e('0x28'),util[_0xfa5e('0x26')](_0x369ecf,{'showHidden':![],'depth':null}));});}else{logger[_0xfa5e('0x18')](_0xfa5e('0x25'),_0xfa5e('0x37'),'skebby',_0xfa5e('0x38'));}break;case _0xfa5e('0x39'):if(_0x1e54d4[_0xfa5e('0x1f')]){var _0x3f7d39={'recipient':_0x20e9ea['phone'],'message':_0x20e9ea[_0xfa5e('0xa')],'sender':_0x1e54d4['senderString']||_0x1e54d4[_0xfa5e('0x20')],'authorization':_0x1e54d4['authToken']};var _0x3c02aa={'method':_0xfa5e('0x32'),'uri':'https://smsapi.connectel.se/api/send/','body':_0x3f7d39,'json':!![]};rp(_0x3c02aa)[_0xfa5e('0x1b')](function(_0x563b66){var _0x323a52={'messageId':_0x563b66['requestid']};if(!_0x1e54d4[_0xfa5e('0x3a')]){_0x323a52[_0xfa5e('0x36')]=!![];}return _0x2f528a[_0xfa5e('0x14')](_0x323a52);})[_0xfa5e('0x17')](function(_0x35cc9b){logger[_0xfa5e('0x18')](_0xfa5e('0x25'),'afterCreate',_0xfa5e('0x39'),util[_0xfa5e('0x26')](_0x35cc9b,{'showHidden':![],'depth':null}));});}else{logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0xfa5e('0x37'),'connectel',_0xfa5e('0x3b'));}break;case _0xfa5e('0x3c'):if(_0x1e54d4['username']&&_0x1e54d4['password']){var _0x3f7d39={'messages':[{'source':_0xfa5e('0x3d'),'to':_0x20e9ea[_0xfa5e('0x20')],'body':_0x20e9ea[_0xfa5e('0xa')],'from':_0x1e54d4['senderString']||_0x1e54d4[_0xfa5e('0x20')]}]};var _0x9791b7=util[_0xfa5e('0x3e')](_0xfa5e('0x3f'),_0x1e54d4[_0xfa5e('0x2a')],_0x1e54d4[_0xfa5e('0x2b')]);var _0x3c02aa={'method':_0xfa5e('0x32'),'uri':_0xfa5e('0x40'),'body':_0x3f7d39,'headers':{'Authorization':util[_0xfa5e('0x3e')](_0xfa5e('0x41'),new Buffer(_0x9791b7)[_0xfa5e('0x42')](_0xfa5e('0x43')))},'json':!![]};rp(_0x3c02aa)[_0xfa5e('0x1b')](function(_0x270366){if(_0x270366[_0xfa5e('0x44')]>=0xc8&&_0x270366[_0xfa5e('0x44')]<=0xce){if(_0x270366[_0xfa5e('0x45')]&&_0x270366[_0xfa5e('0x45')][_0xfa5e('0x46')]>0x0){var _0x4d121c=_['head'](_0x270366['data']['messages']);var _0x44146f={'messageId':_0x4d121c[_0xfa5e('0x47')]};if(!_0x1e54d4['deliveryReport']){_0x44146f['read']=!![];}return _0x2f528a[_0xfa5e('0x14')](_0x44146f);}else{logger['error'](_0xfa5e('0x25'),_0xfa5e('0x37'),_0xfa5e('0x48'),util[_0xfa5e('0x26')](_0x270366,{'showHidden':![],'depth':null}));}}else{logger[_0xfa5e('0x18')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xfa5e('0x37'),_0xfa5e('0x48'),util[_0xfa5e('0x26')](_0x270366,{'showHidden':![],'depth':null}));}})[_0xfa5e('0x17')](function(_0x4197e4){logger[_0xfa5e('0x18')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xfa5e('0x37'),_0xfa5e('0x48'),util['inspect'](_0x4197e4,{'showHidden':![],'depth':null}));});}else{logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0xfa5e('0x37'),_0xfa5e('0x48'),_0xfa5e('0x38'));}break;case _0xfa5e('0x49'):if(_0x1e54d4[_0xfa5e('0x4a')]&&_0x1e54d4[_0xfa5e('0x1f')]){var _0x3f7d39={'dst':_0x20e9ea['phone'],'text':_0x20e9ea[_0xfa5e('0xa')],'src':_0x1e54d4[_0xfa5e('0x4b')]||_0x1e54d4['phone'],'url':_0x1e54d4[_0xfa5e('0x22')]+_0xfa5e('0x4c')+_0x20e9ea['id']+_0xfa5e('0x23')+_0x1e54d4['token']};var _0x9791b7=util['format'](_0xfa5e('0x3f'),_0x1e54d4['authId'],_0x1e54d4[_0xfa5e('0x1f')]);var _0x3c02aa={'method':_0xfa5e('0x32'),'uri':util[_0xfa5e('0x3e')](_0xfa5e('0x4d'),_0x1e54d4[_0xfa5e('0x4a')]),'body':_0x3f7d39,'headers':{'Authorization':util[_0xfa5e('0x3e')](_0xfa5e('0x41'),new Buffer(_0x9791b7)[_0xfa5e('0x42')](_0xfa5e('0x43')))},'json':!![]};rp(_0x3c02aa)[_0xfa5e('0x1b')](function(_0x2e694b){var _0x5bb2ff={'messageId':_0x2e694b[_0xfa5e('0x4e')][0x0]};return _0x2f528a['update'](_0x5bb2ff);})[_0xfa5e('0x17')](function(_0x269504){logger[_0xfa5e('0x18')](_0xfa5e('0x25'),'afterCreate','plivo',util['inspect'](_0x269504,{'showHidden':![],'depth':null}));});}else{logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0xfa5e('0x49'),_0xfa5e('0x4f'));}break;case _0xfa5e('0x50'):if(_0x1e54d4[_0xfa5e('0x2a')]&&_0x1e54d4[_0xfa5e('0x2b')]){if(_0x1e54d4[_0xfa5e('0x51')]){var _0x33c591={'method':_0xfa5e('0x32'),'uri':_0x1e54d4[_0xfa5e('0x51')]+_0xfa5e('0x52'),'body':{'username':_0x1e54d4[_0xfa5e('0x2a')],'password':_0x1e54d4['password']},'json':!![]};return rp(_0x33c591)[_0xfa5e('0x1b')](function(_0x284101){var _0x3e107b={'method':'POST','uri':_0x1e54d4[_0xfa5e('0x51')]+_0xfa5e('0x53'),'body':{'messages':[{'from':_0x1e54d4[_0xfa5e('0x20')],'destinations':[{'to':_0x20e9ea[_0xfa5e('0x20')]}],'text':_0x20e9ea[_0xfa5e('0xa')],'notifyUrl':_0x1e54d4[_0xfa5e('0x22')]+_0xfa5e('0x4c')+_0x20e9ea['id']+_0xfa5e('0x23')+_0x1e54d4['token'],'notifyContentType':'application/json','callbackData':_0x1e54d4['phone']+';'+_0x20e9ea[_0xfa5e('0xa')]}]},'headers':{'Authorization':_0xfa5e('0x54')+_0x284101['token']},'json':!![]};return rp(_0x3e107b)[_0xfa5e('0x1b')](function(_0x2d5392){if(_0x2d5392['messages']){var _0x2cf4b4={'messageId':_0x2d5392[_0xfa5e('0x55')][0x0][_0xfa5e('0x9')]};if(!_0x1e54d4[_0xfa5e('0x3a')]){_0x2cf4b4[_0xfa5e('0x36')]=!![];}return _0x2f528a[_0xfa5e('0x14')](_0x2cf4b4);}else{return logger[_0xfa5e('0x18')](_0xfa5e('0x25'),_0xfa5e('0x37'),_0xfa5e('0x50'),util[_0xfa5e('0x26')](_0x2d5392,{'showHidden':![],'depth':null}));}});})[_0xfa5e('0x17')](function(_0x17b357){return logger[_0xfa5e('0x18')](_0xfa5e('0x25'),'afterCreate',_0xfa5e('0x50'),util['inspect'](_0x17b357,{'showHidden':![],'depth':null}));});}else{logger['error'](_0xfa5e('0x25'),_0xfa5e('0x37'),_0xfa5e('0x50'),_0xfa5e('0x56'));}}else{logger[_0xfa5e('0x18')](_0xfa5e('0x25'),_0xfa5e('0x37'),_0xfa5e('0x50'),_0xfa5e('0x38'));}break;case'csc':var _0x4c78a7=require(_0xfa5e('0x57'));if(_0x1e54d4['apiKey']){var _0x251025={};_0x251025['login']=_0x1e54d4[_0xfa5e('0x2a')];_0x251025[_0xfa5e('0x20')]=_0x20e9ea[_0xfa5e('0x20')];_0x251025[_0xfa5e('0x2d')]=_0x1e54d4[_0xfa5e('0x20')];_0x251025['text']=_0x20e9ea[_0xfa5e('0xa')];_0x251025[_0xfa5e('0x58')]=+new Date();var _0x170079='';var _0x47efb4='';var _0x64dfba=Object['keys'](_0x251025);_0x64dfba[_0xfa5e('0x59')]();for(var _0x7d67d7=0x0;_0x7d67d7<_0x64dfba[_0xfa5e('0x5a')];_0x7d67d7++){if(_0x170079!=''){_0x170079+='&';}_0x170079+=_0x64dfba[_0x7d67d7]+'='+encodeURIComponent(_0x251025[_0x64dfba[_0x7d67d7]]);_0x47efb4+=_0x251025[_0x64dfba[_0x7d67d7]];}_0x47efb4+=_0x1e54d4['apiKey'];_0x47efb4=_0x4c78a7['createHash'](_0xfa5e('0x5b'))[_0xfa5e('0x14')](_0x47efb4)[_0xfa5e('0x5c')](_0xfa5e('0x5d'));if(_0x170079!==''){_0x170079+='&';}_0x170079+=_0xfa5e('0x5e')+_0x47efb4;var _0x2b1335={'method':'GET','uri':_0x1e54d4[_0xfa5e('0x51')]+_0xfa5e('0x5f')+_0x170079,'json':!![]};return rp(_0x2b1335)[_0xfa5e('0x1b')](function(_0x22026b){var _0x59c4d3=Object[_0xfa5e('0x60')](_0x22026b);if(_0x22026b[_0x59c4d3[0x0]][_0xfa5e('0x18')]&&parseInt(_0x22026b[_0x59c4d3[0x0]][_0xfa5e('0x18')])===0x0){var _0x3d29c4={'messageId':_0x22026b[_0x59c4d3[0x0]][_0xfa5e('0x61')]};if(!_0x1e54d4[_0xfa5e('0x3a')]){_0x3d29c4[_0xfa5e('0x36')]=!![];}return _0x2f528a[_0xfa5e('0x14')](_0x3d29c4);}else{return logger[_0xfa5e('0x18')](_0xfa5e('0x25'),_0xfa5e('0x37'),_0xfa5e('0x62'),util[_0xfa5e('0x26')](_0x22026b[_0xfa5e('0x18')],{'showHidden':![],'depth':null}));}})[_0xfa5e('0x17')](function(_0x1dd45f){return logger[_0xfa5e('0x18')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xfa5e('0x37'),'csc',util[_0xfa5e('0x26')](_0x1dd45f,{'showHidden':![],'depth':null}));});}else{logger[_0xfa5e('0x18')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xfa5e('0x37'),'csc',_0xfa5e('0x63'));}break;case _0xfa5e('0x64'):if(_0x1e54d4[_0xfa5e('0x65')]){var _0x18d7fd={'method':_0xfa5e('0x32'),'uri':'https://platform.clickatell.com/messages','headers':{'Authorization':_0x1e54d4['apiKey']},'body':{'content':_0x20e9ea[_0xfa5e('0xa')],'to':[_0x20e9ea[_0xfa5e('0x20')]],'from':_0x1e54d4[_0xfa5e('0x20')],'binary':![],'clientMessageId':_0xfa5e('0x66'),'charset':_0xfa5e('0x67')},'json':!![]};rp(_0x18d7fd)['then'](function(_0x207c32){if(!_0x207c32[_0xfa5e('0x18')]){var _0x5110cb={'messageId':_0x207c32[_0xfa5e('0x55')][0x0][_0xfa5e('0x68')]};if(!_0x1e54d4[_0xfa5e('0x3a')]){_0x5110cb[_0xfa5e('0x36')]=!![];}return _0x2f528a[_0xfa5e('0x14')](_0x5110cb);}else{return logger[_0xfa5e('0x18')](_0xfa5e('0x25'),_0xfa5e('0x37'),_0xfa5e('0x64'),util['inspect'](_0x207c32[_0xfa5e('0x18')],{'showHidden':![],'depth':null}));}})[_0xfa5e('0x17')](function(_0x4f4f1c){return logger['error'](_0xfa5e('0x25'),_0xfa5e('0x37'),_0xfa5e('0x64'),util[_0xfa5e('0x26')](_0x4f4f1c,{'showHidden':![],'depth':null}));});}else{logger['error'](_0xfa5e('0x25'),_0xfa5e('0x37'),_0xfa5e('0x64'),_0xfa5e('0x63'));}break;case'intelepeer':if(_0x1e54d4[_0xfa5e('0x65')]){var _0x58be5e={};var _0x2b1335={'method':_0xfa5e('0x32'),'uri':_0xfa5e('0x69'),'headers':{'Authorization':_0xfa5e('0x6a')+_0x1e54d4[_0xfa5e('0x65')],'Content-Type':_0xfa5e('0x6b')},'body':{'from':_0x1e54d4[_0xfa5e('0x20')],'to':_0x20e9ea[_0xfa5e('0x20')],'text':_0x20e9ea[_0xfa5e('0xa')]},'json':!![]};return rp(_0x2b1335)[_0xfa5e('0x1b')](function(_0x14c91c){if(_0x14c91c[_0xfa5e('0x6c')]==0xca){_0x58be5e['message']=_0x14c91c;var _0x2c499c={'method':'POST','uri':_0xfa5e('0x6d'),'headers':{'Authorization':_0xfa5e('0x6a')+_0x1e54d4[_0xfa5e('0x65')],'Content-Type':_0xfa5e('0x6b')},'body':{'refid':_0x58be5e['message'][_0xfa5e('0x6e')]},'json':!![]};return rp(_0x2c499c)[_0xfa5e('0x1b')](function(_0x2e0e0f){_0x58be5e[_0xfa5e('0x6f')]=_0x2e0e0f;var _0x34ce37={'messageId':_0x58be5e[_0xfa5e('0x70')][_0xfa5e('0x6e')],'read':!![]};return _0x2f528a[_0xfa5e('0x14')](_0x34ce37);});}else{return logger[_0xfa5e('0x18')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0xfa5e('0x71'),util[_0xfa5e('0x26')](_0x14c91c,{'showHidden':![],'depth':null}));}})[_0xfa5e('0x17')](function(_0xe74f97){return logger[_0xfa5e('0x18')](_0xfa5e('0x25'),'afterCreate',_0xfa5e('0x71'),util[_0xfa5e('0x26')](_0xe74f97,{'showHidden':![],'depth':null}));});}else{return logger[_0xfa5e('0x18')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0xfa5e('0x71'),_0xfa5e('0x72'));}break;}}})[_0xfa5e('0x73')](function(){_0x5dc7ed();});}else{_0x5dc7ed();}}},'charset':_0xfa5e('0x74'),'collate':_0xfa5e('0x75')});}; \ No newline at end of file +var _0xcbee=['queued_count','head','messages','message_id','clickSend','Missing\x20parameters:\x20username,\x20password','plivo','authId','https://api.plivo.com/v1/Account/%s/Message/','message_uuid','infobip','baseUrl','/auth/1/session','/sms/2/text/advanced','application/json','IBSSO\x20','csc','crypto','login','text','timestamp','keys','sort','length','signature=','/external/get/send.php?','id_sms','clickatell','apiKey','https://platform.clickatell.com/messages','uuid','UTF-8','Missing\x20parameters:\x20apiKey','https://api.intelepeer.com/_rest/v4/app/sms/send','code','message','refid','status','intelepeer','Token\x20not\x20received','finally','utf8mb4','utf8mb4_unicode_ci','lodash','moment','path','./smsMessage.attributes','exports','define','SmsMessage','sms_messages','body','FULLTEXT','models','get','direction','toLowerCase','out','isNil','SmsInteraction','findOne','SmsInteractionId','then','update','createdAt','catch','error','secret','SmsAccount','find','SmsAccountId','type','twilio','accountSid','authToken','phone','remote','/api/sms/messages/','/status?token=','token','sid','SmsMessage,\x20%s,\x20%s,\x20%s','inspect','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','skebby','https://api.skebby.it/API/v1.0/REST/','username','password','smsMethod','sender','login?username=','&password=','GET','split','sms','POST','user_key','session_key','total_sent','internal_order_id','deliveryReport','read','afterCreate','https://smsapi.connectel.se/api/send/','requestid','connectel','Missing\x20parameters:\x20authToken','senderString','%s:%s','format','Basic\x20%s','toString','base64','http_code','data'];(function(_0x59c20e,_0x272105){var _0x383b97=function(_0x3400cf){while(--_0x3400cf){_0x59c20e['push'](_0x59c20e['shift']());}};_0x383b97(++_0x272105);}(_0xcbee,0x111));var _0xecbe=function(_0x338d81,_0x289932){_0x338d81=_0x338d81-0x0;var _0x234be9=_0xcbee[_0x338d81];return _0x234be9;};'use strict';var _=require(_0xecbe('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0xecbe('0x1'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xecbe('0x2'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xecbe('0x3'));module[_0xecbe('0x4')]=function(_0x1e3a7c,_0x1fa81f){return _0x1e3a7c[_0xecbe('0x5')](_0xecbe('0x6'),attributes,{'tableName':_0xecbe('0x7'),'paranoid':![],'indexes':[{'name':'messageId','fields':['messageId']},{'name':'fti_sms_messages','fields':[_0xecbe('0x8')],'type':_0xecbe('0x9')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x2dc727,_0x45f57c,_0xd63bd5){var _0x25b518=_0x1e3a7c[_0xecbe('0xa')];var _0x7da942=_0x2dc727[_0xecbe('0xb')]({'plain':!![]});if(_0x7da942[_0xecbe('0xc')][_0xecbe('0xd')]()==='in'||_0x7da942['direction'][_0xecbe('0xd')]()===_0xecbe('0xe')&&!_0x7da942['secret']&&!_[_0xecbe('0xf')](_0x7da942['UserId'])){_0x25b518[_0xecbe('0x10')][_0xecbe('0x11')]({'where':{'id':_0x7da942[_0xecbe('0x12')]}})[_0xecbe('0x13')](function(_0x3d7a54){if(_0x3d7a54){_0x3d7a54[_0xecbe('0x14')]({'lastMsgAt':_0x7da942[_0xecbe('0x15')],'lastMsgDirection':_0x7da942[_0xecbe('0xc')][_0xecbe('0xd')]()});}})[_0xecbe('0x16')](function(_0x217ed1){console[_0xecbe('0x17')](_0x217ed1);});}if(_0x7da942[_0xecbe('0xc')]==='out'&&!_0x7da942[_0xecbe('0x18')]){var _0x178168;_0x25b518[_0xecbe('0x19')][_0xecbe('0x1a')]({'where':{'id':_0x7da942[_0xecbe('0x1b')]},'raw':!![]})['then'](function(_0x24950e){_0x178168=_0x24950e;if(_0x178168&&_0x178168[_0xecbe('0x1c')]){switch(_0x178168[_0xecbe('0x1c')]){case _0xecbe('0x1d'):var _0x1df6dd=require(_0xecbe('0x1d'));if(_0x178168[_0xecbe('0x1e')]&&_0x178168[_0xecbe('0x1f')]&&_0x178168['phone']){var _0x8bcd7f=new _0x1df6dd(_0x178168[_0xecbe('0x1e')],_0x178168[_0xecbe('0x1f')]);_0x8bcd7f['messages']['create']({'body':_0x7da942[_0xecbe('0x8')],'to':_0x7da942[_0xecbe('0x20')],'from':_0x178168[_0xecbe('0x20')],'statusCallback':_0x178168[_0xecbe('0x21')]+_0xecbe('0x22')+_0x7da942['id']+_0xecbe('0x23')+_0x178168[_0xecbe('0x24')]})['then'](function(_0xd6caa4){if(_0xd6caa4[_0xecbe('0x25')]){return _0x2dc727[_0xecbe('0x14')]({'messageId':_0xd6caa4[_0xecbe('0x25')]});}})[_0xecbe('0x16')](function(_0x47bf0d){logger['error'](_0xecbe('0x26'),'afterCreate','twilio',util[_0xecbe('0x27')](_0x47bf0d,{'showHidden':![],'depth':null}));});}else{logger[_0xecbe('0x17')](_0xecbe('0x26'),'afterCreate','twilio',_0xecbe('0x28'));}break;case _0xecbe('0x29'):var _0x3a0d9c=_0xecbe('0x2a');if(_0x178168[_0xecbe('0x2b')]&&_0x178168[_0xecbe('0x2c')]){var _0x8a4dcb={'recipient':[_0x7da942[_0xecbe('0x20')]],'message':_0x7da942['body'],'message_type':_0x178168[_0xecbe('0x2d')]};if(_0x178168[_0xecbe('0x2d')]&&_0x178168[_0xecbe('0x2d')]!=='SI'){_0x8a4dcb[_0xecbe('0x2e')]=_0x178168[_0xecbe('0x20')];}var _0x36bf40={'url':_0x3a0d9c+_0xecbe('0x2f')+_0x178168[_0xecbe('0x2b')]+_0xecbe('0x30')+_0x178168['password'],'method':_0xecbe('0x31')};rp(_0x36bf40)['then'](function(_0x5afdc3){var _0x3b6a38=_0x5afdc3[_0xecbe('0x32')](';');var _0x51b350={'user_key':_0x3b6a38[0x0],'session_key':_0x3b6a38[0x1]};_0x36bf40={'url':_0x3a0d9c+_0xecbe('0x33'),'method':_0xecbe('0x34'),'headers':{'user_key':_0x51b350[_0xecbe('0x35')],'Session_key':_0x51b350[_0xecbe('0x36')]},'json':!![],'body':_0x8a4dcb};return rp(_0x36bf40);})['then'](function(_0x213c5c){if(_0x213c5c[_0xecbe('0x37')]>=0x1){var _0x5d7151={'messageId':_0x213c5c[_0xecbe('0x38')]};if(_0x178168[_0xecbe('0x2d')]!=='GP'||!_0x178168[_0xecbe('0x39')]){_0x5d7151[_0xecbe('0x3a')]=!![];}return _0x2dc727[_0xecbe('0x14')](_0x5d7151);}else{return logger['error'](_0xecbe('0x26'),'afterCreate',_0xecbe('0x29'),util[_0xecbe('0x27')](_0x213c5c,{'showHidden':![],'depth':null}));}})[_0xecbe('0x16')](function(_0x2d2827){return logger[_0xecbe('0x17')](_0xecbe('0x26'),'afterCreate',_0xecbe('0x29'),util[_0xecbe('0x27')](_0x2d2827,{'showHidden':![],'depth':null}));});}else{logger[_0xecbe('0x17')](_0xecbe('0x26'),_0xecbe('0x3b'),_0xecbe('0x29'),'Missing\x20parameters:\x20username,\x20password');}break;case'connectel':if(_0x178168['authToken']){var _0x34f572={'recipient':_0x7da942[_0xecbe('0x20')],'message':_0x7da942[_0xecbe('0x8')],'sender':_0x178168['senderString']||_0x178168[_0xecbe('0x20')],'authorization':_0x178168['authToken']};var _0x45f57c={'method':_0xecbe('0x34'),'uri':_0xecbe('0x3c'),'body':_0x34f572,'json':!![]};rp(_0x45f57c)[_0xecbe('0x13')](function(_0x1fe8cc){var _0x31ceb4={'messageId':_0x1fe8cc[_0xecbe('0x3d')]};if(!_0x178168[_0xecbe('0x39')]){_0x31ceb4[_0xecbe('0x3a')]=!![];}return _0x2dc727[_0xecbe('0x14')](_0x31ceb4);})['catch'](function(_0x29ff91){logger[_0xecbe('0x17')](_0xecbe('0x26'),_0xecbe('0x3b'),_0xecbe('0x3e'),util['inspect'](_0x29ff91,{'showHidden':![],'depth':null}));});}else{logger[_0xecbe('0x17')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xecbe('0x3b'),_0xecbe('0x3e'),_0xecbe('0x3f'));}break;case'clicksend':if(_0x178168['username']&&_0x178168[_0xecbe('0x2c')]){var _0x34f572={'messages':[{'source':'xCALLY\x20Motion','to':_0x7da942['phone'],'body':_0x7da942[_0xecbe('0x8')],'from':_0x178168[_0xecbe('0x40')]||_0x178168[_0xecbe('0x20')]}]};var _0x36dfab=util['format'](_0xecbe('0x41'),_0x178168[_0xecbe('0x2b')],_0x178168[_0xecbe('0x2c')]);var _0x45f57c={'method':_0xecbe('0x34'),'uri':'https://rest.clicksend.com/v3/sms/send','body':_0x34f572,'headers':{'Authorization':util[_0xecbe('0x42')](_0xecbe('0x43'),new Buffer(_0x36dfab)[_0xecbe('0x44')](_0xecbe('0x45')))},'json':!![]};rp(_0x45f57c)[_0xecbe('0x13')](function(_0x4d7813){if(_0x4d7813[_0xecbe('0x46')]>=0xc8&&_0x4d7813[_0xecbe('0x46')]<=0xce){if(_0x4d7813[_0xecbe('0x47')]&&_0x4d7813['data'][_0xecbe('0x48')]>0x0){var _0x140426=_[_0xecbe('0x49')](_0x4d7813[_0xecbe('0x47')][_0xecbe('0x4a')]);var _0x4475fa={'messageId':_0x140426[_0xecbe('0x4b')]};if(!_0x178168[_0xecbe('0x39')]){_0x4475fa['read']=!![];}return _0x2dc727[_0xecbe('0x14')](_0x4475fa);}else{logger[_0xecbe('0x17')](_0xecbe('0x26'),_0xecbe('0x3b'),'clickSend',util['inspect'](_0x4d7813,{'showHidden':![],'depth':null}));}}else{logger[_0xecbe('0x17')](_0xecbe('0x26'),_0xecbe('0x3b'),_0xecbe('0x4c'),util[_0xecbe('0x27')](_0x4d7813,{'showHidden':![],'depth':null}));}})[_0xecbe('0x16')](function(_0x5ef820){logger[_0xecbe('0x17')](_0xecbe('0x26'),_0xecbe('0x3b'),_0xecbe('0x4c'),util[_0xecbe('0x27')](_0x5ef820,{'showHidden':![],'depth':null}));});}else{logger[_0xecbe('0x17')](_0xecbe('0x26'),'afterCreate',_0xecbe('0x4c'),_0xecbe('0x4d'));}break;case _0xecbe('0x4e'):if(_0x178168[_0xecbe('0x4f')]&&_0x178168['authToken']){var _0x34f572={'dst':_0x7da942[_0xecbe('0x20')],'text':_0x7da942[_0xecbe('0x8')],'src':_0x178168['senderString']||_0x178168['phone'],'url':_0x178168['remote']+_0xecbe('0x22')+_0x7da942['id']+_0xecbe('0x23')+_0x178168['token']};var _0x36dfab=util[_0xecbe('0x42')](_0xecbe('0x41'),_0x178168[_0xecbe('0x4f')],_0x178168[_0xecbe('0x1f')]);var _0x45f57c={'method':'POST','uri':util[_0xecbe('0x42')](_0xecbe('0x50'),_0x178168[_0xecbe('0x4f')]),'body':_0x34f572,'headers':{'Authorization':util[_0xecbe('0x42')](_0xecbe('0x43'),new Buffer(_0x36dfab)[_0xecbe('0x44')](_0xecbe('0x45')))},'json':!![]};rp(_0x45f57c)[_0xecbe('0x13')](function(_0x45d4b0){var _0x152499={'messageId':_0x45d4b0[_0xecbe('0x51')][0x0]};return _0x2dc727[_0xecbe('0x14')](_0x152499);})['catch'](function(_0x32a286){logger[_0xecbe('0x17')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xecbe('0x3b'),'plivo',util[_0xecbe('0x27')](_0x32a286,{'showHidden':![],'depth':null}));});}else{logger['error'](_0xecbe('0x26'),'afterCreate',_0xecbe('0x4e'),'Missing\x20parameters:\x20authId,\x20authToken');}break;case _0xecbe('0x52'):if(_0x178168['username']&&_0x178168[_0xecbe('0x2c')]){if(_0x178168[_0xecbe('0x53')]){var _0x4d5a20={'method':_0xecbe('0x34'),'uri':_0x178168['baseUrl']+_0xecbe('0x54'),'body':{'username':_0x178168[_0xecbe('0x2b')],'password':_0x178168[_0xecbe('0x2c')]},'json':!![]};return rp(_0x4d5a20)[_0xecbe('0x13')](function(_0x21d509){var _0xf20463={'method':_0xecbe('0x34'),'uri':_0x178168[_0xecbe('0x53')]+_0xecbe('0x55'),'body':{'messages':[{'from':_0x178168[_0xecbe('0x20')],'destinations':[{'to':_0x7da942[_0xecbe('0x20')]}],'text':_0x7da942[_0xecbe('0x8')],'notifyUrl':_0x178168[_0xecbe('0x21')]+_0xecbe('0x22')+_0x7da942['id']+_0xecbe('0x23')+_0x178168[_0xecbe('0x24')],'notifyContentType':_0xecbe('0x56'),'callbackData':_0x178168[_0xecbe('0x20')]+';'+_0x7da942[_0xecbe('0x8')]}]},'headers':{'Authorization':_0xecbe('0x57')+_0x21d509[_0xecbe('0x24')]},'json':!![]};return rp(_0xf20463)[_0xecbe('0x13')](function(_0x39e16a){if(_0x39e16a[_0xecbe('0x4a')]){var _0x650e91={'messageId':_0x39e16a[_0xecbe('0x4a')][0x0]['messageId']};if(!_0x178168[_0xecbe('0x39')]){_0x650e91[_0xecbe('0x3a')]=!![];}return _0x2dc727[_0xecbe('0x14')](_0x650e91);}else{return logger[_0xecbe('0x17')](_0xecbe('0x26'),_0xecbe('0x3b'),_0xecbe('0x52'),util['inspect'](_0x39e16a,{'showHidden':![],'depth':null}));}});})[_0xecbe('0x16')](function(_0x1104dc){return logger[_0xecbe('0x17')](_0xecbe('0x26'),'afterCreate',_0xecbe('0x52'),util[_0xecbe('0x27')](_0x1104dc,{'showHidden':![],'depth':null}));});}else{logger['error'](_0xecbe('0x26'),_0xecbe('0x3b'),_0xecbe('0x52'),'Missing\x20parameters:\x20base_url');}}else{logger[_0xecbe('0x17')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xecbe('0x3b'),_0xecbe('0x52'),_0xecbe('0x4d'));}break;case _0xecbe('0x58'):var _0x21da55=require(_0xecbe('0x59'));if(_0x178168['apiKey']){var _0x4a2975={};_0x4a2975[_0xecbe('0x5a')]=_0x178168[_0xecbe('0x2b')];_0x4a2975[_0xecbe('0x20')]=_0x7da942[_0xecbe('0x20')];_0x4a2975['sender']=_0x178168[_0xecbe('0x20')];_0x4a2975[_0xecbe('0x5b')]=_0x7da942[_0xecbe('0x8')];_0x4a2975[_0xecbe('0x5c')]=+new Date();var _0x805c3f='';var _0x4c186b='';var _0x47f727=Object[_0xecbe('0x5d')](_0x4a2975);_0x47f727[_0xecbe('0x5e')]();for(var _0x388967=0x0;_0x388967<_0x47f727[_0xecbe('0x5f')];_0x388967++){if(_0x805c3f!=''){_0x805c3f+='&';}_0x805c3f+=_0x47f727[_0x388967]+'='+encodeURIComponent(_0x4a2975[_0x47f727[_0x388967]]);_0x4c186b+=_0x4a2975[_0x47f727[_0x388967]];}_0x4c186b+=_0x178168['apiKey'];_0x4c186b=_0x21da55['createHash']('md5')[_0xecbe('0x14')](_0x4c186b)['digest']('hex');if(_0x805c3f!==''){_0x805c3f+='&';}_0x805c3f+=_0xecbe('0x60')+_0x4c186b;var _0x36bf40={'method':'GET','uri':_0x178168[_0xecbe('0x53')]+_0xecbe('0x61')+_0x805c3f,'json':!![]};return rp(_0x36bf40)['then'](function(_0x29ef1b){var _0x143ace=Object[_0xecbe('0x5d')](_0x29ef1b);if(_0x29ef1b[_0x143ace[0x0]]['error']&&parseInt(_0x29ef1b[_0x143ace[0x0]][_0xecbe('0x17')])===0x0){var _0x2e2862={'messageId':_0x29ef1b[_0x143ace[0x0]][_0xecbe('0x62')]};if(!_0x178168[_0xecbe('0x39')]){_0x2e2862[_0xecbe('0x3a')]=!![];}return _0x2dc727[_0xecbe('0x14')](_0x2e2862);}else{return logger[_0xecbe('0x17')](_0xecbe('0x26'),_0xecbe('0x3b'),_0xecbe('0x58'),util[_0xecbe('0x27')](_0x29ef1b['error'],{'showHidden':![],'depth':null}));}})[_0xecbe('0x16')](function(_0x44e47d){return logger[_0xecbe('0x17')](_0xecbe('0x26'),'afterCreate',_0xecbe('0x58'),util[_0xecbe('0x27')](_0x44e47d,{'showHidden':![],'depth':null}));});}else{logger[_0xecbe('0x17')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xecbe('0x3b'),_0xecbe('0x58'),'Missing\x20parameters:\x20apiKey');}break;case _0xecbe('0x63'):if(_0x178168[_0xecbe('0x64')]){var _0x4fbd74={'method':_0xecbe('0x34'),'uri':_0xecbe('0x65'),'headers':{'Authorization':_0x178168[_0xecbe('0x64')]},'body':{'content':_0x7da942['body'],'to':[_0x7da942[_0xecbe('0x20')]],'from':_0x178168['phone'],'binary':![],'clientMessageId':_0xecbe('0x66'),'charset':_0xecbe('0x67')},'json':!![]};rp(_0x4fbd74)[_0xecbe('0x13')](function(_0x319855){if(!_0x319855[_0xecbe('0x17')]){var _0x15fe24={'messageId':_0x319855[_0xecbe('0x4a')][0x0]['apiMessageId']};if(!_0x178168[_0xecbe('0x39')]){_0x15fe24[_0xecbe('0x3a')]=!![];}return _0x2dc727[_0xecbe('0x14')](_0x15fe24);}else{return logger['error'](_0xecbe('0x26'),'afterCreate','clickatell',util[_0xecbe('0x27')](_0x319855[_0xecbe('0x17')],{'showHidden':![],'depth':null}));}})['catch'](function(_0x58b06a){return logger[_0xecbe('0x17')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xecbe('0x3b'),_0xecbe('0x63'),util[_0xecbe('0x27')](_0x58b06a,{'showHidden':![],'depth':null}));});}else{logger[_0xecbe('0x17')](_0xecbe('0x26'),_0xecbe('0x3b'),'clickatell',_0xecbe('0x68'));}break;case'intelepeer':if(_0x178168[_0xecbe('0x64')]){var _0x4f274b={};var _0x36bf40={'method':_0xecbe('0x34'),'uri':_0xecbe('0x69'),'headers':{'Authorization':'Bearer\x20'+_0x178168[_0xecbe('0x64')],'Content-Type':_0xecbe('0x56')},'body':{'from':_0x178168[_0xecbe('0x20')],'to':_0x7da942[_0xecbe('0x20')],'text':_0x7da942[_0xecbe('0x8')]},'json':!![]};return rp(_0x36bf40)[_0xecbe('0x13')](function(_0x1070e7){if(_0x1070e7[_0xecbe('0x6a')]==0xca){_0x4f274b[_0xecbe('0x6b')]=_0x1070e7;var _0x4c043a={'method':_0xecbe('0x34'),'uri':'https://api.intelepeer.com/_rest/v4/app/sms/mdr','headers':{'Authorization':'Bearer\x20'+_0x178168[_0xecbe('0x64')],'Content-Type':_0xecbe('0x56')},'body':{'refid':_0x4f274b[_0xecbe('0x6b')][_0xecbe('0x6c')]},'json':!![]};return rp(_0x4c043a)['then'](function(_0x281882){_0x4f274b[_0xecbe('0x6d')]=_0x281882;var _0x376013={'messageId':_0x4f274b[_0xecbe('0x6b')][_0xecbe('0x6c')],'read':!![]};return _0x2dc727[_0xecbe('0x14')](_0x376013);});}else{return logger[_0xecbe('0x17')](_0xecbe('0x26'),_0xecbe('0x3b'),_0xecbe('0x6e'),util['inspect'](_0x1070e7,{'showHidden':![],'depth':null}));}})['catch'](function(_0x4ab173){return logger[_0xecbe('0x17')](_0xecbe('0x26'),_0xecbe('0x3b'),'intelepeer',util[_0xecbe('0x27')](_0x4ab173,{'showHidden':![],'depth':null}));});}else{return logger[_0xecbe('0x17')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xecbe('0x3b'),_0xecbe('0x6e'),_0xecbe('0x6f'));}break;}}})[_0xecbe('0x70')](function(){_0xd63bd5();});}else{_0xd63bd5();}}},'charset':_0xecbe('0x71'),'collate':_0xecbe('0x72')});}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.rpc.js b/server/api/smsMessage/smsMessage.rpc.js index 3dde307..e44bac0 100644 --- a/server/api/smsMessage/smsMessage.rpc.js +++ b/server/api/smsMessage/smsMessage.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5f2f=['SmsMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','SmsMessage','create','options','raw','CreateSmsMessage','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','register','then','SmsMessage,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x51c41b,_0x47759f){var _0x42968c=function(_0x7793aa){while(--_0x7793aa){_0x51c41b['push'](_0x51c41b['shift']());}};_0x42968c(++_0x47759f);}(_0x5f2f,0x73));var _0xf5f2=function(_0x348bd3,_0x16c57d){_0x348bd3=_0x348bd3-0x0;var _0x3de464=_0x5f2f[_0x348bd3];return _0x3de464;};'use strict';var _=require(_0xf5f2('0x0'));var util=require(_0xf5f2('0x1'));var moment=require(_0xf5f2('0x2'));var BPromise=require(_0xf5f2('0x3'));var rs=require(_0xf5f2('0x4'));var fs=require('fs');var Redis=require(_0xf5f2('0x5'));var db=require(_0xf5f2('0x6'))['db'];var utils=require(_0xf5f2('0x7'));var logger=require('../../config/logger')('rpc');var config=require(_0xf5f2('0x8'));var jayson=require(_0xf5f2('0x9'));var client=jayson[_0xf5f2('0xa')][_0xf5f2('0xb')]({'port':0x232a});config[_0xf5f2('0xc')]=_[_0xf5f2('0xd')](config['redis'],{'host':_0xf5f2('0xe'),'port':0x18eb});var socket=require(_0xf5f2('0xf'))(new Redis(config[_0xf5f2('0xc')]));require('./smsMessage.socket')[_0xf5f2('0x10')](socket);function respondWithRpcPromise(_0x15dd7c,_0x218ae3,_0x4e0e6b){return new BPromise(function(_0x977a59,_0x4ebbbe){return client['request'](_0x15dd7c,_0x4e0e6b)[_0xf5f2('0x11')](function(_0x151aba){logger['info'](_0xf5f2('0x12'),_0x218ae3,_0xf5f2('0x13'));logger[_0xf5f2('0x14')](_0xf5f2('0x15'),_0x218ae3,_0xf5f2('0x13'),JSON[_0xf5f2('0x16')](_0x151aba));if(_0x151aba['error']){if(_0x151aba[_0xf5f2('0x17')][_0xf5f2('0x18')]===0x1f4){logger[_0xf5f2('0x17')](_0xf5f2('0x12'),_0x218ae3,_0x151aba[_0xf5f2('0x17')]['message']);return _0x4ebbbe(_0x151aba[_0xf5f2('0x17')][_0xf5f2('0x19')]);}logger[_0xf5f2('0x17')](_0xf5f2('0x12'),_0x218ae3,_0x151aba[_0xf5f2('0x17')][_0xf5f2('0x19')]);return _0x977a59(_0x151aba[_0xf5f2('0x17')][_0xf5f2('0x19')]);}else{logger[_0xf5f2('0x1a')](_0xf5f2('0x12'),_0x218ae3,_0xf5f2('0x13'));_0x977a59(_0x151aba[_0xf5f2('0x1b')][_0xf5f2('0x19')]);}})[_0xf5f2('0x1c')](function(_0x3cf5ea){logger[_0xf5f2('0x17')](_0xf5f2('0x12'),_0x218ae3,_0x3cf5ea);_0x4ebbbe(_0x3cf5ea);});});}exports['CreateSmsMessage']=function(_0x34706d){var _0x47101e=this;return new Promise(function(_0x49dac2,_0x47acfc){return db[_0xf5f2('0x1d')][_0xf5f2('0x1e')](_0x34706d['body'],{'raw':_0x34706d[_0xf5f2('0x1f')]?_0x34706d[_0xf5f2('0x1f')][_0xf5f2('0x20')]===undefined?!![]:![]:!![]})[_0xf5f2('0x11')](function(_0x36f1cb){logger['info'](_0xf5f2('0x21'),_0x34706d);logger[_0xf5f2('0x14')](_0xf5f2('0x21'),_0x34706d,JSON[_0xf5f2('0x16')](_0x36f1cb));_0x49dac2(_0x36f1cb);})[_0xf5f2('0x1c')](function(_0x5bdf4a){logger['error'](_0xf5f2('0x21'),_0x5bdf4a[_0xf5f2('0x19')],_0x34706d);_0x47acfc(_0x47101e[_0xf5f2('0x17')](0x1f4,_0x5bdf4a[_0xf5f2('0x19')]));});});}; \ No newline at end of file +var _0x8603=['../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','redis','defaults','./smsMessage.socket','register','request','info','request\x20sent','debug','SmsMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','SmsMessage,\x20%s,\x20%s','message','catch','CreateSmsMessage','SmsMessage','create','body','options','raw','then','util','moment','bluebird'];(function(_0x1b2d1e,_0x5d0f38){var _0x4cfc8e=function(_0x2b414e){while(--_0x2b414e){_0x1b2d1e['push'](_0x1b2d1e['shift']());}};_0x4cfc8e(++_0x5d0f38);}(_0x8603,0x190));var _0x3860=function(_0x5240b7,_0x2d7ea2){_0x5240b7=_0x5240b7-0x0;var _0x3b57b2=_0x8603[_0x5240b7];return _0x3b57b2;};'use strict';var _=require('lodash');var util=require(_0x3860('0x0'));var moment=require(_0x3860('0x1'));var BPromise=require(_0x3860('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x3860('0x3'))['db'];var utils=require(_0x3860('0x4'));var logger=require(_0x3860('0x5'))('rpc');var config=require(_0x3860('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x3860('0x7')][_0x3860('0x8')]({'port':0x232a});config[_0x3860('0x9')]=_[_0x3860('0xa')](config[_0x3860('0x9')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x3860('0xb'))[_0x3860('0xc')](socket);function respondWithRpcPromise(_0x52c277,_0x2fb169,_0x38737e){return new BPromise(function(_0x5909b8,_0x101263){return client[_0x3860('0xd')](_0x52c277,_0x38737e)['then'](function(_0x365579){logger[_0x3860('0xe')]('SmsMessage,\x20%s,\x20%s',_0x2fb169,_0x3860('0xf'));logger[_0x3860('0x10')](_0x3860('0x11'),_0x2fb169,_0x3860('0xf'),JSON[_0x3860('0x12')](_0x365579));if(_0x365579[_0x3860('0x13')]){if(_0x365579[_0x3860('0x13')][_0x3860('0x14')]===0x1f4){logger[_0x3860('0x13')](_0x3860('0x15'),_0x2fb169,_0x365579['error'][_0x3860('0x16')]);return _0x101263(_0x365579[_0x3860('0x13')][_0x3860('0x16')]);}logger[_0x3860('0x13')](_0x3860('0x15'),_0x2fb169,_0x365579[_0x3860('0x13')][_0x3860('0x16')]);return _0x5909b8(_0x365579[_0x3860('0x13')][_0x3860('0x16')]);}else{logger[_0x3860('0xe')](_0x3860('0x15'),_0x2fb169,_0x3860('0xf'));_0x5909b8(_0x365579['result']['message']);}})[_0x3860('0x17')](function(_0x41ce59){logger[_0x3860('0x13')]('SmsMessage,\x20%s,\x20%s',_0x2fb169,_0x41ce59);_0x101263(_0x41ce59);});});}exports[_0x3860('0x18')]=function(_0x145b26){var _0x22e873=this;return new Promise(function(_0x3af33a,_0x20a5b0){return db[_0x3860('0x19')][_0x3860('0x1a')](_0x145b26[_0x3860('0x1b')],{'raw':_0x145b26[_0x3860('0x1c')]?_0x145b26[_0x3860('0x1c')][_0x3860('0x1d')]===undefined?!![]:![]:!![]})[_0x3860('0x1e')](function(_0x280ea9){logger[_0x3860('0xe')](_0x3860('0x18'),_0x145b26);logger['debug'](_0x3860('0x18'),_0x145b26,JSON[_0x3860('0x12')](_0x280ea9));_0x3af33a(_0x280ea9);})[_0x3860('0x17')](function(_0x301e03){logger[_0x3860('0x13')]('CreateSmsMessage',_0x301e03[_0x3860('0x16')],_0x145b26);_0x20a5b0(_0x22e873['error'](0x1f4,_0x301e03['message']));});});}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.socket.js b/server/api/smsMessage/smsMessage.socket.js index 7b3eb65..fdc8d1e 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 _0x73da=['removeListener','smsMessage:','./smsMessage.events','update'];(function(_0x1f88f0,_0x2dc0ac){var _0x3684f5=function(_0x2f5efd){while(--_0x2f5efd){_0x1f88f0['push'](_0x1f88f0['shift']());}};_0x3684f5(++_0x2dc0ac);}(_0x73da,0x162));var _0xa73d=function(_0xb60ae4,_0x48b458){_0xb60ae4=_0xb60ae4-0x0;var _0x53d530=_0x73da[_0xb60ae4];return _0x53d530;};'use strict';var SmsMessageEvents=require(_0xa73d('0x0'));var events=['save','remove',_0xa73d('0x1')];function createListener(_0x173e97,_0x890a76){return function(_0x499554){_0x890a76['emit'](_0x173e97,_0x499554);};}function removeListener(_0xe13907,_0x5c2404){return function(){SmsMessageEvents[_0xa73d('0x2')](_0xe13907,_0x5c2404);};}exports['register']=function(_0x5ff3a5){for(var _0x29bd53=0x0,_0x54dc15=events['length'];_0x29bd53<_0x54dc15;_0x29bd53++){var _0x2b5340=events[_0x29bd53];var _0x10402c=createListener(_0xa73d('0x3')+_0x2b5340,_0x5ff3a5);SmsMessageEvents['on'](_0x2b5340,_0x10402c);}}; \ No newline at end of file +var _0xbf18=['emit','removeListener','register','length','smsMessage:','./smsMessage.events','save'];(function(_0x224f65,_0x4750bf){var _0x3f921c=function(_0x1b5f64){while(--_0x1b5f64){_0x224f65['push'](_0x224f65['shift']());}};_0x3f921c(++_0x4750bf);}(_0xbf18,0x91));var _0x8bf1=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xbf18[_0x3dd15e];return _0x231fd0;};'use strict';var SmsMessageEvents=require(_0x8bf1('0x0'));var events=[_0x8bf1('0x1'),'remove','update'];function createListener(_0x4bc3f6,_0x328461){return function(_0x3d7621){_0x328461[_0x8bf1('0x2')](_0x4bc3f6,_0x3d7621);};}function removeListener(_0x5455aa,_0x5e32de){return function(){SmsMessageEvents[_0x8bf1('0x3')](_0x5455aa,_0x5e32de);};}exports[_0x8bf1('0x4')]=function(_0xb02f04){for(var _0x24bb74=0x0,_0x32a60e=events[_0x8bf1('0x5')];_0x24bb74<_0x32a60e;_0x24bb74++){var _0x4668e1=events[_0x24bb74];var _0x45f2c2=createListener(_0x8bf1('0x6')+_0x4668e1,_0xb02f04);SmsMessageEvents['on'](_0x4668e1,_0x45f2c2);}}; \ No newline at end of file diff --git a/server/api/smsQueue/index.js b/server/api/smsQueue/index.js index f209883..568610c 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 _0xe9e7=['isAuthenticated','show','/:id/members','getMembers','/:id/teams','getTeams','post','create','addTeams','/:id/users','addAgents','put','update','destroy','delete','removeTeams','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsQueue.controller','get','index','/describe','describe','/:id'];(function(_0x5625d9,_0x523598){var _0x186314=function(_0x37d849){while(--_0x37d849){_0x5625d9['push'](_0x5625d9['shift']());}};_0x186314(++_0x523598);}(_0xe9e7,0x1f0));var _0x7e9e=function(_0x4a0580,_0x25ff1b){_0x4a0580=_0x4a0580-0x0;var _0x2e6ff5=_0xe9e7[_0x4a0580];return _0x2e6ff5;};'use strict';var multer=require(_0x7e9e('0x0'));var util=require(_0x7e9e('0x1'));var path=require(_0x7e9e('0x2'));var timeout=require('connect-timeout');var express=require(_0x7e9e('0x3'));var router=express[_0x7e9e('0x4')]();var auth=require(_0x7e9e('0x5'));var interaction=require(_0x7e9e('0x6'));var config=require(_0x7e9e('0x7'));var controller=require(_0x7e9e('0x8'));router[_0x7e9e('0x9')]('/',auth['isAuthenticated'](),controller[_0x7e9e('0xa')]);router[_0x7e9e('0x9')](_0x7e9e('0xb'),auth['isAuthenticated'](),controller[_0x7e9e('0xc')]);router['get'](_0x7e9e('0xd'),auth[_0x7e9e('0xe')](),controller[_0x7e9e('0xf')]);router[_0x7e9e('0x9')](_0x7e9e('0x10'),auth[_0x7e9e('0xe')](),controller[_0x7e9e('0x11')]);router[_0x7e9e('0x9')](_0x7e9e('0x12'),auth[_0x7e9e('0xe')](),controller[_0x7e9e('0x13')]);router[_0x7e9e('0x9')]('/:id/users',auth['isAuthenticated'](),controller['getAgents']);router[_0x7e9e('0x14')]('/',auth[_0x7e9e('0xe')](),controller[_0x7e9e('0x15')]);router[_0x7e9e('0x14')]('/:id/teams',auth['isAuthenticated'](),controller[_0x7e9e('0x16')]);router[_0x7e9e('0x14')](_0x7e9e('0x17'),auth[_0x7e9e('0xe')](),controller[_0x7e9e('0x18')]);router[_0x7e9e('0x19')](_0x7e9e('0xd'),auth['isAuthenticated'](),controller[_0x7e9e('0x1a')]);router['delete'](_0x7e9e('0xd'),auth[_0x7e9e('0xe')](),controller[_0x7e9e('0x1b')]);router[_0x7e9e('0x1c')](_0x7e9e('0x12'),auth[_0x7e9e('0xe')](),controller[_0x7e9e('0x1d')]);router['delete'](_0x7e9e('0x17'),auth[_0x7e9e('0xe')](),controller['removeAgents']);module['exports']=router; \ No newline at end of file +var _0x9c48=['util','path','express','Router','../../components/auth/service','./smsQueue.controller','get','index','/describe','isAuthenticated','describe','/:id','show','/:id/members','getMembers','/:id/teams','getTeams','/:id/users','create','post','addTeams','addAgents','put','delete','removeTeams','exports','multer'];(function(_0x2ff762,_0x342c0b){var _0x158b02=function(_0x13c38e){while(--_0x13c38e){_0x2ff762['push'](_0x2ff762['shift']());}};_0x158b02(++_0x342c0b);}(_0x9c48,0xa1));var _0x89c4=function(_0x23f654,_0x38e808){_0x23f654=_0x23f654-0x0;var _0x4b9ef1=_0x9c48[_0x23f654];return _0x4b9ef1;};'use strict';var multer=require(_0x89c4('0x0'));var util=require(_0x89c4('0x1'));var path=require(_0x89c4('0x2'));var timeout=require('connect-timeout');var express=require(_0x89c4('0x3'));var router=express[_0x89c4('0x4')]();var auth=require(_0x89c4('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x89c4('0x6'));router[_0x89c4('0x7')]('/',auth['isAuthenticated'](),controller[_0x89c4('0x8')]);router[_0x89c4('0x7')](_0x89c4('0x9'),auth[_0x89c4('0xa')](),controller[_0x89c4('0xb')]);router[_0x89c4('0x7')](_0x89c4('0xc'),auth[_0x89c4('0xa')](),controller[_0x89c4('0xd')]);router[_0x89c4('0x7')](_0x89c4('0xe'),auth[_0x89c4('0xa')](),controller[_0x89c4('0xf')]);router[_0x89c4('0x7')](_0x89c4('0x10'),auth[_0x89c4('0xa')](),controller[_0x89c4('0x11')]);router[_0x89c4('0x7')](_0x89c4('0x12'),auth[_0x89c4('0xa')](),controller['getAgents']);router['post']('/',auth['isAuthenticated'](),controller[_0x89c4('0x13')]);router[_0x89c4('0x14')](_0x89c4('0x10'),auth[_0x89c4('0xa')](),controller[_0x89c4('0x15')]);router[_0x89c4('0x14')](_0x89c4('0x12'),auth['isAuthenticated'](),controller[_0x89c4('0x16')]);router[_0x89c4('0x17')](_0x89c4('0xc'),auth[_0x89c4('0xa')](),controller['update']);router[_0x89c4('0x18')](_0x89c4('0xc'),auth[_0x89c4('0xa')](),controller['destroy']);router[_0x89c4('0x18')]('/:id/teams',auth[_0x89c4('0xa')](),controller[_0x89c4('0x19')]);router['delete'](_0x89c4('0x12'),auth['isAuthenticated'](),controller['removeAgents']);module[_0x89c4('0x1a')]=router; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.attributes.js b/server/api/smsQueue/smsQueue.attributes.js index 126f157..1293864 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 _0xd370=['exports','STRING','name','INTEGER','ENUM','rrmemory','beepall','roundrobin','sequelize'];(function(_0x45b05a,_0x2ef2ba){var _0x1780d7=function(_0x4ee174){while(--_0x4ee174){_0x45b05a['push'](_0x45b05a['shift']());}};_0x1780d7(++_0x2ef2ba);}(_0xd370,0x1d3));var _0x0d37=function(_0x528575,_0x2e067d){_0x528575=_0x528575-0x0;var _0x3063b7=_0xd370[_0x528575];return _0x3063b7;};'use strict';var Sequelize=require(_0x0d37('0x0'));module[_0x0d37('0x1')]={'name':{'type':Sequelize[_0x0d37('0x2')],'unique':_0x0d37('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x0d37('0x2')]},'timeout':{'type':Sequelize[_0x0d37('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x0d37('0x5')](_0x0d37('0x6'),_0x0d37('0x7'),_0x0d37('0x8'))}}; \ No newline at end of file +var _0xa0f6=['INTEGER','ENUM','rrmemory','roundrobin','sequelize','exports','name','STRING'];(function(_0x37f3e0,_0x4803f1){var _0x190c51=function(_0x28815c){while(--_0x28815c){_0x37f3e0['push'](_0x37f3e0['shift']());}};_0x190c51(++_0x4803f1);}(_0xa0f6,0xd4));var _0x6a0f=function(_0x434d9e,_0x564e85){_0x434d9e=_0x434d9e-0x0;var _0x33de23=_0xa0f6[_0x434d9e];return _0x33de23;};'use strict';var Sequelize=require(_0x6a0f('0x0'));module[_0x6a0f('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0x6a0f('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x6a0f('0x3')]},'timeout':{'type':Sequelize[_0x6a0f('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x6a0f('0x5')](_0x6a0f('0x6'),'beepall',_0x6a0f('0x7'))}}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.controller.js b/server/api/smsQueue/smsQueue.controller.js index 77ab5ee..c948c89 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 _0x5f8f=['../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','redis','defaults','localhost','./smsQueue.socket','register','sendStatus','status','end','count','offset','limit','set','Content-Range','json','apply','reject','save','update','destroy','then','get','SmsQueues','name','index','map','SmsQueue','rawAttributes','fieldName','type','key','query','filters','model','attributes','intersection','fields','order','sort','where','pick','filter','merge','options','includeAll','include','findAll','rows','catch','show','params','keys','length','find','create','body','user','role','UserProfileSection','userProfileId','UserProfileResource','describe','getMembers','UserSmsQueue','hasOwnProperty','nolimit','SmsQueueId','User','agent','updatedAt','createdAt','format','%s/%s','SIP','smsPause','getTeams','findOne','Team','addTeams','ids','Agents','online','voicePause','interface','flatMap','sequelize','forEach','emit','userSmsQueue:save','removeTeams','select','field','tq.TeamId','from','team_has_sms_queues','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','SmsQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','QueryTypes','every','TeamId','all','compact','transaction','isEmpty','removeAgents','userSmsQueue:remove','addAgents','omit','isArray','getAgents','html-pdf','eml-format','request-promise','moment','bluebird','mustache','path','ejs','lodash','jsforce','desk.js','querystring','ioredis','../../components/auth/service'];(function(_0x39e283,_0x247e6b){var _0x7de89f=function(_0x2f8c50){while(--_0x2f8c50){_0x39e283['push'](_0x39e283['shift']());}};_0x7de89f(++_0x247e6b);}(_0x5f8f,0x17b));var _0xf5f8=function(_0x17a78c,_0xbb7874){_0x17a78c=_0x17a78c-0x0;var _0x36a282=_0x5f8f[_0x17a78c];return _0x36a282;};'use strict';var pdf=require(_0xf5f8('0x0'));var emlformat=require(_0xf5f8('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xf5f8('0x2'));var moment=require(_0xf5f8('0x3'));var BPromise=require(_0xf5f8('0x4'));var Mustache=require(_0xf5f8('0x5'));var util=require('util');var path=require(_0xf5f8('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xf5f8('0x7'));var fs=require('fs');var _=require(_0xf5f8('0x8'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xf5f8('0x9'));var deskjs=require(_0xf5f8('0xa'));var toCsv=require('to-csv');var querystring=require(_0xf5f8('0xb'));var Papa=require('papaparse');var Redis=require(_0xf5f8('0xc'));var authService=require(_0xf5f8('0xd'));var qs=require(_0xf5f8('0xe'));var as=require(_0xf5f8('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xf5f8('0x10'))(_0xf5f8('0x11'));var utils=require('../../config/utils');var config=require(_0xf5f8('0x12'));var db=require('../../mysqldb')['db'];config[_0xf5f8('0x13')]=_[_0xf5f8('0x14')](config[_0xf5f8('0x13')],{'host':_0xf5f8('0x15'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xf5f8('0x13')]));require(_0xf5f8('0x16'))[_0xf5f8('0x17')](socket);function respondWithStatusCode(_0x5609bf,_0x4a55c1){_0x4a55c1=_0x4a55c1||0xcc;return function(_0x1ac4d4){if(_0x1ac4d4){return _0x5609bf[_0xf5f8('0x18')](_0x4a55c1);}return _0x5609bf[_0xf5f8('0x19')](_0x4a55c1)[_0xf5f8('0x1a')]();};}function respondWithResult(_0x264d21,_0x4213d1){_0x4213d1=_0x4213d1||0xc8;return function(_0x11e040){if(_0x11e040){return _0x264d21[_0xf5f8('0x19')](_0x4213d1)['json'](_0x11e040);}};}function respondWithFilteredResult(_0x2db773,_0x59dfd2){return function(_0x772ade){if(_0x772ade){var _0x55e53e=_0x772ade[_0xf5f8('0x1b')],_0x5ecec7=_0x59dfd2[_0xf5f8('0x1c')],_0x573cbd=_0x59dfd2[_0xf5f8('0x1c')]+_0x59dfd2[_0xf5f8('0x1d')],_0x1a6aeb;if(_0x573cbd>=_0x55e53e){_0x573cbd=_0x55e53e;_0x1a6aeb=0xc8;}else{_0x1a6aeb=0xce;}_0x2db773[_0xf5f8('0x19')](_0x1a6aeb);return _0x2db773[_0xf5f8('0x1e')](_0xf5f8('0x1f'),_0x5ecec7+'-'+_0x573cbd+'/'+_0x55e53e)[_0xf5f8('0x20')](_0x772ade);}return null;};}function patchUpdates(_0x1d5de5){return function(_0x5ad1ea){try{jsonpatch[_0xf5f8('0x21')](_0x5ad1ea,_0x1d5de5,!![]);}catch(_0x4e55e9){return BPromise[_0xf5f8('0x22')](_0x4e55e9);}return _0x5ad1ea[_0xf5f8('0x23')]();};}function saveUpdates(_0x550cee,_0x1efc05){return function(_0x115721){if(_0x115721){return _0x115721[_0xf5f8('0x24')](_0x550cee)['then'](function(_0x44d055){return _0x44d055;});}return null;};}function removeEntity(_0x403d74,_0x3b97e3){return function(_0x4a93cd){if(_0x4a93cd){return _0x4a93cd[_0xf5f8('0x25')]()[_0xf5f8('0x26')](function(){var _0x1741a6=_0x4a93cd[_0xf5f8('0x27')]({'plain':!![]});var _0xf168ba=_0xf5f8('0x28');return db['UserProfileResource'][_0xf5f8('0x25')]({'where':{'type':_0xf168ba,'resourceId':_0x1741a6['id']}})[_0xf5f8('0x26')](function(){return _0x4a93cd;});})[_0xf5f8('0x26')](function(){_0x403d74[_0xf5f8('0x19')](0xcc)[_0xf5f8('0x1a')]();});}};}function handleEntityNotFound(_0x4889f7,_0x149b6e){return function(_0x1e96bd){if(!_0x1e96bd){_0x4889f7[_0xf5f8('0x18')](0x194);}return _0x1e96bd;};}function handleError(_0x5719ce,_0x5e321f){_0x5e321f=_0x5e321f||0x1f4;return function(_0x1dfde6){logger['error'](_0x1dfde6['stack']);if(_0x1dfde6[_0xf5f8('0x29')]){delete _0x1dfde6[_0xf5f8('0x29')];}_0x5719ce['status'](_0x5e321f)['send'](_0x1dfde6);};}exports[_0xf5f8('0x2a')]=function(_0x3975a1,_0x1be80e){var _0x27bf48={},_0x4119cf={},_0x42c69d={'count':0x0,'rows':[]};var _0x41dc06=_[_0xf5f8('0x2b')](db[_0xf5f8('0x2c')][_0xf5f8('0x2d')],function(_0x12b676){return{'name':_0x12b676[_0xf5f8('0x2e')],'type':_0x12b676[_0xf5f8('0x2f')][_0xf5f8('0x30')]};});_0x4119cf['model']=_[_0xf5f8('0x2b')](_0x41dc06,'name');_0x4119cf[_0xf5f8('0x31')]=_['keys'](_0x3975a1[_0xf5f8('0x31')]);_0x4119cf[_0xf5f8('0x32')]=_['intersection'](_0x4119cf[_0xf5f8('0x33')],_0x4119cf[_0xf5f8('0x31')]);_0x27bf48[_0xf5f8('0x34')]=_[_0xf5f8('0x35')](_0x4119cf[_0xf5f8('0x33')],qs['fields'](_0x3975a1[_0xf5f8('0x31')][_0xf5f8('0x36')]));_0x27bf48['attributes']=_0x27bf48[_0xf5f8('0x34')]['length']?_0x27bf48[_0xf5f8('0x34')]:_0x4119cf[_0xf5f8('0x33')];if(!_0x3975a1[_0xf5f8('0x31')]['hasOwnProperty']('nolimit')){_0x27bf48[_0xf5f8('0x1d')]=qs[_0xf5f8('0x1d')](_0x3975a1[_0xf5f8('0x31')][_0xf5f8('0x1d')]);_0x27bf48['offset']=qs[_0xf5f8('0x1c')](_0x3975a1[_0xf5f8('0x31')][_0xf5f8('0x1c')]);}_0x27bf48[_0xf5f8('0x37')]=qs[_0xf5f8('0x38')](_0x3975a1[_0xf5f8('0x31')][_0xf5f8('0x38')]);_0x27bf48[_0xf5f8('0x39')]=qs[_0xf5f8('0x32')](_[_0xf5f8('0x3a')](_0x3975a1[_0xf5f8('0x31')],_0x4119cf[_0xf5f8('0x32')]),_0x41dc06);if(_0x3975a1[_0xf5f8('0x31')][_0xf5f8('0x3b')]){_0x27bf48[_0xf5f8('0x39')]=_[_0xf5f8('0x3c')](_0x27bf48['where'],{'$or':_[_0xf5f8('0x2b')](_0x41dc06,function(_0x56c539){if(_0x56c539[_0xf5f8('0x2f')]!=='VIRTUAL'){var _0x36e6cc={};_0x36e6cc[_0x56c539[_0xf5f8('0x29')]]={'$like':'%'+_0x3975a1[_0xf5f8('0x31')][_0xf5f8('0x3b')]+'%'};return _0x36e6cc;}})});}_0x27bf48=_[_0xf5f8('0x3c')]({},_0x27bf48,_0x3975a1[_0xf5f8('0x3d')]);var _0x5d2236={'where':_0x27bf48[_0xf5f8('0x39')]};return db[_0xf5f8('0x2c')][_0xf5f8('0x1b')](_0x5d2236)['then'](function(_0x80247e){_0x42c69d[_0xf5f8('0x1b')]=_0x80247e;if(_0x3975a1[_0xf5f8('0x31')][_0xf5f8('0x3e')]){_0x27bf48[_0xf5f8('0x3f')]=[{'all':!![]}];}return db[_0xf5f8('0x2c')][_0xf5f8('0x40')](_0x27bf48);})[_0xf5f8('0x26')](function(_0x4568d4){_0x42c69d[_0xf5f8('0x41')]=_0x4568d4;return _0x42c69d;})[_0xf5f8('0x26')](respondWithFilteredResult(_0x1be80e,_0x27bf48))[_0xf5f8('0x42')](handleError(_0x1be80e,null));};exports[_0xf5f8('0x43')]=function(_0x37db00,_0xdfaa23){var _0x31d788={'raw':!![],'where':{'id':_0x37db00[_0xf5f8('0x44')]['id']}},_0x354752={};_0x354752[_0xf5f8('0x33')]=_['keys'](db[_0xf5f8('0x2c')][_0xf5f8('0x2d')]);_0x354752[_0xf5f8('0x31')]=_[_0xf5f8('0x45')](_0x37db00['query']);_0x354752[_0xf5f8('0x32')]=_[_0xf5f8('0x35')](_0x354752[_0xf5f8('0x33')],_0x354752['query']);_0x31d788[_0xf5f8('0x34')]=_[_0xf5f8('0x35')](_0x354752[_0xf5f8('0x33')],qs[_0xf5f8('0x36')](_0x37db00[_0xf5f8('0x31')][_0xf5f8('0x36')]));_0x31d788['attributes']=_0x31d788['attributes'][_0xf5f8('0x46')]?_0x31d788[_0xf5f8('0x34')]:_0x354752[_0xf5f8('0x33')];if(_0x37db00[_0xf5f8('0x31')]['includeAll']){_0x31d788['include']=[{'all':!![]}];}_0x31d788=_[_0xf5f8('0x3c')]({},_0x31d788,_0x37db00['options']);return db[_0xf5f8('0x2c')][_0xf5f8('0x47')](_0x31d788)[_0xf5f8('0x26')](handleEntityNotFound(_0xdfaa23,null))['then'](respondWithResult(_0xdfaa23,null))[_0xf5f8('0x42')](handleError(_0xdfaa23,null));};exports[_0xf5f8('0x48')]=function(_0x3bda6f,_0xf4d3a0){return db[_0xf5f8('0x2c')][_0xf5f8('0x48')](_0x3bda6f[_0xf5f8('0x49')],{})[_0xf5f8('0x26')](function(_0xff9534){var _0x43543d=_0x3bda6f[_0xf5f8('0x4a')]['get']({'plain':!![]});if(!_0x43543d)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x43543d[_0xf5f8('0x4b')]==='user'){var _0x216f0e=_0xff9534['get']({'plain':!![]});var _0x208204='SmsQueues';return db[_0xf5f8('0x4c')]['find']({'where':{'name':_0x208204,'userProfileId':_0x43543d[_0xf5f8('0x4d')]},'raw':!![]})[_0xf5f8('0x26')](function(_0x420a5c){if(_0x420a5c&&_0x420a5c['autoAssociation']===0x0){return db[_0xf5f8('0x4e')]['create']({'name':_0x216f0e['name'],'resourceId':_0x216f0e['id'],'type':_0x420a5c[_0xf5f8('0x29')],'sectionId':_0x420a5c['id']},{})[_0xf5f8('0x26')](function(){return _0xff9534;});}else{return _0xff9534;}})[_0xf5f8('0x42')](function(_0x23eed5){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x23eed5);throw _0x23eed5;});}return _0xff9534;})[_0xf5f8('0x26')](respondWithResult(_0xf4d3a0,0xc9))[_0xf5f8('0x42')](handleError(_0xf4d3a0,null));};exports['update']=function(_0x5f063a,_0x194a38){if(_0x5f063a[_0xf5f8('0x49')]['id']){delete _0x5f063a['body']['id'];}return db[_0xf5f8('0x2c')][_0xf5f8('0x47')]({'where':{'id':_0x5f063a['params']['id']}})[_0xf5f8('0x26')](handleEntityNotFound(_0x194a38,null))[_0xf5f8('0x26')](saveUpdates(_0x5f063a[_0xf5f8('0x49')],null))['then'](respondWithResult(_0x194a38,null))[_0xf5f8('0x42')](handleError(_0x194a38,null));};exports[_0xf5f8('0x25')]=function(_0xa3029c,_0x338a31){return db[_0xf5f8('0x2c')][_0xf5f8('0x47')]({'where':{'id':_0xa3029c[_0xf5f8('0x44')]['id']}})['then'](handleEntityNotFound(_0x338a31,null))[_0xf5f8('0x26')](removeEntity(_0x338a31,null))['catch'](handleError(_0x338a31,null));};exports[_0xf5f8('0x4f')]=function(_0xf0e5a6,_0x43adfb){return db[_0xf5f8('0x2c')][_0xf5f8('0x4f')]()['then'](respondWithResult(_0x43adfb,null))[_0xf5f8('0x42')](handleError(_0x43adfb,null));};exports[_0xf5f8('0x50')]=function(_0x278eaf,_0x5c7653,_0x306f8d){var _0x21dbc5={'raw':!![],'where':{}},_0x1a35a4={},_0x23211b;return db[_0xf5f8('0x2c')]['findOne']({'where':{'id':_0x278eaf[_0xf5f8('0x44')]['id']}})['then'](handleEntityNotFound(_0x5c7653,null))[_0xf5f8('0x26')](function(_0x486fb1){if(_0x486fb1){_0x23211b=_0x486fb1['get']({'plain':!![]});_0x1a35a4[_0xf5f8('0x33')]=_[_0xf5f8('0x45')](db[_0xf5f8('0x51')][_0xf5f8('0x2d')]);_0x1a35a4[_0xf5f8('0x31')]=_['keys'](_0x278eaf['query']);_0x1a35a4[_0xf5f8('0x32')]=_[_0xf5f8('0x35')](_0x1a35a4['model'],_0x1a35a4['query']);_0x21dbc5[_0xf5f8('0x34')]=_[_0xf5f8('0x35')](_0x1a35a4['model'],qs['fields'](_0x278eaf[_0xf5f8('0x31')][_0xf5f8('0x36')]));_0x21dbc5['attributes']=_0x21dbc5[_0xf5f8('0x34')][_0xf5f8('0x46')]?_0x21dbc5['attributes']:_0x1a35a4[_0xf5f8('0x33')];if(!_0x278eaf['query'][_0xf5f8('0x52')](_0xf5f8('0x53'))){_0x21dbc5[_0xf5f8('0x1d')]=qs[_0xf5f8('0x1d')](_0x278eaf['query'][_0xf5f8('0x1d')]);_0x21dbc5[_0xf5f8('0x1c')]=qs[_0xf5f8('0x1c')](_0x278eaf[_0xf5f8('0x31')][_0xf5f8('0x1c')]);}_0x21dbc5[_0xf5f8('0x37')]=qs[_0xf5f8('0x38')](_0x278eaf[_0xf5f8('0x31')][_0xf5f8('0x38')]);_0x21dbc5[_0xf5f8('0x39')]=qs[_0xf5f8('0x32')](_[_0xf5f8('0x3a')](_0x278eaf['query'],_0x1a35a4[_0xf5f8('0x32')]));_0x21dbc5['where'][_0xf5f8('0x54')]=_0x486fb1['id'];if(_0x278eaf[_0xf5f8('0x31')][_0xf5f8('0x3b')]){_0x21dbc5[_0xf5f8('0x39')]=_[_0xf5f8('0x3c')](_0x21dbc5[_0xf5f8('0x39')],{'$or':_[_0xf5f8('0x2b')](_0x21dbc5[_0xf5f8('0x34')],function(_0x3441d1){var _0x112de3={};_0x112de3[_0x3441d1]={'$like':'%'+_0x278eaf['query']['filter']+'%'};return _0x112de3;})});}_0x21dbc5=_['merge']({},_0x21dbc5,_0x278eaf['options']);return db[_0xf5f8('0x51')][_0xf5f8('0x40')](_0x21dbc5);}})[_0xf5f8('0x26')](function(_0x367061){if(_0x367061){return db[_0xf5f8('0x55')]['findAndCountAll']({'where':{'id':_[_0xf5f8('0x2b')](_0x367061,'UserId'),'role':_0xf5f8('0x56')},'attributes':['id',_0xf5f8('0x29'),'smsPause',_0xf5f8('0x57'),_0xf5f8('0x58')]});}})[_0xf5f8('0x26')](function(_0x5b5063){if(_0x5b5063){return{'count':_0x5b5063[_0xf5f8('0x1b')],'rows':_[_0xf5f8('0x2b')](_0x5b5063['rows'],function(_0x5b3c35){return{'membername':_0x5b3c35[_0xf5f8('0x29')],'UserId':_0x5b3c35['id'],'queue_name':_0x23211b['name'],'SmsQueueId':_0x23211b['id'],'interface':util[_0xf5f8('0x59')](_0xf5f8('0x5a'),_0xf5f8('0x5b'),_0x5b3c35['name']),'penalty':0x0,'paused':_0x5b3c35[_0xf5f8('0x5c')],'createdAt':_0x5b3c35[_0xf5f8('0x58')],'updatedAt':_0x5b3c35[_0xf5f8('0x57')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xf5f8('0x26')](respondWithFilteredResult(_0x5c7653,_0x21dbc5))['catch'](handleError(_0x5c7653,null));};exports[_0xf5f8('0x5d')]=function(_0x1fd7df,_0x1738cb,_0x1efc08){var _0x396868={};var _0x13b978={};var _0x2b95e0;var _0x5b961b;return db[_0xf5f8('0x2c')][_0xf5f8('0x5e')]({'where':{'id':_0x1fd7df[_0xf5f8('0x44')]['id']}})[_0xf5f8('0x26')](handleEntityNotFound(_0x1738cb,null))[_0xf5f8('0x26')](function(_0x3c2600){if(_0x3c2600){_0x2b95e0=_0x3c2600;_0x13b978['model']=_['keys'](db[_0xf5f8('0x5f')][_0xf5f8('0x2d')]);_0x13b978[_0xf5f8('0x31')]=_[_0xf5f8('0x45')](_0x1fd7df['query']);_0x13b978['filters']=_[_0xf5f8('0x35')](_0x13b978[_0xf5f8('0x33')],_0x13b978['query']);_0x396868['attributes']=_[_0xf5f8('0x35')](_0x13b978[_0xf5f8('0x33')],qs['fields'](_0x1fd7df['query'][_0xf5f8('0x36')]));_0x396868[_0xf5f8('0x34')]=_0x396868[_0xf5f8('0x34')][_0xf5f8('0x46')]?_0x396868[_0xf5f8('0x34')]:_0x13b978[_0xf5f8('0x33')];_0x396868['order']=qs['sort'](_0x1fd7df[_0xf5f8('0x31')][_0xf5f8('0x38')]);_0x396868[_0xf5f8('0x39')]=qs[_0xf5f8('0x32')](_[_0xf5f8('0x3a')](_0x1fd7df[_0xf5f8('0x31')],_0x13b978[_0xf5f8('0x32')]));if(_0x1fd7df[_0xf5f8('0x31')][_0xf5f8('0x3b')]){_0x396868[_0xf5f8('0x39')]=_[_0xf5f8('0x3c')](_0x396868[_0xf5f8('0x39')],{'$or':_[_0xf5f8('0x2b')](_0x396868['attributes'],function(_0x5248bb){var _0x249a6c={};_0x249a6c[_0x5248bb]={'$like':'%'+_0x1fd7df[_0xf5f8('0x31')]['filter']+'%'};return _0x249a6c;})});}_0x396868=_[_0xf5f8('0x3c')]({},_0x396868,_0x1fd7df['options']);return _0x2b95e0[_0xf5f8('0x5d')](_0x396868);}})['then'](function(_0x478fc8){if(_0x478fc8){_0x5b961b=_0x478fc8['length'];if(!_0x1fd7df[_0xf5f8('0x31')][_0xf5f8('0x52')](_0xf5f8('0x53'))){_0x396868[_0xf5f8('0x1d')]=qs['limit'](_0x1fd7df[_0xf5f8('0x31')]['limit']);_0x396868[_0xf5f8('0x1c')]=qs['offset'](_0x1fd7df[_0xf5f8('0x31')]['offset']);}return _0x2b95e0[_0xf5f8('0x5d')](_0x396868);}})[_0xf5f8('0x26')](function(_0x3813ae){if(_0x3813ae){return _0x3813ae?{'count':_0x5b961b,'rows':_0x3813ae}:null;}})[_0xf5f8('0x26')](respondWithResult(_0x1738cb,null))[_0xf5f8('0x42')](handleError(_0x1738cb,null));};exports[_0xf5f8('0x60')]=function(_0x55d2e8,_0x902c29,_0x2bae45){var _0xe5b5d4=_0x55d2e8[_0xf5f8('0x49')][_0xf5f8('0x61')];return db[_0xf5f8('0x5f')][_0xf5f8('0x40')]({'where':{'id':_0xe5b5d4},'attributes':['id'],'include':[{'model':db[_0xf5f8('0x55')],'as':_0xf5f8('0x62'),'attributes':['id',_0xf5f8('0x29'),_0xf5f8('0x63'),_0xf5f8('0x64'),_0xf5f8('0x65')],'raw':!![]}]})[_0xf5f8('0x26')](function(_0x40b78a){if(_0x40b78a){var _0x361f1e=_[_0xf5f8('0x66')](_0x40b78a,function(_0x5a21fa){var _0x477a90=_0x5a21fa['get']({'plain':!![]});return _0x477a90['Agents'];});return db[_0xf5f8('0x2c')][_0xf5f8('0x47')]({'where':{'id':_0x55d2e8[_0xf5f8('0x44')]['id']}})[_0xf5f8('0x26')](function(_0x2a3a70){return db[_0xf5f8('0x67')]['transaction'](function(_0xce5dd3){return _0x2a3a70['addTeams'](_0xe5b5d4,{'transaction':_0xce5dd3})[_0xf5f8('0x26')](function(){return BPromise['each'](_0x361f1e,function(_0x24ed64){return db['UserSmsQueue']['findOrCreate']({'where':{'UserId':_0x24ed64['id'],'SmsQueueId':_0x55d2e8['params']['id']},'transaction':_0xce5dd3});});})['then'](function(){_0x361f1e[_0xf5f8('0x68')](function(_0x58dce2){socket[_0xf5f8('0x69')](_0xf5f8('0x6a'),{'UserId':_0x58dce2['id'],'SmsQueueId':_0x2a3a70['id']});});});});});}})['then'](respondWithStatusCode(_0x902c29,null))['catch'](handleError(_0x902c29,null));};exports[_0xf5f8('0x6b')]=function(_0x267467,_0x326d98,_0x39ee1b){return db[_0xf5f8('0x5f')]['findAll']({'where':{'id':_0x267467[_0xf5f8('0x31')][_0xf5f8('0x61')]},'attributes':['id'],'include':[{'model':db[_0xf5f8('0x55')],'as':_0xf5f8('0x62'),'attributes':['id'],'raw':!![]}]})[_0xf5f8('0x26')](handleEntityNotFound(_0x326d98,null))[_0xf5f8('0x26')](function(_0x315538){var _0x4915ad=_[_0xf5f8('0x2b')](_0x315538,'id');var _0x2a6551=[];var _0x985c37=[];var _0x359a4e=squel[_0xf5f8('0x6c')]();_0x359a4e[_0xf5f8('0x6d')](_0xf5f8('0x6e'))[_0xf5f8('0x6f')](_0xf5f8('0x70'),'tq')['join'](_0xf5f8('0x71'),'ut',_0xf5f8('0x72'))[_0xf5f8('0x39')](_0xf5f8('0x73'),_0x267467[_0xf5f8('0x44')]['id']);for(var _0x4c1233=0x0;_0x4c1233<_0x315538[_0xf5f8('0x46')];_0x4c1233+=0x1){let _0x4b6af8=_0x315538[_0x4c1233];for(var _0x2b5f53=0x0;_0x2b5f53<_0x4b6af8[_0xf5f8('0x62')][_0xf5f8('0x46')];_0x2b5f53+=0x1){let _0x2c85b0=_0x4b6af8[_0xf5f8('0x62')][_0x2b5f53];var _0x55bf87=_0x359a4e[_0xf5f8('0x74')]();_0x55bf87[_0xf5f8('0x39')](_0xf5f8('0x75'),_0x2c85b0['id']);_0x985c37['push'](db[_0xf5f8('0x67')][_0xf5f8('0x31')](_0x55bf87['toString'](),{'type':db[_0xf5f8('0x67')][_0xf5f8('0x76')]['SELECT']})[_0xf5f8('0x26')](function(_0x4f0bf5){if(_0x4f0bf5[_0xf5f8('0x46')]===0x1){return _0x2c85b0['id'];}else{var _0x5a07d7=_[_0xf5f8('0x77')](_[_0xf5f8('0x2b')](_0x4f0bf5,_0xf5f8('0x78')),function(_0x56ce1d){return _['includes'](_0x4915ad,_0x56ce1d);});if(_0x5a07d7){return _0x2c85b0['id'];}}}));}}return BPromise[_0xf5f8('0x79')](_0x985c37)[_0xf5f8('0x26')](function(_0x5f43d6){_0x2a6551=_(_0x2a6551)['union'](_0x5f43d6)[_0xf5f8('0x7a')]()['value']();return db[_0xf5f8('0x2c')]['find']({'where':{'id':_0x267467[_0xf5f8('0x44')]['id']}})[_0xf5f8('0x26')](function(_0x154781){return db['sequelize'][_0xf5f8('0x7b')](function(_0x3f2f57){return _0x154781[_0xf5f8('0x6b')](_0x267467[_0xf5f8('0x31')][_0xf5f8('0x61')],{'transaction':_0x3f2f57})['then'](function(){if(!_[_0xf5f8('0x7c')](_0x2a6551)){return _0x154781[_0xf5f8('0x7d')](_0x2a6551,{'transaction':_0x3f2f57});}})['then'](function(){_0x2a6551[_0xf5f8('0x68')](function(_0x1f1f77){socket[_0xf5f8('0x69')](_0xf5f8('0x7e'),{'UserId':_0x1f1f77,'SmsQueueId':_0x154781['id']});});});});});});})[_0xf5f8('0x26')](respondWithStatusCode(_0x326d98,null))['catch'](handleError(_0x326d98,null));};exports['addAgents']=function(_0x5f32a5,_0x351503,_0x55faf1){return db[_0xf5f8('0x2c')][_0xf5f8('0x47')]({'where':{'id':_0x5f32a5[_0xf5f8('0x44')]['id']}})[_0xf5f8('0x26')](handleEntityNotFound(_0x351503,null))[_0xf5f8('0x26')](function(_0x359de2){if(_0x359de2){return _0x359de2[_0xf5f8('0x7f')](_0x5f32a5['body'][_0xf5f8('0x61')],_[_0xf5f8('0x80')](_0x5f32a5[_0xf5f8('0x49')],['ids','id'])||{})['spread'](function(_0x2478e9){for(var _0x3c3bff=0x0;_0x3c3bff<_0x5f32a5['body'][_0xf5f8('0x61')][_0xf5f8('0x46')];_0x3c3bff+=0x1){socket['emit'](_0xf5f8('0x6a'),{'UserId':_0x5f32a5['body'][_0xf5f8('0x61')][_0x3c3bff],'SmsQueueId':_0x5f32a5[_0xf5f8('0x44')]['id']});}return _0x2478e9;});}})['then'](respondWithResult(_0x351503,null))[_0xf5f8('0x42')](handleError(_0x351503,null));};exports[_0xf5f8('0x7d')]=function(_0x546808,_0x463dca,_0x40b222){return db['SmsQueue']['find']({'where':{'id':_0x546808['params']['id']}})[_0xf5f8('0x26')](handleEntityNotFound(_0x463dca,null))[_0xf5f8('0x26')](function(_0x296cfa){if(_0x296cfa){return _0x296cfa[_0xf5f8('0x7d')](_0x546808['query'][_0xf5f8('0x61')])[_0xf5f8('0x26')](function(){if(_[_0xf5f8('0x81')](_0x546808[_0xf5f8('0x31')][_0xf5f8('0x61')])){for(var _0x49b02d=0x0;_0x49b02d<_0x546808[_0xf5f8('0x31')]['ids']['length'];_0x49b02d+=0x1){socket[_0xf5f8('0x69')](_0xf5f8('0x7e'),{'UserId':Number(_0x546808[_0xf5f8('0x31')][_0xf5f8('0x61')][_0x49b02d]),'SmsQueueId':Number(_0x546808['params']['id'])});}}else{socket[_0xf5f8('0x69')]('userSmsQueue:remove',{'UserId':Number(_0x546808[_0xf5f8('0x31')][_0xf5f8('0x61')]),'SmsQueueId':Number(_0x546808[_0xf5f8('0x44')]['id'])});}});}})[_0xf5f8('0x26')](respondWithStatusCode(_0x463dca,null))[_0xf5f8('0x42')](handleError(_0x463dca,null));};exports['getAgents']=function(_0x4d581a,_0x2d36ba,_0x5e7324){var _0x5c7b52={};var _0x2c56e5={};var _0x1c2f04;var _0x43ef24;return db['SmsQueue']['findOne']({'where':{'id':_0x4d581a[_0xf5f8('0x44')]['id']}})[_0xf5f8('0x26')](handleEntityNotFound(_0x2d36ba,null))[_0xf5f8('0x26')](function(_0x4ce731){if(_0x4ce731){_0x1c2f04=_0x4ce731;_0x2c56e5[_0xf5f8('0x33')]=_[_0xf5f8('0x45')](db[_0xf5f8('0x55')]['rawAttributes']);_0x2c56e5[_0xf5f8('0x31')]=_[_0xf5f8('0x45')](_0x4d581a[_0xf5f8('0x31')]);_0x2c56e5[_0xf5f8('0x32')]=_['intersection'](_0x2c56e5[_0xf5f8('0x33')],_0x2c56e5['query']);_0x5c7b52[_0xf5f8('0x34')]=_[_0xf5f8('0x35')](_0x2c56e5[_0xf5f8('0x33')],qs[_0xf5f8('0x36')](_0x4d581a[_0xf5f8('0x31')][_0xf5f8('0x36')]));_0x5c7b52['attributes']=_0x5c7b52[_0xf5f8('0x34')]['length']?_0x5c7b52['attributes']:_0x2c56e5[_0xf5f8('0x33')];_0x5c7b52[_0xf5f8('0x37')]=qs[_0xf5f8('0x38')](_0x4d581a['query'][_0xf5f8('0x38')]);_0x5c7b52[_0xf5f8('0x39')]=qs['filters'](_[_0xf5f8('0x3a')](_0x4d581a['query'],_0x2c56e5[_0xf5f8('0x32')]));if(_0x4d581a[_0xf5f8('0x31')][_0xf5f8('0x3b')]){_0x5c7b52[_0xf5f8('0x39')]=_['merge'](_0x5c7b52['where'],{'$or':_['map'](_0x5c7b52[_0xf5f8('0x34')],function(_0x4c4ddd){var _0x2439d6={};_0x2439d6[_0x4c4ddd]={'$like':'%'+_0x4d581a[_0xf5f8('0x31')][_0xf5f8('0x3b')]+'%'};return _0x2439d6;})});}_0x5c7b52=_[_0xf5f8('0x3c')]({},_0x5c7b52,_0x4d581a[_0xf5f8('0x3d')]);return _0x1c2f04[_0xf5f8('0x82')](_0x5c7b52);}})[_0xf5f8('0x26')](function(_0x5e490f){if(_0x5e490f){_0x43ef24=_0x5e490f[_0xf5f8('0x46')];if(!_0x4d581a[_0xf5f8('0x31')][_0xf5f8('0x52')]('nolimit')){_0x5c7b52[_0xf5f8('0x1d')]=qs[_0xf5f8('0x1d')](_0x4d581a[_0xf5f8('0x31')][_0xf5f8('0x1d')]);_0x5c7b52[_0xf5f8('0x1c')]=qs[_0xf5f8('0x1c')](_0x4d581a['query']['offset']);}return _0x1c2f04[_0xf5f8('0x82')](_0x5c7b52);}})[_0xf5f8('0x26')](function(_0x3a2bde){if(_0x3a2bde){return _0x3a2bde?{'count':_0x43ef24,'rows':_0x3a2bde}:null;}})[_0xf5f8('0x26')](respondWithResult(_0x2d36ba,null))[_0xf5f8('0x42')](handleError(_0x2d36ba,null));}; \ No newline at end of file +var _0x2deb=['sequelize','transaction','each','findOrCreate','removeTeams','select','field','tq.TeamId','from','team_has_sms_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','SmsQueueId\x20=\x20?','clone','toString','QueryTypes','SELECT','TeamId','all','compact','isEmpty','removeAgents','forEach','emit','addAgents','omit','userSmsQueue:save','isArray','userSmsQueue:remove','getAgents','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','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/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./smsQueue.socket','register','sendStatus','status','end','json','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','get','UserProfileResource','error','stack','name','send','index','map','SmsQueue','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','limit','order','sort','pick','filter','where','merge','VIRTUAL','includeAll','include','findAll','rows','catch','show','params','rawAttributes','length','find','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','SmsQueues','UserProfileSection','userProfileId','autoAssociation','create','findOne','SmsQueueId','options','UserSmsQueue','User','UserId','agent','smsPause','updatedAt','createdAt','format','%s/%s','SIP','getTeams','addTeams','ids','Agents','online','flatMap'];(function(_0x245a1a,_0x4740e7){var _0x2fd743=function(_0x5e2b2a){while(--_0x5e2b2a){_0x245a1a['push'](_0x245a1a['shift']());}};_0x2fd743(++_0x4740e7);}(_0x2deb,0x1c6));var _0xb2de=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x2deb[_0x3dd15e];return _0x231fd0;};'use strict';var pdf=require(_0xb2de('0x0'));var emlformat=require(_0xb2de('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xb2de('0x2'));var jsonpatch=require(_0xb2de('0x3'));var rp=require(_0xb2de('0x4'));var moment=require('moment');var BPromise=require(_0xb2de('0x5'));var Mustache=require(_0xb2de('0x6'));var util=require('util');var path=require('path');var sox=require(_0xb2de('0x7'));var csv=require(_0xb2de('0x8'));var ejs=require(_0xb2de('0x9'));var fs=require('fs');var _=require(_0xb2de('0xa'));var squel=require(_0xb2de('0xb'));var crypto=require('crypto');var jsforce=require(_0xb2de('0xc'));var deskjs=require(_0xb2de('0xd'));var toCsv=require(_0xb2de('0x8'));var querystring=require(_0xb2de('0xe'));var Papa=require(_0xb2de('0xf'));var Redis=require(_0xb2de('0x10'));var authService=require(_0xb2de('0x11'));var qs=require(_0xb2de('0x12'));var as=require(_0xb2de('0x13'));var hardwareService=require(_0xb2de('0x14'));var logger=require('../../config/logger')('api');var utils=require(_0xb2de('0x15'));var config=require(_0xb2de('0x16'));var db=require(_0xb2de('0x17'))['db'];config[_0xb2de('0x18')]=_[_0xb2de('0x19')](config[_0xb2de('0x18')],{'host':_0xb2de('0x1a'),'port':0x18eb});var socket=require(_0xb2de('0x1b'))(new Redis(config[_0xb2de('0x18')]));require(_0xb2de('0x1c'))[_0xb2de('0x1d')](socket);function respondWithStatusCode(_0x7a83a,_0xa5acac){_0xa5acac=_0xa5acac||0xcc;return function(_0x47f6bb){if(_0x47f6bb){return _0x7a83a[_0xb2de('0x1e')](_0xa5acac);}return _0x7a83a[_0xb2de('0x1f')](_0xa5acac)[_0xb2de('0x20')]();};}function respondWithResult(_0x3c7cae,_0x33170e){_0x33170e=_0x33170e||0xc8;return function(_0x3ecfb9){if(_0x3ecfb9){return _0x3c7cae['status'](_0x33170e)[_0xb2de('0x21')](_0x3ecfb9);}};}function respondWithFilteredResult(_0x1bfbfe,_0x4a00c8){return function(_0x2e14e2){if(_0x2e14e2){var _0x280658=_0x2e14e2[_0xb2de('0x22')],_0x5c91d0=_0x4a00c8['offset'],_0x276107=_0x4a00c8[_0xb2de('0x23')]+_0x4a00c8['limit'],_0x2223c;if(_0x276107>=_0x280658){_0x276107=_0x280658;_0x2223c=0xc8;}else{_0x2223c=0xce;}_0x1bfbfe[_0xb2de('0x1f')](_0x2223c);return _0x1bfbfe[_0xb2de('0x24')](_0xb2de('0x25'),_0x5c91d0+'-'+_0x276107+'/'+_0x280658)[_0xb2de('0x21')](_0x2e14e2);}return null;};}function patchUpdates(_0x209e94){return function(_0x1ea9c3){try{jsonpatch[_0xb2de('0x26')](_0x1ea9c3,_0x209e94,!![]);}catch(_0x2b8938){return BPromise[_0xb2de('0x27')](_0x2b8938);}return _0x1ea9c3[_0xb2de('0x28')]();};}function saveUpdates(_0x441694,_0x2dce16){return function(_0x14b381){if(_0x14b381){return _0x14b381[_0xb2de('0x29')](_0x441694)[_0xb2de('0x2a')](function(_0x5d4ac3){return _0x5d4ac3;});}return null;};}function removeEntity(_0x1f2ec5,_0x164f82){return function(_0xf431aa){if(_0xf431aa){return _0xf431aa[_0xb2de('0x2b')]()[_0xb2de('0x2a')](function(){var _0xe0b778=_0xf431aa[_0xb2de('0x2c')]({'plain':!![]});var _0x499eea='SmsQueues';return db[_0xb2de('0x2d')][_0xb2de('0x2b')]({'where':{'type':_0x499eea,'resourceId':_0xe0b778['id']}})[_0xb2de('0x2a')](function(){return _0xf431aa;});})[_0xb2de('0x2a')](function(){_0x1f2ec5[_0xb2de('0x1f')](0xcc)['end']();});}};}function handleEntityNotFound(_0x27afb3,_0x10da6a){return function(_0x213b19){if(!_0x213b19){_0x27afb3['sendStatus'](0x194);}return _0x213b19;};}function handleError(_0x386794,_0x5332ad){_0x5332ad=_0x5332ad||0x1f4;return function(_0x28a9e6){logger[_0xb2de('0x2e')](_0x28a9e6[_0xb2de('0x2f')]);if(_0x28a9e6[_0xb2de('0x30')]){delete _0x28a9e6[_0xb2de('0x30')];}_0x386794[_0xb2de('0x1f')](_0x5332ad)[_0xb2de('0x31')](_0x28a9e6);};}exports[_0xb2de('0x32')]=function(_0x1276db,_0x3e9920){var _0x17947a={},_0x1d124a={},_0x42f0f5={'count':0x0,'rows':[]};var _0x342d85=_[_0xb2de('0x33')](db[_0xb2de('0x34')]['rawAttributes'],function(_0x48c145){return{'name':_0x48c145[_0xb2de('0x35')],'type':_0x48c145[_0xb2de('0x36')][_0xb2de('0x37')]};});_0x1d124a[_0xb2de('0x38')]=_['map'](_0x342d85,_0xb2de('0x30'));_0x1d124a[_0xb2de('0x39')]=_[_0xb2de('0x3a')](_0x1276db[_0xb2de('0x39')]);_0x1d124a[_0xb2de('0x3b')]=_[_0xb2de('0x3c')](_0x1d124a['model'],_0x1d124a['query']);_0x17947a[_0xb2de('0x3d')]=_[_0xb2de('0x3c')](_0x1d124a[_0xb2de('0x38')],qs[_0xb2de('0x3e')](_0x1276db['query'][_0xb2de('0x3e')]));_0x17947a[_0xb2de('0x3d')]=_0x17947a[_0xb2de('0x3d')]['length']?_0x17947a[_0xb2de('0x3d')]:_0x1d124a[_0xb2de('0x38')];if(!_0x1276db[_0xb2de('0x39')][_0xb2de('0x3f')](_0xb2de('0x40'))){_0x17947a[_0xb2de('0x41')]=qs[_0xb2de('0x41')](_0x1276db['query'][_0xb2de('0x41')]);_0x17947a[_0xb2de('0x23')]=qs['offset'](_0x1276db[_0xb2de('0x39')][_0xb2de('0x23')]);}_0x17947a[_0xb2de('0x42')]=qs['sort'](_0x1276db[_0xb2de('0x39')][_0xb2de('0x43')]);_0x17947a['where']=qs[_0xb2de('0x3b')](_[_0xb2de('0x44')](_0x1276db[_0xb2de('0x39')],_0x1d124a['filters']),_0x342d85);if(_0x1276db[_0xb2de('0x39')][_0xb2de('0x45')]){_0x17947a[_0xb2de('0x46')]=_[_0xb2de('0x47')](_0x17947a['where'],{'$or':_[_0xb2de('0x33')](_0x342d85,function(_0x1eeecd){if(_0x1eeecd['type']!==_0xb2de('0x48')){var _0x4bc347={};_0x4bc347[_0x1eeecd[_0xb2de('0x30')]]={'$like':'%'+_0x1276db['query'][_0xb2de('0x45')]+'%'};return _0x4bc347;}})});}_0x17947a=_[_0xb2de('0x47')]({},_0x17947a,_0x1276db['options']);var _0x4289ce={'where':_0x17947a[_0xb2de('0x46')]};return db[_0xb2de('0x34')][_0xb2de('0x22')](_0x4289ce)['then'](function(_0x41838c){_0x42f0f5[_0xb2de('0x22')]=_0x41838c;if(_0x1276db[_0xb2de('0x39')][_0xb2de('0x49')]){_0x17947a[_0xb2de('0x4a')]=[{'all':!![]}];}return db['SmsQueue'][_0xb2de('0x4b')](_0x17947a);})['then'](function(_0x40d6f1){_0x42f0f5[_0xb2de('0x4c')]=_0x40d6f1;return _0x42f0f5;})[_0xb2de('0x2a')](respondWithFilteredResult(_0x3e9920,_0x17947a))[_0xb2de('0x4d')](handleError(_0x3e9920,null));};exports[_0xb2de('0x4e')]=function(_0xd54e68,_0x4241cc){var _0x29687e={'raw':!![],'where':{'id':_0xd54e68[_0xb2de('0x4f')]['id']}},_0x36cf52={};_0x36cf52[_0xb2de('0x38')]=_[_0xb2de('0x3a')](db['SmsQueue'][_0xb2de('0x50')]);_0x36cf52['query']=_[_0xb2de('0x3a')](_0xd54e68[_0xb2de('0x39')]);_0x36cf52[_0xb2de('0x3b')]=_[_0xb2de('0x3c')](_0x36cf52[_0xb2de('0x38')],_0x36cf52['query']);_0x29687e[_0xb2de('0x3d')]=_[_0xb2de('0x3c')](_0x36cf52[_0xb2de('0x38')],qs[_0xb2de('0x3e')](_0xd54e68['query']['fields']));_0x29687e[_0xb2de('0x3d')]=_0x29687e[_0xb2de('0x3d')][_0xb2de('0x51')]?_0x29687e[_0xb2de('0x3d')]:_0x36cf52[_0xb2de('0x38')];if(_0xd54e68[_0xb2de('0x39')][_0xb2de('0x49')]){_0x29687e[_0xb2de('0x4a')]=[{'all':!![]}];}_0x29687e=_['merge']({},_0x29687e,_0xd54e68['options']);return db[_0xb2de('0x34')][_0xb2de('0x52')](_0x29687e)[_0xb2de('0x2a')](handleEntityNotFound(_0x4241cc,null))['then'](respondWithResult(_0x4241cc,null))[_0xb2de('0x4d')](handleError(_0x4241cc,null));};exports['create']=function(_0x3af657,_0x371389){return db[_0xb2de('0x34')]['create'](_0x3af657[_0xb2de('0x53')],{})['then'](function(_0x130d6b){var _0x2034a9=_0x3af657[_0xb2de('0x54')]['get']({'plain':!![]});if(!_0x2034a9)throw new Error(_0xb2de('0x55'));if(_0x2034a9['role']===_0xb2de('0x54')){var _0x4ba3f8=_0x130d6b['get']({'plain':!![]});var _0x298a81=_0xb2de('0x56');return db[_0xb2de('0x57')][_0xb2de('0x52')]({'where':{'name':_0x298a81,'userProfileId':_0x2034a9[_0xb2de('0x58')]},'raw':!![]})[_0xb2de('0x2a')](function(_0x2af5c8){if(_0x2af5c8&&_0x2af5c8[_0xb2de('0x59')]===0x0){return db[_0xb2de('0x2d')][_0xb2de('0x5a')]({'name':_0x4ba3f8[_0xb2de('0x30')],'resourceId':_0x4ba3f8['id'],'type':_0x2af5c8[_0xb2de('0x30')],'sectionId':_0x2af5c8['id']},{})[_0xb2de('0x2a')](function(){return _0x130d6b;});}else{return _0x130d6b;}})[_0xb2de('0x4d')](function(_0x43e5ee){logger[_0xb2de('0x2e')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x43e5ee);throw _0x43e5ee;});}return _0x130d6b;})[_0xb2de('0x2a')](respondWithResult(_0x371389,0xc9))['catch'](handleError(_0x371389,null));};exports['update']=function(_0x2a05cc,_0x261617){if(_0x2a05cc[_0xb2de('0x53')]['id']){delete _0x2a05cc[_0xb2de('0x53')]['id'];}return db[_0xb2de('0x34')]['find']({'where':{'id':_0x2a05cc[_0xb2de('0x4f')]['id']}})[_0xb2de('0x2a')](handleEntityNotFound(_0x261617,null))[_0xb2de('0x2a')](saveUpdates(_0x2a05cc['body'],null))['then'](respondWithResult(_0x261617,null))[_0xb2de('0x4d')](handleError(_0x261617,null));};exports['destroy']=function(_0x40017e,_0x39460e){return db[_0xb2de('0x34')][_0xb2de('0x52')]({'where':{'id':_0x40017e[_0xb2de('0x4f')]['id']}})[_0xb2de('0x2a')](handleEntityNotFound(_0x39460e,null))[_0xb2de('0x2a')](removeEntity(_0x39460e,null))[_0xb2de('0x4d')](handleError(_0x39460e,null));};exports['describe']=function(_0x885c91,_0x1e5a47){return db[_0xb2de('0x34')]['describe']()[_0xb2de('0x2a')](respondWithResult(_0x1e5a47,null))[_0xb2de('0x4d')](handleError(_0x1e5a47,null));};exports['getMembers']=function(_0x145b63,_0x16736e,_0x20ce35){var _0xcfb416={'raw':!![],'where':{}},_0x5f2226={},_0x4c1945;return db[_0xb2de('0x34')][_0xb2de('0x5b')]({'where':{'id':_0x145b63[_0xb2de('0x4f')]['id']}})[_0xb2de('0x2a')](handleEntityNotFound(_0x16736e,null))[_0xb2de('0x2a')](function(_0x1450a3){if(_0x1450a3){_0x4c1945=_0x1450a3[_0xb2de('0x2c')]({'plain':!![]});_0x5f2226[_0xb2de('0x38')]=_['keys'](db['UserSmsQueue'][_0xb2de('0x50')]);_0x5f2226['query']=_[_0xb2de('0x3a')](_0x145b63[_0xb2de('0x39')]);_0x5f2226[_0xb2de('0x3b')]=_[_0xb2de('0x3c')](_0x5f2226['model'],_0x5f2226[_0xb2de('0x39')]);_0xcfb416[_0xb2de('0x3d')]=_['intersection'](_0x5f2226['model'],qs[_0xb2de('0x3e')](_0x145b63['query'][_0xb2de('0x3e')]));_0xcfb416[_0xb2de('0x3d')]=_0xcfb416[_0xb2de('0x3d')][_0xb2de('0x51')]?_0xcfb416[_0xb2de('0x3d')]:_0x5f2226['model'];if(!_0x145b63[_0xb2de('0x39')][_0xb2de('0x3f')](_0xb2de('0x40'))){_0xcfb416['limit']=qs['limit'](_0x145b63[_0xb2de('0x39')][_0xb2de('0x41')]);_0xcfb416[_0xb2de('0x23')]=qs[_0xb2de('0x23')](_0x145b63['query']['offset']);}_0xcfb416['order']=qs[_0xb2de('0x43')](_0x145b63['query'][_0xb2de('0x43')]);_0xcfb416[_0xb2de('0x46')]=qs['filters'](_[_0xb2de('0x44')](_0x145b63[_0xb2de('0x39')],_0x5f2226[_0xb2de('0x3b')]));_0xcfb416[_0xb2de('0x46')][_0xb2de('0x5c')]=_0x1450a3['id'];if(_0x145b63[_0xb2de('0x39')][_0xb2de('0x45')]){_0xcfb416[_0xb2de('0x46')]=_['merge'](_0xcfb416[_0xb2de('0x46')],{'$or':_['map'](_0xcfb416['attributes'],function(_0x2c3f69){var _0x1e803f={};_0x1e803f[_0x2c3f69]={'$like':'%'+_0x145b63[_0xb2de('0x39')]['filter']+'%'};return _0x1e803f;})});}_0xcfb416=_[_0xb2de('0x47')]({},_0xcfb416,_0x145b63[_0xb2de('0x5d')]);return db[_0xb2de('0x5e')]['findAll'](_0xcfb416);}})[_0xb2de('0x2a')](function(_0x31635b){if(_0x31635b){return db[_0xb2de('0x5f')]['findAndCountAll']({'where':{'id':_[_0xb2de('0x33')](_0x31635b,_0xb2de('0x60')),'role':_0xb2de('0x61')},'attributes':['id','name',_0xb2de('0x62'),_0xb2de('0x63'),_0xb2de('0x64')]});}})[_0xb2de('0x2a')](function(_0x3fe0a4){if(_0x3fe0a4){return{'count':_0x3fe0a4[_0xb2de('0x22')],'rows':_[_0xb2de('0x33')](_0x3fe0a4[_0xb2de('0x4c')],function(_0x17feb9){return{'membername':_0x17feb9[_0xb2de('0x30')],'UserId':_0x17feb9['id'],'queue_name':_0x4c1945[_0xb2de('0x30')],'SmsQueueId':_0x4c1945['id'],'interface':util[_0xb2de('0x65')](_0xb2de('0x66'),_0xb2de('0x67'),_0x17feb9[_0xb2de('0x30')]),'penalty':0x0,'paused':_0x17feb9[_0xb2de('0x62')],'createdAt':_0x17feb9[_0xb2de('0x64')],'updatedAt':_0x17feb9[_0xb2de('0x63')]};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x16736e,_0xcfb416))[_0xb2de('0x4d')](handleError(_0x16736e,null));};exports[_0xb2de('0x68')]=function(_0x2da137,_0x3d984d,_0x158490){var _0x3ed00a={};var _0x2ab19a={};var _0xdb0e22;var _0x81518f;return db[_0xb2de('0x34')][_0xb2de('0x5b')]({'where':{'id':_0x2da137[_0xb2de('0x4f')]['id']}})[_0xb2de('0x2a')](handleEntityNotFound(_0x3d984d,null))[_0xb2de('0x2a')](function(_0x28110c){if(_0x28110c){_0xdb0e22=_0x28110c;_0x2ab19a[_0xb2de('0x38')]=_['keys'](db['Team']['rawAttributes']);_0x2ab19a['query']=_[_0xb2de('0x3a')](_0x2da137[_0xb2de('0x39')]);_0x2ab19a[_0xb2de('0x3b')]=_[_0xb2de('0x3c')](_0x2ab19a[_0xb2de('0x38')],_0x2ab19a[_0xb2de('0x39')]);_0x3ed00a['attributes']=_[_0xb2de('0x3c')](_0x2ab19a[_0xb2de('0x38')],qs[_0xb2de('0x3e')](_0x2da137[_0xb2de('0x39')][_0xb2de('0x3e')]));_0x3ed00a[_0xb2de('0x3d')]=_0x3ed00a['attributes'][_0xb2de('0x51')]?_0x3ed00a['attributes']:_0x2ab19a['model'];_0x3ed00a[_0xb2de('0x42')]=qs[_0xb2de('0x43')](_0x2da137[_0xb2de('0x39')]['sort']);_0x3ed00a['where']=qs[_0xb2de('0x3b')](_[_0xb2de('0x44')](_0x2da137['query'],_0x2ab19a[_0xb2de('0x3b')]));if(_0x2da137[_0xb2de('0x39')][_0xb2de('0x45')]){_0x3ed00a[_0xb2de('0x46')]=_[_0xb2de('0x47')](_0x3ed00a['where'],{'$or':_[_0xb2de('0x33')](_0x3ed00a[_0xb2de('0x3d')],function(_0x5e232b){var _0x1611af={};_0x1611af[_0x5e232b]={'$like':'%'+_0x2da137['query'][_0xb2de('0x45')]+'%'};return _0x1611af;})});}_0x3ed00a=_[_0xb2de('0x47')]({},_0x3ed00a,_0x2da137[_0xb2de('0x5d')]);return _0xdb0e22['getTeams'](_0x3ed00a);}})[_0xb2de('0x2a')](function(_0x107e6d){if(_0x107e6d){_0x81518f=_0x107e6d['length'];if(!_0x2da137[_0xb2de('0x39')][_0xb2de('0x3f')](_0xb2de('0x40'))){_0x3ed00a[_0xb2de('0x41')]=qs['limit'](_0x2da137[_0xb2de('0x39')][_0xb2de('0x41')]);_0x3ed00a['offset']=qs['offset'](_0x2da137['query'][_0xb2de('0x23')]);}return _0xdb0e22[_0xb2de('0x68')](_0x3ed00a);}})['then'](function(_0x2e98b3){if(_0x2e98b3){return _0x2e98b3?{'count':_0x81518f,'rows':_0x2e98b3}:null;}})[_0xb2de('0x2a')](respondWithResult(_0x3d984d,null))[_0xb2de('0x4d')](handleError(_0x3d984d,null));};exports[_0xb2de('0x69')]=function(_0x39be4c,_0x210c0e,_0x392282){var _0x37a7c8=_0x39be4c[_0xb2de('0x53')][_0xb2de('0x6a')];return db['Team'][_0xb2de('0x4b')]({'where':{'id':_0x37a7c8},'attributes':['id'],'include':[{'model':db[_0xb2de('0x5f')],'as':_0xb2de('0x6b'),'attributes':['id','name',_0xb2de('0x6c'),'voicePause','interface'],'raw':!![]}]})['then'](function(_0x331741){if(_0x331741){var _0x57859b=_[_0xb2de('0x6d')](_0x331741,function(_0x1fe9b8){var _0x1e08c3=_0x1fe9b8[_0xb2de('0x2c')]({'plain':!![]});return _0x1e08c3[_0xb2de('0x6b')];});return db[_0xb2de('0x34')][_0xb2de('0x52')]({'where':{'id':_0x39be4c[_0xb2de('0x4f')]['id']}})[_0xb2de('0x2a')](function(_0x3b1c89){return db[_0xb2de('0x6e')][_0xb2de('0x6f')](function(_0x13c5df){return _0x3b1c89[_0xb2de('0x69')](_0x37a7c8,{'transaction':_0x13c5df})['then'](function(){return BPromise[_0xb2de('0x70')](_0x57859b,function(_0x585966){return db['UserSmsQueue'][_0xb2de('0x71')]({'where':{'UserId':_0x585966['id'],'SmsQueueId':_0x39be4c['params']['id']},'transaction':_0x13c5df});});})['then'](function(){_0x57859b['forEach'](function(_0xd037b1){socket['emit']('userSmsQueue:save',{'UserId':_0xd037b1['id'],'SmsQueueId':_0x3b1c89['id']});});});});});}})[_0xb2de('0x2a')](respondWithStatusCode(_0x210c0e,null))[_0xb2de('0x4d')](handleError(_0x210c0e,null));};exports[_0xb2de('0x72')]=function(_0xa31721,_0x2a7c33,_0x1e1265){return db['Team'][_0xb2de('0x4b')]({'where':{'id':_0xa31721[_0xb2de('0x39')]['ids']},'attributes':['id'],'include':[{'model':db['User'],'as':_0xb2de('0x6b'),'attributes':['id'],'raw':!![]}]})[_0xb2de('0x2a')](handleEntityNotFound(_0x2a7c33,null))['then'](function(_0x3be733){var _0x230c58=_['map'](_0x3be733,'id');var _0x12efb0=[];var _0x900604=[];var _0x35560e=squel[_0xb2de('0x73')]();_0x35560e[_0xb2de('0x74')](_0xb2de('0x75'))[_0xb2de('0x76')](_0xb2de('0x77'),'tq')[_0xb2de('0x78')](_0xb2de('0x79'),'ut',_0xb2de('0x7a'))[_0xb2de('0x46')](_0xb2de('0x7b'),_0xa31721[_0xb2de('0x4f')]['id']);for(var _0x1f940f=0x0;_0x1f940f<_0x3be733[_0xb2de('0x51')];_0x1f940f+=0x1){let _0x29bd25=_0x3be733[_0x1f940f];for(var _0x2f63e7=0x0;_0x2f63e7<_0x29bd25[_0xb2de('0x6b')][_0xb2de('0x51')];_0x2f63e7+=0x1){let _0x30b014=_0x29bd25[_0xb2de('0x6b')][_0x2f63e7];var _0x1442c5=_0x35560e[_0xb2de('0x7c')]();_0x1442c5[_0xb2de('0x46')]('ut.UserId\x20=\x20?',_0x30b014['id']);_0x900604['push'](db['sequelize'][_0xb2de('0x39')](_0x1442c5[_0xb2de('0x7d')](),{'type':db[_0xb2de('0x6e')][_0xb2de('0x7e')][_0xb2de('0x7f')]})[_0xb2de('0x2a')](function(_0x47a499){if(_0x47a499[_0xb2de('0x51')]===0x1){return _0x30b014['id'];}else{var _0x4f84f1=_['every'](_[_0xb2de('0x33')](_0x47a499,_0xb2de('0x80')),function(_0x14040c){return _['includes'](_0x230c58,_0x14040c);});if(_0x4f84f1){return _0x30b014['id'];}}}));}}return BPromise[_0xb2de('0x81')](_0x900604)[_0xb2de('0x2a')](function(_0x3841a2){_0x12efb0=_(_0x12efb0)['union'](_0x3841a2)[_0xb2de('0x82')]()['value']();return db['SmsQueue'][_0xb2de('0x52')]({'where':{'id':_0xa31721[_0xb2de('0x4f')]['id']}})['then'](function(_0x2b469c){return db[_0xb2de('0x6e')][_0xb2de('0x6f')](function(_0xca1733){return _0x2b469c['removeTeams'](_0xa31721[_0xb2de('0x39')][_0xb2de('0x6a')],{'transaction':_0xca1733})[_0xb2de('0x2a')](function(){if(!_[_0xb2de('0x83')](_0x12efb0)){return _0x2b469c[_0xb2de('0x84')](_0x12efb0,{'transaction':_0xca1733});}})[_0xb2de('0x2a')](function(){_0x12efb0[_0xb2de('0x85')](function(_0x41498c){socket[_0xb2de('0x86')]('userSmsQueue:remove',{'UserId':_0x41498c,'SmsQueueId':_0x2b469c['id']});});});});});});})[_0xb2de('0x2a')](respondWithStatusCode(_0x2a7c33,null))['catch'](handleError(_0x2a7c33,null));};exports[_0xb2de('0x87')]=function(_0x16a0d8,_0x56df5a,_0x4a4b19){return db[_0xb2de('0x34')][_0xb2de('0x52')]({'where':{'id':_0x16a0d8[_0xb2de('0x4f')]['id']}})[_0xb2de('0x2a')](handleEntityNotFound(_0x56df5a,null))['then'](function(_0xea09c4){if(_0xea09c4){return _0xea09c4[_0xb2de('0x87')](_0x16a0d8[_0xb2de('0x53')][_0xb2de('0x6a')],_[_0xb2de('0x88')](_0x16a0d8[_0xb2de('0x53')],[_0xb2de('0x6a'),'id'])||{})['spread'](function(_0x3deaab){for(var _0x5e23e8=0x0;_0x5e23e8<_0x16a0d8[_0xb2de('0x53')][_0xb2de('0x6a')][_0xb2de('0x51')];_0x5e23e8+=0x1){socket[_0xb2de('0x86')](_0xb2de('0x89'),{'UserId':_0x16a0d8[_0xb2de('0x53')][_0xb2de('0x6a')][_0x5e23e8],'SmsQueueId':_0x16a0d8[_0xb2de('0x4f')]['id']});}return _0x3deaab;});}})['then'](respondWithResult(_0x56df5a,null))[_0xb2de('0x4d')](handleError(_0x56df5a,null));};exports[_0xb2de('0x84')]=function(_0x22fd9b,_0x54d39b,_0x392aef){return db[_0xb2de('0x34')]['find']({'where':{'id':_0x22fd9b[_0xb2de('0x4f')]['id']}})[_0xb2de('0x2a')](handleEntityNotFound(_0x54d39b,null))['then'](function(_0x5f035f){if(_0x5f035f){return _0x5f035f['removeAgents'](_0x22fd9b[_0xb2de('0x39')][_0xb2de('0x6a')])[_0xb2de('0x2a')](function(){if(_[_0xb2de('0x8a')](_0x22fd9b[_0xb2de('0x39')]['ids'])){for(var _0x31740e=0x0;_0x31740e<_0x22fd9b['query']['ids'][_0xb2de('0x51')];_0x31740e+=0x1){socket[_0xb2de('0x86')](_0xb2de('0x8b'),{'UserId':Number(_0x22fd9b[_0xb2de('0x39')][_0xb2de('0x6a')][_0x31740e]),'SmsQueueId':Number(_0x22fd9b[_0xb2de('0x4f')]['id'])});}}else{socket[_0xb2de('0x86')](_0xb2de('0x8b'),{'UserId':Number(_0x22fd9b[_0xb2de('0x39')][_0xb2de('0x6a')]),'SmsQueueId':Number(_0x22fd9b['params']['id'])});}});}})[_0xb2de('0x2a')](respondWithStatusCode(_0x54d39b,null))[_0xb2de('0x4d')](handleError(_0x54d39b,null));};exports['getAgents']=function(_0x3b3677,_0x1d5c9b,_0x2f67c8){var _0x374266={};var _0x210019={};var _0x587ea9;var _0x1829f6;return db[_0xb2de('0x34')][_0xb2de('0x5b')]({'where':{'id':_0x3b3677[_0xb2de('0x4f')]['id']}})[_0xb2de('0x2a')](handleEntityNotFound(_0x1d5c9b,null))[_0xb2de('0x2a')](function(_0x41f81c){if(_0x41f81c){_0x587ea9=_0x41f81c;_0x210019['model']=_[_0xb2de('0x3a')](db[_0xb2de('0x5f')]['rawAttributes']);_0x210019['query']=_['keys'](_0x3b3677[_0xb2de('0x39')]);_0x210019['filters']=_['intersection'](_0x210019[_0xb2de('0x38')],_0x210019[_0xb2de('0x39')]);_0x374266[_0xb2de('0x3d')]=_[_0xb2de('0x3c')](_0x210019[_0xb2de('0x38')],qs[_0xb2de('0x3e')](_0x3b3677[_0xb2de('0x39')][_0xb2de('0x3e')]));_0x374266[_0xb2de('0x3d')]=_0x374266[_0xb2de('0x3d')]['length']?_0x374266[_0xb2de('0x3d')]:_0x210019[_0xb2de('0x38')];_0x374266[_0xb2de('0x42')]=qs[_0xb2de('0x43')](_0x3b3677['query'][_0xb2de('0x43')]);_0x374266[_0xb2de('0x46')]=qs[_0xb2de('0x3b')](_[_0xb2de('0x44')](_0x3b3677['query'],_0x210019[_0xb2de('0x3b')]));if(_0x3b3677['query'][_0xb2de('0x45')]){_0x374266[_0xb2de('0x46')]=_[_0xb2de('0x47')](_0x374266[_0xb2de('0x46')],{'$or':_['map'](_0x374266[_0xb2de('0x3d')],function(_0x11a909){var _0x54f3d1={};_0x54f3d1[_0x11a909]={'$like':'%'+_0x3b3677[_0xb2de('0x39')][_0xb2de('0x45')]+'%'};return _0x54f3d1;})});}_0x374266=_[_0xb2de('0x47')]({},_0x374266,_0x3b3677[_0xb2de('0x5d')]);return _0x587ea9[_0xb2de('0x8c')](_0x374266);}})['then'](function(_0x212322){if(_0x212322){_0x1829f6=_0x212322[_0xb2de('0x51')];if(!_0x3b3677[_0xb2de('0x39')]['hasOwnProperty'](_0xb2de('0x40'))){_0x374266[_0xb2de('0x41')]=qs[_0xb2de('0x41')](_0x3b3677[_0xb2de('0x39')][_0xb2de('0x41')]);_0x374266[_0xb2de('0x23')]=qs[_0xb2de('0x23')](_0x3b3677['query'][_0xb2de('0x23')]);}return _0x587ea9[_0xb2de('0x8c')](_0x374266);}})[_0xb2de('0x2a')](function(_0x401c73){if(_0x401c73){return _0x401c73?{'count':_0x1829f6,'rows':_0x401c73}:null;}})[_0xb2de('0x2a')](respondWithResult(_0x1d5c9b,null))[_0xb2de('0x4d')](handleError(_0x1d5c9b,null));}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.events.js b/server/api/smsQueue/smsQueue.events.js index f8588cc..ba0058c 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 _0x9931=['SmsQueue','setMaxListeners','save','update','remove','hasOwnProperty','hook','exports','../../mysqldb'];(function(_0x5a56eb,_0x310171){var _0x2ff029=function(_0x1aa403){while(--_0x1aa403){_0x5a56eb['push'](_0x5a56eb['shift']());}};_0x2ff029(++_0x310171);}(_0x9931,0x116));var _0x1993=function(_0x47b204,_0x147951){_0x47b204=_0x47b204-0x0;var _0x3956a1=_0x9931[_0x47b204];return _0x3956a1;};'use strict';var EventEmitter=require('events');var SmsQueue=require(_0x1993('0x0'))['db'][_0x1993('0x1')];var SmsQueueEvents=new EventEmitter();SmsQueueEvents[_0x1993('0x2')](0x0);var events={'afterCreate':_0x1993('0x3'),'afterUpdate':_0x1993('0x4'),'afterDestroy':_0x1993('0x5')};function emitEvent(_0x233539){return function(_0x5e9bde,_0x56435c,_0x2cf407){SmsQueueEvents['emit'](_0x233539+':'+_0x5e9bde['id'],_0x5e9bde);SmsQueueEvents['emit'](_0x233539,_0x5e9bde);_0x2cf407(null);};}for(var e in events){if(events[_0x1993('0x6')](e)){var event=events[e];SmsQueue[_0x1993('0x7')](e,emitEvent(event));}}module[_0x1993('0x8')]=SmsQueueEvents; \ No newline at end of file +var _0x05e2=['emit','hasOwnProperty','hook','exports','events','../../mysqldb','SmsQueue','setMaxListeners','save','update','remove'];(function(_0x4e4131,_0x2a7207){var _0x38a874=function(_0x3c89d6){while(--_0x3c89d6){_0x4e4131['push'](_0x4e4131['shift']());}};_0x38a874(++_0x2a7207);}(_0x05e2,0xe0));var _0x205e=function(_0x3c2666,_0x15fd23){_0x3c2666=_0x3c2666-0x0;var _0x10c814=_0x05e2[_0x3c2666];return _0x10c814;};'use strict';var EventEmitter=require(_0x205e('0x0'));var SmsQueue=require(_0x205e('0x1'))['db'][_0x205e('0x2')];var SmsQueueEvents=new EventEmitter();SmsQueueEvents[_0x205e('0x3')](0x0);var events={'afterCreate':_0x205e('0x4'),'afterUpdate':_0x205e('0x5'),'afterDestroy':_0x205e('0x6')};function emitEvent(_0x39c1eb){return function(_0x28f9cd,_0x9ef671,_0x24b4d2){SmsQueueEvents[_0x205e('0x7')](_0x39c1eb+':'+_0x28f9cd['id'],_0x28f9cd);SmsQueueEvents[_0x205e('0x7')](_0x39c1eb,_0x28f9cd);_0x24b4d2(null);};}for(var e in events){if(events[_0x205e('0x8')](e)){var event=events[e];SmsQueue[_0x205e('0x9')](e,emitEvent(event));}}module[_0x205e('0xa')]=SmsQueueEvents; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.model.js b/server/api/smsQueue/smsQueue.model.js index a054185..1af3a39 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 _0x9335=['SmsQueue','sms_queues','lodash','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define'];(function(_0x560653,_0x3c1465){var _0x1f850c=function(_0x2d3b7c){while(--_0x2d3b7c){_0x560653['push'](_0x560653['shift']());}};_0x1f850c(++_0x3c1465);}(_0x9335,0xab));var _0x5933=function(_0x57bf9f,_0x2fbfcf){_0x57bf9f=_0x57bf9f-0x0;var _0x46b1e1=_0x9335[_0x57bf9f];return _0x46b1e1;};'use strict';var _=require(_0x5933('0x0'));var util=require(_0x5933('0x1'));var logger=require('../../config/logger')(_0x5933('0x2'));var moment=require(_0x5933('0x3'));var BPromise=require(_0x5933('0x4'));var rp=require(_0x5933('0x5'));var fs=require('fs');var path=require(_0x5933('0x6'));var rimraf=require(_0x5933('0x7'));var config=require(_0x5933('0x8'));var attributes=require('./smsQueue.attributes');module[_0x5933('0x9')]=function(_0x4de024,_0x553710){return _0x4de024[_0x5933('0xa')](_0x5933('0xb'),attributes,{'tableName':_0x5933('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xbd3b=['request-promise','path','../../config/environment','./smsQueue.attributes','define','SmsQueue','sms_queues','lodash','util','../../config/logger','moment','bluebird'];(function(_0x15542f,_0x4019bf){var _0x46f5de=function(_0x2726e1){while(--_0x2726e1){_0x15542f['push'](_0x15542f['shift']());}};_0x46f5de(++_0x4019bf);}(_0xbd3b,0x1c3));var _0xbbd3=function(_0x5edafc,_0x22002c){_0x5edafc=_0x5edafc-0x0;var _0x1fa600=_0xbd3b[_0x5edafc];return _0x1fa600;};'use strict';var _=require(_0xbbd3('0x0'));var util=require(_0xbbd3('0x1'));var logger=require(_0xbbd3('0x2'))('api');var moment=require(_0xbbd3('0x3'));var BPromise=require(_0xbbd3('0x4'));var rp=require(_0xbbd3('0x5'));var fs=require('fs');var path=require(_0xbbd3('0x6'));var rimraf=require('rimraf');var config=require(_0xbbd3('0x7'));var attributes=require(_0xbbd3('0x8'));module['exports']=function(_0x2e1bcb,_0x494774){return _0x2e1bcb[_0xbbd3('0x9')](_0xbbd3('0xa'),attributes,{'tableName':_0xbbd3('0xb'),'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 3278f2e..968d74c 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 _0x0552=['catch','SmsQueue','findAll','options','where','limit','include','map','model','attributes','GetSmsQueue','stringify','find','raw','ShowSmsQueue','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','redis','localhost','./smsQueue.socket','register','request','then','info','SmsQueue,\x20%s,\x20%s','request\x20sent','debug','SmsQueue,\x20%s,\x20%s,\x20%s','error','message','result'];(function(_0x356307,_0xe0a012){var _0x59e722=function(_0x31348d){while(--_0x31348d){_0x356307['push'](_0x356307['shift']());}};_0x59e722(++_0xe0a012);}(_0x0552,0x135));var _0x2055=function(_0x5bb2fe,_0x1cdfbe){_0x5bb2fe=_0x5bb2fe-0x0;var _0x16c5b9=_0x0552[_0x5bb2fe];return _0x16c5b9;};'use strict';var _=require(_0x2055('0x0'));var util=require(_0x2055('0x1'));var moment=require(_0x2055('0x2'));var BPromise=require(_0x2055('0x3'));var rs=require(_0x2055('0x4'));var fs=require('fs');var Redis=require(_0x2055('0x5'));var db=require(_0x2055('0x6'))['db'];var utils=require(_0x2055('0x7'));var logger=require(_0x2055('0x8'))('rpc');var config=require(_0x2055('0x9'));var jayson=require(_0x2055('0xa'));var client=jayson[_0x2055('0xb')][_0x2055('0xc')]({'port':0x232a});config[_0x2055('0xd')]=_['defaults'](config[_0x2055('0xd')],{'host':_0x2055('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x2055('0xd')]));require(_0x2055('0xf'))[_0x2055('0x10')](socket);function respondWithRpcPromise(_0x14c7b8,_0x10deec,_0x6696cd){return new BPromise(function(_0x88ed00,_0x41f33f){return client[_0x2055('0x11')](_0x14c7b8,_0x6696cd)[_0x2055('0x12')](function(_0xdbfdab){logger[_0x2055('0x13')](_0x2055('0x14'),_0x10deec,_0x2055('0x15'));logger[_0x2055('0x16')](_0x2055('0x17'),_0x10deec,_0x2055('0x15'),JSON['stringify'](_0xdbfdab));if(_0xdbfdab[_0x2055('0x18')]){if(_0xdbfdab[_0x2055('0x18')]['code']===0x1f4){logger[_0x2055('0x18')](_0x2055('0x14'),_0x10deec,_0xdbfdab[_0x2055('0x18')][_0x2055('0x19')]);return _0x41f33f(_0xdbfdab[_0x2055('0x18')][_0x2055('0x19')]);}logger[_0x2055('0x18')](_0x2055('0x14'),_0x10deec,_0xdbfdab['error'][_0x2055('0x19')]);return _0x88ed00(_0xdbfdab[_0x2055('0x18')][_0x2055('0x19')]);}else{logger[_0x2055('0x13')]('SmsQueue,\x20%s,\x20%s',_0x10deec,'request\x20sent');_0x88ed00(_0xdbfdab[_0x2055('0x1a')]['message']);}})[_0x2055('0x1b')](function(_0x355ef7){logger['error']('SmsQueue,\x20%s,\x20%s',_0x10deec,_0x355ef7);_0x41f33f(_0x355ef7);});});}exports['GetSmsQueue']=function(_0x1874c7){var _0x555eeb=this;return new Promise(function(_0x2eebd5,_0x559c30){return db[_0x2055('0x1c')][_0x2055('0x1d')]({'raw':_0x1874c7['options']?_0x1874c7['options']['raw']===undefined?!![]:![]:!![],'where':_0x1874c7[_0x2055('0x1e')]?_0x1874c7[_0x2055('0x1e')][_0x2055('0x1f')]||null:null,'attributes':_0x1874c7[_0x2055('0x1e')]?_0x1874c7['options']['attributes']||null:null,'limit':_0x1874c7[_0x2055('0x1e')]?_0x1874c7[_0x2055('0x1e')][_0x2055('0x20')]||null:null,'include':_0x1874c7['options']?_0x1874c7[_0x2055('0x1e')][_0x2055('0x21')]?_[_0x2055('0x22')](_0x1874c7[_0x2055('0x1e')][_0x2055('0x21')],function(_0x5b95f8){return{'model':db[_0x5b95f8[_0x2055('0x23')]],'as':_0x5b95f8['as'],'attributes':_0x5b95f8[_0x2055('0x24')],'include':_0x5b95f8[_0x2055('0x21')]?_[_0x2055('0x22')](_0x5b95f8[_0x2055('0x21')],function(_0x1d6ef4){return{'model':db[_0x1d6ef4['model']],'as':_0x1d6ef4['as'],'attributes':_0x1d6ef4[_0x2055('0x24')],'include':_0x1d6ef4[_0x2055('0x21')]?_['map'](_0x1d6ef4[_0x2055('0x21')],function(_0x2bed4c){return{'model':db[_0x2bed4c[_0x2055('0x23')]],'as':_0x2bed4c['as'],'attributes':_0x2bed4c['attributes']};}):[]};}):[]};}):[]:[]})[_0x2055('0x12')](function(_0x193dc7){logger['info']('GetSmsQueue',_0x1874c7);logger[_0x2055('0x16')](_0x2055('0x25'),_0x1874c7,JSON[_0x2055('0x26')](_0x193dc7));_0x2eebd5(_0x193dc7);})[_0x2055('0x1b')](function(_0x805c2d){logger[_0x2055('0x18')](_0x2055('0x25'),_0x805c2d[_0x2055('0x19')],_0x1874c7);_0x559c30(_0x555eeb[_0x2055('0x18')](0x1f4,_0x805c2d['message']));});});};exports['ShowSmsQueue']=function(_0xf4a5d6){var _0x3b173c=this;return new Promise(function(_0x43e6f9,_0x28776d){return db['SmsQueue'][_0x2055('0x27')]({'raw':_0xf4a5d6[_0x2055('0x1e')]?_0xf4a5d6[_0x2055('0x1e')][_0x2055('0x28')]===undefined?!![]:![]:!![],'where':_0xf4a5d6['options']?_0xf4a5d6[_0x2055('0x1e')][_0x2055('0x1f')]||null:null,'attributes':_0xf4a5d6[_0x2055('0x1e')]?_0xf4a5d6['options'][_0x2055('0x24')]||null:null,'include':_0xf4a5d6['options']?_0xf4a5d6['options'][_0x2055('0x21')]?_[_0x2055('0x22')](_0xf4a5d6[_0x2055('0x1e')][_0x2055('0x21')],function(_0x5c9eb5){return{'model':db[_0x5c9eb5['model']],'as':_0x5c9eb5['as'],'attributes':_0x5c9eb5['attributes'],'include':_0x5c9eb5[_0x2055('0x21')]?_[_0x2055('0x22')](_0x5c9eb5[_0x2055('0x21')],function(_0x6801f){return{'model':db[_0x6801f[_0x2055('0x23')]],'as':_0x6801f['as'],'attributes':_0x6801f[_0x2055('0x24')],'include':_0x6801f[_0x2055('0x21')]?_['map'](_0x6801f['include'],function(_0x329dcc){return{'model':db[_0x329dcc['model']],'as':_0x329dcc['as'],'attributes':_0x329dcc[_0x2055('0x24')]};}):[]};}):[]};}):[]:[]})[_0x2055('0x12')](function(_0x574ab1){logger[_0x2055('0x13')]('ShowSmsQueue',_0xf4a5d6);logger['debug'](_0x2055('0x29'),_0xf4a5d6,JSON[_0x2055('0x26')](_0x574ab1));_0x43e6f9(_0x574ab1);})[_0x2055('0x1b')](function(_0x4774ec){logger[_0x2055('0x18')](_0x2055('0x29'),_0x4774ec[_0x2055('0x19')],_0xf4a5d6);_0x28776d(_0x3b173c[_0x2055('0x18')](0x1f4,_0x4774ec[_0x2055('0x19')]));});});}; \ No newline at end of file +var _0xf3a6=['lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./smsQueue.socket','register','request','then','info','SmsQueue,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','catch','GetSmsQueue','findAll','options','raw','where','attributes','limit','include','map','model','ShowSmsQueue','SmsQueue','find'];(function(_0x2d0bdd,_0x299c2f){var _0x80ebfb=function(_0x15c145){while(--_0x15c145){_0x2d0bdd['push'](_0x2d0bdd['shift']());}};_0x80ebfb(++_0x299c2f);}(_0xf3a6,0x183));var _0x6f3a=function(_0x550d12,_0x5384bd){_0x550d12=_0x550d12-0x0;var _0x12103d=_0xf3a6[_0x550d12];return _0x12103d;};'use strict';var _=require(_0x6f3a('0x0'));var util=require(_0x6f3a('0x1'));var moment=require(_0x6f3a('0x2'));var BPromise=require(_0x6f3a('0x3'));var rs=require(_0x6f3a('0x4'));var fs=require('fs');var Redis=require(_0x6f3a('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x6f3a('0x6'));var logger=require(_0x6f3a('0x7'))(_0x6f3a('0x8'));var config=require(_0x6f3a('0x9'));var jayson=require(_0x6f3a('0xa'));var client=jayson[_0x6f3a('0xb')][_0x6f3a('0xc')]({'port':0x232a});config[_0x6f3a('0xd')]=_[_0x6f3a('0xe')](config['redis'],{'host':_0x6f3a('0xf'),'port':0x18eb});var socket=require(_0x6f3a('0x10'))(new Redis(config[_0x6f3a('0xd')]));require(_0x6f3a('0x11'))[_0x6f3a('0x12')](socket);function respondWithRpcPromise(_0x425b5c,_0x3e3978,_0x53f096){return new BPromise(function(_0x1f9f71,_0x147728){return client[_0x6f3a('0x13')](_0x425b5c,_0x53f096)[_0x6f3a('0x14')](function(_0xfa2cdf){logger[_0x6f3a('0x15')](_0x6f3a('0x16'),_0x3e3978,_0x6f3a('0x17'));logger[_0x6f3a('0x18')]('SmsQueue,\x20%s,\x20%s,\x20%s',_0x3e3978,_0x6f3a('0x17'),JSON[_0x6f3a('0x19')](_0xfa2cdf));if(_0xfa2cdf[_0x6f3a('0x1a')]){if(_0xfa2cdf[_0x6f3a('0x1a')]['code']===0x1f4){logger[_0x6f3a('0x1a')]('SmsQueue,\x20%s,\x20%s',_0x3e3978,_0xfa2cdf[_0x6f3a('0x1a')][_0x6f3a('0x1b')]);return _0x147728(_0xfa2cdf[_0x6f3a('0x1a')][_0x6f3a('0x1b')]);}logger[_0x6f3a('0x1a')](_0x6f3a('0x16'),_0x3e3978,_0xfa2cdf[_0x6f3a('0x1a')][_0x6f3a('0x1b')]);return _0x1f9f71(_0xfa2cdf[_0x6f3a('0x1a')][_0x6f3a('0x1b')]);}else{logger[_0x6f3a('0x15')](_0x6f3a('0x16'),_0x3e3978,_0x6f3a('0x17'));_0x1f9f71(_0xfa2cdf[_0x6f3a('0x1c')]['message']);}})[_0x6f3a('0x1d')](function(_0x20a562){logger[_0x6f3a('0x1a')](_0x6f3a('0x16'),_0x3e3978,_0x20a562);_0x147728(_0x20a562);});});}exports[_0x6f3a('0x1e')]=function(_0x3a763c){var _0x324130=this;return new Promise(function(_0x536a17,_0x3ed538){return db['SmsQueue'][_0x6f3a('0x1f')]({'raw':_0x3a763c[_0x6f3a('0x20')]?_0x3a763c[_0x6f3a('0x20')][_0x6f3a('0x21')]===undefined?!![]:![]:!![],'where':_0x3a763c['options']?_0x3a763c['options'][_0x6f3a('0x22')]||null:null,'attributes':_0x3a763c[_0x6f3a('0x20')]?_0x3a763c[_0x6f3a('0x20')][_0x6f3a('0x23')]||null:null,'limit':_0x3a763c[_0x6f3a('0x20')]?_0x3a763c[_0x6f3a('0x20')][_0x6f3a('0x24')]||null:null,'include':_0x3a763c['options']?_0x3a763c[_0x6f3a('0x20')][_0x6f3a('0x25')]?_[_0x6f3a('0x26')](_0x3a763c[_0x6f3a('0x20')]['include'],function(_0x3eb47c){return{'model':db[_0x3eb47c[_0x6f3a('0x27')]],'as':_0x3eb47c['as'],'attributes':_0x3eb47c[_0x6f3a('0x23')],'include':_0x3eb47c['include']?_[_0x6f3a('0x26')](_0x3eb47c['include'],function(_0x3b4cce){return{'model':db[_0x3b4cce[_0x6f3a('0x27')]],'as':_0x3b4cce['as'],'attributes':_0x3b4cce[_0x6f3a('0x23')],'include':_0x3b4cce[_0x6f3a('0x25')]?_[_0x6f3a('0x26')](_0x3b4cce[_0x6f3a('0x25')],function(_0xc0266a){return{'model':db[_0xc0266a[_0x6f3a('0x27')]],'as':_0xc0266a['as'],'attributes':_0xc0266a[_0x6f3a('0x23')]};}):[]};}):[]};}):[]:[]})[_0x6f3a('0x14')](function(_0x1186c1){logger[_0x6f3a('0x15')](_0x6f3a('0x1e'),_0x3a763c);logger[_0x6f3a('0x18')](_0x6f3a('0x1e'),_0x3a763c,JSON[_0x6f3a('0x19')](_0x1186c1));_0x536a17(_0x1186c1);})['catch'](function(_0x4b92f1){logger[_0x6f3a('0x1a')](_0x6f3a('0x1e'),_0x4b92f1[_0x6f3a('0x1b')],_0x3a763c);_0x3ed538(_0x324130[_0x6f3a('0x1a')](0x1f4,_0x4b92f1[_0x6f3a('0x1b')]));});});};exports[_0x6f3a('0x28')]=function(_0x28c653){var _0x193e50=this;return new Promise(function(_0x366a82,_0x15817b){return db[_0x6f3a('0x29')][_0x6f3a('0x2a')]({'raw':_0x28c653['options']?_0x28c653[_0x6f3a('0x20')][_0x6f3a('0x21')]===undefined?!![]:![]:!![],'where':_0x28c653[_0x6f3a('0x20')]?_0x28c653[_0x6f3a('0x20')][_0x6f3a('0x22')]||null:null,'attributes':_0x28c653[_0x6f3a('0x20')]?_0x28c653[_0x6f3a('0x20')][_0x6f3a('0x23')]||null:null,'include':_0x28c653[_0x6f3a('0x20')]?_0x28c653[_0x6f3a('0x20')]['include']?_[_0x6f3a('0x26')](_0x28c653['options'][_0x6f3a('0x25')],function(_0x1c6e58){return{'model':db[_0x1c6e58[_0x6f3a('0x27')]],'as':_0x1c6e58['as'],'attributes':_0x1c6e58['attributes'],'include':_0x1c6e58[_0x6f3a('0x25')]?_[_0x6f3a('0x26')](_0x1c6e58['include'],function(_0x3f83e7){return{'model':db[_0x3f83e7[_0x6f3a('0x27')]],'as':_0x3f83e7['as'],'attributes':_0x3f83e7['attributes'],'include':_0x3f83e7['include']?_[_0x6f3a('0x26')](_0x3f83e7[_0x6f3a('0x25')],function(_0xf22bbd){return{'model':db[_0xf22bbd[_0x6f3a('0x27')]],'as':_0xf22bbd['as'],'attributes':_0xf22bbd[_0x6f3a('0x23')]};}):[]};}):[]};}):[]:[]})['then'](function(_0xd3eea1){logger['info'](_0x6f3a('0x28'),_0x28c653);logger[_0x6f3a('0x18')]('ShowSmsQueue',_0x28c653,JSON[_0x6f3a('0x19')](_0xd3eea1));_0x366a82(_0xd3eea1);})[_0x6f3a('0x1d')](function(_0x58ae05){logger['error'](_0x6f3a('0x28'),_0x58ae05[_0x6f3a('0x1b')],_0x28c653);_0x15817b(_0x193e50['error'](0x1f4,_0x58ae05[_0x6f3a('0x1b')]));});});}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.socket.js b/server/api/smsQueue/smsQueue.socket.js index 5fd94fc..3442bdc 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 _0xa460=['length','./smsQueue.events','save','remove','update','emit','removeListener','register'];(function(_0x37f651,_0x4e02e7){var _0x36613d=function(_0x361f9c){while(--_0x361f9c){_0x37f651['push'](_0x37f651['shift']());}};_0x36613d(++_0x4e02e7);}(_0xa460,0xe1));var _0x0a46=function(_0x151ecd,_0x18ecb1){_0x151ecd=_0x151ecd-0x0;var _0x4c2325=_0xa460[_0x151ecd];return _0x4c2325;};'use strict';var SmsQueueEvents=require(_0x0a46('0x0'));var events=[_0x0a46('0x1'),_0x0a46('0x2'),_0x0a46('0x3')];function createListener(_0x285f6c,_0xbe3230){return function(_0x47f5e5){_0xbe3230[_0x0a46('0x4')](_0x285f6c,_0x47f5e5);};}function removeListener(_0x522614,_0x3387a3){return function(){SmsQueueEvents[_0x0a46('0x5')](_0x522614,_0x3387a3);};}exports[_0x0a46('0x6')]=function(_0xf8e34c){for(var _0x1c68df=0x0,_0x3da504=events[_0x0a46('0x7')];_0x1c68df<_0x3da504;_0x1c68df++){var _0x587517=events[_0x1c68df];var _0x518554=createListener('smsQueue:'+_0x587517,_0xf8e34c);SmsQueueEvents['on'](_0x587517,_0x518554);}}; \ No newline at end of file +var _0x1d91=['emit','removeListener','register','length','./smsQueue.events','save','remove','update'];(function(_0x5c965a,_0x42cc16){var _0x3b6bd9=function(_0x3ba393){while(--_0x3ba393){_0x5c965a['push'](_0x5c965a['shift']());}};_0x3b6bd9(++_0x42cc16);}(_0x1d91,0x64));var _0x11d9=function(_0x5b9031,_0x1ecf8a){_0x5b9031=_0x5b9031-0x0;var _0x522398=_0x1d91[_0x5b9031];return _0x522398;};'use strict';var SmsQueueEvents=require(_0x11d9('0x0'));var events=[_0x11d9('0x1'),_0x11d9('0x2'),_0x11d9('0x3')];function createListener(_0x2c7381,_0x107c14){return function(_0x250003){_0x107c14[_0x11d9('0x4')](_0x2c7381,_0x250003);};}function removeListener(_0x5db550,_0x1f32ef){return function(){SmsQueueEvents[_0x11d9('0x5')](_0x5db550,_0x1f32ef);};}exports[_0x11d9('0x6')]=function(_0x3b304d){for(var _0x4b6de4=0x0,_0x56533e=events[_0x11d9('0x7')];_0x4b6de4<_0x56533e;_0x4b6de4++){var _0x4bda7a=events[_0x4b6de4];var _0x3347c1=createListener('smsQueue:'+_0x4bda7a,_0x3b304d);SmsQueueEvents['on'](_0x4bda7a,_0x3347c1);}}; \ No newline at end of file diff --git a/server/api/smsQueueReport/index.js b/server/api/smsQueueReport/index.js index ffa3cc1..8318231 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 _0x3746=['Router','../../components/auth/service','../../config/environment','./smsQueueReport.controller','get','isAuthenticated','index','describe','/:id','post','put','update','destroy','exports','multer','util','path','connect-timeout'];(function(_0x5c4ffe,_0x585a37){var _0x4f55fb=function(_0x4a9d4b){while(--_0x4a9d4b){_0x5c4ffe['push'](_0x5c4ffe['shift']());}};_0x4f55fb(++_0x585a37);}(_0x3746,0x1e2));var _0x6374=function(_0x31eddb,_0x51f673){_0x31eddb=_0x31eddb-0x0;var _0x1ee2f6=_0x3746[_0x31eddb];return _0x1ee2f6;};'use strict';var multer=require(_0x6374('0x0'));var util=require(_0x6374('0x1'));var path=require(_0x6374('0x2'));var timeout=require(_0x6374('0x3'));var express=require('express');var router=express[_0x6374('0x4')]();var auth=require(_0x6374('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x6374('0x6'));var controller=require(_0x6374('0x7'));router[_0x6374('0x8')]('/',auth[_0x6374('0x9')](),controller[_0x6374('0xa')]);router[_0x6374('0x8')]('/describe',auth['isAuthenticated'](),controller[_0x6374('0xb')]);router[_0x6374('0x8')](_0x6374('0xc'),auth[_0x6374('0x9')](),controller['show']);router[_0x6374('0xd')]('/',auth[_0x6374('0x9')](),controller['create']);router[_0x6374('0xe')](_0x6374('0xc'),auth[_0x6374('0x9')](),controller[_0x6374('0xf')]);router['delete'](_0x6374('0xc'),auth[_0x6374('0x9')](),controller[_0x6374('0x10')]);module[_0x6374('0x11')]=router; \ No newline at end of file +var _0x66e1=['../../components/auth/service','index','get','/describe','isAuthenticated','describe','show','post','create','/:id','delete','destroy','exports','multer','util','path','connect-timeout','express'];(function(_0x5c3347,_0x1a7bbf){var _0x4dc774=function(_0x3cd66d){while(--_0x3cd66d){_0x5c3347['push'](_0x5c3347['shift']());}};_0x4dc774(++_0x1a7bbf);}(_0x66e1,0xd3));var _0x166e=function(_0xd0b415,_0x149675){_0xd0b415=_0xd0b415-0x0;var _0x2bdf2c=_0x66e1[_0xd0b415];return _0x2bdf2c;};'use strict';var multer=require(_0x166e('0x0'));var util=require(_0x166e('0x1'));var path=require(_0x166e('0x2'));var timeout=require(_0x166e('0x3'));var express=require(_0x166e('0x4'));var router=express['Router']();var auth=require(_0x166e('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./smsQueueReport.controller');router['get']('/',auth['isAuthenticated'](),controller[_0x166e('0x6')]);router[_0x166e('0x7')](_0x166e('0x8'),auth[_0x166e('0x9')](),controller[_0x166e('0xa')]);router['get']('/:id',auth[_0x166e('0x9')](),controller[_0x166e('0xb')]);router[_0x166e('0xc')]('/',auth[_0x166e('0x9')](),controller[_0x166e('0xd')]);router['put'](_0x166e('0xe'),auth[_0x166e('0x9')](),controller['update']);router[_0x166e('0xf')]('/:id',auth[_0x166e('0x9')](),controller[_0x166e('0x10')]);module[_0x166e('0x11')]=router; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.attributes.js b/server/api/smsQueueReport/smsQueueReport.attributes.js index 743ca78..5c204ab 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 _0x3667=['moment','sequelize','STRING','DATE'];(function(_0xbd1f60,_0x470e77){var _0x25802f=function(_0xcf5985){while(--_0xcf5985){_0xbd1f60['push'](_0xbd1f60['shift']());}};_0x25802f(++_0x470e77);}(_0x3667,0x1ec));var _0x7366=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3667[_0x3dd15e];return _0x231fd0;};'use strict';var moment=require(_0x7366('0x0'));var Sequelize=require(_0x7366('0x1'));module['exports']={'uniqueid':{'type':Sequelize[_0x7366('0x2')],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0x7366('0x3')]},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize[_0x7366('0x3')]},'exitAt':{'type':Sequelize['DATE']},'reason':{'type':Sequelize[_0x7366('0x2')]}}; \ No newline at end of file +var _0x4a8f=['STRING','DATE','moment','sequelize','exports'];(function(_0x53d5d7,_0x76eed8){var _0x29f8e9=function(_0x50df37){while(--_0x50df37){_0x53d5d7['push'](_0x53d5d7['shift']());}};_0x29f8e9(++_0x76eed8);}(_0x4a8f,0x110));var _0xf4a8=function(_0xe45118,_0x5dffbc){_0xe45118=_0xe45118-0x0;var _0x15e15d=_0x4a8f[_0xe45118];return _0x15e15d;};'use strict';var moment=require(_0xf4a8('0x0'));var Sequelize=require(_0xf4a8('0x1'));module[_0xf4a8('0x2')]={'uniqueid':{'type':Sequelize[_0xf4a8('0x3')],'allowNull':![]},'from':{'type':Sequelize[_0xf4a8('0x3')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize[_0xf4a8('0x4')]},'exitAt':{'type':Sequelize[_0xf4a8('0x4')]},'reason':{'type':Sequelize[_0xf4a8('0x3')]}}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.controller.js b/server/api/smsQueueReport/smsQueueReport.controller.js index 3e93132..604be5e 100644 --- a/server/api/smsQueueReport/smsQueueReport.controller.js +++ b/server/api/smsQueueReport/smsQueueReport.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x814b=['index','map','rawAttributes','fieldName','key','model','keys','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','sort','filters','pick','filter','where','merge','VIRTUAL','include','findAll','rows','catch','show','SmsQueueReport','options','find','create','body','params','describe','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','save','update','destroy','then','error','stack','name','send'];(function(_0x5eb281,_0x2a46c1){var _0xde0b5d=function(_0xb87630){while(--_0xb87630){_0x5eb281['push'](_0x5eb281['shift']());}};_0xde0b5d(++_0x2a46c1);}(_0x814b,0x1a2));var _0xb814=function(_0x24679e,_0x22d9d7){_0x24679e=_0x24679e-0x0;var _0x291f21=_0x814b[_0x24679e];return _0x291f21;};'use strict';var pdf=require(_0xb814('0x0'));var emlformat=require(_0xb814('0x1'));var rimraf=require(_0xb814('0x2'));var zipdir=require(_0xb814('0x3'));var jsonpatch=require(_0xb814('0x4'));var rp=require(_0xb814('0x5'));var moment=require('moment');var BPromise=require(_0xb814('0x6'));var Mustache=require(_0xb814('0x7'));var util=require(_0xb814('0x8'));var path=require(_0xb814('0x9'));var sox=require(_0xb814('0xa'));var csv=require(_0xb814('0xb'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xb814('0xc'));var squel=require(_0xb814('0xd'));var crypto=require('crypto');var jsforce=require(_0xb814('0xe'));var deskjs=require(_0xb814('0xf'));var toCsv=require(_0xb814('0xb'));var querystring=require(_0xb814('0x10'));var Papa=require(_0xb814('0x11'));var Redis=require(_0xb814('0x12'));var authService=require(_0xb814('0x13'));var qs=require(_0xb814('0x14'));var as=require(_0xb814('0x15'));var hardwareService=require(_0xb814('0x16'));var logger=require(_0xb814('0x17'))('api');var utils=require(_0xb814('0x18'));var config=require('../../config/environment');var db=require(_0xb814('0x19'))['db'];function respondWithStatusCode(_0x15d6ef,_0x35b10d){_0x35b10d=_0x35b10d||0xcc;return function(_0x2cc46b){if(_0x2cc46b){return _0x15d6ef[_0xb814('0x1a')](_0x35b10d);}return _0x15d6ef[_0xb814('0x1b')](_0x35b10d)[_0xb814('0x1c')]();};}function respondWithResult(_0x41ed7b,_0xa0a2e5){_0xa0a2e5=_0xa0a2e5||0xc8;return function(_0x2ab627){if(_0x2ab627){return _0x41ed7b[_0xb814('0x1b')](_0xa0a2e5)[_0xb814('0x1d')](_0x2ab627);}};}function respondWithFilteredResult(_0x17f5bd,_0x39bfcf){return function(_0x303aca){if(_0x303aca){var _0x3a71d6=_0x303aca[_0xb814('0x1e')],_0x45e0d0=_0x39bfcf[_0xb814('0x1f')],_0x265a83=_0x39bfcf['offset']+_0x39bfcf[_0xb814('0x20')],_0x125ce2;if(_0x265a83>=_0x3a71d6){_0x265a83=_0x3a71d6;_0x125ce2=0xc8;}else{_0x125ce2=0xce;}_0x17f5bd['status'](_0x125ce2);return _0x17f5bd[_0xb814('0x21')](_0xb814('0x22'),_0x45e0d0+'-'+_0x265a83+'/'+_0x3a71d6)['json'](_0x303aca);}return null;};}function patchUpdates(_0x4b55a7){return function(_0x55d63c){try{jsonpatch[_0xb814('0x23')](_0x55d63c,_0x4b55a7,!![]);}catch(_0x4d5276){return BPromise['reject'](_0x4d5276);}return _0x55d63c[_0xb814('0x24')]();};}function saveUpdates(_0x24211d,_0x25b6b6){return function(_0x4e139e){if(_0x4e139e){return _0x4e139e[_0xb814('0x25')](_0x24211d)['then'](function(_0x1e6393){return _0x1e6393;});}return null;};}function removeEntity(_0x1808a3,_0x3b267e){return function(_0x470e81){if(_0x470e81){return _0x470e81[_0xb814('0x26')]()[_0xb814('0x27')](function(){_0x1808a3[_0xb814('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2ead86,_0x52b7a3){return function(_0x3f81d0){if(!_0x3f81d0){_0x2ead86[_0xb814('0x1a')](0x194);}return _0x3f81d0;};}function handleError(_0x31c7ec,_0x208927){_0x208927=_0x208927||0x1f4;return function(_0x1c8a2e){logger[_0xb814('0x28')](_0x1c8a2e[_0xb814('0x29')]);if(_0x1c8a2e['name']){delete _0x1c8a2e[_0xb814('0x2a')];}_0x31c7ec[_0xb814('0x1b')](_0x208927)[_0xb814('0x2b')](_0x1c8a2e);};}exports[_0xb814('0x2c')]=function(_0x32ed56,_0x1d5965){var _0x3f0150={},_0x1e4e89={},_0x5a6291={'count':0x0,'rows':[]};var _0x271aa8=_[_0xb814('0x2d')](db['SmsQueueReport'][_0xb814('0x2e')],function(_0x37d24d){return{'name':_0x37d24d[_0xb814('0x2f')],'type':_0x37d24d['type'][_0xb814('0x30')]};});_0x1e4e89[_0xb814('0x31')]=_['map'](_0x271aa8,_0xb814('0x2a'));_0x1e4e89['query']=_[_0xb814('0x32')](_0x32ed56['query']);_0x1e4e89['filters']=_[_0xb814('0x33')](_0x1e4e89['model'],_0x1e4e89[_0xb814('0x34')]);_0x3f0150[_0xb814('0x35')]=_[_0xb814('0x33')](_0x1e4e89['model'],qs['fields'](_0x32ed56[_0xb814('0x34')][_0xb814('0x36')]));_0x3f0150['attributes']=_0x3f0150[_0xb814('0x35')][_0xb814('0x37')]?_0x3f0150[_0xb814('0x35')]:_0x1e4e89[_0xb814('0x31')];if(!_0x32ed56[_0xb814('0x34')][_0xb814('0x38')](_0xb814('0x39'))){_0x3f0150['limit']=qs[_0xb814('0x20')](_0x32ed56[_0xb814('0x34')][_0xb814('0x20')]);_0x3f0150[_0xb814('0x1f')]=qs[_0xb814('0x1f')](_0x32ed56['query'][_0xb814('0x1f')]);}_0x3f0150['order']=qs[_0xb814('0x3a')](_0x32ed56[_0xb814('0x34')][_0xb814('0x3a')]);_0x3f0150['where']=qs[_0xb814('0x3b')](_[_0xb814('0x3c')](_0x32ed56['query'],_0x1e4e89[_0xb814('0x3b')]),_0x271aa8);if(_0x32ed56[_0xb814('0x34')][_0xb814('0x3d')]){_0x3f0150[_0xb814('0x3e')]=_[_0xb814('0x3f')](_0x3f0150[_0xb814('0x3e')],{'$or':_['map'](_0x271aa8,function(_0xa6ce87){if(_0xa6ce87['type']!==_0xb814('0x40')){var _0x4b5583={};_0x4b5583[_0xa6ce87[_0xb814('0x2a')]]={'$like':'%'+_0x32ed56['query'][_0xb814('0x3d')]+'%'};return _0x4b5583;}})});}_0x3f0150=_[_0xb814('0x3f')]({},_0x3f0150,_0x32ed56['options']);var _0x4d308a={'where':_0x3f0150['where']};return db['SmsQueueReport'][_0xb814('0x1e')](_0x4d308a)[_0xb814('0x27')](function(_0x38cdc2){_0x5a6291[_0xb814('0x1e')]=_0x38cdc2;if(_0x32ed56['query']['includeAll']){_0x3f0150[_0xb814('0x41')]=[{'all':!![]}];}return db['SmsQueueReport'][_0xb814('0x42')](_0x3f0150);})[_0xb814('0x27')](function(_0x178823){_0x5a6291[_0xb814('0x43')]=_0x178823;return _0x5a6291;})[_0xb814('0x27')](respondWithFilteredResult(_0x1d5965,_0x3f0150))[_0xb814('0x44')](handleError(_0x1d5965,null));};exports[_0xb814('0x45')]=function(_0x28b2b4,_0x31989d){var _0x4b6ff8={'raw':!![],'where':{'id':_0x28b2b4['params']['id']}},_0x544d36={};_0x544d36[_0xb814('0x31')]=_['keys'](db[_0xb814('0x46')]['rawAttributes']);_0x544d36[_0xb814('0x34')]=_[_0xb814('0x32')](_0x28b2b4[_0xb814('0x34')]);_0x544d36[_0xb814('0x3b')]=_['intersection'](_0x544d36[_0xb814('0x31')],_0x544d36[_0xb814('0x34')]);_0x4b6ff8[_0xb814('0x35')]=_[_0xb814('0x33')](_0x544d36[_0xb814('0x31')],qs[_0xb814('0x36')](_0x28b2b4['query'][_0xb814('0x36')]));_0x4b6ff8[_0xb814('0x35')]=_0x4b6ff8[_0xb814('0x35')][_0xb814('0x37')]?_0x4b6ff8[_0xb814('0x35')]:_0x544d36[_0xb814('0x31')];if(_0x28b2b4[_0xb814('0x34')]['includeAll']){_0x4b6ff8['include']=[{'all':!![]}];}_0x4b6ff8=_[_0xb814('0x3f')]({},_0x4b6ff8,_0x28b2b4[_0xb814('0x47')]);return db[_0xb814('0x46')][_0xb814('0x48')](_0x4b6ff8)[_0xb814('0x27')](handleEntityNotFound(_0x31989d,null))[_0xb814('0x27')](respondWithResult(_0x31989d,null))[_0xb814('0x44')](handleError(_0x31989d,null));};exports[_0xb814('0x49')]=function(_0x2eb9b6,_0x344198){return db[_0xb814('0x46')]['create'](_0x2eb9b6[_0xb814('0x4a')],{})[_0xb814('0x27')](respondWithResult(_0x344198,0xc9))['catch'](handleError(_0x344198,null));};exports[_0xb814('0x25')]=function(_0x55234d,_0x2fb0f7){if(_0x55234d[_0xb814('0x4a')]['id']){delete _0x55234d[_0xb814('0x4a')]['id'];}return db[_0xb814('0x46')][_0xb814('0x48')]({'where':{'id':_0x55234d[_0xb814('0x4b')]['id']}})[_0xb814('0x27')](handleEntityNotFound(_0x2fb0f7,null))[_0xb814('0x27')](saveUpdates(_0x55234d[_0xb814('0x4a')],null))[_0xb814('0x27')](respondWithResult(_0x2fb0f7,null))['catch'](handleError(_0x2fb0f7,null));};exports['destroy']=function(_0x32eca6,_0x30f07b){return db[_0xb814('0x46')][_0xb814('0x48')]({'where':{'id':_0x32eca6[_0xb814('0x4b')]['id']}})[_0xb814('0x27')](handleEntityNotFound(_0x30f07b,null))[_0xb814('0x27')](removeEntity(_0x30f07b,null))['catch'](handleError(_0x30f07b,null));};exports[_0xb814('0x4c')]=function(_0x388324,_0xf27a6e){return db['SmsQueueReport'][_0xb814('0x4c')]()['then'](respondWithResult(_0xf27a6e,null))[_0xb814('0x44')](handleError(_0xf27a6e,null));}; \ No newline at end of file +var _0xc4aa=['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','SmsQueueReport','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','destroy','describe','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x342baa,_0x4a110f){_0x342baa=_0x342baa-0x0;var _0x1208f3=_0xc4aa[_0x342baa];return _0x1208f3;};'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['SmsQueueReport']['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['SmsQueueReport'][_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['SmsQueueReport'][_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['SmsQueueReport'][_0xac4a('0x45')]({'where':{'id':_0x424f9b[_0xac4a('0x43')]['id']}})[_0xac4a('0x22')](handleEntityNotFound(_0x1c8c39,null))[_0xac4a('0x22')](removeEntity(_0x1c8c39,null))[_0xac4a('0x42')](handleError(_0x1c8c39,null));};exports[_0xac4a('0x49')]=function(_0x187306,_0x4e6e19){return db[_0xac4a('0x29')][_0xac4a('0x49')]()['then'](respondWithResult(_0x4e6e19,null))[_0xac4a('0x42')](handleError(_0x4e6e19,null));}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.model.js b/server/api/smsQueueReport/smsQueueReport.model.js index 0283d72..f672740 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 _0xb010=['request-promise','path','rimraf','./smsQueueReport.attributes','define','SmsQueueReport','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x3e4f74,_0x26ce71){var _0xd07d99=function(_0x2b09b0){while(--_0x2b09b0){_0x3e4f74['push'](_0x3e4f74['shift']());}};_0xd07d99(++_0x26ce71);}(_0xb010,0xae));var _0x0b01=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xb010[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0x0b01('0x0'));var util=require(_0x0b01('0x1'));var logger=require(_0x0b01('0x2'))(_0x0b01('0x3'));var moment=require(_0x0b01('0x4'));var BPromise=require(_0x0b01('0x5'));var rp=require(_0x0b01('0x6'));var fs=require('fs');var path=require(_0x0b01('0x7'));var rimraf=require(_0x0b01('0x8'));var config=require('../../config/environment');var attributes=require(_0x0b01('0x9'));module['exports']=function(_0x154bcc,_0x455b80){return _0x154bcc[_0x0b01('0xa')](_0x0b01('0xb'),attributes,{'tableName':'report_sms_queue','paranoid':![],'indexes':[{'name':'uniqueid','fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x8705=['define','SmsQueueReport','report_sms_queue','uniqueid','lodash','util','../../config/logger','bluebird','request-promise','path','rimraf','./smsQueueReport.attributes','exports'];(function(_0x1acc2d,_0x597696){var _0xabfa6d=function(_0x41e83c){while(--_0x41e83c){_0x1acc2d['push'](_0x1acc2d['shift']());}};_0xabfa6d(++_0x597696);}(_0x8705,0x1f2));var _0x5870=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0x8705[_0x42cae2];return _0x5f256f;};'use strict';var _=require(_0x5870('0x0'));var util=require(_0x5870('0x1'));var logger=require(_0x5870('0x2'))('api');var moment=require('moment');var BPromise=require(_0x5870('0x3'));var rp=require(_0x5870('0x4'));var fs=require('fs');var path=require(_0x5870('0x5'));var rimraf=require(_0x5870('0x6'));var config=require('../../config/environment');var attributes=require(_0x5870('0x7'));module[_0x5870('0x8')]=function(_0x3f4812,_0x212022){return _0x3f4812[_0x5870('0x9')](_0x5870('0xa'),attributes,{'tableName':_0x5870('0xb'),'paranoid':![],'indexes':[{'name':_0x5870('0xc'),'fields':[_0x5870('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.rpc.js b/server/api/smsQueueReport/smsQueueReport.rpc.js index ed840a9..d598625 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 _0x9141=['body','options','raw','UpdateSmsQueueReport','update','where','attributes','limit','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','then','info','SmsQueueReport,\x20%s,\x20%s','request\x20sent','debug','SmsQueueReport,\x20%s,\x20%s,\x20%s','stringify','code','error','message','result','catch','CreateSmsQueueReport','SmsQueueReport','create'];(function(_0x368c85,_0x586b0a){var _0x3477c2=function(_0x3ef6d9){while(--_0x3ef6d9){_0x368c85['push'](_0x368c85['shift']());}};_0x3477c2(++_0x586b0a);}(_0x9141,0x6e));var _0x1914=function(_0x1cd0fb,_0x13457c){_0x1cd0fb=_0x1cd0fb-0x0;var _0x36ad64=_0x9141[_0x1cd0fb];return _0x36ad64;};'use strict';var _=require(_0x1914('0x0'));var util=require(_0x1914('0x1'));var moment=require('moment');var BPromise=require(_0x1914('0x2'));var rs=require(_0x1914('0x3'));var fs=require('fs');var Redis=require(_0x1914('0x4'));var db=require(_0x1914('0x5'))['db'];var utils=require(_0x1914('0x6'));var logger=require(_0x1914('0x7'))(_0x1914('0x8'));var config=require(_0x1914('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0x1914('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xf09c91,_0x42a474,_0x4c1127){return new BPromise(function(_0x4d74dd,_0x318b62){return client['request'](_0xf09c91,_0x4c1127)[_0x1914('0xb')](function(_0x265de8){logger[_0x1914('0xc')](_0x1914('0xd'),_0x42a474,_0x1914('0xe'));logger[_0x1914('0xf')](_0x1914('0x10'),_0x42a474,_0x1914('0xe'),JSON[_0x1914('0x11')](_0x265de8));if(_0x265de8['error']){if(_0x265de8['error'][_0x1914('0x12')]===0x1f4){logger[_0x1914('0x13')]('SmsQueueReport,\x20%s,\x20%s',_0x42a474,_0x265de8[_0x1914('0x13')][_0x1914('0x14')]);return _0x318b62(_0x265de8['error'][_0x1914('0x14')]);}logger[_0x1914('0x13')](_0x1914('0xd'),_0x42a474,_0x265de8['error'][_0x1914('0x14')]);return _0x4d74dd(_0x265de8[_0x1914('0x13')]['message']);}else{logger[_0x1914('0xc')](_0x1914('0xd'),_0x42a474,_0x1914('0xe'));_0x4d74dd(_0x265de8[_0x1914('0x15')]['message']);}})[_0x1914('0x16')](function(_0x4e2c19){logger[_0x1914('0x13')]('SmsQueueReport,\x20%s,\x20%s',_0x42a474,_0x4e2c19);_0x318b62(_0x4e2c19);});});}exports[_0x1914('0x17')]=function(_0x1335be){var _0x249175=this;return new Promise(function(_0x1b0e2c,_0x1e909b){return db[_0x1914('0x18')][_0x1914('0x19')](_0x1335be[_0x1914('0x1a')],{'raw':_0x1335be[_0x1914('0x1b')]?_0x1335be[_0x1914('0x1b')][_0x1914('0x1c')]===undefined?!![]:![]:!![]})[_0x1914('0xb')](function(_0x2415a9){logger[_0x1914('0xc')](_0x1914('0x17'),_0x1335be);logger['debug']('CreateSmsQueueReport',_0x1335be,JSON['stringify'](_0x2415a9));_0x1b0e2c(_0x2415a9);})[_0x1914('0x16')](function(_0x4ed62c){logger[_0x1914('0x13')](_0x1914('0x17'),_0x4ed62c[_0x1914('0x14')],_0x1335be);_0x1e909b(_0x249175['error'](0x1f4,_0x4ed62c['message']));});});};exports[_0x1914('0x1d')]=function(_0x392af6){var _0x423687=this;return new Promise(function(_0x284ae0,_0x3e63ea){return db[_0x1914('0x18')][_0x1914('0x1e')](_0x392af6[_0x1914('0x1a')],{'raw':_0x392af6[_0x1914('0x1b')]?_0x392af6[_0x1914('0x1b')][_0x1914('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x392af6[_0x1914('0x1b')]?_0x392af6['options'][_0x1914('0x1f')]||null:null,'attributes':_0x392af6['options']?_0x392af6[_0x1914('0x1b')][_0x1914('0x20')]||null:null,'limit':_0x392af6[_0x1914('0x1b')]?_0x392af6[_0x1914('0x1b')][_0x1914('0x21')]||null:null})[_0x1914('0xb')](function(_0x4ad23e){logger['info'](_0x1914('0x1d'),_0x392af6);logger[_0x1914('0xf')](_0x1914('0x1d'),_0x392af6,JSON['stringify'](_0x4ad23e));_0x284ae0(_0x4ad23e);})[_0x1914('0x16')](function(_0x11f864){logger[_0x1914('0x13')]('UpdateSmsQueueReport',_0x11f864[_0x1914('0x14')],_0x392af6);_0x3e63ea(_0x423687[_0x1914('0x13')](0x1f4,_0x11f864[_0x1914('0x14')]));});});}; \ No newline at end of file +var _0xd4ef=['error','code','message','catch','CreateSmsQueueReport','SmsQueueReport','options','info','body','raw','where','limit','UpdateSmsQueueReport','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','SmsQueueReport,\x20%s,\x20%s','request\x20sent','debug','SmsQueueReport,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x5b5f97,_0x46b15e){var _0x2f6001=function(_0x268878){while(--_0x268878){_0x5b5f97['push'](_0x5b5f97['shift']());}};_0x2f6001(++_0x46b15e);}(_0xd4ef,0x169));var _0xfd4e=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xd4ef[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0xfd4e('0x0'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xfd4e('0x1'));var db=require(_0xfd4e('0x2'))['db'];var utils=require(_0xfd4e('0x3'));var logger=require(_0xfd4e('0x4'))(_0xfd4e('0x5'));var config=require(_0xfd4e('0x6'));var jayson=require('jayson/promise');var client=jayson[_0xfd4e('0x7')][_0xfd4e('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x3d513e,_0xce5084,_0x20cd1a){return new BPromise(function(_0x3a985b,_0x1ad2ed){return client[_0xfd4e('0x9')](_0x3d513e,_0x20cd1a)[_0xfd4e('0xa')](function(_0x449d09){logger['info'](_0xfd4e('0xb'),_0xce5084,_0xfd4e('0xc'));logger[_0xfd4e('0xd')](_0xfd4e('0xe'),_0xce5084,_0xfd4e('0xc'),JSON[_0xfd4e('0xf')](_0x449d09));if(_0x449d09[_0xfd4e('0x10')]){if(_0x449d09[_0xfd4e('0x10')][_0xfd4e('0x11')]===0x1f4){logger[_0xfd4e('0x10')]('SmsQueueReport,\x20%s,\x20%s',_0xce5084,_0x449d09[_0xfd4e('0x10')][_0xfd4e('0x12')]);return _0x1ad2ed(_0x449d09[_0xfd4e('0x10')][_0xfd4e('0x12')]);}logger[_0xfd4e('0x10')](_0xfd4e('0xb'),_0xce5084,_0x449d09[_0xfd4e('0x10')]['message']);return _0x3a985b(_0x449d09[_0xfd4e('0x10')][_0xfd4e('0x12')]);}else{logger['info'](_0xfd4e('0xb'),_0xce5084,_0xfd4e('0xc'));_0x3a985b(_0x449d09['result'][_0xfd4e('0x12')]);}})[_0xfd4e('0x13')](function(_0x374397){logger[_0xfd4e('0x10')](_0xfd4e('0xb'),_0xce5084,_0x374397);_0x1ad2ed(_0x374397);});});}exports[_0xfd4e('0x14')]=function(_0x3fab25){var _0x5825fe=this;return new Promise(function(_0x2e420e,_0x5c6f1a){return db[_0xfd4e('0x15')]['create'](_0x3fab25['body'],{'raw':_0x3fab25[_0xfd4e('0x16')]?_0x3fab25[_0xfd4e('0x16')]['raw']===undefined?!![]:![]:!![]})[_0xfd4e('0xa')](function(_0x3c73db){logger[_0xfd4e('0x17')](_0xfd4e('0x14'),_0x3fab25);logger['debug'](_0xfd4e('0x14'),_0x3fab25,JSON['stringify'](_0x3c73db));_0x2e420e(_0x3c73db);})[_0xfd4e('0x13')](function(_0x4bc6b5){logger[_0xfd4e('0x10')]('CreateSmsQueueReport',_0x4bc6b5[_0xfd4e('0x12')],_0x3fab25);_0x5c6f1a(_0x5825fe[_0xfd4e('0x10')](0x1f4,_0x4bc6b5[_0xfd4e('0x12')]));});});};exports['UpdateSmsQueueReport']=function(_0x4495f0){var _0x5128b2=this;return new Promise(function(_0x50850f,_0x417476){return db['SmsQueueReport']['update'](_0x4495f0[_0xfd4e('0x18')],{'raw':_0x4495f0[_0xfd4e('0x16')]?_0x4495f0['options'][_0xfd4e('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4495f0[_0xfd4e('0x16')]?_0x4495f0['options'][_0xfd4e('0x1a')]||null:null,'attributes':_0x4495f0[_0xfd4e('0x16')]?_0x4495f0['options']['attributes']||null:null,'limit':_0x4495f0[_0xfd4e('0x16')]?_0x4495f0[_0xfd4e('0x16')][_0xfd4e('0x1b')]||null:null})[_0xfd4e('0xa')](function(_0x4e3321){logger[_0xfd4e('0x17')](_0xfd4e('0x1c'),_0x4495f0);logger[_0xfd4e('0xd')](_0xfd4e('0x1c'),_0x4495f0,JSON['stringify'](_0x4e3321));_0x50850f(_0x4e3321);})[_0xfd4e('0x13')](function(_0x4d5ff7){logger[_0xfd4e('0x10')](_0xfd4e('0x1c'),_0x4d5ff7[_0xfd4e('0x12')],_0x4495f0);_0x417476(_0x5128b2[_0xfd4e('0x10')](0x1f4,_0x4d5ff7[_0xfd4e('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/smsTransferReport/index.js b/server/api/smsTransferReport/index.js index e50d979..3ed2700 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 _0x878f=['../../config/environment','./smsTransferReport.controller','get','isAuthenticated','/describe','create','put','update','/:id','destroy','exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x332f9b,_0x20cf77){var _0x7f3d1c=function(_0x22586e){while(--_0x22586e){_0x332f9b['push'](_0x332f9b['shift']());}};_0x7f3d1c(++_0x20cf77);}(_0x878f,0x173));var _0xf878=function(_0x83033a,_0x46cd5b){_0x83033a=_0x83033a-0x0;var _0x1a2f5d=_0x878f[_0x83033a];return _0x1a2f5d;};'use strict';var multer=require('multer');var util=require(_0xf878('0x0'));var path=require(_0xf878('0x1'));var timeout=require(_0xf878('0x2'));var express=require(_0xf878('0x3'));var router=express[_0xf878('0x4')]();var auth=require(_0xf878('0x5'));var interaction=require(_0xf878('0x6'));var config=require(_0xf878('0x7'));var controller=require(_0xf878('0x8'));router[_0xf878('0x9')]('/',auth[_0xf878('0xa')](),controller['index']);router['get'](_0xf878('0xb'),auth[_0xf878('0xa')](),controller['describe']);router['get']('/:id',auth[_0xf878('0xa')](),controller['show']);router['post']('/',auth[_0xf878('0xa')](),controller[_0xf878('0xc')]);router[_0xf878('0xd')]('/:id',auth[_0xf878('0xa')](),controller[_0xf878('0xe')]);router['delete'](_0xf878('0xf'),auth['isAuthenticated'](),controller[_0xf878('0x10')]);module[_0xf878('0x11')]=router; \ No newline at end of file +var _0x757a=['../../components/auth/service','../../components/interaction/service','../../config/environment','./smsTransferReport.controller','get','isAuthenticated','/describe','describe','/:id','show','create','put','update','delete','util','path'];(function(_0x22f85a,_0x195ed5){var _0xaa717=function(_0xe9828e){while(--_0xe9828e){_0x22f85a['push'](_0x22f85a['shift']());}};_0xaa717(++_0x195ed5);}(_0x757a,0xde));var _0xa757=function(_0x53da6d,_0x546e8f){_0x53da6d=_0x53da6d-0x0;var _0x5a05ae=_0x757a[_0x53da6d];return _0x5a05ae;};'use strict';var multer=require('multer');var util=require(_0xa757('0x0'));var path=require(_0xa757('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var auth=require(_0xa757('0x2'));var interaction=require(_0xa757('0x3'));var config=require(_0xa757('0x4'));var controller=require(_0xa757('0x5'));router[_0xa757('0x6')]('/',auth[_0xa757('0x7')](),controller['index']);router[_0xa757('0x6')](_0xa757('0x8'),auth['isAuthenticated'](),controller[_0xa757('0x9')]);router[_0xa757('0x6')](_0xa757('0xa'),auth[_0xa757('0x7')](),controller[_0xa757('0xb')]);router['post']('/',auth[_0xa757('0x7')](),controller[_0xa757('0xc')]);router[_0xa757('0xd')](_0xa757('0xa'),auth[_0xa757('0x7')](),controller[_0xa757('0xe')]);router[_0xa757('0xf')]('/:id',auth['isAuthenticated'](),controller['destroy']);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 9d435e6..1162552 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 _0x2bf5=['STRING','ENUM','account','agent','queue','DATE','NOW','moment','sequelize','exports'];(function(_0x4d902e,_0x312dd7){var _0x1f4970=function(_0x50dcbb){while(--_0x50dcbb){_0x4d902e['push'](_0x4d902e['shift']());}};_0x1f4970(++_0x312dd7);}(_0x2bf5,0x11f));var _0x52bf=function(_0x13b64b,_0x5334e9){_0x13b64b=_0x13b64b-0x0;var _0x466fdd=_0x2bf5[_0x13b64b];return _0x466fdd;};'use strict';var moment=require(_0x52bf('0x0'));var Sequelize=require(_0x52bf('0x1'));module[_0x52bf('0x2')]={'uniqueid':{'type':Sequelize[_0x52bf('0x3')],'allowNull':![]},'type':{'type':Sequelize[_0x52bf('0x4')](_0x52bf('0x5'),_0x52bf('0x6'),_0x52bf('0x7')),'allowNull':![],'defaultValue':_0x52bf('0x7')},'transferredAt':{'type':Sequelize[_0x52bf('0x8')],'allowNull':![],'defaultValue':Sequelize[_0x52bf('0x9')]}}; \ No newline at end of file +var _0xb125=['account','agent','queue','NOW','moment','sequelize','exports','STRING'];(function(_0x11067b,_0x2b689f){var _0x511235=function(_0x4425fe){while(--_0x4425fe){_0x11067b['push'](_0x11067b['shift']());}};_0x511235(++_0x2b689f);}(_0xb125,0x1e4));var _0x5b12=function(_0x1ef8d8,_0x594468){_0x1ef8d8=_0x1ef8d8-0x0;var _0x403fe8=_0xb125[_0x1ef8d8];return _0x403fe8;};'use strict';var moment=require(_0x5b12('0x0'));var Sequelize=require(_0x5b12('0x1'));module[_0x5b12('0x2')]={'uniqueid':{'type':Sequelize[_0x5b12('0x3')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x5b12('0x4'),_0x5b12('0x5'),_0x5b12('0x6')),'allowNull':![],'defaultValue':_0x5b12('0x6')},'transferredAt':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':Sequelize[_0x5b12('0x7')]}}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.controller.js b/server/api/smsTransferReport/smsTransferReport.controller.js index e7d48fa..ad08cda 100644 --- a/server/api/smsTransferReport/smsTransferReport.controller.js +++ b/server/api/smsTransferReport/smsTransferReport.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0713=['../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','json','count','offset','limit','status','set','Content-Range','apply','reject','save','then','destroy','error','stack','name','send','index','map','SmsTransferReport','rawAttributes','fieldName','type','query','keys','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','options','findAll','catch','show','params','includeAll','include','find','create','body','update','describe','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs'];(function(_0x214827,_0x440ea2){var _0x3c8aa7=function(_0x315d53){while(--_0x315d53){_0x214827['push'](_0x214827['shift']());}};_0x3c8aa7(++_0x440ea2);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0x3071('0x0'));var zipdir=require(_0x3071('0x1'));var jsonpatch=require(_0x3071('0x2'));var rp=require(_0x3071('0x3'));var moment=require(_0x3071('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x3071('0x5'));var util=require(_0x3071('0x6'));var path=require(_0x3071('0x7'));var sox=require(_0x3071('0x8'));var csv=require(_0x3071('0x9'));var ejs=require(_0x3071('0xa'));var fs=require('fs');var _=require(_0x3071('0xb'));var squel=require(_0x3071('0xc'));var crypto=require(_0x3071('0xd'));var jsforce=require(_0x3071('0xe'));var deskjs=require(_0x3071('0xf'));var toCsv=require(_0x3071('0x9'));var querystring=require(_0x3071('0x10'));var Papa=require('papaparse');var Redis=require(_0x3071('0x11'));var authService=require(_0x3071('0x12'));var qs=require(_0x3071('0x13'));var as=require(_0x3071('0x14'));var hardwareService=require(_0x3071('0x15'));var logger=require('../../config/logger')(_0x3071('0x16'));var utils=require(_0x3071('0x17'));var config=require(_0x3071('0x18'));var db=require(_0x3071('0x19'))['db'];function respondWithStatusCode(_0xa0c1,_0x4a8cc7){_0x4a8cc7=_0x4a8cc7||0xcc;return function(_0x5330a8){if(_0x5330a8){return _0xa0c1[_0x3071('0x1a')](_0x4a8cc7);}return _0xa0c1['status'](_0x4a8cc7)[_0x3071('0x1b')]();};}function respondWithResult(_0x44fbae,_0x5d4883){_0x5d4883=_0x5d4883||0xc8;return function(_0x104e73){if(_0x104e73){return _0x44fbae['status'](_0x5d4883)[_0x3071('0x1c')](_0x104e73);}};}function respondWithFilteredResult(_0x45c93b,_0x1271d0){return function(_0x1f14e1){if(_0x1f14e1){var _0x1caa5d=_0x1f14e1[_0x3071('0x1d')],_0x2a6a4b=_0x1271d0[_0x3071('0x1e')],_0x157a47=_0x1271d0['offset']+_0x1271d0[_0x3071('0x1f')],_0x11bdc9;if(_0x157a47>=_0x1caa5d){_0x157a47=_0x1caa5d;_0x11bdc9=0xc8;}else{_0x11bdc9=0xce;}_0x45c93b[_0x3071('0x20')](_0x11bdc9);return _0x45c93b[_0x3071('0x21')](_0x3071('0x22'),_0x2a6a4b+'-'+_0x157a47+'/'+_0x1caa5d)[_0x3071('0x1c')](_0x1f14e1);}return null;};}function patchUpdates(_0x17aee2){return function(_0x105bbb){try{jsonpatch[_0x3071('0x23')](_0x105bbb,_0x17aee2,!![]);}catch(_0x502a16){return BPromise[_0x3071('0x24')](_0x502a16);}return _0x105bbb[_0x3071('0x25')]();};}function saveUpdates(_0xd3e23d,_0x56c267){return function(_0xb8f4e3){if(_0xb8f4e3){return _0xb8f4e3['update'](_0xd3e23d)[_0x3071('0x26')](function(_0x43128c){return _0x43128c;});}return null;};}function removeEntity(_0x3762d8,_0x457b57){return function(_0x33090c){if(_0x33090c){return _0x33090c[_0x3071('0x27')]()[_0x3071('0x26')](function(){_0x3762d8[_0x3071('0x20')](0xcc)['end']();});}};}function handleEntityNotFound(_0x481a51,_0x2ce48a){return function(_0xb05b1d){if(!_0xb05b1d){_0x481a51[_0x3071('0x1a')](0x194);}return _0xb05b1d;};}function handleError(_0x13df9f,_0x2793ef){_0x2793ef=_0x2793ef||0x1f4;return function(_0x44b45f){logger[_0x3071('0x28')](_0x44b45f[_0x3071('0x29')]);if(_0x44b45f[_0x3071('0x2a')]){delete _0x44b45f['name'];}_0x13df9f[_0x3071('0x20')](_0x2793ef)[_0x3071('0x2b')](_0x44b45f);};}exports[_0x3071('0x2c')]=function(_0x4d5c4b,_0x4fb1ca){var _0x28792d={},_0x163604={},_0x950fde={'count':0x0,'rows':[]};var _0x3fa3b8=_[_0x3071('0x2d')](db[_0x3071('0x2e')][_0x3071('0x2f')],function(_0x32f1b4){return{'name':_0x32f1b4[_0x3071('0x30')],'type':_0x32f1b4[_0x3071('0x31')]['key']};});_0x163604['model']=_[_0x3071('0x2d')](_0x3fa3b8,_0x3071('0x2a'));_0x163604[_0x3071('0x32')]=_[_0x3071('0x33')](_0x4d5c4b[_0x3071('0x32')]);_0x163604[_0x3071('0x34')]=_[_0x3071('0x35')](_0x163604[_0x3071('0x36')],_0x163604['query']);_0x28792d['attributes']=_['intersection'](_0x163604[_0x3071('0x36')],qs[_0x3071('0x37')](_0x4d5c4b['query'][_0x3071('0x37')]));_0x28792d[_0x3071('0x38')]=_0x28792d[_0x3071('0x38')][_0x3071('0x39')]?_0x28792d['attributes']:_0x163604[_0x3071('0x36')];if(!_0x4d5c4b[_0x3071('0x32')][_0x3071('0x3a')](_0x3071('0x3b'))){_0x28792d[_0x3071('0x1f')]=qs[_0x3071('0x1f')](_0x4d5c4b[_0x3071('0x32')][_0x3071('0x1f')]);_0x28792d['offset']=qs[_0x3071('0x1e')](_0x4d5c4b['query']['offset']);}_0x28792d[_0x3071('0x3c')]=qs[_0x3071('0x3d')](_0x4d5c4b['query'][_0x3071('0x3d')]);_0x28792d[_0x3071('0x3e')]=qs[_0x3071('0x34')](_[_0x3071('0x3f')](_0x4d5c4b[_0x3071('0x32')],_0x163604[_0x3071('0x34')]),_0x3fa3b8);if(_0x4d5c4b['query'][_0x3071('0x40')]){_0x28792d[_0x3071('0x3e')]=_['merge'](_0x28792d[_0x3071('0x3e')],{'$or':_['map'](_0x3fa3b8,function(_0x28f855){if(_0x28f855[_0x3071('0x31')]!=='VIRTUAL'){var _0x593c99={};_0x593c99[_0x28f855[_0x3071('0x2a')]]={'$like':'%'+_0x4d5c4b[_0x3071('0x32')][_0x3071('0x40')]+'%'};return _0x593c99;}})});}_0x28792d=_['merge']({},_0x28792d,_0x4d5c4b[_0x3071('0x41')]);var _0x534a77={'where':_0x28792d[_0x3071('0x3e')]};return db['SmsTransferReport'][_0x3071('0x1d')](_0x534a77)[_0x3071('0x26')](function(_0x1fcc52){_0x950fde[_0x3071('0x1d')]=_0x1fcc52;if(_0x4d5c4b[_0x3071('0x32')]['includeAll']){_0x28792d['include']=[{'all':!![]}];}return db[_0x3071('0x2e')][_0x3071('0x42')](_0x28792d);})[_0x3071('0x26')](function(_0x1f69a6){_0x950fde['rows']=_0x1f69a6;return _0x950fde;})[_0x3071('0x26')](respondWithFilteredResult(_0x4fb1ca,_0x28792d))[_0x3071('0x43')](handleError(_0x4fb1ca,null));};exports[_0x3071('0x44')]=function(_0x25c29f,_0x277104){var _0xb9a4b8={'raw':!![],'where':{'id':_0x25c29f[_0x3071('0x45')]['id']}},_0x56a9d8={};_0x56a9d8['model']=_['keys'](db['SmsTransferReport']['rawAttributes']);_0x56a9d8[_0x3071('0x32')]=_[_0x3071('0x33')](_0x25c29f[_0x3071('0x32')]);_0x56a9d8[_0x3071('0x34')]=_[_0x3071('0x35')](_0x56a9d8[_0x3071('0x36')],_0x56a9d8[_0x3071('0x32')]);_0xb9a4b8[_0x3071('0x38')]=_['intersection'](_0x56a9d8[_0x3071('0x36')],qs[_0x3071('0x37')](_0x25c29f[_0x3071('0x32')][_0x3071('0x37')]));_0xb9a4b8[_0x3071('0x38')]=_0xb9a4b8['attributes']['length']?_0xb9a4b8[_0x3071('0x38')]:_0x56a9d8[_0x3071('0x36')];if(_0x25c29f[_0x3071('0x32')][_0x3071('0x46')]){_0xb9a4b8[_0x3071('0x47')]=[{'all':!![]}];}_0xb9a4b8=_['merge']({},_0xb9a4b8,_0x25c29f[_0x3071('0x41')]);return db['SmsTransferReport'][_0x3071('0x48')](_0xb9a4b8)['then'](handleEntityNotFound(_0x277104,null))['then'](respondWithResult(_0x277104,null))[_0x3071('0x43')](handleError(_0x277104,null));};exports['create']=function(_0x1862ea,_0x5a0a69){return db[_0x3071('0x2e')][_0x3071('0x49')](_0x1862ea[_0x3071('0x4a')],{})[_0x3071('0x26')](respondWithResult(_0x5a0a69,0xc9))['catch'](handleError(_0x5a0a69,null));};exports[_0x3071('0x4b')]=function(_0x575c12,_0xd273ec){if(_0x575c12['body']['id']){delete _0x575c12[_0x3071('0x4a')]['id'];}return db[_0x3071('0x2e')]['find']({'where':{'id':_0x575c12[_0x3071('0x45')]['id']}})[_0x3071('0x26')](handleEntityNotFound(_0xd273ec,null))[_0x3071('0x26')](saveUpdates(_0x575c12[_0x3071('0x4a')],null))[_0x3071('0x26')](respondWithResult(_0xd273ec,null))[_0x3071('0x43')](handleError(_0xd273ec,null));};exports[_0x3071('0x27')]=function(_0x577060,_0x2c6e4c){return db[_0x3071('0x2e')][_0x3071('0x48')]({'where':{'id':_0x577060[_0x3071('0x45')]['id']}})['then'](handleEntityNotFound(_0x2c6e4c,null))[_0x3071('0x26')](removeEntity(_0x2c6e4c,null))[_0x3071('0x43')](handleError(_0x2c6e4c,null));};exports[_0x3071('0x4c')]=function(_0x2307dd,_0x22aade){return db[_0x3071('0x2e')][_0x3071('0x4c')]()[_0x3071('0x26')](respondWithResult(_0x22aade,null))[_0x3071('0x43')](handleError(_0x22aade,null));}; \ No newline at end of file +var _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(_0x3904a3,_0x467f1b){var _0x25e8f5=function(_0xc61adf){while(--_0xc61adf){_0x3904a3['push'](_0x3904a3['shift']());}};_0x25e8f5(++_0x467f1b);}(_0x9c44,0x178));var _0x49c4=function(_0x21549c,_0x6d64d1){_0x21549c=_0x21549c-0x0;var _0x426cbd=_0x9c44[_0x21549c];return _0x426cbd;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0x49c4('0x0'));var zipdir=require(_0x49c4('0x1'));var jsonpatch=require(_0x49c4('0x2'));var rp=require(_0x49c4('0x3'));var moment=require(_0x49c4('0x4'));var BPromise=require(_0x49c4('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0x49c4('0x6'));var sox=require('sox');var csv=require(_0x49c4('0x7'));var ejs=require(_0x49c4('0x8'));var fs=require('fs');var _=require(_0x49c4('0x9'));var squel=require(_0x49c4('0xa'));var crypto=require(_0x49c4('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x49c4('0xc'));var toCsv=require(_0x49c4('0x7'));var querystring=require(_0x49c4('0xd'));var Papa=require(_0x49c4('0xe'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x49c4('0xf'));var as=require(_0x49c4('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x49c4('0x11'))(_0x49c4('0x12'));var utils=require('../../config/utils');var config=require('../../config/environment');var db=require(_0x49c4('0x13'))['db'];function respondWithStatusCode(_0x6d1b08,_0x5487cd){_0x5487cd=_0x5487cd||0xcc;return function(_0x7df3a9){if(_0x7df3a9){return _0x6d1b08[_0x49c4('0x14')](_0x5487cd);}return _0x6d1b08['status'](_0x5487cd)[_0x49c4('0x15')]();};}function respondWithResult(_0x280996,_0x21f15a){_0x21f15a=_0x21f15a||0xc8;return function(_0x2decee){if(_0x2decee){return _0x280996[_0x49c4('0x16')](_0x21f15a)[_0x49c4('0x17')](_0x2decee);}};}function respondWithFilteredResult(_0x75ea8,_0x3de397){return function(_0x58d177){if(_0x58d177){var _0x3acd06=_0x58d177[_0x49c4('0x18')],_0x141003=_0x3de397['offset'],_0x13a2db=_0x3de397[_0x49c4('0x19')]+_0x3de397[_0x49c4('0x1a')],_0x81e831;if(_0x13a2db>=_0x3acd06){_0x13a2db=_0x3acd06;_0x81e831=0xc8;}else{_0x81e831=0xce;}_0x75ea8['status'](_0x81e831);return _0x75ea8['set'](_0x49c4('0x1b'),_0x141003+'-'+_0x13a2db+'/'+_0x3acd06)[_0x49c4('0x17')](_0x58d177);}return null;};}function patchUpdates(_0x3addb2){return function(_0x59f29b){try{jsonpatch[_0x49c4('0x1c')](_0x59f29b,_0x3addb2,!![]);}catch(_0x50b151){return BPromise[_0x49c4('0x1d')](_0x50b151);}return _0x59f29b[_0x49c4('0x1e')]();};}function saveUpdates(_0xe31fcc,_0x291526){return function(_0x382040){if(_0x382040){return _0x382040[_0x49c4('0x1f')](_0xe31fcc)[_0x49c4('0x20')](function(_0x46e475){return _0x46e475;});}return null;};}function removeEntity(_0x2197d2,_0x578447){return function(_0x527126){if(_0x527126){return _0x527126['destroy']()[_0x49c4('0x20')](function(){_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 2e017b5..c0bf45b 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 _0x81e8=['../../config/environment','exports','define','SmsTransferReport','report_sms_transfer','uniqueid','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x550a61,_0x1c5d8c){var _0x248bfc=function(_0x38d79e){while(--_0x38d79e){_0x550a61['push'](_0x550a61['shift']());}};_0x248bfc(++_0x1c5d8c);}(_0x81e8,0x105));var _0x881e=function(_0x2ec46e,_0x31d5e6){_0x2ec46e=_0x2ec46e-0x0;var _0x5e7ffa=_0x81e8[_0x2ec46e];return _0x5e7ffa;};'use strict';var _=require(_0x881e('0x0'));var util=require(_0x881e('0x1'));var logger=require(_0x881e('0x2'))(_0x881e('0x3'));var moment=require(_0x881e('0x4'));var BPromise=require(_0x881e('0x5'));var rp=require(_0x881e('0x6'));var fs=require('fs');var path=require(_0x881e('0x7'));var rimraf=require(_0x881e('0x8'));var config=require(_0x881e('0x9'));var attributes=require('./smsTransferReport.attributes');module[_0x881e('0xa')]=function(_0x500bfe,_0x281b6b){return _0x500bfe[_0x881e('0xb')](_0x881e('0xc'),attributes,{'tableName':_0x881e('0xd'),'paranoid':![],'indexes':[{'name':_0x881e('0xe'),'fields':[_0x881e('0xe')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x2ea6=['SmsTransferReport','report_sms_transfer','uniqueid','lodash','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./smsTransferReport.attributes','define'];(function(_0x3bbcf6,_0x596bd4){var _0x308a42=function(_0x5ca9d6){while(--_0x5ca9d6){_0x3bbcf6['push'](_0x3bbcf6['shift']());}};_0x308a42(++_0x596bd4);}(_0x2ea6,0x148));var _0x62ea=function(_0x616290,_0x280b7f){_0x616290=_0x616290-0x0;var _0x453879=_0x2ea6[_0x616290];return _0x453879;};'use strict';var _=require(_0x62ea('0x0'));var util=require('util');var logger=require(_0x62ea('0x1'))(_0x62ea('0x2'));var moment=require(_0x62ea('0x3'));var BPromise=require('bluebird');var rp=require(_0x62ea('0x4'));var fs=require('fs');var path=require(_0x62ea('0x5'));var rimraf=require(_0x62ea('0x6'));var config=require(_0x62ea('0x7'));var attributes=require(_0x62ea('0x8'));module['exports']=function(_0x30eaf8,_0x4d0360){return _0x30eaf8[_0x62ea('0x9')](_0x62ea('0xa'),attributes,{'tableName':_0x62ea('0xb'),'paranoid':![],'indexes':[{'name':_0x62ea('0xc'),'fields':[_0x62ea('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.rpc.js b/server/api/smsTransferReport/smsTransferReport.rpc.js index 3e2a4de..4bccde1 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 _0xf3e3=['bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','request','then','info','SmsTransferReport,\x20%s,\x20%s','debug','SmsTransferReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','lodash','util'];(function(_0x245a14,_0x27d4df){var _0x1c97d6=function(_0x2bbfd6){while(--_0x2bbfd6){_0x245a14['push'](_0x245a14['shift']());}};_0x1c97d6(++_0x27d4df);}(_0xf3e3,0x106));var _0x3f3e=function(_0x429395,_0x731967){_0x429395=_0x429395-0x0;var _0x51c0db=_0xf3e3[_0x429395];return _0x51c0db;};'use strict';var _=require(_0x3f3e('0x0'));var util=require(_0x3f3e('0x1'));var moment=require('moment');var BPromise=require(_0x3f3e('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x3f3e('0x3'));var db=require(_0x3f3e('0x4'))['db'];var utils=require(_0x3f3e('0x5'));var logger=require(_0x3f3e('0x6'))(_0x3f3e('0x7'));var config=require(_0x3f3e('0x8'));var jayson=require(_0x3f3e('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x2174ea,_0x4feccf,_0x4a6f9a){return new BPromise(function(_0x3f3187,_0x5f2be5){return client[_0x3f3e('0xa')](_0x2174ea,_0x4a6f9a)[_0x3f3e('0xb')](function(_0x6641e3){logger[_0x3f3e('0xc')](_0x3f3e('0xd'),_0x4feccf,'request\x20sent');logger[_0x3f3e('0xe')](_0x3f3e('0xf'),_0x4feccf,_0x3f3e('0x10'),JSON[_0x3f3e('0x11')](_0x6641e3));if(_0x6641e3['error']){if(_0x6641e3['error']['code']===0x1f4){logger[_0x3f3e('0x12')](_0x3f3e('0xd'),_0x4feccf,_0x6641e3[_0x3f3e('0x12')][_0x3f3e('0x13')]);return _0x5f2be5(_0x6641e3[_0x3f3e('0x12')][_0x3f3e('0x13')]);}logger[_0x3f3e('0x12')](_0x3f3e('0xd'),_0x4feccf,_0x6641e3[_0x3f3e('0x12')]['message']);return _0x3f3187(_0x6641e3[_0x3f3e('0x12')][_0x3f3e('0x13')]);}else{logger[_0x3f3e('0xc')](_0x3f3e('0xd'),_0x4feccf,'request\x20sent');_0x3f3187(_0x6641e3[_0x3f3e('0x14')]['message']);}})[_0x3f3e('0x15')](function(_0x76e545){logger[_0x3f3e('0x12')](_0x3f3e('0xd'),_0x4feccf,_0x76e545);_0x5f2be5(_0x76e545);});});} \ No newline at end of file +var _0x33d0=['lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','SmsTransferReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','catch'];(function(_0x1a4a06,_0x36a5c2){var _0x49ec08=function(_0x497f24){while(--_0x497f24){_0x1a4a06['push'](_0x1a4a06['shift']());}};_0x49ec08(++_0x36a5c2);}(_0x33d0,0x1e4));var _0x033d=function(_0x499195,_0x5df0b2){_0x499195=_0x499195-0x0;var _0x1137ce=_0x33d0[_0x499195];return _0x1137ce;};'use strict';var _=require(_0x033d('0x0'));var util=require(_0x033d('0x1'));var moment=require(_0x033d('0x2'));var BPromise=require(_0x033d('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x033d('0x4'));var db=require(_0x033d('0x5'))['db'];var utils=require(_0x033d('0x6'));var logger=require(_0x033d('0x7'))(_0x033d('0x8'));var config=require(_0x033d('0x9'));var jayson=require(_0x033d('0xa'));var client=jayson['client'][_0x033d('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x51fb89,_0x320c37,_0x210ab0){return new BPromise(function(_0x45648d,_0x2e5c8b){return client[_0x033d('0xc')](_0x51fb89,_0x210ab0)[_0x033d('0xd')](function(_0x36f11c){logger[_0x033d('0xe')](_0x033d('0xf'),_0x320c37,_0x033d('0x10'));logger[_0x033d('0x11')]('SmsTransferReport,\x20%s,\x20%s,\x20%s',_0x320c37,_0x033d('0x10'),JSON[_0x033d('0x12')](_0x36f11c));if(_0x36f11c[_0x033d('0x13')]){if(_0x36f11c[_0x033d('0x13')]['code']===0x1f4){logger[_0x033d('0x13')](_0x033d('0xf'),_0x320c37,_0x36f11c[_0x033d('0x13')][_0x033d('0x14')]);return _0x2e5c8b(_0x36f11c[_0x033d('0x13')][_0x033d('0x14')]);}logger[_0x033d('0x13')]('SmsTransferReport,\x20%s,\x20%s',_0x320c37,_0x36f11c[_0x033d('0x13')][_0x033d('0x14')]);return _0x45648d(_0x36f11c[_0x033d('0x13')][_0x033d('0x14')]);}else{logger['info'](_0x033d('0xf'),_0x320c37,_0x033d('0x10'));_0x45648d(_0x36f11c['result']['message']);}})[_0x033d('0x15')](function(_0x3f7ca9){logger[_0x033d('0x13')](_0x033d('0xf'),_0x320c37,_0x3f7ca9);_0x2e5c8b(_0x3f7ca9);});});} \ No newline at end of file diff --git a/server/api/sound/index.js b/server/api/sound/index.js index 0d79440..af8c5d7 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 _0x8f74=['exports','util','path','connect-timeout','Router','../../components/interaction/service','../../config/environment','./sound.controller','get','isAuthenticated','index','/:id','show','/:id/download','download','diskStorage','join','server/files/sounds/original/','originalname','format','%s-%s%s','extname','now','post','single','create','put','update','delete'];(function(_0x5b685e,_0x3e69ad){var _0x9a0173=function(_0x5cc6ad){while(--_0x5cc6ad){_0x5b685e['push'](_0x5b685e['shift']());}};_0x9a0173(++_0x3e69ad);}(_0x8f74,0x17a));var _0x48f7=function(_0x14f904,_0x3290e8){_0x14f904=_0x14f904-0x0;var _0x538469=_0x8f74[_0x14f904];return _0x538469;};'use strict';var multer=require('multer');var util=require(_0x48f7('0x0'));var path=require(_0x48f7('0x1'));var timeout=require(_0x48f7('0x2'));var express=require('express');var router=express[_0x48f7('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0x48f7('0x4'));var config=require(_0x48f7('0x5'));var controller=require(_0x48f7('0x6'));router[_0x48f7('0x7')]('/',auth[_0x48f7('0x8')](),controller[_0x48f7('0x9')]);router[_0x48f7('0x7')](_0x48f7('0xa'),auth[_0x48f7('0x8')](),controller[_0x48f7('0xb')]);router['get'](_0x48f7('0xc'),auth[_0x48f7('0x8')](),controller[_0x48f7('0xd')]);var upload=multer({'storage':multer[_0x48f7('0xe')]({'destination':function(_0x3828fb,_0x434a59,_0x5ca40d){_0x5ca40d(null,path[_0x48f7('0xf')](config['root'],_0x48f7('0x10')));},'filename':function(_0x12a88a,_0x3405ce,_0x33f3de){_0x3405ce['originalname']=_0x3405ce[_0x48f7('0x11')]['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x33f3de(null,util[_0x48f7('0x12')](_0x48f7('0x13'),path['basename'](_0x3405ce[_0x48f7('0x11')],path[_0x48f7('0x14')](_0x3405ce[_0x48f7('0x11')])),Date[_0x48f7('0x15')](),path[_0x48f7('0x14')](_0x3405ce[_0x48f7('0x11')])));}})});router[_0x48f7('0x16')]('/',upload[_0x48f7('0x17')]('file'),controller[_0x48f7('0x18')]);router[_0x48f7('0x19')](_0x48f7('0xa'),auth[_0x48f7('0x8')](),controller[_0x48f7('0x1a')]);router[_0x48f7('0x1b')](_0x48f7('0xa'),auth[_0x48f7('0x8')](),controller[_0x48f7('0x1b')]);module[_0x48f7('0x1c')]=router; \ No newline at end of file +var _0xdae8=['update','delete','exports','util','connect-timeout','express','../../components/auth/service','../../config/environment','./sound.controller','get','isAuthenticated','index','/:id','show','/:id/download','diskStorage','join','root','originalname','format','%s-%s%s','basename','extname','now','post','single','file','create','put'];(function(_0x121e0f,_0x1dce03){var _0x563380=function(_0x49fcbb){while(--_0x49fcbb){_0x121e0f['push'](_0x121e0f['shift']());}};_0x563380(++_0x1dce03);}(_0xdae8,0xce));var _0x8dae=function(_0x1dfcb9,_0x3f245e){_0x1dfcb9=_0x1dfcb9-0x0;var _0xc930a7=_0xdae8[_0x1dfcb9];return _0xc930a7;};'use strict';var multer=require('multer');var util=require(_0x8dae('0x0'));var path=require('path');var timeout=require(_0x8dae('0x1'));var express=require(_0x8dae('0x2'));var router=express['Router']();var auth=require(_0x8dae('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0x8dae('0x4'));var controller=require(_0x8dae('0x5'));router[_0x8dae('0x6')]('/',auth[_0x8dae('0x7')](),controller[_0x8dae('0x8')]);router[_0x8dae('0x6')](_0x8dae('0x9'),auth['isAuthenticated'](),controller[_0x8dae('0xa')]);router[_0x8dae('0x6')](_0x8dae('0xb'),auth[_0x8dae('0x7')](),controller['download']);var upload=multer({'storage':multer[_0x8dae('0xc')]({'destination':function(_0x3bcd51,_0x5581c8,_0x5dd2c2){_0x5dd2c2(null,path[_0x8dae('0xd')](config[_0x8dae('0xe')],'server/files/sounds/original/'));},'filename':function(_0x3c0f57,_0x1462a9,_0xbed9bb){_0x1462a9[_0x8dae('0xf')]=_0x1462a9[_0x8dae('0xf')]['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0xbed9bb(null,util[_0x8dae('0x10')](_0x8dae('0x11'),path[_0x8dae('0x12')](_0x1462a9[_0x8dae('0xf')],path[_0x8dae('0x13')](_0x1462a9['originalname'])),Date[_0x8dae('0x14')](),path[_0x8dae('0x13')](_0x1462a9[_0x8dae('0xf')])));}})});router[_0x8dae('0x15')]('/',upload[_0x8dae('0x16')](_0x8dae('0x17')),controller[_0x8dae('0x18')]);router[_0x8dae('0x19')]('/:id',auth[_0x8dae('0x7')](),controller[_0x8dae('0x1a')]);router[_0x8dae('0x1b')](_0x8dae('0x9'),auth[_0x8dae('0x7')](),controller[_0x8dae('0x1b')]);module[_0x8dae('0x1c')]=router; \ No newline at end of file diff --git a/server/api/sound/sound.attributes.js b/server/api/sound/sound.attributes.js index 2d0fc46..098539b 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 _0x7dc5=['sequelize','exports','STRING','name','FLOAT','BIGINT','INTEGER'];(function(_0x181b84,_0x42f8f1){var _0x3f773d=function(_0x2f916f){while(--_0x2f916f){_0x181b84['push'](_0x181b84['shift']());}};_0x3f773d(++_0x42f8f1);}(_0x7dc5,0x85));var _0x57dc=function(_0x42e98c,_0x1c6bb9){_0x42e98c=_0x42e98c-0x0;var _0x59803e=_0x7dc5[_0x42e98c];return _0x59803e;};'use strict';var Sequelize=require(_0x57dc('0x0'));module[_0x57dc('0x1')]={'name':{'type':Sequelize[_0x57dc('0x2')],'unique':_0x57dc('0x3'),'allowNull':![]},'save_name':{'type':Sequelize[_0x57dc('0x2')]},'display_name':{'type':Sequelize[_0x57dc('0x2')],'defaultValue':''},'description':{'type':Sequelize[_0x57dc('0x2')]},'original_format':{'type':Sequelize[_0x57dc('0x2')]},'original_duration':{'type':Sequelize[_0x57dc('0x4')]},'original_sampleCount':{'type':Sequelize[_0x57dc('0x5')]},'original_channelCount':{'type':Sequelize['INTEGER']},'original_bitRate':{'type':Sequelize[_0x57dc('0x5')]},'original_sampleRate':{'type':Sequelize[_0x57dc('0x6')]},'converted_format':{'type':Sequelize['STRING']},'converted_duration':{'type':Sequelize[_0x57dc('0x4')]},'converted_sampleCount':{'type':Sequelize[_0x57dc('0x5')]},'converted_channelCount':{'type':Sequelize['INTEGER']},'converted_bitRate':{'type':Sequelize[_0x57dc('0x5')]},'converted_sampleRate':{'type':Sequelize['INTEGER']}}; \ No newline at end of file +var _0x730c=['BIGINT','INTEGER','sequelize','STRING','name','FLOAT'];(function(_0x5e8d3e,_0x18ed2e){var _0x1348c0=function(_0x5a889f){while(--_0x5a889f){_0x5e8d3e['push'](_0x5e8d3e['shift']());}};_0x1348c0(++_0x18ed2e);}(_0x730c,0x8c));var _0xc730=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x730c[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0xc730('0x0'));module['exports']={'name':{'type':Sequelize[_0xc730('0x1')],'unique':_0xc730('0x2'),'allowNull':![]},'save_name':{'type':Sequelize[_0xc730('0x1')]},'display_name':{'type':Sequelize[_0xc730('0x1')],'defaultValue':''},'description':{'type':Sequelize[_0xc730('0x1')]},'original_format':{'type':Sequelize[_0xc730('0x1')]},'original_duration':{'type':Sequelize[_0xc730('0x3')]},'original_sampleCount':{'type':Sequelize[_0xc730('0x4')]},'original_channelCount':{'type':Sequelize[_0xc730('0x5')]},'original_bitRate':{'type':Sequelize[_0xc730('0x4')]},'original_sampleRate':{'type':Sequelize[_0xc730('0x5')]},'converted_format':{'type':Sequelize['STRING']},'converted_duration':{'type':Sequelize[_0xc730('0x3')]},'converted_sampleCount':{'type':Sequelize[_0xc730('0x4')]},'converted_channelCount':{'type':Sequelize[_0xc730('0x5')]},'converted_bitRate':{'type':Sequelize['BIGINT']},'converted_sampleRate':{'type':Sequelize[_0xc730('0x5')]}}; \ No newline at end of file diff --git a/server/api/sound/sound.controller.js b/server/api/sound/sound.controller.js index 6802fdc..88ccafa 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 _0xe310=['autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','start','description','delete','original_format','html-pdf','rimraf','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','lodash','squel','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','end','status','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','get','UserProfileResource','sendStatus','stack','name','send','index','map','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','Sound','rows','catch','find','params','save_name','existsSync','join','root','server/files/sounds/converted','ValidationError','Sound\x20not\x20found','download','%s.%s','converted_format','format','create','basename','file','originalname','extname','filename','substring','wav','server/files/sounds/original','Sound\x20upload\x20filepath:\x20%s','info','chmodSync','transcode','unlinkSync','src','original_duration','duration','original_sampleCount','sampleCount','original_channelCount','channelCount','bitRate','original_sampleRate','sampleRate','dest','converted_duration','converted_sampleCount','converted_channelCount','converted_sampleRate','0777','body','role','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','Sounds'];(function(_0x4cb7da,_0x136ff8){var _0x6d052f=function(_0x1941db){while(--_0x1941db){_0x4cb7da['push'](_0x4cb7da['shift']());}};_0x6d052f(++_0x136ff8);}(_0xe310,0x105));var _0x0e31=function(_0x3597c5,_0x75cbb3){_0x3597c5=_0x3597c5-0x0;var _0x19b1f7=_0xe310[_0x3597c5];return _0x19b1f7;};'use strict';var pdf=require(_0x0e31('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x0e31('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x0e31('0x2'));var rp=require(_0x0e31('0x3'));var moment=require(_0x0e31('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x0e31('0x5'));var util=require(_0x0e31('0x6'));var path=require(_0x0e31('0x7'));var sox=require(_0x0e31('0x8'));var csv=require(_0x0e31('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x0e31('0xa'));var squel=require(_0x0e31('0xb'));var crypto=require(_0x0e31('0xc'));var jsforce=require(_0x0e31('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x0e31('0xe'));var Papa=require('papaparse');var Redis=require(_0x0e31('0xf'));var authService=require(_0x0e31('0x10'));var qs=require(_0x0e31('0x11'));var as=require(_0x0e31('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x0e31('0x13'))(_0x0e31('0x14'));var utils=require(_0x0e31('0x15'));var config=require(_0x0e31('0x16'));var db=require(_0x0e31('0x17'))['db'];function respondWithStatusCode(_0x14213d,_0x120490){_0x120490=_0x120490||0xcc;return function(_0x7155fa){if(_0x7155fa){return _0x14213d['sendStatus'](_0x120490);}return _0x14213d['status'](_0x120490)[_0x0e31('0x18')]();};}function respondWithResult(_0x2c177e,_0x404b24){_0x404b24=_0x404b24||0xc8;return function(_0x150ff4){if(_0x150ff4){return _0x2c177e[_0x0e31('0x19')](_0x404b24)[_0x0e31('0x1a')](_0x150ff4);}};}function respondWithFilteredResult(_0x3208a8,_0x49316d){return function(_0x38761c){if(_0x38761c){var _0x5f490b=_0x38761c[_0x0e31('0x1b')],_0x165cfe=_0x49316d[_0x0e31('0x1c')],_0x5009c1=_0x49316d[_0x0e31('0x1c')]+_0x49316d[_0x0e31('0x1d')],_0xb8ec00;if(_0x5009c1>=_0x5f490b){_0x5009c1=_0x5f490b;_0xb8ec00=0xc8;}else{_0xb8ec00=0xce;}_0x3208a8[_0x0e31('0x19')](_0xb8ec00);return _0x3208a8[_0x0e31('0x1e')](_0x0e31('0x1f'),_0x165cfe+'-'+_0x5009c1+'/'+_0x5f490b)[_0x0e31('0x1a')](_0x38761c);}return null;};}function patchUpdates(_0x187354){return function(_0x2fa605){try{jsonpatch[_0x0e31('0x20')](_0x2fa605,_0x187354,!![]);}catch(_0x261628){return BPromise[_0x0e31('0x21')](_0x261628);}return _0x2fa605[_0x0e31('0x22')]();};}function saveUpdates(_0x5013e2,_0x2228a3){return function(_0x1deb5c){if(_0x1deb5c){return _0x1deb5c[_0x0e31('0x23')](_0x5013e2)[_0x0e31('0x24')](function(_0xe79596){return _0xe79596;});}return null;};}function removeEntity(_0x556eeb,_0x44c59e){return function(_0xf4ec0e){if(_0xf4ec0e){return _0xf4ec0e[_0x0e31('0x25')]()[_0x0e31('0x24')](function(){var _0x4e6fb7=_0xf4ec0e[_0x0e31('0x26')]({'plain':!![]});var _0x23ce10='Sounds';return db[_0x0e31('0x27')][_0x0e31('0x25')]({'where':{'type':_0x23ce10,'resourceId':_0x4e6fb7['id']}})[_0x0e31('0x24')](function(){return _0xf4ec0e;});})[_0x0e31('0x24')](function(){_0x556eeb[_0x0e31('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x329e2d,_0xd5bb3d){return function(_0x28e320){if(!_0x28e320){_0x329e2d[_0x0e31('0x28')](0x194);}return _0x28e320;};}function handleError(_0x5a74e8,_0x492e3e){_0x492e3e=_0x492e3e||0x1f4;return function(_0x471300){logger['error'](_0x471300[_0x0e31('0x29')]);if(_0x471300[_0x0e31('0x2a')]){delete _0x471300[_0x0e31('0x2a')];}_0x5a74e8[_0x0e31('0x19')](_0x492e3e)[_0x0e31('0x2b')](_0x471300);};}exports[_0x0e31('0x2c')]=function(_0x3aa529,_0x3701d1){var _0x28df02={},_0x455b3f={},_0x46b582={'count':0x0,'rows':[]};var _0x26b7ce=_[_0x0e31('0x2d')](db['Sound'][_0x0e31('0x2e')],function(_0x1e22a7){return{'name':_0x1e22a7['fieldName'],'type':_0x1e22a7[_0x0e31('0x2f')][_0x0e31('0x30')]};});_0x455b3f[_0x0e31('0x31')]=_[_0x0e31('0x2d')](_0x26b7ce,'name');_0x455b3f[_0x0e31('0x32')]=_[_0x0e31('0x33')](_0x3aa529[_0x0e31('0x32')]);_0x455b3f[_0x0e31('0x34')]=_[_0x0e31('0x35')](_0x455b3f['model'],_0x455b3f['query']);_0x28df02[_0x0e31('0x36')]=_[_0x0e31('0x35')](_0x455b3f[_0x0e31('0x31')],qs[_0x0e31('0x37')](_0x3aa529[_0x0e31('0x32')]['fields']));_0x28df02[_0x0e31('0x36')]=_0x28df02['attributes'][_0x0e31('0x38')]?_0x28df02[_0x0e31('0x36')]:_0x455b3f['model'];if(!_0x3aa529[_0x0e31('0x32')][_0x0e31('0x39')](_0x0e31('0x3a'))){_0x28df02['limit']=qs[_0x0e31('0x1d')](_0x3aa529[_0x0e31('0x32')][_0x0e31('0x1d')]);_0x28df02[_0x0e31('0x1c')]=qs['offset'](_0x3aa529['query'][_0x0e31('0x1c')]);}_0x28df02[_0x0e31('0x3b')]=qs[_0x0e31('0x3c')](_0x3aa529['query'][_0x0e31('0x3c')]);_0x28df02[_0x0e31('0x3d')]=qs[_0x0e31('0x34')](_[_0x0e31('0x3e')](_0x3aa529[_0x0e31('0x32')],_0x455b3f[_0x0e31('0x34')]),_0x26b7ce);if(_0x3aa529[_0x0e31('0x32')][_0x0e31('0x3f')]){_0x28df02[_0x0e31('0x3d')]=_[_0x0e31('0x40')](_0x28df02['where'],{'$or':_[_0x0e31('0x2d')](_0x26b7ce,function(_0x4ba887){if(_0x4ba887[_0x0e31('0x2f')]!==_0x0e31('0x41')){var _0xae9870={};_0xae9870[_0x4ba887[_0x0e31('0x2a')]]={'$like':'%'+_0x3aa529[_0x0e31('0x32')]['filter']+'%'};return _0xae9870;}})});}_0x28df02=_['merge']({},_0x28df02,_0x3aa529[_0x0e31('0x42')]);var _0x2b3d1a={'where':_0x28df02[_0x0e31('0x3d')]};return db['Sound'][_0x0e31('0x1b')](_0x2b3d1a)[_0x0e31('0x24')](function(_0x3d6687){_0x46b582[_0x0e31('0x1b')]=_0x3d6687;if(_0x3aa529['query'][_0x0e31('0x43')]){_0x28df02[_0x0e31('0x44')]=[{'all':!![]}];}return db[_0x0e31('0x45')]['findAll'](_0x28df02);})[_0x0e31('0x24')](function(_0x426b6b){_0x46b582[_0x0e31('0x46')]=_0x426b6b;return _0x46b582;})[_0x0e31('0x24')](respondWithFilteredResult(_0x3701d1,_0x28df02))[_0x0e31('0x47')](handleError(_0x3701d1,null));};exports['show']=function(_0xc20eaa,_0x4b1d88){var _0x338a08={'raw':!![],'where':{'id':_0xc20eaa['params']['id']}},_0x4dd8ef={};_0x4dd8ef['model']=_['keys'](db[_0x0e31('0x45')][_0x0e31('0x2e')]);_0x4dd8ef[_0x0e31('0x32')]=_[_0x0e31('0x33')](_0xc20eaa['query']);_0x4dd8ef['filters']=_['intersection'](_0x4dd8ef[_0x0e31('0x31')],_0x4dd8ef['query']);_0x338a08['attributes']=_['intersection'](_0x4dd8ef[_0x0e31('0x31')],qs[_0x0e31('0x37')](_0xc20eaa['query'][_0x0e31('0x37')]));_0x338a08[_0x0e31('0x36')]=_0x338a08['attributes']['length']?_0x338a08[_0x0e31('0x36')]:_0x4dd8ef['model'];if(_0xc20eaa[_0x0e31('0x32')][_0x0e31('0x43')]){_0x338a08[_0x0e31('0x44')]=[{'all':!![]}];}_0x338a08=_[_0x0e31('0x40')]({},_0x338a08,_0xc20eaa[_0x0e31('0x42')]);return db[_0x0e31('0x45')]['find'](_0x338a08)[_0x0e31('0x24')](handleEntityNotFound(_0x4b1d88,null))['then'](respondWithResult(_0x4b1d88,null))[_0x0e31('0x47')](handleError(_0x4b1d88,null));};exports['download']=function(_0x3635a1,_0x2aa478,_0x3888b3){return db[_0x0e31('0x45')][_0x0e31('0x48')]({'where':{'id':_0x3635a1[_0x0e31('0x49')]['id']},'attributes':[_0x0e31('0x2a'),_0x0e31('0x4a'),'converted_format'],'raw':!![]})['then'](handleEntityNotFound(_0x2aa478,null))[_0x0e31('0x24')](function(_0x3843ef){if(_0x3843ef){if(!fs[_0x0e31('0x4b')](path[_0x0e31('0x4c')](config[_0x0e31('0x4d')],_0x0e31('0x4e'),_0x3843ef[_0x0e31('0x4a')]+'.'+_0x3843ef['converted_format']))){throw new db['Sequelize'][(_0x0e31('0x4f'))](_0x0e31('0x50'));}return _0x2aa478[_0x0e31('0x51')](path[_0x0e31('0x4c')](config[_0x0e31('0x4d')],_0x0e31('0x4e'),util['format'](_0x0e31('0x52'),_0x3843ef[_0x0e31('0x4a')],_0x3843ef[_0x0e31('0x53')])),util[_0x0e31('0x54')](_0x0e31('0x52'),_0x3843ef[_0x0e31('0x2a')],_0x3843ef[_0x0e31('0x53')]));}return null;})[_0x0e31('0x47')](handleError(_0x2aa478,null));};exports[_0x0e31('0x55')]=function(_0x4cb75b,_0xe60d05,_0x11eff6){var _0xb46f3e={'name':path[_0x0e31('0x56')](_0x4cb75b[_0x0e31('0x57')][_0x0e31('0x58')],path[_0x0e31('0x59')](_0x4cb75b[_0x0e31('0x57')][_0x0e31('0x58')])),'save_name':path[_0x0e31('0x56')](_0x4cb75b[_0x0e31('0x57')][_0x0e31('0x5a')],path[_0x0e31('0x59')](_0x4cb75b[_0x0e31('0x57')][_0x0e31('0x5a')])),'original_format':path[_0x0e31('0x59')](_0x4cb75b['file'][_0x0e31('0x58')])[_0x0e31('0x5b')](0x1),'converted_format':_0x0e31('0x5c')};var _0x4c7df2=path[_0x0e31('0x4c')](config[_0x0e31('0x4d')],_0x0e31('0x5d'),_0x4cb75b[_0x0e31('0x57')][_0x0e31('0x5a')]);var _0x485f30=path['join'](config['root'],'server/files/sounds/converted',util[_0x0e31('0x54')](_0x0e31('0x52'),path[_0x0e31('0x56')](_0x4cb75b[_0x0e31('0x57')][_0x0e31('0x5a')],path['extname'](_0x4cb75b[_0x0e31('0x57')][_0x0e31('0x5a')])),_0xb46f3e[_0x0e31('0x53')]));logger['info'](_0x0e31('0x5e'),_0x4c7df2);logger[_0x0e31('0x5f')]('Sound\x20upload\x20destination:\x20%s',_0x485f30);try{fs[_0x0e31('0x60')](_0x4c7df2,parseInt('0777',0x8));var _0x4adb6d=sox[_0x0e31('0x61')](_0x4c7df2,_0x485f30,{'sampleRate':0x1f40,'format':'wav','channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x4adb6d['on']('error',function(_0x321437){fs[_0x0e31('0x62')](_0x4c7df2);_0xe60d05[_0x0e31('0x19')](0x1f4)[_0x0e31('0x2b')](_0x321437);});_0x4adb6d['on'](_0x0e31('0x63'),function(_0x12e075){_0xb46f3e[_0x0e31('0x64')]=isNaN(_0x12e075[_0x0e31('0x65')])?null:_0x12e075[_0x0e31('0x65')]*0x3e8;_0xb46f3e[_0x0e31('0x66')]=isNaN(_0x12e075[_0x0e31('0x67')])?null:_0x12e075[_0x0e31('0x67')];_0xb46f3e[_0x0e31('0x68')]=isNaN(_0x12e075[_0x0e31('0x69')])?null:_0x12e075[_0x0e31('0x69')];_0xb46f3e['original_bitRate']=isNaN(_0x12e075[_0x0e31('0x6a')])?null:_0x12e075[_0x0e31('0x6a')];_0xb46f3e[_0x0e31('0x6b')]=isNaN(_0x12e075['sampleRate'])?null:_0x12e075[_0x0e31('0x6c')];});_0x4adb6d['on'](_0x0e31('0x6d'),function(_0x1b3569){_0xb46f3e[_0x0e31('0x6e')]=isNaN(_0x1b3569[_0x0e31('0x65')])?null:_0x1b3569[_0x0e31('0x65')]*0x3e8;_0xb46f3e[_0x0e31('0x6f')]=isNaN(_0x1b3569[_0x0e31('0x67')])?null:_0x1b3569[_0x0e31('0x67')];_0xb46f3e[_0x0e31('0x70')]=isNaN(_0x1b3569[_0x0e31('0x69')])?null:_0x1b3569['channelCount'];_0xb46f3e['converted_bitRate']=isNaN(_0x1b3569[_0x0e31('0x6a')])?null:_0x1b3569[_0x0e31('0x6a')];_0xb46f3e[_0x0e31('0x71')]=isNaN(_0x1b3569[_0x0e31('0x6c')])?null:_0x1b3569[_0x0e31('0x6c')];});_0x4adb6d['on'](_0x0e31('0x18'),function(){fs[_0x0e31('0x60')](_0x485f30,parseInt(_0x0e31('0x72'),0x8));return db['Sound'][_0x0e31('0x55')](_0xb46f3e)[_0x0e31('0x24')](function(_0x5a500d){var _0x2fe59e={'role':_0x4cb75b[_0x0e31('0x73')][_0x0e31('0x74')],'userProfileId':_0x4cb75b[_0x0e31('0x73')]['userProfileId']};if(!_0x2fe59e)throw new Error(_0x0e31('0x75'));if(_0x2fe59e[_0x0e31('0x74')]===_0x0e31('0x76')){var _0x1d6602=_0x5a500d[_0x0e31('0x26')]({'plain':!![]});return db['UserProfileSection'][_0x0e31('0x48')]({'where':{'name':_0x0e31('0x77'),'userProfileId':_0x2fe59e['userProfileId']},'raw':!![]})[_0x0e31('0x24')](function(_0x3d40b9){if(_0x3d40b9&&_0x3d40b9[_0x0e31('0x78')]===0x0){return db['UserProfileResource'][_0x0e31('0x55')]({'name':_0x1d6602[_0x0e31('0x2a')],'resourceId':_0x1d6602['id'],'type':_0x3d40b9['name'],'sectionId':_0x3d40b9['id']},{})[_0x0e31('0x24')](function(){return _0x5a500d;});}else{return _0x5a500d;}})[_0x0e31('0x47')](function(_0x49aebe){logger[_0x0e31('0x79')](_0x0e31('0x7a'),_0x49aebe);throw _0x49aebe;});}return _0x5a500d;})[_0x0e31('0x24')](respondWithResult(_0xe60d05,null))[_0x0e31('0x47')](handleError(_0xe60d05,null));});_0x4adb6d[_0x0e31('0x7b')]();}catch(_0x2ed87d){_0xe60d05[_0x0e31('0x19')](0x1f4)[_0x0e31('0x2b')](_0x2ed87d);}};exports['update']=function(_0x1505be,_0xfa1e0d,_0x1d5949){return db[_0x0e31('0x45')][_0x0e31('0x48')]({'where':{'id':_0x1505be[_0x0e31('0x49')]['id']}})[_0x0e31('0x24')](handleEntityNotFound(_0xfa1e0d,null))['then'](saveUpdates(_[_0x0e31('0x3e')](_0x1505be['body'],[_0x0e31('0x2a'),_0x0e31('0x7c')]),null))['then'](respondWithResult(_0xfa1e0d,null))[_0x0e31('0x47')](handleError(_0xfa1e0d,null));};exports[_0x0e31('0x7d')]=function(_0x521b71,_0x463055,_0x3ef040){return db[_0x0e31('0x45')]['find']({'where':{'id':_0x521b71[_0x0e31('0x49')]['id']}})[_0x0e31('0x24')](function(_0x172fb6){if(_0x172fb6){return _0x172fb6['destroy']();}})[_0x0e31('0x24')](function(_0x363111){var _0x491751=path[_0x0e31('0x4c')](config[_0x0e31('0x4d')],_0x0e31('0x5d'),util[_0x0e31('0x54')](_0x0e31('0x52'),_0x363111[_0x0e31('0x4a')],_0x363111[_0x0e31('0x7e')]));var _0x4428bd=path[_0x0e31('0x4c')](config['root'],_0x0e31('0x4e'),util['format'](_0x0e31('0x52'),_0x363111[_0x0e31('0x4a')],_0x363111[_0x0e31('0x53')]));fs[_0x0e31('0x62')](_0x491751);fs[_0x0e31('0x62')](_0x4428bd);return _0x363111;})[_0x0e31('0x24')](function(_0x284748){if(_0x284748){return _0x463055['status'](0xcc)[_0x0e31('0x18')]();}})['then'](handleEntityNotFound(_0x463055,null))['catch'](handleError(_0x463055,null));}; \ No newline at end of file +var _0x4bcb=['util','path','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','limit','set','apply','reject','save','update','then','destroy','get','Sounds','UserProfileResource','stack','name','send','index','map','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','pick','filter','where','VIRTUAL','Sound','count','includeAll','include','findAll','show','rawAttributes','length','merge','options','find','download','params','save_name','converted_format','join','server/files/sounds/converted','Sequelize','ValidationError','Sound\x20not\x20found','root','format','catch','create','basename','file','originalname','extname','filename','server/files/sounds/original','info','Sound\x20upload\x20filepath:\x20%s','transcode','error','unlinkSync','src','original_duration','duration','original_sampleCount','sampleCount','original_channelCount','channelCount','original_bitRate','bitRate','original_sampleRate','dest','converted_duration','converted_sampleCount','converted_channelCount','converted_bitRate','converted_sampleRate','chmodSync','body','userProfileId','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','autoAssociation','start','%s.%s','original_format','html-pdf','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache'];(function(_0x2070da,_0x45e586){var _0x4f9fe1=function(_0x5b6f2a){while(--_0x5b6f2a){_0x2070da['push'](_0x2070da['shift']());}};_0x4f9fe1(++_0x45e586);}(_0x4bcb,0x74));var _0xb4bc=function(_0x10f68e,_0xf198ea){_0x10f68e=_0x10f68e-0x0;var _0x4c8372=_0x4bcb[_0x10f68e];return _0x4c8372;};'use strict';var pdf=require(_0xb4bc('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xb4bc('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xb4bc('0x2'));var rp=require(_0xb4bc('0x3'));var moment=require(_0xb4bc('0x4'));var BPromise=require(_0xb4bc('0x5'));var Mustache=require(_0xb4bc('0x6'));var util=require(_0xb4bc('0x7'));var path=require(_0xb4bc('0x8'));var sox=require(_0xb4bc('0x9'));var csv=require(_0xb4bc('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xb4bc('0xb'));var squel=require(_0xb4bc('0xc'));var crypto=require(_0xb4bc('0xd'));var jsforce=require(_0xb4bc('0xe'));var deskjs=require(_0xb4bc('0xf'));var toCsv=require(_0xb4bc('0xa'));var querystring=require('querystring');var Papa=require(_0xb4bc('0x10'));var Redis=require(_0xb4bc('0x11'));var authService=require('../../components/auth/service');var qs=require(_0xb4bc('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xb4bc('0x13'))('api');var utils=require(_0xb4bc('0x14'));var config=require(_0xb4bc('0x15'));var db=require(_0xb4bc('0x16'))['db'];function respondWithStatusCode(_0x10039d,_0x23d8b0){_0x23d8b0=_0x23d8b0||0xcc;return function(_0x1ef88c){if(_0x1ef88c){return _0x10039d[_0xb4bc('0x17')](_0x23d8b0);}return _0x10039d[_0xb4bc('0x18')](_0x23d8b0)[_0xb4bc('0x19')]();};}function respondWithResult(_0x4c72a5,_0x2dbe09){_0x2dbe09=_0x2dbe09||0xc8;return function(_0x459dc0){if(_0x459dc0){return _0x4c72a5[_0xb4bc('0x18')](_0x2dbe09)[_0xb4bc('0x1a')](_0x459dc0);}};}function respondWithFilteredResult(_0x260ed6,_0x46cb80){return function(_0x1265e8){if(_0x1265e8){var _0x1219d4=_0x1265e8['count'],_0x399561=_0x46cb80[_0xb4bc('0x1b')],_0x35bb56=_0x46cb80['offset']+_0x46cb80[_0xb4bc('0x1c')],_0x3bf5c8;if(_0x35bb56>=_0x1219d4){_0x35bb56=_0x1219d4;_0x3bf5c8=0xc8;}else{_0x3bf5c8=0xce;}_0x260ed6[_0xb4bc('0x18')](_0x3bf5c8);return _0x260ed6[_0xb4bc('0x1d')]('Content-Range',_0x399561+'-'+_0x35bb56+'/'+_0x1219d4)[_0xb4bc('0x1a')](_0x1265e8);}return null;};}function patchUpdates(_0x11294b){return function(_0x27df74){try{jsonpatch[_0xb4bc('0x1e')](_0x27df74,_0x11294b,!![]);}catch(_0x274745){return BPromise[_0xb4bc('0x1f')](_0x274745);}return _0x27df74[_0xb4bc('0x20')]();};}function saveUpdates(_0x449d3b,_0x1d4cc9){return function(_0x10ba12){if(_0x10ba12){return _0x10ba12[_0xb4bc('0x21')](_0x449d3b)[_0xb4bc('0x22')](function(_0x299aaa){return _0x299aaa;});}return null;};}function removeEntity(_0x1310c7,_0x5acb3f){return function(_0x16674b){if(_0x16674b){return _0x16674b[_0xb4bc('0x23')]()[_0xb4bc('0x22')](function(){var _0x330b22=_0x16674b[_0xb4bc('0x24')]({'plain':!![]});var _0x4f3d45=_0xb4bc('0x25');return db[_0xb4bc('0x26')]['destroy']({'where':{'type':_0x4f3d45,'resourceId':_0x330b22['id']}})[_0xb4bc('0x22')](function(){return _0x16674b;});})[_0xb4bc('0x22')](function(){_0x1310c7[_0xb4bc('0x18')](0xcc)[_0xb4bc('0x19')]();});}};}function handleEntityNotFound(_0x1f0788,_0x9cf783){return function(_0x38aba2){if(!_0x38aba2){_0x1f0788[_0xb4bc('0x17')](0x194);}return _0x38aba2;};}function handleError(_0x558f9f,_0x16b0f3){_0x16b0f3=_0x16b0f3||0x1f4;return function(_0x495cd2){logger['error'](_0x495cd2[_0xb4bc('0x27')]);if(_0x495cd2[_0xb4bc('0x28')]){delete _0x495cd2['name'];}_0x558f9f[_0xb4bc('0x18')](_0x16b0f3)[_0xb4bc('0x29')](_0x495cd2);};}exports[_0xb4bc('0x2a')]=function(_0x361d96,_0x2f9129){var _0x4f9b00={},_0x1e7aab={},_0x55ecf8={'count':0x0,'rows':[]};var _0x4b80e2=_[_0xb4bc('0x2b')](db['Sound']['rawAttributes'],function(_0x30faa9){return{'name':_0x30faa9[_0xb4bc('0x2c')],'type':_0x30faa9[_0xb4bc('0x2d')][_0xb4bc('0x2e')]};});_0x1e7aab[_0xb4bc('0x2f')]=_['map'](_0x4b80e2,_0xb4bc('0x28'));_0x1e7aab['query']=_[_0xb4bc('0x30')](_0x361d96[_0xb4bc('0x31')]);_0x1e7aab[_0xb4bc('0x32')]=_[_0xb4bc('0x33')](_0x1e7aab['model'],_0x1e7aab[_0xb4bc('0x31')]);_0x4f9b00[_0xb4bc('0x34')]=_['intersection'](_0x1e7aab['model'],qs['fields'](_0x361d96[_0xb4bc('0x31')][_0xb4bc('0x35')]));_0x4f9b00[_0xb4bc('0x34')]=_0x4f9b00[_0xb4bc('0x34')]['length']?_0x4f9b00[_0xb4bc('0x34')]:_0x1e7aab[_0xb4bc('0x2f')];if(!_0x361d96[_0xb4bc('0x31')][_0xb4bc('0x36')](_0xb4bc('0x37'))){_0x4f9b00['limit']=qs[_0xb4bc('0x1c')](_0x361d96[_0xb4bc('0x31')]['limit']);_0x4f9b00[_0xb4bc('0x1b')]=qs[_0xb4bc('0x1b')](_0x361d96[_0xb4bc('0x31')]['offset']);}_0x4f9b00[_0xb4bc('0x38')]=qs[_0xb4bc('0x39')](_0x361d96[_0xb4bc('0x31')][_0xb4bc('0x39')]);_0x4f9b00['where']=qs[_0xb4bc('0x32')](_[_0xb4bc('0x3a')](_0x361d96[_0xb4bc('0x31')],_0x1e7aab['filters']),_0x4b80e2);if(_0x361d96[_0xb4bc('0x31')][_0xb4bc('0x3b')]){_0x4f9b00[_0xb4bc('0x3c')]=_['merge'](_0x4f9b00[_0xb4bc('0x3c')],{'$or':_[_0xb4bc('0x2b')](_0x4b80e2,function(_0x3f4cb4){if(_0x3f4cb4['type']!==_0xb4bc('0x3d')){var _0x3abb5d={};_0x3abb5d[_0x3f4cb4[_0xb4bc('0x28')]]={'$like':'%'+_0x361d96[_0xb4bc('0x31')][_0xb4bc('0x3b')]+'%'};return _0x3abb5d;}})});}_0x4f9b00=_['merge']({},_0x4f9b00,_0x361d96['options']);var _0x5d04b0={'where':_0x4f9b00[_0xb4bc('0x3c')]};return db[_0xb4bc('0x3e')]['count'](_0x5d04b0)[_0xb4bc('0x22')](function(_0x53ceca){_0x55ecf8[_0xb4bc('0x3f')]=_0x53ceca;if(_0x361d96[_0xb4bc('0x31')][_0xb4bc('0x40')]){_0x4f9b00[_0xb4bc('0x41')]=[{'all':!![]}];}return db[_0xb4bc('0x3e')][_0xb4bc('0x42')](_0x4f9b00);})[_0xb4bc('0x22')](function(_0x3bf14e){_0x55ecf8['rows']=_0x3bf14e;return _0x55ecf8;})['then'](respondWithFilteredResult(_0x2f9129,_0x4f9b00))['catch'](handleError(_0x2f9129,null));};exports[_0xb4bc('0x43')]=function(_0x50b31a,_0x59a172){var _0x3ba2fb={'raw':!![],'where':{'id':_0x50b31a['params']['id']}},_0x302e82={};_0x302e82[_0xb4bc('0x2f')]=_['keys'](db['Sound'][_0xb4bc('0x44')]);_0x302e82['query']=_[_0xb4bc('0x30')](_0x50b31a[_0xb4bc('0x31')]);_0x302e82[_0xb4bc('0x32')]=_['intersection'](_0x302e82[_0xb4bc('0x2f')],_0x302e82[_0xb4bc('0x31')]);_0x3ba2fb[_0xb4bc('0x34')]=_[_0xb4bc('0x33')](_0x302e82[_0xb4bc('0x2f')],qs[_0xb4bc('0x35')](_0x50b31a[_0xb4bc('0x31')][_0xb4bc('0x35')]));_0x3ba2fb[_0xb4bc('0x34')]=_0x3ba2fb['attributes'][_0xb4bc('0x45')]?_0x3ba2fb[_0xb4bc('0x34')]:_0x302e82['model'];if(_0x50b31a['query'][_0xb4bc('0x40')]){_0x3ba2fb[_0xb4bc('0x41')]=[{'all':!![]}];}_0x3ba2fb=_[_0xb4bc('0x46')]({},_0x3ba2fb,_0x50b31a[_0xb4bc('0x47')]);return db[_0xb4bc('0x3e')][_0xb4bc('0x48')](_0x3ba2fb)[_0xb4bc('0x22')](handleEntityNotFound(_0x59a172,null))[_0xb4bc('0x22')](respondWithResult(_0x59a172,null))['catch'](handleError(_0x59a172,null));};exports[_0xb4bc('0x49')]=function(_0x2b9fb4,_0x404698,_0x74ebdb){return db['Sound'][_0xb4bc('0x48')]({'where':{'id':_0x2b9fb4[_0xb4bc('0x4a')]['id']},'attributes':[_0xb4bc('0x28'),_0xb4bc('0x4b'),_0xb4bc('0x4c')],'raw':!![]})[_0xb4bc('0x22')](handleEntityNotFound(_0x404698,null))[_0xb4bc('0x22')](function(_0x230948){if(_0x230948){if(!fs['existsSync'](path[_0xb4bc('0x4d')](config['root'],_0xb4bc('0x4e'),_0x230948[_0xb4bc('0x4b')]+'.'+_0x230948['converted_format']))){throw new db[(_0xb4bc('0x4f'))][(_0xb4bc('0x50'))](_0xb4bc('0x51'));}return _0x404698[_0xb4bc('0x49')](path[_0xb4bc('0x4d')](config[_0xb4bc('0x52')],_0xb4bc('0x4e'),util[_0xb4bc('0x53')]('%s.%s',_0x230948[_0xb4bc('0x4b')],_0x230948[_0xb4bc('0x4c')])),util[_0xb4bc('0x53')]('%s.%s',_0x230948[_0xb4bc('0x28')],_0x230948[_0xb4bc('0x4c')]));}return null;})[_0xb4bc('0x54')](handleError(_0x404698,null));};exports[_0xb4bc('0x55')]=function(_0x2aacd1,_0x443dc5,_0x40dba2){var _0x1ec6db={'name':path[_0xb4bc('0x56')](_0x2aacd1[_0xb4bc('0x57')][_0xb4bc('0x58')],path['extname'](_0x2aacd1[_0xb4bc('0x57')][_0xb4bc('0x58')])),'save_name':path['basename'](_0x2aacd1['file']['filename'],path[_0xb4bc('0x59')](_0x2aacd1[_0xb4bc('0x57')][_0xb4bc('0x5a')])),'original_format':path[_0xb4bc('0x59')](_0x2aacd1[_0xb4bc('0x57')][_0xb4bc('0x58')])['substring'](0x1),'converted_format':'wav'};var _0x18659b=path[_0xb4bc('0x4d')](config['root'],_0xb4bc('0x5b'),_0x2aacd1[_0xb4bc('0x57')]['filename']);var _0xc579b4=path['join'](config[_0xb4bc('0x52')],'server/files/sounds/converted',util[_0xb4bc('0x53')]('%s.%s',path[_0xb4bc('0x56')](_0x2aacd1[_0xb4bc('0x57')][_0xb4bc('0x5a')],path[_0xb4bc('0x59')](_0x2aacd1[_0xb4bc('0x57')]['filename'])),_0x1ec6db[_0xb4bc('0x4c')]));logger[_0xb4bc('0x5c')](_0xb4bc('0x5d'),_0x18659b);logger[_0xb4bc('0x5c')]('Sound\x20upload\x20destination:\x20%s',_0xc579b4);try{fs['chmodSync'](_0x18659b,parseInt('0777',0x8));var _0x53f544=sox[_0xb4bc('0x5e')](_0x18659b,_0xc579b4,{'sampleRate':0x1f40,'format':'wav','channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x53f544['on'](_0xb4bc('0x5f'),function(_0x55c384){fs[_0xb4bc('0x60')](_0x18659b);_0x443dc5[_0xb4bc('0x18')](0x1f4)[_0xb4bc('0x29')](_0x55c384);});_0x53f544['on'](_0xb4bc('0x61'),function(_0x161aef){_0x1ec6db[_0xb4bc('0x62')]=isNaN(_0x161aef[_0xb4bc('0x63')])?null:_0x161aef[_0xb4bc('0x63')]*0x3e8;_0x1ec6db[_0xb4bc('0x64')]=isNaN(_0x161aef[_0xb4bc('0x65')])?null:_0x161aef[_0xb4bc('0x65')];_0x1ec6db[_0xb4bc('0x66')]=isNaN(_0x161aef[_0xb4bc('0x67')])?null:_0x161aef['channelCount'];_0x1ec6db[_0xb4bc('0x68')]=isNaN(_0x161aef['bitRate'])?null:_0x161aef[_0xb4bc('0x69')];_0x1ec6db[_0xb4bc('0x6a')]=isNaN(_0x161aef['sampleRate'])?null:_0x161aef['sampleRate'];});_0x53f544['on'](_0xb4bc('0x6b'),function(_0x582f35){_0x1ec6db[_0xb4bc('0x6c')]=isNaN(_0x582f35[_0xb4bc('0x63')])?null:_0x582f35['duration']*0x3e8;_0x1ec6db[_0xb4bc('0x6d')]=isNaN(_0x582f35[_0xb4bc('0x65')])?null:_0x582f35[_0xb4bc('0x65')];_0x1ec6db[_0xb4bc('0x6e')]=isNaN(_0x582f35['channelCount'])?null:_0x582f35['channelCount'];_0x1ec6db[_0xb4bc('0x6f')]=isNaN(_0x582f35[_0xb4bc('0x69')])?null:_0x582f35[_0xb4bc('0x69')];_0x1ec6db[_0xb4bc('0x70')]=isNaN(_0x582f35['sampleRate'])?null:_0x582f35['sampleRate'];});_0x53f544['on'](_0xb4bc('0x19'),function(){fs[_0xb4bc('0x71')](_0xc579b4,parseInt('0777',0x8));return db[_0xb4bc('0x3e')][_0xb4bc('0x55')](_0x1ec6db)[_0xb4bc('0x22')](function(_0x97ae6a){var _0x120c8b={'role':_0x2aacd1[_0xb4bc('0x72')]['role'],'userProfileId':_0x2aacd1[_0xb4bc('0x72')][_0xb4bc('0x73')]};if(!_0x120c8b)throw new Error(_0xb4bc('0x74'));if(_0x120c8b['role']===_0xb4bc('0x75')){var _0x1c4370=_0x97ae6a[_0xb4bc('0x24')]({'plain':!![]});return db[_0xb4bc('0x76')][_0xb4bc('0x48')]({'where':{'name':_0xb4bc('0x25'),'userProfileId':_0x120c8b['userProfileId']},'raw':!![]})[_0xb4bc('0x22')](function(_0x222259){if(_0x222259&&_0x222259[_0xb4bc('0x77')]===0x0){return db[_0xb4bc('0x26')]['create']({'name':_0x1c4370[_0xb4bc('0x28')],'resourceId':_0x1c4370['id'],'type':_0x222259[_0xb4bc('0x28')],'sectionId':_0x222259['id']},{})['then'](function(){return _0x97ae6a;});}else{return _0x97ae6a;}})[_0xb4bc('0x54')](function(_0x932474){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x932474);throw _0x932474;});}return _0x97ae6a;})['then'](respondWithResult(_0x443dc5,null))[_0xb4bc('0x54')](handleError(_0x443dc5,null));});_0x53f544[_0xb4bc('0x78')]();}catch(_0xffbe70){_0x443dc5[_0xb4bc('0x18')](0x1f4)[_0xb4bc('0x29')](_0xffbe70);}};exports[_0xb4bc('0x21')]=function(_0x146c95,_0xe97a53,_0x59adfb){return db[_0xb4bc('0x3e')][_0xb4bc('0x48')]({'where':{'id':_0x146c95[_0xb4bc('0x4a')]['id']}})[_0xb4bc('0x22')](handleEntityNotFound(_0xe97a53,null))[_0xb4bc('0x22')](saveUpdates(_[_0xb4bc('0x3a')](_0x146c95[_0xb4bc('0x72')],[_0xb4bc('0x28'),'description']),null))[_0xb4bc('0x22')](respondWithResult(_0xe97a53,null))['catch'](handleError(_0xe97a53,null));};exports['delete']=function(_0x4f262c,_0x20b81a,_0x1048bb){return db[_0xb4bc('0x3e')]['find']({'where':{'id':_0x4f262c['params']['id']}})[_0xb4bc('0x22')](function(_0x4b1622){if(_0x4b1622){return _0x4b1622[_0xb4bc('0x23')]();}})['then'](function(_0x5296b5){var _0x4c7641=path['join'](config[_0xb4bc('0x52')],_0xb4bc('0x5b'),util['format'](_0xb4bc('0x79'),_0x5296b5[_0xb4bc('0x4b')],_0x5296b5[_0xb4bc('0x7a')]));var _0x3205cb=path['join'](config[_0xb4bc('0x52')],_0xb4bc('0x4e'),util['format'](_0xb4bc('0x79'),_0x5296b5[_0xb4bc('0x4b')],_0x5296b5[_0xb4bc('0x4c')]));fs[_0xb4bc('0x60')](_0x4c7641);fs['unlinkSync'](_0x3205cb);return _0x5296b5;})['then'](function(_0x23f24b){if(_0x23f24b){return _0x20b81a[_0xb4bc('0x18')](0xcc)['end']();}})[_0xb4bc('0x22')](handleEntityNotFound(_0x20b81a,null))[_0xb4bc('0x54')](handleError(_0x20b81a,null));}; \ No newline at end of file diff --git a/server/api/sound/sound.model.js b/server/api/sound/sound.model.js index 4d1c541..a16730b 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 _0x8e0d=['rimraf','../../config/environment','define','Sound','lodash','api','moment','request-promise','path'];(function(_0x3d15cd,_0x467f91){var _0x55b5f4=function(_0x23928d){while(--_0x23928d){_0x3d15cd['push'](_0x3d15cd['shift']());}};_0x55b5f4(++_0x467f91);}(_0x8e0d,0x82));var _0xd8e0=function(_0x313c96,_0x3cee6e){_0x313c96=_0x313c96-0x0;var _0x522f53=_0x8e0d[_0x313c96];return _0x522f53;};'use strict';var _=require(_0xd8e0('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xd8e0('0x1'));var moment=require(_0xd8e0('0x2'));var BPromise=require('bluebird');var rp=require(_0xd8e0('0x3'));var fs=require('fs');var path=require(_0xd8e0('0x4'));var rimraf=require(_0xd8e0('0x5'));var config=require(_0xd8e0('0x6'));var attributes=require('./sound.attributes');module['exports']=function(_0x2e79ab,_0x33ff41){return _0x2e79ab[_0xd8e0('0x7')](_0xd8e0('0x8'),attributes,{'tableName':'tools_sounds','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9f7a=['tools_sounds','lodash','../../config/logger','bluebird','path','rimraf','../../config/environment','exports','define','Sound'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x9f7a,0x105));var _0xa9f7=function(_0x3e44fa,_0x75ed2a){_0x3e44fa=_0x3e44fa-0x0;var _0x2a0aba=_0x9f7a[_0x3e44fa];return _0x2a0aba;};'use strict';var _=require(_0xa9f7('0x0'));var util=require('util');var logger=require(_0xa9f7('0x1'))('api');var moment=require('moment');var BPromise=require(_0xa9f7('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xa9f7('0x3'));var rimraf=require(_0xa9f7('0x4'));var config=require(_0xa9f7('0x5'));var attributes=require('./sound.attributes');module[_0xa9f7('0x6')]=function(_0x4ff8f3,_0x1f8946){return _0x4ff8f3[_0xa9f7('0x7')](_0xa9f7('0x8'),attributes,{'tableName':_0xa9f7('0x9'),'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 d7cc7e5..aeaa5bb 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 _0x714a=['../../config/logger','rpc','jayson/promise','request','then','info','request\x20sent','stringify','error','code','Sound,\x20%s,\x20%s','message','result','catch','find','options','where','map','include','model','attributes','ShowSound','debug','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x714a,0xad));var _0xa714=function(_0x14d5cf,_0xb3819d){_0x14d5cf=_0x14d5cf-0x0;var _0x112212=_0x714a[_0x14d5cf];return _0x112212;};'use strict';var _=require(_0xa714('0x0'));var util=require('util');var moment=require(_0xa714('0x1'));var BPromise=require(_0xa714('0x2'));var rs=require(_0xa714('0x3'));var fs=require('fs');var Redis=require(_0xa714('0x4'));var db=require(_0xa714('0x5'))['db'];var utils=require(_0xa714('0x6'));var logger=require(_0xa714('0x7'))(_0xa714('0x8'));var config=require('../../config/environment');var jayson=require(_0xa714('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x2c8e3d,_0x130234,_0x312f56){return new BPromise(function(_0x44240c,_0x10467e){return client[_0xa714('0xa')](_0x2c8e3d,_0x312f56)[_0xa714('0xb')](function(_0x5c6abd){logger[_0xa714('0xc')]('Sound,\x20%s,\x20%s',_0x130234,'request\x20sent');logger['debug']('Sound,\x20%s,\x20%s,\x20%s',_0x130234,_0xa714('0xd'),JSON[_0xa714('0xe')](_0x5c6abd));if(_0x5c6abd['error']){if(_0x5c6abd[_0xa714('0xf')][_0xa714('0x10')]===0x1f4){logger[_0xa714('0xf')](_0xa714('0x11'),_0x130234,_0x5c6abd['error'][_0xa714('0x12')]);return _0x10467e(_0x5c6abd[_0xa714('0xf')][_0xa714('0x12')]);}logger[_0xa714('0xf')](_0xa714('0x11'),_0x130234,_0x5c6abd['error'][_0xa714('0x12')]);return _0x44240c(_0x5c6abd[_0xa714('0xf')]['message']);}else{logger[_0xa714('0xc')]('Sound,\x20%s,\x20%s',_0x130234,_0xa714('0xd'));_0x44240c(_0x5c6abd[_0xa714('0x13')][_0xa714('0x12')]);}})[_0xa714('0x14')](function(_0x449a9a){logger[_0xa714('0xf')](_0xa714('0x11'),_0x130234,_0x449a9a);_0x10467e(_0x449a9a);});});}exports['ShowSound']=function(_0x172caf){var _0x4b64b8=this;return new Promise(function(_0x17b6e2,_0xaaa1c8){return db['Sound'][_0xa714('0x15')]({'raw':_0x172caf[_0xa714('0x16')]?_0x172caf[_0xa714('0x16')]['raw']===undefined?!![]:![]:!![],'where':_0x172caf[_0xa714('0x16')]?_0x172caf[_0xa714('0x16')][_0xa714('0x17')]||null:null,'attributes':_0x172caf[_0xa714('0x16')]?_0x172caf[_0xa714('0x16')]['attributes']||null:null,'include':_0x172caf[_0xa714('0x16')]?_0x172caf[_0xa714('0x16')]['include']?_[_0xa714('0x18')](_0x172caf[_0xa714('0x16')][_0xa714('0x19')],function(_0x5b95a9){return{'model':db[_0x5b95a9[_0xa714('0x1a')]],'as':_0x5b95a9['as'],'attributes':_0x5b95a9['attributes'],'include':_0x5b95a9['include']?_[_0xa714('0x18')](_0x5b95a9[_0xa714('0x19')],function(_0x44eb38){return{'model':db[_0x44eb38[_0xa714('0x1a')]],'as':_0x44eb38['as'],'attributes':_0x44eb38[_0xa714('0x1b')],'include':_0x44eb38[_0xa714('0x19')]?_[_0xa714('0x18')](_0x44eb38['include'],function(_0x2806a9){return{'model':db[_0x2806a9[_0xa714('0x1a')]],'as':_0x2806a9['as'],'attributes':_0x2806a9[_0xa714('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xa714('0xb')](function(_0xe64c71){logger['info'](_0xa714('0x1c'),_0x172caf);logger[_0xa714('0x1d')]('ShowSound',_0x172caf,JSON['stringify'](_0xe64c71));_0x17b6e2(_0xe64c71);})[_0xa714('0x14')](function(_0x53da29){logger[_0xa714('0xf')](_0xa714('0x1c'),_0x53da29[_0xa714('0x12')],_0x172caf);_0xaaa1c8(_0x4b64b8[_0xa714('0xf')](0x1f4,_0x53da29[_0xa714('0x12')]));});});}; \ No newline at end of file +var _0xf878=['request\x20sent','debug','Sound,\x20%s,\x20%s,\x20%s','error','code','message','info','catch','ShowSound','Sound','find','options','where','include','map','model','attributes','stringify','util','moment','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','request','then','Sound,\x20%s,\x20%s'];(function(_0x44184a,_0x571ae2){var _0xd0031e=function(_0x599443){while(--_0x599443){_0x44184a['push'](_0x44184a['shift']());}};_0xd0031e(++_0x571ae2);}(_0xf878,0x13e));var _0x8f87=function(_0x3bce4c,_0x30ab0c){_0x3bce4c=_0x3bce4c-0x0;var _0x2cfc90=_0xf878[_0x3bce4c];return _0x2cfc90;};'use strict';var _=require('lodash');var util=require(_0x8f87('0x0'));var moment=require(_0x8f87('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8f87('0x2'));var db=require(_0x8f87('0x3'))['db'];var utils=require(_0x8f87('0x4'));var logger=require('../../config/logger')(_0x8f87('0x5'));var config=require('../../config/environment');var jayson=require(_0x8f87('0x6'));var client=jayson[_0x8f87('0x7')][_0x8f87('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x11d8e8,_0x3e2161,_0x469d98){return new BPromise(function(_0x18982a,_0x5a376c){return client[_0x8f87('0x9')](_0x11d8e8,_0x469d98)[_0x8f87('0xa')](function(_0xcdad55){logger['info'](_0x8f87('0xb'),_0x3e2161,_0x8f87('0xc'));logger[_0x8f87('0xd')](_0x8f87('0xe'),_0x3e2161,'request\x20sent',JSON['stringify'](_0xcdad55));if(_0xcdad55[_0x8f87('0xf')]){if(_0xcdad55[_0x8f87('0xf')][_0x8f87('0x10')]===0x1f4){logger[_0x8f87('0xf')](_0x8f87('0xb'),_0x3e2161,_0xcdad55[_0x8f87('0xf')][_0x8f87('0x11')]);return _0x5a376c(_0xcdad55[_0x8f87('0xf')]['message']);}logger[_0x8f87('0xf')](_0x8f87('0xb'),_0x3e2161,_0xcdad55[_0x8f87('0xf')][_0x8f87('0x11')]);return _0x18982a(_0xcdad55['error'][_0x8f87('0x11')]);}else{logger[_0x8f87('0x12')](_0x8f87('0xb'),_0x3e2161,_0x8f87('0xc'));_0x18982a(_0xcdad55['result'][_0x8f87('0x11')]);}})[_0x8f87('0x13')](function(_0x582859){logger[_0x8f87('0xf')](_0x8f87('0xb'),_0x3e2161,_0x582859);_0x5a376c(_0x582859);});});}exports[_0x8f87('0x14')]=function(_0x110ef0){var _0x11f51e=this;return new Promise(function(_0x5de0d6,_0xf993aa){return db[_0x8f87('0x15')][_0x8f87('0x16')]({'raw':_0x110ef0['options']?_0x110ef0[_0x8f87('0x17')]['raw']===undefined?!![]:![]:!![],'where':_0x110ef0[_0x8f87('0x17')]?_0x110ef0['options'][_0x8f87('0x18')]||null:null,'attributes':_0x110ef0[_0x8f87('0x17')]?_0x110ef0[_0x8f87('0x17')]['attributes']||null:null,'include':_0x110ef0[_0x8f87('0x17')]?_0x110ef0[_0x8f87('0x17')][_0x8f87('0x19')]?_[_0x8f87('0x1a')](_0x110ef0[_0x8f87('0x17')]['include'],function(_0x1803d9){return{'model':db[_0x1803d9[_0x8f87('0x1b')]],'as':_0x1803d9['as'],'attributes':_0x1803d9[_0x8f87('0x1c')],'include':_0x1803d9[_0x8f87('0x19')]?_[_0x8f87('0x1a')](_0x1803d9[_0x8f87('0x19')],function(_0x314689){return{'model':db[_0x314689['model']],'as':_0x314689['as'],'attributes':_0x314689['attributes'],'include':_0x314689[_0x8f87('0x19')]?_[_0x8f87('0x1a')](_0x314689[_0x8f87('0x19')],function(_0x40dd51){return{'model':db[_0x40dd51['model']],'as':_0x40dd51['as'],'attributes':_0x40dd51[_0x8f87('0x1c')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x4b1e42){logger[_0x8f87('0x12')]('ShowSound',_0x110ef0);logger[_0x8f87('0xd')]('ShowSound',_0x110ef0,JSON[_0x8f87('0x1d')](_0x4b1e42));_0x5de0d6(_0x4b1e42);})[_0x8f87('0x13')](function(_0x18f9cb){logger[_0x8f87('0xf')](_0x8f87('0x14'),_0x18f9cb[_0x8f87('0x11')],_0x110ef0);_0xf993aa(_0x11f51e[_0x8f87('0xf')](0x1f4,_0x18f9cb[_0x8f87('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/squareMessage/index.js b/server/api/squareMessage/index.js index 3c2d4b5..54b57f8 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 _0xd58f=['../../components/interaction/service','./squareMessage.controller','get','isAuthenticated','/:id','show','create','put','destroy','exports','multer','util','path','express','../../components/auth/service'];(function(_0x5b1c72,_0x5c1fd8){var _0x159b7f=function(_0x4201ea){while(--_0x4201ea){_0x5b1c72['push'](_0x5b1c72['shift']());}};_0x159b7f(++_0x5c1fd8);}(_0xd58f,0x73));var _0xfd58=function(_0xb0e53,_0x8cd2d){_0xb0e53=_0xb0e53-0x0;var _0x18f1aa=_0xd58f[_0xb0e53];return _0x18f1aa;};'use strict';var multer=require(_0xfd58('0x0'));var util=require(_0xfd58('0x1'));var path=require(_0xfd58('0x2'));var timeout=require('connect-timeout');var express=require(_0xfd58('0x3'));var router=express['Router']();var auth=require(_0xfd58('0x4'));var interaction=require(_0xfd58('0x5'));var config=require('../../config/environment');var controller=require(_0xfd58('0x6'));router[_0xfd58('0x7')]('/',auth[_0xfd58('0x8')](),controller['index']);router[_0xfd58('0x7')](_0xfd58('0x9'),auth[_0xfd58('0x8')](),controller[_0xfd58('0xa')]);router['post']('/',auth[_0xfd58('0x8')](),controller[_0xfd58('0xb')]);router[_0xfd58('0xc')](_0xfd58('0x9'),auth[_0xfd58('0x8')](),controller['update']);router['delete'](_0xfd58('0x9'),auth[_0xfd58('0x8')](),controller[_0xfd58('0xd')]);module[_0xfd58('0xe')]=router; \ No newline at end of file +var _0x36d9=['path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareMessage.controller','get','isAuthenticated','index','/:id','show','post','put','update','delete','exports','multer','util'];(function(_0x5bd616,_0x3eba4e){var _0x1012f4=function(_0x29e96b){while(--_0x29e96b){_0x5bd616['push'](_0x5bd616['shift']());}};_0x1012f4(++_0x3eba4e);}(_0x36d9,0x1b6));var _0x936d=function(_0x7239d0,_0x41268f){_0x7239d0=_0x7239d0-0x0;var _0x260b38=_0x36d9[_0x7239d0];return _0x260b38;};'use strict';var multer=require(_0x936d('0x0'));var util=require(_0x936d('0x1'));var path=require(_0x936d('0x2'));var timeout=require(_0x936d('0x3'));var express=require(_0x936d('0x4'));var router=express[_0x936d('0x5')]();var auth=require(_0x936d('0x6'));var interaction=require(_0x936d('0x7'));var config=require(_0x936d('0x8'));var controller=require(_0x936d('0x9'));router[_0x936d('0xa')]('/',auth[_0x936d('0xb')](),controller[_0x936d('0xc')]);router['get'](_0x936d('0xd'),auth[_0x936d('0xb')](),controller[_0x936d('0xe')]);router[_0x936d('0xf')]('/',auth[_0x936d('0xb')](),controller['create']);router[_0x936d('0x10')]('/:id',auth[_0x936d('0xb')](),controller[_0x936d('0x11')]);router[_0x936d('0x12')]('/:id',auth[_0x936d('0xb')](),controller['destroy']);module[_0x936d('0x13')]=router; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.attributes.js b/server/api/squareMessage/squareMessage.attributes.js index f4b972a..c54c469 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 _0x97bb=['ENUM','out','sequelize','exports','TEXT'];(function(_0x625a73,_0x50ae08){var _0x3eceb5=function(_0x9e9500){while(--_0x9e9500){_0x625a73['push'](_0x625a73['shift']());}};_0x3eceb5(++_0x50ae08);}(_0x97bb,0x16a));var _0xb97b=function(_0x27af45,_0x1b57aa){_0x27af45=_0x27af45-0x0;var _0x18df21=_0x97bb[_0x27af45];return _0x18df21;};'use strict';var Sequelize=require(_0xb97b('0x0'));module[_0xb97b('0x1')]={'uniqueid':{'type':Sequelize['STRING']},'body':{'type':Sequelize[_0xb97b('0x2')]('medium'),'allowNull':![]},'direction':{'type':Sequelize[_0xb97b('0x3')]('in',_0xb97b('0x4')),'defaultValue':_0xb97b('0x4'),'allowNull':![]}}; \ No newline at end of file +var _0xfa3f=['TEXT','ENUM','out','STRING'];(function(_0x39d548,_0x5dcb27){var _0x1c623d=function(_0x13689a){while(--_0x13689a){_0x39d548['push'](_0x39d548['shift']());}};_0x1c623d(++_0x5dcb27);}(_0xfa3f,0x1a7));var _0xffa3=function(_0x59356e,_0x500356){_0x59356e=_0x59356e-0x0;var _0x230601=_0xfa3f[_0x59356e];return _0x230601;};'use strict';var Sequelize=require('sequelize');module['exports']={'uniqueid':{'type':Sequelize[_0xffa3('0x0')]},'body':{'type':Sequelize[_0xffa3('0x1')]('medium'),'allowNull':![]},'direction':{'type':Sequelize[_0xffa3('0x2')]('in',_0xffa3('0x3')),'defaultValue':_0xffa3('0x3'),'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.controller.js b/server/api/squareMessage/squareMessage.controller.js index 50eb565..843fbc5 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 _0xb785=['map','query','keys','intersection','fields','attributes','length','hasOwnProperty','nolimit','limit','where','filters','merge','VIRTUAL','filter','options','include','catch','params','includeAll','find','create','body','update','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','to-csv','ejs','squel','crypto','jsforce','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','save','then','destroy','error','stack','name','send','SquareMessage','rawAttributes','fieldName','type','key','model'];(function(_0xbca1b1,_0x33f0ce){var _0x4e1686=function(_0x58a80c){while(--_0x58a80c){_0xbca1b1['push'](_0xbca1b1['shift']());}};_0x4e1686(++_0x33f0ce);}(_0xb785,0x1b6));var _0x5b78=function(_0x481564,_0x48d501){_0x481564=_0x481564-0x0;var _0x5cdfa6=_0xb785[_0x481564];return _0x5cdfa6;};'use strict';var pdf=require(_0x5b78('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x5b78('0x1'));var zipdir=require(_0x5b78('0x2'));var jsonpatch=require(_0x5b78('0x3'));var rp=require(_0x5b78('0x4'));var moment=require('moment');var BPromise=require(_0x5b78('0x5'));var Mustache=require(_0x5b78('0x6'));var util=require(_0x5b78('0x7'));var path=require(_0x5b78('0x8'));var sox=require('sox');var csv=require(_0x5b78('0x9'));var ejs=require(_0x5b78('0xa'));var fs=require('fs');var _=require('lodash');var squel=require(_0x5b78('0xb'));var crypto=require(_0x5b78('0xc'));var jsforce=require(_0x5b78('0xd'));var deskjs=require(_0x5b78('0xe'));var toCsv=require('to-csv');var querystring=require(_0x5b78('0xf'));var Papa=require(_0x5b78('0x10'));var Redis=require(_0x5b78('0x11'));var authService=require(_0x5b78('0x12'));var qs=require(_0x5b78('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x5b78('0x14'));var logger=require(_0x5b78('0x15'))('api');var utils=require(_0x5b78('0x16'));var config=require(_0x5b78('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1af5b8,_0x5b0c54){_0x5b0c54=_0x5b0c54||0xcc;return function(_0x205355){if(_0x205355){return _0x1af5b8[_0x5b78('0x18')](_0x5b0c54);}return _0x1af5b8[_0x5b78('0x19')](_0x5b0c54)[_0x5b78('0x1a')]();};}function respondWithResult(_0x69dca5,_0x151dae){_0x151dae=_0x151dae||0xc8;return function(_0x287522){if(_0x287522){return _0x69dca5[_0x5b78('0x19')](_0x151dae)[_0x5b78('0x1b')](_0x287522);}};}function respondWithFilteredResult(_0x313f57,_0x7af0f7){return function(_0x4a14c2){if(_0x4a14c2){var _0x353074=_0x4a14c2[_0x5b78('0x1c')],_0x19d554=_0x7af0f7[_0x5b78('0x1d')],_0x5e302c=_0x7af0f7['offset']+_0x7af0f7['limit'],_0x43a352;if(_0x5e302c>=_0x353074){_0x5e302c=_0x353074;_0x43a352=0xc8;}else{_0x43a352=0xce;}_0x313f57[_0x5b78('0x19')](_0x43a352);return _0x313f57['set'](_0x5b78('0x1e'),_0x19d554+'-'+_0x5e302c+'/'+_0x353074)['json'](_0x4a14c2);}return null;};}function patchUpdates(_0x240dae){return function(_0x51120f){try{jsonpatch[_0x5b78('0x1f')](_0x51120f,_0x240dae,!![]);}catch(_0x15bb59){return BPromise['reject'](_0x15bb59);}return _0x51120f[_0x5b78('0x20')]();};}function saveUpdates(_0x437725,_0x3a9329){return function(_0x91217a){if(_0x91217a){return _0x91217a['update'](_0x437725)[_0x5b78('0x21')](function(_0x726bbe){return _0x726bbe;});}return null;};}function removeEntity(_0x3cd9db,_0x1e4b7b){return function(_0x598300){if(_0x598300){return _0x598300[_0x5b78('0x22')]()[_0x5b78('0x21')](function(){_0x3cd9db[_0x5b78('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0xb98ed8,_0x3899c2){return function(_0x48f922){if(!_0x48f922){_0xb98ed8['sendStatus'](0x194);}return _0x48f922;};}function handleError(_0x1f80ea,_0xa1fed6){_0xa1fed6=_0xa1fed6||0x1f4;return function(_0xec0e43){logger[_0x5b78('0x23')](_0xec0e43[_0x5b78('0x24')]);if(_0xec0e43[_0x5b78('0x25')]){delete _0xec0e43[_0x5b78('0x25')];}_0x1f80ea[_0x5b78('0x19')](_0xa1fed6)[_0x5b78('0x26')](_0xec0e43);};}exports['index']=function(_0x17df3e,_0x2380df){var _0x3fd279={},_0x581c1b={},_0x37c61e={'count':0x0,'rows':[]};var _0x55bc48=_['map'](db[_0x5b78('0x27')][_0x5b78('0x28')],function(_0x58c459){return{'name':_0x58c459[_0x5b78('0x29')],'type':_0x58c459[_0x5b78('0x2a')][_0x5b78('0x2b')]};});_0x581c1b[_0x5b78('0x2c')]=_[_0x5b78('0x2d')](_0x55bc48,_0x5b78('0x25'));_0x581c1b[_0x5b78('0x2e')]=_[_0x5b78('0x2f')](_0x17df3e[_0x5b78('0x2e')]);_0x581c1b['filters']=_[_0x5b78('0x30')](_0x581c1b['model'],_0x581c1b[_0x5b78('0x2e')]);_0x3fd279['attributes']=_['intersection'](_0x581c1b[_0x5b78('0x2c')],qs['fields'](_0x17df3e[_0x5b78('0x2e')][_0x5b78('0x31')]));_0x3fd279[_0x5b78('0x32')]=_0x3fd279[_0x5b78('0x32')][_0x5b78('0x33')]?_0x3fd279[_0x5b78('0x32')]:_0x581c1b[_0x5b78('0x2c')];if(!_0x17df3e[_0x5b78('0x2e')][_0x5b78('0x34')](_0x5b78('0x35'))){_0x3fd279[_0x5b78('0x36')]=qs[_0x5b78('0x36')](_0x17df3e[_0x5b78('0x2e')][_0x5b78('0x36')]);_0x3fd279[_0x5b78('0x1d')]=qs['offset'](_0x17df3e['query'][_0x5b78('0x1d')]);}_0x3fd279['order']=qs['sort'](_0x17df3e['query']['sort']);_0x3fd279[_0x5b78('0x37')]=qs['filters'](_['pick'](_0x17df3e[_0x5b78('0x2e')],_0x581c1b[_0x5b78('0x38')]),_0x55bc48);if(_0x17df3e[_0x5b78('0x2e')]['filter']){_0x3fd279[_0x5b78('0x37')]=_[_0x5b78('0x39')](_0x3fd279[_0x5b78('0x37')],{'$or':_[_0x5b78('0x2d')](_0x55bc48,function(_0x26c8a8){if(_0x26c8a8[_0x5b78('0x2a')]!==_0x5b78('0x3a')){var _0xc4a3b8={};_0xc4a3b8[_0x26c8a8[_0x5b78('0x25')]]={'$like':'%'+_0x17df3e[_0x5b78('0x2e')][_0x5b78('0x3b')]+'%'};return _0xc4a3b8;}})});}_0x3fd279=_['merge']({},_0x3fd279,_0x17df3e[_0x5b78('0x3c')]);var _0x12b910={'where':_0x3fd279[_0x5b78('0x37')]};return db[_0x5b78('0x27')][_0x5b78('0x1c')](_0x12b910)[_0x5b78('0x21')](function(_0x1b95a5){_0x37c61e['count']=_0x1b95a5;if(_0x17df3e[_0x5b78('0x2e')]['includeAll']){_0x3fd279[_0x5b78('0x3d')]=[{'all':!![]}];}return db['SquareMessage']['findAll'](_0x3fd279);})[_0x5b78('0x21')](function(_0x4f1e91){_0x37c61e['rows']=_0x4f1e91;return _0x37c61e;})['then'](respondWithFilteredResult(_0x2380df,_0x3fd279))[_0x5b78('0x3e')](handleError(_0x2380df,null));};exports['show']=function(_0x45c44e,_0x11f713){var _0x94327d={'raw':!![],'where':{'id':_0x45c44e[_0x5b78('0x3f')]['id']}},_0x26892e={};_0x26892e[_0x5b78('0x2c')]=_['keys'](db[_0x5b78('0x27')]['rawAttributes']);_0x26892e[_0x5b78('0x2e')]=_[_0x5b78('0x2f')](_0x45c44e[_0x5b78('0x2e')]);_0x26892e['filters']=_[_0x5b78('0x30')](_0x26892e[_0x5b78('0x2c')],_0x26892e[_0x5b78('0x2e')]);_0x94327d['attributes']=_[_0x5b78('0x30')](_0x26892e['model'],qs['fields'](_0x45c44e['query'][_0x5b78('0x31')]));_0x94327d[_0x5b78('0x32')]=_0x94327d[_0x5b78('0x32')]['length']?_0x94327d[_0x5b78('0x32')]:_0x26892e[_0x5b78('0x2c')];if(_0x45c44e[_0x5b78('0x2e')][_0x5b78('0x40')]){_0x94327d[_0x5b78('0x3d')]=[{'all':!![]}];}_0x94327d=_[_0x5b78('0x39')]({},_0x94327d,_0x45c44e[_0x5b78('0x3c')]);return db['SquareMessage'][_0x5b78('0x41')](_0x94327d)[_0x5b78('0x21')](handleEntityNotFound(_0x11f713,null))[_0x5b78('0x21')](respondWithResult(_0x11f713,null))['catch'](handleError(_0x11f713,null));};exports['create']=function(_0x208dca,_0x21afca){return db[_0x5b78('0x27')][_0x5b78('0x42')](_0x208dca[_0x5b78('0x43')],{})[_0x5b78('0x21')](respondWithResult(_0x21afca,0xc9))['catch'](handleError(_0x21afca,null));};exports[_0x5b78('0x44')]=function(_0x54de68,_0x3bcfd4){if(_0x54de68[_0x5b78('0x43')]['id']){delete _0x54de68[_0x5b78('0x43')]['id'];}return db[_0x5b78('0x27')]['find']({'where':{'id':_0x54de68['params']['id']}})[_0x5b78('0x21')](handleEntityNotFound(_0x3bcfd4,null))[_0x5b78('0x21')](saveUpdates(_0x54de68[_0x5b78('0x43')],null))[_0x5b78('0x21')](respondWithResult(_0x3bcfd4,null))[_0x5b78('0x3e')](handleError(_0x3bcfd4,null));};exports['destroy']=function(_0xb33498,_0x407df8){return db[_0x5b78('0x27')]['find']({'where':{'id':_0xb33498[_0x5b78('0x3f')]['id']}})[_0x5b78('0x21')](handleEntityNotFound(_0x407df8,null))['then'](removeEntity(_0x407df8,null))['catch'](handleError(_0x407df8,null));}; \ No newline at end of file +var _0x7752=['jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','sendStatus','error','stack','name','send','index','map','rawAttributes','fieldName','type','query','filters','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','SquareMessage','findAll','rows','catch','show','params','keys','includeAll','options','find','create','body','eml-format','zip-dir','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','crypto'];(function(_0x2c9215,_0x58ff65){var _0x46dc79=function(_0x5b24e3){while(--_0x5b24e3){_0x2c9215['push'](_0x2c9215['shift']());}};_0x46dc79(++_0x58ff65);}(_0x7752,0x174));var _0x2775=function(_0x2fb4b2,_0x55fd94){_0x2fb4b2=_0x2fb4b2-0x0;var _0x25d88f=_0x7752[_0x2fb4b2];return _0x25d88f;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x2775('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x2775('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x2775('0x2'));var moment=require(_0x2775('0x3'));var BPromise=require(_0x2775('0x4'));var Mustache=require(_0x2775('0x5'));var util=require('util');var path=require(_0x2775('0x6'));var sox=require(_0x2775('0x7'));var csv=require(_0x2775('0x8'));var ejs=require(_0x2775('0x9'));var fs=require('fs');var _=require(_0x2775('0xa'));var squel=require(_0x2775('0xb'));var crypto=require(_0x2775('0xc'));var jsforce=require(_0x2775('0xd'));var deskjs=require(_0x2775('0xe'));var toCsv=require(_0x2775('0x8'));var querystring=require(_0x2775('0xf'));var Papa=require(_0x2775('0x10'));var Redis=require(_0x2775('0x11'));var authService=require(_0x2775('0x12'));var qs=require(_0x2775('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x2775('0x14'));var logger=require(_0x2775('0x15'))('api');var utils=require(_0x2775('0x16'));var config=require(_0x2775('0x17'));var db=require(_0x2775('0x18'))['db'];function respondWithStatusCode(_0x3dcc5f,_0x391fc9){_0x391fc9=_0x391fc9||0xcc;return function(_0x245d93){if(_0x245d93){return _0x3dcc5f['sendStatus'](_0x391fc9);}return _0x3dcc5f[_0x2775('0x19')](_0x391fc9)[_0x2775('0x1a')]();};}function respondWithResult(_0x464ccd,_0x428c77){_0x428c77=_0x428c77||0xc8;return function(_0x410984){if(_0x410984){return _0x464ccd[_0x2775('0x19')](_0x428c77)[_0x2775('0x1b')](_0x410984);}};}function respondWithFilteredResult(_0x5dd075,_0x169f3f){return function(_0x49bf4e){if(_0x49bf4e){var _0x5e8331=_0x49bf4e[_0x2775('0x1c')],_0x859861=_0x169f3f[_0x2775('0x1d')],_0x3c2ff9=_0x169f3f[_0x2775('0x1d')]+_0x169f3f[_0x2775('0x1e')],_0x69ce85;if(_0x3c2ff9>=_0x5e8331){_0x3c2ff9=_0x5e8331;_0x69ce85=0xc8;}else{_0x69ce85=0xce;}_0x5dd075[_0x2775('0x19')](_0x69ce85);return _0x5dd075[_0x2775('0x1f')](_0x2775('0x20'),_0x859861+'-'+_0x3c2ff9+'/'+_0x5e8331)[_0x2775('0x1b')](_0x49bf4e);}return null;};}function patchUpdates(_0xc3d84c){return function(_0x5c32e5){try{jsonpatch[_0x2775('0x21')](_0x5c32e5,_0xc3d84c,!![]);}catch(_0x3ff18c){return BPromise[_0x2775('0x22')](_0x3ff18c);}return _0x5c32e5[_0x2775('0x23')]();};}function saveUpdates(_0x56238b,_0x390b2e){return function(_0x399399){if(_0x399399){return _0x399399[_0x2775('0x24')](_0x56238b)[_0x2775('0x25')](function(_0x2fdc14){return _0x2fdc14;});}return null;};}function removeEntity(_0x47794a,_0x517ec2){return function(_0x457773){if(_0x457773){return _0x457773[_0x2775('0x26')]()[_0x2775('0x25')](function(){_0x47794a[_0x2775('0x19')](0xcc)[_0x2775('0x1a')]();});}};}function handleEntityNotFound(_0x3dc62d,_0x4546e4){return function(_0x4a4ea5){if(!_0x4a4ea5){_0x3dc62d[_0x2775('0x27')](0x194);}return _0x4a4ea5;};}function handleError(_0x3b9b0b,_0x826ff){_0x826ff=_0x826ff||0x1f4;return function(_0x42e988){logger[_0x2775('0x28')](_0x42e988[_0x2775('0x29')]);if(_0x42e988[_0x2775('0x2a')]){delete _0x42e988['name'];}_0x3b9b0b[_0x2775('0x19')](_0x826ff)[_0x2775('0x2b')](_0x42e988);};}exports[_0x2775('0x2c')]=function(_0xd93851,_0x201d05){var _0x412926={},_0x35d2ca={},_0x546ee0={'count':0x0,'rows':[]};var _0xc47272=_[_0x2775('0x2d')](db['SquareMessage'][_0x2775('0x2e')],function(_0x4ead8a){return{'name':_0x4ead8a[_0x2775('0x2f')],'type':_0x4ead8a[_0x2775('0x30')]['key']};});_0x35d2ca['model']=_[_0x2775('0x2d')](_0xc47272,_0x2775('0x2a'));_0x35d2ca[_0x2775('0x31')]=_['keys'](_0xd93851['query']);_0x35d2ca[_0x2775('0x32')]=_['intersection'](_0x35d2ca[_0x2775('0x33')],_0x35d2ca[_0x2775('0x31')]);_0x412926[_0x2775('0x34')]=_[_0x2775('0x35')](_0x35d2ca[_0x2775('0x33')],qs[_0x2775('0x36')](_0xd93851[_0x2775('0x31')][_0x2775('0x36')]));_0x412926[_0x2775('0x34')]=_0x412926['attributes'][_0x2775('0x37')]?_0x412926[_0x2775('0x34')]:_0x35d2ca['model'];if(!_0xd93851['query'][_0x2775('0x38')](_0x2775('0x39'))){_0x412926[_0x2775('0x1e')]=qs[_0x2775('0x1e')](_0xd93851['query']['limit']);_0x412926['offset']=qs['offset'](_0xd93851[_0x2775('0x31')][_0x2775('0x1d')]);}_0x412926[_0x2775('0x3a')]=qs['sort'](_0xd93851[_0x2775('0x31')][_0x2775('0x3b')]);_0x412926[_0x2775('0x3c')]=qs[_0x2775('0x32')](_[_0x2775('0x3d')](_0xd93851[_0x2775('0x31')],_0x35d2ca['filters']),_0xc47272);if(_0xd93851[_0x2775('0x31')][_0x2775('0x3e')]){_0x412926[_0x2775('0x3c')]=_['merge'](_0x412926['where'],{'$or':_[_0x2775('0x2d')](_0xc47272,function(_0x46062f){if(_0x46062f[_0x2775('0x30')]!==_0x2775('0x3f')){var _0x3c371d={};_0x3c371d[_0x46062f['name']]={'$like':'%'+_0xd93851[_0x2775('0x31')][_0x2775('0x3e')]+'%'};return _0x3c371d;}})});}_0x412926=_[_0x2775('0x40')]({},_0x412926,_0xd93851['options']);var _0x1f3d81={'where':_0x412926[_0x2775('0x3c')]};return db['SquareMessage'][_0x2775('0x1c')](_0x1f3d81)['then'](function(_0x155c2b){_0x546ee0['count']=_0x155c2b;if(_0xd93851[_0x2775('0x31')]['includeAll']){_0x412926['include']=[{'all':!![]}];}return db[_0x2775('0x41')][_0x2775('0x42')](_0x412926);})[_0x2775('0x25')](function(_0x5b7079){_0x546ee0[_0x2775('0x43')]=_0x5b7079;return _0x546ee0;})[_0x2775('0x25')](respondWithFilteredResult(_0x201d05,_0x412926))[_0x2775('0x44')](handleError(_0x201d05,null));};exports[_0x2775('0x45')]=function(_0x5827b8,_0x4223ab){var _0x574fbc={'raw':!![],'where':{'id':_0x5827b8[_0x2775('0x46')]['id']}},_0x12ac5c={};_0x12ac5c[_0x2775('0x33')]=_[_0x2775('0x47')](db[_0x2775('0x41')][_0x2775('0x2e')]);_0x12ac5c[_0x2775('0x31')]=_[_0x2775('0x47')](_0x5827b8[_0x2775('0x31')]);_0x12ac5c[_0x2775('0x32')]=_[_0x2775('0x35')](_0x12ac5c[_0x2775('0x33')],_0x12ac5c['query']);_0x574fbc[_0x2775('0x34')]=_['intersection'](_0x12ac5c[_0x2775('0x33')],qs[_0x2775('0x36')](_0x5827b8[_0x2775('0x31')][_0x2775('0x36')]));_0x574fbc[_0x2775('0x34')]=_0x574fbc['attributes'][_0x2775('0x37')]?_0x574fbc[_0x2775('0x34')]:_0x12ac5c[_0x2775('0x33')];if(_0x5827b8[_0x2775('0x31')][_0x2775('0x48')]){_0x574fbc['include']=[{'all':!![]}];}_0x574fbc=_[_0x2775('0x40')]({},_0x574fbc,_0x5827b8[_0x2775('0x49')]);return db[_0x2775('0x41')][_0x2775('0x4a')](_0x574fbc)[_0x2775('0x25')](handleEntityNotFound(_0x4223ab,null))[_0x2775('0x25')](respondWithResult(_0x4223ab,null))['catch'](handleError(_0x4223ab,null));};exports['create']=function(_0x291a5c,_0x5ded6e){return db[_0x2775('0x41')][_0x2775('0x4b')](_0x291a5c[_0x2775('0x4c')],{})[_0x2775('0x25')](respondWithResult(_0x5ded6e,0xc9))[_0x2775('0x44')](handleError(_0x5ded6e,null));};exports['update']=function(_0x402bef,_0x2936bb){if(_0x402bef['body']['id']){delete _0x402bef[_0x2775('0x4c')]['id'];}return db[_0x2775('0x41')][_0x2775('0x4a')]({'where':{'id':_0x402bef[_0x2775('0x46')]['id']}})[_0x2775('0x25')](handleEntityNotFound(_0x2936bb,null))[_0x2775('0x25')](saveUpdates(_0x402bef[_0x2775('0x4c')],null))[_0x2775('0x25')](respondWithResult(_0x2936bb,null))['catch'](handleError(_0x2936bb,null));};exports['destroy']=function(_0x2da58c,_0x218557){return db[_0x2775('0x41')][_0x2775('0x4a')]({'where':{'id':_0x2da58c[_0x2775('0x46')]['id']}})[_0x2775('0x25')](handleEntityNotFound(_0x218557,null))[_0x2775('0x25')](removeEntity(_0x218557,null))[_0x2775('0x44')](handleError(_0x218557,null));}; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.model.js b/server/api/squareMessage/squareMessage.model.js index d8220c1..f315d26 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 _0x1261=['util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./squareMessage.attributes','define','square_messages'];(function(_0xf7c3a5,_0x5db0f4){var _0x357243=function(_0x4867a6){while(--_0x4867a6){_0xf7c3a5['push'](_0xf7c3a5['shift']());}};_0x357243(++_0x5db0f4);}(_0x1261,0x144));var _0x1126=function(_0x2ff1f6,_0x1bc588){_0x2ff1f6=_0x2ff1f6-0x0;var _0xbae96d=_0x1261[_0x2ff1f6];return _0xbae96d;};'use strict';var _=require('lodash');var util=require(_0x1126('0x0'));var logger=require(_0x1126('0x1'))(_0x1126('0x2'));var moment=require(_0x1126('0x3'));var BPromise=require(_0x1126('0x4'));var rp=require(_0x1126('0x5'));var fs=require('fs');var path=require(_0x1126('0x6'));var rimraf=require(_0x1126('0x7'));var config=require(_0x1126('0x8'));var attributes=require(_0x1126('0x9'));module['exports']=function(_0x5c68c8,_0x40ba58){return _0x5c68c8[_0x1126('0xa')]('SquareMessage',attributes,{'tableName':_0x1126('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xabce=['util','../../config/logger','api','moment','path','rimraf','../../config/environment','define','square_messages','lodash'];(function(_0x578ffa,_0x159dd6){var _0x49cea7=function(_0x2b0e1b){while(--_0x2b0e1b){_0x578ffa['push'](_0x578ffa['shift']());}};_0x49cea7(++_0x159dd6);}(_0xabce,0x103));var _0xeabc=function(_0x53cf8e,_0x3d290f){_0x53cf8e=_0x53cf8e-0x0;var _0x459197=_0xabce[_0x53cf8e];return _0x459197;};'use strict';var _=require(_0xeabc('0x0'));var util=require(_0xeabc('0x1'));var logger=require(_0xeabc('0x2'))(_0xeabc('0x3'));var moment=require(_0xeabc('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xeabc('0x5'));var rimraf=require(_0xeabc('0x6'));var config=require(_0xeabc('0x7'));var attributes=require('./squareMessage.attributes');module['exports']=function(_0x1b07a8,_0x52a4d7){return _0x1b07a8[_0xeabc('0x8')]('SquareMessage',attributes,{'tableName':_0xeabc('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 c55e118..2cdd3a8 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 _0x3fc6=['result','catch','CreateSquareMessage','SquareMessage','create','body','options','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','http','request','then','SquareMessage,\x20%s,\x20%s','SquareMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info'];(function(_0x40eaf4,_0x54d2a9){var _0x3fde54=function(_0x4da78b){while(--_0x4da78b){_0x40eaf4['push'](_0x40eaf4['shift']());}};_0x3fde54(++_0x54d2a9);}(_0x3fc6,0x115));var _0x63fc=function(_0x26f4e3,_0x2e962c){_0x26f4e3=_0x26f4e3-0x0;var _0x20da27=_0x3fc6[_0x26f4e3];return _0x20da27;};'use strict';var _=require(_0x63fc('0x0'));var util=require('util');var moment=require(_0x63fc('0x1'));var BPromise=require(_0x63fc('0x2'));var rs=require(_0x63fc('0x3'));var fs=require('fs');var Redis=require(_0x63fc('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x63fc('0x5'));var logger=require(_0x63fc('0x6'))(_0x63fc('0x7'));var config=require('../../config/environment');var jayson=require(_0x63fc('0x8'));var client=jayson['client'][_0x63fc('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1c7f72,_0x3e8157,_0x571ab6){return new BPromise(function(_0x3ec832,_0xffe000){return client[_0x63fc('0xa')](_0x1c7f72,_0x571ab6)[_0x63fc('0xb')](function(_0x32749b){logger['info'](_0x63fc('0xc'),_0x3e8157,'request\x20sent');logger['debug'](_0x63fc('0xd'),_0x3e8157,_0x63fc('0xe'),JSON[_0x63fc('0xf')](_0x32749b));if(_0x32749b[_0x63fc('0x10')]){if(_0x32749b[_0x63fc('0x10')][_0x63fc('0x11')]===0x1f4){logger[_0x63fc('0x10')](_0x63fc('0xc'),_0x3e8157,_0x32749b['error'][_0x63fc('0x12')]);return _0xffe000(_0x32749b[_0x63fc('0x10')][_0x63fc('0x12')]);}logger['error'](_0x63fc('0xc'),_0x3e8157,_0x32749b[_0x63fc('0x10')][_0x63fc('0x12')]);return _0x3ec832(_0x32749b['error'][_0x63fc('0x12')]);}else{logger[_0x63fc('0x13')](_0x63fc('0xc'),_0x3e8157,_0x63fc('0xe'));_0x3ec832(_0x32749b[_0x63fc('0x14')][_0x63fc('0x12')]);}})[_0x63fc('0x15')](function(_0x19a3f2){logger[_0x63fc('0x10')](_0x63fc('0xc'),_0x3e8157,_0x19a3f2);_0xffe000(_0x19a3f2);});});}exports[_0x63fc('0x16')]=function(_0x2db18b){var _0x1283f8=this;return new Promise(function(_0x2e1fb8,_0x51b73e){return db[_0x63fc('0x17')][_0x63fc('0x18')](_0x2db18b[_0x63fc('0x19')],{'raw':_0x2db18b[_0x63fc('0x1a')]?_0x2db18b[_0x63fc('0x1a')]['raw']===undefined?!![]:![]:!![]})[_0x63fc('0xb')](function(_0x2c05ef){logger[_0x63fc('0x13')]('CreateSquareMessage',_0x2db18b);logger['debug'](_0x63fc('0x16'),_0x2db18b,JSON[_0x63fc('0xf')](_0x2c05ef));_0x2e1fb8(_0x2c05ef);})[_0x63fc('0x15')](function(_0x5810b8){logger[_0x63fc('0x10')](_0x63fc('0x16'),_0x5810b8[_0x63fc('0x12')],_0x2db18b);_0x51b73e(_0x1283f8['error'](0x1f4,_0x5810b8[_0x63fc('0x12')]));});});}; \ No newline at end of file +var _0x4279=['error','message','info','result','CreateSquareMessage','SquareMessage','create','body','options','raw','catch','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','then','SquareMessage,\x20%s,\x20%s','request\x20sent','debug','SquareMessage,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x5f0089,_0x227e2c){var _0x193892=function(_0x24051f){while(--_0x24051f){_0x5f0089['push'](_0x5f0089['shift']());}};_0x193892(++_0x227e2c);}(_0x4279,0x8d));var _0x9427=function(_0xe079d3,_0x250371){_0xe079d3=_0xe079d3-0x0;var _0x191e18=_0x4279[_0xe079d3];return _0x191e18;};'use strict';var _=require('lodash');var util=require(_0x9427('0x0'));var moment=require(_0x9427('0x1'));var BPromise=require('bluebird');var rs=require(_0x9427('0x2'));var fs=require('fs');var Redis=require(_0x9427('0x3'));var db=require(_0x9427('0x4'))['db'];var utils=require(_0x9427('0x5'));var logger=require('../../config/logger')(_0x9427('0x6'));var config=require('../../config/environment');var jayson=require(_0x9427('0x7'));var client=jayson[_0x9427('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x7fa417,_0x511208,_0x25ba0b){return new BPromise(function(_0x4d24f2,_0x322f34){return client['request'](_0x7fa417,_0x25ba0b)[_0x9427('0x9')](function(_0x4c729a){logger['info'](_0x9427('0xa'),_0x511208,_0x9427('0xb'));logger[_0x9427('0xc')](_0x9427('0xd'),_0x511208,_0x9427('0xb'),JSON[_0x9427('0xe')](_0x4c729a));if(_0x4c729a[_0x9427('0xf')]){if(_0x4c729a[_0x9427('0xf')]['code']===0x1f4){logger[_0x9427('0xf')](_0x9427('0xa'),_0x511208,_0x4c729a[_0x9427('0xf')][_0x9427('0x10')]);return _0x322f34(_0x4c729a[_0x9427('0xf')][_0x9427('0x10')]);}logger[_0x9427('0xf')](_0x9427('0xa'),_0x511208,_0x4c729a[_0x9427('0xf')][_0x9427('0x10')]);return _0x4d24f2(_0x4c729a[_0x9427('0xf')][_0x9427('0x10')]);}else{logger[_0x9427('0x11')]('SquareMessage,\x20%s,\x20%s',_0x511208,_0x9427('0xb'));_0x4d24f2(_0x4c729a[_0x9427('0x12')][_0x9427('0x10')]);}})['catch'](function(_0x542718){logger[_0x9427('0xf')]('SquareMessage,\x20%s,\x20%s',_0x511208,_0x542718);_0x322f34(_0x542718);});});}exports[_0x9427('0x13')]=function(_0x20de12){var _0x4aaea7=this;return new Promise(function(_0x5177e2,_0x296bd6){return db[_0x9427('0x14')][_0x9427('0x15')](_0x20de12[_0x9427('0x16')],{'raw':_0x20de12[_0x9427('0x17')]?_0x20de12[_0x9427('0x17')][_0x9427('0x18')]===undefined?!![]:![]:!![]})[_0x9427('0x9')](function(_0xa9da31){logger[_0x9427('0x11')](_0x9427('0x13'),_0x20de12);logger[_0x9427('0xc')](_0x9427('0x13'),_0x20de12,JSON[_0x9427('0xe')](_0xa9da31));_0x5177e2(_0xa9da31);})[_0x9427('0x19')](function(_0x3e8743){logger['error']('CreateSquareMessage',_0x3e8743[_0x9427('0x10')],_0x20de12);_0x296bd6(_0x4aaea7[_0x9427('0xf')](0x1f4,_0x3e8743[_0x9427('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/squareOdbc/index.js b/server/api/squareOdbc/index.js index 7638275..3a4f6c0 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 _0x26ef=['../../components/interaction/service','../../config/environment','isAuthenticated','index','get','/:id','show','/:id/test','post','create','update','exports','util','path','connect-timeout','express','../../components/auth/service'];(function(_0x35778e,_0x191dc6){var _0x3dc89a=function(_0x3fef1c){while(--_0x3fef1c){_0x35778e['push'](_0x35778e['shift']());}};_0x3dc89a(++_0x191dc6);}(_0x26ef,0x13e));var _0xf26e=function(_0x2aaf3d,_0x4b2e17){_0x2aaf3d=_0x2aaf3d-0x0;var _0xf95fb8=_0x26ef[_0x2aaf3d];return _0xf95fb8;};'use strict';var multer=require('multer');var util=require(_0xf26e('0x0'));var path=require(_0xf26e('0x1'));var timeout=require(_0xf26e('0x2'));var express=require(_0xf26e('0x3'));var router=express['Router']();var auth=require(_0xf26e('0x4'));var interaction=require(_0xf26e('0x5'));var config=require(_0xf26e('0x6'));var controller=require('./squareOdbc.controller');router['get']('/',auth[_0xf26e('0x7')](),controller[_0xf26e('0x8')]);router[_0xf26e('0x9')](_0xf26e('0xa'),auth[_0xf26e('0x7')](),controller[_0xf26e('0xb')]);router[_0xf26e('0x9')](_0xf26e('0xc'),auth[_0xf26e('0x7')](),timeout('15s'),controller['test']);router[_0xf26e('0xd')]('/',auth[_0xf26e('0x7')](),controller[_0xf26e('0xe')]);router['put'](_0xf26e('0xa'),auth[_0xf26e('0x7')](),controller[_0xf26e('0xf')]);router['delete'](_0xf26e('0xa'),auth[_0xf26e('0x7')](),controller['destroy']);module[_0xf26e('0x10')]=router; \ No newline at end of file +var _0x168b=['destroy','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareOdbc.controller','isAuthenticated','index','get','show','/:id/test','15s','test','post','create','put','/:id','delete'];(function(_0x59b12e,_0xbf0942){var _0xcb7ea9=function(_0x459af8){while(--_0x459af8){_0x59b12e['push'](_0x59b12e['shift']());}};_0xcb7ea9(++_0xbf0942);}(_0x168b,0x9b));var _0xb168=function(_0x4a92f9,_0x32b570){_0x4a92f9=_0x4a92f9-0x0;var _0x3c6448=_0x168b[_0x4a92f9];return _0x3c6448;};'use strict';var multer=require(_0xb168('0x0'));var util=require(_0xb168('0x1'));var path=require(_0xb168('0x2'));var timeout=require('connect-timeout');var express=require(_0xb168('0x3'));var router=express[_0xb168('0x4')]();var auth=require(_0xb168('0x5'));var interaction=require(_0xb168('0x6'));var config=require(_0xb168('0x7'));var controller=require(_0xb168('0x8'));router['get']('/',auth[_0xb168('0x9')](),controller[_0xb168('0xa')]);router[_0xb168('0xb')]('/:id',auth[_0xb168('0x9')](),controller[_0xb168('0xc')]);router[_0xb168('0xb')](_0xb168('0xd'),auth[_0xb168('0x9')](),timeout(_0xb168('0xe')),controller[_0xb168('0xf')]);router[_0xb168('0x10')]('/',auth[_0xb168('0x9')](),controller[_0xb168('0x11')]);router[_0xb168('0x12')](_0xb168('0x13'),auth[_0xb168('0x9')](),controller['update']);router[_0xb168('0x14')]('/:id',auth['isAuthenticated'](),controller[_0xb168('0x15')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.attributes.js b/server/api/squareOdbc/squareOdbc.attributes.js index 1b83d4e..8c47dd2 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 _0x6685=['name','STRING','exports'];(function(_0x26f1b2,_0x33d843){var _0x1624a4=function(_0x58dfb7){while(--_0x58dfb7){_0x26f1b2['push'](_0x26f1b2['shift']());}};_0x1624a4(++_0x33d843);}(_0x6685,0x119));var _0x5668=function(_0x3d4bd5,_0x3e1ebf){_0x3d4bd5=_0x3d4bd5-0x0;var _0x4207ee=_0x6685[_0x3d4bd5];return _0x4207ee;};'use strict';var Sequelize=require('sequelize');module[_0x5668('0x0')]={'name':{'type':Sequelize['STRING'],'unique':_0x5668('0x1'),'allowNull':![]},'dsn':{'type':Sequelize[_0x5668('0x2')]},'description':{'type':Sequelize[_0x5668('0x2')]}}; \ No newline at end of file +var _0xdd05=['name','STRING'];(function(_0x18d4dc,_0x4752e3){var _0x48dda1=function(_0x1af6b1){while(--_0x1af6b1){_0x18d4dc['push'](_0x18d4dc['shift']());}};_0x48dda1(++_0x4752e3);}(_0xdd05,0x7f));var _0x5dd0=function(_0x2e7c1b,_0x232f79){_0x2e7c1b=_0x2e7c1b-0x0;var _0x42f565=_0xdd05[_0x2e7c1b];return _0x42f565;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x5dd0('0x0')],'unique':_0x5dd0('0x1'),'allowNull':![]},'dsn':{'type':Sequelize[_0x5dd0('0x0')]},'description':{'type':Sequelize[_0x5dd0('0x0')]}}; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.controller.js b/server/api/squareOdbc/squareOdbc.controller.js index 27f7bf7..e4f127a 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 _0x3b86=['eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/utils','../../config/environment','sendStatus','status','end','json','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','ODBC','error','stack','name','send','map','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','limit','order','sort','filter','merge','where','VIRTUAL','options','SquareOdbc','includeAll','include','findAll','rows','params','keys','length','find','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','test','dsn','odbc','openSync'];(function(_0x57f8c0,_0x136cf6){var _0x117f08=function(_0x426cd4){while(--_0x426cd4){_0x57f8c0['push'](_0x57f8c0['shift']());}};_0x117f08(++_0x136cf6);}(_0x3b86,0xae));var _0x63b8=function(_0x18edac,_0x487813){_0x18edac=_0x18edac-0x0;var _0x53c0c7=_0x3b86[_0x18edac];return _0x53c0c7;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x63b8('0x0'));var rimraf=require(_0x63b8('0x1'));var zipdir=require(_0x63b8('0x2'));var jsonpatch=require(_0x63b8('0x3'));var rp=require(_0x63b8('0x4'));var moment=require(_0x63b8('0x5'));var BPromise=require(_0x63b8('0x6'));var Mustache=require(_0x63b8('0x7'));var util=require(_0x63b8('0x8'));var path=require('path');var sox=require(_0x63b8('0x9'));var csv=require(_0x63b8('0xa'));var ejs=require(_0x63b8('0xb'));var fs=require('fs');var _=require(_0x63b8('0xc'));var squel=require(_0x63b8('0xd'));var crypto=require(_0x63b8('0xe'));var jsforce=require(_0x63b8('0xf'));var deskjs=require(_0x63b8('0x10'));var toCsv=require(_0x63b8('0xa'));var querystring=require('querystring');var Papa=require(_0x63b8('0x11'));var Redis=require(_0x63b8('0x12'));var authService=require(_0x63b8('0x13'));var qs=require(_0x63b8('0x14'));var as=require(_0x63b8('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0x63b8('0x16'));var config=require(_0x63b8('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x61f9c9,_0x35407c){_0x35407c=_0x35407c||0xcc;return function(_0x4ae7eb){if(_0x4ae7eb){return _0x61f9c9[_0x63b8('0x18')](_0x35407c);}return _0x61f9c9[_0x63b8('0x19')](_0x35407c)[_0x63b8('0x1a')]();};}function respondWithResult(_0x2404a1,_0x3ac951){_0x3ac951=_0x3ac951||0xc8;return function(_0x44dcbd){if(_0x44dcbd){return _0x2404a1[_0x63b8('0x19')](_0x3ac951)[_0x63b8('0x1b')](_0x44dcbd);}};}function respondWithFilteredResult(_0x34dca9,_0x19c838){return function(_0x5d929a){if(_0x5d929a){var _0x344c61=_0x5d929a[_0x63b8('0x1c')],_0x1cceae=_0x19c838[_0x63b8('0x1d')],_0x36519c=_0x19c838[_0x63b8('0x1d')]+_0x19c838['limit'],_0x1672ce;if(_0x36519c>=_0x344c61){_0x36519c=_0x344c61;_0x1672ce=0xc8;}else{_0x1672ce=0xce;}_0x34dca9['status'](_0x1672ce);return _0x34dca9[_0x63b8('0x1e')](_0x63b8('0x1f'),_0x1cceae+'-'+_0x36519c+'/'+_0x344c61)[_0x63b8('0x1b')](_0x5d929a);}return null;};}function patchUpdates(_0x36010d){return function(_0x16d1de){try{jsonpatch[_0x63b8('0x20')](_0x16d1de,_0x36010d,!![]);}catch(_0x55ad0e){return BPromise[_0x63b8('0x21')](_0x55ad0e);}return _0x16d1de[_0x63b8('0x22')]();};}function saveUpdates(_0x414241,_0x46f32e){return function(_0x4750a2){if(_0x4750a2){return _0x4750a2[_0x63b8('0x23')](_0x414241)[_0x63b8('0x24')](function(_0x53722e){return _0x53722e;});}return null;};}function removeEntity(_0x33f151,_0x2cd1a7){return function(_0x2c57b2){if(_0x2c57b2){return _0x2c57b2[_0x63b8('0x25')]()[_0x63b8('0x24')](function(){var _0xf332c0=_0x2c57b2['get']({'plain':!![]});var _0x3f83b4=_0x63b8('0x26');return db['UserProfileResource'][_0x63b8('0x25')]({'where':{'type':_0x3f83b4,'resourceId':_0xf332c0['id']}})[_0x63b8('0x24')](function(){return _0x2c57b2;});})[_0x63b8('0x24')](function(){_0x33f151['status'](0xcc)[_0x63b8('0x1a')]();});}};}function handleEntityNotFound(_0x27a82e,_0x4d5638){return function(_0x206102){if(!_0x206102){_0x27a82e[_0x63b8('0x18')](0x194);}return _0x206102;};}function handleError(_0xc8ee23,_0x1935b9){_0x1935b9=_0x1935b9||0x1f4;return function(_0x2d8829){logger[_0x63b8('0x27')](_0x2d8829[_0x63b8('0x28')]);if(_0x2d8829['name']){delete _0x2d8829[_0x63b8('0x29')];}_0xc8ee23[_0x63b8('0x19')](_0x1935b9)[_0x63b8('0x2a')](_0x2d8829);};}exports['index']=function(_0x43cb64,_0x261f44){var _0x2610cc={},_0x128f8b={},_0x550cdc={'count':0x0,'rows':[]};var _0x1659a9=_[_0x63b8('0x2b')](db['SquareOdbc'][_0x63b8('0x2c')],function(_0x3742da){return{'name':_0x3742da[_0x63b8('0x2d')],'type':_0x3742da[_0x63b8('0x2e')][_0x63b8('0x2f')]};});_0x128f8b[_0x63b8('0x30')]=_[_0x63b8('0x2b')](_0x1659a9,_0x63b8('0x29'));_0x128f8b[_0x63b8('0x31')]=_['keys'](_0x43cb64[_0x63b8('0x31')]);_0x128f8b[_0x63b8('0x32')]=_[_0x63b8('0x33')](_0x128f8b[_0x63b8('0x30')],_0x128f8b[_0x63b8('0x31')]);_0x2610cc[_0x63b8('0x34')]=_['intersection'](_0x128f8b[_0x63b8('0x30')],qs['fields'](_0x43cb64[_0x63b8('0x31')][_0x63b8('0x35')]));_0x2610cc[_0x63b8('0x34')]=_0x2610cc[_0x63b8('0x34')]['length']?_0x2610cc[_0x63b8('0x34')]:_0x128f8b[_0x63b8('0x30')];if(!_0x43cb64[_0x63b8('0x31')][_0x63b8('0x36')](_0x63b8('0x37'))){_0x2610cc['limit']=qs['limit'](_0x43cb64[_0x63b8('0x31')][_0x63b8('0x38')]);_0x2610cc[_0x63b8('0x1d')]=qs[_0x63b8('0x1d')](_0x43cb64[_0x63b8('0x31')]['offset']);}_0x2610cc[_0x63b8('0x39')]=qs['sort'](_0x43cb64[_0x63b8('0x31')][_0x63b8('0x3a')]);_0x2610cc['where']=qs['filters'](_['pick'](_0x43cb64[_0x63b8('0x31')],_0x128f8b['filters']),_0x1659a9);if(_0x43cb64['query'][_0x63b8('0x3b')]){_0x2610cc['where']=_[_0x63b8('0x3c')](_0x2610cc[_0x63b8('0x3d')],{'$or':_[_0x63b8('0x2b')](_0x1659a9,function(_0xe686db){if(_0xe686db[_0x63b8('0x2e')]!==_0x63b8('0x3e')){var _0xee7300={};_0xee7300[_0xe686db[_0x63b8('0x29')]]={'$like':'%'+_0x43cb64[_0x63b8('0x31')][_0x63b8('0x3b')]+'%'};return _0xee7300;}})});}_0x2610cc=_['merge']({},_0x2610cc,_0x43cb64[_0x63b8('0x3f')]);var _0x225882={'where':_0x2610cc[_0x63b8('0x3d')]};return db[_0x63b8('0x40')]['count'](_0x225882)[_0x63b8('0x24')](function(_0x2aae1d){_0x550cdc[_0x63b8('0x1c')]=_0x2aae1d;if(_0x43cb64['query'][_0x63b8('0x41')]){_0x2610cc[_0x63b8('0x42')]=[{'all':!![]}];}return db['SquareOdbc'][_0x63b8('0x43')](_0x2610cc);})[_0x63b8('0x24')](function(_0x537f01){_0x550cdc[_0x63b8('0x44')]=_0x537f01;return _0x550cdc;})['then'](respondWithFilteredResult(_0x261f44,_0x2610cc))['catch'](handleError(_0x261f44,null));};exports['show']=function(_0x42153f,_0x3adcb9){var _0x388afc={'raw':!![],'where':{'id':_0x42153f[_0x63b8('0x45')]['id']}},_0x1bdd5e={};_0x1bdd5e['model']=_[_0x63b8('0x46')](db[_0x63b8('0x40')][_0x63b8('0x2c')]);_0x1bdd5e[_0x63b8('0x31')]=_[_0x63b8('0x46')](_0x42153f['query']);_0x1bdd5e[_0x63b8('0x32')]=_[_0x63b8('0x33')](_0x1bdd5e[_0x63b8('0x30')],_0x1bdd5e[_0x63b8('0x31')]);_0x388afc[_0x63b8('0x34')]=_[_0x63b8('0x33')](_0x1bdd5e[_0x63b8('0x30')],qs[_0x63b8('0x35')](_0x42153f[_0x63b8('0x31')]['fields']));_0x388afc[_0x63b8('0x34')]=_0x388afc[_0x63b8('0x34')][_0x63b8('0x47')]?_0x388afc['attributes']:_0x1bdd5e['model'];if(_0x42153f[_0x63b8('0x31')][_0x63b8('0x41')]){_0x388afc[_0x63b8('0x42')]=[{'all':!![]}];}_0x388afc=_[_0x63b8('0x3c')]({},_0x388afc,_0x42153f[_0x63b8('0x3f')]);return db[_0x63b8('0x40')][_0x63b8('0x48')](_0x388afc)[_0x63b8('0x24')](handleEntityNotFound(_0x3adcb9,null))[_0x63b8('0x24')](respondWithResult(_0x3adcb9,null))[_0x63b8('0x49')](handleError(_0x3adcb9,null));};exports[_0x63b8('0x4a')]=function(_0x21b1c1,_0x594375){return db[_0x63b8('0x40')][_0x63b8('0x4a')](_0x21b1c1[_0x63b8('0x4b')],{})[_0x63b8('0x24')](function(_0x18e3be){var _0x45183a=_0x21b1c1[_0x63b8('0x4c')]['get']({'plain':!![]});if(!_0x45183a)throw new Error(_0x63b8('0x4d'));if(_0x45183a['role']===_0x63b8('0x4c')){var _0x170f5a=_0x18e3be['get']({'plain':!![]});var _0x4e9b51='ODBC';return db[_0x63b8('0x4e')][_0x63b8('0x48')]({'where':{'name':_0x4e9b51,'userProfileId':_0x45183a[_0x63b8('0x4f')]},'raw':!![]})[_0x63b8('0x24')](function(_0x46dc86){if(_0x46dc86&&_0x46dc86[_0x63b8('0x50')]===0x0){return db[_0x63b8('0x51')][_0x63b8('0x4a')]({'name':_0x170f5a[_0x63b8('0x29')],'resourceId':_0x170f5a['id'],'type':_0x46dc86[_0x63b8('0x29')],'sectionId':_0x46dc86['id']},{})['then'](function(){return _0x18e3be;});}else{return _0x18e3be;}})['catch'](function(_0x289198){logger[_0x63b8('0x27')](_0x63b8('0x52'),_0x289198);throw _0x289198;});}return _0x18e3be;})[_0x63b8('0x24')](respondWithResult(_0x594375,0xc9))['catch'](handleError(_0x594375,null));};exports[_0x63b8('0x23')]=function(_0x29431e,_0x1ee632){if(_0x29431e['body']['id']){delete _0x29431e[_0x63b8('0x4b')]['id'];}return db[_0x63b8('0x40')][_0x63b8('0x48')]({'where':{'id':_0x29431e['params']['id']}})[_0x63b8('0x24')](handleEntityNotFound(_0x1ee632,null))['then'](saveUpdates(_0x29431e[_0x63b8('0x4b')],null))[_0x63b8('0x24')](respondWithResult(_0x1ee632,null))[_0x63b8('0x49')](handleError(_0x1ee632,null));};exports[_0x63b8('0x25')]=function(_0x520954,_0x1b518b){return db[_0x63b8('0x40')][_0x63b8('0x48')]({'where':{'id':_0x520954[_0x63b8('0x45')]['id']}})[_0x63b8('0x24')](handleEntityNotFound(_0x1b518b,null))[_0x63b8('0x24')](removeEntity(_0x1b518b,null))[_0x63b8('0x49')](handleError(_0x1b518b,null));};exports[_0x63b8('0x53')]=function(_0x25554d,_0x26e254,_0x4f7b5c){var _0x1a1979;return db['SquareOdbc'][_0x63b8('0x48')]({'where':{'id':_0x25554d['params']['id']},'attributes':['id',_0x63b8('0x54')]})[_0x63b8('0x24')](handleEntityNotFound(_0x26e254,null))[_0x63b8('0x24')](function(_0xa09094){if(_0xa09094){var _0x4bd02b=require(_0x63b8('0x55'))();_0x4bd02b[_0x63b8('0x56')](_0xa09094[_0x63b8('0x54')]);_0x4bd02b['closeSync']();return _0xa09094;}})['then'](respondWithResult(_0x26e254,null))[_0x63b8('0x49')](handleError(_0x26e254,null));}; \ No newline at end of file +var _0x1446=['keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','merge','type','filter','options','includeAll','rows','catch','include','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','ODBC','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','test','dsn','odbc','closeSync','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/environment','../../mysqldb','sendStatus','status','json','count','offset','set','Content-Range','apply','save','update','then','destroy','UserProfileResource','end','error','stack','send','index','SquareOdbc','rawAttributes','fieldName','key','model','map','name','query'];(function(_0x40e471,_0x26a1ec){var _0x3d9d46=function(_0x896da3){while(--_0x896da3){_0x40e471['push'](_0x40e471['shift']());}};_0x3d9d46(++_0x26a1ec);}(_0x1446,0x7b));var _0x6144=function(_0x2318ba,_0x2c2e20){_0x2318ba=_0x2318ba-0x0;var _0x173321=_0x1446[_0x2318ba];return _0x173321;};'use strict';var pdf=require(_0x6144('0x0'));var emlformat=require(_0x6144('0x1'));var rimraf=require(_0x6144('0x2'));var zipdir=require(_0x6144('0x3'));var jsonpatch=require(_0x6144('0x4'));var rp=require(_0x6144('0x5'));var moment=require('moment');var BPromise=require(_0x6144('0x6'));var Mustache=require(_0x6144('0x7'));var util=require(_0x6144('0x8'));var path=require(_0x6144('0x9'));var sox=require(_0x6144('0xa'));var csv=require(_0x6144('0xb'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x6144('0xc'));var squel=require(_0x6144('0xd'));var crypto=require(_0x6144('0xe'));var jsforce=require(_0x6144('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x6144('0xb'));var querystring=require(_0x6144('0x10'));var Papa=require(_0x6144('0x11'));var Redis=require(_0x6144('0x12'));var authService=require(_0x6144('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x6144('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0x6144('0x15'));var db=require(_0x6144('0x16'))['db'];function respondWithStatusCode(_0x5276e6,_0x5f5279){_0x5f5279=_0x5f5279||0xcc;return function(_0x443e4d){if(_0x443e4d){return _0x5276e6[_0x6144('0x17')](_0x5f5279);}return _0x5276e6[_0x6144('0x18')](_0x5f5279)['end']();};}function respondWithResult(_0x3adeca,_0xe01f8e){_0xe01f8e=_0xe01f8e||0xc8;return function(_0x8793fe){if(_0x8793fe){return _0x3adeca[_0x6144('0x18')](_0xe01f8e)[_0x6144('0x19')](_0x8793fe);}};}function respondWithFilteredResult(_0x398514,_0x306c3b){return function(_0x27cb26){if(_0x27cb26){var _0x259c24=_0x27cb26[_0x6144('0x1a')],_0x1cf0ed=_0x306c3b[_0x6144('0x1b')],_0x12d63c=_0x306c3b[_0x6144('0x1b')]+_0x306c3b['limit'],_0x4e39a6;if(_0x12d63c>=_0x259c24){_0x12d63c=_0x259c24;_0x4e39a6=0xc8;}else{_0x4e39a6=0xce;}_0x398514['status'](_0x4e39a6);return _0x398514[_0x6144('0x1c')](_0x6144('0x1d'),_0x1cf0ed+'-'+_0x12d63c+'/'+_0x259c24)[_0x6144('0x19')](_0x27cb26);}return null;};}function patchUpdates(_0x447d94){return function(_0x499eff){try{jsonpatch[_0x6144('0x1e')](_0x499eff,_0x447d94,!![]);}catch(_0xf40436){return BPromise['reject'](_0xf40436);}return _0x499eff[_0x6144('0x1f')]();};}function saveUpdates(_0x4d0978,_0x170bad){return function(_0x54480c){if(_0x54480c){return _0x54480c[_0x6144('0x20')](_0x4d0978)[_0x6144('0x21')](function(_0x360569){return _0x360569;});}return null;};}function removeEntity(_0x31d306,_0x2ee621){return function(_0x177c91){if(_0x177c91){return _0x177c91[_0x6144('0x22')]()[_0x6144('0x21')](function(){var _0x4dad3d=_0x177c91['get']({'plain':!![]});var _0x1f04e1='ODBC';return db[_0x6144('0x23')][_0x6144('0x22')]({'where':{'type':_0x1f04e1,'resourceId':_0x4dad3d['id']}})[_0x6144('0x21')](function(){return _0x177c91;});})[_0x6144('0x21')](function(){_0x31d306[_0x6144('0x18')](0xcc)[_0x6144('0x24')]();});}};}function handleEntityNotFound(_0x478cc8,_0x33d285){return function(_0x21c36c){if(!_0x21c36c){_0x478cc8['sendStatus'](0x194);}return _0x21c36c;};}function handleError(_0x398b87,_0x3a1167){_0x3a1167=_0x3a1167||0x1f4;return function(_0x113d6b){logger[_0x6144('0x25')](_0x113d6b[_0x6144('0x26')]);if(_0x113d6b['name']){delete _0x113d6b['name'];}_0x398b87[_0x6144('0x18')](_0x3a1167)[_0x6144('0x27')](_0x113d6b);};}exports[_0x6144('0x28')]=function(_0x341420,_0x3ab5ce){var _0x2e5691={},_0x17aedb={},_0x19abab={'count':0x0,'rows':[]};var _0x9a9bc3=_['map'](db[_0x6144('0x29')][_0x6144('0x2a')],function(_0x47d238){return{'name':_0x47d238[_0x6144('0x2b')],'type':_0x47d238['type'][_0x6144('0x2c')]};});_0x17aedb[_0x6144('0x2d')]=_[_0x6144('0x2e')](_0x9a9bc3,_0x6144('0x2f'));_0x17aedb[_0x6144('0x30')]=_[_0x6144('0x31')](_0x341420[_0x6144('0x30')]);_0x17aedb[_0x6144('0x32')]=_['intersection'](_0x17aedb[_0x6144('0x2d')],_0x17aedb[_0x6144('0x30')]);_0x2e5691[_0x6144('0x33')]=_[_0x6144('0x34')](_0x17aedb[_0x6144('0x2d')],qs[_0x6144('0x35')](_0x341420[_0x6144('0x30')]['fields']));_0x2e5691[_0x6144('0x33')]=_0x2e5691[_0x6144('0x33')][_0x6144('0x36')]?_0x2e5691[_0x6144('0x33')]:_0x17aedb[_0x6144('0x2d')];if(!_0x341420['query'][_0x6144('0x37')](_0x6144('0x38'))){_0x2e5691[_0x6144('0x39')]=qs[_0x6144('0x39')](_0x341420[_0x6144('0x30')][_0x6144('0x39')]);_0x2e5691[_0x6144('0x1b')]=qs[_0x6144('0x1b')](_0x341420[_0x6144('0x30')]['offset']);}_0x2e5691[_0x6144('0x3a')]=qs[_0x6144('0x3b')](_0x341420[_0x6144('0x30')][_0x6144('0x3b')]);_0x2e5691[_0x6144('0x3c')]=qs['filters'](_[_0x6144('0x3d')](_0x341420[_0x6144('0x30')],_0x17aedb['filters']),_0x9a9bc3);if(_0x341420['query']['filter']){_0x2e5691[_0x6144('0x3c')]=_[_0x6144('0x3e')](_0x2e5691[_0x6144('0x3c')],{'$or':_[_0x6144('0x2e')](_0x9a9bc3,function(_0x551a0f){if(_0x551a0f[_0x6144('0x3f')]!=='VIRTUAL'){var _0x34558c={};_0x34558c[_0x551a0f[_0x6144('0x2f')]]={'$like':'%'+_0x341420[_0x6144('0x30')][_0x6144('0x40')]+'%'};return _0x34558c;}})});}_0x2e5691=_[_0x6144('0x3e')]({},_0x2e5691,_0x341420[_0x6144('0x41')]);var _0x263ffc={'where':_0x2e5691['where']};return db['SquareOdbc'][_0x6144('0x1a')](_0x263ffc)[_0x6144('0x21')](function(_0x1acaa7){_0x19abab[_0x6144('0x1a')]=_0x1acaa7;if(_0x341420[_0x6144('0x30')][_0x6144('0x42')]){_0x2e5691['include']=[{'all':!![]}];}return db[_0x6144('0x29')]['findAll'](_0x2e5691);})[_0x6144('0x21')](function(_0x479dd2){_0x19abab[_0x6144('0x43')]=_0x479dd2;return _0x19abab;})[_0x6144('0x21')](respondWithFilteredResult(_0x3ab5ce,_0x2e5691))[_0x6144('0x44')](handleError(_0x3ab5ce,null));};exports['show']=function(_0x33b5e8,_0x12de35){var _0x1d17d4={'raw':!![],'where':{'id':_0x33b5e8['params']['id']}},_0x649796={};_0x649796[_0x6144('0x2d')]=_[_0x6144('0x31')](db[_0x6144('0x29')]['rawAttributes']);_0x649796['query']=_[_0x6144('0x31')](_0x33b5e8[_0x6144('0x30')]);_0x649796['filters']=_[_0x6144('0x34')](_0x649796[_0x6144('0x2d')],_0x649796[_0x6144('0x30')]);_0x1d17d4[_0x6144('0x33')]=_[_0x6144('0x34')](_0x649796[_0x6144('0x2d')],qs[_0x6144('0x35')](_0x33b5e8[_0x6144('0x30')][_0x6144('0x35')]));_0x1d17d4[_0x6144('0x33')]=_0x1d17d4[_0x6144('0x33')][_0x6144('0x36')]?_0x1d17d4['attributes']:_0x649796[_0x6144('0x2d')];if(_0x33b5e8[_0x6144('0x30')][_0x6144('0x42')]){_0x1d17d4[_0x6144('0x45')]=[{'all':!![]}];}_0x1d17d4=_[_0x6144('0x3e')]({},_0x1d17d4,_0x33b5e8[_0x6144('0x41')]);return db[_0x6144('0x29')][_0x6144('0x46')](_0x1d17d4)[_0x6144('0x21')](handleEntityNotFound(_0x12de35,null))[_0x6144('0x21')](respondWithResult(_0x12de35,null))[_0x6144('0x44')](handleError(_0x12de35,null));};exports[_0x6144('0x47')]=function(_0x4bd3d8,_0x29bd2c){return db['SquareOdbc'][_0x6144('0x47')](_0x4bd3d8[_0x6144('0x48')],{})[_0x6144('0x21')](function(_0x284c5b){var _0x416985=_0x4bd3d8[_0x6144('0x49')][_0x6144('0x4a')]({'plain':!![]});if(!_0x416985)throw new Error(_0x6144('0x4b'));if(_0x416985[_0x6144('0x4c')]===_0x6144('0x49')){var _0x146379=_0x284c5b['get']({'plain':!![]});var _0x3afd8a=_0x6144('0x4d');return db[_0x6144('0x4e')]['find']({'where':{'name':_0x3afd8a,'userProfileId':_0x416985['userProfileId']},'raw':!![]})[_0x6144('0x21')](function(_0x2caaea){if(_0x2caaea&&_0x2caaea[_0x6144('0x4f')]===0x0){return db['UserProfileResource']['create']({'name':_0x146379[_0x6144('0x2f')],'resourceId':_0x146379['id'],'type':_0x2caaea['name'],'sectionId':_0x2caaea['id']},{})[_0x6144('0x21')](function(){return _0x284c5b;});}else{return _0x284c5b;}})['catch'](function(_0x42a0f8){logger[_0x6144('0x25')](_0x6144('0x50'),_0x42a0f8);throw _0x42a0f8;});}return _0x284c5b;})[_0x6144('0x21')](respondWithResult(_0x29bd2c,0xc9))[_0x6144('0x44')](handleError(_0x29bd2c,null));};exports[_0x6144('0x20')]=function(_0x2b41bd,_0xaa53d1){if(_0x2b41bd['body']['id']){delete _0x2b41bd['body']['id'];}return db[_0x6144('0x29')]['find']({'where':{'id':_0x2b41bd[_0x6144('0x51')]['id']}})[_0x6144('0x21')](handleEntityNotFound(_0xaa53d1,null))['then'](saveUpdates(_0x2b41bd[_0x6144('0x48')],null))[_0x6144('0x21')](respondWithResult(_0xaa53d1,null))[_0x6144('0x44')](handleError(_0xaa53d1,null));};exports['destroy']=function(_0x1b01d7,_0x457773){return db[_0x6144('0x29')][_0x6144('0x46')]({'where':{'id':_0x1b01d7['params']['id']}})[_0x6144('0x21')](handleEntityNotFound(_0x457773,null))['then'](removeEntity(_0x457773,null))[_0x6144('0x44')](handleError(_0x457773,null));};exports[_0x6144('0x52')]=function(_0x514b87,_0x383fc1,_0x2707e6){var _0xd0fc25;return db[_0x6144('0x29')][_0x6144('0x46')]({'where':{'id':_0x514b87[_0x6144('0x51')]['id']},'attributes':['id',_0x6144('0x53')]})['then'](handleEntityNotFound(_0x383fc1,null))[_0x6144('0x21')](function(_0xf32222){if(_0xf32222){var _0x218d76=require(_0x6144('0x54'))();_0x218d76['openSync'](_0xf32222['dsn']);_0x218d76[_0x6144('0x55')]();return _0xf32222;}})['then'](respondWithResult(_0x383fc1,null))[_0x6144('0x44')](handleError(_0x383fc1,null));}; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.model.js b/server/api/squareOdbc/squareOdbc.model.js index 2021555..09b4676 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 _0x203a=['util','../../config/logger','api','moment','bluebird','rimraf','../../config/environment','./squareOdbc.attributes','exports','square_odbc'];(function(_0x18ab2a,_0x4debcd){var _0x16dcee=function(_0x10107a){while(--_0x10107a){_0x18ab2a['push'](_0x18ab2a['shift']());}};_0x16dcee(++_0x4debcd);}(_0x203a,0x136));var _0xa203=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x203a[_0x20a584];return _0x4b41a8;};'use strict';var _=require('lodash');var util=require(_0xa203('0x0'));var logger=require(_0xa203('0x1'))(_0xa203('0x2'));var moment=require(_0xa203('0x3'));var BPromise=require(_0xa203('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xa203('0x5'));var config=require(_0xa203('0x6'));var attributes=require(_0xa203('0x7'));module[_0xa203('0x8')]=function(_0x3eb0f4,_0x23575f){return _0x3eb0f4['define']('SquareOdbc',attributes,{'tableName':_0xa203('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xec2f=['../../config/logger','moment','bluebird','rimraf','../../config/environment','exports','define','square_odbc','lodash','util'];(function(_0x214bf6,_0x5205b3){var _0x273223=function(_0x21065a){while(--_0x21065a){_0x214bf6['push'](_0x214bf6['shift']());}};_0x273223(++_0x5205b3);}(_0xec2f,0xa8));var _0xfec2=function(_0x5de7a5,_0x23948a){_0x5de7a5=_0x5de7a5-0x0;var _0x41e57b=_0xec2f[_0x5de7a5];return _0x41e57b;};'use strict';var _=require(_0xfec2('0x0'));var util=require(_0xfec2('0x1'));var logger=require(_0xfec2('0x2'))('api');var moment=require(_0xfec2('0x3'));var BPromise=require(_0xfec2('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xfec2('0x5'));var config=require(_0xfec2('0x6'));var attributes=require('./squareOdbc.attributes');module[_0xfec2('0x7')]=function(_0x5ab50e,_0x256aa3){return _0x5ab50e[_0xfec2('0x8')]('SquareOdbc',attributes,{'tableName':_0xfec2('0x9'),'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 84cae83..852fd6e 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 _0x7217=['where','attributes','map','include','model','ShowSquareOdbc','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','request','then','info','SquareOdbc,\x20%s,\x20%s','debug','SquareOdbc,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','SquareOdbc','find','options','raw'];(function(_0x4f54aa,_0x29cf8c){var _0x437938=function(_0x47ca78){while(--_0x47ca78){_0x4f54aa['push'](_0x4f54aa['shift']());}};_0x437938(++_0x29cf8c);}(_0x7217,0x19e));var _0x7721=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x7217[_0x5b644e];return _0x49c6bf;};'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')]('SquareOdbc,\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']('SquareOdbc,\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);});});}exports['ShowSquareOdbc']=function(_0x3fc09e){var _0x5cb0e6=this;return new Promise(function(_0xfec626,_0x4e96fb){return db[_0x7721('0x18')][_0x7721('0x19')]({'raw':_0x3fc09e[_0x7721('0x1a')]?_0x3fc09e[_0x7721('0x1a')][_0x7721('0x1b')]===undefined?!![]:![]:!![],'where':_0x3fc09e[_0x7721('0x1a')]?_0x3fc09e[_0x7721('0x1a')][_0x7721('0x1c')]||null:null,'attributes':_0x3fc09e['options']?_0x3fc09e[_0x7721('0x1a')][_0x7721('0x1d')]||null:null,'include':_0x3fc09e[_0x7721('0x1a')]?_0x3fc09e[_0x7721('0x1a')]['include']?_[_0x7721('0x1e')](_0x3fc09e['options'][_0x7721('0x1f')],function(_0x288e3a){return{'model':db[_0x288e3a[_0x7721('0x20')]],'as':_0x288e3a['as'],'attributes':_0x288e3a[_0x7721('0x1d')],'include':_0x288e3a[_0x7721('0x1f')]?_[_0x7721('0x1e')](_0x288e3a[_0x7721('0x1f')],function(_0x5b4d74){return{'model':db[_0x5b4d74[_0x7721('0x20')]],'as':_0x5b4d74['as'],'attributes':_0x5b4d74[_0x7721('0x1d')],'include':_0x5b4d74[_0x7721('0x1f')]?_[_0x7721('0x1e')](_0x5b4d74[_0x7721('0x1f')],function(_0x16355a){return{'model':db[_0x16355a[_0x7721('0x20')]],'as':_0x16355a['as'],'attributes':_0x16355a[_0x7721('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x7721('0xc')](function(_0x52316e){logger[_0x7721('0xd')]('ShowSquareOdbc',_0x3fc09e);logger['debug'](_0x7721('0x21'),_0x3fc09e,JSON[_0x7721('0x12')](_0x52316e));_0xfec626(_0x52316e);})[_0x7721('0x17')](function(_0x158d98){logger[_0x7721('0x13')](_0x7721('0x21'),_0x158d98[_0x7721('0x15')],_0x3fc09e);_0x4e96fb(_0x5cb0e6[_0x7721('0x13')](0x1f4,_0x158d98['message']));});});}; \ No newline at end of file +var _0x7217=['where','attributes','map','include','model','ShowSquareOdbc','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','request','then','info','SquareOdbc,\x20%s,\x20%s','debug','SquareOdbc,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','SquareOdbc','find','options','raw'];(function(_0x478a0c,_0x17c51a){var _0x3c76e5=function(_0x159b35){while(--_0x159b35){_0x478a0c['push'](_0x478a0c['shift']());}};_0x3c76e5(++_0x17c51a);}(_0x7217,0x19e));var _0x7721=function(_0x411add,_0x1aed38){_0x411add=_0x411add-0x0;var _0x238242=_0x7217[_0x411add];return _0x238242;};'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')]('SquareOdbc,\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']('SquareOdbc,\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);});});}exports['ShowSquareOdbc']=function(_0x3fc09e){var _0x5cb0e6=this;return new Promise(function(_0xfec626,_0x4e96fb){return db[_0x7721('0x18')][_0x7721('0x19')]({'raw':_0x3fc09e[_0x7721('0x1a')]?_0x3fc09e[_0x7721('0x1a')][_0x7721('0x1b')]===undefined?!![]:![]:!![],'where':_0x3fc09e[_0x7721('0x1a')]?_0x3fc09e[_0x7721('0x1a')][_0x7721('0x1c')]||null:null,'attributes':_0x3fc09e['options']?_0x3fc09e[_0x7721('0x1a')][_0x7721('0x1d')]||null:null,'include':_0x3fc09e[_0x7721('0x1a')]?_0x3fc09e[_0x7721('0x1a')]['include']?_[_0x7721('0x1e')](_0x3fc09e['options'][_0x7721('0x1f')],function(_0x288e3a){return{'model':db[_0x288e3a[_0x7721('0x20')]],'as':_0x288e3a['as'],'attributes':_0x288e3a[_0x7721('0x1d')],'include':_0x288e3a[_0x7721('0x1f')]?_[_0x7721('0x1e')](_0x288e3a[_0x7721('0x1f')],function(_0x5b4d74){return{'model':db[_0x5b4d74[_0x7721('0x20')]],'as':_0x5b4d74['as'],'attributes':_0x5b4d74[_0x7721('0x1d')],'include':_0x5b4d74[_0x7721('0x1f')]?_[_0x7721('0x1e')](_0x5b4d74[_0x7721('0x1f')],function(_0x16355a){return{'model':db[_0x16355a[_0x7721('0x20')]],'as':_0x16355a['as'],'attributes':_0x16355a[_0x7721('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x7721('0xc')](function(_0x52316e){logger[_0x7721('0xd')]('ShowSquareOdbc',_0x3fc09e);logger['debug'](_0x7721('0x21'),_0x3fc09e,JSON[_0x7721('0x12')](_0x52316e));_0xfec626(_0x52316e);})[_0x7721('0x17')](function(_0x158d98){logger[_0x7721('0x13')](_0x7721('0x21'),_0x158d98[_0x7721('0x15')],_0x3fc09e);_0x4e96fb(_0x5cb0e6[_0x7721('0x13')](0x1f4,_0x158d98['message']));});});}; \ No newline at end of file diff --git a/server/api/squareProject/index.js b/server/api/squareProject/index.js index b2cff2a..65eeb85 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(_0x449041,_0x5d1a18){var _0x26dc8b=function(_0x5b8273){while(--_0x5b8273){_0x449041['push'](_0x449041['shift']());}};_0x26dc8b(++_0x5d1a18);}(_0x96cc,0x16c));var _0xc96c=function(_0x4228a9,_0x40d3a3){_0x4228a9=_0x4228a9-0x0;var _0xdbce4a=_0x96cc[_0x4228a9];return _0xdbce4a;};'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 _0x8603=['util','path','connect-timeout','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','/:id','isAuthenticated','show','getUsers','post','create','addUsers','delete','destroy','/:id/users','removeUsers','exports'];(function(_0x2cf2e9,_0xd58ea1){var _0xd3670d=function(_0x272868){while(--_0x272868){_0x2cf2e9['push'](_0x2cf2e9['shift']());}};_0xd3670d(++_0xd58ea1);}(_0x8603,0x190));var _0x3860=function(_0x3d95e9,_0x45bb17){_0x3d95e9=_0x3d95e9-0x0;var _0x472c9a=_0x8603[_0x3d95e9];return _0x472c9a;};'use strict';var multer=require('multer');var util=require(_0x3860('0x0'));var path=require(_0x3860('0x1'));var timeout=require(_0x3860('0x2'));var express=require('express');var router=express['Router']();var auth=require(_0x3860('0x3'));var interaction=require(_0x3860('0x4'));var config=require(_0x3860('0x5'));var controller=require('./squareProject.controller');router[_0x3860('0x6')]('/',auth['isAuthenticated'](),controller[_0x3860('0x7')]);router[_0x3860('0x6')](_0x3860('0x8'),auth[_0x3860('0x9')](),controller[_0x3860('0xa')]);router['get']('/:id/users',auth['isAuthenticated'](),controller[_0x3860('0xb')]);router[_0x3860('0xc')]('/',auth['isAuthenticated'](),controller[_0x3860('0xd')]);router[_0x3860('0xc')]('/:id/users',auth[_0x3860('0x9')](),controller[_0x3860('0xe')]);router['put'](_0x3860('0x8'),auth[_0x3860('0x9')](),controller['update']);router[_0x3860('0xf')](_0x3860('0x8'),auth[_0x3860('0x9')](),controller[_0x3860('0x10')]);router[_0x3860('0xf')](_0x3860('0x11'),auth[_0x3860('0x9')](),controller[_0x3860('0x12')]);module[_0x3860('0x13')]=router; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.attributes.js b/server/api/squareProject/squareProject.attributes.js index 4b56b74..388b343 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 _0xb771=['toString','production','utf8','sequelize','exports','STRING','name','TEXT','BLOB','preproduction','getDataValue'];(function(_0x2546ba,_0x3104e5){var _0x5ea03d=function(_0x5169f1){while(--_0x5169f1){_0x2546ba['push'](_0x2546ba['shift']());}};_0x5ea03d(++_0x3104e5);}(_0xb771,0x100));var _0x1b77=function(_0x25e7cb,_0x3579b7){_0x25e7cb=_0x25e7cb-0x0;var _0x375d92=_0xb771[_0x25e7cb];return _0x375d92;};'use strict';var Sequelize=require(_0x1b77('0x0'));module[_0x1b77('0x1')]={'name':{'type':Sequelize[_0x1b77('0x2')],'unique':_0x1b77('0x3'),'allowNull':![]},'description':{'type':Sequelize[_0x1b77('0x2')]},'notes':{'type':Sequelize[_0x1b77('0x4')]},'preproduction':{'type':Sequelize[_0x1b77('0x5')]('long'),'get':function(){if(this['getDataValue'](_0x1b77('0x6'))){return this[_0x1b77('0x7')]('preproduction')[_0x1b77('0x8')]('utf8');}}},'production':{'type':Sequelize[_0x1b77('0x5')]('long'),'get':function(){if(this[_0x1b77('0x7')](_0x1b77('0x9'))){return this[_0x1b77('0x7')]('production')[_0x1b77('0x8')](_0x1b77('0xa'));}}}}; \ No newline at end of file +var _0x1dbe=['name','BLOB','getDataValue','preproduction','toString','utf8','long','production','exports','STRING'];(function(_0x5be8c5,_0xdbb932){var _0x229597=function(_0x401fd4){while(--_0x401fd4){_0x5be8c5['push'](_0x5be8c5['shift']());}};_0x229597(++_0xdbb932);}(_0x1dbe,0xbc));var _0xe1db=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x1dbe[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require('sequelize');module[_0xe1db('0x0')]={'name':{'type':Sequelize[_0xe1db('0x1')],'unique':_0xe1db('0x2'),'allowNull':![]},'description':{'type':Sequelize['STRING']},'notes':{'type':Sequelize['TEXT']},'preproduction':{'type':Sequelize[_0xe1db('0x3')]('long'),'get':function(){if(this[_0xe1db('0x4')]('preproduction')){return this['getDataValue'](_0xe1db('0x5'))[_0xe1db('0x6')](_0xe1db('0x7'));}}},'production':{'type':Sequelize[_0xe1db('0x3')](_0xe1db('0x8')),'get':function(){if(this[_0xe1db('0x4')](_0xe1db('0x9'))){return this[_0xe1db('0x4')](_0xe1db('0x9'))[_0xe1db('0x6')]('utf8');}}}}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.controller.js b/server/api/squareProject/squareProject.controller.js index 1dcf773..197afd0 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 _0x44d7=['fast-json-patch','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/license/hardware','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./squareProject.socket','register','sendStatus','status','json','offset','limit','Content-Range','reject','save','update','then','destroy','get','UserProfileResource','end','error','name','send','rawAttributes','type','key','model','map','query','intersection','attributes','hasOwnProperty','order','sort','where','filters','filter','merge','VIRTUAL','options','count','includeAll','include','SquareProject','findAll','rows','catch','show','keys','fields','length','find','create','body','role','user','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','addUsers','ids','omit','removeUsers','isArray','emit','userSquareProject:remove','findOne','User','pick','getUsers','nolimit','html-pdf','eml-format','rimraf','zip-dir'];(function(_0x3a3758,_0x4dd8cf){var _0x1a9234=function(_0x3dda22){while(--_0x3dda22){_0x3a3758['push'](_0x3a3758['shift']());}};_0x1a9234(++_0x4dd8cf);}(_0x44d7,0x180));var _0x744d=function(_0x4e9628,_0x250573){_0x4e9628=_0x4e9628-0x0;var _0x27bc8c=_0x44d7[_0x4e9628];return _0x27bc8c;};'use strict';var pdf=require(_0x744d('0x0'));var emlformat=require(_0x744d('0x1'));var rimraf=require(_0x744d('0x2'));var zipdir=require(_0x744d('0x3'));var jsonpatch=require(_0x744d('0x4'));var rp=require(_0x744d('0x5'));var moment=require(_0x744d('0x6'));var BPromise=require(_0x744d('0x7'));var Mustache=require(_0x744d('0x8'));var util=require(_0x744d('0x9'));var path=require(_0x744d('0xa'));var sox=require(_0x744d('0xb'));var csv=require(_0x744d('0xc'));var ejs=require(_0x744d('0xd'));var fs=require('fs');var _=require('lodash');var squel=require(_0x744d('0xe'));var crypto=require(_0x744d('0xf'));var jsforce=require(_0x744d('0x10'));var deskjs=require(_0x744d('0x11'));var toCsv=require(_0x744d('0xc'));var querystring=require(_0x744d('0x12'));var Papa=require(_0x744d('0x13'));var Redis=require(_0x744d('0x14'));var authService=require('../../components/auth/service');var qs=require(_0x744d('0x15'));var as=require(_0x744d('0x16'));var hardwareService=require(_0x744d('0x17'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require('../../config/environment');var db=require(_0x744d('0x18'))['db'];config['redis']=_[_0x744d('0x19')](config[_0x744d('0x1a')],{'host':_0x744d('0x1b'),'port':0x18eb});var socket=require(_0x744d('0x1c'))(new Redis(config[_0x744d('0x1a')]));require(_0x744d('0x1d'))[_0x744d('0x1e')](socket);function respondWithStatusCode(_0x228611,_0x2123e3){_0x2123e3=_0x2123e3||0xcc;return function(_0x2cdb66){if(_0x2cdb66){return _0x228611[_0x744d('0x1f')](_0x2123e3);}return _0x228611['status'](_0x2123e3)['end']();};}function respondWithResult(_0x4e5364,_0x2bce35){_0x2bce35=_0x2bce35||0xc8;return function(_0xd785b1){if(_0xd785b1){return _0x4e5364[_0x744d('0x20')](_0x2bce35)[_0x744d('0x21')](_0xd785b1);}};}function respondWithFilteredResult(_0x162364,_0x1ca9a9){return function(_0x1c7649){if(_0x1c7649){var _0x36ea5b=_0x1c7649['count'],_0x15e421=_0x1ca9a9['offset'],_0x519003=_0x1ca9a9[_0x744d('0x22')]+_0x1ca9a9[_0x744d('0x23')],_0x1dd741;if(_0x519003>=_0x36ea5b){_0x519003=_0x36ea5b;_0x1dd741=0xc8;}else{_0x1dd741=0xce;}_0x162364[_0x744d('0x20')](_0x1dd741);return _0x162364['set'](_0x744d('0x24'),_0x15e421+'-'+_0x519003+'/'+_0x36ea5b)[_0x744d('0x21')](_0x1c7649);}return null;};}function patchUpdates(_0x26da6b){return function(_0x5e6fcd){try{jsonpatch['apply'](_0x5e6fcd,_0x26da6b,!![]);}catch(_0x168019){return BPromise[_0x744d('0x25')](_0x168019);}return _0x5e6fcd[_0x744d('0x26')]();};}function saveUpdates(_0x508c53,_0x53f891){return function(_0x3d6c5b){if(_0x3d6c5b){return _0x3d6c5b[_0x744d('0x27')](_0x508c53)[_0x744d('0x28')](function(_0x18e28f){return _0x18e28f;});}return null;};}function removeEntity(_0x3caa23,_0x30d651){return function(_0x1c543f){if(_0x1c543f){return _0x1c543f[_0x744d('0x29')]()[_0x744d('0x28')](function(){var _0x50cf36=_0x1c543f[_0x744d('0x2a')]({'plain':!![]});var _0x38d726='SquareProjects';return db[_0x744d('0x2b')][_0x744d('0x29')]({'where':{'type':_0x38d726,'resourceId':_0x50cf36['id']}})['then'](function(){return _0x1c543f;});})[_0x744d('0x28')](function(){_0x3caa23['status'](0xcc)[_0x744d('0x2c')]();});}};}function handleEntityNotFound(_0x1fe1fa,_0x1332d9){return function(_0x10bf72){if(!_0x10bf72){_0x1fe1fa[_0x744d('0x1f')](0x194);}return _0x10bf72;};}function handleError(_0x211f87,_0x444f1c){_0x444f1c=_0x444f1c||0x1f4;return function(_0x2694b8){logger[_0x744d('0x2d')](_0x2694b8['stack']);if(_0x2694b8[_0x744d('0x2e')]){delete _0x2694b8[_0x744d('0x2e')];}_0x211f87[_0x744d('0x20')](_0x444f1c)[_0x744d('0x2f')](_0x2694b8);};}exports['index']=function(_0x45b970,_0x4af69c){var _0x57742e={},_0x325316={},_0x2968dd={'count':0x0,'rows':[]};var _0x36e900=_['map'](db['SquareProject'][_0x744d('0x30')],function(_0x5a2b4f){return{'name':_0x5a2b4f['fieldName'],'type':_0x5a2b4f[_0x744d('0x31')][_0x744d('0x32')]};});_0x325316[_0x744d('0x33')]=_[_0x744d('0x34')](_0x36e900,_0x744d('0x2e'));_0x325316[_0x744d('0x35')]=_['keys'](_0x45b970[_0x744d('0x35')]);_0x325316['filters']=_[_0x744d('0x36')](_0x325316[_0x744d('0x33')],_0x325316[_0x744d('0x35')]);_0x57742e['attributes']=_[_0x744d('0x36')](_0x325316[_0x744d('0x33')],qs['fields'](_0x45b970[_0x744d('0x35')]['fields']));_0x57742e[_0x744d('0x37')]=_0x57742e[_0x744d('0x37')]['length']?_0x57742e[_0x744d('0x37')]:_0x325316[_0x744d('0x33')];if(!_0x45b970[_0x744d('0x35')][_0x744d('0x38')]('nolimit')){_0x57742e[_0x744d('0x23')]=qs[_0x744d('0x23')](_0x45b970[_0x744d('0x35')][_0x744d('0x23')]);_0x57742e[_0x744d('0x22')]=qs[_0x744d('0x22')](_0x45b970[_0x744d('0x35')][_0x744d('0x22')]);}_0x57742e[_0x744d('0x39')]=qs[_0x744d('0x3a')](_0x45b970[_0x744d('0x35')][_0x744d('0x3a')]);_0x57742e[_0x744d('0x3b')]=qs[_0x744d('0x3c')](_['pick'](_0x45b970[_0x744d('0x35')],_0x325316[_0x744d('0x3c')]),_0x36e900);if(_0x45b970[_0x744d('0x35')][_0x744d('0x3d')]){_0x57742e['where']=_[_0x744d('0x3e')](_0x57742e[_0x744d('0x3b')],{'$or':_['map'](_0x36e900,function(_0x50568a){if(_0x50568a[_0x744d('0x31')]!==_0x744d('0x3f')){var _0x3fd198={};_0x3fd198[_0x50568a[_0x744d('0x2e')]]={'$like':'%'+_0x45b970[_0x744d('0x35')][_0x744d('0x3d')]+'%'};return _0x3fd198;}})});}_0x57742e=_[_0x744d('0x3e')]({},_0x57742e,_0x45b970[_0x744d('0x40')]);var _0x21cff1={'where':_0x57742e['where']};return db['SquareProject'][_0x744d('0x41')](_0x21cff1)[_0x744d('0x28')](function(_0x23beef){_0x2968dd['count']=_0x23beef;if(_0x45b970[_0x744d('0x35')][_0x744d('0x42')]){_0x57742e[_0x744d('0x43')]=[{'all':!![]}];}return db[_0x744d('0x44')][_0x744d('0x45')](_0x57742e);})['then'](function(_0x5263a9){_0x2968dd[_0x744d('0x46')]=_0x5263a9;return _0x2968dd;})[_0x744d('0x28')](respondWithFilteredResult(_0x4af69c,_0x57742e))[_0x744d('0x47')](handleError(_0x4af69c,null));};exports[_0x744d('0x48')]=function(_0xa0278f,_0x234ece){var _0x3f13d5={'raw':![],'where':{'id':_0xa0278f['params']['id']}},_0x9716b5={};_0x9716b5[_0x744d('0x33')]=_[_0x744d('0x49')](db[_0x744d('0x44')][_0x744d('0x30')]);_0x9716b5['query']=_['keys'](_0xa0278f[_0x744d('0x35')]);_0x9716b5[_0x744d('0x3c')]=_[_0x744d('0x36')](_0x9716b5[_0x744d('0x33')],_0x9716b5[_0x744d('0x35')]);_0x3f13d5[_0x744d('0x37')]=_['intersection'](_0x9716b5[_0x744d('0x33')],qs[_0x744d('0x4a')](_0xa0278f[_0x744d('0x35')]['fields']));_0x3f13d5[_0x744d('0x37')]=_0x3f13d5[_0x744d('0x37')][_0x744d('0x4b')]?_0x3f13d5[_0x744d('0x37')]:_0x9716b5['model'];if(_0xa0278f[_0x744d('0x35')][_0x744d('0x42')]){_0x3f13d5[_0x744d('0x43')]=[{'all':!![]}];}_0x3f13d5=_['merge']({},_0x3f13d5,_0xa0278f[_0x744d('0x40')]);return db['SquareProject'][_0x744d('0x4c')](_0x3f13d5)[_0x744d('0x28')](handleEntityNotFound(_0x234ece,null))['then'](respondWithResult(_0x234ece,null))['catch'](handleError(_0x234ece,null));};exports[_0x744d('0x4d')]=function(_0x2a6f02,_0x482c47){return db['SquareProject'][_0x744d('0x4d')](_0x2a6f02[_0x744d('0x4e')],{})[_0x744d('0x28')](function(_0x193340){var _0x183a3e=_0x2a6f02['user'][_0x744d('0x2a')]({'plain':!![]});if(!_0x183a3e)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x183a3e[_0x744d('0x4f')]===_0x744d('0x50')){var _0x268f0d=_0x193340[_0x744d('0x2a')]({'plain':!![]});var _0x5c82b8='SquareProjects';return db[_0x744d('0x51')][_0x744d('0x4c')]({'where':{'name':_0x5c82b8,'userProfileId':_0x183a3e['userProfileId']},'raw':!![]})[_0x744d('0x28')](function(_0x489af3){if(_0x489af3&&_0x489af3[_0x744d('0x52')]===0x0){return db[_0x744d('0x2b')][_0x744d('0x4d')]({'name':_0x268f0d[_0x744d('0x2e')],'resourceId':_0x268f0d['id'],'type':_0x489af3[_0x744d('0x2e')],'sectionId':_0x489af3['id']},{})[_0x744d('0x28')](function(){return _0x193340;});}else{return _0x193340;}})[_0x744d('0x47')](function(_0xd5853e){logger[_0x744d('0x2d')](_0x744d('0x53'),_0xd5853e);throw _0xd5853e;});}return _0x193340;})[_0x744d('0x28')](respondWithResult(_0x482c47,0xc9))[_0x744d('0x47')](handleError(_0x482c47,null));};exports[_0x744d('0x27')]=function(_0x27a06f,_0x2869f7){if(_0x27a06f['body']['id']){delete _0x27a06f[_0x744d('0x4e')]['id'];}return db[_0x744d('0x44')][_0x744d('0x4c')]({'where':{'id':_0x27a06f[_0x744d('0x54')]['id']}})[_0x744d('0x28')](handleEntityNotFound(_0x2869f7,null))[_0x744d('0x28')](saveUpdates(_0x27a06f['body'],null))[_0x744d('0x28')](respondWithResult(_0x2869f7,null))['catch'](handleError(_0x2869f7,null));};exports['destroy']=function(_0x2b2d9e,_0x5cfa00){return db['SquareProject'][_0x744d('0x4c')]({'where':{'id':_0x2b2d9e[_0x744d('0x54')]['id']}})[_0x744d('0x28')](handleEntityNotFound(_0x5cfa00,null))[_0x744d('0x28')](removeEntity(_0x5cfa00,null))['catch'](handleError(_0x5cfa00,null));};exports[_0x744d('0x55')]=function(_0x117882,_0x2f0a99,_0x3c5e36){return db['SquareProject'][_0x744d('0x4c')]({'where':{'id':_0x117882[_0x744d('0x54')]['id']}})['then'](handleEntityNotFound(_0x2f0a99,null))[_0x744d('0x28')](function(_0x588f64){if(_0x588f64){return _0x588f64[_0x744d('0x55')](_0x117882[_0x744d('0x4e')][_0x744d('0x56')],_[_0x744d('0x57')](_0x117882[_0x744d('0x4e')],[_0x744d('0x56'),'id'])||{});}})[_0x744d('0x28')](respondWithResult(_0x2f0a99,null))[_0x744d('0x47')](handleError(_0x2f0a99,null));};exports[_0x744d('0x58')]=function(_0x1bd1db,_0x5d6a9f,_0x1c3a8d){return db[_0x744d('0x44')]['find']({'where':{'id':_0x1bd1db[_0x744d('0x54')]['id']}})[_0x744d('0x28')](handleEntityNotFound(_0x5d6a9f,null))['then'](function(_0x2eace9){if(_0x2eace9){return _0x2eace9[_0x744d('0x58')](_0x1bd1db[_0x744d('0x35')][_0x744d('0x56')])[_0x744d('0x28')](function(){if(_[_0x744d('0x59')](_0x1bd1db['query']['ids'])){for(var _0x5db473=0x0;_0x5db473<_0x1bd1db['query'][_0x744d('0x56')]['length'];_0x5db473+=0x1){socket[_0x744d('0x5a')](_0x744d('0x5b'),{'UserId':Number(_0x1bd1db[_0x744d('0x35')][_0x744d('0x56')][_0x5db473]),'SquareProjectId':Number(_0x1bd1db['params']['id'])});}}else{socket[_0x744d('0x5a')](_0x744d('0x5b'),{'UserId':Number(_0x1bd1db['query'][_0x744d('0x56')]),'SquareProjectId':Number(_0x1bd1db[_0x744d('0x54')]['id'])});}});}})['then'](respondWithStatusCode(_0x5d6a9f,null))[_0x744d('0x47')](handleError(_0x5d6a9f,null));};exports['getUsers']=function(_0x45fe7f,_0x5d9141,_0x591e0a){var _0x3fda20={};var _0x23ebad={};var _0x2fac27;var _0x17c5f5;return db[_0x744d('0x44')][_0x744d('0x5c')]({'where':{'id':_0x45fe7f[_0x744d('0x54')]['id']}})[_0x744d('0x28')](handleEntityNotFound(_0x5d9141,null))['then'](function(_0xaf7a6d){if(_0xaf7a6d){_0x2fac27=_0xaf7a6d;_0x23ebad[_0x744d('0x33')]=_['keys'](db[_0x744d('0x5d')][_0x744d('0x30')]);_0x23ebad['query']=_['keys'](_0x45fe7f[_0x744d('0x35')]);_0x23ebad['filters']=_[_0x744d('0x36')](_0x23ebad[_0x744d('0x33')],_0x23ebad['query']);_0x3fda20[_0x744d('0x37')]=_['intersection'](_0x23ebad['model'],qs[_0x744d('0x4a')](_0x45fe7f['query'][_0x744d('0x4a')]));_0x3fda20[_0x744d('0x37')]=_0x3fda20['attributes'][_0x744d('0x4b')]?_0x3fda20['attributes']:_0x23ebad[_0x744d('0x33')];_0x3fda20[_0x744d('0x39')]=qs[_0x744d('0x3a')](_0x45fe7f[_0x744d('0x35')][_0x744d('0x3a')]);_0x3fda20[_0x744d('0x3b')]=qs['filters'](_[_0x744d('0x5e')](_0x45fe7f[_0x744d('0x35')],_0x23ebad[_0x744d('0x3c')]));if(_0x45fe7f[_0x744d('0x35')][_0x744d('0x3d')]){_0x3fda20[_0x744d('0x3b')]=_['merge'](_0x3fda20[_0x744d('0x3b')],{'$or':_[_0x744d('0x34')](_0x3fda20[_0x744d('0x37')],function(_0x3e8fa2){var _0x1e25d1={};_0x1e25d1[_0x3e8fa2]={'$like':'%'+_0x45fe7f[_0x744d('0x35')][_0x744d('0x3d')]+'%'};return _0x1e25d1;})});}_0x3fda20=_['merge']({},_0x3fda20,_0x45fe7f['options']);return _0x2fac27[_0x744d('0x5f')](_0x3fda20);}})[_0x744d('0x28')](function(_0x260975){if(_0x260975){_0x17c5f5=_0x260975[_0x744d('0x4b')];if(!_0x45fe7f['query'][_0x744d('0x38')](_0x744d('0x60'))){_0x3fda20['limit']=qs[_0x744d('0x23')](_0x45fe7f[_0x744d('0x35')][_0x744d('0x23')]);_0x3fda20[_0x744d('0x22')]=qs[_0x744d('0x22')](_0x45fe7f[_0x744d('0x35')][_0x744d('0x22')]);}return _0x2fac27[_0x744d('0x5f')](_0x3fda20);}})[_0x744d('0x28')](function(_0x551520){if(_0x551520){return _0x551520?{'count':_0x17c5f5,'rows':_0x551520}:null;}})['then'](respondWithResult(_0x5d9141,null))['catch'](handleError(_0x5d9141,null));}; \ No newline at end of file +var _0xe14c=['redis','socket.io-emitter','./squareProject.socket','sendStatus','status','end','json','count','offset','limit','set','Content-Range','save','update','then','destroy','get','SquareProjects','error','name','send','index','map','SquareProject','rawAttributes','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','order','sort','where','filter','merge','VIRTUAL','options','includeAll','findAll','rows','catch','show','params','include','find','create','body','user','role','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','addUsers','ids','removeUsers','isArray','emit','userSquareProject:remove','getUsers','findOne','nolimit','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','sox','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb'];(function(_0x13c70c,_0x546b34){var _0x50f0f2=function(_0x2a2991){while(--_0x2a2991){_0x13c70c['push'](_0x13c70c['shift']());}};_0x50f0f2(++_0x546b34);}(_0xe14c,0x15a));var _0xce14=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xe14c[_0x3dd15e];return _0x231fd0;};'use strict';var pdf=require(_0xce14('0x0'));var emlformat=require(_0xce14('0x1'));var rimraf=require(_0xce14('0x2'));var zipdir=require(_0xce14('0x3'));var jsonpatch=require(_0xce14('0x4'));var rp=require(_0xce14('0x5'));var moment=require(_0xce14('0x6'));var BPromise=require(_0xce14('0x7'));var Mustache=require(_0xce14('0x8'));var util=require('util');var path=require('path');var sox=require(_0xce14('0x9'));var csv=require(_0xce14('0xa'));var ejs=require(_0xce14('0xb'));var fs=require('fs');var _=require(_0xce14('0xc'));var squel=require(_0xce14('0xd'));var crypto=require(_0xce14('0xe'));var jsforce=require(_0xce14('0xf'));var deskjs=require('desk.js');var toCsv=require(_0xce14('0xa'));var querystring=require(_0xce14('0x10'));var Papa=require(_0xce14('0x11'));var Redis=require(_0xce14('0x12'));var authService=require(_0xce14('0x13'));var qs=require(_0xce14('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xce14('0x15'));var logger=require('../../config/logger')(_0xce14('0x16'));var utils=require(_0xce14('0x17'));var config=require(_0xce14('0x18'));var db=require(_0xce14('0x19'))['db'];config[_0xce14('0x1a')]=_['defaults'](config[_0xce14('0x1a')],{'host':'localhost','port':0x18eb});var socket=require(_0xce14('0x1b'))(new Redis(config[_0xce14('0x1a')]));require(_0xce14('0x1c'))['register'](socket);function respondWithStatusCode(_0x3bf137,_0x21e75a){_0x21e75a=_0x21e75a||0xcc;return function(_0x1c965c){if(_0x1c965c){return _0x3bf137[_0xce14('0x1d')](_0x21e75a);}return _0x3bf137[_0xce14('0x1e')](_0x21e75a)[_0xce14('0x1f')]();};}function respondWithResult(_0x41e217,_0x4e857d){_0x4e857d=_0x4e857d||0xc8;return function(_0x296aa8){if(_0x296aa8){return _0x41e217[_0xce14('0x1e')](_0x4e857d)[_0xce14('0x20')](_0x296aa8);}};}function respondWithFilteredResult(_0x1c5cbc,_0x4b3e7a){return function(_0x4867aa){if(_0x4867aa){var _0xa08cd0=_0x4867aa[_0xce14('0x21')],_0x591f12=_0x4b3e7a[_0xce14('0x22')],_0x305105=_0x4b3e7a[_0xce14('0x22')]+_0x4b3e7a[_0xce14('0x23')],_0x5dcd96;if(_0x305105>=_0xa08cd0){_0x305105=_0xa08cd0;_0x5dcd96=0xc8;}else{_0x5dcd96=0xce;}_0x1c5cbc[_0xce14('0x1e')](_0x5dcd96);return _0x1c5cbc[_0xce14('0x24')](_0xce14('0x25'),_0x591f12+'-'+_0x305105+'/'+_0xa08cd0)[_0xce14('0x20')](_0x4867aa);}return null;};}function patchUpdates(_0x5ed330){return function(_0x4eded2){try{jsonpatch['apply'](_0x4eded2,_0x5ed330,!![]);}catch(_0x12911a){return BPromise['reject'](_0x12911a);}return _0x4eded2[_0xce14('0x26')]();};}function saveUpdates(_0x59f875,_0x50d3f3){return function(_0x4271a2){if(_0x4271a2){return _0x4271a2[_0xce14('0x27')](_0x59f875)[_0xce14('0x28')](function(_0x3ddc32){return _0x3ddc32;});}return null;};}function removeEntity(_0x3ec6b1,_0x417f4d){return function(_0x2f4d2f){if(_0x2f4d2f){return _0x2f4d2f[_0xce14('0x29')]()['then'](function(){var _0x174cdd=_0x2f4d2f[_0xce14('0x2a')]({'plain':!![]});var _0x3f0ef2=_0xce14('0x2b');return db['UserProfileResource'][_0xce14('0x29')]({'where':{'type':_0x3f0ef2,'resourceId':_0x174cdd['id']}})[_0xce14('0x28')](function(){return _0x2f4d2f;});})[_0xce14('0x28')](function(){_0x3ec6b1[_0xce14('0x1e')](0xcc)[_0xce14('0x1f')]();});}};}function handleEntityNotFound(_0x269d36,_0x3e5ffd){return function(_0x39a747){if(!_0x39a747){_0x269d36[_0xce14('0x1d')](0x194);}return _0x39a747;};}function handleError(_0x34df23,_0x4866d0){_0x4866d0=_0x4866d0||0x1f4;return function(_0x4b3cac){logger[_0xce14('0x2c')](_0x4b3cac['stack']);if(_0x4b3cac[_0xce14('0x2d')]){delete _0x4b3cac[_0xce14('0x2d')];}_0x34df23[_0xce14('0x1e')](_0x4866d0)[_0xce14('0x2e')](_0x4b3cac);};}exports[_0xce14('0x2f')]=function(_0x22a062,_0x2f687e){var _0x2c5121={},_0x1c9198={},_0x2ac613={'count':0x0,'rows':[]};var _0x413823=_[_0xce14('0x30')](db[_0xce14('0x31')][_0xce14('0x32')],function(_0x35085a){return{'name':_0x35085a['fieldName'],'type':_0x35085a[_0xce14('0x33')][_0xce14('0x34')]};});_0x1c9198[_0xce14('0x35')]=_[_0xce14('0x30')](_0x413823,_0xce14('0x2d'));_0x1c9198[_0xce14('0x36')]=_[_0xce14('0x37')](_0x22a062[_0xce14('0x36')]);_0x1c9198[_0xce14('0x38')]=_[_0xce14('0x39')](_0x1c9198[_0xce14('0x35')],_0x1c9198[_0xce14('0x36')]);_0x2c5121['attributes']=_[_0xce14('0x39')](_0x1c9198['model'],qs[_0xce14('0x3a')](_0x22a062[_0xce14('0x36')][_0xce14('0x3a')]));_0x2c5121[_0xce14('0x3b')]=_0x2c5121['attributes'][_0xce14('0x3c')]?_0x2c5121[_0xce14('0x3b')]:_0x1c9198[_0xce14('0x35')];if(!_0x22a062[_0xce14('0x36')][_0xce14('0x3d')]('nolimit')){_0x2c5121['limit']=qs[_0xce14('0x23')](_0x22a062[_0xce14('0x36')][_0xce14('0x23')]);_0x2c5121[_0xce14('0x22')]=qs[_0xce14('0x22')](_0x22a062[_0xce14('0x36')][_0xce14('0x22')]);}_0x2c5121[_0xce14('0x3e')]=qs[_0xce14('0x3f')](_0x22a062['query'][_0xce14('0x3f')]);_0x2c5121[_0xce14('0x40')]=qs['filters'](_['pick'](_0x22a062[_0xce14('0x36')],_0x1c9198[_0xce14('0x38')]),_0x413823);if(_0x22a062[_0xce14('0x36')][_0xce14('0x41')]){_0x2c5121[_0xce14('0x40')]=_[_0xce14('0x42')](_0x2c5121[_0xce14('0x40')],{'$or':_['map'](_0x413823,function(_0x1dc502){if(_0x1dc502[_0xce14('0x33')]!==_0xce14('0x43')){var _0x7cdd0a={};_0x7cdd0a[_0x1dc502[_0xce14('0x2d')]]={'$like':'%'+_0x22a062[_0xce14('0x36')]['filter']+'%'};return _0x7cdd0a;}})});}_0x2c5121=_[_0xce14('0x42')]({},_0x2c5121,_0x22a062[_0xce14('0x44')]);var _0x576edc={'where':_0x2c5121[_0xce14('0x40')]};return db[_0xce14('0x31')][_0xce14('0x21')](_0x576edc)[_0xce14('0x28')](function(_0x555ad9){_0x2ac613['count']=_0x555ad9;if(_0x22a062['query'][_0xce14('0x45')]){_0x2c5121['include']=[{'all':!![]}];}return db[_0xce14('0x31')][_0xce14('0x46')](_0x2c5121);})[_0xce14('0x28')](function(_0x4340a4){_0x2ac613[_0xce14('0x47')]=_0x4340a4;return _0x2ac613;})[_0xce14('0x28')](respondWithFilteredResult(_0x2f687e,_0x2c5121))[_0xce14('0x48')](handleError(_0x2f687e,null));};exports[_0xce14('0x49')]=function(_0xa93103,_0x440093){var _0x2f3540={'raw':![],'where':{'id':_0xa93103[_0xce14('0x4a')]['id']}},_0x15841d={};_0x15841d[_0xce14('0x35')]=_[_0xce14('0x37')](db[_0xce14('0x31')]['rawAttributes']);_0x15841d[_0xce14('0x36')]=_[_0xce14('0x37')](_0xa93103[_0xce14('0x36')]);_0x15841d[_0xce14('0x38')]=_[_0xce14('0x39')](_0x15841d['model'],_0x15841d[_0xce14('0x36')]);_0x2f3540[_0xce14('0x3b')]=_['intersection'](_0x15841d['model'],qs['fields'](_0xa93103[_0xce14('0x36')]['fields']));_0x2f3540[_0xce14('0x3b')]=_0x2f3540[_0xce14('0x3b')][_0xce14('0x3c')]?_0x2f3540[_0xce14('0x3b')]:_0x15841d[_0xce14('0x35')];if(_0xa93103[_0xce14('0x36')][_0xce14('0x45')]){_0x2f3540[_0xce14('0x4b')]=[{'all':!![]}];}_0x2f3540=_[_0xce14('0x42')]({},_0x2f3540,_0xa93103[_0xce14('0x44')]);return db[_0xce14('0x31')][_0xce14('0x4c')](_0x2f3540)[_0xce14('0x28')](handleEntityNotFound(_0x440093,null))[_0xce14('0x28')](respondWithResult(_0x440093,null))[_0xce14('0x48')](handleError(_0x440093,null));};exports[_0xce14('0x4d')]=function(_0x35cc98,_0x244260){return db[_0xce14('0x31')]['create'](_0x35cc98[_0xce14('0x4e')],{})[_0xce14('0x28')](function(_0x48cd54){var _0x183038=_0x35cc98[_0xce14('0x4f')][_0xce14('0x2a')]({'plain':!![]});if(!_0x183038)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x183038[_0xce14('0x50')]===_0xce14('0x4f')){var _0x5f561d=_0x48cd54[_0xce14('0x2a')]({'plain':!![]});var _0x48cfeb=_0xce14('0x2b');return db[_0xce14('0x51')][_0xce14('0x4c')]({'where':{'name':_0x48cfeb,'userProfileId':_0x183038[_0xce14('0x52')]},'raw':!![]})[_0xce14('0x28')](function(_0x3e961b){if(_0x3e961b&&_0x3e961b['autoAssociation']===0x0){return db['UserProfileResource'][_0xce14('0x4d')]({'name':_0x5f561d[_0xce14('0x2d')],'resourceId':_0x5f561d['id'],'type':_0x3e961b[_0xce14('0x2d')],'sectionId':_0x3e961b['id']},{})['then'](function(){return _0x48cd54;});}else{return _0x48cd54;}})[_0xce14('0x48')](function(_0x507006){logger[_0xce14('0x2c')](_0xce14('0x53'),_0x507006);throw _0x507006;});}return _0x48cd54;})['then'](respondWithResult(_0x244260,0xc9))['catch'](handleError(_0x244260,null));};exports['update']=function(_0x4cfa9d,_0x5bfb4a){if(_0x4cfa9d[_0xce14('0x4e')]['id']){delete _0x4cfa9d[_0xce14('0x4e')]['id'];}return db[_0xce14('0x31')][_0xce14('0x4c')]({'where':{'id':_0x4cfa9d['params']['id']}})['then'](handleEntityNotFound(_0x5bfb4a,null))['then'](saveUpdates(_0x4cfa9d[_0xce14('0x4e')],null))['then'](respondWithResult(_0x5bfb4a,null))[_0xce14('0x48')](handleError(_0x5bfb4a,null));};exports['destroy']=function(_0xe4243d,_0x2a3b5a){return db['SquareProject']['find']({'where':{'id':_0xe4243d['params']['id']}})['then'](handleEntityNotFound(_0x2a3b5a,null))['then'](removeEntity(_0x2a3b5a,null))['catch'](handleError(_0x2a3b5a,null));};exports['addUsers']=function(_0x26673c,_0x38ebcb,_0x453c35){return db[_0xce14('0x31')][_0xce14('0x4c')]({'where':{'id':_0x26673c[_0xce14('0x4a')]['id']}})[_0xce14('0x28')](handleEntityNotFound(_0x38ebcb,null))[_0xce14('0x28')](function(_0x4823a6){if(_0x4823a6){return _0x4823a6[_0xce14('0x54')](_0x26673c['body'][_0xce14('0x55')],_['omit'](_0x26673c[_0xce14('0x4e')],[_0xce14('0x55'),'id'])||{});}})['then'](respondWithResult(_0x38ebcb,null))[_0xce14('0x48')](handleError(_0x38ebcb,null));};exports[_0xce14('0x56')]=function(_0x39a429,_0xaa6790,_0x4588b6){return db[_0xce14('0x31')][_0xce14('0x4c')]({'where':{'id':_0x39a429[_0xce14('0x4a')]['id']}})[_0xce14('0x28')](handleEntityNotFound(_0xaa6790,null))[_0xce14('0x28')](function(_0x22803d){if(_0x22803d){return _0x22803d[_0xce14('0x56')](_0x39a429['query']['ids'])[_0xce14('0x28')](function(){if(_[_0xce14('0x57')](_0x39a429[_0xce14('0x36')][_0xce14('0x55')])){for(var _0x4c11bf=0x0;_0x4c11bf<_0x39a429[_0xce14('0x36')][_0xce14('0x55')][_0xce14('0x3c')];_0x4c11bf+=0x1){socket[_0xce14('0x58')](_0xce14('0x59'),{'UserId':Number(_0x39a429[_0xce14('0x36')][_0xce14('0x55')][_0x4c11bf]),'SquareProjectId':Number(_0x39a429['params']['id'])});}}else{socket[_0xce14('0x58')](_0xce14('0x59'),{'UserId':Number(_0x39a429['query'][_0xce14('0x55')]),'SquareProjectId':Number(_0x39a429['params']['id'])});}});}})[_0xce14('0x28')](respondWithStatusCode(_0xaa6790,null))['catch'](handleError(_0xaa6790,null));};exports[_0xce14('0x5a')]=function(_0x1e764b,_0x4f3cd6,_0x151c07){var _0x467bfc={};var _0x4b2883={};var _0x4a0009;var _0x30dd2b;return db[_0xce14('0x31')][_0xce14('0x5b')]({'where':{'id':_0x1e764b['params']['id']}})[_0xce14('0x28')](handleEntityNotFound(_0x4f3cd6,null))[_0xce14('0x28')](function(_0x5b8375){if(_0x5b8375){_0x4a0009=_0x5b8375;_0x4b2883[_0xce14('0x35')]=_[_0xce14('0x37')](db['User'][_0xce14('0x32')]);_0x4b2883[_0xce14('0x36')]=_['keys'](_0x1e764b[_0xce14('0x36')]);_0x4b2883[_0xce14('0x38')]=_['intersection'](_0x4b2883[_0xce14('0x35')],_0x4b2883[_0xce14('0x36')]);_0x467bfc[_0xce14('0x3b')]=_['intersection'](_0x4b2883['model'],qs[_0xce14('0x3a')](_0x1e764b['query'][_0xce14('0x3a')]));_0x467bfc[_0xce14('0x3b')]=_0x467bfc[_0xce14('0x3b')][_0xce14('0x3c')]?_0x467bfc[_0xce14('0x3b')]:_0x4b2883[_0xce14('0x35')];_0x467bfc['order']=qs[_0xce14('0x3f')](_0x1e764b[_0xce14('0x36')][_0xce14('0x3f')]);_0x467bfc['where']=qs[_0xce14('0x38')](_['pick'](_0x1e764b['query'],_0x4b2883[_0xce14('0x38')]));if(_0x1e764b['query'][_0xce14('0x41')]){_0x467bfc[_0xce14('0x40')]=_[_0xce14('0x42')](_0x467bfc['where'],{'$or':_[_0xce14('0x30')](_0x467bfc[_0xce14('0x3b')],function(_0x172d87){var _0x210035={};_0x210035[_0x172d87]={'$like':'%'+_0x1e764b[_0xce14('0x36')]['filter']+'%'};return _0x210035;})});}_0x467bfc=_[_0xce14('0x42')]({},_0x467bfc,_0x1e764b['options']);return _0x4a0009[_0xce14('0x5a')](_0x467bfc);}})[_0xce14('0x28')](function(_0x2ae8a6){if(_0x2ae8a6){_0x30dd2b=_0x2ae8a6['length'];if(!_0x1e764b[_0xce14('0x36')][_0xce14('0x3d')](_0xce14('0x5c'))){_0x467bfc[_0xce14('0x23')]=qs[_0xce14('0x23')](_0x1e764b[_0xce14('0x36')][_0xce14('0x23')]);_0x467bfc[_0xce14('0x22')]=qs['offset'](_0x1e764b[_0xce14('0x36')][_0xce14('0x22')]);}return _0x4a0009[_0xce14('0x5a')](_0x467bfc);}})[_0xce14('0x28')](function(_0x2a44de){if(_0x2a44de){return _0x2a44de?{'count':_0x30dd2b,'rows':_0x2a44de}:null;}})[_0xce14('0x28')](respondWithResult(_0x4f3cd6,null))[_0xce14('0x48')](handleError(_0x4f3cd6,null));}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.events.js b/server/api/squareProject/squareProject.events.js index 784b8a6..7b66f51 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 _0xb833=['events','../../mysqldb','SquareProject','setMaxListeners','save','update','remove','emit','hasOwnProperty','exports'];(function(_0x377919,_0x570714){var _0x2de686=function(_0x217ff9){while(--_0x217ff9){_0x377919['push'](_0x377919['shift']());}};_0x2de686(++_0x570714);}(_0xb833,0x168));var _0x3b83=function(_0x32f333,_0x1178fc){_0x32f333=_0x32f333-0x0;var _0x15c724=_0xb833[_0x32f333];return _0x15c724;};'use strict';var EventEmitter=require(_0x3b83('0x0'));var SquareProject=require(_0x3b83('0x1'))['db'][_0x3b83('0x2')];var SquareProjectEvents=new EventEmitter();SquareProjectEvents[_0x3b83('0x3')](0x0);var events={'afterCreate':_0x3b83('0x4'),'afterUpdate':_0x3b83('0x5'),'afterDestroy':_0x3b83('0x6')};function emitEvent(_0x4915f7){return function(_0x3e92d2,_0x881fb3,_0x3858ae){SquareProjectEvents[_0x3b83('0x7')](_0x4915f7+':'+_0x3e92d2['id'],_0x3e92d2);SquareProjectEvents['emit'](_0x4915f7,_0x3e92d2);_0x3858ae(null);};}for(var e in events){if(events[_0x3b83('0x8')](e)){var event=events[e];SquareProject['hook'](e,emitEvent(event));}}module[_0x3b83('0x9')]=SquareProjectEvents; \ No newline at end of file +var _0xab5c=['emit','hasOwnProperty','hook','exports','../../mysqldb','SquareProject','setMaxListeners','update'];(function(_0x59ee58,_0x478012){var _0x9c675c=function(_0x4cf3cd){while(--_0x4cf3cd){_0x59ee58['push'](_0x59ee58['shift']());}};_0x9c675c(++_0x478012);}(_0xab5c,0x134));var _0xcab5=function(_0x569ebf,_0x540e0d){_0x569ebf=_0x569ebf-0x0;var _0x348edf=_0xab5c[_0x569ebf];return _0x348edf;};'use strict';var EventEmitter=require('events');var SquareProject=require(_0xcab5('0x0'))['db'][_0xcab5('0x1')];var SquareProjectEvents=new EventEmitter();SquareProjectEvents[_0xcab5('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0xcab5('0x3'),'afterDestroy':'remove'};function emitEvent(_0x558809){return function(_0x5200b9,_0x1d92af,_0x4da49c){SquareProjectEvents[_0xcab5('0x4')](_0x558809+':'+_0x5200b9['id'],_0x5200b9);SquareProjectEvents[_0xcab5('0x4')](_0x558809,_0x5200b9);_0x4da49c(null);};}for(var e in events){if(events[_0xcab5('0x5')](e)){var event=events[e];SquareProject[_0xcab5('0x6')](e,emitEvent(event));}}module[_0xcab5('0x7')]=SquareProjectEvents; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.model.js b/server/api/squareProject/squareProject.model.js index 9c81484..9e3ef44 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 _0x14a0=['../../config/logger','api','moment','bluebird','request-promise','path','./squareProject.attributes','exports','SquareProject','square_projects','util'];(function(_0x2ed7bb,_0x47f2da){var _0x3fda74=function(_0x8432a4){while(--_0x8432a4){_0x2ed7bb['push'](_0x2ed7bb['shift']());}};_0x3fda74(++_0x47f2da);}(_0x14a0,0x8e));var _0x014a=function(_0x55929e,_0x16e7e0){_0x55929e=_0x55929e-0x0;var _0x14d5de=_0x14a0[_0x55929e];return _0x14d5de;};'use strict';var _=require('lodash');var util=require(_0x014a('0x0'));var logger=require(_0x014a('0x1'))(_0x014a('0x2'));var moment=require(_0x014a('0x3'));var BPromise=require(_0x014a('0x4'));var rp=require(_0x014a('0x5'));var fs=require('fs');var path=require(_0x014a('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x014a('0x7'));module[_0x014a('0x8')]=function(_0x38a22c,_0x5ec84d){return _0x38a22c['define'](_0x014a('0x9'),attributes,{'tableName':_0x014a('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xadb5=['bluebird','path','rimraf','../../config/environment','exports','define','SquareProject','square_projects','util','api','moment'];(function(_0xc05e88,_0x171069){var _0xe2efe3=function(_0x3dbf13){while(--_0x3dbf13){_0xc05e88['push'](_0xc05e88['shift']());}};_0xe2efe3(++_0x171069);}(_0xadb5,0xad));var _0x5adb=function(_0x5af707,_0x1225d1){_0x5af707=_0x5af707-0x0;var _0x241c72=_0xadb5[_0x5af707];return _0x241c72;};'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('./squareProject.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 diff --git a/server/api/squareProject/squareProject.rpc.js b/server/api/squareProject/squareProject.rpc.js index f2ad2ff..0345f26 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 _0x54e2=['map','include','model','attributes','debug','stringify','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','redis','defaults','localhost','socket.io-emitter','./squareProject.socket','then','info','SquareProject,\x20%s,\x20%s','request\x20sent','SquareProject,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','ShowSquareProject','find','options','raw'];(function(_0x496333,_0x1c47d6){var _0x44256e=function(_0x58767d){while(--_0x58767d){_0x496333['push'](_0x496333['shift']());}};_0x44256e(++_0x1c47d6);}(_0x54e2,0x92));var _0x254e=function(_0x418a8d,_0x55cdd6){_0x418a8d=_0x418a8d-0x0;var _0x5d4a8e=_0x54e2[_0x418a8d];return _0x5d4a8e;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x254e('0x0'));var BPromise=require(_0x254e('0x1'));var rs=require(_0x254e('0x2'));var fs=require('fs');var Redis=require(_0x254e('0x3'));var db=require(_0x254e('0x4'))['db'];var utils=require(_0x254e('0x5'));var logger=require(_0x254e('0x6'))(_0x254e('0x7'));var config=require(_0x254e('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x254e('0x9')]['http']({'port':0x232a});config[_0x254e('0xa')]=_[_0x254e('0xb')](config[_0x254e('0xa')],{'host':_0x254e('0xc'),'port':0x18eb});var socket=require(_0x254e('0xd'))(new Redis(config['redis']));require(_0x254e('0xe'))['register'](socket);function respondWithRpcPromise(_0x3772e7,_0x4ceea8,_0x5c8a72){return new BPromise(function(_0x298829,_0x2f51c4){return client['request'](_0x3772e7,_0x5c8a72)[_0x254e('0xf')](function(_0x41add6){logger[_0x254e('0x10')](_0x254e('0x11'),_0x4ceea8,_0x254e('0x12'));logger['debug'](_0x254e('0x13'),_0x4ceea8,'request\x20sent',JSON['stringify'](_0x41add6));if(_0x41add6[_0x254e('0x14')]){if(_0x41add6[_0x254e('0x14')][_0x254e('0x15')]===0x1f4){logger[_0x254e('0x14')]('SquareProject,\x20%s,\x20%s',_0x4ceea8,_0x41add6[_0x254e('0x14')][_0x254e('0x16')]);return _0x2f51c4(_0x41add6[_0x254e('0x14')][_0x254e('0x16')]);}logger[_0x254e('0x14')](_0x254e('0x11'),_0x4ceea8,_0x41add6[_0x254e('0x14')][_0x254e('0x16')]);return _0x298829(_0x41add6[_0x254e('0x14')][_0x254e('0x16')]);}else{logger[_0x254e('0x10')](_0x254e('0x11'),_0x4ceea8,_0x254e('0x12'));_0x298829(_0x41add6[_0x254e('0x17')]['message']);}})[_0x254e('0x18')](function(_0x580774){logger[_0x254e('0x14')](_0x254e('0x11'),_0x4ceea8,_0x580774);_0x2f51c4(_0x580774);});});}exports[_0x254e('0x19')]=function(_0x4f474f){var _0x344aa1=this;return new Promise(function(_0x203335,_0x595aa5){return db['SquareProject'][_0x254e('0x1a')]({'raw':_0x4f474f[_0x254e('0x1b')]?_0x4f474f[_0x254e('0x1b')][_0x254e('0x1c')]===undefined?!![]:![]:!![],'where':_0x4f474f[_0x254e('0x1b')]?_0x4f474f[_0x254e('0x1b')]['where']||null:null,'attributes':_0x4f474f['options']?_0x4f474f[_0x254e('0x1b')]['attributes']||null:null,'include':_0x4f474f['options']?_0x4f474f[_0x254e('0x1b')]['include']?_[_0x254e('0x1d')](_0x4f474f['options'][_0x254e('0x1e')],function(_0x53dcf7){return{'model':db[_0x53dcf7[_0x254e('0x1f')]],'as':_0x53dcf7['as'],'attributes':_0x53dcf7[_0x254e('0x20')],'include':_0x53dcf7['include']?_[_0x254e('0x1d')](_0x53dcf7[_0x254e('0x1e')],function(_0x308109){return{'model':db[_0x308109[_0x254e('0x1f')]],'as':_0x308109['as'],'attributes':_0x308109['attributes'],'include':_0x308109[_0x254e('0x1e')]?_[_0x254e('0x1d')](_0x308109[_0x254e('0x1e')],function(_0x5837e0){return{'model':db[_0x5837e0[_0x254e('0x1f')]],'as':_0x5837e0['as'],'attributes':_0x5837e0[_0x254e('0x20')]};}):[]};}):[]};}):[]:[]})[_0x254e('0xf')](function(_0x322234){logger[_0x254e('0x10')](_0x254e('0x19'),_0x4f474f);logger[_0x254e('0x21')](_0x254e('0x19'),_0x4f474f,JSON[_0x254e('0x22')](_0x322234));_0x203335(_0x322234);})[_0x254e('0x18')](function(_0x263dd8){logger[_0x254e('0x14')](_0x254e('0x19'),_0x263dd8[_0x254e('0x16')],_0x4f474f);_0x595aa5(_0x344aa1[_0x254e('0x14')](0x1f4,_0x263dd8[_0x254e('0x16')]));});});}; \ No newline at end of file +var _0x817a=['../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','socket.io-emitter','./squareProject.socket','request','then','SquareProject,\x20%s,\x20%s','request\x20sent','SquareProject,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','ShowSquareProject','SquareProject','find','options','attributes','map','include','model','lodash','util','moment','ioredis'];(function(_0x1fcaf1,_0x21c3c2){var _0x55f464=function(_0x348eb3){while(--_0x348eb3){_0x1fcaf1['push'](_0x1fcaf1['shift']());}};_0x55f464(++_0x21c3c2);}(_0x817a,0x7c));var _0xa817=function(_0x4da016,_0x4e4e6a){_0x4da016=_0x4da016-0x0;var _0x216051=_0x817a[_0x4da016];return _0x216051;};'use strict';var _=require(_0xa817('0x0'));var util=require(_0xa817('0x1'));var moment=require(_0xa817('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xa817('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xa817('0x4'))(_0xa817('0x5'));var config=require(_0xa817('0x6'));var jayson=require(_0xa817('0x7'));var client=jayson[_0xa817('0x8')][_0xa817('0x9')]({'port':0x232a});config[_0xa817('0xa')]=_['defaults'](config[_0xa817('0xa')],{'host':'localhost','port':0x18eb});var socket=require(_0xa817('0xb'))(new Redis(config[_0xa817('0xa')]));require(_0xa817('0xc'))['register'](socket);function respondWithRpcPromise(_0x3d5364,_0x1378df,_0x17ef69){return new BPromise(function(_0x59e9e7,_0x35acad){return client[_0xa817('0xd')](_0x3d5364,_0x17ef69)[_0xa817('0xe')](function(_0x2257d9){logger['info'](_0xa817('0xf'),_0x1378df,_0xa817('0x10'));logger['debug'](_0xa817('0x11'),_0x1378df,'request\x20sent',JSON[_0xa817('0x12')](_0x2257d9));if(_0x2257d9[_0xa817('0x13')]){if(_0x2257d9[_0xa817('0x13')][_0xa817('0x14')]===0x1f4){logger[_0xa817('0x13')](_0xa817('0xf'),_0x1378df,_0x2257d9['error'][_0xa817('0x15')]);return _0x35acad(_0x2257d9[_0xa817('0x13')]['message']);}logger[_0xa817('0x13')](_0xa817('0xf'),_0x1378df,_0x2257d9['error']['message']);return _0x59e9e7(_0x2257d9[_0xa817('0x13')][_0xa817('0x15')]);}else{logger['info'](_0xa817('0xf'),_0x1378df,_0xa817('0x10'));_0x59e9e7(_0x2257d9[_0xa817('0x16')]['message']);}})[_0xa817('0x17')](function(_0x4d1fd8){logger[_0xa817('0x13')](_0xa817('0xf'),_0x1378df,_0x4d1fd8);_0x35acad(_0x4d1fd8);});});}exports[_0xa817('0x18')]=function(_0x1abe0b){var _0x5bb9fa=this;return new Promise(function(_0x378dbe,_0x2b0519){return db[_0xa817('0x19')][_0xa817('0x1a')]({'raw':_0x1abe0b[_0xa817('0x1b')]?_0x1abe0b['options']['raw']===undefined?!![]:![]:!![],'where':_0x1abe0b[_0xa817('0x1b')]?_0x1abe0b[_0xa817('0x1b')]['where']||null:null,'attributes':_0x1abe0b[_0xa817('0x1b')]?_0x1abe0b['options'][_0xa817('0x1c')]||null:null,'include':_0x1abe0b['options']?_0x1abe0b['options']['include']?_[_0xa817('0x1d')](_0x1abe0b['options'][_0xa817('0x1e')],function(_0x10188d){return{'model':db[_0x10188d[_0xa817('0x1f')]],'as':_0x10188d['as'],'attributes':_0x10188d[_0xa817('0x1c')],'include':_0x10188d['include']?_[_0xa817('0x1d')](_0x10188d[_0xa817('0x1e')],function(_0x3b0156){return{'model':db[_0x3b0156['model']],'as':_0x3b0156['as'],'attributes':_0x3b0156[_0xa817('0x1c')],'include':_0x3b0156[_0xa817('0x1e')]?_['map'](_0x3b0156['include'],function(_0x3ccc2b){return{'model':db[_0x3ccc2b['model']],'as':_0x3ccc2b['as'],'attributes':_0x3ccc2b[_0xa817('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xa817('0xe')](function(_0x5eae1d){logger['info'](_0xa817('0x18'),_0x1abe0b);logger['debug'](_0xa817('0x18'),_0x1abe0b,JSON['stringify'](_0x5eae1d));_0x378dbe(_0x5eae1d);})[_0xa817('0x17')](function(_0x35469f){logger[_0xa817('0x13')](_0xa817('0x18'),_0x35469f['message'],_0x1abe0b);_0x2b0519(_0x5bb9fa['error'](0x1f4,_0x35469f[_0xa817('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.socket.js b/server/api/squareProject/squareProject.socket.js index 39cbfd2..570e718 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 _0x7096=['emit','removeListener','register','length','save','update'];(function(_0x46e596,_0x313faf){var _0x5c59d8=function(_0x1ec59b){while(--_0x1ec59b){_0x46e596['push'](_0x46e596['shift']());}};_0x5c59d8(++_0x313faf);}(_0x7096,0x10c));var _0x6709=function(_0x618414,_0x1a7a60){_0x618414=_0x618414-0x0;var _0x21c19a=_0x7096[_0x618414];return _0x21c19a;};'use strict';var SquareProjectEvents=require('./squareProject.events');var events=[_0x6709('0x0'),'remove',_0x6709('0x1')];function createListener(_0x5c668a,_0x233cbf){return function(_0x9544e0){_0x233cbf[_0x6709('0x2')](_0x5c668a,_0x9544e0);};}function removeListener(_0xccdcb5,_0x3cd087){return function(){SquareProjectEvents[_0x6709('0x3')](_0xccdcb5,_0x3cd087);};}exports[_0x6709('0x4')]=function(_0x9d630f){for(var _0xa35832=0x0,_0x3e2223=events[_0x6709('0x5')];_0xa35832<_0x3e2223;_0xa35832++){var _0x985814=events[_0xa35832];var _0x30147f=createListener('squareProject:'+_0x985814,_0x9d630f);SquareProjectEvents['on'](_0x985814,_0x30147f);}}; \ No newline at end of file +var _0x781d=['squareProject:','./squareProject.events','save','emit','removeListener','register','length'];(function(_0x3a2f21,_0x3781d9){var _0x13dfc7=function(_0x3e0b9b){while(--_0x3e0b9b){_0x3a2f21['push'](_0x3a2f21['shift']());}};_0x13dfc7(++_0x3781d9);}(_0x781d,0x14a));var _0xd781=function(_0x2d7f0e,_0x3e6fbd){_0x2d7f0e=_0x2d7f0e-0x0;var _0x110b07=_0x781d[_0x2d7f0e];return _0x110b07;};'use strict';var SquareProjectEvents=require(_0xd781('0x0'));var events=[_0xd781('0x1'),'remove','update'];function createListener(_0xb125bf,_0x44a72d){return function(_0x3cd308){_0x44a72d[_0xd781('0x2')](_0xb125bf,_0x3cd308);};}function removeListener(_0xfd915d,_0x42258e){return function(){SquareProjectEvents[_0xd781('0x3')](_0xfd915d,_0x42258e);};}exports[_0xd781('0x4')]=function(_0x830b){for(var _0x2f98ee=0x0,_0x5a07f0=events[_0xd781('0x5')];_0x2f98ee<_0x5a07f0;_0x2f98ee++){var _0x1a242d=events[_0x2f98ee];var _0x50610d=createListener(_0xd781('0x6')+_0x1a242d,_0x830b);SquareProjectEvents['on'](_0x1a242d,_0x50610d);}}; \ No newline at end of file diff --git a/server/api/squareRecording/index.js b/server/api/squareRecording/index.js index a7b46c1..5b79f10 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 _0xa1a7=['update','delete','exports','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareRecording.controller','get','isAuthenticated','/:id','show','/:id/download','download','create','put'];(function(_0x166f56,_0x133417){var _0x371bf0=function(_0x200de8){while(--_0x200de8){_0x166f56['push'](_0x166f56['shift']());}};_0x371bf0(++_0x133417);}(_0xa1a7,0x1cf));var _0x7a1a=function(_0x48b3fb,_0x4b07bf){_0x48b3fb=_0x48b3fb-0x0;var _0x458604=_0xa1a7[_0x48b3fb];return _0x458604;};'use strict';var multer=require(_0x7a1a('0x0'));var util=require(_0x7a1a('0x1'));var path=require(_0x7a1a('0x2'));var timeout=require(_0x7a1a('0x3'));var express=require(_0x7a1a('0x4'));var router=express['Router']();var auth=require(_0x7a1a('0x5'));var interaction=require(_0x7a1a('0x6'));var config=require(_0x7a1a('0x7'));var controller=require(_0x7a1a('0x8'));router[_0x7a1a('0x9')]('/',auth[_0x7a1a('0xa')](),controller['index']);router['get'](_0x7a1a('0xb'),auth[_0x7a1a('0xa')](),controller[_0x7a1a('0xc')]);router[_0x7a1a('0x9')](_0x7a1a('0xd'),auth[_0x7a1a('0xa')](),controller[_0x7a1a('0xe')]);router['post']('/',auth[_0x7a1a('0xa')](),controller[_0x7a1a('0xf')]);router[_0x7a1a('0x10')](_0x7a1a('0xb'),auth[_0x7a1a('0xa')](),controller[_0x7a1a('0x11')]);router[_0x7a1a('0x12')]('/:id/delete',auth['isAuthenticated'](),controller['destroy']);module[_0x7a1a('0x13')]=router; \ No newline at end of file +var _0x472f=['path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./squareRecording.controller','get','index','isAuthenticated','/:id/download','download','create','put','delete','/:id/delete','destroy','exports','multer','util'];(function(_0x4a61f0,_0x575ff3){var _0xab2a7d=function(_0x1dcd1a){while(--_0x1dcd1a){_0x4a61f0['push'](_0x4a61f0['shift']());}};_0xab2a7d(++_0x575ff3);}(_0x472f,0x13e));var _0xf472=function(_0x5b7d37,_0x2d715c){_0x5b7d37=_0x5b7d37-0x0;var _0x4e7f37=_0x472f[_0x5b7d37];return _0x4e7f37;};'use strict';var multer=require(_0xf472('0x0'));var util=require(_0xf472('0x1'));var path=require(_0xf472('0x2'));var timeout=require(_0xf472('0x3'));var express=require(_0xf472('0x4'));var router=express[_0xf472('0x5')]();var auth=require(_0xf472('0x6'));var interaction=require(_0xf472('0x7'));var config=require('../../config/environment');var controller=require(_0xf472('0x8'));router[_0xf472('0x9')]('/',auth['isAuthenticated'](),controller[_0xf472('0xa')]);router[_0xf472('0x9')]('/:id',auth[_0xf472('0xb')](),controller['show']);router['get'](_0xf472('0xc'),auth[_0xf472('0xb')](),controller[_0xf472('0xd')]);router['post']('/',auth[_0xf472('0xb')](),controller[_0xf472('0xe')]);router[_0xf472('0xf')]('/:id',auth[_0xf472('0xb')](),controller['update']);router[_0xf472('0x10')](_0xf472('0x11'),auth[_0xf472('0xb')](),controller[_0xf472('0x12')]);module[_0xf472('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 8e3d9fd..a519951 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 _0xf52b=['exports','STRING','VIRTUAL','substring','lastIndexOf','sequelize'];(function(_0x5ba35a,_0x5e5113){var _0x5900dc=function(_0x3e61b7){while(--_0x3e61b7){_0x5ba35a['push'](_0x5ba35a['shift']());}};_0x5900dc(++_0x5e5113);}(_0xf52b,0x119));var _0xbf52=function(_0x439d59,_0x11ccdf){_0x439d59=_0x439d59-0x0;var _0x3670c7=_0xf52b[_0x439d59];return _0x3670c7;};'use strict';var Sequelize=require(_0xbf52('0x0'));module[_0xbf52('0x1')]={'uniqueid':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0xbf52('0x2')]},'context':{'type':Sequelize[_0xbf52('0x2')]},'extension':{'type':Sequelize[_0xbf52('0x2')]},'priority':{'type':Sequelize[_0xbf52('0x2')]},'accountcode':{'type':Sequelize[_0xbf52('0x2')]},'dnid':{'type':Sequelize['STRING']},'projectName':{'type':Sequelize[_0xbf52('0x2')]},'saveName':{'type':Sequelize['STRING']},'filename':{'type':Sequelize[_0xbf52('0x2')]},'savePath':{'type':Sequelize['STRING']},'format':{'type':Sequelize[_0xbf52('0x3')],'get':function(){var _0x184af2='';var _0x4d5f8d=this['getDataValue']('savePath');if(_0x4d5f8d){_0x184af2=_0x4d5f8d[_0xbf52('0x4')](_0x4d5f8d[_0xbf52('0x5')]('.'));}return _0x184af2;}}}; \ No newline at end of file +var _0xc5ce=['STRING','VIRTUAL','savePath','substring','lastIndexOf','exports'];(function(_0x30a1b6,_0x158e1e){var _0x304819=function(_0x7f186c){while(--_0x7f186c){_0x30a1b6['push'](_0x30a1b6['shift']());}};_0x304819(++_0x158e1e);}(_0xc5ce,0x7d));var _0xec5c=function(_0x556bb1,_0x34830d){_0x556bb1=_0x556bb1-0x0;var _0x45455f=_0xc5ce[_0x556bb1];return _0x45455f;};'use strict';var Sequelize=require('sequelize');module[_0xec5c('0x0')]={'uniqueid':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize[_0xec5c('0x1')]},'calleridname':{'type':Sequelize[_0xec5c('0x1')]},'context':{'type':Sequelize[_0xec5c('0x1')]},'extension':{'type':Sequelize[_0xec5c('0x1')]},'priority':{'type':Sequelize[_0xec5c('0x1')]},'accountcode':{'type':Sequelize['STRING']},'dnid':{'type':Sequelize[_0xec5c('0x1')]},'projectName':{'type':Sequelize[_0xec5c('0x1')]},'saveName':{'type':Sequelize[_0xec5c('0x1')]},'filename':{'type':Sequelize[_0xec5c('0x1')]},'savePath':{'type':Sequelize[_0xec5c('0x1')]},'format':{'type':Sequelize[_0xec5c('0x2')],'get':function(){var _0x23b986='';var _0x36d960=this['getDataValue'](_0xec5c('0x3'));if(_0x36d960){_0x23b986=_0x36d960[_0xec5c('0x4')](_0x36d960[_0xec5c('0x5')]('.'));}return _0x23b986;}}}; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.controller.js b/server/api/squareRecording/squareRecording.controller.js index 7039a0c..7b1afa2 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 _0x0422=['decryptFile','secrets','recording','ValidationError','SquareRecording\x20not\x20found','filename','extname','unlink','message','Not\x20found','destroy','info','cancellazione\x20fisica\x20documento\x20%s','isNil','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','.cypher','html-pdf','rimraf','zip-dir','fast-json-patch','moment','mustache','util','path','sox','to-csv','ejs','lodash','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','status','end','json','count','offset','limit','set','save','update','then','sendStatus','error','stack','name','send','index','map','SquareRecording','rawAttributes','fieldName','type','model','keys','query','attributes','intersection','fields','order','sort','where','filters','pick','filter','merge','options','includeAll','include','findAll','rows','show','params','find','catch','create','body','download','../../components/encryptor','uniqueid','savePath','format','existsSync'];(function(_0x11019c,_0x8cf889){var _0x4cd868=function(_0x315f74){while(--_0x315f74){_0x11019c['push'](_0x11019c['shift']());}};_0x4cd868(++_0x8cf889);}(_0x0422,0x175));var _0x2042=function(_0x2d364e,_0x301c5e){_0x2d364e=_0x2d364e-0x0;var _0x1b9312=_0x0422[_0x2d364e];return _0x1b9312;};'use strict';var pdf=require(_0x2042('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x2042('0x1'));var zipdir=require(_0x2042('0x2'));var jsonpatch=require(_0x2042('0x3'));var rp=require('request-promise');var moment=require(_0x2042('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x2042('0x5'));var util=require(_0x2042('0x6'));var path=require(_0x2042('0x7'));var sox=require(_0x2042('0x8'));var csv=require(_0x2042('0x9'));var ejs=require(_0x2042('0xa'));var fs=require('fs');var _=require(_0x2042('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x2042('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x2042('0x9'));var querystring=require(_0x2042('0xd'));var Papa=require(_0x2042('0xe'));var Redis=require(_0x2042('0xf'));var authService=require(_0x2042('0x10'));var qs=require(_0x2042('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x2042('0x12'))(_0x2042('0x13'));var utils=require(_0x2042('0x14'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1f7c88,_0x4e68a3){_0x4e68a3=_0x4e68a3||0xcc;return function(_0x25b8ba){if(_0x25b8ba){return _0x1f7c88['sendStatus'](_0x4e68a3);}return _0x1f7c88[_0x2042('0x15')](_0x4e68a3)[_0x2042('0x16')]();};}function respondWithResult(_0x2be8c5,_0x580341){_0x580341=_0x580341||0xc8;return function(_0x5edc67){if(_0x5edc67){return _0x2be8c5[_0x2042('0x15')](_0x580341)[_0x2042('0x17')](_0x5edc67);}};}function respondWithFilteredResult(_0x102852,_0x3b5777){return function(_0x13d5b3){if(_0x13d5b3){var _0x27b86e=_0x13d5b3[_0x2042('0x18')],_0x1dbeed=_0x3b5777[_0x2042('0x19')],_0x3ee978=_0x3b5777[_0x2042('0x19')]+_0x3b5777[_0x2042('0x1a')],_0x3a898d;if(_0x3ee978>=_0x27b86e){_0x3ee978=_0x27b86e;_0x3a898d=0xc8;}else{_0x3a898d=0xce;}_0x102852[_0x2042('0x15')](_0x3a898d);return _0x102852[_0x2042('0x1b')]('Content-Range',_0x1dbeed+'-'+_0x3ee978+'/'+_0x27b86e)[_0x2042('0x17')](_0x13d5b3);}return null;};}function patchUpdates(_0x16d9e5){return function(_0xdcf885){try{jsonpatch['apply'](_0xdcf885,_0x16d9e5,!![]);}catch(_0x1afe3e){return BPromise['reject'](_0x1afe3e);}return _0xdcf885[_0x2042('0x1c')]();};}function saveUpdates(_0x479f30,_0x4cee55){return function(_0x1541fb){if(_0x1541fb){return _0x1541fb[_0x2042('0x1d')](_0x479f30)[_0x2042('0x1e')](function(_0xc630a){return _0xc630a;});}return null;};}function removeEntity(_0x145949,_0x39c53e){return function(_0x14d9ee){if(_0x14d9ee){return _0x14d9ee['destroy']()[_0x2042('0x1e')](function(){_0x145949[_0x2042('0x15')](0xcc)[_0x2042('0x16')]();});}};}function handleEntityNotFound(_0x82714b,_0x4423bc){return function(_0x6ff80c){if(!_0x6ff80c){_0x82714b[_0x2042('0x1f')](0x194);}return _0x6ff80c;};}function handleError(_0x304e5d,_0x47025d){_0x47025d=_0x47025d||0x1f4;return function(_0x160878){logger[_0x2042('0x20')](_0x160878[_0x2042('0x21')]);if(_0x160878[_0x2042('0x22')]){delete _0x160878[_0x2042('0x22')];}_0x304e5d[_0x2042('0x15')](_0x47025d)[_0x2042('0x23')](_0x160878);};}exports[_0x2042('0x24')]=function(_0x558964,_0x4becd6){var _0x11ed72={},_0x50d140={},_0x28dbb2={'count':0x0,'rows':[]};var _0x4b45e9=_[_0x2042('0x25')](db[_0x2042('0x26')][_0x2042('0x27')],function(_0x237fc7){return{'name':_0x237fc7[_0x2042('0x28')],'type':_0x237fc7[_0x2042('0x29')]['key']};});_0x50d140[_0x2042('0x2a')]=_[_0x2042('0x25')](_0x4b45e9,_0x2042('0x22'));_0x50d140['query']=_[_0x2042('0x2b')](_0x558964[_0x2042('0x2c')]);_0x50d140['filters']=_['intersection'](_0x50d140[_0x2042('0x2a')],_0x50d140['query']);_0x11ed72[_0x2042('0x2d')]=_[_0x2042('0x2e')](_0x50d140[_0x2042('0x2a')],qs[_0x2042('0x2f')](_0x558964['query'][_0x2042('0x2f')]));_0x11ed72[_0x2042('0x2d')]=_0x11ed72[_0x2042('0x2d')]['length']?_0x11ed72[_0x2042('0x2d')]:_0x50d140['model'];if(!_0x558964[_0x2042('0x2c')]['hasOwnProperty']('nolimit')){_0x11ed72['limit']=qs[_0x2042('0x1a')](_0x558964[_0x2042('0x2c')][_0x2042('0x1a')]);_0x11ed72[_0x2042('0x19')]=qs[_0x2042('0x19')](_0x558964[_0x2042('0x2c')]['offset']);}_0x11ed72[_0x2042('0x30')]=qs[_0x2042('0x31')](_0x558964[_0x2042('0x2c')]['sort']);_0x11ed72[_0x2042('0x32')]=qs[_0x2042('0x33')](_[_0x2042('0x34')](_0x558964[_0x2042('0x2c')],_0x50d140[_0x2042('0x33')]),_0x4b45e9);if(_0x558964[_0x2042('0x2c')][_0x2042('0x35')]){_0x11ed72[_0x2042('0x32')]=_[_0x2042('0x36')](_0x11ed72['where'],{'$or':_[_0x2042('0x25')](_0x4b45e9,function(_0x5d28cb){if(_0x5d28cb['type']!=='VIRTUAL'){var _0x1aa659={};_0x1aa659[_0x5d28cb[_0x2042('0x22')]]={'$like':'%'+_0x558964[_0x2042('0x2c')][_0x2042('0x35')]+'%'};return _0x1aa659;}})});}_0x11ed72=_['merge']({},_0x11ed72,_0x558964[_0x2042('0x37')]);var _0x173b68={'where':_0x11ed72[_0x2042('0x32')]};return db[_0x2042('0x26')]['count'](_0x173b68)[_0x2042('0x1e')](function(_0x4b1888){_0x28dbb2[_0x2042('0x18')]=_0x4b1888;if(_0x558964['query'][_0x2042('0x38')]){_0x11ed72[_0x2042('0x39')]=[{'all':!![]}];}return db[_0x2042('0x26')][_0x2042('0x3a')](_0x11ed72);})[_0x2042('0x1e')](function(_0x1aa80e){_0x28dbb2[_0x2042('0x3b')]=_0x1aa80e;return _0x28dbb2;})[_0x2042('0x1e')](respondWithFilteredResult(_0x4becd6,_0x11ed72))['catch'](handleError(_0x4becd6,null));};exports[_0x2042('0x3c')]=function(_0x4b8e61,_0x264fc4){var _0x1cf718={'raw':!![],'where':{'id':_0x4b8e61[_0x2042('0x3d')]['id']}},_0x5bc839={};_0x5bc839[_0x2042('0x2a')]=_[_0x2042('0x2b')](db['SquareRecording'][_0x2042('0x27')]);_0x5bc839[_0x2042('0x2c')]=_[_0x2042('0x2b')](_0x4b8e61[_0x2042('0x2c')]);_0x5bc839[_0x2042('0x33')]=_[_0x2042('0x2e')](_0x5bc839[_0x2042('0x2a')],_0x5bc839['query']);_0x1cf718[_0x2042('0x2d')]=_[_0x2042('0x2e')](_0x5bc839['model'],qs['fields'](_0x4b8e61['query']['fields']));_0x1cf718[_0x2042('0x2d')]=_0x1cf718[_0x2042('0x2d')]['length']?_0x1cf718[_0x2042('0x2d')]:_0x5bc839[_0x2042('0x2a')];if(_0x4b8e61[_0x2042('0x2c')][_0x2042('0x38')]){_0x1cf718[_0x2042('0x39')]=[{'all':!![]}];}_0x1cf718=_[_0x2042('0x36')]({},_0x1cf718,_0x4b8e61[_0x2042('0x37')]);return db[_0x2042('0x26')][_0x2042('0x3e')](_0x1cf718)['then'](handleEntityNotFound(_0x264fc4,null))[_0x2042('0x1e')](respondWithResult(_0x264fc4,null))[_0x2042('0x3f')](handleError(_0x264fc4,null));};exports['create']=function(_0x1954eb,_0xeff489){return db[_0x2042('0x26')][_0x2042('0x40')](_0x1954eb['body'],{})[_0x2042('0x1e')](respondWithResult(_0xeff489,0xc9))['catch'](handleError(_0xeff489,null));};exports[_0x2042('0x1d')]=function(_0x16e9a3,_0x3b905b){if(_0x16e9a3['body']['id']){delete _0x16e9a3[_0x2042('0x41')]['id'];}return db[_0x2042('0x26')][_0x2042('0x3e')]({'where':{'id':_0x16e9a3['params']['id']}})[_0x2042('0x1e')](handleEntityNotFound(_0x3b905b,null))[_0x2042('0x1e')](saveUpdates(_0x16e9a3[_0x2042('0x41')],null))['then'](respondWithResult(_0x3b905b,null))[_0x2042('0x3f')](handleError(_0x3b905b,null));};exports[_0x2042('0x42')]=function(_0x2f14b9,_0x22a957,_0x2f8241){var _0x4df23c=require(_0x2042('0x43'));var _0x429f95=![];var _0x2a1080={};if(_0x2f14b9[_0x2042('0x2c')][_0x2042('0x29')]&&_0x2f14b9[_0x2042('0x2c')]['type']===_0x2042('0x44')){_0x2a1080[_0x2042('0x44')]=_0x2f14b9[_0x2042('0x3d')]['id'];}else{_0x2a1080['id']=_0x2f14b9[_0x2042('0x3d')]['id'];}return db[_0x2042('0x26')][_0x2042('0x3e')]({'where':_0x2a1080,'attributes':['id',_0x2042('0x45'),'filename'],'raw':!![]})['then'](handleEntityNotFound(_0x22a957,null))['then'](function(_0x6a0fa1){if(_0x6a0fa1){var _0xf7c7dc=_0x6a0fa1[_0x2042('0x45')];var _0x53c7e5=util[_0x2042('0x46')]('%s.cypher',_0xf7c7dc);if(fs[_0x2042('0x47')](_0x53c7e5)){_0x429f95=!![];return _0x4df23c[_0x2042('0x48')](_0x53c7e5,_0xf7c7dc,config[_0x2042('0x49')][_0x2042('0x4a')])[_0x2042('0x1e')](function(){return _0x6a0fa1;});}return _0x6a0fa1;}})['then'](function(_0xd5c972){if(_0xd5c972){var _0x4dc38d=_0xd5c972['savePath'];if(!fs[_0x2042('0x47')](_0x4dc38d)){throw new db['Sequelize'][(_0x2042('0x4b'))](_0x2042('0x4c'));}if(_0xd5c972['filename']){return _0x22a957[_0x2042('0x42')](_0x4dc38d,_0xd5c972[_0x2042('0x4d')]+path[_0x2042('0x4e')](_0x4dc38d),function(){if(_0x429f95){fs[_0x2042('0x4f')](_0x4dc38d);}});}else{return _0x22a957['download'](_0x4dc38d,function(_0x370ea8){if(_0x429f95){fs[_0x2042('0x4f')](_0x4dc38d);}});}}})['catch'](function(_0x38dd3c){if(_0x38dd3c[_0x2042('0x50')]===_0x2042('0x4c')){_0x22a957[_0x2042('0x15')](0x194)[_0x2042('0x23')](_0x2042('0x51'));}else{return handleError(_0x22a957,null);}});};exports[_0x2042('0x52')]=function(_0x2ca8b4,_0x31955e){return db[_0x2042('0x26')]['find']({'where':{'id':_0x2ca8b4[_0x2042('0x3d')]['id']}})[_0x2042('0x1e')](function(_0x35a2c1){if(!_0x35a2c1)throw new ReferenceError('Entity\x20not\x20found');return _0x35a2c1;})[_0x2042('0x1e')](function(_0x2d2b99){var _0x7fe0d9=_0x2d2b99['savePath'];logger[_0x2042('0x53')](_0x2042('0x54'),_0x7fe0d9);if(!_[_0x2042('0x55')](_0x2d2b99[_0x2042('0x45')])&&fs['existsSync'](_0x7fe0d9)){logger[_0x2042('0x53')](_0x2042('0x56')+_0x7fe0d9+_0x2042('0x57'));fs['unlinkSync'](_0x7fe0d9);}_0x7fe0d9=_0x7fe0d9+_0x2042('0x58');if(!_[_0x2042('0x55')](_0x2d2b99[_0x2042('0x45')])&&fs[_0x2042('0x47')](_0x7fe0d9)){logger[_0x2042('0x53')]('File:\x20\x22'+_0x7fe0d9+_0x2042('0x57'));fs['unlinkSync'](_0x7fe0d9);}return _0x2d2b99;})['then'](function(_0x45a6f9){if(!_0x45a6f9)throw new InternalError();return _0x45a6f9[_0x2042('0x52')]();})[_0x2042('0x1e')](function(){_0x31955e[_0x2042('0x15')](0xcc)[_0x2042('0x16')]();})['catch'](handleError(_0x31955e,null));}; \ No newline at end of file +var _0x54db=['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/utils','../../config/environment','status','json','offset','limit','set','apply','reject','save','then','destroy','end','sendStatus','error','stack','name','send','index','SquareRecording','rawAttributes','type','key','model','map','keys','query','filters','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','count','includeAll','include','findAll','rows','catch','show','intersection','create','update','find','params','body','download','../../components/encryptor','uniqueid','filename','savePath','%s.cypher','existsSync','secrets','Sequelize','ValidationError','SquareRecording\x20not\x20found','message','Not\x20found','cancellazione\x20fisica\x20documento\x20%s','isNil','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','.cypher','info','unlinkSync','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','util'];(function(_0x32f5fa,_0x46d00d){var _0x72de07=function(_0x255e55){while(--_0x255e55){_0x32f5fa['push'](_0x32f5fa['shift']());}};_0x72de07(++_0x46d00d);}(_0x54db,0xb8));var _0xb54d=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x54db[_0x14add3];return _0x4a174f;};'use strict';var pdf=require(_0xb54d('0x0'));var emlformat=require(_0xb54d('0x1'));var rimraf=require(_0xb54d('0x2'));var zipdir=require(_0xb54d('0x3'));var jsonpatch=require(_0xb54d('0x4'));var rp=require('request-promise');var moment=require(_0xb54d('0x5'));var BPromise=require(_0xb54d('0x6'));var Mustache=require('mustache');var util=require(_0xb54d('0x7'));var path=require(_0xb54d('0x8'));var sox=require(_0xb54d('0x9'));var csv=require(_0xb54d('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xb54d('0xb'));var squel=require(_0xb54d('0xc'));var crypto=require(_0xb54d('0xd'));var jsforce=require(_0xb54d('0xe'));var deskjs=require(_0xb54d('0xf'));var toCsv=require(_0xb54d('0xa'));var querystring=require(_0xb54d('0x10'));var Papa=require(_0xb54d('0x11'));var Redis=require(_0xb54d('0x12'));var authService=require(_0xb54d('0x13'));var qs=require(_0xb54d('0x14'));var as=require(_0xb54d('0x15'));var hardwareService=require(_0xb54d('0x16'));var logger=require('../../config/logger')('api');var utils=require(_0xb54d('0x17'));var config=require(_0xb54d('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x485169,_0x117a0d){_0x117a0d=_0x117a0d||0xcc;return function(_0x31afdf){if(_0x31afdf){return _0x485169['sendStatus'](_0x117a0d);}return _0x485169[_0xb54d('0x19')](_0x117a0d)['end']();};}function respondWithResult(_0x1416d0,_0x17c4a2){_0x17c4a2=_0x17c4a2||0xc8;return function(_0x341fad){if(_0x341fad){return _0x1416d0[_0xb54d('0x19')](_0x17c4a2)[_0xb54d('0x1a')](_0x341fad);}};}function respondWithFilteredResult(_0x3dcf71,_0x22fbdf){return function(_0x5163ec){if(_0x5163ec){var _0x44bde3=_0x5163ec['count'],_0x469b76=_0x22fbdf[_0xb54d('0x1b')],_0x116702=_0x22fbdf[_0xb54d('0x1b')]+_0x22fbdf[_0xb54d('0x1c')],_0x4c5118;if(_0x116702>=_0x44bde3){_0x116702=_0x44bde3;_0x4c5118=0xc8;}else{_0x4c5118=0xce;}_0x3dcf71['status'](_0x4c5118);return _0x3dcf71[_0xb54d('0x1d')]('Content-Range',_0x469b76+'-'+_0x116702+'/'+_0x44bde3)['json'](_0x5163ec);}return null;};}function patchUpdates(_0x2a848c){return function(_0x2b68ea){try{jsonpatch[_0xb54d('0x1e')](_0x2b68ea,_0x2a848c,!![]);}catch(_0x4eff46){return BPromise[_0xb54d('0x1f')](_0x4eff46);}return _0x2b68ea[_0xb54d('0x20')]();};}function saveUpdates(_0x10aae1,_0x306b29){return function(_0x2c6cbf){if(_0x2c6cbf){return _0x2c6cbf['update'](_0x10aae1)[_0xb54d('0x21')](function(_0x467fa3){return _0x467fa3;});}return null;};}function removeEntity(_0x334b66,_0x355486){return function(_0x29415d){if(_0x29415d){return _0x29415d[_0xb54d('0x22')]()['then'](function(){_0x334b66[_0xb54d('0x19')](0xcc)[_0xb54d('0x23')]();});}};}function handleEntityNotFound(_0x551cfc,_0x2a0a87){return function(_0x2d77f3){if(!_0x2d77f3){_0x551cfc[_0xb54d('0x24')](0x194);}return _0x2d77f3;};}function handleError(_0x551ce9,_0x1daf67){_0x1daf67=_0x1daf67||0x1f4;return function(_0xd67a16){logger[_0xb54d('0x25')](_0xd67a16[_0xb54d('0x26')]);if(_0xd67a16[_0xb54d('0x27')]){delete _0xd67a16[_0xb54d('0x27')];}_0x551ce9[_0xb54d('0x19')](_0x1daf67)[_0xb54d('0x28')](_0xd67a16);};}exports[_0xb54d('0x29')]=function(_0x11f116,_0x410770){var _0x583479={},_0x3d113d={},_0x56fb03={'count':0x0,'rows':[]};var _0x55af26=_['map'](db[_0xb54d('0x2a')][_0xb54d('0x2b')],function(_0x7cc5b3){return{'name':_0x7cc5b3['fieldName'],'type':_0x7cc5b3[_0xb54d('0x2c')][_0xb54d('0x2d')]};});_0x3d113d[_0xb54d('0x2e')]=_[_0xb54d('0x2f')](_0x55af26,'name');_0x3d113d['query']=_[_0xb54d('0x30')](_0x11f116[_0xb54d('0x31')]);_0x3d113d[_0xb54d('0x32')]=_['intersection'](_0x3d113d[_0xb54d('0x2e')],_0x3d113d[_0xb54d('0x31')]);_0x583479[_0xb54d('0x33')]=_['intersection'](_0x3d113d['model'],qs[_0xb54d('0x34')](_0x11f116['query'][_0xb54d('0x34')]));_0x583479[_0xb54d('0x33')]=_0x583479['attributes'][_0xb54d('0x35')]?_0x583479[_0xb54d('0x33')]:_0x3d113d[_0xb54d('0x2e')];if(!_0x11f116[_0xb54d('0x31')][_0xb54d('0x36')](_0xb54d('0x37'))){_0x583479[_0xb54d('0x1c')]=qs[_0xb54d('0x1c')](_0x11f116['query'][_0xb54d('0x1c')]);_0x583479[_0xb54d('0x1b')]=qs[_0xb54d('0x1b')](_0x11f116['query']['offset']);}_0x583479[_0xb54d('0x38')]=qs['sort'](_0x11f116['query'][_0xb54d('0x39')]);_0x583479[_0xb54d('0x3a')]=qs['filters'](_['pick'](_0x11f116[_0xb54d('0x31')],_0x3d113d[_0xb54d('0x32')]),_0x55af26);if(_0x11f116[_0xb54d('0x31')][_0xb54d('0x3b')]){_0x583479['where']=_[_0xb54d('0x3c')](_0x583479['where'],{'$or':_[_0xb54d('0x2f')](_0x55af26,function(_0x2709d8){if(_0x2709d8['type']!==_0xb54d('0x3d')){var _0x3fa862={};_0x3fa862[_0x2709d8[_0xb54d('0x27')]]={'$like':'%'+_0x11f116['query'][_0xb54d('0x3b')]+'%'};return _0x3fa862;}})});}_0x583479=_[_0xb54d('0x3c')]({},_0x583479,_0x11f116[_0xb54d('0x3e')]);var _0x5cc146={'where':_0x583479[_0xb54d('0x3a')]};return db[_0xb54d('0x2a')][_0xb54d('0x3f')](_0x5cc146)[_0xb54d('0x21')](function(_0x42fde2){_0x56fb03[_0xb54d('0x3f')]=_0x42fde2;if(_0x11f116['query'][_0xb54d('0x40')]){_0x583479[_0xb54d('0x41')]=[{'all':!![]}];}return db[_0xb54d('0x2a')][_0xb54d('0x42')](_0x583479);})['then'](function(_0x402855){_0x56fb03[_0xb54d('0x43')]=_0x402855;return _0x56fb03;})[_0xb54d('0x21')](respondWithFilteredResult(_0x410770,_0x583479))[_0xb54d('0x44')](handleError(_0x410770,null));};exports[_0xb54d('0x45')]=function(_0x249cd8,_0x33d147){var _0x55b0e2={'raw':!![],'where':{'id':_0x249cd8['params']['id']}},_0x1cb832={};_0x1cb832[_0xb54d('0x2e')]=_['keys'](db[_0xb54d('0x2a')][_0xb54d('0x2b')]);_0x1cb832[_0xb54d('0x31')]=_[_0xb54d('0x30')](_0x249cd8[_0xb54d('0x31')]);_0x1cb832[_0xb54d('0x32')]=_[_0xb54d('0x46')](_0x1cb832[_0xb54d('0x2e')],_0x1cb832[_0xb54d('0x31')]);_0x55b0e2['attributes']=_[_0xb54d('0x46')](_0x1cb832[_0xb54d('0x2e')],qs[_0xb54d('0x34')](_0x249cd8[_0xb54d('0x31')][_0xb54d('0x34')]));_0x55b0e2[_0xb54d('0x33')]=_0x55b0e2[_0xb54d('0x33')][_0xb54d('0x35')]?_0x55b0e2[_0xb54d('0x33')]:_0x1cb832['model'];if(_0x249cd8[_0xb54d('0x31')]['includeAll']){_0x55b0e2['include']=[{'all':!![]}];}_0x55b0e2=_[_0xb54d('0x3c')]({},_0x55b0e2,_0x249cd8[_0xb54d('0x3e')]);return db[_0xb54d('0x2a')]['find'](_0x55b0e2)[_0xb54d('0x21')](handleEntityNotFound(_0x33d147,null))[_0xb54d('0x21')](respondWithResult(_0x33d147,null))['catch'](handleError(_0x33d147,null));};exports['create']=function(_0x1e7306,_0x44bc73){return db['SquareRecording'][_0xb54d('0x47')](_0x1e7306['body'],{})[_0xb54d('0x21')](respondWithResult(_0x44bc73,0xc9))[_0xb54d('0x44')](handleError(_0x44bc73,null));};exports[_0xb54d('0x48')]=function(_0x3f5d4a,_0x55a7e3){if(_0x3f5d4a['body']['id']){delete _0x3f5d4a['body']['id'];}return db[_0xb54d('0x2a')][_0xb54d('0x49')]({'where':{'id':_0x3f5d4a[_0xb54d('0x4a')]['id']}})[_0xb54d('0x21')](handleEntityNotFound(_0x55a7e3,null))['then'](saveUpdates(_0x3f5d4a[_0xb54d('0x4b')],null))[_0xb54d('0x21')](respondWithResult(_0x55a7e3,null))['catch'](handleError(_0x55a7e3,null));};exports[_0xb54d('0x4c')]=function(_0x54ec45,_0x226cf9,_0x3c1f71){var _0x66ccb3=require(_0xb54d('0x4d'));var _0x349d5f=![];var _0x1b10ad={};if(_0x54ec45['query'][_0xb54d('0x2c')]&&_0x54ec45[_0xb54d('0x31')][_0xb54d('0x2c')]===_0xb54d('0x4e')){_0x1b10ad['uniqueid']=_0x54ec45[_0xb54d('0x4a')]['id'];}else{_0x1b10ad['id']=_0x54ec45[_0xb54d('0x4a')]['id'];}return db['SquareRecording'][_0xb54d('0x49')]({'where':_0x1b10ad,'attributes':['id','savePath',_0xb54d('0x4f')],'raw':!![]})[_0xb54d('0x21')](handleEntityNotFound(_0x226cf9,null))[_0xb54d('0x21')](function(_0x280a0e){if(_0x280a0e){var _0x48ed29=_0x280a0e[_0xb54d('0x50')];var _0x1b2c5b=util['format'](_0xb54d('0x51'),_0x48ed29);if(fs[_0xb54d('0x52')](_0x1b2c5b)){_0x349d5f=!![];return _0x66ccb3['decryptFile'](_0x1b2c5b,_0x48ed29,config[_0xb54d('0x53')]['recording'])[_0xb54d('0x21')](function(){return _0x280a0e;});}return _0x280a0e;}})['then'](function(_0x29f929){if(_0x29f929){var _0x540608=_0x29f929['savePath'];if(!fs['existsSync'](_0x540608)){throw new db[(_0xb54d('0x54'))][(_0xb54d('0x55'))](_0xb54d('0x56'));}if(_0x29f929[_0xb54d('0x4f')]){return _0x226cf9[_0xb54d('0x4c')](_0x540608,_0x29f929[_0xb54d('0x4f')]+path['extname'](_0x540608),function(){if(_0x349d5f){fs['unlink'](_0x540608);}});}else{return _0x226cf9[_0xb54d('0x4c')](_0x540608,function(_0x16b44e){if(_0x349d5f){fs['unlink'](_0x540608);}});}}})['catch'](function(_0x108eee){if(_0x108eee[_0xb54d('0x57')]===_0xb54d('0x56')){_0x226cf9['status'](0x194)[_0xb54d('0x28')](_0xb54d('0x58'));}else{return handleError(_0x226cf9,null);}});};exports['destroy']=function(_0x26b75f,_0x182b05){return db[_0xb54d('0x2a')][_0xb54d('0x49')]({'where':{'id':_0x26b75f[_0xb54d('0x4a')]['id']}})[_0xb54d('0x21')](function(_0x55ee44){if(!_0x55ee44)throw new ReferenceError('Entity\x20not\x20found');return _0x55ee44;})[_0xb54d('0x21')](function(_0x5217f5){var _0x13b515=_0x5217f5[_0xb54d('0x50')];logger['info'](_0xb54d('0x59'),_0x13b515);if(!_[_0xb54d('0x5a')](_0x5217f5[_0xb54d('0x50')])&&fs[_0xb54d('0x52')](_0x13b515)){logger['info'](_0xb54d('0x5b')+_0x13b515+_0xb54d('0x5c'));fs['unlinkSync'](_0x13b515);}_0x13b515=_0x13b515+_0xb54d('0x5d');if(!_[_0xb54d('0x5a')](_0x5217f5[_0xb54d('0x50')])&&fs[_0xb54d('0x52')](_0x13b515)){logger[_0xb54d('0x5e')]('File:\x20\x22'+_0x13b515+_0xb54d('0x5c'));fs[_0xb54d('0x5f')](_0x13b515);}return _0x5217f5;})[_0xb54d('0x21')](function(_0x394104){if(!_0x394104)throw new InternalError();return _0x394104[_0xb54d('0x22')]();})[_0xb54d('0x21')](function(){_0x182b05[_0xb54d('0x19')](0xcc)[_0xb54d('0x23')]();})[_0xb54d('0x44')](handleError(_0x182b05,null));}; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.model.js b/server/api/squareRecording/squareRecording.model.js index 9eb2ab0..1df93c8 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 _0x1f47=['api','moment','bluebird','request-promise','path','../../config/environment','./squareRecording.attributes','define','SquareRecording','../../config/logger'];(function(_0x156683,_0x34ec1e){var _0x369fdd=function(_0x300660){while(--_0x300660){_0x156683['push'](_0x156683['shift']());}};_0x369fdd(++_0x34ec1e);}(_0x1f47,0x1ad));var _0x71f4=function(_0x5d8f81,_0x3f0f43){_0x5d8f81=_0x5d8f81-0x0;var _0x2a79a6=_0x1f47[_0x5d8f81];return _0x2a79a6;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x71f4('0x0'))(_0x71f4('0x1'));var moment=require(_0x71f4('0x2'));var BPromise=require(_0x71f4('0x3'));var rp=require(_0x71f4('0x4'));var fs=require('fs');var path=require(_0x71f4('0x5'));var rimraf=require('rimraf');var config=require(_0x71f4('0x6'));var attributes=require(_0x71f4('0x7'));module['exports']=function(_0x3c2791,_0x3cc805){return _0x3c2791[_0x71f4('0x8')](_0x71f4('0x9'),attributes,{'tableName':'square_recordings','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2557=['SquareRecording','square_recordings','lodash','api','moment','bluebird','request-promise','rimraf','../../config/environment','./squareRecording.attributes'];(function(_0x2aea9e,_0x1f587f){var _0x430b92=function(_0x416c37){while(--_0x416c37){_0x2aea9e['push'](_0x2aea9e['shift']());}};_0x430b92(++_0x1f587f);}(_0x2557,0xca));var _0x7255=function(_0x2cc5c1,_0x1f4053){_0x2cc5c1=_0x2cc5c1-0x0;var _0x1f49ce=_0x2557[_0x2cc5c1];return _0x1f49ce;};'use strict';var _=require(_0x7255('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x7255('0x1'));var moment=require(_0x7255('0x2'));var BPromise=require(_0x7255('0x3'));var rp=require(_0x7255('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x7255('0x5'));var config=require(_0x7255('0x6'));var attributes=require(_0x7255('0x7'));module['exports']=function(_0x5cd941,_0x4789e6){return _0x5cd941['define'](_0x7255('0x8'),attributes,{'tableName':_0x7255('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 746f206..73d9828 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 _0xc9a7=['error','code','message','result','catch','CreateSquareRecording','create','body','options','raw','stringify','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','request','info','SquareRecording,\x20%s,\x20%s','request\x20sent','debug','SquareRecording,\x20%s,\x20%s,\x20%s'];(function(_0x38938e,_0x1d1140){var _0x1cd043=function(_0x4117d0){while(--_0x4117d0){_0x38938e['push'](_0x38938e['shift']());}};_0x1cd043(++_0x1d1140);}(_0xc9a7,0xb3));var _0x7c9a=function(_0xeda421,_0x1762a3){_0xeda421=_0xeda421-0x0;var _0x20c697=_0xc9a7[_0xeda421];return _0x20c697;};'use strict';var _=require(_0x7c9a('0x0'));var util=require(_0x7c9a('0x1'));var moment=require(_0x7c9a('0x2'));var BPromise=require('bluebird');var rs=require(_0x7c9a('0x3'));var fs=require('fs');var Redis=require(_0x7c9a('0x4'));var db=require(_0x7c9a('0x5'))['db'];var utils=require(_0x7c9a('0x6'));var logger=require(_0x7c9a('0x7'))(_0x7c9a('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x7c9a('0x9')][_0x7c9a('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x460b55,_0x522ca9,_0x1cd848){return new BPromise(function(_0x1e48bd,_0x4e9328){return client[_0x7c9a('0xb')](_0x460b55,_0x1cd848)['then'](function(_0x58b966){logger[_0x7c9a('0xc')](_0x7c9a('0xd'),_0x522ca9,_0x7c9a('0xe'));logger[_0x7c9a('0xf')](_0x7c9a('0x10'),_0x522ca9,_0x7c9a('0xe'),JSON['stringify'](_0x58b966));if(_0x58b966[_0x7c9a('0x11')]){if(_0x58b966['error'][_0x7c9a('0x12')]===0x1f4){logger['error'](_0x7c9a('0xd'),_0x522ca9,_0x58b966['error']['message']);return _0x4e9328(_0x58b966[_0x7c9a('0x11')][_0x7c9a('0x13')]);}logger[_0x7c9a('0x11')](_0x7c9a('0xd'),_0x522ca9,_0x58b966[_0x7c9a('0x11')][_0x7c9a('0x13')]);return _0x1e48bd(_0x58b966[_0x7c9a('0x11')][_0x7c9a('0x13')]);}else{logger[_0x7c9a('0xc')](_0x7c9a('0xd'),_0x522ca9,_0x7c9a('0xe'));_0x1e48bd(_0x58b966[_0x7c9a('0x14')][_0x7c9a('0x13')]);}})[_0x7c9a('0x15')](function(_0x3b5e84){logger['error']('SquareRecording,\x20%s,\x20%s',_0x522ca9,_0x3b5e84);_0x4e9328(_0x3b5e84);});});}exports[_0x7c9a('0x16')]=function(_0x8860c1){var _0x8498fe=this;return new Promise(function(_0xabda6,_0x34b3e0){return db['SquareRecording'][_0x7c9a('0x17')](_0x8860c1[_0x7c9a('0x18')],{'raw':_0x8860c1[_0x7c9a('0x19')]?_0x8860c1[_0x7c9a('0x19')][_0x7c9a('0x1a')]===undefined?!![]:![]:!![]})['then'](function(_0x525545){logger[_0x7c9a('0xc')](_0x7c9a('0x16'),_0x8860c1);logger[_0x7c9a('0xf')]('CreateSquareRecording',_0x8860c1,JSON[_0x7c9a('0x1b')](_0x525545));_0xabda6(_0x525545);})[_0x7c9a('0x15')](function(_0x880f64){logger[_0x7c9a('0x11')](_0x7c9a('0x16'),_0x880f64[_0x7c9a('0x13')],_0x8860c1);_0x34b3e0(_0x8498fe[_0x7c9a('0x11')](0x1f4,_0x880f64[_0x7c9a('0x13')]));});});}; \ No newline at end of file +var _0x53b8=['options','raw','lodash','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','request','info','SquareRecording,\x20%s,\x20%s','request\x20sent','debug','SquareRecording,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','CreateSquareRecording','create','body'];(function(_0x438c62,_0x2ae35d){var _0x33e2cd=function(_0x45bc00){while(--_0x45bc00){_0x438c62['push'](_0x438c62['shift']());}};_0x33e2cd(++_0x2ae35d);}(_0x53b8,0x92));var _0x853b=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0x53b8[_0xfae23b];return _0x200640;};'use strict';var _=require(_0x853b('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x853b('0x1'));var db=require(_0x853b('0x2'))['db'];var utils=require(_0x853b('0x3'));var logger=require('../../config/logger')('rpc');var config=require(_0x853b('0x4'));var jayson=require(_0x853b('0x5'));var client=jayson[_0x853b('0x6')][_0x853b('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x16c821,_0xb4db3b,_0x4b11e9){return new BPromise(function(_0xb7c465,_0x4aca72){return client[_0x853b('0x8')](_0x16c821,_0x4b11e9)['then'](function(_0x1c7b24){logger[_0x853b('0x9')](_0x853b('0xa'),_0xb4db3b,_0x853b('0xb'));logger[_0x853b('0xc')](_0x853b('0xd'),_0xb4db3b,_0x853b('0xb'),JSON[_0x853b('0xe')](_0x1c7b24));if(_0x1c7b24[_0x853b('0xf')]){if(_0x1c7b24[_0x853b('0xf')][_0x853b('0x10')]===0x1f4){logger[_0x853b('0xf')](_0x853b('0xa'),_0xb4db3b,_0x1c7b24[_0x853b('0xf')][_0x853b('0x11')]);return _0x4aca72(_0x1c7b24[_0x853b('0xf')][_0x853b('0x11')]);}logger[_0x853b('0xf')](_0x853b('0xa'),_0xb4db3b,_0x1c7b24[_0x853b('0xf')]['message']);return _0xb7c465(_0x1c7b24[_0x853b('0xf')][_0x853b('0x11')]);}else{logger[_0x853b('0x9')](_0x853b('0xa'),_0xb4db3b,'request\x20sent');_0xb7c465(_0x1c7b24['result']['message']);}})[_0x853b('0x12')](function(_0x22d1cf){logger[_0x853b('0xf')](_0x853b('0xa'),_0xb4db3b,_0x22d1cf);_0x4aca72(_0x22d1cf);});});}exports[_0x853b('0x13')]=function(_0x2e02c7){var _0x2bb5a2=this;return new Promise(function(_0x20ac63,_0x20468e){return db['SquareRecording'][_0x853b('0x14')](_0x2e02c7[_0x853b('0x15')],{'raw':_0x2e02c7[_0x853b('0x16')]?_0x2e02c7['options'][_0x853b('0x17')]===undefined?!![]:![]:!![]})['then'](function(_0xfd9010){logger[_0x853b('0x9')](_0x853b('0x13'),_0x2e02c7);logger[_0x853b('0xc')](_0x853b('0x13'),_0x2e02c7,JSON[_0x853b('0xe')](_0xfd9010));_0x20ac63(_0xfd9010);})['catch'](function(_0x5479c6){logger[_0x853b('0xf')]('CreateSquareRecording',_0x5479c6[_0x853b('0x11')],_0x2e02c7);_0x20468e(_0x2bb5a2[_0x853b('0xf')](0x1f4,_0x5479c6[_0x853b('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/squareReport/index.js b/server/api/squareReport/index.js index 878250f..eced01a 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 _0xf6b5=['get','isAuthenticated','index','/describe','describe','/:id','show','put','update','delete','exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x55a48d,_0x49b9e0){var _0x4f2cb3=function(_0x265e4a){while(--_0x265e4a){_0x55a48d['push'](_0x55a48d['shift']());}};_0x4f2cb3(++_0x49b9e0);}(_0xf6b5,0x1e6));var _0x5f6b=function(_0x1030ce,_0xbe3f74){_0x1030ce=_0x1030ce-0x0;var _0x3367fd=_0xf6b5[_0x1030ce];return _0x3367fd;};'use strict';var multer=require(_0x5f6b('0x0'));var util=require(_0x5f6b('0x1'));var path=require('path');var timeout=require(_0x5f6b('0x2'));var express=require(_0x5f6b('0x3'));var router=express[_0x5f6b('0x4')]();var auth=require(_0x5f6b('0x5'));var interaction=require(_0x5f6b('0x6'));var config=require(_0x5f6b('0x7'));var controller=require('./squareReport.controller');router[_0x5f6b('0x8')]('/',auth[_0x5f6b('0x9')](),controller[_0x5f6b('0xa')]);router[_0x5f6b('0x8')](_0x5f6b('0xb'),auth['isAuthenticated'](),controller[_0x5f6b('0xc')]);router[_0x5f6b('0x8')](_0x5f6b('0xd'),auth[_0x5f6b('0x9')](),controller[_0x5f6b('0xe')]);router['post']('/',auth[_0x5f6b('0x9')](),controller['create']);router[_0x5f6b('0xf')]('/:id',auth[_0x5f6b('0x9')](),controller[_0x5f6b('0x10')]);router[_0x5f6b('0x11')](_0x5f6b('0xd'),auth[_0x5f6b('0x9')](),controller['destroy']);module[_0x5f6b('0x12')]=router; \ No newline at end of file +var _0x481c=['/describe','isAuthenticated','/:id','show','post','create','put','update','delete','destroy','exports','multer','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareReport.controller','get'];(function(_0x3aca27,_0x67300b){var _0x2275e2=function(_0xbdaaf4){while(--_0xbdaaf4){_0x3aca27['push'](_0x3aca27['shift']());}};_0x2275e2(++_0x67300b);}(_0x481c,0x10f));var _0xc481=function(_0x516976,_0x130848){_0x516976=_0x516976-0x0;var _0x2f3fc9=_0x481c[_0x516976];return _0x2f3fc9;};'use strict';var multer=require(_0xc481('0x0'));var util=require('util');var path=require(_0xc481('0x1'));var timeout=require('connect-timeout');var express=require(_0xc481('0x2'));var router=express[_0xc481('0x3')]();var auth=require(_0xc481('0x4'));var interaction=require(_0xc481('0x5'));var config=require(_0xc481('0x6'));var controller=require(_0xc481('0x7'));router[_0xc481('0x8')]('/',auth['isAuthenticated'](),controller['index']);router[_0xc481('0x8')](_0xc481('0x9'),auth[_0xc481('0xa')](),controller['describe']);router[_0xc481('0x8')](_0xc481('0xb'),auth['isAuthenticated'](),controller[_0xc481('0xc')]);router[_0xc481('0xd')]('/',auth['isAuthenticated'](),controller[_0xc481('0xe')]);router[_0xc481('0xf')]('/:id',auth[_0xc481('0xa')](),controller[_0xc481('0x10')]);router[_0xc481('0x11')]('/:id',auth[_0xc481('0xa')](),controller[_0xc481('0x12')]);module[_0xc481('0x13')]=router; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.attributes.js b/server/api/squareReport/squareReport.attributes.js index 12b5cd7..4fcf851 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 _0x7817=['STRING','DATE','BOOLEAN','exports'];(function(_0x6148ee,_0x4d2fca){var _0x5afc74=function(_0x351621){while(--_0x351621){_0x6148ee['push'](_0x6148ee['shift']());}};_0x5afc74(++_0x4d2fca);}(_0x7817,0x12f));var _0x7781=function(_0x2fecbc,_0x5e8b04){_0x2fecbc=_0x2fecbc-0x0;var _0x2bab10=_0x7817[_0x2fecbc];return _0x2bab10;};'use strict';var Sequelize=require('sequelize');module[_0x7781('0x0')]={'network':{'type':Sequelize['STRING']},'network_script':{'type':Sequelize['STRING']},'request':{'type':Sequelize[_0x7781('0x1')]},'channel':{'type':Sequelize[_0x7781('0x1')]},'language':{'type':Sequelize[_0x7781('0x1')]},'type':{'type':Sequelize[_0x7781('0x1')]},'uniqueid':{'type':Sequelize[_0x7781('0x1')]},'version':{'type':Sequelize[_0x7781('0x1')]},'callerid':{'type':Sequelize[_0x7781('0x1')]},'calleridname':{'type':Sequelize[_0x7781('0x1')]},'callingpres':{'type':Sequelize[_0x7781('0x1')]},'callingani2':{'type':Sequelize[_0x7781('0x1')]},'callington':{'type':Sequelize[_0x7781('0x1')]},'callingtns':{'type':Sequelize['STRING']},'dnid':{'type':Sequelize[_0x7781('0x1')]},'rdnis':{'type':Sequelize[_0x7781('0x1')]},'context':{'type':Sequelize[_0x7781('0x1')]},'extension':{'type':Sequelize[_0x7781('0x1')]},'priority':{'type':Sequelize[_0x7781('0x1')]},'enhanced':{'type':Sequelize[_0x7781('0x1')]},'accountcode':{'type':Sequelize[_0x7781('0x1')]},'threadid':{'type':Sequelize[_0x7781('0x1')]},'project_name':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0x7781('0x2')]},'leaveAt':{'type':Sequelize[_0x7781('0x2')]},'bot':{'type':Sequelize[_0x7781('0x3')],'defaultValue':![]}}; \ No newline at end of file +var _0xd555=['DATE','BOOLEAN','sequelize','exports','STRING'];(function(_0x5d4c48,_0x3030fc){var _0xbb0a9d=function(_0x43bd38){while(--_0x43bd38){_0x5d4c48['push'](_0x5d4c48['shift']());}};_0xbb0a9d(++_0x3030fc);}(_0xd555,0x11a));var _0x5d55=function(_0x20ef83,_0xea60f9){_0x20ef83=_0x20ef83-0x0;var _0x18c673=_0xd555[_0x20ef83];return _0x18c673;};'use strict';var Sequelize=require(_0x5d55('0x0'));module[_0x5d55('0x1')]={'network':{'type':Sequelize[_0x5d55('0x2')]},'network_script':{'type':Sequelize[_0x5d55('0x2')]},'request':{'type':Sequelize[_0x5d55('0x2')]},'channel':{'type':Sequelize[_0x5d55('0x2')]},'language':{'type':Sequelize[_0x5d55('0x2')]},'type':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize['STRING']},'version':{'type':Sequelize[_0x5d55('0x2')]},'callerid':{'type':Sequelize[_0x5d55('0x2')]},'calleridname':{'type':Sequelize[_0x5d55('0x2')]},'callingpres':{'type':Sequelize['STRING']},'callingani2':{'type':Sequelize[_0x5d55('0x2')]},'callington':{'type':Sequelize[_0x5d55('0x2')]},'callingtns':{'type':Sequelize[_0x5d55('0x2')]},'dnid':{'type':Sequelize[_0x5d55('0x2')]},'rdnis':{'type':Sequelize['STRING']},'context':{'type':Sequelize[_0x5d55('0x2')]},'extension':{'type':Sequelize[_0x5d55('0x2')]},'priority':{'type':Sequelize[_0x5d55('0x2')]},'enhanced':{'type':Sequelize[_0x5d55('0x2')]},'accountcode':{'type':Sequelize[_0x5d55('0x2')]},'threadid':{'type':Sequelize[_0x5d55('0x2')]},'project_name':{'type':Sequelize[_0x5d55('0x2')]},'joinAt':{'type':Sequelize[_0x5d55('0x3')]},'leaveAt':{'type':Sequelize['DATE']},'bot':{'type':Sequelize[_0x5d55('0x4')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.controller.js b/server/api/squareReport/squareReport.controller.js index ef05047..9279325 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 _0x7a19=['api','../../config/utils','status','end','json','offset','limit','Content-Range','reject','save','update','then','sendStatus','error','name','send','index','map','SquareReport','rawAttributes','key','keys','query','filters','intersection','model','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','type','VIRTUAL','filter','options','count','includeAll','findAll','rows','catch','params','fields','include','find','create','body','destroy','describe','html-pdf','eml-format','zip-dir','request-promise','moment','bluebird','mustache','util','path','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger'];(function(_0x33b033,_0x4f3022){var _0x5ddea6=function(_0x515832){while(--_0x515832){_0x33b033['push'](_0x33b033['shift']());}};_0x5ddea6(++_0x4f3022);}(_0x7a19,0xca));var _0x97a1=function(_0xf0fad9,_0x36e36a){_0xf0fad9=_0xf0fad9-0x0;var _0x55e3ea=_0x7a19[_0xf0fad9];return _0x55e3ea;};'use strict';var pdf=require(_0x97a1('0x0'));var emlformat=require(_0x97a1('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x97a1('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x97a1('0x3'));var moment=require(_0x97a1('0x4'));var BPromise=require(_0x97a1('0x5'));var Mustache=require(_0x97a1('0x6'));var util=require(_0x97a1('0x7'));var path=require(_0x97a1('0x8'));var sox=require('sox');var csv=require(_0x97a1('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x97a1('0xa'));var squel=require(_0x97a1('0xb'));var crypto=require(_0x97a1('0xc'));var jsforce=require(_0x97a1('0xd'));var deskjs=require(_0x97a1('0xe'));var toCsv=require(_0x97a1('0x9'));var querystring=require(_0x97a1('0xf'));var Papa=require(_0x97a1('0x10'));var Redis=require(_0x97a1('0x11'));var authService=require(_0x97a1('0x12'));var qs=require(_0x97a1('0x13'));var as=require(_0x97a1('0x14'));var hardwareService=require(_0x97a1('0x15'));var logger=require(_0x97a1('0x16'))(_0x97a1('0x17'));var utils=require(_0x97a1('0x18'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2d0f02,_0x42cea8){_0x42cea8=_0x42cea8||0xcc;return function(_0x4f3ea6){if(_0x4f3ea6){return _0x2d0f02['sendStatus'](_0x42cea8);}return _0x2d0f02[_0x97a1('0x19')](_0x42cea8)[_0x97a1('0x1a')]();};}function respondWithResult(_0x289455,_0x4cbcbd){_0x4cbcbd=_0x4cbcbd||0xc8;return function(_0x5b3bdb){if(_0x5b3bdb){return _0x289455[_0x97a1('0x19')](_0x4cbcbd)[_0x97a1('0x1b')](_0x5b3bdb);}};}function respondWithFilteredResult(_0x261029,_0x2a49ab){return function(_0x47465){if(_0x47465){var _0x445709=_0x47465['count'],_0x3515e1=_0x2a49ab[_0x97a1('0x1c')],_0x17aec1=_0x2a49ab['offset']+_0x2a49ab[_0x97a1('0x1d')],_0x5d1eff;if(_0x17aec1>=_0x445709){_0x17aec1=_0x445709;_0x5d1eff=0xc8;}else{_0x5d1eff=0xce;}_0x261029[_0x97a1('0x19')](_0x5d1eff);return _0x261029['set'](_0x97a1('0x1e'),_0x3515e1+'-'+_0x17aec1+'/'+_0x445709)['json'](_0x47465);}return null;};}function patchUpdates(_0x2860e0){return function(_0x457f5e){try{jsonpatch['apply'](_0x457f5e,_0x2860e0,!![]);}catch(_0x322745){return BPromise[_0x97a1('0x1f')](_0x322745);}return _0x457f5e[_0x97a1('0x20')]();};}function saveUpdates(_0x556d41,_0x1af1b2){return function(_0x510649){if(_0x510649){return _0x510649[_0x97a1('0x21')](_0x556d41)['then'](function(_0x48c920){return _0x48c920;});}return null;};}function removeEntity(_0x461518,_0x531983){return function(_0x1de748){if(_0x1de748){return _0x1de748['destroy']()[_0x97a1('0x22')](function(){_0x461518['status'](0xcc)[_0x97a1('0x1a')]();});}};}function handleEntityNotFound(_0x3f073f,_0x4e4ee3){return function(_0x209c30){if(!_0x209c30){_0x3f073f[_0x97a1('0x23')](0x194);}return _0x209c30;};}function handleError(_0x599790,_0x1d28b2){_0x1d28b2=_0x1d28b2||0x1f4;return function(_0x5316cc){logger[_0x97a1('0x24')](_0x5316cc['stack']);if(_0x5316cc[_0x97a1('0x25')]){delete _0x5316cc[_0x97a1('0x25')];}_0x599790[_0x97a1('0x19')](_0x1d28b2)[_0x97a1('0x26')](_0x5316cc);};}exports[_0x97a1('0x27')]=function(_0x3c38cf,_0x40e120){var _0x183ec5={},_0x37f551={},_0x37ba45={'count':0x0,'rows':[]};var _0x6a35c3=_[_0x97a1('0x28')](db[_0x97a1('0x29')][_0x97a1('0x2a')],function(_0x228699){return{'name':_0x228699['fieldName'],'type':_0x228699['type'][_0x97a1('0x2b')]};});_0x37f551['model']=_[_0x97a1('0x28')](_0x6a35c3,_0x97a1('0x25'));_0x37f551['query']=_[_0x97a1('0x2c')](_0x3c38cf[_0x97a1('0x2d')]);_0x37f551[_0x97a1('0x2e')]=_[_0x97a1('0x2f')](_0x37f551[_0x97a1('0x30')],_0x37f551[_0x97a1('0x2d')]);_0x183ec5[_0x97a1('0x31')]=_[_0x97a1('0x2f')](_0x37f551[_0x97a1('0x30')],qs['fields'](_0x3c38cf[_0x97a1('0x2d')]['fields']));_0x183ec5[_0x97a1('0x31')]=_0x183ec5[_0x97a1('0x31')][_0x97a1('0x32')]?_0x183ec5['attributes']:_0x37f551['model'];if(!_0x3c38cf[_0x97a1('0x2d')][_0x97a1('0x33')](_0x97a1('0x34'))){_0x183ec5[_0x97a1('0x1d')]=qs[_0x97a1('0x1d')](_0x3c38cf[_0x97a1('0x2d')][_0x97a1('0x1d')]);_0x183ec5[_0x97a1('0x1c')]=qs[_0x97a1('0x1c')](_0x3c38cf[_0x97a1('0x2d')][_0x97a1('0x1c')]);}_0x183ec5[_0x97a1('0x35')]=qs['sort'](_0x3c38cf[_0x97a1('0x2d')][_0x97a1('0x36')]);_0x183ec5[_0x97a1('0x37')]=qs[_0x97a1('0x2e')](_[_0x97a1('0x38')](_0x3c38cf[_0x97a1('0x2d')],_0x37f551[_0x97a1('0x2e')]),_0x6a35c3);if(_0x3c38cf[_0x97a1('0x2d')]['filter']){_0x183ec5[_0x97a1('0x37')]=_[_0x97a1('0x39')](_0x183ec5[_0x97a1('0x37')],{'$or':_[_0x97a1('0x28')](_0x6a35c3,function(_0x23ff06){if(_0x23ff06[_0x97a1('0x3a')]!==_0x97a1('0x3b')){var _0x16b4c5={};_0x16b4c5[_0x23ff06[_0x97a1('0x25')]]={'$like':'%'+_0x3c38cf[_0x97a1('0x2d')][_0x97a1('0x3c')]+'%'};return _0x16b4c5;}})});}_0x183ec5=_['merge']({},_0x183ec5,_0x3c38cf[_0x97a1('0x3d')]);var _0x446d51={'where':_0x183ec5[_0x97a1('0x37')]};return db[_0x97a1('0x29')]['count'](_0x446d51)[_0x97a1('0x22')](function(_0xd53a6a){_0x37ba45[_0x97a1('0x3e')]=_0xd53a6a;if(_0x3c38cf['query'][_0x97a1('0x3f')]){_0x183ec5['include']=[{'all':!![]}];}return db['SquareReport'][_0x97a1('0x40')](_0x183ec5);})['then'](function(_0x3b5741){_0x37ba45[_0x97a1('0x41')]=_0x3b5741;return _0x37ba45;})[_0x97a1('0x22')](respondWithFilteredResult(_0x40e120,_0x183ec5))[_0x97a1('0x42')](handleError(_0x40e120,null));};exports['show']=function(_0x22cac4,_0x590fba){var _0x1dfcf4={'raw':!![],'where':{'id':_0x22cac4[_0x97a1('0x43')]['id']}},_0x27fda4={};_0x27fda4[_0x97a1('0x30')]=_[_0x97a1('0x2c')](db[_0x97a1('0x29')][_0x97a1('0x2a')]);_0x27fda4[_0x97a1('0x2d')]=_[_0x97a1('0x2c')](_0x22cac4[_0x97a1('0x2d')]);_0x27fda4['filters']=_[_0x97a1('0x2f')](_0x27fda4[_0x97a1('0x30')],_0x27fda4['query']);_0x1dfcf4[_0x97a1('0x31')]=_['intersection'](_0x27fda4[_0x97a1('0x30')],qs[_0x97a1('0x44')](_0x22cac4[_0x97a1('0x2d')][_0x97a1('0x44')]));_0x1dfcf4[_0x97a1('0x31')]=_0x1dfcf4[_0x97a1('0x31')][_0x97a1('0x32')]?_0x1dfcf4[_0x97a1('0x31')]:_0x27fda4[_0x97a1('0x30')];if(_0x22cac4[_0x97a1('0x2d')][_0x97a1('0x3f')]){_0x1dfcf4[_0x97a1('0x45')]=[{'all':!![]}];}_0x1dfcf4=_['merge']({},_0x1dfcf4,_0x22cac4[_0x97a1('0x3d')]);return db[_0x97a1('0x29')][_0x97a1('0x46')](_0x1dfcf4)[_0x97a1('0x22')](handleEntityNotFound(_0x590fba,null))[_0x97a1('0x22')](respondWithResult(_0x590fba,null))['catch'](handleError(_0x590fba,null));};exports[_0x97a1('0x47')]=function(_0xa3f5a6,_0x17f986){return db[_0x97a1('0x29')][_0x97a1('0x47')](_0xa3f5a6[_0x97a1('0x48')],{})[_0x97a1('0x22')](respondWithResult(_0x17f986,0xc9))[_0x97a1('0x42')](handleError(_0x17f986,null));};exports[_0x97a1('0x21')]=function(_0x492e95,_0x3ada01){if(_0x492e95[_0x97a1('0x48')]['id']){delete _0x492e95[_0x97a1('0x48')]['id'];}return db[_0x97a1('0x29')][_0x97a1('0x46')]({'where':{'id':_0x492e95[_0x97a1('0x43')]['id']}})[_0x97a1('0x22')](handleEntityNotFound(_0x3ada01,null))[_0x97a1('0x22')](saveUpdates(_0x492e95[_0x97a1('0x48')],null))[_0x97a1('0x22')](respondWithResult(_0x3ada01,null))[_0x97a1('0x42')](handleError(_0x3ada01,null));};exports[_0x97a1('0x49')]=function(_0x4de5e2,_0x274431){return db[_0x97a1('0x29')]['find']({'where':{'id':_0x4de5e2[_0x97a1('0x43')]['id']}})[_0x97a1('0x22')](handleEntityNotFound(_0x274431,null))[_0x97a1('0x22')](removeEntity(_0x274431,null))[_0x97a1('0x42')](handleError(_0x274431,null));};exports[_0x97a1('0x4a')]=function(_0x4af798,_0x4ae1de){return db[_0x97a1('0x29')][_0x97a1('0x4a')]()[_0x97a1('0x22')](respondWithResult(_0x4ae1de,null))[_0x97a1('0x42')](handleError(_0x4ae1de,null));}; \ No newline at end of file +var _0x7f3a=['path','sox','to-csv','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','json','count','offset','set','Content-Range','apply','reject','save','then','destroy','end','error','stack','index','map','SquareReport','rawAttributes','type','model','name','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','limit','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','find','create','update','body','params','describe','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util'];(function(_0x4ccba8,_0x268fe9){var _0x12720a=function(_0x15faef){while(--_0x15faef){_0x4ccba8['push'](_0x4ccba8['shift']());}};_0x12720a(++_0x268fe9);}(_0x7f3a,0xd9));var _0xa7f3=function(_0x55bf2a,_0x452666){_0x55bf2a=_0x55bf2a-0x0;var _0x4dabc7=_0x7f3a[_0x55bf2a];return _0x4dabc7;};'use strict';var pdf=require(_0xa7f3('0x0'));var emlformat=require(_0xa7f3('0x1'));var rimraf=require(_0xa7f3('0x2'));var zipdir=require(_0xa7f3('0x3'));var jsonpatch=require(_0xa7f3('0x4'));var rp=require(_0xa7f3('0x5'));var moment=require('moment');var BPromise=require(_0xa7f3('0x6'));var Mustache=require('mustache');var util=require(_0xa7f3('0x7'));var path=require(_0xa7f3('0x8'));var sox=require(_0xa7f3('0x9'));var csv=require(_0xa7f3('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xa7f3('0xb'));var squel=require(_0xa7f3('0xc'));var crypto=require('crypto');var jsforce=require(_0xa7f3('0xd'));var deskjs=require(_0xa7f3('0xe'));var toCsv=require(_0xa7f3('0xa'));var querystring=require(_0xa7f3('0xf'));var Papa=require(_0xa7f3('0x10'));var Redis=require(_0xa7f3('0x11'));var authService=require(_0xa7f3('0x12'));var qs=require(_0xa7f3('0x13'));var as=require(_0xa7f3('0x14'));var hardwareService=require(_0xa7f3('0x15'));var logger=require(_0xa7f3('0x16'))(_0xa7f3('0x17'));var utils=require('../../config/utils');var config=require(_0xa7f3('0x18'));var db=require(_0xa7f3('0x19'))['db'];function respondWithStatusCode(_0x5a846f,_0x2edd88){_0x2edd88=_0x2edd88||0xcc;return function(_0x52b353){if(_0x52b353){return _0x5a846f[_0xa7f3('0x1a')](_0x2edd88);}return _0x5a846f[_0xa7f3('0x1b')](_0x2edd88)['end']();};}function respondWithResult(_0x2cc6ad,_0x52a369){_0x52a369=_0x52a369||0xc8;return function(_0x5d1222){if(_0x5d1222){return _0x2cc6ad[_0xa7f3('0x1b')](_0x52a369)[_0xa7f3('0x1c')](_0x5d1222);}};}function respondWithFilteredResult(_0x43b200,_0x31044a){return function(_0x528624){if(_0x528624){var _0x401691=_0x528624[_0xa7f3('0x1d')],_0x511bad=_0x31044a['offset'],_0x2aa242=_0x31044a[_0xa7f3('0x1e')]+_0x31044a['limit'],_0x394a52;if(_0x2aa242>=_0x401691){_0x2aa242=_0x401691;_0x394a52=0xc8;}else{_0x394a52=0xce;}_0x43b200[_0xa7f3('0x1b')](_0x394a52);return _0x43b200[_0xa7f3('0x1f')](_0xa7f3('0x20'),_0x511bad+'-'+_0x2aa242+'/'+_0x401691)[_0xa7f3('0x1c')](_0x528624);}return null;};}function patchUpdates(_0x896450){return function(_0x32cfb7){try{jsonpatch[_0xa7f3('0x21')](_0x32cfb7,_0x896450,!![]);}catch(_0x383334){return BPromise[_0xa7f3('0x22')](_0x383334);}return _0x32cfb7[_0xa7f3('0x23')]();};}function saveUpdates(_0x1d3f2d,_0x37372c){return function(_0xc70ac9){if(_0xc70ac9){return _0xc70ac9['update'](_0x1d3f2d)[_0xa7f3('0x24')](function(_0x3fb4e0){return _0x3fb4e0;});}return null;};}function removeEntity(_0x33ffce,_0x1f8023){return function(_0x34f8d8){if(_0x34f8d8){return _0x34f8d8[_0xa7f3('0x25')]()[_0xa7f3('0x24')](function(){_0x33ffce[_0xa7f3('0x1b')](0xcc)[_0xa7f3('0x26')]();});}};}function handleEntityNotFound(_0x9a96de,_0x3bd2fe){return function(_0x5316fa){if(!_0x5316fa){_0x9a96de[_0xa7f3('0x1a')](0x194);}return _0x5316fa;};}function handleError(_0x952921,_0x199170){_0x199170=_0x199170||0x1f4;return function(_0x2e3047){logger[_0xa7f3('0x27')](_0x2e3047[_0xa7f3('0x28')]);if(_0x2e3047['name']){delete _0x2e3047['name'];}_0x952921[_0xa7f3('0x1b')](_0x199170)['send'](_0x2e3047);};}exports[_0xa7f3('0x29')]=function(_0x1ef515,_0x1087b2){var _0x1f200b={},_0x32baac={},_0x642000={'count':0x0,'rows':[]};var _0x2ae562=_[_0xa7f3('0x2a')](db[_0xa7f3('0x2b')][_0xa7f3('0x2c')],function(_0x567139){return{'name':_0x567139['fieldName'],'type':_0x567139[_0xa7f3('0x2d')]['key']};});_0x32baac[_0xa7f3('0x2e')]=_[_0xa7f3('0x2a')](_0x2ae562,_0xa7f3('0x2f'));_0x32baac[_0xa7f3('0x30')]=_[_0xa7f3('0x31')](_0x1ef515[_0xa7f3('0x30')]);_0x32baac[_0xa7f3('0x32')]=_[_0xa7f3('0x33')](_0x32baac[_0xa7f3('0x2e')],_0x32baac[_0xa7f3('0x30')]);_0x1f200b[_0xa7f3('0x34')]=_[_0xa7f3('0x33')](_0x32baac[_0xa7f3('0x2e')],qs[_0xa7f3('0x35')](_0x1ef515[_0xa7f3('0x30')][_0xa7f3('0x35')]));_0x1f200b[_0xa7f3('0x34')]=_0x1f200b[_0xa7f3('0x34')][_0xa7f3('0x36')]?_0x1f200b[_0xa7f3('0x34')]:_0x32baac[_0xa7f3('0x2e')];if(!_0x1ef515[_0xa7f3('0x30')][_0xa7f3('0x37')]('nolimit')){_0x1f200b[_0xa7f3('0x38')]=qs['limit'](_0x1ef515[_0xa7f3('0x30')]['limit']);_0x1f200b['offset']=qs['offset'](_0x1ef515[_0xa7f3('0x30')][_0xa7f3('0x1e')]);}_0x1f200b['order']=qs['sort'](_0x1ef515[_0xa7f3('0x30')]['sort']);_0x1f200b[_0xa7f3('0x39')]=qs['filters'](_[_0xa7f3('0x3a')](_0x1ef515[_0xa7f3('0x30')],_0x32baac[_0xa7f3('0x32')]),_0x2ae562);if(_0x1ef515[_0xa7f3('0x30')][_0xa7f3('0x3b')]){_0x1f200b[_0xa7f3('0x39')]=_[_0xa7f3('0x3c')](_0x1f200b[_0xa7f3('0x39')],{'$or':_[_0xa7f3('0x2a')](_0x2ae562,function(_0x5918cf){if(_0x5918cf['type']!==_0xa7f3('0x3d')){var _0x31db5d={};_0x31db5d[_0x5918cf[_0xa7f3('0x2f')]]={'$like':'%'+_0x1ef515['query'][_0xa7f3('0x3b')]+'%'};return _0x31db5d;}})});}_0x1f200b=_[_0xa7f3('0x3c')]({},_0x1f200b,_0x1ef515[_0xa7f3('0x3e')]);var _0x56774e={'where':_0x1f200b[_0xa7f3('0x39')]};return db['SquareReport'][_0xa7f3('0x1d')](_0x56774e)[_0xa7f3('0x24')](function(_0x11b1ae){_0x642000[_0xa7f3('0x1d')]=_0x11b1ae;if(_0x1ef515['query'][_0xa7f3('0x3f')]){_0x1f200b[_0xa7f3('0x40')]=[{'all':!![]}];}return db['SquareReport'][_0xa7f3('0x41')](_0x1f200b);})['then'](function(_0x42dafd){_0x642000[_0xa7f3('0x42')]=_0x42dafd;return _0x642000;})[_0xa7f3('0x24')](respondWithFilteredResult(_0x1087b2,_0x1f200b))[_0xa7f3('0x43')](handleError(_0x1087b2,null));};exports[_0xa7f3('0x44')]=function(_0x7a4b3,_0x45e45d){var _0x1dfcbe={'raw':!![],'where':{'id':_0x7a4b3['params']['id']}},_0x3507b9={};_0x3507b9[_0xa7f3('0x2e')]=_['keys'](db[_0xa7f3('0x2b')]['rawAttributes']);_0x3507b9['query']=_[_0xa7f3('0x31')](_0x7a4b3[_0xa7f3('0x30')]);_0x3507b9[_0xa7f3('0x32')]=_['intersection'](_0x3507b9[_0xa7f3('0x2e')],_0x3507b9['query']);_0x1dfcbe[_0xa7f3('0x34')]=_[_0xa7f3('0x33')](_0x3507b9[_0xa7f3('0x2e')],qs['fields'](_0x7a4b3['query'][_0xa7f3('0x35')]));_0x1dfcbe[_0xa7f3('0x34')]=_0x1dfcbe['attributes']['length']?_0x1dfcbe['attributes']:_0x3507b9[_0xa7f3('0x2e')];if(_0x7a4b3[_0xa7f3('0x30')][_0xa7f3('0x3f')]){_0x1dfcbe[_0xa7f3('0x40')]=[{'all':!![]}];}_0x1dfcbe=_[_0xa7f3('0x3c')]({},_0x1dfcbe,_0x7a4b3['options']);return db[_0xa7f3('0x2b')][_0xa7f3('0x45')](_0x1dfcbe)[_0xa7f3('0x24')](handleEntityNotFound(_0x45e45d,null))[_0xa7f3('0x24')](respondWithResult(_0x45e45d,null))['catch'](handleError(_0x45e45d,null));};exports[_0xa7f3('0x46')]=function(_0x1db437,_0x140260){return db[_0xa7f3('0x2b')][_0xa7f3('0x46')](_0x1db437['body'],{})[_0xa7f3('0x24')](respondWithResult(_0x140260,0xc9))[_0xa7f3('0x43')](handleError(_0x140260,null));};exports[_0xa7f3('0x47')]=function(_0x271d52,_0x447d33){if(_0x271d52[_0xa7f3('0x48')]['id']){delete _0x271d52[_0xa7f3('0x48')]['id'];}return db[_0xa7f3('0x2b')][_0xa7f3('0x45')]({'where':{'id':_0x271d52[_0xa7f3('0x49')]['id']}})[_0xa7f3('0x24')](handleEntityNotFound(_0x447d33,null))['then'](saveUpdates(_0x271d52[_0xa7f3('0x48')],null))[_0xa7f3('0x24')](respondWithResult(_0x447d33,null))['catch'](handleError(_0x447d33,null));};exports[_0xa7f3('0x25')]=function(_0x4b3573,_0x2db208){return db[_0xa7f3('0x2b')][_0xa7f3('0x45')]({'where':{'id':_0x4b3573[_0xa7f3('0x49')]['id']}})[_0xa7f3('0x24')](handleEntityNotFound(_0x2db208,null))['then'](removeEntity(_0x2db208,null))[_0xa7f3('0x43')](handleError(_0x2db208,null));};exports[_0xa7f3('0x4a')]=function(_0x116965,_0x439129){return db['SquareReport'][_0xa7f3('0x4a')]()['then'](respondWithResult(_0x439129,null))[_0xa7f3('0x43')](handleError(_0x439129,null));}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.model.js b/server/api/squareReport/squareReport.model.js index b342f76..c57c345 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 _0xa1e2=['bluebird','request-promise','path','rimraf','../../config/environment','./squareReport.attributes','exports','SquareReport','report_square','uid_pname','uniqueid','project_name','leaveAt','lodash','util','../../config/logger','api','moment'];(function(_0x117dfd,_0x47000e){var _0x43f351=function(_0x7be826){while(--_0x7be826){_0x117dfd['push'](_0x117dfd['shift']());}};_0x43f351(++_0x47000e);}(_0xa1e2,0xe5));var _0x2a1e=function(_0x1ad7ae,_0xf4e5c8){_0x1ad7ae=_0x1ad7ae-0x0;var _0x15f474=_0xa1e2[_0x1ad7ae];return _0x15f474;};'use strict';var _=require(_0x2a1e('0x0'));var util=require(_0x2a1e('0x1'));var logger=require(_0x2a1e('0x2'))(_0x2a1e('0x3'));var moment=require(_0x2a1e('0x4'));var BPromise=require(_0x2a1e('0x5'));var rp=require(_0x2a1e('0x6'));var fs=require('fs');var path=require(_0x2a1e('0x7'));var rimraf=require(_0x2a1e('0x8'));var config=require(_0x2a1e('0x9'));var attributes=require(_0x2a1e('0xa'));module[_0x2a1e('0xb')]=function(_0x411bde,_0x409ba4){return _0x411bde['define'](_0x2a1e('0xc'),attributes,{'tableName':_0x2a1e('0xd'),'paranoid':![],'indexes':[{'name':_0x2a1e('0xe'),'fields':[_0x2a1e('0xf'),_0x2a1e('0x10')]},{'name':_0x2a1e('0x11'),'fields':[_0x2a1e('0x11')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x3690=['leaveAt','lodash','util','api','moment','path','rimraf','../../config/environment','./squareReport.attributes','exports','define','SquareReport'];(function(_0xca28d9,_0x206d23){var _0x2a190b=function(_0x4beff9){while(--_0x4beff9){_0xca28d9['push'](_0xca28d9['shift']());}};_0x2a190b(++_0x206d23);}(_0x3690,0xe5));var _0x0369=function(_0x535355,_0x134e0d){_0x535355=_0x535355-0x0;var _0x33f61e=_0x3690[_0x535355];return _0x33f61e;};'use strict';var _=require(_0x0369('0x0'));var util=require(_0x0369('0x1'));var logger=require('../../config/logger')(_0x0369('0x2'));var moment=require(_0x0369('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x0369('0x4'));var rimraf=require(_0x0369('0x5'));var config=require(_0x0369('0x6'));var attributes=require(_0x0369('0x7'));module[_0x0369('0x8')]=function(_0x1bf675,_0x29762d){return _0x1bf675[_0x0369('0x9')](_0x0369('0xa'),attributes,{'tableName':'report_square','paranoid':![],'indexes':[{'name':'uid_pname','fields':['uniqueid','project_name']},{'name':'leaveAt','fields':[_0x0369('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 2ad96ae..f25bb81 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 _0x0924=['jayson/promise','client','http','request','then','info','SquareReport,\x20%s,\x20%s','debug','SquareReport,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','CreateSquareReport','SquareReport','body','options','raw','stringify','UpdateSquareReport','update','attributes','limit','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc'];(function(_0x187de9,_0x5da8c8){var _0x52684c=function(_0x537450){while(--_0x537450){_0x187de9['push'](_0x187de9['shift']());}};_0x52684c(++_0x5da8c8);}(_0x0924,0xdf));var _0x4092=function(_0x17c483,_0xc69535){_0x17c483=_0x17c483-0x0;var _0x112bdb=_0x0924[_0x17c483];return _0x112bdb;};'use strict';var _=require(_0x4092('0x0'));var util=require(_0x4092('0x1'));var moment=require(_0x4092('0x2'));var BPromise=require(_0x4092('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x4092('0x4'));var db=require(_0x4092('0x5'))['db'];var utils=require(_0x4092('0x6'));var logger=require('../../config/logger')(_0x4092('0x7'));var config=require('../../config/environment');var jayson=require(_0x4092('0x8'));var client=jayson[_0x4092('0x9')][_0x4092('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x54463b,_0x1c0981,_0x35e1ea){return new BPromise(function(_0x3d4b63,_0x4621eb){return client[_0x4092('0xb')](_0x54463b,_0x35e1ea)[_0x4092('0xc')](function(_0x208536){logger[_0x4092('0xd')](_0x4092('0xe'),_0x1c0981,'request\x20sent');logger[_0x4092('0xf')](_0x4092('0x10'),_0x1c0981,_0x4092('0x11'),JSON['stringify'](_0x208536));if(_0x208536[_0x4092('0x12')]){if(_0x208536[_0x4092('0x12')][_0x4092('0x13')]===0x1f4){logger[_0x4092('0x12')](_0x4092('0xe'),_0x1c0981,_0x208536[_0x4092('0x12')][_0x4092('0x14')]);return _0x4621eb(_0x208536['error']['message']);}logger[_0x4092('0x12')](_0x4092('0xe'),_0x1c0981,_0x208536[_0x4092('0x12')][_0x4092('0x14')]);return _0x3d4b63(_0x208536[_0x4092('0x12')][_0x4092('0x14')]);}else{logger[_0x4092('0xd')](_0x4092('0xe'),_0x1c0981,_0x4092('0x11'));_0x3d4b63(_0x208536[_0x4092('0x15')][_0x4092('0x14')]);}})[_0x4092('0x16')](function(_0x3506b7){logger['error']('SquareReport,\x20%s,\x20%s',_0x1c0981,_0x3506b7);_0x4621eb(_0x3506b7);});});}exports[_0x4092('0x17')]=function(_0xf38eb6){var _0x4be1ff=this;return new Promise(function(_0x5aba67,_0x54df9e){return db[_0x4092('0x18')]['create'](_0xf38eb6[_0x4092('0x19')],{'raw':_0xf38eb6[_0x4092('0x1a')]?_0xf38eb6['options'][_0x4092('0x1b')]===undefined?!![]:![]:!![]})[_0x4092('0xc')](function(_0x3959a0){logger['info']('CreateSquareReport',_0xf38eb6);logger['debug']('CreateSquareReport',_0xf38eb6,JSON[_0x4092('0x1c')](_0x3959a0));_0x5aba67(_0x3959a0);})[_0x4092('0x16')](function(_0x498cf4){logger[_0x4092('0x12')](_0x4092('0x17'),_0x498cf4[_0x4092('0x14')],_0xf38eb6);_0x54df9e(_0x4be1ff[_0x4092('0x12')](0x1f4,_0x498cf4[_0x4092('0x14')]));});});};exports[_0x4092('0x1d')]=function(_0x44ae31){var _0x105b9e=this;return new Promise(function(_0x29c630,_0xf1ffe5){return db['SquareReport'][_0x4092('0x1e')](_0x44ae31[_0x4092('0x19')],{'raw':_0x44ae31[_0x4092('0x1a')]?_0x44ae31[_0x4092('0x1a')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x44ae31[_0x4092('0x1a')]?_0x44ae31['options']['where']||null:null,'attributes':_0x44ae31['options']?_0x44ae31[_0x4092('0x1a')][_0x4092('0x1f')]||null:null,'limit':_0x44ae31['options']?_0x44ae31[_0x4092('0x1a')][_0x4092('0x20')]||null:null})[_0x4092('0xc')](function(_0x2f2087){logger['info'](_0x4092('0x1d'),_0x44ae31);logger[_0x4092('0xf')]('UpdateSquareReport',_0x44ae31,JSON[_0x4092('0x1c')](_0x2f2087));_0x29c630(_0x2f2087);})[_0x4092('0x16')](function(_0x59bca8){logger[_0x4092('0x12')](_0x4092('0x1d'),_0x59bca8[_0x4092('0x14')],_0x44ae31);_0xf1ffe5(_0x105b9e['error'](0x1f4,_0x59bca8[_0x4092('0x14')]));});});}; \ No newline at end of file +var _0xb962=['error','code','message','result','catch','CreateSquareReport','SquareReport','create','body','options','raw','UpdateSquareReport','update','where','attributes','limit','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','SquareReport,\x20%s,\x20%s','request\x20sent','debug','SquareReport,\x20%s,\x20%s,\x20%s','stringify'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0xb962,0x178));var _0x2b96=function(_0x222627,_0x47a235){_0x222627=_0x222627-0x0;var _0x5bdaf5=_0xb962[_0x222627];return _0x5bdaf5;};'use strict';var _=require(_0x2b96('0x0'));var util=require(_0x2b96('0x1'));var moment=require(_0x2b96('0x2'));var BPromise=require(_0x2b96('0x3'));var rs=require(_0x2b96('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x2b96('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x2b96('0x6'))(_0x2b96('0x7'));var config=require(_0x2b96('0x8'));var jayson=require(_0x2b96('0x9'));var client=jayson[_0x2b96('0xa')][_0x2b96('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1d74ef,_0x5bd317,_0x223917){return new BPromise(function(_0x99ba7c,_0x1dcd97){return client[_0x2b96('0xc')](_0x1d74ef,_0x223917)[_0x2b96('0xd')](function(_0x49d2da){logger[_0x2b96('0xe')](_0x2b96('0xf'),_0x5bd317,_0x2b96('0x10'));logger[_0x2b96('0x11')](_0x2b96('0x12'),_0x5bd317,_0x2b96('0x10'),JSON[_0x2b96('0x13')](_0x49d2da));if(_0x49d2da[_0x2b96('0x14')]){if(_0x49d2da['error'][_0x2b96('0x15')]===0x1f4){logger['error'](_0x2b96('0xf'),_0x5bd317,_0x49d2da[_0x2b96('0x14')][_0x2b96('0x16')]);return _0x1dcd97(_0x49d2da[_0x2b96('0x14')]['message']);}logger[_0x2b96('0x14')](_0x2b96('0xf'),_0x5bd317,_0x49d2da[_0x2b96('0x14')][_0x2b96('0x16')]);return _0x99ba7c(_0x49d2da[_0x2b96('0x14')][_0x2b96('0x16')]);}else{logger[_0x2b96('0xe')](_0x2b96('0xf'),_0x5bd317,_0x2b96('0x10'));_0x99ba7c(_0x49d2da[_0x2b96('0x17')][_0x2b96('0x16')]);}})[_0x2b96('0x18')](function(_0xe47b49){logger['error']('SquareReport,\x20%s,\x20%s',_0x5bd317,_0xe47b49);_0x1dcd97(_0xe47b49);});});}exports[_0x2b96('0x19')]=function(_0x14d7fc){var _0x2e43e2=this;return new Promise(function(_0x288733,_0xec462e){return db[_0x2b96('0x1a')][_0x2b96('0x1b')](_0x14d7fc[_0x2b96('0x1c')],{'raw':_0x14d7fc[_0x2b96('0x1d')]?_0x14d7fc[_0x2b96('0x1d')][_0x2b96('0x1e')]===undefined?!![]:![]:!![]})[_0x2b96('0xd')](function(_0x237f39){logger['info'](_0x2b96('0x19'),_0x14d7fc);logger['debug'](_0x2b96('0x19'),_0x14d7fc,JSON[_0x2b96('0x13')](_0x237f39));_0x288733(_0x237f39);})[_0x2b96('0x18')](function(_0xc3bf4a){logger[_0x2b96('0x14')]('CreateSquareReport',_0xc3bf4a['message'],_0x14d7fc);_0xec462e(_0x2e43e2[_0x2b96('0x14')](0x1f4,_0xc3bf4a['message']));});});};exports[_0x2b96('0x1f')]=function(_0x2696cb){var _0x5b89a0=this;return new Promise(function(_0x2bfec4,_0x69f7ab){return db[_0x2b96('0x1a')][_0x2b96('0x20')](_0x2696cb[_0x2b96('0x1c')],{'raw':_0x2696cb['options']?_0x2696cb[_0x2b96('0x1d')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2696cb[_0x2b96('0x1d')]?_0x2696cb[_0x2b96('0x1d')][_0x2b96('0x21')]||null:null,'attributes':_0x2696cb[_0x2b96('0x1d')]?_0x2696cb[_0x2b96('0x1d')][_0x2b96('0x22')]||null:null,'limit':_0x2696cb[_0x2b96('0x1d')]?_0x2696cb[_0x2b96('0x1d')][_0x2b96('0x23')]||null:null})['then'](function(_0x5f5bae){logger[_0x2b96('0xe')](_0x2b96('0x1f'),_0x2696cb);logger[_0x2b96('0x11')](_0x2b96('0x1f'),_0x2696cb,JSON[_0x2b96('0x13')](_0x5f5bae));_0x2bfec4(_0x5f5bae);})[_0x2b96('0x18')](function(_0x5d74b2){logger[_0x2b96('0x14')]('UpdateSquareReport',_0x5d74b2[_0x2b96('0x16')],_0x2696cb);_0x69f7ab(_0x5b89a0[_0x2b96('0x14')](0x1f4,_0x5d74b2['message']));});});}; \ No newline at end of file diff --git a/server/api/squareReportDetail/index.js b/server/api/squareReportDetail/index.js index 7ff7f1e..d68d7a3 100644 --- a/server/api/squareReportDetail/index.js +++ b/server/api/squareReportDetail/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['describe','/:id','create','delete','destroy','exports','multer','util','path','express','Router','../../components/interaction/service','../../config/environment','./squareReportDetail.controller','get','isAuthenticated'];(function(_0x4f011b,_0xdb6c19){var _0x530ea5=function(_0x1f8bc7){while(--_0x1f8bc7){_0x4f011b['push'](_0x4f011b['shift']());}};_0x530ea5(++_0xdb6c19);}(_0x7a54,0x106));var _0x47a5=function(_0x45ed6d,_0x5d71a5){_0x45ed6d=_0x45ed6d-0x0;var _0x5b48e9=_0x7a54[_0x45ed6d];return _0x5b48e9;};'use strict';var multer=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var path=require(_0x47a5('0x2'));var timeout=require('connect-timeout');var express=require(_0x47a5('0x3'));var router=express[_0x47a5('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x47a5('0x5'));var config=require(_0x47a5('0x6'));var controller=require(_0x47a5('0x7'));router[_0x47a5('0x8')]('/',auth[_0x47a5('0x9')](),controller['index']);router[_0x47a5('0x8')]('/describe',auth[_0x47a5('0x9')](),controller[_0x47a5('0xa')]);router['get'](_0x47a5('0xb'),auth['isAuthenticated'](),controller['show']);router['post']('/',auth[_0x47a5('0x9')](),controller[_0x47a5('0xc')]);router['put'](_0x47a5('0xb'),auth['isAuthenticated'](),controller['update']);router[_0x47a5('0xd')](_0x47a5('0xb'),auth[_0x47a5('0x9')](),controller[_0x47a5('0xe')]);module[_0x47a5('0xf')]=router; \ No newline at end of file +var _0x7a54=['describe','/:id','create','delete','destroy','exports','multer','util','path','express','Router','../../components/interaction/service','../../config/environment','./squareReportDetail.controller','get','isAuthenticated'];(function(_0x559310,_0x2394fc){var _0x504ace=function(_0x10bd15){while(--_0x10bd15){_0x559310['push'](_0x559310['shift']());}};_0x504ace(++_0x2394fc);}(_0x7a54,0x106));var _0x47a5=function(_0x173ff0,_0x195b5d){_0x173ff0=_0x173ff0-0x0;var _0x181e15=_0x7a54[_0x173ff0];return _0x181e15;};'use strict';var multer=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var path=require(_0x47a5('0x2'));var timeout=require('connect-timeout');var express=require(_0x47a5('0x3'));var router=express[_0x47a5('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x47a5('0x5'));var config=require(_0x47a5('0x6'));var controller=require(_0x47a5('0x7'));router[_0x47a5('0x8')]('/',auth[_0x47a5('0x9')](),controller['index']);router[_0x47a5('0x8')]('/describe',auth[_0x47a5('0x9')](),controller[_0x47a5('0xa')]);router['get'](_0x47a5('0xb'),auth['isAuthenticated'](),controller['show']);router['post']('/',auth[_0x47a5('0x9')](),controller[_0x47a5('0xc')]);router['put'](_0x47a5('0xb'),auth['isAuthenticated'](),controller['update']);router[_0x47a5('0xd')](_0x47a5('0xb'),auth[_0x47a5('0x9')](),controller[_0x47a5('0xe')]);module[_0x47a5('0xf')]=router; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.attributes.js b/server/api/squareReportDetail/squareReportDetail.attributes.js index 3d42e9a..c00ff5f 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 _0x5e86=['sequelize','exports','STRING','TEXT'];(function(_0x50e7d2,_0x5c356d){var _0x2d222d=function(_0x4fdfed){while(--_0x4fdfed){_0x50e7d2['push'](_0x50e7d2['shift']());}};_0x2d222d(++_0x5c356d);}(_0x5e86,0x78));var _0x65e8=function(_0x47961a,_0x2a5da6){_0x47961a=_0x47961a-0x0;var _0x1b6d9d=_0x5e86[_0x47961a];return _0x1b6d9d;};'use strict';var Sequelize=require(_0x65e8('0x0'));module[_0x65e8('0x1')]={'uniqueid':{'type':Sequelize[_0x65e8('0x2')]},'node':{'type':Sequelize[_0x65e8('0x2')]},'application':{'type':Sequelize[_0x65e8('0x2')]},'data':{'type':Sequelize[_0x65e8('0x3')]},'project_name':{'type':Sequelize[_0x65e8('0x2')]},'callerid':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xeff6=['sequelize','STRING','TEXT'];(function(_0x3f70cd,_0x6bf4ed){var _0x3feb93=function(_0x4a045a){while(--_0x4a045a){_0x3f70cd['push'](_0x3f70cd['shift']());}};_0x3feb93(++_0x6bf4ed);}(_0xeff6,0x129));var _0x6eff=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xeff6[_0x14add3];return _0x4a174f;};'use strict';var Sequelize=require(_0x6eff('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0x6eff('0x1')]},'node':{'type':Sequelize['STRING']},'application':{'type':Sequelize[_0x6eff('0x1')]},'data':{'type':Sequelize[_0x6eff('0x2')]},'project_name':{'type':Sequelize[_0x6eff('0x1')]},'callerid':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.controller.js b/server/api/squareReportDetail/squareReportDetail.controller.js index 5b8c328..96807a5 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 _0x2591=['fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','papaparse','ioredis','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../mysqldb','status','end','count','offset','Content-Range','apply','save','update','then','destroy','error','stack','name','index','map','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','filter','merge','options','SquareDetailsReport','findAll','rows','show','params','rawAttributes','include','find','create','body','catch','describe','html-pdf','eml-format','zip-dir'];(function(_0xe73080,_0x24c56d){var _0x12cbc4=function(_0x1377e2){while(--_0x1377e2){_0xe73080['push'](_0xe73080['shift']());}};_0x12cbc4(++_0x24c56d);}(_0x2591,0x111));var _0x1259=function(_0x434de7,_0x56f82a){_0x434de7=_0x434de7-0x0;var _0x41b295=_0x2591[_0x434de7];return _0x41b295;};'use strict';var pdf=require(_0x1259('0x0'));var emlformat=require(_0x1259('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x1259('0x2'));var jsonpatch=require(_0x1259('0x3'));var rp=require(_0x1259('0x4'));var moment=require(_0x1259('0x5'));var BPromise=require(_0x1259('0x6'));var Mustache=require(_0x1259('0x7'));var util=require(_0x1259('0x8'));var path=require(_0x1259('0x9'));var sox=require(_0x1259('0xa'));var csv=require(_0x1259('0xb'));var ejs=require(_0x1259('0xc'));var fs=require('fs');var _=require(_0x1259('0xd'));var squel=require('squel');var crypto=require(_0x1259('0xe'));var jsforce=require(_0x1259('0xf'));var deskjs=require(_0x1259('0x10'));var toCsv=require(_0x1259('0xb'));var querystring=require('querystring');var Papa=require(_0x1259('0x11'));var Redis=require(_0x1259('0x12'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x1259('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x1259('0x14'));var utils=require(_0x1259('0x15'));var config=require(_0x1259('0x16'));var db=require(_0x1259('0x17'))['db'];function respondWithStatusCode(_0x8327ba,_0x410236){_0x410236=_0x410236||0xcc;return function(_0x703120){if(_0x703120){return _0x8327ba['sendStatus'](_0x410236);}return _0x8327ba[_0x1259('0x18')](_0x410236)[_0x1259('0x19')]();};}function respondWithResult(_0x4d0dc3,_0x3116d5){_0x3116d5=_0x3116d5||0xc8;return function(_0x54d1e7){if(_0x54d1e7){return _0x4d0dc3[_0x1259('0x18')](_0x3116d5)['json'](_0x54d1e7);}};}function respondWithFilteredResult(_0x1ac011,_0x4c1ada){return function(_0xbb7930){if(_0xbb7930){var _0x182684=_0xbb7930[_0x1259('0x1a')],_0x366cff=_0x4c1ada[_0x1259('0x1b')],_0x1f6be4=_0x4c1ada[_0x1259('0x1b')]+_0x4c1ada['limit'],_0x3ea625;if(_0x1f6be4>=_0x182684){_0x1f6be4=_0x182684;_0x3ea625=0xc8;}else{_0x3ea625=0xce;}_0x1ac011[_0x1259('0x18')](_0x3ea625);return _0x1ac011['set'](_0x1259('0x1c'),_0x366cff+'-'+_0x1f6be4+'/'+_0x182684)['json'](_0xbb7930);}return null;};}function patchUpdates(_0x29cc26){return function(_0x537d81){try{jsonpatch[_0x1259('0x1d')](_0x537d81,_0x29cc26,!![]);}catch(_0x484117){return BPromise['reject'](_0x484117);}return _0x537d81[_0x1259('0x1e')]();};}function saveUpdates(_0x1e874c,_0x227ee9){return function(_0x57864e){if(_0x57864e){return _0x57864e[_0x1259('0x1f')](_0x1e874c)[_0x1259('0x20')](function(_0x52cb24){return _0x52cb24;});}return null;};}function removeEntity(_0x4d8d8f,_0x54b832){return function(_0x333b80){if(_0x333b80){return _0x333b80[_0x1259('0x21')]()[_0x1259('0x20')](function(){_0x4d8d8f['status'](0xcc)[_0x1259('0x19')]();});}};}function handleEntityNotFound(_0x3d5345,_0x1c2798){return function(_0x1671bd){if(!_0x1671bd){_0x3d5345['sendStatus'](0x194);}return _0x1671bd;};}function handleError(_0x2f1d49,_0x4d9ebd){_0x4d9ebd=_0x4d9ebd||0x1f4;return function(_0x155d74){logger[_0x1259('0x22')](_0x155d74[_0x1259('0x23')]);if(_0x155d74[_0x1259('0x24')]){delete _0x155d74[_0x1259('0x24')];}_0x2f1d49[_0x1259('0x18')](_0x4d9ebd)['send'](_0x155d74);};}exports[_0x1259('0x25')]=function(_0x14d986,_0x5d4f9f){var _0x572811={},_0x174626={},_0x1018b2={'count':0x0,'rows':[]};var _0x133860=_[_0x1259('0x26')](db['SquareDetailsReport']['rawAttributes'],function(_0x338b94){return{'name':_0x338b94['fieldName'],'type':_0x338b94[_0x1259('0x27')]['key']};});_0x174626[_0x1259('0x28')]=_[_0x1259('0x26')](_0x133860,_0x1259('0x24'));_0x174626[_0x1259('0x29')]=_[_0x1259('0x2a')](_0x14d986[_0x1259('0x29')]);_0x174626[_0x1259('0x2b')]=_[_0x1259('0x2c')](_0x174626[_0x1259('0x28')],_0x174626[_0x1259('0x29')]);_0x572811[_0x1259('0x2d')]=_['intersection'](_0x174626['model'],qs['fields'](_0x14d986[_0x1259('0x29')][_0x1259('0x2e')]));_0x572811['attributes']=_0x572811[_0x1259('0x2d')][_0x1259('0x2f')]?_0x572811[_0x1259('0x2d')]:_0x174626[_0x1259('0x28')];if(!_0x14d986[_0x1259('0x29')][_0x1259('0x30')](_0x1259('0x31'))){_0x572811['limit']=qs[_0x1259('0x32')](_0x14d986[_0x1259('0x29')]['limit']);_0x572811[_0x1259('0x1b')]=qs[_0x1259('0x1b')](_0x14d986[_0x1259('0x29')]['offset']);}_0x572811[_0x1259('0x33')]=qs[_0x1259('0x34')](_0x14d986[_0x1259('0x29')][_0x1259('0x34')]);_0x572811[_0x1259('0x35')]=qs[_0x1259('0x2b')](_['pick'](_0x14d986[_0x1259('0x29')],_0x174626[_0x1259('0x2b')]),_0x133860);if(_0x14d986[_0x1259('0x29')][_0x1259('0x36')]){_0x572811[_0x1259('0x35')]=_['merge'](_0x572811[_0x1259('0x35')],{'$or':_[_0x1259('0x26')](_0x133860,function(_0x55a352){if(_0x55a352[_0x1259('0x27')]!=='VIRTUAL'){var _0x45539b={};_0x45539b[_0x55a352[_0x1259('0x24')]]={'$like':'%'+_0x14d986['query'][_0x1259('0x36')]+'%'};return _0x45539b;}})});}_0x572811=_[_0x1259('0x37')]({},_0x572811,_0x14d986[_0x1259('0x38')]);var _0x5c81f7={'where':_0x572811[_0x1259('0x35')]};return db[_0x1259('0x39')]['count'](_0x5c81f7)[_0x1259('0x20')](function(_0x45c0bc){_0x1018b2['count']=_0x45c0bc;if(_0x14d986[_0x1259('0x29')]['includeAll']){_0x572811['include']=[{'all':!![]}];}return db[_0x1259('0x39')][_0x1259('0x3a')](_0x572811);})['then'](function(_0x5b2abb){_0x1018b2[_0x1259('0x3b')]=_0x5b2abb;return _0x1018b2;})[_0x1259('0x20')](respondWithFilteredResult(_0x5d4f9f,_0x572811))['catch'](handleError(_0x5d4f9f,null));};exports[_0x1259('0x3c')]=function(_0x273f56,_0x3c478d){var _0x4af76b={'raw':!![],'where':{'id':_0x273f56[_0x1259('0x3d')]['id']}},_0x12ce66={};_0x12ce66[_0x1259('0x28')]=_['keys'](db['SquareDetailsReport'][_0x1259('0x3e')]);_0x12ce66[_0x1259('0x29')]=_[_0x1259('0x2a')](_0x273f56[_0x1259('0x29')]);_0x12ce66[_0x1259('0x2b')]=_[_0x1259('0x2c')](_0x12ce66[_0x1259('0x28')],_0x12ce66['query']);_0x4af76b[_0x1259('0x2d')]=_[_0x1259('0x2c')](_0x12ce66['model'],qs[_0x1259('0x2e')](_0x273f56[_0x1259('0x29')][_0x1259('0x2e')]));_0x4af76b[_0x1259('0x2d')]=_0x4af76b['attributes'][_0x1259('0x2f')]?_0x4af76b[_0x1259('0x2d')]:_0x12ce66['model'];if(_0x273f56[_0x1259('0x29')]['includeAll']){_0x4af76b[_0x1259('0x3f')]=[{'all':!![]}];}_0x4af76b=_[_0x1259('0x37')]({},_0x4af76b,_0x273f56[_0x1259('0x38')]);return db['SquareDetailsReport'][_0x1259('0x40')](_0x4af76b)[_0x1259('0x20')](handleEntityNotFound(_0x3c478d,null))['then'](respondWithResult(_0x3c478d,null))['catch'](handleError(_0x3c478d,null));};exports[_0x1259('0x41')]=function(_0x35a530,_0x3e14a6){return db[_0x1259('0x39')][_0x1259('0x41')](_0x35a530[_0x1259('0x42')],{})[_0x1259('0x20')](respondWithResult(_0x3e14a6,0xc9))[_0x1259('0x43')](handleError(_0x3e14a6,null));};exports[_0x1259('0x1f')]=function(_0x1d78bb,_0x4a11f4){if(_0x1d78bb[_0x1259('0x42')]['id']){delete _0x1d78bb[_0x1259('0x42')]['id'];}return db[_0x1259('0x39')][_0x1259('0x40')]({'where':{'id':_0x1d78bb[_0x1259('0x3d')]['id']}})[_0x1259('0x20')](handleEntityNotFound(_0x4a11f4,null))[_0x1259('0x20')](saveUpdates(_0x1d78bb[_0x1259('0x42')],null))[_0x1259('0x20')](respondWithResult(_0x4a11f4,null))[_0x1259('0x43')](handleError(_0x4a11f4,null));};exports[_0x1259('0x21')]=function(_0x334aaa,_0x47ac47){return db[_0x1259('0x39')][_0x1259('0x40')]({'where':{'id':_0x334aaa['params']['id']}})[_0x1259('0x20')](handleEntityNotFound(_0x47ac47,null))[_0x1259('0x20')](removeEntity(_0x47ac47,null))[_0x1259('0x43')](handleError(_0x47ac47,null));};exports[_0x1259('0x44')]=function(_0x383c9d,_0x478ae0){return db[_0x1259('0x39')]['describe']()[_0x1259('0x20')](respondWithResult(_0x478ae0,null))[_0x1259('0x43')](handleError(_0x478ae0,null));}; \ No newline at end of file +var _0x730c=['../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','end','status','json','offset','set','apply','update','then','sendStatus','error','stack','name','index','map','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','filter','merge','options','SquareDetailsReport','count','includeAll','include','findAll','rows','catch','show','params','keys','find','create','body','describe','eml-format','rimraf','fast-json-patch','request-promise','bluebird','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service'];(function(_0x42dbea,_0x5a9ada){var _0x531d45=function(_0x46aebd){while(--_0x46aebd){_0x42dbea['push'](_0x42dbea['shift']());}};_0x531d45(++_0x5a9ada);}(_0x730c,0x15a));var _0xc730=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x730c[_0x3dd15e];return _0x231fd0;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xc730('0x0'));var rimraf=require(_0xc730('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xc730('0x2'));var rp=require(_0xc730('0x3'));var moment=require('moment');var BPromise=require(_0xc730('0x4'));var Mustache=require('mustache');var util=require(_0xc730('0x5'));var path=require(_0xc730('0x6'));var sox=require(_0xc730('0x7'));var csv=require(_0xc730('0x8'));var ejs=require(_0xc730('0x9'));var fs=require('fs');var _=require(_0xc730('0xa'));var squel=require(_0xc730('0xb'));var crypto=require(_0xc730('0xc'));var jsforce=require(_0xc730('0xd'));var deskjs=require(_0xc730('0xe'));var toCsv=require(_0xc730('0x8'));var querystring=require(_0xc730('0xf'));var Papa=require(_0xc730('0x10'));var Redis=require(_0xc730('0x11'));var authService=require(_0xc730('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xc730('0x13'));var hardwareService=require(_0xc730('0x14'));var logger=require('../../config/logger')(_0xc730('0x15'));var utils=require(_0xc730('0x16'));var config=require(_0xc730('0x17'));var db=require(_0xc730('0x18'))['db'];function respondWithStatusCode(_0x5958f5,_0x5065c3){_0x5065c3=_0x5065c3||0xcc;return function(_0x45f70e){if(_0x45f70e){return _0x5958f5['sendStatus'](_0x5065c3);}return _0x5958f5['status'](_0x5065c3)[_0xc730('0x19')]();};}function respondWithResult(_0x28d1b7,_0x3ad512){_0x3ad512=_0x3ad512||0xc8;return function(_0x461c62){if(_0x461c62){return _0x28d1b7[_0xc730('0x1a')](_0x3ad512)[_0xc730('0x1b')](_0x461c62);}};}function respondWithFilteredResult(_0x1f0bbb,_0x541a8e){return function(_0x181a65){if(_0x181a65){var _0x59b168=_0x181a65['count'],_0x1f1c0b=_0x541a8e[_0xc730('0x1c')],_0x2fd3ea=_0x541a8e[_0xc730('0x1c')]+_0x541a8e['limit'],_0x5b41c1;if(_0x2fd3ea>=_0x59b168){_0x2fd3ea=_0x59b168;_0x5b41c1=0xc8;}else{_0x5b41c1=0xce;}_0x1f0bbb[_0xc730('0x1a')](_0x5b41c1);return _0x1f0bbb[_0xc730('0x1d')]('Content-Range',_0x1f1c0b+'-'+_0x2fd3ea+'/'+_0x59b168)[_0xc730('0x1b')](_0x181a65);}return null;};}function patchUpdates(_0x3022ea){return function(_0x23bd53){try{jsonpatch[_0xc730('0x1e')](_0x23bd53,_0x3022ea,!![]);}catch(_0xc2f04a){return BPromise['reject'](_0xc2f04a);}return _0x23bd53['save']();};}function saveUpdates(_0x1e77e3,_0x267f0c){return function(_0x6e2102){if(_0x6e2102){return _0x6e2102[_0xc730('0x1f')](_0x1e77e3)[_0xc730('0x20')](function(_0x5bcbe1){return _0x5bcbe1;});}return null;};}function removeEntity(_0x4fae4a,_0x11e7ec){return function(_0x6ec874){if(_0x6ec874){return _0x6ec874['destroy']()[_0xc730('0x20')](function(){_0x4fae4a[_0xc730('0x1a')](0xcc)[_0xc730('0x19')]();});}};}function handleEntityNotFound(_0x31d336,_0x4ad58f){return function(_0x590c65){if(!_0x590c65){_0x31d336[_0xc730('0x21')](0x194);}return _0x590c65;};}function handleError(_0x348661,_0x44ea56){_0x44ea56=_0x44ea56||0x1f4;return function(_0x48883b){logger[_0xc730('0x22')](_0x48883b[_0xc730('0x23')]);if(_0x48883b[_0xc730('0x24')]){delete _0x48883b[_0xc730('0x24')];}_0x348661[_0xc730('0x1a')](_0x44ea56)['send'](_0x48883b);};}exports[_0xc730('0x25')]=function(_0xed6a08,_0x405a96){var _0x3dfe88={},_0xeaf8c4={},_0x1d8f59={'count':0x0,'rows':[]};var _0xa6e69b=_[_0xc730('0x26')](db['SquareDetailsReport'][_0xc730('0x27')],function(_0x355a89){return{'name':_0x355a89[_0xc730('0x28')],'type':_0x355a89[_0xc730('0x29')][_0xc730('0x2a')]};});_0xeaf8c4[_0xc730('0x2b')]=_[_0xc730('0x26')](_0xa6e69b,_0xc730('0x24'));_0xeaf8c4[_0xc730('0x2c')]=_['keys'](_0xed6a08['query']);_0xeaf8c4[_0xc730('0x2d')]=_[_0xc730('0x2e')](_0xeaf8c4[_0xc730('0x2b')],_0xeaf8c4[_0xc730('0x2c')]);_0x3dfe88[_0xc730('0x2f')]=_['intersection'](_0xeaf8c4['model'],qs[_0xc730('0x30')](_0xed6a08[_0xc730('0x2c')][_0xc730('0x30')]));_0x3dfe88['attributes']=_0x3dfe88[_0xc730('0x2f')][_0xc730('0x31')]?_0x3dfe88[_0xc730('0x2f')]:_0xeaf8c4['model'];if(!_0xed6a08[_0xc730('0x2c')][_0xc730('0x32')](_0xc730('0x33'))){_0x3dfe88[_0xc730('0x34')]=qs[_0xc730('0x34')](_0xed6a08['query'][_0xc730('0x34')]);_0x3dfe88[_0xc730('0x1c')]=qs[_0xc730('0x1c')](_0xed6a08['query'][_0xc730('0x1c')]);}_0x3dfe88[_0xc730('0x35')]=qs[_0xc730('0x36')](_0xed6a08[_0xc730('0x2c')][_0xc730('0x36')]);_0x3dfe88[_0xc730('0x37')]=qs[_0xc730('0x2d')](_['pick'](_0xed6a08[_0xc730('0x2c')],_0xeaf8c4['filters']),_0xa6e69b);if(_0xed6a08[_0xc730('0x2c')][_0xc730('0x38')]){_0x3dfe88['where']=_[_0xc730('0x39')](_0x3dfe88[_0xc730('0x37')],{'$or':_[_0xc730('0x26')](_0xa6e69b,function(_0x477ec9){if(_0x477ec9[_0xc730('0x29')]!=='VIRTUAL'){var _0x2cc8f1={};_0x2cc8f1[_0x477ec9[_0xc730('0x24')]]={'$like':'%'+_0xed6a08[_0xc730('0x2c')][_0xc730('0x38')]+'%'};return _0x2cc8f1;}})});}_0x3dfe88=_[_0xc730('0x39')]({},_0x3dfe88,_0xed6a08[_0xc730('0x3a')]);var _0x2483a4={'where':_0x3dfe88[_0xc730('0x37')]};return db[_0xc730('0x3b')][_0xc730('0x3c')](_0x2483a4)[_0xc730('0x20')](function(_0x7a40a3){_0x1d8f59[_0xc730('0x3c')]=_0x7a40a3;if(_0xed6a08['query'][_0xc730('0x3d')]){_0x3dfe88[_0xc730('0x3e')]=[{'all':!![]}];}return db[_0xc730('0x3b')][_0xc730('0x3f')](_0x3dfe88);})[_0xc730('0x20')](function(_0x529e06){_0x1d8f59[_0xc730('0x40')]=_0x529e06;return _0x1d8f59;})[_0xc730('0x20')](respondWithFilteredResult(_0x405a96,_0x3dfe88))[_0xc730('0x41')](handleError(_0x405a96,null));};exports[_0xc730('0x42')]=function(_0x45cdc8,_0x38e3c6){var _0x4769fe={'raw':!![],'where':{'id':_0x45cdc8[_0xc730('0x43')]['id']}},_0x5c02c8={};_0x5c02c8['model']=_['keys'](db[_0xc730('0x3b')][_0xc730('0x27')]);_0x5c02c8[_0xc730('0x2c')]=_[_0xc730('0x44')](_0x45cdc8[_0xc730('0x2c')]);_0x5c02c8[_0xc730('0x2d')]=_[_0xc730('0x2e')](_0x5c02c8[_0xc730('0x2b')],_0x5c02c8[_0xc730('0x2c')]);_0x4769fe[_0xc730('0x2f')]=_[_0xc730('0x2e')](_0x5c02c8[_0xc730('0x2b')],qs[_0xc730('0x30')](_0x45cdc8[_0xc730('0x2c')]['fields']));_0x4769fe[_0xc730('0x2f')]=_0x4769fe[_0xc730('0x2f')][_0xc730('0x31')]?_0x4769fe[_0xc730('0x2f')]:_0x5c02c8['model'];if(_0x45cdc8[_0xc730('0x2c')][_0xc730('0x3d')]){_0x4769fe['include']=[{'all':!![]}];}_0x4769fe=_[_0xc730('0x39')]({},_0x4769fe,_0x45cdc8[_0xc730('0x3a')]);return db[_0xc730('0x3b')][_0xc730('0x45')](_0x4769fe)['then'](handleEntityNotFound(_0x38e3c6,null))[_0xc730('0x20')](respondWithResult(_0x38e3c6,null))[_0xc730('0x41')](handleError(_0x38e3c6,null));};exports['create']=function(_0xe7f2b0,_0x2b89b1){return db['SquareDetailsReport'][_0xc730('0x46')](_0xe7f2b0['body'],{})[_0xc730('0x20')](respondWithResult(_0x2b89b1,0xc9))[_0xc730('0x41')](handleError(_0x2b89b1,null));};exports[_0xc730('0x1f')]=function(_0x3921e5,_0x6501ab){if(_0x3921e5['body']['id']){delete _0x3921e5[_0xc730('0x47')]['id'];}return db[_0xc730('0x3b')]['find']({'where':{'id':_0x3921e5[_0xc730('0x43')]['id']}})['then'](handleEntityNotFound(_0x6501ab,null))[_0xc730('0x20')](saveUpdates(_0x3921e5[_0xc730('0x47')],null))[_0xc730('0x20')](respondWithResult(_0x6501ab,null))[_0xc730('0x41')](handleError(_0x6501ab,null));};exports['destroy']=function(_0x95cefb,_0x1ae2c7){return db[_0xc730('0x3b')][_0xc730('0x45')]({'where':{'id':_0x95cefb[_0xc730('0x43')]['id']}})[_0xc730('0x20')](handleEntityNotFound(_0x1ae2c7,null))[_0xc730('0x20')](removeEntity(_0x1ae2c7,null))[_0xc730('0x41')](handleError(_0x1ae2c7,null));};exports[_0xc730('0x48')]=function(_0xaabdd5,_0x59135f){return db['SquareDetailsReport']['describe']()[_0xc730('0x20')](respondWithResult(_0x59135f,null))[_0xc730('0x41')](handleError(_0x59135f,null));}; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.model.js b/server/api/squareReportDetail/squareReportDetail.model.js index f89f80c..d811a37 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 _0xe61e=['../../config/logger','bluebird','request-promise','path','rimraf','./squareReportDetail.attributes','define','util'];(function(_0x1589dd,_0x2b9d22){var _0x1bddd1=function(_0x3687f8){while(--_0x3687f8){_0x1589dd['push'](_0x1589dd['shift']());}};_0x1bddd1(++_0x2b9d22);}(_0xe61e,0x147));var _0xee61=function(_0x11eb1f,_0x826f0b){_0x11eb1f=_0x11eb1f-0x0;var _0x2121e9=_0xe61e[_0x11eb1f];return _0x2121e9;};'use strict';var _=require('lodash');var util=require(_0xee61('0x0'));var logger=require(_0xee61('0x1'))('api');var moment=require('moment');var BPromise=require(_0xee61('0x2'));var rp=require(_0xee61('0x3'));var fs=require('fs');var path=require(_0xee61('0x4'));var rimraf=require(_0xee61('0x5'));var config=require('../../config/environment');var attributes=require(_0xee61('0x6'));module['exports']=function(_0x566b99,_0xc5442b){return _0x566b99[_0xee61('0x7')]('SquareDetailsReport',attributes,{'tableName':'report_square_details','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x85c0=['util','moment','bluebird','request-promise','rimraf','../../config/environment','./squareReportDetail.attributes','exports','define','SquareDetailsReport','report_square_details'];(function(_0x5d02c3,_0xd35ca3){var _0x4c6fbc=function(_0x174eb0){while(--_0x174eb0){_0x5d02c3['push'](_0x5d02c3['shift']());}};_0x4c6fbc(++_0xd35ca3);}(_0x85c0,0x1ef));var _0x085c=function(_0x224b6a,_0x31e5a0){_0x224b6a=_0x224b6a-0x0;var _0x48f0eb=_0x85c0[_0x224b6a];return _0x48f0eb;};'use strict';var _=require('lodash');var util=require(_0x085c('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0x085c('0x1'));var BPromise=require(_0x085c('0x2'));var rp=require(_0x085c('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x085c('0x4'));var config=require(_0x085c('0x5'));var attributes=require(_0x085c('0x6'));module[_0x085c('0x7')]=function(_0x3a93eb,_0x135959){return _0x3a93eb[_0x085c('0x8')](_0x085c('0x9'),attributes,{'tableName':_0x085c('0xa'),'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 93f37f9..3c67cc7 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 _0xe683=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','client','request','then','info','SquareDetailsReport,\x20%s,\x20%s','SquareDetailsReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','CreateSquareDetailsReport','SquareDetailsReport','options','raw','debug','moment'];(function(_0x5765bb,_0x45998c){var _0x452a60=function(_0x23d107){while(--_0x23d107){_0x5765bb['push'](_0x5765bb['shift']());}};_0x452a60(++_0x45998c);}(_0xe683,0x197));var _0x3e68=function(_0x5cd28c,_0x531cd9){_0x5cd28c=_0x5cd28c-0x0;var _0x4fa44b=_0xe683[_0x5cd28c];return _0x4fa44b;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x3e68('0x0'));var BPromise=require(_0x3e68('0x1'));var rs=require(_0x3e68('0x2'));var fs=require('fs');var Redis=require(_0x3e68('0x3'));var db=require(_0x3e68('0x4'))['db'];var utils=require(_0x3e68('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0x3e68('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x3e68('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x385bba,_0x5068c8,_0x39139f){return new BPromise(function(_0x429cbc,_0x5d6800){return client[_0x3e68('0x8')](_0x385bba,_0x39139f)[_0x3e68('0x9')](function(_0x205130){logger[_0x3e68('0xa')](_0x3e68('0xb'),_0x5068c8,'request\x20sent');logger['debug'](_0x3e68('0xc'),_0x5068c8,_0x3e68('0xd'),JSON[_0x3e68('0xe')](_0x205130));if(_0x205130[_0x3e68('0xf')]){if(_0x205130[_0x3e68('0xf')][_0x3e68('0x10')]===0x1f4){logger[_0x3e68('0xf')](_0x3e68('0xb'),_0x5068c8,_0x205130[_0x3e68('0xf')]['message']);return _0x5d6800(_0x205130['error'][_0x3e68('0x11')]);}logger['error'](_0x3e68('0xb'),_0x5068c8,_0x205130[_0x3e68('0xf')]['message']);return _0x429cbc(_0x205130['error'][_0x3e68('0x11')]);}else{logger['info'](_0x3e68('0xb'),_0x5068c8,'request\x20sent');_0x429cbc(_0x205130['result'][_0x3e68('0x11')]);}})[_0x3e68('0x12')](function(_0x84aa6b){logger[_0x3e68('0xf')]('SquareDetailsReport,\x20%s,\x20%s',_0x5068c8,_0x84aa6b);_0x5d6800(_0x84aa6b);});});}exports[_0x3e68('0x13')]=function(_0x37ba8d){var _0x98e907=this;return new Promise(function(_0x4e5d1d,_0x1da8f0){return db[_0x3e68('0x14')]['create'](_0x37ba8d['body'],{'raw':_0x37ba8d[_0x3e68('0x15')]?_0x37ba8d['options'][_0x3e68('0x16')]===undefined?!![]:![]:!![]})[_0x3e68('0x9')](function(_0x22af23){logger['info'](_0x3e68('0x13'),_0x37ba8d);logger[_0x3e68('0x17')](_0x3e68('0x13'),_0x37ba8d,JSON[_0x3e68('0xe')](_0x22af23));_0x4e5d1d(_0x22af23);})[_0x3e68('0x12')](function(_0x13251b){logger[_0x3e68('0xf')](_0x3e68('0x13'),_0x13251b[_0x3e68('0x11')],_0x37ba8d);_0x1da8f0(_0x98e907[_0x3e68('0xf')](0x1f4,_0x13251b[_0x3e68('0x11')]));});});}; \ No newline at end of file +var _0x3e09=['debug','stringify','error','code','message','request\x20sent','catch','CreateSquareDetailsReport','SquareDetailsReport','create','body','options','raw','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','SquareDetailsReport,\x20%s,\x20%s'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x3e09,0xd1));var _0x93e0=function(_0xadc7d9,_0x203608){_0xadc7d9=_0xadc7d9-0x0;var _0x915ca1=_0x3e09[_0xadc7d9];return _0x915ca1;};'use strict';var _=require(_0x93e0('0x0'));var util=require(_0x93e0('0x1'));var moment=require(_0x93e0('0x2'));var BPromise=require(_0x93e0('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x93e0('0x4'));var db=require(_0x93e0('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x93e0('0x6'))(_0x93e0('0x7'));var config=require(_0x93e0('0x8'));var jayson=require(_0x93e0('0x9'));var client=jayson['client'][_0x93e0('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1972a0,_0x15a8be,_0x1778e5){return new BPromise(function(_0x5b87f2,_0xaafe4f){return client[_0x93e0('0xb')](_0x1972a0,_0x1778e5)[_0x93e0('0xc')](function(_0x38199){logger[_0x93e0('0xd')](_0x93e0('0xe'),_0x15a8be,'request\x20sent');logger[_0x93e0('0xf')]('SquareDetailsReport,\x20%s,\x20%s,\x20%s',_0x15a8be,'request\x20sent',JSON[_0x93e0('0x10')](_0x38199));if(_0x38199[_0x93e0('0x11')]){if(_0x38199['error'][_0x93e0('0x12')]===0x1f4){logger[_0x93e0('0x11')]('SquareDetailsReport,\x20%s,\x20%s',_0x15a8be,_0x38199[_0x93e0('0x11')][_0x93e0('0x13')]);return _0xaafe4f(_0x38199[_0x93e0('0x11')][_0x93e0('0x13')]);}logger['error'](_0x93e0('0xe'),_0x15a8be,_0x38199['error']['message']);return _0x5b87f2(_0x38199[_0x93e0('0x11')][_0x93e0('0x13')]);}else{logger[_0x93e0('0xd')]('SquareDetailsReport,\x20%s,\x20%s',_0x15a8be,_0x93e0('0x14'));_0x5b87f2(_0x38199['result'][_0x93e0('0x13')]);}})[_0x93e0('0x15')](function(_0x5b2b78){logger[_0x93e0('0x11')]('SquareDetailsReport,\x20%s,\x20%s',_0x15a8be,_0x5b2b78);_0xaafe4f(_0x5b2b78);});});}exports[_0x93e0('0x16')]=function(_0x2ece2b){var _0x4eba3b=this;return new Promise(function(_0x3ba7c1,_0x17251c){return db[_0x93e0('0x17')][_0x93e0('0x18')](_0x2ece2b[_0x93e0('0x19')],{'raw':_0x2ece2b['options']?_0x2ece2b[_0x93e0('0x1a')][_0x93e0('0x1b')]===undefined?!![]:![]:!![]})[_0x93e0('0xc')](function(_0x443a8f){logger[_0x93e0('0xd')](_0x93e0('0x16'),_0x2ece2b);logger[_0x93e0('0xf')](_0x93e0('0x16'),_0x2ece2b,JSON[_0x93e0('0x10')](_0x443a8f));_0x3ba7c1(_0x443a8f);})[_0x93e0('0x15')](function(_0x1f9366){logger[_0x93e0('0x11')]('CreateSquareDetailsReport',_0x1f9366[_0x93e0('0x13')],_0x2ece2b);_0x17251c(_0x4eba3b[_0x93e0('0x11')](0x1f4,_0x1f9366[_0x93e0('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/system/index.js b/server/api/system/index.js index 7617ae5..84e5ac6 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 _0xd674=['isAuthenticated','index','/process/:pid/kill','killProcess','exports','express','Router','../../components/auth/service','./system.controller','get'];(function(_0x5cfe47,_0x3c4fa4){var _0x4754ad=function(_0x36c7f9){while(--_0x36c7f9){_0x5cfe47['push'](_0x5cfe47['shift']());}};_0x4754ad(++_0x3c4fa4);}(_0xd674,0xb9));var _0x4d67=function(_0x74fe0c,_0x347733){_0x74fe0c=_0x74fe0c-0x0;var _0x3914be=_0xd674[_0x74fe0c];return _0x3914be;};'use strict';var express=require(_0x4d67('0x0'));var router=express[_0x4d67('0x1')]();var auth=require(_0x4d67('0x2'));var controller=require(_0x4d67('0x3'));router[_0x4d67('0x4')]('/',auth[_0x4d67('0x5')](),controller[_0x4d67('0x6')]);router[_0x4d67('0x4')](_0x4d67('0x7'),auth[_0x4d67('0x5')](),controller[_0x4d67('0x8')]);module[_0x4d67('0x9')]=router; \ No newline at end of file +var _0x1198=['get','/process/:pid/kill','killProcess','exports','express','../../components/auth/service','./system.controller','isAuthenticated','index'];(function(_0x35485a,_0x91cdd4){var _0x5148e6=function(_0x27ed1d){while(--_0x27ed1d){_0x35485a['push'](_0x35485a['shift']());}};_0x5148e6(++_0x91cdd4);}(_0x1198,0x1b4));var _0x8119=function(_0x35f1f4,_0x494820){_0x35f1f4=_0x35f1f4-0x0;var _0x1af82a=_0x1198[_0x35f1f4];return _0x1af82a;};'use strict';var express=require(_0x8119('0x0'));var router=express['Router']();var auth=require(_0x8119('0x1'));var controller=require(_0x8119('0x2'));router['get']('/',auth[_0x8119('0x3')](),controller[_0x8119('0x4')]);router[_0x8119('0x5')](_0x8119('0x6'),auth['isAuthenticated'](),controller[_0x8119('0x7')]);module[_0x8119('0x8')]=router; \ No newline at end of file diff --git a/server/api/system/system.controller.js b/server/api/system/system.controller.js index 61039c3..c69fa71 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 _0x4362=['format','Process\x20with\x20pid\x20%s\x20killed\x20correctly','pid','catch','killProcess','systeminformation','child_process','exec','../../config/logger','api','lodash','<%-\x20name\x20%>,\x20%s,\x20%s,\x20%s','inspect','name','status','index','getAllData','json','components/import/cm','ps\x20-p\x20%s\x20-ww\x20-o\x20args','then','split','indexOf','Process\x20with\x20pid\x20%s\x20not\x20found!','params','kill','SIGINT'];(function(_0x623e7,_0x1bef7d){var _0x121131=function(_0x59b734){while(--_0x59b734){_0x623e7['push'](_0x623e7['shift']());}};_0x121131(++_0x1bef7d);}(_0x4362,0xdd));var _0x2436=function(_0x144953,_0x2fe553){_0x144953=_0x144953-0x0;var _0x38d94b=_0x4362[_0x144953];return _0x38d94b;};'use strict';var info=require(_0x2436('0x0'));var exec=require(_0x2436('0x1'))[_0x2436('0x2')];var logger=require(_0x2436('0x3'))(_0x2436('0x4'));var util=require('util');var BPromise=require('bluebird');var _=require(_0x2436('0x5'));function handleError(_0x30784d,_0x1103f4,_0x7aedec){_0x1103f4=_0x1103f4||0x1f4;return function(_0x56591d){logger['error'](_0x2436('0x6'),_0x7aedec,_0x1103f4,util[_0x2436('0x7')](_0x56591d,{'showHidden':![],'depth':null}));delete _0x56591d[_0x2436('0x8')];_0x30784d[_0x2436('0x9')](_0x1103f4)['send'](_0x56591d);};}exports[_0x2436('0xa')]=function(_0x40c0fb,_0x50ee51){return info[_0x2436('0xb')]()['then'](function(_0x75ea72){return _0x50ee51[_0x2436('0x9')](0xc8)['json'](_0x75ea72);})['catch'](function(_0x1652ff){return _0x50ee51[_0x2436('0x9')](0x1f4)[_0x2436('0xc')](_0x1652ff);});};exports['killProcess']=function(_0x53f0d0,_0x2c3921){var _0xc10f28=[_0x2436('0xd')];return new BPromise(function(_0x268221,_0x71cada){return exec(util['format'](_0x2436('0xe'),_0x53f0d0['params']['pid']),function(_0x5c7296,_0x75bbdb,_0x35d36c){if(_0x5c7296){return _0x71cada(_0x5c7296);}return _0x268221(_0x75bbdb);});})[_0x2436('0xf')](function(_0x5115d5){var _0x25a5d3=![];var _0x2aae63=_0x5115d5[_0x2436('0x10')](/\n/);for(var _0x1362cb=0x0,_0x32d607=_0xc10f28['length'];_0x1362cb<_0x32d607,_0x25a5d3===![];_0x1362cb+=0x1){if(_0x5115d5[_0x2436('0x11')](_0xc10f28[_0x1362cb])>=0x0){_0x25a5d3=!![];}}if(!_0x25a5d3){throw new Error(util['format'](_0x2436('0x12'),_0x53f0d0[_0x2436('0x13')]['pid']));}process[_0x2436('0x14')](_0x53f0d0[_0x2436('0x13')]['pid'],_0x2436('0x15'));return _0x2c3921[_0x2436('0x9')](0xc8)[_0x2436('0xc')]({'message':util[_0x2436('0x16')](_0x2436('0x17'),_0x53f0d0[_0x2436('0x13')][_0x2436('0x18')])});})[_0x2436('0x19')](handleError(_0x2c3921,null,_0x2436('0x1a')));}; \ No newline at end of file +var _0xb101=['lodash','error','inspect','name','status','send','index','then','json','catch','killProcess','format','ps\x20-p\x20%s\x20-ww\x20-o\x20args','pid','length','indexOf','Process\x20with\x20pid\x20%s\x20not\x20found!','kill','params','SIGINT','Process\x20with\x20pid\x20%s\x20killed\x20correctly','exec','api','bluebird'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xb101,0x75));var _0x1b10=function(_0x542afe,_0x3099a3){_0x542afe=_0x542afe-0x0;var _0x35826c=_0xb101[_0x542afe];return _0x35826c;};'use strict';var info=require('systeminformation');var exec=require('child_process')[_0x1b10('0x0')];var logger=require('../../config/logger')(_0x1b10('0x1'));var util=require('util');var BPromise=require(_0x1b10('0x2'));var _=require(_0x1b10('0x3'));function handleError(_0x33c0d4,_0x417a43,_0x481a06){_0x417a43=_0x417a43||0x1f4;return function(_0x59864b){logger[_0x1b10('0x4')]('<%-\x20name\x20%>,\x20%s,\x20%s,\x20%s',_0x481a06,_0x417a43,util[_0x1b10('0x5')](_0x59864b,{'showHidden':![],'depth':null}));delete _0x59864b[_0x1b10('0x6')];_0x33c0d4[_0x1b10('0x7')](_0x417a43)[_0x1b10('0x8')](_0x59864b);};}exports[_0x1b10('0x9')]=function(_0x38268b,_0x352056){return info['getAllData']()[_0x1b10('0xa')](function(_0x97dd68){return _0x352056['status'](0xc8)[_0x1b10('0xb')](_0x97dd68);})[_0x1b10('0xc')](function(_0x5c7188){return _0x352056['status'](0x1f4)[_0x1b10('0xb')](_0x5c7188);});};exports[_0x1b10('0xd')]=function(_0x52d151,_0xfe3f64){var _0x3a1c69=['components/import/cm'];return new BPromise(function(_0x5348e9,_0x305432){return exec(util[_0x1b10('0xe')](_0x1b10('0xf'),_0x52d151['params'][_0x1b10('0x10')]),function(_0x57c803,_0x2c23f6,_0x1a7f0e){if(_0x57c803){return _0x305432(_0x57c803);}return _0x5348e9(_0x2c23f6);});})[_0x1b10('0xa')](function(_0x2478c5){var _0x2067d0=![];var _0x2d1066=_0x2478c5['split'](/\n/);for(var _0x57fdad=0x0,_0x527155=_0x3a1c69[_0x1b10('0x11')];_0x57fdad<_0x527155,_0x2067d0===![];_0x57fdad+=0x1){if(_0x2478c5[_0x1b10('0x12')](_0x3a1c69[_0x57fdad])>=0x0){_0x2067d0=!![];}}if(!_0x2067d0){throw new Error(util[_0x1b10('0xe')](_0x1b10('0x13'),_0x52d151['params']['pid']));}process[_0x1b10('0x14')](_0x52d151[_0x1b10('0x15')][_0x1b10('0x10')],_0x1b10('0x16'));return _0xfe3f64[_0x1b10('0x7')](0xc8)[_0x1b10('0xb')]({'message':util['format'](_0x1b10('0x17'),_0x52d151[_0x1b10('0x15')][_0x1b10('0x10')])});})[_0x1b10('0xc')](handleError(_0xfe3f64,null,_0x1b10('0xd')));}; \ No newline at end of file diff --git a/server/api/tag/index.js b/server/api/tag/index.js index 49715cf..d04abaf 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 _0x4bc3=['connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./tag.controller','get','isAuthenticated','index','/:id','post','create','put','destroy','multer','util'];(function(_0x1cc805,_0x19e913){var _0x3e5a41=function(_0x480760){while(--_0x480760){_0x1cc805['push'](_0x1cc805['shift']());}};_0x3e5a41(++_0x19e913);}(_0x4bc3,0x16e));var _0x34bc=function(_0x381589,_0x27a707){_0x381589=_0x381589-0x0;var _0x2a075d=_0x4bc3[_0x381589];return _0x2a075d;};'use strict';var multer=require(_0x34bc('0x0'));var util=require(_0x34bc('0x1'));var path=require('path');var timeout=require(_0x34bc('0x2'));var express=require(_0x34bc('0x3'));var router=express['Router']();var auth=require(_0x34bc('0x4'));var interaction=require(_0x34bc('0x5'));var config=require(_0x34bc('0x6'));var controller=require(_0x34bc('0x7'));router[_0x34bc('0x8')]('/',auth[_0x34bc('0x9')](),controller[_0x34bc('0xa')]);router['get'](_0x34bc('0xb'),auth['isAuthenticated'](),controller['show']);router[_0x34bc('0xc')]('/',auth[_0x34bc('0x9')](),controller[_0x34bc('0xd')]);router[_0x34bc('0xe')](_0x34bc('0xb'),auth[_0x34bc('0x9')](),controller['update']);router['delete'](_0x34bc('0xb'),auth[_0x34bc('0x9')](),controller[_0x34bc('0xf')]);module['exports']=router; \ No newline at end of file +var _0x6f7a=['path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./tag.controller','get','isAuthenticated','index','/:id','create','put','exports','multer','util'];(function(_0x517ab6,_0x5a58a8){var _0x36615a=function(_0x56eb68){while(--_0x56eb68){_0x517ab6['push'](_0x517ab6['shift']());}};_0x36615a(++_0x5a58a8);}(_0x6f7a,0x1ae));var _0xa6f7=function(_0x2cc249,_0x586979){_0x2cc249=_0x2cc249-0x0;var _0x516c7f=_0x6f7a[_0x2cc249];return _0x516c7f;};'use strict';var multer=require(_0xa6f7('0x0'));var util=require(_0xa6f7('0x1'));var path=require(_0xa6f7('0x2'));var timeout=require(_0xa6f7('0x3'));var express=require('express');var router=express[_0xa6f7('0x4')]();var auth=require(_0xa6f7('0x5'));var interaction=require(_0xa6f7('0x6'));var config=require(_0xa6f7('0x7'));var controller=require(_0xa6f7('0x8'));router[_0xa6f7('0x9')]('/',auth[_0xa6f7('0xa')](),controller[_0xa6f7('0xb')]);router[_0xa6f7('0x9')](_0xa6f7('0xc'),auth[_0xa6f7('0xa')](),controller['show']);router['post']('/',auth[_0xa6f7('0xa')](),controller[_0xa6f7('0xd')]);router[_0xa6f7('0xe')](_0xa6f7('0xc'),auth[_0xa6f7('0xa')](),controller['update']);router['delete'](_0xa6f7('0xc'),auth[_0xa6f7('0xa')](),controller['destroy']);module[_0xa6f7('0xf')]=router; \ No newline at end of file diff --git a/server/api/tag/tag.attributes.js b/server/api/tag/tag.attributes.js index 2ecf2ca..abcc0f8 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 _0xbaf0=['name','#0091EA','exports','STRING'];(function(_0x54a73a,_0x5ee77e){var _0x3cf1b8=function(_0xa098fd){while(--_0xa098fd){_0x54a73a['push'](_0x54a73a['shift']());}};_0x3cf1b8(++_0x5ee77e);}(_0xbaf0,0x12a));var _0x0baf=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0xbaf0[_0x5ddb1c];return _0x354adc;};'use strict';var Sequelize=require('sequelize');module[_0x0baf('0x0')]={'name':{'type':Sequelize[_0x0baf('0x1')],'unique':_0x0baf('0x2'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'color':{'type':Sequelize[_0x0baf('0x1')],'defaultValue':_0x0baf('0x3')},'description':{'type':Sequelize[_0x0baf('0x1')]}}; \ No newline at end of file +var _0x087b=['sequelize','exports','STRING'];(function(_0x4da66d,_0x56aead){var _0x32e516=function(_0x29230d){while(--_0x29230d){_0x4da66d['push'](_0x4da66d['shift']());}};_0x32e516(++_0x56aead);}(_0x087b,0x11a));var _0xb087=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0x087b[_0x57b54c];return _0x59cc19;};'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 diff --git a/server/api/tag/tag.controller.js b/server/api/tag/tag.controller.js index a0aad21..d22f315 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 _0xc69b=['rawAttributes','type','key','model','query','keys','filters','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filter','VIRTUAL','merge','include','findAll','rows','catch','show','params','intersection','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','error','destroy','eml-format','zip-dir','fast-json-patch','request-promise','moment','path','sox','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../mysqldb','sendStatus','status','end','json','count','offset','limit','apply','save','update','then','get','Tags','UserProfileResource','stack','name','send','index','Tag'];(function(_0x57c8a9,_0x4160bb){var _0x4c5d8a=function(_0x13ae56){while(--_0x13ae56){_0x57c8a9['push'](_0x57c8a9['shift']());}};_0x4c5d8a(++_0x4160bb);}(_0xc69b,0x6c));var _0xbc69=function(_0xf55e73,_0x3fecc5){_0xf55e73=_0xf55e73-0x0;var _0x116b99=_0xc69b[_0xf55e73];return _0x116b99;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xbc69('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xbc69('0x1'));var jsonpatch=require(_0xbc69('0x2'));var rp=require(_0xbc69('0x3'));var moment=require(_0xbc69('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0xbc69('0x5'));var sox=require(_0xbc69('0x6'));var csv=require(_0xbc69('0x7'));var ejs=require(_0xbc69('0x8'));var fs=require('fs');var _=require(_0xbc69('0x9'));var squel=require(_0xbc69('0xa'));var crypto=require(_0xbc69('0xb'));var jsforce=require('jsforce');var deskjs=require(_0xbc69('0xc'));var toCsv=require(_0xbc69('0x7'));var querystring=require(_0xbc69('0xd'));var Papa=require(_0xbc69('0xe'));var Redis=require(_0xbc69('0xf'));var authService=require('../../components/auth/service');var qs=require(_0xbc69('0x10'));var as=require(_0xbc69('0x11'));var hardwareService=require(_0xbc69('0x12'));var logger=require('../../config/logger')(_0xbc69('0x13'));var utils=require('../../config/utils');var config=require('../../config/environment');var db=require(_0xbc69('0x14'))['db'];function respondWithStatusCode(_0x4263cb,_0x2dc25c){_0x2dc25c=_0x2dc25c||0xcc;return function(_0x4993da){if(_0x4993da){return _0x4263cb[_0xbc69('0x15')](_0x2dc25c);}return _0x4263cb[_0xbc69('0x16')](_0x2dc25c)[_0xbc69('0x17')]();};}function respondWithResult(_0x25e3d9,_0x333537){_0x333537=_0x333537||0xc8;return function(_0x4e61a1){if(_0x4e61a1){return _0x25e3d9[_0xbc69('0x16')](_0x333537)[_0xbc69('0x18')](_0x4e61a1);}};}function respondWithFilteredResult(_0x5e5a2a,_0x2a6b4f){return function(_0x336252){if(_0x336252){var _0x18024c=_0x336252[_0xbc69('0x19')],_0x408d18=_0x2a6b4f[_0xbc69('0x1a')],_0x15b71f=_0x2a6b4f['offset']+_0x2a6b4f[_0xbc69('0x1b')],_0x4ef388;if(_0x15b71f>=_0x18024c){_0x15b71f=_0x18024c;_0x4ef388=0xc8;}else{_0x4ef388=0xce;}_0x5e5a2a[_0xbc69('0x16')](_0x4ef388);return _0x5e5a2a['set']('Content-Range',_0x408d18+'-'+_0x15b71f+'/'+_0x18024c)[_0xbc69('0x18')](_0x336252);}return null;};}function patchUpdates(_0xf203fd){return function(_0x26eeca){try{jsonpatch[_0xbc69('0x1c')](_0x26eeca,_0xf203fd,!![]);}catch(_0x39c9bb){return BPromise['reject'](_0x39c9bb);}return _0x26eeca[_0xbc69('0x1d')]();};}function saveUpdates(_0x56acb2,_0x59e1be){return function(_0x48043a){if(_0x48043a){return _0x48043a[_0xbc69('0x1e')](_0x56acb2)[_0xbc69('0x1f')](function(_0x2b6a1e){return _0x2b6a1e;});}return null;};}function removeEntity(_0x5cbd53,_0x27051d){return function(_0xf1834){if(_0xf1834){return _0xf1834['destroy']()['then'](function(){var _0x4df5e7=_0xf1834[_0xbc69('0x20')]({'plain':!![]});var _0x3aa3f7=_0xbc69('0x21');return db[_0xbc69('0x22')]['destroy']({'where':{'type':_0x3aa3f7,'resourceId':_0x4df5e7['id']}})[_0xbc69('0x1f')](function(){return _0xf1834;});})[_0xbc69('0x1f')](function(){_0x5cbd53[_0xbc69('0x16')](0xcc)[_0xbc69('0x17')]();});}};}function handleEntityNotFound(_0x344a52,_0x1b2aa1){return function(_0x365b97){if(!_0x365b97){_0x344a52['sendStatus'](0x194);}return _0x365b97;};}function handleError(_0x45cfa2,_0x2c682b){_0x2c682b=_0x2c682b||0x1f4;return function(_0x996d8){logger['error'](_0x996d8[_0xbc69('0x23')]);if(_0x996d8[_0xbc69('0x24')]){delete _0x996d8[_0xbc69('0x24')];}_0x45cfa2[_0xbc69('0x16')](_0x2c682b)[_0xbc69('0x25')](_0x996d8);};}exports[_0xbc69('0x26')]=function(_0x15e70d,_0x184a33){var _0x4412f8={},_0x11b0f0={},_0x3f9d85={'count':0x0,'rows':[]};var _0x33daea=_['map'](db[_0xbc69('0x27')][_0xbc69('0x28')],function(_0x1e9824){return{'name':_0x1e9824['fieldName'],'type':_0x1e9824[_0xbc69('0x29')][_0xbc69('0x2a')]};});_0x11b0f0[_0xbc69('0x2b')]=_['map'](_0x33daea,'name');_0x11b0f0[_0xbc69('0x2c')]=_[_0xbc69('0x2d')](_0x15e70d['query']);_0x11b0f0[_0xbc69('0x2e')]=_['intersection'](_0x11b0f0['model'],_0x11b0f0[_0xbc69('0x2c')]);_0x4412f8[_0xbc69('0x2f')]=_['intersection'](_0x11b0f0[_0xbc69('0x2b')],qs[_0xbc69('0x30')](_0x15e70d[_0xbc69('0x2c')]['fields']));_0x4412f8[_0xbc69('0x2f')]=_0x4412f8['attributes'][_0xbc69('0x31')]?_0x4412f8[_0xbc69('0x2f')]:_0x11b0f0[_0xbc69('0x2b')];if(!_0x15e70d[_0xbc69('0x2c')][_0xbc69('0x32')](_0xbc69('0x33'))){_0x4412f8[_0xbc69('0x1b')]=qs['limit'](_0x15e70d['query'][_0xbc69('0x1b')]);_0x4412f8['offset']=qs['offset'](_0x15e70d['query'][_0xbc69('0x1a')]);}_0x4412f8['order']=qs[_0xbc69('0x34')](_0x15e70d['query'][_0xbc69('0x34')]);_0x4412f8[_0xbc69('0x35')]=qs[_0xbc69('0x2e')](_['pick'](_0x15e70d[_0xbc69('0x2c')],_0x11b0f0[_0xbc69('0x2e')]),_0x33daea);if(_0x15e70d[_0xbc69('0x2c')][_0xbc69('0x36')]){_0x4412f8['where']=_['merge'](_0x4412f8[_0xbc69('0x35')],{'$or':_['map'](_0x33daea,function(_0x374af1){if(_0x374af1[_0xbc69('0x29')]!==_0xbc69('0x37')){var _0x1d8bf7={};_0x1d8bf7[_0x374af1['name']]={'$like':'%'+_0x15e70d['query']['filter']+'%'};return _0x1d8bf7;}})});}_0x4412f8=_[_0xbc69('0x38')]({},_0x4412f8,_0x15e70d['options']);var _0x55fa8a={'where':_0x4412f8[_0xbc69('0x35')]};return db[_0xbc69('0x27')]['count'](_0x55fa8a)[_0xbc69('0x1f')](function(_0xb91fcd){_0x3f9d85[_0xbc69('0x19')]=_0xb91fcd;if(_0x15e70d[_0xbc69('0x2c')]['includeAll']){_0x4412f8[_0xbc69('0x39')]=[{'all':!![]}];}return db['Tag'][_0xbc69('0x3a')](_0x4412f8);})[_0xbc69('0x1f')](function(_0x22509d){_0x3f9d85[_0xbc69('0x3b')]=_0x22509d;return _0x3f9d85;})[_0xbc69('0x1f')](respondWithFilteredResult(_0x184a33,_0x4412f8))[_0xbc69('0x3c')](handleError(_0x184a33,null));};exports[_0xbc69('0x3d')]=function(_0x68f38b,_0x10b469){var _0x37d81f={'raw':!![],'where':{'id':_0x68f38b[_0xbc69('0x3e')]['id']}},_0x226a51={};_0x226a51['model']=_['keys'](db['Tag'][_0xbc69('0x28')]);_0x226a51[_0xbc69('0x2c')]=_[_0xbc69('0x2d')](_0x68f38b[_0xbc69('0x2c')]);_0x226a51['filters']=_[_0xbc69('0x3f')](_0x226a51[_0xbc69('0x2b')],_0x226a51[_0xbc69('0x2c')]);_0x37d81f[_0xbc69('0x2f')]=_[_0xbc69('0x3f')](_0x226a51[_0xbc69('0x2b')],qs[_0xbc69('0x30')](_0x68f38b['query'][_0xbc69('0x30')]));_0x37d81f[_0xbc69('0x2f')]=_0x37d81f['attributes']['length']?_0x37d81f[_0xbc69('0x2f')]:_0x226a51[_0xbc69('0x2b')];if(_0x68f38b[_0xbc69('0x2c')]['includeAll']){_0x37d81f[_0xbc69('0x39')]=[{'all':!![]}];}_0x37d81f=_['merge']({},_0x37d81f,_0x68f38b['options']);return db['Tag'][_0xbc69('0x40')](_0x37d81f)['then'](handleEntityNotFound(_0x10b469,null))[_0xbc69('0x1f')](respondWithResult(_0x10b469,null))[_0xbc69('0x3c')](handleError(_0x10b469,null));};exports[_0xbc69('0x41')]=function(_0x44ce99,_0x895b78){return db[_0xbc69('0x27')]['create'](_0x44ce99[_0xbc69('0x42')],{})['then'](function(_0x25f442){var _0x472cc2=_0x44ce99[_0xbc69('0x43')][_0xbc69('0x20')]({'plain':!![]});if(!_0x472cc2)throw new Error(_0xbc69('0x44'));if(_0x472cc2[_0xbc69('0x45')]==='user'){var _0x4371b0=_0x25f442[_0xbc69('0x20')]({'plain':!![]});var _0x178e1a='Tags';return db[_0xbc69('0x46')]['find']({'where':{'name':_0x178e1a,'userProfileId':_0x472cc2[_0xbc69('0x47')]},'raw':!![]})['then'](function(_0x1bb6ab){if(_0x1bb6ab&&_0x1bb6ab['autoAssociation']===0x0){return db[_0xbc69('0x22')][_0xbc69('0x41')]({'name':_0x4371b0['name'],'resourceId':_0x4371b0['id'],'type':_0x1bb6ab[_0xbc69('0x24')],'sectionId':_0x1bb6ab['id']},{})[_0xbc69('0x1f')](function(){return _0x25f442;});}else{return _0x25f442;}})[_0xbc69('0x3c')](function(_0x3874fa){logger[_0xbc69('0x48')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x3874fa);throw _0x3874fa;});}return _0x25f442;})[_0xbc69('0x1f')](respondWithResult(_0x895b78,0xc9))[_0xbc69('0x3c')](handleError(_0x895b78,null));};exports[_0xbc69('0x1e')]=function(_0x1bf12d,_0x51c83e){if(_0x1bf12d[_0xbc69('0x42')]['id']){delete _0x1bf12d[_0xbc69('0x42')]['id'];}return db['Tag'][_0xbc69('0x40')]({'where':{'id':_0x1bf12d['params']['id']}})[_0xbc69('0x1f')](handleEntityNotFound(_0x51c83e,null))[_0xbc69('0x1f')](saveUpdates(_0x1bf12d[_0xbc69('0x42')],null))[_0xbc69('0x1f')](respondWithResult(_0x51c83e,null))['catch'](handleError(_0x51c83e,null));};exports[_0xbc69('0x49')]=function(_0x641769,_0x2c233a){return db['Tag'][_0xbc69('0x40')]({'where':{'id':_0x641769[_0xbc69('0x3e')]['id']}})['then'](handleEntityNotFound(_0x2c233a,null))['then'](removeEntity(_0x2c233a,null))[_0xbc69('0x3c')](handleError(_0x2c233a,null));}; \ No newline at end of file +var _0x6a03=['length','find','create','body','user','role','get','UserProfileSection','autoAssociation','error','update','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','Content-Range','reject','destroy','then','stack','name','index','map','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','pick','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','params','Tag'];(function(_0x10dfdf,_0x36b623){var _0x4d857d=function(_0x4683ee){while(--_0x4683ee){_0x10dfdf['push'](_0x10dfdf['shift']());}};_0x4d857d(++_0x36b623);}(_0x6a03,0x13f));var _0x36a0=function(_0x4b5bbe,_0x4bb2c4){_0x4b5bbe=_0x4b5bbe-0x0;var _0x1daea2=_0x6a03[_0x4b5bbe];return _0x1daea2;};'use strict';var pdf=require(_0x36a0('0x0'));var emlformat=require(_0x36a0('0x1'));var rimraf=require(_0x36a0('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x36a0('0x3'));var rp=require(_0x36a0('0x4'));var moment=require(_0x36a0('0x5'));var BPromise=require(_0x36a0('0x6'));var Mustache=require('mustache');var util=require(_0x36a0('0x7'));var path=require(_0x36a0('0x8'));var sox=require(_0x36a0('0x9'));var csv=require(_0x36a0('0xa'));var ejs=require(_0x36a0('0xb'));var fs=require('fs');var _=require(_0x36a0('0xc'));var squel=require(_0x36a0('0xd'));var crypto=require(_0x36a0('0xe'));var jsforce=require(_0x36a0('0xf'));var deskjs=require(_0x36a0('0x10'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x36a0('0x11'));var Redis=require(_0x36a0('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x36a0('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x36a0('0x14'));var logger=require(_0x36a0('0x15'))(_0x36a0('0x16'));var utils=require(_0x36a0('0x17'));var config=require(_0x36a0('0x18'));var db=require(_0x36a0('0x19'))['db'];function respondWithStatusCode(_0x3f9dbb,_0x3bce81){_0x3bce81=_0x3bce81||0xcc;return function(_0x214a4a){if(_0x214a4a){return _0x3f9dbb[_0x36a0('0x1a')](_0x3bce81);}return _0x3f9dbb[_0x36a0('0x1b')](_0x3bce81)[_0x36a0('0x1c')]();};}function respondWithResult(_0xaa8e3d,_0x14966f){_0x14966f=_0x14966f||0xc8;return function(_0x1c7120){if(_0x1c7120){return _0xaa8e3d[_0x36a0('0x1b')](_0x14966f)[_0x36a0('0x1d')](_0x1c7120);}};}function respondWithFilteredResult(_0x20dc02,_0x366712){return function(_0x39a38f){if(_0x39a38f){var _0x278021=_0x39a38f[_0x36a0('0x1e')],_0x49ef99=_0x366712[_0x36a0('0x1f')],_0x3387b8=_0x366712['offset']+_0x366712[_0x36a0('0x20')],_0x391115;if(_0x3387b8>=_0x278021){_0x3387b8=_0x278021;_0x391115=0xc8;}else{_0x391115=0xce;}_0x20dc02[_0x36a0('0x1b')](_0x391115);return _0x20dc02[_0x36a0('0x21')](_0x36a0('0x22'),_0x49ef99+'-'+_0x3387b8+'/'+_0x278021)['json'](_0x39a38f);}return null;};}function patchUpdates(_0x11f7a1){return function(_0x36848d){try{jsonpatch['apply'](_0x36848d,_0x11f7a1,!![]);}catch(_0x33bc10){return BPromise[_0x36a0('0x23')](_0x33bc10);}return _0x36848d['save']();};}function saveUpdates(_0x1706d3,_0xb59ff1){return function(_0x1066dd){if(_0x1066dd){return _0x1066dd['update'](_0x1706d3)['then'](function(_0x340a43){return _0x340a43;});}return null;};}function removeEntity(_0x10078e,_0x4f6572){return function(_0x216be8){if(_0x216be8){return _0x216be8[_0x36a0('0x24')]()[_0x36a0('0x25')](function(){var _0x354adc=_0x216be8['get']({'plain':!![]});var _0x33a90b='Tags';return db['UserProfileResource']['destroy']({'where':{'type':_0x33a90b,'resourceId':_0x354adc['id']}})[_0x36a0('0x25')](function(){return _0x216be8;});})[_0x36a0('0x25')](function(){_0x10078e[_0x36a0('0x1b')](0xcc)[_0x36a0('0x1c')]();});}};}function handleEntityNotFound(_0x56e006,_0x46d2fa){return function(_0x2677de){if(!_0x2677de){_0x56e006['sendStatus'](0x194);}return _0x2677de;};}function handleError(_0x425855,_0x37faf8){_0x37faf8=_0x37faf8||0x1f4;return function(_0x305f05){logger['error'](_0x305f05[_0x36a0('0x26')]);if(_0x305f05[_0x36a0('0x27')]){delete _0x305f05[_0x36a0('0x27')];}_0x425855['status'](_0x37faf8)['send'](_0x305f05);};}exports[_0x36a0('0x28')]=function(_0x1f69ee,_0x1880a4){var _0x51b620={},_0x3db514={},_0x5a0135={'count':0x0,'rows':[]};var _0x2af2dc=_[_0x36a0('0x29')](db['Tag']['rawAttributes'],function(_0x4150ab){return{'name':_0x4150ab['fieldName'],'type':_0x4150ab[_0x36a0('0x2a')][_0x36a0('0x2b')]};});_0x3db514[_0x36a0('0x2c')]=_['map'](_0x2af2dc,'name');_0x3db514[_0x36a0('0x2d')]=_[_0x36a0('0x2e')](_0x1f69ee[_0x36a0('0x2d')]);_0x3db514[_0x36a0('0x2f')]=_[_0x36a0('0x30')](_0x3db514[_0x36a0('0x2c')],_0x3db514[_0x36a0('0x2d')]);_0x51b620[_0x36a0('0x31')]=_[_0x36a0('0x30')](_0x3db514[_0x36a0('0x2c')],qs[_0x36a0('0x32')](_0x1f69ee[_0x36a0('0x2d')]['fields']));_0x51b620[_0x36a0('0x31')]=_0x51b620['attributes']['length']?_0x51b620[_0x36a0('0x31')]:_0x3db514[_0x36a0('0x2c')];if(!_0x1f69ee[_0x36a0('0x2d')][_0x36a0('0x33')](_0x36a0('0x34'))){_0x51b620[_0x36a0('0x20')]=qs[_0x36a0('0x20')](_0x1f69ee[_0x36a0('0x2d')][_0x36a0('0x20')]);_0x51b620[_0x36a0('0x1f')]=qs[_0x36a0('0x1f')](_0x1f69ee['query'][_0x36a0('0x1f')]);}_0x51b620['order']=qs['sort'](_0x1f69ee[_0x36a0('0x2d')]['sort']);_0x51b620['where']=qs[_0x36a0('0x2f')](_[_0x36a0('0x35')](_0x1f69ee[_0x36a0('0x2d')],_0x3db514['filters']),_0x2af2dc);if(_0x1f69ee[_0x36a0('0x2d')][_0x36a0('0x36')]){_0x51b620[_0x36a0('0x37')]=_[_0x36a0('0x38')](_0x51b620['where'],{'$or':_[_0x36a0('0x29')](_0x2af2dc,function(_0x1ab7e2){if(_0x1ab7e2[_0x36a0('0x2a')]!==_0x36a0('0x39')){var _0x4bc04a={};_0x4bc04a[_0x1ab7e2[_0x36a0('0x27')]]={'$like':'%'+_0x1f69ee[_0x36a0('0x2d')][_0x36a0('0x36')]+'%'};return _0x4bc04a;}})});}_0x51b620=_[_0x36a0('0x38')]({},_0x51b620,_0x1f69ee[_0x36a0('0x3a')]);var _0x1481d1={'where':_0x51b620[_0x36a0('0x37')]};return db['Tag']['count'](_0x1481d1)['then'](function(_0x97035d){_0x5a0135[_0x36a0('0x1e')]=_0x97035d;if(_0x1f69ee[_0x36a0('0x2d')][_0x36a0('0x3b')]){_0x51b620[_0x36a0('0x3c')]=[{'all':!![]}];}return db['Tag'][_0x36a0('0x3d')](_0x51b620);})[_0x36a0('0x25')](function(_0x5d7d6f){_0x5a0135[_0x36a0('0x3e')]=_0x5d7d6f;return _0x5a0135;})[_0x36a0('0x25')](respondWithFilteredResult(_0x1880a4,_0x51b620))[_0x36a0('0x3f')](handleError(_0x1880a4,null));};exports['show']=function(_0x4c9117,_0x36a8b3){var _0x3dae8d={'raw':!![],'where':{'id':_0x4c9117[_0x36a0('0x40')]['id']}},_0x248377={};_0x248377[_0x36a0('0x2c')]=_[_0x36a0('0x2e')](db[_0x36a0('0x41')]['rawAttributes']);_0x248377['query']=_[_0x36a0('0x2e')](_0x4c9117[_0x36a0('0x2d')]);_0x248377['filters']=_[_0x36a0('0x30')](_0x248377['model'],_0x248377[_0x36a0('0x2d')]);_0x3dae8d['attributes']=_['intersection'](_0x248377['model'],qs[_0x36a0('0x32')](_0x4c9117['query'][_0x36a0('0x32')]));_0x3dae8d[_0x36a0('0x31')]=_0x3dae8d[_0x36a0('0x31')][_0x36a0('0x42')]?_0x3dae8d[_0x36a0('0x31')]:_0x248377[_0x36a0('0x2c')];if(_0x4c9117[_0x36a0('0x2d')][_0x36a0('0x3b')]){_0x3dae8d[_0x36a0('0x3c')]=[{'all':!![]}];}_0x3dae8d=_[_0x36a0('0x38')]({},_0x3dae8d,_0x4c9117[_0x36a0('0x3a')]);return db['Tag'][_0x36a0('0x43')](_0x3dae8d)[_0x36a0('0x25')](handleEntityNotFound(_0x36a8b3,null))[_0x36a0('0x25')](respondWithResult(_0x36a8b3,null))[_0x36a0('0x3f')](handleError(_0x36a8b3,null));};exports[_0x36a0('0x44')]=function(_0x52968a,_0x5e46f6){return db[_0x36a0('0x41')][_0x36a0('0x44')](_0x52968a[_0x36a0('0x45')],{})[_0x36a0('0x25')](function(_0x2bc98b){var _0x255af7=_0x52968a[_0x36a0('0x46')]['get']({'plain':!![]});if(!_0x255af7)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x255af7[_0x36a0('0x47')]===_0x36a0('0x46')){var _0x725964=_0x2bc98b[_0x36a0('0x48')]({'plain':!![]});var _0x5b4834='Tags';return db[_0x36a0('0x49')][_0x36a0('0x43')]({'where':{'name':_0x5b4834,'userProfileId':_0x255af7['userProfileId']},'raw':!![]})[_0x36a0('0x25')](function(_0x367467){if(_0x367467&&_0x367467[_0x36a0('0x4a')]===0x0){return db['UserProfileResource'][_0x36a0('0x44')]({'name':_0x725964[_0x36a0('0x27')],'resourceId':_0x725964['id'],'type':_0x367467[_0x36a0('0x27')],'sectionId':_0x367467['id']},{})[_0x36a0('0x25')](function(){return _0x2bc98b;});}else{return _0x2bc98b;}})[_0x36a0('0x3f')](function(_0x33452b){logger[_0x36a0('0x4b')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x33452b);throw _0x33452b;});}return _0x2bc98b;})['then'](respondWithResult(_0x5e46f6,0xc9))[_0x36a0('0x3f')](handleError(_0x5e46f6,null));};exports[_0x36a0('0x4c')]=function(_0x41ce56,_0x2e0461){if(_0x41ce56[_0x36a0('0x45')]['id']){delete _0x41ce56['body']['id'];}return db[_0x36a0('0x41')][_0x36a0('0x43')]({'where':{'id':_0x41ce56[_0x36a0('0x40')]['id']}})[_0x36a0('0x25')](handleEntityNotFound(_0x2e0461,null))[_0x36a0('0x25')](saveUpdates(_0x41ce56['body'],null))[_0x36a0('0x25')](respondWithResult(_0x2e0461,null))['catch'](handleError(_0x2e0461,null));};exports[_0x36a0('0x24')]=function(_0x31c304,_0x3f79fe){return db[_0x36a0('0x41')]['find']({'where':{'id':_0x31c304['params']['id']}})[_0x36a0('0x25')](handleEntityNotFound(_0x3f79fe,null))[_0x36a0('0x25')](removeEntity(_0x3f79fe,null))[_0x36a0('0x3f')](handleError(_0x3f79fe,null));}; \ No newline at end of file diff --git a/server/api/tag/tag.model.js b/server/api/tag/tag.model.js index 9128084..d505264 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 _0xd529=['moment','bluebird','request-promise','path','rimraf','./tag.attributes','exports','define','tools_tags','lodash','util','../../config/logger','api'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xd529,0x10d));var _0x9d52=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xd529[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x9d52('0x0'));var util=require(_0x9d52('0x1'));var logger=require(_0x9d52('0x2'))(_0x9d52('0x3'));var moment=require(_0x9d52('0x4'));var BPromise=require(_0x9d52('0x5'));var rp=require(_0x9d52('0x6'));var fs=require('fs');var path=require(_0x9d52('0x7'));var rimraf=require(_0x9d52('0x8'));var config=require('../../config/environment');var attributes=require(_0x9d52('0x9'));module[_0x9d52('0xa')]=function(_0x561aa9,_0xcab245){return _0x561aa9[_0x9d52('0xb')]('Tag',attributes,{'tableName':_0x9d52('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x017e=['define','Tag','tools_tags','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','exports'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0x017e,0x6b));var _0xe017=function(_0xe97e4c,_0x486a93){_0xe97e4c=_0xe97e4c-0x0;var _0x2a2f09=_0x017e[_0xe97e4c];return _0x2a2f09;};'use strict';var _=require(_0xe017('0x0'));var util=require(_0xe017('0x1'));var logger=require(_0xe017('0x2'))(_0xe017('0x3'));var moment=require(_0xe017('0x4'));var BPromise=require(_0xe017('0x5'));var rp=require(_0xe017('0x6'));var fs=require('fs');var path=require(_0xe017('0x7'));var rimraf=require(_0xe017('0x8'));var config=require('../../config/environment');var attributes=require('./tag.attributes');module[_0xe017('0x9')]=function(_0xf36522,_0x4a859d){return _0xf36522[_0xe017('0xa')](_0xe017('0xb'),attributes,{'tableName':_0xe017('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 0fd0a09..67f3a69 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 _0x524a=['request\x20sent','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','request','then','info','Tag,\x20%s,\x20%s','debug','Tag,\x20%s,\x20%s,\x20%s','error','code','message'];(function(_0x5b644e,_0x2e5e07){var _0x49c6bf=function(_0x3032d9){while(--_0x3032d9){_0x5b644e['push'](_0x5b644e['shift']());}};_0x49c6bf(++_0x2e5e07);}(_0x524a,0xf5));var _0xa524=function(_0x4a5f7f,_0x1382ed){_0x4a5f7f=_0x4a5f7f-0x0;var _0x4a954e=_0x524a[_0x4a5f7f];return _0x4a954e;};'use strict';var _=require(_0xa524('0x0'));var util=require(_0xa524('0x1'));var moment=require(_0xa524('0x2'));var BPromise=require(_0xa524('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xa524('0x4'));var db=require(_0xa524('0x5'))['db'];var utils=require(_0xa524('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0xa524('0x7'));var jayson=require(_0xa524('0x8'));var client=jayson[_0xa524('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x460738,_0x56bd0e,_0x3a2dd6){return new BPromise(function(_0x11aa98,_0x56849e){return client[_0xa524('0xa')](_0x460738,_0x3a2dd6)[_0xa524('0xb')](function(_0x228ffe){logger[_0xa524('0xc')](_0xa524('0xd'),_0x56bd0e,'request\x20sent');logger[_0xa524('0xe')](_0xa524('0xf'),_0x56bd0e,'request\x20sent',JSON['stringify'](_0x228ffe));if(_0x228ffe[_0xa524('0x10')]){if(_0x228ffe[_0xa524('0x10')][_0xa524('0x11')]===0x1f4){logger['error']('Tag,\x20%s,\x20%s',_0x56bd0e,_0x228ffe[_0xa524('0x10')]['message']);return _0x56849e(_0x228ffe[_0xa524('0x10')]['message']);}logger[_0xa524('0x10')]('Tag,\x20%s,\x20%s',_0x56bd0e,_0x228ffe[_0xa524('0x10')][_0xa524('0x12')]);return _0x11aa98(_0x228ffe['error'][_0xa524('0x12')]);}else{logger[_0xa524('0xc')](_0xa524('0xd'),_0x56bd0e,_0xa524('0x13'));_0x11aa98(_0x228ffe[_0xa524('0x14')][_0xa524('0x12')]);}})[_0xa524('0x15')](function(_0x4fc42f){logger[_0xa524('0x10')](_0xa524('0xd'),_0x56bd0e,_0x4fc42f);_0x56849e(_0x4fc42f);});});} \ No newline at end of file +var _0xca66=['http','request','then','info','Tag,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','lodash','bluebird','randomstring','ioredis','../../config/utils','rpc','jayson/promise','client'];(function(_0x3edc05,_0x36420d){var _0x6ce7dc=function(_0x3d2b3c){while(--_0x3d2b3c){_0x3edc05['push'](_0x3edc05['shift']());}};_0x6ce7dc(++_0x36420d);}(_0xca66,0x8b));var _0x6ca6=function(_0x20c07d,_0x4c5d3c){_0x20c07d=_0x20c07d-0x0;var _0xe45bf1=_0xca66[_0x20c07d];return _0xe45bf1;};'use strict';var _=require(_0x6ca6('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x6ca6('0x1'));var rs=require(_0x6ca6('0x2'));var fs=require('fs');var Redis=require(_0x6ca6('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x6ca6('0x4'));var logger=require('../../config/logger')(_0x6ca6('0x5'));var config=require('../../config/environment');var jayson=require(_0x6ca6('0x6'));var client=jayson[_0x6ca6('0x7')][_0x6ca6('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x44019c,_0x407e66,_0x27a210){return new BPromise(function(_0x27d280,_0x4f5651){return client[_0x6ca6('0x9')](_0x44019c,_0x27a210)[_0x6ca6('0xa')](function(_0x34b71b){logger[_0x6ca6('0xb')](_0x6ca6('0xc'),_0x407e66,_0x6ca6('0xd'));logger[_0x6ca6('0xe')]('Tag,\x20%s,\x20%s,\x20%s',_0x407e66,_0x6ca6('0xd'),JSON[_0x6ca6('0xf')](_0x34b71b));if(_0x34b71b[_0x6ca6('0x10')]){if(_0x34b71b[_0x6ca6('0x10')][_0x6ca6('0x11')]===0x1f4){logger[_0x6ca6('0x10')]('Tag,\x20%s,\x20%s',_0x407e66,_0x34b71b[_0x6ca6('0x10')][_0x6ca6('0x12')]);return _0x4f5651(_0x34b71b['error'][_0x6ca6('0x12')]);}logger[_0x6ca6('0x10')](_0x6ca6('0xc'),_0x407e66,_0x34b71b[_0x6ca6('0x10')][_0x6ca6('0x12')]);return _0x27d280(_0x34b71b[_0x6ca6('0x10')]['message']);}else{logger['info']('Tag,\x20%s,\x20%s',_0x407e66,_0x6ca6('0xd'));_0x27d280(_0x34b71b[_0x6ca6('0x13')][_0x6ca6('0x12')]);}})[_0x6ca6('0x14')](function(_0x2c4a5c){logger[_0x6ca6('0x10')](_0x6ca6('0xc'),_0x407e66,_0x2c4a5c);_0x4f5651(_0x2c4a5c);});});} \ No newline at end of file diff --git a/server/api/team/index.js b/server/api/team/index.js index 5ac64ed..c05ad86 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 _0x38a9=['get','isAuthenticated','index','/:id','show','/:id/queues','getQueues','post','create','addQueues','/:id/users','addAgents','put','delete','destroy','removeQueues','removeAgents','exports','multer','util','path','Router','../../components/auth/service','../../components/interaction/service'];(function(_0xbf26d,_0x3dc556){var _0x5318ce=function(_0x460721){while(--_0x460721){_0xbf26d['push'](_0xbf26d['shift']());}};_0x5318ce(++_0x3dc556);}(_0x38a9,0x11a));var _0x938a=function(_0x347e73,_0x499497){_0x347e73=_0x347e73-0x0;var _0x264bf7=_0x38a9[_0x347e73];return _0x264bf7;};'use strict';var multer=require(_0x938a('0x0'));var util=require(_0x938a('0x1'));var path=require(_0x938a('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x938a('0x3')]();var auth=require(_0x938a('0x4'));var interaction=require(_0x938a('0x5'));var config=require('../../config/environment');var controller=require('./team.controller');router[_0x938a('0x6')]('/',auth[_0x938a('0x7')](),controller[_0x938a('0x8')]);router['get'](_0x938a('0x9'),auth[_0x938a('0x7')](),controller[_0x938a('0xa')]);router['get'](_0x938a('0xb'),auth[_0x938a('0x7')](),controller[_0x938a('0xc')]);router[_0x938a('0x6')]('/:id/users',auth[_0x938a('0x7')](),controller['getAgents']);router[_0x938a('0xd')]('/',auth['isAuthenticated'](),controller[_0x938a('0xe')]);router[_0x938a('0xd')](_0x938a('0xb'),auth[_0x938a('0x7')](),controller[_0x938a('0xf')]);router[_0x938a('0xd')](_0x938a('0x10'),auth[_0x938a('0x7')](),controller[_0x938a('0x11')]);router[_0x938a('0x12')](_0x938a('0x9'),auth['isAuthenticated'](),controller['update']);router[_0x938a('0x13')](_0x938a('0x9'),auth[_0x938a('0x7')](),controller[_0x938a('0x14')]);router['delete']('/:id/queues',auth[_0x938a('0x7')](),controller[_0x938a('0x15')]);router[_0x938a('0x13')](_0x938a('0x10'),auth[_0x938a('0x7')](),controller[_0x938a('0x16')]);module[_0x938a('0x17')]=router; \ No newline at end of file +var _0x8652=['multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./team.controller','get','index','/:id','isAuthenticated','show','/:id/queues','getQueues','/:id/users','getAgents','create','post','addAgents','put','delete','destroy','removeQueues','exports'];(function(_0x137fdc,_0x350ef5){var _0x4594b8=function(_0x3bc436){while(--_0x3bc436){_0x137fdc['push'](_0x137fdc['shift']());}};_0x4594b8(++_0x350ef5);}(_0x8652,0x68));var _0x2865=function(_0x358c86,_0x38a8a2){_0x358c86=_0x358c86-0x0;var _0x52edc5=_0x8652[_0x358c86];return _0x52edc5;};'use strict';var multer=require(_0x2865('0x0'));var util=require(_0x2865('0x1'));var path=require(_0x2865('0x2'));var timeout=require(_0x2865('0x3'));var express=require(_0x2865('0x4'));var router=express['Router']();var auth=require(_0x2865('0x5'));var interaction=require(_0x2865('0x6'));var config=require(_0x2865('0x7'));var controller=require(_0x2865('0x8'));router[_0x2865('0x9')]('/',auth['isAuthenticated'](),controller[_0x2865('0xa')]);router[_0x2865('0x9')](_0x2865('0xb'),auth[_0x2865('0xc')](),controller[_0x2865('0xd')]);router[_0x2865('0x9')](_0x2865('0xe'),auth[_0x2865('0xc')](),controller[_0x2865('0xf')]);router[_0x2865('0x9')](_0x2865('0x10'),auth[_0x2865('0xc')](),controller[_0x2865('0x11')]);router['post']('/',auth[_0x2865('0xc')](),controller[_0x2865('0x12')]);router[_0x2865('0x13')](_0x2865('0xe'),auth[_0x2865('0xc')](),controller['addQueues']);router[_0x2865('0x13')](_0x2865('0x10'),auth[_0x2865('0xc')](),controller[_0x2865('0x14')]);router[_0x2865('0x15')](_0x2865('0xb'),auth[_0x2865('0xc')](),controller['update']);router[_0x2865('0x16')]('/:id',auth[_0x2865('0xc')](),controller[_0x2865('0x17')]);router[_0x2865('0x16')](_0x2865('0xe'),auth[_0x2865('0xc')](),controller[_0x2865('0x18')]);router[_0x2865('0x16')](_0x2865('0x10'),auth[_0x2865('0xc')](),controller['removeAgents']);module[_0x2865('0x19')]=router; \ No newline at end of file diff --git a/server/api/team/team.attributes.js b/server/api/team/team.attributes.js index de2b1b3..45a796f 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 _0x3668=['sequelize','exports','STRING','name'];(function(_0x48e38a,_0x51200a){var _0x1a3d7a=function(_0x383019){while(--_0x383019){_0x48e38a['push'](_0x48e38a['shift']());}};_0x1a3d7a(++_0x51200a);}(_0x3668,0x1b4));var _0x8366=function(_0x4d3154,_0x44dccd){_0x4d3154=_0x4d3154-0x0;var _0x1d9d37=_0x3668[_0x4d3154];return _0x1d9d37;};'use strict';var Sequelize=require(_0x8366('0x0'));module[_0x8366('0x1')]={'name':{'type':Sequelize[_0x8366('0x2')],'allowNull':![],'unique':_0x8366('0x3')},'description':{'type':Sequelize[_0x8366('0x2')]}}; \ No newline at end of file +var _0x8f53=['STRING','name','exports'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x8f53,0xb3));var _0x38f5=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x8f53[_0x20a584];return _0x4b41a8;};'use strict';var Sequelize=require('sequelize');module[_0x38f5('0x0')]={'name':{'type':Sequelize[_0x38f5('0x1')],'allowNull':![],'unique':_0x38f5('0x2')},'description':{'type':Sequelize[_0x38f5('0x1')]}}; \ No newline at end of file diff --git a/server/api/team/team.controller.js b/server/api/team/team.controller.js index c44600a..e461e9d 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 _0x3821=['../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','./team.socket','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','Teams','UserProfileResource','sendStatus','error','stack','name','send','index','rawAttributes','type','key','model','map','query','filters','intersection','fields','attributes','length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','Team','includeAll','include','findAll','catch','show','params','keys','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','find','channel','isValidChannel','Sequelize','ValidationError','Unknown\x20channel','toLowerCase','capitalize','addQueues','add','Queues','removeQueues','findOne','ids','addAgents','Voice','Chat','Mail','Sms','Fax','Openchannel','Whatsapp','each','User','online','voicePause','interface','UserVoiceQueueRt','isNil','format','SIP/%s','omit','spread','emit','userTeam:save','removeAgents','mail','fax','openchannel','whatsapp','voice','isArray','userTeam:remove','getAgents','hasOwnProperty','html-pdf','zip-dir','moment','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch'];(function(_0x2a6809,_0x44edde){var _0x11c371=function(_0x1a4888){while(--_0x1a4888){_0x2a6809['push'](_0x2a6809['shift']());}};_0x11c371(++_0x44edde);}(_0x3821,0xf7));var _0x1382=function(_0x5cd936,_0x587a12){_0x5cd936=_0x5cd936-0x0;var _0xd4169f=_0x3821[_0x5cd936];return _0xd4169f;};'use strict';var pdf=require(_0x1382('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x1382('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x1382('0x2'));var BPromise=require('bluebird');var Mustache=require(_0x1382('0x3'));var util=require(_0x1382('0x4'));var path=require(_0x1382('0x5'));var sox=require(_0x1382('0x6'));var csv=require(_0x1382('0x7'));var ejs=require(_0x1382('0x8'));var fs=require('fs');var _=require(_0x1382('0x9'));var squel=require(_0x1382('0xa'));var crypto=require(_0x1382('0xb'));var jsforce=require(_0x1382('0xc'));var deskjs=require(_0x1382('0xd'));var toCsv=require('to-csv');var querystring=require(_0x1382('0xe'));var Papa=require(_0x1382('0xf'));var Redis=require(_0x1382('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x1382('0x11'));var as=require(_0x1382('0x12'));var hardwareService=require(_0x1382('0x13'));var logger=require(_0x1382('0x14'))(_0x1382('0x15'));var utils=require(_0x1382('0x16'));var config=require(_0x1382('0x17'));var db=require(_0x1382('0x18'))['db'];config[_0x1382('0x19')]=_[_0x1382('0x1a')](config[_0x1382('0x19')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x1382('0x19')]));require(_0x1382('0x1b'))['register'](socket);function respondWithStatusCode(_0x38e380,_0x49ab67){_0x49ab67=_0x49ab67||0xcc;return function(_0x146102){if(_0x146102){return _0x38e380['sendStatus'](_0x49ab67);}return _0x38e380[_0x1382('0x1c')](_0x49ab67)[_0x1382('0x1d')]();};}function respondWithResult(_0x204418,_0x21f436){_0x21f436=_0x21f436||0xc8;return function(_0x3d4201){if(_0x3d4201){return _0x204418[_0x1382('0x1c')](_0x21f436)[_0x1382('0x1e')](_0x3d4201);}};}function respondWithFilteredResult(_0x1d2a6f,_0x12b023){return function(_0x1102ca){if(_0x1102ca){var _0xa72071=_0x1102ca[_0x1382('0x1f')],_0x39b126=_0x12b023[_0x1382('0x20')],_0x5d94eb=_0x12b023[_0x1382('0x20')]+_0x12b023[_0x1382('0x21')],_0x46e354;if(_0x5d94eb>=_0xa72071){_0x5d94eb=_0xa72071;_0x46e354=0xc8;}else{_0x46e354=0xce;}_0x1d2a6f['status'](_0x46e354);return _0x1d2a6f[_0x1382('0x22')](_0x1382('0x23'),_0x39b126+'-'+_0x5d94eb+'/'+_0xa72071)[_0x1382('0x1e')](_0x1102ca);}return null;};}function patchUpdates(_0x286302){return function(_0x1e4cdc){try{jsonpatch[_0x1382('0x24')](_0x1e4cdc,_0x286302,!![]);}catch(_0x18f732){return BPromise[_0x1382('0x25')](_0x18f732);}return _0x1e4cdc[_0x1382('0x26')]();};}function saveUpdates(_0x24df4d,_0x43bf3a){return function(_0xeffcb2){if(_0xeffcb2){return _0xeffcb2[_0x1382('0x27')](_0x24df4d)[_0x1382('0x28')](function(_0x1325a7){return _0x1325a7;});}return null;};}function removeEntity(_0xdebd1b,_0x3e16c6){return function(_0x4eae34){if(_0x4eae34){return _0x4eae34[_0x1382('0x29')]()[_0x1382('0x28')](function(){var _0x2cff59=_0x4eae34['get']({'plain':!![]});var _0xc6bcc2=_0x1382('0x2a');return db[_0x1382('0x2b')][_0x1382('0x29')]({'where':{'type':_0xc6bcc2,'resourceId':_0x2cff59['id']}})['then'](function(){return _0x4eae34;});})[_0x1382('0x28')](function(){_0xdebd1b['status'](0xcc)[_0x1382('0x1d')]();});}};}function handleEntityNotFound(_0x477408,_0x599c37){return function(_0x5a5ee4){if(!_0x5a5ee4){_0x477408[_0x1382('0x2c')](0x194);}return _0x5a5ee4;};}function handleError(_0x203a43,_0x136310){_0x136310=_0x136310||0x1f4;return function(_0x7740c4){logger[_0x1382('0x2d')](_0x7740c4[_0x1382('0x2e')]);if(_0x7740c4[_0x1382('0x2f')]){delete _0x7740c4[_0x1382('0x2f')];}_0x203a43[_0x1382('0x1c')](_0x136310)[_0x1382('0x30')](_0x7740c4);};}exports[_0x1382('0x31')]=function(_0x35b9df,_0x19ca41){var _0x1ec7ee={},_0x145fe5={},_0xacbed8={'count':0x0,'rows':[]};var _0x206947=_['map'](db['Team'][_0x1382('0x32')],function(_0x5e11db){return{'name':_0x5e11db['fieldName'],'type':_0x5e11db[_0x1382('0x33')][_0x1382('0x34')]};});_0x145fe5[_0x1382('0x35')]=_[_0x1382('0x36')](_0x206947,_0x1382('0x2f'));_0x145fe5[_0x1382('0x37')]=_['keys'](_0x35b9df[_0x1382('0x37')]);_0x145fe5[_0x1382('0x38')]=_[_0x1382('0x39')](_0x145fe5[_0x1382('0x35')],_0x145fe5[_0x1382('0x37')]);_0x1ec7ee['attributes']=_[_0x1382('0x39')](_0x145fe5[_0x1382('0x35')],qs[_0x1382('0x3a')](_0x35b9df['query']['fields']));_0x1ec7ee[_0x1382('0x3b')]=_0x1ec7ee[_0x1382('0x3b')][_0x1382('0x3c')]?_0x1ec7ee[_0x1382('0x3b')]:_0x145fe5['model'];if(!_0x35b9df[_0x1382('0x37')]['hasOwnProperty'](_0x1382('0x3d'))){_0x1ec7ee[_0x1382('0x21')]=qs[_0x1382('0x21')](_0x35b9df[_0x1382('0x37')][_0x1382('0x21')]);_0x1ec7ee[_0x1382('0x20')]=qs[_0x1382('0x20')](_0x35b9df['query'][_0x1382('0x20')]);}_0x1ec7ee[_0x1382('0x3e')]=qs[_0x1382('0x3f')](_0x35b9df[_0x1382('0x37')][_0x1382('0x3f')]);_0x1ec7ee[_0x1382('0x40')]=qs[_0x1382('0x38')](_[_0x1382('0x41')](_0x35b9df[_0x1382('0x37')],_0x145fe5[_0x1382('0x38')]),_0x206947);if(_0x35b9df[_0x1382('0x37')][_0x1382('0x42')]){_0x1ec7ee['where']=_[_0x1382('0x43')](_0x1ec7ee[_0x1382('0x40')],{'$or':_[_0x1382('0x36')](_0x206947,function(_0x28eada){if(_0x28eada[_0x1382('0x33')]!==_0x1382('0x44')){var _0x4ffbc0={};_0x4ffbc0[_0x28eada[_0x1382('0x2f')]]={'$like':'%'+_0x35b9df[_0x1382('0x37')]['filter']+'%'};return _0x4ffbc0;}})});}_0x1ec7ee=_['merge']({},_0x1ec7ee,_0x35b9df[_0x1382('0x45')]);var _0x1d01fd={'where':_0x1ec7ee['where']};return db[_0x1382('0x46')][_0x1382('0x1f')](_0x1d01fd)[_0x1382('0x28')](function(_0x4748e5){_0xacbed8['count']=_0x4748e5;if(_0x35b9df[_0x1382('0x37')][_0x1382('0x47')]){_0x1ec7ee[_0x1382('0x48')]=[{'all':!![]}];}return db[_0x1382('0x46')][_0x1382('0x49')](_0x1ec7ee);})[_0x1382('0x28')](function(_0x39afeb){_0xacbed8['rows']=_0x39afeb;return _0xacbed8;})[_0x1382('0x28')](respondWithFilteredResult(_0x19ca41,_0x1ec7ee))[_0x1382('0x4a')](handleError(_0x19ca41,null));};exports[_0x1382('0x4b')]=function(_0x412338,_0xedf85){var _0x32cf48={'raw':![],'where':{'id':_0x412338[_0x1382('0x4c')]['id']}},_0x45bfba={};_0x45bfba[_0x1382('0x35')]=_['keys'](db[_0x1382('0x46')]['rawAttributes']);_0x45bfba['query']=_[_0x1382('0x4d')](_0x412338[_0x1382('0x37')]);_0x45bfba[_0x1382('0x38')]=_['intersection'](_0x45bfba['model'],_0x45bfba[_0x1382('0x37')]);_0x32cf48[_0x1382('0x3b')]=_[_0x1382('0x39')](_0x45bfba[_0x1382('0x35')],qs[_0x1382('0x3a')](_0x412338['query']['fields']));_0x32cf48['attributes']=_0x32cf48[_0x1382('0x3b')]['length']?_0x32cf48[_0x1382('0x3b')]:_0x45bfba[_0x1382('0x35')];if(_0x412338[_0x1382('0x37')][_0x1382('0x47')]){_0x32cf48[_0x1382('0x48')]=[{'all':!![]}];}_0x32cf48=_['merge']({},_0x32cf48,_0x412338[_0x1382('0x45')]);return db['Team']['find'](_0x32cf48)[_0x1382('0x28')](handleEntityNotFound(_0xedf85,null))[_0x1382('0x28')](respondWithResult(_0xedf85,null))['catch'](handleError(_0xedf85,null));};exports[_0x1382('0x4e')]=function(_0x267b66,_0x57e761){return db[_0x1382('0x46')]['create'](_0x267b66[_0x1382('0x4f')],{})[_0x1382('0x28')](function(_0x2b4c40){var _0x1c0d0c=_0x267b66[_0x1382('0x50')][_0x1382('0x51')]({'plain':!![]});if(!_0x1c0d0c)throw new Error(_0x1382('0x52'));if(_0x1c0d0c[_0x1382('0x53')]===_0x1382('0x50')){var _0x29c754=_0x2b4c40[_0x1382('0x51')]({'plain':!![]});var _0x44afb4=_0x1382('0x2a');return db[_0x1382('0x54')]['find']({'where':{'name':_0x44afb4,'userProfileId':_0x1c0d0c[_0x1382('0x55')]},'raw':!![]})['then'](function(_0x317a35){if(_0x317a35&&_0x317a35[_0x1382('0x56')]===0x0){return db[_0x1382('0x2b')][_0x1382('0x4e')]({'name':_0x29c754[_0x1382('0x2f')],'resourceId':_0x29c754['id'],'type':_0x317a35[_0x1382('0x2f')],'sectionId':_0x317a35['id']},{})[_0x1382('0x28')](function(){return _0x2b4c40;});}else{return _0x2b4c40;}})[_0x1382('0x4a')](function(_0x4b62cb){logger[_0x1382('0x2d')](_0x1382('0x57'),_0x4b62cb);throw _0x4b62cb;});}return _0x2b4c40;})['then'](respondWithResult(_0x57e761,0xc9))[_0x1382('0x4a')](handleError(_0x57e761,null));};exports[_0x1382('0x27')]=function(_0x6c1a28,_0x1e6487){if(_0x6c1a28['body']['id']){delete _0x6c1a28[_0x1382('0x4f')]['id'];}return db['Team'][_0x1382('0x58')]({'where':{'id':_0x6c1a28['params']['id']}})['then'](handleEntityNotFound(_0x1e6487,null))[_0x1382('0x28')](saveUpdates(_0x6c1a28[_0x1382('0x4f')],null))[_0x1382('0x28')](respondWithResult(_0x1e6487,null))[_0x1382('0x4a')](handleError(_0x1e6487,null));};exports[_0x1382('0x29')]=function(_0x4987ef,_0x2cc495){return db[_0x1382('0x46')][_0x1382('0x58')]({'where':{'id':_0x4987ef['params']['id']}})[_0x1382('0x28')](handleEntityNotFound(_0x2cc495,null))[_0x1382('0x28')](removeEntity(_0x2cc495,null))[_0x1382('0x4a')](handleError(_0x2cc495,null));};exports['getQueues']=function(_0x153c9c,_0x1268f5,_0x949e3e){return db[_0x1382('0x46')]['findOne']({'where':{'id':_0x153c9c[_0x1382('0x4c')]['id']}})[_0x1382('0x28')](handleEntityNotFound(_0x1268f5,null))['then'](function(_0xfb9d7a){if(!_0x153c9c['query'][_0x1382('0x59')]||!utils[_0x1382('0x5a')](_0x153c9c[_0x1382('0x37')][_0x1382('0x59')])){throw new db[(_0x1382('0x5b'))][(_0x1382('0x5c'))](_0x1382('0x5d'));}var _0x1e5766={};var _0x5e814a={};_0x5e814a[_0x1382('0x35')]=_[_0x1382('0x4d')](db[_['capitalize'](_0x153c9c[_0x1382('0x37')]['channel'][_0x1382('0x5e')]())+'Queue'][_0x1382('0x32')]);_0x5e814a['query']=_[_0x1382('0x4d')](_0x153c9c[_0x1382('0x37')]);_0x5e814a[_0x1382('0x38')]=_[_0x1382('0x39')](_0x5e814a['model'],_0x5e814a[_0x1382('0x37')]);_0x1e5766['attributes']=_[_0x1382('0x39')](_0x5e814a['model'],qs['fields'](_0x153c9c[_0x1382('0x37')][_0x1382('0x3a')]));_0x1e5766[_0x1382('0x3b')]=_0x1e5766[_0x1382('0x3b')]['length']?_0x1e5766['attributes']:_0x5e814a[_0x1382('0x35')];_0x1e5766[_0x1382('0x21')]=qs[_0x1382('0x21')](_0x153c9c[_0x1382('0x37')][_0x1382('0x21')]);_0x1e5766[_0x1382('0x20')]=qs[_0x1382('0x20')](_0x153c9c[_0x1382('0x37')][_0x1382('0x20')]);_0x1e5766[_0x1382('0x3e')]=qs[_0x1382('0x3f')](_0x153c9c[_0x1382('0x37')][_0x1382('0x3f')]);_0x1e5766[_0x1382('0x40')]=qs[_0x1382('0x38')](_[_0x1382('0x41')](_0x153c9c[_0x1382('0x37')],_0x5e814a[_0x1382('0x38')]));_0x1e5766=_[_0x1382('0x43')]({},_0x1e5766,_0x153c9c['options']);return _0xfb9d7a[_0x1382('0x51')+_[_0x1382('0x5f')](_0x153c9c['query']['channel'][_0x1382('0x5e')]())+'Queues'](_0x1e5766);})[_0x1382('0x28')](respondWithResult(_0x1268f5,null))[_0x1382('0x4a')](handleError(_0x1268f5,null));};exports[_0x1382('0x60')]=function(_0x2cf9fa,_0x57c5c0,_0x486f85){return db['Team']['findOne']({'where':{'id':_0x2cf9fa[_0x1382('0x4c')]['id']}})['then'](function(_0x280775){if(_0x280775){if(!_0x2cf9fa[_0x1382('0x4f')][_0x1382('0x59')]||!utils[_0x1382('0x5a')](_0x2cf9fa[_0x1382('0x4f')][_0x1382('0x59')])){throw new db[(_0x1382('0x5b'))]['ValidationError'](_0x1382('0x5d'));}return _0x280775[_0x1382('0x61')+_[_0x1382('0x5f')](_0x2cf9fa[_0x1382('0x4f')][_0x1382('0x59')]['toLowerCase']())+_0x1382('0x62')](_0x2cf9fa['body']['ids']);}return null;})[_0x1382('0x28')](handleEntityNotFound(_0x57c5c0,null))[_0x1382('0x28')](respondWithStatusCode(_0x57c5c0,null))[_0x1382('0x4a')](handleError(_0x57c5c0,null));};exports[_0x1382('0x63')]=function(_0x84fc8e,_0x325a67,_0x5777fe){return db[_0x1382('0x46')][_0x1382('0x64')]({'where':{'id':_0x84fc8e['params']['id']}})[_0x1382('0x28')](function(_0x19f6b2){if(_0x19f6b2){if(!_0x84fc8e['query'][_0x1382('0x59')]||!utils[_0x1382('0x5a')](_0x84fc8e[_0x1382('0x37')][_0x1382('0x59')])){throw new db[(_0x1382('0x5b'))][(_0x1382('0x5c'))](_0x1382('0x5d'));}return _0x19f6b2['remove'+_[_0x1382('0x5f')](_0x84fc8e['query'][_0x1382('0x59')]['toLowerCase']())+_0x1382('0x62')](_0x84fc8e[_0x1382('0x37')][_0x1382('0x65')]);}return null;})[_0x1382('0x28')](handleEntityNotFound(_0x325a67,null))['then'](respondWithStatusCode(_0x325a67,null))['catch'](handleError(_0x325a67,null));};exports[_0x1382('0x66')]=function(_0x56c4eb,_0x6f71ba,_0x479f63){return db[_0x1382('0x46')][_0x1382('0x58')]({'where':{'id':_0x56c4eb[_0x1382('0x4c')]['id']}})[_0x1382('0x28')](handleEntityNotFound(_0x6f71ba,null))['then'](function(_0x534243){if(_0x534243){var _0xb1cd50=[_0x1382('0x67'),_0x1382('0x68'),_0x1382('0x69'),_0x1382('0x6a'),_0x1382('0x6b'),_0x1382('0x6c'),_0x1382('0x6d')];return BPromise[_0x1382('0x6e')](_0xb1cd50,function(_0x48aeaa){return _0x534243[_0x1382('0x51')+_0x48aeaa+_0x1382('0x62')]({'attributes':['id','name']})['then'](function(_0x342e99){return BPromise[_0x1382('0x6e')](_0x342e99,function(_0x10373e){return _0x10373e[_0x1382('0x66')](_0x56c4eb[_0x1382('0x4f')]['ids'])[_0x1382('0x28')](function(){if(_0x48aeaa===_0x1382('0x67')){return db[_0x1382('0x6f')]['findAll']({'where':{'id':_0x56c4eb[_0x1382('0x4f')][_0x1382('0x65')]},'attributes':['id','name',_0x1382('0x70'),_0x1382('0x71'),_0x1382('0x72')],'raw':!![]})[_0x1382('0x28')](function(_0x332d97){return BPromise[_0x1382('0x6e')](_[_0x1382('0x42')](_0x332d97,{'online':0x1}),function(_0x497115){return db[_0x1382('0x73')]['upsert']({'membername':_0x497115['name'],'UserId':_0x497115['id'],'queue_name':_0x10373e[_0x1382('0x2f')],'VoiceQueueId':_0x10373e['id'],'interface':_[_0x1382('0x74')](_0x497115[_0x1382('0x72')])?util[_0x1382('0x75')](_0x1382('0x76'),_0x497115[_0x1382('0x2f')]):_0x497115[_0x1382('0x72')],'paused':_0x497115[_0x1382('0x71')]||![],'penalty':0x0});});});}});});})[_0x1382('0x28')](function(){return _0x534243;});})['then'](function(){return _0x534243;});}})[_0x1382('0x28')](function(_0x39bd75){if(_0x39bd75){return _0x39bd75[_0x1382('0x66')](_0x56c4eb['body'][_0x1382('0x65')],_[_0x1382('0x77')](_0x56c4eb[_0x1382('0x4f')],['ids','id'])||{})[_0x1382('0x78')](function(_0x3bca78){for(var _0xe62a95=0x0;_0xe62a95<_0x56c4eb[_0x1382('0x4f')]['ids'][_0x1382('0x3c')];_0xe62a95+=0x1){socket[_0x1382('0x79')](_0x1382('0x7a'),{'UserId':_0x56c4eb['body'][_0x1382('0x65')][_0xe62a95],'TeamId':_0x56c4eb['params']['id']});}return _0x3bca78;});}})['then'](respondWithResult(_0x6f71ba,null))[_0x1382('0x4a')](handleError(_0x6f71ba,null));};exports[_0x1382('0x7b')]=function(_0xc1016f,_0x5e27bf,_0xdd25e8){return db['Team']['find']({'where':{'id':_0xc1016f[_0x1382('0x4c')]['id']}})['then'](handleEntityNotFound(_0x5e27bf,null))[_0x1382('0x28')](function(_0x42cc5c){if(_0x42cc5c){return BPromise[_0x1382('0x6e')](['voice','chat',_0x1382('0x7c'),'sms',_0x1382('0x7d'),_0x1382('0x7e'),_0x1382('0x7f')],function(_0x36f9de){return _0x42cc5c[_0x1382('0x51')+_['capitalize'](_0x36f9de)+_0x1382('0x62')]({'attributes':['id',_0x1382('0x2f')]})['then'](function(_0x45af5c){return BPromise[_0x1382('0x6e')](_0x45af5c,function(_0x5c8c23){return _0x5c8c23[_0x1382('0x7b')](_0xc1016f['query'][_0x1382('0x65')])[_0x1382('0x28')](function(){if(_0x36f9de===_0x1382('0x80')){return db['UserVoiceQueueRt']['destroy']({'where':{'VoiceQueueId':_0x5c8c23['id'],'UserId':_0xc1016f['query'][_0x1382('0x65')]}});}});});})[_0x1382('0x28')](function(){return _0x42cc5c;});})[_0x1382('0x28')](function(){return _0x42cc5c;});}})['then'](function(_0x1af7a6){if(_0x1af7a6){return _0x1af7a6[_0x1382('0x7b')](_0xc1016f['query'][_0x1382('0x65')])['then'](function(){if(_[_0x1382('0x81')](_0xc1016f[_0x1382('0x37')][_0x1382('0x65')])){for(var _0x4bf82f=0x0;_0x4bf82f<_0xc1016f['query']['ids'][_0x1382('0x3c')];_0x4bf82f+=0x1){socket[_0x1382('0x79')](_0x1382('0x82'),{'UserId':Number(_0xc1016f[_0x1382('0x37')]['ids'][_0x4bf82f]),'TeamId':Number(_0xc1016f[_0x1382('0x4c')]['id'])});}}else{socket[_0x1382('0x79')](_0x1382('0x82'),{'UserId':Number(_0xc1016f['query'][_0x1382('0x65')]),'TeamId':Number(_0xc1016f[_0x1382('0x4c')]['id'])});}});}})['then'](respondWithStatusCode(_0x5e27bf,null))['catch'](handleError(_0x5e27bf,null));};exports[_0x1382('0x83')]=function(_0x5424fa,_0x2664a2,_0x469f8c){var _0x569a74={};var _0x4e92ca={};var _0x2b9bca;var _0x21afcf;return db[_0x1382('0x46')][_0x1382('0x64')]({'where':{'id':_0x5424fa[_0x1382('0x4c')]['id']}})[_0x1382('0x28')](handleEntityNotFound(_0x2664a2,null))[_0x1382('0x28')](function(_0xef7dfe){if(_0xef7dfe){_0x2b9bca=_0xef7dfe;_0x4e92ca[_0x1382('0x35')]=_['keys'](db[_0x1382('0x6f')]['rawAttributes']);_0x4e92ca[_0x1382('0x37')]=_[_0x1382('0x4d')](_0x5424fa['query']);_0x4e92ca[_0x1382('0x38')]=_[_0x1382('0x39')](_0x4e92ca[_0x1382('0x35')],_0x4e92ca[_0x1382('0x37')]);_0x569a74[_0x1382('0x3b')]=_[_0x1382('0x39')](_0x4e92ca['model'],qs[_0x1382('0x3a')](_0x5424fa['query'][_0x1382('0x3a')]));_0x569a74['attributes']=_0x569a74['attributes'][_0x1382('0x3c')]?_0x569a74[_0x1382('0x3b')]:_0x4e92ca[_0x1382('0x35')];_0x569a74['order']=qs['sort'](_0x5424fa[_0x1382('0x37')][_0x1382('0x3f')]);_0x569a74['where']=qs[_0x1382('0x38')](_[_0x1382('0x41')](_0x5424fa[_0x1382('0x37')],_0x4e92ca[_0x1382('0x38')]));if(_0x5424fa[_0x1382('0x37')][_0x1382('0x42')]){_0x569a74['where']=_['merge'](_0x569a74[_0x1382('0x40')],{'$or':_['map'](_0x569a74['attributes'],function(_0x44fe72){var _0x3b0f19={};_0x3b0f19[_0x44fe72]={'$like':'%'+_0x5424fa[_0x1382('0x37')][_0x1382('0x42')]+'%'};return _0x3b0f19;})});}_0x569a74=_['merge']({},_0x569a74,_0x5424fa[_0x1382('0x45')]);return _0x2b9bca[_0x1382('0x83')](_0x569a74);}})['then'](function(_0x235ee6){if(_0x235ee6){_0x21afcf=_0x235ee6['length'];if(!_0x5424fa[_0x1382('0x37')][_0x1382('0x84')](_0x1382('0x3d'))){_0x569a74[_0x1382('0x21')]=qs[_0x1382('0x21')](_0x5424fa[_0x1382('0x37')][_0x1382('0x21')]);_0x569a74['offset']=qs[_0x1382('0x20')](_0x5424fa[_0x1382('0x37')]['offset']);}return _0x2b9bca['getAgents'](_0x569a74);}})[_0x1382('0x28')](function(_0x2249a0){if(_0x2249a0){return _0x2249a0?{'count':_0x21afcf,'rows':_0x2249a0}:null;}})[_0x1382('0x28')](respondWithResult(_0x2664a2,null))['catch'](handleError(_0x2664a2,null));}; \ No newline at end of file +var _0x3b2e=['voice','destroy','isArray','userTeam:remove','getAgents','pick','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','path','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./team.socket','register','status','count','offset','limit','Content-Range','json','apply','save','update','then','get','end','sendStatus','error','stack','name','send','index','map','Team','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','includeAll','include','findAll','show','params','options','find','catch','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','Teams','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','body','getQueues','findOne','channel','isValidChannel','Sequelize','ValidationError','Unknown\x20channel','capitalize','Queue','Queues','addQueues','add','ids','remove','toLowerCase','addAgents','Voice','Chat','Mail','Sms','each','User','online','voicePause','UserVoiceQueueRt','upsert','isNil','interface','format','SIP/%s','omit','spread','emit','userTeam:save','removeAgents','mail','sms','whatsapp'];(function(_0x3efe87,_0x35ad48){var _0x56a4cc=function(_0x47869e){while(--_0x47869e){_0x3efe87['push'](_0x3efe87['shift']());}};_0x56a4cc(++_0x35ad48);}(_0x3b2e,0x10a));var _0xe3b2=function(_0x562163,_0x264e2a){_0x562163=_0x562163-0x0;var _0x551eed=_0x3b2e[_0x562163];return _0x551eed;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xe3b2('0x0'));var rimraf=require(_0xe3b2('0x1'));var zipdir=require(_0xe3b2('0x2'));var jsonpatch=require(_0xe3b2('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xe3b2('0x4'));var Mustache=require(_0xe3b2('0x5'));var util=require('util');var path=require(_0xe3b2('0x6'));var sox=require(_0xe3b2('0x7'));var csv=require(_0xe3b2('0x8'));var ejs=require(_0xe3b2('0x9'));var fs=require('fs');var _=require(_0xe3b2('0xa'));var squel=require('squel');var crypto=require(_0xe3b2('0xb'));var jsforce=require(_0xe3b2('0xc'));var deskjs=require(_0xe3b2('0xd'));var toCsv=require(_0xe3b2('0x8'));var querystring=require(_0xe3b2('0xe'));var Papa=require(_0xe3b2('0xf'));var Redis=require(_0xe3b2('0x10'));var authService=require(_0xe3b2('0x11'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xe3b2('0x12'));var logger=require(_0xe3b2('0x13'))('api');var utils=require('../../config/utils');var config=require(_0xe3b2('0x14'));var db=require(_0xe3b2('0x15'))['db'];config[_0xe3b2('0x16')]=_[_0xe3b2('0x17')](config[_0xe3b2('0x16')],{'host':_0xe3b2('0x18'),'port':0x18eb});var socket=require(_0xe3b2('0x19'))(new Redis(config[_0xe3b2('0x16')]));require(_0xe3b2('0x1a'))[_0xe3b2('0x1b')](socket);function respondWithStatusCode(_0xf7523d,_0x51cd01){_0x51cd01=_0x51cd01||0xcc;return function(_0x43e30b){if(_0x43e30b){return _0xf7523d['sendStatus'](_0x51cd01);}return _0xf7523d['status'](_0x51cd01)['end']();};}function respondWithResult(_0x4f2148,_0x3e8d72){_0x3e8d72=_0x3e8d72||0xc8;return function(_0x41be10){if(_0x41be10){return _0x4f2148[_0xe3b2('0x1c')](_0x3e8d72)['json'](_0x41be10);}};}function respondWithFilteredResult(_0x2299b5,_0x3a41c5){return function(_0x55df6e){if(_0x55df6e){var _0x406cb9=_0x55df6e[_0xe3b2('0x1d')],_0x4171f2=_0x3a41c5['offset'],_0x5a0c14=_0x3a41c5[_0xe3b2('0x1e')]+_0x3a41c5[_0xe3b2('0x1f')],_0x3febdf;if(_0x5a0c14>=_0x406cb9){_0x5a0c14=_0x406cb9;_0x3febdf=0xc8;}else{_0x3febdf=0xce;}_0x2299b5[_0xe3b2('0x1c')](_0x3febdf);return _0x2299b5['set'](_0xe3b2('0x20'),_0x4171f2+'-'+_0x5a0c14+'/'+_0x406cb9)[_0xe3b2('0x21')](_0x55df6e);}return null;};}function patchUpdates(_0x2716a5){return function(_0x4a19de){try{jsonpatch[_0xe3b2('0x22')](_0x4a19de,_0x2716a5,!![]);}catch(_0x30a274){return BPromise['reject'](_0x30a274);}return _0x4a19de[_0xe3b2('0x23')]();};}function saveUpdates(_0x5b0130,_0x23852a){return function(_0x2ee612){if(_0x2ee612){return _0x2ee612[_0xe3b2('0x24')](_0x5b0130)[_0xe3b2('0x25')](function(_0x20b65e){return _0x20b65e;});}return null;};}function removeEntity(_0x18eb1d,_0x457ba2){return function(_0x31eaa6){if(_0x31eaa6){return _0x31eaa6['destroy']()[_0xe3b2('0x25')](function(){var _0x1017d7=_0x31eaa6[_0xe3b2('0x26')]({'plain':!![]});var _0x3450d4='Teams';return db['UserProfileResource']['destroy']({'where':{'type':_0x3450d4,'resourceId':_0x1017d7['id']}})[_0xe3b2('0x25')](function(){return _0x31eaa6;});})[_0xe3b2('0x25')](function(){_0x18eb1d['status'](0xcc)[_0xe3b2('0x27')]();});}};}function handleEntityNotFound(_0x651a40,_0x296e4d){return function(_0x1537b2){if(!_0x1537b2){_0x651a40[_0xe3b2('0x28')](0x194);}return _0x1537b2;};}function handleError(_0xabf7ea,_0x4f04ab){_0x4f04ab=_0x4f04ab||0x1f4;return function(_0x1a923a){logger[_0xe3b2('0x29')](_0x1a923a[_0xe3b2('0x2a')]);if(_0x1a923a[_0xe3b2('0x2b')]){delete _0x1a923a['name'];}_0xabf7ea['status'](_0x4f04ab)[_0xe3b2('0x2c')](_0x1a923a);};}exports[_0xe3b2('0x2d')]=function(_0x326460,_0x21e053){var _0x2ef914={},_0x35e40b={},_0x4fe25b={'count':0x0,'rows':[]};var _0x112d82=_[_0xe3b2('0x2e')](db[_0xe3b2('0x2f')][_0xe3b2('0x30')],function(_0x46c59d){return{'name':_0x46c59d[_0xe3b2('0x31')],'type':_0x46c59d[_0xe3b2('0x32')][_0xe3b2('0x33')]};});_0x35e40b[_0xe3b2('0x34')]=_[_0xe3b2('0x2e')](_0x112d82,_0xe3b2('0x2b'));_0x35e40b[_0xe3b2('0x35')]=_[_0xe3b2('0x36')](_0x326460['query']);_0x35e40b[_0xe3b2('0x37')]=_[_0xe3b2('0x38')](_0x35e40b[_0xe3b2('0x34')],_0x35e40b['query']);_0x2ef914['attributes']=_[_0xe3b2('0x38')](_0x35e40b['model'],qs[_0xe3b2('0x39')](_0x326460[_0xe3b2('0x35')][_0xe3b2('0x39')]));_0x2ef914[_0xe3b2('0x3a')]=_0x2ef914[_0xe3b2('0x3a')][_0xe3b2('0x3b')]?_0x2ef914[_0xe3b2('0x3a')]:_0x35e40b['model'];if(!_0x326460[_0xe3b2('0x35')][_0xe3b2('0x3c')](_0xe3b2('0x3d'))){_0x2ef914[_0xe3b2('0x1f')]=qs['limit'](_0x326460[_0xe3b2('0x35')][_0xe3b2('0x1f')]);_0x2ef914[_0xe3b2('0x1e')]=qs[_0xe3b2('0x1e')](_0x326460[_0xe3b2('0x35')]['offset']);}_0x2ef914[_0xe3b2('0x3e')]=qs[_0xe3b2('0x3f')](_0x326460['query'][_0xe3b2('0x3f')]);_0x2ef914[_0xe3b2('0x40')]=qs[_0xe3b2('0x37')](_['pick'](_0x326460[_0xe3b2('0x35')],_0x35e40b['filters']),_0x112d82);if(_0x326460['query'][_0xe3b2('0x41')]){_0x2ef914[_0xe3b2('0x40')]=_[_0xe3b2('0x42')](_0x2ef914[_0xe3b2('0x40')],{'$or':_['map'](_0x112d82,function(_0x550e52){if(_0x550e52[_0xe3b2('0x32')]!==_0xe3b2('0x43')){var _0x3ead97={};_0x3ead97[_0x550e52['name']]={'$like':'%'+_0x326460[_0xe3b2('0x35')][_0xe3b2('0x41')]+'%'};return _0x3ead97;}})});}_0x2ef914=_[_0xe3b2('0x42')]({},_0x2ef914,_0x326460['options']);var _0x246df8={'where':_0x2ef914['where']};return db[_0xe3b2('0x2f')][_0xe3b2('0x1d')](_0x246df8)[_0xe3b2('0x25')](function(_0xd0f4a6){_0x4fe25b[_0xe3b2('0x1d')]=_0xd0f4a6;if(_0x326460['query'][_0xe3b2('0x44')]){_0x2ef914[_0xe3b2('0x45')]=[{'all':!![]}];}return db[_0xe3b2('0x2f')][_0xe3b2('0x46')](_0x2ef914);})[_0xe3b2('0x25')](function(_0xb144b3){_0x4fe25b['rows']=_0xb144b3;return _0x4fe25b;})[_0xe3b2('0x25')](respondWithFilteredResult(_0x21e053,_0x2ef914))['catch'](handleError(_0x21e053,null));};exports[_0xe3b2('0x47')]=function(_0x4166d0,_0x3abceb){var _0x4694e9={'raw':![],'where':{'id':_0x4166d0[_0xe3b2('0x48')]['id']}},_0x19a239={};_0x19a239[_0xe3b2('0x34')]=_[_0xe3b2('0x36')](db[_0xe3b2('0x2f')][_0xe3b2('0x30')]);_0x19a239[_0xe3b2('0x35')]=_[_0xe3b2('0x36')](_0x4166d0[_0xe3b2('0x35')]);_0x19a239[_0xe3b2('0x37')]=_[_0xe3b2('0x38')](_0x19a239['model'],_0x19a239['query']);_0x4694e9[_0xe3b2('0x3a')]=_['intersection'](_0x19a239[_0xe3b2('0x34')],qs[_0xe3b2('0x39')](_0x4166d0[_0xe3b2('0x35')]['fields']));_0x4694e9[_0xe3b2('0x3a')]=_0x4694e9['attributes'][_0xe3b2('0x3b')]?_0x4694e9['attributes']:_0x19a239[_0xe3b2('0x34')];if(_0x4166d0[_0xe3b2('0x35')][_0xe3b2('0x44')]){_0x4694e9[_0xe3b2('0x45')]=[{'all':!![]}];}_0x4694e9=_['merge']({},_0x4694e9,_0x4166d0[_0xe3b2('0x49')]);return db['Team'][_0xe3b2('0x4a')](_0x4694e9)[_0xe3b2('0x25')](handleEntityNotFound(_0x3abceb,null))['then'](respondWithResult(_0x3abceb,null))[_0xe3b2('0x4b')](handleError(_0x3abceb,null));};exports[_0xe3b2('0x4c')]=function(_0x3f0a68,_0x2a8b05){return db['Team'][_0xe3b2('0x4c')](_0x3f0a68['body'],{})[_0xe3b2('0x25')](function(_0x493bb6){var _0x1fb32c=_0x3f0a68['user'][_0xe3b2('0x26')]({'plain':!![]});if(!_0x1fb32c)throw new Error(_0xe3b2('0x4d'));if(_0x1fb32c[_0xe3b2('0x4e')]===_0xe3b2('0x4f')){var _0x1dda6a=_0x493bb6[_0xe3b2('0x26')]({'plain':!![]});var _0x820b08=_0xe3b2('0x50');return db[_0xe3b2('0x51')][_0xe3b2('0x4a')]({'where':{'name':_0x820b08,'userProfileId':_0x1fb32c[_0xe3b2('0x52')]},'raw':!![]})[_0xe3b2('0x25')](function(_0x9183ed){if(_0x9183ed&&_0x9183ed[_0xe3b2('0x53')]===0x0){return db[_0xe3b2('0x54')][_0xe3b2('0x4c')]({'name':_0x1dda6a['name'],'resourceId':_0x1dda6a['id'],'type':_0x9183ed[_0xe3b2('0x2b')],'sectionId':_0x9183ed['id']},{})['then'](function(){return _0x493bb6;});}else{return _0x493bb6;}})[_0xe3b2('0x4b')](function(_0x308dc8){logger[_0xe3b2('0x29')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x308dc8);throw _0x308dc8;});}return _0x493bb6;})['then'](respondWithResult(_0x2a8b05,0xc9))[_0xe3b2('0x4b')](handleError(_0x2a8b05,null));};exports[_0xe3b2('0x24')]=function(_0x4661c1,_0x3ad1b6){if(_0x4661c1[_0xe3b2('0x55')]['id']){delete _0x4661c1['body']['id'];}return db[_0xe3b2('0x2f')][_0xe3b2('0x4a')]({'where':{'id':_0x4661c1['params']['id']}})['then'](handleEntityNotFound(_0x3ad1b6,null))[_0xe3b2('0x25')](saveUpdates(_0x4661c1['body'],null))['then'](respondWithResult(_0x3ad1b6,null))[_0xe3b2('0x4b')](handleError(_0x3ad1b6,null));};exports['destroy']=function(_0x364ae0,_0x3b1dc1){return db[_0xe3b2('0x2f')][_0xe3b2('0x4a')]({'where':{'id':_0x364ae0['params']['id']}})[_0xe3b2('0x25')](handleEntityNotFound(_0x3b1dc1,null))[_0xe3b2('0x25')](removeEntity(_0x3b1dc1,null))[_0xe3b2('0x4b')](handleError(_0x3b1dc1,null));};exports[_0xe3b2('0x56')]=function(_0x4f3078,_0x4b148a,_0x34f642){return db[_0xe3b2('0x2f')][_0xe3b2('0x57')]({'where':{'id':_0x4f3078[_0xe3b2('0x48')]['id']}})[_0xe3b2('0x25')](handleEntityNotFound(_0x4b148a,null))[_0xe3b2('0x25')](function(_0x38d2c0){if(!_0x4f3078[_0xe3b2('0x35')][_0xe3b2('0x58')]||!utils[_0xe3b2('0x59')](_0x4f3078['query']['channel'])){throw new db[(_0xe3b2('0x5a'))][(_0xe3b2('0x5b'))](_0xe3b2('0x5c'));}var _0x6fb47f={};var _0x4c4c31={};_0x4c4c31[_0xe3b2('0x34')]=_[_0xe3b2('0x36')](db[_[_0xe3b2('0x5d')](_0x4f3078[_0xe3b2('0x35')][_0xe3b2('0x58')]['toLowerCase']())+_0xe3b2('0x5e')]['rawAttributes']);_0x4c4c31['query']=_[_0xe3b2('0x36')](_0x4f3078[_0xe3b2('0x35')]);_0x4c4c31[_0xe3b2('0x37')]=_[_0xe3b2('0x38')](_0x4c4c31[_0xe3b2('0x34')],_0x4c4c31[_0xe3b2('0x35')]);_0x6fb47f[_0xe3b2('0x3a')]=_[_0xe3b2('0x38')](_0x4c4c31[_0xe3b2('0x34')],qs[_0xe3b2('0x39')](_0x4f3078[_0xe3b2('0x35')][_0xe3b2('0x39')]));_0x6fb47f[_0xe3b2('0x3a')]=_0x6fb47f[_0xe3b2('0x3a')][_0xe3b2('0x3b')]?_0x6fb47f[_0xe3b2('0x3a')]:_0x4c4c31[_0xe3b2('0x34')];_0x6fb47f[_0xe3b2('0x1f')]=qs[_0xe3b2('0x1f')](_0x4f3078['query']['limit']);_0x6fb47f['offset']=qs[_0xe3b2('0x1e')](_0x4f3078['query']['offset']);_0x6fb47f[_0xe3b2('0x3e')]=qs[_0xe3b2('0x3f')](_0x4f3078['query'][_0xe3b2('0x3f')]);_0x6fb47f['where']=qs[_0xe3b2('0x37')](_['pick'](_0x4f3078[_0xe3b2('0x35')],_0x4c4c31[_0xe3b2('0x37')]));_0x6fb47f=_[_0xe3b2('0x42')]({},_0x6fb47f,_0x4f3078[_0xe3b2('0x49')]);return _0x38d2c0['get'+_[_0xe3b2('0x5d')](_0x4f3078[_0xe3b2('0x35')][_0xe3b2('0x58')]['toLowerCase']())+_0xe3b2('0x5f')](_0x6fb47f);})['then'](respondWithResult(_0x4b148a,null))[_0xe3b2('0x4b')](handleError(_0x4b148a,null));};exports[_0xe3b2('0x60')]=function(_0x244743,_0xe7c804,_0x35eb30){return db['Team'][_0xe3b2('0x57')]({'where':{'id':_0x244743[_0xe3b2('0x48')]['id']}})[_0xe3b2('0x25')](function(_0x244a4b){if(_0x244a4b){if(!_0x244743[_0xe3b2('0x55')][_0xe3b2('0x58')]||!utils[_0xe3b2('0x59')](_0x244743[_0xe3b2('0x55')][_0xe3b2('0x58')])){throw new db['Sequelize']['ValidationError'](_0xe3b2('0x5c'));}return _0x244a4b[_0xe3b2('0x61')+_[_0xe3b2('0x5d')](_0x244743[_0xe3b2('0x55')][_0xe3b2('0x58')]['toLowerCase']())+'Queues'](_0x244743[_0xe3b2('0x55')][_0xe3b2('0x62')]);}return null;})[_0xe3b2('0x25')](handleEntityNotFound(_0xe7c804,null))[_0xe3b2('0x25')](respondWithStatusCode(_0xe7c804,null))[_0xe3b2('0x4b')](handleError(_0xe7c804,null));};exports['removeQueues']=function(_0x5cb491,_0x1b6a74,_0x2d91bd){return db[_0xe3b2('0x2f')][_0xe3b2('0x57')]({'where':{'id':_0x5cb491[_0xe3b2('0x48')]['id']}})[_0xe3b2('0x25')](function(_0x3cd885){if(_0x3cd885){if(!_0x5cb491[_0xe3b2('0x35')]['channel']||!utils[_0xe3b2('0x59')](_0x5cb491[_0xe3b2('0x35')][_0xe3b2('0x58')])){throw new db[(_0xe3b2('0x5a'))]['ValidationError'](_0xe3b2('0x5c'));}return _0x3cd885[_0xe3b2('0x63')+_['capitalize'](_0x5cb491[_0xe3b2('0x35')][_0xe3b2('0x58')][_0xe3b2('0x64')]())+_0xe3b2('0x5f')](_0x5cb491['query'][_0xe3b2('0x62')]);}return null;})[_0xe3b2('0x25')](handleEntityNotFound(_0x1b6a74,null))['then'](respondWithStatusCode(_0x1b6a74,null))['catch'](handleError(_0x1b6a74,null));};exports[_0xe3b2('0x65')]=function(_0x4a5a89,_0x1476f3,_0x39c5ca){return db[_0xe3b2('0x2f')][_0xe3b2('0x4a')]({'where':{'id':_0x4a5a89[_0xe3b2('0x48')]['id']}})[_0xe3b2('0x25')](handleEntityNotFound(_0x1476f3,null))[_0xe3b2('0x25')](function(_0x36d978){if(_0x36d978){var _0x5789b7=[_0xe3b2('0x66'),_0xe3b2('0x67'),_0xe3b2('0x68'),_0xe3b2('0x69'),'Fax','Openchannel','Whatsapp'];return BPromise[_0xe3b2('0x6a')](_0x5789b7,function(_0x47c9da){return _0x36d978[_0xe3b2('0x26')+_0x47c9da+'Queues']({'attributes':['id','name']})[_0xe3b2('0x25')](function(_0x41e464){return BPromise[_0xe3b2('0x6a')](_0x41e464,function(_0x196f53){return _0x196f53[_0xe3b2('0x65')](_0x4a5a89[_0xe3b2('0x55')][_0xe3b2('0x62')])['then'](function(){if(_0x47c9da===_0xe3b2('0x66')){return db[_0xe3b2('0x6b')]['findAll']({'where':{'id':_0x4a5a89[_0xe3b2('0x55')][_0xe3b2('0x62')]},'attributes':['id','name',_0xe3b2('0x6c'),_0xe3b2('0x6d'),'interface'],'raw':!![]})[_0xe3b2('0x25')](function(_0x46bf54){return BPromise[_0xe3b2('0x6a')](_[_0xe3b2('0x41')](_0x46bf54,{'online':0x1}),function(_0x5c2b74){return db[_0xe3b2('0x6e')][_0xe3b2('0x6f')]({'membername':_0x5c2b74[_0xe3b2('0x2b')],'UserId':_0x5c2b74['id'],'queue_name':_0x196f53[_0xe3b2('0x2b')],'VoiceQueueId':_0x196f53['id'],'interface':_[_0xe3b2('0x70')](_0x5c2b74[_0xe3b2('0x71')])?util[_0xe3b2('0x72')](_0xe3b2('0x73'),_0x5c2b74[_0xe3b2('0x2b')]):_0x5c2b74[_0xe3b2('0x71')],'paused':_0x5c2b74[_0xe3b2('0x6d')]||![],'penalty':0x0});});});}});});})[_0xe3b2('0x25')](function(){return _0x36d978;});})['then'](function(){return _0x36d978;});}})[_0xe3b2('0x25')](function(_0x1dbcbe){if(_0x1dbcbe){return _0x1dbcbe[_0xe3b2('0x65')](_0x4a5a89[_0xe3b2('0x55')]['ids'],_[_0xe3b2('0x74')](_0x4a5a89[_0xe3b2('0x55')],[_0xe3b2('0x62'),'id'])||{})[_0xe3b2('0x75')](function(_0x8a0c99){for(var _0x3d4818=0x0;_0x3d4818<_0x4a5a89[_0xe3b2('0x55')][_0xe3b2('0x62')][_0xe3b2('0x3b')];_0x3d4818+=0x1){socket[_0xe3b2('0x76')](_0xe3b2('0x77'),{'UserId':_0x4a5a89['body'][_0xe3b2('0x62')][_0x3d4818],'TeamId':_0x4a5a89[_0xe3b2('0x48')]['id']});}return _0x8a0c99;});}})[_0xe3b2('0x25')](respondWithResult(_0x1476f3,null))[_0xe3b2('0x4b')](handleError(_0x1476f3,null));};exports[_0xe3b2('0x78')]=function(_0x429726,_0x38f337,_0x235c51){return db[_0xe3b2('0x2f')]['find']({'where':{'id':_0x429726['params']['id']}})[_0xe3b2('0x25')](handleEntityNotFound(_0x38f337,null))[_0xe3b2('0x25')](function(_0x1fb49f){if(_0x1fb49f){return BPromise[_0xe3b2('0x6a')](['voice','chat',_0xe3b2('0x79'),_0xe3b2('0x7a'),'fax','openchannel',_0xe3b2('0x7b')],function(_0x5d98d1){return _0x1fb49f['get'+_[_0xe3b2('0x5d')](_0x5d98d1)+_0xe3b2('0x5f')]({'attributes':['id',_0xe3b2('0x2b')]})[_0xe3b2('0x25')](function(_0x10463c){return BPromise[_0xe3b2('0x6a')](_0x10463c,function(_0x32c68c){return _0x32c68c[_0xe3b2('0x78')](_0x429726['query'][_0xe3b2('0x62')])['then'](function(){if(_0x5d98d1===_0xe3b2('0x7c')){return db['UserVoiceQueueRt'][_0xe3b2('0x7d')]({'where':{'VoiceQueueId':_0x32c68c['id'],'UserId':_0x429726[_0xe3b2('0x35')][_0xe3b2('0x62')]}});}});});})['then'](function(){return _0x1fb49f;});})['then'](function(){return _0x1fb49f;});}})['then'](function(_0x292e5f){if(_0x292e5f){return _0x292e5f[_0xe3b2('0x78')](_0x429726[_0xe3b2('0x35')]['ids'])['then'](function(){if(_[_0xe3b2('0x7e')](_0x429726[_0xe3b2('0x35')][_0xe3b2('0x62')])){for(var _0x480a9d=0x0;_0x480a9d<_0x429726[_0xe3b2('0x35')][_0xe3b2('0x62')][_0xe3b2('0x3b')];_0x480a9d+=0x1){socket[_0xe3b2('0x76')](_0xe3b2('0x7f'),{'UserId':Number(_0x429726[_0xe3b2('0x35')]['ids'][_0x480a9d]),'TeamId':Number(_0x429726[_0xe3b2('0x48')]['id'])});}}else{socket[_0xe3b2('0x76')]('userTeam:remove',{'UserId':Number(_0x429726[_0xe3b2('0x35')][_0xe3b2('0x62')]),'TeamId':Number(_0x429726[_0xe3b2('0x48')]['id'])});}});}})[_0xe3b2('0x25')](respondWithStatusCode(_0x38f337,null))['catch'](handleError(_0x38f337,null));};exports[_0xe3b2('0x80')]=function(_0xb21745,_0x1c5557,_0xee2c9b){var _0x445ce7={};var _0x4a32f5={};var _0x4965c9;var _0x1180ab;return db[_0xe3b2('0x2f')][_0xe3b2('0x57')]({'where':{'id':_0xb21745[_0xe3b2('0x48')]['id']}})[_0xe3b2('0x25')](handleEntityNotFound(_0x1c5557,null))[_0xe3b2('0x25')](function(_0x29a286){if(_0x29a286){_0x4965c9=_0x29a286;_0x4a32f5[_0xe3b2('0x34')]=_[_0xe3b2('0x36')](db[_0xe3b2('0x6b')][_0xe3b2('0x30')]);_0x4a32f5[_0xe3b2('0x35')]=_[_0xe3b2('0x36')](_0xb21745[_0xe3b2('0x35')]);_0x4a32f5[_0xe3b2('0x37')]=_['intersection'](_0x4a32f5['model'],_0x4a32f5[_0xe3b2('0x35')]);_0x445ce7['attributes']=_['intersection'](_0x4a32f5[_0xe3b2('0x34')],qs['fields'](_0xb21745[_0xe3b2('0x35')][_0xe3b2('0x39')]));_0x445ce7[_0xe3b2('0x3a')]=_0x445ce7[_0xe3b2('0x3a')][_0xe3b2('0x3b')]?_0x445ce7[_0xe3b2('0x3a')]:_0x4a32f5['model'];_0x445ce7['order']=qs['sort'](_0xb21745['query'][_0xe3b2('0x3f')]);_0x445ce7[_0xe3b2('0x40')]=qs[_0xe3b2('0x37')](_[_0xe3b2('0x81')](_0xb21745['query'],_0x4a32f5[_0xe3b2('0x37')]));if(_0xb21745[_0xe3b2('0x35')]['filter']){_0x445ce7[_0xe3b2('0x40')]=_[_0xe3b2('0x42')](_0x445ce7[_0xe3b2('0x40')],{'$or':_[_0xe3b2('0x2e')](_0x445ce7[_0xe3b2('0x3a')],function(_0x2148f4){var _0x5cb599={};_0x5cb599[_0x2148f4]={'$like':'%'+_0xb21745[_0xe3b2('0x35')][_0xe3b2('0x41')]+'%'};return _0x5cb599;})});}_0x445ce7=_[_0xe3b2('0x42')]({},_0x445ce7,_0xb21745['options']);return _0x4965c9[_0xe3b2('0x80')](_0x445ce7);}})[_0xe3b2('0x25')](function(_0x3cf02e){if(_0x3cf02e){_0x1180ab=_0x3cf02e[_0xe3b2('0x3b')];if(!_0xb21745['query'][_0xe3b2('0x3c')]('nolimit')){_0x445ce7[_0xe3b2('0x1f')]=qs['limit'](_0xb21745[_0xe3b2('0x35')][_0xe3b2('0x1f')]);_0x445ce7[_0xe3b2('0x1e')]=qs[_0xe3b2('0x1e')](_0xb21745[_0xe3b2('0x35')][_0xe3b2('0x1e')]);}return _0x4965c9['getAgents'](_0x445ce7);}})[_0xe3b2('0x25')](function(_0x4540f5){if(_0x4540f5){return _0x4540f5?{'count':_0x1180ab,'rows':_0x4540f5}:null;}})[_0xe3b2('0x25')](respondWithResult(_0x1c5557,null))[_0xe3b2('0x4b')](handleError(_0x1c5557,null));}; \ No newline at end of file diff --git a/server/api/team/team.events.js b/server/api/team/team.events.js index 4f1247e..d1d4f4a 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 _0x8baf=['save','update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','Team','setMaxListeners'];(function(_0x4b7727,_0x4eddad){var _0x25f5ba=function(_0x10aa2f){while(--_0x10aa2f){_0x4b7727['push'](_0x4b7727['shift']());}};_0x25f5ba(++_0x4eddad);}(_0x8baf,0xc2));var _0xf8ba=function(_0x3056c2,_0x3a1621){_0x3056c2=_0x3056c2-0x0;var _0x5b91c8=_0x8baf[_0x3056c2];return _0x5b91c8;};'use strict';var EventEmitter=require(_0xf8ba('0x0'));var Team=require(_0xf8ba('0x1'))['db'][_0xf8ba('0x2')];var TeamEvents=new EventEmitter();TeamEvents[_0xf8ba('0x3')](0x0);var events={'afterCreate':_0xf8ba('0x4'),'afterUpdate':_0xf8ba('0x5'),'afterDestroy':_0xf8ba('0x6')};function emitEvent(_0x250dce){return function(_0x1a8a83,_0x324955,_0x24b389){TeamEvents[_0xf8ba('0x7')](_0x250dce+':'+_0x1a8a83['id'],_0x1a8a83);TeamEvents[_0xf8ba('0x7')](_0x250dce,_0x1a8a83);_0x24b389(null);};}for(var e in events){if(events[_0xf8ba('0x8')](e)){var event=events[e];Team[_0xf8ba('0x9')](e,emitEvent(event));}}module[_0xf8ba('0xa')]=TeamEvents; \ No newline at end of file +var _0x0d88=['events','../../mysqldb','Team','setMaxListeners','save','remove','emit','hasOwnProperty','hook','exports'];(function(_0x2cb4b6,_0xbe1953){var _0x32449e=function(_0x4ce91a){while(--_0x4ce91a){_0x2cb4b6['push'](_0x2cb4b6['shift']());}};_0x32449e(++_0xbe1953);}(_0x0d88,0x6e));var _0x80d8=function(_0x3f542b,_0x587747){_0x3f542b=_0x3f542b-0x0;var _0x16f633=_0x0d88[_0x3f542b];return _0x16f633;};'use strict';var EventEmitter=require(_0x80d8('0x0'));var Team=require(_0x80d8('0x1'))['db'][_0x80d8('0x2')];var TeamEvents=new EventEmitter();TeamEvents[_0x80d8('0x3')](0x0);var events={'afterCreate':_0x80d8('0x4'),'afterUpdate':'update','afterDestroy':_0x80d8('0x5')};function emitEvent(_0x4c8836){return function(_0x17dbab,_0x4354ca,_0x5a872c){TeamEvents[_0x80d8('0x6')](_0x4c8836+':'+_0x17dbab['id'],_0x17dbab);TeamEvents[_0x80d8('0x6')](_0x4c8836,_0x17dbab);_0x5a872c(null);};}for(var e in events){if(events[_0x80d8('0x7')](e)){var event=events[e];Team[_0x80d8('0x8')](e,emitEvent(event));}}module[_0x80d8('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 43d039a..2878a63 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 _0xdf25=['bluebird','request-promise','path','rimraf','../../config/environment','./team.attributes','exports','define','Team','util','../../config/logger','moment'];(function(_0x1846f4,_0x3a6121){var _0xf74891=function(_0x387bce){while(--_0x387bce){_0x1846f4['push'](_0x1846f4['shift']());}};_0xf74891(++_0x3a6121);}(_0xdf25,0xf9));var _0x5df2=function(_0x39b171,_0x2db684){_0x39b171=_0x39b171-0x0;var _0x1fd234=_0xdf25[_0x39b171];return _0x1fd234;};'use strict';var _=require('lodash');var util=require(_0x5df2('0x0'));var logger=require(_0x5df2('0x1'))('api');var moment=require(_0x5df2('0x2'));var BPromise=require(_0x5df2('0x3'));var rp=require(_0x5df2('0x4'));var fs=require('fs');var path=require(_0x5df2('0x5'));var rimraf=require(_0x5df2('0x6'));var config=require(_0x5df2('0x7'));var attributes=require(_0x5df2('0x8'));module[_0x5df2('0x9')]=function(_0x22af1d,_0x51372d){return _0x22af1d[_0x5df2('0xa')](_0x5df2('0xb'),attributes,{'tableName':'teams','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x04a8=['util','../../config/logger','api','moment','bluebird','path','../../config/environment','./team.attributes','define','lodash'];(function(_0x2e4e19,_0x493b50){var _0x9ba20b=function(_0x2f6456){while(--_0x2f6456){_0x2e4e19['push'](_0x2e4e19['shift']());}};_0x9ba20b(++_0x493b50);}(_0x04a8,0x149));var _0x804a=function(_0x485ff3,_0x3efe5c){_0x485ff3=_0x485ff3-0x0;var _0x656dbc=_0x04a8[_0x485ff3];return _0x656dbc;};'use strict';var _=require(_0x804a('0x0'));var util=require(_0x804a('0x1'));var logger=require(_0x804a('0x2'))(_0x804a('0x3'));var moment=require(_0x804a('0x4'));var BPromise=require(_0x804a('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x804a('0x6'));var rimraf=require('rimraf');var config=require(_0x804a('0x7'));var attributes=require(_0x804a('0x8'));module['exports']=function(_0x452bc7,_0x423867){return _0x452bc7[_0x804a('0x9')]('Team',attributes,{'tableName':'teams','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/team/team.rpc.js b/server/api/team/team.rpc.js index debeb8c..bf8deca 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 _0xb9fb=['Team,\x20%s,\x20%s,\x20%s','stringify','error','message','result','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','defaults','localhost','socket.io-emitter','./team.socket','request','then','info','Team,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x187ee1,_0x3fd1e6){var _0x388160=function(_0x542dd2){while(--_0x542dd2){_0x187ee1['push'](_0x187ee1['shift']());}};_0x388160(++_0x3fd1e6);}(_0xb9fb,0x1b5));var _0xbb9f=function(_0x36eaaa,_0x326732){_0x36eaaa=_0x36eaaa-0x0;var _0x461349=_0xb9fb[_0x36eaaa];return _0x461349;};'use strict';var _=require(_0xbb9f('0x0'));var util=require('util');var moment=require(_0xbb9f('0x1'));var BPromise=require(_0xbb9f('0x2'));var rs=require(_0xbb9f('0x3'));var fs=require('fs');var Redis=require(_0xbb9f('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xbb9f('0x5'));var logger=require(_0xbb9f('0x6'))(_0xbb9f('0x7'));var config=require(_0xbb9f('0x8'));var jayson=require(_0xbb9f('0x9'));var client=jayson[_0xbb9f('0xa')]['http']({'port':0x232a});config[_0xbb9f('0xb')]=_[_0xbb9f('0xc')](config[_0xbb9f('0xb')],{'host':_0xbb9f('0xd'),'port':0x18eb});var socket=require(_0xbb9f('0xe'))(new Redis(config[_0xbb9f('0xb')]));require(_0xbb9f('0xf'))['register'](socket);function respondWithRpcPromise(_0x22eaec,_0x31b412,_0x56f44a){return new BPromise(function(_0x58a46f,_0x586ce1){return client[_0xbb9f('0x10')](_0x22eaec,_0x56f44a)[_0xbb9f('0x11')](function(_0xae1f6f){logger[_0xbb9f('0x12')](_0xbb9f('0x13'),_0x31b412,_0xbb9f('0x14'));logger[_0xbb9f('0x15')](_0xbb9f('0x16'),_0x31b412,_0xbb9f('0x14'),JSON[_0xbb9f('0x17')](_0xae1f6f));if(_0xae1f6f['error']){if(_0xae1f6f[_0xbb9f('0x18')]['code']===0x1f4){logger[_0xbb9f('0x18')](_0xbb9f('0x13'),_0x31b412,_0xae1f6f[_0xbb9f('0x18')]['message']);return _0x586ce1(_0xae1f6f['error'][_0xbb9f('0x19')]);}logger['error'](_0xbb9f('0x13'),_0x31b412,_0xae1f6f[_0xbb9f('0x18')][_0xbb9f('0x19')]);return _0x58a46f(_0xae1f6f[_0xbb9f('0x18')][_0xbb9f('0x19')]);}else{logger[_0xbb9f('0x12')](_0xbb9f('0x13'),_0x31b412,_0xbb9f('0x14'));_0x58a46f(_0xae1f6f[_0xbb9f('0x1a')][_0xbb9f('0x19')]);}})['catch'](function(_0x4389bb){logger[_0xbb9f('0x18')](_0xbb9f('0x13'),_0x31b412,_0x4389bb);_0x586ce1(_0x4389bb);});});} \ No newline at end of file +var _0x75fa=['redis','localhost','socket.io-emitter','register','then','Team,\x20%s,\x20%s','debug','request\x20sent','error','code','message','info','result','catch','lodash','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client'];(function(_0x239b5a,_0x56199a){var _0x5a701c=function(_0x3cdf2d){while(--_0x3cdf2d){_0x239b5a['push'](_0x239b5a['shift']());}};_0x5a701c(++_0x56199a);}(_0x75fa,0xce));var _0xa75f=function(_0x32d0dc,_0x465d23){_0x32d0dc=_0x32d0dc-0x0;var _0x40cc25=_0x75fa[_0x32d0dc];return _0x40cc25;};'use strict';var _=require(_0xa75f('0x0'));var util=require(_0xa75f('0x1'));var moment=require(_0xa75f('0x2'));var BPromise=require(_0xa75f('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xa75f('0x4'))['db'];var utils=require(_0xa75f('0x5'));var logger=require(_0xa75f('0x6'))(_0xa75f('0x7'));var config=require(_0xa75f('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xa75f('0x9')]['http']({'port':0x232a});config[_0xa75f('0xa')]=_['defaults'](config['redis'],{'host':_0xa75f('0xb'),'port':0x18eb});var socket=require(_0xa75f('0xc'))(new Redis(config[_0xa75f('0xa')]));require('./team.socket')[_0xa75f('0xd')](socket);function respondWithRpcPromise(_0x57e909,_0xa0089e,_0x4d27a9){return new BPromise(function(_0x15e044,_0x1b2a0c){return client['request'](_0x57e909,_0x4d27a9)[_0xa75f('0xe')](function(_0x1acbfa){logger['info'](_0xa75f('0xf'),_0xa0089e,'request\x20sent');logger[_0xa75f('0x10')]('Team,\x20%s,\x20%s,\x20%s',_0xa0089e,_0xa75f('0x11'),JSON['stringify'](_0x1acbfa));if(_0x1acbfa[_0xa75f('0x12')]){if(_0x1acbfa[_0xa75f('0x12')][_0xa75f('0x13')]===0x1f4){logger['error'](_0xa75f('0xf'),_0xa0089e,_0x1acbfa[_0xa75f('0x12')]['message']);return _0x1b2a0c(_0x1acbfa[_0xa75f('0x12')][_0xa75f('0x14')]);}logger[_0xa75f('0x12')]('Team,\x20%s,\x20%s',_0xa0089e,_0x1acbfa[_0xa75f('0x12')][_0xa75f('0x14')]);return _0x15e044(_0x1acbfa['error']['message']);}else{logger[_0xa75f('0x15')](_0xa75f('0xf'),_0xa0089e,_0xa75f('0x11'));_0x15e044(_0x1acbfa[_0xa75f('0x16')][_0xa75f('0x14')]);}})[_0xa75f('0x17')](function(_0x1baff0){logger[_0xa75f('0x12')](_0xa75f('0xf'),_0xa0089e,_0x1baff0);_0x1b2a0c(_0x1baff0);});});} \ No newline at end of file diff --git a/server/api/team/team.socket.js b/server/api/team/team.socket.js index 389fd64..3691c2b 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 _0x86b8=['save','remove','emit','removeListener','length','team:','./team.events'];(function(_0x2e7266,_0x4340ee){var _0x5d0cc7=function(_0x3df99c){while(--_0x3df99c){_0x2e7266['push'](_0x2e7266['shift']());}};_0x5d0cc7(++_0x4340ee);}(_0x86b8,0x15d));var _0x886b=function(_0x4ff749,_0x24892a){_0x4ff749=_0x4ff749-0x0;var _0x170300=_0x86b8[_0x4ff749];return _0x170300;};'use strict';var TeamEvents=require(_0x886b('0x0'));var events=[_0x886b('0x1'),_0x886b('0x2'),'update'];function createListener(_0x105f5d,_0x5db7b6){return function(_0x3dcb96){_0x5db7b6[_0x886b('0x3')](_0x105f5d,_0x3dcb96);};}function removeListener(_0x4191fb,_0x4d3769){return function(){TeamEvents[_0x886b('0x4')](_0x4191fb,_0x4d3769);};}exports['register']=function(_0x5b5ff5){for(var _0x2c32bc=0x0,_0xd9d9ac=events[_0x886b('0x5')];_0x2c32bc<_0xd9d9ac;_0x2c32bc++){var _0x2f8957=events[_0x2c32bc];var _0xbc2d70=createListener(_0x886b('0x6')+_0x2f8957,_0x5b5ff5);TeamEvents['on'](_0x2f8957,_0xbc2d70);}}; \ No newline at end of file +var _0x9ade=['remove','update','emit','register','length','team:','./team.events','save'];(function(_0x7eb6cf,_0x2b3bf0){var _0x42022f=function(_0x74c915){while(--_0x74c915){_0x7eb6cf['push'](_0x7eb6cf['shift']());}};_0x42022f(++_0x2b3bf0);}(_0x9ade,0x8e));var _0xe9ad=function(_0x24bf11,_0x320ad8){_0x24bf11=_0x24bf11-0x0;var _0x20f05b=_0x9ade[_0x24bf11];return _0x20f05b;};'use strict';var TeamEvents=require(_0xe9ad('0x0'));var events=[_0xe9ad('0x1'),_0xe9ad('0x2'),_0xe9ad('0x3')];function createListener(_0x3ad948,_0x163f67){return function(_0x38fa6c){_0x163f67[_0xe9ad('0x4')](_0x3ad948,_0x38fa6c);};}function removeListener(_0x468a5b,_0x441278){return function(){TeamEvents['removeListener'](_0x468a5b,_0x441278);};}exports[_0xe9ad('0x5')]=function(_0x53b3f7){for(var _0x5cf047=0x0,_0x382206=events[_0xe9ad('0x6')];_0x5cf047<_0x382206;_0x5cf047++){var _0x394441=events[_0x5cf047];var _0xe8984c=createListener(_0xe9ad('0x7')+_0x394441,_0x53b3f7);TeamEvents['on'](_0x394441,_0xe8984c);}}; \ No newline at end of file diff --git a/server/api/template/index.js b/server/api/template/index.js index b261554..e8d0083 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 _0x499e=['update','delete','/:id','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./template.controller','index','isAuthenticated'];(function(_0x562c56,_0x5e3c9c){var _0x6daf03=function(_0x2c6064){while(--_0x2c6064){_0x562c56['push'](_0x562c56['shift']());}};_0x6daf03(++_0x5e3c9c);}(_0x499e,0x115));var _0xe499=function(_0xe35c45,_0x336e08){_0xe35c45=_0xe35c45-0x0;var _0x2a8c5b=_0x499e[_0xe35c45];return _0x2a8c5b;};'use strict';var multer=require(_0xe499('0x0'));var util=require(_0xe499('0x1'));var path=require(_0xe499('0x2'));var timeout=require(_0xe499('0x3'));var express=require(_0xe499('0x4'));var router=express[_0xe499('0x5')]();var auth=require(_0xe499('0x6'));var interaction=require(_0xe499('0x7'));var config=require(_0xe499('0x8'));var controller=require(_0xe499('0x9'));router['get']('/',auth['isAuthenticated'](),controller[_0xe499('0xa')]);router['get']('/:id',auth[_0xe499('0xb')](),controller['show']);router['post']('/',auth[_0xe499('0xb')](),controller['create']);router['put']('/:id',auth['isAuthenticated'](),controller[_0xe499('0xc')]);router[_0xe499('0xd')](_0xe499('0xe'),auth['isAuthenticated'](),controller[_0xe499('0xf')]);module[_0xe499('0x10')]=router; \ No newline at end of file +var _0xa059=['connect-timeout','express','Router','../../components/interaction/service','../../config/environment','get','isAuthenticated','/:id','create','put','update','delete','exports','multer','util','path'];(function(_0x46d0c9,_0x526bfa){var _0x174506=function(_0x654bc6){while(--_0x654bc6){_0x46d0c9['push'](_0x46d0c9['shift']());}};_0x174506(++_0x526bfa);}(_0xa059,0xed));var _0x9a05=function(_0x9d3607,_0x112fdf){_0x9d3607=_0x9d3607-0x0;var _0x1b835a=_0xa059[_0x9d3607];return _0x1b835a;};'use strict';var multer=require(_0x9a05('0x0'));var util=require(_0x9a05('0x1'));var path=require(_0x9a05('0x2'));var timeout=require(_0x9a05('0x3'));var express=require(_0x9a05('0x4'));var router=express[_0x9a05('0x5')]();var auth=require('../../components/auth/service');var interaction=require(_0x9a05('0x6'));var config=require(_0x9a05('0x7'));var controller=require('./template.controller');router[_0x9a05('0x8')]('/',auth[_0x9a05('0x9')](),controller['index']);router[_0x9a05('0x8')](_0x9a05('0xa'),auth[_0x9a05('0x9')](),controller['show']);router['post']('/',auth[_0x9a05('0x9')](),controller[_0x9a05('0xb')]);router[_0x9a05('0xc')](_0x9a05('0xa'),auth['isAuthenticated'](),controller[_0x9a05('0xd')]);router[_0x9a05('0xe')](_0x9a05('0xa'),auth['isAuthenticated'](),controller['destroy']);module[_0x9a05('0xf')]=router; \ No newline at end of file diff --git a/server/api/template/template.attributes.js b/server/api/template/template.attributes.js index 3fa35c2..acdb62d 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 _0x734c=['STRING','sequelize','exports'];(function(_0x2c3036,_0x4b944d){var _0xa705c0=function(_0x3d3363){while(--_0x3d3363){_0x2c3036['push'](_0x2c3036['shift']());}};_0xa705c0(++_0x4b944d);}(_0x734c,0xe2));var _0xc734=function(_0x106fdf,_0x1e71e4){_0x106fdf=_0x106fdf-0x0;var _0x24818c=_0x734c[_0x106fdf];return _0x24818c;};'use strict';var Sequelize=require(_0xc734('0x0'));module[_0xc734('0x1')]={'name':{'type':Sequelize[_0xc734('0x2')]},'description':{'type':Sequelize[_0xc734('0x2')]},'html':{'type':Sequelize['TEXT']}}; \ No newline at end of file +var _0x1ba8=['exports','STRING','TEXT','sequelize'];(function(_0x5c7b76,_0x12382c){var _0x2f6579=function(_0x24772d){while(--_0x24772d){_0x5c7b76['push'](_0x5c7b76['shift']());}};_0x2f6579(++_0x12382c);}(_0x1ba8,0x117));var _0x81ba=function(_0x35a4fc,_0x23f198){_0x35a4fc=_0x35a4fc-0x0;var _0x54e81d=_0x1ba8[_0x35a4fc];return _0x54e81d;};'use strict';var Sequelize=require(_0x81ba('0x0'));module[_0x81ba('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x81ba('0x2')]},'html':{'type':Sequelize[_0x81ba('0x3')]}}; \ No newline at end of file diff --git a/server/api/template/template.controller.js b/server/api/template/template.controller.js index fa6aa19..ec0ce31 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 _0x2e57=['role','get','find','userProfileId','name','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','util','path','to-csv','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../mysqldb','status','json','offset','set','apply','reject','save','update','then','destroy','Templates','UserProfileResource','end','sendStatus','error','stack','index','map','rawAttributes','type','key','model','query','intersection','fields','attributes','hasOwnProperty','nolimit','limit','order','where','filters','pick','filter','merge','VIRTUAL','Template','count','includeAll','include','findAll','rows','show','params','keys','options','catch','create','body','user'];(function(_0x3780ed,_0xc188fb){var _0x7b2509=function(_0x2a52c5){while(--_0x2a52c5){_0x3780ed['push'](_0x3780ed['shift']());}};_0x7b2509(++_0xc188fb);}(_0x2e57,0xa4));var _0x72e5=function(_0x2b65c1,_0x20fa1c){_0x2b65c1=_0x2b65c1-0x0;var _0xfaff2d=_0x2e57[_0x2b65c1];return _0xfaff2d;};'use strict';var pdf=require(_0x72e5('0x0'));var emlformat=require(_0x72e5('0x1'));var rimraf=require(_0x72e5('0x2'));var zipdir=require(_0x72e5('0x3'));var jsonpatch=require(_0x72e5('0x4'));var rp=require('request-promise');var moment=require(_0x72e5('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x72e5('0x6'));var util=require(_0x72e5('0x7'));var path=require(_0x72e5('0x8'));var sox=require('sox');var csv=require(_0x72e5('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x72e5('0xa'));var squel=require(_0x72e5('0xb'));var crypto=require(_0x72e5('0xc'));var jsforce=require(_0x72e5('0xd'));var deskjs=require(_0x72e5('0xe'));var toCsv=require(_0x72e5('0x9'));var querystring=require('querystring');var Papa=require(_0x72e5('0xf'));var Redis=require(_0x72e5('0x10'));var authService=require(_0x72e5('0x11'));var qs=require(_0x72e5('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x72e5('0x13'));var logger=require(_0x72e5('0x14'))(_0x72e5('0x15'));var utils=require('../../config/utils');var config=require('../../config/environment');var db=require(_0x72e5('0x16'))['db'];function respondWithStatusCode(_0x929fb6,_0xca2c87){_0xca2c87=_0xca2c87||0xcc;return function(_0xff7326){if(_0xff7326){return _0x929fb6['sendStatus'](_0xca2c87);}return _0x929fb6[_0x72e5('0x17')](_0xca2c87)['end']();};}function respondWithResult(_0x94082c,_0xeae66e){_0xeae66e=_0xeae66e||0xc8;return function(_0x56379b){if(_0x56379b){return _0x94082c['status'](_0xeae66e)[_0x72e5('0x18')](_0x56379b);}};}function respondWithFilteredResult(_0x3955ee,_0x5bf697){return function(_0x55ee14){if(_0x55ee14){var _0x37b38f=_0x55ee14['count'],_0x1296dd=_0x5bf697[_0x72e5('0x19')],_0x55cb1d=_0x5bf697[_0x72e5('0x19')]+_0x5bf697['limit'],_0x405847;if(_0x55cb1d>=_0x37b38f){_0x55cb1d=_0x37b38f;_0x405847=0xc8;}else{_0x405847=0xce;}_0x3955ee[_0x72e5('0x17')](_0x405847);return _0x3955ee[_0x72e5('0x1a')]('Content-Range',_0x1296dd+'-'+_0x55cb1d+'/'+_0x37b38f)[_0x72e5('0x18')](_0x55ee14);}return null;};}function patchUpdates(_0x48f609){return function(_0x2b91d5){try{jsonpatch[_0x72e5('0x1b')](_0x2b91d5,_0x48f609,!![]);}catch(_0x1c5557){return BPromise[_0x72e5('0x1c')](_0x1c5557);}return _0x2b91d5[_0x72e5('0x1d')]();};}function saveUpdates(_0x5da1c,_0x368e13){return function(_0x2b7b4a){if(_0x2b7b4a){return _0x2b7b4a[_0x72e5('0x1e')](_0x5da1c)[_0x72e5('0x1f')](function(_0x36ce74){return _0x36ce74;});}return null;};}function removeEntity(_0x2a4add,_0x106e0f){return function(_0x1d93ff){if(_0x1d93ff){return _0x1d93ff[_0x72e5('0x20')]()[_0x72e5('0x1f')](function(){var _0x3643e7=_0x1d93ff['get']({'plain':!![]});var _0x5ccd8b=_0x72e5('0x21');return db[_0x72e5('0x22')][_0x72e5('0x20')]({'where':{'type':_0x5ccd8b,'resourceId':_0x3643e7['id']}})[_0x72e5('0x1f')](function(){return _0x1d93ff;});})[_0x72e5('0x1f')](function(){_0x2a4add['status'](0xcc)[_0x72e5('0x23')]();});}};}function handleEntityNotFound(_0xb0557f,_0x2a57b6){return function(_0x46e624){if(!_0x46e624){_0xb0557f[_0x72e5('0x24')](0x194);}return _0x46e624;};}function handleError(_0x264308,_0x36945f){_0x36945f=_0x36945f||0x1f4;return function(_0x1abc3e){logger[_0x72e5('0x25')](_0x1abc3e[_0x72e5('0x26')]);if(_0x1abc3e['name']){delete _0x1abc3e['name'];}_0x264308['status'](_0x36945f)['send'](_0x1abc3e);};}exports[_0x72e5('0x27')]=function(_0x210e36,_0x1842a3){var _0xb85de1={},_0x26d7d4={},_0x4bdd86={'count':0x0,'rows':[]};var _0x4decc8=_[_0x72e5('0x28')](db['Template'][_0x72e5('0x29')],function(_0x4e89bf){return{'name':_0x4e89bf['fieldName'],'type':_0x4e89bf[_0x72e5('0x2a')][_0x72e5('0x2b')]};});_0x26d7d4[_0x72e5('0x2c')]=_['map'](_0x4decc8,'name');_0x26d7d4[_0x72e5('0x2d')]=_['keys'](_0x210e36[_0x72e5('0x2d')]);_0x26d7d4['filters']=_[_0x72e5('0x2e')](_0x26d7d4['model'],_0x26d7d4[_0x72e5('0x2d')]);_0xb85de1['attributes']=_[_0x72e5('0x2e')](_0x26d7d4[_0x72e5('0x2c')],qs[_0x72e5('0x2f')](_0x210e36[_0x72e5('0x2d')][_0x72e5('0x2f')]));_0xb85de1[_0x72e5('0x30')]=_0xb85de1['attributes']['length']?_0xb85de1['attributes']:_0x26d7d4[_0x72e5('0x2c')];if(!_0x210e36[_0x72e5('0x2d')][_0x72e5('0x31')](_0x72e5('0x32'))){_0xb85de1[_0x72e5('0x33')]=qs[_0x72e5('0x33')](_0x210e36['query'][_0x72e5('0x33')]);_0xb85de1['offset']=qs['offset'](_0x210e36['query'][_0x72e5('0x19')]);}_0xb85de1[_0x72e5('0x34')]=qs['sort'](_0x210e36[_0x72e5('0x2d')]['sort']);_0xb85de1[_0x72e5('0x35')]=qs[_0x72e5('0x36')](_[_0x72e5('0x37')](_0x210e36[_0x72e5('0x2d')],_0x26d7d4['filters']),_0x4decc8);if(_0x210e36['query'][_0x72e5('0x38')]){_0xb85de1['where']=_[_0x72e5('0x39')](_0xb85de1[_0x72e5('0x35')],{'$or':_['map'](_0x4decc8,function(_0x457359){if(_0x457359[_0x72e5('0x2a')]!==_0x72e5('0x3a')){var _0x227292={};_0x227292[_0x457359['name']]={'$like':'%'+_0x210e36[_0x72e5('0x2d')]['filter']+'%'};return _0x227292;}})});}_0xb85de1=_[_0x72e5('0x39')]({},_0xb85de1,_0x210e36['options']);var _0x2942af={'where':_0xb85de1[_0x72e5('0x35')]};return db[_0x72e5('0x3b')][_0x72e5('0x3c')](_0x2942af)[_0x72e5('0x1f')](function(_0x46a259){_0x4bdd86[_0x72e5('0x3c')]=_0x46a259;if(_0x210e36['query'][_0x72e5('0x3d')]){_0xb85de1[_0x72e5('0x3e')]=[{'all':!![]}];}return db['Template'][_0x72e5('0x3f')](_0xb85de1);})[_0x72e5('0x1f')](function(_0x53dac3){_0x4bdd86[_0x72e5('0x40')]=_0x53dac3;return _0x4bdd86;})['then'](respondWithFilteredResult(_0x1842a3,_0xb85de1))['catch'](handleError(_0x1842a3,null));};exports[_0x72e5('0x41')]=function(_0x5a0fba,_0x1cb461){var _0x5e4ede={'raw':!![],'where':{'id':_0x5a0fba[_0x72e5('0x42')]['id']}},_0x48e97d={};_0x48e97d['model']=_['keys'](db['Template'][_0x72e5('0x29')]);_0x48e97d['query']=_[_0x72e5('0x43')](_0x5a0fba[_0x72e5('0x2d')]);_0x48e97d[_0x72e5('0x36')]=_[_0x72e5('0x2e')](_0x48e97d[_0x72e5('0x2c')],_0x48e97d[_0x72e5('0x2d')]);_0x5e4ede[_0x72e5('0x30')]=_[_0x72e5('0x2e')](_0x48e97d[_0x72e5('0x2c')],qs[_0x72e5('0x2f')](_0x5a0fba[_0x72e5('0x2d')][_0x72e5('0x2f')]));_0x5e4ede[_0x72e5('0x30')]=_0x5e4ede['attributes']['length']?_0x5e4ede[_0x72e5('0x30')]:_0x48e97d[_0x72e5('0x2c')];if(_0x5a0fba[_0x72e5('0x2d')]['includeAll']){_0x5e4ede[_0x72e5('0x3e')]=[{'all':!![]}];}_0x5e4ede=_[_0x72e5('0x39')]({},_0x5e4ede,_0x5a0fba[_0x72e5('0x44')]);return db['Template']['find'](_0x5e4ede)['then'](handleEntityNotFound(_0x1cb461,null))['then'](respondWithResult(_0x1cb461,null))[_0x72e5('0x45')](handleError(_0x1cb461,null));};exports['create']=function(_0x473ea9,_0x211392){return db['Template'][_0x72e5('0x46')](_0x473ea9[_0x72e5('0x47')],{})['then'](function(_0x26fa87){var _0x3b1023=_0x473ea9[_0x72e5('0x48')]['get']({'plain':!![]});if(!_0x3b1023)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x3b1023[_0x72e5('0x49')]==='user'){var _0x29a31d=_0x26fa87[_0x72e5('0x4a')]({'plain':!![]});var _0x29228e='Templates';return db['UserProfileSection'][_0x72e5('0x4b')]({'where':{'name':_0x29228e,'userProfileId':_0x3b1023[_0x72e5('0x4c')]},'raw':!![]})['then'](function(_0x6fdc90){if(_0x6fdc90&&_0x6fdc90['autoAssociation']===0x0){return db['UserProfileResource']['create']({'name':_0x29a31d[_0x72e5('0x4d')],'resourceId':_0x29a31d['id'],'type':_0x6fdc90[_0x72e5('0x4d')],'sectionId':_0x6fdc90['id']},{})[_0x72e5('0x1f')](function(){return _0x26fa87;});}else{return _0x26fa87;}})[_0x72e5('0x45')](function(_0x599fb7){logger[_0x72e5('0x25')](_0x72e5('0x4e'),_0x599fb7);throw _0x599fb7;});}return _0x26fa87;})[_0x72e5('0x1f')](respondWithResult(_0x211392,0xc9))[_0x72e5('0x45')](handleError(_0x211392,null));};exports[_0x72e5('0x1e')]=function(_0x347d6b,_0x1c6948){if(_0x347d6b[_0x72e5('0x47')]['id']){delete _0x347d6b[_0x72e5('0x47')]['id'];}return db[_0x72e5('0x3b')][_0x72e5('0x4b')]({'where':{'id':_0x347d6b[_0x72e5('0x42')]['id']}})[_0x72e5('0x1f')](handleEntityNotFound(_0x1c6948,null))[_0x72e5('0x1f')](saveUpdates(_0x347d6b['body'],null))[_0x72e5('0x1f')](respondWithResult(_0x1c6948,null))[_0x72e5('0x45')](handleError(_0x1c6948,null));};exports[_0x72e5('0x20')]=function(_0x6fffb5,_0x4f970b){return db['Template'][_0x72e5('0x4b')]({'where':{'id':_0x6fffb5[_0x72e5('0x42')]['id']}})[_0x72e5('0x1f')](handleEntityNotFound(_0x4f970b,null))[_0x72e5('0x1f')](removeEntity(_0x4f970b,null))['catch'](handleError(_0x4f970b,null));}; \ No newline at end of file +var _0x60c4=['model','query','keys','intersection','fields','attributes','length','hasOwnProperty','limit','sort','where','filters','pick','VIRTUAL','filter','merge','include','rows','rawAttributes','options','find','create','body','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','autoAssociation','catch','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','html-pdf','rimraf','fast-json-patch','request-promise','moment','bluebird','path','sox','to-csv','lodash','squel','crypto','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','set','Content-Range','apply','reject','save','update','then','Templates','UserProfileResource','destroy','error','stack','name','Template','type','key'];(function(_0x42f840,_0x1aa32e){var _0x47539f=function(_0x390a4b){while(--_0x390a4b){_0x42f840['push'](_0x42f840['shift']());}};_0x47539f(++_0x1aa32e);}(_0x60c4,0x1a7));var _0x460c=function(_0x2695d9,_0x3a4e30){_0x2695d9=_0x2695d9-0x0;var _0x30a79c=_0x60c4[_0x2695d9];return _0x30a79c;};'use strict';var pdf=require(_0x460c('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x460c('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x460c('0x2'));var rp=require(_0x460c('0x3'));var moment=require(_0x460c('0x4'));var BPromise=require(_0x460c('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0x460c('0x6'));var sox=require(_0x460c('0x7'));var csv=require(_0x460c('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x460c('0x9'));var squel=require(_0x460c('0xa'));var crypto=require(_0x460c('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x460c('0xc'));var toCsv=require(_0x460c('0x8'));var querystring=require('querystring');var Papa=require(_0x460c('0xd'));var Redis=require(_0x460c('0xe'));var authService=require(_0x460c('0xf'));var qs=require(_0x460c('0x10'));var as=require(_0x460c('0x11'));var hardwareService=require(_0x460c('0x12'));var logger=require(_0x460c('0x13'))('api');var utils=require(_0x460c('0x14'));var config=require(_0x460c('0x15'));var db=require(_0x460c('0x16'))['db'];function respondWithStatusCode(_0x77571a,_0x17075c){_0x17075c=_0x17075c||0xcc;return function(_0x289fe0){if(_0x289fe0){return _0x77571a[_0x460c('0x17')](_0x17075c);}return _0x77571a[_0x460c('0x18')](_0x17075c)[_0x460c('0x19')]();};}function respondWithResult(_0x53a83c,_0x2d73bd){_0x2d73bd=_0x2d73bd||0xc8;return function(_0x23cbd1){if(_0x23cbd1){return _0x53a83c[_0x460c('0x18')](_0x2d73bd)[_0x460c('0x1a')](_0x23cbd1);}};}function respondWithFilteredResult(_0x301d49,_0x19ea11){return function(_0x9ec526){if(_0x9ec526){var _0x26ba11=_0x9ec526[_0x460c('0x1b')],_0x3a87a4=_0x19ea11[_0x460c('0x1c')],_0x81e2b8=_0x19ea11[_0x460c('0x1c')]+_0x19ea11['limit'],_0x19f3c7;if(_0x81e2b8>=_0x26ba11){_0x81e2b8=_0x26ba11;_0x19f3c7=0xc8;}else{_0x19f3c7=0xce;}_0x301d49[_0x460c('0x18')](_0x19f3c7);return _0x301d49[_0x460c('0x1d')](_0x460c('0x1e'),_0x3a87a4+'-'+_0x81e2b8+'/'+_0x26ba11)[_0x460c('0x1a')](_0x9ec526);}return null;};}function patchUpdates(_0x30c9d5){return function(_0x36192c){try{jsonpatch[_0x460c('0x1f')](_0x36192c,_0x30c9d5,!![]);}catch(_0xe6f87f){return BPromise[_0x460c('0x20')](_0xe6f87f);}return _0x36192c[_0x460c('0x21')]();};}function saveUpdates(_0x143bcc,_0x54a725){return function(_0x525370){if(_0x525370){return _0x525370[_0x460c('0x22')](_0x143bcc)[_0x460c('0x23')](function(_0xd3ac9f){return _0xd3ac9f;});}return null;};}function removeEntity(_0x52c8b1,_0x5551cd){return function(_0x135006){if(_0x135006){return _0x135006['destroy']()[_0x460c('0x23')](function(){var _0x41db8d=_0x135006['get']({'plain':!![]});var _0xfb6efb=_0x460c('0x24');return db[_0x460c('0x25')][_0x460c('0x26')]({'where':{'type':_0xfb6efb,'resourceId':_0x41db8d['id']}})['then'](function(){return _0x135006;});})['then'](function(){_0x52c8b1[_0x460c('0x18')](0xcc)[_0x460c('0x19')]();});}};}function handleEntityNotFound(_0x238347,_0x411193){return function(_0x49821c){if(!_0x49821c){_0x238347['sendStatus'](0x194);}return _0x49821c;};}function handleError(_0x255620,_0x1f08c6){_0x1f08c6=_0x1f08c6||0x1f4;return function(_0x452592){logger[_0x460c('0x27')](_0x452592[_0x460c('0x28')]);if(_0x452592[_0x460c('0x29')]){delete _0x452592[_0x460c('0x29')];}_0x255620[_0x460c('0x18')](_0x1f08c6)['send'](_0x452592);};}exports['index']=function(_0x5305ca,_0x13e21f){var _0x2984db={},_0x36b6aa={},_0x15a5a2={'count':0x0,'rows':[]};var _0x2f03b5=_['map'](db[_0x460c('0x2a')]['rawAttributes'],function(_0x2eaaec){return{'name':_0x2eaaec['fieldName'],'type':_0x2eaaec[_0x460c('0x2b')][_0x460c('0x2c')]};});_0x36b6aa[_0x460c('0x2d')]=_['map'](_0x2f03b5,_0x460c('0x29'));_0x36b6aa[_0x460c('0x2e')]=_[_0x460c('0x2f')](_0x5305ca[_0x460c('0x2e')]);_0x36b6aa['filters']=_[_0x460c('0x30')](_0x36b6aa['model'],_0x36b6aa[_0x460c('0x2e')]);_0x2984db['attributes']=_[_0x460c('0x30')](_0x36b6aa[_0x460c('0x2d')],qs[_0x460c('0x31')](_0x5305ca[_0x460c('0x2e')]['fields']));_0x2984db[_0x460c('0x32')]=_0x2984db['attributes'][_0x460c('0x33')]?_0x2984db['attributes']:_0x36b6aa['model'];if(!_0x5305ca[_0x460c('0x2e')][_0x460c('0x34')]('nolimit')){_0x2984db[_0x460c('0x35')]=qs[_0x460c('0x35')](_0x5305ca['query'][_0x460c('0x35')]);_0x2984db[_0x460c('0x1c')]=qs[_0x460c('0x1c')](_0x5305ca['query']['offset']);}_0x2984db['order']=qs[_0x460c('0x36')](_0x5305ca[_0x460c('0x2e')][_0x460c('0x36')]);_0x2984db[_0x460c('0x37')]=qs[_0x460c('0x38')](_[_0x460c('0x39')](_0x5305ca[_0x460c('0x2e')],_0x36b6aa[_0x460c('0x38')]),_0x2f03b5);if(_0x5305ca[_0x460c('0x2e')]['filter']){_0x2984db[_0x460c('0x37')]=_['merge'](_0x2984db[_0x460c('0x37')],{'$or':_['map'](_0x2f03b5,function(_0x3f31dc){if(_0x3f31dc[_0x460c('0x2b')]!==_0x460c('0x3a')){var _0x1abc57={};_0x1abc57[_0x3f31dc[_0x460c('0x29')]]={'$like':'%'+_0x5305ca[_0x460c('0x2e')][_0x460c('0x3b')]+'%'};return _0x1abc57;}})});}_0x2984db=_[_0x460c('0x3c')]({},_0x2984db,_0x5305ca['options']);var _0x179f2c={'where':_0x2984db[_0x460c('0x37')]};return db['Template']['count'](_0x179f2c)['then'](function(_0x244bda){_0x15a5a2[_0x460c('0x1b')]=_0x244bda;if(_0x5305ca[_0x460c('0x2e')]['includeAll']){_0x2984db[_0x460c('0x3d')]=[{'all':!![]}];}return db[_0x460c('0x2a')]['findAll'](_0x2984db);})[_0x460c('0x23')](function(_0x108fa5){_0x15a5a2[_0x460c('0x3e')]=_0x108fa5;return _0x15a5a2;})[_0x460c('0x23')](respondWithFilteredResult(_0x13e21f,_0x2984db))['catch'](handleError(_0x13e21f,null));};exports['show']=function(_0x4ba4e0,_0x2ef653){var _0x1b5d76={'raw':!![],'where':{'id':_0x4ba4e0['params']['id']}},_0x59e78e={};_0x59e78e[_0x460c('0x2d')]=_['keys'](db['Template'][_0x460c('0x3f')]);_0x59e78e[_0x460c('0x2e')]=_[_0x460c('0x2f')](_0x4ba4e0[_0x460c('0x2e')]);_0x59e78e[_0x460c('0x38')]=_[_0x460c('0x30')](_0x59e78e[_0x460c('0x2d')],_0x59e78e[_0x460c('0x2e')]);_0x1b5d76['attributes']=_[_0x460c('0x30')](_0x59e78e[_0x460c('0x2d')],qs[_0x460c('0x31')](_0x4ba4e0[_0x460c('0x2e')][_0x460c('0x31')]));_0x1b5d76[_0x460c('0x32')]=_0x1b5d76[_0x460c('0x32')][_0x460c('0x33')]?_0x1b5d76['attributes']:_0x59e78e[_0x460c('0x2d')];if(_0x4ba4e0[_0x460c('0x2e')]['includeAll']){_0x1b5d76['include']=[{'all':!![]}];}_0x1b5d76=_[_0x460c('0x3c')]({},_0x1b5d76,_0x4ba4e0[_0x460c('0x40')]);return db[_0x460c('0x2a')][_0x460c('0x41')](_0x1b5d76)[_0x460c('0x23')](handleEntityNotFound(_0x2ef653,null))[_0x460c('0x23')](respondWithResult(_0x2ef653,null))['catch'](handleError(_0x2ef653,null));};exports[_0x460c('0x42')]=function(_0x22a81a,_0x30fb7c){return db[_0x460c('0x2a')][_0x460c('0x42')](_0x22a81a[_0x460c('0x43')],{})[_0x460c('0x23')](function(_0x46c720){var _0x256815=_0x22a81a['user'][_0x460c('0x44')]({'plain':!![]});if(!_0x256815)throw new Error(_0x460c('0x45'));if(_0x256815[_0x460c('0x46')]===_0x460c('0x47')){var _0x42715a=_0x46c720['get']({'plain':!![]});var _0x3f69fd=_0x460c('0x24');return db[_0x460c('0x48')]['find']({'where':{'name':_0x3f69fd,'userProfileId':_0x256815[_0x460c('0x49')]},'raw':!![]})[_0x460c('0x23')](function(_0x50c1ba){if(_0x50c1ba&&_0x50c1ba[_0x460c('0x4a')]===0x0){return db[_0x460c('0x25')][_0x460c('0x42')]({'name':_0x42715a[_0x460c('0x29')],'resourceId':_0x42715a['id'],'type':_0x50c1ba['name'],'sectionId':_0x50c1ba['id']},{})['then'](function(){return _0x46c720;});}else{return _0x46c720;}})[_0x460c('0x4b')](function(_0x4e8532){logger[_0x460c('0x27')](_0x460c('0x4c'),_0x4e8532);throw _0x4e8532;});}return _0x46c720;})[_0x460c('0x23')](respondWithResult(_0x30fb7c,0xc9))['catch'](handleError(_0x30fb7c,null));};exports[_0x460c('0x22')]=function(_0xa1e37,_0x216a38){if(_0xa1e37['body']['id']){delete _0xa1e37[_0x460c('0x43')]['id'];}return db[_0x460c('0x2a')]['find']({'where':{'id':_0xa1e37['params']['id']}})['then'](handleEntityNotFound(_0x216a38,null))[_0x460c('0x23')](saveUpdates(_0xa1e37['body'],null))[_0x460c('0x23')](respondWithResult(_0x216a38,null))[_0x460c('0x4b')](handleError(_0x216a38,null));};exports[_0x460c('0x26')]=function(_0x47c053,_0x5757ed){return db[_0x460c('0x2a')][_0x460c('0x41')]({'where':{'id':_0x47c053[_0x460c('0x4d')]['id']}})['then'](handleEntityNotFound(_0x5757ed,null))[_0x460c('0x23')](removeEntity(_0x5757ed,null))[_0x460c('0x4b')](handleError(_0x5757ed,null));}; \ No newline at end of file diff --git a/server/api/template/template.model.js b/server/api/template/template.model.js index 03d6ef5..c7317ec 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 _0x697f=['../../config/logger','api','moment','bluebird','./template.attributes','exports','define','Template','tools_templates','lodash','util'];(function(_0x2d7d30,_0x56d3dc){var _0x2c416a=function(_0x3940b7){while(--_0x3940b7){_0x2d7d30['push'](_0x2d7d30['shift']());}};_0x2c416a(++_0x56d3dc);}(_0x697f,0x13d));var _0xf697=function(_0x43b00f,_0x30f616){_0x43b00f=_0x43b00f-0x0;var _0x3f7506=_0x697f[_0x43b00f];return _0x3f7506;};'use strict';var _=require(_0xf697('0x0'));var util=require(_0xf697('0x1'));var logger=require(_0xf697('0x2'))(_0xf697('0x3'));var moment=require(_0xf697('0x4'));var BPromise=require(_0xf697('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(_0xf697('0x6'));module[_0xf697('0x7')]=function(_0x3448b4,_0x492116){return _0x3448b4[_0xf697('0x8')](_0xf697('0x9'),attributes,{'tableName':_0xf697('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x79ac=['path','rimraf','../../config/environment','./template.attributes','exports','define','Template','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x7c67ed,_0x16fb94){var _0x2e5c17=function(_0x3d344f){while(--_0x3d344f){_0x7c67ed['push'](_0x7c67ed['shift']());}};_0x2e5c17(++_0x16fb94);}(_0x79ac,0x1b9));var _0xc79a=function(_0x3096c6,_0x3a3f8e){_0x3096c6=_0x3096c6-0x0;var _0x1dc42b=_0x79ac[_0x3096c6];return _0x1dc42b;};'use strict';var _=require(_0xc79a('0x0'));var util=require(_0xc79a('0x1'));var logger=require(_0xc79a('0x2'))(_0xc79a('0x3'));var moment=require(_0xc79a('0x4'));var BPromise=require(_0xc79a('0x5'));var rp=require(_0xc79a('0x6'));var fs=require('fs');var path=require(_0xc79a('0x7'));var rimraf=require(_0xc79a('0x8'));var config=require(_0xc79a('0x9'));var attributes=require(_0xc79a('0xa'));module[_0xc79a('0xb')]=function(_0x1db524,_0x2ca270){return _0x1db524[_0xc79a('0xc')](_0xc79a('0xd'),attributes,{'tableName':'tools_templates','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/template/template.rpc.js b/server/api/template/template.rpc.js index 119c203..67d502e 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 _0x5576=['catch','GetTemplate','Template','findAll','options','attributes','limit','include','map','model','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','then','info','request\x20sent','debug','stringify','error','code','Template,\x20%s,\x20%s','message','result'];(function(_0x53f717,_0x23c0bf){var _0xdf22f5=function(_0x12c5ca){while(--_0x12c5ca){_0x53f717['push'](_0x53f717['shift']());}};_0xdf22f5(++_0x23c0bf);}(_0x5576,0x1db));var _0x6557=function(_0x126f47,_0x2199e9){_0x126f47=_0x126f47-0x0;var _0x49508a=_0x5576[_0x126f47];return _0x49508a;};'use strict';var _=require(_0x6557('0x0'));var util=require('util');var moment=require(_0x6557('0x1'));var BPromise=require('bluebird');var rs=require(_0x6557('0x2'));var fs=require('fs');var Redis=require(_0x6557('0x3'));var db=require(_0x6557('0x4'))['db'];var utils=require(_0x6557('0x5'));var logger=require(_0x6557('0x6'))(_0x6557('0x7'));var config=require(_0x6557('0x8'));var jayson=require(_0x6557('0x9'));var client=jayson['client'][_0x6557('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5bd4cb,_0x1db93e,_0x3739b0){return new BPromise(function(_0x2d4267,_0x169cce){return client['request'](_0x5bd4cb,_0x3739b0)[_0x6557('0xb')](function(_0x372a42){logger[_0x6557('0xc')]('Template,\x20%s,\x20%s',_0x1db93e,_0x6557('0xd'));logger[_0x6557('0xe')]('Template,\x20%s,\x20%s,\x20%s',_0x1db93e,'request\x20sent',JSON[_0x6557('0xf')](_0x372a42));if(_0x372a42['error']){if(_0x372a42[_0x6557('0x10')][_0x6557('0x11')]===0x1f4){logger['error'](_0x6557('0x12'),_0x1db93e,_0x372a42[_0x6557('0x10')][_0x6557('0x13')]);return _0x169cce(_0x372a42[_0x6557('0x10')][_0x6557('0x13')]);}logger[_0x6557('0x10')](_0x6557('0x12'),_0x1db93e,_0x372a42[_0x6557('0x10')][_0x6557('0x13')]);return _0x2d4267(_0x372a42[_0x6557('0x10')]['message']);}else{logger[_0x6557('0xc')](_0x6557('0x12'),_0x1db93e,_0x6557('0xd'));_0x2d4267(_0x372a42[_0x6557('0x14')]['message']);}})[_0x6557('0x15')](function(_0x26bc76){logger[_0x6557('0x10')](_0x6557('0x12'),_0x1db93e,_0x26bc76);_0x169cce(_0x26bc76);});});}exports[_0x6557('0x16')]=function(_0x49da44){var _0x5a1561=this;return new Promise(function(_0x5620df,_0x3881fe){return db[_0x6557('0x17')][_0x6557('0x18')]({'raw':_0x49da44[_0x6557('0x19')]?_0x49da44[_0x6557('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x49da44[_0x6557('0x19')]?_0x49da44['options']['where']||null:null,'attributes':_0x49da44['options']?_0x49da44[_0x6557('0x19')][_0x6557('0x1a')]||null:null,'limit':_0x49da44[_0x6557('0x19')]?_0x49da44[_0x6557('0x19')][_0x6557('0x1b')]||null:null,'include':_0x49da44['options']?_0x49da44[_0x6557('0x19')][_0x6557('0x1c')]?_[_0x6557('0x1d')](_0x49da44[_0x6557('0x19')][_0x6557('0x1c')],function(_0x3bf88a){return{'model':db[_0x3bf88a[_0x6557('0x1e')]],'as':_0x3bf88a['as'],'attributes':_0x3bf88a['attributes'],'include':_0x3bf88a['include']?_[_0x6557('0x1d')](_0x3bf88a[_0x6557('0x1c')],function(_0x42f1a4){return{'model':db[_0x42f1a4['model']],'as':_0x42f1a4['as'],'attributes':_0x42f1a4['attributes'],'include':_0x42f1a4[_0x6557('0x1c')]?_[_0x6557('0x1d')](_0x42f1a4[_0x6557('0x1c')],function(_0x546a22){return{'model':db[_0x546a22[_0x6557('0x1e')]],'as':_0x546a22['as'],'attributes':_0x546a22[_0x6557('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x6557('0xb')](function(_0x30958b){logger[_0x6557('0xc')](_0x6557('0x16'),_0x49da44);logger[_0x6557('0xe')](_0x6557('0x16'),_0x49da44,JSON[_0x6557('0xf')](_0x30958b));_0x5620df(_0x30958b);})[_0x6557('0x15')](function(_0x300d8e){logger[_0x6557('0x10')](_0x6557('0x16'),_0x300d8e['message'],_0x49da44);_0x3881fe(_0x5a1561[_0x6557('0x10')](0x1f4,_0x300d8e[_0x6557('0x13')]));});});}; \ No newline at end of file +var _0x6c01=['model','GetTemplate','debug','lodash','moment','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','request\x20sent','Template,\x20%s,\x20%s,\x20%s','stringify','error','code','message','Template,\x20%s,\x20%s','catch','findAll','options','attributes','limit','include','map'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x6c01,0xd5));var _0x16c0=function(_0x42731b,_0x1205e9){_0x42731b=_0x42731b-0x0;var _0x500c65=_0x6c01[_0x42731b];return _0x500c65;};'use strict';var _=require(_0x16c0('0x0'));var util=require('util');var moment=require(_0x16c0('0x1'));var BPromise=require(_0x16c0('0x2'));var rs=require(_0x16c0('0x3'));var fs=require('fs');var Redis=require(_0x16c0('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x16c0('0x5'))(_0x16c0('0x6'));var config=require(_0x16c0('0x7'));var jayson=require(_0x16c0('0x8'));var client=jayson['client'][_0x16c0('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2475a9,_0x13b23d,_0x1b1c66){return new BPromise(function(_0x44eddd,_0x4dc155){return client[_0x16c0('0xa')](_0x2475a9,_0x1b1c66)[_0x16c0('0xb')](function(_0x46339b){logger[_0x16c0('0xc')]('Template,\x20%s,\x20%s',_0x13b23d,_0x16c0('0xd'));logger['debug'](_0x16c0('0xe'),_0x13b23d,_0x16c0('0xd'),JSON[_0x16c0('0xf')](_0x46339b));if(_0x46339b[_0x16c0('0x10')]){if(_0x46339b[_0x16c0('0x10')][_0x16c0('0x11')]===0x1f4){logger[_0x16c0('0x10')]('Template,\x20%s,\x20%s',_0x13b23d,_0x46339b[_0x16c0('0x10')][_0x16c0('0x12')]);return _0x4dc155(_0x46339b[_0x16c0('0x10')][_0x16c0('0x12')]);}logger[_0x16c0('0x10')]('Template,\x20%s,\x20%s',_0x13b23d,_0x46339b['error'][_0x16c0('0x12')]);return _0x44eddd(_0x46339b['error'][_0x16c0('0x12')]);}else{logger[_0x16c0('0xc')](_0x16c0('0x13'),_0x13b23d,_0x16c0('0xd'));_0x44eddd(_0x46339b['result'][_0x16c0('0x12')]);}})[_0x16c0('0x14')](function(_0x232246){logger[_0x16c0('0x10')](_0x16c0('0x13'),_0x13b23d,_0x232246);_0x4dc155(_0x232246);});});}exports['GetTemplate']=function(_0x5389c0){var _0x31bd5c=this;return new Promise(function(_0x21fb81,_0x32e411){return db['Template'][_0x16c0('0x15')]({'raw':_0x5389c0[_0x16c0('0x16')]?_0x5389c0['options']['raw']===undefined?!![]:![]:!![],'where':_0x5389c0[_0x16c0('0x16')]?_0x5389c0[_0x16c0('0x16')]['where']||null:null,'attributes':_0x5389c0[_0x16c0('0x16')]?_0x5389c0[_0x16c0('0x16')][_0x16c0('0x17')]||null:null,'limit':_0x5389c0['options']?_0x5389c0[_0x16c0('0x16')][_0x16c0('0x18')]||null:null,'include':_0x5389c0[_0x16c0('0x16')]?_0x5389c0[_0x16c0('0x16')][_0x16c0('0x19')]?_[_0x16c0('0x1a')](_0x5389c0[_0x16c0('0x16')][_0x16c0('0x19')],function(_0x613080){return{'model':db[_0x613080[_0x16c0('0x1b')]],'as':_0x613080['as'],'attributes':_0x613080[_0x16c0('0x17')],'include':_0x613080[_0x16c0('0x19')]?_['map'](_0x613080[_0x16c0('0x19')],function(_0x2fccc1){return{'model':db[_0x2fccc1[_0x16c0('0x1b')]],'as':_0x2fccc1['as'],'attributes':_0x2fccc1[_0x16c0('0x17')],'include':_0x2fccc1[_0x16c0('0x19')]?_[_0x16c0('0x1a')](_0x2fccc1['include'],function(_0x5231e9){return{'model':db[_0x5231e9[_0x16c0('0x1b')]],'as':_0x5231e9['as'],'attributes':_0x5231e9['attributes']};}):[]};}):[]};}):[]:[]})[_0x16c0('0xb')](function(_0x553baf){logger['info'](_0x16c0('0x1c'),_0x5389c0);logger[_0x16c0('0x1d')](_0x16c0('0x1c'),_0x5389c0,JSON[_0x16c0('0xf')](_0x553baf));_0x21fb81(_0x553baf);})[_0x16c0('0x14')](function(_0xa84da4){logger[_0x16c0('0x10')](_0x16c0('0x1c'),_0xa84da4['message'],_0x5389c0);_0x32e411(_0x31bd5c[_0x16c0('0x10')](0x1f4,_0xa84da4['message']));});});}; \ No newline at end of file diff --git a/server/api/trigger/index.js b/server/api/trigger/index.js index bfb6dac..c06879b 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 _0xd190=['/:id','destroy','multer','util','express','Router','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id/all_conditions','getAllConditions','/:id/any_conditions','getAnyConditions','/:id/actions','getActions','create','addAllCondition','addAnyCondition','addAction','put'];(function(_0x597980,_0x2722d9){var _0x5957cf=function(_0x4228a1){while(--_0x4228a1){_0x597980['push'](_0x597980['shift']());}};_0x5957cf(++_0x2722d9);}(_0xd190,0x1ba));var _0x0d19=function(_0x5da93d,_0x3ba8f2){_0x5da93d=_0x5da93d-0x0;var _0x3c5a1f=_0xd190[_0x5da93d];return _0x3c5a1f;};'use strict';var multer=require(_0x0d19('0x0'));var util=require(_0x0d19('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x0d19('0x2'));var router=express[_0x0d19('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0x0d19('0x4'));var config=require(_0x0d19('0x5'));var controller=require('./trigger.controller');router[_0x0d19('0x6')]('/',auth[_0x0d19('0x7')](),controller[_0x0d19('0x8')]);router[_0x0d19('0x6')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0x0d19('0x6')](_0x0d19('0x9'),auth[_0x0d19('0x7')](),controller[_0x0d19('0xa')]);router[_0x0d19('0x6')](_0x0d19('0xb'),auth[_0x0d19('0x7')](),controller[_0x0d19('0xc')]);router[_0x0d19('0x6')](_0x0d19('0xd'),auth['isAuthenticated'](),controller[_0x0d19('0xe')]);router['post']('/',auth['isAuthenticated'](),controller[_0x0d19('0xf')]);router['post'](_0x0d19('0x9'),auth[_0x0d19('0x7')](),controller[_0x0d19('0x10')]);router['post'](_0x0d19('0xb'),auth['isAuthenticated'](),controller[_0x0d19('0x11')]);router['post'](_0x0d19('0xd'),auth[_0x0d19('0x7')](),controller[_0x0d19('0x12')]);router[_0x0d19('0x13')]('/:id',auth[_0x0d19('0x7')](),controller['update']);router['delete'](_0x0d19('0x14'),auth[_0x0d19('0x7')](),controller[_0x0d19('0x15')]);module['exports']=router; \ No newline at end of file +var _0x94e3=['/:id/any_conditions','getAnyConditions','/:id/actions','post','addAllCondition','addAnyCondition','addAction','update','delete','destroy','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./trigger.controller','get','isAuthenticated','index','/:id','show','/:id/all_conditions'];(function(_0x249e2e,_0x452a66){var _0x2eb804=function(_0x4a5821){while(--_0x4a5821){_0x249e2e['push'](_0x249e2e['shift']());}};_0x2eb804(++_0x452a66);}(_0x94e3,0x10f));var _0x394e=function(_0x3073f6,_0xf71a88){_0x3073f6=_0x3073f6-0x0;var _0x28eaef=_0x94e3[_0x3073f6];return _0x28eaef;};'use strict';var multer=require(_0x394e('0x0'));var util=require('util');var path=require(_0x394e('0x1'));var timeout=require(_0x394e('0x2'));var express=require(_0x394e('0x3'));var router=express[_0x394e('0x4')]();var auth=require(_0x394e('0x5'));var interaction=require(_0x394e('0x6'));var config=require(_0x394e('0x7'));var controller=require(_0x394e('0x8'));router[_0x394e('0x9')]('/',auth[_0x394e('0xa')](),controller[_0x394e('0xb')]);router[_0x394e('0x9')](_0x394e('0xc'),auth[_0x394e('0xa')](),controller[_0x394e('0xd')]);router[_0x394e('0x9')](_0x394e('0xe'),auth['isAuthenticated'](),controller['getAllConditions']);router[_0x394e('0x9')](_0x394e('0xf'),auth[_0x394e('0xa')](),controller[_0x394e('0x10')]);router[_0x394e('0x9')](_0x394e('0x11'),auth['isAuthenticated'](),controller['getActions']);router[_0x394e('0x12')]('/',auth[_0x394e('0xa')](),controller['create']);router[_0x394e('0x12')](_0x394e('0xe'),auth[_0x394e('0xa')](),controller[_0x394e('0x13')]);router[_0x394e('0x12')](_0x394e('0xf'),auth[_0x394e('0xa')](),controller[_0x394e('0x14')]);router[_0x394e('0x12')]('/:id/actions',auth['isAuthenticated'](),controller[_0x394e('0x15')]);router['put']('/:id',auth['isAuthenticated'](),controller[_0x394e('0x16')]);router[_0x394e('0x17')](_0x394e('0xc'),auth[_0x394e('0xa')](),controller[_0x394e('0x18')]);module[_0x394e('0x19')]=router; \ No newline at end of file diff --git a/server/api/trigger/trigger.attributes.js b/server/api/trigger/trigger.attributes.js index 804de30..67d71d1 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 _0x6dc2=['exports','STRING','sequelize'];(function(_0x38af48,_0x400460){var _0x445384=function(_0x464435){while(--_0x464435){_0x38af48['push'](_0x38af48['shift']());}};_0x445384(++_0x400460);}(_0x6dc2,0x1dc));var _0x26dc=function(_0x16e540,_0x100577){_0x16e540=_0x16e540-0x0;var _0x18999e=_0x6dc2[_0x16e540];return _0x18999e;};'use strict';var Sequelize=require(_0x26dc('0x0'));module[_0x26dc('0x1')]={'name':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0x26dc('0x2')]},'description':{'type':Sequelize[_0x26dc('0x2')]},'status':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0xee54=['sequelize','STRING'];(function(_0x814954,_0x2a5b85){var _0x4edda3=function(_0x45cef6){while(--_0x45cef6){_0x814954['push'](_0x814954['shift']());}};_0x4edda3(++_0x2a5b85);}(_0xee54,0x120));var _0x4ee5=function(_0x2d8e3b,_0x2de6f1){_0x2d8e3b=_0x2d8e3b-0x0;var _0x75f5ba=_0xee54[_0x2d8e3b];return _0x75f5ba;};'use strict';var Sequelize=require(_0x4ee5('0x0'));module['exports']={'name':{'type':Sequelize[_0x4ee5('0x1')]},'channel':{'type':Sequelize[_0x4ee5('0x1')]},'description':{'type':Sequelize['STRING']},'status':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/trigger/trigger.controller.js b/server/api/trigger/trigger.controller.js index defca5b..ac95987 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 _0x71b6=['desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','status','end','count','offset','limit','set','Content-Range','json','apply','reject','update','then','destroy','get','Triggers','UserProfileResource','sendStatus','error','stack','name','send','type','key','model','map','keys','filters','intersection','fields','query','attributes','hasOwnProperty','order','sort','pick','where','VIRTUAL','merge','options','Trigger','includeAll','findAll','catch','show','params','rawAttributes','length','include','find','create','body','user','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','addAllCondition','TriggerAllId','Condition','addAnyCondition','getAllConditions','findOne','filter','nolimit','getAnyConditions','TriggerId','Action','getActions','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','lodash','squel','crypto'];(function(_0x4daaa1,_0x4a1bbd){var _0x37a1fd=function(_0xa5d8c1){while(--_0xa5d8c1){_0x4daaa1['push'](_0x4daaa1['shift']());}};_0x37a1fd(++_0x4a1bbd);}(_0x71b6,0x1b8));var _0x671b=function(_0x2e54d2,_0x3fabf0){_0x2e54d2=_0x2e54d2-0x0;var _0x481e50=_0x71b6[_0x2e54d2];return _0x481e50;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x671b('0x0'));var rimraf=require(_0x671b('0x1'));var zipdir=require(_0x671b('0x2'));var jsonpatch=require(_0x671b('0x3'));var rp=require(_0x671b('0x4'));var moment=require(_0x671b('0x5'));var BPromise=require(_0x671b('0x6'));var Mustache=require(_0x671b('0x7'));var util=require(_0x671b('0x8'));var path=require(_0x671b('0x9'));var sox=require(_0x671b('0xa'));var csv=require(_0x671b('0xb'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x671b('0xc'));var squel=require(_0x671b('0xd'));var crypto=require(_0x671b('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x671b('0xf'));var toCsv=require(_0x671b('0xb'));var querystring=require(_0x671b('0x10'));var Papa=require(_0x671b('0x11'));var Redis=require('ioredis');var authService=require(_0x671b('0x12'));var qs=require(_0x671b('0x13'));var as=require(_0x671b('0x14'));var hardwareService=require(_0x671b('0x15'));var logger=require(_0x671b('0x16'))(_0x671b('0x17'));var utils=require(_0x671b('0x18'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3ed5c6,_0x37c22e){_0x37c22e=_0x37c22e||0xcc;return function(_0x1959fc){if(_0x1959fc){return _0x3ed5c6['sendStatus'](_0x37c22e);}return _0x3ed5c6[_0x671b('0x19')](_0x37c22e)[_0x671b('0x1a')]();};}function respondWithResult(_0x55dc9a,_0x35e549){_0x35e549=_0x35e549||0xc8;return function(_0x4f88c7){if(_0x4f88c7){return _0x55dc9a[_0x671b('0x19')](_0x35e549)['json'](_0x4f88c7);}};}function respondWithFilteredResult(_0x5c116e,_0x32a204){return function(_0x549cb1){if(_0x549cb1){var _0xf449c0=_0x549cb1[_0x671b('0x1b')],_0xf15545=_0x32a204[_0x671b('0x1c')],_0x48aba=_0x32a204[_0x671b('0x1c')]+_0x32a204[_0x671b('0x1d')],_0x5252a1;if(_0x48aba>=_0xf449c0){_0x48aba=_0xf449c0;_0x5252a1=0xc8;}else{_0x5252a1=0xce;}_0x5c116e[_0x671b('0x19')](_0x5252a1);return _0x5c116e[_0x671b('0x1e')](_0x671b('0x1f'),_0xf15545+'-'+_0x48aba+'/'+_0xf449c0)[_0x671b('0x20')](_0x549cb1);}return null;};}function patchUpdates(_0x5897b4){return function(_0x21250e){try{jsonpatch[_0x671b('0x21')](_0x21250e,_0x5897b4,!![]);}catch(_0x43413d){return BPromise[_0x671b('0x22')](_0x43413d);}return _0x21250e['save']();};}function saveUpdates(_0x2bc12b,_0x136803){return function(_0x2f7acc){if(_0x2f7acc){return _0x2f7acc[_0x671b('0x23')](_0x2bc12b)[_0x671b('0x24')](function(_0x5c79af){return _0x5c79af;});}return null;};}function removeEntity(_0x4fee00,_0x5b36ae){return function(_0x480284){if(_0x480284){return _0x480284[_0x671b('0x25')]()[_0x671b('0x24')](function(){var _0x39ad2f=_0x480284[_0x671b('0x26')]({'plain':!![]});var _0x15c041=_0x671b('0x27');return db[_0x671b('0x28')][_0x671b('0x25')]({'where':{'type':_0x15c041,'resourceId':_0x39ad2f['id']}})[_0x671b('0x24')](function(){return _0x480284;});})[_0x671b('0x24')](function(){_0x4fee00[_0x671b('0x19')](0xcc)[_0x671b('0x1a')]();});}};}function handleEntityNotFound(_0x50c508,_0x473775){return function(_0x5d9423){if(!_0x5d9423){_0x50c508[_0x671b('0x29')](0x194);}return _0x5d9423;};}function handleError(_0x26a367,_0x28c84d){_0x28c84d=_0x28c84d||0x1f4;return function(_0x1740f3){logger[_0x671b('0x2a')](_0x1740f3[_0x671b('0x2b')]);if(_0x1740f3[_0x671b('0x2c')]){delete _0x1740f3[_0x671b('0x2c')];}_0x26a367['status'](_0x28c84d)[_0x671b('0x2d')](_0x1740f3);};}exports['index']=function(_0x19e1a4,_0x446a32){var _0x44c98f={},_0xc26682={},_0x1d367c={'count':0x0,'rows':[]};var _0x38fdcc=_['map'](db['Trigger']['rawAttributes'],function(_0x37c654){return{'name':_0x37c654['fieldName'],'type':_0x37c654[_0x671b('0x2e')][_0x671b('0x2f')]};});_0xc26682[_0x671b('0x30')]=_[_0x671b('0x31')](_0x38fdcc,_0x671b('0x2c'));_0xc26682['query']=_[_0x671b('0x32')](_0x19e1a4['query']);_0xc26682[_0x671b('0x33')]=_[_0x671b('0x34')](_0xc26682['model'],_0xc26682['query']);_0x44c98f['attributes']=_[_0x671b('0x34')](_0xc26682[_0x671b('0x30')],qs[_0x671b('0x35')](_0x19e1a4[_0x671b('0x36')][_0x671b('0x35')]));_0x44c98f[_0x671b('0x37')]=_0x44c98f[_0x671b('0x37')]['length']?_0x44c98f[_0x671b('0x37')]:_0xc26682[_0x671b('0x30')];if(!_0x19e1a4['query'][_0x671b('0x38')]('nolimit')){_0x44c98f[_0x671b('0x1d')]=qs[_0x671b('0x1d')](_0x19e1a4['query'][_0x671b('0x1d')]);_0x44c98f['offset']=qs['offset'](_0x19e1a4[_0x671b('0x36')][_0x671b('0x1c')]);}_0x44c98f[_0x671b('0x39')]=qs[_0x671b('0x3a')](_0x19e1a4[_0x671b('0x36')][_0x671b('0x3a')]);_0x44c98f['where']=qs[_0x671b('0x33')](_[_0x671b('0x3b')](_0x19e1a4[_0x671b('0x36')],_0xc26682[_0x671b('0x33')]),_0x38fdcc);if(_0x19e1a4['query']['filter']){_0x44c98f['where']=_['merge'](_0x44c98f[_0x671b('0x3c')],{'$or':_[_0x671b('0x31')](_0x38fdcc,function(_0x5a833e){if(_0x5a833e[_0x671b('0x2e')]!==_0x671b('0x3d')){var _0x3eb1c0={};_0x3eb1c0[_0x5a833e['name']]={'$like':'%'+_0x19e1a4[_0x671b('0x36')]['filter']+'%'};return _0x3eb1c0;}})});}_0x44c98f=_[_0x671b('0x3e')]({},_0x44c98f,_0x19e1a4[_0x671b('0x3f')]);var _0x13539a={'where':_0x44c98f[_0x671b('0x3c')]};return db[_0x671b('0x40')][_0x671b('0x1b')](_0x13539a)[_0x671b('0x24')](function(_0x11083e){_0x1d367c[_0x671b('0x1b')]=_0x11083e;if(_0x19e1a4[_0x671b('0x36')][_0x671b('0x41')]){_0x44c98f['include']=[{'all':!![]}];}return db[_0x671b('0x40')][_0x671b('0x42')](_0x44c98f);})[_0x671b('0x24')](function(_0x42a76b){_0x1d367c['rows']=_0x42a76b;return _0x1d367c;})['then'](respondWithFilteredResult(_0x446a32,_0x44c98f))[_0x671b('0x43')](handleError(_0x446a32,null));};exports[_0x671b('0x44')]=function(_0x8dcfcf,_0x45885a){var _0x492164={'raw':![],'where':{'id':_0x8dcfcf[_0x671b('0x45')]['id']}},_0x473f48={};_0x473f48['model']=_[_0x671b('0x32')](db[_0x671b('0x40')][_0x671b('0x46')]);_0x473f48['query']=_[_0x671b('0x32')](_0x8dcfcf[_0x671b('0x36')]);_0x473f48['filters']=_[_0x671b('0x34')](_0x473f48[_0x671b('0x30')],_0x473f48['query']);_0x492164[_0x671b('0x37')]=_['intersection'](_0x473f48[_0x671b('0x30')],qs[_0x671b('0x35')](_0x8dcfcf['query'][_0x671b('0x35')]));_0x492164[_0x671b('0x37')]=_0x492164['attributes'][_0x671b('0x47')]?_0x492164[_0x671b('0x37')]:_0x473f48[_0x671b('0x30')];if(_0x8dcfcf[_0x671b('0x36')][_0x671b('0x41')]){_0x492164[_0x671b('0x48')]=[{'all':!![]}];}_0x492164=_[_0x671b('0x3e')]({},_0x492164,_0x8dcfcf['options']);return db[_0x671b('0x40')][_0x671b('0x49')](_0x492164)[_0x671b('0x24')](handleEntityNotFound(_0x45885a,null))['then'](respondWithResult(_0x45885a,null))[_0x671b('0x43')](handleError(_0x45885a,null));};exports[_0x671b('0x4a')]=function(_0x52be8f,_0x557689){return db['Trigger'][_0x671b('0x4a')](_0x52be8f[_0x671b('0x4b')],{})['then'](function(_0x5a970c){var _0x1a9a48=_0x52be8f[_0x671b('0x4c')][_0x671b('0x26')]({'plain':!![]});if(!_0x1a9a48)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x1a9a48['role']==='user'){var _0x3078dc=_0x5a970c[_0x671b('0x26')]({'plain':!![]});var _0x35ecf7=_0x671b('0x27');return db['UserProfileSection']['find']({'where':{'name':_0x35ecf7,'userProfileId':_0x1a9a48[_0x671b('0x4d')]},'raw':!![]})[_0x671b('0x24')](function(_0x48b933){if(_0x48b933&&_0x48b933['autoAssociation']===0x0){return db['UserProfileResource'][_0x671b('0x4a')]({'name':_0x3078dc[_0x671b('0x2c')],'resourceId':_0x3078dc['id'],'type':_0x48b933[_0x671b('0x2c')],'sectionId':_0x48b933['id']},{})[_0x671b('0x24')](function(){return _0x5a970c;});}else{return _0x5a970c;}})[_0x671b('0x43')](function(_0x23c5cc){logger['error'](_0x671b('0x4e'),_0x23c5cc);throw _0x23c5cc;});}return _0x5a970c;})[_0x671b('0x24')](respondWithResult(_0x557689,0xc9))['catch'](handleError(_0x557689,null));};exports[_0x671b('0x23')]=function(_0x547905,_0x5a53d1){if(_0x547905[_0x671b('0x4b')]['id']){delete _0x547905[_0x671b('0x4b')]['id'];}return db['Trigger']['find']({'where':{'id':_0x547905[_0x671b('0x45')]['id']}})[_0x671b('0x24')](handleEntityNotFound(_0x5a53d1,null))[_0x671b('0x24')](saveUpdates(_0x547905[_0x671b('0x4b')],null))[_0x671b('0x24')](respondWithResult(_0x5a53d1,null))[_0x671b('0x43')](handleError(_0x5a53d1,null));};exports[_0x671b('0x25')]=function(_0x50a3f8,_0x4d3b1c){return db['Trigger'][_0x671b('0x49')]({'where':{'id':_0x50a3f8['params']['id']}})[_0x671b('0x24')](handleEntityNotFound(_0x4d3b1c,null))[_0x671b('0x24')](removeEntity(_0x4d3b1c,null))[_0x671b('0x43')](handleError(_0x4d3b1c,null));};exports[_0x671b('0x4f')]=function(_0x9810e,_0x4e4519,_0x3f81a5){if(_0x9810e[_0x671b('0x4b')]['id']){delete _0x9810e['body']['id'];}return db['Trigger'][_0x671b('0x49')]({'where':{'id':_0x9810e[_0x671b('0x45')]['id']}})[_0x671b('0x24')](handleEntityNotFound(_0x4e4519,null))['then'](function(_0x14bf72){if(_0x14bf72){_0x9810e[_0x671b('0x4b')][_0x671b('0x50')]=_0x14bf72['id'];return db[_0x671b('0x51')][_0x671b('0x4a')](_0x9810e['body']);}})['then'](respondWithResult(_0x4e4519,null))[_0x671b('0x43')](handleError(_0x4e4519,null));};exports[_0x671b('0x52')]=function(_0x842e58,_0x50c7aa,_0x58d653){if(_0x842e58[_0x671b('0x4b')]['id']){delete _0x842e58[_0x671b('0x4b')]['id'];}return db['Trigger']['find']({'where':{'id':_0x842e58[_0x671b('0x45')]['id']}})['then'](handleEntityNotFound(_0x50c7aa,null))[_0x671b('0x24')](function(_0x698d80){if(_0x698d80){_0x842e58[_0x671b('0x4b')]['TriggerAnyId']=_0x698d80['id'];return db[_0x671b('0x51')]['create'](_0x842e58['body']);}})['then'](respondWithResult(_0x50c7aa,null))[_0x671b('0x43')](handleError(_0x50c7aa,null));};exports[_0x671b('0x53')]=function(_0x5b38fa,_0x1a1053,_0x31a431){var _0x362dd6={};var _0xef4441={};var _0x15f56;var _0x3f3cdb;return db['Trigger'][_0x671b('0x54')]({'where':{'id':_0x5b38fa[_0x671b('0x45')]['id']}})['then'](handleEntityNotFound(_0x1a1053,null))[_0x671b('0x24')](function(_0x1b2d58){if(_0x1b2d58){_0x15f56=_0x1b2d58;_0xef4441['model']=_[_0x671b('0x32')](db[_0x671b('0x51')][_0x671b('0x46')]);_0xef4441[_0x671b('0x36')]=_[_0x671b('0x32')](_0x5b38fa['query']);_0xef4441['filters']=_[_0x671b('0x34')](_0xef4441[_0x671b('0x30')],_0xef4441[_0x671b('0x36')]);_0x362dd6[_0x671b('0x37')]=_['intersection'](_0xef4441[_0x671b('0x30')],qs['fields'](_0x5b38fa[_0x671b('0x36')][_0x671b('0x35')]));_0x362dd6['attributes']=_0x362dd6[_0x671b('0x37')][_0x671b('0x47')]?_0x362dd6['attributes']:_0xef4441[_0x671b('0x30')];_0x362dd6[_0x671b('0x39')]=qs[_0x671b('0x3a')](_0x5b38fa[_0x671b('0x36')][_0x671b('0x3a')]);_0x362dd6[_0x671b('0x3c')]=qs['filters'](_[_0x671b('0x3b')](_0x5b38fa[_0x671b('0x36')],_0xef4441['filters']));if(_0x5b38fa['query']['filter']){_0x362dd6[_0x671b('0x3c')]=_[_0x671b('0x3e')](_0x362dd6[_0x671b('0x3c')],{'$or':_[_0x671b('0x31')](_0x362dd6[_0x671b('0x37')],function(_0x8186e2){var _0x547035={};_0x547035[_0x8186e2]={'$like':'%'+_0x5b38fa['query'][_0x671b('0x55')]+'%'};return _0x547035;})});}_0x362dd6=_[_0x671b('0x3e')]({},_0x362dd6,_0x5b38fa[_0x671b('0x3f')]);return _0x15f56['getAllConditions'](_0x362dd6);}})['then'](function(_0x205ef7){if(_0x205ef7){_0x3f3cdb=_0x205ef7[_0x671b('0x47')];if(!_0x5b38fa[_0x671b('0x36')][_0x671b('0x38')]('nolimit')){_0x362dd6['limit']=qs['limit'](_0x5b38fa['query']['limit']);_0x362dd6['offset']=qs[_0x671b('0x1c')](_0x5b38fa[_0x671b('0x36')][_0x671b('0x1c')]);}return _0x15f56[_0x671b('0x53')](_0x362dd6);}})[_0x671b('0x24')](function(_0x2d2f3a){if(_0x2d2f3a){return _0x2d2f3a?{'count':_0x3f3cdb,'rows':_0x2d2f3a}:null;}})['then'](respondWithResult(_0x1a1053,null))[_0x671b('0x43')](handleError(_0x1a1053,null));};exports['getAnyConditions']=function(_0x3d77d5,_0x5dc3c1,_0x2965c4){var _0x567dfd={};var _0x1a7677={};var _0x5237e4;var _0x443b27;return db[_0x671b('0x40')][_0x671b('0x54')]({'where':{'id':_0x3d77d5[_0x671b('0x45')]['id']}})['then'](handleEntityNotFound(_0x5dc3c1,null))[_0x671b('0x24')](function(_0x3d07a2){if(_0x3d07a2){_0x5237e4=_0x3d07a2;_0x1a7677[_0x671b('0x30')]=_['keys'](db['Condition'][_0x671b('0x46')]);_0x1a7677[_0x671b('0x36')]=_[_0x671b('0x32')](_0x3d77d5[_0x671b('0x36')]);_0x1a7677['filters']=_[_0x671b('0x34')](_0x1a7677[_0x671b('0x30')],_0x1a7677[_0x671b('0x36')]);_0x567dfd[_0x671b('0x37')]=_['intersection'](_0x1a7677[_0x671b('0x30')],qs['fields'](_0x3d77d5['query'][_0x671b('0x35')]));_0x567dfd[_0x671b('0x37')]=_0x567dfd[_0x671b('0x37')][_0x671b('0x47')]?_0x567dfd[_0x671b('0x37')]:_0x1a7677[_0x671b('0x30')];_0x567dfd[_0x671b('0x39')]=qs[_0x671b('0x3a')](_0x3d77d5[_0x671b('0x36')][_0x671b('0x3a')]);_0x567dfd[_0x671b('0x3c')]=qs[_0x671b('0x33')](_[_0x671b('0x3b')](_0x3d77d5[_0x671b('0x36')],_0x1a7677['filters']));if(_0x3d77d5[_0x671b('0x36')]['filter']){_0x567dfd[_0x671b('0x3c')]=_[_0x671b('0x3e')](_0x567dfd[_0x671b('0x3c')],{'$or':_[_0x671b('0x31')](_0x567dfd[_0x671b('0x37')],function(_0x146ad1){var _0x148a21={};_0x148a21[_0x146ad1]={'$like':'%'+_0x3d77d5[_0x671b('0x36')][_0x671b('0x55')]+'%'};return _0x148a21;})});}_0x567dfd=_[_0x671b('0x3e')]({},_0x567dfd,_0x3d77d5[_0x671b('0x3f')]);return _0x5237e4['getAnyConditions'](_0x567dfd);}})[_0x671b('0x24')](function(_0x497cb4){if(_0x497cb4){_0x443b27=_0x497cb4[_0x671b('0x47')];if(!_0x3d77d5[_0x671b('0x36')]['hasOwnProperty'](_0x671b('0x56'))){_0x567dfd[_0x671b('0x1d')]=qs[_0x671b('0x1d')](_0x3d77d5['query']['limit']);_0x567dfd['offset']=qs['offset'](_0x3d77d5[_0x671b('0x36')][_0x671b('0x1c')]);}return _0x5237e4[_0x671b('0x57')](_0x567dfd);}})[_0x671b('0x24')](function(_0x34acf9){if(_0x34acf9){return _0x34acf9?{'count':_0x443b27,'rows':_0x34acf9}:null;}})['then'](respondWithResult(_0x5dc3c1,null))['catch'](handleError(_0x5dc3c1,null));};exports['addAction']=function(_0x3cd4d6,_0x4afa3d,_0x4b7ce2){if(_0x3cd4d6[_0x671b('0x4b')]['id']){delete _0x3cd4d6[_0x671b('0x4b')]['id'];}return db[_0x671b('0x40')][_0x671b('0x49')]({'where':{'id':_0x3cd4d6[_0x671b('0x45')]['id']}})[_0x671b('0x24')](handleEntityNotFound(_0x4afa3d,null))['then'](function(_0x6f3a84){if(_0x6f3a84){_0x3cd4d6['body'][_0x671b('0x58')]=_0x6f3a84['id'];return db[_0x671b('0x59')][_0x671b('0x4a')](_0x3cd4d6['body']);}})[_0x671b('0x24')](respondWithResult(_0x4afa3d,null))[_0x671b('0x43')](handleError(_0x4afa3d,null));};exports[_0x671b('0x5a')]=function(_0x4fc5bf,_0x1c24cf,_0x36d2e4){var _0x52dde1={};var _0x57c467={};var _0x424e2e;var _0x67a549;return db['Trigger']['findOne']({'where':{'id':_0x4fc5bf[_0x671b('0x45')]['id']}})[_0x671b('0x24')](handleEntityNotFound(_0x1c24cf,null))['then'](function(_0x1a1acf){if(_0x1a1acf){_0x424e2e=_0x1a1acf;_0x57c467[_0x671b('0x30')]=_[_0x671b('0x32')](db[_0x671b('0x59')][_0x671b('0x46')]);_0x57c467[_0x671b('0x36')]=_[_0x671b('0x32')](_0x4fc5bf[_0x671b('0x36')]);_0x57c467[_0x671b('0x33')]=_[_0x671b('0x34')](_0x57c467[_0x671b('0x30')],_0x57c467['query']);_0x52dde1[_0x671b('0x37')]=_['intersection'](_0x57c467[_0x671b('0x30')],qs['fields'](_0x4fc5bf[_0x671b('0x36')]['fields']));_0x52dde1[_0x671b('0x37')]=_0x52dde1[_0x671b('0x37')][_0x671b('0x47')]?_0x52dde1[_0x671b('0x37')]:_0x57c467[_0x671b('0x30')];_0x52dde1[_0x671b('0x39')]=qs[_0x671b('0x3a')](_0x4fc5bf[_0x671b('0x36')][_0x671b('0x3a')]);_0x52dde1['where']=qs[_0x671b('0x33')](_['pick'](_0x4fc5bf['query'],_0x57c467[_0x671b('0x33')]));if(_0x4fc5bf['query']['filter']){_0x52dde1[_0x671b('0x3c')]=_[_0x671b('0x3e')](_0x52dde1['where'],{'$or':_[_0x671b('0x31')](_0x52dde1['attributes'],function(_0x57ca5d){var _0x2cdc14={};_0x2cdc14[_0x57ca5d]={'$like':'%'+_0x4fc5bf[_0x671b('0x36')]['filter']+'%'};return _0x2cdc14;})});}_0x52dde1=_['merge']({},_0x52dde1,_0x4fc5bf['options']);return _0x424e2e[_0x671b('0x5a')](_0x52dde1);}})[_0x671b('0x24')](function(_0x3fd07f){if(_0x3fd07f){_0x67a549=_0x3fd07f[_0x671b('0x47')];if(!_0x4fc5bf[_0x671b('0x36')][_0x671b('0x38')](_0x671b('0x56'))){_0x52dde1[_0x671b('0x1d')]=qs['limit'](_0x4fc5bf[_0x671b('0x36')][_0x671b('0x1d')]);_0x52dde1[_0x671b('0x1c')]=qs[_0x671b('0x1c')](_0x4fc5bf[_0x671b('0x36')][_0x671b('0x1c')]);}return _0x424e2e[_0x671b('0x5a')](_0x52dde1);}})[_0x671b('0x24')](function(_0x271eba){if(_0x271eba){return _0x271eba?{'count':_0x67a549,'rows':_0x271eba}:null;}})[_0x671b('0x24')](respondWithResult(_0x1c24cf,null))['catch'](handleError(_0x1c24cf,null));}; \ No newline at end of file +var _0x7b71=['fieldName','key','model','query','keys','filters','attributes','fields','length','nolimit','limit','order','sort','where','pick','filter','type','VIRTUAL','merge','options','count','includeAll','catch','show','params','intersection','include','find','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','addAllCondition','TriggerAllId','Condition','TriggerAnyId','findOne','getAllConditions','getAnyConditions','hasOwnProperty','addAction','TriggerId','Action','getActions','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','sendStatus','status','end','offset','set','Content-Range','json','reject','save','update','then','destroy','get','Triggers','UserProfileResource','stack','name','send','map','Trigger','rawAttributes'];(function(_0x1a9fc2,_0x12a3f5){var _0x15dbf1=function(_0x57d004){while(--_0x57d004){_0x1a9fc2['push'](_0x1a9fc2['shift']());}};_0x15dbf1(++_0x12a3f5);}(_0x7b71,0x1a4));var _0x17b7=function(_0x4e7551,_0x398ee5){_0x4e7551=_0x4e7551-0x0;var _0x2c2ae8=_0x7b71[_0x4e7551];return _0x2c2ae8;};'use strict';var pdf=require(_0x17b7('0x0'));var emlformat=require(_0x17b7('0x1'));var rimraf=require(_0x17b7('0x2'));var zipdir=require(_0x17b7('0x3'));var jsonpatch=require(_0x17b7('0x4'));var rp=require(_0x17b7('0x5'));var moment=require(_0x17b7('0x6'));var BPromise=require(_0x17b7('0x7'));var Mustache=require(_0x17b7('0x8'));var util=require(_0x17b7('0x9'));var path=require(_0x17b7('0xa'));var sox=require(_0x17b7('0xb'));var csv=require(_0x17b7('0xc'));var ejs=require(_0x17b7('0xd'));var fs=require('fs');var _=require(_0x17b7('0xe'));var squel=require(_0x17b7('0xf'));var crypto=require('crypto');var jsforce=require(_0x17b7('0x10'));var deskjs=require(_0x17b7('0x11'));var toCsv=require(_0x17b7('0xc'));var querystring=require(_0x17b7('0x12'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x17b7('0x13'));var qs=require(_0x17b7('0x14'));var as=require(_0x17b7('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x17b7('0x16'));var utils=require(_0x17b7('0x17'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x283cbd,_0x6a4ee0){_0x6a4ee0=_0x6a4ee0||0xcc;return function(_0x36cb98){if(_0x36cb98){return _0x283cbd[_0x17b7('0x18')](_0x6a4ee0);}return _0x283cbd[_0x17b7('0x19')](_0x6a4ee0)[_0x17b7('0x1a')]();};}function respondWithResult(_0x33ee62,_0x120772){_0x120772=_0x120772||0xc8;return function(_0x1ab9d0){if(_0x1ab9d0){return _0x33ee62[_0x17b7('0x19')](_0x120772)['json'](_0x1ab9d0);}};}function respondWithFilteredResult(_0x5d1048,_0x21ac7e){return function(_0xf61ef6){if(_0xf61ef6){var _0x2eed8e=_0xf61ef6['count'],_0x34576e=_0x21ac7e[_0x17b7('0x1b')],_0x5c0993=_0x21ac7e[_0x17b7('0x1b')]+_0x21ac7e['limit'],_0x1953ab;if(_0x5c0993>=_0x2eed8e){_0x5c0993=_0x2eed8e;_0x1953ab=0xc8;}else{_0x1953ab=0xce;}_0x5d1048[_0x17b7('0x19')](_0x1953ab);return _0x5d1048[_0x17b7('0x1c')](_0x17b7('0x1d'),_0x34576e+'-'+_0x5c0993+'/'+_0x2eed8e)[_0x17b7('0x1e')](_0xf61ef6);}return null;};}function patchUpdates(_0x1bcf4d){return function(_0x1d8b67){try{jsonpatch['apply'](_0x1d8b67,_0x1bcf4d,!![]);}catch(_0x34e63c){return BPromise[_0x17b7('0x1f')](_0x34e63c);}return _0x1d8b67[_0x17b7('0x20')]();};}function saveUpdates(_0xb1da24,_0x328c54){return function(_0x33fb38){if(_0x33fb38){return _0x33fb38[_0x17b7('0x21')](_0xb1da24)[_0x17b7('0x22')](function(_0xdf2a05){return _0xdf2a05;});}return null;};}function removeEntity(_0x17e0b9,_0x55249f){return function(_0x4b3694){if(_0x4b3694){return _0x4b3694[_0x17b7('0x23')]()[_0x17b7('0x22')](function(){var _0x363d70=_0x4b3694[_0x17b7('0x24')]({'plain':!![]});var _0xe81559=_0x17b7('0x25');return db[_0x17b7('0x26')][_0x17b7('0x23')]({'where':{'type':_0xe81559,'resourceId':_0x363d70['id']}})[_0x17b7('0x22')](function(){return _0x4b3694;});})[_0x17b7('0x22')](function(){_0x17e0b9['status'](0xcc)[_0x17b7('0x1a')]();});}};}function handleEntityNotFound(_0x1a5fd4,_0x5876b2){return function(_0x5adaeb){if(!_0x5adaeb){_0x1a5fd4[_0x17b7('0x18')](0x194);}return _0x5adaeb;};}function handleError(_0x5af834,_0x4d9b86){_0x4d9b86=_0x4d9b86||0x1f4;return function(_0x216b45){logger['error'](_0x216b45[_0x17b7('0x27')]);if(_0x216b45[_0x17b7('0x28')]){delete _0x216b45[_0x17b7('0x28')];}_0x5af834['status'](_0x4d9b86)[_0x17b7('0x29')](_0x216b45);};}exports['index']=function(_0x2eac34,_0x196fa3){var _0x1d026c={},_0x53afeb={},_0x687e42={'count':0x0,'rows':[]};var _0x5011fc=_[_0x17b7('0x2a')](db[_0x17b7('0x2b')][_0x17b7('0x2c')],function(_0x129a3d){return{'name':_0x129a3d[_0x17b7('0x2d')],'type':_0x129a3d['type'][_0x17b7('0x2e')]};});_0x53afeb[_0x17b7('0x2f')]=_[_0x17b7('0x2a')](_0x5011fc,_0x17b7('0x28'));_0x53afeb[_0x17b7('0x30')]=_[_0x17b7('0x31')](_0x2eac34[_0x17b7('0x30')]);_0x53afeb[_0x17b7('0x32')]=_['intersection'](_0x53afeb['model'],_0x53afeb[_0x17b7('0x30')]);_0x1d026c[_0x17b7('0x33')]=_['intersection'](_0x53afeb[_0x17b7('0x2f')],qs[_0x17b7('0x34')](_0x2eac34[_0x17b7('0x30')][_0x17b7('0x34')]));_0x1d026c['attributes']=_0x1d026c['attributes'][_0x17b7('0x35')]?_0x1d026c['attributes']:_0x53afeb['model'];if(!_0x2eac34[_0x17b7('0x30')]['hasOwnProperty'](_0x17b7('0x36'))){_0x1d026c[_0x17b7('0x37')]=qs[_0x17b7('0x37')](_0x2eac34['query'][_0x17b7('0x37')]);_0x1d026c[_0x17b7('0x1b')]=qs[_0x17b7('0x1b')](_0x2eac34[_0x17b7('0x30')]['offset']);}_0x1d026c[_0x17b7('0x38')]=qs[_0x17b7('0x39')](_0x2eac34['query'][_0x17b7('0x39')]);_0x1d026c[_0x17b7('0x3a')]=qs[_0x17b7('0x32')](_[_0x17b7('0x3b')](_0x2eac34[_0x17b7('0x30')],_0x53afeb[_0x17b7('0x32')]),_0x5011fc);if(_0x2eac34[_0x17b7('0x30')][_0x17b7('0x3c')]){_0x1d026c[_0x17b7('0x3a')]=_['merge'](_0x1d026c[_0x17b7('0x3a')],{'$or':_[_0x17b7('0x2a')](_0x5011fc,function(_0x2bc145){if(_0x2bc145[_0x17b7('0x3d')]!==_0x17b7('0x3e')){var _0x18a067={};_0x18a067[_0x2bc145[_0x17b7('0x28')]]={'$like':'%'+_0x2eac34[_0x17b7('0x30')]['filter']+'%'};return _0x18a067;}})});}_0x1d026c=_[_0x17b7('0x3f')]({},_0x1d026c,_0x2eac34[_0x17b7('0x40')]);var _0x67b191={'where':_0x1d026c[_0x17b7('0x3a')]};return db[_0x17b7('0x2b')][_0x17b7('0x41')](_0x67b191)[_0x17b7('0x22')](function(_0x2eb2d8){_0x687e42[_0x17b7('0x41')]=_0x2eb2d8;if(_0x2eac34['query'][_0x17b7('0x42')]){_0x1d026c['include']=[{'all':!![]}];}return db[_0x17b7('0x2b')]['findAll'](_0x1d026c);})[_0x17b7('0x22')](function(_0x292f44){_0x687e42['rows']=_0x292f44;return _0x687e42;})[_0x17b7('0x22')](respondWithFilteredResult(_0x196fa3,_0x1d026c))[_0x17b7('0x43')](handleError(_0x196fa3,null));};exports[_0x17b7('0x44')]=function(_0x2b28bb,_0x132f5b){var _0x39ac76={'raw':![],'where':{'id':_0x2b28bb[_0x17b7('0x45')]['id']}},_0x1d05e8={};_0x1d05e8[_0x17b7('0x2f')]=_['keys'](db[_0x17b7('0x2b')][_0x17b7('0x2c')]);_0x1d05e8[_0x17b7('0x30')]=_[_0x17b7('0x31')](_0x2b28bb['query']);_0x1d05e8[_0x17b7('0x32')]=_[_0x17b7('0x46')](_0x1d05e8['model'],_0x1d05e8[_0x17b7('0x30')]);_0x39ac76['attributes']=_['intersection'](_0x1d05e8[_0x17b7('0x2f')],qs[_0x17b7('0x34')](_0x2b28bb[_0x17b7('0x30')][_0x17b7('0x34')]));_0x39ac76[_0x17b7('0x33')]=_0x39ac76['attributes']['length']?_0x39ac76['attributes']:_0x1d05e8[_0x17b7('0x2f')];if(_0x2b28bb[_0x17b7('0x30')]['includeAll']){_0x39ac76[_0x17b7('0x47')]=[{'all':!![]}];}_0x39ac76=_[_0x17b7('0x3f')]({},_0x39ac76,_0x2b28bb[_0x17b7('0x40')]);return db[_0x17b7('0x2b')][_0x17b7('0x48')](_0x39ac76)[_0x17b7('0x22')](handleEntityNotFound(_0x132f5b,null))['then'](respondWithResult(_0x132f5b,null))[_0x17b7('0x43')](handleError(_0x132f5b,null));};exports['create']=function(_0x14e2be,_0x30665c){return db[_0x17b7('0x2b')]['create'](_0x14e2be[_0x17b7('0x49')],{})[_0x17b7('0x22')](function(_0x420fd4){var _0x1ca7ca=_0x14e2be[_0x17b7('0x4a')][_0x17b7('0x24')]({'plain':!![]});if(!_0x1ca7ca)throw new Error(_0x17b7('0x4b'));if(_0x1ca7ca[_0x17b7('0x4c')]===_0x17b7('0x4a')){var _0x192baf=_0x420fd4[_0x17b7('0x24')]({'plain':!![]});var _0x3005bf=_0x17b7('0x25');return db[_0x17b7('0x4d')][_0x17b7('0x48')]({'where':{'name':_0x3005bf,'userProfileId':_0x1ca7ca['userProfileId']},'raw':!![]})['then'](function(_0x483db1){if(_0x483db1&&_0x483db1[_0x17b7('0x4e')]===0x0){return db[_0x17b7('0x26')][_0x17b7('0x4f')]({'name':_0x192baf[_0x17b7('0x28')],'resourceId':_0x192baf['id'],'type':_0x483db1['name'],'sectionId':_0x483db1['id']},{})[_0x17b7('0x22')](function(){return _0x420fd4;});}else{return _0x420fd4;}})[_0x17b7('0x43')](function(_0x555d1a){logger['error'](_0x17b7('0x50'),_0x555d1a);throw _0x555d1a;});}return _0x420fd4;})[_0x17b7('0x22')](respondWithResult(_0x30665c,0xc9))[_0x17b7('0x43')](handleError(_0x30665c,null));};exports[_0x17b7('0x21')]=function(_0x5703a7,_0x9186c9){if(_0x5703a7[_0x17b7('0x49')]['id']){delete _0x5703a7[_0x17b7('0x49')]['id'];}return db[_0x17b7('0x2b')][_0x17b7('0x48')]({'where':{'id':_0x5703a7[_0x17b7('0x45')]['id']}})[_0x17b7('0x22')](handleEntityNotFound(_0x9186c9,null))[_0x17b7('0x22')](saveUpdates(_0x5703a7[_0x17b7('0x49')],null))[_0x17b7('0x22')](respondWithResult(_0x9186c9,null))[_0x17b7('0x43')](handleError(_0x9186c9,null));};exports['destroy']=function(_0x5da78f,_0x4c72b8){return db[_0x17b7('0x2b')][_0x17b7('0x48')]({'where':{'id':_0x5da78f[_0x17b7('0x45')]['id']}})[_0x17b7('0x22')](handleEntityNotFound(_0x4c72b8,null))[_0x17b7('0x22')](removeEntity(_0x4c72b8,null))[_0x17b7('0x43')](handleError(_0x4c72b8,null));};exports[_0x17b7('0x51')]=function(_0x162c8d,_0x10aeda,_0x9d5943){if(_0x162c8d['body']['id']){delete _0x162c8d[_0x17b7('0x49')]['id'];}return db['Trigger'][_0x17b7('0x48')]({'where':{'id':_0x162c8d['params']['id']}})['then'](handleEntityNotFound(_0x10aeda,null))[_0x17b7('0x22')](function(_0x28600e){if(_0x28600e){_0x162c8d[_0x17b7('0x49')][_0x17b7('0x52')]=_0x28600e['id'];return db[_0x17b7('0x53')]['create'](_0x162c8d[_0x17b7('0x49')]);}})[_0x17b7('0x22')](respondWithResult(_0x10aeda,null))[_0x17b7('0x43')](handleError(_0x10aeda,null));};exports['addAnyCondition']=function(_0x5c9bc8,_0x5d439a,_0x5a599a){if(_0x5c9bc8[_0x17b7('0x49')]['id']){delete _0x5c9bc8[_0x17b7('0x49')]['id'];}return db['Trigger'][_0x17b7('0x48')]({'where':{'id':_0x5c9bc8[_0x17b7('0x45')]['id']}})[_0x17b7('0x22')](handleEntityNotFound(_0x5d439a,null))[_0x17b7('0x22')](function(_0x391ba9){if(_0x391ba9){_0x5c9bc8[_0x17b7('0x49')][_0x17b7('0x54')]=_0x391ba9['id'];return db[_0x17b7('0x53')][_0x17b7('0x4f')](_0x5c9bc8[_0x17b7('0x49')]);}})[_0x17b7('0x22')](respondWithResult(_0x5d439a,null))[_0x17b7('0x43')](handleError(_0x5d439a,null));};exports['getAllConditions']=function(_0x43f583,_0x100352,_0x4af677){var _0x308d93={};var _0x21937c={};var _0x540764;var _0x43e8eb;return db[_0x17b7('0x2b')][_0x17b7('0x55')]({'where':{'id':_0x43f583[_0x17b7('0x45')]['id']}})['then'](handleEntityNotFound(_0x100352,null))[_0x17b7('0x22')](function(_0x162449){if(_0x162449){_0x540764=_0x162449;_0x21937c[_0x17b7('0x2f')]=_[_0x17b7('0x31')](db[_0x17b7('0x53')][_0x17b7('0x2c')]);_0x21937c[_0x17b7('0x30')]=_[_0x17b7('0x31')](_0x43f583[_0x17b7('0x30')]);_0x21937c[_0x17b7('0x32')]=_[_0x17b7('0x46')](_0x21937c[_0x17b7('0x2f')],_0x21937c[_0x17b7('0x30')]);_0x308d93[_0x17b7('0x33')]=_['intersection'](_0x21937c[_0x17b7('0x2f')],qs[_0x17b7('0x34')](_0x43f583[_0x17b7('0x30')][_0x17b7('0x34')]));_0x308d93[_0x17b7('0x33')]=_0x308d93['attributes'][_0x17b7('0x35')]?_0x308d93[_0x17b7('0x33')]:_0x21937c[_0x17b7('0x2f')];_0x308d93[_0x17b7('0x38')]=qs['sort'](_0x43f583['query'][_0x17b7('0x39')]);_0x308d93[_0x17b7('0x3a')]=qs[_0x17b7('0x32')](_[_0x17b7('0x3b')](_0x43f583[_0x17b7('0x30')],_0x21937c['filters']));if(_0x43f583[_0x17b7('0x30')][_0x17b7('0x3c')]){_0x308d93['where']=_[_0x17b7('0x3f')](_0x308d93[_0x17b7('0x3a')],{'$or':_['map'](_0x308d93[_0x17b7('0x33')],function(_0x12603f){var _0x2c503a={};_0x2c503a[_0x12603f]={'$like':'%'+_0x43f583[_0x17b7('0x30')]['filter']+'%'};return _0x2c503a;})});}_0x308d93=_[_0x17b7('0x3f')]({},_0x308d93,_0x43f583[_0x17b7('0x40')]);return _0x540764[_0x17b7('0x56')](_0x308d93);}})[_0x17b7('0x22')](function(_0x42203d){if(_0x42203d){_0x43e8eb=_0x42203d[_0x17b7('0x35')];if(!_0x43f583[_0x17b7('0x30')]['hasOwnProperty'](_0x17b7('0x36'))){_0x308d93[_0x17b7('0x37')]=qs[_0x17b7('0x37')](_0x43f583[_0x17b7('0x30')]['limit']);_0x308d93['offset']=qs[_0x17b7('0x1b')](_0x43f583[_0x17b7('0x30')][_0x17b7('0x1b')]);}return _0x540764[_0x17b7('0x56')](_0x308d93);}})[_0x17b7('0x22')](function(_0x26e2d7){if(_0x26e2d7){return _0x26e2d7?{'count':_0x43e8eb,'rows':_0x26e2d7}:null;}})[_0x17b7('0x22')](respondWithResult(_0x100352,null))[_0x17b7('0x43')](handleError(_0x100352,null));};exports[_0x17b7('0x57')]=function(_0x399c81,_0x5b9537,_0x27c850){var _0x45be42={};var _0x336477={};var _0x4ed56d;var _0x2b823f;return db[_0x17b7('0x2b')][_0x17b7('0x55')]({'where':{'id':_0x399c81['params']['id']}})['then'](handleEntityNotFound(_0x5b9537,null))[_0x17b7('0x22')](function(_0x188038){if(_0x188038){_0x4ed56d=_0x188038;_0x336477[_0x17b7('0x2f')]=_[_0x17b7('0x31')](db[_0x17b7('0x53')][_0x17b7('0x2c')]);_0x336477[_0x17b7('0x30')]=_[_0x17b7('0x31')](_0x399c81['query']);_0x336477[_0x17b7('0x32')]=_['intersection'](_0x336477['model'],_0x336477[_0x17b7('0x30')]);_0x45be42['attributes']=_['intersection'](_0x336477[_0x17b7('0x2f')],qs[_0x17b7('0x34')](_0x399c81['query'][_0x17b7('0x34')]));_0x45be42[_0x17b7('0x33')]=_0x45be42[_0x17b7('0x33')][_0x17b7('0x35')]?_0x45be42[_0x17b7('0x33')]:_0x336477[_0x17b7('0x2f')];_0x45be42[_0x17b7('0x38')]=qs['sort'](_0x399c81[_0x17b7('0x30')][_0x17b7('0x39')]);_0x45be42['where']=qs[_0x17b7('0x32')](_[_0x17b7('0x3b')](_0x399c81['query'],_0x336477[_0x17b7('0x32')]));if(_0x399c81[_0x17b7('0x30')][_0x17b7('0x3c')]){_0x45be42[_0x17b7('0x3a')]=_[_0x17b7('0x3f')](_0x45be42[_0x17b7('0x3a')],{'$or':_[_0x17b7('0x2a')](_0x45be42[_0x17b7('0x33')],function(_0x55e994){var _0x1633b2={};_0x1633b2[_0x55e994]={'$like':'%'+_0x399c81[_0x17b7('0x30')]['filter']+'%'};return _0x1633b2;})});}_0x45be42=_[_0x17b7('0x3f')]({},_0x45be42,_0x399c81[_0x17b7('0x40')]);return _0x4ed56d[_0x17b7('0x57')](_0x45be42);}})[_0x17b7('0x22')](function(_0x219588){if(_0x219588){_0x2b823f=_0x219588[_0x17b7('0x35')];if(!_0x399c81[_0x17b7('0x30')][_0x17b7('0x58')]('nolimit')){_0x45be42[_0x17b7('0x37')]=qs[_0x17b7('0x37')](_0x399c81[_0x17b7('0x30')]['limit']);_0x45be42[_0x17b7('0x1b')]=qs[_0x17b7('0x1b')](_0x399c81[_0x17b7('0x30')]['offset']);}return _0x4ed56d[_0x17b7('0x57')](_0x45be42);}})[_0x17b7('0x22')](function(_0x3f5fed){if(_0x3f5fed){return _0x3f5fed?{'count':_0x2b823f,'rows':_0x3f5fed}:null;}})['then'](respondWithResult(_0x5b9537,null))[_0x17b7('0x43')](handleError(_0x5b9537,null));};exports[_0x17b7('0x59')]=function(_0x470907,_0x40d3c9,_0x21d9a7){if(_0x470907['body']['id']){delete _0x470907['body']['id'];}return db['Trigger'][_0x17b7('0x48')]({'where':{'id':_0x470907['params']['id']}})[_0x17b7('0x22')](handleEntityNotFound(_0x40d3c9,null))[_0x17b7('0x22')](function(_0x36ed4e){if(_0x36ed4e){_0x470907['body'][_0x17b7('0x5a')]=_0x36ed4e['id'];return db[_0x17b7('0x5b')]['create'](_0x470907[_0x17b7('0x49')]);}})[_0x17b7('0x22')](respondWithResult(_0x40d3c9,null))['catch'](handleError(_0x40d3c9,null));};exports[_0x17b7('0x5c')]=function(_0xed0bb8,_0x4ae944,_0x1426e6){var _0x1103c9={};var _0x506f99={};var _0x31c9f8;var _0x13cee3;return db[_0x17b7('0x2b')]['findOne']({'where':{'id':_0xed0bb8[_0x17b7('0x45')]['id']}})[_0x17b7('0x22')](handleEntityNotFound(_0x4ae944,null))[_0x17b7('0x22')](function(_0x20f71e){if(_0x20f71e){_0x31c9f8=_0x20f71e;_0x506f99['model']=_[_0x17b7('0x31')](db[_0x17b7('0x5b')][_0x17b7('0x2c')]);_0x506f99[_0x17b7('0x30')]=_[_0x17b7('0x31')](_0xed0bb8['query']);_0x506f99['filters']=_[_0x17b7('0x46')](_0x506f99[_0x17b7('0x2f')],_0x506f99[_0x17b7('0x30')]);_0x1103c9[_0x17b7('0x33')]=_['intersection'](_0x506f99[_0x17b7('0x2f')],qs[_0x17b7('0x34')](_0xed0bb8[_0x17b7('0x30')][_0x17b7('0x34')]));_0x1103c9[_0x17b7('0x33')]=_0x1103c9[_0x17b7('0x33')][_0x17b7('0x35')]?_0x1103c9[_0x17b7('0x33')]:_0x506f99[_0x17b7('0x2f')];_0x1103c9[_0x17b7('0x38')]=qs['sort'](_0xed0bb8['query'][_0x17b7('0x39')]);_0x1103c9['where']=qs[_0x17b7('0x32')](_[_0x17b7('0x3b')](_0xed0bb8[_0x17b7('0x30')],_0x506f99[_0x17b7('0x32')]));if(_0xed0bb8[_0x17b7('0x30')]['filter']){_0x1103c9[_0x17b7('0x3a')]=_[_0x17b7('0x3f')](_0x1103c9['where'],{'$or':_[_0x17b7('0x2a')](_0x1103c9[_0x17b7('0x33')],function(_0x3c6d3a){var _0x57bead={};_0x57bead[_0x3c6d3a]={'$like':'%'+_0xed0bb8[_0x17b7('0x30')][_0x17b7('0x3c')]+'%'};return _0x57bead;})});}_0x1103c9=_[_0x17b7('0x3f')]({},_0x1103c9,_0xed0bb8[_0x17b7('0x40')]);return _0x31c9f8[_0x17b7('0x5c')](_0x1103c9);}})['then'](function(_0x426024){if(_0x426024){_0x13cee3=_0x426024['length'];if(!_0xed0bb8['query'][_0x17b7('0x58')]('nolimit')){_0x1103c9[_0x17b7('0x37')]=qs[_0x17b7('0x37')](_0xed0bb8[_0x17b7('0x30')][_0x17b7('0x37')]);_0x1103c9[_0x17b7('0x1b')]=qs[_0x17b7('0x1b')](_0xed0bb8['query'][_0x17b7('0x1b')]);}return _0x31c9f8[_0x17b7('0x5c')](_0x1103c9);}})[_0x17b7('0x22')](function(_0x14dc03){if(_0x14dc03){return _0x14dc03?{'count':_0x13cee3,'rows':_0x14dc03}:null;}})[_0x17b7('0x22')](respondWithResult(_0x4ae944,null))[_0x17b7('0x43')](handleError(_0x4ae944,null));}; \ No newline at end of file diff --git a/server/api/trigger/trigger.model.js b/server/api/trigger/trigger.model.js index 4274972..085f6e4 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 _0x5f66=['request-promise','path','../../config/environment','exports','Trigger','tools_triggers','util','api','moment','bluebird'];(function(_0x3b0731,_0xcf9925){var _0x4204d7=function(_0x635ac5){while(--_0x635ac5){_0x3b0731['push'](_0x3b0731['shift']());}};_0x4204d7(++_0xcf9925);}(_0x5f66,0x1a0));var _0x65f6=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0x5f66[_0x432682];return _0x463d05;};'use strict';var _=require('lodash');var util=require(_0x65f6('0x0'));var 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 +var _0x2ef3=['exports','define','Trigger','tools_triggers','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','./trigger.attributes'];(function(_0x28efa0,_0x481587){var _0x110f72=function(_0x4b11f7){while(--_0x4b11f7){_0x28efa0['push'](_0x28efa0['shift']());}};_0x110f72(++_0x481587);}(_0x2ef3,0xba));var _0x32ef=function(_0x3debfe,_0x3c4121){_0x3debfe=_0x3debfe-0x0;var _0x595086=_0x2ef3[_0x3debfe];return _0x595086;};'use strict';var _=require(_0x32ef('0x0'));var util=require(_0x32ef('0x1'));var logger=require(_0x32ef('0x2'))(_0x32ef('0x3'));var moment=require(_0x32ef('0x4'));var BPromise=require(_0x32ef('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x32ef('0x6'));var rimraf=require(_0x32ef('0x7'));var config=require('../../config/environment');var attributes=require(_0x32ef('0x8'));module[_0x32ef('0x9')]=function(_0x4c8104,_0x5dfa09){return _0x4c8104[_0x32ef('0xa')](_0x32ef('0xb'),attributes,{'tableName':_0x32ef('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/trigger/trigger.rpc.js b/server/api/trigger/trigger.rpc.js index 69c3007..d6ff732 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 _0xd824=['../../mysqldb','../../config/utils','../../config/logger','rpc','client','request','info','Trigger,\x20%s,\x20%s','request\x20sent','Trigger,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','GetTrigger','Trigger','findAll','options','raw','where','attributes','limit','include','map','model','then','debug','ShowTrigger','find','lodash','util','randomstring','ioredis'];(function(_0xceb849,_0x2327c7){var _0x4c6f0d=function(_0x2b9861){while(--_0x2b9861){_0xceb849['push'](_0xceb849['shift']());}};_0x4c6f0d(++_0x2327c7);}(_0xd824,0xc2));var _0x4d82=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0xd824[_0xfae23b];return _0x200640;};'use strict';var _=require(_0x4d82('0x0'));var util=require(_0x4d82('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x4d82('0x2'));var fs=require('fs');var Redis=require(_0x4d82('0x3'));var db=require(_0x4d82('0x4'))['db'];var utils=require(_0x4d82('0x5'));var logger=require(_0x4d82('0x6'))(_0x4d82('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x4d82('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4b842f,_0x464caf,_0xb54db2){return new BPromise(function(_0x13d624,_0x5cccb6){return client[_0x4d82('0x9')](_0x4b842f,_0xb54db2)['then'](function(_0x5356cd){logger[_0x4d82('0xa')](_0x4d82('0xb'),_0x464caf,_0x4d82('0xc'));logger['debug'](_0x4d82('0xd'),_0x464caf,'request\x20sent',JSON[_0x4d82('0xe')](_0x5356cd));if(_0x5356cd[_0x4d82('0xf')]){if(_0x5356cd[_0x4d82('0xf')]['code']===0x1f4){logger['error'](_0x4d82('0xb'),_0x464caf,_0x5356cd[_0x4d82('0xf')][_0x4d82('0x10')]);return _0x5cccb6(_0x5356cd[_0x4d82('0xf')]['message']);}logger[_0x4d82('0xf')](_0x4d82('0xb'),_0x464caf,_0x5356cd[_0x4d82('0xf')]['message']);return _0x13d624(_0x5356cd[_0x4d82('0xf')]['message']);}else{logger[_0x4d82('0xa')]('Trigger,\x20%s,\x20%s',_0x464caf,_0x4d82('0xc'));_0x13d624(_0x5356cd['result'][_0x4d82('0x10')]);}})[_0x4d82('0x11')](function(_0x461476){logger[_0x4d82('0xf')](_0x4d82('0xb'),_0x464caf,_0x461476);_0x5cccb6(_0x461476);});});}exports[_0x4d82('0x12')]=function(_0x258c59){var _0x217b72=this;return new Promise(function(_0x2f2127,_0x5ef783){return db[_0x4d82('0x13')][_0x4d82('0x14')]({'raw':_0x258c59[_0x4d82('0x15')]?_0x258c59[_0x4d82('0x15')][_0x4d82('0x16')]===undefined?!![]:![]:!![],'where':_0x258c59[_0x4d82('0x15')]?_0x258c59[_0x4d82('0x15')][_0x4d82('0x17')]||null:null,'attributes':_0x258c59[_0x4d82('0x15')]?_0x258c59[_0x4d82('0x15')][_0x4d82('0x18')]||null:null,'limit':_0x258c59['options']?_0x258c59[_0x4d82('0x15')][_0x4d82('0x19')]||null:null,'include':_0x258c59['options']?_0x258c59[_0x4d82('0x15')][_0x4d82('0x1a')]?_[_0x4d82('0x1b')](_0x258c59[_0x4d82('0x15')][_0x4d82('0x1a')],function(_0x15f5d1){return{'model':db[_0x15f5d1[_0x4d82('0x1c')]],'as':_0x15f5d1['as'],'attributes':_0x15f5d1[_0x4d82('0x18')],'include':_0x15f5d1[_0x4d82('0x1a')]?_[_0x4d82('0x1b')](_0x15f5d1[_0x4d82('0x1a')],function(_0x395efc){return{'model':db[_0x395efc[_0x4d82('0x1c')]],'as':_0x395efc['as'],'attributes':_0x395efc[_0x4d82('0x18')],'include':_0x395efc[_0x4d82('0x1a')]?_['map'](_0x395efc['include'],function(_0x3dcb0f){return{'model':db[_0x3dcb0f[_0x4d82('0x1c')]],'as':_0x3dcb0f['as'],'attributes':_0x3dcb0f[_0x4d82('0x18')]};}):[]};}):[]};}):[]:[]})[_0x4d82('0x1d')](function(_0x5cbd7e){logger[_0x4d82('0xa')](_0x4d82('0x12'),_0x258c59);logger[_0x4d82('0x1e')](_0x4d82('0x12'),_0x258c59,JSON['stringify'](_0x5cbd7e));_0x2f2127(_0x5cbd7e);})[_0x4d82('0x11')](function(_0x4a7444){logger['error']('GetTrigger',_0x4a7444['message'],_0x258c59);_0x5ef783(_0x217b72[_0x4d82('0xf')](0x1f4,_0x4a7444[_0x4d82('0x10')]));});});};exports[_0x4d82('0x1f')]=function(_0x52e320){var _0x713c56=this;return new Promise(function(_0x37cdc4,_0x5cf3e6){return db['Trigger'][_0x4d82('0x20')]({'raw':_0x52e320[_0x4d82('0x15')]?_0x52e320[_0x4d82('0x15')][_0x4d82('0x16')]===undefined?!![]:![]:!![],'where':_0x52e320['options']?_0x52e320[_0x4d82('0x15')]['where']||null:null,'attributes':_0x52e320[_0x4d82('0x15')]?_0x52e320[_0x4d82('0x15')]['attributes']||null:null,'include':_0x52e320['options']?_0x52e320[_0x4d82('0x15')][_0x4d82('0x1a')]?_[_0x4d82('0x1b')](_0x52e320[_0x4d82('0x15')][_0x4d82('0x1a')],function(_0x420b28){return{'model':db[_0x420b28[_0x4d82('0x1c')]],'as':_0x420b28['as'],'attributes':_0x420b28[_0x4d82('0x18')],'include':_0x420b28[_0x4d82('0x1a')]?_[_0x4d82('0x1b')](_0x420b28['include'],function(_0x382f43){return{'model':db[_0x382f43[_0x4d82('0x1c')]],'as':_0x382f43['as'],'attributes':_0x382f43[_0x4d82('0x18')],'include':_0x382f43['include']?_[_0x4d82('0x1b')](_0x382f43[_0x4d82('0x1a')],function(_0x57826a){return{'model':db[_0x57826a[_0x4d82('0x1c')]],'as':_0x57826a['as'],'attributes':_0x57826a[_0x4d82('0x18')]};}):[]};}):[]};}):[]:[]})[_0x4d82('0x1d')](function(_0x5d0296){logger[_0x4d82('0xa')](_0x4d82('0x1f'),_0x52e320);logger['debug'](_0x4d82('0x1f'),_0x52e320,JSON['stringify'](_0x5d0296));_0x37cdc4(_0x5d0296);})[_0x4d82('0x11')](function(_0x2c21c9){logger['error'](_0x4d82('0x1f'),_0x2c21c9['message'],_0x52e320);_0x5cf3e6(_0x713c56[_0x4d82('0xf')](0x1f4,_0x2c21c9['message']));});});}; \ No newline at end of file +var _0x087b=['find','where','lodash','util','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','Trigger,\x20%s,\x20%s,\x20%s','stringify','error','Trigger,\x20%s,\x20%s','message','result','findAll','options','raw','attributes','limit','map','include','model','GetTrigger','catch','ShowTrigger'];(function(_0x15876c,_0x510dd4){var _0x39d91b=function(_0x2a692c){while(--_0x2a692c){_0x15876c['push'](_0x15876c['shift']());}};_0x39d91b(++_0x510dd4);}(_0x087b,0x11a));var _0xb087=function(_0x39096d,_0x51f8a0){_0x39096d=_0x39096d-0x0;var _0x13da4f=_0x087b[_0x39096d];return _0x13da4f;};'use strict';var _=require(_0xb087('0x0'));var util=require(_0xb087('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xb087('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb087('0x3'))['db'];var utils=require(_0xb087('0x4'));var logger=require(_0xb087('0x5'))(_0xb087('0x6'));var config=require(_0xb087('0x7'));var jayson=require(_0xb087('0x8'));var client=jayson[_0xb087('0x9')][_0xb087('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xecf080,_0x36ac30,_0x3cebbf){return new BPromise(function(_0x6d83fb,_0x1dbe9f){return client[_0xb087('0xb')](_0xecf080,_0x3cebbf)[_0xb087('0xc')](function(_0x23cdd7){logger[_0xb087('0xd')]('Trigger,\x20%s,\x20%s',_0x36ac30,_0xb087('0xe'));logger[_0xb087('0xf')](_0xb087('0x10'),_0x36ac30,_0xb087('0xe'),JSON[_0xb087('0x11')](_0x23cdd7));if(_0x23cdd7[_0xb087('0x12')]){if(_0x23cdd7[_0xb087('0x12')]['code']===0x1f4){logger[_0xb087('0x12')](_0xb087('0x13'),_0x36ac30,_0x23cdd7[_0xb087('0x12')]['message']);return _0x1dbe9f(_0x23cdd7[_0xb087('0x12')][_0xb087('0x14')]);}logger[_0xb087('0x12')](_0xb087('0x13'),_0x36ac30,_0x23cdd7[_0xb087('0x12')][_0xb087('0x14')]);return _0x6d83fb(_0x23cdd7[_0xb087('0x12')][_0xb087('0x14')]);}else{logger[_0xb087('0xd')](_0xb087('0x13'),_0x36ac30,'request\x20sent');_0x6d83fb(_0x23cdd7[_0xb087('0x15')][_0xb087('0x14')]);}})['catch'](function(_0xcc4426){logger[_0xb087('0x12')](_0xb087('0x13'),_0x36ac30,_0xcc4426);_0x1dbe9f(_0xcc4426);});});}exports['GetTrigger']=function(_0x330005){var _0x3c680f=this;return new Promise(function(_0x17200d,_0x45d074){return db['Trigger'][_0xb087('0x16')]({'raw':_0x330005[_0xb087('0x17')]?_0x330005[_0xb087('0x17')][_0xb087('0x18')]===undefined?!![]:![]:!![],'where':_0x330005['options']?_0x330005['options']['where']||null:null,'attributes':_0x330005['options']?_0x330005[_0xb087('0x17')][_0xb087('0x19')]||null:null,'limit':_0x330005[_0xb087('0x17')]?_0x330005[_0xb087('0x17')][_0xb087('0x1a')]||null:null,'include':_0x330005[_0xb087('0x17')]?_0x330005[_0xb087('0x17')]['include']?_[_0xb087('0x1b')](_0x330005[_0xb087('0x17')][_0xb087('0x1c')],function(_0x1cfb3e){return{'model':db[_0x1cfb3e[_0xb087('0x1d')]],'as':_0x1cfb3e['as'],'attributes':_0x1cfb3e['attributes'],'include':_0x1cfb3e[_0xb087('0x1c')]?_[_0xb087('0x1b')](_0x1cfb3e['include'],function(_0x5a2dc6){return{'model':db[_0x5a2dc6['model']],'as':_0x5a2dc6['as'],'attributes':_0x5a2dc6['attributes'],'include':_0x5a2dc6['include']?_[_0xb087('0x1b')](_0x5a2dc6[_0xb087('0x1c')],function(_0x1d124f){return{'model':db[_0x1d124f[_0xb087('0x1d')]],'as':_0x1d124f['as'],'attributes':_0x1d124f[_0xb087('0x19')]};}):[]};}):[]};}):[]:[]})[_0xb087('0xc')](function(_0xf3f41f){logger[_0xb087('0xd')](_0xb087('0x1e'),_0x330005);logger[_0xb087('0xf')](_0xb087('0x1e'),_0x330005,JSON[_0xb087('0x11')](_0xf3f41f));_0x17200d(_0xf3f41f);})[_0xb087('0x1f')](function(_0x263259){logger['error'](_0xb087('0x1e'),_0x263259[_0xb087('0x14')],_0x330005);_0x45d074(_0x3c680f[_0xb087('0x12')](0x1f4,_0x263259[_0xb087('0x14')]));});});};exports[_0xb087('0x20')]=function(_0xa6d90c){var _0x2e1c57=this;return new Promise(function(_0x13fb2f,_0x53a535){return db['Trigger'][_0xb087('0x21')]({'raw':_0xa6d90c[_0xb087('0x17')]?_0xa6d90c['options'][_0xb087('0x18')]===undefined?!![]:![]:!![],'where':_0xa6d90c[_0xb087('0x17')]?_0xa6d90c[_0xb087('0x17')][_0xb087('0x22')]||null:null,'attributes':_0xa6d90c[_0xb087('0x17')]?_0xa6d90c[_0xb087('0x17')][_0xb087('0x19')]||null:null,'include':_0xa6d90c[_0xb087('0x17')]?_0xa6d90c[_0xb087('0x17')][_0xb087('0x1c')]?_[_0xb087('0x1b')](_0xa6d90c[_0xb087('0x17')]['include'],function(_0x3bec03){return{'model':db[_0x3bec03['model']],'as':_0x3bec03['as'],'attributes':_0x3bec03[_0xb087('0x19')],'include':_0x3bec03[_0xb087('0x1c')]?_[_0xb087('0x1b')](_0x3bec03[_0xb087('0x1c')],function(_0x13cb5d){return{'model':db[_0x13cb5d[_0xb087('0x1d')]],'as':_0x13cb5d['as'],'attributes':_0x13cb5d[_0xb087('0x19')],'include':_0x13cb5d[_0xb087('0x1c')]?_[_0xb087('0x1b')](_0x13cb5d['include'],function(_0x5814c2){return{'model':db[_0x5814c2[_0xb087('0x1d')]],'as':_0x5814c2['as'],'attributes':_0x5814c2[_0xb087('0x19')]};}):[]};}):[]};}):[]:[]})[_0xb087('0xc')](function(_0x2d2902){logger[_0xb087('0xd')]('ShowTrigger',_0xa6d90c);logger[_0xb087('0xf')](_0xb087('0x20'),_0xa6d90c,JSON['stringify'](_0x2d2902));_0x13fb2f(_0x2d2902);})['catch'](function(_0x1726c2){logger[_0xb087('0x12')](_0xb087('0x20'),_0x1726c2['message'],_0xa6d90c);_0x53a535(_0x2e1c57[_0xb087('0x12')](0x1f4,_0x1726c2[_0xb087('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/trunk/index.js b/server/api/trunk/index.js index 460f189..dcfacac 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 _0xeec6=['multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./trunk.controller','get','index','isAuthenticated','show','post','/:id/clone','clone','update','exports'];(function(_0x45ceb0,_0x58cb7b){var _0x3d1b1d=function(_0x449462){while(--_0x449462){_0x45ceb0['push'](_0x45ceb0['shift']());}};_0x3d1b1d(++_0x58cb7b);}(_0xeec6,0x1c2));var _0x6eec=function(_0x3a5648,_0x58054e){_0x3a5648=_0x3a5648-0x0;var _0x34126d=_0xeec6[_0x3a5648];return _0x34126d;};'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')]('/:id',auth[_0x6eec('0xb')](),controller[_0x6eec('0xc')]);router[_0x6eec('0xd')](_0x6eec('0xe'),auth['isAuthenticated'](),controller[_0x6eec('0xf')]);router[_0x6eec('0xd')]('/',auth[_0x6eec('0xb')](),controller['create']);router['put']('/:id',auth[_0x6eec('0xb')](),controller[_0x6eec('0x10')]);router['delete']('/:id',auth[_0x6eec('0xb')](),controller['destroy']);module[_0x6eec('0x11')]=router; \ No newline at end of file +var _0x2d17=['destroy','exports','multer','util','connect-timeout','express','../../components/auth/service','../../components/interaction/service','./trunk.controller','isAuthenticated','get','/:id','show','post','/:id/clone','clone','put','update','delete'];(function(_0x37cc5b,_0x282dac){var _0x16bcc5=function(_0x2fd502){while(--_0x2fd502){_0x37cc5b['push'](_0x37cc5b['shift']());}};_0x16bcc5(++_0x282dac);}(_0x2d17,0x17e));var _0x72d1=function(_0x5ecd93,_0x18ca38){_0x5ecd93=_0x5ecd93-0x0;var _0xa72cf6=_0x2d17[_0x5ecd93];return _0xa72cf6;};'use strict';var multer=require(_0x72d1('0x0'));var util=require(_0x72d1('0x1'));var path=require('path');var timeout=require(_0x72d1('0x2'));var express=require(_0x72d1('0x3'));var router=express['Router']();var auth=require(_0x72d1('0x4'));var interaction=require(_0x72d1('0x5'));var config=require('../../config/environment');var controller=require(_0x72d1('0x6'));router['get']('/',auth[_0x72d1('0x7')](),controller['index']);router[_0x72d1('0x8')](_0x72d1('0x9'),auth['isAuthenticated'](),controller[_0x72d1('0xa')]);router[_0x72d1('0xb')](_0x72d1('0xc'),auth['isAuthenticated'](),controller[_0x72d1('0xd')]);router[_0x72d1('0xb')]('/',auth[_0x72d1('0x7')](),controller['create']);router[_0x72d1('0xe')](_0x72d1('0x9'),auth[_0x72d1('0x7')](),controller[_0x72d1('0xf')]);router[_0x72d1('0x10')](_0x72d1('0x9'),auth[_0x72d1('0x7')](),controller[_0x72d1('0x11')]);module[_0x72d1('0x12')]=router; \ No newline at end of file diff --git a/server/api/trunk/trunk.attributes.js b/server/api/trunk/trunk.attributes.js index 5cc9265..2074c33 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 _0x3202=['name','ENUM','user','peer','friend','from-voip-provider','ALLOWED_PASSED_SCREEN','ALLOWED_FAILED_SCREEN','ALLOWED','PROHIB_NOT_SCREENED','PROHIB_FAILED_SCREEN','PROHIB','udp','setDataValue','join','getDataValue','transport','split','rfc2833','info','shortinfo','inband','auto','nonat','nat','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]','all','ulaw;alaw;gsm','allow','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22alaw\x22]','port,invite','insecure','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]','yes','never','\x22\x22\x20<>','INTEGER','always','accept','refuse','uac','uas','pai','fingerprint','certificate','active','actpass','dynamic','update','update,nonat','sequelize','exports','STRING'];(function(_0xec20ae,_0x518a6e){var _0x5a548f=function(_0x5b0b81){while(--_0x5b0b81){_0xec20ae['push'](_0xec20ae['shift']());}};_0x5a548f(++_0x518a6e);}(_0x3202,0x13b));var _0x2320=function(_0x596fca,_0x561214){_0x596fca=_0x596fca-0x0;var _0x1e64f1=_0x3202[_0x596fca];return _0x1e64f1;};'use strict';var Sequelize=require(_0x2320('0x0'));module[_0x2320('0x1')]={'name':{'type':Sequelize[_0x2320('0x2')],'allowNull':![],'unique':_0x2320('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0x2320('0x4')]('friend',_0x2320('0x5'),_0x2320('0x6')),'allowNull':![],'defaultValue':_0x2320('0x7')},'context':{'type':Sequelize[_0x2320('0x2')],'allowNull':![],'defaultValue':_0x2320('0x8')},'callingpres':{'type':Sequelize['ENUM']('ALLOWED_NOT_SCREENED',_0x2320('0x9'),_0x2320('0xa'),_0x2320('0xb'),_0x2320('0xc'),'PROHIB_PASSED_SCREEN',_0x2320('0xd'),_0x2320('0xe'))},'deny':{'type':Sequelize[_0x2320('0x2')]},'permit':{'type':Sequelize[_0x2320('0x2')]},'secret':{'type':Sequelize[_0x2320('0x2')]},'md5secret':{'type':Sequelize['STRING']},'remotesecret':{'type':Sequelize[_0x2320('0x2')]},'transport':{'type':Sequelize[_0x2320('0x2')],'defaultValue':_0x2320('0xf'),'set':function(_0x42065b){this[_0x2320('0x10')]('transport',_0x42065b?_0x42065b[_0x2320('0x11')](','):null);},'get':function(){return this[_0x2320('0x12')]('transport')?this[_0x2320('0x12')](_0x2320('0x13'))[_0x2320('0x14')](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]'},'dtmfmode':{'type':Sequelize[_0x2320('0x4')](_0x2320('0x15'),_0x2320('0x16'),_0x2320('0x17'),_0x2320('0x18'),_0x2320('0x19')),'defaultValue':_0x2320('0x15')},'directmedia':{'type':Sequelize[_0x2320('0x4')]('yes','no',_0x2320('0x1a'),'update','outgoing'),'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0x2320('0x4')]('yes','no'),'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0x2320('0x2')]},'directmediadeny':{'type':Sequelize[_0x2320('0x2')]},'nat':{'type':Sequelize[_0x2320('0x2')],'defaultValue':'force_rport,comedia','set':function(_0x54dae9){this['setDataValue'](_0x2320('0x1b'),_0x54dae9?_0x54dae9['join'](','):null);},'get':function(){return this['getDataValue'](_0x2320('0x1b'))?this[_0x2320('0x12')](_0x2320('0x1b'))[_0x2320('0x14')](','):null;},'comment':_0x2320('0x1c')},'callgroup':{'type':Sequelize[_0x2320('0x2')]},'namedcallgroup':{'type':Sequelize[_0x2320('0x2')]},'pickupgroup':{'type':Sequelize[_0x2320('0x2')]},'namedpickupgroup':{'type':Sequelize[_0x2320('0x2')]},'language':{'type':Sequelize[_0x2320('0x2')],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0x2320('0x2')],'allowNull':!![]},'disallow':{'type':Sequelize[_0x2320('0x2')],'defaultValue':_0x2320('0x1d')},'allow':{'type':Sequelize[_0x2320('0x2')],'allowNull':![],'defaultValue':_0x2320('0x1e'),'set':function(_0x18d4cb){this[_0x2320('0x10')](_0x2320('0x1f'),_0x18d4cb?_0x18d4cb[_0x2320('0x11')](';'):_0x2320('0x1e'));},'get':function(){return this[_0x2320('0x12')]('allow')?this[_0x2320('0x12')](_0x2320('0x1f'))[_0x2320('0x14')](';'):null;},'comment':_0x2320('0x20')},'autoframing':{'type':Sequelize[_0x2320('0x4')]('yes','no')},'insecure':{'type':Sequelize[_0x2320('0x2')],'defaultValue':_0x2320('0x21'),'set':function(_0x178f56){this[_0x2320('0x10')](_0x2320('0x22'),_0x178f56?_0x178f56[_0x2320('0x11')](','):null);},'get':function(){return this[_0x2320('0x12')]('insecure')?this['getDataValue'](_0x2320('0x22'))[_0x2320('0x14')](','):null;},'comment':_0x2320('0x23')},'trustrpid':{'type':Sequelize[_0x2320('0x4')](_0x2320('0x24'),'no'),'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0x2320('0x4')](_0x2320('0x24'),'no'),'defaultValue':'no'},'progressinband':{'type':Sequelize[_0x2320('0x4')](_0x2320('0x24'),'no',_0x2320('0x25'))},'promiscredir':{'type':Sequelize['ENUM'](_0x2320('0x24'),'no')},'useclientcode':{'type':Sequelize['ENUM']('yes','no')},'accountcode':{'type':Sequelize['INTEGER'](0xb)},'setvar':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize[_0x2320('0x2')],'defaultValue':_0x2320('0x26')},'amaflags':{'type':Sequelize[_0x2320('0x2')]},'callcounter':{'type':Sequelize[_0x2320('0x4')](_0x2320('0x24'),'no'),'defaultValue':_0x2320('0x24')},'busylevel':{'type':Sequelize[_0x2320('0x27')](0xb)},'allowoverlap':{'type':Sequelize[_0x2320('0x4')](_0x2320('0x24'),'no')},'allowsubscribe':{'type':Sequelize[_0x2320('0x4')](_0x2320('0x24'),'no')},'allowtransfer':{'type':Sequelize[_0x2320('0x4')](_0x2320('0x24'),'no')},'ignoresdpversion':{'type':Sequelize['ENUM'](_0x2320('0x24'),'no')},'subscribecontext':{'type':Sequelize[_0x2320('0x2')]},'template':{'type':Sequelize[_0x2320('0x2')]},'videosupport':{'type':Sequelize[_0x2320('0x4')](_0x2320('0x24'),'no',_0x2320('0x28')),'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0x2320('0x27')](0xb)},'rfc2833compensate':{'type':Sequelize[_0x2320('0x4')](_0x2320('0x24'),'no')},'mailbox':{'type':Sequelize[_0x2320('0x2')]},'session_timers':{'type':Sequelize['ENUM'](_0x2320('0x29'),_0x2320('0x2a'),'originate')},'session_expires':{'type':Sequelize[_0x2320('0x27')](0xb)},'session_minse':{'type':Sequelize['INTEGER'](0xb)},'session_refresher':{'type':Sequelize['ENUM'](_0x2320('0x2b'),_0x2320('0x2c')),'defaultValue':_0x2320('0x2c')},'t38pt_usertpsource':{'type':Sequelize['STRING']},'regexten':{'type':Sequelize[_0x2320('0x2')]},'fromdomain':{'type':Sequelize[_0x2320('0x2')]},'fromuser':{'type':Sequelize[_0x2320('0x2')]},'port':{'type':Sequelize[_0x2320('0x27')](0x5)},'qualify':{'type':Sequelize['ENUM'](_0x2320('0x24'),'no'),'defaultValue':_0x2320('0x24')},'keepalive':{'type':Sequelize[_0x2320('0x27')](0xb)},'defaultip':{'type':Sequelize[_0x2320('0x2')]},'defaultuser':{'type':Sequelize[_0x2320('0x2')]},'rtptimeout':{'type':Sequelize[_0x2320('0x27')](0xb)},'rtpholdtimeout':{'type':Sequelize[_0x2320('0x27')](0xb)},'rtpkeepalive':{'type':Sequelize['INTEGER'](0xb)},'sendrpid':{'type':Sequelize[_0x2320('0x4')](_0x2320('0x24'),'no',_0x2320('0x2d')),'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0x2320('0x2')]},'callbackextension':{'type':Sequelize[_0x2320('0x2')]},'timert1':{'type':Sequelize['INTEGER'](0xb)},'timerb':{'type':Sequelize[_0x2320('0x27')](0xb)},'qualifyfreq':{'type':Sequelize['INTEGER'](0xb)},'contactpermit':{'type':Sequelize[_0x2320('0x2')]},'contactdeny':{'type':Sequelize[_0x2320('0x2')]},'contactacl':{'type':Sequelize[_0x2320('0x2')]},'unsolicited_mailbox':{'type':Sequelize[_0x2320('0x2')]},'use_q850_reason':{'type':Sequelize[_0x2320('0x2')]},'maxforwards':{'type':Sequelize['INTEGER'](0xb)},'encryption':{'type':Sequelize[_0x2320('0x4')](_0x2320('0x24'),'no'),'defaultValue':'no'},'avpf':{'type':Sequelize[_0x2320('0x4')](_0x2320('0x24'),'no')},'force_avp':{'type':Sequelize[_0x2320('0x4')](_0x2320('0x24'),'no')},'icesupport':{'type':Sequelize[_0x2320('0x4')](_0x2320('0x24'),'no')},'dtlsenable':{'type':Sequelize[_0x2320('0x4')]('yes','no')},'dtlsverify':{'type':Sequelize[_0x2320('0x4')](_0x2320('0x24'),'no',_0x2320('0x2e'),_0x2320('0x2f'))},'dtlsrekey':{'type':Sequelize[_0x2320('0x27')](0xb)},'dtlscertfile':{'type':Sequelize[_0x2320('0x2')]},'dtlsprivatekey':{'type':Sequelize[_0x2320('0x2')]},'dtlscipher':{'type':Sequelize[_0x2320('0x2')]},'dtlscafile':{'type':Sequelize[_0x2320('0x2')]},'dtlscapath':{'type':Sequelize[_0x2320('0x2')]},'dtlssetup':{'type':Sequelize[_0x2320('0x4')](_0x2320('0x30'),'passive',_0x2320('0x31')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0x2320('0x2')]},'usereqphone':{'type':Sequelize[_0x2320('0x4')](_0x2320('0x24'),'no'),'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0x2320('0x2')]},'recordofffeature':{'type':Sequelize[_0x2320('0x2')]},'call_limit':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x3e8},'registertrying':{'type':Sequelize[_0x2320('0x4')]('yes','no')},'subscribemwi':{'type':Sequelize[_0x2320('0x4')]('yes','no')},'vmexten':{'type':Sequelize[_0x2320('0x2')]},'mohinterpret':{'type':Sequelize['STRING']},'mohsuggest':{'type':Sequelize[_0x2320('0x2')]},'parkinglot':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']},'host':{'type':Sequelize[_0x2320('0x2')],'defaultValue':_0x2320('0x32')},'canreinvite':{'type':Sequelize[_0x2320('0x4')]('yes','no',_0x2320('0x1a'),_0x2320('0x33'),_0x2320('0x34')),'defaultValue':'no'},'registry':{'type':Sequelize[_0x2320('0x2')]},'otherFields':{'type':Sequelize[_0x2320('0x2')]},'active':{'type':Sequelize['BOOLEAN'],'allowNull':![],'defaultValue':!![]},'t38pt_udptl':{'type':Sequelize['STRING'],'defaultValue':'no'}}; \ No newline at end of file +var _0x113d=['auto','yes','update','outgoing','force_rport,comedia','nat','split','all','ulaw;alaw;gsm','allow','port,invite','setDataValue','insecure','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]','never','INTEGER','always','accept','refuse','originate','uac','uas','pai','certificate','active','passive','actpass','dynamic','update,nonat','BOOLEAN','sequelize','exports','STRING','name','friend','user','peer','ENUM','ALLOWED_NOT_SCREENED','ALLOWED_FAILED_SCREEN','ALLOWED','PROHIB_PASSED_SCREEN','PROHIB_FAILED_SCREEN','transport','join','getDataValue','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','rfc2833','info','shortinfo','inband'];(function(_0x239ebd,_0x1ce664){var _0x25c9c7=function(_0x133bdd){while(--_0x133bdd){_0x239ebd['push'](_0x239ebd['shift']());}};_0x25c9c7(++_0x1ce664);}(_0x113d,0xea));var _0xd113=function(_0x25b244,_0x165d6b){_0x25b244=_0x25b244-0x0;var _0xcc202=_0x113d[_0x25b244];return _0xcc202;};'use strict';var Sequelize=require(_0xd113('0x0'));module[_0xd113('0x1')]={'name':{'type':Sequelize[_0xd113('0x2')],'allowNull':![],'unique':_0xd113('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize['ENUM'](_0xd113('0x4'),_0xd113('0x5'),_0xd113('0x6')),'allowNull':![],'defaultValue':_0xd113('0x4')},'context':{'type':Sequelize[_0xd113('0x2')],'allowNull':![],'defaultValue':'from-voip-provider'},'callingpres':{'type':Sequelize[_0xd113('0x7')](_0xd113('0x8'),'ALLOWED_PASSED_SCREEN',_0xd113('0x9'),_0xd113('0xa'),'PROHIB_NOT_SCREENED',_0xd113('0xb'),_0xd113('0xc'),'PROHIB')},'deny':{'type':Sequelize[_0xd113('0x2')]},'permit':{'type':Sequelize[_0xd113('0x2')]},'secret':{'type':Sequelize[_0xd113('0x2')]},'md5secret':{'type':Sequelize['STRING']},'remotesecret':{'type':Sequelize[_0xd113('0x2')]},'transport':{'type':Sequelize[_0xd113('0x2')],'defaultValue':'udp','set':function(_0x5b04e8){this['setDataValue'](_0xd113('0xd'),_0x5b04e8?_0x5b04e8[_0xd113('0xe')](','):null);},'get':function(){return this[_0xd113('0xf')]('transport')?this[_0xd113('0xf')](_0xd113('0xd'))['split'](','):null;},'comment':_0xd113('0x10')},'dtmfmode':{'type':Sequelize[_0xd113('0x7')](_0xd113('0x11'),_0xd113('0x12'),_0xd113('0x13'),_0xd113('0x14'),_0xd113('0x15')),'defaultValue':_0xd113('0x11')},'directmedia':{'type':Sequelize[_0xd113('0x7')](_0xd113('0x16'),'no','nonat',_0xd113('0x17'),_0xd113('0x18')),'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0xd113('0x7')](_0xd113('0x16'),'no'),'defaultValue':'no'},'directmediapermit':{'type':Sequelize['STRING']},'directmediadeny':{'type':Sequelize[_0xd113('0x2')]},'nat':{'type':Sequelize[_0xd113('0x2')],'defaultValue':_0xd113('0x19'),'set':function(_0x290ab0){this['setDataValue'](_0xd113('0x1a'),_0x290ab0?_0x290ab0[_0xd113('0xe')](','):null);},'get':function(){return this[_0xd113('0xf')](_0xd113('0x1a'))?this[_0xd113('0xf')]('nat')[_0xd113('0x1b')](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]'},'callgroup':{'type':Sequelize[_0xd113('0x2')]},'namedcallgroup':{'type':Sequelize[_0xd113('0x2')]},'pickupgroup':{'type':Sequelize[_0xd113('0x2')]},'namedpickupgroup':{'type':Sequelize[_0xd113('0x2')]},'language':{'type':Sequelize['STRING'],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0xd113('0x2')],'allowNull':!![]},'disallow':{'type':Sequelize[_0xd113('0x2')],'defaultValue':_0xd113('0x1c')},'allow':{'type':Sequelize[_0xd113('0x2')],'allowNull':![],'defaultValue':_0xd113('0x1d'),'set':function(_0x429fa8){this['setDataValue'](_0xd113('0x1e'),_0x429fa8?_0x429fa8[_0xd113('0xe')](';'):_0xd113('0x1d'));},'get':function(){return this['getDataValue'](_0xd113('0x1e'))?this[_0xd113('0xf')](_0xd113('0x1e'))['split'](';'):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22alaw\x22]'},'autoframing':{'type':Sequelize[_0xd113('0x7')](_0xd113('0x16'),'no')},'insecure':{'type':Sequelize[_0xd113('0x2')],'defaultValue':_0xd113('0x1f'),'set':function(_0x378dcb){this[_0xd113('0x20')](_0xd113('0x21'),_0x378dcb?_0x378dcb[_0xd113('0xe')](','):null);},'get':function(){return this[_0xd113('0xf')](_0xd113('0x21'))?this[_0xd113('0xf')](_0xd113('0x21'))[_0xd113('0x1b')](','):null;},'comment':_0xd113('0x22')},'trustrpid':{'type':Sequelize[_0xd113('0x7')](_0xd113('0x16'),'no'),'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize['ENUM'](_0xd113('0x16'),'no'),'defaultValue':'no'},'progressinband':{'type':Sequelize[_0xd113('0x7')](_0xd113('0x16'),'no',_0xd113('0x23'))},'promiscredir':{'type':Sequelize[_0xd113('0x7')]('yes','no')},'useclientcode':{'type':Sequelize[_0xd113('0x7')](_0xd113('0x16'),'no')},'accountcode':{'type':Sequelize[_0xd113('0x24')](0xb)},'setvar':{'type':Sequelize[_0xd113('0x2')]},'callerid':{'type':Sequelize[_0xd113('0x2')],'defaultValue':'\x22\x22\x20<>'},'amaflags':{'type':Sequelize[_0xd113('0x2')]},'callcounter':{'type':Sequelize['ENUM'](_0xd113('0x16'),'no'),'defaultValue':_0xd113('0x16')},'busylevel':{'type':Sequelize['INTEGER'](0xb)},'allowoverlap':{'type':Sequelize['ENUM'](_0xd113('0x16'),'no')},'allowsubscribe':{'type':Sequelize[_0xd113('0x7')](_0xd113('0x16'),'no')},'allowtransfer':{'type':Sequelize['ENUM'](_0xd113('0x16'),'no')},'ignoresdpversion':{'type':Sequelize[_0xd113('0x7')]('yes','no')},'subscribecontext':{'type':Sequelize[_0xd113('0x2')]},'template':{'type':Sequelize[_0xd113('0x2')]},'videosupport':{'type':Sequelize[_0xd113('0x7')](_0xd113('0x16'),'no',_0xd113('0x25')),'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0xd113('0x24')](0xb)},'rfc2833compensate':{'type':Sequelize['ENUM']('yes','no')},'mailbox':{'type':Sequelize['STRING']},'session_timers':{'type':Sequelize[_0xd113('0x7')](_0xd113('0x26'),_0xd113('0x27'),_0xd113('0x28'))},'session_expires':{'type':Sequelize[_0xd113('0x24')](0xb)},'session_minse':{'type':Sequelize['INTEGER'](0xb)},'session_refresher':{'type':Sequelize[_0xd113('0x7')](_0xd113('0x29'),_0xd113('0x2a')),'defaultValue':_0xd113('0x2a')},'t38pt_usertpsource':{'type':Sequelize['STRING']},'regexten':{'type':Sequelize[_0xd113('0x2')]},'fromdomain':{'type':Sequelize[_0xd113('0x2')]},'fromuser':{'type':Sequelize[_0xd113('0x2')]},'port':{'type':Sequelize['INTEGER'](0x5)},'qualify':{'type':Sequelize['ENUM'](_0xd113('0x16'),'no'),'defaultValue':_0xd113('0x16')},'keepalive':{'type':Sequelize[_0xd113('0x24')](0xb)},'defaultip':{'type':Sequelize[_0xd113('0x2')]},'defaultuser':{'type':Sequelize[_0xd113('0x2')]},'rtptimeout':{'type':Sequelize[_0xd113('0x24')](0xb)},'rtpholdtimeout':{'type':Sequelize[_0xd113('0x24')](0xb)},'rtpkeepalive':{'type':Sequelize[_0xd113('0x24')](0xb)},'sendrpid':{'type':Sequelize[_0xd113('0x7')](_0xd113('0x16'),'no',_0xd113('0x2b')),'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0xd113('0x2')]},'callbackextension':{'type':Sequelize[_0xd113('0x2')]},'timert1':{'type':Sequelize[_0xd113('0x24')](0xb)},'timerb':{'type':Sequelize[_0xd113('0x24')](0xb)},'qualifyfreq':{'type':Sequelize[_0xd113('0x24')](0xb)},'contactpermit':{'type':Sequelize[_0xd113('0x2')]},'contactdeny':{'type':Sequelize[_0xd113('0x2')]},'contactacl':{'type':Sequelize[_0xd113('0x2')]},'unsolicited_mailbox':{'type':Sequelize[_0xd113('0x2')]},'use_q850_reason':{'type':Sequelize['STRING']},'maxforwards':{'type':Sequelize[_0xd113('0x24')](0xb)},'encryption':{'type':Sequelize['ENUM'](_0xd113('0x16'),'no'),'defaultValue':'no'},'avpf':{'type':Sequelize['ENUM'](_0xd113('0x16'),'no')},'force_avp':{'type':Sequelize[_0xd113('0x7')](_0xd113('0x16'),'no')},'icesupport':{'type':Sequelize[_0xd113('0x7')](_0xd113('0x16'),'no')},'dtlsenable':{'type':Sequelize['ENUM'](_0xd113('0x16'),'no')},'dtlsverify':{'type':Sequelize['ENUM']('yes','no','fingerprint',_0xd113('0x2c'))},'dtlsrekey':{'type':Sequelize[_0xd113('0x24')](0xb)},'dtlscertfile':{'type':Sequelize[_0xd113('0x2')]},'dtlsprivatekey':{'type':Sequelize['STRING']},'dtlscipher':{'type':Sequelize['STRING']},'dtlscafile':{'type':Sequelize['STRING']},'dtlscapath':{'type':Sequelize[_0xd113('0x2')]},'dtlssetup':{'type':Sequelize[_0xd113('0x7')](_0xd113('0x2d'),_0xd113('0x2e'),_0xd113('0x2f')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize['STRING']},'usereqphone':{'type':Sequelize[_0xd113('0x7')](_0xd113('0x16'),'no'),'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0xd113('0x2')]},'recordofffeature':{'type':Sequelize[_0xd113('0x2')]},'call_limit':{'type':Sequelize[_0xd113('0x24')](0xb),'defaultValue':0x3e8},'registertrying':{'type':Sequelize[_0xd113('0x7')](_0xd113('0x16'),'no')},'subscribemwi':{'type':Sequelize[_0xd113('0x7')](_0xd113('0x16'),'no')},'vmexten':{'type':Sequelize[_0xd113('0x2')]},'mohinterpret':{'type':Sequelize[_0xd113('0x2')]},'mohsuggest':{'type':Sequelize[_0xd113('0x2')]},'parkinglot':{'type':Sequelize[_0xd113('0x2')]},'description':{'type':Sequelize[_0xd113('0x2')]},'host':{'type':Sequelize[_0xd113('0x2')],'defaultValue':_0xd113('0x30')},'canreinvite':{'type':Sequelize['ENUM'](_0xd113('0x16'),'no','nonat',_0xd113('0x17'),_0xd113('0x31')),'defaultValue':'no'},'registry':{'type':Sequelize[_0xd113('0x2')]},'otherFields':{'type':Sequelize[_0xd113('0x2')]},'active':{'type':Sequelize[_0xd113('0x32')],'allowNull':![],'defaultValue':!![]},'t38pt_udptl':{'type':Sequelize[_0xd113('0x2')],'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 5b457a9..1ac5050 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 _0xd523=['server/files/templates/trunk.ejs','utf8','render','writeFileSync','/etc/asterisk/sip_xcally_trunks.conf','/etc/asterisk/sip_xcally_registers.conf','Reload','chan_sip.so','server/files/templates/registry.ejs','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','util','path','sox','to-csv','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','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','Trunk,\x20%s,\x20%s,\x20%s','stringify','error','Trunk,\x20%s,\x20%s','message','result','catch','status','end','json','offset','limit','Content-Range','apply','reject','update','destroy','Trunks','UserProfileResource','sendStatus','stack','name','index','map','rawAttributes','type','model','keys','query','filters','intersection','fields','attributes','length','nolimit','order','sort','where','merge','filter','options','count','includeAll','Trunk','show','params','find','clone','include','get','omit','createdAt','updatedAt','body','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','findAll','readFileSync','join','root'];(function(_0x3e3509,_0x2531e7){var _0x2d8596=function(_0x4e18fc){while(--_0x4e18fc){_0x3e3509['push'](_0x3e3509['shift']());}};_0x2d8596(++_0x2531e7);}(_0xd523,0x153));var _0x3d52=function(_0xd53b3e,_0x10e746){_0xd53b3e=_0xd53b3e-0x0;var _0x432020=_0xd523[_0xd53b3e];return _0x432020;};'use strict';var pdf=require(_0x3d52('0x0'));var emlformat=require(_0x3d52('0x1'));var rimraf=require(_0x3d52('0x2'));var zipdir=require(_0x3d52('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x3d52('0x4'));var moment=require(_0x3d52('0x5'));var BPromise=require(_0x3d52('0x6'));var Mustache=require('mustache');var util=require(_0x3d52('0x7'));var path=require(_0x3d52('0x8'));var sox=require(_0x3d52('0x9'));var csv=require(_0x3d52('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0x3d52('0xb'));var crypto=require(_0x3d52('0xc'));var jsforce=require(_0x3d52('0xd'));var deskjs=require(_0x3d52('0xe'));var toCsv=require(_0x3d52('0xa'));var querystring=require(_0x3d52('0xf'));var Papa=require(_0x3d52('0x10'));var Redis=require(_0x3d52('0x11'));var authService=require(_0x3d52('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x3d52('0x13'));var hardwareService=require(_0x3d52('0x14'));var logger=require(_0x3d52('0x15'))(_0x3d52('0x16'));var utils=require(_0x3d52('0x17'));var config=require('../../config/environment');var db=require(_0x3d52('0x18'))['db'];var jayson=require('jayson/promise');var client=jayson['client'][_0x3d52('0x19')]({'port':0x232a});function checkPasswordPattern(_0x42b184,_0x4fcdab,_0x511971){if(_0x511971){var _0x546bb4=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x546bb4[_0x3d52('0x1a')](_0x4fcdab)){return _0x42b184;}else{throw new db[(_0x3d52('0x1b'))][(_0x3d52('0x1c'))](_0x3d52('0x1d'));}}else{return _0x42b184;}}function respondWithRpcPromise(_0x336261,_0x5add11,_0x1aaa98,_0x36acb8){return new BPromise(function(_0x2e956d,_0x360659){var _0x153c89=_0x36acb8||client;return _0x153c89[_0x3d52('0x1e')](_0x336261,_0x1aaa98)[_0x3d52('0x1f')](function(_0x10ec1e){logger[_0x3d52('0x20')]('Trunk,\x20%s,\x20%s',_0x5add11,_0x3d52('0x21'));logger[_0x3d52('0x22')](_0x3d52('0x23'),_0x5add11,'request\x20sent',JSON[_0x3d52('0x24')](_0x10ec1e));if(_0x10ec1e[_0x3d52('0x25')]){if(_0x10ec1e[_0x3d52('0x25')]['code']===0x1f4){logger[_0x3d52('0x25')](_0x3d52('0x26'),_0x5add11,_0x10ec1e[_0x3d52('0x25')][_0x3d52('0x27')]);return _0x360659(_0x10ec1e[_0x3d52('0x25')][_0x3d52('0x27')]);}logger[_0x3d52('0x25')](_0x3d52('0x26'),_0x5add11,_0x10ec1e['error'][_0x3d52('0x27')]);return _0x2e956d(_0x10ec1e[_0x3d52('0x25')][_0x3d52('0x27')]);}else{logger['info'](_0x3d52('0x26'),_0x5add11,_0x3d52('0x21'));_0x2e956d(_0x10ec1e[_0x3d52('0x28')][_0x3d52('0x27')]);}})[_0x3d52('0x29')](function(_0x349b30){logger[_0x3d52('0x25')](_0x3d52('0x26'),_0x5add11,_0x349b30);_0x360659(_0x349b30);});});}function respondWithStatusCode(_0x44ba59,_0x16b9d8){_0x16b9d8=_0x16b9d8||0xcc;return function(_0x1ef6db){if(_0x1ef6db){return _0x44ba59['sendStatus'](_0x16b9d8);}return _0x44ba59[_0x3d52('0x2a')](_0x16b9d8)[_0x3d52('0x2b')]();};}function respondWithResult(_0x2e3957,_0xbefe8c){_0xbefe8c=_0xbefe8c||0xc8;return function(_0x490ce5){if(_0x490ce5){return _0x2e3957['status'](_0xbefe8c)[_0x3d52('0x2c')](_0x490ce5);}};}function respondWithFilteredResult(_0x11bf44,_0x28e50d){return function(_0x5adddf){if(_0x5adddf){var _0x209cca=_0x5adddf['count'],_0x4312a7=_0x28e50d[_0x3d52('0x2d')],_0x2fd0ec=_0x28e50d[_0x3d52('0x2d')]+_0x28e50d[_0x3d52('0x2e')],_0x2f2934;if(_0x2fd0ec>=_0x209cca){_0x2fd0ec=_0x209cca;_0x2f2934=0xc8;}else{_0x2f2934=0xce;}_0x11bf44[_0x3d52('0x2a')](_0x2f2934);return _0x11bf44['set'](_0x3d52('0x2f'),_0x4312a7+'-'+_0x2fd0ec+'/'+_0x209cca)['json'](_0x5adddf);}return null;};}function patchUpdates(_0x5f006b){return function(_0x389582){try{jsonpatch[_0x3d52('0x30')](_0x389582,_0x5f006b,!![]);}catch(_0x5e4e7b){return BPromise[_0x3d52('0x31')](_0x5e4e7b);}return _0x389582['save']();};}function saveUpdates(_0x2dd85f,_0x4c0273){return function(_0x56ac79){if(_0x56ac79){return _0x56ac79[_0x3d52('0x32')](_0x2dd85f)[_0x3d52('0x1f')](function(_0xc9b8bc){return _0xc9b8bc;});}return null;};}function removeEntity(_0x2e0cd6,_0x410dc3){return function(_0x453f96){if(_0x453f96){return _0x453f96[_0x3d52('0x33')]()[_0x3d52('0x1f')](function(){var _0x26d1d8=_0x453f96['get']({'plain':!![]});var _0x1919a9=_0x3d52('0x34');return db[_0x3d52('0x35')][_0x3d52('0x33')]({'where':{'type':_0x1919a9,'resourceId':_0x26d1d8['id']}})['then'](function(){return _0x453f96;});})[_0x3d52('0x1f')](function(){_0x2e0cd6[_0x3d52('0x2a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3f8bb6,_0x4fdb9c){return function(_0x464764){if(!_0x464764){_0x3f8bb6[_0x3d52('0x36')](0x194);}return _0x464764;};}function handleError(_0x3077ed,_0x54880b){_0x54880b=_0x54880b||0x1f4;return function(_0x2798a7){logger['error'](_0x2798a7[_0x3d52('0x37')]);if(_0x2798a7[_0x3d52('0x38')]){delete _0x2798a7[_0x3d52('0x38')];}_0x3077ed['status'](_0x54880b)['send'](_0x2798a7);};}exports[_0x3d52('0x39')]=function(_0xf6de70,_0x98706f){var _0x5a3492={},_0x328138={},_0x22262c={'count':0x0,'rows':[]};var _0xa49220=_[_0x3d52('0x3a')](db['Trunk'][_0x3d52('0x3b')],function(_0x4dc059){return{'name':_0x4dc059['fieldName'],'type':_0x4dc059[_0x3d52('0x3c')]['key']};});_0x328138[_0x3d52('0x3d')]=_['map'](_0xa49220,_0x3d52('0x38'));_0x328138['query']=_[_0x3d52('0x3e')](_0xf6de70[_0x3d52('0x3f')]);_0x328138[_0x3d52('0x40')]=_['intersection'](_0x328138[_0x3d52('0x3d')],_0x328138[_0x3d52('0x3f')]);_0x5a3492['attributes']=_[_0x3d52('0x41')](_0x328138[_0x3d52('0x3d')],qs[_0x3d52('0x42')](_0xf6de70[_0x3d52('0x3f')][_0x3d52('0x42')]));_0x5a3492[_0x3d52('0x43')]=_0x5a3492[_0x3d52('0x43')][_0x3d52('0x44')]?_0x5a3492['attributes']:_0x328138['model'];if(!_0xf6de70['query']['hasOwnProperty'](_0x3d52('0x45'))){_0x5a3492['limit']=qs[_0x3d52('0x2e')](_0xf6de70['query'][_0x3d52('0x2e')]);_0x5a3492[_0x3d52('0x2d')]=qs[_0x3d52('0x2d')](_0xf6de70[_0x3d52('0x3f')]['offset']);}_0x5a3492[_0x3d52('0x46')]=qs[_0x3d52('0x47')](_0xf6de70['query'][_0x3d52('0x47')]);_0x5a3492[_0x3d52('0x48')]=qs[_0x3d52('0x40')](_['pick'](_0xf6de70[_0x3d52('0x3f')],_0x328138['filters']),_0xa49220);if(_0xf6de70['query']['filter']){_0x5a3492['where']=_[_0x3d52('0x49')](_0x5a3492[_0x3d52('0x48')],{'$or':_[_0x3d52('0x3a')](_0xa49220,function(_0x4dbd13){if(_0x4dbd13[_0x3d52('0x3c')]!=='VIRTUAL'){var _0x3b4e1d={};_0x3b4e1d[_0x4dbd13[_0x3d52('0x38')]]={'$like':'%'+_0xf6de70['query'][_0x3d52('0x4a')]+'%'};return _0x3b4e1d;}})});}_0x5a3492=_[_0x3d52('0x49')]({},_0x5a3492,_0xf6de70[_0x3d52('0x4b')]);var _0x2597d4={'where':_0x5a3492['where']};return db['Trunk'][_0x3d52('0x4c')](_0x2597d4)['then'](function(_0x42a438){_0x22262c[_0x3d52('0x4c')]=_0x42a438;if(_0xf6de70[_0x3d52('0x3f')][_0x3d52('0x4d')]){_0x5a3492['include']=[{'all':!![]}];}return db[_0x3d52('0x4e')]['findAll'](_0x5a3492);})[_0x3d52('0x1f')](function(_0x2911da){_0x22262c['rows']=_0x2911da;return _0x22262c;})[_0x3d52('0x1f')](respondWithFilteredResult(_0x98706f,_0x5a3492))[_0x3d52('0x29')](handleError(_0x98706f,null));};exports[_0x3d52('0x4f')]=function(_0x432521,_0x2b0c0e){var _0x3f4db8={'raw':![],'where':{'id':_0x432521[_0x3d52('0x50')]['id']}},_0x439901={};_0x439901[_0x3d52('0x3d')]=_['keys'](db[_0x3d52('0x4e')][_0x3d52('0x3b')]);_0x439901['query']=_[_0x3d52('0x3e')](_0x432521['query']);_0x439901[_0x3d52('0x40')]=_[_0x3d52('0x41')](_0x439901[_0x3d52('0x3d')],_0x439901['query']);_0x3f4db8[_0x3d52('0x43')]=_[_0x3d52('0x41')](_0x439901['model'],qs['fields'](_0x432521[_0x3d52('0x3f')][_0x3d52('0x42')]));_0x3f4db8['attributes']=_0x3f4db8[_0x3d52('0x43')][_0x3d52('0x44')]?_0x3f4db8[_0x3d52('0x43')]:_0x439901[_0x3d52('0x3d')];if(_0x432521[_0x3d52('0x3f')][_0x3d52('0x4d')]){_0x3f4db8['include']=[{'all':!![]}];}_0x3f4db8=_[_0x3d52('0x49')]({},_0x3f4db8,_0x432521[_0x3d52('0x4b')]);return db[_0x3d52('0x4e')][_0x3d52('0x51')](_0x3f4db8)[_0x3d52('0x1f')](handleEntityNotFound(_0x2b0c0e,null))[_0x3d52('0x1f')](respondWithResult(_0x2b0c0e,null))[_0x3d52('0x29')](handleError(_0x2b0c0e,null));};exports[_0x3d52('0x52')]=function(_0x5d0e25,_0x170d2c){var _0x4a005b={'where':{'id':_0x5d0e25[_0x3d52('0x50')]['id']}},_0x2c7496={};_0x2c7496['model']=_['keys'](db[_0x3d52('0x4e')][_0x3d52('0x3b')]);_0x4a005b[_0x3d52('0x43')]=_[_0x3d52('0x41')](_0x2c7496[_0x3d52('0x3d')],qs[_0x3d52('0x42')](_0x5d0e25[_0x3d52('0x3f')][_0x3d52('0x42')]));_0x4a005b[_0x3d52('0x43')]=_0x4a005b['attributes'][_0x3d52('0x44')]?_0x4a005b['attributes']:_0x2c7496[_0x3d52('0x3d')];if(_0x5d0e25[_0x3d52('0x3f')][_0x3d52('0x4d')]){_0x4a005b[_0x3d52('0x53')]=[{'all':!![]}];}_0x4a005b=_[_0x3d52('0x49')]({},_0x4a005b,_0x5d0e25[_0x3d52('0x4b')]);return db['Trunk'][_0x3d52('0x51')](_0x4a005b)[_0x3d52('0x1f')](handleEntityNotFound(_0x170d2c,null))[_0x3d52('0x1f')](function(_0x257646){if(_0x257646){var _0x5538b4=_0x257646[_0x3d52('0x54')]({'plain':!![]});_0x5538b4=qs[_0x3d52('0x55')](_0x5538b4,['id',_0x3d52('0x56'),_0x3d52('0x57')]);_0x5d0e25[_0x3d52('0x58')]=_['omit'](_0x5d0e25[_0x3d52('0x58')],['id','createdAt',_0x3d52('0x57')]);return db['Trunk'][_0x3d52('0x59')](_[_0x3d52('0x49')](_0x5538b4,_0x5d0e25['body']),{'include':_0x5d0e25['query']['includeAll']?[{'all':!![]}]:undefined})[_0x3d52('0x1f')](function(_0x4c7a76){var _0x38db76=_0x5d0e25[_0x3d52('0x5a')]['get']({'plain':!![]});if(!_0x38db76)throw new Error(_0x3d52('0x5b'));if(_0x38db76[_0x3d52('0x5c')]===_0x3d52('0x5a')){var _0x581b60=_0x4c7a76[_0x3d52('0x54')]({'plain':!![]});var _0x31d3a9=_0x3d52('0x34');return db[_0x3d52('0x5d')][_0x3d52('0x51')]({'where':{'name':_0x31d3a9,'userProfileId':_0x38db76[_0x3d52('0x5e')]},'raw':!![]})[_0x3d52('0x1f')](function(_0x111831){if(_0x111831&&_0x111831[_0x3d52('0x5f')]===0x0){return db[_0x3d52('0x35')][_0x3d52('0x59')]({'name':_0x581b60[_0x3d52('0x38')],'resourceId':_0x581b60['id'],'type':_0x111831[_0x3d52('0x38')],'sectionId':_0x111831['id']},{})[_0x3d52('0x1f')](function(){return _0x4c7a76;});}else{return _0x4c7a76;}})[_0x3d52('0x29')](function(_0x337107){logger[_0x3d52('0x25')](_0x3d52('0x60'),_0x337107);throw _0x337107;});}return _0x4c7a76;});}})[_0x3d52('0x1f')](respondWithResult(_0x170d2c,0xc9))['catch'](handleError(_0x170d2c,null));};exports[_0x3d52('0x59')]=function(_0x4ec9d9,_0x47dc11,_0x372374){var _0x238fbd;return db[_0x3d52('0x4e')]['create'](_0x4ec9d9[_0x3d52('0x58')],{'raw':!![]})[_0x3d52('0x1f')](function(_0x162004){_0x238fbd=_0x162004;return db[_0x3d52('0x4e')][_0x3d52('0x61')]({'raw':!![]});})[_0x3d52('0x1f')](function(_0x118b68){var _0xb1e4df=fs[_0x3d52('0x62')](path[_0x3d52('0x63')](config[_0x3d52('0x64')],_0x3d52('0x65')),_0x3d52('0x66'));var _0xe18087=fs[_0x3d52('0x62')](path[_0x3d52('0x63')](config[_0x3d52('0x64')],'server/files/templates/registry.ejs'),_0x3d52('0x66'));var _0xd6a574=ejs[_0x3d52('0x67')](_0xb1e4df,{'trunks':_0x118b68||[]});fs[_0x3d52('0x68')](_0x3d52('0x69'),_0xd6a574);if(_0x238fbd['registry']){var _0x3d7add=ejs[_0x3d52('0x67')](_0xe18087,{'trunks':_0x118b68||[]});fs[_0x3d52('0x68')](_0x3d52('0x6a'),_0x3d7add);}})[_0x3d52('0x1f')](function(){return respondWithRpcPromise(_0x3d52('0x6b'),'create',{'module':_0x3d52('0x6c')});})[_0x3d52('0x1f')](function(){var _0x51f87b=_0x4ec9d9[_0x3d52('0x5a')]['get']({'plain':!![]});if(!_0x51f87b)throw new Error(_0x3d52('0x5b'));if(_0x51f87b[_0x3d52('0x5c')]===_0x3d52('0x5a')){var _0x595a64=_0x238fbd[_0x3d52('0x54')]({'plain':!![]});return db['UserProfileSection'][_0x3d52('0x51')]({'where':{'name':'Trunks','userProfileId':_0x51f87b[_0x3d52('0x5e')]},'raw':!![]})[_0x3d52('0x1f')](function(_0x574f4e){if(_0x574f4e&&_0x574f4e[_0x3d52('0x5f')]===0x0){return db[_0x3d52('0x35')]['create']({'name':_0x595a64['name'],'resourceId':_0x595a64['id'],'type':_0x574f4e[_0x3d52('0x38')],'sectionId':_0x574f4e['id']},{})[_0x3d52('0x1f')](function(){return _0x238fbd;});}else{return _0x238fbd;}})[_0x3d52('0x29')](function(_0x2c4f2c){logger[_0x3d52('0x25')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x2c4f2c);throw _0x2c4f2c;});}return _0x238fbd;})[_0x3d52('0x1f')](respondWithResult(_0x47dc11,0xc9))[_0x3d52('0x29')](handleError(_0x47dc11,null));};exports['update']=function(_0x14a52e,_0x260fe3,_0x4c03d5){var _0x3904e2;return db[_0x3d52('0x4e')]['find']({'where':{'id':_0x14a52e[_0x3d52('0x50')]['id']}})['then'](handleEntityNotFound(_0x260fe3,null))['then'](saveUpdates(_0x14a52e[_0x3d52('0x58')],null))[_0x3d52('0x1f')](function(_0x4e349d){if(_0x4e349d){_0x3904e2=_0x4e349d;return db[_0x3d52('0x4e')]['findAll']({'raw':!![]});}})['then'](function(_0x13b382){if(_0x13b382){var _0x4e6c72=fs['readFileSync'](path['join'](config['root'],_0x3d52('0x65')),_0x3d52('0x66'));var _0x26c99d=fs[_0x3d52('0x62')](path[_0x3d52('0x63')](config[_0x3d52('0x64')],_0x3d52('0x6d')),_0x3d52('0x66'));var _0x2e116f=ejs[_0x3d52('0x67')](_0x4e6c72,{'trunks':_0x13b382||[]});fs['writeFileSync'](_0x3d52('0x69'),_0x2e116f);var _0x4d74ef=ejs[_0x3d52('0x67')](_0x26c99d,{'trunks':_0x13b382||[]});fs[_0x3d52('0x68')](_0x3d52('0x6a'),_0x4d74ef);return respondWithRpcPromise(_0x3d52('0x6b'),'update',{'module':_0x3d52('0x6c')});}return null;})[_0x3d52('0x1f')](function(_0x4f0426){if(_0x4f0426){return _0x3904e2;}})[_0x3d52('0x1f')](respondWithResult(_0x260fe3,null))['catch'](handleError(_0x260fe3,null));};exports['destroy']=function(_0x3b5ebe,_0x2986dd,_0x56d0bd){var _0x46e9cc;return db[_0x3d52('0x4e')][_0x3d52('0x51')]({'where':{'id':_0x3b5ebe['params']['id']}})[_0x3d52('0x1f')](handleEntityNotFound(_0x2986dd,null))[_0x3d52('0x1f')](removeEntity(_0x2986dd,null))[_0x3d52('0x1f')](function(){return db['Trunk']['findAll']({'raw':!![]});})['then'](function(_0x50717d){var _0x1eeed3=fs[_0x3d52('0x62')](path[_0x3d52('0x63')](config['root'],_0x3d52('0x65')),'utf8');var _0xea608b=fs['readFileSync'](path[_0x3d52('0x63')](config['root'],_0x3d52('0x6d')),_0x3d52('0x66'));var _0x446ffd=ejs[_0x3d52('0x67')](_0x1eeed3,{'trunks':_0x50717d});var _0x2a96c9=ejs[_0x3d52('0x67')](_0xea608b,{'trunks':_0x50717d});fs[_0x3d52('0x68')]('/etc/asterisk/sip_xcally_trunks.conf',_0x446ffd);fs[_0x3d52('0x68')](_0x3d52('0x6a'),_0x2a96c9);return respondWithRpcPromise(_0x3d52('0x6b'),'destroy',{'module':_0x3d52('0x6c')});})[_0x3d52('0x29')](handleError(_0x2986dd,null));}; \ No newline at end of file +var _0x0bb4=['/etc/asterisk/sip_xcally_trunks.conf','destroy','Reload','chan_sip.so','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','path','to-csv','ejs','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','jayson/promise','client','http','test','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','Trunk,\x20%s,\x20%s','request\x20sent','debug','Trunk,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','status','end','json','count','offset','limit','set','apply','reject','save','update','Trunks','UserProfileResource','stack','name','send','Trunk','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','order','sort','where','pick','filter','map','merge','options','includeAll','include','findAll','find','clone','params','createdAt','updatedAt','body','omit','create','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','readFileSync','root','server/files/templates/trunk.ejs','utf8','join','render','writeFileSync','registry','userProfileId','server/files/templates/registry.ejs'];(function(_0x597cb7,_0x448d77){var _0x23e80a=function(_0x4b2048){while(--_0x4b2048){_0x597cb7['push'](_0x597cb7['shift']());}};_0x23e80a(++_0x448d77);}(_0x0bb4,0x77));var _0x40bb=function(_0x3befe7,_0x417c57){_0x3befe7=_0x3befe7-0x0;var _0x22dcdb=_0x0bb4[_0x3befe7];return _0x22dcdb;};'use strict';var pdf=require(_0x40bb('0x0'));var emlformat=require(_0x40bb('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x40bb('0x2'));var jsonpatch=require(_0x40bb('0x3'));var rp=require(_0x40bb('0x4'));var moment=require(_0x40bb('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x40bb('0x6'));var util=require('util');var path=require(_0x40bb('0x7'));var sox=require('sox');var csv=require(_0x40bb('0x8'));var ejs=require(_0x40bb('0x9'));var fs=require('fs');var _=require('lodash');var squel=require(_0x40bb('0xa'));var crypto=require(_0x40bb('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x40bb('0xc'));var toCsv=require('to-csv');var querystring=require(_0x40bb('0xd'));var Papa=require(_0x40bb('0xe'));var Redis=require(_0x40bb('0xf'));var authService=require(_0x40bb('0x10'));var qs=require(_0x40bb('0x11'));var as=require(_0x40bb('0x12'));var hardwareService=require(_0x40bb('0x13'));var logger=require(_0x40bb('0x14'))(_0x40bb('0x15'));var utils=require(_0x40bb('0x16'));var config=require(_0x40bb('0x17'));var db=require(_0x40bb('0x18'))['db'];var jayson=require(_0x40bb('0x19'));var client=jayson[_0x40bb('0x1a')][_0x40bb('0x1b')]({'port':0x232a});function checkPasswordPattern(_0x2a3ae5,_0x713bae,_0x4c98ae){if(_0x4c98ae){var _0x55cac9=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x55cac9[_0x40bb('0x1c')](_0x713bae)){return _0x2a3ae5;}else{throw new db[(_0x40bb('0x1d'))][(_0x40bb('0x1e'))](_0x40bb('0x1f'));}}else{return _0x2a3ae5;}}function respondWithRpcPromise(_0x2d6121,_0x99c52d,_0x207c7e,_0x3c5751){return new BPromise(function(_0x4a177c,_0x3b28a2){var _0x3edc83=_0x3c5751||client;return _0x3edc83[_0x40bb('0x20')](_0x2d6121,_0x207c7e)[_0x40bb('0x21')](function(_0x45be5d){logger['info'](_0x40bb('0x22'),_0x99c52d,_0x40bb('0x23'));logger[_0x40bb('0x24')](_0x40bb('0x25'),_0x99c52d,_0x40bb('0x23'),JSON[_0x40bb('0x26')](_0x45be5d));if(_0x45be5d[_0x40bb('0x27')]){if(_0x45be5d['error'][_0x40bb('0x28')]===0x1f4){logger[_0x40bb('0x27')](_0x40bb('0x22'),_0x99c52d,_0x45be5d[_0x40bb('0x27')][_0x40bb('0x29')]);return _0x3b28a2(_0x45be5d[_0x40bb('0x27')][_0x40bb('0x29')]);}logger[_0x40bb('0x27')](_0x40bb('0x22'),_0x99c52d,_0x45be5d[_0x40bb('0x27')][_0x40bb('0x29')]);return _0x4a177c(_0x45be5d[_0x40bb('0x27')]['message']);}else{logger[_0x40bb('0x2a')](_0x40bb('0x22'),_0x99c52d,_0x40bb('0x23'));_0x4a177c(_0x45be5d[_0x40bb('0x2b')][_0x40bb('0x29')]);}})[_0x40bb('0x2c')](function(_0x3ab03b){logger[_0x40bb('0x27')](_0x40bb('0x22'),_0x99c52d,_0x3ab03b);_0x3b28a2(_0x3ab03b);});});}function respondWithStatusCode(_0x22daf6,_0x8ee5e5){_0x8ee5e5=_0x8ee5e5||0xcc;return function(_0x558cd6){if(_0x558cd6){return _0x22daf6['sendStatus'](_0x8ee5e5);}return _0x22daf6[_0x40bb('0x2d')](_0x8ee5e5)[_0x40bb('0x2e')]();};}function respondWithResult(_0x8592b6,_0x5b73c2){_0x5b73c2=_0x5b73c2||0xc8;return function(_0xc1b76f){if(_0xc1b76f){return _0x8592b6[_0x40bb('0x2d')](_0x5b73c2)[_0x40bb('0x2f')](_0xc1b76f);}};}function respondWithFilteredResult(_0x121056,_0x28cd48){return function(_0x1e8ac0){if(_0x1e8ac0){var _0x1b0ad6=_0x1e8ac0[_0x40bb('0x30')],_0x39766a=_0x28cd48[_0x40bb('0x31')],_0x418834=_0x28cd48['offset']+_0x28cd48[_0x40bb('0x32')],_0x510ea9;if(_0x418834>=_0x1b0ad6){_0x418834=_0x1b0ad6;_0x510ea9=0xc8;}else{_0x510ea9=0xce;}_0x121056['status'](_0x510ea9);return _0x121056[_0x40bb('0x33')]('Content-Range',_0x39766a+'-'+_0x418834+'/'+_0x1b0ad6)['json'](_0x1e8ac0);}return null;};}function patchUpdates(_0x4538e5){return function(_0x420128){try{jsonpatch[_0x40bb('0x34')](_0x420128,_0x4538e5,!![]);}catch(_0x4a48f6){return BPromise[_0x40bb('0x35')](_0x4a48f6);}return _0x420128[_0x40bb('0x36')]();};}function saveUpdates(_0x27e9cb,_0x551d41){return function(_0x451fb1){if(_0x451fb1){return _0x451fb1[_0x40bb('0x37')](_0x27e9cb)[_0x40bb('0x21')](function(_0x13eced){return _0x13eced;});}return null;};}function removeEntity(_0xd31b22,_0x3eca00){return function(_0x3bc259){if(_0x3bc259){return _0x3bc259['destroy']()['then'](function(){var _0x30cf4b=_0x3bc259['get']({'plain':!![]});var _0x423dba=_0x40bb('0x38');return db[_0x40bb('0x39')]['destroy']({'where':{'type':_0x423dba,'resourceId':_0x30cf4b['id']}})[_0x40bb('0x21')](function(){return _0x3bc259;});})['then'](function(){_0xd31b22[_0x40bb('0x2d')](0xcc)[_0x40bb('0x2e')]();});}};}function handleEntityNotFound(_0x529e28,_0x441f59){return function(_0x494935){if(!_0x494935){_0x529e28['sendStatus'](0x194);}return _0x494935;};}function handleError(_0x380640,_0x461464){_0x461464=_0x461464||0x1f4;return function(_0xd49d70){logger['error'](_0xd49d70[_0x40bb('0x3a')]);if(_0xd49d70[_0x40bb('0x3b')]){delete _0xd49d70['name'];}_0x380640['status'](_0x461464)[_0x40bb('0x3c')](_0xd49d70);};}exports['index']=function(_0x276330,_0x1d3d53){var _0x1a32ef={},_0x348120={},_0x4ecfe5={'count':0x0,'rows':[]};var _0x59dce5=_['map'](db[_0x40bb('0x3d')][_0x40bb('0x3e')],function(_0x5530cf){return{'name':_0x5530cf[_0x40bb('0x3f')],'type':_0x5530cf[_0x40bb('0x40')][_0x40bb('0x41')]};});_0x348120[_0x40bb('0x42')]=_['map'](_0x59dce5,_0x40bb('0x3b'));_0x348120[_0x40bb('0x43')]=_[_0x40bb('0x44')](_0x276330[_0x40bb('0x43')]);_0x348120[_0x40bb('0x45')]=_['intersection'](_0x348120['model'],_0x348120['query']);_0x1a32ef[_0x40bb('0x46')]=_[_0x40bb('0x47')](_0x348120['model'],qs['fields'](_0x276330[_0x40bb('0x43')][_0x40bb('0x48')]));_0x1a32ef[_0x40bb('0x46')]=_0x1a32ef[_0x40bb('0x46')][_0x40bb('0x49')]?_0x1a32ef[_0x40bb('0x46')]:_0x348120['model'];if(!_0x276330[_0x40bb('0x43')][_0x40bb('0x4a')]('nolimit')){_0x1a32ef['limit']=qs['limit'](_0x276330['query'][_0x40bb('0x32')]);_0x1a32ef[_0x40bb('0x31')]=qs['offset'](_0x276330['query'][_0x40bb('0x31')]);}_0x1a32ef[_0x40bb('0x4b')]=qs[_0x40bb('0x4c')](_0x276330['query']['sort']);_0x1a32ef[_0x40bb('0x4d')]=qs[_0x40bb('0x45')](_[_0x40bb('0x4e')](_0x276330['query'],_0x348120[_0x40bb('0x45')]),_0x59dce5);if(_0x276330[_0x40bb('0x43')][_0x40bb('0x4f')]){_0x1a32ef[_0x40bb('0x4d')]=_['merge'](_0x1a32ef[_0x40bb('0x4d')],{'$or':_[_0x40bb('0x50')](_0x59dce5,function(_0x1454aa){if(_0x1454aa[_0x40bb('0x40')]!=='VIRTUAL'){var _0x2a83c5={};_0x2a83c5[_0x1454aa[_0x40bb('0x3b')]]={'$like':'%'+_0x276330[_0x40bb('0x43')]['filter']+'%'};return _0x2a83c5;}})});}_0x1a32ef=_[_0x40bb('0x51')]({},_0x1a32ef,_0x276330[_0x40bb('0x52')]);var _0x8c56b0={'where':_0x1a32ef[_0x40bb('0x4d')]};return db[_0x40bb('0x3d')][_0x40bb('0x30')](_0x8c56b0)['then'](function(_0x5adfb0){_0x4ecfe5[_0x40bb('0x30')]=_0x5adfb0;if(_0x276330[_0x40bb('0x43')][_0x40bb('0x53')]){_0x1a32ef[_0x40bb('0x54')]=[{'all':!![]}];}return db[_0x40bb('0x3d')][_0x40bb('0x55')](_0x1a32ef);})[_0x40bb('0x21')](function(_0x195561){_0x4ecfe5['rows']=_0x195561;return _0x4ecfe5;})['then'](respondWithFilteredResult(_0x1d3d53,_0x1a32ef))['catch'](handleError(_0x1d3d53,null));};exports['show']=function(_0x2457bb,_0x29e589){var _0x46c9ef={'raw':![],'where':{'id':_0x2457bb['params']['id']}},_0x4fc0ca={};_0x4fc0ca[_0x40bb('0x42')]=_[_0x40bb('0x44')](db[_0x40bb('0x3d')][_0x40bb('0x3e')]);_0x4fc0ca[_0x40bb('0x43')]=_[_0x40bb('0x44')](_0x2457bb['query']);_0x4fc0ca[_0x40bb('0x45')]=_[_0x40bb('0x47')](_0x4fc0ca['model'],_0x4fc0ca[_0x40bb('0x43')]);_0x46c9ef[_0x40bb('0x46')]=_[_0x40bb('0x47')](_0x4fc0ca[_0x40bb('0x42')],qs[_0x40bb('0x48')](_0x2457bb[_0x40bb('0x43')]['fields']));_0x46c9ef[_0x40bb('0x46')]=_0x46c9ef[_0x40bb('0x46')][_0x40bb('0x49')]?_0x46c9ef[_0x40bb('0x46')]:_0x4fc0ca['model'];if(_0x2457bb[_0x40bb('0x43')][_0x40bb('0x53')]){_0x46c9ef[_0x40bb('0x54')]=[{'all':!![]}];}_0x46c9ef=_[_0x40bb('0x51')]({},_0x46c9ef,_0x2457bb['options']);return db['Trunk'][_0x40bb('0x56')](_0x46c9ef)[_0x40bb('0x21')](handleEntityNotFound(_0x29e589,null))[_0x40bb('0x21')](respondWithResult(_0x29e589,null))[_0x40bb('0x2c')](handleError(_0x29e589,null));};exports[_0x40bb('0x57')]=function(_0x14090e,_0x4cfed9){var _0x284de0={'where':{'id':_0x14090e[_0x40bb('0x58')]['id']}},_0xbff3fb={};_0xbff3fb[_0x40bb('0x42')]=_[_0x40bb('0x44')](db[_0x40bb('0x3d')]['rawAttributes']);_0x284de0[_0x40bb('0x46')]=_[_0x40bb('0x47')](_0xbff3fb[_0x40bb('0x42')],qs[_0x40bb('0x48')](_0x14090e[_0x40bb('0x43')][_0x40bb('0x48')]));_0x284de0['attributes']=_0x284de0[_0x40bb('0x46')]['length']?_0x284de0[_0x40bb('0x46')]:_0xbff3fb[_0x40bb('0x42')];if(_0x14090e[_0x40bb('0x43')][_0x40bb('0x53')]){_0x284de0[_0x40bb('0x54')]=[{'all':!![]}];}_0x284de0=_['merge']({},_0x284de0,_0x14090e[_0x40bb('0x52')]);return db[_0x40bb('0x3d')][_0x40bb('0x56')](_0x284de0)[_0x40bb('0x21')](handleEntityNotFound(_0x4cfed9,null))[_0x40bb('0x21')](function(_0x4fe879){if(_0x4fe879){var _0x2b463d=_0x4fe879['get']({'plain':!![]});_0x2b463d=qs['omit'](_0x2b463d,['id',_0x40bb('0x59'),_0x40bb('0x5a')]);_0x14090e[_0x40bb('0x5b')]=_[_0x40bb('0x5c')](_0x14090e[_0x40bb('0x5b')],['id',_0x40bb('0x59'),'updatedAt']);return db['Trunk'][_0x40bb('0x5d')](_[_0x40bb('0x51')](_0x2b463d,_0x14090e[_0x40bb('0x5b')]),{'include':_0x14090e[_0x40bb('0x43')][_0x40bb('0x53')]?[{'all':!![]}]:undefined})['then'](function(_0x351788){var _0x42cdf1=_0x14090e[_0x40bb('0x5e')][_0x40bb('0x5f')]({'plain':!![]});if(!_0x42cdf1)throw new Error(_0x40bb('0x60'));if(_0x42cdf1[_0x40bb('0x61')]==='user'){var _0x44ce1d=_0x351788[_0x40bb('0x5f')]({'plain':!![]});var _0x41c2c9=_0x40bb('0x38');return db[_0x40bb('0x62')]['find']({'where':{'name':_0x41c2c9,'userProfileId':_0x42cdf1['userProfileId']},'raw':!![]})[_0x40bb('0x21')](function(_0x542db4){if(_0x542db4&&_0x542db4[_0x40bb('0x63')]===0x0){return db[_0x40bb('0x39')]['create']({'name':_0x44ce1d[_0x40bb('0x3b')],'resourceId':_0x44ce1d['id'],'type':_0x542db4[_0x40bb('0x3b')],'sectionId':_0x542db4['id']},{})[_0x40bb('0x21')](function(){return _0x351788;});}else{return _0x351788;}})[_0x40bb('0x2c')](function(_0x5bbafd){logger[_0x40bb('0x27')](_0x40bb('0x64'),_0x5bbafd);throw _0x5bbafd;});}return _0x351788;});}})[_0x40bb('0x21')](respondWithResult(_0x4cfed9,0xc9))[_0x40bb('0x2c')](handleError(_0x4cfed9,null));};exports['create']=function(_0xb6a620,_0x138187,_0xf1d756){var _0x3de31d;return db['Trunk'][_0x40bb('0x5d')](_0xb6a620[_0x40bb('0x5b')],{'raw':!![]})['then'](function(_0x3ca7b3){_0x3de31d=_0x3ca7b3;return db['Trunk'][_0x40bb('0x55')]({'raw':!![]});})[_0x40bb('0x21')](function(_0x547afc){var _0x37a359=fs[_0x40bb('0x65')](path['join'](config[_0x40bb('0x66')],_0x40bb('0x67')),_0x40bb('0x68'));var _0x4ceb7e=fs[_0x40bb('0x65')](path[_0x40bb('0x69')](config[_0x40bb('0x66')],'server/files/templates/registry.ejs'),_0x40bb('0x68'));var _0xa2e0e5=ejs[_0x40bb('0x6a')](_0x37a359,{'trunks':_0x547afc||[]});fs[_0x40bb('0x6b')]('/etc/asterisk/sip_xcally_trunks.conf',_0xa2e0e5);if(_0x3de31d[_0x40bb('0x6c')]){var _0x30d4eb=ejs['render'](_0x4ceb7e,{'trunks':_0x547afc||[]});fs[_0x40bb('0x6b')]('/etc/asterisk/sip_xcally_registers.conf',_0x30d4eb);}})[_0x40bb('0x21')](function(){return respondWithRpcPromise('Reload',_0x40bb('0x5d'),{'module':'chan_sip.so'});})[_0x40bb('0x21')](function(){var _0x3d54aa=_0xb6a620[_0x40bb('0x5e')][_0x40bb('0x5f')]({'plain':!![]});if(!_0x3d54aa)throw new Error(_0x40bb('0x60'));if(_0x3d54aa['role']===_0x40bb('0x5e')){var _0x4287be=_0x3de31d[_0x40bb('0x5f')]({'plain':!![]});return db[_0x40bb('0x62')][_0x40bb('0x56')]({'where':{'name':_0x40bb('0x38'),'userProfileId':_0x3d54aa[_0x40bb('0x6d')]},'raw':!![]})[_0x40bb('0x21')](function(_0x22329e){if(_0x22329e&&_0x22329e[_0x40bb('0x63')]===0x0){return db['UserProfileResource'][_0x40bb('0x5d')]({'name':_0x4287be['name'],'resourceId':_0x4287be['id'],'type':_0x22329e[_0x40bb('0x3b')],'sectionId':_0x22329e['id']},{})[_0x40bb('0x21')](function(){return _0x3de31d;});}else{return _0x3de31d;}})[_0x40bb('0x2c')](function(_0x3ce5d4){logger[_0x40bb('0x27')](_0x40bb('0x64'),_0x3ce5d4);throw _0x3ce5d4;});}return _0x3de31d;})[_0x40bb('0x21')](respondWithResult(_0x138187,0xc9))[_0x40bb('0x2c')](handleError(_0x138187,null));};exports[_0x40bb('0x37')]=function(_0x295a5a,_0xd66131,_0x3d6e77){var _0x32b8e4;return db[_0x40bb('0x3d')][_0x40bb('0x56')]({'where':{'id':_0x295a5a[_0x40bb('0x58')]['id']}})[_0x40bb('0x21')](handleEntityNotFound(_0xd66131,null))[_0x40bb('0x21')](saveUpdates(_0x295a5a[_0x40bb('0x5b')],null))[_0x40bb('0x21')](function(_0x3ad10b){if(_0x3ad10b){_0x32b8e4=_0x3ad10b;return db[_0x40bb('0x3d')][_0x40bb('0x55')]({'raw':!![]});}})[_0x40bb('0x21')](function(_0x4eba2c){if(_0x4eba2c){var _0x3f3310=fs[_0x40bb('0x65')](path[_0x40bb('0x69')](config[_0x40bb('0x66')],'server/files/templates/trunk.ejs'),_0x40bb('0x68'));var _0x2c963e=fs[_0x40bb('0x65')](path[_0x40bb('0x69')](config[_0x40bb('0x66')],_0x40bb('0x6e')),_0x40bb('0x68'));var _0x3fda5f=ejs[_0x40bb('0x6a')](_0x3f3310,{'trunks':_0x4eba2c||[]});fs[_0x40bb('0x6b')](_0x40bb('0x6f'),_0x3fda5f);var _0xc781f3=ejs['render'](_0x2c963e,{'trunks':_0x4eba2c||[]});fs[_0x40bb('0x6b')]('/etc/asterisk/sip_xcally_registers.conf',_0xc781f3);return respondWithRpcPromise('Reload',_0x40bb('0x37'),{'module':'chan_sip.so'});}return null;})[_0x40bb('0x21')](function(_0x4460b1){if(_0x4460b1){return _0x32b8e4;}})[_0x40bb('0x21')](respondWithResult(_0xd66131,null))[_0x40bb('0x2c')](handleError(_0xd66131,null));};exports[_0x40bb('0x70')]=function(_0x40ef93,_0x22ed4f,_0x39b3fc){var _0x11cefc;return db[_0x40bb('0x3d')][_0x40bb('0x56')]({'where':{'id':_0x40ef93[_0x40bb('0x58')]['id']}})[_0x40bb('0x21')](handleEntityNotFound(_0x22ed4f,null))[_0x40bb('0x21')](removeEntity(_0x22ed4f,null))[_0x40bb('0x21')](function(){return db[_0x40bb('0x3d')][_0x40bb('0x55')]({'raw':!![]});})['then'](function(_0x46aab1){var _0x32f90b=fs[_0x40bb('0x65')](path['join'](config[_0x40bb('0x66')],_0x40bb('0x67')),_0x40bb('0x68'));var _0x1e5fd0=fs[_0x40bb('0x65')](path[_0x40bb('0x69')](config[_0x40bb('0x66')],_0x40bb('0x6e')),_0x40bb('0x68'));var _0x503f06=ejs[_0x40bb('0x6a')](_0x32f90b,{'trunks':_0x46aab1});var _0x16e32e=ejs[_0x40bb('0x6a')](_0x1e5fd0,{'trunks':_0x46aab1});fs[_0x40bb('0x6b')](_0x40bb('0x6f'),_0x503f06);fs[_0x40bb('0x6b')]('/etc/asterisk/sip_xcally_registers.conf',_0x16e32e);return respondWithRpcPromise(_0x40bb('0x71'),_0x40bb('0x70'),{'module':_0x40bb('0x72')});})['catch'](handleError(_0x22ed4f,null));}; \ No newline at end of file diff --git a/server/api/trunk/trunk.model.js b/server/api/trunk/trunk.model.js index 2b8b1cf..53f90c6 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 _0x438a=['util','../../config/logger','api','moment','../../config/environment','./trunk.attributes','exports','define','Trunk','tools_trunks'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x438a,0x1cc));var _0xa438=function(_0x2cf08a,_0x352fcb){_0x2cf08a=_0x2cf08a-0x0;var _0x3b35a8=_0x438a[_0x2cf08a];return _0x3b35a8;};'use strict';var _=require('lodash');var util=require(_0xa438('0x0'));var logger=require(_0xa438('0x1'))(_0xa438('0x2'));var moment=require(_0xa438('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xa438('0x4'));var attributes=require(_0xa438('0x5'));module[_0xa438('0x6')]=function(_0x390d72,_0x27daa8){return _0x390d72[_0xa438('0x7')](_0xa438('0x8'),attributes,{'tableName':_0xa438('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf962=['path','rimraf','../../config/environment','./trunk.attributes','exports','define','lodash','api','moment','bluebird','request-promise'];(function(_0x521513,_0x1fe32a){var _0x26ec71=function(_0xba81f8){while(--_0xba81f8){_0x521513['push'](_0x521513['shift']());}};_0x26ec71(++_0x1fe32a);}(_0xf962,0x10e));var _0x2f96=function(_0x3a2aa4,_0x2e9f97){_0x3a2aa4=_0x3a2aa4-0x0;var _0x3905c5=_0xf962[_0x3a2aa4];return _0x3905c5;};'use strict';var _=require(_0x2f96('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x2f96('0x1'));var moment=require(_0x2f96('0x2'));var BPromise=require(_0x2f96('0x3'));var rp=require(_0x2f96('0x4'));var fs=require('fs');var path=require(_0x2f96('0x5'));var rimraf=require(_0x2f96('0x6'));var config=require(_0x2f96('0x7'));var attributes=require(_0x2f96('0x8'));module[_0x2f96('0x9')]=function(_0x4b69a6,_0x1f23f5){return _0x4b69a6[_0x2f96('0xa')]('Trunk',attributes,{'tableName':'tools_trunks','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/trunk/trunk.rpc.js b/server/api/trunk/trunk.rpc.js index 8d23d5b..ccbdaa4 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 _0x8603=['result','catch','GetTrunk','Trunk','findAll','options','raw','where','attributes','limit','include','map','model','stringify','ShowTrunk','debug','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','then','Trunk,\x20%s,\x20%s','request\x20sent','Trunk,\x20%s,\x20%s,\x20%s','error','message','info'];(function(_0x2b323d,_0x1632bf){var _0x4e1623=function(_0x3d4853){while(--_0x3d4853){_0x2b323d['push'](_0x2b323d['shift']());}};_0x4e1623(++_0x1632bf);}(_0x8603,0x190));var _0x3860=function(_0x5dcc04,_0x45c416){_0x5dcc04=_0x5dcc04-0x0;var _0x451853=_0x8603[_0x5dcc04];return _0x451853;};'use strict';var _=require('lodash');var util=require(_0x3860('0x0'));var moment=require(_0x3860('0x1'));var BPromise=require(_0x3860('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x3860('0x3'))['db'];var utils=require(_0x3860('0x4'));var logger=require(_0x3860('0x5'))('rpc');var config=require(_0x3860('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x3860('0x7')][_0x3860('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x1eca44,_0xd3ce26,_0x472bf2){return new BPromise(function(_0x4aba10,_0x5c7350){return client['request'](_0x1eca44,_0x472bf2)[_0x3860('0x9')](function(_0x441dc4){logger['info'](_0x3860('0xa'),_0xd3ce26,_0x3860('0xb'));logger['debug'](_0x3860('0xc'),_0xd3ce26,_0x3860('0xb'),JSON['stringify'](_0x441dc4));if(_0x441dc4[_0x3860('0xd')]){if(_0x441dc4[_0x3860('0xd')]['code']===0x1f4){logger[_0x3860('0xd')](_0x3860('0xa'),_0xd3ce26,_0x441dc4[_0x3860('0xd')][_0x3860('0xe')]);return _0x5c7350(_0x441dc4[_0x3860('0xd')][_0x3860('0xe')]);}logger[_0x3860('0xd')](_0x3860('0xa'),_0xd3ce26,_0x441dc4[_0x3860('0xd')][_0x3860('0xe')]);return _0x4aba10(_0x441dc4['error'][_0x3860('0xe')]);}else{logger[_0x3860('0xf')](_0x3860('0xa'),_0xd3ce26,_0x3860('0xb'));_0x4aba10(_0x441dc4[_0x3860('0x10')][_0x3860('0xe')]);}})[_0x3860('0x11')](function(_0x378305){logger[_0x3860('0xd')](_0x3860('0xa'),_0xd3ce26,_0x378305);_0x5c7350(_0x378305);});});}exports[_0x3860('0x12')]=function(_0x45b799){var _0x4b6b15=this;return new Promise(function(_0x4863bd,_0x373b06){return db[_0x3860('0x13')][_0x3860('0x14')]({'raw':_0x45b799['options']?_0x45b799[_0x3860('0x15')][_0x3860('0x16')]===undefined?!![]:![]:!![],'where':_0x45b799[_0x3860('0x15')]?_0x45b799[_0x3860('0x15')][_0x3860('0x17')]||null:null,'attributes':_0x45b799[_0x3860('0x15')]?_0x45b799[_0x3860('0x15')][_0x3860('0x18')]||null:null,'limit':_0x45b799[_0x3860('0x15')]?_0x45b799[_0x3860('0x15')][_0x3860('0x19')]||null:null,'include':_0x45b799[_0x3860('0x15')]?_0x45b799[_0x3860('0x15')][_0x3860('0x1a')]?_[_0x3860('0x1b')](_0x45b799['options'][_0x3860('0x1a')],function(_0x133093){return{'model':db[_0x133093[_0x3860('0x1c')]],'as':_0x133093['as'],'attributes':_0x133093[_0x3860('0x18')],'include':_0x133093[_0x3860('0x1a')]?_['map'](_0x133093[_0x3860('0x1a')],function(_0x568515){return{'model':db[_0x568515['model']],'as':_0x568515['as'],'attributes':_0x568515[_0x3860('0x18')],'include':_0x568515[_0x3860('0x1a')]?_['map'](_0x568515['include'],function(_0x5f42d5){return{'model':db[_0x5f42d5[_0x3860('0x1c')]],'as':_0x5f42d5['as'],'attributes':_0x5f42d5[_0x3860('0x18')]};}):[]};}):[]};}):[]:[]})[_0x3860('0x9')](function(_0x371f3a){logger[_0x3860('0xf')](_0x3860('0x12'),_0x45b799);logger['debug']('GetTrunk',_0x45b799,JSON[_0x3860('0x1d')](_0x371f3a));_0x4863bd(_0x371f3a);})[_0x3860('0x11')](function(_0x5a9af2){logger[_0x3860('0xd')](_0x3860('0x12'),_0x5a9af2[_0x3860('0xe')],_0x45b799);_0x373b06(_0x4b6b15[_0x3860('0xd')](0x1f4,_0x5a9af2[_0x3860('0xe')]));});});};exports['ShowTrunk']=function(_0x36ae2b){var _0xf624ba=this;return new Promise(function(_0x367b14,_0x4bd90c){return db[_0x3860('0x13')]['find']({'raw':_0x36ae2b[_0x3860('0x15')]?_0x36ae2b['options'][_0x3860('0x16')]===undefined?!![]:![]:!![],'where':_0x36ae2b[_0x3860('0x15')]?_0x36ae2b[_0x3860('0x15')]['where']||null:null,'attributes':_0x36ae2b[_0x3860('0x15')]?_0x36ae2b[_0x3860('0x15')]['attributes']||null:null,'include':_0x36ae2b[_0x3860('0x15')]?_0x36ae2b['options'][_0x3860('0x1a')]?_[_0x3860('0x1b')](_0x36ae2b[_0x3860('0x15')][_0x3860('0x1a')],function(_0x30dc2a){return{'model':db[_0x30dc2a[_0x3860('0x1c')]],'as':_0x30dc2a['as'],'attributes':_0x30dc2a[_0x3860('0x18')],'include':_0x30dc2a['include']?_[_0x3860('0x1b')](_0x30dc2a[_0x3860('0x1a')],function(_0x4d62e9){return{'model':db[_0x4d62e9[_0x3860('0x1c')]],'as':_0x4d62e9['as'],'attributes':_0x4d62e9[_0x3860('0x18')],'include':_0x4d62e9[_0x3860('0x1a')]?_['map'](_0x4d62e9['include'],function(_0x285b1b){return{'model':db[_0x285b1b[_0x3860('0x1c')]],'as':_0x285b1b['as'],'attributes':_0x285b1b[_0x3860('0x18')]};}):[]};}):[]};}):[]:[]})[_0x3860('0x9')](function(_0x59271f){logger['info'](_0x3860('0x1e'),_0x36ae2b);logger[_0x3860('0x1f')](_0x3860('0x1e'),_0x36ae2b,JSON[_0x3860('0x1d')](_0x59271f));_0x367b14(_0x59271f);})[_0x3860('0x11')](function(_0x4df2a9){logger[_0x3860('0xd')](_0x3860('0x1e'),_0x4df2a9['message'],_0x36ae2b);_0x4bd90c(_0xf624ba['error'](0x1f4,_0x4df2a9[_0x3860('0xe')]));});});}; \ No newline at end of file +var _0x4fc2=['rpc','../../config/environment','client','http','request','then','info','Trunk,\x20%s,\x20%s','request\x20sent','debug','Trunk,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','findAll','options','where','attributes','include','model','map','GetTrunk','Trunk','find','raw','ShowTrunk','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils'];(function(_0x5864ef,_0x496812){var _0x21c244=function(_0x433f8a){while(--_0x433f8a){_0x5864ef['push'](_0x5864ef['shift']());}};_0x21c244(++_0x496812);}(_0x4fc2,0x111));var _0x24fc=function(_0x293fec,_0x133f38){_0x293fec=_0x293fec-0x0;var _0x405724=_0x4fc2[_0x293fec];return _0x405724;};'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});function respondWithRpcPromise(_0x4889f4,_0x115851,_0x22a0c8){return new BPromise(function(_0x220f9a,_0x123eff){return client[_0x24fc('0xb')](_0x4889f4,_0x22a0c8)[_0x24fc('0xc')](function(_0x5afdf1){logger[_0x24fc('0xd')](_0x24fc('0xe'),_0x115851,_0x24fc('0xf'));logger[_0x24fc('0x10')](_0x24fc('0x11'),_0x115851,_0x24fc('0xf'),JSON[_0x24fc('0x12')](_0x5afdf1));if(_0x5afdf1[_0x24fc('0x13')]){if(_0x5afdf1['error'][_0x24fc('0x14')]===0x1f4){logger[_0x24fc('0x13')]('Trunk,\x20%s,\x20%s',_0x115851,_0x5afdf1[_0x24fc('0x13')][_0x24fc('0x15')]);return _0x123eff(_0x5afdf1[_0x24fc('0x13')][_0x24fc('0x15')]);}logger[_0x24fc('0x13')](_0x24fc('0xe'),_0x115851,_0x5afdf1['error'][_0x24fc('0x15')]);return _0x220f9a(_0x5afdf1[_0x24fc('0x13')][_0x24fc('0x15')]);}else{logger[_0x24fc('0xd')]('Trunk,\x20%s,\x20%s',_0x115851,_0x24fc('0xf'));_0x220f9a(_0x5afdf1['result'][_0x24fc('0x15')]);}})[_0x24fc('0x16')](function(_0x218fb6){logger[_0x24fc('0x13')](_0x24fc('0xe'),_0x115851,_0x218fb6);_0x123eff(_0x218fb6);});});}exports['GetTrunk']=function(_0x23873c){var _0x1cb3d0=this;return new Promise(function(_0x6cfa0a,_0x8ac114){return db['Trunk'][_0x24fc('0x17')]({'raw':_0x23873c[_0x24fc('0x18')]?_0x23873c[_0x24fc('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x23873c[_0x24fc('0x18')]?_0x23873c[_0x24fc('0x18')][_0x24fc('0x19')]||null:null,'attributes':_0x23873c[_0x24fc('0x18')]?_0x23873c['options'][_0x24fc('0x1a')]||null:null,'limit':_0x23873c['options']?_0x23873c[_0x24fc('0x18')]['limit']||null:null,'include':_0x23873c[_0x24fc('0x18')]?_0x23873c[_0x24fc('0x18')][_0x24fc('0x1b')]?_['map'](_0x23873c[_0x24fc('0x18')]['include'],function(_0x35a9c7){return{'model':db[_0x35a9c7[_0x24fc('0x1c')]],'as':_0x35a9c7['as'],'attributes':_0x35a9c7[_0x24fc('0x1a')],'include':_0x35a9c7[_0x24fc('0x1b')]?_[_0x24fc('0x1d')](_0x35a9c7[_0x24fc('0x1b')],function(_0x3f0875){return{'model':db[_0x3f0875[_0x24fc('0x1c')]],'as':_0x3f0875['as'],'attributes':_0x3f0875[_0x24fc('0x1a')],'include':_0x3f0875[_0x24fc('0x1b')]?_['map'](_0x3f0875[_0x24fc('0x1b')],function(_0x16f27f){return{'model':db[_0x16f27f[_0x24fc('0x1c')]],'as':_0x16f27f['as'],'attributes':_0x16f27f['attributes']};}):[]};}):[]};}):[]:[]})[_0x24fc('0xc')](function(_0x3d1ec8){logger[_0x24fc('0xd')](_0x24fc('0x1e'),_0x23873c);logger[_0x24fc('0x10')](_0x24fc('0x1e'),_0x23873c,JSON['stringify'](_0x3d1ec8));_0x6cfa0a(_0x3d1ec8);})[_0x24fc('0x16')](function(_0x29a461){logger[_0x24fc('0x13')](_0x24fc('0x1e'),_0x29a461[_0x24fc('0x15')],_0x23873c);_0x8ac114(_0x1cb3d0['error'](0x1f4,_0x29a461['message']));});});};exports['ShowTrunk']=function(_0x3df6f4){var _0x574ba3=this;return new Promise(function(_0x3f2464,_0x3e6389){return db[_0x24fc('0x1f')][_0x24fc('0x20')]({'raw':_0x3df6f4['options']?_0x3df6f4[_0x24fc('0x18')][_0x24fc('0x21')]===undefined?!![]:![]:!![],'where':_0x3df6f4['options']?_0x3df6f4[_0x24fc('0x18')][_0x24fc('0x19')]||null:null,'attributes':_0x3df6f4['options']?_0x3df6f4['options'][_0x24fc('0x1a')]||null:null,'include':_0x3df6f4['options']?_0x3df6f4[_0x24fc('0x18')][_0x24fc('0x1b')]?_['map'](_0x3df6f4[_0x24fc('0x18')][_0x24fc('0x1b')],function(_0x3b2862){return{'model':db[_0x3b2862[_0x24fc('0x1c')]],'as':_0x3b2862['as'],'attributes':_0x3b2862[_0x24fc('0x1a')],'include':_0x3b2862[_0x24fc('0x1b')]?_[_0x24fc('0x1d')](_0x3b2862[_0x24fc('0x1b')],function(_0x379a4a){return{'model':db[_0x379a4a['model']],'as':_0x379a4a['as'],'attributes':_0x379a4a[_0x24fc('0x1a')],'include':_0x379a4a[_0x24fc('0x1b')]?_[_0x24fc('0x1d')](_0x379a4a[_0x24fc('0x1b')],function(_0x242bd5){return{'model':db[_0x242bd5['model']],'as':_0x242bd5['as'],'attributes':_0x242bd5['attributes']};}):[]};}):[]};}):[]:[]})[_0x24fc('0xc')](function(_0x5d48fe){logger[_0x24fc('0xd')](_0x24fc('0x22'),_0x3df6f4);logger[_0x24fc('0x10')](_0x24fc('0x22'),_0x3df6f4,JSON['stringify'](_0x5d48fe));_0x3f2464(_0x5d48fe);})[_0x24fc('0x16')](function(_0x4f4ec8){logger[_0x24fc('0x13')](_0x24fc('0x22'),_0x4f4ec8[_0x24fc('0x15')],_0x3df6f4);_0x3e6389(_0x574ba3[_0x24fc('0x13')](0x1f4,_0x4f4ec8[_0x24fc('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/user/index.js b/server/api/user/index.js index e5ce4a1..8c67440 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 _0xde9b=['/:id/unpause','unpause','/:id/teams','addTeams','/:id/chat_interactions','addChatInteractions','/:id/mail_interactions','addMailInteractions','addFaxInteractions','/:id/sms_interactions','/:id/openchannel_interactions','addOpenchannelInteractions','/:id/whatsapp_interactions','addWhatsappInteractions','addMailAccounts','addOpenchannelAccounts','addSmsAccounts','addChatWebsites','/:id/whatsapp_accounts','addWhatsappAccounts','/:id/square_projects','addSquareProjects','put','/:id','/:id/password','delete','removeQueues','removeTeams','destroy','removeChatInteractions','removeMailInteractions','/:id/fax_interactions','removeFaxInteractions','removeSmsInteractions','removeWhatsappInteractions','removeFaxAccounts','removeSmsAccounts','removeChatWebsites','removeWhatsappAccounts','removeSquareProjects','removeApiKey','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./user.controller','get','index','isAuthenticated','/whoami','whoami','show','/:id/avatar','getAvatar','/:id/contacts','/:id/queues','getQueues','getGroups','/:id/recordings','getRecordings','/:id/chat/interactions','getChatInteractions','/:id/openchannel/interactions','getOpenchannelInteractions','/:id/mail/interactions','getMailInteractions','/:id/sms/interactions','getSmsInteractions','/:id/fax/interactions','getFaxInteractions','/:id/whatsapp/interactions','getWhatsappInteractions','getTeams','getLists','/:id/agents','getAgents','getVoicePrefixes','/:id/fax_accounts','getFaxAccounts','/:id/mail_accounts','getMailAccounts','/:id/openchannel_accounts','/:id/sms_accounts','getSmsAccounts','/:id/chat_websites','getChatWebsites','getWhatsappAccounts','/:id/scheduled_calls','getScheduledCalls','/:id/api_key','getApiKey','post','/create_many','addContacts','addQueues','diskStorage','join','root','server/files/images/','%s-%s','now','originalname','single','file','addAvatar','/:id/login','login','/:id/logout','logout','/:id/pause','pause'];(function(_0x51185a,_0x2dcfcf){var _0x195001=function(_0x1305a5){while(--_0x1305a5){_0x51185a['push'](_0x51185a['shift']());}};_0x195001(++_0x2dcfcf);}(_0xde9b,0x9e));var _0xbde9=function(_0x51630f,_0x54b703){_0x51630f=_0x51630f-0x0;var _0x2de9ef=_0xde9b[_0x51630f];return _0x2de9ef;};'use strict';var multer=require(_0xbde9('0x0'));var util=require(_0xbde9('0x1'));var path=require(_0xbde9('0x2'));var timeout=require(_0xbde9('0x3'));var express=require(_0xbde9('0x4'));var router=express[_0xbde9('0x5')]();var auth=require(_0xbde9('0x6'));var interaction=require(_0xbde9('0x7'));var config=require('../../config/environment');var controller=require(_0xbde9('0x8'));router[_0xbde9('0x9')]('/',auth['isAuthenticated'](),controller[_0xbde9('0xa')]);router[_0xbde9('0x9')]('/describe',auth[_0xbde9('0xb')](),controller['describe']);router[_0xbde9('0x9')](_0xbde9('0xc'),auth[_0xbde9('0xb')](),controller[_0xbde9('0xd')]);router[_0xbde9('0x9')]('/:id',auth[_0xbde9('0xb')](),controller[_0xbde9('0xe')]);router[_0xbde9('0x9')](_0xbde9('0xf'),controller[_0xbde9('0x10')]);router[_0xbde9('0x9')](_0xbde9('0x11'),auth['isAuthenticated'](),controller['getContacts']);router[_0xbde9('0x9')](_0xbde9('0x12'),auth['isAuthenticated'](),controller[_0xbde9('0x13')]);router['get']('/:id/queues_rt',auth['isAuthenticated'](),controller['getVoiceQueuesRt']);router[_0xbde9('0x9')]('/:id/groups',auth[_0xbde9('0xb')](),controller[_0xbde9('0x14')]);router[_0xbde9('0x9')](_0xbde9('0x15'),auth['isAuthenticated'](),controller[_0xbde9('0x16')]);router[_0xbde9('0x9')]('/:id/screen_recordings',auth[_0xbde9('0xb')](),controller['getScreenRecordings']);router[_0xbde9('0x9')](_0xbde9('0x17'),auth[_0xbde9('0xb')](),controller[_0xbde9('0x18')]);router[_0xbde9('0x9')](_0xbde9('0x19'),auth['isAuthenticated'](),controller[_0xbde9('0x1a')]);router[_0xbde9('0x9')](_0xbde9('0x1b'),auth[_0xbde9('0xb')](),controller[_0xbde9('0x1c')]);router[_0xbde9('0x9')](_0xbde9('0x1d'),auth[_0xbde9('0xb')](),controller[_0xbde9('0x1e')]);router[_0xbde9('0x9')](_0xbde9('0x1f'),auth[_0xbde9('0xb')](),controller[_0xbde9('0x20')]);router[_0xbde9('0x9')](_0xbde9('0x21'),auth['isAuthenticated'](),controller[_0xbde9('0x22')]);router[_0xbde9('0x9')]('/:id/teams',auth['isAuthenticated'](),controller[_0xbde9('0x23')]);router['get']('/:id/lists',auth['isAuthenticated'](),controller[_0xbde9('0x24')]);router[_0xbde9('0x9')](_0xbde9('0x25'),auth[_0xbde9('0xb')](),controller[_0xbde9('0x26')]);router['get']('/:id/prefixes',auth['isAuthenticated'](),controller[_0xbde9('0x27')]);router[_0xbde9('0x9')](_0xbde9('0x28'),auth[_0xbde9('0xb')](),controller[_0xbde9('0x29')]);router['get'](_0xbde9('0x2a'),auth[_0xbde9('0xb')](),controller[_0xbde9('0x2b')]);router[_0xbde9('0x9')](_0xbde9('0x2c'),auth[_0xbde9('0xb')](),controller['getOpenchannelAccounts']);router['get'](_0xbde9('0x2d'),auth[_0xbde9('0xb')](),controller[_0xbde9('0x2e')]);router[_0xbde9('0x9')](_0xbde9('0x2f'),auth[_0xbde9('0xb')](),controller[_0xbde9('0x30')]);router[_0xbde9('0x9')]('/:id/whatsapp_accounts',auth['isAuthenticated'](),controller[_0xbde9('0x31')]);router['get']('/:id/square_projects',auth[_0xbde9('0xb')](),controller['getSquareProjects']);router[_0xbde9('0x9')](_0xbde9('0x32'),auth[_0xbde9('0xb')](),controller[_0xbde9('0x33')]);router[_0xbde9('0x9')](_0xbde9('0x34'),auth[_0xbde9('0xb')](),controller[_0xbde9('0x35')]);router[_0xbde9('0x36')](_0xbde9('0x37'),auth['isAuthenticated'](),controller['bulkCreate']);router[_0xbde9('0x36')](_0xbde9('0x11'),auth[_0xbde9('0xb')](),controller[_0xbde9('0x38')]);router['post']('/',auth[_0xbde9('0xb')](),controller['create']);router[_0xbde9('0x36')]('/:id/queues',auth[_0xbde9('0xb')](),controller[_0xbde9('0x39')]);var upload=multer({'storage':multer[_0xbde9('0x3a')]({'destination':function(_0x384f8f,_0x5d5e92,_0x2428f0){_0x2428f0(null,path[_0xbde9('0x3b')](config[_0xbde9('0x3c')],_0xbde9('0x3d')));},'filename':function(_0x3e789e,_0x46e387,_0x1c5bd6){_0x1c5bd6(null,util['format'](_0xbde9('0x3e'),Date[_0xbde9('0x3f')](),_0x46e387[_0xbde9('0x40')]));}})});router[_0xbde9('0x36')](_0xbde9('0xf'),upload[_0xbde9('0x41')](_0xbde9('0x42')),controller[_0xbde9('0x43')]);router[_0xbde9('0x36')](_0xbde9('0x44'),auth[_0xbde9('0xb')](),controller[_0xbde9('0x45')]);router[_0xbde9('0x36')](_0xbde9('0x46'),auth['isAuthenticated'](),controller[_0xbde9('0x47')]);router[_0xbde9('0x36')](_0xbde9('0x48'),auth[_0xbde9('0xb')](),controller[_0xbde9('0x49')]);router[_0xbde9('0x36')](_0xbde9('0x4a'),auth[_0xbde9('0xb')](),controller[_0xbde9('0x4b')]);router[_0xbde9('0x36')](_0xbde9('0x4c'),auth[_0xbde9('0xb')](),controller[_0xbde9('0x4d')]);router[_0xbde9('0x36')](_0xbde9('0x4e'),auth[_0xbde9('0xb')](),controller[_0xbde9('0x4f')]);router[_0xbde9('0x36')](_0xbde9('0x50'),auth[_0xbde9('0xb')](),controller[_0xbde9('0x51')]);router['post']('/:id/fax_interactions',auth[_0xbde9('0xb')](),controller[_0xbde9('0x52')]);router[_0xbde9('0x36')](_0xbde9('0x53'),auth[_0xbde9('0xb')](),controller['addSmsInteractions']);router['post'](_0xbde9('0x54'),auth[_0xbde9('0xb')](),controller[_0xbde9('0x55')]);router[_0xbde9('0x36')](_0xbde9('0x56'),auth[_0xbde9('0xb')](),controller[_0xbde9('0x57')]);router['post'](_0xbde9('0x28'),auth[_0xbde9('0xb')](),controller['addFaxAccounts']);router['post'](_0xbde9('0x2a'),auth[_0xbde9('0xb')](),controller[_0xbde9('0x58')]);router[_0xbde9('0x36')]('/:id/openchannel_accounts',auth['isAuthenticated'](),controller[_0xbde9('0x59')]);router[_0xbde9('0x36')](_0xbde9('0x2d'),auth[_0xbde9('0xb')](),controller[_0xbde9('0x5a')]);router['post']('/:id/chat_websites',auth[_0xbde9('0xb')](),controller[_0xbde9('0x5b')]);router[_0xbde9('0x36')](_0xbde9('0x5c'),auth['isAuthenticated'](),controller[_0xbde9('0x5d')]);router[_0xbde9('0x36')](_0xbde9('0x5e'),auth['isAuthenticated'](),controller[_0xbde9('0x5f')]);router[_0xbde9('0x36')](_0xbde9('0x34'),auth[_0xbde9('0xb')](),controller['createApiKey']);router[_0xbde9('0x60')](_0xbde9('0x61'),auth[_0xbde9('0xb')](),controller['update']);router[_0xbde9('0x60')](_0xbde9('0x62'),auth[_0xbde9('0xb')](),controller['changePassword']);router[_0xbde9('0x63')](_0xbde9('0x12'),auth['isAuthenticated'](),controller[_0xbde9('0x64')]);router[_0xbde9('0x63')](_0xbde9('0x4c'),auth[_0xbde9('0xb')](),controller[_0xbde9('0x65')]);router[_0xbde9('0x63')](_0xbde9('0x61'),auth[_0xbde9('0xb')](),controller[_0xbde9('0x66')]);router[_0xbde9('0x63')]('/:id/chat_interactions',auth[_0xbde9('0xb')](),controller[_0xbde9('0x67')]);router[_0xbde9('0x63')](_0xbde9('0x50'),auth[_0xbde9('0xb')](),controller[_0xbde9('0x68')]);router['delete'](_0xbde9('0x69'),auth['isAuthenticated'](),controller[_0xbde9('0x6a')]);router[_0xbde9('0x63')](_0xbde9('0x53'),auth[_0xbde9('0xb')](),controller[_0xbde9('0x6b')]);router[_0xbde9('0x63')](_0xbde9('0x54'),auth[_0xbde9('0xb')](),controller['removeOpenchannelInteractions']);router[_0xbde9('0x63')]('/:id/whatsapp_interactions',auth['isAuthenticated'](),controller[_0xbde9('0x6c')]);router[_0xbde9('0x63')](_0xbde9('0x28'),auth['isAuthenticated'](),controller[_0xbde9('0x6d')]);router['delete'](_0xbde9('0x2a'),auth[_0xbde9('0xb')](),controller['removeMailAccounts']);router[_0xbde9('0x63')](_0xbde9('0x2c'),auth[_0xbde9('0xb')](),controller['removeOpenchannelAccounts']);router['delete'](_0xbde9('0x2d'),auth['isAuthenticated'](),controller[_0xbde9('0x6e')]);router[_0xbde9('0x63')]('/:id/chat_websites',auth['isAuthenticated'](),controller[_0xbde9('0x6f')]);router[_0xbde9('0x63')](_0xbde9('0x5c'),auth['isAuthenticated'](),controller[_0xbde9('0x70')]);router[_0xbde9('0x63')](_0xbde9('0x5e'),auth[_0xbde9('0xb')](),controller[_0xbde9('0x71')]);router[_0xbde9('0x63')](_0xbde9('0x34'),auth[_0xbde9('0xb')](),controller[_0xbde9('0x72')]);module[_0xbde9('0x73')]=router; \ No newline at end of file +var _0x51eb=['removeQueues','removeTeams','destroy','removeChatInteractions','removeFaxInteractions','removeSmsInteractions','removeOpenchannelInteractions','removeMailAccounts','removeOpenchannelAccounts','removeSmsAccounts','removeChatWebsites','removeSquareProjects','removeApiKey','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./user.controller','get','isAuthenticated','/describe','/whoami','whoami','/:id','/:id/avatar','getAvatar','/:id/contacts','getContacts','/:id/queues','getQueues','/:id/queues_rt','getVoiceQueuesRt','/:id/groups','/:id/recordings','getRecordings','/:id/screen_recordings','getChatInteractions','/:id/openchannel/interactions','getOpenchannelInteractions','/:id/mail/interactions','getMailInteractions','getFaxInteractions','/:id/whatsapp/interactions','/:id/teams','/:id/lists','getLists','getAgents','/:id/prefixes','getVoicePrefixes','/:id/fax_accounts','getFaxAccounts','/:id/mail_accounts','getMailAccounts','/:id/openchannel_accounts','getOpenchannelAccounts','/:id/sms_accounts','getSmsAccounts','/:id/chat_websites','getChatWebsites','/:id/whatsapp_accounts','getWhatsappAccounts','/:id/scheduled_calls','getScheduledCalls','/:id/api_key','/create_many','bulkCreate','post','addContacts','create','addQueues','join','root','%s-%s','now','originalname','file','addAvatar','login','/:id/logout','logout','/:id/pause','pause','/:id/unpause','/:id/chat_interactions','/:id/mail_interactions','addMailInteractions','/:id/fax_interactions','/:id/sms_interactions','addSmsInteractions','/:id/openchannel_interactions','/:id/whatsapp_interactions','addFaxAccounts','addOpenchannelAccounts','addSmsAccounts','addChatWebsites','/:id/square_projects','addSquareProjects','put','update','/:id/password','changePassword','delete'];(function(_0x428d55,_0x4e5e47){var _0x4ba5fc=function(_0x216dcd){while(--_0x216dcd){_0x428d55['push'](_0x428d55['shift']());}};_0x4ba5fc(++_0x4e5e47);}(_0x51eb,0x1ba));var _0xb51e=function(_0x3aba31,_0x4f3a86){_0x3aba31=_0x3aba31-0x0;var _0x4ed575=_0x51eb[_0x3aba31];return _0x4ed575;};'use strict';var multer=require(_0xb51e('0x0'));var util=require(_0xb51e('0x1'));var path=require(_0xb51e('0x2'));var timeout=require(_0xb51e('0x3'));var express=require('express');var router=express[_0xb51e('0x4')]();var auth=require(_0xb51e('0x5'));var interaction=require(_0xb51e('0x6'));var config=require(_0xb51e('0x7'));var controller=require(_0xb51e('0x8'));router[_0xb51e('0x9')]('/',auth[_0xb51e('0xa')](),controller['index']);router['get'](_0xb51e('0xb'),auth[_0xb51e('0xa')](),controller['describe']);router[_0xb51e('0x9')](_0xb51e('0xc'),auth['isAuthenticated'](),controller[_0xb51e('0xd')]);router[_0xb51e('0x9')](_0xb51e('0xe'),auth[_0xb51e('0xa')](),controller['show']);router[_0xb51e('0x9')](_0xb51e('0xf'),controller[_0xb51e('0x10')]);router[_0xb51e('0x9')](_0xb51e('0x11'),auth[_0xb51e('0xa')](),controller[_0xb51e('0x12')]);router[_0xb51e('0x9')](_0xb51e('0x13'),auth[_0xb51e('0xa')](),controller[_0xb51e('0x14')]);router[_0xb51e('0x9')](_0xb51e('0x15'),auth[_0xb51e('0xa')](),controller[_0xb51e('0x16')]);router[_0xb51e('0x9')](_0xb51e('0x17'),auth['isAuthenticated'](),controller['getGroups']);router[_0xb51e('0x9')](_0xb51e('0x18'),auth['isAuthenticated'](),controller[_0xb51e('0x19')]);router[_0xb51e('0x9')](_0xb51e('0x1a'),auth[_0xb51e('0xa')](),controller['getScreenRecordings']);router[_0xb51e('0x9')]('/:id/chat/interactions',auth[_0xb51e('0xa')](),controller[_0xb51e('0x1b')]);router[_0xb51e('0x9')](_0xb51e('0x1c'),auth['isAuthenticated'](),controller[_0xb51e('0x1d')]);router[_0xb51e('0x9')](_0xb51e('0x1e'),auth[_0xb51e('0xa')](),controller[_0xb51e('0x1f')]);router['get']('/:id/sms/interactions',auth[_0xb51e('0xa')](),controller['getSmsInteractions']);router[_0xb51e('0x9')]('/:id/fax/interactions',auth[_0xb51e('0xa')](),controller[_0xb51e('0x20')]);router[_0xb51e('0x9')](_0xb51e('0x21'),auth[_0xb51e('0xa')](),controller['getWhatsappInteractions']);router[_0xb51e('0x9')](_0xb51e('0x22'),auth[_0xb51e('0xa')](),controller['getTeams']);router[_0xb51e('0x9')](_0xb51e('0x23'),auth['isAuthenticated'](),controller[_0xb51e('0x24')]);router[_0xb51e('0x9')]('/:id/agents',auth[_0xb51e('0xa')](),controller[_0xb51e('0x25')]);router[_0xb51e('0x9')](_0xb51e('0x26'),auth['isAuthenticated'](),controller[_0xb51e('0x27')]);router['get'](_0xb51e('0x28'),auth['isAuthenticated'](),controller[_0xb51e('0x29')]);router[_0xb51e('0x9')](_0xb51e('0x2a'),auth[_0xb51e('0xa')](),controller[_0xb51e('0x2b')]);router[_0xb51e('0x9')](_0xb51e('0x2c'),auth[_0xb51e('0xa')](),controller[_0xb51e('0x2d')]);router[_0xb51e('0x9')](_0xb51e('0x2e'),auth[_0xb51e('0xa')](),controller[_0xb51e('0x2f')]);router[_0xb51e('0x9')](_0xb51e('0x30'),auth[_0xb51e('0xa')](),controller[_0xb51e('0x31')]);router[_0xb51e('0x9')](_0xb51e('0x32'),auth[_0xb51e('0xa')](),controller[_0xb51e('0x33')]);router[_0xb51e('0x9')]('/:id/square_projects',auth[_0xb51e('0xa')](),controller['getSquareProjects']);router[_0xb51e('0x9')](_0xb51e('0x34'),auth['isAuthenticated'](),controller[_0xb51e('0x35')]);router['get'](_0xb51e('0x36'),auth[_0xb51e('0xa')](),controller['getApiKey']);router['post'](_0xb51e('0x37'),auth[_0xb51e('0xa')](),controller[_0xb51e('0x38')]);router[_0xb51e('0x39')]('/:id/contacts',auth[_0xb51e('0xa')](),controller[_0xb51e('0x3a')]);router[_0xb51e('0x39')]('/',auth[_0xb51e('0xa')](),controller[_0xb51e('0x3b')]);router[_0xb51e('0x39')]('/:id/queues',auth['isAuthenticated'](),controller[_0xb51e('0x3c')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x770b36,_0x5d0f13,_0x525f91){_0x525f91(null,path[_0xb51e('0x3d')](config[_0xb51e('0x3e')],'server/files/images/'));},'filename':function(_0x10db00,_0x28d6c5,_0x328e20){_0x328e20(null,util['format'](_0xb51e('0x3f'),Date[_0xb51e('0x40')](),_0x28d6c5[_0xb51e('0x41')]));}})});router['post'](_0xb51e('0xf'),upload['single'](_0xb51e('0x42')),controller[_0xb51e('0x43')]);router['post']('/:id/login',auth[_0xb51e('0xa')](),controller[_0xb51e('0x44')]);router[_0xb51e('0x39')](_0xb51e('0x45'),auth[_0xb51e('0xa')](),controller[_0xb51e('0x46')]);router[_0xb51e('0x39')](_0xb51e('0x47'),auth[_0xb51e('0xa')](),controller[_0xb51e('0x48')]);router[_0xb51e('0x39')](_0xb51e('0x49'),auth[_0xb51e('0xa')](),controller['unpause']);router[_0xb51e('0x39')](_0xb51e('0x22'),auth[_0xb51e('0xa')](),controller['addTeams']);router[_0xb51e('0x39')](_0xb51e('0x4a'),auth[_0xb51e('0xa')](),controller['addChatInteractions']);router[_0xb51e('0x39')](_0xb51e('0x4b'),auth[_0xb51e('0xa')](),controller[_0xb51e('0x4c')]);router[_0xb51e('0x39')](_0xb51e('0x4d'),auth[_0xb51e('0xa')](),controller['addFaxInteractions']);router[_0xb51e('0x39')](_0xb51e('0x4e'),auth[_0xb51e('0xa')](),controller[_0xb51e('0x4f')]);router[_0xb51e('0x39')](_0xb51e('0x50'),auth[_0xb51e('0xa')](),controller['addOpenchannelInteractions']);router[_0xb51e('0x39')](_0xb51e('0x51'),auth[_0xb51e('0xa')](),controller['addWhatsappInteractions']);router[_0xb51e('0x39')](_0xb51e('0x28'),auth[_0xb51e('0xa')](),controller[_0xb51e('0x52')]);router[_0xb51e('0x39')](_0xb51e('0x2a'),auth['isAuthenticated'](),controller['addMailAccounts']);router[_0xb51e('0x39')](_0xb51e('0x2c'),auth[_0xb51e('0xa')](),controller[_0xb51e('0x53')]);router['post'](_0xb51e('0x2e'),auth[_0xb51e('0xa')](),controller[_0xb51e('0x54')]);router['post'](_0xb51e('0x30'),auth[_0xb51e('0xa')](),controller[_0xb51e('0x55')]);router[_0xb51e('0x39')](_0xb51e('0x32'),auth['isAuthenticated'](),controller['addWhatsappAccounts']);router[_0xb51e('0x39')](_0xb51e('0x56'),auth[_0xb51e('0xa')](),controller[_0xb51e('0x57')]);router[_0xb51e('0x39')](_0xb51e('0x36'),auth[_0xb51e('0xa')](),controller['createApiKey']);router[_0xb51e('0x58')]('/:id',auth[_0xb51e('0xa')](),controller[_0xb51e('0x59')]);router[_0xb51e('0x58')](_0xb51e('0x5a'),auth[_0xb51e('0xa')](),controller[_0xb51e('0x5b')]);router[_0xb51e('0x5c')]('/:id/queues',auth[_0xb51e('0xa')](),controller[_0xb51e('0x5d')]);router[_0xb51e('0x5c')](_0xb51e('0x22'),auth[_0xb51e('0xa')](),controller[_0xb51e('0x5e')]);router[_0xb51e('0x5c')](_0xb51e('0xe'),auth[_0xb51e('0xa')](),controller[_0xb51e('0x5f')]);router[_0xb51e('0x5c')]('/:id/chat_interactions',auth[_0xb51e('0xa')](),controller[_0xb51e('0x60')]);router['delete'](_0xb51e('0x4b'),auth['isAuthenticated'](),controller['removeMailInteractions']);router[_0xb51e('0x5c')](_0xb51e('0x4d'),auth[_0xb51e('0xa')](),controller[_0xb51e('0x61')]);router['delete']('/:id/sms_interactions',auth['isAuthenticated'](),controller[_0xb51e('0x62')]);router[_0xb51e('0x5c')](_0xb51e('0x50'),auth['isAuthenticated'](),controller[_0xb51e('0x63')]);router[_0xb51e('0x5c')](_0xb51e('0x51'),auth[_0xb51e('0xa')](),controller['removeWhatsappInteractions']);router[_0xb51e('0x5c')](_0xb51e('0x28'),auth[_0xb51e('0xa')](),controller['removeFaxAccounts']);router['delete'](_0xb51e('0x2a'),auth[_0xb51e('0xa')](),controller[_0xb51e('0x64')]);router[_0xb51e('0x5c')](_0xb51e('0x2c'),auth['isAuthenticated'](),controller[_0xb51e('0x65')]);router['delete'](_0xb51e('0x2e'),auth[_0xb51e('0xa')](),controller[_0xb51e('0x66')]);router['delete'](_0xb51e('0x30'),auth[_0xb51e('0xa')](),controller[_0xb51e('0x67')]);router['delete']('/:id/whatsapp_accounts',auth['isAuthenticated'](),controller['removeWhatsappAccounts']);router[_0xb51e('0x5c')](_0xb51e('0x56'),auth[_0xb51e('0xa')](),controller[_0xb51e('0x68')]);router['delete']('/:id/api_key',auth[_0xb51e('0xa')](),controller[_0xb51e('0x69')]);module[_0xb51e('0x6a')]=router; \ No newline at end of file diff --git a/server/api/user/user.attributes.js b/server/api/user/user.attributes.js index 99c4144..531b998 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 _0x84ec=['dtlssetup','dtlsprivatekey','/etc/pki/tls/private/motion.key','permissions','map','VIRTUAL','phoneBarEnableScreenRecordingByAgent','string','screenrecording','blocked','blockedAt','loginAttempts','sequelize','moment','util','lodash','exports','STRING','name','setDataValue','defaultuser','fullname','callerid','internal','email','toLowerCase','ENUM','admin','local','accountcode','format','getDataValue','BOOLEAN','DATE','DEFAULT\x20PAUSE','INTEGER','dynamic','friend','user','peer','from-sip','ALLOWED_NOT_SCREENED','ALLOWED_PASSED_SCREEN','ALLOWED_FAILED_SCREEN','PROHIB_PASSED_SCREEN','PROHIB_FAILED_SCREEN','PROHIB','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','rfc2833','info','auto','yes','nonat','force_rport,comedia','join','nat','ulaw;alaw;gsm','allow','split','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]','\x22\x22\x20<>','always','accept','refuse','uas','fingerprint','active','passive','actpass','update,nonat','get','transport','udp','wss','encryption','avpf','force_avp','icesupport','dtlsenable','dtlscertfile','rtcp_mux','dtlsverify'];(function(_0x3a0ddd,_0x24432a){var _0xd396c6=function(_0x20adfd){while(--_0x20adfd){_0x3a0ddd['push'](_0x3a0ddd['shift']());}};_0xd396c6(++_0x24432a);}(_0x84ec,0x1b0));var _0xc84e=function(_0x4f28a6,_0x20eaa2){_0x4f28a6=_0x4f28a6-0x0;var _0x3b0d88=_0x84ec[_0x4f28a6];return _0x3b0d88;};'use strict';var Sequelize=require(_0xc84e('0x0'));var moment=require(_0xc84e('0x1'));var util=require(_0xc84e('0x2'));var _=require(_0xc84e('0x3'));module[_0xc84e('0x4')]={'name':{'type':Sequelize[_0xc84e('0x5')],'allowNull':![],'unique':_0xc84e('0x6'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i},'set':function(_0x64f367){this['setDataValue'](_0xc84e('0x6'),_0x64f367);this[_0xc84e('0x7')](_0xc84e('0x8'),_0x64f367);},'comment':'The\x20name\x20of\x20the\x20user'},'fullname':{'type':Sequelize['STRING'],'allowNull':![],'set':function(_0x1ceaf0){this[_0xc84e('0x7')](_0xc84e('0x9'),_0x1ceaf0);this['setDataValue'](_0xc84e('0xa'),util['format']('\x22%s\x22\x20<%s>',_0x1ceaf0,this['getDataValue'](_0xc84e('0xb'))));}},'alias':{'type':Sequelize['STRING']},'email':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0xc84e('0xc'),'validate':{'isEmail':!![]},'set':function(_0x1f3d09){if(_0x1f3d09){this[_0xc84e('0x7')](_0xc84e('0xc'),_0x1f3d09[_0xc84e('0xd')]());}}},'role':{'type':Sequelize[_0xc84e('0xe')](_0xc84e('0xf'),'user','agent','telephone'),'allowNull':![]},'password':{'type':Sequelize[_0xc84e('0x5')],'allowNull':![],'validate':{'notEmpty':!![]}},'provider':{'type':Sequelize['STRING'],'defaultValue':_0xc84e('0x10')},'internal':{'type':Sequelize['INTEGER'](0xb),'allowNull':![],'unique':_0xc84e('0xb'),'set':function(_0x48627b){this[_0xc84e('0x7')]('internal',_0x48627b);this[_0xc84e('0x7')](_0xc84e('0x11'),_0x48627b);this['setDataValue'](_0xc84e('0xa'),util[_0xc84e('0x12')]('\x22%s\x22\x20<%s>',this[_0xc84e('0x13')](_0xc84e('0x9')),_0x48627b));}},'salt':{'type':Sequelize['STRING']},'phone':{'type':Sequelize[_0xc84e('0x5')]},'mobile':{'type':Sequelize[_0xc84e('0x5')]},'address':{'type':Sequelize['STRING']},'zipcode':{'type':Sequelize[_0xc84e('0x5')]},'userpic':{'type':Sequelize['STRING']},'city':{'type':Sequelize[_0xc84e('0x5')]},'country':{'type':Sequelize[_0xc84e('0x5')]},'online':{'type':Sequelize[_0xc84e('0x14')],'defaultValue':![]},'lastLoginAt':{'type':Sequelize[_0xc84e('0x15')]},'voicePause':{'type':Sequelize[_0xc84e('0x14')],'defaultValue':![]},'chatPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'mailPause':{'type':Sequelize[_0xc84e('0x14')],'defaultValue':![]},'faxPause':{'type':Sequelize[_0xc84e('0x14')],'defaultValue':![]},'smsPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'whatsappPause':{'type':Sequelize[_0xc84e('0x14')],'defaultValue':![]},'openchannelPause':{'type':Sequelize[_0xc84e('0x14')],'defaultValue':![]},'pauseType':{'type':Sequelize[_0xc84e('0x5')],'defaultValue':_0xc84e('0x16')},'lastPauseAt':{'type':Sequelize[_0xc84e('0x15')]},'chatCapacity':{'type':Sequelize[_0xc84e('0x17')],'defaultValue':0x0},'mailCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'faxCapacity':{'type':Sequelize[_0xc84e('0x17')],'defaultValue':0x0},'smsCapacity':{'type':Sequelize[_0xc84e('0x17')],'defaultValue':0x0},'whatsappCapacity':{'type':Sequelize[_0xc84e('0x17')],'defaultValue':0x0},'openchannelCapacity':{'type':Sequelize[_0xc84e('0x17')],'defaultValue':0x0},'phoneBarAutoAnswer':{'type':Sequelize[_0xc84e('0x14')],'defaultValue':![]},'phoneBarEnableSettings':{'type':Sequelize[_0xc84e('0x14')],'defaultValue':!![]},'phoneBarListenPort':{'type':Sequelize[_0xc84e('0x17')](0x5),'defaultValue':0x1428},'phoneBarExpires':{'type':Sequelize[_0xc84e('0x17')](0x5),'defaultValue':0x78},'phoneBarRemoteControl':{'type':Sequelize[_0xc84e('0x14')],'defaultValue':![]},'phoneBarRemoteControlPort':{'type':Sequelize[_0xc84e('0x17')],'defaultValue':0x26a0},'phoneBarEnableRecording':{'type':Sequelize[_0xc84e('0x14')],'defaultValue':![]},'phoneBarRingInUse':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'chanspy':{'type':Sequelize[_0xc84e('0x14')],'defaultValue':![]},'description':{'type':Sequelize['STRING'],'allowNull':!![]},'host':{'type':Sequelize[_0xc84e('0x5')],'allowNull':!![],'defaultValue':_0xc84e('0x18')},'ipaddr':{'type':Sequelize[_0xc84e('0x5')],'allowNull':!![]},'port':{'type':Sequelize[_0xc84e('0x17')](0x5),'allowNull':!![]},'regseconds':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'fullcontact':{'type':Sequelize[_0xc84e('0x5')],'allowNull':!![]},'regserver':{'type':Sequelize[_0xc84e('0x5')],'allowNull':!![]},'useragent':{'type':Sequelize[_0xc84e('0x5')],'allowNull':!![]},'lastms':{'type':Sequelize[_0xc84e('0x17')](0xb),'allowNull':!![]},'type':{'type':Sequelize['ENUM'](_0xc84e('0x19'),_0xc84e('0x1a'),_0xc84e('0x1b')),'allowNull':!![],'defaultValue':'friend'},'context':{'type':Sequelize[_0xc84e('0x5')],'allowNull':!![],'defaultValue':_0xc84e('0x1c')},'callingpres':{'type':Sequelize[_0xc84e('0xe')](_0xc84e('0x1d'),_0xc84e('0x1e'),_0xc84e('0x1f'),'ALLOWED','PROHIB_NOT_SCREENED',_0xc84e('0x20'),_0xc84e('0x21'),_0xc84e('0x22')),'allowNull':!![]},'deny':{'type':Sequelize[_0xc84e('0x5')],'allowNull':!![]},'permit':{'type':Sequelize[_0xc84e('0x5')],'allowNull':!![]},'secret':{'type':Sequelize[_0xc84e('0x5')],'allowNull':!![]},'md5secret':{'type':Sequelize['STRING'],'allowNull':!![]},'remotesecret':{'type':Sequelize[_0xc84e('0x5')],'allowNull':!![]},'transport':{'type':Sequelize[_0xc84e('0x5')],'allowNull':!![],'defaultValue':'udp','set':function(_0x125bb6){this[_0xc84e('0x7')]('transport',_0x125bb6?_0x125bb6['join'](','):null);},'get':function(){return this['getDataValue']('transport')?this[_0xc84e('0x13')]('transport')['split'](','):null;},'comment':_0xc84e('0x23')},'dtmfmode':{'type':Sequelize[_0xc84e('0xe')](_0xc84e('0x24'),_0xc84e('0x25'),'shortinfo','inband',_0xc84e('0x26')),'allowNull':!![],'defaultValue':_0xc84e('0x24')},'directmedia':{'type':Sequelize[_0xc84e('0xe')](_0xc84e('0x27'),'no',_0xc84e('0x28'),'update','outgoing'),'allowNull':!![],'defaultValue':'no'},'directrtpsetup':{'type':Sequelize['ENUM']('yes','no'),'allowNull':!![],'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0xc84e('0x5')],'allowNull':!![]},'directmediadeny':{'type':Sequelize[_0xc84e('0x5')],'allowNull':!![]},'nat':{'type':Sequelize[_0xc84e('0x5')],'allowNull':!![],'defaultValue':_0xc84e('0x29'),'set':function(_0x1e8a6a){this[_0xc84e('0x7')]('nat',_0x1e8a6a?_0x1e8a6a[_0xc84e('0x2a')](','):null);},'get':function(){return this['getDataValue'](_0xc84e('0x2b'))?this[_0xc84e('0x13')](_0xc84e('0x2b'))['split'](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]'},'callgroup':{'type':Sequelize['STRING']},'namedcallgroup':{'type':Sequelize[_0xc84e('0x5')]},'pickupgroup':{'type':Sequelize[_0xc84e('0x5')]},'namedpickupgroup':{'type':Sequelize['STRING']},'language':{'type':Sequelize['STRING'],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0xc84e('0x5')]},'disallow':{'type':Sequelize[_0xc84e('0x5')],'allowNull':![],'defaultValue':'all'},'allow':{'type':Sequelize[_0xc84e('0x5')],'allowNull':![],'defaultValue':_0xc84e('0x2c'),'set':function(_0x2be38a){this[_0xc84e('0x7')]('allow',_0x2be38a?_0x2be38a[_0xc84e('0x2a')](';'):_0xc84e('0x2c'));},'get':function(){return this[_0xc84e('0x13')]('allow')?this['getDataValue'](_0xc84e('0x2d'))[_0xc84e('0x2e')](';'):null;},'comment':_0xc84e('0x2f')},'autoframing':{'type':Sequelize[_0xc84e('0xe')](_0xc84e('0x27'),'no'),'allowNull':!![]},'insecure':{'type':Sequelize[_0xc84e('0x5')],'allowNull':!![],'set':function(_0x5cf673){this[_0xc84e('0x7')](_0xc84e('0x30'),_0x5cf673?_0x5cf673[_0xc84e('0x2a')](','):null);},'get':function(){return this[_0xc84e('0x13')](_0xc84e('0x30'))?this[_0xc84e('0x13')](_0xc84e('0x30'))[_0xc84e('0x2e')](','):null;},'comment':_0xc84e('0x31')},'trustrpid':{'type':Sequelize['ENUM'](_0xc84e('0x27'),'no'),'allowNull':!![],'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0xc84e('0xe')](_0xc84e('0x27'),'no'),'allowNull':!![],'defaultValue':'no'},'progressinband':{'type':Sequelize[_0xc84e('0xe')](_0xc84e('0x27'),'no','never'),'allowNull':!![]},'promiscredir':{'type':Sequelize['ENUM'](_0xc84e('0x27'),'no'),'allowNull':!![]},'useclientcode':{'type':Sequelize['ENUM'](_0xc84e('0x27'),'no'),'allowNull':!![]},'accountcode':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'setvar':{'type':Sequelize[_0xc84e('0x5')],'allowNull':!![]},'callerid':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':_0xc84e('0x32')},'amaflags':{'type':Sequelize[_0xc84e('0x5')],'allowNull':!![]},'callcounter':{'type':Sequelize['ENUM'](_0xc84e('0x27'),'no'),'allowNull':!![],'defaultValue':_0xc84e('0x27')},'busylevel':{'type':Sequelize[_0xc84e('0x17')](0xb),'allowNull':!![]},'allowoverlap':{'type':Sequelize[_0xc84e('0xe')](_0xc84e('0x27'),'no'),'allowNull':!![]},'allowsubscribe':{'type':Sequelize['ENUM'](_0xc84e('0x27'),'no'),'allowNull':!![]},'allowtransfer':{'type':Sequelize['ENUM'](_0xc84e('0x27'),'no'),'allowNull':!![]},'ignoresdpversion':{'type':Sequelize[_0xc84e('0xe')](_0xc84e('0x27'),'no'),'allowNull':!![]},'subscribecontext':{'type':Sequelize[_0xc84e('0x5')],'allowNull':!![]},'template':{'type':Sequelize['STRING'],'allowNull':!![]},'videosupport':{'type':Sequelize[_0xc84e('0xe')]('yes','no',_0xc84e('0x33')),'allowNull':!![],'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'rfc2833compensate':{'type':Sequelize[_0xc84e('0xe')](_0xc84e('0x27'),'no'),'allowNull':!![]},'mailbox':{'type':Sequelize[_0xc84e('0x5')],'allowNull':!![]},'session_timers':{'type':Sequelize[_0xc84e('0xe')](_0xc84e('0x34'),_0xc84e('0x35'),'originate'),'allowNull':!![]},'session_expires':{'type':Sequelize[_0xc84e('0x17')](0xb),'allowNull':!![]},'session_minse':{'type':Sequelize[_0xc84e('0x17')](0xb),'allowNull':!![]},'session_refresher':{'type':Sequelize[_0xc84e('0xe')]('uac',_0xc84e('0x36')),'allowNull':!![],'defaultValue':_0xc84e('0x36')},'t38pt_usertpsource':{'type':Sequelize[_0xc84e('0x5')],'allowNull':!![]},'regexten':{'type':Sequelize['STRING'],'allowNull':!![]},'fromdomain':{'type':Sequelize['STRING'],'allowNull':!![]},'fromuser':{'type':Sequelize[_0xc84e('0x5')],'allowNull':!![]},'qualify':{'type':Sequelize['ENUM']('yes','no'),'allowNull':!![],'defaultValue':_0xc84e('0x27')},'keepalive':{'type':Sequelize[_0xc84e('0x17')](0xb),'allowNull':!![]},'defaultip':{'type':Sequelize[_0xc84e('0x5')],'allowNull':!![]},'defaultuser':{'type':Sequelize['STRING'],'allowNull':!![]},'rtptimeout':{'type':Sequelize[_0xc84e('0x17')](0xb),'allowNull':!![]},'rtpholdtimeout':{'type':Sequelize[_0xc84e('0x17')](0xb),'allowNull':!![]},'rtpkeepalive':{'type':Sequelize[_0xc84e('0x17')](0xb),'allowNull':!![]},'sendrpid':{'type':Sequelize[_0xc84e('0xe')](_0xc84e('0x27'),'no'),'allowNull':!![],'defaultValue':'no'},'outboundproxy':{'type':Sequelize['STRING'],'allowNull':!![]},'callbackextension':{'type':Sequelize[_0xc84e('0x5')],'allowNull':!![]},'timert1':{'type':Sequelize[_0xc84e('0x17')](0xb),'allowNull':!![]},'timerb':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'qualifyfreq':{'type':Sequelize[_0xc84e('0x17')](0xb),'allowNull':!![]},'contactpermit':{'type':Sequelize[_0xc84e('0x5')],'allowNull':!![]},'contactdeny':{'type':Sequelize[_0xc84e('0x5')],'allowNull':!![]},'contactacl':{'type':Sequelize['STRING'],'allowNull':!![]},'unsolicited_mailbox':{'type':Sequelize[_0xc84e('0x5')],'allowNull':!![]},'use_q850_reason':{'type':Sequelize[_0xc84e('0x5')],'allowNull':!![]},'maxforwards':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'encryption':{'type':Sequelize[_0xc84e('0xe')](_0xc84e('0x27'),'no'),'allowNull':!![],'defaultValue':'no'},'avpf':{'type':Sequelize['ENUM']('yes','no'),'allowNull':!![]},'force_avp':{'type':Sequelize[_0xc84e('0xe')](_0xc84e('0x27'),'no'),'allowNull':!![]},'icesupport':{'type':Sequelize['ENUM'](_0xc84e('0x27'),'no'),'allowNull':!![]},'dtlsenable':{'type':Sequelize['ENUM'](_0xc84e('0x27'),'no'),'allowNull':!![]},'dtlsverify':{'type':Sequelize[_0xc84e('0xe')](_0xc84e('0x27'),'no',_0xc84e('0x37'),'certificate'),'allowNull':!![]},'dtlsrekey':{'type':Sequelize[_0xc84e('0x17')](0xb),'allowNull':!![]},'dtlscertfile':{'type':Sequelize[_0xc84e('0x5')],'allowNull':!![]},'dtlsprivatekey':{'type':Sequelize[_0xc84e('0x5')],'allowNull':!![]},'dtlscipher':{'type':Sequelize[_0xc84e('0x5')],'allowNull':!![]},'dtlscafile':{'type':Sequelize['STRING'],'allowNull':!![]},'dtlscapath':{'type':Sequelize[_0xc84e('0x5')],'allowNull':!![]},'dtlssetup':{'type':Sequelize[_0xc84e('0xe')](_0xc84e('0x38'),_0xc84e('0x39'),_0xc84e('0x3a')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0xc84e('0x5')],'allowNull':!![]},'usereqphone':{'type':Sequelize[_0xc84e('0xe')]('yes','no'),'allowNull':!![],'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0xc84e('0x5')],'allowNull':!![]},'recordofffeature':{'type':Sequelize['STRING'],'allowNull':!![]},'call_limit':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![],'defaultValue':0xa},'registertrying':{'type':Sequelize[_0xc84e('0xe')](_0xc84e('0x27'),'no'),'allowNull':!![]},'subscribemwi':{'type':Sequelize['ENUM'](_0xc84e('0x27'),'no'),'allowNull':!![]},'vmexten':{'type':Sequelize['STRING'],'allowNull':!![]},'mohinterpret':{'type':Sequelize[_0xc84e('0x5')],'allowNull':!![]},'mohsuggest':{'type':Sequelize[_0xc84e('0x5')],'allowNull':!![]},'parkinglot':{'type':Sequelize[_0xc84e('0x5')],'allowNull':!![]},'canreinvite':{'type':Sequelize[_0xc84e('0xe')](_0xc84e('0x27'),'no','nonat','update',_0xc84e('0x3b')),'allowNull':!![],'defaultValue':'no'},'loginInPause':{'type':Sequelize[_0xc84e('0x14')],'defaultValue':![]},'resetPasswordToken':{'type':Sequelize[_0xc84e('0x5')]},'resetPasswordExpires':{'type':Sequelize[_0xc84e('0x15')]},'showWebBar':{'type':Sequelize[_0xc84e('0x17')],'defaultValue':0x0,'set':function(_0x5a1240){this['setDataValue']('showWebBar',_0x5a1240);var _0x54e81f=this[_0xc84e('0x3c')]({'plain':!![]});switch(_0x5a1240){case 0x0:case 0x1:var _0x2151ad=_0x54e81f[_0xc84e('0x3d')]?_['isArray'](_0x54e81f[_0xc84e('0x3d')])?_0x54e81f[_0xc84e('0x3d')][_0xc84e('0x2a')]():_0x54e81f[_0xc84e('0x3d')]:_0xc84e('0x3e');if(_0x2151ad===_0xc84e('0x3f')){_0x2151ad=_0xc84e('0x3e');}this['setDataValue']('transport',_0x2151ad);this[_0xc84e('0x7')](_0xc84e('0x40'),'no');this[_0xc84e('0x7')](_0xc84e('0x41'),null);this[_0xc84e('0x7')](_0xc84e('0x42'),null);this[_0xc84e('0x7')](_0xc84e('0x43'),null);this[_0xc84e('0x7')](_0xc84e('0x44'),null);this[_0xc84e('0x7')]('dtlsverify',null);this[_0xc84e('0x7')]('dtlssetup',null);this[_0xc84e('0x7')](_0xc84e('0x45'),null);this[_0xc84e('0x7')]('dtlsprivatekey',null);this[_0xc84e('0x7')](_0xc84e('0x46'),'no');break;case 0x2:this['setDataValue']('transport',_0xc84e('0x3f'));this['setDataValue'](_0xc84e('0x40'),_0xc84e('0x27'));this['setDataValue'](_0xc84e('0x41'),_0xc84e('0x27'));this[_0xc84e('0x7')]('force_avp',_0xc84e('0x27'));this[_0xc84e('0x7')](_0xc84e('0x43'),'yes');this[_0xc84e('0x7')]('dtlsenable',_0xc84e('0x27'));this['setDataValue'](_0xc84e('0x47'),'no');this[_0xc84e('0x7')](_0xc84e('0x48'),_0xc84e('0x3a'));this['setDataValue']('dtlscertfile',_0x54e81f[_0xc84e('0x45')]||'/etc/pki/tls/certs/motion.crt');this[_0xc84e('0x7')](_0xc84e('0x49'),_0x54e81f[_0xc84e('0x49')]||_0xc84e('0x4a'));this[_0xc84e('0x7')]('rtcp_mux','yes');break;default:}}},'permissions':{'type':Sequelize['TEXT'],'set':function(_0x3f927f){this['setDataValue'](_0xc84e('0x4b'),_0x3f927f?_0x3f927f[_0xc84e('0x2a')](','):[]);},'get':function(){return this[_0xc84e('0x13')]('permissions')?_[_0xc84e('0x4c')](this[_0xc84e('0x13')](_0xc84e('0x4b'))['split'](','),function(_0x17bdfa){return parseInt(_0x17bdfa,0xa);}):[];}},'phoneBarUnconditionalNumber':{'type':Sequelize[_0xc84e('0x5')]},'phoneBarNoReplyNumber':{'type':Sequelize['STRING']},'phoneBarBusyNumber':{'type':Sequelize[_0xc84e('0x5')]},'phoneBarUnconditional':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarNoReply':{'type':Sequelize[_0xc84e('0x14')],'defaultValue':![]},'phoneBarBusy':{'type':Sequelize[_0xc84e('0x14')],'defaultValue':![]},'phoneBarDnd':{'type':Sequelize[_0xc84e('0x14')],'defaultValue':!![]},'phoneBarUnansweredCallBadge':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'phoneBarEnableDtmfTone':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarAutoAnswerDelay':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'extensionMonitor':{'type':Sequelize[_0xc84e('0x5')],'defaultValue':''},'crudPermissions':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'rtcp_mux':{'type':Sequelize[_0xc84e('0xe')](_0xc84e('0x27'),'no'),'defaultValue':'no'},'allowmessenger':{'type':Sequelize[_0xc84e('0x14')],'defaultValue':!![]},'phoneBarOutboundProxy':{'type':Sequelize[_0xc84e('0x5')]},'passwordResetAt':{'type':Sequelize[_0xc84e('0x15')],'defaultValue':null},'phoneBarEnableJaws':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarEnableScreenRecordingByAgent':{'type':Sequelize[_0xc84e('0x14')],'defaultValue':![]},'phoneBarEnableVideoRecording':{'type':Sequelize[_0xc84e('0x4d')],'get':function(){return this[_0xc84e('0x13')](_0xc84e('0x4e'))?this[_0xc84e('0x13')]('phoneBarEnableScreenRecordingByAgent'):![];}},'phoneBarEnableAutomaticScreenRecording':{'type':Sequelize[_0xc84e('0x14')],'defaultValue':![]},'phoneBarPrefixRequired':{'type':Sequelize[_0xc84e('0x14')],'defaultValue':![]},'hotdesk':{'type':Sequelize[_0xc84e('0x14')],'defaultValue':![]},'interface':{'type':Sequelize[_0xc84e('0x5')],'defaultValue':null},'privacyEnabled':{'type':Sequelize[_0xc84e('0x14')],'defaultValue':![]},'apiKeyNonce':{'type':Sequelize[_0xc84e('0x5')],'allowNull':!![]},'apiKeyIat':{'type':Sequelize[_0xc84e('0x5')],'allowNull':!![]},'screenrecording':{'type':Sequelize[_0xc84e('0x14')],'defaultValue':![],'set':function(_0x58c285){if(typeof _0x58c285===_0xc84e('0x4f')){var _0x4f7508=_0x58c285==='1'?!![]:_0x58c285==='0'?![]:_0x58c285==='true'?!![]:_0x58c285==='false'?![]:![];this[_0xc84e('0x7')](_0xc84e('0x50'),_0x4f7508);}else{this[_0xc84e('0x7')]('screenrecording',_0x58c285);}}},'blocked':{'type':Sequelize[_0xc84e('0x14')],'defaultValue':![],'set':function(_0x1e038a){this[_0xc84e('0x7')](_0xc84e('0x51'),_0x1e038a);if(_0x1e038a===!![]){this[_0xc84e('0x7')](_0xc84e('0x52'),moment());this['setDataValue'](_0xc84e('0x53'),0x0);}else{this[_0xc84e('0x7')](_0xc84e('0x52'),null);}}},'blockedAt':{'type':Sequelize[_0xc84e('0x15')],'defaultValue':null},'loginAttempts':{'type':Sequelize[_0xc84e('0x17')],'defaultValue':0x0},'disabled':{'type':Sequelize[_0xc84e('0x14')],'defaultValue':![]}}; \ No newline at end of file +var _0xe4a2=['accountcode','callerid','format','BOOLEAN','DATE','DEFAULT\x20PAUSE','dynamic','ENUM','friend','user','peer','from-sip','ALLOWED_NOT_SCREENED','ALLOWED_PASSED_SCREEN','ALLOWED_FAILED_SCREEN','ALLOWED','PROHIB_NOT_SCREENED','PROHIB_PASSED_SCREEN','PROHIB_FAILED_SCREEN','PROHIB','udp','transport','join','split','info','shortinfo','inband','auto','yes','nonat','update','outgoing','force_rport,comedia','nat','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]','all','allow','ulaw;alaw;gsm','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22gsm\x22]','insecure','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]','never','accept','refuse','originate','uas','fingerprint','certificate','active','passive','actpass','showWebBar','get','isArray','encryption','avpf','force_avp','icesupport','dtlsenable','dtlsverify','dtlssetup','dtlscertfile','dtlsprivatekey','rtcp_mux','wss','/etc/pki/tls/certs/motion.crt','/etc/pki/tls/private/motion.key','TEXT','permissions','phoneBarEnableScreenRecordingByAgent','string','true','screenrecording','blocked','blockedAt','loginAttempts','sequelize','moment','lodash','exports','STRING','name','setDataValue','fullname','getDataValue','email','toLowerCase','admin','agent','telephone','local','INTEGER','internal'];(function(_0x5e3a45,_0x45f0c5){var _0x13419f=function(_0x5ac996){while(--_0x5ac996){_0x5e3a45['push'](_0x5e3a45['shift']());}};_0x13419f(++_0x45f0c5);}(_0xe4a2,0x106));var _0x2e4a=function(_0x3dcb03,_0x29f542){_0x3dcb03=_0x3dcb03-0x0;var _0x4c42b1=_0xe4a2[_0x3dcb03];return _0x4c42b1;};'use strict';var Sequelize=require(_0x2e4a('0x0'));var moment=require(_0x2e4a('0x1'));var util=require('util');var _=require(_0x2e4a('0x2'));module[_0x2e4a('0x3')]={'name':{'type':Sequelize[_0x2e4a('0x4')],'allowNull':![],'unique':_0x2e4a('0x5'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i},'set':function(_0x1b4a77){this[_0x2e4a('0x6')](_0x2e4a('0x5'),_0x1b4a77);this['setDataValue']('defaultuser',_0x1b4a77);},'comment':'The\x20name\x20of\x20the\x20user'},'fullname':{'type':Sequelize[_0x2e4a('0x4')],'allowNull':![],'set':function(_0x4f23c0){this[_0x2e4a('0x6')](_0x2e4a('0x7'),_0x4f23c0);this[_0x2e4a('0x6')]('callerid',util['format']('\x22%s\x22\x20<%s>',_0x4f23c0,this[_0x2e4a('0x8')]('internal')));}},'alias':{'type':Sequelize[_0x2e4a('0x4')]},'email':{'type':Sequelize[_0x2e4a('0x4')],'allowNull':![],'unique':_0x2e4a('0x9'),'validate':{'isEmail':!![]},'set':function(_0x398c67){if(_0x398c67){this[_0x2e4a('0x6')](_0x2e4a('0x9'),_0x398c67[_0x2e4a('0xa')]());}}},'role':{'type':Sequelize['ENUM'](_0x2e4a('0xb'),'user',_0x2e4a('0xc'),_0x2e4a('0xd')),'allowNull':![]},'password':{'type':Sequelize[_0x2e4a('0x4')],'allowNull':![],'validate':{'notEmpty':!![]}},'provider':{'type':Sequelize[_0x2e4a('0x4')],'defaultValue':_0x2e4a('0xe')},'internal':{'type':Sequelize[_0x2e4a('0xf')](0xb),'allowNull':![],'unique':'internal','set':function(_0x5135e6){this[_0x2e4a('0x6')](_0x2e4a('0x10'),_0x5135e6);this[_0x2e4a('0x6')](_0x2e4a('0x11'),_0x5135e6);this['setDataValue'](_0x2e4a('0x12'),util[_0x2e4a('0x13')]('\x22%s\x22\x20<%s>',this[_0x2e4a('0x8')]('fullname'),_0x5135e6));}},'salt':{'type':Sequelize['STRING']},'phone':{'type':Sequelize[_0x2e4a('0x4')]},'mobile':{'type':Sequelize[_0x2e4a('0x4')]},'address':{'type':Sequelize[_0x2e4a('0x4')]},'zipcode':{'type':Sequelize[_0x2e4a('0x4')]},'userpic':{'type':Sequelize[_0x2e4a('0x4')]},'city':{'type':Sequelize[_0x2e4a('0x4')]},'country':{'type':Sequelize[_0x2e4a('0x4')]},'online':{'type':Sequelize[_0x2e4a('0x14')],'defaultValue':![]},'lastLoginAt':{'type':Sequelize[_0x2e4a('0x15')]},'voicePause':{'type':Sequelize[_0x2e4a('0x14')],'defaultValue':![]},'chatPause':{'type':Sequelize[_0x2e4a('0x14')],'defaultValue':![]},'mailPause':{'type':Sequelize[_0x2e4a('0x14')],'defaultValue':![]},'faxPause':{'type':Sequelize[_0x2e4a('0x14')],'defaultValue':![]},'smsPause':{'type':Sequelize[_0x2e4a('0x14')],'defaultValue':![]},'whatsappPause':{'type':Sequelize[_0x2e4a('0x14')],'defaultValue':![]},'openchannelPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'pauseType':{'type':Sequelize[_0x2e4a('0x4')],'defaultValue':_0x2e4a('0x16')},'lastPauseAt':{'type':Sequelize[_0x2e4a('0x15')]},'chatCapacity':{'type':Sequelize[_0x2e4a('0xf')],'defaultValue':0x0},'mailCapacity':{'type':Sequelize[_0x2e4a('0xf')],'defaultValue':0x0},'faxCapacity':{'type':Sequelize[_0x2e4a('0xf')],'defaultValue':0x0},'smsCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'whatsappCapacity':{'type':Sequelize[_0x2e4a('0xf')],'defaultValue':0x0},'openchannelCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'phoneBarAutoAnswer':{'type':Sequelize[_0x2e4a('0x14')],'defaultValue':![]},'phoneBarEnableSettings':{'type':Sequelize[_0x2e4a('0x14')],'defaultValue':!![]},'phoneBarListenPort':{'type':Sequelize['INTEGER'](0x5),'defaultValue':0x1428},'phoneBarExpires':{'type':Sequelize[_0x2e4a('0xf')](0x5),'defaultValue':0x78},'phoneBarRemoteControl':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarRemoteControlPort':{'type':Sequelize['INTEGER'],'defaultValue':0x26a0},'phoneBarEnableRecording':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarRingInUse':{'type':Sequelize[_0x2e4a('0x14')],'defaultValue':![]},'chanspy':{'type':Sequelize[_0x2e4a('0x14')],'defaultValue':![]},'description':{'type':Sequelize[_0x2e4a('0x4')],'allowNull':!![]},'host':{'type':Sequelize[_0x2e4a('0x4')],'allowNull':!![],'defaultValue':_0x2e4a('0x17')},'ipaddr':{'type':Sequelize[_0x2e4a('0x4')],'allowNull':!![]},'port':{'type':Sequelize[_0x2e4a('0xf')](0x5),'allowNull':!![]},'regseconds':{'type':Sequelize[_0x2e4a('0xf')](0xb),'allowNull':!![]},'fullcontact':{'type':Sequelize[_0x2e4a('0x4')],'allowNull':!![]},'regserver':{'type':Sequelize['STRING'],'allowNull':!![]},'useragent':{'type':Sequelize['STRING'],'allowNull':!![]},'lastms':{'type':Sequelize[_0x2e4a('0xf')](0xb),'allowNull':!![]},'type':{'type':Sequelize[_0x2e4a('0x18')](_0x2e4a('0x19'),_0x2e4a('0x1a'),_0x2e4a('0x1b')),'allowNull':!![],'defaultValue':_0x2e4a('0x19')},'context':{'type':Sequelize[_0x2e4a('0x4')],'allowNull':!![],'defaultValue':_0x2e4a('0x1c')},'callingpres':{'type':Sequelize[_0x2e4a('0x18')](_0x2e4a('0x1d'),_0x2e4a('0x1e'),_0x2e4a('0x1f'),_0x2e4a('0x20'),_0x2e4a('0x21'),_0x2e4a('0x22'),_0x2e4a('0x23'),_0x2e4a('0x24')),'allowNull':!![]},'deny':{'type':Sequelize[_0x2e4a('0x4')],'allowNull':!![]},'permit':{'type':Sequelize[_0x2e4a('0x4')],'allowNull':!![]},'secret':{'type':Sequelize[_0x2e4a('0x4')],'allowNull':!![]},'md5secret':{'type':Sequelize[_0x2e4a('0x4')],'allowNull':!![]},'remotesecret':{'type':Sequelize['STRING'],'allowNull':!![]},'transport':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':_0x2e4a('0x25'),'set':function(_0x31ba15){this[_0x2e4a('0x6')](_0x2e4a('0x26'),_0x31ba15?_0x31ba15[_0x2e4a('0x27')](','):null);},'get':function(){return this[_0x2e4a('0x8')](_0x2e4a('0x26'))?this[_0x2e4a('0x8')]('transport')[_0x2e4a('0x28')](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]'},'dtmfmode':{'type':Sequelize[_0x2e4a('0x18')]('rfc2833',_0x2e4a('0x29'),_0x2e4a('0x2a'),_0x2e4a('0x2b'),_0x2e4a('0x2c')),'allowNull':!![],'defaultValue':'rfc2833'},'directmedia':{'type':Sequelize[_0x2e4a('0x18')](_0x2e4a('0x2d'),'no',_0x2e4a('0x2e'),_0x2e4a('0x2f'),_0x2e4a('0x30')),'allowNull':!![],'defaultValue':'no'},'directrtpsetup':{'type':Sequelize['ENUM'](_0x2e4a('0x2d'),'no'),'allowNull':!![],'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0x2e4a('0x4')],'allowNull':!![]},'directmediadeny':{'type':Sequelize[_0x2e4a('0x4')],'allowNull':!![]},'nat':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':_0x2e4a('0x31'),'set':function(_0x3c30e0){this['setDataValue'](_0x2e4a('0x32'),_0x3c30e0?_0x3c30e0['join'](','):null);},'get':function(){return this[_0x2e4a('0x8')]('nat')?this['getDataValue'](_0x2e4a('0x32'))[_0x2e4a('0x28')](','):null;},'comment':_0x2e4a('0x33')},'callgroup':{'type':Sequelize['STRING']},'namedcallgroup':{'type':Sequelize[_0x2e4a('0x4')]},'pickupgroup':{'type':Sequelize[_0x2e4a('0x4')]},'namedpickupgroup':{'type':Sequelize[_0x2e4a('0x4')]},'language':{'type':Sequelize[_0x2e4a('0x4')],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0x2e4a('0x4')]},'disallow':{'type':Sequelize[_0x2e4a('0x4')],'allowNull':![],'defaultValue':_0x2e4a('0x34')},'allow':{'type':Sequelize[_0x2e4a('0x4')],'allowNull':![],'defaultValue':'ulaw;alaw;gsm','set':function(_0xd66e31){this['setDataValue'](_0x2e4a('0x35'),_0xd66e31?_0xd66e31[_0x2e4a('0x27')](';'):_0x2e4a('0x36'));},'get':function(){return this[_0x2e4a('0x8')]('allow')?this[_0x2e4a('0x8')](_0x2e4a('0x35'))[_0x2e4a('0x28')](';'):null;},'comment':_0x2e4a('0x37')},'autoframing':{'type':Sequelize[_0x2e4a('0x18')](_0x2e4a('0x2d'),'no'),'allowNull':!![]},'insecure':{'type':Sequelize[_0x2e4a('0x4')],'allowNull':!![],'set':function(_0x173a20){this[_0x2e4a('0x6')](_0x2e4a('0x38'),_0x173a20?_0x173a20[_0x2e4a('0x27')](','):null);},'get':function(){return this[_0x2e4a('0x8')]('insecure')?this[_0x2e4a('0x8')](_0x2e4a('0x38'))[_0x2e4a('0x28')](','):null;},'comment':_0x2e4a('0x39')},'trustrpid':{'type':Sequelize[_0x2e4a('0x18')](_0x2e4a('0x2d'),'no'),'allowNull':!![],'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0x2e4a('0x18')](_0x2e4a('0x2d'),'no'),'allowNull':!![],'defaultValue':'no'},'progressinband':{'type':Sequelize[_0x2e4a('0x18')]('yes','no',_0x2e4a('0x3a')),'allowNull':!![]},'promiscredir':{'type':Sequelize['ENUM']('yes','no'),'allowNull':!![]},'useclientcode':{'type':Sequelize[_0x2e4a('0x18')](_0x2e4a('0x2d'),'no'),'allowNull':!![]},'accountcode':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'setvar':{'type':Sequelize[_0x2e4a('0x4')],'allowNull':!![]},'callerid':{'type':Sequelize[_0x2e4a('0x4')],'allowNull':!![],'defaultValue':'\x22\x22\x20<>'},'amaflags':{'type':Sequelize[_0x2e4a('0x4')],'allowNull':!![]},'callcounter':{'type':Sequelize[_0x2e4a('0x18')]('yes','no'),'allowNull':!![],'defaultValue':_0x2e4a('0x2d')},'busylevel':{'type':Sequelize[_0x2e4a('0xf')](0xb),'allowNull':!![]},'allowoverlap':{'type':Sequelize[_0x2e4a('0x18')](_0x2e4a('0x2d'),'no'),'allowNull':!![]},'allowsubscribe':{'type':Sequelize['ENUM']('yes','no'),'allowNull':!![]},'allowtransfer':{'type':Sequelize[_0x2e4a('0x18')](_0x2e4a('0x2d'),'no'),'allowNull':!![]},'ignoresdpversion':{'type':Sequelize[_0x2e4a('0x18')]('yes','no'),'allowNull':!![]},'subscribecontext':{'type':Sequelize[_0x2e4a('0x4')],'allowNull':!![]},'template':{'type':Sequelize[_0x2e4a('0x4')],'allowNull':!![]},'videosupport':{'type':Sequelize[_0x2e4a('0x18')]('yes','no','always'),'allowNull':!![],'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0x2e4a('0xf')](0xb),'allowNull':!![]},'rfc2833compensate':{'type':Sequelize[_0x2e4a('0x18')](_0x2e4a('0x2d'),'no'),'allowNull':!![]},'mailbox':{'type':Sequelize[_0x2e4a('0x4')],'allowNull':!![]},'session_timers':{'type':Sequelize[_0x2e4a('0x18')](_0x2e4a('0x3b'),_0x2e4a('0x3c'),_0x2e4a('0x3d')),'allowNull':!![]},'session_expires':{'type':Sequelize[_0x2e4a('0xf')](0xb),'allowNull':!![]},'session_minse':{'type':Sequelize[_0x2e4a('0xf')](0xb),'allowNull':!![]},'session_refresher':{'type':Sequelize[_0x2e4a('0x18')]('uac',_0x2e4a('0x3e')),'allowNull':!![],'defaultValue':_0x2e4a('0x3e')},'t38pt_usertpsource':{'type':Sequelize[_0x2e4a('0x4')],'allowNull':!![]},'regexten':{'type':Sequelize['STRING'],'allowNull':!![]},'fromdomain':{'type':Sequelize[_0x2e4a('0x4')],'allowNull':!![]},'fromuser':{'type':Sequelize[_0x2e4a('0x4')],'allowNull':!![]},'qualify':{'type':Sequelize[_0x2e4a('0x18')](_0x2e4a('0x2d'),'no'),'allowNull':!![],'defaultValue':_0x2e4a('0x2d')},'keepalive':{'type':Sequelize[_0x2e4a('0xf')](0xb),'allowNull':!![]},'defaultip':{'type':Sequelize[_0x2e4a('0x4')],'allowNull':!![]},'defaultuser':{'type':Sequelize[_0x2e4a('0x4')],'allowNull':!![]},'rtptimeout':{'type':Sequelize[_0x2e4a('0xf')](0xb),'allowNull':!![]},'rtpholdtimeout':{'type':Sequelize[_0x2e4a('0xf')](0xb),'allowNull':!![]},'rtpkeepalive':{'type':Sequelize[_0x2e4a('0xf')](0xb),'allowNull':!![]},'sendrpid':{'type':Sequelize[_0x2e4a('0x18')]('yes','no'),'allowNull':!![],'defaultValue':'no'},'outboundproxy':{'type':Sequelize['STRING'],'allowNull':!![]},'callbackextension':{'type':Sequelize['STRING'],'allowNull':!![]},'timert1':{'type':Sequelize[_0x2e4a('0xf')](0xb),'allowNull':!![]},'timerb':{'type':Sequelize[_0x2e4a('0xf')](0xb),'allowNull':!![]},'qualifyfreq':{'type':Sequelize[_0x2e4a('0xf')](0xb),'allowNull':!![]},'contactpermit':{'type':Sequelize['STRING'],'allowNull':!![]},'contactdeny':{'type':Sequelize[_0x2e4a('0x4')],'allowNull':!![]},'contactacl':{'type':Sequelize[_0x2e4a('0x4')],'allowNull':!![]},'unsolicited_mailbox':{'type':Sequelize[_0x2e4a('0x4')],'allowNull':!![]},'use_q850_reason':{'type':Sequelize['STRING'],'allowNull':!![]},'maxforwards':{'type':Sequelize[_0x2e4a('0xf')](0xb),'allowNull':!![]},'encryption':{'type':Sequelize['ENUM'](_0x2e4a('0x2d'),'no'),'allowNull':!![],'defaultValue':'no'},'avpf':{'type':Sequelize['ENUM'](_0x2e4a('0x2d'),'no'),'allowNull':!![]},'force_avp':{'type':Sequelize[_0x2e4a('0x18')](_0x2e4a('0x2d'),'no'),'allowNull':!![]},'icesupport':{'type':Sequelize[_0x2e4a('0x18')](_0x2e4a('0x2d'),'no'),'allowNull':!![]},'dtlsenable':{'type':Sequelize[_0x2e4a('0x18')]('yes','no'),'allowNull':!![]},'dtlsverify':{'type':Sequelize['ENUM'](_0x2e4a('0x2d'),'no',_0x2e4a('0x3f'),_0x2e4a('0x40')),'allowNull':!![]},'dtlsrekey':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'dtlscertfile':{'type':Sequelize[_0x2e4a('0x4')],'allowNull':!![]},'dtlsprivatekey':{'type':Sequelize['STRING'],'allowNull':!![]},'dtlscipher':{'type':Sequelize[_0x2e4a('0x4')],'allowNull':!![]},'dtlscafile':{'type':Sequelize[_0x2e4a('0x4')],'allowNull':!![]},'dtlscapath':{'type':Sequelize[_0x2e4a('0x4')],'allowNull':!![]},'dtlssetup':{'type':Sequelize[_0x2e4a('0x18')](_0x2e4a('0x41'),_0x2e4a('0x42'),_0x2e4a('0x43')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0x2e4a('0x4')],'allowNull':!![]},'usereqphone':{'type':Sequelize[_0x2e4a('0x18')](_0x2e4a('0x2d'),'no'),'allowNull':!![],'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0x2e4a('0x4')],'allowNull':!![]},'recordofffeature':{'type':Sequelize[_0x2e4a('0x4')],'allowNull':!![]},'call_limit':{'type':Sequelize[_0x2e4a('0xf')](0xb),'allowNull':!![],'defaultValue':0xa},'registertrying':{'type':Sequelize[_0x2e4a('0x18')](_0x2e4a('0x2d'),'no'),'allowNull':!![]},'subscribemwi':{'type':Sequelize[_0x2e4a('0x18')](_0x2e4a('0x2d'),'no'),'allowNull':!![]},'vmexten':{'type':Sequelize['STRING'],'allowNull':!![]},'mohinterpret':{'type':Sequelize[_0x2e4a('0x4')],'allowNull':!![]},'mohsuggest':{'type':Sequelize['STRING'],'allowNull':!![]},'parkinglot':{'type':Sequelize['STRING'],'allowNull':!![]},'canreinvite':{'type':Sequelize['ENUM'](_0x2e4a('0x2d'),'no',_0x2e4a('0x2e'),'update','update,nonat'),'allowNull':!![],'defaultValue':'no'},'loginInPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'resetPasswordToken':{'type':Sequelize[_0x2e4a('0x4')]},'resetPasswordExpires':{'type':Sequelize[_0x2e4a('0x15')]},'showWebBar':{'type':Sequelize[_0x2e4a('0xf')],'defaultValue':0x0,'set':function(_0x256c53){this[_0x2e4a('0x6')](_0x2e4a('0x44'),_0x256c53);var _0x1a2829=this[_0x2e4a('0x45')]({'plain':!![]});switch(_0x256c53){case 0x0:case 0x1:var _0x52da4e=_0x1a2829[_0x2e4a('0x26')]?_[_0x2e4a('0x46')](_0x1a2829['transport'])?_0x1a2829[_0x2e4a('0x26')]['join']():_0x1a2829['transport']:_0x2e4a('0x25');if(_0x52da4e==='wss'){_0x52da4e=_0x2e4a('0x25');}this[_0x2e4a('0x6')](_0x2e4a('0x26'),_0x52da4e);this[_0x2e4a('0x6')](_0x2e4a('0x47'),'no');this[_0x2e4a('0x6')](_0x2e4a('0x48'),null);this[_0x2e4a('0x6')](_0x2e4a('0x49'),null);this['setDataValue'](_0x2e4a('0x4a'),null);this[_0x2e4a('0x6')](_0x2e4a('0x4b'),null);this[_0x2e4a('0x6')](_0x2e4a('0x4c'),null);this['setDataValue'](_0x2e4a('0x4d'),null);this[_0x2e4a('0x6')](_0x2e4a('0x4e'),null);this[_0x2e4a('0x6')](_0x2e4a('0x4f'),null);this[_0x2e4a('0x6')](_0x2e4a('0x50'),'no');break;case 0x2:this[_0x2e4a('0x6')](_0x2e4a('0x26'),_0x2e4a('0x51'));this['setDataValue'](_0x2e4a('0x47'),'yes');this[_0x2e4a('0x6')](_0x2e4a('0x48'),_0x2e4a('0x2d'));this[_0x2e4a('0x6')](_0x2e4a('0x49'),_0x2e4a('0x2d'));this[_0x2e4a('0x6')]('icesupport',_0x2e4a('0x2d'));this[_0x2e4a('0x6')](_0x2e4a('0x4b'),_0x2e4a('0x2d'));this[_0x2e4a('0x6')](_0x2e4a('0x4c'),'no');this[_0x2e4a('0x6')]('dtlssetup',_0x2e4a('0x43'));this[_0x2e4a('0x6')](_0x2e4a('0x4e'),_0x1a2829[_0x2e4a('0x4e')]||_0x2e4a('0x52'));this[_0x2e4a('0x6')](_0x2e4a('0x4f'),_0x1a2829[_0x2e4a('0x4f')]||_0x2e4a('0x53'));this['setDataValue']('rtcp_mux','yes');break;default:}}},'permissions':{'type':Sequelize[_0x2e4a('0x54')],'set':function(_0x28b433){this[_0x2e4a('0x6')]('permissions',_0x28b433?_0x28b433[_0x2e4a('0x27')](','):[]);},'get':function(){return this[_0x2e4a('0x8')](_0x2e4a('0x55'))?_['map'](this[_0x2e4a('0x8')](_0x2e4a('0x55'))[_0x2e4a('0x28')](','),function(_0x443a37){return parseInt(_0x443a37,0xa);}):[];}},'phoneBarUnconditionalNumber':{'type':Sequelize[_0x2e4a('0x4')]},'phoneBarNoReplyNumber':{'type':Sequelize[_0x2e4a('0x4')]},'phoneBarBusyNumber':{'type':Sequelize[_0x2e4a('0x4')]},'phoneBarUnconditional':{'type':Sequelize[_0x2e4a('0x14')],'defaultValue':![]},'phoneBarNoReply':{'type':Sequelize[_0x2e4a('0x14')],'defaultValue':![]},'phoneBarBusy':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarDnd':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'phoneBarUnansweredCallBadge':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'phoneBarEnableDtmfTone':{'type':Sequelize[_0x2e4a('0x14')],'defaultValue':![]},'phoneBarAutoAnswerDelay':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'extensionMonitor':{'type':Sequelize[_0x2e4a('0x4')],'defaultValue':''},'crudPermissions':{'type':Sequelize[_0x2e4a('0xf')],'defaultValue':0x0},'rtcp_mux':{'type':Sequelize[_0x2e4a('0x18')](_0x2e4a('0x2d'),'no'),'defaultValue':'no'},'allowmessenger':{'type':Sequelize[_0x2e4a('0x14')],'defaultValue':!![]},'phoneBarOutboundProxy':{'type':Sequelize['STRING']},'passwordResetAt':{'type':Sequelize['DATE'],'defaultValue':null},'phoneBarEnableJaws':{'type':Sequelize[_0x2e4a('0x14')],'defaultValue':![]},'phoneBarEnableScreenRecordingByAgent':{'type':Sequelize[_0x2e4a('0x14')],'defaultValue':![]},'phoneBarEnableVideoRecording':{'type':Sequelize['VIRTUAL'],'get':function(){return this[_0x2e4a('0x8')](_0x2e4a('0x56'))?this[_0x2e4a('0x8')](_0x2e4a('0x56')):![];}},'phoneBarEnableAutomaticScreenRecording':{'type':Sequelize[_0x2e4a('0x14')],'defaultValue':![]},'phoneBarPrefixRequired':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'hotdesk':{'type':Sequelize[_0x2e4a('0x14')],'defaultValue':![]},'interface':{'type':Sequelize[_0x2e4a('0x4')],'defaultValue':null},'privacyEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'apiKeyNonce':{'type':Sequelize['STRING'],'allowNull':!![]},'apiKeyIat':{'type':Sequelize[_0x2e4a('0x4')],'allowNull':!![]},'screenrecording':{'type':Sequelize[_0x2e4a('0x14')],'defaultValue':![],'set':function(_0x340714){if(typeof _0x340714===_0x2e4a('0x57')){var _0x4884f3=_0x340714==='1'?!![]:_0x340714==='0'?![]:_0x340714===_0x2e4a('0x58')?!![]:_0x340714==='false'?![]:![];this[_0x2e4a('0x6')](_0x2e4a('0x59'),_0x4884f3);}else{this['setDataValue'](_0x2e4a('0x59'),_0x340714);}}},'blocked':{'type':Sequelize[_0x2e4a('0x14')],'defaultValue':![],'set':function(_0x3823cb){this['setDataValue'](_0x2e4a('0x5a'),_0x3823cb);if(_0x3823cb===!![]){this[_0x2e4a('0x6')](_0x2e4a('0x5b'),moment());this['setDataValue'](_0x2e4a('0x5c'),0x0);}else{this[_0x2e4a('0x6')](_0x2e4a('0x5b'),null);}}},'blockedAt':{'type':Sequelize['DATE'],'defaultValue':null},'loginAttempts':{'type':Sequelize[_0x2e4a('0xf')],'defaultValue':0x0},'disabled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/user/user.controller.js b/server/api/user/user.controller.js index 2f91f2c..f73277e 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 _0xce34=['$not','$in','$notIn','$notLike','$iLike','$notILike','$like','$overlap','$contains','$contained','$any','firstName','CmContact','Contact','dialActive','getApiKey','retrieveApiKey','token','No\x20API\x20access\x20key\x20found!','You\x20don\x27t\x20have\x20sufficient\x20privileges\x20to\x20access\x20this\x20resource.','createApiKey','generateApiKey','iat','nonce','removeApiKey','apiKeyNonce','apiKeyIat','API\x20key\x20not\x20available','whoami','html-pdf','zip-dir','fast-json-patch','request-promise','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','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./user.socket','jayson/promise','client','http','test','ValidationError','request','then','info','User,\x20%s,\x20%s','request\x20sent','User,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','sendStatus','status','end','json','offset','limit','reject','save','update','destroy','get','user','agent','telephone','filter','value','includes','find','role','stack','name','send','index','map','User','rawAttributes','type','model','differenceBy','salt','keys','query','filters','intersection','attributes','length','hasOwnProperty','nolimit','sort','where','merge','VIRTUAL','sequelize','lower','options','count','includeAll','include','findAll','rows','params','password','fields','bulkCreate','body','describe','addContacts','ids','agent\x20role','admin','../../config/license/util','telephones','users','isNil','count\x20%s:\x20%s','create','internal','Setting','findById','securePassword','min_internal','max','QueryTypes','from','voicemail','mailbox','VoiceMail','fullname','permissions','101','102','113','110','105','106','107','108','109','111','114','Unable\x20to\x20retrieve\x20the\x20current\x20user','Agents','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','oldPassword','newPassword','Sequelize','Invalid\x20body\x20format.\x20Use\x20oldPassord\x20and\x20newPassword','authenticate','Wrong\x20credentials','New\x20password\x20must\x20be\x20different\x20from\x20old\x20password','Invalid\x20body\x20format.\x20Use\x20newPassword','Unauthorized','addQueues','channel','online','loginInPause','voicePause','interface','Unknown\x20channel','add','capitalize','toLowerCase','Queues','penalty','spread','QueueId','emit','Queue:save','voice','VoiceQueue','format','SIP/%s','each','UserVoiceQueueRt','upsert','isValidChannel','remove','Queue:remove','addAvatar','userpic','file','filename','getAvatar','join','root','server/files/images/logos/default_profile.png','download','existsSync','server/files/images/','getContacts','findOne','order','pick','CmList','List','Tag','Tags','color','tag','Queue','Unknown\x20role','getVoiceQueuesRt','getGroups','ChatGroup','getRecordings','VoiceRecording','UserId','getScreenRecordings','ScreenRecording','getChatInteractions','ChatInteraction','getOpenchannelInteractions','getMailInteractions','MailInteraction','getSmsInteractions','getFaxInteractions','FaxInteraction','WhatsappInteraction','login','intrf','user:%s','user:forcelogout','headers','x-forwarded-for','remoteAddress','socket','connection','User\x20not\x20found\x20or\x20not\x20allowed\x20to\x20perform\x20login\x20method','getVoiceQueues','UserVoiceQueue.penalty','MemberReport','forEach','push','all','getChannels','LOGIN','device','PAUSE','LOGININPAUSE','concat','YYYY-MM-DD\x20HH:mm:ss','resolve','pause','QueuePause','updateAttributes','DEFAULT\x20PAUSE','mailPause','chatPause','faxPause','openchannelPause','smsPause','whatsapppause','pauseType','lastPauseAt','unpause','chat','fax','sms','whatsapp','manual','Pause','getTeams','omit','Team','Voice','setDataValue','Chat','getMailQueues','Mail','Sms','getWhatsappQueues','Whatsapp','getFaxQueues','getOpenchannelQueues','Openchannel','flatten','getDataValue','removeTeams','getChatQueues','getSmsQueues','transaction','removeAgent','getLists','You\x20can\x27t\x20delete\x20yourself','addChatInteractions','removeChatInteractions','user_has_chat_interactions:remove','user_has_mail_interactions:save','removeMailInteractions','isArray','user_has_mail_interactions:remove','addFaxInteractions','user_has_fax_interactions:save','removeFaxInteractions','user_has_fax_interactions:remove','addSmsInteractions','removeSmsInteractions','user_has_sms_interactions:remove','addOpenchannelInteractions','user_has_openchannel_interactions:save','removeOpenchannelInteractions','user_has_openchannel_interactions:remove','addWhatsappInteractions','user_has_whatsapp_interactions:save','removeWhatsappInteractions','getVoicePrefixes','FaxAccount','getFaxAccounts','addFaxAccounts','removeFaxAccounts','getMailAccounts','MailAccount','addMailAccounts','removeMailAccounts','getOpenchannelAccounts','OpenchannelAccount','addOpenchannelAccounts','removeOpenchannelAccounts','SmsAccount','getSmsAccounts','addSmsAccounts','removeSmsAccounts','getChatWebsites','addChatWebsites','removeChatWebsites','getWhatsappAccounts','addWhatsappAccounts','removeWhatsappAccounts','getSquareProjects','SquareProject','addSquareProjects','removeSquareProjects','CmHopper','$and','$or','$gt','$gte','$lt','$lte','$eq'];(function(_0x27948b,_0x25c578){var _0x30219c=function(_0x45b23b){while(--_0x45b23b){_0x27948b['push'](_0x27948b['shift']());}};_0x30219c(++_0x25c578);}(_0xce34,0x18f));var _0x4ce3=function(_0xd18292,_0x3f9087){_0xd18292=_0xd18292-0x0;var _0x1fb678=_0xce34[_0xd18292];return _0x1fb678;};'use strict';var pdf=require(_0x4ce3('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x4ce3('0x1'));var jsonpatch=require(_0x4ce3('0x2'));var rp=require(_0x4ce3('0x3'));var moment=require('moment');var BPromise=require(_0x4ce3('0x4'));var Mustache=require(_0x4ce3('0x5'));var util=require(_0x4ce3('0x6'));var path=require(_0x4ce3('0x7'));var sox=require('sox');var csv=require(_0x4ce3('0x8'));var ejs=require(_0x4ce3('0x9'));var fs=require('fs');var _=require(_0x4ce3('0xa'));var squel=require(_0x4ce3('0xb'));var crypto=require(_0x4ce3('0xc'));var jsforce=require(_0x4ce3('0xd'));var deskjs=require(_0x4ce3('0xe'));var toCsv=require('to-csv');var querystring=require(_0x4ce3('0xf'));var Papa=require(_0x4ce3('0x10'));var Redis=require(_0x4ce3('0x11'));var authService=require(_0x4ce3('0x12'));var qs=require(_0x4ce3('0x13'));var as=require(_0x4ce3('0x14'));var hardwareService=require(_0x4ce3('0x15'));var logger=require('../../config/logger')(_0x4ce3('0x16'));var utils=require(_0x4ce3('0x17'));var config=require(_0x4ce3('0x18'));var db=require(_0x4ce3('0x19'))['db'];config[_0x4ce3('0x1a')]=_[_0x4ce3('0x1b')](config[_0x4ce3('0x1a')],{'host':_0x4ce3('0x1c'),'port':0x18eb});var socket=require(_0x4ce3('0x1d'))(new Redis(config[_0x4ce3('0x1a')]));require(_0x4ce3('0x1e'))['register'](socket);var jayson=require(_0x4ce3('0x1f'));var client=jayson[_0x4ce3('0x20')][_0x4ce3('0x21')]({'port':0x232a});function checkPasswordPattern(_0x4fddf2,_0x4409a6,_0x289b14){if(_0x289b14){var _0x2d1427=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x2d1427[_0x4ce3('0x22')](_0x4409a6)){return _0x4fddf2;}else{throw new db['Sequelize'][(_0x4ce3('0x23'))]('The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.');}}else{return _0x4fddf2;}}function respondWithRpcPromise(_0x19b1b3,_0x41983d,_0x8e6aba,_0x278dea){return new BPromise(function(_0x35c277,_0x514017){var _0x475e30=_0x278dea||client;return _0x475e30[_0x4ce3('0x24')](_0x19b1b3,_0x8e6aba)[_0x4ce3('0x25')](function(_0x2214e2){logger[_0x4ce3('0x26')](_0x4ce3('0x27'),_0x41983d,_0x4ce3('0x28'));logger['debug'](_0x4ce3('0x29'),_0x41983d,_0x4ce3('0x28'),JSON[_0x4ce3('0x2a')](_0x2214e2));if(_0x2214e2[_0x4ce3('0x2b')]){if(_0x2214e2[_0x4ce3('0x2b')]['code']===0x1f4){logger[_0x4ce3('0x2b')](_0x4ce3('0x27'),_0x41983d,_0x2214e2['error'][_0x4ce3('0x2c')]);return _0x514017(_0x2214e2['error'][_0x4ce3('0x2c')]);}logger[_0x4ce3('0x2b')]('User,\x20%s,\x20%s',_0x41983d,_0x2214e2['error'][_0x4ce3('0x2c')]);return _0x35c277(_0x2214e2[_0x4ce3('0x2b')][_0x4ce3('0x2c')]);}else{logger['info'](_0x4ce3('0x27'),_0x41983d,_0x4ce3('0x28'));_0x35c277(_0x2214e2[_0x4ce3('0x2d')][_0x4ce3('0x2c')]);}})[_0x4ce3('0x2e')](function(_0x369658){logger[_0x4ce3('0x2b')](_0x4ce3('0x27'),_0x41983d,_0x369658);_0x514017(_0x369658);});});}function respondWithStatusCode(_0x11e5c1,_0x33962b){_0x33962b=_0x33962b||0xcc;return function(_0x43b08d){if(_0x43b08d){return _0x11e5c1[_0x4ce3('0x2f')](_0x33962b);}return _0x11e5c1[_0x4ce3('0x30')](_0x33962b)[_0x4ce3('0x31')]();};}function respondWithResult(_0xa00df6,_0x2bd575){_0x2bd575=_0x2bd575||0xc8;return function(_0x2b16c6){if(_0x2b16c6){return _0xa00df6[_0x4ce3('0x30')](_0x2bd575)[_0x4ce3('0x32')](_0x2b16c6);}};}function respondWithFilteredResult(_0x5e0db8,_0x28490e){return function(_0x5c303b){if(_0x5c303b){var _0xa3d72d=_0x5c303b['count'],_0x20a016=_0x28490e['offset'],_0x3ca14a=_0x28490e[_0x4ce3('0x33')]+_0x28490e[_0x4ce3('0x34')],_0x1c0e94;if(_0x3ca14a>=_0xa3d72d){_0x3ca14a=_0xa3d72d;_0x1c0e94=0xc8;}else{_0x1c0e94=0xce;}_0x5e0db8[_0x4ce3('0x30')](_0x1c0e94);return _0x5e0db8['set']('Content-Range',_0x20a016+'-'+_0x3ca14a+'/'+_0xa3d72d)[_0x4ce3('0x32')](_0x5c303b);}return null;};}function patchUpdates(_0x338061){return function(_0x43203a){try{jsonpatch['apply'](_0x43203a,_0x338061,!![]);}catch(_0x47078a){return BPromise[_0x4ce3('0x35')](_0x47078a);}return _0x43203a[_0x4ce3('0x36')]();};}function saveUpdates(_0x44ef5f,_0x16dcf3){return function(_0x277fb5){if(_0x277fb5){return _0x277fb5[_0x4ce3('0x37')](_0x44ef5f)['then'](function(_0x384721){return _0x384721;});}return null;};}function removeEntity(_0x5ad807,_0x1ea6c9){return function(_0x400bc3){if(_0x400bc3){return _0x400bc3[_0x4ce3('0x38')]()[_0x4ce3('0x25')](function(){var _0xdcff35=_0x400bc3[_0x4ce3('0x39')]({'plain':!![]});var _0x30e5d5=[{'name':'Users','value':_0x4ce3('0x3a'),'ignore':!![]},{'name':'Agents','value':_0x4ce3('0x3b'),'ignore':![]},{'name':'Telephones','value':_0x4ce3('0x3c'),'ignore':![]}];var _0x568b63=_(_0x30e5d5)[_0x4ce3('0x3d')]('ignore')['map'](_0x4ce3('0x3e'))['value']();if(_[_0x4ce3('0x3f')](_0x568b63,_0xdcff35['role'])){return;}var _0x1e806e=_[_0x4ce3('0x40')](_0x30e5d5,['value',_0xdcff35[_0x4ce3('0x41')]])['name'];return db['UserProfileResource'][_0x4ce3('0x38')]({'where':{'type':_0x1e806e,'resourceId':_0xdcff35['id']}})[_0x4ce3('0x25')](function(){return _0x400bc3;});})[_0x4ce3('0x25')](function(){_0x5ad807[_0x4ce3('0x30')](0xcc)['end']();});}};}function handleEntityNotFound(_0x73fae6,_0x23735a){return function(_0x1551d3){if(!_0x1551d3){_0x73fae6[_0x4ce3('0x2f')](0x194);}return _0x1551d3;};}function handleError(_0x1567de,_0x3b8cc3){_0x3b8cc3=_0x3b8cc3||0x1f4;return function(_0x3969f1){logger[_0x4ce3('0x2b')](_0x3969f1[_0x4ce3('0x42')]);if(_0x3969f1[_0x4ce3('0x43')]){delete _0x3969f1['name'];}_0x1567de[_0x4ce3('0x30')](_0x3b8cc3)[_0x4ce3('0x44')](_0x3969f1);};}exports[_0x4ce3('0x45')]=function(_0x5c3370,_0x491ed1){var _0x36fa53={},_0x4f1f7d={},_0x44c61b={'count':0x0,'rows':[]};var _0x3f259a=_[_0x4ce3('0x46')](db[_0x4ce3('0x47')][_0x4ce3('0x48')],function(_0x595971){return{'name':_0x595971['fieldName'],'type':_0x595971[_0x4ce3('0x49')]['key']};});_0x4f1f7d[_0x4ce3('0x4a')]=_[_0x4ce3('0x4b')](_[_0x4ce3('0x46')](_0x3f259a,_0x4ce3('0x43')),['password',_0x4ce3('0x4c')]);_0x4f1f7d['query']=_[_0x4ce3('0x4d')](_0x5c3370[_0x4ce3('0x4e')]);_0x4f1f7d[_0x4ce3('0x4f')]=_[_0x4ce3('0x50')](_0x4f1f7d[_0x4ce3('0x4a')],_0x4f1f7d[_0x4ce3('0x4e')]);_0x36fa53[_0x4ce3('0x51')]=_[_0x4ce3('0x50')](_0x4f1f7d['model'],qs['fields'](_0x5c3370['query']['fields']));_0x36fa53[_0x4ce3('0x51')]=_0x36fa53[_0x4ce3('0x51')][_0x4ce3('0x52')]?_0x36fa53[_0x4ce3('0x51')]:_0x4f1f7d['model'];if(!_0x5c3370['query'][_0x4ce3('0x53')](_0x4ce3('0x54'))){_0x36fa53[_0x4ce3('0x34')]=qs[_0x4ce3('0x34')](_0x5c3370[_0x4ce3('0x4e')][_0x4ce3('0x34')]);_0x36fa53[_0x4ce3('0x33')]=qs[_0x4ce3('0x33')](_0x5c3370[_0x4ce3('0x4e')][_0x4ce3('0x33')]);}_0x36fa53['order']=qs[_0x4ce3('0x55')](_0x5c3370[_0x4ce3('0x4e')]['sort']);_0x36fa53['where']=qs[_0x4ce3('0x4f')](_['pick'](_0x5c3370['query'],_0x4f1f7d[_0x4ce3('0x4f')]),_0x3f259a);if(_0x5c3370['query'][_0x4ce3('0x3d')]){_0x36fa53[_0x4ce3('0x56')]=_[_0x4ce3('0x57')](_0x36fa53[_0x4ce3('0x56')],{'$or':_[_0x4ce3('0x46')](_0x3f259a,function(_0x350630){if(_0x350630[_0x4ce3('0x49')]!==_0x4ce3('0x58')){return db[_0x4ce3('0x59')][_0x4ce3('0x56')](db['sequelize']['fn'](_0x4ce3('0x5a'),db[_0x4ce3('0x59')]['col'](_0x350630[_0x4ce3('0x43')])),{'$like':db[_0x4ce3('0x59')]['fn']('lower','%'+_0x5c3370[_0x4ce3('0x4e')][_0x4ce3('0x3d')]+'%')});}})});}_0x36fa53=_[_0x4ce3('0x57')]({},_0x36fa53,_0x5c3370[_0x4ce3('0x5b')]);var _0x10408e={'where':_0x36fa53[_0x4ce3('0x56')]};return db['User'][_0x4ce3('0x5c')](_0x10408e)[_0x4ce3('0x25')](function(_0x4548c6){_0x44c61b[_0x4ce3('0x5c')]=_0x4548c6;if(_0x5c3370['query'][_0x4ce3('0x5d')]){_0x36fa53[_0x4ce3('0x5e')]=[{'all':!![]}];}return db['User'][_0x4ce3('0x5f')](_0x36fa53);})[_0x4ce3('0x25')](function(_0x2d0094){_0x44c61b[_0x4ce3('0x60')]=_0x2d0094;return _0x44c61b;})[_0x4ce3('0x25')](respondWithFilteredResult(_0x491ed1,_0x36fa53))[_0x4ce3('0x2e')](handleError(_0x491ed1,null));};exports['show']=function(_0x2b7aed,_0x5aa211){var _0xcb7676={'raw':![],'where':{'id':_0x2b7aed[_0x4ce3('0x61')]['id']}},_0x426a8f={};_0x426a8f[_0x4ce3('0x4a')]=_[_0x4ce3('0x4b')](_['keys'](db['User'][_0x4ce3('0x48')]),[_0x4ce3('0x62'),_0x4ce3('0x4c')]);_0x426a8f[_0x4ce3('0x4e')]=_[_0x4ce3('0x4d')](_0x2b7aed['query']);_0x426a8f[_0x4ce3('0x4f')]=_[_0x4ce3('0x50')](_0x426a8f[_0x4ce3('0x4a')],_0x426a8f[_0x4ce3('0x4e')]);_0xcb7676['attributes']=_[_0x4ce3('0x50')](_0x426a8f[_0x4ce3('0x4a')],qs[_0x4ce3('0x63')](_0x2b7aed[_0x4ce3('0x4e')]['fields']));_0xcb7676['attributes']=_0xcb7676[_0x4ce3('0x51')][_0x4ce3('0x52')]?_0xcb7676[_0x4ce3('0x51')]:_0x426a8f['model'];if(_0x2b7aed[_0x4ce3('0x4e')]['includeAll']){_0xcb7676[_0x4ce3('0x5e')]=[{'all':!![]}];}_0xcb7676=_[_0x4ce3('0x57')]({},_0xcb7676,_0x2b7aed['options']);return db[_0x4ce3('0x47')][_0x4ce3('0x40')](_0xcb7676)[_0x4ce3('0x25')](handleEntityNotFound(_0x5aa211,null))[_0x4ce3('0x25')](respondWithResult(_0x5aa211,null))[_0x4ce3('0x2e')](handleError(_0x5aa211,null));};exports['bulkCreate']=function(_0x5bebad,_0x9b4c6a){return db[_0x4ce3('0x47')][_0x4ce3('0x64')](_0x5bebad[_0x4ce3('0x65')],{'raw':![],'individualHooks':!![]})[_0x4ce3('0x25')](respondWithResult(_0x9b4c6a,0xc9))['catch'](handleError(_0x9b4c6a,null));};exports[_0x4ce3('0x37')]=function(_0xed107,_0x143067){if(_0xed107['body']['id']){delete _0xed107[_0x4ce3('0x65')]['id'];}delete _0xed107[_0x4ce3('0x65')]['role'];return db[_0x4ce3('0x47')][_0x4ce3('0x40')]({'where':{'id':_0xed107[_0x4ce3('0x61')]['id']}})[_0x4ce3('0x25')](handleEntityNotFound(_0x143067,null))['then'](saveUpdates(_0xed107['body'],null))['then'](respondWithResult(_0x143067,null))['catch'](handleError(_0x143067,null));};exports[_0x4ce3('0x66')]=function(_0x3722ca,_0xed6b75){return db[_0x4ce3('0x47')][_0x4ce3('0x66')]()[_0x4ce3('0x25')](respondWithResult(_0xed6b75,null))[_0x4ce3('0x2e')](handleError(_0xed6b75,null));};exports[_0x4ce3('0x67')]=function(_0x4d18f9,_0x577484,_0x17cdcd){return db[_0x4ce3('0x47')][_0x4ce3('0x40')]({'where':{'id':_0x4d18f9[_0x4ce3('0x61')]['id']}})['then'](handleEntityNotFound(_0x577484,null))[_0x4ce3('0x25')](function(_0x252152){if(_0x252152){return _0x252152['addContacts'](_0x4d18f9['body'][_0x4ce3('0x68')],_['omit'](_0x4d18f9['body'],[_0x4ce3('0x68'),'id'])||{});}})[_0x4ce3('0x25')](respondWithResult(_0x577484,null))[_0x4ce3('0x2e')](handleError(_0x577484,null));};var getLicense=function(_0x5bf142){return new BPromise(function(_0x5b6c7f,_0x495a01){var _0x160a99=0x0;_0x5bf142['body'][_0x4ce3('0x41')]==='agent'&&_0x5b6c7f(_0x4ce3('0x69'));return db[_0x4ce3('0x47')]['count']({'where':{'$or':[{'role':_0x5bf142[_0x4ce3('0x65')]['role']==='telephone'?_0x4ce3('0x3c'):[_0x4ce3('0x6a'),'user']}]}})[_0x4ce3('0x25')](function(_0x191a6d){_0x160a99=_0x191a6d;return require(_0x4ce3('0x6b'))['getLicense']();})[_0x4ce3('0x25')](function(_0x23b5df){var _0x1c2a54=_0x5bf142['body'][_0x4ce3('0x41')]===_0x4ce3('0x3c')?_0x4ce3('0x6c'):_0x4ce3('0x6d');if(!_[_0x4ce3('0x6e')](_0x23b5df[_0x1c2a54])&&_0x160a99>=_0x23b5df[_0x1c2a54]){return _0x495a01({'message':'License\x20limit\x20reached'});}return _0x5b6c7f(util['format'](_0x4ce3('0x6f'),_0x1c2a54,_0x160a99));})[_0x4ce3('0x2e')](function(_0x4c54ce){return _0x495a01(_0x4c54ce);});});};exports[_0x4ce3('0x70')]=function(_0x5974b2,_0x385978){return getLicense(_0x5974b2)[_0x4ce3('0x25')](function(_0x584c07){if(!_0x5974b2[_0x4ce3('0x65')][_0x4ce3('0x71')]){var _0x445fdb;return db[_0x4ce3('0x72')][_0x4ce3('0x73')](0x1)[_0x4ce3('0x25')](function(_0x2e5473){return checkPasswordPattern(_0x2e5473,_0x5974b2[_0x4ce3('0x65')][_0x4ce3('0x62')],_0x2e5473[_0x4ce3('0x74')]);})['then'](function(_0x302ebe){_0x445fdb=_0x302ebe[_0x4ce3('0x75')];return db[_0x4ce3('0x47')][_0x4ce3('0x76')](_0x4ce3('0x71'));})[_0x4ce3('0x25')](function(_0x3873ff){if(_[_0x4ce3('0x6e')](_0x3873ff)){if(_0x445fdb){_0x5974b2[_0x4ce3('0x65')][_0x4ce3('0x71')]=_0x445fdb;}else{_0x5974b2['body']['internal']=0x1;}}else{if(_[_0x4ce3('0x6e')](_0x445fdb)||_0x445fdb==_0x3873ff){_0x5974b2['body'][_0x4ce3('0x71')]=_0x3873ff+0x1;}else if(_0x445fdb>_0x3873ff){_0x5974b2['body'][_0x4ce3('0x71')]=_0x445fdb;}else{return db[_0x4ce3('0x59')][_0x4ce3('0x4e')]('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[_0x4ce3('0x59')][_0x4ce3('0x77')]['SELECT']})[_0x4ce3('0x25')](function(_0x214b50){if(_0x214b50&&_0x214b50['length']){for(var _0x30f1e1=0x0,_0x5c747a=_0x214b50[_0x4ce3('0x52')];_0x30f1e1<_0x5c747a&&_[_0x4ce3('0x6e')](_0x5974b2[_0x4ce3('0x65')][_0x4ce3('0x71')]);_0x30f1e1++){if(_0x445fdb<=_0x214b50[_0x30f1e1][_0x4ce3('0x78')]){_0x5974b2[_0x4ce3('0x65')][_0x4ce3('0x71')]=_0x214b50[_0x30f1e1][_0x4ce3('0x78')];}else if(_0x445fdb>_0x214b50[_0x30f1e1][_0x4ce3('0x78')]&&_0x445fdb<=_0x214b50[_0x30f1e1]['to']){_0x5974b2[_0x4ce3('0x65')][_0x4ce3('0x71')]=_0x445fdb;}}}if(_['isNil'](_0x5974b2[_0x4ce3('0x65')]['internal'])){_0x5974b2[_0x4ce3('0x65')][_0x4ce3('0x71')]=_0x3873ff+0x1;}});}}});}})[_0x4ce3('0x25')](function(){if(_0x5974b2[_0x4ce3('0x65')][_0x4ce3('0x79')]){_0x5974b2['body'][_0x4ce3('0x7a')]=_0x5974b2['body'][_0x4ce3('0x71')];_0x5974b2[_0x4ce3('0x65')][_0x4ce3('0x7b')]={'mailbox':_0x5974b2[_0x4ce3('0x65')][_0x4ce3('0x71')],'password':_0x5974b2['body'][_0x4ce3('0x62')],'fullname':_0x5974b2[_0x4ce3('0x65')][_0x4ce3('0x7c')],'email':_0x5974b2[_0x4ce3('0x65')]['email']};}if(_0x5974b2[_0x4ce3('0x65')]&&_0x5974b2['body'][_0x4ce3('0x41')]===_0x4ce3('0x3b')){if(!_0x5974b2[_0x4ce3('0x65')][_0x4ce3('0x7d')]){_0x5974b2[_0x4ce3('0x65')][_0x4ce3('0x7d')]=[_0x4ce3('0x7e'),_0x4ce3('0x7f'),'103',_0x4ce3('0x80'),_0x4ce3('0x81'),'104',_0x4ce3('0x82'),_0x4ce3('0x83'),_0x4ce3('0x84'),_0x4ce3('0x85'),_0x4ce3('0x86'),'100',_0x4ce3('0x87'),_0x4ce3('0x88')];}}return db[_0x4ce3('0x47')][_0x4ce3('0x70')](_0x5974b2['body'],{'include':[{'model':db[_0x4ce3('0x7b')],'as':_0x4ce3('0x7b')}]});})[_0x4ce3('0x25')](function(_0x5877a4){if(_0x5974b2[_0x4ce3('0x65')]['role']===_0x4ce3('0x3a'))return _0x5877a4;var _0x4d296f=_0x5974b2[_0x4ce3('0x3a')]['get']({'plain':!![]});if(!_0x4d296f)throw new Error(_0x4ce3('0x89'));if(_0x4d296f[_0x4ce3('0x41')]===_0x4ce3('0x3a')){var _0x39d7ef=_0x5877a4['get']({'plain':!![]});var _0x5626d5=[{'name':_0x4ce3('0x8a'),'value':_0x4ce3('0x3b')},{'name':'Telephones','value':_0x4ce3('0x3c')}];var _0x231199=_['find'](_0x5626d5,[_0x4ce3('0x3e'),_0x39d7ef[_0x4ce3('0x41')]])[_0x4ce3('0x43')];return db[_0x4ce3('0x8b')]['find']({'where':{'name':_0x231199,'userProfileId':_0x4d296f[_0x4ce3('0x8c')]},'raw':!![]})['then'](function(_0x1a35af){if(_0x1a35af&&_0x1a35af[_0x4ce3('0x8d')]===0x0){return db[_0x4ce3('0x8e')][_0x4ce3('0x70')]({'name':_0x39d7ef[_0x4ce3('0x43')],'resourceId':_0x39d7ef['id'],'type':_0x1a35af[_0x4ce3('0x43')],'sectionId':_0x1a35af['id']},{})['then'](function(){return _0x5877a4;});}else{return _0x5877a4;}})[_0x4ce3('0x2e')](function(_0x13178f){logger[_0x4ce3('0x2b')](_0x4ce3('0x8f'),_0x13178f);throw _0x13178f;});}return _0x5877a4;})[_0x4ce3('0x25')](respondWithResult(_0x385978,0xc9))[_0x4ce3('0x2e')](handleError(_0x385978,null));};exports['changePassword']=function(_0x9b39b6,_0x4ade55,_0x3c2efe){var _0x2b61c7=![];if(_0x9b39b6['body']['id']){delete _0x9b39b6[_0x4ce3('0x65')]['id'];}return db[_0x4ce3('0x72')]['findOne']({'attributes':['id',_0x4ce3('0x74')]})[_0x4ce3('0x25')](function(_0x212c79){_0x2b61c7=_0x212c79['securePassword'];return db[_0x4ce3('0x47')][_0x4ce3('0x40')]({'where':{'id':_0x9b39b6['params']['id']}});})['then'](function(_0x1517f4){if(_0x1517f4){if(_0x1517f4['id']==_0x9b39b6[_0x4ce3('0x3a')]['id']){if(!_0x9b39b6[_0x4ce3('0x65')][_0x4ce3('0x90')]||!_0x9b39b6['body'][_0x4ce3('0x91')]){throw new db[(_0x4ce3('0x92'))][(_0x4ce3('0x23'))](_0x4ce3('0x93'));}if(!_0x1517f4[_0x4ce3('0x94')](_0x9b39b6[_0x4ce3('0x65')][_0x4ce3('0x90')])){throw new db[(_0x4ce3('0x92'))][(_0x4ce3('0x23'))](_0x4ce3('0x95'));}if(_0x9b39b6[_0x4ce3('0x65')][_0x4ce3('0x90')]==_0x9b39b6[_0x4ce3('0x65')]['newPassword']){throw new db[(_0x4ce3('0x92'))][(_0x4ce3('0x23'))](_0x4ce3('0x96'));}return _0x1517f4;}else if(_0x9b39b6[_0x4ce3('0x3a')][_0x4ce3('0x41')]==_0x4ce3('0x6a')){if(!_0x9b39b6['body']['newPassword']){throw new db[(_0x4ce3('0x92'))][(_0x4ce3('0x23'))](_0x4ce3('0x97'));}return _0x1517f4;}else if(_0x9b39b6[_0x4ce3('0x3a')][_0x4ce3('0x41')]=='user'){if(!_0x9b39b6[_0x4ce3('0x65')][_0x4ce3('0x91')]){throw new db['Sequelize'][(_0x4ce3('0x23'))](_0x4ce3('0x97'));}if(_0x1517f4[_0x4ce3('0x41')]!=_0x4ce3('0x3b')){throw new db['Sequelize'][(_0x4ce3('0x23'))]('Unauthorized');}return _0x1517f4;}else{throw new db['Sequelize']['ValidationError'](_0x4ce3('0x98'));}}return null;})[_0x4ce3('0x25')](handleEntityNotFound(_0x4ade55,null))[_0x4ce3('0x25')](function(_0x3dc4cc){return checkPasswordPattern(_0x3dc4cc,_0x9b39b6['body']['newPassword'],_0x2b61c7);})[_0x4ce3('0x25')](saveUpdates({'password':_0x9b39b6['body']['newPassword'],'passwordResetAt':_0x9b39b6[_0x4ce3('0x3a')]['id']==_0x9b39b6[_0x4ce3('0x61')]['id']?moment():null},null))[_0x4ce3('0x25')](respondWithResult(_0x4ade55,null))['catch'](handleError(_0x4ade55,null));};exports[_0x4ce3('0x99')]=function(_0x14ebe9,_0x4fd421,_0x59bcd6){var _0x4e086c=_0x14ebe9[_0x4ce3('0x65')][_0x4ce3('0x9a')];return db[_0x4ce3('0x47')][_0x4ce3('0x40')]({'where':{'id':_0x14ebe9[_0x4ce3('0x61')]['id']},'attributes':['id','name',_0x4ce3('0x41'),_0x4ce3('0x9b'),_0x4ce3('0x9c'),_0x4ce3('0x9d'),_0x4ce3('0x9e')]})[_0x4ce3('0x25')](handleEntityNotFound(_0x4fd421,null))[_0x4ce3('0x25')](function(_0x407a81){if(_0x407a81){if(!utils['isValidChannel'](_0x4e086c)){throw new db[(_0x4ce3('0x92'))][(_0x4ce3('0x23'))](_0x4ce3('0x9f'));}return _0x407a81[_0x4ce3('0xa0')+_[_0x4ce3('0xa1')](_0x4e086c[_0x4ce3('0xa2')]())+_0x4ce3('0xa3')](_0x14ebe9[_0x4ce3('0x65')][_0x4ce3('0x68')],{'penalty':_0x14ebe9['body'][_0x4ce3('0xa4')]||0x0})[_0x4ce3('0xa5')](function(_0x48132b){for(var _0x2e7292=0x0;_0x2e7292<_0x14ebe9[_0x4ce3('0x65')]['ids']['length'];_0x2e7292+=0x1){var _0x44277f={'UserId':_0x14ebe9[_0x4ce3('0x61')]['id']};_0x44277f[_['capitalize'](_0x4e086c['toLowerCase']())+_0x4ce3('0xa6')]=_0x14ebe9['body']['ids'][_0x2e7292];socket[_0x4ce3('0xa7')](_0x4ce3('0x3a')+_['capitalize'](_0x4e086c['toLowerCase']())+_0x4ce3('0xa8'),_0x44277f);}return _0x48132b;})[_0x4ce3('0x25')](function(){if(_0x4e086c===_0x4ce3('0xa9')){return db[_0x4ce3('0xaa')][_0x4ce3('0x5f')]({'where':{'id':_0x14ebe9[_0x4ce3('0x65')][_0x4ce3('0x68')]||[]},'raw':!![],'attributes':['id',_0x4ce3('0x43')]});}})['then'](function(_0xeef4b1){var _0x5ed81a=_0x407a81[_0x4ce3('0x39')]({'plain':!![]});var _0x831a04=[];if(_0x4e086c===_0x4ce3('0xa9')&&_0x5ed81a[_0x4ce3('0x41')]===_0x4ce3('0x3b')&&_0x5ed81a['online']){for(var _0x23417d=0x0;_0x23417d<_0xeef4b1['length'];_0x23417d+=0x1){_0x831a04['push']({'membername':_0x5ed81a[_0x4ce3('0x43')],'UserId':_0x5ed81a['id'],'queue_name':_0xeef4b1[_0x23417d][_0x4ce3('0x43')],'VoiceQueueId':_0xeef4b1[_0x23417d]['id'],'interface':_[_0x4ce3('0x6e')](_0x5ed81a[_0x4ce3('0x9e')])?util[_0x4ce3('0xab')](_0x4ce3('0xac'),_0x5ed81a[_0x4ce3('0x43')]):_0x5ed81a[_0x4ce3('0x9e')],'paused':_0x5ed81a[_0x4ce3('0x9d')]||![],'penalty':_0x14ebe9['body'][_0x4ce3('0xa4')]||0x0});}return BPromise[_0x4ce3('0xad')](_0x831a04,function(_0x530911){return db[_0x4ce3('0xae')][_0x4ce3('0xaf')](_0x530911);});}return _0x407a81;});}})[_0x4ce3('0x25')](respondWithStatusCode(_0x4fd421,null))[_0x4ce3('0x2e')](handleError(_0x4fd421,null));};exports['removeQueues']=function(_0x1fc891,_0x135c0f,_0x52b344){var _0x161373;return db[_0x4ce3('0x47')]['find']({'where':{'id':_0x1fc891[_0x4ce3('0x61')]['id']},'attributes':['id',_0x4ce3('0x43'),'role']})[_0x4ce3('0x25')](handleEntityNotFound(_0x135c0f,null))['then'](function(_0x281b2e){if(_0x281b2e){_0x161373=_0x281b2e;if(!_0x1fc891[_0x4ce3('0x4e')][_0x4ce3('0x9a')]||!utils[_0x4ce3('0xb0')](_0x1fc891[_0x4ce3('0x4e')][_0x4ce3('0x9a')])){throw new db['Sequelize'][(_0x4ce3('0x23'))](_0x4ce3('0x9f'));}return _0x281b2e[_0x4ce3('0xb1')+_[_0x4ce3('0xa1')](_0x1fc891[_0x4ce3('0x4e')][_0x4ce3('0x9a')][_0x4ce3('0xa2')]())+_0x4ce3('0xa3')](_0x1fc891['query']['ids']);}})[_0x4ce3('0x25')](function(_0x14d872){for(var _0xf51e0b=0x0;_0xf51e0b<_0x1fc891[_0x4ce3('0x4e')]['ids'][_0x4ce3('0x52')];_0xf51e0b+=0x1){var _0x3f94df={'UserId':_0x1fc891[_0x4ce3('0x61')]['id']};_0x3f94df[_[_0x4ce3('0xa1')](_0x1fc891[_0x4ce3('0x4e')][_0x4ce3('0x9a')]['toLowerCase']())+_0x4ce3('0xa6')]=_0x1fc891[_0x4ce3('0x4e')][_0x4ce3('0x68')][_0xf51e0b];socket['emit'](_0x4ce3('0x3a')+_['capitalize'](_0x1fc891[_0x4ce3('0x4e')]['channel'][_0x4ce3('0xa2')]())+_0x4ce3('0xb2'),_0x3f94df);}return _0x14d872;})[_0x4ce3('0x25')](function(){if(_0x1fc891[_0x4ce3('0x4e')][_0x4ce3('0x9a')]===_0x4ce3('0xa9')){return db[_0x4ce3('0xae')]['destroy']({'where':{'UserId':_0x1fc891['params']['id'],'VoiceQueueId':_0x1fc891[_0x4ce3('0x4e')][_0x4ce3('0x68')]},'individualHooks':!![]})[_0x4ce3('0x25')](function(){return _0x161373;});}return _0x161373;})[_0x4ce3('0x25')](respondWithStatusCode(_0x135c0f,null))[_0x4ce3('0x2e')](handleError(_0x135c0f,null));};exports[_0x4ce3('0xb3')]=function(_0x14c428,_0xa0e904,_0x1859a5){_0x14c428[_0x4ce3('0x65')][_0x4ce3('0xb4')]=_0x14c428[_0x4ce3('0xb5')][_0x4ce3('0xb6')];return db[_0x4ce3('0x47')][_0x4ce3('0x40')]({'where':{'id':_0x14c428[_0x4ce3('0x61')]['id']}})[_0x4ce3('0x25')](handleEntityNotFound(_0xa0e904,null))[_0x4ce3('0x25')](saveUpdates(_0x14c428[_0x4ce3('0x65')],null))[_0x4ce3('0x25')](respondWithResult(_0xa0e904,null))[_0x4ce3('0x2e')](handleError(_0xa0e904,null));};exports[_0x4ce3('0xb7')]=function(_0x4381f1,_0x5dba93,_0xb283c4){var _0x3c5b6c=path[_0x4ce3('0xb8')](config[_0x4ce3('0xb9')],_0x4ce3('0xba'));return db[_0x4ce3('0x47')][_0x4ce3('0x40')]({'where':{'id':_0x4381f1[_0x4ce3('0x61')]['id']},'attributes':['id',_0x4ce3('0xb4')],'raw':!![]})[_0x4ce3('0x25')](handleEntityNotFound(_0x5dba93,null))[_0x4ce3('0x25')](function(_0x3f223a){if(_0x3f223a){if(_['isNil'](_0x3f223a[_0x4ce3('0xb4')])){return _0x5dba93[_0x4ce3('0xbb')](_0x3c5b6c);}else{if(!fs[_0x4ce3('0xbc')](path[_0x4ce3('0xb8')](config[_0x4ce3('0xb9')],_0x4ce3('0xbd'),_0x3f223a[_0x4ce3('0xb4')]))){return _0x5dba93[_0x4ce3('0xbb')](_0x3c5b6c);}return _0x5dba93[_0x4ce3('0xbb')](path[_0x4ce3('0xb8')](config[_0x4ce3('0xb9')],_0x4ce3('0xbd'),_0x3f223a[_0x4ce3('0xb4')]));}}})[_0x4ce3('0x2e')](handleError(_0x5dba93,null));};exports[_0x4ce3('0xbe')]=function(_0x3c6684,_0x434853,_0x1a190f){var _0x556bda={};var _0x295ed2={};var _0x4694ec;var _0x382f85;return db[_0x4ce3('0x47')][_0x4ce3('0xbf')]({'where':{'id':_0x3c6684[_0x4ce3('0x61')]['id']}})['then'](handleEntityNotFound(_0x434853,null))[_0x4ce3('0x25')](function(_0xa0e764){if(_0xa0e764){_0x4694ec=_0xa0e764;_0x295ed2[_0x4ce3('0x4a')]=_['keys'](db['CmContact'][_0x4ce3('0x48')]);_0x295ed2[_0x4ce3('0x4e')]=_[_0x4ce3('0x4d')](_0x3c6684['query']);_0x295ed2[_0x4ce3('0x4f')]=_['intersection'](_0x295ed2[_0x4ce3('0x4a')],_0x295ed2[_0x4ce3('0x4e')]);_0x556bda[_0x4ce3('0x51')]=_[_0x4ce3('0x50')](_0x295ed2[_0x4ce3('0x4a')],qs[_0x4ce3('0x63')](_0x3c6684[_0x4ce3('0x4e')][_0x4ce3('0x63')]));_0x556bda[_0x4ce3('0x51')]=_0x556bda[_0x4ce3('0x51')][_0x4ce3('0x52')]?_0x556bda[_0x4ce3('0x51')]:_0x295ed2['model'];_0x556bda[_0x4ce3('0xc0')]=qs[_0x4ce3('0x55')](_0x3c6684['query']['sort']);_0x556bda['where']=qs[_0x4ce3('0x4f')](_[_0x4ce3('0xc1')](_0x3c6684[_0x4ce3('0x4e')],_0x295ed2[_0x4ce3('0x4f')]));if(_0x3c6684[_0x4ce3('0x4e')][_0x4ce3('0x3d')]){_0x556bda['where']=_[_0x4ce3('0x57')](_0x556bda[_0x4ce3('0x56')],{'$or':_['map'](_0x556bda[_0x4ce3('0x51')],function(_0x3c00aa){var _0x54f446={};_0x54f446[_0x3c00aa]={'$like':'%'+_0x3c6684[_0x4ce3('0x4e')]['filter']+'%'};return _0x54f446;})});}_0x556bda=_[_0x4ce3('0x57')]({},_0x556bda,_0x3c6684[_0x4ce3('0x5b')]);return _0x4694ec[_0x4ce3('0xbe')](_0x556bda);}})[_0x4ce3('0x25')](function(_0x14aa3c){if(_0x14aa3c){_0x382f85=_0x14aa3c[_0x4ce3('0x52')];if(_0x3c6684[_0x4ce3('0x4e')][_0x4ce3('0x53')]('includeAll')){_0x556bda[_0x4ce3('0x5e')]=[{'model':db[_0x4ce3('0xc2')],'as':_0x4ce3('0xc3'),'required':![]},{'model':db[_0x4ce3('0xc4')],'as':_0x4ce3('0xc5'),'attributes':['id',_0x4ce3('0x43'),_0x4ce3('0xc6')],'where':_0x3c6684[_0x4ce3('0x4e')]['tag']?{'id':_0x3c6684['query'][_0x4ce3('0xc7')]}:undefined,'required':_0x3c6684[_0x4ce3('0x4e')][_0x4ce3('0xc7')]?!![]:![]}];}if(!_0x3c6684[_0x4ce3('0x4e')][_0x4ce3('0x53')](_0x4ce3('0x54'))){_0x556bda['limit']=qs[_0x4ce3('0x34')](_0x3c6684[_0x4ce3('0x4e')][_0x4ce3('0x34')]);_0x556bda[_0x4ce3('0x33')]=qs[_0x4ce3('0x33')](_0x3c6684['query'][_0x4ce3('0x33')]);}return _0x4694ec[_0x4ce3('0xbe')](_0x556bda);}})['then'](function(_0x10ccb1){if(_0x10ccb1){return _0x10ccb1?{'count':_0x382f85,'rows':_0x10ccb1}:null;}})[_0x4ce3('0x25')](respondWithResult(_0x434853,null))[_0x4ce3('0x2e')](handleError(_0x434853,null));};exports['getQueues']=function(_0x48903c,_0x5af803,_0x253837){var _0x4e0f5b;var _0x87b777;var _0x5743c6={};var _0x6e10b2;return db['User'][_0x4ce3('0xbf')]({'where':{'id':_0x48903c[_0x4ce3('0x61')]['id']},'attributes':['id',_0x4ce3('0x43'),_0x4ce3('0x41')]})['then'](handleEntityNotFound(_0x5af803,null))['then'](function(_0x34b33b){if(!utils[_0x4ce3('0xb0')](_0x48903c['query'][_0x4ce3('0x9a')])){throw new db[(_0x4ce3('0x92'))][(_0x4ce3('0x23'))](_0x4ce3('0x9f'));}_0x4e0f5b=_0x34b33b;var _0x65fc4b={};_0x65fc4b[_0x4ce3('0x4a')]=_[_0x4ce3('0x4d')](db[_[_0x4ce3('0xa1')](_0x48903c[_0x4ce3('0x4e')][_0x4ce3('0x9a')])+'Queue'][_0x4ce3('0x48')]);_0x65fc4b[_0x4ce3('0x4e')]=_['keys'](_0x48903c['query']);_0x65fc4b['filters']=_[_0x4ce3('0x50')](_0x65fc4b[_0x4ce3('0x4a')],_0x65fc4b[_0x4ce3('0x4e')]);_0x5743c6[_0x4ce3('0x51')]=_[_0x4ce3('0x50')](_0x65fc4b['model'],qs[_0x4ce3('0x63')](_0x48903c[_0x4ce3('0x4e')][_0x4ce3('0x63')]));_0x5743c6[_0x4ce3('0x51')]=_0x5743c6[_0x4ce3('0x51')][_0x4ce3('0x52')]?_0x5743c6[_0x4ce3('0x51')]:_0x65fc4b['model'];_0x5743c6[_0x4ce3('0xc0')]=qs[_0x4ce3('0x55')](_0x48903c[_0x4ce3('0x4e')][_0x4ce3('0x55')]);_0x5743c6[_0x4ce3('0x56')]=qs['filters'](_[_0x4ce3('0xc1')](_0x48903c[_0x4ce3('0x4e')],_0x65fc4b[_0x4ce3('0x4f')]));if(_0x48903c[_0x4ce3('0x4e')][_0x4ce3('0x3d')]){_0x5743c6['where']=_[_0x4ce3('0x57')](_0x5743c6[_0x4ce3('0x56')],{'$or':_[_0x4ce3('0x46')](_0x5743c6[_0x4ce3('0x51')],function(_0x443f93){var _0x5150ca={};_0x5150ca[_0x443f93]={'$like':'%'+_0x48903c[_0x4ce3('0x4e')][_0x4ce3('0x3d')]+'%'};return _0x5150ca;})});}_0x5743c6=_['merge']({},_0x5743c6,_0x48903c[_0x4ce3('0x5b')]);switch(_0x4e0f5b[_0x4ce3('0x41')]){case _0x4ce3('0x6a'):return db[_[_0x4ce3('0xa1')](_0x48903c[_0x4ce3('0x4e')][_0x4ce3('0x9a')])+_0x4ce3('0xc8')]['findAll'](_0x5743c6);case _0x4ce3('0x3a'):case _0x4ce3('0x3b'):return _0x4e0f5b[_0x4ce3('0x39')+_[_0x4ce3('0xa1')](_0x48903c[_0x4ce3('0x4e')][_0x4ce3('0x9a')])+_0x4ce3('0xa3')](_0x5743c6);default:throw new db[(_0x4ce3('0x92'))][(_0x4ce3('0x23'))](_0x4ce3('0xc9'));}})[_0x4ce3('0x25')](function(_0x365311){_0x6e10b2=_0x365311[_0x4ce3('0x52')];if(!_0x48903c[_0x4ce3('0x4e')][_0x4ce3('0x53')](_0x4ce3('0x54'))){_0x5743c6[_0x4ce3('0x34')]=qs[_0x4ce3('0x34')](_0x48903c['query'][_0x4ce3('0x34')]);_0x5743c6[_0x4ce3('0x33')]=qs[_0x4ce3('0x33')](_0x48903c['query'][_0x4ce3('0x33')]);}switch(_0x4e0f5b[_0x4ce3('0x41')]){case _0x4ce3('0x6a'):return db[_['capitalize'](_0x48903c['query'][_0x4ce3('0x9a')])+_0x4ce3('0xc8')][_0x4ce3('0x5f')](_0x5743c6);case _0x4ce3('0x3a'):case _0x4ce3('0x3b'):return _0x4e0f5b[_0x4ce3('0x39')+_[_0x4ce3('0xa1')](_0x48903c[_0x4ce3('0x4e')]['channel'])+_0x4ce3('0xa3')](_0x5743c6);}})[_0x4ce3('0x25')](function(_0xc0eb12){return{'count':_0x6e10b2,'rows':_0xc0eb12};})[_0x4ce3('0x25')](respondWithResult(_0x5af803,null))[_0x4ce3('0x2e')](handleError(_0x5af803,null));};exports['getVoiceQueuesRt']=function(_0x49086d,_0x272c12,_0x52058a){var _0x350bf2={};var _0x1ca044={};var _0x2ec934;var _0x3d2056;return db['User'][_0x4ce3('0xbf')]({'where':{'id':_0x49086d[_0x4ce3('0x61')]['id']}})[_0x4ce3('0x25')](handleEntityNotFound(_0x272c12,null))[_0x4ce3('0x25')](function(_0x3b3d67){if(_0x3b3d67){_0x2ec934=_0x3b3d67;_0x1ca044['model']=_['keys'](db[_0x4ce3('0xae')][_0x4ce3('0x48')]);_0x1ca044[_0x4ce3('0x4e')]=_['keys'](_0x49086d[_0x4ce3('0x4e')]);_0x1ca044[_0x4ce3('0x4f')]=_[_0x4ce3('0x50')](_0x1ca044[_0x4ce3('0x4a')],_0x1ca044['query']);_0x350bf2[_0x4ce3('0x51')]=_[_0x4ce3('0x50')](_0x1ca044[_0x4ce3('0x4a')],qs[_0x4ce3('0x63')](_0x49086d['query'][_0x4ce3('0x63')]));_0x350bf2[_0x4ce3('0x51')]=_0x350bf2['attributes'][_0x4ce3('0x52')]?_0x350bf2[_0x4ce3('0x51')]:_0x1ca044[_0x4ce3('0x4a')];_0x350bf2['order']=qs['sort'](_0x49086d[_0x4ce3('0x4e')][_0x4ce3('0x55')]);_0x350bf2['where']=qs['filters'](_[_0x4ce3('0xc1')](_0x49086d[_0x4ce3('0x4e')],_0x1ca044['filters']));if(_0x49086d[_0x4ce3('0x4e')][_0x4ce3('0x3d')]){_0x350bf2[_0x4ce3('0x56')]=_['merge'](_0x350bf2[_0x4ce3('0x56')],{'$or':_[_0x4ce3('0x46')](_0x350bf2[_0x4ce3('0x51')],function(_0x350f8c){var _0x140009={};_0x140009[_0x350f8c]={'$like':'%'+_0x49086d[_0x4ce3('0x4e')][_0x4ce3('0x3d')]+'%'};return _0x140009;})});}_0x350bf2=_[_0x4ce3('0x57')]({},_0x350bf2,_0x49086d[_0x4ce3('0x5b')]);return _0x2ec934[_0x4ce3('0xca')](_0x350bf2);}})[_0x4ce3('0x25')](function(_0x1b8fcd){if(_0x1b8fcd){_0x3d2056=_0x1b8fcd[_0x4ce3('0x52')];if(!_0x49086d['query']['hasOwnProperty']('nolimit')){_0x350bf2['limit']=qs[_0x4ce3('0x34')](_0x49086d['query']['limit']);_0x350bf2[_0x4ce3('0x33')]=qs[_0x4ce3('0x33')](_0x49086d[_0x4ce3('0x4e')][_0x4ce3('0x33')]);}return _0x2ec934[_0x4ce3('0xca')](_0x350bf2);}})[_0x4ce3('0x25')](function(_0x382dfc){if(_0x382dfc){return _0x382dfc?{'count':_0x3d2056,'rows':_0x382dfc}:null;}})[_0x4ce3('0x25')](respondWithResult(_0x272c12,null))[_0x4ce3('0x2e')](handleError(_0x272c12,null));};exports[_0x4ce3('0xcb')]=function(_0x3b84e9,_0x3bd209,_0x5d5310){var _0x4fc6b9={};var _0x198b25={};var _0x29b4c4;var _0x36ca8c;return db[_0x4ce3('0x47')][_0x4ce3('0xbf')]({'where':{'id':_0x3b84e9[_0x4ce3('0x61')]['id']}})[_0x4ce3('0x25')](handleEntityNotFound(_0x3bd209,null))['then'](function(_0xe991b4){if(_0xe991b4){_0x29b4c4=_0xe991b4;_0x198b25[_0x4ce3('0x4a')]=_[_0x4ce3('0x4d')](db[_0x4ce3('0xcc')][_0x4ce3('0x48')]);_0x198b25['query']=_['keys'](_0x3b84e9[_0x4ce3('0x4e')]);_0x198b25[_0x4ce3('0x4f')]=_[_0x4ce3('0x50')](_0x198b25['model'],_0x198b25[_0x4ce3('0x4e')]);_0x4fc6b9[_0x4ce3('0x51')]=_[_0x4ce3('0x50')](_0x198b25[_0x4ce3('0x4a')],qs[_0x4ce3('0x63')](_0x3b84e9[_0x4ce3('0x4e')][_0x4ce3('0x63')]));_0x4fc6b9[_0x4ce3('0x51')]=_0x4fc6b9['attributes']['length']?_0x4fc6b9[_0x4ce3('0x51')]:_0x198b25[_0x4ce3('0x4a')];_0x4fc6b9[_0x4ce3('0xc0')]=qs[_0x4ce3('0x55')](_0x3b84e9[_0x4ce3('0x4e')]['sort']);_0x4fc6b9[_0x4ce3('0x56')]=qs[_0x4ce3('0x4f')](_[_0x4ce3('0xc1')](_0x3b84e9[_0x4ce3('0x4e')],_0x198b25[_0x4ce3('0x4f')]));if(_0x3b84e9['query'][_0x4ce3('0x3d')]){_0x4fc6b9[_0x4ce3('0x56')]=_[_0x4ce3('0x57')](_0x4fc6b9[_0x4ce3('0x56')],{'$or':_['map'](_0x4fc6b9['attributes'],function(_0x5cf374){var _0x1fc4fa={};_0x1fc4fa[_0x5cf374]={'$like':'%'+_0x3b84e9[_0x4ce3('0x4e')][_0x4ce3('0x3d')]+'%'};return _0x1fc4fa;})});}_0x4fc6b9=_[_0x4ce3('0x57')]({},_0x4fc6b9,_0x3b84e9[_0x4ce3('0x5b')]);return _0x29b4c4[_0x4ce3('0xcb')](_0x4fc6b9);}})[_0x4ce3('0x25')](function(_0x4d711f){if(_0x4d711f){_0x36ca8c=_0x4d711f['length'];if(!_0x3b84e9['query'][_0x4ce3('0x53')](_0x4ce3('0x54'))){_0x4fc6b9[_0x4ce3('0x34')]=qs[_0x4ce3('0x34')](_0x3b84e9[_0x4ce3('0x4e')][_0x4ce3('0x34')]);_0x4fc6b9[_0x4ce3('0x33')]=qs[_0x4ce3('0x33')](_0x3b84e9[_0x4ce3('0x4e')][_0x4ce3('0x33')]);}return _0x29b4c4['getGroups'](_0x4fc6b9);}})['then'](function(_0x4b7232){if(_0x4b7232){return _0x4b7232?{'count':_0x36ca8c,'rows':_0x4b7232}:null;}})[_0x4ce3('0x25')](respondWithResult(_0x3bd209,null))[_0x4ce3('0x2e')](handleError(_0x3bd209,null));};exports[_0x4ce3('0xcd')]=function(_0x32dad1,_0x59b1ca,_0x36d97e){var _0x380e25={'raw':!![],'where':{}};var _0xf7740b={};var _0x2a7be4={'count':0x0,'rows':[]};return db[_0x4ce3('0x47')][_0x4ce3('0xbf')]({'where':{'id':_0x32dad1['params']['id']}})[_0x4ce3('0x25')](handleEntityNotFound(_0x59b1ca,null))[_0x4ce3('0x25')](function(_0x168e1e){if(_0x168e1e){_0xf7740b['model']=_[_0x4ce3('0x4d')](db[_0x4ce3('0xce')][_0x4ce3('0x48')]);_0xf7740b[_0x4ce3('0x4e')]=_[_0x4ce3('0x4d')](_0x32dad1[_0x4ce3('0x4e')]);_0xf7740b['filters']=_[_0x4ce3('0x50')](_0xf7740b['model'],_0xf7740b[_0x4ce3('0x4e')]);_0x380e25['attributes']=_['intersection'](_0xf7740b[_0x4ce3('0x4a')],qs[_0x4ce3('0x63')](_0x32dad1['query'][_0x4ce3('0x63')]));_0x380e25['attributes']=_0x380e25[_0x4ce3('0x51')][_0x4ce3('0x52')]?_0x380e25[_0x4ce3('0x51')]:_0xf7740b[_0x4ce3('0x4a')];if(!_0x32dad1[_0x4ce3('0x4e')]['hasOwnProperty'](_0x4ce3('0x54'))){_0x380e25[_0x4ce3('0x34')]=qs[_0x4ce3('0x34')](_0x32dad1[_0x4ce3('0x4e')][_0x4ce3('0x34')]);_0x380e25[_0x4ce3('0x33')]=qs['offset'](_0x32dad1['query']['offset']);}_0x380e25['order']=qs[_0x4ce3('0x55')](_0x32dad1[_0x4ce3('0x4e')][_0x4ce3('0x55')]);_0x380e25[_0x4ce3('0x56')]=qs[_0x4ce3('0x4f')](_[_0x4ce3('0xc1')](_0x32dad1[_0x4ce3('0x4e')],_0xf7740b[_0x4ce3('0x4f')]));_0x380e25['where'][_0x4ce3('0xcf')]=_0x168e1e['id'];if(_0x32dad1['query'][_0x4ce3('0x3d')]){_0x380e25[_0x4ce3('0x56')]=_['merge'](_0x380e25[_0x4ce3('0x56')],{'$or':_[_0x4ce3('0x46')](_0x380e25['attributes'],function(_0x211fe0){var _0x7e8a07={};_0x7e8a07[_0x211fe0]={'$like':'%'+_0x32dad1[_0x4ce3('0x4e')][_0x4ce3('0x3d')]+'%'};return _0x7e8a07;})});}_0x380e25=_[_0x4ce3('0x57')]({},_0x380e25,_0x32dad1[_0x4ce3('0x5b')]);return db[_0x4ce3('0xce')][_0x4ce3('0x5c')]({'where':_0x380e25[_0x4ce3('0x56')]})[_0x4ce3('0x25')](function(_0x36ebd2){_0x2a7be4['count']=_0x36ebd2;if(_0x32dad1[_0x4ce3('0x4e')][_0x4ce3('0x5d')]){_0x380e25['include']=[{'all':!![]}];}return db[_0x4ce3('0xce')][_0x4ce3('0x5f')](_0x380e25);})['then'](function(_0x17b35c){_0x2a7be4[_0x4ce3('0x60')]=_0x17b35c;return _0x2a7be4;});}})['then'](respondWithFilteredResult(_0x59b1ca,_0x380e25))[_0x4ce3('0x2e')](handleError(_0x59b1ca,null));};exports[_0x4ce3('0xd0')]=function(_0x2df314,_0x4cedb1,_0x2d467e){var _0xc9cad3={'raw':!![],'where':{}};var _0x4a471a={};var _0xed486b={'count':0x0,'rows':[]};return db[_0x4ce3('0x47')][_0x4ce3('0xbf')]({'where':{'id':_0x2df314[_0x4ce3('0x61')]['id']}})[_0x4ce3('0x25')](handleEntityNotFound(_0x4cedb1,null))[_0x4ce3('0x25')](function(_0x3762b8){if(_0x3762b8){_0x4a471a['model']=_[_0x4ce3('0x4d')](db['ScreenRecording'][_0x4ce3('0x48')]);_0x4a471a[_0x4ce3('0x4e')]=_[_0x4ce3('0x4d')](_0x2df314[_0x4ce3('0x4e')]);_0x4a471a[_0x4ce3('0x4f')]=_['intersection'](_0x4a471a['model'],_0x4a471a[_0x4ce3('0x4e')]);_0xc9cad3[_0x4ce3('0x51')]=_['intersection'](_0x4a471a[_0x4ce3('0x4a')],qs[_0x4ce3('0x63')](_0x2df314[_0x4ce3('0x4e')]['fields']));_0xc9cad3['attributes']=_0xc9cad3['attributes'][_0x4ce3('0x52')]?_0xc9cad3['attributes']:_0x4a471a['model'];if(!_0x2df314[_0x4ce3('0x4e')][_0x4ce3('0x53')](_0x4ce3('0x54'))){_0xc9cad3[_0x4ce3('0x34')]=qs['limit'](_0x2df314[_0x4ce3('0x4e')][_0x4ce3('0x34')]);_0xc9cad3[_0x4ce3('0x33')]=qs[_0x4ce3('0x33')](_0x2df314[_0x4ce3('0x4e')][_0x4ce3('0x33')]);}_0xc9cad3['order']=qs['sort'](_0x2df314[_0x4ce3('0x4e')][_0x4ce3('0x55')]);_0xc9cad3['where']=qs[_0x4ce3('0x4f')](_[_0x4ce3('0xc1')](_0x2df314[_0x4ce3('0x4e')],_0x4a471a[_0x4ce3('0x4f')]));_0xc9cad3[_0x4ce3('0x56')][_0x4ce3('0xcf')]=_0x3762b8['id'];if(_0x2df314[_0x4ce3('0x4e')]['filter']){_0xc9cad3[_0x4ce3('0x56')]=_[_0x4ce3('0x57')](_0xc9cad3[_0x4ce3('0x56')],{'$or':_[_0x4ce3('0x46')](_0xc9cad3[_0x4ce3('0x51')],function(_0x24f03a){var _0x52a1e3={};_0x52a1e3[_0x24f03a]={'$like':'%'+_0x2df314['query']['filter']+'%'};return _0x52a1e3;})});}_0xc9cad3=_['merge']({},_0xc9cad3,_0x2df314[_0x4ce3('0x5b')]);return db[_0x4ce3('0xd1')][_0x4ce3('0x5c')]({'where':_0xc9cad3[_0x4ce3('0x56')]})['then'](function(_0x38bf48){_0xed486b[_0x4ce3('0x5c')]=_0x38bf48;if(_0x2df314[_0x4ce3('0x4e')][_0x4ce3('0x5d')]){_0xc9cad3[_0x4ce3('0x5e')]=[{'all':!![]}];}return db[_0x4ce3('0xd1')][_0x4ce3('0x5f')](_0xc9cad3);})[_0x4ce3('0x25')](function(_0x148827){_0xed486b['rows']=_0x148827;return _0xed486b;});}})[_0x4ce3('0x25')](respondWithFilteredResult(_0x4cedb1,_0xc9cad3))[_0x4ce3('0x2e')](handleError(_0x4cedb1,null));};exports[_0x4ce3('0xd2')]=function(_0x511252,_0xdddc32,_0x2fc23c){var _0x241ea3={};var _0x30112c={};var _0x49374d;var _0x1cf5fa;return db['User'][_0x4ce3('0xbf')]({'where':{'id':_0x511252[_0x4ce3('0x61')]['id']}})[_0x4ce3('0x25')](handleEntityNotFound(_0xdddc32,null))[_0x4ce3('0x25')](function(_0x821e2){if(_0x821e2){_0x49374d=_0x821e2;_0x30112c[_0x4ce3('0x4a')]=_[_0x4ce3('0x4d')](db[_0x4ce3('0xd3')][_0x4ce3('0x48')]);_0x30112c[_0x4ce3('0x4e')]=_[_0x4ce3('0x4d')](_0x511252[_0x4ce3('0x4e')]);_0x30112c[_0x4ce3('0x4f')]=_[_0x4ce3('0x50')](_0x30112c[_0x4ce3('0x4a')],_0x30112c[_0x4ce3('0x4e')]);_0x241ea3[_0x4ce3('0x51')]=_[_0x4ce3('0x50')](_0x30112c[_0x4ce3('0x4a')],qs['fields'](_0x511252[_0x4ce3('0x4e')][_0x4ce3('0x63')]));_0x241ea3[_0x4ce3('0x51')]=_0x241ea3[_0x4ce3('0x51')][_0x4ce3('0x52')]?_0x241ea3[_0x4ce3('0x51')]:_0x30112c['model'];_0x241ea3[_0x4ce3('0xc0')]=qs['sort'](_0x511252[_0x4ce3('0x4e')][_0x4ce3('0x55')]);_0x241ea3[_0x4ce3('0x56')]=qs[_0x4ce3('0x4f')](_[_0x4ce3('0xc1')](_0x511252[_0x4ce3('0x4e')],_0x30112c[_0x4ce3('0x4f')]));if(_0x511252[_0x4ce3('0x4e')][_0x4ce3('0x3d')]){_0x241ea3['where']=_['merge'](_0x241ea3['where'],{'$or':_[_0x4ce3('0x46')](_0x241ea3[_0x4ce3('0x51')],function(_0x22c091){var _0x23cae6={};_0x23cae6[_0x22c091]={'$like':'%'+_0x511252[_0x4ce3('0x4e')]['filter']+'%'};return _0x23cae6;})});}_0x241ea3=_[_0x4ce3('0x57')]({},_0x241ea3,_0x511252['options']);return _0x49374d[_0x4ce3('0xd2')](_0x241ea3);}})[_0x4ce3('0x25')](function(_0x11fc86){if(_0x11fc86){_0x1cf5fa=_0x11fc86[_0x4ce3('0x52')];if(!_0x511252[_0x4ce3('0x4e')]['hasOwnProperty']('nolimit')){_0x241ea3[_0x4ce3('0x34')]=qs[_0x4ce3('0x34')](_0x511252['query']['limit']);_0x241ea3[_0x4ce3('0x33')]=qs[_0x4ce3('0x33')](_0x511252[_0x4ce3('0x4e')][_0x4ce3('0x33')]);}return _0x49374d[_0x4ce3('0xd2')](_0x241ea3);}})[_0x4ce3('0x25')](function(_0x121c8e){if(_0x121c8e){return _0x121c8e?{'count':_0x1cf5fa,'rows':_0x121c8e}:null;}})[_0x4ce3('0x25')](respondWithResult(_0xdddc32,null))[_0x4ce3('0x2e')](handleError(_0xdddc32,null));};exports[_0x4ce3('0xd4')]=function(_0x49ada8,_0x9c7533,_0x56297d){var _0xf9b842={};var _0x2498b6={};var _0x3896c3;var _0x292437;return db[_0x4ce3('0x47')][_0x4ce3('0xbf')]({'where':{'id':_0x49ada8[_0x4ce3('0x61')]['id']}})['then'](handleEntityNotFound(_0x9c7533,null))[_0x4ce3('0x25')](function(_0x170b46){if(_0x170b46){_0x3896c3=_0x170b46;_0x2498b6[_0x4ce3('0x4a')]=_[_0x4ce3('0x4d')](db['OpenchannelInteraction'][_0x4ce3('0x48')]);_0x2498b6[_0x4ce3('0x4e')]=_['keys'](_0x49ada8[_0x4ce3('0x4e')]);_0x2498b6[_0x4ce3('0x4f')]=_[_0x4ce3('0x50')](_0x2498b6[_0x4ce3('0x4a')],_0x2498b6['query']);_0xf9b842['attributes']=_[_0x4ce3('0x50')](_0x2498b6['model'],qs[_0x4ce3('0x63')](_0x49ada8['query'][_0x4ce3('0x63')]));_0xf9b842['attributes']=_0xf9b842['attributes']['length']?_0xf9b842['attributes']:_0x2498b6[_0x4ce3('0x4a')];_0xf9b842[_0x4ce3('0xc0')]=qs[_0x4ce3('0x55')](_0x49ada8[_0x4ce3('0x4e')][_0x4ce3('0x55')]);_0xf9b842['where']=qs[_0x4ce3('0x4f')](_[_0x4ce3('0xc1')](_0x49ada8[_0x4ce3('0x4e')],_0x2498b6[_0x4ce3('0x4f')]));if(_0x49ada8[_0x4ce3('0x4e')][_0x4ce3('0x3d')]){_0xf9b842[_0x4ce3('0x56')]=_[_0x4ce3('0x57')](_0xf9b842[_0x4ce3('0x56')],{'$or':_[_0x4ce3('0x46')](_0xf9b842[_0x4ce3('0x51')],function(_0x1e7a5e){var _0x5dfd1d={};_0x5dfd1d[_0x1e7a5e]={'$like':'%'+_0x49ada8[_0x4ce3('0x4e')][_0x4ce3('0x3d')]+'%'};return _0x5dfd1d;})});}_0xf9b842=_[_0x4ce3('0x57')]({},_0xf9b842,_0x49ada8[_0x4ce3('0x5b')]);return _0x3896c3[_0x4ce3('0xd4')](_0xf9b842);}})[_0x4ce3('0x25')](function(_0x1541f7){if(_0x1541f7){_0x292437=_0x1541f7[_0x4ce3('0x52')];if(!_0x49ada8[_0x4ce3('0x4e')]['hasOwnProperty']('nolimit')){_0xf9b842['limit']=qs['limit'](_0x49ada8[_0x4ce3('0x4e')]['limit']);_0xf9b842[_0x4ce3('0x33')]=qs[_0x4ce3('0x33')](_0x49ada8[_0x4ce3('0x4e')][_0x4ce3('0x33')]);}return _0x3896c3['getOpenchannelInteractions'](_0xf9b842);}})['then'](function(_0x5f0c7b){if(_0x5f0c7b){return _0x5f0c7b?{'count':_0x292437,'rows':_0x5f0c7b}:null;}})[_0x4ce3('0x25')](respondWithResult(_0x9c7533,null))[_0x4ce3('0x2e')](handleError(_0x9c7533,null));};exports[_0x4ce3('0xd5')]=function(_0x52c651,_0x5aa1ce,_0x3eb469){var _0xf9dda6={'raw':!![],'where':{}};var _0xbe429a={};var _0x4e6cd7={'count':0x0,'rows':[]};return db[_0x4ce3('0x47')][_0x4ce3('0xbf')]({'where':{'id':_0x52c651[_0x4ce3('0x61')]['id']}})['then'](handleEntityNotFound(_0x5aa1ce,null))[_0x4ce3('0x25')](function(_0x2b88f0){if(_0x2b88f0){_0xbe429a[_0x4ce3('0x4a')]=_[_0x4ce3('0x4d')](db['MailInteraction'][_0x4ce3('0x48')]);_0xbe429a[_0x4ce3('0x4e')]=_[_0x4ce3('0x4d')](_0x52c651[_0x4ce3('0x4e')]);_0xbe429a[_0x4ce3('0x4f')]=_[_0x4ce3('0x50')](_0xbe429a[_0x4ce3('0x4a')],_0xbe429a[_0x4ce3('0x4e')]);_0xf9dda6['attributes']=_[_0x4ce3('0x50')](_0xbe429a[_0x4ce3('0x4a')],qs[_0x4ce3('0x63')](_0x52c651[_0x4ce3('0x4e')][_0x4ce3('0x63')]));_0xf9dda6[_0x4ce3('0x51')]=_0xf9dda6['attributes'][_0x4ce3('0x52')]?_0xf9dda6[_0x4ce3('0x51')]:_0xbe429a[_0x4ce3('0x4a')];if(!_0x52c651['query']['hasOwnProperty']('nolimit')){_0xf9dda6[_0x4ce3('0x34')]=qs['limit'](_0x52c651[_0x4ce3('0x4e')]['limit']);_0xf9dda6[_0x4ce3('0x33')]=qs[_0x4ce3('0x33')](_0x52c651[_0x4ce3('0x4e')][_0x4ce3('0x33')]);}_0xf9dda6['order']=qs[_0x4ce3('0x55')](_0x52c651[_0x4ce3('0x4e')][_0x4ce3('0x55')]);_0xf9dda6['where']=qs[_0x4ce3('0x4f')](_[_0x4ce3('0xc1')](_0x52c651[_0x4ce3('0x4e')],_0xbe429a[_0x4ce3('0x4f')]));_0xf9dda6[_0x4ce3('0x56')][_0x4ce3('0xcf')]=_0x2b88f0['id'];if(_0x52c651['query'][_0x4ce3('0x3d')]){_0xf9dda6[_0x4ce3('0x56')]=_[_0x4ce3('0x57')](_0xf9dda6[_0x4ce3('0x56')],{'$or':_[_0x4ce3('0x46')](_0xf9dda6[_0x4ce3('0x51')],function(_0x14c739){var _0x3cf782={};_0x3cf782[_0x14c739]={'$like':'%'+_0x52c651[_0x4ce3('0x4e')][_0x4ce3('0x3d')]+'%'};return _0x3cf782;})});}_0xf9dda6=_[_0x4ce3('0x57')]({},_0xf9dda6,_0x52c651['options']);return db['MailInteraction'][_0x4ce3('0x5c')]({'where':_0xf9dda6[_0x4ce3('0x56')]})[_0x4ce3('0x25')](function(_0x5607c6){_0x4e6cd7[_0x4ce3('0x5c')]=_0x5607c6;if(_0x52c651[_0x4ce3('0x4e')][_0x4ce3('0x5d')]){_0xf9dda6[_0x4ce3('0x5e')]=[{'all':!![]}];}return db[_0x4ce3('0xd6')][_0x4ce3('0x5f')](_0xf9dda6);})['then'](function(_0x1a8255){_0x4e6cd7[_0x4ce3('0x60')]=_0x1a8255;return _0x4e6cd7;});}})[_0x4ce3('0x25')](respondWithFilteredResult(_0x5aa1ce,_0xf9dda6))['catch'](handleError(_0x5aa1ce,null));};exports['getSmsInteractions']=function(_0x5a1b38,_0x7c23b3,_0x119eb2){var _0x526661={};var _0x96fbe8={};var _0x36740d;var _0x58b8c5;return db[_0x4ce3('0x47')][_0x4ce3('0xbf')]({'where':{'id':_0x5a1b38[_0x4ce3('0x61')]['id']}})['then'](handleEntityNotFound(_0x7c23b3,null))[_0x4ce3('0x25')](function(_0x5132fb){if(_0x5132fb){_0x36740d=_0x5132fb;_0x96fbe8[_0x4ce3('0x4a')]=_[_0x4ce3('0x4d')](db['SmsInteraction']['rawAttributes']);_0x96fbe8[_0x4ce3('0x4e')]=_[_0x4ce3('0x4d')](_0x5a1b38['query']);_0x96fbe8['filters']=_[_0x4ce3('0x50')](_0x96fbe8[_0x4ce3('0x4a')],_0x96fbe8['query']);_0x526661[_0x4ce3('0x51')]=_['intersection'](_0x96fbe8[_0x4ce3('0x4a')],qs['fields'](_0x5a1b38['query']['fields']));_0x526661[_0x4ce3('0x51')]=_0x526661[_0x4ce3('0x51')][_0x4ce3('0x52')]?_0x526661[_0x4ce3('0x51')]:_0x96fbe8[_0x4ce3('0x4a')];_0x526661['order']=qs[_0x4ce3('0x55')](_0x5a1b38[_0x4ce3('0x4e')]['sort']);_0x526661[_0x4ce3('0x56')]=qs[_0x4ce3('0x4f')](_[_0x4ce3('0xc1')](_0x5a1b38[_0x4ce3('0x4e')],_0x96fbe8[_0x4ce3('0x4f')]));if(_0x5a1b38[_0x4ce3('0x4e')][_0x4ce3('0x3d')]){_0x526661[_0x4ce3('0x56')]=_['merge'](_0x526661[_0x4ce3('0x56')],{'$or':_[_0x4ce3('0x46')](_0x526661[_0x4ce3('0x51')],function(_0x11ec76){var _0x2fd76c={};_0x2fd76c[_0x11ec76]={'$like':'%'+_0x5a1b38[_0x4ce3('0x4e')][_0x4ce3('0x3d')]+'%'};return _0x2fd76c;})});}_0x526661=_[_0x4ce3('0x57')]({},_0x526661,_0x5a1b38['options']);return _0x36740d['getSmsInteractions'](_0x526661);}})['then'](function(_0x5239f2){if(_0x5239f2){_0x58b8c5=_0x5239f2[_0x4ce3('0x52')];if(!_0x5a1b38[_0x4ce3('0x4e')][_0x4ce3('0x53')]('nolimit')){_0x526661[_0x4ce3('0x34')]=qs[_0x4ce3('0x34')](_0x5a1b38[_0x4ce3('0x4e')][_0x4ce3('0x34')]);_0x526661[_0x4ce3('0x33')]=qs[_0x4ce3('0x33')](_0x5a1b38['query']['offset']);}return _0x36740d[_0x4ce3('0xd7')](_0x526661);}})[_0x4ce3('0x25')](function(_0x3971d7){if(_0x3971d7){return _0x3971d7?{'count':_0x58b8c5,'rows':_0x3971d7}:null;}})[_0x4ce3('0x25')](respondWithResult(_0x7c23b3,null))[_0x4ce3('0x2e')](handleError(_0x7c23b3,null));};exports[_0x4ce3('0xd8')]=function(_0x5601cb,_0x1a642f,_0x4725fe){var _0x2141a3={};var _0x4b8a62={};var _0x39bb5c;var _0x9c5852;return db['User']['findOne']({'where':{'id':_0x5601cb[_0x4ce3('0x61')]['id']}})[_0x4ce3('0x25')](handleEntityNotFound(_0x1a642f,null))[_0x4ce3('0x25')](function(_0x562bed){if(_0x562bed){_0x39bb5c=_0x562bed;_0x4b8a62[_0x4ce3('0x4a')]=_['keys'](db[_0x4ce3('0xd9')][_0x4ce3('0x48')]);_0x4b8a62[_0x4ce3('0x4e')]=_[_0x4ce3('0x4d')](_0x5601cb[_0x4ce3('0x4e')]);_0x4b8a62[_0x4ce3('0x4f')]=_[_0x4ce3('0x50')](_0x4b8a62['model'],_0x4b8a62['query']);_0x2141a3['attributes']=_[_0x4ce3('0x50')](_0x4b8a62[_0x4ce3('0x4a')],qs[_0x4ce3('0x63')](_0x5601cb[_0x4ce3('0x4e')][_0x4ce3('0x63')]));_0x2141a3[_0x4ce3('0x51')]=_0x2141a3[_0x4ce3('0x51')][_0x4ce3('0x52')]?_0x2141a3[_0x4ce3('0x51')]:_0x4b8a62[_0x4ce3('0x4a')];_0x2141a3['order']=qs[_0x4ce3('0x55')](_0x5601cb[_0x4ce3('0x4e')][_0x4ce3('0x55')]);_0x2141a3[_0x4ce3('0x56')]=qs[_0x4ce3('0x4f')](_['pick'](_0x5601cb[_0x4ce3('0x4e')],_0x4b8a62[_0x4ce3('0x4f')]));if(_0x5601cb[_0x4ce3('0x4e')]['filter']){_0x2141a3[_0x4ce3('0x56')]=_[_0x4ce3('0x57')](_0x2141a3[_0x4ce3('0x56')],{'$or':_[_0x4ce3('0x46')](_0x2141a3[_0x4ce3('0x51')],function(_0x12e690){var _0x403bda={};_0x403bda[_0x12e690]={'$like':'%'+_0x5601cb['query'][_0x4ce3('0x3d')]+'%'};return _0x403bda;})});}_0x2141a3=_['merge']({},_0x2141a3,_0x5601cb[_0x4ce3('0x5b')]);return _0x39bb5c[_0x4ce3('0xd8')](_0x2141a3);}})[_0x4ce3('0x25')](function(_0x193970){if(_0x193970){_0x9c5852=_0x193970[_0x4ce3('0x52')];if(!_0x5601cb[_0x4ce3('0x4e')][_0x4ce3('0x53')](_0x4ce3('0x54'))){_0x2141a3[_0x4ce3('0x34')]=qs[_0x4ce3('0x34')](_0x5601cb[_0x4ce3('0x4e')][_0x4ce3('0x34')]);_0x2141a3[_0x4ce3('0x33')]=qs[_0x4ce3('0x33')](_0x5601cb[_0x4ce3('0x4e')][_0x4ce3('0x33')]);}return _0x39bb5c[_0x4ce3('0xd8')](_0x2141a3);}})[_0x4ce3('0x25')](function(_0x4bd8db){if(_0x4bd8db){return _0x4bd8db?{'count':_0x9c5852,'rows':_0x4bd8db}:null;}})[_0x4ce3('0x25')](respondWithResult(_0x1a642f,null))[_0x4ce3('0x2e')](handleError(_0x1a642f,null));};exports['getWhatsappInteractions']=function(_0x13cb66,_0x3ed45e,_0xac16ea){var _0x14af42={};var _0x27b7fc={};var _0x28a4fb;var _0x2b41ce;return db['User'][_0x4ce3('0xbf')]({'where':{'id':_0x13cb66['params']['id']}})[_0x4ce3('0x25')](handleEntityNotFound(_0x3ed45e,null))[_0x4ce3('0x25')](function(_0x23da92){if(_0x23da92){_0x28a4fb=_0x23da92;_0x27b7fc[_0x4ce3('0x4a')]=_['keys'](db[_0x4ce3('0xda')][_0x4ce3('0x48')]);_0x27b7fc[_0x4ce3('0x4e')]=_[_0x4ce3('0x4d')](_0x13cb66[_0x4ce3('0x4e')]);_0x27b7fc[_0x4ce3('0x4f')]=_[_0x4ce3('0x50')](_0x27b7fc[_0x4ce3('0x4a')],_0x27b7fc[_0x4ce3('0x4e')]);_0x14af42[_0x4ce3('0x51')]=_[_0x4ce3('0x50')](_0x27b7fc[_0x4ce3('0x4a')],qs[_0x4ce3('0x63')](_0x13cb66[_0x4ce3('0x4e')][_0x4ce3('0x63')]));_0x14af42['attributes']=_0x14af42[_0x4ce3('0x51')]['length']?_0x14af42[_0x4ce3('0x51')]:_0x27b7fc[_0x4ce3('0x4a')];_0x14af42[_0x4ce3('0xc0')]=qs['sort'](_0x13cb66[_0x4ce3('0x4e')][_0x4ce3('0x55')]);_0x14af42['where']=qs[_0x4ce3('0x4f')](_[_0x4ce3('0xc1')](_0x13cb66[_0x4ce3('0x4e')],_0x27b7fc['filters']));if(_0x13cb66[_0x4ce3('0x4e')][_0x4ce3('0x3d')]){_0x14af42[_0x4ce3('0x56')]=_['merge'](_0x14af42['where'],{'$or':_[_0x4ce3('0x46')](_0x14af42[_0x4ce3('0x51')],function(_0x575196){var _0xafcb5e={};_0xafcb5e[_0x575196]={'$like':'%'+_0x13cb66[_0x4ce3('0x4e')][_0x4ce3('0x3d')]+'%'};return _0xafcb5e;})});}_0x14af42=_[_0x4ce3('0x57')]({},_0x14af42,_0x13cb66[_0x4ce3('0x5b')]);return _0x28a4fb['getWhatsappInteractions'](_0x14af42);}})[_0x4ce3('0x25')](function(_0x2dc504){if(_0x2dc504){_0x2b41ce=_0x2dc504[_0x4ce3('0x52')];if(!_0x13cb66[_0x4ce3('0x4e')]['hasOwnProperty'](_0x4ce3('0x54'))){_0x14af42['limit']=qs[_0x4ce3('0x34')](_0x13cb66[_0x4ce3('0x4e')]['limit']);_0x14af42[_0x4ce3('0x33')]=qs['offset'](_0x13cb66['query'][_0x4ce3('0x33')]);}return _0x28a4fb['getWhatsappInteractions'](_0x14af42);}})[_0x4ce3('0x25')](function(_0x3e92e8){if(_0x3e92e8){return _0x3e92e8?{'count':_0x2b41ce,'rows':_0x3e92e8}:null;}})[_0x4ce3('0x25')](respondWithResult(_0x3ed45e,null))['catch'](handleError(_0x3ed45e,null));};exports[_0x4ce3('0xdb')]=function(_0xb563df,_0x17aaee,_0x59c28e){var _0x3d345d;var _0x1125ab;var _0x36bbf1;var _0x44080c=!_['isNil'](_0xb563df[_0x4ce3('0x61')]['id'])?_0xb563df['params']['id']:!_[_0x4ce3('0x6e')](_0xb563df[_0x4ce3('0x3a')]['id'])?_0xb563df[_0x4ce3('0x3a')]['id']:null;return db[_0x4ce3('0x47')][_0x4ce3('0x40')]({'where':{'id':_0x44080c,'role':{'$or':['admin',_0x4ce3('0x3a'),'agent']}},'attributes':['id','name','phone','mobile',_0x4ce3('0x41'),'internal',_0x4ce3('0x9c')]})[_0x4ce3('0x25')](function(_0x160da5){if(_0x160da5){if(_0x160da5[_0x4ce3('0x41')]===_0x4ce3('0x3b')){_0x3d345d=_0x160da5;if(_0xb563df['body'][_0x4ce3('0x9e')]){_0x36bbf1=util[_0x4ce3('0xab')]('LOCAL/%s@from-sip/n',_0x3d345d[_0xb563df[_0x4ce3('0x65')][_0x4ce3('0x9e')]]);}else if(_0xb563df[_0x4ce3('0x65')]['intrf']){_0x36bbf1=util[_0x4ce3('0xab')](_0x4ce3('0xac'),_0xb563df['body'][_0x4ce3('0xdc')]);}else{_0x36bbf1=util[_0x4ce3('0xab')](_0x4ce3('0xac'),_0x3d345d['name']);}socket['to'](util[_0x4ce3('0xab')](_0x4ce3('0xdd'),_0x3d345d[_0x4ce3('0x43')]))[_0x4ce3('0xa7')](_0x4ce3('0xde'),{'ip':_0xb563df[_0x4ce3('0xdf')][_0x4ce3('0xe0')]||_0xb563df['connection'][_0x4ce3('0xe1')]||_0xb563df[_0x4ce3('0xe2')][_0x4ce3('0xe1')]||_0xb563df[_0x4ce3('0xe3')][_0x4ce3('0xe2')]['remoteAddress']});return db['UserVoiceQueueRt'][_0x4ce3('0x38')]({'where':{'membername':_0x3d345d[_0x4ce3('0x43')]},'individualHooks':!![]});}}else{throw new db[(_0x4ce3('0x92'))]['ValidationError'](_0x4ce3('0xe4'));}})[_0x4ce3('0x25')](function(){if(_0x3d345d){return _0x3d345d[_0x4ce3('0xe5')]({'raw':!![]});}})['then'](function(_0x4e2f07){if(_0x3d345d){var _0x183dc8=[];if(_0x4e2f07){_0x1125ab=_0x4e2f07;if(_0x1125ab[_0x4ce3('0x52')]){for(var _0x2debf7=0x0;_0x2debf7<_0x1125ab['length'];_0x2debf7++){_0x183dc8['push']({'membername':_0x3d345d[_0x4ce3('0x43')],'UserId':_0x3d345d['id'],'queue_name':_0x1125ab[_0x2debf7][_0x4ce3('0x43')],'VoiceQueueId':_0x1125ab[_0x2debf7]['id'],'interface':_0x36bbf1,'paused':_0x3d345d[_0x4ce3('0x9c')]||![],'penalty':_0x1125ab[_0x2debf7][_0x4ce3('0xe6')]||0x0});}return BPromise['each'](_0x183dc8,function(_0x11268e){return db[_0x4ce3('0xae')][_0x4ce3('0xaf')](_0x11268e);});}}}})[_0x4ce3('0x25')](function(){if(_0x3d345d){return db[_0x4ce3('0xe7')][_0x4ce3('0x5f')]({'where':{'membername':_0x3d345d[_0x4ce3('0x43')],'exitAt':null}});}})[_0x4ce3('0x25')](function(_0x340ba8){if(_0x3d345d){var _0x2fab51=[];_0x340ba8[_0x4ce3('0xe8')](function(_0x597d60){_0x2fab51[_0x4ce3('0xe9')](_0x597d60[_0x4ce3('0x37')]({'exitAt':moment()[_0x4ce3('0xab')]('YYYY-MM-DD\x20HH:mm:ss')}));});return BPromise[_0x4ce3('0xea')](_0x2fab51);}})['then'](function(){if(_0x3d345d){var _0x2a8467=[];var _0x18e71c=[];var _0x4425bb=utils[_0x4ce3('0xeb')]();var _0x54274a={'membername':_0x3d345d[_0x4ce3('0x43')],'interface':_0x36bbf1,'enterAt':moment()[_0x4ce3('0xab')]('YYYY-MM-DD\x20HH:mm:ss'),'role':_0x3d345d[_0x4ce3('0x41')],'internal':_0x3d345d['internal']};_0x4425bb[_0x4ce3('0xe8')](function(_0x4d8e9b){_0x2a8467[_0x4ce3('0xe9')](_[_0x4ce3('0x57')]({'channel':_0x4d8e9b,'type':_0x4ce3('0xec'),'data1':_0xb563df['body'][_0x4ce3('0xed')],'data2':_0x36bbf1},_0x54274a));if(_0x3d345d[_0x4ce3('0x9c')]){_0x18e71c[_0x4ce3('0xe9')](_[_0x4ce3('0x57')]({'channel':_0x4d8e9b,'type':_0x4ce3('0xee'),'data1':_0x4ce3('0xef')},_0x54274a));}});return db[_0x4ce3('0xe7')][_0x4ce3('0x64')](_0x2a8467[_0x4ce3('0xf0')](_0x18e71c),{'individualHooks':!![]});}})[_0x4ce3('0x25')](function(){if(_0x3d345d){return _0x3d345d[_0x4ce3('0x37')]({'online':!![],'lastLoginAt':moment()[_0x4ce3('0xab')]('YYYY-MM-DD\x20HH:mm:ss'),'voicePause':_0x3d345d[_0x4ce3('0x9c')]||![],'mailPause':_0x3d345d[_0x4ce3('0x9c')]||![],'chatPause':_0x3d345d[_0x4ce3('0x9c')]||![],'faxPause':_0x3d345d['loginInPause']||![],'smsPause':_0x3d345d[_0x4ce3('0x9c')]||![],'openchannelPause':_0x3d345d[_0x4ce3('0x9c')]||![],'whatsappPause':_0x3d345d[_0x4ce3('0x9c')]||![],'pauseType':_0x3d345d[_0x4ce3('0x9c')]?_0x4ce3('0xef'):null,'interface':_0x36bbf1,'lastPauseAt':moment()[_0x4ce3('0xab')](_0x4ce3('0xf1'))});}})[_0x4ce3('0x25')](function(_0x2dbca9){if(_0xb563df['isMiddleware']){return _0x59c28e();}else{return BPromise[_0x4ce3('0xf2')](_0x2dbca9)[_0x4ce3('0x25')](respondWithResult(_0x17aaee,null));}})[_0x4ce3('0x2e')](handleError(_0x17aaee,null));};exports['logout']=function(_0x525aa7,_0x160505,_0x48019a){var _0x32c807;return db[_0x4ce3('0x47')]['find']({'where':{'id':_0x525aa7[_0x4ce3('0x61')]['id'],'role':_0x4ce3('0x3b')},'attributes':['id',_0x4ce3('0x43'),_0x4ce3('0x41')]})[_0x4ce3('0x25')](handleEntityNotFound(_0x160505,null))['then'](function(_0x116fbb){if(_0x116fbb){_0x32c807=_0x116fbb;return db['UserVoiceQueueRt'][_0x4ce3('0x38')]({'where':{'membername':_0x32c807[_0x4ce3('0x43')]},'individualHooks':!![]});}})['then'](function(){return db[_0x4ce3('0xe7')][_0x4ce3('0x5f')]({'where':{'membername':_0x32c807[_0x4ce3('0x43')],'exitAt':null}});})[_0x4ce3('0x25')](function(_0x393bff){var _0x35ca66=[];_0x393bff[_0x4ce3('0xe8')](function(_0x27426e){_0x35ca66[_0x4ce3('0xe9')](_0x27426e[_0x4ce3('0x37')]({'exitAt':moment()[_0x4ce3('0xab')](_0x4ce3('0xf1'))}));});return BPromise['all'](_0x35ca66);})[_0x4ce3('0x25')](function(){return _0x32c807['update']({'online':![],'lastLoginAt':null,'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![],'whatsappPause':![],'interface':null});})[_0x4ce3('0x25')](respondWithResult(_0x160505,null))[_0x4ce3('0x2e')](handleError(_0x160505,null));};exports[_0x4ce3('0xf3')]=function(_0x447fd5,_0x17df29,_0x11f9c6){var _0x775e;return db['UserVoiceQueueRt'][_0x4ce3('0x37')]({'paused':0x1},{'where':{'UserId':_0x447fd5[_0x4ce3('0x61')]['id']},'individualHooks':!![]})[_0x4ce3('0x25')](function(){return db[_0x4ce3('0x47')]['find']({'where':{'id':_0x447fd5[_0x4ce3('0x61')]['id'],'role':_0x4ce3('0x3b')},'attributes':['id',_0x4ce3('0x43'),_0x4ce3('0x41'),_0x4ce3('0x71'),'interface']});})['then'](handleEntityNotFound(_0x17df29,null))['then'](function(_0x45eb19){if(_0x45eb19){_0x775e=_0x45eb19;return respondWithRpcPromise(_0x4ce3('0xf4'),_0x4ce3('0xf3'),{'id':_0x775e['id'],'name':_0x775e[_0x4ce3('0x43')],'pause':!![]});}})[_0x4ce3('0x25')](function(){if(_0x775e){return db[_0x4ce3('0xe7')][_0x4ce3('0x5f')]({'where':{'membername':_0x775e[_0x4ce3('0x43')],'type':'PAUSE','exitAt':null}});}})[_0x4ce3('0x25')](function(_0x255d5b){if(_0x255d5b['length']){var _0x3ce017=moment()[_0x4ce3('0xab')](_0x4ce3('0xf1'));for(var _0x267005=0x0,_0x18b2bb=_0x255d5b[_0x4ce3('0x52')];_0x267005<_0x18b2bb;_0x267005++){_0x255d5b[_0x267005][_0x4ce3('0xf5')]({'exitAt':_0x3ce017});}}})[_0x4ce3('0x25')](function(){var _0x4c07b8=[];var _0x29fd27=utils[_0x4ce3('0xeb')]();_0x29fd27[_0x4ce3('0xe8')](function(_0x458301){_0x4c07b8[_0x4ce3('0xe9')]({'channel':_0x458301,'membername':_0x775e[_0x4ce3('0x43')],'interface':_['isNil'](_0x775e[_0x4ce3('0x9e')])?util[_0x4ce3('0xab')](_0x4ce3('0xac'),_0x775e[_0x4ce3('0x43')]):_0x775e['interface'],'type':_0x4ce3('0xee'),'enterAt':moment()[_0x4ce3('0xab')](_0x4ce3('0xf1')),'data1':_0x447fd5[_0x4ce3('0x65')][_0x4ce3('0x49')]||_0x4ce3('0xf6'),'role':_0x775e['role'],'internal':_0x775e[_0x4ce3('0x71')]});});return db[_0x4ce3('0xe7')][_0x4ce3('0x64')](_0x4c07b8,{'individualHooks':!![]});})[_0x4ce3('0x25')](function(){return _0x775e['update']({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'whatsappPause':!![],'openchannelPause':!![],'pauseType':_0x447fd5['body'][_0x4ce3('0x49')]||_0x4ce3('0xf6'),'lastPauseAt':moment()['format'](_0x4ce3('0xf1'))});})[_0x4ce3('0x25')](respondWithResult(_0x17df29,null))[_0x4ce3('0x2e')](handleError(_0x17df29,null));};exports['unpause']=function(_0x1e8400,_0x5ecf6a,_0x24e55d){var _0x30b5cd;return db[_0x4ce3('0x47')][_0x4ce3('0x40')]({'where':{'id':_0x1e8400[_0x4ce3('0x61')]['id']},'attributes':['id',_0x4ce3('0x43'),_0x4ce3('0x41'),'voicePause',_0x4ce3('0xf7'),_0x4ce3('0xf8'),_0x4ce3('0xf9'),_0x4ce3('0xfa'),_0x4ce3('0xfb'),_0x4ce3('0xfc'),_0x4ce3('0xfd'),_0x4ce3('0xfe')]})[_0x4ce3('0x25')](handleEntityNotFound(_0x5ecf6a,null))[_0x4ce3('0x25')](function(_0x1cd21a){if(_0x1cd21a){_0x30b5cd=_0x1cd21a;if(_0x1e8400[_0x4ce3('0x65')][_0x4ce3('0x9a')]&&!utils[_0x4ce3('0xb0')](_0x1e8400[_0x4ce3('0x65')][_0x4ce3('0x9a')])){throw new db[(_0x4ce3('0x92'))][(_0x4ce3('0x23'))](_0x4ce3('0x9f'));}switch(_0x1e8400[_0x4ce3('0x65')]['channel']){case _0x4ce3('0xa9'):return respondWithRpcPromise(_0x4ce3('0xf4'),_0x4ce3('0xff'),{'id':_0x30b5cd['id'],'name':_0x30b5cd[_0x4ce3('0x43')],'pause':![]})['then'](function(){return db[_0x4ce3('0xae')]['update']({'paused':0x0},{'where':{'UserId':_0x30b5cd['id']},'individualHooks':!![]});})[_0x4ce3('0x25')](function(){return db[_0x4ce3('0xe7')][_0x4ce3('0x40')]({'where':{'channel':_0x1e8400[_0x4ce3('0x65')][_0x4ce3('0x9a')],'membername':_0x30b5cd[_0x4ce3('0x43')],'type':'PAUSE','exitAt':null}});})['then'](function(_0x3f3c54){if(_0x3f3c54){return _0x3f3c54['update']({'exitAt':moment()[_0x4ce3('0xab')](_0x4ce3('0xf1')),'data2':'manual'},{'individualHooks':!![]});}return null;})[_0x4ce3('0x25')](function(){return _0x30b5cd['update']({'voicePause':![]});});case'mail':case _0x4ce3('0x100'):case _0x4ce3('0x101'):case _0x4ce3('0x102'):case _0x4ce3('0x103'):case'openchannel':return db[_0x4ce3('0xe7')][_0x4ce3('0x40')]({'where':{'channel':_0x1e8400[_0x4ce3('0x65')][_0x4ce3('0x9a')],'membername':_0x30b5cd['name'],'type':'PAUSE','exitAt':null}})[_0x4ce3('0x25')](function(_0x42a70c){if(_0x42a70c){return _0x42a70c[_0x4ce3('0x37')]({'exitAt':moment()[_0x4ce3('0xab')](_0x4ce3('0xf1')),'data2':_0x4ce3('0x104')},{'individualHooks':!![]});}return null;})[_0x4ce3('0x25')](function(){var _0x3c2c02={};_['set'](_0x3c2c02,util['format']('%s%s',_0x1e8400[_0x4ce3('0x65')][_0x4ce3('0x9a')],_0x4ce3('0x105')),![]);return _0x30b5cd[_0x4ce3('0x37')](_0x3c2c02);});default:return respondWithRpcPromise('QueuePause',_0x4ce3('0xff'),{'id':_0x30b5cd['id'],'name':_0x30b5cd[_0x4ce3('0x43')],'pause':![]})[_0x4ce3('0x25')](function(){return db[_0x4ce3('0xae')][_0x4ce3('0x37')]({'paused':0x0},{'where':{'UserId':_0x30b5cd['id']}});})[_0x4ce3('0x25')](function(){return db[_0x4ce3('0xe7')][_0x4ce3('0x5f')]({'where':{'membername':_0x30b5cd['name'],'type':_0x4ce3('0xee'),'exitAt':null}});})[_0x4ce3('0x25')](function(_0x39bafb){var _0x44a971=[];_0x39bafb[_0x4ce3('0xe8')](function(_0x24097f){_0x44a971[_0x4ce3('0xe9')](_0x24097f[_0x4ce3('0x37')]({'exitAt':moment()['format'](_0x4ce3('0xf1')),'data2':'manual'}));});return BPromise[_0x4ce3('0xea')](_0x44a971);})[_0x4ce3('0x25')](function(){return _0x30b5cd[_0x4ce3('0x37')]({'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'whatsappPause':![],'openchannelPause':![]});});}}})[_0x4ce3('0x25')](respondWithResult(_0x5ecf6a,null))[_0x4ce3('0x2e')](handleError(_0x5ecf6a,null));};exports[_0x4ce3('0x106')]=function(_0x4c758a,_0x563ad5,_0x12172a){var _0x1fc820={};var _0x481e81={};var _0x3ddb4f;var _0x39daff;return db[_0x4ce3('0x47')][_0x4ce3('0xbf')]({'where':{'id':_0x4c758a[_0x4ce3('0x61')]['id']}})[_0x4ce3('0x25')](handleEntityNotFound(_0x563ad5,null))[_0x4ce3('0x25')](function(_0x23741a){if(_0x23741a){_0x3ddb4f=_0x23741a;_0x481e81[_0x4ce3('0x4a')]=_[_0x4ce3('0x4d')](db['Team'][_0x4ce3('0x48')]);_0x481e81[_0x4ce3('0x4e')]=_[_0x4ce3('0x4d')](_0x4c758a[_0x4ce3('0x4e')]);_0x481e81[_0x4ce3('0x4f')]=_[_0x4ce3('0x50')](_0x481e81[_0x4ce3('0x4a')],_0x481e81[_0x4ce3('0x4e')]);_0x1fc820[_0x4ce3('0x51')]=_['intersection'](_0x481e81['model'],qs[_0x4ce3('0x63')](_0x4c758a['query'][_0x4ce3('0x63')]));_0x1fc820[_0x4ce3('0x51')]=_0x1fc820[_0x4ce3('0x51')][_0x4ce3('0x52')]?_0x1fc820[_0x4ce3('0x51')]:_0x481e81['model'];_0x1fc820[_0x4ce3('0xc0')]=qs[_0x4ce3('0x55')](_0x4c758a['query']['sort']);_0x1fc820[_0x4ce3('0x56')]=qs[_0x4ce3('0x4f')](_[_0x4ce3('0xc1')](_0x4c758a[_0x4ce3('0x4e')],_0x481e81[_0x4ce3('0x4f')]));if(_0x4c758a[_0x4ce3('0x4e')]['filter']){_0x1fc820['where']=_['merge'](_0x1fc820[_0x4ce3('0x56')],{'$or':_[_0x4ce3('0x46')](_0x1fc820[_0x4ce3('0x51')],function(_0x405195){var _0x5b9267={};_0x5b9267[_0x405195]={'$like':'%'+_0x4c758a[_0x4ce3('0x4e')]['filter']+'%'};return _0x5b9267;})});}_0x1fc820=_[_0x4ce3('0x57')]({},_0x1fc820,_0x4c758a[_0x4ce3('0x5b')]);return _0x3ddb4f[_0x4ce3('0x106')](_0x1fc820);}})[_0x4ce3('0x25')](function(_0x1eb9c4){if(_0x1eb9c4){_0x39daff=_0x1eb9c4[_0x4ce3('0x52')];if(!_0x4c758a['query'][_0x4ce3('0x53')](_0x4ce3('0x54'))){_0x1fc820[_0x4ce3('0x34')]=qs[_0x4ce3('0x34')](_0x4c758a['query'][_0x4ce3('0x34')]);_0x1fc820[_0x4ce3('0x33')]=qs[_0x4ce3('0x33')](_0x4c758a[_0x4ce3('0x4e')]['offset']);}return _0x3ddb4f[_0x4ce3('0x106')](_0x1fc820);}})['then'](function(_0x3528ea){if(_0x3528ea){return _0x3528ea?{'count':_0x39daff,'rows':_0x3528ea}:null;}})[_0x4ce3('0x25')](respondWithResult(_0x563ad5,null))[_0x4ce3('0x2e')](handleError(_0x563ad5,null));};exports['addTeams']=function(_0x5555e9,_0xf927ae){return db[_0x4ce3('0x47')]['find']({'where':{'id':_0x5555e9['params']['id']}})[_0x4ce3('0x25')](handleEntityNotFound(_0xf927ae,null))[_0x4ce3('0x25')](function(_0x47ddb8){if(_0x47ddb8){var _0x4ff134=_0x47ddb8[_0x4ce3('0x39')]({'plain':!![]});return _0x47ddb8['addTeams'](_0x5555e9['body'][_0x4ce3('0x68')],_[_0x4ce3('0x107')](_0x5555e9[_0x4ce3('0x65')],['ids','id'])||{})[_0x4ce3('0x25')](function(){for(var _0x5b02e7=0x0;_0x5b02e7<_0x5555e9['body']['ids'][_0x4ce3('0x52')];_0x5b02e7++){var _0x251d22=[];db[_0x4ce3('0x108')][_0x4ce3('0xbf')]({'where':{'id':_0x5555e9['body'][_0x4ce3('0x68')][_0x5b02e7]}})[_0x4ce3('0x25')](function(_0x2a5813){_0x251d22[_0x4ce3('0xe9')](_0x2a5813[_0x4ce3('0xe5')]()[_0x4ce3('0x25')](function(_0x2dbd0e){for(var _0x4d0bfc=0x0;_0x4d0bfc<_0x2dbd0e[_0x4ce3('0x52')];_0x4d0bfc++){_0x2dbd0e[_0x4d0bfc]['setDataValue'](_0x4ce3('0x9a'),_0x4ce3('0x109'));}return _0x2dbd0e;}));_0x251d22[_0x4ce3('0xe9')](_0x2a5813['getChatQueues']()['then'](function(_0x57955f){for(var _0x3a605b=0x0;_0x3a605b<_0x57955f[_0x4ce3('0x52')];_0x3a605b++){_0x57955f[_0x3a605b][_0x4ce3('0x10a')]('channel',_0x4ce3('0x10b'));}return _0x57955f;}));_0x251d22[_0x4ce3('0xe9')](_0x2a5813[_0x4ce3('0x10c')]()[_0x4ce3('0x25')](function(_0x490a66){for(var _0x3e3a00=0x0;_0x3e3a00<_0x490a66[_0x4ce3('0x52')];_0x3e3a00++){_0x490a66[_0x3e3a00][_0x4ce3('0x10a')](_0x4ce3('0x9a'),_0x4ce3('0x10d'));}return _0x490a66;}));_0x251d22[_0x4ce3('0xe9')](_0x2a5813['getSmsQueues']()[_0x4ce3('0x25')](function(_0x430052){for(var _0x386185=0x0;_0x386185<_0x430052[_0x4ce3('0x52')];_0x386185++){_0x430052[_0x386185][_0x4ce3('0x10a')](_0x4ce3('0x9a'),_0x4ce3('0x10e'));}return _0x430052;}));_0x251d22[_0x4ce3('0xe9')](_0x2a5813[_0x4ce3('0x10f')]()[_0x4ce3('0x25')](function(_0x214926){for(var _0x4da856=0x0;_0x4da856<_0x214926['length'];_0x4da856++){_0x214926[_0x4da856][_0x4ce3('0x10a')](_0x4ce3('0x9a'),_0x4ce3('0x110'));}return _0x214926;}));_0x251d22[_0x4ce3('0xe9')](_0x2a5813[_0x4ce3('0x111')]()[_0x4ce3('0x25')](function(_0x8ff8f){for(var _0x2636a1=0x0;_0x2636a1<_0x8ff8f[_0x4ce3('0x52')];_0x2636a1++){_0x8ff8f[_0x2636a1][_0x4ce3('0x10a')]('channel','Fax');}return _0x8ff8f;}));_0x251d22['push'](_0x2a5813[_0x4ce3('0x112')]()[_0x4ce3('0x25')](function(_0x471f5f){for(var _0x5ee699=0x0;_0x5ee699<_0x471f5f[_0x4ce3('0x52')];_0x5ee699++){_0x471f5f[_0x5ee699]['setDataValue'](_0x4ce3('0x9a'),_0x4ce3('0x113'));}return _0x471f5f;}));return BPromise['all'](_0x251d22);})[_0x4ce3('0x25')](function(_0x575868){var _0x4a8226=_[_0x4ce3('0x114')](_0x575868);_0x251d22=[];return db[_0x4ce3('0x59')]['transaction'](function(_0x2343d9){for(var _0x37b8ce=0x0;_0x37b8ce<_0x4a8226['length'];_0x37b8ce++){_0x251d22[_0x4ce3('0xe9')](_0x4a8226[_0x37b8ce]['addAgent'](_0x4ff134['id']),{'transaction':_0x2343d9});}return BPromise[_0x4ce3('0xea')](_0x251d22)['then'](function(){if(_0x4ff134[_0x4ce3('0x9b')]){return BPromise['each'](_['filter'](_0x4a8226,function(_0x51b3c4){return _0x51b3c4[_0x4ce3('0x115')](_0x4ce3('0x9a'))===_0x4ce3('0x109');}),function(_0x17675e){return db[_0x4ce3('0xae')]['upsert']({'membername':_0x4ff134[_0x4ce3('0x43')],'UserId':_0x4ff134['id'],'queue_name':_0x17675e[_0x4ce3('0x43')],'VoiceQueueId':_0x17675e['id'],'interface':_[_0x4ce3('0x6e')](_0x4ff134[_0x4ce3('0x9e')])?util[_0x4ce3('0xab')]('SIP/%s',_0x4ff134[_0x4ce3('0x43')]):_0x4ff134[_0x4ce3('0x9e')],'paused':_0x4ff134['voicePause']||![],'penalty':_0x4ff134['penalty']},{'transaction':_0x2343d9});});}else{return;}})[_0x4ce3('0x25')](function(){for(var _0x4fa871=0x0;_0x4fa871<_0x4a8226[_0x4ce3('0x52')];_0x4fa871++){var _0x2c5b18=_0x4a8226[_0x4fa871][_0x4ce3('0x115')]('channel');var _0x3a0402=_0x2c5b18+_0x4ce3('0xa6');socket['emit'](_0x4ce3('0x3a')+_0x2c5b18+_0x4ce3('0xa8'),{'UserId':_0x4ff134['id'],['queueField']:_0x4a8226[_0x4fa871]['id']});}});});});}});}})[_0x4ce3('0x25')](respondWithStatusCode(_0xf927ae,null))['catch'](handleError(_0xf927ae,null));};exports[_0x4ce3('0x116')]=function(_0x15ecc9,_0x29f18a){return db[_0x4ce3('0x47')]['findOne']({'where':{'id':_0x15ecc9[_0x4ce3('0x61')]['id']}})[_0x4ce3('0x25')](handleEntityNotFound(_0x29f18a,null))['then'](function(_0x2bca7f){if(_0x2bca7f){var _0x3adfa0=_0x2bca7f[_0x4ce3('0x39')]({'plain':!![]});var _0x4214e8=_0x15ecc9[_0x4ce3('0x4e')][_0x4ce3('0x68')];return _0x2bca7f[_0x4ce3('0x116')](_0x4214e8)['then'](function(){for(var _0x30bde6=0x0;_0x30bde6<_0x4214e8[_0x4ce3('0x52')];_0x30bde6++){var _0x6123cf=[];db[_0x4ce3('0x108')][_0x4ce3('0xbf')]({'where':{'id':_0x4214e8[_0x30bde6]}})['then'](function(_0x12219e){_0x6123cf[_0x4ce3('0xe9')](_0x12219e[_0x4ce3('0xe5')]()[_0x4ce3('0x25')](function(_0x2ff28f){for(var _0x615b73=0x0;_0x615b73<_0x2ff28f[_0x4ce3('0x52')];_0x615b73++){_0x2ff28f[_0x615b73]['setDataValue'](_0x4ce3('0x9a'),_0x4ce3('0x109'));}return _0x2ff28f;}));_0x6123cf[_0x4ce3('0xe9')](_0x12219e[_0x4ce3('0x117')]()[_0x4ce3('0x25')](function(_0x57aa3c){for(var _0x980ff9=0x0;_0x980ff9<_0x57aa3c[_0x4ce3('0x52')];_0x980ff9++){_0x57aa3c[_0x980ff9][_0x4ce3('0x10a')](_0x4ce3('0x9a'),_0x4ce3('0x10b'));}return _0x57aa3c;}));_0x6123cf[_0x4ce3('0xe9')](_0x12219e[_0x4ce3('0x10c')]()['then'](function(_0x1c5b77){for(var _0x48d5b2=0x0;_0x48d5b2<_0x1c5b77['length'];_0x48d5b2++){_0x1c5b77[_0x48d5b2]['setDataValue'](_0x4ce3('0x9a'),_0x4ce3('0x10d'));}return _0x1c5b77;}));_0x6123cf[_0x4ce3('0xe9')](_0x12219e[_0x4ce3('0x118')]()[_0x4ce3('0x25')](function(_0x506ed7){for(var _0x3b85a4=0x0;_0x3b85a4<_0x506ed7[_0x4ce3('0x52')];_0x3b85a4++){_0x506ed7[_0x3b85a4][_0x4ce3('0x10a')](_0x4ce3('0x9a'),_0x4ce3('0x10e'));}return _0x506ed7;}));_0x6123cf[_0x4ce3('0xe9')](_0x12219e[_0x4ce3('0x10f')]()[_0x4ce3('0x25')](function(_0x4cc1b9){for(var _0x4cc4d4=0x0;_0x4cc4d4<_0x4cc1b9[_0x4ce3('0x52')];_0x4cc4d4++){_0x4cc1b9[_0x4cc4d4][_0x4ce3('0x10a')](_0x4ce3('0x9a'),'Whatsapp');}return _0x4cc1b9;}));_0x6123cf[_0x4ce3('0xe9')](_0x12219e['getFaxQueues']()[_0x4ce3('0x25')](function(_0x5bc8de){for(var _0x2a03a8=0x0;_0x2a03a8<_0x5bc8de[_0x4ce3('0x52')];_0x2a03a8++){_0x5bc8de[_0x2a03a8][_0x4ce3('0x10a')](_0x4ce3('0x9a'),'Fax');}return _0x5bc8de;}));_0x6123cf[_0x4ce3('0xe9')](_0x12219e[_0x4ce3('0x112')]()['then'](function(_0x1f9ac7){for(var _0x297a32=0x0;_0x297a32<_0x1f9ac7[_0x4ce3('0x52')];_0x297a32++){_0x1f9ac7[_0x297a32][_0x4ce3('0x10a')](_0x4ce3('0x9a'),_0x4ce3('0x113'));}return _0x1f9ac7;}));return BPromise[_0x4ce3('0xea')](_0x6123cf);})[_0x4ce3('0x25')](function(_0x14894e){var _0x1b8f3c=_['flatten'](_0x14894e);_0x6123cf=[];return db[_0x4ce3('0x59')][_0x4ce3('0x119')](function(_0x146acf){for(var _0x21ea4f=0x0;_0x21ea4f<_0x1b8f3c[_0x4ce3('0x52')];_0x21ea4f++){_0x6123cf[_0x4ce3('0xe9')](_0x1b8f3c[_0x21ea4f][_0x4ce3('0x11a')](_0x3adfa0['id']),{'transaction':_0x146acf});}return BPromise[_0x4ce3('0xea')](_0x6123cf)[_0x4ce3('0x25')](function(){if(_0x3adfa0['online']){return BPromise[_0x4ce3('0xad')](_['filter'](_0x1b8f3c,function(_0x260d36){return _0x260d36[_0x4ce3('0x115')](_0x4ce3('0x9a'))===_0x4ce3('0x109');}),function(_0x4fd374){return db['UserVoiceQueueRt'][_0x4ce3('0x38')]({'where':{'VoiceQueueId':_0x4fd374['id'],'UserId':_0x3adfa0['id']},'transaction':_0x146acf});});}else{return;}})[_0x4ce3('0x25')](function(){for(var _0x189bee=0x0;_0x189bee<_0x1b8f3c['length'];_0x189bee++){var _0x951ae1=_0x1b8f3c[_0x189bee]['getDataValue'](_0x4ce3('0x9a'));var _0x31f670=_0x951ae1+_0x4ce3('0xa6');socket[_0x4ce3('0xa7')](_0x4ce3('0x3a')+_0x951ae1+_0x4ce3('0xb2'),{'UserId':_0x3adfa0['id'],['queueField']:_0x1b8f3c[_0x189bee]['id']});}});});});}});}})[_0x4ce3('0x25')](respondWithStatusCode(_0x29f18a,null))[_0x4ce3('0x2e')](handleError(_0x29f18a,null));};exports['getLists']=function(_0x2d6006,_0x245302,_0x432d63){var _0x569196={};var _0x30f87c={};var _0x214066;var _0x1b95b6;return db['User'][_0x4ce3('0xbf')]({'where':{'id':_0x2d6006[_0x4ce3('0x61')]['id']}})[_0x4ce3('0x25')](handleEntityNotFound(_0x245302,null))['then'](function(_0x542932){if(_0x542932){_0x214066=_0x542932;_0x30f87c[_0x4ce3('0x4a')]=_['keys'](db['CmList'][_0x4ce3('0x48')]);_0x30f87c[_0x4ce3('0x4e')]=_[_0x4ce3('0x4d')](_0x2d6006['query']);_0x30f87c[_0x4ce3('0x4f')]=_[_0x4ce3('0x50')](_0x30f87c['model'],_0x30f87c[_0x4ce3('0x4e')]);_0x569196[_0x4ce3('0x51')]=_[_0x4ce3('0x50')](_0x30f87c['model'],qs[_0x4ce3('0x63')](_0x2d6006['query'][_0x4ce3('0x63')]));_0x569196[_0x4ce3('0x51')]=_0x569196[_0x4ce3('0x51')][_0x4ce3('0x52')]?_0x569196['attributes']:_0x30f87c[_0x4ce3('0x4a')];_0x569196[_0x4ce3('0xc0')]=qs[_0x4ce3('0x55')](_0x2d6006['query'][_0x4ce3('0x55')]);_0x569196['where']=qs[_0x4ce3('0x4f')](_[_0x4ce3('0xc1')](_0x2d6006[_0x4ce3('0x4e')],_0x30f87c[_0x4ce3('0x4f')]));if(_0x2d6006['query'][_0x4ce3('0x3d')]){_0x569196['where']=_[_0x4ce3('0x57')](_0x569196[_0x4ce3('0x56')],{'$or':_[_0x4ce3('0x46')](_0x569196['attributes'],function(_0x1335c8){var _0x5a3e65={};_0x5a3e65[_0x1335c8]={'$like':'%'+_0x2d6006[_0x4ce3('0x4e')][_0x4ce3('0x3d')]+'%'};return _0x5a3e65;})});}_0x569196=_['merge']({},_0x569196,_0x2d6006[_0x4ce3('0x5b')]);return _0x214066[_0x4ce3('0x11b')](_0x569196);}})['then'](function(_0xbbae74){if(_0xbbae74){_0x1b95b6=_0xbbae74[_0x4ce3('0x52')];if(!_0x2d6006[_0x4ce3('0x4e')][_0x4ce3('0x53')](_0x4ce3('0x54'))){_0x569196[_0x4ce3('0x34')]=qs[_0x4ce3('0x34')](_0x2d6006[_0x4ce3('0x4e')][_0x4ce3('0x34')]);_0x569196[_0x4ce3('0x33')]=qs['offset'](_0x2d6006[_0x4ce3('0x4e')][_0x4ce3('0x33')]);}return _0x214066['getLists'](_0x569196);}})[_0x4ce3('0x25')](function(_0x46b185){if(_0x46b185){return _0x46b185?{'count':_0x1b95b6,'rows':_0x46b185}:null;}})[_0x4ce3('0x25')](respondWithResult(_0x245302,null))['catch'](handleError(_0x245302,null));};exports['getAgents']=function(_0x3ca02e,_0x14a2a7,_0x564ada){var _0x249ef5={};var _0xfdfdff={};var _0x42d4d5;var _0x1a878e;return db[_0x4ce3('0x47')][_0x4ce3('0xbf')]({'where':{'id':_0x3ca02e[_0x4ce3('0x61')]['id']}})[_0x4ce3('0x25')](handleEntityNotFound(_0x14a2a7,null))[_0x4ce3('0x25')](function(_0x46c98d){if(_0x46c98d){_0x42d4d5=_0x46c98d;_0xfdfdff[_0x4ce3('0x4a')]=_[_0x4ce3('0x4d')](db[_0x4ce3('0x47')][_0x4ce3('0x48')]);_0xfdfdff[_0x4ce3('0x4e')]=_['keys'](_0x3ca02e[_0x4ce3('0x4e')]);_0xfdfdff[_0x4ce3('0x4f')]=_[_0x4ce3('0x50')](_0xfdfdff['model'],_0xfdfdff[_0x4ce3('0x4e')]);_0x249ef5[_0x4ce3('0x51')]=_['intersection'](_0xfdfdff['model'],qs[_0x4ce3('0x63')](_0x3ca02e['query'][_0x4ce3('0x63')]));_0x249ef5[_0x4ce3('0x51')]=_0x249ef5[_0x4ce3('0x51')][_0x4ce3('0x52')]?_0x249ef5[_0x4ce3('0x51')]:_0xfdfdff[_0x4ce3('0x4a')];_0x249ef5[_0x4ce3('0xc0')]=qs[_0x4ce3('0x55')](_0x3ca02e[_0x4ce3('0x4e')]['sort']);_0x249ef5[_0x4ce3('0x56')]=qs[_0x4ce3('0x4f')](_[_0x4ce3('0xc1')](_0x3ca02e[_0x4ce3('0x4e')],_0xfdfdff[_0x4ce3('0x4f')]));if(_0x3ca02e['query'][_0x4ce3('0x3d')]){_0x249ef5['where']=_[_0x4ce3('0x57')](_0x249ef5[_0x4ce3('0x56')],{'$or':_['map'](_0x249ef5[_0x4ce3('0x51')],function(_0x130955){var _0x46330a={};_0x46330a[_0x130955]={'$like':'%'+_0x3ca02e[_0x4ce3('0x4e')][_0x4ce3('0x3d')]+'%'};return _0x46330a;})});}_0x249ef5[_0x4ce3('0x4a')]=db[_0x4ce3('0x47')];_0x249ef5['as']='Agents';_0x249ef5=_['merge']({},_0x249ef5,_0x3ca02e[_0x4ce3('0x5b')]);return _0x42d4d5[_0x4ce3('0xe5')]({'include':[_0x249ef5]});}})[_0x4ce3('0x25')](function(_0x5c35eb){if(_0x5c35eb){var _0x4dec5d={},_0x2f6c24=[],_0x427d9a=0x0;for(var _0x43a201=0x0;_0x43a201<_0x5c35eb['length'];_0x43a201+=0x1){for(var _0x1ede5d=0x0,_0x172421;_0x1ede5d<_0x5c35eb[_0x43a201][_0x4ce3('0x8a')][_0x4ce3('0x52')];_0x1ede5d+=0x1){_0x172421=_0x5c35eb[_0x43a201][_0x4ce3('0x8a')][_0x1ede5d][_0x4ce3('0x39')]({'plain':!![]});_0x4dec5d[_0x172421['id']]=_0x172421;}}_0x4dec5d=_['values'](_0x4dec5d);for(var _0x2bee41=qs[_0x4ce3('0x33')](_0x3ca02e['query'][_0x4ce3('0x33')]);_0x2bee41<_0x4dec5d['length']&&_0x2f6c24[_0x4ce3('0x52')]=_0x52b441){_0x4165ff=_0x52b441;_0x28c99a=0xc8;}else{_0x28c99a=0xce;}_0x213425[_0x0820('0x2e')](_0x28c99a);return _0x213425[_0x0820('0x33')](_0x0820('0x34'),_0x585cd0+'-'+_0x4165ff+'/'+_0x52b441)[_0x0820('0x2f')](_0x3cfdf6);}return null;};}function patchUpdates(_0x2eb841){return function(_0x31a5c4){try{jsonpatch['apply'](_0x31a5c4,_0x2eb841,!![]);}catch(_0x42aac9){return BPromise['reject'](_0x42aac9);}return _0x31a5c4[_0x0820('0x35')]();};}function saveUpdates(_0x43ee49,_0x4df43c){return function(_0x18c5b5){if(_0x18c5b5){return _0x18c5b5[_0x0820('0x36')](_0x43ee49)[_0x0820('0x37')](function(_0x223fa8){return _0x223fa8;});}return null;};}function removeEntity(_0xcf6619,_0x4f0d02){return function(_0x5af9d2){if(_0x5af9d2){return _0x5af9d2[_0x0820('0x38')]()[_0x0820('0x37')](function(){var _0x3fe06d=_0x5af9d2['get']({'plain':!![]});var _0x1d9bdb=[{'name':'Users','value':_0x0820('0x39'),'ignore':!![]},{'name':_0x0820('0x3a'),'value':_0x0820('0x3b'),'ignore':![]},{'name':_0x0820('0x3c'),'value':'telephone','ignore':![]}];var _0xfaf176=_(_0x1d9bdb)[_0x0820('0x3d')](_0x0820('0x3e'))[_0x0820('0x3f')](_0x0820('0x40'))['value']();if(_[_0x0820('0x41')](_0xfaf176,_0x3fe06d[_0x0820('0x42')])){return;}var _0x7ca105=_[_0x0820('0x43')](_0x1d9bdb,['value',_0x3fe06d[_0x0820('0x42')]])[_0x0820('0x44')];return db['UserProfileResource'][_0x0820('0x38')]({'where':{'type':_0x7ca105,'resourceId':_0x3fe06d['id']}})[_0x0820('0x37')](function(){return _0x5af9d2;});})[_0x0820('0x37')](function(){_0xcf6619[_0x0820('0x2e')](0xcc)[_0x0820('0x45')]();});}};}function handleEntityNotFound(_0x17b321,_0x6ebbba){return function(_0x5d160d){if(!_0x5d160d){_0x17b321[_0x0820('0x2d')](0x194);}return _0x5d160d;};}function handleError(_0x15a9cd,_0x4b9c2a){_0x4b9c2a=_0x4b9c2a||0x1f4;return function(_0x4648b9){logger['error'](_0x4648b9[_0x0820('0x46')]);if(_0x4648b9[_0x0820('0x44')]){delete _0x4648b9[_0x0820('0x44')];}_0x15a9cd[_0x0820('0x2e')](_0x4b9c2a)[_0x0820('0x47')](_0x4648b9);};}exports[_0x0820('0x48')]=function(_0x4e8a94,_0x5eb889){var _0x2a7fe8={},_0x4053b8={},_0xcf0a48={'count':0x0,'rows':[]};var _0x3baac7=_[_0x0820('0x3f')](db[_0x0820('0x49')][_0x0820('0x4a')],function(_0x2fcafa){return{'name':_0x2fcafa[_0x0820('0x4b')],'type':_0x2fcafa[_0x0820('0x4c')][_0x0820('0x4d')]};});_0x4053b8['model']=_[_0x0820('0x4e')](_[_0x0820('0x3f')](_0x3baac7,_0x0820('0x44')),[_0x0820('0x4f'),'salt']);_0x4053b8[_0x0820('0x50')]=_[_0x0820('0x51')](_0x4e8a94[_0x0820('0x50')]);_0x4053b8[_0x0820('0x52')]=_[_0x0820('0x53')](_0x4053b8[_0x0820('0x54')],_0x4053b8[_0x0820('0x50')]);_0x2a7fe8[_0x0820('0x55')]=_[_0x0820('0x53')](_0x4053b8[_0x0820('0x54')],qs[_0x0820('0x56')](_0x4e8a94[_0x0820('0x50')][_0x0820('0x56')]));_0x2a7fe8['attributes']=_0x2a7fe8[_0x0820('0x55')][_0x0820('0x57')]?_0x2a7fe8[_0x0820('0x55')]:_0x4053b8[_0x0820('0x54')];if(!_0x4e8a94[_0x0820('0x50')]['hasOwnProperty'](_0x0820('0x58'))){_0x2a7fe8[_0x0820('0x32')]=qs[_0x0820('0x32')](_0x4e8a94[_0x0820('0x50')][_0x0820('0x32')]);_0x2a7fe8[_0x0820('0x31')]=qs[_0x0820('0x31')](_0x4e8a94[_0x0820('0x50')][_0x0820('0x31')]);}_0x2a7fe8['order']=qs[_0x0820('0x59')](_0x4e8a94[_0x0820('0x50')][_0x0820('0x59')]);_0x2a7fe8['where']=qs[_0x0820('0x52')](_[_0x0820('0x5a')](_0x4e8a94['query'],_0x4053b8[_0x0820('0x52')]),_0x3baac7);if(_0x4e8a94[_0x0820('0x50')][_0x0820('0x3d')]){_0x2a7fe8[_0x0820('0x5b')]=_[_0x0820('0x5c')](_0x2a7fe8['where'],{'$or':_['map'](_0x3baac7,function(_0x3a23b9){if(_0x3a23b9[_0x0820('0x4c')]!=='VIRTUAL'){return db[_0x0820('0x5d')][_0x0820('0x5b')](db[_0x0820('0x5d')]['fn'](_0x0820('0x5e'),db['sequelize'][_0x0820('0x5f')](_0x3a23b9['name'])),{'$like':db[_0x0820('0x5d')]['fn'](_0x0820('0x5e'),'%'+_0x4e8a94[_0x0820('0x50')][_0x0820('0x3d')]+'%')});}})});}_0x2a7fe8=_[_0x0820('0x5c')]({},_0x2a7fe8,_0x4e8a94[_0x0820('0x60')]);var _0x2da950={'where':_0x2a7fe8[_0x0820('0x5b')]};return db['User'][_0x0820('0x30')](_0x2da950)['then'](function(_0x36052a){_0xcf0a48[_0x0820('0x30')]=_0x36052a;if(_0x4e8a94[_0x0820('0x50')][_0x0820('0x61')]){_0x2a7fe8[_0x0820('0x62')]=[{'all':!![]}];}return db[_0x0820('0x49')][_0x0820('0x63')](_0x2a7fe8);})[_0x0820('0x37')](function(_0x327295){_0xcf0a48[_0x0820('0x64')]=_0x327295;return _0xcf0a48;})[_0x0820('0x37')](respondWithFilteredResult(_0x5eb889,_0x2a7fe8))[_0x0820('0x2c')](handleError(_0x5eb889,null));};exports[_0x0820('0x65')]=function(_0xa9554d,_0x32e06a){var _0x3d484d={'raw':![],'where':{'id':_0xa9554d[_0x0820('0x66')]['id']}},_0x38bf27={};_0x38bf27[_0x0820('0x54')]=_[_0x0820('0x4e')](_['keys'](db[_0x0820('0x49')]['rawAttributes']),['password',_0x0820('0x67')]);_0x38bf27[_0x0820('0x50')]=_[_0x0820('0x51')](_0xa9554d['query']);_0x38bf27['filters']=_[_0x0820('0x53')](_0x38bf27[_0x0820('0x54')],_0x38bf27[_0x0820('0x50')]);_0x3d484d['attributes']=_[_0x0820('0x53')](_0x38bf27[_0x0820('0x54')],qs[_0x0820('0x56')](_0xa9554d[_0x0820('0x50')]['fields']));_0x3d484d[_0x0820('0x55')]=_0x3d484d[_0x0820('0x55')]['length']?_0x3d484d[_0x0820('0x55')]:_0x38bf27['model'];if(_0xa9554d[_0x0820('0x50')][_0x0820('0x61')]){_0x3d484d[_0x0820('0x62')]=[{'all':!![]}];}_0x3d484d=_[_0x0820('0x5c')]({},_0x3d484d,_0xa9554d['options']);return db['User']['find'](_0x3d484d)[_0x0820('0x37')](handleEntityNotFound(_0x32e06a,null))[_0x0820('0x37')](respondWithResult(_0x32e06a,null))[_0x0820('0x2c')](handleError(_0x32e06a,null));};exports[_0x0820('0x68')]=function(_0x549559,_0x3a6120){return db[_0x0820('0x49')][_0x0820('0x68')](_0x549559['body'],{'raw':![],'individualHooks':!![]})[_0x0820('0x37')](respondWithResult(_0x3a6120,0xc9))[_0x0820('0x2c')](handleError(_0x3a6120,null));};exports[_0x0820('0x36')]=function(_0x235950,_0x4aea85){if(_0x235950[_0x0820('0x69')]['id']){delete _0x235950[_0x0820('0x69')]['id'];}delete _0x235950['body'][_0x0820('0x42')];return db[_0x0820('0x49')][_0x0820('0x43')]({'where':{'id':_0x235950[_0x0820('0x66')]['id']}})[_0x0820('0x37')](handleEntityNotFound(_0x4aea85,null))[_0x0820('0x37')](saveUpdates(_0x235950[_0x0820('0x69')],null))[_0x0820('0x37')](respondWithResult(_0x4aea85,null))[_0x0820('0x2c')](handleError(_0x4aea85,null));};exports[_0x0820('0x6a')]=function(_0x1dc580,_0x851998){return db[_0x0820('0x49')][_0x0820('0x6a')]()['then'](respondWithResult(_0x851998,null))[_0x0820('0x2c')](handleError(_0x851998,null));};exports[_0x0820('0x6b')]=function(_0x4c0178,_0x809e7,_0x4bdd66){return db[_0x0820('0x49')][_0x0820('0x43')]({'where':{'id':_0x4c0178[_0x0820('0x66')]['id']}})[_0x0820('0x37')](handleEntityNotFound(_0x809e7,null))[_0x0820('0x37')](function(_0x3aabcb){if(_0x3aabcb){return _0x3aabcb[_0x0820('0x6b')](_0x4c0178[_0x0820('0x69')]['ids'],_[_0x0820('0x6c')](_0x4c0178[_0x0820('0x69')],[_0x0820('0x6d'),'id'])||{});}})[_0x0820('0x37')](respondWithResult(_0x809e7,null))[_0x0820('0x2c')](handleError(_0x809e7,null));};var getLicense=function(_0x28a20c){return new BPromise(function(_0x2e4f7f,_0x100778){var _0x1e1e7d=0x0;_0x28a20c['body'][_0x0820('0x42')]===_0x0820('0x3b')&&_0x2e4f7f('agent\x20role');return db[_0x0820('0x49')][_0x0820('0x30')]({'where':{'$or':[{'role':_0x28a20c[_0x0820('0x69')][_0x0820('0x42')]===_0x0820('0x6e')?_0x0820('0x6e'):[_0x0820('0x6f'),_0x0820('0x39')]}]}})[_0x0820('0x37')](function(_0x179855){_0x1e1e7d=_0x179855;return require('../../config/license/util')['getLicense']();})[_0x0820('0x37')](function(_0x17fd34){var _0x4e6744=_0x28a20c[_0x0820('0x69')][_0x0820('0x42')]===_0x0820('0x6e')?_0x0820('0x70'):_0x0820('0x71');if(!_['isNil'](_0x17fd34[_0x4e6744])&&_0x1e1e7d>=_0x17fd34[_0x4e6744]){return _0x100778({'message':_0x0820('0x72')});}return _0x2e4f7f(util[_0x0820('0x73')](_0x0820('0x74'),_0x4e6744,_0x1e1e7d));})[_0x0820('0x2c')](function(_0x40a7ee){return _0x100778(_0x40a7ee);});});};exports[_0x0820('0x75')]=function(_0x4ca303,_0x5bb41f){return getLicense(_0x4ca303)[_0x0820('0x37')](function(_0x54c7bc){if(!_0x4ca303['body'][_0x0820('0x76')]){var _0x1429c8;return db['Setting']['findById'](0x1)[_0x0820('0x37')](function(_0x2ed3d7){return checkPasswordPattern(_0x2ed3d7,_0x4ca303[_0x0820('0x69')][_0x0820('0x4f')],_0x2ed3d7[_0x0820('0x77')]);})[_0x0820('0x37')](function(_0x2f979a){_0x1429c8=_0x2f979a[_0x0820('0x78')];return db[_0x0820('0x49')]['max'](_0x0820('0x76'));})[_0x0820('0x37')](function(_0x1a3622){if(_[_0x0820('0x79')](_0x1a3622)){if(_0x1429c8){_0x4ca303[_0x0820('0x69')][_0x0820('0x76')]=_0x1429c8;}else{_0x4ca303['body'][_0x0820('0x76')]=0x1;}}else{if(_[_0x0820('0x79')](_0x1429c8)||_0x1429c8==_0x1a3622){_0x4ca303[_0x0820('0x69')]['internal']=_0x1a3622+0x1;}else if(_0x1429c8>_0x1a3622){_0x4ca303[_0x0820('0x69')]['internal']=_0x1429c8;}else{return db[_0x0820('0x5d')]['query'](_0x0820('0x7a'),{'type':db[_0x0820('0x5d')][_0x0820('0x7b')][_0x0820('0x7c')]})[_0x0820('0x37')](function(_0x132d95){if(_0x132d95&&_0x132d95[_0x0820('0x57')]){for(var _0x3e1458=0x0,_0xff06b8=_0x132d95['length'];_0x3e1458<_0xff06b8&&_[_0x0820('0x79')](_0x4ca303[_0x0820('0x69')][_0x0820('0x76')]);_0x3e1458++){if(_0x1429c8<=_0x132d95[_0x3e1458][_0x0820('0x7d')]){_0x4ca303['body'][_0x0820('0x76')]=_0x132d95[_0x3e1458][_0x0820('0x7d')];}else if(_0x1429c8>_0x132d95[_0x3e1458][_0x0820('0x7d')]&&_0x1429c8<=_0x132d95[_0x3e1458]['to']){_0x4ca303[_0x0820('0x69')][_0x0820('0x76')]=_0x1429c8;}}}if(_['isNil'](_0x4ca303['body'][_0x0820('0x76')])){_0x4ca303[_0x0820('0x69')][_0x0820('0x76')]=_0x1a3622+0x1;}});}}});}})[_0x0820('0x37')](function(){if(_0x4ca303['body']['voicemail']){_0x4ca303['body'][_0x0820('0x7e')]=_0x4ca303[_0x0820('0x69')][_0x0820('0x76')];_0x4ca303[_0x0820('0x69')][_0x0820('0x7f')]={'mailbox':_0x4ca303[_0x0820('0x69')]['internal'],'password':_0x4ca303['body'][_0x0820('0x4f')],'fullname':_0x4ca303['body']['fullname'],'email':_0x4ca303[_0x0820('0x69')][_0x0820('0x80')]};}if(_0x4ca303['body']&&_0x4ca303[_0x0820('0x69')]['role']===_0x0820('0x3b')){if(!_0x4ca303[_0x0820('0x69')]['permissions']){_0x4ca303[_0x0820('0x69')][_0x0820('0x81')]=[_0x0820('0x82'),'102','103',_0x0820('0x83'),_0x0820('0x84'),'104',_0x0820('0x85'),_0x0820('0x86'),_0x0820('0x87'),_0x0820('0x88'),'109',_0x0820('0x89'),_0x0820('0x8a'),'114'];}}return db[_0x0820('0x49')][_0x0820('0x75')](_0x4ca303[_0x0820('0x69')],{'include':[{'model':db[_0x0820('0x7f')],'as':'VoiceMail'}]});})['then'](function(_0x2ea560){if(_0x4ca303[_0x0820('0x69')][_0x0820('0x42')]===_0x0820('0x39'))return _0x2ea560;var _0x2637ee=_0x4ca303[_0x0820('0x39')][_0x0820('0x8b')]({'plain':!![]});if(!_0x2637ee)throw new Error(_0x0820('0x8c'));if(_0x2637ee[_0x0820('0x42')]==='user'){var _0x4982ae=_0x2ea560[_0x0820('0x8b')]({'plain':!![]});var _0x1838f4=[{'name':_0x0820('0x3a'),'value':_0x0820('0x3b')},{'name':_0x0820('0x3c'),'value':_0x0820('0x6e')}];var _0x39c20f=_['find'](_0x1838f4,['value',_0x4982ae['role']])['name'];return db[_0x0820('0x8d')][_0x0820('0x43')]({'where':{'name':_0x39c20f,'userProfileId':_0x2637ee[_0x0820('0x8e')]},'raw':!![]})[_0x0820('0x37')](function(_0x3da48b){if(_0x3da48b&&_0x3da48b[_0x0820('0x8f')]===0x0){return db['UserProfileResource']['create']({'name':_0x4982ae[_0x0820('0x44')],'resourceId':_0x4982ae['id'],'type':_0x3da48b[_0x0820('0x44')],'sectionId':_0x3da48b['id']},{})[_0x0820('0x37')](function(){return _0x2ea560;});}else{return _0x2ea560;}})[_0x0820('0x2c')](function(_0x394620){logger[_0x0820('0x29')](_0x0820('0x90'),_0x394620);throw _0x394620;});}return _0x2ea560;})[_0x0820('0x37')](respondWithResult(_0x5bb41f,0xc9))[_0x0820('0x2c')](handleError(_0x5bb41f,null));};exports[_0x0820('0x91')]=function(_0x3bde07,_0x1b1b0c,_0x56fe39){var _0x95d867=![];if(_0x3bde07['body']['id']){delete _0x3bde07[_0x0820('0x69')]['id'];}return db[_0x0820('0x92')][_0x0820('0x93')]({'attributes':['id',_0x0820('0x77')]})['then'](function(_0x222a17){_0x95d867=_0x222a17['securePassword'];return db['User'][_0x0820('0x43')]({'where':{'id':_0x3bde07[_0x0820('0x66')]['id']}});})['then'](function(_0x501798){if(_0x501798){if(_0x501798['id']==_0x3bde07[_0x0820('0x39')]['id']){if(!_0x3bde07['body'][_0x0820('0x94')]||!_0x3bde07['body'][_0x0820('0x95')]){throw new db[(_0x0820('0x20'))][(_0x0820('0x96'))](_0x0820('0x97'));}if(!_0x501798[_0x0820('0x98')](_0x3bde07[_0x0820('0x69')][_0x0820('0x94')])){throw new db[(_0x0820('0x20'))][(_0x0820('0x96'))](_0x0820('0x99'));}if(_0x3bde07[_0x0820('0x69')]['oldPassword']==_0x3bde07['body'][_0x0820('0x95')]){throw new db['Sequelize'][(_0x0820('0x96'))](_0x0820('0x9a'));}return _0x501798;}else if(_0x3bde07[_0x0820('0x39')][_0x0820('0x42')]==_0x0820('0x6f')){if(!_0x3bde07[_0x0820('0x69')][_0x0820('0x95')]){throw new db['Sequelize'][(_0x0820('0x96'))](_0x0820('0x9b'));}return _0x501798;}else if(_0x3bde07['user'][_0x0820('0x42')]==_0x0820('0x39')){if(!_0x3bde07[_0x0820('0x69')][_0x0820('0x95')]){throw new db[(_0x0820('0x20'))][(_0x0820('0x96'))](_0x0820('0x9b'));}if(_0x501798[_0x0820('0x42')]!='agent'){throw new db[(_0x0820('0x20'))][(_0x0820('0x96'))](_0x0820('0x9c'));}return _0x501798;}else{throw new db['Sequelize']['ValidationError'](_0x0820('0x9c'));}}return null;})[_0x0820('0x37')](handleEntityNotFound(_0x1b1b0c,null))[_0x0820('0x37')](function(_0x11facc){return checkPasswordPattern(_0x11facc,_0x3bde07[_0x0820('0x69')][_0x0820('0x95')],_0x95d867);})['then'](saveUpdates({'password':_0x3bde07[_0x0820('0x69')]['newPassword'],'passwordResetAt':_0x3bde07[_0x0820('0x39')]['id']==_0x3bde07[_0x0820('0x66')]['id']?moment():null},null))['then'](respondWithResult(_0x1b1b0c,null))['catch'](handleError(_0x1b1b0c,null));};exports[_0x0820('0x9d')]=function(_0x5f3a94,_0x4b419d,_0x401265){var _0x138d42=_0x5f3a94[_0x0820('0x69')][_0x0820('0x9e')];return db[_0x0820('0x49')][_0x0820('0x43')]({'where':{'id':_0x5f3a94[_0x0820('0x66')]['id']},'attributes':['id',_0x0820('0x44'),_0x0820('0x42'),_0x0820('0x9f'),'loginInPause',_0x0820('0xa0'),_0x0820('0xa1')]})[_0x0820('0x37')](handleEntityNotFound(_0x4b419d,null))[_0x0820('0x37')](function(_0x57a691){if(_0x57a691){if(!utils[_0x0820('0xa2')](_0x138d42)){throw new db[(_0x0820('0x20'))]['ValidationError'](_0x0820('0xa3'));}return _0x57a691[_0x0820('0xa4')+_[_0x0820('0xa5')](_0x138d42['toLowerCase']())+_0x0820('0xa6')](_0x5f3a94[_0x0820('0x69')][_0x0820('0x6d')],{'penalty':_0x5f3a94['body']['penalty']||0x0})[_0x0820('0xa7')](function(_0xeb2717){for(var _0x1474a5=0x0;_0x1474a5<_0x5f3a94[_0x0820('0x69')][_0x0820('0x6d')][_0x0820('0x57')];_0x1474a5+=0x1){var _0x5c59c9={'UserId':_0x5f3a94['params']['id']};_0x5c59c9[_[_0x0820('0xa5')](_0x138d42[_0x0820('0xa8')]())+_0x0820('0xa9')]=_0x5f3a94['body'][_0x0820('0x6d')][_0x1474a5];socket[_0x0820('0xaa')]('user'+_['capitalize'](_0x138d42[_0x0820('0xa8')]())+_0x0820('0xab'),_0x5c59c9);}return _0xeb2717;})[_0x0820('0x37')](function(){if(_0x138d42===_0x0820('0xac')){return db['VoiceQueue']['findAll']({'where':{'id':_0x5f3a94[_0x0820('0x69')][_0x0820('0x6d')]||[]},'raw':!![],'attributes':['id','name']});}})[_0x0820('0x37')](function(_0x3c8df9){var _0x2a60e7=_0x57a691[_0x0820('0x8b')]({'plain':!![]});var _0x489e64=[];if(_0x138d42===_0x0820('0xac')&&_0x2a60e7[_0x0820('0x42')]===_0x0820('0x3b')&&_0x2a60e7[_0x0820('0x9f')]){for(var _0x155992=0x0;_0x155992<_0x3c8df9[_0x0820('0x57')];_0x155992+=0x1){_0x489e64[_0x0820('0xad')]({'membername':_0x2a60e7[_0x0820('0x44')],'UserId':_0x2a60e7['id'],'queue_name':_0x3c8df9[_0x155992]['name'],'VoiceQueueId':_0x3c8df9[_0x155992]['id'],'interface':_[_0x0820('0x79')](_0x2a60e7[_0x0820('0xa1')])?util['format'](_0x0820('0xae'),_0x2a60e7[_0x0820('0x44')]):_0x2a60e7[_0x0820('0xa1')],'paused':_0x2a60e7[_0x0820('0xa0')]||![],'penalty':_0x5f3a94[_0x0820('0x69')]['penalty']||0x0});}return BPromise[_0x0820('0xaf')](_0x489e64,function(_0x23b20c){return db['UserVoiceQueueRt'][_0x0820('0xb0')](_0x23b20c);});}return _0x57a691;});}})[_0x0820('0x37')](respondWithStatusCode(_0x4b419d,null))[_0x0820('0x2c')](handleError(_0x4b419d,null));};exports['removeQueues']=function(_0x50a8fa,_0x2afa84,_0x36d02d){var _0x209be5;return db['User']['find']({'where':{'id':_0x50a8fa[_0x0820('0x66')]['id']},'attributes':['id','name',_0x0820('0x42')]})[_0x0820('0x37')](handleEntityNotFound(_0x2afa84,null))[_0x0820('0x37')](function(_0x3361f5){if(_0x3361f5){_0x209be5=_0x3361f5;if(!_0x50a8fa[_0x0820('0x50')][_0x0820('0x9e')]||!utils[_0x0820('0xa2')](_0x50a8fa[_0x0820('0x50')][_0x0820('0x9e')])){throw new db[(_0x0820('0x20'))][(_0x0820('0x96'))](_0x0820('0xa3'));}return _0x3361f5[_0x0820('0xb1')+_[_0x0820('0xa5')](_0x50a8fa['query'][_0x0820('0x9e')][_0x0820('0xa8')]())+_0x0820('0xa6')](_0x50a8fa[_0x0820('0x50')][_0x0820('0x6d')]);}})[_0x0820('0x37')](function(_0x11e280){for(var _0x27c164=0x0;_0x27c164<_0x50a8fa[_0x0820('0x50')][_0x0820('0x6d')]['length'];_0x27c164+=0x1){var _0x4761a8={'UserId':_0x50a8fa[_0x0820('0x66')]['id']};_0x4761a8[_[_0x0820('0xa5')](_0x50a8fa[_0x0820('0x50')][_0x0820('0x9e')][_0x0820('0xa8')]())+_0x0820('0xa9')]=_0x50a8fa[_0x0820('0x50')][_0x0820('0x6d')][_0x27c164];socket[_0x0820('0xaa')](_0x0820('0x39')+_[_0x0820('0xa5')](_0x50a8fa[_0x0820('0x50')][_0x0820('0x9e')][_0x0820('0xa8')]())+_0x0820('0xb2'),_0x4761a8);}return _0x11e280;})[_0x0820('0x37')](function(){if(_0x50a8fa[_0x0820('0x50')][_0x0820('0x9e')]===_0x0820('0xac')){return db[_0x0820('0xb3')][_0x0820('0x38')]({'where':{'UserId':_0x50a8fa['params']['id'],'VoiceQueueId':_0x50a8fa[_0x0820('0x50')][_0x0820('0x6d')]},'individualHooks':!![]})[_0x0820('0x37')](function(){return _0x209be5;});}return _0x209be5;})[_0x0820('0x37')](respondWithStatusCode(_0x2afa84,null))[_0x0820('0x2c')](handleError(_0x2afa84,null));};exports[_0x0820('0xb4')]=function(_0x8beb2f,_0x7aaa5c,_0x5b1a6b){_0x8beb2f[_0x0820('0x69')][_0x0820('0xb5')]=_0x8beb2f[_0x0820('0xb6')][_0x0820('0xb7')];return db['User'][_0x0820('0x43')]({'where':{'id':_0x8beb2f[_0x0820('0x66')]['id']}})['then'](handleEntityNotFound(_0x7aaa5c,null))[_0x0820('0x37')](saveUpdates(_0x8beb2f[_0x0820('0x69')],null))['then'](respondWithResult(_0x7aaa5c,null))['catch'](handleError(_0x7aaa5c,null));};exports['getAvatar']=function(_0x32369f,_0x4c7e03,_0x4b75a4){var _0x4a5916=path['join'](config[_0x0820('0xb8')],_0x0820('0xb9'));return db['User'][_0x0820('0x43')]({'where':{'id':_0x32369f[_0x0820('0x66')]['id']},'attributes':['id','userpic'],'raw':!![]})[_0x0820('0x37')](handleEntityNotFound(_0x4c7e03,null))['then'](function(_0x5bb3f2){if(_0x5bb3f2){if(_[_0x0820('0x79')](_0x5bb3f2['userpic'])){return _0x4c7e03[_0x0820('0xba')](_0x4a5916);}else{if(!fs[_0x0820('0xbb')](path['join'](config[_0x0820('0xb8')],_0x0820('0xbc'),_0x5bb3f2[_0x0820('0xb5')]))){return _0x4c7e03[_0x0820('0xba')](_0x4a5916);}return _0x4c7e03[_0x0820('0xba')](path['join'](config['root'],_0x0820('0xbc'),_0x5bb3f2[_0x0820('0xb5')]));}}})[_0x0820('0x2c')](handleError(_0x4c7e03,null));};exports[_0x0820('0xbd')]=function(_0x19b355,_0xc0cdad,_0x144207){var _0x5db8ac={};var _0x540277={};var _0x503961;var _0x19c0de;return db[_0x0820('0x49')][_0x0820('0x93')]({'where':{'id':_0x19b355[_0x0820('0x66')]['id']}})['then'](handleEntityNotFound(_0xc0cdad,null))[_0x0820('0x37')](function(_0x2952cf){if(_0x2952cf){_0x503961=_0x2952cf;_0x540277[_0x0820('0x54')]=_[_0x0820('0x51')](db['CmContact'][_0x0820('0x4a')]);_0x540277['query']=_[_0x0820('0x51')](_0x19b355[_0x0820('0x50')]);_0x540277['filters']=_['intersection'](_0x540277[_0x0820('0x54')],_0x540277['query']);_0x5db8ac[_0x0820('0x55')]=_[_0x0820('0x53')](_0x540277[_0x0820('0x54')],qs[_0x0820('0x56')](_0x19b355[_0x0820('0x50')][_0x0820('0x56')]));_0x5db8ac[_0x0820('0x55')]=_0x5db8ac[_0x0820('0x55')][_0x0820('0x57')]?_0x5db8ac['attributes']:_0x540277[_0x0820('0x54')];_0x5db8ac['order']=qs[_0x0820('0x59')](_0x19b355['query'][_0x0820('0x59')]);_0x5db8ac[_0x0820('0x5b')]=qs[_0x0820('0x52')](_['pick'](_0x19b355[_0x0820('0x50')],_0x540277[_0x0820('0x52')]));if(_0x19b355[_0x0820('0x50')][_0x0820('0x3d')]){_0x5db8ac[_0x0820('0x5b')]=_[_0x0820('0x5c')](_0x5db8ac[_0x0820('0x5b')],{'$or':_[_0x0820('0x3f')](_0x5db8ac[_0x0820('0x55')],function(_0x3743e9){var _0x37d12b={};_0x37d12b[_0x3743e9]={'$like':'%'+_0x19b355['query']['filter']+'%'};return _0x37d12b;})});}_0x5db8ac=_[_0x0820('0x5c')]({},_0x5db8ac,_0x19b355['options']);return _0x503961[_0x0820('0xbd')](_0x5db8ac);}})[_0x0820('0x37')](function(_0x268601){if(_0x268601){_0x19c0de=_0x268601['length'];if(_0x19b355[_0x0820('0x50')][_0x0820('0xbe')]('includeAll')){_0x5db8ac[_0x0820('0x62')]=[{'model':db['CmList'],'as':_0x0820('0xbf'),'required':![]},{'model':db['Tag'],'as':'Tags','attributes':['id',_0x0820('0x44'),_0x0820('0xc0')],'where':_0x19b355[_0x0820('0x50')][_0x0820('0xc1')]?{'id':_0x19b355[_0x0820('0x50')][_0x0820('0xc1')]}:undefined,'required':_0x19b355['query'][_0x0820('0xc1')]?!![]:![]}];}if(!_0x19b355[_0x0820('0x50')]['hasOwnProperty'](_0x0820('0x58'))){_0x5db8ac[_0x0820('0x32')]=qs[_0x0820('0x32')](_0x19b355[_0x0820('0x50')]['limit']);_0x5db8ac[_0x0820('0x31')]=qs[_0x0820('0x31')](_0x19b355['query'][_0x0820('0x31')]);}return _0x503961[_0x0820('0xbd')](_0x5db8ac);}})['then'](function(_0x597891){if(_0x597891){return _0x597891?{'count':_0x19c0de,'rows':_0x597891}:null;}})[_0x0820('0x37')](respondWithResult(_0xc0cdad,null))[_0x0820('0x2c')](handleError(_0xc0cdad,null));};exports[_0x0820('0xc2')]=function(_0x2c72e1,_0x472084,_0x4e5f5a){var _0x3ea2a8;var _0x47b4f8;var _0x506319={};var _0xa14c95;return db['User'][_0x0820('0x93')]({'where':{'id':_0x2c72e1[_0x0820('0x66')]['id']},'attributes':['id',_0x0820('0x44'),_0x0820('0x42')]})[_0x0820('0x37')](handleEntityNotFound(_0x472084,null))[_0x0820('0x37')](function(_0xf7ebbf){if(!utils[_0x0820('0xa2')](_0x2c72e1[_0x0820('0x50')][_0x0820('0x9e')])){throw new db['Sequelize'][(_0x0820('0x96'))]('Unknown\x20channel');}_0x3ea2a8=_0xf7ebbf;var _0x31a582={};_0x31a582[_0x0820('0x54')]=_[_0x0820('0x51')](db[_[_0x0820('0xa5')](_0x2c72e1['query'][_0x0820('0x9e')])+_0x0820('0xc3')]['rawAttributes']);_0x31a582[_0x0820('0x50')]=_['keys'](_0x2c72e1[_0x0820('0x50')]);_0x31a582[_0x0820('0x52')]=_[_0x0820('0x53')](_0x31a582[_0x0820('0x54')],_0x31a582['query']);_0x506319[_0x0820('0x55')]=_[_0x0820('0x53')](_0x31a582['model'],qs['fields'](_0x2c72e1['query'][_0x0820('0x56')]));_0x506319['attributes']=_0x506319['attributes']['length']?_0x506319[_0x0820('0x55')]:_0x31a582[_0x0820('0x54')];_0x506319['order']=qs['sort'](_0x2c72e1[_0x0820('0x50')][_0x0820('0x59')]);_0x506319[_0x0820('0x5b')]=qs[_0x0820('0x52')](_[_0x0820('0x5a')](_0x2c72e1[_0x0820('0x50')],_0x31a582[_0x0820('0x52')]));if(_0x2c72e1['query']['filter']){_0x506319[_0x0820('0x5b')]=_[_0x0820('0x5c')](_0x506319[_0x0820('0x5b')],{'$or':_[_0x0820('0x3f')](_0x506319[_0x0820('0x55')],function(_0xfbdf0b){var _0x546cb9={};_0x546cb9[_0xfbdf0b]={'$like':'%'+_0x2c72e1[_0x0820('0x50')]['filter']+'%'};return _0x546cb9;})});}_0x506319=_[_0x0820('0x5c')]({},_0x506319,_0x2c72e1[_0x0820('0x60')]);switch(_0x3ea2a8[_0x0820('0x42')]){case _0x0820('0x6f'):return db[_['capitalize'](_0x2c72e1[_0x0820('0x50')][_0x0820('0x9e')])+_0x0820('0xc3')]['findAll'](_0x506319);case _0x0820('0x39'):case'agent':return _0x3ea2a8['get'+_[_0x0820('0xa5')](_0x2c72e1[_0x0820('0x50')][_0x0820('0x9e')])+_0x0820('0xa6')](_0x506319);default:throw new db[(_0x0820('0x20'))][(_0x0820('0x96'))](_0x0820('0xc4'));}})['then'](function(_0x4fa70a){_0xa14c95=_0x4fa70a[_0x0820('0x57')];if(!_0x2c72e1['query'][_0x0820('0xbe')](_0x0820('0x58'))){_0x506319[_0x0820('0x32')]=qs['limit'](_0x2c72e1[_0x0820('0x50')][_0x0820('0x32')]);_0x506319[_0x0820('0x31')]=qs['offset'](_0x2c72e1[_0x0820('0x50')][_0x0820('0x31')]);}switch(_0x3ea2a8[_0x0820('0x42')]){case _0x0820('0x6f'):return db[_[_0x0820('0xa5')](_0x2c72e1[_0x0820('0x50')][_0x0820('0x9e')])+_0x0820('0xc3')]['findAll'](_0x506319);case _0x0820('0x39'):case'agent':return _0x3ea2a8[_0x0820('0x8b')+_[_0x0820('0xa5')](_0x2c72e1[_0x0820('0x50')][_0x0820('0x9e')])+'Queues'](_0x506319);}})['then'](function(_0x2091b0){return{'count':_0xa14c95,'rows':_0x2091b0};})[_0x0820('0x37')](respondWithResult(_0x472084,null))[_0x0820('0x2c')](handleError(_0x472084,null));};exports['getVoiceQueuesRt']=function(_0x16b886,_0x309c58,_0x5237e9){var _0x363cde={};var _0x7e25c3={};var _0x1853d4;var _0x4dd12c;return db[_0x0820('0x49')]['findOne']({'where':{'id':_0x16b886[_0x0820('0x66')]['id']}})['then'](handleEntityNotFound(_0x309c58,null))[_0x0820('0x37')](function(_0x4a63a7){if(_0x4a63a7){_0x1853d4=_0x4a63a7;_0x7e25c3[_0x0820('0x54')]=_[_0x0820('0x51')](db['UserVoiceQueueRt'][_0x0820('0x4a')]);_0x7e25c3[_0x0820('0x50')]=_[_0x0820('0x51')](_0x16b886[_0x0820('0x50')]);_0x7e25c3[_0x0820('0x52')]=_[_0x0820('0x53')](_0x7e25c3[_0x0820('0x54')],_0x7e25c3[_0x0820('0x50')]);_0x363cde[_0x0820('0x55')]=_[_0x0820('0x53')](_0x7e25c3[_0x0820('0x54')],qs[_0x0820('0x56')](_0x16b886[_0x0820('0x50')][_0x0820('0x56')]));_0x363cde['attributes']=_0x363cde['attributes']['length']?_0x363cde['attributes']:_0x7e25c3[_0x0820('0x54')];_0x363cde[_0x0820('0xc5')]=qs[_0x0820('0x59')](_0x16b886[_0x0820('0x50')][_0x0820('0x59')]);_0x363cde[_0x0820('0x5b')]=qs[_0x0820('0x52')](_[_0x0820('0x5a')](_0x16b886[_0x0820('0x50')],_0x7e25c3[_0x0820('0x52')]));if(_0x16b886['query'][_0x0820('0x3d')]){_0x363cde[_0x0820('0x5b')]=_[_0x0820('0x5c')](_0x363cde['where'],{'$or':_['map'](_0x363cde[_0x0820('0x55')],function(_0x23f9cc){var _0x10e67a={};_0x10e67a[_0x23f9cc]={'$like':'%'+_0x16b886[_0x0820('0x50')][_0x0820('0x3d')]+'%'};return _0x10e67a;})});}_0x363cde=_[_0x0820('0x5c')]({},_0x363cde,_0x16b886[_0x0820('0x60')]);return _0x1853d4[_0x0820('0xc6')](_0x363cde);}})[_0x0820('0x37')](function(_0x45dd3f){if(_0x45dd3f){_0x4dd12c=_0x45dd3f['length'];if(!_0x16b886[_0x0820('0x50')][_0x0820('0xbe')](_0x0820('0x58'))){_0x363cde['limit']=qs[_0x0820('0x32')](_0x16b886['query']['limit']);_0x363cde['offset']=qs[_0x0820('0x31')](_0x16b886[_0x0820('0x50')][_0x0820('0x31')]);}return _0x1853d4[_0x0820('0xc6')](_0x363cde);}})[_0x0820('0x37')](function(_0x3d9e7b){if(_0x3d9e7b){return _0x3d9e7b?{'count':_0x4dd12c,'rows':_0x3d9e7b}:null;}})[_0x0820('0x37')](respondWithResult(_0x309c58,null))['catch'](handleError(_0x309c58,null));};exports[_0x0820('0xc7')]=function(_0x4a3e99,_0x14b694,_0x518580){var _0xbd645a={};var _0x5d3afb={};var _0xd7f9b2;var _0x122a38;return db[_0x0820('0x49')][_0x0820('0x93')]({'where':{'id':_0x4a3e99[_0x0820('0x66')]['id']}})[_0x0820('0x37')](handleEntityNotFound(_0x14b694,null))['then'](function(_0x3fb3de){if(_0x3fb3de){_0xd7f9b2=_0x3fb3de;_0x5d3afb[_0x0820('0x54')]=_['keys'](db['ChatGroup']['rawAttributes']);_0x5d3afb[_0x0820('0x50')]=_[_0x0820('0x51')](_0x4a3e99[_0x0820('0x50')]);_0x5d3afb[_0x0820('0x52')]=_[_0x0820('0x53')](_0x5d3afb[_0x0820('0x54')],_0x5d3afb['query']);_0xbd645a[_0x0820('0x55')]=_[_0x0820('0x53')](_0x5d3afb['model'],qs[_0x0820('0x56')](_0x4a3e99[_0x0820('0x50')]['fields']));_0xbd645a['attributes']=_0xbd645a['attributes'][_0x0820('0x57')]?_0xbd645a['attributes']:_0x5d3afb[_0x0820('0x54')];_0xbd645a['order']=qs[_0x0820('0x59')](_0x4a3e99[_0x0820('0x50')][_0x0820('0x59')]);_0xbd645a[_0x0820('0x5b')]=qs['filters'](_[_0x0820('0x5a')](_0x4a3e99[_0x0820('0x50')],_0x5d3afb[_0x0820('0x52')]));if(_0x4a3e99['query'][_0x0820('0x3d')]){_0xbd645a[_0x0820('0x5b')]=_['merge'](_0xbd645a[_0x0820('0x5b')],{'$or':_['map'](_0xbd645a[_0x0820('0x55')],function(_0x26e0fa){var _0x4458df={};_0x4458df[_0x26e0fa]={'$like':'%'+_0x4a3e99['query']['filter']+'%'};return _0x4458df;})});}_0xbd645a=_[_0x0820('0x5c')]({},_0xbd645a,_0x4a3e99['options']);return _0xd7f9b2[_0x0820('0xc7')](_0xbd645a);}})[_0x0820('0x37')](function(_0x54c930){if(_0x54c930){_0x122a38=_0x54c930[_0x0820('0x57')];if(!_0x4a3e99[_0x0820('0x50')][_0x0820('0xbe')](_0x0820('0x58'))){_0xbd645a[_0x0820('0x32')]=qs[_0x0820('0x32')](_0x4a3e99[_0x0820('0x50')][_0x0820('0x32')]);_0xbd645a[_0x0820('0x31')]=qs['offset'](_0x4a3e99[_0x0820('0x50')][_0x0820('0x31')]);}return _0xd7f9b2[_0x0820('0xc7')](_0xbd645a);}})['then'](function(_0x34f155){if(_0x34f155){return _0x34f155?{'count':_0x122a38,'rows':_0x34f155}:null;}})[_0x0820('0x37')](respondWithResult(_0x14b694,null))[_0x0820('0x2c')](handleError(_0x14b694,null));};exports['getRecordings']=function(_0x173e8e,_0x244dbb,_0x1d0615){var _0x5041e1={'raw':!![],'where':{}};var _0x4b924a={};var _0x8f15f={'count':0x0,'rows':[]};return db[_0x0820('0x49')][_0x0820('0x93')]({'where':{'id':_0x173e8e[_0x0820('0x66')]['id']}})[_0x0820('0x37')](handleEntityNotFound(_0x244dbb,null))['then'](function(_0x25446f){if(_0x25446f){_0x4b924a[_0x0820('0x54')]=_[_0x0820('0x51')](db[_0x0820('0xc8')][_0x0820('0x4a')]);_0x4b924a['query']=_[_0x0820('0x51')](_0x173e8e[_0x0820('0x50')]);_0x4b924a[_0x0820('0x52')]=_[_0x0820('0x53')](_0x4b924a[_0x0820('0x54')],_0x4b924a['query']);_0x5041e1[_0x0820('0x55')]=_[_0x0820('0x53')](_0x4b924a[_0x0820('0x54')],qs['fields'](_0x173e8e[_0x0820('0x50')]['fields']));_0x5041e1[_0x0820('0x55')]=_0x5041e1['attributes'][_0x0820('0x57')]?_0x5041e1['attributes']:_0x4b924a[_0x0820('0x54')];if(!_0x173e8e[_0x0820('0x50')][_0x0820('0xbe')]('nolimit')){_0x5041e1[_0x0820('0x32')]=qs['limit'](_0x173e8e[_0x0820('0x50')][_0x0820('0x32')]);_0x5041e1[_0x0820('0x31')]=qs[_0x0820('0x31')](_0x173e8e[_0x0820('0x50')][_0x0820('0x31')]);}_0x5041e1['order']=qs[_0x0820('0x59')](_0x173e8e[_0x0820('0x50')][_0x0820('0x59')]);_0x5041e1[_0x0820('0x5b')]=qs[_0x0820('0x52')](_['pick'](_0x173e8e[_0x0820('0x50')],_0x4b924a['filters']));_0x5041e1['where'][_0x0820('0xc9')]=_0x25446f['id'];if(_0x173e8e[_0x0820('0x50')]['filter']){_0x5041e1[_0x0820('0x5b')]=_['merge'](_0x5041e1['where'],{'$or':_[_0x0820('0x3f')](_0x5041e1[_0x0820('0x55')],function(_0x47a8bd){var _0x201f12={};_0x201f12[_0x47a8bd]={'$like':'%'+_0x173e8e[_0x0820('0x50')][_0x0820('0x3d')]+'%'};return _0x201f12;})});}_0x5041e1=_[_0x0820('0x5c')]({},_0x5041e1,_0x173e8e['options']);return db['VoiceRecording'][_0x0820('0x30')]({'where':_0x5041e1[_0x0820('0x5b')]})['then'](function(_0x3f6d92){_0x8f15f['count']=_0x3f6d92;if(_0x173e8e[_0x0820('0x50')][_0x0820('0x61')]){_0x5041e1[_0x0820('0x62')]=[{'all':!![]}];}return db[_0x0820('0xc8')][_0x0820('0x63')](_0x5041e1);})[_0x0820('0x37')](function(_0x3fe730){_0x8f15f[_0x0820('0x64')]=_0x3fe730;return _0x8f15f;});}})[_0x0820('0x37')](respondWithFilteredResult(_0x244dbb,_0x5041e1))[_0x0820('0x2c')](handleError(_0x244dbb,null));};exports['getScreenRecordings']=function(_0x35c1d0,_0xaf1976,_0x14b167){var _0x1741e7={'raw':!![],'where':{}};var _0x3b116f={};var _0x38af2a={'count':0x0,'rows':[]};return db[_0x0820('0x49')][_0x0820('0x93')]({'where':{'id':_0x35c1d0['params']['id']}})['then'](handleEntityNotFound(_0xaf1976,null))[_0x0820('0x37')](function(_0xbc62bd){if(_0xbc62bd){_0x3b116f['model']=_[_0x0820('0x51')](db[_0x0820('0xca')]['rawAttributes']);_0x3b116f[_0x0820('0x50')]=_[_0x0820('0x51')](_0x35c1d0['query']);_0x3b116f[_0x0820('0x52')]=_[_0x0820('0x53')](_0x3b116f[_0x0820('0x54')],_0x3b116f[_0x0820('0x50')]);_0x1741e7['attributes']=_[_0x0820('0x53')](_0x3b116f[_0x0820('0x54')],qs[_0x0820('0x56')](_0x35c1d0['query'][_0x0820('0x56')]));_0x1741e7[_0x0820('0x55')]=_0x1741e7['attributes'][_0x0820('0x57')]?_0x1741e7['attributes']:_0x3b116f[_0x0820('0x54')];if(!_0x35c1d0[_0x0820('0x50')][_0x0820('0xbe')](_0x0820('0x58'))){_0x1741e7[_0x0820('0x32')]=qs[_0x0820('0x32')](_0x35c1d0[_0x0820('0x50')][_0x0820('0x32')]);_0x1741e7['offset']=qs[_0x0820('0x31')](_0x35c1d0[_0x0820('0x50')][_0x0820('0x31')]);}_0x1741e7[_0x0820('0xc5')]=qs[_0x0820('0x59')](_0x35c1d0['query'][_0x0820('0x59')]);_0x1741e7['where']=qs[_0x0820('0x52')](_[_0x0820('0x5a')](_0x35c1d0[_0x0820('0x50')],_0x3b116f[_0x0820('0x52')]));_0x1741e7[_0x0820('0x5b')][_0x0820('0xc9')]=_0xbc62bd['id'];if(_0x35c1d0[_0x0820('0x50')]['filter']){_0x1741e7['where']=_['merge'](_0x1741e7[_0x0820('0x5b')],{'$or':_[_0x0820('0x3f')](_0x1741e7[_0x0820('0x55')],function(_0x2f2d7f){var _0x5e0dee={};_0x5e0dee[_0x2f2d7f]={'$like':'%'+_0x35c1d0[_0x0820('0x50')][_0x0820('0x3d')]+'%'};return _0x5e0dee;})});}_0x1741e7=_['merge']({},_0x1741e7,_0x35c1d0[_0x0820('0x60')]);return db[_0x0820('0xca')][_0x0820('0x30')]({'where':_0x1741e7[_0x0820('0x5b')]})[_0x0820('0x37')](function(_0x508c27){_0x38af2a[_0x0820('0x30')]=_0x508c27;if(_0x35c1d0[_0x0820('0x50')]['includeAll']){_0x1741e7[_0x0820('0x62')]=[{'all':!![]}];}return db[_0x0820('0xca')][_0x0820('0x63')](_0x1741e7);})[_0x0820('0x37')](function(_0x6e84b4){_0x38af2a[_0x0820('0x64')]=_0x6e84b4;return _0x38af2a;});}})[_0x0820('0x37')](respondWithFilteredResult(_0xaf1976,_0x1741e7))[_0x0820('0x2c')](handleError(_0xaf1976,null));};exports[_0x0820('0xcb')]=function(_0x4341b2,_0x4043df,_0x1b936f){var _0x3b8417={};var _0x39cbe7={};var _0x2a6edd;var _0x2229ca;return db[_0x0820('0x49')][_0x0820('0x93')]({'where':{'id':_0x4341b2[_0x0820('0x66')]['id']}})[_0x0820('0x37')](handleEntityNotFound(_0x4043df,null))[_0x0820('0x37')](function(_0x593661){if(_0x593661){_0x2a6edd=_0x593661;_0x39cbe7['model']=_[_0x0820('0x51')](db[_0x0820('0xcc')]['rawAttributes']);_0x39cbe7[_0x0820('0x50')]=_[_0x0820('0x51')](_0x4341b2[_0x0820('0x50')]);_0x39cbe7[_0x0820('0x52')]=_[_0x0820('0x53')](_0x39cbe7[_0x0820('0x54')],_0x39cbe7[_0x0820('0x50')]);_0x3b8417[_0x0820('0x55')]=_[_0x0820('0x53')](_0x39cbe7['model'],qs['fields'](_0x4341b2[_0x0820('0x50')][_0x0820('0x56')]));_0x3b8417[_0x0820('0x55')]=_0x3b8417[_0x0820('0x55')]['length']?_0x3b8417[_0x0820('0x55')]:_0x39cbe7[_0x0820('0x54')];_0x3b8417[_0x0820('0xc5')]=qs[_0x0820('0x59')](_0x4341b2['query'][_0x0820('0x59')]);_0x3b8417[_0x0820('0x5b')]=qs[_0x0820('0x52')](_['pick'](_0x4341b2[_0x0820('0x50')],_0x39cbe7[_0x0820('0x52')]));if(_0x4341b2[_0x0820('0x50')][_0x0820('0x3d')]){_0x3b8417[_0x0820('0x5b')]=_[_0x0820('0x5c')](_0x3b8417[_0x0820('0x5b')],{'$or':_[_0x0820('0x3f')](_0x3b8417[_0x0820('0x55')],function(_0x23a32d){var _0x3bc195={};_0x3bc195[_0x23a32d]={'$like':'%'+_0x4341b2[_0x0820('0x50')]['filter']+'%'};return _0x3bc195;})});}_0x3b8417=_[_0x0820('0x5c')]({},_0x3b8417,_0x4341b2[_0x0820('0x60')]);return _0x2a6edd[_0x0820('0xcb')](_0x3b8417);}})[_0x0820('0x37')](function(_0x4f1768){if(_0x4f1768){_0x2229ca=_0x4f1768['length'];if(!_0x4341b2[_0x0820('0x50')][_0x0820('0xbe')](_0x0820('0x58'))){_0x3b8417['limit']=qs[_0x0820('0x32')](_0x4341b2[_0x0820('0x50')][_0x0820('0x32')]);_0x3b8417[_0x0820('0x31')]=qs['offset'](_0x4341b2[_0x0820('0x50')]['offset']);}return _0x2a6edd[_0x0820('0xcb')](_0x3b8417);}})[_0x0820('0x37')](function(_0x3d534c){if(_0x3d534c){return _0x3d534c?{'count':_0x2229ca,'rows':_0x3d534c}:null;}})[_0x0820('0x37')](respondWithResult(_0x4043df,null))['catch'](handleError(_0x4043df,null));};exports[_0x0820('0xcd')]=function(_0x3a4fa1,_0x81a7e0,_0x335dd5){var _0x408cf9={};var _0xe445be={};var _0xe7dd57;var _0x313423;return db[_0x0820('0x49')]['findOne']({'where':{'id':_0x3a4fa1[_0x0820('0x66')]['id']}})[_0x0820('0x37')](handleEntityNotFound(_0x81a7e0,null))[_0x0820('0x37')](function(_0x2a06f6){if(_0x2a06f6){_0xe7dd57=_0x2a06f6;_0xe445be['model']=_['keys'](db[_0x0820('0xce')]['rawAttributes']);_0xe445be[_0x0820('0x50')]=_[_0x0820('0x51')](_0x3a4fa1[_0x0820('0x50')]);_0xe445be[_0x0820('0x52')]=_['intersection'](_0xe445be[_0x0820('0x54')],_0xe445be[_0x0820('0x50')]);_0x408cf9[_0x0820('0x55')]=_['intersection'](_0xe445be[_0x0820('0x54')],qs[_0x0820('0x56')](_0x3a4fa1['query']['fields']));_0x408cf9[_0x0820('0x55')]=_0x408cf9[_0x0820('0x55')]['length']?_0x408cf9[_0x0820('0x55')]:_0xe445be[_0x0820('0x54')];_0x408cf9[_0x0820('0xc5')]=qs[_0x0820('0x59')](_0x3a4fa1['query'][_0x0820('0x59')]);_0x408cf9[_0x0820('0x5b')]=qs['filters'](_[_0x0820('0x5a')](_0x3a4fa1[_0x0820('0x50')],_0xe445be['filters']));if(_0x3a4fa1[_0x0820('0x50')][_0x0820('0x3d')]){_0x408cf9[_0x0820('0x5b')]=_[_0x0820('0x5c')](_0x408cf9[_0x0820('0x5b')],{'$or':_[_0x0820('0x3f')](_0x408cf9['attributes'],function(_0x3d42e6){var _0x19172d={};_0x19172d[_0x3d42e6]={'$like':'%'+_0x3a4fa1[_0x0820('0x50')][_0x0820('0x3d')]+'%'};return _0x19172d;})});}_0x408cf9=_[_0x0820('0x5c')]({},_0x408cf9,_0x3a4fa1[_0x0820('0x60')]);return _0xe7dd57[_0x0820('0xcd')](_0x408cf9);}})[_0x0820('0x37')](function(_0x3c3488){if(_0x3c3488){_0x313423=_0x3c3488['length'];if(!_0x3a4fa1['query']['hasOwnProperty'](_0x0820('0x58'))){_0x408cf9[_0x0820('0x32')]=qs[_0x0820('0x32')](_0x3a4fa1[_0x0820('0x50')]['limit']);_0x408cf9['offset']=qs[_0x0820('0x31')](_0x3a4fa1[_0x0820('0x50')][_0x0820('0x31')]);}return _0xe7dd57[_0x0820('0xcd')](_0x408cf9);}})[_0x0820('0x37')](function(_0x50104b){if(_0x50104b){return _0x50104b?{'count':_0x313423,'rows':_0x50104b}:null;}})[_0x0820('0x37')](respondWithResult(_0x81a7e0,null))[_0x0820('0x2c')](handleError(_0x81a7e0,null));};exports[_0x0820('0xcf')]=function(_0x427d07,_0x9568f4,_0x59ada4){var _0x5c1124={'raw':!![],'where':{}};var _0x266713={};var _0x50c827={'count':0x0,'rows':[]};return db['User'][_0x0820('0x93')]({'where':{'id':_0x427d07[_0x0820('0x66')]['id']}})[_0x0820('0x37')](handleEntityNotFound(_0x9568f4,null))['then'](function(_0x1055fc){if(_0x1055fc){_0x266713[_0x0820('0x54')]=_['keys'](db['MailInteraction'][_0x0820('0x4a')]);_0x266713[_0x0820('0x50')]=_[_0x0820('0x51')](_0x427d07['query']);_0x266713[_0x0820('0x52')]=_['intersection'](_0x266713[_0x0820('0x54')],_0x266713[_0x0820('0x50')]);_0x5c1124[_0x0820('0x55')]=_['intersection'](_0x266713['model'],qs[_0x0820('0x56')](_0x427d07[_0x0820('0x50')][_0x0820('0x56')]));_0x5c1124['attributes']=_0x5c1124[_0x0820('0x55')][_0x0820('0x57')]?_0x5c1124[_0x0820('0x55')]:_0x266713['model'];if(!_0x427d07[_0x0820('0x50')]['hasOwnProperty'](_0x0820('0x58'))){_0x5c1124[_0x0820('0x32')]=qs[_0x0820('0x32')](_0x427d07[_0x0820('0x50')]['limit']);_0x5c1124[_0x0820('0x31')]=qs['offset'](_0x427d07[_0x0820('0x50')][_0x0820('0x31')]);}_0x5c1124[_0x0820('0xc5')]=qs[_0x0820('0x59')](_0x427d07[_0x0820('0x50')]['sort']);_0x5c1124[_0x0820('0x5b')]=qs['filters'](_[_0x0820('0x5a')](_0x427d07[_0x0820('0x50')],_0x266713[_0x0820('0x52')]));_0x5c1124['where'][_0x0820('0xc9')]=_0x1055fc['id'];if(_0x427d07[_0x0820('0x50')][_0x0820('0x3d')]){_0x5c1124[_0x0820('0x5b')]=_['merge'](_0x5c1124[_0x0820('0x5b')],{'$or':_[_0x0820('0x3f')](_0x5c1124[_0x0820('0x55')],function(_0x1a3aeb){var _0x1a61ef={};_0x1a61ef[_0x1a3aeb]={'$like':'%'+_0x427d07[_0x0820('0x50')][_0x0820('0x3d')]+'%'};return _0x1a61ef;})});}_0x5c1124=_['merge']({},_0x5c1124,_0x427d07[_0x0820('0x60')]);return db[_0x0820('0xd0')][_0x0820('0x30')]({'where':_0x5c1124['where']})[_0x0820('0x37')](function(_0xfa6f2b){_0x50c827[_0x0820('0x30')]=_0xfa6f2b;if(_0x427d07['query'][_0x0820('0x61')]){_0x5c1124[_0x0820('0x62')]=[{'all':!![]}];}return db['MailInteraction'][_0x0820('0x63')](_0x5c1124);})[_0x0820('0x37')](function(_0x2ed2d2){_0x50c827[_0x0820('0x64')]=_0x2ed2d2;return _0x50c827;});}})[_0x0820('0x37')](respondWithFilteredResult(_0x9568f4,_0x5c1124))[_0x0820('0x2c')](handleError(_0x9568f4,null));};exports[_0x0820('0xd1')]=function(_0x505aa1,_0x810865,_0x4a2bb1){var _0x2cf2a5={};var _0x370541={};var _0x44e4fe;var _0x2abac7;return db['User'][_0x0820('0x93')]({'where':{'id':_0x505aa1[_0x0820('0x66')]['id']}})[_0x0820('0x37')](handleEntityNotFound(_0x810865,null))['then'](function(_0x5e4a52){if(_0x5e4a52){_0x44e4fe=_0x5e4a52;_0x370541[_0x0820('0x54')]=_['keys'](db['SmsInteraction'][_0x0820('0x4a')]);_0x370541[_0x0820('0x50')]=_[_0x0820('0x51')](_0x505aa1[_0x0820('0x50')]);_0x370541[_0x0820('0x52')]=_['intersection'](_0x370541[_0x0820('0x54')],_0x370541['query']);_0x2cf2a5['attributes']=_[_0x0820('0x53')](_0x370541[_0x0820('0x54')],qs['fields'](_0x505aa1['query']['fields']));_0x2cf2a5[_0x0820('0x55')]=_0x2cf2a5[_0x0820('0x55')][_0x0820('0x57')]?_0x2cf2a5[_0x0820('0x55')]:_0x370541['model'];_0x2cf2a5[_0x0820('0xc5')]=qs[_0x0820('0x59')](_0x505aa1[_0x0820('0x50')][_0x0820('0x59')]);_0x2cf2a5['where']=qs[_0x0820('0x52')](_[_0x0820('0x5a')](_0x505aa1[_0x0820('0x50')],_0x370541[_0x0820('0x52')]));if(_0x505aa1['query'][_0x0820('0x3d')]){_0x2cf2a5[_0x0820('0x5b')]=_[_0x0820('0x5c')](_0x2cf2a5['where'],{'$or':_['map'](_0x2cf2a5[_0x0820('0x55')],function(_0x3d2b5b){var _0x50078f={};_0x50078f[_0x3d2b5b]={'$like':'%'+_0x505aa1['query'][_0x0820('0x3d')]+'%'};return _0x50078f;})});}_0x2cf2a5=_[_0x0820('0x5c')]({},_0x2cf2a5,_0x505aa1[_0x0820('0x60')]);return _0x44e4fe[_0x0820('0xd1')](_0x2cf2a5);}})[_0x0820('0x37')](function(_0x15c05f){if(_0x15c05f){_0x2abac7=_0x15c05f['length'];if(!_0x505aa1[_0x0820('0x50')][_0x0820('0xbe')]('nolimit')){_0x2cf2a5[_0x0820('0x32')]=qs[_0x0820('0x32')](_0x505aa1[_0x0820('0x50')][_0x0820('0x32')]);_0x2cf2a5[_0x0820('0x31')]=qs[_0x0820('0x31')](_0x505aa1[_0x0820('0x50')][_0x0820('0x31')]);}return _0x44e4fe[_0x0820('0xd1')](_0x2cf2a5);}})[_0x0820('0x37')](function(_0x44c8ff){if(_0x44c8ff){return _0x44c8ff?{'count':_0x2abac7,'rows':_0x44c8ff}:null;}})[_0x0820('0x37')](respondWithResult(_0x810865,null))[_0x0820('0x2c')](handleError(_0x810865,null));};exports[_0x0820('0xd2')]=function(_0x2c75bb,_0x2e709c,_0xde0d0c){var _0x572d6={};var _0x17ffb9={};var _0x5ed866;var _0x50dd28;return db[_0x0820('0x49')]['findOne']({'where':{'id':_0x2c75bb[_0x0820('0x66')]['id']}})['then'](handleEntityNotFound(_0x2e709c,null))[_0x0820('0x37')](function(_0x2bcbd7){if(_0x2bcbd7){_0x5ed866=_0x2bcbd7;_0x17ffb9[_0x0820('0x54')]=_[_0x0820('0x51')](db[_0x0820('0xd3')][_0x0820('0x4a')]);_0x17ffb9[_0x0820('0x50')]=_[_0x0820('0x51')](_0x2c75bb['query']);_0x17ffb9['filters']=_['intersection'](_0x17ffb9['model'],_0x17ffb9[_0x0820('0x50')]);_0x572d6[_0x0820('0x55')]=_['intersection'](_0x17ffb9[_0x0820('0x54')],qs[_0x0820('0x56')](_0x2c75bb['query'][_0x0820('0x56')]));_0x572d6['attributes']=_0x572d6[_0x0820('0x55')]['length']?_0x572d6[_0x0820('0x55')]:_0x17ffb9[_0x0820('0x54')];_0x572d6['order']=qs[_0x0820('0x59')](_0x2c75bb[_0x0820('0x50')][_0x0820('0x59')]);_0x572d6[_0x0820('0x5b')]=qs[_0x0820('0x52')](_['pick'](_0x2c75bb[_0x0820('0x50')],_0x17ffb9[_0x0820('0x52')]));if(_0x2c75bb[_0x0820('0x50')][_0x0820('0x3d')]){_0x572d6[_0x0820('0x5b')]=_[_0x0820('0x5c')](_0x572d6[_0x0820('0x5b')],{'$or':_['map'](_0x572d6['attributes'],function(_0x424056){var _0x2d84d9={};_0x2d84d9[_0x424056]={'$like':'%'+_0x2c75bb[_0x0820('0x50')]['filter']+'%'};return _0x2d84d9;})});}_0x572d6=_['merge']({},_0x572d6,_0x2c75bb['options']);return _0x5ed866[_0x0820('0xd2')](_0x572d6);}})[_0x0820('0x37')](function(_0x580286){if(_0x580286){_0x50dd28=_0x580286[_0x0820('0x57')];if(!_0x2c75bb[_0x0820('0x50')]['hasOwnProperty']('nolimit')){_0x572d6[_0x0820('0x32')]=qs[_0x0820('0x32')](_0x2c75bb[_0x0820('0x50')][_0x0820('0x32')]);_0x572d6['offset']=qs[_0x0820('0x31')](_0x2c75bb[_0x0820('0x50')][_0x0820('0x31')]);}return _0x5ed866['getFaxInteractions'](_0x572d6);}})[_0x0820('0x37')](function(_0x24eb13){if(_0x24eb13){return _0x24eb13?{'count':_0x50dd28,'rows':_0x24eb13}:null;}})[_0x0820('0x37')](respondWithResult(_0x2e709c,null))[_0x0820('0x2c')](handleError(_0x2e709c,null));};exports[_0x0820('0xd4')]=function(_0x442e45,_0x29e338,_0x1a2e76){var _0x2c77a4={};var _0x19f979={};var _0x5b8178;var _0x1e5a55;return db[_0x0820('0x49')][_0x0820('0x93')]({'where':{'id':_0x442e45[_0x0820('0x66')]['id']}})[_0x0820('0x37')](handleEntityNotFound(_0x29e338,null))[_0x0820('0x37')](function(_0x3303dd){if(_0x3303dd){_0x5b8178=_0x3303dd;_0x19f979[_0x0820('0x54')]=_['keys'](db[_0x0820('0xd5')][_0x0820('0x4a')]);_0x19f979[_0x0820('0x50')]=_[_0x0820('0x51')](_0x442e45[_0x0820('0x50')]);_0x19f979[_0x0820('0x52')]=_[_0x0820('0x53')](_0x19f979[_0x0820('0x54')],_0x19f979['query']);_0x2c77a4[_0x0820('0x55')]=_[_0x0820('0x53')](_0x19f979[_0x0820('0x54')],qs[_0x0820('0x56')](_0x442e45[_0x0820('0x50')][_0x0820('0x56')]));_0x2c77a4[_0x0820('0x55')]=_0x2c77a4['attributes'][_0x0820('0x57')]?_0x2c77a4['attributes']:_0x19f979[_0x0820('0x54')];_0x2c77a4[_0x0820('0xc5')]=qs[_0x0820('0x59')](_0x442e45[_0x0820('0x50')]['sort']);_0x2c77a4[_0x0820('0x5b')]=qs[_0x0820('0x52')](_[_0x0820('0x5a')](_0x442e45[_0x0820('0x50')],_0x19f979[_0x0820('0x52')]));if(_0x442e45[_0x0820('0x50')][_0x0820('0x3d')]){_0x2c77a4[_0x0820('0x5b')]=_[_0x0820('0x5c')](_0x2c77a4['where'],{'$or':_['map'](_0x2c77a4['attributes'],function(_0x5c26c0){var _0x7c70d0={};_0x7c70d0[_0x5c26c0]={'$like':'%'+_0x442e45['query'][_0x0820('0x3d')]+'%'};return _0x7c70d0;})});}_0x2c77a4=_[_0x0820('0x5c')]({},_0x2c77a4,_0x442e45[_0x0820('0x60')]);return _0x5b8178[_0x0820('0xd4')](_0x2c77a4);}})['then'](function(_0x5e9c8b){if(_0x5e9c8b){_0x1e5a55=_0x5e9c8b[_0x0820('0x57')];if(!_0x442e45['query']['hasOwnProperty'](_0x0820('0x58'))){_0x2c77a4[_0x0820('0x32')]=qs[_0x0820('0x32')](_0x442e45[_0x0820('0x50')][_0x0820('0x32')]);_0x2c77a4['offset']=qs[_0x0820('0x31')](_0x442e45[_0x0820('0x50')][_0x0820('0x31')]);}return _0x5b8178[_0x0820('0xd4')](_0x2c77a4);}})[_0x0820('0x37')](function(_0x41b3e8){if(_0x41b3e8){return _0x41b3e8?{'count':_0x1e5a55,'rows':_0x41b3e8}:null;}})[_0x0820('0x37')](respondWithResult(_0x29e338,null))[_0x0820('0x2c')](handleError(_0x29e338,null));};exports[_0x0820('0xd6')]=function(_0x18dea1,_0x18d9e4,_0x5b7574){var _0x44b49b;var _0x70736d;var _0x3e0dac;var _0x37ec16=!_[_0x0820('0x79')](_0x18dea1['params']['id'])?_0x18dea1[_0x0820('0x66')]['id']:!_[_0x0820('0x79')](_0x18dea1['user']['id'])?_0x18dea1[_0x0820('0x39')]['id']:null;return db[_0x0820('0x49')][_0x0820('0x43')]({'where':{'id':_0x37ec16,'role':{'$or':['admin','user',_0x0820('0x3b')]}},'attributes':['id','name',_0x0820('0xd7'),_0x0820('0xd8'),_0x0820('0x42'),_0x0820('0x76'),_0x0820('0xd9')]})[_0x0820('0x37')](function(_0x23797f){if(_0x23797f){if(_0x23797f[_0x0820('0x42')]===_0x0820('0x3b')){_0x44b49b=_0x23797f;if(_0x18dea1['body'][_0x0820('0xa1')]){_0x3e0dac=util['format']('LOCAL/%s@from-sip/n',_0x44b49b[_0x18dea1[_0x0820('0x69')][_0x0820('0xa1')]]);}else if(_0x18dea1[_0x0820('0x69')][_0x0820('0xda')]){_0x3e0dac=util[_0x0820('0x73')]('SIP/%s',_0x18dea1[_0x0820('0x69')][_0x0820('0xda')]);}else{_0x3e0dac=util['format'](_0x0820('0xae'),_0x44b49b[_0x0820('0x44')]);}socket['to'](util['format']('user:%s',_0x44b49b['name']))['emit'](_0x0820('0xdb'),{'ip':_0x18dea1[_0x0820('0xdc')][_0x0820('0xdd')]||_0x18dea1[_0x0820('0xde')][_0x0820('0xdf')]||_0x18dea1['socket'][_0x0820('0xdf')]||_0x18dea1[_0x0820('0xde')]['socket'][_0x0820('0xdf')]});return db['UserVoiceQueueRt'][_0x0820('0x38')]({'where':{'membername':_0x44b49b[_0x0820('0x44')]},'individualHooks':!![]});}}else{throw new db[(_0x0820('0x20'))][(_0x0820('0x96'))]('User\x20not\x20found\x20or\x20not\x20allowed\x20to\x20perform\x20login\x20method');}})[_0x0820('0x37')](function(){if(_0x44b49b){return _0x44b49b['getVoiceQueues']({'raw':!![]});}})['then'](function(_0x21c6b9){if(_0x44b49b){var _0x11768e=[];if(_0x21c6b9){_0x70736d=_0x21c6b9;if(_0x70736d[_0x0820('0x57')]){for(var _0x11abb7=0x0;_0x11abb7<_0x70736d[_0x0820('0x57')];_0x11abb7++){_0x11768e[_0x0820('0xad')]({'membername':_0x44b49b[_0x0820('0x44')],'UserId':_0x44b49b['id'],'queue_name':_0x70736d[_0x11abb7][_0x0820('0x44')],'VoiceQueueId':_0x70736d[_0x11abb7]['id'],'interface':_0x3e0dac,'paused':_0x44b49b['loginInPause']||![],'penalty':_0x70736d[_0x11abb7][_0x0820('0xe0')]||0x0});}return BPromise[_0x0820('0xaf')](_0x11768e,function(_0x1415da){return db[_0x0820('0xb3')]['upsert'](_0x1415da);});}}}})[_0x0820('0x37')](function(){if(_0x44b49b){return db[_0x0820('0xe1')][_0x0820('0x63')]({'where':{'membername':_0x44b49b['name'],'exitAt':null}});}})[_0x0820('0x37')](function(_0x4507b4){if(_0x44b49b){var _0x4f4417=[];_0x4507b4['forEach'](function(_0x1063dc){_0x4f4417[_0x0820('0xad')](_0x1063dc[_0x0820('0x36')]({'exitAt':moment()[_0x0820('0x73')]('YYYY-MM-DD\x20HH:mm:ss')}));});return BPromise[_0x0820('0xe2')](_0x4f4417);}})['then'](function(){if(_0x44b49b){var _0x4de580=[];var _0x2892ac=[];var _0x6f8e3d=utils['getChannels']();var _0x1f9efb={'membername':_0x44b49b[_0x0820('0x44')],'interface':_0x3e0dac,'enterAt':moment()[_0x0820('0x73')](_0x0820('0xe3')),'role':_0x44b49b[_0x0820('0x42')],'internal':_0x44b49b[_0x0820('0x76')]};_0x6f8e3d[_0x0820('0xe4')](function(_0x5210f6){_0x4de580[_0x0820('0xad')](_[_0x0820('0x5c')]({'channel':_0x5210f6,'type':'LOGIN','data1':_0x18dea1[_0x0820('0x69')][_0x0820('0xe5')],'data2':_0x3e0dac},_0x1f9efb));if(_0x44b49b[_0x0820('0xd9')]){_0x2892ac['push'](_[_0x0820('0x5c')]({'channel':_0x5210f6,'type':_0x0820('0xe6'),'data1':_0x0820('0xe7')},_0x1f9efb));}});return db[_0x0820('0xe1')][_0x0820('0x68')](_0x4de580[_0x0820('0xe8')](_0x2892ac),{'individualHooks':!![]});}})['then'](function(){if(_0x44b49b){return _0x44b49b[_0x0820('0x36')]({'online':!![],'lastLoginAt':moment()['format'](_0x0820('0xe3')),'voicePause':_0x44b49b[_0x0820('0xd9')]||![],'mailPause':_0x44b49b[_0x0820('0xd9')]||![],'chatPause':_0x44b49b[_0x0820('0xd9')]||![],'faxPause':_0x44b49b[_0x0820('0xd9')]||![],'smsPause':_0x44b49b[_0x0820('0xd9')]||![],'openchannelPause':_0x44b49b[_0x0820('0xd9')]||![],'whatsappPause':_0x44b49b['loginInPause']||![],'pauseType':_0x44b49b['loginInPause']?'LOGININPAUSE':null,'interface':_0x3e0dac,'lastPauseAt':moment()[_0x0820('0x73')](_0x0820('0xe3'))});}})['then'](function(_0x463bdc){if(_0x18dea1['isMiddleware']){return _0x5b7574();}else{return BPromise[_0x0820('0xe9')](_0x463bdc)['then'](respondWithResult(_0x18d9e4,null));}})['catch'](handleError(_0x18d9e4,null));};exports['logout']=function(_0x9bed1f,_0x3e095e,_0x519332){var _0x4f7b05;return db['User']['find']({'where':{'id':_0x9bed1f[_0x0820('0x66')]['id'],'role':_0x0820('0x3b')},'attributes':['id','name',_0x0820('0x42')]})[_0x0820('0x37')](handleEntityNotFound(_0x3e095e,null))[_0x0820('0x37')](function(_0x4dfd6f){if(_0x4dfd6f){_0x4f7b05=_0x4dfd6f;return db[_0x0820('0xb3')][_0x0820('0x38')]({'where':{'membername':_0x4f7b05[_0x0820('0x44')]},'individualHooks':!![]});}})[_0x0820('0x37')](function(){return db['MemberReport'][_0x0820('0x63')]({'where':{'membername':_0x4f7b05[_0x0820('0x44')],'exitAt':null}});})[_0x0820('0x37')](function(_0x133091){var _0x182dc3=[];_0x133091[_0x0820('0xe4')](function(_0x22d5e9){_0x182dc3[_0x0820('0xad')](_0x22d5e9['update']({'exitAt':moment()[_0x0820('0x73')]('YYYY-MM-DD\x20HH:mm:ss')}));});return BPromise[_0x0820('0xe2')](_0x182dc3);})[_0x0820('0x37')](function(){return _0x4f7b05[_0x0820('0x36')]({'online':![],'lastLoginAt':null,'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![],'whatsappPause':![],'interface':null});})[_0x0820('0x37')](respondWithResult(_0x3e095e,null))[_0x0820('0x2c')](handleError(_0x3e095e,null));};exports[_0x0820('0xea')]=function(_0x2d77ef,_0xa9dda7,_0x4b591d){var _0x3ecf86;return db['UserVoiceQueueRt'][_0x0820('0x36')]({'paused':0x1},{'where':{'UserId':_0x2d77ef[_0x0820('0x66')]['id']},'individualHooks':!![]})[_0x0820('0x37')](function(){return db['User'][_0x0820('0x43')]({'where':{'id':_0x2d77ef[_0x0820('0x66')]['id'],'role':_0x0820('0x3b')},'attributes':['id',_0x0820('0x44'),'role',_0x0820('0x76'),_0x0820('0xa1')]});})[_0x0820('0x37')](handleEntityNotFound(_0xa9dda7,null))[_0x0820('0x37')](function(_0x42e725){if(_0x42e725){_0x3ecf86=_0x42e725;return respondWithRpcPromise(_0x0820('0xeb'),_0x0820('0xea'),{'id':_0x3ecf86['id'],'name':_0x3ecf86[_0x0820('0x44')],'pause':!![]});}})[_0x0820('0x37')](function(){if(_0x3ecf86){return db[_0x0820('0xe1')][_0x0820('0x63')]({'where':{'membername':_0x3ecf86[_0x0820('0x44')],'type':_0x0820('0xe6'),'exitAt':null}});}})[_0x0820('0x37')](function(_0x4f40cf){if(_0x4f40cf['length']){var _0x406299=moment()[_0x0820('0x73')](_0x0820('0xe3'));for(var _0x366868=0x0,_0x5e02d1=_0x4f40cf[_0x0820('0x57')];_0x366868<_0x5e02d1;_0x366868++){_0x4f40cf[_0x366868][_0x0820('0xec')]({'exitAt':_0x406299});}}})['then'](function(){var _0x55e08d=[];var _0x113ca6=utils[_0x0820('0xed')]();_0x113ca6['forEach'](function(_0x4a498d){_0x55e08d['push']({'channel':_0x4a498d,'membername':_0x3ecf86[_0x0820('0x44')],'interface':_[_0x0820('0x79')](_0x3ecf86[_0x0820('0xa1')])?util[_0x0820('0x73')](_0x0820('0xae'),_0x3ecf86[_0x0820('0x44')]):_0x3ecf86[_0x0820('0xa1')],'type':_0x0820('0xe6'),'enterAt':moment()[_0x0820('0x73')](_0x0820('0xe3')),'data1':_0x2d77ef[_0x0820('0x69')][_0x0820('0x4c')]||_0x0820('0xee'),'role':_0x3ecf86[_0x0820('0x42')],'internal':_0x3ecf86[_0x0820('0x76')]});});return db[_0x0820('0xe1')]['bulkCreate'](_0x55e08d,{'individualHooks':!![]});})['then'](function(){return _0x3ecf86[_0x0820('0x36')]({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'whatsappPause':!![],'openchannelPause':!![],'pauseType':_0x2d77ef[_0x0820('0x69')][_0x0820('0x4c')]||'DEFAULT\x20PAUSE','lastPauseAt':moment()[_0x0820('0x73')]('YYYY-MM-DD\x20HH:mm:ss')});})['then'](respondWithResult(_0xa9dda7,null))[_0x0820('0x2c')](handleError(_0xa9dda7,null));};exports[_0x0820('0xef')]=function(_0x2000d0,_0x29bf54,_0x178a89){var _0x5f285a;return db['User'][_0x0820('0x43')]({'where':{'id':_0x2000d0[_0x0820('0x66')]['id']},'attributes':['id',_0x0820('0x44'),'role',_0x0820('0xa0'),_0x0820('0xf0'),'chatPause','faxPause','openchannelPause',_0x0820('0xf1'),_0x0820('0xf2'),'pauseType',_0x0820('0xf3')]})[_0x0820('0x37')](handleEntityNotFound(_0x29bf54,null))[_0x0820('0x37')](function(_0x302190){if(_0x302190){_0x5f285a=_0x302190;if(_0x2000d0[_0x0820('0x69')][_0x0820('0x9e')]&&!utils[_0x0820('0xa2')](_0x2000d0[_0x0820('0x69')]['channel'])){throw new db[(_0x0820('0x20'))][(_0x0820('0x96'))](_0x0820('0xa3'));}switch(_0x2000d0[_0x0820('0x69')][_0x0820('0x9e')]){case _0x0820('0xac'):return respondWithRpcPromise(_0x0820('0xeb'),_0x0820('0xef'),{'id':_0x5f285a['id'],'name':_0x5f285a[_0x0820('0x44')],'pause':![]})[_0x0820('0x37')](function(){return db['UserVoiceQueueRt'][_0x0820('0x36')]({'paused':0x0},{'where':{'UserId':_0x5f285a['id']},'individualHooks':!![]});})['then'](function(){return db[_0x0820('0xe1')][_0x0820('0x43')]({'where':{'channel':_0x2000d0[_0x0820('0x69')][_0x0820('0x9e')],'membername':_0x5f285a[_0x0820('0x44')],'type':_0x0820('0xe6'),'exitAt':null}});})[_0x0820('0x37')](function(_0x98fa7a){if(_0x98fa7a){return _0x98fa7a[_0x0820('0x36')]({'exitAt':moment()[_0x0820('0x73')](_0x0820('0xe3')),'data2':_0x0820('0xf4')},{'individualHooks':!![]});}return null;})[_0x0820('0x37')](function(){return _0x5f285a[_0x0820('0x36')]({'voicePause':![]});});case _0x0820('0xf5'):case _0x0820('0xf6'):case _0x0820('0xf7'):case'sms':case _0x0820('0xf8'):case _0x0820('0xf9'):return db['MemberReport'][_0x0820('0x43')]({'where':{'channel':_0x2000d0[_0x0820('0x69')][_0x0820('0x9e')],'membername':_0x5f285a[_0x0820('0x44')],'type':_0x0820('0xe6'),'exitAt':null}})['then'](function(_0x413bea){if(_0x413bea){return _0x413bea[_0x0820('0x36')]({'exitAt':moment()[_0x0820('0x73')](_0x0820('0xe3')),'data2':'manual'},{'individualHooks':!![]});}return null;})[_0x0820('0x37')](function(){var _0x76de13={};_['set'](_0x76de13,util[_0x0820('0x73')]('%s%s',_0x2000d0[_0x0820('0x69')][_0x0820('0x9e')],'Pause'),![]);return _0x5f285a['update'](_0x76de13);});default:return respondWithRpcPromise(_0x0820('0xeb'),_0x0820('0xef'),{'id':_0x5f285a['id'],'name':_0x5f285a[_0x0820('0x44')],'pause':![]})[_0x0820('0x37')](function(){return db[_0x0820('0xb3')][_0x0820('0x36')]({'paused':0x0},{'where':{'UserId':_0x5f285a['id']}});})[_0x0820('0x37')](function(){return db[_0x0820('0xe1')][_0x0820('0x63')]({'where':{'membername':_0x5f285a[_0x0820('0x44')],'type':_0x0820('0xe6'),'exitAt':null}});})['then'](function(_0x36fcfd){var _0x325478=[];_0x36fcfd['forEach'](function(_0x1d3d9f){_0x325478['push'](_0x1d3d9f[_0x0820('0x36')]({'exitAt':moment()[_0x0820('0x73')](_0x0820('0xe3')),'data2':_0x0820('0xf4')}));});return BPromise[_0x0820('0xe2')](_0x325478);})[_0x0820('0x37')](function(){return _0x5f285a[_0x0820('0x36')]({'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'whatsappPause':![],'openchannelPause':![]});});}}})[_0x0820('0x37')](respondWithResult(_0x29bf54,null))['catch'](handleError(_0x29bf54,null));};exports[_0x0820('0xfa')]=function(_0xc146e,_0x1b3e03,_0x447733){var _0x397563={};var _0xb07dcf={};var _0xb437a6;var _0x45453d;return db[_0x0820('0x49')][_0x0820('0x93')]({'where':{'id':_0xc146e[_0x0820('0x66')]['id']}})[_0x0820('0x37')](handleEntityNotFound(_0x1b3e03,null))['then'](function(_0x4b98fa){if(_0x4b98fa){_0xb437a6=_0x4b98fa;_0xb07dcf[_0x0820('0x54')]=_[_0x0820('0x51')](db['Team']['rawAttributes']);_0xb07dcf[_0x0820('0x50')]=_[_0x0820('0x51')](_0xc146e[_0x0820('0x50')]);_0xb07dcf[_0x0820('0x52')]=_[_0x0820('0x53')](_0xb07dcf[_0x0820('0x54')],_0xb07dcf[_0x0820('0x50')]);_0x397563[_0x0820('0x55')]=_[_0x0820('0x53')](_0xb07dcf[_0x0820('0x54')],qs[_0x0820('0x56')](_0xc146e[_0x0820('0x50')][_0x0820('0x56')]));_0x397563[_0x0820('0x55')]=_0x397563[_0x0820('0x55')][_0x0820('0x57')]?_0x397563[_0x0820('0x55')]:_0xb07dcf['model'];_0x397563[_0x0820('0xc5')]=qs['sort'](_0xc146e[_0x0820('0x50')][_0x0820('0x59')]);_0x397563['where']=qs[_0x0820('0x52')](_[_0x0820('0x5a')](_0xc146e[_0x0820('0x50')],_0xb07dcf[_0x0820('0x52')]));if(_0xc146e[_0x0820('0x50')][_0x0820('0x3d')]){_0x397563[_0x0820('0x5b')]=_[_0x0820('0x5c')](_0x397563[_0x0820('0x5b')],{'$or':_[_0x0820('0x3f')](_0x397563[_0x0820('0x55')],function(_0x5dedcd){var _0x2d049a={};_0x2d049a[_0x5dedcd]={'$like':'%'+_0xc146e[_0x0820('0x50')][_0x0820('0x3d')]+'%'};return _0x2d049a;})});}_0x397563=_['merge']({},_0x397563,_0xc146e[_0x0820('0x60')]);return _0xb437a6[_0x0820('0xfa')](_0x397563);}})[_0x0820('0x37')](function(_0x156677){if(_0x156677){_0x45453d=_0x156677[_0x0820('0x57')];if(!_0xc146e[_0x0820('0x50')][_0x0820('0xbe')]('nolimit')){_0x397563[_0x0820('0x32')]=qs[_0x0820('0x32')](_0xc146e['query'][_0x0820('0x32')]);_0x397563['offset']=qs[_0x0820('0x31')](_0xc146e[_0x0820('0x50')][_0x0820('0x31')]);}return _0xb437a6['getTeams'](_0x397563);}})[_0x0820('0x37')](function(_0x540567){if(_0x540567){return _0x540567?{'count':_0x45453d,'rows':_0x540567}:null;}})['then'](respondWithResult(_0x1b3e03,null))[_0x0820('0x2c')](handleError(_0x1b3e03,null));};exports[_0x0820('0xfb')]=function(_0x5ad079,_0x5f169a){return db[_0x0820('0x49')]['find']({'where':{'id':_0x5ad079[_0x0820('0x66')]['id']}})[_0x0820('0x37')](handleEntityNotFound(_0x5f169a,null))[_0x0820('0x37')](function(_0x3e8dc8){if(_0x3e8dc8){var _0xc1d0cf=_0x3e8dc8[_0x0820('0x8b')]({'plain':!![]});return _0x3e8dc8[_0x0820('0xfb')](_0x5ad079[_0x0820('0x69')]['ids'],_[_0x0820('0x6c')](_0x5ad079[_0x0820('0x69')],[_0x0820('0x6d'),'id'])||{})[_0x0820('0x37')](function(){for(var _0x4e673e=0x0;_0x4e673e<_0x5ad079[_0x0820('0x69')][_0x0820('0x6d')][_0x0820('0x57')];_0x4e673e++){var _0x54bd20=[];db['Team'][_0x0820('0x93')]({'where':{'id':_0x5ad079[_0x0820('0x69')][_0x0820('0x6d')][_0x4e673e]}})[_0x0820('0x37')](function(_0x4d1fd3){_0x54bd20['push'](_0x4d1fd3[_0x0820('0xfc')]()['then'](function(_0x267162){for(var _0xe3963a=0x0;_0xe3963a<_0x267162['length'];_0xe3963a++){_0x267162[_0xe3963a][_0x0820('0xfd')](_0x0820('0x9e'),_0x0820('0xfe'));}return _0x267162;}));_0x54bd20[_0x0820('0xad')](_0x4d1fd3[_0x0820('0xff')]()['then'](function(_0x48bec3){for(var _0x55d3d3=0x0;_0x55d3d3<_0x48bec3[_0x0820('0x57')];_0x55d3d3++){_0x48bec3[_0x55d3d3][_0x0820('0xfd')](_0x0820('0x9e'),'Chat');}return _0x48bec3;}));_0x54bd20[_0x0820('0xad')](_0x4d1fd3[_0x0820('0x100')]()[_0x0820('0x37')](function(_0x4a142a){for(var _0x369bc3=0x0;_0x369bc3<_0x4a142a[_0x0820('0x57')];_0x369bc3++){_0x4a142a[_0x369bc3]['setDataValue'](_0x0820('0x9e'),_0x0820('0x101'));}return _0x4a142a;}));_0x54bd20[_0x0820('0xad')](_0x4d1fd3[_0x0820('0x102')]()[_0x0820('0x37')](function(_0x3e70a2){for(var _0x3a8bb=0x0;_0x3a8bb<_0x3e70a2[_0x0820('0x57')];_0x3a8bb++){_0x3e70a2[_0x3a8bb][_0x0820('0xfd')]('channel',_0x0820('0x103'));}return _0x3e70a2;}));_0x54bd20[_0x0820('0xad')](_0x4d1fd3[_0x0820('0x104')]()[_0x0820('0x37')](function(_0x5df062){for(var _0xa1e07b=0x0;_0xa1e07b<_0x5df062['length'];_0xa1e07b++){_0x5df062[_0xa1e07b][_0x0820('0xfd')]('channel',_0x0820('0x105'));}return _0x5df062;}));_0x54bd20[_0x0820('0xad')](_0x4d1fd3[_0x0820('0x106')]()[_0x0820('0x37')](function(_0x1d6c42){for(var _0x16c9d3=0x0;_0x16c9d3<_0x1d6c42[_0x0820('0x57')];_0x16c9d3++){_0x1d6c42[_0x16c9d3][_0x0820('0xfd')](_0x0820('0x9e'),_0x0820('0x107'));}return _0x1d6c42;}));_0x54bd20[_0x0820('0xad')](_0x4d1fd3[_0x0820('0x108')]()['then'](function(_0x3042f4){for(var _0x4a6e33=0x0;_0x4a6e33<_0x3042f4['length'];_0x4a6e33++){_0x3042f4[_0x4a6e33]['setDataValue'](_0x0820('0x9e'),'Openchannel');}return _0x3042f4;}));return BPromise['all'](_0x54bd20);})[_0x0820('0x37')](function(_0x2dc337){var _0x1607da=_[_0x0820('0x109')](_0x2dc337);_0x54bd20=[];return db[_0x0820('0x5d')][_0x0820('0x10a')](function(_0x2cce05){for(var _0x3cd237=0x0;_0x3cd237<_0x1607da['length'];_0x3cd237++){_0x54bd20['push'](_0x1607da[_0x3cd237][_0x0820('0x10b')](_0xc1d0cf['id']),{'transaction':_0x2cce05});}return BPromise['all'](_0x54bd20)[_0x0820('0x37')](function(){if(_0xc1d0cf[_0x0820('0x9f')]){return BPromise[_0x0820('0xaf')](_[_0x0820('0x3d')](_0x1607da,function(_0x492da9){return _0x492da9[_0x0820('0x10c')](_0x0820('0x9e'))===_0x0820('0xfe');}),function(_0x3753cc){return db[_0x0820('0xb3')]['upsert']({'membername':_0xc1d0cf[_0x0820('0x44')],'UserId':_0xc1d0cf['id'],'queue_name':_0x3753cc['name'],'VoiceQueueId':_0x3753cc['id'],'interface':_[_0x0820('0x79')](_0xc1d0cf[_0x0820('0xa1')])?util[_0x0820('0x73')](_0x0820('0xae'),_0xc1d0cf[_0x0820('0x44')]):_0xc1d0cf[_0x0820('0xa1')],'paused':_0xc1d0cf[_0x0820('0xa0')]||![],'penalty':_0xc1d0cf[_0x0820('0x10d')]},{'transaction':_0x2cce05});});}else{return;}})['then'](function(){for(var _0x5f2e06=0x0;_0x5f2e06<_0x1607da[_0x0820('0x57')];_0x5f2e06++){var _0x5216b3=_0x1607da[_0x5f2e06][_0x0820('0x10c')](_0x0820('0x9e'));var _0x2b48e7=_0x5216b3+_0x0820('0xa9');socket['emit'](_0x0820('0x39')+_0x5216b3+_0x0820('0xab'),{'UserId':_0xc1d0cf['id'],['queueField']:_0x1607da[_0x5f2e06]['id']});}});});});}});}})[_0x0820('0x37')](respondWithStatusCode(_0x5f169a,null))[_0x0820('0x2c')](handleError(_0x5f169a,null));};exports[_0x0820('0x10e')]=function(_0x28e597,_0x36c7ab){return db[_0x0820('0x49')][_0x0820('0x93')]({'where':{'id':_0x28e597[_0x0820('0x66')]['id']}})[_0x0820('0x37')](handleEntityNotFound(_0x36c7ab,null))[_0x0820('0x37')](function(_0x259fb0){if(_0x259fb0){var _0xeabbec=_0x259fb0[_0x0820('0x8b')]({'plain':!![]});var _0xfa8e34=_0x28e597[_0x0820('0x50')][_0x0820('0x6d')];return _0x259fb0['removeTeams'](_0xfa8e34)[_0x0820('0x37')](function(){for(var _0x474151=0x0;_0x474151<_0xfa8e34[_0x0820('0x57')];_0x474151++){var _0xfcbd7=[];db[_0x0820('0x10f')][_0x0820('0x93')]({'where':{'id':_0xfa8e34[_0x474151]}})[_0x0820('0x37')](function(_0x4a120d){_0xfcbd7[_0x0820('0xad')](_0x4a120d[_0x0820('0xfc')]()[_0x0820('0x37')](function(_0x2f980c){for(var _0x68f7e5=0x0;_0x68f7e5<_0x2f980c[_0x0820('0x57')];_0x68f7e5++){_0x2f980c[_0x68f7e5]['setDataValue'](_0x0820('0x9e'),_0x0820('0xfe'));}return _0x2f980c;}));_0xfcbd7['push'](_0x4a120d[_0x0820('0xff')]()['then'](function(_0x6bfd17){for(var _0x4ac6ed=0x0;_0x4ac6ed<_0x6bfd17[_0x0820('0x57')];_0x4ac6ed++){_0x6bfd17[_0x4ac6ed]['setDataValue']('channel',_0x0820('0x110'));}return _0x6bfd17;}));_0xfcbd7[_0x0820('0xad')](_0x4a120d[_0x0820('0x100')]()[_0x0820('0x37')](function(_0x5c5f4f){for(var _0x249b1b=0x0;_0x249b1b<_0x5c5f4f['length'];_0x249b1b++){_0x5c5f4f[_0x249b1b]['setDataValue'](_0x0820('0x9e'),'Mail');}return _0x5c5f4f;}));_0xfcbd7[_0x0820('0xad')](_0x4a120d[_0x0820('0x102')]()[_0x0820('0x37')](function(_0x37a70e){for(var _0x5e9f41=0x0;_0x5e9f41<_0x37a70e['length'];_0x5e9f41++){_0x37a70e[_0x5e9f41][_0x0820('0xfd')](_0x0820('0x9e'),_0x0820('0x103'));}return _0x37a70e;}));_0xfcbd7[_0x0820('0xad')](_0x4a120d['getWhatsappQueues']()['then'](function(_0x2165f0){for(var _0x47872c=0x0;_0x47872c<_0x2165f0['length'];_0x47872c++){_0x2165f0[_0x47872c]['setDataValue'](_0x0820('0x9e'),_0x0820('0x105'));}return _0x2165f0;}));_0xfcbd7[_0x0820('0xad')](_0x4a120d[_0x0820('0x106')]()[_0x0820('0x37')](function(_0x1ff0c9){for(var _0x3f7fd8=0x0;_0x3f7fd8<_0x1ff0c9[_0x0820('0x57')];_0x3f7fd8++){_0x1ff0c9[_0x3f7fd8]['setDataValue'](_0x0820('0x9e'),'Fax');}return _0x1ff0c9;}));_0xfcbd7[_0x0820('0xad')](_0x4a120d['getOpenchannelQueues']()[_0x0820('0x37')](function(_0x230cc9){for(var _0x1a84fa=0x0;_0x1a84fa<_0x230cc9[_0x0820('0x57')];_0x1a84fa++){_0x230cc9[_0x1a84fa][_0x0820('0xfd')](_0x0820('0x9e'),_0x0820('0x111'));}return _0x230cc9;}));return BPromise['all'](_0xfcbd7);})[_0x0820('0x37')](function(_0x1753a7){var _0x50b7e9=_[_0x0820('0x109')](_0x1753a7);_0xfcbd7=[];return db['sequelize'][_0x0820('0x10a')](function(_0x5671bb){for(var _0x4625fb=0x0;_0x4625fb<_0x50b7e9['length'];_0x4625fb++){_0xfcbd7[_0x0820('0xad')](_0x50b7e9[_0x4625fb][_0x0820('0x112')](_0xeabbec['id']),{'transaction':_0x5671bb});}return BPromise[_0x0820('0xe2')](_0xfcbd7)[_0x0820('0x37')](function(){if(_0xeabbec[_0x0820('0x9f')]){return BPromise['each'](_[_0x0820('0x3d')](_0x50b7e9,function(_0x251242){return _0x251242[_0x0820('0x10c')](_0x0820('0x9e'))===_0x0820('0xfe');}),function(_0x4bafad){return db['UserVoiceQueueRt'][_0x0820('0x38')]({'where':{'VoiceQueueId':_0x4bafad['id'],'UserId':_0xeabbec['id']},'transaction':_0x5671bb});});}else{return;}})[_0x0820('0x37')](function(){for(var _0x4a8916=0x0;_0x4a8916<_0x50b7e9[_0x0820('0x57')];_0x4a8916++){var _0x1c637d=_0x50b7e9[_0x4a8916][_0x0820('0x10c')](_0x0820('0x9e'));var _0x2cc861=_0x1c637d+'QueueId';socket[_0x0820('0xaa')](_0x0820('0x39')+_0x1c637d+_0x0820('0xb2'),{'UserId':_0xeabbec['id'],['queueField']:_0x50b7e9[_0x4a8916]['id']});}});});});}});}})['then'](respondWithStatusCode(_0x36c7ab,null))[_0x0820('0x2c')](handleError(_0x36c7ab,null));};exports[_0x0820('0x113')]=function(_0x560f14,_0x32844d,_0xa7377e){var _0x48b5f0={};var _0x2ab60f={};var _0x1bc41a;var _0x476eff;return db[_0x0820('0x49')][_0x0820('0x93')]({'where':{'id':_0x560f14[_0x0820('0x66')]['id']}})['then'](handleEntityNotFound(_0x32844d,null))['then'](function(_0x253613){if(_0x253613){_0x1bc41a=_0x253613;_0x2ab60f['model']=_['keys'](db[_0x0820('0x114')][_0x0820('0x4a')]);_0x2ab60f['query']=_[_0x0820('0x51')](_0x560f14[_0x0820('0x50')]);_0x2ab60f[_0x0820('0x52')]=_[_0x0820('0x53')](_0x2ab60f[_0x0820('0x54')],_0x2ab60f['query']);_0x48b5f0[_0x0820('0x55')]=_[_0x0820('0x53')](_0x2ab60f[_0x0820('0x54')],qs[_0x0820('0x56')](_0x560f14[_0x0820('0x50')][_0x0820('0x56')]));_0x48b5f0[_0x0820('0x55')]=_0x48b5f0[_0x0820('0x55')]['length']?_0x48b5f0['attributes']:_0x2ab60f['model'];_0x48b5f0[_0x0820('0xc5')]=qs[_0x0820('0x59')](_0x560f14['query']['sort']);_0x48b5f0[_0x0820('0x5b')]=qs['filters'](_[_0x0820('0x5a')](_0x560f14[_0x0820('0x50')],_0x2ab60f[_0x0820('0x52')]));if(_0x560f14[_0x0820('0x50')][_0x0820('0x3d')]){_0x48b5f0[_0x0820('0x5b')]=_[_0x0820('0x5c')](_0x48b5f0[_0x0820('0x5b')],{'$or':_[_0x0820('0x3f')](_0x48b5f0['attributes'],function(_0x14bb38){var _0x76607b={};_0x76607b[_0x14bb38]={'$like':'%'+_0x560f14[_0x0820('0x50')][_0x0820('0x3d')]+'%'};return _0x76607b;})});}_0x48b5f0=_[_0x0820('0x5c')]({},_0x48b5f0,_0x560f14[_0x0820('0x60')]);return _0x1bc41a[_0x0820('0x113')](_0x48b5f0);}})[_0x0820('0x37')](function(_0x45ee5b){if(_0x45ee5b){_0x476eff=_0x45ee5b[_0x0820('0x57')];if(!_0x560f14[_0x0820('0x50')]['hasOwnProperty'](_0x0820('0x58'))){_0x48b5f0[_0x0820('0x32')]=qs['limit'](_0x560f14['query'][_0x0820('0x32')]);_0x48b5f0[_0x0820('0x31')]=qs['offset'](_0x560f14[_0x0820('0x50')][_0x0820('0x31')]);}return _0x1bc41a[_0x0820('0x113')](_0x48b5f0);}})[_0x0820('0x37')](function(_0x3f26d8){if(_0x3f26d8){return _0x3f26d8?{'count':_0x476eff,'rows':_0x3f26d8}:null;}})[_0x0820('0x37')](respondWithResult(_0x32844d,null))['catch'](handleError(_0x32844d,null));};exports[_0x0820('0x115')]=function(_0x50e116,_0x5a1c90,_0x2654d7){var _0x4bfd1c={};var _0x364951={};var _0x3e0005;var _0x57435e;return db['User'][_0x0820('0x93')]({'where':{'id':_0x50e116[_0x0820('0x66')]['id']}})['then'](handleEntityNotFound(_0x5a1c90,null))['then'](function(_0x301525){if(_0x301525){_0x3e0005=_0x301525;_0x364951['model']=_['keys'](db[_0x0820('0x49')][_0x0820('0x4a')]);_0x364951[_0x0820('0x50')]=_[_0x0820('0x51')](_0x50e116[_0x0820('0x50')]);_0x364951[_0x0820('0x52')]=_['intersection'](_0x364951['model'],_0x364951[_0x0820('0x50')]);_0x4bfd1c['attributes']=_[_0x0820('0x53')](_0x364951[_0x0820('0x54')],qs[_0x0820('0x56')](_0x50e116[_0x0820('0x50')]['fields']));_0x4bfd1c[_0x0820('0x55')]=_0x4bfd1c[_0x0820('0x55')][_0x0820('0x57')]?_0x4bfd1c[_0x0820('0x55')]:_0x364951['model'];_0x4bfd1c[_0x0820('0xc5')]=qs['sort'](_0x50e116['query']['sort']);_0x4bfd1c[_0x0820('0x5b')]=qs['filters'](_[_0x0820('0x5a')](_0x50e116['query'],_0x364951[_0x0820('0x52')]));if(_0x50e116[_0x0820('0x50')]['filter']){_0x4bfd1c[_0x0820('0x5b')]=_[_0x0820('0x5c')](_0x4bfd1c[_0x0820('0x5b')],{'$or':_[_0x0820('0x3f')](_0x4bfd1c[_0x0820('0x55')],function(_0x13a128){var _0x2aaf5d={};_0x2aaf5d[_0x13a128]={'$like':'%'+_0x50e116[_0x0820('0x50')][_0x0820('0x3d')]+'%'};return _0x2aaf5d;})});}_0x4bfd1c[_0x0820('0x54')]=db[_0x0820('0x49')];_0x4bfd1c['as']=_0x0820('0x3a');_0x4bfd1c=_[_0x0820('0x5c')]({},_0x4bfd1c,_0x50e116[_0x0820('0x60')]);return _0x3e0005['getVoiceQueues']({'include':[_0x4bfd1c]});}})[_0x0820('0x37')](function(_0x2b78d7){if(_0x2b78d7){var _0x2ebd4b={},_0x11b802=[],_0x317a84=0x0;for(var _0x4fe56d=0x0;_0x4fe56d<_0x2b78d7[_0x0820('0x57')];_0x4fe56d+=0x1){for(var _0x3d37dd=0x0,_0x46a771;_0x3d37dd<_0x2b78d7[_0x4fe56d][_0x0820('0x3a')][_0x0820('0x57')];_0x3d37dd+=0x1){_0x46a771=_0x2b78d7[_0x4fe56d][_0x0820('0x3a')][_0x3d37dd]['get']({'plain':!![]});_0x2ebd4b[_0x46a771['id']]=_0x46a771;}}_0x2ebd4b=_[_0x0820('0x116')](_0x2ebd4b);for(var _0x31a689=qs[_0x0820('0x31')](_0x50e116[_0x0820('0x50')][_0x0820('0x31')]);_0x31a689<_0x2ebd4b['length']&&_0x11b802[_0x0820('0x57')]=_0x5443b7[_0x5649('0x4e')]){throw new Error('Maximum\x20login\x20has\x20been\x20reached');}})[_0x5649('0x23')](function(){if(_0xd5f854){return db['UserVoiceQueueRt']['destroy']({'where':{'membername':_0xd5f854[_0x5649('0x28')]},'individualHooks':!![]});}})[_0x5649('0x23')](function(){if(_0xd5f854){return _0xd5f854[_0x5649('0x4f')]({'raw':!![]});}})[_0x5649('0x23')](function(_0x44c580){if(_0xd5f854){if(_0x44c580){var _0x13dbd0=[];_0x84c689=_0x44c580;if(_0x84c689[_0x5649('0x2e')]){for(var _0x4183f5=0x0;_0x4183f5<_0x84c689[_0x5649('0x2e')];_0x4183f5++){_0x13dbd0[_0x5649('0x33')](db[_0x5649('0x2a')][_0x5649('0x50')]({'membername':_0xd5f854[_0x5649('0x28')],'UserId':_0xd5f854['id'],'queue_name':_0x84c689[_0x4183f5][_0x5649('0x28')],'VoiceQueueId':_0x84c689[_0x4183f5]['id'],'interface':_0x3eaada,'paused':_0xd5f854[_0x5649('0x51')]||![],'penalty':_0x84c689[_0x4183f5][_0x5649('0x52')]||0x0}));}return BPromise[_0x5649('0x47')](_0x13dbd0);}}}})['then'](function(){if(_0xd5f854){return db[_0x5649('0x2c')][_0x5649('0x1b')]({'where':{'membername':_0xd5f854['name'],'exitAt':null}});}})[_0x5649('0x23')](function(_0x5a55c2){if(_0xd5f854){if(_0x5a55c2&&_0x5a55c2[_0x5649('0x2e')]){var _0x401956=[];_0x5a55c2['forEach'](function(_0x7d35f2){_0x401956[_0x5649('0x33')](_0x7d35f2[_0x5649('0x2b')]({'exitAt':moment()[_0x5649('0x2f')](_0x5649('0x30'))}));});return BPromise[_0x5649('0x47')](_0x401956);}}})[_0x5649('0x23')](function(_0x1ff2dd){if(_0xd5f854){var _0xf370b=[];var _0x3ed56c=[];var _0x2edbbe=utils['getChannels']();var _0x2aa47b={'membername':_0xd5f854[_0x5649('0x28')],'interface':_0x3eaada,'enterAt':moment()['format'](_0x5649('0x30')),'role':_0xd5f854[_0x5649('0x29')],'internal':_0xd5f854[_0x5649('0x3a')]};_0x2edbbe[_0x5649('0x32')](function(_0x9676e5){_0xf370b['push'](_['merge']({'channel':_0x9676e5,'type':'LOGIN','data1':_0x5649('0x53'),'data2':_0x3eaada},_0x2aa47b));if(_0xd5f854[_0x5649('0x51')]){_0x3ed56c[_0x5649('0x33')](_[_0x5649('0x54')]({'channel':_0x9676e5,'type':'PAUSE','data1':_0x5649('0x55')},_0x2aa47b));}});return db['MemberReport'][_0x5649('0x56')](_0xf370b['concat'](_0x3ed56c),{'individualHooks':!![]});}})[_0x5649('0x23')](function(){if(_0xd5f854){return _0xd5f854[_0x5649('0x2b')]({'online':!![],'lastLoginAt':moment()['format'](_0x5649('0x30')),'voicePause':_0xd5f854[_0x5649('0x51')]||![],'mailPause':_0xd5f854['loginInPause']||![],'chatPause':_0xd5f854[_0x5649('0x51')]||![],'faxPause':_0xd5f854[_0x5649('0x51')]||![],'smsPause':_0xd5f854[_0x5649('0x51')]||![],'openchannelPause':_0xd5f854[_0x5649('0x51')]||![],'pauseType':_0xd5f854[_0x5649('0x51')]?_0x5649('0x55'):null,'lastPauseAt':moment()[_0x5649('0x2f')](_0x5649('0x30')),'interface':_0x3eaada});}})['then'](function(_0x127c8d){_0x3facab(_0x127c8d);})['catch'](function(_0x401be5){_0x32cdd8(_0x5ebf82[_0x5649('0x15')](0x1f4,_0x401be5[_0x5649('0x17')]));});});}; \ No newline at end of file +var _0x954d=['GetUser','User','options','attributes','limit','include','map','model','then','ShowUser','find','raw','where','PauseUser','name','role','internal','interface','UserVoiceQueueRt','MemberReport','PAUSE','length','YYYY-MM-DD\x20HH:mm:ss','updateAttributes','getChannels','forEach','push','SIP/%s','format','body','type','uniqueid','bulkCreate','update','DEFAULT\x20PAUSE','UnpauseUser','channel','isValidChannel','Unknown\x20channel','voice','system','mail','fax','openchannel','%s%s','findAll','all','LogoutUser','findOne','LoginUser','mobile','count','agent','../../config/license/util','getLicense','agents','Maximum\x20login\x20has\x20been\x20reached','destroy','getVoiceQueues','upsert','loginInPause','merge','callysquare','LOGININPAUSE','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','redis','localhost','socket.io-emitter','./user.socket','register','request','info','User,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','result','catch'];(function(_0x22e366,_0x21689d){var _0x8d8067=function(_0x53f6ba){while(--_0x53f6ba){_0x22e366['push'](_0x22e366['shift']());}};_0x8d8067(++_0x21689d);}(_0x954d,0x9b));var _0xd954=function(_0x34fb19,_0xc493c6){_0x34fb19=_0x34fb19-0x0;var _0x3a1dcd=_0x954d[_0x34fb19];return _0x3a1dcd;};'use strict';var _=require(_0xd954('0x0'));var util=require(_0xd954('0x1'));var moment=require(_0xd954('0x2'));var BPromise=require(_0xd954('0x3'));var rs=require(_0xd954('0x4'));var fs=require('fs');var Redis=require(_0xd954('0x5'));var db=require(_0xd954('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xd954('0x7'))('rpc');var config=require(_0xd954('0x8'));var jayson=require(_0xd954('0x9'));var client=jayson[_0xd954('0xa')]['http']({'port':0x232a});config['redis']=_['defaults'](config[_0xd954('0xb')],{'host':_0xd954('0xc'),'port':0x18eb});var socket=require(_0xd954('0xd'))(new Redis(config[_0xd954('0xb')]));require(_0xd954('0xe'))[_0xd954('0xf')](socket);function respondWithRpcPromise(_0x5c745c,_0x4703c9,_0x1af138){return new BPromise(function(_0x486f14,_0xe5df76){return client[_0xd954('0x10')](_0x5c745c,_0x1af138)['then'](function(_0x417dd2){logger[_0xd954('0x11')](_0xd954('0x12'),_0x4703c9,'request\x20sent');logger[_0xd954('0x13')]('User,\x20%s,\x20%s,\x20%s',_0x4703c9,_0xd954('0x14'),JSON[_0xd954('0x15')](_0x417dd2));if(_0x417dd2[_0xd954('0x16')]){if(_0x417dd2[_0xd954('0x16')][_0xd954('0x17')]===0x1f4){logger[_0xd954('0x16')](_0xd954('0x12'),_0x4703c9,_0x417dd2[_0xd954('0x16')][_0xd954('0x18')]);return _0xe5df76(_0x417dd2[_0xd954('0x16')]['message']);}logger[_0xd954('0x16')](_0xd954('0x12'),_0x4703c9,_0x417dd2['error'][_0xd954('0x18')]);return _0x486f14(_0x417dd2[_0xd954('0x16')][_0xd954('0x18')]);}else{logger[_0xd954('0x11')]('User,\x20%s,\x20%s',_0x4703c9,'request\x20sent');_0x486f14(_0x417dd2[_0xd954('0x19')][_0xd954('0x18')]);}})[_0xd954('0x1a')](function(_0x21cf3){logger[_0xd954('0x16')](_0xd954('0x12'),_0x4703c9,_0x21cf3);_0xe5df76(_0x21cf3);});});}exports[_0xd954('0x1b')]=function(_0xa452d){var _0x12f7f8=this;return new Promise(function(_0x1071c6,_0xab2c9b){return db[_0xd954('0x1c')]['findAll']({'raw':_0xa452d[_0xd954('0x1d')]?_0xa452d['options']['raw']===undefined?!![]:![]:!![],'where':_0xa452d['options']?_0xa452d['options']['where']||null:null,'attributes':_0xa452d['options']?_0xa452d['options'][_0xd954('0x1e')]||null:null,'limit':_0xa452d[_0xd954('0x1d')]?_0xa452d['options'][_0xd954('0x1f')]||null:null,'include':_0xa452d['options']?_0xa452d[_0xd954('0x1d')][_0xd954('0x20')]?_[_0xd954('0x21')](_0xa452d[_0xd954('0x1d')][_0xd954('0x20')],function(_0x3ddd8b){return{'model':db[_0x3ddd8b['model']],'as':_0x3ddd8b['as'],'attributes':_0x3ddd8b[_0xd954('0x1e')],'include':_0x3ddd8b[_0xd954('0x20')]?_[_0xd954('0x21')](_0x3ddd8b[_0xd954('0x20')],function(_0x2c5bde){return{'model':db[_0x2c5bde[_0xd954('0x22')]],'as':_0x2c5bde['as'],'attributes':_0x2c5bde[_0xd954('0x1e')],'include':_0x2c5bde[_0xd954('0x20')]?_[_0xd954('0x21')](_0x2c5bde[_0xd954('0x20')],function(_0x289199){return{'model':db[_0x289199[_0xd954('0x22')]],'as':_0x289199['as'],'attributes':_0x289199[_0xd954('0x1e')]};}):[]};}):[]};}):[]:[]})[_0xd954('0x23')](function(_0x2a7395){logger['info'](_0xd954('0x1b'),_0xa452d);logger['debug'](_0xd954('0x1b'),_0xa452d,JSON[_0xd954('0x15')](_0x2a7395));_0x1071c6(_0x2a7395);})[_0xd954('0x1a')](function(_0x1f9960){logger['error'](_0xd954('0x1b'),_0x1f9960[_0xd954('0x18')],_0xa452d);_0xab2c9b(_0x12f7f8['error'](0x1f4,_0x1f9960[_0xd954('0x18')]));});});};exports[_0xd954('0x24')]=function(_0x23cbb5){var _0x3f6cc4=this;return new Promise(function(_0x3116d1,_0x5b9b9a){return db[_0xd954('0x1c')][_0xd954('0x25')]({'raw':_0x23cbb5[_0xd954('0x1d')]?_0x23cbb5[_0xd954('0x1d')][_0xd954('0x26')]===undefined?!![]:![]:!![],'where':_0x23cbb5[_0xd954('0x1d')]?_0x23cbb5['options'][_0xd954('0x27')]||null:null,'attributes':_0x23cbb5['options']?_0x23cbb5[_0xd954('0x1d')][_0xd954('0x1e')]||null:null,'include':_0x23cbb5[_0xd954('0x1d')]?_0x23cbb5[_0xd954('0x1d')]['include']?_[_0xd954('0x21')](_0x23cbb5[_0xd954('0x1d')][_0xd954('0x20')],function(_0x521cd7){return{'model':db[_0x521cd7[_0xd954('0x22')]],'as':_0x521cd7['as'],'attributes':_0x521cd7[_0xd954('0x1e')],'include':_0x521cd7['include']?_[_0xd954('0x21')](_0x521cd7[_0xd954('0x20')],function(_0x56ae4d){return{'model':db[_0x56ae4d[_0xd954('0x22')]],'as':_0x56ae4d['as'],'attributes':_0x56ae4d[_0xd954('0x1e')],'include':_0x56ae4d['include']?_[_0xd954('0x21')](_0x56ae4d[_0xd954('0x20')],function(_0x4f2fe2){return{'model':db[_0x4f2fe2[_0xd954('0x22')]],'as':_0x4f2fe2['as'],'attributes':_0x4f2fe2[_0xd954('0x1e')]};}):[]};}):[]};}):[]:[]})[_0xd954('0x23')](function(_0x3866fa){logger['info'](_0xd954('0x24'),_0x23cbb5);logger[_0xd954('0x13')](_0xd954('0x24'),_0x23cbb5,JSON['stringify'](_0x3866fa));_0x3116d1(_0x3866fa);})[_0xd954('0x1a')](function(_0x1f3282){logger['error'](_0xd954('0x24'),_0x1f3282[_0xd954('0x18')],_0x23cbb5);_0x5b9b9a(_0x3f6cc4[_0xd954('0x16')](0x1f4,_0x1f3282['message']));});});};exports[_0xd954('0x28')]=function(_0x5bed01){var _0x3a0b73=this;return new Promise(function(_0x2316d4,_0x5b0e94){var _0x828e4a;return db[_0xd954('0x1c')][_0xd954('0x25')]({'where':_0x5bed01['options']['where']||{},'attributes':['id',_0xd954('0x29'),_0xd954('0x2a'),_0xd954('0x2b'),_0xd954('0x2c')]})['then'](function(_0x137af9){if(_0x137af9){_0x828e4a=_0x137af9;return db[_0xd954('0x2d')]['update']({'paused':0x1},{'where':{'UserId':_0x828e4a['id']},'individualHooks':!![]});}})[_0xd954('0x23')](function(){if(_0x828e4a){return db[_0xd954('0x2e')]['findAll']({'where':{'membername':_0x828e4a[_0xd954('0x29')],'type':_0xd954('0x2f'),'exitAt':null}});}})[_0xd954('0x23')](function(_0x21f87e){if(_0x828e4a){if(_0x21f87e&&_0x21f87e[_0xd954('0x30')]){var _0x5004a6=moment()['format'](_0xd954('0x31'));for(var _0x23a049=0x0,_0x41244b=_0x21f87e[_0xd954('0x30')];_0x23a049<_0x41244b;_0x23a049++){_0x21f87e[_0x23a049][_0xd954('0x32')]({'exitAt':_0x5004a6});}}}})[_0xd954('0x23')](function(){if(_0x828e4a){var _0xb213cd=[];var _0x645330=utils[_0xd954('0x33')]();_0x645330[_0xd954('0x34')](function(_0x3b1c01){_0xb213cd[_0xd954('0x35')]({'channel':_0x3b1c01,'membername':_0x828e4a[_0xd954('0x29')],'interface':_['isNil'](_0x828e4a[_0xd954('0x2c')])?util['format'](_0xd954('0x36'),_0x828e4a[_0xd954('0x29')]):_0x828e4a['interface'],'type':_0xd954('0x2f'),'enterAt':moment()[_0xd954('0x37')](_0xd954('0x31')),'data1':_0x5bed01[_0xd954('0x38')][_0xd954('0x39')]||'DEFAULT\x20PAUSE','role':_0x828e4a[_0xd954('0x2a')],'internal':_0x828e4a[_0xd954('0x2b')],'uniqueid':_0x5bed01[_0xd954('0x38')][_0xd954('0x3a')]||null});});return db['MemberReport'][_0xd954('0x3b')](_0xb213cd,{'individualHooks':!![]});}})[_0xd954('0x23')](function(){if(_0x828e4a){return _0x828e4a[_0xd954('0x3c')]({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'openchannelPause':!![],'pauseType':_0x5bed01[_0xd954('0x38')][_0xd954('0x39')]||_0xd954('0x3d'),'lastPauseAt':moment()[_0xd954('0x37')](_0xd954('0x31'))});}})[_0xd954('0x23')](function(_0x11479d){_0x2316d4(_0x11479d);})['catch'](function(_0x3dfe22){_0x5b0e94(_0x3a0b73[_0xd954('0x16')](0x1f4,_0x3dfe22[_0xd954('0x18')]));});});};exports[_0xd954('0x3e')]=function(_0xd7a07d){var _0x2e94d9=this;return new Promise(function(_0x50912e,_0x1fb8ac){var _0x404c63;return db[_0xd954('0x1c')]['findOne']({'where':_0xd7a07d[_0xd954('0x1d')][_0xd954('0x27')]||{},'attributes':['id',_0xd954('0x29')]})['then'](function(_0x1e055a){if(_0x1e055a){_0x404c63=_0x1e055a;if(_0xd7a07d['body'][_0xd954('0x3f')]&&!utils[_0xd954('0x40')](_0xd7a07d[_0xd954('0x38')]['channel'])){throw new Error(_0xd954('0x41'));}switch(_0xd7a07d['body'][_0xd954('0x3f')]){case _0xd954('0x42'):return db[_0xd954('0x2d')]['update']({'paused':0x0},{'where':{'UserId':_0x404c63['id']}})[_0xd954('0x23')](function(){return db[_0xd954('0x2e')][_0xd954('0x25')]({'where':{'channel':_0xd7a07d['body'][_0xd954('0x3f')],'membername':_0x404c63['name'],'type':'PAUSE','exitAt':null}});})[_0xd954('0x23')](function(_0x33b1e6){if(_0x33b1e6){return _0x33b1e6[_0xd954('0x3c')]({'exitAt':moment()[_0xd954('0x37')]('YYYY-MM-DD\x20HH:mm:ss'),'data2':_0xd954('0x43')},{'individualHooks':!![]});}return null;})['then'](function(){return _0x404c63[_0xd954('0x3c')]({'voicePause':![]});});case _0xd954('0x44'):case'chat':case _0xd954('0x45'):case'sms':case _0xd954('0x46'):return db[_0xd954('0x2e')]['find']({'where':{'channel':_0xd7a07d['body']['channel'],'membername':_0x404c63[_0xd954('0x29')],'type':'PAUSE','exitAt':null}})['then'](function(_0x3064f5){return _0x3064f5[_0xd954('0x3c')]({'exitAt':moment()[_0xd954('0x37')](_0xd954('0x31')),'data2':_0xd954('0x43')},{'individualHooks':!![]});})[_0xd954('0x23')](function(){var _0x402db5={};_['set'](_0x402db5,util[_0xd954('0x37')](_0xd954('0x47'),_0xd7a07d[_0xd954('0x38')][_0xd954('0x3f')],'Pause'),![]);return _0x404c63[_0xd954('0x3c')](_0x402db5);});default:return db[_0xd954('0x2d')]['update']({'paused':0x0},{'where':{'UserId':_0x404c63['id']}})[_0xd954('0x23')](function(){return db['MemberReport'][_0xd954('0x48')]({'where':{'membername':_0x404c63['name'],'type':'PAUSE','exitAt':null}});})[_0xd954('0x23')](function(_0x21e02c){var _0x28d5a5=[];_0x21e02c[_0xd954('0x34')](function(_0x23658f){_0x28d5a5['push'](_0x23658f[_0xd954('0x3c')]({'exitAt':moment()[_0xd954('0x37')](_0xd954('0x31')),'data2':_0xd954('0x43')}));});return BPromise[_0xd954('0x49')](_0x28d5a5);})[_0xd954('0x23')](function(){return _0x404c63[_0xd954('0x3c')]({'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![]});});}}})[_0xd954('0x23')](function(_0x7ebc61){_0x50912e(_0x7ebc61);})[_0xd954('0x1a')](function(_0x2c9a08){_0x1fb8ac(_0x2e94d9[_0xd954('0x16')](0x1f4,_0x2c9a08['message']));});});};exports[_0xd954('0x4a')]=function(_0x40f697){var _0x28d2cb=this;return new Promise(function(_0x2fb763,_0x50ee9a){var _0x3fd92d;return db[_0xd954('0x1c')][_0xd954('0x4b')]({'where':_0x40f697['options']['where']||{},'attributes':['id','name']})[_0xd954('0x23')](function(_0x4d807e){if(_0x4d807e){_0x3fd92d=_0x4d807e;return db[_0xd954('0x2d')]['destroy']({'where':{'membername':_0x3fd92d[_0xd954('0x29')]},'individualHooks':!![]});}})[_0xd954('0x23')](function(){if(_0x3fd92d){return db['MemberReport'][_0xd954('0x48')]({'where':{'membername':_0x3fd92d['name'],'exitAt':null}});}})[_0xd954('0x23')](function(_0x299583){if(_0x3fd92d){if(_0x299583&&_0x299583['length']){var _0x3756d5=[];_0x299583[_0xd954('0x34')](function(_0x12f44a){_0x3756d5[_0xd954('0x35')](_0x12f44a[_0xd954('0x3c')]({'exitAt':moment()[_0xd954('0x37')](_0xd954('0x31'))}));});return BPromise[_0xd954('0x49')](_0x3756d5);}}})['then'](function(){if(_0x3fd92d){return _0x3fd92d['update']({'online':![],'lastLoginAt':null,'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![]});}})[_0xd954('0x23')](function(_0x5365a0){_0x2fb763(_0x5365a0);})[_0xd954('0x1a')](function(_0x57ec94){_0x50ee9a(_0x28d2cb[_0xd954('0x16')](0x1f4,_0x57ec94[_0xd954('0x18')]));});});};exports[_0xd954('0x4c')]=function(_0x32976d){var _0x2ed64c=this;return new Promise(function(_0x294ff4,_0x401316){var _0x220f4e;var _0x3a7938;var _0xcf28b4;var _0x5b2305;return db['User'][_0xd954('0x4b')]({'where':_0x32976d[_0xd954('0x1d')][_0xd954('0x27')]||{},'attributes':['id',_0xd954('0x29'),_0xd954('0x2a'),_0xd954('0x4d'),'phone',_0xd954('0x2b'),'loginInPause',_0xd954('0x2c')]})[_0xd954('0x23')](function(_0x4c08a9){if(_0x4c08a9){_0x220f4e=_0x4c08a9;_0x5b2305=_0x32976d[_0xd954('0x38')]['interface']?_0x32976d[_0xd954('0x38')][_0xd954('0x2c')]:util['format'](_0xd954('0x36'),_0x220f4e[_0xd954('0x29')]);return db[_0xd954('0x1c')][_0xd954('0x4e')]({'where':{'role':_0xd954('0x4f'),'online':!![],'id':{'$ne':_0x220f4e['id']}}});}})[_0xd954('0x23')](function(_0x44fac9){if(_0x44fac9){_0xcf28b4=_0x44fac9;return require(_0xd954('0x50'))[_0xd954('0x51')]();}})[_0xd954('0x23')](function(_0x5bcdd4){if(_0x5bcdd4&&_0x5bcdd4['agents']&&_0xcf28b4>=_0x5bcdd4[_0xd954('0x52')]){throw new Error(_0xd954('0x53'));}})[_0xd954('0x23')](function(){if(_0x220f4e){return db[_0xd954('0x2d')][_0xd954('0x54')]({'where':{'membername':_0x220f4e[_0xd954('0x29')]},'individualHooks':!![]});}})[_0xd954('0x23')](function(){if(_0x220f4e){return _0x220f4e[_0xd954('0x55')]({'raw':!![]});}})['then'](function(_0x4e3691){if(_0x220f4e){if(_0x4e3691){var _0x971184=[];_0x3a7938=_0x4e3691;if(_0x3a7938[_0xd954('0x30')]){for(var _0xc1df5f=0x0;_0xc1df5f<_0x3a7938[_0xd954('0x30')];_0xc1df5f++){_0x971184[_0xd954('0x35')](db['UserVoiceQueueRt'][_0xd954('0x56')]({'membername':_0x220f4e['name'],'UserId':_0x220f4e['id'],'queue_name':_0x3a7938[_0xc1df5f][_0xd954('0x29')],'VoiceQueueId':_0x3a7938[_0xc1df5f]['id'],'interface':_0x5b2305,'paused':_0x220f4e[_0xd954('0x57')]||![],'penalty':_0x3a7938[_0xc1df5f]['UserVoiceQueue.penalty']||0x0}));}return BPromise[_0xd954('0x49')](_0x971184);}}}})[_0xd954('0x23')](function(){if(_0x220f4e){return db[_0xd954('0x2e')][_0xd954('0x48')]({'where':{'membername':_0x220f4e[_0xd954('0x29')],'exitAt':null}});}})[_0xd954('0x23')](function(_0x8f58a4){if(_0x220f4e){if(_0x8f58a4&&_0x8f58a4[_0xd954('0x30')]){var _0x50f6ac=[];_0x8f58a4[_0xd954('0x34')](function(_0x417dfa){_0x50f6ac[_0xd954('0x35')](_0x417dfa[_0xd954('0x3c')]({'exitAt':moment()['format'](_0xd954('0x31'))}));});return BPromise[_0xd954('0x49')](_0x50f6ac);}}})['then'](function(_0x5143bd){if(_0x220f4e){var _0x1e4315=[];var _0x172fab=[];var _0x432da9=utils[_0xd954('0x33')]();var _0x26d2c3={'membername':_0x220f4e['name'],'interface':_0x5b2305,'enterAt':moment()[_0xd954('0x37')](_0xd954('0x31')),'role':_0x220f4e[_0xd954('0x2a')],'internal':_0x220f4e[_0xd954('0x2b')]};_0x432da9['forEach'](function(_0x4edb4c){_0x1e4315[_0xd954('0x35')](_[_0xd954('0x58')]({'channel':_0x4edb4c,'type':'LOGIN','data1':_0xd954('0x59'),'data2':_0x5b2305},_0x26d2c3));if(_0x220f4e[_0xd954('0x57')]){_0x172fab['push'](_['merge']({'channel':_0x4edb4c,'type':_0xd954('0x2f'),'data1':'LOGININPAUSE'},_0x26d2c3));}});return db[_0xd954('0x2e')][_0xd954('0x3b')](_0x1e4315['concat'](_0x172fab),{'individualHooks':!![]});}})[_0xd954('0x23')](function(){if(_0x220f4e){return _0x220f4e[_0xd954('0x3c')]({'online':!![],'lastLoginAt':moment()[_0xd954('0x37')](_0xd954('0x31')),'voicePause':_0x220f4e[_0xd954('0x57')]||![],'mailPause':_0x220f4e['loginInPause']||![],'chatPause':_0x220f4e[_0xd954('0x57')]||![],'faxPause':_0x220f4e[_0xd954('0x57')]||![],'smsPause':_0x220f4e[_0xd954('0x57')]||![],'openchannelPause':_0x220f4e[_0xd954('0x57')]||![],'pauseType':_0x220f4e[_0xd954('0x57')]?_0xd954('0x5a'):null,'lastPauseAt':moment()[_0xd954('0x37')](_0xd954('0x31')),'interface':_0x5b2305});}})[_0xd954('0x23')](function(_0x445590){_0x294ff4(_0x445590);})[_0xd954('0x1a')](function(_0xaba1c7){_0x401316(_0x2ed64c[_0xd954('0x16')](0x1f4,_0xaba1c7[_0xd954('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/user/user.socket.js b/server/api/user/user.socket.js index 21298c2..6de7415 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 _0xaa78=['save','remove','update','emit','removeListener','register','user:','./user.events'];(function(_0x41bbfd,_0x5df31a){var _0x5484c1=function(_0x4c5743){while(--_0x4c5743){_0x41bbfd['push'](_0x41bbfd['shift']());}};_0x5484c1(++_0x5df31a);}(_0xaa78,0x197));var _0x8aa7=function(_0x5c0979,_0x287854){_0x5c0979=_0x5c0979-0x0;var _0x309972=_0xaa78[_0x5c0979];return _0x309972;};'use strict';var UserEvents=require(_0x8aa7('0x0'));var events=[_0x8aa7('0x1'),_0x8aa7('0x2'),_0x8aa7('0x3')];function createListener(_0x3ca42b,_0x2090e3){return function(_0x5740ce){_0x2090e3[_0x8aa7('0x4')](_0x3ca42b,_0x5740ce);};}function removeListener(_0x301f1c,_0x1374b5){return function(){UserEvents[_0x8aa7('0x5')](_0x301f1c,_0x1374b5);};}exports[_0x8aa7('0x6')]=function(_0x20c13d){for(var _0x22a25a=0x0,_0x37537b=events['length'];_0x22a25a<_0x37537b;_0x22a25a++){var _0x2dd4ab=events[_0x22a25a];var _0x590a81=createListener(_0x8aa7('0x7')+_0x2dd4ab,_0x20c13d);UserEvents['on'](_0x2dd4ab,_0x590a81);}}; \ No newline at end of file +var _0xcd5e=['length','./user.events','save','update','removeListener','register'];(function(_0x1cc8fe,_0x105328){var _0x230054=function(_0x1a1b56){while(--_0x1a1b56){_0x1cc8fe['push'](_0x1cc8fe['shift']());}};_0x230054(++_0x105328);}(_0xcd5e,0x12d));var _0xecd5=function(_0x3d3c64,_0x4bf2da){_0x3d3c64=_0x3d3c64-0x0;var _0x313642=_0xcd5e[_0x3d3c64];return _0x313642;};'use strict';var UserEvents=require(_0xecd5('0x0'));var events=[_0xecd5('0x1'),'remove',_0xecd5('0x2')];function createListener(_0x5d16a6,_0x41be60){return function(_0x30fa79){_0x41be60['emit'](_0x5d16a6,_0x30fa79);};}function removeListener(_0x5a53c5,_0x2f5465){return function(){UserEvents[_0xecd5('0x3')](_0x5a53c5,_0x2f5465);};}exports[_0xecd5('0x4')]=function(_0x41546f){for(var _0x1cbdb7=0x0,_0x368673=events[_0xecd5('0x5')];_0x1cbdb7<_0x368673;_0x1cbdb7++){var _0x4b373f=events[_0x1cbdb7];var _0x59cf1a=createListener('user:'+_0x4b373f,_0x41546f);UserEvents['on'](_0x4b373f,_0x59cf1a);}}; \ No newline at end of file diff --git a/server/api/userChatQueue/index.js b/server/api/userChatQueue/index.js index 68ad3a8..48b2cd7 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 _0x9eb2=['exports','multer','util','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x5f519b,_0x5b606f){var _0x2461e2=function(_0x510241){while(--_0x510241){_0x5f519b['push'](_0x5f519b['shift']());}};_0x2461e2(++_0x5b606f);}(_0x9eb2,0x1a9));var _0x29eb=function(_0x465f7b,_0x77be70){_0x465f7b=_0x465f7b-0x0;var _0x1927c2=_0x9eb2[_0x465f7b];return _0x1927c2;};'use strict';var multer=require(_0x29eb('0x0'));var util=require(_0x29eb('0x1'));var path=require('path');var timeout=require(_0x29eb('0x2'));var express=require(_0x29eb('0x3'));var router=express['Router']();var auth=require(_0x29eb('0x4'));var interaction=require(_0x29eb('0x5'));var config=require(_0x29eb('0x6'));module[_0x29eb('0x7')]=router; \ No newline at end of file +var _0x5a4a=['multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','exports'];(function(_0x3a6efb,_0x51f0df){var _0x32cbad=function(_0x3b86af){while(--_0x3b86af){_0x3a6efb['push'](_0x3a6efb['shift']());}};_0x32cbad(++_0x51f0df);}(_0x5a4a,0xfc));var _0xa5a4=function(_0x149c25,_0x402f03){_0x149c25=_0x149c25-0x0;var _0x2455fc=_0x5a4a[_0x149c25];return _0x2455fc;};'use strict';var multer=require(_0xa5a4('0x0'));var util=require(_0xa5a4('0x1'));var path=require(_0xa5a4('0x2'));var timeout=require(_0xa5a4('0x3'));var express=require(_0xa5a4('0x4'));var router=express[_0xa5a4('0x5')]();var auth=require(_0xa5a4('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xa5a4('0x7'));module[_0xa5a4('0x8')]=router; \ No newline at end of file diff --git a/server/api/userChatQueue/userChatQueue.attributes.js b/server/api/userChatQueue/userChatQueue.attributes.js index bcf8ebd..0f900bf 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 _0xd8b0=['exports','sequelize'];(function(_0x58dbb8,_0x43ff61){var _0x1e83c5=function(_0x299565){while(--_0x299565){_0x58dbb8['push'](_0x58dbb8['shift']());}};_0x1e83c5(++_0x43ff61);}(_0xd8b0,0xad));var _0x0d8b=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xd8b0[_0xa464c9];return _0x3d73c4;};'use strict';var Sequelize=require(_0x0d8b('0x0'));module[_0x0d8b('0x1')]={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0xbaf0=['exports','INTEGER'];(function(_0x4c67b8,_0x571e13){var _0xbc26e=function(_0x16e9ac){while(--_0x16e9ac){_0x4c67b8['push'](_0x4c67b8['shift']());}};_0xbc26e(++_0x571e13);}(_0xbaf0,0x12a));var _0x0baf=function(_0x465028,_0x4570ac){_0x465028=_0x465028-0x0;var _0xb783d4=_0xbaf0[_0x465028];return _0xb783d4;};'use strict';var Sequelize=require('sequelize');module[_0x0baf('0x0')]={'penalty':{'type':Sequelize[_0x0baf('0x1')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userChatQueue/userChatQueue.model.js b/server/api/userChatQueue/userChatQueue.model.js index ab5e66b..67f6639 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 _0xafe8=['exports','define','UserChatQueue','user_has_chat_queues','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./userChatQueue.attributes'];(function(_0x43fe92,_0x2cb722){var _0x104f4f=function(_0x19e572){while(--_0x19e572){_0x43fe92['push'](_0x43fe92['shift']());}};_0x104f4f(++_0x2cb722);}(_0xafe8,0xe4));var _0x8afe=function(_0x1c7137,_0x4c7c26){_0x1c7137=_0x1c7137-0x0;var _0xeb4432=_0xafe8[_0x1c7137];return _0xeb4432;};'use strict';var _=require(_0x8afe('0x0'));var util=require(_0x8afe('0x1'));var logger=require(_0x8afe('0x2'))(_0x8afe('0x3'));var moment=require(_0x8afe('0x4'));var BPromise=require('bluebird');var rp=require(_0x8afe('0x5'));var fs=require('fs');var path=require(_0x8afe('0x6'));var rimraf=require(_0x8afe('0x7'));var config=require(_0x8afe('0x8'));var attributes=require(_0x8afe('0x9'));module[_0x8afe('0xa')]=function(_0x4e614e,_0x31ec0f){return _0x4e614e[_0x8afe('0xb')](_0x8afe('0xc'),attributes,{'tableName':_0x8afe('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4643=['bluebird','request-promise','path','rimraf','../../config/environment','./userChatQueue.attributes','UserChatQueue','user_has_chat_queues','api','moment'];(function(_0x3c0c92,_0x267969){var _0xe3859b=function(_0x4d38f2){while(--_0x4d38f2){_0x3c0c92['push'](_0x3c0c92['shift']());}};_0xe3859b(++_0x267969);}(_0x4643,0x116));var _0x3464=function(_0x1928c9,_0x13a6d1){_0x1928c9=_0x1928c9-0x0;var _0x51b5fb=_0x4643[_0x1928c9];return _0x51b5fb;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0x3464('0x0'));var moment=require(_0x3464('0x1'));var BPromise=require(_0x3464('0x2'));var rp=require(_0x3464('0x3'));var fs=require('fs');var path=require(_0x3464('0x4'));var rimraf=require(_0x3464('0x5'));var config=require(_0x3464('0x6'));var attributes=require(_0x3464('0x7'));module['exports']=function(_0xe5c7a9,_0x479d6e){return _0xe5c7a9['define'](_0x3464('0x8'),attributes,{'tableName':_0x3464('0x9'),'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 0206ad5..d1b6e6c 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 _0xcef9=['request','UserChatQueue,\x20%s,\x20%s','request\x20sent','UserChatQueue,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client'];(function(_0x5b6d2a,_0x2a4e3b){var _0x536640=function(_0x38f760){while(--_0x38f760){_0x5b6d2a['push'](_0x5b6d2a['shift']());}};_0x536640(++_0x2a4e3b);}(_0xcef9,0x139));var _0x9cef=function(_0x346db7,_0x57eb0b){_0x346db7=_0x346db7-0x0;var _0x515430=_0xcef9[_0x346db7];return _0x515430;};'use strict';var _=require(_0x9cef('0x0'));var util=require('util');var moment=require(_0x9cef('0x1'));var BPromise=require(_0x9cef('0x2'));var rs=require(_0x9cef('0x3'));var fs=require('fs');var Redis=require(_0x9cef('0x4'));var db=require(_0x9cef('0x5'))['db'];var utils=require(_0x9cef('0x6'));var logger=require(_0x9cef('0x7'))(_0x9cef('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x9cef('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x487c90,_0x45b6e1,_0x2262bb){return new BPromise(function(_0x1ca60a,_0x235625){return client[_0x9cef('0xa')](_0x487c90,_0x2262bb)['then'](function(_0x47f33b){logger['info'](_0x9cef('0xb'),_0x45b6e1,_0x9cef('0xc'));logger['debug'](_0x9cef('0xd'),_0x45b6e1,_0x9cef('0xc'),JSON[_0x9cef('0xe')](_0x47f33b));if(_0x47f33b[_0x9cef('0xf')]){if(_0x47f33b['error']['code']===0x1f4){logger[_0x9cef('0xf')](_0x9cef('0xb'),_0x45b6e1,_0x47f33b[_0x9cef('0xf')][_0x9cef('0x10')]);return _0x235625(_0x47f33b[_0x9cef('0xf')][_0x9cef('0x10')]);}logger[_0x9cef('0xf')](_0x9cef('0xb'),_0x45b6e1,_0x47f33b['error'][_0x9cef('0x10')]);return _0x1ca60a(_0x47f33b[_0x9cef('0xf')][_0x9cef('0x10')]);}else{logger[_0x9cef('0x11')](_0x9cef('0xb'),_0x45b6e1,_0x9cef('0xc'));_0x1ca60a(_0x47f33b[_0x9cef('0x12')][_0x9cef('0x10')]);}})['catch'](function(_0x3c2894){logger[_0x9cef('0xf')](_0x9cef('0xb'),_0x45b6e1,_0x3c2894);_0x235625(_0x3c2894);});});} \ No newline at end of file +var _0x38c8=['rpc','../../config/environment','jayson/promise','http','then','info','request\x20sent','UserChatQueue,\x20%s,\x20%s,\x20%s','stringify','error','UserChatQueue,\x20%s,\x20%s','message','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x38c8,0xbe));var _0x838c=function(_0x4f3b2d,_0x3bbf46){_0x4f3b2d=_0x4f3b2d-0x0;var _0x3dddfa=_0x38c8[_0x4f3b2d];return _0x3dddfa;};'use strict';var _=require(_0x838c('0x0'));var util=require(_0x838c('0x1'));var moment=require('moment');var BPromise=require(_0x838c('0x2'));var rs=require(_0x838c('0x3'));var fs=require('fs');var Redis=require(_0x838c('0x4'));var db=require(_0x838c('0x5'))['db'];var utils=require(_0x838c('0x6'));var logger=require(_0x838c('0x7'))(_0x838c('0x8'));var config=require(_0x838c('0x9'));var jayson=require(_0x838c('0xa'));var client=jayson['client'][_0x838c('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2fce3c,_0x47a847,_0x55e833){return new BPromise(function(_0x3c6574,_0x30e656){return client['request'](_0x2fce3c,_0x55e833)[_0x838c('0xc')](function(_0x19157b){logger[_0x838c('0xd')]('UserChatQueue,\x20%s,\x20%s',_0x47a847,_0x838c('0xe'));logger['debug'](_0x838c('0xf'),_0x47a847,_0x838c('0xe'),JSON[_0x838c('0x10')](_0x19157b));if(_0x19157b['error']){if(_0x19157b[_0x838c('0x11')]['code']===0x1f4){logger['error'](_0x838c('0x12'),_0x47a847,_0x19157b['error'][_0x838c('0x13')]);return _0x30e656(_0x19157b[_0x838c('0x11')][_0x838c('0x13')]);}logger[_0x838c('0x11')](_0x838c('0x12'),_0x47a847,_0x19157b[_0x838c('0x11')][_0x838c('0x13')]);return _0x3c6574(_0x19157b['error'][_0x838c('0x13')]);}else{logger[_0x838c('0xd')](_0x838c('0x12'),_0x47a847,_0x838c('0xe'));_0x3c6574(_0x19157b[_0x838c('0x14')][_0x838c('0x13')]);}})[_0x838c('0x15')](function(_0x34a9d){logger[_0x838c('0x11')]('UserChatQueue,\x20%s,\x20%s',_0x47a847,_0x34a9d);_0x30e656(_0x34a9d);});});} \ No newline at end of file diff --git a/server/api/userFaxQueue/index.js b/server/api/userFaxQueue/index.js index 860350b..61728b9 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 _0xdd48=['connect-timeout','Router','../../components/auth/service','../../config/environment','exports','multer','util'];(function(_0x418237,_0x393768){var _0x5734fc=function(_0x281f5a){while(--_0x281f5a){_0x418237['push'](_0x418237['shift']());}};_0x5734fc(++_0x393768);}(_0xdd48,0xec));var _0x8dd4=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xdd48[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0x8dd4('0x0'));var util=require(_0x8dd4('0x1'));var path=require('path');var timeout=require(_0x8dd4('0x2'));var express=require('express');var router=express[_0x8dd4('0x3')]();var auth=require(_0x8dd4('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x8dd4('0x5'));module[_0x8dd4('0x6')]=router; \ No newline at end of file +var _0xe308=['path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','util'];(function(_0x458e08,_0x4a97b1){var _0x1c088d=function(_0x254632){while(--_0x254632){_0x458e08['push'](_0x458e08['shift']());}};_0x1c088d(++_0x4a97b1);}(_0xe308,0x110));var _0x8e30=function(_0x40d9ec,_0x142a71){_0x40d9ec=_0x40d9ec-0x0;var _0x4dc31d=_0xe308[_0x40d9ec];return _0x4dc31d;};'use strict';var multer=require('multer');var util=require(_0x8e30('0x0'));var path=require(_0x8e30('0x1'));var timeout=require('connect-timeout');var express=require(_0x8e30('0x2'));var router=express[_0x8e30('0x3')]();var auth=require(_0x8e30('0x4'));var interaction=require(_0x8e30('0x5'));var config=require(_0x8e30('0x6'));module['exports']=router; \ No newline at end of file diff --git a/server/api/userFaxQueue/userFaxQueue.attributes.js b/server/api/userFaxQueue/userFaxQueue.attributes.js index 022ea92..062d3d0 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 _0xb10b=['STRING','sequelize','INTEGER'];(function(_0x51549f,_0x371d86){var _0x1e0591=function(_0x1a68a1){while(--_0x1a68a1){_0x51549f['push'](_0x51549f['shift']());}};_0x1e0591(++_0x371d86);}(_0xb10b,0x12a));var _0xbb10=function(_0x25c5a4,_0x1922b9){_0x25c5a4=_0x25c5a4-0x0;var _0x3f191b=_0xb10b[_0x25c5a4];return _0x3f191b;};'use strict';var Sequelize=require(_0xbb10('0x0'));module['exports']={'penalty':{'type':Sequelize[_0xbb10('0x1')],'defaultValue':0x0},'assigned':{'type':Sequelize[_0xbb10('0x1')],'defaultValue':0x0},'queue':{'type':Sequelize[_0xbb10('0x2')]}}; \ No newline at end of file +var _0xb03e=['INTEGER','STRING','exports'];(function(_0x18cd5b,_0x10240b){var _0x5eaa52=function(_0x2bccad){while(--_0x2bccad){_0x18cd5b['push'](_0x18cd5b['shift']());}};_0x5eaa52(++_0x10240b);}(_0xb03e,0x1eb));var _0xeb03=function(_0x583a0a,_0x2d1dd6){_0x583a0a=_0x583a0a-0x0;var _0x4e6481=_0xb03e[_0x583a0a];return _0x4e6481;};'use strict';var Sequelize=require('sequelize');module[_0xeb03('0x0')]={'penalty':{'type':Sequelize[_0xeb03('0x1')],'defaultValue':0x0},'assigned':{'type':Sequelize[_0xeb03('0x1')],'defaultValue':0x0},'queue':{'type':Sequelize[_0xeb03('0x2')]}}; \ No newline at end of file diff --git a/server/api/userFaxQueue/userFaxQueue.model.js b/server/api/userFaxQueue/userFaxQueue.model.js index fff9652..9361b05 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(_0xd67723,_0x1e576f){var _0x53b62b=function(_0x2460a3){while(--_0x2460a3){_0xd67723['push'](_0xd67723['shift']());}};_0x53b62b(++_0x1e576f);}(_0xb10b,0x12a));var _0xbb10=function(_0x52c1e1,_0x5d4e83){_0x52c1e1=_0x52c1e1-0x0;var _0x25d937=_0xb10b[_0x52c1e1];return _0x25d937;};'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(_0x394cdf,_0xb53aa5){var _0x3b553f=function(_0x40b7f5){while(--_0x40b7f5){_0x394cdf['push'](_0x394cdf['shift']());}};_0x3b553f(++_0xb53aa5);}(_0x5f2f,0x73));var _0xf5f2=function(_0x102539,_0x18d10a){_0x102539=_0x102539-0x0;var _0x4e3c3d=_0x5f2f[_0x102539];return _0x4e3c3d;};'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 48edfec..5c4d458 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 _0xaf23=['jayson/promise','request','UserFaxQueue,\x20%s,\x20%s','request\x20sent','debug','UserFaxQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc'];(function(_0xb96ae6,_0x4c6602){var _0x2dc126=function(_0x4fe7ed){while(--_0x4fe7ed){_0xb96ae6['push'](_0xb96ae6['shift']());}};_0x2dc126(++_0x4c6602);}(_0xaf23,0x11a));var _0x3af2=function(_0x4f192e,_0x4d1756){_0x4f192e=_0x4f192e-0x0;var _0x49294d=_0xaf23[_0x4f192e];return _0x49294d;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x3af2('0x0'));var BPromise=require(_0x3af2('0x1'));var rs=require(_0x3af2('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x3af2('0x3'))['db'];var utils=require(_0x3af2('0x4'));var logger=require('../../config/logger')(_0x3af2('0x5'));var config=require('../../config/environment');var jayson=require(_0x3af2('0x6'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x141c5e,_0x1af3de,_0x6df222){return new BPromise(function(_0x27b4b0,_0x587abd){return client[_0x3af2('0x7')](_0x141c5e,_0x6df222)['then'](function(_0x23ebd8){logger['info'](_0x3af2('0x8'),_0x1af3de,_0x3af2('0x9'));logger[_0x3af2('0xa')](_0x3af2('0xb'),_0x1af3de,_0x3af2('0x9'),JSON[_0x3af2('0xc')](_0x23ebd8));if(_0x23ebd8[_0x3af2('0xd')]){if(_0x23ebd8[_0x3af2('0xd')][_0x3af2('0xe')]===0x1f4){logger[_0x3af2('0xd')]('UserFaxQueue,\x20%s,\x20%s',_0x1af3de,_0x23ebd8[_0x3af2('0xd')][_0x3af2('0xf')]);return _0x587abd(_0x23ebd8[_0x3af2('0xd')]['message']);}logger['error'](_0x3af2('0x8'),_0x1af3de,_0x23ebd8[_0x3af2('0xd')][_0x3af2('0xf')]);return _0x27b4b0(_0x23ebd8[_0x3af2('0xd')]['message']);}else{logger[_0x3af2('0x10')](_0x3af2('0x8'),_0x1af3de,_0x3af2('0x9'));_0x27b4b0(_0x23ebd8['result'][_0x3af2('0xf')]);}})[_0x3af2('0x11')](function(_0x21f087){logger[_0x3af2('0xd')]('UserFaxQueue,\x20%s,\x20%s',_0x1af3de,_0x21f087);_0x587abd(_0x21f087);});});} \ No newline at end of file +var _0xaaa6=['lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','UserFaxQueue,\x20%s,\x20%s','debug','UserFaxQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result'];(function(_0x2c0ded,_0x3de22c){var _0x4473e5=function(_0x3705bc){while(--_0x3705bc){_0x2c0ded['push'](_0x2c0ded['shift']());}};_0x4473e5(++_0x3de22c);}(_0xaaa6,0xfd));var _0x6aaa=function(_0x1b8f5a,_0x57c154){_0x1b8f5a=_0x1b8f5a-0x0;var _0x594189=_0xaaa6[_0x1b8f5a];return _0x594189;};'use strict';var _=require(_0x6aaa('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x6aaa('0x1'));var rs=require(_0x6aaa('0x2'));var fs=require('fs');var Redis=require(_0x6aaa('0x3'));var db=require(_0x6aaa('0x4'))['db'];var utils=require(_0x6aaa('0x5'));var logger=require(_0x6aaa('0x6'))(_0x6aaa('0x7'));var config=require(_0x6aaa('0x8'));var jayson=require(_0x6aaa('0x9'));var client=jayson[_0x6aaa('0xa')][_0x6aaa('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5ec110,_0x35046d,_0x159130){return new BPromise(function(_0xb0a7aa,_0x129a77){return client['request'](_0x5ec110,_0x159130)[_0x6aaa('0xc')](function(_0x5834ad){logger['info'](_0x6aaa('0xd'),_0x35046d,'request\x20sent');logger[_0x6aaa('0xe')](_0x6aaa('0xf'),_0x35046d,_0x6aaa('0x10'),JSON[_0x6aaa('0x11')](_0x5834ad));if(_0x5834ad['error']){if(_0x5834ad[_0x6aaa('0x12')][_0x6aaa('0x13')]===0x1f4){logger[_0x6aaa('0x12')](_0x6aaa('0xd'),_0x35046d,_0x5834ad['error']['message']);return _0x129a77(_0x5834ad['error'][_0x6aaa('0x14')]);}logger[_0x6aaa('0x12')]('UserFaxQueue,\x20%s,\x20%s',_0x35046d,_0x5834ad['error'][_0x6aaa('0x14')]);return _0xb0a7aa(_0x5834ad[_0x6aaa('0x12')][_0x6aaa('0x14')]);}else{logger[_0x6aaa('0x15')]('UserFaxQueue,\x20%s,\x20%s',_0x35046d,_0x6aaa('0x10'));_0xb0a7aa(_0x5834ad[_0x6aaa('0x16')][_0x6aaa('0x14')]);}})['catch'](function(_0x5e2419){logger['error']('UserFaxQueue,\x20%s,\x20%s',_0x35046d,_0x5e2419);_0x129a77(_0x5e2419);});});} \ No newline at end of file diff --git a/server/api/userMailQueue/index.js b/server/api/userMailQueue/index.js index e9ef5f1..03d5a66 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 _0xa87e=['multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x27856d,_0x13b764){var _0x3a80b8=function(_0xe84430){while(--_0xe84430){_0x27856d['push'](_0x27856d['shift']());}};_0x3a80b8(++_0x13b764);}(_0xa87e,0x17a));var _0xea87=function(_0x5c30f9,_0x22f20d){_0x5c30f9=_0x5c30f9-0x0;var _0xf95a16=_0xa87e[_0x5c30f9];return _0xf95a16;};'use strict';var multer=require(_0xea87('0x0'));var util=require(_0xea87('0x1'));var path=require('path');var timeout=require(_0xea87('0x2'));var express=require(_0xea87('0x3'));var router=express[_0xea87('0x4')]();var auth=require(_0xea87('0x5'));var interaction=require(_0xea87('0x6'));var config=require('../../config/environment');module['exports']=router; \ No newline at end of file +var _0xa398=['../../components/interaction/service','exports','connect-timeout','express','Router'];(function(_0x342782,_0x4236e0){var _0xadb50c=function(_0x33ff6f){while(--_0x33ff6f){_0x342782['push'](_0x342782['shift']());}};_0xadb50c(++_0x4236e0);}(_0xa398,0xbb));var _0x8a39=function(_0x206290,_0x35fbd7){_0x206290=_0x206290-0x0;var _0x40373c=_0xa398[_0x206290];return _0x40373c;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0x8a39('0x0'));var express=require(_0x8a39('0x1'));var router=express[_0x8a39('0x2')]();var auth=require('../../components/auth/service');var interaction=require(_0x8a39('0x3'));var config=require('../../config/environment');module[_0x8a39('0x4')]=router; \ No newline at end of file diff --git a/server/api/userMailQueue/userMailQueue.attributes.js b/server/api/userMailQueue/userMailQueue.attributes.js index e676e19..0a55b64 100644 --- a/server/api/userMailQueue/userMailQueue.attributes.js +++ b/server/api/userMailQueue/userMailQueue.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['sequelize','exports','INTEGER'];(function(_0x459b4a,_0x3f7961){var _0x5d49ae=function(_0x150ecb){while(--_0x150ecb){_0x459b4a['push'](_0x459b4a['shift']());}};_0x5d49ae(++_0x3f7961);}(_0xa9e0,0x123));var _0x0a9e=function(_0x12d033,_0x25fa2f){_0x12d033=_0x12d033-0x0;var _0x3b4e80=_0xa9e0[_0x12d033];return _0x3b4e80;};'use strict';var Sequelize=require(_0x0a9e('0x0'));module[_0x0a9e('0x1')]={'penalty':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0xd8b0=['exports','sequelize'];(function(_0x2967b4,_0x9b5a9b){var _0x483322=function(_0x4652d0){while(--_0x4652d0){_0x2967b4['push'](_0x2967b4['shift']());}};_0x483322(++_0x9b5a9b);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var Sequelize=require(_0x0d8b('0x0'));module[_0x0d8b('0x1')]={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userMailQueue/userMailQueue.model.js b/server/api/userMailQueue/userMailQueue.model.js index 73ba232..a09f577 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(_0x105963,_0x1257ba){var _0x59e969=function(_0x1455b5){while(--_0x1455b5){_0x105963['push'](_0x105963['shift']());}};_0x59e969(++_0x1257ba);}(_0xa9e0,0x123));var _0x0a9e=function(_0x56482c,_0x16118d){_0x56482c=_0x56482c-0x0;var _0x5aae7a=_0xa9e0[_0x56482c];return _0x5aae7a;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var logger=require(_0x0a9e('0x2'))('api');var moment=require('moment');var BPromise=require(_0x0a9e('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0a9e('0x4'));var rimraf=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var attributes=require(_0x0a9e('0x7'));module[_0x0a9e('0x8')]=function(_0x57b080,_0x219af0){return _0x57b080[_0x0a9e('0x9')](_0x0a9e('0xa'),attributes,{'tableName':'user_has_mail_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa9e0=['../../config/environment','./userMailQueue.attributes','exports','define','UserMailQueue','lodash','util','../../config/logger','bluebird','path','rimraf'];(function(_0x27ac26,_0x68ae52){var _0x395e51=function(_0x1a4584){while(--_0x1a4584){_0x27ac26['push'](_0x27ac26['shift']());}};_0x395e51(++_0x68ae52);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3a6efd,_0x2a5102){_0x3a6efd=_0x3a6efd-0x0;var _0x487b9a=_0xa9e0[_0x3a6efd];return _0x487b9a;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var 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 edb316b..9a14445 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 _0xe437=['jayson/promise','http','request','then','info','UserMailQueue,\x20%s,\x20%s','request\x20sent','UserMailQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x28cc8f,_0x3d7370){var _0x30e6d3=function(_0x1ab4ef){while(--_0x1ab4ef){_0x28cc8f['push'](_0x28cc8f['shift']());}};_0x30e6d3(++_0x3d7370);}(_0xe437,0x69));var _0x7e43=function(_0x369df8,_0x1e0a6c){_0x369df8=_0x369df8-0x0;var _0x4b5ef3=_0xe437[_0x369df8];return _0x4b5ef3;};'use strict';var _=require(_0x7e43('0x0'));var util=require(_0x7e43('0x1'));var moment=require(_0x7e43('0x2'));var BPromise=require('bluebird');var rs=require(_0x7e43('0x3'));var fs=require('fs');var Redis=require(_0x7e43('0x4'));var db=require(_0x7e43('0x5'))['db'];var utils=require(_0x7e43('0x6'));var logger=require(_0x7e43('0x7'))(_0x7e43('0x8'));var config=require(_0x7e43('0x9'));var jayson=require(_0x7e43('0xa'));var client=jayson['client'][_0x7e43('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3bd40f,_0xed5596,_0x8488f6){return new BPromise(function(_0x4fac58,_0x94fd3b){return client[_0x7e43('0xc')](_0x3bd40f,_0x8488f6)[_0x7e43('0xd')](function(_0x43d20b){logger[_0x7e43('0xe')](_0x7e43('0xf'),_0xed5596,_0x7e43('0x10'));logger['debug'](_0x7e43('0x11'),_0xed5596,_0x7e43('0x10'),JSON[_0x7e43('0x12')](_0x43d20b));if(_0x43d20b[_0x7e43('0x13')]){if(_0x43d20b[_0x7e43('0x13')][_0x7e43('0x14')]===0x1f4){logger[_0x7e43('0x13')](_0x7e43('0xf'),_0xed5596,_0x43d20b['error'][_0x7e43('0x15')]);return _0x94fd3b(_0x43d20b['error']['message']);}logger['error']('UserMailQueue,\x20%s,\x20%s',_0xed5596,_0x43d20b[_0x7e43('0x13')]['message']);return _0x4fac58(_0x43d20b['error'][_0x7e43('0x15')]);}else{logger[_0x7e43('0xe')](_0x7e43('0xf'),_0xed5596,_0x7e43('0x10'));_0x4fac58(_0x43d20b['result'][_0x7e43('0x15')]);}})[_0x7e43('0x16')](function(_0x2a66ee){logger[_0x7e43('0x13')](_0x7e43('0xf'),_0xed5596,_0x2a66ee);_0x94fd3b(_0x2a66ee);});});} \ No newline at end of file +var _0xdca7=['UserMailQueue,\x20%s,\x20%s','request\x20sent','debug','UserMailQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/environment','request','then','info'];(function(_0x55dd5c,_0x2e550f){var _0x281104=function(_0x46c769){while(--_0x46c769){_0x55dd5c['push'](_0x55dd5c['shift']());}};_0x281104(++_0x2e550f);}(_0xdca7,0xe6));var _0x7dca=function(_0x3ec52a,_0x1da33e){_0x3ec52a=_0x3ec52a-0x0;var _0x1945f7=_0xdca7[_0x3ec52a];return _0x1945f7;};'use strict';var _=require(_0x7dca('0x0'));var util=require('util');var moment=require(_0x7dca('0x1'));var BPromise=require(_0x7dca('0x2'));var rs=require(_0x7dca('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x7dca('0x4'))['db'];var utils=require(_0x7dca('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0x7dca('0x6'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0xbc4387,_0x4cab84,_0x5a27cc){return new BPromise(function(_0x38cb81,_0x189afd){return client[_0x7dca('0x7')](_0xbc4387,_0x5a27cc)[_0x7dca('0x8')](function(_0x323d54){logger[_0x7dca('0x9')](_0x7dca('0xa'),_0x4cab84,_0x7dca('0xb'));logger[_0x7dca('0xc')](_0x7dca('0xd'),_0x4cab84,_0x7dca('0xb'),JSON[_0x7dca('0xe')](_0x323d54));if(_0x323d54['error']){if(_0x323d54[_0x7dca('0xf')][_0x7dca('0x10')]===0x1f4){logger['error'](_0x7dca('0xa'),_0x4cab84,_0x323d54[_0x7dca('0xf')][_0x7dca('0x11')]);return _0x189afd(_0x323d54['error']['message']);}logger[_0x7dca('0xf')](_0x7dca('0xa'),_0x4cab84,_0x323d54[_0x7dca('0xf')][_0x7dca('0x11')]);return _0x38cb81(_0x323d54[_0x7dca('0xf')][_0x7dca('0x11')]);}else{logger[_0x7dca('0x9')](_0x7dca('0xa'),_0x4cab84,_0x7dca('0xb'));_0x38cb81(_0x323d54[_0x7dca('0x12')][_0x7dca('0x11')]);}})[_0x7dca('0x13')](function(_0x835781){logger[_0x7dca('0xf')](_0x7dca('0xa'),_0x4cab84,_0x835781);_0x189afd(_0x835781);});});} \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/index.js b/server/api/userOpenchannelQueue/index.js index c515c44..58500db 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 _0xcbe6=['../../config/environment','exports','multer','path','express','../../components/auth/service','../../components/interaction/service'];(function(_0x453a8d,_0x2131da){var _0x13eaa1=function(_0x480404){while(--_0x480404){_0x453a8d['push'](_0x453a8d['shift']());}};_0x13eaa1(++_0x2131da);}(_0xcbe6,0x152));var _0x6cbe=function(_0x52385d,_0x378627){_0x52385d=_0x52385d-0x0;var _0xe9f769=_0xcbe6[_0x52385d];return _0xe9f769;};'use strict';var multer=require(_0x6cbe('0x0'));var util=require('util');var path=require(_0x6cbe('0x1'));var timeout=require('connect-timeout');var express=require(_0x6cbe('0x2'));var router=express['Router']();var auth=require(_0x6cbe('0x3'));var interaction=require(_0x6cbe('0x4'));var config=require(_0x6cbe('0x5'));module[_0x6cbe('0x6')]=router; \ No newline at end of file +var _0xa210=['path','../../components/auth/service','../../config/environment','exports','util'];(function(_0x32a767,_0x4e3e76){var _0x2b4e6d=function(_0x5e0702){while(--_0x5e0702){_0x32a767['push'](_0x32a767['shift']());}};_0x2b4e6d(++_0x4e3e76);}(_0xa210,0xe5));var _0x0a21=function(_0x37215a,_0x5f0f9d){_0x37215a=_0x37215a-0x0;var _0x2e46f8=_0xa210[_0x37215a];return _0x2e46f8;};'use strict';var multer=require('multer');var util=require(_0x0a21('0x0'));var path=require(_0x0a21('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var auth=require(_0x0a21('0x2'));var interaction=require('../../components/interaction/service');var config=require(_0x0a21('0x3'));module[_0x0a21('0x4')]=router; \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/userOpenchannelQueue.attributes.js b/server/api/userOpenchannelQueue/userOpenchannelQueue.attributes.js index 37135a6..61d51c9 100644 --- a/server/api/userOpenchannelQueue/userOpenchannelQueue.attributes.js +++ b/server/api/userOpenchannelQueue/userOpenchannelQueue.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd8b0=['exports','sequelize'];(function(_0x3e4d9a,_0x449a9f){var _0x4124d3=function(_0x3dd192){while(--_0x3dd192){_0x3e4d9a['push'](_0x3e4d9a['shift']());}};_0x4124d3(++_0x449a9f);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var Sequelize=require(_0x0d8b('0x0'));module[_0x0d8b('0x1')]={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0xbaf0=['exports','INTEGER'];(function(_0x101094,_0x5d3900){var _0x3d6d75=function(_0x10aa02){while(--_0x10aa02){_0x101094['push'](_0x101094['shift']());}};_0x3d6d75(++_0x5d3900);}(_0xbaf0,0x12a));var _0x0baf=function(_0x465028,_0x4570ac){_0x465028=_0x465028-0x0;var _0xb783d4=_0xbaf0[_0x465028];return _0xb783d4;};'use strict';var Sequelize=require('sequelize');module[_0x0baf('0x0')]={'penalty':{'type':Sequelize[_0x0baf('0x1')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/userOpenchannelQueue.model.js b/server/api/userOpenchannelQueue/userOpenchannelQueue.model.js index 59885b6..9686035 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 _0x9ac8=['api','path','rimraf','./userOpenchannelQueue.attributes','exports','define','user_has_openchannel_queues','lodash','../../config/logger'];(function(_0x3bc222,_0x481df5){var _0x574be4=function(_0x1f5a5a){while(--_0x1f5a5a){_0x3bc222['push'](_0x3bc222['shift']());}};_0x574be4(++_0x481df5);}(_0x9ac8,0x18a));var _0x89ac=function(_0xb2b83d,_0x427417){_0xb2b83d=_0xb2b83d-0x0;var _0x25560f=_0x9ac8[_0xb2b83d];return _0x25560f;};'use strict';var _=require(_0x89ac('0x0'));var util=require('util');var logger=require(_0x89ac('0x1'))(_0x89ac('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x89ac('0x3'));var rimraf=require(_0x89ac('0x4'));var config=require('../../config/environment');var attributes=require(_0x89ac('0x5'));module[_0x89ac('0x6')]=function(_0x5a7177,_0x2f41f0){return _0x5a7177[_0x89ac('0x7')]('UserOpenchannelQueue',attributes,{'tableName':_0x89ac('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x67e4=['api','moment','bluebird','request-promise','../../config/environment','./userOpenchannelQueue.attributes','exports','user_has_openchannel_queues','lodash','util','../../config/logger'];(function(_0x1a68dd,_0x168fdd){var _0x564bc7=function(_0x36b497){while(--_0x36b497){_0x1a68dd['push'](_0x1a68dd['shift']());}};_0x564bc7(++_0x168fdd);}(_0x67e4,0x126));var _0x467e=function(_0x548627,_0x4ec392){_0x548627=_0x548627-0x0;var _0x844a84=_0x67e4[_0x548627];return _0x844a84;};'use strict';var _=require(_0x467e('0x0'));var util=require(_0x467e('0x1'));var logger=require(_0x467e('0x2'))(_0x467e('0x3'));var moment=require(_0x467e('0x4'));var BPromise=require(_0x467e('0x5'));var rp=require(_0x467e('0x6'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x467e('0x7'));var attributes=require(_0x467e('0x8'));module[_0x467e('0x9')]=function(_0x14c6c6,_0x4d2344){return _0x14c6c6['define']('UserOpenchannelQueue',attributes,{'tableName':_0x467e('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/userOpenchannelQueue.rpc.js b/server/api/userOpenchannelQueue/userOpenchannelQueue.rpc.js index c038a8c..8723867 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 _0x5920=['UserOpenchannelQueue,\x20%s,\x20%s','message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','request\x20sent','UserOpenchannelQueue,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x5920,0x153));var _0x0592=function(_0x5929b4,_0x342f8f){_0x5929b4=_0x5929b4-0x0;var _0x3723fa=_0x5920[_0x5929b4];return _0x3723fa;};'use strict';var _=require(_0x0592('0x0'));var util=require(_0x0592('0x1'));var moment=require(_0x0592('0x2'));var BPromise=require(_0x0592('0x3'));var rs=require(_0x0592('0x4'));var fs=require('fs');var Redis=require(_0x0592('0x5'));var db=require(_0x0592('0x6'))['db'];var utils=require(_0x0592('0x7'));var logger=require(_0x0592('0x8'))(_0x0592('0x9'));var config=require(_0x0592('0xa'));var jayson=require(_0x0592('0xb'));var client=jayson[_0x0592('0xc')][_0x0592('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x481c10,_0x2897be,_0x27f59a){return new BPromise(function(_0x4766ef,_0x59a32d){return client[_0x0592('0xe')](_0x481c10,_0x27f59a)['then'](function(_0x5bcb02){logger[_0x0592('0xf')]('UserOpenchannelQueue,\x20%s,\x20%s',_0x2897be,_0x0592('0x10'));logger['debug'](_0x0592('0x11'),_0x2897be,_0x0592('0x10'),JSON[_0x0592('0x12')](_0x5bcb02));if(_0x5bcb02[_0x0592('0x13')]){if(_0x5bcb02['error'][_0x0592('0x14')]===0x1f4){logger['error'](_0x0592('0x15'),_0x2897be,_0x5bcb02['error']['message']);return _0x59a32d(_0x5bcb02[_0x0592('0x13')][_0x0592('0x16')]);}logger['error'](_0x0592('0x15'),_0x2897be,_0x5bcb02[_0x0592('0x13')][_0x0592('0x16')]);return _0x4766ef(_0x5bcb02['error'][_0x0592('0x16')]);}else{logger['info'](_0x0592('0x15'),_0x2897be,_0x0592('0x10'));_0x4766ef(_0x5bcb02['result']['message']);}})[_0x0592('0x17')](function(_0x33586c){logger[_0x0592('0x13')](_0x0592('0x15'),_0x2897be,_0x33586c);_0x59a32d(_0x33586c);});});} \ No newline at end of file +var _0x3254=['../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','UserOpenchannelQueue,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','ioredis','../../config/utils'];(function(_0x27af45,_0x1b57aa){var _0x18df21=function(_0x4b7679){while(--_0x4b7679){_0x27af45['push'](_0x27af45['shift']());}};_0x18df21(++_0x1b57aa);}(_0x3254,0x1c8));var _0x4325=function(_0x129e1c,_0x3bab40){_0x129e1c=_0x129e1c-0x0;var _0x56b43a=_0x3254[_0x129e1c];return _0x56b43a;};'use strict';var _=require(_0x4325('0x0'));var util=require(_0x4325('0x1'));var moment=require(_0x4325('0x2'));var BPromise=require(_0x4325('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x4325('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x4325('0x5'));var logger=require(_0x4325('0x6'))(_0x4325('0x7'));var config=require(_0x4325('0x8'));var jayson=require(_0x4325('0x9'));var client=jayson[_0x4325('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x293f42,_0x34327b,_0x316da7){return new BPromise(function(_0x3bd4eb,_0x2bb065){return client[_0x4325('0xb')](_0x293f42,_0x316da7)[_0x4325('0xc')](function(_0x5310af){logger[_0x4325('0xd')](_0x4325('0xe'),_0x34327b,_0x4325('0xf'));logger['debug']('UserOpenchannelQueue,\x20%s,\x20%s,\x20%s',_0x34327b,'request\x20sent',JSON[_0x4325('0x10')](_0x5310af));if(_0x5310af[_0x4325('0x11')]){if(_0x5310af['error'][_0x4325('0x12')]===0x1f4){logger[_0x4325('0x11')](_0x4325('0xe'),_0x34327b,_0x5310af['error'][_0x4325('0x13')]);return _0x2bb065(_0x5310af[_0x4325('0x11')][_0x4325('0x13')]);}logger[_0x4325('0x11')]('UserOpenchannelQueue,\x20%s,\x20%s',_0x34327b,_0x5310af[_0x4325('0x11')]['message']);return _0x3bd4eb(_0x5310af[_0x4325('0x11')][_0x4325('0x13')]);}else{logger['info'](_0x4325('0xe'),_0x34327b,_0x4325('0xf'));_0x3bd4eb(_0x5310af[_0x4325('0x14')]['message']);}})[_0x4325('0x15')](function(_0x272522){logger[_0x4325('0x11')](_0x4325('0xe'),_0x34327b,_0x272522);_0x2bb065(_0x272522);});});} \ No newline at end of file diff --git a/server/api/userProfile/index.js b/server/api/userProfile/index.js index 356cf93..ed166e6 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 _0x7895=['/:id/sections','getSections','/:id/resources','getResources','post','/:id/clone','clone','addResources','update','removeSections','delete','removeResources','exports','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','show'];(function(_0x4921fd,_0x45b894){var _0x5812e5=function(_0x360c7d){while(--_0x360c7d){_0x4921fd['push'](_0x4921fd['shift']());}};_0x5812e5(++_0x45b894);}(_0x7895,0x1e1));var _0x5789=function(_0x154ee9,_0x27ce59){_0x154ee9=_0x154ee9-0x0;var _0x3d9be4=_0x7895[_0x154ee9];return _0x3d9be4;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x5789('0x0'));var timeout=require(_0x5789('0x1'));var express=require(_0x5789('0x2'));var router=express[_0x5789('0x3')]();var auth=require(_0x5789('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x5789('0x5'));var controller=require('./userProfile.controller');router[_0x5789('0x6')]('/',auth[_0x5789('0x7')](),controller[_0x5789('0x8')]);router[_0x5789('0x6')](_0x5789('0x9'),auth['isAuthenticated'](),controller[_0x5789('0xa')]);router[_0x5789('0x6')](_0x5789('0xb'),auth[_0x5789('0x7')](),controller[_0x5789('0xc')]);router[_0x5789('0x6')](_0x5789('0xd'),auth[_0x5789('0x7')](),controller[_0x5789('0xe')]);router[_0x5789('0x6')](_0x5789('0xf'),auth[_0x5789('0x7')](),controller[_0x5789('0x10')]);router['post']('/',auth[_0x5789('0x7')](),controller['create']);router[_0x5789('0x11')](_0x5789('0x12'),auth[_0x5789('0x7')](),controller[_0x5789('0x13')]);router[_0x5789('0x11')](_0x5789('0xd'),auth[_0x5789('0x7')](),controller['addSections']);router['post'](_0x5789('0xf'),auth[_0x5789('0x7')](),controller[_0x5789('0x14')]);router['put'](_0x5789('0xb'),auth[_0x5789('0x7')](),controller[_0x5789('0x15')]);router['delete'](_0x5789('0xb'),auth[_0x5789('0x7')](),controller['destroy']);router['delete'](_0x5789('0xd'),auth['isAuthenticated'](),controller[_0x5789('0x16')]);router[_0x5789('0x17')]('/:id/resources',auth[_0x5789('0x7')](),controller[_0x5789('0x18')]);module[_0x5789('0x19')]=router; \ No newline at end of file +var _0x16fd=['show','/:id/sections','getSections','/:id/resources','getResources','post','/:id/clone','clone','addSections','put','update','delete','removeSections','removeResources','multer','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./userProfile.controller','get','isAuthenticated','index','/:id'];(function(_0x2cb7eb,_0x34817d){var _0x38a294=function(_0x384a02){while(--_0x384a02){_0x2cb7eb['push'](_0x2cb7eb['shift']());}};_0x38a294(++_0x34817d);}(_0x16fd,0x194));var _0xd16f=function(_0x4320ce,_0x49f5f5){_0x4320ce=_0x4320ce-0x0;var _0x537dae=_0x16fd[_0x4320ce];return _0x537dae;};'use strict';var multer=require(_0xd16f('0x0'));var util=require('util');var path=require(_0xd16f('0x1'));var timeout=require('connect-timeout');var express=require(_0xd16f('0x2'));var router=express[_0xd16f('0x3')]();var auth=require(_0xd16f('0x4'));var interaction=require(_0xd16f('0x5'));var config=require(_0xd16f('0x6'));var controller=require(_0xd16f('0x7'));router[_0xd16f('0x8')]('/',auth[_0xd16f('0x9')](),controller[_0xd16f('0xa')]);router[_0xd16f('0x8')]('/describe',auth['isAuthenticated'](),controller['describe']);router[_0xd16f('0x8')](_0xd16f('0xb'),auth[_0xd16f('0x9')](),controller[_0xd16f('0xc')]);router[_0xd16f('0x8')](_0xd16f('0xd'),auth[_0xd16f('0x9')](),controller[_0xd16f('0xe')]);router[_0xd16f('0x8')](_0xd16f('0xf'),auth['isAuthenticated'](),controller[_0xd16f('0x10')]);router[_0xd16f('0x11')]('/',auth[_0xd16f('0x9')](),controller['create']);router[_0xd16f('0x11')](_0xd16f('0x12'),auth[_0xd16f('0x9')](),controller[_0xd16f('0x13')]);router[_0xd16f('0x11')]('/:id/sections',auth[_0xd16f('0x9')](),controller[_0xd16f('0x14')]);router[_0xd16f('0x11')](_0xd16f('0xf'),auth['isAuthenticated'](),controller['addResources']);router[_0xd16f('0x15')](_0xd16f('0xb'),auth['isAuthenticated'](),controller[_0xd16f('0x16')]);router[_0xd16f('0x17')](_0xd16f('0xb'),auth[_0xd16f('0x9')](),controller['destroy']);router['delete'](_0xd16f('0xd'),auth['isAuthenticated'](),controller[_0xd16f('0x18')]);router['delete'](_0xd16f('0xf'),auth[_0xd16f('0x9')](),controller[_0xd16f('0x19')]);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 5d18fc0..5dcf894 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 _0xb8ba=['STRING','setDataValue','join','getDataValue','crudPermissions','sequelize'];(function(_0x4b73a2,_0x40b5fe){var _0x383c66=function(_0x3917ae){while(--_0x3917ae){_0x4b73a2['push'](_0x4b73a2['shift']());}};_0x383c66(++_0x40b5fe);}(_0xb8ba,0x1a9));var _0xab8b=function(_0x1c31a5,_0x54413b){_0x1c31a5=_0x1c31a5-0x0;var _0x5c8ee9=_0xb8ba[_0x1c31a5];return _0x5c8ee9;};'use strict';var Sequelize=require(_0xab8b('0x0'));module['exports']={'name':{'type':Sequelize[_0xab8b('0x1')],'allowNull':![],'unique':'name'},'crudPermissions':{'type':Sequelize[_0xab8b('0x1')],'set':function(_0x370d48){this[_0xab8b('0x2')]('crudPermissions',_0x370d48?_0x370d48[_0xab8b('0x3')](''):[]);},'get':function(){return this[_0xab8b('0x4')]('crudPermissions')?this['getDataValue'](_0xab8b('0x5'))['split'](''):[];},'allowNull':![],'defaultValue':'r'},'description':{'type':Sequelize[_0xab8b('0x1')],'allowNull':!![]}}; \ No newline at end of file +var _0xd523=['setDataValue','crudPermissions','getDataValue','sequelize','exports','STRING','name'];(function(_0x482ac6,_0x182c1d){var _0x15b85f=function(_0xce6d67){while(--_0xce6d67){_0x482ac6['push'](_0x482ac6['shift']());}};_0x15b85f(++_0x182c1d);}(_0xd523,0x153));var _0x3d52=function(_0x3c1da7,_0x1a53c9){_0x3c1da7=_0x3c1da7-0x0;var _0x3e621d=_0xd523[_0x3c1da7];return _0x3e621d;};'use strict';var Sequelize=require(_0x3d52('0x0'));module[_0x3d52('0x1')]={'name':{'type':Sequelize[_0x3d52('0x2')],'allowNull':![],'unique':_0x3d52('0x3')},'crudPermissions':{'type':Sequelize['STRING'],'set':function(_0x20ccf9){this[_0x3d52('0x4')](_0x3d52('0x5'),_0x20ccf9?_0x20ccf9['join'](''):[]);},'get':function(){return this[_0x3d52('0x6')](_0x3d52('0x5'))?this[_0x3d52('0x6')](_0x3d52('0x5'))['split'](''):[];},'allowNull':![],'defaultValue':'r'},'description':{'type':Sequelize['STRING'],'allowNull':!![]}}; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.controller.js b/server/api/userProfile/userProfile.controller.js index dd71e4f..6caf659 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 _0x03b5=['includeAll','findAll','rows','catch','show','rawAttributes','include','find','create','params','createdAt','updatedAt','crudPermissions','body','omit','sequelize','transaction','UserProfileSection','each','autoAssociation','UserProfileResource','sectionId','userProfileId','Resources','describe','addSections','push','get','removeSections','ids','getSections','isEmpty','subsections','includes','enabled','forEach','resourceId','Plugin','addResources','bulkCreate','removeResources','getResources','section','undefined','mergeResources','childModel','ValidationError','Invalid\x20section\x20\x27','parentSections','findOne','union','field','foreignKey','associatedResources','reportType','reportId','DefaultReports','custom','CustomReports','CmContact','Tag','Tags','color','tag','ThroughTags','value','squareprojects','SquareProject','odbc','SquareOdbc','squarerecordings','SquareRecording','SquareProjects','projectName','JscriptyProject','contacts','Lists','lists','CmList','companies','CmCompany','CmCustomField','chatqueues','ChatQueue','ChatWebsite','faxqueues','FaxQueue','FaxAccount','internalroutes','outboundroutes','VoiceExtension','contexts','VoiceContext','voicemails','VoiceMail','voicerecordings','VoiceRecording','Agents','User','agent','Telephones','membername','telephone','VoiceQueues','inbound','queue','VoiceQueue','outbound','VoiceMusicOnHold','chanspies','VoiceChanSpy','voiceprefixes','VoicePrefix','Campaign','MailAccount','mailsubstatuses','openchannelqueues','OpenchannelQueue','openchannelaccounts','OpenchannelAccount','smsqueues','SmsQueue','smsaccounts','SmsAccount','whatsappqueues','WhatsappQueue','whatsappaccounts','WhatsappAccount','teams','voicequeues','queuecampaigns','users','agents','telephones','role','admin','zendeskaccounts','ZendeskAccount','SalesforceAccount','FreshdeskAccount','sugarcrmaccounts','SugarcrmAccount','deskaccounts','DeskAccount','zohoaccounts','ZohoAccount','vtigeraccounts','cannedanswers','CannedAnswer','dispositions','Disposition','customdashboards','intervals','pauses','scheduler','Schedule','Sound','tags','triggers','Trigger','trunks','Trunk','variables','Variable','extractedreports','AnalyticExtractedReport','Reports','metrics','AnalyticMetric','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','to-csv','ejs','squel','crypto','querystring','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','redis','localhost','socket.io-emitter','./userProfile.socket','sendStatus','status','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','end','stack','name','index','map','UserProfile','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options'];(function(_0x44dbf9,_0x149390){var _0x29be86=function(_0x8be0d8){while(--_0x8be0d8){_0x44dbf9['push'](_0x44dbf9['shift']());}};_0x29be86(++_0x149390);}(_0x03b5,0xa9));var _0x503b=function(_0x521881,_0x124873){_0x521881=_0x521881-0x0;var _0x1a372f=_0x03b5[_0x521881];return _0x1a372f;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x503b('0x0'));var rimraf=require(_0x503b('0x1'));var zipdir=require(_0x503b('0x2'));var jsonpatch=require(_0x503b('0x3'));var rp=require(_0x503b('0x4'));var moment=require(_0x503b('0x5'));var BPromise=require(_0x503b('0x6'));var Mustache=require(_0x503b('0x7'));var util=require('util');var path=require(_0x503b('0x8'));var sox=require('sox');var csv=require(_0x503b('0x9'));var ejs=require(_0x503b('0xa'));var fs=require('fs');var _=require('lodash');var squel=require(_0x503b('0xb'));var crypto=require(_0x503b('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x503b('0x9'));var querystring=require(_0x503b('0xd'));var Papa=require('papaparse');var Redis=require(_0x503b('0xe'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x503b('0xf'));var hardwareService=require(_0x503b('0x10'));var logger=require('../../config/logger')(_0x503b('0x11'));var utils=require(_0x503b('0x12'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];config[_0x503b('0x13')]=_['defaults'](config[_0x503b('0x13')],{'host':_0x503b('0x14'),'port':0x18eb});var socket=require(_0x503b('0x15'))(new Redis(config['redis']));require(_0x503b('0x16'))['register'](socket);function respondWithStatusCode(_0x5b2080,_0x4f2354){_0x4f2354=_0x4f2354||0xcc;return function(_0x313d1f){if(_0x313d1f){return _0x5b2080[_0x503b('0x17')](_0x4f2354);}return _0x5b2080[_0x503b('0x18')](_0x4f2354)['end']();};}function respondWithResult(_0x36e046,_0x2c212f){_0x2c212f=_0x2c212f||0xc8;return function(_0x526dd5){if(_0x526dd5){return _0x36e046['status'](_0x2c212f)[_0x503b('0x19')](_0x526dd5);}};}function respondWithFilteredResult(_0xd87d2e,_0x4f1224){return function(_0x3f54f7){if(_0x3f54f7){var _0xcabd31=_0x3f54f7[_0x503b('0x1a')],_0x221f44=_0x4f1224[_0x503b('0x1b')],_0x5e02e8=_0x4f1224[_0x503b('0x1b')]+_0x4f1224[_0x503b('0x1c')],_0x73981b;if(_0x5e02e8>=_0xcabd31){_0x5e02e8=_0xcabd31;_0x73981b=0xc8;}else{_0x73981b=0xce;}_0xd87d2e[_0x503b('0x18')](_0x73981b);return _0xd87d2e[_0x503b('0x1d')](_0x503b('0x1e'),_0x221f44+'-'+_0x5e02e8+'/'+_0xcabd31)[_0x503b('0x19')](_0x3f54f7);}return null;};}function patchUpdates(_0x139ca2){return function(_0x5a77f6){try{jsonpatch[_0x503b('0x1f')](_0x5a77f6,_0x139ca2,!![]);}catch(_0x5f33c8){return BPromise[_0x503b('0x20')](_0x5f33c8);}return _0x5a77f6[_0x503b('0x21')]();};}function saveUpdates(_0x337a00,_0x354371){return function(_0x34b538){if(_0x34b538){return _0x34b538[_0x503b('0x22')](_0x337a00)[_0x503b('0x23')](function(_0x58b641){return _0x58b641;});}return null;};}function removeEntity(_0x3bbc73,_0x49cfda){return function(_0x64969d){if(_0x64969d){return _0x64969d[_0x503b('0x24')]()['then'](function(){_0x3bbc73['status'](0xcc)[_0x503b('0x25')]();});}};}function handleEntityNotFound(_0x20699f,_0xa7a6c2){return function(_0x1dc880){if(!_0x1dc880){_0x20699f[_0x503b('0x17')](0x194);}return _0x1dc880;};}function handleError(_0x266e60,_0x5c7aa4){_0x5c7aa4=_0x5c7aa4||0x1f4;return function(_0x3ed291){logger['error'](_0x3ed291[_0x503b('0x26')]);if(_0x3ed291[_0x503b('0x27')]){delete _0x3ed291[_0x503b('0x27')];}_0x266e60[_0x503b('0x18')](_0x5c7aa4)['send'](_0x3ed291);};}exports[_0x503b('0x28')]=function(_0x508d5f,_0x21de37){var _0x320325={},_0x43775d={},_0x5e5878={'count':0x0,'rows':[]};var _0x32b2ba=_[_0x503b('0x29')](db[_0x503b('0x2a')]['rawAttributes'],function(_0x7ef4ce){return{'name':_0x7ef4ce[_0x503b('0x2b')],'type':_0x7ef4ce[_0x503b('0x2c')][_0x503b('0x2d')]};});_0x43775d[_0x503b('0x2e')]=_['map'](_0x32b2ba,_0x503b('0x27'));_0x43775d[_0x503b('0x2f')]=_[_0x503b('0x30')](_0x508d5f[_0x503b('0x2f')]);_0x43775d[_0x503b('0x31')]=_[_0x503b('0x32')](_0x43775d[_0x503b('0x2e')],_0x43775d[_0x503b('0x2f')]);_0x320325[_0x503b('0x33')]=_[_0x503b('0x32')](_0x43775d[_0x503b('0x2e')],qs['fields'](_0x508d5f[_0x503b('0x2f')][_0x503b('0x34')]));_0x320325[_0x503b('0x33')]=_0x320325[_0x503b('0x33')][_0x503b('0x35')]?_0x320325[_0x503b('0x33')]:_0x43775d['model'];if(!_0x508d5f['query'][_0x503b('0x36')](_0x503b('0x37'))){_0x320325['limit']=qs[_0x503b('0x1c')](_0x508d5f[_0x503b('0x2f')][_0x503b('0x1c')]);_0x320325[_0x503b('0x1b')]=qs['offset'](_0x508d5f[_0x503b('0x2f')][_0x503b('0x1b')]);}_0x320325[_0x503b('0x38')]=qs['sort'](_0x508d5f[_0x503b('0x2f')][_0x503b('0x39')]);_0x320325[_0x503b('0x3a')]=qs['filters'](_[_0x503b('0x3b')](_0x508d5f[_0x503b('0x2f')],_0x43775d[_0x503b('0x31')]),_0x32b2ba);if(_0x508d5f['query'][_0x503b('0x3c')]){_0x320325[_0x503b('0x3a')]=_['merge'](_0x320325[_0x503b('0x3a')],{'$or':_[_0x503b('0x29')](_0x32b2ba,function(_0x182c8f){if(_0x182c8f[_0x503b('0x2c')]!==_0x503b('0x3d')){var _0x1bf28e={};_0x1bf28e[_0x182c8f[_0x503b('0x27')]]={'$like':'%'+_0x508d5f['query']['filter']+'%'};return _0x1bf28e;}})});}_0x320325=_[_0x503b('0x3e')]({},_0x320325,_0x508d5f[_0x503b('0x3f')]);var _0x20afa2={'where':_0x320325[_0x503b('0x3a')]};return db[_0x503b('0x2a')][_0x503b('0x1a')](_0x20afa2)[_0x503b('0x23')](function(_0x4f145a){_0x5e5878[_0x503b('0x1a')]=_0x4f145a;if(_0x508d5f[_0x503b('0x2f')][_0x503b('0x40')]){_0x320325['include']=[{'all':!![]}];}return db[_0x503b('0x2a')][_0x503b('0x41')](_0x320325);})['then'](function(_0x5934da){_0x5e5878[_0x503b('0x42')]=_0x5934da;return _0x5e5878;})['then'](respondWithFilteredResult(_0x21de37,_0x320325))[_0x503b('0x43')](handleError(_0x21de37,null));};exports[_0x503b('0x44')]=function(_0x43159c,_0x5a65e4){var _0xfee325={'raw':![],'where':{'id':_0x43159c['params']['id']}},_0x3d1fd1={};_0x3d1fd1[_0x503b('0x2e')]=_[_0x503b('0x30')](db[_0x503b('0x2a')][_0x503b('0x45')]);_0x3d1fd1[_0x503b('0x2f')]=_[_0x503b('0x30')](_0x43159c[_0x503b('0x2f')]);_0x3d1fd1[_0x503b('0x31')]=_[_0x503b('0x32')](_0x3d1fd1[_0x503b('0x2e')],_0x3d1fd1[_0x503b('0x2f')]);_0xfee325[_0x503b('0x33')]=_['intersection'](_0x3d1fd1['model'],qs['fields'](_0x43159c['query'][_0x503b('0x34')]));_0xfee325['attributes']=_0xfee325[_0x503b('0x33')][_0x503b('0x35')]?_0xfee325['attributes']:_0x3d1fd1[_0x503b('0x2e')];if(_0x43159c[_0x503b('0x2f')][_0x503b('0x40')]){_0xfee325[_0x503b('0x46')]=[{'all':!![]}];}_0xfee325=_[_0x503b('0x3e')]({},_0xfee325,_0x43159c['options']);return db['UserProfile'][_0x503b('0x47')](_0xfee325)[_0x503b('0x23')](handleEntityNotFound(_0x5a65e4,null))[_0x503b('0x23')](respondWithResult(_0x5a65e4,null))[_0x503b('0x43')](handleError(_0x5a65e4,null));};exports[_0x503b('0x48')]=function(_0x7c30b,_0x48a612){return db[_0x503b('0x2a')][_0x503b('0x48')](_0x7c30b['body'],{})['then'](respondWithResult(_0x48a612,0xc9))['catch'](handleError(_0x48a612,null));};exports['clone']=function(_0x4fba7d,_0x38efd8){var _0x215b95={'where':{'id':_0x4fba7d[_0x503b('0x49')]['id']}},_0x466eac={};_0x466eac['model']=_[_0x503b('0x30')](db[_0x503b('0x2a')][_0x503b('0x45')]);_0x215b95[_0x503b('0x33')]=_[_0x503b('0x32')](_0x466eac['model'],qs[_0x503b('0x34')](_0x4fba7d[_0x503b('0x2f')][_0x503b('0x34')]));_0x215b95[_0x503b('0x33')]=_0x215b95['attributes']['length']?_0x215b95[_0x503b('0x33')]:_0x466eac[_0x503b('0x2e')];if(_0x4fba7d['query']['includeAll']){_0x215b95[_0x503b('0x46')]=[{'all':!![]}];}_0x215b95=_[_0x503b('0x3e')]({},_0x215b95,_0x4fba7d[_0x503b('0x3f')]);return db[_0x503b('0x2a')][_0x503b('0x47')](_0x215b95)[_0x503b('0x23')](handleEntityNotFound(_0x38efd8,null))[_0x503b('0x23')](function(_0x40dde2){if(_0x40dde2){var _0x455270=_0x40dde2['get']({'plain':!![]});_0x455270=qs['omit'](_0x455270,['id',_0x503b('0x4a'),_0x503b('0x4b'),_0x503b('0x4c')]);_0x4fba7d[_0x503b('0x4d')]=_[_0x503b('0x4e')](_0x4fba7d[_0x503b('0x4d')],['id',_0x503b('0x4a'),_0x503b('0x4b')]);return db[_0x503b('0x4f')][_0x503b('0x50')](function(_0x278fa8){return db['UserProfile'][_0x503b('0x48')](_[_0x503b('0x3e')](_0x455270,_0x4fba7d[_0x503b('0x4d')]),{'include':_0x4fba7d[_0x503b('0x2f')][_0x503b('0x40')]?[{'all':!![]}]:undefined,'transaction':_0x278fa8})['then'](function(_0x54d1ea){var _0x2c4986=_0x54d1ea['get']({'plain':!![]});return db[_0x503b('0x51')][_0x503b('0x41')]({'where':{'userProfileId':_0x4fba7d[_0x503b('0x49')]['id']},'raw':!![]})[_0x503b('0x23')](function(_0x188163){if(_0x188163){return BPromise[_0x503b('0x52')](_0x188163,function(_0x11f7bc){return new BPromise(function(_0x2d6877,_0x18aaff){if(_0x11f7bc[_0x503b('0x53')]===null||_0x11f7bc[_0x503b('0x53')]===0x1)_0x2d6877(null);return db[_0x503b('0x54')][_0x503b('0x41')]({'where':{'sectionId':_0x11f7bc['id']},'raw':!![]})[_0x503b('0x23')](function(_0x3356e8){var _0x155b74=_[_0x503b('0x29')](_0x3356e8,function(_0x3dff14){return qs[_0x503b('0x4e')](_0x3dff14,['id','createdAt',_0x503b('0x4b'),_0x503b('0x55')]);});_0x2d6877(_0x155b74);})['catch'](function(_0x42545b){_0x18aaff(_0x42545b);});})[_0x503b('0x23')](function(_0x3d9371){var _0x1e44b8=qs[_0x503b('0x4e')](_0x11f7bc,['id',_0x503b('0x4a'),_0x503b('0x4b')]);_0x1e44b8[_0x503b('0x56')]=_0x2c4986['id'];if(_0x3d9371)_0x1e44b8[_0x503b('0x57')]=_0x3d9371;return _0x1e44b8;})[_0x503b('0x23')](function(_0x51eb6d){return db[_0x503b('0x51')][_0x503b('0x48')](_0x51eb6d,{'include':[{'model':db['UserProfileResource'],'as':_0x503b('0x57')}],'raw':!![],'transaction':_0x278fa8});});})[_0x503b('0x23')](function(){return _0x2c4986;});}});});});}})[_0x503b('0x23')](respondWithResult(_0x38efd8,0xc9))[_0x503b('0x43')](handleError(_0x38efd8,null));};exports['update']=function(_0x3572c5,_0x5f54df){if(_0x3572c5['body']['id']){delete _0x3572c5['body']['id'];}return db['UserProfile'][_0x503b('0x47')]({'where':{'id':_0x3572c5[_0x503b('0x49')]['id']}})['then'](handleEntityNotFound(_0x5f54df,null))[_0x503b('0x23')](saveUpdates(_0x3572c5['body'],null))[_0x503b('0x23')](respondWithResult(_0x5f54df,null))[_0x503b('0x43')](handleError(_0x5f54df,null));};exports[_0x503b('0x24')]=function(_0x5b33b5,_0x1469d7){return db[_0x503b('0x2a')]['find']({'where':{'id':_0x5b33b5[_0x503b('0x49')]['id']}})['then'](handleEntityNotFound(_0x1469d7,null))[_0x503b('0x23')](removeEntity(_0x1469d7,null))[_0x503b('0x43')](handleError(_0x1469d7,null));};exports[_0x503b('0x58')]=function(_0x379d6b,_0x1f4d3b){return db['UserProfile'][_0x503b('0x58')]()[_0x503b('0x23')](respondWithResult(_0x1f4d3b,null))['catch'](handleError(_0x1f4d3b,null));};exports[_0x503b('0x59')]=function(_0x4e9a07,_0x35a1a2){var _0x4702d0=_0x4e9a07[_0x503b('0x4d')];return db[_0x503b('0x2a')][_0x503b('0x47')]({'where':{'id':_0x4e9a07[_0x503b('0x49')]['id']}})[_0x503b('0x23')](handleEntityNotFound(_0x35a1a2,null))[_0x503b('0x23')](function(_0x1ab21f){if(_0x1ab21f){return db[_0x503b('0x4f')][_0x503b('0x50')](function(_0x4303fc){return db[_0x503b('0x51')][_0x503b('0x24')]({'where':{'userProfileId':_0x4e9a07[_0x503b('0x49')]['id'],'sectionId':_[_0x503b('0x29')](_0x4702d0,function(_0x8efb40){return _0x8efb40['sectionId'];})},'transaction':_0x4303fc})[_0x503b('0x23')](function(){var _0x5bb505=_[_0x503b('0x29')](_0x4702d0,function(_0x2bc80c){_0x2bc80c[_0x503b('0x56')]=_0x4e9a07[_0x503b('0x49')]['id'];return _0x2bc80c;});var _0x39853f=[];return BPromise[_0x503b('0x52')](_0x5bb505,function(_0x1ce353){return db['UserProfileSection'][_0x503b('0x48')](_0x1ce353,{'include':[{'model':db[_0x503b('0x54')],'as':_0x503b('0x57')}],'raw':!![],'transaction':_0x4303fc})[_0x503b('0x23')](function(_0xb929b){_0x39853f[_0x503b('0x5a')](_0xb929b[_0x503b('0x5b')]({'plain':!![]}));});})[_0x503b('0x23')](function(){return _0x39853f;});});});}})[_0x503b('0x23')](function(_0x5f4c84){return _0x5f4c84;})[_0x503b('0x23')](respondWithResult(_0x35a1a2,null))['catch'](handleError(_0x35a1a2,null));};exports[_0x503b('0x5c')]=function(_0x2f2c08,_0x4952c4){var _0x390aca;return db[_0x503b('0x2a')][_0x503b('0x47')]({'where':{'id':_0x2f2c08[_0x503b('0x49')]['id']},'attributes':['id',_0x503b('0x27')]})['then'](handleEntityNotFound(_0x4952c4,null))['then'](function(_0x31e8ea){if(_0x31e8ea){_0x390aca=_0x31e8ea;return db['UserProfileSection'][_0x503b('0x24')]({'where':{'userProfileId':_0x2f2c08['params']['id'],'sectionId':_0x2f2c08[_0x503b('0x2f')][_0x503b('0x5d')]}});}})[_0x503b('0x23')](function(){return _0x390aca;})[_0x503b('0x23')](respondWithStatusCode(_0x4952c4,null))['catch'](handleError(_0x4952c4,null));};exports[_0x503b('0x5e')]=function(_0x6dec3d,_0x352e4e){var _0x494477=[];var _0x1ce1f4=[];return db['UserProfileSection']['findAll']({'where':{'userProfileId':_0x6dec3d[_0x503b('0x49')]['id']},'raw':!![]})[_0x503b('0x23')](function(_0x8089c1){_0x494477=_[_0x503b('0x3c')](_0x8089c1,function(_0x25bb91){return _0x25bb91['enabled']===0x1||_['includes']([0x3eb,0x709],_0x25bb91[_0x503b('0x55')]);});if(!_[_0x503b('0x5f')](_0x494477)){return _['map'](_0x494477,function(_0x5de6fe){return _0x5de6fe[_0x503b('0x55')];});}else{return;}})['then'](function(_0x2d266d){if(_0x2d266d)_0x1ce1f4=_0x2d266d;if(_['includes'](_0x1ce1f4,0x64)){var _0x3a7091=_[_0x503b('0x47')](_0x494477,{'sectionId':0x64});return hasDefaultDashboard(_0x3a7091)[_0x503b('0x23')](function(_0x419cd7){return _[_0x503b('0x29')](_0x494477,function(_0x30dc66){if(_0x30dc66['sectionId']===0x64){_0x30dc66[_0x503b('0x60')]=_0x419cd7;}return _0x30dc66;});});}else{return;}})[_0x503b('0x23')](function(_0x2386e8){if(_0x2386e8)_0x494477=_0x2386e8;if(_[_0x503b('0x61')](_0x1ce1f4,0x3eb)){var _0x53056f=_[_0x503b('0x47')](_0x494477,{'sectionId':0x3eb});return getCustomDashboards(_0x53056f)[_0x503b('0x23')](function(_0x4d944b){return _['map'](_0x494477,function(_0x339583){if(_0x53056f[_0x503b('0x62')]){if(_0x339583[_0x503b('0x55')]===0x3eb){_0x339583[_0x503b('0x60')]=_0x4d944b;}}else{if(_0x339583[_0x503b('0x55')]===0x64){_0x339583[_0x503b('0x60')]=_0x4d944b;}}return _0x339583;});});}else{return;}})[_0x503b('0x23')](function(_0x4d0579){if(_0x4d0579)_0x494477=_0x4d0579;if(_[_0x503b('0x61')](_0x1ce1f4,0x709)){var _0x555fcc=_[_0x503b('0x47')](_0x494477,{'sectionId':0x709});return getPlugins(_0x555fcc)['then'](function(_0x5f0298){if(_0x555fcc[_0x503b('0x62')]){return _[_0x503b('0x29')](_0x494477,function(_0x4ccf23){if(_0x4ccf23['sectionId']===0x709){_0x4ccf23[_0x503b('0x60')]=_0x5f0298;}return _0x4ccf23;});}else{var _0x10d506={'sectionId':0x76c,'enabled':0x1,'subsections':_0x5f0298};var _0x180a8e=_[_0x503b('0x29')](_0x494477);_0x180a8e[_0x503b('0x5a')](_0x10d506);return _0x180a8e;}});}else{return;}})[_0x503b('0x23')](function(_0x152586){if(_0x152586)_0x494477=_0x152586;return _[_0x503b('0x3c')](_0x494477,[_0x503b('0x62'),0x1]);})[_0x503b('0x23')](respondWithResult(_0x352e4e,null))[_0x503b('0x43')](handleError(_0x352e4e,null));};function hasDefaultDashboard(_0x572d82){var _0x2fae81=[0x65];return new BPromise(function(_0x3015f1,_0x1fefae){try{if(_0x572d82['autoAssociation']){_0x3015f1(_0x2fae81);}else{return db[_0x503b('0x54')]['findOne']({'where':{'sectionId':_0x572d82['id']},'raw':!![]})[_0x503b('0x23')](function(_0x509f18){_0x509f18?_0x3015f1(_0x2fae81):_0x3015f1();});}}catch(_0x6dc97){_0x1fefae(_0x6dc97);}});}function getCustomDashboards(_0x3e16b5){var _0x2096d9=[];return new BPromise(function(_0x39fb30,_0x57b7c4){try{if(_0x3e16b5[_0x503b('0x53')]){return db['Dashboard'][_0x503b('0x41')]({'raw':!![]})[_0x503b('0x23')](function(_0x20ac1e){_0x20ac1e[_0x503b('0x63')](function(_0x2da767){_0x2096d9[_0x503b('0x5a')](_0x2da767['id']+0x1869f);});_0x39fb30(_0x2096d9);});}else{return db[_0x503b('0x54')][_0x503b('0x41')]({'where':{'sectionId':_0x3e16b5['id']},'raw':!![]})[_0x503b('0x23')](function(_0x385857){_0x385857[_0x503b('0x63')](function(_0x370c09){_0x2096d9[_0x503b('0x5a')](_0x370c09[_0x503b('0x64')]+0x1869f);});_0x39fb30(_0x2096d9);});}}catch(_0xe6295f){_0x57b7c4(_0xe6295f);}});}function getPlugins(_0x56fddd){var _0x149a6b=[];return new BPromise(function(_0x50b026,_0x4d32d3){try{if(_0x56fddd[_0x503b('0x53')]){return db[_0x503b('0x65')]['findAll']({'raw':!![]})[_0x503b('0x23')](function(_0xc6d90){_0xc6d90[_0x503b('0x63')](function(_0xdfbe1c){_0x149a6b[_0x503b('0x5a')](_0xdfbe1c['id']+0x15b38);});_0x50b026(_0x149a6b);});}else{return db[_0x503b('0x54')][_0x503b('0x41')]({'where':{'sectionId':_0x56fddd['id']},'raw':!![]})[_0x503b('0x23')](function(_0x5767e4){_0x5767e4['forEach'](function(_0x8f3acb){_0x149a6b[_0x503b('0x5a')](_0x8f3acb[_0x503b('0x64')]+0x15b38);});_0x50b026(_0x149a6b);});}}catch(_0x3e0c69){_0x4d32d3(_0x3e0c69);}});}exports[_0x503b('0x66')]=function(_0x50e6cb,_0x354153){return db[_0x503b('0x2a')][_0x503b('0x47')]({'where':{'id':_0x50e6cb[_0x503b('0x49')]['id']}})[_0x503b('0x23')](handleEntityNotFound(_0x354153,null))[_0x503b('0x23')](function(_0x48a5ee){if(_0x48a5ee){return db['sequelize']['transaction'](function(_0x47a15a){return db[_0x503b('0x51')][_0x503b('0x41')]({'where':{'userProfileId':_0x50e6cb['params']['id']},'attributes':['id'],'raw':!![]})[_0x503b('0x23')](function(_0x529286){if(_0x529286){return db[_0x503b('0x51')][_0x503b('0x24')]({'where':{'userProfileId':_0x50e6cb[_0x503b('0x49')]['id'],'id':_[_0x503b('0x29')](_0x529286,function(_0x33b40a){return _0x33b40a['id'];})},'transaction':_0x47a15a});}})[_0x503b('0x23')](function(_0x4d6f51){var _0x14d863=_[_0x503b('0x29')](_0x50e6cb[_0x503b('0x4d')],function(_0x385c93){_0x385c93['userProfileId']=_0x50e6cb['params']['id'];return _0x385c93;});return db['UserProfileSection'][_0x503b('0x67')](_0x14d863,{'raw':!![],'transaction':_0x47a15a});})[_0x503b('0x23')](function(_0x2f513c){var _0x4b172e=_['filter'](_['map'](_0x2f513c,function(_0x246268){return _0x246268[_0x503b('0x5b')]({'plain':!![]});}),{'includeAll':![]});if(_0x4b172e){return db['UserProfileSection'][_0x503b('0x41')]({'where':{'userProfileId':_0x50e6cb[_0x503b('0x49')]['id'],'sectionId':_[_0x503b('0x29')](_0x4b172e,function(_0x31a46a){return _0x31a46a[_0x503b('0x55')];})},'attributes':['id',_0x503b('0x55')],'raw':!![]})['then'](function(_0x2bf4da){var _0x39a2e8=_[_0x503b('0x29')](_0x50e6cb[_0x503b('0x4d')],function(_0x5ad1db){_0x5ad1db[_0x503b('0x56')]=_0x50e6cb[_0x503b('0x49')]['id'];return _0x5ad1db;});return db[_0x503b('0x54')][_0x503b('0x67')](_0x39a2e8,{'raw':!![],'transaction':_0x47a15a});});}})[_0x503b('0x43')](handleError(_0x354153,null));});}})[_0x503b('0x23')](function(_0x1cad5c){var _0x6b27e4=_[_0x503b('0x29')](_0x1cad5c,function(_0x1921a9){return _0x1921a9[_0x503b('0x5b')]({'plain':!![]});});})[_0x503b('0x23')](respondWithResult(_0x354153,null))[_0x503b('0x43')](handleError(_0x354153,null));};exports['removeResources']=function(_0x521034,_0x4d4258,_0x1e427d){return db['UserProfile'][_0x503b('0x47')]({'where':{'id':_0x521034[_0x503b('0x49')]['id']}})[_0x503b('0x23')](handleEntityNotFound(_0x4d4258,null))[_0x503b('0x23')](function(_0x34ada6){if(_0x34ada6){return _0x34ada6[_0x503b('0x68')](_0x521034[_0x503b('0x2f')][_0x503b('0x5d')]);}})[_0x503b('0x23')](respondWithStatusCode(_0x4d4258,null))[_0x503b('0x43')](handleError(_0x4d4258,null));};exports[_0x503b('0x69')]=function(_0x272e83,_0x6977c9){var _0x1446bd={'raw':![],'where':{}};var _0xc394eb={};var _0x49097c={'count':0x0,'rows':[]};var _0x327f63=_0x272e83['query'][_0x503b('0x6a')];if(typeof _0x327f63===_0x503b('0x6b')){throw new db['Sequelize']['ValidationError']('Unknown\x20section');}var _0x1519e4=_0x272e83['query'][_0x503b('0x6c')]||![];var _0x31262b=getQueryModels(_0x327f63,_0x1519e4);if(typeof _0x31262b[_0x503b('0x6d')]==='undefined'){throw new db['Sequelize'][(_0x503b('0x6e'))](_0x503b('0x6f')+_0x327f63+'\x27');}var _0x41f183=[];if(!_[_0x503b('0x5f')](_0x31262b[_0x503b('0x70')])){_0x41f183=_0x31262b[_0x503b('0x70')];}else{_0x41f183=[{'name':_0x327f63}];}return db[_0x503b('0x2a')][_0x503b('0x71')]({'where':{'id':_0x272e83[_0x503b('0x49')]['id']}})['then'](handleEntityNotFound(_0x6977c9,null))[_0x503b('0x23')](function(_0x2cff98){if(_0x2cff98){var _0x335217=[];for(var _0x4574e4=0x0;_0x4574e4<_0x41f183[_0x503b('0x35')];_0x4574e4++){_0x335217[_0x503b('0x5a')](db['UserProfileSection'][_0x503b('0x71')]({'where':{'userProfileId':_0x2cff98['id'],'name':_0x41f183[_0x4574e4][_0x503b('0x27')]},'raw':!![]}));}return BPromise['all'](_0x335217);}})[_0x503b('0x23')](function(_0x245d18){var _0x25b609=_[_0x503b('0x3c')](_0x245d18,function(_0x2b3c61){return _0x2b3c61?_0x2b3c61:undefined;});var _0x290bd5=_['filter'](_0x41f183,['ignore',!![]]);var _0x2dbd80=_['isEmpty'](_0x25b609)&&_[_0x503b('0x5f')](_0x290bd5)?null:_[_0x503b('0x72')](_0x290bd5,_0x25b609);if(_0x2dbd80){var _0x1e3aab=[];for(var _0x27f9a9=0x0;_0x27f9a9<_0x2dbd80[_0x503b('0x35')];_0x27f9a9++){var _0x10a263=_[_0x503b('0x47')](_0x41f183,function(_0x47ebdb){return _0x2dbd80[_0x27f9a9]?_0x47ebdb[_0x503b('0x27')]===_0x2dbd80[_0x27f9a9]['name']:null;});if(_0x10a263){if(_0x2dbd80[_0x27f9a9]['ignore']){_0x1e3aab[_0x503b('0x5a')](getAllResources(_0x31262b[_0x503b('0x6d')],_0x2dbd80[_0x27f9a9]));}else{if(!_0x2dbd80[_0x27f9a9][_0x503b('0x53')]){_0x1e3aab[_0x503b('0x5a')](getAllowedResources(_0x10a263,_0x2dbd80[_0x27f9a9],_0x31262b[_0x503b('0x6d')]));}else{if(_0x10a263['model']){_0x1e3aab[_0x503b('0x5a')](getAllFilteredResources(_0x10a263,_0x2dbd80[_0x27f9a9]));}}}}}return BPromise['all'](_0x1e3aab);}else{return null;}})[_0x503b('0x23')](function(_0x1ad739){var _0x5dad2d=_0x1ad739;var _0x33fff3=null;if(_0x5dad2d){_0x33fff3=_0x5dad2d[_0x503b('0x35')]===0x1?_0x5dad2d[0x0]:null;}if(_0x33fff3||_0x5dad2d){var _0x3c3e9c=db[_0x31262b['childModel']][_0x503b('0x45')];_0xc394eb['model']=_[_0x503b('0x30')](_0x3c3e9c);_0xc394eb[_0x503b('0x2f')]=_[_0x503b('0x30')](_0x272e83[_0x503b('0x2f')]);_0xc394eb[_0x503b('0x31')]=_[_0x503b('0x32')](_0xc394eb[_0x503b('0x2e')],_0xc394eb['query']);_0x1446bd[_0x503b('0x33')]=_[_0x503b('0x32')](_0xc394eb[_0x503b('0x2e')],qs[_0x503b('0x34')](_0x272e83[_0x503b('0x2f')]['fields']));_0x1446bd[_0x503b('0x33')]=_0x1446bd[_0x503b('0x33')][_0x503b('0x35')]?_0x1446bd[_0x503b('0x33')]:_0xc394eb[_0x503b('0x2e')];if(!_0x272e83[_0x503b('0x2f')]['hasOwnProperty'](_0x503b('0x37'))){_0x1446bd[_0x503b('0x1c')]=qs['limit'](_0x272e83['query'][_0x503b('0x1c')]);_0x1446bd['offset']=qs[_0x503b('0x1b')](_0x272e83[_0x503b('0x2f')]['offset']);}_0x1446bd['order']=qs[_0x503b('0x39')](_0x272e83[_0x503b('0x2f')][_0x503b('0x39')]);_0x1446bd[_0x503b('0x3a')]=qs[_0x503b('0x31')](_['pick'](_0x272e83[_0x503b('0x2f')],_0xc394eb[_0x503b('0x31')]));if(_0x272e83[_0x503b('0x2f')][_0x503b('0x3c')]){_0x1446bd[_0x503b('0x3a')]=_[_0x503b('0x3e')](_0x1446bd[_0x503b('0x3a')],{'$or':_[_0x503b('0x29')](_0x3c3e9c,function(_0x3888aa){if(_0x3888aa[_0x503b('0x2c')][_0x503b('0x2d')]!=='VIRTUAL'){var _0x18c1ef={};_0x18c1ef[_0x3888aa[_0x503b('0x73')]]={'$like':'%'+_0x272e83[_0x503b('0x2f')][_0x503b('0x3c')]+'%'};return _0x18c1ef;}})});}var _0x5eb283=[];if(_0x33fff3){var _0xd4d647=_[_0x503b('0x47')](_0x41f183,['name',_0x33fff3[_0x503b('0x27')]]);if(_0xd4d647[_0x503b('0x73')]){var _0x1f5473={};if(_0x31262b['childModel']==='AnalyticExtractedReport'){_0x1f5473[_0xd4d647[_0x503b('0x74')]]=_[_0x503b('0x29')](_0x33fff3[_0x503b('0x75')],'id');}else{_0x1f5473[_0xd4d647[_0x503b('0x74')]]=_0x33fff3[_0x503b('0x75')];}_0x5eb283['push'](_0x1f5473);}else{_0x1446bd[_0x503b('0x3a')]['id']=_0x33fff3[_0x503b('0x75')];}}else{for(var _0x2dfcbb=0x0;_0x2dfcbb<_0x5dad2d[_0x503b('0x35')];_0x2dfcbb++){var _0xd4d647=_[_0x503b('0x47')](_0x41f183,[_0x503b('0x27'),_0x5dad2d[_0x2dfcbb][_0x503b('0x27')]]);if(_0xd4d647[_0x503b('0x73')]){var _0x1f5473={};_0x1f5473[_0xd4d647[_0x503b('0x74')]]=_0x5dad2d[_0x2dfcbb]['associatedResources'];_0x5eb283[_0x503b('0x5a')](_0x1f5473);}else{if(!_0x1446bd[_0x503b('0x3a')]['id'])_0x1446bd[_0x503b('0x3a')]['id']=[];_0x5dad2d[_0x2dfcbb]['associatedResources']['forEach'](function(_0x40242f){_0x1446bd['where']['id'][_0x503b('0x5a')](_0x40242f);});}}}if(!_['isEmpty'](_0x5eb283)){_0x1446bd['where']=_[_0x503b('0x3e')](_0x1446bd[_0x503b('0x3a')],{'$and':{'$or':_0x5eb283}});}_0x1446bd=_[_0x503b('0x3e')]({},_0x1446bd,_0x272e83[_0x503b('0x3f')]);if(_0x33fff3&&!_0x33fff3['autoAssociation']&&_0x31262b[_0x503b('0x6d')]==='AnalyticExtractedReport'){if(_0x272e83['query'][_0x503b('0x40')]){_0x1446bd['include']=[{'all':!![]}];}return db[_0x31262b[_0x503b('0x6d')]][_0x503b('0x41')](_0x1446bd)['then'](function(_0x288edc){var _0x9a0645=[];_0x288edc[_0x503b('0x63')](function(_0x2a6057){var _0x5341af;switch(_0x2a6057[_0x503b('0x76')]){case'default':_0x5341af=_[_0x503b('0x47')](_0x33fff3['associatedResources'],function(_0x4a86b4){return _0x4a86b4['id']===_0x2a6057[_0x503b('0x77')]&&_0x4a86b4[_0x503b('0x2c')]===_0x503b('0x78');});break;case _0x503b('0x79'):_0x5341af=_['find'](_0x33fff3[_0x503b('0x75')],function(_0x1af61e){return _0x1af61e['id']===_0x2a6057[_0x503b('0x77')]&&_0x1af61e['type']===_0x503b('0x7a');});break;}if(_0x5341af)_0x9a0645['push'](_0x2a6057);});_0x49097c['count']=_0x9a0645[_0x503b('0x35')];_0x49097c['rows']=_0x9a0645;return _0x49097c;});}else{return db[_0x31262b[_0x503b('0x6d')]][_0x503b('0x1a')]({'where':_0x1446bd[_0x503b('0x3a')]})[_0x503b('0x23')](function(_0x5c6834){_0x49097c['count']=_0x5c6834;if(_0x272e83[_0x503b('0x2f')][_0x503b('0x40')]){if(_0x31262b[_0x503b('0x6d')]===_0x503b('0x7b')){_0x1446bd[_0x503b('0x46')]=[{'model':db[_0x503b('0x7c')],'as':_0x503b('0x7d'),'attributes':['id','name',_0x503b('0x7e')],'required':_0x272e83[_0x503b('0x2f')][_0x503b('0x7f')]?!![]:![]},{'model':db[_0x503b('0x7c')],'as':_0x503b('0x80'),'attributes':['id','name',_0x503b('0x7e')],'through':_0x272e83[_0x503b('0x2f')][_0x503b('0x7f')]?{'attributes':[],'where':{'TagId':_0x272e83[_0x503b('0x2f')][_0x503b('0x7f')]||undefined}}:{},'required':_0x272e83['query'][_0x503b('0x7f')]?!![]:![]}];}else{_0x1446bd[_0x503b('0x46')]=[{'all':!![]}];}}return db[_0x31262b[_0x503b('0x6d')]][_0x503b('0x41')](_0x1446bd);})[_0x503b('0x23')](function(_0x3f3d89){_0x49097c[_0x503b('0x42')]=_0x3f3d89;return _0x49097c;});}}else{return _0x49097c;}})['then'](respondWithFilteredResult(_0x6977c9,_0x1446bd))[_0x503b('0x43')](handleError(_0x6977c9,null));};function getAllResources(_0x33146b,_0xa0160e){return new BPromise(function(_0x1ea106,_0x16fdfc){if(_0xa0160e){var _0x31874a=_0xa0160e[_0x503b('0x3c')]?{[_0xa0160e['filter']['field']]:_0xa0160e[_0x503b('0x3c')][_0x503b('0x81')]}:undefined;return db[_0x33146b][_0x503b('0x41')]({'where':_0x31874a,'raw':!![]})['then'](function(_0x530d10){_0xa0160e[_0x503b('0x75')]=_[_0x503b('0x29')](_0x530d10,'id');_0x1ea106(_0xa0160e);})[_0x503b('0x43')](function(_0x291a3f){_0x16fdfc(_0x291a3f);});}else{_0x1ea106(null);}});}function getAllFilteredResources(_0x106a0c,_0x4fcf56){return new BPromise(function(_0x1142ec,_0x482c21){var _0x41c112=_0x106a0c[_0x503b('0x3c')]?{[_0x106a0c['filter']['field']]:_0x106a0c[_0x503b('0x3c')][_0x503b('0x81')]}:undefined;return db[_0x106a0c[_0x503b('0x2e')]][_0x503b('0x41')]({'where':_0x41c112,'raw':!![]})[_0x503b('0x23')](function(_0x4a7c23){_0x4fcf56[_0x503b('0x75')]=_[_0x503b('0x29')](_0x4a7c23,function(_0x23aeea){return _0x23aeea['name'];});_0x1142ec(_0x4fcf56);})[_0x503b('0x43')](function(_0x434d9b){_0x482c21(_0x434d9b);});});}function getAllowedResources(_0x2f91ae,_0x537114,_0xf02797){return new BPromise(function(_0x1ccd0e,_0x3ec78a){if(_0x537114){return db[_0x503b('0x54')][_0x503b('0x41')]({'where':{'sectionId':_0x537114['id']},'raw':!![]})['then'](function(_0x1a39d3){if(_0x2f91ae[_0x503b('0x73')]&&_0x2f91ae[_0x503b('0x73')]!=='id'){_0x537114[_0x503b('0x75')]=_[_0x503b('0x29')](_0x1a39d3,function(_0x547374){return _0x547374[_0x2f91ae[_0x503b('0x73')]];});}else{if(_0xf02797==='AnalyticExtractedReport'){_0x537114[_0x503b('0x75')]=_[_0x503b('0x29')](_0x1a39d3,function(_0x30e272){return{'id':_0x30e272['resourceId'],'type':_0x30e272[_0x503b('0x2c')]};});}else{_0x537114['associatedResources']=_[_0x503b('0x29')](_0x1a39d3,function(_0x10260b){return _0x10260b[_0x503b('0x64')];});}}_0x1ccd0e(_0x537114);})[_0x503b('0x43')](function(_0xef42c1){_0x3ec78a(_0xef42c1);});}else{_0x1ccd0e(null);}});}function getQueryModels(_0x13e97a,_0x1a5de1){var _0x2c9388=_0x13e97a['toLowerCase']();var _0x2d2546={'childModel':undefined,'parentSections':[]};switch(_0x2c9388){case _0x503b('0x82'):_0x2d2546['childModel']=_0x503b('0x83');break;case _0x503b('0x84'):_0x2d2546['childModel']=_0x503b('0x85');break;case _0x503b('0x86'):_0x2d2546['childModel']=_0x503b('0x87');_0x2d2546['parentSections']=[{'name':_0x503b('0x88'),'field':_0x503b('0x27'),'foreignKey':_0x503b('0x89')}];break;case'projects':_0x2d2546[_0x503b('0x6d')]=_0x503b('0x8a');break;case _0x503b('0x8b'):_0x2d2546[_0x503b('0x6d')]=_0x503b('0x7b');_0x2d2546['parentSections']=[{'name':_0x503b('0x8c'),'field':'id','foreignKey':'ListId'}];break;case _0x503b('0x8d'):_0x2d2546[_0x503b('0x6d')]=_0x503b('0x8e');break;case _0x503b('0x8f'):_0x2d2546[_0x503b('0x6d')]=_0x503b('0x90');break;case'globalcustomfields':_0x2d2546['childModel']=_0x503b('0x91');break;case _0x503b('0x92'):_0x2d2546[_0x503b('0x6d')]=_0x503b('0x93');break;case'chatwebsites':_0x2d2546['childModel']=_0x503b('0x94');break;case _0x503b('0x95'):_0x2d2546[_0x503b('0x6d')]=_0x503b('0x96');break;case'faxaccounts':_0x2d2546['childModel']=_0x503b('0x97');break;case'inboundroutes':case _0x503b('0x98'):case _0x503b('0x99'):_0x2d2546[_0x503b('0x6d')]=_0x503b('0x9a');break;case _0x503b('0x9b'):_0x2d2546['childModel']=_0x503b('0x9c');break;case _0x503b('0x9d'):_0x2d2546[_0x503b('0x6d')]=_0x503b('0x9e');break;case _0x503b('0x9f'):_0x2d2546['childModel']=_0x503b('0xa0');_0x2d2546[_0x503b('0x70')]=[{'name':_0x503b('0xa1'),'field':_0x503b('0x27'),'foreignKey':'membername','model':_0x503b('0xa2'),'filter':{'field':'role','value':[_0x503b('0xa3')]}},{'name':_0x503b('0xa4'),'field':_0x503b('0x27'),'foreignKey':_0x503b('0xa5'),'model':'User','filter':{'field':'role','value':[_0x503b('0xa6')]}},{'name':_0x503b('0xa7'),'field':_0x503b('0x27'),'foreignKey':'queue','model':'VoiceQueue','filter':{'field':_0x503b('0x2c'),'value':[_0x503b('0xa8')]}},{'name':'QueueCampaigns','field':_0x503b('0x27'),'foreignKey':_0x503b('0xa9'),'model':_0x503b('0xaa'),'filter':{'field':_0x503b('0x2c'),'value':[_0x503b('0xab')]}}];break;case'musiconholds':_0x2d2546[_0x503b('0x6d')]=_0x503b('0xac');break;case _0x503b('0xad'):_0x2d2546[_0x503b('0x6d')]=_0x503b('0xae');break;case _0x503b('0xaf'):_0x2d2546[_0x503b('0x6d')]=_0x503b('0xb0');break;case'ivrcampaigns':_0x2d2546[_0x503b('0x6d')]=_0x503b('0xb1');break;case'mailqueues':_0x2d2546[_0x503b('0x6d')]='MailQueue';break;case'mailaccounts':_0x2d2546['childModel']=_0x503b('0xb2');break;case _0x503b('0xb3'):_0x2d2546[_0x503b('0x6d')]='MailSubstatus';break;case _0x503b('0xb4'):_0x2d2546[_0x503b('0x6d')]=_0x503b('0xb5');break;case _0x503b('0xb6'):_0x2d2546[_0x503b('0x6d')]=_0x503b('0xb7');break;case _0x503b('0xb8'):_0x2d2546[_0x503b('0x6d')]=_0x503b('0xb9');break;case _0x503b('0xba'):_0x2d2546[_0x503b('0x6d')]=_0x503b('0xbb');break;case _0x503b('0xbc'):_0x2d2546[_0x503b('0x6d')]=_0x503b('0xbd');break;case _0x503b('0xbe'):_0x2d2546[_0x503b('0x6d')]=_0x503b('0xbf');break;case _0x503b('0xc0'):_0x2d2546['childModel']='Team';break;case _0x503b('0xc1'):case _0x503b('0xc2'):_0x2d2546[_0x503b('0x6d')]='VoiceQueue';if(_0x1a5de1){_0x2d2546[_0x503b('0x70')]=[{'name':_0x503b('0xa7')},{'name':'QueueCampaigns'}];}break;case _0x503b('0xc3'):case _0x503b('0xc4'):case _0x503b('0xc5'):_0x2d2546[_0x503b('0x6d')]=_0x503b('0xa2');if(_0x1a5de1){_0x2d2546[_0x503b('0x70')]=[{'name':'Users','filter':{'field':_0x503b('0xc6'),'value':[_0x503b('0xc7'),'user']},'ignore':!![]},{'name':_0x503b('0xa1')},{'name':'Telephones'}];}break;case _0x503b('0xc8'):_0x2d2546[_0x503b('0x6d')]=_0x503b('0xc9');break;case'salesforceaccounts':_0x2d2546['childModel']=_0x503b('0xca');break;case'freshdeskaccounts':_0x2d2546[_0x503b('0x6d')]=_0x503b('0xcb');break;case _0x503b('0xcc'):_0x2d2546[_0x503b('0x6d')]=_0x503b('0xcd');break;case _0x503b('0xce'):_0x2d2546['childModel']=_0x503b('0xcf');break;case _0x503b('0xd0'):_0x2d2546['childModel']=_0x503b('0xd1');break;case _0x503b('0xd2'):_0x2d2546[_0x503b('0x6d')]='User';break;case _0x503b('0xd3'):_0x2d2546[_0x503b('0x6d')]=_0x503b('0xd4');break;case _0x503b('0xd5'):_0x2d2546['childModel']=_0x503b('0xd6');break;case _0x503b('0xd7'):_0x2d2546['childModel']='Dashboard';break;case _0x503b('0xd8'):_0x2d2546[_0x503b('0x6d')]='Interval';break;case _0x503b('0xd9'):_0x2d2546[_0x503b('0x6d')]='Pause';break;case _0x503b('0xda'):_0x2d2546[_0x503b('0x6d')]=_0x503b('0xdb');break;case'sounds':_0x2d2546[_0x503b('0x6d')]=_0x503b('0xdc');break;case _0x503b('0xdd'):_0x2d2546[_0x503b('0x6d')]=_0x503b('0x7c');break;case'templates':_0x2d2546[_0x503b('0x6d')]='Template';break;case _0x503b('0xde'):_0x2d2546[_0x503b('0x6d')]=_0x503b('0xdf');break;case _0x503b('0xe0'):_0x2d2546[_0x503b('0x6d')]=_0x503b('0xe1');break;case _0x503b('0xe2'):_0x2d2546['childModel']=_0x503b('0xe3');break;case'plugins':_0x2d2546[_0x503b('0x6d')]=_0x503b('0x65');break;case _0x503b('0xe4'):_0x2d2546[_0x503b('0x6d')]=_0x503b('0xe5');_0x2d2546[_0x503b('0x70')]=[{'name':_0x503b('0xe6'),'field':'id','foreignKey':'reportId'}];break;case _0x503b('0xe7'):_0x2d2546[_0x503b('0x6d')]=_0x503b('0xe8');break;case _0x503b('0xbe'):_0x2d2546[_0x503b('0x6d')]=_0x503b('0xbf');break;default:return _0x2d2546;}return _0x2d2546;} \ No newline at end of file +var _0x6e26=['CmContact','Tag','Tags','color','ThroughTags','tag','value','toLowerCase','squareprojects','SquareProject','SquareOdbc','squarerecordings','SquareRecording','parentSections','SquareProjects','projects','contacts','Lists','ListId','lists','CmList','companies','CmCompany','globalcustomfields','CmCustomField','chatqueues','ChatQueue','ChatWebsite','faxqueues','faxaccounts','FaxAccount','inboundroutes','internalroutes','VoiceExtension','contexts','voicemails','VoiceMail','voicerecordings','VoiceRecording','Agents','membername','agent','Telephones','User','role','telephone','queue','inbound','VoiceQueue','musiconholds','chanspies','voiceprefixes','VoicePrefix','Campaign','MailQueue','mailaccounts','MailAccount','MailSubstatus','openchannelqueues','OpenchannelQueue','openchannelaccounts','OpenchannelAccount','smsqueues','SmsQueue','smsaccounts','SmsAccount','whatsappqueues','WhatsappQueue','WhatsappAccount','teams','Team','VoiceQueues','QueueCampaigns','users','agents','telephones','Users','admin','user','zendeskaccounts','ZendeskAccount','salesforceaccounts','SalesforceAccount','FreshdeskAccount','sugarcrmaccounts','SugarcrmAccount','deskaccounts','DeskAccount','ZohoAccount','vtigeraccounts','cannedanswers','CannedAnswer','Disposition','intervals','Interval','pauses','Pause','scheduler','Schedule','sounds','tags','templates','triggers','Trigger','trunks','Trunk','variables','Variable','plugins','extractedreports','Reports','metrics','AnalyticMetric','whatsappaccounts','html-pdf','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','redis','socket.io-emitter','./userProfile.socket','register','status','json','count','offset','limit','set','Content-Range','reject','save','update','then','end','error','stack','name','send','map','UserProfile','rawAttributes','fieldName','type','model','keys','query','filters','intersection','attributes','fields','length','nolimit','order','sort','where','filter','merge','options','includeAll','include','rows','catch','show','find','create','body','clone','params','get','omit','updatedAt','crudPermissions','createdAt','sequelize','transaction','UserProfileSection','findAll','each','autoAssociation','UserProfileResource','sectionId','userProfileId','Resources','destroy','describe','addSections','push','removeSections','ids','getSections','enabled','includes','isEmpty','subsections','Dashboard','forEach','Plugin','resourceId','addResources','bulkCreate','removeResources','getResources','section','Sequelize','ValidationError','Unknown\x20section','mergeResources','childModel','undefined','findOne','all','union','hasOwnProperty','key','VIRTUAL','field','AnalyticExtractedReport','foreignKey','associatedResources','reportType','default','reportId','DefaultReports','custom'];(function(_0x35d64e,_0x131178){var _0x61efa=function(_0x2ecb7a){while(--_0x2ecb7a){_0x35d64e['push'](_0x35d64e['shift']());}};_0x61efa(++_0x131178);}(_0x6e26,0x167));var _0x66e2=function(_0x244fb0,_0x41188e){_0x244fb0=_0x244fb0-0x0;var _0x19c25b=_0x6e26[_0x244fb0];return _0x19c25b;};'use strict';var pdf=require(_0x66e2('0x0'));var emlformat=require(_0x66e2('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x66e2('0x2'));var jsonpatch=require(_0x66e2('0x3'));var rp=require('request-promise');var moment=require(_0x66e2('0x4'));var BPromise=require(_0x66e2('0x5'));var Mustache=require(_0x66e2('0x6'));var util=require(_0x66e2('0x7'));var path=require(_0x66e2('0x8'));var sox=require(_0x66e2('0x9'));var csv=require(_0x66e2('0xa'));var ejs=require(_0x66e2('0xb'));var fs=require('fs');var _=require(_0x66e2('0xc'));var squel=require(_0x66e2('0xd'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x66e2('0xe'));var toCsv=require(_0x66e2('0xa'));var querystring=require(_0x66e2('0xf'));var Papa=require('papaparse');var Redis=require(_0x66e2('0x10'));var authService=require(_0x66e2('0x11'));var qs=require(_0x66e2('0x12'));var as=require(_0x66e2('0x13'));var hardwareService=require(_0x66e2('0x14'));var logger=require(_0x66e2('0x15'))('api');var utils=require(_0x66e2('0x16'));var config=require(_0x66e2('0x17'));var db=require(_0x66e2('0x18'))['db'];config['redis']=_['defaults'](config[_0x66e2('0x19')],{'host':'localhost','port':0x18eb});var socket=require(_0x66e2('0x1a'))(new Redis(config[_0x66e2('0x19')]));require(_0x66e2('0x1b'))[_0x66e2('0x1c')](socket);function respondWithStatusCode(_0x3532a8,_0xa82e5d){_0xa82e5d=_0xa82e5d||0xcc;return function(_0x5348c2){if(_0x5348c2){return _0x3532a8['sendStatus'](_0xa82e5d);}return _0x3532a8[_0x66e2('0x1d')](_0xa82e5d)['end']();};}function respondWithResult(_0x46e1a7,_0x5c71b8){_0x5c71b8=_0x5c71b8||0xc8;return function(_0x2fa72b){if(_0x2fa72b){return _0x46e1a7[_0x66e2('0x1d')](_0x5c71b8)[_0x66e2('0x1e')](_0x2fa72b);}};}function respondWithFilteredResult(_0x425238,_0x361031){return function(_0x3fa025){if(_0x3fa025){var _0x535f44=_0x3fa025[_0x66e2('0x1f')],_0x3226c0=_0x361031[_0x66e2('0x20')],_0x531630=_0x361031[_0x66e2('0x20')]+_0x361031[_0x66e2('0x21')],_0x10b1cb;if(_0x531630>=_0x535f44){_0x531630=_0x535f44;_0x10b1cb=0xc8;}else{_0x10b1cb=0xce;}_0x425238['status'](_0x10b1cb);return _0x425238[_0x66e2('0x22')](_0x66e2('0x23'),_0x3226c0+'-'+_0x531630+'/'+_0x535f44)[_0x66e2('0x1e')](_0x3fa025);}return null;};}function patchUpdates(_0x43e619){return function(_0x410b48){try{jsonpatch['apply'](_0x410b48,_0x43e619,!![]);}catch(_0x3db5b1){return BPromise[_0x66e2('0x24')](_0x3db5b1);}return _0x410b48[_0x66e2('0x25')]();};}function saveUpdates(_0x6101b1,_0x2086dc){return function(_0x344a4e){if(_0x344a4e){return _0x344a4e[_0x66e2('0x26')](_0x6101b1)[_0x66e2('0x27')](function(_0x4f9b7d){return _0x4f9b7d;});}return null;};}function removeEntity(_0x28b4ab,_0x292eb7){return function(_0x24708d){if(_0x24708d){return _0x24708d['destroy']()['then'](function(){_0x28b4ab[_0x66e2('0x1d')](0xcc)[_0x66e2('0x28')]();});}};}function handleEntityNotFound(_0x5af382,_0x2a9568){return function(_0xd23eac){if(!_0xd23eac){_0x5af382['sendStatus'](0x194);}return _0xd23eac;};}function handleError(_0x5158a2,_0xc0e15c){_0xc0e15c=_0xc0e15c||0x1f4;return function(_0x4db9e2){logger[_0x66e2('0x29')](_0x4db9e2[_0x66e2('0x2a')]);if(_0x4db9e2[_0x66e2('0x2b')]){delete _0x4db9e2[_0x66e2('0x2b')];}_0x5158a2[_0x66e2('0x1d')](_0xc0e15c)[_0x66e2('0x2c')](_0x4db9e2);};}exports['index']=function(_0x5a5576,_0x3197cd){var _0x7867dd={},_0x5279e8={},_0xdcf02={'count':0x0,'rows':[]};var _0x182087=_[_0x66e2('0x2d')](db[_0x66e2('0x2e')][_0x66e2('0x2f')],function(_0x2e0b97){return{'name':_0x2e0b97[_0x66e2('0x30')],'type':_0x2e0b97[_0x66e2('0x31')]['key']};});_0x5279e8[_0x66e2('0x32')]=_[_0x66e2('0x2d')](_0x182087,_0x66e2('0x2b'));_0x5279e8['query']=_[_0x66e2('0x33')](_0x5a5576[_0x66e2('0x34')]);_0x5279e8[_0x66e2('0x35')]=_[_0x66e2('0x36')](_0x5279e8[_0x66e2('0x32')],_0x5279e8[_0x66e2('0x34')]);_0x7867dd[_0x66e2('0x37')]=_[_0x66e2('0x36')](_0x5279e8['model'],qs['fields'](_0x5a5576['query'][_0x66e2('0x38')]));_0x7867dd[_0x66e2('0x37')]=_0x7867dd[_0x66e2('0x37')][_0x66e2('0x39')]?_0x7867dd[_0x66e2('0x37')]:_0x5279e8['model'];if(!_0x5a5576['query']['hasOwnProperty'](_0x66e2('0x3a'))){_0x7867dd[_0x66e2('0x21')]=qs[_0x66e2('0x21')](_0x5a5576[_0x66e2('0x34')][_0x66e2('0x21')]);_0x7867dd[_0x66e2('0x20')]=qs[_0x66e2('0x20')](_0x5a5576[_0x66e2('0x34')][_0x66e2('0x20')]);}_0x7867dd[_0x66e2('0x3b')]=qs['sort'](_0x5a5576[_0x66e2('0x34')][_0x66e2('0x3c')]);_0x7867dd[_0x66e2('0x3d')]=qs[_0x66e2('0x35')](_['pick'](_0x5a5576[_0x66e2('0x34')],_0x5279e8[_0x66e2('0x35')]),_0x182087);if(_0x5a5576[_0x66e2('0x34')][_0x66e2('0x3e')]){_0x7867dd[_0x66e2('0x3d')]=_[_0x66e2('0x3f')](_0x7867dd[_0x66e2('0x3d')],{'$or':_[_0x66e2('0x2d')](_0x182087,function(_0x39380c){if(_0x39380c[_0x66e2('0x31')]!=='VIRTUAL'){var _0x1bcd4a={};_0x1bcd4a[_0x39380c[_0x66e2('0x2b')]]={'$like':'%'+_0x5a5576[_0x66e2('0x34')][_0x66e2('0x3e')]+'%'};return _0x1bcd4a;}})});}_0x7867dd=_['merge']({},_0x7867dd,_0x5a5576[_0x66e2('0x40')]);var _0xc869e={'where':_0x7867dd[_0x66e2('0x3d')]};return db['UserProfile'][_0x66e2('0x1f')](_0xc869e)[_0x66e2('0x27')](function(_0x31167a){_0xdcf02['count']=_0x31167a;if(_0x5a5576[_0x66e2('0x34')][_0x66e2('0x41')]){_0x7867dd[_0x66e2('0x42')]=[{'all':!![]}];}return db[_0x66e2('0x2e')]['findAll'](_0x7867dd);})[_0x66e2('0x27')](function(_0x3ec782){_0xdcf02[_0x66e2('0x43')]=_0x3ec782;return _0xdcf02;})[_0x66e2('0x27')](respondWithFilteredResult(_0x3197cd,_0x7867dd))[_0x66e2('0x44')](handleError(_0x3197cd,null));};exports[_0x66e2('0x45')]=function(_0x558398,_0x53c113){var _0x29ec74={'raw':![],'where':{'id':_0x558398['params']['id']}},_0x45a41d={};_0x45a41d[_0x66e2('0x32')]=_[_0x66e2('0x33')](db['UserProfile'][_0x66e2('0x2f')]);_0x45a41d[_0x66e2('0x34')]=_[_0x66e2('0x33')](_0x558398['query']);_0x45a41d['filters']=_['intersection'](_0x45a41d[_0x66e2('0x32')],_0x45a41d[_0x66e2('0x34')]);_0x29ec74[_0x66e2('0x37')]=_[_0x66e2('0x36')](_0x45a41d['model'],qs[_0x66e2('0x38')](_0x558398[_0x66e2('0x34')][_0x66e2('0x38')]));_0x29ec74[_0x66e2('0x37')]=_0x29ec74[_0x66e2('0x37')][_0x66e2('0x39')]?_0x29ec74[_0x66e2('0x37')]:_0x45a41d['model'];if(_0x558398['query']['includeAll']){_0x29ec74[_0x66e2('0x42')]=[{'all':!![]}];}_0x29ec74=_[_0x66e2('0x3f')]({},_0x29ec74,_0x558398[_0x66e2('0x40')]);return db[_0x66e2('0x2e')][_0x66e2('0x46')](_0x29ec74)[_0x66e2('0x27')](handleEntityNotFound(_0x53c113,null))[_0x66e2('0x27')](respondWithResult(_0x53c113,null))['catch'](handleError(_0x53c113,null));};exports[_0x66e2('0x47')]=function(_0x147d36,_0x39f2d1){return db[_0x66e2('0x2e')][_0x66e2('0x47')](_0x147d36[_0x66e2('0x48')],{})[_0x66e2('0x27')](respondWithResult(_0x39f2d1,0xc9))['catch'](handleError(_0x39f2d1,null));};exports[_0x66e2('0x49')]=function(_0x43ce8a,_0x55ee30){var _0x3ded57={'where':{'id':_0x43ce8a[_0x66e2('0x4a')]['id']}},_0x5f0437={};_0x5f0437[_0x66e2('0x32')]=_[_0x66e2('0x33')](db['UserProfile'][_0x66e2('0x2f')]);_0x3ded57[_0x66e2('0x37')]=_['intersection'](_0x5f0437['model'],qs[_0x66e2('0x38')](_0x43ce8a[_0x66e2('0x34')][_0x66e2('0x38')]));_0x3ded57[_0x66e2('0x37')]=_0x3ded57[_0x66e2('0x37')][_0x66e2('0x39')]?_0x3ded57['attributes']:_0x5f0437['model'];if(_0x43ce8a[_0x66e2('0x34')][_0x66e2('0x41')]){_0x3ded57['include']=[{'all':!![]}];}_0x3ded57=_[_0x66e2('0x3f')]({},_0x3ded57,_0x43ce8a[_0x66e2('0x40')]);return db[_0x66e2('0x2e')]['find'](_0x3ded57)[_0x66e2('0x27')](handleEntityNotFound(_0x55ee30,null))[_0x66e2('0x27')](function(_0x48854d){if(_0x48854d){var _0x10110c=_0x48854d[_0x66e2('0x4b')]({'plain':!![]});_0x10110c=qs[_0x66e2('0x4c')](_0x10110c,['id','createdAt',_0x66e2('0x4d'),_0x66e2('0x4e')]);_0x43ce8a['body']=_[_0x66e2('0x4c')](_0x43ce8a[_0x66e2('0x48')],['id',_0x66e2('0x4f'),_0x66e2('0x4d')]);return db[_0x66e2('0x50')][_0x66e2('0x51')](function(_0x2e4758){return db[_0x66e2('0x2e')][_0x66e2('0x47')](_[_0x66e2('0x3f')](_0x10110c,_0x43ce8a[_0x66e2('0x48')]),{'include':_0x43ce8a[_0x66e2('0x34')]['includeAll']?[{'all':!![]}]:undefined,'transaction':_0x2e4758})[_0x66e2('0x27')](function(_0x226425){var _0x5ab4f0=_0x226425[_0x66e2('0x4b')]({'plain':!![]});return db[_0x66e2('0x52')][_0x66e2('0x53')]({'where':{'userProfileId':_0x43ce8a['params']['id']},'raw':!![]})[_0x66e2('0x27')](function(_0x2fabc0){if(_0x2fabc0){return BPromise[_0x66e2('0x54')](_0x2fabc0,function(_0x46e7fa){return new BPromise(function(_0xc7853d,_0x1cacf8){if(_0x46e7fa[_0x66e2('0x55')]===null||_0x46e7fa[_0x66e2('0x55')]===0x1)_0xc7853d(null);return db[_0x66e2('0x56')][_0x66e2('0x53')]({'where':{'sectionId':_0x46e7fa['id']},'raw':!![]})[_0x66e2('0x27')](function(_0x3f8a78){var _0x6f7c68=_['map'](_0x3f8a78,function(_0x2f8793){return qs['omit'](_0x2f8793,['id','createdAt',_0x66e2('0x4d'),_0x66e2('0x57')]);});_0xc7853d(_0x6f7c68);})['catch'](function(_0x40fe60){_0x1cacf8(_0x40fe60);});})[_0x66e2('0x27')](function(_0x573036){var _0x4fa2f0=qs['omit'](_0x46e7fa,['id',_0x66e2('0x4f'),_0x66e2('0x4d')]);_0x4fa2f0[_0x66e2('0x58')]=_0x5ab4f0['id'];if(_0x573036)_0x4fa2f0[_0x66e2('0x59')]=_0x573036;return _0x4fa2f0;})['then'](function(_0x692b1d){return db['UserProfileSection']['create'](_0x692b1d,{'include':[{'model':db[_0x66e2('0x56')],'as':'Resources'}],'raw':!![],'transaction':_0x2e4758});});})['then'](function(){return _0x5ab4f0;});}});});});}})['then'](respondWithResult(_0x55ee30,0xc9))[_0x66e2('0x44')](handleError(_0x55ee30,null));};exports[_0x66e2('0x26')]=function(_0x5c334e,_0x2928d2){if(_0x5c334e[_0x66e2('0x48')]['id']){delete _0x5c334e[_0x66e2('0x48')]['id'];}return db['UserProfile'][_0x66e2('0x46')]({'where':{'id':_0x5c334e['params']['id']}})['then'](handleEntityNotFound(_0x2928d2,null))[_0x66e2('0x27')](saveUpdates(_0x5c334e[_0x66e2('0x48')],null))[_0x66e2('0x27')](respondWithResult(_0x2928d2,null))[_0x66e2('0x44')](handleError(_0x2928d2,null));};exports[_0x66e2('0x5a')]=function(_0x42a370,_0x1906a2){return db[_0x66e2('0x2e')][_0x66e2('0x46')]({'where':{'id':_0x42a370[_0x66e2('0x4a')]['id']}})[_0x66e2('0x27')](handleEntityNotFound(_0x1906a2,null))['then'](removeEntity(_0x1906a2,null))[_0x66e2('0x44')](handleError(_0x1906a2,null));};exports[_0x66e2('0x5b')]=function(_0x1094b1,_0x4e0f3a){return db['UserProfile']['describe']()[_0x66e2('0x27')](respondWithResult(_0x4e0f3a,null))[_0x66e2('0x44')](handleError(_0x4e0f3a,null));};exports[_0x66e2('0x5c')]=function(_0x220185,_0xde1a6d){var _0x2cdcaa=_0x220185[_0x66e2('0x48')];return db[_0x66e2('0x2e')]['find']({'where':{'id':_0x220185[_0x66e2('0x4a')]['id']}})[_0x66e2('0x27')](handleEntityNotFound(_0xde1a6d,null))[_0x66e2('0x27')](function(_0x4edbe3){if(_0x4edbe3){return db[_0x66e2('0x50')]['transaction'](function(_0x58319f){return db['UserProfileSection'][_0x66e2('0x5a')]({'where':{'userProfileId':_0x220185[_0x66e2('0x4a')]['id'],'sectionId':_['map'](_0x2cdcaa,function(_0x66dd2a){return _0x66dd2a[_0x66e2('0x57')];})},'transaction':_0x58319f})[_0x66e2('0x27')](function(){var _0x34846d=_[_0x66e2('0x2d')](_0x2cdcaa,function(_0x330cd9){_0x330cd9[_0x66e2('0x58')]=_0x220185['params']['id'];return _0x330cd9;});var _0x2e58bd=[];return BPromise['each'](_0x34846d,function(_0x23a5ad){return db[_0x66e2('0x52')][_0x66e2('0x47')](_0x23a5ad,{'include':[{'model':db['UserProfileResource'],'as':_0x66e2('0x59')}],'raw':!![],'transaction':_0x58319f})[_0x66e2('0x27')](function(_0x298022){_0x2e58bd[_0x66e2('0x5d')](_0x298022['get']({'plain':!![]}));});})[_0x66e2('0x27')](function(){return _0x2e58bd;});});});}})['then'](function(_0x1702f6){return _0x1702f6;})['then'](respondWithResult(_0xde1a6d,null))[_0x66e2('0x44')](handleError(_0xde1a6d,null));};exports[_0x66e2('0x5e')]=function(_0x2e7c0b,_0x26bf8c){var _0x4827b4;return db[_0x66e2('0x2e')][_0x66e2('0x46')]({'where':{'id':_0x2e7c0b[_0x66e2('0x4a')]['id']},'attributes':['id','name']})['then'](handleEntityNotFound(_0x26bf8c,null))[_0x66e2('0x27')](function(_0x33c983){if(_0x33c983){_0x4827b4=_0x33c983;return db[_0x66e2('0x52')]['destroy']({'where':{'userProfileId':_0x2e7c0b[_0x66e2('0x4a')]['id'],'sectionId':_0x2e7c0b[_0x66e2('0x34')][_0x66e2('0x5f')]}});}})[_0x66e2('0x27')](function(){return _0x4827b4;})['then'](respondWithStatusCode(_0x26bf8c,null))[_0x66e2('0x44')](handleError(_0x26bf8c,null));};exports[_0x66e2('0x60')]=function(_0x26776f,_0x5e3142){var _0x55df4e=[];var _0x5d5caa=[];return db['UserProfileSection'][_0x66e2('0x53')]({'where':{'userProfileId':_0x26776f[_0x66e2('0x4a')]['id']},'raw':!![]})[_0x66e2('0x27')](function(_0x326819){_0x55df4e=_['filter'](_0x326819,function(_0x2b7682){return _0x2b7682[_0x66e2('0x61')]===0x1||_[_0x66e2('0x62')]([0x3eb,0x709],_0x2b7682[_0x66e2('0x57')]);});if(!_[_0x66e2('0x63')](_0x55df4e)){return _['map'](_0x55df4e,function(_0x1ae790){return _0x1ae790[_0x66e2('0x57')];});}else{return;}})[_0x66e2('0x27')](function(_0x4dedff){if(_0x4dedff)_0x5d5caa=_0x4dedff;if(_[_0x66e2('0x62')](_0x5d5caa,0x64)){var _0x233e2a=_[_0x66e2('0x46')](_0x55df4e,{'sectionId':0x64});return hasDefaultDashboard(_0x233e2a)[_0x66e2('0x27')](function(_0x18a09c){return _[_0x66e2('0x2d')](_0x55df4e,function(_0x6ee218){if(_0x6ee218[_0x66e2('0x57')]===0x64){_0x6ee218['subsections']=_0x18a09c;}return _0x6ee218;});});}else{return;}})[_0x66e2('0x27')](function(_0x5ef473){if(_0x5ef473)_0x55df4e=_0x5ef473;if(_[_0x66e2('0x62')](_0x5d5caa,0x3eb)){var _0x3ae0bf=_[_0x66e2('0x46')](_0x55df4e,{'sectionId':0x3eb});return getCustomDashboards(_0x3ae0bf)['then'](function(_0x5bd957){return _['map'](_0x55df4e,function(_0x15a0f9){if(_0x3ae0bf[_0x66e2('0x61')]){if(_0x15a0f9[_0x66e2('0x57')]===0x3eb){_0x15a0f9[_0x66e2('0x64')]=_0x5bd957;}}else{if(_0x15a0f9[_0x66e2('0x57')]===0x64){_0x15a0f9[_0x66e2('0x64')]=_0x5bd957;}}return _0x15a0f9;});});}else{return;}})[_0x66e2('0x27')](function(_0x5003be){if(_0x5003be)_0x55df4e=_0x5003be;if(_[_0x66e2('0x62')](_0x5d5caa,0x709)){var _0x134128=_['find'](_0x55df4e,{'sectionId':0x709});return getPlugins(_0x134128)[_0x66e2('0x27')](function(_0x9553b7){if(_0x134128[_0x66e2('0x61')]){return _['map'](_0x55df4e,function(_0x4bcbad){if(_0x4bcbad[_0x66e2('0x57')]===0x709){_0x4bcbad[_0x66e2('0x64')]=_0x9553b7;}return _0x4bcbad;});}else{var _0x3909fc={'sectionId':0x76c,'enabled':0x1,'subsections':_0x9553b7};var _0x538d11=_[_0x66e2('0x2d')](_0x55df4e);_0x538d11[_0x66e2('0x5d')](_0x3909fc);return _0x538d11;}});}else{return;}})[_0x66e2('0x27')](function(_0x32353d){if(_0x32353d)_0x55df4e=_0x32353d;return _['filter'](_0x55df4e,[_0x66e2('0x61'),0x1]);})['then'](respondWithResult(_0x5e3142,null))[_0x66e2('0x44')](handleError(_0x5e3142,null));};function hasDefaultDashboard(_0x23529d){var _0x146b54=[0x65];return new BPromise(function(_0x5ab23c,_0x56e82f){try{if(_0x23529d[_0x66e2('0x55')]){_0x5ab23c(_0x146b54);}else{return db[_0x66e2('0x56')]['findOne']({'where':{'sectionId':_0x23529d['id']},'raw':!![]})['then'](function(_0xe2ae4a){_0xe2ae4a?_0x5ab23c(_0x146b54):_0x5ab23c();});}}catch(_0x3637bb){_0x56e82f(_0x3637bb);}});}function getCustomDashboards(_0x3cd568){var _0x16e3c6=[];return new BPromise(function(_0x23c16b,_0x5092a2){try{if(_0x3cd568[_0x66e2('0x55')]){return db[_0x66e2('0x65')]['findAll']({'raw':!![]})[_0x66e2('0x27')](function(_0x141573){_0x141573[_0x66e2('0x66')](function(_0x57d93a){_0x16e3c6['push'](_0x57d93a['id']+0x1869f);});_0x23c16b(_0x16e3c6);});}else{return db[_0x66e2('0x56')][_0x66e2('0x53')]({'where':{'sectionId':_0x3cd568['id']},'raw':!![]})[_0x66e2('0x27')](function(_0x1c52db){_0x1c52db[_0x66e2('0x66')](function(_0x4577d7){_0x16e3c6[_0x66e2('0x5d')](_0x4577d7['resourceId']+0x1869f);});_0x23c16b(_0x16e3c6);});}}catch(_0x2f27be){_0x5092a2(_0x2f27be);}});}function getPlugins(_0x509b83){var _0x17dab3=[];return new BPromise(function(_0x2ec7b2,_0x398ea7){try{if(_0x509b83[_0x66e2('0x55')]){return db[_0x66e2('0x67')][_0x66e2('0x53')]({'raw':!![]})['then'](function(_0x29ff76){_0x29ff76[_0x66e2('0x66')](function(_0x4ce444){_0x17dab3['push'](_0x4ce444['id']+0x15b38);});_0x2ec7b2(_0x17dab3);});}else{return db[_0x66e2('0x56')][_0x66e2('0x53')]({'where':{'sectionId':_0x509b83['id']},'raw':!![]})[_0x66e2('0x27')](function(_0x1475cb){_0x1475cb[_0x66e2('0x66')](function(_0x304a6b){_0x17dab3['push'](_0x304a6b[_0x66e2('0x68')]+0x15b38);});_0x2ec7b2(_0x17dab3);});}}catch(_0x3f28b8){_0x398ea7(_0x3f28b8);}});}exports[_0x66e2('0x69')]=function(_0x3fc565,_0x4b6d7e){return db[_0x66e2('0x2e')][_0x66e2('0x46')]({'where':{'id':_0x3fc565[_0x66e2('0x4a')]['id']}})[_0x66e2('0x27')](handleEntityNotFound(_0x4b6d7e,null))[_0x66e2('0x27')](function(_0x2edcb0){if(_0x2edcb0){return db[_0x66e2('0x50')][_0x66e2('0x51')](function(_0x3c7869){return db['UserProfileSection'][_0x66e2('0x53')]({'where':{'userProfileId':_0x3fc565['params']['id']},'attributes':['id'],'raw':!![]})[_0x66e2('0x27')](function(_0x109023){if(_0x109023){return db[_0x66e2('0x52')]['destroy']({'where':{'userProfileId':_0x3fc565[_0x66e2('0x4a')]['id'],'id':_[_0x66e2('0x2d')](_0x109023,function(_0x35bf05){return _0x35bf05['id'];})},'transaction':_0x3c7869});}})[_0x66e2('0x27')](function(_0xab66a3){var _0x55bfbf=_[_0x66e2('0x2d')](_0x3fc565[_0x66e2('0x48')],function(_0x138605){_0x138605['userProfileId']=_0x3fc565[_0x66e2('0x4a')]['id'];return _0x138605;});return db[_0x66e2('0x52')][_0x66e2('0x6a')](_0x55bfbf,{'raw':!![],'transaction':_0x3c7869});})[_0x66e2('0x27')](function(_0x50f926){var _0x287a4e=_[_0x66e2('0x3e')](_[_0x66e2('0x2d')](_0x50f926,function(_0x4656a5){return _0x4656a5[_0x66e2('0x4b')]({'plain':!![]});}),{'includeAll':![]});if(_0x287a4e){return db['UserProfileSection']['findAll']({'where':{'userProfileId':_0x3fc565[_0x66e2('0x4a')]['id'],'sectionId':_[_0x66e2('0x2d')](_0x287a4e,function(_0x180a3c){return _0x180a3c[_0x66e2('0x57')];})},'attributes':['id','sectionId'],'raw':!![]})['then'](function(_0x433236){var _0x37d232=_['map'](_0x3fc565['body'],function(_0x5baf26){_0x5baf26['userProfileId']=_0x3fc565[_0x66e2('0x4a')]['id'];return _0x5baf26;});return db[_0x66e2('0x56')]['bulkCreate'](_0x37d232,{'raw':!![],'transaction':_0x3c7869});});}})[_0x66e2('0x44')](handleError(_0x4b6d7e,null));});}})['then'](function(_0x453b4f){var _0x6ade2f=_[_0x66e2('0x2d')](_0x453b4f,function(_0x104ee3){return _0x104ee3[_0x66e2('0x4b')]({'plain':!![]});});})[_0x66e2('0x27')](respondWithResult(_0x4b6d7e,null))[_0x66e2('0x44')](handleError(_0x4b6d7e,null));};exports[_0x66e2('0x6b')]=function(_0x59fd8,_0x3ebb61,_0x52c721){return db[_0x66e2('0x2e')][_0x66e2('0x46')]({'where':{'id':_0x59fd8[_0x66e2('0x4a')]['id']}})[_0x66e2('0x27')](handleEntityNotFound(_0x3ebb61,null))['then'](function(_0x13e9e6){if(_0x13e9e6){return _0x13e9e6[_0x66e2('0x6b')](_0x59fd8[_0x66e2('0x34')][_0x66e2('0x5f')]);}})['then'](respondWithStatusCode(_0x3ebb61,null))['catch'](handleError(_0x3ebb61,null));};exports[_0x66e2('0x6c')]=function(_0x19377d,_0x177110){var _0x46436c={'raw':![],'where':{}};var _0x1baa99={};var _0x4e67b5={'count':0x0,'rows':[]};var _0x27eead=_0x19377d['query'][_0x66e2('0x6d')];if(typeof _0x27eead==='undefined'){throw new db[(_0x66e2('0x6e'))][(_0x66e2('0x6f'))](_0x66e2('0x70'));}var _0xe43529=_0x19377d[_0x66e2('0x34')][_0x66e2('0x71')]||![];var _0x2a258b=getQueryModels(_0x27eead,_0xe43529);if(typeof _0x2a258b[_0x66e2('0x72')]===_0x66e2('0x73')){throw new db[(_0x66e2('0x6e'))][(_0x66e2('0x6f'))]('Invalid\x20section\x20\x27'+_0x27eead+'\x27');}var _0x233cde=[];if(!_[_0x66e2('0x63')](_0x2a258b['parentSections'])){_0x233cde=_0x2a258b['parentSections'];}else{_0x233cde=[{'name':_0x27eead}];}return db[_0x66e2('0x2e')][_0x66e2('0x74')]({'where':{'id':_0x19377d[_0x66e2('0x4a')]['id']}})[_0x66e2('0x27')](handleEntityNotFound(_0x177110,null))[_0x66e2('0x27')](function(_0x58006f){if(_0x58006f){var _0x599a1e=[];for(var _0x51ebe1=0x0;_0x51ebe1<_0x233cde[_0x66e2('0x39')];_0x51ebe1++){_0x599a1e[_0x66e2('0x5d')](db[_0x66e2('0x52')][_0x66e2('0x74')]({'where':{'userProfileId':_0x58006f['id'],'name':_0x233cde[_0x51ebe1][_0x66e2('0x2b')]},'raw':!![]}));}return BPromise[_0x66e2('0x75')](_0x599a1e);}})['then'](function(_0x512905){var _0x4d95cc=_[_0x66e2('0x3e')](_0x512905,function(_0x167181){return _0x167181?_0x167181:undefined;});var _0x2c38b6=_[_0x66e2('0x3e')](_0x233cde,['ignore',!![]]);var _0x46e1ab=_['isEmpty'](_0x4d95cc)&&_[_0x66e2('0x63')](_0x2c38b6)?null:_[_0x66e2('0x76')](_0x2c38b6,_0x4d95cc);if(_0x46e1ab){var _0x19872a=[];for(var _0x1b90fa=0x0;_0x1b90fa<_0x46e1ab[_0x66e2('0x39')];_0x1b90fa++){var _0xdd4c26=_['find'](_0x233cde,function(_0x5cbbda){return _0x46e1ab[_0x1b90fa]?_0x5cbbda[_0x66e2('0x2b')]===_0x46e1ab[_0x1b90fa][_0x66e2('0x2b')]:null;});if(_0xdd4c26){if(_0x46e1ab[_0x1b90fa]['ignore']){_0x19872a[_0x66e2('0x5d')](getAllResources(_0x2a258b[_0x66e2('0x72')],_0x46e1ab[_0x1b90fa]));}else{if(!_0x46e1ab[_0x1b90fa]['autoAssociation']){_0x19872a[_0x66e2('0x5d')](getAllowedResources(_0xdd4c26,_0x46e1ab[_0x1b90fa],_0x2a258b['childModel']));}else{if(_0xdd4c26[_0x66e2('0x32')]){_0x19872a[_0x66e2('0x5d')](getAllFilteredResources(_0xdd4c26,_0x46e1ab[_0x1b90fa]));}}}}}return BPromise[_0x66e2('0x75')](_0x19872a);}else{return null;}})['then'](function(_0xbf29e6){var _0x481eba=_0xbf29e6;var _0x4ba58d=null;if(_0x481eba){_0x4ba58d=_0x481eba[_0x66e2('0x39')]===0x1?_0x481eba[0x0]:null;}if(_0x4ba58d||_0x481eba){var _0x49b431=db[_0x2a258b[_0x66e2('0x72')]][_0x66e2('0x2f')];_0x1baa99[_0x66e2('0x32')]=_['keys'](_0x49b431);_0x1baa99[_0x66e2('0x34')]=_[_0x66e2('0x33')](_0x19377d['query']);_0x1baa99[_0x66e2('0x35')]=_[_0x66e2('0x36')](_0x1baa99['model'],_0x1baa99[_0x66e2('0x34')]);_0x46436c[_0x66e2('0x37')]=_[_0x66e2('0x36')](_0x1baa99[_0x66e2('0x32')],qs[_0x66e2('0x38')](_0x19377d['query']['fields']));_0x46436c[_0x66e2('0x37')]=_0x46436c[_0x66e2('0x37')][_0x66e2('0x39')]?_0x46436c[_0x66e2('0x37')]:_0x1baa99[_0x66e2('0x32')];if(!_0x19377d['query'][_0x66e2('0x77')](_0x66e2('0x3a'))){_0x46436c[_0x66e2('0x21')]=qs[_0x66e2('0x21')](_0x19377d[_0x66e2('0x34')][_0x66e2('0x21')]);_0x46436c[_0x66e2('0x20')]=qs[_0x66e2('0x20')](_0x19377d[_0x66e2('0x34')]['offset']);}_0x46436c[_0x66e2('0x3b')]=qs[_0x66e2('0x3c')](_0x19377d[_0x66e2('0x34')][_0x66e2('0x3c')]);_0x46436c[_0x66e2('0x3d')]=qs[_0x66e2('0x35')](_['pick'](_0x19377d['query'],_0x1baa99[_0x66e2('0x35')]));if(_0x19377d[_0x66e2('0x34')][_0x66e2('0x3e')]){_0x46436c[_0x66e2('0x3d')]=_[_0x66e2('0x3f')](_0x46436c['where'],{'$or':_[_0x66e2('0x2d')](_0x49b431,function(_0x508a73){if(_0x508a73[_0x66e2('0x31')][_0x66e2('0x78')]!==_0x66e2('0x79')){var _0x6b719e={};_0x6b719e[_0x508a73[_0x66e2('0x7a')]]={'$like':'%'+_0x19377d['query']['filter']+'%'};return _0x6b719e;}})});}var _0x4a1a41=[];if(_0x4ba58d){var _0x251c00=_[_0x66e2('0x46')](_0x233cde,[_0x66e2('0x2b'),_0x4ba58d['name']]);if(_0x251c00[_0x66e2('0x7a')]){var _0x5e8399={};if(_0x2a258b[_0x66e2('0x72')]===_0x66e2('0x7b')){_0x5e8399[_0x251c00[_0x66e2('0x7c')]]=_['map'](_0x4ba58d[_0x66e2('0x7d')],'id');}else{_0x5e8399[_0x251c00[_0x66e2('0x7c')]]=_0x4ba58d['associatedResources'];}_0x4a1a41['push'](_0x5e8399);}else{_0x46436c[_0x66e2('0x3d')]['id']=_0x4ba58d[_0x66e2('0x7d')];}}else{for(var _0x3b9be4=0x0;_0x3b9be4<_0x481eba['length'];_0x3b9be4++){var _0x251c00=_[_0x66e2('0x46')](_0x233cde,[_0x66e2('0x2b'),_0x481eba[_0x3b9be4]['name']]);if(_0x251c00[_0x66e2('0x7a')]){var _0x5e8399={};_0x5e8399[_0x251c00['foreignKey']]=_0x481eba[_0x3b9be4][_0x66e2('0x7d')];_0x4a1a41[_0x66e2('0x5d')](_0x5e8399);}else{if(!_0x46436c[_0x66e2('0x3d')]['id'])_0x46436c[_0x66e2('0x3d')]['id']=[];_0x481eba[_0x3b9be4][_0x66e2('0x7d')][_0x66e2('0x66')](function(_0x38b3c6){_0x46436c[_0x66e2('0x3d')]['id'][_0x66e2('0x5d')](_0x38b3c6);});}}}if(!_[_0x66e2('0x63')](_0x4a1a41)){_0x46436c[_0x66e2('0x3d')]=_[_0x66e2('0x3f')](_0x46436c[_0x66e2('0x3d')],{'$and':{'$or':_0x4a1a41}});}_0x46436c=_['merge']({},_0x46436c,_0x19377d[_0x66e2('0x40')]);if(_0x4ba58d&&!_0x4ba58d[_0x66e2('0x55')]&&_0x2a258b[_0x66e2('0x72')]===_0x66e2('0x7b')){if(_0x19377d[_0x66e2('0x34')][_0x66e2('0x41')]){_0x46436c[_0x66e2('0x42')]=[{'all':!![]}];}return db[_0x2a258b[_0x66e2('0x72')]][_0x66e2('0x53')](_0x46436c)[_0x66e2('0x27')](function(_0x2f7cbf){var _0x4f4ade=[];_0x2f7cbf['forEach'](function(_0x1d6fb5){var _0x8e3d28;switch(_0x1d6fb5[_0x66e2('0x7e')]){case _0x66e2('0x7f'):_0x8e3d28=_[_0x66e2('0x46')](_0x4ba58d[_0x66e2('0x7d')],function(_0x1bf32a){return _0x1bf32a['id']===_0x1d6fb5[_0x66e2('0x80')]&&_0x1bf32a[_0x66e2('0x31')]===_0x66e2('0x81');});break;case _0x66e2('0x82'):_0x8e3d28=_['find'](_0x4ba58d[_0x66e2('0x7d')],function(_0x48a06b){return _0x48a06b['id']===_0x1d6fb5[_0x66e2('0x80')]&&_0x48a06b[_0x66e2('0x31')]==='CustomReports';});break;}if(_0x8e3d28)_0x4f4ade[_0x66e2('0x5d')](_0x1d6fb5);});_0x4e67b5[_0x66e2('0x1f')]=_0x4f4ade['length'];_0x4e67b5[_0x66e2('0x43')]=_0x4f4ade;return _0x4e67b5;});}else{return db[_0x2a258b['childModel']][_0x66e2('0x1f')]({'where':_0x46436c[_0x66e2('0x3d')]})[_0x66e2('0x27')](function(_0x1391cf){_0x4e67b5[_0x66e2('0x1f')]=_0x1391cf;if(_0x19377d[_0x66e2('0x34')]['includeAll']){if(_0x2a258b[_0x66e2('0x72')]===_0x66e2('0x83')){_0x46436c[_0x66e2('0x42')]=[{'model':db[_0x66e2('0x84')],'as':_0x66e2('0x85'),'attributes':['id',_0x66e2('0x2b'),_0x66e2('0x86')],'required':_0x19377d[_0x66e2('0x34')]['tag']?!![]:![]},{'model':db[_0x66e2('0x84')],'as':_0x66e2('0x87'),'attributes':['id','name','color'],'through':_0x19377d[_0x66e2('0x34')]['tag']?{'attributes':[],'where':{'TagId':_0x19377d[_0x66e2('0x34')][_0x66e2('0x88')]||undefined}}:{},'required':_0x19377d['query'][_0x66e2('0x88')]?!![]:![]}];}else{_0x46436c[_0x66e2('0x42')]=[{'all':!![]}];}}return db[_0x2a258b[_0x66e2('0x72')]][_0x66e2('0x53')](_0x46436c);})[_0x66e2('0x27')](function(_0x5d1de2){_0x4e67b5[_0x66e2('0x43')]=_0x5d1de2;return _0x4e67b5;});}}else{return _0x4e67b5;}})['then'](respondWithFilteredResult(_0x177110,_0x46436c))['catch'](handleError(_0x177110,null));};function getAllResources(_0x40896a,_0x4ada9f){return new BPromise(function(_0x35befd,_0x5c740e){if(_0x4ada9f){var _0x17042d=_0x4ada9f[_0x66e2('0x3e')]?{[_0x4ada9f[_0x66e2('0x3e')][_0x66e2('0x7a')]]:_0x4ada9f[_0x66e2('0x3e')]['value']}:undefined;return db[_0x40896a][_0x66e2('0x53')]({'where':_0x17042d,'raw':!![]})[_0x66e2('0x27')](function(_0x418e6a){_0x4ada9f[_0x66e2('0x7d')]=_[_0x66e2('0x2d')](_0x418e6a,'id');_0x35befd(_0x4ada9f);})[_0x66e2('0x44')](function(_0x380045){_0x5c740e(_0x380045);});}else{_0x35befd(null);}});}function getAllFilteredResources(_0x273d00,_0x5f58e5){return new BPromise(function(_0x23ad03,_0x3d9e42){var _0x2f4bcd=_0x273d00[_0x66e2('0x3e')]?{[_0x273d00['filter'][_0x66e2('0x7a')]]:_0x273d00['filter'][_0x66e2('0x89')]}:undefined;return db[_0x273d00[_0x66e2('0x32')]][_0x66e2('0x53')]({'where':_0x2f4bcd,'raw':!![]})[_0x66e2('0x27')](function(_0x2b7730){_0x5f58e5[_0x66e2('0x7d')]=_[_0x66e2('0x2d')](_0x2b7730,function(_0x24c511){return _0x24c511[_0x66e2('0x2b')];});_0x23ad03(_0x5f58e5);})[_0x66e2('0x44')](function(_0x318472){_0x3d9e42(_0x318472);});});}function getAllowedResources(_0x1b7952,_0x4e97f5,_0x3d885d){return new BPromise(function(_0x12321f,_0x29b250){if(_0x4e97f5){return db[_0x66e2('0x56')][_0x66e2('0x53')]({'where':{'sectionId':_0x4e97f5['id']},'raw':!![]})[_0x66e2('0x27')](function(_0x30a85a){if(_0x1b7952[_0x66e2('0x7a')]&&_0x1b7952[_0x66e2('0x7a')]!=='id'){_0x4e97f5[_0x66e2('0x7d')]=_[_0x66e2('0x2d')](_0x30a85a,function(_0x49ddae){return _0x49ddae[_0x1b7952[_0x66e2('0x7a')]];});}else{if(_0x3d885d==='AnalyticExtractedReport'){_0x4e97f5['associatedResources']=_[_0x66e2('0x2d')](_0x30a85a,function(_0x2931d5){return{'id':_0x2931d5[_0x66e2('0x68')],'type':_0x2931d5['type']};});}else{_0x4e97f5[_0x66e2('0x7d')]=_[_0x66e2('0x2d')](_0x30a85a,function(_0x1808e8){return _0x1808e8['resourceId'];});}}_0x12321f(_0x4e97f5);})[_0x66e2('0x44')](function(_0x4740db){_0x29b250(_0x4740db);});}else{_0x12321f(null);}});}function getQueryModels(_0x2822c8,_0xf8e8fa){var _0x241bfa=_0x2822c8[_0x66e2('0x8a')]();var _0x1fc72c={'childModel':undefined,'parentSections':[]};switch(_0x241bfa){case _0x66e2('0x8b'):_0x1fc72c[_0x66e2('0x72')]=_0x66e2('0x8c');break;case'odbc':_0x1fc72c['childModel']=_0x66e2('0x8d');break;case _0x66e2('0x8e'):_0x1fc72c[_0x66e2('0x72')]=_0x66e2('0x8f');_0x1fc72c[_0x66e2('0x90')]=[{'name':_0x66e2('0x91'),'field':_0x66e2('0x2b'),'foreignKey':'projectName'}];break;case _0x66e2('0x92'):_0x1fc72c[_0x66e2('0x72')]='JscriptyProject';break;case _0x66e2('0x93'):_0x1fc72c[_0x66e2('0x72')]=_0x66e2('0x83');_0x1fc72c[_0x66e2('0x90')]=[{'name':_0x66e2('0x94'),'field':'id','foreignKey':_0x66e2('0x95')}];break;case _0x66e2('0x96'):_0x1fc72c[_0x66e2('0x72')]=_0x66e2('0x97');break;case _0x66e2('0x98'):_0x1fc72c[_0x66e2('0x72')]=_0x66e2('0x99');break;case _0x66e2('0x9a'):_0x1fc72c[_0x66e2('0x72')]=_0x66e2('0x9b');break;case _0x66e2('0x9c'):_0x1fc72c[_0x66e2('0x72')]=_0x66e2('0x9d');break;case'chatwebsites':_0x1fc72c[_0x66e2('0x72')]=_0x66e2('0x9e');break;case _0x66e2('0x9f'):_0x1fc72c[_0x66e2('0x72')]='FaxQueue';break;case _0x66e2('0xa0'):_0x1fc72c[_0x66e2('0x72')]=_0x66e2('0xa1');break;case _0x66e2('0xa2'):case _0x66e2('0xa3'):case'outboundroutes':_0x1fc72c[_0x66e2('0x72')]=_0x66e2('0xa4');break;case _0x66e2('0xa5'):_0x1fc72c[_0x66e2('0x72')]='VoiceContext';break;case _0x66e2('0xa6'):_0x1fc72c[_0x66e2('0x72')]=_0x66e2('0xa7');break;case _0x66e2('0xa8'):_0x1fc72c[_0x66e2('0x72')]=_0x66e2('0xa9');_0x1fc72c[_0x66e2('0x90')]=[{'name':_0x66e2('0xaa'),'field':'name','foreignKey':_0x66e2('0xab'),'model':'User','filter':{'field':'role','value':[_0x66e2('0xac')]}},{'name':_0x66e2('0xad'),'field':_0x66e2('0x2b'),'foreignKey':'membername','model':_0x66e2('0xae'),'filter':{'field':_0x66e2('0xaf'),'value':[_0x66e2('0xb0')]}},{'name':'VoiceQueues','field':'name','foreignKey':_0x66e2('0xb1'),'model':'VoiceQueue','filter':{'field':_0x66e2('0x31'),'value':[_0x66e2('0xb2')]}},{'name':'QueueCampaigns','field':_0x66e2('0x2b'),'foreignKey':_0x66e2('0xb1'),'model':_0x66e2('0xb3'),'filter':{'field':_0x66e2('0x31'),'value':['outbound']}}];break;case _0x66e2('0xb4'):_0x1fc72c[_0x66e2('0x72')]='VoiceMusicOnHold';break;case _0x66e2('0xb5'):_0x1fc72c['childModel']='VoiceChanSpy';break;case _0x66e2('0xb6'):_0x1fc72c[_0x66e2('0x72')]=_0x66e2('0xb7');break;case'ivrcampaigns':_0x1fc72c[_0x66e2('0x72')]=_0x66e2('0xb8');break;case'mailqueues':_0x1fc72c[_0x66e2('0x72')]=_0x66e2('0xb9');break;case _0x66e2('0xba'):_0x1fc72c['childModel']=_0x66e2('0xbb');break;case'mailsubstatuses':_0x1fc72c[_0x66e2('0x72')]=_0x66e2('0xbc');break;case _0x66e2('0xbd'):_0x1fc72c[_0x66e2('0x72')]=_0x66e2('0xbe');break;case _0x66e2('0xbf'):_0x1fc72c['childModel']=_0x66e2('0xc0');break;case _0x66e2('0xc1'):_0x1fc72c['childModel']=_0x66e2('0xc2');break;case _0x66e2('0xc3'):_0x1fc72c[_0x66e2('0x72')]=_0x66e2('0xc4');break;case _0x66e2('0xc5'):_0x1fc72c[_0x66e2('0x72')]=_0x66e2('0xc6');break;case'whatsappaccounts':_0x1fc72c[_0x66e2('0x72')]=_0x66e2('0xc7');break;case _0x66e2('0xc8'):_0x1fc72c[_0x66e2('0x72')]=_0x66e2('0xc9');break;case'voicequeues':case'queuecampaigns':_0x1fc72c[_0x66e2('0x72')]=_0x66e2('0xb3');if(_0xf8e8fa){_0x1fc72c['parentSections']=[{'name':_0x66e2('0xca')},{'name':_0x66e2('0xcb')}];}break;case _0x66e2('0xcc'):case _0x66e2('0xcd'):case _0x66e2('0xce'):_0x1fc72c[_0x66e2('0x72')]='User';if(_0xf8e8fa){_0x1fc72c[_0x66e2('0x90')]=[{'name':_0x66e2('0xcf'),'filter':{'field':_0x66e2('0xaf'),'value':[_0x66e2('0xd0'),_0x66e2('0xd1')]},'ignore':!![]},{'name':_0x66e2('0xaa')},{'name':'Telephones'}];}break;case _0x66e2('0xd2'):_0x1fc72c[_0x66e2('0x72')]=_0x66e2('0xd3');break;case _0x66e2('0xd4'):_0x1fc72c[_0x66e2('0x72')]=_0x66e2('0xd5');break;case'freshdeskaccounts':_0x1fc72c['childModel']=_0x66e2('0xd6');break;case _0x66e2('0xd7'):_0x1fc72c['childModel']=_0x66e2('0xd8');break;case _0x66e2('0xd9'):_0x1fc72c['childModel']=_0x66e2('0xda');break;case'zohoaccounts':_0x1fc72c[_0x66e2('0x72')]=_0x66e2('0xdb');break;case _0x66e2('0xdc'):_0x1fc72c['childModel']='User';break;case _0x66e2('0xdd'):_0x1fc72c[_0x66e2('0x72')]=_0x66e2('0xde');break;case'dispositions':_0x1fc72c[_0x66e2('0x72')]=_0x66e2('0xdf');break;case'customdashboards':_0x1fc72c[_0x66e2('0x72')]=_0x66e2('0x65');break;case _0x66e2('0xe0'):_0x1fc72c[_0x66e2('0x72')]=_0x66e2('0xe1');break;case _0x66e2('0xe2'):_0x1fc72c[_0x66e2('0x72')]=_0x66e2('0xe3');break;case _0x66e2('0xe4'):_0x1fc72c[_0x66e2('0x72')]=_0x66e2('0xe5');break;case _0x66e2('0xe6'):_0x1fc72c[_0x66e2('0x72')]='Sound';break;case _0x66e2('0xe7'):_0x1fc72c[_0x66e2('0x72')]=_0x66e2('0x84');break;case _0x66e2('0xe8'):_0x1fc72c['childModel']='Template';break;case _0x66e2('0xe9'):_0x1fc72c[_0x66e2('0x72')]=_0x66e2('0xea');break;case _0x66e2('0xeb'):_0x1fc72c['childModel']=_0x66e2('0xec');break;case _0x66e2('0xed'):_0x1fc72c['childModel']=_0x66e2('0xee');break;case _0x66e2('0xef'):_0x1fc72c[_0x66e2('0x72')]=_0x66e2('0x67');break;case _0x66e2('0xf0'):_0x1fc72c[_0x66e2('0x72')]=_0x66e2('0x7b');_0x1fc72c[_0x66e2('0x90')]=[{'name':_0x66e2('0xf1'),'field':'id','foreignKey':_0x66e2('0x80')}];break;case _0x66e2('0xf2'):_0x1fc72c[_0x66e2('0x72')]=_0x66e2('0xf3');break;case _0x66e2('0xf4'):_0x1fc72c[_0x66e2('0x72')]=_0x66e2('0xc7');break;default:return _0x1fc72c;}return _0x1fc72c;} \ No newline at end of file diff --git a/server/api/userProfile/userProfile.events.js b/server/api/userProfile/userProfile.events.js index 30ce58b..3c1440b 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 _0x003b=['setMaxListeners','save','update','remove','emit','hook','events','UserProfile'];(function(_0x1ea39b,_0x550554){var _0x3c2e56=function(_0x31edb2){while(--_0x31edb2){_0x1ea39b['push'](_0x1ea39b['shift']());}};_0x3c2e56(++_0x550554);}(_0x003b,0xae));var _0xb003=function(_0x3ca68a,_0x2063fd){_0x3ca68a=_0x3ca68a-0x0;var _0x204c1b=_0x003b[_0x3ca68a];return _0x204c1b;};'use strict';var EventEmitter=require(_0xb003('0x0'));var UserProfile=require('../../mysqldb')['db'][_0xb003('0x1')];var UserProfileEvents=new EventEmitter();UserProfileEvents[_0xb003('0x2')](0x0);var events={'afterCreate':_0xb003('0x3'),'afterUpdate':_0xb003('0x4'),'afterDestroy':_0xb003('0x5')};function emitEvent(_0x1ad6b8){return function(_0xd1f056,_0x3892af,_0x10cc06){UserProfileEvents[_0xb003('0x6')](_0x1ad6b8+':'+_0xd1f056['id'],_0xd1f056);UserProfileEvents[_0xb003('0x6')](_0x1ad6b8,_0xd1f056);_0x10cc06(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];UserProfile[_0xb003('0x7')](e,emitEvent(event));}}module['exports']=UserProfileEvents; \ No newline at end of file +var _0xac57=['UserProfile','setMaxListeners','remove','emit','hasOwnProperty','exports','events','../../mysqldb'];(function(_0xc23a26,_0x283345){var _0x13e139=function(_0x3e8918){while(--_0x3e8918){_0xc23a26['push'](_0xc23a26['shift']());}};_0x13e139(++_0x283345);}(_0xac57,0x136));var _0x7ac5=function(_0x1a362a,_0x532d2e){_0x1a362a=_0x1a362a-0x0;var _0x1c6fc4=_0xac57[_0x1a362a];return _0x1c6fc4;};'use strict';var EventEmitter=require(_0x7ac5('0x0'));var UserProfile=require(_0x7ac5('0x1'))['db'][_0x7ac5('0x2')];var UserProfileEvents=new EventEmitter();UserProfileEvents[_0x7ac5('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0x7ac5('0x4')};function emitEvent(_0x6518f7){return function(_0x5dfd48,_0x5766aa,_0x3099e3){UserProfileEvents[_0x7ac5('0x5')](_0x6518f7+':'+_0x5dfd48['id'],_0x5dfd48);UserProfileEvents[_0x7ac5('0x5')](_0x6518f7,_0x5dfd48);_0x3099e3(null);};}for(var e in events){if(events[_0x7ac5('0x6')](e)){var event=events[e];UserProfile['hook'](e,emitEvent(event));}}module[_0x7ac5('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 5f50b05..91041e1 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 _0xf904=['../../config/environment','define','user_profiles','lodash','util','../../config/logger','bluebird','request-promise','rimraf'];(function(_0x57b4dc,_0x3fbf56){var _0x19a18a=function(_0x31b596){while(--_0x31b596){_0x57b4dc['push'](_0x57b4dc['shift']());}};_0x19a18a(++_0x3fbf56);}(_0xf904,0xc9));var _0x4f90=function(_0x4e783c,_0x51a362){_0x4e783c=_0x4e783c-0x0;var _0x2fbd6d=_0xf904[_0x4e783c];return _0x2fbd6d;};'use strict';var _=require(_0x4f90('0x0'));var util=require(_0x4f90('0x1'));var logger=require(_0x4f90('0x2'))('api');var moment=require('moment');var BPromise=require(_0x4f90('0x3'));var rp=require(_0x4f90('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x4f90('0x5'));var config=require(_0x4f90('0x6'));var attributes=require('./userProfile.attributes');module['exports']=function(_0x2814fa,_0x32dd34){return _0x2814fa[_0x4f90('0x7')]('UserProfile',attributes,{'tableName':_0x4f90('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf12e=['UserProfile','util','../../config/logger','bluebird','request-promise','rimraf','./userProfile.attributes','exports','define'];(function(_0x3ffcf3,_0xbea246){var _0x54104a=function(_0xf28336){while(--_0xf28336){_0x3ffcf3['push'](_0x3ffcf3['shift']());}};_0x54104a(++_0xbea246);}(_0xf12e,0x1f0));var _0xef12=function(_0x32017c,_0x3991d4){_0x32017c=_0x32017c-0x0;var _0xca9140=_0xf12e[_0x32017c];return _0xca9140;};'use strict';var _=require('lodash');var util=require(_0xef12('0x0'));var logger=require(_0xef12('0x1'))('api');var moment=require('moment');var BPromise=require(_0xef12('0x2'));var rp=require(_0xef12('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0xef12('0x4'));var config=require('../../config/environment');var attributes=require(_0xef12('0x5'));module[_0xef12('0x6')]=function(_0x3ca57f,_0x5e85ed){return _0x3ca57f[_0xef12('0x7')](_0xef12('0x8'),attributes,{'tableName':'user_profiles','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.rpc.js b/server/api/userProfile/userProfile.rpc.js index 972eaef..d0d994b 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 _0xb138=['message','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','defaults','redis','localhost','./userProfile.socket','request','info','UserProfile,\x20%s,\x20%s','request\x20sent','debug','UserProfile,\x20%s,\x20%s,\x20%s','error'];(function(_0x854372,_0x13fcbf){var _0x2b0f2d=function(_0x394499){while(--_0x394499){_0x854372['push'](_0x854372['shift']());}};_0x2b0f2d(++_0x13fcbf);}(_0xb138,0x1dd));var _0x8b13=function(_0x2abacb,_0x2887a0){_0x2abacb=_0x2abacb-0x0;var _0x1e0521=_0xb138[_0x2abacb];return _0x1e0521;};'use strict';var _=require(_0x8b13('0x0'));var util=require(_0x8b13('0x1'));var moment=require(_0x8b13('0x2'));var BPromise=require(_0x8b13('0x3'));var rs=require(_0x8b13('0x4'));var fs=require('fs');var Redis=require(_0x8b13('0x5'));var db=require(_0x8b13('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x8b13('0x7'))(_0x8b13('0x8'));var config=require(_0x8b13('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x8b13('0xa')][_0x8b13('0xb')]({'port':0x232a});config['redis']=_[_0x8b13('0xc')](config[_0x8b13('0xd')],{'host':_0x8b13('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x8b13('0xd')]));require(_0x8b13('0xf'))['register'](socket);function respondWithRpcPromise(_0x53ae50,_0x1f2528,_0x21fcd9){return new BPromise(function(_0x13fbd1,_0x439451){return client[_0x8b13('0x10')](_0x53ae50,_0x21fcd9)['then'](function(_0x11bc89){logger[_0x8b13('0x11')](_0x8b13('0x12'),_0x1f2528,_0x8b13('0x13'));logger[_0x8b13('0x14')](_0x8b13('0x15'),_0x1f2528,'request\x20sent',JSON['stringify'](_0x11bc89));if(_0x11bc89[_0x8b13('0x16')]){if(_0x11bc89[_0x8b13('0x16')]['code']===0x1f4){logger['error']('UserProfile,\x20%s,\x20%s',_0x1f2528,_0x11bc89[_0x8b13('0x16')][_0x8b13('0x17')]);return _0x439451(_0x11bc89[_0x8b13('0x16')][_0x8b13('0x17')]);}logger[_0x8b13('0x16')]('UserProfile,\x20%s,\x20%s',_0x1f2528,_0x11bc89[_0x8b13('0x16')][_0x8b13('0x17')]);return _0x13fbd1(_0x11bc89[_0x8b13('0x16')][_0x8b13('0x17')]);}else{logger[_0x8b13('0x11')](_0x8b13('0x12'),_0x1f2528,_0x8b13('0x13'));_0x13fbd1(_0x11bc89[_0x8b13('0x18')]['message']);}})['catch'](function(_0xae4966){logger[_0x8b13('0x16')](_0x8b13('0x12'),_0x1f2528,_0xae4966);_0x439451(_0xae4966);});});} \ No newline at end of file +var _0xac9d=['./userProfile.socket','register','request','then','info','UserProfile,\x20%s,\x20%s','debug','UserProfile,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','redis','defaults','socket.io-emitter'];(function(_0x217ef4,_0x2a9025){var _0x531d31=function(_0x385958){while(--_0x385958){_0x217ef4['push'](_0x217ef4['shift']());}};_0x531d31(++_0x2a9025);}(_0xac9d,0x14d));var _0xdac9=function(_0x71e493,_0x4308b7){_0x71e493=_0x71e493-0x0;var _0x3d40ab=_0xac9d[_0x71e493];return _0x3d40ab;};'use strict';var _=require(_0xdac9('0x0'));var util=require(_0xdac9('0x1'));var moment=require(_0xdac9('0x2'));var BPromise=require(_0xdac9('0x3'));var rs=require(_0xdac9('0x4'));var fs=require('fs');var Redis=require(_0xdac9('0x5'));var db=require(_0xdac9('0x6'))['db'];var utils=require(_0xdac9('0x7'));var logger=require('../../config/logger')(_0xdac9('0x8'));var config=require('../../config/environment');var jayson=require(_0xdac9('0x9'));var client=jayson[_0xdac9('0xa')][_0xdac9('0xb')]({'port':0x232a});config[_0xdac9('0xc')]=_[_0xdac9('0xd')](config[_0xdac9('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0xdac9('0xe'))(new Redis(config['redis']));require(_0xdac9('0xf'))[_0xdac9('0x10')](socket);function respondWithRpcPromise(_0x39c92c,_0x1a4674,_0x23ec14){return new BPromise(function(_0x2859bf,_0x255627){return client[_0xdac9('0x11')](_0x39c92c,_0x23ec14)[_0xdac9('0x12')](function(_0x5514c5){logger[_0xdac9('0x13')](_0xdac9('0x14'),_0x1a4674,'request\x20sent');logger[_0xdac9('0x15')](_0xdac9('0x16'),_0x1a4674,_0xdac9('0x17'),JSON['stringify'](_0x5514c5));if(_0x5514c5[_0xdac9('0x18')]){if(_0x5514c5[_0xdac9('0x18')][_0xdac9('0x19')]===0x1f4){logger['error']('UserProfile,\x20%s,\x20%s',_0x1a4674,_0x5514c5[_0xdac9('0x18')][_0xdac9('0x1a')]);return _0x255627(_0x5514c5['error'][_0xdac9('0x1a')]);}logger[_0xdac9('0x18')](_0xdac9('0x14'),_0x1a4674,_0x5514c5[_0xdac9('0x18')][_0xdac9('0x1a')]);return _0x2859bf(_0x5514c5[_0xdac9('0x18')][_0xdac9('0x1a')]);}else{logger[_0xdac9('0x13')]('UserProfile,\x20%s,\x20%s',_0x1a4674,_0xdac9('0x17'));_0x2859bf(_0x5514c5[_0xdac9('0x1b')]['message']);}})[_0xdac9('0x1c')](function(_0xa57f2d){logger[_0xdac9('0x18')](_0xdac9('0x14'),_0x1a4674,_0xa57f2d);_0x255627(_0xa57f2d);});});} \ No newline at end of file diff --git a/server/api/userProfile/userProfile.socket.js b/server/api/userProfile/userProfile.socket.js index cbca9a6..e313c68 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 _0x21a3=['length','userProfile:','./userProfile.events','save','remove','removeListener'];(function(_0x24a1db,_0x37ae2a){var _0x59728d=function(_0x10744d){while(--_0x10744d){_0x24a1db['push'](_0x24a1db['shift']());}};_0x59728d(++_0x37ae2a);}(_0x21a3,0x1d0));var _0x321a=function(_0x542da8,_0x509c26){_0x542da8=_0x542da8-0x0;var _0x533d7e=_0x21a3[_0x542da8];return _0x533d7e;};'use strict';var UserProfileEvents=require(_0x321a('0x0'));var events=[_0x321a('0x1'),_0x321a('0x2'),'update'];function createListener(_0x2c23f6,_0x2e18bf){return function(_0x35f058){_0x2e18bf['emit'](_0x2c23f6,_0x35f058);};}function removeListener(_0x526d28,_0x383a0f){return function(){UserProfileEvents[_0x321a('0x3')](_0x526d28,_0x383a0f);};}exports['register']=function(_0x72993){for(var _0x47e0a6=0x0,_0x42adee=events[_0x321a('0x4')];_0x47e0a6<_0x42adee;_0x47e0a6++){var _0x32a01b=events[_0x47e0a6];var _0x2bf6b0=createListener(_0x321a('0x5')+_0x32a01b,_0x72993);UserProfileEvents['on'](_0x32a01b,_0x2bf6b0);}}; \ No newline at end of file +var _0x3447=['update','emit','removeListener','userProfile:','./userProfile.events','save','remove'];(function(_0x189981,_0x1d4d5a){var _0x13f0ce=function(_0x38ca8f){while(--_0x38ca8f){_0x189981['push'](_0x189981['shift']());}};_0x13f0ce(++_0x1d4d5a);}(_0x3447,0x170));var _0x7344=function(_0x3070dc,_0x40cf11){_0x3070dc=_0x3070dc-0x0;var _0x431489=_0x3447[_0x3070dc];return _0x431489;};'use strict';var UserProfileEvents=require(_0x7344('0x0'));var events=[_0x7344('0x1'),_0x7344('0x2'),_0x7344('0x3')];function createListener(_0x11aea5,_0xb4695c){return function(_0x29aff7){_0xb4695c[_0x7344('0x4')](_0x11aea5,_0x29aff7);};}function removeListener(_0x59be46,_0x34396d){return function(){UserProfileEvents[_0x7344('0x5')](_0x59be46,_0x34396d);};}exports['register']=function(_0x435c3b){for(var _0xdbba67=0x0,_0x903647=events['length'];_0xdbba67<_0x903647;_0xdbba67++){var _0x4bb32d=events[_0xdbba67];var _0x220b32=createListener(_0x7344('0x6')+_0x4bb32d,_0x435c3b);UserProfileEvents['on'](_0x4bb32d,_0x220b32);}}; \ No newline at end of file diff --git a/server/api/userProfileResource/index.js b/server/api/userProfileResource/index.js index f6f791a..159608a 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 _0xcf8f=['post','put','update','delete','destroy','exports','multer','util','path','express','Router','../../components/interaction/service','../../config/environment','isAuthenticated','index','describe','get','/:id','show'];(function(_0x347862,_0x339566){var _0x2ec88b=function(_0x290bdc){while(--_0x290bdc){_0x347862['push'](_0x347862['shift']());}};_0x2ec88b(++_0x339566);}(_0xcf8f,0x78));var _0xfcf8=function(_0x4ef887,_0x35dfe){_0x4ef887=_0x4ef887-0x0;var _0x482373=_0xcf8f[_0x4ef887];return _0x482373;};'use strict';var multer=require(_0xfcf8('0x0'));var util=require(_0xfcf8('0x1'));var path=require(_0xfcf8('0x2'));var timeout=require('connect-timeout');var express=require(_0xfcf8('0x3'));var router=express[_0xfcf8('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0xfcf8('0x5'));var config=require(_0xfcf8('0x6'));var controller=require('./userProfileResource.controller');router['get']('/',auth[_0xfcf8('0x7')](),controller[_0xfcf8('0x8')]);router['get']('/describe',auth[_0xfcf8('0x7')](),controller[_0xfcf8('0x9')]);router[_0xfcf8('0xa')](_0xfcf8('0xb'),auth[_0xfcf8('0x7')](),controller[_0xfcf8('0xc')]);router[_0xfcf8('0xd')]('/',auth['isAuthenticated'](),controller['create']);router[_0xfcf8('0xe')](_0xfcf8('0xb'),auth['isAuthenticated'](),controller[_0xfcf8('0xf')]);router[_0xfcf8('0x10')]('/:id',auth['isAuthenticated'](),controller[_0xfcf8('0x11')]);module[_0xfcf8('0x12')]=router; \ No newline at end of file +var _0x4dd2=['get','isAuthenticated','/describe','describe','/:id','show','post','create','put','update','delete','destroy','exports','util','path','connect-timeout','Router','../../components/interaction/service','./userProfileResource.controller'];(function(_0x4404ff,_0x13d7a9){var _0x5e7b19=function(_0x13847a){while(--_0x13847a){_0x4404ff['push'](_0x4404ff['shift']());}};_0x5e7b19(++_0x13d7a9);}(_0x4dd2,0xf1));var _0x24dd=function(_0x40eec9,_0x817a67){_0x40eec9=_0x40eec9-0x0;var _0xfee890=_0x4dd2[_0x40eec9];return _0xfee890;};'use strict';var multer=require('multer');var util=require(_0x24dd('0x0'));var path=require(_0x24dd('0x1'));var timeout=require(_0x24dd('0x2'));var express=require('express');var router=express[_0x24dd('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0x24dd('0x4'));var config=require('../../config/environment');var controller=require(_0x24dd('0x5'));router[_0x24dd('0x6')]('/',auth[_0x24dd('0x7')](),controller['index']);router['get'](_0x24dd('0x8'),auth[_0x24dd('0x7')](),controller[_0x24dd('0x9')]);router[_0x24dd('0x6')](_0x24dd('0xa'),auth['isAuthenticated'](),controller[_0x24dd('0xb')]);router[_0x24dd('0xc')]('/',auth[_0x24dd('0x7')](),controller[_0x24dd('0xd')]);router[_0x24dd('0xe')]('/:id',auth[_0x24dd('0x7')](),controller[_0x24dd('0xf')]);router[_0x24dd('0x10')](_0x24dd('0xa'),auth[_0x24dd('0x7')](),controller[_0x24dd('0x11')]);module[_0x24dd('0x12')]=router; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.attributes.js b/server/api/userProfileResource/userProfileResource.attributes.js index 5277ce9..64989a9 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 _0x7b2d=['STRING','sequelize','exports'];(function(_0x4c9915,_0x406b1a){var _0x473218=function(_0x2536ba){while(--_0x2536ba){_0x4c9915['push'](_0x4c9915['shift']());}};_0x473218(++_0x406b1a);}(_0x7b2d,0x190));var _0xd7b2=function(_0x178e48,_0x3c9509){_0x178e48=_0x178e48-0x0;var _0x440d7e=_0x7b2d[_0x178e48];return _0x440d7e;};'use strict';var Sequelize=require(_0xd7b2('0x0'));module[_0xd7b2('0x1')]={'name':{'type':Sequelize[_0xd7b2('0x2')],'allowNull':![]},'resourceId':{'type':Sequelize['INTEGER'],'allowNull':![]},'type':{'type':Sequelize[_0xd7b2('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0xaee4=['INTEGER','STRING','sequelize','exports'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xaee4,0x1de));var _0x4aee=function(_0x163119,_0x9c69b4){_0x163119=_0x163119-0x0;var _0x234d1a=_0xaee4[_0x163119];return _0x234d1a;};'use strict';var Sequelize=require(_0x4aee('0x0'));module[_0x4aee('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'resourceId':{'type':Sequelize[_0x4aee('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x4aee('0x3')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.controller.js b/server/api/userProfileResource/userProfileResource.controller.js index 7bb3616..9176c6b 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 _0xe015=['key','query','filters','intersection','model','fields','attributes','length','hasOwnProperty','order','sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','params','rawAttributes','keys','find','catch','create','body','update','describe','html-pdf','eml-format','rimraf','request-promise','bluebird','mustache','util','path','to-csv','ejs','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','end','offset','limit','Content-Range','json','apply','reject','save','then','destroy','error','stack','name','send','index','map','UserProfileResource'];(function(_0x226836,_0x4b0ee3){var _0x41ad05=function(_0xdef3db){while(--_0xdef3db){_0x226836['push'](_0x226836['shift']());}};_0x41ad05(++_0x4b0ee3);}(_0xe015,0x13b));var _0x5e01=function(_0x27af45,_0x1b57aa){_0x27af45=_0x27af45-0x0;var _0x18df21=_0xe015[_0x27af45];return _0x18df21;};'use strict';var pdf=require(_0x5e01('0x0'));var emlformat=require(_0x5e01('0x1'));var rimraf=require(_0x5e01('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x5e01('0x3'));var moment=require('moment');var BPromise=require(_0x5e01('0x4'));var Mustache=require(_0x5e01('0x5'));var util=require(_0x5e01('0x6'));var path=require(_0x5e01('0x7'));var sox=require('sox');var csv=require(_0x5e01('0x8'));var ejs=require(_0x5e01('0x9'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0x5e01('0xa'));var jsforce=require(_0x5e01('0xb'));var deskjs=require(_0x5e01('0xc'));var toCsv=require(_0x5e01('0x8'));var querystring=require(_0x5e01('0xd'));var Papa=require(_0x5e01('0xe'));var Redis=require('ioredis');var authService=require(_0x5e01('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x5e01('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x5e01('0x11'))(_0x5e01('0x12'));var utils=require('../../config/utils');var config=require(_0x5e01('0x13'));var db=require(_0x5e01('0x14'))['db'];function respondWithStatusCode(_0x4a4f01,_0x560ae2){_0x560ae2=_0x560ae2||0xcc;return function(_0x3d0b04){if(_0x3d0b04){return _0x4a4f01[_0x5e01('0x15')](_0x560ae2);}return _0x4a4f01[_0x5e01('0x16')](_0x560ae2)[_0x5e01('0x17')]();};}function respondWithResult(_0x3ecf64,_0x16bc8f){_0x16bc8f=_0x16bc8f||0xc8;return function(_0x4bd426){if(_0x4bd426){return _0x3ecf64[_0x5e01('0x16')](_0x16bc8f)['json'](_0x4bd426);}};}function respondWithFilteredResult(_0x4ab9b2,_0x1df2e0){return function(_0x2dd70c){if(_0x2dd70c){var _0x494b8a=_0x2dd70c['count'],_0x27c6e7=_0x1df2e0[_0x5e01('0x18')],_0x5a532d=_0x1df2e0['offset']+_0x1df2e0[_0x5e01('0x19')],_0x4fb33e;if(_0x5a532d>=_0x494b8a){_0x5a532d=_0x494b8a;_0x4fb33e=0xc8;}else{_0x4fb33e=0xce;}_0x4ab9b2['status'](_0x4fb33e);return _0x4ab9b2['set'](_0x5e01('0x1a'),_0x27c6e7+'-'+_0x5a532d+'/'+_0x494b8a)[_0x5e01('0x1b')](_0x2dd70c);}return null;};}function patchUpdates(_0x4fa1c7){return function(_0xce3f3f){try{jsonpatch[_0x5e01('0x1c')](_0xce3f3f,_0x4fa1c7,!![]);}catch(_0x36b4a7){return BPromise[_0x5e01('0x1d')](_0x36b4a7);}return _0xce3f3f[_0x5e01('0x1e')]();};}function saveUpdates(_0x35eb4e,_0x173410){return function(_0x153eb1){if(_0x153eb1){return _0x153eb1['update'](_0x35eb4e)[_0x5e01('0x1f')](function(_0x208586){return _0x208586;});}return null;};}function removeEntity(_0x4b28ca,_0xf6fe3f){return function(_0x306cff){if(_0x306cff){return _0x306cff[_0x5e01('0x20')]()[_0x5e01('0x1f')](function(){_0x4b28ca[_0x5e01('0x16')](0xcc)[_0x5e01('0x17')]();});}};}function handleEntityNotFound(_0x5efff9,_0x329315){return function(_0x720922){if(!_0x720922){_0x5efff9[_0x5e01('0x15')](0x194);}return _0x720922;};}function handleError(_0x52ccd0,_0x514ade){_0x514ade=_0x514ade||0x1f4;return function(_0x557f06){logger[_0x5e01('0x21')](_0x557f06[_0x5e01('0x22')]);if(_0x557f06['name']){delete _0x557f06[_0x5e01('0x23')];}_0x52ccd0[_0x5e01('0x16')](_0x514ade)[_0x5e01('0x24')](_0x557f06);};}exports[_0x5e01('0x25')]=function(_0x58dc6f,_0x4d0ebe){var _0xca92be={},_0x5f01dd={},_0x14b9f5={'count':0x0,'rows':[]};var _0x1332bb=_[_0x5e01('0x26')](db[_0x5e01('0x27')]['rawAttributes'],function(_0x531f0a){return{'name':_0x531f0a['fieldName'],'type':_0x531f0a['type'][_0x5e01('0x28')]};});_0x5f01dd['model']=_[_0x5e01('0x26')](_0x1332bb,_0x5e01('0x23'));_0x5f01dd[_0x5e01('0x29')]=_['keys'](_0x58dc6f[_0x5e01('0x29')]);_0x5f01dd[_0x5e01('0x2a')]=_[_0x5e01('0x2b')](_0x5f01dd[_0x5e01('0x2c')],_0x5f01dd['query']);_0xca92be['attributes']=_[_0x5e01('0x2b')](_0x5f01dd[_0x5e01('0x2c')],qs[_0x5e01('0x2d')](_0x58dc6f[_0x5e01('0x29')][_0x5e01('0x2d')]));_0xca92be[_0x5e01('0x2e')]=_0xca92be[_0x5e01('0x2e')][_0x5e01('0x2f')]?_0xca92be[_0x5e01('0x2e')]:_0x5f01dd[_0x5e01('0x2c')];if(!_0x58dc6f[_0x5e01('0x29')][_0x5e01('0x30')]('nolimit')){_0xca92be[_0x5e01('0x19')]=qs[_0x5e01('0x19')](_0x58dc6f[_0x5e01('0x29')]['limit']);_0xca92be[_0x5e01('0x18')]=qs[_0x5e01('0x18')](_0x58dc6f['query'][_0x5e01('0x18')]);}_0xca92be[_0x5e01('0x31')]=qs[_0x5e01('0x32')](_0x58dc6f['query'][_0x5e01('0x32')]);_0xca92be[_0x5e01('0x33')]=qs[_0x5e01('0x2a')](_[_0x5e01('0x34')](_0x58dc6f[_0x5e01('0x29')],_0x5f01dd[_0x5e01('0x2a')]),_0x1332bb);if(_0x58dc6f[_0x5e01('0x29')][_0x5e01('0x35')]){_0xca92be[_0x5e01('0x33')]=_[_0x5e01('0x36')](_0xca92be[_0x5e01('0x33')],{'$or':_[_0x5e01('0x26')](_0x1332bb,function(_0x20f3c6){if(_0x20f3c6[_0x5e01('0x37')]!==_0x5e01('0x38')){var _0x578d61={};_0x578d61[_0x20f3c6[_0x5e01('0x23')]]={'$like':'%'+_0x58dc6f['query']['filter']+'%'};return _0x578d61;}})});}_0xca92be=_[_0x5e01('0x36')]({},_0xca92be,_0x58dc6f[_0x5e01('0x39')]);var _0x120b7b={'where':_0xca92be[_0x5e01('0x33')]};return db[_0x5e01('0x27')]['count'](_0x120b7b)[_0x5e01('0x1f')](function(_0x1770e5){_0x14b9f5['count']=_0x1770e5;if(_0x58dc6f[_0x5e01('0x29')][_0x5e01('0x3a')]){_0xca92be[_0x5e01('0x3b')]=[{'all':!![]}];}return db['UserProfileResource'][_0x5e01('0x3c')](_0xca92be);})[_0x5e01('0x1f')](function(_0x503c8c){_0x14b9f5[_0x5e01('0x3d')]=_0x503c8c;return _0x14b9f5;})[_0x5e01('0x1f')](respondWithFilteredResult(_0x4d0ebe,_0xca92be))['catch'](handleError(_0x4d0ebe,null));};exports['show']=function(_0xce5f1b,_0x4fe865){var _0x2d7423={'raw':![],'where':{'id':_0xce5f1b[_0x5e01('0x3e')]['id']}},_0x1b1d35={};_0x1b1d35[_0x5e01('0x2c')]=_['keys'](db[_0x5e01('0x27')][_0x5e01('0x3f')]);_0x1b1d35[_0x5e01('0x29')]=_[_0x5e01('0x40')](_0xce5f1b[_0x5e01('0x29')]);_0x1b1d35[_0x5e01('0x2a')]=_[_0x5e01('0x2b')](_0x1b1d35['model'],_0x1b1d35[_0x5e01('0x29')]);_0x2d7423[_0x5e01('0x2e')]=_[_0x5e01('0x2b')](_0x1b1d35[_0x5e01('0x2c')],qs[_0x5e01('0x2d')](_0xce5f1b['query'][_0x5e01('0x2d')]));_0x2d7423[_0x5e01('0x2e')]=_0x2d7423[_0x5e01('0x2e')][_0x5e01('0x2f')]?_0x2d7423[_0x5e01('0x2e')]:_0x1b1d35[_0x5e01('0x2c')];if(_0xce5f1b[_0x5e01('0x29')]['includeAll']){_0x2d7423[_0x5e01('0x3b')]=[{'all':!![]}];}_0x2d7423=_['merge']({},_0x2d7423,_0xce5f1b[_0x5e01('0x39')]);return db[_0x5e01('0x27')][_0x5e01('0x41')](_0x2d7423)[_0x5e01('0x1f')](handleEntityNotFound(_0x4fe865,null))[_0x5e01('0x1f')](respondWithResult(_0x4fe865,null))[_0x5e01('0x42')](handleError(_0x4fe865,null));};exports['create']=function(_0x24541a,_0x4a5f37){return db[_0x5e01('0x27')][_0x5e01('0x43')](_0x24541a[_0x5e01('0x44')],{})[_0x5e01('0x1f')](respondWithResult(_0x4a5f37,0xc9))[_0x5e01('0x42')](handleError(_0x4a5f37,null));};exports[_0x5e01('0x45')]=function(_0x555204,_0x5cf1e4){if(_0x555204[_0x5e01('0x44')]['id']){delete _0x555204[_0x5e01('0x44')]['id'];}return db[_0x5e01('0x27')][_0x5e01('0x41')]({'where':{'id':_0x555204[_0x5e01('0x3e')]['id']}})[_0x5e01('0x1f')](handleEntityNotFound(_0x5cf1e4,null))[_0x5e01('0x1f')](saveUpdates(_0x555204[_0x5e01('0x44')],null))[_0x5e01('0x1f')](respondWithResult(_0x5cf1e4,null))[_0x5e01('0x42')](handleError(_0x5cf1e4,null));};exports[_0x5e01('0x20')]=function(_0x5cd7ec,_0x470cec){return db[_0x5e01('0x27')][_0x5e01('0x41')]({'where':{'id':_0x5cd7ec['params']['id']}})[_0x5e01('0x1f')](handleEntityNotFound(_0x470cec,null))[_0x5e01('0x1f')](removeEntity(_0x470cec,null))[_0x5e01('0x42')](handleError(_0x470cec,null));};exports[_0x5e01('0x46')]=function(_0x3bb6a8,_0x538a39){return db[_0x5e01('0x27')]['describe']()[_0x5e01('0x1f')](respondWithResult(_0x538a39,null))[_0x5e01('0x42')](handleError(_0x538a39,null));}; \ No newline at end of file +var _0x3baf=['VIRTUAL','options','count','findAll','rows','show','params','keys','includeAll','include','find','catch','create','body','destroy','describe','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','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','end','json','offset','limit','Content-Range','apply','reject','update','then','error','stack','send','UserProfileResource','rawAttributes','fieldName','type','name','query','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','filters','filter','merge','where'];(function(_0x1ad447,_0x5457ae){var _0x23afb7=function(_0x3a8442){while(--_0x3a8442){_0x1ad447['push'](_0x1ad447['shift']());}};_0x23afb7(++_0x5457ae);}(_0x3baf,0xf7));var _0xf3ba=function(_0x42152e,_0x509b93){_0x42152e=_0x42152e-0x0;var _0x57bb09=_0x3baf[_0x42152e];return _0x57bb09;};'use strict';var pdf=require(_0xf3ba('0x0'));var emlformat=require(_0xf3ba('0x1'));var rimraf=require(_0xf3ba('0x2'));var zipdir=require(_0xf3ba('0x3'));var jsonpatch=require(_0xf3ba('0x4'));var rp=require(_0xf3ba('0x5'));var moment=require(_0xf3ba('0x6'));var BPromise=require(_0xf3ba('0x7'));var Mustache=require(_0xf3ba('0x8'));var util=require(_0xf3ba('0x9'));var path=require(_0xf3ba('0xa'));var sox=require(_0xf3ba('0xb'));var csv=require(_0xf3ba('0xc'));var ejs=require(_0xf3ba('0xd'));var fs=require('fs');var _=require(_0xf3ba('0xe'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xf3ba('0xf'));var toCsv=require('to-csv');var querystring=require(_0xf3ba('0x10'));var Papa=require(_0xf3ba('0x11'));var Redis=require(_0xf3ba('0x12'));var authService=require(_0xf3ba('0x13'));var qs=require(_0xf3ba('0x14'));var as=require(_0xf3ba('0x15'));var hardwareService=require(_0xf3ba('0x16'));var logger=require(_0xf3ba('0x17'))(_0xf3ba('0x18'));var utils=require(_0xf3ba('0x19'));var config=require(_0xf3ba('0x1a'));var db=require(_0xf3ba('0x1b'))['db'];function respondWithStatusCode(_0x46c2cf,_0x85939e){_0x85939e=_0x85939e||0xcc;return function(_0x26cefe){if(_0x26cefe){return _0x46c2cf[_0xf3ba('0x1c')](_0x85939e);}return _0x46c2cf[_0xf3ba('0x1d')](_0x85939e)[_0xf3ba('0x1e')]();};}function respondWithResult(_0x505b8d,_0x327675){_0x327675=_0x327675||0xc8;return function(_0x56816b){if(_0x56816b){return _0x505b8d[_0xf3ba('0x1d')](_0x327675)[_0xf3ba('0x1f')](_0x56816b);}};}function respondWithFilteredResult(_0x4717be,_0x1e2969){return function(_0x235c8a){if(_0x235c8a){var _0x53f848=_0x235c8a['count'],_0x301856=_0x1e2969[_0xf3ba('0x20')],_0x29e45b=_0x1e2969[_0xf3ba('0x20')]+_0x1e2969[_0xf3ba('0x21')],_0x13d899;if(_0x29e45b>=_0x53f848){_0x29e45b=_0x53f848;_0x13d899=0xc8;}else{_0x13d899=0xce;}_0x4717be[_0xf3ba('0x1d')](_0x13d899);return _0x4717be['set'](_0xf3ba('0x22'),_0x301856+'-'+_0x29e45b+'/'+_0x53f848)[_0xf3ba('0x1f')](_0x235c8a);}return null;};}function patchUpdates(_0x4e601c){return function(_0x479d65){try{jsonpatch[_0xf3ba('0x23')](_0x479d65,_0x4e601c,!![]);}catch(_0x2bd5b8){return BPromise[_0xf3ba('0x24')](_0x2bd5b8);}return _0x479d65['save']();};}function saveUpdates(_0x375bcf,_0x327723){return function(_0x35d6d4){if(_0x35d6d4){return _0x35d6d4[_0xf3ba('0x25')](_0x375bcf)[_0xf3ba('0x26')](function(_0x3480cb){return _0x3480cb;});}return null;};}function removeEntity(_0x168961,_0x4caf74){return function(_0x4e94a7){if(_0x4e94a7){return _0x4e94a7['destroy']()[_0xf3ba('0x26')](function(){_0x168961[_0xf3ba('0x1d')](0xcc)[_0xf3ba('0x1e')]();});}};}function handleEntityNotFound(_0x3b6404,_0x2cc01a){return function(_0x545ee1){if(!_0x545ee1){_0x3b6404['sendStatus'](0x194);}return _0x545ee1;};}function handleError(_0x37fdda,_0xd6c2da){_0xd6c2da=_0xd6c2da||0x1f4;return function(_0x5410a2){logger[_0xf3ba('0x27')](_0x5410a2[_0xf3ba('0x28')]);if(_0x5410a2['name']){delete _0x5410a2['name'];}_0x37fdda[_0xf3ba('0x1d')](_0xd6c2da)[_0xf3ba('0x29')](_0x5410a2);};}exports['index']=function(_0x18a4fb,_0x318817){var _0x15ac44={},_0x5a880e={},_0x29ed57={'count':0x0,'rows':[]};var _0x4e1708=_['map'](db[_0xf3ba('0x2a')][_0xf3ba('0x2b')],function(_0x5b4e0d){return{'name':_0x5b4e0d[_0xf3ba('0x2c')],'type':_0x5b4e0d[_0xf3ba('0x2d')]['key']};});_0x5a880e['model']=_['map'](_0x4e1708,_0xf3ba('0x2e'));_0x5a880e[_0xf3ba('0x2f')]=_['keys'](_0x18a4fb[_0xf3ba('0x2f')]);_0x5a880e['filters']=_['intersection'](_0x5a880e[_0xf3ba('0x30')],_0x5a880e[_0xf3ba('0x2f')]);_0x15ac44[_0xf3ba('0x31')]=_[_0xf3ba('0x32')](_0x5a880e[_0xf3ba('0x30')],qs[_0xf3ba('0x33')](_0x18a4fb['query'][_0xf3ba('0x33')]));_0x15ac44['attributes']=_0x15ac44[_0xf3ba('0x31')][_0xf3ba('0x34')]?_0x15ac44['attributes']:_0x5a880e[_0xf3ba('0x30')];if(!_0x18a4fb[_0xf3ba('0x2f')][_0xf3ba('0x35')](_0xf3ba('0x36'))){_0x15ac44['limit']=qs[_0xf3ba('0x21')](_0x18a4fb['query']['limit']);_0x15ac44['offset']=qs[_0xf3ba('0x20')](_0x18a4fb[_0xf3ba('0x2f')][_0xf3ba('0x20')]);}_0x15ac44[_0xf3ba('0x37')]=qs[_0xf3ba('0x38')](_0x18a4fb['query'][_0xf3ba('0x38')]);_0x15ac44['where']=qs[_0xf3ba('0x39')](_['pick'](_0x18a4fb[_0xf3ba('0x2f')],_0x5a880e[_0xf3ba('0x39')]),_0x4e1708);if(_0x18a4fb[_0xf3ba('0x2f')][_0xf3ba('0x3a')]){_0x15ac44['where']=_[_0xf3ba('0x3b')](_0x15ac44[_0xf3ba('0x3c')],{'$or':_['map'](_0x4e1708,function(_0x3d844d){if(_0x3d844d[_0xf3ba('0x2d')]!==_0xf3ba('0x3d')){var _0x498570={};_0x498570[_0x3d844d[_0xf3ba('0x2e')]]={'$like':'%'+_0x18a4fb[_0xf3ba('0x2f')][_0xf3ba('0x3a')]+'%'};return _0x498570;}})});}_0x15ac44=_['merge']({},_0x15ac44,_0x18a4fb[_0xf3ba('0x3e')]);var _0x527092={'where':_0x15ac44[_0xf3ba('0x3c')]};return db['UserProfileResource'][_0xf3ba('0x3f')](_0x527092)[_0xf3ba('0x26')](function(_0x1251b1){_0x29ed57[_0xf3ba('0x3f')]=_0x1251b1;if(_0x18a4fb[_0xf3ba('0x2f')]['includeAll']){_0x15ac44['include']=[{'all':!![]}];}return db[_0xf3ba('0x2a')][_0xf3ba('0x40')](_0x15ac44);})[_0xf3ba('0x26')](function(_0x433752){_0x29ed57[_0xf3ba('0x41')]=_0x433752;return _0x29ed57;})[_0xf3ba('0x26')](respondWithFilteredResult(_0x318817,_0x15ac44))['catch'](handleError(_0x318817,null));};exports[_0xf3ba('0x42')]=function(_0x4b9c9e,_0x42b805){var _0x239e2a={'raw':![],'where':{'id':_0x4b9c9e[_0xf3ba('0x43')]['id']}},_0x2328d5={};_0x2328d5[_0xf3ba('0x30')]=_[_0xf3ba('0x44')](db[_0xf3ba('0x2a')][_0xf3ba('0x2b')]);_0x2328d5['query']=_[_0xf3ba('0x44')](_0x4b9c9e[_0xf3ba('0x2f')]);_0x2328d5[_0xf3ba('0x39')]=_[_0xf3ba('0x32')](_0x2328d5[_0xf3ba('0x30')],_0x2328d5[_0xf3ba('0x2f')]);_0x239e2a[_0xf3ba('0x31')]=_['intersection'](_0x2328d5[_0xf3ba('0x30')],qs[_0xf3ba('0x33')](_0x4b9c9e['query'][_0xf3ba('0x33')]));_0x239e2a[_0xf3ba('0x31')]=_0x239e2a[_0xf3ba('0x31')][_0xf3ba('0x34')]?_0x239e2a[_0xf3ba('0x31')]:_0x2328d5[_0xf3ba('0x30')];if(_0x4b9c9e[_0xf3ba('0x2f')][_0xf3ba('0x45')]){_0x239e2a[_0xf3ba('0x46')]=[{'all':!![]}];}_0x239e2a=_[_0xf3ba('0x3b')]({},_0x239e2a,_0x4b9c9e[_0xf3ba('0x3e')]);return db[_0xf3ba('0x2a')][_0xf3ba('0x47')](_0x239e2a)[_0xf3ba('0x26')](handleEntityNotFound(_0x42b805,null))[_0xf3ba('0x26')](respondWithResult(_0x42b805,null))[_0xf3ba('0x48')](handleError(_0x42b805,null));};exports[_0xf3ba('0x49')]=function(_0x3afc3e,_0x4f251b){return db[_0xf3ba('0x2a')][_0xf3ba('0x49')](_0x3afc3e['body'],{})[_0xf3ba('0x26')](respondWithResult(_0x4f251b,0xc9))[_0xf3ba('0x48')](handleError(_0x4f251b,null));};exports[_0xf3ba('0x25')]=function(_0x36f476,_0x52ef61){if(_0x36f476['body']['id']){delete _0x36f476[_0xf3ba('0x4a')]['id'];}return db[_0xf3ba('0x2a')][_0xf3ba('0x47')]({'where':{'id':_0x36f476[_0xf3ba('0x43')]['id']}})['then'](handleEntityNotFound(_0x52ef61,null))[_0xf3ba('0x26')](saveUpdates(_0x36f476[_0xf3ba('0x4a')],null))[_0xf3ba('0x26')](respondWithResult(_0x52ef61,null))['catch'](handleError(_0x52ef61,null));};exports[_0xf3ba('0x4b')]=function(_0x425304,_0x3dd531){return db[_0xf3ba('0x2a')][_0xf3ba('0x47')]({'where':{'id':_0x425304[_0xf3ba('0x43')]['id']}})[_0xf3ba('0x26')](handleEntityNotFound(_0x3dd531,null))[_0xf3ba('0x26')](removeEntity(_0x3dd531,null))[_0xf3ba('0x48')](handleError(_0x3dd531,null));};exports[_0xf3ba('0x4c')]=function(_0x534426,_0x5a30f9){return db[_0xf3ba('0x2a')][_0xf3ba('0x4c')]()[_0xf3ba('0x26')](respondWithResult(_0x5a30f9,null))['catch'](handleError(_0x5a30f9,null));}; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.model.js b/server/api/userProfileResource/userProfileResource.model.js index 92007f5..01fa552 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 _0xb43b=['lodash','util','api','moment','bluebird','path','rimraf','../../config/environment','./userProfileResource.attributes','UserProfileResource','user_profile_has_resources','compositeIndex','resourceId','sectionId'];(function(_0x216cab,_0x1d8048){var _0x1f7ce7=function(_0x3c585b){while(--_0x3c585b){_0x216cab['push'](_0x216cab['shift']());}};_0x1f7ce7(++_0x1d8048);}(_0xb43b,0x1b2));var _0xbb43=function(_0x5e553c,_0x3b5b19){_0x5e553c=_0x5e553c-0x0;var _0x3da209=_0xb43b[_0x5e553c];return _0x3da209;};'use strict';var _=require(_0xbb43('0x0'));var util=require(_0xbb43('0x1'));var logger=require('../../config/logger')(_0xbb43('0x2'));var moment=require(_0xbb43('0x3'));var BPromise=require(_0xbb43('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xbb43('0x5'));var rimraf=require(_0xbb43('0x6'));var config=require(_0xbb43('0x7'));var attributes=require(_0xbb43('0x8'));module['exports']=function(_0x491fb9,_0x378df5){return _0x491fb9['define'](_0xbb43('0x9'),attributes,{'tableName':_0xbb43('0xa'),'paranoid':![],'indexes':[{'name':_0xbb43('0xb'),'fields':[_0xbb43('0xc'),_0xbb43('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x9bde=['util','api','bluebird','request-promise','path','rimraf','../../config/environment','./userProfileResource.attributes','exports','define','UserProfileResource','user_profile_has_resources','compositeIndex','resourceId','sectionId'];(function(_0x154584,_0x421e12){var _0x969074=function(_0x17303b){while(--_0x17303b){_0x154584['push'](_0x154584['shift']());}};_0x969074(++_0x421e12);}(_0x9bde,0xe1));var _0xe9bd=function(_0x36ea98,_0x2cf23d){_0x36ea98=_0x36ea98-0x0;var _0x4d0ec7=_0x9bde[_0x36ea98];return _0x4d0ec7;};'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':[{'name':_0xe9bd('0xc'),'fields':[_0xe9bd('0xd'),_0xe9bd('0xe')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.rpc.js b/server/api/userProfileResource/userProfileResource.rpc.js index 5f2b530..567ce98 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 _0x4156=['message','info','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','http','request','UserProfileResource,\x20%s,\x20%s','request\x20sent','debug','UserProfileResource,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x33575a,_0x36431e){var _0x134235=function(_0x2f736f){while(--_0x2f736f){_0x33575a['push'](_0x33575a['shift']());}};_0x134235(++_0x36431e);}(_0x4156,0x122));var _0x6415=function(_0x335fa2,_0x4c6dfb){_0x335fa2=_0x335fa2-0x0;var _0x4e1060=_0x4156[_0x335fa2];return _0x4e1060;};'use strict';var _=require(_0x6415('0x0'));var util=require(_0x6415('0x1'));var moment=require(_0x6415('0x2'));var BPromise=require(_0x6415('0x3'));var rs=require(_0x6415('0x4'));var fs=require('fs');var Redis=require(_0x6415('0x5'));var db=require(_0x6415('0x6'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x6415('0x7'));var config=require(_0x6415('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0x6415('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2b5157,_0x30b6be,_0x58fc0c){return new BPromise(function(_0x15af40,_0x11a61c){return client[_0x6415('0xa')](_0x2b5157,_0x58fc0c)['then'](function(_0x5203bd){logger['info'](_0x6415('0xb'),_0x30b6be,_0x6415('0xc'));logger[_0x6415('0xd')](_0x6415('0xe'),_0x30b6be,_0x6415('0xc'),JSON[_0x6415('0xf')](_0x5203bd));if(_0x5203bd['error']){if(_0x5203bd[_0x6415('0x10')][_0x6415('0x11')]===0x1f4){logger[_0x6415('0x10')](_0x6415('0xb'),_0x30b6be,_0x5203bd[_0x6415('0x10')][_0x6415('0x12')]);return _0x11a61c(_0x5203bd[_0x6415('0x10')]['message']);}logger[_0x6415('0x10')]('UserProfileResource,\x20%s,\x20%s',_0x30b6be,_0x5203bd[_0x6415('0x10')][_0x6415('0x12')]);return _0x15af40(_0x5203bd[_0x6415('0x10')][_0x6415('0x12')]);}else{logger[_0x6415('0x13')](_0x6415('0xb'),_0x30b6be,_0x6415('0xc'));_0x15af40(_0x5203bd[_0x6415('0x14')][_0x6415('0x12')]);}})[_0x6415('0x15')](function(_0x306557){logger[_0x6415('0x10')](_0x6415('0xb'),_0x30b6be,_0x306557);_0x11a61c(_0x306557);});});} \ No newline at end of file +var _0x3c22=['message','result','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','info','UserProfileResource,\x20%s,\x20%s','request\x20sent','debug','UserProfileResource,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x15667d,_0x17a7f7){var _0x3a61bc=function(_0x58c88b){while(--_0x58c88b){_0x15667d['push'](_0x15667d['shift']());}};_0x3a61bc(++_0x17a7f7);}(_0x3c22,0x17c));var _0x23c2=function(_0x2b616b,_0x88aa3d){_0x2b616b=_0x2b616b-0x0;var _0x381ce6=_0x3c22[_0x2b616b];return _0x381ce6;};'use strict';var _=require(_0x23c2('0x0'));var util=require(_0x23c2('0x1'));var moment=require('moment');var BPromise=require(_0x23c2('0x2'));var rs=require(_0x23c2('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x23c2('0x4'))['db'];var utils=require(_0x23c2('0x5'));var logger=require(_0x23c2('0x6'))(_0x23c2('0x7'));var config=require('../../config/environment');var jayson=require(_0x23c2('0x8'));var client=jayson[_0x23c2('0x9')][_0x23c2('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x28ce61,_0x19ef7d,_0x3fd18d){return new BPromise(function(_0x11503c,_0x3e5ec8){return client['request'](_0x28ce61,_0x3fd18d)['then'](function(_0x3d6c20){logger[_0x23c2('0xb')](_0x23c2('0xc'),_0x19ef7d,_0x23c2('0xd'));logger[_0x23c2('0xe')](_0x23c2('0xf'),_0x19ef7d,_0x23c2('0xd'),JSON[_0x23c2('0x10')](_0x3d6c20));if(_0x3d6c20[_0x23c2('0x11')]){if(_0x3d6c20[_0x23c2('0x11')][_0x23c2('0x12')]===0x1f4){logger[_0x23c2('0x11')]('UserProfileResource,\x20%s,\x20%s',_0x19ef7d,_0x3d6c20[_0x23c2('0x11')][_0x23c2('0x13')]);return _0x3e5ec8(_0x3d6c20[_0x23c2('0x11')][_0x23c2('0x13')]);}logger[_0x23c2('0x11')](_0x23c2('0xc'),_0x19ef7d,_0x3d6c20['error'][_0x23c2('0x13')]);return _0x11503c(_0x3d6c20[_0x23c2('0x11')]['message']);}else{logger['info'](_0x23c2('0xc'),_0x19ef7d,_0x23c2('0xd'));_0x11503c(_0x3d6c20[_0x23c2('0x14')][_0x23c2('0x13')]);}})['catch'](function(_0x5e6647){logger['error'](_0x23c2('0xc'),_0x19ef7d,_0x5e6647);_0x3e5ec8(_0x5e6647);});});} \ No newline at end of file diff --git a/server/api/userProfileSection/index.js b/server/api/userProfileSection/index.js index 5cd8fc3..9bbfbd4 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 _0x5f44=['isAuthenticated','index','/describe','describe','/:id','show','post','create','put','update','delete','exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./userProfileSection.controller','get'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x5f44,0x1c4));var _0x45f4=function(_0x44ade0,_0x1996e2){_0x44ade0=_0x44ade0-0x0;var _0x1fba3c=_0x5f44[_0x44ade0];return _0x1fba3c;};'use strict';var multer=require(_0x45f4('0x0'));var util=require(_0x45f4('0x1'));var path=require('path');var timeout=require(_0x45f4('0x2'));var express=require(_0x45f4('0x3'));var router=express[_0x45f4('0x4')]();var auth=require(_0x45f4('0x5'));var interaction=require(_0x45f4('0x6'));var config=require(_0x45f4('0x7'));var controller=require(_0x45f4('0x8'));router[_0x45f4('0x9')]('/',auth[_0x45f4('0xa')](),controller[_0x45f4('0xb')]);router[_0x45f4('0x9')](_0x45f4('0xc'),auth['isAuthenticated'](),controller[_0x45f4('0xd')]);router[_0x45f4('0x9')](_0x45f4('0xe'),auth[_0x45f4('0xa')](),controller[_0x45f4('0xf')]);router[_0x45f4('0x10')]('/',auth['isAuthenticated'](),controller[_0x45f4('0x11')]);router[_0x45f4('0x12')]('/:id',auth[_0x45f4('0xa')](),controller[_0x45f4('0x13')]);router[_0x45f4('0x14')](_0x45f4('0xe'),auth['isAuthenticated'](),controller['destroy']);module[_0x45f4('0x15')]=router; \ No newline at end of file +var _0xbaf4=['create','put','update','delete','/:id','destroy','exports','util','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./userProfileSection.controller','get','isAuthenticated','index','/describe','describe','show','post'];(function(_0x527481,_0x4037d8){var _0x23ee32=function(_0x296155){while(--_0x296155){_0x527481['push'](_0x527481['shift']());}};_0x23ee32(++_0x4037d8);}(_0xbaf4,0xc4));var _0x4baf=function(_0x3a78fc,_0x5f4e8f){_0x3a78fc=_0x3a78fc-0x0;var _0x531f5f=_0xbaf4[_0x3a78fc];return _0x531f5f;};'use strict';var multer=require('multer');var util=require(_0x4baf('0x0'));var path=require('path');var timeout=require(_0x4baf('0x1'));var express=require(_0x4baf('0x2'));var router=express[_0x4baf('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0x4baf('0x4'));var config=require(_0x4baf('0x5'));var controller=require(_0x4baf('0x6'));router[_0x4baf('0x7')]('/',auth[_0x4baf('0x8')](),controller[_0x4baf('0x9')]);router[_0x4baf('0x7')](_0x4baf('0xa'),auth[_0x4baf('0x8')](),controller[_0x4baf('0xb')]);router['get']('/:id',auth[_0x4baf('0x8')](),controller[_0x4baf('0xc')]);router[_0x4baf('0xd')]('/',auth[_0x4baf('0x8')](),controller[_0x4baf('0xe')]);router[_0x4baf('0xf')]('/:id',auth[_0x4baf('0x8')](),controller[_0x4baf('0x10')]);router[_0x4baf('0x11')](_0x4baf('0x12'),auth['isAuthenticated'](),controller[_0x4baf('0x13')]);module[_0x4baf('0x14')]=router; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.attributes.js b/server/api/userProfileSection/userProfileSection.attributes.js index b7923b5..e49a9d6 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 _0x865d=['BOOLEAN','setDataValue','crudPermissions','join','split','sequelize','exports','STRING','INTEGER'];(function(_0x1030ce,_0xbe3f74){var _0x3367fd=function(_0x387153){while(--_0x387153){_0x1030ce['push'](_0x1030ce['shift']());}};_0x3367fd(++_0xbe3f74);}(_0x865d,0x1d9));var _0xd865=function(_0x199572,_0x33e667){_0x199572=_0x199572-0x0;var _0x13cfa3=_0x865d[_0x199572];return _0x13cfa3;};'use strict';var Sequelize=require(_0xd865('0x0'));module[_0xd865('0x1')]={'name':{'type':Sequelize[_0xd865('0x2')],'allowNull':![]},'category':{'type':Sequelize[_0xd865('0x2')],'allowNull':![]},'sectionId':{'type':Sequelize[_0xd865('0x3')],'allowNull':![]},'enabled':{'type':Sequelize[_0xd865('0x4')],'defaultValue':null},'autoAssociation':{'type':Sequelize[_0xd865('0x4')],'defaultValue':null},'crudPermissions':{'type':Sequelize[_0xd865('0x2')],'set':function(_0x5dfa34){this[_0xd865('0x5')](_0xd865('0x6'),_0x5dfa34?_0x5dfa34[_0xd865('0x7')](''):[]);},'get':function(){return this['getDataValue']('crudPermissions')?this['getDataValue'](_0xd865('0x6'))[_0xd865('0x8')](''):[];}}}; \ No newline at end of file +var _0x50b9=['sequelize','STRING','INTEGER','BOOLEAN','setDataValue','crudPermissions','join','getDataValue','split'];(function(_0x311c35,_0x534915){var _0x5cc50c=function(_0x3ad680){while(--_0x3ad680){_0x311c35['push'](_0x311c35['shift']());}};_0x5cc50c(++_0x534915);}(_0x50b9,0x171));var _0x950b=function(_0x6f114,_0x2ac0f9){_0x6f114=_0x6f114-0x0;var _0x40546b=_0x50b9[_0x6f114];return _0x40546b;};'use strict';var Sequelize=require(_0x950b('0x0'));module['exports']={'name':{'type':Sequelize[_0x950b('0x1')],'allowNull':![]},'category':{'type':Sequelize['STRING'],'allowNull':![]},'sectionId':{'type':Sequelize[_0x950b('0x2')],'allowNull':![]},'enabled':{'type':Sequelize[_0x950b('0x3')],'defaultValue':null},'autoAssociation':{'type':Sequelize[_0x950b('0x3')],'defaultValue':null},'crudPermissions':{'type':Sequelize[_0x950b('0x1')],'set':function(_0x237b83){this[_0x950b('0x4')](_0x950b('0x5'),_0x237b83?_0x237b83[_0x950b('0x6')](''):[]);},'get':function(){return this[_0x950b('0x7')]('crudPermissions')?this[_0x950b('0x7')](_0x950b('0x5'))[_0x950b('0x8')](''):[];}}}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.controller.js b/server/api/userProfileSection/userProfileSection.controller.js index d888f3d..a2b9757 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 _0x95f2=['VIRTUAL','includeAll','include','findAll','rows','catch','params','rawAttributes','options','find','create','body','describe','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','limit','apply','reject','save','update','then','destroy','stack','name','index','UserProfileSection','fieldName','key','model','map','query','keys','intersection','attributes','fields','length','nolimit','order','sort','filters','filter','merge','type'];(function(_0x42bdad,_0x12836c){var _0x122626=function(_0x2eb29c){while(--_0x2eb29c){_0x42bdad['push'](_0x42bdad['shift']());}};_0x122626(++_0x12836c);}(_0x95f2,0xdf));var _0x295f=function(_0x1589dd,_0x2b9d22){_0x1589dd=_0x1589dd-0x0;var _0x1bddd1=_0x95f2[_0x1589dd];return _0x1bddd1;};'use strict';var pdf=require(_0x295f('0x0'));var emlformat=require(_0x295f('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x295f('0x2'));var jsonpatch=require(_0x295f('0x3'));var rp=require(_0x295f('0x4'));var moment=require(_0x295f('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x295f('0x6'));var path=require(_0x295f('0x7'));var sox=require(_0x295f('0x8'));var csv=require(_0x295f('0x9'));var ejs=require(_0x295f('0xa'));var fs=require('fs');var _=require(_0x295f('0xb'));var squel=require(_0x295f('0xc'));var crypto=require(_0x295f('0xd'));var jsforce=require(_0x295f('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x295f('0xf'));var Papa=require('papaparse');var Redis=require(_0x295f('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x295f('0x11'));var as=require(_0x295f('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x295f('0x13'))(_0x295f('0x14'));var utils=require('../../config/utils');var config=require(_0x295f('0x15'));var db=require(_0x295f('0x16'))['db'];function respondWithStatusCode(_0x89f0c8,_0x11b4db){_0x11b4db=_0x11b4db||0xcc;return function(_0x4fdb61){if(_0x4fdb61){return _0x89f0c8[_0x295f('0x17')](_0x11b4db);}return _0x89f0c8[_0x295f('0x18')](_0x11b4db)[_0x295f('0x19')]();};}function respondWithResult(_0xc3f919,_0x2d8066){_0x2d8066=_0x2d8066||0xc8;return function(_0x25a813){if(_0x25a813){return _0xc3f919['status'](_0x2d8066)[_0x295f('0x1a')](_0x25a813);}};}function respondWithFilteredResult(_0x143f9b,_0x369edf){return function(_0x407e60){if(_0x407e60){var _0x1766dc=_0x407e60[_0x295f('0x1b')],_0x3701d4=_0x369edf[_0x295f('0x1c')],_0x26c12d=_0x369edf[_0x295f('0x1c')]+_0x369edf[_0x295f('0x1d')],_0x2e2d17;if(_0x26c12d>=_0x1766dc){_0x26c12d=_0x1766dc;_0x2e2d17=0xc8;}else{_0x2e2d17=0xce;}_0x143f9b[_0x295f('0x18')](_0x2e2d17);return _0x143f9b['set']('Content-Range',_0x3701d4+'-'+_0x26c12d+'/'+_0x1766dc)[_0x295f('0x1a')](_0x407e60);}return null;};}function patchUpdates(_0xf2114a){return function(_0x1dc94a){try{jsonpatch[_0x295f('0x1e')](_0x1dc94a,_0xf2114a,!![]);}catch(_0xd37370){return BPromise[_0x295f('0x1f')](_0xd37370);}return _0x1dc94a[_0x295f('0x20')]();};}function saveUpdates(_0x411bc4,_0x3b8d4d){return function(_0x1bb69a){if(_0x1bb69a){return _0x1bb69a[_0x295f('0x21')](_0x411bc4)[_0x295f('0x22')](function(_0x4c194d){return _0x4c194d;});}return null;};}function removeEntity(_0x270905,_0x1b5ca5){return function(_0x5b5d32){if(_0x5b5d32){return _0x5b5d32[_0x295f('0x23')]()['then'](function(){_0x270905[_0x295f('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1df335,_0x4789b3){return function(_0x4e687a){if(!_0x4e687a){_0x1df335[_0x295f('0x17')](0x194);}return _0x4e687a;};}function handleError(_0x463dbf,_0x19dfb7){_0x19dfb7=_0x19dfb7||0x1f4;return function(_0x3bff40){logger['error'](_0x3bff40[_0x295f('0x24')]);if(_0x3bff40[_0x295f('0x25')]){delete _0x3bff40[_0x295f('0x25')];}_0x463dbf[_0x295f('0x18')](_0x19dfb7)['send'](_0x3bff40);};}exports[_0x295f('0x26')]=function(_0x207981,_0x49835d){var _0x3c5f51={},_0x226991={},_0x1b6fbc={'count':0x0,'rows':[]};var _0x37b666=_['map'](db[_0x295f('0x27')]['rawAttributes'],function(_0x1a7d41){return{'name':_0x1a7d41[_0x295f('0x28')],'type':_0x1a7d41['type'][_0x295f('0x29')]};});_0x226991[_0x295f('0x2a')]=_[_0x295f('0x2b')](_0x37b666,_0x295f('0x25'));_0x226991[_0x295f('0x2c')]=_[_0x295f('0x2d')](_0x207981[_0x295f('0x2c')]);_0x226991['filters']=_[_0x295f('0x2e')](_0x226991[_0x295f('0x2a')],_0x226991['query']);_0x3c5f51[_0x295f('0x2f')]=_[_0x295f('0x2e')](_0x226991[_0x295f('0x2a')],qs[_0x295f('0x30')](_0x207981[_0x295f('0x2c')][_0x295f('0x30')]));_0x3c5f51[_0x295f('0x2f')]=_0x3c5f51['attributes'][_0x295f('0x31')]?_0x3c5f51[_0x295f('0x2f')]:_0x226991['model'];if(!_0x207981[_0x295f('0x2c')]['hasOwnProperty'](_0x295f('0x32'))){_0x3c5f51[_0x295f('0x1d')]=qs[_0x295f('0x1d')](_0x207981[_0x295f('0x2c')][_0x295f('0x1d')]);_0x3c5f51[_0x295f('0x1c')]=qs[_0x295f('0x1c')](_0x207981['query']['offset']);}_0x3c5f51[_0x295f('0x33')]=qs[_0x295f('0x34')](_0x207981[_0x295f('0x2c')][_0x295f('0x34')]);_0x3c5f51['where']=qs['filters'](_['pick'](_0x207981['query'],_0x226991[_0x295f('0x35')]),_0x37b666);if(_0x207981['query'][_0x295f('0x36')]){_0x3c5f51['where']=_[_0x295f('0x37')](_0x3c5f51['where'],{'$or':_[_0x295f('0x2b')](_0x37b666,function(_0x269035){if(_0x269035[_0x295f('0x38')]!==_0x295f('0x39')){var _0x2c6575={};_0x2c6575[_0x269035[_0x295f('0x25')]]={'$like':'%'+_0x207981[_0x295f('0x2c')][_0x295f('0x36')]+'%'};return _0x2c6575;}})});}_0x3c5f51=_[_0x295f('0x37')]({},_0x3c5f51,_0x207981['options']);var _0x455be1={'where':_0x3c5f51['where']};return db['UserProfileSection'][_0x295f('0x1b')](_0x455be1)[_0x295f('0x22')](function(_0x4a5474){_0x1b6fbc[_0x295f('0x1b')]=_0x4a5474;if(_0x207981[_0x295f('0x2c')][_0x295f('0x3a')]){_0x3c5f51[_0x295f('0x3b')]=[{'all':!![]}];}return db[_0x295f('0x27')][_0x295f('0x3c')](_0x3c5f51);})[_0x295f('0x22')](function(_0x50f0fe){_0x1b6fbc[_0x295f('0x3d')]=_0x50f0fe;return _0x1b6fbc;})[_0x295f('0x22')](respondWithFilteredResult(_0x49835d,_0x3c5f51))[_0x295f('0x3e')](handleError(_0x49835d,null));};exports['show']=function(_0x1a8d94,_0x519c86){var _0x2c973e={'raw':![],'where':{'id':_0x1a8d94[_0x295f('0x3f')]['id']}},_0x1c65bb={};_0x1c65bb['model']=_['keys'](db[_0x295f('0x27')][_0x295f('0x40')]);_0x1c65bb[_0x295f('0x2c')]=_['keys'](_0x1a8d94['query']);_0x1c65bb[_0x295f('0x35')]=_[_0x295f('0x2e')](_0x1c65bb['model'],_0x1c65bb[_0x295f('0x2c')]);_0x2c973e[_0x295f('0x2f')]=_['intersection'](_0x1c65bb[_0x295f('0x2a')],qs[_0x295f('0x30')](_0x1a8d94[_0x295f('0x2c')]['fields']));_0x2c973e[_0x295f('0x2f')]=_0x2c973e[_0x295f('0x2f')]['length']?_0x2c973e['attributes']:_0x1c65bb[_0x295f('0x2a')];if(_0x1a8d94['query'][_0x295f('0x3a')]){_0x2c973e['include']=[{'all':!![]}];}_0x2c973e=_[_0x295f('0x37')]({},_0x2c973e,_0x1a8d94[_0x295f('0x41')]);return db[_0x295f('0x27')][_0x295f('0x42')](_0x2c973e)['then'](handleEntityNotFound(_0x519c86,null))['then'](respondWithResult(_0x519c86,null))[_0x295f('0x3e')](handleError(_0x519c86,null));};exports[_0x295f('0x43')]=function(_0x2f6df8,_0x31cf4e){return db[_0x295f('0x27')][_0x295f('0x43')](_0x2f6df8[_0x295f('0x44')],{})[_0x295f('0x22')](respondWithResult(_0x31cf4e,0xc9))[_0x295f('0x3e')](handleError(_0x31cf4e,null));};exports[_0x295f('0x21')]=function(_0x104081,_0x538e06){if(_0x104081[_0x295f('0x44')]['id']){delete _0x104081['body']['id'];}return db['UserProfileSection'][_0x295f('0x42')]({'where':{'id':_0x104081[_0x295f('0x3f')]['id']}})[_0x295f('0x22')](handleEntityNotFound(_0x538e06,null))[_0x295f('0x22')](saveUpdates(_0x104081[_0x295f('0x44')],null))[_0x295f('0x22')](respondWithResult(_0x538e06,null))[_0x295f('0x3e')](handleError(_0x538e06,null));};exports[_0x295f('0x23')]=function(_0x4c1b2b,_0x50ac61){return db[_0x295f('0x27')]['find']({'where':{'id':_0x4c1b2b[_0x295f('0x3f')]['id']}})[_0x295f('0x22')](handleEntityNotFound(_0x50ac61,null))[_0x295f('0x22')](removeEntity(_0x50ac61,null))[_0x295f('0x3e')](handleError(_0x50ac61,null));};exports[_0x295f('0x45')]=function(_0x1dca8b,_0x4957ba){return db[_0x295f('0x27')][_0x295f('0x45')]()[_0x295f('0x22')](respondWithResult(_0x4957ba,null))[_0x295f('0x3e')](handleError(_0x4957ba,null));}; \ No newline at end of file +var _0x6b1c=['send','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','includeAll','UserProfileSection','findAll','catch','show','params','find','create','body','describe','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','sox','to-csv','lodash','squel','crypto','jsforce','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','status','end','json','count','offset','set','reject','save','update','then','destroy','sendStatus','error','name'];(function(_0x509506,_0x4df17f){var _0x2b8271=function(_0x7dd765){while(--_0x7dd765){_0x509506['push'](_0x509506['shift']());}};_0x2b8271(++_0x4df17f);}(_0x6b1c,0xf3));var _0xc6b1=function(_0x296b66,_0x40766f){_0x296b66=_0x296b66-0x0;var _0x4a309c=_0x6b1c[_0x296b66];return _0x4a309c;};'use strict';var pdf=require(_0xc6b1('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xc6b1('0x1'));var zipdir=require(_0xc6b1('0x2'));var jsonpatch=require(_0xc6b1('0x3'));var rp=require(_0xc6b1('0x4'));var moment=require(_0xc6b1('0x5'));var BPromise=require(_0xc6b1('0x6'));var Mustache=require('mustache');var util=require(_0xc6b1('0x7'));var path=require('path');var sox=require(_0xc6b1('0x8'));var csv=require(_0xc6b1('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xc6b1('0xa'));var squel=require(_0xc6b1('0xb'));var crypto=require(_0xc6b1('0xc'));var jsforce=require(_0xc6b1('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xc6b1('0x9'));var querystring=require(_0xc6b1('0xe'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xc6b1('0xf'));var qs=require(_0xc6b1('0x10'));var as=require(_0xc6b1('0x11'));var hardwareService=require(_0xc6b1('0x12'));var logger=require(_0xc6b1('0x13'))(_0xc6b1('0x14'));var utils=require('../../config/utils');var config=require(_0xc6b1('0x15'));var db=require(_0xc6b1('0x16'))['db'];function respondWithStatusCode(_0x327fe0,_0x3c5b2b){_0x3c5b2b=_0x3c5b2b||0xcc;return function(_0x283072){if(_0x283072){return _0x327fe0['sendStatus'](_0x3c5b2b);}return _0x327fe0[_0xc6b1('0x17')](_0x3c5b2b)[_0xc6b1('0x18')]();};}function respondWithResult(_0x1a57e6,_0x61ad75){_0x61ad75=_0x61ad75||0xc8;return function(_0x4cf458){if(_0x4cf458){return _0x1a57e6['status'](_0x61ad75)[_0xc6b1('0x19')](_0x4cf458);}};}function respondWithFilteredResult(_0x12079c,_0x37ea66){return function(_0x1d31cf){if(_0x1d31cf){var _0xef7fda=_0x1d31cf[_0xc6b1('0x1a')],_0x6885bd=_0x37ea66[_0xc6b1('0x1b')],_0x4ba242=_0x37ea66[_0xc6b1('0x1b')]+_0x37ea66['limit'],_0x4fbf72;if(_0x4ba242>=_0xef7fda){_0x4ba242=_0xef7fda;_0x4fbf72=0xc8;}else{_0x4fbf72=0xce;}_0x12079c[_0xc6b1('0x17')](_0x4fbf72);return _0x12079c[_0xc6b1('0x1c')]('Content-Range',_0x6885bd+'-'+_0x4ba242+'/'+_0xef7fda)[_0xc6b1('0x19')](_0x1d31cf);}return null;};}function patchUpdates(_0x2c8ac5){return function(_0xf3f94a){try{jsonpatch['apply'](_0xf3f94a,_0x2c8ac5,!![]);}catch(_0x24e135){return BPromise[_0xc6b1('0x1d')](_0x24e135);}return _0xf3f94a[_0xc6b1('0x1e')]();};}function saveUpdates(_0xe1480f,_0x57a253){return function(_0x507a37){if(_0x507a37){return _0x507a37[_0xc6b1('0x1f')](_0xe1480f)[_0xc6b1('0x20')](function(_0x9ac881){return _0x9ac881;});}return null;};}function removeEntity(_0x1d86f5,_0x2d41c4){return function(_0x9cef9f){if(_0x9cef9f){return _0x9cef9f[_0xc6b1('0x21')]()[_0xc6b1('0x20')](function(){_0x1d86f5[_0xc6b1('0x17')](0xcc)[_0xc6b1('0x18')]();});}};}function handleEntityNotFound(_0x267e1f,_0x673d7f){return function(_0x279fbf){if(!_0x279fbf){_0x267e1f[_0xc6b1('0x22')](0x194);}return _0x279fbf;};}function handleError(_0x311b3f,_0x3976df){_0x3976df=_0x3976df||0x1f4;return function(_0x5c0dad){logger[_0xc6b1('0x23')](_0x5c0dad['stack']);if(_0x5c0dad[_0xc6b1('0x24')]){delete _0x5c0dad[_0xc6b1('0x24')];}_0x311b3f[_0xc6b1('0x17')](_0x3976df)[_0xc6b1('0x25')](_0x5c0dad);};}exports['index']=function(_0x836608,_0x2942bb){var _0x168187={},_0x71ce3e={},_0x443774={'count':0x0,'rows':[]};var _0x44bbf6=_[_0xc6b1('0x26')](db['UserProfileSection'][_0xc6b1('0x27')],function(_0x16ec61){return{'name':_0x16ec61[_0xc6b1('0x28')],'type':_0x16ec61[_0xc6b1('0x29')][_0xc6b1('0x2a')]};});_0x71ce3e[_0xc6b1('0x2b')]=_['map'](_0x44bbf6,_0xc6b1('0x24'));_0x71ce3e[_0xc6b1('0x2c')]=_[_0xc6b1('0x2d')](_0x836608['query']);_0x71ce3e[_0xc6b1('0x2e')]=_[_0xc6b1('0x2f')](_0x71ce3e[_0xc6b1('0x2b')],_0x71ce3e[_0xc6b1('0x2c')]);_0x168187['attributes']=_['intersection'](_0x71ce3e[_0xc6b1('0x2b')],qs['fields'](_0x836608[_0xc6b1('0x2c')][_0xc6b1('0x30')]));_0x168187[_0xc6b1('0x31')]=_0x168187[_0xc6b1('0x31')][_0xc6b1('0x32')]?_0x168187[_0xc6b1('0x31')]:_0x71ce3e[_0xc6b1('0x2b')];if(!_0x836608[_0xc6b1('0x2c')][_0xc6b1('0x33')](_0xc6b1('0x34'))){_0x168187['limit']=qs['limit'](_0x836608[_0xc6b1('0x2c')]['limit']);_0x168187[_0xc6b1('0x1b')]=qs[_0xc6b1('0x1b')](_0x836608[_0xc6b1('0x2c')][_0xc6b1('0x1b')]);}_0x168187[_0xc6b1('0x35')]=qs[_0xc6b1('0x36')](_0x836608[_0xc6b1('0x2c')][_0xc6b1('0x36')]);_0x168187[_0xc6b1('0x37')]=qs['filters'](_[_0xc6b1('0x38')](_0x836608[_0xc6b1('0x2c')],_0x71ce3e[_0xc6b1('0x2e')]),_0x44bbf6);if(_0x836608[_0xc6b1('0x2c')][_0xc6b1('0x39')]){_0x168187[_0xc6b1('0x37')]=_[_0xc6b1('0x3a')](_0x168187[_0xc6b1('0x37')],{'$or':_['map'](_0x44bbf6,function(_0x541161){if(_0x541161['type']!=='VIRTUAL'){var _0x605a9f={};_0x605a9f[_0x541161[_0xc6b1('0x24')]]={'$like':'%'+_0x836608[_0xc6b1('0x2c')][_0xc6b1('0x39')]+'%'};return _0x605a9f;}})});}_0x168187=_['merge']({},_0x168187,_0x836608[_0xc6b1('0x3b')]);var _0x801870={'where':_0x168187[_0xc6b1('0x37')]};return db['UserProfileSection'][_0xc6b1('0x1a')](_0x801870)[_0xc6b1('0x20')](function(_0x2cbfb1){_0x443774[_0xc6b1('0x1a')]=_0x2cbfb1;if(_0x836608[_0xc6b1('0x2c')][_0xc6b1('0x3c')]){_0x168187['include']=[{'all':!![]}];}return db[_0xc6b1('0x3d')][_0xc6b1('0x3e')](_0x168187);})[_0xc6b1('0x20')](function(_0x357111){_0x443774['rows']=_0x357111;return _0x443774;})[_0xc6b1('0x20')](respondWithFilteredResult(_0x2942bb,_0x168187))[_0xc6b1('0x3f')](handleError(_0x2942bb,null));};exports[_0xc6b1('0x40')]=function(_0x3114fa,_0x1734c9){var _0x5343f1={'raw':![],'where':{'id':_0x3114fa[_0xc6b1('0x41')]['id']}},_0x5555a7={};_0x5555a7['model']=_[_0xc6b1('0x2d')](db['UserProfileSection'][_0xc6b1('0x27')]);_0x5555a7[_0xc6b1('0x2c')]=_[_0xc6b1('0x2d')](_0x3114fa[_0xc6b1('0x2c')]);_0x5555a7[_0xc6b1('0x2e')]=_[_0xc6b1('0x2f')](_0x5555a7[_0xc6b1('0x2b')],_0x5555a7[_0xc6b1('0x2c')]);_0x5343f1[_0xc6b1('0x31')]=_[_0xc6b1('0x2f')](_0x5555a7[_0xc6b1('0x2b')],qs[_0xc6b1('0x30')](_0x3114fa[_0xc6b1('0x2c')][_0xc6b1('0x30')]));_0x5343f1[_0xc6b1('0x31')]=_0x5343f1[_0xc6b1('0x31')]['length']?_0x5343f1[_0xc6b1('0x31')]:_0x5555a7[_0xc6b1('0x2b')];if(_0x3114fa[_0xc6b1('0x2c')][_0xc6b1('0x3c')]){_0x5343f1['include']=[{'all':!![]}];}_0x5343f1=_[_0xc6b1('0x3a')]({},_0x5343f1,_0x3114fa['options']);return db[_0xc6b1('0x3d')][_0xc6b1('0x42')](_0x5343f1)[_0xc6b1('0x20')](handleEntityNotFound(_0x1734c9,null))[_0xc6b1('0x20')](respondWithResult(_0x1734c9,null))[_0xc6b1('0x3f')](handleError(_0x1734c9,null));};exports['create']=function(_0x420e1c,_0x3d0872){return db[_0xc6b1('0x3d')][_0xc6b1('0x43')](_0x420e1c[_0xc6b1('0x44')],{})[_0xc6b1('0x20')](respondWithResult(_0x3d0872,0xc9))[_0xc6b1('0x3f')](handleError(_0x3d0872,null));};exports['update']=function(_0x23b539,_0x59c5f1){if(_0x23b539[_0xc6b1('0x44')]['id']){delete _0x23b539[_0xc6b1('0x44')]['id'];}return db['UserProfileSection'][_0xc6b1('0x42')]({'where':{'id':_0x23b539[_0xc6b1('0x41')]['id']}})[_0xc6b1('0x20')](handleEntityNotFound(_0x59c5f1,null))['then'](saveUpdates(_0x23b539['body'],null))[_0xc6b1('0x20')](respondWithResult(_0x59c5f1,null))[_0xc6b1('0x3f')](handleError(_0x59c5f1,null));};exports[_0xc6b1('0x21')]=function(_0x2a4b36,_0x2b6e1a){return db[_0xc6b1('0x3d')][_0xc6b1('0x42')]({'where':{'id':_0x2a4b36[_0xc6b1('0x41')]['id']}})[_0xc6b1('0x20')](handleEntityNotFound(_0x2b6e1a,null))[_0xc6b1('0x20')](removeEntity(_0x2b6e1a,null))[_0xc6b1('0x3f')](handleError(_0x2b6e1a,null));};exports['describe']=function(_0x3c4359,_0x196fd5){return db[_0xc6b1('0x3d')][_0xc6b1('0x45')]()[_0xc6b1('0x20')](respondWithResult(_0x196fd5,null))[_0xc6b1('0x3f')](handleError(_0x196fd5,null));}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.model.js b/server/api/userProfileSection/userProfileSection.model.js index 5f3926e..a292a82 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 _0x4f98=['UserProfileSection','user_profile_has_sections','compositeIndex','sectionId','lodash','../../config/logger','api','bluebird','request-promise','../../config/environment','exports','define'];(function(_0x1789bc,_0x1acf84){var _0x35efd1=function(_0x2329b2){while(--_0x2329b2){_0x1789bc['push'](_0x1789bc['shift']());}};_0x35efd1(++_0x1acf84);}(_0x4f98,0x160));var _0x84f9=function(_0x246148,_0x1358ee){_0x246148=_0x246148-0x0;var _0x453d94=_0x4f98[_0x246148];return _0x453d94;};'use strict';var _=require(_0x84f9('0x0'));var util=require('util');var logger=require(_0x84f9('0x1'))(_0x84f9('0x2'));var moment=require('moment');var BPromise=require(_0x84f9('0x3'));var rp=require(_0x84f9('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x84f9('0x5'));var attributes=require('./userProfileSection.attributes');module[_0x84f9('0x6')]=function(_0x33c783,_0x15dc82){return _0x33c783[_0x84f9('0x7')](_0x84f9('0x8'),attributes,{'tableName':_0x84f9('0x9'),'paranoid':![],'indexes':[{'name':_0x84f9('0xa'),'fields':[_0x84f9('0xb'),'userProfileId']}],'timestamps':!![]});}; \ No newline at end of file +var _0x99c4=['path','rimraf','../../config/environment','./userProfileSection.attributes','exports','define','user_profile_has_sections','compositeIndex','sectionId','userProfileId','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0xa9a245,_0x2a0387){var _0x2d0eaa=function(_0x2bba86){while(--_0x2bba86){_0xa9a245['push'](_0xa9a245['shift']());}};_0x2d0eaa(++_0x2a0387);}(_0x99c4,0x14d));var _0x499c=function(_0x2cc3fa,_0x1a4af2){_0x2cc3fa=_0x2cc3fa-0x0;var _0x5044eb=_0x99c4[_0x2cc3fa];return _0x5044eb;};'use strict';var _=require(_0x499c('0x0'));var util=require(_0x499c('0x1'));var logger=require(_0x499c('0x2'))(_0x499c('0x3'));var moment=require(_0x499c('0x4'));var BPromise=require(_0x499c('0x5'));var rp=require(_0x499c('0x6'));var fs=require('fs');var path=require(_0x499c('0x7'));var rimraf=require(_0x499c('0x8'));var config=require(_0x499c('0x9'));var attributes=require(_0x499c('0xa'));module[_0x499c('0xb')]=function(_0x29e7a2,_0x2fd0d7){return _0x29e7a2[_0x499c('0xc')]('UserProfileSection',attributes,{'tableName':_0x499c('0xd'),'paranoid':![],'indexes':[{'name':_0x499c('0xe'),'fields':[_0x499c('0xf'),_0x499c('0x10')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.rpc.js b/server/api/userProfileSection/userProfileSection.rpc.js index 385360a..9bcd6dd 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 _0x25c7=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','then','info','request\x20sent','debug','UserProfileSection,\x20%s,\x20%s,\x20%s','stringify','error','UserProfileSection,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','randomstring'];(function(_0x41c88c,_0x381f8d){var _0x2c97ea=function(_0x35fd44){while(--_0x35fd44){_0x41c88c['push'](_0x41c88c['shift']());}};_0x2c97ea(++_0x381f8d);}(_0x25c7,0x103));var _0x725c=function(_0x1ae150,_0x3ff834){_0x1ae150=_0x1ae150-0x0;var _0x52ad8e=_0x25c7[_0x1ae150];return _0x52ad8e;};'use strict';var _=require(_0x725c('0x0'));var util=require(_0x725c('0x1'));var moment=require(_0x725c('0x2'));var BPromise=require(_0x725c('0x3'));var rs=require(_0x725c('0x4'));var fs=require('fs');var Redis=require(_0x725c('0x5'));var db=require(_0x725c('0x6'))['db'];var utils=require(_0x725c('0x7'));var logger=require(_0x725c('0x8'))(_0x725c('0x9'));var config=require(_0x725c('0xa'));var jayson=require(_0x725c('0xb'));var client=jayson['client'][_0x725c('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x10c209,_0x162773,_0x55fc20){return new BPromise(function(_0x395d5c,_0x4576af){return client['request'](_0x10c209,_0x55fc20)[_0x725c('0xd')](function(_0x166b61){logger[_0x725c('0xe')]('UserProfileSection,\x20%s,\x20%s',_0x162773,_0x725c('0xf'));logger[_0x725c('0x10')](_0x725c('0x11'),_0x162773,_0x725c('0xf'),JSON[_0x725c('0x12')](_0x166b61));if(_0x166b61[_0x725c('0x13')]){if(_0x166b61[_0x725c('0x13')]['code']===0x1f4){logger[_0x725c('0x13')](_0x725c('0x14'),_0x162773,_0x166b61[_0x725c('0x13')]['message']);return _0x4576af(_0x166b61[_0x725c('0x13')][_0x725c('0x15')]);}logger['error'](_0x725c('0x14'),_0x162773,_0x166b61['error'][_0x725c('0x15')]);return _0x395d5c(_0x166b61[_0x725c('0x13')][_0x725c('0x15')]);}else{logger['info'](_0x725c('0x14'),_0x162773,_0x725c('0xf'));_0x395d5c(_0x166b61[_0x725c('0x16')][_0x725c('0x15')]);}})[_0x725c('0x17')](function(_0x5c6712){logger[_0x725c('0x13')](_0x725c('0x14'),_0x162773,_0x5c6712);_0x4576af(_0x5c6712);});});} \ No newline at end of file +var _0xd442=['moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','UserProfileSection,\x20%s,\x20%s,\x20%s','stringify','error','code','UserProfileSection,\x20%s,\x20%s','message','result','catch'];(function(_0x1035c1,_0x2d8583){var _0x308d67=function(_0x58ddb6){while(--_0x58ddb6){_0x1035c1['push'](_0x1035c1['shift']());}};_0x308d67(++_0x2d8583);}(_0xd442,0x1b5));var _0x2d44=function(_0x4ee389,_0x4cc020){_0x4ee389=_0x4ee389-0x0;var _0x2d8657=_0xd442[_0x4ee389];return _0x2d8657;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x2d44('0x0'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2d44('0x1'));var db=require(_0x2d44('0x2'))['db'];var utils=require(_0x2d44('0x3'));var logger=require(_0x2d44('0x4'))(_0x2d44('0x5'));var config=require(_0x2d44('0x6'));var jayson=require(_0x2d44('0x7'));var client=jayson[_0x2d44('0x8')][_0x2d44('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x307323,_0x47f26d,_0x444062){return new BPromise(function(_0x86211f,_0xefd015){return client[_0x2d44('0xa')](_0x307323,_0x444062)[_0x2d44('0xb')](function(_0x34c7cd){logger[_0x2d44('0xc')]('UserProfileSection,\x20%s,\x20%s',_0x47f26d,_0x2d44('0xd'));logger[_0x2d44('0xe')](_0x2d44('0xf'),_0x47f26d,'request\x20sent',JSON[_0x2d44('0x10')](_0x34c7cd));if(_0x34c7cd[_0x2d44('0x11')]){if(_0x34c7cd[_0x2d44('0x11')][_0x2d44('0x12')]===0x1f4){logger['error'](_0x2d44('0x13'),_0x47f26d,_0x34c7cd[_0x2d44('0x11')]['message']);return _0xefd015(_0x34c7cd[_0x2d44('0x11')][_0x2d44('0x14')]);}logger[_0x2d44('0x11')](_0x2d44('0x13'),_0x47f26d,_0x34c7cd[_0x2d44('0x11')][_0x2d44('0x14')]);return _0x86211f(_0x34c7cd['error'][_0x2d44('0x14')]);}else{logger[_0x2d44('0xc')]('UserProfileSection,\x20%s,\x20%s',_0x47f26d,'request\x20sent');_0x86211f(_0x34c7cd[_0x2d44('0x15')][_0x2d44('0x14')]);}})[_0x2d44('0x16')](function(_0x2ec9b2){logger[_0x2d44('0x11')](_0x2d44('0x13'),_0x47f26d,_0x2ec9b2);_0xefd015(_0x2ec9b2);});});} \ No newline at end of file diff --git a/server/api/userSmsQueue/index.js b/server/api/userSmsQueue/index.js index ae0cd04..e60b694 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 _0x04a3=['Router','../../components/auth/service','exports','multer','util','path','connect-timeout'];(function(_0x1fc4e2,_0x493c3b){var _0x2ba184=function(_0x58e64f){while(--_0x58e64f){_0x1fc4e2['push'](_0x1fc4e2['shift']());}};_0x2ba184(++_0x493c3b);}(_0x04a3,0x10d));var _0x304a=function(_0x164c8c,_0x24f2d5){_0x164c8c=_0x164c8c-0x0;var _0x1fd534=_0x04a3[_0x164c8c];return _0x1fd534;};'use strict';var multer=require(_0x304a('0x0'));var util=require(_0x304a('0x1'));var path=require(_0x304a('0x2'));var timeout=require(_0x304a('0x3'));var express=require('express');var router=express[_0x304a('0x4')]();var auth=require(_0x304a('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');module[_0x304a('0x6')]=router; \ No newline at end of file +var _0x19cc=['connect-timeout','express','Router','../../components/auth/service','../../config/environment','exports','multer','util'];(function(_0x381589,_0x27a707){var _0x2a075d=function(_0x4ea19d){while(--_0x4ea19d){_0x381589['push'](_0x381589['shift']());}};_0x2a075d(++_0x27a707);}(_0x19cc,0x10e));var _0xc19c=function(_0x5df61d,_0x158640){_0x5df61d=_0x5df61d-0x0;var _0x24cc4c=_0x19cc[_0x5df61d];return _0x24cc4c;};'use strict';var multer=require(_0xc19c('0x0'));var util=require(_0xc19c('0x1'));var path=require('path');var timeout=require(_0xc19c('0x2'));var express=require(_0xc19c('0x3'));var router=express[_0xc19c('0x4')]();var auth=require(_0xc19c('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xc19c('0x6'));module[_0xc19c('0x7')]=router; \ No newline at end of file diff --git a/server/api/userSmsQueue/userSmsQueue.attributes.js b/server/api/userSmsQueue/userSmsQueue.attributes.js index 8a1f623..7cef96c 100644 --- a/server/api/userSmsQueue/userSmsQueue.attributes.js +++ b/server/api/userSmsQueue/userSmsQueue.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['sequelize','exports','INTEGER'];(function(_0x107638,_0x3ad732){var _0x492ff7=function(_0x1b8c5c){while(--_0x1b8c5c){_0x107638['push'](_0x107638['shift']());}};_0x492ff7(++_0x3ad732);}(_0xa9e0,0x123));var _0x0a9e=function(_0x298ed3,_0x4ab5e1){_0x298ed3=_0x298ed3-0x0;var _0x5aad28=_0xa9e0[_0x298ed3];return _0x5aad28;};'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(_0x1ae8ab,_0x6e5c2a){var _0x1ad705=function(_0x1dfa15){while(--_0x1dfa15){_0x1ae8ab['push'](_0x1ae8ab['shift']());}};_0x1ad705(++_0x6e5c2a);}(_0xbaf0,0x12a));var _0x0baf=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0xbaf0[_0x501510];return _0x1e6ee5;};'use strict';var Sequelize=require('sequelize');module[_0x0baf('0x0')]={'penalty':{'type':Sequelize[_0x0baf('0x1')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userSmsQueue/userSmsQueue.model.js b/server/api/userSmsQueue/userSmsQueue.model.js index 0bf424f..e22fbda 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 _0x261b=['./userSmsQueue.attributes','define','UserSmsQueue','lodash','util','request-promise','rimraf'];(function(_0x40bffc,_0x3a45d7){var _0x3007e9=function(_0x4c8fda){while(--_0x4c8fda){_0x40bffc['push'](_0x40bffc['shift']());}};_0x3007e9(++_0x3a45d7);}(_0x261b,0x15a));var _0xb261=function(_0x5a3468,_0xf9c673){_0x5a3468=_0x5a3468-0x0;var _0x190610=_0x261b[_0x5a3468];return _0x190610;};'use strict';var _=require(_0xb261('0x0'));var util=require(_0xb261('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xb261('0x2'));var fs=require('fs');var path=require('path');var rimraf=require(_0xb261('0x3'));var config=require('../../config/environment');var attributes=require(_0xb261('0x4'));module['exports']=function(_0x10f7ba,_0xaf0725){return _0x10f7ba[_0xb261('0x5')](_0xb261('0x6'),attributes,{'tableName':'user_has_sms_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2d93=['../../config/environment','./userSmsQueue.attributes','exports','UserSmsQueue','user_has_sms_queues','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x59e791,_0x1d7bb8){var _0x5df1ef=function(_0xf5643a){while(--_0xf5643a){_0x59e791['push'](_0x59e791['shift']());}};_0x5df1ef(++_0x1d7bb8);}(_0x2d93,0xf3));var _0x32d9=function(_0x5e6cb8,_0x16cf56){_0x5e6cb8=_0x5e6cb8-0x0;var _0x3faeb3=_0x2d93[_0x5e6cb8];return _0x3faeb3;};'use strict';var _=require(_0x32d9('0x0'));var util=require(_0x32d9('0x1'));var logger=require(_0x32d9('0x2'))(_0x32d9('0x3'));var moment=require(_0x32d9('0x4'));var BPromise=require(_0x32d9('0x5'));var rp=require(_0x32d9('0x6'));var fs=require('fs');var path=require(_0x32d9('0x7'));var rimraf=require(_0x32d9('0x8'));var config=require(_0x32d9('0x9'));var attributes=require(_0x32d9('0xa'));module[_0x32d9('0xb')]=function(_0x9b4979,_0x3529db){return _0x9b4979['define'](_0x32d9('0xc'),attributes,{'tableName':_0x32d9('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userSmsQueue/userSmsQueue.rpc.js b/server/api/userSmsQueue/userSmsQueue.rpc.js index b61f4ae..4200361 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 _0x87a3=['moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','request','then','info','UserSmsQueue,\x20%s,\x20%s','request\x20sent','debug','UserSmsQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash'];(function(_0x31b826,_0x327fae){var _0x2efe52=function(_0x1042c0){while(--_0x1042c0){_0x31b826['push'](_0x31b826['shift']());}};_0x2efe52(++_0x327fae);}(_0x87a3,0x16f));var _0x387a=function(_0x209fcd,_0x1ecccc){_0x209fcd=_0x209fcd-0x0;var _0x501d5e=_0x87a3[_0x209fcd];return _0x501d5e;};'use strict';var _=require(_0x387a('0x0'));var util=require('util');var moment=require(_0x387a('0x1'));var BPromise=require(_0x387a('0x2'));var rs=require(_0x387a('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x387a('0x4'))['db'];var utils=require(_0x387a('0x5'));var logger=require(_0x387a('0x6'))(_0x387a('0x7'));var config=require('../../config/environment');var jayson=require(_0x387a('0x8'));var client=jayson[_0x387a('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3ea501,_0x9ae658,_0xe1c95a){return new BPromise(function(_0x53504f,_0x291e1c){return client[_0x387a('0xa')](_0x3ea501,_0xe1c95a)[_0x387a('0xb')](function(_0x556142){logger[_0x387a('0xc')](_0x387a('0xd'),_0x9ae658,_0x387a('0xe'));logger[_0x387a('0xf')](_0x387a('0x10'),_0x9ae658,_0x387a('0xe'),JSON[_0x387a('0x11')](_0x556142));if(_0x556142[_0x387a('0x12')]){if(_0x556142[_0x387a('0x12')][_0x387a('0x13')]===0x1f4){logger['error']('UserSmsQueue,\x20%s,\x20%s',_0x9ae658,_0x556142[_0x387a('0x12')][_0x387a('0x14')]);return _0x291e1c(_0x556142[_0x387a('0x12')][_0x387a('0x14')]);}logger[_0x387a('0x12')]('UserSmsQueue,\x20%s,\x20%s',_0x9ae658,_0x556142[_0x387a('0x12')]['message']);return _0x53504f(_0x556142[_0x387a('0x12')][_0x387a('0x14')]);}else{logger[_0x387a('0xc')]('UserSmsQueue,\x20%s,\x20%s',_0x9ae658,_0x387a('0xe'));_0x53504f(_0x556142[_0x387a('0x15')]['message']);}})[_0x387a('0x16')](function(_0x3b9490){logger[_0x387a('0x12')](_0x387a('0xd'),_0x9ae658,_0x3b9490);_0x291e1c(_0x3b9490);});});} \ No newline at end of file +var _0xc993=['../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','UserSmsQueue,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x18c057,_0x2ac2e3){var _0x2afcc1=function(_0x28ecd3){while(--_0x28ecd3){_0x18c057['push'](_0x18c057['shift']());}};_0x2afcc1(++_0x2ac2e3);}(_0xc993,0x9a));var _0x3c99=function(_0xfb9eb5,_0x468bc6){_0xfb9eb5=_0xfb9eb5-0x0;var _0x3d0096=_0xc993[_0xfb9eb5];return _0x3d0096;};'use strict';var _=require(_0x3c99('0x0'));var util=require(_0x3c99('0x1'));var moment=require(_0x3c99('0x2'));var BPromise=require('bluebird');var rs=require(_0x3c99('0x3'));var fs=require('fs');var Redis=require(_0x3c99('0x4'));var db=require(_0x3c99('0x5'))['db'];var utils=require(_0x3c99('0x6'));var logger=require(_0x3c99('0x7'))('rpc');var config=require(_0x3c99('0x8'));var jayson=require(_0x3c99('0x9'));var client=jayson[_0x3c99('0xa')][_0x3c99('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x15c08f,_0x484b7c,_0x4c9036){return new BPromise(function(_0x177f99,_0x354111){return client[_0x3c99('0xc')](_0x15c08f,_0x4c9036)[_0x3c99('0xd')](function(_0x3bc3dc){logger[_0x3c99('0xe')](_0x3c99('0xf'),_0x484b7c,_0x3c99('0x10'));logger[_0x3c99('0x11')]('UserSmsQueue,\x20%s,\x20%s,\x20%s',_0x484b7c,_0x3c99('0x10'),JSON[_0x3c99('0x12')](_0x3bc3dc));if(_0x3bc3dc[_0x3c99('0x13')]){if(_0x3bc3dc[_0x3c99('0x13')][_0x3c99('0x14')]===0x1f4){logger[_0x3c99('0x13')](_0x3c99('0xf'),_0x484b7c,_0x3bc3dc['error'][_0x3c99('0x15')]);return _0x354111(_0x3bc3dc[_0x3c99('0x13')][_0x3c99('0x15')]);}logger[_0x3c99('0x13')](_0x3c99('0xf'),_0x484b7c,_0x3bc3dc[_0x3c99('0x13')][_0x3c99('0x15')]);return _0x177f99(_0x3bc3dc[_0x3c99('0x13')]['message']);}else{logger[_0x3c99('0xe')](_0x3c99('0xf'),_0x484b7c,_0x3c99('0x10'));_0x177f99(_0x3bc3dc['result']['message']);}})[_0x3c99('0x16')](function(_0x5eaa3c){logger[_0x3c99('0x13')](_0x3c99('0xf'),_0x484b7c,_0x5eaa3c);_0x354111(_0x5eaa3c);});});} \ No newline at end of file diff --git a/server/api/userVoiceQueue/index.js b/server/api/userVoiceQueue/index.js index 885e92b..05a459d 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 _0x1252=['connect-timeout','express','../../components/auth/service','exports','multer'];(function(_0x1b5335,_0x4c291e){var _0x4fbfb5=function(_0x421e9a){while(--_0x421e9a){_0x1b5335['push'](_0x1b5335['shift']());}};_0x4fbfb5(++_0x4c291e);}(_0x1252,0x11c));var _0x2125=function(_0x145e61,_0x2062a0){_0x145e61=_0x145e61-0x0;var _0x1e5050=_0x1252[_0x145e61];return _0x1e5050;};'use strict';var multer=require(_0x2125('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x2125('0x1'));var express=require(_0x2125('0x2'));var router=express['Router']();var auth=require(_0x2125('0x3'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');module[_0x2125('0x4')]=router; \ No newline at end of file +var _0x4d53=['express','Router','../../components/interaction/service','exports','util','path','connect-timeout'];(function(_0x2799a3,_0x3bac20){var _0x77d0c1=function(_0x377424){while(--_0x377424){_0x2799a3['push'](_0x2799a3['shift']());}};_0x77d0c1(++_0x3bac20);}(_0x4d53,0x115));var _0x34d5=function(_0x1d9aa0,_0x272488){_0x1d9aa0=_0x1d9aa0-0x0;var _0x226868=_0x4d53[_0x1d9aa0];return _0x226868;};'use strict';var multer=require('multer');var util=require(_0x34d5('0x0'));var path=require(_0x34d5('0x1'));var timeout=require(_0x34d5('0x2'));var express=require(_0x34d5('0x3'));var router=express[_0x34d5('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x34d5('0x5'));var config=require('../../config/environment');module[_0x34d5('0x6')]=router; \ No newline at end of file diff --git a/server/api/userVoiceQueue/userVoiceQueue.attributes.js b/server/api/userVoiceQueue/userVoiceQueue.attributes.js index ab4227f..75ddaf6 100644 --- a/server/api/userVoiceQueue/userVoiceQueue.attributes.js +++ b/server/api/userVoiceQueue/userVoiceQueue.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd8b0=['exports','sequelize'];(function(_0x31316a,_0x1c57b6){var _0x148799=function(_0x410dea){while(--_0x410dea){_0x31316a['push'](_0x31316a['shift']());}};_0x148799(++_0x1c57b6);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var Sequelize=require(_0x0d8b('0x0'));module[_0x0d8b('0x1')]={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0xd8b0=['exports','sequelize'];(function(_0x1f20c1,_0x350567){var _0x548c58=function(_0x54b7c5){while(--_0x54b7c5){_0x1f20c1['push'](_0x1f20c1['shift']());}};_0x548c58(++_0x350567);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var Sequelize=require(_0x0d8b('0x0'));module[_0x0d8b('0x1')]={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userVoiceQueue/userVoiceQueue.model.js b/server/api/userVoiceQueue/userVoiceQueue.model.js index 727b144..c04d381 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 _0x4075=['path','../../config/environment','./userVoiceQueue.attributes','exports','define','UserVoiceQueue','util','../../config/logger','api','moment','request-promise'];(function(_0x3562df,_0x1fe6ee){var _0x2775be=function(_0x1d5b04){while(--_0x1d5b04){_0x3562df['push'](_0x3562df['shift']());}};_0x2775be(++_0x1fe6ee);}(_0x4075,0x187));var _0x5407=function(_0x19dd7a,_0x51de21){_0x19dd7a=_0x19dd7a-0x0;var _0x3feb6a=_0x4075[_0x19dd7a];return _0x3feb6a;};'use strict';var _=require('lodash');var util=require(_0x5407('0x0'));var logger=require(_0x5407('0x1'))(_0x5407('0x2'));var moment=require(_0x5407('0x3'));var BPromise=require('bluebird');var rp=require(_0x5407('0x4'));var fs=require('fs');var path=require(_0x5407('0x5'));var rimraf=require('rimraf');var config=require(_0x5407('0x6'));var attributes=require(_0x5407('0x7'));module[_0x5407('0x8')]=function(_0x54e7cd,_0xf740b2){return _0x54e7cd[_0x5407('0x9')](_0x5407('0xa'),attributes,{'tableName':'user_has_voice_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x89e3=['api','moment','bluebird','path','../../config/environment','./userVoiceQueue.attributes','exports','UserVoiceQueue','user_has_voice_queues','lodash','util','../../config/logger'];(function(_0x2f8611,_0x22c3e0){var _0x208272=function(_0x29b8b4){while(--_0x29b8b4){_0x2f8611['push'](_0x2f8611['shift']());}};_0x208272(++_0x22c3e0);}(_0x89e3,0x17d));var _0x389e=function(_0x17254f,_0x55f75d){_0x17254f=_0x17254f-0x0;var _0x383a9e=_0x89e3[_0x17254f];return _0x383a9e;};'use strict';var _=require(_0x389e('0x0'));var util=require(_0x389e('0x1'));var logger=require(_0x389e('0x2'))(_0x389e('0x3'));var moment=require(_0x389e('0x4'));var BPromise=require(_0x389e('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x389e('0x6'));var rimraf=require('rimraf');var config=require(_0x389e('0x7'));var attributes=require(_0x389e('0x8'));module[_0x389e('0x9')]=function(_0x195c14,_0xaedd45){return _0x195c14['define'](_0x389e('0xa'),attributes,{'tableName':_0x389e('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userVoiceQueue/userVoiceQueue.rpc.js b/server/api/userVoiceQueue/userVoiceQueue.rpc.js index 8dea7b5..27d0b4e 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 _0x71f1=['jayson/promise','request','info','UserVoiceQueue,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','lodash','util','bluebird','randomstring','rpc','../../config/environment'];(function(_0x4452f1,_0x5ad396){var _0x6cedd0=function(_0x1448f0){while(--_0x1448f0){_0x4452f1['push'](_0x4452f1['shift']());}};_0x6cedd0(++_0x5ad396);}(_0x71f1,0xea));var _0x171f=function(_0x33626e,_0x2c1e9a){_0x33626e=_0x33626e-0x0;var _0x254df4=_0x71f1[_0x33626e];return _0x254df4;};'use strict';var _=require(_0x171f('0x0'));var util=require(_0x171f('0x1'));var moment=require('moment');var BPromise=require(_0x171f('0x2'));var rs=require(_0x171f('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x171f('0x4'));var config=require(_0x171f('0x5'));var jayson=require(_0x171f('0x6'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x451f17,_0x7c18f2,_0x2a0d77){return new BPromise(function(_0x376b51,_0x144871){return client[_0x171f('0x7')](_0x451f17,_0x2a0d77)['then'](function(_0x4dc0ec){logger[_0x171f('0x8')](_0x171f('0x9'),_0x7c18f2,_0x171f('0xa'));logger['debug']('UserVoiceQueue,\x20%s,\x20%s,\x20%s',_0x7c18f2,'request\x20sent',JSON[_0x171f('0xb')](_0x4dc0ec));if(_0x4dc0ec[_0x171f('0xc')]){if(_0x4dc0ec[_0x171f('0xc')][_0x171f('0xd')]===0x1f4){logger['error'](_0x171f('0x9'),_0x7c18f2,_0x4dc0ec['error'][_0x171f('0xe')]);return _0x144871(_0x4dc0ec[_0x171f('0xc')]['message']);}logger[_0x171f('0xc')](_0x171f('0x9'),_0x7c18f2,_0x4dc0ec[_0x171f('0xc')][_0x171f('0xe')]);return _0x376b51(_0x4dc0ec[_0x171f('0xc')][_0x171f('0xe')]);}else{logger['info'](_0x171f('0x9'),_0x7c18f2,'request\x20sent');_0x376b51(_0x4dc0ec['result']['message']);}})['catch'](function(_0x2fdecd){logger[_0x171f('0xc')](_0x171f('0x9'),_0x7c18f2,_0x2fdecd);_0x144871(_0x2fdecd);});});} \ No newline at end of file +var _0x7e35=['UserVoiceQueue,\x20%s,\x20%s,\x20%s','error','code','message','catch','lodash','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','UserVoiceQueue,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x415600,_0x2cb7c3){var _0x592e05=function(_0x296bad){while(--_0x296bad){_0x415600['push'](_0x415600['shift']());}};_0x592e05(++_0x2cb7c3);}(_0x7e35,0x9f));var _0x57e3=function(_0x1be7f3,_0x37da8f){_0x1be7f3=_0x1be7f3-0x0;var _0x1b2672=_0x7e35[_0x1be7f3];return _0x1b2672;};'use strict';var _=require(_0x57e3('0x0'));var util=require('util');var moment=require(_0x57e3('0x1'));var BPromise=require(_0x57e3('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x57e3('0x3'))['db'];var utils=require(_0x57e3('0x4'));var logger=require(_0x57e3('0x5'))(_0x57e3('0x6'));var config=require(_0x57e3('0x7'));var jayson=require(_0x57e3('0x8'));var client=jayson[_0x57e3('0x9')][_0x57e3('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4a75f3,_0x364d56,_0x263c8a){return new BPromise(function(_0x55af88,_0xf22c4f){return client[_0x57e3('0xb')](_0x4a75f3,_0x263c8a)[_0x57e3('0xc')](function(_0x75f6c9){logger[_0x57e3('0xd')](_0x57e3('0xe'),_0x364d56,_0x57e3('0xf'));logger[_0x57e3('0x10')](_0x57e3('0x11'),_0x364d56,'request\x20sent',JSON['stringify'](_0x75f6c9));if(_0x75f6c9[_0x57e3('0x12')]){if(_0x75f6c9['error'][_0x57e3('0x13')]===0x1f4){logger[_0x57e3('0x12')]('UserVoiceQueue,\x20%s,\x20%s',_0x364d56,_0x75f6c9['error']['message']);return _0xf22c4f(_0x75f6c9['error']['message']);}logger[_0x57e3('0x12')]('UserVoiceQueue,\x20%s,\x20%s',_0x364d56,_0x75f6c9[_0x57e3('0x12')][_0x57e3('0x14')]);return _0x55af88(_0x75f6c9[_0x57e3('0x12')][_0x57e3('0x14')]);}else{logger['info'](_0x57e3('0xe'),_0x364d56,_0x57e3('0xf'));_0x55af88(_0x75f6c9['result'][_0x57e3('0x14')]);}})[_0x57e3('0x15')](function(_0x17bf63){logger[_0x57e3('0x12')](_0x57e3('0xe'),_0x364d56,_0x17bf63);_0xf22c4f(_0x17bf63);});});} \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/index.js b/server/api/userVoiceQueueRt/index.js index b5e7569..e19d3bd 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 _0x80ed=['exports','multer','util','path','connect-timeout','express','Router','../../components/interaction/service'];(function(_0x88cd7b,_0x4c884c){var _0x56fcc8=function(_0x513b3d){while(--_0x513b3d){_0x88cd7b['push'](_0x88cd7b['shift']());}};_0x56fcc8(++_0x4c884c);}(_0x80ed,0xa1));var _0xd80e=function(_0x25df98,_0x1bfe49){_0x25df98=_0x25df98-0x0;var _0xcbbcd9=_0x80ed[_0x25df98];return _0xcbbcd9;};'use strict';var multer=require(_0xd80e('0x0'));var util=require(_0xd80e('0x1'));var path=require(_0xd80e('0x2'));var timeout=require(_0xd80e('0x3'));var express=require(_0xd80e('0x4'));var router=express[_0xd80e('0x5')]();var auth=require('../../components/auth/service');var interaction=require(_0xd80e('0x6'));var config=require('../../config/environment');module[_0xd80e('0x7')]=router; \ No newline at end of file +var _0x0439=['../../config/environment','exports','multer','util','connect-timeout','express','Router','../../components/auth/service'];(function(_0x702a6b,_0x4e1994){var _0x5b2af8=function(_0x42e447){while(--_0x42e447){_0x702a6b['push'](_0x702a6b['shift']());}};_0x5b2af8(++_0x4e1994);}(_0x0439,0xaa));var _0x9043=function(_0x50cfc3,_0x526cc6){_0x50cfc3=_0x50cfc3-0x0;var _0x5c11ef=_0x0439[_0x50cfc3];return _0x5c11ef;};'use strict';var multer=require(_0x9043('0x0'));var util=require(_0x9043('0x1'));var path=require('path');var timeout=require(_0x9043('0x2'));var express=require(_0x9043('0x3'));var router=express[_0x9043('0x4')]();var auth=require(_0x9043('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x9043('0x6'));module[_0x9043('0x7')]=router; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.attributes.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.attributes.js index df1c3e9..2739c11 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 _0xa9f2=['INTEGER','STRING','Required\x20by\x20Asterisk','queue_interface','sequelize'];(function(_0x1a72f3,_0x217011){var _0x57ef47=function(_0x20123d){while(--_0x20123d){_0x1a72f3['push'](_0x1a72f3['shift']());}};_0x57ef47(++_0x217011);}(_0xa9f2,0x167));var _0x2a9f=function(_0x251de1,_0x18882b){_0x251de1=_0x251de1-0x0;var _0xe81f63=_0xa9f2[_0x251de1];return _0xe81f63;};'use strict';var Sequelize=require(_0x2a9f('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0x2a9f('0x1')],'primaryKey':!![],'autoIncrement':!![],'comment':'Required\x20by\x20Asterisk'},'membername':{'type':Sequelize[_0x2a9f('0x2')],'allowNull':![],'comment':_0x2a9f('0x3')},'UserId':{'type':Sequelize[_0x2a9f('0x1')],'allowNull':![]},'queue_name':{'type':Sequelize[_0x2a9f('0x2')],'allowNull':![],'unique':_0x2a9f('0x4'),'comment':_0x2a9f('0x3')},'VoiceQueueId':{'type':Sequelize[_0x2a9f('0x1')],'allowNull':![]},'interface':{'type':Sequelize[_0x2a9f('0x2')],'allowNull':![],'unique':'queue_interface','comment':_0x2a9f('0x3')},'penalty':{'type':Sequelize[_0x2a9f('0x1')](0xb),'defaultValue':0x0,'comment':_0x2a9f('0x3')},'paused':{'type':Sequelize[_0x2a9f('0x1')](0xb),'defaultValue':0x0,'comment':_0x2a9f('0x3')}}; \ No newline at end of file +var _0xcdf5=['exports','INTEGER','Required\x20by\x20Asterisk','STRING','queue_interface'];(function(_0x1761ce,_0x469beb){var _0xbefd63=function(_0x14bbcb){while(--_0x14bbcb){_0x1761ce['push'](_0x1761ce['shift']());}};_0xbefd63(++_0x469beb);}(_0xcdf5,0xe1));var _0x5cdf=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0xcdf5[_0x3947c9];return _0x2e7871;};'use strict';var Sequelize=require('sequelize');module[_0x5cdf('0x0')]={'uniqueid':{'type':Sequelize[_0x5cdf('0x1')],'primaryKey':!![],'autoIncrement':!![],'comment':_0x5cdf('0x2')},'membername':{'type':Sequelize['STRING'],'allowNull':![],'comment':'Required\x20by\x20Asterisk'},'UserId':{'type':Sequelize['INTEGER'],'allowNull':![]},'queue_name':{'type':Sequelize[_0x5cdf('0x3')],'allowNull':![],'unique':_0x5cdf('0x4'),'comment':_0x5cdf('0x2')},'VoiceQueueId':{'type':Sequelize['INTEGER'],'allowNull':![]},'interface':{'type':Sequelize['STRING'],'allowNull':![],'unique':'queue_interface','comment':_0x5cdf('0x2')},'penalty':{'type':Sequelize[_0x5cdf('0x1')](0xb),'defaultValue':0x0,'comment':_0x5cdf('0x2')},'paused':{'type':Sequelize[_0x5cdf('0x1')](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 e2fa182..6650300 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 _0x9400=['save','update','remove','emit','hasOwnProperty','hook','exports','events','UserVoiceQueueRt'];(function(_0x4ce3dc,_0x75cf13){var _0x2880ce=function(_0x8bd46e){while(--_0x8bd46e){_0x4ce3dc['push'](_0x4ce3dc['shift']());}};_0x2880ce(++_0x75cf13);}(_0x9400,0x15d));var _0x0940=function(_0x5d63fb,_0x5da6ab){_0x5d63fb=_0x5d63fb-0x0;var _0x5cc1d6=_0x9400[_0x5d63fb];return _0x5cc1d6;};'use strict';var EventEmitter=require(_0x0940('0x0'));var UserVoiceQueueRt=require('../../mysqldb')['db'][_0x0940('0x1')];var UserVoiceQueueRtEvents=new EventEmitter();UserVoiceQueueRtEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x0940('0x2'),'afterUpdate':_0x0940('0x3'),'afterDestroy':_0x0940('0x4')};function emitEvent(_0x47f4d9){return function(_0x556565,_0x6169fe,_0x1bc2b6){UserVoiceQueueRtEvents['emit'](_0x47f4d9+':'+_0x556565['id'],_0x556565);UserVoiceQueueRtEvents[_0x0940('0x5')](_0x47f4d9,_0x556565);_0x1bc2b6(null);};}for(var e in events){if(events[_0x0940('0x6')](e)){var event=events[e];UserVoiceQueueRt[_0x0940('0x7')](e,emitEvent(event));}}module[_0x0940('0x8')]=UserVoiceQueueRtEvents; \ No newline at end of file +var _0x1174=['exports','UserVoiceQueueRt','save','update','remove','emit','hasOwnProperty'];(function(_0x58291d,_0x106d2f){var _0x4a225a=function(_0x1638f4){while(--_0x1638f4){_0x58291d['push'](_0x58291d['shift']());}};_0x4a225a(++_0x106d2f);}(_0x1174,0xe1));var _0x4117=function(_0x3019fa,_0x39644a){_0x3019fa=_0x3019fa-0x0;var _0x553bd5=_0x1174[_0x3019fa];return _0x553bd5;};'use strict';var EventEmitter=require('events');var UserVoiceQueueRt=require('../../mysqldb')['db'][_0x4117('0x0')];var UserVoiceQueueRtEvents=new EventEmitter();UserVoiceQueueRtEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x4117('0x1'),'afterUpdate':_0x4117('0x2'),'afterDestroy':_0x4117('0x3')};function emitEvent(_0x488b2d){return function(_0x180c5f,_0x3deae4,_0x2c6f4f){UserVoiceQueueRtEvents[_0x4117('0x4')](_0x488b2d+':'+_0x180c5f['id'],_0x180c5f);UserVoiceQueueRtEvents['emit'](_0x488b2d,_0x180c5f);_0x2c6f4f(null);};}for(var e in events){if(events[_0x4117('0x5')](e)){var event=events[e];UserVoiceQueueRt['hook'](e,emitEvent(event));}}module[_0x4117('0x6')]=UserVoiceQueueRtEvents; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.model.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.model.js index 3d0a183..ea3723c 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 _0x8630=['bluebird','path','rimraf','../../config/environment','./userVoiceQueueRt.attributes','UserVoiceQueueRt','user_has_voice_queues_rt','lodash','util','api','moment'];(function(_0x385c76,_0xb97335){var _0x5c8367=function(_0xdfcd3){while(--_0xdfcd3){_0x385c76['push'](_0x385c76['shift']());}};_0x5c8367(++_0xb97335);}(_0x8630,0x11a));var _0x0863=function(_0x15250a,_0x34d6bf){_0x15250a=_0x15250a-0x0;var _0x14ec2f=_0x8630[_0x15250a];return _0x14ec2f;};'use strict';var _=require(_0x0863('0x0'));var util=require(_0x0863('0x1'));var logger=require('../../config/logger')(_0x0863('0x2'));var moment=require(_0x0863('0x3'));var BPromise=require(_0x0863('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0863('0x5'));var rimraf=require(_0x0863('0x6'));var config=require(_0x0863('0x7'));var attributes=require(_0x0863('0x8'));module['exports']=function(_0x212e13,_0x2b2cb8){return _0x212e13['define'](_0x0863('0x9'),attributes,{'tableName':_0x0863('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x44bb=['define','UserVoiceQueueRt','user_has_voice_queues_rt','lodash','util','../../config/logger','api','moment','request-promise','rimraf','../../config/environment','./userVoiceQueueRt.attributes','exports'];(function(_0x2cad5b,_0x354cc9){var _0x19a9c3=function(_0x230ef5){while(--_0x230ef5){_0x2cad5b['push'](_0x2cad5b['shift']());}};_0x19a9c3(++_0x354cc9);}(_0x44bb,0x121));var _0xb44b=function(_0xfc46f6,_0x412435){_0xfc46f6=_0xfc46f6-0x0;var _0x446e63=_0x44bb[_0xfc46f6];return _0x446e63;};'use strict';var _=require(_0xb44b('0x0'));var util=require(_0xb44b('0x1'));var logger=require(_0xb44b('0x2'))(_0xb44b('0x3'));var moment=require(_0xb44b('0x4'));var BPromise=require('bluebird');var rp=require(_0xb44b('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xb44b('0x6'));var config=require(_0xb44b('0x7'));var attributes=require(_0xb44b('0x8'));module[_0xb44b('0x9')]=function(_0x240a11,_0x3a2ce0){return _0x240a11[_0xb44b('0xa')](_0xb44b('0xb'),attributes,{'tableName':_0xb44b('0xc'),'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 8c66f94..1c6f506 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 _0x220f=['code','UserVoiceQueueRt,\x20%s,\x20%s','message','result','catch','GetVoiceQueueRtPauses','UserVoiceQueueRt','findAll','options','raw','COUNT','sequelize','literal','`paused`\x20=\x201,\x201,\x20null','outboundQueuePauses','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','./userVoiceQueueRt.socket','request','then','info','debug','UserVoiceQueueRt,\x20%s,\x20%s,\x20%s','error'];(function(_0x4ff961,_0x1c9a75){var _0x47f740=function(_0x53dea4){while(--_0x53dea4){_0x4ff961['push'](_0x4ff961['shift']());}};_0x47f740(++_0x1c9a75);}(_0x220f,0x119));var _0xf220=function(_0x35a56d,_0x4eca8a){_0x35a56d=_0x35a56d-0x0;var _0x48f18f=_0x220f[_0x35a56d];return _0x48f18f;};'use strict';var _=require(_0xf220('0x0'));var util=require(_0xf220('0x1'));var moment=require(_0xf220('0x2'));var BPromise=require(_0xf220('0x3'));var rs=require(_0xf220('0x4'));var fs=require('fs');var Redis=require(_0xf220('0x5'));var db=require(_0xf220('0x6'))['db'];var utils=require(_0xf220('0x7'));var logger=require(_0xf220('0x8'))(_0xf220('0x9'));var config=require(_0xf220('0xa'));var jayson=require(_0xf220('0xb'));var client=jayson[_0xf220('0xc')][_0xf220('0xd')]({'port':0x232a});config[_0xf220('0xe')]=_[_0xf220('0xf')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xf220('0x10'))['register'](socket);function respondWithRpcPromise(_0x3dcd1c,_0x46e442,_0x3c95fa){return new BPromise(function(_0x36bf12,_0x221758){return client[_0xf220('0x11')](_0x3dcd1c,_0x3c95fa)[_0xf220('0x12')](function(_0x2f5d1c){logger[_0xf220('0x13')]('UserVoiceQueueRt,\x20%s,\x20%s',_0x46e442,'request\x20sent');logger[_0xf220('0x14')](_0xf220('0x15'),_0x46e442,'request\x20sent',JSON['stringify'](_0x2f5d1c));if(_0x2f5d1c['error']){if(_0x2f5d1c[_0xf220('0x16')][_0xf220('0x17')]===0x1f4){logger[_0xf220('0x16')](_0xf220('0x18'),_0x46e442,_0x2f5d1c['error'][_0xf220('0x19')]);return _0x221758(_0x2f5d1c[_0xf220('0x16')][_0xf220('0x19')]);}logger[_0xf220('0x16')](_0xf220('0x18'),_0x46e442,_0x2f5d1c[_0xf220('0x16')][_0xf220('0x19')]);return _0x36bf12(_0x2f5d1c['error'][_0xf220('0x19')]);}else{logger[_0xf220('0x13')](_0xf220('0x18'),_0x46e442,'request\x20sent');_0x36bf12(_0x2f5d1c[_0xf220('0x1a')][_0xf220('0x19')]);}})[_0xf220('0x1b')](function(_0x520b04){logger['error'](_0xf220('0x18'),_0x46e442,_0x520b04);_0x221758(_0x520b04);});});}exports[_0xf220('0x1c')]=function(_0x2b0573){var _0x2b3f4f=this;return new Promise(function(_0x44eadd,_0x4d6f59){return db[_0xf220('0x1d')][_0xf220('0x1e')]({'raw':_0x2b0573[_0xf220('0x1f')]?_0x2b0573['options'][_0xf220('0x20')]===undefined?!![]:![]:!![],'where':_0x2b0573[_0xf220('0x1f')]?_0x2b0573[_0xf220('0x1f')]['where']||null:null,'attributes':[[db['sequelize']['fn'](_0xf220('0x21'),db[_0xf220('0x22')]['fn']('IF',db['sequelize'][_0xf220('0x23')](_0xf220('0x24')))),_0xf220('0x25')]]})['then'](function(_0x379021){logger['info']('GetVoiceQueueRtPauses',_0x2b0573);logger[_0xf220('0x14')](_0xf220('0x1c'),_0x2b0573,JSON['stringify'](_0x379021));_0x44eadd(_0x379021);})[_0xf220('0x1b')](function(_0x3deb86){logger[_0xf220('0x16')]('GetVoiceQueueRtPauses',_0x3deb86[_0xf220('0x19')],_0x2b0573);_0x4d6f59(_0x2b3f4f['error'](0x1f4,_0x3deb86[_0xf220('0x19')]));});});}; \ No newline at end of file +var _0xa6c9=['request\x20sent','debug','UserVoiceQueueRt,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','GetVoiceQueueRtPauses','UserVoiceQueueRt','findAll','options','raw','where','sequelize','COUNT','literal','`paused`\x20=\x201,\x201,\x20null','outboundQueuePauses','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','redis','defaults','socket.io-emitter','./userVoiceQueueRt.socket','request','then','info','UserVoiceQueueRt,\x20%s,\x20%s'];(function(_0x1f12fa,_0x298d5e){var _0x5b1d6d=function(_0x41f973){while(--_0x41f973){_0x1f12fa['push'](_0x1f12fa['shift']());}};_0x5b1d6d(++_0x298d5e);}(_0xa6c9,0x1b5));var _0x9a6c=function(_0x7573ea,_0x22963c){_0x7573ea=_0x7573ea-0x0;var _0x47cae7=_0xa6c9[_0x7573ea];return _0x47cae7;};'use strict';var _=require(_0x9a6c('0x0'));var util=require(_0x9a6c('0x1'));var moment=require(_0x9a6c('0x2'));var BPromise=require(_0x9a6c('0x3'));var rs=require(_0x9a6c('0x4'));var fs=require('fs');var Redis=require(_0x9a6c('0x5'));var db=require(_0x9a6c('0x6'))['db'];var utils=require(_0x9a6c('0x7'));var logger=require(_0x9a6c('0x8'))('rpc');var config=require('../../config/environment');var jayson=require(_0x9a6c('0x9'));var client=jayson[_0x9a6c('0xa')]['http']({'port':0x232a});config[_0x9a6c('0xb')]=_[_0x9a6c('0xc')](config[_0x9a6c('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0x9a6c('0xd'))(new Redis(config[_0x9a6c('0xb')]));require(_0x9a6c('0xe'))['register'](socket);function respondWithRpcPromise(_0x38e528,_0x4209d8,_0x2f2ee4){return new BPromise(function(_0x4072a5,_0x5ea596){return client[_0x9a6c('0xf')](_0x38e528,_0x2f2ee4)[_0x9a6c('0x10')](function(_0x4d6a21){logger[_0x9a6c('0x11')](_0x9a6c('0x12'),_0x4209d8,_0x9a6c('0x13'));logger[_0x9a6c('0x14')](_0x9a6c('0x15'),_0x4209d8,_0x9a6c('0x13'),JSON[_0x9a6c('0x16')](_0x4d6a21));if(_0x4d6a21['error']){if(_0x4d6a21[_0x9a6c('0x17')][_0x9a6c('0x18')]===0x1f4){logger[_0x9a6c('0x17')](_0x9a6c('0x12'),_0x4209d8,_0x4d6a21[_0x9a6c('0x17')][_0x9a6c('0x19')]);return _0x5ea596(_0x4d6a21[_0x9a6c('0x17')][_0x9a6c('0x19')]);}logger[_0x9a6c('0x17')](_0x9a6c('0x12'),_0x4209d8,_0x4d6a21['error']['message']);return _0x4072a5(_0x4d6a21[_0x9a6c('0x17')]['message']);}else{logger[_0x9a6c('0x11')](_0x9a6c('0x12'),_0x4209d8,_0x9a6c('0x13'));_0x4072a5(_0x4d6a21['result'][_0x9a6c('0x19')]);}})[_0x9a6c('0x1a')](function(_0x5a9587){logger[_0x9a6c('0x17')](_0x9a6c('0x12'),_0x4209d8,_0x5a9587);_0x5ea596(_0x5a9587);});});}exports[_0x9a6c('0x1b')]=function(_0x429dbb){var _0x4bf5a7=this;return new Promise(function(_0x281d7b,_0x130c0d){return db[_0x9a6c('0x1c')][_0x9a6c('0x1d')]({'raw':_0x429dbb['options']?_0x429dbb[_0x9a6c('0x1e')][_0x9a6c('0x1f')]===undefined?!![]:![]:!![],'where':_0x429dbb['options']?_0x429dbb[_0x9a6c('0x1e')][_0x9a6c('0x20')]||null:null,'attributes':[[db[_0x9a6c('0x21')]['fn'](_0x9a6c('0x22'),db[_0x9a6c('0x21')]['fn']('IF',db['sequelize'][_0x9a6c('0x23')](_0x9a6c('0x24')))),_0x9a6c('0x25')]]})[_0x9a6c('0x10')](function(_0x426494){logger[_0x9a6c('0x11')]('GetVoiceQueueRtPauses',_0x429dbb);logger[_0x9a6c('0x14')](_0x9a6c('0x1b'),_0x429dbb,JSON[_0x9a6c('0x16')](_0x426494));_0x281d7b(_0x426494);})['catch'](function(_0x31e351){logger[_0x9a6c('0x17')](_0x9a6c('0x1b'),_0x31e351[_0x9a6c('0x19')],_0x429dbb);_0x130c0d(_0x4bf5a7[_0x9a6c('0x17')](0x1f4,_0x31e351[_0x9a6c('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.socket.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.socket.js index f796ca9..fe38814 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 _0xa347=['update','emit','removeListener','register','length','userVoiceQueueRt:','./userVoiceQueueRt.events','save','remove'];(function(_0x5b79b0,_0x4faca4){var _0x31348d=function(_0x324ec7){while(--_0x324ec7){_0x5b79b0['push'](_0x5b79b0['shift']());}};_0x31348d(++_0x4faca4);}(_0xa347,0x8d));var _0x7a34=function(_0x7148b6,_0xa61534){_0x7148b6=_0x7148b6-0x0;var _0x111019=_0xa347[_0x7148b6];return _0x111019;};'use strict';var UserVoiceQueueRtEvents=require(_0x7a34('0x0'));var events=[_0x7a34('0x1'),_0x7a34('0x2'),_0x7a34('0x3')];function createListener(_0x410579,_0x1e1439){return function(_0x588395){_0x1e1439[_0x7a34('0x4')](_0x410579,_0x588395);};}function removeListener(_0x36b873,_0x6f8217){return function(){UserVoiceQueueRtEvents[_0x7a34('0x5')](_0x36b873,_0x6f8217);};}exports[_0x7a34('0x6')]=function(_0x2f9135){for(var _0x1fee17=0x0,_0x5a8e1d=events[_0x7a34('0x7')];_0x1fee17<_0x5a8e1d;_0x1fee17++){var _0x4d29b5=events[_0x1fee17];var _0x1cbaf8=createListener(_0x7a34('0x8')+_0x4d29b5,_0x2f9135);UserVoiceQueueRtEvents['on'](_0x4d29b5,_0x1cbaf8);}}; \ No newline at end of file +var _0xf8a1=['remove','update','emit','removeListener','register','./userVoiceQueueRt.events'];(function(_0x3bcd1d,_0x35f2e8){var _0x23fae1=function(_0x4b4f79){while(--_0x4b4f79){_0x3bcd1d['push'](_0x3bcd1d['shift']());}};_0x23fae1(++_0x35f2e8);}(_0xf8a1,0x143));var _0x1f8a=function(_0x20bb9f,_0x339db0){_0x20bb9f=_0x20bb9f-0x0;var _0x51fc1f=_0xf8a1[_0x20bb9f];return _0x51fc1f;};'use strict';var UserVoiceQueueRtEvents=require(_0x1f8a('0x0'));var events=['save',_0x1f8a('0x1'),_0x1f8a('0x2')];function createListener(_0x13981f,_0x46a99c){return function(_0x4fd3e2){_0x46a99c[_0x1f8a('0x3')](_0x13981f,_0x4fd3e2);};}function removeListener(_0x4feca9,_0x3ee915){return function(){UserVoiceQueueRtEvents[_0x1f8a('0x4')](_0x4feca9,_0x3ee915);};}exports[_0x1f8a('0x5')]=function(_0x453606){for(var _0x46bc88=0x0,_0x36ee3a=events['length'];_0x46bc88<_0x36ee3a;_0x46bc88++){var _0x5c7c71=events[_0x46bc88];var _0x53b485=createListener('userVoiceQueueRt:'+_0x5c7c71,_0x453606);UserVoiceQueueRtEvents['on'](_0x5c7c71,_0x53b485);}}; \ No newline at end of file diff --git a/server/api/userWhatsappQueue/index.js b/server/api/userWhatsappQueue/index.js index d99f152..a857584 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 _0x7d3b=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','exports','multer','util','path','connect-timeout'];(function(_0x559139,_0xcd4ac8){var _0x6f712c=function(_0x5bbbf9){while(--_0x5bbbf9){_0x559139['push'](_0x559139['shift']());}};_0x6f712c(++_0xcd4ac8);}(_0x7d3b,0x188));var _0xb7d3=function(_0x357caf,_0x444155){_0x357caf=_0x357caf-0x0;var _0x12284b=_0x7d3b[_0x357caf];return _0x12284b;};'use strict';var multer=require(_0xb7d3('0x0'));var util=require(_0xb7d3('0x1'));var path=require(_0xb7d3('0x2'));var timeout=require(_0xb7d3('0x3'));var express=require('express');var router=express[_0xb7d3('0x4')]();var auth=require(_0xb7d3('0x5'));var interaction=require(_0xb7d3('0x6'));var config=require(_0xb7d3('0x7'));module[_0xb7d3('0x8')]=router; \ No newline at end of file +var _0xe257=['util','path','express','../../components/auth/service','../../components/interaction/service','../../config/environment','multer'];(function(_0x414103,_0x350dcd){var _0x24e69a=function(_0x349fbd){while(--_0x349fbd){_0x414103['push'](_0x414103['shift']());}};_0x24e69a(++_0x350dcd);}(_0xe257,0x110));var _0x7e25=function(_0x4c7d8b,_0x572388){_0x4c7d8b=_0x4c7d8b-0x0;var _0x187158=_0xe257[_0x4c7d8b];return _0x187158;};'use strict';var multer=require(_0x7e25('0x0'));var util=require(_0x7e25('0x1'));var path=require(_0x7e25('0x2'));var timeout=require('connect-timeout');var express=require(_0x7e25('0x3'));var router=express['Router']();var auth=require(_0x7e25('0x4'));var interaction=require(_0x7e25('0x5'));var config=require(_0x7e25('0x6'));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 7ed6149..0fd15bc 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 _0xbaf0=['exports','INTEGER'];(function(_0x7d4dc8,_0x14d70e){var _0x20b216=function(_0x3575b0){while(--_0x3575b0){_0x7d4dc8['push'](_0x7d4dc8['shift']());}};_0x20b216(++_0x14d70e);}(_0xbaf0,0x12a));var _0x0baf=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0xbaf0[_0x501510];return _0x1e6ee5;};'use strict';var Sequelize=require('sequelize');module[_0x0baf('0x0')]={'penalty':{'type':Sequelize[_0x0baf('0x1')],'defaultValue':0x0}}; \ No newline at end of file +var _0xa9e0=['sequelize','exports','INTEGER'];(function(_0x27eba8,_0x37ae38){var _0x49044c=function(_0x2d42f5){while(--_0x2d42f5){_0x27eba8['push'](_0x27eba8['shift']());}};_0x49044c(++_0x37ae38);}(_0xa9e0,0x123));var _0x0a9e=function(_0xf0bcac,_0x531755){_0xf0bcac=_0xf0bcac-0x0;var _0x4e4c65=_0xa9e0[_0xf0bcac];return _0x4e4c65;};'use strict';var Sequelize=require(_0x0a9e('0x0'));module[_0x0a9e('0x1')]={'penalty':{'type':Sequelize[_0x0a9e('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 47e1f49..f44142f 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 _0xb2ef=['UserWhatsappQueue','user_has_whatsapp_queues','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','./userWhatsappQueue.attributes','exports','define'];(function(_0x4f0fab,_0x1e487c){var _0x1bfc05=function(_0x5c5135){while(--_0x5c5135){_0x4f0fab['push'](_0x4f0fab['shift']());}};_0x1bfc05(++_0x1e487c);}(_0xb2ef,0x17b));var _0xfb2e=function(_0x506e8a,_0x1225ba){_0x506e8a=_0x506e8a-0x0;var _0x6f5616=_0xb2ef[_0x506e8a];return _0x6f5616;};'use strict';var _=require(_0xfb2e('0x0'));var util=require(_0xfb2e('0x1'));var logger=require(_0xfb2e('0x2'))(_0xfb2e('0x3'));var moment=require(_0xfb2e('0x4'));var BPromise=require(_0xfb2e('0x5'));var rp=require(_0xfb2e('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xfb2e('0x7'));var config=require('../../config/environment');var attributes=require(_0xfb2e('0x8'));module[_0xfb2e('0x9')]=function(_0x200201,_0x226bee){return _0x200201[_0xfb2e('0xa')](_0xfb2e('0xb'),attributes,{'tableName':_0xfb2e('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd828=['define','user_has_whatsapp_queues','lodash','util','api','bluebird','path','rimraf','../../config/environment','./userWhatsappQueue.attributes'];(function(_0x46a59e,_0x4bf9ff){var _0x35aae0=function(_0x2ff6ae){while(--_0x2ff6ae){_0x46a59e['push'](_0x46a59e['shift']());}};_0x35aae0(++_0x4bf9ff);}(_0xd828,0x17e));var _0x8d82=function(_0x33d359,_0x258114){_0x33d359=_0x33d359-0x0;var _0x17fa43=_0xd828[_0x33d359];return _0x17fa43;};'use strict';var _=require(_0x8d82('0x0'));var util=require(_0x8d82('0x1'));var logger=require('../../config/logger')(_0x8d82('0x2'));var moment=require('moment');var BPromise=require(_0x8d82('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x8d82('0x4'));var rimraf=require(_0x8d82('0x5'));var config=require(_0x8d82('0x6'));var attributes=require(_0x8d82('0x7'));module['exports']=function(_0x489ab5,_0x539d47){return _0x489ab5[_0x8d82('0x8')]('UserWhatsappQueue',attributes,{'tableName':_0x8d82('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userWhatsappQueue/userWhatsappQueue.rpc.js b/server/api/userWhatsappQueue/userWhatsappQueue.rpc.js index 679b5a6..9cb102e 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(_0x576fa3,_0x543cf5){var _0x259c59=function(_0x3f083c){while(--_0x3f083c){_0x576fa3['push'](_0x576fa3['shift']());}};_0x259c59(++_0x543cf5);}(_0xa9e0,0x123));var _0x0a9e=function(_0x34bc30,_0x177cb0){_0x34bc30=_0x34bc30-0x0;var _0x5706de=_0xa9e0[_0x34bc30];return _0x5706de;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a9e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var config=require(_0x0a9e('0x7'));var jayson=require(_0x0a9e('0x8'));var client=jayson['client'][_0x0a9e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x441e3a,_0x2cc193,_0x5f41ea){return new BPromise(function(_0x503809,_0xe42b77){return client['request'](_0x441e3a,_0x5f41ea)['then'](function(_0x39753a){logger[_0x0a9e('0xa')](_0x0a9e('0xb'),_0x2cc193,_0x0a9e('0xc'));logger[_0x0a9e('0xd')](_0x0a9e('0xe'),_0x2cc193,'request\x20sent',JSON['stringify'](_0x39753a));if(_0x39753a['error']){if(_0x39753a['error'][_0x0a9e('0xf')]===0x1f4){logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0xe42b77(_0x39753a[_0x0a9e('0x10')]['message']);}logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0x503809(_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);}else{logger['info'](_0x0a9e('0xb'),_0x2cc193,'request\x20sent');_0x503809(_0x39753a[_0x0a9e('0x12')]['message']);}})[_0x0a9e('0x13')](function(_0x12066b){logger['error'](_0x0a9e('0xb'),_0x2cc193,_0x12066b);_0xe42b77(_0x12066b);});});} \ 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(_0x16dd7a,_0xd8e853){var _0x3d7429=function(_0x1246b0){while(--_0x1246b0){_0x16dd7a['push'](_0x16dd7a['shift']());}};_0x3d7429(++_0xd8e853);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2b10c6,_0x185590){_0x2b10c6=_0x2b10c6-0x0;var _0x3789d2=_0xa9e0[_0x2b10c6];return _0x3789d2;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a9e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var config=require(_0x0a9e('0x7'));var jayson=require(_0x0a9e('0x8'));var client=jayson['client'][_0x0a9e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x441e3a,_0x2cc193,_0x5f41ea){return new BPromise(function(_0x503809,_0xe42b77){return client['request'](_0x441e3a,_0x5f41ea)['then'](function(_0x39753a){logger[_0x0a9e('0xa')](_0x0a9e('0xb'),_0x2cc193,_0x0a9e('0xc'));logger[_0x0a9e('0xd')](_0x0a9e('0xe'),_0x2cc193,'request\x20sent',JSON['stringify'](_0x39753a));if(_0x39753a['error']){if(_0x39753a['error'][_0x0a9e('0xf')]===0x1f4){logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0xe42b77(_0x39753a[_0x0a9e('0x10')]['message']);}logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0x503809(_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);}else{logger['info'](_0x0a9e('0xb'),_0x2cc193,'request\x20sent');_0x503809(_0x39753a[_0x0a9e('0x12')]['message']);}})[_0x0a9e('0x13')](function(_0x12066b){logger['error'](_0x0a9e('0xb'),_0x2cc193,_0x12066b);_0xe42b77(_0x12066b);});});} \ No newline at end of file diff --git a/server/api/variable/index.js b/server/api/variable/index.js index 1a4ec9e..9c25105 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 _0xfdb0=['Router','../../components/interaction/service','../../config/environment','./variable.controller','get','index','/:id','isAuthenticated','post','create','put','update','destroy','exports','multer','util','path','connect-timeout','express'];(function(_0x33f669,_0x279fce){var _0x55fa39=function(_0x21b9d8){while(--_0x21b9d8){_0x33f669['push'](_0x33f669['shift']());}};_0x55fa39(++_0x279fce);}(_0xfdb0,0x1d6));var _0x0fdb=function(_0x3df539,_0x2e1a0a){_0x3df539=_0x3df539-0x0;var _0x19e83a=_0xfdb0[_0x3df539];return _0x19e83a;};'use strict';var multer=require(_0x0fdb('0x0'));var util=require(_0x0fdb('0x1'));var path=require(_0x0fdb('0x2'));var timeout=require(_0x0fdb('0x3'));var express=require(_0x0fdb('0x4'));var router=express[_0x0fdb('0x5')]();var auth=require('../../components/auth/service');var interaction=require(_0x0fdb('0x6'));var config=require(_0x0fdb('0x7'));var controller=require(_0x0fdb('0x8'));router[_0x0fdb('0x9')]('/',auth['isAuthenticated'](),controller[_0x0fdb('0xa')]);router[_0x0fdb('0x9')](_0x0fdb('0xb'),auth[_0x0fdb('0xc')](),controller['show']);router[_0x0fdb('0xd')]('/',auth[_0x0fdb('0xc')](),controller[_0x0fdb('0xe')]);router[_0x0fdb('0xf')]('/:id',auth[_0x0fdb('0xc')](),controller[_0x0fdb('0x10')]);router['delete'](_0x0fdb('0xb'),auth[_0x0fdb('0xc')](),controller[_0x0fdb('0x11')]);module[_0x0fdb('0x12')]=router; \ No newline at end of file +var _0xf5a1=['../../components/interaction/service','./variable.controller','get','index','/:id','show','post','isAuthenticated','create','update','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service'];(function(_0x474035,_0x41e639){var _0x1b58e0=function(_0x91b15c){while(--_0x91b15c){_0x474035['push'](_0x474035['shift']());}};_0x1b58e0(++_0x41e639);}(_0xf5a1,0x129));var _0x1f5a=function(_0x3febc2,_0x54bd7b){_0x3febc2=_0x3febc2-0x0;var _0x4db519=_0xf5a1[_0x3febc2];return _0x4db519;};'use strict';var multer=require(_0x1f5a('0x0'));var util=require(_0x1f5a('0x1'));var path=require(_0x1f5a('0x2'));var timeout=require(_0x1f5a('0x3'));var express=require(_0x1f5a('0x4'));var router=express[_0x1f5a('0x5')]();var auth=require(_0x1f5a('0x6'));var interaction=require(_0x1f5a('0x7'));var config=require('../../config/environment');var controller=require(_0x1f5a('0x8'));router[_0x1f5a('0x9')]('/',auth['isAuthenticated'](),controller[_0x1f5a('0xa')]);router[_0x1f5a('0x9')](_0x1f5a('0xb'),auth['isAuthenticated'](),controller[_0x1f5a('0xc')]);router[_0x1f5a('0xd')]('/',auth[_0x1f5a('0xe')](),controller[_0x1f5a('0xf')]);router['put']('/:id',auth['isAuthenticated'](),controller[_0x1f5a('0x10')]);router['delete'](_0x1f5a('0xb'),auth[_0x1f5a('0xe')](),controller[_0x1f5a('0x11')]);module[_0x1f5a('0x12')]=router; \ No newline at end of file diff --git a/server/api/variable/variable.attributes.js b/server/api/variable/variable.attributes.js index 67d1432..6f24c53 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 _0x85a1=['exports','STRING','sequelize'];(function(_0x566901,_0x4ae7f9){var _0x264942=function(_0x3af8f1){while(--_0x3af8f1){_0x566901['push'](_0x566901['shift']());}};_0x264942(++_0x4ae7f9);}(_0x85a1,0x194));var _0x185a=function(_0x1fd492,_0x9503e9){_0x1fd492=_0x1fd492-0x0;var _0x11da0e=_0x85a1[_0x1fd492];return _0x11da0e;};'use strict';var Sequelize=require(_0x185a('0x0'));module[_0x185a('0x1')]={'name':{'type':Sequelize[_0x185a('0x2')],'unique':'name','allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x185a('0x2')]}}; \ No newline at end of file +var _0x2950=['name','sequelize','exports','STRING'];(function(_0x1f5bf5,_0x57b037){var _0xa86bf=function(_0x445448){while(--_0x445448){_0x1f5bf5['push'](_0x1f5bf5['shift']());}};_0xa86bf(++_0x57b037);}(_0x2950,0x1d1));var _0x0295=function(_0x1ec48d,_0x4f5448){_0x1ec48d=_0x1ec48d-0x0;var _0xa8e823=_0x2950[_0x1ec48d];return _0xa8e823;};'use strict';var Sequelize=require(_0x0295('0x0'));module[_0x0295('0x1')]={'name':{'type':Sequelize[_0x0295('0x2')],'unique':_0x0295('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x0295('0x2')]}}; \ No newline at end of file diff --git a/server/api/variable/variable.controller.js b/server/api/variable/variable.controller.js index dac2db7..39964c5 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 _0x49b9=['ejs','lodash','squel','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../mysqldb','sendStatus','status','end','count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','Variables','error','send','map','rawAttributes','fieldName','key','model','name','query','keys','filters','intersection','attributes','hasOwnProperty','nolimit','order','sort','pick','filter','merge','where','VIRTUAL','Variable','include','findAll','show','params','fields','length','options','catch','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','get','find','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv'];(function(_0x5e734d,_0x104071){var _0xeae2eb=function(_0x1b01b7){while(--_0x1b01b7){_0x5e734d['push'](_0x5e734d['shift']());}};_0xeae2eb(++_0x104071);}(_0x49b9,0x1da));var _0x949b=function(_0x1bd7ef,_0x1ba909){_0x1bd7ef=_0x1bd7ef-0x0;var _0x20072c=_0x49b9[_0x1bd7ef];return _0x20072c;};'use strict';var pdf=require(_0x949b('0x0'));var emlformat=require(_0x949b('0x1'));var rimraf=require(_0x949b('0x2'));var zipdir=require(_0x949b('0x3'));var jsonpatch=require(_0x949b('0x4'));var rp=require(_0x949b('0x5'));var moment=require(_0x949b('0x6'));var BPromise=require('bluebird');var Mustache=require(_0x949b('0x7'));var util=require(_0x949b('0x8'));var path=require(_0x949b('0x9'));var sox=require(_0x949b('0xa'));var csv=require(_0x949b('0xb'));var ejs=require(_0x949b('0xc'));var fs=require('fs');var _=require(_0x949b('0xd'));var squel=require(_0x949b('0xe'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x949b('0xf'));var toCsv=require(_0x949b('0xb'));var querystring=require(_0x949b('0x10'));var Papa=require('papaparse');var Redis=require(_0x949b('0x11'));var authService=require(_0x949b('0x12'));var qs=require(_0x949b('0x13'));var as=require(_0x949b('0x14'));var hardwareService=require(_0x949b('0x15'));var logger=require(_0x949b('0x16'))('api');var utils=require(_0x949b('0x17'));var config=require('../../config/environment');var db=require(_0x949b('0x18'))['db'];function respondWithStatusCode(_0x778ae3,_0x7462cd){_0x7462cd=_0x7462cd||0xcc;return function(_0x3a9071){if(_0x3a9071){return _0x778ae3[_0x949b('0x19')](_0x7462cd);}return _0x778ae3[_0x949b('0x1a')](_0x7462cd)[_0x949b('0x1b')]();};}function respondWithResult(_0x2d5ffc,_0x5a4542){_0x5a4542=_0x5a4542||0xc8;return function(_0x397bd2){if(_0x397bd2){return _0x2d5ffc[_0x949b('0x1a')](_0x5a4542)['json'](_0x397bd2);}};}function respondWithFilteredResult(_0x3a997d,_0x32c9b8){return function(_0x35e3a2){if(_0x35e3a2){var _0x1726c5=_0x35e3a2[_0x949b('0x1c')],_0x36ef3c=_0x32c9b8['offset'],_0xb099ca=_0x32c9b8[_0x949b('0x1d')]+_0x32c9b8[_0x949b('0x1e')],_0x4b8ea9;if(_0xb099ca>=_0x1726c5){_0xb099ca=_0x1726c5;_0x4b8ea9=0xc8;}else{_0x4b8ea9=0xce;}_0x3a997d[_0x949b('0x1a')](_0x4b8ea9);return _0x3a997d[_0x949b('0x1f')](_0x949b('0x20'),_0x36ef3c+'-'+_0xb099ca+'/'+_0x1726c5)['json'](_0x35e3a2);}return null;};}function patchUpdates(_0x4f15b2){return function(_0x44ada8){try{jsonpatch[_0x949b('0x21')](_0x44ada8,_0x4f15b2,!![]);}catch(_0x37926f){return BPromise[_0x949b('0x22')](_0x37926f);}return _0x44ada8[_0x949b('0x23')]();};}function saveUpdates(_0x48f6a3,_0x4f6ece){return function(_0x5b908f){if(_0x5b908f){return _0x5b908f[_0x949b('0x24')](_0x48f6a3)[_0x949b('0x25')](function(_0x4f1e2f){return _0x4f1e2f;});}return null;};}function removeEntity(_0x3c6c9b,_0x1ed213){return function(_0x1a8ed3){if(_0x1a8ed3){return _0x1a8ed3[_0x949b('0x26')]()[_0x949b('0x25')](function(){var _0x5b7b9e=_0x1a8ed3['get']({'plain':!![]});var _0x4126d1=_0x949b('0x27');return db['UserProfileResource']['destroy']({'where':{'type':_0x4126d1,'resourceId':_0x5b7b9e['id']}})[_0x949b('0x25')](function(){return _0x1a8ed3;});})['then'](function(){_0x3c6c9b['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x3c8139,_0x247c1e){return function(_0x9d6137){if(!_0x9d6137){_0x3c8139[_0x949b('0x19')](0x194);}return _0x9d6137;};}function handleError(_0x51d480,_0x2a79f5){_0x2a79f5=_0x2a79f5||0x1f4;return function(_0x51f221){logger[_0x949b('0x28')](_0x51f221['stack']);if(_0x51f221['name']){delete _0x51f221['name'];}_0x51d480[_0x949b('0x1a')](_0x2a79f5)[_0x949b('0x29')](_0x51f221);};}exports['index']=function(_0x49e151,_0x38d41b){var _0x24a749={},_0x3c23fa={},_0x3e2495={'count':0x0,'rows':[]};var _0x4587d5=_[_0x949b('0x2a')](db['Variable'][_0x949b('0x2b')],function(_0x5c0a76){return{'name':_0x5c0a76[_0x949b('0x2c')],'type':_0x5c0a76['type'][_0x949b('0x2d')]};});_0x3c23fa[_0x949b('0x2e')]=_['map'](_0x4587d5,_0x949b('0x2f'));_0x3c23fa[_0x949b('0x30')]=_[_0x949b('0x31')](_0x49e151[_0x949b('0x30')]);_0x3c23fa[_0x949b('0x32')]=_[_0x949b('0x33')](_0x3c23fa[_0x949b('0x2e')],_0x3c23fa['query']);_0x24a749['attributes']=_['intersection'](_0x3c23fa[_0x949b('0x2e')],qs['fields'](_0x49e151['query']['fields']));_0x24a749[_0x949b('0x34')]=_0x24a749[_0x949b('0x34')]['length']?_0x24a749[_0x949b('0x34')]:_0x3c23fa[_0x949b('0x2e')];if(!_0x49e151['query'][_0x949b('0x35')](_0x949b('0x36'))){_0x24a749['limit']=qs['limit'](_0x49e151[_0x949b('0x30')][_0x949b('0x1e')]);_0x24a749[_0x949b('0x1d')]=qs['offset'](_0x49e151[_0x949b('0x30')]['offset']);}_0x24a749[_0x949b('0x37')]=qs[_0x949b('0x38')](_0x49e151['query'][_0x949b('0x38')]);_0x24a749['where']=qs['filters'](_[_0x949b('0x39')](_0x49e151[_0x949b('0x30')],_0x3c23fa['filters']),_0x4587d5);if(_0x49e151[_0x949b('0x30')][_0x949b('0x3a')]){_0x24a749['where']=_[_0x949b('0x3b')](_0x24a749[_0x949b('0x3c')],{'$or':_[_0x949b('0x2a')](_0x4587d5,function(_0x3f4e03){if(_0x3f4e03['type']!==_0x949b('0x3d')){var _0x3a6c3c={};_0x3a6c3c[_0x3f4e03[_0x949b('0x2f')]]={'$like':'%'+_0x49e151[_0x949b('0x30')][_0x949b('0x3a')]+'%'};return _0x3a6c3c;}})});}_0x24a749=_[_0x949b('0x3b')]({},_0x24a749,_0x49e151['options']);var _0x1a2fa1={'where':_0x24a749[_0x949b('0x3c')]};return db[_0x949b('0x3e')][_0x949b('0x1c')](_0x1a2fa1)[_0x949b('0x25')](function(_0x3b6350){_0x3e2495['count']=_0x3b6350;if(_0x49e151['query']['includeAll']){_0x24a749[_0x949b('0x3f')]=[{'all':!![]}];}return db[_0x949b('0x3e')][_0x949b('0x40')](_0x24a749);})['then'](function(_0x43d73f){_0x3e2495['rows']=_0x43d73f;return _0x3e2495;})[_0x949b('0x25')](respondWithFilteredResult(_0x38d41b,_0x24a749))['catch'](handleError(_0x38d41b,null));};exports[_0x949b('0x41')]=function(_0x5cafff,_0x2c7604){var _0x22b262={'raw':!![],'where':{'id':_0x5cafff[_0x949b('0x42')]['id']}},_0x1e0444={};_0x1e0444['model']=_[_0x949b('0x31')](db[_0x949b('0x3e')][_0x949b('0x2b')]);_0x1e0444['query']=_['keys'](_0x5cafff[_0x949b('0x30')]);_0x1e0444[_0x949b('0x32')]=_[_0x949b('0x33')](_0x1e0444['model'],_0x1e0444['query']);_0x22b262[_0x949b('0x34')]=_[_0x949b('0x33')](_0x1e0444[_0x949b('0x2e')],qs[_0x949b('0x43')](_0x5cafff['query'][_0x949b('0x43')]));_0x22b262['attributes']=_0x22b262[_0x949b('0x34')][_0x949b('0x44')]?_0x22b262[_0x949b('0x34')]:_0x1e0444[_0x949b('0x2e')];if(_0x5cafff[_0x949b('0x30')]['includeAll']){_0x22b262[_0x949b('0x3f')]=[{'all':!![]}];}_0x22b262=_[_0x949b('0x3b')]({},_0x22b262,_0x5cafff[_0x949b('0x45')]);return db['Variable']['find'](_0x22b262)[_0x949b('0x25')](handleEntityNotFound(_0x2c7604,null))[_0x949b('0x25')](respondWithResult(_0x2c7604,null))[_0x949b('0x46')](handleError(_0x2c7604,null));};exports[_0x949b('0x47')]=function(_0x45a6ea,_0x550bc1){return db[_0x949b('0x3e')][_0x949b('0x47')](_0x45a6ea['body'],{})[_0x949b('0x25')](function(_0x3bc313){var _0x238674=_0x45a6ea['user']['get']({'plain':!![]});if(!_0x238674)throw new Error(_0x949b('0x48'));if(_0x238674[_0x949b('0x49')]==='user'){var _0x32d301=_0x3bc313[_0x949b('0x4a')]({'plain':!![]});var _0x40691a='Variables';return db['UserProfileSection'][_0x949b('0x4b')]({'where':{'name':_0x40691a,'userProfileId':_0x238674[_0x949b('0x4c')]},'raw':!![]})[_0x949b('0x25')](function(_0x5f0110){if(_0x5f0110&&_0x5f0110[_0x949b('0x4d')]===0x0){return db[_0x949b('0x4e')]['create']({'name':_0x32d301[_0x949b('0x2f')],'resourceId':_0x32d301['id'],'type':_0x5f0110[_0x949b('0x2f')],'sectionId':_0x5f0110['id']},{})[_0x949b('0x25')](function(){return _0x3bc313;});}else{return _0x3bc313;}})[_0x949b('0x46')](function(_0x485545){logger[_0x949b('0x28')](_0x949b('0x4f'),_0x485545);throw _0x485545;});}return _0x3bc313;})[_0x949b('0x25')](respondWithResult(_0x550bc1,0xc9))['catch'](handleError(_0x550bc1,null));};exports[_0x949b('0x24')]=function(_0x418c13,_0xd782c9){if(_0x418c13['body']['id']){delete _0x418c13[_0x949b('0x50')]['id'];}return db[_0x949b('0x3e')]['find']({'where':{'id':_0x418c13[_0x949b('0x42')]['id']}})[_0x949b('0x25')](handleEntityNotFound(_0xd782c9,null))[_0x949b('0x25')](saveUpdates(_0x418c13[_0x949b('0x50')],null))[_0x949b('0x25')](respondWithResult(_0xd782c9,null))['catch'](handleError(_0xd782c9,null));};exports['destroy']=function(_0x57c6f9,_0x4d7d69){return db[_0x949b('0x3e')]['find']({'where':{'id':_0x57c6f9[_0x949b('0x42')]['id']}})[_0x949b('0x25')](handleEntityNotFound(_0x4d7d69,null))['then'](removeEntity(_0x4d7d69,null))[_0x949b('0x46')](handleError(_0x4d7d69,null));}; \ No newline at end of file +var _0x5e60=['limit','set','Content-Range','apply','reject','save','update','then','destroy','get','UserProfileResource','end','stack','name','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','order','sort','where','filter','merge','VIRTUAL','options','Variable','rows','catch','includeAll','include','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Variables','UserProfileSection','userProfileId','autoAssociation','error','params','eml-format','rimraf','zip-dir','request-promise','bluebird','util','sox','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','count','offset'];(function(_0x1f36bb,_0x8af718){var _0xaf97fa=function(_0xeca489){while(--_0xeca489){_0x1f36bb['push'](_0x1f36bb['shift']());}};_0xaf97fa(++_0x8af718);}(_0x5e60,0x179));var _0x05e6=function(_0x91d9dd,_0x571d3b){_0x91d9dd=_0x91d9dd-0x0;var _0x4f0a02=_0x5e60[_0x91d9dd];return _0x4f0a02;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x05e6('0x0'));var rimraf=require(_0x05e6('0x1'));var zipdir=require(_0x05e6('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x05e6('0x3'));var moment=require('moment');var BPromise=require(_0x05e6('0x4'));var Mustache=require('mustache');var util=require(_0x05e6('0x5'));var path=require('path');var sox=require(_0x05e6('0x6'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0x05e6('0x7'));var crypto=require(_0x05e6('0x8'));var jsforce=require(_0x05e6('0x9'));var deskjs=require(_0x05e6('0xa'));var toCsv=require('to-csv');var querystring=require(_0x05e6('0xb'));var Papa=require(_0x05e6('0xc'));var Redis=require(_0x05e6('0xd'));var authService=require(_0x05e6('0xe'));var qs=require(_0x05e6('0xf'));var as=require(_0x05e6('0x10'));var hardwareService=require(_0x05e6('0x11'));var logger=require(_0x05e6('0x12'))(_0x05e6('0x13'));var utils=require(_0x05e6('0x14'));var config=require(_0x05e6('0x15'));var db=require(_0x05e6('0x16'))['db'];function respondWithStatusCode(_0x11f34f,_0x82ab3e){_0x82ab3e=_0x82ab3e||0xcc;return function(_0x32b222){if(_0x32b222){return _0x11f34f[_0x05e6('0x17')](_0x82ab3e);}return _0x11f34f[_0x05e6('0x18')](_0x82ab3e)['end']();};}function respondWithResult(_0x4bf777,_0x2123f7){_0x2123f7=_0x2123f7||0xc8;return function(_0xa72faa){if(_0xa72faa){return _0x4bf777[_0x05e6('0x18')](_0x2123f7)[_0x05e6('0x19')](_0xa72faa);}};}function respondWithFilteredResult(_0x21eb0a,_0x13a7d7){return function(_0x377bb0){if(_0x377bb0){var _0x155753=_0x377bb0[_0x05e6('0x1a')],_0x1b033c=_0x13a7d7[_0x05e6('0x1b')],_0x4f0ee3=_0x13a7d7[_0x05e6('0x1b')]+_0x13a7d7[_0x05e6('0x1c')],_0x2bc2e4;if(_0x4f0ee3>=_0x155753){_0x4f0ee3=_0x155753;_0x2bc2e4=0xc8;}else{_0x2bc2e4=0xce;}_0x21eb0a[_0x05e6('0x18')](_0x2bc2e4);return _0x21eb0a[_0x05e6('0x1d')](_0x05e6('0x1e'),_0x1b033c+'-'+_0x4f0ee3+'/'+_0x155753)['json'](_0x377bb0);}return null;};}function patchUpdates(_0xfaf80a){return function(_0x33fb17){try{jsonpatch[_0x05e6('0x1f')](_0x33fb17,_0xfaf80a,!![]);}catch(_0x2564fe){return BPromise[_0x05e6('0x20')](_0x2564fe);}return _0x33fb17[_0x05e6('0x21')]();};}function saveUpdates(_0x4d1818,_0x4f60d2){return function(_0x440eb1){if(_0x440eb1){return _0x440eb1[_0x05e6('0x22')](_0x4d1818)[_0x05e6('0x23')](function(_0x1f6fca){return _0x1f6fca;});}return null;};}function removeEntity(_0x74d673,_0x1df140){return function(_0x1db276){if(_0x1db276){return _0x1db276[_0x05e6('0x24')]()[_0x05e6('0x23')](function(){var _0x4199e9=_0x1db276[_0x05e6('0x25')]({'plain':!![]});var _0x284a02='Variables';return db[_0x05e6('0x26')][_0x05e6('0x24')]({'where':{'type':_0x284a02,'resourceId':_0x4199e9['id']}})['then'](function(){return _0x1db276;});})['then'](function(){_0x74d673[_0x05e6('0x18')](0xcc)[_0x05e6('0x27')]();});}};}function handleEntityNotFound(_0x5f0d50,_0xda78fe){return function(_0x362325){if(!_0x362325){_0x5f0d50['sendStatus'](0x194);}return _0x362325;};}function handleError(_0x55e7c2,_0x20832e){_0x20832e=_0x20832e||0x1f4;return function(_0x2eba67){logger['error'](_0x2eba67[_0x05e6('0x28')]);if(_0x2eba67['name']){delete _0x2eba67[_0x05e6('0x29')];}_0x55e7c2['status'](_0x20832e)['send'](_0x2eba67);};}exports[_0x05e6('0x2a')]=function(_0x1fb43c,_0x4fb24c){var _0x12f85f={},_0xadf188={},_0x5b07fd={'count':0x0,'rows':[]};var _0x87019c=_[_0x05e6('0x2b')](db['Variable'][_0x05e6('0x2c')],function(_0x967f17){return{'name':_0x967f17[_0x05e6('0x2d')],'type':_0x967f17[_0x05e6('0x2e')][_0x05e6('0x2f')]};});_0xadf188[_0x05e6('0x30')]=_[_0x05e6('0x2b')](_0x87019c,_0x05e6('0x29'));_0xadf188[_0x05e6('0x31')]=_[_0x05e6('0x32')](_0x1fb43c[_0x05e6('0x31')]);_0xadf188[_0x05e6('0x33')]=_[_0x05e6('0x34')](_0xadf188['model'],_0xadf188[_0x05e6('0x31')]);_0x12f85f['attributes']=_[_0x05e6('0x34')](_0xadf188['model'],qs[_0x05e6('0x35')](_0x1fb43c[_0x05e6('0x31')]['fields']));_0x12f85f[_0x05e6('0x36')]=_0x12f85f[_0x05e6('0x36')][_0x05e6('0x37')]?_0x12f85f[_0x05e6('0x36')]:_0xadf188[_0x05e6('0x30')];if(!_0x1fb43c[_0x05e6('0x31')][_0x05e6('0x38')]('nolimit')){_0x12f85f[_0x05e6('0x1c')]=qs[_0x05e6('0x1c')](_0x1fb43c[_0x05e6('0x31')][_0x05e6('0x1c')]);_0x12f85f[_0x05e6('0x1b')]=qs['offset'](_0x1fb43c[_0x05e6('0x31')][_0x05e6('0x1b')]);}_0x12f85f[_0x05e6('0x39')]=qs['sort'](_0x1fb43c[_0x05e6('0x31')][_0x05e6('0x3a')]);_0x12f85f[_0x05e6('0x3b')]=qs['filters'](_['pick'](_0x1fb43c[_0x05e6('0x31')],_0xadf188[_0x05e6('0x33')]),_0x87019c);if(_0x1fb43c[_0x05e6('0x31')][_0x05e6('0x3c')]){_0x12f85f[_0x05e6('0x3b')]=_[_0x05e6('0x3d')](_0x12f85f[_0x05e6('0x3b')],{'$or':_[_0x05e6('0x2b')](_0x87019c,function(_0x5d189f){if(_0x5d189f[_0x05e6('0x2e')]!==_0x05e6('0x3e')){var _0x2a59c5={};_0x2a59c5[_0x5d189f['name']]={'$like':'%'+_0x1fb43c[_0x05e6('0x31')][_0x05e6('0x3c')]+'%'};return _0x2a59c5;}})});}_0x12f85f=_['merge']({},_0x12f85f,_0x1fb43c[_0x05e6('0x3f')]);var _0x170ea1={'where':_0x12f85f[_0x05e6('0x3b')]};return db[_0x05e6('0x40')][_0x05e6('0x1a')](_0x170ea1)['then'](function(_0x1e33d8){_0x5b07fd[_0x05e6('0x1a')]=_0x1e33d8;if(_0x1fb43c[_0x05e6('0x31')]['includeAll']){_0x12f85f['include']=[{'all':!![]}];}return db[_0x05e6('0x40')]['findAll'](_0x12f85f);})[_0x05e6('0x23')](function(_0x2d2092){_0x5b07fd[_0x05e6('0x41')]=_0x2d2092;return _0x5b07fd;})[_0x05e6('0x23')](respondWithFilteredResult(_0x4fb24c,_0x12f85f))[_0x05e6('0x42')](handleError(_0x4fb24c,null));};exports['show']=function(_0x543e5f,_0x3f49ca){var _0x1d030f={'raw':!![],'where':{'id':_0x543e5f['params']['id']}},_0x4cdc94={};_0x4cdc94[_0x05e6('0x30')]=_[_0x05e6('0x32')](db[_0x05e6('0x40')][_0x05e6('0x2c')]);_0x4cdc94[_0x05e6('0x31')]=_[_0x05e6('0x32')](_0x543e5f[_0x05e6('0x31')]);_0x4cdc94[_0x05e6('0x33')]=_[_0x05e6('0x34')](_0x4cdc94['model'],_0x4cdc94['query']);_0x1d030f[_0x05e6('0x36')]=_['intersection'](_0x4cdc94[_0x05e6('0x30')],qs['fields'](_0x543e5f['query'][_0x05e6('0x35')]));_0x1d030f[_0x05e6('0x36')]=_0x1d030f[_0x05e6('0x36')][_0x05e6('0x37')]?_0x1d030f['attributes']:_0x4cdc94[_0x05e6('0x30')];if(_0x543e5f[_0x05e6('0x31')][_0x05e6('0x43')]){_0x1d030f[_0x05e6('0x44')]=[{'all':!![]}];}_0x1d030f=_['merge']({},_0x1d030f,_0x543e5f[_0x05e6('0x3f')]);return db[_0x05e6('0x40')][_0x05e6('0x45')](_0x1d030f)[_0x05e6('0x23')](handleEntityNotFound(_0x3f49ca,null))[_0x05e6('0x23')](respondWithResult(_0x3f49ca,null))['catch'](handleError(_0x3f49ca,null));};exports[_0x05e6('0x46')]=function(_0x778fc9,_0x5dd67c){return db[_0x05e6('0x40')][_0x05e6('0x46')](_0x778fc9[_0x05e6('0x47')],{})[_0x05e6('0x23')](function(_0x3dd261){var _0x545d9d=_0x778fc9[_0x05e6('0x48')][_0x05e6('0x25')]({'plain':!![]});if(!_0x545d9d)throw new Error(_0x05e6('0x49'));if(_0x545d9d[_0x05e6('0x4a')]===_0x05e6('0x48')){var _0x1db469=_0x3dd261[_0x05e6('0x25')]({'plain':!![]});var _0x886934=_0x05e6('0x4b');return db[_0x05e6('0x4c')]['find']({'where':{'name':_0x886934,'userProfileId':_0x545d9d[_0x05e6('0x4d')]},'raw':!![]})['then'](function(_0x395a7e){if(_0x395a7e&&_0x395a7e[_0x05e6('0x4e')]===0x0){return db['UserProfileResource'][_0x05e6('0x46')]({'name':_0x1db469[_0x05e6('0x29')],'resourceId':_0x1db469['id'],'type':_0x395a7e[_0x05e6('0x29')],'sectionId':_0x395a7e['id']},{})[_0x05e6('0x23')](function(){return _0x3dd261;});}else{return _0x3dd261;}})[_0x05e6('0x42')](function(_0x3c64d3){logger[_0x05e6('0x4f')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x3c64d3);throw _0x3c64d3;});}return _0x3dd261;})['then'](respondWithResult(_0x5dd67c,0xc9))[_0x05e6('0x42')](handleError(_0x5dd67c,null));};exports[_0x05e6('0x22')]=function(_0x54c68e,_0x22553d){if(_0x54c68e[_0x05e6('0x47')]['id']){delete _0x54c68e[_0x05e6('0x47')]['id'];}return db['Variable'][_0x05e6('0x45')]({'where':{'id':_0x54c68e[_0x05e6('0x50')]['id']}})[_0x05e6('0x23')](handleEntityNotFound(_0x22553d,null))[_0x05e6('0x23')](saveUpdates(_0x54c68e[_0x05e6('0x47')],null))[_0x05e6('0x23')](respondWithResult(_0x22553d,null))[_0x05e6('0x42')](handleError(_0x22553d,null));};exports['destroy']=function(_0x2fc964,_0x3f2229){return db[_0x05e6('0x40')]['find']({'where':{'id':_0x2fc964[_0x05e6('0x50')]['id']}})[_0x05e6('0x23')](handleEntityNotFound(_0x3f2229,null))['then'](removeEntity(_0x3f2229,null))[_0x05e6('0x42')](handleError(_0x3f2229,null));}; \ No newline at end of file diff --git a/server/api/variable/variable.model.js b/server/api/variable/variable.model.js index 82b29a3..551f2a1 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 _0xb71f=['./variable.attributes','exports','define','tools_variables','lodash','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment'];(function(_0xa4928c,_0x16b89c){var _0x27cc29=function(_0x14b819){while(--_0x14b819){_0xa4928c['push'](_0xa4928c['shift']());}};_0x27cc29(++_0x16b89c);}(_0xb71f,0x1b4));var _0xfb71=function(_0x403c20,_0x4a7b99){_0x403c20=_0x403c20-0x0;var _0x2b271a=_0xb71f[_0x403c20];return _0x2b271a;};'use strict';var _=require(_0xfb71('0x0'));var util=require('util');var logger=require(_0xfb71('0x1'))(_0xfb71('0x2'));var moment=require(_0xfb71('0x3'));var BPromise=require(_0xfb71('0x4'));var rp=require(_0xfb71('0x5'));var fs=require('fs');var path=require(_0xfb71('0x6'));var rimraf=require('rimraf');var config=require(_0xfb71('0x7'));var attributes=require(_0xfb71('0x8'));module[_0xfb71('0x9')]=function(_0x563c93,_0x45c64b){return _0x563c93[_0xfb71('0xa')]('Variable',attributes,{'tableName':_0xfb71('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xdd1d=['api','moment','rimraf','../../config/environment','./variable.attributes','exports','define','tools_variables','lodash','../../config/logger'];(function(_0x16ed67,_0x43d3b0){var _0x5de868=function(_0x4cdd86){while(--_0x4cdd86){_0x16ed67['push'](_0x16ed67['shift']());}};_0x5de868(++_0x43d3b0);}(_0xdd1d,0x9e));var _0xddd1=function(_0x40ae18,_0x271674){_0x40ae18=_0x40ae18-0x0;var _0x3a6f2c=_0xdd1d[_0x40ae18];return _0x3a6f2c;};'use strict';var _=require(_0xddd1('0x0'));var util=require('util');var logger=require(_0xddd1('0x1'))(_0xddd1('0x2'));var moment=require(_0xddd1('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xddd1('0x4'));var config=require(_0xddd1('0x5'));var attributes=require(_0xddd1('0x6'));module[_0xddd1('0x7')]=function(_0x50db8d,_0x2ce744){return _0x50db8d[_0xddd1('0x8')]('Variable',attributes,{'tableName':_0xddd1('0x9'),'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 8de6735..d796004 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 _0x8dba=['stringify','moment','bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info','Variable,\x20%s,\x20%s','Variable,\x20%s,\x20%s,\x20%s','request\x20sent','error','message','catch','Variable','find','options','raw','include','map','model','attributes','ShowVariable'];(function(_0xf858d,_0x5867e5){var _0x473f59=function(_0x3126a0){while(--_0x3126a0){_0xf858d['push'](_0xf858d['shift']());}};_0x473f59(++_0x5867e5);}(_0x8dba,0xaf));var _0xa8db=function(_0x1f5a2a,_0x4a66f8){_0x1f5a2a=_0x1f5a2a-0x0;var _0x46e23f=_0x8dba[_0x1f5a2a];return _0x46e23f;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xa8db('0x0'));var BPromise=require(_0xa8db('0x1'));var rs=require(_0xa8db('0x2'));var fs=require('fs');var Redis=require(_0xa8db('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xa8db('0x4'));var logger=require('../../config/logger')(_0xa8db('0x5'));var config=require(_0xa8db('0x6'));var jayson=require(_0xa8db('0x7'));var client=jayson[_0xa8db('0x8')][_0xa8db('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x857a5d,_0x5eafaa,_0x3d53fe){return new BPromise(function(_0x1decbf,_0x30aba2){return client[_0xa8db('0xa')](_0x857a5d,_0x3d53fe)[_0xa8db('0xb')](function(_0x46ecd6){logger[_0xa8db('0xc')](_0xa8db('0xd'),_0x5eafaa,'request\x20sent');logger['debug'](_0xa8db('0xe'),_0x5eafaa,_0xa8db('0xf'),JSON['stringify'](_0x46ecd6));if(_0x46ecd6[_0xa8db('0x10')]){if(_0x46ecd6[_0xa8db('0x10')]['code']===0x1f4){logger['error']('Variable,\x20%s,\x20%s',_0x5eafaa,_0x46ecd6[_0xa8db('0x10')][_0xa8db('0x11')]);return _0x30aba2(_0x46ecd6[_0xa8db('0x10')]['message']);}logger[_0xa8db('0x10')](_0xa8db('0xd'),_0x5eafaa,_0x46ecd6['error'][_0xa8db('0x11')]);return _0x1decbf(_0x46ecd6['error']['message']);}else{logger[_0xa8db('0xc')](_0xa8db('0xd'),_0x5eafaa,_0xa8db('0xf'));_0x1decbf(_0x46ecd6['result'][_0xa8db('0x11')]);}})[_0xa8db('0x12')](function(_0x158c0a){logger['error'](_0xa8db('0xd'),_0x5eafaa,_0x158c0a);_0x30aba2(_0x158c0a);});});}exports['ShowVariable']=function(_0x4c579c){var _0x4d05e6=this;return new Promise(function(_0x3ff4bc,_0x36a091){return db[_0xa8db('0x13')][_0xa8db('0x14')]({'raw':_0x4c579c['options']?_0x4c579c[_0xa8db('0x15')][_0xa8db('0x16')]===undefined?!![]:![]:!![],'where':_0x4c579c['options']?_0x4c579c[_0xa8db('0x15')]['where']||null:null,'attributes':_0x4c579c[_0xa8db('0x15')]?_0x4c579c[_0xa8db('0x15')]['attributes']||null:null,'include':_0x4c579c[_0xa8db('0x15')]?_0x4c579c[_0xa8db('0x15')][_0xa8db('0x17')]?_[_0xa8db('0x18')](_0x4c579c[_0xa8db('0x15')][_0xa8db('0x17')],function(_0x39af6a){return{'model':db[_0x39af6a[_0xa8db('0x19')]],'as':_0x39af6a['as'],'attributes':_0x39af6a[_0xa8db('0x1a')],'include':_0x39af6a[_0xa8db('0x17')]?_[_0xa8db('0x18')](_0x39af6a[_0xa8db('0x17')],function(_0x3e8158){return{'model':db[_0x3e8158[_0xa8db('0x19')]],'as':_0x3e8158['as'],'attributes':_0x3e8158['attributes'],'include':_0x3e8158[_0xa8db('0x17')]?_[_0xa8db('0x18')](_0x3e8158[_0xa8db('0x17')],function(_0x2bd8da){return{'model':db[_0x2bd8da[_0xa8db('0x19')]],'as':_0x2bd8da['as'],'attributes':_0x2bd8da[_0xa8db('0x1a')]};}):[]};}):[]};}):[]:[]})[_0xa8db('0xb')](function(_0x74c022){logger['info'](_0xa8db('0x1b'),_0x4c579c);logger['debug'](_0xa8db('0x1b'),_0x4c579c,JSON[_0xa8db('0x1c')](_0x74c022));_0x3ff4bc(_0x74c022);})[_0xa8db('0x12')](function(_0xf6e038){logger['error'](_0xa8db('0x1b'),_0xf6e038[_0xa8db('0x11')],_0x4c579c);_0x36a091(_0x4d05e6['error'](0x1f4,_0xf6e038[_0xa8db('0x11')]));});});}; \ No newline at end of file +var _0x1a76=['code','message','ShowVariable','Variable','find','options','raw','where','attributes','map','include','model','debug','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','Variable,\x20%s,\x20%s','request\x20sent','stringify','error'];(function(_0x15362f,_0x599532){var _0x14a985=function(_0x4f585a){while(--_0x4f585a){_0x15362f['push'](_0x15362f['shift']());}};_0x14a985(++_0x599532);}(_0x1a76,0xd4));var _0x61a7=function(_0x3ae96c,_0x5f1e7e){_0x3ae96c=_0x3ae96c-0x0;var _0x1b0c90=_0x1a76[_0x3ae96c];return _0x1b0c90;};'use strict';var _=require(_0x61a7('0x0'));var util=require(_0x61a7('0x1'));var moment=require(_0x61a7('0x2'));var BPromise=require(_0x61a7('0x3'));var rs=require(_0x61a7('0x4'));var fs=require('fs');var Redis=require(_0x61a7('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x61a7('0x6'));var logger=require(_0x61a7('0x7'))(_0x61a7('0x8'));var config=require(_0x61a7('0x9'));var jayson=require(_0x61a7('0xa'));var client=jayson[_0x61a7('0xb')][_0x61a7('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x2b4089,_0x27b08a,_0x315d0d){return new BPromise(function(_0x5b9fc1,_0x1c0166){return client['request'](_0x2b4089,_0x315d0d)[_0x61a7('0xd')](function(_0x13eb9f){logger[_0x61a7('0xe')](_0x61a7('0xf'),_0x27b08a,_0x61a7('0x10'));logger['debug']('Variable,\x20%s,\x20%s,\x20%s',_0x27b08a,_0x61a7('0x10'),JSON[_0x61a7('0x11')](_0x13eb9f));if(_0x13eb9f[_0x61a7('0x12')]){if(_0x13eb9f[_0x61a7('0x12')][_0x61a7('0x13')]===0x1f4){logger[_0x61a7('0x12')](_0x61a7('0xf'),_0x27b08a,_0x13eb9f[_0x61a7('0x12')][_0x61a7('0x14')]);return _0x1c0166(_0x13eb9f[_0x61a7('0x12')][_0x61a7('0x14')]);}logger[_0x61a7('0x12')](_0x61a7('0xf'),_0x27b08a,_0x13eb9f[_0x61a7('0x12')][_0x61a7('0x14')]);return _0x5b9fc1(_0x13eb9f[_0x61a7('0x12')]['message']);}else{logger[_0x61a7('0xe')](_0x61a7('0xf'),_0x27b08a,_0x61a7('0x10'));_0x5b9fc1(_0x13eb9f['result'][_0x61a7('0x14')]);}})['catch'](function(_0x12f997){logger['error'](_0x61a7('0xf'),_0x27b08a,_0x12f997);_0x1c0166(_0x12f997);});});}exports[_0x61a7('0x15')]=function(_0x54c68f){var _0x5eef30=this;return new Promise(function(_0x3b0643,_0x19c09e){return db[_0x61a7('0x16')][_0x61a7('0x17')]({'raw':_0x54c68f[_0x61a7('0x18')]?_0x54c68f['options'][_0x61a7('0x19')]===undefined?!![]:![]:!![],'where':_0x54c68f['options']?_0x54c68f[_0x61a7('0x18')][_0x61a7('0x1a')]||null:null,'attributes':_0x54c68f[_0x61a7('0x18')]?_0x54c68f[_0x61a7('0x18')][_0x61a7('0x1b')]||null:null,'include':_0x54c68f['options']?_0x54c68f[_0x61a7('0x18')]['include']?_[_0x61a7('0x1c')](_0x54c68f[_0x61a7('0x18')][_0x61a7('0x1d')],function(_0x239c1f){return{'model':db[_0x239c1f[_0x61a7('0x1e')]],'as':_0x239c1f['as'],'attributes':_0x239c1f[_0x61a7('0x1b')],'include':_0x239c1f[_0x61a7('0x1d')]?_[_0x61a7('0x1c')](_0x239c1f[_0x61a7('0x1d')],function(_0x5ec02d){return{'model':db[_0x5ec02d[_0x61a7('0x1e')]],'as':_0x5ec02d['as'],'attributes':_0x5ec02d['attributes'],'include':_0x5ec02d[_0x61a7('0x1d')]?_['map'](_0x5ec02d[_0x61a7('0x1d')],function(_0x29d919){return{'model':db[_0x29d919[_0x61a7('0x1e')]],'as':_0x29d919['as'],'attributes':_0x29d919[_0x61a7('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x61a7('0xd')](function(_0x183f35){logger[_0x61a7('0xe')]('ShowVariable',_0x54c68f);logger[_0x61a7('0x1f')](_0x61a7('0x15'),_0x54c68f,JSON[_0x61a7('0x11')](_0x183f35));_0x3b0643(_0x183f35);})[_0x61a7('0x20')](function(_0x32db9b){logger[_0x61a7('0x12')](_0x61a7('0x15'),_0x32db9b['message'],_0x54c68f);_0x19c09e(_0x5eef30[_0x61a7('0x12')](0x1f4,_0x32db9b[_0x61a7('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/version/index.js b/server/api/version/index.js index 5f10413..68285c2 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 _0x8509=['../../components/auth/service','./version.controller','get','/fetch','isAuthenticated','canUpdate','/reset','reset','/pull','/restart','restart','/migrations','migrations','exports','Router'];(function(_0x33975c,_0x50d085){var _0x1c15ab=function(_0x54e8bc){while(--_0x54e8bc){_0x33975c['push'](_0x33975c['shift']());}};_0x1c15ab(++_0x50d085);}(_0x8509,0x1c1));var _0x9850=function(_0x3e5147,_0x33eef9){_0x3e5147=_0x3e5147-0x0;var _0x18c779=_0x8509[_0x3e5147];return _0x18c779;};'use strict';var express=require('express');var router=express[_0x9850('0x0')]();var auth=require(_0x9850('0x1'));var controller=require(_0x9850('0x2'));router[_0x9850('0x3')]('/',controller['index']);router['get'](_0x9850('0x4'),auth[_0x9850('0x5')](),auth[_0x9850('0x6')](),controller['fetch']);router[_0x9850('0x3')](_0x9850('0x7'),auth[_0x9850('0x5')](),auth[_0x9850('0x6')](),controller[_0x9850('0x8')]);router[_0x9850('0x3')](_0x9850('0x9'),auth[_0x9850('0x5')](),auth[_0x9850('0x6')](),controller['pull']);router[_0x9850('0x3')](_0x9850('0xa'),auth[_0x9850('0x5')](),controller[_0x9850('0xb')]);router[_0x9850('0x3')](_0x9850('0xc'),controller[_0x9850('0xd')]);module[_0x9850('0xe')]=router; \ No newline at end of file +var _0xda2f=['pull','/restart','restart','/migrations','migrations','exports','Router','get','/fetch','isAuthenticated','canUpdate','fetch','reset','/pull'];(function(_0xe44b1,_0x242100){var _0x368147=function(_0x3cd64c){while(--_0x3cd64c){_0xe44b1['push'](_0xe44b1['shift']());}};_0x368147(++_0x242100);}(_0xda2f,0x156));var _0xfda2=function(_0x476e03,_0x163c5b){_0x476e03=_0x476e03-0x0;var _0x4570a0=_0xda2f[_0x476e03];return _0x4570a0;};'use strict';var express=require('express');var router=express[_0xfda2('0x0')]();var auth=require('../../components/auth/service');var controller=require('./version.controller');router[_0xfda2('0x1')]('/',controller['index']);router[_0xfda2('0x1')](_0xfda2('0x2'),auth[_0xfda2('0x3')](),auth[_0xfda2('0x4')](),controller[_0xfda2('0x5')]);router[_0xfda2('0x1')]('/reset',auth[_0xfda2('0x3')](),auth[_0xfda2('0x4')](),controller[_0xfda2('0x6')]);router[_0xfda2('0x1')](_0xfda2('0x7'),auth[_0xfda2('0x3')](),auth[_0xfda2('0x4')](),controller[_0xfda2('0x8')]);router['get'](_0xfda2('0x9'),auth[_0xfda2('0x3')](),controller[_0xfda2('0xa')]);router['get'](_0xfda2('0xb'),controller[_0xfda2('0xc')]);module[_0xfda2('0xd')]=router; \ No newline at end of file diff --git a/server/api/version/version.controller.js b/server/api/version/version.controller.js index 50e874f..92eea41 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 _0x2d06=['join','server','length','replace','.js','sort','Migration','sequelize','getQueryInterface','Migration\x20tried\x20to\x20use\x20old\x20style\x20\x22done\x22\x20callback.\x20Please\x20upgrade\x20to\x20\x22umzug\x22\x20and\x20return\x20a\x20promise\x20instead.','then','Database\x20migrated\x20successfully\x20from\x20version\x20','UniqueConstraintError','Database\x20already\x20up-to-date','path','lodash','pkginfo','version','child_process','exec','../../mysqldb','../../config/environment','../../config/logger','update','root','index','exports','latest','fetch','tags','2.0.0','status','json','master','info','git\x20fetch','git\x20fetch\x20origin\x20master','--hard','error','git\x20reset\x20--hard\x20FETCH_HEAD','git\x20reset\x20--hard','npm\x20install\x20--production','restart','pm2\x20restart\x20motion\x20%s','Your\x20system\x20has\x20been\x20restart\x20successfully','catch','migrations'];(function(_0x40d48a,_0x1ce6bb){var _0x3c8aa6=function(_0x4ad6fb){while(--_0x4ad6fb){_0x40d48a['push'](_0x40d48a['shift']());}};_0x3c8aa6(++_0x1ce6bb);}(_0x2d06,0x157));var _0x62d0=function(_0x2e4274,_0x26d41a){_0x2e4274=_0x2e4274-0x0;var _0x231211=_0x2d06[_0x2e4274];return _0x231211;};'use strict';var Umzug=require('umzug');var path=require(_0x62d0('0x0'));var fs=require('fs');var _=require(_0x62d0('0x1'));var pkginfo=require(_0x62d0('0x2'))(module,_0x62d0('0x3'));var compareVersions=require('compare-versions');var exec=require(_0x62d0('0x4'))[_0x62d0('0x5')];var db=require(_0x62d0('0x6'))['db'];var config=require(_0x62d0('0x7'));var pm2=require('../../config/pm2');var logger=require(_0x62d0('0x8'))(_0x62d0('0x9'));var git=require('simple-git')(config[_0x62d0('0xa')]);exports[_0x62d0('0xb')]=function(_0x508d82,_0x264cd4){var _0xc4dacc={'current':module[_0x62d0('0xc')][_0x62d0('0x3')],'phonebar':0x2};if(_0x508d82['query']&&_0x508d82['query'][_0x62d0('0xd')]){return git[_0x62d0('0xe')]()[_0x62d0('0xf')](function(_0x26a4c0,_0x3b7959){_0xc4dacc[_0x62d0('0xd')]=(_0x26a4c0?module[_0x62d0('0xc')][_0x62d0('0x3')]:_0x3b7959[_0x62d0('0xd')])||_0x62d0('0x10');return _0x264cd4[_0x62d0('0x11')](0xc8)[_0x62d0('0x12')](_0xc4dacc);});}else{return _0x264cd4[_0x62d0('0x11')](0xc8)[_0x62d0('0x12')](_0xc4dacc);}};exports['fetch']=function(_0x38afb7,_0x23376e){return git[_0x62d0('0xe')](['origin',_0x62d0('0x13')],function(_0x16acd1){if(_0x16acd1){logger['error'](_0x16acd1);return _0x23376e[_0x62d0('0x11')](0x1f4)[_0x62d0('0x12')](_0x16acd1);}logger[_0x62d0('0x14')](_0x62d0('0x15'));return _0x23376e['status'](0xc8)[_0x62d0('0x12')]({'output':_0x62d0('0x16')});});};exports['reset']=function(_0x8bab8,_0x12036c){return git['reset']([_0x62d0('0x17'),'FETCH_HEAD'],function(_0xaa093f){if(_0xaa093f){logger[_0x62d0('0x18')](_0xaa093f);return _0x12036c[_0x62d0('0x11')](0x1f4)['json'](_0xaa093f);}logger[_0x62d0('0x14')](_0x62d0('0x19'));return _0x12036c[_0x62d0('0x11')](0xc8)['json']({'output':_0x62d0('0x1a')});});};exports['pull']=function(_0x186860,_0x489ca2){exec(_0x62d0('0x1b'),function(_0x522bd6,_0x200d3f,_0x211fc7){logger['info'](_0x200d3f);logger[_0x62d0('0x14')](_0x211fc7);if(_0x522bd6){logger['error'](_0x522bd6);return _0x489ca2[_0x62d0('0x11')](0x1f4)['json'](_0x522bd6);}return _0x489ca2[_0x62d0('0x11')](0xc8)[_0x62d0('0x12')]({'output':_0x200d3f});});};exports[_0x62d0('0x1c')]=function(_0x4ba600,_0xe451b8){return pm2[_0x62d0('0x1c')]('motion2')['then'](function(_0x5140e6){logger['info'](_0x62d0('0x1d'),_0x5140e6);return _0xe451b8[_0x62d0('0x11')](0xc8)[_0x62d0('0x12')]({'output':_0x62d0('0x1e')});})[_0x62d0('0x1f')](function(_0x52cec8){logger['error'](_0x52cec8);return _0xe451b8[_0x62d0('0x11')](0x1f4)[_0x62d0('0x12')](_0x52cec8);});};exports[_0x62d0('0x20')]=function(_0x2472cd,_0x502620){var _0x44e51b=fs['readdirSync'](path[_0x62d0('0x21')](config[_0x62d0('0xa')],_0x62d0('0x22'),_0x62d0('0x20')));var _0x35dd07=[];for(var _0x1ff4df=0x0;_0x1ff4df<_0x44e51b[_0x62d0('0x23')];_0x1ff4df++){var _0x382aa6=_0x44e51b[_0x1ff4df][_0x62d0('0x24')](_0x62d0('0x25'),'');if(compareVersions(module[_0x62d0('0xc')][_0x62d0('0x3')],_0x382aa6)===-0x1){_0x35dd07['push'](_0x382aa6);}}if(_0x35dd07['length']){var _0x528117=_0x35dd07[_0x62d0('0x26')](compareVersions);var _0x292f03=new Umzug({'storage':'sequelize','storageOptions':{'model':db[_0x62d0('0x27')],'modelName':_0x62d0('0x27'),'columnName':'version'},'migrations':{'params':[db[_0x62d0('0x28')][_0x62d0('0x29')](),db[_0x62d0('0x28')]['constructor'],function(){throw new Error(_0x62d0('0x2a'));}],'path':path['join'](config['root'],_0x62d0('0x22'),_0x62d0('0x20')),'pattern':/\.js$/}});_0x292f03['up']({'migrations':_['map'](_0x528117,function(_0x2e42f2){return _0x2e42f2+_0x62d0('0x25');})})[_0x62d0('0x2b')](function(){return _0x502620['status'](0xc8)[_0x62d0('0x12')]({'output':_0x62d0('0x2c')+module[_0x62d0('0xc')][_0x62d0('0x3')]+'\x20to\x20'+_['last'](_0x528117),'migrations':_[_0x62d0('0x21')](_0x528117)});})[_0x62d0('0x1f')](function(_0x812015){if(_0x812015 instanceof db[_0x62d0('0x28')][_0x62d0('0x2d')]){return _0x502620[_0x62d0('0x11')](0xc8)[_0x62d0('0x12')]({'output':'Database\x20already\x20up-to-date'});}else{return _0x502620[_0x62d0('0x11')](0x1f4)['json'](_0x812015);}});}else{return _0x502620['status'](0xc8)[_0x62d0('0x12')]({'output':_0x62d0('0x2e')});}}; \ No newline at end of file +var _0x5942=['../../config/environment','../../config/pm2','../../config/logger','root','index','exports','query','latest','fetch','tags','2.0.0','status','json','master','info','git\x20fetch','git\x20fetch\x20origin\x20master','reset','--hard','FETCH_HEAD','error','git\x20reset\x20--hard','pull','restart','motion2','then','pm2\x20restart\x20motion\x20%s','Your\x20system\x20has\x20been\x20restart\x20successfully','migrations','join','server','length','replace','.js','push','sort','sequelize','Migration','map','Database\x20migrated\x20successfully\x20from\x20version\x20','\x20to\x20','last','UniqueConstraintError','Database\x20already\x20up-to-date','umzug','path','lodash','pkginfo','version','compare-versions','child_process','exec','../../mysqldb'];(function(_0x4a45b4,_0x59804f){var _0x1a99c9=function(_0x3aa517){while(--_0x3aa517){_0x4a45b4['push'](_0x4a45b4['shift']());}};_0x1a99c9(++_0x59804f);}(_0x5942,0x16a));var _0x2594=function(_0x270aa6,_0x366458){_0x270aa6=_0x270aa6-0x0;var _0x3b9dd1=_0x5942[_0x270aa6];return _0x3b9dd1;};'use strict';var Umzug=require(_0x2594('0x0'));var path=require(_0x2594('0x1'));var fs=require('fs');var _=require(_0x2594('0x2'));var pkginfo=require(_0x2594('0x3'))(module,_0x2594('0x4'));var compareVersions=require(_0x2594('0x5'));var exec=require(_0x2594('0x6'))[_0x2594('0x7')];var db=require(_0x2594('0x8'))['db'];var config=require(_0x2594('0x9'));var pm2=require(_0x2594('0xa'));var logger=require(_0x2594('0xb'))('update');var git=require('simple-git')(config[_0x2594('0xc')]);exports[_0x2594('0xd')]=function(_0x3d20aa,_0x5707a0){var _0x2b42d3={'current':module[_0x2594('0xe')]['version'],'phonebar':0x2};if(_0x3d20aa[_0x2594('0xf')]&&_0x3d20aa['query'][_0x2594('0x10')]){return git[_0x2594('0x11')]()[_0x2594('0x12')](function(_0x4a7dd2,_0xbb20af){_0x2b42d3[_0x2594('0x10')]=(_0x4a7dd2?module[_0x2594('0xe')][_0x2594('0x4')]:_0xbb20af['latest'])||_0x2594('0x13');return _0x5707a0[_0x2594('0x14')](0xc8)[_0x2594('0x15')](_0x2b42d3);});}else{return _0x5707a0[_0x2594('0x14')](0xc8)[_0x2594('0x15')](_0x2b42d3);}};exports[_0x2594('0x11')]=function(_0x400924,_0xa26e3a){return git[_0x2594('0x11')](['origin',_0x2594('0x16')],function(_0x158cff){if(_0x158cff){logger['error'](_0x158cff);return _0xa26e3a[_0x2594('0x14')](0x1f4)['json'](_0x158cff);}logger[_0x2594('0x17')](_0x2594('0x18'));return _0xa26e3a[_0x2594('0x14')](0xc8)[_0x2594('0x15')]({'output':_0x2594('0x19')});});};exports['reset']=function(_0x3f3e14,_0x457beb){return git[_0x2594('0x1a')]([_0x2594('0x1b'),_0x2594('0x1c')],function(_0x4776a3){if(_0x4776a3){logger[_0x2594('0x1d')](_0x4776a3);return _0x457beb[_0x2594('0x14')](0x1f4)[_0x2594('0x15')](_0x4776a3);}logger['info']('git\x20reset\x20--hard\x20FETCH_HEAD');return _0x457beb[_0x2594('0x14')](0xc8)[_0x2594('0x15')]({'output':_0x2594('0x1e')});});};exports[_0x2594('0x1f')]=function(_0x3b68eb,_0x37109a){exec('npm\x20install\x20--production',function(_0x44766c,_0x3bbebd,_0x121a8e){logger[_0x2594('0x17')](_0x3bbebd);logger['info'](_0x121a8e);if(_0x44766c){logger[_0x2594('0x1d')](_0x44766c);return _0x37109a['status'](0x1f4)[_0x2594('0x15')](_0x44766c);}return _0x37109a['status'](0xc8)[_0x2594('0x15')]({'output':_0x3bbebd});});};exports[_0x2594('0x20')]=function(_0x55af02,_0x8982e9){return pm2['restart'](_0x2594('0x21'))[_0x2594('0x22')](function(_0x1adef8){logger[_0x2594('0x17')](_0x2594('0x23'),_0x1adef8);return _0x8982e9[_0x2594('0x14')](0xc8)[_0x2594('0x15')]({'output':_0x2594('0x24')});})['catch'](function(_0x3a1058){logger['error'](_0x3a1058);return _0x8982e9['status'](0x1f4)[_0x2594('0x15')](_0x3a1058);});};exports[_0x2594('0x25')]=function(_0x4dc1a5,_0x36fdf4){var _0xa8ee54=fs['readdirSync'](path[_0x2594('0x26')](config[_0x2594('0xc')],_0x2594('0x27'),_0x2594('0x25')));var _0x587af2=[];for(var _0x43ac77=0x0;_0x43ac77<_0xa8ee54[_0x2594('0x28')];_0x43ac77++){var _0x2737ea=_0xa8ee54[_0x43ac77][_0x2594('0x29')](_0x2594('0x2a'),'');if(compareVersions(module['exports'][_0x2594('0x4')],_0x2737ea)===-0x1){_0x587af2[_0x2594('0x2b')](_0x2737ea);}}if(_0x587af2['length']){var _0x4ca65e=_0x587af2[_0x2594('0x2c')](compareVersions);var _0x1f1425=new Umzug({'storage':_0x2594('0x2d'),'storageOptions':{'model':db[_0x2594('0x2e')],'modelName':'Migration','columnName':_0x2594('0x4')},'migrations':{'params':[db[_0x2594('0x2d')]['getQueryInterface'](),db['sequelize']['constructor'],function(){throw new Error('Migration\x20tried\x20to\x20use\x20old\x20style\x20\x22done\x22\x20callback.\x20Please\x20upgrade\x20to\x20\x22umzug\x22\x20and\x20return\x20a\x20promise\x20instead.');}],'path':path['join'](config[_0x2594('0xc')],_0x2594('0x27'),_0x2594('0x25')),'pattern':/\.js$/}});_0x1f1425['up']({'migrations':_[_0x2594('0x2f')](_0x4ca65e,function(_0x38f5c9){return _0x38f5c9+_0x2594('0x2a');})})[_0x2594('0x22')](function(){return _0x36fdf4[_0x2594('0x14')](0xc8)[_0x2594('0x15')]({'output':_0x2594('0x30')+module[_0x2594('0xe')][_0x2594('0x4')]+_0x2594('0x31')+_[_0x2594('0x32')](_0x4ca65e),'migrations':_[_0x2594('0x26')](_0x4ca65e)});})['catch'](function(_0x562bae){if(_0x562bae instanceof db[_0x2594('0x2d')][_0x2594('0x33')]){return _0x36fdf4[_0x2594('0x14')](0xc8)[_0x2594('0x15')]({'output':_0x2594('0x34')});}else{return _0x36fdf4[_0x2594('0x14')](0x1f4)[_0x2594('0x15')](_0x562bae);}});}else{return _0x36fdf4[_0x2594('0x14')](0xc8)[_0x2594('0x15')]({'output':'Database\x20already\x20up-to-date'});}}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/index.js b/server/api/voiceAgentReport/index.js index 8126b65..9a3eadd 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 _0xc71b=['describe','/:id','show','post','put','delete','destroy','exports','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceAgentReport.controller','get','index','/describe','isAuthenticated'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0xc71b,0x1d3));var _0xbc71=function(_0x364a12,_0x100ae5){_0x364a12=_0x364a12-0x0;var _0x5d3c82=_0xc71b[_0x364a12];return _0x5d3c82;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0xbc71('0x0'));var router=express['Router']();var auth=require(_0xbc71('0x1'));var interaction=require(_0xbc71('0x2'));var config=require(_0xbc71('0x3'));var controller=require(_0xbc71('0x4'));router[_0xbc71('0x5')]('/',auth['isAuthenticated'](),controller[_0xbc71('0x6')]);router[_0xbc71('0x5')](_0xbc71('0x7'),auth[_0xbc71('0x8')](),controller[_0xbc71('0x9')]);router[_0xbc71('0x5')](_0xbc71('0xa'),auth[_0xbc71('0x8')](),controller[_0xbc71('0xb')]);router[_0xbc71('0xc')]('/',auth[_0xbc71('0x8')](),controller['create']);router[_0xbc71('0xd')]('/:id',auth[_0xbc71('0x8')](),controller['update']);router[_0xbc71('0xe')](_0xbc71('0xa'),auth[_0xbc71('0x8')](),controller[_0xbc71('0xf')]);module[_0xbc71('0x10')]=router; \ No newline at end of file +var _0xe740=['../../components/interaction/service','./voiceAgentReport.controller','get','isAuthenticated','index','/describe','describe','show','post','create','put','/:id','update','destroy','multer','util','path','connect-timeout','express','Router','../../components/auth/service'];(function(_0x5ce358,_0xa88c44){var _0x107f30=function(_0x5d7f28){while(--_0x5d7f28){_0x5ce358['push'](_0x5ce358['shift']());}};_0x107f30(++_0xa88c44);}(_0xe740,0x15e));var _0x0e74=function(_0x1443eb,_0x203408){_0x1443eb=_0x1443eb-0x0;var _0x2b8810=_0xe740[_0x1443eb];return _0x2b8810;};'use strict';var multer=require(_0x0e74('0x0'));var util=require(_0x0e74('0x1'));var path=require(_0x0e74('0x2'));var timeout=require(_0x0e74('0x3'));var express=require(_0x0e74('0x4'));var router=express[_0x0e74('0x5')]();var auth=require(_0x0e74('0x6'));var interaction=require(_0x0e74('0x7'));var config=require('../../config/environment');var controller=require(_0x0e74('0x8'));router[_0x0e74('0x9')]('/',auth[_0x0e74('0xa')](),controller[_0x0e74('0xb')]);router[_0x0e74('0x9')](_0x0e74('0xc'),auth[_0x0e74('0xa')](),controller[_0x0e74('0xd')]);router[_0x0e74('0x9')]('/:id',auth['isAuthenticated'](),controller[_0x0e74('0xe')]);router[_0x0e74('0xf')]('/',auth[_0x0e74('0xa')](),controller[_0x0e74('0x10')]);router[_0x0e74('0x11')](_0x0e74('0x12'),auth[_0x0e74('0xa')](),controller[_0x0e74('0x13')]);router['delete'](_0x0e74('0x12'),auth[_0x0e74('0xa')](),controller[_0x0e74('0x14')]);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 f126384..ab7a19c 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 _0xed1f=['FORWARD,\x20BLIND,\x20ATTENDED','sequelize','exports','STRING','DATE','INTEGER','BOOLEAN'];(function(_0x4fde08,_0x463a36){var _0x12e725=function(_0x2670c5){while(--_0x2670c5){_0x4fde08['push'](_0x4fde08['shift']());}};_0x12e725(++_0x463a36);}(_0xed1f,0x6a));var _0xfed1=function(_0x9dfc10,_0x19c2d5){_0x9dfc10=_0x9dfc10-0x0;var _0x4f938a=_0xed1f[_0x9dfc10];return _0x4f938a;};'use strict';var Sequelize=require(_0xfed1('0x0'));module[_0xfed1('0x1')]={'type':{'type':Sequelize[_0xfed1('0x2')]},'uniqueid':{'type':Sequelize[_0xfed1('0x2')]},'calleridnum':{'type':Sequelize[_0xfed1('0x2')]},'calleridname':{'type':Sequelize[_0xfed1('0x2')]},'queue':{'type':Sequelize[_0xfed1('0x2')]},'interface':{'type':Sequelize[_0xfed1('0x2')]},'membername':{'type':Sequelize[_0xfed1('0x2')]},'agentcalledAt':{'type':Sequelize[_0xfed1('0x3')]},'agentconnectAt':{'type':Sequelize[_0xfed1('0x3')]},'agentcompleteAt':{'type':Sequelize[_0xfed1('0x3')]},'agentringnoanswerAt':{'type':Sequelize[_0xfed1('0x3')]},'agentdumpAt':{'type':Sequelize[_0xfed1('0x3')]},'holdtime':{'type':Sequelize[_0xfed1('0x4')]},'agentcomplete':{'type':Sequelize[_0xfed1('0x5')],'defaultValue':![]},'agentringnoanswer':{'type':Sequelize[_0xfed1('0x5')],'defaultValue':![]},'agentdump':{'type':Sequelize[_0xfed1('0x5')],'defaultValue':![]},'talktime':{'type':Sequelize['INTEGER']},'agentacw':{'type':Sequelize[_0xfed1('0x5')],'defaultValue':![]},'acwtime':{'type':Sequelize[_0xfed1('0x4')]},'reason':{'type':Sequelize['STRING']},'lastevent':{'type':Sequelize[_0xfed1('0x2')]},'channel':{'type':Sequelize[_0xfed1('0x2')]},'channelstate':{'type':Sequelize['INTEGER']},'channelstatedesc':{'type':Sequelize[_0xfed1('0x2')]},'connectedlinenum':{'type':Sequelize['STRING']},'connectedlinename':{'type':Sequelize[_0xfed1('0x2')]},'language':{'type':Sequelize[_0xfed1('0x2')]},'accountcode':{'type':Sequelize['STRING']},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize[_0xfed1('0x2')]},'priority':{'type':Sequelize[_0xfed1('0x2')]},'destchannel':{'type':Sequelize['STRING']},'destchannelstate':{'type':Sequelize[_0xfed1('0x4')]},'destchannelstatedesc':{'type':Sequelize['STRING']},'destcalleridnum':{'type':Sequelize['STRING']},'destcalleridname':{'type':Sequelize[_0xfed1('0x2')]},'destconnectedlinenum':{'type':Sequelize[_0xfed1('0x2')]},'destconnectedlinename':{'type':Sequelize['STRING']},'destlanguage':{'type':Sequelize[_0xfed1('0x2')]},'destaccountcode':{'type':Sequelize['STRING']},'destcontext':{'type':Sequelize['STRING']},'destexten':{'type':Sequelize[_0xfed1('0x2')]},'destpriority':{'type':Sequelize[_0xfed1('0x2')]},'destuniqueid':{'type':Sequelize[_0xfed1('0x2')]},'answeredelsewheredestinationuniqueid':{'type':Sequelize[_0xfed1('0x2')]},'answeredelsewheremembername':{'type':Sequelize['STRING']},'transfer':{'type':Sequelize[_0xfed1('0x5')],'defaultValue':![]},'transfertype':{'type':Sequelize['STRING'],'comment':_0xfed1('0x6')},'transferexten':{'type':Sequelize[_0xfed1('0x2')]},'transferuniqueid':{'type':Sequelize['STRING']},'agententerreason':{'type':Sequelize[_0xfed1('0x4')],'defaultValue':0x0}}; \ No newline at end of file +var _0xdc97=['sequelize','exports','STRING','DATE','INTEGER','BOOLEAN','FORWARD,\x20BLIND,\x20ATTENDED'];(function(_0x22a85c,_0x350c51){var _0x424ebf=function(_0x3a5c32){while(--_0x3a5c32){_0x22a85c['push'](_0x22a85c['shift']());}};_0x424ebf(++_0x350c51);}(_0xdc97,0x13b));var _0x7dc9=function(_0x53fe11,_0x4ee355){_0x53fe11=_0x53fe11-0x0;var _0x50a47e=_0xdc97[_0x53fe11];return _0x50a47e;};'use strict';var Sequelize=require(_0x7dc9('0x0'));module[_0x7dc9('0x1')]={'type':{'type':Sequelize[_0x7dc9('0x2')]},'uniqueid':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0x7dc9('0x2')]},'calleridname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize[_0x7dc9('0x2')]},'interface':{'type':Sequelize[_0x7dc9('0x2')]},'membername':{'type':Sequelize['STRING']},'agentcalledAt':{'type':Sequelize[_0x7dc9('0x3')]},'agentconnectAt':{'type':Sequelize[_0x7dc9('0x3')]},'agentcompleteAt':{'type':Sequelize[_0x7dc9('0x3')]},'agentringnoanswerAt':{'type':Sequelize[_0x7dc9('0x3')]},'agentdumpAt':{'type':Sequelize['DATE']},'holdtime':{'type':Sequelize[_0x7dc9('0x4')]},'agentcomplete':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentringnoanswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentdump':{'type':Sequelize[_0x7dc9('0x5')],'defaultValue':![]},'talktime':{'type':Sequelize[_0x7dc9('0x4')]},'agentacw':{'type':Sequelize[_0x7dc9('0x5')],'defaultValue':![]},'acwtime':{'type':Sequelize[_0x7dc9('0x4')]},'reason':{'type':Sequelize[_0x7dc9('0x2')]},'lastevent':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0x7dc9('0x2')]},'channelstate':{'type':Sequelize[_0x7dc9('0x4')]},'channelstatedesc':{'type':Sequelize[_0x7dc9('0x2')]},'connectedlinenum':{'type':Sequelize[_0x7dc9('0x2')]},'connectedlinename':{'type':Sequelize[_0x7dc9('0x2')]},'language':{'type':Sequelize[_0x7dc9('0x2')]},'accountcode':{'type':Sequelize[_0x7dc9('0x2')]},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize['STRING']},'priority':{'type':Sequelize['STRING']},'destchannel':{'type':Sequelize['STRING']},'destchannelstate':{'type':Sequelize[_0x7dc9('0x4')]},'destchannelstatedesc':{'type':Sequelize[_0x7dc9('0x2')]},'destcalleridnum':{'type':Sequelize['STRING']},'destcalleridname':{'type':Sequelize[_0x7dc9('0x2')]},'destconnectedlinenum':{'type':Sequelize[_0x7dc9('0x2')]},'destconnectedlinename':{'type':Sequelize[_0x7dc9('0x2')]},'destlanguage':{'type':Sequelize[_0x7dc9('0x2')]},'destaccountcode':{'type':Sequelize[_0x7dc9('0x2')]},'destcontext':{'type':Sequelize[_0x7dc9('0x2')]},'destexten':{'type':Sequelize['STRING']},'destpriority':{'type':Sequelize[_0x7dc9('0x2')]},'destuniqueid':{'type':Sequelize[_0x7dc9('0x2')]},'answeredelsewheredestinationuniqueid':{'type':Sequelize[_0x7dc9('0x2')]},'answeredelsewheremembername':{'type':Sequelize[_0x7dc9('0x2')]},'transfer':{'type':Sequelize[_0x7dc9('0x5')],'defaultValue':![]},'transfertype':{'type':Sequelize[_0x7dc9('0x2')],'comment':_0x7dc9('0x6')},'transferexten':{'type':Sequelize[_0x7dc9('0x2')]},'transferuniqueid':{'type':Sequelize[_0x7dc9('0x2')]},'agententerreason':{'type':Sequelize['INTEGER'],'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 675285d..29d62dc 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 _0x9592=['../../config/license/hardware','../../config/utils','../../mysqldb','end','json','count','offset','limit','status','set','Content-Range','apply','reject','save','then','destroy','sendStatus','error','stack','name','send','VoiceAgentReport','rawAttributes','fieldName','model','map','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','type','VIRTUAL','merge','options','includeAll','findAll','rows','show','keys','include','find','create','body','catch','update','params','describe','eml-format','rimraf','zip-dir','moment','bluebird','mustache','util','path','to-csv','ejs','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch'];(function(_0xe30e17,_0xce02be){var _0x2342c9=function(_0x20b733){while(--_0x20b733){_0xe30e17['push'](_0xe30e17['shift']());}};_0x2342c9(++_0xce02be);}(_0x9592,0x160));var _0x2959=function(_0x31dad6,_0x271b9f){_0x31dad6=_0x31dad6-0x0;var _0x21cb81=_0x9592[_0x31dad6];return _0x21cb81;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x2959('0x0'));var rimraf=require(_0x2959('0x1'));var zipdir=require(_0x2959('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x2959('0x3'));var BPromise=require(_0x2959('0x4'));var Mustache=require(_0x2959('0x5'));var util=require(_0x2959('0x6'));var path=require(_0x2959('0x7'));var sox=require('sox');var csv=require(_0x2959('0x8'));var ejs=require(_0x2959('0x9'));var fs=require('fs');var _=require('lodash');var squel=require(_0x2959('0xa'));var crypto=require(_0x2959('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x2959('0xc'));var toCsv=require(_0x2959('0x8'));var querystring=require(_0x2959('0xd'));var Papa=require(_0x2959('0xe'));var Redis=require(_0x2959('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x2959('0x10'));var as=require(_0x2959('0x11'));var hardwareService=require(_0x2959('0x12'));var logger=require('../../config/logger')('api');var utils=require(_0x2959('0x13'));var config=require('../../config/environment');var db=require(_0x2959('0x14'))['db'];function respondWithStatusCode(_0x37f86a,_0x3516a3){_0x3516a3=_0x3516a3||0xcc;return function(_0x197e9e){if(_0x197e9e){return _0x37f86a['sendStatus'](_0x3516a3);}return _0x37f86a['status'](_0x3516a3)[_0x2959('0x15')]();};}function respondWithResult(_0x1d7e16,_0xc7cb27){_0xc7cb27=_0xc7cb27||0xc8;return function(_0x18a9ea){if(_0x18a9ea){return _0x1d7e16['status'](_0xc7cb27)[_0x2959('0x16')](_0x18a9ea);}};}function respondWithFilteredResult(_0x4778e0,_0xb5bfa9){return function(_0x276c81){if(_0x276c81){var _0x5dea7d=_0x276c81[_0x2959('0x17')],_0x24b265=_0xb5bfa9[_0x2959('0x18')],_0x599fae=_0xb5bfa9[_0x2959('0x18')]+_0xb5bfa9[_0x2959('0x19')],_0x500302;if(_0x599fae>=_0x5dea7d){_0x599fae=_0x5dea7d;_0x500302=0xc8;}else{_0x500302=0xce;}_0x4778e0[_0x2959('0x1a')](_0x500302);return _0x4778e0[_0x2959('0x1b')](_0x2959('0x1c'),_0x24b265+'-'+_0x599fae+'/'+_0x5dea7d)[_0x2959('0x16')](_0x276c81);}return null;};}function patchUpdates(_0x35e9c8){return function(_0x11f43d){try{jsonpatch[_0x2959('0x1d')](_0x11f43d,_0x35e9c8,!![]);}catch(_0x54fc8f){return BPromise[_0x2959('0x1e')](_0x54fc8f);}return _0x11f43d[_0x2959('0x1f')]();};}function saveUpdates(_0x36230b,_0x56114e){return function(_0x344084){if(_0x344084){return _0x344084['update'](_0x36230b)[_0x2959('0x20')](function(_0x41e267){return _0x41e267;});}return null;};}function removeEntity(_0x157f26,_0x48bc9c){return function(_0x497d5f){if(_0x497d5f){return _0x497d5f[_0x2959('0x21')]()[_0x2959('0x20')](function(){_0x157f26[_0x2959('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x787fff,_0x3798e1){return function(_0x43adc2){if(!_0x43adc2){_0x787fff[_0x2959('0x22')](0x194);}return _0x43adc2;};}function handleError(_0x172f38,_0x51e84f){_0x51e84f=_0x51e84f||0x1f4;return function(_0x3d24ee){logger[_0x2959('0x23')](_0x3d24ee[_0x2959('0x24')]);if(_0x3d24ee[_0x2959('0x25')]){delete _0x3d24ee[_0x2959('0x25')];}_0x172f38['status'](_0x51e84f)[_0x2959('0x26')](_0x3d24ee);};}exports['index']=function(_0x1412b4,_0x151ff8){var _0x53e534={},_0xe4fafb={},_0x5a2ebf={'count':0x0,'rows':[]};var _0x1a9243=_['map'](db[_0x2959('0x27')][_0x2959('0x28')],function(_0x18aedc){return{'name':_0x18aedc[_0x2959('0x29')],'type':_0x18aedc['type']['key']};});_0xe4fafb[_0x2959('0x2a')]=_[_0x2959('0x2b')](_0x1a9243,'name');_0xe4fafb[_0x2959('0x2c')]=_['keys'](_0x1412b4[_0x2959('0x2c')]);_0xe4fafb[_0x2959('0x2d')]=_['intersection'](_0xe4fafb[_0x2959('0x2a')],_0xe4fafb[_0x2959('0x2c')]);_0x53e534[_0x2959('0x2e')]=_[_0x2959('0x2f')](_0xe4fafb[_0x2959('0x2a')],qs[_0x2959('0x30')](_0x1412b4[_0x2959('0x2c')]['fields']));_0x53e534[_0x2959('0x2e')]=_0x53e534[_0x2959('0x2e')][_0x2959('0x31')]?_0x53e534[_0x2959('0x2e')]:_0xe4fafb[_0x2959('0x2a')];if(!_0x1412b4[_0x2959('0x2c')][_0x2959('0x32')](_0x2959('0x33'))){_0x53e534[_0x2959('0x19')]=qs['limit'](_0x1412b4[_0x2959('0x2c')][_0x2959('0x19')]);_0x53e534[_0x2959('0x18')]=qs['offset'](_0x1412b4['query'][_0x2959('0x18')]);}_0x53e534[_0x2959('0x34')]=qs[_0x2959('0x35')](_0x1412b4[_0x2959('0x2c')]['sort']);_0x53e534[_0x2959('0x36')]=qs[_0x2959('0x2d')](_[_0x2959('0x37')](_0x1412b4[_0x2959('0x2c')],_0xe4fafb[_0x2959('0x2d')]),_0x1a9243);if(_0x1412b4['query'][_0x2959('0x38')]){_0x53e534[_0x2959('0x36')]=_['merge'](_0x53e534[_0x2959('0x36')],{'$or':_[_0x2959('0x2b')](_0x1a9243,function(_0x52113b){if(_0x52113b[_0x2959('0x39')]!==_0x2959('0x3a')){var _0x293d31={};_0x293d31[_0x52113b[_0x2959('0x25')]]={'$like':'%'+_0x1412b4[_0x2959('0x2c')]['filter']+'%'};return _0x293d31;}})});}_0x53e534=_[_0x2959('0x3b')]({},_0x53e534,_0x1412b4[_0x2959('0x3c')]);var _0x3cc8bb={'where':_0x53e534[_0x2959('0x36')]};return db['VoiceAgentReport'][_0x2959('0x17')](_0x3cc8bb)[_0x2959('0x20')](function(_0x536fac){_0x5a2ebf[_0x2959('0x17')]=_0x536fac;if(_0x1412b4[_0x2959('0x2c')][_0x2959('0x3d')]){_0x53e534['include']=[{'all':!![]}];}return db['VoiceAgentReport'][_0x2959('0x3e')](_0x53e534);})[_0x2959('0x20')](function(_0x57ae3a){_0x5a2ebf[_0x2959('0x3f')]=_0x57ae3a;return _0x5a2ebf;})[_0x2959('0x20')](respondWithFilteredResult(_0x151ff8,_0x53e534))['catch'](handleError(_0x151ff8,null));};exports[_0x2959('0x40')]=function(_0x43de84,_0x330769){var _0x3a95a5={'raw':![],'where':{'id':_0x43de84['params']['id']}},_0x19e643={};_0x19e643[_0x2959('0x2a')]=_[_0x2959('0x41')](db[_0x2959('0x27')][_0x2959('0x28')]);_0x19e643[_0x2959('0x2c')]=_[_0x2959('0x41')](_0x43de84[_0x2959('0x2c')]);_0x19e643['filters']=_[_0x2959('0x2f')](_0x19e643[_0x2959('0x2a')],_0x19e643[_0x2959('0x2c')]);_0x3a95a5[_0x2959('0x2e')]=_[_0x2959('0x2f')](_0x19e643[_0x2959('0x2a')],qs[_0x2959('0x30')](_0x43de84[_0x2959('0x2c')]['fields']));_0x3a95a5[_0x2959('0x2e')]=_0x3a95a5[_0x2959('0x2e')][_0x2959('0x31')]?_0x3a95a5['attributes']:_0x19e643[_0x2959('0x2a')];if(_0x43de84['query']['includeAll']){_0x3a95a5[_0x2959('0x42')]=[{'all':!![]}];}_0x3a95a5=_[_0x2959('0x3b')]({},_0x3a95a5,_0x43de84['options']);return db['VoiceAgentReport'][_0x2959('0x43')](_0x3a95a5)['then'](handleEntityNotFound(_0x330769,null))[_0x2959('0x20')](respondWithResult(_0x330769,null))['catch'](handleError(_0x330769,null));};exports[_0x2959('0x44')]=function(_0x5d53b5,_0x56718d){return db[_0x2959('0x27')][_0x2959('0x44')](_0x5d53b5[_0x2959('0x45')],{})[_0x2959('0x20')](respondWithResult(_0x56718d,0xc9))[_0x2959('0x46')](handleError(_0x56718d,null));};exports[_0x2959('0x47')]=function(_0x25af7a,_0x4ca653){if(_0x25af7a['body']['id']){delete _0x25af7a[_0x2959('0x45')]['id'];}return db[_0x2959('0x27')][_0x2959('0x43')]({'where':{'id':_0x25af7a[_0x2959('0x48')]['id']}})[_0x2959('0x20')](handleEntityNotFound(_0x4ca653,null))['then'](saveUpdates(_0x25af7a[_0x2959('0x45')],null))[_0x2959('0x20')](respondWithResult(_0x4ca653,null))[_0x2959('0x46')](handleError(_0x4ca653,null));};exports[_0x2959('0x21')]=function(_0x1284cb,_0x4e278a){return db[_0x2959('0x27')][_0x2959('0x43')]({'where':{'id':_0x1284cb[_0x2959('0x48')]['id']}})[_0x2959('0x20')](handleEntityNotFound(_0x4e278a,null))['then'](removeEntity(_0x4e278a,null))[_0x2959('0x46')](handleError(_0x4e278a,null));};exports[_0x2959('0x49')]=function(_0x543fe0,_0x2d08dd){return db[_0x2959('0x27')][_0x2959('0x49')]()[_0x2959('0x20')](respondWithResult(_0x2d08dd,null))['catch'](handleError(_0x2d08dd,null));}; \ No newline at end of file +var _0x30f1=['merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','params','length','find','create','body','describe','eml-format','rimraf','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','api','../../config/environment','sendStatus','status','json','count','offset','limit','set','Content-Range','apply','reject','update','then','destroy','error','stack','name','send','VoiceAgentReport','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter'];(function(_0x46d823,_0x2fc351){var _0x2a1623=function(_0xde1602){while(--_0xde1602){_0x46d823['push'](_0x46d823['shift']());}};_0x2a1623(++_0x2fc351);}(_0x30f1,0xa0));var _0x130f=function(_0x17f827,_0x22aa98){_0x17f827=_0x17f827-0x0;var _0x2d3e93=_0x30f1[_0x17f827];return _0x2d3e93;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x130f('0x0'));var rimraf=require(_0x130f('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x130f('0x2'));var moment=require(_0x130f('0x3'));var BPromise=require(_0x130f('0x4'));var Mustache=require(_0x130f('0x5'));var util=require(_0x130f('0x6'));var path=require(_0x130f('0x7'));var sox=require(_0x130f('0x8'));var csv=require(_0x130f('0x9'));var ejs=require(_0x130f('0xa'));var fs=require('fs');var _=require('lodash');var squel=require(_0x130f('0xb'));var crypto=require(_0x130f('0xc'));var jsforce=require(_0x130f('0xd'));var deskjs=require(_0x130f('0xe'));var toCsv=require(_0x130f('0x9'));var querystring=require(_0x130f('0xf'));var Papa=require(_0x130f('0x10'));var Redis=require(_0x130f('0x11'));var authService=require(_0x130f('0x12'));var qs=require(_0x130f('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x130f('0x14'));var utils=require('../../config/utils');var config=require(_0x130f('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2095ff,_0x3e71a3){_0x3e71a3=_0x3e71a3||0xcc;return function(_0xeb4d8f){if(_0xeb4d8f){return _0x2095ff[_0x130f('0x16')](_0x3e71a3);}return _0x2095ff['status'](_0x3e71a3)['end']();};}function respondWithResult(_0x3cffe8,_0x4de0ef){_0x4de0ef=_0x4de0ef||0xc8;return function(_0xdea2ab){if(_0xdea2ab){return _0x3cffe8[_0x130f('0x17')](_0x4de0ef)[_0x130f('0x18')](_0xdea2ab);}};}function respondWithFilteredResult(_0x260b0c,_0x7cc260){return function(_0x17a239){if(_0x17a239){var _0x44d06e=_0x17a239[_0x130f('0x19')],_0x2b7e37=_0x7cc260['offset'],_0x486b19=_0x7cc260[_0x130f('0x1a')]+_0x7cc260[_0x130f('0x1b')],_0x19e10d;if(_0x486b19>=_0x44d06e){_0x486b19=_0x44d06e;_0x19e10d=0xc8;}else{_0x19e10d=0xce;}_0x260b0c['status'](_0x19e10d);return _0x260b0c[_0x130f('0x1c')](_0x130f('0x1d'),_0x2b7e37+'-'+_0x486b19+'/'+_0x44d06e)[_0x130f('0x18')](_0x17a239);}return null;};}function patchUpdates(_0x3386e1){return function(_0x4b693e){try{jsonpatch[_0x130f('0x1e')](_0x4b693e,_0x3386e1,!![]);}catch(_0x54f238){return BPromise[_0x130f('0x1f')](_0x54f238);}return _0x4b693e['save']();};}function saveUpdates(_0x35f94b,_0x19bfb5){return function(_0x444078){if(_0x444078){return _0x444078[_0x130f('0x20')](_0x35f94b)[_0x130f('0x21')](function(_0x969692){return _0x969692;});}return null;};}function removeEntity(_0x3508f8,_0x531b6e){return function(_0x1e350d){if(_0x1e350d){return _0x1e350d[_0x130f('0x22')]()[_0x130f('0x21')](function(){_0x3508f8[_0x130f('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x827c25,_0x4b2984){return function(_0x5aab40){if(!_0x5aab40){_0x827c25[_0x130f('0x16')](0x194);}return _0x5aab40;};}function handleError(_0x51c2b5,_0x19e8bf){_0x19e8bf=_0x19e8bf||0x1f4;return function(_0x16171a){logger[_0x130f('0x23')](_0x16171a[_0x130f('0x24')]);if(_0x16171a[_0x130f('0x25')]){delete _0x16171a[_0x130f('0x25')];}_0x51c2b5[_0x130f('0x17')](_0x19e8bf)[_0x130f('0x26')](_0x16171a);};}exports['index']=function(_0x41e6ef,_0x52f882){var _0x3ab813={},_0x58c69f={},_0x57f294={'count':0x0,'rows':[]};var _0x3508f9=_['map'](db[_0x130f('0x27')][_0x130f('0x28')],function(_0x5367f9){return{'name':_0x5367f9[_0x130f('0x29')],'type':_0x5367f9[_0x130f('0x2a')][_0x130f('0x2b')]};});_0x58c69f[_0x130f('0x2c')]=_[_0x130f('0x2d')](_0x3508f9,'name');_0x58c69f[_0x130f('0x2e')]=_[_0x130f('0x2f')](_0x41e6ef[_0x130f('0x2e')]);_0x58c69f[_0x130f('0x30')]=_[_0x130f('0x31')](_0x58c69f[_0x130f('0x2c')],_0x58c69f[_0x130f('0x2e')]);_0x3ab813[_0x130f('0x32')]=_[_0x130f('0x31')](_0x58c69f['model'],qs[_0x130f('0x33')](_0x41e6ef[_0x130f('0x2e')][_0x130f('0x33')]));_0x3ab813['attributes']=_0x3ab813['attributes']['length']?_0x3ab813[_0x130f('0x32')]:_0x58c69f[_0x130f('0x2c')];if(!_0x41e6ef['query'][_0x130f('0x34')](_0x130f('0x35'))){_0x3ab813['limit']=qs[_0x130f('0x1b')](_0x41e6ef[_0x130f('0x2e')][_0x130f('0x1b')]);_0x3ab813[_0x130f('0x1a')]=qs[_0x130f('0x1a')](_0x41e6ef['query'][_0x130f('0x1a')]);}_0x3ab813[_0x130f('0x36')]=qs['sort'](_0x41e6ef[_0x130f('0x2e')][_0x130f('0x37')]);_0x3ab813[_0x130f('0x38')]=qs[_0x130f('0x30')](_[_0x130f('0x39')](_0x41e6ef[_0x130f('0x2e')],_0x58c69f[_0x130f('0x30')]),_0x3508f9);if(_0x41e6ef[_0x130f('0x2e')][_0x130f('0x3a')]){_0x3ab813[_0x130f('0x38')]=_[_0x130f('0x3b')](_0x3ab813[_0x130f('0x38')],{'$or':_['map'](_0x3508f9,function(_0x2be02c){if(_0x2be02c[_0x130f('0x2a')]!==_0x130f('0x3c')){var _0x3e790d={};_0x3e790d[_0x2be02c['name']]={'$like':'%'+_0x41e6ef['query'][_0x130f('0x3a')]+'%'};return _0x3e790d;}})});}_0x3ab813=_[_0x130f('0x3b')]({},_0x3ab813,_0x41e6ef[_0x130f('0x3d')]);var _0x52c5be={'where':_0x3ab813[_0x130f('0x38')]};return db[_0x130f('0x27')][_0x130f('0x19')](_0x52c5be)[_0x130f('0x21')](function(_0xdbba21){_0x57f294[_0x130f('0x19')]=_0xdbba21;if(_0x41e6ef[_0x130f('0x2e')][_0x130f('0x3e')]){_0x3ab813[_0x130f('0x3f')]=[{'all':!![]}];}return db[_0x130f('0x27')][_0x130f('0x40')](_0x3ab813);})[_0x130f('0x21')](function(_0x79001c){_0x57f294[_0x130f('0x41')]=_0x79001c;return _0x57f294;})['then'](respondWithFilteredResult(_0x52f882,_0x3ab813))[_0x130f('0x42')](handleError(_0x52f882,null));};exports['show']=function(_0x183cd3,_0x19855f){var _0x466b1f={'raw':![],'where':{'id':_0x183cd3[_0x130f('0x43')]['id']}},_0x306c38={};_0x306c38[_0x130f('0x2c')]=_[_0x130f('0x2f')](db[_0x130f('0x27')][_0x130f('0x28')]);_0x306c38[_0x130f('0x2e')]=_[_0x130f('0x2f')](_0x183cd3['query']);_0x306c38[_0x130f('0x30')]=_[_0x130f('0x31')](_0x306c38[_0x130f('0x2c')],_0x306c38[_0x130f('0x2e')]);_0x466b1f[_0x130f('0x32')]=_['intersection'](_0x306c38[_0x130f('0x2c')],qs[_0x130f('0x33')](_0x183cd3[_0x130f('0x2e')][_0x130f('0x33')]));_0x466b1f[_0x130f('0x32')]=_0x466b1f['attributes'][_0x130f('0x44')]?_0x466b1f[_0x130f('0x32')]:_0x306c38[_0x130f('0x2c')];if(_0x183cd3[_0x130f('0x2e')][_0x130f('0x3e')]){_0x466b1f[_0x130f('0x3f')]=[{'all':!![]}];}_0x466b1f=_[_0x130f('0x3b')]({},_0x466b1f,_0x183cd3[_0x130f('0x3d')]);return db['VoiceAgentReport'][_0x130f('0x45')](_0x466b1f)['then'](handleEntityNotFound(_0x19855f,null))[_0x130f('0x21')](respondWithResult(_0x19855f,null))['catch'](handleError(_0x19855f,null));};exports[_0x130f('0x46')]=function(_0x81a507,_0x5dc020){return db[_0x130f('0x27')][_0x130f('0x46')](_0x81a507[_0x130f('0x47')],{})[_0x130f('0x21')](respondWithResult(_0x5dc020,0xc9))[_0x130f('0x42')](handleError(_0x5dc020,null));};exports[_0x130f('0x20')]=function(_0x3be1e4,_0x47d460){if(_0x3be1e4[_0x130f('0x47')]['id']){delete _0x3be1e4[_0x130f('0x47')]['id'];}return db['VoiceAgentReport'][_0x130f('0x45')]({'where':{'id':_0x3be1e4['params']['id']}})[_0x130f('0x21')](handleEntityNotFound(_0x47d460,null))[_0x130f('0x21')](saveUpdates(_0x3be1e4[_0x130f('0x47')],null))[_0x130f('0x21')](respondWithResult(_0x47d460,null))[_0x130f('0x42')](handleError(_0x47d460,null));};exports[_0x130f('0x22')]=function(_0x251847,_0x5c1154){return db[_0x130f('0x27')][_0x130f('0x45')]({'where':{'id':_0x251847[_0x130f('0x43')]['id']}})[_0x130f('0x21')](handleEntityNotFound(_0x5c1154,null))[_0x130f('0x21')](removeEntity(_0x5c1154,null))['catch'](handleError(_0x5c1154,null));};exports[_0x130f('0x48')]=function(_0xde448c,_0x1cc6e4){return db[_0x130f('0x27')]['describe']()[_0x130f('0x21')](respondWithResult(_0x1cc6e4,null))[_0x130f('0x42')](handleError(_0x1cc6e4,null));}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.model.js b/server/api/voiceAgentReport/voiceAgentReport.model.js index 482d0ff..2e717ae 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 _0xe706=['report_agent','uniqueid','destuniqueid','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./voiceAgentReport.attributes','exports','define','VoiceAgentReport'];(function(_0x26ce0f,_0x5c2378){var _0x268931=function(_0x545e0b){while(--_0x545e0b){_0x26ce0f['push'](_0x26ce0f['shift']());}};_0x268931(++_0x5c2378);}(_0xe706,0xa3));var _0x6e70=function(_0x20fa14,_0x2f0234){_0x20fa14=_0x20fa14-0x0;var _0x161aa0=_0xe706[_0x20fa14];return _0x161aa0;};'use strict';var _=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var logger=require(_0x6e70('0x2'))('api');var moment=require(_0x6e70('0x3'));var BPromise=require(_0x6e70('0x4'));var rp=require(_0x6e70('0x5'));var fs=require('fs');var path=require(_0x6e70('0x6'));var rimraf=require(_0x6e70('0x7'));var config=require(_0x6e70('0x8'));var attributes=require(_0x6e70('0x9'));module[_0x6e70('0xa')]=function(_0x1b0389,_0x4381d1){return _0x1b0389[_0x6e70('0xb')](_0x6e70('0xc'),attributes,{'tableName':_0x6e70('0xd'),'paranoid':![],'indexes':[{'fields':[_0x6e70('0xe'),_0x6e70('0xf')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xa9e0=['define','VoiceAgentReport','destuniqueid','lodash','util','../../config/logger','bluebird','path','rimraf','../../config/environment','./voiceAgentReport.attributes','exports'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4bfac3,_0x58324d){_0x4bfac3=_0x4bfac3-0x0;var _0x15f0f2=_0xa9e0[_0x4bfac3];return _0x15f0f2;};'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':'report_agent','paranoid':![],'indexes':[{'fields':['uniqueid',_0x0a9e('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.rpc.js b/server/api/voiceAgentReport/voiceAgentReport.rpc.js index 50e4745..f24e645 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 _0xa98e=['stringify','UpdateVoiceAgentReport','where','attributes','limit','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','VoiceAgentReport,\x20%s,\x20%s','request\x20sent','VoiceAgentReport,\x20%s,\x20%s,\x20%s','code','error','message','catch','CreateVoiceAgentReport','VoiceAgentReport','create','body','options','raw'];(function(_0x217dee,_0xbde5bf){var _0x23ddb0=function(_0x17ccf1){while(--_0x17ccf1){_0x217dee['push'](_0x217dee['shift']());}};_0x23ddb0(++_0xbde5bf);}(_0xa98e,0xaa));var _0xea98=function(_0x5a16f4,_0x3b56b7){_0x5a16f4=_0x5a16f4-0x0;var _0x168e61=_0xa98e[_0x5a16f4];return _0x168e61;};'use strict';var _=require(_0xea98('0x0'));var util=require(_0xea98('0x1'));var moment=require('moment');var BPromise=require(_0xea98('0x2'));var rs=require(_0xea98('0x3'));var fs=require('fs');var Redis=require(_0xea98('0x4'));var db=require(_0xea98('0x5'))['db'];var utils=require(_0xea98('0x6'));var logger=require(_0xea98('0x7'))(_0xea98('0x8'));var config=require(_0xea98('0x9'));var jayson=require(_0xea98('0xa'));var client=jayson[_0xea98('0xb')][_0xea98('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x4ae4ed,_0x4cd207,_0x1f2fc2){return new BPromise(function(_0x1e08d9,_0x1f4cb4){return client['request'](_0x4ae4ed,_0x1f2fc2)[_0xea98('0xd')](function(_0x3baa55){logger[_0xea98('0xe')](_0xea98('0xf'),_0x4cd207,_0xea98('0x10'));logger['debug'](_0xea98('0x11'),_0x4cd207,'request\x20sent',JSON['stringify'](_0x3baa55));if(_0x3baa55['error']){if(_0x3baa55['error'][_0xea98('0x12')]===0x1f4){logger[_0xea98('0x13')]('VoiceAgentReport,\x20%s,\x20%s',_0x4cd207,_0x3baa55[_0xea98('0x13')][_0xea98('0x14')]);return _0x1f4cb4(_0x3baa55[_0xea98('0x13')][_0xea98('0x14')]);}logger[_0xea98('0x13')]('VoiceAgentReport,\x20%s,\x20%s',_0x4cd207,_0x3baa55[_0xea98('0x13')][_0xea98('0x14')]);return _0x1e08d9(_0x3baa55[_0xea98('0x13')][_0xea98('0x14')]);}else{logger['info'](_0xea98('0xf'),_0x4cd207,_0xea98('0x10'));_0x1e08d9(_0x3baa55['result'][_0xea98('0x14')]);}})[_0xea98('0x15')](function(_0x25fcbd){logger[_0xea98('0x13')]('VoiceAgentReport,\x20%s,\x20%s',_0x4cd207,_0x25fcbd);_0x1f4cb4(_0x25fcbd);});});}exports[_0xea98('0x16')]=function(_0x2eea6e){var _0x25ae7a=this;return new Promise(function(_0x46e28a,_0x1b84c6){return db[_0xea98('0x17')][_0xea98('0x18')](_0x2eea6e[_0xea98('0x19')],{'raw':_0x2eea6e[_0xea98('0x1a')]?_0x2eea6e[_0xea98('0x1a')][_0xea98('0x1b')]===undefined?!![]:![]:!![]})[_0xea98('0xd')](function(_0x14e200){logger[_0xea98('0xe')]('CreateVoiceAgentReport',_0x2eea6e);logger['debug'](_0xea98('0x16'),_0x2eea6e,JSON[_0xea98('0x1c')](_0x14e200));_0x46e28a(_0x14e200);})[_0xea98('0x15')](function(_0x2fa49f){logger[_0xea98('0x13')](_0xea98('0x16'),_0x2fa49f['message'],_0x2eea6e);_0x1b84c6(_0x25ae7a[_0xea98('0x13')](0x1f4,_0x2fa49f['message']));});});};exports[_0xea98('0x1d')]=function(_0x3f4eb0){var _0xa52ada=this;return new Promise(function(_0x355903,_0x597a6){return db[_0xea98('0x17')]['update'](_0x3f4eb0[_0xea98('0x19')],{'raw':_0x3f4eb0[_0xea98('0x1a')]?_0x3f4eb0[_0xea98('0x1a')][_0xea98('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3f4eb0[_0xea98('0x1a')]?_0x3f4eb0[_0xea98('0x1a')][_0xea98('0x1e')]||null:null,'attributes':_0x3f4eb0[_0xea98('0x1a')]?_0x3f4eb0[_0xea98('0x1a')][_0xea98('0x1f')]||null:null,'limit':_0x3f4eb0[_0xea98('0x1a')]?_0x3f4eb0['options'][_0xea98('0x20')]||null:null})['then'](function(_0x32465a){logger[_0xea98('0xe')](_0xea98('0x1d'),_0x3f4eb0);logger['debug'](_0xea98('0x1d'),_0x3f4eb0,JSON[_0xea98('0x1c')](_0x32465a));_0x355903(_0x32465a);})['catch'](function(_0x1e36c4){logger['error'](_0xea98('0x1d'),_0x1e36c4[_0xea98('0x14')],_0x3f4eb0);_0x597a6(_0xa52ada[_0xea98('0x13')](0x1f4,_0x1e36c4['message']));});});}; \ No newline at end of file +var _0x6f67=['UpdateVoiceAgentReport','update','body','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','then','info','VoiceAgentReport,\x20%s,\x20%s','request\x20sent','debug','VoiceAgentReport,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','VoiceAgentReport','options','raw','CreateVoiceAgentReport','stringify'];(function(_0x5f1391,_0x19c132){var _0x50ebe3=function(_0x3d00a3){while(--_0x3d00a3){_0x5f1391['push'](_0x5f1391['shift']());}};_0x50ebe3(++_0x19c132);}(_0x6f67,0x1d4));var _0x76f6=function(_0x21f78e,_0x54a66b){_0x21f78e=_0x21f78e-0x0;var _0x207ad2=_0x6f67[_0x21f78e];return _0x207ad2;};'use strict';var _=require('lodash');var util=require(_0x76f6('0x0'));var moment=require(_0x76f6('0x1'));var BPromise=require(_0x76f6('0x2'));var rs=require(_0x76f6('0x3'));var fs=require('fs');var Redis=require(_0x76f6('0x4'));var db=require(_0x76f6('0x5'))['db'];var utils=require(_0x76f6('0x6'));var logger=require('../../config/logger')(_0x76f6('0x7'));var config=require(_0x76f6('0x8'));var jayson=require(_0x76f6('0x9'));var client=jayson[_0x76f6('0xa')][_0x76f6('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x330171,_0x5c33ec,_0x359d7c){return new BPromise(function(_0x2ff924,_0x3fa8cf){return client['request'](_0x330171,_0x359d7c)[_0x76f6('0xc')](function(_0x3790b3){logger[_0x76f6('0xd')](_0x76f6('0xe'),_0x5c33ec,_0x76f6('0xf'));logger[_0x76f6('0x10')](_0x76f6('0x11'),_0x5c33ec,_0x76f6('0xf'),JSON['stringify'](_0x3790b3));if(_0x3790b3[_0x76f6('0x12')]){if(_0x3790b3['error'][_0x76f6('0x13')]===0x1f4){logger['error'](_0x76f6('0xe'),_0x5c33ec,_0x3790b3[_0x76f6('0x12')]['message']);return _0x3fa8cf(_0x3790b3[_0x76f6('0x12')]['message']);}logger['error'](_0x76f6('0xe'),_0x5c33ec,_0x3790b3[_0x76f6('0x12')][_0x76f6('0x14')]);return _0x2ff924(_0x3790b3[_0x76f6('0x12')][_0x76f6('0x14')]);}else{logger[_0x76f6('0xd')](_0x76f6('0xe'),_0x5c33ec,_0x76f6('0xf'));_0x2ff924(_0x3790b3[_0x76f6('0x15')][_0x76f6('0x14')]);}})[_0x76f6('0x16')](function(_0x4063d5){logger[_0x76f6('0x12')](_0x76f6('0xe'),_0x5c33ec,_0x4063d5);_0x3fa8cf(_0x4063d5);});});}exports['CreateVoiceAgentReport']=function(_0x202614){var _0x133da1=this;return new Promise(function(_0x5d1f13,_0x328b4c){return db[_0x76f6('0x17')]['create'](_0x202614['body'],{'raw':_0x202614['options']?_0x202614[_0x76f6('0x18')][_0x76f6('0x19')]===undefined?!![]:![]:!![]})[_0x76f6('0xc')](function(_0x26cf79){logger['info'](_0x76f6('0x1a'),_0x202614);logger[_0x76f6('0x10')](_0x76f6('0x1a'),_0x202614,JSON[_0x76f6('0x1b')](_0x26cf79));_0x5d1f13(_0x26cf79);})[_0x76f6('0x16')](function(_0x55dab7){logger[_0x76f6('0x12')](_0x76f6('0x1a'),_0x55dab7[_0x76f6('0x14')],_0x202614);_0x328b4c(_0x133da1[_0x76f6('0x12')](0x1f4,_0x55dab7['message']));});});};exports[_0x76f6('0x1c')]=function(_0x2c6d2f){var _0x25dabd=this;return new Promise(function(_0x3ec91d,_0x3f499e){return db[_0x76f6('0x17')][_0x76f6('0x1d')](_0x2c6d2f[_0x76f6('0x1e')],{'raw':_0x2c6d2f['options']?_0x2c6d2f['options'][_0x76f6('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2c6d2f['options']?_0x2c6d2f['options']['where']||null:null,'attributes':_0x2c6d2f['options']?_0x2c6d2f[_0x76f6('0x18')]['attributes']||null:null,'limit':_0x2c6d2f[_0x76f6('0x18')]?_0x2c6d2f['options']['limit']||null:null})['then'](function(_0x35476f){logger[_0x76f6('0xd')](_0x76f6('0x1c'),_0x2c6d2f);logger[_0x76f6('0x10')]('UpdateVoiceAgentReport',_0x2c6d2f,JSON[_0x76f6('0x1b')](_0x35476f));_0x3ec91d(_0x35476f);})[_0x76f6('0x16')](function(_0x38fed){logger['error']('UpdateVoiceAgentReport',_0x38fed[_0x76f6('0x14')],_0x2c6d2f);_0x3f499e(_0x25dabd[_0x76f6('0x12')](0x1f4,_0x38fed['message']));});});}; \ No newline at end of file diff --git a/server/api/voiceCallReport/index.js b/server/api/voiceCallReport/index.js index 006e44f..15a2b1f 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 _0x7928=['put','/:id','update','delete','util','path','Router','../../components/auth/service','../../config/environment','./voiceCallReport.controller','get','isAuthenticated','show','post','create'];(function(_0x30d38c,_0x4f91d9){var _0x23e0f7=function(_0x5a1c63){while(--_0x5a1c63){_0x30d38c['push'](_0x30d38c['shift']());}};_0x23e0f7(++_0x4f91d9);}(_0x7928,0xf4));var _0x8792=function(_0x36fddf,_0xc46d0d){_0x36fddf=_0x36fddf-0x0;var _0x5005ca=_0x7928[_0x36fddf];return _0x5005ca;};'use strict';var multer=require('multer');var util=require(_0x8792('0x0'));var path=require(_0x8792('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x8792('0x2')]();var auth=require(_0x8792('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0x8792('0x4'));var controller=require(_0x8792('0x5'));router[_0x8792('0x6')]('/',auth[_0x8792('0x7')](),controller['index']);router[_0x8792('0x6')]('/describe',auth[_0x8792('0x7')](),controller['describe']);router['get']('/:id',auth['isAuthenticated'](),controller[_0x8792('0x8')]);router[_0x8792('0x9')]('/',auth[_0x8792('0x7')](),controller[_0x8792('0xa')]);router[_0x8792('0xb')](_0x8792('0xc'),auth[_0x8792('0x7')](),controller[_0x8792('0xd')]);router[_0x8792('0xe')](_0x8792('0xc'),auth[_0x8792('0x7')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x298d=['multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceCallReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','create','put','update','delete','destroy','exports'];(function(_0x5071b2,_0x370e50){var _0x1d68dd=function(_0x42c954){while(--_0x42c954){_0x5071b2['push'](_0x5071b2['shift']());}};_0x1d68dd(++_0x370e50);}(_0x298d,0x1e4));var _0xd298=function(_0x321e41,_0x471c01){_0x321e41=_0x321e41-0x0;var _0x2f5c46=_0x298d[_0x321e41];return _0x2f5c46;};'use strict';var multer=require(_0xd298('0x0'));var util=require(_0xd298('0x1'));var path=require(_0xd298('0x2'));var timeout=require('connect-timeout');var express=require(_0xd298('0x3'));var router=express[_0xd298('0x4')]();var auth=require(_0xd298('0x5'));var interaction=require(_0xd298('0x6'));var config=require(_0xd298('0x7'));var controller=require(_0xd298('0x8'));router[_0xd298('0x9')]('/',auth[_0xd298('0xa')](),controller[_0xd298('0xb')]);router['get'](_0xd298('0xc'),auth[_0xd298('0xa')](),controller[_0xd298('0xd')]);router[_0xd298('0x9')](_0xd298('0xe'),auth[_0xd298('0xa')](),controller[_0xd298('0xf')]);router['post']('/',auth[_0xd298('0xa')](),controller[_0xd298('0x10')]);router[_0xd298('0x11')](_0xd298('0xe'),auth[_0xd298('0xa')](),controller[_0xd298('0x12')]);router[_0xd298('0x13')](_0xd298('0xe'),auth[_0xd298('0xa')](),controller[_0xd298('0x14')]);module[_0xd298('0x15')]=router; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.attributes.js b/server/api/voiceCallReport/voiceCallReport.attributes.js index 957e14b..d1849a4 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(_0x55a345,_0x1a7ec1){var _0x257a39=function(_0x396959){while(--_0x396959){_0x55a345['push'](_0x55a345['shift']());}};_0x257a39(++_0x1a7ec1);}(_0x9957,0x93));var _0x7995=function(_0x1ac595,_0x5d2081){_0x1ac595=_0x1ac595-0x0;var _0x455fff=_0x9957[_0x1ac595];return _0x455fff;};'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(_0xc01d2,_0x29f146){var _0x17f297=function(_0x24703f){while(--_0x24703f){_0xc01d2['push'](_0xc01d2['shift']());}};_0x17f297(++_0x29f146);}(_0xa9e0,0x123));var _0x0a9e=function(_0x9aada2,_0xd2d349){_0x9aada2=_0x9aada2-0x0;var _0x196dff=_0xa9e0[_0x9aada2];return _0x196dff;};'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 4cf5a9b..2225fe5 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 _0x2607=['pick','filter','merge','type','VIRTUAL','options','VoiceCallReport','includeAll','include','alias','User','findAll','rows','catch','show','keys','length','find','create','params','describe','update','body','uniqueid','user','rimraf','zip-dir','moment','bluebird','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','api','../../config/utils','../../config/environment','../../mysqldb','end','status','count','offset','limit','set','Content-Range','json','apply','reject','save','then','destroy','sendStatus','error','stack','name','map','rawAttributes','fieldName','key','model','query','filters','intersection','attributes','fields','order','sort','where'];(function(_0x389ca2,_0x29e579){var _0x45de57=function(_0x2f8d83){while(--_0x2f8d83){_0x389ca2['push'](_0x389ca2['shift']());}};_0x45de57(++_0x29e579);}(_0x2607,0x14d));var _0x7260=function(_0x1aeda2,_0x1217eb){_0x1aeda2=_0x1aeda2-0x0;var _0x32dc6d=_0x2607[_0x1aeda2];return _0x32dc6d;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0x7260('0x0'));var zipdir=require(_0x7260('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x7260('0x2'));var BPromise=require(_0x7260('0x3'));var Mustache=require('mustache');var util=require(_0x7260('0x4'));var path=require(_0x7260('0x5'));var sox=require(_0x7260('0x6'));var csv=require(_0x7260('0x7'));var ejs=require(_0x7260('0x8'));var fs=require('fs');var _=require(_0x7260('0x9'));var squel=require(_0x7260('0xa'));var crypto=require(_0x7260('0xb'));var jsforce=require(_0x7260('0xc'));var deskjs=require(_0x7260('0xd'));var toCsv=require(_0x7260('0x7'));var querystring=require(_0x7260('0xe'));var Papa=require('papaparse');var Redis=require(_0x7260('0xf'));var authService=require(_0x7260('0x10'));var qs=require(_0x7260('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x7260('0x12'));var utils=require(_0x7260('0x13'));var config=require(_0x7260('0x14'));var db=require(_0x7260('0x15'))['db'];function respondWithStatusCode(_0x5a3567,_0x179a9f){_0x179a9f=_0x179a9f||0xcc;return function(_0x213bdf){if(_0x213bdf){return _0x5a3567['sendStatus'](_0x179a9f);}return _0x5a3567['status'](_0x179a9f)[_0x7260('0x16')]();};}function respondWithResult(_0x48678f,_0x581737){_0x581737=_0x581737||0xc8;return function(_0x40fdcc){if(_0x40fdcc){return _0x48678f[_0x7260('0x17')](_0x581737)['json'](_0x40fdcc);}};}function respondWithFilteredResult(_0x185d83,_0x369680){return function(_0x41ed4b){if(_0x41ed4b){var _0x5fec4c=_0x41ed4b[_0x7260('0x18')],_0x5b6659=_0x369680[_0x7260('0x19')],_0x223945=_0x369680[_0x7260('0x19')]+_0x369680[_0x7260('0x1a')],_0x5b8fff;if(_0x223945>=_0x5fec4c){_0x223945=_0x5fec4c;_0x5b8fff=0xc8;}else{_0x5b8fff=0xce;}_0x185d83[_0x7260('0x17')](_0x5b8fff);return _0x185d83[_0x7260('0x1b')](_0x7260('0x1c'),_0x5b6659+'-'+_0x223945+'/'+_0x5fec4c)[_0x7260('0x1d')](_0x41ed4b);}return null;};}function patchUpdates(_0x2939f9){return function(_0x2e30e7){try{jsonpatch[_0x7260('0x1e')](_0x2e30e7,_0x2939f9,!![]);}catch(_0x7955fa){return BPromise[_0x7260('0x1f')](_0x7955fa);}return _0x2e30e7[_0x7260('0x20')]();};}function saveUpdates(_0x3894e9,_0xf3de22){return function(_0x100a72){if(_0x100a72){return _0x100a72['update'](_0x3894e9)[_0x7260('0x21')](function(_0x2f8ef1){return _0x2f8ef1;});}return null;};}function removeEntity(_0x4d6402,_0x478c25){return function(_0x2ea5f7){if(_0x2ea5f7){return _0x2ea5f7[_0x7260('0x22')]()['then'](function(){_0x4d6402[_0x7260('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4264f3,_0x3142c9){return function(_0x511a15){if(!_0x511a15){_0x4264f3[_0x7260('0x23')](0x194);}return _0x511a15;};}function handleError(_0x115a79,_0x51b83a){_0x51b83a=_0x51b83a||0x1f4;return function(_0x42a8f0){logger[_0x7260('0x24')](_0x42a8f0[_0x7260('0x25')]);if(_0x42a8f0[_0x7260('0x26')]){delete _0x42a8f0[_0x7260('0x26')];}_0x115a79['status'](_0x51b83a)['send'](_0x42a8f0);};}exports['index']=function(_0x330792,_0x910260){var _0x4b47e9={},_0x35ff52={},_0x1fc1f5={'count':0x0,'rows':[]};var _0x2adbdc=_[_0x7260('0x27')](db['VoiceCallReport'][_0x7260('0x28')],function(_0x55bd3a){return{'name':_0x55bd3a[_0x7260('0x29')],'type':_0x55bd3a['type'][_0x7260('0x2a')]};});_0x35ff52[_0x7260('0x2b')]=_[_0x7260('0x27')](_0x2adbdc,_0x7260('0x26'));_0x35ff52[_0x7260('0x2c')]=_['keys'](_0x330792[_0x7260('0x2c')]);_0x35ff52[_0x7260('0x2d')]=_[_0x7260('0x2e')](_0x35ff52['model'],_0x35ff52[_0x7260('0x2c')]);_0x4b47e9[_0x7260('0x2f')]=_[_0x7260('0x2e')](_0x35ff52[_0x7260('0x2b')],qs[_0x7260('0x30')](_0x330792[_0x7260('0x2c')][_0x7260('0x30')]));_0x4b47e9[_0x7260('0x2f')]=_0x4b47e9['attributes']['length']?_0x4b47e9['attributes']:_0x35ff52['model'];if(!_0x330792[_0x7260('0x2c')]['hasOwnProperty']('nolimit')){_0x4b47e9[_0x7260('0x1a')]=qs[_0x7260('0x1a')](_0x330792['query']['limit']);_0x4b47e9[_0x7260('0x19')]=qs['offset'](_0x330792[_0x7260('0x2c')][_0x7260('0x19')]);}_0x4b47e9[_0x7260('0x31')]=qs[_0x7260('0x32')](_0x330792[_0x7260('0x2c')][_0x7260('0x32')]);_0x4b47e9[_0x7260('0x33')]=qs['filters'](_[_0x7260('0x34')](_0x330792[_0x7260('0x2c')],_0x35ff52[_0x7260('0x2d')]),_0x2adbdc);if(_0x330792['query'][_0x7260('0x35')]){_0x4b47e9[_0x7260('0x33')]=_[_0x7260('0x36')](_0x4b47e9[_0x7260('0x33')],{'$or':_[_0x7260('0x27')](_0x2adbdc,function(_0x4fba5d){if(_0x4fba5d[_0x7260('0x37')]!==_0x7260('0x38')){var _0x412359={};_0x412359[_0x4fba5d[_0x7260('0x26')]]={'$like':'%'+_0x330792[_0x7260('0x2c')][_0x7260('0x35')]+'%'};return _0x412359;}})});}_0x4b47e9=_[_0x7260('0x36')]({},_0x4b47e9,_0x330792[_0x7260('0x39')]);var _0x489570={'where':_0x4b47e9[_0x7260('0x33')]};return db[_0x7260('0x3a')][_0x7260('0x18')](_0x489570)[_0x7260('0x21')](function(_0x2a980e){_0x1fc1f5[_0x7260('0x18')]=_0x2a980e;if(_0x330792['query'][_0x7260('0x3b')]){_0x4b47e9[_0x7260('0x3c')]=[{'attributes':['id',_0x7260('0x26'),'fullname',_0x7260('0x3d')],'model':db[_0x7260('0x3e')],'as':_0x7260('0x3e')}];}return db[_0x7260('0x3a')][_0x7260('0x3f')](_0x4b47e9);})[_0x7260('0x21')](function(_0x3bb7c1){_0x1fc1f5[_0x7260('0x40')]=_0x3bb7c1;return _0x1fc1f5;})[_0x7260('0x21')](respondWithFilteredResult(_0x910260,_0x4b47e9))[_0x7260('0x41')](handleError(_0x910260,null));};exports[_0x7260('0x42')]=function(_0x3bafd5,_0x4fd046){var _0x30e30b={'raw':!![],'where':{'id':_0x3bafd5['params']['id']}},_0x5114b5={};_0x5114b5['model']=_[_0x7260('0x43')](db['VoiceCallReport'][_0x7260('0x28')]);_0x5114b5[_0x7260('0x2c')]=_[_0x7260('0x43')](_0x3bafd5[_0x7260('0x2c')]);_0x5114b5['filters']=_[_0x7260('0x2e')](_0x5114b5[_0x7260('0x2b')],_0x5114b5[_0x7260('0x2c')]);_0x30e30b[_0x7260('0x2f')]=_[_0x7260('0x2e')](_0x5114b5[_0x7260('0x2b')],qs[_0x7260('0x30')](_0x3bafd5['query'][_0x7260('0x30')]));_0x30e30b[_0x7260('0x2f')]=_0x30e30b[_0x7260('0x2f')][_0x7260('0x44')]?_0x30e30b['attributes']:_0x5114b5[_0x7260('0x2b')];if(_0x3bafd5[_0x7260('0x2c')]['includeAll']){_0x30e30b['include']=[{'all':!![]}];}_0x30e30b=_[_0x7260('0x36')]({},_0x30e30b,_0x3bafd5[_0x7260('0x39')]);return db['VoiceCallReport'][_0x7260('0x45')](_0x30e30b)[_0x7260('0x21')](handleEntityNotFound(_0x4fd046,null))['then'](respondWithResult(_0x4fd046,null))['catch'](handleError(_0x4fd046,null));};exports[_0x7260('0x46')]=function(_0x4e266b,_0x1fc614){return db[_0x7260('0x3a')]['create'](_0x4e266b['body'],{})[_0x7260('0x21')](respondWithResult(_0x1fc614,0xc9))[_0x7260('0x41')](handleError(_0x1fc614,null));};exports[_0x7260('0x22')]=function(_0x49e233,_0x5d64cf){return db[_0x7260('0x3a')][_0x7260('0x45')]({'where':{'id':_0x49e233[_0x7260('0x47')]['id']}})[_0x7260('0x21')](handleEntityNotFound(_0x5d64cf,null))[_0x7260('0x21')](removeEntity(_0x5d64cf,null))[_0x7260('0x41')](handleError(_0x5d64cf,null));};exports['describe']=function(_0x2525ce,_0xe2c1c8){return db[_0x7260('0x3a')][_0x7260('0x48')]()[_0x7260('0x21')](respondWithResult(_0xe2c1c8,null))[_0x7260('0x41')](handleError(_0xe2c1c8,null));};exports[_0x7260('0x49')]=function(_0x5392e1,_0x3d30d2){if(_0x5392e1[_0x7260('0x4a')]['uniqueid']){delete _0x5392e1[_0x7260('0x4a')][_0x7260('0x4b')];}return db[_0x7260('0x3a')]['find']({'where':{'uniqueid':_0x5392e1['params']['id'],'UserId':{'$or':[null,_0x5392e1[_0x7260('0x4c')]['id']]}}})['then'](handleEntityNotFound(_0x3d30d2,null))['then'](saveUpdates(_0x5392e1[_0x7260('0x4a')],null))[_0x7260('0x21')](respondWithResult(_0x3d30d2,null))[_0x7260('0x41')](handleError(_0x3d30d2,null));}; \ No newline at end of file +var _0x35b3=['sort','filter','where','merge','VIRTUAL','includeAll','include','alias','User','rows','catch','show','keys','length','find','create','body','params','describe','uniqueid','user','html-pdf','fast-json-patch','moment','bluebird','mustache','sox','to-csv','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','end','json','count','offset','limit','set','Content-Range','reject','save','update','then','destroy','stack','name','send','map','VoiceCallReport','rawAttributes','fieldName','type','model','query','filters','intersection','attributes','fields','hasOwnProperty','order'];(function(_0x2f277b,_0x39d77c){var _0x1847c3=function(_0x52d2ee){while(--_0x52d2ee){_0x2f277b['push'](_0x2f277b['shift']());}};_0x1847c3(++_0x39d77c);}(_0x35b3,0x17d));var _0x335b=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x35b3[_0x3dd15e];return _0x231fd0;};'use strict';var pdf=require(_0x335b('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x335b('0x1'));var rp=require('request-promise');var moment=require(_0x335b('0x2'));var BPromise=require(_0x335b('0x3'));var Mustache=require(_0x335b('0x4'));var util=require('util');var path=require('path');var sox=require(_0x335b('0x5'));var csv=require(_0x335b('0x6'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x335b('0x7'));var squel=require(_0x335b('0x8'));var crypto=require(_0x335b('0x9'));var jsforce=require(_0x335b('0xa'));var deskjs=require('desk.js');var toCsv=require(_0x335b('0x6'));var querystring=require(_0x335b('0xb'));var Papa=require(_0x335b('0xc'));var Redis=require(_0x335b('0xd'));var authService=require(_0x335b('0xe'));var qs=require(_0x335b('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x335b('0x10'));var logger=require(_0x335b('0x11'))(_0x335b('0x12'));var utils=require(_0x335b('0x13'));var config=require(_0x335b('0x14'));var db=require(_0x335b('0x15'))['db'];function respondWithStatusCode(_0x2712ca,_0x569399){_0x569399=_0x569399||0xcc;return function(_0x1fdcb1){if(_0x1fdcb1){return _0x2712ca['sendStatus'](_0x569399);}return _0x2712ca[_0x335b('0x16')](_0x569399)[_0x335b('0x17')]();};}function respondWithResult(_0x2f3683,_0xabe990){_0xabe990=_0xabe990||0xc8;return function(_0x2ce5bc){if(_0x2ce5bc){return _0x2f3683['status'](_0xabe990)[_0x335b('0x18')](_0x2ce5bc);}};}function respondWithFilteredResult(_0x269985,_0x419c7e){return function(_0x37a6af){if(_0x37a6af){var _0x52401e=_0x37a6af[_0x335b('0x19')],_0x38b07d=_0x419c7e[_0x335b('0x1a')],_0x320379=_0x419c7e[_0x335b('0x1a')]+_0x419c7e[_0x335b('0x1b')],_0x42f260;if(_0x320379>=_0x52401e){_0x320379=_0x52401e;_0x42f260=0xc8;}else{_0x42f260=0xce;}_0x269985[_0x335b('0x16')](_0x42f260);return _0x269985[_0x335b('0x1c')](_0x335b('0x1d'),_0x38b07d+'-'+_0x320379+'/'+_0x52401e)[_0x335b('0x18')](_0x37a6af);}return null;};}function patchUpdates(_0x211b05){return function(_0x5ac6d8){try{jsonpatch['apply'](_0x5ac6d8,_0x211b05,!![]);}catch(_0x439728){return BPromise[_0x335b('0x1e')](_0x439728);}return _0x5ac6d8[_0x335b('0x1f')]();};}function saveUpdates(_0x298596,_0x56b425){return function(_0x47988e){if(_0x47988e){return _0x47988e[_0x335b('0x20')](_0x298596)[_0x335b('0x21')](function(_0x45bb9e){return _0x45bb9e;});}return null;};}function removeEntity(_0x218260,_0x484532){return function(_0x55e735){if(_0x55e735){return _0x55e735[_0x335b('0x22')]()['then'](function(){_0x218260[_0x335b('0x16')](0xcc)[_0x335b('0x17')]();});}};}function handleEntityNotFound(_0x313888,_0x4c0baf){return function(_0x148ce8){if(!_0x148ce8){_0x313888['sendStatus'](0x194);}return _0x148ce8;};}function handleError(_0x13a2ef,_0x338e2e){_0x338e2e=_0x338e2e||0x1f4;return function(_0x3a7ed2){logger['error'](_0x3a7ed2[_0x335b('0x23')]);if(_0x3a7ed2[_0x335b('0x24')]){delete _0x3a7ed2[_0x335b('0x24')];}_0x13a2ef[_0x335b('0x16')](_0x338e2e)[_0x335b('0x25')](_0x3a7ed2);};}exports['index']=function(_0x26565c,_0x442cbb){var _0x14400a={},_0xdcaec1={},_0x17a10e={'count':0x0,'rows':[]};var _0x3e7ec3=_[_0x335b('0x26')](db[_0x335b('0x27')][_0x335b('0x28')],function(_0x15e581){return{'name':_0x15e581[_0x335b('0x29')],'type':_0x15e581[_0x335b('0x2a')]['key']};});_0xdcaec1[_0x335b('0x2b')]=_['map'](_0x3e7ec3,_0x335b('0x24'));_0xdcaec1[_0x335b('0x2c')]=_['keys'](_0x26565c[_0x335b('0x2c')]);_0xdcaec1[_0x335b('0x2d')]=_[_0x335b('0x2e')](_0xdcaec1[_0x335b('0x2b')],_0xdcaec1['query']);_0x14400a[_0x335b('0x2f')]=_[_0x335b('0x2e')](_0xdcaec1['model'],qs[_0x335b('0x30')](_0x26565c[_0x335b('0x2c')][_0x335b('0x30')]));_0x14400a[_0x335b('0x2f')]=_0x14400a[_0x335b('0x2f')]['length']?_0x14400a[_0x335b('0x2f')]:_0xdcaec1[_0x335b('0x2b')];if(!_0x26565c[_0x335b('0x2c')][_0x335b('0x31')]('nolimit')){_0x14400a['limit']=qs[_0x335b('0x1b')](_0x26565c[_0x335b('0x2c')]['limit']);_0x14400a[_0x335b('0x1a')]=qs[_0x335b('0x1a')](_0x26565c[_0x335b('0x2c')]['offset']);}_0x14400a[_0x335b('0x32')]=qs[_0x335b('0x33')](_0x26565c[_0x335b('0x2c')]['sort']);_0x14400a['where']=qs[_0x335b('0x2d')](_['pick'](_0x26565c[_0x335b('0x2c')],_0xdcaec1[_0x335b('0x2d')]),_0x3e7ec3);if(_0x26565c['query'][_0x335b('0x34')]){_0x14400a[_0x335b('0x35')]=_[_0x335b('0x36')](_0x14400a[_0x335b('0x35')],{'$or':_[_0x335b('0x26')](_0x3e7ec3,function(_0x398d32){if(_0x398d32['type']!==_0x335b('0x37')){var _0x1009f2={};_0x1009f2[_0x398d32[_0x335b('0x24')]]={'$like':'%'+_0x26565c[_0x335b('0x2c')][_0x335b('0x34')]+'%'};return _0x1009f2;}})});}_0x14400a=_[_0x335b('0x36')]({},_0x14400a,_0x26565c['options']);var _0x1600d5={'where':_0x14400a[_0x335b('0x35')]};return db[_0x335b('0x27')][_0x335b('0x19')](_0x1600d5)[_0x335b('0x21')](function(_0x272b74){_0x17a10e[_0x335b('0x19')]=_0x272b74;if(_0x26565c[_0x335b('0x2c')][_0x335b('0x38')]){_0x14400a[_0x335b('0x39')]=[{'attributes':['id','name','fullname',_0x335b('0x3a')],'model':db[_0x335b('0x3b')],'as':'User'}];}return db[_0x335b('0x27')]['findAll'](_0x14400a);})[_0x335b('0x21')](function(_0x464302){_0x17a10e[_0x335b('0x3c')]=_0x464302;return _0x17a10e;})[_0x335b('0x21')](respondWithFilteredResult(_0x442cbb,_0x14400a))[_0x335b('0x3d')](handleError(_0x442cbb,null));};exports[_0x335b('0x3e')]=function(_0x80dc13,_0x53d5c5){var _0x509404={'raw':!![],'where':{'id':_0x80dc13['params']['id']}},_0x5b5034={};_0x5b5034['model']=_['keys'](db[_0x335b('0x27')][_0x335b('0x28')]);_0x5b5034[_0x335b('0x2c')]=_[_0x335b('0x3f')](_0x80dc13[_0x335b('0x2c')]);_0x5b5034[_0x335b('0x2d')]=_[_0x335b('0x2e')](_0x5b5034['model'],_0x5b5034[_0x335b('0x2c')]);_0x509404[_0x335b('0x2f')]=_['intersection'](_0x5b5034[_0x335b('0x2b')],qs[_0x335b('0x30')](_0x80dc13['query'][_0x335b('0x30')]));_0x509404[_0x335b('0x2f')]=_0x509404[_0x335b('0x2f')][_0x335b('0x40')]?_0x509404['attributes']:_0x5b5034[_0x335b('0x2b')];if(_0x80dc13['query'][_0x335b('0x38')]){_0x509404[_0x335b('0x39')]=[{'all':!![]}];}_0x509404=_['merge']({},_0x509404,_0x80dc13['options']);return db['VoiceCallReport'][_0x335b('0x41')](_0x509404)['then'](handleEntityNotFound(_0x53d5c5,null))[_0x335b('0x21')](respondWithResult(_0x53d5c5,null))[_0x335b('0x3d')](handleError(_0x53d5c5,null));};exports[_0x335b('0x42')]=function(_0x3dfe74,_0x568556){return db['VoiceCallReport'][_0x335b('0x42')](_0x3dfe74[_0x335b('0x43')],{})[_0x335b('0x21')](respondWithResult(_0x568556,0xc9))[_0x335b('0x3d')](handleError(_0x568556,null));};exports[_0x335b('0x22')]=function(_0x9caf5f,_0x5323de){return db[_0x335b('0x27')][_0x335b('0x41')]({'where':{'id':_0x9caf5f[_0x335b('0x44')]['id']}})[_0x335b('0x21')](handleEntityNotFound(_0x5323de,null))[_0x335b('0x21')](removeEntity(_0x5323de,null))[_0x335b('0x3d')](handleError(_0x5323de,null));};exports[_0x335b('0x45')]=function(_0x4468d7,_0xca0b87){return db['VoiceCallReport']['describe']()[_0x335b('0x21')](respondWithResult(_0xca0b87,null))[_0x335b('0x3d')](handleError(_0xca0b87,null));};exports['update']=function(_0x3e2510,_0x211534){if(_0x3e2510[_0x335b('0x43')][_0x335b('0x46')]){delete _0x3e2510['body'][_0x335b('0x46')];}return db[_0x335b('0x27')][_0x335b('0x41')]({'where':{'uniqueid':_0x3e2510['params']['id'],'UserId':{'$or':[null,_0x3e2510[_0x335b('0x47')]['id']]}}})[_0x335b('0x21')](handleEntityNotFound(_0x211534,null))[_0x335b('0x21')](saveUpdates(_0x3e2510[_0x335b('0x43')],null))[_0x335b('0x21')](respondWithResult(_0x211534,null))[_0x335b('0x3d')](handleError(_0x211534,null));}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.model.js b/server/api/voiceCallReport/voiceCallReport.model.js index 82a2e8b..943f406 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 _0x5768=['request-promise','path','rimraf','../../config/environment','./voiceCallReport.attributes','exports','define','report_call','uniqueid','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0xc53bf5,_0x3b1228){var _0x196ff3=function(_0x115c77){while(--_0x115c77){_0xc53bf5['push'](_0xc53bf5['shift']());}};_0x196ff3(++_0x3b1228);}(_0x5768,0x162));var _0x8576=function(_0x1589dd,_0x2b9d22){_0x1589dd=_0x1589dd-0x0;var _0x1bddd1=_0x5768[_0x1589dd];return _0x1bddd1;};'use strict';var _=require(_0x8576('0x0'));var util=require(_0x8576('0x1'));var logger=require(_0x8576('0x2'))(_0x8576('0x3'));var moment=require(_0x8576('0x4'));var BPromise=require(_0x8576('0x5'));var rp=require(_0x8576('0x6'));var fs=require('fs');var path=require(_0x8576('0x7'));var rimraf=require(_0x8576('0x8'));var config=require(_0x8576('0x9'));var attributes=require(_0x8576('0xa'));module[_0x8576('0xb')]=function(_0x519d1d,_0x14a8cd){return _0x519d1d[_0x8576('0xc')]('VoiceCallReport',attributes,{'tableName':_0x8576('0xd'),'paranoid':![],'indexes':[{'fields':[_0x8576('0xe')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x36af=['VoiceCallReport','report_call','uniqueid','lodash','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x345ce9,_0xfeba2e){var _0x59e5ff=function(_0x3ed9a4){while(--_0x3ed9a4){_0x345ce9['push'](_0x345ce9['shift']());}};_0x59e5ff(++_0xfeba2e);}(_0x36af,0xdb));var _0xf36a=function(_0x5cf890,_0x106f66){_0x5cf890=_0x5cf890-0x0;var _0x16a18e=_0x36af[_0x5cf890];return _0x16a18e;};'use strict';var _=require(_0xf36a('0x0'));var util=require(_0xf36a('0x1'));var logger=require('../../config/logger')(_0xf36a('0x2'));var moment=require(_0xf36a('0x3'));var BPromise=require(_0xf36a('0x4'));var rp=require(_0xf36a('0x5'));var fs=require('fs');var path=require(_0xf36a('0x6'));var rimraf=require(_0xf36a('0x7'));var config=require(_0xf36a('0x8'));var attributes=require('./voiceCallReport.attributes');module['exports']=function(_0x38fd92,_0x3794c6){return _0x38fd92['define'](_0xf36a('0x9'),attributes,{'tableName':_0xf36a('0xa'),'paranoid':![],'indexes':[{'fields':[_0xf36a('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 1f6cee4..87ce1ba 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 _0xa929=['map','attributes','then','create','CreateVoiceCallReport','body','where','UpdateVoiceCallReport','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','request','info','VoiceCallReport,\x20%s,\x20%s','request\x20sent','debug','VoiceCallReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetVoiceCallReport','VoiceCallReport','findAll','options','raw','limit','include','model'];(function(_0x5b67db,_0x33c4f0){var _0x16b751=function(_0x416fcf){while(--_0x416fcf){_0x5b67db['push'](_0x5b67db['shift']());}};_0x16b751(++_0x33c4f0);}(_0xa929,0x1c0));var _0x9a92=function(_0x4b9bd0,_0x23b665){_0x4b9bd0=_0x4b9bd0-0x0;var _0x59d49f=_0xa929[_0x4b9bd0];return _0x59d49f;};'use strict';var _=require(_0x9a92('0x0'));var util=require(_0x9a92('0x1'));var moment=require(_0x9a92('0x2'));var BPromise=require(_0x9a92('0x3'));var rs=require(_0x9a92('0x4'));var fs=require('fs');var Redis=require(_0x9a92('0x5'));var db=require(_0x9a92('0x6'))['db'];var utils=require(_0x9a92('0x7'));var logger=require(_0x9a92('0x8'))(_0x9a92('0x9'));var config=require(_0x9a92('0xa'));var jayson=require('jayson/promise');var client=jayson['client'][_0x9a92('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x47ffaa,_0x26656b,_0x59f68f){return new BPromise(function(_0x1a12db,_0x509e86){return client[_0x9a92('0xc')](_0x47ffaa,_0x59f68f)['then'](function(_0x326ae2){logger[_0x9a92('0xd')](_0x9a92('0xe'),_0x26656b,_0x9a92('0xf'));logger[_0x9a92('0x10')](_0x9a92('0x11'),_0x26656b,_0x9a92('0xf'),JSON[_0x9a92('0x12')](_0x326ae2));if(_0x326ae2['error']){if(_0x326ae2[_0x9a92('0x13')][_0x9a92('0x14')]===0x1f4){logger[_0x9a92('0x13')]('VoiceCallReport,\x20%s,\x20%s',_0x26656b,_0x326ae2[_0x9a92('0x13')][_0x9a92('0x15')]);return _0x509e86(_0x326ae2['error'][_0x9a92('0x15')]);}logger['error']('VoiceCallReport,\x20%s,\x20%s',_0x26656b,_0x326ae2[_0x9a92('0x13')][_0x9a92('0x15')]);return _0x1a12db(_0x326ae2[_0x9a92('0x13')][_0x9a92('0x15')]);}else{logger[_0x9a92('0xd')](_0x9a92('0xe'),_0x26656b,'request\x20sent');_0x1a12db(_0x326ae2[_0x9a92('0x16')][_0x9a92('0x15')]);}})[_0x9a92('0x17')](function(_0x35d9fc){logger[_0x9a92('0x13')](_0x9a92('0xe'),_0x26656b,_0x35d9fc);_0x509e86(_0x35d9fc);});});}exports[_0x9a92('0x18')]=function(_0x323bf9){var _0x3c4fc0=this;return new Promise(function(_0x59f375,_0x487a07){return db[_0x9a92('0x19')][_0x9a92('0x1a')]({'raw':_0x323bf9[_0x9a92('0x1b')]?_0x323bf9[_0x9a92('0x1b')][_0x9a92('0x1c')]===undefined?!![]:![]:!![],'where':_0x323bf9[_0x9a92('0x1b')]?_0x323bf9[_0x9a92('0x1b')]['where']||null:null,'attributes':_0x323bf9[_0x9a92('0x1b')]?_0x323bf9[_0x9a92('0x1b')]['attributes']||null:null,'limit':_0x323bf9[_0x9a92('0x1b')]?_0x323bf9[_0x9a92('0x1b')][_0x9a92('0x1d')]||null:null,'include':_0x323bf9[_0x9a92('0x1b')]?_0x323bf9[_0x9a92('0x1b')][_0x9a92('0x1e')]?_['map'](_0x323bf9[_0x9a92('0x1b')][_0x9a92('0x1e')],function(_0x4af079){return{'model':db[_0x4af079[_0x9a92('0x1f')]],'as':_0x4af079['as'],'attributes':_0x4af079['attributes'],'include':_0x4af079[_0x9a92('0x1e')]?_[_0x9a92('0x20')](_0x4af079['include'],function(_0x4c44e2){return{'model':db[_0x4c44e2[_0x9a92('0x1f')]],'as':_0x4c44e2['as'],'attributes':_0x4c44e2[_0x9a92('0x21')],'include':_0x4c44e2['include']?_[_0x9a92('0x20')](_0x4c44e2['include'],function(_0x260d68){return{'model':db[_0x260d68[_0x9a92('0x1f')]],'as':_0x260d68['as'],'attributes':_0x260d68[_0x9a92('0x21')]};}):[]};}):[]};}):[]:[]})[_0x9a92('0x22')](function(_0x63e91f){logger[_0x9a92('0xd')](_0x9a92('0x18'),_0x323bf9);logger['debug'](_0x9a92('0x18'),_0x323bf9,JSON[_0x9a92('0x12')](_0x63e91f));_0x59f375(_0x63e91f);})[_0x9a92('0x17')](function(_0x3a197f){logger[_0x9a92('0x13')](_0x9a92('0x18'),_0x3a197f[_0x9a92('0x15')],_0x323bf9);_0x487a07(_0x3c4fc0[_0x9a92('0x13')](0x1f4,_0x3a197f[_0x9a92('0x15')]));});});};exports['CreateVoiceCallReport']=function(_0xd5959d){var _0x15df2b=this;return new Promise(function(_0x3cfeb1,_0x9727b3){return db[_0x9a92('0x19')][_0x9a92('0x23')](_0xd5959d['body'],{'raw':_0xd5959d['options']?_0xd5959d['options'][_0x9a92('0x1c')]===undefined?!![]:![]:!![]})['then'](function(_0x53224c){logger[_0x9a92('0xd')](_0x9a92('0x24'),_0xd5959d);logger['debug'](_0x9a92('0x24'),_0xd5959d,JSON[_0x9a92('0x12')](_0x53224c));_0x3cfeb1(_0x53224c);})['catch'](function(_0x1bedc2){logger['error'](_0x9a92('0x24'),_0x1bedc2[_0x9a92('0x15')],_0xd5959d);_0x9727b3(_0x15df2b[_0x9a92('0x13')](0x1f4,_0x1bedc2[_0x9a92('0x15')]));});});};exports['UpdateVoiceCallReport']=function(_0x3fce73){var _0x41cc48=this;return new Promise(function(_0x4a3be7,_0xa2607a){return db[_0x9a92('0x19')]['update'](_0x3fce73[_0x9a92('0x25')],{'raw':_0x3fce73[_0x9a92('0x1b')]?_0x3fce73['options'][_0x9a92('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3fce73['options']?_0x3fce73[_0x9a92('0x1b')][_0x9a92('0x26')]||null:null,'attributes':_0x3fce73[_0x9a92('0x1b')]?_0x3fce73[_0x9a92('0x1b')]['attributes']||null:null,'limit':_0x3fce73['options']?_0x3fce73[_0x9a92('0x1b')][_0x9a92('0x1d')]||null:null})[_0x9a92('0x22')](function(_0x21db2a){logger[_0x9a92('0xd')]('UpdateVoiceCallReport',_0x3fce73);logger[_0x9a92('0x10')](_0x9a92('0x27'),_0x3fce73,JSON[_0x9a92('0x12')](_0x21db2a));_0x4a3be7(_0x21db2a);})[_0x9a92('0x17')](function(_0x2c1d75){logger[_0x9a92('0x13')](_0x9a92('0x27'),_0x2c1d75[_0x9a92('0x15')],_0x3fce73);_0xa2607a(_0x41cc48[_0x9a92('0x13')](0x1f4,_0x2c1d75[_0x9a92('0x15')]));});});}; \ No newline at end of file +var _0xedbd=['code','VoiceCallReport,\x20%s,\x20%s','message','catch','GetVoiceCallReport','VoiceCallReport','options','raw','where','attributes','limit','map','include','model','debug','create','body','CreateVoiceCallReport','UpdateVoiceCallReport','update','moment','bluebird','randomstring','../../mysqldb','rpc','../../config/environment','jayson/promise','client','request','then','info','request\x20sent','VoiceCallReport,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x5c4303,_0x15212f){var _0xc87c1b=function(_0x3de432){while(--_0x3de432){_0x5c4303['push'](_0x5c4303['shift']());}};_0xc87c1b(++_0x15212f);}(_0xedbd,0x12c));var _0xdedb=function(_0xdbc022,_0x2edbdd){_0xdbc022=_0xdbc022-0x0;var _0x4c8ae3=_0xedbd[_0xdbc022];return _0x4c8ae3;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xdedb('0x0'));var BPromise=require(_0xdedb('0x1'));var rs=require(_0xdedb('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xdedb('0x3'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xdedb('0x4'));var config=require(_0xdedb('0x5'));var jayson=require(_0xdedb('0x6'));var client=jayson[_0xdedb('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5b7e5f,_0xf612bb,_0x5eaa61){return new BPromise(function(_0x46ea1f,_0x51b77f){return client[_0xdedb('0x8')](_0x5b7e5f,_0x5eaa61)[_0xdedb('0x9')](function(_0x140a8e){logger[_0xdedb('0xa')]('VoiceCallReport,\x20%s,\x20%s',_0xf612bb,_0xdedb('0xb'));logger['debug'](_0xdedb('0xc'),_0xf612bb,_0xdedb('0xb'),JSON[_0xdedb('0xd')](_0x140a8e));if(_0x140a8e[_0xdedb('0xe')]){if(_0x140a8e[_0xdedb('0xe')][_0xdedb('0xf')]===0x1f4){logger[_0xdedb('0xe')](_0xdedb('0x10'),_0xf612bb,_0x140a8e[_0xdedb('0xe')][_0xdedb('0x11')]);return _0x51b77f(_0x140a8e['error']['message']);}logger[_0xdedb('0xe')](_0xdedb('0x10'),_0xf612bb,_0x140a8e['error'][_0xdedb('0x11')]);return _0x46ea1f(_0x140a8e[_0xdedb('0xe')][_0xdedb('0x11')]);}else{logger['info']('VoiceCallReport,\x20%s,\x20%s',_0xf612bb,_0xdedb('0xb'));_0x46ea1f(_0x140a8e['result'][_0xdedb('0x11')]);}})[_0xdedb('0x12')](function(_0x48067c){logger[_0xdedb('0xe')](_0xdedb('0x10'),_0xf612bb,_0x48067c);_0x51b77f(_0x48067c);});});}exports[_0xdedb('0x13')]=function(_0x440d01){var _0x55ca42=this;return new Promise(function(_0x25d5e8,_0x27dca3){return db[_0xdedb('0x14')]['findAll']({'raw':_0x440d01[_0xdedb('0x15')]?_0x440d01['options'][_0xdedb('0x16')]===undefined?!![]:![]:!![],'where':_0x440d01[_0xdedb('0x15')]?_0x440d01[_0xdedb('0x15')][_0xdedb('0x17')]||null:null,'attributes':_0x440d01[_0xdedb('0x15')]?_0x440d01[_0xdedb('0x15')][_0xdedb('0x18')]||null:null,'limit':_0x440d01['options']?_0x440d01[_0xdedb('0x15')][_0xdedb('0x19')]||null:null,'include':_0x440d01[_0xdedb('0x15')]?_0x440d01[_0xdedb('0x15')]['include']?_['map'](_0x440d01[_0xdedb('0x15')]['include'],function(_0x58fb40){return{'model':db[_0x58fb40['model']],'as':_0x58fb40['as'],'attributes':_0x58fb40[_0xdedb('0x18')],'include':_0x58fb40['include']?_[_0xdedb('0x1a')](_0x58fb40[_0xdedb('0x1b')],function(_0x5d4633){return{'model':db[_0x5d4633[_0xdedb('0x1c')]],'as':_0x5d4633['as'],'attributes':_0x5d4633[_0xdedb('0x18')],'include':_0x5d4633[_0xdedb('0x1b')]?_[_0xdedb('0x1a')](_0x5d4633[_0xdedb('0x1b')],function(_0x5af242){return{'model':db[_0x5af242[_0xdedb('0x1c')]],'as':_0x5af242['as'],'attributes':_0x5af242[_0xdedb('0x18')]};}):[]};}):[]};}):[]:[]})[_0xdedb('0x9')](function(_0x82e084){logger[_0xdedb('0xa')]('GetVoiceCallReport',_0x440d01);logger[_0xdedb('0x1d')]('GetVoiceCallReport',_0x440d01,JSON[_0xdedb('0xd')](_0x82e084));_0x25d5e8(_0x82e084);})[_0xdedb('0x12')](function(_0xe9568b){logger['error'](_0xdedb('0x13'),_0xe9568b['message'],_0x440d01);_0x27dca3(_0x55ca42[_0xdedb('0xe')](0x1f4,_0xe9568b[_0xdedb('0x11')]));});});};exports['CreateVoiceCallReport']=function(_0x19af07){var _0x2eab24=this;return new Promise(function(_0x5bbe2b,_0x220c08){return db[_0xdedb('0x14')][_0xdedb('0x1e')](_0x19af07[_0xdedb('0x1f')],{'raw':_0x19af07[_0xdedb('0x15')]?_0x19af07[_0xdedb('0x15')]['raw']===undefined?!![]:![]:!![]})[_0xdedb('0x9')](function(_0x229c1f){logger[_0xdedb('0xa')](_0xdedb('0x20'),_0x19af07);logger[_0xdedb('0x1d')](_0xdedb('0x20'),_0x19af07,JSON[_0xdedb('0xd')](_0x229c1f));_0x5bbe2b(_0x229c1f);})[_0xdedb('0x12')](function(_0x531dc9){logger[_0xdedb('0xe')](_0xdedb('0x20'),_0x531dc9['message'],_0x19af07);_0x220c08(_0x2eab24[_0xdedb('0xe')](0x1f4,_0x531dc9[_0xdedb('0x11')]));});});};exports[_0xdedb('0x21')]=function(_0x50f755){var _0x3abf11=this;return new Promise(function(_0x2057cc,_0x15faaf){return db['VoiceCallReport'][_0xdedb('0x22')](_0x50f755['body'],{'raw':_0x50f755[_0xdedb('0x15')]?_0x50f755[_0xdedb('0x15')][_0xdedb('0x16')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x50f755['options']?_0x50f755[_0xdedb('0x15')]['where']||null:null,'attributes':_0x50f755['options']?_0x50f755[_0xdedb('0x15')]['attributes']||null:null,'limit':_0x50f755[_0xdedb('0x15')]?_0x50f755['options'][_0xdedb('0x19')]||null:null})['then'](function(_0x52463d){logger['info'](_0xdedb('0x21'),_0x50f755);logger[_0xdedb('0x1d')](_0xdedb('0x21'),_0x50f755,JSON['stringify'](_0x52463d));_0x2057cc(_0x52463d);})[_0xdedb('0x12')](function(_0x22b7ad){logger[_0xdedb('0xe')](_0xdedb('0x21'),_0x22b7ad[_0xdedb('0x11')],_0x50f755);_0x15faaf(_0x3abf11[_0xdedb('0xe')](0x1f4,_0x22b7ad[_0xdedb('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/index.js b/server/api/voiceChanSpy/index.js index c3f5ee5..93f5c8d 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 _0xb698=['create','put','delete','destroy','exports','util','path','connect-timeout','express','../../components/auth/service','../../config/environment','get','index','/:id','isAuthenticated','show','post'];(function(_0x2d7f0e,_0x3e6fbd){var _0x110b07=function(_0x557b00){while(--_0x557b00){_0x2d7f0e['push'](_0x2d7f0e['shift']());}};_0x110b07(++_0x3e6fbd);}(_0xb698,0x16a));var _0x8b69=function(_0x58baa2,_0x4501e9){_0x58baa2=_0x58baa2-0x0;var _0x3e3680=_0xb698[_0x58baa2];return _0x3e3680;};'use strict';var multer=require('multer');var util=require(_0x8b69('0x0'));var path=require(_0x8b69('0x1'));var timeout=require(_0x8b69('0x2'));var express=require(_0x8b69('0x3'));var router=express['Router']();var auth=require(_0x8b69('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x8b69('0x5'));var controller=require('./voiceChanSpy.controller');router[_0x8b69('0x6')]('/',auth['isAuthenticated'](),controller[_0x8b69('0x7')]);router['get'](_0x8b69('0x8'),auth[_0x8b69('0x9')](),controller[_0x8b69('0xa')]);router[_0x8b69('0xb')]('/',auth[_0x8b69('0x9')](),controller[_0x8b69('0xc')]);router[_0x8b69('0xd')]('/:id',auth[_0x8b69('0x9')](),controller['update']);router[_0x8b69('0xe')](_0x8b69('0x8'),auth[_0x8b69('0x9')](),controller[_0x8b69('0xf')]);module[_0x8b69('0x10')]=router; \ No newline at end of file +var _0x9137=['path','express','../../components/auth/service','../../config/environment','./voiceChanSpy.controller','get','isAuthenticated','/:id','show','post','put','update','delete','util'];(function(_0x4fde08,_0x463a36){var _0x12e725=function(_0x2670c5){while(--_0x2670c5){_0x4fde08['push'](_0x4fde08['shift']());}};_0x12e725(++_0x463a36);}(_0x9137,0x15d));var _0x7913=function(_0xb065e3,_0x2d01cf){_0xb065e3=_0xb065e3-0x0;var _0x1db262=_0x9137[_0xb065e3];return _0x1db262;};'use strict';var multer=require('multer');var util=require(_0x7913('0x0'));var path=require(_0x7913('0x1'));var timeout=require('connect-timeout');var express=require(_0x7913('0x2'));var router=express['Router']();var auth=require(_0x7913('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0x7913('0x4'));var controller=require(_0x7913('0x5'));router[_0x7913('0x6')]('/',auth[_0x7913('0x7')](),controller['index']);router['get'](_0x7913('0x8'),auth[_0x7913('0x7')](),controller[_0x7913('0x9')]);router[_0x7913('0xa')]('/',auth[_0x7913('0x7')](),controller['create']);router[_0x7913('0xb')](_0x7913('0x8'),auth[_0x7913('0x7')](),controller[_0x7913('0xc')]);router[_0x7913('0xd')]('/:id',auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.attributes.js b/server/api/voiceChanSpy/voiceChanSpy.attributes.js index 9e3d87a..1ef9d09 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 _0x3240=['options','getDataValue','split','BOOLEAN','sequelize','exports','STRING','name','setDataValue'];(function(_0x5bc6f0,_0x2296b0){var _0x34b12b=function(_0x3f4576){while(--_0x3f4576){_0x5bc6f0['push'](_0x5bc6f0['shift']());}};_0x34b12b(++_0x2296b0);}(_0x3240,0x1a2));var _0x0324=function(_0x2a3147,_0x480a7f){_0x2a3147=_0x2a3147-0x0;var _0x2c35c2=_0x3240[_0x2a3147];return _0x2c35c2;};'use strict';var Sequelize=require(_0x0324('0x0'));module[_0x0324('0x1')]={'name':{'type':Sequelize[_0x0324('0x2')]},'prefix':{'type':Sequelize[_0x0324('0x2')],'unique':_0x0324('0x3'),'allowNull':![]},'options':{'type':Sequelize['STRING'],'set':function(_0x56d06a){this[_0x0324('0x4')](_0x0324('0x5'),_0x56d06a?_0x56d06a['join'](''):[]);},'get':function(){return this[_0x0324('0x6')]('options')?this[_0x0324('0x6')](_0x0324('0x5'))[_0x0324('0x7')](''):[];}},'auth':{'type':Sequelize[_0x0324('0x8')],'defaultValue':![]},'password':{'type':Sequelize[_0x0324('0x2')]},'record':{'type':Sequelize[_0x0324('0x8')],'defaultValue':![]},'recordingFormat':{'type':Sequelize[_0x0324('0x2')]},'description':{'type':Sequelize[_0x0324('0x2')]}}; \ No newline at end of file +var _0xd9d0=['setDataValue','join','getDataValue','options','split','BOOLEAN','sequelize','exports','STRING','name'];(function(_0x312ff8,_0x5d7167){var _0x4e144b=function(_0x8c0bd5){while(--_0x8c0bd5){_0x312ff8['push'](_0x312ff8['shift']());}};_0x4e144b(++_0x5d7167);}(_0xd9d0,0xb0));var _0x0d9d=function(_0x398ec3,_0x403e6c){_0x398ec3=_0x398ec3-0x0;var _0x231f76=_0xd9d0[_0x398ec3];return _0x231f76;};'use strict';var Sequelize=require(_0x0d9d('0x0'));module[_0x0d9d('0x1')]={'name':{'type':Sequelize[_0x0d9d('0x2')]},'prefix':{'type':Sequelize['STRING'],'unique':_0x0d9d('0x3'),'allowNull':![]},'options':{'type':Sequelize[_0x0d9d('0x2')],'set':function(_0x5958f6){this[_0x0d9d('0x4')]('options',_0x5958f6?_0x5958f6[_0x0d9d('0x5')](''):[]);},'get':function(){return this[_0x0d9d('0x6')](_0x0d9d('0x7'))?this['getDataValue'](_0x0d9d('0x7'))[_0x0d9d('0x8')](''):[];}},'auth':{'type':Sequelize[_0x0d9d('0x9')],'defaultValue':![]},'password':{'type':Sequelize['STRING']},'record':{'type':Sequelize[_0x0d9d('0x9')],'defaultValue':![]},'recordingFormat':{'type':Sequelize[_0x0d9d('0x2')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.controller.js b/server/api/voiceChanSpy/voiceChanSpy.controller.js index 5f6af31..d4aa5df 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 _0xdedc=['VIRTUAL','options','VoiceChanSpy','includeAll','include','findAll','rows','show','keys','length','find','catch','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','params','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../mysqldb','sendStatus','status','json','count','offset','limit','set','reject','save','update','then','destroy','ChanSpies','UserProfileResource','end','error','name','send','map','rawAttributes','type','key','query','filters','model','attributes','intersection','fields','nolimit','order','sort','where','filter','merge'];(function(_0x2b5448,_0xe31456){var _0xee510e=function(_0x48a4fa){while(--_0x48a4fa){_0x2b5448['push'](_0x2b5448['shift']());}};_0xee510e(++_0xe31456);}(_0xdedc,0x1ab));var _0xcded=function(_0x65e3dc,_0x10fd05){_0x65e3dc=_0x65e3dc-0x0;var _0x5d475b=_0xdedc[_0x65e3dc];return _0x5d475b;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xcded('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xcded('0x1'));var jsonpatch=require(_0xcded('0x2'));var rp=require(_0xcded('0x3'));var moment=require(_0xcded('0x4'));var BPromise=require(_0xcded('0x5'));var Mustache=require(_0xcded('0x6'));var util=require(_0xcded('0x7'));var path=require(_0xcded('0x8'));var sox=require(_0xcded('0x9'));var csv=require(_0xcded('0xa'));var ejs=require(_0xcded('0xb'));var fs=require('fs');var _=require(_0xcded('0xc'));var squel=require(_0xcded('0xd'));var crypto=require('crypto');var jsforce=require(_0xcded('0xe'));var deskjs=require(_0xcded('0xf'));var toCsv=require('to-csv');var querystring=require(_0xcded('0x10'));var Papa=require(_0xcded('0x11'));var Redis=require(_0xcded('0x12'));var authService=require('../../components/auth/service');var qs=require(_0xcded('0x13'));var as=require(_0xcded('0x14'));var hardwareService=require(_0xcded('0x15'));var logger=require(_0xcded('0x16'))('api');var utils=require('../../config/utils');var config=require(_0xcded('0x17'));var db=require(_0xcded('0x18'))['db'];function respondWithStatusCode(_0x5c3f60,_0x5ea607){_0x5ea607=_0x5ea607||0xcc;return function(_0xe52a1a){if(_0xe52a1a){return _0x5c3f60[_0xcded('0x19')](_0x5ea607);}return _0x5c3f60[_0xcded('0x1a')](_0x5ea607)['end']();};}function respondWithResult(_0x3924f5,_0x1d4bb1){_0x1d4bb1=_0x1d4bb1||0xc8;return function(_0x5bfece){if(_0x5bfece){return _0x3924f5[_0xcded('0x1a')](_0x1d4bb1)[_0xcded('0x1b')](_0x5bfece);}};}function respondWithFilteredResult(_0x597519,_0x2530e8){return function(_0x4b05c2){if(_0x4b05c2){var _0x547a7a=_0x4b05c2[_0xcded('0x1c')],_0x15a036=_0x2530e8[_0xcded('0x1d')],_0x15172b=_0x2530e8[_0xcded('0x1d')]+_0x2530e8[_0xcded('0x1e')],_0x51cb67;if(_0x15172b>=_0x547a7a){_0x15172b=_0x547a7a;_0x51cb67=0xc8;}else{_0x51cb67=0xce;}_0x597519['status'](_0x51cb67);return _0x597519[_0xcded('0x1f')]('Content-Range',_0x15a036+'-'+_0x15172b+'/'+_0x547a7a)[_0xcded('0x1b')](_0x4b05c2);}return null;};}function patchUpdates(_0x573385){return function(_0x32a54f){try{jsonpatch['apply'](_0x32a54f,_0x573385,!![]);}catch(_0x3936fc){return BPromise[_0xcded('0x20')](_0x3936fc);}return _0x32a54f[_0xcded('0x21')]();};}function saveUpdates(_0x16b94f,_0x6461d0){return function(_0x2cd805){if(_0x2cd805){return _0x2cd805[_0xcded('0x22')](_0x16b94f)[_0xcded('0x23')](function(_0x5e0340){return _0x5e0340;});}return null;};}function removeEntity(_0x280be3,_0x19cd81){return function(_0x59d9d9){if(_0x59d9d9){return _0x59d9d9[_0xcded('0x24')]()[_0xcded('0x23')](function(){var _0x3b50fc=_0x59d9d9['get']({'plain':!![]});var _0x45e246=_0xcded('0x25');return db[_0xcded('0x26')][_0xcded('0x24')]({'where':{'type':_0x45e246,'resourceId':_0x3b50fc['id']}})[_0xcded('0x23')](function(){return _0x59d9d9;});})['then'](function(){_0x280be3[_0xcded('0x1a')](0xcc)[_0xcded('0x27')]();});}};}function handleEntityNotFound(_0x3963a0,_0x391472){return function(_0x400c18){if(!_0x400c18){_0x3963a0[_0xcded('0x19')](0x194);}return _0x400c18;};}function handleError(_0x52c50e,_0x50924d){_0x50924d=_0x50924d||0x1f4;return function(_0x458c75){logger[_0xcded('0x28')](_0x458c75['stack']);if(_0x458c75[_0xcded('0x29')]){delete _0x458c75[_0xcded('0x29')];}_0x52c50e['status'](_0x50924d)[_0xcded('0x2a')](_0x458c75);};}exports['index']=function(_0x3c172a,_0xa8897d){var _0x8a0a83={},_0x76d37d={},_0x425c0e={'count':0x0,'rows':[]};var _0x2be8a3=_[_0xcded('0x2b')](db['VoiceChanSpy'][_0xcded('0x2c')],function(_0x558ae5){return{'name':_0x558ae5['fieldName'],'type':_0x558ae5[_0xcded('0x2d')][_0xcded('0x2e')]};});_0x76d37d['model']=_[_0xcded('0x2b')](_0x2be8a3,'name');_0x76d37d[_0xcded('0x2f')]=_['keys'](_0x3c172a[_0xcded('0x2f')]);_0x76d37d[_0xcded('0x30')]=_['intersection'](_0x76d37d[_0xcded('0x31')],_0x76d37d['query']);_0x8a0a83[_0xcded('0x32')]=_[_0xcded('0x33')](_0x76d37d[_0xcded('0x31')],qs['fields'](_0x3c172a['query'][_0xcded('0x34')]));_0x8a0a83['attributes']=_0x8a0a83[_0xcded('0x32')]['length']?_0x8a0a83[_0xcded('0x32')]:_0x76d37d[_0xcded('0x31')];if(!_0x3c172a[_0xcded('0x2f')]['hasOwnProperty'](_0xcded('0x35'))){_0x8a0a83['limit']=qs[_0xcded('0x1e')](_0x3c172a[_0xcded('0x2f')][_0xcded('0x1e')]);_0x8a0a83[_0xcded('0x1d')]=qs[_0xcded('0x1d')](_0x3c172a[_0xcded('0x2f')]['offset']);}_0x8a0a83[_0xcded('0x36')]=qs[_0xcded('0x37')](_0x3c172a[_0xcded('0x2f')][_0xcded('0x37')]);_0x8a0a83[_0xcded('0x38')]=qs['filters'](_['pick'](_0x3c172a[_0xcded('0x2f')],_0x76d37d[_0xcded('0x30')]),_0x2be8a3);if(_0x3c172a[_0xcded('0x2f')][_0xcded('0x39')]){_0x8a0a83['where']=_[_0xcded('0x3a')](_0x8a0a83[_0xcded('0x38')],{'$or':_[_0xcded('0x2b')](_0x2be8a3,function(_0x58ce9b){if(_0x58ce9b[_0xcded('0x2d')]!==_0xcded('0x3b')){var _0x6c20c0={};_0x6c20c0[_0x58ce9b[_0xcded('0x29')]]={'$like':'%'+_0x3c172a[_0xcded('0x2f')][_0xcded('0x39')]+'%'};return _0x6c20c0;}})});}_0x8a0a83=_[_0xcded('0x3a')]({},_0x8a0a83,_0x3c172a[_0xcded('0x3c')]);var _0x648284={'where':_0x8a0a83['where']};return db[_0xcded('0x3d')][_0xcded('0x1c')](_0x648284)[_0xcded('0x23')](function(_0xbfe2b6){_0x425c0e[_0xcded('0x1c')]=_0xbfe2b6;if(_0x3c172a[_0xcded('0x2f')][_0xcded('0x3e')]){_0x8a0a83[_0xcded('0x3f')]=[{'all':!![]}];}return db[_0xcded('0x3d')][_0xcded('0x40')](_0x8a0a83);})[_0xcded('0x23')](function(_0x47afe3){_0x425c0e[_0xcded('0x41')]=_0x47afe3;return _0x425c0e;})[_0xcded('0x23')](respondWithFilteredResult(_0xa8897d,_0x8a0a83))['catch'](handleError(_0xa8897d,null));};exports[_0xcded('0x42')]=function(_0x179878,_0x69470a){var _0x107133={'raw':![],'where':{'id':_0x179878['params']['id']}},_0x5c88a0={};_0x5c88a0[_0xcded('0x31')]=_[_0xcded('0x43')](db[_0xcded('0x3d')][_0xcded('0x2c')]);_0x5c88a0[_0xcded('0x2f')]=_[_0xcded('0x43')](_0x179878['query']);_0x5c88a0[_0xcded('0x30')]=_['intersection'](_0x5c88a0['model'],_0x5c88a0[_0xcded('0x2f')]);_0x107133[_0xcded('0x32')]=_['intersection'](_0x5c88a0[_0xcded('0x31')],qs[_0xcded('0x34')](_0x179878['query']['fields']));_0x107133['attributes']=_0x107133[_0xcded('0x32')][_0xcded('0x44')]?_0x107133[_0xcded('0x32')]:_0x5c88a0[_0xcded('0x31')];if(_0x179878[_0xcded('0x2f')][_0xcded('0x3e')]){_0x107133[_0xcded('0x3f')]=[{'all':!![]}];}_0x107133=_['merge']({},_0x107133,_0x179878[_0xcded('0x3c')]);return db[_0xcded('0x3d')][_0xcded('0x45')](_0x107133)[_0xcded('0x23')](handleEntityNotFound(_0x69470a,null))[_0xcded('0x23')](respondWithResult(_0x69470a,null))[_0xcded('0x46')](handleError(_0x69470a,null));};exports['create']=function(_0x4a2344,_0x19ee19){return db[_0xcded('0x3d')][_0xcded('0x47')](_0x4a2344[_0xcded('0x48')],{})['then'](function(_0x2ffb9a){var _0x1cb7d1=_0x4a2344[_0xcded('0x49')][_0xcded('0x4a')]({'plain':!![]});if(!_0x1cb7d1)throw new Error(_0xcded('0x4b'));if(_0x1cb7d1[_0xcded('0x4c')]===_0xcded('0x49')){var _0x575b32=_0x2ffb9a[_0xcded('0x4a')]({'plain':!![]});var _0x5c28e6=_0xcded('0x25');return db[_0xcded('0x4d')][_0xcded('0x45')]({'where':{'name':_0x5c28e6,'userProfileId':_0x1cb7d1[_0xcded('0x4e')]},'raw':!![]})[_0xcded('0x23')](function(_0xca3041){if(_0xca3041&&_0xca3041[_0xcded('0x4f')]===0x0){return db[_0xcded('0x26')][_0xcded('0x47')]({'name':_0x575b32[_0xcded('0x29')],'resourceId':_0x575b32['id'],'type':_0xca3041[_0xcded('0x29')],'sectionId':_0xca3041['id']},{})[_0xcded('0x23')](function(){return _0x2ffb9a;});}else{return _0x2ffb9a;}})[_0xcded('0x46')](function(_0x242010){logger[_0xcded('0x28')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x242010);throw _0x242010;});}return _0x2ffb9a;})[_0xcded('0x23')](respondWithResult(_0x19ee19,0xc9))[_0xcded('0x46')](handleError(_0x19ee19,null));};exports[_0xcded('0x22')]=function(_0x4bff03,_0x3a46b6){if(_0x4bff03['body']['id']){delete _0x4bff03[_0xcded('0x48')]['id'];}return db[_0xcded('0x3d')][_0xcded('0x45')]({'where':{'id':_0x4bff03[_0xcded('0x50')]['id']}})[_0xcded('0x23')](handleEntityNotFound(_0x3a46b6,null))[_0xcded('0x23')](saveUpdates(_0x4bff03[_0xcded('0x48')],null))[_0xcded('0x23')](respondWithResult(_0x3a46b6,null))[_0xcded('0x46')](handleError(_0x3a46b6,null));};exports[_0xcded('0x24')]=function(_0x10f129,_0xa68619){return db[_0xcded('0x3d')][_0xcded('0x45')]({'where':{'id':_0x10f129[_0xcded('0x50')]['id']}})[_0xcded('0x23')](handleEntityNotFound(_0xa68619,null))[_0xcded('0x23')](removeEntity(_0xa68619,null))[_0xcded('0x46')](handleError(_0xa68619,null));}; \ No newline at end of file +var _0xd455=['attributes','intersection','fields','length','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','VoiceChanSpy','include','findAll','rows','catch','show','includeAll','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','limit','Content-Range','save','update','then','destroy','get','ChanSpies','UserProfileResource','error','name','send','rawAttributes','fieldName','type','key','model','map','query','keys','filters'];(function(_0x45a383,_0x49848c){var _0x3f4cce=function(_0x43af93){while(--_0x43af93){_0x45a383['push'](_0x45a383['shift']());}};_0x3f4cce(++_0x49848c);}(_0xd455,0xbe));var _0x5d45=function(_0x2dfddd,_0x1457ba){_0x2dfddd=_0x2dfddd-0x0;var _0x5cfdbb=_0xd455[_0x2dfddd];return _0x5cfdbb;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x5d45('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x5d45('0x1'));var jsonpatch=require(_0x5d45('0x2'));var rp=require('request-promise');var moment=require(_0x5d45('0x3'));var BPromise=require(_0x5d45('0x4'));var Mustache=require(_0x5d45('0x5'));var util=require(_0x5d45('0x6'));var path=require(_0x5d45('0x7'));var sox=require(_0x5d45('0x8'));var csv=require(_0x5d45('0x9'));var ejs=require(_0x5d45('0xa'));var fs=require('fs');var _=require(_0x5d45('0xb'));var squel=require(_0x5d45('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x5d45('0xd'));var toCsv=require(_0x5d45('0x9'));var querystring=require(_0x5d45('0xe'));var Papa=require('papaparse');var Redis=require(_0x5d45('0xf'));var authService=require(_0x5d45('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x5d45('0x11'));var hardwareService=require(_0x5d45('0x12'));var logger=require(_0x5d45('0x13'))(_0x5d45('0x14'));var utils=require('../../config/utils');var config=require(_0x5d45('0x15'));var db=require(_0x5d45('0x16'))['db'];function respondWithStatusCode(_0x3ba65d,_0x33abb2){_0x33abb2=_0x33abb2||0xcc;return function(_0x26bee1){if(_0x26bee1){return _0x3ba65d[_0x5d45('0x17')](_0x33abb2);}return _0x3ba65d[_0x5d45('0x18')](_0x33abb2)[_0x5d45('0x19')]();};}function respondWithResult(_0x53f1f6,_0x22f3ae){_0x22f3ae=_0x22f3ae||0xc8;return function(_0x2aa744){if(_0x2aa744){return _0x53f1f6['status'](_0x22f3ae)[_0x5d45('0x1a')](_0x2aa744);}};}function respondWithFilteredResult(_0x44f351,_0x39e90b){return function(_0x21c64a){if(_0x21c64a){var _0x1b6781=_0x21c64a[_0x5d45('0x1b')],_0x26174d=_0x39e90b[_0x5d45('0x1c')],_0xdd58d5=_0x39e90b[_0x5d45('0x1c')]+_0x39e90b[_0x5d45('0x1d')],_0x3afb5c;if(_0xdd58d5>=_0x1b6781){_0xdd58d5=_0x1b6781;_0x3afb5c=0xc8;}else{_0x3afb5c=0xce;}_0x44f351['status'](_0x3afb5c);return _0x44f351['set'](_0x5d45('0x1e'),_0x26174d+'-'+_0xdd58d5+'/'+_0x1b6781)[_0x5d45('0x1a')](_0x21c64a);}return null;};}function patchUpdates(_0x419ade){return function(_0x325234){try{jsonpatch['apply'](_0x325234,_0x419ade,!![]);}catch(_0x4adf6c){return BPromise['reject'](_0x4adf6c);}return _0x325234[_0x5d45('0x1f')]();};}function saveUpdates(_0x2ac048,_0x416bfe){return function(_0x421fd2){if(_0x421fd2){return _0x421fd2[_0x5d45('0x20')](_0x2ac048)[_0x5d45('0x21')](function(_0x4c39e8){return _0x4c39e8;});}return null;};}function removeEntity(_0x2cc548,_0x4cc3f9){return function(_0x28bf14){if(_0x28bf14){return _0x28bf14[_0x5d45('0x22')]()['then'](function(){var _0x335ee7=_0x28bf14[_0x5d45('0x23')]({'plain':!![]});var _0x4d655c=_0x5d45('0x24');return db[_0x5d45('0x25')]['destroy']({'where':{'type':_0x4d655c,'resourceId':_0x335ee7['id']}})[_0x5d45('0x21')](function(){return _0x28bf14;});})[_0x5d45('0x21')](function(){_0x2cc548[_0x5d45('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x41c1e4,_0x19a7b9){return function(_0x25d3f3){if(!_0x25d3f3){_0x41c1e4[_0x5d45('0x17')](0x194);}return _0x25d3f3;};}function handleError(_0x2982d3,_0x26bb4b){_0x26bb4b=_0x26bb4b||0x1f4;return function(_0x1ed82b){logger[_0x5d45('0x26')](_0x1ed82b['stack']);if(_0x1ed82b[_0x5d45('0x27')]){delete _0x1ed82b[_0x5d45('0x27')];}_0x2982d3[_0x5d45('0x18')](_0x26bb4b)[_0x5d45('0x28')](_0x1ed82b);};}exports['index']=function(_0x5e1c66,_0x7bc39c){var _0x4ba36a={},_0x4161da={},_0x1b16e7={'count':0x0,'rows':[]};var _0x1286f2=_['map'](db['VoiceChanSpy'][_0x5d45('0x29')],function(_0xb88bfc){return{'name':_0xb88bfc[_0x5d45('0x2a')],'type':_0xb88bfc[_0x5d45('0x2b')][_0x5d45('0x2c')]};});_0x4161da[_0x5d45('0x2d')]=_[_0x5d45('0x2e')](_0x1286f2,'name');_0x4161da[_0x5d45('0x2f')]=_[_0x5d45('0x30')](_0x5e1c66[_0x5d45('0x2f')]);_0x4161da[_0x5d45('0x31')]=_['intersection'](_0x4161da[_0x5d45('0x2d')],_0x4161da[_0x5d45('0x2f')]);_0x4ba36a[_0x5d45('0x32')]=_[_0x5d45('0x33')](_0x4161da[_0x5d45('0x2d')],qs[_0x5d45('0x34')](_0x5e1c66[_0x5d45('0x2f')]['fields']));_0x4ba36a[_0x5d45('0x32')]=_0x4ba36a[_0x5d45('0x32')][_0x5d45('0x35')]?_0x4ba36a[_0x5d45('0x32')]:_0x4161da[_0x5d45('0x2d')];if(!_0x5e1c66['query']['hasOwnProperty'](_0x5d45('0x36'))){_0x4ba36a[_0x5d45('0x1d')]=qs[_0x5d45('0x1d')](_0x5e1c66[_0x5d45('0x2f')][_0x5d45('0x1d')]);_0x4ba36a[_0x5d45('0x1c')]=qs[_0x5d45('0x1c')](_0x5e1c66[_0x5d45('0x2f')][_0x5d45('0x1c')]);}_0x4ba36a[_0x5d45('0x37')]=qs[_0x5d45('0x38')](_0x5e1c66[_0x5d45('0x2f')][_0x5d45('0x38')]);_0x4ba36a['where']=qs[_0x5d45('0x31')](_[_0x5d45('0x39')](_0x5e1c66['query'],_0x4161da[_0x5d45('0x31')]),_0x1286f2);if(_0x5e1c66[_0x5d45('0x2f')][_0x5d45('0x3a')]){_0x4ba36a[_0x5d45('0x3b')]=_[_0x5d45('0x3c')](_0x4ba36a[_0x5d45('0x3b')],{'$or':_[_0x5d45('0x2e')](_0x1286f2,function(_0x1dd519){if(_0x1dd519[_0x5d45('0x2b')]!==_0x5d45('0x3d')){var _0x1ba6c3={};_0x1ba6c3[_0x1dd519[_0x5d45('0x27')]]={'$like':'%'+_0x5e1c66[_0x5d45('0x2f')][_0x5d45('0x3a')]+'%'};return _0x1ba6c3;}})});}_0x4ba36a=_['merge']({},_0x4ba36a,_0x5e1c66[_0x5d45('0x3e')]);var _0x18d911={'where':_0x4ba36a[_0x5d45('0x3b')]};return db[_0x5d45('0x3f')][_0x5d45('0x1b')](_0x18d911)[_0x5d45('0x21')](function(_0x578d55){_0x1b16e7['count']=_0x578d55;if(_0x5e1c66[_0x5d45('0x2f')]['includeAll']){_0x4ba36a[_0x5d45('0x40')]=[{'all':!![]}];}return db['VoiceChanSpy'][_0x5d45('0x41')](_0x4ba36a);})[_0x5d45('0x21')](function(_0x5c2ffd){_0x1b16e7[_0x5d45('0x42')]=_0x5c2ffd;return _0x1b16e7;})['then'](respondWithFilteredResult(_0x7bc39c,_0x4ba36a))[_0x5d45('0x43')](handleError(_0x7bc39c,null));};exports[_0x5d45('0x44')]=function(_0x1f4fc3,_0x33eea0){var _0x5de928={'raw':![],'where':{'id':_0x1f4fc3['params']['id']}},_0x39ef8e={};_0x39ef8e['model']=_[_0x5d45('0x30')](db[_0x5d45('0x3f')][_0x5d45('0x29')]);_0x39ef8e['query']=_[_0x5d45('0x30')](_0x1f4fc3['query']);_0x39ef8e['filters']=_[_0x5d45('0x33')](_0x39ef8e['model'],_0x39ef8e[_0x5d45('0x2f')]);_0x5de928['attributes']=_['intersection'](_0x39ef8e[_0x5d45('0x2d')],qs[_0x5d45('0x34')](_0x1f4fc3[_0x5d45('0x2f')]['fields']));_0x5de928[_0x5d45('0x32')]=_0x5de928['attributes'][_0x5d45('0x35')]?_0x5de928[_0x5d45('0x32')]:_0x39ef8e[_0x5d45('0x2d')];if(_0x1f4fc3[_0x5d45('0x2f')][_0x5d45('0x45')]){_0x5de928[_0x5d45('0x40')]=[{'all':!![]}];}_0x5de928=_[_0x5d45('0x3c')]({},_0x5de928,_0x1f4fc3[_0x5d45('0x3e')]);return db[_0x5d45('0x3f')][_0x5d45('0x46')](_0x5de928)[_0x5d45('0x21')](handleEntityNotFound(_0x33eea0,null))['then'](respondWithResult(_0x33eea0,null))[_0x5d45('0x43')](handleError(_0x33eea0,null));};exports[_0x5d45('0x47')]=function(_0x34ac96,_0x31e06a){return db[_0x5d45('0x3f')][_0x5d45('0x47')](_0x34ac96[_0x5d45('0x48')],{})[_0x5d45('0x21')](function(_0x256319){var _0x4e8a09=_0x34ac96[_0x5d45('0x49')]['get']({'plain':!![]});if(!_0x4e8a09)throw new Error(_0x5d45('0x4a'));if(_0x4e8a09[_0x5d45('0x4b')]===_0x5d45('0x49')){var _0x35c949=_0x256319[_0x5d45('0x23')]({'plain':!![]});var _0x3ff2c1=_0x5d45('0x24');return db['UserProfileSection'][_0x5d45('0x46')]({'where':{'name':_0x3ff2c1,'userProfileId':_0x4e8a09[_0x5d45('0x4c')]},'raw':!![]})['then'](function(_0x1ea056){if(_0x1ea056&&_0x1ea056[_0x5d45('0x4d')]===0x0){return db['UserProfileResource'][_0x5d45('0x47')]({'name':_0x35c949[_0x5d45('0x27')],'resourceId':_0x35c949['id'],'type':_0x1ea056[_0x5d45('0x27')],'sectionId':_0x1ea056['id']},{})['then'](function(){return _0x256319;});}else{return _0x256319;}})[_0x5d45('0x43')](function(_0x55a646){logger['error'](_0x5d45('0x4e'),_0x55a646);throw _0x55a646;});}return _0x256319;})[_0x5d45('0x21')](respondWithResult(_0x31e06a,0xc9))[_0x5d45('0x43')](handleError(_0x31e06a,null));};exports['update']=function(_0x342934,_0x457481){if(_0x342934[_0x5d45('0x48')]['id']){delete _0x342934[_0x5d45('0x48')]['id'];}return db[_0x5d45('0x3f')]['find']({'where':{'id':_0x342934[_0x5d45('0x4f')]['id']}})[_0x5d45('0x21')](handleEntityNotFound(_0x457481,null))[_0x5d45('0x21')](saveUpdates(_0x342934[_0x5d45('0x48')],null))[_0x5d45('0x21')](respondWithResult(_0x457481,null))[_0x5d45('0x43')](handleError(_0x457481,null));};exports[_0x5d45('0x22')]=function(_0x4ef10f,_0x363050){return db[_0x5d45('0x3f')][_0x5d45('0x46')]({'where':{'id':_0x4ef10f[_0x5d45('0x4f')]['id']}})['then'](handleEntityNotFound(_0x363050,null))[_0x5d45('0x21')](removeEntity(_0x363050,null))[_0x5d45('0x43')](handleError(_0x363050,null));}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.model.js b/server/api/voiceChanSpy/voiceChanSpy.model.js index ef16ddb..8008ca9 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 _0xdfcc=['name','User','findAll','agent','catch','exports','models','define','VoiceChanSpy','voice_chanspy','then','VoiceExtension','length','lodash','util','bluebird','format','%s%s','system','push','merge','Set','CDR(type)=%s','record','MixMonitor','${UNIQUEID}.%s,a','password','ChanSpy','SIP/%s,%s','options','concat','internal'];(function(_0x3b52bf,_0xe47312){var _0x253982=function(_0x13feb2){while(--_0x13feb2){_0x3b52bf['push'](_0x3b52bf['shift']());}};_0x253982(++_0xe47312);}(_0xdfcc,0x8d));var _0xcdfc=function(_0x1646fa,_0x4e5bd7){_0x1646fa=_0x1646fa-0x0;var _0x5a47a5=_0xdfcc[_0x1646fa];return _0x5a47a5;};'use strict';var _=require(_0xcdfc('0x0'));var util=require(_0xcdfc('0x1'));var BPromise=require(_0xcdfc('0x2'));var attributes=require('./voiceChanSpy.attributes');var getUserApplications=function(_0x133c72,_0x851248,_0x54bd16){var _0x4aef49=0x1;var _0x468275=[];var _0x4e9e63={'context':_0x851248['context']||'from-sip','exten':util[_0xcdfc('0x3')](_0xcdfc('0x4'),_0x133c72['prefix'],_0x54bd16),'type':_0xcdfc('0x5'),'isApp':![],'ChanSpyId':_0x133c72['id'],'UserId':_0x851248['id']};_0x468275[_0xcdfc('0x6')](_[_0xcdfc('0x7')]({'app':_0xcdfc('0x8'),'appdata':util['format'](_0xcdfc('0x9'),'chanspy'),'priority':_0x4aef49++},_0x4e9e63));if(_0x133c72[_0xcdfc('0xa')]){_0x468275[_0xcdfc('0x6')](_[_0xcdfc('0x7')]({'app':_0xcdfc('0xb'),'appdata':util[_0xcdfc('0x3')](_0xcdfc('0xc'),_0x133c72['recordingFormat']),'priority':_0x4aef49++},_0x4e9e63));}if(_0x133c72['auth']){_0x468275[_0xcdfc('0x6')](_[_0xcdfc('0x7')]({'app':'Authenticate','appdata':_0x133c72[_0xcdfc('0xd')],'priority':_0x4aef49++},_0x4e9e63));}_0x468275[_0xcdfc('0x6')](_['merge']({'app':_0xcdfc('0xe'),'appdata':util[_0xcdfc('0x3')](_0xcdfc('0xf'),_0x851248['name'],_0x133c72[_0xcdfc('0x10')]?_0x133c72[_0xcdfc('0x10')]['join'](''):''),'priority':_0x4aef49++},_0x4e9e63));if(_0x133c72[_0xcdfc('0xa')]){_0x468275[_0xcdfc('0x6')](_[_0xcdfc('0x7')]({'app':'StopMixMonitor','priority':_0x4aef49++},_0x4e9e63));}return _0x468275;};var getChanSpyApplications=function(_0x3834aa,_0x1a8095){var _0x48f497=[];for(var _0x375ae5=0x0,_0x19f868=0x1;_0x375ae5<_0x1a8095['length'];_0x375ae5++,_0x19f868=0x1){_0x48f497=_0x48f497[_0xcdfc('0x11')](getUserApplications(_0x3834aa,_0x1a8095[_0x375ae5],_0x1a8095[_0x375ae5][_0xcdfc('0x12')]));if(_0x1a8095[_0x375ae5][_0xcdfc('0x12')]!=_0x1a8095[_0x375ae5]['name']){_0x48f497=_0x48f497[_0xcdfc('0x11')](getUserApplications(_0x3834aa,_0x1a8095[_0x375ae5],_0x1a8095[_0x375ae5][_0xcdfc('0x13')]));}}return _0x48f497;};var getChanSpyPromise=function(_0x5ad601,_0x3e1707){return new BPromise(function(_0x7e62d0,_0x1efa4e){return _0x5ad601[_0xcdfc('0x14')][_0xcdfc('0x15')]({'attributes':['id',_0xcdfc('0x13'),'internal'],'where':{'role':_0xcdfc('0x16'),'chanspy':!![]},'raw':!![]})['then'](function(_0x2124cf){if(_0x2124cf){return _0x7e62d0(getChanSpyApplications(_0x3e1707,_0x2124cf));}return _0x7e62d0([]);})[_0xcdfc('0x17')](function(_0x2b7868){_0x1efa4e(_0x2b7868);});});};module[_0xcdfc('0x18')]=function(_0x4e58ce,_0x183ada){var _0x1949df=_0x4e58ce[_0xcdfc('0x19')];return _0x4e58ce[_0xcdfc('0x1a')](_0xcdfc('0x1b'),attributes,{'tableName':_0xcdfc('0x1c'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x101ba0,_0x3bdd7f,_0xf31d8a){return getChanSpyPromise(_0x1949df,_0x101ba0)[_0xcdfc('0x1d')](function(_0x44ab0b){if(_0x44ab0b&&_0x44ab0b['length']){return _0x1949df[_0xcdfc('0x1e')]['bulkCreate'](_0x44ab0b);}})[_0xcdfc('0x1d')](function(){_0xf31d8a();})[_0xcdfc('0x17')](function(_0x762f0e){_0xf31d8a(_0x762f0e);});},'afterUpdate':function(_0x28d4bc,_0x1de322,_0x180198){return _0x1949df[_0xcdfc('0x1e')]['destroy']({'where':{'ChanSpyId':_0x28d4bc['id']}})['then'](function(){return getChanSpyPromise(_0x1949df,_0x28d4bc);})[_0xcdfc('0x1d')](function(_0x260843){if(_0x260843&&_0x260843[_0xcdfc('0x1f')]){return _0x1949df[_0xcdfc('0x1e')]['bulkCreate'](_0x260843);}})[_0xcdfc('0x1d')](function(){_0x180198();})[_0xcdfc('0x17')](function(_0x5561bd){_0x180198(_0x5561bd);});},'afterDestroy':function(_0x5b19e2,_0x29cc4e,_0x3854cf){return _0x1949df[_0xcdfc('0x1e')]['destroy']({'where':{'ChanSpyId':_0x5b19e2['id']}})[_0xcdfc('0x1d')](function(){_0x3854cf();})[_0xcdfc('0x17')](function(_0x40008e){_0x3854cf(_0x40008e);});}}});}; \ No newline at end of file +var _0x10a5=['from-sip','format','%s%s','push','merge','Set','CDR(type)=%s','chanspy','record','${UNIQUEID}.%s,a','auth','Authenticate','password','ChanSpy','SIP/%s,%s','name','StopMixMonitor','concat','internal','User','agent','then','catch','exports','models','VoiceChanSpy','voice_chanspy','length','VoiceExtension','bulkCreate','destroy','lodash','util','bluebird','./voiceChanSpy.attributes','context'];(function(_0xbca1b1,_0x33f0ce){var _0x4e1686=function(_0x58a80c){while(--_0x58a80c){_0xbca1b1['push'](_0xbca1b1['shift']());}};_0x4e1686(++_0x33f0ce);}(_0x10a5,0x163));var _0x510a=function(_0x37e845,_0x219f9f){_0x37e845=_0x37e845-0x0;var _0x59e55b=_0x10a5[_0x37e845];return _0x59e55b;};'use strict';var _=require(_0x510a('0x0'));var util=require(_0x510a('0x1'));var BPromise=require(_0x510a('0x2'));var attributes=require(_0x510a('0x3'));var getUserApplications=function(_0x15a46b,_0x3dce5a,_0x68c824){var _0x29c239=0x1;var _0xc8089=[];var _0x5f6539={'context':_0x3dce5a[_0x510a('0x4')]||_0x510a('0x5'),'exten':util[_0x510a('0x6')](_0x510a('0x7'),_0x15a46b['prefix'],_0x68c824),'type':'system','isApp':![],'ChanSpyId':_0x15a46b['id'],'UserId':_0x3dce5a['id']};_0xc8089[_0x510a('0x8')](_[_0x510a('0x9')]({'app':_0x510a('0xa'),'appdata':util[_0x510a('0x6')](_0x510a('0xb'),_0x510a('0xc')),'priority':_0x29c239++},_0x5f6539));if(_0x15a46b[_0x510a('0xd')]){_0xc8089[_0x510a('0x8')](_[_0x510a('0x9')]({'app':'MixMonitor','appdata':util[_0x510a('0x6')](_0x510a('0xe'),_0x15a46b['recordingFormat']),'priority':_0x29c239++},_0x5f6539));}if(_0x15a46b[_0x510a('0xf')]){_0xc8089[_0x510a('0x8')](_[_0x510a('0x9')]({'app':_0x510a('0x10'),'appdata':_0x15a46b[_0x510a('0x11')],'priority':_0x29c239++},_0x5f6539));}_0xc8089[_0x510a('0x8')](_[_0x510a('0x9')]({'app':_0x510a('0x12'),'appdata':util['format'](_0x510a('0x13'),_0x3dce5a[_0x510a('0x14')],_0x15a46b['options']?_0x15a46b['options']['join'](''):''),'priority':_0x29c239++},_0x5f6539));if(_0x15a46b[_0x510a('0xd')]){_0xc8089[_0x510a('0x8')](_[_0x510a('0x9')]({'app':_0x510a('0x15'),'priority':_0x29c239++},_0x5f6539));}return _0xc8089;};var getChanSpyApplications=function(_0x15fd06,_0x2d15af){var _0x5a079c=[];for(var _0x19f5c4=0x0,_0x11e0dc=0x1;_0x19f5c4<_0x2d15af['length'];_0x19f5c4++,_0x11e0dc=0x1){_0x5a079c=_0x5a079c[_0x510a('0x16')](getUserApplications(_0x15fd06,_0x2d15af[_0x19f5c4],_0x2d15af[_0x19f5c4][_0x510a('0x17')]));if(_0x2d15af[_0x19f5c4][_0x510a('0x17')]!=_0x2d15af[_0x19f5c4]['name']){_0x5a079c=_0x5a079c[_0x510a('0x16')](getUserApplications(_0x15fd06,_0x2d15af[_0x19f5c4],_0x2d15af[_0x19f5c4]['name']));}}return _0x5a079c;};var getChanSpyPromise=function(_0x167721,_0x1d78c1){return new BPromise(function(_0x3e64d4,_0x22ff84){return _0x167721[_0x510a('0x18')]['findAll']({'attributes':['id',_0x510a('0x14'),_0x510a('0x17')],'where':{'role':_0x510a('0x19'),'chanspy':!![]},'raw':!![]})[_0x510a('0x1a')](function(_0x157127){if(_0x157127){return _0x3e64d4(getChanSpyApplications(_0x1d78c1,_0x157127));}return _0x3e64d4([]);})[_0x510a('0x1b')](function(_0x5b24fb){_0x22ff84(_0x5b24fb);});});};module[_0x510a('0x1c')]=function(_0x4ee01f,_0xc23844){var _0x3cec5b=_0x4ee01f[_0x510a('0x1d')];return _0x4ee01f['define'](_0x510a('0x1e'),attributes,{'tableName':_0x510a('0x1f'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x5e923e,_0xab5f53,_0x54cc9c){return getChanSpyPromise(_0x3cec5b,_0x5e923e)[_0x510a('0x1a')](function(_0x26bcf1){if(_0x26bcf1&&_0x26bcf1[_0x510a('0x20')]){return _0x3cec5b[_0x510a('0x21')][_0x510a('0x22')](_0x26bcf1);}})[_0x510a('0x1a')](function(){_0x54cc9c();})[_0x510a('0x1b')](function(_0x197da9){_0x54cc9c(_0x197da9);});},'afterUpdate':function(_0xf08430,_0x26b4f8,_0x24fc29){return _0x3cec5b[_0x510a('0x21')][_0x510a('0x23')]({'where':{'ChanSpyId':_0xf08430['id']}})[_0x510a('0x1a')](function(){return getChanSpyPromise(_0x3cec5b,_0xf08430);})[_0x510a('0x1a')](function(_0x1b7e4b){if(_0x1b7e4b&&_0x1b7e4b[_0x510a('0x20')]){return _0x3cec5b[_0x510a('0x21')][_0x510a('0x22')](_0x1b7e4b);}})[_0x510a('0x1a')](function(){_0x24fc29();})[_0x510a('0x1b')](function(_0x57f0a6){_0x24fc29(_0x57f0a6);});},'afterDestroy':function(_0x340fef,_0x2a4bd2,_0x48f9eb){return _0x3cec5b[_0x510a('0x21')][_0x510a('0x23')]({'where':{'ChanSpyId':_0x340fef['id']}})['then'](function(){_0x48f9eb();})[_0x510a('0x1b')](function(_0x2cbac5){_0x48f9eb(_0x2cbac5);});}}});}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.rpc.js b/server/api/voiceChanSpy/voiceChanSpy.rpc.js index 441f2d0..b23553c 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 _0xb85d=['stringify','error','code','message','result','catch','util','moment','../../config/utils','../../config/logger','rpc','../../config/environment','client','then','info','VoiceChanSpy,\x20%s,\x20%s','request\x20sent','debug','VoiceChanSpy,\x20%s,\x20%s,\x20%s'];(function(_0x1895b7,_0x21fbc7){var _0x1aecdc=function(_0x44682a){while(--_0x44682a){_0x1895b7['push'](_0x1895b7['shift']());}};_0x1aecdc(++_0x21fbc7);}(_0xb85d,0x78));var _0xdb85=function(_0x205c76,_0x385a60){_0x205c76=_0x205c76-0x0;var _0x5e5ddb=_0xb85d[_0x205c76];return _0x5e5ddb;};'use strict';var _=require('lodash');var util=require(_0xdb85('0x0'));var moment=require(_0xdb85('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xdb85('0x2'));var logger=require(_0xdb85('0x3'))(_0xdb85('0x4'));var config=require(_0xdb85('0x5'));var jayson=require('jayson/promise');var client=jayson[_0xdb85('0x6')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5d932f,_0x3954d5,_0x5ace41){return new BPromise(function(_0x596f4f,_0x1d476d){return client['request'](_0x5d932f,_0x5ace41)[_0xdb85('0x7')](function(_0x501a65){logger[_0xdb85('0x8')](_0xdb85('0x9'),_0x3954d5,_0xdb85('0xa'));logger[_0xdb85('0xb')](_0xdb85('0xc'),_0x3954d5,'request\x20sent',JSON[_0xdb85('0xd')](_0x501a65));if(_0x501a65[_0xdb85('0xe')]){if(_0x501a65[_0xdb85('0xe')][_0xdb85('0xf')]===0x1f4){logger[_0xdb85('0xe')](_0xdb85('0x9'),_0x3954d5,_0x501a65[_0xdb85('0xe')][_0xdb85('0x10')]);return _0x1d476d(_0x501a65[_0xdb85('0xe')][_0xdb85('0x10')]);}logger[_0xdb85('0xe')](_0xdb85('0x9'),_0x3954d5,_0x501a65[_0xdb85('0xe')][_0xdb85('0x10')]);return _0x596f4f(_0x501a65[_0xdb85('0xe')][_0xdb85('0x10')]);}else{logger[_0xdb85('0x8')](_0xdb85('0x9'),_0x3954d5,_0xdb85('0xa'));_0x596f4f(_0x501a65[_0xdb85('0x11')][_0xdb85('0x10')]);}})[_0xdb85('0x12')](function(_0x3c3a67){logger['error'](_0xdb85('0x9'),_0x3954d5,_0x3c3a67);_0x1d476d(_0x3c3a67);});});} \ No newline at end of file +var _0xa9e4=['ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','then','info','request\x20sent','debug','VoiceChanSpy,\x20%s,\x20%s,\x20%s','stringify','error','code','message','VoiceChanSpy,\x20%s,\x20%s','result','lodash','util','moment','bluebird','randomstring'];(function(_0x574d9b,_0x2063da){var _0x31d2a5=function(_0x97ce4c){while(--_0x97ce4c){_0x574d9b['push'](_0x574d9b['shift']());}};_0x31d2a5(++_0x2063da);}(_0xa9e4,0x10f));var _0x4a9e=function(_0x18e67c,_0x18d6a6){_0x18e67c=_0x18e67c-0x0;var _0x551e11=_0xa9e4[_0x18e67c];return _0x551e11;};'use strict';var _=require(_0x4a9e('0x0'));var util=require(_0x4a9e('0x1'));var moment=require(_0x4a9e('0x2'));var BPromise=require(_0x4a9e('0x3'));var rs=require(_0x4a9e('0x4'));var fs=require('fs');var Redis=require(_0x4a9e('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x4a9e('0x6'));var logger=require(_0x4a9e('0x7'))('rpc');var config=require(_0x4a9e('0x8'));var jayson=require(_0x4a9e('0x9'));var client=jayson[_0x4a9e('0xa')][_0x4a9e('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x566814,_0x5bf4f0,_0x13a919){return new BPromise(function(_0x3da296,_0x25d2e2){return client['request'](_0x566814,_0x13a919)[_0x4a9e('0xc')](function(_0x10770a){logger[_0x4a9e('0xd')]('VoiceChanSpy,\x20%s,\x20%s',_0x5bf4f0,_0x4a9e('0xe'));logger[_0x4a9e('0xf')](_0x4a9e('0x10'),_0x5bf4f0,_0x4a9e('0xe'),JSON[_0x4a9e('0x11')](_0x10770a));if(_0x10770a[_0x4a9e('0x12')]){if(_0x10770a[_0x4a9e('0x12')][_0x4a9e('0x13')]===0x1f4){logger[_0x4a9e('0x12')]('VoiceChanSpy,\x20%s,\x20%s',_0x5bf4f0,_0x10770a[_0x4a9e('0x12')][_0x4a9e('0x14')]);return _0x25d2e2(_0x10770a['error'][_0x4a9e('0x14')]);}logger[_0x4a9e('0x12')](_0x4a9e('0x15'),_0x5bf4f0,_0x10770a['error']['message']);return _0x3da296(_0x10770a[_0x4a9e('0x12')][_0x4a9e('0x14')]);}else{logger[_0x4a9e('0xd')](_0x4a9e('0x15'),_0x5bf4f0,_0x4a9e('0xe'));_0x3da296(_0x10770a[_0x4a9e('0x16')][_0x4a9e('0x14')]);}})['catch'](function(_0x324c29){logger[_0x4a9e('0x12')](_0x4a9e('0x15'),_0x5bf4f0,_0x324c29);_0x25d2e2(_0x324c29);});});} \ No newline at end of file diff --git a/server/api/voiceContext/index.js b/server/api/voiceContext/index.js index cae830b..de3151d 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 _0x7dbe=['index','/:id','show','post','create','delete','multer','path','connect-timeout','express','../../components/interaction/service','../../config/environment','get','isAuthenticated'];(function(_0x46743a,_0x38a26f){var _0x181f33=function(_0x54edd7){while(--_0x54edd7){_0x46743a['push'](_0x46743a['shift']());}};_0x181f33(++_0x38a26f);}(_0x7dbe,0x13a));var _0xe7db=function(_0x2dc205,_0x326e0d){_0x2dc205=_0x2dc205-0x0;var _0x452a76=_0x7dbe[_0x2dc205];return _0x452a76;};'use strict';var multer=require(_0xe7db('0x0'));var util=require('util');var path=require(_0xe7db('0x1'));var timeout=require(_0xe7db('0x2'));var express=require(_0xe7db('0x3'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0xe7db('0x4'));var config=require(_0xe7db('0x5'));var controller=require('./voiceContext.controller');router[_0xe7db('0x6')]('/',auth[_0xe7db('0x7')](),controller[_0xe7db('0x8')]);router[_0xe7db('0x6')](_0xe7db('0x9'),auth[_0xe7db('0x7')](),controller[_0xe7db('0xa')]);router[_0xe7db('0xb')]('/',auth[_0xe7db('0x7')](),controller[_0xe7db('0xc')]);router['put'](_0xe7db('0x9'),auth[_0xe7db('0x7')](),controller['update']);router[_0xe7db('0xd')]('/:id',auth[_0xe7db('0x7')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xd659=['../../components/auth/service','../../config/environment','get','isAuthenticated','index','/:id','show','post','create','put','update','delete','destroy','exports','util','path','connect-timeout','express','Router'];(function(_0x20a29a,_0x414104){var _0x4de1d4=function(_0x3beb42){while(--_0x3beb42){_0x20a29a['push'](_0x20a29a['shift']());}};_0x4de1d4(++_0x414104);}(_0xd659,0xf2));var _0x9d65=function(_0x233102,_0x2664bd){_0x233102=_0x233102-0x0;var _0x1531d1=_0xd659[_0x233102];return _0x1531d1;};'use strict';var multer=require('multer');var util=require(_0x9d65('0x0'));var path=require(_0x9d65('0x1'));var timeout=require(_0x9d65('0x2'));var express=require(_0x9d65('0x3'));var router=express[_0x9d65('0x4')]();var auth=require(_0x9d65('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x9d65('0x6'));var controller=require('./voiceContext.controller');router[_0x9d65('0x7')]('/',auth[_0x9d65('0x8')](),controller[_0x9d65('0x9')]);router[_0x9d65('0x7')](_0x9d65('0xa'),auth[_0x9d65('0x8')](),controller[_0x9d65('0xb')]);router[_0x9d65('0xc')]('/',auth['isAuthenticated'](),controller[_0x9d65('0xd')]);router[_0x9d65('0xe')](_0x9d65('0xa'),auth['isAuthenticated'](),controller[_0x9d65('0xf')]);router[_0x9d65('0x10')](_0x9d65('0xa'),auth['isAuthenticated'](),controller[_0x9d65('0x11')]);module[_0x9d65('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 d7c69fb..bcc2716 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 _0x9c44=['BOOLEAN','STRING','name'];(function(_0xeb54a4,_0x53b95e){var _0x597e40=function(_0xcf55f4){while(--_0xcf55f4){_0xeb54a4['push'](_0xeb54a4['shift']());}};_0x597e40(++_0x53b95e);}(_0x9c44,0x178));var _0x49c4=function(_0x543084,_0x4337f5){_0x543084=_0x543084-0x0;var _0x306a57=_0x9c44[_0x543084];return _0x306a57;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x49c4('0x0')],'unique':_0x49c4('0x1')},'description':{'type':Sequelize[_0x49c4('0x0')],'allowNull':!![]},'defaultEntry':{'type':Sequelize[_0x49c4('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0x34e8=['sequelize','exports','STRING','name','BOOLEAN'];(function(_0x328da0,_0x3103f4){var _0x3360a9=function(_0x149917){while(--_0x149917){_0x328da0['push'](_0x328da0['shift']());}};_0x3360a9(++_0x3103f4);}(_0x34e8,0x12c));var _0x834e=function(_0x16948b,_0x2e98fa){_0x16948b=_0x16948b-0x0;var _0x534f72=_0x34e8[_0x16948b];return _0x534f72;};'use strict';var Sequelize=require(_0x834e('0x0'));module[_0x834e('0x1')]={'name':{'type':Sequelize[_0x834e('0x2')],'unique':_0x834e('0x3')},'description':{'type':Sequelize['STRING'],'allowNull':!![]},'defaultEntry':{'type':Sequelize[_0x834e('0x4')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.controller.js b/server/api/voiceContext/voiceContext.controller.js index a617bb3..7688b06 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 _0xe14b=['query','keys','intersection','attributes','fields','hasOwnProperty','sort','where','pick','filters','merge','filter','include','rows','catch','show','params','includeAll','options','create','body','findAll','readFileSync','join','root','server/files/templates/context.ejs','utf8','render','writeFileSync','/etc/asterisk/extensions_xcally_contexts.conf','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','Reload','chan_sip.so','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','jayson/promise','client','http','test','Sequelize','ValidationError','request','then','info','VoiceContext,\x20%s,\x20%s','request\x20sent','VoiceContext,\x20%s,\x20%s,\x20%s','stringify','error','code','message','sendStatus','status','count','offset','limit','set','Content-Range','json','apply','reject','save','update','destroy','Contexts','end','stack','name','send','index','map','VoiceContext','rawAttributes','fieldName','type','key','model'];(function(_0x25bb5c,_0x398eed){var _0x3db377=function(_0x5b678e){while(--_0x5b678e){_0x25bb5c['push'](_0x25bb5c['shift']());}};_0x3db377(++_0x398eed);}(_0xe14b,0x93));var _0xbe14=function(_0x4efe12,_0x5cd207){_0x4efe12=_0x4efe12-0x0;var _0x4b0ad3=_0xe14b[_0x4efe12];return _0x4b0ad3;};'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'];var jayson=require(_0xbe14('0x15'));var client=jayson[_0xbe14('0x16')][_0xbe14('0x17')]({'port':0x232a});function checkPasswordPattern(_0x23a730,_0x2850cb,_0x16893f){if(_0x16893f){var _0xa2cf72=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0xa2cf72[_0xbe14('0x18')](_0x2850cb)){return _0x23a730;}else{throw new db[(_0xbe14('0x19'))][(_0xbe14('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 _0x23a730;}}function respondWithRpcPromise(_0x55b3a7,_0x3f58f5,_0x3dc4a9,_0xf4ac9){return new BPromise(function(_0x37ce4e,_0x4e8f34){var _0x21c789=_0xf4ac9||client;return _0x21c789[_0xbe14('0x1b')](_0x55b3a7,_0x3dc4a9)[_0xbe14('0x1c')](function(_0x123ede){logger[_0xbe14('0x1d')](_0xbe14('0x1e'),_0x3f58f5,_0xbe14('0x1f'));logger['debug'](_0xbe14('0x20'),_0x3f58f5,_0xbe14('0x1f'),JSON[_0xbe14('0x21')](_0x123ede));if(_0x123ede[_0xbe14('0x22')]){if(_0x123ede[_0xbe14('0x22')][_0xbe14('0x23')]===0x1f4){logger['error'](_0xbe14('0x1e'),_0x3f58f5,_0x123ede[_0xbe14('0x22')][_0xbe14('0x24')]);return _0x4e8f34(_0x123ede[_0xbe14('0x22')][_0xbe14('0x24')]);}logger['error'](_0xbe14('0x1e'),_0x3f58f5,_0x123ede['error'][_0xbe14('0x24')]);return _0x37ce4e(_0x123ede['error'][_0xbe14('0x24')]);}else{logger['info'](_0xbe14('0x1e'),_0x3f58f5,_0xbe14('0x1f'));_0x37ce4e(_0x123ede['result'][_0xbe14('0x24')]);}})['catch'](function(_0x4587a8){logger['error'](_0xbe14('0x1e'),_0x3f58f5,_0x4587a8);_0x4e8f34(_0x4587a8);});});}function respondWithStatusCode(_0x5fa043,_0x1ee9c1){_0x1ee9c1=_0x1ee9c1||0xcc;return function(_0x39cc81){if(_0x39cc81){return _0x5fa043[_0xbe14('0x25')](_0x1ee9c1);}return _0x5fa043[_0xbe14('0x26')](_0x1ee9c1)['end']();};}function respondWithResult(_0x1822e0,_0x1ba46a){_0x1ba46a=_0x1ba46a||0xc8;return function(_0x391556){if(_0x391556){return _0x1822e0[_0xbe14('0x26')](_0x1ba46a)['json'](_0x391556);}};}function respondWithFilteredResult(_0x16f884,_0x29fc64){return function(_0x59bf34){if(_0x59bf34){var _0x3c3613=_0x59bf34[_0xbe14('0x27')],_0x3b3e84=_0x29fc64[_0xbe14('0x28')],_0x1c7cc7=_0x29fc64[_0xbe14('0x28')]+_0x29fc64[_0xbe14('0x29')],_0x19252f;if(_0x1c7cc7>=_0x3c3613){_0x1c7cc7=_0x3c3613;_0x19252f=0xc8;}else{_0x19252f=0xce;}_0x16f884[_0xbe14('0x26')](_0x19252f);return _0x16f884[_0xbe14('0x2a')](_0xbe14('0x2b'),_0x3b3e84+'-'+_0x1c7cc7+'/'+_0x3c3613)[_0xbe14('0x2c')](_0x59bf34);}return null;};}function patchUpdates(_0x39dc0a){return function(_0x10ae36){try{jsonpatch[_0xbe14('0x2d')](_0x10ae36,_0x39dc0a,!![]);}catch(_0xe6feb2){return BPromise[_0xbe14('0x2e')](_0xe6feb2);}return _0x10ae36[_0xbe14('0x2f')]();};}function saveUpdates(_0x29e76a,_0x14e7c4){return function(_0x581e86){if(_0x581e86){return _0x581e86[_0xbe14('0x30')](_0x29e76a)['then'](function(_0x58f8de){return _0x58f8de;});}return null;};}function removeEntity(_0x46c2d1,_0x4c1e7e){return function(_0x243524){if(_0x243524){return _0x243524[_0xbe14('0x31')]()['then'](function(){var _0x50cb09=_0x243524['get']({'plain':!![]});var _0x412ad5=_0xbe14('0x32');return db['UserProfileResource'][_0xbe14('0x31')]({'where':{'type':_0x412ad5,'resourceId':_0x50cb09['id']}})[_0xbe14('0x1c')](function(){return _0x243524;});})[_0xbe14('0x1c')](function(){_0x46c2d1[_0xbe14('0x26')](0xcc)[_0xbe14('0x33')]();});}};}function handleEntityNotFound(_0x5ef1e5,_0x591a36){return function(_0x15a997){if(!_0x15a997){_0x5ef1e5['sendStatus'](0x194);}return _0x15a997;};}function handleError(_0x5dd7aa,_0x5c5e9f){_0x5c5e9f=_0x5c5e9f||0x1f4;return function(_0x163ef7){logger[_0xbe14('0x22')](_0x163ef7[_0xbe14('0x34')]);if(_0x163ef7[_0xbe14('0x35')]){delete _0x163ef7[_0xbe14('0x35')];}_0x5dd7aa[_0xbe14('0x26')](_0x5c5e9f)[_0xbe14('0x36')](_0x163ef7);};}exports[_0xbe14('0x37')]=function(_0x2d9c12,_0x2dfd5a){var _0x41652d={},_0x32c59d={},_0x539c41={'count':0x0,'rows':[]};var _0x4f51f8=_[_0xbe14('0x38')](db[_0xbe14('0x39')][_0xbe14('0x3a')],function(_0x520e09){return{'name':_0x520e09[_0xbe14('0x3b')],'type':_0x520e09[_0xbe14('0x3c')][_0xbe14('0x3d')]};});_0x32c59d[_0xbe14('0x3e')]=_[_0xbe14('0x38')](_0x4f51f8,_0xbe14('0x35'));_0x32c59d[_0xbe14('0x3f')]=_[_0xbe14('0x40')](_0x2d9c12[_0xbe14('0x3f')]);_0x32c59d['filters']=_[_0xbe14('0x41')](_0x32c59d[_0xbe14('0x3e')],_0x32c59d[_0xbe14('0x3f')]);_0x41652d[_0xbe14('0x42')]=_[_0xbe14('0x41')](_0x32c59d[_0xbe14('0x3e')],qs['fields'](_0x2d9c12[_0xbe14('0x3f')][_0xbe14('0x43')]));_0x41652d[_0xbe14('0x42')]=_0x41652d[_0xbe14('0x42')]['length']?_0x41652d['attributes']:_0x32c59d[_0xbe14('0x3e')];if(!_0x2d9c12[_0xbe14('0x3f')][_0xbe14('0x44')]('nolimit')){_0x41652d['limit']=qs[_0xbe14('0x29')](_0x2d9c12['query']['limit']);_0x41652d[_0xbe14('0x28')]=qs[_0xbe14('0x28')](_0x2d9c12[_0xbe14('0x3f')]['offset']);}_0x41652d['order']=qs['sort'](_0x2d9c12[_0xbe14('0x3f')][_0xbe14('0x45')]);_0x41652d[_0xbe14('0x46')]=qs['filters'](_[_0xbe14('0x47')](_0x2d9c12[_0xbe14('0x3f')],_0x32c59d[_0xbe14('0x48')]),_0x4f51f8);if(_0x2d9c12[_0xbe14('0x3f')]['filter']){_0x41652d['where']=_[_0xbe14('0x49')](_0x41652d[_0xbe14('0x46')],{'$or':_[_0xbe14('0x38')](_0x4f51f8,function(_0xb2b285){if(_0xb2b285[_0xbe14('0x3c')]!=='VIRTUAL'){var _0x51023a={};_0x51023a[_0xb2b285[_0xbe14('0x35')]]={'$like':'%'+_0x2d9c12[_0xbe14('0x3f')][_0xbe14('0x4a')]+'%'};return _0x51023a;}})});}_0x41652d=_[_0xbe14('0x49')]({},_0x41652d,_0x2d9c12['options']);var _0x28b6e3={'where':_0x41652d[_0xbe14('0x46')]};return db['VoiceContext'][_0xbe14('0x27')](_0x28b6e3)[_0xbe14('0x1c')](function(_0x2d6ee8){_0x539c41[_0xbe14('0x27')]=_0x2d6ee8;if(_0x2d9c12['query']['includeAll']){_0x41652d[_0xbe14('0x4b')]=[{'all':!![]}];}return db[_0xbe14('0x39')]['findAll'](_0x41652d);})['then'](function(_0xca8cdb){_0x539c41[_0xbe14('0x4c')]=_0xca8cdb;return _0x539c41;})[_0xbe14('0x1c')](respondWithFilteredResult(_0x2dfd5a,_0x41652d))[_0xbe14('0x4d')](handleError(_0x2dfd5a,null));};exports[_0xbe14('0x4e')]=function(_0xd04fd5,_0x10cd86){var _0x5a4068={'raw':![],'where':{'id':_0xd04fd5[_0xbe14('0x4f')]['id']}},_0xf32e93={};_0xf32e93[_0xbe14('0x3e')]=_[_0xbe14('0x40')](db[_0xbe14('0x39')]['rawAttributes']);_0xf32e93[_0xbe14('0x3f')]=_[_0xbe14('0x40')](_0xd04fd5[_0xbe14('0x3f')]);_0xf32e93[_0xbe14('0x48')]=_[_0xbe14('0x41')](_0xf32e93[_0xbe14('0x3e')],_0xf32e93['query']);_0x5a4068['attributes']=_[_0xbe14('0x41')](_0xf32e93[_0xbe14('0x3e')],qs[_0xbe14('0x43')](_0xd04fd5['query']['fields']));_0x5a4068[_0xbe14('0x42')]=_0x5a4068[_0xbe14('0x42')]['length']?_0x5a4068[_0xbe14('0x42')]:_0xf32e93[_0xbe14('0x3e')];if(_0xd04fd5['query'][_0xbe14('0x50')]){_0x5a4068['include']=[{'all':!![]}];}_0x5a4068=_[_0xbe14('0x49')]({},_0x5a4068,_0xd04fd5[_0xbe14('0x51')]);return db[_0xbe14('0x39')]['find'](_0x5a4068)[_0xbe14('0x1c')](handleEntityNotFound(_0x10cd86,null))[_0xbe14('0x1c')](respondWithResult(_0x10cd86,null))['catch'](handleError(_0x10cd86,null));};exports[_0xbe14('0x52')]=function(_0x42ca15,_0x2210cc,_0x20c48d){var _0x49322f;return db['VoiceContext'][_0xbe14('0x52')](_0x42ca15[_0xbe14('0x53')],{'raw':!![]})[_0xbe14('0x1c')](function(_0x243b9e){_0x49322f=_0x243b9e;return db[_0xbe14('0x39')][_0xbe14('0x54')]({'raw':!![]});})[_0xbe14('0x1c')](function(_0x56ab61){var _0x72c875=fs[_0xbe14('0x55')](path[_0xbe14('0x56')](config[_0xbe14('0x57')],_0xbe14('0x58')),_0xbe14('0x59'));var _0xd8f78f=ejs[_0xbe14('0x5a')](_0x72c875,{'contexts':_0x56ab61||[]});fs[_0xbe14('0x5b')](_0xbe14('0x5c'),_0xd8f78f);})[_0xbe14('0x1c')](function(){return respondWithRpcPromise('Reload','create',{'module':'chan_sip.so'});})[_0xbe14('0x1c')](function(){var _0x1bfcbf=_0x42ca15[_0xbe14('0x5d')][_0xbe14('0x5e')]({'plain':!![]});if(!_0x1bfcbf)throw new Error(_0xbe14('0x5f'));if(_0x1bfcbf[_0xbe14('0x60')]===_0xbe14('0x5d')){var _0x22bf69=_0x49322f[_0xbe14('0x5e')]({'plain':!![]});return db[_0xbe14('0x61')][_0xbe14('0x62')]({'where':{'name':_0xbe14('0x32'),'userProfileId':_0x1bfcbf[_0xbe14('0x63')]},'raw':!![]})[_0xbe14('0x1c')](function(_0x1c831a){if(_0x1c831a&&_0x1c831a[_0xbe14('0x64')]===0x0){return db[_0xbe14('0x65')][_0xbe14('0x52')]({'name':_0x22bf69[_0xbe14('0x35')],'resourceId':_0x22bf69['id'],'type':_0x1c831a[_0xbe14('0x35')],'sectionId':_0x1c831a['id']},{})['then'](function(){return _0x49322f;});}else{return _0x49322f;}})[_0xbe14('0x4d')](function(_0x9333d){logger[_0xbe14('0x22')](_0xbe14('0x66'),_0x9333d);throw _0x9333d;});}return _0x49322f;})[_0xbe14('0x1c')](respondWithResult(_0x2210cc,0xc9))[_0xbe14('0x4d')](handleError(_0x2210cc,null));};exports[_0xbe14('0x30')]=function(_0x310311,_0x23cb36,_0x100d43){var _0x5917d5;return db[_0xbe14('0x39')][_0xbe14('0x62')]({'where':{'id':_0x310311[_0xbe14('0x4f')]['id']}})[_0xbe14('0x1c')](handleEntityNotFound(_0x23cb36,null))[_0xbe14('0x1c')](saveUpdates(_0x310311['body'],null))[_0xbe14('0x1c')](function(_0x120077){if(_0x120077){_0x5917d5=_0x120077;return db[_0xbe14('0x39')][_0xbe14('0x54')]({'raw':!![]});}})[_0xbe14('0x1c')](function(_0x5ed9b3){var _0x48da19=fs[_0xbe14('0x55')](path[_0xbe14('0x56')](config[_0xbe14('0x57')],_0xbe14('0x58')),_0xbe14('0x59'));var _0xd9dd1c=ejs[_0xbe14('0x5a')](_0x48da19,{'contexts':_0x5ed9b3||[]});fs['writeFileSync'](_0xbe14('0x5c'),_0xd9dd1c);})[_0xbe14('0x1c')](function(){return respondWithRpcPromise(_0xbe14('0x67'),_0xbe14('0x30'),{'module':_0xbe14('0x68')});})[_0xbe14('0x1c')](function(){return _0x5917d5;})[_0xbe14('0x1c')](respondWithResult(_0x23cb36,null))['catch'](handleError(_0x23cb36,null));};exports['destroy']=function(_0x12941d,_0x3c2b58,_0x2d2643){var _0x2510a0;return db[_0xbe14('0x39')][_0xbe14('0x62')]({'where':{'id':_0x12941d[_0xbe14('0x4f')]['id']}})[_0xbe14('0x1c')](handleEntityNotFound(_0x3c2b58,null))['then'](removeEntity(_0x3c2b58,null))['then'](function(){return db[_0xbe14('0x39')][_0xbe14('0x54')]({'raw':!![]});})[_0xbe14('0x1c')](function(_0x57729f){var _0x76e91e=fs[_0xbe14('0x55')](path[_0xbe14('0x56')](config[_0xbe14('0x57')],_0xbe14('0x58')),_0xbe14('0x59'));var _0x12e23a=ejs['render'](_0x76e91e,{'contexts':_0x57729f});fs[_0xbe14('0x5b')](_0xbe14('0x5c'),_0x12e23a);return respondWithRpcPromise(_0xbe14('0x67'),_0xbe14('0x31'),{'module':_0xbe14('0x68')});})[_0xbe14('0x4d')](handleError(_0x3c2b58,null));}; \ No newline at end of file +var _0xe14b=['query','keys','intersection','attributes','fields','hasOwnProperty','sort','where','pick','filters','merge','filter','include','rows','catch','show','params','includeAll','options','create','body','findAll','readFileSync','join','root','server/files/templates/context.ejs','utf8','render','writeFileSync','/etc/asterisk/extensions_xcally_contexts.conf','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','Reload','chan_sip.so','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','jayson/promise','client','http','test','Sequelize','ValidationError','request','then','info','VoiceContext,\x20%s,\x20%s','request\x20sent','VoiceContext,\x20%s,\x20%s,\x20%s','stringify','error','code','message','sendStatus','status','count','offset','limit','set','Content-Range','json','apply','reject','save','update','destroy','Contexts','end','stack','name','send','index','map','VoiceContext','rawAttributes','fieldName','type','key','model'];(function(_0x3626ab,_0x46cf71){var _0x3d3f52=function(_0x3f7e88){while(--_0x3f7e88){_0x3626ab['push'](_0x3626ab['shift']());}};_0x3d3f52(++_0x46cf71);}(_0xe14b,0x93));var _0xbe14=function(_0x252df5,_0x4bdd0a){_0x252df5=_0x252df5-0x0;var _0x4800be=_0xe14b[_0x252df5];return _0x4800be;};'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'];var jayson=require(_0xbe14('0x15'));var client=jayson[_0xbe14('0x16')][_0xbe14('0x17')]({'port':0x232a});function checkPasswordPattern(_0x23a730,_0x2850cb,_0x16893f){if(_0x16893f){var _0xa2cf72=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0xa2cf72[_0xbe14('0x18')](_0x2850cb)){return _0x23a730;}else{throw new db[(_0xbe14('0x19'))][(_0xbe14('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 _0x23a730;}}function respondWithRpcPromise(_0x55b3a7,_0x3f58f5,_0x3dc4a9,_0xf4ac9){return new BPromise(function(_0x37ce4e,_0x4e8f34){var _0x21c789=_0xf4ac9||client;return _0x21c789[_0xbe14('0x1b')](_0x55b3a7,_0x3dc4a9)[_0xbe14('0x1c')](function(_0x123ede){logger[_0xbe14('0x1d')](_0xbe14('0x1e'),_0x3f58f5,_0xbe14('0x1f'));logger['debug'](_0xbe14('0x20'),_0x3f58f5,_0xbe14('0x1f'),JSON[_0xbe14('0x21')](_0x123ede));if(_0x123ede[_0xbe14('0x22')]){if(_0x123ede[_0xbe14('0x22')][_0xbe14('0x23')]===0x1f4){logger['error'](_0xbe14('0x1e'),_0x3f58f5,_0x123ede[_0xbe14('0x22')][_0xbe14('0x24')]);return _0x4e8f34(_0x123ede[_0xbe14('0x22')][_0xbe14('0x24')]);}logger['error'](_0xbe14('0x1e'),_0x3f58f5,_0x123ede['error'][_0xbe14('0x24')]);return _0x37ce4e(_0x123ede['error'][_0xbe14('0x24')]);}else{logger['info'](_0xbe14('0x1e'),_0x3f58f5,_0xbe14('0x1f'));_0x37ce4e(_0x123ede['result'][_0xbe14('0x24')]);}})['catch'](function(_0x4587a8){logger['error'](_0xbe14('0x1e'),_0x3f58f5,_0x4587a8);_0x4e8f34(_0x4587a8);});});}function respondWithStatusCode(_0x5fa043,_0x1ee9c1){_0x1ee9c1=_0x1ee9c1||0xcc;return function(_0x39cc81){if(_0x39cc81){return _0x5fa043[_0xbe14('0x25')](_0x1ee9c1);}return _0x5fa043[_0xbe14('0x26')](_0x1ee9c1)['end']();};}function respondWithResult(_0x1822e0,_0x1ba46a){_0x1ba46a=_0x1ba46a||0xc8;return function(_0x391556){if(_0x391556){return _0x1822e0[_0xbe14('0x26')](_0x1ba46a)['json'](_0x391556);}};}function respondWithFilteredResult(_0x16f884,_0x29fc64){return function(_0x59bf34){if(_0x59bf34){var _0x3c3613=_0x59bf34[_0xbe14('0x27')],_0x3b3e84=_0x29fc64[_0xbe14('0x28')],_0x1c7cc7=_0x29fc64[_0xbe14('0x28')]+_0x29fc64[_0xbe14('0x29')],_0x19252f;if(_0x1c7cc7>=_0x3c3613){_0x1c7cc7=_0x3c3613;_0x19252f=0xc8;}else{_0x19252f=0xce;}_0x16f884[_0xbe14('0x26')](_0x19252f);return _0x16f884[_0xbe14('0x2a')](_0xbe14('0x2b'),_0x3b3e84+'-'+_0x1c7cc7+'/'+_0x3c3613)[_0xbe14('0x2c')](_0x59bf34);}return null;};}function patchUpdates(_0x39dc0a){return function(_0x10ae36){try{jsonpatch[_0xbe14('0x2d')](_0x10ae36,_0x39dc0a,!![]);}catch(_0xe6feb2){return BPromise[_0xbe14('0x2e')](_0xe6feb2);}return _0x10ae36[_0xbe14('0x2f')]();};}function saveUpdates(_0x29e76a,_0x14e7c4){return function(_0x581e86){if(_0x581e86){return _0x581e86[_0xbe14('0x30')](_0x29e76a)['then'](function(_0x58f8de){return _0x58f8de;});}return null;};}function removeEntity(_0x46c2d1,_0x4c1e7e){return function(_0x243524){if(_0x243524){return _0x243524[_0xbe14('0x31')]()['then'](function(){var _0x50cb09=_0x243524['get']({'plain':!![]});var _0x412ad5=_0xbe14('0x32');return db['UserProfileResource'][_0xbe14('0x31')]({'where':{'type':_0x412ad5,'resourceId':_0x50cb09['id']}})[_0xbe14('0x1c')](function(){return _0x243524;});})[_0xbe14('0x1c')](function(){_0x46c2d1[_0xbe14('0x26')](0xcc)[_0xbe14('0x33')]();});}};}function handleEntityNotFound(_0x5ef1e5,_0x591a36){return function(_0x15a997){if(!_0x15a997){_0x5ef1e5['sendStatus'](0x194);}return _0x15a997;};}function handleError(_0x5dd7aa,_0x5c5e9f){_0x5c5e9f=_0x5c5e9f||0x1f4;return function(_0x163ef7){logger[_0xbe14('0x22')](_0x163ef7[_0xbe14('0x34')]);if(_0x163ef7[_0xbe14('0x35')]){delete _0x163ef7[_0xbe14('0x35')];}_0x5dd7aa[_0xbe14('0x26')](_0x5c5e9f)[_0xbe14('0x36')](_0x163ef7);};}exports[_0xbe14('0x37')]=function(_0x2d9c12,_0x2dfd5a){var _0x41652d={},_0x32c59d={},_0x539c41={'count':0x0,'rows':[]};var _0x4f51f8=_[_0xbe14('0x38')](db[_0xbe14('0x39')][_0xbe14('0x3a')],function(_0x520e09){return{'name':_0x520e09[_0xbe14('0x3b')],'type':_0x520e09[_0xbe14('0x3c')][_0xbe14('0x3d')]};});_0x32c59d[_0xbe14('0x3e')]=_[_0xbe14('0x38')](_0x4f51f8,_0xbe14('0x35'));_0x32c59d[_0xbe14('0x3f')]=_[_0xbe14('0x40')](_0x2d9c12[_0xbe14('0x3f')]);_0x32c59d['filters']=_[_0xbe14('0x41')](_0x32c59d[_0xbe14('0x3e')],_0x32c59d[_0xbe14('0x3f')]);_0x41652d[_0xbe14('0x42')]=_[_0xbe14('0x41')](_0x32c59d[_0xbe14('0x3e')],qs['fields'](_0x2d9c12[_0xbe14('0x3f')][_0xbe14('0x43')]));_0x41652d[_0xbe14('0x42')]=_0x41652d[_0xbe14('0x42')]['length']?_0x41652d['attributes']:_0x32c59d[_0xbe14('0x3e')];if(!_0x2d9c12[_0xbe14('0x3f')][_0xbe14('0x44')]('nolimit')){_0x41652d['limit']=qs[_0xbe14('0x29')](_0x2d9c12['query']['limit']);_0x41652d[_0xbe14('0x28')]=qs[_0xbe14('0x28')](_0x2d9c12[_0xbe14('0x3f')]['offset']);}_0x41652d['order']=qs['sort'](_0x2d9c12[_0xbe14('0x3f')][_0xbe14('0x45')]);_0x41652d[_0xbe14('0x46')]=qs['filters'](_[_0xbe14('0x47')](_0x2d9c12[_0xbe14('0x3f')],_0x32c59d[_0xbe14('0x48')]),_0x4f51f8);if(_0x2d9c12[_0xbe14('0x3f')]['filter']){_0x41652d['where']=_[_0xbe14('0x49')](_0x41652d[_0xbe14('0x46')],{'$or':_[_0xbe14('0x38')](_0x4f51f8,function(_0xb2b285){if(_0xb2b285[_0xbe14('0x3c')]!=='VIRTUAL'){var _0x51023a={};_0x51023a[_0xb2b285[_0xbe14('0x35')]]={'$like':'%'+_0x2d9c12[_0xbe14('0x3f')][_0xbe14('0x4a')]+'%'};return _0x51023a;}})});}_0x41652d=_[_0xbe14('0x49')]({},_0x41652d,_0x2d9c12['options']);var _0x28b6e3={'where':_0x41652d[_0xbe14('0x46')]};return db['VoiceContext'][_0xbe14('0x27')](_0x28b6e3)[_0xbe14('0x1c')](function(_0x2d6ee8){_0x539c41[_0xbe14('0x27')]=_0x2d6ee8;if(_0x2d9c12['query']['includeAll']){_0x41652d[_0xbe14('0x4b')]=[{'all':!![]}];}return db[_0xbe14('0x39')]['findAll'](_0x41652d);})['then'](function(_0xca8cdb){_0x539c41[_0xbe14('0x4c')]=_0xca8cdb;return _0x539c41;})[_0xbe14('0x1c')](respondWithFilteredResult(_0x2dfd5a,_0x41652d))[_0xbe14('0x4d')](handleError(_0x2dfd5a,null));};exports[_0xbe14('0x4e')]=function(_0xd04fd5,_0x10cd86){var _0x5a4068={'raw':![],'where':{'id':_0xd04fd5[_0xbe14('0x4f')]['id']}},_0xf32e93={};_0xf32e93[_0xbe14('0x3e')]=_[_0xbe14('0x40')](db[_0xbe14('0x39')]['rawAttributes']);_0xf32e93[_0xbe14('0x3f')]=_[_0xbe14('0x40')](_0xd04fd5[_0xbe14('0x3f')]);_0xf32e93[_0xbe14('0x48')]=_[_0xbe14('0x41')](_0xf32e93[_0xbe14('0x3e')],_0xf32e93['query']);_0x5a4068['attributes']=_[_0xbe14('0x41')](_0xf32e93[_0xbe14('0x3e')],qs[_0xbe14('0x43')](_0xd04fd5['query']['fields']));_0x5a4068[_0xbe14('0x42')]=_0x5a4068[_0xbe14('0x42')]['length']?_0x5a4068[_0xbe14('0x42')]:_0xf32e93[_0xbe14('0x3e')];if(_0xd04fd5['query'][_0xbe14('0x50')]){_0x5a4068['include']=[{'all':!![]}];}_0x5a4068=_[_0xbe14('0x49')]({},_0x5a4068,_0xd04fd5[_0xbe14('0x51')]);return db[_0xbe14('0x39')]['find'](_0x5a4068)[_0xbe14('0x1c')](handleEntityNotFound(_0x10cd86,null))[_0xbe14('0x1c')](respondWithResult(_0x10cd86,null))['catch'](handleError(_0x10cd86,null));};exports[_0xbe14('0x52')]=function(_0x42ca15,_0x2210cc,_0x20c48d){var _0x49322f;return db['VoiceContext'][_0xbe14('0x52')](_0x42ca15[_0xbe14('0x53')],{'raw':!![]})[_0xbe14('0x1c')](function(_0x243b9e){_0x49322f=_0x243b9e;return db[_0xbe14('0x39')][_0xbe14('0x54')]({'raw':!![]});})[_0xbe14('0x1c')](function(_0x56ab61){var _0x72c875=fs[_0xbe14('0x55')](path[_0xbe14('0x56')](config[_0xbe14('0x57')],_0xbe14('0x58')),_0xbe14('0x59'));var _0xd8f78f=ejs[_0xbe14('0x5a')](_0x72c875,{'contexts':_0x56ab61||[]});fs[_0xbe14('0x5b')](_0xbe14('0x5c'),_0xd8f78f);})[_0xbe14('0x1c')](function(){return respondWithRpcPromise('Reload','create',{'module':'chan_sip.so'});})[_0xbe14('0x1c')](function(){var _0x1bfcbf=_0x42ca15[_0xbe14('0x5d')][_0xbe14('0x5e')]({'plain':!![]});if(!_0x1bfcbf)throw new Error(_0xbe14('0x5f'));if(_0x1bfcbf[_0xbe14('0x60')]===_0xbe14('0x5d')){var _0x22bf69=_0x49322f[_0xbe14('0x5e')]({'plain':!![]});return db[_0xbe14('0x61')][_0xbe14('0x62')]({'where':{'name':_0xbe14('0x32'),'userProfileId':_0x1bfcbf[_0xbe14('0x63')]},'raw':!![]})[_0xbe14('0x1c')](function(_0x1c831a){if(_0x1c831a&&_0x1c831a[_0xbe14('0x64')]===0x0){return db[_0xbe14('0x65')][_0xbe14('0x52')]({'name':_0x22bf69[_0xbe14('0x35')],'resourceId':_0x22bf69['id'],'type':_0x1c831a[_0xbe14('0x35')],'sectionId':_0x1c831a['id']},{})['then'](function(){return _0x49322f;});}else{return _0x49322f;}})[_0xbe14('0x4d')](function(_0x9333d){logger[_0xbe14('0x22')](_0xbe14('0x66'),_0x9333d);throw _0x9333d;});}return _0x49322f;})[_0xbe14('0x1c')](respondWithResult(_0x2210cc,0xc9))[_0xbe14('0x4d')](handleError(_0x2210cc,null));};exports[_0xbe14('0x30')]=function(_0x310311,_0x23cb36,_0x100d43){var _0x5917d5;return db[_0xbe14('0x39')][_0xbe14('0x62')]({'where':{'id':_0x310311[_0xbe14('0x4f')]['id']}})[_0xbe14('0x1c')](handleEntityNotFound(_0x23cb36,null))[_0xbe14('0x1c')](saveUpdates(_0x310311['body'],null))[_0xbe14('0x1c')](function(_0x120077){if(_0x120077){_0x5917d5=_0x120077;return db[_0xbe14('0x39')][_0xbe14('0x54')]({'raw':!![]});}})[_0xbe14('0x1c')](function(_0x5ed9b3){var _0x48da19=fs[_0xbe14('0x55')](path[_0xbe14('0x56')](config[_0xbe14('0x57')],_0xbe14('0x58')),_0xbe14('0x59'));var _0xd9dd1c=ejs[_0xbe14('0x5a')](_0x48da19,{'contexts':_0x5ed9b3||[]});fs['writeFileSync'](_0xbe14('0x5c'),_0xd9dd1c);})[_0xbe14('0x1c')](function(){return respondWithRpcPromise(_0xbe14('0x67'),_0xbe14('0x30'),{'module':_0xbe14('0x68')});})[_0xbe14('0x1c')](function(){return _0x5917d5;})[_0xbe14('0x1c')](respondWithResult(_0x23cb36,null))['catch'](handleError(_0x23cb36,null));};exports['destroy']=function(_0x12941d,_0x3c2b58,_0x2d2643){var _0x2510a0;return db[_0xbe14('0x39')][_0xbe14('0x62')]({'where':{'id':_0x12941d[_0xbe14('0x4f')]['id']}})[_0xbe14('0x1c')](handleEntityNotFound(_0x3c2b58,null))['then'](removeEntity(_0x3c2b58,null))['then'](function(){return db[_0xbe14('0x39')][_0xbe14('0x54')]({'raw':!![]});})[_0xbe14('0x1c')](function(_0x57729f){var _0x76e91e=fs[_0xbe14('0x55')](path[_0xbe14('0x56')](config[_0xbe14('0x57')],_0xbe14('0x58')),_0xbe14('0x59'));var _0x12e23a=ejs['render'](_0x76e91e,{'contexts':_0x57729f});fs[_0xbe14('0x5b')](_0xbe14('0x5c'),_0x12e23a);return respondWithRpcPromise(_0xbe14('0x67'),_0xbe14('0x31'),{'module':_0xbe14('0x68')});})[_0xbe14('0x4d')](handleError(_0x3c2b58,null));}; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.model.js b/server/api/voiceContext/voiceContext.model.js index 67225c2..6290644 100644 --- a/server/api/voiceContext/voiceContext.model.js +++ b/server/api/voiceContext/voiceContext.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['../../config/environment','./voiceContext.attributes','exports','define','VoiceContext','lodash','util','../../config/logger','bluebird','path','rimraf'];(function(_0xb26123,_0x120616){var _0x49add1=function(_0x201621){while(--_0x201621){_0xb26123['push'](_0xb26123['shift']());}};_0x49add1(++_0x120616);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5c3c0b,_0x4ee35e){_0x5c3c0b=_0x5c3c0b-0x0;var _0x52ecd2=_0xa9e0[_0x5c3c0b];return _0x52ecd2;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var logger=require(_0x0a9e('0x2'))('api');var moment=require('moment');var BPromise=require(_0x0a9e('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0a9e('0x4'));var rimraf=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var attributes=require(_0x0a9e('0x7'));module[_0x0a9e('0x8')]=function(_0x57b080,_0x219af0){return _0x57b080[_0x0a9e('0x9')](_0x0a9e('0xa'),attributes,{'tableName':'voice_contexts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9957=['exports','define','VoiceContext','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','./voiceContext.attributes'];(function(_0x4e7d25,_0x58285f){var _0x526fe6=function(_0x4f0aec){while(--_0x4f0aec){_0x4e7d25['push'](_0x4e7d25['shift']());}};_0x526fe6(++_0x58285f);}(_0x9957,0x93));var _0x7995=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0x9957[_0x6131cd];return _0x47e916;};'use strict';var _=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var logger=require(_0x7995('0x2'))(_0x7995('0x3'));var moment=require('moment');var BPromise=require(_0x7995('0x4'));var rp=require(_0x7995('0x5'));var fs=require('fs');var path=require(_0x7995('0x6'));var rimraf=require(_0x7995('0x7'));var config=require('../../config/environment');var attributes=require(_0x7995('0x8'));module[_0x7995('0x9')]=function(_0x137b6b,_0x219534){return _0x137b6b[_0x7995('0xa')](_0x7995('0xb'),attributes,{'tableName':'voice_contexts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.rpc.js b/server/api/voiceContext/voiceContext.rpc.js index 13bdfe1..7f56109 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 _0xc686=['debug','error','message','VoiceContext,\x20%s,\x20%s','catch','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent'];(function(_0x40aaa4,_0x3b22f4){var _0x4e21e5=function(_0x35d2f3){while(--_0x35d2f3){_0x40aaa4['push'](_0x40aaa4['shift']());}};_0x4e21e5(++_0x3b22f4);}(_0xc686,0x148));var _0x6c68=function(_0x40ac5e,_0x2de228){_0x40ac5e=_0x40ac5e-0x0;var _0x2839d6=_0xc686[_0x40ac5e];return _0x2839d6;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x6c68('0x0'));var BPromise=require('bluebird');var rs=require(_0x6c68('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x6c68('0x2'))['db'];var utils=require(_0x6c68('0x3'));var logger=require(_0x6c68('0x4'))(_0x6c68('0x5'));var config=require(_0x6c68('0x6'));var jayson=require(_0x6c68('0x7'));var client=jayson[_0x6c68('0x8')][_0x6c68('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3dc035,_0x1e88b0,_0x12e935){return new BPromise(function(_0x394644,_0x5634c4){return client[_0x6c68('0xa')](_0x3dc035,_0x12e935)[_0x6c68('0xb')](function(_0x4ff2ce){logger[_0x6c68('0xc')]('VoiceContext,\x20%s,\x20%s',_0x1e88b0,_0x6c68('0xd'));logger[_0x6c68('0xe')]('VoiceContext,\x20%s,\x20%s,\x20%s',_0x1e88b0,_0x6c68('0xd'),JSON['stringify'](_0x4ff2ce));if(_0x4ff2ce[_0x6c68('0xf')]){if(_0x4ff2ce[_0x6c68('0xf')]['code']===0x1f4){logger[_0x6c68('0xf')]('VoiceContext,\x20%s,\x20%s',_0x1e88b0,_0x4ff2ce['error'][_0x6c68('0x10')]);return _0x5634c4(_0x4ff2ce['error'][_0x6c68('0x10')]);}logger[_0x6c68('0xf')](_0x6c68('0x11'),_0x1e88b0,_0x4ff2ce['error'][_0x6c68('0x10')]);return _0x394644(_0x4ff2ce[_0x6c68('0xf')][_0x6c68('0x10')]);}else{logger[_0x6c68('0xc')](_0x6c68('0x11'),_0x1e88b0,'request\x20sent');_0x394644(_0x4ff2ce['result']['message']);}})[_0x6c68('0x12')](function(_0x32cfd2){logger[_0x6c68('0xf')](_0x6c68('0x11'),_0x1e88b0,_0x32cfd2);_0x5634c4(_0x32cfd2);});});} \ No newline at end of file +var _0xf5ee=['util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','client','http','request','info','VoiceContext,\x20%s,\x20%s','request\x20sent','VoiceContext,\x20%s,\x20%s,\x20%s','error','code','message','result','catch'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0xf5ee,0xbe));var _0xef5e=function(_0x382544,_0x5cc6f8){_0x382544=_0x382544-0x0;var _0x23e476=_0xf5ee[_0x382544];return _0x23e476;};'use strict';var _=require('lodash');var util=require(_0xef5e('0x0'));var moment=require(_0xef5e('0x1'));var BPromise=require(_0xef5e('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xef5e('0x3'));var db=require(_0xef5e('0x4'))['db'];var utils=require(_0xef5e('0x5'));var logger=require('../../config/logger')(_0xef5e('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xef5e('0x7')][_0xef5e('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x3951b7,_0x9199f0,_0x34c345){return new BPromise(function(_0x55590b,_0x44e505){return client[_0xef5e('0x9')](_0x3951b7,_0x34c345)['then'](function(_0x4f05e2){logger[_0xef5e('0xa')](_0xef5e('0xb'),_0x9199f0,_0xef5e('0xc'));logger['debug'](_0xef5e('0xd'),_0x9199f0,'request\x20sent',JSON['stringify'](_0x4f05e2));if(_0x4f05e2[_0xef5e('0xe')]){if(_0x4f05e2[_0xef5e('0xe')][_0xef5e('0xf')]===0x1f4){logger[_0xef5e('0xe')]('VoiceContext,\x20%s,\x20%s',_0x9199f0,_0x4f05e2[_0xef5e('0xe')][_0xef5e('0x10')]);return _0x44e505(_0x4f05e2[_0xef5e('0xe')]['message']);}logger['error'](_0xef5e('0xb'),_0x9199f0,_0x4f05e2[_0xef5e('0xe')][_0xef5e('0x10')]);return _0x55590b(_0x4f05e2[_0xef5e('0xe')][_0xef5e('0x10')]);}else{logger[_0xef5e('0xa')]('VoiceContext,\x20%s,\x20%s',_0x9199f0,_0xef5e('0xc'));_0x55590b(_0x4f05e2[_0xef5e('0x11')][_0xef5e('0x10')]);}})[_0xef5e('0x12')](function(_0x126059){logger[_0xef5e('0xe')](_0xef5e('0xb'),_0x9199f0,_0x126059);_0x44e505(_0x126059);});});} \ No newline at end of file diff --git a/server/api/voiceDialReport/index.js b/server/api/voiceDialReport/index.js index 6cacfbf..901ad35 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 _0xcb92=['show','post','create','put','destroy','exports','multer','util','connect-timeout','express','Router','../../config/environment','./voiceDialReport.controller','get','isAuthenticated','index','/describe','describe','/:id'];(function(_0x5f1cf7,_0x47d9a9){var _0x2ab77b=function(_0x3b8a33){while(--_0x3b8a33){_0x5f1cf7['push'](_0x5f1cf7['shift']());}};_0x2ab77b(++_0x47d9a9);}(_0xcb92,0x1a8));var _0x2cb9=function(_0x184060,_0x2c60bd){_0x184060=_0x184060-0x0;var _0x552579=_0xcb92[_0x184060];return _0x552579;};'use strict';var multer=require(_0x2cb9('0x0'));var util=require(_0x2cb9('0x1'));var path=require('path');var timeout=require(_0x2cb9('0x2'));var express=require(_0x2cb9('0x3'));var router=express[_0x2cb9('0x4')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x2cb9('0x5'));var controller=require(_0x2cb9('0x6'));router[_0x2cb9('0x7')]('/',auth[_0x2cb9('0x8')](),controller[_0x2cb9('0x9')]);router[_0x2cb9('0x7')](_0x2cb9('0xa'),auth[_0x2cb9('0x8')](),controller[_0x2cb9('0xb')]);router[_0x2cb9('0x7')](_0x2cb9('0xc'),auth[_0x2cb9('0x8')](),controller[_0x2cb9('0xd')]);router[_0x2cb9('0xe')]('/',auth[_0x2cb9('0x8')](),controller[_0x2cb9('0xf')]);router[_0x2cb9('0x10')]('/:id',auth[_0x2cb9('0x8')](),controller['update']);router['delete'](_0x2cb9('0xc'),auth[_0x2cb9('0x8')](),controller[_0x2cb9('0x11')]);module[_0x2cb9('0x12')]=router; \ No newline at end of file +var _0xf545=['path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceDialReport.controller','get','isAuthenticated','index','/:id','show','post','create','put','update','delete','multer'];(function(_0x269fab,_0xd76e80){var _0x21982b=function(_0x572ae6){while(--_0x572ae6){_0x269fab['push'](_0x269fab['shift']());}};_0x21982b(++_0xd76e80);}(_0xf545,0x1af));var _0x5f54=function(_0x1879a4,_0x581a4a){_0x1879a4=_0x1879a4-0x0;var _0x38e837=_0xf545[_0x1879a4];return _0x38e837;};'use strict';var multer=require(_0x5f54('0x0'));var util=require('util');var path=require(_0x5f54('0x1'));var timeout=require('connect-timeout');var express=require(_0x5f54('0x2'));var router=express[_0x5f54('0x3')]();var auth=require(_0x5f54('0x4'));var interaction=require(_0x5f54('0x5'));var config=require(_0x5f54('0x6'));var controller=require(_0x5f54('0x7'));router[_0x5f54('0x8')]('/',auth[_0x5f54('0x9')](),controller[_0x5f54('0xa')]);router['get']('/describe',auth[_0x5f54('0x9')](),controller['describe']);router[_0x5f54('0x8')](_0x5f54('0xb'),auth[_0x5f54('0x9')](),controller[_0x5f54('0xc')]);router[_0x5f54('0xd')]('/',auth[_0x5f54('0x9')](),controller[_0x5f54('0xe')]);router[_0x5f54('0xf')](_0x5f54('0xb'),auth[_0x5f54('0x9')](),controller[_0x5f54('0x10')]);router[_0x5f54('0x11')]('/:id',auth[_0x5f54('0x9')](),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 334373f..710d310 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 _0x961b=['sequelize','STRING','INTEGER','DATE'];(function(_0x5cd44e,_0x259986){var _0x2f60a0=function(_0x36c6d5){while(--_0x36c6d5){_0x5cd44e['push'](_0x5cd44e['shift']());}};_0x2f60a0(++_0x259986);}(_0x961b,0xa0));var _0xb961=function(_0x468b0f,_0x408566){_0x468b0f=_0x468b0f-0x0;var _0x3e74d9=_0x961b[_0x468b0f];return _0x3e74d9;};'use strict';var Sequelize=require(_0xb961('0x0'));module['exports']={'privilege':{'type':Sequelize[_0xb961('0x1')]},'channel':{'type':Sequelize[_0xb961('0x1')]},'channelstate':{'type':Sequelize[_0xb961('0x2')]},'channelstatedesc':{'type':Sequelize[_0xb961('0x1')]},'calleridnum':{'type':Sequelize[_0xb961('0x1')]},'calleridname':{'type':Sequelize['STRING']},'connectedlinenum':{'type':Sequelize['STRING']},'connectedlinename':{'type':Sequelize[_0xb961('0x1')]},'language':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0xb961('0x1')]},'context':{'type':Sequelize[_0xb961('0x1')]},'exten':{'type':Sequelize[_0xb961('0x1')]},'priority':{'type':Sequelize[_0xb961('0x2')]},'uniqueid':{'type':Sequelize[_0xb961('0x1')]},'linkedid':{'type':Sequelize[_0xb961('0x1')]},'destchannel':{'type':Sequelize[_0xb961('0x1')]},'destchannelstate':{'type':Sequelize['INTEGER']},'destchannelstatedesc':{'type':Sequelize[_0xb961('0x1')]},'destcalleridnum':{'type':Sequelize[_0xb961('0x1')]},'destcalleridname':{'type':Sequelize[_0xb961('0x1')]},'destconnectedlinenum':{'type':Sequelize[_0xb961('0x1')]},'destconnectedlinename':{'type':Sequelize[_0xb961('0x1')]},'destlanguage':{'type':Sequelize['STRING']},'destaccountcode':{'type':Sequelize['STRING']},'destcontext':{'type':Sequelize['STRING']},'destexten':{'type':Sequelize['STRING']},'destpriority':{'type':Sequelize['INTEGER']},'destuniqueid':{'type':Sequelize['STRING']},'destlinkedid':{'type':Sequelize[_0xb961('0x1')]},'dialstring':{'type':Sequelize['STRING']},'dialstatus':{'type':Sequelize[_0xb961('0x1')]},'starttime':{'type':Sequelize['DATE']},'answertime':{'type':Sequelize[_0xb961('0x3')]},'endtime':{'type':Sequelize[_0xb961('0x3')]},'lastevent':{'type':Sequelize[_0xb961('0x1')],'comment':'called,connect,complete'},'routeId':{'type':Sequelize[_0xb961('0x2')]},'duration':{'type':Sequelize[_0xb961('0x2')]},'holdtime':{'type':Sequelize['INTEGER']},'billableseconds':{'type':Sequelize['INTEGER']}}; \ No newline at end of file +var _0x479a=['sequelize','STRING','INTEGER','DATE','called,connect,complete'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x479a,0xb4));var _0xa479=function(_0x2b650f,_0x518dd9){_0x2b650f=_0x2b650f-0x0;var _0x341c51=_0x479a[_0x2b650f];return _0x341c51;};'use strict';var Sequelize=require(_0xa479('0x0'));module['exports']={'privilege':{'type':Sequelize[_0xa479('0x1')]},'channel':{'type':Sequelize[_0xa479('0x1')]},'channelstate':{'type':Sequelize[_0xa479('0x2')]},'channelstatedesc':{'type':Sequelize[_0xa479('0x1')]},'calleridnum':{'type':Sequelize[_0xa479('0x1')]},'calleridname':{'type':Sequelize['STRING']},'connectedlinenum':{'type':Sequelize[_0xa479('0x1')]},'connectedlinename':{'type':Sequelize['STRING']},'language':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0xa479('0x1')]},'context':{'type':Sequelize[_0xa479('0x1')]},'exten':{'type':Sequelize[_0xa479('0x1')]},'priority':{'type':Sequelize[_0xa479('0x2')]},'uniqueid':{'type':Sequelize['STRING']},'linkedid':{'type':Sequelize[_0xa479('0x1')]},'destchannel':{'type':Sequelize[_0xa479('0x1')]},'destchannelstate':{'type':Sequelize[_0xa479('0x2')]},'destchannelstatedesc':{'type':Sequelize['STRING']},'destcalleridnum':{'type':Sequelize[_0xa479('0x1')]},'destcalleridname':{'type':Sequelize[_0xa479('0x1')]},'destconnectedlinenum':{'type':Sequelize[_0xa479('0x1')]},'destconnectedlinename':{'type':Sequelize[_0xa479('0x1')]},'destlanguage':{'type':Sequelize[_0xa479('0x1')]},'destaccountcode':{'type':Sequelize[_0xa479('0x1')]},'destcontext':{'type':Sequelize[_0xa479('0x1')]},'destexten':{'type':Sequelize[_0xa479('0x1')]},'destpriority':{'type':Sequelize[_0xa479('0x2')]},'destuniqueid':{'type':Sequelize[_0xa479('0x1')]},'destlinkedid':{'type':Sequelize[_0xa479('0x1')]},'dialstring':{'type':Sequelize[_0xa479('0x1')]},'dialstatus':{'type':Sequelize[_0xa479('0x1')]},'starttime':{'type':Sequelize[_0xa479('0x3')]},'answertime':{'type':Sequelize[_0xa479('0x3')]},'endtime':{'type':Sequelize[_0xa479('0x3')]},'lastevent':{'type':Sequelize[_0xa479('0x1')],'comment':_0xa479('0x4')},'routeId':{'type':Sequelize[_0xa479('0x2')]},'duration':{'type':Sequelize[_0xa479('0x2')]},'holdtime':{'type':Sequelize[_0xa479('0x2')]},'billableseconds':{'type':Sequelize[_0xa479('0x2')]}}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.controller.js b/server/api/voiceDialReport/voiceDialReport.controller.js index eaef50f..7e8e5a5 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 _0xb26e=['bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status','json','count','offset','Content-Range','apply','reject','update','then','destroy','error','stack','name','send','index','VoiceDialReport','rawAttributes','fieldName','key','model','map','query','keys','filters','intersection','attributes','fields','length','nolimit','limit','order','where','pick','merge','type','filter','options','includeAll','include','findAll','rows','show','params','create','body','catch','find','describe','html-pdf','fast-json-patch','request-promise'];(function(_0x25451a,_0x11c823){var _0x20a8aa=function(_0xc99869){while(--_0xc99869){_0x25451a['push'](_0x25451a['shift']());}};_0x20a8aa(++_0x11c823);}(_0xb26e,0x11d));var _0xeb26=function(_0x5ccf1,_0x28a9ed){_0x5ccf1=_0x5ccf1-0x0;var _0x2d6b4d=_0xb26e[_0x5ccf1];return _0x2d6b4d;};'use strict';var pdf=require(_0xeb26('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xeb26('0x1'));var rp=require(_0xeb26('0x2'));var moment=require('moment');var BPromise=require(_0xeb26('0x3'));var Mustache=require(_0xeb26('0x4'));var util=require(_0xeb26('0x5'));var path=require(_0xeb26('0x6'));var sox=require(_0xeb26('0x7'));var csv=require(_0xeb26('0x8'));var ejs=require(_0xeb26('0x9'));var fs=require('fs');var _=require(_0xeb26('0xa'));var squel=require(_0xeb26('0xb'));var crypto=require(_0xeb26('0xc'));var jsforce=require(_0xeb26('0xd'));var deskjs=require(_0xeb26('0xe'));var toCsv=require(_0xeb26('0x8'));var querystring=require('querystring');var Papa=require(_0xeb26('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xeb26('0x10'));var as=require(_0xeb26('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xeb26('0x12'))('api');var utils=require(_0xeb26('0x13'));var config=require(_0xeb26('0x14'));var db=require(_0xeb26('0x15'))['db'];function respondWithStatusCode(_0xff52af,_0x4540da){_0x4540da=_0x4540da||0xcc;return function(_0x3053a5){if(_0x3053a5){return _0xff52af[_0xeb26('0x16')](_0x4540da);}return _0xff52af['status'](_0x4540da)[_0xeb26('0x17')]();};}function respondWithResult(_0xf791fe,_0x4c7112){_0x4c7112=_0x4c7112||0xc8;return function(_0x3d8643){if(_0x3d8643){return _0xf791fe[_0xeb26('0x18')](_0x4c7112)[_0xeb26('0x19')](_0x3d8643);}};}function respondWithFilteredResult(_0x1e5bea,_0x54740f){return function(_0x17e9d2){if(_0x17e9d2){var _0x1a07ac=_0x17e9d2[_0xeb26('0x1a')],_0x76e697=_0x54740f[_0xeb26('0x1b')],_0x1c0a56=_0x54740f[_0xeb26('0x1b')]+_0x54740f['limit'],_0x473b97;if(_0x1c0a56>=_0x1a07ac){_0x1c0a56=_0x1a07ac;_0x473b97=0xc8;}else{_0x473b97=0xce;}_0x1e5bea[_0xeb26('0x18')](_0x473b97);return _0x1e5bea['set'](_0xeb26('0x1c'),_0x76e697+'-'+_0x1c0a56+'/'+_0x1a07ac)[_0xeb26('0x19')](_0x17e9d2);}return null;};}function patchUpdates(_0x703d48){return function(_0x48e056){try{jsonpatch[_0xeb26('0x1d')](_0x48e056,_0x703d48,!![]);}catch(_0xe15415){return BPromise[_0xeb26('0x1e')](_0xe15415);}return _0x48e056['save']();};}function saveUpdates(_0x1451b5,_0x413108){return function(_0x32dad3){if(_0x32dad3){return _0x32dad3[_0xeb26('0x1f')](_0x1451b5)[_0xeb26('0x20')](function(_0x3a042e){return _0x3a042e;});}return null;};}function removeEntity(_0x2e3f7b,_0x20392f){return function(_0x2dc7ee){if(_0x2dc7ee){return _0x2dc7ee[_0xeb26('0x21')]()[_0xeb26('0x20')](function(){_0x2e3f7b[_0xeb26('0x18')](0xcc)[_0xeb26('0x17')]();});}};}function handleEntityNotFound(_0x40bce7,_0xde4668){return function(_0xcf9673){if(!_0xcf9673){_0x40bce7['sendStatus'](0x194);}return _0xcf9673;};}function handleError(_0x25384d,_0x36ae32){_0x36ae32=_0x36ae32||0x1f4;return function(_0x4c8de2){logger[_0xeb26('0x22')](_0x4c8de2[_0xeb26('0x23')]);if(_0x4c8de2[_0xeb26('0x24')]){delete _0x4c8de2['name'];}_0x25384d[_0xeb26('0x18')](_0x36ae32)[_0xeb26('0x25')](_0x4c8de2);};}exports[_0xeb26('0x26')]=function(_0x2e3bc2,_0x40dc54){var _0x3e3785={},_0x2b2963={},_0x596350={'count':0x0,'rows':[]};var _0x34bfa9=_['map'](db[_0xeb26('0x27')][_0xeb26('0x28')],function(_0x84d448){return{'name':_0x84d448[_0xeb26('0x29')],'type':_0x84d448['type'][_0xeb26('0x2a')]};});_0x2b2963[_0xeb26('0x2b')]=_[_0xeb26('0x2c')](_0x34bfa9,_0xeb26('0x24'));_0x2b2963[_0xeb26('0x2d')]=_[_0xeb26('0x2e')](_0x2e3bc2[_0xeb26('0x2d')]);_0x2b2963[_0xeb26('0x2f')]=_[_0xeb26('0x30')](_0x2b2963[_0xeb26('0x2b')],_0x2b2963[_0xeb26('0x2d')]);_0x3e3785[_0xeb26('0x31')]=_[_0xeb26('0x30')](_0x2b2963[_0xeb26('0x2b')],qs['fields'](_0x2e3bc2[_0xeb26('0x2d')][_0xeb26('0x32')]));_0x3e3785[_0xeb26('0x31')]=_0x3e3785[_0xeb26('0x31')][_0xeb26('0x33')]?_0x3e3785[_0xeb26('0x31')]:_0x2b2963[_0xeb26('0x2b')];if(!_0x2e3bc2[_0xeb26('0x2d')]['hasOwnProperty'](_0xeb26('0x34'))){_0x3e3785['limit']=qs[_0xeb26('0x35')](_0x2e3bc2[_0xeb26('0x2d')][_0xeb26('0x35')]);_0x3e3785['offset']=qs['offset'](_0x2e3bc2[_0xeb26('0x2d')]['offset']);}_0x3e3785[_0xeb26('0x36')]=qs['sort'](_0x2e3bc2['query']['sort']);_0x3e3785[_0xeb26('0x37')]=qs[_0xeb26('0x2f')](_[_0xeb26('0x38')](_0x2e3bc2[_0xeb26('0x2d')],_0x2b2963[_0xeb26('0x2f')]),_0x34bfa9);if(_0x2e3bc2[_0xeb26('0x2d')]['filter']){_0x3e3785[_0xeb26('0x37')]=_[_0xeb26('0x39')](_0x3e3785['where'],{'$or':_[_0xeb26('0x2c')](_0x34bfa9,function(_0x5b6874){if(_0x5b6874[_0xeb26('0x3a')]!=='VIRTUAL'){var _0x1cc068={};_0x1cc068[_0x5b6874[_0xeb26('0x24')]]={'$like':'%'+_0x2e3bc2[_0xeb26('0x2d')][_0xeb26('0x3b')]+'%'};return _0x1cc068;}})});}_0x3e3785=_[_0xeb26('0x39')]({},_0x3e3785,_0x2e3bc2[_0xeb26('0x3c')]);var _0xfa5d7c={'where':_0x3e3785[_0xeb26('0x37')]};return db[_0xeb26('0x27')][_0xeb26('0x1a')](_0xfa5d7c)[_0xeb26('0x20')](function(_0x18ed64){_0x596350[_0xeb26('0x1a')]=_0x18ed64;if(_0x2e3bc2['query'][_0xeb26('0x3d')]){_0x3e3785[_0xeb26('0x3e')]=[{'all':!![]}];}return db['VoiceDialReport'][_0xeb26('0x3f')](_0x3e3785);})[_0xeb26('0x20')](function(_0x355bbe){_0x596350[_0xeb26('0x40')]=_0x355bbe;return _0x596350;})['then'](respondWithFilteredResult(_0x40dc54,_0x3e3785))['catch'](handleError(_0x40dc54,null));};exports[_0xeb26('0x41')]=function(_0x94698a,_0x39effe){var _0x8017fb={'raw':!![],'where':{'id':_0x94698a[_0xeb26('0x42')]['id']}},_0x4db7d5={};_0x4db7d5[_0xeb26('0x2b')]=_[_0xeb26('0x2e')](db[_0xeb26('0x27')][_0xeb26('0x28')]);_0x4db7d5[_0xeb26('0x2d')]=_[_0xeb26('0x2e')](_0x94698a[_0xeb26('0x2d')]);_0x4db7d5[_0xeb26('0x2f')]=_[_0xeb26('0x30')](_0x4db7d5['model'],_0x4db7d5['query']);_0x8017fb['attributes']=_[_0xeb26('0x30')](_0x4db7d5[_0xeb26('0x2b')],qs['fields'](_0x94698a['query'][_0xeb26('0x32')]));_0x8017fb[_0xeb26('0x31')]=_0x8017fb[_0xeb26('0x31')]['length']?_0x8017fb[_0xeb26('0x31')]:_0x4db7d5['model'];if(_0x94698a['query'][_0xeb26('0x3d')]){_0x8017fb[_0xeb26('0x3e')]=[{'all':!![]}];}_0x8017fb=_[_0xeb26('0x39')]({},_0x8017fb,_0x94698a[_0xeb26('0x3c')]);return db[_0xeb26('0x27')]['find'](_0x8017fb)[_0xeb26('0x20')](handleEntityNotFound(_0x39effe,null))[_0xeb26('0x20')](respondWithResult(_0x39effe,null))['catch'](handleError(_0x39effe,null));};exports['create']=function(_0x2c946a,_0x37827a){return db[_0xeb26('0x27')][_0xeb26('0x43')](_0x2c946a[_0xeb26('0x44')],{})[_0xeb26('0x20')](respondWithResult(_0x37827a,0xc9))[_0xeb26('0x45')](handleError(_0x37827a,null));};exports[_0xeb26('0x1f')]=function(_0xaee67a,_0x1a1d38){if(_0xaee67a[_0xeb26('0x44')]['id']){delete _0xaee67a[_0xeb26('0x44')]['id'];}return db[_0xeb26('0x27')][_0xeb26('0x46')]({'where':{'id':_0xaee67a[_0xeb26('0x42')]['id']}})[_0xeb26('0x20')](handleEntityNotFound(_0x1a1d38,null))[_0xeb26('0x20')](saveUpdates(_0xaee67a[_0xeb26('0x44')],null))[_0xeb26('0x20')](respondWithResult(_0x1a1d38,null))['catch'](handleError(_0x1a1d38,null));};exports[_0xeb26('0x21')]=function(_0x3e1979,_0x562bc5){return db[_0xeb26('0x27')][_0xeb26('0x46')]({'where':{'id':_0x3e1979[_0xeb26('0x42')]['id']}})[_0xeb26('0x20')](handleEntityNotFound(_0x562bc5,null))[_0xeb26('0x20')](removeEntity(_0x562bc5,null))[_0xeb26('0x45')](handleError(_0x562bc5,null));};exports[_0xeb26('0x47')]=function(_0x1a2bf0,_0x12152b){return db['VoiceDialReport'][_0xeb26('0x47')]()[_0xeb26('0x20')](respondWithResult(_0x12152b,null))[_0xeb26('0x45')](handleError(_0x12152b,null));}; \ No newline at end of file +var _0xa639=['rawAttributes','type','model','map','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','merge','VIRTUAL','options','then','includeAll','include','findAll','catch','show','params','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','sox','to-csv','lodash','squel','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','sendStatus','status','json','count','offset','set','Content-Range','apply','reject','save','update','destroy','end','error','stack','name','send','index','VoiceDialReport'];(function(_0x1ee0a1,_0x51058e){var _0x1d2d5b=function(_0x35cfb5){while(--_0x35cfb5){_0x1ee0a1['push'](_0x1ee0a1['shift']());}};_0x1d2d5b(++_0x51058e);}(_0xa639,0x140));var _0x9a63=function(_0x2f4d54,_0x1cb759){_0x2f4d54=_0x2f4d54-0x0;var _0x21c76d=_0xa639[_0x2f4d54];return _0x21c76d;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x9a63('0x0'));var rimraf=require(_0x9a63('0x1'));var zipdir=require(_0x9a63('0x2'));var jsonpatch=require(_0x9a63('0x3'));var rp=require(_0x9a63('0x4'));var moment=require('moment');var BPromise=require(_0x9a63('0x5'));var Mustache=require('mustache');var util=require(_0x9a63('0x6'));var path=require('path');var sox=require(_0x9a63('0x7'));var csv=require(_0x9a63('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x9a63('0x9'));var squel=require(_0x9a63('0xa'));var crypto=require('crypto');var jsforce=require(_0x9a63('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x9a63('0x8'));var querystring=require(_0x9a63('0xc'));var Papa=require(_0x9a63('0xd'));var Redis=require(_0x9a63('0xe'));var authService=require(_0x9a63('0xf'));var qs=require(_0x9a63('0x10'));var as=require(_0x9a63('0x11'));var hardwareService=require(_0x9a63('0x12'));var logger=require('../../config/logger')(_0x9a63('0x13'));var utils=require('../../config/utils');var config=require(_0x9a63('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4a4a86,_0x216567){_0x216567=_0x216567||0xcc;return function(_0x4050ff){if(_0x4050ff){return _0x4a4a86[_0x9a63('0x15')](_0x216567);}return _0x4a4a86[_0x9a63('0x16')](_0x216567)['end']();};}function respondWithResult(_0x2b8b2f,_0x116786){_0x116786=_0x116786||0xc8;return function(_0x486a5b){if(_0x486a5b){return _0x2b8b2f[_0x9a63('0x16')](_0x116786)[_0x9a63('0x17')](_0x486a5b);}};}function respondWithFilteredResult(_0x285929,_0x1c40ac){return function(_0x16f835){if(_0x16f835){var _0x19af35=_0x16f835[_0x9a63('0x18')],_0x2479e7=_0x1c40ac[_0x9a63('0x19')],_0x3947da=_0x1c40ac[_0x9a63('0x19')]+_0x1c40ac['limit'],_0x1b97ad;if(_0x3947da>=_0x19af35){_0x3947da=_0x19af35;_0x1b97ad=0xc8;}else{_0x1b97ad=0xce;}_0x285929[_0x9a63('0x16')](_0x1b97ad);return _0x285929[_0x9a63('0x1a')](_0x9a63('0x1b'),_0x2479e7+'-'+_0x3947da+'/'+_0x19af35)[_0x9a63('0x17')](_0x16f835);}return null;};}function patchUpdates(_0x1fea01){return function(_0x16d112){try{jsonpatch[_0x9a63('0x1c')](_0x16d112,_0x1fea01,!![]);}catch(_0x58edf6){return BPromise[_0x9a63('0x1d')](_0x58edf6);}return _0x16d112[_0x9a63('0x1e')]();};}function saveUpdates(_0xd84360,_0xf31ed4){return function(_0x3b8459){if(_0x3b8459){return _0x3b8459[_0x9a63('0x1f')](_0xd84360)['then'](function(_0x1ec0cb){return _0x1ec0cb;});}return null;};}function removeEntity(_0x3f170f,_0x1dbf11){return function(_0x54226c){if(_0x54226c){return _0x54226c[_0x9a63('0x20')]()['then'](function(){_0x3f170f[_0x9a63('0x16')](0xcc)[_0x9a63('0x21')]();});}};}function handleEntityNotFound(_0xb8bd4a,_0x17aabc){return function(_0x4c7a6a){if(!_0x4c7a6a){_0xb8bd4a['sendStatus'](0x194);}return _0x4c7a6a;};}function handleError(_0x32576e,_0x4f8e6c){_0x4f8e6c=_0x4f8e6c||0x1f4;return function(_0x50701d){logger[_0x9a63('0x22')](_0x50701d[_0x9a63('0x23')]);if(_0x50701d['name']){delete _0x50701d[_0x9a63('0x24')];}_0x32576e['status'](_0x4f8e6c)[_0x9a63('0x25')](_0x50701d);};}exports[_0x9a63('0x26')]=function(_0x25c997,_0x155fe4){var _0xd67322={},_0x4d010a={},_0x21ecc9={'count':0x0,'rows':[]};var _0x2d9306=_['map'](db[_0x9a63('0x27')][_0x9a63('0x28')],function(_0x44a1b2){return{'name':_0x44a1b2['fieldName'],'type':_0x44a1b2[_0x9a63('0x29')]['key']};});_0x4d010a[_0x9a63('0x2a')]=_[_0x9a63('0x2b')](_0x2d9306,_0x9a63('0x24'));_0x4d010a[_0x9a63('0x2c')]=_[_0x9a63('0x2d')](_0x25c997[_0x9a63('0x2c')]);_0x4d010a[_0x9a63('0x2e')]=_[_0x9a63('0x2f')](_0x4d010a[_0x9a63('0x2a')],_0x4d010a[_0x9a63('0x2c')]);_0xd67322['attributes']=_[_0x9a63('0x2f')](_0x4d010a['model'],qs[_0x9a63('0x30')](_0x25c997[_0x9a63('0x2c')][_0x9a63('0x30')]));_0xd67322[_0x9a63('0x31')]=_0xd67322[_0x9a63('0x31')][_0x9a63('0x32')]?_0xd67322[_0x9a63('0x31')]:_0x4d010a[_0x9a63('0x2a')];if(!_0x25c997[_0x9a63('0x2c')][_0x9a63('0x33')](_0x9a63('0x34'))){_0xd67322[_0x9a63('0x35')]=qs[_0x9a63('0x35')](_0x25c997[_0x9a63('0x2c')]['limit']);_0xd67322[_0x9a63('0x19')]=qs[_0x9a63('0x19')](_0x25c997[_0x9a63('0x2c')][_0x9a63('0x19')]);}_0xd67322[_0x9a63('0x36')]=qs[_0x9a63('0x37')](_0x25c997[_0x9a63('0x2c')][_0x9a63('0x37')]);_0xd67322[_0x9a63('0x38')]=qs[_0x9a63('0x2e')](_[_0x9a63('0x39')](_0x25c997[_0x9a63('0x2c')],_0x4d010a[_0x9a63('0x2e')]),_0x2d9306);if(_0x25c997['query']['filter']){_0xd67322[_0x9a63('0x38')]=_[_0x9a63('0x3a')](_0xd67322['where'],{'$or':_[_0x9a63('0x2b')](_0x2d9306,function(_0x48e3ad){if(_0x48e3ad[_0x9a63('0x29')]!==_0x9a63('0x3b')){var _0x4cf384={};_0x4cf384[_0x48e3ad[_0x9a63('0x24')]]={'$like':'%'+_0x25c997[_0x9a63('0x2c')]['filter']+'%'};return _0x4cf384;}})});}_0xd67322=_[_0x9a63('0x3a')]({},_0xd67322,_0x25c997[_0x9a63('0x3c')]);var _0x4051a2={'where':_0xd67322[_0x9a63('0x38')]};return db['VoiceDialReport']['count'](_0x4051a2)[_0x9a63('0x3d')](function(_0x3bca41){_0x21ecc9[_0x9a63('0x18')]=_0x3bca41;if(_0x25c997[_0x9a63('0x2c')][_0x9a63('0x3e')]){_0xd67322[_0x9a63('0x3f')]=[{'all':!![]}];}return db[_0x9a63('0x27')][_0x9a63('0x40')](_0xd67322);})['then'](function(_0x279cda){_0x21ecc9['rows']=_0x279cda;return _0x21ecc9;})['then'](respondWithFilteredResult(_0x155fe4,_0xd67322))[_0x9a63('0x41')](handleError(_0x155fe4,null));};exports[_0x9a63('0x42')]=function(_0x33032f,_0x450060){var _0x403364={'raw':!![],'where':{'id':_0x33032f[_0x9a63('0x43')]['id']}},_0x462a0e={};_0x462a0e[_0x9a63('0x2a')]=_[_0x9a63('0x2d')](db['VoiceDialReport'][_0x9a63('0x28')]);_0x462a0e[_0x9a63('0x2c')]=_[_0x9a63('0x2d')](_0x33032f['query']);_0x462a0e[_0x9a63('0x2e')]=_[_0x9a63('0x2f')](_0x462a0e[_0x9a63('0x2a')],_0x462a0e['query']);_0x403364[_0x9a63('0x31')]=_[_0x9a63('0x2f')](_0x462a0e[_0x9a63('0x2a')],qs[_0x9a63('0x30')](_0x33032f[_0x9a63('0x2c')][_0x9a63('0x30')]));_0x403364[_0x9a63('0x31')]=_0x403364[_0x9a63('0x31')][_0x9a63('0x32')]?_0x403364[_0x9a63('0x31')]:_0x462a0e[_0x9a63('0x2a')];if(_0x33032f[_0x9a63('0x2c')][_0x9a63('0x3e')]){_0x403364[_0x9a63('0x3f')]=[{'all':!![]}];}_0x403364=_[_0x9a63('0x3a')]({},_0x403364,_0x33032f[_0x9a63('0x3c')]);return db[_0x9a63('0x27')][_0x9a63('0x44')](_0x403364)['then'](handleEntityNotFound(_0x450060,null))[_0x9a63('0x3d')](respondWithResult(_0x450060,null))[_0x9a63('0x41')](handleError(_0x450060,null));};exports[_0x9a63('0x45')]=function(_0x520bdf,_0x5c2d17){return db[_0x9a63('0x27')][_0x9a63('0x45')](_0x520bdf[_0x9a63('0x46')],{})[_0x9a63('0x3d')](respondWithResult(_0x5c2d17,0xc9))[_0x9a63('0x41')](handleError(_0x5c2d17,null));};exports[_0x9a63('0x1f')]=function(_0x21c09c,_0x31c582){if(_0x21c09c['body']['id']){delete _0x21c09c['body']['id'];}return db[_0x9a63('0x27')][_0x9a63('0x44')]({'where':{'id':_0x21c09c[_0x9a63('0x43')]['id']}})[_0x9a63('0x3d')](handleEntityNotFound(_0x31c582,null))[_0x9a63('0x3d')](saveUpdates(_0x21c09c[_0x9a63('0x46')],null))[_0x9a63('0x3d')](respondWithResult(_0x31c582,null))['catch'](handleError(_0x31c582,null));};exports[_0x9a63('0x20')]=function(_0x1eb09d,_0x324d2d){return db[_0x9a63('0x27')][_0x9a63('0x44')]({'where':{'id':_0x1eb09d[_0x9a63('0x43')]['id']}})['then'](handleEntityNotFound(_0x324d2d,null))[_0x9a63('0x3d')](removeEntity(_0x324d2d,null))[_0x9a63('0x41')](handleError(_0x324d2d,null));};exports[_0x9a63('0x47')]=function(_0x45e118,_0x932b2d){return db['VoiceDialReport'][_0x9a63('0x47')]()['then'](respondWithResult(_0x932b2d,null))[_0x9a63('0x41')](handleError(_0x932b2d,null));}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.model.js b/server/api/voiceDialReport/voiceDialReport.model.js index f3a9123..e7b8e0e 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 _0xe547=['define','VoiceDialReport','report_dial','uniqueid','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x46698a,_0x8de1e4){var _0x356db0=function(_0x19e83c){while(--_0x19e83c){_0x46698a['push'](_0x46698a['shift']());}};_0x356db0(++_0x8de1e4);}(_0xe547,0x1e4));var _0x7e54=function(_0x1dd3ae,_0x5cc628){_0x1dd3ae=_0x1dd3ae-0x0;var _0x1fbe84=_0xe547[_0x1dd3ae];return _0x1fbe84;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0x7e54('0x0'));var moment=require(_0x7e54('0x1'));var BPromise=require(_0x7e54('0x2'));var rp=require(_0x7e54('0x3'));var fs=require('fs');var path=require(_0x7e54('0x4'));var rimraf=require(_0x7e54('0x5'));var config=require('../../config/environment');var attributes=require('./voiceDialReport.attributes');module['exports']=function(_0x142d01,_0x3b2674){return _0x142d01[_0x7e54('0x6')](_0x7e54('0x7'),attributes,{'tableName':_0x7e54('0x8'),'paranoid':![],'indexes':[{'fields':[_0x7e54('0x9')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x297a=['path','exports','VoiceDialReport','report_dial','uniqueid','lodash','util','../../config/logger','api'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0x297a,0xd4));var _0xa297=function(_0x25abed,_0x1a25b3){_0x25abed=_0x25abed-0x0;var _0x45374e=_0x297a[_0x25abed];return _0x45374e;};'use strict';var _=require(_0xa297('0x0'));var util=require(_0xa297('0x1'));var logger=require(_0xa297('0x2'))(_0xa297('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xa297('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./voiceDialReport.attributes');module[_0xa297('0x5')]=function(_0x21dc09,_0x10407d){return _0x21dc09['define'](_0xa297('0x6'),attributes,{'tableName':_0xa297('0x7'),'paranoid':![],'indexes':[{'fields':[_0xa297('0x8')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.rpc.js b/server/api/voiceDialReport/voiceDialReport.rpc.js index 536bb68..24dccdb 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 _0x4a47=['error','code','message','VoiceDialReport,\x20%s,\x20%s','result','catch','CreateVoiceDialReport','VoiceDialReport','create','options','stringify','UpdateVoiceDialReport','update','raw','where','attributes','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','request','then','info','request\x20sent','debug','VoiceDialReport,\x20%s,\x20%s,\x20%s'];(function(_0x463960,_0x23af9e){var _0x48ebe2=function(_0x4ce71a){while(--_0x4ce71a){_0x463960['push'](_0x463960['shift']());}};_0x48ebe2(++_0x23af9e);}(_0x4a47,0xb5));var _0x74a4=function(_0x1c33dc,_0x177c7e){_0x1c33dc=_0x1c33dc-0x0;var _0x405580=_0x4a47[_0x1c33dc];return _0x405580;};'use strict';var _=require(_0x74a4('0x0'));var util=require(_0x74a4('0x1'));var moment=require(_0x74a4('0x2'));var BPromise=require(_0x74a4('0x3'));var rs=require(_0x74a4('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x74a4('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x74a4('0x6'))(_0x74a4('0x7'));var config=require('../../config/environment');var jayson=require(_0x74a4('0x8'));var client=jayson[_0x74a4('0x9')][_0x74a4('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4ebaa6,_0x41ef5a,_0x55e8a1){return new BPromise(function(_0x3122ba,_0x58e307){return client[_0x74a4('0xb')](_0x4ebaa6,_0x55e8a1)[_0x74a4('0xc')](function(_0x19f82b){logger[_0x74a4('0xd')]('VoiceDialReport,\x20%s,\x20%s',_0x41ef5a,_0x74a4('0xe'));logger[_0x74a4('0xf')](_0x74a4('0x10'),_0x41ef5a,_0x74a4('0xe'),JSON['stringify'](_0x19f82b));if(_0x19f82b[_0x74a4('0x11')]){if(_0x19f82b[_0x74a4('0x11')][_0x74a4('0x12')]===0x1f4){logger['error']('VoiceDialReport,\x20%s,\x20%s',_0x41ef5a,_0x19f82b[_0x74a4('0x11')][_0x74a4('0x13')]);return _0x58e307(_0x19f82b[_0x74a4('0x11')][_0x74a4('0x13')]);}logger[_0x74a4('0x11')](_0x74a4('0x14'),_0x41ef5a,_0x19f82b[_0x74a4('0x11')][_0x74a4('0x13')]);return _0x3122ba(_0x19f82b[_0x74a4('0x11')][_0x74a4('0x13')]);}else{logger[_0x74a4('0xd')](_0x74a4('0x14'),_0x41ef5a,_0x74a4('0xe'));_0x3122ba(_0x19f82b[_0x74a4('0x15')][_0x74a4('0x13')]);}})[_0x74a4('0x16')](function(_0x5d6dad){logger[_0x74a4('0x11')](_0x74a4('0x14'),_0x41ef5a,_0x5d6dad);_0x58e307(_0x5d6dad);});});}exports[_0x74a4('0x17')]=function(_0x2c9130){var _0x55cf53=this;return new Promise(function(_0xf224ef,_0x105998){return db[_0x74a4('0x18')][_0x74a4('0x19')](_0x2c9130['body'],{'raw':_0x2c9130[_0x74a4('0x1a')]?_0x2c9130[_0x74a4('0x1a')]['raw']===undefined?!![]:![]:!![]})[_0x74a4('0xc')](function(_0x2d3075){logger['info']('CreateVoiceDialReport',_0x2c9130);logger[_0x74a4('0xf')](_0x74a4('0x17'),_0x2c9130,JSON[_0x74a4('0x1b')](_0x2d3075));_0xf224ef(_0x2d3075);})[_0x74a4('0x16')](function(_0x484802){logger[_0x74a4('0x11')]('CreateVoiceDialReport',_0x484802['message'],_0x2c9130);_0x105998(_0x55cf53[_0x74a4('0x11')](0x1f4,_0x484802[_0x74a4('0x13')]));});});};exports[_0x74a4('0x1c')]=function(_0x5c3362){var _0x22f0fa=this;return new Promise(function(_0x387d89,_0x47c200){return db[_0x74a4('0x18')][_0x74a4('0x1d')](_0x5c3362['body'],{'raw':_0x5c3362[_0x74a4('0x1a')]?_0x5c3362[_0x74a4('0x1a')][_0x74a4('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5c3362['options']?_0x5c3362[_0x74a4('0x1a')][_0x74a4('0x1f')]||null:null,'attributes':_0x5c3362[_0x74a4('0x1a')]?_0x5c3362[_0x74a4('0x1a')][_0x74a4('0x20')]||null:null,'limit':_0x5c3362[_0x74a4('0x1a')]?_0x5c3362['options']['limit']||null:null})[_0x74a4('0xc')](function(_0x4fe101){logger[_0x74a4('0xd')]('UpdateVoiceDialReport',_0x5c3362);logger[_0x74a4('0xf')]('UpdateVoiceDialReport',_0x5c3362,JSON['stringify'](_0x4fe101));_0x387d89(_0x4fe101);})[_0x74a4('0x16')](function(_0x376f29){logger[_0x74a4('0x11')]('UpdateVoiceDialReport',_0x376f29['message'],_0x5c3362);_0x47c200(_0x22f0fa['error'](0x1f4,_0x376f29['message']));});});}; \ No newline at end of file +var _0x089f=['http','request','then','info','VoiceDialReport,\x20%s,\x20%s','request\x20sent','VoiceDialReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','create','body','options','raw','CreateVoiceDialReport','debug','UpdateVoiceDialReport','update','attributes','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client'];(function(_0xefe1b6,_0x308cc8){var _0x3b3256=function(_0x3804e5){while(--_0x3804e5){_0xefe1b6['push'](_0xefe1b6['shift']());}};_0x3b3256(++_0x308cc8);}(_0x089f,0x1c7));var _0xf089=function(_0x2251c4,_0x262b18){_0x2251c4=_0x2251c4-0x0;var _0x4df075=_0x089f[_0x2251c4];return _0x4df075;};'use strict';var _=require('lodash');var util=require(_0xf089('0x0'));var moment=require(_0xf089('0x1'));var BPromise=require(_0xf089('0x2'));var rs=require(_0xf089('0x3'));var fs=require('fs');var Redis=require(_0xf089('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xf089('0x5'));var logger=require(_0xf089('0x6'))(_0xf089('0x7'));var config=require('../../config/environment');var jayson=require(_0xf089('0x8'));var client=jayson[_0xf089('0x9')][_0xf089('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x49b977,_0x21a3f7,_0x1987d9){return new BPromise(function(_0x115de6,_0x55e37a){return client[_0xf089('0xb')](_0x49b977,_0x1987d9)[_0xf089('0xc')](function(_0x433553){logger[_0xf089('0xd')](_0xf089('0xe'),_0x21a3f7,_0xf089('0xf'));logger['debug'](_0xf089('0x10'),_0x21a3f7,_0xf089('0xf'),JSON[_0xf089('0x11')](_0x433553));if(_0x433553['error']){if(_0x433553[_0xf089('0x12')][_0xf089('0x13')]===0x1f4){logger['error']('VoiceDialReport,\x20%s,\x20%s',_0x21a3f7,_0x433553[_0xf089('0x12')][_0xf089('0x14')]);return _0x55e37a(_0x433553['error'][_0xf089('0x14')]);}logger[_0xf089('0x12')](_0xf089('0xe'),_0x21a3f7,_0x433553[_0xf089('0x12')]['message']);return _0x115de6(_0x433553[_0xf089('0x12')]['message']);}else{logger[_0xf089('0xd')]('VoiceDialReport,\x20%s,\x20%s',_0x21a3f7,_0xf089('0xf'));_0x115de6(_0x433553['result'][_0xf089('0x14')]);}})[_0xf089('0x15')](function(_0x157371){logger[_0xf089('0x12')](_0xf089('0xe'),_0x21a3f7,_0x157371);_0x55e37a(_0x157371);});});}exports['CreateVoiceDialReport']=function(_0x7fbed5){var _0x4e714a=this;return new Promise(function(_0x407263,_0x3418c4){return db['VoiceDialReport'][_0xf089('0x16')](_0x7fbed5[_0xf089('0x17')],{'raw':_0x7fbed5['options']?_0x7fbed5[_0xf089('0x18')][_0xf089('0x19')]===undefined?!![]:![]:!![]})[_0xf089('0xc')](function(_0x2ab659){logger[_0xf089('0xd')](_0xf089('0x1a'),_0x7fbed5);logger[_0xf089('0x1b')](_0xf089('0x1a'),_0x7fbed5,JSON[_0xf089('0x11')](_0x2ab659));_0x407263(_0x2ab659);})[_0xf089('0x15')](function(_0x581180){logger[_0xf089('0x12')](_0xf089('0x1a'),_0x581180[_0xf089('0x14')],_0x7fbed5);_0x3418c4(_0x4e714a[_0xf089('0x12')](0x1f4,_0x581180[_0xf089('0x14')]));});});};exports[_0xf089('0x1c')]=function(_0x249b88){var _0x94df4d=this;return new Promise(function(_0x22f2f2,_0x3a78fc){return db['VoiceDialReport'][_0xf089('0x1d')](_0x249b88['body'],{'raw':_0x249b88[_0xf089('0x18')]?_0x249b88[_0xf089('0x18')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x249b88[_0xf089('0x18')]?_0x249b88['options']['where']||null:null,'attributes':_0x249b88[_0xf089('0x18')]?_0x249b88[_0xf089('0x18')][_0xf089('0x1e')]||null:null,'limit':_0x249b88[_0xf089('0x18')]?_0x249b88[_0xf089('0x18')]['limit']||null:null})[_0xf089('0xc')](function(_0x531dd2){logger[_0xf089('0xd')](_0xf089('0x1c'),_0x249b88);logger[_0xf089('0x1b')](_0xf089('0x1c'),_0x249b88,JSON[_0xf089('0x11')](_0x531dd2));_0x22f2f2(_0x531dd2);})[_0xf089('0x15')](function(_0x3268ca){logger[_0xf089('0x12')](_0xf089('0x1c'),_0x3268ca[_0xf089('0x14')],_0x249b88);_0x3a78fc(_0x94df4d[_0xf089('0x12')](0x1f4,_0x3268ca[_0xf089('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/voiceExtension/index.js b/server/api/voiceExtension/index.js index e3805a4..3e30537 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 _0xe112=['/:id','update','delete','exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceExtension.controller','isAuthenticated','index','get','show','post','create','/:id/applications','addApplications','put'];(function(_0x1362f2,_0x532559){var _0xc54836=function(_0x3ca961){while(--_0x3ca961){_0x1362f2['push'](_0x1362f2['shift']());}};_0xc54836(++_0x532559);}(_0xe112,0xf6));var _0x2e11=function(_0xbd6a4d,_0x5f29ed){_0xbd6a4d=_0xbd6a4d-0x0;var _0x5651cf=_0xe112[_0xbd6a4d];return _0x5651cf;};'use strict';var multer=require('multer');var util=require(_0x2e11('0x0'));var path=require(_0x2e11('0x1'));var timeout=require(_0x2e11('0x2'));var express=require(_0x2e11('0x3'));var router=express[_0x2e11('0x4')]();var auth=require(_0x2e11('0x5'));var interaction=require(_0x2e11('0x6'));var config=require(_0x2e11('0x7'));var controller=require(_0x2e11('0x8'));router['get']('/',auth[_0x2e11('0x9')](),controller[_0x2e11('0xa')]);router[_0x2e11('0xb')]('/:id',auth[_0x2e11('0x9')](),controller[_0x2e11('0xc')]);router[_0x2e11('0xd')]('/',auth[_0x2e11('0x9')](),controller[_0x2e11('0xe')]);router[_0x2e11('0xd')](_0x2e11('0xf'),auth[_0x2e11('0x9')](),controller[_0x2e11('0x10')]);router[_0x2e11('0x11')](_0x2e11('0x12'),auth['isAuthenticated'](),controller[_0x2e11('0x13')]);router[_0x2e11('0x14')](_0x2e11('0x12'),auth[_0x2e11('0x9')](),controller['destroy']);module[_0x2e11('0x15')]=router; \ No newline at end of file +var _0xa58f=['addApplications','/:id','update','destroy','exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceExtension.controller','get','index','isAuthenticated','show','post','create','/:id/applications'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xa58f,0x17f));var _0xfa58=function(_0x4726ba,_0x17a603){_0x4726ba=_0x4726ba-0x0;var _0x17e45d=_0xa58f[_0x4726ba];return _0x17e45d;};'use strict';var multer=require('multer');var util=require(_0xfa58('0x0'));var path=require(_0xfa58('0x1'));var timeout=require(_0xfa58('0x2'));var express=require(_0xfa58('0x3'));var router=express[_0xfa58('0x4')]();var auth=require(_0xfa58('0x5'));var interaction=require(_0xfa58('0x6'));var config=require(_0xfa58('0x7'));var controller=require(_0xfa58('0x8'));router[_0xfa58('0x9')]('/',auth['isAuthenticated'](),controller[_0xfa58('0xa')]);router[_0xfa58('0x9')]('/:id',auth[_0xfa58('0xb')](),controller[_0xfa58('0xc')]);router[_0xfa58('0xd')]('/',auth[_0xfa58('0xb')](),controller[_0xfa58('0xe')]);router[_0xfa58('0xd')](_0xfa58('0xf'),auth[_0xfa58('0xb')](),controller[_0xfa58('0x10')]);router['put'](_0xfa58('0x11'),auth[_0xfa58('0xb')](),controller[_0xfa58('0x12')]);router['delete']('/:id',auth[_0xfa58('0xb')](),controller[_0xfa58('0x13')]);module[_0xfa58('0x14')]=router; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.attributes.js b/server/api/voiceExtension/voiceExtension.attributes.js index e66ed55..49a6281 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(_0x3b8bf8,_0x59e09f){var _0x481a4a=function(_0x3b6bf3){while(--_0x3b6bf3){_0x3b8bf8['push'](_0x3b8bf8['shift']());}};_0x481a4a(++_0x59e09f);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4fc9e6,_0xc51915){_0x4fc9e6=_0x4fc9e6-0x0;var _0x551d28=_0xa9e0[_0x4fc9e6];return _0x551d28;};'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(_0x44654b,_0x167f38){var _0x423e96=function(_0x17026c){while(--_0x17026c){_0x44654b['push'](_0x44654b['shift']());}};_0x423e96(++_0x167f38);}(_0xa9e0,0x123));var _0x0a9e=function(_0x411add,_0x1aed38){_0x411add=_0x411add-0x0;var _0x238242=_0xa9e0[_0x411add];return _0x238242;};'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 785dec6..b914b6c 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 _0xc6ac=['mandatoryDisposition','addApplications','findOne','sequelize','transaction','VoiceExtensionId','findAndCountAll','cast(priority\x20as\x20unsigned)','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','register','sendStatus','status','end','json','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','get','InboundRoutes','inbound','OutboundRoutes','InternalRoutes','internal','filter','ignore','map','value','includes','type','UserProfileResource','error','stack','name','send','index','rawAttributes','fieldName','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','merge','VIRTUAL','options','VoiceExtension','includeAll','include','rows','catch','show','params','find','create','body','outbound','startsWith','exten','concat','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','pick','context'];(function(_0x1bf09a,_0x28ddd6){var _0x268924=function(_0x582c1d){while(--_0x582c1d){_0x1bf09a['push'](_0x1bf09a['shift']());}};_0x268924(++_0x28ddd6);}(_0xc6ac,0x15b));var _0xcc6a=function(_0x43ea01,_0x38a0db){_0x43ea01=_0x43ea01-0x0;var _0xaceb66=_0xc6ac[_0x43ea01];return _0xaceb66;};'use strict';var pdf=require(_0xcc6a('0x0'));var emlformat=require(_0xcc6a('0x1'));var rimraf=require(_0xcc6a('0x2'));var zipdir=require(_0xcc6a('0x3'));var jsonpatch=require(_0xcc6a('0x4'));var rp=require(_0xcc6a('0x5'));var moment=require(_0xcc6a('0x6'));var BPromise=require(_0xcc6a('0x7'));var Mustache=require(_0xcc6a('0x8'));var util=require(_0xcc6a('0x9'));var path=require(_0xcc6a('0xa'));var sox=require(_0xcc6a('0xb'));var csv=require(_0xcc6a('0xc'));var ejs=require(_0xcc6a('0xd'));var fs=require('fs');var _=require('lodash');var squel=require(_0xcc6a('0xe'));var crypto=require(_0xcc6a('0xf'));var jsforce=require(_0xcc6a('0x10'));var deskjs=require('desk.js');var toCsv=require(_0xcc6a('0xc'));var querystring=require(_0xcc6a('0x11'));var Papa=require(_0xcc6a('0x12'));var Redis=require(_0xcc6a('0x13'));var authService=require(_0xcc6a('0x14'));var qs=require('../../components/parsers/qs');var as=require(_0xcc6a('0x15'));var hardwareService=require(_0xcc6a('0x16'));var logger=require(_0xcc6a('0x17'))('api');var utils=require(_0xcc6a('0x18'));var config=require(_0xcc6a('0x19'));var db=require(_0xcc6a('0x1a'))['db'];config['redis']=_['defaults'](config[_0xcc6a('0x1b')],{'host':_0xcc6a('0x1c'),'port':0x18eb});var socket=require(_0xcc6a('0x1d'))(new Redis(config['redis']));require('./voiceExtension.socket')[_0xcc6a('0x1e')](socket);function respondWithStatusCode(_0xcb9e2e,_0x43710d){_0x43710d=_0x43710d||0xcc;return function(_0x348af7){if(_0x348af7){return _0xcb9e2e[_0xcc6a('0x1f')](_0x43710d);}return _0xcb9e2e[_0xcc6a('0x20')](_0x43710d)[_0xcc6a('0x21')]();};}function respondWithResult(_0x403b18,_0x56ffb0){_0x56ffb0=_0x56ffb0||0xc8;return function(_0x4e628f){if(_0x4e628f){return _0x403b18['status'](_0x56ffb0)[_0xcc6a('0x22')](_0x4e628f);}};}function respondWithFilteredResult(_0x44910f,_0x307f2a){return function(_0x3e63d9){if(_0x3e63d9){var _0x33079c=_0x3e63d9[_0xcc6a('0x23')],_0x12ef33=_0x307f2a[_0xcc6a('0x24')],_0x2d9585=_0x307f2a[_0xcc6a('0x24')]+_0x307f2a['limit'],_0x412bc7;if(_0x2d9585>=_0x33079c){_0x2d9585=_0x33079c;_0x412bc7=0xc8;}else{_0x412bc7=0xce;}_0x44910f[_0xcc6a('0x20')](_0x412bc7);return _0x44910f[_0xcc6a('0x25')](_0xcc6a('0x26'),_0x12ef33+'-'+_0x2d9585+'/'+_0x33079c)[_0xcc6a('0x22')](_0x3e63d9);}return null;};}function patchUpdates(_0x1495d8){return function(_0x30b8ed){try{jsonpatch[_0xcc6a('0x27')](_0x30b8ed,_0x1495d8,!![]);}catch(_0x43f510){return BPromise[_0xcc6a('0x28')](_0x43f510);}return _0x30b8ed[_0xcc6a('0x29')]();};}function saveUpdates(_0x329d17,_0x845088){return function(_0x51be9a){if(_0x51be9a){return _0x51be9a[_0xcc6a('0x2a')](_0x329d17)[_0xcc6a('0x2b')](function(_0x38f812){return _0x38f812;});}return null;};}function removeEntity(_0x581aae,_0x10016a){return function(_0x294486){if(_0x294486){return _0x294486[_0xcc6a('0x2c')]()[_0xcc6a('0x2b')](function(){var _0x432c23=_0x294486[_0xcc6a('0x2d')]({'plain':!![]});var _0x50abc1=[{'name':_0xcc6a('0x2e'),'value':_0xcc6a('0x2f'),'ignore':![]},{'name':_0xcc6a('0x30'),'value':'outbound','ignore':![]},{'name':_0xcc6a('0x31'),'value':_0xcc6a('0x32'),'ignore':![]}];var _0x4da301=_(_0x50abc1)[_0xcc6a('0x33')](_0xcc6a('0x34'))[_0xcc6a('0x35')](_0xcc6a('0x36'))['value']();if(_[_0xcc6a('0x37')](_0x4da301,_0x432c23[_0xcc6a('0x38')])){return;}var _0x2c6d88=_['find'](_0x50abc1,[_0xcc6a('0x36'),_0x432c23['type']])['name'];return db[_0xcc6a('0x39')][_0xcc6a('0x2c')]({'where':{'type':_0x2c6d88,'resourceId':_0x432c23['id']}})[_0xcc6a('0x2b')](function(){return _0x294486;});})[_0xcc6a('0x2b')](function(){_0x581aae[_0xcc6a('0x20')](0xcc)[_0xcc6a('0x21')]();});}};}function handleEntityNotFound(_0x4e2de4,_0x7b2b54){return function(_0x28e3c3){if(!_0x28e3c3){_0x4e2de4[_0xcc6a('0x1f')](0x194);}return _0x28e3c3;};}function handleError(_0x2faeb5,_0x211a8c){_0x211a8c=_0x211a8c||0x1f4;return function(_0x152ebd){logger[_0xcc6a('0x3a')](_0x152ebd[_0xcc6a('0x3b')]);if(_0x152ebd['name']){delete _0x152ebd[_0xcc6a('0x3c')];}_0x2faeb5[_0xcc6a('0x20')](_0x211a8c)[_0xcc6a('0x3d')](_0x152ebd);};}exports[_0xcc6a('0x3e')]=function(_0x30d6e1,_0x711a58){var _0x28b16e={},_0x5afbbc={},_0x5d2287={'count':0x0,'rows':[]};var _0x5a41b4=_['map'](db['VoiceExtension'][_0xcc6a('0x3f')],function(_0x2a3e93){return{'name':_0x2a3e93[_0xcc6a('0x40')],'type':_0x2a3e93[_0xcc6a('0x38')][_0xcc6a('0x41')]};});_0x5afbbc['model']=_['map'](_0x5a41b4,_0xcc6a('0x3c'));_0x5afbbc[_0xcc6a('0x42')]=_[_0xcc6a('0x43')](_0x30d6e1['query']);_0x5afbbc[_0xcc6a('0x44')]=_[_0xcc6a('0x45')](_0x5afbbc[_0xcc6a('0x46')],_0x5afbbc[_0xcc6a('0x42')]);_0x28b16e[_0xcc6a('0x47')]=_[_0xcc6a('0x45')](_0x5afbbc[_0xcc6a('0x46')],qs[_0xcc6a('0x48')](_0x30d6e1[_0xcc6a('0x42')][_0xcc6a('0x48')]));_0x28b16e[_0xcc6a('0x47')]=_0x28b16e[_0xcc6a('0x47')][_0xcc6a('0x49')]?_0x28b16e[_0xcc6a('0x47')]:_0x5afbbc[_0xcc6a('0x46')];if(!_0x30d6e1[_0xcc6a('0x42')][_0xcc6a('0x4a')](_0xcc6a('0x4b'))){_0x28b16e['limit']=qs['limit'](_0x30d6e1[_0xcc6a('0x42')][_0xcc6a('0x4c')]);_0x28b16e[_0xcc6a('0x24')]=qs[_0xcc6a('0x24')](_0x30d6e1[_0xcc6a('0x42')][_0xcc6a('0x24')]);}_0x28b16e[_0xcc6a('0x4d')]=qs[_0xcc6a('0x4e')](_0x30d6e1['query']['sort']);_0x28b16e[_0xcc6a('0x4f')]=qs['filters'](_['pick'](_0x30d6e1['query'],_0x5afbbc[_0xcc6a('0x44')]),_0x5a41b4);if(_0x30d6e1[_0xcc6a('0x42')][_0xcc6a('0x33')]){_0x28b16e[_0xcc6a('0x4f')]=_[_0xcc6a('0x50')](_0x28b16e['where'],{'$or':_[_0xcc6a('0x35')](_0x5a41b4,function(_0xfbb079){if(_0xfbb079[_0xcc6a('0x38')]!==_0xcc6a('0x51')){var _0x14ca90={};_0x14ca90[_0xfbb079[_0xcc6a('0x3c')]]={'$like':'%'+_0x30d6e1['query'][_0xcc6a('0x33')]+'%'};return _0x14ca90;}})});}_0x28b16e=_[_0xcc6a('0x50')]({},_0x28b16e,_0x30d6e1[_0xcc6a('0x52')]);var _0x11c137={'where':_0x28b16e['where']};return db[_0xcc6a('0x53')]['count'](_0x11c137)[_0xcc6a('0x2b')](function(_0x3f280a){_0x5d2287[_0xcc6a('0x23')]=_0x3f280a;if(_0x30d6e1['query'][_0xcc6a('0x54')]){_0x28b16e[_0xcc6a('0x55')]=[{'all':!![]}];}return db[_0xcc6a('0x53')]['findAll'](_0x28b16e);})['then'](function(_0x3467b1){_0x5d2287[_0xcc6a('0x56')]=_0x3467b1;return _0x5d2287;})[_0xcc6a('0x2b')](respondWithFilteredResult(_0x711a58,_0x28b16e))[_0xcc6a('0x57')](handleError(_0x711a58,null));};exports[_0xcc6a('0x58')]=function(_0x5e59af,_0x16b83b){var _0xff1166={'raw':![],'where':{'id':_0x5e59af[_0xcc6a('0x59')]['id']}},_0x50ef8c={};_0x50ef8c[_0xcc6a('0x46')]=_[_0xcc6a('0x43')](db[_0xcc6a('0x53')][_0xcc6a('0x3f')]);_0x50ef8c[_0xcc6a('0x42')]=_['keys'](_0x5e59af['query']);_0x50ef8c['filters']=_[_0xcc6a('0x45')](_0x50ef8c[_0xcc6a('0x46')],_0x50ef8c[_0xcc6a('0x42')]);_0xff1166[_0xcc6a('0x47')]=_['intersection'](_0x50ef8c[_0xcc6a('0x46')],qs['fields'](_0x5e59af[_0xcc6a('0x42')][_0xcc6a('0x48')]));_0xff1166[_0xcc6a('0x47')]=_0xff1166[_0xcc6a('0x47')][_0xcc6a('0x49')]?_0xff1166[_0xcc6a('0x47')]:_0x50ef8c['model'];if(_0x5e59af[_0xcc6a('0x42')][_0xcc6a('0x54')]){_0xff1166[_0xcc6a('0x55')]=[{'all':!![]}];}_0xff1166=_[_0xcc6a('0x50')]({},_0xff1166,_0x5e59af[_0xcc6a('0x52')]);return db[_0xcc6a('0x53')][_0xcc6a('0x5a')](_0xff1166)[_0xcc6a('0x2b')](handleEntityNotFound(_0x16b83b,null))[_0xcc6a('0x2b')](respondWithResult(_0x16b83b,null))[_0xcc6a('0x57')](handleError(_0x16b83b,null));};exports['destroy']=function(_0x1c8470,_0x3197b5){return db[_0xcc6a('0x53')][_0xcc6a('0x5a')]({'where':{'id':_0x1c8470[_0xcc6a('0x59')]['id']}})[_0xcc6a('0x2b')](handleEntityNotFound(_0x3197b5,null))['then'](removeEntity(_0x3197b5,null))['catch'](handleError(_0x3197b5,null));};exports[_0xcc6a('0x5b')]=function(_0x5eeca6,_0x1ac0f0){if(_0x5eeca6[_0xcc6a('0x5c')][_0xcc6a('0x38')]===_0xcc6a('0x5d')&&!_[_0xcc6a('0x5e')](_0x5eeca6[_0xcc6a('0x5c')][_0xcc6a('0x5f')],'_')){_0x5eeca6[_0xcc6a('0x5c')][_0xcc6a('0x5f')]='_'[_0xcc6a('0x60')](_0x5eeca6[_0xcc6a('0x5c')]['exten']);}return db[_0xcc6a('0x53')]['create'](_0x5eeca6[_0xcc6a('0x5c')],{'raw':![]})[_0xcc6a('0x2b')](function(_0x22acfb){var _0x571a0a=_0x5eeca6[_0xcc6a('0x61')]['get']({'plain':!![]});if(!_0x571a0a)throw new Error(_0xcc6a('0x62'));if(_0x571a0a['role']===_0xcc6a('0x61')){var _0x271d07=_0x22acfb[_0xcc6a('0x2d')]({'plain':!![]});var _0xe212e8=[{'name':_0xcc6a('0x2e'),'value':_0xcc6a('0x2f')},{'name':_0xcc6a('0x30'),'value':_0xcc6a('0x5d')},{'name':'InternalRoutes','value':_0xcc6a('0x32')}];var _0x56d512=_[_0xcc6a('0x5a')](_0xe212e8,['value',_0x271d07[_0xcc6a('0x38')]])[_0xcc6a('0x3c')];return db[_0xcc6a('0x63')]['find']({'where':{'name':_0x56d512,'userProfileId':_0x571a0a[_0xcc6a('0x64')]},'raw':!![]})['then'](function(_0x5e53e4){if(_0x5e53e4&&_0x5e53e4[_0xcc6a('0x65')]===0x0){return db[_0xcc6a('0x39')][_0xcc6a('0x5b')]({'name':_0x271d07[_0xcc6a('0x3c')],'resourceId':_0x271d07['id'],'type':_0x5e53e4[_0xcc6a('0x3c')],'sectionId':_0x5e53e4['id']},{})[_0xcc6a('0x2b')](function(){return _0x22acfb;});}else{return _0x22acfb;}})[_0xcc6a('0x57')](function(_0x5668d1){logger[_0xcc6a('0x3a')](_0xcc6a('0x66'),_0x5668d1);throw _0x5668d1;});}return _0x22acfb;})[_0xcc6a('0x2b')](respondWithResult(_0x1ac0f0,0xc9))[_0xcc6a('0x57')](handleError(_0x1ac0f0,null));};exports[_0xcc6a('0x2a')]=function(_0x483aa4,_0x2a3745){if(_0x483aa4[_0xcc6a('0x5c')]['id']){delete _0x483aa4[_0xcc6a('0x5c')]['id'];}return db[_0xcc6a('0x53')]['find']({'where':{'id':_0x483aa4[_0xcc6a('0x59')]['id']}})[_0xcc6a('0x2b')](handleEntityNotFound(_0x2a3745,null))[_0xcc6a('0x2b')](function(_0x2ffe07){if(_0x2ffe07){return db[_0xcc6a('0x53')][_0xcc6a('0x2a')](_[_0xcc6a('0x67')](_0x483aa4[_0xcc6a('0x5c')],[_0xcc6a('0x5f'),_0xcc6a('0x68'),'description','recordingFormat','cutdigits',_0xcc6a('0x69')]),{'where':{'context':_0x2ffe07[_0xcc6a('0x68')],'exten':_0x2ffe07[_0xcc6a('0x5f')]},'individualHooks':!![]})['then'](function(_0x2f7787){return _0x2f7787;});}return null;})[_0xcc6a('0x2b')](respondWithStatusCode(_0x2a3745,null))[_0xcc6a('0x57')](handleError(_0x2a3745,null));};exports[_0xcc6a('0x6a')]=function(_0x5e1c69,_0x481d25,_0xaec5e8){return db[_0xcc6a('0x53')][_0xcc6a('0x6b')]({'where':{'id':_0x5e1c69[_0xcc6a('0x59')]['id']}})['then'](handleEntityNotFound(_0x481d25,null))[_0xcc6a('0x2b')](function(_0x2e9a9f){if(_0x2e9a9f){return db[_0xcc6a('0x6c')][_0xcc6a('0x6d')](function(_0x3a0d36){return db['VoiceExtension']['destroy']({'where':{'VoiceExtensionId':_0x5e1c69[_0xcc6a('0x59')]['id']},'transaction':_0x3a0d36})[_0xcc6a('0x2b')](function(_0x2d9f02){var _0x144495=_['map'](_0x5e1c69['body'],function(_0x43827c){_0x43827c[_0xcc6a('0x6e')]=_0x5e1c69[_0xcc6a('0x59')]['id'];return _0x43827c;});return db[_0xcc6a('0x53')]['bulkCreate'](_0x144495,{'transaction':_0x3a0d36});});})['then'](function(){return db['VoiceExtension'][_0xcc6a('0x6f')]({'where':{'isApp':!![],'VoiceExtensionId':_0x5e1c69[_0xcc6a('0x59')]['id']},'order':_0xcc6a('0x70')});});}})[_0xcc6a('0x2b')](respondWithResult(_0x481d25,null))['catch'](handleError(_0x481d25,null));}; \ No newline at end of file +var _0xef0f=['hasOwnProperty','nolimit','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','findAll','catch','params','include','body','startsWith','exten','concat','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','userProfileId','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','context','description','cutdigits','mandatoryDisposition','addApplications','findOne','sequelize','transaction','VoiceExtensionId','findAndCountAll','cast(priority\x20as\x20unsigned)','html-pdf','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','./voiceExtension.socket','register','status','json','count','offset','limit','set','Content-Range','reject','then','destroy','get','InboundRoutes','inbound','OutboundRoutes','outbound','InternalRoutes','internal','ignore','map','value','includes','type','find','name','UserProfileResource','end','error','stack','send','VoiceExtension','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length'];(function(_0x28dae9,_0x41ebe6){var _0x1c9f27=function(_0x35944f){while(--_0x35944f){_0x28dae9['push'](_0x28dae9['shift']());}};_0x1c9f27(++_0x41ebe6);}(_0xef0f,0x168));var _0xfef0=function(_0x3c6c44,_0x3aae67){_0x3c6c44=_0x3c6c44-0x0;var _0x1ecffd=_0xef0f[_0x3c6c44];return _0x1ecffd;};'use strict';var pdf=require(_0xfef0('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xfef0('0x1'));var zipdir=require(_0xfef0('0x2'));var jsonpatch=require(_0xfef0('0x3'));var rp=require('request-promise');var moment=require(_0xfef0('0x4'));var BPromise=require(_0xfef0('0x5'));var Mustache=require(_0xfef0('0x6'));var util=require('util');var path=require(_0xfef0('0x7'));var sox=require(_0xfef0('0x8'));var csv=require(_0xfef0('0x9'));var ejs=require(_0xfef0('0xa'));var fs=require('fs');var _=require(_0xfef0('0xb'));var squel=require(_0xfef0('0xc'));var crypto=require('crypto');var jsforce=require(_0xfef0('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xfef0('0x9'));var querystring=require(_0xfef0('0xe'));var Papa=require(_0xfef0('0xf'));var Redis=require(_0xfef0('0x10'));var authService=require(_0xfef0('0x11'));var qs=require(_0xfef0('0x12'));var as=require(_0xfef0('0x13'));var hardwareService=require(_0xfef0('0x14'));var logger=require(_0xfef0('0x15'))(_0xfef0('0x16'));var utils=require(_0xfef0('0x17'));var config=require(_0xfef0('0x18'));var db=require(_0xfef0('0x19'))['db'];config[_0xfef0('0x1a')]=_['defaults'](config[_0xfef0('0x1a')],{'host':_0xfef0('0x1b'),'port':0x18eb});var socket=require(_0xfef0('0x1c'))(new Redis(config[_0xfef0('0x1a')]));require(_0xfef0('0x1d'))[_0xfef0('0x1e')](socket);function respondWithStatusCode(_0xa9f040,_0x573ae7){_0x573ae7=_0x573ae7||0xcc;return function(_0x3d1f02){if(_0x3d1f02){return _0xa9f040['sendStatus'](_0x573ae7);}return _0xa9f040['status'](_0x573ae7)['end']();};}function respondWithResult(_0x118b8d,_0x284b6d){_0x284b6d=_0x284b6d||0xc8;return function(_0x3510a7){if(_0x3510a7){return _0x118b8d[_0xfef0('0x1f')](_0x284b6d)[_0xfef0('0x20')](_0x3510a7);}};}function respondWithFilteredResult(_0x3f9a6c,_0x155833){return function(_0x2887e6){if(_0x2887e6){var _0x581459=_0x2887e6[_0xfef0('0x21')],_0xd60678=_0x155833[_0xfef0('0x22')],_0x1642cd=_0x155833['offset']+_0x155833[_0xfef0('0x23')],_0x1577fa;if(_0x1642cd>=_0x581459){_0x1642cd=_0x581459;_0x1577fa=0xc8;}else{_0x1577fa=0xce;}_0x3f9a6c['status'](_0x1577fa);return _0x3f9a6c[_0xfef0('0x24')](_0xfef0('0x25'),_0xd60678+'-'+_0x1642cd+'/'+_0x581459)[_0xfef0('0x20')](_0x2887e6);}return null;};}function patchUpdates(_0x48408a){return function(_0x2be956){try{jsonpatch['apply'](_0x2be956,_0x48408a,!![]);}catch(_0x4074b7){return BPromise[_0xfef0('0x26')](_0x4074b7);}return _0x2be956['save']();};}function saveUpdates(_0x4897af,_0x4b8b22){return function(_0x19fde8){if(_0x19fde8){return _0x19fde8['update'](_0x4897af)[_0xfef0('0x27')](function(_0x46b34a){return _0x46b34a;});}return null;};}function removeEntity(_0x1a8d66,_0x4483f2){return function(_0x249fe4){if(_0x249fe4){return _0x249fe4[_0xfef0('0x28')]()['then'](function(){var _0x4ac8c5=_0x249fe4[_0xfef0('0x29')]({'plain':!![]});var _0x1ffaa4=[{'name':_0xfef0('0x2a'),'value':_0xfef0('0x2b'),'ignore':![]},{'name':_0xfef0('0x2c'),'value':_0xfef0('0x2d'),'ignore':![]},{'name':_0xfef0('0x2e'),'value':_0xfef0('0x2f'),'ignore':![]}];var _0x391279=_(_0x1ffaa4)['filter'](_0xfef0('0x30'))[_0xfef0('0x31')](_0xfef0('0x32'))[_0xfef0('0x32')]();if(_[_0xfef0('0x33')](_0x391279,_0x4ac8c5[_0xfef0('0x34')])){return;}var _0x3e3c4c=_[_0xfef0('0x35')](_0x1ffaa4,[_0xfef0('0x32'),_0x4ac8c5[_0xfef0('0x34')]])[_0xfef0('0x36')];return db[_0xfef0('0x37')]['destroy']({'where':{'type':_0x3e3c4c,'resourceId':_0x4ac8c5['id']}})[_0xfef0('0x27')](function(){return _0x249fe4;});})['then'](function(){_0x1a8d66['status'](0xcc)[_0xfef0('0x38')]();});}};}function handleEntityNotFound(_0x2ae54a,_0x4a481d){return function(_0x4bbdba){if(!_0x4bbdba){_0x2ae54a['sendStatus'](0x194);}return _0x4bbdba;};}function handleError(_0x4f65cd,_0x4cce8a){_0x4cce8a=_0x4cce8a||0x1f4;return function(_0x417535){logger[_0xfef0('0x39')](_0x417535[_0xfef0('0x3a')]);if(_0x417535['name']){delete _0x417535['name'];}_0x4f65cd['status'](_0x4cce8a)[_0xfef0('0x3b')](_0x417535);};}exports['index']=function(_0x215032,_0x3783f9){var _0x1b9f39={},_0x4a2773={},_0x3cad13={'count':0x0,'rows':[]};var _0x4c3a0f=_[_0xfef0('0x31')](db[_0xfef0('0x3c')][_0xfef0('0x3d')],function(_0xe5188e){return{'name':_0xe5188e[_0xfef0('0x3e')],'type':_0xe5188e[_0xfef0('0x34')][_0xfef0('0x3f')]};});_0x4a2773[_0xfef0('0x40')]=_['map'](_0x4c3a0f,_0xfef0('0x36'));_0x4a2773[_0xfef0('0x41')]=_[_0xfef0('0x42')](_0x215032[_0xfef0('0x41')]);_0x4a2773[_0xfef0('0x43')]=_[_0xfef0('0x44')](_0x4a2773[_0xfef0('0x40')],_0x4a2773[_0xfef0('0x41')]);_0x1b9f39[_0xfef0('0x45')]=_[_0xfef0('0x44')](_0x4a2773[_0xfef0('0x40')],qs[_0xfef0('0x46')](_0x215032[_0xfef0('0x41')]['fields']));_0x1b9f39[_0xfef0('0x45')]=_0x1b9f39['attributes'][_0xfef0('0x47')]?_0x1b9f39[_0xfef0('0x45')]:_0x4a2773[_0xfef0('0x40')];if(!_0x215032['query'][_0xfef0('0x48')](_0xfef0('0x49'))){_0x1b9f39[_0xfef0('0x23')]=qs['limit'](_0x215032[_0xfef0('0x41')][_0xfef0('0x23')]);_0x1b9f39[_0xfef0('0x22')]=qs['offset'](_0x215032[_0xfef0('0x41')]['offset']);}_0x1b9f39['order']=qs[_0xfef0('0x4a')](_0x215032['query']['sort']);_0x1b9f39[_0xfef0('0x4b')]=qs[_0xfef0('0x43')](_[_0xfef0('0x4c')](_0x215032[_0xfef0('0x41')],_0x4a2773[_0xfef0('0x43')]),_0x4c3a0f);if(_0x215032[_0xfef0('0x41')]['filter']){_0x1b9f39[_0xfef0('0x4b')]=_[_0xfef0('0x4d')](_0x1b9f39['where'],{'$or':_['map'](_0x4c3a0f,function(_0x1d554e){if(_0x1d554e['type']!==_0xfef0('0x4e')){var _0x22c940={};_0x22c940[_0x1d554e[_0xfef0('0x36')]]={'$like':'%'+_0x215032[_0xfef0('0x41')][_0xfef0('0x4f')]+'%'};return _0x22c940;}})});}_0x1b9f39=_[_0xfef0('0x4d')]({},_0x1b9f39,_0x215032[_0xfef0('0x50')]);var _0x15b4a6={'where':_0x1b9f39['where']};return db[_0xfef0('0x3c')]['count'](_0x15b4a6)['then'](function(_0x18c656){_0x3cad13[_0xfef0('0x21')]=_0x18c656;if(_0x215032['query'][_0xfef0('0x51')]){_0x1b9f39['include']=[{'all':!![]}];}return db[_0xfef0('0x3c')][_0xfef0('0x52')](_0x1b9f39);})[_0xfef0('0x27')](function(_0x115e64){_0x3cad13['rows']=_0x115e64;return _0x3cad13;})[_0xfef0('0x27')](respondWithFilteredResult(_0x3783f9,_0x1b9f39))[_0xfef0('0x53')](handleError(_0x3783f9,null));};exports['show']=function(_0x4cafd1,_0x392607){var _0x4f3231={'raw':![],'where':{'id':_0x4cafd1[_0xfef0('0x54')]['id']}},_0x32392a={};_0x32392a[_0xfef0('0x40')]=_[_0xfef0('0x42')](db[_0xfef0('0x3c')][_0xfef0('0x3d')]);_0x32392a['query']=_[_0xfef0('0x42')](_0x4cafd1['query']);_0x32392a['filters']=_[_0xfef0('0x44')](_0x32392a[_0xfef0('0x40')],_0x32392a[_0xfef0('0x41')]);_0x4f3231['attributes']=_[_0xfef0('0x44')](_0x32392a['model'],qs['fields'](_0x4cafd1['query'][_0xfef0('0x46')]));_0x4f3231[_0xfef0('0x45')]=_0x4f3231[_0xfef0('0x45')][_0xfef0('0x47')]?_0x4f3231[_0xfef0('0x45')]:_0x32392a[_0xfef0('0x40')];if(_0x4cafd1[_0xfef0('0x41')][_0xfef0('0x51')]){_0x4f3231[_0xfef0('0x55')]=[{'all':!![]}];}_0x4f3231=_['merge']({},_0x4f3231,_0x4cafd1['options']);return db[_0xfef0('0x3c')][_0xfef0('0x35')](_0x4f3231)[_0xfef0('0x27')](handleEntityNotFound(_0x392607,null))[_0xfef0('0x27')](respondWithResult(_0x392607,null))[_0xfef0('0x53')](handleError(_0x392607,null));};exports[_0xfef0('0x28')]=function(_0x1ec15d,_0x20b647){return db['VoiceExtension'][_0xfef0('0x35')]({'where':{'id':_0x1ec15d[_0xfef0('0x54')]['id']}})[_0xfef0('0x27')](handleEntityNotFound(_0x20b647,null))[_0xfef0('0x27')](removeEntity(_0x20b647,null))[_0xfef0('0x53')](handleError(_0x20b647,null));};exports['create']=function(_0x5b3592,_0x523763){if(_0x5b3592[_0xfef0('0x56')][_0xfef0('0x34')]===_0xfef0('0x2d')&&!_[_0xfef0('0x57')](_0x5b3592['body'][_0xfef0('0x58')],'_')){_0x5b3592[_0xfef0('0x56')][_0xfef0('0x58')]='_'[_0xfef0('0x59')](_0x5b3592[_0xfef0('0x56')][_0xfef0('0x58')]);}return db[_0xfef0('0x3c')]['create'](_0x5b3592[_0xfef0('0x56')],{'raw':![]})[_0xfef0('0x27')](function(_0x47f17a){var _0x291f3f=_0x5b3592['user'][_0xfef0('0x29')]({'plain':!![]});if(!_0x291f3f)throw new Error(_0xfef0('0x5a'));if(_0x291f3f['role']===_0xfef0('0x5b')){var _0x49ec3c=_0x47f17a['get']({'plain':!![]});var _0x4812c7=[{'name':_0xfef0('0x2a'),'value':_0xfef0('0x2b')},{'name':_0xfef0('0x2c'),'value':_0xfef0('0x2d')},{'name':_0xfef0('0x2e'),'value':_0xfef0('0x2f')}];var _0x5b5664=_[_0xfef0('0x35')](_0x4812c7,[_0xfef0('0x32'),_0x49ec3c[_0xfef0('0x34')]])[_0xfef0('0x36')];return db[_0xfef0('0x5c')]['find']({'where':{'name':_0x5b5664,'userProfileId':_0x291f3f[_0xfef0('0x5d')]},'raw':!![]})['then'](function(_0x135653){if(_0x135653&&_0x135653['autoAssociation']===0x0){return db[_0xfef0('0x37')][_0xfef0('0x5e')]({'name':_0x49ec3c[_0xfef0('0x36')],'resourceId':_0x49ec3c['id'],'type':_0x135653[_0xfef0('0x36')],'sectionId':_0x135653['id']},{})[_0xfef0('0x27')](function(){return _0x47f17a;});}else{return _0x47f17a;}})['catch'](function(_0x2abdb7){logger['error'](_0xfef0('0x5f'),_0x2abdb7);throw _0x2abdb7;});}return _0x47f17a;})[_0xfef0('0x27')](respondWithResult(_0x523763,0xc9))['catch'](handleError(_0x523763,null));};exports[_0xfef0('0x60')]=function(_0x3c5640,_0xd6de4d){if(_0x3c5640[_0xfef0('0x56')]['id']){delete _0x3c5640[_0xfef0('0x56')]['id'];}return db[_0xfef0('0x3c')][_0xfef0('0x35')]({'where':{'id':_0x3c5640[_0xfef0('0x54')]['id']}})[_0xfef0('0x27')](handleEntityNotFound(_0xd6de4d,null))[_0xfef0('0x27')](function(_0x2acb4e){if(_0x2acb4e){return db[_0xfef0('0x3c')]['update'](_[_0xfef0('0x4c')](_0x3c5640[_0xfef0('0x56')],[_0xfef0('0x58'),_0xfef0('0x61'),_0xfef0('0x62'),'recordingFormat',_0xfef0('0x63'),_0xfef0('0x64')]),{'where':{'context':_0x2acb4e[_0xfef0('0x61')],'exten':_0x2acb4e[_0xfef0('0x58')]},'individualHooks':!![]})[_0xfef0('0x27')](function(_0x1765e2){return _0x1765e2;});}return null;})[_0xfef0('0x27')](respondWithStatusCode(_0xd6de4d,null))[_0xfef0('0x53')](handleError(_0xd6de4d,null));};exports[_0xfef0('0x65')]=function(_0x3f26d9,_0x4f7ad3,_0x100c6a){return db['VoiceExtension'][_0xfef0('0x66')]({'where':{'id':_0x3f26d9[_0xfef0('0x54')]['id']}})['then'](handleEntityNotFound(_0x4f7ad3,null))[_0xfef0('0x27')](function(_0x20c2ec){if(_0x20c2ec){return db[_0xfef0('0x67')][_0xfef0('0x68')](function(_0x1e0ad5){return db['VoiceExtension'][_0xfef0('0x28')]({'where':{'VoiceExtensionId':_0x3f26d9[_0xfef0('0x54')]['id']},'transaction':_0x1e0ad5})[_0xfef0('0x27')](function(_0x4f0737){var _0x117b74=_[_0xfef0('0x31')](_0x3f26d9[_0xfef0('0x56')],function(_0x6f759a){_0x6f759a[_0xfef0('0x69')]=_0x3f26d9[_0xfef0('0x54')]['id'];return _0x6f759a;});return db[_0xfef0('0x3c')]['bulkCreate'](_0x117b74,{'transaction':_0x1e0ad5});});})[_0xfef0('0x27')](function(){return db[_0xfef0('0x3c')][_0xfef0('0x6a')]({'where':{'isApp':!![],'VoiceExtensionId':_0x3f26d9[_0xfef0('0x54')]['id']},'order':_0xfef0('0x6b')});});}})[_0xfef0('0x27')](respondWithResult(_0x4f7ad3,null))['catch'](handleError(_0x4f7ad3,null));}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.events.js b/server/api/voiceExtension/voiceExtension.events.js index 9998ad4..a0ddeee 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 _0x78b6=['save','update','remove','hasOwnProperty','exports','events','VoiceExtension','setMaxListeners'];(function(_0x252fd0,_0x33bf8a){var _0x41e841=function(_0x511779){while(--_0x511779){_0x252fd0['push'](_0x252fd0['shift']());}};_0x41e841(++_0x33bf8a);}(_0x78b6,0x75));var _0x678b=function(_0x334524,_0x1fca82){_0x334524=_0x334524-0x0;var _0x870ae9=_0x78b6[_0x334524];return _0x870ae9;};'use strict';var EventEmitter=require(_0x678b('0x0'));var VoiceExtension=require('../../mysqldb')['db'][_0x678b('0x1')];var VoiceExtensionEvents=new EventEmitter();VoiceExtensionEvents[_0x678b('0x2')](0x0);var events={'afterCreate':_0x678b('0x3'),'afterUpdate':_0x678b('0x4'),'afterDestroy':_0x678b('0x5')};function emitEvent(_0x41f815){return function(_0x445003,_0x33fd38,_0x11f75b){VoiceExtensionEvents['emit'](_0x41f815+':'+_0x445003['id'],_0x445003);VoiceExtensionEvents['emit'](_0x41f815,_0x445003);_0x11f75b(null);};}for(var e in events){if(events[_0x678b('0x6')](e)){var event=events[e];VoiceExtension['hook'](e,emitEvent(event));}}module[_0x678b('0x7')]=VoiceExtensionEvents; \ No newline at end of file +var _0xd6b9=['setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports','../../mysqldb','VoiceExtension'];(function(_0x1939e1,_0x386ccc){var _0x852e36=function(_0x5400a7){while(--_0x5400a7){_0x1939e1['push'](_0x1939e1['shift']());}};_0x852e36(++_0x386ccc);}(_0xd6b9,0xee));var _0x9d6b=function(_0x1c1483,_0x344989){_0x1c1483=_0x1c1483-0x0;var _0x435d4d=_0xd6b9[_0x1c1483];return _0x435d4d;};'use strict';var EventEmitter=require('events');var VoiceExtension=require(_0x9d6b('0x0'))['db'][_0x9d6b('0x1')];var VoiceExtensionEvents=new EventEmitter();VoiceExtensionEvents[_0x9d6b('0x2')](0x0);var events={'afterCreate':_0x9d6b('0x3'),'afterUpdate':_0x9d6b('0x4'),'afterDestroy':_0x9d6b('0x5')};function emitEvent(_0x272069){return function(_0xfde96b,_0x12ffb3,_0x285775){VoiceExtensionEvents[_0x9d6b('0x6')](_0x272069+':'+_0xfde96b['id'],_0xfde96b);VoiceExtensionEvents[_0x9d6b('0x6')](_0x272069,_0xfde96b);_0x285775(null);};}for(var e in events){if(events[_0x9d6b('0x7')](e)){var event=events[e];VoiceExtension[_0x9d6b('0x8')](e,emitEvent(event));}}module[_0x9d6b('0x9')]=VoiceExtensionEvents; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.model.js b/server/api/voiceExtension/voiceExtension.model.js index c903e80..832a88f 100644 --- a/server/api/voiceExtension/voiceExtension.model.js +++ b/server/api/voiceExtension/voiceExtension.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5f2f=['bluebird','request-promise','path','./voiceExtension.attributes','exports','define','VoiceExtension','lodash','util','../../config/logger','api','moment'];(function(_0x3650a2,_0x1bc6ae){var _0x1e2ed7=function(_0x2ab7c4){while(--_0x2ab7c4){_0x3650a2['push'](_0x3650a2['shift']());}};_0x1e2ed7(++_0x1bc6ae);}(_0x5f2f,0x73));var _0xf5f2=function(_0x17dcbe,_0x4969ac){_0x17dcbe=_0x17dcbe-0x0;var _0x6065ba=_0x5f2f[_0x17dcbe];return _0x6065ba;};'use strict';var _=require(_0xf5f2('0x0'));var util=require(_0xf5f2('0x1'));var logger=require(_0xf5f2('0x2'))(_0xf5f2('0x3'));var moment=require(_0xf5f2('0x4'));var BPromise=require(_0xf5f2('0x5'));var rp=require(_0xf5f2('0x6'));var fs=require('fs');var path=require(_0xf5f2('0x7'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xf5f2('0x8'));module[_0xf5f2('0x9')]=function(_0xad7f65,_0x3eebf6){return _0xad7f65[_0xf5f2('0xa')](_0xf5f2('0xb'),attributes,{'tableName':'voice_extensions','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0b0e=['path','rimraf','../../config/environment','./voiceExtension.attributes','exports','define','lodash','../../config/logger','moment','bluebird','request-promise'];(function(_0x332cca,_0x27d1ee){var _0xe67530=function(_0x12fa75){while(--_0x12fa75){_0x332cca['push'](_0x332cca['shift']());}};_0xe67530(++_0x27d1ee);}(_0x0b0e,0x187));var _0xe0b0=function(_0x16cb03,_0x43ea58){_0x16cb03=_0x16cb03-0x0;var _0x10944e=_0x0b0e[_0x16cb03];return _0x10944e;};'use strict';var _=require(_0xe0b0('0x0'));var util=require('util');var logger=require(_0xe0b0('0x1'))('api');var moment=require(_0xe0b0('0x2'));var BPromise=require(_0xe0b0('0x3'));var rp=require(_0xe0b0('0x4'));var fs=require('fs');var path=require(_0xe0b0('0x5'));var rimraf=require(_0xe0b0('0x6'));var config=require(_0xe0b0('0x7'));var attributes=require(_0xe0b0('0x8'));module[_0xe0b0('0x9')]=function(_0x30e20d,_0x28e40f){return _0x30e20d[_0xe0b0('0xa')]('VoiceExtension',attributes,{'tableName':'voice_extensions','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.rpc.js b/server/api/voiceExtension/voiceExtension.rpc.js index e6bfffe..30bd38b 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 _0x573e=['model','then','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','jayson/promise','client','http','redis','defaults','socket.io-emitter','./voiceExtension.socket','register','VoiceExtension,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','catch','GetVoiceExtension','options','raw','where','limit','include','attributes','map'];(function(_0xe0e895,_0xf51c5c){var _0x222093=function(_0x295062){while(--_0x295062){_0xe0e895['push'](_0xe0e895['shift']());}};_0x222093(++_0xf51c5c);}(_0x573e,0x68));var _0xe573=function(_0x1df638,_0x41f1c8){_0x1df638=_0x1df638-0x0;var _0x2b97a3=_0x573e[_0x1df638];return _0x2b97a3;};'use strict';var _=require(_0xe573('0x0'));var util=require('util');var moment=require(_0xe573('0x1'));var BPromise=require(_0xe573('0x2'));var rs=require(_0xe573('0x3'));var fs=require('fs');var Redis=require(_0xe573('0x4'));var db=require(_0xe573('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xe573('0x6'));var config=require('../../config/environment');var jayson=require(_0xe573('0x7'));var client=jayson[_0xe573('0x8')][_0xe573('0x9')]({'port':0x232a});config[_0xe573('0xa')]=_[_0xe573('0xb')](config[_0xe573('0xa')],{'host':'localhost','port':0x18eb});var socket=require(_0xe573('0xc'))(new Redis(config[_0xe573('0xa')]));require(_0xe573('0xd'))[_0xe573('0xe')](socket);function respondWithRpcPromise(_0x4479e8,_0x45b3c7,_0xed8f39){return new BPromise(function(_0x4ab386,_0x54cdb2){return client['request'](_0x4479e8,_0xed8f39)['then'](function(_0x49f77c){logger['info'](_0xe573('0xf'),_0x45b3c7,_0xe573('0x10'));logger[_0xe573('0x11')]('VoiceExtension,\x20%s,\x20%s,\x20%s',_0x45b3c7,'request\x20sent',JSON[_0xe573('0x12')](_0x49f77c));if(_0x49f77c[_0xe573('0x13')]){if(_0x49f77c[_0xe573('0x13')][_0xe573('0x14')]===0x1f4){logger['error'](_0xe573('0xf'),_0x45b3c7,_0x49f77c['error'][_0xe573('0x15')]);return _0x54cdb2(_0x49f77c[_0xe573('0x13')][_0xe573('0x15')]);}logger[_0xe573('0x13')](_0xe573('0xf'),_0x45b3c7,_0x49f77c['error'][_0xe573('0x15')]);return _0x4ab386(_0x49f77c[_0xe573('0x13')]['message']);}else{logger[_0xe573('0x16')]('VoiceExtension,\x20%s,\x20%s',_0x45b3c7,_0xe573('0x10'));_0x4ab386(_0x49f77c['result'][_0xe573('0x15')]);}})[_0xe573('0x17')](function(_0x5ae71b){logger[_0xe573('0x13')]('VoiceExtension,\x20%s,\x20%s',_0x45b3c7,_0x5ae71b);_0x54cdb2(_0x5ae71b);});});}exports[_0xe573('0x18')]=function(_0x2fc681){var _0x16ee43=this;return new Promise(function(_0x3ab67c,_0x1e4d19){return db['VoiceExtension']['findAll']({'raw':_0x2fc681['options']?_0x2fc681[_0xe573('0x19')][_0xe573('0x1a')]===undefined?!![]:![]:!![],'where':_0x2fc681[_0xe573('0x19')]?_0x2fc681[_0xe573('0x19')][_0xe573('0x1b')]||null:null,'attributes':_0x2fc681['options']?_0x2fc681[_0xe573('0x19')]['attributes']||null:null,'limit':_0x2fc681[_0xe573('0x19')]?_0x2fc681['options'][_0xe573('0x1c')]||null:null,'include':_0x2fc681['options']?_0x2fc681['options'][_0xe573('0x1d')]?_['map'](_0x2fc681[_0xe573('0x19')][_0xe573('0x1d')],function(_0x12dda1){return{'model':db[_0x12dda1['model']],'as':_0x12dda1['as'],'attributes':_0x12dda1[_0xe573('0x1e')],'include':_0x12dda1['include']?_[_0xe573('0x1f')](_0x12dda1[_0xe573('0x1d')],function(_0x598c75){return{'model':db[_0x598c75[_0xe573('0x20')]],'as':_0x598c75['as'],'attributes':_0x598c75[_0xe573('0x1e')],'include':_0x598c75[_0xe573('0x1d')]?_[_0xe573('0x1f')](_0x598c75[_0xe573('0x1d')],function(_0x1903f2){return{'model':db[_0x1903f2[_0xe573('0x20')]],'as':_0x1903f2['as'],'attributes':_0x1903f2['attributes']};}):[]};}):[]};}):[]:[]})[_0xe573('0x21')](function(_0x44e38e){logger[_0xe573('0x16')](_0xe573('0x18'),_0x2fc681);logger[_0xe573('0x11')](_0xe573('0x18'),_0x2fc681,JSON['stringify'](_0x44e38e));_0x3ab67c(_0x44e38e);})[_0xe573('0x17')](function(_0x51d1b8){logger[_0xe573('0x13')]('GetVoiceExtension',_0x51d1b8[_0xe573('0x15')],_0x2fc681);_0x1e4d19(_0x16ee43['error'](0x1f4,_0x51d1b8[_0xe573('0x15')]));});});}; \ No newline at end of file +var _0x2d76=['util','bluebird','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','./voiceExtension.socket','register','request','then','info','VoiceExtension,\x20%s,\x20%s','VoiceExtension,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','VoiceExtension','findAll','options','raw','where','attributes','limit','include','map','model','GetVoiceExtension','debug','lodash'];(function(_0x47c60a,_0x433c7f){var _0x2d1a3d=function(_0x250f35){while(--_0x250f35){_0x47c60a['push'](_0x47c60a['shift']());}};_0x2d1a3d(++_0x433c7f);}(_0x2d76,0x1a1));var _0x62d7=function(_0x4f027d,_0x3f9587){_0x4f027d=_0x4f027d-0x0;var _0xc46890=_0x2d76[_0x4f027d];return _0xc46890;};'use strict';var _=require(_0x62d7('0x0'));var util=require(_0x62d7('0x1'));var moment=require('moment');var BPromise=require(_0x62d7('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x62d7('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x62d7('0x4'))(_0x62d7('0x5'));var config=require(_0x62d7('0x6'));var jayson=require(_0x62d7('0x7'));var client=jayson[_0x62d7('0x8')][_0x62d7('0x9')]({'port':0x232a});config[_0x62d7('0xa')]=_[_0x62d7('0xb')](config[_0x62d7('0xa')],{'host':_0x62d7('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x62d7('0xa')]));require(_0x62d7('0xd'))[_0x62d7('0xe')](socket);function respondWithRpcPromise(_0x2a7f16,_0x2d0170,_0xe77f7e){return new BPromise(function(_0x56562f,_0x15a547){return client[_0x62d7('0xf')](_0x2a7f16,_0xe77f7e)[_0x62d7('0x10')](function(_0x3f8b0a){logger[_0x62d7('0x11')](_0x62d7('0x12'),_0x2d0170,'request\x20sent');logger['debug'](_0x62d7('0x13'),_0x2d0170,_0x62d7('0x14'),JSON[_0x62d7('0x15')](_0x3f8b0a));if(_0x3f8b0a[_0x62d7('0x16')]){if(_0x3f8b0a[_0x62d7('0x16')]['code']===0x1f4){logger[_0x62d7('0x16')](_0x62d7('0x12'),_0x2d0170,_0x3f8b0a[_0x62d7('0x16')][_0x62d7('0x17')]);return _0x15a547(_0x3f8b0a[_0x62d7('0x16')][_0x62d7('0x17')]);}logger['error']('VoiceExtension,\x20%s,\x20%s',_0x2d0170,_0x3f8b0a[_0x62d7('0x16')][_0x62d7('0x17')]);return _0x56562f(_0x3f8b0a[_0x62d7('0x16')][_0x62d7('0x17')]);}else{logger[_0x62d7('0x11')]('VoiceExtension,\x20%s,\x20%s',_0x2d0170,'request\x20sent');_0x56562f(_0x3f8b0a[_0x62d7('0x18')]['message']);}})[_0x62d7('0x19')](function(_0x61252c){logger[_0x62d7('0x16')]('VoiceExtension,\x20%s,\x20%s',_0x2d0170,_0x61252c);_0x15a547(_0x61252c);});});}exports['GetVoiceExtension']=function(_0x501a09){var _0x38d11b=this;return new Promise(function(_0x1b0866,_0x3584d2){return db[_0x62d7('0x1a')][_0x62d7('0x1b')]({'raw':_0x501a09['options']?_0x501a09[_0x62d7('0x1c')][_0x62d7('0x1d')]===undefined?!![]:![]:!![],'where':_0x501a09[_0x62d7('0x1c')]?_0x501a09[_0x62d7('0x1c')][_0x62d7('0x1e')]||null:null,'attributes':_0x501a09[_0x62d7('0x1c')]?_0x501a09[_0x62d7('0x1c')][_0x62d7('0x1f')]||null:null,'limit':_0x501a09[_0x62d7('0x1c')]?_0x501a09[_0x62d7('0x1c')][_0x62d7('0x20')]||null:null,'include':_0x501a09[_0x62d7('0x1c')]?_0x501a09[_0x62d7('0x1c')][_0x62d7('0x21')]?_[_0x62d7('0x22')](_0x501a09[_0x62d7('0x1c')][_0x62d7('0x21')],function(_0x32fceb){return{'model':db[_0x32fceb[_0x62d7('0x23')]],'as':_0x32fceb['as'],'attributes':_0x32fceb[_0x62d7('0x1f')],'include':_0x32fceb['include']?_[_0x62d7('0x22')](_0x32fceb[_0x62d7('0x21')],function(_0x273f49){return{'model':db[_0x273f49[_0x62d7('0x23')]],'as':_0x273f49['as'],'attributes':_0x273f49[_0x62d7('0x1f')],'include':_0x273f49[_0x62d7('0x21')]?_[_0x62d7('0x22')](_0x273f49['include'],function(_0x56e4b9){return{'model':db[_0x56e4b9['model']],'as':_0x56e4b9['as'],'attributes':_0x56e4b9['attributes']};}):[]};}):[]};}):[]:[]})[_0x62d7('0x10')](function(_0x59997d){logger[_0x62d7('0x11')](_0x62d7('0x24'),_0x501a09);logger[_0x62d7('0x25')](_0x62d7('0x24'),_0x501a09,JSON[_0x62d7('0x15')](_0x59997d));_0x1b0866(_0x59997d);})[_0x62d7('0x19')](function(_0x4602bd){logger[_0x62d7('0x16')](_0x62d7('0x24'),_0x4602bd[_0x62d7('0x17')],_0x501a09);_0x3584d2(_0x38d11b['error'](0x1f4,_0x4602bd[_0x62d7('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.socket.js b/server/api/voiceExtension/voiceExtension.socket.js index 4ffab86..083776a 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 _0x11a7=['remove','emit','register','length','voiceExtension:','./voiceExtension.events','save'];(function(_0x8419b9,_0x2809d9){var _0x522340=function(_0xa8885){while(--_0xa8885){_0x8419b9['push'](_0x8419b9['shift']());}};_0x522340(++_0x2809d9);}(_0x11a7,0x15c));var _0x711a=function(_0x109c40,_0x3463fa){_0x109c40=_0x109c40-0x0;var _0x3d5aed=_0x11a7[_0x109c40];return _0x3d5aed;};'use strict';var VoiceExtensionEvents=require(_0x711a('0x0'));var events=[_0x711a('0x1'),_0x711a('0x2'),'update'];function createListener(_0x5b48fb,_0x5514c8){return function(_0x1bb281){_0x5514c8[_0x711a('0x3')](_0x5b48fb,_0x1bb281);};}function removeListener(_0x214219,_0x4a10b1){return function(){VoiceExtensionEvents['removeListener'](_0x214219,_0x4a10b1);};}exports[_0x711a('0x4')]=function(_0x1839e3){for(var _0x3c78fb=0x0,_0x3bc415=events[_0x711a('0x5')];_0x3c78fb<_0x3bc415;_0x3c78fb++){var _0x1d392a=events[_0x3c78fb];var _0x19088e=createListener(_0x711a('0x6')+_0x1d392a,_0x1839e3);VoiceExtensionEvents['on'](_0x1d392a,_0x19088e);}}; \ No newline at end of file +var _0xe1a2=['register','length','voiceExtension:','./voiceExtension.events','save','remove','update','emit','removeListener'];(function(_0x15ef66,_0x5cdaf9){var _0x5bd16b=function(_0x5550ea){while(--_0x5550ea){_0x15ef66['push'](_0x15ef66['shift']());}};_0x5bd16b(++_0x5cdaf9);}(_0xe1a2,0x162));var _0x2e1a=function(_0x71e493,_0x4308b7){_0x71e493=_0x71e493-0x0;var _0x3d40ab=_0xe1a2[_0x71e493];return _0x3d40ab;};'use strict';var VoiceExtensionEvents=require(_0x2e1a('0x0'));var events=[_0x2e1a('0x1'),_0x2e1a('0x2'),_0x2e1a('0x3')];function createListener(_0x341ffe,_0x285d01){return function(_0x14d226){_0x285d01[_0x2e1a('0x4')](_0x341ffe,_0x14d226);};}function removeListener(_0x51a5e2,_0x47372b){return function(){VoiceExtensionEvents[_0x2e1a('0x5')](_0x51a5e2,_0x47372b);};}exports[_0x2e1a('0x6')]=function(_0x4463c3){for(var _0x588b86=0x0,_0x199e96=events[_0x2e1a('0x7')];_0x588b86<_0x199e96;_0x588b86++){var _0x346eac=events[_0x588b86];var _0x170840=createListener(_0x2e1a('0x8')+_0x346eac,_0x4463c3);VoiceExtensionEvents['on'](_0x346eac,_0x170840);}}; \ No newline at end of file diff --git a/server/api/voiceMail/index.js b/server/api/voiceMail/index.js index 15291c7..2286eea 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 _0xe481=['util','path','connect-timeout','express','../../components/interaction/service','../../config/environment','./voiceMail.controller','get','isAuthenticated','/:id','show','/:id/messages','getMessages','create','delete','destroy','multer'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0xe481,0x153));var _0x1e48=function(_0x29a3b7,_0x18d6b6){_0x29a3b7=_0x29a3b7-0x0;var _0x4ab7b2=_0xe481[_0x29a3b7];return _0x4ab7b2;};'use strict';var multer=require(_0x1e48('0x0'));var util=require(_0x1e48('0x1'));var path=require(_0x1e48('0x2'));var timeout=require(_0x1e48('0x3'));var express=require(_0x1e48('0x4'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0x1e48('0x5'));var config=require(_0x1e48('0x6'));var controller=require(_0x1e48('0x7'));router[_0x1e48('0x8')]('/',auth[_0x1e48('0x9')](),controller['index']);router['get'](_0x1e48('0xa'),auth[_0x1e48('0x9')](),controller[_0x1e48('0xb')]);router[_0x1e48('0x8')](_0x1e48('0xc'),auth[_0x1e48('0x9')](),controller[_0x1e48('0xd')]);router['post']('/',auth[_0x1e48('0x9')](),controller[_0x1e48('0xe')]);router['put']('/:id',auth[_0x1e48('0x9')](),controller['update']);router[_0x1e48('0xf')](_0x1e48('0xa'),auth['isAuthenticated'](),controller[_0x1e48('0x10')]);module['exports']=router; \ No newline at end of file +var _0x8152=['exports','util','path','../../components/interaction/service','../../config/environment','./voiceMail.controller','isAuthenticated','index','/:id','show','/:id/messages','getMessages','post','create','put','update','delete','destroy'];(function(_0x55f004,_0x57bd0b){var _0xd0620a=function(_0x265995){while(--_0x265995){_0x55f004['push'](_0x55f004['shift']());}};_0xd0620a(++_0x57bd0b);}(_0x8152,0x19f));var _0x2815=function(_0x42fc12,_0x51f9a8){_0x42fc12=_0x42fc12-0x0;var _0x586edd=_0x8152[_0x42fc12];return _0x586edd;};'use strict';var multer=require('multer');var util=require(_0x2815('0x0'));var path=require(_0x2815('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0x2815('0x2'));var config=require(_0x2815('0x3'));var controller=require(_0x2815('0x4'));router['get']('/',auth[_0x2815('0x5')](),controller[_0x2815('0x6')]);router['get'](_0x2815('0x7'),auth[_0x2815('0x5')](),controller[_0x2815('0x8')]);router['get'](_0x2815('0x9'),auth[_0x2815('0x5')](),controller[_0x2815('0xa')]);router[_0x2815('0xb')]('/',auth[_0x2815('0x5')](),controller[_0x2815('0xc')]);router[_0x2815('0xd')](_0x2815('0x7'),auth[_0x2815('0x5')](),controller[_0x2815('0xe')]);router[_0x2815('0xf')]('/:id',auth[_0x2815('0x5')](),controller[_0x2815('0x10')]);module[_0x2815('0x11')]=router; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.attributes.js b/server/api/voiceMail/voiceMail.attributes.js index 6425661..8bb89d4 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 _0xac4a=['contest_mailbox','setDataValue','string','trim','ENUM','yes','TINYINT(4)','TIMESTAMP','INTEGER','getDataValue','fullname','\x20-\x20','mailbox','sequelize','exports','STRING','from-voicemail'];(function(_0x4fd03b,_0x1bbda2){var _0x5eaf4a=function(_0x908a80){while(--_0x908a80){_0x4fd03b['push'](_0x4fd03b['shift']());}};_0x5eaf4a(++_0x1bbda2);}(_0xac4a,0x13f));var _0xaac4=function(_0x192e16,_0x467ce1){_0x192e16=_0x192e16-0x0;var _0x583f3d=_0xac4a[_0x192e16];return _0x583f3d;};'use strict';var Sequelize=require(_0xaac4('0x0'));module[_0xaac4('0x1')]={'customer_id':{'type':Sequelize[_0xaac4('0x2')]},'context':{'type':Sequelize[_0xaac4('0x2')],'defaultValue':_0xaac4('0x3'),'unique':_0xaac4('0x4')},'mailbox':{'type':Sequelize['STRING'],'defaultValue':'','allowNull':![],'unique':'contest_mailbox'},'password':{'type':Sequelize[_0xaac4('0x2')]},'fullname':{'type':Sequelize[_0xaac4('0x2')]},'email':{'type':Sequelize[_0xaac4('0x2')],'validate':{'isEmail':!![]},'set':function(_0x58ae95){this[_0xaac4('0x5')]('email',typeof _0x58ae95===_0xaac4('0x6')&&_0x58ae95['trim']()?_0x58ae95[_0xaac4('0x7')]():null);}},'pager':{'type':Sequelize[_0xaac4('0x2')]},'tz':{'type':Sequelize['STRING'],'defaultValue':'central'},'attach':{'type':Sequelize[_0xaac4('0x8')]('yes','no'),'defaultValue':_0xaac4('0x9'),'allowNull':![]},'saycid':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':_0xaac4('0x9'),'allowNull':![]},'dialout':{'type':Sequelize[_0xaac4('0x2')]},'callback':{'type':Sequelize[_0xaac4('0x2')]},'review':{'type':Sequelize[_0xaac4('0x8')](_0xaac4('0x9'),'no'),'defaultValue':'no','allowNull':![]},'operator':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'no','allowNull':![]},'envelope':{'type':Sequelize[_0xaac4('0x8')](_0xaac4('0x9'),'no'),'defaultValue':'no','allowNull':![]},'sayduration':{'type':Sequelize[_0xaac4('0x8')]('yes','no'),'defaultValue':'no','allowNull':![]},'saydurationm':{'type':_0xaac4('0xa'),'defaultValue':0x1,'allowNull':![]},'sendvoicemail':{'type':Sequelize[_0xaac4('0x8')]('yes','no'),'defaultValue':'no','allowNull':![]},'delete':{'type':Sequelize[_0xaac4('0x8')](_0xaac4('0x9'),'no'),'defaultValue':'no','allowNull':![]},'nextaftercmd':{'type':Sequelize[_0xaac4('0x8')](_0xaac4('0x9'),'no'),'defaultValue':_0xaac4('0x9'),'allowNull':![]},'forcename':{'type':Sequelize[_0xaac4('0x8')](_0xaac4('0x9'),'no'),'defaultValue':'no','allowNull':![]},'forcegreetings':{'type':Sequelize[_0xaac4('0x8')](_0xaac4('0x9'),'no'),'defaultValue':'no','allowNull':![]},'hidefromdir':{'type':Sequelize[_0xaac4('0x8')](_0xaac4('0x9'),'no'),'defaultValue':_0xaac4('0x9'),'allowNull':![]},'stamp':{'type':_0xaac4('0xb')},'emailsubject':{'type':Sequelize['STRING']},'emailbody':{'type':Sequelize[_0xaac4('0x2')]},'maxsecs':{'type':Sequelize['INTEGER'](0xff),'defaultValue':0xb4,'allowNull':![]},'maxmsg':{'type':Sequelize[_0xaac4('0xc')](0xff),'defaultValue':0x64,'allowNull':![]},'name':{'type':Sequelize['VIRTUAL'],'get':function(){return this[_0xaac4('0xd')](_0xaac4('0xe'))+_0xaac4('0xf')+this[_0xaac4('0xd')](_0xaac4('0x10'));}}}; \ No newline at end of file +var _0x0713=['trim','central','ENUM','yes','TIMESTAMP','INTEGER','VIRTUAL','getDataValue','fullname','\x20-\x20','STRING','from-voicemail','contest_mailbox','setDataValue','email','string'];(function(_0x3a6c22,_0x25539e){var _0x61930a=function(_0x69ae65){while(--_0x69ae65){_0x3a6c22['push'](_0x3a6c22['shift']());}};_0x61930a(++_0x25539e);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require('sequelize');module['exports']={'customer_id':{'type':Sequelize[_0x3071('0x0')]},'context':{'type':Sequelize[_0x3071('0x0')],'defaultValue':_0x3071('0x1'),'unique':_0x3071('0x2')},'mailbox':{'type':Sequelize[_0x3071('0x0')],'defaultValue':'','allowNull':![],'unique':'contest_mailbox'},'password':{'type':Sequelize[_0x3071('0x0')]},'fullname':{'type':Sequelize[_0x3071('0x0')]},'email':{'type':Sequelize[_0x3071('0x0')],'validate':{'isEmail':!![]},'set':function(_0x3137c8){this[_0x3071('0x3')](_0x3071('0x4'),typeof _0x3137c8===_0x3071('0x5')&&_0x3137c8[_0x3071('0x6')]()?_0x3137c8[_0x3071('0x6')]():null);}},'pager':{'type':Sequelize[_0x3071('0x0')]},'tz':{'type':Sequelize[_0x3071('0x0')],'defaultValue':_0x3071('0x7')},'attach':{'type':Sequelize[_0x3071('0x8')]('yes','no'),'defaultValue':_0x3071('0x9'),'allowNull':![]},'saycid':{'type':Sequelize[_0x3071('0x8')](_0x3071('0x9'),'no'),'defaultValue':_0x3071('0x9'),'allowNull':![]},'dialout':{'type':Sequelize[_0x3071('0x0')]},'callback':{'type':Sequelize['STRING']},'review':{'type':Sequelize[_0x3071('0x8')](_0x3071('0x9'),'no'),'defaultValue':'no','allowNull':![]},'operator':{'type':Sequelize[_0x3071('0x8')](_0x3071('0x9'),'no'),'defaultValue':'no','allowNull':![]},'envelope':{'type':Sequelize[_0x3071('0x8')]('yes','no'),'defaultValue':'no','allowNull':![]},'sayduration':{'type':Sequelize['ENUM'](_0x3071('0x9'),'no'),'defaultValue':'no','allowNull':![]},'saydurationm':{'type':'TINYINT(4)','defaultValue':0x1,'allowNull':![]},'sendvoicemail':{'type':Sequelize[_0x3071('0x8')](_0x3071('0x9'),'no'),'defaultValue':'no','allowNull':![]},'delete':{'type':Sequelize['ENUM'](_0x3071('0x9'),'no'),'defaultValue':'no','allowNull':![]},'nextaftercmd':{'type':Sequelize['ENUM'](_0x3071('0x9'),'no'),'defaultValue':_0x3071('0x9'),'allowNull':![]},'forcename':{'type':Sequelize[_0x3071('0x8')](_0x3071('0x9'),'no'),'defaultValue':'no','allowNull':![]},'forcegreetings':{'type':Sequelize[_0x3071('0x8')](_0x3071('0x9'),'no'),'defaultValue':'no','allowNull':![]},'hidefromdir':{'type':Sequelize[_0x3071('0x8')](_0x3071('0x9'),'no'),'defaultValue':_0x3071('0x9'),'allowNull':![]},'stamp':{'type':_0x3071('0xa')},'emailsubject':{'type':Sequelize['STRING']},'emailbody':{'type':Sequelize[_0x3071('0x0')]},'maxsecs':{'type':Sequelize[_0x3071('0xb')](0xff),'defaultValue':0xb4,'allowNull':![]},'maxmsg':{'type':Sequelize[_0x3071('0xb')](0xff),'defaultValue':0x64,'allowNull':![]},'name':{'type':Sequelize[_0x3071('0xc')],'get':function(){return this[_0x3071('0xd')](_0x3071('0xe'))+_0x3071('0xf')+this[_0x3071('0xd')]('mailbox');}}}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.controller.js b/server/api/voiceMail/voiceMail.controller.js index 7eff43b..69528f8 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 _0x3217=['catch','show','params','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','getMessages','findOne','VoiceMailMessage','mailbox','findAndCountAll','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','json','count','offset','limit','Content-Range','apply','reject','save','update','destroy','then','get','Voicemails','UserProfileResource','error','stack','name','index','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','pick','where','merge','map','VIRTUAL','filter','options','VoiceMail','includeAll','include','findAll','rows'];(function(_0x98a27a,_0x274d8e){var _0x3e9725=function(_0x2bcef7){while(--_0x2bcef7){_0x98a27a['push'](_0x98a27a['shift']());}};_0x3e9725(++_0x274d8e);}(_0x3217,0x1d3));var _0x7321=function(_0x26c67f,_0x3c9fab){_0x26c67f=_0x26c67f-0x0;var _0x563266=_0x3217[_0x26c67f];return _0x563266;};'use strict';var pdf=require(_0x7321('0x0'));var emlformat=require(_0x7321('0x1'));var rimraf=require(_0x7321('0x2'));var zipdir=require(_0x7321('0x3'));var jsonpatch=require(_0x7321('0x4'));var rp=require(_0x7321('0x5'));var moment=require(_0x7321('0x6'));var BPromise=require(_0x7321('0x7'));var Mustache=require(_0x7321('0x8'));var util=require(_0x7321('0x9'));var path=require(_0x7321('0xa'));var sox=require(_0x7321('0xb'));var csv=require(_0x7321('0xc'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x7321('0xd'));var squel=require(_0x7321('0xe'));var crypto=require(_0x7321('0xf'));var jsforce=require(_0x7321('0x10'));var deskjs=require(_0x7321('0x11'));var toCsv=require(_0x7321('0xc'));var querystring=require(_0x7321('0x12'));var Papa=require(_0x7321('0x13'));var Redis=require('ioredis');var authService=require(_0x7321('0x14'));var qs=require('../../components/parsers/qs');var as=require(_0x7321('0x15'));var hardwareService=require(_0x7321('0x16'));var logger=require(_0x7321('0x17'))(_0x7321('0x18'));var utils=require('../../config/utils');var config=require(_0x7321('0x19'));var db=require(_0x7321('0x1a'))['db'];function respondWithStatusCode(_0x2c9eae,_0x2987ab){_0x2987ab=_0x2987ab||0xcc;return function(_0xb0581a){if(_0xb0581a){return _0x2c9eae[_0x7321('0x1b')](_0x2987ab);}return _0x2c9eae[_0x7321('0x1c')](_0x2987ab)['end']();};}function respondWithResult(_0x5c2333,_0x49d5af){_0x49d5af=_0x49d5af||0xc8;return function(_0x19f5c7){if(_0x19f5c7){return _0x5c2333['status'](_0x49d5af)[_0x7321('0x1d')](_0x19f5c7);}};}function respondWithFilteredResult(_0x4ba662,_0x5bbf58){return function(_0x7edf27){if(_0x7edf27){var _0x3b9f97=_0x7edf27[_0x7321('0x1e')],_0xf82c00=_0x5bbf58[_0x7321('0x1f')],_0x1303d1=_0x5bbf58[_0x7321('0x1f')]+_0x5bbf58[_0x7321('0x20')],_0x3dd6a5;if(_0x1303d1>=_0x3b9f97){_0x1303d1=_0x3b9f97;_0x3dd6a5=0xc8;}else{_0x3dd6a5=0xce;}_0x4ba662[_0x7321('0x1c')](_0x3dd6a5);return _0x4ba662['set'](_0x7321('0x21'),_0xf82c00+'-'+_0x1303d1+'/'+_0x3b9f97)[_0x7321('0x1d')](_0x7edf27);}return null;};}function patchUpdates(_0x3a32ce){return function(_0xf9b954){try{jsonpatch[_0x7321('0x22')](_0xf9b954,_0x3a32ce,!![]);}catch(_0x3862c7){return BPromise[_0x7321('0x23')](_0x3862c7);}return _0xf9b954[_0x7321('0x24')]();};}function saveUpdates(_0x3a323e,_0x2ed124){return function(_0x327f1a){if(_0x327f1a){return _0x327f1a[_0x7321('0x25')](_0x3a323e)['then'](function(_0x36f98a){return _0x36f98a;});}return null;};}function removeEntity(_0x72f543,_0x59c623){return function(_0x2f05fb){if(_0x2f05fb){return _0x2f05fb[_0x7321('0x26')]()[_0x7321('0x27')](function(){var _0x18a925=_0x2f05fb[_0x7321('0x28')]({'plain':!![]});var _0x3d4d42=_0x7321('0x29');return db[_0x7321('0x2a')]['destroy']({'where':{'type':_0x3d4d42,'resourceId':_0x18a925['id']}})['then'](function(){return _0x2f05fb;});})['then'](function(){_0x72f543[_0x7321('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x576bb1,_0x3658cb){return function(_0x596d45){if(!_0x596d45){_0x576bb1[_0x7321('0x1b')](0x194);}return _0x596d45;};}function handleError(_0x2744cd,_0x3713d4){_0x3713d4=_0x3713d4||0x1f4;return function(_0x29037a){logger[_0x7321('0x2b')](_0x29037a[_0x7321('0x2c')]);if(_0x29037a['name']){delete _0x29037a[_0x7321('0x2d')];}_0x2744cd[_0x7321('0x1c')](_0x3713d4)['send'](_0x29037a);};}exports[_0x7321('0x2e')]=function(_0x4f42f0,_0x3f42cc){var _0x567008={},_0x4138b5={},_0xad7ad7={'count':0x0,'rows':[]};var _0x10670c=_['map'](db['VoiceMail'][_0x7321('0x2f')],function(_0x462d87){return{'name':_0x462d87[_0x7321('0x30')],'type':_0x462d87[_0x7321('0x31')]['key']};});_0x4138b5[_0x7321('0x32')]=_['map'](_0x10670c,_0x7321('0x2d'));_0x4138b5[_0x7321('0x33')]=_[_0x7321('0x34')](_0x4f42f0[_0x7321('0x33')]);_0x4138b5[_0x7321('0x35')]=_[_0x7321('0x36')](_0x4138b5[_0x7321('0x32')],_0x4138b5[_0x7321('0x33')]);_0x567008[_0x7321('0x37')]=_[_0x7321('0x36')](_0x4138b5[_0x7321('0x32')],qs[_0x7321('0x38')](_0x4f42f0[_0x7321('0x33')][_0x7321('0x38')]));_0x567008['attributes']=_0x567008[_0x7321('0x37')][_0x7321('0x39')]?_0x567008[_0x7321('0x37')]:_0x4138b5[_0x7321('0x32')];if(!_0x4f42f0['query'][_0x7321('0x3a')](_0x7321('0x3b'))){_0x567008[_0x7321('0x20')]=qs[_0x7321('0x20')](_0x4f42f0[_0x7321('0x33')][_0x7321('0x20')]);_0x567008[_0x7321('0x1f')]=qs['offset'](_0x4f42f0[_0x7321('0x33')][_0x7321('0x1f')]);}_0x567008['order']=qs[_0x7321('0x3c')](_0x4f42f0[_0x7321('0x33')][_0x7321('0x3c')]);_0x567008['where']=qs[_0x7321('0x35')](_[_0x7321('0x3d')](_0x4f42f0[_0x7321('0x33')],_0x4138b5[_0x7321('0x35')]),_0x10670c);if(_0x4f42f0['query']['filter']){_0x567008[_0x7321('0x3e')]=_[_0x7321('0x3f')](_0x567008['where'],{'$or':_[_0x7321('0x40')](_0x10670c,function(_0x3a4513){if(_0x3a4513[_0x7321('0x31')]!==_0x7321('0x41')){var _0x288757={};_0x288757[_0x3a4513[_0x7321('0x2d')]]={'$like':'%'+_0x4f42f0[_0x7321('0x33')][_0x7321('0x42')]+'%'};return _0x288757;}})});}_0x567008=_[_0x7321('0x3f')]({},_0x567008,_0x4f42f0[_0x7321('0x43')]);var _0x1b4337={'where':_0x567008[_0x7321('0x3e')]};return db[_0x7321('0x44')][_0x7321('0x1e')](_0x1b4337)[_0x7321('0x27')](function(_0x40464f){_0xad7ad7[_0x7321('0x1e')]=_0x40464f;if(_0x4f42f0[_0x7321('0x33')][_0x7321('0x45')]){_0x567008[_0x7321('0x46')]=[{'all':!![]}];}return db[_0x7321('0x44')][_0x7321('0x47')](_0x567008);})['then'](function(_0x24a4ae){_0xad7ad7[_0x7321('0x48')]=_0x24a4ae;return _0xad7ad7;})[_0x7321('0x27')](respondWithFilteredResult(_0x3f42cc,_0x567008))[_0x7321('0x49')](handleError(_0x3f42cc,null));};exports[_0x7321('0x4a')]=function(_0x3d5376,_0x51a72d){var _0x37b4bb={'raw':!![],'where':{'id':_0x3d5376[_0x7321('0x4b')]['id']}},_0x5ea656={};_0x5ea656['model']=_['keys'](db[_0x7321('0x44')][_0x7321('0x2f')]);_0x5ea656[_0x7321('0x33')]=_[_0x7321('0x34')](_0x3d5376[_0x7321('0x33')]);_0x5ea656[_0x7321('0x35')]=_['intersection'](_0x5ea656['model'],_0x5ea656[_0x7321('0x33')]);_0x37b4bb[_0x7321('0x37')]=_['intersection'](_0x5ea656[_0x7321('0x32')],qs[_0x7321('0x38')](_0x3d5376[_0x7321('0x33')]['fields']));_0x37b4bb[_0x7321('0x37')]=_0x37b4bb[_0x7321('0x37')][_0x7321('0x39')]?_0x37b4bb['attributes']:_0x5ea656[_0x7321('0x32')];if(_0x3d5376[_0x7321('0x33')][_0x7321('0x45')]){_0x37b4bb['include']=[{'all':!![]}];}_0x37b4bb=_[_0x7321('0x3f')]({},_0x37b4bb,_0x3d5376[_0x7321('0x43')]);return db[_0x7321('0x44')][_0x7321('0x4c')](_0x37b4bb)[_0x7321('0x27')](handleEntityNotFound(_0x51a72d,null))[_0x7321('0x27')](respondWithResult(_0x51a72d,null))[_0x7321('0x49')](handleError(_0x51a72d,null));};exports['create']=function(_0x3a953d,_0x274353){return db[_0x7321('0x44')][_0x7321('0x4d')](_0x3a953d[_0x7321('0x4e')],{})['then'](function(_0x555a1c){var _0x5a90bd=_0x3a953d[_0x7321('0x4f')][_0x7321('0x28')]({'plain':!![]});if(!_0x5a90bd)throw new Error(_0x7321('0x50'));if(_0x5a90bd[_0x7321('0x51')]===_0x7321('0x4f')){var _0x13bb07=_0x555a1c['get']({'plain':!![]});var _0x3630ae=_0x7321('0x29');return db[_0x7321('0x52')][_0x7321('0x4c')]({'where':{'name':_0x3630ae,'userProfileId':_0x5a90bd[_0x7321('0x53')]},'raw':!![]})[_0x7321('0x27')](function(_0x1ae367){if(_0x1ae367&&_0x1ae367[_0x7321('0x54')]===0x0){return db[_0x7321('0x2a')][_0x7321('0x4d')]({'name':_0x13bb07[_0x7321('0x2d')],'resourceId':_0x13bb07['id'],'type':_0x1ae367['name'],'sectionId':_0x1ae367['id']},{})['then'](function(){return _0x555a1c;});}else{return _0x555a1c;}})[_0x7321('0x49')](function(_0xf8d9bb){logger[_0x7321('0x2b')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0xf8d9bb);throw _0xf8d9bb;});}return _0x555a1c;})['then'](respondWithResult(_0x274353,0xc9))[_0x7321('0x49')](handleError(_0x274353,null));};exports[_0x7321('0x25')]=function(_0x5ccabc,_0x19b0c2){if(_0x5ccabc[_0x7321('0x4e')]['id']){delete _0x5ccabc[_0x7321('0x4e')]['id'];}return db['VoiceMail'][_0x7321('0x4c')]({'where':{'id':_0x5ccabc[_0x7321('0x4b')]['id']}})[_0x7321('0x27')](handleEntityNotFound(_0x19b0c2,null))['then'](saveUpdates(_0x5ccabc['body'],null))[_0x7321('0x27')](respondWithResult(_0x19b0c2,null))[_0x7321('0x49')](handleError(_0x19b0c2,null));};exports[_0x7321('0x26')]=function(_0x139a7e,_0x422825){return db[_0x7321('0x44')][_0x7321('0x4c')]({'where':{'id':_0x139a7e['params']['id']}})[_0x7321('0x27')](handleEntityNotFound(_0x422825,null))[_0x7321('0x27')](removeEntity(_0x422825,null))[_0x7321('0x49')](handleError(_0x422825,null));};exports[_0x7321('0x55')]=function(_0x356c60,_0x615e47,_0x3a673a){return db['VoiceMail'][_0x7321('0x56')]({'where':{'id':_0x356c60['params']['id']}})['then'](handleEntityNotFound(_0x615e47,null))[_0x7321('0x27')](function(_0x1288ac){var _0x546cc9;var _0x48baa5={},_0x359800={};_0x359800['model']=_[_0x7321('0x34')](db[_0x7321('0x57')]['rawAttributes']);_0x359800[_0x7321('0x33')]=_[_0x7321('0x34')](_0x356c60[_0x7321('0x33')]);_0x359800[_0x7321('0x35')]=_['intersection'](_0x359800['model'],_0x359800[_0x7321('0x33')]);_0x48baa5[_0x7321('0x37')]=_[_0x7321('0x36')](_0x359800[_0x7321('0x32')],qs[_0x7321('0x38')](_0x356c60[_0x7321('0x33')]['fields']));_0x48baa5[_0x7321('0x37')]=_0x48baa5['attributes']['length']?_0x48baa5[_0x7321('0x37')]:_0x359800[_0x7321('0x32')];if(!_0x356c60[_0x7321('0x33')][_0x7321('0x3a')](_0x7321('0x3b'))){_0x48baa5[_0x7321('0x20')]=qs[_0x7321('0x20')](_0x356c60[_0x7321('0x33')]['limit']);_0x48baa5[_0x7321('0x1f')]=qs[_0x7321('0x1f')](_0x356c60['query'][_0x7321('0x1f')]);}_0x48baa5['order']=qs[_0x7321('0x3c')](_0x356c60[_0x7321('0x33')][_0x7321('0x3c')]);_0x48baa5[_0x7321('0x3e')]=qs[_0x7321('0x35')](_[_0x7321('0x3d')](_0x356c60[_0x7321('0x33')],_0x359800[_0x7321('0x35')]));if(_0x356c60[_0x7321('0x33')][_0x7321('0x42')]){_0x48baa5[_0x7321('0x3e')]=_['merge'](_0x48baa5[_0x7321('0x3e')],{'$or':_[_0x7321('0x40')](_0x48baa5[_0x7321('0x37')],function(_0x3ba855){var _0x434b28={};_0x434b28[_0x3ba855]={'$like':'%'+_0x356c60['query']['filter']+'%'};return _0x434b28;})});}_0x48baa5[_0x7321('0x3e')]=_[_0x7321('0x3f')](_0x48baa5['where'],{'mailboxuser':_0x1288ac[_0x7321('0x58')]});_0x48baa5=_['merge']({},_0x48baa5,_0x356c60[_0x7321('0x43')]);return db[_0x7321('0x57')][_0x7321('0x59')](_0x48baa5)[_0x7321('0x27')](respondWithFilteredResult(_0x615e47,_0x48baa5));})['catch'](handleError(_0x615e47,null));}; \ No newline at end of file +var _0x74b8=['VoiceMail','rawAttributes','fieldName','type','key','query','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','limit','order','sort','where','filters','filter','merge','VIRTUAL','options','includeAll','rows','catch','show','params','keys','include','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','findOne','VoiceMailMessage','mailbox','findAndCountAll','html-pdf','rimraf','zip-dir','fast-json-patch','moment','util','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','end','status','json','count','offset','set','Content-Range','apply','reject','update','then','destroy','get','Voicemails','sendStatus','error','stack','name','index','map'];(function(_0xffd1b5,_0x1ede18){var _0x3176d6=function(_0xe9ba48){while(--_0xe9ba48){_0xffd1b5['push'](_0xffd1b5['shift']());}};_0x3176d6(++_0x1ede18);}(_0x74b8,0x82));var _0x874b=function(_0x5037ab,_0x43209e){_0x5037ab=_0x5037ab-0x0;var _0x512adb=_0x74b8[_0x5037ab];return _0x512adb;};'use strict';var pdf=require(_0x874b('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x874b('0x1'));var zipdir=require(_0x874b('0x2'));var jsonpatch=require(_0x874b('0x3'));var rp=require('request-promise');var moment=require(_0x874b('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x874b('0x5'));var path=require('path');var sox=require(_0x874b('0x6'));var csv=require(_0x874b('0x7'));var ejs=require(_0x874b('0x8'));var fs=require('fs');var _=require(_0x874b('0x9'));var squel=require('squel');var crypto=require(_0x874b('0xa'));var jsforce=require(_0x874b('0xb'));var deskjs=require(_0x874b('0xc'));var toCsv=require(_0x874b('0x7'));var querystring=require(_0x874b('0xd'));var Papa=require(_0x874b('0xe'));var Redis=require('ioredis');var authService=require(_0x874b('0xf'));var qs=require(_0x874b('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x874b('0x11'));var logger=require(_0x874b('0x12'))(_0x874b('0x13'));var utils=require(_0x874b('0x14'));var config=require('../../config/environment');var db=require(_0x874b('0x15'))['db'];function respondWithStatusCode(_0x5cadfe,_0x5ebaaa){_0x5ebaaa=_0x5ebaaa||0xcc;return function(_0x34a8b5){if(_0x34a8b5){return _0x5cadfe['sendStatus'](_0x5ebaaa);}return _0x5cadfe['status'](_0x5ebaaa)[_0x874b('0x16')]();};}function respondWithResult(_0x2b0952,_0x166262){_0x166262=_0x166262||0xc8;return function(_0x518764){if(_0x518764){return _0x2b0952[_0x874b('0x17')](_0x166262)[_0x874b('0x18')](_0x518764);}};}function respondWithFilteredResult(_0x2230a4,_0x2c2717){return function(_0x1f6448){if(_0x1f6448){var _0x219a19=_0x1f6448[_0x874b('0x19')],_0x1202db=_0x2c2717[_0x874b('0x1a')],_0x2e2919=_0x2c2717[_0x874b('0x1a')]+_0x2c2717['limit'],_0x531f29;if(_0x2e2919>=_0x219a19){_0x2e2919=_0x219a19;_0x531f29=0xc8;}else{_0x531f29=0xce;}_0x2230a4['status'](_0x531f29);return _0x2230a4[_0x874b('0x1b')](_0x874b('0x1c'),_0x1202db+'-'+_0x2e2919+'/'+_0x219a19)[_0x874b('0x18')](_0x1f6448);}return null;};}function patchUpdates(_0x39b680){return function(_0x471428){try{jsonpatch[_0x874b('0x1d')](_0x471428,_0x39b680,!![]);}catch(_0x3f00a5){return BPromise[_0x874b('0x1e')](_0x3f00a5);}return _0x471428['save']();};}function saveUpdates(_0x343811,_0x23b158){return function(_0x12e076){if(_0x12e076){return _0x12e076[_0x874b('0x1f')](_0x343811)[_0x874b('0x20')](function(_0x1c9b82){return _0x1c9b82;});}return null;};}function removeEntity(_0x818f2c,_0x159e70){return function(_0x2cdc07){if(_0x2cdc07){return _0x2cdc07[_0x874b('0x21')]()[_0x874b('0x20')](function(){var _0x406fab=_0x2cdc07[_0x874b('0x22')]({'plain':!![]});var _0x550615=_0x874b('0x23');return db['UserProfileResource'][_0x874b('0x21')]({'where':{'type':_0x550615,'resourceId':_0x406fab['id']}})[_0x874b('0x20')](function(){return _0x2cdc07;});})[_0x874b('0x20')](function(){_0x818f2c['status'](0xcc)[_0x874b('0x16')]();});}};}function handleEntityNotFound(_0x5f4dd1,_0x1d5343){return function(_0x261759){if(!_0x261759){_0x5f4dd1[_0x874b('0x24')](0x194);}return _0x261759;};}function handleError(_0x19fe91,_0x4e0ec1){_0x4e0ec1=_0x4e0ec1||0x1f4;return function(_0x4d2755){logger[_0x874b('0x25')](_0x4d2755[_0x874b('0x26')]);if(_0x4d2755[_0x874b('0x27')]){delete _0x4d2755[_0x874b('0x27')];}_0x19fe91[_0x874b('0x17')](_0x4e0ec1)['send'](_0x4d2755);};}exports[_0x874b('0x28')]=function(_0x49c0f8,_0xfcd66){var _0x35c0f6={},_0x3eae27={},_0x2284a2={'count':0x0,'rows':[]};var _0x119823=_[_0x874b('0x29')](db[_0x874b('0x2a')][_0x874b('0x2b')],function(_0xfa3969){return{'name':_0xfa3969[_0x874b('0x2c')],'type':_0xfa3969[_0x874b('0x2d')][_0x874b('0x2e')]};});_0x3eae27['model']=_[_0x874b('0x29')](_0x119823,'name');_0x3eae27[_0x874b('0x2f')]=_['keys'](_0x49c0f8[_0x874b('0x2f')]);_0x3eae27['filters']=_[_0x874b('0x30')](_0x3eae27[_0x874b('0x31')],_0x3eae27[_0x874b('0x2f')]);_0x35c0f6['attributes']=_[_0x874b('0x30')](_0x3eae27['model'],qs[_0x874b('0x32')](_0x49c0f8[_0x874b('0x2f')][_0x874b('0x32')]));_0x35c0f6[_0x874b('0x33')]=_0x35c0f6[_0x874b('0x33')][_0x874b('0x34')]?_0x35c0f6[_0x874b('0x33')]:_0x3eae27[_0x874b('0x31')];if(!_0x49c0f8[_0x874b('0x2f')][_0x874b('0x35')](_0x874b('0x36'))){_0x35c0f6['limit']=qs[_0x874b('0x37')](_0x49c0f8[_0x874b('0x2f')][_0x874b('0x37')]);_0x35c0f6[_0x874b('0x1a')]=qs[_0x874b('0x1a')](_0x49c0f8[_0x874b('0x2f')]['offset']);}_0x35c0f6[_0x874b('0x38')]=qs[_0x874b('0x39')](_0x49c0f8[_0x874b('0x2f')][_0x874b('0x39')]);_0x35c0f6[_0x874b('0x3a')]=qs[_0x874b('0x3b')](_['pick'](_0x49c0f8[_0x874b('0x2f')],_0x3eae27['filters']),_0x119823);if(_0x49c0f8[_0x874b('0x2f')][_0x874b('0x3c')]){_0x35c0f6[_0x874b('0x3a')]=_[_0x874b('0x3d')](_0x35c0f6[_0x874b('0x3a')],{'$or':_[_0x874b('0x29')](_0x119823,function(_0x5393a9){if(_0x5393a9[_0x874b('0x2d')]!==_0x874b('0x3e')){var _0x27ff14={};_0x27ff14[_0x5393a9['name']]={'$like':'%'+_0x49c0f8[_0x874b('0x2f')]['filter']+'%'};return _0x27ff14;}})});}_0x35c0f6=_['merge']({},_0x35c0f6,_0x49c0f8[_0x874b('0x3f')]);var _0x48d7bf={'where':_0x35c0f6[_0x874b('0x3a')]};return db[_0x874b('0x2a')][_0x874b('0x19')](_0x48d7bf)[_0x874b('0x20')](function(_0x141f91){_0x2284a2['count']=_0x141f91;if(_0x49c0f8['query'][_0x874b('0x40')]){_0x35c0f6['include']=[{'all':!![]}];}return db[_0x874b('0x2a')]['findAll'](_0x35c0f6);})[_0x874b('0x20')](function(_0x302d0a){_0x2284a2[_0x874b('0x41')]=_0x302d0a;return _0x2284a2;})[_0x874b('0x20')](respondWithFilteredResult(_0xfcd66,_0x35c0f6))[_0x874b('0x42')](handleError(_0xfcd66,null));};exports[_0x874b('0x43')]=function(_0x595b01,_0x3da51d){var _0x25f5fc={'raw':!![],'where':{'id':_0x595b01[_0x874b('0x44')]['id']}},_0x24c92e={};_0x24c92e[_0x874b('0x31')]=_[_0x874b('0x45')](db['VoiceMail']['rawAttributes']);_0x24c92e[_0x874b('0x2f')]=_[_0x874b('0x45')](_0x595b01['query']);_0x24c92e[_0x874b('0x3b')]=_[_0x874b('0x30')](_0x24c92e[_0x874b('0x31')],_0x24c92e[_0x874b('0x2f')]);_0x25f5fc[_0x874b('0x33')]=_['intersection'](_0x24c92e[_0x874b('0x31')],qs['fields'](_0x595b01['query'][_0x874b('0x32')]));_0x25f5fc[_0x874b('0x33')]=_0x25f5fc[_0x874b('0x33')][_0x874b('0x34')]?_0x25f5fc[_0x874b('0x33')]:_0x24c92e[_0x874b('0x31')];if(_0x595b01[_0x874b('0x2f')][_0x874b('0x40')]){_0x25f5fc[_0x874b('0x46')]=[{'all':!![]}];}_0x25f5fc=_[_0x874b('0x3d')]({},_0x25f5fc,_0x595b01[_0x874b('0x3f')]);return db[_0x874b('0x2a')]['find'](_0x25f5fc)[_0x874b('0x20')](handleEntityNotFound(_0x3da51d,null))[_0x874b('0x20')](respondWithResult(_0x3da51d,null))[_0x874b('0x42')](handleError(_0x3da51d,null));};exports[_0x874b('0x47')]=function(_0x533716,_0x348f78){return db['VoiceMail'][_0x874b('0x47')](_0x533716[_0x874b('0x48')],{})[_0x874b('0x20')](function(_0x31ff56){var _0x5507c5=_0x533716[_0x874b('0x49')][_0x874b('0x22')]({'plain':!![]});if(!_0x5507c5)throw new Error(_0x874b('0x4a'));if(_0x5507c5[_0x874b('0x4b')]===_0x874b('0x49')){var _0x2395ff=_0x31ff56[_0x874b('0x22')]({'plain':!![]});var _0x15b81c='Voicemails';return db[_0x874b('0x4c')][_0x874b('0x4d')]({'where':{'name':_0x15b81c,'userProfileId':_0x5507c5[_0x874b('0x4e')]},'raw':!![]})['then'](function(_0xd3935e){if(_0xd3935e&&_0xd3935e[_0x874b('0x4f')]===0x0){return db[_0x874b('0x50')]['create']({'name':_0x2395ff[_0x874b('0x27')],'resourceId':_0x2395ff['id'],'type':_0xd3935e['name'],'sectionId':_0xd3935e['id']},{})[_0x874b('0x20')](function(){return _0x31ff56;});}else{return _0x31ff56;}})['catch'](function(_0x183ea6){logger[_0x874b('0x25')](_0x874b('0x51'),_0x183ea6);throw _0x183ea6;});}return _0x31ff56;})['then'](respondWithResult(_0x348f78,0xc9))[_0x874b('0x42')](handleError(_0x348f78,null));};exports[_0x874b('0x1f')]=function(_0x47da39,_0x54efef){if(_0x47da39[_0x874b('0x48')]['id']){delete _0x47da39[_0x874b('0x48')]['id'];}return db[_0x874b('0x2a')][_0x874b('0x4d')]({'where':{'id':_0x47da39['params']['id']}})[_0x874b('0x20')](handleEntityNotFound(_0x54efef,null))[_0x874b('0x20')](saveUpdates(_0x47da39['body'],null))[_0x874b('0x20')](respondWithResult(_0x54efef,null))[_0x874b('0x42')](handleError(_0x54efef,null));};exports[_0x874b('0x21')]=function(_0x483a5e,_0x53ca13){return db[_0x874b('0x2a')][_0x874b('0x4d')]({'where':{'id':_0x483a5e['params']['id']}})[_0x874b('0x20')](handleEntityNotFound(_0x53ca13,null))[_0x874b('0x20')](removeEntity(_0x53ca13,null))['catch'](handleError(_0x53ca13,null));};exports['getMessages']=function(_0x5aee0c,_0x175d82,_0x13d75e){return db[_0x874b('0x2a')][_0x874b('0x52')]({'where':{'id':_0x5aee0c[_0x874b('0x44')]['id']}})['then'](handleEntityNotFound(_0x175d82,null))[_0x874b('0x20')](function(_0x4e6ade){var _0x2ce305;var _0x5175e1={},_0x5b4d6e={};_0x5b4d6e[_0x874b('0x31')]=_['keys'](db[_0x874b('0x53')]['rawAttributes']);_0x5b4d6e[_0x874b('0x2f')]=_[_0x874b('0x45')](_0x5aee0c[_0x874b('0x2f')]);_0x5b4d6e['filters']=_[_0x874b('0x30')](_0x5b4d6e['model'],_0x5b4d6e[_0x874b('0x2f')]);_0x5175e1[_0x874b('0x33')]=_['intersection'](_0x5b4d6e['model'],qs['fields'](_0x5aee0c[_0x874b('0x2f')][_0x874b('0x32')]));_0x5175e1[_0x874b('0x33')]=_0x5175e1[_0x874b('0x33')][_0x874b('0x34')]?_0x5175e1[_0x874b('0x33')]:_0x5b4d6e[_0x874b('0x31')];if(!_0x5aee0c[_0x874b('0x2f')][_0x874b('0x35')](_0x874b('0x36'))){_0x5175e1[_0x874b('0x37')]=qs[_0x874b('0x37')](_0x5aee0c[_0x874b('0x2f')][_0x874b('0x37')]);_0x5175e1['offset']=qs[_0x874b('0x1a')](_0x5aee0c[_0x874b('0x2f')][_0x874b('0x1a')]);}_0x5175e1[_0x874b('0x38')]=qs['sort'](_0x5aee0c[_0x874b('0x2f')][_0x874b('0x39')]);_0x5175e1['where']=qs[_0x874b('0x3b')](_['pick'](_0x5aee0c[_0x874b('0x2f')],_0x5b4d6e[_0x874b('0x3b')]));if(_0x5aee0c[_0x874b('0x2f')][_0x874b('0x3c')]){_0x5175e1[_0x874b('0x3a')]=_[_0x874b('0x3d')](_0x5175e1['where'],{'$or':_[_0x874b('0x29')](_0x5175e1['attributes'],function(_0x358d8d){var _0x3b2c4f={};_0x3b2c4f[_0x358d8d]={'$like':'%'+_0x5aee0c['query'][_0x874b('0x3c')]+'%'};return _0x3b2c4f;})});}_0x5175e1['where']=_[_0x874b('0x3d')](_0x5175e1[_0x874b('0x3a')],{'mailboxuser':_0x4e6ade[_0x874b('0x54')]});_0x5175e1=_['merge']({},_0x5175e1,_0x5aee0c[_0x874b('0x3f')]);return db[_0x874b('0x53')][_0x874b('0x55')](_0x5175e1)[_0x874b('0x20')](respondWithFilteredResult(_0x175d82,_0x5175e1));})[_0x874b('0x42')](handleError(_0x175d82,null));}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.model.js b/server/api/voiceMail/voiceMail.model.js index e47714e..75f3065 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 _0x7122=['mailbox','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','./voiceMail.attributes','VoiceMail','voice_voicemail','mailbox_context'];(function(_0x5e9c3a,_0x13acc2){var _0x12ccb4=function(_0x3ffd23){while(--_0x3ffd23){_0x5e9c3a['push'](_0x5e9c3a['shift']());}};_0x12ccb4(++_0x13acc2);}(_0x7122,0x9d));var _0x2712=function(_0x114b27,_0x42f774){_0x114b27=_0x114b27-0x0;var _0x457a0f=_0x7122[_0x114b27];return _0x457a0f;};'use strict';var _=require(_0x2712('0x0'));var util=require(_0x2712('0x1'));var logger=require(_0x2712('0x2'))(_0x2712('0x3'));var moment=require(_0x2712('0x4'));var BPromise=require(_0x2712('0x5'));var rp=require(_0x2712('0x6'));var fs=require('fs');var path=require(_0x2712('0x7'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x2712('0x8'));module['exports']=function(_0x480d0d,_0x34fec8){return _0x480d0d['define'](_0x2712('0x9'),attributes,{'tableName':_0x2712('0xa'),'paranoid':![],'indexes':[{'name':_0x2712('0xb'),'fields':[_0x2712('0xc'),'context']}],'timestamps':!![]});}; \ No newline at end of file +var _0x3e44=['mailbox_context','mailbox','context','lodash','util','../../config/logger','bluebird','request-promise','path','../../config/environment','exports','define','VoiceMail','voice_voicemail'];(function(_0x43fd84,_0x408c0c){var _0x3bd971=function(_0x5ea0b0){while(--_0x5ea0b0){_0x43fd84['push'](_0x43fd84['shift']());}};_0x3bd971(++_0x408c0c);}(_0x3e44,0x1df));var _0x43e4=function(_0xb4b7a,_0x45d071){_0xb4b7a=_0xb4b7a-0x0;var _0x474e23=_0x3e44[_0xb4b7a];return _0x474e23;};'use strict';var _=require(_0x43e4('0x0'));var util=require(_0x43e4('0x1'));var logger=require(_0x43e4('0x2'))('api');var moment=require('moment');var BPromise=require(_0x43e4('0x3'));var rp=require(_0x43e4('0x4'));var fs=require('fs');var path=require(_0x43e4('0x5'));var rimraf=require('rimraf');var config=require(_0x43e4('0x6'));var attributes=require('./voiceMail.attributes');module[_0x43e4('0x7')]=function(_0x511aef,_0x3d0fb6){return _0x511aef[_0x43e4('0x8')](_0x43e4('0x9'),attributes,{'tableName':_0x43e4('0xa'),'paranoid':![],'indexes':[{'name':_0x43e4('0xb'),'fields':[_0x43e4('0xc'),_0x43e4('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 d2b9b8b..82d4d92 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 _0x0dac=['VoiceMail,\x20%s,\x20%s','request\x20sent','VoiceMail,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','request','info'];(function(_0x3a93f2,_0x4038e0){var _0x357c12=function(_0x5166ce){while(--_0x5166ce){_0x3a93f2['push'](_0x3a93f2['shift']());}};_0x357c12(++_0x4038e0);}(_0x0dac,0xb9));var _0xc0da=function(_0x24271c,_0x4b4104){_0x24271c=_0x24271c-0x0;var _0xa5d9d9=_0x0dac[_0x24271c];return _0xa5d9d9;};'use strict';var _=require(_0xc0da('0x0'));var util=require(_0xc0da('0x1'));var moment=require(_0xc0da('0x2'));var BPromise=require(_0xc0da('0x3'));var rs=require(_0xc0da('0x4'));var fs=require('fs');var Redis=require(_0xc0da('0x5'));var db=require(_0xc0da('0x6'))['db'];var utils=require(_0xc0da('0x7'));var logger=require('../../config/logger')(_0xc0da('0x8'));var config=require(_0xc0da('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xc0da('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2adf48,_0x444af0,_0x13e4aa){return new BPromise(function(_0x1b2010,_0x40c4d0){return client[_0xc0da('0xb')](_0x2adf48,_0x13e4aa)['then'](function(_0x3e8474){logger[_0xc0da('0xc')](_0xc0da('0xd'),_0x444af0,_0xc0da('0xe'));logger['debug'](_0xc0da('0xf'),_0x444af0,_0xc0da('0xe'),JSON[_0xc0da('0x10')](_0x3e8474));if(_0x3e8474[_0xc0da('0x11')]){if(_0x3e8474[_0xc0da('0x11')][_0xc0da('0x12')]===0x1f4){logger[_0xc0da('0x11')]('VoiceMail,\x20%s,\x20%s',_0x444af0,_0x3e8474[_0xc0da('0x11')]['message']);return _0x40c4d0(_0x3e8474[_0xc0da('0x11')][_0xc0da('0x13')]);}logger[_0xc0da('0x11')](_0xc0da('0xd'),_0x444af0,_0x3e8474[_0xc0da('0x11')][_0xc0da('0x13')]);return _0x1b2010(_0x3e8474['error'][_0xc0da('0x13')]);}else{logger[_0xc0da('0xc')](_0xc0da('0xd'),_0x444af0,_0xc0da('0xe'));_0x1b2010(_0x3e8474[_0xc0da('0x14')][_0xc0da('0x13')]);}})[_0xc0da('0x15')](function(_0x1c812f){logger[_0xc0da('0x11')](_0xc0da('0xd'),_0x444af0,_0x1c812f);_0x40c4d0(_0x1c812f);});});} \ No newline at end of file +var _0xd38f=['../../config/environment','jayson/promise','client','request','then','info','debug','error','code','VoiceMail,\x20%s,\x20%s','message','request\x20sent','result','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc'];(function(_0x5a95fa,_0x4a2fc9){var _0x1a61b8=function(_0x59f119){while(--_0x59f119){_0x5a95fa['push'](_0x5a95fa['shift']());}};_0x1a61b8(++_0x4a2fc9);}(_0xd38f,0xf1));var _0xfd38=function(_0x58abe0,_0x3b559f){_0x58abe0=_0x58abe0-0x0;var _0x13c0d9=_0xd38f[_0x58abe0];return _0x13c0d9;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xfd38('0x0'));var BPromise=require('bluebird');var rs=require(_0xfd38('0x1'));var fs=require('fs');var Redis=require(_0xfd38('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0xfd38('0x3'));var logger=require(_0xfd38('0x4'))(_0xfd38('0x5'));var config=require(_0xfd38('0x6'));var jayson=require(_0xfd38('0x7'));var client=jayson[_0xfd38('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x589d59,_0x2d2040,_0xc3d89a){return new BPromise(function(_0x49f39,_0x135430){return client[_0xfd38('0x9')](_0x589d59,_0xc3d89a)[_0xfd38('0xa')](function(_0x5ed8ec){logger[_0xfd38('0xb')]('VoiceMail,\x20%s,\x20%s',_0x2d2040,'request\x20sent');logger[_0xfd38('0xc')]('VoiceMail,\x20%s,\x20%s,\x20%s',_0x2d2040,'request\x20sent',JSON['stringify'](_0x5ed8ec));if(_0x5ed8ec[_0xfd38('0xd')]){if(_0x5ed8ec['error'][_0xfd38('0xe')]===0x1f4){logger[_0xfd38('0xd')](_0xfd38('0xf'),_0x2d2040,_0x5ed8ec[_0xfd38('0xd')][_0xfd38('0x10')]);return _0x135430(_0x5ed8ec['error']['message']);}logger['error'](_0xfd38('0xf'),_0x2d2040,_0x5ed8ec[_0xfd38('0xd')][_0xfd38('0x10')]);return _0x49f39(_0x5ed8ec[_0xfd38('0xd')][_0xfd38('0x10')]);}else{logger[_0xfd38('0xb')](_0xfd38('0xf'),_0x2d2040,_0xfd38('0x11'));_0x49f39(_0x5ed8ec[_0xfd38('0x12')][_0xfd38('0x10')]);}})['catch'](function(_0x395ac9){logger[_0xfd38('0xd')]('VoiceMail,\x20%s,\x20%s',_0x2d2040,_0x395ac9);_0x135430(_0x395ac9);});});} \ No newline at end of file diff --git a/server/api/voiceMailMessage/index.js b/server/api/voiceMailMessage/index.js index 875846e..8146ac2 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 _0x814b=['path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./voiceMailMessage.controller','get','isAuthenticated','index','/:id','/:id/download','download','post','create','put','update','destroy','exports','multer','util'];(function(_0x5d4607,_0x6b5e7b){var _0x5e4a86=function(_0x46891a){while(--_0x46891a){_0x5d4607['push'](_0x5d4607['shift']());}};_0x5e4a86(++_0x6b5e7b);}(_0x814b,0x1a2));var _0xb814=function(_0x45bcb1,_0x46cad0){_0x45bcb1=_0x45bcb1-0x0;var _0x4bd6a3=_0x814b[_0x45bcb1];return _0x4bd6a3;};'use strict';var multer=require(_0xb814('0x0'));var util=require(_0xb814('0x1'));var path=require(_0xb814('0x2'));var timeout=require(_0xb814('0x3'));var express=require(_0xb814('0x4'));var router=express[_0xb814('0x5')]();var auth=require('../../components/auth/service');var interaction=require(_0xb814('0x6'));var config=require(_0xb814('0x7'));var controller=require(_0xb814('0x8'));router[_0xb814('0x9')]('/',auth[_0xb814('0xa')](),controller[_0xb814('0xb')]);router['get'](_0xb814('0xc'),auth[_0xb814('0xa')](),controller['show']);router[_0xb814('0x9')](_0xb814('0xd'),auth[_0xb814('0xa')](),controller[_0xb814('0xe')]);router[_0xb814('0xf')]('/',auth[_0xb814('0xa')](),controller[_0xb814('0x10')]);router[_0xb814('0x11')](_0xb814('0xc'),auth[_0xb814('0xa')](),controller[_0xb814('0x12')]);router['delete'](_0xb814('0xc'),auth['isAuthenticated'](),controller[_0xb814('0x13')]);module[_0xb814('0x14')]=router; \ No newline at end of file +var _0x7a54=['show','/:id/download','create','/:id','delete','destroy','exports','multer','util','path','express','Router','../../components/interaction/service','../../config/environment','./voiceMailMessage.controller','get','isAuthenticated'];(function(_0x45cc8d,_0x2f240a){var _0x4d1d2b=function(_0x2d65be){while(--_0x2d65be){_0x45cc8d['push'](_0x45cc8d['shift']());}};_0x4d1d2b(++_0x2f240a);}(_0x7a54,0x106));var _0x47a5=function(_0x26cbbb,_0x330bcd){_0x26cbbb=_0x26cbbb-0x0;var _0x43bfcf=_0x7a54[_0x26cbbb];return _0x43bfcf;};'use strict';var multer=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var path=require(_0x47a5('0x2'));var timeout=require('connect-timeout');var express=require(_0x47a5('0x3'));var router=express[_0x47a5('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x47a5('0x5'));var config=require(_0x47a5('0x6'));var controller=require(_0x47a5('0x7'));router[_0x47a5('0x8')]('/',auth[_0x47a5('0x9')](),controller['index']);router[_0x47a5('0x8')]('/:id',auth[_0x47a5('0x9')](),controller[_0x47a5('0xa')]);router['get'](_0x47a5('0xb'),auth['isAuthenticated'](),controller['download']);router['post']('/',auth[_0x47a5('0x9')](),controller[_0x47a5('0xc')]);router['put'](_0x47a5('0xd'),auth['isAuthenticated'](),controller['update']);router[_0x47a5('0xe')](_0x47a5('0xd'),auth[_0x47a5('0x9')](),controller[_0x47a5('0xf')]);module[_0x47a5('0x10')]=router; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.attributes.js b/server/api/voiceMailMessage/voiceMailMessage.attributes.js index 1fef37e..2c1b9ce 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 _0xcab7=['sequelize','VIRTUAL','STRING','BLOB','TIMESTAMP'];(function(_0x10e347,_0x53379c){var _0x1c39b7=function(_0x3086ca){while(--_0x3086ca){_0x10e347['push'](_0x10e347['shift']());}};_0x1c39b7(++_0x53379c);}(_0xcab7,0x9b));var _0x7cab=function(_0x3b3f4f,_0x403216){_0x3b3f4f=_0x3b3f4f-0x0;var _0x174dbe=_0xcab7[_0x3b3f4f];return _0x174dbe;};'use strict';var Sequelize=require(_0x7cab('0x0'));module['exports']={'name':{'type':Sequelize[_0x7cab('0x1')],'get':function(_0x9a1659){return this['getDataValue']('id');}},'msgnum':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0,'allowNull':![]},'dir':{'type':Sequelize[_0x7cab('0x2')],'defaultValue':''},'context':{'type':Sequelize[_0x7cab('0x2')],'defaultValue':''},'macrocontext':{'type':Sequelize[_0x7cab('0x2')],'defaultValue':''},'callerid':{'type':Sequelize['STRING'],'defaultValue':''},'origtime':{'type':Sequelize['STRING'],'defaultValue':''},'duration':{'type':Sequelize['STRING'],'defaultValue':''},'mailboxuser':{'type':Sequelize[_0x7cab('0x2')],'defaultValue':''},'mailboxcontext':{'type':Sequelize[_0x7cab('0x2')],'defaultValue':''},'recording':{'type':Sequelize[_0x7cab('0x3')]('long'),'defaultValue':null},'flag':{'type':Sequelize['STRING'],'defaultValue':''},'msg_id':{'type':Sequelize['STRING'],'defaultValue':''},'stamp':{'type':_0x7cab('0x4'),'allowNull':![]}}; \ No newline at end of file +var _0x74a1=['BLOB','TIMESTAMP','sequelize','VIRTUAL','getDataValue','STRING'];(function(_0x372171,_0x27e97c){var _0xb05392=function(_0x1bcb9c){while(--_0x1bcb9c){_0x372171['push'](_0x372171['shift']());}};_0xb05392(++_0x27e97c);}(_0x74a1,0x122));var _0x174a=function(_0x4c9d00,_0x5092d5){_0x4c9d00=_0x4c9d00-0x0;var _0x4a73f5=_0x74a1[_0x4c9d00];return _0x4a73f5;};'use strict';var Sequelize=require(_0x174a('0x0'));module['exports']={'name':{'type':Sequelize[_0x174a('0x1')],'get':function(_0x5b75f4){return this[_0x174a('0x2')]('id');}},'msgnum':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0,'allowNull':![]},'dir':{'type':Sequelize[_0x174a('0x3')],'defaultValue':''},'context':{'type':Sequelize[_0x174a('0x3')],'defaultValue':''},'macrocontext':{'type':Sequelize[_0x174a('0x3')],'defaultValue':''},'callerid':{'type':Sequelize[_0x174a('0x3')],'defaultValue':''},'origtime':{'type':Sequelize['STRING'],'defaultValue':''},'duration':{'type':Sequelize[_0x174a('0x3')],'defaultValue':''},'mailboxuser':{'type':Sequelize[_0x174a('0x3')],'defaultValue':''},'mailboxcontext':{'type':Sequelize[_0x174a('0x3')],'defaultValue':''},'recording':{'type':Sequelize[_0x174a('0x4')]('long'),'defaultValue':null},'flag':{'type':Sequelize[_0x174a('0x3')],'defaultValue':''},'msg_id':{'type':Sequelize[_0x174a('0x3')],'defaultValue':''},'stamp':{'type':_0x174a('0x5'),'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.controller.js b/server/api/voiceMailMessage/voiceMailMessage.controller.js index bec0081..a404195 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 _0x84a0=['merge','map','VIRTUAL','options','count','include','findAll','rows','catch','show','find','create','body','params','download','recording','msg_id','Sequelize','VoiceMailMessage\x20not\x20found','audio/wav','Content-Disposition','.wav\x22','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','util','path','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','sendStatus','status','end','offset','set','Content-Range','json','apply','reject','save','update','then','destroy','error','stack','name','send','VoiceMailMessage','rawAttributes','fieldName','type','key','model','differenceBy','keys','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','limit','sort','where','filter'];(function(_0x50b2da,_0x9f4363){var _0x9f30d9=function(_0x1b3e37){while(--_0x1b3e37){_0x50b2da['push'](_0x50b2da['shift']());}};_0x9f30d9(++_0x9f4363);}(_0x84a0,0x66));var _0x084a=function(_0x40aa66,_0x2c7679){_0x40aa66=_0x40aa66-0x0;var _0x593df7=_0x84a0[_0x40aa66];return _0x593df7;};'use strict';var pdf=require(_0x084a('0x0'));var emlformat=require(_0x084a('0x1'));var rimraf=require(_0x084a('0x2'));var zipdir=require(_0x084a('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x084a('0x4'));var moment=require(_0x084a('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x084a('0x6'));var path=require(_0x084a('0x7'));var sox=require('sox');var csv=require(_0x084a('0x8'));var ejs=require(_0x084a('0x9'));var fs=require('fs');var _=require(_0x084a('0xa'));var squel=require(_0x084a('0xb'));var crypto=require(_0x084a('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x084a('0xd'));var toCsv=require(_0x084a('0x8'));var querystring=require(_0x084a('0xe'));var Papa=require(_0x084a('0xf'));var Redis=require(_0x084a('0x10'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x084a('0x11'));var hardwareService=require(_0x084a('0x12'));var logger=require(_0x084a('0x13'))(_0x084a('0x14'));var utils=require(_0x084a('0x15'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xc451b1,_0x3ca72f){_0x3ca72f=_0x3ca72f||0xcc;return function(_0xec90a5){if(_0xec90a5){return _0xc451b1[_0x084a('0x16')](_0x3ca72f);}return _0xc451b1[_0x084a('0x17')](_0x3ca72f)[_0x084a('0x18')]();};}function respondWithResult(_0x3ff351,_0x3a76d1){_0x3a76d1=_0x3a76d1||0xc8;return function(_0x5aef40){if(_0x5aef40){return _0x3ff351[_0x084a('0x17')](_0x3a76d1)['json'](_0x5aef40);}};}function respondWithFilteredResult(_0x225de0,_0x3ccaca){return function(_0x366624){if(_0x366624){var _0x2d35b8=_0x366624['count'],_0xd20527=_0x3ccaca[_0x084a('0x19')],_0x4cbd16=_0x3ccaca[_0x084a('0x19')]+_0x3ccaca['limit'],_0x443ebb;if(_0x4cbd16>=_0x2d35b8){_0x4cbd16=_0x2d35b8;_0x443ebb=0xc8;}else{_0x443ebb=0xce;}_0x225de0[_0x084a('0x17')](_0x443ebb);return _0x225de0[_0x084a('0x1a')](_0x084a('0x1b'),_0xd20527+'-'+_0x4cbd16+'/'+_0x2d35b8)[_0x084a('0x1c')](_0x366624);}return null;};}function patchUpdates(_0x33d3a6){return function(_0x145636){try{jsonpatch[_0x084a('0x1d')](_0x145636,_0x33d3a6,!![]);}catch(_0x34e86e){return BPromise[_0x084a('0x1e')](_0x34e86e);}return _0x145636[_0x084a('0x1f')]();};}function saveUpdates(_0x3c7fd6,_0x279e25){return function(_0x116328){if(_0x116328){return _0x116328[_0x084a('0x20')](_0x3c7fd6)[_0x084a('0x21')](function(_0x506f71){return _0x506f71;});}return null;};}function removeEntity(_0x343c5c,_0x1ad257){return function(_0x41a90f){if(_0x41a90f){return _0x41a90f[_0x084a('0x22')]()[_0x084a('0x21')](function(){_0x343c5c['status'](0xcc)[_0x084a('0x18')]();});}};}function handleEntityNotFound(_0x288e9e,_0x6346a5){return function(_0x1f2c9f){if(!_0x1f2c9f){_0x288e9e[_0x084a('0x16')](0x194);}return _0x1f2c9f;};}function handleError(_0x3cdc1e,_0x5be167){_0x5be167=_0x5be167||0x1f4;return function(_0x297e5b){logger[_0x084a('0x23')](_0x297e5b[_0x084a('0x24')]);if(_0x297e5b['name']){delete _0x297e5b[_0x084a('0x25')];}_0x3cdc1e[_0x084a('0x17')](_0x5be167)[_0x084a('0x26')](_0x297e5b);};}exports['index']=function(_0x5596ac,_0x4874fe){var _0x52227a={},_0x33b88f={},_0x5c5efb={'count':0x0,'rows':[]};var _0x5bea78=_['map'](db[_0x084a('0x27')][_0x084a('0x28')],function(_0x388062){return{'name':_0x388062[_0x084a('0x29')],'type':_0x388062[_0x084a('0x2a')][_0x084a('0x2b')]};});_0x33b88f[_0x084a('0x2c')]=_[_0x084a('0x2d')](_['map'](_0x5bea78,_0x084a('0x25')),[_0x084a('0x25')]);_0x33b88f['query']=_[_0x084a('0x2e')](_0x5596ac[_0x084a('0x2f')]);_0x33b88f[_0x084a('0x30')]=_[_0x084a('0x31')](_0x33b88f[_0x084a('0x2c')],_0x33b88f[_0x084a('0x2f')]);_0x52227a[_0x084a('0x32')]=_[_0x084a('0x31')](_0x33b88f[_0x084a('0x2c')],qs[_0x084a('0x33')](_0x5596ac[_0x084a('0x2f')][_0x084a('0x33')]));_0x52227a[_0x084a('0x32')]=_0x52227a['attributes']['length']?_0x52227a[_0x084a('0x32')]:_0x33b88f[_0x084a('0x2c')];if(!_0x5596ac[_0x084a('0x2f')][_0x084a('0x34')](_0x084a('0x35'))){_0x52227a['limit']=qs[_0x084a('0x36')](_0x5596ac[_0x084a('0x2f')][_0x084a('0x36')]);_0x52227a['offset']=qs[_0x084a('0x19')](_0x5596ac[_0x084a('0x2f')][_0x084a('0x19')]);}_0x52227a['order']=qs['sort'](_0x5596ac['query'][_0x084a('0x37')]);_0x52227a[_0x084a('0x38')]=qs[_0x084a('0x30')](_['pick'](_0x5596ac[_0x084a('0x2f')],_0x33b88f[_0x084a('0x30')]),_0x5bea78);if(_0x5596ac[_0x084a('0x2f')][_0x084a('0x39')]){_0x52227a[_0x084a('0x38')]=_[_0x084a('0x3a')](_0x52227a[_0x084a('0x38')],{'$or':_[_0x084a('0x3b')](_0x5bea78,function(_0x434a06){if(_0x434a06[_0x084a('0x2a')]!==_0x084a('0x3c')){var _0x1454a9={};_0x1454a9[_0x434a06[_0x084a('0x25')]]={'$like':'%'+_0x5596ac[_0x084a('0x2f')][_0x084a('0x39')]+'%'};return _0x1454a9;}})});}_0x52227a=_['merge']({},_0x52227a,_0x5596ac[_0x084a('0x3d')]);var _0x1dada8={'where':_0x52227a[_0x084a('0x38')]};return db[_0x084a('0x27')][_0x084a('0x3e')](_0x1dada8)[_0x084a('0x21')](function(_0xa7b652){_0x5c5efb[_0x084a('0x3e')]=_0xa7b652;if(_0x5596ac[_0x084a('0x2f')]['includeAll']){_0x52227a[_0x084a('0x3f')]=[{'all':!![]}];}return db[_0x084a('0x27')][_0x084a('0x40')](_0x52227a);})[_0x084a('0x21')](function(_0x256008){_0x5c5efb[_0x084a('0x41')]=_0x256008;return _0x5c5efb;})['then'](respondWithFilteredResult(_0x4874fe,_0x52227a))[_0x084a('0x42')](handleError(_0x4874fe,null));};exports[_0x084a('0x43')]=function(_0x55c5f4,_0x410fdb){var _0x30428a={'raw':!![],'where':{'id':_0x55c5f4['params']['id']}},_0x68e0d6={};_0x68e0d6[_0x084a('0x2c')]=_[_0x084a('0x2e')](db['VoiceMailMessage'][_0x084a('0x28')]);_0x68e0d6[_0x084a('0x2f')]=_['keys'](_0x55c5f4['query']);_0x68e0d6[_0x084a('0x30')]=_[_0x084a('0x31')](_0x68e0d6[_0x084a('0x2c')],_0x68e0d6[_0x084a('0x2f')]);_0x30428a[_0x084a('0x32')]=_[_0x084a('0x31')](_0x68e0d6[_0x084a('0x2c')],qs[_0x084a('0x33')](_0x55c5f4[_0x084a('0x2f')][_0x084a('0x33')]));_0x30428a[_0x084a('0x32')]=_0x30428a['attributes']['length']?_0x30428a[_0x084a('0x32')]:_0x68e0d6[_0x084a('0x2c')];if(_0x55c5f4[_0x084a('0x2f')]['includeAll']){_0x30428a[_0x084a('0x3f')]=[{'all':!![]}];}_0x30428a=_[_0x084a('0x3a')]({},_0x30428a,_0x55c5f4[_0x084a('0x3d')]);return db[_0x084a('0x27')][_0x084a('0x44')](_0x30428a)['then'](handleEntityNotFound(_0x410fdb,null))[_0x084a('0x21')](respondWithResult(_0x410fdb,null))['catch'](handleError(_0x410fdb,null));};exports[_0x084a('0x45')]=function(_0x4f98c6,_0x1ffd20){return db['VoiceMailMessage']['create'](_0x4f98c6[_0x084a('0x46')],{})[_0x084a('0x21')](respondWithResult(_0x1ffd20,0xc9))['catch'](handleError(_0x1ffd20,null));};exports[_0x084a('0x20')]=function(_0x2c2c2e,_0x12e0d5){if(_0x2c2c2e[_0x084a('0x46')]['id']){delete _0x2c2c2e['body']['id'];}return db[_0x084a('0x27')][_0x084a('0x44')]({'where':{'id':_0x2c2c2e[_0x084a('0x47')]['id']}})[_0x084a('0x21')](handleEntityNotFound(_0x12e0d5,null))['then'](saveUpdates(_0x2c2c2e[_0x084a('0x46')],null))[_0x084a('0x21')](respondWithResult(_0x12e0d5,null))[_0x084a('0x42')](handleError(_0x12e0d5,null));};exports[_0x084a('0x22')]=function(_0x5a718c,_0x502d9a){return db[_0x084a('0x27')][_0x084a('0x44')]({'where':{'id':_0x5a718c[_0x084a('0x47')]['id']}})[_0x084a('0x21')](handleEntityNotFound(_0x502d9a,null))[_0x084a('0x21')](removeEntity(_0x502d9a,null))[_0x084a('0x42')](handleError(_0x502d9a,null));};exports[_0x084a('0x48')]=function(_0x12c3a8,_0xf6ce0d,_0x211606){return db[_0x084a('0x27')][_0x084a('0x44')]({'where':{'id':_0x12c3a8['params']['id']},'attributes':['id',_0x084a('0x49'),_0x084a('0x4a')]})[_0x084a('0x21')](handleEntityNotFound(_0xf6ce0d,null))[_0x084a('0x21')](function(_0x2091b1){if(_0x2091b1){if(!_0x2091b1[_0x084a('0x49')]){throw new db[(_0x084a('0x4b'))]['ValidationError'](_0x084a('0x4c'));}var _0x40dc39={'Content-Type':_0x084a('0x4d'),'Content-Disposition':'attachment'};if(_0x2091b1['msg_id']){_0x40dc39[_0x084a('0x4e')]='attachment;\x20filename=\x22'+_0x2091b1[_0x084a('0x4a')]+_0x084a('0x4f');}_0xf6ce0d['set'](_0x40dc39);return _0xf6ce0d[_0x084a('0x26')](new Buffer(_0x2091b1['recording']));}})['catch'](handleError(_0xf6ce0d,null));}; \ No newline at end of file +var _0x7341=['../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','set','save','then','destroy','stack','name','send','index','map','VoiceMailMessage','fieldName','type','model','differenceBy','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','filter','merge','VIRTUAL','includeAll','include','findAll','rows','catch','show','params','options','find','create','body','update','download','msg_id','recording','Sequelize','ValidationError','VoiceMailMessage\x20not\x20found','audio/wav','attachment','Content-Disposition','attachment;\x20filename=\x22','.wav\x22','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','squel','crypto','jsforce','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware'];(function(_0xa10a8f,_0x4d5a24){var _0x48eb98=function(_0xd193b4){while(--_0xd193b4){_0xa10a8f['push'](_0xa10a8f['shift']());}};_0x48eb98(++_0x4d5a24);}(_0x7341,0xe4));var _0x1734=function(_0x4ffec7,_0x2ff519){_0x4ffec7=_0x4ffec7-0x0;var _0x4e13af=_0x7341[_0x4ffec7];return _0x4e13af;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0x1734('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x1734('0x1'));var rp=require(_0x1734('0x2'));var moment=require('moment');var BPromise=require(_0x1734('0x3'));var Mustache=require(_0x1734('0x4'));var util=require(_0x1734('0x5'));var path=require(_0x1734('0x6'));var sox=require(_0x1734('0x7'));var csv=require(_0x1734('0x8'));var ejs=require(_0x1734('0x9'));var fs=require('fs');var _=require('lodash');var squel=require(_0x1734('0xa'));var crypto=require(_0x1734('0xb'));var jsforce=require(_0x1734('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x1734('0x8'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x1734('0xd'));var authService=require(_0x1734('0xe'));var qs=require(_0x1734('0xf'));var as=require(_0x1734('0x10'));var hardwareService=require(_0x1734('0x11'));var logger=require(_0x1734('0x12'))(_0x1734('0x13'));var utils=require(_0x1734('0x14'));var config=require(_0x1734('0x15'));var db=require(_0x1734('0x16'))['db'];function respondWithStatusCode(_0x59830b,_0x4391a1){_0x4391a1=_0x4391a1||0xcc;return function(_0x449ab1){if(_0x449ab1){return _0x59830b[_0x1734('0x17')](_0x4391a1);}return _0x59830b[_0x1734('0x18')](_0x4391a1)[_0x1734('0x19')]();};}function respondWithResult(_0x424a23,_0x9e7cf5){_0x9e7cf5=_0x9e7cf5||0xc8;return function(_0xd2f288){if(_0xd2f288){return _0x424a23[_0x1734('0x18')](_0x9e7cf5)[_0x1734('0x1a')](_0xd2f288);}};}function respondWithFilteredResult(_0x444527,_0x27679e){return function(_0x2162c9){if(_0x2162c9){var _0x2dd53c=_0x2162c9[_0x1734('0x1b')],_0x3989a6=_0x27679e[_0x1734('0x1c')],_0x24bbf3=_0x27679e['offset']+_0x27679e['limit'],_0x2b375d;if(_0x24bbf3>=_0x2dd53c){_0x24bbf3=_0x2dd53c;_0x2b375d=0xc8;}else{_0x2b375d=0xce;}_0x444527[_0x1734('0x18')](_0x2b375d);return _0x444527[_0x1734('0x1d')]('Content-Range',_0x3989a6+'-'+_0x24bbf3+'/'+_0x2dd53c)[_0x1734('0x1a')](_0x2162c9);}return null;};}function patchUpdates(_0x58f566){return function(_0x530f66){try{jsonpatch['apply'](_0x530f66,_0x58f566,!![]);}catch(_0x14347d){return BPromise['reject'](_0x14347d);}return _0x530f66[_0x1734('0x1e')]();};}function saveUpdates(_0xc4b4cc,_0x4fc4ed){return function(_0x54b1bd){if(_0x54b1bd){return _0x54b1bd['update'](_0xc4b4cc)[_0x1734('0x1f')](function(_0x53f13d){return _0x53f13d;});}return null;};}function removeEntity(_0x183f7a,_0x5ad801){return function(_0x215ae4){if(_0x215ae4){return _0x215ae4[_0x1734('0x20')]()[_0x1734('0x1f')](function(){_0x183f7a[_0x1734('0x18')](0xcc)[_0x1734('0x19')]();});}};}function handleEntityNotFound(_0x45593e,_0x4285ee){return function(_0x44e420){if(!_0x44e420){_0x45593e[_0x1734('0x17')](0x194);}return _0x44e420;};}function handleError(_0x5c1be3,_0x34ac29){_0x34ac29=_0x34ac29||0x1f4;return function(_0x568e0c){logger['error'](_0x568e0c[_0x1734('0x21')]);if(_0x568e0c[_0x1734('0x22')]){delete _0x568e0c[_0x1734('0x22')];}_0x5c1be3[_0x1734('0x18')](_0x34ac29)[_0x1734('0x23')](_0x568e0c);};}exports[_0x1734('0x24')]=function(_0x3616c1,_0x27d6e5){var _0x4a670a={},_0x381960={},_0x52eaf5={'count':0x0,'rows':[]};var _0x17e068=_[_0x1734('0x25')](db[_0x1734('0x26')]['rawAttributes'],function(_0x3eb31b){return{'name':_0x3eb31b[_0x1734('0x27')],'type':_0x3eb31b[_0x1734('0x28')]['key']};});_0x381960[_0x1734('0x29')]=_[_0x1734('0x2a')](_['map'](_0x17e068,_0x1734('0x22')),[_0x1734('0x22')]);_0x381960[_0x1734('0x2b')]=_[_0x1734('0x2c')](_0x3616c1['query']);_0x381960[_0x1734('0x2d')]=_[_0x1734('0x2e')](_0x381960['model'],_0x381960['query']);_0x4a670a[_0x1734('0x2f')]=_[_0x1734('0x2e')](_0x381960[_0x1734('0x29')],qs[_0x1734('0x30')](_0x3616c1[_0x1734('0x2b')][_0x1734('0x30')]));_0x4a670a[_0x1734('0x2f')]=_0x4a670a[_0x1734('0x2f')][_0x1734('0x31')]?_0x4a670a[_0x1734('0x2f')]:_0x381960[_0x1734('0x29')];if(!_0x3616c1[_0x1734('0x2b')][_0x1734('0x32')](_0x1734('0x33'))){_0x4a670a[_0x1734('0x34')]=qs[_0x1734('0x34')](_0x3616c1[_0x1734('0x2b')]['limit']);_0x4a670a[_0x1734('0x1c')]=qs['offset'](_0x3616c1[_0x1734('0x2b')][_0x1734('0x1c')]);}_0x4a670a[_0x1734('0x35')]=qs[_0x1734('0x36')](_0x3616c1[_0x1734('0x2b')][_0x1734('0x36')]);_0x4a670a[_0x1734('0x37')]=qs[_0x1734('0x2d')](_['pick'](_0x3616c1[_0x1734('0x2b')],_0x381960[_0x1734('0x2d')]),_0x17e068);if(_0x3616c1[_0x1734('0x2b')][_0x1734('0x38')]){_0x4a670a[_0x1734('0x37')]=_[_0x1734('0x39')](_0x4a670a[_0x1734('0x37')],{'$or':_['map'](_0x17e068,function(_0x1f67b4){if(_0x1f67b4[_0x1734('0x28')]!==_0x1734('0x3a')){var _0x3a9bcd={};_0x3a9bcd[_0x1f67b4[_0x1734('0x22')]]={'$like':'%'+_0x3616c1[_0x1734('0x2b')][_0x1734('0x38')]+'%'};return _0x3a9bcd;}})});}_0x4a670a=_[_0x1734('0x39')]({},_0x4a670a,_0x3616c1['options']);var _0x1f5cc6={'where':_0x4a670a['where']};return db[_0x1734('0x26')][_0x1734('0x1b')](_0x1f5cc6)[_0x1734('0x1f')](function(_0x387aab){_0x52eaf5[_0x1734('0x1b')]=_0x387aab;if(_0x3616c1[_0x1734('0x2b')][_0x1734('0x3b')]){_0x4a670a[_0x1734('0x3c')]=[{'all':!![]}];}return db[_0x1734('0x26')][_0x1734('0x3d')](_0x4a670a);})[_0x1734('0x1f')](function(_0x55d67c){_0x52eaf5[_0x1734('0x3e')]=_0x55d67c;return _0x52eaf5;})[_0x1734('0x1f')](respondWithFilteredResult(_0x27d6e5,_0x4a670a))[_0x1734('0x3f')](handleError(_0x27d6e5,null));};exports[_0x1734('0x40')]=function(_0x5f34e1,_0x4369a2){var _0x562be1={'raw':!![],'where':{'id':_0x5f34e1[_0x1734('0x41')]['id']}},_0x539270={};_0x539270[_0x1734('0x29')]=_[_0x1734('0x2c')](db[_0x1734('0x26')]['rawAttributes']);_0x539270[_0x1734('0x2b')]=_[_0x1734('0x2c')](_0x5f34e1['query']);_0x539270[_0x1734('0x2d')]=_[_0x1734('0x2e')](_0x539270['model'],_0x539270[_0x1734('0x2b')]);_0x562be1['attributes']=_[_0x1734('0x2e')](_0x539270[_0x1734('0x29')],qs[_0x1734('0x30')](_0x5f34e1[_0x1734('0x2b')][_0x1734('0x30')]));_0x562be1[_0x1734('0x2f')]=_0x562be1[_0x1734('0x2f')]['length']?_0x562be1[_0x1734('0x2f')]:_0x539270[_0x1734('0x29')];if(_0x5f34e1['query'][_0x1734('0x3b')]){_0x562be1[_0x1734('0x3c')]=[{'all':!![]}];}_0x562be1=_[_0x1734('0x39')]({},_0x562be1,_0x5f34e1[_0x1734('0x42')]);return db['VoiceMailMessage'][_0x1734('0x43')](_0x562be1)[_0x1734('0x1f')](handleEntityNotFound(_0x4369a2,null))[_0x1734('0x1f')](respondWithResult(_0x4369a2,null))['catch'](handleError(_0x4369a2,null));};exports[_0x1734('0x44')]=function(_0x245420,_0xa86be6){return db[_0x1734('0x26')][_0x1734('0x44')](_0x245420[_0x1734('0x45')],{})[_0x1734('0x1f')](respondWithResult(_0xa86be6,0xc9))[_0x1734('0x3f')](handleError(_0xa86be6,null));};exports[_0x1734('0x46')]=function(_0x408b12,_0x1ef5d6){if(_0x408b12[_0x1734('0x45')]['id']){delete _0x408b12[_0x1734('0x45')]['id'];}return db[_0x1734('0x26')][_0x1734('0x43')]({'where':{'id':_0x408b12[_0x1734('0x41')]['id']}})[_0x1734('0x1f')](handleEntityNotFound(_0x1ef5d6,null))[_0x1734('0x1f')](saveUpdates(_0x408b12['body'],null))[_0x1734('0x1f')](respondWithResult(_0x1ef5d6,null))['catch'](handleError(_0x1ef5d6,null));};exports[_0x1734('0x20')]=function(_0x3d49d6,_0x95d24f){return db[_0x1734('0x26')]['find']({'where':{'id':_0x3d49d6['params']['id']}})[_0x1734('0x1f')](handleEntityNotFound(_0x95d24f,null))[_0x1734('0x1f')](removeEntity(_0x95d24f,null))['catch'](handleError(_0x95d24f,null));};exports[_0x1734('0x47')]=function(_0x1c5d2f,_0x2a71cf,_0x427cd8){return db[_0x1734('0x26')][_0x1734('0x43')]({'where':{'id':_0x1c5d2f[_0x1734('0x41')]['id']},'attributes':['id','recording',_0x1734('0x48')]})[_0x1734('0x1f')](handleEntityNotFound(_0x2a71cf,null))[_0x1734('0x1f')](function(_0x47cd87){if(_0x47cd87){if(!_0x47cd87[_0x1734('0x49')]){throw new db[(_0x1734('0x4a'))][(_0x1734('0x4b'))](_0x1734('0x4c'));}var _0x5c1d5d={'Content-Type':_0x1734('0x4d'),'Content-Disposition':_0x1734('0x4e')};if(_0x47cd87[_0x1734('0x48')]){_0x5c1d5d[_0x1734('0x4f')]=_0x1734('0x50')+_0x47cd87['msg_id']+_0x1734('0x51');}_0x2a71cf['set'](_0x5c1d5d);return _0x2a71cf['send'](new Buffer(_0x47cd87[_0x1734('0x49')]));}})[_0x1734('0x3f')](handleError(_0x2a71cf,null));}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.model.js b/server/api/voiceMailMessage/voiceMailMessage.model.js index 1d7347b..61ac62a 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 _0x8a5c=['bluebird','request-promise','path','rimraf','./voiceMailMessage.attributes','exports','define','VoiceMailMessage','voice_voicemail_messages','dir','lodash','util','../../config/logger','api','moment'];(function(_0x24a531,_0x37a5c6){var _0x3440d8=function(_0x300dab){while(--_0x300dab){_0x24a531['push'](_0x24a531['shift']());}};_0x3440d8(++_0x37a5c6);}(_0x8a5c,0x136));var _0xc8a5=function(_0xb59c62,_0x228786){_0xb59c62=_0xb59c62-0x0;var _0xb67e57=_0x8a5c[_0xb59c62];return _0xb67e57;};'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':'dir','fields':[_0xc8a5('0xe')]}],'timestamps':![]});}; \ No newline at end of file +var _0xd7d1=['VoiceMailMessage','voice_voicemail_messages','dir','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./voiceMailMessage.attributes','exports','define'];(function(_0x4387f2,_0x5e49b4){var _0x3ed955=function(_0x177d07){while(--_0x177d07){_0x4387f2['push'](_0x4387f2['shift']());}};_0x3ed955(++_0x5e49b4);}(_0xd7d1,0x1b3));var _0x1d7d=function(_0x1d2252,_0x5b48d9){_0x1d2252=_0x1d2252-0x0;var _0x107e09=_0xd7d1[_0x1d2252];return _0x107e09;};'use strict';var _=require(_0x1d7d('0x0'));var util=require(_0x1d7d('0x1'));var logger=require(_0x1d7d('0x2'))(_0x1d7d('0x3'));var moment=require(_0x1d7d('0x4'));var BPromise=require(_0x1d7d('0x5'));var rp=require(_0x1d7d('0x6'));var fs=require('fs');var path=require(_0x1d7d('0x7'));var rimraf=require(_0x1d7d('0x8'));var config=require(_0x1d7d('0x9'));var attributes=require(_0x1d7d('0xa'));module[_0x1d7d('0xb')]=function(_0x14b2b9,_0x5a8cf3){return _0x14b2b9[_0x1d7d('0xc')](_0x1d7d('0xd'),attributes,{'tableName':_0x1d7d('0xe'),'paranoid':![],'indexes':[{'name':_0x1d7d('0xf'),'fields':[_0x1d7d('0xf')]}],'timestamps':![]});}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.rpc.js b/server/api/voiceMailMessage/voiceMailMessage.rpc.js index 7ed9ad1..602284e 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 _0xda2d=['bluebird','randomstring','ioredis','rpc','../../config/environment','jayson/promise','client','http','then','VoiceMailMessage,\x20%s,\x20%s','request\x20sent','debug','VoiceMailMessage,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','util','moment'];(function(_0x7440e0,_0x42d9b8){var _0x33ee99=function(_0x3edb33){while(--_0x3edb33){_0x7440e0['push'](_0x7440e0['shift']());}};_0x33ee99(++_0x42d9b8);}(_0xda2d,0x102));var _0xdda2=function(_0x54e391,_0x4c9c53){_0x54e391=_0x54e391-0x0;var _0x445653=_0xda2d[_0x54e391];return _0x445653;};'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});function respondWithRpcPromise(_0xf38e58,_0x2f55dc,_0x436676){return new BPromise(function(_0x2e2523,_0x341c7b){return client['request'](_0xf38e58,_0x436676)[_0xdda2('0xa')](function(_0x22c6e5){logger['info'](_0xdda2('0xb'),_0x2f55dc,_0xdda2('0xc'));logger[_0xdda2('0xd')](_0xdda2('0xe'),_0x2f55dc,_0xdda2('0xc'),JSON[_0xdda2('0xf')](_0x22c6e5));if(_0x22c6e5[_0xdda2('0x10')]){if(_0x22c6e5[_0xdda2('0x10')]['code']===0x1f4){logger['error']('VoiceMailMessage,\x20%s,\x20%s',_0x2f55dc,_0x22c6e5[_0xdda2('0x10')][_0xdda2('0x11')]);return _0x341c7b(_0x22c6e5[_0xdda2('0x10')][_0xdda2('0x11')]);}logger[_0xdda2('0x10')](_0xdda2('0xb'),_0x2f55dc,_0x22c6e5[_0xdda2('0x10')]['message']);return _0x2e2523(_0x22c6e5[_0xdda2('0x10')]['message']);}else{logger[_0xdda2('0x12')](_0xdda2('0xb'),_0x2f55dc,_0xdda2('0xc'));_0x2e2523(_0x22c6e5[_0xdda2('0x13')][_0xdda2('0x11')]);}})['catch'](function(_0x55d674){logger[_0xdda2('0x10')]('VoiceMailMessage,\x20%s,\x20%s',_0x2f55dc,_0x55d674);_0x341c7b(_0x55d674);});});} \ No newline at end of file +var _0x57ca=['client','http','request','info','request\x20sent','VoiceMailMessage,\x20%s,\x20%s,\x20%s','error','code','VoiceMailMessage,\x20%s,\x20%s','message','result','catch','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise'];(function(_0x47e97c,_0x580b25){var _0x2f2891=function(_0x5a58e6){while(--_0x5a58e6){_0x47e97c['push'](_0x47e97c['shift']());}};_0x2f2891(++_0x580b25);}(_0x57ca,0x108));var _0xa57c=function(_0x49a6ba,_0x116f2c){_0x49a6ba=_0x49a6ba-0x0;var _0x517537=_0x57ca[_0x49a6ba];return _0x517537;};'use strict';var _=require('lodash');var util=require(_0xa57c('0x0'));var moment=require(_0xa57c('0x1'));var BPromise=require('bluebird');var rs=require(_0xa57c('0x2'));var fs=require('fs');var Redis=require(_0xa57c('0x3'));var db=require(_0xa57c('0x4'))['db'];var utils=require(_0xa57c('0x5'));var logger=require(_0xa57c('0x6'))('rpc');var config=require(_0xa57c('0x7'));var jayson=require(_0xa57c('0x8'));var client=jayson[_0xa57c('0x9')][_0xa57c('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xbdfffb,_0x314574,_0x19e28e){return new BPromise(function(_0x271ccc,_0x5e3962){return client[_0xa57c('0xb')](_0xbdfffb,_0x19e28e)['then'](function(_0x46ba92){logger[_0xa57c('0xc')]('VoiceMailMessage,\x20%s,\x20%s',_0x314574,_0xa57c('0xd'));logger['debug'](_0xa57c('0xe'),_0x314574,_0xa57c('0xd'),JSON['stringify'](_0x46ba92));if(_0x46ba92[_0xa57c('0xf')]){if(_0x46ba92['error'][_0xa57c('0x10')]===0x1f4){logger[_0xa57c('0xf')](_0xa57c('0x11'),_0x314574,_0x46ba92[_0xa57c('0xf')][_0xa57c('0x12')]);return _0x5e3962(_0x46ba92['error'][_0xa57c('0x12')]);}logger['error'](_0xa57c('0x11'),_0x314574,_0x46ba92[_0xa57c('0xf')][_0xa57c('0x12')]);return _0x271ccc(_0x46ba92[_0xa57c('0xf')][_0xa57c('0x12')]);}else{logger[_0xa57c('0xc')](_0xa57c('0x11'),_0x314574,'request\x20sent');_0x271ccc(_0x46ba92[_0xa57c('0x13')][_0xa57c('0x12')]);}})[_0xa57c('0x14')](function(_0x5a6024){logger[_0xa57c('0xf')]('VoiceMailMessage,\x20%s,\x20%s',_0x314574,_0x5a6024);_0x5e3962(_0x5a6024);});});} \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/index.js b/server/api/voiceMusicOnHold/index.js index e550054..92c5b6e 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 _0x746b=['show','getSounds','create','post','/:id/sounds','addSound','put','update','delete','destroy','/:id/sounds/:id2','util','Router','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','/:id'];(function(_0xea88c1,_0x461ebd){var _0x1082e8=function(_0x53703a){while(--_0x53703a){_0xea88c1['push'](_0xea88c1['shift']());}};_0x1082e8(++_0x461ebd);}(_0x746b,0x1ad));var _0xb746=function(_0x48e06c,_0xd37cb8){_0x48e06c=_0x48e06c-0x0;var _0x45a0df=_0x746b[_0x48e06c];return _0x45a0df;};'use strict';var multer=require('multer');var util=require(_0xb746('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0xb746('0x1')]();var auth=require(_0xb746('0x2'));var interaction=require(_0xb746('0x3'));var config=require('../../config/environment');var controller=require('./voiceMusicOnHold.controller');router[_0xb746('0x4')]('/',auth[_0xb746('0x5')](),controller[_0xb746('0x6')]);router[_0xb746('0x4')](_0xb746('0x7'),auth[_0xb746('0x5')](),controller[_0xb746('0x8')]);router['get']('/:id/sounds',auth[_0xb746('0x5')](),controller[_0xb746('0x9')]);router['post']('/',auth['isAuthenticated'](),controller[_0xb746('0xa')]);router[_0xb746('0xb')](_0xb746('0xc'),auth[_0xb746('0x5')](),controller[_0xb746('0xd')]);router[_0xb746('0xe')]('/:id',auth[_0xb746('0x5')](),controller[_0xb746('0xf')]);router[_0xb746('0x10')]('/:id',auth['isAuthenticated'](),controller[_0xb746('0x11')]);router['delete'](_0xb746('0x12'),auth[_0xb746('0x5')](),controller['removeSound']);module['exports']=router; \ No newline at end of file +var _0x0346=['update','destroy','/:id/sounds/:id2','removeSound','exports','util','path','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceMusicOnHold.controller','get','isAuthenticated','index','/:id','show','/:id/sounds','getSounds','create','post','addSound','put'];(function(_0x18e7fe,_0x2686fc){var _0x704fe2=function(_0x4f9138){while(--_0x4f9138){_0x18e7fe['push'](_0x18e7fe['shift']());}};_0x704fe2(++_0x2686fc);}(_0x0346,0x130));var _0x6034=function(_0x160170,_0x5596e0){_0x160170=_0x160170-0x0;var _0x1d81e7=_0x0346[_0x160170];return _0x1d81e7;};'use strict';var multer=require('multer');var util=require(_0x6034('0x0'));var path=require(_0x6034('0x1'));var timeout=require('connect-timeout');var express=require(_0x6034('0x2'));var router=express['Router']();var auth=require(_0x6034('0x3'));var interaction=require(_0x6034('0x4'));var config=require(_0x6034('0x5'));var controller=require(_0x6034('0x6'));router[_0x6034('0x7')]('/',auth[_0x6034('0x8')](),controller[_0x6034('0x9')]);router['get'](_0x6034('0xa'),auth[_0x6034('0x8')](),controller[_0x6034('0xb')]);router[_0x6034('0x7')](_0x6034('0xc'),auth[_0x6034('0x8')](),controller[_0x6034('0xd')]);router['post']('/',auth[_0x6034('0x8')](),controller[_0x6034('0xe')]);router[_0x6034('0xf')](_0x6034('0xc'),auth[_0x6034('0x8')](),controller[_0x6034('0x10')]);router[_0x6034('0x11')]('/:id',auth['isAuthenticated'](),controller[_0x6034('0x12')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0x6034('0x13')]);router['delete'](_0x6034('0x14'),auth['isAuthenticated'](),controller[_0x6034('0x15')]);module[_0x6034('0x16')]=router; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.attributes.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.attributes.js index c3055b9..141b3f8 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 _0x496a=['mp3','alpha','TIMESTAMP','BOOLEAN','exports','STRING','files','mp3nb','quietmp3nb','quietmp3'];(function(_0x1fb9a5,_0x1f026c){var _0x5eb7f0=function(_0x5c8979){while(--_0x5c8979){_0x1fb9a5['push'](_0x1fb9a5['shift']());}};_0x5eb7f0(++_0x1f026c);}(_0x496a,0xfe));var _0xa496=function(_0x999d24,_0x1ea701){_0x999d24=_0x999d24-0x0;var _0x2a050d=_0x496a[_0x999d24];return _0x2a050d;};'use strict';var Sequelize=require('sequelize');module[_0xa496('0x0')]={'name':{'type':Sequelize[_0xa496('0x1')],'allowNull':![],'unique':'name'},'mode':{'type':Sequelize['ENUM']('custom',_0xa496('0x2'),_0xa496('0x3'),_0xa496('0x4'),_0xa496('0x5'),_0xa496('0x6')),'allowNull':!![],'defaultValue':'files'},'directory':{'type':Sequelize['STRING'],'allowNull':!![]},'application':{'type':Sequelize[_0xa496('0x1')],'allowNull':!![]},'digit':{'type':Sequelize[_0xa496('0x1')],'allowNull':!![]},'sort':{'type':Sequelize[_0xa496('0x1')],'allowNull':!![],'defaultValue':_0xa496('0x7')},'format':{'type':Sequelize[_0xa496('0x1')],'allowNull':!![]},'stamp':{'type':_0xa496('0x8')},'defaultEntry':{'type':Sequelize[_0xa496('0x9')],'defaultValue':0x0}}; \ No newline at end of file +var _0xc634=['files','mp3nb','quietmp3nb','quietmp3','mp3','STRING','alpha','BOOLEAN','sequelize','exports','ENUM'];(function(_0x3ce4af,_0x13187a){var _0x43985e=function(_0xebf2d5){while(--_0xebf2d5){_0x3ce4af['push'](_0x3ce4af['shift']());}};_0x43985e(++_0x13187a);}(_0xc634,0x173));var _0x4c63=function(_0x3b2c8e,_0x53910b){_0x3b2c8e=_0x3b2c8e-0x0;var _0x3ebe3d=_0xc634[_0x3b2c8e];return _0x3ebe3d;};'use strict';var Sequelize=require(_0x4c63('0x0'));module[_0x4c63('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':'name'},'mode':{'type':Sequelize[_0x4c63('0x2')]('custom',_0x4c63('0x3'),_0x4c63('0x4'),_0x4c63('0x5'),_0x4c63('0x6'),_0x4c63('0x7')),'allowNull':!![],'defaultValue':'files'},'directory':{'type':Sequelize[_0x4c63('0x8')],'allowNull':!![]},'application':{'type':Sequelize['STRING'],'allowNull':!![]},'digit':{'type':Sequelize[_0x4c63('0x8')],'allowNull':!![]},'sort':{'type':Sequelize[_0x4c63('0x8')],'allowNull':!![],'defaultValue':_0x4c63('0x9')},'format':{'type':Sequelize[_0x4c63('0x8')],'allowNull':!![]},'stamp':{'type':'TIMESTAMP'},'defaultEntry':{'type':Sequelize[_0x4c63('0xa')],'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 f0a88b6..c37c5bc 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(_0x3ca4d0,_0x56b572){var _0xca0702=function(_0x1dc4b9){while(--_0x1dc4b9){_0x3ca4d0['push'](_0x3ca4d0['shift']());}};_0xca0702(++_0x56b572);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var pdf=require(_0x0d8b('0x0'));var emlformat=require(_0x0d8b('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x0d8b('0x2'));var moment=require(_0x0d8b('0x3'));var BPromise=require(_0x0d8b('0x4'));var Mustache=require(_0x0d8b('0x5'));var util=require(_0x0d8b('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0x0d8b('0x7'));var ejs=require(_0x0d8b('0x8'));var fs=require('fs');var _=require(_0x0d8b('0x9'));var squel=require('squel');var crypto=require(_0x0d8b('0xa'));var jsforce=require(_0x0d8b('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x0d8b('0x7'));var querystring=require(_0x0d8b('0xc'));var Papa=require(_0x0d8b('0xd'));var Redis=require(_0x0d8b('0xe'));var authService=require(_0x0d8b('0xf'));var qs=require(_0x0d8b('0x10'));var as=require(_0x0d8b('0x11'));var hardwareService=require(_0x0d8b('0x12'));var logger=require('../../config/logger')(_0x0d8b('0x13'));var utils=require('../../config/utils');var config=require(_0x0d8b('0x14'));var db=require(_0x0d8b('0x15'))['db'];function respondWithStatusCode(_0x340cc4,_0x92cdd8){_0x92cdd8=_0x92cdd8||0xcc;return function(_0x35a07b){if(_0x35a07b){return _0x340cc4[_0x0d8b('0x16')](_0x92cdd8);}return _0x340cc4[_0x0d8b('0x17')](_0x92cdd8)[_0x0d8b('0x18')]();};}function respondWithResult(_0x1d4bbc,_0x2ce75e){_0x2ce75e=_0x2ce75e||0xc8;return function(_0x5ad086){if(_0x5ad086){return _0x1d4bbc[_0x0d8b('0x17')](_0x2ce75e)[_0x0d8b('0x19')](_0x5ad086);}};}function respondWithFilteredResult(_0x2d4e1c,_0x4f6f21){return function(_0x23eb7b){if(_0x23eb7b){var _0xa86349=_0x23eb7b['count'],_0x17f7df=_0x4f6f21[_0x0d8b('0x1a')],_0xe2e167=_0x4f6f21[_0x0d8b('0x1a')]+_0x4f6f21[_0x0d8b('0x1b')],_0x2cb03c;if(_0xe2e167>=_0xa86349){_0xe2e167=_0xa86349;_0x2cb03c=0xc8;}else{_0x2cb03c=0xce;}_0x2d4e1c[_0x0d8b('0x17')](_0x2cb03c);return _0x2d4e1c[_0x0d8b('0x1c')](_0x0d8b('0x1d'),_0x17f7df+'-'+_0xe2e167+'/'+_0xa86349)[_0x0d8b('0x19')](_0x23eb7b);}return null;};}function patchUpdates(_0xa3612a){return function(_0x4a15bf){try{jsonpatch[_0x0d8b('0x1e')](_0x4a15bf,_0xa3612a,!![]);}catch(_0x23d58f){return BPromise[_0x0d8b('0x1f')](_0x23d58f);}return _0x4a15bf[_0x0d8b('0x20')]();};}function saveUpdates(_0x24e8ed,_0x5b709c){return function(_0x393beb){if(_0x393beb){return _0x393beb[_0x0d8b('0x21')](_0x24e8ed)['then'](function(_0x4f0a1a){return _0x4f0a1a;});}return null;};}function removeEntity(_0x33fb87,_0x54a9a7){return function(_0x56c729){if(_0x56c729){return _0x56c729['destroy']()[_0x0d8b('0x22')](function(){var _0x2b924f=_0x56c729[_0x0d8b('0x23')]({'plain':!![]});var _0x38efc8=_0x0d8b('0x24');return db[_0x0d8b('0x25')][_0x0d8b('0x26')]({'where':{'type':_0x38efc8,'resourceId':_0x2b924f['id']}})[_0x0d8b('0x22')](function(){return _0x56c729;});})[_0x0d8b('0x22')](function(){_0x33fb87['status'](0xcc)[_0x0d8b('0x18')]();});}};}function handleEntityNotFound(_0x4463ee,_0x5363e3){return function(_0xe1ef20){if(!_0xe1ef20){_0x4463ee['sendStatus'](0x194);}return _0xe1ef20;};}function handleError(_0x3dd149,_0x234bdd){_0x234bdd=_0x234bdd||0x1f4;return function(_0xa2af02){logger['error'](_0xa2af02['stack']);if(_0xa2af02[_0x0d8b('0x27')]){delete _0xa2af02[_0x0d8b('0x27')];}_0x3dd149['status'](_0x234bdd)[_0x0d8b('0x28')](_0xa2af02);};}exports['index']=function(_0x1b2b59,_0x4b59e5){var _0x97050a={},_0x48f24f={},_0x2ab00d={'count':0x0,'rows':[]};var _0x546bf6=_[_0x0d8b('0x29')](db['VoiceMusicOnHold'][_0x0d8b('0x2a')],function(_0x106e4c){return{'name':_0x106e4c[_0x0d8b('0x2b')],'type':_0x106e4c['type']['key']};});_0x48f24f['model']=_[_0x0d8b('0x29')](_0x546bf6,'name');_0x48f24f[_0x0d8b('0x2c')]=_['keys'](_0x1b2b59['query']);_0x48f24f[_0x0d8b('0x2d')]=_[_0x0d8b('0x2e')](_0x48f24f[_0x0d8b('0x2f')],_0x48f24f[_0x0d8b('0x2c')]);_0x97050a[_0x0d8b('0x30')]=_[_0x0d8b('0x2e')](_0x48f24f[_0x0d8b('0x2f')],qs[_0x0d8b('0x31')](_0x1b2b59['query'][_0x0d8b('0x31')]));_0x97050a[_0x0d8b('0x30')]=_0x97050a['attributes'][_0x0d8b('0x32')]?_0x97050a[_0x0d8b('0x30')]:_0x48f24f[_0x0d8b('0x2f')];if(!_0x1b2b59['query'][_0x0d8b('0x33')](_0x0d8b('0x34'))){_0x97050a[_0x0d8b('0x1b')]=qs[_0x0d8b('0x1b')](_0x1b2b59[_0x0d8b('0x2c')]['limit']);_0x97050a[_0x0d8b('0x1a')]=qs[_0x0d8b('0x1a')](_0x1b2b59['query'][_0x0d8b('0x1a')]);}_0x97050a[_0x0d8b('0x35')]=qs[_0x0d8b('0x36')](_0x1b2b59[_0x0d8b('0x2c')][_0x0d8b('0x36')]);_0x97050a['where']=qs['filters'](_[_0x0d8b('0x37')](_0x1b2b59['query'],_0x48f24f['filters']),_0x546bf6);if(_0x1b2b59[_0x0d8b('0x2c')][_0x0d8b('0x38')]){_0x97050a[_0x0d8b('0x39')]=_[_0x0d8b('0x3a')](_0x97050a[_0x0d8b('0x39')],{'$or':_[_0x0d8b('0x29')](_0x546bf6,function(_0x579324){if(_0x579324[_0x0d8b('0x3b')]!==_0x0d8b('0x3c')){var _0x28fd82={};_0x28fd82[_0x579324[_0x0d8b('0x27')]]={'$like':'%'+_0x1b2b59[_0x0d8b('0x2c')][_0x0d8b('0x38')]+'%'};return _0x28fd82;}})});}_0x97050a=_[_0x0d8b('0x3a')]({},_0x97050a,_0x1b2b59['options']);var _0x1d06b6={'where':_0x97050a[_0x0d8b('0x39')]};return db[_0x0d8b('0x3d')][_0x0d8b('0x3e')](_0x1d06b6)['then'](function(_0xe0bf42){_0x2ab00d['count']=_0xe0bf42;if(_0x1b2b59[_0x0d8b('0x2c')][_0x0d8b('0x3f')]){_0x97050a[_0x0d8b('0x40')]=[{'all':!![]}];}return db[_0x0d8b('0x3d')][_0x0d8b('0x41')](_0x97050a);})[_0x0d8b('0x22')](function(_0x1ff17d){_0x2ab00d[_0x0d8b('0x42')]=_0x1ff17d;return _0x2ab00d;})[_0x0d8b('0x22')](respondWithFilteredResult(_0x4b59e5,_0x97050a))[_0x0d8b('0x43')](handleError(_0x4b59e5,null));};exports['show']=function(_0x571acf,_0x576050){var _0x4d0811={'raw':![],'where':{'id':_0x571acf[_0x0d8b('0x44')]['id']}},_0x524d79={};_0x524d79[_0x0d8b('0x2f')]=_[_0x0d8b('0x45')](db['VoiceMusicOnHold']['rawAttributes']);_0x524d79[_0x0d8b('0x2c')]=_[_0x0d8b('0x45')](_0x571acf[_0x0d8b('0x2c')]);_0x524d79['filters']=_[_0x0d8b('0x2e')](_0x524d79[_0x0d8b('0x2f')],_0x524d79['query']);_0x4d0811['attributes']=_[_0x0d8b('0x2e')](_0x524d79['model'],qs[_0x0d8b('0x31')](_0x571acf['query']['fields']));_0x4d0811[_0x0d8b('0x30')]=_0x4d0811[_0x0d8b('0x30')]['length']?_0x4d0811['attributes']:_0x524d79['model'];if(_0x571acf['query'][_0x0d8b('0x3f')]){_0x4d0811[_0x0d8b('0x40')]=[{'all':!![]}];}_0x4d0811=_[_0x0d8b('0x3a')]({},_0x4d0811,_0x571acf['options']);return db[_0x0d8b('0x3d')][_0x0d8b('0x46')](_0x4d0811)[_0x0d8b('0x22')](handleEntityNotFound(_0x576050,null))[_0x0d8b('0x22')](respondWithResult(_0x576050,null))[_0x0d8b('0x43')](handleError(_0x576050,null));};exports[_0x0d8b('0x21')]=function(_0x11d22b,_0x1d5067){if(_0x11d22b[_0x0d8b('0x47')]['id']){delete _0x11d22b[_0x0d8b('0x47')]['id'];}return db[_0x0d8b('0x3d')][_0x0d8b('0x46')]({'where':{'id':_0x11d22b[_0x0d8b('0x44')]['id']}})[_0x0d8b('0x22')](handleEntityNotFound(_0x1d5067,null))[_0x0d8b('0x22')](saveUpdates(_0x11d22b[_0x0d8b('0x47')],null))[_0x0d8b('0x22')](respondWithResult(_0x1d5067,null))[_0x0d8b('0x43')](handleError(_0x1d5067,null));};exports[_0x0d8b('0x48')]=function(_0x574b90,_0x371fa0,_0x4d8850){return db['sequelize'][_0x0d8b('0x49')](function(_0x113fb7){if(_0x574b90[_0x0d8b('0x47')][_0x0d8b('0x4a')]==='files'){_0x574b90[_0x0d8b('0x47')][_0x0d8b('0x4b')]=path[_0x0d8b('0x4c')](config[_0x0d8b('0x4d')],_0x0d8b('0x4e'),_0x574b90['body']['name']);}return db['VoiceMusicOnHold']['create'](_0x574b90[_0x0d8b('0x47')],{'transaction':_0x113fb7})[_0x0d8b('0x22')](function(_0x5e3bb4){if(_0x574b90['body'][_0x0d8b('0x4a')]===_0x0d8b('0x4f')){fs['mkdirSync'](_0x5e3bb4['directory'],parseInt(_0x0d8b('0x50'),0x8));}var _0xeeefd4=_0x574b90[_0x0d8b('0x51')][_0x0d8b('0x23')]({'plain':!![]});if(!_0xeeefd4)throw new Error(_0x0d8b('0x52'));if(_0xeeefd4['role']===_0x0d8b('0x51')){var _0x2afe34=_0x5e3bb4['get']({'plain':!![]});return db['UserProfileSection'][_0x0d8b('0x46')]({'where':{'name':_0x0d8b('0x24'),'userProfileId':_0xeeefd4['userProfileId']},'raw':!![]})['then'](function(_0xb8be3b){if(_0xb8be3b&&_0xb8be3b[_0x0d8b('0x53')]===0x0){return db[_0x0d8b('0x25')][_0x0d8b('0x48')]({'name':_0x2afe34['name'],'resourceId':_0x2afe34['id'],'type':_0xb8be3b[_0x0d8b('0x27')],'sectionId':_0xb8be3b['id']},{})['then'](function(){return _0x5e3bb4;});}else{return _0x5e3bb4;}})['catch'](function(_0x38c24e){logger[_0x0d8b('0x54')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x38c24e);});}return _0x5e3bb4;});})['then'](respondWithResult(_0x371fa0,0xc9))[_0x0d8b('0x43')](handleError(_0x371fa0,null));};exports[_0x0d8b('0x26')]=function(_0xccc2a9,_0x2c1eb0,_0x3afc3a){var _0xb66e76;return db[_0x0d8b('0x3d')][_0x0d8b('0x46')]({'where':{'id':_0xccc2a9['params']['id']}})[_0x0d8b('0x22')](function(_0x37dc9f){if(_0x37dc9f){return db[_0x0d8b('0x55')][_0x0d8b('0x49')](function(_0x3fb9ea){return _0x37dc9f[_0x0d8b('0x26')]({'transaction':_0x3fb9ea,'raw':!![]})[_0x0d8b('0x22')](function(_0x1c78b6){if(_0x1c78b6[_0x0d8b('0x4b')]){fs['readdirSync'](_0x1c78b6[_0x0d8b('0x4b')])[_0x0d8b('0x56')](function(_0x180b7b){fs[_0x0d8b('0x57')](path[_0x0d8b('0x4c')](_0x1c78b6['directory'],_0x180b7b));});fs[_0x0d8b('0x58')](_0x1c78b6[_0x0d8b('0x4b')]);}return _0x1c78b6;});})[_0x0d8b('0x43')](function(_0x17a87f){throw new db[(_0x0d8b('0x59'))]['ValidationError'](_0x17a87f['message']);});}})[_0x0d8b('0x22')](handleEntityNotFound(_0x2c1eb0,null))[_0x0d8b('0x22')](removeEntity(_0x2c1eb0,null))[_0x0d8b('0x43')](handleError(_0x2c1eb0,null));};exports[_0x0d8b('0x5a')]=function(_0x5a70bd,_0x199122,_0x12aef7){return db[_0x0d8b('0x55')]['transaction'](function(_0x2f19f4){var _0x532a85;return db[_0x0d8b('0x3d')][_0x0d8b('0x46')]({'where':{'id':_0x5a70bd[_0x0d8b('0x44')]['id']}})[_0x0d8b('0x22')](function(_0x2b6eb6){if(_0x2b6eb6){_0x532a85=_0x2b6eb6;return _0x2b6eb6[_0x0d8b('0x5a')](_0x5a70bd['body']['id'],{'transaction':_0x2f19f4});}})[_0x0d8b('0x22')](function(_0x4c074d){if(_0x4c074d){return db[_0x0d8b('0x5b')][_0x0d8b('0x5c')]({'where':{'id':_0x5a70bd[_0x0d8b('0x47')]['id']},'attributes':['id',_0x0d8b('0x27'),'save_name',_0x0d8b('0x5d'),_0x0d8b('0x5e')],'raw':!![]});}})[_0x0d8b('0x22')](function(_0x2332fc){if(_0x2332fc){var _0x2ccdae=path[_0x0d8b('0x4c')](config[_0x0d8b('0x4d')],_0x0d8b('0x5f'),util[_0x0d8b('0x60')](_0x0d8b('0x61'),path['basename'](_0x2332fc['save_name'],path[_0x0d8b('0x62')](_0x2332fc[_0x0d8b('0x63')])),_0x2332fc['converted_format']));var _0xb1aa96=path['join'](config['root'],_0x0d8b('0x4e'),_0x532a85[_0x0d8b('0x27')],util['format']('%s.%s',_0x2332fc[_0x0d8b('0x27')],_0x2332fc[_0x0d8b('0x5d')]));fs[_0x0d8b('0x64')](_0x2ccdae,_0xb1aa96);return _0x2332fc;}})[_0x0d8b('0x43')](function(_0x2ab72b){throw new db[(_0x0d8b('0x59'))][(_0x0d8b('0x65'))](_0x2ab72b['message']);});})[_0x0d8b('0x22')](handleEntityNotFound(_0x199122,null))['then'](respondWithResult(_0x199122,0xc9))[_0x0d8b('0x43')](handleError(_0x199122,null));};exports[_0x0d8b('0x66')]=function(_0x2bb690,_0x14a34b,_0x49f610){return db[_0x0d8b('0x55')]['transaction'](function(_0x3a356b){var _0x2c6c5f;return db[_0x0d8b('0x3d')][_0x0d8b('0x5c')]({'where':{'id':_0x2bb690[_0x0d8b('0x44')]['id']}})[_0x0d8b('0x22')](handleEntityNotFound(_0x14a34b,null))[_0x0d8b('0x22')](function(_0x91aa89){if(_0x91aa89){_0x2c6c5f=_0x91aa89;return _0x91aa89[_0x0d8b('0x66')](_0x2bb690[_0x0d8b('0x44')]['id2']);}})[_0x0d8b('0x22')](function(_0x54c28b){if(_0x54c28b){return db[_0x0d8b('0x5b')][_0x0d8b('0x5c')]({'where':{'id':_0x2bb690['params'][_0x0d8b('0x67')]},'attributes':['id','name',_0x0d8b('0x63'),_0x0d8b('0x5d'),_0x0d8b('0x5e')],'raw':!![]});}})[_0x0d8b('0x22')](function(_0x2242cd){if(_0x2242cd){fs[_0x0d8b('0x57')](path[_0x0d8b('0x4c')](_0x2c6c5f[_0x0d8b('0x4b')],util['format'](_0x0d8b('0x61'),_0x2242cd[_0x0d8b('0x27')],_0x2242cd['converted_format'])));return _0x2242cd;}})[_0x0d8b('0x43')](function(_0x105df9){throw new db[(_0x0d8b('0x59'))][(_0x0d8b('0x65'))](_0x105df9[_0x0d8b('0x68')]);});})[_0x0d8b('0x22')](handleEntityNotFound(_0x14a34b,null))[_0x0d8b('0x22')](respondWithStatusCode(_0x14a34b,0xcc))[_0x0d8b('0x43')](handleError(_0x14a34b,null));};exports[_0x0d8b('0x69')]=function(_0x5007c0,_0xe35028,_0x16df83){var _0x50c0ff={};var _0x1ece98={};var _0x93fc55;var _0x3acffa;return db['VoiceMusicOnHold']['findOne']({'where':{'id':_0x5007c0[_0x0d8b('0x44')]['id']}})[_0x0d8b('0x22')](handleEntityNotFound(_0xe35028,null))[_0x0d8b('0x22')](function(_0x5b76af){if(_0x5b76af){_0x93fc55=_0x5b76af;_0x1ece98['model']=_[_0x0d8b('0x45')](db[_0x0d8b('0x5b')][_0x0d8b('0x2a')]);_0x1ece98[_0x0d8b('0x2c')]=_[_0x0d8b('0x45')](_0x5007c0[_0x0d8b('0x2c')]);_0x1ece98[_0x0d8b('0x2d')]=_[_0x0d8b('0x2e')](_0x1ece98[_0x0d8b('0x2f')],_0x1ece98[_0x0d8b('0x2c')]);_0x50c0ff[_0x0d8b('0x30')]=_[_0x0d8b('0x2e')](_0x1ece98[_0x0d8b('0x2f')],qs['fields'](_0x5007c0[_0x0d8b('0x2c')][_0x0d8b('0x31')]));_0x50c0ff['attributes']=_0x50c0ff['attributes'][_0x0d8b('0x32')]?_0x50c0ff[_0x0d8b('0x30')]:_0x1ece98[_0x0d8b('0x2f')];_0x50c0ff[_0x0d8b('0x35')]=qs[_0x0d8b('0x36')](_0x5007c0[_0x0d8b('0x2c')]['sort']);_0x50c0ff['where']=qs['filters'](_[_0x0d8b('0x37')](_0x5007c0[_0x0d8b('0x2c')],_0x1ece98[_0x0d8b('0x2d')]));if(_0x5007c0[_0x0d8b('0x2c')][_0x0d8b('0x38')]){_0x50c0ff[_0x0d8b('0x39')]=_['merge'](_0x50c0ff[_0x0d8b('0x39')],{'$or':_[_0x0d8b('0x29')](_0x50c0ff['attributes'],function(_0x30a69d){var _0x57e3c2={};_0x57e3c2[_0x30a69d]={'$like':'%'+_0x5007c0[_0x0d8b('0x2c')][_0x0d8b('0x38')]+'%'};return _0x57e3c2;})});}_0x50c0ff=_[_0x0d8b('0x3a')]({},_0x50c0ff,_0x5007c0[_0x0d8b('0x6a')]);return _0x93fc55[_0x0d8b('0x69')](_0x50c0ff);}})[_0x0d8b('0x22')](function(_0x424f9d){if(_0x424f9d){_0x3acffa=_0x424f9d[_0x0d8b('0x32')];if(!_0x5007c0[_0x0d8b('0x2c')][_0x0d8b('0x33')](_0x0d8b('0x34'))){_0x50c0ff[_0x0d8b('0x1b')]=qs['limit'](_0x5007c0['query'][_0x0d8b('0x1b')]);_0x50c0ff[_0x0d8b('0x1a')]=qs[_0x0d8b('0x1a')](_0x5007c0[_0x0d8b('0x2c')][_0x0d8b('0x1a')]);}return _0x93fc55[_0x0d8b('0x69')](_0x50c0ff);}})[_0x0d8b('0x22')](function(_0x54674f){if(_0x54674f){return _0x54674f?{'count':_0x3acffa,'rows':_0x54674f}:null;}})[_0x0d8b('0x22')](respondWithResult(_0xe35028,null))['catch'](handleError(_0xe35028,null));}; \ No newline at end of file +var _0x5f2f=['getSounds','nolimit','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','set','Content-Range','apply','reject','save','update','destroy','get','MusicOnHolds','UserProfileResource','then','end','error','stack','name','send','map','VoiceMusicOnHold','rawAttributes','fieldName','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','params','find','body','catch','transaction','mode','directory','server/files/moh','create','files','0777','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','sequelize','readdirSync','forEach','unlinkSync','join','rmdirSync','message','addSound','findOne','save_name','converted_format','createdAt','root','server/files/sounds/converted','format','%s.%s','basename','extname','symlinkSync','Sequelize','ValidationError','removeSound','id2','Sound'];(function(_0x351d6d,_0x4a3b0a){var _0x27336e=function(_0x4baa63){while(--_0x4baa63){_0x351d6d['push'](_0x351d6d['shift']());}};_0x27336e(++_0x4a3b0a);}(_0x5f2f,0x73));var _0xf5f2=function(_0x41f0a3,_0x2dfb5b){_0x41f0a3=_0x41f0a3-0x0;var _0x415a7d=_0x5f2f[_0x41f0a3];return _0x415a7d;};'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(){var _0x21cd91=_0x39c024[_0xf5f2('0x24')]({'plain':!![]});var _0x4e8bda=_0xf5f2('0x25');return db[_0xf5f2('0x26')]['destroy']({'where':{'type':_0x4e8bda,'resourceId':_0x21cd91['id']}})['then'](function(){return _0x39c024;});})[_0xf5f2('0x27')](function(){_0x170042[_0xf5f2('0x18')](0xcc)[_0xf5f2('0x28')]();});}};}function handleEntityNotFound(_0x1a5bb3,_0xf6c58d){return function(_0x788a8d){if(!_0x788a8d){_0x1a5bb3[_0xf5f2('0x17')](0x194);}return _0x788a8d;};}function handleError(_0x281ec8,_0x294414){_0x294414=_0x294414||0x1f4;return function(_0x4ab014){logger[_0xf5f2('0x29')](_0x4ab014[_0xf5f2('0x2a')]);if(_0x4ab014[_0xf5f2('0x2b')]){delete _0x4ab014[_0xf5f2('0x2b')];}_0x281ec8[_0xf5f2('0x18')](_0x294414)[_0xf5f2('0x2c')](_0x4ab014);};}exports['index']=function(_0x53cb96,_0x22c826){var _0x14c829={},_0x11c771={},_0x5027ab={'count':0x0,'rows':[]};var _0x5a2c7e=_[_0xf5f2('0x2d')](db[_0xf5f2('0x2e')][_0xf5f2('0x2f')],function(_0x153924){return{'name':_0x153924[_0xf5f2('0x30')],'type':_0x153924['type']['key']};});_0x11c771[_0xf5f2('0x31')]=_['map'](_0x5a2c7e,_0xf5f2('0x2b'));_0x11c771['query']=_[_0xf5f2('0x32')](_0x53cb96[_0xf5f2('0x33')]);_0x11c771[_0xf5f2('0x34')]=_[_0xf5f2('0x35')](_0x11c771[_0xf5f2('0x31')],_0x11c771[_0xf5f2('0x33')]);_0x14c829[_0xf5f2('0x36')]=_[_0xf5f2('0x35')](_0x11c771['model'],qs[_0xf5f2('0x37')](_0x53cb96[_0xf5f2('0x33')][_0xf5f2('0x37')]));_0x14c829[_0xf5f2('0x36')]=_0x14c829[_0xf5f2('0x36')][_0xf5f2('0x38')]?_0x14c829[_0xf5f2('0x36')]:_0x11c771['model'];if(!_0x53cb96[_0xf5f2('0x33')][_0xf5f2('0x39')]('nolimit')){_0x14c829[_0xf5f2('0x1c')]=qs['limit'](_0x53cb96[_0xf5f2('0x33')][_0xf5f2('0x1c')]);_0x14c829[_0xf5f2('0x1b')]=qs[_0xf5f2('0x1b')](_0x53cb96['query']['offset']);}_0x14c829[_0xf5f2('0x3a')]=qs[_0xf5f2('0x3b')](_0x53cb96[_0xf5f2('0x33')]['sort']);_0x14c829[_0xf5f2('0x3c')]=qs['filters'](_[_0xf5f2('0x3d')](_0x53cb96['query'],_0x11c771[_0xf5f2('0x34')]),_0x5a2c7e);if(_0x53cb96[_0xf5f2('0x33')]['filter']){_0x14c829[_0xf5f2('0x3c')]=_[_0xf5f2('0x3e')](_0x14c829[_0xf5f2('0x3c')],{'$or':_[_0xf5f2('0x2d')](_0x5a2c7e,function(_0x542cd6){if(_0x542cd6['type']!==_0xf5f2('0x3f')){var _0x140a11={};_0x140a11[_0x542cd6[_0xf5f2('0x2b')]]={'$like':'%'+_0x53cb96[_0xf5f2('0x33')][_0xf5f2('0x40')]+'%'};return _0x140a11;}})});}_0x14c829=_[_0xf5f2('0x3e')]({},_0x14c829,_0x53cb96[_0xf5f2('0x41')]);var _0x4c0ac7={'where':_0x14c829[_0xf5f2('0x3c')]};return db[_0xf5f2('0x2e')]['count'](_0x4c0ac7)[_0xf5f2('0x27')](function(_0x3f3895){_0x5027ab[_0xf5f2('0x1a')]=_0x3f3895;if(_0x53cb96[_0xf5f2('0x33')][_0xf5f2('0x42')]){_0x14c829[_0xf5f2('0x43')]=[{'all':!![]}];}return db[_0xf5f2('0x2e')][_0xf5f2('0x44')](_0x14c829);})['then'](function(_0x31c3c){_0x5027ab[_0xf5f2('0x45')]=_0x31c3c;return _0x5027ab;})[_0xf5f2('0x27')](respondWithFilteredResult(_0x22c826,_0x14c829))['catch'](handleError(_0x22c826,null));};exports['show']=function(_0x59eb00,_0x76d21b){var _0x2ad13c={'raw':![],'where':{'id':_0x59eb00[_0xf5f2('0x46')]['id']}},_0x4c8d8e={};_0x4c8d8e[_0xf5f2('0x31')]=_[_0xf5f2('0x32')](db[_0xf5f2('0x2e')][_0xf5f2('0x2f')]);_0x4c8d8e[_0xf5f2('0x33')]=_[_0xf5f2('0x32')](_0x59eb00[_0xf5f2('0x33')]);_0x4c8d8e[_0xf5f2('0x34')]=_[_0xf5f2('0x35')](_0x4c8d8e[_0xf5f2('0x31')],_0x4c8d8e[_0xf5f2('0x33')]);_0x2ad13c[_0xf5f2('0x36')]=_[_0xf5f2('0x35')](_0x4c8d8e['model'],qs[_0xf5f2('0x37')](_0x59eb00['query'][_0xf5f2('0x37')]));_0x2ad13c[_0xf5f2('0x36')]=_0x2ad13c[_0xf5f2('0x36')][_0xf5f2('0x38')]?_0x2ad13c[_0xf5f2('0x36')]:_0x4c8d8e[_0xf5f2('0x31')];if(_0x59eb00['query'][_0xf5f2('0x42')]){_0x2ad13c[_0xf5f2('0x43')]=[{'all':!![]}];}_0x2ad13c=_[_0xf5f2('0x3e')]({},_0x2ad13c,_0x59eb00[_0xf5f2('0x41')]);return db[_0xf5f2('0x2e')][_0xf5f2('0x47')](_0x2ad13c)[_0xf5f2('0x27')](handleEntityNotFound(_0x76d21b,null))[_0xf5f2('0x27')](respondWithResult(_0x76d21b,null))['catch'](handleError(_0x76d21b,null));};exports[_0xf5f2('0x22')]=function(_0x33ec29,_0x45db9a){if(_0x33ec29['body']['id']){delete _0x33ec29[_0xf5f2('0x48')]['id'];}return db[_0xf5f2('0x2e')][_0xf5f2('0x47')]({'where':{'id':_0x33ec29['params']['id']}})['then'](handleEntityNotFound(_0x45db9a,null))[_0xf5f2('0x27')](saveUpdates(_0x33ec29[_0xf5f2('0x48')],null))['then'](respondWithResult(_0x45db9a,null))[_0xf5f2('0x49')](handleError(_0x45db9a,null));};exports['create']=function(_0x740321,_0x497eb8,_0x2cbd9d){return db['sequelize'][_0xf5f2('0x4a')](function(_0xb8ea3a){if(_0x740321[_0xf5f2('0x48')][_0xf5f2('0x4b')]==='files'){_0x740321[_0xf5f2('0x48')][_0xf5f2('0x4c')]=path['join'](config['root'],_0xf5f2('0x4d'),_0x740321[_0xf5f2('0x48')]['name']);}return db[_0xf5f2('0x2e')][_0xf5f2('0x4e')](_0x740321[_0xf5f2('0x48')],{'transaction':_0xb8ea3a})[_0xf5f2('0x27')](function(_0x5d0db0){if(_0x740321['body'][_0xf5f2('0x4b')]===_0xf5f2('0x4f')){fs['mkdirSync'](_0x5d0db0[_0xf5f2('0x4c')],parseInt(_0xf5f2('0x50'),0x8));}var _0x255125=_0x740321[_0xf5f2('0x51')][_0xf5f2('0x24')]({'plain':!![]});if(!_0x255125)throw new Error(_0xf5f2('0x52'));if(_0x255125[_0xf5f2('0x53')]==='user'){var _0x59e8ef=_0x5d0db0[_0xf5f2('0x24')]({'plain':!![]});return db[_0xf5f2('0x54')][_0xf5f2('0x47')]({'where':{'name':_0xf5f2('0x25'),'userProfileId':_0x255125[_0xf5f2('0x55')]},'raw':!![]})['then'](function(_0xdb1106){if(_0xdb1106&&_0xdb1106[_0xf5f2('0x56')]===0x0){return db[_0xf5f2('0x26')]['create']({'name':_0x59e8ef[_0xf5f2('0x2b')],'resourceId':_0x59e8ef['id'],'type':_0xdb1106['name'],'sectionId':_0xdb1106['id']},{})[_0xf5f2('0x27')](function(){return _0x5d0db0;});}else{return _0x5d0db0;}})[_0xf5f2('0x49')](function(_0x28cce5){logger[_0xf5f2('0x29')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x28cce5);});}return _0x5d0db0;});})['then'](respondWithResult(_0x497eb8,0xc9))[_0xf5f2('0x49')](handleError(_0x497eb8,null));};exports['destroy']=function(_0xa39c65,_0x1f1916,_0x572ec1){var _0x3f0579;return db[_0xf5f2('0x2e')][_0xf5f2('0x47')]({'where':{'id':_0xa39c65['params']['id']}})[_0xf5f2('0x27')](function(_0xcf7a50){if(_0xcf7a50){return db[_0xf5f2('0x57')][_0xf5f2('0x4a')](function(_0x51fa7e){return _0xcf7a50[_0xf5f2('0x23')]({'transaction':_0x51fa7e,'raw':!![]})['then'](function(_0x2cbe1e){if(_0x2cbe1e[_0xf5f2('0x4c')]){fs[_0xf5f2('0x58')](_0x2cbe1e[_0xf5f2('0x4c')])[_0xf5f2('0x59')](function(_0x5583c2){fs[_0xf5f2('0x5a')](path[_0xf5f2('0x5b')](_0x2cbe1e[_0xf5f2('0x4c')],_0x5583c2));});fs[_0xf5f2('0x5c')](_0x2cbe1e[_0xf5f2('0x4c')]);}return _0x2cbe1e;});})['catch'](function(_0x31e16b){throw new db['Sequelize']['ValidationError'](_0x31e16b[_0xf5f2('0x5d')]);});}})['then'](handleEntityNotFound(_0x1f1916,null))[_0xf5f2('0x27')](removeEntity(_0x1f1916,null))[_0xf5f2('0x49')](handleError(_0x1f1916,null));};exports[_0xf5f2('0x5e')]=function(_0x123b93,_0x5767fc,_0x15d0c2){return db[_0xf5f2('0x57')][_0xf5f2('0x4a')](function(_0x18c41f){var _0x15b680;return db[_0xf5f2('0x2e')][_0xf5f2('0x47')]({'where':{'id':_0x123b93['params']['id']}})[_0xf5f2('0x27')](function(_0x2d171d){if(_0x2d171d){_0x15b680=_0x2d171d;return _0x2d171d[_0xf5f2('0x5e')](_0x123b93[_0xf5f2('0x48')]['id'],{'transaction':_0x18c41f});}})['then'](function(_0x1de396){if(_0x1de396){return db['Sound'][_0xf5f2('0x5f')]({'where':{'id':_0x123b93[_0xf5f2('0x48')]['id']},'attributes':['id','name',_0xf5f2('0x60'),_0xf5f2('0x61'),_0xf5f2('0x62')],'raw':!![]});}})[_0xf5f2('0x27')](function(_0x146462){if(_0x146462){var _0x4bd113=path[_0xf5f2('0x5b')](config[_0xf5f2('0x63')],_0xf5f2('0x64'),util[_0xf5f2('0x65')](_0xf5f2('0x66'),path[_0xf5f2('0x67')](_0x146462['save_name'],path[_0xf5f2('0x68')](_0x146462[_0xf5f2('0x60')])),_0x146462['converted_format']));var _0x3f677e=path[_0xf5f2('0x5b')](config[_0xf5f2('0x63')],'server/files/moh',_0x15b680['name'],util['format'](_0xf5f2('0x66'),_0x146462[_0xf5f2('0x2b')],_0x146462[_0xf5f2('0x61')]));fs[_0xf5f2('0x69')](_0x4bd113,_0x3f677e);return _0x146462;}})[_0xf5f2('0x49')](function(_0x4d878e){throw new db[(_0xf5f2('0x6a'))][(_0xf5f2('0x6b'))](_0x4d878e[_0xf5f2('0x5d')]);});})[_0xf5f2('0x27')](handleEntityNotFound(_0x5767fc,null))[_0xf5f2('0x27')](respondWithResult(_0x5767fc,0xc9))[_0xf5f2('0x49')](handleError(_0x5767fc,null));};exports[_0xf5f2('0x6c')]=function(_0x3cce11,_0x155f45,_0x1f35ef){return db[_0xf5f2('0x57')]['transaction'](function(_0x5e4e07){var _0x5a143f;return db[_0xf5f2('0x2e')][_0xf5f2('0x5f')]({'where':{'id':_0x3cce11[_0xf5f2('0x46')]['id']}})[_0xf5f2('0x27')](handleEntityNotFound(_0x155f45,null))[_0xf5f2('0x27')](function(_0x5c6959){if(_0x5c6959){_0x5a143f=_0x5c6959;return _0x5c6959[_0xf5f2('0x6c')](_0x3cce11[_0xf5f2('0x46')][_0xf5f2('0x6d')]);}})[_0xf5f2('0x27')](function(_0x44d119){if(_0x44d119){return db['Sound'][_0xf5f2('0x5f')]({'where':{'id':_0x3cce11[_0xf5f2('0x46')]['id2']},'attributes':['id',_0xf5f2('0x2b'),_0xf5f2('0x60'),_0xf5f2('0x61'),_0xf5f2('0x62')],'raw':!![]});}})['then'](function(_0x40b36e){if(_0x40b36e){fs[_0xf5f2('0x5a')](path[_0xf5f2('0x5b')](_0x5a143f[_0xf5f2('0x4c')],util[_0xf5f2('0x65')]('%s.%s',_0x40b36e['name'],_0x40b36e[_0xf5f2('0x61')])));return _0x40b36e;}})[_0xf5f2('0x49')](function(_0x17eb69){throw new db[(_0xf5f2('0x6a'))]['ValidationError'](_0x17eb69['message']);});})[_0xf5f2('0x27')](handleEntityNotFound(_0x155f45,null))['then'](respondWithStatusCode(_0x155f45,0xcc))['catch'](handleError(_0x155f45,null));};exports['getSounds']=function(_0x57cb18,_0xad4554,_0x543434){var _0x18eb83={};var _0x168092={};var _0x3de508;var _0x9f941e;return db[_0xf5f2('0x2e')][_0xf5f2('0x5f')]({'where':{'id':_0x57cb18[_0xf5f2('0x46')]['id']}})[_0xf5f2('0x27')](handleEntityNotFound(_0xad4554,null))[_0xf5f2('0x27')](function(_0x2afeac){if(_0x2afeac){_0x3de508=_0x2afeac;_0x168092[_0xf5f2('0x31')]=_[_0xf5f2('0x32')](db[_0xf5f2('0x6e')][_0xf5f2('0x2f')]);_0x168092[_0xf5f2('0x33')]=_[_0xf5f2('0x32')](_0x57cb18['query']);_0x168092[_0xf5f2('0x34')]=_[_0xf5f2('0x35')](_0x168092[_0xf5f2('0x31')],_0x168092[_0xf5f2('0x33')]);_0x18eb83[_0xf5f2('0x36')]=_[_0xf5f2('0x35')](_0x168092[_0xf5f2('0x31')],qs[_0xf5f2('0x37')](_0x57cb18['query'][_0xf5f2('0x37')]));_0x18eb83['attributes']=_0x18eb83['attributes']['length']?_0x18eb83['attributes']:_0x168092['model'];_0x18eb83['order']=qs[_0xf5f2('0x3b')](_0x57cb18[_0xf5f2('0x33')][_0xf5f2('0x3b')]);_0x18eb83[_0xf5f2('0x3c')]=qs[_0xf5f2('0x34')](_[_0xf5f2('0x3d')](_0x57cb18['query'],_0x168092['filters']));if(_0x57cb18[_0xf5f2('0x33')]['filter']){_0x18eb83[_0xf5f2('0x3c')]=_[_0xf5f2('0x3e')](_0x18eb83['where'],{'$or':_['map'](_0x18eb83[_0xf5f2('0x36')],function(_0x274aa3){var _0x5a23c7={};_0x5a23c7[_0x274aa3]={'$like':'%'+_0x57cb18[_0xf5f2('0x33')][_0xf5f2('0x40')]+'%'};return _0x5a23c7;})});}_0x18eb83=_['merge']({},_0x18eb83,_0x57cb18[_0xf5f2('0x41')]);return _0x3de508[_0xf5f2('0x6f')](_0x18eb83);}})[_0xf5f2('0x27')](function(_0x4c1678){if(_0x4c1678){_0x9f941e=_0x4c1678[_0xf5f2('0x38')];if(!_0x57cb18[_0xf5f2('0x33')][_0xf5f2('0x39')](_0xf5f2('0x70'))){_0x18eb83[_0xf5f2('0x1c')]=qs[_0xf5f2('0x1c')](_0x57cb18[_0xf5f2('0x33')][_0xf5f2('0x1c')]);_0x18eb83[_0xf5f2('0x1b')]=qs[_0xf5f2('0x1b')](_0x57cb18[_0xf5f2('0x33')][_0xf5f2('0x1b')]);}return _0x3de508[_0xf5f2('0x6f')](_0x18eb83);}})[_0xf5f2('0x27')](function(_0xe900ea){if(_0xe900ea){return _0xe900ea?{'count':_0x9f941e,'rows':_0xe900ea}:null;}})[_0xf5f2('0x27')](respondWithResult(_0xad4554,null))[_0xf5f2('0x49')](handleError(_0xad4554,null));}; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.model.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.model.js index a6493ff..081e857 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 _0xb62b=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./voiceMusicOnHold.attributes','exports','define','VoiceMusicOnHold','voice_musiconhold'];(function(_0x3d644f,_0x3b10ed){var _0x4d12f8=function(_0x240b30){while(--_0x240b30){_0x3d644f['push'](_0x3d644f['shift']());}};_0x4d12f8(++_0x3b10ed);}(_0xb62b,0x1a4));var _0xbb62=function(_0x1b9715,_0x2a8d66){_0x1b9715=_0x1b9715-0x0;var _0x496716=_0xb62b[_0x1b9715];return _0x496716;};'use strict';var _=require(_0xbb62('0x0'));var util=require(_0xbb62('0x1'));var logger=require(_0xbb62('0x2'))(_0xbb62('0x3'));var moment=require(_0xbb62('0x4'));var BPromise=require(_0xbb62('0x5'));var rp=require(_0xbb62('0x6'));var fs=require('fs');var path=require(_0xbb62('0x7'));var rimraf=require(_0xbb62('0x8'));var config=require('../../config/environment');var attributes=require(_0xbb62('0x9'));module[_0xbb62('0xa')]=function(_0x39c37f,_0x550063){return _0x39c37f[_0xbb62('0xb')](_0xbb62('0xc'),attributes,{'tableName':_0xbb62('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0cc8=['request-promise','rimraf','../../config/environment','./voiceMusicOnHold.attributes','exports','define','voice_musiconhold','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x2a453b,_0x479c50){var _0x132f79=function(_0x5e3d83){while(--_0x5e3d83){_0x2a453b['push'](_0x2a453b['shift']());}};_0x132f79(++_0x479c50);}(_0x0cc8,0xd7));var _0x80cc=function(_0x5d76cc,_0x195736){_0x5d76cc=_0x5d76cc-0x0;var _0x4acce4=_0x0cc8[_0x5d76cc];return _0x4acce4;};'use strict';var _=require(_0x80cc('0x0'));var util=require(_0x80cc('0x1'));var logger=require(_0x80cc('0x2'))(_0x80cc('0x3'));var moment=require(_0x80cc('0x4'));var BPromise=require(_0x80cc('0x5'));var rp=require(_0x80cc('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x80cc('0x7'));var config=require(_0x80cc('0x8'));var attributes=require(_0x80cc('0x9'));module[_0x80cc('0xa')]=function(_0x396eec,_0x30797e){return _0x396eec[_0x80cc('0xb')]('VoiceMusicOnHold',attributes,{'tableName':_0x80cc('0xc'),'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 1884afb..b78d97a 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 _0xe72b=['info','VoiceMusicOnHold,\x20%s,\x20%s','error','message','result','catch','util','bluebird','../../config/logger','../../config/environment','jayson/promise','client','then'];(function(_0x5c7694,_0x2056ca){var _0x128872=function(_0x25a914){while(--_0x25a914){_0x5c7694['push'](_0x5c7694['shift']());}};_0x128872(++_0x2056ca);}(_0xe72b,0x18c));var _0xbe72=function(_0x301dab,_0x38050a){_0x301dab=_0x301dab-0x0;var _0x2500a2=_0xe72b[_0x301dab];return _0x2500a2;};'use strict';var _=require('lodash');var util=require(_0xbe72('0x0'));var moment=require('moment');var BPromise=require(_0xbe72('0x1'));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(_0xbe72('0x2'))('rpc');var config=require(_0xbe72('0x3'));var jayson=require(_0xbe72('0x4'));var client=jayson[_0xbe72('0x5')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4c9b5c,_0x2e6df9,_0x41b2e7){return new BPromise(function(_0x43ced7,_0x42b849){return client['request'](_0x4c9b5c,_0x41b2e7)[_0xbe72('0x6')](function(_0x37ec4f){logger[_0xbe72('0x7')](_0xbe72('0x8'),_0x2e6df9,'request\x20sent');logger['debug']('VoiceMusicOnHold,\x20%s,\x20%s,\x20%s',_0x2e6df9,'request\x20sent',JSON['stringify'](_0x37ec4f));if(_0x37ec4f[_0xbe72('0x9')]){if(_0x37ec4f[_0xbe72('0x9')]['code']===0x1f4){logger[_0xbe72('0x9')](_0xbe72('0x8'),_0x2e6df9,_0x37ec4f[_0xbe72('0x9')][_0xbe72('0xa')]);return _0x42b849(_0x37ec4f[_0xbe72('0x9')][_0xbe72('0xa')]);}logger[_0xbe72('0x9')]('VoiceMusicOnHold,\x20%s,\x20%s',_0x2e6df9,_0x37ec4f[_0xbe72('0x9')]['message']);return _0x43ced7(_0x37ec4f['error'][_0xbe72('0xa')]);}else{logger[_0xbe72('0x7')](_0xbe72('0x8'),_0x2e6df9,'request\x20sent');_0x43ced7(_0x37ec4f[_0xbe72('0xb')][_0xbe72('0xa')]);}})[_0xbe72('0xc')](function(_0x35a31a){logger[_0xbe72('0x9')](_0xbe72('0x8'),_0x2e6df9,_0x35a31a);_0x42b849(_0x35a31a);});});} \ No newline at end of file +var _0x07f6=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','VoiceMusicOnHold,\x20%s,\x20%s','request\x20sent','debug','VoiceMusicOnHold,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','moment'];(function(_0x3fbb93,_0x1f2e7f){var _0x270434=function(_0x20d29b){while(--_0x20d29b){_0x3fbb93['push'](_0x3fbb93['shift']());}};_0x270434(++_0x1f2e7f);}(_0x07f6,0x7b));var _0x607f=function(_0x3b87f4,_0x112243){_0x3b87f4=_0x3b87f4-0x0;var _0x63d16e=_0x07f6[_0x3b87f4];return _0x63d16e;};'use strict';var _=require(_0x607f('0x0'));var util=require('util');var moment=require(_0x607f('0x1'));var BPromise=require('bluebird');var rs=require(_0x607f('0x2'));var fs=require('fs');var Redis=require(_0x607f('0x3'));var db=require(_0x607f('0x4'))['db'];var utils=require(_0x607f('0x5'));var logger=require(_0x607f('0x6'))(_0x607f('0x7'));var config=require(_0x607f('0x8'));var jayson=require(_0x607f('0x9'));var client=jayson[_0x607f('0xa')][_0x607f('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4ace71,_0x3c61ce,_0x21ca04){return new BPromise(function(_0x12fc31,_0x4aaa91){return client[_0x607f('0xc')](_0x4ace71,_0x21ca04)[_0x607f('0xd')](function(_0x15acf6){logger[_0x607f('0xe')](_0x607f('0xf'),_0x3c61ce,_0x607f('0x10'));logger[_0x607f('0x11')](_0x607f('0x12'),_0x3c61ce,'request\x20sent',JSON[_0x607f('0x13')](_0x15acf6));if(_0x15acf6[_0x607f('0x14')]){if(_0x15acf6[_0x607f('0x14')][_0x607f('0x15')]===0x1f4){logger[_0x607f('0x14')]('VoiceMusicOnHold,\x20%s,\x20%s',_0x3c61ce,_0x15acf6[_0x607f('0x14')][_0x607f('0x16')]);return _0x4aaa91(_0x15acf6[_0x607f('0x14')][_0x607f('0x16')]);}logger[_0x607f('0x14')]('VoiceMusicOnHold,\x20%s,\x20%s',_0x3c61ce,_0x15acf6[_0x607f('0x14')][_0x607f('0x16')]);return _0x12fc31(_0x15acf6['error']['message']);}else{logger['info'](_0x607f('0xf'),_0x3c61ce,_0x607f('0x10'));_0x12fc31(_0x15acf6[_0x607f('0x17')][_0x607f('0x16')]);}})[_0x607f('0x18')](function(_0x3ea7cb){logger['error'](_0x607f('0xf'),_0x3c61ce,_0x3ea7cb);_0x4aaa91(_0x3ea7cb);});});} \ No newline at end of file diff --git a/server/api/voicePrefix/index.js b/server/api/voicePrefix/index.js index eedaa2b..7aa1a36 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 _0xfdeb=['multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','./voicePrefix.controller','isAuthenticated','get','describe','/:id','getAgents','post','create','/:id/users','addAgents','put','delete','destroy','exports'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0xfdeb,0x1b9));var _0xbfde=function(_0x4599b6,_0x40c254){_0x4599b6=_0x4599b6-0x0;var _0x2e014c=_0xfdeb[_0x4599b6];return _0x2e014c;};'use strict';var multer=require(_0xbfde('0x0'));var util=require(_0xbfde('0x1'));var path=require(_0xbfde('0x2'));var timeout=require(_0xbfde('0x3'));var express=require(_0xbfde('0x4'));var router=express['Router']();var auth=require(_0xbfde('0x5'));var interaction=require(_0xbfde('0x6'));var config=require('../../config/environment');var controller=require(_0xbfde('0x7'));router['get']('/',auth[_0xbfde('0x8')](),controller['index']);router[_0xbfde('0x9')]('/describe',auth[_0xbfde('0x8')](),controller[_0xbfde('0xa')]);router[_0xbfde('0x9')](_0xbfde('0xb'),auth['isAuthenticated'](),controller['show']);router[_0xbfde('0x9')]('/:id/users',auth[_0xbfde('0x8')](),controller[_0xbfde('0xc')]);router[_0xbfde('0xd')]('/',auth['isAuthenticated'](),controller[_0xbfde('0xe')]);router['post'](_0xbfde('0xf'),auth[_0xbfde('0x8')](),controller[_0xbfde('0x10')]);router[_0xbfde('0x11')](_0xbfde('0xb'),auth[_0xbfde('0x8')](),controller['update']);router[_0xbfde('0x12')](_0xbfde('0xb'),auth[_0xbfde('0x8')](),controller[_0xbfde('0x13')]);router[_0xbfde('0x12')](_0xbfde('0xf'),auth[_0xbfde('0x8')](),controller['removeAgents']);module[_0xbfde('0x14')]=router; \ No newline at end of file +var _0xf96a=['describe','/:id','show','/:id/users','getAgents','post','create','addAgents','put','update','destroy','delete','removeAgents','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./voicePrefix.controller','get','isAuthenticated','/describe'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0xf96a,0x13a));var _0xaf96=function(_0x4cc95a,_0x15c4c7){_0x4cc95a=_0x4cc95a-0x0;var _0x4abee3=_0xf96a[_0x4cc95a];return _0x4abee3;};'use strict';var multer=require(_0xaf96('0x0'));var util=require('util');var path=require(_0xaf96('0x1'));var timeout=require(_0xaf96('0x2'));var express=require(_0xaf96('0x3'));var router=express[_0xaf96('0x4')]();var auth=require(_0xaf96('0x5'));var interaction=require(_0xaf96('0x6'));var config=require('../../config/environment');var controller=require(_0xaf96('0x7'));router[_0xaf96('0x8')]('/',auth[_0xaf96('0x9')](),controller['index']);router[_0xaf96('0x8')](_0xaf96('0xa'),auth[_0xaf96('0x9')](),controller[_0xaf96('0xb')]);router[_0xaf96('0x8')](_0xaf96('0xc'),auth[_0xaf96('0x9')](),controller[_0xaf96('0xd')]);router[_0xaf96('0x8')](_0xaf96('0xe'),auth['isAuthenticated'](),controller[_0xaf96('0xf')]);router[_0xaf96('0x10')]('/',auth[_0xaf96('0x9')](),controller[_0xaf96('0x11')]);router[_0xaf96('0x10')]('/:id/users',auth[_0xaf96('0x9')](),controller[_0xaf96('0x12')]);router[_0xaf96('0x13')](_0xaf96('0xc'),auth['isAuthenticated'](),controller[_0xaf96('0x14')]);router['delete']('/:id',auth[_0xaf96('0x9')](),controller[_0xaf96('0x15')]);router[_0xaf96('0x16')](_0xaf96('0xe'),auth[_0xaf96('0x9')](),controller[_0xaf96('0x17')]);module[_0xaf96('0x18')]=router; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.attributes.js b/server/api/voicePrefix/voicePrefix.attributes.js index 8f39724..8113087 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 _0xcaa4=['INTEGER','sequelize','exports','STRING','name','getDataValue'];(function(_0x176f98,_0x40cea3){var _0x3027b5=function(_0x3ca852){while(--_0x3ca852){_0x176f98['push'](_0x176f98['shift']());}};_0x3027b5(++_0x40cea3);}(_0xcaa4,0x1b7));var _0x4caa=function(_0x2bac1c,_0x4d2517){_0x2bac1c=_0x2bac1c-0x0;var _0x247059=_0xcaa4[_0x2bac1c];return _0x247059;};'use strict';var Sequelize=require(_0x4caa('0x0'));module[_0x4caa('0x1')]={'name':{'type':Sequelize[_0x4caa('0x2')],'allowNull':![],'unique':_0x4caa('0x3')},'prefix':{'type':Sequelize['VIRTUAL'],'get':function(_0xf632bc){return'system-'+this[_0x4caa('0x4')](_0x4caa('0x3'))+'-';}},'description':{'type':Sequelize[_0x4caa('0x2')]},'callerIdAll':{'type':Sequelize[_0x4caa('0x2')]},'VoiceExtensionId':{'type':Sequelize[_0x4caa('0x5')]}}; \ No newline at end of file +var _0xa35d=['VIRTUAL','getDataValue','INTEGER','sequelize','exports','STRING','name'];(function(_0x373bec,_0x4790b5){var _0x33088f=function(_0x1edfe6){while(--_0x1edfe6){_0x373bec['push'](_0x373bec['shift']());}};_0x33088f(++_0x4790b5);}(_0xa35d,0x1d8));var _0xda35=function(_0x2fc3ae,_0x42da14){_0x2fc3ae=_0x2fc3ae-0x0;var _0x26175b=_0xa35d[_0x2fc3ae];return _0x26175b;};'use strict';var Sequelize=require(_0xda35('0x0'));module[_0xda35('0x1')]={'name':{'type':Sequelize[_0xda35('0x2')],'allowNull':![],'unique':_0xda35('0x3')},'prefix':{'type':Sequelize[_0xda35('0x4')],'get':function(_0xba556b){return'system-'+this[_0xda35('0x5')](_0xda35('0x3'))+'-';}},'description':{'type':Sequelize[_0xda35('0x2')]},'callerIdAll':{'type':Sequelize[_0xda35('0x2')]},'VoiceExtensionId':{'type':Sequelize[_0xda35('0x6')]}}; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.controller.js b/server/api/voicePrefix/voicePrefix.controller.js index 9ae931f..5dffa5c 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 _0xf189=['key','model','query','keys','intersection','attributes','fields','nolimit','order','sort','where','filters','filter','map','VIRTUAL','options','VoicePrefix','count','include','findAll','catch','show','params','rawAttributes','length','merge','find','describe','create','sequelize','transaction','body','get','VoiceExtensionId','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','context','system','description','Voice\x20Prefix\x20Extension','priority','appdata','prefix','NoOp','VoicePrefixId','VoiceExtension','bulkCreate','Extensions\x20creation\x20failed','push','Set','CDR(prefix)=','callerIdAll','No\x20callerid\x20available','goto','charAt','system-','findById','addAgents','omit','ids','emit','userVoicePrefix:save','removeAgents','isArray','userVoicePrefix:remove','getAgents','User','pick','html-pdf','eml-format','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','redis','localhost','./voicePrefix.socket','register','sendStatus','end','json','offset','limit','status','set','Content-Range','apply','reject','save','update','then','destroy','VoicePrefixes','error','name','send','index','type'];(function(_0x8b826b,_0x4401d3){var _0x30505d=function(_0x25ca93){while(--_0x25ca93){_0x8b826b['push'](_0x8b826b['shift']());}};_0x30505d(++_0x4401d3);}(_0xf189,0xc0));var _0x9f18=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0xf189[_0x19e35c];return _0x3e1fe8;};'use strict';var pdf=require(_0x9f18('0x0'));var emlformat=require(_0x9f18('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x9f18('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x9f18('0x3'));var moment=require(_0x9f18('0x4'));var BPromise=require(_0x9f18('0x5'));var Mustache=require(_0x9f18('0x6'));var util=require(_0x9f18('0x7'));var path=require(_0x9f18('0x8'));var sox=require(_0x9f18('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0x9f18('0xa'));var squel=require(_0x9f18('0xb'));var crypto=require(_0x9f18('0xc'));var jsforce=require(_0x9f18('0xd'));var deskjs=require(_0x9f18('0xe'));var toCsv=require('to-csv');var querystring=require(_0x9f18('0xf'));var Papa=require(_0x9f18('0x10'));var Redis=require(_0x9f18('0x11'));var authService=require(_0x9f18('0x12'));var qs=require(_0x9f18('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x9f18('0x14'))(_0x9f18('0x15'));var utils=require(_0x9f18('0x16'));var config=require(_0x9f18('0x17'));var db=require('../../mysqldb')['db'];config[_0x9f18('0x18')]=_['defaults'](config['redis'],{'host':_0x9f18('0x19'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x9f18('0x1a'))[_0x9f18('0x1b')](socket);function respondWithStatusCode(_0x1230c6,_0x51069d){_0x51069d=_0x51069d||0xcc;return function(_0x198e3a){if(_0x198e3a){return _0x1230c6[_0x9f18('0x1c')](_0x51069d);}return _0x1230c6['status'](_0x51069d)[_0x9f18('0x1d')]();};}function respondWithResult(_0x22febf,_0x48dbcf){_0x48dbcf=_0x48dbcf||0xc8;return function(_0x6b1a98){if(_0x6b1a98){return _0x22febf['status'](_0x48dbcf)[_0x9f18('0x1e')](_0x6b1a98);}};}function respondWithFilteredResult(_0x4d6ee0,_0x46aade){return function(_0x5ca202){if(_0x5ca202){var _0x30aebf=_0x5ca202['count'],_0x4ab7d7=_0x46aade[_0x9f18('0x1f')],_0x597b3e=_0x46aade[_0x9f18('0x1f')]+_0x46aade[_0x9f18('0x20')],_0x2d4bbf;if(_0x597b3e>=_0x30aebf){_0x597b3e=_0x30aebf;_0x2d4bbf=0xc8;}else{_0x2d4bbf=0xce;}_0x4d6ee0[_0x9f18('0x21')](_0x2d4bbf);return _0x4d6ee0[_0x9f18('0x22')](_0x9f18('0x23'),_0x4ab7d7+'-'+_0x597b3e+'/'+_0x30aebf)[_0x9f18('0x1e')](_0x5ca202);}return null;};}function patchUpdates(_0x5088f7){return function(_0x5e737a){try{jsonpatch[_0x9f18('0x24')](_0x5e737a,_0x5088f7,!![]);}catch(_0x2acfbf){return BPromise[_0x9f18('0x25')](_0x2acfbf);}return _0x5e737a[_0x9f18('0x26')]();};}function saveUpdates(_0x4b4723,_0x2ce7bb){return function(_0x42310b){if(_0x42310b){return _0x42310b[_0x9f18('0x27')](_0x4b4723)[_0x9f18('0x28')](function(_0x9c2d5a){return _0x9c2d5a;});}return null;};}function removeEntity(_0x3f94d4,_0x52774b){return function(_0x5c15ae){if(_0x5c15ae){return _0x5c15ae[_0x9f18('0x29')]()[_0x9f18('0x28')](function(){var _0x2668a3=_0x5c15ae['get']({'plain':!![]});var _0x422142=_0x9f18('0x2a');return db['UserProfileResource'][_0x9f18('0x29')]({'where':{'type':_0x422142,'resourceId':_0x2668a3['id']}})['then'](function(){return _0x5c15ae;});})['then'](function(){_0x3f94d4[_0x9f18('0x21')](0xcc)['end']();});}};}function handleEntityNotFound(_0x114bed,_0x44ce2d){return function(_0x11cec5){if(!_0x11cec5){_0x114bed[_0x9f18('0x1c')](0x194);}return _0x11cec5;};}function handleError(_0x8fa86d,_0x5ca0bd){_0x5ca0bd=_0x5ca0bd||0x1f4;return function(_0x257828){logger[_0x9f18('0x2b')](_0x257828['stack']);if(_0x257828[_0x9f18('0x2c')]){delete _0x257828['name'];}_0x8fa86d[_0x9f18('0x21')](_0x5ca0bd)[_0x9f18('0x2d')](_0x257828);};}exports[_0x9f18('0x2e')]=function(_0x1361b4,_0x2d57cc){var _0x4318ca={},_0x32bf2f={},_0x32e6cc={'count':0x0,'rows':[]};var _0x121c8d=_['map'](db['VoicePrefix']['rawAttributes'],function(_0x589a13){return{'name':_0x589a13['fieldName'],'type':_0x589a13[_0x9f18('0x2f')][_0x9f18('0x30')]};});_0x32bf2f[_0x9f18('0x31')]=_['map'](_0x121c8d,_0x9f18('0x2c'));_0x32bf2f[_0x9f18('0x32')]=_[_0x9f18('0x33')](_0x1361b4['query']);_0x32bf2f['filters']=_[_0x9f18('0x34')](_0x32bf2f['model'],_0x32bf2f[_0x9f18('0x32')]);_0x4318ca[_0x9f18('0x35')]=_[_0x9f18('0x34')](_0x32bf2f[_0x9f18('0x31')],qs[_0x9f18('0x36')](_0x1361b4[_0x9f18('0x32')][_0x9f18('0x36')]));_0x4318ca[_0x9f18('0x35')]=_0x4318ca['attributes']['length']?_0x4318ca['attributes']:_0x32bf2f['model'];if(!_0x1361b4[_0x9f18('0x32')]['hasOwnProperty'](_0x9f18('0x37'))){_0x4318ca[_0x9f18('0x20')]=qs[_0x9f18('0x20')](_0x1361b4[_0x9f18('0x32')][_0x9f18('0x20')]);_0x4318ca[_0x9f18('0x1f')]=qs[_0x9f18('0x1f')](_0x1361b4[_0x9f18('0x32')][_0x9f18('0x1f')]);}_0x4318ca[_0x9f18('0x38')]=qs[_0x9f18('0x39')](_0x1361b4[_0x9f18('0x32')][_0x9f18('0x39')]);_0x4318ca[_0x9f18('0x3a')]=qs[_0x9f18('0x3b')](_['pick'](_0x1361b4[_0x9f18('0x32')],_0x32bf2f[_0x9f18('0x3b')]),_0x121c8d);if(_0x1361b4['query'][_0x9f18('0x3c')]){_0x4318ca[_0x9f18('0x3a')]=_['merge'](_0x4318ca[_0x9f18('0x3a')],{'$or':_[_0x9f18('0x3d')](_0x121c8d,function(_0x5eee42){if(_0x5eee42[_0x9f18('0x2f')]!==_0x9f18('0x3e')){var _0x44f105={};_0x44f105[_0x5eee42[_0x9f18('0x2c')]]={'$like':'%'+_0x1361b4[_0x9f18('0x32')][_0x9f18('0x3c')]+'%'};return _0x44f105;}})});}_0x4318ca=_['merge']({},_0x4318ca,_0x1361b4[_0x9f18('0x3f')]);var _0x31c719={'where':_0x4318ca[_0x9f18('0x3a')]};return db[_0x9f18('0x40')]['count'](_0x31c719)[_0x9f18('0x28')](function(_0x43803d){_0x32e6cc[_0x9f18('0x41')]=_0x43803d;if(_0x1361b4[_0x9f18('0x32')]['includeAll']){_0x4318ca[_0x9f18('0x42')]=[{'all':!![]}];}return db[_0x9f18('0x40')][_0x9f18('0x43')](_0x4318ca);})['then'](function(_0x3457c1){_0x32e6cc['rows']=_0x3457c1;return _0x32e6cc;})[_0x9f18('0x28')](respondWithFilteredResult(_0x2d57cc,_0x4318ca))[_0x9f18('0x44')](handleError(_0x2d57cc,null));};exports[_0x9f18('0x45')]=function(_0x597cfe,_0xc9b528){var _0x5e8714={'raw':![],'where':{'id':_0x597cfe[_0x9f18('0x46')]['id']}},_0x2c2914={};_0x2c2914['model']=_[_0x9f18('0x33')](db['VoicePrefix'][_0x9f18('0x47')]);_0x2c2914[_0x9f18('0x32')]=_[_0x9f18('0x33')](_0x597cfe[_0x9f18('0x32')]);_0x2c2914['filters']=_[_0x9f18('0x34')](_0x2c2914[_0x9f18('0x31')],_0x2c2914[_0x9f18('0x32')]);_0x5e8714['attributes']=_[_0x9f18('0x34')](_0x2c2914[_0x9f18('0x31')],qs[_0x9f18('0x36')](_0x597cfe[_0x9f18('0x32')][_0x9f18('0x36')]));_0x5e8714[_0x9f18('0x35')]=_0x5e8714[_0x9f18('0x35')][_0x9f18('0x48')]?_0x5e8714[_0x9f18('0x35')]:_0x2c2914['model'];if(_0x597cfe[_0x9f18('0x32')]['includeAll']){_0x5e8714[_0x9f18('0x42')]=[{'all':!![]}];}_0x5e8714=_[_0x9f18('0x49')]({},_0x5e8714,_0x597cfe['options']);return db['VoicePrefix']['find'](_0x5e8714)[_0x9f18('0x28')](handleEntityNotFound(_0xc9b528,null))[_0x9f18('0x28')](respondWithResult(_0xc9b528,null))[_0x9f18('0x44')](handleError(_0xc9b528,null));};exports[_0x9f18('0x29')]=function(_0x494406,_0x3534d0){return db[_0x9f18('0x40')][_0x9f18('0x4a')]({'where':{'id':_0x494406[_0x9f18('0x46')]['id']}})[_0x9f18('0x28')](handleEntityNotFound(_0x3534d0,null))['then'](removeEntity(_0x3534d0,null))[_0x9f18('0x44')](handleError(_0x3534d0,null));};exports['describe']=function(_0x11658d,_0xa75f6){return db[_0x9f18('0x40')][_0x9f18('0x4b')]()[_0x9f18('0x28')](respondWithResult(_0xa75f6,null))[_0x9f18('0x44')](handleError(_0xa75f6,null));};exports[_0x9f18('0x4c')]=function(_0x30eec2,_0x5e6d87){var _0x2fc318;return db[_0x9f18('0x4d')][_0x9f18('0x4e')](function(_0x3c3646){return db['VoicePrefix'][_0x9f18('0x4c')](_0x30eec2[_0x9f18('0x4f')],{'transaction':_0x3c3646})[_0x9f18('0x28')](function(_0x5a9732){_0x2fc318=_0x5a9732[_0x9f18('0x50')]({'plain':!![]});return db['VoiceExtension'][_0x9f18('0x4a')]({'where':{'id':_0x2fc318[_0x9f18('0x51')]},'raw':!![]})[_0x9f18('0x28')](function(_0x16616b){return createVoicePrefixExtensions(_0x2fc318,_0x16616b,_0x3c3646);});});})['then'](function(){var _0x417a4b=_0x30eec2['user']['get']({'plain':!![]});if(!_0x417a4b)throw new Error(_0x9f18('0x52'));if(_0x417a4b[_0x9f18('0x53')]==='user'){var _0x54ba81=_0x2fc318;return db[_0x9f18('0x54')]['find']({'where':{'name':_0x9f18('0x2a'),'userProfileId':_0x417a4b[_0x9f18('0x55')]},'raw':!![]})['then'](function(_0x21fd96){if(_0x21fd96&&_0x21fd96[_0x9f18('0x56')]===0x0){return db['UserProfileResource'][_0x9f18('0x4c')]({'name':_0x54ba81[_0x9f18('0x2c')],'resourceId':_0x54ba81['id'],'type':_0x21fd96[_0x9f18('0x2c')],'sectionId':_0x21fd96['id']},{})[_0x9f18('0x28')](function(){return _0x2fc318;});}else{return _0x2fc318;}})[_0x9f18('0x44')](function(_0x23c463){logger[_0x9f18('0x2b')](_0x9f18('0x57'),_0x23c463);throw _0x23c463;});}return _0x2fc318;})[_0x9f18('0x28')](respondWithResult(_0x5e6d87,null))[_0x9f18('0x44')](handleError(_0x5e6d87,null));};function Extension(_0x276d69,_0x11de02,_0x2a519b,_0x138437){this[_0x9f18('0x58')]='from-sip';this['exten']=_0x276d69;this['app']=_0x2a519b;this[_0x9f18('0x2f')]=_0x9f18('0x59');this[_0x9f18('0x5a')]=_0x9f18('0x5b');this[_0x9f18('0x5c')]=_0x11de02;this[_0x9f18('0x5d')]=_0x138437;}function createVoicePrefixExtensions(_0x1924b0,_0x3db7b1,_0x3f8891){return new BPromise(function(_0x1816ad,_0x2d1fee){var _0x37d0d0=new Extension(formatPrefixName(_0x1924b0[_0x9f18('0x5e')]),0x1,_0x9f18('0x5f'),'Voice\x20Prefix');_0x37d0d0[_0x9f18('0x60')]=_0x1924b0['id'];return db[_0x9f18('0x61')][_0x9f18('0x4c')](_0x37d0d0,{'transaction':_0x3f8891})[_0x9f18('0x28')](function(_0x3e66a7){var _0xce729f=_0x3e66a7[_0x9f18('0x50')]({'plain':!![]});var _0xf7b4c6=_['map'](addVoicePrefixExtensions(_0x1924b0,_0x3db7b1),function(_0x5d623a){_0x5d623a[_0x9f18('0x51')]=_0xce729f['id'];_0x5d623a[_0x9f18('0x60')]=_0x1924b0['id'];return _0x5d623a;});return db['VoiceExtension'][_0x9f18('0x62')](_0xf7b4c6,{'transaction':_0x3f8891})[_0x9f18('0x28')](function(_0x17a4ca){if(!_0x17a4ca){return _0x2d1fee(_0x9f18('0x63'));}else{return _0x1816ad(_0x17a4ca);}})[_0x9f18('0x44')](function(_0x5e0b32){return _0x2d1fee(_0x5e0b32);});});;});};function addVoicePrefixExtensions(_0x41059a,_0x5cee5b){var _0x2e17fd=[];var _0x278f07=formatPrefixName(_0x41059a[_0x9f18('0x5e')]);_0x2e17fd[_0x9f18('0x64')](new Extension(_0x278f07,0x2,_0x9f18('0x65'),_0x9f18('0x66')+_0x41059a[_0x9f18('0x2c')]));if(_0x41059a[_0x9f18('0x67')]){_0x2e17fd[_0x9f18('0x64')](new Extension(_0x278f07,0x3,_0x9f18('0x65'),'PREFIX-CALLERIDALL='+_0x41059a['callerIdAll']));}else{_0x2e17fd[_0x9f18('0x64')](new Extension(_0x278f07,0x3,_0x9f18('0x5f'),_0x9f18('0x68')));}_0x2e17fd['push'](new Extension(_0x278f07,0x4,_0x9f18('0x69'),_0x5cee5b['context']+','+'${EXTEN:'+(0x8+_0x41059a['name'][_0x9f18('0x48')])+'}'+','+0x1));return _0x2e17fd;}function formatPrefixName(_0x2710e4){var _0x28cb69='_';for(var _0xb8240f=0x0;_0xb8240f<_0x2710e4[_0x9f18('0x48')];_0xb8240f++){if(_0x2710e4[_0x9f18('0x6a')](_0xb8240f)=='-'){_0x28cb69+=_0x2710e4[_0x9f18('0x6a')](_0xb8240f);}else{_0x28cb69+='['+_0x2710e4[_0x9f18('0x6a')](_0xb8240f)+']';}}_0x28cb69+='.';return _0x28cb69;}exports[_0x9f18('0x27')]=function(_0x3adc18,_0x422f8c,_0x51f445){var _0x1d0f6f=_0x3adc18[_0x9f18('0x4f')];_0x1d0f6f[_0x9f18('0x5e')]=_0x9f18('0x6b')+_0x1d0f6f['name']+'-';return db[_0x9f18('0x4d')][_0x9f18('0x4e')](function(_0x5cbaf1){return db[_0x9f18('0x40')][_0x9f18('0x27')](_0x1d0f6f,{'where':{'id':_0x1d0f6f['id']},'transaction':_0x5cbaf1})[_0x9f18('0x28')](function(){return db['VoiceExtension'][_0x9f18('0x29')]({'where':{'VoicePrefixId':_0x1d0f6f['id']},'transaction':_0x5cbaf1})[_0x9f18('0x28')](function(){return db[_0x9f18('0x61')]['find']({'where':{'id':_0x1d0f6f[_0x9f18('0x51')]},'raw':!![]})[_0x9f18('0x28')](function(_0x3fda69){return createVoicePrefixExtensions(_0x1d0f6f,_0x3fda69,_0x5cbaf1);});});});})[_0x9f18('0x28')](function(){return db[_0x9f18('0x40')][_0x9f18('0x6c')](_0x1d0f6f['id']);})[_0x9f18('0x28')](respondWithResult(_0x422f8c,null))[_0x9f18('0x44')](handleError(_0x422f8c,null));};exports['addAgents']=function(_0x38db22,_0x1f1c8c,_0x10c279){return db[_0x9f18('0x40')]['find']({'where':{'id':_0x38db22[_0x9f18('0x46')]['id']}})[_0x9f18('0x28')](handleEntityNotFound(_0x1f1c8c,null))[_0x9f18('0x28')](function(_0x523b3c){if(_0x523b3c){return _0x523b3c[_0x9f18('0x6d')](_0x38db22[_0x9f18('0x4f')]['ids'],_[_0x9f18('0x6e')](_0x38db22[_0x9f18('0x4f')],[_0x9f18('0x6f'),'id'])||{})['spread'](function(_0x53f867){for(var _0x34d3d6=0x0;_0x34d3d6<_0x38db22['body']['ids'][_0x9f18('0x48')];_0x34d3d6+=0x1){socket[_0x9f18('0x70')](_0x9f18('0x71'),{'UserId':_0x38db22[_0x9f18('0x4f')]['ids'][_0x34d3d6],'VoicePrefixId':_0x38db22['params']['id']});}return _0x53f867;});}})['then'](respondWithResult(_0x1f1c8c,null))['catch'](handleError(_0x1f1c8c,null));};exports[_0x9f18('0x72')]=function(_0x2ed137,_0xe999f1,_0x22212c){return db[_0x9f18('0x40')]['find']({'where':{'id':_0x2ed137[_0x9f18('0x46')]['id']}})[_0x9f18('0x28')](handleEntityNotFound(_0xe999f1,null))[_0x9f18('0x28')](function(_0x30581c){if(_0x30581c){return _0x30581c[_0x9f18('0x72')](_0x2ed137[_0x9f18('0x32')][_0x9f18('0x6f')])[_0x9f18('0x28')](function(){if(_[_0x9f18('0x73')](_0x2ed137[_0x9f18('0x32')][_0x9f18('0x6f')])){for(var _0x188ae3=0x0;_0x188ae3<_0x2ed137[_0x9f18('0x32')][_0x9f18('0x6f')][_0x9f18('0x48')];_0x188ae3+=0x1){socket[_0x9f18('0x70')](_0x9f18('0x74'),{'UserId':Number(_0x2ed137[_0x9f18('0x32')]['ids'][_0x188ae3]),'VoicePrefixId':Number(_0x2ed137['params']['id'])});}}else{socket[_0x9f18('0x70')](_0x9f18('0x74'),{'UserId':Number(_0x2ed137['query'][_0x9f18('0x6f')]),'VoicePrefixId':Number(_0x2ed137['params']['id'])});}});}})[_0x9f18('0x28')](respondWithStatusCode(_0xe999f1,null))[_0x9f18('0x44')](handleError(_0xe999f1,null));};exports[_0x9f18('0x75')]=function(_0x8711e6,_0x21b38c,_0x54d6bc){var _0x950439={};var _0x1c218d={};var _0x306e2e;var _0x16f579;return db[_0x9f18('0x40')]['findOne']({'where':{'id':_0x8711e6['params']['id']}})[_0x9f18('0x28')](handleEntityNotFound(_0x21b38c,null))[_0x9f18('0x28')](function(_0x5395ab){if(_0x5395ab){_0x306e2e=_0x5395ab;_0x1c218d[_0x9f18('0x31')]=_[_0x9f18('0x33')](db[_0x9f18('0x76')][_0x9f18('0x47')]);_0x1c218d[_0x9f18('0x32')]=_[_0x9f18('0x33')](_0x8711e6[_0x9f18('0x32')]);_0x1c218d[_0x9f18('0x3b')]=_[_0x9f18('0x34')](_0x1c218d[_0x9f18('0x31')],_0x1c218d[_0x9f18('0x32')]);_0x950439[_0x9f18('0x35')]=_['intersection'](_0x1c218d['model'],qs[_0x9f18('0x36')](_0x8711e6[_0x9f18('0x32')]['fields']));_0x950439['attributes']=_0x950439[_0x9f18('0x35')]['length']?_0x950439[_0x9f18('0x35')]:_0x1c218d[_0x9f18('0x31')];_0x950439['order']=qs[_0x9f18('0x39')](_0x8711e6[_0x9f18('0x32')][_0x9f18('0x39')]);_0x950439[_0x9f18('0x3a')]=qs[_0x9f18('0x3b')](_[_0x9f18('0x77')](_0x8711e6['query'],_0x1c218d[_0x9f18('0x3b')]));if(_0x8711e6[_0x9f18('0x32')][_0x9f18('0x3c')]){_0x950439[_0x9f18('0x3a')]=_[_0x9f18('0x49')](_0x950439[_0x9f18('0x3a')],{'$or':_[_0x9f18('0x3d')](_0x950439[_0x9f18('0x35')],function(_0x3fdbb4){var _0x278ea0={};_0x278ea0[_0x3fdbb4]={'$like':'%'+_0x8711e6[_0x9f18('0x32')][_0x9f18('0x3c')]+'%'};return _0x278ea0;})});}_0x950439=_[_0x9f18('0x49')]({},_0x950439,_0x8711e6[_0x9f18('0x3f')]);return _0x306e2e[_0x9f18('0x75')](_0x950439);}})['then'](function(_0x4f1e00){if(_0x4f1e00){_0x16f579=_0x4f1e00['length'];if(!_0x8711e6[_0x9f18('0x32')]['hasOwnProperty'](_0x9f18('0x37'))){_0x950439[_0x9f18('0x20')]=qs[_0x9f18('0x20')](_0x8711e6[_0x9f18('0x32')][_0x9f18('0x20')]);_0x950439['offset']=qs['offset'](_0x8711e6[_0x9f18('0x32')][_0x9f18('0x1f')]);}return _0x306e2e['getAgents'](_0x950439);}})[_0x9f18('0x28')](function(_0x278837){if(_0x278837){return _0x278837?{'count':_0x16f579,'rows':_0x278837}:null;}})['then'](respondWithResult(_0x21b38c,null))[_0x9f18('0x44')](handleError(_0x21b38c,null));}; \ No newline at end of file +var _0x8513=['fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','merge','filter','includeAll','include','findAll','rows','catch','options','create','sequelize','body','VoiceExtension','find','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','exten','app','system','description','priority','appdata','prefix','NoOp','Voice\x20Prefix','VoicePrefixId','VoiceExtensionId','bulkCreate','Extensions\x20creation\x20failed','CDR(prefix)=','callerIdAll','push','Set','PREFIX-CALLERIDALL=','No\x20callerid\x20available','${EXTEN:','charAt','system-','transaction','findById','addAgents','params','omit','ids','spread','emit','userVoicePrefix:save','removeAgents','isArray','userVoicePrefix:remove','getAgents','findOne','User','pick','html-pdf','eml-format','zip-dir','request-promise','moment','mustache','util','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','redis','defaults','localhost','socket.io-emitter','./voicePrefix.socket','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','update','then','destroy','get','VoicePrefixes','error','stack','name','send','map','VoicePrefix','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection'];(function(_0x46698a,_0x8de1e4){var _0x356db0=function(_0x19e83c){while(--_0x19e83c){_0x46698a['push'](_0x46698a['shift']());}};_0x356db0(++_0x8de1e4);}(_0x8513,0x1b2));var _0x3851=function(_0x56d10b,_0x5e511b){_0x56d10b=_0x56d10b-0x0;var _0x5a9969=_0x8513[_0x56d10b];return _0x5a9969;};'use strict';var pdf=require(_0x3851('0x0'));var emlformat=require(_0x3851('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x3851('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x3851('0x3'));var moment=require(_0x3851('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x3851('0x5'));var util=require(_0x3851('0x6'));var path=require('path');var sox=require(_0x3851('0x7'));var csv=require(_0x3851('0x8'));var ejs=require(_0x3851('0x9'));var fs=require('fs');var _=require('lodash');var squel=require(_0x3851('0xa'));var crypto=require(_0x3851('0xb'));var jsforce=require(_0x3851('0xc'));var deskjs=require(_0x3851('0xd'));var toCsv=require(_0x3851('0x8'));var querystring=require('querystring');var Papa=require(_0x3851('0xe'));var Redis=require('ioredis');var authService=require(_0x3851('0xf'));var qs=require(_0x3851('0x10'));var as=require(_0x3851('0x11'));var hardwareService=require(_0x3851('0x12'));var logger=require('../../config/logger')(_0x3851('0x13'));var utils=require(_0x3851('0x14'));var config=require(_0x3851('0x15'));var db=require('../../mysqldb')['db'];config[_0x3851('0x16')]=_[_0x3851('0x17')](config[_0x3851('0x16')],{'host':_0x3851('0x18'),'port':0x18eb});var socket=require(_0x3851('0x19'))(new Redis(config[_0x3851('0x16')]));require(_0x3851('0x1a'))['register'](socket);function respondWithStatusCode(_0x3f33da,_0x5ec4cf){_0x5ec4cf=_0x5ec4cf||0xcc;return function(_0x4f7d7c){if(_0x4f7d7c){return _0x3f33da[_0x3851('0x1b')](_0x5ec4cf);}return _0x3f33da[_0x3851('0x1c')](_0x5ec4cf)[_0x3851('0x1d')]();};}function respondWithResult(_0x5250f2,_0x6d55bb){_0x6d55bb=_0x6d55bb||0xc8;return function(_0x573596){if(_0x573596){return _0x5250f2[_0x3851('0x1c')](_0x6d55bb)[_0x3851('0x1e')](_0x573596);}};}function respondWithFilteredResult(_0x20c8df,_0x5142d8){return function(_0x3c19dd){if(_0x3c19dd){var _0x4743ba=_0x3c19dd[_0x3851('0x1f')],_0x4f3e5d=_0x5142d8[_0x3851('0x20')],_0x5566cb=_0x5142d8[_0x3851('0x20')]+_0x5142d8[_0x3851('0x21')],_0xbc7696;if(_0x5566cb>=_0x4743ba){_0x5566cb=_0x4743ba;_0xbc7696=0xc8;}else{_0xbc7696=0xce;}_0x20c8df['status'](_0xbc7696);return _0x20c8df[_0x3851('0x22')](_0x3851('0x23'),_0x4f3e5d+'-'+_0x5566cb+'/'+_0x4743ba)[_0x3851('0x1e')](_0x3c19dd);}return null;};}function patchUpdates(_0x1916cc){return function(_0xbb19ef){try{jsonpatch[_0x3851('0x24')](_0xbb19ef,_0x1916cc,!![]);}catch(_0x1bbd57){return BPromise[_0x3851('0x25')](_0x1bbd57);}return _0xbb19ef['save']();};}function saveUpdates(_0x2113b4,_0x8ffb84){return function(_0x49b8fb){if(_0x49b8fb){return _0x49b8fb[_0x3851('0x26')](_0x2113b4)[_0x3851('0x27')](function(_0x373733){return _0x373733;});}return null;};}function removeEntity(_0x52462a,_0x49ed4f){return function(_0x55a67f){if(_0x55a67f){return _0x55a67f[_0x3851('0x28')]()[_0x3851('0x27')](function(){var _0xd05492=_0x55a67f[_0x3851('0x29')]({'plain':!![]});var _0x2e6125=_0x3851('0x2a');return db['UserProfileResource'][_0x3851('0x28')]({'where':{'type':_0x2e6125,'resourceId':_0xd05492['id']}})[_0x3851('0x27')](function(){return _0x55a67f;});})[_0x3851('0x27')](function(){_0x52462a[_0x3851('0x1c')](0xcc)[_0x3851('0x1d')]();});}};}function handleEntityNotFound(_0x58f0cc,_0x20fd39){return function(_0x4bbddd){if(!_0x4bbddd){_0x58f0cc[_0x3851('0x1b')](0x194);}return _0x4bbddd;};}function handleError(_0x461d5e,_0x39f2d0){_0x39f2d0=_0x39f2d0||0x1f4;return function(_0x29e387){logger[_0x3851('0x2b')](_0x29e387[_0x3851('0x2c')]);if(_0x29e387['name']){delete _0x29e387[_0x3851('0x2d')];}_0x461d5e[_0x3851('0x1c')](_0x39f2d0)[_0x3851('0x2e')](_0x29e387);};}exports['index']=function(_0x3a1b98,_0x30dc13){var _0x1ffbe1={},_0x355f82={},_0x1d6fc1={'count':0x0,'rows':[]};var _0x1eb9e9=_[_0x3851('0x2f')](db[_0x3851('0x30')][_0x3851('0x31')],function(_0x2434d3){return{'name':_0x2434d3[_0x3851('0x32')],'type':_0x2434d3[_0x3851('0x33')][_0x3851('0x34')]};});_0x355f82[_0x3851('0x35')]=_['map'](_0x1eb9e9,_0x3851('0x2d'));_0x355f82[_0x3851('0x36')]=_[_0x3851('0x37')](_0x3a1b98[_0x3851('0x36')]);_0x355f82[_0x3851('0x38')]=_[_0x3851('0x39')](_0x355f82[_0x3851('0x35')],_0x355f82['query']);_0x1ffbe1['attributes']=_['intersection'](_0x355f82[_0x3851('0x35')],qs[_0x3851('0x3a')](_0x3a1b98[_0x3851('0x36')]['fields']));_0x1ffbe1[_0x3851('0x3b')]=_0x1ffbe1[_0x3851('0x3b')][_0x3851('0x3c')]?_0x1ffbe1['attributes']:_0x355f82[_0x3851('0x35')];if(!_0x3a1b98[_0x3851('0x36')][_0x3851('0x3d')](_0x3851('0x3e'))){_0x1ffbe1[_0x3851('0x21')]=qs[_0x3851('0x21')](_0x3a1b98['query'][_0x3851('0x21')]);_0x1ffbe1[_0x3851('0x20')]=qs['offset'](_0x3a1b98[_0x3851('0x36')]['offset']);}_0x1ffbe1[_0x3851('0x3f')]=qs[_0x3851('0x40')](_0x3a1b98[_0x3851('0x36')][_0x3851('0x40')]);_0x1ffbe1[_0x3851('0x41')]=qs[_0x3851('0x38')](_['pick'](_0x3a1b98['query'],_0x355f82[_0x3851('0x38')]),_0x1eb9e9);if(_0x3a1b98['query']['filter']){_0x1ffbe1['where']=_[_0x3851('0x42')](_0x1ffbe1[_0x3851('0x41')],{'$or':_[_0x3851('0x2f')](_0x1eb9e9,function(_0x223ee0){if(_0x223ee0[_0x3851('0x33')]!=='VIRTUAL'){var _0x553ebd={};_0x553ebd[_0x223ee0[_0x3851('0x2d')]]={'$like':'%'+_0x3a1b98[_0x3851('0x36')][_0x3851('0x43')]+'%'};return _0x553ebd;}})});}_0x1ffbe1=_[_0x3851('0x42')]({},_0x1ffbe1,_0x3a1b98['options']);var _0x1bc245={'where':_0x1ffbe1[_0x3851('0x41')]};return db['VoicePrefix'][_0x3851('0x1f')](_0x1bc245)[_0x3851('0x27')](function(_0x1634fb){_0x1d6fc1[_0x3851('0x1f')]=_0x1634fb;if(_0x3a1b98['query'][_0x3851('0x44')]){_0x1ffbe1[_0x3851('0x45')]=[{'all':!![]}];}return db[_0x3851('0x30')][_0x3851('0x46')](_0x1ffbe1);})[_0x3851('0x27')](function(_0x224ed0){_0x1d6fc1[_0x3851('0x47')]=_0x224ed0;return _0x1d6fc1;})[_0x3851('0x27')](respondWithFilteredResult(_0x30dc13,_0x1ffbe1))[_0x3851('0x48')](handleError(_0x30dc13,null));};exports['show']=function(_0x4f2403,_0x3508ab){var _0x3baba1={'raw':![],'where':{'id':_0x4f2403['params']['id']}},_0x3ef700={};_0x3ef700[_0x3851('0x35')]=_[_0x3851('0x37')](db[_0x3851('0x30')]['rawAttributes']);_0x3ef700[_0x3851('0x36')]=_[_0x3851('0x37')](_0x4f2403[_0x3851('0x36')]);_0x3ef700[_0x3851('0x38')]=_['intersection'](_0x3ef700[_0x3851('0x35')],_0x3ef700['query']);_0x3baba1['attributes']=_['intersection'](_0x3ef700[_0x3851('0x35')],qs[_0x3851('0x3a')](_0x4f2403['query'][_0x3851('0x3a')]));_0x3baba1[_0x3851('0x3b')]=_0x3baba1[_0x3851('0x3b')][_0x3851('0x3c')]?_0x3baba1[_0x3851('0x3b')]:_0x3ef700[_0x3851('0x35')];if(_0x4f2403['query'][_0x3851('0x44')]){_0x3baba1[_0x3851('0x45')]=[{'all':!![]}];}_0x3baba1=_['merge']({},_0x3baba1,_0x4f2403[_0x3851('0x49')]);return db[_0x3851('0x30')]['find'](_0x3baba1)['then'](handleEntityNotFound(_0x3508ab,null))[_0x3851('0x27')](respondWithResult(_0x3508ab,null))[_0x3851('0x48')](handleError(_0x3508ab,null));};exports['destroy']=function(_0x2930a1,_0x3a2624){return db[_0x3851('0x30')]['find']({'where':{'id':_0x2930a1['params']['id']}})[_0x3851('0x27')](handleEntityNotFound(_0x3a2624,null))[_0x3851('0x27')](removeEntity(_0x3a2624,null))[_0x3851('0x48')](handleError(_0x3a2624,null));};exports['describe']=function(_0x366440,_0x29362d){return db['VoicePrefix']['describe']()[_0x3851('0x27')](respondWithResult(_0x29362d,null))[_0x3851('0x48')](handleError(_0x29362d,null));};exports[_0x3851('0x4a')]=function(_0x308f5d,_0x29d5d2){var _0x59ecbe;return db[_0x3851('0x4b')]['transaction'](function(_0x2b4e25){return db[_0x3851('0x30')]['create'](_0x308f5d[_0x3851('0x4c')],{'transaction':_0x2b4e25})['then'](function(_0x814b3){_0x59ecbe=_0x814b3[_0x3851('0x29')]({'plain':!![]});return db[_0x3851('0x4d')][_0x3851('0x4e')]({'where':{'id':_0x59ecbe['VoiceExtensionId']},'raw':!![]})[_0x3851('0x27')](function(_0x57eba5){return createVoicePrefixExtensions(_0x59ecbe,_0x57eba5,_0x2b4e25);});});})[_0x3851('0x27')](function(){var _0x19870f=_0x308f5d[_0x3851('0x4f')][_0x3851('0x29')]({'plain':!![]});if(!_0x19870f)throw new Error(_0x3851('0x50'));if(_0x19870f[_0x3851('0x51')]===_0x3851('0x4f')){var _0x3e2225=_0x59ecbe;return db[_0x3851('0x52')]['find']({'where':{'name':_0x3851('0x2a'),'userProfileId':_0x19870f['userProfileId']},'raw':!![]})['then'](function(_0x536588){if(_0x536588&&_0x536588['autoAssociation']===0x0){return db[_0x3851('0x53')][_0x3851('0x4a')]({'name':_0x3e2225[_0x3851('0x2d')],'resourceId':_0x3e2225['id'],'type':_0x536588[_0x3851('0x2d')],'sectionId':_0x536588['id']},{})[_0x3851('0x27')](function(){return _0x59ecbe;});}else{return _0x59ecbe;}})[_0x3851('0x48')](function(_0x659621){logger['error'](_0x3851('0x54'),_0x659621);throw _0x659621;});}return _0x59ecbe;})[_0x3851('0x27')](respondWithResult(_0x29d5d2,null))['catch'](handleError(_0x29d5d2,null));};function Extension(_0x5c01bd,_0x23daa4,_0x5c128d,_0x31121a){this['context']='from-sip';this[_0x3851('0x55')]=_0x5c01bd;this[_0x3851('0x56')]=_0x5c128d;this[_0x3851('0x33')]=_0x3851('0x57');this[_0x3851('0x58')]='Voice\x20Prefix\x20Extension';this[_0x3851('0x59')]=_0x23daa4;this[_0x3851('0x5a')]=_0x31121a;}function createVoicePrefixExtensions(_0x1ec38a,_0x47663e,_0x2022a7){return new BPromise(function(_0x58f290,_0x57ff83){var _0xf55816=new Extension(formatPrefixName(_0x1ec38a[_0x3851('0x5b')]),0x1,_0x3851('0x5c'),_0x3851('0x5d'));_0xf55816[_0x3851('0x5e')]=_0x1ec38a['id'];return db[_0x3851('0x4d')][_0x3851('0x4a')](_0xf55816,{'transaction':_0x2022a7})['then'](function(_0x2d79ff){var _0x49f2de=_0x2d79ff[_0x3851('0x29')]({'plain':!![]});var _0x4055d2=_['map'](addVoicePrefixExtensions(_0x1ec38a,_0x47663e),function(_0x1ecb61){_0x1ecb61[_0x3851('0x5f')]=_0x49f2de['id'];_0x1ecb61[_0x3851('0x5e')]=_0x1ec38a['id'];return _0x1ecb61;});return db[_0x3851('0x4d')][_0x3851('0x60')](_0x4055d2,{'transaction':_0x2022a7})[_0x3851('0x27')](function(_0xc07e6f){if(!_0xc07e6f){return _0x57ff83(_0x3851('0x61'));}else{return _0x58f290(_0xc07e6f);}})['catch'](function(_0x5452d7){return _0x57ff83(_0x5452d7);});});;});};function addVoicePrefixExtensions(_0x16cca9,_0x29970f){var _0x34dda5=[];var _0x565dc6=formatPrefixName(_0x16cca9[_0x3851('0x5b')]);_0x34dda5['push'](new Extension(_0x565dc6,0x2,'Set',_0x3851('0x62')+_0x16cca9[_0x3851('0x2d')]));if(_0x16cca9[_0x3851('0x63')]){_0x34dda5[_0x3851('0x64')](new Extension(_0x565dc6,0x3,_0x3851('0x65'),_0x3851('0x66')+_0x16cca9[_0x3851('0x63')]));}else{_0x34dda5[_0x3851('0x64')](new Extension(_0x565dc6,0x3,_0x3851('0x5c'),_0x3851('0x67')));}_0x34dda5['push'](new Extension(_0x565dc6,0x4,'goto',_0x29970f['context']+','+_0x3851('0x68')+(0x8+_0x16cca9[_0x3851('0x2d')]['length'])+'}'+','+0x1));return _0x34dda5;}function formatPrefixName(_0x48b41b){var _0x8e269f='_';for(var _0x5e3b55=0x0;_0x5e3b55<_0x48b41b[_0x3851('0x3c')];_0x5e3b55++){if(_0x48b41b[_0x3851('0x69')](_0x5e3b55)=='-'){_0x8e269f+=_0x48b41b['charAt'](_0x5e3b55);}else{_0x8e269f+='['+_0x48b41b[_0x3851('0x69')](_0x5e3b55)+']';}}_0x8e269f+='.';return _0x8e269f;}exports['update']=function(_0x330fee,_0x1d3435,_0x59c0a0){var _0x2f2c0d=_0x330fee[_0x3851('0x4c')];_0x2f2c0d['prefix']=_0x3851('0x6a')+_0x2f2c0d[_0x3851('0x2d')]+'-';return db[_0x3851('0x4b')][_0x3851('0x6b')](function(_0x1a7995){return db[_0x3851('0x30')][_0x3851('0x26')](_0x2f2c0d,{'where':{'id':_0x2f2c0d['id']},'transaction':_0x1a7995})[_0x3851('0x27')](function(){return db[_0x3851('0x4d')]['destroy']({'where':{'VoicePrefixId':_0x2f2c0d['id']},'transaction':_0x1a7995})[_0x3851('0x27')](function(){return db['VoiceExtension'][_0x3851('0x4e')]({'where':{'id':_0x2f2c0d[_0x3851('0x5f')]},'raw':!![]})[_0x3851('0x27')](function(_0x10fc8e){return createVoicePrefixExtensions(_0x2f2c0d,_0x10fc8e,_0x1a7995);});});});})[_0x3851('0x27')](function(){return db[_0x3851('0x30')][_0x3851('0x6c')](_0x2f2c0d['id']);})[_0x3851('0x27')](respondWithResult(_0x1d3435,null))[_0x3851('0x48')](handleError(_0x1d3435,null));};exports[_0x3851('0x6d')]=function(_0x24f29b,_0x488ac0,_0x5ad8a7){return db[_0x3851('0x30')][_0x3851('0x4e')]({'where':{'id':_0x24f29b[_0x3851('0x6e')]['id']}})['then'](handleEntityNotFound(_0x488ac0,null))[_0x3851('0x27')](function(_0x55edde){if(_0x55edde){return _0x55edde[_0x3851('0x6d')](_0x24f29b[_0x3851('0x4c')]['ids'],_[_0x3851('0x6f')](_0x24f29b[_0x3851('0x4c')],[_0x3851('0x70'),'id'])||{})[_0x3851('0x71')](function(_0x265996){for(var _0x2a0ebf=0x0;_0x2a0ebf<_0x24f29b[_0x3851('0x4c')][_0x3851('0x70')][_0x3851('0x3c')];_0x2a0ebf+=0x1){socket[_0x3851('0x72')](_0x3851('0x73'),{'UserId':_0x24f29b[_0x3851('0x4c')][_0x3851('0x70')][_0x2a0ebf],'VoicePrefixId':_0x24f29b[_0x3851('0x6e')]['id']});}return _0x265996;});}})[_0x3851('0x27')](respondWithResult(_0x488ac0,null))['catch'](handleError(_0x488ac0,null));};exports['removeAgents']=function(_0x4a5c54,_0x5abd1f,_0x597c74){return db[_0x3851('0x30')][_0x3851('0x4e')]({'where':{'id':_0x4a5c54[_0x3851('0x6e')]['id']}})[_0x3851('0x27')](handleEntityNotFound(_0x5abd1f,null))[_0x3851('0x27')](function(_0x1f8bf5){if(_0x1f8bf5){return _0x1f8bf5[_0x3851('0x74')](_0x4a5c54[_0x3851('0x36')][_0x3851('0x70')])[_0x3851('0x27')](function(){if(_[_0x3851('0x75')](_0x4a5c54[_0x3851('0x36')]['ids'])){for(var _0x523661=0x0;_0x523661<_0x4a5c54[_0x3851('0x36')]['ids'][_0x3851('0x3c')];_0x523661+=0x1){socket['emit']('userVoicePrefix:remove',{'UserId':Number(_0x4a5c54[_0x3851('0x36')][_0x3851('0x70')][_0x523661]),'VoicePrefixId':Number(_0x4a5c54[_0x3851('0x6e')]['id'])});}}else{socket[_0x3851('0x72')](_0x3851('0x76'),{'UserId':Number(_0x4a5c54[_0x3851('0x36')][_0x3851('0x70')]),'VoicePrefixId':Number(_0x4a5c54['params']['id'])});}});}})[_0x3851('0x27')](respondWithStatusCode(_0x5abd1f,null))[_0x3851('0x48')](handleError(_0x5abd1f,null));};exports[_0x3851('0x77')]=function(_0x3c2a37,_0x2f4dbc,_0x377801){var _0x2441e5={};var _0x5a132f={};var _0x1d39b9;var _0x242eef;return db[_0x3851('0x30')][_0x3851('0x78')]({'where':{'id':_0x3c2a37[_0x3851('0x6e')]['id']}})[_0x3851('0x27')](handleEntityNotFound(_0x2f4dbc,null))[_0x3851('0x27')](function(_0x28f87b){if(_0x28f87b){_0x1d39b9=_0x28f87b;_0x5a132f['model']=_[_0x3851('0x37')](db[_0x3851('0x79')][_0x3851('0x31')]);_0x5a132f[_0x3851('0x36')]=_[_0x3851('0x37')](_0x3c2a37[_0x3851('0x36')]);_0x5a132f[_0x3851('0x38')]=_[_0x3851('0x39')](_0x5a132f[_0x3851('0x35')],_0x5a132f[_0x3851('0x36')]);_0x2441e5['attributes']=_[_0x3851('0x39')](_0x5a132f[_0x3851('0x35')],qs[_0x3851('0x3a')](_0x3c2a37[_0x3851('0x36')][_0x3851('0x3a')]));_0x2441e5[_0x3851('0x3b')]=_0x2441e5[_0x3851('0x3b')]['length']?_0x2441e5['attributes']:_0x5a132f[_0x3851('0x35')];_0x2441e5['order']=qs['sort'](_0x3c2a37[_0x3851('0x36')][_0x3851('0x40')]);_0x2441e5[_0x3851('0x41')]=qs['filters'](_[_0x3851('0x7a')](_0x3c2a37[_0x3851('0x36')],_0x5a132f[_0x3851('0x38')]));if(_0x3c2a37['query'][_0x3851('0x43')]){_0x2441e5[_0x3851('0x41')]=_[_0x3851('0x42')](_0x2441e5[_0x3851('0x41')],{'$or':_[_0x3851('0x2f')](_0x2441e5['attributes'],function(_0x5df43e){var _0x561482={};_0x561482[_0x5df43e]={'$like':'%'+_0x3c2a37[_0x3851('0x36')][_0x3851('0x43')]+'%'};return _0x561482;})});}_0x2441e5=_[_0x3851('0x42')]({},_0x2441e5,_0x3c2a37[_0x3851('0x49')]);return _0x1d39b9[_0x3851('0x77')](_0x2441e5);}})[_0x3851('0x27')](function(_0x2000c7){if(_0x2000c7){_0x242eef=_0x2000c7[_0x3851('0x3c')];if(!_0x3c2a37[_0x3851('0x36')]['hasOwnProperty'](_0x3851('0x3e'))){_0x2441e5[_0x3851('0x21')]=qs['limit'](_0x3c2a37['query'][_0x3851('0x21')]);_0x2441e5[_0x3851('0x20')]=qs[_0x3851('0x20')](_0x3c2a37[_0x3851('0x36')][_0x3851('0x20')]);}return _0x1d39b9['getAgents'](_0x2441e5);}})[_0x3851('0x27')](function(_0x21c6fb){if(_0x21c6fb){return _0x21c6fb?{'count':_0x242eef,'rows':_0x21c6fb}:null;}})['then'](respondWithResult(_0x2f4dbc,null))[_0x3851('0x48')](handleError(_0x2f4dbc,null));}; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.events.js b/server/api/voicePrefix/voicePrefix.events.js index 27cbec4..5b233bf 100644 --- a/server/api/voicePrefix/voicePrefix.events.js +++ b/server/api/voicePrefix/voicePrefix.events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xcb91=['save','update','emit','hasOwnProperty','hook','VoicePrefix','setMaxListeners'];(function(_0x279134,_0x5045f9){var _0x49beca=function(_0x3c7fd8){while(--_0x3c7fd8){_0x279134['push'](_0x279134['shift']());}};_0x49beca(++_0x5045f9);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x4c3ffe,_0x457374){_0x4c3ffe=_0x4c3ffe-0x0;var _0x28d3eb=_0xcb91[_0x4c3ffe];return _0x28d3eb;};'use strict';var EventEmitter=require('events');var VoicePrefix=require('../../mysqldb')['db'][_0x1cb9('0x0')];var VoicePrefixEvents=new EventEmitter();VoicePrefixEvents[_0x1cb9('0x1')](0x0);var events={'afterCreate':_0x1cb9('0x2'),'afterUpdate':_0x1cb9('0x3'),'afterDestroy':'remove'};function emitEvent(_0x8c392f){return function(_0x2c17b8,_0x545a34,_0x13d5fd){VoicePrefixEvents[_0x1cb9('0x4')](_0x8c392f+':'+_0x2c17b8['id'],_0x2c17b8);VoicePrefixEvents['emit'](_0x8c392f,_0x2c17b8);_0x13d5fd(null);};}for(var e in events){if(events[_0x1cb9('0x5')](e)){var event=events[e];VoicePrefix[_0x1cb9('0x6')](e,emitEvent(event));}}module['exports']=VoicePrefixEvents; \ No newline at end of file +var _0x34e8=['emit','hasOwnProperty','exports','events','../../mysqldb','VoicePrefix','setMaxListeners','update','remove'];(function(_0x3635ce,_0x33a6f9){var _0x97ecd0=function(_0x123d98){while(--_0x123d98){_0x3635ce['push'](_0x3635ce['shift']());}};_0x97ecd0(++_0x33a6f9);}(_0x34e8,0x12c));var _0x834e=function(_0x49917a,_0x38e29a){_0x49917a=_0x49917a-0x0;var _0x1ae91e=_0x34e8[_0x49917a];return _0x1ae91e;};'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 48bd3d7..ac01f4b 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 _0xf730=['define','VoicePrefix','lodash','util','moment','bluebird','request-promise','rimraf','./voicePrefix.attributes','exports'];(function(_0x203d48,_0x2e28bb){var _0x2a2759=function(_0x5d1280){while(--_0x5d1280){_0x203d48['push'](_0x203d48['shift']());}};_0x2a2759(++_0x2e28bb);}(_0xf730,0xd4));var _0x0f73=function(_0x1a3984,_0x492a1d){_0x1a3984=_0x1a3984-0x0;var _0x386311=_0xf730[_0x1a3984];return _0x386311;};'use strict';var _=require(_0x0f73('0x0'));var util=require(_0x0f73('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x0f73('0x2'));var BPromise=require(_0x0f73('0x3'));var rp=require(_0x0f73('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x0f73('0x5'));var config=require('../../config/environment');var attributes=require(_0x0f73('0x6'));module[_0x0f73('0x7')]=function(_0x392163,_0x2bb970){return _0x392163[_0x0f73('0x8')](_0x0f73('0x9'),attributes,{'tableName':'voice_prefixes','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xeddd=['util','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','VoicePrefix','lodash'];(function(_0x101237,_0x448f24){var _0x50ede4=function(_0x4d858d){while(--_0x4d858d){_0x101237['push'](_0x101237['shift']());}};_0x50ede4(++_0x448f24);}(_0xeddd,0xd0));var _0xdedd=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0xeddd[_0x2641f9];return _0x585741;};'use strict';var _=require(_0xdedd('0x0'));var util=require(_0xdedd('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xdedd('0x2'));var BPromise=require(_0xdedd('0x3'));var rp=require(_0xdedd('0x4'));var fs=require('fs');var path=require(_0xdedd('0x5'));var rimraf=require(_0xdedd('0x6'));var config=require(_0xdedd('0x7'));var attributes=require('./voicePrefix.attributes');module[_0xdedd('0x8')]=function(_0x5b0d82,_0x36fe1e){return _0x5b0d82[_0xdedd('0x9')](_0xdedd('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 c8e97c4..bb928fa 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 _0x1794=['localhost','./voicePrefix.socket','then','VoicePrefix,\x20%s,\x20%s','request\x20sent','debug','VoicePrefix,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','redis'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x1794,0x1f3));var _0x4179=function(_0x319199,_0x151627){_0x319199=_0x319199-0x0;var _0x5493a2=_0x1794[_0x319199];return _0x5493a2;};'use strict';var _=require(_0x4179('0x0'));var util=require(_0x4179('0x1'));var moment=require(_0x4179('0x2'));var BPromise=require(_0x4179('0x3'));var rs=require(_0x4179('0x4'));var fs=require('fs');var Redis=require(_0x4179('0x5'));var db=require(_0x4179('0x6'))['db'];var utils=require(_0x4179('0x7'));var logger=require(_0x4179('0x8'))(_0x4179('0x9'));var config=require(_0x4179('0xa'));var jayson=require('jayson/promise');var client=jayson[_0x4179('0xb')][_0x4179('0xc')]({'port':0x232a});config[_0x4179('0xd')]=_['defaults'](config['redis'],{'host':_0x4179('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x4179('0xd')]));require(_0x4179('0xf'))['register'](socket);function respondWithRpcPromise(_0xefb283,_0x6547c,_0xc69340){return new BPromise(function(_0x441f19,_0x33b6aa){return client['request'](_0xefb283,_0xc69340)[_0x4179('0x10')](function(_0x264f44){logger['info'](_0x4179('0x11'),_0x6547c,_0x4179('0x12'));logger[_0x4179('0x13')](_0x4179('0x14'),_0x6547c,_0x4179('0x12'),JSON[_0x4179('0x15')](_0x264f44));if(_0x264f44['error']){if(_0x264f44[_0x4179('0x16')][_0x4179('0x17')]===0x1f4){logger[_0x4179('0x16')]('VoicePrefix,\x20%s,\x20%s',_0x6547c,_0x264f44[_0x4179('0x16')][_0x4179('0x18')]);return _0x33b6aa(_0x264f44[_0x4179('0x16')][_0x4179('0x18')]);}logger[_0x4179('0x16')](_0x4179('0x11'),_0x6547c,_0x264f44[_0x4179('0x16')]['message']);return _0x441f19(_0x264f44[_0x4179('0x16')][_0x4179('0x18')]);}else{logger['info'](_0x4179('0x11'),_0x6547c,_0x4179('0x12'));_0x441f19(_0x264f44[_0x4179('0x19')][_0x4179('0x18')]);}})[_0x4179('0x1a')](function(_0x33a9b0){logger[_0x4179('0x16')]('VoicePrefix,\x20%s,\x20%s',_0x6547c,_0x33a9b0);_0x33b6aa(_0x33a9b0);});});} \ No newline at end of file +var _0x6b89=['localhost','./voicePrefix.socket','request','then','VoicePrefix,\x20%s,\x20%s','request\x20sent','debug','VoicePrefix,\x20%s,\x20%s,\x20%s','stringify','code','error','message','info','result','catch','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','http','defaults','redis'];(function(_0x15c421,_0x6366f7){var _0x5e5ed5=function(_0x206e66){while(--_0x206e66){_0x15c421['push'](_0x15c421['shift']());}};_0x5e5ed5(++_0x6366f7);}(_0x6b89,0x186));var _0x96b8=function(_0x460452,_0x3b0d60){_0x460452=_0x460452-0x0;var _0xa06647=_0x6b89[_0x460452];return _0xa06647;};'use strict';var _=require('lodash');var util=require(_0x96b8('0x0'));var moment=require(_0x96b8('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x96b8('0x2'));var db=require(_0x96b8('0x3'))['db'];var utils=require(_0x96b8('0x4'));var logger=require('../../config/logger')('rpc');var config=require(_0x96b8('0x5'));var jayson=require(_0x96b8('0x6'));var client=jayson['client'][_0x96b8('0x7')]({'port':0x232a});config['redis']=_[_0x96b8('0x8')](config[_0x96b8('0x9')],{'host':_0x96b8('0xa'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x96b8('0xb'))['register'](socket);function respondWithRpcPromise(_0x3824a4,_0x3e6237,_0x3d331c){return new BPromise(function(_0x23d805,_0x47d6aa){return client[_0x96b8('0xc')](_0x3824a4,_0x3d331c)[_0x96b8('0xd')](function(_0x17883a){logger['info'](_0x96b8('0xe'),_0x3e6237,_0x96b8('0xf'));logger[_0x96b8('0x10')](_0x96b8('0x11'),_0x3e6237,'request\x20sent',JSON[_0x96b8('0x12')](_0x17883a));if(_0x17883a['error']){if(_0x17883a['error'][_0x96b8('0x13')]===0x1f4){logger[_0x96b8('0x14')]('VoicePrefix,\x20%s,\x20%s',_0x3e6237,_0x17883a[_0x96b8('0x14')][_0x96b8('0x15')]);return _0x47d6aa(_0x17883a['error']['message']);}logger[_0x96b8('0x14')](_0x96b8('0xe'),_0x3e6237,_0x17883a[_0x96b8('0x14')][_0x96b8('0x15')]);return _0x23d805(_0x17883a['error'][_0x96b8('0x15')]);}else{logger[_0x96b8('0x16')](_0x96b8('0xe'),_0x3e6237,_0x96b8('0xf'));_0x23d805(_0x17883a[_0x96b8('0x17')]['message']);}})[_0x96b8('0x18')](function(_0x36af6e){logger[_0x96b8('0x14')](_0x96b8('0xe'),_0x3e6237,_0x36af6e);_0x47d6aa(_0x36af6e);});});} \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.socket.js b/server/api/voicePrefix/voicePrefix.socket.js index 55c23cb..490c939 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 _0x1408=['emit','removeListener','register','voicePrefix:','./voicePrefix.events','save','update'];(function(_0x2cdfba,_0x2e9f8c){var _0x28cd8f=function(_0x584cfb){while(--_0x584cfb){_0x2cdfba['push'](_0x2cdfba['shift']());}};_0x28cd8f(++_0x2e9f8c);}(_0x1408,0x131));var _0x8140=function(_0x367644,_0x508eea){_0x367644=_0x367644-0x0;var _0x4ae940=_0x1408[_0x367644];return _0x4ae940;};'use strict';var VoicePrefixEvents=require(_0x8140('0x0'));var events=[_0x8140('0x1'),'remove',_0x8140('0x2')];function createListener(_0x25884c,_0x40f6f9){return function(_0x51ad69){_0x40f6f9[_0x8140('0x3')](_0x25884c,_0x51ad69);};}function removeListener(_0x3f7712,_0x3510d9){return function(){VoicePrefixEvents[_0x8140('0x4')](_0x3f7712,_0x3510d9);};}exports[_0x8140('0x5')]=function(_0x585648){for(var _0x4e1763=0x0,_0x1ce368=events['length'];_0x4e1763<_0x1ce368;_0x4e1763++){var _0x3ccd16=events[_0x4e1763];var _0x25ecb0=createListener(_0x8140('0x6')+_0x3ccd16,_0x585648);VoicePrefixEvents['on'](_0x3ccd16,_0x25ecb0);}}; \ No newline at end of file +var _0x172f=['length','voicePrefix:','./voicePrefix.events','save','remove','emit','removeListener','register'];(function(_0x14b66e,_0xcc9bd7){var _0x455907=function(_0x2bccef){while(--_0x2bccef){_0x14b66e['push'](_0x14b66e['shift']());}};_0x455907(++_0xcc9bd7);}(_0x172f,0xfa));var _0xf172=function(_0x28e90d,_0x3d6244){_0x28e90d=_0x28e90d-0x0;var _0x103d54=_0x172f[_0x28e90d];return _0x103d54;};'use strict';var VoicePrefixEvents=require(_0xf172('0x0'));var events=[_0xf172('0x1'),_0xf172('0x2'),'update'];function createListener(_0xa1d60,_0x30d46f){return function(_0x3d145a){_0x30d46f[_0xf172('0x3')](_0xa1d60,_0x3d145a);};}function removeListener(_0xd38b74,_0x2c00a0){return function(){VoicePrefixEvents[_0xf172('0x4')](_0xd38b74,_0x2c00a0);};}exports[_0xf172('0x5')]=function(_0x4d97d4){for(var _0x442ba4=0x0,_0x308782=events[_0xf172('0x6')];_0x442ba4<_0x308782;_0x442ba4++){var _0x14275c=events[_0x442ba4];var _0x494049=createListener(_0xf172('0x7')+_0x14275c,_0x4d97d4);VoicePrefixEvents['on'](_0x14275c,_0x494049);}}; \ No newline at end of file diff --git a/server/api/voiceQueue/index.js b/server/api/voiceQueue/index.js index 5648d40..528ae85 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 _0x312a=['Router','../../components/auth/service','./voiceQueue.controller','index','get','/:id','isAuthenticated','show','/:id/hoppers','getHoppers','/:id/hopper_black','getHopperBlacks','/:id/teams','getTeams','/:id/users','getAgents','getMembers','/:id/lists','getLists','/:id/blacklists','getBlackLists','post','/:id/clone','clone','addTeams','addAgents','addLists','put','delete','removeAgents','removeLists','removeBlackLists','exports','multer','util','path','connect-timeout'];(function(_0x497a22,_0x323180){var _0x501e7d=function(_0x252b86){while(--_0x252b86){_0x497a22['push'](_0x497a22['shift']());}};_0x501e7d(++_0x323180);}(_0x312a,0x1dd));var _0xa312=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x312a[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0xa312('0x0'));var util=require(_0xa312('0x1'));var path=require(_0xa312('0x2'));var timeout=require(_0xa312('0x3'));var express=require('express');var router=express[_0xa312('0x4')]();var auth=require(_0xa312('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xa312('0x6'));router['get']('/',auth['isAuthenticated'](),controller[_0xa312('0x7')]);router[_0xa312('0x8')](_0xa312('0x9'),auth[_0xa312('0xa')](),controller[_0xa312('0xb')]);router['get'](_0xa312('0xc'),auth['isAuthenticated'](),controller[_0xa312('0xd')]);router[_0xa312('0x8')]('/:id/hopper_histories',auth[_0xa312('0xa')](),controller['getHopperHistories']);router[_0xa312('0x8')]('/:id/hopper_finals',auth[_0xa312('0xa')](),controller['getHopperFinals']);router[_0xa312('0x8')](_0xa312('0xe'),auth[_0xa312('0xa')](),controller[_0xa312('0xf')]);router[_0xa312('0x8')](_0xa312('0x10'),auth[_0xa312('0xa')](),controller[_0xa312('0x11')]);router['get'](_0xa312('0x12'),auth[_0xa312('0xa')](),controller[_0xa312('0x13')]);router[_0xa312('0x8')]('/:id/members',auth[_0xa312('0xa')](),controller[_0xa312('0x14')]);router[_0xa312('0x8')](_0xa312('0x15'),auth[_0xa312('0xa')](),controller[_0xa312('0x16')]);router[_0xa312('0x8')](_0xa312('0x17'),auth[_0xa312('0xa')](),controller[_0xa312('0x18')]);router[_0xa312('0x19')]('/',auth[_0xa312('0xa')](),controller['create']);router[_0xa312('0x19')](_0xa312('0x1a'),auth[_0xa312('0xa')](),controller[_0xa312('0x1b')]);router[_0xa312('0x19')](_0xa312('0x10'),auth['isAuthenticated'](),controller[_0xa312('0x1c')]);router[_0xa312('0x19')](_0xa312('0x12'),auth[_0xa312('0xa')](),controller[_0xa312('0x1d')]);router[_0xa312('0x19')](_0xa312('0x15'),auth[_0xa312('0xa')](),controller[_0xa312('0x1e')]);router[_0xa312('0x19')](_0xa312('0x17'),auth[_0xa312('0xa')](),controller['addBlackLists']);router[_0xa312('0x1f')](_0xa312('0x9'),auth['isAuthenticated'](),controller['update']);router[_0xa312('0x20')]('/:id',auth['isAuthenticated'](),controller['destroy']);router[_0xa312('0x20')](_0xa312('0x10'),auth[_0xa312('0xa')](),controller['removeTeams']);router[_0xa312('0x20')](_0xa312('0x12'),auth[_0xa312('0xa')](),controller[_0xa312('0x21')]);router[_0xa312('0x20')](_0xa312('0x15'),auth[_0xa312('0xa')](),controller[_0xa312('0x22')]);router[_0xa312('0x20')](_0xa312('0x17'),auth['isAuthenticated'](),controller[_0xa312('0x23')]);module[_0xa312('0x24')]=router; \ No newline at end of file +var _0xe15a=['/:id/hopper_finals','getHopperFinals','getAgents','/:id/members','getMembers','getLists','post','create','/:id/clone','addTeams','/:id/users','addAgents','addLists','addBlackLists','put','update','destroy','delete','/:id/teams','removeTeams','/:id/lists','removeLists','removeBlackLists','exports','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','./voiceQueue.controller','get','isAuthenticated','index','/:id','/:id/hoppers','getHoppers','/:id/hopper_histories','getHopperHistories'];(function(_0x440031,_0x4d84f5){var _0x4d2561=function(_0x25a6dd){while(--_0x25a6dd){_0x440031['push'](_0x440031['shift']());}};_0x4d2561(++_0x4d84f5);}(_0xe15a,0xb4));var _0xae15=function(_0x178f52,_0x5d9675){_0x178f52=_0x178f52-0x0;var _0x556f99=_0xe15a[_0x178f52];return _0x556f99;};'use strict';var multer=require(_0xae15('0x0'));var util=require(_0xae15('0x1'));var path=require(_0xae15('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xae15('0x3')]();var auth=require(_0xae15('0x4'));var interaction=require(_0xae15('0x5'));var config=require('../../config/environment');var controller=require(_0xae15('0x6'));router[_0xae15('0x7')]('/',auth[_0xae15('0x8')](),controller[_0xae15('0x9')]);router[_0xae15('0x7')](_0xae15('0xa'),auth[_0xae15('0x8')](),controller['show']);router['get'](_0xae15('0xb'),auth[_0xae15('0x8')](),controller[_0xae15('0xc')]);router['get'](_0xae15('0xd'),auth['isAuthenticated'](),controller[_0xae15('0xe')]);router['get'](_0xae15('0xf'),auth['isAuthenticated'](),controller[_0xae15('0x10')]);router[_0xae15('0x7')]('/:id/hopper_black',auth[_0xae15('0x8')](),controller['getHopperBlacks']);router[_0xae15('0x7')]('/:id/teams',auth[_0xae15('0x8')](),controller['getTeams']);router[_0xae15('0x7')]('/:id/users',auth[_0xae15('0x8')](),controller[_0xae15('0x11')]);router[_0xae15('0x7')](_0xae15('0x12'),auth[_0xae15('0x8')](),controller[_0xae15('0x13')]);router['get']('/:id/lists',auth[_0xae15('0x8')](),controller[_0xae15('0x14')]);router[_0xae15('0x7')]('/:id/blacklists',auth['isAuthenticated'](),controller['getBlackLists']);router[_0xae15('0x15')]('/',auth[_0xae15('0x8')](),controller[_0xae15('0x16')]);router[_0xae15('0x15')](_0xae15('0x17'),auth[_0xae15('0x8')](),controller['clone']);router[_0xae15('0x15')]('/:id/teams',auth[_0xae15('0x8')](),controller[_0xae15('0x18')]);router[_0xae15('0x15')](_0xae15('0x19'),auth[_0xae15('0x8')](),controller[_0xae15('0x1a')]);router[_0xae15('0x15')]('/:id/lists',auth[_0xae15('0x8')](),controller[_0xae15('0x1b')]);router[_0xae15('0x15')]('/:id/blacklists',auth[_0xae15('0x8')](),controller[_0xae15('0x1c')]);router[_0xae15('0x1d')](_0xae15('0xa'),auth[_0xae15('0x8')](),controller[_0xae15('0x1e')]);router['delete'](_0xae15('0xa'),auth[_0xae15('0x8')](),controller[_0xae15('0x1f')]);router[_0xae15('0x20')](_0xae15('0x21'),auth[_0xae15('0x8')](),controller[_0xae15('0x22')]);router[_0xae15('0x20')](_0xae15('0x19'),auth[_0xae15('0x8')](),controller['removeAgents']);router[_0xae15('0x20')](_0xae15('0x23'),auth['isAuthenticated'](),controller[_0xae15('0x24')]);router[_0xae15('0x20')]('/:id/blacklists',auth['isAuthenticated'](),controller[_0xae15('0x25')]);module[_0xae15('0x26')]=router; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.attributes.js b/server/api/voiceQueue/voiceQueue.attributes.js index 33bff38..06a2dc1 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(_0x43f2ed,_0x18ef91){var _0x5f452f=function(_0x4616df){while(--_0x4616df){_0x43f2ed['push'](_0x43f2ed['shift']());}};_0x5f452f(++_0x18ef91);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2cfb58,_0x3d9412){_0x2cfb58=_0x2cfb58-0x0;var _0xd99951=_0xa9e0[_0x2cfb58];return _0xd99951;};'use strict';var Sequelize=require(_0x0a9e('0x0'));module[_0x0a9e('0x1')]={'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(_0x2f229a,_0x542731){var _0xdd2c1f=function(_0x39f8f4){while(--_0x39f8f4){_0x2f229a['push'](_0x2f229a['shift']());}};_0xdd2c1f(++_0x542731);}(_0xa9e0,0x123));var _0x0a9e=function(_0x37c22c,_0x28a70d){_0x37c22c=_0x37c22c-0x0;var _0x119d79=_0xa9e0[_0x37c22c];return _0x119d79;};'use strict';var Sequelize=require(_0x0a9e('0x0'));module[_0x0a9e('0x1')]={'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 4a87ac6..18f3a47 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 _0x6ede=['squel','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../mysqldb','redis','localhost','socket.io-emitter','./voiceQueue.socket','register','status','end','json','count','offset','limit','set','Content-Range','apply','save','then','destroy','get','VoiceQueues','inbound','QueueCampaigns','outbound','ignore','map','value','includes','type','name','UserProfileResource','sendStatus','error','stack','send','index','VoiceQueue','rawAttributes','fieldName','key','model','query','keys','filters','attributes','intersection','fields','length','nolimit','order','where','pick','filter','options','includeAll','findAll','catch','show','params','include','merge','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','omit','createdAt','updatedAt','find','getHoppers','findOne','CmHopper','hasOwnProperty','sort','VoiceQueueId','CmHopperHistory','rows','getHopperFinals','CmHopperFinal','CmHopperBlack','getTeams','Team','addTeams','teams','Agents','online','voicePause','interface','flatMap','penalty','sequelize','transaction','each','UserVoiceQueue','findOrCreate','UserVoiceQueueRt','isNil','format','SIP/%s','emit','userVoiceQueue:save','removeTeams','ids','User','select','field','from','team_has_voice_queues','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','ut.UserId\x20=\x20?','QueryTypes','every','TeamId','all','union','isEmpty','removeAgents','forEach','userVoiceQueue:remove','addAgents','spread','push','upsert','isArray','getAgents','getMembers','getLists','CmList','addLists','dialCheckDuplicateType','always','insert','into','cm_hopper','phone','scheduledAt','ContactId','ListId','NOW()','CmListId','toString','cm_contacts','deletedAt\x20IS\x20NULL','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','COALESCE(calleridnum,\x27\x27)','cm_hopper_final','COALESCE(phone,\x27\x27)','onlyIfOpen','fromQuery','ListId\x20=\x20?','VoiceQueueId\x20=\x20?','removeLists','getBlackLists','addBlackLists','removeBlackLists','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','sox'];(function(_0x6d0a05,_0x545cd2){var _0x17fec8=function(_0x95f7e9){while(--_0x95f7e9){_0x6d0a05['push'](_0x6d0a05['shift']());}};_0x17fec8(++_0x545cd2);}(_0x6ede,0xac));var _0xe6ed=function(_0xcf0d77,_0x2195aa){_0xcf0d77=_0xcf0d77-0x0;var _0x13b05f=_0x6ede[_0xcf0d77];return _0x13b05f;};'use strict';var pdf=require(_0xe6ed('0x0'));var emlformat=require(_0xe6ed('0x1'));var rimraf=require(_0xe6ed('0x2'));var zipdir=require(_0xe6ed('0x3'));var jsonpatch=require(_0xe6ed('0x4'));var rp=require(_0xe6ed('0x5'));var moment=require('moment');var BPromise=require(_0xe6ed('0x6'));var Mustache=require(_0xe6ed('0x7'));var util=require('util');var path=require('path');var sox=require(_0xe6ed('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0xe6ed('0x9'));var crypto=require(_0xe6ed('0xa'));var jsforce=require(_0xe6ed('0xb'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xe6ed('0xc'));var Papa=require(_0xe6ed('0xd'));var Redis=require('ioredis');var authService=require(_0xe6ed('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0xe6ed('0xf'));var hardwareService=require(_0xe6ed('0x10'));var logger=require(_0xe6ed('0x11'))(_0xe6ed('0x12'));var utils=require('../../config/utils');var config=require('../../config/environment');var db=require(_0xe6ed('0x13'))['db'];config['redis']=_['defaults'](config[_0xe6ed('0x14')],{'host':_0xe6ed('0x15'),'port':0x18eb});var socket=require(_0xe6ed('0x16'))(new Redis(config[_0xe6ed('0x14')]));require(_0xe6ed('0x17'))[_0xe6ed('0x18')](socket);function respondWithStatusCode(_0x3783f6,_0x3bdd19){_0x3bdd19=_0x3bdd19||0xcc;return function(_0x499ea2){if(_0x499ea2){return _0x3783f6['sendStatus'](_0x3bdd19);}return _0x3783f6[_0xe6ed('0x19')](_0x3bdd19)[_0xe6ed('0x1a')]();};}function respondWithResult(_0x5c0ca2,_0x1a8d9c){_0x1a8d9c=_0x1a8d9c||0xc8;return function(_0x52a1a3){if(_0x52a1a3){return _0x5c0ca2[_0xe6ed('0x19')](_0x1a8d9c)[_0xe6ed('0x1b')](_0x52a1a3);}};}function respondWithFilteredResult(_0x3b2bbd,_0x160335){return function(_0x212e46){if(_0x212e46){var _0x5962ef=_0x212e46[_0xe6ed('0x1c')],_0x1a037b=_0x160335[_0xe6ed('0x1d')],_0x2da725=_0x160335['offset']+_0x160335[_0xe6ed('0x1e')],_0x554895;if(_0x2da725>=_0x5962ef){_0x2da725=_0x5962ef;_0x554895=0xc8;}else{_0x554895=0xce;}_0x3b2bbd['status'](_0x554895);return _0x3b2bbd[_0xe6ed('0x1f')](_0xe6ed('0x20'),_0x1a037b+'-'+_0x2da725+'/'+_0x5962ef)['json'](_0x212e46);}return null;};}function patchUpdates(_0x56f83c){return function(_0x29a66f){try{jsonpatch[_0xe6ed('0x21')](_0x29a66f,_0x56f83c,!![]);}catch(_0x346096){return BPromise['reject'](_0x346096);}return _0x29a66f[_0xe6ed('0x22')]();};}function saveUpdates(_0x3deb06,_0x833d43){return function(_0x288fd4){if(_0x288fd4){return _0x288fd4['update'](_0x3deb06)[_0xe6ed('0x23')](function(_0x4d1068){return _0x4d1068;});}return null;};}function removeEntity(_0x2ad4e5,_0x2277dc){return function(_0x10c73d){if(_0x10c73d){return _0x10c73d[_0xe6ed('0x24')]()['then'](function(){var _0x39fb58=_0x10c73d[_0xe6ed('0x25')]({'plain':!![]});var _0x25ba84=[{'name':_0xe6ed('0x26'),'value':_0xe6ed('0x27'),'ignore':![]},{'name':_0xe6ed('0x28'),'value':_0xe6ed('0x29'),'ignore':![]}];var _0x40da28=_(_0x25ba84)['filter'](_0xe6ed('0x2a'))[_0xe6ed('0x2b')](_0xe6ed('0x2c'))[_0xe6ed('0x2c')]();if(_[_0xe6ed('0x2d')](_0x40da28,_0x39fb58[_0xe6ed('0x2e')])){return;}var _0x18bbb1=_['find'](_0x25ba84,[_0xe6ed('0x2c'),_0x39fb58[_0xe6ed('0x2e')]])[_0xe6ed('0x2f')];return db[_0xe6ed('0x30')][_0xe6ed('0x24')]({'where':{'type':_0x18bbb1,'resourceId':_0x39fb58['id']}})['then'](function(){return _0x10c73d;});})[_0xe6ed('0x23')](function(){_0x2ad4e5[_0xe6ed('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4ad400,_0x32b6d2){return function(_0x34f15d){if(!_0x34f15d){_0x4ad400[_0xe6ed('0x31')](0x194);}return _0x34f15d;};}function handleError(_0x710af4,_0x593921){_0x593921=_0x593921||0x1f4;return function(_0x449f0c){logger[_0xe6ed('0x32')](_0x449f0c[_0xe6ed('0x33')]);if(_0x449f0c[_0xe6ed('0x2f')]){delete _0x449f0c[_0xe6ed('0x2f')];}_0x710af4[_0xe6ed('0x19')](_0x593921)[_0xe6ed('0x34')](_0x449f0c);};}exports[_0xe6ed('0x35')]=function(_0x34f12c,_0x265b2e){var _0x139606={},_0x16d1c5={},_0x2d8c={'count':0x0,'rows':[]};var _0x14d20f=_['map'](db[_0xe6ed('0x36')][_0xe6ed('0x37')],function(_0x574c06){return{'name':_0x574c06[_0xe6ed('0x38')],'type':_0x574c06[_0xe6ed('0x2e')][_0xe6ed('0x39')]};});_0x16d1c5[_0xe6ed('0x3a')]=_[_0xe6ed('0x2b')](_0x14d20f,_0xe6ed('0x2f'));_0x16d1c5[_0xe6ed('0x3b')]=_[_0xe6ed('0x3c')](_0x34f12c[_0xe6ed('0x3b')]);_0x16d1c5[_0xe6ed('0x3d')]=_['intersection'](_0x16d1c5[_0xe6ed('0x3a')],_0x16d1c5[_0xe6ed('0x3b')]);_0x139606[_0xe6ed('0x3e')]=_[_0xe6ed('0x3f')](_0x16d1c5[_0xe6ed('0x3a')],qs['fields'](_0x34f12c[_0xe6ed('0x3b')][_0xe6ed('0x40')]));_0x139606[_0xe6ed('0x3e')]=_0x139606[_0xe6ed('0x3e')][_0xe6ed('0x41')]?_0x139606[_0xe6ed('0x3e')]:_0x16d1c5[_0xe6ed('0x3a')];if(!_0x34f12c[_0xe6ed('0x3b')]['hasOwnProperty'](_0xe6ed('0x42'))){_0x139606[_0xe6ed('0x1e')]=qs['limit'](_0x34f12c['query'][_0xe6ed('0x1e')]);_0x139606['offset']=qs[_0xe6ed('0x1d')](_0x34f12c[_0xe6ed('0x3b')][_0xe6ed('0x1d')]);}_0x139606[_0xe6ed('0x43')]=qs['sort'](_0x34f12c[_0xe6ed('0x3b')]['sort']);_0x139606[_0xe6ed('0x44')]=qs[_0xe6ed('0x3d')](_[_0xe6ed('0x45')](_0x34f12c[_0xe6ed('0x3b')],_0x16d1c5[_0xe6ed('0x3d')]),_0x14d20f);if(_0x34f12c['query']['filter']){_0x139606['where']=_['merge'](_0x139606[_0xe6ed('0x44')],{'$or':_['map'](_0x14d20f,function(_0x3747cf){if(_0x3747cf[_0xe6ed('0x2e')]!=='VIRTUAL'){var _0x443913={};_0x443913[_0x3747cf[_0xe6ed('0x2f')]]={'$like':'%'+_0x34f12c[_0xe6ed('0x3b')][_0xe6ed('0x46')]+'%'};return _0x443913;}})});}_0x139606=_['merge']({},_0x139606,_0x34f12c[_0xe6ed('0x47')]);var _0x1165fc={'where':_0x139606[_0xe6ed('0x44')]};return db[_0xe6ed('0x36')][_0xe6ed('0x1c')](_0x1165fc)[_0xe6ed('0x23')](function(_0x64eb9c){_0x2d8c['count']=_0x64eb9c;if(_0x34f12c[_0xe6ed('0x3b')][_0xe6ed('0x48')]){_0x139606['include']=[{'all':!![]}];}return db[_0xe6ed('0x36')][_0xe6ed('0x49')](_0x139606);})[_0xe6ed('0x23')](function(_0x481bd4){_0x2d8c['rows']=_0x481bd4;return _0x2d8c;})[_0xe6ed('0x23')](respondWithFilteredResult(_0x265b2e,_0x139606))[_0xe6ed('0x4a')](handleError(_0x265b2e,null));};exports[_0xe6ed('0x4b')]=function(_0x51bf48,_0x465117){var _0x54c52a={'raw':![],'where':{'id':_0x51bf48[_0xe6ed('0x4c')]['id']}},_0x148a0f={};_0x148a0f[_0xe6ed('0x3a')]=_['keys'](db['VoiceQueue'][_0xe6ed('0x37')]);_0x148a0f['query']=_['keys'](_0x51bf48[_0xe6ed('0x3b')]);_0x148a0f[_0xe6ed('0x3d')]=_[_0xe6ed('0x3f')](_0x148a0f['model'],_0x148a0f[_0xe6ed('0x3b')]);_0x54c52a[_0xe6ed('0x3e')]=_[_0xe6ed('0x3f')](_0x148a0f[_0xe6ed('0x3a')],qs['fields'](_0x51bf48['query'][_0xe6ed('0x40')]));_0x54c52a[_0xe6ed('0x3e')]=_0x54c52a[_0xe6ed('0x3e')][_0xe6ed('0x41')]?_0x54c52a[_0xe6ed('0x3e')]:_0x148a0f['model'];if(_0x51bf48[_0xe6ed('0x3b')][_0xe6ed('0x48')]){_0x54c52a[_0xe6ed('0x4d')]=[{'all':!![]}];}_0x54c52a=_[_0xe6ed('0x4e')]({},_0x54c52a,_0x51bf48[_0xe6ed('0x47')]);return db[_0xe6ed('0x36')]['find'](_0x54c52a)[_0xe6ed('0x23')](handleEntityNotFound(_0x465117,null))['then'](respondWithResult(_0x465117,null))[_0xe6ed('0x4a')](handleError(_0x465117,null));};exports[_0xe6ed('0x4f')]=function(_0x328e4a,_0x2996cd){return db[_0xe6ed('0x36')][_0xe6ed('0x4f')](_0x328e4a[_0xe6ed('0x50')],{})[_0xe6ed('0x23')](function(_0x36ef47){var _0x14d91e=_0x328e4a[_0xe6ed('0x51')][_0xe6ed('0x25')]({'plain':!![]});if(!_0x14d91e)throw new Error(_0xe6ed('0x52'));if(_0x14d91e[_0xe6ed('0x53')]===_0xe6ed('0x51')){var _0x179105=_0x36ef47['get']({'plain':!![]});var _0x11f4ac=[{'name':_0xe6ed('0x26'),'value':_0xe6ed('0x27')},{'name':_0xe6ed('0x28'),'value':_0xe6ed('0x29')}];var _0x81abee=_['find'](_0x11f4ac,[_0xe6ed('0x2c'),_0x179105[_0xe6ed('0x2e')]])[_0xe6ed('0x2f')];return db[_0xe6ed('0x54')]['find']({'where':{'name':_0x81abee,'userProfileId':_0x14d91e[_0xe6ed('0x55')]},'raw':!![]})[_0xe6ed('0x23')](function(_0xcec87c){if(_0xcec87c&&_0xcec87c[_0xe6ed('0x56')]===0x0){return db['UserProfileResource'][_0xe6ed('0x4f')]({'name':_0x179105[_0xe6ed('0x2f')],'resourceId':_0x179105['id'],'type':_0xcec87c[_0xe6ed('0x2f')],'sectionId':_0xcec87c['id']},{})['then'](function(){return _0x36ef47;});}else{return _0x36ef47;}})[_0xe6ed('0x4a')](function(_0x39008d){logger[_0xe6ed('0x32')](_0xe6ed('0x57'),_0x39008d);throw _0x39008d;});}return _0x36ef47;})[_0xe6ed('0x23')](respondWithResult(_0x2996cd,0xc9))[_0xe6ed('0x4a')](handleError(_0x2996cd,null));};exports[_0xe6ed('0x58')]=function(_0x2c37e6,_0x14abef){var _0x51a8f2={'where':{'id':_0x2c37e6[_0xe6ed('0x4c')]['id']}},_0x371ae4={};_0x371ae4[_0xe6ed('0x3a')]=_[_0xe6ed('0x3c')](db['VoiceQueue'][_0xe6ed('0x37')]);_0x51a8f2['attributes']=_['intersection'](_0x371ae4[_0xe6ed('0x3a')],qs[_0xe6ed('0x40')](_0x2c37e6['query'][_0xe6ed('0x40')]));_0x51a8f2[_0xe6ed('0x3e')]=_0x51a8f2['attributes'][_0xe6ed('0x41')]?_0x51a8f2[_0xe6ed('0x3e')]:_0x371ae4[_0xe6ed('0x3a')];if(_0x2c37e6['query'][_0xe6ed('0x48')]){_0x51a8f2[_0xe6ed('0x4d')]=[{'all':!![]}];}_0x51a8f2=_[_0xe6ed('0x4e')]({},_0x51a8f2,_0x2c37e6[_0xe6ed('0x47')]);return db[_0xe6ed('0x36')]['find'](_0x51a8f2)[_0xe6ed('0x23')](handleEntityNotFound(_0x14abef,null))['then'](function(_0x5c03c0){if(_0x5c03c0){var _0x49618a=_0x5c03c0['get']({'plain':!![]});_0x49618a=qs[_0xe6ed('0x59')](_0x49618a,['id',_0xe6ed('0x5a'),'updatedAt']);_0x2c37e6[_0xe6ed('0x50')]=_[_0xe6ed('0x59')](_0x2c37e6[_0xe6ed('0x50')],['id',_0xe6ed('0x5a'),_0xe6ed('0x5b')]);return db['VoiceQueue'][_0xe6ed('0x4f')](_['merge'](_0x49618a,_0x2c37e6[_0xe6ed('0x50')]),{'include':_0x2c37e6[_0xe6ed('0x3b')][_0xe6ed('0x48')]?[{'all':!![]}]:undefined})['then'](function(_0x2aa4da){var _0x441f4a=_0x2c37e6[_0xe6ed('0x51')][_0xe6ed('0x25')]({'plain':!![]});if(!_0x441f4a)throw new Error(_0xe6ed('0x52'));if(_0x441f4a['role']===_0xe6ed('0x51')){var _0x1f6452=_0x2aa4da['get']({'plain':!![]});var _0x4ac53a=[{'name':_0xe6ed('0x26'),'value':_0xe6ed('0x27')},{'name':_0xe6ed('0x28'),'value':_0xe6ed('0x29')}];var _0x3e20c3=_[_0xe6ed('0x5c')](_0x4ac53a,[_0xe6ed('0x2c'),_0x1f6452[_0xe6ed('0x2e')]])['name'];return db[_0xe6ed('0x54')][_0xe6ed('0x5c')]({'where':{'name':_0x3e20c3,'userProfileId':_0x441f4a['userProfileId']},'raw':!![]})['then'](function(_0x518ada){if(_0x518ada&&_0x518ada[_0xe6ed('0x56')]===0x0){return db[_0xe6ed('0x30')]['create']({'name':_0x1f6452[_0xe6ed('0x2f')],'resourceId':_0x1f6452['id'],'type':_0x518ada[_0xe6ed('0x2f')],'sectionId':_0x518ada['id']},{})[_0xe6ed('0x23')](function(){return _0x2aa4da;});}else{return _0x2aa4da;}})[_0xe6ed('0x4a')](function(_0x5d8875){logger['error'](_0xe6ed('0x57'),_0x5d8875);throw _0x5d8875;});}return _0x2aa4da;});}})[_0xe6ed('0x23')](respondWithResult(_0x14abef,0xc9))[_0xe6ed('0x4a')](handleError(_0x14abef,null));};exports['update']=function(_0x3d6692,_0x3d42b0){if(_0x3d6692[_0xe6ed('0x50')]['id']){delete _0x3d6692['body']['id'];}return db[_0xe6ed('0x36')][_0xe6ed('0x5c')]({'where':{'id':_0x3d6692[_0xe6ed('0x4c')]['id']}})['then'](handleEntityNotFound(_0x3d42b0,null))[_0xe6ed('0x23')](saveUpdates(_0x3d6692[_0xe6ed('0x50')],null))[_0xe6ed('0x23')](respondWithResult(_0x3d42b0,null))[_0xe6ed('0x4a')](handleError(_0x3d42b0,null));};exports[_0xe6ed('0x24')]=function(_0x2d7b83,_0x264221){return db['VoiceQueue'][_0xe6ed('0x5c')]({'where':{'id':_0x2d7b83['params']['id']}})[_0xe6ed('0x23')](handleEntityNotFound(_0x264221,null))[_0xe6ed('0x23')](removeEntity(_0x264221,null))['catch'](handleError(_0x264221,null));};exports[_0xe6ed('0x5d')]=function(_0x33f88a,_0x3eb65e,_0x1d94d0){var _0x3c6f70={'raw':![],'where':{}};var _0x2ffdf4={};var _0x19701f={'count':0x0,'rows':[]};return db[_0xe6ed('0x36')][_0xe6ed('0x5e')]({'where':{'id':_0x33f88a[_0xe6ed('0x4c')]['id']}})[_0xe6ed('0x23')](handleEntityNotFound(_0x3eb65e,null))[_0xe6ed('0x23')](function(_0x560519){if(_0x560519){_0x2ffdf4['model']=_[_0xe6ed('0x3c')](db[_0xe6ed('0x5f')][_0xe6ed('0x37')]);_0x2ffdf4['query']=_[_0xe6ed('0x3c')](_0x33f88a['query']);_0x2ffdf4[_0xe6ed('0x3d')]=_[_0xe6ed('0x3f')](_0x2ffdf4[_0xe6ed('0x3a')],_0x2ffdf4['query']);_0x3c6f70[_0xe6ed('0x3e')]=_[_0xe6ed('0x3f')](_0x2ffdf4[_0xe6ed('0x3a')],qs[_0xe6ed('0x40')](_0x33f88a[_0xe6ed('0x3b')][_0xe6ed('0x40')]));_0x3c6f70[_0xe6ed('0x3e')]=_0x3c6f70[_0xe6ed('0x3e')][_0xe6ed('0x41')]?_0x3c6f70[_0xe6ed('0x3e')]:_0x2ffdf4[_0xe6ed('0x3a')];if(!_0x33f88a[_0xe6ed('0x3b')][_0xe6ed('0x60')]('nolimit')){_0x3c6f70['limit']=qs['limit'](_0x33f88a[_0xe6ed('0x3b')]['limit']);_0x3c6f70['offset']=qs['offset'](_0x33f88a['query'][_0xe6ed('0x1d')]);}_0x3c6f70[_0xe6ed('0x43')]=qs['sort'](_0x33f88a['query'][_0xe6ed('0x61')]);_0x3c6f70[_0xe6ed('0x44')]=qs[_0xe6ed('0x3d')](_['pick'](_0x33f88a[_0xe6ed('0x3b')],_0x2ffdf4[_0xe6ed('0x3d')]));_0x3c6f70[_0xe6ed('0x44')][_0xe6ed('0x62')]=_0x560519['id'];if(_0x33f88a[_0xe6ed('0x3b')][_0xe6ed('0x46')]){_0x3c6f70[_0xe6ed('0x44')]=_[_0xe6ed('0x4e')](_0x3c6f70[_0xe6ed('0x44')],{'$or':_[_0xe6ed('0x2b')](_0x3c6f70['attributes'],function(_0x56e562){var _0x203c24={};_0x203c24[_0x56e562]={'$like':'%'+_0x33f88a[_0xe6ed('0x3b')]['filter']+'%'};return _0x203c24;})});}_0x3c6f70=_['merge']({},_0x3c6f70,_0x33f88a['options']);return db[_0xe6ed('0x5f')][_0xe6ed('0x1c')]({'where':_0x3c6f70[_0xe6ed('0x44')]})['then'](function(_0x345265){_0x19701f['count']=_0x345265;if(_0x33f88a[_0xe6ed('0x3b')][_0xe6ed('0x48')]){_0x3c6f70[_0xe6ed('0x4d')]=[{'all':!![]}];}return db[_0xe6ed('0x5f')][_0xe6ed('0x49')](_0x3c6f70);})[_0xe6ed('0x23')](function(_0x461e22){_0x19701f['rows']=_0x461e22;return _0x19701f;});}})['then'](respondWithFilteredResult(_0x3eb65e,_0x3c6f70))[_0xe6ed('0x4a')](handleError(_0x3eb65e,null));};exports['getHopperHistories']=function(_0x495c55,_0x3ea94d,_0x4bad77){var _0x43eabe={'raw':!![],'where':{}};var _0x4b4128={};var _0x2d8599={'count':0x0,'rows':[]};return db['VoiceQueue'][_0xe6ed('0x5e')]({'where':{'id':_0x495c55[_0xe6ed('0x4c')]['id']}})[_0xe6ed('0x23')](handleEntityNotFound(_0x3ea94d,null))[_0xe6ed('0x23')](function(_0x276768){if(_0x276768){_0x4b4128[_0xe6ed('0x3a')]=_['keys'](db['CmHopperHistory']['rawAttributes']);_0x4b4128[_0xe6ed('0x3b')]=_[_0xe6ed('0x3c')](_0x495c55[_0xe6ed('0x3b')]);_0x4b4128[_0xe6ed('0x3d')]=_['intersection'](_0x4b4128['model'],_0x4b4128[_0xe6ed('0x3b')]);_0x43eabe['attributes']=_[_0xe6ed('0x3f')](_0x4b4128['model'],qs[_0xe6ed('0x40')](_0x495c55[_0xe6ed('0x3b')][_0xe6ed('0x40')]));_0x43eabe['attributes']=_0x43eabe[_0xe6ed('0x3e')][_0xe6ed('0x41')]?_0x43eabe[_0xe6ed('0x3e')]:_0x4b4128['model'];if(!_0x495c55[_0xe6ed('0x3b')]['hasOwnProperty']('nolimit')){_0x43eabe[_0xe6ed('0x1e')]=qs[_0xe6ed('0x1e')](_0x495c55[_0xe6ed('0x3b')][_0xe6ed('0x1e')]);_0x43eabe['offset']=qs['offset'](_0x495c55[_0xe6ed('0x3b')]['offset']);}_0x43eabe[_0xe6ed('0x43')]=qs[_0xe6ed('0x61')](_0x495c55['query']['sort']);_0x43eabe['where']=qs[_0xe6ed('0x3d')](_[_0xe6ed('0x45')](_0x495c55[_0xe6ed('0x3b')],_0x4b4128[_0xe6ed('0x3d')]));_0x43eabe[_0xe6ed('0x44')][_0xe6ed('0x62')]=_0x276768['id'];if(_0x495c55[_0xe6ed('0x3b')][_0xe6ed('0x46')]){_0x43eabe['where']=_[_0xe6ed('0x4e')](_0x43eabe[_0xe6ed('0x44')],{'$or':_['map'](_0x43eabe['attributes'],function(_0x4fb0a0){var _0x588e62={};_0x588e62[_0x4fb0a0]={'$like':'%'+_0x495c55[_0xe6ed('0x3b')]['filter']+'%'};return _0x588e62;})});}_0x43eabe=_[_0xe6ed('0x4e')]({},_0x43eabe,_0x495c55['options']);return db[_0xe6ed('0x63')]['count']({'where':_0x43eabe[_0xe6ed('0x44')]})[_0xe6ed('0x23')](function(_0x421e53){_0x2d8599[_0xe6ed('0x1c')]=_0x421e53;if(_0x495c55[_0xe6ed('0x3b')][_0xe6ed('0x48')]){_0x43eabe['include']=[{'all':!![]}];}return db[_0xe6ed('0x63')]['findAll'](_0x43eabe);})[_0xe6ed('0x23')](function(_0x31529f){_0x2d8599[_0xe6ed('0x64')]=_0x31529f;return _0x2d8599;});}})[_0xe6ed('0x23')](respondWithFilteredResult(_0x3ea94d,_0x43eabe))[_0xe6ed('0x4a')](handleError(_0x3ea94d,null));};exports[_0xe6ed('0x65')]=function(_0x507296,_0x1504be,_0x3f1d12){var _0x403f33={'raw':!![],'where':{}};var _0x2641dc={};var _0x10c6c3={'count':0x0,'rows':[]};return db['VoiceQueue'][_0xe6ed('0x5e')]({'where':{'id':_0x507296['params']['id']}})[_0xe6ed('0x23')](handleEntityNotFound(_0x1504be,null))[_0xe6ed('0x23')](function(_0x3e3b78){if(_0x3e3b78){_0x2641dc[_0xe6ed('0x3a')]=_[_0xe6ed('0x3c')](db['CmHopperFinal'][_0xe6ed('0x37')]);_0x2641dc[_0xe6ed('0x3b')]=_[_0xe6ed('0x3c')](_0x507296[_0xe6ed('0x3b')]);_0x2641dc[_0xe6ed('0x3d')]=_[_0xe6ed('0x3f')](_0x2641dc['model'],_0x2641dc['query']);_0x403f33[_0xe6ed('0x3e')]=_[_0xe6ed('0x3f')](_0x2641dc[_0xe6ed('0x3a')],qs[_0xe6ed('0x40')](_0x507296[_0xe6ed('0x3b')][_0xe6ed('0x40')]));_0x403f33['attributes']=_0x403f33[_0xe6ed('0x3e')][_0xe6ed('0x41')]?_0x403f33[_0xe6ed('0x3e')]:_0x2641dc[_0xe6ed('0x3a')];if(!_0x507296[_0xe6ed('0x3b')][_0xe6ed('0x60')](_0xe6ed('0x42'))){_0x403f33[_0xe6ed('0x1e')]=qs['limit'](_0x507296[_0xe6ed('0x3b')][_0xe6ed('0x1e')]);_0x403f33[_0xe6ed('0x1d')]=qs['offset'](_0x507296[_0xe6ed('0x3b')][_0xe6ed('0x1d')]);}_0x403f33[_0xe6ed('0x43')]=qs['sort'](_0x507296['query']['sort']);_0x403f33[_0xe6ed('0x44')]=qs[_0xe6ed('0x3d')](_[_0xe6ed('0x45')](_0x507296[_0xe6ed('0x3b')],_0x2641dc[_0xe6ed('0x3d')]));_0x403f33[_0xe6ed('0x44')][_0xe6ed('0x62')]=_0x3e3b78['id'];if(_0x507296['query']['filter']){_0x403f33[_0xe6ed('0x44')]=_[_0xe6ed('0x4e')](_0x403f33[_0xe6ed('0x44')],{'$or':_[_0xe6ed('0x2b')](_0x403f33[_0xe6ed('0x3e')],function(_0x4de580){var _0x5b8f8f={};_0x5b8f8f[_0x4de580]={'$like':'%'+_0x507296['query'][_0xe6ed('0x46')]+'%'};return _0x5b8f8f;})});}_0x403f33=_[_0xe6ed('0x4e')]({},_0x403f33,_0x507296[_0xe6ed('0x47')]);return db[_0xe6ed('0x66')][_0xe6ed('0x1c')]({'where':_0x403f33[_0xe6ed('0x44')]})[_0xe6ed('0x23')](function(_0x1df8a0){_0x10c6c3[_0xe6ed('0x1c')]=_0x1df8a0;if(_0x507296[_0xe6ed('0x3b')][_0xe6ed('0x48')]){_0x403f33[_0xe6ed('0x4d')]=[{'all':!![]}];}return db[_0xe6ed('0x66')][_0xe6ed('0x49')](_0x403f33);})[_0xe6ed('0x23')](function(_0x41dd7c){_0x10c6c3[_0xe6ed('0x64')]=_0x41dd7c;return _0x10c6c3;});}})['then'](respondWithFilteredResult(_0x1504be,_0x403f33))[_0xe6ed('0x4a')](handleError(_0x1504be,null));};exports['getHopperBlacks']=function(_0x20f7c1,_0x521df3,_0x414881){var _0x26b84a={'raw':!![],'where':{}};var _0x4a465f={};var _0x31e5d9={'count':0x0,'rows':[]};return db[_0xe6ed('0x36')]['findOne']({'where':{'id':_0x20f7c1[_0xe6ed('0x4c')]['id']}})[_0xe6ed('0x23')](handleEntityNotFound(_0x521df3,null))[_0xe6ed('0x23')](function(_0x230c8c){if(_0x230c8c){_0x4a465f[_0xe6ed('0x3a')]=_['keys'](db[_0xe6ed('0x67')][_0xe6ed('0x37')]);_0x4a465f[_0xe6ed('0x3b')]=_[_0xe6ed('0x3c')](_0x20f7c1[_0xe6ed('0x3b')]);_0x4a465f[_0xe6ed('0x3d')]=_[_0xe6ed('0x3f')](_0x4a465f[_0xe6ed('0x3a')],_0x4a465f['query']);_0x26b84a[_0xe6ed('0x3e')]=_[_0xe6ed('0x3f')](_0x4a465f[_0xe6ed('0x3a')],qs[_0xe6ed('0x40')](_0x20f7c1['query'][_0xe6ed('0x40')]));_0x26b84a['attributes']=_0x26b84a[_0xe6ed('0x3e')]['length']?_0x26b84a['attributes']:_0x4a465f[_0xe6ed('0x3a')];if(!_0x20f7c1[_0xe6ed('0x3b')][_0xe6ed('0x60')](_0xe6ed('0x42'))){_0x26b84a['limit']=qs[_0xe6ed('0x1e')](_0x20f7c1[_0xe6ed('0x3b')][_0xe6ed('0x1e')]);_0x26b84a[_0xe6ed('0x1d')]=qs[_0xe6ed('0x1d')](_0x20f7c1[_0xe6ed('0x3b')][_0xe6ed('0x1d')]);}_0x26b84a['order']=qs[_0xe6ed('0x61')](_0x20f7c1['query'][_0xe6ed('0x61')]);_0x26b84a[_0xe6ed('0x44')]=qs[_0xe6ed('0x3d')](_[_0xe6ed('0x45')](_0x20f7c1[_0xe6ed('0x3b')],_0x4a465f[_0xe6ed('0x3d')]));_0x26b84a[_0xe6ed('0x44')][_0xe6ed('0x62')]=_0x230c8c['id'];if(_0x20f7c1[_0xe6ed('0x3b')][_0xe6ed('0x46')]){_0x26b84a[_0xe6ed('0x44')]=_[_0xe6ed('0x4e')](_0x26b84a[_0xe6ed('0x44')],{'$or':_['map'](_0x26b84a[_0xe6ed('0x3e')],function(_0x59c0b0){var _0x4e75c1={};_0x4e75c1[_0x59c0b0]={'$like':'%'+_0x20f7c1[_0xe6ed('0x3b')]['filter']+'%'};return _0x4e75c1;})});}_0x26b84a=_[_0xe6ed('0x4e')]({},_0x26b84a,_0x20f7c1['options']);return db[_0xe6ed('0x67')]['count']({'where':_0x26b84a['where']})['then'](function(_0x999bd9){_0x31e5d9['count']=_0x999bd9;if(_0x20f7c1['query'][_0xe6ed('0x48')]){_0x26b84a[_0xe6ed('0x4d')]=[{'all':!![]}];}return db[_0xe6ed('0x67')][_0xe6ed('0x49')](_0x26b84a);})[_0xe6ed('0x23')](function(_0x5f5695){_0x31e5d9['rows']=_0x5f5695;return _0x31e5d9;});}})[_0xe6ed('0x23')](respondWithFilteredResult(_0x521df3,_0x26b84a))['catch'](handleError(_0x521df3,null));};exports[_0xe6ed('0x68')]=function(_0x5b0e71,_0x5a3e3b,_0x152d57){var _0x3c2db0={};var _0x2ebfed={};var _0x4d073a;var _0x4ea7e5;return db[_0xe6ed('0x36')]['findOne']({'where':{'id':_0x5b0e71[_0xe6ed('0x4c')]['id']}})[_0xe6ed('0x23')](handleEntityNotFound(_0x5a3e3b,null))[_0xe6ed('0x23')](function(_0x3cc8e3){if(_0x3cc8e3){_0x4d073a=_0x3cc8e3;_0x2ebfed[_0xe6ed('0x3a')]=_['keys'](db[_0xe6ed('0x69')][_0xe6ed('0x37')]);_0x2ebfed[_0xe6ed('0x3b')]=_[_0xe6ed('0x3c')](_0x5b0e71['query']);_0x2ebfed['filters']=_[_0xe6ed('0x3f')](_0x2ebfed[_0xe6ed('0x3a')],_0x2ebfed[_0xe6ed('0x3b')]);_0x3c2db0[_0xe6ed('0x3e')]=_['intersection'](_0x2ebfed['model'],qs[_0xe6ed('0x40')](_0x5b0e71[_0xe6ed('0x3b')][_0xe6ed('0x40')]));_0x3c2db0[_0xe6ed('0x3e')]=_0x3c2db0['attributes'][_0xe6ed('0x41')]?_0x3c2db0[_0xe6ed('0x3e')]:_0x2ebfed[_0xe6ed('0x3a')];_0x3c2db0[_0xe6ed('0x43')]=qs['sort'](_0x5b0e71[_0xe6ed('0x3b')][_0xe6ed('0x61')]);_0x3c2db0[_0xe6ed('0x44')]=qs['filters'](_[_0xe6ed('0x45')](_0x5b0e71['query'],_0x2ebfed['filters']));if(_0x5b0e71[_0xe6ed('0x3b')][_0xe6ed('0x46')]){_0x3c2db0[_0xe6ed('0x44')]=_[_0xe6ed('0x4e')](_0x3c2db0[_0xe6ed('0x44')],{'$or':_['map'](_0x3c2db0[_0xe6ed('0x3e')],function(_0x5b7db8){var _0x3ea547={};_0x3ea547[_0x5b7db8]={'$like':'%'+_0x5b0e71['query'][_0xe6ed('0x46')]+'%'};return _0x3ea547;})});}_0x3c2db0=_['merge']({},_0x3c2db0,_0x5b0e71[_0xe6ed('0x47')]);return _0x4d073a[_0xe6ed('0x68')](_0x3c2db0);}})[_0xe6ed('0x23')](function(_0x111bc1){if(_0x111bc1){_0x4ea7e5=_0x111bc1['length'];if(!_0x5b0e71[_0xe6ed('0x3b')]['hasOwnProperty'](_0xe6ed('0x42'))){_0x3c2db0[_0xe6ed('0x1e')]=qs[_0xe6ed('0x1e')](_0x5b0e71[_0xe6ed('0x3b')]['limit']);_0x3c2db0[_0xe6ed('0x1d')]=qs[_0xe6ed('0x1d')](_0x5b0e71['query'][_0xe6ed('0x1d')]);}return _0x4d073a[_0xe6ed('0x68')](_0x3c2db0);}})['then'](function(_0x451ea1){if(_0x451ea1){return _0x451ea1?{'count':_0x4ea7e5,'rows':_0x451ea1}:null;}})['then'](respondWithResult(_0x5a3e3b,null))['catch'](handleError(_0x5a3e3b,null));};exports[_0xe6ed('0x6a')]=function(_0x1af203,_0x14927c,_0x4ff0ff){var _0x2fe553=_0x1af203[_0xe6ed('0x50')][_0xe6ed('0x6b')];var _0x358333=_[_0xe6ed('0x2b')](_0x2fe553,'id');return db['Team'][_0xe6ed('0x49')]({'where':{'id':_0x358333},'attributes':['id'],'include':[{'model':db['User'],'as':_0xe6ed('0x6c'),'attributes':['id',_0xe6ed('0x2f'),_0xe6ed('0x6d'),_0xe6ed('0x6e'),_0xe6ed('0x6f')],'raw':!![]}]})[_0xe6ed('0x23')](function(_0x14908c){if(_0x14908c){var _0x27513c=_[_0xe6ed('0x70')](_0x14908c,function(_0x3c0459){var _0x19fed1=_0x3c0459[_0xe6ed('0x25')]({'plain':!![]});_0x19fed1['Agents']['forEach'](function(_0x2efb4f){_0x2efb4f[_0xe6ed('0x71')]=_[_0xe6ed('0x5c')](_0x2fe553,{'id':_0x19fed1['id']})['penalty'];});return _0x19fed1[_0xe6ed('0x6c')];});return db[_0xe6ed('0x36')][_0xe6ed('0x5c')]({'where':{'id':_0x1af203['params']['id']}})[_0xe6ed('0x23')](function(_0x576786){return db[_0xe6ed('0x72')][_0xe6ed('0x73')](function(_0x3eeddc){return _0x576786[_0xe6ed('0x6a')](_0x358333,{'transaction':_0x3eeddc})[_0xe6ed('0x23')](function(){return BPromise[_0xe6ed('0x74')](_0x27513c,function(_0x22342c){return db[_0xe6ed('0x75')][_0xe6ed('0x76')]({'where':{'UserId':_0x22342c['id'],'VoiceQueueId':_0x1af203[_0xe6ed('0x4c')]['id']},'defaults':{'penalty':_0x22342c[_0xe6ed('0x71')]},'transaction':_0x3eeddc});});})[_0xe6ed('0x23')](function(){return BPromise[_0xe6ed('0x74')](_[_0xe6ed('0x46')](_0x27513c,{'online':!![]}),function(_0x155aa6){return db[_0xe6ed('0x77')]['upsert']({'membername':_0x155aa6[_0xe6ed('0x2f')],'UserId':_0x155aa6['id'],'queue_name':_0x576786['name'],'VoiceQueueId':_0x576786['id'],'interface':_[_0xe6ed('0x78')](_0x155aa6[_0xe6ed('0x6f')])?util[_0xe6ed('0x79')](_0xe6ed('0x7a'),_0x155aa6['name']):_0x155aa6['interface'],'paused':_0x155aa6[_0xe6ed('0x6e')]||![],'penalty':_0x155aa6['penalty']},{'transaction':_0x3eeddc});});})[_0xe6ed('0x23')](function(){_0x27513c['forEach'](function(_0xb2ebc3){socket[_0xe6ed('0x7b')](_0xe6ed('0x7c'),{'UserId':_0xb2ebc3['id'],'VoiceQueueId':_0x576786['id']});});});});});}})[_0xe6ed('0x23')](respondWithStatusCode(_0x14927c,null))['catch'](handleError(_0x14927c,null));};exports[_0xe6ed('0x7d')]=function(_0x45c8d5,_0x553c61,_0x482e8c){return db[_0xe6ed('0x69')][_0xe6ed('0x49')]({'where':{'id':_0x45c8d5['query'][_0xe6ed('0x7e')]},'attributes':['id'],'include':[{'model':db[_0xe6ed('0x7f')],'as':'Agents','attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x553c61,null))[_0xe6ed('0x23')](function(_0x31f266){var _0x3abfaa=_[_0xe6ed('0x2b')](_0x31f266,'id');var _0x4ed286=[];var _0x13fce1=[];var _0x49667=squel[_0xe6ed('0x80')]();_0x49667[_0xe6ed('0x81')]('tq.TeamId')[_0xe6ed('0x82')](_0xe6ed('0x83'),'tq')['join'](_0xe6ed('0x84'),'ut',_0xe6ed('0x85'))[_0xe6ed('0x44')]('VoiceQueueId\x20=\x20?',_0x45c8d5['params']['id']);for(var _0x1cd28f=0x0;_0x1cd28f<_0x31f266[_0xe6ed('0x41')];_0x1cd28f+=0x1){let _0x3995eb=_0x31f266[_0x1cd28f];for(var _0x207117=0x0;_0x207117<_0x3995eb['Agents'][_0xe6ed('0x41')];_0x207117+=0x1){let _0x333a31=_0x3995eb[_0xe6ed('0x6c')][_0x207117];var _0x56dbf1=_0x49667['clone']();_0x56dbf1[_0xe6ed('0x44')](_0xe6ed('0x86'),_0x333a31['id']);_0x13fce1['push'](db[_0xe6ed('0x72')][_0xe6ed('0x3b')](_0x56dbf1['toString'](),{'type':db[_0xe6ed('0x72')][_0xe6ed('0x87')]['SELECT']})[_0xe6ed('0x23')](function(_0x59f489){if(_0x59f489['length']===0x1){return _0x333a31['id'];}else{var _0x50924c=_[_0xe6ed('0x88')](_[_0xe6ed('0x2b')](_0x59f489,_0xe6ed('0x89')),function(_0x48cb0e){return _['includes'](_0x3abfaa,_0x48cb0e);});if(_0x50924c){return _0x333a31['id'];}}}));}}return BPromise[_0xe6ed('0x8a')](_0x13fce1)[_0xe6ed('0x23')](function(_0x4aeb7){_0x4ed286=_(_0x4ed286)[_0xe6ed('0x8b')](_0x4aeb7)['compact']()[_0xe6ed('0x2c')]();return db[_0xe6ed('0x36')]['find']({'where':{'id':_0x45c8d5[_0xe6ed('0x4c')]['id']}})[_0xe6ed('0x23')](function(_0x155a1f){return db['sequelize'][_0xe6ed('0x73')](function(_0x3abffe){return _0x155a1f[_0xe6ed('0x7d')](_0x45c8d5[_0xe6ed('0x3b')][_0xe6ed('0x7e')],{'transaction':_0x3abffe})[_0xe6ed('0x23')](function(){if(!_[_0xe6ed('0x8c')](_0x4ed286)){return _0x155a1f[_0xe6ed('0x8d')](_0x4ed286,{'transaction':_0x3abffe})['then'](function(){return db[_0xe6ed('0x77')][_0xe6ed('0x24')]({'where':{'VoiceQueueId':_0x45c8d5['params']['id'],'UserId':_0x4ed286},'transaction':_0x3abffe});});}})[_0xe6ed('0x23')](function(){_0x4ed286[_0xe6ed('0x8e')](function(_0x2690be){socket[_0xe6ed('0x7b')](_0xe6ed('0x8f'),{'UserId':_0x2690be,'VoiceQueueId':_0x155a1f['id']});});});});});});})[_0xe6ed('0x23')](respondWithStatusCode(_0x553c61,null))[_0xe6ed('0x4a')](handleError(_0x553c61,null));};exports[_0xe6ed('0x90')]=function(_0x2a91f3,_0x2a7e8f,_0x1d3e6f){var _0x26dca8,_0x32b362;return db[_0xe6ed('0x36')]['find']({'where':{'id':_0x2a91f3[_0xe6ed('0x4c')]['id']}})['then'](handleEntityNotFound(_0x2a7e8f,null))[_0xe6ed('0x23')](function(_0x22b2e4){if(_0x22b2e4){_0x32b362=_0x22b2e4;return _0x22b2e4['addAgents'](_0x2a91f3['body']['ids'],_['omit'](_0x2a91f3['body'],[_0xe6ed('0x7e'),'id'])||{})[_0xe6ed('0x91')](function(_0x3bd36f){for(var _0x33d75f=0x0;_0x33d75f<_0x2a91f3[_0xe6ed('0x50')]['ids'][_0xe6ed('0x41')];_0x33d75f+=0x1){socket[_0xe6ed('0x7b')]('userVoiceQueue:save',{'UserId':_0x2a91f3['body'][_0xe6ed('0x7e')][_0x33d75f],'VoiceQueueId':_0x2a91f3['params']['id']});}return _0x3bd36f;});}})['then'](function(_0x21f2c9){_0x26dca8=_0x21f2c9||[];if(_0x32b362){return db[_0xe6ed('0x7f')][_0xe6ed('0x49')]({'where':{'id':_0x2a91f3[_0xe6ed('0x50')][_0xe6ed('0x7e')]},'attributes':['id',_0xe6ed('0x2f'),_0xe6ed('0x6d'),'voicePause',_0xe6ed('0x6f')],'raw':!![]});}})[_0xe6ed('0x23')](function(_0x5d6a4e){if(!_[_0xe6ed('0x8c')](_0x5d6a4e)){var _0x444323=[];for(var _0x26ec35=0x0;_0x26ec35<_0x5d6a4e[_0xe6ed('0x41')];_0x26ec35++){if(_0x5d6a4e[_0x26ec35][_0xe6ed('0x6d')]){_0x444323[_0xe6ed('0x92')](db[_0xe6ed('0x77')][_0xe6ed('0x93')]({'membername':_0x5d6a4e[_0x26ec35]['name'],'UserId':_0x5d6a4e[_0x26ec35]['id'],'queue_name':_0x32b362[_0xe6ed('0x2f')],'VoiceQueueId':_0x32b362['id'],'interface':_[_0xe6ed('0x78')](_0x5d6a4e[_0x26ec35][_0xe6ed('0x6f')])?util[_0xe6ed('0x79')](_0xe6ed('0x7a'),_0x5d6a4e[_0x26ec35][_0xe6ed('0x2f')]):_0x5d6a4e[_0x26ec35]['interface'],'paused':_0x5d6a4e[_0x26ec35][_0xe6ed('0x6e')]||![],'penalty':_0x2a91f3[_0xe6ed('0x50')][_0xe6ed('0x71')]||0x0}));}}return BPromise[_0xe6ed('0x8a')](_0x444323);}})[_0xe6ed('0x23')](function(){return _0x26dca8;})[_0xe6ed('0x23')](respondWithResult(_0x2a7e8f,null))[_0xe6ed('0x4a')](handleError(_0x2a7e8f,null));};exports[_0xe6ed('0x8d')]=function(_0x64ccc8,_0x4ed684,_0x1acd0e){return db[_0xe6ed('0x36')]['find']({'where':{'id':_0x64ccc8[_0xe6ed('0x4c')]['id']}})[_0xe6ed('0x23')](handleEntityNotFound(_0x4ed684,null))[_0xe6ed('0x23')](function(_0xeec291){if(_0xeec291){return _0xeec291['removeAgents'](_0x64ccc8[_0xe6ed('0x3b')]['ids'])[_0xe6ed('0x23')](function(){if(_[_0xe6ed('0x94')](_0x64ccc8[_0xe6ed('0x3b')][_0xe6ed('0x7e')])){for(var _0x5bc64b=0x0;_0x5bc64b<_0x64ccc8[_0xe6ed('0x3b')][_0xe6ed('0x7e')][_0xe6ed('0x41')];_0x5bc64b+=0x1){socket[_0xe6ed('0x7b')](_0xe6ed('0x8f'),{'UserId':Number(_0x64ccc8[_0xe6ed('0x3b')][_0xe6ed('0x7e')][_0x5bc64b]),'VoiceQueueId':Number(_0x64ccc8[_0xe6ed('0x4c')]['id'])});}}else{socket['emit'](_0xe6ed('0x8f'),{'UserId':Number(_0x64ccc8['query']['ids']),'VoiceQueueId':Number(_0x64ccc8[_0xe6ed('0x4c')]['id'])});}});}})[_0xe6ed('0x23')](function(_0x15b982){return db['UserVoiceQueueRt'][_0xe6ed('0x24')]({'where':{'VoiceQueueId':_0x64ccc8['params']['id'],'UserId':_0x64ccc8[_0xe6ed('0x3b')][_0xe6ed('0x7e')]}})['then'](function(){return _0x15b982;});})[_0xe6ed('0x23')](respondWithStatusCode(_0x4ed684,null))['catch'](handleError(_0x4ed684,null));};exports[_0xe6ed('0x95')]=function(_0xe90058,_0x422514,_0x19c9c3){var _0x23f5d8={};var _0x17477a={};var _0x246594;var _0x8304ff;return db[_0xe6ed('0x36')][_0xe6ed('0x5e')]({'where':{'id':_0xe90058[_0xe6ed('0x4c')]['id']}})[_0xe6ed('0x23')](handleEntityNotFound(_0x422514,null))['then'](function(_0x51d868){if(_0x51d868){_0x246594=_0x51d868;_0x17477a[_0xe6ed('0x3a')]=_[_0xe6ed('0x3c')](db[_0xe6ed('0x7f')][_0xe6ed('0x37')]);_0x17477a[_0xe6ed('0x3b')]=_['keys'](_0xe90058[_0xe6ed('0x3b')]);_0x17477a[_0xe6ed('0x3d')]=_[_0xe6ed('0x3f')](_0x17477a[_0xe6ed('0x3a')],_0x17477a['query']);_0x23f5d8['attributes']=_[_0xe6ed('0x3f')](_0x17477a[_0xe6ed('0x3a')],qs[_0xe6ed('0x40')](_0xe90058[_0xe6ed('0x3b')][_0xe6ed('0x40')]));_0x23f5d8['attributes']=_0x23f5d8[_0xe6ed('0x3e')]['length']?_0x23f5d8['attributes']:_0x17477a['model'];_0x23f5d8['order']=qs['sort'](_0xe90058['query'][_0xe6ed('0x61')]);_0x23f5d8[_0xe6ed('0x44')]=qs['filters'](_[_0xe6ed('0x45')](_0xe90058[_0xe6ed('0x3b')],_0x17477a[_0xe6ed('0x3d')]));if(_0xe90058['query'][_0xe6ed('0x46')]){_0x23f5d8[_0xe6ed('0x44')]=_[_0xe6ed('0x4e')](_0x23f5d8[_0xe6ed('0x44')],{'$or':_[_0xe6ed('0x2b')](_0x23f5d8['attributes'],function(_0x253cd9){var _0x26e15d={};_0x26e15d[_0x253cd9]={'$like':'%'+_0xe90058[_0xe6ed('0x3b')]['filter']+'%'};return _0x26e15d;})});}_0x23f5d8=_['merge']({},_0x23f5d8,_0xe90058[_0xe6ed('0x47')]);return _0x246594['getAgents'](_0x23f5d8);}})[_0xe6ed('0x23')](function(_0x2ecd15){if(_0x2ecd15){_0x8304ff=_0x2ecd15[_0xe6ed('0x41')];if(!_0xe90058[_0xe6ed('0x3b')][_0xe6ed('0x60')](_0xe6ed('0x42'))){_0x23f5d8[_0xe6ed('0x1e')]=qs[_0xe6ed('0x1e')](_0xe90058[_0xe6ed('0x3b')]['limit']);_0x23f5d8[_0xe6ed('0x1d')]=qs['offset'](_0xe90058[_0xe6ed('0x3b')][_0xe6ed('0x1d')]);}return _0x246594[_0xe6ed('0x95')](_0x23f5d8);}})[_0xe6ed('0x23')](function(_0x1fd0ad){if(_0x1fd0ad){return _0x1fd0ad?{'count':_0x8304ff,'rows':_0x1fd0ad}:null;}})[_0xe6ed('0x23')](respondWithResult(_0x422514,null))[_0xe6ed('0x4a')](handleError(_0x422514,null));};exports[_0xe6ed('0x96')]=function(_0x29163f,_0x287593,_0x5c7936){var _0xff8039={};var _0x106497={};var _0x16ad62;var _0xd3cfe1;return db['VoiceQueue'][_0xe6ed('0x5e')]({'where':{'id':_0x29163f['params']['id']}})[_0xe6ed('0x23')](handleEntityNotFound(_0x287593,null))[_0xe6ed('0x23')](function(_0x42b6db){if(_0x42b6db){_0x16ad62=_0x42b6db;_0x106497[_0xe6ed('0x3a')]=_[_0xe6ed('0x3c')](db[_0xe6ed('0x77')][_0xe6ed('0x37')]);_0x106497[_0xe6ed('0x3b')]=_[_0xe6ed('0x3c')](_0x29163f[_0xe6ed('0x3b')]);_0x106497[_0xe6ed('0x3d')]=_['intersection'](_0x106497[_0xe6ed('0x3a')],_0x106497[_0xe6ed('0x3b')]);_0xff8039[_0xe6ed('0x3e')]=_['intersection'](_0x106497[_0xe6ed('0x3a')],qs[_0xe6ed('0x40')](_0x29163f[_0xe6ed('0x3b')]['fields']));_0xff8039['attributes']=_0xff8039[_0xe6ed('0x3e')][_0xe6ed('0x41')]?_0xff8039[_0xe6ed('0x3e')]:_0x106497[_0xe6ed('0x3a')];_0xff8039['order']=qs[_0xe6ed('0x61')](_0x29163f[_0xe6ed('0x3b')]['sort']);_0xff8039[_0xe6ed('0x44')]=qs['filters'](_[_0xe6ed('0x45')](_0x29163f[_0xe6ed('0x3b')],_0x106497[_0xe6ed('0x3d')]));if(_0x29163f[_0xe6ed('0x3b')][_0xe6ed('0x46')]){_0xff8039['where']=_['merge'](_0xff8039[_0xe6ed('0x44')],{'$or':_[_0xe6ed('0x2b')](_0xff8039['attributes'],function(_0x7ccb7c){var _0x363ff3={};_0x363ff3[_0x7ccb7c]={'$like':'%'+_0x29163f[_0xe6ed('0x3b')]['filter']+'%'};return _0x363ff3;})});}_0xff8039=_[_0xe6ed('0x4e')]({},_0xff8039,_0x29163f[_0xe6ed('0x47')]);return _0x16ad62[_0xe6ed('0x96')](_0xff8039);}})[_0xe6ed('0x23')](function(_0x3a3b9f){if(_0x3a3b9f){_0xd3cfe1=_0x3a3b9f[_0xe6ed('0x41')];if(!_0x29163f[_0xe6ed('0x3b')][_0xe6ed('0x60')](_0xe6ed('0x42'))){_0xff8039[_0xe6ed('0x1e')]=qs[_0xe6ed('0x1e')](_0x29163f[_0xe6ed('0x3b')][_0xe6ed('0x1e')]);_0xff8039[_0xe6ed('0x1d')]=qs['offset'](_0x29163f[_0xe6ed('0x3b')][_0xe6ed('0x1d')]);}return _0x16ad62['getMembers'](_0xff8039);}})[_0xe6ed('0x23')](function(_0x2b0095){return _0x2b0095?{'count':_0xd3cfe1,'rows':_0x2b0095}:null;})['then'](respondWithResult(_0x287593,null))['catch'](handleError(_0x287593,null));};exports[_0xe6ed('0x97')]=function(_0x349025,_0x316fdd,_0x487b54){var _0x9b596d={};var _0x3e4b36={};var _0x1820f0;var _0x4bec5d;return db[_0xe6ed('0x36')]['findOne']({'where':{'id':_0x349025[_0xe6ed('0x4c')]['id']}})[_0xe6ed('0x23')](handleEntityNotFound(_0x316fdd,null))[_0xe6ed('0x23')](function(_0xdd6bed){if(_0xdd6bed){_0x1820f0=_0xdd6bed;_0x3e4b36['model']=_[_0xe6ed('0x3c')](db[_0xe6ed('0x98')]['rawAttributes']);_0x3e4b36[_0xe6ed('0x3b')]=_['keys'](_0x349025[_0xe6ed('0x3b')]);_0x3e4b36['filters']=_[_0xe6ed('0x3f')](_0x3e4b36['model'],_0x3e4b36[_0xe6ed('0x3b')]);_0x9b596d[_0xe6ed('0x3e')]=_['intersection'](_0x3e4b36['model'],qs[_0xe6ed('0x40')](_0x349025['query'][_0xe6ed('0x40')]));_0x9b596d[_0xe6ed('0x3e')]=_0x9b596d[_0xe6ed('0x3e')][_0xe6ed('0x41')]?_0x9b596d[_0xe6ed('0x3e')]:_0x3e4b36[_0xe6ed('0x3a')];_0x9b596d['order']=qs[_0xe6ed('0x61')](_0x349025[_0xe6ed('0x3b')][_0xe6ed('0x61')]);_0x9b596d[_0xe6ed('0x44')]=qs['filters'](_['pick'](_0x349025['query'],_0x3e4b36[_0xe6ed('0x3d')]));if(_0x349025[_0xe6ed('0x3b')]['filter']){_0x9b596d[_0xe6ed('0x44')]=_[_0xe6ed('0x4e')](_0x9b596d['where'],{'$or':_[_0xe6ed('0x2b')](_0x9b596d[_0xe6ed('0x3e')],function(_0x4ec5b1){var _0x24648a={};_0x24648a[_0x4ec5b1]={'$like':'%'+_0x349025[_0xe6ed('0x3b')][_0xe6ed('0x46')]+'%'};return _0x24648a;})});}_0x9b596d=_[_0xe6ed('0x4e')]({},_0x9b596d,_0x349025[_0xe6ed('0x47')]);return _0x1820f0['getLists'](_0x9b596d);}})[_0xe6ed('0x23')](function(_0x2b6369){if(_0x2b6369){_0x4bec5d=_0x2b6369[_0xe6ed('0x41')];if(!_0x349025[_0xe6ed('0x3b')][_0xe6ed('0x60')](_0xe6ed('0x42'))){_0x9b596d['limit']=qs[_0xe6ed('0x1e')](_0x349025[_0xe6ed('0x3b')][_0xe6ed('0x1e')]);_0x9b596d[_0xe6ed('0x1d')]=qs['offset'](_0x349025[_0xe6ed('0x3b')][_0xe6ed('0x1d')]);}return _0x1820f0['getLists'](_0x9b596d);}})[_0xe6ed('0x23')](function(_0x1a818f){if(_0x1a818f){return _0x1a818f?{'count':_0x4bec5d,'rows':_0x1a818f}:null;}})[_0xe6ed('0x23')](respondWithResult(_0x316fdd,null))['catch'](handleError(_0x316fdd,null));};exports[_0xe6ed('0x99')]=function(_0x5f1399,_0x4c21f2,_0x3003ea){var _0x41fcfd,_0x21aa2d;return db['VoiceQueue']['find']({'where':{'id':_0x5f1399['params']['id']}})['then'](handleEntityNotFound(_0x4c21f2,null))['then'](function(_0x2edf1e){if(_0x2edf1e){_0x21aa2d=_0x2edf1e;return _0x2edf1e[_0xe6ed('0x99')](_0x5f1399[_0xe6ed('0x50')][_0xe6ed('0x7e')],_[_0xe6ed('0x59')](_0x5f1399['body'],[_0xe6ed('0x7e'),'id'])||{});}return null;})[_0xe6ed('0x91')](function(_0xcaf268){var _0x41dfc4;_0x41fcfd=_0xcaf268||[];var _0x4f586a=[];if(_0xcaf268){for(var _0x102ab8=0x0;_0x102ab8<_0xcaf268[_0xe6ed('0x41')];_0x102ab8+=0x1){var _0x616133=_0xcaf268[_0x102ab8][_0xe6ed('0x25')]({'plain':!![]});_0x21aa2d['dialCheckDuplicateType']=_0x5f1399['body'][_0xe6ed('0x9a')]?_0x5f1399['body'][_0xe6ed('0x9a')]:_0x21aa2d[_0xe6ed('0x9a')];switch(_0x21aa2d[_0xe6ed('0x9a')]){case _0xe6ed('0x9b'):_0x41dfc4=squel[_0xe6ed('0x9c')]()[_0xe6ed('0x9d')](_0xe6ed('0x9e'))['fromQuery']([_0xe6ed('0x9f'),_0xe6ed('0xa0'),_0xe6ed('0xa1'),_0xe6ed('0xa2'),'VoiceQueueId',_0xe6ed('0x5a'),_0xe6ed('0x5b')],squel[_0xe6ed('0x80')]()[_0xe6ed('0x81')](_0xe6ed('0x9f'),_0xe6ed('0x9f'))[_0xe6ed('0x81')](_0xe6ed('0xa3'),_0xe6ed('0xa0'))[_0xe6ed('0x81')]('id',_0xe6ed('0xa1'))[_0xe6ed('0x81')](_0x616133[_0xe6ed('0xa4')][_0xe6ed('0xa5')](),_0xe6ed('0xa2'))['field'](_0x5f1399[_0xe6ed('0x4c')]['id']['toString'](),_0xe6ed('0x62'))[_0xe6ed('0x81')](_0xe6ed('0xa3'),_0xe6ed('0x5a'))[_0xe6ed('0x81')]('NOW()',_0xe6ed('0x5b'))[_0xe6ed('0x82')](_0xe6ed('0xa6'))[_0xe6ed('0x44')](_0xe6ed('0xa7'))[_0xe6ed('0x44')]('ListId\x20=\x20?',_0x616133[_0xe6ed('0xa4')][_0xe6ed('0xa5')]())[_0xe6ed('0x44')](_0xe6ed('0xa8'))[_0xe6ed('0x44')](_0xe6ed('0xa9'),squel[_0xe6ed('0x80')]()[_0xe6ed('0x81')](_0xe6ed('0xaa'))['from'](_0xe6ed('0xab'))[_0xe6ed('0x44')]('VoiceQueueId\x20=\x20?',_0x5f1399[_0xe6ed('0x4c')]['id'][_0xe6ed('0xa5')]()))[_0xe6ed('0x44')]('phone\x20NOT\x20IN\x20(?)',squel[_0xe6ed('0x80')]()[_0xe6ed('0x81')](_0xe6ed('0xac'))[_0xe6ed('0x82')]('cm_hopper')['where']('VoiceQueueId\x20=\x20?',_0x5f1399[_0xe6ed('0x4c')]['id'][_0xe6ed('0xa5')]())))['toString']();break;case _0xe6ed('0xad'):_0x41dfc4=squel[_0xe6ed('0x9c')]()['into'](_0xe6ed('0x9e'))[_0xe6ed('0xae')]([_0xe6ed('0x9f'),_0xe6ed('0xa0'),_0xe6ed('0xa1'),_0xe6ed('0xa2'),_0xe6ed('0x62'),_0xe6ed('0x5a'),_0xe6ed('0x5b')],squel[_0xe6ed('0x80')]()[_0xe6ed('0x81')](_0xe6ed('0x9f'),_0xe6ed('0x9f'))[_0xe6ed('0x81')]('NOW()',_0xe6ed('0xa0'))[_0xe6ed('0x81')]('id',_0xe6ed('0xa1'))['field'](_0x616133[_0xe6ed('0xa4')]['toString'](),_0xe6ed('0xa2'))[_0xe6ed('0x81')](_0x5f1399[_0xe6ed('0x4c')]['id'][_0xe6ed('0xa5')](),_0xe6ed('0x62'))[_0xe6ed('0x81')](_0xe6ed('0xa3'),_0xe6ed('0x5a'))['field']('NOW()','updatedAt')[_0xe6ed('0x82')]('cm_contacts')[_0xe6ed('0x44')](_0xe6ed('0xa7'))['where'](_0xe6ed('0xaf'),_0x616133['CmListId']['toString']())[_0xe6ed('0x44')](_0xe6ed('0xa8'))[_0xe6ed('0x44')]('phone\x20NOT\x20IN\x20(?)',squel[_0xe6ed('0x80')]()['field'](_0xe6ed('0xac'))[_0xe6ed('0x82')]('cm_hopper')[_0xe6ed('0x44')](_0xe6ed('0xb0'),_0x5f1399['params']['id'][_0xe6ed('0xa5')]())))['toString']();break;default:_0x41dfc4=squel[_0xe6ed('0x9c')]()[_0xe6ed('0x9d')]('cm_hopper')[_0xe6ed('0xae')]([_0xe6ed('0x9f'),'scheduledAt',_0xe6ed('0xa1'),'ListId',_0xe6ed('0x62'),_0xe6ed('0x5a'),_0xe6ed('0x5b')],squel[_0xe6ed('0x80')]()['field'](_0xe6ed('0x9f'),_0xe6ed('0x9f'))[_0xe6ed('0x81')]('NOW()','scheduledAt')['field']('id','ContactId')[_0xe6ed('0x81')](_0x616133[_0xe6ed('0xa4')]['toString'](),_0xe6ed('0xa2'))[_0xe6ed('0x81')](_0x5f1399[_0xe6ed('0x4c')]['id'][_0xe6ed('0xa5')](),_0xe6ed('0x62'))['field'](_0xe6ed('0xa3'),_0xe6ed('0x5a'))[_0xe6ed('0x81')]('NOW()',_0xe6ed('0x5b'))[_0xe6ed('0x82')](_0xe6ed('0xa6'))['where'](_0xe6ed('0xa7'))[_0xe6ed('0x44')](_0xe6ed('0xaf'),_0x616133[_0xe6ed('0xa4')][_0xe6ed('0xa5')]())[_0xe6ed('0x44')]('phone\x20IS\x20NOT\x20NULL'))['toString']();}_0x4f586a[_0xe6ed('0x92')](db[_0xe6ed('0x72')][_0xe6ed('0x3b')](_0x41dfc4));}return BPromise[_0xe6ed('0x8a')](_0x4f586a);}})[_0xe6ed('0x23')](function(){return _0x41fcfd;})['then'](respondWithResult(_0x4c21f2,null))[_0xe6ed('0x4a')](handleError(_0x4c21f2,null));};exports[_0xe6ed('0xb1')]=function(_0x157374,_0xaeabea,_0x21b1c0){return db['VoiceQueue'][_0xe6ed('0x5c')]({'where':{'id':_0x157374[_0xe6ed('0x4c')]['id']}})[_0xe6ed('0x23')](handleEntityNotFound(_0xaeabea,null))[_0xe6ed('0x23')](function(_0x17d0a3){if(_0x17d0a3){return _0x17d0a3[_0xe6ed('0xb1')](_0x157374[_0xe6ed('0x3b')][_0xe6ed('0x7e')]);}})[_0xe6ed('0x23')](function(_0x21288c){if(_0x21288c){return db[_0xe6ed('0x5f')][_0xe6ed('0x24')]({'where':{'ListId':_0x157374[_0xe6ed('0x3b')][_0xe6ed('0x7e')],'VoiceQueueId':_0x157374[_0xe6ed('0x4c')]['id']}})[_0xe6ed('0x23')](function(){return _0x21288c;});}})['then'](respondWithStatusCode(_0xaeabea,null))[_0xe6ed('0x4a')](handleError(_0xaeabea,null));};exports[_0xe6ed('0xb2')]=function(_0x59d4f5,_0x596518,_0x50bb55){var _0x612062={};var _0x4a9a54={};var _0x9afa7c;var _0x119419;return db['VoiceQueue'][_0xe6ed('0x5e')]({'where':{'id':_0x59d4f5[_0xe6ed('0x4c')]['id']}})[_0xe6ed('0x23')](handleEntityNotFound(_0x596518,null))[_0xe6ed('0x23')](function(_0xe51e86){if(_0xe51e86){_0x9afa7c=_0xe51e86;_0x4a9a54[_0xe6ed('0x3a')]=_[_0xe6ed('0x3c')](db['CmList'][_0xe6ed('0x37')]);_0x4a9a54[_0xe6ed('0x3b')]=_[_0xe6ed('0x3c')](_0x59d4f5[_0xe6ed('0x3b')]);_0x4a9a54[_0xe6ed('0x3d')]=_[_0xe6ed('0x3f')](_0x4a9a54['model'],_0x4a9a54[_0xe6ed('0x3b')]);_0x612062[_0xe6ed('0x3e')]=_[_0xe6ed('0x3f')](_0x4a9a54[_0xe6ed('0x3a')],qs[_0xe6ed('0x40')](_0x59d4f5['query'][_0xe6ed('0x40')]));_0x612062['attributes']=_0x612062[_0xe6ed('0x3e')][_0xe6ed('0x41')]?_0x612062[_0xe6ed('0x3e')]:_0x4a9a54[_0xe6ed('0x3a')];_0x612062['order']=qs[_0xe6ed('0x61')](_0x59d4f5[_0xe6ed('0x3b')]['sort']);_0x612062[_0xe6ed('0x44')]=qs['filters'](_[_0xe6ed('0x45')](_0x59d4f5[_0xe6ed('0x3b')],_0x4a9a54[_0xe6ed('0x3d')]));if(_0x59d4f5['query'][_0xe6ed('0x46')]){_0x612062[_0xe6ed('0x44')]=_['merge'](_0x612062[_0xe6ed('0x44')],{'$or':_[_0xe6ed('0x2b')](_0x612062[_0xe6ed('0x3e')],function(_0x521e72){var _0x3a8a86={};_0x3a8a86[_0x521e72]={'$like':'%'+_0x59d4f5['query'][_0xe6ed('0x46')]+'%'};return _0x3a8a86;})});}_0x612062=_[_0xe6ed('0x4e')]({},_0x612062,_0x59d4f5[_0xe6ed('0x47')]);return _0x9afa7c[_0xe6ed('0xb2')](_0x612062);}})[_0xe6ed('0x23')](function(_0x2e14b6){if(_0x2e14b6){_0x119419=_0x2e14b6[_0xe6ed('0x41')];if(!_0x59d4f5[_0xe6ed('0x3b')][_0xe6ed('0x60')](_0xe6ed('0x42'))){_0x612062[_0xe6ed('0x1e')]=qs[_0xe6ed('0x1e')](_0x59d4f5[_0xe6ed('0x3b')][_0xe6ed('0x1e')]);_0x612062[_0xe6ed('0x1d')]=qs[_0xe6ed('0x1d')](_0x59d4f5[_0xe6ed('0x3b')]['offset']);}return _0x9afa7c['getBlackLists'](_0x612062);}})['then'](function(_0x13075a){if(_0x13075a){return _0x13075a?{'count':_0x119419,'rows':_0x13075a}:null;}})[_0xe6ed('0x23')](respondWithResult(_0x596518,null))['catch'](handleError(_0x596518,null));};exports['addBlackLists']=function(_0x28bcfe,_0x142142,_0x102f39){var _0x241544,_0x7e59ba;return db['VoiceQueue'][_0xe6ed('0x5c')]({'where':{'id':_0x28bcfe[_0xe6ed('0x4c')]['id']}})[_0xe6ed('0x23')](handleEntityNotFound(_0x142142,null))[_0xe6ed('0x23')](function(_0x18dc19){if(_0x18dc19){_0x7e59ba=_0x18dc19;return _0x18dc19[_0xe6ed('0xb3')](_0x28bcfe['body'][_0xe6ed('0x7e')],_[_0xe6ed('0x59')](_0x28bcfe[_0xe6ed('0x50')],[_0xe6ed('0x7e'),'id'])||{});}return null;})[_0xe6ed('0x91')](function(_0x118bf0){var _0x2f5c3f;_0x241544=_0x118bf0||[];var _0x518288=[];if(_0x118bf0){for(var _0x2d1455=0x0;_0x2d1455<_0x118bf0['length'];_0x2d1455+=0x1){var _0x4337f=_0x118bf0[_0x2d1455][_0xe6ed('0x25')]({'plain':!![]});_0x2f5c3f=squel['insert']()['into']('cm_hopper_black')['fromQuery'](['phone',_0xe6ed('0xa1'),'ListId',_0xe6ed('0x62'),_0xe6ed('0x5a'),_0xe6ed('0x5b')],squel[_0xe6ed('0x80')]()[_0xe6ed('0x81')]('phone',_0xe6ed('0x9f'))[_0xe6ed('0x81')]('id',_0xe6ed('0xa1'))[_0xe6ed('0x81')](_0x4337f[_0xe6ed('0xa4')]['toString'](),'ListId')[_0xe6ed('0x81')](_0x28bcfe[_0xe6ed('0x4c')]['id'][_0xe6ed('0xa5')](),_0xe6ed('0x62'))[_0xe6ed('0x81')](_0xe6ed('0xa3'),_0xe6ed('0x5a'))['field'](_0xe6ed('0xa3'),_0xe6ed('0x5b'))[_0xe6ed('0x82')]('cm_contacts')[_0xe6ed('0x44')](_0xe6ed('0xa7'))[_0xe6ed('0x44')](_0xe6ed('0xaf'),_0x4337f[_0xe6ed('0xa4')]['toString']())[_0xe6ed('0x44')](_0xe6ed('0xa8')))[_0xe6ed('0xa5')]();_0x518288[_0xe6ed('0x92')](db[_0xe6ed('0x72')]['query'](_0x2f5c3f));}return BPromise['all'](_0x518288);}})[_0xe6ed('0x23')](function(){return _0x241544;})['then'](respondWithResult(_0x142142,null))[_0xe6ed('0x4a')](handleError(_0x142142,null));};exports[_0xe6ed('0xb4')]=function(_0x3a7787,_0x174bd7,_0x114f6e){return db[_0xe6ed('0x36')][_0xe6ed('0x5c')]({'where':{'id':_0x3a7787['params']['id']}})[_0xe6ed('0x23')](handleEntityNotFound(_0x174bd7,null))['then'](function(_0x33b899){if(_0x33b899){return _0x33b899[_0xe6ed('0xb4')](_0x3a7787[_0xe6ed('0x3b')][_0xe6ed('0x7e')]);}})[_0xe6ed('0x23')](function(_0x2f6457){if(_0x2f6457){return db[_0xe6ed('0x67')]['destroy']({'where':{'ListId':_0x3a7787[_0xe6ed('0x3b')][_0xe6ed('0x7e')],'VoiceQueueId':_0x3a7787['params']['id']}})[_0xe6ed('0x23')](function(){return _0x2f6457;});}})[_0xe6ed('0x23')](respondWithStatusCode(_0x174bd7,null))[_0xe6ed('0x4a')](handleError(_0x174bd7,null));}; \ No newline at end of file +var _0x242d=['include','findAll','catch','params','rawAttributes','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','inbound','userProfileId','autoAssociation','clone','omit','createdAt','updatedAt','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getHoppers','findOne','CmHopper','VoiceQueueId','options','rows','order','CmHopperHistory','getHopperFinals','CmHopperFinal','CmHopperBlack','Team','getTeams','addTeams','teams','User','Agents','online','voicePause','flatMap','forEach','penalty','sequelize','transaction','UserVoiceQueue','findOrCreate','each','UserVoiceQueueRt','isNil','interface','SIP/%s','userVoiceQueue:save','removeTeams','ids','select','team_has_voice_queues','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','VoiceQueueId\x20=\x20?','ut.UserId\x20=\x20?','push','toString','QueryTypes','every','TeamId','all','union','compact','removeAgents','emit','userVoiceQueue:remove','addAgents','spread','isEmpty','isArray','getAgents','getMembers','getLists','addLists','dialCheckDuplicateType','always','insert','into','cm_hopper','fromQuery','phone','scheduledAt','ContactId','ListId','field','NOW()','CmListId','from','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','COALESCE(calleridnum,\x27\x27)','cm_hopper_final','COALESCE(phone,\x27\x27)','removeLists','getBlackLists','CmList','addBlackLists','cm_hopper_black','cm_contacts','removeBlackLists','html-pdf','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','util','path','to-csv','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../mysqldb','redis','defaults','./voiceQueue.socket','sendStatus','status','end','count','offset','limit','set','Content-Range','json','apply','save','update','then','destroy','get','VoiceQueues','QueueCampaigns','outbound','filter','ignore','map','value','includes','find','type','name','UserProfileResource','send','index','VoiceQueue','fieldName','keys','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','merge','VIRTUAL','includeAll'];(function(_0x52684f,_0xff73fc){var _0x4a55f0=function(_0x8ce37c){while(--_0x8ce37c){_0x52684f['push'](_0x52684f['shift']());}};_0x4a55f0(++_0xff73fc);}(_0x242d,0x11e));var _0xd242=function(_0x37bb3e,_0x295424){_0x37bb3e=_0x37bb3e-0x0;var _0x5331d2=_0x242d[_0x37bb3e];return _0x5331d2;};'use strict';var pdf=require(_0xd242('0x0'));var emlformat=require(_0xd242('0x1'));var rimraf=require(_0xd242('0x2'));var zipdir=require(_0xd242('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0xd242('0x4'));var moment=require('moment');var BPromise=require(_0xd242('0x5'));var Mustache=require(_0xd242('0x6'));var util=require(_0xd242('0x7'));var path=require(_0xd242('0x8'));var sox=require('sox');var csv=require(_0xd242('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xd242('0xa'));var squel=require(_0xd242('0xb'));var crypto=require(_0xd242('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xd242('0xd'));var toCsv=require('to-csv');var querystring=require(_0xd242('0xe'));var Papa=require(_0xd242('0xf'));var Redis=require(_0xd242('0x10'));var authService=require(_0xd242('0x11'));var qs=require(_0xd242('0x12'));var as=require(_0xd242('0x13'));var hardwareService=require(_0xd242('0x14'));var logger=require(_0xd242('0x15'))('api');var utils=require('../../config/utils');var config=require(_0xd242('0x16'));var db=require(_0xd242('0x17'))['db'];config[_0xd242('0x18')]=_[_0xd242('0x19')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xd242('0x18')]));require(_0xd242('0x1a'))['register'](socket);function respondWithStatusCode(_0x515de4,_0x5ca96b){_0x5ca96b=_0x5ca96b||0xcc;return function(_0xc85a12){if(_0xc85a12){return _0x515de4[_0xd242('0x1b')](_0x5ca96b);}return _0x515de4[_0xd242('0x1c')](_0x5ca96b)[_0xd242('0x1d')]();};}function respondWithResult(_0x4df330,_0x50a39d){_0x50a39d=_0x50a39d||0xc8;return function(_0x183082){if(_0x183082){return _0x4df330[_0xd242('0x1c')](_0x50a39d)['json'](_0x183082);}};}function respondWithFilteredResult(_0x470d3e,_0xeddf9c){return function(_0x1496c7){if(_0x1496c7){var _0x585ce7=_0x1496c7[_0xd242('0x1e')],_0x3112a6=_0xeddf9c[_0xd242('0x1f')],_0x552a76=_0xeddf9c[_0xd242('0x1f')]+_0xeddf9c[_0xd242('0x20')],_0x2c56e6;if(_0x552a76>=_0x585ce7){_0x552a76=_0x585ce7;_0x2c56e6=0xc8;}else{_0x2c56e6=0xce;}_0x470d3e[_0xd242('0x1c')](_0x2c56e6);return _0x470d3e[_0xd242('0x21')](_0xd242('0x22'),_0x3112a6+'-'+_0x552a76+'/'+_0x585ce7)[_0xd242('0x23')](_0x1496c7);}return null;};}function patchUpdates(_0x33738b){return function(_0xea24a8){try{jsonpatch[_0xd242('0x24')](_0xea24a8,_0x33738b,!![]);}catch(_0x316a05){return BPromise['reject'](_0x316a05);}return _0xea24a8[_0xd242('0x25')]();};}function saveUpdates(_0x4c4828,_0x38d9f5){return function(_0x4210b8){if(_0x4210b8){return _0x4210b8[_0xd242('0x26')](_0x4c4828)[_0xd242('0x27')](function(_0x270457){return _0x270457;});}return null;};}function removeEntity(_0x4f2052,_0x3a2d37){return function(_0x209e66){if(_0x209e66){return _0x209e66[_0xd242('0x28')]()[_0xd242('0x27')](function(){var _0x4b957d=_0x209e66[_0xd242('0x29')]({'plain':!![]});var _0x2f1920=[{'name':_0xd242('0x2a'),'value':'inbound','ignore':![]},{'name':_0xd242('0x2b'),'value':_0xd242('0x2c'),'ignore':![]}];var _0x412383=_(_0x2f1920)[_0xd242('0x2d')](_0xd242('0x2e'))[_0xd242('0x2f')](_0xd242('0x30'))[_0xd242('0x30')]();if(_[_0xd242('0x31')](_0x412383,_0x4b957d['type'])){return;}var _0x180065=_[_0xd242('0x32')](_0x2f1920,[_0xd242('0x30'),_0x4b957d[_0xd242('0x33')]])[_0xd242('0x34')];return db[_0xd242('0x35')]['destroy']({'where':{'type':_0x180065,'resourceId':_0x4b957d['id']}})['then'](function(){return _0x209e66;});})['then'](function(){_0x4f2052[_0xd242('0x1c')](0xcc)[_0xd242('0x1d')]();});}};}function handleEntityNotFound(_0x43f733,_0x5276fe){return function(_0x45576c){if(!_0x45576c){_0x43f733[_0xd242('0x1b')](0x194);}return _0x45576c;};}function handleError(_0x3881aa,_0x112867){_0x112867=_0x112867||0x1f4;return function(_0x5b922f){logger['error'](_0x5b922f['stack']);if(_0x5b922f[_0xd242('0x34')]){delete _0x5b922f[_0xd242('0x34')];}_0x3881aa[_0xd242('0x1c')](_0x112867)[_0xd242('0x36')](_0x5b922f);};}exports[_0xd242('0x37')]=function(_0x47ea9f,_0x279699){var _0x49cee8={},_0x92af8f={},_0x28783f={'count':0x0,'rows':[]};var _0x42f7bb=_['map'](db[_0xd242('0x38')]['rawAttributes'],function(_0x2dd862){return{'name':_0x2dd862[_0xd242('0x39')],'type':_0x2dd862['type']['key']};});_0x92af8f['model']=_[_0xd242('0x2f')](_0x42f7bb,_0xd242('0x34'));_0x92af8f['query']=_[_0xd242('0x3a')](_0x47ea9f[_0xd242('0x3b')]);_0x92af8f[_0xd242('0x3c')]=_[_0xd242('0x3d')](_0x92af8f[_0xd242('0x3e')],_0x92af8f[_0xd242('0x3b')]);_0x49cee8[_0xd242('0x3f')]=_[_0xd242('0x3d')](_0x92af8f['model'],qs[_0xd242('0x40')](_0x47ea9f['query']['fields']));_0x49cee8[_0xd242('0x3f')]=_0x49cee8[_0xd242('0x3f')][_0xd242('0x41')]?_0x49cee8[_0xd242('0x3f')]:_0x92af8f[_0xd242('0x3e')];if(!_0x47ea9f[_0xd242('0x3b')][_0xd242('0x42')](_0xd242('0x43'))){_0x49cee8[_0xd242('0x20')]=qs[_0xd242('0x20')](_0x47ea9f[_0xd242('0x3b')][_0xd242('0x20')]);_0x49cee8['offset']=qs['offset'](_0x47ea9f[_0xd242('0x3b')][_0xd242('0x1f')]);}_0x49cee8['order']=qs['sort'](_0x47ea9f[_0xd242('0x3b')][_0xd242('0x44')]);_0x49cee8[_0xd242('0x45')]=qs[_0xd242('0x3c')](_[_0xd242('0x46')](_0x47ea9f[_0xd242('0x3b')],_0x92af8f['filters']),_0x42f7bb);if(_0x47ea9f[_0xd242('0x3b')]['filter']){_0x49cee8[_0xd242('0x45')]=_[_0xd242('0x47')](_0x49cee8[_0xd242('0x45')],{'$or':_[_0xd242('0x2f')](_0x42f7bb,function(_0x7e621e){if(_0x7e621e[_0xd242('0x33')]!==_0xd242('0x48')){var _0x2352ae={};_0x2352ae[_0x7e621e[_0xd242('0x34')]]={'$like':'%'+_0x47ea9f[_0xd242('0x3b')][_0xd242('0x2d')]+'%'};return _0x2352ae;}})});}_0x49cee8=_[_0xd242('0x47')]({},_0x49cee8,_0x47ea9f['options']);var _0x2c247c={'where':_0x49cee8[_0xd242('0x45')]};return db[_0xd242('0x38')][_0xd242('0x1e')](_0x2c247c)[_0xd242('0x27')](function(_0x4590ef){_0x28783f['count']=_0x4590ef;if(_0x47ea9f[_0xd242('0x3b')][_0xd242('0x49')]){_0x49cee8[_0xd242('0x4a')]=[{'all':!![]}];}return db[_0xd242('0x38')][_0xd242('0x4b')](_0x49cee8);})[_0xd242('0x27')](function(_0xede711){_0x28783f['rows']=_0xede711;return _0x28783f;})['then'](respondWithFilteredResult(_0x279699,_0x49cee8))[_0xd242('0x4c')](handleError(_0x279699,null));};exports['show']=function(_0x427278,_0x149420){var _0x20c01a={'raw':![],'where':{'id':_0x427278[_0xd242('0x4d')]['id']}},_0x149967={};_0x149967[_0xd242('0x3e')]=_['keys'](db[_0xd242('0x38')][_0xd242('0x4e')]);_0x149967[_0xd242('0x3b')]=_[_0xd242('0x3a')](_0x427278[_0xd242('0x3b')]);_0x149967[_0xd242('0x3c')]=_[_0xd242('0x3d')](_0x149967[_0xd242('0x3e')],_0x149967['query']);_0x20c01a['attributes']=_[_0xd242('0x3d')](_0x149967['model'],qs['fields'](_0x427278['query'][_0xd242('0x40')]));_0x20c01a[_0xd242('0x3f')]=_0x20c01a[_0xd242('0x3f')][_0xd242('0x41')]?_0x20c01a[_0xd242('0x3f')]:_0x149967[_0xd242('0x3e')];if(_0x427278[_0xd242('0x3b')][_0xd242('0x49')]){_0x20c01a['include']=[{'all':!![]}];}_0x20c01a=_[_0xd242('0x47')]({},_0x20c01a,_0x427278['options']);return db[_0xd242('0x38')][_0xd242('0x32')](_0x20c01a)['then'](handleEntityNotFound(_0x149420,null))['then'](respondWithResult(_0x149420,null))[_0xd242('0x4c')](handleError(_0x149420,null));};exports[_0xd242('0x4f')]=function(_0x2d1cb0,_0x1d04e0){return db[_0xd242('0x38')]['create'](_0x2d1cb0[_0xd242('0x50')],{})[_0xd242('0x27')](function(_0x192f03){var _0x595be8=_0x2d1cb0[_0xd242('0x51')][_0xd242('0x29')]({'plain':!![]});if(!_0x595be8)throw new Error(_0xd242('0x52'));if(_0x595be8[_0xd242('0x53')]===_0xd242('0x51')){var _0x3bbafd=_0x192f03['get']({'plain':!![]});var _0x1f95a6=[{'name':_0xd242('0x2a'),'value':_0xd242('0x54')},{'name':_0xd242('0x2b'),'value':_0xd242('0x2c')}];var _0x1a4982=_[_0xd242('0x32')](_0x1f95a6,[_0xd242('0x30'),_0x3bbafd[_0xd242('0x33')]])['name'];return db['UserProfileSection']['find']({'where':{'name':_0x1a4982,'userProfileId':_0x595be8[_0xd242('0x55')]},'raw':!![]})[_0xd242('0x27')](function(_0x536285){if(_0x536285&&_0x536285[_0xd242('0x56')]===0x0){return db[_0xd242('0x35')]['create']({'name':_0x3bbafd[_0xd242('0x34')],'resourceId':_0x3bbafd['id'],'type':_0x536285['name'],'sectionId':_0x536285['id']},{})[_0xd242('0x27')](function(){return _0x192f03;});}else{return _0x192f03;}})[_0xd242('0x4c')](function(_0x10583a){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x10583a);throw _0x10583a;});}return _0x192f03;})[_0xd242('0x27')](respondWithResult(_0x1d04e0,0xc9))[_0xd242('0x4c')](handleError(_0x1d04e0,null));};exports[_0xd242('0x57')]=function(_0x2df019,_0x49020b){var _0x4c08e6={'where':{'id':_0x2df019[_0xd242('0x4d')]['id']}},_0x14147e={};_0x14147e[_0xd242('0x3e')]=_[_0xd242('0x3a')](db[_0xd242('0x38')][_0xd242('0x4e')]);_0x4c08e6[_0xd242('0x3f')]=_[_0xd242('0x3d')](_0x14147e[_0xd242('0x3e')],qs['fields'](_0x2df019['query'][_0xd242('0x40')]));_0x4c08e6['attributes']=_0x4c08e6['attributes'][_0xd242('0x41')]?_0x4c08e6['attributes']:_0x14147e[_0xd242('0x3e')];if(_0x2df019[_0xd242('0x3b')][_0xd242('0x49')]){_0x4c08e6[_0xd242('0x4a')]=[{'all':!![]}];}_0x4c08e6=_['merge']({},_0x4c08e6,_0x2df019['options']);return db['VoiceQueue'][_0xd242('0x32')](_0x4c08e6)[_0xd242('0x27')](handleEntityNotFound(_0x49020b,null))[_0xd242('0x27')](function(_0x24338a){if(_0x24338a){var _0xccf050=_0x24338a[_0xd242('0x29')]({'plain':!![]});_0xccf050=qs[_0xd242('0x58')](_0xccf050,['id',_0xd242('0x59'),'updatedAt']);_0x2df019[_0xd242('0x50')]=_['omit'](_0x2df019[_0xd242('0x50')],['id',_0xd242('0x59'),_0xd242('0x5a')]);return db['VoiceQueue'][_0xd242('0x4f')](_[_0xd242('0x47')](_0xccf050,_0x2df019[_0xd242('0x50')]),{'include':_0x2df019[_0xd242('0x3b')]['includeAll']?[{'all':!![]}]:undefined})[_0xd242('0x27')](function(_0x5604c3){var _0x255420=_0x2df019[_0xd242('0x51')][_0xd242('0x29')]({'plain':!![]});if(!_0x255420)throw new Error(_0xd242('0x52'));if(_0x255420[_0xd242('0x53')]==='user'){var _0x3dd3ab=_0x5604c3['get']({'plain':!![]});var _0x4b18c=[{'name':_0xd242('0x2a'),'value':_0xd242('0x54')},{'name':_0xd242('0x2b'),'value':_0xd242('0x2c')}];var _0x3c0d94=_[_0xd242('0x32')](_0x4b18c,[_0xd242('0x30'),_0x3dd3ab[_0xd242('0x33')]])[_0xd242('0x34')];return db['UserProfileSection']['find']({'where':{'name':_0x3c0d94,'userProfileId':_0x255420[_0xd242('0x55')]},'raw':!![]})[_0xd242('0x27')](function(_0x4116ed){if(_0x4116ed&&_0x4116ed[_0xd242('0x56')]===0x0){return db[_0xd242('0x35')]['create']({'name':_0x3dd3ab['name'],'resourceId':_0x3dd3ab['id'],'type':_0x4116ed['name'],'sectionId':_0x4116ed['id']},{})[_0xd242('0x27')](function(){return _0x5604c3;});}else{return _0x5604c3;}})[_0xd242('0x4c')](function(_0x34367f){logger[_0xd242('0x5b')](_0xd242('0x5c'),_0x34367f);throw _0x34367f;});}return _0x5604c3;});}})[_0xd242('0x27')](respondWithResult(_0x49020b,0xc9))['catch'](handleError(_0x49020b,null));};exports[_0xd242('0x26')]=function(_0x56a2c6,_0x202b80){if(_0x56a2c6['body']['id']){delete _0x56a2c6[_0xd242('0x50')]['id'];}return db['VoiceQueue']['find']({'where':{'id':_0x56a2c6[_0xd242('0x4d')]['id']}})[_0xd242('0x27')](handleEntityNotFound(_0x202b80,null))[_0xd242('0x27')](saveUpdates(_0x56a2c6[_0xd242('0x50')],null))[_0xd242('0x27')](respondWithResult(_0x202b80,null))[_0xd242('0x4c')](handleError(_0x202b80,null));};exports[_0xd242('0x28')]=function(_0x3ffc82,_0x8b8ff9){return db[_0xd242('0x38')]['find']({'where':{'id':_0x3ffc82[_0xd242('0x4d')]['id']}})[_0xd242('0x27')](handleEntityNotFound(_0x8b8ff9,null))[_0xd242('0x27')](removeEntity(_0x8b8ff9,null))[_0xd242('0x4c')](handleError(_0x8b8ff9,null));};exports[_0xd242('0x5d')]=function(_0x53fb21,_0x57b5be,_0x3c4e54){var _0xe0b9b5={'raw':![],'where':{}};var _0x1d9939={};var _0x404c8e={'count':0x0,'rows':[]};return db['VoiceQueue'][_0xd242('0x5e')]({'where':{'id':_0x53fb21[_0xd242('0x4d')]['id']}})[_0xd242('0x27')](handleEntityNotFound(_0x57b5be,null))['then'](function(_0xc8f749){if(_0xc8f749){_0x1d9939[_0xd242('0x3e')]=_['keys'](db[_0xd242('0x5f')][_0xd242('0x4e')]);_0x1d9939['query']=_[_0xd242('0x3a')](_0x53fb21[_0xd242('0x3b')]);_0x1d9939['filters']=_[_0xd242('0x3d')](_0x1d9939[_0xd242('0x3e')],_0x1d9939['query']);_0xe0b9b5['attributes']=_[_0xd242('0x3d')](_0x1d9939['model'],qs[_0xd242('0x40')](_0x53fb21[_0xd242('0x3b')][_0xd242('0x40')]));_0xe0b9b5[_0xd242('0x3f')]=_0xe0b9b5['attributes'][_0xd242('0x41')]?_0xe0b9b5[_0xd242('0x3f')]:_0x1d9939[_0xd242('0x3e')];if(!_0x53fb21[_0xd242('0x3b')][_0xd242('0x42')]('nolimit')){_0xe0b9b5['limit']=qs[_0xd242('0x20')](_0x53fb21[_0xd242('0x3b')][_0xd242('0x20')]);_0xe0b9b5[_0xd242('0x1f')]=qs[_0xd242('0x1f')](_0x53fb21[_0xd242('0x3b')][_0xd242('0x1f')]);}_0xe0b9b5['order']=qs[_0xd242('0x44')](_0x53fb21['query'][_0xd242('0x44')]);_0xe0b9b5[_0xd242('0x45')]=qs['filters'](_[_0xd242('0x46')](_0x53fb21['query'],_0x1d9939['filters']));_0xe0b9b5[_0xd242('0x45')][_0xd242('0x60')]=_0xc8f749['id'];if(_0x53fb21[_0xd242('0x3b')][_0xd242('0x2d')]){_0xe0b9b5[_0xd242('0x45')]=_[_0xd242('0x47')](_0xe0b9b5['where'],{'$or':_[_0xd242('0x2f')](_0xe0b9b5[_0xd242('0x3f')],function(_0x3e0d22){var _0x589c2a={};_0x589c2a[_0x3e0d22]={'$like':'%'+_0x53fb21[_0xd242('0x3b')]['filter']+'%'};return _0x589c2a;})});}_0xe0b9b5=_[_0xd242('0x47')]({},_0xe0b9b5,_0x53fb21[_0xd242('0x61')]);return db[_0xd242('0x5f')][_0xd242('0x1e')]({'where':_0xe0b9b5[_0xd242('0x45')]})[_0xd242('0x27')](function(_0x49de0d){_0x404c8e[_0xd242('0x1e')]=_0x49de0d;if(_0x53fb21[_0xd242('0x3b')][_0xd242('0x49')]){_0xe0b9b5[_0xd242('0x4a')]=[{'all':!![]}];}return db[_0xd242('0x5f')]['findAll'](_0xe0b9b5);})[_0xd242('0x27')](function(_0x3b8b74){_0x404c8e[_0xd242('0x62')]=_0x3b8b74;return _0x404c8e;});}})[_0xd242('0x27')](respondWithFilteredResult(_0x57b5be,_0xe0b9b5))[_0xd242('0x4c')](handleError(_0x57b5be,null));};exports['getHopperHistories']=function(_0x2c1590,_0xfe4dc,_0x466158){var _0x381541={'raw':!![],'where':{}};var _0x54035f={};var _0xa9ee8f={'count':0x0,'rows':[]};return db[_0xd242('0x38')]['findOne']({'where':{'id':_0x2c1590['params']['id']}})[_0xd242('0x27')](handleEntityNotFound(_0xfe4dc,null))[_0xd242('0x27')](function(_0x2a5726){if(_0x2a5726){_0x54035f['model']=_[_0xd242('0x3a')](db['CmHopperHistory']['rawAttributes']);_0x54035f[_0xd242('0x3b')]=_['keys'](_0x2c1590[_0xd242('0x3b')]);_0x54035f[_0xd242('0x3c')]=_[_0xd242('0x3d')](_0x54035f[_0xd242('0x3e')],_0x54035f[_0xd242('0x3b')]);_0x381541['attributes']=_['intersection'](_0x54035f[_0xd242('0x3e')],qs[_0xd242('0x40')](_0x2c1590[_0xd242('0x3b')][_0xd242('0x40')]));_0x381541[_0xd242('0x3f')]=_0x381541[_0xd242('0x3f')]['length']?_0x381541[_0xd242('0x3f')]:_0x54035f[_0xd242('0x3e')];if(!_0x2c1590[_0xd242('0x3b')]['hasOwnProperty'](_0xd242('0x43'))){_0x381541['limit']=qs[_0xd242('0x20')](_0x2c1590[_0xd242('0x3b')][_0xd242('0x20')]);_0x381541[_0xd242('0x1f')]=qs[_0xd242('0x1f')](_0x2c1590[_0xd242('0x3b')][_0xd242('0x1f')]);}_0x381541[_0xd242('0x63')]=qs[_0xd242('0x44')](_0x2c1590[_0xd242('0x3b')][_0xd242('0x44')]);_0x381541[_0xd242('0x45')]=qs[_0xd242('0x3c')](_[_0xd242('0x46')](_0x2c1590[_0xd242('0x3b')],_0x54035f[_0xd242('0x3c')]));_0x381541[_0xd242('0x45')]['VoiceQueueId']=_0x2a5726['id'];if(_0x2c1590['query']['filter']){_0x381541['where']=_['merge'](_0x381541[_0xd242('0x45')],{'$or':_[_0xd242('0x2f')](_0x381541[_0xd242('0x3f')],function(_0xefebb1){var _0x8b5468={};_0x8b5468[_0xefebb1]={'$like':'%'+_0x2c1590[_0xd242('0x3b')][_0xd242('0x2d')]+'%'};return _0x8b5468;})});}_0x381541=_[_0xd242('0x47')]({},_0x381541,_0x2c1590[_0xd242('0x61')]);return db[_0xd242('0x64')][_0xd242('0x1e')]({'where':_0x381541[_0xd242('0x45')]})[_0xd242('0x27')](function(_0x141914){_0xa9ee8f[_0xd242('0x1e')]=_0x141914;if(_0x2c1590[_0xd242('0x3b')][_0xd242('0x49')]){_0x381541[_0xd242('0x4a')]=[{'all':!![]}];}return db['CmHopperHistory'][_0xd242('0x4b')](_0x381541);})[_0xd242('0x27')](function(_0x49e845){_0xa9ee8f[_0xd242('0x62')]=_0x49e845;return _0xa9ee8f;});}})[_0xd242('0x27')](respondWithFilteredResult(_0xfe4dc,_0x381541))[_0xd242('0x4c')](handleError(_0xfe4dc,null));};exports[_0xd242('0x65')]=function(_0x290a52,_0x16fc73,_0x43b06f){var _0x11518a={'raw':!![],'where':{}};var _0x5a7273={};var _0x12ed5b={'count':0x0,'rows':[]};return db[_0xd242('0x38')][_0xd242('0x5e')]({'where':{'id':_0x290a52['params']['id']}})['then'](handleEntityNotFound(_0x16fc73,null))[_0xd242('0x27')](function(_0x3ca86c){if(_0x3ca86c){_0x5a7273[_0xd242('0x3e')]=_[_0xd242('0x3a')](db[_0xd242('0x66')][_0xd242('0x4e')]);_0x5a7273[_0xd242('0x3b')]=_[_0xd242('0x3a')](_0x290a52[_0xd242('0x3b')]);_0x5a7273[_0xd242('0x3c')]=_['intersection'](_0x5a7273[_0xd242('0x3e')],_0x5a7273['query']);_0x11518a[_0xd242('0x3f')]=_[_0xd242('0x3d')](_0x5a7273[_0xd242('0x3e')],qs[_0xd242('0x40')](_0x290a52[_0xd242('0x3b')][_0xd242('0x40')]));_0x11518a['attributes']=_0x11518a[_0xd242('0x3f')]['length']?_0x11518a[_0xd242('0x3f')]:_0x5a7273[_0xd242('0x3e')];if(!_0x290a52[_0xd242('0x3b')][_0xd242('0x42')](_0xd242('0x43'))){_0x11518a['limit']=qs[_0xd242('0x20')](_0x290a52[_0xd242('0x3b')][_0xd242('0x20')]);_0x11518a['offset']=qs['offset'](_0x290a52[_0xd242('0x3b')][_0xd242('0x1f')]);}_0x11518a[_0xd242('0x63')]=qs[_0xd242('0x44')](_0x290a52[_0xd242('0x3b')][_0xd242('0x44')]);_0x11518a[_0xd242('0x45')]=qs[_0xd242('0x3c')](_[_0xd242('0x46')](_0x290a52[_0xd242('0x3b')],_0x5a7273[_0xd242('0x3c')]));_0x11518a[_0xd242('0x45')][_0xd242('0x60')]=_0x3ca86c['id'];if(_0x290a52[_0xd242('0x3b')][_0xd242('0x2d')]){_0x11518a[_0xd242('0x45')]=_[_0xd242('0x47')](_0x11518a[_0xd242('0x45')],{'$or':_['map'](_0x11518a[_0xd242('0x3f')],function(_0x54e42d){var _0x15aab1={};_0x15aab1[_0x54e42d]={'$like':'%'+_0x290a52[_0xd242('0x3b')][_0xd242('0x2d')]+'%'};return _0x15aab1;})});}_0x11518a=_[_0xd242('0x47')]({},_0x11518a,_0x290a52[_0xd242('0x61')]);return db[_0xd242('0x66')][_0xd242('0x1e')]({'where':_0x11518a[_0xd242('0x45')]})[_0xd242('0x27')](function(_0x44b480){_0x12ed5b[_0xd242('0x1e')]=_0x44b480;if(_0x290a52[_0xd242('0x3b')][_0xd242('0x49')]){_0x11518a[_0xd242('0x4a')]=[{'all':!![]}];}return db['CmHopperFinal'][_0xd242('0x4b')](_0x11518a);})[_0xd242('0x27')](function(_0x5c0f1c){_0x12ed5b[_0xd242('0x62')]=_0x5c0f1c;return _0x12ed5b;});}})[_0xd242('0x27')](respondWithFilteredResult(_0x16fc73,_0x11518a))['catch'](handleError(_0x16fc73,null));};exports['getHopperBlacks']=function(_0x2a14a0,_0x3a5351,_0x14ab34){var _0x5605c2={'raw':!![],'where':{}};var _0x467232={};var _0x16040a={'count':0x0,'rows':[]};return db[_0xd242('0x38')][_0xd242('0x5e')]({'where':{'id':_0x2a14a0[_0xd242('0x4d')]['id']}})['then'](handleEntityNotFound(_0x3a5351,null))[_0xd242('0x27')](function(_0x27b4f2){if(_0x27b4f2){_0x467232[_0xd242('0x3e')]=_[_0xd242('0x3a')](db['CmHopperBlack'][_0xd242('0x4e')]);_0x467232[_0xd242('0x3b')]=_[_0xd242('0x3a')](_0x2a14a0['query']);_0x467232['filters']=_[_0xd242('0x3d')](_0x467232['model'],_0x467232['query']);_0x5605c2[_0xd242('0x3f')]=_[_0xd242('0x3d')](_0x467232[_0xd242('0x3e')],qs[_0xd242('0x40')](_0x2a14a0[_0xd242('0x3b')][_0xd242('0x40')]));_0x5605c2[_0xd242('0x3f')]=_0x5605c2['attributes']['length']?_0x5605c2[_0xd242('0x3f')]:_0x467232[_0xd242('0x3e')];if(!_0x2a14a0['query'][_0xd242('0x42')](_0xd242('0x43'))){_0x5605c2['limit']=qs[_0xd242('0x20')](_0x2a14a0[_0xd242('0x3b')][_0xd242('0x20')]);_0x5605c2[_0xd242('0x1f')]=qs[_0xd242('0x1f')](_0x2a14a0['query'][_0xd242('0x1f')]);}_0x5605c2[_0xd242('0x63')]=qs[_0xd242('0x44')](_0x2a14a0[_0xd242('0x3b')][_0xd242('0x44')]);_0x5605c2[_0xd242('0x45')]=qs[_0xd242('0x3c')](_['pick'](_0x2a14a0[_0xd242('0x3b')],_0x467232[_0xd242('0x3c')]));_0x5605c2['where'][_0xd242('0x60')]=_0x27b4f2['id'];if(_0x2a14a0[_0xd242('0x3b')][_0xd242('0x2d')]){_0x5605c2[_0xd242('0x45')]=_[_0xd242('0x47')](_0x5605c2[_0xd242('0x45')],{'$or':_[_0xd242('0x2f')](_0x5605c2[_0xd242('0x3f')],function(_0x1d3c6b){var _0x1bc52d={};_0x1bc52d[_0x1d3c6b]={'$like':'%'+_0x2a14a0[_0xd242('0x3b')]['filter']+'%'};return _0x1bc52d;})});}_0x5605c2=_[_0xd242('0x47')]({},_0x5605c2,_0x2a14a0['options']);return db[_0xd242('0x67')][_0xd242('0x1e')]({'where':_0x5605c2[_0xd242('0x45')]})[_0xd242('0x27')](function(_0x4be7da){_0x16040a['count']=_0x4be7da;if(_0x2a14a0['query'][_0xd242('0x49')]){_0x5605c2[_0xd242('0x4a')]=[{'all':!![]}];}return db['CmHopperBlack']['findAll'](_0x5605c2);})[_0xd242('0x27')](function(_0x42604f){_0x16040a[_0xd242('0x62')]=_0x42604f;return _0x16040a;});}})['then'](respondWithFilteredResult(_0x3a5351,_0x5605c2))[_0xd242('0x4c')](handleError(_0x3a5351,null));};exports['getTeams']=function(_0xdcc54a,_0x3b3dc7,_0x339e8c){var _0x28c0c0={};var _0x521faf={};var _0x47eac2;var _0x9d727b;return db[_0xd242('0x38')][_0xd242('0x5e')]({'where':{'id':_0xdcc54a[_0xd242('0x4d')]['id']}})['then'](handleEntityNotFound(_0x3b3dc7,null))['then'](function(_0x422b50){if(_0x422b50){_0x47eac2=_0x422b50;_0x521faf[_0xd242('0x3e')]=_[_0xd242('0x3a')](db[_0xd242('0x68')][_0xd242('0x4e')]);_0x521faf[_0xd242('0x3b')]=_[_0xd242('0x3a')](_0xdcc54a[_0xd242('0x3b')]);_0x521faf[_0xd242('0x3c')]=_[_0xd242('0x3d')](_0x521faf[_0xd242('0x3e')],_0x521faf[_0xd242('0x3b')]);_0x28c0c0[_0xd242('0x3f')]=_[_0xd242('0x3d')](_0x521faf[_0xd242('0x3e')],qs[_0xd242('0x40')](_0xdcc54a[_0xd242('0x3b')][_0xd242('0x40')]));_0x28c0c0[_0xd242('0x3f')]=_0x28c0c0[_0xd242('0x3f')][_0xd242('0x41')]?_0x28c0c0['attributes']:_0x521faf[_0xd242('0x3e')];_0x28c0c0[_0xd242('0x63')]=qs['sort'](_0xdcc54a[_0xd242('0x3b')][_0xd242('0x44')]);_0x28c0c0[_0xd242('0x45')]=qs[_0xd242('0x3c')](_[_0xd242('0x46')](_0xdcc54a[_0xd242('0x3b')],_0x521faf[_0xd242('0x3c')]));if(_0xdcc54a[_0xd242('0x3b')][_0xd242('0x2d')]){_0x28c0c0[_0xd242('0x45')]=_[_0xd242('0x47')](_0x28c0c0[_0xd242('0x45')],{'$or':_[_0xd242('0x2f')](_0x28c0c0['attributes'],function(_0x59a54c){var _0x47b90e={};_0x47b90e[_0x59a54c]={'$like':'%'+_0xdcc54a[_0xd242('0x3b')]['filter']+'%'};return _0x47b90e;})});}_0x28c0c0=_[_0xd242('0x47')]({},_0x28c0c0,_0xdcc54a[_0xd242('0x61')]);return _0x47eac2['getTeams'](_0x28c0c0);}})[_0xd242('0x27')](function(_0x11b35e){if(_0x11b35e){_0x9d727b=_0x11b35e[_0xd242('0x41')];if(!_0xdcc54a['query'][_0xd242('0x42')](_0xd242('0x43'))){_0x28c0c0['limit']=qs[_0xd242('0x20')](_0xdcc54a[_0xd242('0x3b')][_0xd242('0x20')]);_0x28c0c0['offset']=qs[_0xd242('0x1f')](_0xdcc54a[_0xd242('0x3b')][_0xd242('0x1f')]);}return _0x47eac2[_0xd242('0x69')](_0x28c0c0);}})['then'](function(_0x4dcb6c){if(_0x4dcb6c){return _0x4dcb6c?{'count':_0x9d727b,'rows':_0x4dcb6c}:null;}})['then'](respondWithResult(_0x3b3dc7,null))[_0xd242('0x4c')](handleError(_0x3b3dc7,null));};exports[_0xd242('0x6a')]=function(_0x342561,_0x152d74,_0x1dbf1d){var _0x1b41f0=_0x342561[_0xd242('0x50')][_0xd242('0x6b')];var _0x273e1c=_[_0xd242('0x2f')](_0x1b41f0,'id');return db[_0xd242('0x68')]['findAll']({'where':{'id':_0x273e1c},'attributes':['id'],'include':[{'model':db[_0xd242('0x6c')],'as':_0xd242('0x6d'),'attributes':['id',_0xd242('0x34'),_0xd242('0x6e'),_0xd242('0x6f'),'interface'],'raw':!![]}]})['then'](function(_0x285642){if(_0x285642){var _0x174aa9=_[_0xd242('0x70')](_0x285642,function(_0x51edef){var _0x239b6d=_0x51edef[_0xd242('0x29')]({'plain':!![]});_0x239b6d['Agents'][_0xd242('0x71')](function(_0x2d7c99){_0x2d7c99[_0xd242('0x72')]=_[_0xd242('0x32')](_0x1b41f0,{'id':_0x239b6d['id']})[_0xd242('0x72')];});return _0x239b6d['Agents'];});return db[_0xd242('0x38')][_0xd242('0x32')]({'where':{'id':_0x342561[_0xd242('0x4d')]['id']}})[_0xd242('0x27')](function(_0x534b06){return db[_0xd242('0x73')][_0xd242('0x74')](function(_0x4adc9b){return _0x534b06[_0xd242('0x6a')](_0x273e1c,{'transaction':_0x4adc9b})[_0xd242('0x27')](function(){return BPromise['each'](_0x174aa9,function(_0x19939f){return db[_0xd242('0x75')][_0xd242('0x76')]({'where':{'UserId':_0x19939f['id'],'VoiceQueueId':_0x342561[_0xd242('0x4d')]['id']},'defaults':{'penalty':_0x19939f[_0xd242('0x72')]},'transaction':_0x4adc9b});});})[_0xd242('0x27')](function(){return BPromise[_0xd242('0x77')](_[_0xd242('0x2d')](_0x174aa9,{'online':!![]}),function(_0x56430d){return db[_0xd242('0x78')]['upsert']({'membername':_0x56430d[_0xd242('0x34')],'UserId':_0x56430d['id'],'queue_name':_0x534b06[_0xd242('0x34')],'VoiceQueueId':_0x534b06['id'],'interface':_[_0xd242('0x79')](_0x56430d[_0xd242('0x7a')])?util['format'](_0xd242('0x7b'),_0x56430d['name']):_0x56430d[_0xd242('0x7a')],'paused':_0x56430d[_0xd242('0x6f')]||![],'penalty':_0x56430d['penalty']},{'transaction':_0x4adc9b});});})['then'](function(){_0x174aa9[_0xd242('0x71')](function(_0x27103e){socket['emit'](_0xd242('0x7c'),{'UserId':_0x27103e['id'],'VoiceQueueId':_0x534b06['id']});});});});});}})[_0xd242('0x27')](respondWithStatusCode(_0x152d74,null))[_0xd242('0x4c')](handleError(_0x152d74,null));};exports[_0xd242('0x7d')]=function(_0x49ef43,_0x43707f,_0x455b67){return db['Team'][_0xd242('0x4b')]({'where':{'id':_0x49ef43['query'][_0xd242('0x7e')]},'attributes':['id'],'include':[{'model':db[_0xd242('0x6c')],'as':_0xd242('0x6d'),'attributes':['id'],'raw':!![]}]})[_0xd242('0x27')](handleEntityNotFound(_0x43707f,null))[_0xd242('0x27')](function(_0x31914d){var _0xf1f3b5=_[_0xd242('0x2f')](_0x31914d,'id');var _0x331e01=[];var _0x3432b9=[];var _0x4f23d5=squel[_0xd242('0x7f')]();_0x4f23d5['field']('tq.TeamId')['from'](_0xd242('0x80'),'tq')['join'](_0xd242('0x81'),'ut',_0xd242('0x82'))[_0xd242('0x45')](_0xd242('0x83'),_0x49ef43['params']['id']);for(var _0x40d251=0x0;_0x40d251<_0x31914d['length'];_0x40d251+=0x1){let _0x1b396f=_0x31914d[_0x40d251];for(var _0x4217a9=0x0;_0x4217a9<_0x1b396f[_0xd242('0x6d')]['length'];_0x4217a9+=0x1){let _0x57ed57=_0x1b396f[_0xd242('0x6d')][_0x4217a9];var _0x6f5c6=_0x4f23d5['clone']();_0x6f5c6[_0xd242('0x45')](_0xd242('0x84'),_0x57ed57['id']);_0x3432b9[_0xd242('0x85')](db[_0xd242('0x73')]['query'](_0x6f5c6[_0xd242('0x86')](),{'type':db[_0xd242('0x73')][_0xd242('0x87')]['SELECT']})[_0xd242('0x27')](function(_0x31bfb6){if(_0x31bfb6[_0xd242('0x41')]===0x1){return _0x57ed57['id'];}else{var _0x3935dc=_[_0xd242('0x88')](_[_0xd242('0x2f')](_0x31bfb6,_0xd242('0x89')),function(_0x17d2ee){return _[_0xd242('0x31')](_0xf1f3b5,_0x17d2ee);});if(_0x3935dc){return _0x57ed57['id'];}}}));}}return BPromise[_0xd242('0x8a')](_0x3432b9)[_0xd242('0x27')](function(_0x8c2054){_0x331e01=_(_0x331e01)[_0xd242('0x8b')](_0x8c2054)[_0xd242('0x8c')]()[_0xd242('0x30')]();return db[_0xd242('0x38')][_0xd242('0x32')]({'where':{'id':_0x49ef43[_0xd242('0x4d')]['id']}})[_0xd242('0x27')](function(_0x41522e){return db[_0xd242('0x73')][_0xd242('0x74')](function(_0x2d5409){return _0x41522e[_0xd242('0x7d')](_0x49ef43[_0xd242('0x3b')][_0xd242('0x7e')],{'transaction':_0x2d5409})[_0xd242('0x27')](function(){if(!_['isEmpty'](_0x331e01)){return _0x41522e[_0xd242('0x8d')](_0x331e01,{'transaction':_0x2d5409})[_0xd242('0x27')](function(){return db[_0xd242('0x78')]['destroy']({'where':{'VoiceQueueId':_0x49ef43[_0xd242('0x4d')]['id'],'UserId':_0x331e01},'transaction':_0x2d5409});});}})[_0xd242('0x27')](function(){_0x331e01['forEach'](function(_0x21ae31){socket[_0xd242('0x8e')](_0xd242('0x8f'),{'UserId':_0x21ae31,'VoiceQueueId':_0x41522e['id']});});});});});});})[_0xd242('0x27')](respondWithStatusCode(_0x43707f,null))['catch'](handleError(_0x43707f,null));};exports[_0xd242('0x90')]=function(_0x260f1d,_0x159373,_0xf532d2){var _0xaf5e76,_0x121548;return db['VoiceQueue']['find']({'where':{'id':_0x260f1d[_0xd242('0x4d')]['id']}})[_0xd242('0x27')](handleEntityNotFound(_0x159373,null))[_0xd242('0x27')](function(_0x1b00d3){if(_0x1b00d3){_0x121548=_0x1b00d3;return _0x1b00d3[_0xd242('0x90')](_0x260f1d[_0xd242('0x50')][_0xd242('0x7e')],_[_0xd242('0x58')](_0x260f1d[_0xd242('0x50')],[_0xd242('0x7e'),'id'])||{})[_0xd242('0x91')](function(_0x3bdb88){for(var _0x58cfb5=0x0;_0x58cfb5<_0x260f1d[_0xd242('0x50')][_0xd242('0x7e')]['length'];_0x58cfb5+=0x1){socket[_0xd242('0x8e')](_0xd242('0x7c'),{'UserId':_0x260f1d['body']['ids'][_0x58cfb5],'VoiceQueueId':_0x260f1d[_0xd242('0x4d')]['id']});}return _0x3bdb88;});}})['then'](function(_0x48e375){_0xaf5e76=_0x48e375||[];if(_0x121548){return db[_0xd242('0x6c')]['findAll']({'where':{'id':_0x260f1d[_0xd242('0x50')]['ids']},'attributes':['id',_0xd242('0x34'),_0xd242('0x6e'),_0xd242('0x6f'),_0xd242('0x7a')],'raw':!![]});}})[_0xd242('0x27')](function(_0x2f5666){if(!_[_0xd242('0x92')](_0x2f5666)){var _0x23aae5=[];for(var _0x499d48=0x0;_0x499d48<_0x2f5666[_0xd242('0x41')];_0x499d48++){if(_0x2f5666[_0x499d48][_0xd242('0x6e')]){_0x23aae5[_0xd242('0x85')](db['UserVoiceQueueRt']['upsert']({'membername':_0x2f5666[_0x499d48][_0xd242('0x34')],'UserId':_0x2f5666[_0x499d48]['id'],'queue_name':_0x121548[_0xd242('0x34')],'VoiceQueueId':_0x121548['id'],'interface':_[_0xd242('0x79')](_0x2f5666[_0x499d48][_0xd242('0x7a')])?util['format'](_0xd242('0x7b'),_0x2f5666[_0x499d48][_0xd242('0x34')]):_0x2f5666[_0x499d48][_0xd242('0x7a')],'paused':_0x2f5666[_0x499d48][_0xd242('0x6f')]||![],'penalty':_0x260f1d['body'][_0xd242('0x72')]||0x0}));}}return BPromise[_0xd242('0x8a')](_0x23aae5);}})[_0xd242('0x27')](function(){return _0xaf5e76;})[_0xd242('0x27')](respondWithResult(_0x159373,null))['catch'](handleError(_0x159373,null));};exports[_0xd242('0x8d')]=function(_0x5d13bf,_0x25049a,_0x587467){return db[_0xd242('0x38')][_0xd242('0x32')]({'where':{'id':_0x5d13bf[_0xd242('0x4d')]['id']}})[_0xd242('0x27')](handleEntityNotFound(_0x25049a,null))[_0xd242('0x27')](function(_0x15d6df){if(_0x15d6df){return _0x15d6df[_0xd242('0x8d')](_0x5d13bf[_0xd242('0x3b')][_0xd242('0x7e')])['then'](function(){if(_[_0xd242('0x93')](_0x5d13bf[_0xd242('0x3b')][_0xd242('0x7e')])){for(var _0x4f72cc=0x0;_0x4f72cc<_0x5d13bf[_0xd242('0x3b')][_0xd242('0x7e')][_0xd242('0x41')];_0x4f72cc+=0x1){socket[_0xd242('0x8e')]('userVoiceQueue:remove',{'UserId':Number(_0x5d13bf[_0xd242('0x3b')]['ids'][_0x4f72cc]),'VoiceQueueId':Number(_0x5d13bf[_0xd242('0x4d')]['id'])});}}else{socket['emit'](_0xd242('0x8f'),{'UserId':Number(_0x5d13bf[_0xd242('0x3b')]['ids']),'VoiceQueueId':Number(_0x5d13bf[_0xd242('0x4d')]['id'])});}});}})['then'](function(_0x20d169){return db['UserVoiceQueueRt'][_0xd242('0x28')]({'where':{'VoiceQueueId':_0x5d13bf[_0xd242('0x4d')]['id'],'UserId':_0x5d13bf['query'][_0xd242('0x7e')]}})[_0xd242('0x27')](function(){return _0x20d169;});})[_0xd242('0x27')](respondWithStatusCode(_0x25049a,null))[_0xd242('0x4c')](handleError(_0x25049a,null));};exports['getAgents']=function(_0x36ccd5,_0x4e8139,_0xa12310){var _0x51ee24={};var _0x3daf6a={};var _0x3fb985;var _0x3746f0;return db[_0xd242('0x38')]['findOne']({'where':{'id':_0x36ccd5[_0xd242('0x4d')]['id']}})[_0xd242('0x27')](handleEntityNotFound(_0x4e8139,null))[_0xd242('0x27')](function(_0x5855f7){if(_0x5855f7){_0x3fb985=_0x5855f7;_0x3daf6a['model']=_[_0xd242('0x3a')](db[_0xd242('0x6c')][_0xd242('0x4e')]);_0x3daf6a[_0xd242('0x3b')]=_[_0xd242('0x3a')](_0x36ccd5[_0xd242('0x3b')]);_0x3daf6a[_0xd242('0x3c')]=_[_0xd242('0x3d')](_0x3daf6a[_0xd242('0x3e')],_0x3daf6a['query']);_0x51ee24[_0xd242('0x3f')]=_[_0xd242('0x3d')](_0x3daf6a[_0xd242('0x3e')],qs[_0xd242('0x40')](_0x36ccd5[_0xd242('0x3b')][_0xd242('0x40')]));_0x51ee24[_0xd242('0x3f')]=_0x51ee24[_0xd242('0x3f')][_0xd242('0x41')]?_0x51ee24[_0xd242('0x3f')]:_0x3daf6a[_0xd242('0x3e')];_0x51ee24[_0xd242('0x63')]=qs[_0xd242('0x44')](_0x36ccd5['query'][_0xd242('0x44')]);_0x51ee24['where']=qs[_0xd242('0x3c')](_['pick'](_0x36ccd5[_0xd242('0x3b')],_0x3daf6a['filters']));if(_0x36ccd5[_0xd242('0x3b')][_0xd242('0x2d')]){_0x51ee24[_0xd242('0x45')]=_[_0xd242('0x47')](_0x51ee24['where'],{'$or':_['map'](_0x51ee24[_0xd242('0x3f')],function(_0x31ff2a){var _0x175472={};_0x175472[_0x31ff2a]={'$like':'%'+_0x36ccd5[_0xd242('0x3b')][_0xd242('0x2d')]+'%'};return _0x175472;})});}_0x51ee24=_[_0xd242('0x47')]({},_0x51ee24,_0x36ccd5[_0xd242('0x61')]);return _0x3fb985[_0xd242('0x94')](_0x51ee24);}})[_0xd242('0x27')](function(_0x5cbda4){if(_0x5cbda4){_0x3746f0=_0x5cbda4[_0xd242('0x41')];if(!_0x36ccd5[_0xd242('0x3b')]['hasOwnProperty'](_0xd242('0x43'))){_0x51ee24[_0xd242('0x20')]=qs[_0xd242('0x20')](_0x36ccd5[_0xd242('0x3b')][_0xd242('0x20')]);_0x51ee24[_0xd242('0x1f')]=qs[_0xd242('0x1f')](_0x36ccd5[_0xd242('0x3b')][_0xd242('0x1f')]);}return _0x3fb985[_0xd242('0x94')](_0x51ee24);}})['then'](function(_0x1c6ee8){if(_0x1c6ee8){return _0x1c6ee8?{'count':_0x3746f0,'rows':_0x1c6ee8}:null;}})[_0xd242('0x27')](respondWithResult(_0x4e8139,null))['catch'](handleError(_0x4e8139,null));};exports[_0xd242('0x95')]=function(_0x5e3afc,_0x32c138,_0x1d52a1){var _0x38b279={};var _0x5736b={};var _0x241d62;var _0x2d3204;return db[_0xd242('0x38')][_0xd242('0x5e')]({'where':{'id':_0x5e3afc[_0xd242('0x4d')]['id']}})[_0xd242('0x27')](handleEntityNotFound(_0x32c138,null))[_0xd242('0x27')](function(_0x367ad4){if(_0x367ad4){_0x241d62=_0x367ad4;_0x5736b[_0xd242('0x3e')]=_[_0xd242('0x3a')](db[_0xd242('0x78')][_0xd242('0x4e')]);_0x5736b[_0xd242('0x3b')]=_[_0xd242('0x3a')](_0x5e3afc[_0xd242('0x3b')]);_0x5736b[_0xd242('0x3c')]=_['intersection'](_0x5736b[_0xd242('0x3e')],_0x5736b[_0xd242('0x3b')]);_0x38b279[_0xd242('0x3f')]=_[_0xd242('0x3d')](_0x5736b[_0xd242('0x3e')],qs[_0xd242('0x40')](_0x5e3afc[_0xd242('0x3b')][_0xd242('0x40')]));_0x38b279[_0xd242('0x3f')]=_0x38b279[_0xd242('0x3f')]['length']?_0x38b279[_0xd242('0x3f')]:_0x5736b['model'];_0x38b279[_0xd242('0x63')]=qs[_0xd242('0x44')](_0x5e3afc['query'][_0xd242('0x44')]);_0x38b279[_0xd242('0x45')]=qs[_0xd242('0x3c')](_[_0xd242('0x46')](_0x5e3afc['query'],_0x5736b[_0xd242('0x3c')]));if(_0x5e3afc[_0xd242('0x3b')]['filter']){_0x38b279[_0xd242('0x45')]=_[_0xd242('0x47')](_0x38b279[_0xd242('0x45')],{'$or':_['map'](_0x38b279[_0xd242('0x3f')],function(_0x28bb54){var _0x1ea338={};_0x1ea338[_0x28bb54]={'$like':'%'+_0x5e3afc[_0xd242('0x3b')][_0xd242('0x2d')]+'%'};return _0x1ea338;})});}_0x38b279=_['merge']({},_0x38b279,_0x5e3afc['options']);return _0x241d62[_0xd242('0x95')](_0x38b279);}})[_0xd242('0x27')](function(_0xea30f5){if(_0xea30f5){_0x2d3204=_0xea30f5[_0xd242('0x41')];if(!_0x5e3afc[_0xd242('0x3b')][_0xd242('0x42')](_0xd242('0x43'))){_0x38b279[_0xd242('0x20')]=qs[_0xd242('0x20')](_0x5e3afc[_0xd242('0x3b')][_0xd242('0x20')]);_0x38b279[_0xd242('0x1f')]=qs[_0xd242('0x1f')](_0x5e3afc[_0xd242('0x3b')]['offset']);}return _0x241d62[_0xd242('0x95')](_0x38b279);}})[_0xd242('0x27')](function(_0x44482e){return _0x44482e?{'count':_0x2d3204,'rows':_0x44482e}:null;})['then'](respondWithResult(_0x32c138,null))[_0xd242('0x4c')](handleError(_0x32c138,null));};exports[_0xd242('0x96')]=function(_0x1212fd,_0x5d204a,_0x16db7f){var _0x165d81={};var _0x3c5ac1={};var _0x4f185c;var _0x346573;return db[_0xd242('0x38')][_0xd242('0x5e')]({'where':{'id':_0x1212fd['params']['id']}})[_0xd242('0x27')](handleEntityNotFound(_0x5d204a,null))[_0xd242('0x27')](function(_0xb66563){if(_0xb66563){_0x4f185c=_0xb66563;_0x3c5ac1[_0xd242('0x3e')]=_[_0xd242('0x3a')](db['CmList'][_0xd242('0x4e')]);_0x3c5ac1[_0xd242('0x3b')]=_[_0xd242('0x3a')](_0x1212fd[_0xd242('0x3b')]);_0x3c5ac1[_0xd242('0x3c')]=_[_0xd242('0x3d')](_0x3c5ac1[_0xd242('0x3e')],_0x3c5ac1[_0xd242('0x3b')]);_0x165d81[_0xd242('0x3f')]=_[_0xd242('0x3d')](_0x3c5ac1[_0xd242('0x3e')],qs[_0xd242('0x40')](_0x1212fd[_0xd242('0x3b')][_0xd242('0x40')]));_0x165d81[_0xd242('0x3f')]=_0x165d81[_0xd242('0x3f')]['length']?_0x165d81[_0xd242('0x3f')]:_0x3c5ac1[_0xd242('0x3e')];_0x165d81[_0xd242('0x63')]=qs[_0xd242('0x44')](_0x1212fd[_0xd242('0x3b')][_0xd242('0x44')]);_0x165d81['where']=qs[_0xd242('0x3c')](_[_0xd242('0x46')](_0x1212fd['query'],_0x3c5ac1[_0xd242('0x3c')]));if(_0x1212fd['query'][_0xd242('0x2d')]){_0x165d81[_0xd242('0x45')]=_[_0xd242('0x47')](_0x165d81[_0xd242('0x45')],{'$or':_['map'](_0x165d81[_0xd242('0x3f')],function(_0x1d57a5){var _0xd9dca5={};_0xd9dca5[_0x1d57a5]={'$like':'%'+_0x1212fd[_0xd242('0x3b')][_0xd242('0x2d')]+'%'};return _0xd9dca5;})});}_0x165d81=_[_0xd242('0x47')]({},_0x165d81,_0x1212fd[_0xd242('0x61')]);return _0x4f185c[_0xd242('0x96')](_0x165d81);}})['then'](function(_0x6423f3){if(_0x6423f3){_0x346573=_0x6423f3['length'];if(!_0x1212fd[_0xd242('0x3b')]['hasOwnProperty'](_0xd242('0x43'))){_0x165d81[_0xd242('0x20')]=qs[_0xd242('0x20')](_0x1212fd[_0xd242('0x3b')][_0xd242('0x20')]);_0x165d81['offset']=qs[_0xd242('0x1f')](_0x1212fd['query'][_0xd242('0x1f')]);}return _0x4f185c['getLists'](_0x165d81);}})['then'](function(_0x2b481a){if(_0x2b481a){return _0x2b481a?{'count':_0x346573,'rows':_0x2b481a}:null;}})['then'](respondWithResult(_0x5d204a,null))['catch'](handleError(_0x5d204a,null));};exports[_0xd242('0x97')]=function(_0x267c10,_0x407d09,_0x42ef1f){var _0x8fff15,_0x27b565;return db[_0xd242('0x38')]['find']({'where':{'id':_0x267c10[_0xd242('0x4d')]['id']}})[_0xd242('0x27')](handleEntityNotFound(_0x407d09,null))[_0xd242('0x27')](function(_0x5e3522){if(_0x5e3522){_0x27b565=_0x5e3522;return _0x5e3522[_0xd242('0x97')](_0x267c10['body'][_0xd242('0x7e')],_[_0xd242('0x58')](_0x267c10['body'],[_0xd242('0x7e'),'id'])||{});}return null;})[_0xd242('0x91')](function(_0x196660){var _0x348757;_0x8fff15=_0x196660||[];var _0x46d31e=[];if(_0x196660){for(var _0x235441=0x0;_0x235441<_0x196660['length'];_0x235441+=0x1){var _0x324501=_0x196660[_0x235441][_0xd242('0x29')]({'plain':!![]});_0x27b565[_0xd242('0x98')]=_0x267c10[_0xd242('0x50')]['dialCheckDuplicateType']?_0x267c10[_0xd242('0x50')][_0xd242('0x98')]:_0x27b565[_0xd242('0x98')];switch(_0x27b565[_0xd242('0x98')]){case _0xd242('0x99'):_0x348757=squel[_0xd242('0x9a')]()[_0xd242('0x9b')](_0xd242('0x9c'))[_0xd242('0x9d')]([_0xd242('0x9e'),_0xd242('0x9f'),_0xd242('0xa0'),_0xd242('0xa1'),_0xd242('0x60'),_0xd242('0x59'),'updatedAt'],squel[_0xd242('0x7f')]()[_0xd242('0xa2')]('phone','phone')[_0xd242('0xa2')](_0xd242('0xa3'),_0xd242('0x9f'))[_0xd242('0xa2')]('id',_0xd242('0xa0'))[_0xd242('0xa2')](_0x324501[_0xd242('0xa4')][_0xd242('0x86')](),_0xd242('0xa1'))[_0xd242('0xa2')](_0x267c10[_0xd242('0x4d')]['id'][_0xd242('0x86')](),_0xd242('0x60'))[_0xd242('0xa2')](_0xd242('0xa3'),_0xd242('0x59'))[_0xd242('0xa2')]('NOW()',_0xd242('0x5a'))[_0xd242('0xa5')]('cm_contacts')['where'](_0xd242('0xa6'))['where'](_0xd242('0xa7'),_0x324501[_0xd242('0xa4')]['toString']())[_0xd242('0x45')](_0xd242('0xa8'))[_0xd242('0x45')](_0xd242('0xa9'),squel[_0xd242('0x7f')]()[_0xd242('0xa2')](_0xd242('0xaa'))['from'](_0xd242('0xab'))['where'](_0xd242('0x83'),_0x267c10[_0xd242('0x4d')]['id'][_0xd242('0x86')]()))['where'](_0xd242('0xa9'),squel['select']()[_0xd242('0xa2')](_0xd242('0xac'))['from'](_0xd242('0x9c'))[_0xd242('0x45')](_0xd242('0x83'),_0x267c10['params']['id'][_0xd242('0x86')]())))[_0xd242('0x86')]();break;case'onlyIfOpen':_0x348757=squel[_0xd242('0x9a')]()['into'](_0xd242('0x9c'))[_0xd242('0x9d')](['phone',_0xd242('0x9f'),'ContactId',_0xd242('0xa1'),'VoiceQueueId','createdAt','updatedAt'],squel[_0xd242('0x7f')]()['field'](_0xd242('0x9e'),'phone')[_0xd242('0xa2')]('NOW()',_0xd242('0x9f'))[_0xd242('0xa2')]('id',_0xd242('0xa0'))[_0xd242('0xa2')](_0x324501[_0xd242('0xa4')][_0xd242('0x86')](),_0xd242('0xa1'))[_0xd242('0xa2')](_0x267c10[_0xd242('0x4d')]['id']['toString'](),_0xd242('0x60'))[_0xd242('0xa2')](_0xd242('0xa3'),_0xd242('0x59'))[_0xd242('0xa2')](_0xd242('0xa3'),_0xd242('0x5a'))[_0xd242('0xa5')]('cm_contacts')[_0xd242('0x45')](_0xd242('0xa6'))[_0xd242('0x45')](_0xd242('0xa7'),_0x324501[_0xd242('0xa4')][_0xd242('0x86')]())[_0xd242('0x45')](_0xd242('0xa8'))[_0xd242('0x45')]('phone\x20NOT\x20IN\x20(?)',squel[_0xd242('0x7f')]()[_0xd242('0xa2')](_0xd242('0xac'))[_0xd242('0xa5')](_0xd242('0x9c'))[_0xd242('0x45')]('VoiceQueueId\x20=\x20?',_0x267c10[_0xd242('0x4d')]['id'][_0xd242('0x86')]())))['toString']();break;default:_0x348757=squel['insert']()[_0xd242('0x9b')](_0xd242('0x9c'))['fromQuery']([_0xd242('0x9e'),_0xd242('0x9f'),_0xd242('0xa0'),_0xd242('0xa1'),_0xd242('0x60'),_0xd242('0x59'),_0xd242('0x5a')],squel[_0xd242('0x7f')]()['field'](_0xd242('0x9e'),_0xd242('0x9e'))['field'](_0xd242('0xa3'),_0xd242('0x9f'))[_0xd242('0xa2')]('id','ContactId')[_0xd242('0xa2')](_0x324501[_0xd242('0xa4')][_0xd242('0x86')](),_0xd242('0xa1'))[_0xd242('0xa2')](_0x267c10[_0xd242('0x4d')]['id'][_0xd242('0x86')](),_0xd242('0x60'))['field']('NOW()','createdAt')['field']('NOW()',_0xd242('0x5a'))[_0xd242('0xa5')]('cm_contacts')['where'](_0xd242('0xa6'))[_0xd242('0x45')](_0xd242('0xa7'),_0x324501[_0xd242('0xa4')][_0xd242('0x86')]())[_0xd242('0x45')]('phone\x20IS\x20NOT\x20NULL'))[_0xd242('0x86')]();}_0x46d31e['push'](db[_0xd242('0x73')][_0xd242('0x3b')](_0x348757));}return BPromise[_0xd242('0x8a')](_0x46d31e);}})[_0xd242('0x27')](function(){return _0x8fff15;})['then'](respondWithResult(_0x407d09,null))[_0xd242('0x4c')](handleError(_0x407d09,null));};exports[_0xd242('0xad')]=function(_0x5e4d4b,_0x2f8396,_0xfbd955){return db[_0xd242('0x38')][_0xd242('0x32')]({'where':{'id':_0x5e4d4b[_0xd242('0x4d')]['id']}})[_0xd242('0x27')](handleEntityNotFound(_0x2f8396,null))[_0xd242('0x27')](function(_0x5e9f6b){if(_0x5e9f6b){return _0x5e9f6b[_0xd242('0xad')](_0x5e4d4b[_0xd242('0x3b')][_0xd242('0x7e')]);}})[_0xd242('0x27')](function(_0x2a5296){if(_0x2a5296){return db['CmHopper'][_0xd242('0x28')]({'where':{'ListId':_0x5e4d4b['query']['ids'],'VoiceQueueId':_0x5e4d4b[_0xd242('0x4d')]['id']}})['then'](function(){return _0x2a5296;});}})[_0xd242('0x27')](respondWithStatusCode(_0x2f8396,null))[_0xd242('0x4c')](handleError(_0x2f8396,null));};exports[_0xd242('0xae')]=function(_0x5ce0f3,_0x2222c8,_0x46d3af){var _0x80f70f={};var _0x3475f8={};var _0x302ffa;var _0x4e89b3;return db[_0xd242('0x38')][_0xd242('0x5e')]({'where':{'id':_0x5ce0f3[_0xd242('0x4d')]['id']}})['then'](handleEntityNotFound(_0x2222c8,null))[_0xd242('0x27')](function(_0x4cf7ac){if(_0x4cf7ac){_0x302ffa=_0x4cf7ac;_0x3475f8[_0xd242('0x3e')]=_[_0xd242('0x3a')](db[_0xd242('0xaf')][_0xd242('0x4e')]);_0x3475f8[_0xd242('0x3b')]=_[_0xd242('0x3a')](_0x5ce0f3['query']);_0x3475f8['filters']=_[_0xd242('0x3d')](_0x3475f8['model'],_0x3475f8[_0xd242('0x3b')]);_0x80f70f[_0xd242('0x3f')]=_['intersection'](_0x3475f8[_0xd242('0x3e')],qs[_0xd242('0x40')](_0x5ce0f3['query'][_0xd242('0x40')]));_0x80f70f['attributes']=_0x80f70f[_0xd242('0x3f')][_0xd242('0x41')]?_0x80f70f['attributes']:_0x3475f8[_0xd242('0x3e')];_0x80f70f['order']=qs[_0xd242('0x44')](_0x5ce0f3[_0xd242('0x3b')][_0xd242('0x44')]);_0x80f70f[_0xd242('0x45')]=qs['filters'](_[_0xd242('0x46')](_0x5ce0f3[_0xd242('0x3b')],_0x3475f8[_0xd242('0x3c')]));if(_0x5ce0f3[_0xd242('0x3b')][_0xd242('0x2d')]){_0x80f70f[_0xd242('0x45')]=_[_0xd242('0x47')](_0x80f70f['where'],{'$or':_[_0xd242('0x2f')](_0x80f70f[_0xd242('0x3f')],function(_0x30ad52){var _0x55cdce={};_0x55cdce[_0x30ad52]={'$like':'%'+_0x5ce0f3['query'][_0xd242('0x2d')]+'%'};return _0x55cdce;})});}_0x80f70f=_[_0xd242('0x47')]({},_0x80f70f,_0x5ce0f3[_0xd242('0x61')]);return _0x302ffa[_0xd242('0xae')](_0x80f70f);}})[_0xd242('0x27')](function(_0x36472f){if(_0x36472f){_0x4e89b3=_0x36472f[_0xd242('0x41')];if(!_0x5ce0f3[_0xd242('0x3b')][_0xd242('0x42')](_0xd242('0x43'))){_0x80f70f[_0xd242('0x20')]=qs[_0xd242('0x20')](_0x5ce0f3[_0xd242('0x3b')][_0xd242('0x20')]);_0x80f70f['offset']=qs[_0xd242('0x1f')](_0x5ce0f3[_0xd242('0x3b')][_0xd242('0x1f')]);}return _0x302ffa[_0xd242('0xae')](_0x80f70f);}})[_0xd242('0x27')](function(_0x29674f){if(_0x29674f){return _0x29674f?{'count':_0x4e89b3,'rows':_0x29674f}:null;}})[_0xd242('0x27')](respondWithResult(_0x2222c8,null))[_0xd242('0x4c')](handleError(_0x2222c8,null));};exports[_0xd242('0xb0')]=function(_0x5272c5,_0x553c87,_0x522ce2){var _0x5260f5,_0x2ffb1c;return db['VoiceQueue'][_0xd242('0x32')]({'where':{'id':_0x5272c5['params']['id']}})[_0xd242('0x27')](handleEntityNotFound(_0x553c87,null))[_0xd242('0x27')](function(_0x589ead){if(_0x589ead){_0x2ffb1c=_0x589ead;return _0x589ead['addBlackLists'](_0x5272c5[_0xd242('0x50')]['ids'],_['omit'](_0x5272c5[_0xd242('0x50')],[_0xd242('0x7e'),'id'])||{});}return null;})[_0xd242('0x91')](function(_0x24aa6e){var _0x278ccb;_0x5260f5=_0x24aa6e||[];var _0x1c56d5=[];if(_0x24aa6e){for(var _0x3cebd3=0x0;_0x3cebd3<_0x24aa6e[_0xd242('0x41')];_0x3cebd3+=0x1){var _0x17dd02=_0x24aa6e[_0x3cebd3][_0xd242('0x29')]({'plain':!![]});_0x278ccb=squel[_0xd242('0x9a')]()[_0xd242('0x9b')](_0xd242('0xb1'))[_0xd242('0x9d')]([_0xd242('0x9e'),_0xd242('0xa0'),_0xd242('0xa1'),'VoiceQueueId',_0xd242('0x59'),_0xd242('0x5a')],squel[_0xd242('0x7f')]()[_0xd242('0xa2')]('phone',_0xd242('0x9e'))[_0xd242('0xa2')]('id',_0xd242('0xa0'))[_0xd242('0xa2')](_0x17dd02[_0xd242('0xa4')][_0xd242('0x86')](),_0xd242('0xa1'))['field'](_0x5272c5[_0xd242('0x4d')]['id'][_0xd242('0x86')](),_0xd242('0x60'))['field'](_0xd242('0xa3'),_0xd242('0x59'))['field']('NOW()',_0xd242('0x5a'))[_0xd242('0xa5')](_0xd242('0xb2'))[_0xd242('0x45')](_0xd242('0xa6'))['where']('ListId\x20=\x20?',_0x17dd02['CmListId']['toString']())['where'](_0xd242('0xa8')))['toString']();_0x1c56d5[_0xd242('0x85')](db[_0xd242('0x73')]['query'](_0x278ccb));}return BPromise[_0xd242('0x8a')](_0x1c56d5);}})[_0xd242('0x27')](function(){return _0x5260f5;})[_0xd242('0x27')](respondWithResult(_0x553c87,null))[_0xd242('0x4c')](handleError(_0x553c87,null));};exports[_0xd242('0xb3')]=function(_0x4c6e88,_0x5a9622,_0x4720c8){return db[_0xd242('0x38')][_0xd242('0x32')]({'where':{'id':_0x4c6e88[_0xd242('0x4d')]['id']}})[_0xd242('0x27')](handleEntityNotFound(_0x5a9622,null))[_0xd242('0x27')](function(_0x58d2e5){if(_0x58d2e5){return _0x58d2e5[_0xd242('0xb3')](_0x4c6e88[_0xd242('0x3b')]['ids']);}})[_0xd242('0x27')](function(_0x1704db){if(_0x1704db){return db[_0xd242('0x67')][_0xd242('0x28')]({'where':{'ListId':_0x4c6e88['query'][_0xd242('0x7e')],'VoiceQueueId':_0x4c6e88[_0xd242('0x4d')]['id']}})['then'](function(){return _0x1704db;});}})[_0xd242('0x27')](respondWithStatusCode(_0x5a9622,null))[_0xd242('0x4c')](handleError(_0x5a9622,null));}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.events.js b/server/api/voiceQueue/voiceQueue.events.js index 59e8a9d..f671a9e 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 _0xd748=['setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports','events','VoiceQueue'];(function(_0x41b29e,_0x34b288){var _0xacd517=function(_0x3318df){while(--_0x3318df){_0x41b29e['push'](_0x41b29e['shift']());}};_0xacd517(++_0x34b288);}(_0xd748,0x184));var _0x8d74=function(_0x29d94e,_0xf386d6){_0x29d94e=_0x29d94e-0x0;var _0x106237=_0xd748[_0x29d94e];return _0x106237;};'use strict';var EventEmitter=require(_0x8d74('0x0'));var VoiceQueue=require('../../mysqldb')['db'][_0x8d74('0x1')];var VoiceQueueEvents=new EventEmitter();VoiceQueueEvents[_0x8d74('0x2')](0x0);var events={'afterCreate':_0x8d74('0x3'),'afterUpdate':_0x8d74('0x4'),'afterDestroy':_0x8d74('0x5')};function emitEvent(_0x4d75c8){return function(_0x3b3d21,_0xd5e7d0,_0x23157a){VoiceQueueEvents[_0x8d74('0x6')](_0x4d75c8+':'+_0x3b3d21['id'],_0x3b3d21);VoiceQueueEvents[_0x8d74('0x6')](_0x4d75c8,_0x3b3d21);_0x23157a(null);};}for(var e in events){if(events[_0x8d74('0x7')](e)){var event=events[e];VoiceQueue[_0x8d74('0x8')](e,emitEvent(event));}}module[_0x8d74('0x9')]=VoiceQueueEvents; \ No newline at end of file +var _0xfd50=['hasOwnProperty','events','../../mysqldb','VoiceQueue','setMaxListeners','save','update','remove','emit'];(function(_0x54d782,_0x1ff092){var _0x24bbbb=function(_0x49fd2d){while(--_0x49fd2d){_0x54d782['push'](_0x54d782['shift']());}};_0x24bbbb(++_0x1ff092);}(_0xfd50,0x160));var _0x0fd5=function(_0x4914e2,_0x48be8f){_0x4914e2=_0x4914e2-0x0;var _0x2dcd07=_0xfd50[_0x4914e2];return _0x2dcd07;};'use strict';var EventEmitter=require(_0x0fd5('0x0'));var VoiceQueue=require(_0x0fd5('0x1'))['db'][_0x0fd5('0x2')];var VoiceQueueEvents=new EventEmitter();VoiceQueueEvents[_0x0fd5('0x3')](0x0);var events={'afterCreate':_0x0fd5('0x4'),'afterUpdate':_0x0fd5('0x5'),'afterDestroy':_0x0fd5('0x6')};function emitEvent(_0x12c888){return function(_0x366031,_0x11f267,_0xeb967){VoiceQueueEvents[_0x0fd5('0x7')](_0x12c888+':'+_0x366031['id'],_0x366031);VoiceQueueEvents[_0x0fd5('0x7')](_0x12c888,_0x366031);_0xeb967(null);};}for(var e in events){if(events[_0x0fd5('0x8')](e)){var event=events[e];VoiceQueue['hook'](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 e3a3574..63a9d19 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 _0xd479=['define','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./voiceQueue.attributes','exports'];(function(_0x236bd0,_0x131bc9){var _0x16a5da=function(_0x2dab7f){while(--_0x2dab7f){_0x236bd0['push'](_0x236bd0['shift']());}};_0x16a5da(++_0x131bc9);}(_0xd479,0xc1));var _0x9d47=function(_0x23a103,_0x2a4072){_0x23a103=_0x23a103-0x0;var _0x3f8fe7=_0xd479[_0x23a103];return _0x3f8fe7;};'use strict';var _=require(_0x9d47('0x0'));var util=require('util');var logger=require(_0x9d47('0x1'))(_0x9d47('0x2'));var moment=require(_0x9d47('0x3'));var BPromise=require(_0x9d47('0x4'));var rp=require(_0x9d47('0x5'));var fs=require('fs');var path=require(_0x9d47('0x6'));var rimraf=require(_0x9d47('0x7'));var config=require(_0x9d47('0x8'));var attributes=require(_0x9d47('0x9'));module[_0x9d47('0xa')]=function(_0x5b5118,_0x1bc51e){return _0x5b5118[_0x9d47('0xb')]('VoiceQueue',attributes,{'tableName':'voice_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x35ce=['exports','define','voice_queues','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./voiceQueue.attributes'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x35ce,0x15f));var _0xe35c=function(_0x3d38ae,_0x51102b){_0x3d38ae=_0x3d38ae-0x0;var _0x3757ee=_0x35ce[_0x3d38ae];return _0x3757ee;};'use strict';var _=require('lodash');var util=require(_0xe35c('0x0'));var logger=require(_0xe35c('0x1'))(_0xe35c('0x2'));var moment=require(_0xe35c('0x3'));var BPromise=require(_0xe35c('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xe35c('0x5'));var rimraf=require(_0xe35c('0x6'));var config=require(_0xe35c('0x7'));var attributes=require(_0xe35c('0x8'));module[_0xe35c('0x9')]=function(_0x584550,_0x14dcbd){return _0x584550[_0xe35c('0xa')]('VoiceQueue',attributes,{'tableName':_0xe35c('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.rpc.js b/server/api/voiceQueue/voiceQueue.rpc.js index 8bc4d75..e70c5f4 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 _0x174b=['../../config/environment','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','./voiceQueue.socket','request','then','info','VoiceQueue,\x20%s,\x20%s','request\x20sent','debug','VoiceQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetVoiceQueue','VoiceQueue','options','raw','where','attributes','limit','include','map','model','ShowVoiceQueue','find','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x2a56dc,_0x3d9117){var _0x5f465f=function(_0xb64e42){while(--_0xb64e42){_0x2a56dc['push'](_0x2a56dc['shift']());}};_0x5f465f(++_0x3d9117);}(_0x174b,0x1d9));var _0xb174=function(_0x3cfec4,_0x1c77c7){_0x3cfec4=_0x3cfec4-0x0;var _0x160f64=_0x174b[_0x3cfec4];return _0x160f64;};'use strict';var _=require('lodash');var util=require(_0xb174('0x0'));var moment=require(_0xb174('0x1'));var BPromise=require(_0xb174('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb174('0x3'))['db'];var utils=require(_0xb174('0x4'));var logger=require(_0xb174('0x5'))(_0xb174('0x6'));var config=require(_0xb174('0x7'));var jayson=require(_0xb174('0x8'));var client=jayson['client'][_0xb174('0x9')]({'port':0x232a});config[_0xb174('0xa')]=_[_0xb174('0xb')](config[_0xb174('0xa')],{'host':_0xb174('0xc'),'port':0x18eb});var socket=require(_0xb174('0xd'))(new Redis(config[_0xb174('0xa')]));require(_0xb174('0xe'))['register'](socket);function respondWithRpcPromise(_0x2d9501,_0x2da92d,_0x36fef7){return new BPromise(function(_0x6b134,_0x3f39ec){return client[_0xb174('0xf')](_0x2d9501,_0x36fef7)[_0xb174('0x10')](function(_0xc3ce50){logger[_0xb174('0x11')](_0xb174('0x12'),_0x2da92d,_0xb174('0x13'));logger[_0xb174('0x14')](_0xb174('0x15'),_0x2da92d,_0xb174('0x13'),JSON[_0xb174('0x16')](_0xc3ce50));if(_0xc3ce50[_0xb174('0x17')]){if(_0xc3ce50[_0xb174('0x17')][_0xb174('0x18')]===0x1f4){logger['error']('VoiceQueue,\x20%s,\x20%s',_0x2da92d,_0xc3ce50['error']['message']);return _0x3f39ec(_0xc3ce50[_0xb174('0x17')]['message']);}logger[_0xb174('0x17')](_0xb174('0x12'),_0x2da92d,_0xc3ce50['error'][_0xb174('0x19')]);return _0x6b134(_0xc3ce50['error'][_0xb174('0x19')]);}else{logger['info'](_0xb174('0x12'),_0x2da92d,_0xb174('0x13'));_0x6b134(_0xc3ce50[_0xb174('0x1a')][_0xb174('0x19')]);}})[_0xb174('0x1b')](function(_0x6567f2){logger[_0xb174('0x17')](_0xb174('0x12'),_0x2da92d,_0x6567f2);_0x3f39ec(_0x6567f2);});});}exports[_0xb174('0x1c')]=function(_0x55b6e6){var _0x5f24b2=this;return new Promise(function(_0x152292,_0x255070){return db[_0xb174('0x1d')]['findAll']({'raw':_0x55b6e6[_0xb174('0x1e')]?_0x55b6e6[_0xb174('0x1e')][_0xb174('0x1f')]===undefined?!![]:![]:!![],'where':_0x55b6e6[_0xb174('0x1e')]?_0x55b6e6[_0xb174('0x1e')][_0xb174('0x20')]||null:null,'attributes':_0x55b6e6[_0xb174('0x1e')]?_0x55b6e6[_0xb174('0x1e')][_0xb174('0x21')]||null:null,'limit':_0x55b6e6['options']?_0x55b6e6['options'][_0xb174('0x22')]||null:null,'include':_0x55b6e6[_0xb174('0x1e')]?_0x55b6e6[_0xb174('0x1e')][_0xb174('0x23')]?_[_0xb174('0x24')](_0x55b6e6[_0xb174('0x1e')]['include'],function(_0x69da9d){return{'model':db[_0x69da9d[_0xb174('0x25')]],'as':_0x69da9d['as'],'attributes':_0x69da9d[_0xb174('0x21')],'include':_0x69da9d['include']?_['map'](_0x69da9d['include'],function(_0x4a12be){return{'model':db[_0x4a12be['model']],'as':_0x4a12be['as'],'attributes':_0x4a12be[_0xb174('0x21')],'include':_0x4a12be[_0xb174('0x23')]?_['map'](_0x4a12be[_0xb174('0x23')],function(_0xc5ce15){return{'model':db[_0xc5ce15[_0xb174('0x25')]],'as':_0xc5ce15['as'],'attributes':_0xc5ce15[_0xb174('0x21')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x16b405){logger[_0xb174('0x11')]('GetVoiceQueue',_0x55b6e6);logger[_0xb174('0x14')](_0xb174('0x1c'),_0x55b6e6,JSON[_0xb174('0x16')](_0x16b405));_0x152292(_0x16b405);})[_0xb174('0x1b')](function(_0x1c4434){logger['error']('GetVoiceQueue',_0x1c4434[_0xb174('0x19')],_0x55b6e6);_0x255070(_0x5f24b2[_0xb174('0x17')](0x1f4,_0x1c4434['message']));});});};exports[_0xb174('0x26')]=function(_0x27a4c5){var _0x1bb9db=this;return new Promise(function(_0x777c65,_0x1087ae){return db[_0xb174('0x1d')][_0xb174('0x27')]({'raw':_0x27a4c5['options']?_0x27a4c5['options'][_0xb174('0x1f')]===undefined?!![]:![]:!![],'where':_0x27a4c5['options']?_0x27a4c5[_0xb174('0x1e')][_0xb174('0x20')]||null:null,'attributes':_0x27a4c5[_0xb174('0x1e')]?_0x27a4c5[_0xb174('0x1e')][_0xb174('0x21')]||null:null,'include':_0x27a4c5['options']?_0x27a4c5[_0xb174('0x1e')]['include']?_['map'](_0x27a4c5[_0xb174('0x1e')][_0xb174('0x23')],function(_0x10d232){return{'model':db[_0x10d232['model']],'as':_0x10d232['as'],'attributes':_0x10d232[_0xb174('0x21')],'include':_0x10d232[_0xb174('0x23')]?_[_0xb174('0x24')](_0x10d232[_0xb174('0x23')],function(_0x1239ac){return{'model':db[_0x1239ac[_0xb174('0x25')]],'as':_0x1239ac['as'],'attributes':_0x1239ac[_0xb174('0x21')],'include':_0x1239ac[_0xb174('0x23')]?_[_0xb174('0x24')](_0x1239ac[_0xb174('0x23')],function(_0x284362){return{'model':db[_0x284362[_0xb174('0x25')]],'as':_0x284362['as'],'attributes':_0x284362[_0xb174('0x21')]};}):[]};}):[]};}):[]:[]})[_0xb174('0x10')](function(_0x57999d){logger['info'](_0xb174('0x26'),_0x27a4c5);logger[_0xb174('0x14')](_0xb174('0x26'),_0x27a4c5,JSON['stringify'](_0x57999d));_0x777c65(_0x57999d);})['catch'](function(_0x3299bd){logger[_0xb174('0x17')]('ShowVoiceQueue',_0x3299bd['message'],_0x27a4c5);_0x1087ae(_0x1bb9db[_0xb174('0x17')](0x1f4,_0x3299bd[_0xb174('0x19')]));});});}; \ No newline at end of file +var _0x6780=['stringify','error','code','message','result','catch','options','raw','attributes','limit','include','model','map','debug','GetVoiceQueue','ShowVoiceQueue','VoiceQueue','where','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','redis','register','request','then','info','VoiceQueue,\x20%s,\x20%s','VoiceQueue,\x20%s,\x20%s,\x20%s','request\x20sent'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0x6780,0x81));var _0x0678=function(_0x11c871,_0x74b0ba){_0x11c871=_0x11c871-0x0;var _0x4fcc7e=_0x6780[_0x11c871];return _0x4fcc7e;};'use strict';var _=require(_0x0678('0x0'));var util=require(_0x0678('0x1'));var moment=require(_0x0678('0x2'));var BPromise=require('bluebird');var rs=require(_0x0678('0x3'));var fs=require('fs');var Redis=require(_0x0678('0x4'));var db=require(_0x0678('0x5'))['db'];var utils=require(_0x0678('0x6'));var logger=require(_0x0678('0x7'))('rpc');var config=require(_0x0678('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x0678('0x9')][_0x0678('0xa')]({'port':0x232a});config['redis']=_['defaults'](config[_0x0678('0xb')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x0678('0xb')]));require('./voiceQueue.socket')[_0x0678('0xc')](socket);function respondWithRpcPromise(_0xaac680,_0x2e0347,_0x45ef91){return new BPromise(function(_0x1e8e84,_0x3ac000){return client[_0x0678('0xd')](_0xaac680,_0x45ef91)[_0x0678('0xe')](function(_0x252ce4){logger[_0x0678('0xf')](_0x0678('0x10'),_0x2e0347,'request\x20sent');logger['debug'](_0x0678('0x11'),_0x2e0347,_0x0678('0x12'),JSON[_0x0678('0x13')](_0x252ce4));if(_0x252ce4[_0x0678('0x14')]){if(_0x252ce4[_0x0678('0x14')][_0x0678('0x15')]===0x1f4){logger['error'](_0x0678('0x10'),_0x2e0347,_0x252ce4[_0x0678('0x14')][_0x0678('0x16')]);return _0x3ac000(_0x252ce4[_0x0678('0x14')][_0x0678('0x16')]);}logger['error']('VoiceQueue,\x20%s,\x20%s',_0x2e0347,_0x252ce4[_0x0678('0x14')][_0x0678('0x16')]);return _0x1e8e84(_0x252ce4[_0x0678('0x14')][_0x0678('0x16')]);}else{logger[_0x0678('0xf')](_0x0678('0x10'),_0x2e0347,_0x0678('0x12'));_0x1e8e84(_0x252ce4[_0x0678('0x17')][_0x0678('0x16')]);}})[_0x0678('0x18')](function(_0x40a25b){logger[_0x0678('0x14')](_0x0678('0x10'),_0x2e0347,_0x40a25b);_0x3ac000(_0x40a25b);});});}exports['GetVoiceQueue']=function(_0x4c296b){var _0x1116ab=this;return new Promise(function(_0x577b4,_0x3dea20){return db['VoiceQueue']['findAll']({'raw':_0x4c296b[_0x0678('0x19')]?_0x4c296b['options'][_0x0678('0x1a')]===undefined?!![]:![]:!![],'where':_0x4c296b[_0x0678('0x19')]?_0x4c296b['options']['where']||null:null,'attributes':_0x4c296b['options']?_0x4c296b[_0x0678('0x19')][_0x0678('0x1b')]||null:null,'limit':_0x4c296b[_0x0678('0x19')]?_0x4c296b[_0x0678('0x19')][_0x0678('0x1c')]||null:null,'include':_0x4c296b['options']?_0x4c296b['options'][_0x0678('0x1d')]?_['map'](_0x4c296b[_0x0678('0x19')]['include'],function(_0x4ca4ca){return{'model':db[_0x4ca4ca[_0x0678('0x1e')]],'as':_0x4ca4ca['as'],'attributes':_0x4ca4ca[_0x0678('0x1b')],'include':_0x4ca4ca[_0x0678('0x1d')]?_[_0x0678('0x1f')](_0x4ca4ca['include'],function(_0x4c15fa){return{'model':db[_0x4c15fa['model']],'as':_0x4c15fa['as'],'attributes':_0x4c15fa[_0x0678('0x1b')],'include':_0x4c15fa[_0x0678('0x1d')]?_[_0x0678('0x1f')](_0x4c15fa['include'],function(_0xd8a184){return{'model':db[_0xd8a184[_0x0678('0x1e')]],'as':_0xd8a184['as'],'attributes':_0xd8a184[_0x0678('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x0678('0xe')](function(_0x1659e2){logger[_0x0678('0xf')]('GetVoiceQueue',_0x4c296b);logger[_0x0678('0x20')](_0x0678('0x21'),_0x4c296b,JSON[_0x0678('0x13')](_0x1659e2));_0x577b4(_0x1659e2);})[_0x0678('0x18')](function(_0x232ed1){logger['error']('GetVoiceQueue',_0x232ed1[_0x0678('0x16')],_0x4c296b);_0x3dea20(_0x1116ab['error'](0x1f4,_0x232ed1['message']));});});};exports[_0x0678('0x22')]=function(_0xfa0015){var _0x94163f=this;return new Promise(function(_0x5abf46,_0x184b92){return db[_0x0678('0x23')]['find']({'raw':_0xfa0015[_0x0678('0x19')]?_0xfa0015[_0x0678('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0xfa0015[_0x0678('0x19')]?_0xfa0015[_0x0678('0x19')][_0x0678('0x24')]||null:null,'attributes':_0xfa0015[_0x0678('0x19')]?_0xfa0015[_0x0678('0x19')][_0x0678('0x1b')]||null:null,'include':_0xfa0015[_0x0678('0x19')]?_0xfa0015[_0x0678('0x19')][_0x0678('0x1d')]?_[_0x0678('0x1f')](_0xfa0015['options']['include'],function(_0x2d3d8d){return{'model':db[_0x2d3d8d['model']],'as':_0x2d3d8d['as'],'attributes':_0x2d3d8d[_0x0678('0x1b')],'include':_0x2d3d8d['include']?_[_0x0678('0x1f')](_0x2d3d8d[_0x0678('0x1d')],function(_0x601c6b){return{'model':db[_0x601c6b['model']],'as':_0x601c6b['as'],'attributes':_0x601c6b['attributes'],'include':_0x601c6b['include']?_[_0x0678('0x1f')](_0x601c6b[_0x0678('0x1d')],function(_0x3ad6f0){return{'model':db[_0x3ad6f0[_0x0678('0x1e')]],'as':_0x3ad6f0['as'],'attributes':_0x3ad6f0[_0x0678('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x0678('0xe')](function(_0x163a6e){logger[_0x0678('0xf')](_0x0678('0x22'),_0xfa0015);logger['debug'](_0x0678('0x22'),_0xfa0015,JSON[_0x0678('0x13')](_0x163a6e));_0x5abf46(_0x163a6e);})[_0x0678('0x18')](function(_0x36b87f){logger[_0x0678('0x14')](_0x0678('0x22'),_0x36b87f[_0x0678('0x16')],_0xfa0015);_0x184b92(_0x94163f['error'](0x1f4,_0x36b87f[_0x0678('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.socket.js b/server/api/voiceQueue/voiceQueue.socket.js index 60f2327..7568d16 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 _0xe008=['update','removeListener','register','length','remove'];(function(_0x30f1aa,_0x4caac6){var _0x27ea5f=function(_0x5ea439){while(--_0x5ea439){_0x30f1aa['push'](_0x30f1aa['shift']());}};_0x27ea5f(++_0x4caac6);}(_0xe008,0xcc));var _0x8e00=function(_0x44a80f,_0x4e23cb){_0x44a80f=_0x44a80f-0x0;var _0x34ed16=_0xe008[_0x44a80f];return _0x34ed16;};'use strict';var VoiceQueueEvents=require('./voiceQueue.events');var events=['save',_0x8e00('0x0'),_0x8e00('0x1')];function createListener(_0x42d683,_0x420621){return function(_0x45012f){_0x420621['emit'](_0x42d683,_0x45012f);};}function removeListener(_0x579641,_0x416494){return function(){VoiceQueueEvents[_0x8e00('0x2')](_0x579641,_0x416494);};}exports[_0x8e00('0x3')]=function(_0x328a68){for(var _0x34e7fe=0x0,_0x1b9c06=events[_0x8e00('0x4')];_0x34e7fe<_0x1b9c06;_0x34e7fe++){var _0x3975b4=events[_0x34e7fe];var _0x101d2b=createListener('voiceQueue:'+_0x3975b4,_0x328a68);VoiceQueueEvents['on'](_0x3975b4,_0x101d2b);}}; \ No newline at end of file +var _0x09ac=['update','emit','removeListener','register','length','save','remove'];(function(_0x3e2583,_0x57051c){var _0x574b35=function(_0x4da108){while(--_0x4da108){_0x3e2583['push'](_0x3e2583['shift']());}};_0x574b35(++_0x57051c);}(_0x09ac,0x14e));var _0xc09a=function(_0x160b71,_0x2ed489){_0x160b71=_0x160b71-0x0;var _0x32a6e1=_0x09ac[_0x160b71];return _0x32a6e1;};'use strict';var VoiceQueueEvents=require('./voiceQueue.events');var events=[_0xc09a('0x0'),_0xc09a('0x1'),_0xc09a('0x2')];function createListener(_0x4dca9d,_0x40247f){return function(_0x405d0f){_0x40247f[_0xc09a('0x3')](_0x4dca9d,_0x405d0f);};}function removeListener(_0x20d348,_0x556afc){return function(){VoiceQueueEvents[_0xc09a('0x4')](_0x20d348,_0x556afc);};}exports[_0xc09a('0x5')]=function(_0x4ab14a){for(var _0x4992d3=0x0,_0x5db0b9=events[_0xc09a('0x6')];_0x4992d3<_0x5db0b9;_0x4992d3++){var _0x3c5c92=events[_0x4992d3];var _0x142dc7=createListener('voiceQueue:'+_0x3c5c92,_0x4ab14a);VoiceQueueEvents['on'](_0x3c5c92,_0x142dc7);}}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/index.js b/server/api/voiceQueueReport/index.js index 65675a6..a212b26 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 _0x2581=['express','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceQueueReport.controller','get','isAuthenticated','index','describe','/index','getVoiceQueuesReport','show','post','create','/:id','update','delete','destroy','exports','multer','util','path','connect-timeout'];(function(_0x42f7d1,_0x196c39){var _0x33ecba=function(_0x543d99){while(--_0x543d99){_0x42f7d1['push'](_0x42f7d1['shift']());}};_0x33ecba(++_0x196c39);}(_0x2581,0xcb));var _0x1258=function(_0x3a41a1,_0x1d954b){_0x3a41a1=_0x3a41a1-0x0;var _0x33455f=_0x2581[_0x3a41a1];return _0x33455f;};'use strict';var multer=require(_0x1258('0x0'));var util=require(_0x1258('0x1'));var path=require(_0x1258('0x2'));var timeout=require(_0x1258('0x3'));var express=require(_0x1258('0x4'));var router=express['Router']();var auth=require(_0x1258('0x5'));var interaction=require(_0x1258('0x6'));var config=require(_0x1258('0x7'));var controller=require(_0x1258('0x8'));router[_0x1258('0x9')]('/',auth[_0x1258('0xa')](),controller[_0x1258('0xb')]);router[_0x1258('0x9')]('/describe',auth[_0x1258('0xa')](),controller[_0x1258('0xc')]);router[_0x1258('0x9')](_0x1258('0xd'),auth[_0x1258('0xa')](),controller[_0x1258('0xe')]);router[_0x1258('0x9')]('/:id',auth['isAuthenticated'](),controller[_0x1258('0xf')]);router[_0x1258('0x10')]('/',auth[_0x1258('0xa')](),controller[_0x1258('0x11')]);router['put'](_0x1258('0x12'),auth[_0x1258('0xa')](),controller[_0x1258('0x13')]);router[_0x1258('0x14')]('/:id',auth[_0x1258('0xa')](),controller[_0x1258('0x15')]);module[_0x1258('0x16')]=router; \ No newline at end of file +var _0x3fa4=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceQueueReport.controller','get','index','/describe','describe','/index','getVoiceQueuesReport','show','post','isAuthenticated','create','put','update','delete','destroy','exports','multer','express'];(function(_0x95e21a,_0x5bda41){var _0x2165d4=function(_0x4c4524){while(--_0x4c4524){_0x95e21a['push'](_0x95e21a['shift']());}};_0x2165d4(++_0x5bda41);}(_0x3fa4,0xf0));var _0x43fa=function(_0x9520a5,_0x2849cc){_0x9520a5=_0x9520a5-0x0;var _0x228795=_0x3fa4[_0x9520a5];return _0x228795;};'use strict';var multer=require(_0x43fa('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0x43fa('0x1'));var router=express[_0x43fa('0x2')]();var auth=require(_0x43fa('0x3'));var interaction=require(_0x43fa('0x4'));var config=require(_0x43fa('0x5'));var controller=require(_0x43fa('0x6'));router[_0x43fa('0x7')]('/',auth['isAuthenticated'](),controller[_0x43fa('0x8')]);router[_0x43fa('0x7')](_0x43fa('0x9'),auth['isAuthenticated'](),controller[_0x43fa('0xa')]);router[_0x43fa('0x7')](_0x43fa('0xb'),auth['isAuthenticated'](),controller[_0x43fa('0xc')]);router[_0x43fa('0x7')]('/:id',auth['isAuthenticated'](),controller[_0x43fa('0xd')]);router[_0x43fa('0xe')]('/',auth[_0x43fa('0xf')](),controller[_0x43fa('0x10')]);router[_0x43fa('0x11')]('/:id',auth[_0x43fa('0xf')](),controller[_0x43fa('0x12')]);router[_0x43fa('0x13')]('/:id',auth[_0x43fa('0xf')](),controller[_0x43fa('0x14')]);module[_0x43fa('0x15')]=router; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.attributes.js b/server/api/voiceQueueReport/voiceQueueReport.attributes.js index 00854e4..5817b0a 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 _0x9402=['queuecallerleaveAt','holdtime','INTEGER','BOOLEAN','DATE','sequelize','moment','exports','STRING','queuecallerjoinAt','format','YYYY-MM-DD\x20HH:mm:ss','diff','seconds','setDataValue'];(function(_0x4623fa,_0xbdecc8){var _0x2714b3=function(_0x5e55c4){while(--_0x5e55c4){_0x4623fa['push'](_0x4623fa['shift']());}};_0x2714b3(++_0xbdecc8);}(_0x9402,0x14f));var _0x2940=function(_0x43d97b,_0x27951f){_0x43d97b=_0x43d97b-0x0;var _0x3ccced=_0x9402[_0x43d97b];return _0x3ccced;};'use strict';var Sequelize=require(_0x2940('0x0'));var moment=require(_0x2940('0x1'));module[_0x2940('0x2')]={'type':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize[_0x2940('0x3')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x2940('0x3')]},'queue':{'type':Sequelize[_0x2940('0x3')]},'queuecallerjoinAt':{'type':Sequelize['DATE']},'queuecallerleaveAt':{'type':Sequelize['DATE'],'set':function(_0x2e249d){var _0x5233a1=moment(_0x2e249d);var _0x434e0d=moment(this['getDataValue'](_0x2940('0x4')))[_0x2940('0x5')](_0x2940('0x6'));var _0x50107d=_0x5233a1[_0x2940('0x7')](_0x434e0d,_0x2940('0x8'));this[_0x2940('0x9')](_0x2940('0xa'),_0x2e249d);this[_0x2940('0x9')](_0x2940('0xb'),_0x50107d||null);}},'position':{'type':Sequelize[_0x2940('0xc')]},'count':{'type':Sequelize[_0x2940('0xc')]},'queuecallerabandon':{'type':Sequelize[_0x2940('0xd')],'defaultValue':![]},'queuecallerabandonAt':{'type':Sequelize[_0x2940('0xe')]},'queuecallercomplete':{'type':Sequelize[_0x2940('0xd')],'defaultValue':![]},'queuecallercompleteAt':{'type':Sequelize[_0x2940('0xe')]},'queuecallerexit':{'type':Sequelize[_0x2940('0xd')],'defaultValue':![]},'queuecallerexitAt':{'type':Sequelize[_0x2940('0xe')]},'queuecallerexitreason':{'type':Sequelize['STRING'],'comment':'COMPLETEDBYCALLER,\x20COMPLETEDBYAGENT,\x20FORWARDTRANFER,\x20BLINDTRANSFER,\x20ATTENDEDTRANSFER,\x20EXITWITHKEY,\x20TIMEOUT'},'originalposition':{'type':Sequelize[_0x2940('0xc')]},'channel':{'type':Sequelize[_0x2940('0x3')]},'connectedlinenum':{'type':Sequelize['STRING']},'connectedlinename':{'type':Sequelize[_0x2940('0x3')]},'accountcode':{'type':Sequelize[_0x2940('0x3')]},'context':{'type':Sequelize[_0x2940('0x3')]},'exten':{'type':Sequelize[_0x2940('0x3')]},'priority':{'type':Sequelize[_0x2940('0x3')]},'holdtime':{'type':Sequelize[_0x2940('0xc')]},'mohtime':{'type':Sequelize[_0x2940('0xc')],'defaultValue':0x0},'assigned':{'type':Sequelize[_0x2940('0xd')],'defaultValue':![]},'lastAssignedTo':{'type':Sequelize[_0x2940('0x3')]},'transfer':{'type':Sequelize[_0x2940('0xd')],'defaultValue':![]},'transfertype':{'type':Sequelize[_0x2940('0x3')],'comment':'FORWARD,\x20BLIND,\x20ATTENDED'},'transferexten':{'type':Sequelize[_0x2940('0x3')]},'transferuniqueid':{'type':Sequelize[_0x2940('0x3')]},'disposition':{'type':Sequelize[_0x2940('0x3')]},'queuecallerenterreason':{'type':Sequelize[_0x2940('0xc')],'defaultValue':0x0}}; \ No newline at end of file +var _0xe2ec=['sequelize','moment','exports','STRING','DATE','getDataValue','YYYY-MM-DD\x20HH:mm:ss','diff','seconds','setDataValue','holdtime','INTEGER','BOOLEAN','COMPLETEDBYCALLER,\x20COMPLETEDBYAGENT,\x20FORWARDTRANFER,\x20BLINDTRANSFER,\x20ATTENDEDTRANSFER,\x20EXITWITHKEY,\x20TIMEOUT','FORWARD,\x20BLIND,\x20ATTENDED'];(function(_0x42c790,_0x34d709){var _0x487bb8=function(_0x3362e9){while(--_0x3362e9){_0x42c790['push'](_0x42c790['shift']());}};_0x487bb8(++_0x34d709);}(_0xe2ec,0xe1));var _0xce2e=function(_0x297fd3,_0x115406){_0x297fd3=_0x297fd3-0x0;var _0x2af381=_0xe2ec[_0x297fd3];return _0x2af381;};'use strict';var Sequelize=require(_0xce2e('0x0'));var moment=require(_0xce2e('0x1'));module[_0xce2e('0x2')]={'type':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize[_0xce2e('0x3')]},'calleridnum':{'type':Sequelize[_0xce2e('0x3')]},'calleridname':{'type':Sequelize[_0xce2e('0x3')]},'queue':{'type':Sequelize[_0xce2e('0x3')]},'queuecallerjoinAt':{'type':Sequelize[_0xce2e('0x4')]},'queuecallerleaveAt':{'type':Sequelize[_0xce2e('0x4')],'set':function(_0x6b07a4){var _0x2f2e4f=moment(_0x6b07a4);var _0xf1d341=moment(this[_0xce2e('0x5')]('queuecallerjoinAt'))['format'](_0xce2e('0x6'));var _0x2fe03d=_0x2f2e4f[_0xce2e('0x7')](_0xf1d341,_0xce2e('0x8'));this[_0xce2e('0x9')]('queuecallerleaveAt',_0x6b07a4);this[_0xce2e('0x9')](_0xce2e('0xa'),_0x2fe03d||null);}},'position':{'type':Sequelize[_0xce2e('0xb')]},'count':{'type':Sequelize[_0xce2e('0xb')]},'queuecallerabandon':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queuecallerabandonAt':{'type':Sequelize['DATE']},'queuecallercomplete':{'type':Sequelize[_0xce2e('0xc')],'defaultValue':![]},'queuecallercompleteAt':{'type':Sequelize[_0xce2e('0x4')]},'queuecallerexit':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queuecallerexitAt':{'type':Sequelize[_0xce2e('0x4')]},'queuecallerexitreason':{'type':Sequelize[_0xce2e('0x3')],'comment':_0xce2e('0xd')},'originalposition':{'type':Sequelize[_0xce2e('0xb')]},'channel':{'type':Sequelize['STRING']},'connectedlinenum':{'type':Sequelize[_0xce2e('0x3')]},'connectedlinename':{'type':Sequelize[_0xce2e('0x3')]},'accountcode':{'type':Sequelize[_0xce2e('0x3')]},'context':{'type':Sequelize[_0xce2e('0x3')]},'exten':{'type':Sequelize['STRING']},'priority':{'type':Sequelize[_0xce2e('0x3')]},'holdtime':{'type':Sequelize[_0xce2e('0xb')]},'mohtime':{'type':Sequelize[_0xce2e('0xb')],'defaultValue':0x0},'assigned':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'lastAssignedTo':{'type':Sequelize[_0xce2e('0x3')]},'transfer':{'type':Sequelize[_0xce2e('0xc')],'defaultValue':![]},'transfertype':{'type':Sequelize[_0xce2e('0x3')],'comment':_0xce2e('0xe')},'transferexten':{'type':Sequelize[_0xce2e('0x3')]},'transferuniqueid':{'type':Sequelize[_0xce2e('0x3')]},'disposition':{'type':Sequelize[_0xce2e('0x3')]},'queuecallerenterreason':{'type':Sequelize[_0xce2e('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 2d391c8..431d0e9 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 _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(_0x934425,_0x5af72f){var _0x31d596=function(_0x219869){while(--_0x219869){_0x934425['push'](_0x934425['shift']());}};_0x31d596(++_0x5af72f);}(_0x9957,0x93));var _0x7995=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0x9957[_0x6131cd];return _0x47e916;};'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 +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(_0x1a72f3,_0x217011){var _0x57ef47=function(_0x20123d){while(--_0x20123d){_0x1a72f3['push'](_0x1a72f3['shift']());}};_0x57ef47(++_0x217011);}(_0x7a54,0x106));var _0x47a5=function(_0x202267,_0x2f8479){_0x202267=_0x202267-0x0;var _0x289389=_0x7a54[_0x202267];return _0x289389;};'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 diff --git a/server/api/voiceQueueReport/voiceQueueReport.events.js b/server/api/voiceQueueReport/voiceQueueReport.events.js index 63d3558..6e2df84 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 _0x35d8=['exports','save','update','emit','hook'];(function(_0x2ebbdf,_0x46334b){var _0x421c66=function(_0x29456a){while(--_0x29456a){_0x2ebbdf['push'](_0x2ebbdf['shift']());}};_0x421c66(++_0x46334b);}(_0x35d8,0xc4));var _0x835d=function(_0x322da3,_0xb412d7){_0x322da3=_0x322da3-0x0;var _0x1f303d=_0x35d8[_0x322da3];return _0x1f303d;};'use strict';var EventEmitter=require('events');var VoiceQueueReport=require('../../mysqldb')['db']['VoiceQueueReport'];var VoiceQueueReportEvents=new EventEmitter();VoiceQueueReportEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x835d('0x0'),'afterUpdate':_0x835d('0x1'),'afterDestroy':'remove'};function emitEvent(_0x1f5fd0){return function(_0x4be49e,_0x29f2ef,_0x30dc7c){VoiceQueueReportEvents[_0x835d('0x2')](_0x1f5fd0+':'+_0x4be49e['id'],_0x4be49e);VoiceQueueReportEvents['emit'](_0x1f5fd0,_0x4be49e);_0x30dc7c(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];VoiceQueueReport[_0x835d('0x3')](e,emitEvent(event));}}module[_0x835d('0x4')]=VoiceQueueReportEvents; \ No newline at end of file +var _0x93c5=['hook','exports','events','VoiceQueueReport','setMaxListeners','save','update','remove','emit','hasOwnProperty'];(function(_0xe6f6be,_0x4fa9a9){var _0x2e88b6=function(_0x57836f){while(--_0x57836f){_0xe6f6be['push'](_0xe6f6be['shift']());}};_0x2e88b6(++_0x4fa9a9);}(_0x93c5,0x16a));var _0x593c=function(_0x16d10f,_0x2ba2d5){_0x16d10f=_0x16d10f-0x0;var _0x50c823=_0x93c5[_0x16d10f];return _0x50c823;};'use strict';var EventEmitter=require(_0x593c('0x0'));var VoiceQueueReport=require('../../mysqldb')['db'][_0x593c('0x1')];var VoiceQueueReportEvents=new EventEmitter();VoiceQueueReportEvents[_0x593c('0x2')](0x0);var events={'afterCreate':_0x593c('0x3'),'afterUpdate':_0x593c('0x4'),'afterDestroy':_0x593c('0x5')};function emitEvent(_0x10bbab){return function(_0x13c4dc,_0x539f51,_0x418a5b){VoiceQueueReportEvents[_0x593c('0x6')](_0x10bbab+':'+_0x13c4dc['id'],_0x13c4dc);VoiceQueueReportEvents['emit'](_0x10bbab,_0x13c4dc);_0x418a5b(null);};}for(var e in events){if(events[_0x593c('0x7')](e)){var event=events[e];VoiceQueueReport[_0x593c('0x8')](e,emitEvent(event));}}module[_0x593c('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 c9158f5..e4950a0 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 _0x6f5b=['define','VoiceQueueReport','report_queue','calleridnum','lodash','moment','bluebird','request-promise','path','rimraf','../../config/environment','./voiceQueueReport.attributes','exports'];(function(_0xa0f69c,_0x2b07e8){var _0x540f04=function(_0x4c3866){while(--_0x4c3866){_0xa0f69c['push'](_0xa0f69c['shift']());}};_0x540f04(++_0x2b07e8);}(_0x6f5b,0xa0));var _0xb6f5=function(_0x5d03c7,_0x5f5725){_0x5d03c7=_0x5d03c7-0x0;var _0x4dd1e0=_0x6f5b[_0x5d03c7];return _0x4dd1e0;};'use strict';var _=require(_0xb6f5('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0xb6f5('0x1'));var BPromise=require(_0xb6f5('0x2'));var rp=require(_0xb6f5('0x3'));var fs=require('fs');var path=require(_0xb6f5('0x4'));var rimraf=require(_0xb6f5('0x5'));var config=require(_0xb6f5('0x6'));var attributes=require(_0xb6f5('0x7'));module[_0xb6f5('0x8')]=function(_0x38412d,_0xf2d601){return _0x38412d[_0xb6f5('0x9')](_0xb6f5('0xa'),attributes,{'tableName':_0xb6f5('0xb'),'paranoid':![],'indexes':[{'fields':['uniqueid']},{'fields':[_0xb6f5('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x1fcb=['bluebird','request-promise','path','rimraf','../../config/environment','exports','define','VoiceQueueReport','report_queue','calleridnum','lodash','util','api','moment'];(function(_0x57bc1d,_0x4fc48a){var _0x127745=function(_0xb67723){while(--_0xb67723){_0x57bc1d['push'](_0x57bc1d['shift']());}};_0x127745(++_0x4fc48a);}(_0x1fcb,0x96));var _0xb1fc=function(_0x1efe9a,_0x4e96db){_0x1efe9a=_0x1efe9a-0x0;var _0x4385b4=_0x1fcb[_0x1efe9a];return _0x4385b4;};'use strict';var _=require(_0xb1fc('0x0'));var util=require(_0xb1fc('0x1'));var logger=require('../../config/logger')(_0xb1fc('0x2'));var moment=require(_0xb1fc('0x3'));var BPromise=require(_0xb1fc('0x4'));var rp=require(_0xb1fc('0x5'));var fs=require('fs');var path=require(_0xb1fc('0x6'));var rimraf=require(_0xb1fc('0x7'));var config=require(_0xb1fc('0x8'));var attributes=require('./voiceQueueReport.attributes');module[_0xb1fc('0x9')]=function(_0x4ea231,_0x2527c6){return _0x4ea231[_0xb1fc('0xa')](_0xb1fc('0xb'),attributes,{'tableName':_0xb1fc('0xc'),'paranoid':![],'indexes':[{'fields':['uniqueid']},{'fields':[_0xb1fc('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.rpc.js b/server/api/voiceQueueReport/voiceQueueReport.rpc.js index 0f02688..a6ae05d 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 _0x091e=['create','CreateVoiceQueueReport','UpdateVoiceQueueReport','update','body','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','defaults','localhost','socket.io-emitter','register','request','then','info','VoiceQueueReport,\x20%s,\x20%s','debug','VoiceQueueReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','GetVoiceQueueReport','findAll','options','raw','where','attributes','include','map','model','catch','VoiceQueueReport'];(function(_0x4b2863,_0x494899){var _0x567d67=function(_0x751f03){while(--_0x751f03){_0x4b2863['push'](_0x4b2863['shift']());}};_0x567d67(++_0x494899);}(_0x091e,0x16d));var _0xe091=function(_0x4a3898,_0x4c9853){_0x4a3898=_0x4a3898-0x0;var _0x25ceb0=_0x091e[_0x4a3898];return _0x25ceb0;};'use strict';var _=require(_0xe091('0x0'));var util=require(_0xe091('0x1'));var moment=require(_0xe091('0x2'));var BPromise=require(_0xe091('0x3'));var rs=require(_0xe091('0x4'));var fs=require('fs');var Redis=require(_0xe091('0x5'));var db=require(_0xe091('0x6'))['db'];var utils=require(_0xe091('0x7'));var logger=require('../../config/logger')(_0xe091('0x8'));var config=require(_0xe091('0x9'));var jayson=require(_0xe091('0xa'));var client=jayson[_0xe091('0xb')][_0xe091('0xc')]({'port':0x232a});config['redis']=_[_0xe091('0xd')](config['redis'],{'host':_0xe091('0xe'),'port':0x18eb});var socket=require(_0xe091('0xf'))(new Redis(config['redis']));require('./voiceQueueReport.socket')[_0xe091('0x10')](socket);function respondWithRpcPromise(_0x5de712,_0x46787e,_0x2a62fb){return new BPromise(function(_0x4d317c,_0x1ffe68){return client[_0xe091('0x11')](_0x5de712,_0x2a62fb)[_0xe091('0x12')](function(_0x2ffcd8){logger[_0xe091('0x13')](_0xe091('0x14'),_0x46787e,'request\x20sent');logger[_0xe091('0x15')](_0xe091('0x16'),_0x46787e,_0xe091('0x17'),JSON[_0xe091('0x18')](_0x2ffcd8));if(_0x2ffcd8['error']){if(_0x2ffcd8[_0xe091('0x19')][_0xe091('0x1a')]===0x1f4){logger[_0xe091('0x19')]('VoiceQueueReport,\x20%s,\x20%s',_0x46787e,_0x2ffcd8[_0xe091('0x19')]['message']);return _0x1ffe68(_0x2ffcd8[_0xe091('0x19')]['message']);}logger[_0xe091('0x19')](_0xe091('0x14'),_0x46787e,_0x2ffcd8['error'][_0xe091('0x1b')]);return _0x4d317c(_0x2ffcd8[_0xe091('0x19')][_0xe091('0x1b')]);}else{logger['info'](_0xe091('0x14'),_0x46787e,_0xe091('0x17'));_0x4d317c(_0x2ffcd8[_0xe091('0x1c')][_0xe091('0x1b')]);}})['catch'](function(_0x42b99a){logger[_0xe091('0x19')](_0xe091('0x14'),_0x46787e,_0x42b99a);_0x1ffe68(_0x42b99a);});});}exports[_0xe091('0x1d')]=function(_0x254bfd){var _0x35e0ca=this;return new Promise(function(_0xd391cf,_0x52ba7e){return db['VoiceQueueReport'][_0xe091('0x1e')]({'raw':_0x254bfd[_0xe091('0x1f')]?_0x254bfd[_0xe091('0x1f')][_0xe091('0x20')]===undefined?!![]:![]:!![],'where':_0x254bfd['options']?_0x254bfd['options'][_0xe091('0x21')]||null:null,'attributes':_0x254bfd[_0xe091('0x1f')]?_0x254bfd[_0xe091('0x1f')][_0xe091('0x22')]||null:null,'limit':_0x254bfd['options']?_0x254bfd['options']['limit']||null:null,'include':_0x254bfd[_0xe091('0x1f')]?_0x254bfd['options'][_0xe091('0x23')]?_[_0xe091('0x24')](_0x254bfd[_0xe091('0x1f')][_0xe091('0x23')],function(_0x3d5b4c){return{'model':db[_0x3d5b4c[_0xe091('0x25')]],'as':_0x3d5b4c['as'],'attributes':_0x3d5b4c[_0xe091('0x22')],'include':_0x3d5b4c['include']?_[_0xe091('0x24')](_0x3d5b4c['include'],function(_0x1ac1a3){return{'model':db[_0x1ac1a3['model']],'as':_0x1ac1a3['as'],'attributes':_0x1ac1a3['attributes'],'include':_0x1ac1a3[_0xe091('0x23')]?_[_0xe091('0x24')](_0x1ac1a3[_0xe091('0x23')],function(_0x478090){return{'model':db[_0x478090[_0xe091('0x25')]],'as':_0x478090['as'],'attributes':_0x478090[_0xe091('0x22')]};}):[]};}):[]};}):[]:[]})[_0xe091('0x12')](function(_0x2ecf18){logger[_0xe091('0x13')](_0xe091('0x1d'),_0x254bfd);logger[_0xe091('0x15')](_0xe091('0x1d'),_0x254bfd,JSON[_0xe091('0x18')](_0x2ecf18));_0xd391cf(_0x2ecf18);})[_0xe091('0x26')](function(_0x448f3c){logger[_0xe091('0x19')]('GetVoiceQueueReport',_0x448f3c[_0xe091('0x1b')],_0x254bfd);_0x52ba7e(_0x35e0ca[_0xe091('0x19')](0x1f4,_0x448f3c[_0xe091('0x1b')]));});});};exports['CreateVoiceQueueReport']=function(_0x1c7075){var _0x23fdc2=this;return new Promise(function(_0x4ce657,_0x4c0157){return db[_0xe091('0x27')][_0xe091('0x28')](_0x1c7075['body'],{'raw':_0x1c7075[_0xe091('0x1f')]?_0x1c7075['options'][_0xe091('0x20')]===undefined?!![]:![]:!![]})[_0xe091('0x12')](function(_0x2ea946){logger[_0xe091('0x13')](_0xe091('0x29'),_0x1c7075);logger[_0xe091('0x15')](_0xe091('0x29'),_0x1c7075,JSON['stringify'](_0x2ea946));_0x4ce657(_0x2ea946);})[_0xe091('0x26')](function(_0x543111){logger[_0xe091('0x19')]('CreateVoiceQueueReport',_0x543111[_0xe091('0x1b')],_0x1c7075);_0x4c0157(_0x23fdc2['error'](0x1f4,_0x543111[_0xe091('0x1b')]));});});};exports[_0xe091('0x2a')]=function(_0x5c1e56){var _0x3fa1e2=this;return new Promise(function(_0x27410a,_0x10a528){return db[_0xe091('0x27')][_0xe091('0x2b')](_0x5c1e56[_0xe091('0x2c')],{'raw':_0x5c1e56[_0xe091('0x1f')]?_0x5c1e56['options'][_0xe091('0x20')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5c1e56[_0xe091('0x1f')]?_0x5c1e56[_0xe091('0x1f')][_0xe091('0x21')]||null:null,'attributes':_0x5c1e56[_0xe091('0x1f')]?_0x5c1e56[_0xe091('0x1f')]['attributes']||null:null,'limit':_0x5c1e56[_0xe091('0x1f')]?_0x5c1e56[_0xe091('0x1f')]['limit']||null:null})[_0xe091('0x12')](function(_0x359cd8){logger[_0xe091('0x13')]('UpdateVoiceQueueReport',_0x5c1e56);logger[_0xe091('0x15')](_0xe091('0x2a'),_0x5c1e56,JSON[_0xe091('0x18')](_0x359cd8));_0x27410a(_0x359cd8);})[_0xe091('0x26')](function(_0x54a8be){logger[_0xe091('0x19')](_0xe091('0x2a'),_0x54a8be['message'],_0x5c1e56);_0x10a528(_0x3fa1e2[_0xe091('0x19')](0x1f4,_0x54a8be['message']));});});}; \ No newline at end of file +var _0xfee2=['findAll','options','raw','where','attributes','limit','map','include','model','CreateVoiceQueueReport','create','body','UpdateVoiceQueueReport','VoiceQueueReport','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','./voiceQueueReport.socket','register','then','request\x20sent','debug','VoiceQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','VoiceQueueReport,\x20%s,\x20%s','info','result','catch','GetVoiceQueueReport'];(function(_0x1fa759,_0x4ecdce){var _0x2da9f4=function(_0x463e2a){while(--_0x463e2a){_0x1fa759['push'](_0x1fa759['shift']());}};_0x2da9f4(++_0x4ecdce);}(_0xfee2,0x176));var _0x2fee=function(_0x2ae0bf,_0x41bd97){_0x2ae0bf=_0x2ae0bf-0x0;var _0x41480c=_0xfee2[_0x2ae0bf];return _0x41480c;};'use strict';var _=require(_0x2fee('0x0'));var util=require(_0x2fee('0x1'));var moment=require(_0x2fee('0x2'));var BPromise=require(_0x2fee('0x3'));var rs=require(_0x2fee('0x4'));var fs=require('fs');var Redis=require(_0x2fee('0x5'));var db=require(_0x2fee('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x2fee('0x7'))(_0x2fee('0x8'));var config=require(_0x2fee('0x9'));var jayson=require(_0x2fee('0xa'));var client=jayson['client'][_0x2fee('0xb')]({'port':0x232a});config[_0x2fee('0xc')]=_[_0x2fee('0xd')](config['redis'],{'host':_0x2fee('0xe'),'port':0x18eb});var socket=require(_0x2fee('0xf'))(new Redis(config[_0x2fee('0xc')]));require(_0x2fee('0x10'))[_0x2fee('0x11')](socket);function respondWithRpcPromise(_0x1f08a5,_0x4184e2,_0x3fee91){return new BPromise(function(_0x375add,_0x1a600b){return client['request'](_0x1f08a5,_0x3fee91)[_0x2fee('0x12')](function(_0x627760){logger['info']('VoiceQueueReport,\x20%s,\x20%s',_0x4184e2,_0x2fee('0x13'));logger[_0x2fee('0x14')](_0x2fee('0x15'),_0x4184e2,_0x2fee('0x13'),JSON[_0x2fee('0x16')](_0x627760));if(_0x627760[_0x2fee('0x17')]){if(_0x627760[_0x2fee('0x17')][_0x2fee('0x18')]===0x1f4){logger[_0x2fee('0x17')]('VoiceQueueReport,\x20%s,\x20%s',_0x4184e2,_0x627760[_0x2fee('0x17')][_0x2fee('0x19')]);return _0x1a600b(_0x627760[_0x2fee('0x17')][_0x2fee('0x19')]);}logger[_0x2fee('0x17')](_0x2fee('0x1a'),_0x4184e2,_0x627760['error'][_0x2fee('0x19')]);return _0x375add(_0x627760['error'][_0x2fee('0x19')]);}else{logger[_0x2fee('0x1b')](_0x2fee('0x1a'),_0x4184e2,_0x2fee('0x13'));_0x375add(_0x627760[_0x2fee('0x1c')][_0x2fee('0x19')]);}})[_0x2fee('0x1d')](function(_0x191871){logger[_0x2fee('0x17')](_0x2fee('0x1a'),_0x4184e2,_0x191871);_0x1a600b(_0x191871);});});}exports[_0x2fee('0x1e')]=function(_0x1d8417){var _0x2cbf9c=this;return new Promise(function(_0x477e03,_0x2d99e7){return db['VoiceQueueReport'][_0x2fee('0x1f')]({'raw':_0x1d8417[_0x2fee('0x20')]?_0x1d8417[_0x2fee('0x20')][_0x2fee('0x21')]===undefined?!![]:![]:!![],'where':_0x1d8417[_0x2fee('0x20')]?_0x1d8417[_0x2fee('0x20')][_0x2fee('0x22')]||null:null,'attributes':_0x1d8417[_0x2fee('0x20')]?_0x1d8417['options'][_0x2fee('0x23')]||null:null,'limit':_0x1d8417[_0x2fee('0x20')]?_0x1d8417['options'][_0x2fee('0x24')]||null:null,'include':_0x1d8417[_0x2fee('0x20')]?_0x1d8417[_0x2fee('0x20')]['include']?_[_0x2fee('0x25')](_0x1d8417[_0x2fee('0x20')][_0x2fee('0x26')],function(_0x28c31b){return{'model':db[_0x28c31b[_0x2fee('0x27')]],'as':_0x28c31b['as'],'attributes':_0x28c31b[_0x2fee('0x23')],'include':_0x28c31b[_0x2fee('0x26')]?_[_0x2fee('0x25')](_0x28c31b[_0x2fee('0x26')],function(_0x7e4ae6){return{'model':db[_0x7e4ae6[_0x2fee('0x27')]],'as':_0x7e4ae6['as'],'attributes':_0x7e4ae6[_0x2fee('0x23')],'include':_0x7e4ae6[_0x2fee('0x26')]?_[_0x2fee('0x25')](_0x7e4ae6[_0x2fee('0x26')],function(_0x2a9963){return{'model':db[_0x2a9963['model']],'as':_0x2a9963['as'],'attributes':_0x2a9963[_0x2fee('0x23')]};}):[]};}):[]};}):[]:[]})[_0x2fee('0x12')](function(_0x499420){logger[_0x2fee('0x1b')]('GetVoiceQueueReport',_0x1d8417);logger[_0x2fee('0x14')]('GetVoiceQueueReport',_0x1d8417,JSON['stringify'](_0x499420));_0x477e03(_0x499420);})['catch'](function(_0x48dc85){logger[_0x2fee('0x17')]('GetVoiceQueueReport',_0x48dc85['message'],_0x1d8417);_0x2d99e7(_0x2cbf9c['error'](0x1f4,_0x48dc85['message']));});});};exports[_0x2fee('0x28')]=function(_0x16edbe){var _0xb5bbc7=this;return new Promise(function(_0xdb45bb,_0x44d7a4){return db['VoiceQueueReport'][_0x2fee('0x29')](_0x16edbe[_0x2fee('0x2a')],{'raw':_0x16edbe['options']?_0x16edbe[_0x2fee('0x20')][_0x2fee('0x21')]===undefined?!![]:![]:!![]})[_0x2fee('0x12')](function(_0x3d74d1){logger[_0x2fee('0x1b')](_0x2fee('0x28'),_0x16edbe);logger['debug'](_0x2fee('0x28'),_0x16edbe,JSON[_0x2fee('0x16')](_0x3d74d1));_0xdb45bb(_0x3d74d1);})[_0x2fee('0x1d')](function(_0x4fb98f){logger[_0x2fee('0x17')]('CreateVoiceQueueReport',_0x4fb98f['message'],_0x16edbe);_0x44d7a4(_0xb5bbc7[_0x2fee('0x17')](0x1f4,_0x4fb98f[_0x2fee('0x19')]));});});};exports[_0x2fee('0x2b')]=function(_0x53bb0e){var _0x2caf75=this;return new Promise(function(_0x416843,_0x235e5a){return db[_0x2fee('0x2c')]['update'](_0x53bb0e[_0x2fee('0x2a')],{'raw':_0x53bb0e[_0x2fee('0x20')]?_0x53bb0e[_0x2fee('0x20')][_0x2fee('0x21')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x53bb0e[_0x2fee('0x20')]?_0x53bb0e[_0x2fee('0x20')][_0x2fee('0x22')]||null:null,'attributes':_0x53bb0e[_0x2fee('0x20')]?_0x53bb0e[_0x2fee('0x20')][_0x2fee('0x23')]||null:null,'limit':_0x53bb0e[_0x2fee('0x20')]?_0x53bb0e['options'][_0x2fee('0x24')]||null:null})[_0x2fee('0x12')](function(_0x363697){logger[_0x2fee('0x1b')]('UpdateVoiceQueueReport',_0x53bb0e);logger['debug'](_0x2fee('0x2b'),_0x53bb0e,JSON[_0x2fee('0x16')](_0x363697));_0x416843(_0x363697);})[_0x2fee('0x1d')](function(_0x1a4c1c){logger[_0x2fee('0x17')](_0x2fee('0x2b'),_0x1a4c1c[_0x2fee('0x19')],_0x53bb0e);_0x235e5a(_0x2caf75[_0x2fee('0x17')](0x1f4,_0x1a4c1c[_0x2fee('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.socket.js b/server/api/voiceQueueReport/voiceQueueReport.socket.js index d019506..4fae9fa 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 _0x38fb=['emit','removeListener','register','length','./voiceQueueReport.events','save','remove','update'];(function(_0x31d423,_0x45de45){var _0x28c00d=function(_0x9bde8a){while(--_0x9bde8a){_0x31d423['push'](_0x31d423['shift']());}};_0x28c00d(++_0x45de45);}(_0x38fb,0x6c));var _0xb38f=function(_0x29733c,_0x2da30b){_0x29733c=_0x29733c-0x0;var _0x49e72f=_0x38fb[_0x29733c];return _0x49e72f;};'use strict';var VoiceQueueReportEvents=require(_0xb38f('0x0'));var events=[_0xb38f('0x1'),_0xb38f('0x2'),_0xb38f('0x3')];function createListener(_0x2deb6e,_0x25f5c1){return function(_0xf21260){_0x25f5c1[_0xb38f('0x4')](_0x2deb6e,_0xf21260);};}function removeListener(_0x2a5ea3,_0x116d13){return function(){VoiceQueueReportEvents[_0xb38f('0x5')](_0x2a5ea3,_0x116d13);};}exports[_0xb38f('0x6')]=function(_0x4afce){for(var _0xc542f4=0x0,_0x5ef990=events[_0xb38f('0x7')];_0xc542f4<_0x5ef990;_0xc542f4++){var _0x2ef19c=events[_0xc542f4];var _0x3ee0f0=createListener('voiceQueueReport:'+_0x2ef19c,_0x4afce);VoiceQueueReportEvents['on'](_0x2ef19c,_0x3ee0f0);}}; \ No newline at end of file +var _0xd00b=['length','voiceQueueReport:','./voiceQueueReport.events','save','remove','update','emit','removeListener','register'];(function(_0x5a93e1,_0x353625){var _0x524249=function(_0x3e2f07){while(--_0x3e2f07){_0x5a93e1['push'](_0x5a93e1['shift']());}};_0x524249(++_0x353625);}(_0xd00b,0x107));var _0xbd00=function(_0x3f7e59,_0x1c6293){_0x3f7e59=_0x3f7e59-0x0;var _0x52ff9d=_0xd00b[_0x3f7e59];return _0x52ff9d;};'use strict';var VoiceQueueReportEvents=require(_0xbd00('0x0'));var events=[_0xbd00('0x1'),_0xbd00('0x2'),_0xbd00('0x3')];function createListener(_0x3db048,_0x263637){return function(_0x1eff2f){_0x263637[_0xbd00('0x4')](_0x3db048,_0x1eff2f);};}function removeListener(_0x42aee3,_0x10cef3){return function(){VoiceQueueReportEvents[_0xbd00('0x5')](_0x42aee3,_0x10cef3);};}exports[_0xbd00('0x6')]=function(_0x4ac3da){for(var _0x332ab8=0x0,_0x23d5ff=events[_0xbd00('0x7')];_0x332ab8<_0x23d5ff;_0x332ab8++){var _0x1c3306=events[_0x332ab8];var _0x467300=createListener(_0xbd00('0x8')+_0x1c3306,_0x4ac3da);VoiceQueueReportEvents['on'](_0x1c3306,_0x467300);}}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/index.js b/server/api/voiceQueuesLog/index.js index 522829e..36aa944 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 _0x3f10=['get','/:id','show','post','create','update','delete','destroy','exports','multer','express','Router','../../components/interaction/service','./voiceQueuesLog.controller','isAuthenticated','index'];(function(_0x470f24,_0x2436a9){var _0x2c6fc8=function(_0x3ef190){while(--_0x3ef190){_0x470f24['push'](_0x470f24['shift']());}};_0x2c6fc8(++_0x2436a9);}(_0x3f10,0x69));var _0x03f1=function(_0x89dc5a,_0x1f9a6a){_0x89dc5a=_0x89dc5a-0x0;var _0x3b810e=_0x3f10[_0x89dc5a];return _0x3b810e;};'use strict';var multer=require(_0x03f1('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0x03f1('0x1'));var router=express[_0x03f1('0x2')]();var auth=require('../../components/auth/service');var interaction=require(_0x03f1('0x3'));var config=require('../../config/environment');var controller=require(_0x03f1('0x4'));router['get']('/',auth[_0x03f1('0x5')](),controller[_0x03f1('0x6')]);router[_0x03f1('0x7')](_0x03f1('0x8'),auth['isAuthenticated'](),controller[_0x03f1('0x9')]);router[_0x03f1('0xa')]('/',auth[_0x03f1('0x5')](),controller[_0x03f1('0xb')]);router['put'](_0x03f1('0x8'),auth[_0x03f1('0x5')](),controller[_0x03f1('0xc')]);router[_0x03f1('0xd')]('/:id',auth['isAuthenticated'](),controller[_0x03f1('0xe')]);module[_0x03f1('0xf')]=router; \ No newline at end of file +var _0x20c0=['delete','destroy','util','path','express','Router','../../components/auth/service','./voiceQueuesLog.controller','get','isAuthenticated','index','show','post','create','/:id'];(function(_0x2a90d1,_0x1caf6c){var _0x13a99a=function(_0x55f21a){while(--_0x55f21a){_0x2a90d1['push'](_0x2a90d1['shift']());}};_0x13a99a(++_0x1caf6c);}(_0x20c0,0x13d));var _0x020c=function(_0x5863cc,_0x10ad34){_0x5863cc=_0x5863cc-0x0;var _0x55c055=_0x20c0[_0x5863cc];return _0x55c055;};'use strict';var multer=require('multer');var util=require(_0x020c('0x0'));var path=require(_0x020c('0x1'));var timeout=require('connect-timeout');var express=require(_0x020c('0x2'));var router=express[_0x020c('0x3')]();var auth=require(_0x020c('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x020c('0x5'));router[_0x020c('0x6')]('/',auth[_0x020c('0x7')](),controller[_0x020c('0x8')]);router['get']('/:id',auth[_0x020c('0x7')](),controller[_0x020c('0x9')]);router[_0x020c('0xa')]('/',auth['isAuthenticated'](),controller[_0x020c('0xb')]);router['put'](_0x020c('0xc'),auth[_0x020c('0x7')](),controller['update']);router[_0x020c('0xd')](_0x020c('0xc'),auth[_0x020c('0x7')](),controller[_0x020c('0xe')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.attributes.js b/server/api/voiceQueuesLog/voiceQueuesLog.attributes.js index 53b511b..017dc5a 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 _0x299c=['STRING','format','YYYY-MM-DD\x20HH:mm:ss','sequelize','moment'];(function(_0x4f005b,_0x46904d){var _0x121ad7=function(_0x5ef99a){while(--_0x5ef99a){_0x4f005b['push'](_0x4f005b['shift']());}};_0x121ad7(++_0x46904d);}(_0x299c,0x15c));var _0xc299=function(_0x5ba1cd,_0x495124){_0x5ba1cd=_0x5ba1cd-0x0;var _0x477409=_0x299c[_0x5ba1cd];return _0x477409;};'use strict';var Sequelize=require(_0xc299('0x0'));var moment=require(_0xc299('0x1'));module['exports']={'time':{'type':Sequelize[_0xc299('0x2')]},'callid':{'type':Sequelize[_0xc299('0x2')],'allowNull':![],'defaultValue':''},'queuename':{'type':Sequelize[_0xc299('0x2')],'allowNull':![],'defaultValue':''},'agent':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'event':{'type':Sequelize[_0xc299('0x2')],'allowNull':![],'defaultValue':''},'data':{'type':Sequelize[_0xc299('0x2')],'allowNull':![],'defaultValue':''},'data1':{'type':Sequelize[_0xc299('0x2')],'allowNull':![],'defaultValue':''},'data2':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data3':{'type':Sequelize[_0xc299('0x2')],'allowNull':![],'defaultValue':''},'data4':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data5':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'dtm':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':moment()[_0xc299('0x3')](_0xc299('0x4'))}}; \ No newline at end of file +var _0xcb70=['DATE','format','YYYY-MM-DD\x20HH:mm:ss','moment','exports','STRING'];(function(_0x4f6a88,_0x174e85){var _0x1b7594=function(_0x5ad264){while(--_0x5ad264){_0x4f6a88['push'](_0x4f6a88['shift']());}};_0x1b7594(++_0x174e85);}(_0xcb70,0x111));var _0x0cb7=function(_0x2adbeb,_0x5581be){_0x2adbeb=_0x2adbeb-0x0;var _0x5e18a6=_0xcb70[_0x2adbeb];return _0x5e18a6;};'use strict';var Sequelize=require('sequelize');var moment=require(_0x0cb7('0x0'));module[_0x0cb7('0x1')]={'time':{'type':Sequelize[_0x0cb7('0x2')]},'callid':{'type':Sequelize[_0x0cb7('0x2')],'allowNull':![],'defaultValue':''},'queuename':{'type':Sequelize[_0x0cb7('0x2')],'allowNull':![],'defaultValue':''},'agent':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'event':{'type':Sequelize[_0x0cb7('0x2')],'allowNull':![],'defaultValue':''},'data':{'type':Sequelize[_0x0cb7('0x2')],'allowNull':![],'defaultValue':''},'data1':{'type':Sequelize[_0x0cb7('0x2')],'allowNull':![],'defaultValue':''},'data2':{'type':Sequelize[_0x0cb7('0x2')],'allowNull':![],'defaultValue':''},'data3':{'type':Sequelize[_0x0cb7('0x2')],'allowNull':![],'defaultValue':''},'data4':{'type':Sequelize[_0x0cb7('0x2')],'allowNull':![],'defaultValue':''},'data5':{'type':Sequelize[_0x0cb7('0x2')],'allowNull':![],'defaultValue':''},'dtm':{'type':Sequelize[_0x0cb7('0x3')],'allowNull':![],'defaultValue':moment()[_0x0cb7('0x4')](_0x0cb7('0x5'))}}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.controller.js b/server/api/voiceQueuesLog/voiceQueuesLog.controller.js index 8a0f6f6..9791a4f 100644 --- a/server/api/voiceQueuesLog/voiceQueuesLog.controller.js +++ b/server/api/voiceQueuesLog/voiceQueuesLog.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['sort','where','pick','filter','VIRTUAL','merge','options','include','findAll','catch','params','includeAll','create','body','find','html-pdf','eml-format','rimraf','request-promise','bluebird','mustache','util','path','sox','ejs','lodash','squel','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../mysqldb','sendStatus','status','json','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','end','error','name','send','index','map','VoiceQueuesLog','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','limit'];(function(_0x4701cd,_0xc24fda){var _0x324b93=function(_0xfa3426){while(--_0xfa3426){_0x4701cd['push'](_0x4701cd['shift']());}};_0x324b93(++_0xc24fda);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5783f4,_0x4a9e0a){_0x5783f4=_0x5783f4-0x0;var _0x28e380=_0xa9e0[_0x5783f4];return _0x28e380;};'use strict';var pdf=require(_0x0a9e('0x0'));var emlformat=require(_0x0a9e('0x1'));var rimraf=require(_0x0a9e('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x0a9e('0x3'));var moment=require('moment');var BPromise=require(_0x0a9e('0x4'));var Mustache=require(_0x0a9e('0x5'));var util=require(_0x0a9e('0x6'));var path=require(_0x0a9e('0x7'));var sox=require(_0x0a9e('0x8'));var csv=require('to-csv');var ejs=require(_0x0a9e('0x9'));var fs=require('fs');var _=require(_0x0a9e('0xa'));var squel=require(_0x0a9e('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x0a9e('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x0a9e('0xd'));var Redis=require(_0x0a9e('0xe'));var authService=require(_0x0a9e('0xf'));var qs=require(_0x0a9e('0x10'));var as=require(_0x0a9e('0x11'));var hardwareService=require(_0x0a9e('0x12'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require('../../config/environment');var db=require(_0x0a9e('0x13'))['db'];function respondWithStatusCode(_0x36471c,_0xd5b662){_0xd5b662=_0xd5b662||0xcc;return function(_0x26d672){if(_0x26d672){return _0x36471c[_0x0a9e('0x14')](_0xd5b662);}return _0x36471c[_0x0a9e('0x15')](_0xd5b662)['end']();};}function respondWithResult(_0x4283ce,_0x239b12){_0x239b12=_0x239b12||0xc8;return function(_0x2b4227){if(_0x2b4227){return _0x4283ce[_0x0a9e('0x15')](_0x239b12)[_0x0a9e('0x16')](_0x2b4227);}};}function respondWithFilteredResult(_0x4d5611,_0x52a03d){return function(_0x22dccb){if(_0x22dccb){var _0x5d0880=_0x22dccb[_0x0a9e('0x17')],_0x1985b6=_0x52a03d['offset'],_0x519dfd=_0x52a03d[_0x0a9e('0x18')]+_0x52a03d['limit'],_0x16033c;if(_0x519dfd>=_0x5d0880){_0x519dfd=_0x5d0880;_0x16033c=0xc8;}else{_0x16033c=0xce;}_0x4d5611[_0x0a9e('0x15')](_0x16033c);return _0x4d5611[_0x0a9e('0x19')](_0x0a9e('0x1a'),_0x1985b6+'-'+_0x519dfd+'/'+_0x5d0880)[_0x0a9e('0x16')](_0x22dccb);}return null;};}function patchUpdates(_0x31b1ca){return function(_0x2eb11f){try{jsonpatch[_0x0a9e('0x1b')](_0x2eb11f,_0x31b1ca,!![]);}catch(_0x20559e){return BPromise[_0x0a9e('0x1c')](_0x20559e);}return _0x2eb11f[_0x0a9e('0x1d')]();};}function saveUpdates(_0x1c696a,_0x105080){return function(_0x4bb1e3){if(_0x4bb1e3){return _0x4bb1e3[_0x0a9e('0x1e')](_0x1c696a)[_0x0a9e('0x1f')](function(_0x53682f){return _0x53682f;});}return null;};}function removeEntity(_0x20f109,_0x5a09ef){return function(_0x588269){if(_0x588269){return _0x588269[_0x0a9e('0x20')]()[_0x0a9e('0x1f')](function(){_0x20f109[_0x0a9e('0x15')](0xcc)[_0x0a9e('0x21')]();});}};}function handleEntityNotFound(_0x4abc77,_0xfb6e48){return function(_0x2fb0e4){if(!_0x2fb0e4){_0x4abc77[_0x0a9e('0x14')](0x194);}return _0x2fb0e4;};}function handleError(_0x4d00e6,_0x370d86){_0x370d86=_0x370d86||0x1f4;return function(_0x42ac8f){logger[_0x0a9e('0x22')](_0x42ac8f['stack']);if(_0x42ac8f['name']){delete _0x42ac8f[_0x0a9e('0x23')];}_0x4d00e6[_0x0a9e('0x15')](_0x370d86)[_0x0a9e('0x24')](_0x42ac8f);};}exports[_0x0a9e('0x25')]=function(_0x526cf3,_0x384319){var _0x479bc4={},_0x45a1e7={},_0x5bfb33={'count':0x0,'rows':[]};var _0x1dc186=_[_0x0a9e('0x26')](db[_0x0a9e('0x27')][_0x0a9e('0x28')],function(_0x140511){return{'name':_0x140511[_0x0a9e('0x29')],'type':_0x140511[_0x0a9e('0x2a')][_0x0a9e('0x2b')]};});_0x45a1e7['model']=_[_0x0a9e('0x26')](_0x1dc186,_0x0a9e('0x23'));_0x45a1e7[_0x0a9e('0x2c')]=_[_0x0a9e('0x2d')](_0x526cf3['query']);_0x45a1e7[_0x0a9e('0x2e')]=_[_0x0a9e('0x2f')](_0x45a1e7[_0x0a9e('0x30')],_0x45a1e7[_0x0a9e('0x2c')]);_0x479bc4[_0x0a9e('0x31')]=_[_0x0a9e('0x2f')](_0x45a1e7[_0x0a9e('0x30')],qs[_0x0a9e('0x32')](_0x526cf3[_0x0a9e('0x2c')]['fields']));_0x479bc4[_0x0a9e('0x31')]=_0x479bc4['attributes'][_0x0a9e('0x33')]?_0x479bc4[_0x0a9e('0x31')]:_0x45a1e7[_0x0a9e('0x30')];if(!_0x526cf3[_0x0a9e('0x2c')][_0x0a9e('0x34')]('nolimit')){_0x479bc4[_0x0a9e('0x35')]=qs[_0x0a9e('0x35')](_0x526cf3[_0x0a9e('0x2c')][_0x0a9e('0x35')]);_0x479bc4[_0x0a9e('0x18')]=qs[_0x0a9e('0x18')](_0x526cf3[_0x0a9e('0x2c')][_0x0a9e('0x18')]);}_0x479bc4['order']=qs[_0x0a9e('0x36')](_0x526cf3['query'][_0x0a9e('0x36')]);_0x479bc4[_0x0a9e('0x37')]=qs[_0x0a9e('0x2e')](_[_0x0a9e('0x38')](_0x526cf3['query'],_0x45a1e7[_0x0a9e('0x2e')]),_0x1dc186);if(_0x526cf3[_0x0a9e('0x2c')][_0x0a9e('0x39')]){_0x479bc4[_0x0a9e('0x37')]=_['merge'](_0x479bc4['where'],{'$or':_[_0x0a9e('0x26')](_0x1dc186,function(_0x5640eb){if(_0x5640eb[_0x0a9e('0x2a')]!==_0x0a9e('0x3a')){var _0x381c37={};_0x381c37[_0x5640eb[_0x0a9e('0x23')]]={'$like':'%'+_0x526cf3['query'][_0x0a9e('0x39')]+'%'};return _0x381c37;}})});}_0x479bc4=_[_0x0a9e('0x3b')]({},_0x479bc4,_0x526cf3[_0x0a9e('0x3c')]);var _0x533942={'where':_0x479bc4[_0x0a9e('0x37')]};return db[_0x0a9e('0x27')][_0x0a9e('0x17')](_0x533942)['then'](function(_0x546ef8){_0x5bfb33[_0x0a9e('0x17')]=_0x546ef8;if(_0x526cf3[_0x0a9e('0x2c')]['includeAll']){_0x479bc4[_0x0a9e('0x3d')]=[{'all':!![]}];}return db[_0x0a9e('0x27')][_0x0a9e('0x3e')](_0x479bc4);})[_0x0a9e('0x1f')](function(_0x4b38d9){_0x5bfb33['rows']=_0x4b38d9;return _0x5bfb33;})[_0x0a9e('0x1f')](respondWithFilteredResult(_0x384319,_0x479bc4))[_0x0a9e('0x3f')](handleError(_0x384319,null));};exports['show']=function(_0x183991,_0x1dec2e){var _0x1459bb={'raw':!![],'where':{'id':_0x183991[_0x0a9e('0x40')]['id']}},_0x5b4f5e={};_0x5b4f5e[_0x0a9e('0x30')]=_[_0x0a9e('0x2d')](db[_0x0a9e('0x27')][_0x0a9e('0x28')]);_0x5b4f5e[_0x0a9e('0x2c')]=_[_0x0a9e('0x2d')](_0x183991[_0x0a9e('0x2c')]);_0x5b4f5e[_0x0a9e('0x2e')]=_[_0x0a9e('0x2f')](_0x5b4f5e[_0x0a9e('0x30')],_0x5b4f5e[_0x0a9e('0x2c')]);_0x1459bb[_0x0a9e('0x31')]=_[_0x0a9e('0x2f')](_0x5b4f5e[_0x0a9e('0x30')],qs['fields'](_0x183991['query'][_0x0a9e('0x32')]));_0x1459bb[_0x0a9e('0x31')]=_0x1459bb[_0x0a9e('0x31')][_0x0a9e('0x33')]?_0x1459bb[_0x0a9e('0x31')]:_0x5b4f5e[_0x0a9e('0x30')];if(_0x183991[_0x0a9e('0x2c')][_0x0a9e('0x41')]){_0x1459bb[_0x0a9e('0x3d')]=[{'all':!![]}];}_0x1459bb=_[_0x0a9e('0x3b')]({},_0x1459bb,_0x183991[_0x0a9e('0x3c')]);return db[_0x0a9e('0x27')]['find'](_0x1459bb)[_0x0a9e('0x1f')](handleEntityNotFound(_0x1dec2e,null))[_0x0a9e('0x1f')](respondWithResult(_0x1dec2e,null))[_0x0a9e('0x3f')](handleError(_0x1dec2e,null));};exports[_0x0a9e('0x42')]=function(_0x2e8caf,_0xbe9d19){return db[_0x0a9e('0x27')][_0x0a9e('0x42')](_0x2e8caf['body'],{})[_0x0a9e('0x1f')](respondWithResult(_0xbe9d19,0xc9))['catch'](handleError(_0xbe9d19,null));};exports[_0x0a9e('0x1e')]=function(_0x476688,_0x8d6dd1){if(_0x476688['body']['id']){delete _0x476688[_0x0a9e('0x43')]['id'];}return db[_0x0a9e('0x27')][_0x0a9e('0x44')]({'where':{'id':_0x476688[_0x0a9e('0x40')]['id']}})[_0x0a9e('0x1f')](handleEntityNotFound(_0x8d6dd1,null))[_0x0a9e('0x1f')](saveUpdates(_0x476688[_0x0a9e('0x43')],null))['then'](respondWithResult(_0x8d6dd1,null))[_0x0a9e('0x3f')](handleError(_0x8d6dd1,null));};exports[_0x0a9e('0x20')]=function(_0x1b5e80,_0x16f976){return db[_0x0a9e('0x27')][_0x0a9e('0x44')]({'where':{'id':_0x1b5e80[_0x0a9e('0x40')]['id']}})[_0x0a9e('0x1f')](handleEntityNotFound(_0x16f976,null))[_0x0a9e('0x1f')](removeEntity(_0x16f976,null))['catch'](handleError(_0x16f976,null));}; \ No newline at end of file +var _0xb10b=['where','merge','VoiceQueuesLog','include','rows','catch','show','params','includeAll','options','find','create','body','update','html-pdf','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','ejs','lodash','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/environment','sendStatus','status','end','json','count','offset','limit','set','Content-Range','reject','save','then','destroy','name','send','map','rawAttributes','fieldName','type','key','model','keys','filters','intersection','query','fields','attributes','length','hasOwnProperty','nolimit','order','sort','filter'];(function(_0x177fde,_0x2458d9){var _0x195b91=function(_0x2e5eb3){while(--_0x2e5eb3){_0x177fde['push'](_0x177fde['shift']());}};_0x195b91(++_0x2458d9);}(_0xb10b,0x12a));var _0xbb10=function(_0x45ccd2,_0x4ecb10){_0x45ccd2=_0x45ccd2-0x0;var _0x554dff=_0xb10b[_0x45ccd2];return _0x554dff;};'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 48ba4ad..732ee48 100644 --- a/server/api/voiceQueuesLog/voiceQueuesLog.model.js +++ b/server/api/voiceQueuesLog/voiceQueuesLog.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x038b=['util','../../config/logger','api','bluebird','path','rimraf','./voiceQueuesLog.attributes','exports','define','VoiceQueuesLog','voice_queues_log','dtm'];(function(_0x189d79,_0x470d4e){var _0x481205=function(_0x5eb39b){while(--_0x5eb39b){_0x189d79['push'](_0x189d79['shift']());}};_0x481205(++_0x470d4e);}(_0x038b,0x114));var _0xb038=function(_0x543a22,_0x40534d){_0x543a22=_0x543a22-0x0;var _0x5bc5e9=_0x038b[_0x543a22];return _0x5bc5e9;};'use strict';var _=require('lodash');var util=require(_0xb038('0x0'));var logger=require(_0xb038('0x1'))(_0xb038('0x2'));var moment=require('moment');var BPromise=require(_0xb038('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xb038('0x4'));var rimraf=require(_0xb038('0x5'));var config=require('../../config/environment');var attributes=require(_0xb038('0x6'));module[_0xb038('0x7')]=function(_0x4fe092,_0x54e1e7){return _0x4fe092[_0xb038('0x8')](_0xb038('0x9'),attributes,{'tableName':_0xb038('0xa'),'paranoid':![],'indexes':[{'name':'event_dtm','fields':['event',_0xb038('0xb')]}],'timestamps':![]});}; \ No newline at end of file +var _0x2675=['rimraf','./voiceQueuesLog.attributes','exports','define','VoiceQueuesLog','event_dtm','event','lodash','moment','bluebird','path'];(function(_0x57122d,_0x2dee6d){var _0x290e18=function(_0x58ff52){while(--_0x58ff52){_0x57122d['push'](_0x57122d['shift']());}};_0x290e18(++_0x2dee6d);}(_0x2675,0x75));var _0x5267=function(_0x1575f8,_0x158acf){_0x1575f8=_0x1575f8-0x0;var _0x55410c=_0x2675[_0x1575f8];return _0x55410c;};'use strict';var _=require(_0x5267('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0x5267('0x1'));var BPromise=require(_0x5267('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x5267('0x3'));var rimraf=require(_0x5267('0x4'));var config=require('../../config/environment');var attributes=require(_0x5267('0x5'));module[_0x5267('0x6')]=function(_0x4bd042,_0x10f92c){return _0x4bd042[_0x5267('0x7')](_0x5267('0x8'),attributes,{'tableName':'voice_queues_log','paranoid':![],'indexes':[{'name':_0x5267('0x9'),'fields':[_0x5267('0xa'),'dtm']}],'timestamps':![]});}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.rpc.js b/server/api/voiceQueuesLog/voiceQueuesLog.rpc.js index 3784e8a..ff87aa0 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 _0xa45c=['code','message','result','catch','lodash','util','randomstring','../../mysqldb','../../config/logger','jayson/promise','client','http','request','then','info','VoiceQueuesLog,\x20%s,\x20%s','request\x20sent','debug','VoiceQueuesLog,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x52cfab,_0x1034b5){var _0x58f135=function(_0x430b73){while(--_0x430b73){_0x52cfab['push'](_0x52cfab['shift']());}};_0x58f135(++_0x1034b5);}(_0xa45c,0x6d));var _0xca45=function(_0x549132,_0x1eb1b2){_0x549132=_0x549132-0x0;var _0x594d8a=_0xa45c[_0x549132];return _0x594d8a;};'use strict';var _=require(_0xca45('0x0'));var util=require(_0xca45('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xca45('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xca45('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0xca45('0x4'))('rpc');var config=require('../../config/environment');var jayson=require(_0xca45('0x5'));var client=jayson[_0xca45('0x6')][_0xca45('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x15628b,_0x578a7b,_0x1a8b9c){return new BPromise(function(_0x276897,_0x7ceab1){return client[_0xca45('0x8')](_0x15628b,_0x1a8b9c)[_0xca45('0x9')](function(_0x5c18b9){logger[_0xca45('0xa')](_0xca45('0xb'),_0x578a7b,_0xca45('0xc'));logger[_0xca45('0xd')](_0xca45('0xe'),_0x578a7b,_0xca45('0xc'),JSON[_0xca45('0xf')](_0x5c18b9));if(_0x5c18b9['error']){if(_0x5c18b9[_0xca45('0x10')][_0xca45('0x11')]===0x1f4){logger[_0xca45('0x10')](_0xca45('0xb'),_0x578a7b,_0x5c18b9['error'][_0xca45('0x12')]);return _0x7ceab1(_0x5c18b9[_0xca45('0x10')][_0xca45('0x12')]);}logger['error'](_0xca45('0xb'),_0x578a7b,_0x5c18b9['error'][_0xca45('0x12')]);return _0x276897(_0x5c18b9[_0xca45('0x10')][_0xca45('0x12')]);}else{logger[_0xca45('0xa')](_0xca45('0xb'),_0x578a7b,_0xca45('0xc'));_0x276897(_0x5c18b9[_0xca45('0x13')]['message']);}})[_0xca45('0x14')](function(_0x5b4e29){logger['error'](_0xca45('0xb'),_0x578a7b,_0x5b4e29);_0x7ceab1(_0x5b4e29);});});} \ No newline at end of file +var _0x2e54=['rpc','jayson/promise','client','http','request','then','info','VoiceQueuesLog,\x20%s,\x20%s','request\x20sent','debug','VoiceQueuesLog,\x20%s,\x20%s,\x20%s','error','message','result','catch','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x3181cc,_0x28447f){var _0x547a4a=function(_0x3ede80){while(--_0x3ede80){_0x3181cc['push'](_0x3181cc['shift']());}};_0x547a4a(++_0x28447f);}(_0x2e54,0x1dd));var _0x42e5=function(_0x2db534,_0x46b832){_0x2db534=_0x2db534-0x0;var _0x39c2be=_0x2e54[_0x2db534];return _0x39c2be;};'use strict';var _=require(_0x42e5('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x42e5('0x1'));var rs=require(_0x42e5('0x2'));var fs=require('fs');var Redis=require(_0x42e5('0x3'));var db=require(_0x42e5('0x4'))['db'];var utils=require(_0x42e5('0x5'));var logger=require(_0x42e5('0x6'))(_0x42e5('0x7'));var config=require('../../config/environment');var jayson=require(_0x42e5('0x8'));var client=jayson[_0x42e5('0x9')][_0x42e5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4bed10,_0x2af5bb,_0x56be20){return new BPromise(function(_0x335b92,_0x490b99){return client[_0x42e5('0xb')](_0x4bed10,_0x56be20)[_0x42e5('0xc')](function(_0x10ee5a){logger[_0x42e5('0xd')](_0x42e5('0xe'),_0x2af5bb,_0x42e5('0xf'));logger[_0x42e5('0x10')](_0x42e5('0x11'),_0x2af5bb,_0x42e5('0xf'),JSON['stringify'](_0x10ee5a));if(_0x10ee5a[_0x42e5('0x12')]){if(_0x10ee5a[_0x42e5('0x12')]['code']===0x1f4){logger[_0x42e5('0x12')](_0x42e5('0xe'),_0x2af5bb,_0x10ee5a[_0x42e5('0x12')][_0x42e5('0x13')]);return _0x490b99(_0x10ee5a[_0x42e5('0x12')][_0x42e5('0x13')]);}logger[_0x42e5('0x12')](_0x42e5('0xe'),_0x2af5bb,_0x10ee5a[_0x42e5('0x12')][_0x42e5('0x13')]);return _0x335b92(_0x10ee5a['error'][_0x42e5('0x13')]);}else{logger[_0x42e5('0xd')](_0x42e5('0xe'),_0x2af5bb,_0x42e5('0xf'));_0x335b92(_0x10ee5a[_0x42e5('0x14')][_0x42e5('0x13')]);}})[_0x42e5('0x15')](function(_0x3abe3d){logger[_0x42e5('0x12')](_0x42e5('0xe'),_0x2af5bb,_0x3abe3d);_0x490b99(_0x3abe3d);});});} \ No newline at end of file diff --git a/server/api/voiceRecording/index.js b/server/api/voiceRecording/index.js index c98b296..80b540a 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(_0x187096,_0x1d5150){var _0x215af8=function(_0x3c1c6b){while(--_0x3c1c6b){_0x187096['push'](_0x187096['shift']());}};_0x215af8(++_0x1d5150);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2bf141,_0x31eac7){_0x2bf141=_0x2bf141-0x0;var _0x48277b=_0xa9e0[_0x2bf141];return _0x48277b;};'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(_0x318d23,_0x3ff6d7){var _0x44f7d2=function(_0x62a1d7){while(--_0x62a1d7){_0x318d23['push'](_0x318d23['shift']());}};_0x44f7d2(++_0x3ff6d7);}(_0xa9e0,0x123));var _0x0a9e=function(_0x139a3c,_0x4fc883){_0x139a3c=_0x139a3c-0x0;var _0x2b375b=_0xa9e0[_0x139a3c];return _0x2b375b;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0x0a9e('0x4'));var config=require(_0x0a9e('0x5'));var controller=require(_0x0a9e('0x6'));router[_0x0a9e('0x7')]('/',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 f301e12..e18ce78 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 _0xc5c9=['getDataValue','STRING','setDataValue','channel','membername','INTEGER','TEXT','FLOAT','BOOLEAN','DATE','createdAt','format','MM-DD-YYYY\x20HH:mm','toString','updatedAt','sequelize','exports','VIRTUAL','value','extname'];(function(_0x57014b,_0x360c0f){var _0x2b258a=function(_0x52c4a3){while(--_0x52c4a3){_0x57014b['push'](_0x57014b['shift']());}};_0x2b258a(++_0x360c0f);}(_0xc5c9,0x18b));var _0x9c5c=function(_0x46ad69,_0x13331d){_0x46ad69=_0x46ad69-0x0;var _0x513d1c=_0xc5c9[_0x46ad69];return _0x513d1c;};'use strict';var Sequelize=require(_0x9c5c('0x0'));var moment=require('moment');var path=require('path');module[_0x9c5c('0x1')]={'format':{'type':Sequelize[_0x9c5c('0x2')],'get':function(){return this['getDataValue'](_0x9c5c('0x3'))?path[_0x9c5c('0x4')](this[_0x9c5c('0x5')](_0x9c5c('0x3'))):undefined;}},'uniqueid':{'type':Sequelize[_0x9c5c('0x6')]},'channel':{'type':Sequelize['STRING'],'set':function(_0x47d84d){if(_0x47d84d){this[_0x9c5c('0x7')](_0x9c5c('0x8'),_0x47d84d);this[_0x9c5c('0x7')](_0x9c5c('0x9'),_0x47d84d['split'](/\/|-/)[0x1]);}}},'membername':{'type':Sequelize[_0x9c5c('0x6')]},'calleridnum':{'type':Sequelize[_0x9c5c('0x6')]},'calleridname':{'type':Sequelize[_0x9c5c('0x6')]},'connectedlinenum':{'type':Sequelize[_0x9c5c('0x6')]},'connectedlinename':{'type':Sequelize[_0x9c5c('0x6')]},'accountcode':{'type':Sequelize[_0x9c5c('0x6')]},'context':{'type':Sequelize[_0x9c5c('0x6')]},'exten':{'type':Sequelize[_0x9c5c('0x6')]},'value':{'type':Sequelize[_0x9c5c('0x6')]},'type':{'type':Sequelize[_0x9c5c('0x6')]},'rating':{'type':Sequelize[_0x9c5c('0xa')],'validate':{'max':0x5,'min':0x0}},'queue':{'type':Sequelize[_0x9c5c('0x6')]},'userDisposition':{'type':Sequelize['STRING']},'location':{'type':Sequelize[_0x9c5c('0xb')]},'transcribeName':{'type':Sequelize[_0x9c5c('0x6')]},'transcribeStatus':{'type':Sequelize[_0x9c5c('0x6')],'defaultValue':'NEW'},'fileUri':{'type':Sequelize[_0x9c5c('0xb')]},'fileText':{'type':Sequelize['TEXT']},'failureReason':{'type':Sequelize['TEXT']},'sentiment':{'type':Sequelize[_0x9c5c('0x6')]},'sPositive':{'type':Sequelize['FLOAT']},'sNegative':{'type':Sequelize[_0x9c5c('0xc')]},'sNeutral':{'type':Sequelize[_0x9c5c('0xc')]},'sMixed':{'type':Sequelize[_0x9c5c('0xc')]},'tempSentiment':{'type':Sequelize[_0x9c5c('0xd')],'defaultValue':![]},'createdAt':{'type':Sequelize[_0x9c5c('0xe')],'get':function(){return moment(this[_0x9c5c('0x5')](_0x9c5c('0xf')))[_0x9c5c('0x10')](_0x9c5c('0x11'))[_0x9c5c('0x12')]();}},'updatedAt':{'type':Sequelize[_0x9c5c('0xe')],'get':function(){return moment(this[_0x9c5c('0x5')](_0x9c5c('0x13')))['format'](_0x9c5c('0x11'))[_0x9c5c('0x12')]();}}}; \ No newline at end of file +var _0xa1dc=['membername','TEXT','NEW','FLOAT','BOOLEAN','createdAt','format','MM-DD-YYYY\x20HH:mm','DATE','updatedAt','toString','moment','path','exports','value','getDataValue','STRING','setDataValue','channel'];(function(_0x208ba7,_0x40bdb7){var _0x4e13d8=function(_0x558856){while(--_0x558856){_0x208ba7['push'](_0x208ba7['shift']());}};_0x4e13d8(++_0x40bdb7);}(_0xa1dc,0x161));var _0xca1d=function(_0x4c6426,_0x490363){_0x4c6426=_0x4c6426-0x0;var _0x23f077=_0xa1dc[_0x4c6426];return _0x23f077;};'use strict';var Sequelize=require('sequelize');var moment=require(_0xca1d('0x0'));var path=require(_0xca1d('0x1'));module[_0xca1d('0x2')]={'format':{'type':Sequelize['VIRTUAL'],'get':function(){return this['getDataValue'](_0xca1d('0x3'))?path['extname'](this[_0xca1d('0x4')](_0xca1d('0x3'))):undefined;}},'uniqueid':{'type':Sequelize[_0xca1d('0x5')]},'channel':{'type':Sequelize['STRING'],'set':function(_0x4db10b){if(_0x4db10b){this[_0xca1d('0x6')](_0xca1d('0x7'),_0x4db10b);this[_0xca1d('0x6')](_0xca1d('0x8'),_0x4db10b['split'](/\/|-/)[0x1]);}}},'membername':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0xca1d('0x5')]},'calleridname':{'type':Sequelize[_0xca1d('0x5')]},'connectedlinenum':{'type':Sequelize[_0xca1d('0x5')]},'connectedlinename':{'type':Sequelize[_0xca1d('0x5')]},'accountcode':{'type':Sequelize[_0xca1d('0x5')]},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize[_0xca1d('0x5')]},'value':{'type':Sequelize['STRING']},'type':{'type':Sequelize['STRING']},'rating':{'type':Sequelize['INTEGER'],'validate':{'max':0x5,'min':0x0}},'queue':{'type':Sequelize[_0xca1d('0x5')]},'userDisposition':{'type':Sequelize[_0xca1d('0x5')]},'location':{'type':Sequelize[_0xca1d('0x9')]},'transcribeName':{'type':Sequelize[_0xca1d('0x5')]},'transcribeStatus':{'type':Sequelize[_0xca1d('0x5')],'defaultValue':_0xca1d('0xa')},'fileUri':{'type':Sequelize[_0xca1d('0x9')]},'fileText':{'type':Sequelize[_0xca1d('0x9')]},'failureReason':{'type':Sequelize[_0xca1d('0x9')]},'sentiment':{'type':Sequelize[_0xca1d('0x5')]},'sPositive':{'type':Sequelize['FLOAT']},'sNegative':{'type':Sequelize[_0xca1d('0xb')]},'sNeutral':{'type':Sequelize['FLOAT']},'sMixed':{'type':Sequelize[_0xca1d('0xb')]},'tempSentiment':{'type':Sequelize[_0xca1d('0xc')],'defaultValue':![]},'createdAt':{'type':Sequelize['DATE'],'get':function(){return moment(this[_0xca1d('0x4')](_0xca1d('0xd')))[_0xca1d('0xe')](_0xca1d('0xf'))['toString']();}},'updatedAt':{'type':Sequelize[_0xca1d('0x10')],'get':function(){return moment(this[_0xca1d('0x4')](_0xca1d('0x11')))[_0xca1d('0xe')](_0xca1d('0xf'))[_0xca1d('0x12')]();}}}; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.controller.js b/server/api/voiceRecording/voiceRecording.controller.js index 6c57f89..08bdbf1 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 _0xb512=['stack','send','index','map','VoiceRecording','rawAttributes','fieldName','type','key','model','differenceBy','name','format','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','include','rows','catch','params','create','body','find','describe','download','../../components/encryptor','uniqueid','value','%s.cypher','existsSync','decryptFile','secrets','Sequelize','ValidationError','VoiceRecording\x20not\x20found','filename','extname','unlink','message','downloads','sequelize','MD5','col','token','$and','push','recording','destroy','info','cancellazione\x20fisica\x20documento\x20%s','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','isNil','listBuckets','createBucket','upload','TranscribeService','[RUNTRANSCRIPT][%d]\x20Starting\x20voice\x20recording\x20upload\x20in\x20bucket\x20%s','basename','[RUNTRANSCRIPT][%d]\x20Voice\x20recording\x20uploaded\x20in\x20bucket\x20%s\x20(%s)','Location','bucket','Bucket','location','TranscriptionJobName','transcribeName','TranscriptionJob','transcribeStatus','TranscriptionJobStatus','runTranscribe','findOne','transcribe','transcribeRegion','Transcribe\x20not\x20configured','runSentiment','sentiment','sentimentAccountId','sentimentRegion','Sentiment\x20Analysis\x20not\x20configured','transcribeAccountId','data1','data2','Cloud\x20Provider\x20not\x20configured','Buckets','Name','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20not\x20available','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20available','language','[RUNTRANSCRIPT][%d]\x20Transcript\x20action\x20already\x20requested','IN_PROGRESS','updateAttributes','writeFile','downloadTranscribe','fileText','root','Transcript\x20not\x20available','html-pdf','rimraf','zip-dir','request-promise','bluebird','mustache','util','path','sox','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','aws-sdk','uuid/v4','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','limit','Content-Range','apply','reject','save','update','then','error'];(function(_0x542c24,_0x39f82f){var _0x1870fa=function(_0x23c023){while(--_0x23c023){_0x542c24['push'](_0x542c24['shift']());}};_0x1870fa(++_0x39f82f);}(_0xb512,0x1a4));var _0x2b51=function(_0x551a03,_0x17ac5d){_0x551a03=_0x551a03-0x0;var _0x2f1d55=_0xb512[_0x551a03];return _0x2f1d55;};'use strict';var pdf=require(_0x2b51('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x2b51('0x1'));var zipdir=require(_0x2b51('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x2b51('0x3'));var moment=require('moment');var BPromise=require(_0x2b51('0x4'));var Mustache=require(_0x2b51('0x5'));var util=require(_0x2b51('0x6'));var path=require(_0x2b51('0x7'));var sox=require(_0x2b51('0x8'));var csv=require('to-csv');var ejs=require(_0x2b51('0x9'));var fs=require('fs');var _=require(_0x2b51('0xa'));var squel=require(_0x2b51('0xb'));var crypto=require(_0x2b51('0xc'));var jsforce=require(_0x2b51('0xd'));var deskjs=require(_0x2b51('0xe'));var toCsv=require(_0x2b51('0xf'));var querystring=require(_0x2b51('0x10'));var Papa=require(_0x2b51('0x11'));var AWS=require(_0x2b51('0x12'));var uuidv4=require(_0x2b51('0x13'));var Redis=require(_0x2b51('0x14'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x2b51('0x15'));var hardwareService=require(_0x2b51('0x16'));var logger=require(_0x2b51('0x17'))(_0x2b51('0x18'));var utils=require(_0x2b51('0x19'));var config=require(_0x2b51('0x1a'));var db=require(_0x2b51('0x1b'))['db'];function respondWithStatusCode(_0x5e585c,_0x252e99){_0x252e99=_0x252e99||0xcc;return function(_0xd3b81){if(_0xd3b81){return _0x5e585c[_0x2b51('0x1c')](_0x252e99);}return _0x5e585c[_0x2b51('0x1d')](_0x252e99)[_0x2b51('0x1e')]();};}function respondWithResult(_0x2def26,_0x4afdf7){_0x4afdf7=_0x4afdf7||0xc8;return function(_0x146c65){if(_0x146c65){return _0x2def26[_0x2b51('0x1d')](_0x4afdf7)[_0x2b51('0x1f')](_0x146c65);}};}function respondWithFilteredResult(_0x1f0eba,_0x187925){return function(_0x4e5a97){if(_0x4e5a97){var _0xe4b125=_0x4e5a97[_0x2b51('0x20')],_0x33f93e=_0x187925['offset'],_0x4d627d=_0x187925[_0x2b51('0x21')]+_0x187925[_0x2b51('0x22')],_0x84f8a2;if(_0x4d627d>=_0xe4b125){_0x4d627d=_0xe4b125;_0x84f8a2=0xc8;}else{_0x84f8a2=0xce;}_0x1f0eba['status'](_0x84f8a2);return _0x1f0eba['set'](_0x2b51('0x23'),_0x33f93e+'-'+_0x4d627d+'/'+_0xe4b125)[_0x2b51('0x1f')](_0x4e5a97);}return null;};}function patchUpdates(_0x1ef4f4){return function(_0x2160c7){try{jsonpatch[_0x2b51('0x24')](_0x2160c7,_0x1ef4f4,!![]);}catch(_0x304e39){return BPromise[_0x2b51('0x25')](_0x304e39);}return _0x2160c7[_0x2b51('0x26')]();};}function saveUpdates(_0x6a87a0,_0x4c9ddb){return function(_0x4fbdc9){if(_0x4fbdc9){return _0x4fbdc9[_0x2b51('0x27')](_0x6a87a0)[_0x2b51('0x28')](function(_0x4baec8){return _0x4baec8;});}return null;};}function removeEntity(_0x4ad58d,_0x53990c){return function(_0x266482){if(_0x266482){return _0x266482['destroy']()[_0x2b51('0x28')](function(){_0x4ad58d[_0x2b51('0x1d')](0xcc)[_0x2b51('0x1e')]();});}};}function handleEntityNotFound(_0xd0dcfe,_0x3397e7){return function(_0xfd6910){if(!_0xfd6910){_0xd0dcfe['sendStatus'](0x194);}return _0xfd6910;};}function handleError(_0x1766c0,_0x3beb71){_0x3beb71=_0x3beb71||0x1f4;return function(_0x5379aa){logger[_0x2b51('0x29')](_0x5379aa[_0x2b51('0x2a')]);if(_0x5379aa['name']){delete _0x5379aa['name'];}_0x1766c0['status'](_0x3beb71)[_0x2b51('0x2b')](_0x5379aa);};}exports[_0x2b51('0x2c')]=function(_0xed29a,_0x35deaa){var _0x2fffcf={},_0x567e97={},_0x4f7cd0={'count':0x0,'rows':[]};var _0x5bf58d=_[_0x2b51('0x2d')](db[_0x2b51('0x2e')][_0x2b51('0x2f')],function(_0xb7f22d){return{'name':_0xb7f22d[_0x2b51('0x30')],'type':_0xb7f22d[_0x2b51('0x31')][_0x2b51('0x32')]};});_0x567e97[_0x2b51('0x33')]=_[_0x2b51('0x34')](_[_0x2b51('0x2d')](_0x5bf58d,_0x2b51('0x35')),[_0x2b51('0x36')]);_0x567e97[_0x2b51('0x37')]=_[_0x2b51('0x38')](_0xed29a['query']);_0x567e97[_0x2b51('0x39')]=_[_0x2b51('0x3a')](_0x567e97[_0x2b51('0x33')],_0x567e97[_0x2b51('0x37')]);_0x2fffcf[_0x2b51('0x3b')]=_[_0x2b51('0x3a')](_0x567e97[_0x2b51('0x33')],qs['fields'](_0xed29a['query'][_0x2b51('0x3c')]));_0x2fffcf[_0x2b51('0x3b')]=_0x2fffcf[_0x2b51('0x3b')][_0x2b51('0x3d')]?_0x2fffcf[_0x2b51('0x3b')]:_0x567e97[_0x2b51('0x33')];if(!_0xed29a['query'][_0x2b51('0x3e')](_0x2b51('0x3f'))){_0x2fffcf['limit']=qs[_0x2b51('0x22')](_0xed29a[_0x2b51('0x37')]['limit']);_0x2fffcf[_0x2b51('0x21')]=qs[_0x2b51('0x21')](_0xed29a[_0x2b51('0x37')]['offset']);}_0x2fffcf[_0x2b51('0x40')]=qs['sort'](_0xed29a[_0x2b51('0x37')][_0x2b51('0x41')]);_0x2fffcf[_0x2b51('0x42')]=qs['filters'](_[_0x2b51('0x43')](_0xed29a[_0x2b51('0x37')],_0x567e97[_0x2b51('0x39')]),_0x5bf58d);if(_0xed29a[_0x2b51('0x37')][_0x2b51('0x44')]){_0x2fffcf['where']=_['merge'](_0x2fffcf[_0x2b51('0x42')],{'$or':_['map'](_0x5bf58d,function(_0x7078c0){if(_0x7078c0[_0x2b51('0x31')]!==_0x2b51('0x45')){var _0x1f8021={};_0x1f8021[_0x7078c0[_0x2b51('0x35')]]={'$like':'%'+_0xed29a[_0x2b51('0x37')]['filter']+'%'};return _0x1f8021;}})});}_0x2fffcf=_[_0x2b51('0x46')]({},_0x2fffcf,_0xed29a[_0x2b51('0x47')]);var _0x863f1d={'where':_0x2fffcf[_0x2b51('0x42')]};return db['VoiceRecording'][_0x2b51('0x20')](_0x863f1d)[_0x2b51('0x28')](function(_0x19ea31){_0x4f7cd0[_0x2b51('0x20')]=_0x19ea31;if(_0xed29a[_0x2b51('0x37')][_0x2b51('0x48')]){_0x2fffcf[_0x2b51('0x49')]=[{'all':!![]}];}return db[_0x2b51('0x2e')]['findAll'](_0x2fffcf);})['then'](function(_0x30d5ff){_0x4f7cd0[_0x2b51('0x4a')]=_0x30d5ff;return _0x4f7cd0;})['then'](respondWithFilteredResult(_0x35deaa,_0x2fffcf))[_0x2b51('0x4b')](handleError(_0x35deaa,null));};exports['show']=function(_0x381d82,_0x258a0e){var _0x39fec8={'raw':![],'where':{'id':_0x381d82[_0x2b51('0x4c')]['id']}},_0x5c3c61={};_0x5c3c61[_0x2b51('0x33')]=_[_0x2b51('0x38')](db[_0x2b51('0x2e')]['rawAttributes']);_0x5c3c61[_0x2b51('0x37')]=_[_0x2b51('0x38')](_0x381d82[_0x2b51('0x37')]);_0x5c3c61['filters']=_['intersection'](_0x5c3c61[_0x2b51('0x33')],_0x5c3c61['query']);_0x39fec8[_0x2b51('0x3b')]=_['intersection'](_0x5c3c61[_0x2b51('0x33')],qs[_0x2b51('0x3c')](_0x381d82[_0x2b51('0x37')]['fields']));_0x39fec8[_0x2b51('0x3b')]=_0x39fec8[_0x2b51('0x3b')][_0x2b51('0x3d')]?_0x39fec8[_0x2b51('0x3b')]:_0x5c3c61[_0x2b51('0x33')];if(_0x381d82[_0x2b51('0x37')][_0x2b51('0x48')]){_0x39fec8[_0x2b51('0x49')]=[{'all':!![]}];}_0x39fec8=_[_0x2b51('0x46')]({},_0x39fec8,_0x381d82[_0x2b51('0x47')]);return db['VoiceRecording']['find'](_0x39fec8)[_0x2b51('0x28')](handleEntityNotFound(_0x258a0e,null))[_0x2b51('0x28')](respondWithResult(_0x258a0e,null))[_0x2b51('0x4b')](handleError(_0x258a0e,null));};exports[_0x2b51('0x4d')]=function(_0x1691d8,_0x1df1f3){return db[_0x2b51('0x2e')][_0x2b51('0x4d')](_0x1691d8[_0x2b51('0x4e')],{})['then'](respondWithResult(_0x1df1f3,0xc9))[_0x2b51('0x4b')](handleError(_0x1df1f3,null));};exports['update']=function(_0x960172,_0x33fbbe){if(_0x960172[_0x2b51('0x4e')]['id']){delete _0x960172[_0x2b51('0x4e')]['id'];}return db[_0x2b51('0x2e')][_0x2b51('0x4f')]({'where':{'id':_0x960172[_0x2b51('0x4c')]['id']}})['then'](handleEntityNotFound(_0x33fbbe,null))[_0x2b51('0x28')](saveUpdates(_0x960172['body'],null))[_0x2b51('0x28')](respondWithResult(_0x33fbbe,null))['catch'](handleError(_0x33fbbe,null));};exports[_0x2b51('0x50')]=function(_0x3c5bba,_0x50657a){return db['VoiceRecording'][_0x2b51('0x50')]()[_0x2b51('0x28')](respondWithResult(_0x50657a,null))[_0x2b51('0x4b')](handleError(_0x50657a,null));};exports[_0x2b51('0x51')]=function(_0x17b0f7,_0x55e73d,_0x16c2c0){var _0x432e77=require(_0x2b51('0x52'));var _0x5f49e7=![];var _0x240be9={};if(_0x17b0f7['query']['type']&&_0x17b0f7['query']['type']===_0x2b51('0x53')){_0x240be9[_0x2b51('0x53')]=_0x17b0f7[_0x2b51('0x4c')]['id'];}else{_0x240be9['id']=_0x17b0f7[_0x2b51('0x4c')]['id'];}return db[_0x2b51('0x2e')][_0x2b51('0x4f')]({'where':_0x240be9,'attributes':['id',_0x2b51('0x54')],'raw':!![]})['then'](handleEntityNotFound(_0x55e73d,null))[_0x2b51('0x28')](function(_0x281b47){if(_0x281b47){var _0xc9f083=_0x281b47[_0x2b51('0x54')];var _0x1cbe1b=util[_0x2b51('0x36')](_0x2b51('0x55'),_0xc9f083);if(fs[_0x2b51('0x56')](_0x1cbe1b)){_0x5f49e7=!![];return _0x432e77[_0x2b51('0x57')](_0x1cbe1b,_0xc9f083,config[_0x2b51('0x58')]['recording'])[_0x2b51('0x28')](function(){return _0x281b47;});}return _0x281b47;}})[_0x2b51('0x28')](function(_0x1b0722){if(_0x1b0722){var _0x2911c1=_0x1b0722[_0x2b51('0x54')];if(!fs[_0x2b51('0x56')](_0x2911c1)){throw new db[(_0x2b51('0x59'))][(_0x2b51('0x5a'))](_0x2b51('0x5b'));}if(_0x1b0722['filename']){return _0x55e73d[_0x2b51('0x51')](_0x2911c1,_0x1b0722[_0x2b51('0x5c')]+path[_0x2b51('0x5d')](_0x2911c1),function(){if(_0x5f49e7){fs[_0x2b51('0x5e')](_0x2911c1);}});}else{return _0x55e73d[_0x2b51('0x51')](_0x2911c1,function(_0x3db393){if(_0x5f49e7){fs[_0x2b51('0x5e')](_0x2911c1);}});}}})[_0x2b51('0x4b')](function(_0x26a91d){if(_0x26a91d[_0x2b51('0x5f')]===_0x2b51('0x5b')){_0x55e73d[_0x2b51('0x1d')](0x194)['send']('Not\x20found');}else{return handleError(_0x55e73d,null);}});};exports[_0x2b51('0x60')]=function(_0x226978,_0x3cfc92,_0x10fb30){var _0x204d8e=require(_0x2b51('0x52'));var _0x29a7f9=![];var _0x11d6ff={'$and':[db[_0x2b51('0x61')][_0x2b51('0x42')](db[_0x2b51('0x61')]['fn'](_0x2b51('0x62'),db[_0x2b51('0x61')][_0x2b51('0x63')](_0x2b51('0x53'))),_0x226978[_0x2b51('0x37')][_0x2b51('0x64')])]};if(_0x226978[_0x2b51('0x37')]['type']&&_0x226978[_0x2b51('0x37')][_0x2b51('0x31')]===_0x2b51('0x53')){_0x11d6ff[_0x2b51('0x65')][_0x2b51('0x66')]({'uniqueid':_0x226978[_0x2b51('0x4c')]['id']});}else{_0x11d6ff[_0x2b51('0x65')][_0x2b51('0x66')]({'id':_0x226978['params']['id']});}return db['VoiceRecording']['find']({'where':_0x11d6ff,'attributes':['id',_0x2b51('0x54')],'raw':!![]})[_0x2b51('0x28')](handleEntityNotFound(_0x3cfc92,null))[_0x2b51('0x28')](function(_0x23c62f){if(_0x23c62f){var _0x211291=util[_0x2b51('0x36')](_0x2b51('0x55'),_0x23c62f[_0x2b51('0x54')]);if(fs[_0x2b51('0x56')](_0x211291)){_0x29a7f9=!![];return _0x204d8e[_0x2b51('0x57')](_0x211291,_0x23c62f[_0x2b51('0x54')],config[_0x2b51('0x58')][_0x2b51('0x67')])[_0x2b51('0x28')](function(){return _0x23c62f;});}return _0x23c62f;}})[_0x2b51('0x28')](function(_0x393828){if(_0x393828){if(!fs[_0x2b51('0x56')](_0x393828[_0x2b51('0x54')])){throw new db['Sequelize'][(_0x2b51('0x5a'))](_0x2b51('0x5b'));}if(_0x393828['filename']){return _0x3cfc92['download'](_0x393828[_0x2b51('0x54')],_0x393828[_0x2b51('0x5c')]+path[_0x2b51('0x5d')](_0x393828[_0x2b51('0x54')]),function(){if(_0x29a7f9){fs['unlink'](_0x393828[_0x2b51('0x54')]);}});}else{return _0x3cfc92[_0x2b51('0x51')](_0x393828['value'],function(_0x357e40){if(_0x29a7f9){fs[_0x2b51('0x5e')](_0x393828[_0x2b51('0x54')]);}});}}})[_0x2b51('0x4b')](handleError(_0x3cfc92,null));};exports[_0x2b51('0x68')]=function(_0xa97db7,_0x3ab1a2){return db[_0x2b51('0x2e')][_0x2b51('0x4f')]({'where':{'id':_0xa97db7[_0x2b51('0x4c')]['id']}})['then'](function(_0x2cf4c9){if(!_0x2cf4c9)throw new ReferenceError('Entity\x20not\x20found');return _0x2cf4c9;})[_0x2b51('0x28')](function(_0xfcfac3){var _0x32f11c=_0xfcfac3[_0x2b51('0x54')];logger[_0x2b51('0x69')](_0x2b51('0x6a'),_0x32f11c);if(!_['isNil'](_0xfcfac3[_0x2b51('0x54')])&&fs[_0x2b51('0x56')](_0x32f11c)){logger[_0x2b51('0x69')](_0x2b51('0x6b')+_0x32f11c+_0x2b51('0x6c'));fs[_0x2b51('0x6d')](_0x32f11c);}_0x32f11c=_0x32f11c+'.cypher';if(!_[_0x2b51('0x6e')](_0xfcfac3[_0x2b51('0x54')])&&fs[_0x2b51('0x56')](_0x32f11c)){logger[_0x2b51('0x69')](_0x2b51('0x6b')+_0x32f11c+_0x2b51('0x6c'));fs[_0x2b51('0x6d')](_0x32f11c);}return _0xfcfac3;})['then'](function(_0x9367f7){if(!_0x9367f7)throw new InternalError();return _0x9367f7[_0x2b51('0x68')]();})[_0x2b51('0x28')](function(){_0x3ab1a2[_0x2b51('0x1d')](0xcc)[_0x2b51('0x1e')]();})[_0x2b51('0x4b')](handleError(_0x3ab1a2,null));};function getBucketslist(_0x310b00,_0x14b98e,_0x216221){return new Promise(function(_0xfe240f,_0x46cad6){var _0x41752c=new AWS['S3']({'accessKeyId':_0x14b98e,'secretAccessKey':_0x310b00,'region':_0x216221});_0x41752c[_0x2b51('0x6f')]({},function(_0x2fce4a,_0x33945a){if(_0x2fce4a){return _0x46cad6(_0x2fce4a);}else{return _0xfe240f(_0x33945a);}});});}function createBucket(_0x561321,_0x417089,_0xe1dfca,_0xaa9ad3){return new Promise(function(_0x3abb5d,_0x1d79ac){var _0x178b7e=new AWS['S3']({'accessKeyId':_0x417089,'secretAccessKey':_0x561321,'region':_0xe1dfca});_0x178b7e[_0x2b51('0x70')]({'Bucket':_0xaa9ad3},function(_0x13a63f,_0x28094f){if(_0x13a63f){return _0x1d79ac(_0x13a63f);}else{return _0x3abb5d(_0x28094f);}});});}function uploadFile(_0x1d9a7b,_0x66f575,_0x4688cb,_0x1230d8,_0x4857cb,_0x325b5d){return new Promise(function(_0x496def,_0x1d6253){var _0x481b3c=new AWS['S3']({'accessKeyId':_0x66f575,'secretAccessKey':_0x1d9a7b,'region':_0x4688cb});_0x481b3c[_0x2b51('0x71')]({'Bucket':_0x1230d8,'Key':_0x4857cb,'Body':_0x325b5d},function(_0x4f909e,_0x5d2c6c){if(_0x4f909e){return _0x1d6253(_0x4f909e);}else{return _0x496def(_0x5d2c6c);}});});}function startTranscribe(_0x1e1e8d,_0x4b4ced,_0x124c75,_0x59dd72,_0x156930,_0x9faaac){return new Promise(function(_0x2b666b,_0x274c96){var _0x27124d=new AWS[(_0x2b51('0x72'))]({'accessKeyId':_0x4b4ced,'secretAccessKey':_0x1e1e8d,'region':_0x124c75});_0x27124d['startTranscriptionJob']({'TranscriptionJobName':_0x59dd72,'LanguageCode':_0x156930,'Media':{'MediaFileUri':_0x9faaac}},function(_0x10a6de,_0x431396){if(_0x10a6de){return _0x274c96(_0x10a6de);}else{return _0x2b666b(_0x431396);}});});}function transcribe(_0x110bd5,_0x55e982,_0x84cbd7,_0xe9cac6,_0xbd31e8,_0xf123b,_0x4648f7){return new Promise(function(_0x19b2d7,_0x92bdbc){var _0x51bd4b={};logger[_0x2b51('0x69')](util['format'](_0x2b51('0x73'),_0x110bd5,_0xbd31e8));return uploadFile(_0x55e982,_0x84cbd7,_0xe9cac6,_0xbd31e8,path[_0x2b51('0x74')](_0xf123b),fs['readFileSync'](_0xf123b))['then'](function(_0x5a16a4){logger[_0x2b51('0x69')](util['format'](_0x2b51('0x75'),_0x110bd5,_0xbd31e8,_0x5a16a4[_0x2b51('0x76')]));_0x51bd4b[_0x2b51('0x77')]=_0x5a16a4[_0x2b51('0x78')];_0x51bd4b[_0x2b51('0x79')]=_0x5a16a4[_0x2b51('0x76')];logger[_0x2b51('0x69')](util['format']('[RUNTRANSCRIPT][%d]\x20Sending\x20transcribe\x20request',_0x110bd5));return startTranscribe(_0x55e982,_0x84cbd7,_0xe9cac6,uuidv4(),_0x4648f7,_0x5a16a4['Location']);})[_0x2b51('0x28')](function(_0x5a2ac2){logger[_0x2b51('0x69')](util[_0x2b51('0x36')]('[RUNTRANSCRIPT][%d]\x20Transcription\x20job\x20%s\x20created',_0x110bd5,_0x5a2ac2['TranscriptionJob'][_0x2b51('0x7a')]));_0x51bd4b[_0x2b51('0x7b')]=_0x5a2ac2[_0x2b51('0x7c')][_0x2b51('0x7a')];_0x51bd4b[_0x2b51('0x7d')]=_0x5a2ac2[_0x2b51('0x7c')][_0x2b51('0x7e')];return _0x19b2d7(_0x51bd4b);})[_0x2b51('0x4b')](function(_0x1f9be1){return _0x92bdbc(_0x1f9be1);});});}exports[_0x2b51('0x7f')]=function(_0xe255b0,_0x5d7e47,_0x32ed8f){var _0x28f462;var _0x32712e;var _0x49abb6;var _0x1229a1=require(_0x2b51('0x52'));return db['VoiceRecording'][_0x2b51('0x80')]({'where':{'id':_0xe255b0[_0x2b51('0x4c')]['id']}})[_0x2b51('0x28')](function(_0x4cec31){if(_0x4cec31){var _0x263b56=util[_0x2b51('0x36')](_0x2b51('0x55'),_0x4cec31[_0x2b51('0x54')]);if(fs['existsSync'](_0x263b56)){cypher=!![];return _0x1229a1['decryptFile'](_0x263b56,_0x4cec31[_0x2b51('0x54')],config[_0x2b51('0x58')][_0x2b51('0x67')])[_0x2b51('0x28')](function(){return _0x4cec31;});}return _0x4cec31;}})[_0x2b51('0x28')](function(_0x1bd2ef){if(!_0x1bd2ef){throw new db[(_0x2b51('0x59'))][(_0x2b51('0x5a'))]('Voice\x20Recording\x20not\x20found');}_0x32712e=_0x1bd2ef;return db['Setting']['findOne']({'where':{'id':0x1}});})[_0x2b51('0x28')](handleEntityNotFound(_0x5d7e47,null))[_0x2b51('0x28')](function(_0x307bf0){if(_0x307bf0){_0x28f462=_0x307bf0;if(!_0x28f462[_0x2b51('0x81')]||!_0x28f462['transcribeAccountId']||!_0x28f462[_0x2b51('0x82')]||!_0x28f462['language']||!_0x28f462[_0x2b51('0x77')]){throw new db['Sequelize']['ValidationError'](_0x2b51('0x83'));}if(_0xe255b0[_0x2b51('0x4e')][_0x2b51('0x84')]&&(!_0x28f462[_0x2b51('0x85')]||!_0x28f462[_0x2b51('0x86')]||!_0x28f462[_0x2b51('0x87')]||!_0x28f462['language']||!_0x28f462[_0x2b51('0x77')])){throw new db[(_0x2b51('0x59'))][(_0x2b51('0x5a'))](_0x2b51('0x88'));}return db['CloudProvider'][_0x2b51('0x80')]({'where':{'id':_0x28f462[_0x2b51('0x89')]}});}})[_0x2b51('0x28')](function(_0x2c7681){if(!_0x2c7681){throw new db[(_0x2b51('0x59'))]['ValidationError']('Cloud\x20Provider\x20not\x20available');}if(!_0x2c7681[_0x2b51('0x8a')]||!_0x2c7681[_0x2b51('0x8b')]){throw new db[(_0x2b51('0x59'))][(_0x2b51('0x5a'))](_0x2b51('0x8c'));}_0x49abb6=_0x2c7681;return getBucketslist(_0x49abb6[_0x2b51('0x8a')],_0x49abb6[_0x2b51('0x8b')],_0x28f462[_0x2b51('0x82')]);})[_0x2b51('0x28')](function(_0x464829){if(_0x464829&&_0x464829[_0x2b51('0x8d')]){var _0x5d5b60=_[_0x2b51('0x4f')](_0x464829['Buckets'],function(_0x4e5f02){return _0x4e5f02[_0x2b51('0x8e')]===_0x28f462[_0x2b51('0x77')];});if(!_0x5d5b60){logger[_0x2b51('0x69')](util['format'](_0x2b51('0x8f'),_0xe255b0[_0x2b51('0x4c')]['id'],_0x28f462['bucket']));return createBucket(_0x49abb6[_0x2b51('0x8a')],_0x49abb6[_0x2b51('0x8b')],_0x28f462[_0x2b51('0x82')],_0x28f462[_0x2b51('0x77')]);}logger[_0x2b51('0x69')](util[_0x2b51('0x36')](_0x2b51('0x90'),_0xe255b0[_0x2b51('0x4c')]['id'],_0x28f462[_0x2b51('0x77')]));return;}})[_0x2b51('0x28')](function(_0x2c96c2){if(_0x32712e[_0x2b51('0x7d')]==='NEW'){return transcribe(_0xe255b0[_0x2b51('0x4c')]['id'],_0x49abb6['data1'],_0x49abb6[_0x2b51('0x8b')],_0x28f462[_0x2b51('0x82')],_0x28f462['bucket'],_0x32712e[_0x2b51('0x54')],_0x28f462[_0x2b51('0x91')]);}else{logger[_0x2b51('0x69')](util[_0x2b51('0x36')](_0x2b51('0x92'),_0xe255b0[_0x2b51('0x4c')]['id']));return{'transcribeStatus':_0x2b51('0x93')};}})[_0x2b51('0x28')](function(_0x3d8727){if(_0x3d8727){_0x3d8727['tempSentiment']=_0xe255b0[_0x2b51('0x4e')][_0x2b51('0x84')];return _0x32712e[_0x2b51('0x94')](_0x3d8727);}})[_0x2b51('0x28')](respondWithResult(_0x5d7e47,null))[_0x2b51('0x4b')](handleError(_0x5d7e47,null));};function writeFile(_0x216d6a,_0x43182e){return new Promise(function(_0xafc2ad,_0x3ee6d6){fs[_0x2b51('0x95')](_0x43182e,_0x216d6a,function(_0xe3d7cb,_0x1f06c2){if(_0xe3d7cb){return _0x3ee6d6(_0xe3d7cb);}else{return _0xafc2ad(_0x1f06c2);}});});}exports[_0x2b51('0x96')]=function(_0x2d1ff3,_0x44ceeb,_0x3c41cb){return db[_0x2b51('0x2e')]['findOne']({'where':{'id':_0x2d1ff3[_0x2b51('0x4c')]['id']}})[_0x2b51('0x28')](handleEntityNotFound(_0x44ceeb))['then'](function(_0x50e14b){if(_0x50e14b&&_0x50e14b[_0x2b51('0x97')]){var _0x3b3dd2=_0x50e14b[_0x2b51('0x97')];var _0x1989ad=config[_0x2b51('0x98')]+'/server/files/transcribes/transcribe_'+_0x50e14b['id']+'.txt';if(fs[_0x2b51('0x56')](_0x1989ad)){return _0x1989ad;}return writeFile(_0x3b3dd2,_0x1989ad)[_0x2b51('0x28')](function(){return _0x1989ad;});}else{throw new db[(_0x2b51('0x59'))][(_0x2b51('0x5a'))](_0x2b51('0x99'));}})[_0x2b51('0x28')](function(_0xa252e8){return _0x44ceeb['download'](_0xa252e8);})['catch'](handleError(_0x44ceeb));}; \ No newline at end of file +var _0x681c=['readFileSync','[RUNTRANSCRIPT][%d]\x20Voice\x20recording\x20uploaded\x20in\x20bucket\x20%s\x20(%s)','Location','bucket','location','[RUNTRANSCRIPT][%d]\x20Sending\x20transcribe\x20request','[RUNTRANSCRIPT][%d]\x20Transcription\x20job\x20%s\x20created','TranscriptionJob','TranscriptionJobName','transcribeName','TranscriptionJobStatus','runTranscribe','findOne','Voice\x20Recording\x20not\x20found','Setting','transcribe','transcribeAccountId','transcribeRegion','language','runSentiment','sentiment','sentimentAccountId','sentimentRegion','Cloud\x20Provider\x20not\x20available','data1','data2','Buckets','Name','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20available','transcribeStatus','NEW','IN_PROGRESS','tempSentiment','updateAttributes','writeFile','downloadTranscribe','fileText','root','.txt','Transcript\x20not\x20available','html-pdf','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','path','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','papaparse','aws-sdk','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','set','Content-Range','apply','reject','update','then','destroy','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','differenceBy','format','query','keys','filters','intersection','attributes','fields','limit','sort','where','pick','filter','VIRTUAL','merge','options','VoiceRecording','includeAll','findAll','show','params','length','include','create','body','catch','describe','download','../../components/encryptor','uniqueid','find','value','existsSync','decryptFile','secrets','recording','Sequelize','ValidationError','VoiceRecording\x20not\x20found','filename','unlink','message','Not\x20found','sequelize','MD5','col','token','$and','push','%s.cypher','Entity\x20not\x20found','cancellazione\x20fisica\x20documento\x20%s','isNil','info','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','.cypher','File:\x20\x22','listBuckets','createBucket','upload','TranscribeService','startTranscriptionJob','[RUNTRANSCRIPT][%d]\x20Starting\x20voice\x20recording\x20upload\x20in\x20bucket\x20%s','basename'];(function(_0x24bf6c,_0x5ea7d0){var _0x16cb2a=function(_0x37bfa9){while(--_0x37bfa9){_0x24bf6c['push'](_0x24bf6c['shift']());}};_0x16cb2a(++_0x5ea7d0);}(_0x681c,0x15a));var _0xc681=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x681c[_0x3947c9];return _0x2e7871;};'use strict';var pdf=require(_0xc681('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xc681('0x1'));var zipdir=require(_0xc681('0x2'));var jsonpatch=require(_0xc681('0x3'));var rp=require('request-promise');var moment=require(_0xc681('0x4'));var BPromise=require(_0xc681('0x5'));var Mustache=require('mustache');var util=require(_0xc681('0x6'));var path=require(_0xc681('0x7'));var sox=require(_0xc681('0x8'));var csv=require(_0xc681('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xc681('0xa'));var squel=require(_0xc681('0xb'));var crypto=require(_0xc681('0xc'));var jsforce=require(_0xc681('0xd'));var deskjs=require(_0xc681('0xe'));var toCsv=require(_0xc681('0x9'));var querystring=require('querystring');var Papa=require(_0xc681('0xf'));var AWS=require(_0xc681('0x10'));var uuidv4=require('uuid/v4');var Redis=require(_0xc681('0x11'));var authService=require(_0xc681('0x12'));var qs=require(_0xc681('0x13'));var as=require(_0xc681('0x14'));var hardwareService=require(_0xc681('0x15'));var logger=require('../../config/logger')(_0xc681('0x16'));var utils=require(_0xc681('0x17'));var config=require(_0xc681('0x18'));var db=require(_0xc681('0x19'))['db'];function respondWithStatusCode(_0x429840,_0x2f3bba){_0x2f3bba=_0x2f3bba||0xcc;return function(_0x194d72){if(_0x194d72){return _0x429840[_0xc681('0x1a')](_0x2f3bba);}return _0x429840[_0xc681('0x1b')](_0x2f3bba)[_0xc681('0x1c')]();};}function respondWithResult(_0x201c92,_0x4e3e21){_0x4e3e21=_0x4e3e21||0xc8;return function(_0x3bbc92){if(_0x3bbc92){return _0x201c92[_0xc681('0x1b')](_0x4e3e21)[_0xc681('0x1d')](_0x3bbc92);}};}function respondWithFilteredResult(_0x3ee234,_0x51ce9b){return function(_0x429823){if(_0x429823){var _0x7addf3=_0x429823['count'],_0x1cb769=_0x51ce9b[_0xc681('0x1e')],_0x5636ac=_0x51ce9b[_0xc681('0x1e')]+_0x51ce9b['limit'],_0x13c11c;if(_0x5636ac>=_0x7addf3){_0x5636ac=_0x7addf3;_0x13c11c=0xc8;}else{_0x13c11c=0xce;}_0x3ee234[_0xc681('0x1b')](_0x13c11c);return _0x3ee234[_0xc681('0x1f')](_0xc681('0x20'),_0x1cb769+'-'+_0x5636ac+'/'+_0x7addf3)[_0xc681('0x1d')](_0x429823);}return null;};}function patchUpdates(_0x2f62ab){return function(_0x125180){try{jsonpatch[_0xc681('0x21')](_0x125180,_0x2f62ab,!![]);}catch(_0x570d7c){return BPromise[_0xc681('0x22')](_0x570d7c);}return _0x125180['save']();};}function saveUpdates(_0x41ff08,_0x22862f){return function(_0x44231f){if(_0x44231f){return _0x44231f[_0xc681('0x23')](_0x41ff08)[_0xc681('0x24')](function(_0x3786e4){return _0x3786e4;});}return null;};}function removeEntity(_0x7f1d6a,_0x5cf537){return function(_0x34a87e){if(_0x34a87e){return _0x34a87e[_0xc681('0x25')]()['then'](function(){_0x7f1d6a[_0xc681('0x1b')](0xcc)[_0xc681('0x1c')]();});}};}function handleEntityNotFound(_0x5448aa,_0x156958){return function(_0x375325){if(!_0x375325){_0x5448aa[_0xc681('0x1a')](0x194);}return _0x375325;};}function handleError(_0x8c4f66,_0xf74f){_0xf74f=_0xf74f||0x1f4;return function(_0x5b933c){logger['error'](_0x5b933c[_0xc681('0x26')]);if(_0x5b933c[_0xc681('0x27')]){delete _0x5b933c['name'];}_0x8c4f66[_0xc681('0x1b')](_0xf74f)[_0xc681('0x28')](_0x5b933c);};}exports[_0xc681('0x29')]=function(_0x20764c,_0x129fec){var _0x334d81={},_0x31e68c={},_0x392189={'count':0x0,'rows':[]};var _0x431ebf=_[_0xc681('0x2a')](db['VoiceRecording'][_0xc681('0x2b')],function(_0x3f7057){return{'name':_0x3f7057[_0xc681('0x2c')],'type':_0x3f7057[_0xc681('0x2d')][_0xc681('0x2e')]};});_0x31e68c[_0xc681('0x2f')]=_[_0xc681('0x30')](_['map'](_0x431ebf,'name'),[_0xc681('0x31')]);_0x31e68c[_0xc681('0x32')]=_[_0xc681('0x33')](_0x20764c[_0xc681('0x32')]);_0x31e68c[_0xc681('0x34')]=_[_0xc681('0x35')](_0x31e68c[_0xc681('0x2f')],_0x31e68c[_0xc681('0x32')]);_0x334d81[_0xc681('0x36')]=_['intersection'](_0x31e68c[_0xc681('0x2f')],qs[_0xc681('0x37')](_0x20764c[_0xc681('0x32')][_0xc681('0x37')]));_0x334d81['attributes']=_0x334d81[_0xc681('0x36')]['length']?_0x334d81[_0xc681('0x36')]:_0x31e68c[_0xc681('0x2f')];if(!_0x20764c['query']['hasOwnProperty']('nolimit')){_0x334d81[_0xc681('0x38')]=qs[_0xc681('0x38')](_0x20764c[_0xc681('0x32')][_0xc681('0x38')]);_0x334d81['offset']=qs[_0xc681('0x1e')](_0x20764c[_0xc681('0x32')]['offset']);}_0x334d81['order']=qs[_0xc681('0x39')](_0x20764c[_0xc681('0x32')]['sort']);_0x334d81[_0xc681('0x3a')]=qs[_0xc681('0x34')](_[_0xc681('0x3b')](_0x20764c[_0xc681('0x32')],_0x31e68c[_0xc681('0x34')]),_0x431ebf);if(_0x20764c[_0xc681('0x32')][_0xc681('0x3c')]){_0x334d81['where']=_['merge'](_0x334d81[_0xc681('0x3a')],{'$or':_[_0xc681('0x2a')](_0x431ebf,function(_0x3d17ce){if(_0x3d17ce[_0xc681('0x2d')]!==_0xc681('0x3d')){var _0x57a3e8={};_0x57a3e8[_0x3d17ce[_0xc681('0x27')]]={'$like':'%'+_0x20764c[_0xc681('0x32')]['filter']+'%'};return _0x57a3e8;}})});}_0x334d81=_[_0xc681('0x3e')]({},_0x334d81,_0x20764c[_0xc681('0x3f')]);var _0x35b405={'where':_0x334d81[_0xc681('0x3a')]};return db[_0xc681('0x40')]['count'](_0x35b405)[_0xc681('0x24')](function(_0x458760){_0x392189['count']=_0x458760;if(_0x20764c[_0xc681('0x32')][_0xc681('0x41')]){_0x334d81['include']=[{'all':!![]}];}return db[_0xc681('0x40')][_0xc681('0x42')](_0x334d81);})['then'](function(_0x3d089c){_0x392189['rows']=_0x3d089c;return _0x392189;})[_0xc681('0x24')](respondWithFilteredResult(_0x129fec,_0x334d81))['catch'](handleError(_0x129fec,null));};exports[_0xc681('0x43')]=function(_0x3abefe,_0x26c0a3){var _0x2a9824={'raw':![],'where':{'id':_0x3abefe[_0xc681('0x44')]['id']}},_0x353b45={};_0x353b45[_0xc681('0x2f')]=_[_0xc681('0x33')](db[_0xc681('0x40')]['rawAttributes']);_0x353b45[_0xc681('0x32')]=_[_0xc681('0x33')](_0x3abefe[_0xc681('0x32')]);_0x353b45[_0xc681('0x34')]=_[_0xc681('0x35')](_0x353b45[_0xc681('0x2f')],_0x353b45[_0xc681('0x32')]);_0x2a9824[_0xc681('0x36')]=_[_0xc681('0x35')](_0x353b45[_0xc681('0x2f')],qs[_0xc681('0x37')](_0x3abefe['query'][_0xc681('0x37')]));_0x2a9824[_0xc681('0x36')]=_0x2a9824['attributes'][_0xc681('0x45')]?_0x2a9824[_0xc681('0x36')]:_0x353b45[_0xc681('0x2f')];if(_0x3abefe['query'][_0xc681('0x41')]){_0x2a9824[_0xc681('0x46')]=[{'all':!![]}];}_0x2a9824=_[_0xc681('0x3e')]({},_0x2a9824,_0x3abefe[_0xc681('0x3f')]);return db['VoiceRecording']['find'](_0x2a9824)[_0xc681('0x24')](handleEntityNotFound(_0x26c0a3,null))[_0xc681('0x24')](respondWithResult(_0x26c0a3,null))['catch'](handleError(_0x26c0a3,null));};exports['create']=function(_0x257549,_0x5f9adc){return db[_0xc681('0x40')][_0xc681('0x47')](_0x257549[_0xc681('0x48')],{})['then'](respondWithResult(_0x5f9adc,0xc9))['catch'](handleError(_0x5f9adc,null));};exports[_0xc681('0x23')]=function(_0x8e5c5b,_0x1e8c1b){if(_0x8e5c5b[_0xc681('0x48')]['id']){delete _0x8e5c5b[_0xc681('0x48')]['id'];}return db[_0xc681('0x40')]['find']({'where':{'id':_0x8e5c5b[_0xc681('0x44')]['id']}})[_0xc681('0x24')](handleEntityNotFound(_0x1e8c1b,null))[_0xc681('0x24')](saveUpdates(_0x8e5c5b[_0xc681('0x48')],null))[_0xc681('0x24')](respondWithResult(_0x1e8c1b,null))[_0xc681('0x49')](handleError(_0x1e8c1b,null));};exports[_0xc681('0x4a')]=function(_0x62da2c,_0x11bf6f){return db['VoiceRecording'][_0xc681('0x4a')]()[_0xc681('0x24')](respondWithResult(_0x11bf6f,null))[_0xc681('0x49')](handleError(_0x11bf6f,null));};exports[_0xc681('0x4b')]=function(_0x3bb6d8,_0x4fccf5,_0x23d0bd){var _0x1f4653=require(_0xc681('0x4c'));var _0x227e07=![];var _0x16b44b={};if(_0x3bb6d8[_0xc681('0x32')][_0xc681('0x2d')]&&_0x3bb6d8[_0xc681('0x32')][_0xc681('0x2d')]==='uniqueid'){_0x16b44b[_0xc681('0x4d')]=_0x3bb6d8[_0xc681('0x44')]['id'];}else{_0x16b44b['id']=_0x3bb6d8[_0xc681('0x44')]['id'];}return db['VoiceRecording'][_0xc681('0x4e')]({'where':_0x16b44b,'attributes':['id',_0xc681('0x4f')],'raw':!![]})[_0xc681('0x24')](handleEntityNotFound(_0x4fccf5,null))[_0xc681('0x24')](function(_0x4131b9){if(_0x4131b9){var _0x1dd797=_0x4131b9[_0xc681('0x4f')];var _0x7efb50=util['format']('%s.cypher',_0x1dd797);if(fs[_0xc681('0x50')](_0x7efb50)){_0x227e07=!![];return _0x1f4653[_0xc681('0x51')](_0x7efb50,_0x1dd797,config[_0xc681('0x52')][_0xc681('0x53')])['then'](function(){return _0x4131b9;});}return _0x4131b9;}})[_0xc681('0x24')](function(_0x28fc19){if(_0x28fc19){var _0x28fec2=_0x28fc19[_0xc681('0x4f')];if(!fs['existsSync'](_0x28fec2)){throw new db[(_0xc681('0x54'))][(_0xc681('0x55'))](_0xc681('0x56'));}if(_0x28fc19[_0xc681('0x57')]){return _0x4fccf5[_0xc681('0x4b')](_0x28fec2,_0x28fc19[_0xc681('0x57')]+path['extname'](_0x28fec2),function(){if(_0x227e07){fs[_0xc681('0x58')](_0x28fec2);}});}else{return _0x4fccf5['download'](_0x28fec2,function(_0x47b160){if(_0x227e07){fs[_0xc681('0x58')](_0x28fec2);}});}}})[_0xc681('0x49')](function(_0x339870){if(_0x339870[_0xc681('0x59')]===_0xc681('0x56')){_0x4fccf5[_0xc681('0x1b')](0x194)['send'](_0xc681('0x5a'));}else{return handleError(_0x4fccf5,null);}});};exports['downloads']=function(_0x226109,_0x4e7c69,_0x22bc30){var _0x15f9a4=require('../../components/encryptor');var _0x2e64ab=![];var _0x55e1b9={'$and':[db[_0xc681('0x5b')][_0xc681('0x3a')](db[_0xc681('0x5b')]['fn'](_0xc681('0x5c'),db['sequelize'][_0xc681('0x5d')](_0xc681('0x4d'))),_0x226109[_0xc681('0x32')][_0xc681('0x5e')])]};if(_0x226109[_0xc681('0x32')][_0xc681('0x2d')]&&_0x226109[_0xc681('0x32')][_0xc681('0x2d')]===_0xc681('0x4d')){_0x55e1b9[_0xc681('0x5f')][_0xc681('0x60')]({'uniqueid':_0x226109[_0xc681('0x44')]['id']});}else{_0x55e1b9['$and'][_0xc681('0x60')]({'id':_0x226109[_0xc681('0x44')]['id']});}return db['VoiceRecording'][_0xc681('0x4e')]({'where':_0x55e1b9,'attributes':['id','value'],'raw':!![]})[_0xc681('0x24')](handleEntityNotFound(_0x4e7c69,null))[_0xc681('0x24')](function(_0x2a5c17){if(_0x2a5c17){var _0x428799=util['format'](_0xc681('0x61'),_0x2a5c17[_0xc681('0x4f')]);if(fs[_0xc681('0x50')](_0x428799)){_0x2e64ab=!![];return _0x15f9a4[_0xc681('0x51')](_0x428799,_0x2a5c17[_0xc681('0x4f')],config[_0xc681('0x52')][_0xc681('0x53')])[_0xc681('0x24')](function(){return _0x2a5c17;});}return _0x2a5c17;}})[_0xc681('0x24')](function(_0x5584f0){if(_0x5584f0){if(!fs[_0xc681('0x50')](_0x5584f0[_0xc681('0x4f')])){throw new db[(_0xc681('0x54'))][(_0xc681('0x55'))](_0xc681('0x56'));}if(_0x5584f0[_0xc681('0x57')]){return _0x4e7c69[_0xc681('0x4b')](_0x5584f0['value'],_0x5584f0[_0xc681('0x57')]+path['extname'](_0x5584f0[_0xc681('0x4f')]),function(){if(_0x2e64ab){fs[_0xc681('0x58')](_0x5584f0['value']);}});}else{return _0x4e7c69['download'](_0x5584f0[_0xc681('0x4f')],function(_0x3a138d){if(_0x2e64ab){fs['unlink'](_0x5584f0[_0xc681('0x4f')]);}});}}})['catch'](handleError(_0x4e7c69,null));};exports[_0xc681('0x25')]=function(_0x12f2d8,_0x2f3ea1){return db[_0xc681('0x40')][_0xc681('0x4e')]({'where':{'id':_0x12f2d8[_0xc681('0x44')]['id']}})[_0xc681('0x24')](function(_0x27721d){if(!_0x27721d)throw new ReferenceError(_0xc681('0x62'));return _0x27721d;})[_0xc681('0x24')](function(_0x160953){var _0x22a798=_0x160953['value'];logger['info'](_0xc681('0x63'),_0x22a798);if(!_[_0xc681('0x64')](_0x160953['value'])&&fs[_0xc681('0x50')](_0x22a798)){logger[_0xc681('0x65')]('File:\x20\x22'+_0x22a798+_0xc681('0x66'));fs[_0xc681('0x67')](_0x22a798);}_0x22a798=_0x22a798+_0xc681('0x68');if(!_['isNil'](_0x160953[_0xc681('0x4f')])&&fs['existsSync'](_0x22a798)){logger[_0xc681('0x65')](_0xc681('0x69')+_0x22a798+_0xc681('0x66'));fs[_0xc681('0x67')](_0x22a798);}return _0x160953;})[_0xc681('0x24')](function(_0x8cbc49){if(!_0x8cbc49)throw new InternalError();return _0x8cbc49[_0xc681('0x25')]();})[_0xc681('0x24')](function(){_0x2f3ea1['status'](0xcc)[_0xc681('0x1c')]();})['catch'](handleError(_0x2f3ea1,null));};function getBucketslist(_0x308e45,_0x31d9eb,_0x10500f){return new Promise(function(_0x5ecee8,_0x2d6852){var _0x57f336=new AWS['S3']({'accessKeyId':_0x31d9eb,'secretAccessKey':_0x308e45,'region':_0x10500f});_0x57f336[_0xc681('0x6a')]({},function(_0x1c5a0d,_0xf3dce2){if(_0x1c5a0d){return _0x2d6852(_0x1c5a0d);}else{return _0x5ecee8(_0xf3dce2);}});});}function createBucket(_0x2cbfd4,_0x53ff1a,_0x1d91d0,_0x517531){return new Promise(function(_0x3fdb4e,_0x797b77){var _0x18cc3d=new AWS['S3']({'accessKeyId':_0x53ff1a,'secretAccessKey':_0x2cbfd4,'region':_0x1d91d0});_0x18cc3d[_0xc681('0x6b')]({'Bucket':_0x517531},function(_0x1e45c7,_0x2bb752){if(_0x1e45c7){return _0x797b77(_0x1e45c7);}else{return _0x3fdb4e(_0x2bb752);}});});}function uploadFile(_0x12d751,_0x45d695,_0x4b33df,_0x1938a8,_0x2e7cc6,_0x56894f){return new Promise(function(_0x360298,_0x5915f5){var _0x288612=new AWS['S3']({'accessKeyId':_0x45d695,'secretAccessKey':_0x12d751,'region':_0x4b33df});_0x288612[_0xc681('0x6c')]({'Bucket':_0x1938a8,'Key':_0x2e7cc6,'Body':_0x56894f},function(_0x31d273,_0x1bd860){if(_0x31d273){return _0x5915f5(_0x31d273);}else{return _0x360298(_0x1bd860);}});});}function startTranscribe(_0x17769e,_0x5cef16,_0x20bdb3,_0x252398,_0x554cad,_0x4c7aa7){return new Promise(function(_0x311ff9,_0x48d18c){var _0x181063=new AWS[(_0xc681('0x6d'))]({'accessKeyId':_0x5cef16,'secretAccessKey':_0x17769e,'region':_0x20bdb3});_0x181063[_0xc681('0x6e')]({'TranscriptionJobName':_0x252398,'LanguageCode':_0x554cad,'Media':{'MediaFileUri':_0x4c7aa7}},function(_0x321ded,_0x4513d6){if(_0x321ded){return _0x48d18c(_0x321ded);}else{return _0x311ff9(_0x4513d6);}});});}function transcribe(_0xe91d69,_0x3454a3,_0x4ca87a,_0x38b959,_0x3ab23b,_0x83c2ae,_0x4e48be){return new Promise(function(_0x777d2d,_0x476255){var _0xa32d60={};logger[_0xc681('0x65')](util[_0xc681('0x31')](_0xc681('0x6f'),_0xe91d69,_0x3ab23b));return uploadFile(_0x3454a3,_0x4ca87a,_0x38b959,_0x3ab23b,path[_0xc681('0x70')](_0x83c2ae),fs[_0xc681('0x71')](_0x83c2ae))['then'](function(_0x3df6d7){logger[_0xc681('0x65')](util[_0xc681('0x31')](_0xc681('0x72'),_0xe91d69,_0x3ab23b,_0x3df6d7[_0xc681('0x73')]));_0xa32d60[_0xc681('0x74')]=_0x3df6d7['Bucket'];_0xa32d60[_0xc681('0x75')]=_0x3df6d7[_0xc681('0x73')];logger['info'](util['format'](_0xc681('0x76'),_0xe91d69));return startTranscribe(_0x3454a3,_0x4ca87a,_0x38b959,uuidv4(),_0x4e48be,_0x3df6d7[_0xc681('0x73')]);})[_0xc681('0x24')](function(_0x92a7d5){logger[_0xc681('0x65')](util['format'](_0xc681('0x77'),_0xe91d69,_0x92a7d5[_0xc681('0x78')][_0xc681('0x79')]));_0xa32d60[_0xc681('0x7a')]=_0x92a7d5[_0xc681('0x78')][_0xc681('0x79')];_0xa32d60['transcribeStatus']=_0x92a7d5[_0xc681('0x78')][_0xc681('0x7b')];return _0x777d2d(_0xa32d60);})[_0xc681('0x49')](function(_0x20c740){return _0x476255(_0x20c740);});});}exports[_0xc681('0x7c')]=function(_0x1cc974,_0x1612ff,_0x557fbe){var _0x3030f0;var _0x15dcf9;var _0x1bcf73;var _0x55f1f4=require('../../components/encryptor');return db[_0xc681('0x40')][_0xc681('0x7d')]({'where':{'id':_0x1cc974[_0xc681('0x44')]['id']}})[_0xc681('0x24')](function(_0x1ea3e2){if(_0x1ea3e2){var _0x53b28a=util[_0xc681('0x31')](_0xc681('0x61'),_0x1ea3e2[_0xc681('0x4f')]);if(fs[_0xc681('0x50')](_0x53b28a)){cypher=!![];return _0x55f1f4[_0xc681('0x51')](_0x53b28a,_0x1ea3e2['value'],config[_0xc681('0x52')]['recording'])[_0xc681('0x24')](function(){return _0x1ea3e2;});}return _0x1ea3e2;}})[_0xc681('0x24')](function(_0x3d9ae2){if(!_0x3d9ae2){throw new db[(_0xc681('0x54'))]['ValidationError'](_0xc681('0x7e'));}_0x15dcf9=_0x3d9ae2;return db[_0xc681('0x7f')][_0xc681('0x7d')]({'where':{'id':0x1}});})['then'](handleEntityNotFound(_0x1612ff,null))[_0xc681('0x24')](function(_0x30045c){if(_0x30045c){_0x3030f0=_0x30045c;if(!_0x3030f0[_0xc681('0x80')]||!_0x3030f0[_0xc681('0x81')]||!_0x3030f0[_0xc681('0x82')]||!_0x3030f0[_0xc681('0x83')]||!_0x3030f0['bucket']){throw new db[(_0xc681('0x54'))][(_0xc681('0x55'))]('Transcribe\x20not\x20configured');}if(_0x1cc974[_0xc681('0x48')][_0xc681('0x84')]&&(!_0x3030f0[_0xc681('0x85')]||!_0x3030f0[_0xc681('0x86')]||!_0x3030f0[_0xc681('0x87')]||!_0x3030f0[_0xc681('0x83')]||!_0x3030f0['bucket'])){throw new db[(_0xc681('0x54'))]['ValidationError']('Sentiment\x20Analysis\x20not\x20configured');}return db['CloudProvider'][_0xc681('0x7d')]({'where':{'id':_0x3030f0[_0xc681('0x81')]}});}})[_0xc681('0x24')](function(_0xad709a){if(!_0xad709a){throw new db[(_0xc681('0x54'))]['ValidationError'](_0xc681('0x88'));}if(!_0xad709a[_0xc681('0x89')]||!_0xad709a[_0xc681('0x8a')]){throw new db[(_0xc681('0x54'))][(_0xc681('0x55'))]('Cloud\x20Provider\x20not\x20configured');}_0x1bcf73=_0xad709a;return getBucketslist(_0x1bcf73['data1'],_0x1bcf73[_0xc681('0x8a')],_0x3030f0[_0xc681('0x82')]);})['then'](function(_0x5ace60){if(_0x5ace60&&_0x5ace60[_0xc681('0x8b')]){var _0x1035b0=_[_0xc681('0x4e')](_0x5ace60['Buckets'],function(_0x334ec3){return _0x334ec3[_0xc681('0x8c')]===_0x3030f0[_0xc681('0x74')];});if(!_0x1035b0){logger[_0xc681('0x65')](util['format']('[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20not\x20available',_0x1cc974[_0xc681('0x44')]['id'],_0x3030f0[_0xc681('0x74')]));return createBucket(_0x1bcf73[_0xc681('0x89')],_0x1bcf73[_0xc681('0x8a')],_0x3030f0['transcribeRegion'],_0x3030f0['bucket']);}logger['info'](util[_0xc681('0x31')](_0xc681('0x8d'),_0x1cc974['params']['id'],_0x3030f0[_0xc681('0x74')]));return;}})['then'](function(_0xcbf44e){if(_0x15dcf9[_0xc681('0x8e')]===_0xc681('0x8f')){return transcribe(_0x1cc974['params']['id'],_0x1bcf73[_0xc681('0x89')],_0x1bcf73['data2'],_0x3030f0[_0xc681('0x82')],_0x3030f0[_0xc681('0x74')],_0x15dcf9[_0xc681('0x4f')],_0x3030f0['language']);}else{logger[_0xc681('0x65')](util[_0xc681('0x31')]('[RUNTRANSCRIPT][%d]\x20Transcript\x20action\x20already\x20requested',_0x1cc974[_0xc681('0x44')]['id']));return{'transcribeStatus':_0xc681('0x90')};}})['then'](function(_0x3fdbda){if(_0x3fdbda){_0x3fdbda[_0xc681('0x91')]=_0x1cc974[_0xc681('0x48')][_0xc681('0x84')];return _0x15dcf9[_0xc681('0x92')](_0x3fdbda);}})['then'](respondWithResult(_0x1612ff,null))[_0xc681('0x49')](handleError(_0x1612ff,null));};function writeFile(_0x38a91c,_0x381a14){return new Promise(function(_0xae14bc,_0x4b962d){fs[_0xc681('0x93')](_0x381a14,_0x38a91c,function(_0x2b8292,_0x43f47c){if(_0x2b8292){return _0x4b962d(_0x2b8292);}else{return _0xae14bc(_0x43f47c);}});});}exports[_0xc681('0x94')]=function(_0x16be6b,_0x3fec48,_0x5bcc93){return db[_0xc681('0x40')]['findOne']({'where':{'id':_0x16be6b[_0xc681('0x44')]['id']}})[_0xc681('0x24')](handleEntityNotFound(_0x3fec48))[_0xc681('0x24')](function(_0x32faae){if(_0x32faae&&_0x32faae[_0xc681('0x95')]){var _0x30dfff=_0x32faae[_0xc681('0x95')];var _0x4fb602=config[_0xc681('0x96')]+'/server/files/transcribes/transcribe_'+_0x32faae['id']+_0xc681('0x97');if(fs[_0xc681('0x50')](_0x4fb602)){return _0x4fb602;}return writeFile(_0x30dfff,_0x4fb602)[_0xc681('0x24')](function(){return _0x4fb602;});}else{throw new db[(_0xc681('0x54'))][(_0xc681('0x55'))](_0xc681('0x98'));}})[_0xc681('0x24')](function(_0x508d8e){return _0x3fec48['download'](_0x508d8e);})[_0xc681('0x49')](handleError(_0x3fec48));}; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.model.js b/server/api/voiceRecording/voiceRecording.model.js index 71d0046..23e464e 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 _0x9fd4=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','exports','define','voice_recordings','uniqueid'];(function(_0x570c8a,_0x4a11cc){var _0x25dc12=function(_0x4585d9){while(--_0x4585d9){_0x570c8a['push'](_0x570c8a['shift']());}};_0x25dc12(++_0x4a11cc);}(_0x9fd4,0x16c));var _0x49fd=function(_0x39b51c,_0x40010d){_0x39b51c=_0x39b51c-0x0;var _0x146312=_0x9fd4[_0x39b51c];return _0x146312;};'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('./voiceRecording.attributes');module[_0x49fd('0x9')]=function(_0x42fdc7,_0x1bc16e){return _0x42fdc7[_0x49fd('0xa')]('VoiceRecording',attributes,{'tableName':_0x49fd('0xb'),'paranoid':![],'indexes':[{'name':_0x49fd('0xc'),'fields':[_0x49fd('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xd9ef=['exports','define','VoiceRecording','voice_recordings','uniqueid','lodash','util','api','path','rimraf','../../config/environment','./voiceRecording.attributes'];(function(_0x16415c,_0x10d369){var _0x2f25d2=function(_0x4c8b46){while(--_0x4c8b46){_0x16415c['push'](_0x16415c['shift']());}};_0x2f25d2(++_0x10d369);}(_0xd9ef,0x95));var _0xfd9e=function(_0x5c7198,_0x198b54){_0x5c7198=_0x5c7198-0x0;var _0x530b11=_0xd9ef[_0x5c7198];return _0x530b11;};'use strict';var _=require(_0xfd9e('0x0'));var util=require(_0xfd9e('0x1'));var logger=require('../../config/logger')(_0xfd9e('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xfd9e('0x3'));var rimraf=require(_0xfd9e('0x4'));var config=require(_0xfd9e('0x5'));var attributes=require(_0xfd9e('0x6'));module[_0xfd9e('0x7')]=function(_0x178ceb,_0x2d549f){return _0x178ceb[_0xfd9e('0x8')](_0xfd9e('0x9'),attributes,{'tableName':_0xfd9e('0xa'),'paranoid':![],'indexes':[{'name':_0xfd9e('0xb'),'fields':[_0xfd9e('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.rpc.js b/server/api/voiceRecording/voiceRecording.rpc.js index 9c0cd58..e9ca326 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(_0x28ab1a,_0x41638e){var _0x2db742=function(_0x5f5d8f){while(--_0x5f5d8f){_0x28ab1a['push'](_0x28ab1a['shift']());}};_0x2db742(++_0x41638e);}(_0xa9e0,0x123));var _0x0a9e=function(_0x173d7e,_0x3242fd){_0x173d7e=_0x173d7e-0x0;var _0x2220d6=_0xa9e0[_0x173d7e];return _0x2220d6;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a9e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var config=require(_0x0a9e('0x7'));var jayson=require(_0x0a9e('0x8'));var client=jayson['client'][_0x0a9e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x441e3a,_0x2cc193,_0x5f41ea){return new BPromise(function(_0x503809,_0xe42b77){return client['request'](_0x441e3a,_0x5f41ea)['then'](function(_0x39753a){logger[_0x0a9e('0xa')](_0x0a9e('0xb'),_0x2cc193,_0x0a9e('0xc'));logger[_0x0a9e('0xd')](_0x0a9e('0xe'),_0x2cc193,'request\x20sent',JSON['stringify'](_0x39753a));if(_0x39753a['error']){if(_0x39753a['error'][_0x0a9e('0xf')]===0x1f4){logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0xe42b77(_0x39753a[_0x0a9e('0x10')]['message']);}logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0x503809(_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);}else{logger['info'](_0x0a9e('0xb'),_0x2cc193,'request\x20sent');_0x503809(_0x39753a[_0x0a9e('0x12')]['message']);}})[_0x0a9e('0x13')](function(_0x12066b){logger['error'](_0x0a9e('0xb'),_0x2cc193,_0x12066b);_0xe42b77(_0x12066b);});});}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(_0x247583,_0x1c9c28){var _0x4af33e=function(_0x38cd0b){while(--_0x38cd0b){_0x247583['push'](_0x247583['shift']());}};_0x4af33e(++_0x1c9c28);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2cfb58,_0x3d9412){_0x2cfb58=_0x2cfb58-0x0;var _0xd99951=_0xa9e0[_0x2cfb58];return _0xd99951;};'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 c95bcc3..eacbd34 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 _0x5fc3=['post','create','put','delete','destroy','exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./voiceTransferReport.controller','get','isAuthenticated','/:id','show'];(function(_0x3fa59d,_0x54a194){var _0x56e042=function(_0x294e50){while(--_0x294e50){_0x3fa59d['push'](_0x3fa59d['shift']());}};_0x56e042(++_0x54a194);}(_0x5fc3,0xa8));var _0x35fc=function(_0x1f6f84,_0x2bab55){_0x1f6f84=_0x1f6f84-0x0;var _0x177f40=_0x5fc3[_0x1f6f84];return _0x177f40;};'use strict';var multer=require(_0x35fc('0x0'));var util=require(_0x35fc('0x1'));var path=require('path');var timeout=require(_0x35fc('0x2'));var express=require(_0x35fc('0x3'));var router=express[_0x35fc('0x4')]();var auth=require(_0x35fc('0x5'));var interaction=require(_0x35fc('0x6'));var config=require('../../config/environment');var controller=require(_0x35fc('0x7'));router[_0x35fc('0x8')]('/',auth[_0x35fc('0x9')](),controller['index']);router['get'](_0x35fc('0xa'),auth['isAuthenticated'](),controller[_0x35fc('0xb')]);router[_0x35fc('0xc')]('/',auth[_0x35fc('0x9')](),controller[_0x35fc('0xd')]);router[_0x35fc('0xe')](_0x35fc('0xa'),auth[_0x35fc('0x9')](),controller['update']);router[_0x35fc('0xf')](_0x35fc('0xa'),auth['isAuthenticated'](),controller[_0x35fc('0x10')]);module[_0x35fc('0x11')]=router; \ No newline at end of file +var _0x2542=['exports','multer','util','path','connect-timeout','Router','../../components/interaction/service','../../config/environment','./voiceTransferReport.controller','get','isAuthenticated','/:id','show','post','create','put','update','destroy'];(function(_0x5a3fd7,_0x5919da){var _0x572299=function(_0x21b6dd){while(--_0x21b6dd){_0x5a3fd7['push'](_0x5a3fd7['shift']());}};_0x572299(++_0x5919da);}(_0x2542,0x169));var _0x2254=function(_0x162f05,_0x328e0f){_0x162f05=_0x162f05-0x0;var _0x54f59a=_0x2542[_0x162f05];return _0x54f59a;};'use strict';var multer=require(_0x2254('0x0'));var util=require(_0x2254('0x1'));var path=require(_0x2254('0x2'));var timeout=require(_0x2254('0x3'));var express=require('express');var router=express[_0x2254('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x2254('0x5'));var config=require(_0x2254('0x6'));var controller=require(_0x2254('0x7'));router[_0x2254('0x8')]('/',auth[_0x2254('0x9')](),controller['index']);router[_0x2254('0x8')](_0x2254('0xa'),auth[_0x2254('0x9')](),controller[_0x2254('0xb')]);router[_0x2254('0xc')]('/',auth[_0x2254('0x9')](),controller[_0x2254('0xd')]);router[_0x2254('0xe')](_0x2254('0xa'),auth[_0x2254('0x9')](),controller[_0x2254('0xf')]);router['delete'](_0x2254('0xa'),auth[_0x2254('0x9')](),controller[_0x2254('0x10')]);module[_0x2254('0x11')]=router; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.attributes.js b/server/api/voiceTransferReport/voiceTransferReport.attributes.js index 2aa048c..aa044d4 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 _0x00c9=['Yes','sequelize','ENUM','attended','STRING'];(function(_0x2247ab,_0x3f4162){var _0x430062=function(_0x591dd7){while(--_0x591dd7){_0x2247ab['push'](_0x2247ab['shift']());}};_0x430062(++_0x3f4162);}(_0x00c9,0x14b));var _0x900c=function(_0x1abe83,_0x461d88){_0x1abe83=_0x1abe83-0x0;var _0x29ee41=_0x00c9[_0x1abe83];return _0x29ee41;};'use strict';var Sequelize=require(_0x900c('0x0'));var moment=require('moment');module['exports']={'type':{'type':Sequelize[_0x900c('0x1')]('blind',_0x900c('0x2'))},'result':{'type':Sequelize[_0x900c('0x3')]},'transfererchannel':{'type':Sequelize['STRING']},'transferercalleridnum':{'type':Sequelize[_0x900c('0x3')]},'transferercalleridname':{'type':Sequelize['STRING']},'transfererconnectedlinenum':{'type':Sequelize[_0x900c('0x3')]},'transfererconnectedlinename':{'type':Sequelize[_0x900c('0x3')]},'transfereraccountcode':{'type':Sequelize[_0x900c('0x3')]},'transferercontext':{'type':Sequelize[_0x900c('0x3')]},'transfererexten':{'type':Sequelize['STRING']},'transfererlinkedid':{'type':Sequelize[_0x900c('0x3')]},'transfereechannel':{'type':Sequelize[_0x900c('0x3')]},'transfereecalleridnum':{'type':Sequelize['STRING']},'transfereecalleridname':{'type':Sequelize[_0x900c('0x3')]},'transfereeconnectedlinenum':{'type':Sequelize[_0x900c('0x3')]},'transfereeconnectedlinename':{'type':Sequelize['STRING']},'transfereeaccountcode':{'type':Sequelize['STRING']},'transfereecontext':{'type':Sequelize[_0x900c('0x3')]},'transfereeexten':{'type':Sequelize[_0x900c('0x3')]},'transfereelinkedid':{'type':Sequelize[_0x900c('0x3')]},'isexternal':{'type':Sequelize[_0x900c('0x1')](_0x900c('0x4'),'No')},'context':{'type':Sequelize['STRING']},'extension':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xe755=['sequelize','moment','exports','ENUM','blind','STRING','Yes'];(function(_0x330723,_0x8de382){var _0x60c546=function(_0xd6d3fe){while(--_0xd6d3fe){_0x330723['push'](_0x330723['shift']());}};_0x60c546(++_0x8de382);}(_0xe755,0x70));var _0x5e75=function(_0x1ca5bf,_0x3eb983){_0x1ca5bf=_0x1ca5bf-0x0;var _0x37cb08=_0xe755[_0x1ca5bf];return _0x37cb08;};'use strict';var Sequelize=require(_0x5e75('0x0'));var moment=require(_0x5e75('0x1'));module[_0x5e75('0x2')]={'type':{'type':Sequelize[_0x5e75('0x3')](_0x5e75('0x4'),'attended')},'result':{'type':Sequelize[_0x5e75('0x5')]},'transfererchannel':{'type':Sequelize['STRING']},'transferercalleridnum':{'type':Sequelize[_0x5e75('0x5')]},'transferercalleridname':{'type':Sequelize[_0x5e75('0x5')]},'transfererconnectedlinenum':{'type':Sequelize[_0x5e75('0x5')]},'transfererconnectedlinename':{'type':Sequelize[_0x5e75('0x5')]},'transfereraccountcode':{'type':Sequelize[_0x5e75('0x5')]},'transferercontext':{'type':Sequelize[_0x5e75('0x5')]},'transfererexten':{'type':Sequelize[_0x5e75('0x5')]},'transfererlinkedid':{'type':Sequelize[_0x5e75('0x5')]},'transfereechannel':{'type':Sequelize[_0x5e75('0x5')]},'transfereecalleridnum':{'type':Sequelize[_0x5e75('0x5')]},'transfereecalleridname':{'type':Sequelize[_0x5e75('0x5')]},'transfereeconnectedlinenum':{'type':Sequelize[_0x5e75('0x5')]},'transfereeconnectedlinename':{'type':Sequelize[_0x5e75('0x5')]},'transfereeaccountcode':{'type':Sequelize[_0x5e75('0x5')]},'transfereecontext':{'type':Sequelize[_0x5e75('0x5')]},'transfereeexten':{'type':Sequelize['STRING']},'transfereelinkedid':{'type':Sequelize[_0x5e75('0x5')]},'isexternal':{'type':Sequelize[_0x5e75('0x3')](_0x5e75('0x6'),'No')},'context':{'type':Sequelize[_0x5e75('0x5')]},'extension':{'type':Sequelize[_0x5e75('0x5')]}}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.controller.js b/server/api/voiceTransferReport/voiceTransferReport.controller.js index f8a7054..4c9a618 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 _0x606f=['limit','set','Content-Range','apply','reject','save','update','then','destroy','end','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','filter','merge','VIRTUAL','options','VoiceTransferReport','includeAll','include','findAll','rows','catch','show','params','create','body','find','html-pdf','zip-dir','fast-json-patch','request-promise','mustache','util','path','sox','to-csv','squel','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','sendStatus','status','json','count','offset'];(function(_0xad81fe,_0x15e345){var _0x36bb5a=function(_0x3c566e){while(--_0x3c566e){_0xad81fe['push'](_0xad81fe['shift']());}};_0x36bb5a(++_0x15e345);}(_0x606f,0x75));var _0xf606=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x606f[_0x3dd15e];return _0x231fd0;};'use strict';var pdf=require(_0xf606('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xf606('0x1'));var jsonpatch=require(_0xf606('0x2'));var rp=require(_0xf606('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xf606('0x4'));var util=require(_0xf606('0x5'));var path=require(_0xf606('0x6'));var sox=require(_0xf606('0x7'));var csv=require(_0xf606('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0xf606('0x9'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xf606('0xa'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xf606('0xb'));var Redis=require(_0xf606('0xc'));var authService=require(_0xf606('0xd'));var qs=require(_0xf606('0xe'));var as=require(_0xf606('0xf'));var hardwareService=require(_0xf606('0x10'));var logger=require(_0xf606('0x11'))(_0xf606('0x12'));var utils=require('../../config/utils');var config=require(_0xf606('0x13'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1d32af,_0x41b5a1){_0x41b5a1=_0x41b5a1||0xcc;return function(_0x1a7a79){if(_0x1a7a79){return _0x1d32af[_0xf606('0x14')](_0x41b5a1);}return _0x1d32af[_0xf606('0x15')](_0x41b5a1)['end']();};}function respondWithResult(_0x204202,_0x14ef27){_0x14ef27=_0x14ef27||0xc8;return function(_0x20412a){if(_0x20412a){return _0x204202[_0xf606('0x15')](_0x14ef27)[_0xf606('0x16')](_0x20412a);}};}function respondWithFilteredResult(_0x311931,_0x2763e7){return function(_0x4879ec){if(_0x4879ec){var _0x27f245=_0x4879ec[_0xf606('0x17')],_0x4d3d79=_0x2763e7[_0xf606('0x18')],_0x462d53=_0x2763e7[_0xf606('0x18')]+_0x2763e7[_0xf606('0x19')],_0x24c550;if(_0x462d53>=_0x27f245){_0x462d53=_0x27f245;_0x24c550=0xc8;}else{_0x24c550=0xce;}_0x311931[_0xf606('0x15')](_0x24c550);return _0x311931[_0xf606('0x1a')](_0xf606('0x1b'),_0x4d3d79+'-'+_0x462d53+'/'+_0x27f245)['json'](_0x4879ec);}return null;};}function patchUpdates(_0x1380f5){return function(_0x3aa7cb){try{jsonpatch[_0xf606('0x1c')](_0x3aa7cb,_0x1380f5,!![]);}catch(_0x285f73){return BPromise[_0xf606('0x1d')](_0x285f73);}return _0x3aa7cb[_0xf606('0x1e')]();};}function saveUpdates(_0x1582ee,_0x5b1a53){return function(_0x53e24c){if(_0x53e24c){return _0x53e24c[_0xf606('0x1f')](_0x1582ee)[_0xf606('0x20')](function(_0x9bd67f){return _0x9bd67f;});}return null;};}function removeEntity(_0x348c88,_0x51c26b){return function(_0x38c467){if(_0x38c467){return _0x38c467[_0xf606('0x21')]()[_0xf606('0x20')](function(){_0x348c88['status'](0xcc)[_0xf606('0x22')]();});}};}function handleEntityNotFound(_0x348497,_0x235ea5){return function(_0x307f77){if(!_0x307f77){_0x348497[_0xf606('0x14')](0x194);}return _0x307f77;};}function handleError(_0x20fdeb,_0x51a906){_0x51a906=_0x51a906||0x1f4;return function(_0x5e4496){logger['error'](_0x5e4496[_0xf606('0x23')]);if(_0x5e4496[_0xf606('0x24')]){delete _0x5e4496[_0xf606('0x24')];}_0x20fdeb['status'](_0x51a906)[_0xf606('0x25')](_0x5e4496);};}exports[_0xf606('0x26')]=function(_0x327f50,_0xeed070){var _0x7470ac={},_0x7b6e74={},_0x2eef21={'count':0x0,'rows':[]};var _0x228744=_[_0xf606('0x27')](db['VoiceTransferReport'][_0xf606('0x28')],function(_0x23478f){return{'name':_0x23478f[_0xf606('0x29')],'type':_0x23478f[_0xf606('0x2a')][_0xf606('0x2b')]};});_0x7b6e74[_0xf606('0x2c')]=_[_0xf606('0x27')](_0x228744,'name');_0x7b6e74[_0xf606('0x2d')]=_[_0xf606('0x2e')](_0x327f50[_0xf606('0x2d')]);_0x7b6e74[_0xf606('0x2f')]=_[_0xf606('0x30')](_0x7b6e74[_0xf606('0x2c')],_0x7b6e74[_0xf606('0x2d')]);_0x7470ac[_0xf606('0x31')]=_['intersection'](_0x7b6e74[_0xf606('0x2c')],qs[_0xf606('0x32')](_0x327f50['query'][_0xf606('0x32')]));_0x7470ac[_0xf606('0x31')]=_0x7470ac[_0xf606('0x31')][_0xf606('0x33')]?_0x7470ac[_0xf606('0x31')]:_0x7b6e74['model'];if(!_0x327f50['query'][_0xf606('0x34')]('nolimit')){_0x7470ac[_0xf606('0x19')]=qs[_0xf606('0x19')](_0x327f50['query']['limit']);_0x7470ac[_0xf606('0x18')]=qs[_0xf606('0x18')](_0x327f50[_0xf606('0x2d')][_0xf606('0x18')]);}_0x7470ac[_0xf606('0x35')]=qs[_0xf606('0x36')](_0x327f50[_0xf606('0x2d')]['sort']);_0x7470ac[_0xf606('0x37')]=qs[_0xf606('0x2f')](_['pick'](_0x327f50[_0xf606('0x2d')],_0x7b6e74[_0xf606('0x2f')]),_0x228744);if(_0x327f50[_0xf606('0x2d')][_0xf606('0x38')]){_0x7470ac[_0xf606('0x37')]=_[_0xf606('0x39')](_0x7470ac['where'],{'$or':_['map'](_0x228744,function(_0x14a7a3){if(_0x14a7a3['type']!==_0xf606('0x3a')){var _0x2aae2b={};_0x2aae2b[_0x14a7a3[_0xf606('0x24')]]={'$like':'%'+_0x327f50[_0xf606('0x2d')][_0xf606('0x38')]+'%'};return _0x2aae2b;}})});}_0x7470ac=_[_0xf606('0x39')]({},_0x7470ac,_0x327f50[_0xf606('0x3b')]);var _0x9a3a77={'where':_0x7470ac[_0xf606('0x37')]};return db[_0xf606('0x3c')][_0xf606('0x17')](_0x9a3a77)[_0xf606('0x20')](function(_0x5eed9b){_0x2eef21[_0xf606('0x17')]=_0x5eed9b;if(_0x327f50[_0xf606('0x2d')][_0xf606('0x3d')]){_0x7470ac[_0xf606('0x3e')]=[{'all':!![]}];}return db[_0xf606('0x3c')][_0xf606('0x3f')](_0x7470ac);})['then'](function(_0x481cff){_0x2eef21[_0xf606('0x40')]=_0x481cff;return _0x2eef21;})['then'](respondWithFilteredResult(_0xeed070,_0x7470ac))[_0xf606('0x41')](handleError(_0xeed070,null));};exports[_0xf606('0x42')]=function(_0x20c5ec,_0x54539e){var _0x433b76={'raw':!![],'where':{'id':_0x20c5ec[_0xf606('0x43')]['id']}},_0x5b0676={};_0x5b0676[_0xf606('0x2c')]=_['keys'](db['VoiceTransferReport'][_0xf606('0x28')]);_0x5b0676[_0xf606('0x2d')]=_['keys'](_0x20c5ec[_0xf606('0x2d')]);_0x5b0676[_0xf606('0x2f')]=_[_0xf606('0x30')](_0x5b0676[_0xf606('0x2c')],_0x5b0676[_0xf606('0x2d')]);_0x433b76[_0xf606('0x31')]=_[_0xf606('0x30')](_0x5b0676[_0xf606('0x2c')],qs[_0xf606('0x32')](_0x20c5ec[_0xf606('0x2d')][_0xf606('0x32')]));_0x433b76[_0xf606('0x31')]=_0x433b76[_0xf606('0x31')][_0xf606('0x33')]?_0x433b76[_0xf606('0x31')]:_0x5b0676[_0xf606('0x2c')];if(_0x20c5ec[_0xf606('0x2d')][_0xf606('0x3d')]){_0x433b76['include']=[{'all':!![]}];}_0x433b76=_[_0xf606('0x39')]({},_0x433b76,_0x20c5ec[_0xf606('0x3b')]);return db[_0xf606('0x3c')]['find'](_0x433b76)[_0xf606('0x20')](handleEntityNotFound(_0x54539e,null))['then'](respondWithResult(_0x54539e,null))[_0xf606('0x41')](handleError(_0x54539e,null));};exports[_0xf606('0x44')]=function(_0x5797cc,_0x30a046){return db[_0xf606('0x3c')][_0xf606('0x44')](_0x5797cc['body'],{})[_0xf606('0x20')](respondWithResult(_0x30a046,0xc9))['catch'](handleError(_0x30a046,null));};exports['update']=function(_0x13832f,_0xbeafea){if(_0x13832f[_0xf606('0x45')]['id']){delete _0x13832f[_0xf606('0x45')]['id'];}return db[_0xf606('0x3c')]['find']({'where':{'id':_0x13832f[_0xf606('0x43')]['id']}})[_0xf606('0x20')](handleEntityNotFound(_0xbeafea,null))[_0xf606('0x20')](saveUpdates(_0x13832f[_0xf606('0x45')],null))[_0xf606('0x20')](respondWithResult(_0xbeafea,null))['catch'](handleError(_0xbeafea,null));};exports['destroy']=function(_0x441e4a,_0x5c3922){return db[_0xf606('0x3c')][_0xf606('0x46')]({'where':{'id':_0x441e4a['params']['id']}})['then'](handleEntityNotFound(_0x5c3922,null))[_0xf606('0x20')](removeEntity(_0x5c3922,null))[_0xf606('0x41')](handleError(_0x5c3922,null));}; \ No newline at end of file +var _0x42a3=['options','count','include','VoiceTransferReport','findAll','rows','catch','show','params','includeAll','find','create','body','update','html-pdf','eml-format','rimraf','zip-dir','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','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','offset','limit','set','Content-Range','reject','save','then','end','error','stack','name','index','rawAttributes','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','VIRTUAL','filter','merge'];(function(_0x3da5ea,_0x284691){var _0x22ad25=function(_0xc1b419){while(--_0xc1b419){_0x3da5ea['push'](_0x3da5ea['shift']());}};_0x22ad25(++_0x284691);}(_0x42a3,0x1d6));var _0x342a=function(_0x1e0f17,_0x332b6c){_0x1e0f17=_0x1e0f17-0x0;var _0x40eb93=_0x42a3[_0x1e0f17];return _0x40eb93;};'use strict';var pdf=require(_0x342a('0x0'));var emlformat=require(_0x342a('0x1'));var rimraf=require(_0x342a('0x2'));var zipdir=require(_0x342a('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x342a('0x4'));var moment=require(_0x342a('0x5'));var BPromise=require(_0x342a('0x6'));var Mustache=require(_0x342a('0x7'));var util=require('util');var path=require(_0x342a('0x8'));var sox=require(_0x342a('0x9'));var csv=require(_0x342a('0xa'));var ejs=require(_0x342a('0xb'));var fs=require('fs');var _=require(_0x342a('0xc'));var squel=require(_0x342a('0xd'));var crypto=require(_0x342a('0xe'));var jsforce=require(_0x342a('0xf'));var deskjs=require(_0x342a('0x10'));var toCsv=require(_0x342a('0xa'));var querystring=require(_0x342a('0x11'));var Papa=require(_0x342a('0x12'));var Redis=require(_0x342a('0x13'));var authService=require(_0x342a('0x14'));var qs=require(_0x342a('0x15'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x342a('0x16'));var logger=require(_0x342a('0x17'))(_0x342a('0x18'));var utils=require(_0x342a('0x19'));var config=require(_0x342a('0x1a'));var db=require(_0x342a('0x1b'))['db'];function respondWithStatusCode(_0x165acd,_0x2081ea){_0x2081ea=_0x2081ea||0xcc;return function(_0x2283ed){if(_0x2283ed){return _0x165acd[_0x342a('0x1c')](_0x2081ea);}return _0x165acd[_0x342a('0x1d')](_0x2081ea)['end']();};}function respondWithResult(_0x5e2e8a,_0x5da8a5){_0x5da8a5=_0x5da8a5||0xc8;return function(_0xe3159a){if(_0xe3159a){return _0x5e2e8a[_0x342a('0x1d')](_0x5da8a5)[_0x342a('0x1e')](_0xe3159a);}};}function respondWithFilteredResult(_0x31d1fd,_0x2532d3){return function(_0x2e0462){if(_0x2e0462){var _0x35b6d2=_0x2e0462['count'],_0xd31a6e=_0x2532d3['offset'],_0x2bcfeb=_0x2532d3[_0x342a('0x1f')]+_0x2532d3[_0x342a('0x20')],_0x1dd617;if(_0x2bcfeb>=_0x35b6d2){_0x2bcfeb=_0x35b6d2;_0x1dd617=0xc8;}else{_0x1dd617=0xce;}_0x31d1fd[_0x342a('0x1d')](_0x1dd617);return _0x31d1fd[_0x342a('0x21')](_0x342a('0x22'),_0xd31a6e+'-'+_0x2bcfeb+'/'+_0x35b6d2)[_0x342a('0x1e')](_0x2e0462);}return null;};}function patchUpdates(_0x360ecb){return function(_0x5c505e){try{jsonpatch['apply'](_0x5c505e,_0x360ecb,!![]);}catch(_0x55b3b9){return BPromise[_0x342a('0x23')](_0x55b3b9);}return _0x5c505e[_0x342a('0x24')]();};}function saveUpdates(_0x248dd0,_0x1938c3){return function(_0x3a0847){if(_0x3a0847){return _0x3a0847['update'](_0x248dd0)[_0x342a('0x25')](function(_0x3492a7){return _0x3492a7;});}return null;};}function removeEntity(_0x56e25c,_0x2c5dd3){return function(_0x6f2bf0){if(_0x6f2bf0){return _0x6f2bf0['destroy']()[_0x342a('0x25')](function(){_0x56e25c[_0x342a('0x1d')](0xcc)[_0x342a('0x26')]();});}};}function handleEntityNotFound(_0x53e36a,_0x167acf){return function(_0x791957){if(!_0x791957){_0x53e36a[_0x342a('0x1c')](0x194);}return _0x791957;};}function handleError(_0x5b8f18,_0x337a82){_0x337a82=_0x337a82||0x1f4;return function(_0x2cae49){logger[_0x342a('0x27')](_0x2cae49[_0x342a('0x28')]);if(_0x2cae49[_0x342a('0x29')]){delete _0x2cae49[_0x342a('0x29')];}_0x5b8f18[_0x342a('0x1d')](_0x337a82)['send'](_0x2cae49);};}exports[_0x342a('0x2a')]=function(_0x29712a,_0x477402){var _0x522284={},_0x3beeda={},_0x5cdca6={'count':0x0,'rows':[]};var _0x32c00a=_['map'](db['VoiceTransferReport'][_0x342a('0x2b')],function(_0x36bbf4){return{'name':_0x36bbf4['fieldName'],'type':_0x36bbf4['type'][_0x342a('0x2c')]};});_0x3beeda[_0x342a('0x2d')]=_[_0x342a('0x2e')](_0x32c00a,'name');_0x3beeda[_0x342a('0x2f')]=_[_0x342a('0x30')](_0x29712a[_0x342a('0x2f')]);_0x3beeda[_0x342a('0x31')]=_[_0x342a('0x32')](_0x3beeda[_0x342a('0x2d')],_0x3beeda[_0x342a('0x2f')]);_0x522284[_0x342a('0x33')]=_[_0x342a('0x32')](_0x3beeda[_0x342a('0x2d')],qs['fields'](_0x29712a['query'][_0x342a('0x34')]));_0x522284[_0x342a('0x33')]=_0x522284['attributes'][_0x342a('0x35')]?_0x522284[_0x342a('0x33')]:_0x3beeda['model'];if(!_0x29712a[_0x342a('0x2f')][_0x342a('0x36')](_0x342a('0x37'))){_0x522284[_0x342a('0x20')]=qs[_0x342a('0x20')](_0x29712a[_0x342a('0x2f')][_0x342a('0x20')]);_0x522284['offset']=qs[_0x342a('0x1f')](_0x29712a[_0x342a('0x2f')][_0x342a('0x1f')]);}_0x522284[_0x342a('0x38')]=qs['sort'](_0x29712a[_0x342a('0x2f')][_0x342a('0x39')]);_0x522284[_0x342a('0x3a')]=qs[_0x342a('0x31')](_['pick'](_0x29712a[_0x342a('0x2f')],_0x3beeda[_0x342a('0x31')]),_0x32c00a);if(_0x29712a[_0x342a('0x2f')]['filter']){_0x522284[_0x342a('0x3a')]=_['merge'](_0x522284[_0x342a('0x3a')],{'$or':_[_0x342a('0x2e')](_0x32c00a,function(_0x2a2342){if(_0x2a2342['type']!==_0x342a('0x3b')){var _0x2cc8a4={};_0x2cc8a4[_0x2a2342[_0x342a('0x29')]]={'$like':'%'+_0x29712a[_0x342a('0x2f')][_0x342a('0x3c')]+'%'};return _0x2cc8a4;}})});}_0x522284=_[_0x342a('0x3d')]({},_0x522284,_0x29712a[_0x342a('0x3e')]);var _0x2f0d0e={'where':_0x522284[_0x342a('0x3a')]};return db['VoiceTransferReport'][_0x342a('0x3f')](_0x2f0d0e)['then'](function(_0x18ce7b){_0x5cdca6[_0x342a('0x3f')]=_0x18ce7b;if(_0x29712a[_0x342a('0x2f')]['includeAll']){_0x522284[_0x342a('0x40')]=[{'all':!![]}];}return db[_0x342a('0x41')][_0x342a('0x42')](_0x522284);})['then'](function(_0x43eab8){_0x5cdca6[_0x342a('0x43')]=_0x43eab8;return _0x5cdca6;})[_0x342a('0x25')](respondWithFilteredResult(_0x477402,_0x522284))[_0x342a('0x44')](handleError(_0x477402,null));};exports[_0x342a('0x45')]=function(_0x4bffd6,_0x46322a){var _0x123c91={'raw':!![],'where':{'id':_0x4bffd6[_0x342a('0x46')]['id']}},_0xf78174={};_0xf78174[_0x342a('0x2d')]=_[_0x342a('0x30')](db['VoiceTransferReport'][_0x342a('0x2b')]);_0xf78174[_0x342a('0x2f')]=_[_0x342a('0x30')](_0x4bffd6['query']);_0xf78174[_0x342a('0x31')]=_[_0x342a('0x32')](_0xf78174[_0x342a('0x2d')],_0xf78174[_0x342a('0x2f')]);_0x123c91[_0x342a('0x33')]=_[_0x342a('0x32')](_0xf78174[_0x342a('0x2d')],qs['fields'](_0x4bffd6['query'][_0x342a('0x34')]));_0x123c91[_0x342a('0x33')]=_0x123c91['attributes'][_0x342a('0x35')]?_0x123c91['attributes']:_0xf78174[_0x342a('0x2d')];if(_0x4bffd6['query'][_0x342a('0x47')]){_0x123c91['include']=[{'all':!![]}];}_0x123c91=_[_0x342a('0x3d')]({},_0x123c91,_0x4bffd6[_0x342a('0x3e')]);return db[_0x342a('0x41')][_0x342a('0x48')](_0x123c91)['then'](handleEntityNotFound(_0x46322a,null))[_0x342a('0x25')](respondWithResult(_0x46322a,null))[_0x342a('0x44')](handleError(_0x46322a,null));};exports[_0x342a('0x49')]=function(_0x18f813,_0x20c237){return db[_0x342a('0x41')][_0x342a('0x49')](_0x18f813[_0x342a('0x4a')],{})[_0x342a('0x25')](respondWithResult(_0x20c237,0xc9))[_0x342a('0x44')](handleError(_0x20c237,null));};exports[_0x342a('0x4b')]=function(_0x240a6d,_0x54e3b0){if(_0x240a6d[_0x342a('0x4a')]['id']){delete _0x240a6d[_0x342a('0x4a')]['id'];}return db['VoiceTransferReport']['find']({'where':{'id':_0x240a6d['params']['id']}})[_0x342a('0x25')](handleEntityNotFound(_0x54e3b0,null))[_0x342a('0x25')](saveUpdates(_0x240a6d[_0x342a('0x4a')],null))[_0x342a('0x25')](respondWithResult(_0x54e3b0,null))[_0x342a('0x44')](handleError(_0x54e3b0,null));};exports['destroy']=function(_0x375965,_0x3839b2){return db[_0x342a('0x41')][_0x342a('0x48')]({'where':{'id':_0x375965[_0x342a('0x46')]['id']}})['then'](handleEntityNotFound(_0x3839b2,null))[_0x342a('0x25')](removeEntity(_0x3839b2,null))[_0x342a('0x44')](handleError(_0x3839b2,null));}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.model.js b/server/api/voiceTransferReport/voiceTransferReport.model.js index 0c5945d..d0b94ba 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 _0x3d18=['../../config/logger','moment','bluebird','request-promise','rimraf','./voiceTransferReport.attributes','exports','define','report_call_transfer','lodash','util'];(function(_0x408778,_0x157bd1){var _0x545940=function(_0x1a4dea){while(--_0x1a4dea){_0x408778['push'](_0x408778['shift']());}};_0x545940(++_0x157bd1);}(_0x3d18,0x169));var _0x83d1=function(_0x3766e0,_0x3203fa){_0x3766e0=_0x3766e0-0x0;var _0x28f495=_0x3d18[_0x3766e0];return _0x28f495;};'use strict';var _=require(_0x83d1('0x0'));var util=require(_0x83d1('0x1'));var logger=require(_0x83d1('0x2'))('api');var moment=require(_0x83d1('0x3'));var BPromise=require(_0x83d1('0x4'));var rp=require(_0x83d1('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x83d1('0x6'));var config=require('../../config/environment');var attributes=require(_0x83d1('0x7'));module[_0x83d1('0x8')]=function(_0x4b6b02,_0x49196d){return _0x4b6b02[_0x83d1('0x9')]('VoiceTransferReport',attributes,{'tableName':_0x83d1('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe439=['rimraf','./voiceTransferReport.attributes','exports','define','VoiceTransferReport','report_call_transfer','lodash','util','../../config/logger','bluebird','request-promise','path'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0xe439,0x1da));var _0x9e43=function(_0x5073c7,_0x49ed94){_0x5073c7=_0x5073c7-0x0;var _0x41093a=_0xe439[_0x5073c7];return _0x41093a;};'use strict';var _=require(_0x9e43('0x0'));var util=require(_0x9e43('0x1'));var logger=require(_0x9e43('0x2'))('api');var moment=require('moment');var BPromise=require(_0x9e43('0x3'));var rp=require(_0x9e43('0x4'));var fs=require('fs');var path=require(_0x9e43('0x5'));var rimraf=require(_0x9e43('0x6'));var config=require('../../config/environment');var attributes=require(_0x9e43('0x7'));module[_0x9e43('0x8')]=function(_0x2e940d,_0x13a2da){return _0x2e940d[_0x9e43('0x9')](_0x9e43('0xa'),attributes,{'tableName':_0x9e43('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 12dd474..bcbe0ea 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 _0xfa90=['VoiceTransferReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','info','CreateVoiceTransferReport','create','body','options','raw','catch','lodash','util','moment','randomstring','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','VoiceTransferReport,\x20%s,\x20%s','debug'];(function(_0x520e3b,_0x36ddc0){var _0xb07b0a=function(_0x260e9a){while(--_0x260e9a){_0x520e3b['push'](_0x520e3b['shift']());}};_0xb07b0a(++_0x36ddc0);}(_0xfa90,0xbb));var _0x0fa9=function(_0x28475a,_0x4ae9db){_0x28475a=_0x28475a-0x0;var _0x10ec1f=_0xfa90[_0x28475a];return _0x10ec1f;};'use strict';var _=require(_0x0fa9('0x0'));var util=require(_0x0fa9('0x1'));var moment=require(_0x0fa9('0x2'));var BPromise=require('bluebird');var rs=require(_0x0fa9('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x0fa9('0x4'))(_0x0fa9('0x5'));var config=require(_0x0fa9('0x6'));var jayson=require(_0x0fa9('0x7'));var client=jayson[_0x0fa9('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x554b84,_0x5906bd,_0x2cd606){return new BPromise(function(_0x463be3,_0x5e07f2){return client[_0x0fa9('0x9')](_0x554b84,_0x2cd606)[_0x0fa9('0xa')](function(_0x4d0ac0){logger['info'](_0x0fa9('0xb'),_0x5906bd,'request\x20sent');logger[_0x0fa9('0xc')](_0x0fa9('0xd'),_0x5906bd,_0x0fa9('0xe'),JSON[_0x0fa9('0xf')](_0x4d0ac0));if(_0x4d0ac0['error']){if(_0x4d0ac0[_0x0fa9('0x10')]['code']===0x1f4){logger['error'](_0x0fa9('0xb'),_0x5906bd,_0x4d0ac0[_0x0fa9('0x10')][_0x0fa9('0x11')]);return _0x5e07f2(_0x4d0ac0['error'][_0x0fa9('0x11')]);}logger[_0x0fa9('0x10')](_0x0fa9('0xb'),_0x5906bd,_0x4d0ac0['error']['message']);return _0x463be3(_0x4d0ac0[_0x0fa9('0x10')][_0x0fa9('0x11')]);}else{logger[_0x0fa9('0x12')]('VoiceTransferReport,\x20%s,\x20%s',_0x5906bd,_0x0fa9('0xe'));_0x463be3(_0x4d0ac0['result'][_0x0fa9('0x11')]);}})['catch'](function(_0x32e626){logger[_0x0fa9('0x10')](_0x0fa9('0xb'),_0x5906bd,_0x32e626);_0x5e07f2(_0x32e626);});});}exports[_0x0fa9('0x13')]=function(_0x14346f){var _0x15f550=this;return new Promise(function(_0x36aeb5,_0x11663f){return db['VoiceTransferReport'][_0x0fa9('0x14')](_0x14346f[_0x0fa9('0x15')],{'raw':_0x14346f[_0x0fa9('0x16')]?_0x14346f[_0x0fa9('0x16')][_0x0fa9('0x17')]===undefined?!![]:![]:!![]})[_0x0fa9('0xa')](function(_0x28113a){logger[_0x0fa9('0x12')]('CreateVoiceTransferReport',_0x14346f);logger['debug'](_0x0fa9('0x13'),_0x14346f,JSON[_0x0fa9('0xf')](_0x28113a));_0x36aeb5(_0x28113a);})[_0x0fa9('0x18')](function(_0x3a282b){logger[_0x0fa9('0x10')](_0x0fa9('0x13'),_0x3a282b[_0x0fa9('0x11')],_0x14346f);_0x11663f(_0x15f550[_0x0fa9('0x10')](0x1f4,_0x3a282b[_0x0fa9('0x11')]));});});}; \ No newline at end of file +var _0xd35f=['VoiceTransferReport','create','options','raw','catch','lodash','util','bluebird','randomstring','../../mysqldb','client','http','request','then','info','VoiceTransferReport,\x20%s,\x20%s','request\x20sent','debug','VoiceTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','CreateVoiceTransferReport'];(function(_0x2cd71d,_0xb13927){var _0x4c98b1=function(_0x3f01e9){while(--_0x3f01e9){_0x2cd71d['push'](_0x2cd71d['shift']());}};_0x4c98b1(++_0xb13927);}(_0xd35f,0x82));var _0xfd35=function(_0x1190c2,_0x2c078b){_0x1190c2=_0x1190c2-0x0;var _0x6ec988=_0xd35f[_0x1190c2];return _0x6ec988;};'use strict';var _=require(_0xfd35('0x0'));var util=require(_0xfd35('0x1'));var moment=require('moment');var BPromise=require(_0xfd35('0x2'));var rs=require(_0xfd35('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xfd35('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xfd35('0x5')][_0xfd35('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x402b8d,_0x4a80eb,_0x40e9f2){return new BPromise(function(_0x385c0f,_0x325797){return client[_0xfd35('0x7')](_0x402b8d,_0x40e9f2)[_0xfd35('0x8')](function(_0x365114){logger[_0xfd35('0x9')](_0xfd35('0xa'),_0x4a80eb,_0xfd35('0xb'));logger[_0xfd35('0xc')](_0xfd35('0xd'),_0x4a80eb,_0xfd35('0xb'),JSON[_0xfd35('0xe')](_0x365114));if(_0x365114[_0xfd35('0xf')]){if(_0x365114[_0xfd35('0xf')][_0xfd35('0x10')]===0x1f4){logger[_0xfd35('0xf')](_0xfd35('0xa'),_0x4a80eb,_0x365114[_0xfd35('0xf')][_0xfd35('0x11')]);return _0x325797(_0x365114['error'][_0xfd35('0x11')]);}logger[_0xfd35('0xf')]('VoiceTransferReport,\x20%s,\x20%s',_0x4a80eb,_0x365114[_0xfd35('0xf')]['message']);return _0x385c0f(_0x365114['error'][_0xfd35('0x11')]);}else{logger[_0xfd35('0x9')](_0xfd35('0xa'),_0x4a80eb,'request\x20sent');_0x385c0f(_0x365114[_0xfd35('0x12')][_0xfd35('0x11')]);}})['catch'](function(_0x4f5d60){logger[_0xfd35('0xf')](_0xfd35('0xa'),_0x4a80eb,_0x4f5d60);_0x325797(_0x4f5d60);});});}exports[_0xfd35('0x13')]=function(_0xdcd29c){var _0x18b2f0=this;return new Promise(function(_0x1b55f9,_0x487a15){return db[_0xfd35('0x14')][_0xfd35('0x15')](_0xdcd29c['body'],{'raw':_0xdcd29c[_0xfd35('0x16')]?_0xdcd29c[_0xfd35('0x16')][_0xfd35('0x17')]===undefined?!![]:![]:!![]})['then'](function(_0x29ad98){logger['info'](_0xfd35('0x13'),_0xdcd29c);logger[_0xfd35('0xc')]('CreateVoiceTransferReport',_0xdcd29c,JSON['stringify'](_0x29ad98));_0x1b55f9(_0x29ad98);})[_0xfd35('0x18')](function(_0x1123f7){logger[_0xfd35('0xf')](_0xfd35('0x13'),_0x1123f7[_0xfd35('0x11')],_0xdcd29c);_0x487a15(_0x18b2f0[_0xfd35('0xf')](0x1f4,_0x1123f7[_0xfd35('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/webbar/index.js b/server/api/webbar/index.js index 481bd97..2eda151 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 _0xc368=['calls','/transfer','transfer','exports','Router','./webbar.controller','post','/originate','isAuthenticated','canUpdate','/hangup','/answer','answer','/hold','/unhold','unhold','/calls'];(function(_0x28b83a,_0x401d6f){var _0x5985d9=function(_0x37d489){while(--_0x37d489){_0x28b83a['push'](_0x28b83a['shift']());}};_0x5985d9(++_0x401d6f);}(_0xc368,0x7b));var _0x8c36=function(_0x26541a,_0x53e583){_0x26541a=_0x26541a-0x0;var _0xaaff11=_0xc368[_0x26541a];return _0xaaff11;};'use strict';var express=require('express');var router=express[_0x8c36('0x0')]();var auth=require('../../components/auth/service');var controller=require(_0x8c36('0x1'));router[_0x8c36('0x2')](_0x8c36('0x3'),auth[_0x8c36('0x4')](),auth[_0x8c36('0x5')](),controller['originate']);router[_0x8c36('0x2')](_0x8c36('0x6'),auth[_0x8c36('0x4')](),auth[_0x8c36('0x5')](),controller['hangup']);router['post'](_0x8c36('0x7'),auth[_0x8c36('0x4')](),auth[_0x8c36('0x5')](),controller[_0x8c36('0x8')]);router[_0x8c36('0x2')](_0x8c36('0x9'),auth['isAuthenticated'](),auth['canUpdate'](),controller['hold']);router[_0x8c36('0x2')](_0x8c36('0xa'),auth['isAuthenticated'](),auth[_0x8c36('0x5')](),controller[_0x8c36('0xb')]);router[_0x8c36('0x2')](_0x8c36('0xc'),auth[_0x8c36('0x4')](),auth[_0x8c36('0x5')](),controller[_0x8c36('0xd')]);router[_0x8c36('0x2')](_0x8c36('0xe'),auth[_0x8c36('0x4')](),auth[_0x8c36('0x5')](),controller[_0x8c36('0xf')]);module[_0x8c36('0x10')]=router; \ No newline at end of file +var _0xac7f=['/hold','hold','unhold','/calls','calls','/transfer','express','../../components/auth/service','./webbar.controller','post','isAuthenticated','canUpdate','originate','/hangup','hangup','/answer','answer'];(function(_0x2c8fe3,_0x9f0818){var _0x2fc448=function(_0xadb375){while(--_0xadb375){_0x2c8fe3['push'](_0x2c8fe3['shift']());}};_0x2fc448(++_0x9f0818);}(_0xac7f,0x1e2));var _0xfac7=function(_0x36eaaa,_0x326732){_0x36eaaa=_0x36eaaa-0x0;var _0x461349=_0xac7f[_0x36eaaa];return _0x461349;};'use strict';var express=require(_0xfac7('0x0'));var router=express['Router']();var auth=require(_0xfac7('0x1'));var controller=require(_0xfac7('0x2'));router[_0xfac7('0x3')]('/originate',auth[_0xfac7('0x4')](),auth[_0xfac7('0x5')](),controller[_0xfac7('0x6')]);router[_0xfac7('0x3')](_0xfac7('0x7'),auth[_0xfac7('0x4')](),auth['canUpdate'](),controller[_0xfac7('0x8')]);router['post'](_0xfac7('0x9'),auth[_0xfac7('0x4')](),auth['canUpdate'](),controller[_0xfac7('0xa')]);router[_0xfac7('0x3')](_0xfac7('0xb'),auth['isAuthenticated'](),auth[_0xfac7('0x5')](),controller[_0xfac7('0xc')]);router['post']('/unhold',auth[_0xfac7('0x4')](),auth[_0xfac7('0x5')](),controller[_0xfac7('0xd')]);router[_0xfac7('0x3')](_0xfac7('0xe'),auth['isAuthenticated'](),auth[_0xfac7('0x5')](),controller[_0xfac7('0xf')]);router[_0xfac7('0x3')](_0xfac7('0x10'),auth[_0xfac7('0x4')](),auth[_0xfac7('0x5')](),controller['transfer']);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 f1ef0e9..4642935 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 _0x342b=['json','callNumber','callerId','callbackUrl','info','format','user:%s','webbar:originate','originate\x20executed!','hangup','userId','entityFound:','webbar:hangup','hangup\x20executed!','answer','answer\x20fired:','webbar:answer','answer\x20executed!','webbar:hold','hold\x20executed!','unhold','unhold\x20fired:','webbar:unhold','unhold\x20executed!','calls','calls\x20fired:','rows','conference','conference\x20fired:','webbar:conference','conference\x20executed!','transfer','transfer\x20fired:','webbar:transfer','path','../../mysqldb','../../config/environment','util','../../config/logger','webbarapi','ioredis','redis','defaults','localhost','socket.io-emitter','number','userId\x20is\x20required','callNumber\x20is\x20required','string','sessionId\x20is\x20required','emit','log','handleError:','error','stack','name','send','status','NotFound','request','then','code','result','catch','findOne','agent','VoiceChannels','all','filter','UserId','sessionId','length','sessionId\x20','originate','originate\x20fired:','validate','body'];(function(_0x3c85f3,_0x49dc88){var _0x3e0304=function(_0x419808){while(--_0x419808){_0x3c85f3['push'](_0x3c85f3['shift']());}};_0x3e0304(++_0x49dc88);}(_0x342b,0xbc));var _0xb342=function(_0x3c077c,_0x5e47b5){_0x3c077c=_0x3c077c-0x0;var _0x38e047=_0x342b[_0x3c077c];return _0x38e047;};'use strict';var path=require(_0xb342('0x0'));var fs=require('fs');var _=require('lodash');var db=require(_0xb342('0x1'))['db'];var config=require(_0xb342('0x2'));var util=require(_0xb342('0x3'));var BPromise=require('bluebird');var jayson=require('jayson/promise');var amiClient=jayson['client']['http']({'port':0x232a});var logger=require(_0xb342('0x4'))(_0xb342('0x5'));var Redis=require(_0xb342('0x6'));config[_0xb342('0x7')]=_[_0xb342('0x8')](config[_0xb342('0x7')],{'host':_0xb342('0x9'),'port':0x18eb});var io=require(_0xb342('0xa'))(new Redis(config['redis']));var Schema=require('validate');var originateValidation=new Schema({'userId':{'type':_0xb342('0xb'),'required':[!![],_0xb342('0xc')]},'callNumber':{'type':'string','required':[!![],_0xb342('0xd')]},'callerId':{'type':_0xb342('0xe')},'callbackUrl':{'type':_0xb342('0xe')}});var hangupValidation=new Schema({'userId':{'type':_0xb342('0xb'),'required':[!![],_0xb342('0xc')]},'sessionId':{'type':_0xb342('0xe'),'required':![]}});var answerValidation=new Schema({'userId':{'type':_0xb342('0xb'),'required':[!![],_0xb342('0xc')]},'sessionId':{'type':_0xb342('0xe'),'required':![]}});var transferValidation=new Schema({'userId':{'type':_0xb342('0xb'),'required':[!![],_0xb342('0xc')]},'sessionId':{'type':'string','required':[!![],_0xb342('0xf')]},'transferNumber':{'type':'string','required':[!![],'transferNumber\x20is\x20required']}});var holdValidation=new Schema({'userId':{'type':'number','required':[!![],_0xb342('0xc')]},'sessionId':{'type':_0xb342('0xe'),'required':![]}});var unholdValidation=new Schema({'userId':{'type':_0xb342('0xb'),'required':[!![],_0xb342('0xc')]},'sessionId':{'type':_0xb342('0xe'),'required':![]}});var callsValidation=new Schema({'userId':{'type':_0xb342('0xb'),'required':[!![],_0xb342('0xc')]}});var conferenceValidation=new Schema({'userId':{'type':_0xb342('0xb'),'required':[!![],'userId\x20is\x20required']}});function emit(_0x435b8c,_0x1057f9,_0x4ab953){logger['info'](_0x435b8c,_0x1057f9,JSON['stringify'](_0x4ab953));io['to'](_0x435b8c)[_0xb342('0x10')](_0x1057f9,_0x4ab953);}function handleError(_0x1fdb22){return function(_0x52b3b6){console[_0xb342('0x11')](_0xb342('0x12'),_0x52b3b6,_0x52b3b6 instanceof RangeError);logger[_0xb342('0x13')](_0x52b3b6[_0xb342('0x14')]);if(_0x52b3b6 instanceof RangeError){if(_0x52b3b6[_0xb342('0x15')]){delete _0x52b3b6['name'];}_0x1fdb22['status'](0x194)[_0xb342('0x16')](_0x52b3b6);}else{if(_0x52b3b6['name']){delete _0x52b3b6[_0xb342('0x15')];}_0x1fdb22[_0xb342('0x17')](0x1f4)[_0xb342('0x16')](_0x52b3b6);}};}function checkError(){return function(_0xca6906){if(!_0xca6906){throw new RangeError(_0xb342('0x18'));}return _0xca6906;};}function respondWithRpcPromise(_0x553fd3,_0xd3f9be){return new BPromise(function(_0x4dfca1,_0x99593d){var _0x59d63a=amiClient;return _0x59d63a[_0xb342('0x19')](_0x553fd3,_0xd3f9be)[_0xb342('0x1a')](function(_0x422bec){if(_0x422bec[_0xb342('0x13')]){if(_0x422bec['error'][_0xb342('0x1b')]===0x1f4){return _0x99593d(_0x422bec['error']['message']);}return _0x4dfca1(_0x422bec[_0xb342('0x13')]['message']);}else{_0x4dfca1(_0x422bec[_0xb342('0x1c')]);}})[_0xb342('0x1d')](function(_0x2cfb0d){_0x99593d(_0x2cfb0d);});});}function getAgent(_0x14e1e3){return db['User'][_0xb342('0x1e')]({'where':{'id':_0x14e1e3,'role':_0xb342('0x1f')}})[_0xb342('0x1a')](checkError());}function getAgentCheckSession(_0xe36c4b,_0x4696ac){return new BPromise(function(_0x27005b,_0x127dbc){var _0x59f5b4=respondWithRpcPromise(_0xb342('0x20'));var _0x168d1b=getAgent(_0xe36c4b);Promise[_0xb342('0x21')]([_0x59f5b4,_0x168d1b])['then'](function(_0x54cc70){var _0x5f320d=_0x54cc70[0x0];var _0x3abe87=_0x54cc70[0x1];var _0x56dd88=_[_0xb342('0x22')](_0x5f320d['rows'],function(_0x37d262){return _0x37d262[_0xb342('0x23')]==_0x3abe87['id']&&_0x37d262[_0xb342('0x24')]==_0x4696ac;});if(_0x56dd88[_0xb342('0x25')]==0x1){_0x27005b(_0x3abe87);}else{_0x127dbc(new RangeError(_0xb342('0x26')+_0x4696ac+'\x20not\x20found!'));}});});}exports[_0xb342('0x27')]=function(_0x3beb06,_0x18cf78){logger['info'](_0xb342('0x28'),_0x3beb06['body']);var _0x25e83e=originateValidation[_0xb342('0x29')](_0x3beb06[_0xb342('0x2a')]);if(_0x25e83e[_0xb342('0x25')]>0x0){return _0x18cf78[_0xb342('0x17')](0x190)[_0xb342('0x2b')](_0x25e83e);}var _0x46b0c0=_0x3beb06['body']['userId'];var _0x50c23a=_0x3beb06[_0xb342('0x2a')][_0xb342('0x2c')];var _0x4fbe59=_0x3beb06['body'][_0xb342('0x2d')];var _0x14131a=_0x3beb06[_0xb342('0x2a')][_0xb342('0x2e')];return getAgent(_0x46b0c0)[_0xb342('0x1a')](function(_0x1c6e5d){logger[_0xb342('0x2f')]('entityFound:',_0x1c6e5d[_0xb342('0x15')]);emit(util[_0xb342('0x30')](_0xb342('0x31'),_0x1c6e5d[_0xb342('0x15')]),_0xb342('0x32'),{'callNumber':_0x50c23a,'callerId':_0x4fbe59,'callbackUrl':_0x14131a});return _0x18cf78[_0xb342('0x17')](0xc8)['json']({'error':![],'message':_0xb342('0x33')});})[_0xb342('0x1d')](handleError(_0x18cf78));};exports[_0xb342('0x34')]=function(_0x3bd06c,_0x587c48){logger['info']('hangup\x20fired:',_0x3bd06c[_0xb342('0x2a')]);var _0xaa8ef8=hangupValidation[_0xb342('0x29')](_0x3bd06c['body']);if(_0xaa8ef8[_0xb342('0x25')]>0x0){return _0x587c48[_0xb342('0x17')](0x190)['json'](_0xaa8ef8);}var _0x449e6e=_0x3bd06c[_0xb342('0x2a')][_0xb342('0x35')];var _0x3f358a=_0x3bd06c[_0xb342('0x2a')][_0xb342('0x24')];return getAgent(_0x449e6e)[_0xb342('0x1a')](function(_0x58e57f){logger['info'](_0xb342('0x36'),_0x58e57f[_0xb342('0x15')]);emit(util[_0xb342('0x30')](_0xb342('0x31'),_0x58e57f[_0xb342('0x15')]),_0xb342('0x37'),{'sessionId':_0x3f358a});return _0x587c48[_0xb342('0x17')](0xc8)[_0xb342('0x2b')]({'error':![],'message':_0xb342('0x38')});})[_0xb342('0x1d')](handleError(_0x587c48));};exports[_0xb342('0x39')]=function(_0x316083,_0x292ad3){logger[_0xb342('0x2f')](_0xb342('0x3a'),_0x316083[_0xb342('0x2a')]);var _0x4ac3db=answerValidation['validate'](_0x316083['body']);if(_0x4ac3db[_0xb342('0x25')]>0x0){return _0x292ad3[_0xb342('0x17')](0x190)[_0xb342('0x2b')](_0x4ac3db);}var _0x34849c=_0x316083[_0xb342('0x2a')]['userId'];var _0x4cc0fb=_0x316083[_0xb342('0x2a')]['sessionId'];return getAgent(_0x34849c)[_0xb342('0x1a')](function(_0x321dc1){logger[_0xb342('0x2f')](_0xb342('0x36'),_0x321dc1[_0xb342('0x15')]);emit(util[_0xb342('0x30')]('user:%s',_0x321dc1[_0xb342('0x15')]),_0xb342('0x3b'),{'sessionId':_0x4cc0fb});return _0x292ad3[_0xb342('0x17')](0xc8)['json']({'error':![],'message':_0xb342('0x3c')});})[_0xb342('0x1d')](handleError(_0x292ad3));};exports['hold']=function(_0x2f1b9c,_0x58800d){logger[_0xb342('0x2f')]('hold\x20fired:',_0x2f1b9c[_0xb342('0x2a')]);var _0x5b638b=holdValidation['validate'](_0x2f1b9c[_0xb342('0x2a')]);if(_0x5b638b[_0xb342('0x25')]>0x0){return _0x58800d[_0xb342('0x17')](0x190)[_0xb342('0x2b')](_0x5b638b);}var _0x4dff08=_0x2f1b9c[_0xb342('0x2a')][_0xb342('0x35')];var _0x3cd72b=_0x2f1b9c[_0xb342('0x2a')][_0xb342('0x24')];return getAgent(_0x4dff08)[_0xb342('0x1a')](function(_0x4cc2d9){logger[_0xb342('0x2f')](_0xb342('0x36'),_0x4cc2d9['name']);emit(util[_0xb342('0x30')](_0xb342('0x31'),_0x4cc2d9['name']),_0xb342('0x3d'),{'sessionId':_0x3cd72b});return _0x58800d[_0xb342('0x17')](0xc8)[_0xb342('0x2b')]({'error':![],'message':_0xb342('0x3e')});})[_0xb342('0x1d')](handleError(_0x58800d));};exports[_0xb342('0x3f')]=function(_0x1ec165,_0x8736b5){logger[_0xb342('0x2f')](_0xb342('0x40'),_0x1ec165[_0xb342('0x2a')]);var _0xe7928=unholdValidation['validate'](_0x1ec165[_0xb342('0x2a')]);if(_0xe7928[_0xb342('0x25')]>0x0){return _0x8736b5[_0xb342('0x17')](0x190)[_0xb342('0x2b')](_0xe7928);}var _0x338de9=_0x1ec165['body'][_0xb342('0x35')];var _0x215007=_0x1ec165[_0xb342('0x2a')][_0xb342('0x24')];return getAgent(_0x338de9)['then'](function(_0x549076){logger[_0xb342('0x2f')]('entityFound:',_0x549076[_0xb342('0x15')]);emit(util[_0xb342('0x30')](_0xb342('0x31'),_0x549076[_0xb342('0x15')]),_0xb342('0x41'),{'sessionId':_0x215007});return _0x8736b5[_0xb342('0x17')](0xc8)[_0xb342('0x2b')]({'error':![],'message':_0xb342('0x42')});})[_0xb342('0x1d')](handleError(_0x8736b5));};exports[_0xb342('0x43')]=function(_0x34d0ab,_0x19532f){logger[_0xb342('0x2f')](_0xb342('0x44'),_0x19532f[_0xb342('0x2a')]);var _0x1caa1e=callsValidation[_0xb342('0x29')](_0x34d0ab[_0xb342('0x2a')]);if(_0x1caa1e[_0xb342('0x25')]>0x0){return _0x19532f['status'](0x190)['json'](_0x1caa1e);}var _0x2a0b0e=_0x34d0ab[_0xb342('0x2a')][_0xb342('0x35')];var _0x533e28=respondWithRpcPromise(_0xb342('0x20'));var _0x4ec083=getAgent(_0x2a0b0e);return Promise['all']([_0x533e28,_0x4ec083])[_0xb342('0x1a')](function(_0x282713){var _0x407532=_0x282713[0x0];var _0x27b0bf=_0x282713[0x1];var _0xf12e4d=_[_0xb342('0x22')](_0x407532[_0xb342('0x45')],function(_0x4029af){return _0x4029af[_0xb342('0x23')]==_0x27b0bf['id'];});return _0x19532f[_0xb342('0x17')](0xc8)['json']({'count':_0xf12e4d[_0xb342('0x25')],'rows':_0xf12e4d});})['catch'](handleError(_0x19532f));};exports[_0xb342('0x46')]=function(_0x1c03e5,_0x26b2c4){logger[_0xb342('0x2f')](_0xb342('0x47'),_0x1c03e5[_0xb342('0x2a')]);var _0x484a51=conferenceValidation[_0xb342('0x29')](_0x1c03e5['body']);if(_0x484a51['length']>0x0){return _0x26b2c4[_0xb342('0x17')](0x190)[_0xb342('0x2b')](_0x484a51);}var _0x35bcda=_0x1c03e5[_0xb342('0x2a')][_0xb342('0x35')];return getAgent(_0x35bcda)['then'](function(_0x46e6ba){logger[_0xb342('0x2f')](_0xb342('0x36'),_0x46e6ba[_0xb342('0x15')]);emit(util[_0xb342('0x30')](_0xb342('0x31'),_0x46e6ba[_0xb342('0x15')]),_0xb342('0x48'));return _0x26b2c4[_0xb342('0x17')](0xc8)[_0xb342('0x2b')]({'error':![],'message':_0xb342('0x49')});})[_0xb342('0x1d')](handleError(_0x26b2c4));};exports[_0xb342('0x4a')]=function(_0x2f8898,_0x8c1449){logger[_0xb342('0x2f')](_0xb342('0x4b'),_0x2f8898[_0xb342('0x2a')]);var _0x68a12d=transferValidation['validate'](_0x2f8898['body']);if(_0x68a12d[_0xb342('0x25')]>0x0){return _0x8c1449[_0xb342('0x17')](0x190)['json'](_0x68a12d);}var _0x19fc5b=_0x2f8898[_0xb342('0x2a')][_0xb342('0x35')];var _0x2dae90=_0x2f8898[_0xb342('0x2a')][_0xb342('0x24')];var _0x2f2453=_0x2f8898['body']['transferNumber'];return getAgent(_0x19fc5b)['then'](function(_0x25d860){logger[_0xb342('0x2f')]('entityFound:',_0x25d860['name']);emit(util[_0xb342('0x30')]('user:%s',_0x25d860['name']),_0xb342('0x4c'),{'sessionId':_0x2dae90,'transferNumber':_0x2f2453});return _0x8c1449[_0xb342('0x17')](0xc8)[_0xb342('0x2b')]({'error':![],'message':'transfer\x20executed!'});})[_0xb342('0x1d')](handleError(_0x8c1449));}; \ No newline at end of file +var _0x4536=['lodash','../../mysqldb','../../config/environment','bluebird','jayson/promise','http','../../config/logger','webbarapi','redis','defaults','localhost','socket.io-emitter','validate','number','userId\x20is\x20required','string','callNumber\x20is\x20required','transferNumber\x20is\x20required','info','stringify','log','handleError:','error','stack','name','status','send','request','then','code','message','result','catch','findOne','agent','VoiceChannels','all','filter','rows','UserId','sessionId','\x20not\x20found!','originate','originate\x20fired:','body','json','callNumber','callerId','callbackUrl','format','webbar:originate','originate\x20executed!','hangup','hangup\x20fired:','user:%s','answer','answer\x20fired:','length','userId','webbar:answer','answer\x20executed!','hold','hold\x20executed!','unhold','unhold\x20fired:','unhold\x20executed!','calls','calls\x20fired:','conference','conference\x20fired:','entityFound:','conference\x20executed!','transfer','transfer\x20fired:','transferNumber','webbar:transfer','transfer\x20executed!','path'];(function(_0x3cb615,_0x26d81a){var _0x365c24=function(_0x351434){while(--_0x351434){_0x3cb615['push'](_0x3cb615['shift']());}};_0x365c24(++_0x26d81a);}(_0x4536,0xe9));var _0x6453=function(_0x2fac1e,_0x5a3a9d){_0x2fac1e=_0x2fac1e-0x0;var _0x432c6b=_0x4536[_0x2fac1e];return _0x432c6b;};'use strict';var path=require(_0x6453('0x0'));var fs=require('fs');var _=require(_0x6453('0x1'));var db=require(_0x6453('0x2'))['db'];var config=require(_0x6453('0x3'));var util=require('util');var BPromise=require(_0x6453('0x4'));var jayson=require(_0x6453('0x5'));var amiClient=jayson['client'][_0x6453('0x6')]({'port':0x232a});var logger=require(_0x6453('0x7'))(_0x6453('0x8'));var Redis=require('ioredis');config[_0x6453('0x9')]=_[_0x6453('0xa')](config['redis'],{'host':_0x6453('0xb'),'port':0x18eb});var io=require(_0x6453('0xc'))(new Redis(config['redis']));var Schema=require(_0x6453('0xd'));var originateValidation=new Schema({'userId':{'type':_0x6453('0xe'),'required':[!![],_0x6453('0xf')]},'callNumber':{'type':_0x6453('0x10'),'required':[!![],_0x6453('0x11')]},'callerId':{'type':_0x6453('0x10')},'callbackUrl':{'type':'string'}});var hangupValidation=new Schema({'userId':{'type':_0x6453('0xe'),'required':[!![],_0x6453('0xf')]},'sessionId':{'type':'string','required':![]}});var answerValidation=new Schema({'userId':{'type':'number','required':[!![],_0x6453('0xf')]},'sessionId':{'type':_0x6453('0x10'),'required':![]}});var transferValidation=new Schema({'userId':{'type':_0x6453('0xe'),'required':[!![],_0x6453('0xf')]},'sessionId':{'type':_0x6453('0x10'),'required':[!![],'sessionId\x20is\x20required']},'transferNumber':{'type':_0x6453('0x10'),'required':[!![],_0x6453('0x12')]}});var holdValidation=new Schema({'userId':{'type':_0x6453('0xe'),'required':[!![],_0x6453('0xf')]},'sessionId':{'type':_0x6453('0x10'),'required':![]}});var unholdValidation=new Schema({'userId':{'type':_0x6453('0xe'),'required':[!![],'userId\x20is\x20required']},'sessionId':{'type':'string','required':![]}});var callsValidation=new Schema({'userId':{'type':_0x6453('0xe'),'required':[!![],_0x6453('0xf')]}});var conferenceValidation=new Schema({'userId':{'type':_0x6453('0xe'),'required':[!![],_0x6453('0xf')]}});function emit(_0x3e7c5e,_0x405a42,_0x2c4383){logger[_0x6453('0x13')](_0x3e7c5e,_0x405a42,JSON[_0x6453('0x14')](_0x2c4383));io['to'](_0x3e7c5e)['emit'](_0x405a42,_0x2c4383);}function handleError(_0x334128){return function(_0x446707){console[_0x6453('0x15')](_0x6453('0x16'),_0x446707,_0x446707 instanceof RangeError);logger[_0x6453('0x17')](_0x446707[_0x6453('0x18')]);if(_0x446707 instanceof RangeError){if(_0x446707[_0x6453('0x19')]){delete _0x446707['name'];}_0x334128[_0x6453('0x1a')](0x194)[_0x6453('0x1b')](_0x446707);}else{if(_0x446707[_0x6453('0x19')]){delete _0x446707[_0x6453('0x19')];}_0x334128[_0x6453('0x1a')](0x1f4)['send'](_0x446707);}};}function checkError(){return function(_0x30f201){if(!_0x30f201){throw new RangeError('NotFound');}return _0x30f201;};}function respondWithRpcPromise(_0x1f9ae4,_0x411240){return new BPromise(function(_0x3c80f4,_0x2a82d9){var _0x28d953=amiClient;return _0x28d953[_0x6453('0x1c')](_0x1f9ae4,_0x411240)[_0x6453('0x1d')](function(_0x3fa66d){if(_0x3fa66d[_0x6453('0x17')]){if(_0x3fa66d[_0x6453('0x17')][_0x6453('0x1e')]===0x1f4){return _0x2a82d9(_0x3fa66d[_0x6453('0x17')][_0x6453('0x1f')]);}return _0x3c80f4(_0x3fa66d[_0x6453('0x17')]['message']);}else{_0x3c80f4(_0x3fa66d[_0x6453('0x20')]);}})[_0x6453('0x21')](function(_0x408783){_0x2a82d9(_0x408783);});});}function getAgent(_0x3a2a31){return db['User'][_0x6453('0x22')]({'where':{'id':_0x3a2a31,'role':_0x6453('0x23')}})[_0x6453('0x1d')](checkError());}function getAgentCheckSession(_0x557e90,_0x1fde34){return new BPromise(function(_0x380d8e,_0x8e5c88){var _0x390ecc=respondWithRpcPromise(_0x6453('0x24'));var _0x4ae0da=getAgent(_0x557e90);Promise[_0x6453('0x25')]([_0x390ecc,_0x4ae0da])[_0x6453('0x1d')](function(_0x1b5750){var _0xa39cd5=_0x1b5750[0x0];var _0x5f2140=_0x1b5750[0x1];var _0x2f0c09=_[_0x6453('0x26')](_0xa39cd5[_0x6453('0x27')],function(_0x21726d){return _0x21726d[_0x6453('0x28')]==_0x5f2140['id']&&_0x21726d[_0x6453('0x29')]==_0x1fde34;});if(_0x2f0c09['length']==0x1){_0x380d8e(_0x5f2140);}else{_0x8e5c88(new RangeError('sessionId\x20'+_0x1fde34+_0x6453('0x2a')));}});});}exports[_0x6453('0x2b')]=function(_0x32dd73,_0x9a1363){logger[_0x6453('0x13')](_0x6453('0x2c'),_0x32dd73[_0x6453('0x2d')]);var _0x143cf3=originateValidation[_0x6453('0xd')](_0x32dd73['body']);if(_0x143cf3['length']>0x0){return _0x9a1363[_0x6453('0x1a')](0x190)[_0x6453('0x2e')](_0x143cf3);}var _0x2a6dd2=_0x32dd73[_0x6453('0x2d')]['userId'];var _0x270f48=_0x32dd73['body'][_0x6453('0x2f')];var _0x47e6b4=_0x32dd73['body'][_0x6453('0x30')];var _0x39695b=_0x32dd73[_0x6453('0x2d')][_0x6453('0x31')];return getAgent(_0x2a6dd2)[_0x6453('0x1d')](function(_0x3a0369){logger['info']('entityFound:',_0x3a0369[_0x6453('0x19')]);emit(util[_0x6453('0x32')]('user:%s',_0x3a0369[_0x6453('0x19')]),_0x6453('0x33'),{'callNumber':_0x270f48,'callerId':_0x47e6b4,'callbackUrl':_0x39695b});return _0x9a1363['status'](0xc8)['json']({'error':![],'message':_0x6453('0x34')});})[_0x6453('0x21')](handleError(_0x9a1363));};exports[_0x6453('0x35')]=function(_0x7f0f4b,_0x2081b3){logger[_0x6453('0x13')](_0x6453('0x36'),_0x7f0f4b[_0x6453('0x2d')]);var _0x43bb89=hangupValidation[_0x6453('0xd')](_0x7f0f4b['body']);if(_0x43bb89['length']>0x0){return _0x2081b3[_0x6453('0x1a')](0x190)[_0x6453('0x2e')](_0x43bb89);}var _0x85af05=_0x7f0f4b[_0x6453('0x2d')]['userId'];var _0x16aa58=_0x7f0f4b[_0x6453('0x2d')][_0x6453('0x29')];return getAgent(_0x85af05)['then'](function(_0x311bf0){logger[_0x6453('0x13')]('entityFound:',_0x311bf0[_0x6453('0x19')]);emit(util[_0x6453('0x32')](_0x6453('0x37'),_0x311bf0[_0x6453('0x19')]),'webbar:hangup',{'sessionId':_0x16aa58});return _0x2081b3[_0x6453('0x1a')](0xc8)[_0x6453('0x2e')]({'error':![],'message':'hangup\x20executed!'});})[_0x6453('0x21')](handleError(_0x2081b3));};exports[_0x6453('0x38')]=function(_0x4027f0,_0x48e4ac){logger[_0x6453('0x13')](_0x6453('0x39'),_0x4027f0['body']);var _0x31e5e3=answerValidation[_0x6453('0xd')](_0x4027f0[_0x6453('0x2d')]);if(_0x31e5e3[_0x6453('0x3a')]>0x0){return _0x48e4ac[_0x6453('0x1a')](0x190)[_0x6453('0x2e')](_0x31e5e3);}var _0x38d563=_0x4027f0['body'][_0x6453('0x3b')];var _0x10d66e=_0x4027f0[_0x6453('0x2d')][_0x6453('0x29')];return getAgent(_0x38d563)['then'](function(_0x475723){logger['info']('entityFound:',_0x475723[_0x6453('0x19')]);emit(util[_0x6453('0x32')]('user:%s',_0x475723[_0x6453('0x19')]),_0x6453('0x3c'),{'sessionId':_0x10d66e});return _0x48e4ac[_0x6453('0x1a')](0xc8)[_0x6453('0x2e')]({'error':![],'message':_0x6453('0x3d')});})[_0x6453('0x21')](handleError(_0x48e4ac));};exports[_0x6453('0x3e')]=function(_0x571a11,_0x374d4e){logger[_0x6453('0x13')]('hold\x20fired:',_0x571a11['body']);var _0x5cb8b2=holdValidation['validate'](_0x571a11['body']);if(_0x5cb8b2[_0x6453('0x3a')]>0x0){return _0x374d4e[_0x6453('0x1a')](0x190)[_0x6453('0x2e')](_0x5cb8b2);}var _0x51f1e5=_0x571a11[_0x6453('0x2d')]['userId'];var _0x165928=_0x571a11[_0x6453('0x2d')][_0x6453('0x29')];return getAgent(_0x51f1e5)[_0x6453('0x1d')](function(_0x3a3254){logger['info']('entityFound:',_0x3a3254[_0x6453('0x19')]);emit(util['format']('user:%s',_0x3a3254[_0x6453('0x19')]),'webbar:hold',{'sessionId':_0x165928});return _0x374d4e[_0x6453('0x1a')](0xc8)[_0x6453('0x2e')]({'error':![],'message':_0x6453('0x3f')});})[_0x6453('0x21')](handleError(_0x374d4e));};exports[_0x6453('0x40')]=function(_0x5979b4,_0x59aec9){logger[_0x6453('0x13')](_0x6453('0x41'),_0x5979b4[_0x6453('0x2d')]);var _0x13766e=unholdValidation[_0x6453('0xd')](_0x5979b4['body']);if(_0x13766e[_0x6453('0x3a')]>0x0){return _0x59aec9[_0x6453('0x1a')](0x190)[_0x6453('0x2e')](_0x13766e);}var _0x56f6ed=_0x5979b4[_0x6453('0x2d')]['userId'];var _0x4ca691=_0x5979b4[_0x6453('0x2d')]['sessionId'];return getAgent(_0x56f6ed)[_0x6453('0x1d')](function(_0x27c07c){logger[_0x6453('0x13')]('entityFound:',_0x27c07c[_0x6453('0x19')]);emit(util[_0x6453('0x32')]('user:%s',_0x27c07c[_0x6453('0x19')]),'webbar:unhold',{'sessionId':_0x4ca691});return _0x59aec9[_0x6453('0x1a')](0xc8)[_0x6453('0x2e')]({'error':![],'message':_0x6453('0x42')});})[_0x6453('0x21')](handleError(_0x59aec9));};exports[_0x6453('0x43')]=function(_0x55d1c0,_0x36e6ec){logger[_0x6453('0x13')](_0x6453('0x44'),_0x36e6ec[_0x6453('0x2d')]);var _0x3cc446=callsValidation['validate'](_0x55d1c0['body']);if(_0x3cc446[_0x6453('0x3a')]>0x0){return _0x36e6ec[_0x6453('0x1a')](0x190)['json'](_0x3cc446);}var _0x3a5061=_0x55d1c0[_0x6453('0x2d')][_0x6453('0x3b')];var _0xb9ba1a=respondWithRpcPromise(_0x6453('0x24'));var _0x3c394c=getAgent(_0x3a5061);return Promise['all']([_0xb9ba1a,_0x3c394c])[_0x6453('0x1d')](function(_0x3f3f74){var _0x24ffe8=_0x3f3f74[0x0];var _0x288989=_0x3f3f74[0x1];var _0x44ac7b=_[_0x6453('0x26')](_0x24ffe8[_0x6453('0x27')],function(_0x5bb47d){return _0x5bb47d[_0x6453('0x28')]==_0x288989['id'];});return _0x36e6ec[_0x6453('0x1a')](0xc8)[_0x6453('0x2e')]({'count':_0x44ac7b[_0x6453('0x3a')],'rows':_0x44ac7b});})['catch'](handleError(_0x36e6ec));};exports[_0x6453('0x45')]=function(_0x28849b,_0x574a92){logger[_0x6453('0x13')](_0x6453('0x46'),_0x28849b[_0x6453('0x2d')]);var _0x377641=conferenceValidation[_0x6453('0xd')](_0x28849b[_0x6453('0x2d')]);if(_0x377641[_0x6453('0x3a')]>0x0){return _0x574a92[_0x6453('0x1a')](0x190)['json'](_0x377641);}var _0x3246e6=_0x28849b['body']['userId'];return getAgent(_0x3246e6)[_0x6453('0x1d')](function(_0x2dc963){logger[_0x6453('0x13')](_0x6453('0x47'),_0x2dc963[_0x6453('0x19')]);emit(util[_0x6453('0x32')]('user:%s',_0x2dc963[_0x6453('0x19')]),'webbar:conference');return _0x574a92['status'](0xc8)['json']({'error':![],'message':_0x6453('0x48')});})['catch'](handleError(_0x574a92));};exports[_0x6453('0x49')]=function(_0x296c87,_0x542d81){logger[_0x6453('0x13')](_0x6453('0x4a'),_0x296c87[_0x6453('0x2d')]);var _0xa60c0f=transferValidation[_0x6453('0xd')](_0x296c87['body']);if(_0xa60c0f[_0x6453('0x3a')]>0x0){return _0x542d81[_0x6453('0x1a')](0x190)['json'](_0xa60c0f);}var _0x47108a=_0x296c87[_0x6453('0x2d')][_0x6453('0x3b')];var _0x4e143a=_0x296c87['body']['sessionId'];var _0xf87fb2=_0x296c87[_0x6453('0x2d')][_0x6453('0x4b')];return getAgent(_0x47108a)[_0x6453('0x1d')](function(_0x4ba440){logger[_0x6453('0x13')](_0x6453('0x47'),_0x4ba440[_0x6453('0x19')]);emit(util[_0x6453('0x32')](_0x6453('0x37'),_0x4ba440[_0x6453('0x19')]),_0x6453('0x4c'),{'sessionId':_0x4e143a,'transferNumber':_0xf87fb2});return _0x542d81['status'](0xc8)[_0x6453('0x2e')]({'error':![],'message':_0x6453('0x4d')});})[_0x6453('0x21')](handleError(_0x542d81));}; \ No newline at end of file diff --git a/server/api/whatsappAccount/index.js b/server/api/whatsappAccount/index.js index 05d23e6..3fa4fdb 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 _0x1193=['/describe','isAuthenticated','describe','show','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/users','getAgents','/:id/applications','post','addAnswer','addAgents','addApplications','notify','send','put','/:id','update','delete','removeDispositions','removeAnswers','removeAgents','exports','multer','path','connect-timeout','../../components/auth/service','../../components/interaction/service','./whatsappAccount.controller','index','get'];(function(_0x2e7e9f,_0x3229ad){var _0x1c5662=function(_0x448110){while(--_0x448110){_0x2e7e9f['push'](_0x2e7e9f['shift']());}};_0x1c5662(++_0x3229ad);}(_0x1193,0x9d));var _0x3119=function(_0x51127a,_0x210758){_0x51127a=_0x51127a-0x0;var _0x423571=_0x1193[_0x51127a];return _0x423571;};'use strict';var multer=require(_0x3119('0x0'));var util=require('util');var path=require(_0x3119('0x1'));var timeout=require(_0x3119('0x2'));var express=require('express');var router=express['Router']();var auth=require(_0x3119('0x3'));var interaction=require(_0x3119('0x4'));var config=require('../../config/environment');var controller=require(_0x3119('0x5'));router['get']('/',auth['isAuthenticated'](),controller[_0x3119('0x6')]);router[_0x3119('0x7')](_0x3119('0x8'),auth[_0x3119('0x9')](),controller[_0x3119('0xa')]);router['get']('/:id',auth[_0x3119('0x9')](),controller[_0x3119('0xb')]);router[_0x3119('0x7')](_0x3119('0xc'),auth[_0x3119('0x9')](),controller[_0x3119('0xd')]);router['get'](_0x3119('0xe'),auth[_0x3119('0x9')](),controller[_0x3119('0xf')]);router[_0x3119('0x7')](_0x3119('0x10'),auth[_0x3119('0x9')](),controller[_0x3119('0x11')]);router[_0x3119('0x7')](_0x3119('0x12'),auth[_0x3119('0x9')](),controller['getApplications']);router[_0x3119('0x13')]('/',auth[_0x3119('0x9')](),controller['create']);router[_0x3119('0x13')]('/:id/dispositions',auth[_0x3119('0x9')](),controller['addDisposition']);router[_0x3119('0x13')](_0x3119('0xe'),auth[_0x3119('0x9')](),controller[_0x3119('0x14')]);router['post']('/:id/users',auth[_0x3119('0x9')](),controller[_0x3119('0x15')]);router['post'](_0x3119('0x12'),auth['isAuthenticated'](),controller[_0x3119('0x16')]);router[_0x3119('0x13')]('/:id/notify',controller[_0x3119('0x17')]);router[_0x3119('0x13')]('/:id/send',auth[_0x3119('0x9')](),controller[_0x3119('0x18')]);router[_0x3119('0x19')](_0x3119('0x1a'),auth[_0x3119('0x9')](),controller[_0x3119('0x1b')]);router['delete'](_0x3119('0x1a'),auth[_0x3119('0x9')](),controller['destroy']);router[_0x3119('0x1c')]('/:id/dispositions',auth[_0x3119('0x9')](),controller[_0x3119('0x1d')]);router[_0x3119('0x1c')]('/:id/canned_answers',auth['isAuthenticated'](),controller[_0x3119('0x1e')]);router['delete'](_0x3119('0x10'),auth[_0x3119('0x9')](),controller[_0x3119('0x1f')]);module[_0x3119('0x20')]=router; \ No newline at end of file +var _0xb94a=['getAgents','post','create','addDisposition','addAnswer','addAgents','/:id/applications','/:id/notify','notify','put','update','delete','removeDispositions','removeAnswers','removeAgents','exports','util','express','Router','get','isAuthenticated','index','/describe','describe','/:id','/:id/dispositions','/:id/canned_answers','/:id/users'];(function(_0x51020b,_0x38c2c7){var _0x371e47=function(_0x2a538f){while(--_0x2a538f){_0x51020b['push'](_0x51020b['shift']());}};_0x371e47(++_0x38c2c7);}(_0xb94a,0x1ec));var _0xab94=function(_0x46f261,_0x2f1b1d){_0x46f261=_0x46f261-0x0;var _0x1cc482=_0xb94a[_0x46f261];return _0x1cc482;};'use strict';var multer=require('multer');var util=require(_0xab94('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xab94('0x1'));var router=express[_0xab94('0x2')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./whatsappAccount.controller');router[_0xab94('0x3')]('/',auth[_0xab94('0x4')](),controller[_0xab94('0x5')]);router[_0xab94('0x3')](_0xab94('0x6'),auth[_0xab94('0x4')](),controller[_0xab94('0x7')]);router[_0xab94('0x3')](_0xab94('0x8'),auth['isAuthenticated'](),controller['show']);router[_0xab94('0x3')](_0xab94('0x9'),auth['isAuthenticated'](),controller['getDispositions']);router[_0xab94('0x3')](_0xab94('0xa'),auth[_0xab94('0x4')](),controller['getAnswers']);router[_0xab94('0x3')](_0xab94('0xb'),auth[_0xab94('0x4')](),controller[_0xab94('0xc')]);router[_0xab94('0x3')]('/:id/applications',auth[_0xab94('0x4')](),controller['getApplications']);router[_0xab94('0xd')]('/',auth['isAuthenticated'](),controller[_0xab94('0xe')]);router[_0xab94('0xd')](_0xab94('0x9'),auth[_0xab94('0x4')](),controller[_0xab94('0xf')]);router[_0xab94('0xd')](_0xab94('0xa'),auth[_0xab94('0x4')](),controller[_0xab94('0x10')]);router['post']('/:id/users',auth[_0xab94('0x4')](),controller[_0xab94('0x11')]);router[_0xab94('0xd')](_0xab94('0x12'),auth[_0xab94('0x4')](),controller['addApplications']);router[_0xab94('0xd')](_0xab94('0x13'),controller[_0xab94('0x14')]);router['post']('/:id/send',auth['isAuthenticated'](),controller['send']);router[_0xab94('0x15')]('/:id',auth[_0xab94('0x4')](),controller[_0xab94('0x16')]);router[_0xab94('0x17')](_0xab94('0x8'),auth[_0xab94('0x4')](),controller['destroy']);router[_0xab94('0x17')](_0xab94('0x9'),auth[_0xab94('0x4')](),controller[_0xab94('0x18')]);router['delete'](_0xab94('0xa'),auth[_0xab94('0x4')](),controller[_0xab94('0x19')]);router[_0xab94('0x17')]('/:id/users',auth[_0xab94('0x4')](),controller[_0xab94('0x1a')]);module[_0xab94('0x1b')]=router; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.attributes.js b/server/api/whatsappAccount/whatsappAccount.attributes.js index 438d64b..ea87bfd 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 _0xbb6f=['Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDisposition','randomstring','exports','name','STRING','generate','ENUM','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'];(function(_0x529be8,_0x5d98ba){var _0x38db2a=function(_0xc01ab){while(--_0xc01ab){_0x529be8['push'](_0x529be8['shift']());}};_0x38db2a(++_0x5d98ba);}(_0xbb6f,0x137));var _0xfbb6=function(_0x59f13d,_0x34e180){_0x59f13d=_0x59f13d-0x0;var _0x920e2f=_0xbb6f[_0x59f13d];return _0x920e2f;};'use strict';var Sequelize=require('sequelize');var rs=require(_0xfbb6('0x0'));module[_0xfbb6('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0xfbb6('0x2'),'allowNull':![]},'key':{'type':Sequelize[_0xfbb6('0x3')],'allowNull':![]},'remote':{'type':Sequelize[_0xfbb6('0x3')],'allowNull':![]},'token':{'type':Sequelize['STRING'],'defaultValue':function(){return rs[_0xfbb6('0x4')]();}},'phone':{'type':Sequelize[_0xfbb6('0x3')]},'type':{'type':Sequelize[_0xfbb6('0x5')]('twilio')},'accountSid':{'type':Sequelize['STRING']},'authToken':{'type':Sequelize[_0xfbb6('0x3')]},'notificationTemplate':{'type':Sequelize[_0xfbb6('0x6')],'defaultValue':function(){return _0xfbb6('0x7');}},'notificationSound':{'type':Sequelize[_0xfbb6('0x8')],'defaultValue':![]},'notificationShake':{'type':Sequelize[_0xfbb6('0x8')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xfbb6('0x9')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0xfbb6('0x8')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xfbb6('0x9')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xfbb6('0x8')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xfbb6('0x9')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'comment':_0xfbb6('0xa')},'mandatoryDisposition':{'type':Sequelize[_0xfbb6('0x8')],'defaultValue':![],'comment':_0xfbb6('0xb'),'set':function(_0x11c117){if(!_0x11c117){this[_0xfbb6('0xc')]('mandatoryDispositionPauseId',null);}this['setDataValue'](_0xfbb6('0xd'),_0x11c117);}},'description':{'type':Sequelize[_0xfbb6('0x3')]}}; \ No newline at end of file +var _0xc4ed=['STRING','name','generate','ENUM','twilio','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','INTEGER','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','sequelize','randomstring','exports'];(function(_0x1a0016,_0x3d80e1){var _0x2945df=function(_0x2e82b2){while(--_0x2e82b2){_0x1a0016['push'](_0x1a0016['shift']());}};_0x2945df(++_0x3d80e1);}(_0xc4ed,0x185));var _0xdc4e=function(_0x87d3ec,_0x387888){_0x87d3ec=_0x87d3ec-0x0;var _0x5f3f6f=_0xc4ed[_0x87d3ec];return _0x5f3f6f;};'use strict';var Sequelize=require(_0xdc4e('0x0'));var rs=require(_0xdc4e('0x1'));module[_0xdc4e('0x2')]={'name':{'type':Sequelize[_0xdc4e('0x3')],'unique':_0xdc4e('0x4'),'allowNull':![]},'key':{'type':Sequelize[_0xdc4e('0x3')],'allowNull':![]},'remote':{'type':Sequelize[_0xdc4e('0x3')],'allowNull':![]},'token':{'type':Sequelize[_0xdc4e('0x3')],'defaultValue':function(){return rs[_0xdc4e('0x5')]();}},'phone':{'type':Sequelize[_0xdc4e('0x3')]},'type':{'type':Sequelize[_0xdc4e('0x6')](_0xdc4e('0x7'))},'accountSid':{'type':Sequelize[_0xdc4e('0x3')]},'authToken':{'type':Sequelize['STRING']},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return _0xdc4e('0x8');}},'notificationSound':{'type':Sequelize[_0xdc4e('0x9')],'defaultValue':![]},'notificationShake':{'type':Sequelize[_0xdc4e('0x9')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xdc4e('0xa')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xdc4e('0xa')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xdc4e('0x9')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xdc4e('0xa')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0xdc4e('0xa')],'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize[_0xdc4e('0x9')],'defaultValue':![],'comment':_0xdc4e('0xb'),'set':function(_0x5ed1b8){if(!_0x5ed1b8){this[_0xdc4e('0xc')](_0xdc4e('0xd'),null);}this[_0xdc4e('0xc')]('mandatoryDisposition',_0x5ed1b8);}},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.controller.js b/server/api/whatsappAccount/whatsappAccount.controller.js index fb5bc0c..d1eaae9 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 _0x579c=['contact','WhatsappInteraction','interaction','created','applications','close','unmanaged','*,*,*,*','WhatsappMessage','ContactId','AttachmentId','UserId','unshift','waitForTheAssignedAgent','Start','startRouting','receiveMessage','entity\x20found','WhatsappAccount,\x20%s,\x20%s,\x20%s,\x20%s','twilio','Content-Type','text/xml','json','List','out','dataValues','Messages','push','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','util','path','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','register','client','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','info','request\x20sent','debug','WhatsappAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','WhatsappAccount,\x20%s,\x20%s','message','result','catch','sendStatus','status','end','count','offset','limit','set','apply','reject','save','then','get','WhatsappAccounts','UserProfileResource','stack','name','send','index','map','WhatsappAccount','rawAttributes','fieldName','type','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','include','findAll','rows','Pause','mandatoryDispositionPause','includeAll','find','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','params','destroy','describe','WhatsappAccountId','getDispositions','findOne','Disposition','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','removeAnswers','addAgents','omit','spread','emit','removeAgents','isArray','userWhatsappAccount:remove','getAgents','User','sequelize','transaction','WhatsappApplication','bulkCreate','findAndCountAll','priority','getApplications','notify','Applications','account','orderBy','asc','CmContact','Sequelize','no\x20available\x20attributes','createdAt','updatedAt','difference','CompanyId','mobile','from','From','replace','whatsapp:','Body','messageId','MessageSid','isNil','from\x20is\x20mandatory','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','ListId','Contacts','DESC','list'];(function(_0x3c1dd0,_0x490ac1){var _0x5f3c86=function(_0x389c40){while(--_0x389c40){_0x3c1dd0['push'](_0x3c1dd0['shift']());}};_0x5f3c86(++_0x490ac1);}(_0x579c,0xda));var _0xc579=function(_0x720b33,_0x325d6a){_0x720b33=_0x720b33-0x0;var _0x43032e=_0x579c[_0x720b33];return _0x43032e;};'use strict';var pdf=require(_0xc579('0x0'));var emlformat=require(_0xc579('0x1'));var rimraf=require(_0xc579('0x2'));var zipdir=require(_0xc579('0x3'));var jsonpatch=require(_0xc579('0x4'));var rp=require('request-promise');var moment=require(_0xc579('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xc579('0x6'));var util=require(_0xc579('0x7'));var path=require(_0xc579('0x8'));var sox=require(_0xc579('0x9'));var csv=require(_0xc579('0xa'));var ejs=require(_0xc579('0xb'));var fs=require('fs');var _=require(_0xc579('0xc'));var squel=require('squel');var crypto=require(_0xc579('0xd'));var jsforce=require(_0xc579('0xe'));var deskjs=require(_0xc579('0xf'));var toCsv=require(_0xc579('0xa'));var querystring=require(_0xc579('0x10'));var Papa=require(_0xc579('0x11'));var Redis=require(_0xc579('0x12'));var authService=require(_0xc579('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0xc579('0x14'));var hardwareService=require(_0xc579('0x15'));var logger=require(_0xc579('0x16'))(_0xc579('0x17'));var utils=require(_0xc579('0x18'));var config=require(_0xc579('0x19'));var db=require(_0xc579('0x1a'))['db'];config[_0xc579('0x1b')]=_[_0xc579('0x1c')](config[_0xc579('0x1b')],{'host':_0xc579('0x1d'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xc579('0x1b')]));require('./whatsappAccount.socket')[_0xc579('0x1e')](socket);var jayson=require('jayson/promise');var client=jayson[_0xc579('0x1f')]['http']({'port':0x232c});function checkPasswordPattern(_0x44cd32,_0x4b3635,_0x349e82){if(_0x349e82){var _0x115276=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x115276['test'](_0x4b3635)){return _0x44cd32;}else{throw new db['Sequelize'][(_0xc579('0x20'))](_0xc579('0x21'));}}else{return _0x44cd32;}}function respondWithRpcPromise(_0x1ddc13,_0x414ee7,_0x7d5865,_0x33d341){return new BPromise(function(_0xbbbe3e,_0x3da8a1){var _0xa41248=_0x33d341||client;return _0xa41248[_0xc579('0x22')](_0x1ddc13,_0x7d5865)['then'](function(_0x463f5e){logger[_0xc579('0x23')]('WhatsappAccount,\x20%s,\x20%s',_0x414ee7,_0xc579('0x24'));logger[_0xc579('0x25')](_0xc579('0x26'),_0x414ee7,_0xc579('0x24'),JSON[_0xc579('0x27')](_0x463f5e));if(_0x463f5e[_0xc579('0x28')]){if(_0x463f5e[_0xc579('0x28')][_0xc579('0x29')]===0x1f4){logger['error'](_0xc579('0x2a'),_0x414ee7,_0x463f5e[_0xc579('0x28')][_0xc579('0x2b')]);return _0x3da8a1(_0x463f5e[_0xc579('0x28')][_0xc579('0x2b')]);}logger['error'](_0xc579('0x2a'),_0x414ee7,_0x463f5e[_0xc579('0x28')][_0xc579('0x2b')]);return _0xbbbe3e(_0x463f5e['error'][_0xc579('0x2b')]);}else{logger['info'](_0xc579('0x2a'),_0x414ee7,_0xc579('0x24'));_0xbbbe3e(_0x463f5e[_0xc579('0x2c')]['message']);}})[_0xc579('0x2d')](function(_0x5b5f4e){logger['error']('WhatsappAccount,\x20%s,\x20%s',_0x414ee7,_0x5b5f4e);_0x3da8a1(_0x5b5f4e);});});}function respondWithStatusCode(_0x540d90,_0x3f7363){_0x3f7363=_0x3f7363||0xcc;return function(_0xfdbb73){if(_0xfdbb73){return _0x540d90[_0xc579('0x2e')](_0x3f7363);}return _0x540d90[_0xc579('0x2f')](_0x3f7363)[_0xc579('0x30')]();};}function respondWithResult(_0x45fef4,_0x5c272f){_0x5c272f=_0x5c272f||0xc8;return function(_0x4d78bc){if(_0x4d78bc){return _0x45fef4[_0xc579('0x2f')](_0x5c272f)['json'](_0x4d78bc);}};}function respondWithFilteredResult(_0x314daa,_0x56224e){return function(_0x1a4551){if(_0x1a4551){var _0x3fe96b=_0x1a4551[_0xc579('0x31')],_0x1ad8f7=_0x56224e['offset'],_0x156bf5=_0x56224e[_0xc579('0x32')]+_0x56224e[_0xc579('0x33')],_0x45e6a3;if(_0x156bf5>=_0x3fe96b){_0x156bf5=_0x3fe96b;_0x45e6a3=0xc8;}else{_0x45e6a3=0xce;}_0x314daa[_0xc579('0x2f')](_0x45e6a3);return _0x314daa[_0xc579('0x34')]('Content-Range',_0x1ad8f7+'-'+_0x156bf5+'/'+_0x3fe96b)['json'](_0x1a4551);}return null;};}function patchUpdates(_0x21ab16){return function(_0x560e3b){try{jsonpatch[_0xc579('0x35')](_0x560e3b,_0x21ab16,!![]);}catch(_0x1591bc){return BPromise[_0xc579('0x36')](_0x1591bc);}return _0x560e3b[_0xc579('0x37')]();};}function saveUpdates(_0x29d619,_0x552c3a){return function(_0x1959c0){if(_0x1959c0){return _0x1959c0['update'](_0x29d619)[_0xc579('0x38')](function(_0x473000){return _0x473000;});}return null;};}function removeEntity(_0x5ec55f,_0x3535af){return function(_0x249fdc){if(_0x249fdc){return _0x249fdc['destroy']()['then'](function(){var _0x37bce9=_0x249fdc[_0xc579('0x39')]({'plain':!![]});var _0x578094=_0xc579('0x3a');return db[_0xc579('0x3b')]['destroy']({'where':{'type':_0x578094,'resourceId':_0x37bce9['id']}})[_0xc579('0x38')](function(){return _0x249fdc;});})['then'](function(){_0x5ec55f[_0xc579('0x2f')](0xcc)[_0xc579('0x30')]();});}};}function handleEntityNotFound(_0x5c6f38,_0x198d87){return function(_0x288e15){if(!_0x288e15){_0x5c6f38[_0xc579('0x2e')](0x194);}return _0x288e15;};}function handleError(_0x2fcdb5,_0x86e55f){_0x86e55f=_0x86e55f||0x1f4;return function(_0x324b51){logger['error'](_0x324b51[_0xc579('0x3c')]);if(_0x324b51[_0xc579('0x3d')]){delete _0x324b51['name'];}_0x2fcdb5[_0xc579('0x2f')](_0x86e55f)[_0xc579('0x3e')](_0x324b51);};}exports[_0xc579('0x3f')]=function(_0x33f56e,_0x58f293){var _0x3f744f={'include':[{'model':db['Pause'],'as':'mandatoryDispositionPause'}]},_0x2864de={},_0x4160ce={'count':0x0,'rows':[]};var _0x5c9d54=_[_0xc579('0x40')](db[_0xc579('0x41')][_0xc579('0x42')],function(_0xb93094){return{'name':_0xb93094[_0xc579('0x43')],'type':_0xb93094[_0xc579('0x44')]['key']};});_0x2864de[_0xc579('0x45')]=_['map'](_0x5c9d54,_0xc579('0x3d'));_0x2864de[_0xc579('0x46')]=_[_0xc579('0x47')](_0x33f56e[_0xc579('0x46')]);_0x2864de[_0xc579('0x48')]=_[_0xc579('0x49')](_0x2864de[_0xc579('0x45')],_0x2864de[_0xc579('0x46')]);_0x3f744f['attributes']=_[_0xc579('0x49')](_0x2864de[_0xc579('0x45')],qs[_0xc579('0x4a')](_0x33f56e[_0xc579('0x46')][_0xc579('0x4a')]));_0x3f744f[_0xc579('0x4b')]=_0x3f744f['attributes'][_0xc579('0x4c')]?_0x3f744f[_0xc579('0x4b')]:_0x2864de[_0xc579('0x45')];if(!_0x33f56e['query'][_0xc579('0x4d')](_0xc579('0x4e'))){_0x3f744f[_0xc579('0x33')]=qs['limit'](_0x33f56e[_0xc579('0x46')]['limit']);_0x3f744f[_0xc579('0x32')]=qs[_0xc579('0x32')](_0x33f56e[_0xc579('0x46')]['offset']);}_0x3f744f[_0xc579('0x4f')]=qs[_0xc579('0x50')](_0x33f56e['query']['sort']);_0x3f744f[_0xc579('0x51')]=qs[_0xc579('0x48')](_[_0xc579('0x52')](_0x33f56e[_0xc579('0x46')],_0x2864de['filters']),_0x5c9d54);if(_0x33f56e['query'][_0xc579('0x53')]){_0x3f744f[_0xc579('0x51')]=_[_0xc579('0x54')](_0x3f744f[_0xc579('0x51')],{'$or':_['map'](_0x5c9d54,function(_0x38b08f){if(_0x38b08f[_0xc579('0x44')]!=='VIRTUAL'){var _0x40d790={};_0x40d790[_0x38b08f['name']]={'$like':'%'+_0x33f56e['query']['filter']+'%'};return _0x40d790;}})});}_0x3f744f=_[_0xc579('0x54')]({},_0x3f744f,_0x33f56e[_0xc579('0x55')]);var _0x2b7a30={'where':_0x3f744f[_0xc579('0x51')]};return db[_0xc579('0x41')]['count'](_0x2b7a30)[_0xc579('0x38')](function(_0x1c7633){_0x4160ce[_0xc579('0x31')]=_0x1c7633;if(_0x33f56e['query']['includeAll']){_0x3f744f[_0xc579('0x56')]=[{'all':!![]}];}return db[_0xc579('0x41')][_0xc579('0x57')](_0x3f744f);})[_0xc579('0x38')](function(_0x192509){_0x4160ce[_0xc579('0x58')]=_0x192509;return _0x4160ce;})[_0xc579('0x38')](respondWithFilteredResult(_0x58f293,_0x3f744f))['catch'](handleError(_0x58f293,null));};exports['show']=function(_0x43e36d,_0x349c65){var _0x58081f={'raw':![],'where':{'id':_0x43e36d['params']['id']},'include':[{'model':db[_0xc579('0x59')],'as':_0xc579('0x5a')}]},_0x36daa4={};_0x36daa4[_0xc579('0x45')]=_[_0xc579('0x47')](db[_0xc579('0x41')][_0xc579('0x42')]);_0x36daa4['query']=_[_0xc579('0x47')](_0x43e36d[_0xc579('0x46')]);_0x36daa4[_0xc579('0x48')]=_['intersection'](_0x36daa4[_0xc579('0x45')],_0x36daa4['query']);_0x58081f[_0xc579('0x4b')]=_[_0xc579('0x49')](_0x36daa4[_0xc579('0x45')],qs[_0xc579('0x4a')](_0x43e36d['query']['fields']));_0x58081f[_0xc579('0x4b')]=_0x58081f['attributes'][_0xc579('0x4c')]?_0x58081f[_0xc579('0x4b')]:_0x36daa4[_0xc579('0x45')];if(_0x43e36d['query'][_0xc579('0x5b')]){_0x58081f[_0xc579('0x56')]=[{'all':!![]}];}_0x58081f=_['merge']({},_0x58081f,_0x43e36d[_0xc579('0x55')]);return db[_0xc579('0x41')][_0xc579('0x5c')](_0x58081f)[_0xc579('0x38')](handleEntityNotFound(_0x349c65,null))[_0xc579('0x38')](respondWithResult(_0x349c65,null))['catch'](handleError(_0x349c65,null));};exports['create']=function(_0x19765c,_0x409948){return db[_0xc579('0x41')]['create'](_0x19765c['body'],{})[_0xc579('0x38')](function(_0x4554a2){var _0x4fb2fb=_0x19765c[_0xc579('0x5d')][_0xc579('0x39')]({'plain':!![]});if(!_0x4fb2fb)throw new Error(_0xc579('0x5e'));if(_0x4fb2fb[_0xc579('0x5f')]===_0xc579('0x5d')){var _0x469fe5=_0x4554a2[_0xc579('0x39')]({'plain':!![]});var _0x51162b=_0xc579('0x3a');return db[_0xc579('0x60')][_0xc579('0x5c')]({'where':{'name':_0x51162b,'userProfileId':_0x4fb2fb[_0xc579('0x61')]},'raw':!![]})[_0xc579('0x38')](function(_0x4c08c5){if(_0x4c08c5&&_0x4c08c5[_0xc579('0x62')]===0x0){return db[_0xc579('0x3b')][_0xc579('0x63')]({'name':_0x469fe5[_0xc579('0x3d')],'resourceId':_0x469fe5['id'],'type':_0x4c08c5[_0xc579('0x3d')],'sectionId':_0x4c08c5['id']},{})['then'](function(){return _0x4554a2;});}else{return _0x4554a2;}})[_0xc579('0x2d')](function(_0x2f7a84){logger[_0xc579('0x28')](_0xc579('0x64'),_0x2f7a84);throw _0x2f7a84;});}return _0x4554a2;})[_0xc579('0x38')](respondWithResult(_0x409948,0xc9))[_0xc579('0x2d')](handleError(_0x409948,null));};exports['update']=function(_0x3821e0,_0x30b304){if(_0x3821e0[_0xc579('0x65')]['id']){delete _0x3821e0[_0xc579('0x65')]['id'];}return db[_0xc579('0x41')][_0xc579('0x5c')]({'where':{'id':_0x3821e0[_0xc579('0x66')]['id']},'include':[{'model':db[_0xc579('0x59')],'as':'mandatoryDispositionPause'}]})['then'](handleEntityNotFound(_0x30b304,null))[_0xc579('0x38')](saveUpdates(_0x3821e0[_0xc579('0x65')],null))[_0xc579('0x38')](respondWithResult(_0x30b304,null))[_0xc579('0x2d')](handleError(_0x30b304,null));};exports[_0xc579('0x67')]=function(_0xccec41,_0x40d1c1){return db[_0xc579('0x41')][_0xc579('0x5c')]({'where':{'id':_0xccec41[_0xc579('0x66')]['id']}})[_0xc579('0x38')](handleEntityNotFound(_0x40d1c1,null))[_0xc579('0x38')](removeEntity(_0x40d1c1,null))[_0xc579('0x2d')](handleError(_0x40d1c1,null));};exports[_0xc579('0x68')]=function(_0x535e23,_0x45c6c8){return db[_0xc579('0x41')]['describe']()[_0xc579('0x38')](respondWithResult(_0x45c6c8,null))[_0xc579('0x2d')](handleError(_0x45c6c8,null));};exports['addDisposition']=function(_0x134c7f,_0x167696,_0x1ab782){if(_0x134c7f[_0xc579('0x65')]['id']){delete _0x134c7f[_0xc579('0x65')]['id'];}return db[_0xc579('0x41')][_0xc579('0x5c')]({'where':{'id':_0x134c7f[_0xc579('0x66')]['id']}})[_0xc579('0x38')](handleEntityNotFound(_0x167696,null))[_0xc579('0x38')](function(_0x6ca41c){if(_0x6ca41c){_0x134c7f[_0xc579('0x65')][_0xc579('0x69')]=_0x6ca41c['id'];return db['Disposition'][_0xc579('0x63')](_0x134c7f[_0xc579('0x65')]);}})['then'](respondWithResult(_0x167696,null))[_0xc579('0x2d')](handleError(_0x167696,null));};exports[_0xc579('0x6a')]=function(_0x3f969c,_0x4f1195,_0x42f21b){var _0xea767c={'raw':![],'where':{}};var _0x52b0ed={};var _0x4ac9d3={'count':0x0,'rows':[]};return db[_0xc579('0x41')][_0xc579('0x6b')]({'where':{'id':_0x3f969c[_0xc579('0x66')]['id']}})[_0xc579('0x38')](handleEntityNotFound(_0x4f1195,null))[_0xc579('0x38')](function(_0x26b6f5){if(_0x26b6f5){_0x52b0ed['model']=_['keys'](db[_0xc579('0x6c')][_0xc579('0x42')]);_0x52b0ed[_0xc579('0x46')]=_[_0xc579('0x47')](_0x3f969c[_0xc579('0x46')]);_0x52b0ed[_0xc579('0x48')]=_[_0xc579('0x49')](_0x52b0ed[_0xc579('0x45')],_0x52b0ed[_0xc579('0x46')]);_0xea767c[_0xc579('0x4b')]=_[_0xc579('0x49')](_0x52b0ed[_0xc579('0x45')],qs[_0xc579('0x4a')](_0x3f969c[_0xc579('0x46')][_0xc579('0x4a')]));_0xea767c['attributes']=_0xea767c[_0xc579('0x4b')][_0xc579('0x4c')]?_0xea767c['attributes']:_0x52b0ed[_0xc579('0x45')];if(!_0x3f969c[_0xc579('0x46')][_0xc579('0x4d')](_0xc579('0x4e'))){_0xea767c[_0xc579('0x33')]=qs[_0xc579('0x33')](_0x3f969c[_0xc579('0x46')][_0xc579('0x33')]);_0xea767c[_0xc579('0x32')]=qs[_0xc579('0x32')](_0x3f969c[_0xc579('0x46')][_0xc579('0x32')]);}_0xea767c[_0xc579('0x4f')]=qs[_0xc579('0x50')](_0x3f969c[_0xc579('0x46')][_0xc579('0x50')]);_0xea767c['where']=qs['filters'](_[_0xc579('0x52')](_0x3f969c[_0xc579('0x46')],_0x52b0ed[_0xc579('0x48')]));_0xea767c[_0xc579('0x51')][_0xc579('0x69')]=_0x26b6f5['id'];if(_0x3f969c[_0xc579('0x46')][_0xc579('0x53')]){_0xea767c[_0xc579('0x51')]=_[_0xc579('0x54')](_0xea767c['where'],{'$or':_['map'](_0xea767c[_0xc579('0x4b')],function(_0x4838a8){var _0x5dd473={};_0x5dd473[_0x4838a8]={'$like':'%'+_0x3f969c[_0xc579('0x46')][_0xc579('0x53')]+'%'};return _0x5dd473;})});}_0xea767c=_[_0xc579('0x54')]({},_0xea767c,_0x3f969c[_0xc579('0x55')]);return db[_0xc579('0x6c')][_0xc579('0x31')]({'where':_0xea767c['where']})[_0xc579('0x38')](function(_0x3ecd06){_0x4ac9d3['count']=_0x3ecd06;if(_0x3f969c[_0xc579('0x46')]['includeAll']){_0xea767c['include']=[{'all':!![]}];}return db[_0xc579('0x6c')][_0xc579('0x57')](_0xea767c);})[_0xc579('0x38')](function(_0x26a978){_0x4ac9d3[_0xc579('0x58')]=_0x26a978;return _0x4ac9d3;});}})[_0xc579('0x38')](respondWithFilteredResult(_0x4f1195,_0xea767c))[_0xc579('0x2d')](handleError(_0x4f1195,null));};exports['removeDispositions']=function(_0x33b7e2,_0x41d041,_0x5bdd18){return db[_0xc579('0x41')][_0xc579('0x5c')]({'where':{'id':_0x33b7e2[_0xc579('0x66')]['id']}})[_0xc579('0x38')](handleEntityNotFound(_0x41d041,null))['then'](function(_0x5b8e9e){if(_0x5b8e9e){return _0x5b8e9e[_0xc579('0x6d')](_0x33b7e2[_0xc579('0x46')][_0xc579('0x6e')]);}})['then'](respondWithStatusCode(_0x41d041,null))[_0xc579('0x2d')](handleError(_0x41d041,null));};exports[_0xc579('0x6f')]=function(_0x5b0172,_0x161018,_0xebf56f){if(_0x5b0172[_0xc579('0x65')]['id']){delete _0x5b0172['body']['id'];}return db[_0xc579('0x41')][_0xc579('0x5c')]({'where':{'id':_0x5b0172[_0xc579('0x66')]['id']}})['then'](handleEntityNotFound(_0x161018,null))[_0xc579('0x38')](function(_0x28e9c5){if(_0x28e9c5){_0x5b0172[_0xc579('0x65')][_0xc579('0x69')]=_0x28e9c5['id'];return db[_0xc579('0x70')][_0xc579('0x63')](_0x5b0172[_0xc579('0x65')]);}})['then'](respondWithResult(_0x161018,null))[_0xc579('0x2d')](handleError(_0x161018,null));};exports[_0xc579('0x71')]=function(_0x882c68,_0x183e8c,_0x2530bd){var _0x132d1b={'raw':![],'where':{}};var _0x1166fa={};var _0x2da70e={'count':0x0,'rows':[]};return db['WhatsappAccount'][_0xc579('0x6b')]({'where':{'id':_0x882c68[_0xc579('0x66')]['id']}})['then'](handleEntityNotFound(_0x183e8c,null))[_0xc579('0x38')](function(_0x378ec1){if(_0x378ec1){_0x1166fa['model']=_[_0xc579('0x47')](db[_0xc579('0x70')][_0xc579('0x42')]);_0x1166fa[_0xc579('0x46')]=_[_0xc579('0x47')](_0x882c68['query']);_0x1166fa[_0xc579('0x48')]=_[_0xc579('0x49')](_0x1166fa[_0xc579('0x45')],_0x1166fa[_0xc579('0x46')]);_0x132d1b[_0xc579('0x4b')]=_['intersection'](_0x1166fa[_0xc579('0x45')],qs[_0xc579('0x4a')](_0x882c68[_0xc579('0x46')]['fields']));_0x132d1b['attributes']=_0x132d1b[_0xc579('0x4b')][_0xc579('0x4c')]?_0x132d1b[_0xc579('0x4b')]:_0x1166fa[_0xc579('0x45')];if(!_0x882c68[_0xc579('0x46')][_0xc579('0x4d')](_0xc579('0x4e'))){_0x132d1b[_0xc579('0x33')]=qs[_0xc579('0x33')](_0x882c68['query'][_0xc579('0x33')]);_0x132d1b[_0xc579('0x32')]=qs[_0xc579('0x32')](_0x882c68[_0xc579('0x46')]['offset']);}_0x132d1b[_0xc579('0x4f')]=qs[_0xc579('0x50')](_0x882c68[_0xc579('0x46')][_0xc579('0x50')]);_0x132d1b['where']=qs[_0xc579('0x48')](_['pick'](_0x882c68[_0xc579('0x46')],_0x1166fa[_0xc579('0x48')]));_0x132d1b['where'][_0xc579('0x69')]=_0x378ec1['id'];if(_0x882c68['query'][_0xc579('0x53')]){_0x132d1b[_0xc579('0x51')]=_[_0xc579('0x54')](_0x132d1b[_0xc579('0x51')],{'$or':_[_0xc579('0x40')](_0x132d1b['attributes'],function(_0x2e5400){var _0x47e836={};_0x47e836[_0x2e5400]={'$like':'%'+_0x882c68['query'][_0xc579('0x53')]+'%'};return _0x47e836;})});}_0x132d1b=_[_0xc579('0x54')]({},_0x132d1b,_0x882c68['options']);return db['CannedAnswer'][_0xc579('0x31')]({'where':_0x132d1b['where']})[_0xc579('0x38')](function(_0x11f5c5){_0x2da70e[_0xc579('0x31')]=_0x11f5c5;if(_0x882c68[_0xc579('0x46')][_0xc579('0x5b')]){_0x132d1b['include']=[{'all':!![]}];}return db[_0xc579('0x70')][_0xc579('0x57')](_0x132d1b);})[_0xc579('0x38')](function(_0x406fba){_0x2da70e[_0xc579('0x58')]=_0x406fba;return _0x2da70e;});}})[_0xc579('0x38')](respondWithFilteredResult(_0x183e8c,_0x132d1b))[_0xc579('0x2d')](handleError(_0x183e8c,null));};exports[_0xc579('0x72')]=function(_0x4ec8d5,_0x40c2cd,_0x3a7127){return db['WhatsappAccount'][_0xc579('0x5c')]({'where':{'id':_0x4ec8d5['params']['id']}})[_0xc579('0x38')](handleEntityNotFound(_0x40c2cd,null))[_0xc579('0x38')](function(_0xb63e3a){if(_0xb63e3a){return _0xb63e3a[_0xc579('0x72')](_0x4ec8d5[_0xc579('0x46')][_0xc579('0x6e')]);}})[_0xc579('0x38')](respondWithStatusCode(_0x40c2cd,null))[_0xc579('0x2d')](handleError(_0x40c2cd,null));};exports['addAgents']=function(_0x48037d,_0x3ba895,_0x4e418c){return db['WhatsappAccount'][_0xc579('0x5c')]({'where':{'id':_0x48037d['params']['id']}})['then'](handleEntityNotFound(_0x3ba895,null))[_0xc579('0x38')](function(_0x35b10e){if(_0x35b10e){return _0x35b10e[_0xc579('0x73')](_0x48037d[_0xc579('0x65')]['ids'],_[_0xc579('0x74')](_0x48037d[_0xc579('0x65')],[_0xc579('0x6e'),'id'])||{})[_0xc579('0x75')](function(_0x30b033){for(var _0x2053ad=0x0;_0x2053ad<_0x48037d['body']['ids'][_0xc579('0x4c')];_0x2053ad+=0x1){socket[_0xc579('0x76')]('userWhatsappAccount:save',{'UserId':_0x48037d[_0xc579('0x65')]['ids'][_0x2053ad],'WhatsappAccountId':_0x48037d['params']['id']});}return _0x30b033;});}})[_0xc579('0x38')](respondWithResult(_0x3ba895,null))['catch'](handleError(_0x3ba895,null));};exports[_0xc579('0x77')]=function(_0x1b62ea,_0x35175c,_0x5aa10d){return db[_0xc579('0x41')]['find']({'where':{'id':_0x1b62ea['params']['id']}})[_0xc579('0x38')](handleEntityNotFound(_0x35175c,null))[_0xc579('0x38')](function(_0x168ed5){if(_0x168ed5){return _0x168ed5[_0xc579('0x77')](_0x1b62ea['query'][_0xc579('0x6e')])[_0xc579('0x38')](function(){if(_[_0xc579('0x78')](_0x1b62ea['query'][_0xc579('0x6e')])){for(var _0x50b1ef=0x0;_0x50b1ef<_0x1b62ea[_0xc579('0x46')][_0xc579('0x6e')][_0xc579('0x4c')];_0x50b1ef+=0x1){socket[_0xc579('0x76')](_0xc579('0x79'),{'UserId':Number(_0x1b62ea[_0xc579('0x46')][_0xc579('0x6e')][_0x50b1ef]),'WhatsappAccountId':Number(_0x1b62ea['params']['id'])});}}else{socket['emit'](_0xc579('0x79'),{'UserId':Number(_0x1b62ea[_0xc579('0x46')]['ids']),'WhatsappAccountId':Number(_0x1b62ea[_0xc579('0x66')]['id'])});}});}})[_0xc579('0x38')](respondWithStatusCode(_0x35175c,null))[_0xc579('0x2d')](handleError(_0x35175c,null));};exports[_0xc579('0x7a')]=function(_0x103f50,_0x292d7e,_0x3d980b){var _0x195e7d={};var _0x3f8389={};var _0x43a2fd;var _0x31e44c;return db[_0xc579('0x41')][_0xc579('0x6b')]({'where':{'id':_0x103f50[_0xc579('0x66')]['id']}})[_0xc579('0x38')](handleEntityNotFound(_0x292d7e,null))['then'](function(_0x1e69cc){if(_0x1e69cc){_0x43a2fd=_0x1e69cc;_0x3f8389['model']=_[_0xc579('0x47')](db[_0xc579('0x7b')][_0xc579('0x42')]);_0x3f8389['query']=_['keys'](_0x103f50[_0xc579('0x46')]);_0x3f8389[_0xc579('0x48')]=_['intersection'](_0x3f8389[_0xc579('0x45')],_0x3f8389['query']);_0x195e7d[_0xc579('0x4b')]=_['intersection'](_0x3f8389['model'],qs[_0xc579('0x4a')](_0x103f50['query'][_0xc579('0x4a')]));_0x195e7d[_0xc579('0x4b')]=_0x195e7d[_0xc579('0x4b')][_0xc579('0x4c')]?_0x195e7d[_0xc579('0x4b')]:_0x3f8389[_0xc579('0x45')];_0x195e7d[_0xc579('0x4f')]=qs[_0xc579('0x50')](_0x103f50['query'][_0xc579('0x50')]);_0x195e7d[_0xc579('0x51')]=qs[_0xc579('0x48')](_['pick'](_0x103f50[_0xc579('0x46')],_0x3f8389[_0xc579('0x48')]));if(_0x103f50['query'][_0xc579('0x53')]){_0x195e7d[_0xc579('0x51')]=_[_0xc579('0x54')](_0x195e7d[_0xc579('0x51')],{'$or':_[_0xc579('0x40')](_0x195e7d[_0xc579('0x4b')],function(_0x138ec7){var _0x382987={};_0x382987[_0x138ec7]={'$like':'%'+_0x103f50[_0xc579('0x46')][_0xc579('0x53')]+'%'};return _0x382987;})});}_0x195e7d=_['merge']({},_0x195e7d,_0x103f50[_0xc579('0x55')]);return _0x43a2fd[_0xc579('0x7a')](_0x195e7d);}})[_0xc579('0x38')](function(_0x1089e5){if(_0x1089e5){_0x31e44c=_0x1089e5[_0xc579('0x4c')];if(!_0x103f50['query'][_0xc579('0x4d')]('nolimit')){_0x195e7d[_0xc579('0x33')]=qs[_0xc579('0x33')](_0x103f50['query'][_0xc579('0x33')]);_0x195e7d['offset']=qs[_0xc579('0x32')](_0x103f50[_0xc579('0x46')][_0xc579('0x32')]);}return _0x43a2fd[_0xc579('0x7a')](_0x195e7d);}})['then'](function(_0x50eb89){if(_0x50eb89){return _0x50eb89?{'count':_0x31e44c,'rows':_0x50eb89}:null;}})['then'](respondWithResult(_0x292d7e,null))['catch'](handleError(_0x292d7e,null));};exports['addApplications']=function(_0x505d33,_0x1cb42a,_0x35f8f2){return db['WhatsappAccount'][_0xc579('0x6b')]({'where':{'id':_0x505d33['params']['id']}})[_0xc579('0x38')](handleEntityNotFound(_0x1cb42a,null))[_0xc579('0x38')](function(_0x3b86d9){if(_0x3b86d9){return db[_0xc579('0x7c')][_0xc579('0x7d')](function(_0x4d895f){return db[_0xc579('0x7e')][_0xc579('0x67')]({'where':{'WhatsappAccountId':_0x505d33[_0xc579('0x66')]['id']},'transaction':_0x4d895f})[_0xc579('0x38')](function(_0x296b6c){var _0x1d05bc=_[_0xc579('0x40')](_0x505d33[_0xc579('0x65')],function(_0x416a3b){_0x416a3b[_0xc579('0x69')]=_0x505d33[_0xc579('0x66')]['id'];return _0x416a3b;});return db[_0xc579('0x7e')][_0xc579('0x7f')](_0x1d05bc,{'transaction':_0x4d895f});});})[_0xc579('0x38')](function(){return db['WhatsappApplication'][_0xc579('0x80')]({'where':{'WhatsappAccountId':_0x505d33[_0xc579('0x66')]['id']},'order':_0xc579('0x81')});});}})[_0xc579('0x38')](respondWithResult(_0x1cb42a,null))['catch'](handleError(_0x1cb42a,null));};exports['getApplications']=function(_0x111a61,_0x12bf07,_0x2c1861){var _0x9c3592={};var _0x1e55c9={};var _0x38331f;var _0x57554a;return db['WhatsappAccount'][_0xc579('0x6b')]({'where':{'id':_0x111a61[_0xc579('0x66')]['id']}})[_0xc579('0x38')](handleEntityNotFound(_0x12bf07,null))[_0xc579('0x38')](function(_0x2f90d7){if(_0x2f90d7){_0x38331f=_0x2f90d7;_0x1e55c9[_0xc579('0x45')]=_[_0xc579('0x47')](db[_0xc579('0x7e')]['rawAttributes']);_0x1e55c9[_0xc579('0x46')]=_[_0xc579('0x47')](_0x111a61[_0xc579('0x46')]);_0x1e55c9[_0xc579('0x48')]=_[_0xc579('0x49')](_0x1e55c9[_0xc579('0x45')],_0x1e55c9[_0xc579('0x46')]);_0x9c3592['attributes']=_['intersection'](_0x1e55c9[_0xc579('0x45')],qs[_0xc579('0x4a')](_0x111a61[_0xc579('0x46')][_0xc579('0x4a')]));_0x9c3592[_0xc579('0x4b')]=_0x9c3592[_0xc579('0x4b')]['length']?_0x9c3592[_0xc579('0x4b')]:_0x1e55c9[_0xc579('0x45')];_0x9c3592['order']=qs[_0xc579('0x50')](_0x111a61[_0xc579('0x46')]['sort']);_0x9c3592[_0xc579('0x51')]=qs[_0xc579('0x48')](_[_0xc579('0x52')](_0x111a61[_0xc579('0x46')],_0x1e55c9[_0xc579('0x48')]));if(_0x111a61[_0xc579('0x46')][_0xc579('0x53')]){_0x9c3592[_0xc579('0x51')]=_[_0xc579('0x54')](_0x9c3592[_0xc579('0x51')],{'$or':_['map'](_0x9c3592[_0xc579('0x4b')],function(_0x528ead){var _0x2a44fe={};_0x2a44fe[_0x528ead]={'$like':'%'+_0x111a61['query']['filter']+'%'};return _0x2a44fe;})});}_0x9c3592=_['merge']({},_0x9c3592,_0x111a61[_0xc579('0x55')]);return _0x38331f[_0xc579('0x82')](_0x9c3592);}})['then'](function(_0x3dc289){if(_0x3dc289){_0x57554a=_0x3dc289['length'];if(!_0x111a61['query']['hasOwnProperty'](_0xc579('0x4e'))){_0x9c3592[_0xc579('0x33')]=qs[_0xc579('0x33')](_0x111a61[_0xc579('0x46')][_0xc579('0x33')]);_0x9c3592[_0xc579('0x32')]=qs[_0xc579('0x32')](_0x111a61[_0xc579('0x46')][_0xc579('0x32')]);}return _0x38331f[_0xc579('0x82')](_0x9c3592);}})[_0xc579('0x38')](function(_0x4a1b6c){if(_0x4a1b6c){return _0x4a1b6c?{'count':_0x57554a,'rows':_0x4a1b6c}:null;}})[_0xc579('0x38')](respondWithResult(_0x12bf07,null))[_0xc579('0x2d')](handleError(_0x12bf07,null));};exports[_0xc579('0x83')]=function(_0x44c108,_0x55ac32,_0xcbdcd0){var _0x29a134={'channel':'whatsapp'};var _0x32a638=[];var _0x1f29f2=[];var _0x307208={};return db['WhatsappAccount'][_0xc579('0x5c')]({'where':{'id':_0x44c108[_0xc579('0x66')]['id']},'include':[{'model':db[_0xc579('0x7e')],'as':_0xc579('0x84')}]})['then'](handleEntityNotFound(_0x55ac32,null))[_0xc579('0x38')](function(_0x198a3d){_0x29a134[_0xc579('0x85')]=_0x198a3d;_0x29a134['applications']=_[_0xc579('0x86')](_0x198a3d[_0xc579('0x84')],['priority'],[_0xc579('0x87')]);if(_0x29a134[_0xc579('0x85')][_0xc579('0x84')]){delete _0x29a134[_0xc579('0x85')][_0xc579('0x84')];}return db[_0xc579('0x88')][_0xc579('0x68')]();})[_0xc579('0x38')](function(_0x95e144){if(!_0x95e144){throw new db[(_0xc579('0x89'))][(_0xc579('0x20'))](_0xc579('0x8a'));}_0x32a638=_['difference'](_[_0xc579('0x47')](_0x95e144),[_0xc579('0x8b'),_0xc579('0x8c')]);_0x1f29f2=_[_0xc579('0x8d')](_[_0xc579('0x47')](_0x95e144),['createdAt',_0xc579('0x8c'),_0xc579('0x8e'),'ListId']);_0x29a134[_0xc579('0x65')]={'mapKey':_0xc579('0x8f')};if(_0x29a134[_0xc579('0x85')][_0xc579('0x44')]&&_0x29a134[_0xc579('0x85')][_0xc579('0x44')]==='twilio'){_0x29a134[_0xc579('0x65')][_0xc579('0x90')]=_0x44c108[_0xc579('0x65')][_0xc579('0x91')][_0xc579('0x92')](_0xc579('0x93'),'');_0x29a134[_0xc579('0x65')]['body']=_0x44c108[_0xc579('0x65')][_0xc579('0x94')];_0x29a134['body'][_0xc579('0x95')]=_0x44c108[_0xc579('0x65')][_0xc579('0x96')];}if(_0x29a134[_0xc579('0x65')]['id']){delete _0x29a134[_0xc579('0x65')]['id'];}if(_[_0xc579('0x97')](_0x29a134[_0xc579('0x65')]['from'])){throw new db['Sequelize'][(_0xc579('0x20'))](_0xc579('0x98'));}if(_[_0xc579('0x97')](_0x29a134[_0xc579('0x65')][_0xc579('0x65')])||_0x29a134['body'][_0xc579('0x65')]===''){throw new db[(_0xc579('0x89'))]['ValidationError']('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0xc579('0x97')](_0x29a134[_0xc579('0x65')][_0xc579('0x99')])){throw new db[(_0xc579('0x89'))][(_0xc579('0x20'))](_0xc579('0x9a')+_0x1f29f2);}if(!_[_0xc579('0x9b')](_0x1f29f2,_0x29a134[_0xc579('0x65')][_0xc579('0x99')])){throw new db[(_0xc579('0x89'))][(_0xc579('0x20'))](_0xc579('0x9c')+_0x1f29f2);}_0x307208[_0x29a134[_0xc579('0x65')][_0xc579('0x99')]]=_0x29a134[_0xc579('0x65')][_0xc579('0x90')];return db[_0xc579('0x9d')][_0xc579('0x5c')]({'where':{'id':_0x29a134[_0xc579('0x85')][_0xc579('0x9e')]},'include':[{'model':db[_0xc579('0x88')],'as':_0xc579('0x9f'),'where':_0x307208,'limit':0x1,'order':[[_0xc579('0x8c'),_0xc579('0xa0')]]}]});})[_0xc579('0x38')](handleEntityNotFound(_0x55ac32,null))[_0xc579('0x38')](function(_0x216989){if(_0x216989){_0x29a134[_0xc579('0xa1')]=_[_0xc579('0x74')](_0x216989,[_0xc579('0x9f')]);if(_0x216989[_0xc579('0x9f')]['length']){return _0x216989[_0xc579('0x9f')][0x0];}var _0x5cb508=_[_0xc579('0x1c')](_0x29a134[_0xc579('0x65')],{'firstName':_0x29a134['body'][_0xc579('0x90')],'ListId':_0x216989['id']});_0x5cb508[_0x29a134['body'][_0xc579('0x99')]]=_0x29a134['body'][_0xc579('0x90')];return db[_0xc579('0x88')][_0xc579('0x63')](_0x5cb508,{'fields':_0x32a638,'raw':!![]});}})[_0xc579('0x38')](handleEntityNotFound(_0x55ac32,null))[_0xc579('0x38')](function(_0x2ef51e){if(_0x2ef51e){_0x29a134[_0xc579('0xa2')]=_0x2ef51e;var _0x3f0755={'ContactId':_0x2ef51e['id'],'phone':_0x29a134['body'][_0xc579('0x90')],'WhatsappAccountId':_0x44c108['params']['id']};var _0x359457={'ContactId':_0x2ef51e['id'],'WhatsappAccountId':_0x44c108['params']['id'],'closed':![]};return db[_0xc579('0xa3')][_0xc579('0x5c')]({'where':_0x359457})['then'](function(_0x2f431a){if(_0x2f431a){return[_0x2f431a,![]];}return db['WhatsappInteraction']['create'](_0x3f0755)[_0xc579('0x38')](function(_0x40c285){return[_0x40c285,!![]];});});}})['spread'](function(_0x4a8d57,_0x1cf256){_0x29a134[_0xc579('0xa4')]=_0x4a8d57[_0xc579('0x39')]({'plain':!![]});_0x29a134[_0xc579('0xa4')][_0xc579('0xa5')]=![];if(_0x1cf256){if(_0x29a134['account']['autoclose']){_0x29a134[_0xc579('0xa6')]['push']({'id':0x0,'priority':_0x29a134[_0xc579('0xa6')][_0xc579('0x4c')]+0x1,'app':_0xc579('0xa7'),'appdata':_0xc579('0xa8'),'interval':_0xc579('0xa9')});}_0x29a134[_0xc579('0xa4')]['created']=!![];}return db[_0xc579('0xaa')][_0xc579('0x63')]({'phone':_0x29a134[_0xc579('0x65')]['from'],'messageId':_0x29a134[_0xc579('0x65')][_0xc579('0x95')],'body':_0x29a134[_0xc579('0x65')]['body'],'WhatsappAccountId':_0x44c108[_0xc579('0x66')]['id'],'WhatsappInteractionId':_0x4a8d57['id'],'direction':'in','ContactId':_0x4a8d57[_0xc579('0xab')],'AttachmentId':_0x29a134[_0xc579('0x65')][_0xc579('0xac')]});})['then'](function(_0x154c38){_0x29a134[_0xc579('0x2b')]=_0x154c38;if(_0x29a134[_0xc579('0xa4')]['UserId']){return db[_0xc579('0x7b')][_0xc579('0x5c')]({'attributes':['id',_0xc579('0x3d')],'where':{'id':_0x29a134[_0xc579('0xa4')][_0xc579('0xad')]}})[_0xc579('0x38')](function(_0x1b46b1){if(_0x1b46b1){_0x29a134['applications'][_0xc579('0xae')]({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x1b46b1[_0xc579('0x3d')]+','+(_0x29a134[_0xc579('0x85')][_0xc579('0xaf')]||0xa),'interval':_0xc579('0xa9')});}return respondWithRpcPromise(_0xc579('0xb0'),'startRouting',_0x29a134);});}return respondWithRpcPromise('Start',_0xc579('0xb1'),_0x29a134);})['then'](function(_0x56f271){if(_0x56f271){var _0x42f774=0xc8;var _0x5da288=_0xc579('0xb2');logger[_0xc579('0x23')](_0xc579('0x26'),_0x5da288,_0x42f774,_0xc579('0xb3'));logger[_0xc579('0x25')](_0xc579('0xb4'),_0x5da288,_0x42f774,_0xc579('0xb3'),JSON[_0xc579('0x27')](_0x56f271));if(_0x29a134[_0xc579('0x85')][_0xc579('0x44')]===_0xc579('0xb5')){return _0x55ac32['status'](_0x42f774)[_0xc579('0x34')](_0xc579('0xb6'),_0xc579('0xb7'))['send']('\x0a');}else{return _0x55ac32[_0xc579('0x2f')](_0x42f774)[_0xc579('0xb8')](_0x56f271);}}})[_0xc579('0x2d')](handleError(_0x55ac32,null));};exports[_0xc579('0x3e')]=function(_0x3adf5a,_0x5a2a89,_0x5d523f){var _0x41abf5,_0x5ab567,_0x2bac1c;if(_[_0xc579('0x97')](_0x3adf5a[_0xc579('0x65')][_0xc579('0x65')])||_0x3adf5a['body'][_0xc579('0x65')]===''){throw new db['Sequelize'][(_0xc579('0x20'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0xc579('0x97')](_0x3adf5a[_0xc579('0x65')]['to'])){throw new db[(_0xc579('0x89'))][(_0xc579('0x20'))]('to\x20is\x20mandatory');}_0x41abf5=_0x3adf5a[_0xc579('0x65')]['to'];return db[_0xc579('0x41')][_0xc579('0x5c')]({'where':{'id':_0x3adf5a['params']['id']},'include':[{'model':db[_0xc579('0x9d')],'as':_0xc579('0xb9'),'include':[{'model':db[_0xc579('0x88')],'as':'Contacts','where':{'mobile':_0x41abf5},'limit':0x1,'order':[['updatedAt',_0xc579('0xa0')]]}]}]})[_0xc579('0x38')](handleEntityNotFound(_0x5a2a89,null))['then'](function(_0x42b702){if(_0x42b702&&_0x42b702[_0xc579('0xb9')]){_0x5ab567=_0x42b702[_0xc579('0x39')]({'plain':!![]});if(_0x5ab567[_0xc579('0xb9')]&&_0x5ab567['List'][_0xc579('0x9f')][_0xc579('0x4c')]){return _0x5ab567[_0xc579('0xb9')][_0xc579('0x9f')][0x0];}return db['CmContact'][_0xc579('0x63')](_[_0xc579('0x1c')](_0x3adf5a[_0xc579('0x65')],{'firstName':_0x41abf5,'mobile':_0x41abf5,'phone':_0x41abf5,'ListId':_0x5ab567[_0xc579('0x9e')]}));}})[_0xc579('0x38')](handleEntityNotFound(_0x5a2a89,null))[_0xc579('0x38')](function(_0x12dd99){if(_0x12dd99){_0x2bac1c=_0x12dd99;return db['WhatsappInteraction'][_0xc579('0x5c')]({'where':{'ContactId':_0x2bac1c['id'],'closed':![],'WhatsappAccountId':_0x5ab567['id']}})['then'](function(_0x1651ba){if(_0x1651ba){return[_0x1651ba,![]];}return db[_0xc579('0xa3')]['create']({'UserId':_0x3adf5a['user']['id'],'ContactId':_0x2bac1c['id'],'WhatsappAccountId':_0x5ab567['id'],'phone':_0x41abf5,'firstMsgDirection':_0xc579('0xba'),'Messages':[_[_0xc579('0x54')](_0x3adf5a[_0xc579('0x65')],{'read':![],'body':_0x3adf5a['body'][_0xc579('0x65')],'phone':_0x41abf5,'WhatsappAccountId':_0x5ab567['id'],'UserId':_0x3adf5a[_0xc579('0x5d')]['id'],'ContactId':_0x2bac1c['id']})]},{'include':[{'model':db[_0xc579('0xaa')],'as':'Messages'}]})[_0xc579('0x38')](function(_0x40a493){return[_0x40a493,!![]];});});}})['spread'](function(_0x57242c,_0x3eb634){if(_0x3eb634){return _0x57242c;}return db[_0xc579('0xaa')]['create'](_[_0xc579('0x54')](_0x3adf5a[_0xc579('0x65')],{'read':![],'body':_0x3adf5a['body'][_0xc579('0x65')],'phone':_0x41abf5,'WhatsappAccountId':_0x5ab567['id'],'WhatsappInteractionId':_0x57242c['id'],'UserId':_0x3adf5a['user']['id'],'ContactId':_0x2bac1c['id']}))[_0xc579('0x38')](function(_0x2082fe){_0x57242c[_0xc579('0xbb')][_0xc579('0xbc')]=[];_0x57242c[_0xc579('0xbb')][_0xc579('0xbc')][_0xc579('0xbd')](_0x2082fe[_0xc579('0xbb')]);return _0x57242c;});})[_0xc579('0x38')](respondWithResult(_0x5a2a89,null))[_0xc579('0x2d')](handleError(_0x5a2a89,null));}; \ No newline at end of file +var _0x2e54=['type','VIRTUAL','options','include','findAll','show','params','includeAll','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','describe','WhatsappAccountId','Disposition','getDispositions','findOne','rows','removeDispositions','ids','addAnswer','getAnswers','CannedAnswer','removeAnswers','addAgents','omit','spread','emit','removeAgents','isArray','userWhatsappAccount:remove','getAgents','addApplications','sequelize','transaction','WhatsappApplication','bulkCreate','priority','getApplications','notify','whatsapp','Applications','asc','account','CmContact','no\x20available\x20attributes','difference','createdAt','updatedAt','CompanyId','ListId','mobile','twilio','from','From','replace','whatsapp:','Body','MessageSid','isNil','from\x20is\x20mandatory','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey','CmList','Contacts','DESC','list','contact','WhatsappInteraction','interaction','created','autoclose','applications','push','close','WhatsappMessage','UserId','User','unshift','agent','waitForTheAssignedAgent','*,*,*,*','Start','startRouting','receiveMessage','entity\x20found','Content-Type','text/xml','\x0a','send','body\x20is\x20mandatory\x20and\x20not\x20empty','List','Messages','dataValues','html-pdf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','squel','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','redis','defaults','localhost','socket.io-emitter','./whatsappAccount.socket','register','jayson/promise','client','test','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','info','WhatsappAccount,\x20%s,\x20%s','debug','WhatsappAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','sendStatus','status','end','json','count','offset','set','Content-Range','apply','reject','then','destroy','get','WhatsappAccounts','UserProfileResource','stack','name','index','Pause','mandatoryDispositionPause','WhatsappAccount','rawAttributes','fieldName','map','query','keys','filters','intersection','attributes','model','fields','length','hasOwnProperty','nolimit','limit','order','sort','pick','filter','where','merge'];(function(_0x4fbfd9,_0x3ab91a){var _0x31dc94=function(_0x11e53b){while(--_0x11e53b){_0x4fbfd9['push'](_0x4fbfd9['shift']());}};_0x31dc94(++_0x3ab91a);}(_0x2e54,0x1dd));var _0x42e5=function(_0x143447,_0xdd222f){_0x143447=_0x143447-0x0;var _0x415de1=_0x2e54[_0x143447];return _0x415de1;};'use strict';var pdf=require(_0x42e5('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x42e5('0x1'));var jsonpatch=require(_0x42e5('0x2'));var rp=require(_0x42e5('0x3'));var moment=require(_0x42e5('0x4'));var BPromise=require(_0x42e5('0x5'));var Mustache=require(_0x42e5('0x6'));var util=require(_0x42e5('0x7'));var path=require('path');var sox=require(_0x42e5('0x8'));var csv=require(_0x42e5('0x9'));var ejs=require(_0x42e5('0xa'));var fs=require('fs');var _=require('lodash');var squel=require(_0x42e5('0xb'));var crypto=require('crypto');var jsforce=require(_0x42e5('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x42e5('0x9'));var querystring=require(_0x42e5('0xd'));var Papa=require(_0x42e5('0xe'));var Redis=require(_0x42e5('0xf'));var authService=require(_0x42e5('0x10'));var qs=require(_0x42e5('0x11'));var as=require(_0x42e5('0x12'));var hardwareService=require(_0x42e5('0x13'));var logger=require(_0x42e5('0x14'))('api');var utils=require(_0x42e5('0x15'));var config=require(_0x42e5('0x16'));var db=require('../../mysqldb')['db'];config[_0x42e5('0x17')]=_[_0x42e5('0x18')](config[_0x42e5('0x17')],{'host':_0x42e5('0x19'),'port':0x18eb});var socket=require(_0x42e5('0x1a'))(new Redis(config[_0x42e5('0x17')]));require(_0x42e5('0x1b'))[_0x42e5('0x1c')](socket);var jayson=require(_0x42e5('0x1d'));var client=jayson[_0x42e5('0x1e')]['http']({'port':0x232c});function checkPasswordPattern(_0x3b3dd9,_0x1d8e52,_0x4034bd){if(_0x4034bd){var _0x388300=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x388300[_0x42e5('0x1f')](_0x1d8e52)){return _0x3b3dd9;}else{throw new db[(_0x42e5('0x20'))][(_0x42e5('0x21'))](_0x42e5('0x22'));}}else{return _0x3b3dd9;}}function respondWithRpcPromise(_0x16c753,_0x3c7b79,_0x22655f,_0x38282d){return new BPromise(function(_0x11550e,_0x23fe09){var _0x54fcfc=_0x38282d||client;return _0x54fcfc[_0x42e5('0x23')](_0x16c753,_0x22655f)['then'](function(_0x5f4428){logger[_0x42e5('0x24')](_0x42e5('0x25'),_0x3c7b79,'request\x20sent');logger[_0x42e5('0x26')](_0x42e5('0x27'),_0x3c7b79,_0x42e5('0x28'),JSON[_0x42e5('0x29')](_0x5f4428));if(_0x5f4428[_0x42e5('0x2a')]){if(_0x5f4428[_0x42e5('0x2a')][_0x42e5('0x2b')]===0x1f4){logger['error']('WhatsappAccount,\x20%s,\x20%s',_0x3c7b79,_0x5f4428[_0x42e5('0x2a')]['message']);return _0x23fe09(_0x5f4428[_0x42e5('0x2a')][_0x42e5('0x2c')]);}logger[_0x42e5('0x2a')](_0x42e5('0x25'),_0x3c7b79,_0x5f4428[_0x42e5('0x2a')]['message']);return _0x11550e(_0x5f4428[_0x42e5('0x2a')][_0x42e5('0x2c')]);}else{logger[_0x42e5('0x24')](_0x42e5('0x25'),_0x3c7b79,_0x42e5('0x28'));_0x11550e(_0x5f4428['result']['message']);}})[_0x42e5('0x2d')](function(_0x534a26){logger['error'](_0x42e5('0x25'),_0x3c7b79,_0x534a26);_0x23fe09(_0x534a26);});});}function respondWithStatusCode(_0x5b1727,_0x392c6b){_0x392c6b=_0x392c6b||0xcc;return function(_0x2d9e65){if(_0x2d9e65){return _0x5b1727[_0x42e5('0x2e')](_0x392c6b);}return _0x5b1727[_0x42e5('0x2f')](_0x392c6b)[_0x42e5('0x30')]();};}function respondWithResult(_0x2f1edc,_0x59a46b){_0x59a46b=_0x59a46b||0xc8;return function(_0x3e2ea5){if(_0x3e2ea5){return _0x2f1edc[_0x42e5('0x2f')](_0x59a46b)[_0x42e5('0x31')](_0x3e2ea5);}};}function respondWithFilteredResult(_0x2c53d4,_0x1d22ba){return function(_0xd62a0f){if(_0xd62a0f){var _0x383e97=_0xd62a0f[_0x42e5('0x32')],_0x282cbf=_0x1d22ba[_0x42e5('0x33')],_0x5a4930=_0x1d22ba[_0x42e5('0x33')]+_0x1d22ba['limit'],_0x2ba9ef;if(_0x5a4930>=_0x383e97){_0x5a4930=_0x383e97;_0x2ba9ef=0xc8;}else{_0x2ba9ef=0xce;}_0x2c53d4[_0x42e5('0x2f')](_0x2ba9ef);return _0x2c53d4[_0x42e5('0x34')](_0x42e5('0x35'),_0x282cbf+'-'+_0x5a4930+'/'+_0x383e97)[_0x42e5('0x31')](_0xd62a0f);}return null;};}function patchUpdates(_0x5bdc87){return function(_0x539254){try{jsonpatch[_0x42e5('0x36')](_0x539254,_0x5bdc87,!![]);}catch(_0x59f8d6){return BPromise[_0x42e5('0x37')](_0x59f8d6);}return _0x539254['save']();};}function saveUpdates(_0x472600,_0x188d9d){return function(_0x860000){if(_0x860000){return _0x860000['update'](_0x472600)[_0x42e5('0x38')](function(_0x3a8d1c){return _0x3a8d1c;});}return null;};}function removeEntity(_0x5b99da,_0x1ae59c){return function(_0x57558d){if(_0x57558d){return _0x57558d[_0x42e5('0x39')]()[_0x42e5('0x38')](function(){var _0x25a040=_0x57558d[_0x42e5('0x3a')]({'plain':!![]});var _0x3c12c6=_0x42e5('0x3b');return db[_0x42e5('0x3c')]['destroy']({'where':{'type':_0x3c12c6,'resourceId':_0x25a040['id']}})['then'](function(){return _0x57558d;});})[_0x42e5('0x38')](function(){_0x5b99da[_0x42e5('0x2f')](0xcc)[_0x42e5('0x30')]();});}};}function handleEntityNotFound(_0x4a1a8a,_0x56804a){return function(_0x5da91c){if(!_0x5da91c){_0x4a1a8a['sendStatus'](0x194);}return _0x5da91c;};}function handleError(_0x245cda,_0x288fb0){_0x288fb0=_0x288fb0||0x1f4;return function(_0x24958b){logger[_0x42e5('0x2a')](_0x24958b[_0x42e5('0x3d')]);if(_0x24958b[_0x42e5('0x3e')]){delete _0x24958b[_0x42e5('0x3e')];}_0x245cda[_0x42e5('0x2f')](_0x288fb0)['send'](_0x24958b);};}exports[_0x42e5('0x3f')]=function(_0x587832,_0x470338){var _0x343363={'include':[{'model':db[_0x42e5('0x40')],'as':_0x42e5('0x41')}]},_0x340caf={},_0x53a5c8={'count':0x0,'rows':[]};var _0xd5e7f5=_['map'](db[_0x42e5('0x42')][_0x42e5('0x43')],function(_0x5362c8){return{'name':_0x5362c8[_0x42e5('0x44')],'type':_0x5362c8['type']['key']};});_0x340caf['model']=_[_0x42e5('0x45')](_0xd5e7f5,_0x42e5('0x3e'));_0x340caf[_0x42e5('0x46')]=_[_0x42e5('0x47')](_0x587832[_0x42e5('0x46')]);_0x340caf[_0x42e5('0x48')]=_[_0x42e5('0x49')](_0x340caf['model'],_0x340caf[_0x42e5('0x46')]);_0x343363[_0x42e5('0x4a')]=_['intersection'](_0x340caf[_0x42e5('0x4b')],qs[_0x42e5('0x4c')](_0x587832['query'][_0x42e5('0x4c')]));_0x343363[_0x42e5('0x4a')]=_0x343363[_0x42e5('0x4a')][_0x42e5('0x4d')]?_0x343363[_0x42e5('0x4a')]:_0x340caf['model'];if(!_0x587832[_0x42e5('0x46')][_0x42e5('0x4e')](_0x42e5('0x4f'))){_0x343363[_0x42e5('0x50')]=qs['limit'](_0x587832[_0x42e5('0x46')][_0x42e5('0x50')]);_0x343363[_0x42e5('0x33')]=qs[_0x42e5('0x33')](_0x587832[_0x42e5('0x46')][_0x42e5('0x33')]);}_0x343363[_0x42e5('0x51')]=qs[_0x42e5('0x52')](_0x587832['query'][_0x42e5('0x52')]);_0x343363['where']=qs['filters'](_[_0x42e5('0x53')](_0x587832[_0x42e5('0x46')],_0x340caf[_0x42e5('0x48')]),_0xd5e7f5);if(_0x587832[_0x42e5('0x46')][_0x42e5('0x54')]){_0x343363[_0x42e5('0x55')]=_[_0x42e5('0x56')](_0x343363['where'],{'$or':_[_0x42e5('0x45')](_0xd5e7f5,function(_0x27681a){if(_0x27681a[_0x42e5('0x57')]!==_0x42e5('0x58')){var _0x1086b2={};_0x1086b2[_0x27681a[_0x42e5('0x3e')]]={'$like':'%'+_0x587832[_0x42e5('0x46')][_0x42e5('0x54')]+'%'};return _0x1086b2;}})});}_0x343363=_['merge']({},_0x343363,_0x587832[_0x42e5('0x59')]);var _0x3fbccb={'where':_0x343363[_0x42e5('0x55')]};return db[_0x42e5('0x42')][_0x42e5('0x32')](_0x3fbccb)[_0x42e5('0x38')](function(_0xffc1e2){_0x53a5c8[_0x42e5('0x32')]=_0xffc1e2;if(_0x587832[_0x42e5('0x46')]['includeAll']){_0x343363[_0x42e5('0x5a')]=[{'all':!![]}];}return db['WhatsappAccount'][_0x42e5('0x5b')](_0x343363);})[_0x42e5('0x38')](function(_0x326086){_0x53a5c8['rows']=_0x326086;return _0x53a5c8;})['then'](respondWithFilteredResult(_0x470338,_0x343363))['catch'](handleError(_0x470338,null));};exports[_0x42e5('0x5c')]=function(_0x2601c6,_0x11fd3c){var _0x148d2c={'raw':![],'where':{'id':_0x2601c6[_0x42e5('0x5d')]['id']},'include':[{'model':db[_0x42e5('0x40')],'as':_0x42e5('0x41')}]},_0x53edc8={};_0x53edc8['model']=_[_0x42e5('0x47')](db['WhatsappAccount'][_0x42e5('0x43')]);_0x53edc8[_0x42e5('0x46')]=_['keys'](_0x2601c6[_0x42e5('0x46')]);_0x53edc8[_0x42e5('0x48')]=_[_0x42e5('0x49')](_0x53edc8[_0x42e5('0x4b')],_0x53edc8[_0x42e5('0x46')]);_0x148d2c[_0x42e5('0x4a')]=_[_0x42e5('0x49')](_0x53edc8[_0x42e5('0x4b')],qs[_0x42e5('0x4c')](_0x2601c6[_0x42e5('0x46')]['fields']));_0x148d2c[_0x42e5('0x4a')]=_0x148d2c[_0x42e5('0x4a')][_0x42e5('0x4d')]?_0x148d2c[_0x42e5('0x4a')]:_0x53edc8[_0x42e5('0x4b')];if(_0x2601c6['query'][_0x42e5('0x5e')]){_0x148d2c[_0x42e5('0x5a')]=[{'all':!![]}];}_0x148d2c=_[_0x42e5('0x56')]({},_0x148d2c,_0x2601c6[_0x42e5('0x59')]);return db['WhatsappAccount']['find'](_0x148d2c)['then'](handleEntityNotFound(_0x11fd3c,null))[_0x42e5('0x38')](respondWithResult(_0x11fd3c,null))[_0x42e5('0x2d')](handleError(_0x11fd3c,null));};exports['create']=function(_0x42094e,_0xb73aa8){return db[_0x42e5('0x42')][_0x42e5('0x5f')](_0x42094e[_0x42e5('0x60')],{})[_0x42e5('0x38')](function(_0x2ec142){var _0x2c76e0=_0x42094e[_0x42e5('0x61')]['get']({'plain':!![]});if(!_0x2c76e0)throw new Error(_0x42e5('0x62'));if(_0x2c76e0['role']===_0x42e5('0x61')){var _0x2d05b5=_0x2ec142[_0x42e5('0x3a')]({'plain':!![]});var _0x3b4836=_0x42e5('0x3b');return db[_0x42e5('0x63')][_0x42e5('0x64')]({'where':{'name':_0x3b4836,'userProfileId':_0x2c76e0[_0x42e5('0x65')]},'raw':!![]})[_0x42e5('0x38')](function(_0x397481){if(_0x397481&&_0x397481[_0x42e5('0x66')]===0x0){return db['UserProfileResource'][_0x42e5('0x5f')]({'name':_0x2d05b5['name'],'resourceId':_0x2d05b5['id'],'type':_0x397481[_0x42e5('0x3e')],'sectionId':_0x397481['id']},{})['then'](function(){return _0x2ec142;});}else{return _0x2ec142;}})[_0x42e5('0x2d')](function(_0x3068fa){logger['error'](_0x42e5('0x67'),_0x3068fa);throw _0x3068fa;});}return _0x2ec142;})[_0x42e5('0x38')](respondWithResult(_0xb73aa8,0xc9))['catch'](handleError(_0xb73aa8,null));};exports[_0x42e5('0x68')]=function(_0x9b93a9,_0x513b80){if(_0x9b93a9[_0x42e5('0x60')]['id']){delete _0x9b93a9[_0x42e5('0x60')]['id'];}return db[_0x42e5('0x42')]['find']({'where':{'id':_0x9b93a9[_0x42e5('0x5d')]['id']},'include':[{'model':db[_0x42e5('0x40')],'as':_0x42e5('0x41')}]})[_0x42e5('0x38')](handleEntityNotFound(_0x513b80,null))['then'](saveUpdates(_0x9b93a9[_0x42e5('0x60')],null))['then'](respondWithResult(_0x513b80,null))[_0x42e5('0x2d')](handleError(_0x513b80,null));};exports[_0x42e5('0x39')]=function(_0x1f1d6e,_0x474095){return db[_0x42e5('0x42')][_0x42e5('0x64')]({'where':{'id':_0x1f1d6e[_0x42e5('0x5d')]['id']}})['then'](handleEntityNotFound(_0x474095,null))[_0x42e5('0x38')](removeEntity(_0x474095,null))[_0x42e5('0x2d')](handleError(_0x474095,null));};exports[_0x42e5('0x69')]=function(_0x93c05d,_0x21a8aa){return db[_0x42e5('0x42')][_0x42e5('0x69')]()[_0x42e5('0x38')](respondWithResult(_0x21a8aa,null))[_0x42e5('0x2d')](handleError(_0x21a8aa,null));};exports['addDisposition']=function(_0x1cf8e4,_0x30d2b5,_0x2af01f){if(_0x1cf8e4[_0x42e5('0x60')]['id']){delete _0x1cf8e4['body']['id'];}return db[_0x42e5('0x42')][_0x42e5('0x64')]({'where':{'id':_0x1cf8e4[_0x42e5('0x5d')]['id']}})[_0x42e5('0x38')](handleEntityNotFound(_0x30d2b5,null))['then'](function(_0x5cbc4c){if(_0x5cbc4c){_0x1cf8e4['body'][_0x42e5('0x6a')]=_0x5cbc4c['id'];return db[_0x42e5('0x6b')][_0x42e5('0x5f')](_0x1cf8e4[_0x42e5('0x60')]);}})[_0x42e5('0x38')](respondWithResult(_0x30d2b5,null))[_0x42e5('0x2d')](handleError(_0x30d2b5,null));};exports[_0x42e5('0x6c')]=function(_0x3cc383,_0x2a28ce,_0x5d1c15){var _0x1d0660={'raw':![],'where':{}};var _0x43e7d0={};var _0xdd32a0={'count':0x0,'rows':[]};return db[_0x42e5('0x42')][_0x42e5('0x6d')]({'where':{'id':_0x3cc383[_0x42e5('0x5d')]['id']}})[_0x42e5('0x38')](handleEntityNotFound(_0x2a28ce,null))[_0x42e5('0x38')](function(_0x4d5357){if(_0x4d5357){_0x43e7d0['model']=_[_0x42e5('0x47')](db[_0x42e5('0x6b')]['rawAttributes']);_0x43e7d0['query']=_['keys'](_0x3cc383[_0x42e5('0x46')]);_0x43e7d0[_0x42e5('0x48')]=_['intersection'](_0x43e7d0[_0x42e5('0x4b')],_0x43e7d0[_0x42e5('0x46')]);_0x1d0660['attributes']=_[_0x42e5('0x49')](_0x43e7d0[_0x42e5('0x4b')],qs['fields'](_0x3cc383[_0x42e5('0x46')]['fields']));_0x1d0660['attributes']=_0x1d0660['attributes']['length']?_0x1d0660[_0x42e5('0x4a')]:_0x43e7d0[_0x42e5('0x4b')];if(!_0x3cc383['query'][_0x42e5('0x4e')](_0x42e5('0x4f'))){_0x1d0660[_0x42e5('0x50')]=qs[_0x42e5('0x50')](_0x3cc383[_0x42e5('0x46')][_0x42e5('0x50')]);_0x1d0660['offset']=qs[_0x42e5('0x33')](_0x3cc383[_0x42e5('0x46')]['offset']);}_0x1d0660['order']=qs[_0x42e5('0x52')](_0x3cc383[_0x42e5('0x46')][_0x42e5('0x52')]);_0x1d0660[_0x42e5('0x55')]=qs[_0x42e5('0x48')](_[_0x42e5('0x53')](_0x3cc383[_0x42e5('0x46')],_0x43e7d0['filters']));_0x1d0660['where']['WhatsappAccountId']=_0x4d5357['id'];if(_0x3cc383['query'][_0x42e5('0x54')]){_0x1d0660[_0x42e5('0x55')]=_['merge'](_0x1d0660[_0x42e5('0x55')],{'$or':_['map'](_0x1d0660[_0x42e5('0x4a')],function(_0x2982a2){var _0x3493d4={};_0x3493d4[_0x2982a2]={'$like':'%'+_0x3cc383[_0x42e5('0x46')][_0x42e5('0x54')]+'%'};return _0x3493d4;})});}_0x1d0660=_[_0x42e5('0x56')]({},_0x1d0660,_0x3cc383[_0x42e5('0x59')]);return db[_0x42e5('0x6b')][_0x42e5('0x32')]({'where':_0x1d0660[_0x42e5('0x55')]})[_0x42e5('0x38')](function(_0x78573b){_0xdd32a0[_0x42e5('0x32')]=_0x78573b;if(_0x3cc383[_0x42e5('0x46')][_0x42e5('0x5e')]){_0x1d0660[_0x42e5('0x5a')]=[{'all':!![]}];}return db[_0x42e5('0x6b')][_0x42e5('0x5b')](_0x1d0660);})['then'](function(_0x42b60b){_0xdd32a0[_0x42e5('0x6e')]=_0x42b60b;return _0xdd32a0;});}})[_0x42e5('0x38')](respondWithFilteredResult(_0x2a28ce,_0x1d0660))[_0x42e5('0x2d')](handleError(_0x2a28ce,null));};exports[_0x42e5('0x6f')]=function(_0x161874,_0x437589,_0x103338){return db['WhatsappAccount'][_0x42e5('0x64')]({'where':{'id':_0x161874[_0x42e5('0x5d')]['id']}})[_0x42e5('0x38')](handleEntityNotFound(_0x437589,null))[_0x42e5('0x38')](function(_0xb0d649){if(_0xb0d649){return _0xb0d649['removeDispositions'](_0x161874['query'][_0x42e5('0x70')]);}})[_0x42e5('0x38')](respondWithStatusCode(_0x437589,null))[_0x42e5('0x2d')](handleError(_0x437589,null));};exports[_0x42e5('0x71')]=function(_0x1cf03d,_0x2ff615,_0x2f0556){if(_0x1cf03d[_0x42e5('0x60')]['id']){delete _0x1cf03d[_0x42e5('0x60')]['id'];}return db['WhatsappAccount'][_0x42e5('0x64')]({'where':{'id':_0x1cf03d[_0x42e5('0x5d')]['id']}})['then'](handleEntityNotFound(_0x2ff615,null))[_0x42e5('0x38')](function(_0x44d9ff){if(_0x44d9ff){_0x1cf03d[_0x42e5('0x60')][_0x42e5('0x6a')]=_0x44d9ff['id'];return db['CannedAnswer']['create'](_0x1cf03d['body']);}})[_0x42e5('0x38')](respondWithResult(_0x2ff615,null))[_0x42e5('0x2d')](handleError(_0x2ff615,null));};exports[_0x42e5('0x72')]=function(_0x32f5d5,_0x66a72,_0x1f1843){var _0x259b83={'raw':![],'where':{}};var _0x5713b9={};var _0x321188={'count':0x0,'rows':[]};return db[_0x42e5('0x42')][_0x42e5('0x6d')]({'where':{'id':_0x32f5d5['params']['id']}})[_0x42e5('0x38')](handleEntityNotFound(_0x66a72,null))['then'](function(_0x561a99){if(_0x561a99){_0x5713b9[_0x42e5('0x4b')]=_[_0x42e5('0x47')](db[_0x42e5('0x73')]['rawAttributes']);_0x5713b9['query']=_[_0x42e5('0x47')](_0x32f5d5['query']);_0x5713b9['filters']=_[_0x42e5('0x49')](_0x5713b9[_0x42e5('0x4b')],_0x5713b9['query']);_0x259b83[_0x42e5('0x4a')]=_[_0x42e5('0x49')](_0x5713b9[_0x42e5('0x4b')],qs[_0x42e5('0x4c')](_0x32f5d5[_0x42e5('0x46')][_0x42e5('0x4c')]));_0x259b83['attributes']=_0x259b83[_0x42e5('0x4a')][_0x42e5('0x4d')]?_0x259b83[_0x42e5('0x4a')]:_0x5713b9['model'];if(!_0x32f5d5[_0x42e5('0x46')][_0x42e5('0x4e')]('nolimit')){_0x259b83[_0x42e5('0x50')]=qs[_0x42e5('0x50')](_0x32f5d5[_0x42e5('0x46')]['limit']);_0x259b83[_0x42e5('0x33')]=qs[_0x42e5('0x33')](_0x32f5d5['query']['offset']);}_0x259b83[_0x42e5('0x51')]=qs['sort'](_0x32f5d5[_0x42e5('0x46')][_0x42e5('0x52')]);_0x259b83[_0x42e5('0x55')]=qs[_0x42e5('0x48')](_[_0x42e5('0x53')](_0x32f5d5['query'],_0x5713b9[_0x42e5('0x48')]));_0x259b83[_0x42e5('0x55')][_0x42e5('0x6a')]=_0x561a99['id'];if(_0x32f5d5['query'][_0x42e5('0x54')]){_0x259b83[_0x42e5('0x55')]=_[_0x42e5('0x56')](_0x259b83[_0x42e5('0x55')],{'$or':_['map'](_0x259b83[_0x42e5('0x4a')],function(_0x543bba){var _0x5721a9={};_0x5721a9[_0x543bba]={'$like':'%'+_0x32f5d5[_0x42e5('0x46')][_0x42e5('0x54')]+'%'};return _0x5721a9;})});}_0x259b83=_[_0x42e5('0x56')]({},_0x259b83,_0x32f5d5[_0x42e5('0x59')]);return db[_0x42e5('0x73')]['count']({'where':_0x259b83[_0x42e5('0x55')]})[_0x42e5('0x38')](function(_0x3be24d){_0x321188[_0x42e5('0x32')]=_0x3be24d;if(_0x32f5d5[_0x42e5('0x46')][_0x42e5('0x5e')]){_0x259b83[_0x42e5('0x5a')]=[{'all':!![]}];}return db[_0x42e5('0x73')][_0x42e5('0x5b')](_0x259b83);})['then'](function(_0xf7b3d3){_0x321188[_0x42e5('0x6e')]=_0xf7b3d3;return _0x321188;});}})[_0x42e5('0x38')](respondWithFilteredResult(_0x66a72,_0x259b83))[_0x42e5('0x2d')](handleError(_0x66a72,null));};exports[_0x42e5('0x74')]=function(_0x42c6d5,_0x39c46,_0x432105){return db[_0x42e5('0x42')][_0x42e5('0x64')]({'where':{'id':_0x42c6d5['params']['id']}})['then'](handleEntityNotFound(_0x39c46,null))['then'](function(_0x5cbf7){if(_0x5cbf7){return _0x5cbf7[_0x42e5('0x74')](_0x42c6d5['query'][_0x42e5('0x70')]);}})['then'](respondWithStatusCode(_0x39c46,null))[_0x42e5('0x2d')](handleError(_0x39c46,null));};exports['addAgents']=function(_0x4e335c,_0x4a5920,_0x275d80){return db[_0x42e5('0x42')][_0x42e5('0x64')]({'where':{'id':_0x4e335c[_0x42e5('0x5d')]['id']}})[_0x42e5('0x38')](handleEntityNotFound(_0x4a5920,null))['then'](function(_0x4b5500){if(_0x4b5500){return _0x4b5500[_0x42e5('0x75')](_0x4e335c[_0x42e5('0x60')][_0x42e5('0x70')],_[_0x42e5('0x76')](_0x4e335c[_0x42e5('0x60')],['ids','id'])||{})[_0x42e5('0x77')](function(_0x3d3b01){for(var _0x3ec86e=0x0;_0x3ec86e<_0x4e335c['body']['ids']['length'];_0x3ec86e+=0x1){socket[_0x42e5('0x78')]('userWhatsappAccount:save',{'UserId':_0x4e335c[_0x42e5('0x60')][_0x42e5('0x70')][_0x3ec86e],'WhatsappAccountId':_0x4e335c['params']['id']});}return _0x3d3b01;});}})[_0x42e5('0x38')](respondWithResult(_0x4a5920,null))[_0x42e5('0x2d')](handleError(_0x4a5920,null));};exports[_0x42e5('0x79')]=function(_0x5773c6,_0x106257,_0xa1efc){return db[_0x42e5('0x42')][_0x42e5('0x64')]({'where':{'id':_0x5773c6[_0x42e5('0x5d')]['id']}})['then'](handleEntityNotFound(_0x106257,null))[_0x42e5('0x38')](function(_0x190029){if(_0x190029){return _0x190029[_0x42e5('0x79')](_0x5773c6[_0x42e5('0x46')][_0x42e5('0x70')])['then'](function(){if(_[_0x42e5('0x7a')](_0x5773c6[_0x42e5('0x46')]['ids'])){for(var _0x2cf42b=0x0;_0x2cf42b<_0x5773c6[_0x42e5('0x46')][_0x42e5('0x70')][_0x42e5('0x4d')];_0x2cf42b+=0x1){socket[_0x42e5('0x78')](_0x42e5('0x7b'),{'UserId':Number(_0x5773c6[_0x42e5('0x46')][_0x42e5('0x70')][_0x2cf42b]),'WhatsappAccountId':Number(_0x5773c6['params']['id'])});}}else{socket[_0x42e5('0x78')](_0x42e5('0x7b'),{'UserId':Number(_0x5773c6[_0x42e5('0x46')][_0x42e5('0x70')]),'WhatsappAccountId':Number(_0x5773c6[_0x42e5('0x5d')]['id'])});}});}})['then'](respondWithStatusCode(_0x106257,null))[_0x42e5('0x2d')](handleError(_0x106257,null));};exports[_0x42e5('0x7c')]=function(_0x2e252a,_0x18bd47,_0x5190b0){var _0x444033={};var _0x2030a5={};var _0x1f74a3;var _0x2e54f5;return db[_0x42e5('0x42')][_0x42e5('0x6d')]({'where':{'id':_0x2e252a[_0x42e5('0x5d')]['id']}})[_0x42e5('0x38')](handleEntityNotFound(_0x18bd47,null))[_0x42e5('0x38')](function(_0x36cdac){if(_0x36cdac){_0x1f74a3=_0x36cdac;_0x2030a5['model']=_[_0x42e5('0x47')](db['User'][_0x42e5('0x43')]);_0x2030a5['query']=_['keys'](_0x2e252a[_0x42e5('0x46')]);_0x2030a5[_0x42e5('0x48')]=_[_0x42e5('0x49')](_0x2030a5[_0x42e5('0x4b')],_0x2030a5[_0x42e5('0x46')]);_0x444033[_0x42e5('0x4a')]=_[_0x42e5('0x49')](_0x2030a5[_0x42e5('0x4b')],qs[_0x42e5('0x4c')](_0x2e252a[_0x42e5('0x46')][_0x42e5('0x4c')]));_0x444033[_0x42e5('0x4a')]=_0x444033[_0x42e5('0x4a')][_0x42e5('0x4d')]?_0x444033['attributes']:_0x2030a5[_0x42e5('0x4b')];_0x444033[_0x42e5('0x51')]=qs[_0x42e5('0x52')](_0x2e252a['query'][_0x42e5('0x52')]);_0x444033['where']=qs['filters'](_[_0x42e5('0x53')](_0x2e252a[_0x42e5('0x46')],_0x2030a5['filters']));if(_0x2e252a[_0x42e5('0x46')][_0x42e5('0x54')]){_0x444033[_0x42e5('0x55')]=_['merge'](_0x444033[_0x42e5('0x55')],{'$or':_[_0x42e5('0x45')](_0x444033[_0x42e5('0x4a')],function(_0x5a7744){var _0x1f173f={};_0x1f173f[_0x5a7744]={'$like':'%'+_0x2e252a[_0x42e5('0x46')]['filter']+'%'};return _0x1f173f;})});}_0x444033=_[_0x42e5('0x56')]({},_0x444033,_0x2e252a[_0x42e5('0x59')]);return _0x1f74a3[_0x42e5('0x7c')](_0x444033);}})['then'](function(_0x22f0a8){if(_0x22f0a8){_0x2e54f5=_0x22f0a8[_0x42e5('0x4d')];if(!_0x2e252a['query'][_0x42e5('0x4e')]('nolimit')){_0x444033[_0x42e5('0x50')]=qs[_0x42e5('0x50')](_0x2e252a['query'][_0x42e5('0x50')]);_0x444033[_0x42e5('0x33')]=qs[_0x42e5('0x33')](_0x2e252a[_0x42e5('0x46')][_0x42e5('0x33')]);}return _0x1f74a3[_0x42e5('0x7c')](_0x444033);}})[_0x42e5('0x38')](function(_0xdb1042){if(_0xdb1042){return _0xdb1042?{'count':_0x2e54f5,'rows':_0xdb1042}:null;}})[_0x42e5('0x38')](respondWithResult(_0x18bd47,null))[_0x42e5('0x2d')](handleError(_0x18bd47,null));};exports[_0x42e5('0x7d')]=function(_0x44daee,_0x1d99b2,_0x5d519b){return db['WhatsappAccount'][_0x42e5('0x6d')]({'where':{'id':_0x44daee[_0x42e5('0x5d')]['id']}})[_0x42e5('0x38')](handleEntityNotFound(_0x1d99b2,null))[_0x42e5('0x38')](function(_0x140f2f){if(_0x140f2f){return db[_0x42e5('0x7e')][_0x42e5('0x7f')](function(_0x4e5fc3){return db[_0x42e5('0x80')][_0x42e5('0x39')]({'where':{'WhatsappAccountId':_0x44daee[_0x42e5('0x5d')]['id']},'transaction':_0x4e5fc3})[_0x42e5('0x38')](function(_0x3e56b1){var _0x3df3d9=_['map'](_0x44daee[_0x42e5('0x60')],function(_0x2f6e12){_0x2f6e12['WhatsappAccountId']=_0x44daee[_0x42e5('0x5d')]['id'];return _0x2f6e12;});return db[_0x42e5('0x80')][_0x42e5('0x81')](_0x3df3d9,{'transaction':_0x4e5fc3});});})['then'](function(){return db[_0x42e5('0x80')]['findAndCountAll']({'where':{'WhatsappAccountId':_0x44daee[_0x42e5('0x5d')]['id']},'order':_0x42e5('0x82')});});}})[_0x42e5('0x38')](respondWithResult(_0x1d99b2,null))['catch'](handleError(_0x1d99b2,null));};exports[_0x42e5('0x83')]=function(_0x39ef97,_0xe61208,_0x23efc9){var _0x47770d={};var _0x187013={};var _0x35f5f2;var _0x4db653;return db[_0x42e5('0x42')][_0x42e5('0x6d')]({'where':{'id':_0x39ef97[_0x42e5('0x5d')]['id']}})[_0x42e5('0x38')](handleEntityNotFound(_0xe61208,null))[_0x42e5('0x38')](function(_0x584da4){if(_0x584da4){_0x35f5f2=_0x584da4;_0x187013[_0x42e5('0x4b')]=_[_0x42e5('0x47')](db[_0x42e5('0x80')]['rawAttributes']);_0x187013['query']=_[_0x42e5('0x47')](_0x39ef97['query']);_0x187013[_0x42e5('0x48')]=_['intersection'](_0x187013[_0x42e5('0x4b')],_0x187013['query']);_0x47770d['attributes']=_[_0x42e5('0x49')](_0x187013[_0x42e5('0x4b')],qs[_0x42e5('0x4c')](_0x39ef97['query'][_0x42e5('0x4c')]));_0x47770d[_0x42e5('0x4a')]=_0x47770d[_0x42e5('0x4a')]['length']?_0x47770d[_0x42e5('0x4a')]:_0x187013[_0x42e5('0x4b')];_0x47770d[_0x42e5('0x51')]=qs[_0x42e5('0x52')](_0x39ef97['query']['sort']);_0x47770d[_0x42e5('0x55')]=qs[_0x42e5('0x48')](_[_0x42e5('0x53')](_0x39ef97[_0x42e5('0x46')],_0x187013[_0x42e5('0x48')]));if(_0x39ef97[_0x42e5('0x46')]['filter']){_0x47770d[_0x42e5('0x55')]=_[_0x42e5('0x56')](_0x47770d[_0x42e5('0x55')],{'$or':_['map'](_0x47770d[_0x42e5('0x4a')],function(_0x238633){var _0x268064={};_0x268064[_0x238633]={'$like':'%'+_0x39ef97[_0x42e5('0x46')][_0x42e5('0x54')]+'%'};return _0x268064;})});}_0x47770d=_[_0x42e5('0x56')]({},_0x47770d,_0x39ef97[_0x42e5('0x59')]);return _0x35f5f2[_0x42e5('0x83')](_0x47770d);}})['then'](function(_0x5de903){if(_0x5de903){_0x4db653=_0x5de903['length'];if(!_0x39ef97[_0x42e5('0x46')][_0x42e5('0x4e')](_0x42e5('0x4f'))){_0x47770d['limit']=qs[_0x42e5('0x50')](_0x39ef97[_0x42e5('0x46')]['limit']);_0x47770d[_0x42e5('0x33')]=qs['offset'](_0x39ef97['query'][_0x42e5('0x33')]);}return _0x35f5f2[_0x42e5('0x83')](_0x47770d);}})['then'](function(_0x5d510c){if(_0x5d510c){return _0x5d510c?{'count':_0x4db653,'rows':_0x5d510c}:null;}})[_0x42e5('0x38')](respondWithResult(_0xe61208,null))[_0x42e5('0x2d')](handleError(_0xe61208,null));};exports[_0x42e5('0x84')]=function(_0xfca9e7,_0x22addd,_0x34b0f1){var _0x591e1f={'channel':_0x42e5('0x85')};var _0x49ba4d=[];var _0x5621c4=[];var _0x347698={};return db[_0x42e5('0x42')]['find']({'where':{'id':_0xfca9e7['params']['id']},'include':[{'model':db['WhatsappApplication'],'as':'Applications'}]})['then'](handleEntityNotFound(_0x22addd,null))[_0x42e5('0x38')](function(_0x140fe3){_0x591e1f['account']=_0x140fe3;_0x591e1f['applications']=_['orderBy'](_0x140fe3[_0x42e5('0x86')],[_0x42e5('0x82')],[_0x42e5('0x87')]);if(_0x591e1f[_0x42e5('0x88')]['Applications']){delete _0x591e1f[_0x42e5('0x88')]['Applications'];}return db[_0x42e5('0x89')][_0x42e5('0x69')]();})[_0x42e5('0x38')](function(_0x12b4ea){if(!_0x12b4ea){throw new db[(_0x42e5('0x20'))][(_0x42e5('0x21'))](_0x42e5('0x8a'));}_0x49ba4d=_[_0x42e5('0x8b')](_[_0x42e5('0x47')](_0x12b4ea),[_0x42e5('0x8c'),'updatedAt']);_0x5621c4=_[_0x42e5('0x8b')](_[_0x42e5('0x47')](_0x12b4ea),[_0x42e5('0x8c'),_0x42e5('0x8d'),_0x42e5('0x8e'),_0x42e5('0x8f')]);_0x591e1f[_0x42e5('0x60')]={'mapKey':_0x42e5('0x90')};if(_0x591e1f['account'][_0x42e5('0x57')]&&_0x591e1f[_0x42e5('0x88')][_0x42e5('0x57')]===_0x42e5('0x91')){_0x591e1f['body'][_0x42e5('0x92')]=_0xfca9e7[_0x42e5('0x60')][_0x42e5('0x93')][_0x42e5('0x94')](_0x42e5('0x95'),'');_0x591e1f[_0x42e5('0x60')]['body']=_0xfca9e7['body'][_0x42e5('0x96')];_0x591e1f[_0x42e5('0x60')]['messageId']=_0xfca9e7[_0x42e5('0x60')][_0x42e5('0x97')];}if(_0x591e1f[_0x42e5('0x60')]['id']){delete _0x591e1f[_0x42e5('0x60')]['id'];}if(_[_0x42e5('0x98')](_0x591e1f['body'][_0x42e5('0x92')])){throw new db['Sequelize'][(_0x42e5('0x21'))](_0x42e5('0x99'));}if(_[_0x42e5('0x98')](_0x591e1f[_0x42e5('0x60')][_0x42e5('0x60')])||_0x591e1f[_0x42e5('0x60')][_0x42e5('0x60')]===''){throw new db[(_0x42e5('0x20'))][(_0x42e5('0x21'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_['isNil'](_0x591e1f['body']['mapKey'])){throw new db['Sequelize']['ValidationError'](_0x42e5('0x9a')+_0x5621c4);}if(!_[_0x42e5('0x9b')](_0x5621c4,_0x591e1f[_0x42e5('0x60')]['mapKey'])){throw new db['Sequelize'][(_0x42e5('0x21'))]('mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x5621c4);}_0x347698[_0x591e1f[_0x42e5('0x60')][_0x42e5('0x9c')]]=_0x591e1f[_0x42e5('0x60')][_0x42e5('0x92')];return db[_0x42e5('0x9d')][_0x42e5('0x64')]({'where':{'id':_0x591e1f[_0x42e5('0x88')][_0x42e5('0x8f')]},'include':[{'model':db[_0x42e5('0x89')],'as':_0x42e5('0x9e'),'where':_0x347698,'limit':0x1,'order':[['updatedAt',_0x42e5('0x9f')]]}]});})[_0x42e5('0x38')](handleEntityNotFound(_0x22addd,null))[_0x42e5('0x38')](function(_0x35798b){if(_0x35798b){_0x591e1f[_0x42e5('0xa0')]=_[_0x42e5('0x76')](_0x35798b,[_0x42e5('0x9e')]);if(_0x35798b[_0x42e5('0x9e')]['length']){return _0x35798b['Contacts'][0x0];}var _0x15abfa=_[_0x42e5('0x18')](_0x591e1f['body'],{'firstName':_0x591e1f['body'][_0x42e5('0x92')],'ListId':_0x35798b['id']});_0x15abfa[_0x591e1f[_0x42e5('0x60')][_0x42e5('0x9c')]]=_0x591e1f[_0x42e5('0x60')][_0x42e5('0x92')];return db['CmContact']['create'](_0x15abfa,{'fields':_0x49ba4d,'raw':!![]});}})[_0x42e5('0x38')](handleEntityNotFound(_0x22addd,null))['then'](function(_0x28fab1){if(_0x28fab1){_0x591e1f[_0x42e5('0xa1')]=_0x28fab1;var _0xbaa50a={'ContactId':_0x28fab1['id'],'phone':_0x591e1f['body']['from'],'WhatsappAccountId':_0xfca9e7['params']['id']};var _0x234213={'ContactId':_0x28fab1['id'],'WhatsappAccountId':_0xfca9e7[_0x42e5('0x5d')]['id'],'closed':![]};return db[_0x42e5('0xa2')][_0x42e5('0x64')]({'where':_0x234213})[_0x42e5('0x38')](function(_0x125f20){if(_0x125f20){return[_0x125f20,![]];}return db['WhatsappInteraction'][_0x42e5('0x5f')](_0xbaa50a)[_0x42e5('0x38')](function(_0x3ff915){return[_0x3ff915,!![]];});});}})[_0x42e5('0x77')](function(_0x38b18c,_0x61eba){_0x591e1f[_0x42e5('0xa3')]=_0x38b18c[_0x42e5('0x3a')]({'plain':!![]});_0x591e1f[_0x42e5('0xa3')][_0x42e5('0xa4')]=![];if(_0x61eba){if(_0x591e1f[_0x42e5('0x88')][_0x42e5('0xa5')]){_0x591e1f[_0x42e5('0xa6')][_0x42e5('0xa7')]({'id':0x0,'priority':_0x591e1f['applications'][_0x42e5('0x4d')]+0x1,'app':_0x42e5('0xa8'),'appdata':'unmanaged','interval':'*,*,*,*'});}_0x591e1f[_0x42e5('0xa3')][_0x42e5('0xa4')]=!![];}return db[_0x42e5('0xa9')][_0x42e5('0x5f')]({'phone':_0x591e1f[_0x42e5('0x60')][_0x42e5('0x92')],'messageId':_0x591e1f['body']['messageId'],'body':_0x591e1f['body'][_0x42e5('0x60')],'WhatsappAccountId':_0xfca9e7[_0x42e5('0x5d')]['id'],'WhatsappInteractionId':_0x38b18c['id'],'direction':'in','ContactId':_0x38b18c['ContactId'],'AttachmentId':_0x591e1f['body']['AttachmentId']});})[_0x42e5('0x38')](function(_0x23551d){_0x591e1f[_0x42e5('0x2c')]=_0x23551d;if(_0x591e1f[_0x42e5('0xa3')][_0x42e5('0xaa')]){return db[_0x42e5('0xab')]['find']({'attributes':['id',_0x42e5('0x3e')],'where':{'id':_0x591e1f[_0x42e5('0xa3')][_0x42e5('0xaa')]}})[_0x42e5('0x38')](function(_0xc1a11){if(_0xc1a11){_0x591e1f['applications'][_0x42e5('0xac')]({'id':0x0,'priority':0x0,'app':_0x42e5('0xad'),'appdata':_0xc1a11[_0x42e5('0x3e')]+','+(_0x591e1f[_0x42e5('0x88')][_0x42e5('0xae')]||0xa),'interval':_0x42e5('0xaf')});}return respondWithRpcPromise(_0x42e5('0xb0'),'startRouting',_0x591e1f);});}return respondWithRpcPromise(_0x42e5('0xb0'),_0x42e5('0xb1'),_0x591e1f);})[_0x42e5('0x38')](function(_0x52ac9b){if(_0x52ac9b){var _0x4dc094=0xc8;var _0x2e96d7=_0x42e5('0xb2');logger[_0x42e5('0x24')](_0x42e5('0x27'),_0x2e96d7,_0x4dc094,_0x42e5('0xb3'));logger[_0x42e5('0x26')]('WhatsappAccount,\x20%s,\x20%s,\x20%s,\x20%s',_0x2e96d7,_0x4dc094,'entity\x20found',JSON[_0x42e5('0x29')](_0x52ac9b));if(_0x591e1f[_0x42e5('0x88')][_0x42e5('0x57')]==='twilio'){return _0x22addd[_0x42e5('0x2f')](_0x4dc094)[_0x42e5('0x34')](_0x42e5('0xb4'),_0x42e5('0xb5'))['send'](_0x42e5('0xb6'));}else{return _0x22addd[_0x42e5('0x2f')](_0x4dc094)['json'](_0x52ac9b);}}})[_0x42e5('0x2d')](handleError(_0x22addd,null));};exports[_0x42e5('0xb7')]=function(_0x112a57,_0x128122,_0x36bf71){var _0x17b370,_0x3ba5e7,_0x12f4ae;if(_[_0x42e5('0x98')](_0x112a57['body'][_0x42e5('0x60')])||_0x112a57[_0x42e5('0x60')]['body']===''){throw new db[(_0x42e5('0x20'))][(_0x42e5('0x21'))](_0x42e5('0xb8'));}if(_[_0x42e5('0x98')](_0x112a57[_0x42e5('0x60')]['to'])){throw new db[(_0x42e5('0x20'))]['ValidationError']('to\x20is\x20mandatory');}_0x17b370=_0x112a57[_0x42e5('0x60')]['to'];return db[_0x42e5('0x42')]['find']({'where':{'id':_0x112a57['params']['id']},'include':[{'model':db[_0x42e5('0x9d')],'as':_0x42e5('0xb9'),'include':[{'model':db[_0x42e5('0x89')],'as':_0x42e5('0x9e'),'where':{'mobile':_0x17b370},'limit':0x1,'order':[['updatedAt',_0x42e5('0x9f')]]}]}]})['then'](handleEntityNotFound(_0x128122,null))[_0x42e5('0x38')](function(_0x29de97){if(_0x29de97&&_0x29de97[_0x42e5('0xb9')]){_0x3ba5e7=_0x29de97[_0x42e5('0x3a')]({'plain':!![]});if(_0x3ba5e7[_0x42e5('0xb9')]&&_0x3ba5e7[_0x42e5('0xb9')]['Contacts'][_0x42e5('0x4d')]){return _0x3ba5e7[_0x42e5('0xb9')][_0x42e5('0x9e')][0x0];}return db[_0x42e5('0x89')][_0x42e5('0x5f')](_[_0x42e5('0x18')](_0x112a57[_0x42e5('0x60')],{'firstName':_0x17b370,'mobile':_0x17b370,'phone':_0x17b370,'ListId':_0x3ba5e7[_0x42e5('0x8f')]}));}})[_0x42e5('0x38')](handleEntityNotFound(_0x128122,null))[_0x42e5('0x38')](function(_0x1b2e09){if(_0x1b2e09){_0x12f4ae=_0x1b2e09;return db[_0x42e5('0xa2')][_0x42e5('0x64')]({'where':{'ContactId':_0x12f4ae['id'],'closed':![],'WhatsappAccountId':_0x3ba5e7['id']}})[_0x42e5('0x38')](function(_0x201947){if(_0x201947){return[_0x201947,![]];}return db[_0x42e5('0xa2')][_0x42e5('0x5f')]({'UserId':_0x112a57[_0x42e5('0x61')]['id'],'ContactId':_0x12f4ae['id'],'WhatsappAccountId':_0x3ba5e7['id'],'phone':_0x17b370,'firstMsgDirection':'out','Messages':[_[_0x42e5('0x56')](_0x112a57[_0x42e5('0x60')],{'read':![],'body':_0x112a57[_0x42e5('0x60')]['body'],'phone':_0x17b370,'WhatsappAccountId':_0x3ba5e7['id'],'UserId':_0x112a57[_0x42e5('0x61')]['id'],'ContactId':_0x12f4ae['id']})]},{'include':[{'model':db[_0x42e5('0xa9')],'as':_0x42e5('0xba')}]})[_0x42e5('0x38')](function(_0x5d6771){return[_0x5d6771,!![]];});});}})[_0x42e5('0x77')](function(_0x23da35,_0x116b83){if(_0x116b83){return _0x23da35;}return db[_0x42e5('0xa9')][_0x42e5('0x5f')](_['merge'](_0x112a57[_0x42e5('0x60')],{'read':![],'body':_0x112a57[_0x42e5('0x60')][_0x42e5('0x60')],'phone':_0x17b370,'WhatsappAccountId':_0x3ba5e7['id'],'WhatsappInteractionId':_0x23da35['id'],'UserId':_0x112a57[_0x42e5('0x61')]['id'],'ContactId':_0x12f4ae['id']}))['then'](function(_0x3e2c29){_0x23da35[_0x42e5('0xbb')][_0x42e5('0xba')]=[];_0x23da35[_0x42e5('0xbb')][_0x42e5('0xba')][_0x42e5('0xa7')](_0x3e2c29[_0x42e5('0xbb')]);return _0x23da35;});})[_0x42e5('0x38')](respondWithResult(_0x128122,null))['catch'](handleError(_0x128122,null));}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.events.js b/server/api/whatsappAccount/whatsappAccount.events.js index f6f1744..53e2f2b 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 _0x39e6=['update','remove','emit','hasOwnProperty','hook','exports','events','WhatsappAccount'];(function(_0x2c8c80,_0x20b19a){var _0xc8f3e4=function(_0x4afa4b){while(--_0x4afa4b){_0x2c8c80['push'](_0x2c8c80['shift']());}};_0xc8f3e4(++_0x20b19a);}(_0x39e6,0x9e));var _0x639e=function(_0x248e7c,_0x750e08){_0x248e7c=_0x248e7c-0x0;var _0x1af0d7=_0x39e6[_0x248e7c];return _0x1af0d7;};'use strict';var EventEmitter=require(_0x639e('0x0'));var WhatsappAccount=require('../../mysqldb')['db'][_0x639e('0x1')];var WhatsappAccountEvents=new EventEmitter();WhatsappAccountEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0x639e('0x2'),'afterDestroy':_0x639e('0x3')};function emitEvent(_0x529394){return function(_0x467229,_0x207d6a,_0x199e72){WhatsappAccountEvents[_0x639e('0x4')](_0x529394+':'+_0x467229['id'],_0x467229);WhatsappAccountEvents[_0x639e('0x4')](_0x529394,_0x467229);_0x199e72(null);};}for(var e in events){if(events[_0x639e('0x5')](e)){var event=events[e];WhatsappAccount[_0x639e('0x6')](e,emitEvent(event));}}module[_0x639e('0x7')]=WhatsappAccountEvents; \ No newline at end of file +var _0x4137=['update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','WhatsappAccount','setMaxListeners','save'];(function(_0x2134b7,_0x1eb5e2){var _0x6c5914=function(_0x1da201){while(--_0x1da201){_0x2134b7['push'](_0x2134b7['shift']());}};_0x6c5914(++_0x1eb5e2);}(_0x4137,0xf8));var _0x7413=function(_0x46e363,_0x45d7e2){_0x46e363=_0x46e363-0x0;var _0x3fb059=_0x4137[_0x46e363];return _0x3fb059;};'use strict';var EventEmitter=require(_0x7413('0x0'));var WhatsappAccount=require(_0x7413('0x1'))['db'][_0x7413('0x2')];var WhatsappAccountEvents=new EventEmitter();WhatsappAccountEvents[_0x7413('0x3')](0x0);var events={'afterCreate':_0x7413('0x4'),'afterUpdate':_0x7413('0x5'),'afterDestroy':_0x7413('0x6')};function emitEvent(_0x299eea){return function(_0x258255,_0x3dc48a,_0x451a96){WhatsappAccountEvents[_0x7413('0x7')](_0x299eea+':'+_0x258255['id'],_0x258255);WhatsappAccountEvents['emit'](_0x299eea,_0x258255);_0x451a96(null);};}for(var e in events){if(events[_0x7413('0x8')](e)){var event=events[e];WhatsappAccount[_0x7413('0x9')](e,emitEvent(event));}}module[_0x7413('0xa')]=WhatsappAccountEvents; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.model.js b/server/api/whatsappAccount/whatsappAccount.model.js index f36f025..be1ebea 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 _0xe340=['lodash','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./whatsappAccount.attributes','exports','define','WhatsappAccount','whatsapp_accounts'];(function(_0x50a0c2,_0x4befab){var _0x5ebadd=function(_0x3a3342){while(--_0x3a3342){_0x50a0c2['push'](_0x50a0c2['shift']());}};_0x5ebadd(++_0x4befab);}(_0xe340,0x145));var _0x0e34=function(_0x1caf6a,_0x26a5bf){_0x1caf6a=_0x1caf6a-0x0;var _0x1bf493=_0xe340[_0x1caf6a];return _0x1bf493;};'use strict';var _=require(_0x0e34('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x0e34('0x1'));var moment=require(_0x0e34('0x2'));var BPromise=require(_0x0e34('0x3'));var rp=require(_0x0e34('0x4'));var fs=require('fs');var path=require(_0x0e34('0x5'));var rimraf=require(_0x0e34('0x6'));var config=require(_0x0e34('0x7'));var attributes=require(_0x0e34('0x8'));module[_0x0e34('0x9')]=function(_0x562f70,_0x40b22b){return _0x562f70[_0x0e34('0xa')](_0x0e34('0xb'),attributes,{'tableName':_0x0e34('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x308f=['bluebird','request-promise','path','rimraf','./whatsappAccount.attributes','exports','define','whatsapp_accounts','lodash'];(function(_0x21b820,_0x537133){var _0x2bacfc=function(_0x299b91){while(--_0x299b91){_0x21b820['push'](_0x21b820['shift']());}};_0x2bacfc(++_0x537133);}(_0x308f,0xbc));var _0xf308=function(_0x40b4c8,_0x20c6b6){_0x40b4c8=_0x40b4c8-0x0;var _0x301728=_0x308f[_0x40b4c8];return _0x301728;};'use strict';var _=require(_0xf308('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0xf308('0x1'));var rp=require(_0xf308('0x2'));var fs=require('fs');var path=require(_0xf308('0x3'));var rimraf=require(_0xf308('0x4'));var config=require('../../config/environment');var attributes=require(_0xf308('0x5'));module[_0xf308('0x6')]=function(_0x4fdff9,_0x1b59e7){return _0x4fdff9[_0xf308('0x7')]('WhatsappAccount',attributes,{'tableName':_0xf308('0x8'),'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 c9efe10..1cda81d 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 _0x832c=['redis','defaults','localhost','socket.io-emitter','./whatsappAccount.socket','register','request','then','WhatsappAccount,\x20%s,\x20%s','debug','WhatsappAccount,\x20%s,\x20%s,\x20%s','error','code','message','info','request\x20sent','result','catch','ShowWhatsappAccount','WhatsappAccount','find','options','raw','where','attributes','include','map','model','stringify','lodash','util','moment','bluebird','ioredis','rpc','jayson/promise','client','http'];(function(_0x2ae2ad,_0xac5b0c){var _0x26dbd7=function(_0x5e685b){while(--_0x5e685b){_0x2ae2ad['push'](_0x2ae2ad['shift']());}};_0x26dbd7(++_0xac5b0c);}(_0x832c,0x1e5));var _0xc832=function(_0x148df8,_0x37e55c){_0x148df8=_0x148df8-0x0;var _0x5318aa=_0x832c[_0x148df8];return _0x5318aa;};'use strict';var _=require(_0xc832('0x0'));var util=require(_0xc832('0x1'));var moment=require(_0xc832('0x2'));var BPromise=require(_0xc832('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xc832('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xc832('0x5'));var config=require('../../config/environment');var jayson=require(_0xc832('0x6'));var client=jayson[_0xc832('0x7')][_0xc832('0x8')]({'port':0x232a});config[_0xc832('0x9')]=_[_0xc832('0xa')](config[_0xc832('0x9')],{'host':_0xc832('0xb'),'port':0x18eb});var socket=require(_0xc832('0xc'))(new Redis(config[_0xc832('0x9')]));require(_0xc832('0xd'))[_0xc832('0xe')](socket);function respondWithRpcPromise(_0x48be2d,_0x50ab17,_0x165905){return new BPromise(function(_0x4393d8,_0x37bb0a){return client[_0xc832('0xf')](_0x48be2d,_0x165905)[_0xc832('0x10')](function(_0x44d7e3){logger['info'](_0xc832('0x11'),_0x50ab17,'request\x20sent');logger[_0xc832('0x12')](_0xc832('0x13'),_0x50ab17,'request\x20sent',JSON['stringify'](_0x44d7e3));if(_0x44d7e3['error']){if(_0x44d7e3[_0xc832('0x14')][_0xc832('0x15')]===0x1f4){logger[_0xc832('0x14')](_0xc832('0x11'),_0x50ab17,_0x44d7e3[_0xc832('0x14')][_0xc832('0x16')]);return _0x37bb0a(_0x44d7e3[_0xc832('0x14')][_0xc832('0x16')]);}logger['error']('WhatsappAccount,\x20%s,\x20%s',_0x50ab17,_0x44d7e3[_0xc832('0x14')]['message']);return _0x4393d8(_0x44d7e3['error'][_0xc832('0x16')]);}else{logger[_0xc832('0x17')]('WhatsappAccount,\x20%s,\x20%s',_0x50ab17,_0xc832('0x18'));_0x4393d8(_0x44d7e3[_0xc832('0x19')][_0xc832('0x16')]);}})[_0xc832('0x1a')](function(_0x54965c){logger[_0xc832('0x14')]('WhatsappAccount,\x20%s,\x20%s',_0x50ab17,_0x54965c);_0x37bb0a(_0x54965c);});});}exports[_0xc832('0x1b')]=function(_0x2b3434){var _0x235916=this;return new Promise(function(_0x3ca30d,_0x42b7f8){return db[_0xc832('0x1c')][_0xc832('0x1d')]({'raw':_0x2b3434['options']?_0x2b3434[_0xc832('0x1e')][_0xc832('0x1f')]===undefined?!![]:![]:!![],'where':_0x2b3434[_0xc832('0x1e')]?_0x2b3434[_0xc832('0x1e')][_0xc832('0x20')]||null:null,'attributes':_0x2b3434[_0xc832('0x1e')]?_0x2b3434[_0xc832('0x1e')][_0xc832('0x21')]||null:null,'include':_0x2b3434[_0xc832('0x1e')]?_0x2b3434[_0xc832('0x1e')][_0xc832('0x22')]?_['map'](_0x2b3434[_0xc832('0x1e')][_0xc832('0x22')],function(_0x4fc7c2){return{'model':db[_0x4fc7c2['model']],'as':_0x4fc7c2['as'],'attributes':_0x4fc7c2[_0xc832('0x21')],'include':_0x4fc7c2['include']?_[_0xc832('0x23')](_0x4fc7c2[_0xc832('0x22')],function(_0x346293){return{'model':db[_0x346293[_0xc832('0x24')]],'as':_0x346293['as'],'attributes':_0x346293[_0xc832('0x21')],'include':_0x346293[_0xc832('0x22')]?_[_0xc832('0x23')](_0x346293[_0xc832('0x22')],function(_0x49fb4e){return{'model':db[_0x49fb4e[_0xc832('0x24')]],'as':_0x49fb4e['as'],'attributes':_0x49fb4e[_0xc832('0x21')]};}):[]};}):[]};}):[]:[]})[_0xc832('0x10')](function(_0x5526a4){logger['info']('ShowWhatsappAccount',_0x2b3434);logger[_0xc832('0x12')](_0xc832('0x1b'),_0x2b3434,JSON[_0xc832('0x25')](_0x5526a4));_0x3ca30d(_0x5526a4);})['catch'](function(_0x197898){logger[_0xc832('0x14')](_0xc832('0x1b'),_0x197898[_0xc832('0x16')],_0x2b3434);_0x42b7f8(_0x235916[_0xc832('0x14')](0x1f4,_0x197898[_0xc832('0x16')]));});});}; \ No newline at end of file +var _0xf7a3=['client','redis','defaults','socket.io-emitter','./whatsappAccount.socket','register','request','then','request\x20sent','debug','WhatsappAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','WhatsappAccount,\x20%s,\x20%s','message','WhatsappAccount','find','options','raw','where','attributes','include','map','model','info','ShowWhatsappAccount','catch','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0xf7a3,0xac));var _0x3f7a=function(_0x314a8c,_0x1c2e8d){_0x314a8c=_0x314a8c-0x0;var _0x1d4607=_0xf7a3[_0x314a8c];return _0x1d4607;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x3f7a('0x0'));var BPromise=require(_0x3f7a('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x3f7a('0x2'));var db=require(_0x3f7a('0x3'))['db'];var utils=require(_0x3f7a('0x4'));var logger=require(_0x3f7a('0x5'))(_0x3f7a('0x6'));var config=require('../../config/environment');var jayson=require(_0x3f7a('0x7'));var client=jayson[_0x3f7a('0x8')]['http']({'port':0x232a});config[_0x3f7a('0x9')]=_[_0x3f7a('0xa')](config[_0x3f7a('0x9')],{'host':'localhost','port':0x18eb});var socket=require(_0x3f7a('0xb'))(new Redis(config[_0x3f7a('0x9')]));require(_0x3f7a('0xc'))[_0x3f7a('0xd')](socket);function respondWithRpcPromise(_0xe8dbb8,_0x54c855,_0x424a1f){return new BPromise(function(_0x3d41d4,_0x2dbb93){return client[_0x3f7a('0xe')](_0xe8dbb8,_0x424a1f)[_0x3f7a('0xf')](function(_0x34b746){logger['info']('WhatsappAccount,\x20%s,\x20%s',_0x54c855,_0x3f7a('0x10'));logger[_0x3f7a('0x11')](_0x3f7a('0x12'),_0x54c855,'request\x20sent',JSON[_0x3f7a('0x13')](_0x34b746));if(_0x34b746['error']){if(_0x34b746[_0x3f7a('0x14')][_0x3f7a('0x15')]===0x1f4){logger[_0x3f7a('0x14')](_0x3f7a('0x16'),_0x54c855,_0x34b746[_0x3f7a('0x14')][_0x3f7a('0x17')]);return _0x2dbb93(_0x34b746['error']['message']);}logger['error'](_0x3f7a('0x16'),_0x54c855,_0x34b746[_0x3f7a('0x14')][_0x3f7a('0x17')]);return _0x3d41d4(_0x34b746[_0x3f7a('0x14')][_0x3f7a('0x17')]);}else{logger['info'](_0x3f7a('0x16'),_0x54c855,'request\x20sent');_0x3d41d4(_0x34b746['result'][_0x3f7a('0x17')]);}})['catch'](function(_0x26840d){logger[_0x3f7a('0x14')](_0x3f7a('0x16'),_0x54c855,_0x26840d);_0x2dbb93(_0x26840d);});});}exports['ShowWhatsappAccount']=function(_0x20503e){var _0xcc0f8f=this;return new Promise(function(_0x3fabfa,_0x5ceb2d){return db[_0x3f7a('0x18')][_0x3f7a('0x19')]({'raw':_0x20503e[_0x3f7a('0x1a')]?_0x20503e['options'][_0x3f7a('0x1b')]===undefined?!![]:![]:!![],'where':_0x20503e['options']?_0x20503e[_0x3f7a('0x1a')][_0x3f7a('0x1c')]||null:null,'attributes':_0x20503e[_0x3f7a('0x1a')]?_0x20503e[_0x3f7a('0x1a')][_0x3f7a('0x1d')]||null:null,'include':_0x20503e['options']?_0x20503e['options'][_0x3f7a('0x1e')]?_[_0x3f7a('0x1f')](_0x20503e[_0x3f7a('0x1a')][_0x3f7a('0x1e')],function(_0x39bd0d){return{'model':db[_0x39bd0d[_0x3f7a('0x20')]],'as':_0x39bd0d['as'],'attributes':_0x39bd0d[_0x3f7a('0x1d')],'include':_0x39bd0d[_0x3f7a('0x1e')]?_[_0x3f7a('0x1f')](_0x39bd0d[_0x3f7a('0x1e')],function(_0x3ceb2d){return{'model':db[_0x3ceb2d[_0x3f7a('0x20')]],'as':_0x3ceb2d['as'],'attributes':_0x3ceb2d[_0x3f7a('0x1d')],'include':_0x3ceb2d[_0x3f7a('0x1e')]?_[_0x3f7a('0x1f')](_0x3ceb2d[_0x3f7a('0x1e')],function(_0x4ec654){return{'model':db[_0x4ec654['model']],'as':_0x4ec654['as'],'attributes':_0x4ec654[_0x3f7a('0x1d')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x3dd9f3){logger[_0x3f7a('0x21')](_0x3f7a('0x22'),_0x20503e);logger[_0x3f7a('0x11')](_0x3f7a('0x22'),_0x20503e,JSON[_0x3f7a('0x13')](_0x3dd9f3));_0x3fabfa(_0x3dd9f3);})[_0x3f7a('0x23')](function(_0x471101){logger[_0x3f7a('0x14')](_0x3f7a('0x22'),_0x471101['message'],_0x20503e);_0x5ceb2d(_0xcc0f8f['error'](0x1f4,_0x471101['message']));});});}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.socket.js b/server/api/whatsappAccount/whatsappAccount.socket.js index b4f05e6..763bc96 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 _0x67b2=['./whatsappAccount.events','save','remove','update','emit','removeListener','register','length','whatsappAccount:'];(function(_0x4c47fb,_0x5834d5){var _0x39381b=function(_0x22a34a){while(--_0x22a34a){_0x4c47fb['push'](_0x4c47fb['shift']());}};_0x39381b(++_0x5834d5);}(_0x67b2,0x15f));var _0x267b=function(_0x41d432,_0x20e878){_0x41d432=_0x41d432-0x0;var _0x1650f9=_0x67b2[_0x41d432];return _0x1650f9;};'use strict';var WhatsappAccountEvents=require(_0x267b('0x0'));var events=[_0x267b('0x1'),_0x267b('0x2'),_0x267b('0x3')];function createListener(_0x59df52,_0x4fd722){return function(_0x4d6562){_0x4fd722[_0x267b('0x4')](_0x59df52,_0x4d6562);};}function removeListener(_0x396b66,_0x924307){return function(){WhatsappAccountEvents[_0x267b('0x5')](_0x396b66,_0x924307);};}exports[_0x267b('0x6')]=function(_0x57006f){for(var _0x4b4afc=0x0,_0x2416e1=events[_0x267b('0x7')];_0x4b4afc<_0x2416e1;_0x4b4afc++){var _0x50001b=events[_0x4b4afc];var _0x3b804b=createListener(_0x267b('0x8')+_0x50001b,_0x57006f);WhatsappAccountEvents['on'](_0x50001b,_0x3b804b);}}; \ No newline at end of file +var _0x47e1=['emit','./whatsappAccount.events','remove'];(function(_0x268823,_0x3f8fd8){var _0x5dedfd=function(_0x4f3a42){while(--_0x4f3a42){_0x268823['push'](_0x268823['shift']());}};_0x5dedfd(++_0x3f8fd8);}(_0x47e1,0x9a));var _0x147e=function(_0x4714aa,_0x2454cb){_0x4714aa=_0x4714aa-0x0;var _0x1a41af=_0x47e1[_0x4714aa];return _0x1a41af;};'use strict';var WhatsappAccountEvents=require(_0x147e('0x0'));var events=['save',_0x147e('0x1'),'update'];function createListener(_0x30b88f,_0x2d5bc2){return function(_0x1cf47b){_0x2d5bc2[_0x147e('0x2')](_0x30b88f,_0x1cf47b);};}function removeListener(_0x4d4b19,_0x21a588){return function(){WhatsappAccountEvents['removeListener'](_0x4d4b19,_0x21a588);};}exports['register']=function(_0x290903){for(var _0x4aeaa1=0x0,_0x442058=events['length'];_0x4aeaa1<_0x442058;_0x4aeaa1++){var _0x270e3b=events[_0x4aeaa1];var _0x216e82=createListener('whatsappAccount:'+_0x270e3b,_0x290903);WhatsappAccountEvents['on'](_0x270e3b,_0x216e82);}}; \ No newline at end of file diff --git a/server/api/whatsappApplication/index.js b/server/api/whatsappApplication/index.js index c0fa454..e8d9fb2 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 _0x5300=['isAuthenticated','/:id','show','post','create','put','delete','destroy','exports','multer','util','path','connect-timeout','express','../../components/interaction/service','../../config/environment','./whatsappApplication.controller','get'];(function(_0x1928c9,_0x13a6d1){var _0x51b5fb=function(_0x24cf70){while(--_0x24cf70){_0x1928c9['push'](_0x1928c9['shift']());}};_0x51b5fb(++_0x13a6d1);}(_0x5300,0x117));var _0x0530=function(_0x7d8a84,_0x53ac6c){_0x7d8a84=_0x7d8a84-0x0;var _0x2991b4=_0x5300[_0x7d8a84];return _0x2991b4;};'use strict';var multer=require(_0x0530('0x0'));var util=require(_0x0530('0x1'));var path=require(_0x0530('0x2'));var timeout=require(_0x0530('0x3'));var express=require(_0x0530('0x4'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0x0530('0x5'));var config=require(_0x0530('0x6'));var controller=require(_0x0530('0x7'));router[_0x0530('0x8')]('/',auth[_0x0530('0x9')](),controller['index']);router[_0x0530('0x8')](_0x0530('0xa'),auth['isAuthenticated'](),controller[_0x0530('0xb')]);router[_0x0530('0xc')]('/',auth[_0x0530('0x9')](),controller[_0x0530('0xd')]);router[_0x0530('0xe')]('/:id',auth[_0x0530('0x9')](),controller['update']);router[_0x0530('0xf')](_0x0530('0xa'),auth[_0x0530('0x9')](),controller[_0x0530('0x10')]);module[_0x0530('0x11')]=router; \ No newline at end of file +var _0xaaba=['exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappApplication.controller','isAuthenticated','/:id','show','post','create','put','update','delete','destroy'];(function(_0x18cd5b,_0x10240b){var _0x5eaa52=function(_0x2bccad){while(--_0x2bccad){_0x18cd5b['push'](_0x18cd5b['shift']());}};_0x5eaa52(++_0x10240b);}(_0xaaba,0x99));var _0xaaab=function(_0x2733ba,_0x5813a9){_0x2733ba=_0x2733ba-0x0;var _0x172196=_0xaaba[_0x2733ba];return _0x172196;};'use strict';var multer=require(_0xaaab('0x0'));var util=require(_0xaaab('0x1'));var path=require('path');var timeout=require(_0xaaab('0x2'));var express=require(_0xaaab('0x3'));var router=express[_0xaaab('0x4')]();var auth=require(_0xaaab('0x5'));var interaction=require(_0xaaab('0x6'));var config=require(_0xaaab('0x7'));var controller=require(_0xaaab('0x8'));router['get']('/',auth[_0xaaab('0x9')](),controller['index']);router['get'](_0xaaab('0xa'),auth['isAuthenticated'](),controller[_0xaaab('0xb')]);router[_0xaaab('0xc')]('/',auth[_0xaaab('0x9')](),controller[_0xaaab('0xd')]);router[_0xaaab('0xe')](_0xaaab('0xa'),auth[_0xaaab('0x9')](),controller[_0xaaab('0xf')]);router[_0xaaab('0x10')](_0xaaab('0xa'),auth[_0xaaab('0x9')](),controller[_0xaaab('0x11')]);module[_0xaaab('0x12')]=router; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.attributes.js b/server/api/whatsappApplication/whatsappApplication.attributes.js index 834a912..159ce8a 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 _0xa52d=['STRING','noop','sequelize','INTEGER'];(function(_0x299b65,_0x1a4e00){var _0x4884e0=function(_0x976e4b){while(--_0x976e4b){_0x299b65['push'](_0x299b65['shift']());}};_0x4884e0(++_0x1a4e00);}(_0xa52d,0x6e));var _0xda52=function(_0x25e109,_0x6ab24c){_0x25e109=_0x25e109-0x0;var _0xc0f7d6=_0xa52d[_0x25e109];return _0xc0f7d6;};'use strict';var Sequelize=require(_0xda52('0x0'));module['exports']={'priority':{'type':Sequelize[_0xda52('0x1')],'allowNull':![]},'app':{'type':Sequelize[_0xda52('0x2')],'allowNull':![],'defaultValue':_0xda52('0x3')},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize[_0xda52('0x2')]},'interval':{'type':Sequelize[_0xda52('0x2')],'defaultValue':'*,*,*,*'}}; \ No newline at end of file +var _0x1882=['STRING','noop','TEXT','*,*,*,*','sequelize','exports','INTEGER'];(function(_0x2fc980,_0x511242){var _0x1a3792=function(_0x3bc3f7){while(--_0x3bc3f7){_0x2fc980['push'](_0x2fc980['shift']());}};_0x1a3792(++_0x511242);}(_0x1882,0x169));var _0x2188=function(_0x1d43cb,_0x4aac5d){_0x1d43cb=_0x1d43cb-0x0;var _0x39010d=_0x1882[_0x1d43cb];return _0x39010d;};'use strict';var Sequelize=require(_0x2188('0x0'));module[_0x2188('0x1')]={'priority':{'type':Sequelize[_0x2188('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0x2188('0x3')],'allowNull':![],'defaultValue':_0x2188('0x4')},'appdata':{'type':Sequelize[_0x2188('0x5')]()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0x2188('0x3')],'defaultValue':_0x2188('0x6')}}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.controller.js b/server/api/whatsappApplication/whatsappApplication.controller.js index fe68283..b0c7e31 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 _0xdfb0=['status','end','json','offset','limit','Content-Range','reject','save','then','destroy','error','stack','name','send','index','map','WhatsappApplication','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','hasOwnProperty','nolimit','order','sort','pick','where','merge','VIRTUAL','filter','options','count','include','findAll','rows','catch','show','includeAll','find','create','body','params','html-pdf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','sendStatus'];(function(_0x278e3c,_0x1c9cfd){var _0x3e2d9b=function(_0x34d928){while(--_0x34d928){_0x278e3c['push'](_0x278e3c['shift']());}};_0x3e2d9b(++_0x1c9cfd);}(_0xdfb0,0x79));var _0x0dfb=function(_0xaa53b7,_0x5ca330){_0xaa53b7=_0xaa53b7-0x0;var _0x5435e7=_0xdfb0[_0xaa53b7];return _0x5435e7;};'use strict';var pdf=require(_0x0dfb('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x0dfb('0x1'));var jsonpatch=require(_0x0dfb('0x2'));var rp=require(_0x0dfb('0x3'));var moment=require(_0x0dfb('0x4'));var BPromise=require(_0x0dfb('0x5'));var Mustache=require(_0x0dfb('0x6'));var util=require(_0x0dfb('0x7'));var path=require(_0x0dfb('0x8'));var sox=require(_0x0dfb('0x9'));var csv=require(_0x0dfb('0xa'));var ejs=require(_0x0dfb('0xb'));var fs=require('fs');var _=require(_0x0dfb('0xc'));var squel=require('squel');var crypto=require(_0x0dfb('0xd'));var jsforce=require(_0x0dfb('0xe'));var deskjs=require(_0x0dfb('0xf'));var toCsv=require(_0x0dfb('0xa'));var querystring=require(_0x0dfb('0x10'));var Papa=require('papaparse');var Redis=require(_0x0dfb('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x0dfb('0x12'));var hardwareService=require(_0x0dfb('0x13'));var logger=require('../../config/logger')(_0x0dfb('0x14'));var utils=require('../../config/utils');var config=require(_0x0dfb('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x509936,_0x452b4a){_0x452b4a=_0x452b4a||0xcc;return function(_0x477244){if(_0x477244){return _0x509936[_0x0dfb('0x16')](_0x452b4a);}return _0x509936[_0x0dfb('0x17')](_0x452b4a)[_0x0dfb('0x18')]();};}function respondWithResult(_0x3bc19b,_0x1ce6f4){_0x1ce6f4=_0x1ce6f4||0xc8;return function(_0x2e7d94){if(_0x2e7d94){return _0x3bc19b['status'](_0x1ce6f4)[_0x0dfb('0x19')](_0x2e7d94);}};}function respondWithFilteredResult(_0x5250df,_0x3b7e5c){return function(_0x30c8c3){if(_0x30c8c3){var _0x1b7f45=_0x30c8c3['count'],_0x5cbd82=_0x3b7e5c[_0x0dfb('0x1a')],_0x180d44=_0x3b7e5c[_0x0dfb('0x1a')]+_0x3b7e5c[_0x0dfb('0x1b')],_0x32e9d2;if(_0x180d44>=_0x1b7f45){_0x180d44=_0x1b7f45;_0x32e9d2=0xc8;}else{_0x32e9d2=0xce;}_0x5250df['status'](_0x32e9d2);return _0x5250df['set'](_0x0dfb('0x1c'),_0x5cbd82+'-'+_0x180d44+'/'+_0x1b7f45)[_0x0dfb('0x19')](_0x30c8c3);}return null;};}function patchUpdates(_0x4ea728){return function(_0x1b596d){try{jsonpatch['apply'](_0x1b596d,_0x4ea728,!![]);}catch(_0x521e26){return BPromise[_0x0dfb('0x1d')](_0x521e26);}return _0x1b596d[_0x0dfb('0x1e')]();};}function saveUpdates(_0x2412f1,_0x195049){return function(_0x4d1d17){if(_0x4d1d17){return _0x4d1d17['update'](_0x2412f1)[_0x0dfb('0x1f')](function(_0x5cb16c){return _0x5cb16c;});}return null;};}function removeEntity(_0x16cf34,_0x7763a7){return function(_0x1cc4f2){if(_0x1cc4f2){return _0x1cc4f2[_0x0dfb('0x20')]()[_0x0dfb('0x1f')](function(){_0x16cf34[_0x0dfb('0x17')](0xcc)[_0x0dfb('0x18')]();});}};}function handleEntityNotFound(_0x5d2817,_0x3e11f1){return function(_0x5a45ad){if(!_0x5a45ad){_0x5d2817[_0x0dfb('0x16')](0x194);}return _0x5a45ad;};}function handleError(_0x5d2f8c,_0x1e5db7){_0x1e5db7=_0x1e5db7||0x1f4;return function(_0x133d78){logger[_0x0dfb('0x21')](_0x133d78[_0x0dfb('0x22')]);if(_0x133d78['name']){delete _0x133d78[_0x0dfb('0x23')];}_0x5d2f8c[_0x0dfb('0x17')](_0x1e5db7)[_0x0dfb('0x24')](_0x133d78);};}exports[_0x0dfb('0x25')]=function(_0x31a0d2,_0x2b1629){var _0x31d9aa={},_0x1d0be7={},_0x1ff2cd={'count':0x0,'rows':[]};var _0x224cb5=_[_0x0dfb('0x26')](db[_0x0dfb('0x27')][_0x0dfb('0x28')],function(_0x25d28f){return{'name':_0x25d28f[_0x0dfb('0x29')],'type':_0x25d28f[_0x0dfb('0x2a')][_0x0dfb('0x2b')]};});_0x1d0be7['model']=_['map'](_0x224cb5,_0x0dfb('0x23'));_0x1d0be7[_0x0dfb('0x2c')]=_[_0x0dfb('0x2d')](_0x31a0d2[_0x0dfb('0x2c')]);_0x1d0be7[_0x0dfb('0x2e')]=_[_0x0dfb('0x2f')](_0x1d0be7[_0x0dfb('0x30')],_0x1d0be7['query']);_0x31d9aa[_0x0dfb('0x31')]=_['intersection'](_0x1d0be7[_0x0dfb('0x30')],qs[_0x0dfb('0x32')](_0x31a0d2[_0x0dfb('0x2c')][_0x0dfb('0x32')]));_0x31d9aa[_0x0dfb('0x31')]=_0x31d9aa[_0x0dfb('0x31')]['length']?_0x31d9aa[_0x0dfb('0x31')]:_0x1d0be7[_0x0dfb('0x30')];if(!_0x31a0d2[_0x0dfb('0x2c')][_0x0dfb('0x33')](_0x0dfb('0x34'))){_0x31d9aa[_0x0dfb('0x1b')]=qs[_0x0dfb('0x1b')](_0x31a0d2[_0x0dfb('0x2c')]['limit']);_0x31d9aa[_0x0dfb('0x1a')]=qs[_0x0dfb('0x1a')](_0x31a0d2[_0x0dfb('0x2c')][_0x0dfb('0x1a')]);}_0x31d9aa[_0x0dfb('0x35')]=qs[_0x0dfb('0x36')](_0x31a0d2[_0x0dfb('0x2c')][_0x0dfb('0x36')]);_0x31d9aa['where']=qs['filters'](_[_0x0dfb('0x37')](_0x31a0d2['query'],_0x1d0be7[_0x0dfb('0x2e')]),_0x224cb5);if(_0x31a0d2[_0x0dfb('0x2c')]['filter']){_0x31d9aa[_0x0dfb('0x38')]=_[_0x0dfb('0x39')](_0x31d9aa[_0x0dfb('0x38')],{'$or':_[_0x0dfb('0x26')](_0x224cb5,function(_0x3897ae){if(_0x3897ae['type']!==_0x0dfb('0x3a')){var _0x27de1c={};_0x27de1c[_0x3897ae[_0x0dfb('0x23')]]={'$like':'%'+_0x31a0d2[_0x0dfb('0x2c')][_0x0dfb('0x3b')]+'%'};return _0x27de1c;}})});}_0x31d9aa=_['merge']({},_0x31d9aa,_0x31a0d2[_0x0dfb('0x3c')]);var _0x2f3a4f={'where':_0x31d9aa[_0x0dfb('0x38')]};return db[_0x0dfb('0x27')][_0x0dfb('0x3d')](_0x2f3a4f)[_0x0dfb('0x1f')](function(_0x83989c){_0x1ff2cd[_0x0dfb('0x3d')]=_0x83989c;if(_0x31a0d2[_0x0dfb('0x2c')]['includeAll']){_0x31d9aa[_0x0dfb('0x3e')]=[{'all':!![]}];}return db['WhatsappApplication'][_0x0dfb('0x3f')](_0x31d9aa);})[_0x0dfb('0x1f')](function(_0xb7468d){_0x1ff2cd[_0x0dfb('0x40')]=_0xb7468d;return _0x1ff2cd;})['then'](respondWithFilteredResult(_0x2b1629,_0x31d9aa))[_0x0dfb('0x41')](handleError(_0x2b1629,null));};exports[_0x0dfb('0x42')]=function(_0xca8733,_0x470d01){var _0x3e8d42={'raw':!![],'where':{'id':_0xca8733['params']['id']}},_0x4408d0={};_0x4408d0[_0x0dfb('0x30')]=_[_0x0dfb('0x2d')](db[_0x0dfb('0x27')][_0x0dfb('0x28')]);_0x4408d0[_0x0dfb('0x2c')]=_['keys'](_0xca8733[_0x0dfb('0x2c')]);_0x4408d0[_0x0dfb('0x2e')]=_[_0x0dfb('0x2f')](_0x4408d0['model'],_0x4408d0[_0x0dfb('0x2c')]);_0x3e8d42[_0x0dfb('0x31')]=_[_0x0dfb('0x2f')](_0x4408d0['model'],qs[_0x0dfb('0x32')](_0xca8733[_0x0dfb('0x2c')][_0x0dfb('0x32')]));_0x3e8d42[_0x0dfb('0x31')]=_0x3e8d42[_0x0dfb('0x31')]['length']?_0x3e8d42['attributes']:_0x4408d0[_0x0dfb('0x30')];if(_0xca8733[_0x0dfb('0x2c')][_0x0dfb('0x43')]){_0x3e8d42['include']=[{'all':!![]}];}_0x3e8d42=_[_0x0dfb('0x39')]({},_0x3e8d42,_0xca8733[_0x0dfb('0x3c')]);return db[_0x0dfb('0x27')][_0x0dfb('0x44')](_0x3e8d42)[_0x0dfb('0x1f')](handleEntityNotFound(_0x470d01,null))[_0x0dfb('0x1f')](respondWithResult(_0x470d01,null))['catch'](handleError(_0x470d01,null));};exports[_0x0dfb('0x45')]=function(_0x497e83,_0x31664d){return db[_0x0dfb('0x27')]['create'](_0x497e83[_0x0dfb('0x46')],{})[_0x0dfb('0x1f')](respondWithResult(_0x31664d,0xc9))['catch'](handleError(_0x31664d,null));};exports['update']=function(_0x3151a1,_0x21602c){if(_0x3151a1[_0x0dfb('0x46')]['id']){delete _0x3151a1[_0x0dfb('0x46')]['id'];}return db[_0x0dfb('0x27')][_0x0dfb('0x44')]({'where':{'id':_0x3151a1[_0x0dfb('0x47')]['id']}})['then'](handleEntityNotFound(_0x21602c,null))[_0x0dfb('0x1f')](saveUpdates(_0x3151a1[_0x0dfb('0x46')],null))['then'](respondWithResult(_0x21602c,null))[_0x0dfb('0x41')](handleError(_0x21602c,null));};exports[_0x0dfb('0x20')]=function(_0x18ed74,_0x50e6b7){return db[_0x0dfb('0x27')][_0x0dfb('0x44')]({'where':{'id':_0x18ed74['params']['id']}})['then'](handleEntityNotFound(_0x50e6b7,null))[_0x0dfb('0x1f')](removeEntity(_0x50e6b7,null))[_0x0dfb('0x41')](handleError(_0x50e6b7,null));}; \ No newline at end of file +var _0xfda8=['filters','intersection','attributes','model','fields','length','nolimit','sort','where','VIRTUAL','filter','merge','options','includeAll','include','findAll','show','params','keys','find','create','catch','body','destroy','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/environment','sendStatus','status','end','json','offset','limit','set','reject','save','update','then','error','stack','name','send','map','WhatsappApplication','rawAttributes','fieldName','type','key','query'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0xfda8,0x9e));var _0x8fda=function(_0x27dd52,_0x1617f6){_0x27dd52=_0x27dd52-0x0;var _0x41093e=_0xfda8[_0x27dd52];return _0x41093e;};'use strict';var pdf=require(_0x8fda('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x8fda('0x1'));var zipdir=require(_0x8fda('0x2'));var jsonpatch=require(_0x8fda('0x3'));var rp=require(_0x8fda('0x4'));var moment=require(_0x8fda('0x5'));var BPromise=require(_0x8fda('0x6'));var Mustache=require(_0x8fda('0x7'));var util=require('util');var path=require(_0x8fda('0x8'));var sox=require(_0x8fda('0x9'));var csv=require(_0x8fda('0xa'));var ejs=require(_0x8fda('0xb'));var fs=require('fs');var _=require(_0x8fda('0xc'));var squel=require(_0x8fda('0xd'));var crypto=require('crypto');var jsforce=require(_0x8fda('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x8fda('0xf'));var Papa=require('papaparse');var Redis=require(_0x8fda('0x10'));var authService=require(_0x8fda('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x8fda('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x8fda('0x13'));var utils=require('../../config/utils');var config=require(_0x8fda('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x184ac5,_0x3cf3b3){_0x3cf3b3=_0x3cf3b3||0xcc;return function(_0x630ce0){if(_0x630ce0){return _0x184ac5[_0x8fda('0x15')](_0x3cf3b3);}return _0x184ac5[_0x8fda('0x16')](_0x3cf3b3)[_0x8fda('0x17')]();};}function respondWithResult(_0x4f9e7e,_0x367366){_0x367366=_0x367366||0xc8;return function(_0x39f089){if(_0x39f089){return _0x4f9e7e[_0x8fda('0x16')](_0x367366)[_0x8fda('0x18')](_0x39f089);}};}function respondWithFilteredResult(_0x19bb75,_0x57cecb){return function(_0x5b04a7){if(_0x5b04a7){var _0x3b9225=_0x5b04a7['count'],_0x54b415=_0x57cecb[_0x8fda('0x19')],_0x4c8780=_0x57cecb['offset']+_0x57cecb[_0x8fda('0x1a')],_0x64e6c1;if(_0x4c8780>=_0x3b9225){_0x4c8780=_0x3b9225;_0x64e6c1=0xc8;}else{_0x64e6c1=0xce;}_0x19bb75[_0x8fda('0x16')](_0x64e6c1);return _0x19bb75[_0x8fda('0x1b')]('Content-Range',_0x54b415+'-'+_0x4c8780+'/'+_0x3b9225)[_0x8fda('0x18')](_0x5b04a7);}return null;};}function patchUpdates(_0x32e4f2){return function(_0x56fa6d){try{jsonpatch['apply'](_0x56fa6d,_0x32e4f2,!![]);}catch(_0x19350f){return BPromise[_0x8fda('0x1c')](_0x19350f);}return _0x56fa6d[_0x8fda('0x1d')]();};}function saveUpdates(_0x29ad58,_0x459f4d){return function(_0x16970f){if(_0x16970f){return _0x16970f[_0x8fda('0x1e')](_0x29ad58)[_0x8fda('0x1f')](function(_0x508df7){return _0x508df7;});}return null;};}function removeEntity(_0x200308,_0x2c2ff9){return function(_0xeb2853){if(_0xeb2853){return _0xeb2853['destroy']()[_0x8fda('0x1f')](function(){_0x200308[_0x8fda('0x16')](0xcc)[_0x8fda('0x17')]();});}};}function handleEntityNotFound(_0x3cc617,_0x5cf465){return function(_0x355c6a){if(!_0x355c6a){_0x3cc617[_0x8fda('0x15')](0x194);}return _0x355c6a;};}function handleError(_0x1236a0,_0xfad51e){_0xfad51e=_0xfad51e||0x1f4;return function(_0xff4311){logger[_0x8fda('0x20')](_0xff4311[_0x8fda('0x21')]);if(_0xff4311['name']){delete _0xff4311[_0x8fda('0x22')];}_0x1236a0[_0x8fda('0x16')](_0xfad51e)[_0x8fda('0x23')](_0xff4311);};}exports['index']=function(_0x1d2426,_0x51dd55){var _0xbfdd58={},_0x2a3b31={},_0x17aaff={'count':0x0,'rows':[]};var _0xdc335a=_[_0x8fda('0x24')](db[_0x8fda('0x25')][_0x8fda('0x26')],function(_0x8355e1){return{'name':_0x8355e1[_0x8fda('0x27')],'type':_0x8355e1[_0x8fda('0x28')][_0x8fda('0x29')]};});_0x2a3b31['model']=_[_0x8fda('0x24')](_0xdc335a,_0x8fda('0x22'));_0x2a3b31[_0x8fda('0x2a')]=_['keys'](_0x1d2426['query']);_0x2a3b31[_0x8fda('0x2b')]=_[_0x8fda('0x2c')](_0x2a3b31['model'],_0x2a3b31[_0x8fda('0x2a')]);_0xbfdd58[_0x8fda('0x2d')]=_[_0x8fda('0x2c')](_0x2a3b31[_0x8fda('0x2e')],qs[_0x8fda('0x2f')](_0x1d2426[_0x8fda('0x2a')]['fields']));_0xbfdd58['attributes']=_0xbfdd58[_0x8fda('0x2d')][_0x8fda('0x30')]?_0xbfdd58[_0x8fda('0x2d')]:_0x2a3b31[_0x8fda('0x2e')];if(!_0x1d2426[_0x8fda('0x2a')]['hasOwnProperty'](_0x8fda('0x31'))){_0xbfdd58[_0x8fda('0x1a')]=qs[_0x8fda('0x1a')](_0x1d2426[_0x8fda('0x2a')]['limit']);_0xbfdd58['offset']=qs[_0x8fda('0x19')](_0x1d2426['query'][_0x8fda('0x19')]);}_0xbfdd58['order']=qs[_0x8fda('0x32')](_0x1d2426[_0x8fda('0x2a')][_0x8fda('0x32')]);_0xbfdd58[_0x8fda('0x33')]=qs['filters'](_['pick'](_0x1d2426[_0x8fda('0x2a')],_0x2a3b31['filters']),_0xdc335a);if(_0x1d2426[_0x8fda('0x2a')]['filter']){_0xbfdd58[_0x8fda('0x33')]=_['merge'](_0xbfdd58[_0x8fda('0x33')],{'$or':_['map'](_0xdc335a,function(_0x461e7e){if(_0x461e7e[_0x8fda('0x28')]!==_0x8fda('0x34')){var _0x9753b3={};_0x9753b3[_0x461e7e[_0x8fda('0x22')]]={'$like':'%'+_0x1d2426[_0x8fda('0x2a')][_0x8fda('0x35')]+'%'};return _0x9753b3;}})});}_0xbfdd58=_[_0x8fda('0x36')]({},_0xbfdd58,_0x1d2426[_0x8fda('0x37')]);var _0x23dc72={'where':_0xbfdd58[_0x8fda('0x33')]};return db[_0x8fda('0x25')]['count'](_0x23dc72)[_0x8fda('0x1f')](function(_0x329d52){_0x17aaff['count']=_0x329d52;if(_0x1d2426[_0x8fda('0x2a')][_0x8fda('0x38')]){_0xbfdd58[_0x8fda('0x39')]=[{'all':!![]}];}return db[_0x8fda('0x25')][_0x8fda('0x3a')](_0xbfdd58);})[_0x8fda('0x1f')](function(_0x2966bd){_0x17aaff['rows']=_0x2966bd;return _0x17aaff;})[_0x8fda('0x1f')](respondWithFilteredResult(_0x51dd55,_0xbfdd58))['catch'](handleError(_0x51dd55,null));};exports[_0x8fda('0x3b')]=function(_0x84eae8,_0x3bfc53){var _0x1e1dda={'raw':!![],'where':{'id':_0x84eae8[_0x8fda('0x3c')]['id']}},_0x517d27={};_0x517d27['model']=_[_0x8fda('0x3d')](db['WhatsappApplication'][_0x8fda('0x26')]);_0x517d27[_0x8fda('0x2a')]=_[_0x8fda('0x3d')](_0x84eae8[_0x8fda('0x2a')]);_0x517d27['filters']=_[_0x8fda('0x2c')](_0x517d27[_0x8fda('0x2e')],_0x517d27[_0x8fda('0x2a')]);_0x1e1dda[_0x8fda('0x2d')]=_['intersection'](_0x517d27[_0x8fda('0x2e')],qs[_0x8fda('0x2f')](_0x84eae8['query'][_0x8fda('0x2f')]));_0x1e1dda[_0x8fda('0x2d')]=_0x1e1dda[_0x8fda('0x2d')]['length']?_0x1e1dda['attributes']:_0x517d27['model'];if(_0x84eae8[_0x8fda('0x2a')][_0x8fda('0x38')]){_0x1e1dda[_0x8fda('0x39')]=[{'all':!![]}];}_0x1e1dda=_[_0x8fda('0x36')]({},_0x1e1dda,_0x84eae8[_0x8fda('0x37')]);return db['WhatsappApplication'][_0x8fda('0x3e')](_0x1e1dda)[_0x8fda('0x1f')](handleEntityNotFound(_0x3bfc53,null))[_0x8fda('0x1f')](respondWithResult(_0x3bfc53,null))['catch'](handleError(_0x3bfc53,null));};exports[_0x8fda('0x3f')]=function(_0x73e03c,_0x3f8bb5){return db[_0x8fda('0x25')][_0x8fda('0x3f')](_0x73e03c['body'],{})[_0x8fda('0x1f')](respondWithResult(_0x3f8bb5,0xc9))[_0x8fda('0x40')](handleError(_0x3f8bb5,null));};exports[_0x8fda('0x1e')]=function(_0xb39e7a,_0x6ac1e2){if(_0xb39e7a[_0x8fda('0x41')]['id']){delete _0xb39e7a['body']['id'];}return db['WhatsappApplication'][_0x8fda('0x3e')]({'where':{'id':_0xb39e7a[_0x8fda('0x3c')]['id']}})['then'](handleEntityNotFound(_0x6ac1e2,null))['then'](saveUpdates(_0xb39e7a[_0x8fda('0x41')],null))[_0x8fda('0x1f')](respondWithResult(_0x6ac1e2,null))[_0x8fda('0x40')](handleError(_0x6ac1e2,null));};exports[_0x8fda('0x42')]=function(_0x504ab6,_0x5aad54){return db['WhatsappApplication']['find']({'where':{'id':_0x504ab6[_0x8fda('0x3c')]['id']}})[_0x8fda('0x1f')](handleEntityNotFound(_0x5aad54,null))[_0x8fda('0x1f')](removeEntity(_0x5aad54,null))[_0x8fda('0x40')](handleError(_0x5aad54,null));}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.model.js b/server/api/whatsappApplication/whatsappApplication.model.js index 5142f14..56ef6c0 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 _0x594d=['whatsapp_applications','utf8mb4','utf8mb4_unicode_ci','lodash','api','moment','bluebird','path','rimraf','../../config/environment','./whatsappApplication.attributes','define','WhatsappApplication'];(function(_0x2b4411,_0x2625ed){var _0x8e41ef=function(_0x2aa8c1){while(--_0x2aa8c1){_0x2b4411['push'](_0x2b4411['shift']());}};_0x8e41ef(++_0x2625ed);}(_0x594d,0x92));var _0xd594=function(_0xc54bb3,_0x551b5b){_0xc54bb3=_0xc54bb3-0x0;var _0x1e8d40=_0x594d[_0xc54bb3];return _0x1e8d40;};'use strict';var _=require(_0xd594('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xd594('0x1'));var moment=require(_0xd594('0x2'));var BPromise=require(_0xd594('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xd594('0x4'));var rimraf=require(_0xd594('0x5'));var config=require(_0xd594('0x6'));var attributes=require(_0xd594('0x7'));module['exports']=function(_0x3347cd,_0x498ef4){return _0x3347cd[_0xd594('0x8')](_0xd594('0x9'),attributes,{'tableName':_0xd594('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xd594('0xb'),'collate':_0xd594('0xc')});}; \ No newline at end of file +var _0xabad=['api','moment','request-promise','path','../../config/environment','./whatsappApplication.attributes','exports','define','WhatsappApplication','whatsapp_applications','utf8mb4_unicode_ci','lodash','../../config/logger'];(function(_0x7903b1,_0x1cb471){var _0xdff432=function(_0x5e2b47){while(--_0x5e2b47){_0x7903b1['push'](_0x7903b1['shift']());}};_0xdff432(++_0x1cb471);}(_0xabad,0x150));var _0xdaba=function(_0x531a19,_0x43e019){_0x531a19=_0x531a19-0x0;var _0x4845d2=_0xabad[_0x531a19];return _0x4845d2;};'use strict';var _=require(_0xdaba('0x0'));var util=require('util');var logger=require(_0xdaba('0x1'))(_0xdaba('0x2'));var moment=require(_0xdaba('0x3'));var BPromise=require('bluebird');var rp=require(_0xdaba('0x4'));var fs=require('fs');var path=require(_0xdaba('0x5'));var rimraf=require('rimraf');var config=require(_0xdaba('0x6'));var attributes=require(_0xdaba('0x7'));module[_0xdaba('0x8')]=function(_0x387d02,_0x20fd9f){return _0x387d02[_0xdaba('0x9')](_0xdaba('0xa'),attributes,{'tableName':_0xdaba('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0xdaba('0xc')});}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.rpc.js b/server/api/whatsappApplication/whatsappApplication.rpc.js index da12bd5..2718baa 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 _0xb4c7=['client','http','request','then','info','WhatsappApplication,\x20%s,\x20%s','request\x20sent','debug','WhatsappApplication,\x20%s,\x20%s,\x20%s','stringify','code','error','message','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x195d44,_0x7c56f8){var _0x46a0e7=function(_0xb30c3d){while(--_0xb30c3d){_0x195d44['push'](_0x195d44['shift']());}};_0x46a0e7(++_0x7c56f8);}(_0xb4c7,0x1ea));var _0x7b4c=function(_0x3643dc,_0x3ee6e4){_0x3643dc=_0x3643dc-0x0;var _0x4102e4=_0xb4c7[_0x3643dc];return _0x4102e4;};'use strict';var _=require(_0x7b4c('0x0'));var util=require(_0x7b4c('0x1'));var moment=require(_0x7b4c('0x2'));var BPromise=require(_0x7b4c('0x3'));var rs=require(_0x7b4c('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x7b4c('0x5'))['db'];var utils=require(_0x7b4c('0x6'));var logger=require(_0x7b4c('0x7'))(_0x7b4c('0x8'));var config=require(_0x7b4c('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x7b4c('0xa')][_0x7b4c('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2dd5c7,_0x4bf85d,_0x2d7b7e){return new BPromise(function(_0x21687f,_0x570daa){return client[_0x7b4c('0xc')](_0x2dd5c7,_0x2d7b7e)[_0x7b4c('0xd')](function(_0x28e902){logger[_0x7b4c('0xe')](_0x7b4c('0xf'),_0x4bf85d,_0x7b4c('0x10'));logger[_0x7b4c('0x11')](_0x7b4c('0x12'),_0x4bf85d,_0x7b4c('0x10'),JSON[_0x7b4c('0x13')](_0x28e902));if(_0x28e902['error']){if(_0x28e902['error'][_0x7b4c('0x14')]===0x1f4){logger[_0x7b4c('0x15')](_0x7b4c('0xf'),_0x4bf85d,_0x28e902[_0x7b4c('0x15')][_0x7b4c('0x16')]);return _0x570daa(_0x28e902[_0x7b4c('0x15')][_0x7b4c('0x16')]);}logger[_0x7b4c('0x15')](_0x7b4c('0xf'),_0x4bf85d,_0x28e902[_0x7b4c('0x15')]['message']);return _0x21687f(_0x28e902[_0x7b4c('0x15')][_0x7b4c('0x16')]);}else{logger[_0x7b4c('0xe')](_0x7b4c('0xf'),_0x4bf85d,_0x7b4c('0x10'));_0x21687f(_0x28e902[_0x7b4c('0x17')][_0x7b4c('0x16')]);}})[_0x7b4c('0x18')](function(_0x4d3f5e){logger[_0x7b4c('0x15')](_0x7b4c('0xf'),_0x4bf85d,_0x4d3f5e);_0x570daa(_0x4d3f5e);});});} \ No newline at end of file +var _0x11e5=['request\x20sent','debug','WhatsappApplication,\x20%s,\x20%s,\x20%s','error','message','result','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','client','http','request','then','info','WhatsappApplication,\x20%s,\x20%s'];(function(_0x3b4b1d,_0x15029e){var _0x488c36=function(_0x56c8b3){while(--_0x56c8b3){_0x3b4b1d['push'](_0x3b4b1d['shift']());}};_0x488c36(++_0x15029e);}(_0x11e5,0x8b));var _0x511e=function(_0xa0aee9,_0x36c6dc){_0xa0aee9=_0xa0aee9-0x0;var _0xd912e5=_0x11e5[_0xa0aee9];return _0xd912e5;};'use strict';var _=require(_0x511e('0x0'));var util=require('util');var moment=require(_0x511e('0x1'));var BPromise=require(_0x511e('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x511e('0x3'));var db=require(_0x511e('0x4'))['db'];var utils=require(_0x511e('0x5'));var logger=require('../../config/logger')(_0x511e('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x511e('0x7')][_0x511e('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x466dec,_0x57cac3,_0x47cf56){return new BPromise(function(_0x3ebc4b,_0xf0ba86){return client[_0x511e('0x9')](_0x466dec,_0x47cf56)[_0x511e('0xa')](function(_0x4449c4){logger[_0x511e('0xb')](_0x511e('0xc'),_0x57cac3,_0x511e('0xd'));logger[_0x511e('0xe')](_0x511e('0xf'),_0x57cac3,_0x511e('0xd'),JSON['stringify'](_0x4449c4));if(_0x4449c4[_0x511e('0x10')]){if(_0x4449c4['error']['code']===0x1f4){logger[_0x511e('0x10')](_0x511e('0xc'),_0x57cac3,_0x4449c4[_0x511e('0x10')][_0x511e('0x11')]);return _0xf0ba86(_0x4449c4[_0x511e('0x10')][_0x511e('0x11')]);}logger['error'](_0x511e('0xc'),_0x57cac3,_0x4449c4[_0x511e('0x10')]['message']);return _0x3ebc4b(_0x4449c4[_0x511e('0x10')][_0x511e('0x11')]);}else{logger['info'](_0x511e('0xc'),_0x57cac3,_0x511e('0xd'));_0x3ebc4b(_0x4449c4[_0x511e('0x12')][_0x511e('0x11')]);}})['catch'](function(_0x3e0415){logger[_0x511e('0x10')](_0x511e('0xc'),_0x57cac3,_0x3e0415);_0xf0ba86(_0x3e0415);});});} \ No newline at end of file diff --git a/server/api/whatsappInteraction/index.js b/server/api/whatsappInteraction/index.js index 36c8d20..cfe8b92 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 _0x5977=['../../components/interaction/service','./whatsappInteraction.controller','isAuthenticated','index','describe','get','show','getMessages','/:id/download','post','create','/:id/messages','/:id/tags','tracked','whatsappinteraction:addtags','addTags','put','whatsapp','update','delete','/:id','whatsappinteraction:destroy','destroy','removeTags','exports','multer','util','path','express','Router'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x5977,0xeb));var _0x7597=function(_0x39d9ea,_0x124cf1){_0x39d9ea=_0x39d9ea-0x0;var _0x535d4c=_0x5977[_0x39d9ea];return _0x535d4c;};'use strict';var multer=require(_0x7597('0x0'));var util=require(_0x7597('0x1'));var path=require(_0x7597('0x2'));var timeout=require('connect-timeout');var express=require(_0x7597('0x3'));var router=express[_0x7597('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x7597('0x5'));var config=require('../../config/environment');var controller=require(_0x7597('0x6'));router['get']('/',auth[_0x7597('0x7')](),controller[_0x7597('0x8')]);router['get']('/describe',auth['isAuthenticated'](),controller[_0x7597('0x9')]);router[_0x7597('0xa')]('/:id',auth['isAuthenticated'](),controller[_0x7597('0xb')]);router['get']('/:id/messages',auth[_0x7597('0x7')](),controller[_0x7597('0xc')]);router[_0x7597('0xa')](_0x7597('0xd'),auth[_0x7597('0x7')](),controller['download']);router[_0x7597('0xe')]('/',auth[_0x7597('0x7')](),controller[_0x7597('0xf')]);router[_0x7597('0xe')](_0x7597('0x10'),auth['isAuthenticated'](),controller['addMessage']);router[_0x7597('0xe')](_0x7597('0x11'),auth[_0x7597('0x7')](),interaction[_0x7597('0x12')]('whatsapp',_0x7597('0x13')),controller[_0x7597('0x14')]);router[_0x7597('0x15')]('/:id',auth['isAuthenticated'](),interaction[_0x7597('0x12')](_0x7597('0x16'),'whatsappinteraction:update'),controller[_0x7597('0x17')]);router[_0x7597('0x18')](_0x7597('0x19'),auth[_0x7597('0x7')](),interaction[_0x7597('0x12')](_0x7597('0x16'),_0x7597('0x1a')),controller[_0x7597('0x1b')]);router[_0x7597('0x18')](_0x7597('0x11'),auth['isAuthenticated'](),controller[_0x7597('0x1c')]);module[_0x7597('0x1d')]=router; \ No newline at end of file +var _0xf26a=['../../components/interaction/service','../../config/environment','./whatsappInteraction.controller','get','isAuthenticated','index','/describe','describe','/:id','/:id/download','download','post','/:id/messages','addMessage','/:id/tags','tracked','whatsapp','whatsappinteraction:addtags','put','whatsappinteraction:update','update','delete','destroy','removeTags','exports','multer','util','express','../../components/auth/service'];(function(_0x4495c7,_0x36a025){var _0x3d0e93=function(_0x1112f3){while(--_0x1112f3){_0x4495c7['push'](_0x4495c7['shift']());}};_0x3d0e93(++_0x36a025);}(_0xf26a,0x158));var _0xaf26=function(_0x58dbcd,_0x11bccf){_0x58dbcd=_0x58dbcd-0x0;var _0x2448ea=_0xf26a[_0x58dbcd];return _0x2448ea;};'use strict';var multer=require(_0xaf26('0x0'));var util=require(_0xaf26('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xaf26('0x2'));var router=express['Router']();var auth=require(_0xaf26('0x3'));var interaction=require(_0xaf26('0x4'));var config=require(_0xaf26('0x5'));var controller=require(_0xaf26('0x6'));router[_0xaf26('0x7')]('/',auth[_0xaf26('0x8')](),controller[_0xaf26('0x9')]);router[_0xaf26('0x7')](_0xaf26('0xa'),auth[_0xaf26('0x8')](),controller[_0xaf26('0xb')]);router[_0xaf26('0x7')](_0xaf26('0xc'),auth[_0xaf26('0x8')](),controller['show']);router[_0xaf26('0x7')]('/:id/messages',auth[_0xaf26('0x8')](),controller['getMessages']);router[_0xaf26('0x7')](_0xaf26('0xd'),auth[_0xaf26('0x8')](),controller[_0xaf26('0xe')]);router['post']('/',auth[_0xaf26('0x8')](),controller['create']);router[_0xaf26('0xf')](_0xaf26('0x10'),auth[_0xaf26('0x8')](),controller[_0xaf26('0x11')]);router['post'](_0xaf26('0x12'),auth[_0xaf26('0x8')](),interaction[_0xaf26('0x13')](_0xaf26('0x14'),_0xaf26('0x15')),controller['addTags']);router[_0xaf26('0x16')](_0xaf26('0xc'),auth[_0xaf26('0x8')](),interaction['tracked'](_0xaf26('0x14'),_0xaf26('0x17')),controller[_0xaf26('0x18')]);router[_0xaf26('0x19')](_0xaf26('0xc'),auth[_0xaf26('0x8')](),interaction[_0xaf26('0x13')](_0xaf26('0x14'),'whatsappinteraction:destroy'),controller[_0xaf26('0x1a')]);router['delete'](_0xaf26('0x12'),auth[_0xaf26('0x8')](),controller[_0xaf26('0x1b')]);module[_0xaf26('0x1c')]=router; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.attributes.js b/server/api/whatsappInteraction/whatsappInteraction.attributes.js index 03fe665..a4d483b 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 _0xc3f4=['exports','BOOLEAN','DATE','STRING','ENUM','out','sequelize','moment'];(function(_0x1a8f86,_0x5ed9c4){var _0x20d876=function(_0x596e1b){while(--_0x596e1b){_0x1a8f86['push'](_0x1a8f86['shift']());}};_0x20d876(++_0x5ed9c4);}(_0xc3f4,0x9e));var _0x4c3f=function(_0x5d1ebc,_0x59f486){_0x5d1ebc=_0x5d1ebc-0x0;var _0x2b1741=_0xc3f4[_0x5d1ebc];return _0x2b1741;};'use strict';var Sequelize=require(_0x4c3f('0x0'));var moment=require(_0x4c3f('0x1'));module[_0x4c3f('0x2')]={'closed':{'type':Sequelize[_0x4c3f('0x3')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x4c3f('0x4')]},'disposition':{'type':Sequelize[_0x4c3f('0x5')]},'note':{'type':Sequelize[_0x4c3f('0x5')]},'phone':{'type':Sequelize[_0x4c3f('0x5')]},'read1stAt':{'type':Sequelize[_0x4c3f('0x4')]},'firstMsgDirection':{'type':Sequelize['ENUM']('in','out'),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x4c3f('0x4')]},'lastMsgDirection':{'type':Sequelize[_0x4c3f('0x6')]('in',_0x4c3f('0x7')),'defaultValue':'in','allowNull':![]}}; \ No newline at end of file +var _0x186a=['BOOLEAN','DATE','STRING','ENUM','out','sequelize','moment','exports'];(function(_0x54eab6,_0x5e262f){var _0x1e7435=function(_0x468c91){while(--_0x468c91){_0x54eab6['push'](_0x54eab6['shift']());}};_0x1e7435(++_0x5e262f);}(_0x186a,0x75));var _0xa186=function(_0x2169d3,_0x333b7c){_0x2169d3=_0x2169d3-0x0;var _0x49551c=_0x186a[_0x2169d3];return _0x49551c;};'use strict';var Sequelize=require(_0xa186('0x0'));var moment=require(_0xa186('0x1'));module[_0xa186('0x2')]={'closed':{'type':Sequelize[_0xa186('0x3')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xa186('0x4')]},'disposition':{'type':Sequelize[_0xa186('0x5')]},'note':{'type':Sequelize['STRING']},'phone':{'type':Sequelize[_0xa186('0x5')]},'read1stAt':{'type':Sequelize[_0xa186('0x4')]},'firstMsgDirection':{'type':Sequelize[_0xa186('0x6')]('in',_0xa186('0x7')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0xa186('0x4')]},'lastMsgDirection':{'type':Sequelize[_0xa186('0x6')]('in',_0xa186('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 74aeb8e..86e6d86 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 _0x7a54=['attachments','Attachment','direction','secret','WhatsappAccount','Account','Owner','mkdirSync','30px','%s\x20#%d','Whatsapp','YYYY-MM-DD','YYYY-MM-DD\x20HH:mm:ss','closedAt','disposition','Messages','basename','existsSync','createReadStream','pipe','createWriteStream','System','out','renderFile','views','downloadInteraction.html','toFile','transcript-','.pdf','download','log','err','unlinkSync','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','ejs','squel','crypto','desk.js','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','socket.io-emitter','./whatsappInteraction.socket','register','sendStatus','end','status','count','offset','limit','set','json','apply','reject','update','destroy','then','error','stack','name','send','Users','map','fullname','TagIds','Tags','split','push','catch','index','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filters','select','color','tools_tags','u.id','field','ui.WhatsappInteractionId','user_has_whatsapp_interactions','left_join','users','u.id\x20=\x20ui.UserId','from','whatsapp_interactions','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','whatsapp_accounts','whatsapp_messages','whatsapp_interaction_has_tags','expr','search','parseSearch','sqlOperator','conditions','find','unreadMessages','having','`\x20=\x200','`\x20>\x200','Contact','operator','$substring','value','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','text','Tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','UserId','buildExpression','start','body','isEmpty','WhatsappAccountId','i.WhatsappAccountId\x20IN\x20?','concat','createdAt','$gte','parse','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','filter','isNumeric','i.id\x20LIKE\x20?','i.phone\x20LIKE\x20?','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','group','i.id','Sequelize','QueryTypes','SELECT','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','forEach','DESC','t.id\x20IN\x20?','resolve','i.WhatsappAccountId\x20IS\x20NOT\x20NULL','user','i.WhatsappAccountId\x20IS\x20NULL','sequelize','toString','keyBy','merge','Account.key','Account.mandatoryDisposition','i.*','c.firstName','c.lastName','Contact.lastName','c.email','Contact.email','Contact.phone','c.mobile','c.fax','Contact.fax','Owner.fullname','o.internal','Owner.internal','ui.WhatsappInteractionId\x20IN\x20?','WhatsappInteractionId','rows','show','params','includeAll','include','WhatsappInteraction','create','addMessage','WhatsappMessage','omit','ids','getMessages','findOne','format','options','findAll','emit','removeTags','unix','root','files','tmp','server','join','transcript-%d-%s.zip','User','firstName','lastName'];(function(_0x368fb9,_0x1a9895){var _0x4892fb=function(_0x28d735){while(--_0x28d735){_0x368fb9['push'](_0x368fb9['shift']());}};_0x4892fb(++_0x1a9895);}(_0x7a54,0x106));var _0x47a5=function(_0x24289b,_0x2e8d17){_0x24289b=_0x24289b-0x0;var _0x158e8d=_0x7a54[_0x24289b];return _0x158e8d;};'use strict';var pdf=require(_0x47a5('0x0'));var emlformat=require(_0x47a5('0x1'));var rimraf=require(_0x47a5('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x47a5('0x3'));var rp=require(_0x47a5('0x4'));var moment=require('moment');var BPromise=require(_0x47a5('0x5'));var Mustache=require(_0x47a5('0x6'));var util=require(_0x47a5('0x7'));var path=require(_0x47a5('0x8'));var sox=require(_0x47a5('0x9'));var csv=require('to-csv');var ejs=require(_0x47a5('0xa'));var fs=require('fs');var _=require('lodash');var squel=require(_0x47a5('0xb'));var crypto=require(_0x47a5('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x47a5('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x47a5('0xe'));var authService=require(_0x47a5('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x47a5('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x47a5('0x11'));var utils=require(_0x47a5('0x12'));var config=require(_0x47a5('0x13'));var db=require(_0x47a5('0x14'))['db'];config[_0x47a5('0x15')]=_[_0x47a5('0x16')](config[_0x47a5('0x15')],{'host':'localhost','port':0x18eb});var socket=require(_0x47a5('0x17'))(new Redis(config[_0x47a5('0x15')]));require(_0x47a5('0x18'))[_0x47a5('0x19')](socket);function respondWithStatusCode(_0x139f25,_0x620ee9){_0x620ee9=_0x620ee9||0xcc;return function(_0x3c6c46){if(_0x3c6c46){return _0x139f25[_0x47a5('0x1a')](_0x620ee9);}return _0x139f25['status'](_0x620ee9)[_0x47a5('0x1b')]();};}function respondWithResult(_0x11faf5,_0x3b001e){_0x3b001e=_0x3b001e||0xc8;return function(_0x2a2cbb){if(_0x2a2cbb){return _0x11faf5[_0x47a5('0x1c')](_0x3b001e)['json'](_0x2a2cbb);}};}function respondWithFilteredResult(_0x549de3,_0x138bc0){return function(_0x4b966e){if(_0x4b966e){var _0x5247fd=_0x4b966e[_0x47a5('0x1d')],_0x423a81=_0x138bc0[_0x47a5('0x1e')],_0xaf70a6=_0x138bc0[_0x47a5('0x1e')]+_0x138bc0[_0x47a5('0x1f')],_0x2ce454;if(_0xaf70a6>=_0x5247fd){_0xaf70a6=_0x5247fd;_0x2ce454=0xc8;}else{_0x2ce454=0xce;}_0x549de3[_0x47a5('0x1c')](_0x2ce454);return _0x549de3[_0x47a5('0x20')]('Content-Range',_0x423a81+'-'+_0xaf70a6+'/'+_0x5247fd)[_0x47a5('0x21')](_0x4b966e);}return null;};}function patchUpdates(_0xf160ba){return function(_0x47cf3c){try{jsonpatch[_0x47a5('0x22')](_0x47cf3c,_0xf160ba,!![]);}catch(_0x1f03f7){return BPromise[_0x47a5('0x23')](_0x1f03f7);}return _0x47cf3c['save']();};}function saveUpdates(_0xb8ae6c,_0x2f142b){return function(_0x23db32){if(_0x23db32){return _0x23db32[_0x47a5('0x24')](_0xb8ae6c)['then'](function(_0xe2dea9){return _0xe2dea9;});}return null;};}function removeEntity(_0x385687,_0x513981){return function(_0x28747d){if(_0x28747d){return _0x28747d[_0x47a5('0x25')]()[_0x47a5('0x26')](function(){_0x385687[_0x47a5('0x1c')](0xcc)[_0x47a5('0x1b')]();});}};}function handleEntityNotFound(_0x50bf17,_0x53078a){return function(_0x136745){if(!_0x136745){_0x50bf17['sendStatus'](0x194);}return _0x136745;};}function handleError(_0x1ea9c8,_0x5b6c4e){_0x5b6c4e=_0x5b6c4e||0x1f4;return function(_0x23cb77){logger[_0x47a5('0x27')](_0x23cb77[_0x47a5('0x28')]);if(_0x23cb77[_0x47a5('0x29')]){delete _0x23cb77[_0x47a5('0x29')];}_0x1ea9c8[_0x47a5('0x1c')](_0x5b6c4e)[_0x47a5('0x2a')](_0x23cb77);};}function getInteractionUsers(_0x136b14,_0x16631f){return new BPromise(function(_0x361bfa,_0x1127f8){try{if(_0x16631f[_0x136b14['id']]){_0x136b14[_0x47a5('0x2b')]=_[_0x47a5('0x2c')](_0x16631f[_0x136b14['id']],function(_0x528582){return{'id':_0x528582['id'],'fullname':_0x528582[_0x47a5('0x2d')]};});}}catch(_0x51833b){_0x1127f8(_0x51833b);}_0x361bfa(_0x136b14);});}function getInteractionTags(_0x2ef875,_0x9ac908){return new BPromise(function(_0x16901f,_0x4d6b57){try{if(_0x2ef875[_0x47a5('0x2e')]){_0x2ef875[_0x47a5('0x2f')]=[];_0x2ef875[_0x47a5('0x2e')][_0x47a5('0x30')](',')['forEach'](function(_0x50d875){_0x2ef875[_0x47a5('0x2f')][_0x47a5('0x31')](_0x9ac908[_0x50d875]);});}delete _0x2ef875['TagIds'];}catch(_0x4e1006){_0x4d6b57(_0x4e1006);}_0x16901f(_0x2ef875);});}function updateWhatsappInteraction(_0x836303,_0x51544e,_0x57bff6){return new BPromise(function(_0x42f70c,_0x53119b){return getInteractionUsers(_0x836303,_0x57bff6)[_0x47a5('0x26')](function(_0xd972c){return getInteractionTags(_0xd972c,_0x51544e);})['then'](function(_0x4843c0){_0x42f70c(_0x4843c0);})[_0x47a5('0x32')](function(_0x5910bb){_0x53119b(_0x5910bb);});});}exports[_0x47a5('0x33')]=function(_0x87e4c9,_0xf269a8){var _0x52749b={},_0x18f7e9={},_0x50c086={'count':0x0,'rows':[]};var _0x53c754=_[_0x47a5('0x2c')](db['WhatsappInteraction'][_0x47a5('0x34')],function(_0x5ef577){return{'name':_0x5ef577[_0x47a5('0x35')],'type':_0x5ef577[_0x47a5('0x36')][_0x47a5('0x37')]};});_0x18f7e9[_0x47a5('0x38')]=_[_0x47a5('0x2c')](_0x53c754,_0x47a5('0x29'));_0x18f7e9[_0x47a5('0x39')]=_[_0x47a5('0x3a')](_0x87e4c9[_0x47a5('0x39')]);_0x18f7e9['filters']=_[_0x47a5('0x3b')](_0x18f7e9[_0x47a5('0x38')],_0x18f7e9['query']);_0x52749b[_0x47a5('0x3c')]=_[_0x47a5('0x3b')](_0x18f7e9[_0x47a5('0x38')],qs['fields'](_0x87e4c9[_0x47a5('0x39')][_0x47a5('0x3d')]));_0x52749b['attributes']=_0x52749b[_0x47a5('0x3c')][_0x47a5('0x3e')]?_0x52749b['attributes']:_0x18f7e9['model'];if(!_0x87e4c9['query'][_0x47a5('0x3f')]('nolimit')){_0x52749b[_0x47a5('0x1f')]=qs[_0x47a5('0x1f')](_0x87e4c9[_0x47a5('0x39')][_0x47a5('0x1f')]);_0x52749b[_0x47a5('0x1e')]=qs[_0x47a5('0x1e')](_0x87e4c9[_0x47a5('0x39')][_0x47a5('0x1e')]);}_0x52749b[_0x47a5('0x40')]=qs[_0x47a5('0x41')](_0x87e4c9[_0x47a5('0x39')][_0x47a5('0x41')]);_0x52749b[_0x47a5('0x42')]=qs['filters'](_[_0x47a5('0x43')](_0x87e4c9[_0x47a5('0x39')],_0x18f7e9[_0x47a5('0x44')]),_0x53c754);var _0x23bd8d=[];var _0x586f4f=squel[_0x47a5('0x45')]()['field']('id')['field']('name')['field'](_0x47a5('0x46'))['from'](_0x47a5('0x47'));var _0x3a740b=squel[_0x47a5('0x45')]()['field'](_0x47a5('0x48'))[_0x47a5('0x49')]('u.fullname')['field'](_0x47a5('0x4a'))['from'](_0x47a5('0x4b'),'ui')[_0x47a5('0x4c')](_0x47a5('0x4d'),'u',_0x47a5('0x4e'));var _0x34a9ae=squel[_0x47a5('0x45')]()[_0x47a5('0x4f')](_0x47a5('0x50'),'i')[_0x47a5('0x4c')](_0x47a5('0x51'),'c',_0x47a5('0x52'))[_0x47a5('0x4c')](_0x47a5('0x4d'),'o',_0x47a5('0x53'))[_0x47a5('0x4c')](_0x47a5('0x54'),'a','a.id\x20=\x20i.WhatsappAccountId')[_0x47a5('0x4c')](_0x47a5('0x55'),'me','me.WhatsappInteractionId\x20=\x20i.id')['left_join'](_0x47a5('0x56'),'it','it.WhatsappInteractionId\x20=\x20i.id')[_0x47a5('0x4c')](_0x47a5('0x47'),'t','t.id\x20=\x20it.TagId');var _0x4f62d3=squel[_0x47a5('0x57')]();var _0x52d409=[];var _0x2d147c=squel[_0x47a5('0x57')]();var _0x3548bc;if(_0x87e4c9[_0x47a5('0x39')][_0x47a5('0x58')]){_0x3548bc=as[_0x47a5('0x59')](_0x87e4c9[_0x47a5('0x39')]['search']);var _0x48a0ef=_0x3548bc[_0x47a5('0x5a')];for(var _0x411230=0x0;_0x411230<_0x3548bc[_0x47a5('0x5b')][_0x47a5('0x3e')];_0x411230++){var _0x2c7020=_0x3548bc[_0x47a5('0x5b')][_0x411230];var _0x249de5='i';var _0x492cf7=_[_0x47a5('0x5c')](_0x53c754,[_0x47a5('0x29'),_0x2c7020[_0x47a5('0x49')]]);if(!_0x492cf7){switch(_0x2c7020['field']){case _0x47a5('0x5d'):if(_0x2c7020['value']==0x1){_0x34a9ae[_0x47a5('0x5e')]('`'+_0x2c7020[_0x47a5('0x49')]+_0x47a5('0x5f'));}else{_0x34a9ae[_0x47a5('0x5e')]('`'+_0x2c7020['field']+_0x47a5('0x60'));}break;case _0x47a5('0x61'):if(_0x2c7020[_0x47a5('0x62')]===_0x47a5('0x63')){if(_0x2c7020[_0x47a5('0x64')][_0x47a5('0x30')]('\x20')[_0x47a5('0x3e')]>0x1){_0x4f62d3[_0x48a0ef]('MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0x47a5('0x65')](_0x2c7020[_0x47a5('0x64')]),null);}else{var _0x187d7e='%'+_0x2c7020[_0x47a5('0x64')]+'%';_0x4f62d3[_0x48a0ef](_0x47a5('0x66'),_0x187d7e,_0x187d7e,_0x187d7e);}}else{_0x492cf7=_[_0x47a5('0x5c')](_0x53c754,['name',_0x47a5('0x67')]);_0x2c7020[_0x47a5('0x49')]=_0x47a5('0x67');_0x5cbe97=as['buildExpression'](_0x249de5,_0x492cf7[_0x47a5('0x36')],_0x2c7020);_0x4f62d3[_0x48a0ef](_0x5cbe97[_0x47a5('0x68')],_0x5cbe97[_0x47a5('0x64')]['start'],_0x5cbe97['value'][_0x47a5('0x1b')]);}break;case _0x47a5('0x69'):var _0x4fa1da=_0x2c7020['value'][_0x47a5('0x30')](',')['map'](function(_0x16bb8a){return Number(_0x16bb8a);});_0x4fa1da['forEach'](function(_0x482de6){_0x2d147c['or'](_0x47a5('0x6a'),'%,'+_0x482de6+',%');});_0x52d409=_[_0x47a5('0x6b')](_0x52d409,_0x4fa1da);break;case'User':if(_0x2c7020[_0x47a5('0x62')]===_0x47a5('0x63')){_0x4f62d3[_0x48a0ef]('CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','%'+_0x2c7020['value']+'%',null);}else{_0x492cf7=_[_0x47a5('0x5c')](_0x53c754,[_0x47a5('0x29'),_0x47a5('0x6c')]);_0x2c7020[_0x47a5('0x49')]='UserId';_0x5cbe97=as[_0x47a5('0x6d')](_0x249de5,_0x492cf7[_0x47a5('0x36')],_0x2c7020);_0x4f62d3[_0x48a0ef](_0x5cbe97[_0x47a5('0x68')],_0x5cbe97['value'][_0x47a5('0x6e')],_0x5cbe97['value'][_0x47a5('0x1b')]);}break;case _0x47a5('0x6f'):_0x5cbe97=as[_0x47a5('0x6d')]('me',null,_0x2c7020);_0x4f62d3[_0x48a0ef](_0x5cbe97[_0x47a5('0x68')],_0x5cbe97[_0x47a5('0x64')]['start'],_0x5cbe97[_0x47a5('0x64')]['end']);break;}}else{var _0x5cbe97=as['buildExpression'](_0x249de5,_0x492cf7['type'],_0x2c7020);_0x4f62d3[_0x48a0ef](_0x5cbe97[_0x47a5('0x68')],_0x5cbe97[_0x47a5('0x64')][_0x47a5('0x6e')],_0x5cbe97['value']['end']);}}}else{var _0x139229=_(_0x87e4c9[_0x47a5('0x39')])[_0x47a5('0x3a')]()[_0x47a5('0x2c')](function(_0xc45e25){return _['some'](_0x53c754,[_0x47a5('0x29'),_0xc45e25])?_0xc45e25:undefined;})['compact']()[_0x47a5('0x64')]();if(!_[_0x47a5('0x70')](_0x139229)){_0x139229['forEach'](function(_0x32b4de){if(_0x32b4de===_0x47a5('0x71')){_0x34a9ae[_0x47a5('0x42')](_0x47a5('0x72'),[][_0x47a5('0x73')](_0x87e4c9[_0x47a5('0x39')][_0x32b4de]));}else if(_0x32b4de===_0x47a5('0x74')){var _0x3ac38c=JSON['parse'](_0x87e4c9[_0x47a5('0x39')][_0x32b4de])[_0x47a5('0x75')];var _0x3c75c6=JSON[_0x47a5('0x76')](_0x87e4c9[_0x47a5('0x39')][_0x32b4de])['$lte'];_0x34a9ae[_0x47a5('0x42')](_0x47a5('0x77'),_0x3ac38c,_0x3c75c6);}else{if(_0x87e4c9[_0x47a5('0x39')][_0x32b4de]===_0x47a5('0x78')){_0x34a9ae[_0x47a5('0x42')]('i.'+_0x32b4de+_0x47a5('0x79'));}else{_0x34a9ae[_0x47a5('0x42')]('i.'+_0x32b4de+_0x47a5('0x7a'),_0x87e4c9[_0x47a5('0x39')][_0x32b4de]);}}});}if(_0x87e4c9[_0x47a5('0x39')][_0x47a5('0x7b')]){if(_0x87e4c9[_0x47a5('0x39')][_0x47a5('0x7b')]==0x1){_0x34a9ae[_0x47a5('0x5e')](_0x47a5('0x7c'));}else{_0x34a9ae['having'](_0x47a5('0x7d'));}}if(_0x87e4c9[_0x47a5('0x39')][_0x47a5('0x7e')]){_0x52d409=_['isArray'](_0x87e4c9[_0x47a5('0x39')][_0x47a5('0x7e')])?_0x87e4c9[_0x47a5('0x39')][_0x47a5('0x7e')]:new Array(_0x87e4c9['query'][_0x47a5('0x7e')]);_0x52d409['forEach'](function(_0x2d5ee6){_0x2d147c['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x2d5ee6+',%');});}if(_0x87e4c9[_0x47a5('0x39')]['filter']){var _0x7c1190=_0x87e4c9[_0x47a5('0x39')][_0x47a5('0x7f')]['replace']('\x5c','\x5c\x5c')['replace']('\x27\x27','\x27\x27\x27\x27');if(qs[_0x47a5('0x80')](_0x7c1190)){_0x4f62d3['or'](_0x47a5('0x81'),_0x7c1190+'%')['or'](_0x47a5('0x82'),_0x7c1190+'%');}else{_0x4f62d3['or'](_0x47a5('0x83'),qs['getFullTextValue'](_0x7c1190))['or'](_0x47a5('0x84'),_0x7c1190+'%');}}}_0x34a9ae[_0x47a5('0x42')](_0x4f62d3);_0x34a9ae[_0x47a5('0x85')](_0x47a5('0x86'));var _0x308c9a={'type':db[_0x47a5('0x87')][_0x47a5('0x88')][_0x47a5('0x89')],'raw':!![]};var _0x4618a0=_0x34a9ae[_0x47a5('0x8a')]();_0x4618a0[_0x47a5('0x49')](_0x47a5('0x86'));_0x4618a0['field'](_0x47a5('0x8b'),'unreadMessages');if(_0x52749b[_0x47a5('0x40')]){_0x52749b[_0x47a5('0x40')][_0x47a5('0x8c')](function(_0x12fec9){_0x34a9ae[_0x47a5('0x40')]('i.'+_0x12fec9[0x0],_0x12fec9[0x1]===_0x47a5('0x8d')?![]:!![]);});}if(!_[_0x47a5('0x70')](_0x52d409)){_0x34a9ae[_0x47a5('0x5e')](_0x2d147c);_0x4618a0[_0x47a5('0x42')](_0x47a5('0x8e'),_0x52d409);}BPromise[_0x47a5('0x8f')]()[_0x47a5('0x26')](function(){if(!_0x3548bc){if(_0x87e4c9[_0x47a5('0x39')][_0x47a5('0x71')]||_0x87e4c9[_0x47a5('0x39')]['journey'])return;_0x4618a0['where']('i.WhatsappAccountId\x20IS\x20NOT\x20NULL');_0x34a9ae['where'](_0x47a5('0x90'));return;}return _0x87e4c9[_0x47a5('0x91')]['getWhatsappAccounts']({'attributes':['id'],'raw':!![]})[_0x47a5('0x26')](function(_0x44dda2){if(_[_0x47a5('0x70')](_0x44dda2)){_0x4618a0[_0x47a5('0x42')](_0x47a5('0x92'));_0x34a9ae[_0x47a5('0x42')](_0x47a5('0x92'));}else{_0x4618a0[_0x47a5('0x42')](_0x47a5('0x72'),_[_0x47a5('0x2c')](_0x44dda2,'id'));_0x34a9ae[_0x47a5('0x42')]('i.WhatsappAccountId\x20IN\x20?',_[_0x47a5('0x2c')](_0x44dda2,'id'));}});})[_0x47a5('0x26')](function(){db[_0x47a5('0x93')]['query'](_0x4618a0[_0x47a5('0x94')](),_0x308c9a)[_0x47a5('0x26')](function(_0x17b61d){_0x50c086['count']=_0x17b61d[_0x47a5('0x3e')];if(_0x50c086['count']===0x0)return[];return db['sequelize'][_0x47a5('0x39')](_0x586f4f[_0x47a5('0x94')](),_0x308c9a)[_0x47a5('0x26')](function(_0x27333e){_0x23bd8d=_[_0x47a5('0x95')](_0x27333e,'id');_0x308c9a=_[_0x47a5('0x96')](_0x308c9a,{'model':db['WhatsappInteraction'],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x87e4c9['query'][_0x47a5('0x3d')]){_0x52749b['attributes'][_0x47a5('0x8c')](function(_0x3fffd1){_0x34a9ae[_0x47a5('0x49')]('i.'+_0x3fffd1);});}else{_0x34a9ae[_0x47a5('0x49')]('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0x47a5('0x5d'));_0x34a9ae['field']('a.key',_0x47a5('0x97'));_0x34a9ae[_0x47a5('0x49')]('a.mandatoryDisposition',_0x47a5('0x98'));_0x34a9ae[_0x47a5('0x49')](_0x47a5('0x99'));_0x34a9ae['field'](_0x47a5('0x9a'),'Contact.firstName');_0x34a9ae[_0x47a5('0x49')](_0x47a5('0x9b'),_0x47a5('0x9c'));_0x34a9ae['field'](_0x47a5('0x9d'),_0x47a5('0x9e'));_0x34a9ae[_0x47a5('0x49')]('c.phone',_0x47a5('0x9f'));_0x34a9ae['field'](_0x47a5('0xa0'),'Contact.mobile');_0x34a9ae[_0x47a5('0x49')](_0x47a5('0xa1'),_0x47a5('0xa2'));_0x34a9ae[_0x47a5('0x49')]('o.fullname',_0x47a5('0xa3'));_0x34a9ae[_0x47a5('0x49')](_0x47a5('0xa4'),_0x47a5('0xa5'));_0x34a9ae[_0x47a5('0x49')]('GROUP_CONCAT(DISTINCT\x20t.id)','TagIds');}if(_0x52749b[_0x47a5('0x1f')])_0x34a9ae['limit'](_0x52749b[_0x47a5('0x1f')]);if(_0x52749b[_0x47a5('0x1e')])_0x34a9ae[_0x47a5('0x1e')](_0x52749b['offset']);return db[_0x47a5('0x93')][_0x47a5('0x39')](_0x34a9ae['toString'](),_0x308c9a);})[_0x47a5('0x26')](function(_0x8a9dea){_0x3a740b[_0x47a5('0x42')](_0x47a5('0xa6'),_['map'](_0x8a9dea,'id'));return db['sequelize'][_0x47a5('0x39')](_0x3a740b[_0x47a5('0x94')](),_0x308c9a)['then'](function(_0x27d422){var _0x23f055=_['groupBy'](_0x27d422,_0x47a5('0xa7'));var _0x2a02cd=[];_0x8a9dea[_0x47a5('0x8c')](function(_0x59f010){_0x2a02cd[_0x47a5('0x31')](updateWhatsappInteraction(_0x59f010,_0x23bd8d,_0x23f055));});return BPromise['all'](_0x2a02cd);});});})[_0x47a5('0x26')](function(_0x5e2946){_0x50c086[_0x47a5('0xa8')]=_0x5e2946;return _0x50c086;})[_0x47a5('0x26')](respondWithFilteredResult(_0xf269a8,_0x52749b));})['catch'](handleError(_0xf269a8,null));};exports[_0x47a5('0xa9')]=function(_0x597cb2,_0x1eabef){var _0x36f619={'raw':![],'where':{'id':_0x597cb2[_0x47a5('0xaa')]['id']}},_0x37e045={};_0x37e045['model']=_[_0x47a5('0x3a')](db['WhatsappInteraction']['rawAttributes']);_0x37e045[_0x47a5('0x39')]=_[_0x47a5('0x3a')](_0x597cb2[_0x47a5('0x39')]);_0x37e045[_0x47a5('0x44')]=_[_0x47a5('0x3b')](_0x37e045['model'],_0x37e045[_0x47a5('0x39')]);_0x36f619[_0x47a5('0x3c')]=_[_0x47a5('0x3b')](_0x37e045[_0x47a5('0x38')],qs['fields'](_0x597cb2[_0x47a5('0x39')]['fields']));_0x36f619[_0x47a5('0x3c')]=_0x36f619[_0x47a5('0x3c')][_0x47a5('0x3e')]?_0x36f619[_0x47a5('0x3c')]:_0x37e045[_0x47a5('0x38')];if(_0x597cb2[_0x47a5('0x39')][_0x47a5('0xab')]){_0x36f619[_0x47a5('0xac')]=[{'all':!![]}];}_0x36f619=_[_0x47a5('0x96')]({},_0x36f619,_0x597cb2['options']);return db[_0x47a5('0xad')][_0x47a5('0x5c')](_0x36f619)['then'](handleEntityNotFound(_0x1eabef,null))[_0x47a5('0x26')](respondWithResult(_0x1eabef,null))[_0x47a5('0x32')](handleError(_0x1eabef,null));};exports[_0x47a5('0xae')]=function(_0x5b85cd,_0x4bf1f5){return db[_0x47a5('0xad')][_0x47a5('0xae')](_0x5b85cd['body'],{})['then'](respondWithResult(_0x4bf1f5,0xc9))[_0x47a5('0x32')](handleError(_0x4bf1f5,null));};exports[_0x47a5('0x24')]=function(_0x54eab1,_0x29e384){if(_0x54eab1[_0x47a5('0x6f')]['id']){delete _0x54eab1['body']['id'];}return db[_0x47a5('0xad')][_0x47a5('0x5c')]({'where':{'id':_0x54eab1[_0x47a5('0xaa')]['id']}})[_0x47a5('0x26')](handleEntityNotFound(_0x29e384,null))[_0x47a5('0x26')](saveUpdates(_0x54eab1[_0x47a5('0x6f')],null))['then'](respondWithResult(_0x29e384,null))['catch'](handleError(_0x29e384,null));};exports['destroy']=function(_0x133b7a,_0xce5ada){return db['WhatsappInteraction'][_0x47a5('0x5c')]({'where':{'id':_0x133b7a[_0x47a5('0xaa')]['id']}})[_0x47a5('0x26')](handleEntityNotFound(_0xce5ada,null))[_0x47a5('0x26')](removeEntity(_0xce5ada,null))[_0x47a5('0x32')](handleError(_0xce5ada,null));};exports['describe']=function(_0x3e7750,_0x548a06){return db['WhatsappInteraction']['describe']()[_0x47a5('0x26')](respondWithResult(_0x548a06,null))['catch'](handleError(_0x548a06,null));};exports[_0x47a5('0xaf')]=function(_0xf3edc8,_0x5a316e,_0x49f791){return db[_0x47a5('0xb0')][_0x47a5('0x5c')]({'where':{'id':_0xf3edc8[_0x47a5('0xaa')]['id']}})[_0x47a5('0x26')](handleEntityNotFound(_0x5a316e,null))[_0x47a5('0x26')](function(_0x581a87){if(_0x581a87){return _0x581a87[_0x47a5('0xaf')](_0xf3edc8[_0x47a5('0x6f')]['ids'],_[_0x47a5('0xb1')](_0xf3edc8[_0x47a5('0x6f')],[_0x47a5('0xb2'),'id'])||{});}})[_0x47a5('0x26')](respondWithResult(_0x5a316e,null))[_0x47a5('0x32')](handleError(_0x5a316e,null));};exports[_0x47a5('0xb3')]=function(_0x5112d7,_0x6a8174,_0x2e418d){var _0x50b236={'raw':![],'where':{}};var _0x263521={};var _0x9769b5={'count':0x0,'rows':[]};return db[_0x47a5('0xad')][_0x47a5('0xb4')]({'where':{'id':_0x5112d7['params']['id']}})['then'](handleEntityNotFound(_0x6a8174,null))['then'](function(_0x4eee99){if(_0x4eee99){_0x263521[_0x47a5('0x38')]=_[_0x47a5('0x3a')](db[_0x47a5('0xb0')][_0x47a5('0x34')]);_0x263521[_0x47a5('0x39')]=_[_0x47a5('0x3a')](_0x5112d7[_0x47a5('0x39')]);_0x263521[_0x47a5('0x44')]=_['intersection'](_0x263521[_0x47a5('0x38')],_0x263521[_0x47a5('0x39')]);_0x50b236[_0x47a5('0x3c')]=_[_0x47a5('0x3b')](_0x263521['model'],qs['fields'](_0x5112d7[_0x47a5('0x39')]['fields']));_0x50b236['attributes']=_0x50b236[_0x47a5('0x3c')][_0x47a5('0x3e')]?_0x50b236['attributes']:_0x263521[_0x47a5('0x38')];if(!_0x5112d7[_0x47a5('0x39')][_0x47a5('0x3f')]('nolimit')){_0x50b236[_0x47a5('0x1f')]=qs[_0x47a5('0x1f')](_0x5112d7['query'][_0x47a5('0x1f')]);_0x50b236[_0x47a5('0x1e')]=qs[_0x47a5('0x1e')](_0x5112d7[_0x47a5('0x39')][_0x47a5('0x1e')]);}_0x50b236[_0x47a5('0x40')]=qs['sort'](_0x5112d7[_0x47a5('0x39')]['sort']);_0x50b236[_0x47a5('0x42')]=qs[_0x47a5('0x44')](_[_0x47a5('0x43')](_0x5112d7[_0x47a5('0x39')],_0x263521['filters']));_0x50b236[_0x47a5('0x42')][_0x47a5('0xa7')]=_0x4eee99['id'];if(_0x5112d7[_0x47a5('0x39')][_0x47a5('0x7f')]){_0x50b236[_0x47a5('0x42')]=_[_0x47a5('0x96')](_0x50b236[_0x47a5('0x42')],{'$or':_[_0x47a5('0x2c')](_0x50b236[_0x47a5('0x3c')],function(_0xa2045c){var _0x109738={};_0x109738[_0xa2045c]={'$like':'%'+_0x5112d7[_0x47a5('0x39')]['filter']+'%'};return _0x109738;})});}if(_0x5112d7[_0x47a5('0x39')][_0x47a5('0x75')]){var _0x591bde=_0x5112d7[_0x47a5('0x39')][_0x47a5('0x75')][_0x47a5('0x30')](',');var _0x2ccf21={};_0x2ccf21[_0x591bde[0x0]]={'$gte':moment(_0x591bde[0x1])[_0x47a5('0xb5')]('YYYY-MM-DD\x20HH:mm:ss')};_0x50b236[_0x47a5('0x42')]=_[_0x47a5('0x96')](_0x50b236[_0x47a5('0x42')],_0x2ccf21);}_0x50b236=_[_0x47a5('0x96')]({},_0x50b236,_0x5112d7[_0x47a5('0xb6')]);return db[_0x47a5('0xb0')][_0x47a5('0x1d')]({'where':_0x50b236['where']})['then'](function(_0xa3d578){_0x9769b5['count']=_0xa3d578;if(_0x5112d7[_0x47a5('0x39')]['includeAll']){_0x50b236[_0x47a5('0xac')]=[{'all':!![]}];}return db[_0x47a5('0xb0')][_0x47a5('0xb7')](_0x50b236);})[_0x47a5('0x26')](function(_0x49cb8c){_0x9769b5[_0x47a5('0xa8')]=_0x49cb8c;return _0x9769b5;});}})[_0x47a5('0x26')](respondWithFilteredResult(_0x6a8174,_0x50b236))[_0x47a5('0x32')](handleError(_0x6a8174,null));};exports['addTags']=function(_0x581759,_0x30375f,_0x29015a){return db[_0x47a5('0xad')][_0x47a5('0x5c')]({'where':{'id':_0x581759[_0x47a5('0xaa')]['id']}})[_0x47a5('0x26')](handleEntityNotFound(_0x30375f,null))[_0x47a5('0x26')](function(_0xe662d7){if(_0xe662d7){return _0xe662d7['setTags'](_0x581759[_0x47a5('0x6f')]['ids'],_[_0x47a5('0xb1')](_0x581759[_0x47a5('0x6f')],['ids','id'])||{})['spread'](function(){return db[_0x47a5('0x69')][_0x47a5('0xb7')]({'attributes':['id','name',_0x47a5('0x46')],'where':{'id':_0x581759[_0x47a5('0x6f')][_0x47a5('0xb2')]}});})[_0x47a5('0x26')](function(_0x5a7f32){socket[_0x47a5('0xb8')]('whatsappInteractionTags:save',{'id':Number(_0x581759['params']['id']),'tags':_0x5a7f32||[]});return{'id':Number(_0x581759['params']['id']),'tags':_0x5a7f32||[]};});}})[_0x47a5('0x26')](respondWithResult(_0x30375f,null))['catch'](handleError(_0x30375f,null));};exports[_0x47a5('0xb9')]=function(_0x156d51,_0x401139,_0x2005d5){return db[_0x47a5('0xad')][_0x47a5('0x5c')]({'where':{'id':_0x156d51[_0x47a5('0xaa')]['id']}})[_0x47a5('0x26')](handleEntityNotFound(_0x401139,null))[_0x47a5('0x26')](function(_0x2200f9){if(_0x2200f9){return _0x2200f9[_0x47a5('0xb9')](_0x156d51[_0x47a5('0x39')][_0x47a5('0xb2')]);}})[_0x47a5('0x26')](respondWithStatusCode(_0x401139,null))[_0x47a5('0x32')](handleError(_0x401139,null));};exports['download']=function(_0xdd95c8,_0x40aee5){var _0x322cee=moment()[_0x47a5('0xba')]()['toString']();var _0x367662=path['join'](config[_0x47a5('0xbb')],'server',_0x47a5('0xbc'),_0x47a5('0xbd'));var _0x3b894d=path['join'](config[_0x47a5('0xbb')],_0x47a5('0xbe'),_0x47a5('0xbc'),'attachments');var _0x52798d=path[_0x47a5('0xbf')](_0x367662,_0x322cee);var _0x1a5e07=util[_0x47a5('0xb5')](_0x47a5('0xc0'),_0xdd95c8[_0x47a5('0xaa')]['id'],_0x322cee);var _0x579e5c=path[_0x47a5('0xbf')](_0x367662,_0x1a5e07);var _0x4b3ae4=[];_0x4b3ae4[_0x47a5('0x31')]({'model':db[_0x47a5('0xc1')],'as':_0x47a5('0xc1'),'attributes':['id',_0x47a5('0x2d')],'raw':!![]});_0x4b3ae4['push']({'model':db['CmContact'],'as':_0x47a5('0x61'),'attributes':['id',_0x47a5('0xc2'),_0x47a5('0xc3')],'raw':!![]});if(_0xdd95c8[_0x47a5('0x39')][_0x47a5('0xc4')]){_0x4b3ae4[_0x47a5('0x31')]({'model':db[_0x47a5('0xc5')],'as':_0x47a5('0xc5'),'raw':!![]});}var _0x2c2245=[{'model':db['WhatsappMessage'],'as':'Messages','attributes':['id',_0x47a5('0x6f'),'createdAt',_0x47a5('0xc6'),_0x47a5('0xc7'),_0x47a5('0x7b')],'include':_0x4b3ae4}];_0x2c2245['push']({'model':db[_0x47a5('0xc8')],'as':_0x47a5('0xc9'),'attributes':['id','name']});_0x2c2245[_0x47a5('0x31')]({'model':db['User'],'as':_0x47a5('0xca'),'attributes':['id',_0x47a5('0x2d')]});return db[_0x47a5('0xad')]['find']({'where':{'id':_0xdd95c8['params']['id']},'include':_0x2c2245})['then'](handleEntityNotFound(_0x40aee5,null))['then'](function(_0x5075a6){if(_0x5075a6){var _0x1ba5b6=_0x5075a6['get']({'plain':!![]});fs[_0x47a5('0xcb')](_0x52798d);var _0x2287b0={'format':'A4','border':'10px','header':{'height':'40px','contents':{'first':'\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20
Interaction\x20Transcript
\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20'}},'footer':{'height':_0x47a5('0xcc'),'contents':{'default':util['format']('\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20%s\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20{{page}}/{{pages}}\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20%s\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',util['format'](_0x47a5('0xcd'),_0x47a5('0xce'),_0x1ba5b6['id']),moment()[_0x47a5('0xb5')](_0x47a5('0xcf'))['toString']())}}};var _0xdda046={'channel':'Whatsapp','account':_0x1ba5b6[_0x47a5('0xc9')]['name'],'agent':_0x1ba5b6[_0x47a5('0xca')]?_0x1ba5b6[_0x47a5('0xca')][_0x47a5('0x2d')]:'N.A.','createdAt':moment(_0x1ba5b6[_0x47a5('0x74')])[_0x47a5('0xb5')](_0x47a5('0xd0'))[_0x47a5('0x94')](),'closedAt':_0x1ba5b6['closed']?moment(_0x1ba5b6[_0x47a5('0xd1')])[_0x47a5('0xb5')](_0x47a5('0xd0'))[_0x47a5('0x94')]():'','disposition':_0x1ba5b6[_0x47a5('0xd2')],'messages':_(_0x1ba5b6[_0x47a5('0xd3')])['filter']({'secret':![]})[_0x47a5('0x2c')](function(_0xe245ca){if(_0xe245ca[_0x47a5('0xc5')]){var _0xac8d4f=path[_0x47a5('0xbf')](_0x3b894d,_0xe245ca[_0x47a5('0xc5')][_0x47a5('0xd4')]);if(fs[_0x47a5('0xd5')](_0xac8d4f)){fs[_0x47a5('0xd6')](_0xac8d4f)[_0x47a5('0xd7')](fs[_0x47a5('0xd8')](path[_0x47a5('0xbf')](_0x52798d,_0xe245ca[_0x47a5('0xc5')][_0x47a5('0xd4')])));}}return{'date':moment(_0xe245ca[_0x47a5('0x74')])[_0x47a5('0xb5')](_0x47a5('0xd0'))['toString'](),'sender':_0xe245ca[_0x47a5('0xc6')]==='out'?_0xe245ca['User']?_0xe245ca[_0x47a5('0xc1')][_0x47a5('0x2d')]:_0x47a5('0xd9'):_0xe245ca['Contact'][_0x47a5('0xc2')]+(_0xe245ca[_0x47a5('0x61')][_0x47a5('0xc3')]?'\x20'+_0xe245ca[_0x47a5('0x61')][_0x47a5('0xc3')]:''),'body':_0xe245ca[_0x47a5('0xc5')]?_0xe245ca[_0x47a5('0xc5')][_0x47a5('0xd4')]:_0xe245ca[_0x47a5('0x6f')],'direction':_0xe245ca[_0x47a5('0xc6')]===_0x47a5('0xda')?'A':'C','secret':_0xe245ca[_0x47a5('0xc7')],'read':_0xe245ca[_0x47a5('0x7b')],'attachment':_0xe245ca['Attachment']};})['value']()};return ejs[_0x47a5('0xdb')](path['join'](config[_0x47a5('0xbb')],_0x47a5('0xbe'),_0x47a5('0xdc'),_0x47a5('0xdd')),{'interaction':_0xdda046})[_0x47a5('0x26')](function(_0x3708ea){return new BPromise(function(_0x583b37,_0x2b4039){pdf[_0x47a5('0xae')](_0x3708ea,_0x2287b0)[_0x47a5('0xde')](path['join'](_0x52798d,_0x47a5('0xdf')+_0x1ba5b6['id']+'-'+_0x322cee+_0x47a5('0xe0')),function(_0x3ecc41,_0x3e4148){if(_0x3ecc41)return _0x2b4039(_0x3ecc41);_0x583b37(_0x3e4148);});});})[_0x47a5('0x26')](function(){return new BPromise(function(_0x23e649,_0x35e20f){zipdir(_0x52798d,{'saveTo':_0x579e5c},function(_0x46615a,_0xd6e255){if(_0x46615a)return _0x35e20f(_0x46615a);return _0x23e649(_0xd6e255);});})[_0x47a5('0x26')](function(){return new BPromise(function(_0x1b91ad,_0x40b7a5){rimraf(_0x52798d,function(_0x28e998){if(_0x28e998)_0x40b7a5(_0x28e998);return _0x1b91ad();});});})[_0x47a5('0x26')](function(){return _0x40aee5[_0x47a5('0xe1')](_0x579e5c,_0x1a5e07,function(_0x3f7fdc){if(_0x3f7fdc){console[_0x47a5('0xe2')](_0x47a5('0xe3'),_0x3f7fdc);}else{fs[_0x47a5('0xe4')](_0x579e5c);}});});});}else{return _0x40aee5[_0x47a5('0x1a')](0xc8);}})[_0x47a5('0x32')](handleError(_0x40aee5,null));}; \ No newline at end of file +var _0xc4aa=['status','end','json','count','offset','set','Content-Range','apply','save','update','then','destroy','error','stack','name','send','map','fullname','TagIds','Tags','split','push','catch','WhatsappInteraction','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','hasOwnProperty','nolimit','limit','sort','where','pick','select','field','color','from','u.id','u.fullname','ui.WhatsappInteractionId','user_has_whatsapp_interactions','left_join','users','u.id\x20=\x20ui.UserId','whatsapp_interactions','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','a.id\x20=\x20i.WhatsappAccountId','whatsapp_messages','me.WhatsappInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','parseSearch','search','sqlOperator','conditions','find','unreadMessages','value','having','`\x20=\x200','Contact','operator','length','getFullTextValue','ContactId','buildExpression','type','start','Tag','forEach','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','User','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','text','body','some','compact','isEmpty','WhatsappAccountId','i.WhatsappAccountId\x20IN\x20?','concat','parse','$gte','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20=\x20?','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','isArray','tag','filter','replace','\x27\x27\x27\x27','i.phone\x20LIKE\x20?','group','QueryTypes','SELECT','clone','order','journey','i.WhatsappAccountId\x20IS\x20NOT\x20NULL','getWhatsappAccounts','i.WhatsappAccountId\x20IS\x20NULL','sequelize','toString','keyBy','fields','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','Account.key','a.mandatoryDisposition','Account.mandatoryDisposition','c.firstName','Contact.firstName','c.lastName','Contact.lastName','c.email','Contact.email','Contact.phone','c.mobile','Contact.mobile','c.fax','Contact.fax','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.WhatsappInteractionId\x20IN\x20?','groupBy','WhatsappInteractionId','all','rows','show','params','include','merge','create','describe','addMessage','WhatsappMessage','ids','getMessages','findOne','YYYY-MM-DD\x20HH:mm:ss','options','findAll','setTags','omit','emit','whatsappInteractionTags:save','removeTags','unix','join','root','server','files','tmp','attachments','transcript-%d-%s.zip','CmContact','firstName','lastName','Attachment','createdAt','secret','WhatsappAccount','Account','get','mkdirSync','40px','\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20
Interaction\x20Transcript
\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','30px','format','%s\x20#%d','Whatsapp','YYYY-MM-DD','Owner','N.A.','closed','closedAt','disposition','basename','existsSync','createReadStream','pipe','createWriteStream','direction','out','System','downloadInteraction.html','transcript-','download','log','err','unlinkSync','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','util','path','sox','to-csv','ejs','lodash','squel','crypto','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./whatsappInteraction.socket','register','sendStatus'];(function(_0x359354,_0x441c6a){var _0x46d78d=function(_0x201a92){while(--_0x201a92){_0x359354['push'](_0x359354['shift']());}};_0x46d78d(++_0x441c6a);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x88cd7b,_0x4c884c){_0x88cd7b=_0x88cd7b-0x0;var _0x56fcc8=_0xc4aa[_0x88cd7b];return _0x56fcc8;};'use strict';var pdf=require(_0xac4a('0x0'));var emlformat=require(_0xac4a('0x1'));var rimraf=require(_0xac4a('0x2'));var zipdir=require(_0xac4a('0x3'));var jsonpatch=require(_0xac4a('0x4'));var rp=require(_0xac4a('0x5'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xac4a('0x6'));var path=require(_0xac4a('0x7'));var sox=require(_0xac4a('0x8'));var csv=require(_0xac4a('0x9'));var ejs=require(_0xac4a('0xa'));var fs=require('fs');var _=require(_0xac4a('0xb'));var squel=require(_0xac4a('0xc'));var crypto=require(_0xac4a('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xac4a('0x9'));var querystring=require(_0xac4a('0xe'));var Papa=require(_0xac4a('0xf'));var Redis=require('ioredis');var authService=require(_0xac4a('0x10'));var qs=require(_0xac4a('0x11'));var as=require(_0xac4a('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xac4a('0x13'))('api');var utils=require(_0xac4a('0x14'));var config=require('../../config/environment');var db=require(_0xac4a('0x15'))['db'];config[_0xac4a('0x16')]=_[_0xac4a('0x17')](config['redis'],{'host':_0xac4a('0x18'),'port':0x18eb});var socket=require(_0xac4a('0x19'))(new Redis(config[_0xac4a('0x16')]));require(_0xac4a('0x1a'))[_0xac4a('0x1b')](socket);function respondWithStatusCode(_0x3b71c0,_0x34bc01){_0x34bc01=_0x34bc01||0xcc;return function(_0x33c287){if(_0x33c287){return _0x3b71c0[_0xac4a('0x1c')](_0x34bc01);}return _0x3b71c0[_0xac4a('0x1d')](_0x34bc01)[_0xac4a('0x1e')]();};}function respondWithResult(_0x26dbb8,_0x4a2119){_0x4a2119=_0x4a2119||0xc8;return function(_0x402fff){if(_0x402fff){return _0x26dbb8[_0xac4a('0x1d')](_0x4a2119)[_0xac4a('0x1f')](_0x402fff);}};}function respondWithFilteredResult(_0x144553,_0x3e88e3){return function(_0x387a54){if(_0x387a54){var _0x28e304=_0x387a54[_0xac4a('0x20')],_0x44ec59=_0x3e88e3[_0xac4a('0x21')],_0x546c5d=_0x3e88e3[_0xac4a('0x21')]+_0x3e88e3['limit'],_0x5ac21e;if(_0x546c5d>=_0x28e304){_0x546c5d=_0x28e304;_0x5ac21e=0xc8;}else{_0x5ac21e=0xce;}_0x144553[_0xac4a('0x1d')](_0x5ac21e);return _0x144553[_0xac4a('0x22')](_0xac4a('0x23'),_0x44ec59+'-'+_0x546c5d+'/'+_0x28e304)[_0xac4a('0x1f')](_0x387a54);}return null;};}function patchUpdates(_0x123694){return function(_0x3e829c){try{jsonpatch[_0xac4a('0x24')](_0x3e829c,_0x123694,!![]);}catch(_0x3ca790){return BPromise['reject'](_0x3ca790);}return _0x3e829c[_0xac4a('0x25')]();};}function saveUpdates(_0x3204ad,_0x599787){return function(_0x3d7ce0){if(_0x3d7ce0){return _0x3d7ce0[_0xac4a('0x26')](_0x3204ad)[_0xac4a('0x27')](function(_0x947d8e){return _0x947d8e;});}return null;};}function removeEntity(_0x4d2d6c,_0x1b7998){return function(_0x2503d8){if(_0x2503d8){return _0x2503d8[_0xac4a('0x28')]()[_0xac4a('0x27')](function(){_0x4d2d6c[_0xac4a('0x1d')](0xcc)[_0xac4a('0x1e')]();});}};}function handleEntityNotFound(_0x222507,_0x36054a){return function(_0x3e2c69){if(!_0x3e2c69){_0x222507[_0xac4a('0x1c')](0x194);}return _0x3e2c69;};}function handleError(_0x1d0539,_0x215a31){_0x215a31=_0x215a31||0x1f4;return function(_0x14832b){logger[_0xac4a('0x29')](_0x14832b[_0xac4a('0x2a')]);if(_0x14832b[_0xac4a('0x2b')]){delete _0x14832b['name'];}_0x1d0539[_0xac4a('0x1d')](_0x215a31)[_0xac4a('0x2c')](_0x14832b);};}function getInteractionUsers(_0x42a33c,_0x2772fe){return new BPromise(function(_0x116700,_0x4a5a9e){try{if(_0x2772fe[_0x42a33c['id']]){_0x42a33c['Users']=_[_0xac4a('0x2d')](_0x2772fe[_0x42a33c['id']],function(_0x7a948b){return{'id':_0x7a948b['id'],'fullname':_0x7a948b[_0xac4a('0x2e')]};});}}catch(_0x546b65){_0x4a5a9e(_0x546b65);}_0x116700(_0x42a33c);});}function getInteractionTags(_0x4bda1f,_0x355755){return new BPromise(function(_0x2896bc,_0x228629){try{if(_0x4bda1f[_0xac4a('0x2f')]){_0x4bda1f[_0xac4a('0x30')]=[];_0x4bda1f['TagIds'][_0xac4a('0x31')](',')['forEach'](function(_0x30364b){_0x4bda1f['Tags'][_0xac4a('0x32')](_0x355755[_0x30364b]);});}delete _0x4bda1f[_0xac4a('0x2f')];}catch(_0x31501b){_0x228629(_0x31501b);}_0x2896bc(_0x4bda1f);});}function updateWhatsappInteraction(_0x228aa7,_0x34577f,_0x61e552){return new BPromise(function(_0xbd4591,_0x1f13f3){return getInteractionUsers(_0x228aa7,_0x61e552)[_0xac4a('0x27')](function(_0xfd7c16){return getInteractionTags(_0xfd7c16,_0x34577f);})[_0xac4a('0x27')](function(_0x1634df){_0xbd4591(_0x1634df);})[_0xac4a('0x33')](function(_0x1a9d4e){_0x1f13f3(_0x1a9d4e);});});}exports['index']=function(_0x30442d,_0x1c41fb){var _0x5a4e2b={},_0x2a5419={},_0x1af1c1={'count':0x0,'rows':[]};var _0x565164=_['map'](db[_0xac4a('0x34')][_0xac4a('0x35')],function(_0x1b42b6){return{'name':_0x1b42b6[_0xac4a('0x36')],'type':_0x1b42b6['type'][_0xac4a('0x37')]};});_0x2a5419[_0xac4a('0x38')]=_['map'](_0x565164,_0xac4a('0x2b'));_0x2a5419[_0xac4a('0x39')]=_[_0xac4a('0x3a')](_0x30442d['query']);_0x2a5419[_0xac4a('0x3b')]=_[_0xac4a('0x3c')](_0x2a5419[_0xac4a('0x38')],_0x2a5419['query']);_0x5a4e2b[_0xac4a('0x3d')]=_[_0xac4a('0x3c')](_0x2a5419['model'],qs['fields'](_0x30442d[_0xac4a('0x39')]['fields']));_0x5a4e2b['attributes']=_0x5a4e2b['attributes']['length']?_0x5a4e2b[_0xac4a('0x3d')]:_0x2a5419[_0xac4a('0x38')];if(!_0x30442d[_0xac4a('0x39')][_0xac4a('0x3e')](_0xac4a('0x3f'))){_0x5a4e2b[_0xac4a('0x40')]=qs[_0xac4a('0x40')](_0x30442d[_0xac4a('0x39')][_0xac4a('0x40')]);_0x5a4e2b[_0xac4a('0x21')]=qs[_0xac4a('0x21')](_0x30442d[_0xac4a('0x39')]['offset']);}_0x5a4e2b['order']=qs['sort'](_0x30442d[_0xac4a('0x39')][_0xac4a('0x41')]);_0x5a4e2b[_0xac4a('0x42')]=qs[_0xac4a('0x3b')](_[_0xac4a('0x43')](_0x30442d[_0xac4a('0x39')],_0x2a5419[_0xac4a('0x3b')]),_0x565164);var _0x3441f2=[];var _0x3e9973=squel[_0xac4a('0x44')]()['field']('id')[_0xac4a('0x45')](_0xac4a('0x2b'))[_0xac4a('0x45')](_0xac4a('0x46'))[_0xac4a('0x47')]('tools_tags');var _0x8700b4=squel[_0xac4a('0x44')]()['field'](_0xac4a('0x48'))['field'](_0xac4a('0x49'))[_0xac4a('0x45')](_0xac4a('0x4a'))[_0xac4a('0x47')](_0xac4a('0x4b'),'ui')[_0xac4a('0x4c')](_0xac4a('0x4d'),'u',_0xac4a('0x4e'));var _0x98e0c4=squel[_0xac4a('0x44')]()[_0xac4a('0x47')](_0xac4a('0x4f'),'i')['left_join'](_0xac4a('0x50'),'c',_0xac4a('0x51'))[_0xac4a('0x4c')]('users','o',_0xac4a('0x52'))[_0xac4a('0x4c')]('whatsapp_accounts','a',_0xac4a('0x53'))['left_join'](_0xac4a('0x54'),'me',_0xac4a('0x55'))[_0xac4a('0x4c')]('whatsapp_interaction_has_tags','it','it.WhatsappInteractionId\x20=\x20i.id')[_0xac4a('0x4c')]('tools_tags','t',_0xac4a('0x56'));var _0x566258=squel[_0xac4a('0x57')]();var _0x530bbb=[];var _0x3be103=squel[_0xac4a('0x57')]();var _0x424f9b;if(_0x30442d[_0xac4a('0x39')]['search']){_0x424f9b=as[_0xac4a('0x58')](_0x30442d[_0xac4a('0x39')][_0xac4a('0x59')]);var _0x1ee454=_0x424f9b[_0xac4a('0x5a')];for(var _0x138876=0x0;_0x138876<_0x424f9b[_0xac4a('0x5b')]['length'];_0x138876++){var _0x35dee5=_0x424f9b[_0xac4a('0x5b')][_0x138876];var _0x4828e3='i';var _0x16afbe=_[_0xac4a('0x5c')](_0x565164,[_0xac4a('0x2b'),_0x35dee5[_0xac4a('0x45')]]);if(!_0x16afbe){switch(_0x35dee5['field']){case _0xac4a('0x5d'):if(_0x35dee5[_0xac4a('0x5e')]==0x1){_0x98e0c4[_0xac4a('0x5f')]('`'+_0x35dee5[_0xac4a('0x45')]+_0xac4a('0x60'));}else{_0x98e0c4['having']('`'+_0x35dee5[_0xac4a('0x45')]+'`\x20>\x200');}break;case _0xac4a('0x61'):if(_0x35dee5[_0xac4a('0x62')]==='$substring'){if(_0x35dee5['value'][_0xac4a('0x31')]('\x20')[_0xac4a('0x63')]>0x1){_0x566258[_0x1ee454]('MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0xac4a('0x64')](_0x35dee5[_0xac4a('0x5e')]),null);}else{var _0x26b582='%'+_0x35dee5[_0xac4a('0x5e')]+'%';_0x566258[_0x1ee454]('c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?',_0x26b582,_0x26b582,_0x26b582);}}else{_0x16afbe=_[_0xac4a('0x5c')](_0x565164,[_0xac4a('0x2b'),_0xac4a('0x65')]);_0x35dee5[_0xac4a('0x45')]=_0xac4a('0x65');_0x19ce2c=as[_0xac4a('0x66')](_0x4828e3,_0x16afbe[_0xac4a('0x67')],_0x35dee5);_0x566258[_0x1ee454](_0x19ce2c['text'],_0x19ce2c[_0xac4a('0x5e')][_0xac4a('0x68')],_0x19ce2c[_0xac4a('0x5e')][_0xac4a('0x1e')]);}break;case _0xac4a('0x69'):var _0x2ac1e9=_0x35dee5[_0xac4a('0x5e')][_0xac4a('0x31')](',')[_0xac4a('0x2d')](function(_0x786d9){return Number(_0x786d9);});_0x2ac1e9[_0xac4a('0x6a')](function(_0x38dd4f){_0x3be103['or'](_0xac4a('0x6b'),'%,'+_0x38dd4f+',%');});_0x530bbb=_[_0xac4a('0x6c')](_0x530bbb,_0x2ac1e9);break;case _0xac4a('0x6d'):if(_0x35dee5[_0xac4a('0x62')]==='$substring'){_0x566258[_0x1ee454](_0xac4a('0x6e'),'%'+_0x35dee5['value']+'%',null);}else{_0x16afbe=_[_0xac4a('0x5c')](_0x565164,['name',_0xac4a('0x6f')]);_0x35dee5['field']=_0xac4a('0x6f');_0x19ce2c=as['buildExpression'](_0x4828e3,_0x16afbe['type'],_0x35dee5);_0x566258[_0x1ee454](_0x19ce2c[_0xac4a('0x70')],_0x19ce2c[_0xac4a('0x5e')][_0xac4a('0x68')],_0x19ce2c[_0xac4a('0x5e')][_0xac4a('0x1e')]);}break;case _0xac4a('0x71'):_0x19ce2c=as['buildExpression']('me',null,_0x35dee5);_0x566258[_0x1ee454](_0x19ce2c[_0xac4a('0x70')],_0x19ce2c['value'][_0xac4a('0x68')],_0x19ce2c['value'][_0xac4a('0x1e')]);break;}}else{var _0x19ce2c=as[_0xac4a('0x66')](_0x4828e3,_0x16afbe[_0xac4a('0x67')],_0x35dee5);_0x566258[_0x1ee454](_0x19ce2c[_0xac4a('0x70')],_0x19ce2c[_0xac4a('0x5e')][_0xac4a('0x68')],_0x19ce2c[_0xac4a('0x5e')][_0xac4a('0x1e')]);}}}else{var _0x430dd0=_(_0x30442d[_0xac4a('0x39')])[_0xac4a('0x3a')]()[_0xac4a('0x2d')](function(_0x2cc410){return _[_0xac4a('0x72')](_0x565164,[_0xac4a('0x2b'),_0x2cc410])?_0x2cc410:undefined;})[_0xac4a('0x73')]()['value']();if(!_[_0xac4a('0x74')](_0x430dd0)){_0x430dd0[_0xac4a('0x6a')](function(_0x4fb812){if(_0x4fb812===_0xac4a('0x75')){_0x98e0c4[_0xac4a('0x42')](_0xac4a('0x76'),[][_0xac4a('0x77')](_0x30442d[_0xac4a('0x39')][_0x4fb812]));}else if(_0x4fb812==='createdAt'){var _0x47c6d8=JSON[_0xac4a('0x78')](_0x30442d[_0xac4a('0x39')][_0x4fb812])[_0xac4a('0x79')];var _0x148288=JSON[_0xac4a('0x78')](_0x30442d[_0xac4a('0x39')][_0x4fb812])[_0xac4a('0x7a')];_0x98e0c4[_0xac4a('0x42')](_0xac4a('0x7b'),_0x47c6d8,_0x148288);}else{if(_0x30442d[_0xac4a('0x39')][_0x4fb812]===_0xac4a('0x7c')){_0x98e0c4['where']('i.'+_0x4fb812+'\x20IS\x20NULL');}else{_0x98e0c4[_0xac4a('0x42')]('i.'+_0x4fb812+_0xac4a('0x7d'),_0x30442d[_0xac4a('0x39')][_0x4fb812]);}}});}if(_0x30442d[_0xac4a('0x39')][_0xac4a('0x7e')]){if(_0x30442d[_0xac4a('0x39')][_0xac4a('0x7e')]==0x1){_0x98e0c4[_0xac4a('0x5f')](_0xac4a('0x7f'));}else{_0x98e0c4[_0xac4a('0x5f')](_0xac4a('0x80'));}}if(_0x30442d[_0xac4a('0x39')]['tag']){_0x530bbb=_[_0xac4a('0x81')](_0x30442d[_0xac4a('0x39')][_0xac4a('0x82')])?_0x30442d[_0xac4a('0x39')]['tag']:new Array(_0x30442d[_0xac4a('0x39')]['tag']);_0x530bbb[_0xac4a('0x6a')](function(_0x3af39a){_0x3be103['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x3af39a+',%');});}if(_0x30442d['query'][_0xac4a('0x83')]){var _0x3b8974=_0x30442d[_0xac4a('0x39')]['filter'][_0xac4a('0x84')]('\x5c','\x5c\x5c')['replace']('\x27\x27',_0xac4a('0x85'));if(qs['isNumeric'](_0x3b8974)){_0x566258['or']('i.id\x20LIKE\x20?',_0x3b8974+'%')['or'](_0xac4a('0x86'),_0x3b8974+'%');}else{_0x566258['or']('MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0xac4a('0x64')](_0x3b8974))['or']('CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?',_0x3b8974+'%');}}}_0x98e0c4[_0xac4a('0x42')](_0x566258);_0x98e0c4[_0xac4a('0x87')]('i.id');var _0x3980ae={'type':db['Sequelize'][_0xac4a('0x88')][_0xac4a('0x89')],'raw':!![]};var _0x522949=_0x98e0c4[_0xac4a('0x8a')]();_0x522949['field']('i.id');_0x522949[_0xac4a('0x45')]('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0xac4a('0x5d'));if(_0x5a4e2b['order']){_0x5a4e2b['order'][_0xac4a('0x6a')](function(_0x4065c0){_0x98e0c4[_0xac4a('0x8b')]('i.'+_0x4065c0[0x0],_0x4065c0[0x1]==='DESC'?![]:!![]);});}if(!_['isEmpty'](_0x530bbb)){_0x98e0c4[_0xac4a('0x5f')](_0x3be103);_0x522949[_0xac4a('0x42')]('t.id\x20IN\x20?',_0x530bbb);}BPromise['resolve']()[_0xac4a('0x27')](function(){if(!_0x424f9b){if(_0x30442d[_0xac4a('0x39')][_0xac4a('0x75')]||_0x30442d[_0xac4a('0x39')][_0xac4a('0x8c')])return;_0x522949[_0xac4a('0x42')](_0xac4a('0x8d'));_0x98e0c4[_0xac4a('0x42')](_0xac4a('0x8d'));return;}return _0x30442d['user'][_0xac4a('0x8e')]({'attributes':['id'],'raw':!![]})[_0xac4a('0x27')](function(_0x3ba61e){if(_['isEmpty'](_0x3ba61e)){_0x522949[_0xac4a('0x42')](_0xac4a('0x8f'));_0x98e0c4[_0xac4a('0x42')](_0xac4a('0x8f'));}else{_0x522949[_0xac4a('0x42')]('i.WhatsappAccountId\x20IN\x20?',_[_0xac4a('0x2d')](_0x3ba61e,'id'));_0x98e0c4[_0xac4a('0x42')](_0xac4a('0x76'),_[_0xac4a('0x2d')](_0x3ba61e,'id'));}});})[_0xac4a('0x27')](function(){db[_0xac4a('0x90')][_0xac4a('0x39')](_0x522949['toString'](),_0x3980ae)[_0xac4a('0x27')](function(_0x2be178){_0x1af1c1[_0xac4a('0x20')]=_0x2be178[_0xac4a('0x63')];if(_0x1af1c1[_0xac4a('0x20')]===0x0)return[];return db[_0xac4a('0x90')]['query'](_0x3e9973[_0xac4a('0x91')](),_0x3980ae)[_0xac4a('0x27')](function(_0x1b9a33){_0x3441f2=_[_0xac4a('0x92')](_0x1b9a33,'id');_0x3980ae=_['merge'](_0x3980ae,{'model':db[_0xac4a('0x34')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x30442d['query'][_0xac4a('0x93')]){_0x5a4e2b[_0xac4a('0x3d')]['forEach'](function(_0x5b95ab){_0x98e0c4[_0xac4a('0x45')]('i.'+_0x5b95ab);});}else{_0x98e0c4[_0xac4a('0x45')](_0xac4a('0x94'),'unreadMessages');_0x98e0c4[_0xac4a('0x45')]('a.key',_0xac4a('0x95'));_0x98e0c4[_0xac4a('0x45')](_0xac4a('0x96'),_0xac4a('0x97'));_0x98e0c4[_0xac4a('0x45')]('i.*');_0x98e0c4['field'](_0xac4a('0x98'),_0xac4a('0x99'));_0x98e0c4[_0xac4a('0x45')](_0xac4a('0x9a'),_0xac4a('0x9b'));_0x98e0c4[_0xac4a('0x45')](_0xac4a('0x9c'),_0xac4a('0x9d'));_0x98e0c4['field']('c.phone',_0xac4a('0x9e'));_0x98e0c4[_0xac4a('0x45')](_0xac4a('0x9f'),_0xac4a('0xa0'));_0x98e0c4[_0xac4a('0x45')](_0xac4a('0xa1'),_0xac4a('0xa2'));_0x98e0c4[_0xac4a('0x45')]('o.fullname','Owner.fullname');_0x98e0c4[_0xac4a('0x45')](_0xac4a('0xa3'),_0xac4a('0xa4'));_0x98e0c4[_0xac4a('0x45')](_0xac4a('0xa5'),_0xac4a('0x2f'));}if(_0x5a4e2b[_0xac4a('0x40')])_0x98e0c4['limit'](_0x5a4e2b[_0xac4a('0x40')]);if(_0x5a4e2b[_0xac4a('0x21')])_0x98e0c4[_0xac4a('0x21')](_0x5a4e2b['offset']);return db[_0xac4a('0x90')][_0xac4a('0x39')](_0x98e0c4[_0xac4a('0x91')](),_0x3980ae);})[_0xac4a('0x27')](function(_0x1a7448){_0x8700b4[_0xac4a('0x42')](_0xac4a('0xa6'),_[_0xac4a('0x2d')](_0x1a7448,'id'));return db[_0xac4a('0x90')]['query'](_0x8700b4[_0xac4a('0x91')](),_0x3980ae)['then'](function(_0x203321){var _0x1199f6=_[_0xac4a('0xa7')](_0x203321,_0xac4a('0xa8'));var _0x840fec=[];_0x1a7448[_0xac4a('0x6a')](function(_0x19766a){_0x840fec['push'](updateWhatsappInteraction(_0x19766a,_0x3441f2,_0x1199f6));});return BPromise[_0xac4a('0xa9')](_0x840fec);});});})[_0xac4a('0x27')](function(_0x279f9b){_0x1af1c1[_0xac4a('0xaa')]=_0x279f9b;return _0x1af1c1;})[_0xac4a('0x27')](respondWithFilteredResult(_0x1c41fb,_0x5a4e2b));})['catch'](handleError(_0x1c41fb,null));};exports[_0xac4a('0xab')]=function(_0x360d4f,_0x4f2b19){var _0x55af32={'raw':![],'where':{'id':_0x360d4f[_0xac4a('0xac')]['id']}},_0x386d6d={};_0x386d6d['model']=_[_0xac4a('0x3a')](db[_0xac4a('0x34')][_0xac4a('0x35')]);_0x386d6d[_0xac4a('0x39')]=_[_0xac4a('0x3a')](_0x360d4f[_0xac4a('0x39')]);_0x386d6d['filters']=_[_0xac4a('0x3c')](_0x386d6d[_0xac4a('0x38')],_0x386d6d[_0xac4a('0x39')]);_0x55af32['attributes']=_[_0xac4a('0x3c')](_0x386d6d[_0xac4a('0x38')],qs[_0xac4a('0x93')](_0x360d4f[_0xac4a('0x39')][_0xac4a('0x93')]));_0x55af32[_0xac4a('0x3d')]=_0x55af32['attributes'][_0xac4a('0x63')]?_0x55af32[_0xac4a('0x3d')]:_0x386d6d['model'];if(_0x360d4f[_0xac4a('0x39')]['includeAll']){_0x55af32[_0xac4a('0xad')]=[{'all':!![]}];}_0x55af32=_[_0xac4a('0xae')]({},_0x55af32,_0x360d4f['options']);return db[_0xac4a('0x34')]['find'](_0x55af32)[_0xac4a('0x27')](handleEntityNotFound(_0x4f2b19,null))['then'](respondWithResult(_0x4f2b19,null))[_0xac4a('0x33')](handleError(_0x4f2b19,null));};exports[_0xac4a('0xaf')]=function(_0x24f464,_0xfe8977){return db[_0xac4a('0x34')][_0xac4a('0xaf')](_0x24f464[_0xac4a('0x71')],{})[_0xac4a('0x27')](respondWithResult(_0xfe8977,0xc9))[_0xac4a('0x33')](handleError(_0xfe8977,null));};exports[_0xac4a('0x26')]=function(_0x3a0163,_0x455eb7){if(_0x3a0163[_0xac4a('0x71')]['id']){delete _0x3a0163[_0xac4a('0x71')]['id'];}return db['WhatsappInteraction'][_0xac4a('0x5c')]({'where':{'id':_0x3a0163[_0xac4a('0xac')]['id']}})['then'](handleEntityNotFound(_0x455eb7,null))[_0xac4a('0x27')](saveUpdates(_0x3a0163[_0xac4a('0x71')],null))[_0xac4a('0x27')](respondWithResult(_0x455eb7,null))[_0xac4a('0x33')](handleError(_0x455eb7,null));};exports[_0xac4a('0x28')]=function(_0x5d5bb3,_0x101137){return db['WhatsappInteraction'][_0xac4a('0x5c')]({'where':{'id':_0x5d5bb3[_0xac4a('0xac')]['id']}})[_0xac4a('0x27')](handleEntityNotFound(_0x101137,null))[_0xac4a('0x27')](removeEntity(_0x101137,null))['catch'](handleError(_0x101137,null));};exports[_0xac4a('0xb0')]=function(_0x55866d,_0x277fd1){return db[_0xac4a('0x34')][_0xac4a('0xb0')]()['then'](respondWithResult(_0x277fd1,null))[_0xac4a('0x33')](handleError(_0x277fd1,null));};exports[_0xac4a('0xb1')]=function(_0x127ede,_0x52f3f2,_0x2da95f){return db[_0xac4a('0xb2')][_0xac4a('0x5c')]({'where':{'id':_0x127ede[_0xac4a('0xac')]['id']}})[_0xac4a('0x27')](handleEntityNotFound(_0x52f3f2,null))[_0xac4a('0x27')](function(_0x3b4183){if(_0x3b4183){return _0x3b4183[_0xac4a('0xb1')](_0x127ede['body'][_0xac4a('0xb3')],_['omit'](_0x127ede['body'],['ids','id'])||{});}})['then'](respondWithResult(_0x52f3f2,null))['catch'](handleError(_0x52f3f2,null));};exports[_0xac4a('0xb4')]=function(_0x58fcb0,_0xc014a6,_0x377444){var _0x2132b2={'raw':![],'where':{}};var _0x525d50={};var _0x9ea4d1={'count':0x0,'rows':[]};return db[_0xac4a('0x34')][_0xac4a('0xb5')]({'where':{'id':_0x58fcb0[_0xac4a('0xac')]['id']}})[_0xac4a('0x27')](handleEntityNotFound(_0xc014a6,null))[_0xac4a('0x27')](function(_0x7a1b25){if(_0x7a1b25){_0x525d50[_0xac4a('0x38')]=_['keys'](db[_0xac4a('0xb2')][_0xac4a('0x35')]);_0x525d50[_0xac4a('0x39')]=_[_0xac4a('0x3a')](_0x58fcb0[_0xac4a('0x39')]);_0x525d50[_0xac4a('0x3b')]=_[_0xac4a('0x3c')](_0x525d50['model'],_0x525d50['query']);_0x2132b2[_0xac4a('0x3d')]=_[_0xac4a('0x3c')](_0x525d50['model'],qs[_0xac4a('0x93')](_0x58fcb0[_0xac4a('0x39')]['fields']));_0x2132b2['attributes']=_0x2132b2[_0xac4a('0x3d')][_0xac4a('0x63')]?_0x2132b2[_0xac4a('0x3d')]:_0x525d50[_0xac4a('0x38')];if(!_0x58fcb0[_0xac4a('0x39')]['hasOwnProperty'](_0xac4a('0x3f'))){_0x2132b2['limit']=qs['limit'](_0x58fcb0['query'][_0xac4a('0x40')]);_0x2132b2[_0xac4a('0x21')]=qs[_0xac4a('0x21')](_0x58fcb0[_0xac4a('0x39')][_0xac4a('0x21')]);}_0x2132b2[_0xac4a('0x8b')]=qs[_0xac4a('0x41')](_0x58fcb0[_0xac4a('0x39')]['sort']);_0x2132b2['where']=qs['filters'](_[_0xac4a('0x43')](_0x58fcb0[_0xac4a('0x39')],_0x525d50[_0xac4a('0x3b')]));_0x2132b2[_0xac4a('0x42')][_0xac4a('0xa8')]=_0x7a1b25['id'];if(_0x58fcb0[_0xac4a('0x39')][_0xac4a('0x83')]){_0x2132b2[_0xac4a('0x42')]=_[_0xac4a('0xae')](_0x2132b2[_0xac4a('0x42')],{'$or':_[_0xac4a('0x2d')](_0x2132b2[_0xac4a('0x3d')],function(_0xe0fd57){var _0x32b013={};_0x32b013[_0xe0fd57]={'$like':'%'+_0x58fcb0[_0xac4a('0x39')][_0xac4a('0x83')]+'%'};return _0x32b013;})});}if(_0x58fcb0[_0xac4a('0x39')][_0xac4a('0x79')]){var _0x41cdb5=_0x58fcb0[_0xac4a('0x39')][_0xac4a('0x79')][_0xac4a('0x31')](',');var _0x3e2575={};_0x3e2575[_0x41cdb5[0x0]]={'$gte':moment(_0x41cdb5[0x1])['format'](_0xac4a('0xb6'))};_0x2132b2[_0xac4a('0x42')]=_[_0xac4a('0xae')](_0x2132b2[_0xac4a('0x42')],_0x3e2575);}_0x2132b2=_[_0xac4a('0xae')]({},_0x2132b2,_0x58fcb0[_0xac4a('0xb7')]);return db[_0xac4a('0xb2')][_0xac4a('0x20')]({'where':_0x2132b2['where']})['then'](function(_0x113f80){_0x9ea4d1[_0xac4a('0x20')]=_0x113f80;if(_0x58fcb0[_0xac4a('0x39')]['includeAll']){_0x2132b2['include']=[{'all':!![]}];}return db['WhatsappMessage'][_0xac4a('0xb8')](_0x2132b2);})['then'](function(_0x59e82c){_0x9ea4d1[_0xac4a('0xaa')]=_0x59e82c;return _0x9ea4d1;});}})['then'](respondWithFilteredResult(_0xc014a6,_0x2132b2))[_0xac4a('0x33')](handleError(_0xc014a6,null));};exports['addTags']=function(_0x3f95a4,_0x2b4f28,_0x413f5f){return db[_0xac4a('0x34')][_0xac4a('0x5c')]({'where':{'id':_0x3f95a4[_0xac4a('0xac')]['id']}})['then'](handleEntityNotFound(_0x2b4f28,null))[_0xac4a('0x27')](function(_0x34b6d7){if(_0x34b6d7){return _0x34b6d7[_0xac4a('0xb9')](_0x3f95a4['body'][_0xac4a('0xb3')],_[_0xac4a('0xba')](_0x3f95a4[_0xac4a('0x71')],[_0xac4a('0xb3'),'id'])||{})['spread'](function(){return db[_0xac4a('0x69')][_0xac4a('0xb8')]({'attributes':['id',_0xac4a('0x2b'),_0xac4a('0x46')],'where':{'id':_0x3f95a4[_0xac4a('0x71')][_0xac4a('0xb3')]}});})['then'](function(_0x57d3cd){socket[_0xac4a('0xbb')](_0xac4a('0xbc'),{'id':Number(_0x3f95a4[_0xac4a('0xac')]['id']),'tags':_0x57d3cd||[]});return{'id':Number(_0x3f95a4[_0xac4a('0xac')]['id']),'tags':_0x57d3cd||[]};});}})[_0xac4a('0x27')](respondWithResult(_0x2b4f28,null))[_0xac4a('0x33')](handleError(_0x2b4f28,null));};exports['removeTags']=function(_0x21a6f6,_0x580c9b,_0xe4165d){return db['WhatsappInteraction'][_0xac4a('0x5c')]({'where':{'id':_0x21a6f6[_0xac4a('0xac')]['id']}})[_0xac4a('0x27')](handleEntityNotFound(_0x580c9b,null))[_0xac4a('0x27')](function(_0x5650ce){if(_0x5650ce){return _0x5650ce[_0xac4a('0xbd')](_0x21a6f6[_0xac4a('0x39')][_0xac4a('0xb3')]);}})[_0xac4a('0x27')](respondWithStatusCode(_0x580c9b,null))[_0xac4a('0x33')](handleError(_0x580c9b,null));};exports['download']=function(_0x3dd60a,_0xbe1958){var _0x462964=moment()[_0xac4a('0xbe')]()[_0xac4a('0x91')]();var _0x5e5eb1=path[_0xac4a('0xbf')](config[_0xac4a('0xc0')],_0xac4a('0xc1'),_0xac4a('0xc2'),_0xac4a('0xc3'));var _0x55ccc3=path['join'](config['root'],'server',_0xac4a('0xc2'),_0xac4a('0xc4'));var _0x17f815=path[_0xac4a('0xbf')](_0x5e5eb1,_0x462964);var _0xa8b5bb=util['format'](_0xac4a('0xc5'),_0x3dd60a[_0xac4a('0xac')]['id'],_0x462964);var _0x5aad90=path[_0xac4a('0xbf')](_0x5e5eb1,_0xa8b5bb);var _0x14b425=[];_0x14b425[_0xac4a('0x32')]({'model':db['User'],'as':_0xac4a('0x6d'),'attributes':['id',_0xac4a('0x2e')],'raw':!![]});_0x14b425[_0xac4a('0x32')]({'model':db[_0xac4a('0xc6')],'as':_0xac4a('0x61'),'attributes':['id',_0xac4a('0xc7'),_0xac4a('0xc8')],'raw':!![]});if(_0x3dd60a[_0xac4a('0x39')][_0xac4a('0xc4')]){_0x14b425['push']({'model':db[_0xac4a('0xc9')],'as':_0xac4a('0xc9'),'raw':!![]});}var _0x579181=[{'model':db[_0xac4a('0xb2')],'as':'Messages','attributes':['id',_0xac4a('0x71'),_0xac4a('0xca'),'direction',_0xac4a('0xcb'),_0xac4a('0x7e')],'include':_0x14b425}];_0x579181[_0xac4a('0x32')]({'model':db[_0xac4a('0xcc')],'as':_0xac4a('0xcd'),'attributes':['id',_0xac4a('0x2b')]});_0x579181[_0xac4a('0x32')]({'model':db[_0xac4a('0x6d')],'as':'Owner','attributes':['id','fullname']});return db[_0xac4a('0x34')]['find']({'where':{'id':_0x3dd60a['params']['id']},'include':_0x579181})[_0xac4a('0x27')](handleEntityNotFound(_0xbe1958,null))[_0xac4a('0x27')](function(_0x3254c3){if(_0x3254c3){var _0x516225=_0x3254c3[_0xac4a('0xce')]({'plain':!![]});fs[_0xac4a('0xcf')](_0x17f815);var _0x5a2abf={'format':'A4','border':'10px','header':{'height':_0xac4a('0xd0'),'contents':{'first':_0xac4a('0xd1')}},'footer':{'height':_0xac4a('0xd2'),'contents':{'default':util[_0xac4a('0xd3')]('\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20%s\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20{{page}}/{{pages}}\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20%s\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',util[_0xac4a('0xd3')](_0xac4a('0xd4'),_0xac4a('0xd5'),_0x516225['id']),moment()['format'](_0xac4a('0xd6'))[_0xac4a('0x91')]())}}};var _0x15b97a={'channel':_0xac4a('0xd5'),'account':_0x516225[_0xac4a('0xcd')]['name'],'agent':_0x516225['Owner']?_0x516225[_0xac4a('0xd7')][_0xac4a('0x2e')]:_0xac4a('0xd8'),'createdAt':moment(_0x516225[_0xac4a('0xca')])[_0xac4a('0xd3')](_0xac4a('0xb6'))[_0xac4a('0x91')](),'closedAt':_0x516225[_0xac4a('0xd9')]?moment(_0x516225[_0xac4a('0xda')])[_0xac4a('0xd3')](_0xac4a('0xb6'))[_0xac4a('0x91')]():'','disposition':_0x516225[_0xac4a('0xdb')],'messages':_(_0x516225['Messages'])[_0xac4a('0x83')]({'secret':![]})['map'](function(_0x4ec2c3){if(_0x4ec2c3[_0xac4a('0xc9')]){var _0x27833a=path[_0xac4a('0xbf')](_0x55ccc3,_0x4ec2c3[_0xac4a('0xc9')][_0xac4a('0xdc')]);if(fs[_0xac4a('0xdd')](_0x27833a)){fs[_0xac4a('0xde')](_0x27833a)[_0xac4a('0xdf')](fs[_0xac4a('0xe0')](path['join'](_0x17f815,_0x4ec2c3[_0xac4a('0xc9')][_0xac4a('0xdc')])));}}return{'date':moment(_0x4ec2c3[_0xac4a('0xca')])[_0xac4a('0xd3')]('YYYY-MM-DD\x20HH:mm:ss')['toString'](),'sender':_0x4ec2c3[_0xac4a('0xe1')]===_0xac4a('0xe2')?_0x4ec2c3[_0xac4a('0x6d')]?_0x4ec2c3[_0xac4a('0x6d')][_0xac4a('0x2e')]:_0xac4a('0xe3'):_0x4ec2c3[_0xac4a('0x61')][_0xac4a('0xc7')]+(_0x4ec2c3[_0xac4a('0x61')]['lastName']?'\x20'+_0x4ec2c3[_0xac4a('0x61')][_0xac4a('0xc8')]:''),'body':_0x4ec2c3[_0xac4a('0xc9')]?_0x4ec2c3[_0xac4a('0xc9')][_0xac4a('0xdc')]:_0x4ec2c3[_0xac4a('0x71')],'direction':_0x4ec2c3['direction']==='out'?'A':'C','secret':_0x4ec2c3['secret'],'read':_0x4ec2c3[_0xac4a('0x7e')],'attachment':_0x4ec2c3[_0xac4a('0xc9')]};})['value']()};return ejs['renderFile'](path[_0xac4a('0xbf')](config['root'],_0xac4a('0xc1'),'views',_0xac4a('0xe4')),{'interaction':_0x15b97a})[_0xac4a('0x27')](function(_0x1888c3){return new BPromise(function(_0x4a04c3,_0x14435d){pdf[_0xac4a('0xaf')](_0x1888c3,_0x5a2abf)['toFile'](path[_0xac4a('0xbf')](_0x17f815,_0xac4a('0xe5')+_0x516225['id']+'-'+_0x462964+'.pdf'),function(_0x48a75c,_0x4514a5){if(_0x48a75c)return _0x14435d(_0x48a75c);_0x4a04c3(_0x4514a5);});});})[_0xac4a('0x27')](function(){return new BPromise(function(_0x43df37,_0x45e45b){zipdir(_0x17f815,{'saveTo':_0x5aad90},function(_0x367254,_0x22cc71){if(_0x367254)return _0x45e45b(_0x367254);return _0x43df37(_0x22cc71);});})[_0xac4a('0x27')](function(){return new BPromise(function(_0x1ea4ef,_0x156b67){rimraf(_0x17f815,function(_0x330070){if(_0x330070)_0x156b67(_0x330070);return _0x1ea4ef();});});})[_0xac4a('0x27')](function(){return _0xbe1958[_0xac4a('0xe6')](_0x5aad90,_0xa8b5bb,function(_0x2d755c){if(_0x2d755c){console[_0xac4a('0xe7')](_0xac4a('0xe8'),_0x2d755c);}else{fs[_0xac4a('0xe9')](_0x5aad90);}});});});}else{return _0xbe1958[_0xac4a('0x1c')](0xc8);}})['catch'](handleError(_0xbe1958,null));}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.events.js b/server/api/whatsappInteraction/whatsappInteraction.events.js index f8b4674..a44cbef 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 _0xa5f1=['emit','hasOwnProperty','exports','events','WhatsappInteraction','../../mysqldb','WhatsappMessage','setMaxListeners','save','remove','getUsers','then','Users','map','setDataValue','unreadMessages'];(function(_0x1c6bbb,_0x1019b7){var _0x5b876d=function(_0x5a8ac4){while(--_0x5a8ac4){_0x1c6bbb['push'](_0x1c6bbb['shift']());}};_0x5b876d(++_0x1019b7);}(_0xa5f1,0x173));var _0x1a5f=function(_0x411add,_0x1aed38){_0x411add=_0x411add-0x0;var _0x238242=_0xa5f1[_0x411add];return _0x238242;};'use strict';var EventEmitter=require(_0x1a5f('0x0'));var WhatsappInteraction=require('../../mysqldb')['db'][_0x1a5f('0x1')];var WhatsappMessage=require(_0x1a5f('0x2'))['db'][_0x1a5f('0x3')];var WhatsappInteractionEvents=new EventEmitter();WhatsappInteractionEvents[_0x1a5f('0x4')](0x0);var events={'afterCreate':_0x1a5f('0x5'),'afterUpdate':'update','afterDestroy':_0x1a5f('0x6')};function emitEvent(_0x5cc7ee){return function(_0x48f1e6,_0x5071f2,_0x411123){_0x48f1e6[_0x1a5f('0x7')]({'attributes':['id'],'raw':!![]})[_0x1a5f('0x8')](function(_0x1113ab){_0x48f1e6['setDataValue'](_0x1a5f('0x9'),_0x1113ab[_0x1a5f('0xa')](function(_0x157ba0){return{'id':_0x157ba0['id']};}));return WhatsappMessage['findAll']({'where':{'WhatsappInteractionId':_0x48f1e6['id'],'direction':'in','read':![]},'raw':!![]});})[_0x1a5f('0x8')](function(_0x4a7281){_0x48f1e6[_0x1a5f('0xb')](_0x1a5f('0xc'),_0x4a7281['length']);WhatsappInteractionEvents[_0x1a5f('0xd')](_0x5cc7ee+':'+_0x48f1e6['id'],_0x48f1e6);WhatsappInteractionEvents['emit'](_0x5cc7ee,_0x48f1e6);_0x411123(null);})['catch'](_0x411123(null));};}for(var e in events){if(events[_0x1a5f('0xe')](e)){var event=events[e];WhatsappInteraction['hook'](e,emitEvent(event));}}module[_0x1a5f('0xf')]=WhatsappInteractionEvents; \ No newline at end of file +var _0x18b8=['WhatsappInteraction','../../mysqldb','WhatsappMessage','save','update','getUsers','then','setDataValue','Users','map','findAll','length','emit','hasOwnProperty','exports','events'];(function(_0x163040,_0x38a58c){var _0x364667=function(_0x3b104f){while(--_0x3b104f){_0x163040['push'](_0x163040['shift']());}};_0x364667(++_0x38a58c);}(_0x18b8,0x1bf));var _0x818b=function(_0x4a3fd3,_0x1b2a6d){_0x4a3fd3=_0x4a3fd3-0x0;var _0x5a3226=_0x18b8[_0x4a3fd3];return _0x5a3226;};'use strict';var EventEmitter=require(_0x818b('0x0'));var WhatsappInteraction=require('../../mysqldb')['db'][_0x818b('0x1')];var WhatsappMessage=require(_0x818b('0x2'))['db'][_0x818b('0x3')];var WhatsappInteractionEvents=new EventEmitter();WhatsappInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x818b('0x4'),'afterUpdate':_0x818b('0x5'),'afterDestroy':'remove'};function emitEvent(_0x3302a1){return function(_0x1bffd1,_0x3f7c20,_0x411e83){_0x1bffd1[_0x818b('0x6')]({'attributes':['id'],'raw':!![]})[_0x818b('0x7')](function(_0x474eba){_0x1bffd1[_0x818b('0x8')](_0x818b('0x9'),_0x474eba[_0x818b('0xa')](function(_0x1e07b2){return{'id':_0x1e07b2['id']};}));return WhatsappMessage[_0x818b('0xb')]({'where':{'WhatsappInteractionId':_0x1bffd1['id'],'direction':'in','read':![]},'raw':!![]});})[_0x818b('0x7')](function(_0x3c2ba2){_0x1bffd1[_0x818b('0x8')]('unreadMessages',_0x3c2ba2[_0x818b('0xc')]);WhatsappInteractionEvents[_0x818b('0xd')](_0x3302a1+':'+_0x1bffd1['id'],_0x1bffd1);WhatsappInteractionEvents['emit'](_0x3302a1,_0x1bffd1);_0x411e83(null);})['catch'](_0x411e83(null));};}for(var e in events){if(events[_0x818b('0xe')](e)){var event=events[e];WhatsappInteraction['hook'](e,emitEvent(event));}}module[_0x818b('0xf')]=WhatsappInteractionEvents; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.model.js b/server/api/whatsappInteraction/whatsappInteraction.model.js index 24d1a53..ceb8926 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(_0x11648d,_0x1c3bd1){var _0x5cfdb7=function(_0x31f659){while(--_0x31f659){_0x11648d['push'](_0x11648d['shift']());}};_0x5cfdb7(++_0x1c3bd1);}(_0xa9e0,0x123));var _0x0a9e=function(_0x34bc30,_0x177cb0){_0x34bc30=_0x34bc30-0x0;var _0x5706de=_0xa9e0[_0x34bc30];return _0x5706de;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var 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(_0x3913c1,_0x62265f){var _0x2b3e90=function(_0x1babc8){while(--_0x1babc8){_0x3913c1['push'](_0x3913c1['shift']());}};_0x2b3e90(++_0x62265f);}(_0xa9e0,0x123));var _0x0a9e=function(_0x37bd26,_0x5ad346){_0x37bd26=_0x37bd26-0x0;var _0xe83dc4=_0xa9e0[_0x37bd26];return _0xe83dc4;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var 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 02e2849..da9211d 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 _0x2d52=['request','info','WhatsappInteraction,\x20%s,\x20%s','request\x20sent','debug','WhatsappInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','UpdateWhatsappInteraction','WhatsappInteraction','update','body','raw','options','then','catch','AddTagsToWhatsappInteraction','where','addTags','ids','omit','spread','AddTags','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','defaults','redis','localhost','./whatsappInteraction.socket'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x2d52,0x1e8));var _0x22d5=function(_0x319696,_0x477274){_0x319696=_0x319696-0x0;var _0x44085a=_0x2d52[_0x319696];return _0x44085a;};'use strict';var _=require(_0x22d5('0x0'));var util=require(_0x22d5('0x1'));var moment=require(_0x22d5('0x2'));var BPromise=require(_0x22d5('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x22d5('0x4'));var db=require(_0x22d5('0x5'))['db'];var utils=require(_0x22d5('0x6'));var logger=require(_0x22d5('0x7'))(_0x22d5('0x8'));var config=require(_0x22d5('0x9'));var jayson=require(_0x22d5('0xa'));var client=jayson['client'][_0x22d5('0xb')]({'port':0x232a});config['redis']=_[_0x22d5('0xc')](config[_0x22d5('0xd')],{'host':_0x22d5('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x22d5('0xf'))['register'](socket);function respondWithRpcPromise(_0x17b961,_0xa1472e,_0x46cc06){return new BPromise(function(_0x273cd2,_0xddc18d){return client[_0x22d5('0x10')](_0x17b961,_0x46cc06)['then'](function(_0x2a5ab6){logger[_0x22d5('0x11')](_0x22d5('0x12'),_0xa1472e,_0x22d5('0x13'));logger[_0x22d5('0x14')](_0x22d5('0x15'),_0xa1472e,_0x22d5('0x13'),JSON[_0x22d5('0x16')](_0x2a5ab6));if(_0x2a5ab6[_0x22d5('0x17')]){if(_0x2a5ab6['error'][_0x22d5('0x18')]===0x1f4){logger[_0x22d5('0x17')](_0x22d5('0x12'),_0xa1472e,_0x2a5ab6['error'][_0x22d5('0x19')]);return _0xddc18d(_0x2a5ab6['error']['message']);}logger[_0x22d5('0x17')](_0x22d5('0x12'),_0xa1472e,_0x2a5ab6[_0x22d5('0x17')][_0x22d5('0x19')]);return _0x273cd2(_0x2a5ab6[_0x22d5('0x17')]['message']);}else{logger['info'](_0x22d5('0x12'),_0xa1472e,_0x22d5('0x13'));_0x273cd2(_0x2a5ab6[_0x22d5('0x1a')][_0x22d5('0x19')]);}})['catch'](function(_0x333251){logger['error'](_0x22d5('0x12'),_0xa1472e,_0x333251);_0xddc18d(_0x333251);});});}exports[_0x22d5('0x1b')]=function(_0x4fac12){var _0x1ca254=this;return new Promise(function(_0x22afec,_0x593881){return db[_0x22d5('0x1c')][_0x22d5('0x1d')](_0x4fac12[_0x22d5('0x1e')],{'raw':_0x4fac12['options']?_0x4fac12['options'][_0x22d5('0x1f')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4fac12['options']?_0x4fac12[_0x22d5('0x20')]['where']||null:null,'attributes':_0x4fac12[_0x22d5('0x20')]?_0x4fac12['options']['attributes']||null:null,'limit':_0x4fac12[_0x22d5('0x20')]?_0x4fac12['options']['limit']||null:null})[_0x22d5('0x21')](function(_0x41ae24){logger[_0x22d5('0x11')](_0x22d5('0x1b'),_0x4fac12);logger[_0x22d5('0x14')](_0x22d5('0x1b'),_0x4fac12,JSON[_0x22d5('0x16')](_0x41ae24));_0x22afec(_0x41ae24);})[_0x22d5('0x22')](function(_0x4b9008){logger[_0x22d5('0x17')]('UpdateWhatsappInteraction',_0x4b9008[_0x22d5('0x19')],_0x4fac12);_0x593881(_0x1ca254[_0x22d5('0x17')](0x1f4,_0x4b9008[_0x22d5('0x19')]));});});};exports[_0x22d5('0x23')]=function(_0x155ab4){return new Promise(function(_0x1201a8,_0x146b6e){return db[_0x22d5('0x1c')]['find']({'where':_0x155ab4[_0x22d5('0x20')]?_0x155ab4['options'][_0x22d5('0x24')]||null:null})[_0x22d5('0x21')](function(_0x5428d9){if(_0x5428d9){return _0x5428d9[_0x22d5('0x25')](_0x155ab4[_0x22d5('0x1e')][_0x22d5('0x26')],_[_0x22d5('0x27')](_0x155ab4[_0x22d5('0x1e')],['ids','id'])||{});}})[_0x22d5('0x28')](function(_0x1b5a52){logger[_0x22d5('0x11')](_0x22d5('0x29'),_0x155ab4);logger[_0x22d5('0x14')](_0x22d5('0x29'),_0x155ab4,JSON[_0x22d5('0x16')](_0x1b5a52));_0x1201a8(_0x1b5a52);})[_0x22d5('0x22')](function(_0xf5ff6b){logger[_0x22d5('0x17')]('AddTags',_0xf5ff6b[_0x22d5('0x19')],_0x155ab4);_0x146b6e(_this[_0x22d5('0x17')](0x1f4,_0xf5ff6b[_0x22d5('0x19')]));});});}; \ No newline at end of file +var _0xc687=['catch','UpdateWhatsappInteraction','update','body','options','raw','where','attributes','limit','AddTagsToWhatsappInteraction','WhatsappInteraction','find','addTags','omit','ids','spread','AddTags','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','client','http','redis','defaults','localhost','socket.io-emitter','./whatsappInteraction.socket','request','then','info','request\x20sent','debug','WhatsappInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','WhatsappInteraction,\x20%s,\x20%s','message'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0xc687,0xbd));var _0x7c68=function(_0x31b26d,_0x4d24c5){_0x31b26d=_0x31b26d-0x0;var _0x59d29c=_0xc687[_0x31b26d];return _0x59d29c;};'use strict';var _=require(_0x7c68('0x0'));var util=require('util');var moment=require(_0x7c68('0x1'));var BPromise=require(_0x7c68('0x2'));var rs=require(_0x7c68('0x3'));var fs=require('fs');var Redis=require(_0x7c68('0x4'));var db=require(_0x7c68('0x5'))['db'];var utils=require(_0x7c68('0x6'));var logger=require(_0x7c68('0x7'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x7c68('0x8')][_0x7c68('0x9')]({'port':0x232a});config[_0x7c68('0xa')]=_[_0x7c68('0xb')](config[_0x7c68('0xa')],{'host':_0x7c68('0xc'),'port':0x18eb});var socket=require(_0x7c68('0xd'))(new Redis(config[_0x7c68('0xa')]));require(_0x7c68('0xe'))['register'](socket);function respondWithRpcPromise(_0x172d86,_0x183ccf,_0x24d89a){return new BPromise(function(_0x2c03dc,_0x10e52d){return client[_0x7c68('0xf')](_0x172d86,_0x24d89a)[_0x7c68('0x10')](function(_0x3c7693){logger[_0x7c68('0x11')]('WhatsappInteraction,\x20%s,\x20%s',_0x183ccf,_0x7c68('0x12'));logger[_0x7c68('0x13')](_0x7c68('0x14'),_0x183ccf,_0x7c68('0x12'),JSON[_0x7c68('0x15')](_0x3c7693));if(_0x3c7693[_0x7c68('0x16')]){if(_0x3c7693[_0x7c68('0x16')][_0x7c68('0x17')]===0x1f4){logger[_0x7c68('0x16')](_0x7c68('0x18'),_0x183ccf,_0x3c7693[_0x7c68('0x16')][_0x7c68('0x19')]);return _0x10e52d(_0x3c7693['error'][_0x7c68('0x19')]);}logger['error'](_0x7c68('0x18'),_0x183ccf,_0x3c7693[_0x7c68('0x16')][_0x7c68('0x19')]);return _0x2c03dc(_0x3c7693[_0x7c68('0x16')][_0x7c68('0x19')]);}else{logger[_0x7c68('0x11')](_0x7c68('0x18'),_0x183ccf,_0x7c68('0x12'));_0x2c03dc(_0x3c7693['result'][_0x7c68('0x19')]);}})[_0x7c68('0x1a')](function(_0x4f8494){logger[_0x7c68('0x16')](_0x7c68('0x18'),_0x183ccf,_0x4f8494);_0x10e52d(_0x4f8494);});});}exports[_0x7c68('0x1b')]=function(_0xd0009f){var _0x3db36b=this;return new Promise(function(_0x159ed3,_0x566497){return db['WhatsappInteraction'][_0x7c68('0x1c')](_0xd0009f[_0x7c68('0x1d')],{'raw':_0xd0009f[_0x7c68('0x1e')]?_0xd0009f[_0x7c68('0x1e')][_0x7c68('0x1f')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xd0009f[_0x7c68('0x1e')]?_0xd0009f[_0x7c68('0x1e')][_0x7c68('0x20')]||null:null,'attributes':_0xd0009f['options']?_0xd0009f[_0x7c68('0x1e')][_0x7c68('0x21')]||null:null,'limit':_0xd0009f[_0x7c68('0x1e')]?_0xd0009f[_0x7c68('0x1e')][_0x7c68('0x22')]||null:null})[_0x7c68('0x10')](function(_0x34f614){logger[_0x7c68('0x11')](_0x7c68('0x1b'),_0xd0009f);logger[_0x7c68('0x13')](_0x7c68('0x1b'),_0xd0009f,JSON[_0x7c68('0x15')](_0x34f614));_0x159ed3(_0x34f614);})[_0x7c68('0x1a')](function(_0x1fd6be){logger[_0x7c68('0x16')]('UpdateWhatsappInteraction',_0x1fd6be[_0x7c68('0x19')],_0xd0009f);_0x566497(_0x3db36b[_0x7c68('0x16')](0x1f4,_0x1fd6be[_0x7c68('0x19')]));});});};exports[_0x7c68('0x23')]=function(_0x1fc737){return new Promise(function(_0x376497,_0x3164d9){return db[_0x7c68('0x24')][_0x7c68('0x25')]({'where':_0x1fc737[_0x7c68('0x1e')]?_0x1fc737[_0x7c68('0x1e')][_0x7c68('0x20')]||null:null})[_0x7c68('0x10')](function(_0x4d113c){if(_0x4d113c){return _0x4d113c[_0x7c68('0x26')](_0x1fc737[_0x7c68('0x1d')]['ids'],_[_0x7c68('0x27')](_0x1fc737['body'],[_0x7c68('0x28'),'id'])||{});}})[_0x7c68('0x29')](function(_0x46e422){logger[_0x7c68('0x11')]('AddTags',_0x1fc737);logger[_0x7c68('0x13')](_0x7c68('0x2a'),_0x1fc737,JSON[_0x7c68('0x15')](_0x46e422));_0x376497(_0x46e422);})[_0x7c68('0x1a')](function(_0x4dd126){logger[_0x7c68('0x16')](_0x7c68('0x2a'),_0x4dd126['message'],_0x1fc737);_0x3164d9(_this[_0x7c68('0x16')](0x1f4,_0x4dd126[_0x7c68('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.socket.js b/server/api/whatsappInteraction/whatsappInteraction.socket.js index 1823145..c7c0144 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 _0xb8a4=['whatsappInteraction:','./whatsappInteraction.events','save','remove','removeListener','length'];(function(_0x3e1151,_0x55eb14){var _0x5e7a3f=function(_0x5978e0){while(--_0x5978e0){_0x3e1151['push'](_0x3e1151['shift']());}};_0x5e7a3f(++_0x55eb14);}(_0xb8a4,0x109));var _0x4b8a=function(_0xcd939f,_0x33117d){_0xcd939f=_0xcd939f-0x0;var _0xe23e6f=_0xb8a4[_0xcd939f];return _0xe23e6f;};'use strict';var WhatsappInteractionEvents=require(_0x4b8a('0x0'));var events=[_0x4b8a('0x1'),_0x4b8a('0x2'),'update'];function createListener(_0x25cfb0,_0x36497e){return function(_0x4c9332){_0x36497e['emit'](_0x25cfb0,_0x4c9332);};}function removeListener(_0x3e5288,_0x5eea74){return function(){WhatsappInteractionEvents[_0x4b8a('0x3')](_0x3e5288,_0x5eea74);};}exports['register']=function(_0xa7518e){for(var _0x5c6c97=0x0,_0x3111a7=events[_0x4b8a('0x4')];_0x5c6c97<_0x3111a7;_0x5c6c97++){var _0x19bbe=events[_0x5c6c97];var _0x28def0=createListener(_0x4b8a('0x5')+_0x19bbe,_0xa7518e);WhatsappInteractionEvents['on'](_0x19bbe,_0x28def0);}}; \ No newline at end of file +var _0x8a78=['register','./whatsappInteraction.events','save','remove','update','removeListener'];(function(_0x1d1e82,_0x12b0ac){var _0x4a352c=function(_0x233858){while(--_0x233858){_0x1d1e82['push'](_0x1d1e82['shift']());}};_0x4a352c(++_0x12b0ac);}(_0x8a78,0xa9));var _0x88a7=function(_0x14d250,_0x4b2e12){_0x14d250=_0x14d250-0x0;var _0xb991d8=_0x8a78[_0x14d250];return _0xb991d8;};'use strict';var WhatsappInteractionEvents=require(_0x88a7('0x0'));var events=[_0x88a7('0x1'),_0x88a7('0x2'),_0x88a7('0x3')];function createListener(_0x743542,_0xf59111){return function(_0xdfc96d){_0xf59111['emit'](_0x743542,_0xdfc96d);};}function removeListener(_0x95d044,_0x1b744e){return function(){WhatsappInteractionEvents[_0x88a7('0x4')](_0x95d044,_0x1b744e);};}exports[_0x88a7('0x5')]=function(_0x5eb63f){for(var _0xa9519c=0x0,_0x4b18e1=events['length'];_0xa9519c<_0x4b18e1;_0xa9519c++){var _0x426004=events[_0xa9519c];var _0x1d0df9=createListener('whatsappInteraction:'+_0x426004,_0x5eb63f);WhatsappInteractionEvents['on'](_0x426004,_0x1d0df9);}}; \ No newline at end of file diff --git a/server/api/whatsappMessage/index.js b/server/api/whatsappMessage/index.js index 2d505ee..3b16ac0 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 _0x5b93=['isAuthenticated','/describe','describe','get','/:id','show','whatsapp','whatsappmessage:create','create','post','/:id/status','status','put','accept','/:id/reject','reject','delete','destroy','exports','multer','util','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappMessage.controller'];(function(_0x28947d,_0x4cc9c6){var _0x12d2ee=function(_0x3f38fc){while(--_0x3f38fc){_0x28947d['push'](_0x28947d['shift']());}};_0x12d2ee(++_0x4cc9c6);}(_0x5b93,0x1de));var _0x35b9=function(_0x6d0a94,_0x198e6d){_0x6d0a94=_0x6d0a94-0x0;var _0x5e8056=_0x5b93[_0x6d0a94];return _0x5e8056;};'use strict';var multer=require(_0x35b9('0x0'));var util=require(_0x35b9('0x1'));var path=require('path');var timeout=require(_0x35b9('0x2'));var express=require(_0x35b9('0x3'));var router=express['Router']();var auth=require(_0x35b9('0x4'));var interaction=require(_0x35b9('0x5'));var config=require(_0x35b9('0x6'));var controller=require(_0x35b9('0x7'));router['get']('/',auth[_0x35b9('0x8')](),controller['index']);router['get'](_0x35b9('0x9'),auth[_0x35b9('0x8')](),controller[_0x35b9('0xa')]);router[_0x35b9('0xb')](_0x35b9('0xc'),auth[_0x35b9('0x8')](),controller[_0x35b9('0xd')]);router['post']('/',auth['isAuthenticated'](),interaction['tracked'](_0x35b9('0xe'),_0x35b9('0xf')),controller[_0x35b9('0x10')]);router[_0x35b9('0x11')](_0x35b9('0x12'),controller[_0x35b9('0x13')]);router[_0x35b9('0x14')](_0x35b9('0xc'),auth['isAuthenticated'](),controller['update']);router[_0x35b9('0x14')]('/:id/accept',auth[_0x35b9('0x8')](),controller[_0x35b9('0x15')]);router['put'](_0x35b9('0x16'),auth[_0x35b9('0x8')](),controller[_0x35b9('0x17')]);router[_0x35b9('0x18')](_0x35b9('0xc'),auth[_0x35b9('0x8')](),controller[_0x35b9('0x19')]);module[_0x35b9('0x1a')]=router; \ No newline at end of file +var _0x5c6f=['../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappMessage.controller','get','isAuthenticated','index','describe','/:id','show','tracked','whatsapp','post','/:id/status','status','put','update','accept','/:id/reject','reject','delete','exports','util','path','connect-timeout','Router'];(function(_0x44a618,_0x41bbdc){var _0x331e5f=function(_0x4e7fa6){while(--_0x4e7fa6){_0x44a618['push'](_0x44a618['shift']());}};_0x331e5f(++_0x41bbdc);}(_0x5c6f,0x98));var _0xf5c6=function(_0x3102d3,_0x1b86e8){_0x3102d3=_0x3102d3-0x0;var _0x1b46ed=_0x5c6f[_0x3102d3];return _0x1b46ed;};'use strict';var multer=require('multer');var util=require(_0xf5c6('0x0'));var path=require(_0xf5c6('0x1'));var timeout=require(_0xf5c6('0x2'));var express=require('express');var router=express[_0xf5c6('0x3')]();var auth=require(_0xf5c6('0x4'));var interaction=require(_0xf5c6('0x5'));var config=require(_0xf5c6('0x6'));var controller=require(_0xf5c6('0x7'));router[_0xf5c6('0x8')]('/',auth[_0xf5c6('0x9')](),controller[_0xf5c6('0xa')]);router[_0xf5c6('0x8')]('/describe',auth[_0xf5c6('0x9')](),controller[_0xf5c6('0xb')]);router[_0xf5c6('0x8')](_0xf5c6('0xc'),auth[_0xf5c6('0x9')](),controller[_0xf5c6('0xd')]);router['post']('/',auth[_0xf5c6('0x9')](),interaction[_0xf5c6('0xe')](_0xf5c6('0xf'),'whatsappmessage:create'),controller['create']);router[_0xf5c6('0x10')](_0xf5c6('0x11'),controller[_0xf5c6('0x12')]);router[_0xf5c6('0x13')]('/:id',auth[_0xf5c6('0x9')](),controller[_0xf5c6('0x14')]);router['put']('/:id/accept',auth[_0xf5c6('0x9')](),controller[_0xf5c6('0x15')]);router[_0xf5c6('0x13')](_0xf5c6('0x16'),auth[_0xf5c6('0x9')](),controller[_0xf5c6('0x17')]);router[_0xf5c6('0x18')](_0xf5c6('0xc'),auth[_0xf5c6('0x9')](),controller['destroy']);module[_0xf5c6('0x19')]=router; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.attributes.js b/server/api/whatsappMessage/whatsappMessage.attributes.js index b4bcd9c..8ef53b9 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 _0x8bc8=['TEXT','medium','ENUM','DATE','sequelize','exports'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0x8bc8,0xc4));var _0x88bc=function(_0x517869,_0x1f383b){_0x517869=_0x517869-0x0;var _0x2e6dd7=_0x8bc8[_0x517869];return _0x2e6dd7;};'use strict';var Sequelize=require(_0x88bc('0x0'));module[_0x88bc('0x1')]={'body':{'type':Sequelize[_0x88bc('0x2')](_0x88bc('0x3')),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize[_0x88bc('0x4')]('in','out'),'defaultValue':'out','allowNull':![]},'messageId':{'type':Sequelize['STRING'](0xbe)},'phone':{'type':Sequelize['STRING']},'readAt':{'type':Sequelize[_0x88bc('0x5')]},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0x878f=['ENUM','out','STRING','DATE','sequelize','exports','TEXT','medium','BOOLEAN'];(function(_0x4d4c09,_0xd16a9b){var _0x5c89d8=function(_0xb0c641){while(--_0xb0c641){_0x4d4c09['push'](_0x4d4c09['shift']());}};_0x5c89d8(++_0xd16a9b);}(_0x878f,0x124));var _0xf878=function(_0x27e8d6,_0xb78ece){_0x27e8d6=_0x27e8d6-0x0;var _0x591454=_0x878f[_0x27e8d6];return _0x591454;};'use strict';var Sequelize=require(_0xf878('0x0'));module[_0xf878('0x1')]={'body':{'type':Sequelize[_0xf878('0x2')](_0xf878('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0xf878('0x4')],'defaultValue':![]},'direction':{'type':Sequelize[_0xf878('0x5')]('in',_0xf878('0x6')),'defaultValue':'out','allowNull':![]},'messageId':{'type':Sequelize['STRING'](0xbe)},'phone':{'type':Sequelize[_0xf878('0x7')]},'readAt':{'type':Sequelize[_0xf878('0x8')]},'secret':{'type':Sequelize[_0xf878('0x4')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.controller.js b/server/api/whatsappMessage/whatsappMessage.controller.js index cf8a8bd..e78e67a 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 _0x05f9=['order','sort','where','merge','includeAll','findAll','rows','show','include','options','find','create','body','params','describe','../../config/logger','accept','read','readAt','YYYY-MM-DD\x20HH:mm:ss','UserId','user','CmContact','Contact','WhatsappInteraction','WhatsappInteractionId','isNil','read1stAt','format','interaction','[WHATSAPPMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','AcceptMessage','acceptMessage','manual','interface','SIP/%s','channel','event','EventManager','acceptmessage','whatsapp-interactions','agent','get','null','RejectMessage','rejectmessage','WhatsappAccount','WhatsppMessage,\x20%s,\x20%s,\x20%s','received\x20delivery\x20report\x20from','twilio','MessageSid','MessageStatus','inspect','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','socket.io-emitter','./whatsappMessage.socket','register','jayson/promise','client','http','test','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','info','WhatsappMessage,\x20%s,\x20%s','debug','WhatsappMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','sendStatus','status','end','json','count','offset','limit','set','apply','reject','save','update','destroy','stack','name','index','map','WhatsappMessage','rawAttributes','fieldName','type','model','query','keys','filters','attributes','intersection','fields','hasOwnProperty','nolimit'];(function(_0x130fb3,_0x11188e){var _0x284fa0=function(_0x87e976){while(--_0x87e976){_0x130fb3['push'](_0x130fb3['shift']());}};_0x284fa0(++_0x11188e);}(_0x05f9,0xba));var _0x905f=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x05f9[_0x14add3];return _0x4a174f;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0x905f('0x0'));var zipdir=require(_0x905f('0x1'));var jsonpatch=require(_0x905f('0x2'));var rp=require(_0x905f('0x3'));var moment=require(_0x905f('0x4'));var BPromise=require(_0x905f('0x5'));var Mustache=require(_0x905f('0x6'));var util=require(_0x905f('0x7'));var path=require(_0x905f('0x8'));var sox=require(_0x905f('0x9'));var csv=require(_0x905f('0xa'));var ejs=require(_0x905f('0xb'));var fs=require('fs');var _=require(_0x905f('0xc'));var squel=require('squel');var crypto=require(_0x905f('0xd'));var jsforce=require(_0x905f('0xe'));var deskjs=require(_0x905f('0xf'));var toCsv=require('to-csv');var querystring=require(_0x905f('0x10'));var Papa=require('papaparse');var Redis=require(_0x905f('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x905f('0x12'));var hardwareService=require(_0x905f('0x13'));var logger=require('../../config/logger')('api');var utils=require(_0x905f('0x14'));var config=require(_0x905f('0x15'));var db=require(_0x905f('0x16'))['db'];config[_0x905f('0x17')]=_[_0x905f('0x18')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x905f('0x19'))(new Redis(config[_0x905f('0x17')]));require(_0x905f('0x1a'))[_0x905f('0x1b')](socket);var jayson=require(_0x905f('0x1c'));var client=jayson[_0x905f('0x1d')][_0x905f('0x1e')]({'port':0x232c});var client9002=jayson[_0x905f('0x1d')][_0x905f('0x1e')]({'port':0x232a});function checkPasswordPattern(_0x1dafce,_0x5a5fb9,_0x212267){if(_0x212267){var _0x9a5a97=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x9a5a97[_0x905f('0x1f')](_0x5a5fb9)){return _0x1dafce;}else{throw new db[(_0x905f('0x20'))][(_0x905f('0x21'))](_0x905f('0x22'));}}else{return _0x1dafce;}}function respondWithRpcPromise(_0x58451c,_0x278e86,_0x2e8945,_0x5ed985){return new BPromise(function(_0x4bdc4a,_0x204db4){var _0x2c76e9=_0x5ed985||client;return _0x2c76e9[_0x905f('0x23')](_0x58451c,_0x2e8945)[_0x905f('0x24')](function(_0x38bb27){logger[_0x905f('0x25')](_0x905f('0x26'),_0x278e86,'request\x20sent');logger[_0x905f('0x27')](_0x905f('0x28'),_0x278e86,_0x905f('0x29'),JSON[_0x905f('0x2a')](_0x38bb27));if(_0x38bb27[_0x905f('0x2b')]){if(_0x38bb27['error'][_0x905f('0x2c')]===0x1f4){logger['error'](_0x905f('0x26'),_0x278e86,_0x38bb27[_0x905f('0x2b')]['message']);return _0x204db4(_0x38bb27[_0x905f('0x2b')]['message']);}logger[_0x905f('0x2b')]('WhatsappMessage,\x20%s,\x20%s',_0x278e86,_0x38bb27['error'][_0x905f('0x2d')]);return _0x4bdc4a(_0x38bb27[_0x905f('0x2b')][_0x905f('0x2d')]);}else{logger[_0x905f('0x25')](_0x905f('0x26'),_0x278e86,_0x905f('0x29'));_0x4bdc4a(_0x38bb27[_0x905f('0x2e')]['message']);}})[_0x905f('0x2f')](function(_0x3def52){logger[_0x905f('0x2b')]('WhatsappMessage,\x20%s,\x20%s',_0x278e86,_0x3def52);_0x204db4(_0x3def52);});});}function respondWithStatusCode(_0x5de988,_0x527fb5){_0x527fb5=_0x527fb5||0xcc;return function(_0x49d918){if(_0x49d918){return _0x5de988[_0x905f('0x30')](_0x527fb5);}return _0x5de988[_0x905f('0x31')](_0x527fb5)[_0x905f('0x32')]();};}function respondWithResult(_0xeb858a,_0x5c79f9){_0x5c79f9=_0x5c79f9||0xc8;return function(_0x30aae6){if(_0x30aae6){return _0xeb858a['status'](_0x5c79f9)[_0x905f('0x33')](_0x30aae6);}};}function respondWithFilteredResult(_0x42405d,_0x5b976f){return function(_0xc1df34){if(_0xc1df34){var _0x116f3e=_0xc1df34[_0x905f('0x34')],_0x3ae18c=_0x5b976f['offset'],_0x94cdcf=_0x5b976f[_0x905f('0x35')]+_0x5b976f[_0x905f('0x36')],_0x223eca;if(_0x94cdcf>=_0x116f3e){_0x94cdcf=_0x116f3e;_0x223eca=0xc8;}else{_0x223eca=0xce;}_0x42405d['status'](_0x223eca);return _0x42405d[_0x905f('0x37')]('Content-Range',_0x3ae18c+'-'+_0x94cdcf+'/'+_0x116f3e)[_0x905f('0x33')](_0xc1df34);}return null;};}function patchUpdates(_0x5d66b1){return function(_0x4531da){try{jsonpatch[_0x905f('0x38')](_0x4531da,_0x5d66b1,!![]);}catch(_0x3b758f){return BPromise[_0x905f('0x39')](_0x3b758f);}return _0x4531da[_0x905f('0x3a')]();};}function saveUpdates(_0xcbed46,_0xb1533){return function(_0x1bdd31){if(_0x1bdd31){return _0x1bdd31[_0x905f('0x3b')](_0xcbed46)[_0x905f('0x24')](function(_0x199968){return _0x199968;});}return null;};}function removeEntity(_0x590f9f,_0x382b2b){return function(_0x4d96f0){if(_0x4d96f0){return _0x4d96f0[_0x905f('0x3c')]()[_0x905f('0x24')](function(){_0x590f9f[_0x905f('0x31')](0xcc)[_0x905f('0x32')]();});}};}function handleEntityNotFound(_0x50e97d,_0x23b7a1){return function(_0x436394){if(!_0x436394){_0x50e97d[_0x905f('0x30')](0x194);}return _0x436394;};}function handleError(_0x3a9612,_0xcf9e47){_0xcf9e47=_0xcf9e47||0x1f4;return function(_0x129e3d){logger[_0x905f('0x2b')](_0x129e3d[_0x905f('0x3d')]);if(_0x129e3d[_0x905f('0x3e')]){delete _0x129e3d[_0x905f('0x3e')];}_0x3a9612[_0x905f('0x31')](_0xcf9e47)['send'](_0x129e3d);};}exports[_0x905f('0x3f')]=function(_0x13f388,_0x34aa21){var _0x40a173={},_0x2447f5={},_0x5661b0={'count':0x0,'rows':[]};var _0x106398=_[_0x905f('0x40')](db[_0x905f('0x41')][_0x905f('0x42')],function(_0x3125ed){return{'name':_0x3125ed[_0x905f('0x43')],'type':_0x3125ed[_0x905f('0x44')]['key']};});_0x2447f5[_0x905f('0x45')]=_[_0x905f('0x40')](_0x106398,_0x905f('0x3e'));_0x2447f5[_0x905f('0x46')]=_[_0x905f('0x47')](_0x13f388[_0x905f('0x46')]);_0x2447f5[_0x905f('0x48')]=_['intersection'](_0x2447f5[_0x905f('0x45')],_0x2447f5['query']);_0x40a173[_0x905f('0x49')]=_[_0x905f('0x4a')](_0x2447f5[_0x905f('0x45')],qs['fields'](_0x13f388[_0x905f('0x46')][_0x905f('0x4b')]));_0x40a173['attributes']=_0x40a173[_0x905f('0x49')]['length']?_0x40a173[_0x905f('0x49')]:_0x2447f5['model'];if(!_0x13f388['query'][_0x905f('0x4c')](_0x905f('0x4d'))){_0x40a173['limit']=qs[_0x905f('0x36')](_0x13f388[_0x905f('0x46')][_0x905f('0x36')]);_0x40a173[_0x905f('0x35')]=qs['offset'](_0x13f388['query'][_0x905f('0x35')]);}_0x40a173[_0x905f('0x4e')]=qs[_0x905f('0x4f')](_0x13f388[_0x905f('0x46')]['sort']);_0x40a173[_0x905f('0x50')]=qs['filters'](_['pick'](_0x13f388[_0x905f('0x46')],_0x2447f5[_0x905f('0x48')]),_0x106398);if(_0x13f388[_0x905f('0x46')]['filter']){_0x40a173[_0x905f('0x50')]=_['merge'](_0x40a173[_0x905f('0x50')],{'$or':_[_0x905f('0x40')](_0x106398,function(_0x5ada6c){if(_0x5ada6c[_0x905f('0x44')]!=='VIRTUAL'){var _0x14ca54={};_0x14ca54[_0x5ada6c['name']]={'$like':'%'+_0x13f388[_0x905f('0x46')]['filter']+'%'};return _0x14ca54;}})});}_0x40a173=_[_0x905f('0x51')]({},_0x40a173,_0x13f388['options']);var _0x9b6a4d={'where':_0x40a173[_0x905f('0x50')]};return db[_0x905f('0x41')][_0x905f('0x34')](_0x9b6a4d)[_0x905f('0x24')](function(_0x4e026d){_0x5661b0[_0x905f('0x34')]=_0x4e026d;if(_0x13f388[_0x905f('0x46')][_0x905f('0x52')]){_0x40a173['include']=[{'all':!![]}];}return db[_0x905f('0x41')][_0x905f('0x53')](_0x40a173);})['then'](function(_0x2a1b45){_0x5661b0[_0x905f('0x54')]=_0x2a1b45;return _0x5661b0;})['then'](respondWithFilteredResult(_0x34aa21,_0x40a173))['catch'](handleError(_0x34aa21,null));};exports[_0x905f('0x55')]=function(_0x303e3a,_0x136382){var _0x10097d={'raw':!![],'where':{'id':_0x303e3a['params']['id']}},_0x5d7c2d={};_0x5d7c2d[_0x905f('0x45')]=_['keys'](db[_0x905f('0x41')]['rawAttributes']);_0x5d7c2d[_0x905f('0x46')]=_[_0x905f('0x47')](_0x303e3a[_0x905f('0x46')]);_0x5d7c2d[_0x905f('0x48')]=_[_0x905f('0x4a')](_0x5d7c2d['model'],_0x5d7c2d[_0x905f('0x46')]);_0x10097d[_0x905f('0x49')]=_['intersection'](_0x5d7c2d['model'],qs[_0x905f('0x4b')](_0x303e3a[_0x905f('0x46')][_0x905f('0x4b')]));_0x10097d[_0x905f('0x49')]=_0x10097d[_0x905f('0x49')]['length']?_0x10097d[_0x905f('0x49')]:_0x5d7c2d[_0x905f('0x45')];if(_0x303e3a[_0x905f('0x46')][_0x905f('0x52')]){_0x10097d[_0x905f('0x56')]=[{'all':!![]}];}_0x10097d=_['merge']({},_0x10097d,_0x303e3a[_0x905f('0x57')]);return db[_0x905f('0x41')][_0x905f('0x58')](_0x10097d)[_0x905f('0x24')](handleEntityNotFound(_0x136382,null))[_0x905f('0x24')](respondWithResult(_0x136382,null))['catch'](handleError(_0x136382,null));};exports[_0x905f('0x59')]=function(_0x15c67e,_0x4155b1){return db[_0x905f('0x41')]['create'](_0x15c67e[_0x905f('0x5a')],{})[_0x905f('0x24')](respondWithResult(_0x4155b1,0xc9))[_0x905f('0x2f')](handleError(_0x4155b1,null));};exports[_0x905f('0x3b')]=function(_0x5d5c32,_0x4b7b65){if(_0x5d5c32[_0x905f('0x5a')]['id']){delete _0x5d5c32['body']['id'];}return db[_0x905f('0x41')][_0x905f('0x58')]({'where':{'id':_0x5d5c32[_0x905f('0x5b')]['id']}})[_0x905f('0x24')](handleEntityNotFound(_0x4b7b65,null))['then'](saveUpdates(_0x5d5c32['body'],null))[_0x905f('0x24')](respondWithResult(_0x4b7b65,null))[_0x905f('0x2f')](handleError(_0x4b7b65,null));};exports['destroy']=function(_0x2631d7,_0x259d3d){return db[_0x905f('0x41')][_0x905f('0x58')]({'where':{'id':_0x2631d7[_0x905f('0x5b')]['id']}})[_0x905f('0x24')](handleEntityNotFound(_0x259d3d,null))['then'](removeEntity(_0x259d3d,null))[_0x905f('0x2f')](handleError(_0x259d3d,null));};exports[_0x905f('0x5c')]=function(_0x51d6ab,_0x3b4790){return db[_0x905f('0x41')]['describe']()['then'](respondWithResult(_0x3b4790,null))[_0x905f('0x2f')](handleError(_0x3b4790,null));};var interaction_log=require(_0x905f('0x5d'))('whatsapp-interactions');exports[_0x905f('0x5e')]=function(_0x289e22,_0x46e712,_0xb6ebdd){var _0x136153={'channel':'whatsapp'};if(_0x289e22['body']['id']){delete _0x289e22[_0x905f('0x5a')]['id'];}_0x289e22[_0x905f('0x5a')][_0x905f('0x5f')]=!![];_0x289e22[_0x905f('0x5a')][_0x905f('0x60')]=moment()['format'](_0x905f('0x61'));_0x289e22[_0x905f('0x5a')][_0x905f('0x62')]=_0x289e22[_0x905f('0x5a')][_0x905f('0x62')]||_0x289e22[_0x905f('0x63')]['id'];return db[_0x905f('0x41')][_0x905f('0x58')]({'where':{'id':_0x289e22['params']['id'],'UserId':null},'include':[{'model':db[_0x905f('0x64')],'as':_0x905f('0x65')}]})['then'](handleEntityNotFound(_0x46e712,null))[_0x905f('0x24')](saveUpdates(_0x289e22[_0x905f('0x5a')],null))[_0x905f('0x24')](function(_0x34c58a){if(_0x34c58a){_0x136153[_0x905f('0x2d')]=_0x34c58a['get']({'plain':!![]});return db[_0x905f('0x66')][_0x905f('0x58')]({'where':{'id':_0x34c58a[_0x905f('0x67')]}});}return null;})[_0x905f('0x24')](handleEntityNotFound(_0x46e712,null))['then'](function(_0x5101f3){if(_0x5101f3){return _0x5101f3[_0x905f('0x3b')]({'UserId':_0x289e22[_0x905f('0x5a')][_0x905f('0x62')],'read1stAt':_[_0x905f('0x68')](_0x5101f3[_0x905f('0x69')])?moment()[_0x905f('0x6a')](_0x905f('0x61')):undefined});}return null;})[_0x905f('0x24')](function(_0x2fbf4e){if(_0x2fbf4e){_0x136153[_0x905f('0x6b')]=_0x2fbf4e['get']({'plain':!![]});interaction_log[_0x905f('0x25')](_0x905f('0x6c'),_0x289e22[_0x905f('0x63')]['id'],_0x289e22['user'][_0x905f('0x3e')],_0x289e22[_0x905f('0x63')][_0x905f('0x6d')],_0x136153[_0x905f('0x6b')]['id'],_0x289e22[_0x905f('0x5a')]?JSON[_0x905f('0x2a')](_0x289e22['body']):'null');return respondWithRpcPromise(_0x905f('0x6e'),_0x905f('0x6f'),_0x136153);}return null;})[_0x905f('0x24')](function(_0x5cdb79){if(_0x5cdb79){if(_0x289e22['body'][_0x905f('0x70')]){_0x136153[_0x905f('0x2d')][_0x905f('0x71')]=util['format'](_0x905f('0x72'),_0x289e22['user'][_0x905f('0x3e')]);_0x136153[_0x905f('0x2d')][_0x905f('0x73')]=_0x136153[_0x905f('0x73')];_0x136153[_0x905f('0x2d')][_0x905f('0x74')]=_0x905f('0x5e');return respondWithRpcPromise(_0x905f('0x75'),'EventManager',{'event':_0x905f('0x76'),'message':_0x136153[_0x905f('0x2d')]},client9002)['then'](function(){return _0x136153;});}return _0x136153;}return null;})[_0x905f('0x24')](respondWithResult(_0x46e712,null))['catch'](handleError(_0x46e712,null));};var interaction_log=require(_0x905f('0x5d'))(_0x905f('0x77'));exports[_0x905f('0x39')]=function(_0x4ff396,_0x110a45,_0x379ac7){var _0x2525e0={'agent':{},'channel':'whatsapp'};if(_0x4ff396['body']['id']){delete _0x4ff396[_0x905f('0x5a')]['id'];}_0x4ff396[_0x905f('0x5a')][_0x905f('0x62')]=_0x4ff396['body'][_0x905f('0x62')]||_0x4ff396[_0x905f('0x63')]['id'];_0x2525e0[_0x905f('0x78')]['id']=_0x4ff396[_0x905f('0x5a')][_0x905f('0x62')];return db['WhatsappMessage'][_0x905f('0x58')]({'where':{'id':_0x4ff396[_0x905f('0x5b')]['id'],'UserId':null}})[_0x905f('0x24')](handleEntityNotFound(_0x110a45,null))[_0x905f('0x24')](function(_0x4c5f76){if(_0x4c5f76){_0x2525e0['message']=_0x4c5f76['get']({'plain':!![]});return db[_0x905f('0x66')]['find']({'where':{'id':_0x4c5f76[_0x905f('0x67')]}});}return null;})[_0x905f('0x24')](handleEntityNotFound(_0x110a45,null))[_0x905f('0x24')](function(_0xfd1ca3){if(_0xfd1ca3){_0x2525e0[_0x905f('0x6b')]=_0xfd1ca3[_0x905f('0x79')]({'plain':!![]});interaction_log[_0x905f('0x25')]('[WHATSAPPMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x4ff396['user']['id'],_0x4ff396['user'][_0x905f('0x3e')],_0x4ff396['user'][_0x905f('0x6d')],_0x2525e0[_0x905f('0x6b')]['id'],_0x4ff396[_0x905f('0x5a')]?JSON[_0x905f('0x2a')](_0x4ff396[_0x905f('0x5a')]):_0x905f('0x7a'));return respondWithRpcPromise(_0x905f('0x7b'),'rejectMessage',_0x2525e0);}return null;})[_0x905f('0x24')](function(_0x12c69f){if(_0x12c69f){_0x12c69f[_0x905f('0x2d')][_0x905f('0x71')]=util[_0x905f('0x6a')]('SIP/%s',_0x4ff396['user'][_0x905f('0x3e')]);_0x12c69f['message']['channel']=_0x2525e0[_0x905f('0x73')];_0x12c69f[_0x905f('0x2d')][_0x905f('0x74')]='reject';respondWithRpcPromise(_0x905f('0x75'),_0x905f('0x75'),{'event':_0x905f('0x7c'),'message':_0x12c69f[_0x905f('0x2d')]},client9002);return _0x2525e0;}return null;})[_0x905f('0x24')](respondWithResult(_0x110a45,null))[_0x905f('0x2f')](handleError(_0x110a45,null));};exports['status']=function(_0x292ad7,_0x5424bc,_0x9f34d0){if(_0x292ad7['body']['id']){delete _0x292ad7[_0x905f('0x5a')]['id'];}var _0x56ecb3;return db[_0x905f('0x41')][_0x905f('0x58')]({'where':{'id':_0x292ad7[_0x905f('0x5b')]['id']}})[_0x905f('0x24')](handleEntityNotFound(_0x5424bc,null))[_0x905f('0x24')](function(_0x511637){if(_0x511637){_0x56ecb3=_0x511637;return db[_0x905f('0x7d')][_0x905f('0x58')]({'where':{'id':_0x511637['WhatsappAccountId']}});}})['then'](handleEntityNotFound(_0x5424bc,null))[_0x905f('0x24')](function(_0x573bc1){if(_0x573bc1){logger['debug'](_0x905f('0x7e'),'status',_0x905f('0x7f'),_0x573bc1[_0x905f('0x44')],util['inspect'](_0x292ad7['body'],{'showHidden':![],'depth':null}));switch(_0x573bc1['type']){case _0x905f('0x80'):if(_0x292ad7[_0x905f('0x5a')]['MessageSid']&&_0x292ad7[_0x905f('0x5a')][_0x905f('0x81')]===_0x56ecb3['messageId']&&_0x292ad7[_0x905f('0x5a')][_0x905f('0x82')]&&_0x292ad7['body'][_0x905f('0x82')]===_0x905f('0x5f')){return _0x56ecb3[_0x905f('0x3b')]({'read':!![]});}else{logger[_0x905f('0x2b')]('WhatsappAccount,\x20%s,\x20%s,\x20%s',_0x905f('0x31'),_0x905f('0x80'),util[_0x905f('0x83')](_0x292ad7[_0x905f('0x5a')],{'showHidden':![],'depth':null}));}break;}return _0x56ecb3;}})[_0x905f('0x24')](respondWithResult(_0x5424bc,null))[_0x905f('0x2f')](handleError(_0x5424bc,null));}; \ No newline at end of file +var _0xecca=['save','sendStatus','name','send','index','map','WhatsappMessage','rawAttributes','fieldName','model','query','filters','attributes','intersection','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll','findAll','keys','include','find','body','update','params','destroy','describe','whatsapp-interactions','accept','read','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','CmContact','Contact','get','read1stAt','interaction','role','AcceptMessage','acceptMessage','manual','interface','channel','EventManager','acceptmessage','whatsapp','agent','WhatsappInteraction','WhatsappInteractionId','[WHATSAPPMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','null','RejectMessage','rejectMessage','SIP/%s','event','reject','rejectmessage','WhatsappAccount','WhatsppMessage,\x20%s,\x20%s,\x20%s','received\x20delivery\x20report\x20from','inspect','twilio','MessageSid','messageId','MessageStatus','WhatsappAccount,\x20%s,\x20%s,\x20%s','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','ejs','lodash','squel','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../mysqldb','redis','socket.io-emitter','register','jayson/promise','client','http','test','Sequelize','request','then','info','WhatsappMessage,\x20%s,\x20%s','request\x20sent','debug','WhatsappMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','status','end','json','count','offset','limit','set','Content-Range','apply'];(function(_0x383c94,_0x2c7402){var _0x149b61=function(_0x33dac0){while(--_0x33dac0){_0x383c94['push'](_0x383c94['shift']());}};_0x149b61(++_0x2c7402);}(_0xecca,0x1d6));var _0xaecc=function(_0x2c91e9,_0x2fb965){_0x2c91e9=_0x2c91e9-0x0;var _0x13f0ff=_0xecca[_0x2c91e9];return _0x13f0ff;};'use strict';var pdf=require(_0xaecc('0x0'));var emlformat=require(_0xaecc('0x1'));var rimraf=require(_0xaecc('0x2'));var zipdir=require(_0xaecc('0x3'));var jsonpatch=require(_0xaecc('0x4'));var rp=require(_0xaecc('0x5'));var moment=require(_0xaecc('0x6'));var BPromise=require(_0xaecc('0x7'));var Mustache=require(_0xaecc('0x8'));var util=require(_0xaecc('0x9'));var path=require('path');var sox=require(_0xaecc('0xa'));var csv=require('to-csv');var ejs=require(_0xaecc('0xb'));var fs=require('fs');var _=require(_0xaecc('0xc'));var squel=require(_0xaecc('0xd'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xaecc('0xe'));var querystring=require(_0xaecc('0xf'));var Papa=require(_0xaecc('0x10'));var Redis=require(_0xaecc('0x11'));var authService=require(_0xaecc('0x12'));var qs=require(_0xaecc('0x13'));var as=require(_0xaecc('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xaecc('0x15'))(_0xaecc('0x16'));var utils=require('../../config/utils');var config=require('../../config/environment');var db=require(_0xaecc('0x17'))['db'];config[_0xaecc('0x18')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xaecc('0x19'))(new Redis(config[_0xaecc('0x18')]));require('./whatsappMessage.socket')[_0xaecc('0x1a')](socket);var jayson=require(_0xaecc('0x1b'));var client=jayson[_0xaecc('0x1c')][_0xaecc('0x1d')]({'port':0x232c});var client9002=jayson['client']['http']({'port':0x232a});function checkPasswordPattern(_0x14f97c,_0x148445,_0x8c963c){if(_0x8c963c){var _0x26a05f=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x26a05f[_0xaecc('0x1e')](_0x148445)){return _0x14f97c;}else{throw new db[(_0xaecc('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 _0x14f97c;}}function respondWithRpcPromise(_0x57b0a7,_0x2ac8be,_0x527dd6,_0x2bc6ec){return new BPromise(function(_0x4d5cc1,_0x591858){var _0x2980b8=_0x2bc6ec||client;return _0x2980b8[_0xaecc('0x20')](_0x57b0a7,_0x527dd6)[_0xaecc('0x21')](function(_0x54a18a){logger[_0xaecc('0x22')](_0xaecc('0x23'),_0x2ac8be,_0xaecc('0x24'));logger[_0xaecc('0x25')](_0xaecc('0x26'),_0x2ac8be,_0xaecc('0x24'),JSON[_0xaecc('0x27')](_0x54a18a));if(_0x54a18a[_0xaecc('0x28')]){if(_0x54a18a[_0xaecc('0x28')][_0xaecc('0x29')]===0x1f4){logger['error'](_0xaecc('0x23'),_0x2ac8be,_0x54a18a[_0xaecc('0x28')][_0xaecc('0x2a')]);return _0x591858(_0x54a18a[_0xaecc('0x28')][_0xaecc('0x2a')]);}logger['error'](_0xaecc('0x23'),_0x2ac8be,_0x54a18a[_0xaecc('0x28')][_0xaecc('0x2a')]);return _0x4d5cc1(_0x54a18a[_0xaecc('0x28')][_0xaecc('0x2a')]);}else{logger[_0xaecc('0x22')]('WhatsappMessage,\x20%s,\x20%s',_0x2ac8be,_0xaecc('0x24'));_0x4d5cc1(_0x54a18a[_0xaecc('0x2b')][_0xaecc('0x2a')]);}})[_0xaecc('0x2c')](function(_0x4362ef){logger[_0xaecc('0x28')](_0xaecc('0x23'),_0x2ac8be,_0x4362ef);_0x591858(_0x4362ef);});});}function respondWithStatusCode(_0x257116,_0x233b91){_0x233b91=_0x233b91||0xcc;return function(_0x5f3964){if(_0x5f3964){return _0x257116['sendStatus'](_0x233b91);}return _0x257116[_0xaecc('0x2d')](_0x233b91)[_0xaecc('0x2e')]();};}function respondWithResult(_0x3d67e0,_0x4ab695){_0x4ab695=_0x4ab695||0xc8;return function(_0x4ae310){if(_0x4ae310){return _0x3d67e0[_0xaecc('0x2d')](_0x4ab695)[_0xaecc('0x2f')](_0x4ae310);}};}function respondWithFilteredResult(_0x50bdf4,_0x10e5dc){return function(_0xd9a6d){if(_0xd9a6d){var _0x5bf227=_0xd9a6d[_0xaecc('0x30')],_0x556bc6=_0x10e5dc[_0xaecc('0x31')],_0x59f610=_0x10e5dc[_0xaecc('0x31')]+_0x10e5dc[_0xaecc('0x32')],_0x50e7c2;if(_0x59f610>=_0x5bf227){_0x59f610=_0x5bf227;_0x50e7c2=0xc8;}else{_0x50e7c2=0xce;}_0x50bdf4[_0xaecc('0x2d')](_0x50e7c2);return _0x50bdf4[_0xaecc('0x33')](_0xaecc('0x34'),_0x556bc6+'-'+_0x59f610+'/'+_0x5bf227)[_0xaecc('0x2f')](_0xd9a6d);}return null;};}function patchUpdates(_0x405acc){return function(_0x5169dd){try{jsonpatch[_0xaecc('0x35')](_0x5169dd,_0x405acc,!![]);}catch(_0x26dbd8){return BPromise['reject'](_0x26dbd8);}return _0x5169dd[_0xaecc('0x36')]();};}function saveUpdates(_0x4bee41,_0x12d835){return function(_0x1582d2){if(_0x1582d2){return _0x1582d2['update'](_0x4bee41)[_0xaecc('0x21')](function(_0x52b387){return _0x52b387;});}return null;};}function removeEntity(_0x2fcedf,_0x19ee62){return function(_0x2b9753){if(_0x2b9753){return _0x2b9753['destroy']()[_0xaecc('0x21')](function(){_0x2fcedf[_0xaecc('0x2d')](0xcc)[_0xaecc('0x2e')]();});}};}function handleEntityNotFound(_0x13c268,_0x2d081f){return function(_0x1b489c){if(!_0x1b489c){_0x13c268[_0xaecc('0x37')](0x194);}return _0x1b489c;};}function handleError(_0x4d8378,_0x121a7f){_0x121a7f=_0x121a7f||0x1f4;return function(_0x8cee3c){logger[_0xaecc('0x28')](_0x8cee3c['stack']);if(_0x8cee3c['name']){delete _0x8cee3c[_0xaecc('0x38')];}_0x4d8378[_0xaecc('0x2d')](_0x121a7f)[_0xaecc('0x39')](_0x8cee3c);};}exports[_0xaecc('0x3a')]=function(_0x30d375,_0x59f6ba){var _0x3d72b5={},_0xc5d502={},_0x264583={'count':0x0,'rows':[]};var _0x17d3f7=_[_0xaecc('0x3b')](db[_0xaecc('0x3c')][_0xaecc('0x3d')],function(_0x4d030b){return{'name':_0x4d030b[_0xaecc('0x3e')],'type':_0x4d030b['type']['key']};});_0xc5d502[_0xaecc('0x3f')]=_['map'](_0x17d3f7,'name');_0xc5d502[_0xaecc('0x40')]=_['keys'](_0x30d375[_0xaecc('0x40')]);_0xc5d502[_0xaecc('0x41')]=_['intersection'](_0xc5d502['model'],_0xc5d502[_0xaecc('0x40')]);_0x3d72b5[_0xaecc('0x42')]=_[_0xaecc('0x43')](_0xc5d502[_0xaecc('0x3f')],qs[_0xaecc('0x44')](_0x30d375[_0xaecc('0x40')]['fields']));_0x3d72b5['attributes']=_0x3d72b5[_0xaecc('0x42')]['length']?_0x3d72b5[_0xaecc('0x42')]:_0xc5d502[_0xaecc('0x3f')];if(!_0x30d375[_0xaecc('0x40')][_0xaecc('0x45')](_0xaecc('0x46'))){_0x3d72b5['limit']=qs[_0xaecc('0x32')](_0x30d375['query'][_0xaecc('0x32')]);_0x3d72b5[_0xaecc('0x31')]=qs[_0xaecc('0x31')](_0x30d375['query'][_0xaecc('0x31')]);}_0x3d72b5[_0xaecc('0x47')]=qs['sort'](_0x30d375[_0xaecc('0x40')][_0xaecc('0x48')]);_0x3d72b5[_0xaecc('0x49')]=qs[_0xaecc('0x41')](_[_0xaecc('0x4a')](_0x30d375['query'],_0xc5d502['filters']),_0x17d3f7);if(_0x30d375[_0xaecc('0x40')][_0xaecc('0x4b')]){_0x3d72b5['where']=_[_0xaecc('0x4c')](_0x3d72b5['where'],{'$or':_['map'](_0x17d3f7,function(_0x4060ea){if(_0x4060ea[_0xaecc('0x4d')]!==_0xaecc('0x4e')){var _0x10f3c5={};_0x10f3c5[_0x4060ea['name']]={'$like':'%'+_0x30d375['query'][_0xaecc('0x4b')]+'%'};return _0x10f3c5;}})});}_0x3d72b5=_[_0xaecc('0x4c')]({},_0x3d72b5,_0x30d375[_0xaecc('0x4f')]);var _0x5c793b={'where':_0x3d72b5[_0xaecc('0x49')]};return db[_0xaecc('0x3c')][_0xaecc('0x30')](_0x5c793b)[_0xaecc('0x21')](function(_0x3fa20a){_0x264583['count']=_0x3fa20a;if(_0x30d375[_0xaecc('0x40')][_0xaecc('0x50')]){_0x3d72b5['include']=[{'all':!![]}];}return db[_0xaecc('0x3c')][_0xaecc('0x51')](_0x3d72b5);})[_0xaecc('0x21')](function(_0x5d8a2e){_0x264583['rows']=_0x5d8a2e;return _0x264583;})[_0xaecc('0x21')](respondWithFilteredResult(_0x59f6ba,_0x3d72b5))['catch'](handleError(_0x59f6ba,null));};exports['show']=function(_0x54adef,_0x3f019c){var _0x4a0ede={'raw':!![],'where':{'id':_0x54adef['params']['id']}},_0x55742d={};_0x55742d[_0xaecc('0x3f')]=_[_0xaecc('0x52')](db['WhatsappMessage'][_0xaecc('0x3d')]);_0x55742d['query']=_[_0xaecc('0x52')](_0x54adef[_0xaecc('0x40')]);_0x55742d['filters']=_[_0xaecc('0x43')](_0x55742d[_0xaecc('0x3f')],_0x55742d[_0xaecc('0x40')]);_0x4a0ede['attributes']=_[_0xaecc('0x43')](_0x55742d['model'],qs['fields'](_0x54adef['query'][_0xaecc('0x44')]));_0x4a0ede['attributes']=_0x4a0ede[_0xaecc('0x42')]['length']?_0x4a0ede[_0xaecc('0x42')]:_0x55742d[_0xaecc('0x3f')];if(_0x54adef[_0xaecc('0x40')][_0xaecc('0x50')]){_0x4a0ede[_0xaecc('0x53')]=[{'all':!![]}];}_0x4a0ede=_[_0xaecc('0x4c')]({},_0x4a0ede,_0x54adef['options']);return db[_0xaecc('0x3c')][_0xaecc('0x54')](_0x4a0ede)[_0xaecc('0x21')](handleEntityNotFound(_0x3f019c,null))[_0xaecc('0x21')](respondWithResult(_0x3f019c,null))[_0xaecc('0x2c')](handleError(_0x3f019c,null));};exports['create']=function(_0x1b64d6,_0x3173a5){return db[_0xaecc('0x3c')]['create'](_0x1b64d6[_0xaecc('0x55')],{})[_0xaecc('0x21')](respondWithResult(_0x3173a5,0xc9))[_0xaecc('0x2c')](handleError(_0x3173a5,null));};exports[_0xaecc('0x56')]=function(_0x551900,_0x16131a){if(_0x551900[_0xaecc('0x55')]['id']){delete _0x551900[_0xaecc('0x55')]['id'];}return db[_0xaecc('0x3c')]['find']({'where':{'id':_0x551900[_0xaecc('0x57')]['id']}})[_0xaecc('0x21')](handleEntityNotFound(_0x16131a,null))[_0xaecc('0x21')](saveUpdates(_0x551900[_0xaecc('0x55')],null))[_0xaecc('0x21')](respondWithResult(_0x16131a,null))['catch'](handleError(_0x16131a,null));};exports[_0xaecc('0x58')]=function(_0x49751c,_0x43021a){return db[_0xaecc('0x3c')][_0xaecc('0x54')]({'where':{'id':_0x49751c[_0xaecc('0x57')]['id']}})[_0xaecc('0x21')](handleEntityNotFound(_0x43021a,null))[_0xaecc('0x21')](removeEntity(_0x43021a,null))[_0xaecc('0x2c')](handleError(_0x43021a,null));};exports[_0xaecc('0x59')]=function(_0x58eb63,_0x18caec){return db[_0xaecc('0x3c')][_0xaecc('0x59')]()[_0xaecc('0x21')](respondWithResult(_0x18caec,null))[_0xaecc('0x2c')](handleError(_0x18caec,null));};var interaction_log=require('../../config/logger')(_0xaecc('0x5a'));exports[_0xaecc('0x5b')]=function(_0x1089a7,_0x2ef5ed,_0x2dc52f){var _0x511996={'channel':'whatsapp'};if(_0x1089a7[_0xaecc('0x55')]['id']){delete _0x1089a7[_0xaecc('0x55')]['id'];}_0x1089a7['body'][_0xaecc('0x5c')]=!![];_0x1089a7[_0xaecc('0x55')]['readAt']=moment()[_0xaecc('0x5d')](_0xaecc('0x5e'));_0x1089a7['body'][_0xaecc('0x5f')]=_0x1089a7[_0xaecc('0x55')]['UserId']||_0x1089a7[_0xaecc('0x60')]['id'];return db[_0xaecc('0x3c')][_0xaecc('0x54')]({'where':{'id':_0x1089a7['params']['id'],'UserId':null},'include':[{'model':db[_0xaecc('0x61')],'as':_0xaecc('0x62')}]})[_0xaecc('0x21')](handleEntityNotFound(_0x2ef5ed,null))[_0xaecc('0x21')](saveUpdates(_0x1089a7['body'],null))[_0xaecc('0x21')](function(_0x17807c){if(_0x17807c){_0x511996[_0xaecc('0x2a')]=_0x17807c[_0xaecc('0x63')]({'plain':!![]});return db['WhatsappInteraction'][_0xaecc('0x54')]({'where':{'id':_0x17807c['WhatsappInteractionId']}});}return null;})[_0xaecc('0x21')](handleEntityNotFound(_0x2ef5ed,null))[_0xaecc('0x21')](function(_0x36d037){if(_0x36d037){return _0x36d037[_0xaecc('0x56')]({'UserId':_0x1089a7[_0xaecc('0x55')][_0xaecc('0x5f')],'read1stAt':_['isNil'](_0x36d037[_0xaecc('0x64')])?moment()['format'](_0xaecc('0x5e')):undefined});}return null;})[_0xaecc('0x21')](function(_0x4b9918){if(_0x4b9918){_0x511996[_0xaecc('0x65')]=_0x4b9918['get']({'plain':!![]});interaction_log[_0xaecc('0x22')]('[WHATSAPPMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x1089a7['user']['id'],_0x1089a7['user'][_0xaecc('0x38')],_0x1089a7['user'][_0xaecc('0x66')],_0x511996['interaction']['id'],_0x1089a7[_0xaecc('0x55')]?JSON['stringify'](_0x1089a7[_0xaecc('0x55')]):'null');return respondWithRpcPromise(_0xaecc('0x67'),_0xaecc('0x68'),_0x511996);}return null;})[_0xaecc('0x21')](function(_0x48b459){if(_0x48b459){if(_0x1089a7['body'][_0xaecc('0x69')]){_0x511996['message'][_0xaecc('0x6a')]=util[_0xaecc('0x5d')]('SIP/%s',_0x1089a7[_0xaecc('0x60')][_0xaecc('0x38')]);_0x511996[_0xaecc('0x2a')][_0xaecc('0x6b')]=_0x511996['channel'];_0x511996['message']['event']=_0xaecc('0x5b');return respondWithRpcPromise(_0xaecc('0x6c'),_0xaecc('0x6c'),{'event':_0xaecc('0x6d'),'message':_0x511996[_0xaecc('0x2a')]},client9002)[_0xaecc('0x21')](function(){return _0x511996;});}return _0x511996;}return null;})[_0xaecc('0x21')](respondWithResult(_0x2ef5ed,null))[_0xaecc('0x2c')](handleError(_0x2ef5ed,null));};var interaction_log=require(_0xaecc('0x15'))('whatsapp-interactions');exports['reject']=function(_0x1c53e2,_0x56e105,_0x167f45){var _0x51cfa1={'agent':{},'channel':_0xaecc('0x6e')};if(_0x1c53e2[_0xaecc('0x55')]['id']){delete _0x1c53e2['body']['id'];}_0x1c53e2[_0xaecc('0x55')][_0xaecc('0x5f')]=_0x1c53e2['body'][_0xaecc('0x5f')]||_0x1c53e2['user']['id'];_0x51cfa1[_0xaecc('0x6f')]['id']=_0x1c53e2[_0xaecc('0x55')][_0xaecc('0x5f')];return db[_0xaecc('0x3c')]['find']({'where':{'id':_0x1c53e2[_0xaecc('0x57')]['id'],'UserId':null}})[_0xaecc('0x21')](handleEntityNotFound(_0x56e105,null))[_0xaecc('0x21')](function(_0x2f533b){if(_0x2f533b){_0x51cfa1['message']=_0x2f533b[_0xaecc('0x63')]({'plain':!![]});return db[_0xaecc('0x70')][_0xaecc('0x54')]({'where':{'id':_0x2f533b[_0xaecc('0x71')]}});}return null;})[_0xaecc('0x21')](handleEntityNotFound(_0x56e105,null))[_0xaecc('0x21')](function(_0xef9841){if(_0xef9841){_0x51cfa1[_0xaecc('0x65')]=_0xef9841[_0xaecc('0x63')]({'plain':!![]});interaction_log['info'](_0xaecc('0x72'),_0x1c53e2['user']['id'],_0x1c53e2[_0xaecc('0x60')][_0xaecc('0x38')],_0x1c53e2[_0xaecc('0x60')][_0xaecc('0x66')],_0x51cfa1[_0xaecc('0x65')]['id'],_0x1c53e2[_0xaecc('0x55')]?JSON[_0xaecc('0x27')](_0x1c53e2['body']):_0xaecc('0x73'));return respondWithRpcPromise(_0xaecc('0x74'),_0xaecc('0x75'),_0x51cfa1);}return null;})['then'](function(_0x3fab0d){if(_0x3fab0d){_0x3fab0d[_0xaecc('0x2a')]['interface']=util[_0xaecc('0x5d')](_0xaecc('0x76'),_0x1c53e2[_0xaecc('0x60')][_0xaecc('0x38')]);_0x3fab0d['message'][_0xaecc('0x6b')]=_0x51cfa1[_0xaecc('0x6b')];_0x3fab0d[_0xaecc('0x2a')][_0xaecc('0x77')]=_0xaecc('0x78');respondWithRpcPromise(_0xaecc('0x6c'),_0xaecc('0x6c'),{'event':_0xaecc('0x79'),'message':_0x3fab0d['message']},client9002);return _0x51cfa1;}return null;})['then'](respondWithResult(_0x56e105,null))[_0xaecc('0x2c')](handleError(_0x56e105,null));};exports[_0xaecc('0x2d')]=function(_0x789644,_0x2baad2,_0x290d7a){if(_0x789644['body']['id']){delete _0x789644[_0xaecc('0x55')]['id'];}var _0x285c31;return db[_0xaecc('0x3c')]['find']({'where':{'id':_0x789644['params']['id']}})[_0xaecc('0x21')](handleEntityNotFound(_0x2baad2,null))['then'](function(_0xeae7f8){if(_0xeae7f8){_0x285c31=_0xeae7f8;return db[_0xaecc('0x7a')]['find']({'where':{'id':_0xeae7f8['WhatsappAccountId']}});}})['then'](handleEntityNotFound(_0x2baad2,null))['then'](function(_0x405b24){if(_0x405b24){logger[_0xaecc('0x25')](_0xaecc('0x7b'),_0xaecc('0x2d'),_0xaecc('0x7c'),_0x405b24[_0xaecc('0x4d')],util[_0xaecc('0x7d')](_0x789644[_0xaecc('0x55')],{'showHidden':![],'depth':null}));switch(_0x405b24[_0xaecc('0x4d')]){case _0xaecc('0x7e'):if(_0x789644[_0xaecc('0x55')][_0xaecc('0x7f')]&&_0x789644[_0xaecc('0x55')][_0xaecc('0x7f')]===_0x285c31[_0xaecc('0x80')]&&_0x789644['body']['MessageStatus']&&_0x789644[_0xaecc('0x55')][_0xaecc('0x81')]===_0xaecc('0x5c')){return _0x285c31['update']({'read':!![]});}else{logger[_0xaecc('0x28')](_0xaecc('0x82'),_0xaecc('0x2d'),_0xaecc('0x7e'),util[_0xaecc('0x7d')](_0x789644[_0xaecc('0x55')],{'showHidden':![],'depth':null}));}break;}return _0x285c31;}})[_0xaecc('0x21')](respondWithResult(_0x2baad2,null))[_0xaecc('0x2c')](handleError(_0x2baad2,null));}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.events.js b/server/api/whatsappMessage/whatsappMessage.events.js index ddf0710..b19f92a 100644 --- a/server/api/whatsappMessage/whatsappMessage.events.js +++ b/server/api/whatsappMessage/whatsappMessage.events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5f2f=['remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','WhatsappMessage','setMaxListeners','save','update'];(function(_0x3c54e1,_0x3440e5){var _0x125cde=function(_0x5f42e0){while(--_0x5f42e0){_0x3c54e1['push'](_0x3c54e1['shift']());}};_0x125cde(++_0x3440e5);}(_0x5f2f,0x73));var _0xf5f2=function(_0x50cd31,_0x33368c){_0x50cd31=_0x50cd31-0x0;var _0x3143ef=_0x5f2f[_0x50cd31];return _0x3143ef;};'use strict';var EventEmitter=require(_0xf5f2('0x0'));var WhatsappMessage=require(_0xf5f2('0x1'))['db'][_0xf5f2('0x2')];var WhatsappMessageEvents=new EventEmitter();WhatsappMessageEvents[_0xf5f2('0x3')](0x0);var events={'afterCreate':_0xf5f2('0x4'),'afterUpdate':_0xf5f2('0x5'),'afterDestroy':_0xf5f2('0x6')};function emitEvent(_0x107cf){return function(_0x501fbd,_0x4854b6,_0x1665c7){WhatsappMessageEvents[_0xf5f2('0x7')](_0x107cf+':'+_0x501fbd['id'],_0x501fbd);WhatsappMessageEvents[_0xf5f2('0x7')](_0x107cf,_0x501fbd);_0x1665c7(null);};}for(var e in events){if(events[_0xf5f2('0x8')](e)){var event=events[e];WhatsappMessage[_0xf5f2('0x9')](e,emitEvent(event));}}module[_0xf5f2('0xa')]=WhatsappMessageEvents; \ No newline at end of file +var _0x5f2f=['remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','WhatsappMessage','setMaxListeners','save','update'];(function(_0xbe1862,_0x4e6d18){var _0x25bd0f=function(_0x3766a2){while(--_0x3766a2){_0xbe1862['push'](_0xbe1862['shift']());}};_0x25bd0f(++_0x4e6d18);}(_0x5f2f,0x73));var _0xf5f2=function(_0x55dd9e,_0x56d484){_0x55dd9e=_0x55dd9e-0x0;var _0x52f534=_0x5f2f[_0x55dd9e];return _0x52f534;};'use strict';var EventEmitter=require(_0xf5f2('0x0'));var WhatsappMessage=require(_0xf5f2('0x1'))['db'][_0xf5f2('0x2')];var WhatsappMessageEvents=new EventEmitter();WhatsappMessageEvents[_0xf5f2('0x3')](0x0);var events={'afterCreate':_0xf5f2('0x4'),'afterUpdate':_0xf5f2('0x5'),'afterDestroy':_0xf5f2('0x6')};function emitEvent(_0x107cf){return function(_0x501fbd,_0x4854b6,_0x1665c7){WhatsappMessageEvents[_0xf5f2('0x7')](_0x107cf+':'+_0x501fbd['id'],_0x501fbd);WhatsappMessageEvents[_0xf5f2('0x7')](_0x107cf,_0x501fbd);_0x1665c7(null);};}for(var e in events){if(events[_0xf5f2('0x8')](e)){var event=events[e];WhatsappMessage[_0xf5f2('0x9')](e,emitEvent(event));}}module[_0xf5f2('0xa')]=WhatsappMessageEvents; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.model.js b/server/api/whatsappMessage/whatsappMessage.model.js index 19b466b..d82de22 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 _0xec7e=['messageId','fti_whatsapp_messages','body','FULLTEXT','models','get','direction','toLowerCase','out','isNil','UserId','WhatsappInteraction','findOne','WhatsappInteractionId','then','update','createdAt','catch','error','secret','WhatsappAccountId','type','twilio','authToken','phone','accountSid','messages','whatsapp:','/api/whatsapp/messages/','/status?token=','token','sid','WhatsappMessage,\x20%s,\x20%s,\x20%s','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','finally','utf8mb4','utf8mb4_unicode_ci','lodash','api','moment','bluebird','request-promise','path','../../config/environment','exports','define','whatsapp_messages'];(function(_0x2e0443,_0x7e5974){var _0x52d450=function(_0x3a9985){while(--_0x3a9985){_0x2e0443['push'](_0x2e0443['shift']());}};_0x52d450(++_0x7e5974);}(_0xec7e,0x83));var _0xeec7=function(_0x2a191b,_0x53e5ce){_0x2a191b=_0x2a191b-0x0;var _0x488906=_0xec7e[_0x2a191b];return _0x488906;};'use strict';var _=require(_0xeec7('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xeec7('0x1'));var moment=require(_0xeec7('0x2'));var BPromise=require(_0xeec7('0x3'));var rp=require(_0xeec7('0x4'));var fs=require('fs');var path=require(_0xeec7('0x5'));var rimraf=require('rimraf');var config=require(_0xeec7('0x6'));var attributes=require('./whatsappMessage.attributes');module[_0xeec7('0x7')]=function(_0x53fd2d,_0x440434){return _0x53fd2d[_0xeec7('0x8')]('WhatsappMessage',attributes,{'tableName':_0xeec7('0x9'),'paranoid':![],'indexes':[{'name':_0xeec7('0xa'),'fields':[_0xeec7('0xa')]},{'name':_0xeec7('0xb'),'fields':[_0xeec7('0xc')],'type':_0xeec7('0xd')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x4af3f7,_0x249e71,_0x3217e6){var _0x2d4482=_0x53fd2d[_0xeec7('0xe')];var _0x5e0916=_0x4af3f7[_0xeec7('0xf')]({'plain':!![]});if(_0x5e0916[_0xeec7('0x10')][_0xeec7('0x11')]()==='in'||_0x5e0916[_0xeec7('0x10')][_0xeec7('0x11')]()===_0xeec7('0x12')&&!_0x5e0916['secret']&&!_[_0xeec7('0x13')](_0x5e0916[_0xeec7('0x14')])){_0x2d4482[_0xeec7('0x15')][_0xeec7('0x16')]({'where':{'id':_0x5e0916[_0xeec7('0x17')]}})[_0xeec7('0x18')](function(_0x4cb8dd){if(_0x4cb8dd){_0x4cb8dd[_0xeec7('0x19')]({'lastMsgAt':_0x5e0916[_0xeec7('0x1a')],'lastMsgDirection':_0x5e0916[_0xeec7('0x10')][_0xeec7('0x11')]()});}})[_0xeec7('0x1b')](function(_0x93ae7d){console[_0xeec7('0x1c')](_0x93ae7d);});}if(_0x5e0916['direction']===_0xeec7('0x12')&&!_0x5e0916[_0xeec7('0x1d')]){var _0x8f0cef;_0x2d4482['WhatsappAccount']['find']({'where':{'id':_0x5e0916[_0xeec7('0x1e')]},'raw':!![]})['then'](function(_0x25d309){_0x8f0cef=_0x25d309;if(_0x8f0cef&&_0x8f0cef['type']){switch(_0x8f0cef[_0xeec7('0x1f')]){case _0xeec7('0x20'):var _0x1f2dee=require(_0xeec7('0x20'));if(_0x8f0cef['accountSid']&&_0x8f0cef[_0xeec7('0x21')]&&_0x8f0cef[_0xeec7('0x22')]){var _0x5a22d3=new _0x1f2dee(_0x8f0cef[_0xeec7('0x23')],_0x8f0cef[_0xeec7('0x21')]);_0x5a22d3[_0xeec7('0x24')]['create']({'body':_0x5e0916[_0xeec7('0xc')],'to':_0xeec7('0x25')+_0x5e0916[_0xeec7('0x22')],'from':_0xeec7('0x25')+_0x8f0cef[_0xeec7('0x22')],'statusCallback':_0x8f0cef['remote']+_0xeec7('0x26')+_0x5e0916['id']+_0xeec7('0x27')+_0x8f0cef[_0xeec7('0x28')]})[_0xeec7('0x18')](function(_0x590230){if(_0x590230[_0xeec7('0x29')]){return _0x4af3f7[_0xeec7('0x19')]({'messageId':_0x590230[_0xeec7('0x29')]});}})[_0xeec7('0x1b')](function(_0xd7231d){logger[_0xeec7('0x1c')](_0xeec7('0x2a'),'afterCreate',_0xeec7('0x20'),util['inspect'](_0xd7231d,{'showHidden':![],'depth':null}));});}else{logger[_0xeec7('0x1c')](_0xeec7('0x2a'),'afterCreate',_0xeec7('0x20'),_0xeec7('0x2b'));}break;}}})[_0xeec7('0x2c')](function(){_0x3217e6();});}else{_0x3217e6();}}},'charset':_0xeec7('0x2d'),'collate':_0xeec7('0x2e')});}; \ No newline at end of file +var _0xa63f=['WhatsappAccount','type','twilio','authToken','phone','accountSid','messages','create','whatsapp:','remote','/status?token=','token','sid','catch','afterCreate','WhatsappMessage,\x20%s,\x20%s,\x20%s','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','finally','lodash','api','moment','bluebird','request-promise','path','../../config/environment','./whatsappMessage.attributes','exports','define','WhatsappMessage','whatsapp_messages','messageId','fti_whatsapp_messages','body','FULLTEXT','models','get','direction','toLowerCase','out','secret','isNil','UserId','WhatsappInteraction','findOne','then','update','error'];(function(_0x54b0c6,_0x5432f0){var _0x4a4a48=function(_0x407167){while(--_0x407167){_0x54b0c6['push'](_0x54b0c6['shift']());}};_0x4a4a48(++_0x5432f0);}(_0xa63f,0x70));var _0xfa63=function(_0x4cd690,_0x4797cc){_0x4cd690=_0x4cd690-0x0;var _0x4a74a9=_0xa63f[_0x4cd690];return _0x4a74a9;};'use strict';var _=require(_0xfa63('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xfa63('0x1'));var moment=require(_0xfa63('0x2'));var BPromise=require(_0xfa63('0x3'));var rp=require(_0xfa63('0x4'));var fs=require('fs');var path=require(_0xfa63('0x5'));var rimraf=require('rimraf');var config=require(_0xfa63('0x6'));var attributes=require(_0xfa63('0x7'));module[_0xfa63('0x8')]=function(_0x2de68d,_0x526d30){return _0x2de68d[_0xfa63('0x9')](_0xfa63('0xa'),attributes,{'tableName':_0xfa63('0xb'),'paranoid':![],'indexes':[{'name':_0xfa63('0xc'),'fields':[_0xfa63('0xc')]},{'name':_0xfa63('0xd'),'fields':[_0xfa63('0xe')],'type':_0xfa63('0xf')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x504d18,_0x2c1143,_0x3231be){var _0x1026d6=_0x2de68d[_0xfa63('0x10')];var _0x31160a=_0x504d18[_0xfa63('0x11')]({'plain':!![]});if(_0x31160a[_0xfa63('0x12')][_0xfa63('0x13')]()==='in'||_0x31160a[_0xfa63('0x12')][_0xfa63('0x13')]()===_0xfa63('0x14')&&!_0x31160a[_0xfa63('0x15')]&&!_[_0xfa63('0x16')](_0x31160a[_0xfa63('0x17')])){_0x1026d6[_0xfa63('0x18')][_0xfa63('0x19')]({'where':{'id':_0x31160a['WhatsappInteractionId']}})[_0xfa63('0x1a')](function(_0x30e740){if(_0x30e740){_0x30e740[_0xfa63('0x1b')]({'lastMsgAt':_0x31160a['createdAt'],'lastMsgDirection':_0x31160a[_0xfa63('0x12')][_0xfa63('0x13')]()});}})['catch'](function(_0x5cd619){console[_0xfa63('0x1c')](_0x5cd619);});}if(_0x31160a[_0xfa63('0x12')]==='out'&&!_0x31160a[_0xfa63('0x15')]){var _0x37010e;_0x1026d6[_0xfa63('0x1d')]['find']({'where':{'id':_0x31160a['WhatsappAccountId']},'raw':!![]})[_0xfa63('0x1a')](function(_0x392531){_0x37010e=_0x392531;if(_0x37010e&&_0x37010e[_0xfa63('0x1e')]){switch(_0x37010e[_0xfa63('0x1e')]){case _0xfa63('0x1f'):var _0x4b7112=require(_0xfa63('0x1f'));if(_0x37010e['accountSid']&&_0x37010e[_0xfa63('0x20')]&&_0x37010e[_0xfa63('0x21')]){var _0x20f90b=new _0x4b7112(_0x37010e[_0xfa63('0x22')],_0x37010e[_0xfa63('0x20')]);_0x20f90b[_0xfa63('0x23')][_0xfa63('0x24')]({'body':_0x31160a[_0xfa63('0xe')],'to':_0xfa63('0x25')+_0x31160a['phone'],'from':_0xfa63('0x25')+_0x37010e[_0xfa63('0x21')],'statusCallback':_0x37010e[_0xfa63('0x26')]+'/api/whatsapp/messages/'+_0x31160a['id']+_0xfa63('0x27')+_0x37010e[_0xfa63('0x28')]})[_0xfa63('0x1a')](function(_0x25936c){if(_0x25936c[_0xfa63('0x29')]){return _0x504d18['update']({'messageId':_0x25936c['sid']});}})[_0xfa63('0x2a')](function(_0x204db1){logger[_0xfa63('0x1c')]('WhatsappMessage,\x20%s,\x20%s,\x20%s',_0xfa63('0x2b'),_0xfa63('0x1f'),util['inspect'](_0x204db1,{'showHidden':![],'depth':null}));});}else{logger[_0xfa63('0x1c')](_0xfa63('0x2c'),_0xfa63('0x2b'),_0xfa63('0x1f'),_0xfa63('0x2d'));}break;}}})[_0xfa63('0x2e')](function(){_0x3231be();});}else{_0x3231be();}}},'charset':'utf8mb4','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 afb7b68..0c65408 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 _0x1058=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http','defaults','redis','socket.io-emitter','./whatsappMessage.socket','register','request','info','WhatsappMessage,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','catch','CreateWhatsappMessage','WhatsappMessage','create','body','options','lodash','util'];(function(_0x417ca3,_0x54f30a){var _0x5f4ded=function(_0x46e366){while(--_0x46e366){_0x417ca3['push'](_0x417ca3['shift']());}};_0x5f4ded(++_0x54f30a);}(_0x1058,0x1de));var _0x8105=function(_0x50929b,_0x448269){_0x50929b=_0x50929b-0x0;var _0x4db45d=_0x1058[_0x50929b];return _0x4db45d;};'use strict';var _=require(_0x8105('0x0'));var util=require(_0x8105('0x1'));var moment=require(_0x8105('0x2'));var BPromise=require(_0x8105('0x3'));var rs=require(_0x8105('0x4'));var fs=require('fs');var Redis=require(_0x8105('0x5'));var db=require(_0x8105('0x6'))['db'];var utils=require(_0x8105('0x7'));var logger=require(_0x8105('0x8'))('rpc');var config=require('../../config/environment');var jayson=require(_0x8105('0x9'));var client=jayson[_0x8105('0xa')][_0x8105('0xb')]({'port':0x232a});config['redis']=_[_0x8105('0xc')](config[_0x8105('0xd')],{'host':'localhost','port':0x18eb});var socket=require(_0x8105('0xe'))(new Redis(config['redis']));require(_0x8105('0xf'))[_0x8105('0x10')](socket);function respondWithRpcPromise(_0x4885d5,_0x52cfbc,_0x297a4f){return new BPromise(function(_0x5d788f,_0x57f466){return client[_0x8105('0x11')](_0x4885d5,_0x297a4f)['then'](function(_0x3b7b2b){logger[_0x8105('0x12')](_0x8105('0x13'),_0x52cfbc,_0x8105('0x14'));logger[_0x8105('0x15')]('WhatsappMessage,\x20%s,\x20%s,\x20%s',_0x52cfbc,_0x8105('0x14'),JSON[_0x8105('0x16')](_0x3b7b2b));if(_0x3b7b2b['error']){if(_0x3b7b2b[_0x8105('0x17')]['code']===0x1f4){logger[_0x8105('0x17')]('WhatsappMessage,\x20%s,\x20%s',_0x52cfbc,_0x3b7b2b[_0x8105('0x17')][_0x8105('0x18')]);return _0x57f466(_0x3b7b2b['error'][_0x8105('0x18')]);}logger[_0x8105('0x17')]('WhatsappMessage,\x20%s,\x20%s',_0x52cfbc,_0x3b7b2b[_0x8105('0x17')][_0x8105('0x18')]);return _0x5d788f(_0x3b7b2b[_0x8105('0x17')][_0x8105('0x18')]);}else{logger[_0x8105('0x12')](_0x8105('0x13'),_0x52cfbc,_0x8105('0x14'));_0x5d788f(_0x3b7b2b[_0x8105('0x19')][_0x8105('0x18')]);}})[_0x8105('0x1a')](function(_0x254476){logger['error']('WhatsappMessage,\x20%s,\x20%s',_0x52cfbc,_0x254476);_0x57f466(_0x254476);});});}exports[_0x8105('0x1b')]=function(_0x27f49d){var _0x20d2c2=this;return new Promise(function(_0x3caa8d,_0x37570d){return db[_0x8105('0x1c')][_0x8105('0x1d')](_0x27f49d[_0x8105('0x1e')],{'raw':_0x27f49d['options']?_0x27f49d[_0x8105('0x1f')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0xb5f611){logger[_0x8105('0x12')]('CreateWhatsappMessage',_0x27f49d);logger[_0x8105('0x15')](_0x8105('0x1b'),_0x27f49d,JSON[_0x8105('0x16')](_0xb5f611));_0x3caa8d(_0xb5f611);})[_0x8105('0x1a')](function(_0x5a639c){logger[_0x8105('0x17')](_0x8105('0x1b'),_0x5a639c[_0x8105('0x18')],_0x27f49d);_0x37570d(_0x20d2c2[_0x8105('0x17')](0x1f4,_0x5a639c[_0x8105('0x18')]));});});}; \ No newline at end of file +var _0x19c3=['../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','./whatsappMessage.socket','register','request','then','request\x20sent','WhatsappMessage,\x20%s,\x20%s,\x20%s','stringify','error','WhatsappMessage,\x20%s,\x20%s','message','info','result','catch','CreateWhatsappMessage','WhatsappMessage','create','options','debug','lodash','util','moment','bluebird','randomstring','ioredis'];(function(_0x397b38,_0xe81a28){var _0x108e60=function(_0x2beacf){while(--_0x2beacf){_0x397b38['push'](_0x397b38['shift']());}};_0x108e60(++_0xe81a28);}(_0x19c3,0x102));var _0x319c=function(_0x3f009a,_0x19fb63){_0x3f009a=_0x3f009a-0x0;var _0x180345=_0x19c3[_0x3f009a];return _0x180345;};'use strict';var _=require(_0x319c('0x0'));var util=require(_0x319c('0x1'));var moment=require(_0x319c('0x2'));var BPromise=require(_0x319c('0x3'));var rs=require(_0x319c('0x4'));var fs=require('fs');var Redis=require(_0x319c('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x319c('0x6'));var logger=require(_0x319c('0x7'))(_0x319c('0x8'));var config=require(_0x319c('0x9'));var jayson=require(_0x319c('0xa'));var client=jayson[_0x319c('0xb')][_0x319c('0xc')]({'port':0x232a});config[_0x319c('0xd')]=_['defaults'](config['redis'],{'host':_0x319c('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x319c('0xf'))[_0x319c('0x10')](socket);function respondWithRpcPromise(_0x1a6a91,_0x277f0c,_0x1fd67e){return new BPromise(function(_0x32e5bf,_0x578f2b){return client[_0x319c('0x11')](_0x1a6a91,_0x1fd67e)[_0x319c('0x12')](function(_0x4ef970){logger['info']('WhatsappMessage,\x20%s,\x20%s',_0x277f0c,_0x319c('0x13'));logger['debug'](_0x319c('0x14'),_0x277f0c,'request\x20sent',JSON[_0x319c('0x15')](_0x4ef970));if(_0x4ef970[_0x319c('0x16')]){if(_0x4ef970['error']['code']===0x1f4){logger[_0x319c('0x16')](_0x319c('0x17'),_0x277f0c,_0x4ef970[_0x319c('0x16')][_0x319c('0x18')]);return _0x578f2b(_0x4ef970[_0x319c('0x16')][_0x319c('0x18')]);}logger[_0x319c('0x16')](_0x319c('0x17'),_0x277f0c,_0x4ef970[_0x319c('0x16')][_0x319c('0x18')]);return _0x32e5bf(_0x4ef970[_0x319c('0x16')][_0x319c('0x18')]);}else{logger[_0x319c('0x19')](_0x319c('0x17'),_0x277f0c,_0x319c('0x13'));_0x32e5bf(_0x4ef970[_0x319c('0x1a')][_0x319c('0x18')]);}})[_0x319c('0x1b')](function(_0x2205ad){logger['error'](_0x319c('0x17'),_0x277f0c,_0x2205ad);_0x578f2b(_0x2205ad);});});}exports[_0x319c('0x1c')]=function(_0x152512){var _0x32b03b=this;return new Promise(function(_0x135cd9,_0x506fd0){return db[_0x319c('0x1d')][_0x319c('0x1e')](_0x152512['body'],{'raw':_0x152512[_0x319c('0x1f')]?_0x152512[_0x319c('0x1f')]['raw']===undefined?!![]:![]:!![]})[_0x319c('0x12')](function(_0x4d6247){logger[_0x319c('0x19')]('CreateWhatsappMessage',_0x152512);logger[_0x319c('0x20')]('CreateWhatsappMessage',_0x152512,JSON[_0x319c('0x15')](_0x4d6247));_0x135cd9(_0x4d6247);})[_0x319c('0x1b')](function(_0x328677){logger['error'](_0x319c('0x1c'),_0x328677[_0x319c('0x18')],_0x152512);_0x506fd0(_0x32b03b[_0x319c('0x16')](0x1f4,_0x328677['message']));});});}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.socket.js b/server/api/whatsappMessage/whatsappMessage.socket.js index 4a8bc13..c37cc2f 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 _0xab72=['removeListener','register','whatsappMessage:','remove','update','emit'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0xab72,0x123));var _0x2ab7=function(_0x76782a,_0x815cde){_0x76782a=_0x76782a-0x0;var _0x29ebb6=_0xab72[_0x76782a];return _0x29ebb6;};'use strict';var WhatsappMessageEvents=require('./whatsappMessage.events');var events=['save',_0x2ab7('0x0'),_0x2ab7('0x1')];function createListener(_0xf333d0,_0x27dedd){return function(_0x28fc27){_0x27dedd[_0x2ab7('0x2')](_0xf333d0,_0x28fc27);};}function removeListener(_0x34540d,_0x34d14a){return function(){WhatsappMessageEvents[_0x2ab7('0x3')](_0x34540d,_0x34d14a);};}exports[_0x2ab7('0x4')]=function(_0x6919d7){for(var _0x1177cd=0x0,_0x49c770=events['length'];_0x1177cd<_0x49c770;_0x1177cd++){var _0x10b8ef=events[_0x1177cd];var _0x3be695=createListener(_0x2ab7('0x5')+_0x10b8ef,_0x6919d7);WhatsappMessageEvents['on'](_0x10b8ef,_0x3be695);}}; \ No newline at end of file +var _0x3f2b=['remove','update','length','whatsappMessage:','./whatsappMessage.events','save'];(function(_0x43dc27,_0x1c7a69){var _0xda3954=function(_0x1a8f2a){while(--_0x1a8f2a){_0x43dc27['push'](_0x43dc27['shift']());}};_0xda3954(++_0x1c7a69);}(_0x3f2b,0x13c));var _0xb3f2=function(_0x39661d,_0x48ad03){_0x39661d=_0x39661d-0x0;var _0x1e6639=_0x3f2b[_0x39661d];return _0x1e6639;};'use strict';var WhatsappMessageEvents=require(_0xb3f2('0x0'));var events=[_0xb3f2('0x1'),_0xb3f2('0x2'),_0xb3f2('0x3')];function createListener(_0x319af5,_0x1f9de6){return function(_0x40920a){_0x1f9de6['emit'](_0x319af5,_0x40920a);};}function removeListener(_0x39dd35,_0x45a7e7){return function(){WhatsappMessageEvents['removeListener'](_0x39dd35,_0x45a7e7);};}exports['register']=function(_0x1ce440){for(var _0x286d6b=0x0,_0x65a50d=events[_0xb3f2('0x4')];_0x286d6b<_0x65a50d;_0x286d6b++){var _0x256699=events[_0x286d6b];var _0x2422e1=createListener(_0xb3f2('0x5')+_0x256699,_0x1ce440);WhatsappMessageEvents['on'](_0x256699,_0x2422e1);}}; \ No newline at end of file diff --git a/server/api/whatsappQueue/index.js b/server/api/whatsappQueue/index.js index 5dfe8b5..7018bd4 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 _0xe604=['removeAgents','util','connect-timeout','Router','../../config/environment','./whatsappQueue.controller','isAuthenticated','get','/describe','describe','/:id','show','/:id/members','getMembers','/:id/teams','/:id/users','post','addAgents','put','update','delete','removeTeams'];(function(_0x353d59,_0xbc0e8e){var _0x59d50f=function(_0x397865){while(--_0x397865){_0x353d59['push'](_0x353d59['shift']());}};_0x59d50f(++_0xbc0e8e);}(_0xe604,0xdd));var _0x4e60=function(_0x52b3e3,_0x4a3615){_0x52b3e3=_0x52b3e3-0x0;var _0x31b17d=_0xe604[_0x52b3e3];return _0x31b17d;};'use strict';var multer=require('multer');var util=require(_0x4e60('0x0'));var path=require('path');var timeout=require(_0x4e60('0x1'));var express=require('express');var router=express[_0x4e60('0x2')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x4e60('0x3'));var controller=require(_0x4e60('0x4'));router['get']('/',auth[_0x4e60('0x5')](),controller['index']);router[_0x4e60('0x6')](_0x4e60('0x7'),auth[_0x4e60('0x5')](),controller[_0x4e60('0x8')]);router[_0x4e60('0x6')](_0x4e60('0x9'),auth[_0x4e60('0x5')](),controller[_0x4e60('0xa')]);router[_0x4e60('0x6')](_0x4e60('0xb'),auth[_0x4e60('0x5')](),controller[_0x4e60('0xc')]);router[_0x4e60('0x6')](_0x4e60('0xd'),auth[_0x4e60('0x5')](),controller['getTeams']);router[_0x4e60('0x6')](_0x4e60('0xe'),auth['isAuthenticated'](),controller['getAgents']);router[_0x4e60('0xf')]('/',auth[_0x4e60('0x5')](),controller['create']);router[_0x4e60('0xf')](_0x4e60('0xd'),auth[_0x4e60('0x5')](),controller['addTeams']);router['post']('/:id/users',auth[_0x4e60('0x5')](),controller[_0x4e60('0x10')]);router[_0x4e60('0x11')](_0x4e60('0x9'),auth[_0x4e60('0x5')](),controller[_0x4e60('0x12')]);router['delete']('/:id',auth[_0x4e60('0x5')](),controller['destroy']);router[_0x4e60('0x13')](_0x4e60('0xd'),auth[_0x4e60('0x5')](),controller[_0x4e60('0x14')]);router[_0x4e60('0x13')](_0x4e60('0xe'),auth[_0x4e60('0x5')](),controller[_0x4e60('0x15')]);module['exports']=router; \ No newline at end of file +var _0x6f1c=['post','create','addTeams','/:id/users','addAgents','/:id','delete','destroy','removeTeams','removeAgents','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappQueue.controller','get','isAuthenticated','index','/describe','describe','show','/:id/members','getMembers','/:id/teams','getTeams','getAgents'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0x6f1c,0x160));var _0xc6f1=function(_0x17e48f,_0x2e36e9){_0x17e48f=_0x17e48f-0x0;var _0x49ee3e=_0x6f1c[_0x17e48f];return _0x49ee3e;};'use strict';var multer=require(_0xc6f1('0x0'));var util=require(_0xc6f1('0x1'));var path=require(_0xc6f1('0x2'));var timeout=require(_0xc6f1('0x3'));var express=require('express');var router=express[_0xc6f1('0x4')]();var auth=require(_0xc6f1('0x5'));var interaction=require(_0xc6f1('0x6'));var config=require(_0xc6f1('0x7'));var controller=require(_0xc6f1('0x8'));router[_0xc6f1('0x9')]('/',auth[_0xc6f1('0xa')](),controller[_0xc6f1('0xb')]);router[_0xc6f1('0x9')](_0xc6f1('0xc'),auth[_0xc6f1('0xa')](),controller[_0xc6f1('0xd')]);router[_0xc6f1('0x9')]('/:id',auth[_0xc6f1('0xa')](),controller[_0xc6f1('0xe')]);router['get'](_0xc6f1('0xf'),auth[_0xc6f1('0xa')](),controller[_0xc6f1('0x10')]);router[_0xc6f1('0x9')](_0xc6f1('0x11'),auth[_0xc6f1('0xa')](),controller[_0xc6f1('0x12')]);router['get']('/:id/users',auth[_0xc6f1('0xa')](),controller[_0xc6f1('0x13')]);router[_0xc6f1('0x14')]('/',auth[_0xc6f1('0xa')](),controller[_0xc6f1('0x15')]);router[_0xc6f1('0x14')](_0xc6f1('0x11'),auth[_0xc6f1('0xa')](),controller[_0xc6f1('0x16')]);router[_0xc6f1('0x14')](_0xc6f1('0x17'),auth['isAuthenticated'](),controller[_0xc6f1('0x18')]);router['put'](_0xc6f1('0x19'),auth[_0xc6f1('0xa')](),controller['update']);router[_0xc6f1('0x1a')]('/:id',auth[_0xc6f1('0xa')](),controller[_0xc6f1('0x1b')]);router[_0xc6f1('0x1a')](_0xc6f1('0x11'),auth[_0xc6f1('0xa')](),controller[_0xc6f1('0x1c')]);router['delete'](_0xc6f1('0x17'),auth[_0xc6f1('0xa')](),controller[_0xc6f1('0x1d')]);module[_0xc6f1('0x1e')]=router; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.attributes.js b/server/api/whatsappQueue/whatsappQueue.attributes.js index 64af4a4..f944c4f 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 _0xa422=['beepall','roundrobin','sequelize','INTEGER','ENUM'];(function(_0x3e44fa,_0x75ed2a){var _0x2a0aba=function(_0x1db6a7){while(--_0x1db6a7){_0x3e44fa['push'](_0x3e44fa['shift']());}};_0x2a0aba(++_0x75ed2a);}(_0xa422,0x16f));var _0x2a42=function(_0x3715df,_0x578cb0){_0x3715df=_0x3715df-0x0;var _0xdf69b=_0xa422[_0x3715df];return _0xdf69b;};'use strict';var Sequelize=require(_0x2a42('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'timeout':{'type':Sequelize[_0x2a42('0x1')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x2a42('0x2')]('rrmemory',_0x2a42('0x3'),_0x2a42('0x4'))},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x4d00=['rrmemory','beepall','roundrobin','exports','STRING','name','INTEGER','ENUM'];(function(_0x4f1608,_0x401631){var _0x53a0a8=function(_0x4df0f3){while(--_0x4df0f3){_0x4f1608['push'](_0x4f1608['shift']());}};_0x53a0a8(++_0x401631);}(_0x4d00,0xe3));var _0x04d0=function(_0xa7cb80,_0x4d636a){_0xa7cb80=_0xa7cb80-0x0;var _0x5dbf8a=_0x4d00[_0xa7cb80];return _0x5dbf8a;};'use strict';var Sequelize=require('sequelize');module[_0x04d0('0x0')]={'name':{'type':Sequelize[_0x04d0('0x1')],'unique':_0x04d0('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'timeout':{'type':Sequelize[_0x04d0('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x04d0('0x4')](_0x04d0('0x5'),_0x04d0('0x6'),_0x04d0('0x7'))},'description':{'type':Sequelize[_0x04d0('0x1')]}}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.controller.js b/server/api/whatsappQueue/whatsappQueue.controller.js index 7fcc1f4..5b006d6 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 _0xcff3=['SIP','getTeams','findOne','Team','addTeams','ids','Agents','online','voicePause','interface','flatMap','sequelize','transaction','each','emit','userWhatsappQueue:save','removeTeams','select','field','tq.TeamId','from','team_has_whatsapp_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','WhatsappQueueId\x20=\x20?','ut.UserId\x20=\x20?','push','toString','SELECT','every','TeamId','includes','all','union','compact','isEmpty','userWhatsappQueue:remove','addAgents','spread','removeAgents','isArray','getAgents','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','socket.io-emitter','redis','register','sendStatus','status','json','count','offset','limit','set','Content-Range','apply','save','update','then','destroy','WhatsappQueues','UserProfileResource','end','error','name','send','map','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','WhatsappQueue','includeAll','include','findAll','rows','catch','show','params','keys','fields','find','create','body','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getMembers','UserWhatsappQueue','WhatsappQueueId','User','findAndCountAll','UserId','agent','updatedAt','format'];(function(_0x45564a,_0x160043){var _0x1184c7=function(_0x529f16){while(--_0x529f16){_0x45564a['push'](_0x45564a['shift']());}};_0x1184c7(++_0x160043);}(_0xcff3,0x14b));var _0x3cff=function(_0xbd08b4,_0x4790ed){_0xbd08b4=_0xbd08b4-0x0;var _0x314f1e=_0xcff3[_0xbd08b4];return _0x314f1e;};'use strict';var pdf=require(_0x3cff('0x0'));var emlformat=require(_0x3cff('0x1'));var rimraf=require(_0x3cff('0x2'));var zipdir=require(_0x3cff('0x3'));var jsonpatch=require(_0x3cff('0x4'));var rp=require(_0x3cff('0x5'));var moment=require(_0x3cff('0x6'));var BPromise=require('bluebird');var Mustache=require(_0x3cff('0x7'));var util=require(_0x3cff('0x8'));var path=require(_0x3cff('0x9'));var sox=require(_0x3cff('0xa'));var csv=require(_0x3cff('0xb'));var ejs=require(_0x3cff('0xc'));var fs=require('fs');var _=require(_0x3cff('0xd'));var squel=require(_0x3cff('0xe'));var crypto=require(_0x3cff('0xf'));var jsforce=require(_0x3cff('0x10'));var deskjs=require(_0x3cff('0x11'));var toCsv=require(_0x3cff('0xb'));var querystring=require(_0x3cff('0x12'));var Papa=require(_0x3cff('0x13'));var Redis=require(_0x3cff('0x14'));var authService=require('../../components/auth/service');var qs=require(_0x3cff('0x15'));var as=require(_0x3cff('0x16'));var hardwareService=require(_0x3cff('0x17'));var logger=require(_0x3cff('0x18'))(_0x3cff('0x19'));var utils=require(_0x3cff('0x1a'));var config=require(_0x3cff('0x1b'));var db=require(_0x3cff('0x1c'))['db'];config['redis']=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x3cff('0x1d'))(new Redis(config[_0x3cff('0x1e')]));require('./whatsappQueue.socket')[_0x3cff('0x1f')](socket);function respondWithStatusCode(_0x24258b,_0x3c8686){_0x3c8686=_0x3c8686||0xcc;return function(_0x570e11){if(_0x570e11){return _0x24258b[_0x3cff('0x20')](_0x3c8686);}return _0x24258b['status'](_0x3c8686)['end']();};}function respondWithResult(_0x1c9455,_0x268690){_0x268690=_0x268690||0xc8;return function(_0x1237d6){if(_0x1237d6){return _0x1c9455[_0x3cff('0x21')](_0x268690)[_0x3cff('0x22')](_0x1237d6);}};}function respondWithFilteredResult(_0x13a1ec,_0xcd9b31){return function(_0x2eea66){if(_0x2eea66){var _0x231422=_0x2eea66[_0x3cff('0x23')],_0x5cf134=_0xcd9b31[_0x3cff('0x24')],_0x4c5df8=_0xcd9b31[_0x3cff('0x24')]+_0xcd9b31[_0x3cff('0x25')],_0x2bbddb;if(_0x4c5df8>=_0x231422){_0x4c5df8=_0x231422;_0x2bbddb=0xc8;}else{_0x2bbddb=0xce;}_0x13a1ec[_0x3cff('0x21')](_0x2bbddb);return _0x13a1ec[_0x3cff('0x26')](_0x3cff('0x27'),_0x5cf134+'-'+_0x4c5df8+'/'+_0x231422)[_0x3cff('0x22')](_0x2eea66);}return null;};}function patchUpdates(_0x2a25ce){return function(_0x279210){try{jsonpatch[_0x3cff('0x28')](_0x279210,_0x2a25ce,!![]);}catch(_0x5eb182){return BPromise['reject'](_0x5eb182);}return _0x279210[_0x3cff('0x29')]();};}function saveUpdates(_0x37d563,_0x2c556){return function(_0x53a314){if(_0x53a314){return _0x53a314[_0x3cff('0x2a')](_0x37d563)[_0x3cff('0x2b')](function(_0x182e98){return _0x182e98;});}return null;};}function removeEntity(_0x223757,_0x221505){return function(_0x3f4281){if(_0x3f4281){return _0x3f4281[_0x3cff('0x2c')]()['then'](function(){var _0x4e4663=_0x3f4281['get']({'plain':!![]});var _0x5e2a1f=_0x3cff('0x2d');return db[_0x3cff('0x2e')][_0x3cff('0x2c')]({'where':{'type':_0x5e2a1f,'resourceId':_0x4e4663['id']}})[_0x3cff('0x2b')](function(){return _0x3f4281;});})[_0x3cff('0x2b')](function(){_0x223757[_0x3cff('0x21')](0xcc)[_0x3cff('0x2f')]();});}};}function handleEntityNotFound(_0x35403b,_0x2d8caf){return function(_0x53fa4d){if(!_0x53fa4d){_0x35403b[_0x3cff('0x20')](0x194);}return _0x53fa4d;};}function handleError(_0x256a9b,_0x2b043e){_0x2b043e=_0x2b043e||0x1f4;return function(_0x2f0659){logger[_0x3cff('0x30')](_0x2f0659['stack']);if(_0x2f0659[_0x3cff('0x31')]){delete _0x2f0659[_0x3cff('0x31')];}_0x256a9b[_0x3cff('0x21')](_0x2b043e)[_0x3cff('0x32')](_0x2f0659);};}exports['index']=function(_0x4d0a8d,_0x4ee55d){var _0xb69a18={},_0x52fef8={},_0x571c65={'count':0x0,'rows':[]};var _0x31f162=_[_0x3cff('0x33')](db['WhatsappQueue'][_0x3cff('0x34')],function(_0x396c82){return{'name':_0x396c82[_0x3cff('0x35')],'type':_0x396c82[_0x3cff('0x36')][_0x3cff('0x37')]};});_0x52fef8[_0x3cff('0x38')]=_[_0x3cff('0x33')](_0x31f162,'name');_0x52fef8[_0x3cff('0x39')]=_['keys'](_0x4d0a8d[_0x3cff('0x39')]);_0x52fef8[_0x3cff('0x3a')]=_[_0x3cff('0x3b')](_0x52fef8[_0x3cff('0x38')],_0x52fef8[_0x3cff('0x39')]);_0xb69a18[_0x3cff('0x3c')]=_[_0x3cff('0x3b')](_0x52fef8[_0x3cff('0x38')],qs['fields'](_0x4d0a8d['query']['fields']));_0xb69a18['attributes']=_0xb69a18[_0x3cff('0x3c')][_0x3cff('0x3d')]?_0xb69a18['attributes']:_0x52fef8[_0x3cff('0x38')];if(!_0x4d0a8d['query'][_0x3cff('0x3e')](_0x3cff('0x3f'))){_0xb69a18['limit']=qs['limit'](_0x4d0a8d[_0x3cff('0x39')][_0x3cff('0x25')]);_0xb69a18['offset']=qs[_0x3cff('0x24')](_0x4d0a8d['query'][_0x3cff('0x24')]);}_0xb69a18[_0x3cff('0x40')]=qs[_0x3cff('0x41')](_0x4d0a8d[_0x3cff('0x39')][_0x3cff('0x41')]);_0xb69a18['where']=qs[_0x3cff('0x3a')](_[_0x3cff('0x42')](_0x4d0a8d[_0x3cff('0x39')],_0x52fef8[_0x3cff('0x3a')]),_0x31f162);if(_0x4d0a8d[_0x3cff('0x39')][_0x3cff('0x43')]){_0xb69a18[_0x3cff('0x44')]=_[_0x3cff('0x45')](_0xb69a18[_0x3cff('0x44')],{'$or':_[_0x3cff('0x33')](_0x31f162,function(_0x398f2b){if(_0x398f2b[_0x3cff('0x36')]!==_0x3cff('0x46')){var _0x22d1fe={};_0x22d1fe[_0x398f2b[_0x3cff('0x31')]]={'$like':'%'+_0x4d0a8d[_0x3cff('0x39')][_0x3cff('0x43')]+'%'};return _0x22d1fe;}})});}_0xb69a18=_[_0x3cff('0x45')]({},_0xb69a18,_0x4d0a8d[_0x3cff('0x47')]);var _0x2ab760={'where':_0xb69a18['where']};return db[_0x3cff('0x48')][_0x3cff('0x23')](_0x2ab760)[_0x3cff('0x2b')](function(_0x34ce23){_0x571c65[_0x3cff('0x23')]=_0x34ce23;if(_0x4d0a8d[_0x3cff('0x39')][_0x3cff('0x49')]){_0xb69a18[_0x3cff('0x4a')]=[{'all':!![]}];}return db[_0x3cff('0x48')][_0x3cff('0x4b')](_0xb69a18);})[_0x3cff('0x2b')](function(_0x28a1d7){_0x571c65[_0x3cff('0x4c')]=_0x28a1d7;return _0x571c65;})[_0x3cff('0x2b')](respondWithFilteredResult(_0x4ee55d,_0xb69a18))[_0x3cff('0x4d')](handleError(_0x4ee55d,null));};exports[_0x3cff('0x4e')]=function(_0x49282c,_0x18d4ca){var _0x41d2f7={'raw':!![],'where':{'id':_0x49282c[_0x3cff('0x4f')]['id']}},_0x145fc0={};_0x145fc0['model']=_[_0x3cff('0x50')](db[_0x3cff('0x48')]['rawAttributes']);_0x145fc0[_0x3cff('0x39')]=_[_0x3cff('0x50')](_0x49282c[_0x3cff('0x39')]);_0x145fc0[_0x3cff('0x3a')]=_[_0x3cff('0x3b')](_0x145fc0[_0x3cff('0x38')],_0x145fc0[_0x3cff('0x39')]);_0x41d2f7[_0x3cff('0x3c')]=_[_0x3cff('0x3b')](_0x145fc0[_0x3cff('0x38')],qs['fields'](_0x49282c[_0x3cff('0x39')][_0x3cff('0x51')]));_0x41d2f7['attributes']=_0x41d2f7[_0x3cff('0x3c')][_0x3cff('0x3d')]?_0x41d2f7[_0x3cff('0x3c')]:_0x145fc0[_0x3cff('0x38')];if(_0x49282c[_0x3cff('0x39')]['includeAll']){_0x41d2f7[_0x3cff('0x4a')]=[{'all':!![]}];}_0x41d2f7=_[_0x3cff('0x45')]({},_0x41d2f7,_0x49282c[_0x3cff('0x47')]);return db[_0x3cff('0x48')][_0x3cff('0x52')](_0x41d2f7)['then'](handleEntityNotFound(_0x18d4ca,null))[_0x3cff('0x2b')](respondWithResult(_0x18d4ca,null))['catch'](handleError(_0x18d4ca,null));};exports['create']=function(_0x3bc407,_0x35c361){return db[_0x3cff('0x48')][_0x3cff('0x53')](_0x3bc407[_0x3cff('0x54')],{})[_0x3cff('0x2b')](function(_0x52ebd6){var _0x28e42d=_0x3bc407['user'][_0x3cff('0x55')]({'plain':!![]});if(!_0x28e42d)throw new Error(_0x3cff('0x56'));if(_0x28e42d[_0x3cff('0x57')]===_0x3cff('0x58')){var _0x4f0758=_0x52ebd6[_0x3cff('0x55')]({'plain':!![]});var _0x195082='WhatsappQueues';return db[_0x3cff('0x59')][_0x3cff('0x52')]({'where':{'name':_0x195082,'userProfileId':_0x28e42d[_0x3cff('0x5a')]},'raw':!![]})[_0x3cff('0x2b')](function(_0x667df){if(_0x667df&&_0x667df['autoAssociation']===0x0){return db[_0x3cff('0x2e')][_0x3cff('0x53')]({'name':_0x4f0758[_0x3cff('0x31')],'resourceId':_0x4f0758['id'],'type':_0x667df[_0x3cff('0x31')],'sectionId':_0x667df['id']},{})[_0x3cff('0x2b')](function(){return _0x52ebd6;});}else{return _0x52ebd6;}})['catch'](function(_0x5bd691){logger[_0x3cff('0x30')](_0x3cff('0x5b'),_0x5bd691);throw _0x5bd691;});}return _0x52ebd6;})[_0x3cff('0x2b')](respondWithResult(_0x35c361,0xc9))[_0x3cff('0x4d')](handleError(_0x35c361,null));};exports[_0x3cff('0x2a')]=function(_0x2ccc45,_0x3f255e){if(_0x2ccc45[_0x3cff('0x54')]['id']){delete _0x2ccc45[_0x3cff('0x54')]['id'];}return db[_0x3cff('0x48')][_0x3cff('0x52')]({'where':{'id':_0x2ccc45[_0x3cff('0x4f')]['id']}})['then'](handleEntityNotFound(_0x3f255e,null))[_0x3cff('0x2b')](saveUpdates(_0x2ccc45[_0x3cff('0x54')],null))['then'](respondWithResult(_0x3f255e,null))[_0x3cff('0x4d')](handleError(_0x3f255e,null));};exports[_0x3cff('0x2c')]=function(_0x1916ae,_0x7737dc){return db[_0x3cff('0x48')][_0x3cff('0x52')]({'where':{'id':_0x1916ae[_0x3cff('0x4f')]['id']}})[_0x3cff('0x2b')](handleEntityNotFound(_0x7737dc,null))[_0x3cff('0x2b')](removeEntity(_0x7737dc,null))['catch'](handleError(_0x7737dc,null));};exports['describe']=function(_0x576749,_0x42992e){return db[_0x3cff('0x48')]['describe']()[_0x3cff('0x2b')](respondWithResult(_0x42992e,null))[_0x3cff('0x4d')](handleError(_0x42992e,null));};exports[_0x3cff('0x5c')]=function(_0x4244e9,_0x1aa975,_0x3a146a){var _0x336310={'raw':!![],'where':{}},_0x2d485d={},_0x3a7d5d;return db[_0x3cff('0x48')]['findOne']({'where':{'id':_0x4244e9[_0x3cff('0x4f')]['id']}})[_0x3cff('0x2b')](handleEntityNotFound(_0x1aa975,null))[_0x3cff('0x2b')](function(_0x2a1a4c){if(_0x2a1a4c){_0x3a7d5d=_0x2a1a4c[_0x3cff('0x55')]({'plain':!![]});_0x2d485d['model']=_[_0x3cff('0x50')](db[_0x3cff('0x5d')][_0x3cff('0x34')]);_0x2d485d[_0x3cff('0x39')]=_['keys'](_0x4244e9[_0x3cff('0x39')]);_0x2d485d['filters']=_[_0x3cff('0x3b')](_0x2d485d[_0x3cff('0x38')],_0x2d485d['query']);_0x336310['attributes']=_['intersection'](_0x2d485d['model'],qs[_0x3cff('0x51')](_0x4244e9[_0x3cff('0x39')][_0x3cff('0x51')]));_0x336310['attributes']=_0x336310[_0x3cff('0x3c')][_0x3cff('0x3d')]?_0x336310['attributes']:_0x2d485d[_0x3cff('0x38')];if(!_0x4244e9[_0x3cff('0x39')]['hasOwnProperty'](_0x3cff('0x3f'))){_0x336310[_0x3cff('0x25')]=qs['limit'](_0x4244e9[_0x3cff('0x39')][_0x3cff('0x25')]);_0x336310[_0x3cff('0x24')]=qs[_0x3cff('0x24')](_0x4244e9[_0x3cff('0x39')][_0x3cff('0x24')]);}_0x336310[_0x3cff('0x40')]=qs[_0x3cff('0x41')](_0x4244e9[_0x3cff('0x39')][_0x3cff('0x41')]);_0x336310[_0x3cff('0x44')]=qs[_0x3cff('0x3a')](_[_0x3cff('0x42')](_0x4244e9[_0x3cff('0x39')],_0x2d485d[_0x3cff('0x3a')]));_0x336310[_0x3cff('0x44')][_0x3cff('0x5e')]=_0x2a1a4c['id'];if(_0x4244e9[_0x3cff('0x39')][_0x3cff('0x43')]){_0x336310[_0x3cff('0x44')]=_[_0x3cff('0x45')](_0x336310[_0x3cff('0x44')],{'$or':_[_0x3cff('0x33')](_0x336310['attributes'],function(_0x561e2b){var _0xbb9f39={};_0xbb9f39[_0x561e2b]={'$like':'%'+_0x4244e9[_0x3cff('0x39')][_0x3cff('0x43')]+'%'};return _0xbb9f39;})});}_0x336310=_[_0x3cff('0x45')]({},_0x336310,_0x4244e9['options']);return db[_0x3cff('0x5d')][_0x3cff('0x4b')](_0x336310);}})[_0x3cff('0x2b')](function(_0x2c4ce8){if(_0x2c4ce8){return db[_0x3cff('0x5f')][_0x3cff('0x60')]({'where':{'id':_[_0x3cff('0x33')](_0x2c4ce8,_0x3cff('0x61')),'role':_0x3cff('0x62')},'attributes':['id',_0x3cff('0x31'),'whatsappPause',_0x3cff('0x63'),'createdAt']});}})[_0x3cff('0x2b')](function(_0xc6ea7c){if(_0xc6ea7c){return{'count':_0xc6ea7c[_0x3cff('0x23')],'rows':_['map'](_0xc6ea7c[_0x3cff('0x4c')],function(_0x8bfc17){return{'membername':_0x8bfc17[_0x3cff('0x31')],'UserId':_0x8bfc17['id'],'queue_name':_0x3a7d5d['name'],'WhatsappQueueId':_0x3a7d5d['id'],'interface':util[_0x3cff('0x64')]('%s/%s',_0x3cff('0x65'),_0x8bfc17['name']),'penalty':0x0,'paused':_0x8bfc17['whatsappPause'],'createdAt':_0x8bfc17['createdAt'],'updatedAt':_0x8bfc17['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})[_0x3cff('0x2b')](respondWithFilteredResult(_0x1aa975,_0x336310))[_0x3cff('0x4d')](handleError(_0x1aa975,null));};exports[_0x3cff('0x66')]=function(_0x358655,_0x371934,_0x182093){var _0x263d85={};var _0x2ad953={};var _0x4a42ca;var _0x182675;return db[_0x3cff('0x48')][_0x3cff('0x67')]({'where':{'id':_0x358655[_0x3cff('0x4f')]['id']}})[_0x3cff('0x2b')](handleEntityNotFound(_0x371934,null))['then'](function(_0x2323e5){if(_0x2323e5){_0x4a42ca=_0x2323e5;_0x2ad953[_0x3cff('0x38')]=_[_0x3cff('0x50')](db[_0x3cff('0x68')][_0x3cff('0x34')]);_0x2ad953[_0x3cff('0x39')]=_[_0x3cff('0x50')](_0x358655['query']);_0x2ad953[_0x3cff('0x3a')]=_[_0x3cff('0x3b')](_0x2ad953[_0x3cff('0x38')],_0x2ad953['query']);_0x263d85[_0x3cff('0x3c')]=_[_0x3cff('0x3b')](_0x2ad953[_0x3cff('0x38')],qs[_0x3cff('0x51')](_0x358655[_0x3cff('0x39')][_0x3cff('0x51')]));_0x263d85[_0x3cff('0x3c')]=_0x263d85[_0x3cff('0x3c')][_0x3cff('0x3d')]?_0x263d85[_0x3cff('0x3c')]:_0x2ad953['model'];_0x263d85['order']=qs['sort'](_0x358655[_0x3cff('0x39')]['sort']);_0x263d85['where']=qs[_0x3cff('0x3a')](_['pick'](_0x358655['query'],_0x2ad953[_0x3cff('0x3a')]));if(_0x358655[_0x3cff('0x39')][_0x3cff('0x43')]){_0x263d85[_0x3cff('0x44')]=_[_0x3cff('0x45')](_0x263d85[_0x3cff('0x44')],{'$or':_[_0x3cff('0x33')](_0x263d85['attributes'],function(_0x478bc4){var _0x3dedc5={};_0x3dedc5[_0x478bc4]={'$like':'%'+_0x358655[_0x3cff('0x39')][_0x3cff('0x43')]+'%'};return _0x3dedc5;})});}_0x263d85=_[_0x3cff('0x45')]({},_0x263d85,_0x358655[_0x3cff('0x47')]);return _0x4a42ca[_0x3cff('0x66')](_0x263d85);}})[_0x3cff('0x2b')](function(_0xf3cce9){if(_0xf3cce9){_0x182675=_0xf3cce9[_0x3cff('0x3d')];if(!_0x358655['query'][_0x3cff('0x3e')](_0x3cff('0x3f'))){_0x263d85[_0x3cff('0x25')]=qs['limit'](_0x358655['query'][_0x3cff('0x25')]);_0x263d85[_0x3cff('0x24')]=qs[_0x3cff('0x24')](_0x358655['query'][_0x3cff('0x24')]);}return _0x4a42ca[_0x3cff('0x66')](_0x263d85);}})[_0x3cff('0x2b')](function(_0x35679b){if(_0x35679b){return _0x35679b?{'count':_0x182675,'rows':_0x35679b}:null;}})['then'](respondWithResult(_0x371934,null))['catch'](handleError(_0x371934,null));};exports[_0x3cff('0x69')]=function(_0x47e9c2,_0x3c8933,_0x35716c){var _0x38958c=_0x47e9c2[_0x3cff('0x54')][_0x3cff('0x6a')];return db[_0x3cff('0x68')][_0x3cff('0x4b')]({'where':{'id':_0x38958c},'attributes':['id'],'include':[{'model':db[_0x3cff('0x5f')],'as':_0x3cff('0x6b'),'attributes':['id',_0x3cff('0x31'),_0x3cff('0x6c'),_0x3cff('0x6d'),_0x3cff('0x6e')],'raw':!![]}]})[_0x3cff('0x2b')](function(_0x2255a2){if(_0x2255a2){var _0x11b3a2=_[_0x3cff('0x6f')](_0x2255a2,function(_0x43678b){var _0x49f355=_0x43678b[_0x3cff('0x55')]({'plain':!![]});return _0x49f355[_0x3cff('0x6b')];});return db[_0x3cff('0x48')][_0x3cff('0x52')]({'where':{'id':_0x47e9c2[_0x3cff('0x4f')]['id']}})[_0x3cff('0x2b')](function(_0xa6b439){return db[_0x3cff('0x70')][_0x3cff('0x71')](function(_0x1bd6dc){return _0xa6b439['addTeams'](_0x38958c,{'transaction':_0x1bd6dc})[_0x3cff('0x2b')](function(){return BPromise[_0x3cff('0x72')](_0x11b3a2,function(_0x357e34){return db[_0x3cff('0x5d')]['findOrCreate']({'where':{'UserId':_0x357e34['id'],'WhatsappQueueId':_0x47e9c2[_0x3cff('0x4f')]['id']},'transaction':_0x1bd6dc});});})[_0x3cff('0x2b')](function(){_0x11b3a2['forEach'](function(_0x17da08){socket[_0x3cff('0x73')](_0x3cff('0x74'),{'UserId':_0x17da08['id'],'WhatsappQueueId':_0xa6b439['id']});});});});});}})[_0x3cff('0x2b')](respondWithStatusCode(_0x3c8933,null))['catch'](handleError(_0x3c8933,null));};exports[_0x3cff('0x75')]=function(_0x239c5e,_0x41f8a3,_0x10f836){return db[_0x3cff('0x68')]['findAll']({'where':{'id':_0x239c5e[_0x3cff('0x39')][_0x3cff('0x6a')]},'attributes':['id'],'include':[{'model':db[_0x3cff('0x5f')],'as':_0x3cff('0x6b'),'attributes':['id'],'raw':!![]}]})[_0x3cff('0x2b')](handleEntityNotFound(_0x41f8a3,null))[_0x3cff('0x2b')](function(_0x1bab7f){var _0x1737f3=_[_0x3cff('0x33')](_0x1bab7f,'id');var _0x496ca0=[];var _0x1208fa=[];var _0x5b9e70=squel[_0x3cff('0x76')]();_0x5b9e70[_0x3cff('0x77')](_0x3cff('0x78'))[_0x3cff('0x79')](_0x3cff('0x7a'),'tq')[_0x3cff('0x7b')](_0x3cff('0x7c'),'ut',_0x3cff('0x7d'))[_0x3cff('0x44')](_0x3cff('0x7e'),_0x239c5e[_0x3cff('0x4f')]['id']);for(var _0x48f6a3=0x0;_0x48f6a3<_0x1bab7f[_0x3cff('0x3d')];_0x48f6a3+=0x1){let _0x157cc4=_0x1bab7f[_0x48f6a3];for(var _0x1bca79=0x0;_0x1bca79<_0x157cc4[_0x3cff('0x6b')][_0x3cff('0x3d')];_0x1bca79+=0x1){let _0x5308aa=_0x157cc4[_0x3cff('0x6b')][_0x1bca79];var _0x6ab894=_0x5b9e70['clone']();_0x6ab894['where'](_0x3cff('0x7f'),_0x5308aa['id']);_0x1208fa[_0x3cff('0x80')](db[_0x3cff('0x70')]['query'](_0x6ab894[_0x3cff('0x81')](),{'type':db['sequelize']['QueryTypes'][_0x3cff('0x82')]})[_0x3cff('0x2b')](function(_0x583f09){if(_0x583f09[_0x3cff('0x3d')]===0x1){return _0x5308aa['id'];}else{var _0x2c8e20=_[_0x3cff('0x83')](_['map'](_0x583f09,_0x3cff('0x84')),function(_0x1f541f){return _[_0x3cff('0x85')](_0x1737f3,_0x1f541f);});if(_0x2c8e20){return _0x5308aa['id'];}}}));}}return BPromise[_0x3cff('0x86')](_0x1208fa)[_0x3cff('0x2b')](function(_0x29c429){_0x496ca0=_(_0x496ca0)[_0x3cff('0x87')](_0x29c429)[_0x3cff('0x88')]()['value']();return db[_0x3cff('0x48')][_0x3cff('0x52')]({'where':{'id':_0x239c5e['params']['id']}})[_0x3cff('0x2b')](function(_0x552cd5){return db[_0x3cff('0x70')][_0x3cff('0x71')](function(_0x1ba1b1){return _0x552cd5[_0x3cff('0x75')](_0x239c5e['query'][_0x3cff('0x6a')],{'transaction':_0x1ba1b1})[_0x3cff('0x2b')](function(){if(!_[_0x3cff('0x89')](_0x496ca0)){return _0x552cd5['removeAgents'](_0x496ca0,{'transaction':_0x1ba1b1});}})[_0x3cff('0x2b')](function(){_0x496ca0['forEach'](function(_0x5921fc){socket[_0x3cff('0x73')](_0x3cff('0x8a'),{'UserId':_0x5921fc,'WhatsappQueueId':_0x552cd5['id']});});});});});});})[_0x3cff('0x2b')](respondWithStatusCode(_0x41f8a3,null))[_0x3cff('0x4d')](handleError(_0x41f8a3,null));};exports['addAgents']=function(_0x547a01,_0x1d8427,_0x10896e){return db[_0x3cff('0x48')][_0x3cff('0x52')]({'where':{'id':_0x547a01[_0x3cff('0x4f')]['id']}})[_0x3cff('0x2b')](handleEntityNotFound(_0x1d8427,null))[_0x3cff('0x2b')](function(_0x3ecf7f){if(_0x3ecf7f){return _0x3ecf7f[_0x3cff('0x8b')](_0x547a01[_0x3cff('0x54')][_0x3cff('0x6a')],_['omit'](_0x547a01[_0x3cff('0x54')],[_0x3cff('0x6a'),'id'])||{})[_0x3cff('0x8c')](function(_0x371604){for(var _0x3308bd=0x0;_0x3308bd<_0x547a01[_0x3cff('0x54')][_0x3cff('0x6a')][_0x3cff('0x3d')];_0x3308bd+=0x1){socket[_0x3cff('0x73')]('userWhatsappQueue:save',{'UserId':_0x547a01[_0x3cff('0x54')]['ids'][_0x3308bd],'WhatsappQueueId':_0x547a01[_0x3cff('0x4f')]['id']});}return _0x371604;});}})[_0x3cff('0x2b')](respondWithResult(_0x1d8427,null))[_0x3cff('0x4d')](handleError(_0x1d8427,null));};exports[_0x3cff('0x8d')]=function(_0x344bf2,_0x387620,_0xbd7ebb){return db[_0x3cff('0x48')][_0x3cff('0x52')]({'where':{'id':_0x344bf2[_0x3cff('0x4f')]['id']}})['then'](handleEntityNotFound(_0x387620,null))[_0x3cff('0x2b')](function(_0x147b91){if(_0x147b91){return _0x147b91[_0x3cff('0x8d')](_0x344bf2['query'][_0x3cff('0x6a')])[_0x3cff('0x2b')](function(){if(_[_0x3cff('0x8e')](_0x344bf2[_0x3cff('0x39')][_0x3cff('0x6a')])){for(var _0x4272be=0x0;_0x4272be<_0x344bf2['query'][_0x3cff('0x6a')]['length'];_0x4272be+=0x1){socket['emit'](_0x3cff('0x8a'),{'UserId':Number(_0x344bf2[_0x3cff('0x39')][_0x3cff('0x6a')][_0x4272be]),'WhatsappQueueId':Number(_0x344bf2['params']['id'])});}}else{socket[_0x3cff('0x73')](_0x3cff('0x8a'),{'UserId':Number(_0x344bf2[_0x3cff('0x39')][_0x3cff('0x6a')]),'WhatsappQueueId':Number(_0x344bf2['params']['id'])});}});}})[_0x3cff('0x2b')](respondWithStatusCode(_0x387620,null))[_0x3cff('0x4d')](handleError(_0x387620,null));};exports[_0x3cff('0x8f')]=function(_0x4c5ad8,_0x40b8c0,_0x51aed7){var _0x4c74e8={};var _0x1db694={};var _0x30fdb0;var _0x51f3b7;return db[_0x3cff('0x48')]['findOne']({'where':{'id':_0x4c5ad8[_0x3cff('0x4f')]['id']}})[_0x3cff('0x2b')](handleEntityNotFound(_0x40b8c0,null))[_0x3cff('0x2b')](function(_0x14cdda){if(_0x14cdda){_0x30fdb0=_0x14cdda;_0x1db694[_0x3cff('0x38')]=_[_0x3cff('0x50')](db['User'][_0x3cff('0x34')]);_0x1db694[_0x3cff('0x39')]=_[_0x3cff('0x50')](_0x4c5ad8[_0x3cff('0x39')]);_0x1db694[_0x3cff('0x3a')]=_[_0x3cff('0x3b')](_0x1db694['model'],_0x1db694[_0x3cff('0x39')]);_0x4c74e8['attributes']=_['intersection'](_0x1db694[_0x3cff('0x38')],qs[_0x3cff('0x51')](_0x4c5ad8[_0x3cff('0x39')]['fields']));_0x4c74e8[_0x3cff('0x3c')]=_0x4c74e8[_0x3cff('0x3c')][_0x3cff('0x3d')]?_0x4c74e8[_0x3cff('0x3c')]:_0x1db694['model'];_0x4c74e8[_0x3cff('0x40')]=qs[_0x3cff('0x41')](_0x4c5ad8['query']['sort']);_0x4c74e8[_0x3cff('0x44')]=qs[_0x3cff('0x3a')](_[_0x3cff('0x42')](_0x4c5ad8[_0x3cff('0x39')],_0x1db694[_0x3cff('0x3a')]));if(_0x4c5ad8[_0x3cff('0x39')]['filter']){_0x4c74e8[_0x3cff('0x44')]=_['merge'](_0x4c74e8[_0x3cff('0x44')],{'$or':_[_0x3cff('0x33')](_0x4c74e8['attributes'],function(_0x49d051){var _0x2eede9={};_0x2eede9[_0x49d051]={'$like':'%'+_0x4c5ad8[_0x3cff('0x39')][_0x3cff('0x43')]+'%'};return _0x2eede9;})});}_0x4c74e8=_[_0x3cff('0x45')]({},_0x4c74e8,_0x4c5ad8[_0x3cff('0x47')]);return _0x30fdb0[_0x3cff('0x8f')](_0x4c74e8);}})[_0x3cff('0x2b')](function(_0x1aade6){if(_0x1aade6){_0x51f3b7=_0x1aade6[_0x3cff('0x3d')];if(!_0x4c5ad8[_0x3cff('0x39')][_0x3cff('0x3e')](_0x3cff('0x3f'))){_0x4c74e8[_0x3cff('0x25')]=qs[_0x3cff('0x25')](_0x4c5ad8['query'][_0x3cff('0x25')]);_0x4c74e8[_0x3cff('0x24')]=qs[_0x3cff('0x24')](_0x4c5ad8[_0x3cff('0x39')][_0x3cff('0x24')]);}return _0x30fdb0[_0x3cff('0x8f')](_0x4c74e8);}})[_0x3cff('0x2b')](function(_0x1c741b){if(_0x1c741b){return _0x1c741b?{'count':_0x51f3b7,'rows':_0x1c741b}:null;}})[_0x3cff('0x2b')](respondWithResult(_0x40b8c0,null))['catch'](handleError(_0x40b8c0,null));}; \ No newline at end of file +var _0x683c=['WhatsappQueueId','UserWhatsappQueue','User','findAndCountAll','agent','rows','format','SIP','whatsappPause','createdAt','getTeams','Team','pick','addTeams','ids','findAll','Agents','online','voicePause','interface','flatMap','sequelize','transaction','each','findOrCreate','forEach','emit','removeTeams','select','tq.TeamId','from','team_has_whatsapp_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','WhatsappQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','toString','SELECT','every','includes','all','union','compact','isEmpty','removeAgents','addAgents','omit','spread','userWhatsappQueue:save','userWhatsappQueue:remove','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','path','sox','ejs','lodash','squel','crypto','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','./whatsappQueue.socket','register','sendStatus','end','status','count','offset','limit','set','Content-Range','json','apply','reject','save','update','then','destroy','get','WhatsappQueues','UserProfileResource','error','stack','name','send','index','map','WhatsappQueue','rawAttributes','fieldName','type','key','model','query','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','filter','merge','VIRTUAL','options','includeAll','include','catch','params','keys','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','getMembers','findOne'];(function(_0x88cd7b,_0x4c884c){var _0x56fcc8=function(_0x513b3d){while(--_0x513b3d){_0x88cd7b['push'](_0x88cd7b['shift']());}};_0x56fcc8(++_0x4c884c);}(_0x683c,0x1e8));var _0xc683=function(_0x39809d,_0x4fc32f){_0x39809d=_0x39809d-0x0;var _0x1541d3=_0x683c[_0x39809d];return _0x1541d3;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xc683('0x0'));var rimraf=require(_0xc683('0x1'));var zipdir=require(_0xc683('0x2'));var jsonpatch=require(_0xc683('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xc683('0x4'));var Mustache=require(_0xc683('0x5'));var util=require(_0xc683('0x6'));var path=require(_0xc683('0x7'));var sox=require(_0xc683('0x8'));var csv=require('to-csv');var ejs=require(_0xc683('0x9'));var fs=require('fs');var _=require(_0xc683('0xa'));var squel=require(_0xc683('0xb'));var crypto=require(_0xc683('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xc683('0xd'));var toCsv=require(_0xc683('0xe'));var querystring=require(_0xc683('0xf'));var Papa=require(_0xc683('0x10'));var Redis=require(_0xc683('0x11'));var authService=require(_0xc683('0x12'));var qs=require(_0xc683('0x13'));var as=require(_0xc683('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xc683('0x15'))(_0xc683('0x16'));var utils=require('../../config/utils');var config=require(_0xc683('0x17'));var db=require(_0xc683('0x18'))['db'];config[_0xc683('0x19')]=_['defaults'](config[_0xc683('0x19')],{'host':_0xc683('0x1a'),'port':0x18eb});var socket=require(_0xc683('0x1b'))(new Redis(config['redis']));require(_0xc683('0x1c'))[_0xc683('0x1d')](socket);function respondWithStatusCode(_0x30acc3,_0x7f9b92){_0x7f9b92=_0x7f9b92||0xcc;return function(_0x106d14){if(_0x106d14){return _0x30acc3[_0xc683('0x1e')](_0x7f9b92);}return _0x30acc3['status'](_0x7f9b92)[_0xc683('0x1f')]();};}function respondWithResult(_0x18c550,_0x122b18){_0x122b18=_0x122b18||0xc8;return function(_0x31b935){if(_0x31b935){return _0x18c550[_0xc683('0x20')](_0x122b18)['json'](_0x31b935);}};}function respondWithFilteredResult(_0x155e69,_0x315b53){return function(_0x2b090d){if(_0x2b090d){var _0x1c9f93=_0x2b090d[_0xc683('0x21')],_0xc105cb=_0x315b53[_0xc683('0x22')],_0x2e4034=_0x315b53[_0xc683('0x22')]+_0x315b53[_0xc683('0x23')],_0x4c1d9a;if(_0x2e4034>=_0x1c9f93){_0x2e4034=_0x1c9f93;_0x4c1d9a=0xc8;}else{_0x4c1d9a=0xce;}_0x155e69[_0xc683('0x20')](_0x4c1d9a);return _0x155e69[_0xc683('0x24')](_0xc683('0x25'),_0xc105cb+'-'+_0x2e4034+'/'+_0x1c9f93)[_0xc683('0x26')](_0x2b090d);}return null;};}function patchUpdates(_0x457a7e){return function(_0xc6763b){try{jsonpatch[_0xc683('0x27')](_0xc6763b,_0x457a7e,!![]);}catch(_0x38b444){return BPromise[_0xc683('0x28')](_0x38b444);}return _0xc6763b[_0xc683('0x29')]();};}function saveUpdates(_0x5f46ae,_0x5af207){return function(_0x2812e){if(_0x2812e){return _0x2812e[_0xc683('0x2a')](_0x5f46ae)[_0xc683('0x2b')](function(_0x3dcf76){return _0x3dcf76;});}return null;};}function removeEntity(_0x1fb338,_0x1ffcf7){return function(_0x6767ab){if(_0x6767ab){return _0x6767ab[_0xc683('0x2c')]()[_0xc683('0x2b')](function(){var _0x3b0095=_0x6767ab[_0xc683('0x2d')]({'plain':!![]});var _0x6135e5=_0xc683('0x2e');return db[_0xc683('0x2f')][_0xc683('0x2c')]({'where':{'type':_0x6135e5,'resourceId':_0x3b0095['id']}})[_0xc683('0x2b')](function(){return _0x6767ab;});})['then'](function(){_0x1fb338[_0xc683('0x20')](0xcc)[_0xc683('0x1f')]();});}};}function handleEntityNotFound(_0x2169df,_0x2750e5){return function(_0x3fb328){if(!_0x3fb328){_0x2169df['sendStatus'](0x194);}return _0x3fb328;};}function handleError(_0x3b2475,_0x289011){_0x289011=_0x289011||0x1f4;return function(_0x4f3645){logger[_0xc683('0x30')](_0x4f3645[_0xc683('0x31')]);if(_0x4f3645[_0xc683('0x32')]){delete _0x4f3645[_0xc683('0x32')];}_0x3b2475['status'](_0x289011)[_0xc683('0x33')](_0x4f3645);};}exports[_0xc683('0x34')]=function(_0x23f302,_0x4b0ccb){var _0x3d4876={},_0x2add3c={},_0x206c83={'count':0x0,'rows':[]};var _0x4ec959=_[_0xc683('0x35')](db[_0xc683('0x36')][_0xc683('0x37')],function(_0x537b18){return{'name':_0x537b18[_0xc683('0x38')],'type':_0x537b18[_0xc683('0x39')][_0xc683('0x3a')]};});_0x2add3c[_0xc683('0x3b')]=_['map'](_0x4ec959,_0xc683('0x32'));_0x2add3c[_0xc683('0x3c')]=_['keys'](_0x23f302[_0xc683('0x3c')]);_0x2add3c['filters']=_['intersection'](_0x2add3c[_0xc683('0x3b')],_0x2add3c[_0xc683('0x3c')]);_0x3d4876[_0xc683('0x3d')]=_[_0xc683('0x3e')](_0x2add3c['model'],qs[_0xc683('0x3f')](_0x23f302['query'][_0xc683('0x3f')]));_0x3d4876[_0xc683('0x3d')]=_0x3d4876[_0xc683('0x3d')][_0xc683('0x40')]?_0x3d4876[_0xc683('0x3d')]:_0x2add3c['model'];if(!_0x23f302['query'][_0xc683('0x41')](_0xc683('0x42'))){_0x3d4876[_0xc683('0x23')]=qs[_0xc683('0x23')](_0x23f302[_0xc683('0x3c')][_0xc683('0x23')]);_0x3d4876[_0xc683('0x22')]=qs['offset'](_0x23f302[_0xc683('0x3c')][_0xc683('0x22')]);}_0x3d4876[_0xc683('0x43')]=qs[_0xc683('0x44')](_0x23f302['query'][_0xc683('0x44')]);_0x3d4876[_0xc683('0x45')]=qs[_0xc683('0x46')](_['pick'](_0x23f302[_0xc683('0x3c')],_0x2add3c[_0xc683('0x46')]),_0x4ec959);if(_0x23f302[_0xc683('0x3c')][_0xc683('0x47')]){_0x3d4876[_0xc683('0x45')]=_[_0xc683('0x48')](_0x3d4876[_0xc683('0x45')],{'$or':_['map'](_0x4ec959,function(_0x2fb4e9){if(_0x2fb4e9[_0xc683('0x39')]!==_0xc683('0x49')){var _0x5e0080={};_0x5e0080[_0x2fb4e9[_0xc683('0x32')]]={'$like':'%'+_0x23f302[_0xc683('0x3c')][_0xc683('0x47')]+'%'};return _0x5e0080;}})});}_0x3d4876=_['merge']({},_0x3d4876,_0x23f302[_0xc683('0x4a')]);var _0x407ee2={'where':_0x3d4876[_0xc683('0x45')]};return db['WhatsappQueue'][_0xc683('0x21')](_0x407ee2)[_0xc683('0x2b')](function(_0x42a140){_0x206c83[_0xc683('0x21')]=_0x42a140;if(_0x23f302[_0xc683('0x3c')][_0xc683('0x4b')]){_0x3d4876[_0xc683('0x4c')]=[{'all':!![]}];}return db['WhatsappQueue']['findAll'](_0x3d4876);})['then'](function(_0x3d66c2){_0x206c83['rows']=_0x3d66c2;return _0x206c83;})[_0xc683('0x2b')](respondWithFilteredResult(_0x4b0ccb,_0x3d4876))[_0xc683('0x4d')](handleError(_0x4b0ccb,null));};exports['show']=function(_0x3c22eb,_0x424f48){var _0x5cf166={'raw':!![],'where':{'id':_0x3c22eb[_0xc683('0x4e')]['id']}},_0x4016fd={};_0x4016fd[_0xc683('0x3b')]=_[_0xc683('0x4f')](db[_0xc683('0x36')][_0xc683('0x37')]);_0x4016fd['query']=_[_0xc683('0x4f')](_0x3c22eb['query']);_0x4016fd[_0xc683('0x46')]=_['intersection'](_0x4016fd[_0xc683('0x3b')],_0x4016fd[_0xc683('0x3c')]);_0x5cf166[_0xc683('0x3d')]=_[_0xc683('0x3e')](_0x4016fd[_0xc683('0x3b')],qs['fields'](_0x3c22eb[_0xc683('0x3c')]['fields']));_0x5cf166[_0xc683('0x3d')]=_0x5cf166[_0xc683('0x3d')][_0xc683('0x40')]?_0x5cf166['attributes']:_0x4016fd[_0xc683('0x3b')];if(_0x3c22eb[_0xc683('0x3c')]['includeAll']){_0x5cf166[_0xc683('0x4c')]=[{'all':!![]}];}_0x5cf166=_[_0xc683('0x48')]({},_0x5cf166,_0x3c22eb['options']);return db[_0xc683('0x36')][_0xc683('0x50')](_0x5cf166)[_0xc683('0x2b')](handleEntityNotFound(_0x424f48,null))[_0xc683('0x2b')](respondWithResult(_0x424f48,null))['catch'](handleError(_0x424f48,null));};exports['create']=function(_0x3ad500,_0x213052){return db[_0xc683('0x36')][_0xc683('0x51')](_0x3ad500[_0xc683('0x52')],{})[_0xc683('0x2b')](function(_0x275f8e){var _0xcb4337=_0x3ad500[_0xc683('0x53')]['get']({'plain':!![]});if(!_0xcb4337)throw new Error(_0xc683('0x54'));if(_0xcb4337[_0xc683('0x55')]==='user'){var _0x47397b=_0x275f8e['get']({'plain':!![]});var _0x3bd6f5=_0xc683('0x2e');return db[_0xc683('0x56')]['find']({'where':{'name':_0x3bd6f5,'userProfileId':_0xcb4337[_0xc683('0x57')]},'raw':!![]})['then'](function(_0x4a1ec1){if(_0x4a1ec1&&_0x4a1ec1['autoAssociation']===0x0){return db[_0xc683('0x2f')][_0xc683('0x51')]({'name':_0x47397b[_0xc683('0x32')],'resourceId':_0x47397b['id'],'type':_0x4a1ec1['name'],'sectionId':_0x4a1ec1['id']},{})[_0xc683('0x2b')](function(){return _0x275f8e;});}else{return _0x275f8e;}})[_0xc683('0x4d')](function(_0x51b4b0){logger['error'](_0xc683('0x58'),_0x51b4b0);throw _0x51b4b0;});}return _0x275f8e;})[_0xc683('0x2b')](respondWithResult(_0x213052,0xc9))['catch'](handleError(_0x213052,null));};exports['update']=function(_0x314e2d,_0x57e0e2){if(_0x314e2d[_0xc683('0x52')]['id']){delete _0x314e2d[_0xc683('0x52')]['id'];}return db['WhatsappQueue'][_0xc683('0x50')]({'where':{'id':_0x314e2d['params']['id']}})['then'](handleEntityNotFound(_0x57e0e2,null))[_0xc683('0x2b')](saveUpdates(_0x314e2d[_0xc683('0x52')],null))['then'](respondWithResult(_0x57e0e2,null))[_0xc683('0x4d')](handleError(_0x57e0e2,null));};exports['destroy']=function(_0x2f6342,_0x34fe31){return db[_0xc683('0x36')][_0xc683('0x50')]({'where':{'id':_0x2f6342[_0xc683('0x4e')]['id']}})['then'](handleEntityNotFound(_0x34fe31,null))[_0xc683('0x2b')](removeEntity(_0x34fe31,null))[_0xc683('0x4d')](handleError(_0x34fe31,null));};exports[_0xc683('0x59')]=function(_0x2c1fc1,_0x335532){return db[_0xc683('0x36')][_0xc683('0x59')]()['then'](respondWithResult(_0x335532,null))[_0xc683('0x4d')](handleError(_0x335532,null));};exports[_0xc683('0x5a')]=function(_0x1c0168,_0x4685d2,_0x3de37c){var _0x34a9e0={'raw':!![],'where':{}},_0x21588e={},_0x2168aa;return db[_0xc683('0x36')][_0xc683('0x5b')]({'where':{'id':_0x1c0168[_0xc683('0x4e')]['id']}})[_0xc683('0x2b')](handleEntityNotFound(_0x4685d2,null))[_0xc683('0x2b')](function(_0x1f0e73){if(_0x1f0e73){_0x2168aa=_0x1f0e73[_0xc683('0x2d')]({'plain':!![]});_0x21588e[_0xc683('0x3b')]=_['keys'](db['UserWhatsappQueue'][_0xc683('0x37')]);_0x21588e[_0xc683('0x3c')]=_['keys'](_0x1c0168['query']);_0x21588e[_0xc683('0x46')]=_['intersection'](_0x21588e[_0xc683('0x3b')],_0x21588e['query']);_0x34a9e0[_0xc683('0x3d')]=_[_0xc683('0x3e')](_0x21588e['model'],qs['fields'](_0x1c0168[_0xc683('0x3c')][_0xc683('0x3f')]));_0x34a9e0[_0xc683('0x3d')]=_0x34a9e0[_0xc683('0x3d')][_0xc683('0x40')]?_0x34a9e0[_0xc683('0x3d')]:_0x21588e[_0xc683('0x3b')];if(!_0x1c0168[_0xc683('0x3c')][_0xc683('0x41')](_0xc683('0x42'))){_0x34a9e0[_0xc683('0x23')]=qs[_0xc683('0x23')](_0x1c0168['query'][_0xc683('0x23')]);_0x34a9e0[_0xc683('0x22')]=qs[_0xc683('0x22')](_0x1c0168[_0xc683('0x3c')][_0xc683('0x22')]);}_0x34a9e0[_0xc683('0x43')]=qs[_0xc683('0x44')](_0x1c0168['query'][_0xc683('0x44')]);_0x34a9e0['where']=qs[_0xc683('0x46')](_['pick'](_0x1c0168[_0xc683('0x3c')],_0x21588e[_0xc683('0x46')]));_0x34a9e0['where'][_0xc683('0x5c')]=_0x1f0e73['id'];if(_0x1c0168[_0xc683('0x3c')][_0xc683('0x47')]){_0x34a9e0['where']=_[_0xc683('0x48')](_0x34a9e0['where'],{'$or':_[_0xc683('0x35')](_0x34a9e0['attributes'],function(_0x1052e2){var _0x376fd5={};_0x376fd5[_0x1052e2]={'$like':'%'+_0x1c0168[_0xc683('0x3c')][_0xc683('0x47')]+'%'};return _0x376fd5;})});}_0x34a9e0=_[_0xc683('0x48')]({},_0x34a9e0,_0x1c0168['options']);return db[_0xc683('0x5d')]['findAll'](_0x34a9e0);}})[_0xc683('0x2b')](function(_0x368bf2){if(_0x368bf2){return db[_0xc683('0x5e')][_0xc683('0x5f')]({'where':{'id':_[_0xc683('0x35')](_0x368bf2,'UserId'),'role':_0xc683('0x60')},'attributes':['id',_0xc683('0x32'),'whatsappPause','updatedAt','createdAt']});}})[_0xc683('0x2b')](function(_0x2b037d){if(_0x2b037d){return{'count':_0x2b037d[_0xc683('0x21')],'rows':_[_0xc683('0x35')](_0x2b037d[_0xc683('0x61')],function(_0x353999){return{'membername':_0x353999[_0xc683('0x32')],'UserId':_0x353999['id'],'queue_name':_0x2168aa['name'],'WhatsappQueueId':_0x2168aa['id'],'interface':util[_0xc683('0x62')]('%s/%s',_0xc683('0x63'),_0x353999['name']),'penalty':0x0,'paused':_0x353999[_0xc683('0x64')],'createdAt':_0x353999[_0xc683('0x65')],'updatedAt':_0x353999['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})[_0xc683('0x2b')](respondWithFilteredResult(_0x4685d2,_0x34a9e0))[_0xc683('0x4d')](handleError(_0x4685d2,null));};exports[_0xc683('0x66')]=function(_0x51f5ce,_0x3a7a9a,_0x4e631f){var _0xa3461a={};var _0x368aae={};var _0x209f45;var _0x2b5170;return db[_0xc683('0x36')][_0xc683('0x5b')]({'where':{'id':_0x51f5ce[_0xc683('0x4e')]['id']}})['then'](handleEntityNotFound(_0x3a7a9a,null))[_0xc683('0x2b')](function(_0x3ee647){if(_0x3ee647){_0x209f45=_0x3ee647;_0x368aae[_0xc683('0x3b')]=_[_0xc683('0x4f')](db[_0xc683('0x67')][_0xc683('0x37')]);_0x368aae[_0xc683('0x3c')]=_['keys'](_0x51f5ce[_0xc683('0x3c')]);_0x368aae[_0xc683('0x46')]=_[_0xc683('0x3e')](_0x368aae[_0xc683('0x3b')],_0x368aae['query']);_0xa3461a['attributes']=_[_0xc683('0x3e')](_0x368aae[_0xc683('0x3b')],qs[_0xc683('0x3f')](_0x51f5ce[_0xc683('0x3c')][_0xc683('0x3f')]));_0xa3461a[_0xc683('0x3d')]=_0xa3461a['attributes']['length']?_0xa3461a['attributes']:_0x368aae[_0xc683('0x3b')];_0xa3461a[_0xc683('0x43')]=qs[_0xc683('0x44')](_0x51f5ce[_0xc683('0x3c')][_0xc683('0x44')]);_0xa3461a[_0xc683('0x45')]=qs['filters'](_[_0xc683('0x68')](_0x51f5ce[_0xc683('0x3c')],_0x368aae[_0xc683('0x46')]));if(_0x51f5ce[_0xc683('0x3c')]['filter']){_0xa3461a['where']=_[_0xc683('0x48')](_0xa3461a[_0xc683('0x45')],{'$or':_[_0xc683('0x35')](_0xa3461a['attributes'],function(_0x29ab78){var _0x2891dc={};_0x2891dc[_0x29ab78]={'$like':'%'+_0x51f5ce[_0xc683('0x3c')][_0xc683('0x47')]+'%'};return _0x2891dc;})});}_0xa3461a=_[_0xc683('0x48')]({},_0xa3461a,_0x51f5ce['options']);return _0x209f45[_0xc683('0x66')](_0xa3461a);}})['then'](function(_0xf5ac4b){if(_0xf5ac4b){_0x2b5170=_0xf5ac4b[_0xc683('0x40')];if(!_0x51f5ce[_0xc683('0x3c')][_0xc683('0x41')](_0xc683('0x42'))){_0xa3461a['limit']=qs[_0xc683('0x23')](_0x51f5ce[_0xc683('0x3c')][_0xc683('0x23')]);_0xa3461a['offset']=qs[_0xc683('0x22')](_0x51f5ce['query'][_0xc683('0x22')]);}return _0x209f45[_0xc683('0x66')](_0xa3461a);}})[_0xc683('0x2b')](function(_0x287175){if(_0x287175){return _0x287175?{'count':_0x2b5170,'rows':_0x287175}:null;}})[_0xc683('0x2b')](respondWithResult(_0x3a7a9a,null))['catch'](handleError(_0x3a7a9a,null));};exports[_0xc683('0x69')]=function(_0x564fdb,_0x3f5c05,_0x50befa){var _0x4a0aa1=_0x564fdb[_0xc683('0x52')][_0xc683('0x6a')];return db['Team'][_0xc683('0x6b')]({'where':{'id':_0x4a0aa1},'attributes':['id'],'include':[{'model':db[_0xc683('0x5e')],'as':_0xc683('0x6c'),'attributes':['id',_0xc683('0x32'),_0xc683('0x6d'),_0xc683('0x6e'),_0xc683('0x6f')],'raw':!![]}]})[_0xc683('0x2b')](function(_0x4b50d7){if(_0x4b50d7){var _0x3c77db=_[_0xc683('0x70')](_0x4b50d7,function(_0x621552){var _0x535fa2=_0x621552['get']({'plain':!![]});return _0x535fa2[_0xc683('0x6c')];});return db[_0xc683('0x36')]['find']({'where':{'id':_0x564fdb['params']['id']}})[_0xc683('0x2b')](function(_0x36e8d0){return db[_0xc683('0x71')][_0xc683('0x72')](function(_0x43025e){return _0x36e8d0[_0xc683('0x69')](_0x4a0aa1,{'transaction':_0x43025e})[_0xc683('0x2b')](function(){return BPromise[_0xc683('0x73')](_0x3c77db,function(_0x467061){return db[_0xc683('0x5d')][_0xc683('0x74')]({'where':{'UserId':_0x467061['id'],'WhatsappQueueId':_0x564fdb['params']['id']},'transaction':_0x43025e});});})[_0xc683('0x2b')](function(){_0x3c77db[_0xc683('0x75')](function(_0x17091b){socket[_0xc683('0x76')]('userWhatsappQueue:save',{'UserId':_0x17091b['id'],'WhatsappQueueId':_0x36e8d0['id']});});});});});}})[_0xc683('0x2b')](respondWithStatusCode(_0x3f5c05,null))[_0xc683('0x4d')](handleError(_0x3f5c05,null));};exports[_0xc683('0x77')]=function(_0xb1d43a,_0x503f15,_0x216f23){return db[_0xc683('0x67')]['findAll']({'where':{'id':_0xb1d43a[_0xc683('0x3c')][_0xc683('0x6a')]},'attributes':['id'],'include':[{'model':db[_0xc683('0x5e')],'as':_0xc683('0x6c'),'attributes':['id'],'raw':!![]}]})[_0xc683('0x2b')](handleEntityNotFound(_0x503f15,null))[_0xc683('0x2b')](function(_0x48289f){var _0x514363=_['map'](_0x48289f,'id');var _0x2d0f9d=[];var _0x3876d5=[];var _0x22ec11=squel[_0xc683('0x78')]();_0x22ec11['field'](_0xc683('0x79'))[_0xc683('0x7a')](_0xc683('0x7b'),'tq')[_0xc683('0x7c')](_0xc683('0x7d'),'ut',_0xc683('0x7e'))[_0xc683('0x45')](_0xc683('0x7f'),_0xb1d43a[_0xc683('0x4e')]['id']);for(var _0x51abeb=0x0;_0x51abeb<_0x48289f[_0xc683('0x40')];_0x51abeb+=0x1){let _0x235768=_0x48289f[_0x51abeb];for(var _0x1cecb1=0x0;_0x1cecb1<_0x235768[_0xc683('0x6c')][_0xc683('0x40')];_0x1cecb1+=0x1){let _0x924e6d=_0x235768[_0xc683('0x6c')][_0x1cecb1];var _0x53df64=_0x22ec11[_0xc683('0x80')]();_0x53df64[_0xc683('0x45')](_0xc683('0x81'),_0x924e6d['id']);_0x3876d5['push'](db[_0xc683('0x71')][_0xc683('0x3c')](_0x53df64[_0xc683('0x82')](),{'type':db[_0xc683('0x71')]['QueryTypes'][_0xc683('0x83')]})[_0xc683('0x2b')](function(_0x36453f){if(_0x36453f['length']===0x1){return _0x924e6d['id'];}else{var _0x4a5ae6=_[_0xc683('0x84')](_[_0xc683('0x35')](_0x36453f,'TeamId'),function(_0x51eb8d){return _[_0xc683('0x85')](_0x514363,_0x51eb8d);});if(_0x4a5ae6){return _0x924e6d['id'];}}}));}}return BPromise[_0xc683('0x86')](_0x3876d5)[_0xc683('0x2b')](function(_0x542924){_0x2d0f9d=_(_0x2d0f9d)[_0xc683('0x87')](_0x542924)[_0xc683('0x88')]()['value']();return db[_0xc683('0x36')][_0xc683('0x50')]({'where':{'id':_0xb1d43a['params']['id']}})[_0xc683('0x2b')](function(_0x17ddc0){return db[_0xc683('0x71')][_0xc683('0x72')](function(_0x2080a9){return _0x17ddc0['removeTeams'](_0xb1d43a[_0xc683('0x3c')][_0xc683('0x6a')],{'transaction':_0x2080a9})[_0xc683('0x2b')](function(){if(!_[_0xc683('0x89')](_0x2d0f9d)){return _0x17ddc0[_0xc683('0x8a')](_0x2d0f9d,{'transaction':_0x2080a9});}})[_0xc683('0x2b')](function(){_0x2d0f9d[_0xc683('0x75')](function(_0x21af53){socket[_0xc683('0x76')]('userWhatsappQueue:remove',{'UserId':_0x21af53,'WhatsappQueueId':_0x17ddc0['id']});});});});});});})[_0xc683('0x2b')](respondWithStatusCode(_0x503f15,null))['catch'](handleError(_0x503f15,null));};exports['addAgents']=function(_0xd78b6a,_0x2cb45c,_0x2ae571){return db['WhatsappQueue'][_0xc683('0x50')]({'where':{'id':_0xd78b6a[_0xc683('0x4e')]['id']}})[_0xc683('0x2b')](handleEntityNotFound(_0x2cb45c,null))[_0xc683('0x2b')](function(_0x41c342){if(_0x41c342){return _0x41c342[_0xc683('0x8b')](_0xd78b6a['body'][_0xc683('0x6a')],_[_0xc683('0x8c')](_0xd78b6a[_0xc683('0x52')],[_0xc683('0x6a'),'id'])||{})[_0xc683('0x8d')](function(_0x2ebb05){for(var _0x615b61=0x0;_0x615b61<_0xd78b6a[_0xc683('0x52')][_0xc683('0x6a')][_0xc683('0x40')];_0x615b61+=0x1){socket[_0xc683('0x76')](_0xc683('0x8e'),{'UserId':_0xd78b6a[_0xc683('0x52')][_0xc683('0x6a')][_0x615b61],'WhatsappQueueId':_0xd78b6a[_0xc683('0x4e')]['id']});}return _0x2ebb05;});}})[_0xc683('0x2b')](respondWithResult(_0x2cb45c,null))['catch'](handleError(_0x2cb45c,null));};exports[_0xc683('0x8a')]=function(_0x378f68,_0x42218d,_0x212a99){return db[_0xc683('0x36')][_0xc683('0x50')]({'where':{'id':_0x378f68[_0xc683('0x4e')]['id']}})[_0xc683('0x2b')](handleEntityNotFound(_0x42218d,null))['then'](function(_0x329fd7){if(_0x329fd7){return _0x329fd7[_0xc683('0x8a')](_0x378f68[_0xc683('0x3c')][_0xc683('0x6a')])['then'](function(){if(_['isArray'](_0x378f68[_0xc683('0x3c')][_0xc683('0x6a')])){for(var _0x51bb06=0x0;_0x51bb06<_0x378f68[_0xc683('0x3c')]['ids'][_0xc683('0x40')];_0x51bb06+=0x1){socket[_0xc683('0x76')](_0xc683('0x8f'),{'UserId':Number(_0x378f68[_0xc683('0x3c')][_0xc683('0x6a')][_0x51bb06]),'WhatsappQueueId':Number(_0x378f68[_0xc683('0x4e')]['id'])});}}else{socket[_0xc683('0x76')](_0xc683('0x8f'),{'UserId':Number(_0x378f68['query'][_0xc683('0x6a')]),'WhatsappQueueId':Number(_0x378f68[_0xc683('0x4e')]['id'])});}});}})[_0xc683('0x2b')](respondWithStatusCode(_0x42218d,null))[_0xc683('0x4d')](handleError(_0x42218d,null));};exports[_0xc683('0x90')]=function(_0x4d6658,_0x4125b2,_0x46f83f){var _0xf01c7={};var _0x769782={};var _0x2ca404;var _0x16482e;return db[_0xc683('0x36')]['findOne']({'where':{'id':_0x4d6658[_0xc683('0x4e')]['id']}})[_0xc683('0x2b')](handleEntityNotFound(_0x4125b2,null))[_0xc683('0x2b')](function(_0x11bb78){if(_0x11bb78){_0x2ca404=_0x11bb78;_0x769782['model']=_['keys'](db['User']['rawAttributes']);_0x769782['query']=_[_0xc683('0x4f')](_0x4d6658['query']);_0x769782[_0xc683('0x46')]=_[_0xc683('0x3e')](_0x769782['model'],_0x769782[_0xc683('0x3c')]);_0xf01c7[_0xc683('0x3d')]=_[_0xc683('0x3e')](_0x769782['model'],qs[_0xc683('0x3f')](_0x4d6658[_0xc683('0x3c')][_0xc683('0x3f')]));_0xf01c7[_0xc683('0x3d')]=_0xf01c7[_0xc683('0x3d')][_0xc683('0x40')]?_0xf01c7[_0xc683('0x3d')]:_0x769782[_0xc683('0x3b')];_0xf01c7[_0xc683('0x43')]=qs['sort'](_0x4d6658[_0xc683('0x3c')][_0xc683('0x44')]);_0xf01c7['where']=qs[_0xc683('0x46')](_['pick'](_0x4d6658[_0xc683('0x3c')],_0x769782[_0xc683('0x46')]));if(_0x4d6658['query'][_0xc683('0x47')]){_0xf01c7['where']=_[_0xc683('0x48')](_0xf01c7['where'],{'$or':_[_0xc683('0x35')](_0xf01c7[_0xc683('0x3d')],function(_0x4e7e1b){var _0x115c9f={};_0x115c9f[_0x4e7e1b]={'$like':'%'+_0x4d6658['query'][_0xc683('0x47')]+'%'};return _0x115c9f;})});}_0xf01c7=_[_0xc683('0x48')]({},_0xf01c7,_0x4d6658[_0xc683('0x4a')]);return _0x2ca404['getAgents'](_0xf01c7);}})['then'](function(_0x546080){if(_0x546080){_0x16482e=_0x546080[_0xc683('0x40')];if(!_0x4d6658[_0xc683('0x3c')][_0xc683('0x41')](_0xc683('0x42'))){_0xf01c7[_0xc683('0x23')]=qs['limit'](_0x4d6658[_0xc683('0x3c')][_0xc683('0x23')]);_0xf01c7[_0xc683('0x22')]=qs[_0xc683('0x22')](_0x4d6658[_0xc683('0x3c')][_0xc683('0x22')]);}return _0x2ca404[_0xc683('0x90')](_0xf01c7);}})[_0xc683('0x2b')](function(_0x2fbe9c){if(_0x2fbe9c){return _0x2fbe9c?{'count':_0x16482e,'rows':_0x2fbe9c}:null;}})[_0xc683('0x2b')](respondWithResult(_0x4125b2,null))[_0xc683('0x4d')](handleError(_0x4125b2,null));}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.events.js b/server/api/whatsappQueue/whatsappQueue.events.js index a9e0f0e..8a1ab18 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 _0x69ae=['hasOwnProperty','hook','events','../../mysqldb','WhatsappQueue','setMaxListeners','save','update','remove','emit'];(function(_0x4ec805,_0x3b8515){var _0x386805=function(_0x58c4c0){while(--_0x58c4c0){_0x4ec805['push'](_0x4ec805['shift']());}};_0x386805(++_0x3b8515);}(_0x69ae,0x1ba));var _0xe69a=function(_0x144767,_0x475e1b){_0x144767=_0x144767-0x0;var _0x437ca7=_0x69ae[_0x144767];return _0x437ca7;};'use strict';var EventEmitter=require(_0xe69a('0x0'));var WhatsappQueue=require(_0xe69a('0x1'))['db'][_0xe69a('0x2')];var WhatsappQueueEvents=new EventEmitter();WhatsappQueueEvents[_0xe69a('0x3')](0x0);var events={'afterCreate':_0xe69a('0x4'),'afterUpdate':_0xe69a('0x5'),'afterDestroy':_0xe69a('0x6')};function emitEvent(_0x59219e){return function(_0x919232,_0x2abda4,_0x7949e4){WhatsappQueueEvents[_0xe69a('0x7')](_0x59219e+':'+_0x919232['id'],_0x919232);WhatsappQueueEvents[_0xe69a('0x7')](_0x59219e,_0x919232);_0x7949e4(null);};}for(var e in events){if(events[_0xe69a('0x8')](e)){var event=events[e];WhatsappQueue[_0xe69a('0x9')](e,emitEvent(event));}}module['exports']=WhatsappQueueEvents; \ No newline at end of file +var _0x51f0=['emit','exports','events','setMaxListeners','save'];(function(_0x54f0b7,_0x1f969e){var _0x3c1e8f=function(_0x5c6aa0){while(--_0x5c6aa0){_0x54f0b7['push'](_0x54f0b7['shift']());}};_0x3c1e8f(++_0x1f969e);}(_0x51f0,0x7a));var _0x051f=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0x51f0[_0xfae23b];return _0x200640;};'use strict';var EventEmitter=require(_0x051f('0x0'));var WhatsappQueue=require('../../mysqldb')['db']['WhatsappQueue'];var WhatsappQueueEvents=new EventEmitter();WhatsappQueueEvents[_0x051f('0x1')](0x0);var events={'afterCreate':_0x051f('0x2'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0xcbc31c){return function(_0x3eebe9,_0x488ea3,_0x1c7d68){WhatsappQueueEvents[_0x051f('0x3')](_0xcbc31c+':'+_0x3eebe9['id'],_0x3eebe9);WhatsappQueueEvents[_0x051f('0x3')](_0xcbc31c,_0x3eebe9);_0x1c7d68(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];WhatsappQueue['hook'](e,emitEvent(event));}}module[_0x051f('0x4')]=WhatsappQueueEvents; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.model.js b/server/api/whatsappQueue/whatsappQueue.model.js index 3468366..f23df5f 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 _0x847b=['api','bluebird','request-promise','path','rimraf','../../config/environment','exports','whatsapp_queues','lodash','../../config/logger'];(function(_0xa1b5fb,_0x41a2bd){var _0x123597=function(_0x1b3157){while(--_0x1b3157){_0xa1b5fb['push'](_0xa1b5fb['shift']());}};_0x123597(++_0x41a2bd);}(_0x847b,0x1ac));var _0xb847=function(_0x167cc1,_0x56ef5a){_0x167cc1=_0x167cc1-0x0;var _0x10bc4b=_0x847b[_0x167cc1];return _0x10bc4b;};'use strict';var _=require(_0xb847('0x0'));var util=require('util');var logger=require(_0xb847('0x1'))(_0xb847('0x2'));var moment=require('moment');var BPromise=require(_0xb847('0x3'));var rp=require(_0xb847('0x4'));var fs=require('fs');var path=require(_0xb847('0x5'));var rimraf=require(_0xb847('0x6'));var config=require(_0xb847('0x7'));var attributes=require('./whatsappQueue.attributes');module[_0xb847('0x8')]=function(_0x32b381,_0x4124f2){return _0x32b381['define']('WhatsappQueue',attributes,{'tableName':_0xb847('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x300e=['../../config/environment','./whatsappQueue.attributes','exports','WhatsappQueue','whatsapp_queues','lodash','util','moment','bluebird','request-promise','path','rimraf'];(function(_0x200aa5,_0x197802){var _0x458200=function(_0x594959){while(--_0x594959){_0x200aa5['push'](_0x200aa5['shift']());}};_0x458200(++_0x197802);}(_0x300e,0x16d));var _0xe300=function(_0x710815,_0x520da8){_0x710815=_0x710815-0x0;var _0x5b3b89=_0x300e[_0x710815];return _0x5b3b89;};'use strict';var _=require(_0xe300('0x0'));var util=require(_0xe300('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xe300('0x2'));var BPromise=require(_0xe300('0x3'));var rp=require(_0xe300('0x4'));var fs=require('fs');var path=require(_0xe300('0x5'));var rimraf=require(_0xe300('0x6'));var config=require(_0xe300('0x7'));var attributes=require(_0xe300('0x8'));module[_0xe300('0x9')]=function(_0x1f231c,_0x2c6c86){return _0x1f231c['define'](_0xe300('0xa'),attributes,{'tableName':_0xe300('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.rpc.js b/server/api/whatsappQueue/whatsappQueue.rpc.js index aef0b9e..9f0fb36 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 _0xb87a=['stringify','ShowWhatsappQueue','find','where','catch','ioredis','../../mysqldb','../../config/utils','../../config/logger','client','redis','defaults','localhost','socket.io-emitter','./whatsappQueue.socket','register','request','then','request\x20sent','WhatsappQueue,\x20%s,\x20%s,\x20%s','error','code','WhatsappQueue,\x20%s,\x20%s','message','WhatsappQueue','options','raw','attributes','limit','include','model','map','info','GetWhatsappQueue','debug'];(function(_0xd3c1fc,_0x54e814){var _0x2735ed=function(_0x4547e7){while(--_0x4547e7){_0xd3c1fc['push'](_0xd3c1fc['shift']());}};_0x2735ed(++_0x54e814);}(_0xb87a,0x6e));var _0xab87=function(_0x30ae5e,_0x391fc4){_0x30ae5e=_0x30ae5e-0x0;var _0x1f2e93=_0xb87a[_0x30ae5e];return _0x1f2e93;};'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(_0xab87('0x0'));var db=require(_0xab87('0x1'))['db'];var utils=require(_0xab87('0x2'));var logger=require(_0xab87('0x3'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xab87('0x4')]['http']({'port':0x232a});config[_0xab87('0x5')]=_[_0xab87('0x6')](config[_0xab87('0x5')],{'host':_0xab87('0x7'),'port':0x18eb});var socket=require(_0xab87('0x8'))(new Redis(config['redis']));require(_0xab87('0x9'))[_0xab87('0xa')](socket);function respondWithRpcPromise(_0xb7cd9f,_0x5d7a3b,_0x8606d4){return new BPromise(function(_0xd6edcc,_0x18bed6){return client[_0xab87('0xb')](_0xb7cd9f,_0x8606d4)[_0xab87('0xc')](function(_0x3b142d){logger['info']('WhatsappQueue,\x20%s,\x20%s',_0x5d7a3b,_0xab87('0xd'));logger['debug'](_0xab87('0xe'),_0x5d7a3b,_0xab87('0xd'),JSON['stringify'](_0x3b142d));if(_0x3b142d[_0xab87('0xf')]){if(_0x3b142d['error'][_0xab87('0x10')]===0x1f4){logger[_0xab87('0xf')](_0xab87('0x11'),_0x5d7a3b,_0x3b142d[_0xab87('0xf')][_0xab87('0x12')]);return _0x18bed6(_0x3b142d[_0xab87('0xf')]['message']);}logger[_0xab87('0xf')](_0xab87('0x11'),_0x5d7a3b,_0x3b142d[_0xab87('0xf')]['message']);return _0xd6edcc(_0x3b142d[_0xab87('0xf')]['message']);}else{logger['info'](_0xab87('0x11'),_0x5d7a3b,_0xab87('0xd'));_0xd6edcc(_0x3b142d['result'][_0xab87('0x12')]);}})['catch'](function(_0x45c638){logger['error'](_0xab87('0x11'),_0x5d7a3b,_0x45c638);_0x18bed6(_0x45c638);});});}exports['GetWhatsappQueue']=function(_0xe8e026){var _0x3b80d=this;return new Promise(function(_0xb8e431,_0x478ce3){return db[_0xab87('0x13')]['findAll']({'raw':_0xe8e026[_0xab87('0x14')]?_0xe8e026['options'][_0xab87('0x15')]===undefined?!![]:![]:!![],'where':_0xe8e026['options']?_0xe8e026[_0xab87('0x14')]['where']||null:null,'attributes':_0xe8e026[_0xab87('0x14')]?_0xe8e026['options'][_0xab87('0x16')]||null:null,'limit':_0xe8e026[_0xab87('0x14')]?_0xe8e026[_0xab87('0x14')][_0xab87('0x17')]||null:null,'include':_0xe8e026[_0xab87('0x14')]?_0xe8e026[_0xab87('0x14')][_0xab87('0x18')]?_['map'](_0xe8e026['options'][_0xab87('0x18')],function(_0x5df21e){return{'model':db[_0x5df21e[_0xab87('0x19')]],'as':_0x5df21e['as'],'attributes':_0x5df21e[_0xab87('0x16')],'include':_0x5df21e[_0xab87('0x18')]?_[_0xab87('0x1a')](_0x5df21e[_0xab87('0x18')],function(_0x312842){return{'model':db[_0x312842['model']],'as':_0x312842['as'],'attributes':_0x312842[_0xab87('0x16')],'include':_0x312842[_0xab87('0x18')]?_[_0xab87('0x1a')](_0x312842[_0xab87('0x18')],function(_0x187f98){return{'model':db[_0x187f98[_0xab87('0x19')]],'as':_0x187f98['as'],'attributes':_0x187f98[_0xab87('0x16')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x4a7f53){logger[_0xab87('0x1b')](_0xab87('0x1c'),_0xe8e026);logger[_0xab87('0x1d')](_0xab87('0x1c'),_0xe8e026,JSON[_0xab87('0x1e')](_0x4a7f53));_0xb8e431(_0x4a7f53);})['catch'](function(_0x9d84ef){logger[_0xab87('0xf')](_0xab87('0x1c'),_0x9d84ef[_0xab87('0x12')],_0xe8e026);_0x478ce3(_0x3b80d['error'](0x1f4,_0x9d84ef[_0xab87('0x12')]));});});};exports[_0xab87('0x1f')]=function(_0x4d1331){var _0x14255f=this;return new Promise(function(_0x37ab63,_0x5f398a){return db[_0xab87('0x13')][_0xab87('0x20')]({'raw':_0x4d1331['options']?_0x4d1331[_0xab87('0x14')][_0xab87('0x15')]===undefined?!![]:![]:!![],'where':_0x4d1331[_0xab87('0x14')]?_0x4d1331[_0xab87('0x14')][_0xab87('0x21')]||null:null,'attributes':_0x4d1331[_0xab87('0x14')]?_0x4d1331[_0xab87('0x14')][_0xab87('0x16')]||null:null,'include':_0x4d1331[_0xab87('0x14')]?_0x4d1331[_0xab87('0x14')]['include']?_[_0xab87('0x1a')](_0x4d1331['options'][_0xab87('0x18')],function(_0x5b40cc){return{'model':db[_0x5b40cc['model']],'as':_0x5b40cc['as'],'attributes':_0x5b40cc[_0xab87('0x16')],'include':_0x5b40cc['include']?_[_0xab87('0x1a')](_0x5b40cc[_0xab87('0x18')],function(_0xb17a17){return{'model':db[_0xb17a17[_0xab87('0x19')]],'as':_0xb17a17['as'],'attributes':_0xb17a17[_0xab87('0x16')],'include':_0xb17a17[_0xab87('0x18')]?_[_0xab87('0x1a')](_0xb17a17['include'],function(_0x48bd7b){return{'model':db[_0x48bd7b[_0xab87('0x19')]],'as':_0x48bd7b['as'],'attributes':_0x48bd7b[_0xab87('0x16')]};}):[]};}):[]};}):[]:[]})[_0xab87('0xc')](function(_0x17a343){logger[_0xab87('0x1b')](_0xab87('0x1f'),_0x4d1331);logger[_0xab87('0x1d')](_0xab87('0x1f'),_0x4d1331,JSON[_0xab87('0x1e')](_0x17a343));_0x37ab63(_0x17a343);})[_0xab87('0x22')](function(_0x17ed8d){logger[_0xab87('0xf')](_0xab87('0x1f'),_0x17ed8d['message'],_0x4d1331);_0x5f398a(_0x14255f['error'](0x1f4,_0x17ed8d[_0xab87('0x12')]));});});}; \ No newline at end of file +var _0x165e=['attributes','limit','include','map','model','debug','stringify','ShowWhatsappQueue','catch','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','redis','defaults','localhost','./whatsappQueue.socket','register','request','then','info','request\x20sent','WhatsappQueue,\x20%s,\x20%s,\x20%s','error','code','WhatsappQueue,\x20%s,\x20%s','message','result','GetWhatsappQueue','WhatsappQueue','findAll','options','raw','where'];(function(_0x1b8c5d,_0x304d9c){var _0x58c702=function(_0x3bf7c1){while(--_0x3bf7c1){_0x1b8c5d['push'](_0x1b8c5d['shift']());}};_0x58c702(++_0x304d9c);}(_0x165e,0x199));var _0xe165=function(_0x591cfd,_0x501204){_0x591cfd=_0x591cfd-0x0;var _0x4d0100=_0x165e[_0x591cfd];return _0x4d0100;};'use strict';var _=require(_0xe165('0x0'));var util=require('util');var moment=require(_0xe165('0x1'));var BPromise=require(_0xe165('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xe165('0x3'));var db=require(_0xe165('0x4'))['db'];var utils=require(_0xe165('0x5'));var logger=require('../../config/logger')(_0xe165('0x6'));var config=require(_0xe165('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xe165('0x8')][_0xe165('0x9')]({'port':0x232a});config[_0xe165('0xa')]=_[_0xe165('0xb')](config[_0xe165('0xa')],{'host':_0xe165('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xe165('0xd'))[_0xe165('0xe')](socket);function respondWithRpcPromise(_0x4e9fe5,_0x402605,_0x5e4d29){return new BPromise(function(_0x1e9674,_0x498d6b){return client[_0xe165('0xf')](_0x4e9fe5,_0x5e4d29)[_0xe165('0x10')](function(_0x4486d5){logger[_0xe165('0x11')]('WhatsappQueue,\x20%s,\x20%s',_0x402605,_0xe165('0x12'));logger['debug'](_0xe165('0x13'),_0x402605,_0xe165('0x12'),JSON['stringify'](_0x4486d5));if(_0x4486d5[_0xe165('0x14')]){if(_0x4486d5[_0xe165('0x14')][_0xe165('0x15')]===0x1f4){logger['error'](_0xe165('0x16'),_0x402605,_0x4486d5[_0xe165('0x14')][_0xe165('0x17')]);return _0x498d6b(_0x4486d5[_0xe165('0x14')]['message']);}logger[_0xe165('0x14')](_0xe165('0x16'),_0x402605,_0x4486d5['error'][_0xe165('0x17')]);return _0x1e9674(_0x4486d5['error'][_0xe165('0x17')]);}else{logger[_0xe165('0x11')]('WhatsappQueue,\x20%s,\x20%s',_0x402605,_0xe165('0x12'));_0x1e9674(_0x4486d5[_0xe165('0x18')][_0xe165('0x17')]);}})['catch'](function(_0x4d7ae5){logger[_0xe165('0x14')]('WhatsappQueue,\x20%s,\x20%s',_0x402605,_0x4d7ae5);_0x498d6b(_0x4d7ae5);});});}exports[_0xe165('0x19')]=function(_0x5a6b5a){var _0x4f47d1=this;return new Promise(function(_0x515eae,_0x507c32){return db[_0xe165('0x1a')][_0xe165('0x1b')]({'raw':_0x5a6b5a[_0xe165('0x1c')]?_0x5a6b5a['options'][_0xe165('0x1d')]===undefined?!![]:![]:!![],'where':_0x5a6b5a['options']?_0x5a6b5a['options'][_0xe165('0x1e')]||null:null,'attributes':_0x5a6b5a[_0xe165('0x1c')]?_0x5a6b5a[_0xe165('0x1c')][_0xe165('0x1f')]||null:null,'limit':_0x5a6b5a[_0xe165('0x1c')]?_0x5a6b5a[_0xe165('0x1c')][_0xe165('0x20')]||null:null,'include':_0x5a6b5a['options']?_0x5a6b5a[_0xe165('0x1c')][_0xe165('0x21')]?_[_0xe165('0x22')](_0x5a6b5a['options'][_0xe165('0x21')],function(_0x6e08b7){return{'model':db[_0x6e08b7[_0xe165('0x23')]],'as':_0x6e08b7['as'],'attributes':_0x6e08b7[_0xe165('0x1f')],'include':_0x6e08b7[_0xe165('0x21')]?_[_0xe165('0x22')](_0x6e08b7[_0xe165('0x21')],function(_0x3604d5){return{'model':db[_0x3604d5[_0xe165('0x23')]],'as':_0x3604d5['as'],'attributes':_0x3604d5['attributes'],'include':_0x3604d5['include']?_[_0xe165('0x22')](_0x3604d5[_0xe165('0x21')],function(_0x472df0){return{'model':db[_0x472df0[_0xe165('0x23')]],'as':_0x472df0['as'],'attributes':_0x472df0[_0xe165('0x1f')]};}):[]};}):[]};}):[]:[]})[_0xe165('0x10')](function(_0x1431c6){logger[_0xe165('0x11')]('GetWhatsappQueue',_0x5a6b5a);logger[_0xe165('0x24')]('GetWhatsappQueue',_0x5a6b5a,JSON[_0xe165('0x25')](_0x1431c6));_0x515eae(_0x1431c6);})['catch'](function(_0x4f99fb){logger[_0xe165('0x14')]('GetWhatsappQueue',_0x4f99fb['message'],_0x5a6b5a);_0x507c32(_0x4f47d1[_0xe165('0x14')](0x1f4,_0x4f99fb[_0xe165('0x17')]));});});};exports[_0xe165('0x26')]=function(_0x3caf74){var _0x3774bd=this;return new Promise(function(_0x1b7d5d,_0x456478){return db[_0xe165('0x1a')]['find']({'raw':_0x3caf74['options']?_0x3caf74[_0xe165('0x1c')][_0xe165('0x1d')]===undefined?!![]:![]:!![],'where':_0x3caf74[_0xe165('0x1c')]?_0x3caf74[_0xe165('0x1c')]['where']||null:null,'attributes':_0x3caf74['options']?_0x3caf74[_0xe165('0x1c')][_0xe165('0x1f')]||null:null,'include':_0x3caf74[_0xe165('0x1c')]?_0x3caf74[_0xe165('0x1c')][_0xe165('0x21')]?_[_0xe165('0x22')](_0x3caf74[_0xe165('0x1c')][_0xe165('0x21')],function(_0x4032af){return{'model':db[_0x4032af[_0xe165('0x23')]],'as':_0x4032af['as'],'attributes':_0x4032af[_0xe165('0x1f')],'include':_0x4032af[_0xe165('0x21')]?_[_0xe165('0x22')](_0x4032af[_0xe165('0x21')],function(_0x4a0792){return{'model':db[_0x4a0792[_0xe165('0x23')]],'as':_0x4a0792['as'],'attributes':_0x4a0792[_0xe165('0x1f')],'include':_0x4a0792[_0xe165('0x21')]?_[_0xe165('0x22')](_0x4a0792[_0xe165('0x21')],function(_0x121418){return{'model':db[_0x121418[_0xe165('0x23')]],'as':_0x121418['as'],'attributes':_0x121418[_0xe165('0x1f')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x1408f7){logger[_0xe165('0x11')]('ShowWhatsappQueue',_0x3caf74);logger['debug'](_0xe165('0x26'),_0x3caf74,JSON[_0xe165('0x25')](_0x1408f7));_0x1b7d5d(_0x1408f7);})[_0xe165('0x27')](function(_0x528db4){logger[_0xe165('0x14')](_0xe165('0x26'),_0x528db4[_0xe165('0x17')],_0x3caf74);_0x456478(_0x3774bd['error'](0x1f4,_0x528db4[_0xe165('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.socket.js b/server/api/whatsappQueue/whatsappQueue.socket.js index ec0c069..45b3c5b 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 _0xbabf=['./whatsappQueue.events','update','emit','register','length','whatsappQueue:'];(function(_0x3042c5,_0x36cb88){var _0x7cd140=function(_0x4cdcd8){while(--_0x4cdcd8){_0x3042c5['push'](_0x3042c5['shift']());}};_0x7cd140(++_0x36cb88);}(_0xbabf,0x156));var _0xfbab=function(_0x126558,_0x143c9a){_0x126558=_0x126558-0x0;var _0x1f6d14=_0xbabf[_0x126558];return _0x1f6d14;};'use strict';var WhatsappQueueEvents=require(_0xfbab('0x0'));var events=['save','remove',_0xfbab('0x1')];function createListener(_0x3d4983,_0x5d27bf){return function(_0x482fef){_0x5d27bf[_0xfbab('0x2')](_0x3d4983,_0x482fef);};}function removeListener(_0x18357c,_0x2d2eb3){return function(){WhatsappQueueEvents['removeListener'](_0x18357c,_0x2d2eb3);};}exports[_0xfbab('0x3')]=function(_0x181a19){for(var _0x42bc34=0x0,_0x3cf9a0=events[_0xfbab('0x4')];_0x42bc34<_0x3cf9a0;_0x42bc34++){var _0x328d2f=events[_0x42bc34];var _0x1484d4=createListener(_0xfbab('0x5')+_0x328d2f,_0x181a19);WhatsappQueueEvents['on'](_0x328d2f,_0x1484d4);}}; \ No newline at end of file +var _0x0e97=['register','length','./whatsappQueue.events','save','remove','update','emit'];(function(_0x36c5b0,_0x5001da){var _0xf19333=function(_0x1e880a){while(--_0x1e880a){_0x36c5b0['push'](_0x36c5b0['shift']());}};_0xf19333(++_0x5001da);}(_0x0e97,0x64));var _0x70e9=function(_0x34ea65,_0x5f1d4c){_0x34ea65=_0x34ea65-0x0;var _0xcc7845=_0x0e97[_0x34ea65];return _0xcc7845;};'use strict';var WhatsappQueueEvents=require(_0x70e9('0x0'));var events=[_0x70e9('0x1'),_0x70e9('0x2'),_0x70e9('0x3')];function createListener(_0x5129b3,_0x5ec2f0){return function(_0x1640ab){_0x5ec2f0[_0x70e9('0x4')](_0x5129b3,_0x1640ab);};}function removeListener(_0x2df2db,_0x403d09){return function(){WhatsappQueueEvents['removeListener'](_0x2df2db,_0x403d09);};}exports[_0x70e9('0x5')]=function(_0x748baf){for(var _0x488cf1=0x0,_0x13cd2b=events[_0x70e9('0x6')];_0x488cf1<_0x13cd2b;_0x488cf1++){var _0x3353af=events[_0x488cf1];var _0x1b6887=createListener('whatsappQueue:'+_0x3353af,_0x748baf);WhatsappQueueEvents['on'](_0x3353af,_0x1b6887);}}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/index.js b/server/api/whatsappQueueReport/index.js index 132865d..5d2f817 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 _0x8bca=['post','create','put','update','delete','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappQueueReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show'];(function(_0x50e29a,_0x1d4ba0){var _0x46179b=function(_0x1bb32d){while(--_0x1bb32d){_0x50e29a['push'](_0x50e29a['shift']());}};_0x46179b(++_0x1d4ba0);}(_0x8bca,0x12b));var _0xa8bc=function(_0x2ec461,_0x5f588a){_0x2ec461=_0x2ec461-0x0;var _0x28603d=_0x8bca[_0x2ec461];return _0x28603d;};'use strict';var multer=require(_0xa8bc('0x0'));var util=require(_0xa8bc('0x1'));var path=require(_0xa8bc('0x2'));var timeout=require('connect-timeout');var express=require(_0xa8bc('0x3'));var router=express[_0xa8bc('0x4')]();var auth=require(_0xa8bc('0x5'));var interaction=require(_0xa8bc('0x6'));var config=require(_0xa8bc('0x7'));var controller=require(_0xa8bc('0x8'));router[_0xa8bc('0x9')]('/',auth[_0xa8bc('0xa')](),controller[_0xa8bc('0xb')]);router[_0xa8bc('0x9')](_0xa8bc('0xc'),auth['isAuthenticated'](),controller[_0xa8bc('0xd')]);router[_0xa8bc('0x9')](_0xa8bc('0xe'),auth[_0xa8bc('0xa')](),controller[_0xa8bc('0xf')]);router[_0xa8bc('0x10')]('/',auth[_0xa8bc('0xa')](),controller[_0xa8bc('0x11')]);router[_0xa8bc('0x12')](_0xa8bc('0xe'),auth[_0xa8bc('0xa')](),controller[_0xa8bc('0x13')]);router[_0xa8bc('0x14')](_0xa8bc('0xe'),auth[_0xa8bc('0xa')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x6eec=['../../config/environment','./whatsappQueueReport.controller','get','isAuthenticated','index','/describe','describe','show','put','/:id','update','destroy','multer','util','path','connect-timeout','Router','../../components/auth/service'];(function(_0x68361,_0x231f90){var _0xbb709a=function(_0x47e656){while(--_0x47e656){_0x68361['push'](_0x68361['shift']());}};_0xbb709a(++_0x231f90);}(_0x6eec,0x1e0));var _0xc6ee=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x6eec[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0xc6ee('0x0'));var util=require(_0xc6ee('0x1'));var path=require(_0xc6ee('0x2'));var timeout=require(_0xc6ee('0x3'));var express=require('express');var router=express[_0xc6ee('0x4')]();var auth=require(_0xc6ee('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xc6ee('0x6'));var controller=require(_0xc6ee('0x7'));router[_0xc6ee('0x8')]('/',auth[_0xc6ee('0x9')](),controller[_0xc6ee('0xa')]);router[_0xc6ee('0x8')](_0xc6ee('0xb'),auth[_0xc6ee('0x9')](),controller[_0xc6ee('0xc')]);router['get']('/:id',auth[_0xc6ee('0x9')](),controller[_0xc6ee('0xd')]);router['post']('/',auth[_0xc6ee('0x9')](),controller['create']);router[_0xc6ee('0xe')](_0xc6ee('0xf'),auth[_0xc6ee('0x9')](),controller[_0xc6ee('0x10')]);router['delete'](_0xc6ee('0xf'),auth[_0xc6ee('0x9')](),controller[_0xc6ee('0x11')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.attributes.js b/server/api/whatsappQueueReport/whatsappQueueReport.attributes.js index 354a9ec..4247dd4 100644 --- a/server/api/whatsappQueueReport/whatsappQueueReport.attributes.js +++ b/server/api/whatsappQueueReport/whatsappQueueReport.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x34e8=['sequelize','exports','STRING','DATE'];(function(_0x40ec05,_0x179503){var _0x569be9=function(_0x490021){while(--_0x490021){_0x40ec05['push'](_0x40ec05['shift']());}};_0x569be9(++_0x179503);}(_0x34e8,0x12c));var _0x834e=function(_0x5be951,_0x1047fe){_0x5be951=_0x5be951-0x0;var _0x5c1063=_0x34e8[_0x5be951];return _0x5c1063;};'use strict';var Sequelize=require(_0x834e('0x0'));module[_0x834e('0x1')]={'uniqueid':{'type':Sequelize[_0x834e('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0x834e('0x2')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0x834e('0x3')]},'acceptAt':{'type':Sequelize[_0x834e('0x3')]},'exitAt':{'type':Sequelize[_0x834e('0x3')]},'reason':{'type':Sequelize[_0x834e('0x2')]}}; \ No newline at end of file +var _0x6aa7=['DATE','sequelize','STRING'];(function(_0x430350,_0x3ec8d1){var _0x31f73e=function(_0x384ea2){while(--_0x384ea2){_0x430350['push'](_0x430350['shift']());}};_0x31f73e(++_0x3ec8d1);}(_0x6aa7,0x178));var _0x76aa=function(_0x1a1226,_0x594347){_0x1a1226=_0x1a1226-0x0;var _0xf2db27=_0x6aa7[_0x1a1226];return _0xf2db27;};'use strict';var Sequelize=require(_0x76aa('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0x76aa('0x1')],'allowNull':![]},'from':{'type':Sequelize[_0x76aa('0x1')]},'joinAt':{'type':Sequelize[_0x76aa('0x2')]},'leaveAt':{'type':Sequelize[_0x76aa('0x2')]},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0x76aa('0x2')]},'reason':{'type':Sequelize[_0x76aa('0x1')]}}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.controller.js b/server/api/whatsappQueueReport/whatsappQueueReport.controller.js index 31669f9..082cda0 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 _0xe1d1=['fields','merge','options','find','create','catch','body','params','describe','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','status','end','json','count','offset','limit','set','apply','reject','save','update','destroy','then','name','send','index','map','WhatsappQueueReport','rawAttributes','key','model','query','filters','intersection','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','includeAll','include','rows','show','keys'];(function(_0x5d6456,_0x58ecc7){var _0x4d66c1=function(_0x4335e3){while(--_0x4335e3){_0x5d6456['push'](_0x5d6456['shift']());}};_0x4d66c1(++_0x58ecc7);}(_0xe1d1,0x131));var _0x1e1d=function(_0x2235bf,_0x3a06a7){_0x2235bf=_0x2235bf-0x0;var _0x4c3a64=_0xe1d1[_0x2235bf];return _0x4c3a64;};'use strict';var pdf=require(_0x1e1d('0x0'));var emlformat=require(_0x1e1d('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x1e1d('0x2'));var jsonpatch=require(_0x1e1d('0x3'));var rp=require(_0x1e1d('0x4'));var moment=require(_0x1e1d('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x1e1d('0x6'));var util=require(_0x1e1d('0x7'));var path=require(_0x1e1d('0x8'));var sox=require(_0x1e1d('0x9'));var csv=require(_0x1e1d('0xa'));var ejs=require(_0x1e1d('0xb'));var fs=require('fs');var _=require('lodash');var squel=require(_0x1e1d('0xc'));var crypto=require(_0x1e1d('0xd'));var jsforce=require(_0x1e1d('0xe'));var deskjs=require(_0x1e1d('0xf'));var toCsv=require(_0x1e1d('0xa'));var querystring=require(_0x1e1d('0x10'));var Papa=require('papaparse');var Redis=require(_0x1e1d('0x11'));var authService=require(_0x1e1d('0x12'));var qs=require(_0x1e1d('0x13'));var as=require(_0x1e1d('0x14'));var hardwareService=require(_0x1e1d('0x15'));var logger=require(_0x1e1d('0x16'))(_0x1e1d('0x17'));var utils=require('../../config/utils');var config=require(_0x1e1d('0x18'));var db=require(_0x1e1d('0x19'))['db'];function respondWithStatusCode(_0x1ebf5e,_0x1c209d){_0x1c209d=_0x1c209d||0xcc;return function(_0x37fd79){if(_0x37fd79){return _0x1ebf5e['sendStatus'](_0x1c209d);}return _0x1ebf5e[_0x1e1d('0x1a')](_0x1c209d)[_0x1e1d('0x1b')]();};}function respondWithResult(_0x3f2e59,_0x50f09a){_0x50f09a=_0x50f09a||0xc8;return function(_0x38aa77){if(_0x38aa77){return _0x3f2e59[_0x1e1d('0x1a')](_0x50f09a)[_0x1e1d('0x1c')](_0x38aa77);}};}function respondWithFilteredResult(_0x119a87,_0x157840){return function(_0x5c4ae1){if(_0x5c4ae1){var _0x16cdf5=_0x5c4ae1[_0x1e1d('0x1d')],_0x466bdb=_0x157840[_0x1e1d('0x1e')],_0x2bc2cf=_0x157840[_0x1e1d('0x1e')]+_0x157840[_0x1e1d('0x1f')],_0x274b76;if(_0x2bc2cf>=_0x16cdf5){_0x2bc2cf=_0x16cdf5;_0x274b76=0xc8;}else{_0x274b76=0xce;}_0x119a87['status'](_0x274b76);return _0x119a87[_0x1e1d('0x20')]('Content-Range',_0x466bdb+'-'+_0x2bc2cf+'/'+_0x16cdf5)[_0x1e1d('0x1c')](_0x5c4ae1);}return null;};}function patchUpdates(_0x5eae62){return function(_0x2cb5ab){try{jsonpatch[_0x1e1d('0x21')](_0x2cb5ab,_0x5eae62,!![]);}catch(_0x148d32){return BPromise[_0x1e1d('0x22')](_0x148d32);}return _0x2cb5ab[_0x1e1d('0x23')]();};}function saveUpdates(_0x4b2f34,_0x1ef527){return function(_0x2ed406){if(_0x2ed406){return _0x2ed406[_0x1e1d('0x24')](_0x4b2f34)['then'](function(_0x511548){return _0x511548;});}return null;};}function removeEntity(_0x747fc7,_0x24b1bb){return function(_0x53e8a1){if(_0x53e8a1){return _0x53e8a1[_0x1e1d('0x25')]()[_0x1e1d('0x26')](function(){_0x747fc7[_0x1e1d('0x1a')](0xcc)[_0x1e1d('0x1b')]();});}};}function handleEntityNotFound(_0xc0d6c0,_0x59124f){return function(_0x1a11dc){if(!_0x1a11dc){_0xc0d6c0['sendStatus'](0x194);}return _0x1a11dc;};}function handleError(_0x5f05f1,_0x3c3cb6){_0x3c3cb6=_0x3c3cb6||0x1f4;return function(_0x26aeab){logger['error'](_0x26aeab['stack']);if(_0x26aeab[_0x1e1d('0x27')]){delete _0x26aeab[_0x1e1d('0x27')];}_0x5f05f1['status'](_0x3c3cb6)[_0x1e1d('0x28')](_0x26aeab);};}exports[_0x1e1d('0x29')]=function(_0xdc69ee,_0x4427e9){var _0x82ee43={},_0x15f703={},_0x3c1181={'count':0x0,'rows':[]};var _0x47cb5f=_[_0x1e1d('0x2a')](db[_0x1e1d('0x2b')][_0x1e1d('0x2c')],function(_0xb1388b){return{'name':_0xb1388b['fieldName'],'type':_0xb1388b['type'][_0x1e1d('0x2d')]};});_0x15f703[_0x1e1d('0x2e')]=_[_0x1e1d('0x2a')](_0x47cb5f,'name');_0x15f703[_0x1e1d('0x2f')]=_['keys'](_0xdc69ee[_0x1e1d('0x2f')]);_0x15f703[_0x1e1d('0x30')]=_[_0x1e1d('0x31')](_0x15f703[_0x1e1d('0x2e')],_0x15f703[_0x1e1d('0x2f')]);_0x82ee43[_0x1e1d('0x32')]=_[_0x1e1d('0x31')](_0x15f703['model'],qs['fields'](_0xdc69ee[_0x1e1d('0x2f')]['fields']));_0x82ee43['attributes']=_0x82ee43[_0x1e1d('0x32')][_0x1e1d('0x33')]?_0x82ee43[_0x1e1d('0x32')]:_0x15f703['model'];if(!_0xdc69ee[_0x1e1d('0x2f')][_0x1e1d('0x34')](_0x1e1d('0x35'))){_0x82ee43['limit']=qs['limit'](_0xdc69ee[_0x1e1d('0x2f')][_0x1e1d('0x1f')]);_0x82ee43[_0x1e1d('0x1e')]=qs['offset'](_0xdc69ee['query'][_0x1e1d('0x1e')]);}_0x82ee43[_0x1e1d('0x36')]=qs[_0x1e1d('0x37')](_0xdc69ee[_0x1e1d('0x2f')]['sort']);_0x82ee43[_0x1e1d('0x38')]=qs['filters'](_[_0x1e1d('0x39')](_0xdc69ee['query'],_0x15f703[_0x1e1d('0x30')]),_0x47cb5f);if(_0xdc69ee[_0x1e1d('0x2f')][_0x1e1d('0x3a')]){_0x82ee43[_0x1e1d('0x38')]=_['merge'](_0x82ee43[_0x1e1d('0x38')],{'$or':_['map'](_0x47cb5f,function(_0x36daf2){if(_0x36daf2['type']!==_0x1e1d('0x3b')){var _0x2cd83d={};_0x2cd83d[_0x36daf2[_0x1e1d('0x27')]]={'$like':'%'+_0xdc69ee[_0x1e1d('0x2f')]['filter']+'%'};return _0x2cd83d;}})});}_0x82ee43=_['merge']({},_0x82ee43,_0xdc69ee['options']);var _0x2dbd33={'where':_0x82ee43[_0x1e1d('0x38')]};return db['WhatsappQueueReport'][_0x1e1d('0x1d')](_0x2dbd33)[_0x1e1d('0x26')](function(_0x5bc7d5){_0x3c1181[_0x1e1d('0x1d')]=_0x5bc7d5;if(_0xdc69ee['query'][_0x1e1d('0x3c')]){_0x82ee43[_0x1e1d('0x3d')]=[{'all':!![]}];}return db[_0x1e1d('0x2b')]['findAll'](_0x82ee43);})[_0x1e1d('0x26')](function(_0x5e478b){_0x3c1181[_0x1e1d('0x3e')]=_0x5e478b;return _0x3c1181;})[_0x1e1d('0x26')](respondWithFilteredResult(_0x4427e9,_0x82ee43))['catch'](handleError(_0x4427e9,null));};exports[_0x1e1d('0x3f')]=function(_0x45a174,_0x65d921){var _0x2e4528={'raw':!![],'where':{'id':_0x45a174['params']['id']}},_0x1ae1d8={};_0x1ae1d8[_0x1e1d('0x2e')]=_['keys'](db[_0x1e1d('0x2b')][_0x1e1d('0x2c')]);_0x1ae1d8[_0x1e1d('0x2f')]=_[_0x1e1d('0x40')](_0x45a174['query']);_0x1ae1d8['filters']=_[_0x1e1d('0x31')](_0x1ae1d8[_0x1e1d('0x2e')],_0x1ae1d8[_0x1e1d('0x2f')]);_0x2e4528[_0x1e1d('0x32')]=_[_0x1e1d('0x31')](_0x1ae1d8['model'],qs[_0x1e1d('0x41')](_0x45a174['query'][_0x1e1d('0x41')]));_0x2e4528[_0x1e1d('0x32')]=_0x2e4528[_0x1e1d('0x32')][_0x1e1d('0x33')]?_0x2e4528[_0x1e1d('0x32')]:_0x1ae1d8[_0x1e1d('0x2e')];if(_0x45a174[_0x1e1d('0x2f')][_0x1e1d('0x3c')]){_0x2e4528[_0x1e1d('0x3d')]=[{'all':!![]}];}_0x2e4528=_[_0x1e1d('0x42')]({},_0x2e4528,_0x45a174[_0x1e1d('0x43')]);return db[_0x1e1d('0x2b')][_0x1e1d('0x44')](_0x2e4528)[_0x1e1d('0x26')](handleEntityNotFound(_0x65d921,null))[_0x1e1d('0x26')](respondWithResult(_0x65d921,null))['catch'](handleError(_0x65d921,null));};exports['create']=function(_0x585636,_0x110195){return db[_0x1e1d('0x2b')][_0x1e1d('0x45')](_0x585636['body'],{})['then'](respondWithResult(_0x110195,0xc9))[_0x1e1d('0x46')](handleError(_0x110195,null));};exports['update']=function(_0xb6e13f,_0x31bb95){if(_0xb6e13f[_0x1e1d('0x47')]['id']){delete _0xb6e13f['body']['id'];}return db[_0x1e1d('0x2b')][_0x1e1d('0x44')]({'where':{'id':_0xb6e13f[_0x1e1d('0x48')]['id']}})[_0x1e1d('0x26')](handleEntityNotFound(_0x31bb95,null))[_0x1e1d('0x26')](saveUpdates(_0xb6e13f[_0x1e1d('0x47')],null))[_0x1e1d('0x26')](respondWithResult(_0x31bb95,null))[_0x1e1d('0x46')](handleError(_0x31bb95,null));};exports[_0x1e1d('0x25')]=function(_0x1e7bc3,_0x57f008){return db[_0x1e1d('0x2b')][_0x1e1d('0x44')]({'where':{'id':_0x1e7bc3['params']['id']}})[_0x1e1d('0x26')](handleEntityNotFound(_0x57f008,null))['then'](removeEntity(_0x57f008,null))['catch'](handleError(_0x57f008,null));};exports[_0x1e1d('0x49')]=function(_0x5fd2e1,_0x999266){return db[_0x1e1d('0x2b')][_0x1e1d('0x49')]()['then'](respondWithResult(_0x999266,null))[_0x1e1d('0x46')](handleError(_0x999266,null));}; \ No newline at end of file +var _0xafec=['../../mysqldb','sendStatus','status','json','count','offset','limit','set','Content-Range','apply','reject','save','then','destroy','end','error','name','send','map','WhatsappQueueReport','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','catch','show','params','keys','options','find','create','body','update','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','util','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/utils','../../config/environment'];(function(_0x1de487,_0x2d1056){var _0x55c07e=function(_0x50abdf){while(--_0x50abdf){_0x1de487['push'](_0x1de487['shift']());}};_0x55c07e(++_0x2d1056);}(_0xafec,0x161));var _0xcafe=function(_0x3b2fbf,_0x477fc9){_0x3b2fbf=_0x3b2fbf-0x0;var _0x3236c0=_0xafec[_0x3b2fbf];return _0x3236c0;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xcafe('0x0'));var rimraf=require(_0xcafe('0x1'));var zipdir=require(_0xcafe('0x2'));var jsonpatch=require(_0xcafe('0x3'));var rp=require('request-promise');var moment=require(_0xcafe('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xcafe('0x5'));var util=require(_0xcafe('0x6'));var path=require('path');var sox=require(_0xcafe('0x7'));var csv=require(_0xcafe('0x8'));var ejs=require(_0xcafe('0x9'));var fs=require('fs');var _=require(_0xcafe('0xa'));var squel=require(_0xcafe('0xb'));var crypto=require(_0xcafe('0xc'));var jsforce=require(_0xcafe('0xd'));var deskjs=require(_0xcafe('0xe'));var toCsv=require(_0xcafe('0x8'));var querystring=require(_0xcafe('0xf'));var Papa=require(_0xcafe('0x10'));var Redis=require(_0xcafe('0x11'));var authService=require('../../components/auth/service');var qs=require(_0xcafe('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xcafe('0x13'));var logger=require('../../config/logger')('api');var utils=require(_0xcafe('0x14'));var config=require(_0xcafe('0x15'));var db=require(_0xcafe('0x16'))['db'];function respondWithStatusCode(_0x5987c6,_0x36b734){_0x36b734=_0x36b734||0xcc;return function(_0x40780b){if(_0x40780b){return _0x5987c6[_0xcafe('0x17')](_0x36b734);}return _0x5987c6[_0xcafe('0x18')](_0x36b734)['end']();};}function respondWithResult(_0xde913f,_0x435bf8){_0x435bf8=_0x435bf8||0xc8;return function(_0x4ce537){if(_0x4ce537){return _0xde913f[_0xcafe('0x18')](_0x435bf8)[_0xcafe('0x19')](_0x4ce537);}};}function respondWithFilteredResult(_0x572321,_0x37016d){return function(_0x8dddd3){if(_0x8dddd3){var _0x20fbc1=_0x8dddd3[_0xcafe('0x1a')],_0x316cf8=_0x37016d['offset'],_0x2e26ef=_0x37016d[_0xcafe('0x1b')]+_0x37016d[_0xcafe('0x1c')],_0x1a4a47;if(_0x2e26ef>=_0x20fbc1){_0x2e26ef=_0x20fbc1;_0x1a4a47=0xc8;}else{_0x1a4a47=0xce;}_0x572321[_0xcafe('0x18')](_0x1a4a47);return _0x572321[_0xcafe('0x1d')](_0xcafe('0x1e'),_0x316cf8+'-'+_0x2e26ef+'/'+_0x20fbc1)[_0xcafe('0x19')](_0x8dddd3);}return null;};}function patchUpdates(_0x51616f){return function(_0x324132){try{jsonpatch[_0xcafe('0x1f')](_0x324132,_0x51616f,!![]);}catch(_0x1aadcc){return BPromise[_0xcafe('0x20')](_0x1aadcc);}return _0x324132[_0xcafe('0x21')]();};}function saveUpdates(_0x3f1563,_0xd8b76d){return function(_0xcddca6){if(_0xcddca6){return _0xcddca6['update'](_0x3f1563)[_0xcafe('0x22')](function(_0x3563b5){return _0x3563b5;});}return null;};}function removeEntity(_0x579e65,_0x409f16){return function(_0x14f11b){if(_0x14f11b){return _0x14f11b[_0xcafe('0x23')]()[_0xcafe('0x22')](function(){_0x579e65[_0xcafe('0x18')](0xcc)[_0xcafe('0x24')]();});}};}function handleEntityNotFound(_0x5f470f,_0x39aaf9){return function(_0x1cb09f){if(!_0x1cb09f){_0x5f470f[_0xcafe('0x17')](0x194);}return _0x1cb09f;};}function handleError(_0x926138,_0x5a49d9){_0x5a49d9=_0x5a49d9||0x1f4;return function(_0x13a57b){logger[_0xcafe('0x25')](_0x13a57b['stack']);if(_0x13a57b[_0xcafe('0x26')]){delete _0x13a57b[_0xcafe('0x26')];}_0x926138['status'](_0x5a49d9)[_0xcafe('0x27')](_0x13a57b);};}exports['index']=function(_0x2f5239,_0x3b7e6f){var _0x33b77d={},_0x4ef74f={},_0x3d31d1={'count':0x0,'rows':[]};var _0x997192=_[_0xcafe('0x28')](db[_0xcafe('0x29')][_0xcafe('0x2a')],function(_0x4053fb){return{'name':_0x4053fb[_0xcafe('0x2b')],'type':_0x4053fb[_0xcafe('0x2c')][_0xcafe('0x2d')]};});_0x4ef74f[_0xcafe('0x2e')]=_[_0xcafe('0x28')](_0x997192,_0xcafe('0x26'));_0x4ef74f[_0xcafe('0x2f')]=_['keys'](_0x2f5239[_0xcafe('0x2f')]);_0x4ef74f[_0xcafe('0x30')]=_[_0xcafe('0x31')](_0x4ef74f[_0xcafe('0x2e')],_0x4ef74f[_0xcafe('0x2f')]);_0x33b77d[_0xcafe('0x32')]=_['intersection'](_0x4ef74f['model'],qs[_0xcafe('0x33')](_0x2f5239['query'][_0xcafe('0x33')]));_0x33b77d[_0xcafe('0x32')]=_0x33b77d['attributes'][_0xcafe('0x34')]?_0x33b77d['attributes']:_0x4ef74f[_0xcafe('0x2e')];if(!_0x2f5239[_0xcafe('0x2f')][_0xcafe('0x35')](_0xcafe('0x36'))){_0x33b77d['limit']=qs['limit'](_0x2f5239['query'][_0xcafe('0x1c')]);_0x33b77d[_0xcafe('0x1b')]=qs['offset'](_0x2f5239[_0xcafe('0x2f')][_0xcafe('0x1b')]);}_0x33b77d[_0xcafe('0x37')]=qs[_0xcafe('0x38')](_0x2f5239[_0xcafe('0x2f')]['sort']);_0x33b77d[_0xcafe('0x39')]=qs['filters'](_[_0xcafe('0x3a')](_0x2f5239[_0xcafe('0x2f')],_0x4ef74f[_0xcafe('0x30')]),_0x997192);if(_0x2f5239[_0xcafe('0x2f')][_0xcafe('0x3b')]){_0x33b77d[_0xcafe('0x39')]=_[_0xcafe('0x3c')](_0x33b77d['where'],{'$or':_[_0xcafe('0x28')](_0x997192,function(_0x2388c7){if(_0x2388c7[_0xcafe('0x2c')]!==_0xcafe('0x3d')){var _0x21eb47={};_0x21eb47[_0x2388c7['name']]={'$like':'%'+_0x2f5239[_0xcafe('0x2f')][_0xcafe('0x3b')]+'%'};return _0x21eb47;}})});}_0x33b77d=_[_0xcafe('0x3c')]({},_0x33b77d,_0x2f5239['options']);var _0x4b575c={'where':_0x33b77d[_0xcafe('0x39')]};return db[_0xcafe('0x29')]['count'](_0x4b575c)[_0xcafe('0x22')](function(_0x1a11e4){_0x3d31d1[_0xcafe('0x1a')]=_0x1a11e4;if(_0x2f5239['query'][_0xcafe('0x3e')]){_0x33b77d[_0xcafe('0x3f')]=[{'all':!![]}];}return db['WhatsappQueueReport'][_0xcafe('0x40')](_0x33b77d);})[_0xcafe('0x22')](function(_0x27e49e){_0x3d31d1['rows']=_0x27e49e;return _0x3d31d1;})[_0xcafe('0x22')](respondWithFilteredResult(_0x3b7e6f,_0x33b77d))[_0xcafe('0x41')](handleError(_0x3b7e6f,null));};exports[_0xcafe('0x42')]=function(_0xc957c8,_0x2ba297){var _0x285324={'raw':!![],'where':{'id':_0xc957c8[_0xcafe('0x43')]['id']}},_0x491d16={};_0x491d16[_0xcafe('0x2e')]=_['keys'](db[_0xcafe('0x29')][_0xcafe('0x2a')]);_0x491d16[_0xcafe('0x2f')]=_[_0xcafe('0x44')](_0xc957c8[_0xcafe('0x2f')]);_0x491d16[_0xcafe('0x30')]=_[_0xcafe('0x31')](_0x491d16[_0xcafe('0x2e')],_0x491d16['query']);_0x285324['attributes']=_[_0xcafe('0x31')](_0x491d16[_0xcafe('0x2e')],qs[_0xcafe('0x33')](_0xc957c8[_0xcafe('0x2f')][_0xcafe('0x33')]));_0x285324[_0xcafe('0x32')]=_0x285324['attributes']['length']?_0x285324[_0xcafe('0x32')]:_0x491d16[_0xcafe('0x2e')];if(_0xc957c8[_0xcafe('0x2f')][_0xcafe('0x3e')]){_0x285324[_0xcafe('0x3f')]=[{'all':!![]}];}_0x285324=_[_0xcafe('0x3c')]({},_0x285324,_0xc957c8[_0xcafe('0x45')]);return db[_0xcafe('0x29')][_0xcafe('0x46')](_0x285324)[_0xcafe('0x22')](handleEntityNotFound(_0x2ba297,null))['then'](respondWithResult(_0x2ba297,null))[_0xcafe('0x41')](handleError(_0x2ba297,null));};exports['create']=function(_0x12503c,_0x16cb0a){return db[_0xcafe('0x29')][_0xcafe('0x47')](_0x12503c[_0xcafe('0x48')],{})[_0xcafe('0x22')](respondWithResult(_0x16cb0a,0xc9))[_0xcafe('0x41')](handleError(_0x16cb0a,null));};exports[_0xcafe('0x49')]=function(_0x50fdc7,_0x2a02e2){if(_0x50fdc7[_0xcafe('0x48')]['id']){delete _0x50fdc7[_0xcafe('0x48')]['id'];}return db[_0xcafe('0x29')][_0xcafe('0x46')]({'where':{'id':_0x50fdc7['params']['id']}})[_0xcafe('0x22')](handleEntityNotFound(_0x2a02e2,null))[_0xcafe('0x22')](saveUpdates(_0x50fdc7[_0xcafe('0x48')],null))[_0xcafe('0x22')](respondWithResult(_0x2a02e2,null))[_0xcafe('0x41')](handleError(_0x2a02e2,null));};exports[_0xcafe('0x23')]=function(_0x47022c,_0x3fe32c){return db[_0xcafe('0x29')][_0xcafe('0x46')]({'where':{'id':_0x47022c[_0xcafe('0x43')]['id']}})[_0xcafe('0x22')](handleEntityNotFound(_0x3fe32c,null))[_0xcafe('0x22')](removeEntity(_0x3fe32c,null))[_0xcafe('0x41')](handleError(_0x3fe32c,null));};exports[_0xcafe('0x4a')]=function(_0x52a2b6,_0x1a5c39){return db[_0xcafe('0x29')]['describe']()['then'](respondWithResult(_0x1a5c39,null))[_0xcafe('0x41')](handleError(_0x1a5c39,null));}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.model.js b/server/api/whatsappQueueReport/whatsappQueueReport.model.js index dec8088..e50fa6c 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 _0x9a37=['define','report_whatsapp_queue','uniqueid','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports'];(function(_0x6c993a,_0x5ea3ab){var _0x27f547=function(_0x22df20){while(--_0x22df20){_0x6c993a['push'](_0x6c993a['shift']());}};_0x27f547(++_0x5ea3ab);}(_0x9a37,0x17d));var _0x79a3=function(_0x286354,_0x128be5){_0x286354=_0x286354-0x0;var _0x30fe4d=_0x9a37[_0x286354];return _0x30fe4d;};'use strict';var _=require(_0x79a3('0x0'));var util=require(_0x79a3('0x1'));var logger=require(_0x79a3('0x2'))(_0x79a3('0x3'));var moment=require(_0x79a3('0x4'));var BPromise=require(_0x79a3('0x5'));var rp=require(_0x79a3('0x6'));var fs=require('fs');var path=require(_0x79a3('0x7'));var rimraf=require(_0x79a3('0x8'));var config=require(_0x79a3('0x9'));var attributes=require('./whatsappQueueReport.attributes');module[_0x79a3('0xa')]=function(_0x566a18,_0xb857de){return _0x566a18[_0x79a3('0xb')]('WhatsappQueueReport',attributes,{'tableName':_0x79a3('0xc'),'paranoid':![],'indexes':[{'name':_0x79a3('0xd'),'fields':[_0x79a3('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xfe89=['../../config/environment','exports','define','WhatsappQueueReport','uniqueid','lodash','util','../../config/logger','api','moment','path','rimraf'];(function(_0x29cb57,_0x58226c){var _0x5036f8=function(_0x352eef){while(--_0x352eef){_0x29cb57['push'](_0x29cb57['shift']());}};_0x5036f8(++_0x58226c);}(_0xfe89,0x19d));var _0x9fe8=function(_0x3d3dff,_0x5d4d62){_0x3d3dff=_0x3d3dff-0x0;var _0x350140=_0xfe89[_0x3d3dff];return _0x350140;};'use strict';var _=require(_0x9fe8('0x0'));var util=require(_0x9fe8('0x1'));var logger=require(_0x9fe8('0x2'))(_0x9fe8('0x3'));var moment=require(_0x9fe8('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x9fe8('0x5'));var rimraf=require(_0x9fe8('0x6'));var config=require(_0x9fe8('0x7'));var attributes=require('./whatsappQueueReport.attributes');module[_0x9fe8('0x8')]=function(_0x1cbcfd,_0x40d964){return _0x1cbcfd[_0x9fe8('0x9')](_0x9fe8('0xa'),attributes,{'tableName':'report_whatsapp_queue','paranoid':![],'indexes':[{'name':_0x9fe8('0xb'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.rpc.js b/server/api/whatsappQueueReport/whatsappQueueReport.rpc.js index 9eba439..891591a 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 _0x2745=['lodash','util','bluebird','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','then','info','WhatsappQueueReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','CreateWhatsappQueueReport','WhatsappQueueReport','create','options','raw','UpdateWhatsappQueueReport','update','body','where','attributes','limit'];(function(_0x24bf11,_0x320ad8){var _0x20f05b=function(_0x175223){while(--_0x175223){_0x24bf11['push'](_0x24bf11['shift']());}};_0x20f05b(++_0x320ad8);}(_0x2745,0x155));var _0x5274=function(_0x53088c,_0x328aa2){_0x53088c=_0x53088c-0x0;var _0x330c89=_0x2745[_0x53088c];return _0x330c89;};'use strict';var _=require(_0x5274('0x0'));var util=require(_0x5274('0x1'));var moment=require('moment');var BPromise=require(_0x5274('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x5274('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x5274('0x4'))(_0x5274('0x5'));var config=require('../../config/environment');var jayson=require(_0x5274('0x6'));var client=jayson[_0x5274('0x7')][_0x5274('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x5c8271,_0x2e95d6,_0x59d6b4){return new BPromise(function(_0x1db6ab,_0x29bc57){return client['request'](_0x5c8271,_0x59d6b4)[_0x5274('0x9')](function(_0x43c92f){logger[_0x5274('0xa')](_0x5274('0xb'),_0x2e95d6,_0x5274('0xc'));logger[_0x5274('0xd')]('WhatsappQueueReport,\x20%s,\x20%s,\x20%s',_0x2e95d6,'request\x20sent',JSON[_0x5274('0xe')](_0x43c92f));if(_0x43c92f[_0x5274('0xf')]){if(_0x43c92f[_0x5274('0xf')][_0x5274('0x10')]===0x1f4){logger['error'](_0x5274('0xb'),_0x2e95d6,_0x43c92f[_0x5274('0xf')][_0x5274('0x11')]);return _0x29bc57(_0x43c92f[_0x5274('0xf')]['message']);}logger[_0x5274('0xf')](_0x5274('0xb'),_0x2e95d6,_0x43c92f[_0x5274('0xf')][_0x5274('0x11')]);return _0x1db6ab(_0x43c92f[_0x5274('0xf')]['message']);}else{logger[_0x5274('0xa')](_0x5274('0xb'),_0x2e95d6,_0x5274('0xc'));_0x1db6ab(_0x43c92f[_0x5274('0x12')][_0x5274('0x11')]);}})[_0x5274('0x13')](function(_0x548755){logger[_0x5274('0xf')]('WhatsappQueueReport,\x20%s,\x20%s',_0x2e95d6,_0x548755);_0x29bc57(_0x548755);});});}exports[_0x5274('0x14')]=function(_0x230c78){var _0x506f7c=this;return new Promise(function(_0x4239ff,_0x465b77){return db[_0x5274('0x15')][_0x5274('0x16')](_0x230c78['body'],{'raw':_0x230c78[_0x5274('0x17')]?_0x230c78['options'][_0x5274('0x18')]===undefined?!![]:![]:!![]})[_0x5274('0x9')](function(_0x4781dc){logger[_0x5274('0xa')](_0x5274('0x14'),_0x230c78);logger[_0x5274('0xd')](_0x5274('0x14'),_0x230c78,JSON[_0x5274('0xe')](_0x4781dc));_0x4239ff(_0x4781dc);})[_0x5274('0x13')](function(_0x5a6edc){logger[_0x5274('0xf')](_0x5274('0x14'),_0x5a6edc[_0x5274('0x11')],_0x230c78);_0x465b77(_0x506f7c[_0x5274('0xf')](0x1f4,_0x5a6edc[_0x5274('0x11')]));});});};exports[_0x5274('0x19')]=function(_0x1f29f1){var _0x13df9c=this;return new Promise(function(_0x145232,_0x26c799){return db[_0x5274('0x15')][_0x5274('0x1a')](_0x1f29f1[_0x5274('0x1b')],{'raw':_0x1f29f1['options']?_0x1f29f1['options'][_0x5274('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1f29f1[_0x5274('0x17')]?_0x1f29f1[_0x5274('0x17')][_0x5274('0x1c')]||null:null,'attributes':_0x1f29f1[_0x5274('0x17')]?_0x1f29f1[_0x5274('0x17')][_0x5274('0x1d')]||null:null,'limit':_0x1f29f1[_0x5274('0x17')]?_0x1f29f1[_0x5274('0x17')][_0x5274('0x1e')]||null:null})[_0x5274('0x9')](function(_0x445653){logger[_0x5274('0xa')](_0x5274('0x19'),_0x1f29f1);logger[_0x5274('0xd')]('UpdateWhatsappQueueReport',_0x1f29f1,JSON['stringify'](_0x445653));_0x145232(_0x445653);})['catch'](function(_0x34db9a){logger[_0x5274('0xf')](_0x5274('0x19'),_0x34db9a['message'],_0x1f29f1);_0x26c799(_0x13df9c[_0x5274('0xf')](0x1f4,_0x34db9a['message']));});});}; \ No newline at end of file +var _0xf92d=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','info','WhatsappQueueReport,\x20%s,\x20%s','debug','WhatsappQueueReport,\x20%s,\x20%s,\x20%s','error','code','message','request\x20sent','result','catch','CreateWhatsappQueueReport','WhatsappQueueReport','body','options','raw','stringify','UpdateWhatsappQueueReport','where','attributes','limit','then','util','moment'];(function(_0x4db9e6,_0x4ad84b){var _0xc8814a=function(_0x43aba5){while(--_0x43aba5){_0x4db9e6['push'](_0x4db9e6['shift']());}};_0xc8814a(++_0x4ad84b);}(_0xf92d,0x196));var _0xdf92=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xf92d[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require(_0xdf92('0x0'));var moment=require(_0xdf92('0x1'));var BPromise=require(_0xdf92('0x2'));var rs=require(_0xdf92('0x3'));var fs=require('fs');var Redis=require(_0xdf92('0x4'));var db=require(_0xdf92('0x5'))['db'];var utils=require(_0xdf92('0x6'));var logger=require(_0xdf92('0x7'))(_0xdf92('0x8'));var config=require(_0xdf92('0x9'));var jayson=require(_0xdf92('0xa'));var client=jayson['client'][_0xdf92('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xb88c35,_0x4d560f,_0x4b7ef2){return new BPromise(function(_0x5b0e61,_0x47d335){return client[_0xdf92('0xc')](_0xb88c35,_0x4b7ef2)['then'](function(_0x65e831){logger[_0xdf92('0xd')](_0xdf92('0xe'),_0x4d560f,'request\x20sent');logger[_0xdf92('0xf')](_0xdf92('0x10'),_0x4d560f,'request\x20sent',JSON['stringify'](_0x65e831));if(_0x65e831[_0xdf92('0x11')]){if(_0x65e831['error'][_0xdf92('0x12')]===0x1f4){logger[_0xdf92('0x11')](_0xdf92('0xe'),_0x4d560f,_0x65e831[_0xdf92('0x11')]['message']);return _0x47d335(_0x65e831[_0xdf92('0x11')][_0xdf92('0x13')]);}logger[_0xdf92('0x11')](_0xdf92('0xe'),_0x4d560f,_0x65e831[_0xdf92('0x11')][_0xdf92('0x13')]);return _0x5b0e61(_0x65e831[_0xdf92('0x11')]['message']);}else{logger['info'](_0xdf92('0xe'),_0x4d560f,_0xdf92('0x14'));_0x5b0e61(_0x65e831[_0xdf92('0x15')][_0xdf92('0x13')]);}})[_0xdf92('0x16')](function(_0x2a8be8){logger[_0xdf92('0x11')](_0xdf92('0xe'),_0x4d560f,_0x2a8be8);_0x47d335(_0x2a8be8);});});}exports[_0xdf92('0x17')]=function(_0x36ccd7){var _0x3bf22a=this;return new Promise(function(_0x415234,_0x2ea63e){return db[_0xdf92('0x18')]['create'](_0x36ccd7[_0xdf92('0x19')],{'raw':_0x36ccd7[_0xdf92('0x1a')]?_0x36ccd7['options'][_0xdf92('0x1b')]===undefined?!![]:![]:!![]})['then'](function(_0x19884e){logger[_0xdf92('0xd')](_0xdf92('0x17'),_0x36ccd7);logger[_0xdf92('0xf')](_0xdf92('0x17'),_0x36ccd7,JSON[_0xdf92('0x1c')](_0x19884e));_0x415234(_0x19884e);})['catch'](function(_0xca92c7){logger[_0xdf92('0x11')]('CreateWhatsappQueueReport',_0xca92c7[_0xdf92('0x13')],_0x36ccd7);_0x2ea63e(_0x3bf22a[_0xdf92('0x11')](0x1f4,_0xca92c7[_0xdf92('0x13')]));});});};exports[_0xdf92('0x1d')]=function(_0x29257e){var _0x2f479d=this;return new Promise(function(_0x2d6575,_0x39127d){return db[_0xdf92('0x18')]['update'](_0x29257e[_0xdf92('0x19')],{'raw':_0x29257e['options']?_0x29257e[_0xdf92('0x1a')][_0xdf92('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x29257e['options']?_0x29257e[_0xdf92('0x1a')][_0xdf92('0x1e')]||null:null,'attributes':_0x29257e[_0xdf92('0x1a')]?_0x29257e[_0xdf92('0x1a')][_0xdf92('0x1f')]||null:null,'limit':_0x29257e['options']?_0x29257e[_0xdf92('0x1a')][_0xdf92('0x20')]||null:null})[_0xdf92('0x21')](function(_0x3f0b2a){logger[_0xdf92('0xd')](_0xdf92('0x1d'),_0x29257e);logger['debug'](_0xdf92('0x1d'),_0x29257e,JSON[_0xdf92('0x1c')](_0x3f0b2a));_0x2d6575(_0x3f0b2a);})[_0xdf92('0x16')](function(_0x507851){logger[_0xdf92('0x11')](_0xdf92('0x1d'),_0x507851[_0xdf92('0x13')],_0x29257e);_0x39127d(_0x2f479d[_0xdf92('0x11')](0x1f4,_0x507851[_0xdf92('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/index.js b/server/api/whatsappTransferReport/index.js index e5d8432..3f4cf22 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 _0x8a17=['put','update','delete','destroy','exports','multer','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./whatsappTransferReport.controller','get','isAuthenticated','index','/describe','/:id','show','create'];(function(_0x389c94,_0x2a93d9){var _0x1455cb=function(_0x5903d6){while(--_0x5903d6){_0x389c94['push'](_0x389c94['shift']());}};_0x1455cb(++_0x2a93d9);}(_0x8a17,0x135));var _0x78a1=function(_0x3d4876,_0x366386){_0x3d4876=_0x3d4876-0x0;var _0x58ca9d=_0x8a17[_0x3d4876];return _0x58ca9d;};'use strict';var multer=require(_0x78a1('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x78a1('0x1'));var express=require(_0x78a1('0x2'));var router=express[_0x78a1('0x3')]();var auth=require(_0x78a1('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x78a1('0x5'));var controller=require(_0x78a1('0x6'));router[_0x78a1('0x7')]('/',auth[_0x78a1('0x8')](),controller[_0x78a1('0x9')]);router[_0x78a1('0x7')](_0x78a1('0xa'),auth[_0x78a1('0x8')](),controller['describe']);router[_0x78a1('0x7')](_0x78a1('0xb'),auth[_0x78a1('0x8')](),controller[_0x78a1('0xc')]);router['post']('/',auth[_0x78a1('0x8')](),controller[_0x78a1('0xd')]);router[_0x78a1('0xe')](_0x78a1('0xb'),auth[_0x78a1('0x8')](),controller[_0x78a1('0xf')]);router[_0x78a1('0x10')](_0x78a1('0xb'),auth['isAuthenticated'](),controller[_0x78a1('0x11')]);module[_0x78a1('0x12')]=router; \ No newline at end of file +var _0x6b52=['../../components/interaction/service','../../config/environment','./whatsappTransferReport.controller','isAuthenticated','index','get','/describe','describe','/:id','show','post','create','put','update','delete','destroy','multer','util','path','connect-timeout','express','Router','../../components/auth/service'];(function(_0x235080,_0x2b35ce){var _0x4d1b05=function(_0x605fe8){while(--_0x605fe8){_0x235080['push'](_0x235080['shift']());}};_0x4d1b05(++_0x2b35ce);}(_0x6b52,0xdf));var _0x26b5=function(_0x4cda06,_0x3cb29c){_0x4cda06=_0x4cda06-0x0;var _0x48f3fa=_0x6b52[_0x4cda06];return _0x48f3fa;};'use strict';var multer=require(_0x26b5('0x0'));var util=require(_0x26b5('0x1'));var path=require(_0x26b5('0x2'));var timeout=require(_0x26b5('0x3'));var express=require(_0x26b5('0x4'));var router=express[_0x26b5('0x5')]();var auth=require(_0x26b5('0x6'));var interaction=require(_0x26b5('0x7'));var config=require(_0x26b5('0x8'));var controller=require(_0x26b5('0x9'));router['get']('/',auth[_0x26b5('0xa')](),controller[_0x26b5('0xb')]);router[_0x26b5('0xc')](_0x26b5('0xd'),auth['isAuthenticated'](),controller[_0x26b5('0xe')]);router[_0x26b5('0xc')](_0x26b5('0xf'),auth['isAuthenticated'](),controller[_0x26b5('0x10')]);router[_0x26b5('0x11')]('/',auth[_0x26b5('0xa')](),controller[_0x26b5('0x12')]);router[_0x26b5('0x13')](_0x26b5('0xf'),auth[_0x26b5('0xa')](),controller[_0x26b5('0x14')]);router[_0x26b5('0x15')](_0x26b5('0xf'),auth[_0x26b5('0xa')](),controller[_0x26b5('0x16')]);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 d02d3cf..93a9898 100644 --- a/server/api/whatsappTransferReport/whatsappTransferReport.attributes.js +++ b/server/api/whatsappTransferReport/whatsappTransferReport.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5f2f=['agent','queue','DATE','sequelize','exports','STRING','ENUM','account'];(function(_0x2f8f88,_0x158be2){var _0x2aaff1=function(_0x379097){while(--_0x379097){_0x2f8f88['push'](_0x2f8f88['shift']());}};_0x2aaff1(++_0x158be2);}(_0x5f2f,0x73));var _0xf5f2=function(_0x7e269,_0x1049df){_0x7e269=_0x7e269-0x0;var _0xaf2fb9=_0x5f2f[_0x7e269];return _0xaf2fb9;};'use strict';var Sequelize=require(_0xf5f2('0x0'));module[_0xf5f2('0x1')]={'uniqueid':{'type':Sequelize[_0xf5f2('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0xf5f2('0x3')](_0xf5f2('0x4'),_0xf5f2('0x5'),_0xf5f2('0x6')),'allowNull':![]},'transferredAt':{'type':Sequelize[_0xf5f2('0x7')]}}; \ No newline at end of file +var _0x0b0e=['DATE','sequelize','STRING','account','agent','queue'];(function(_0x4f9b18,_0x2cb5ca){var _0x29f20c=function(_0x268b3d){while(--_0x268b3d){_0x4f9b18['push'](_0x4f9b18['shift']());}};_0x29f20c(++_0x2cb5ca);}(_0x0b0e,0x187));var _0xe0b0=function(_0x2418e0,_0x7215b0){_0x2418e0=_0x2418e0-0x0;var _0x55ffbf=_0x0b0e[_0x2418e0];return _0x55ffbf;};'use strict';var Sequelize=require(_0xe0b0('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0xe0b0('0x1')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0xe0b0('0x2'),_0xe0b0('0x3'),_0xe0b0('0x4')),'allowNull':![]},'transferredAt':{'type':Sequelize[_0xe0b0('0x5')]}}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.controller.js b/server/api/whatsappTransferReport/whatsappTransferReport.controller.js index 845279a..894389c 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 _0xa595=['fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','limit','Content-Range','apply','reject','update','then','destroy','error','stack','name','send','map','WhatsappTransferReport','rawAttributes','fieldName','type','model','query','keys','intersection','attributes','fields','length','nolimit','order','sort','filters','pick','filter','where','merge','options','includeAll','include','show','params','find','catch','create','body','describe','html-pdf','eml-format','rimraf','zip-dir'];(function(_0x363b81,_0x81e6ca){var _0x1d92fb=function(_0x129644){while(--_0x129644){_0x363b81['push'](_0x363b81['shift']());}};_0x1d92fb(++_0x81e6ca);}(_0xa595,0xe0));var _0x5a59=function(_0x166c59,_0xb34c4c){_0x166c59=_0x166c59-0x0;var _0x3aff11=_0xa595[_0x166c59];return _0x3aff11;};'use strict';var pdf=require(_0x5a59('0x0'));var emlformat=require(_0x5a59('0x1'));var rimraf=require(_0x5a59('0x2'));var zipdir=require(_0x5a59('0x3'));var jsonpatch=require(_0x5a59('0x4'));var rp=require(_0x5a59('0x5'));var moment=require(_0x5a59('0x6'));var BPromise=require(_0x5a59('0x7'));var Mustache=require(_0x5a59('0x8'));var util=require(_0x5a59('0x9'));var path=require(_0x5a59('0xa'));var sox=require(_0x5a59('0xb'));var csv=require(_0x5a59('0xc'));var ejs=require(_0x5a59('0xd'));var fs=require('fs');var _=require('lodash');var squel=require(_0x5a59('0xe'));var crypto=require(_0x5a59('0xf'));var jsforce=require(_0x5a59('0x10'));var deskjs=require('desk.js');var toCsv=require(_0x5a59('0xc'));var querystring=require(_0x5a59('0x11'));var Papa=require(_0x5a59('0x12'));var Redis=require(_0x5a59('0x13'));var authService=require(_0x5a59('0x14'));var qs=require(_0x5a59('0x15'));var as=require(_0x5a59('0x16'));var hardwareService=require(_0x5a59('0x17'));var logger=require(_0x5a59('0x18'))(_0x5a59('0x19'));var utils=require(_0x5a59('0x1a'));var config=require(_0x5a59('0x1b'));var db=require(_0x5a59('0x1c'))['db'];function respondWithStatusCode(_0x587140,_0x4599a7){_0x4599a7=_0x4599a7||0xcc;return function(_0x1b54eb){if(_0x1b54eb){return _0x587140[_0x5a59('0x1d')](_0x4599a7);}return _0x587140[_0x5a59('0x1e')](_0x4599a7)[_0x5a59('0x1f')]();};}function respondWithResult(_0x267281,_0x31c1a3){_0x31c1a3=_0x31c1a3||0xc8;return function(_0x388a3c){if(_0x388a3c){return _0x267281[_0x5a59('0x1e')](_0x31c1a3)[_0x5a59('0x20')](_0x388a3c);}};}function respondWithFilteredResult(_0x13b8e7,_0x90a2be){return function(_0x3ce290){if(_0x3ce290){var _0xdac385=_0x3ce290[_0x5a59('0x21')],_0x549502=_0x90a2be[_0x5a59('0x22')],_0x136542=_0x90a2be[_0x5a59('0x22')]+_0x90a2be[_0x5a59('0x23')],_0x25b596;if(_0x136542>=_0xdac385){_0x136542=_0xdac385;_0x25b596=0xc8;}else{_0x25b596=0xce;}_0x13b8e7['status'](_0x25b596);return _0x13b8e7['set'](_0x5a59('0x24'),_0x549502+'-'+_0x136542+'/'+_0xdac385)[_0x5a59('0x20')](_0x3ce290);}return null;};}function patchUpdates(_0x471ee8){return function(_0x7259f8){try{jsonpatch[_0x5a59('0x25')](_0x7259f8,_0x471ee8,!![]);}catch(_0x513bba){return BPromise[_0x5a59('0x26')](_0x513bba);}return _0x7259f8['save']();};}function saveUpdates(_0x57aa6a,_0x1d6ee8){return function(_0x1662bb){if(_0x1662bb){return _0x1662bb[_0x5a59('0x27')](_0x57aa6a)[_0x5a59('0x28')](function(_0x1754dc){return _0x1754dc;});}return null;};}function removeEntity(_0x5a073b,_0x4b40f7){return function(_0x245257){if(_0x245257){return _0x245257[_0x5a59('0x29')]()[_0x5a59('0x28')](function(){_0x5a073b[_0x5a59('0x1e')](0xcc)[_0x5a59('0x1f')]();});}};}function handleEntityNotFound(_0x1a59b7,_0x5997b2){return function(_0x12834e){if(!_0x12834e){_0x1a59b7[_0x5a59('0x1d')](0x194);}return _0x12834e;};}function handleError(_0x4c6aad,_0x4da2e4){_0x4da2e4=_0x4da2e4||0x1f4;return function(_0x427dd9){logger[_0x5a59('0x2a')](_0x427dd9[_0x5a59('0x2b')]);if(_0x427dd9[_0x5a59('0x2c')]){delete _0x427dd9[_0x5a59('0x2c')];}_0x4c6aad[_0x5a59('0x1e')](_0x4da2e4)[_0x5a59('0x2d')](_0x427dd9);};}exports['index']=function(_0x50e047,_0x4e5148){var _0x99ccd9={},_0x2f5bf0={},_0x1b3a8f={'count':0x0,'rows':[]};var _0x54e6bb=_[_0x5a59('0x2e')](db[_0x5a59('0x2f')][_0x5a59('0x30')],function(_0x4da90e){return{'name':_0x4da90e[_0x5a59('0x31')],'type':_0x4da90e[_0x5a59('0x32')]['key']};});_0x2f5bf0[_0x5a59('0x33')]=_[_0x5a59('0x2e')](_0x54e6bb,_0x5a59('0x2c'));_0x2f5bf0[_0x5a59('0x34')]=_[_0x5a59('0x35')](_0x50e047['query']);_0x2f5bf0['filters']=_[_0x5a59('0x36')](_0x2f5bf0['model'],_0x2f5bf0[_0x5a59('0x34')]);_0x99ccd9[_0x5a59('0x37')]=_[_0x5a59('0x36')](_0x2f5bf0[_0x5a59('0x33')],qs[_0x5a59('0x38')](_0x50e047[_0x5a59('0x34')][_0x5a59('0x38')]));_0x99ccd9[_0x5a59('0x37')]=_0x99ccd9[_0x5a59('0x37')][_0x5a59('0x39')]?_0x99ccd9['attributes']:_0x2f5bf0[_0x5a59('0x33')];if(!_0x50e047[_0x5a59('0x34')]['hasOwnProperty'](_0x5a59('0x3a'))){_0x99ccd9[_0x5a59('0x23')]=qs['limit'](_0x50e047[_0x5a59('0x34')]['limit']);_0x99ccd9[_0x5a59('0x22')]=qs[_0x5a59('0x22')](_0x50e047[_0x5a59('0x34')][_0x5a59('0x22')]);}_0x99ccd9[_0x5a59('0x3b')]=qs[_0x5a59('0x3c')](_0x50e047['query'][_0x5a59('0x3c')]);_0x99ccd9['where']=qs[_0x5a59('0x3d')](_[_0x5a59('0x3e')](_0x50e047[_0x5a59('0x34')],_0x2f5bf0[_0x5a59('0x3d')]),_0x54e6bb);if(_0x50e047[_0x5a59('0x34')][_0x5a59('0x3f')]){_0x99ccd9[_0x5a59('0x40')]=_[_0x5a59('0x41')](_0x99ccd9[_0x5a59('0x40')],{'$or':_[_0x5a59('0x2e')](_0x54e6bb,function(_0x162cf8){if(_0x162cf8['type']!=='VIRTUAL'){var _0x2e2301={};_0x2e2301[_0x162cf8[_0x5a59('0x2c')]]={'$like':'%'+_0x50e047[_0x5a59('0x34')][_0x5a59('0x3f')]+'%'};return _0x2e2301;}})});}_0x99ccd9=_[_0x5a59('0x41')]({},_0x99ccd9,_0x50e047[_0x5a59('0x42')]);var _0x2342f4={'where':_0x99ccd9[_0x5a59('0x40')]};return db[_0x5a59('0x2f')]['count'](_0x2342f4)['then'](function(_0x1a2205){_0x1b3a8f['count']=_0x1a2205;if(_0x50e047[_0x5a59('0x34')][_0x5a59('0x43')]){_0x99ccd9[_0x5a59('0x44')]=[{'all':!![]}];}return db[_0x5a59('0x2f')]['findAll'](_0x99ccd9);})[_0x5a59('0x28')](function(_0x598a8d){_0x1b3a8f['rows']=_0x598a8d;return _0x1b3a8f;})[_0x5a59('0x28')](respondWithFilteredResult(_0x4e5148,_0x99ccd9))['catch'](handleError(_0x4e5148,null));};exports[_0x5a59('0x45')]=function(_0x470de6,_0x97d1b9){var _0x121edf={'raw':!![],'where':{'id':_0x470de6[_0x5a59('0x46')]['id']}},_0x216578={};_0x216578[_0x5a59('0x33')]=_[_0x5a59('0x35')](db[_0x5a59('0x2f')][_0x5a59('0x30')]);_0x216578['query']=_[_0x5a59('0x35')](_0x470de6[_0x5a59('0x34')]);_0x216578[_0x5a59('0x3d')]=_['intersection'](_0x216578[_0x5a59('0x33')],_0x216578[_0x5a59('0x34')]);_0x121edf[_0x5a59('0x37')]=_[_0x5a59('0x36')](_0x216578['model'],qs[_0x5a59('0x38')](_0x470de6['query'][_0x5a59('0x38')]));_0x121edf['attributes']=_0x121edf[_0x5a59('0x37')]['length']?_0x121edf[_0x5a59('0x37')]:_0x216578[_0x5a59('0x33')];if(_0x470de6['query'][_0x5a59('0x43')]){_0x121edf[_0x5a59('0x44')]=[{'all':!![]}];}_0x121edf=_[_0x5a59('0x41')]({},_0x121edf,_0x470de6['options']);return db[_0x5a59('0x2f')][_0x5a59('0x47')](_0x121edf)['then'](handleEntityNotFound(_0x97d1b9,null))[_0x5a59('0x28')](respondWithResult(_0x97d1b9,null))[_0x5a59('0x48')](handleError(_0x97d1b9,null));};exports[_0x5a59('0x49')]=function(_0x2d6848,_0x1b6899){return db[_0x5a59('0x2f')][_0x5a59('0x49')](_0x2d6848[_0x5a59('0x4a')],{})['then'](respondWithResult(_0x1b6899,0xc9))['catch'](handleError(_0x1b6899,null));};exports[_0x5a59('0x27')]=function(_0x5bd251,_0xadf0d5){if(_0x5bd251[_0x5a59('0x4a')]['id']){delete _0x5bd251['body']['id'];}return db[_0x5a59('0x2f')][_0x5a59('0x47')]({'where':{'id':_0x5bd251[_0x5a59('0x46')]['id']}})['then'](handleEntityNotFound(_0xadf0d5,null))[_0x5a59('0x28')](saveUpdates(_0x5bd251[_0x5a59('0x4a')],null))[_0x5a59('0x28')](respondWithResult(_0xadf0d5,null))[_0x5a59('0x48')](handleError(_0xadf0d5,null));};exports['destroy']=function(_0x49b87b,_0x1b9521){return db['WhatsappTransferReport']['find']({'where':{'id':_0x49b87b[_0x5a59('0x46')]['id']}})[_0x5a59('0x28')](handleEntityNotFound(_0x1b9521,null))[_0x5a59('0x28')](removeEntity(_0x1b9521,null))[_0x5a59('0x48')](handleError(_0x1b9521,null));};exports[_0x5a59('0x4b')]=function(_0x4ce57f,_0xbe27ae){return db[_0x5a59('0x2f')]['describe']()[_0x5a59('0x28')](respondWithResult(_0xbe27ae,null))['catch'](handleError(_0xbe27ae,null));}; \ No newline at end of file +var _0x38e2=['path','to-csv','ejs','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','error','name','index','map','WhatsappTransferReport','rawAttributes','fieldName','type','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','rows','params','options','find','catch','create','body','describe','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','mustache'];(function(_0xe36ac8,_0x1a4924){var _0x4b36f1=function(_0x1cec49){while(--_0x1cec49){_0xe36ac8['push'](_0xe36ac8['shift']());}};_0x4b36f1(++_0x1a4924);}(_0x38e2,0x8b));var _0x238e=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x38e2[_0x122ef9];return _0x42fba0;};'use strict';var pdf=require(_0x238e('0x0'));var emlformat=require(_0x238e('0x1'));var rimraf=require(_0x238e('0x2'));var zipdir=require(_0x238e('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x238e('0x4'));var moment=require(_0x238e('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x238e('0x6'));var util=require('util');var path=require(_0x238e('0x7'));var sox=require('sox');var csv=require(_0x238e('0x8'));var ejs=require(_0x238e('0x9'));var fs=require('fs');var _=require('lodash');var squel=require(_0x238e('0xa'));var crypto=require(_0x238e('0xb'));var jsforce=require(_0x238e('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x238e('0xd'));var Papa=require(_0x238e('0xe'));var Redis=require(_0x238e('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x238e('0x10'));var as=require(_0x238e('0x11'));var hardwareService=require(_0x238e('0x12'));var logger=require(_0x238e('0x13'))(_0x238e('0x14'));var utils=require(_0x238e('0x15'));var config=require('../../config/environment');var db=require(_0x238e('0x16'))['db'];function respondWithStatusCode(_0x31524b,_0x411443){_0x411443=_0x411443||0xcc;return function(_0x5b6f18){if(_0x5b6f18){return _0x31524b[_0x238e('0x17')](_0x411443);}return _0x31524b[_0x238e('0x18')](_0x411443)[_0x238e('0x19')]();};}function respondWithResult(_0x571ff7,_0x2638b3){_0x2638b3=_0x2638b3||0xc8;return function(_0x2a2c67){if(_0x2a2c67){return _0x571ff7['status'](_0x2638b3)[_0x238e('0x1a')](_0x2a2c67);}};}function respondWithFilteredResult(_0x7b696c,_0x2f261a){return function(_0x11fd7d){if(_0x11fd7d){var _0x2858a1=_0x11fd7d[_0x238e('0x1b')],_0x11961d=_0x2f261a[_0x238e('0x1c')],_0x10666a=_0x2f261a[_0x238e('0x1c')]+_0x2f261a[_0x238e('0x1d')],_0x594a7c;if(_0x10666a>=_0x2858a1){_0x10666a=_0x2858a1;_0x594a7c=0xc8;}else{_0x594a7c=0xce;}_0x7b696c[_0x238e('0x18')](_0x594a7c);return _0x7b696c[_0x238e('0x1e')](_0x238e('0x1f'),_0x11961d+'-'+_0x10666a+'/'+_0x2858a1)[_0x238e('0x1a')](_0x11fd7d);}return null;};}function patchUpdates(_0x209d87){return function(_0x40cde4){try{jsonpatch[_0x238e('0x20')](_0x40cde4,_0x209d87,!![]);}catch(_0xaa3484){return BPromise[_0x238e('0x21')](_0xaa3484);}return _0x40cde4[_0x238e('0x22')]();};}function saveUpdates(_0x595241,_0xcc89d8){return function(_0x1a3f63){if(_0x1a3f63){return _0x1a3f63[_0x238e('0x23')](_0x595241)[_0x238e('0x24')](function(_0x213452){return _0x213452;});}return null;};}function removeEntity(_0x4ed2d6,_0x5f4ebf){return function(_0x30b0e1){if(_0x30b0e1){return _0x30b0e1[_0x238e('0x25')]()[_0x238e('0x24')](function(){_0x4ed2d6[_0x238e('0x18')](0xcc)[_0x238e('0x19')]();});}};}function handleEntityNotFound(_0x17dc4c,_0x4d5fdc){return function(_0x4807ed){if(!_0x4807ed){_0x17dc4c['sendStatus'](0x194);}return _0x4807ed;};}function handleError(_0x421c37,_0x1d72ee){_0x1d72ee=_0x1d72ee||0x1f4;return function(_0x22b283){logger[_0x238e('0x26')](_0x22b283['stack']);if(_0x22b283[_0x238e('0x27')]){delete _0x22b283[_0x238e('0x27')];}_0x421c37[_0x238e('0x18')](_0x1d72ee)['send'](_0x22b283);};}exports[_0x238e('0x28')]=function(_0x5a99c5,_0x5ef3e5){var _0x5efb14={},_0x4d8ea1={},_0x40dc70={'count':0x0,'rows':[]};var _0x153558=_[_0x238e('0x29')](db[_0x238e('0x2a')][_0x238e('0x2b')],function(_0x3a0040){return{'name':_0x3a0040[_0x238e('0x2c')],'type':_0x3a0040[_0x238e('0x2d')]['key']};});_0x4d8ea1[_0x238e('0x2e')]=_[_0x238e('0x29')](_0x153558,_0x238e('0x27'));_0x4d8ea1[_0x238e('0x2f')]=_[_0x238e('0x30')](_0x5a99c5[_0x238e('0x2f')]);_0x4d8ea1[_0x238e('0x31')]=_[_0x238e('0x32')](_0x4d8ea1['model'],_0x4d8ea1[_0x238e('0x2f')]);_0x5efb14['attributes']=_['intersection'](_0x4d8ea1[_0x238e('0x2e')],qs[_0x238e('0x33')](_0x5a99c5['query'][_0x238e('0x33')]));_0x5efb14[_0x238e('0x34')]=_0x5efb14[_0x238e('0x34')][_0x238e('0x35')]?_0x5efb14[_0x238e('0x34')]:_0x4d8ea1[_0x238e('0x2e')];if(!_0x5a99c5['query'][_0x238e('0x36')](_0x238e('0x37'))){_0x5efb14[_0x238e('0x1d')]=qs[_0x238e('0x1d')](_0x5a99c5[_0x238e('0x2f')][_0x238e('0x1d')]);_0x5efb14['offset']=qs[_0x238e('0x1c')](_0x5a99c5[_0x238e('0x2f')]['offset']);}_0x5efb14[_0x238e('0x38')]=qs[_0x238e('0x39')](_0x5a99c5[_0x238e('0x2f')]['sort']);_0x5efb14[_0x238e('0x3a')]=qs[_0x238e('0x31')](_[_0x238e('0x3b')](_0x5a99c5[_0x238e('0x2f')],_0x4d8ea1[_0x238e('0x31')]),_0x153558);if(_0x5a99c5['query'][_0x238e('0x3c')]){_0x5efb14['where']=_[_0x238e('0x3d')](_0x5efb14[_0x238e('0x3a')],{'$or':_['map'](_0x153558,function(_0x58cd33){if(_0x58cd33[_0x238e('0x2d')]!==_0x238e('0x3e')){var _0x2333e9={};_0x2333e9[_0x58cd33[_0x238e('0x27')]]={'$like':'%'+_0x5a99c5[_0x238e('0x2f')][_0x238e('0x3c')]+'%'};return _0x2333e9;}})});}_0x5efb14=_[_0x238e('0x3d')]({},_0x5efb14,_0x5a99c5['options']);var _0x40ecaa={'where':_0x5efb14['where']};return db['WhatsappTransferReport'][_0x238e('0x1b')](_0x40ecaa)[_0x238e('0x24')](function(_0x34c981){_0x40dc70[_0x238e('0x1b')]=_0x34c981;if(_0x5a99c5[_0x238e('0x2f')][_0x238e('0x3f')]){_0x5efb14[_0x238e('0x40')]=[{'all':!![]}];}return db['WhatsappTransferReport']['findAll'](_0x5efb14);})['then'](function(_0x319e82){_0x40dc70[_0x238e('0x41')]=_0x319e82;return _0x40dc70;})[_0x238e('0x24')](respondWithFilteredResult(_0x5ef3e5,_0x5efb14))['catch'](handleError(_0x5ef3e5,null));};exports['show']=function(_0x12090f,_0x41b1a5){var _0x320a61={'raw':!![],'where':{'id':_0x12090f[_0x238e('0x42')]['id']}},_0x10307a={};_0x10307a[_0x238e('0x2e')]=_[_0x238e('0x30')](db[_0x238e('0x2a')][_0x238e('0x2b')]);_0x10307a[_0x238e('0x2f')]=_[_0x238e('0x30')](_0x12090f['query']);_0x10307a[_0x238e('0x31')]=_['intersection'](_0x10307a[_0x238e('0x2e')],_0x10307a[_0x238e('0x2f')]);_0x320a61[_0x238e('0x34')]=_[_0x238e('0x32')](_0x10307a[_0x238e('0x2e')],qs[_0x238e('0x33')](_0x12090f[_0x238e('0x2f')][_0x238e('0x33')]));_0x320a61[_0x238e('0x34')]=_0x320a61['attributes']['length']?_0x320a61[_0x238e('0x34')]:_0x10307a[_0x238e('0x2e')];if(_0x12090f[_0x238e('0x2f')]['includeAll']){_0x320a61[_0x238e('0x40')]=[{'all':!![]}];}_0x320a61=_['merge']({},_0x320a61,_0x12090f[_0x238e('0x43')]);return db[_0x238e('0x2a')][_0x238e('0x44')](_0x320a61)['then'](handleEntityNotFound(_0x41b1a5,null))[_0x238e('0x24')](respondWithResult(_0x41b1a5,null))[_0x238e('0x45')](handleError(_0x41b1a5,null));};exports['create']=function(_0x52a665,_0x1ad352){return db['WhatsappTransferReport'][_0x238e('0x46')](_0x52a665['body'],{})[_0x238e('0x24')](respondWithResult(_0x1ad352,0xc9))[_0x238e('0x45')](handleError(_0x1ad352,null));};exports[_0x238e('0x23')]=function(_0x3977c6,_0x16d356){if(_0x3977c6[_0x238e('0x47')]['id']){delete _0x3977c6[_0x238e('0x47')]['id'];}return db[_0x238e('0x2a')][_0x238e('0x44')]({'where':{'id':_0x3977c6[_0x238e('0x42')]['id']}})[_0x238e('0x24')](handleEntityNotFound(_0x16d356,null))[_0x238e('0x24')](saveUpdates(_0x3977c6[_0x238e('0x47')],null))[_0x238e('0x24')](respondWithResult(_0x16d356,null))[_0x238e('0x45')](handleError(_0x16d356,null));};exports[_0x238e('0x25')]=function(_0x25c865,_0x2efc09){return db[_0x238e('0x2a')][_0x238e('0x44')]({'where':{'id':_0x25c865[_0x238e('0x42')]['id']}})[_0x238e('0x24')](handleEntityNotFound(_0x2efc09,null))[_0x238e('0x24')](removeEntity(_0x2efc09,null))[_0x238e('0x45')](handleError(_0x2efc09,null));};exports[_0x238e('0x48')]=function(_0x22dba3,_0x53ae8a){return db[_0x238e('0x2a')][_0x238e('0x48')]()['then'](respondWithResult(_0x53ae8a,null))[_0x238e('0x45')](handleError(_0x53ae8a,null));}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.model.js b/server/api/whatsappTransferReport/whatsappTransferReport.model.js index 397c15d..4b119d5 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 _0x18db=['request-promise','path','../../config/environment','./whatsappTransferReport.attributes','exports','WhatsappTransferReport','report_whatsapp_transfer','uniqueid','lodash','util','../../config/logger','moment','bluebird'];(function(_0x3b6888,_0x29ad85){var _0xbda3fd=function(_0x2cc245){while(--_0x2cc245){_0x3b6888['push'](_0x3b6888['shift']());}};_0xbda3fd(++_0x29ad85);}(_0x18db,0xd8));var _0xb18d=function(_0x16535d,_0xe13222){_0x16535d=_0x16535d-0x0;var _0x4a0239=_0x18db[_0x16535d];return _0x4a0239;};'use strict';var _=require(_0xb18d('0x0'));var util=require(_0xb18d('0x1'));var logger=require(_0xb18d('0x2'))('api');var moment=require(_0xb18d('0x3'));var BPromise=require(_0xb18d('0x4'));var rp=require(_0xb18d('0x5'));var fs=require('fs');var path=require(_0xb18d('0x6'));var rimraf=require('rimraf');var config=require(_0xb18d('0x7'));var attributes=require(_0xb18d('0x8'));module[_0xb18d('0x9')]=function(_0x3865f8,_0x4c921c){return _0x3865f8['define'](_0xb18d('0xa'),attributes,{'tableName':_0xb18d('0xb'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0xb18d('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x30cc=['WhatsappTransferReport','report_whatsapp_transfer','uniqueid','util','api','moment','request-promise','path','rimraf','./whatsappTransferReport.attributes','exports','define'];(function(_0x59a3c5,_0x29f03a){var _0x3c5cdf=function(_0x56d55b){while(--_0x56d55b){_0x59a3c5['push'](_0x59a3c5['shift']());}};_0x3c5cdf(++_0x29f03a);}(_0x30cc,0x1e3));var _0xc30c=function(_0x1a89a1,_0x56d889){_0x1a89a1=_0x1a89a1-0x0;var _0x3d5b46=_0x30cc[_0x1a89a1];return _0x3d5b46;};'use strict';var _=require('lodash');var util=require(_0xc30c('0x0'));var logger=require('../../config/logger')(_0xc30c('0x1'));var moment=require(_0xc30c('0x2'));var BPromise=require('bluebird');var rp=require(_0xc30c('0x3'));var fs=require('fs');var path=require(_0xc30c('0x4'));var rimraf=require(_0xc30c('0x5'));var config=require('../../config/environment');var attributes=require(_0xc30c('0x6'));module[_0xc30c('0x7')]=function(_0x1413b6,_0x18f0c9){return _0x1413b6[_0xc30c('0x8')](_0xc30c('0x9'),attributes,{'tableName':_0xc30c('0xa'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0xc30c('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 b352341..23cf3e7 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(_0x17961e,_0x543fcf){var _0x101136=function(_0x4d5660){while(--_0x4d5660){_0x17961e['push'](_0x17961e['shift']());}};_0x101136(++_0x543fcf);}(_0xa9e0,0x123));var _0x0a9e=function(_0x47b58b,_0x41a189){_0x47b58b=_0x47b58b-0x0;var _0x46bebe=_0xa9e0[_0x47b58b];return _0x46bebe;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var 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(_0x74c5e9,_0x4c8709){var _0x5711f1=function(_0x32b82a){while(--_0x32b82a){_0x74c5e9['push'](_0x74c5e9['shift']());}};_0x5711f1(++_0x4c8709);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1da04e,_0x31024b){_0x1da04e=_0x1da04e-0x0;var _0xdd8c41=_0xa9e0[_0x1da04e];return _0xdd8c41;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a9e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var config=require(_0x0a9e('0x7'));var jayson=require(_0x0a9e('0x8'));var client=jayson['client'][_0x0a9e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x441e3a,_0x2cc193,_0x5f41ea){return new BPromise(function(_0x503809,_0xe42b77){return client['request'](_0x441e3a,_0x5f41ea)['then'](function(_0x39753a){logger[_0x0a9e('0xa')](_0x0a9e('0xb'),_0x2cc193,_0x0a9e('0xc'));logger[_0x0a9e('0xd')](_0x0a9e('0xe'),_0x2cc193,'request\x20sent',JSON['stringify'](_0x39753a));if(_0x39753a['error']){if(_0x39753a['error'][_0x0a9e('0xf')]===0x1f4){logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0xe42b77(_0x39753a[_0x0a9e('0x10')]['message']);}logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0x503809(_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);}else{logger['info'](_0x0a9e('0xb'),_0x2cc193,'request\x20sent');_0x503809(_0x39753a[_0x0a9e('0x12')]['message']);}})[_0x0a9e('0x13')](function(_0x12066b){logger['error'](_0x0a9e('0xb'),_0x2cc193,_0x12066b);_0xe42b77(_0x12066b);});});} \ No newline at end of file diff --git a/server/app.js b/server/app.js index d41fa3d..acd3bd8 100644 --- a/server/app.js +++ b/server/app.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x38f9=['name','Offline\x20apps:','status','join','None','seedDB','default','./config/license','error','Server\x20failed\x20to\x20start\x20due\x20to\x20error:\x20%s','exit','./mysqldb','./rpc','./config/environment','./config/logger','app','./config/pm2/config','./config/schedule','./config/schedule/chat','./config/schedule/transcribe','sync','then','listen','info','start','Online\x20apps:','map','filter','online'];(function(_0x2598a2,_0x282a18){var _0x21a10f=function(_0x23a906){while(--_0x23a906){_0x2598a2['push'](_0x2598a2['shift']());}};_0x21a10f(++_0x282a18);}(_0x38f9,0x14a));var _0x938f=function(_0x2c91e9,_0x2fb965){_0x2c91e9=_0x2c91e9-0x0;var _0x13f0ff=_0x38f9[_0x2c91e9];return _0x13f0ff;};'use strict';var _=require('lodash');var mysqldb=require(_0x938f('0x0'));var rpc=require(_0x938f('0x1'));var config=require(_0x938f('0x2'));var logger=require(_0x938f('0x3'))(_0x938f('0x4'));var pm2=require('./config/pm2');var pm2Config=require(_0x938f('0x5'));var schedule=require(_0x938f('0x6'));var chat=require(_0x938f('0x7'));var transcribe=require(_0x938f('0x8'));function main(){return mysqldb['db']['sequelize'][_0x938f('0x9')]()[_0x938f('0xa')](function(){return rpc[_0x938f('0xb')]();})[_0x938f('0xa')](function(_0x19a5d0){logger[_0x938f('0xc')](_0x19a5d0);return chat[_0x938f('0xd')]();})['then'](function(){return schedule[_0x938f('0xd')]();})[_0x938f('0xa')](function(){return transcribe[_0x938f('0xd')]();})['then'](function(_0x436496){logger[_0x938f('0xc')](_0x436496);return pm2[_0x938f('0xd')](pm2Config);})[_0x938f('0xa')](function(_0x102efd){logger['info'](_0x938f('0xe'),_[_0x938f('0xf')](_[_0x938f('0x10')](_0x102efd,{'status':_0x938f('0x11')}),_0x938f('0x12'))['join']());logger[_0x938f('0xc')](_0x938f('0x13'),_[_0x938f('0xf')](_[_0x938f('0x10')](_0x102efd,function(_0x1dd5a0){return _0x1dd5a0[_0x938f('0x14')]!==_0x938f('0x11');}),'name')[_0x938f('0x15')]()||_0x938f('0x16'));config[_0x938f('0x17')]&&require('./config/seedDB')[_0x938f('0x18')]();require(_0x938f('0x19'))[_0x938f('0x18')]();})['catch'](function(_0x229aca){logger[_0x938f('0x1a')](_0x938f('0x1b'),_0x229aca);process[_0x938f('0x1c')](0x1);});}main(); \ No newline at end of file +var _0xcc28=['map','filter','online','name','Offline\x20apps:','status','join','None','seedDB','default','./config/license','catch','error','Server\x20failed\x20to\x20start\x20due\x20to\x20error:\x20%s','lodash','./mysqldb','./rpc','./config/environment','./config/logger','app','./config/pm2','./config/pm2/config','./config/schedule','./config/schedule/chat','sequelize','then','listen','start','info','Online\x20apps:'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xcc28,0xc2));var _0x8cc2=function(_0x34abb8,_0x3adab3){_0x34abb8=_0x34abb8-0x0;var _0x5b5344=_0xcc28[_0x34abb8];return _0x5b5344;};'use strict';var _=require(_0x8cc2('0x0'));var mysqldb=require(_0x8cc2('0x1'));var rpc=require(_0x8cc2('0x2'));var config=require(_0x8cc2('0x3'));var logger=require(_0x8cc2('0x4'))(_0x8cc2('0x5'));var pm2=require(_0x8cc2('0x6'));var pm2Config=require(_0x8cc2('0x7'));var schedule=require(_0x8cc2('0x8'));var chat=require(_0x8cc2('0x9'));var transcribe=require('./config/schedule/transcribe');function main(){return mysqldb['db'][_0x8cc2('0xa')]['sync']()[_0x8cc2('0xb')](function(){return rpc[_0x8cc2('0xc')]();})[_0x8cc2('0xb')](function(_0x2d1941){logger['info'](_0x2d1941);return chat[_0x8cc2('0xd')]();})[_0x8cc2('0xb')](function(){return schedule[_0x8cc2('0xd')]();})['then'](function(){return transcribe[_0x8cc2('0xd')]();})[_0x8cc2('0xb')](function(_0x441ae5){logger[_0x8cc2('0xe')](_0x441ae5);return pm2['start'](pm2Config);})[_0x8cc2('0xb')](function(_0x4cd172){logger[_0x8cc2('0xe')](_0x8cc2('0xf'),_[_0x8cc2('0x10')](_[_0x8cc2('0x11')](_0x4cd172,{'status':_0x8cc2('0x12')}),_0x8cc2('0x13'))['join']());logger[_0x8cc2('0xe')](_0x8cc2('0x14'),_['map'](_[_0x8cc2('0x11')](_0x4cd172,function(_0x224786){return _0x224786[_0x8cc2('0x15')]!==_0x8cc2('0x12');}),_0x8cc2('0x13'))[_0x8cc2('0x16')]()||_0x8cc2('0x17'));config[_0x8cc2('0x18')]&&require('./config/seedDB')[_0x8cc2('0x19')]();require(_0x8cc2('0x1a'))['default']();})[_0x8cc2('0x1b')](function(_0x255992){logger[_0x8cc2('0x1c')](_0x8cc2('0x1d'),_0x255992);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 e45d427..609ee17 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 _0x6609=['params','disposition','then','closed','status','json','Unmanaged.','catch','headers','authorization','startsWith','find','authenticate','Wrong\x20credentials.','user','Bearer','Unknown\x20authorization\x20format','apikey','getUuid','query','sub','isEqual','apiKeyNonce','Invalid\x20API\x20access\x20key','User','User\x20not\x20found.','canUpdate','../../config/license/util','getLicense','update','Forbidden','isMiddleware','signToken','setTokenCookie','cookie','motion.token','redirect','/dashboards/general','send','retrieveApiKey','isNil','apiKeyIat','regenerateApiKey','Please\x20use\x20the\x20previous\x20API\x20access\x20key\x20to\x20generate\x20a\x20new\x20one','sign','secret','payload','verify','randomBytes','toString','hex','now','HS512','../../mysqldb','../../config/environment','../../config/license/hardware','lodash','jsonwebtoken','express-jwt','composable-middleware','basic-auth','crypto','bluebird','secrets','session','role','fullname','name','permissions','voicePause','chatPause','mailPause','faxPause','pauseType','lastLoginAt','lastPauseAt','crudPermissions','alias','phoneBarAutoAnswer','phoneBarAutoAnswerDelay','phoneBarDnd','phoneBarEnableDtmfTone','phoneBarEnableSettings','phoneBarExpires','phoneBarPrefixRequired','phoneBarRemoteControl','phoneBarRemoteControlPort','hotdesk','interface','userProfileId','isChatInteractionAuthorized','isAuthenticated','use','ChatInteraction','findOne'];(function(_0x5c0389,_0xc9f662){var _0xdc2e9e=function(_0x54766b){while(--_0x54766b){_0x5c0389['push'](_0x5c0389['shift']());}};_0xdc2e9e(++_0xc9f662);}(_0x6609,0xf3));var _0x9660=function(_0x540c8e,_0x441ea6){_0x540c8e=_0x540c8e-0x0;var _0x573f84=_0x6609[_0x540c8e];return _0x573f84;};'use strict';var db=require(_0x9660('0x0'))['db'];var config=require(_0x9660('0x1'));var hardwareConf=require(_0x9660('0x2'));var _=require(_0x9660('0x3'));var jwt=require(_0x9660('0x4'));var expressJwt=require(_0x9660('0x5'));var compose=require(_0x9660('0x6'));var basicAuth=require(_0x9660('0x7'));var crypto=require(_0x9660('0x8'));var BPromise=require(_0x9660('0x9'));var validateJwt=expressJwt({'secret':config[_0x9660('0xa')][_0x9660('0xb')]});var userAttributes=['id',_0x9660('0xc'),_0x9660('0xd'),_0x9660('0xe'),'internal','email','userpic',_0x9660('0xf'),'md5secret',_0x9660('0x10'),_0x9660('0x11'),_0x9660('0x12'),_0x9660('0x13'),'smsPause','openchannelPause',_0x9660('0x14'),'showWebBar',_0x9660('0x15'),_0x9660('0x16'),_0x9660('0x17'),'allowmessenger','passwordResetAt',_0x9660('0x18'),_0x9660('0x19'),_0x9660('0x1a'),_0x9660('0x1b'),'phoneBarEnableRecording',_0x9660('0x1c'),_0x9660('0x1d'),_0x9660('0x1e'),_0x9660('0x1f'),_0x9660('0x20'),_0x9660('0x21'),_0x9660('0x22'),_0x9660('0x23'),_0x9660('0x24')];exports[_0x9660('0x25')]=function(){return this[_0x9660('0x26')](!![])[_0x9660('0x27')](function(_0x31612d,_0xc3cb29,_0x190fbd){if(_0x31612d['user']){_0x190fbd();}else{return db[_0x9660('0x28')][_0x9660('0x29')]({'where':{'id':_0x31612d[_0x9660('0x2a')]['id']},'attributes':['id','closed',_0x9660('0x2b')],'raw':!![]})[_0x9660('0x2c')](function(_0x3f7b02){if(_0x3f7b02&&_0x3f7b02[_0x9660('0x2d')]){return _0xc3cb29[_0x9660('0x2e')](_0x3f7b02[_0x9660('0x2b')]==='unmanaged'?0x195:0x193)[_0x9660('0x2f')]({'message':_0x3f7b02['disposition']==='unmanaged'?_0x9660('0x30'):'Forbidden.'});}else{_0x190fbd();}})[_0x9660('0x31')](function(_0xc60b2a){_0x190fbd(_0xc60b2a);});}});};exports[_0x9660('0x26')]=function isAuthenticated(_0x26685c){return compose()[_0x9660('0x27')](function(_0x35f66d,_0xbbb938,_0x4b72ee){if(_0x35f66d[_0x9660('0x32')][_0x9660('0x33')]){if(_[_0x9660('0x34')](_0x35f66d[_0x9660('0x32')][_0x9660('0x33')],'Basic')){var _0x80ce74=basicAuth(_0x35f66d);db['User'][_0x9660('0x35')]({'where':{'name':_0x80ce74[_0x9660('0xe')]}})['then'](function(_0x439c59){if(!_0x439c59||!_0x439c59[_0x9660('0x36')](_0x80ce74['pass'])){return _0xbbb938[_0x9660('0x2e')](0x191)[_0x9660('0x2f')]({'message':_0x9660('0x37')});}_0x35f66d[_0x9660('0x38')]={'id':_0x439c59['id']};_0x4b72ee();})[_0x9660('0x31')](function(_0x23beaf){_0x4b72ee(_0x23beaf);});}else if(_[_0x9660('0x34')](_0x35f66d[_0x9660('0x32')][_0x9660('0x33')],_0x9660('0x39'))){validateJwt(_0x35f66d,_0xbbb938,_0x4b72ee);}else{if(_0x26685c){_0x4b72ee();}else{return _0xbbb938['status'](0x193)[_0x9660('0x2f')]({'message':_0x9660('0x3a')});}}}else if(_0x35f66d['query'][_0x9660('0x3b')]){try{var _0x3290a7={'audience':hardwareConf[_0x9660('0x3c')](),'issuer':hardwareConf[_0x9660('0x3c')]()};verifyJwt(_0x35f66d[_0x9660('0x3d')][_0x9660('0x3b')],_0x3290a7)[_0x9660('0x2c')](function(_0x13e3ed){return db['User'][_0x9660('0x35')]({'where':{'id':_0x13e3ed[_0x9660('0x3e')]}})['then'](function(_0xc08e97){if(!_0xc08e97||!_[_0x9660('0x3f')](_0xc08e97[_0x9660('0x40')],_0x13e3ed['nonce'])){return _0xbbb938[_0x9660('0x2e')](0x191)[_0x9660('0x2f')]({'message':'API\x20access\x20key\x20is\x20not\x20valid\x20anymore'});}_0x35f66d[_0x9660('0x38')]={'id':_0xc08e97['id']};_0x4b72ee();});})[_0x9660('0x31')](function(){return _0xbbb938[_0x9660('0x2e')](0x191)[_0x9660('0x2f')]({'message':_0x9660('0x41')});});}catch(_0x324ea2){_0x4b72ee(_0x324ea2);}}else if(_0x26685c){_0x4b72ee();}else{return _0xbbb938[_0x9660('0x2e')](0x193)['json']({'message':_0x9660('0x3a')});}})[_0x9660('0x27')](function(_0x1ee2a0,_0x23627e,_0x454bdb){if(_0x1ee2a0['user']){db[_0x9660('0x42')][_0x9660('0x35')]({'where':{'id':_0x1ee2a0[_0x9660('0x38')]['id']},'attributes':userAttributes})['then'](function(_0x25d644){if(!_0x25d644){return _0x23627e['status'](0x194)['json']({'message':_0x9660('0x43')});}_0x1ee2a0[_0x9660('0x38')]=_0x25d644;_0x454bdb();})[_0x9660('0x31')](function(_0x550103){_0x454bdb(_0x550103);});}else if(_0x26685c){_0x454bdb();}else{return _0x23627e[_0x9660('0x2e')](0x194)[_0x9660('0x2f')]({'message':'User\x20object\x20not\x20found.'});}});};exports[_0x9660('0x44')]=function canUpdate(){return compose()[_0x9660('0x27')](function(_0x241fb2,_0x196018,_0xad5707){return require(_0x9660('0x45'))[_0x9660('0x46')]()[_0x9660('0x2c')](function(_0x266ee7){if(_0x266ee7[_0x9660('0x47')]){_0xad5707();}else{return _0x196018[_0x9660('0x2e')](0x193)[_0x9660('0x2f')]({'message':_0x9660('0x48')});}})[_0x9660('0x31')](function(_0x307ce4){_0xad5707(_0x307ce4);});});};exports[_0x9660('0x49')]=function(_0x5d2737,_0x131964,_0x2a4e96){_0x5d2737[_0x9660('0x49')]=!![];return _0x2a4e96();};exports[_0x9660('0x4a')]=function signToken(_0x31e405){return signJwt(_0x31e405);};exports[_0x9660('0x4b')]=function(_0x210cf9,_0x4b6ebd){if(!_0x210cf9[_0x9660('0x38')]){return _0x4b6ebd['status'](0x194)['json']({'message':'It\x20looks\x20like\x20you\x20aren\x27t\x20logged\x20in,\x20please\x20try\x20again.'});}var _0x401758={'payload':{'id':_0x210cf9[_0x9660('0x38')]['id'],'role':_0x210cf9[_0x9660('0x38')][_0x9660('0xc')]},'options':{'expiresIn':0x15180}};return signJwt(_0x401758)[_0x9660('0x2c')](function(_0x27e7b8){_0x4b6ebd[_0x9660('0x4c')](_0x9660('0x4d'),_0x27e7b8);_0x4b6ebd[_0x9660('0x4e')](_0x9660('0x4f'));})['catch'](function(_0x567c15){return _0x4b6ebd[_0x9660('0x2e')](0x1f4)[_0x9660('0x50')](_0x567c15);});};exports[_0x9660('0x51')]=function(_0xb1e45e){if(_[_0x9660('0x52')](_0xb1e45e[_0x9660('0x40')])||_['isNil'](_0xb1e45e[_0x9660('0x53')])){return null;}else{return createJwt(_0xb1e45e);}};exports['generateApiKey']=function(_0x58e8cb){_0x58e8cb[_0x9660('0x40')]=generateNonce();_0x58e8cb[_0x9660('0x53')]=generateIssuedAt();return createJwt(_0x58e8cb);};exports[_0x9660('0x54')]=function(_0x14604b,_0x286c4d){var _0x30a686=_0x14604b[_0x9660('0x3d')][_0x9660('0x3b')];if(_0x30a686){var _0x4b044e={'nonce':_0x286c4d['apiKeyNonce'],'iat':_0x286c4d[_0x9660('0x53')],'audience':hardwareConf[_0x9660('0x3c')](),'issuer':hardwareConf[_0x9660('0x3c')]()};return verifyJwt(_0x30a686,_0x4b044e)['then'](function(){return generateApiKey(_0x286c4d);});}else{throw{'message':_0x9660('0x55')};}};function signJwt(_0x2aa7fc){var _0x1d1212=BPromise['promisify'](jwt[_0x9660('0x56')],{'context':jwt});var _0x16a745=_0x2aa7fc[_0x9660('0x57')]||config['secrets'][_0x9660('0xb')];return new BPromise(function(_0xd8c9b0,_0x129583){_0x1d1212(_0x2aa7fc[_0x9660('0x58')],_0x16a745,_0x2aa7fc['options'])[_0x9660('0x2c')](function(_0xa222c7){_0xd8c9b0(_0xa222c7);})[_0x9660('0x31')](function(_0x248d4a){_0x129583(_0x248d4a);});});}function verifyJwt(_0x25d1ac,_0x48852c,_0xa3e658){var _0x459809=BPromise['promisify'](jwt[_0x9660('0x59')],{'context':jwt});var _0x24fc2c=_0xa3e658||config[_0x9660('0xa')][_0x9660('0xb')];return new BPromise(function(_0x1d2b4a,_0x5bf5b4){_0x459809(_0x25d1ac,_0x24fc2c,_0x48852c)[_0x9660('0x2c')](function(_0x380887){_0x1d2b4a(_0x380887);})[_0x9660('0x31')](function(_0x7c32f5){_0x5bf5b4(_0x7c32f5);});});}function generateNonce(){return crypto[_0x9660('0x5a')](0x10)[_0x9660('0x5b')](_0x9660('0x5c'));}function generateIssuedAt(){return Math['floor'](Date[_0x9660('0x5d')]()/0x3e8)[_0x9660('0x5b')]();}function createJwt(_0x2f17b3){var _0x358451={'payload':{'iat':_0x2f17b3[_0x9660('0x53')],'nonce':_0x2f17b3['apiKeyNonce']},'options':{'algorithm':_0x9660('0x5e'),'subject':_0x2f17b3['id']['toString'](),'issuer':hardwareConf[_0x9660('0x3c')](),'audience':hardwareConf[_0x9660('0x3c')]()}};return signJwt(_0x358451)[_0x9660('0x2c')](function(_0xd7ce48){return{'iat':_0x2f17b3['apiKeyIat'],'nonce':_0x2f17b3['apiKeyNonce'],'token':_0xd7ce48};});} \ No newline at end of file +var _0x240e=['now','HS512','../../mysqldb','../../config/environment','../../config/license/hardware','jsonwebtoken','express-jwt','composable-middleware','crypto','bluebird','secrets','session','role','name','permissions','md5secret','voicePause','smsPause','pauseType','showWebBar','lastLoginAt','lastPauseAt','crudPermissions','allowmessenger','passwordResetAt','alias','phoneBarAutoAnswer','phoneBarAutoAnswerDelay','phoneBarDnd','phoneBarEnableRecording','phoneBarEnableDtmfTone','phoneBarEnableSettings','phoneBarExpires','phoneBarPrefixRequired','phoneBarRemoteControlPort','hotdesk','interface','userProfileId','isChatInteractionAuthorized','isAuthenticated','use','ChatInteraction','findOne','params','closed','then','disposition','unmanaged','Unmanaged.','Forbidden.','catch','headers','startsWith','authorization','Basic','User','pass','status','json','user','Unknown\x20authorization\x20format','apikey','getUuid','query','find','sub','isEqual','apiKeyNonce','nonce','API\x20access\x20key\x20is\x20not\x20valid\x20anymore','Invalid\x20API\x20access\x20key','User\x20not\x20found.','User\x20object\x20not\x20found.','canUpdate','../../config/license/util','update','Forbidden','isMiddleware','signToken','setTokenCookie','cookie','redirect','/dashboards/general','send','isNil','generateApiKey','apiKeyIat','regenerateApiKey','promisify','sign','verify','randomBytes','toString','hex','floor'];(function(_0x87485,_0x2c760b){var _0x30b0b9=function(_0xdfb934){while(--_0xdfb934){_0x87485['push'](_0x87485['shift']());}};_0x30b0b9(++_0x2c760b);}(_0x240e,0x1dd));var _0xe240=function(_0x43d11d,_0xccff91){_0x43d11d=_0x43d11d-0x0;var _0x38cd08=_0x240e[_0x43d11d];return _0x38cd08;};'use strict';var db=require(_0xe240('0x0'))['db'];var config=require(_0xe240('0x1'));var hardwareConf=require(_0xe240('0x2'));var _=require('lodash');var jwt=require(_0xe240('0x3'));var expressJwt=require(_0xe240('0x4'));var compose=require(_0xe240('0x5'));var basicAuth=require('basic-auth');var crypto=require(_0xe240('0x6'));var BPromise=require(_0xe240('0x7'));var validateJwt=expressJwt({'secret':config[_0xe240('0x8')][_0xe240('0x9')]});var userAttributes=['id',_0xe240('0xa'),'fullname',_0xe240('0xb'),'internal','email','userpic',_0xe240('0xc'),_0xe240('0xd'),_0xe240('0xe'),'chatPause','mailPause','faxPause',_0xe240('0xf'),'openchannelPause',_0xe240('0x10'),_0xe240('0x11'),_0xe240('0x12'),_0xe240('0x13'),_0xe240('0x14'),_0xe240('0x15'),_0xe240('0x16'),_0xe240('0x17'),_0xe240('0x18'),_0xe240('0x19'),_0xe240('0x1a'),_0xe240('0x1b'),_0xe240('0x1c'),_0xe240('0x1d'),_0xe240('0x1e'),_0xe240('0x1f'),'phoneBarRemoteControl',_0xe240('0x20'),_0xe240('0x21'),_0xe240('0x22'),_0xe240('0x23')];exports[_0xe240('0x24')]=function(){return this[_0xe240('0x25')](!![])[_0xe240('0x26')](function(_0x55c591,_0x5c919c,_0x24dd1f){if(_0x55c591['user']){_0x24dd1f();}else{return db[_0xe240('0x27')][_0xe240('0x28')]({'where':{'id':_0x55c591[_0xe240('0x29')]['id']},'attributes':['id',_0xe240('0x2a'),'disposition'],'raw':!![]})[_0xe240('0x2b')](function(_0x2a5cde){if(_0x2a5cde&&_0x2a5cde['closed']){return _0x5c919c['status'](_0x2a5cde[_0xe240('0x2c')]===_0xe240('0x2d')?0x195:0x193)['json']({'message':_0x2a5cde[_0xe240('0x2c')]===_0xe240('0x2d')?_0xe240('0x2e'):_0xe240('0x2f')});}else{_0x24dd1f();}})[_0xe240('0x30')](function(_0x42b39a){_0x24dd1f(_0x42b39a);});}});};exports[_0xe240('0x25')]=function isAuthenticated(_0x32951f){return compose()['use'](function(_0x8dba93,_0x26aca7,_0x3121e4){if(_0x8dba93[_0xe240('0x31')]['authorization']){if(_[_0xe240('0x32')](_0x8dba93[_0xe240('0x31')][_0xe240('0x33')],_0xe240('0x34'))){var _0x3445ed=basicAuth(_0x8dba93);db[_0xe240('0x35')]['find']({'where':{'name':_0x3445ed['name']}})[_0xe240('0x2b')](function(_0x1df8ae){if(!_0x1df8ae||!_0x1df8ae['authenticate'](_0x3445ed[_0xe240('0x36')])){return _0x26aca7[_0xe240('0x37')](0x191)[_0xe240('0x38')]({'message':'Wrong\x20credentials.'});}_0x8dba93[_0xe240('0x39')]={'id':_0x1df8ae['id']};_0x3121e4();})['catch'](function(_0x4e923b){_0x3121e4(_0x4e923b);});}else if(_['startsWith'](_0x8dba93[_0xe240('0x31')][_0xe240('0x33')],'Bearer')){validateJwt(_0x8dba93,_0x26aca7,_0x3121e4);}else{if(_0x32951f){_0x3121e4();}else{return _0x26aca7[_0xe240('0x37')](0x193)[_0xe240('0x38')]({'message':_0xe240('0x3a')});}}}else if(_0x8dba93['query'][_0xe240('0x3b')]){try{var _0x1e612b={'audience':hardwareConf[_0xe240('0x3c')](),'issuer':hardwareConf[_0xe240('0x3c')]()};verifyJwt(_0x8dba93[_0xe240('0x3d')][_0xe240('0x3b')],_0x1e612b)[_0xe240('0x2b')](function(_0x4d808d){return db[_0xe240('0x35')][_0xe240('0x3e')]({'where':{'id':_0x4d808d[_0xe240('0x3f')]}})[_0xe240('0x2b')](function(_0x373569){if(!_0x373569||!_[_0xe240('0x40')](_0x373569[_0xe240('0x41')],_0x4d808d[_0xe240('0x42')])){return _0x26aca7[_0xe240('0x37')](0x191)[_0xe240('0x38')]({'message':_0xe240('0x43')});}_0x8dba93[_0xe240('0x39')]={'id':_0x373569['id']};_0x3121e4();});})[_0xe240('0x30')](function(){return _0x26aca7['status'](0x191)[_0xe240('0x38')]({'message':_0xe240('0x44')});});}catch(_0x3cd0ac){_0x3121e4(_0x3cd0ac);}}else if(_0x32951f){_0x3121e4();}else{return _0x26aca7[_0xe240('0x37')](0x193)[_0xe240('0x38')]({'message':_0xe240('0x3a')});}})['use'](function(_0x2542c8,_0x43a239,_0x422b80){if(_0x2542c8[_0xe240('0x39')]){db[_0xe240('0x35')][_0xe240('0x3e')]({'where':{'id':_0x2542c8[_0xe240('0x39')]['id']},'attributes':userAttributes})[_0xe240('0x2b')](function(_0x166b91){if(!_0x166b91){return _0x43a239['status'](0x194)[_0xe240('0x38')]({'message':_0xe240('0x45')});}_0x2542c8[_0xe240('0x39')]=_0x166b91;_0x422b80();})[_0xe240('0x30')](function(_0x1eeedb){_0x422b80(_0x1eeedb);});}else if(_0x32951f){_0x422b80();}else{return _0x43a239[_0xe240('0x37')](0x194)[_0xe240('0x38')]({'message':_0xe240('0x46')});}});};exports[_0xe240('0x47')]=function canUpdate(){return compose()[_0xe240('0x26')](function(_0x2243e3,_0x55a181,_0x27bb5a){return require(_0xe240('0x48'))['getLicense']()[_0xe240('0x2b')](function(_0x14eb96){if(_0x14eb96[_0xe240('0x49')]){_0x27bb5a();}else{return _0x55a181[_0xe240('0x37')](0x193)[_0xe240('0x38')]({'message':_0xe240('0x4a')});}})['catch'](function(_0x1f9a29){_0x27bb5a(_0x1f9a29);});});};exports[_0xe240('0x4b')]=function(_0x1e26dc,_0x433b1d,_0x4ca12d){_0x1e26dc[_0xe240('0x4b')]=!![];return _0x4ca12d();};exports[_0xe240('0x4c')]=function signToken(_0x2db07a){return signJwt(_0x2db07a);};exports[_0xe240('0x4d')]=function(_0x3778da,_0x117934){if(!_0x3778da['user']){return _0x117934[_0xe240('0x37')](0x194)[_0xe240('0x38')]({'message':'It\x20looks\x20like\x20you\x20aren\x27t\x20logged\x20in,\x20please\x20try\x20again.'});}var _0x46c380={'payload':{'id':_0x3778da[_0xe240('0x39')]['id'],'role':_0x3778da[_0xe240('0x39')][_0xe240('0xa')]},'options':{'expiresIn':0x15180}};return signJwt(_0x46c380)['then'](function(_0x55437f){_0x117934[_0xe240('0x4e')]('motion.token',_0x55437f);_0x117934[_0xe240('0x4f')](_0xe240('0x50'));})['catch'](function(_0x1741e8){return _0x117934[_0xe240('0x37')](0x1f4)[_0xe240('0x51')](_0x1741e8);});};exports['retrieveApiKey']=function(_0x1345b8){if(_['isNil'](_0x1345b8[_0xe240('0x41')])||_[_0xe240('0x52')](_0x1345b8['apiKeyIat'])){return null;}else{return createJwt(_0x1345b8);}};exports[_0xe240('0x53')]=function(_0xbcfe98){_0xbcfe98[_0xe240('0x41')]=generateNonce();_0xbcfe98[_0xe240('0x54')]=generateIssuedAt();return createJwt(_0xbcfe98);};exports[_0xe240('0x55')]=function(_0x55cd24,_0x211b25){var _0x464957=_0x55cd24[_0xe240('0x3d')][_0xe240('0x3b')];if(_0x464957){var _0x2127cf={'nonce':_0x211b25[_0xe240('0x41')],'iat':_0x211b25[_0xe240('0x54')],'audience':hardwareConf[_0xe240('0x3c')](),'issuer':hardwareConf['getUuid']()};return verifyJwt(_0x464957,_0x2127cf)[_0xe240('0x2b')](function(){return generateApiKey(_0x211b25);});}else{throw{'message':'Please\x20use\x20the\x20previous\x20API\x20access\x20key\x20to\x20generate\x20a\x20new\x20one'};}};function signJwt(_0x322561){var _0x368aee=BPromise[_0xe240('0x56')](jwt[_0xe240('0x57')],{'context':jwt});var _0x5c0de3=_0x322561['secret']||config[_0xe240('0x8')]['session'];return new BPromise(function(_0xa19422,_0x3bfead){_0x368aee(_0x322561['payload'],_0x5c0de3,_0x322561['options'])['then'](function(_0x13df1e){_0xa19422(_0x13df1e);})[_0xe240('0x30')](function(_0x431a5a){_0x3bfead(_0x431a5a);});});}function verifyJwt(_0x22dde6,_0x478c35,_0x5e67dc){var _0x4f94e0=BPromise[_0xe240('0x56')](jwt[_0xe240('0x58')],{'context':jwt});var _0x1f3426=_0x5e67dc||config[_0xe240('0x8')][_0xe240('0x9')];return new BPromise(function(_0x3ccc46,_0x4acf73){_0x4f94e0(_0x22dde6,_0x1f3426,_0x478c35)[_0xe240('0x2b')](function(_0x144d44){_0x3ccc46(_0x144d44);})['catch'](function(_0x5ccad7){_0x4acf73(_0x5ccad7);});});}function generateNonce(){return crypto[_0xe240('0x59')](0x10)[_0xe240('0x5a')](_0xe240('0x5b'));}function generateIssuedAt(){return Math[_0xe240('0x5c')](Date[_0xe240('0x5d')]()/0x3e8)[_0xe240('0x5a')]();}function createJwt(_0x516949){var _0x443d0b={'payload':{'iat':_0x516949[_0xe240('0x54')],'nonce':_0x516949[_0xe240('0x41')]},'options':{'algorithm':_0xe240('0x5e'),'subject':_0x516949['id'][_0xe240('0x5a')](),'issuer':hardwareConf[_0xe240('0x3c')](),'audience':hardwareConf[_0xe240('0x3c')]()}};return signJwt(_0x443d0b)['then'](function(_0x331a4f){return{'iat':_0x516949[_0xe240('0x54')],'nonce':_0x516949[_0xe240('0x41')],'token':_0x331a4f};});} \ No newline at end of file diff --git a/server/components/encryptor/index.js b/server/components/encryptor/index.js index e446b18..12b1488 100644 --- a/server/components/encryptor/index.js +++ b/server/components/encryptor/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['update','close','crypto','bluebird','aes192','hasOwnProperty','encryptFile','createReadStream','createCipher','algorithm','data','final','binary','write','end','unlink','decryptFile'];(function(_0x7de353,_0x58d7e6){var _0x3500a1=function(_0x3ca5a7){while(--_0x3ca5a7){_0x7de353['push'](_0x7de353['shift']());}};_0x3500a1(++_0x58d7e6);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3c4737,_0x2329ec){_0x3c4737=_0x3c4737-0x0;var _0x2bb926=_0xa9e0[_0x3c4737];return _0x2bb926;};'use strict';var crypto=require(_0x0a9e('0x0'));var fs=require('fs');var BPromise=require(_0x0a9e('0x1'));var defaultOptions={'algorithm':_0x0a9e('0x2')};function combineOptions(_0x5dd881){var _0x550fbc={};for(var _0x18d5c9 in defaultOptions){if(defaultOptions['hasOwnProperty'](_0x18d5c9)){_0x550fbc[_0x18d5c9]=defaultOptions[_0x18d5c9];}}if(_0x5dd881){for(var _0x333808 in _0x5dd881){if(_0x5dd881[_0x0a9e('0x3')](_0x333808)){_0x550fbc[_0x333808]=_0x5dd881[_0x333808];}}}return _0x550fbc;}exports[_0x0a9e('0x4')]=function(_0x991246,_0x981158,_0x57b080,_0x219af0){return new BPromise(function(_0x441e3a,_0x2cc193){_0x219af0=combineOptions(_0x219af0);var _0x5f41ea=new Buffer(_0x57b080);var _0x503809=fs[_0x0a9e('0x5')](_0x991246);var _0x56465b=fs['createWriteStream'](_0x981158);var _0x39753a=crypto[_0x0a9e('0x6')](_0x219af0[_0x0a9e('0x7')],_0x5f41ea);_0x503809['on'](_0x0a9e('0x8'),function(_0xfeb75b){var _0xbd1168=new Buffer(_0x39753a['update'](_0xfeb75b),'binary');_0x56465b['write'](_0xbd1168);});_0x503809['on']('end',function(){try{var _0x273d4d=new Buffer(_0x39753a[_0x0a9e('0x9')](_0x0a9e('0xa')),_0x0a9e('0xa'));_0x56465b[_0x0a9e('0xb')](_0x273d4d);_0x56465b[_0x0a9e('0xc')]();_0x56465b['on']('close',function(){return _0x441e3a(_0x981158);});}catch(_0x4283ce){fs[_0x0a9e('0xd')](_0x981158);return _0x2cc193(_0x4283ce);}});});};exports[_0x0a9e('0xe')]=function(_0x281129,_0x44dcfd,_0x4d5611,_0x52a03d){return new BPromise(function(_0x22dccb,_0x5d0880){_0x52a03d=combineOptions(_0x52a03d);var _0x1985b6=new Buffer(_0x4d5611);var _0x519dfd=fs[_0x0a9e('0x5')](_0x281129);var _0x12066b=fs['createWriteStream'](_0x44dcfd);var _0x225616=crypto['createDecipher'](_0x52a03d[_0x0a9e('0x7')],_0x1985b6);_0x519dfd['on'](_0x0a9e('0x8'),function(_0x106033){var _0x205fd6=new Buffer(_0x225616[_0x0a9e('0xf')](_0x106033),_0x0a9e('0xa'));_0x12066b[_0x0a9e('0xb')](_0x205fd6);});_0x519dfd['on'](_0x0a9e('0xc'),function(){try{var _0x1314ae=new Buffer(_0x225616[_0x0a9e('0x9')](_0x0a9e('0xa')),_0x0a9e('0xa'));_0x12066b['write'](_0x1314ae);_0x12066b[_0x0a9e('0xc')]();_0x12066b['on'](_0x0a9e('0x10'),function(){return _0x22dccb(_0x44dcfd);});}catch(_0x53682f){fs[_0x0a9e('0xd')](_0x44dcfd);return _0x5d0880(_0x53682f);}});});}; \ No newline at end of file +var _0xb7e7=['crypto','aes192','hasOwnProperty','encryptFile','createReadStream','createWriteStream','createCipher','algorithm','update','binary','write','end','final','createDecipher','data','close','unlink'];(function(_0x1020a8,_0x1c3f0a){var _0xb37592=function(_0x2fda4f){while(--_0x2fda4f){_0x1020a8['push'](_0x1020a8['shift']());}};_0xb37592(++_0x1c3f0a);}(_0xb7e7,0x121));var _0x7b7e=function(_0x1d24eb,_0x12295b){_0x1d24eb=_0x1d24eb-0x0;var _0x1dc576=_0xb7e7[_0x1d24eb];return _0x1dc576;};'use strict';var crypto=require(_0x7b7e('0x0'));var fs=require('fs');var BPromise=require('bluebird');var defaultOptions={'algorithm':_0x7b7e('0x1')};function combineOptions(_0x518dc6){var _0x1b7cc7={};for(var _0x54a37f in defaultOptions){if(defaultOptions[_0x7b7e('0x2')](_0x54a37f)){_0x1b7cc7[_0x54a37f]=defaultOptions[_0x54a37f];}}if(_0x518dc6){for(var _0x556d68 in _0x518dc6){if(_0x518dc6[_0x7b7e('0x2')](_0x556d68)){_0x1b7cc7[_0x556d68]=_0x518dc6[_0x556d68];}}}return _0x1b7cc7;}exports[_0x7b7e('0x3')]=function(_0x1d9384,_0x52047f,_0x53ed64,_0x333fa4){return new BPromise(function(_0x372bde,_0x7f87e0){_0x333fa4=combineOptions(_0x333fa4);var _0x55ce81=new Buffer(_0x53ed64);var _0x42b871=fs[_0x7b7e('0x4')](_0x1d9384);var _0x2917f9=fs[_0x7b7e('0x5')](_0x52047f);var _0x148964=crypto[_0x7b7e('0x6')](_0x333fa4[_0x7b7e('0x7')],_0x55ce81);_0x42b871['on']('data',function(_0x299519){var _0x1eef0a=new Buffer(_0x148964[_0x7b7e('0x8')](_0x299519),_0x7b7e('0x9'));_0x2917f9[_0x7b7e('0xa')](_0x1eef0a);});_0x42b871['on'](_0x7b7e('0xb'),function(){try{var _0x36d2a3=new Buffer(_0x148964[_0x7b7e('0xc')](_0x7b7e('0x9')),'binary');_0x2917f9[_0x7b7e('0xa')](_0x36d2a3);_0x2917f9[_0x7b7e('0xb')]();_0x2917f9['on']('close',function(){return _0x372bde(_0x52047f);});}catch(_0x422d3a){fs['unlink'](_0x52047f);return _0x7f87e0(_0x422d3a);}});});};exports['decryptFile']=function(_0x2889ed,_0xd304f5,_0xf067da,_0x457ec5){return new BPromise(function(_0x3d2fb2,_0x5703fd){_0x457ec5=combineOptions(_0x457ec5);var _0x51baf6=new Buffer(_0xf067da);var _0xc7f087=fs[_0x7b7e('0x4')](_0x2889ed);var _0x27f999=fs[_0x7b7e('0x5')](_0xd304f5);var _0x2cc400=crypto[_0x7b7e('0xd')](_0x457ec5[_0x7b7e('0x7')],_0x51baf6);_0xc7f087['on'](_0x7b7e('0xe'),function(_0x2acb8c){var _0x429a0e=new Buffer(_0x2cc400[_0x7b7e('0x8')](_0x2acb8c),_0x7b7e('0x9'));_0x27f999[_0x7b7e('0xa')](_0x429a0e);});_0xc7f087['on'](_0x7b7e('0xb'),function(){try{var _0x9776c3=new Buffer(_0x2cc400[_0x7b7e('0xc')](_0x7b7e('0x9')),'binary');_0x27f999[_0x7b7e('0xa')](_0x9776c3);_0x27f999[_0x7b7e('0xb')]();_0x27f999['on'](_0x7b7e('0xf'),function(){return _0x3d2fb2(_0xd304f5);});}catch(_0x4c0647){fs[_0x7b7e('0x10')](_0xd304f5);return _0x5703fd(_0x4c0647);}});});}; \ No newline at end of file diff --git a/server/components/export/csv.js b/server/components/export/csv.js index 0143de5..370c10f 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 _0xedd9=['path','lodash','to-csv','bluebird','zip-dir','rimraf','../../mysqldb','../../config/logger','analytics','argv','savename','AnalyticExtractedReport','info','format','CSV','Setting','split','splitSizeCsv','then','sequelize','query','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','QueryTypes','SELECT','num','Empty','length','push','dirname','basename','existsSync','mkdirSync','join','each','%s.%s','writeFileSync','zip','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','Completed','csv','inspect','Failed'];(function(_0x15bc81,_0x4d4f77){var _0x59440e=function(_0x1b60f2){while(--_0x1b60f2){_0x15bc81['push'](_0x15bc81['shift']());}};_0x59440e(++_0x4d4f77);}(_0xedd9,0xfc));var _0x9edd=function(_0x12401e,_0x919ac3){_0x12401e=_0x12401e-0x0;var _0x29aae4=_0xedd9[_0x12401e];return _0x29aae4;};'use strict';var util=require('util');var path=require(_0x9edd('0x0'));var _=require(_0x9edd('0x1'));var csv=require(_0x9edd('0x2'));var fs=require('fs');var BPromise=require(_0x9edd('0x3'));var zipdir=require(_0x9edd('0x4'));var rimraf=require(_0x9edd('0x5'));var db=require(_0x9edd('0x6'))['db'];var dbH=require(_0x9edd('0x6'))['dbH'];var logger=require(_0x9edd('0x7'))(_0x9edd('0x8'));var EXTRACTED_REPORT_ID=Number(process[_0x9edd('0x9')][0x2]);var QUERY=process[_0x9edd('0x9')][0x3];var PATH=process['argv'][0x4];function analyticExtractedReport(_0xf0b2d8,_0x571af9){var _0x172522={'status':_0xf0b2d8};var _0x190185={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x571af9){_0x172522[_0x9edd('0xa')]=_0x571af9;}return db[_0x9edd('0xb')]['update'](_0x172522,_0x190185);}function main(){var _0x494a24=0x1388;var _0x5d2f90;logger[_0x9edd('0xc')](util[_0x9edd('0xd')]('Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,_0x9edd('0xe')));return db[_0x9edd('0xf')]['find']({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x9edd('0x10'),_0x9edd('0x11')]})[_0x9edd('0x12')](function(_0xfd544a){if(_0xfd544a){_0x5d2f90=_0xfd544a;_0x494a24=_0x5d2f90[_0x9edd('0x11')]||0x1388;}})[_0x9edd('0x12')](function(){return dbH[_0x9edd('0x13')][_0x9edd('0x14')](util['format'](_0x9edd('0x15'),QUERY),{'type':dbH[_0x9edd('0x13')][_0x9edd('0x16')][_0x9edd('0x17')]});})[_0x9edd('0x12')](function(_0x338f3c){if(!_0x338f3c[0x0][_0x9edd('0x18')]){return analyticExtractedReport(_0x9edd('0x19'));}var _0x4ea60f=[];var _0x5f5bf4=0x0;var _0x448996=!![];if(_0x338f3c&&_0x338f3c[_0x9edd('0x1a')]){var _0x5acf65=_0x338f3c[0x0][_0x9edd('0x18')]%(_0x5f5bf4+_0x494a24);if(_0x5d2f90[_0x9edd('0x10')]){for(;_0x448996;_0x5f5bf4+=_0x494a24,_0x5acf65=_0x338f3c[0x0][_0x9edd('0x18')]%(_0x5f5bf4+_0x494a24)){if(_0x5acf65==0x0||_0x5acf65==_0x338f3c[0x0]['num']){_0x448996=![];}_0x4ea60f[_0x9edd('0x1b')](dbH['sequelize'][_0x9edd('0x14')](util[_0x9edd('0xd')]('%s\x20limit\x20%d\x20OFFSET\x20%d',QUERY,_0x494a24,_0x5f5bf4),{'type':dbH['sequelize'][_0x9edd('0x16')]['SELECT']}));}}else{_0x4ea60f[_0x9edd('0x1b')](dbH['sequelize']['query'](QUERY,{'type':dbH[_0x9edd('0x13')][_0x9edd('0x16')]['SELECT']}));}}var _0x5823bc=path[_0x9edd('0x1c')](PATH);var _0x186186=path[_0x9edd('0x1d')](PATH,'.csv');var _0x3741c8=_0x5d2f90[_0x9edd('0x10')]&&_0x4ea60f[_0x9edd('0x1a')]>0x1;var _0x2ca65f=[];if(!fs[_0x9edd('0x1e')](path['join'](_0x5823bc,_0x186186))&&_0x3741c8){fs[_0x9edd('0x1f')](path[_0x9edd('0x20')](_0x5823bc,_0x186186));}return BPromise[_0x9edd('0x21')](_0x4ea60f,function(_0x2f9f86){_0x2ca65f[_0x9edd('0x1b')](_0x2f9f86);})['then'](function(){for(var _0x4b3d1b=0x0;_0x4b3d1b<_0x2ca65f[_0x9edd('0x1a')];_0x4b3d1b+=0x1){var _0xfeca7b;var _0x8d67aa=_0x2ca65f[_0x4b3d1b];if(_0x3741c8){_0xfeca7b=path[_0x9edd('0x20')](_0x5823bc,_0x186186,util[_0x9edd('0xd')]('%s%d.%s',_0x186186,_0x4b3d1b,'csv'));}else{_0xfeca7b=path[_0x9edd('0x20')](_0x5823bc,util[_0x9edd('0xd')](_0x9edd('0x22'),_0x186186,'csv'));}fs[_0x9edd('0x23')](_0xfeca7b,csv(_0x8d67aa));}})[_0x9edd('0x12')](function(){if(_0x3741c8){zipdir(path[_0x9edd('0x20')](_0x5823bc,_0x186186),{'saveTo':path[_0x9edd('0x20')](_0x5823bc,util['format'](_0x9edd('0x22'),_0x186186,_0x9edd('0x24')))},function(_0xbe87e1,_0x12c1bc){});rimraf(path[_0x9edd('0x20')](_0x5823bc,_0x186186),function(){});}})[_0x9edd('0x12')](function(){logger[_0x9edd('0xc')](util[_0x9edd('0xd')](_0x9edd('0x25'),EXTRACTED_REPORT_ID,_0x9edd('0xe')));return analyticExtractedReport(_0x9edd('0x26'),_0x3741c8?util[_0x9edd('0xd')](_0x9edd('0x22'),_0x186186,_0x3741c8?_0x9edd('0x24'):_0x9edd('0x27')):null);});})['catch'](function(_0x1453d2){logger[_0x9edd('0xc')](util[_0x9edd('0xd')]('Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,_0x9edd('0xe')),util[_0x9edd('0x28')](_0x1453d2,{'showHidden':![],'depth':null}));return analyticExtractedReport(_0x9edd('0x29'));});}main(); \ No newline at end of file +var _0x55e0=['util','path','lodash','to-csv','rimraf','../../mysqldb','dbH','../../config/logger','analytics','argv','savename','AnalyticExtractedReport','info','format','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','find','splitSizeCsv','then','sequelize','query','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','QueryTypes','SELECT','num','Empty','length','split','push','%s\x20limit\x20%d\x20OFFSET\x20%d','dirname','.csv','existsSync','mkdirSync','join','each','%s%d.%s','csv','%s.%s','writeFileSync','zip','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','Completed','catch','inspect'];(function(_0x51c52b,_0x147712){var _0x581ce3=function(_0x2e61a0){while(--_0x2e61a0){_0x51c52b['push'](_0x51c52b['shift']());}};_0x581ce3(++_0x147712);}(_0x55e0,0xdc));var _0x055e=function(_0x8314a6,_0x8833c9){_0x8314a6=_0x8314a6-0x0;var _0x46af07=_0x55e0[_0x8314a6];return _0x46af07;};'use strict';var util=require(_0x055e('0x0'));var path=require(_0x055e('0x1'));var _=require(_0x055e('0x2'));var csv=require(_0x055e('0x3'));var fs=require('fs');var BPromise=require('bluebird');var zipdir=require('zip-dir');var rimraf=require(_0x055e('0x4'));var db=require(_0x055e('0x5'))['db'];var dbH=require(_0x055e('0x5'))[_0x055e('0x6')];var logger=require(_0x055e('0x7'))(_0x055e('0x8'));var EXTRACTED_REPORT_ID=Number(process['argv'][0x2]);var QUERY=process['argv'][0x3];var PATH=process[_0x055e('0x9')][0x4];function analyticExtractedReport(_0x4a442e,_0x8e7824){var _0x3c4cf={'status':_0x4a442e};var _0x376618={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x8e7824){_0x3c4cf[_0x055e('0xa')]=_0x8e7824;}return db[_0x055e('0xb')]['update'](_0x3c4cf,_0x376618);}function main(){var _0x40779c=0x1388;var _0xd67814;logger[_0x055e('0xc')](util[_0x055e('0xd')](_0x055e('0xe'),EXTRACTED_REPORT_ID,'CSV'));return db['Setting'][_0x055e('0xf')]({'where':{'id':0x1},'raw':!![],'attributes':['id','split',_0x055e('0x10')]})[_0x055e('0x11')](function(_0x72d424){if(_0x72d424){_0xd67814=_0x72d424;_0x40779c=_0xd67814[_0x055e('0x10')]||0x1388;}})[_0x055e('0x11')](function(){return dbH[_0x055e('0x12')][_0x055e('0x13')](util['format'](_0x055e('0x14'),QUERY),{'type':dbH[_0x055e('0x12')][_0x055e('0x15')][_0x055e('0x16')]});})[_0x055e('0x11')](function(_0x56af18){if(!_0x56af18[0x0][_0x055e('0x17')]){return analyticExtractedReport(_0x055e('0x18'));}var _0x111cdb=[];var _0x599533=0x0;var _0x3f2d0e=!![];if(_0x56af18&&_0x56af18[_0x055e('0x19')]){var _0xb4e6ca=_0x56af18[0x0][_0x055e('0x17')]%(_0x599533+_0x40779c);if(_0xd67814[_0x055e('0x1a')]){for(;_0x3f2d0e;_0x599533+=_0x40779c,_0xb4e6ca=_0x56af18[0x0]['num']%(_0x599533+_0x40779c)){if(_0xb4e6ca==0x0||_0xb4e6ca==_0x56af18[0x0][_0x055e('0x17')]){_0x3f2d0e=![];}_0x111cdb[_0x055e('0x1b')](dbH[_0x055e('0x12')][_0x055e('0x13')](util['format'](_0x055e('0x1c'),QUERY,_0x40779c,_0x599533),{'type':dbH[_0x055e('0x12')]['QueryTypes'][_0x055e('0x16')]}));}}else{_0x111cdb[_0x055e('0x1b')](dbH[_0x055e('0x12')][_0x055e('0x13')](QUERY,{'type':dbH[_0x055e('0x12')][_0x055e('0x15')]['SELECT']}));}}var _0x31c355=path[_0x055e('0x1d')](PATH);var _0x211594=path['basename'](PATH,_0x055e('0x1e'));var _0x2da6b=_0xd67814[_0x055e('0x1a')]&&_0x111cdb[_0x055e('0x19')]>0x1;var _0x51df23=[];if(!fs[_0x055e('0x1f')](path['join'](_0x31c355,_0x211594))&&_0x2da6b){fs[_0x055e('0x20')](path[_0x055e('0x21')](_0x31c355,_0x211594));}return BPromise[_0x055e('0x22')](_0x111cdb,function(_0x1a76c6){_0x51df23[_0x055e('0x1b')](_0x1a76c6);})[_0x055e('0x11')](function(){for(var _0x58caf9=0x0;_0x58caf9<_0x51df23[_0x055e('0x19')];_0x58caf9+=0x1){var _0x1f90a9;var _0x2a82f8=_0x51df23[_0x58caf9];if(_0x2da6b){_0x1f90a9=path['join'](_0x31c355,_0x211594,util[_0x055e('0xd')](_0x055e('0x23'),_0x211594,_0x58caf9,_0x055e('0x24')));}else{_0x1f90a9=path[_0x055e('0x21')](_0x31c355,util['format'](_0x055e('0x25'),_0x211594,'csv'));}fs[_0x055e('0x26')](_0x1f90a9,csv(_0x2a82f8));}})[_0x055e('0x11')](function(){if(_0x2da6b){zipdir(path[_0x055e('0x21')](_0x31c355,_0x211594),{'saveTo':path[_0x055e('0x21')](_0x31c355,util[_0x055e('0xd')]('%s.%s',_0x211594,_0x055e('0x27')))},function(_0x453e5e,_0x293062){});rimraf(path[_0x055e('0x21')](_0x31c355,_0x211594),function(){});}})[_0x055e('0x11')](function(){logger[_0x055e('0xc')](util[_0x055e('0xd')](_0x055e('0x28'),EXTRACTED_REPORT_ID,'CSV'));return analyticExtractedReport(_0x055e('0x29'),_0x2da6b?util[_0x055e('0xd')]('%s.%s',_0x211594,_0x2da6b?_0x055e('0x27'):_0x055e('0x24')):null);});})[_0x055e('0x2a')](function(_0x20717b){logger[_0x055e('0xc')](util[_0x055e('0xd')]('Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,'CSV'),util[_0x055e('0x2b')](_0x20717b,{'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 e29e661..011e599 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(_0x25c3bb,_0x253aa6){var _0x36b047=function(_0x5d1d57){while(--_0x5d1d57){_0x25c3bb['push'](_0x25c3bb['shift']());}};_0x36b047(++_0x253aa6);}(_0xb10b,0x12a));var _0xbb10=function(_0x55c3d9,_0x3bf75c){_0x55c3d9=_0x55c3d9-0x0;var _0x19fd97=_0xb10b[_0x55c3d9];return _0x19fd97;};'use strict';var _=require(_0xbb10('0x0'));var fs=require('fs');var BPromise=require('bluebird');var util=require(_0xbb10('0x1'));var path=require(_0xbb10('0x2'));var moment=require(_0xbb10('0x3'));var PdfPrinter=require('pdfmake/src/printer');var zipdir=require(_0xbb10('0x4'));var rimraf=require(_0xbb10('0x5'));var db=require(_0xbb10('0x6'))['db'];var dbH=require(_0xbb10('0x6'))[_0xbb10('0x7')];var logger=require(_0xbb10('0x8'))('analytics');var EXTRACTED_REPORT_ID=Number(process[_0xbb10('0x9')][0x2]);var QUERY=process[_0xbb10('0x9')][0x3];var PATH=process['argv'][0x4];var NAME=process[_0xbb10('0x9')][0x5];var FORMAT=_0xbb10('0xa');var _extractedReport;function analyticExtractedReport(_0x21370f,_0x1c3ee5){var _0x2353ef={'status':_0x21370f};var _0x1ce33e={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x1c3ee5){_0x2353ef[_0xbb10('0xb')]=_0x1c3ee5;}return db[_0xbb10('0xc')]['update'](_0x2353ef,_0x1ce33e);}function getHeader(_0x4e47f8){var _0x20bd61=[];for(var _0x118a74 in _0x4e47f8){if(_0x4e47f8[_0xbb10('0xd')](_0x118a74)){_0x20bd61['push']({'text':_0x118a74,'style':_0xbb10('0xe')});}}return _0x20bd61;}function extractReport(_0x5be7e0){var _0x44fb19=0x1388;var _0x916a32;if(!_0x5be7e0[0x0][_0xbb10('0xf')]){return analyticExtractedReport(_0xbb10('0x10'));}var _0x442548=[];var _0x147230=0x0;var _0x58a612=!![];var _0x26e021=path[_0xbb10('0x11')](PATH);var _0x45b9d6=path[_0xbb10('0x12')](PATH,_0xbb10('0x13'));var _0x2f2ebf=![];var _0x24a57b=[];return db[_0xbb10('0x14')][_0xbb10('0x15')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0xbb10('0x16'),'splitSizePdf']})[_0xbb10('0x17')](function(_0x1145f1){if(_0x1145f1){_0x916a32=_0x1145f1;_0x44fb19=_0x916a32[_0xbb10('0x18')]||0x3e8;}})[_0xbb10('0x17')](function(){if(_0x5be7e0&&_0x5be7e0[_0xbb10('0x19')]){var _0x1682a4=_0x5be7e0[0x0][_0xbb10('0xf')]%(_0x147230+_0x44fb19);if(_0x916a32[_0xbb10('0x16')]){for(;_0x58a612;_0x147230+=_0x44fb19,_0x1682a4=_0x5be7e0[0x0][_0xbb10('0xf')]%(_0x147230+_0x44fb19)){if(_0x1682a4==0x0||_0x1682a4==_0x5be7e0[0x0][_0xbb10('0xf')]){_0x58a612=![];}_0x442548['push'](dbH[_0xbb10('0x1a')][_0xbb10('0x1b')](util[_0xbb10('0x1c')](_0xbb10('0x1d'),QUERY,_0x44fb19,_0x147230),{'type':dbH[_0xbb10('0x1a')][_0xbb10('0x1e')]['SELECT']}));}}else{_0x442548[_0xbb10('0x1f')](dbH[_0xbb10('0x1a')]['query'](QUERY,{'type':dbH['sequelize'][_0xbb10('0x1e')][_0xbb10('0x20')]}));}}_0x2f2ebf=_0x916a32[_0xbb10('0x16')]&&_0x442548[_0xbb10('0x19')]>0x1;if(!fs[_0xbb10('0x21')](path[_0xbb10('0x22')](_0x26e021,_0x45b9d6))&&_0x2f2ebf){fs[_0xbb10('0x23')](path[_0xbb10('0x22')](_0x26e021,_0x45b9d6));}return BPromise[_0xbb10('0x24')](_0x442548,function(_0x395404){_0x24a57b[_0xbb10('0x1f')](_0x395404);});})[_0xbb10('0x17')](function(){return BPromise['each'](_0x442548,function(_0x4fedac,_0x4fb5e0){var _0xc93a04;var _0x3c5ae7=util[_0xbb10('0x1c')]('Name:\x20%s\x0aReport:\x20%s\x0aFrom:\x20%s\x20To:\x20%s',NAME,_extractedReport[_0xbb10('0x25')],moment(_extractedReport[_0xbb10('0x26')])[_0xbb10('0x1c')](FORMAT),moment(_extractedReport[_0xbb10('0x27')])[_0xbb10('0x1c')](FORMAT));var _0x20d946={'pageSize':'A4','pageOrientation':_0xbb10('0x28'),'content':[{'text':_0x3c5ae7,'style':'header'}],'styles':{'header':{'fontSize':0x12,'bold':!![],'margin':[0x0,0x0,0x0,0xa]},'tableHeader':{'bold':!![],'fontSize':0xd,'color':_0xbb10('0x29')}}};var _0x21ac54={'headerRows':0x1,'body':[]};_0x21ac54[_0xbb10('0x2a')][_0xbb10('0x1f')](getHeader(_0x4fedac[0x0]));var _0x1d30aa;for(var _0x2ff4c1=0x0;_0x2ff4c1<_0x4fedac['length'];_0x2ff4c1+=0x1){_0x1d30aa=[];for(var _0x221624 in _0x4fedac[_0x2ff4c1]){if(_0x4fedac[_0x2ff4c1]['hasOwnProperty'](_0x221624)){_0x1d30aa[_0xbb10('0x1f')](_0x4fedac[_0x2ff4c1][_0x221624]?_['toString'](_0x4fedac[_0x2ff4c1][_0x221624]):'');}}_0x21ac54[_0xbb10('0x2a')][_0xbb10('0x1f')](_0x1d30aa);}_0x20d946[_0xbb10('0x2b')]['push']({'table':_0x21ac54});return new BPromise(function(_0x518d47,_0x4c3744){var _0x34f65e=new PdfPrinter({'Roboto':{'normal':__dirname+'/fonts/Roboto-Regular.ttf','bold':__dirname+_0xbb10('0x2c'),'italics':__dirname+_0xbb10('0x2d'),'bolditalics':__dirname+_0xbb10('0x2e')}});var _0x1c0b57=_0x34f65e[_0xbb10('0x2f')](_0x20d946);if(_0x2f2ebf){_0xc93a04=path[_0xbb10('0x22')](_0x26e021,_0x45b9d6,util[_0xbb10('0x1c')]('%s%d.%s',_0x45b9d6,_0x4fb5e0,_0xbb10('0x30')));}else{_0xc93a04=path[_0xbb10('0x22')](_0x26e021,util[_0xbb10('0x1c')](_0xbb10('0x31'),_0x45b9d6,_0xbb10('0x30')));}var _0x9de708=_0x1c0b57[_0xbb10('0x32')](fs[_0xbb10('0x33')](_0xc93a04));_0x9de708['on'](_0xbb10('0x34'),function(){_0x518d47();});_0x9de708['on']('error',function(_0x2b5352){console[_0xbb10('0x35')](_0xbb10('0x36'),_0x2b5352);_0x4c3744(_0x2b5352);});_0x1c0b57[_0xbb10('0x37')]();});});})['then'](function(){if(_0x2f2ebf){return new BPromise(function(_0x111762,_0x5de37b){zipdir(path['join'](_0x26e021,_0x45b9d6),{'saveTo':path[_0xbb10('0x22')](_0x26e021,util[_0xbb10('0x1c')](_0xbb10('0x31'),_0x45b9d6,_0xbb10('0x38')))},function(_0x15d895){if(_0x15d895){_0x5de37b(_0x15d895);}else{_0x111762();}});});}})[_0xbb10('0x17')](function(){if(_0x2f2ebf){rimraf(path['join'](_0x26e021,_0x45b9d6),function(){});}})[_0xbb10('0x17')](function(){logger[_0xbb10('0x39')](util['format']('Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed',EXTRACTED_REPORT_ID,'CSV'));return analyticExtractedReport(_0xbb10('0x3a'),_0x2f2ebf?util[_0xbb10('0x1c')](_0xbb10('0x31'),_0x45b9d6,_0x2f2ebf?'zip':_0xbb10('0x30')):null);});}function main(){logger[_0xbb10('0x39')](util[_0xbb10('0x1c')]('Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,_0xbb10('0x3b')));return db[_0xbb10('0xc')][_0xbb10('0x3c')]({'where':{'id':EXTRACTED_REPORT_ID}})[_0xbb10('0x17')](function(_0x4f1cdd){_extractedReport=_0x4f1cdd;return dbH[_0xbb10('0x1a')][_0xbb10('0x1b')](util['format'](_0xbb10('0x3d'),QUERY),{'type':dbH[_0xbb10('0x1a')][_0xbb10('0x1e')][_0xbb10('0x20')]});})[_0xbb10('0x17')](extractReport)[_0xbb10('0x3e')](function(_0x5f3d67){logger[_0xbb10('0x39')](util[_0xbb10('0x1c')](_0xbb10('0x3f'),EXTRACTED_REPORT_ID,_0xbb10('0x3b')),util['inspect'](_0x5f3d67,{'showHidden':![],'depth':null}));return analyticExtractedReport(_0xbb10('0x40'));});}main(); \ No newline at end of file +var _0xb10b=['query','format','%s\x20limit\x20%d\x20OFFSET\x20%d','QueryTypes','push','SELECT','existsSync','join','mkdirSync','each','name','startDate','endDate','landscape','black','body','content','/fonts/Roboto-Medium.ttf','/fonts/Roboto-Italic.ttf','/fonts/Roboto-MediumItalic.ttf','createPdfKitDocument','pdf','%s.%s','pipe','createWriteStream','finish','log','err','end','zip','info','Completed','PDF','findOne','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','Failed','lodash','util','path','moment','zip-dir','rimraf','../../mysqldb','dbH','../../config/logger','argv','MMMM\x20Do\x20YYYY,\x20h:mm:ss\x20a','savename','AnalyticExtractedReport','hasOwnProperty','tableHeader','num','Empty','dirname','basename','.pdf','Setting','find','split','then','splitSizePdf','length','sequelize'];(function(_0x47d8b8,_0x11a38b){var _0xad183=function(_0x99dc70){while(--_0x99dc70){_0x47d8b8['push'](_0x47d8b8['shift']());}};_0xad183(++_0x11a38b);}(_0xb10b,0x12a));var _0xbb10=function(_0x31038b,_0x3ac1c9){_0x31038b=_0x31038b-0x0;var _0x1c9d3c=_0xb10b[_0x31038b];return _0x1c9d3c;};'use strict';var _=require(_0xbb10('0x0'));var fs=require('fs');var BPromise=require('bluebird');var util=require(_0xbb10('0x1'));var path=require(_0xbb10('0x2'));var moment=require(_0xbb10('0x3'));var PdfPrinter=require('pdfmake/src/printer');var zipdir=require(_0xbb10('0x4'));var rimraf=require(_0xbb10('0x5'));var db=require(_0xbb10('0x6'))['db'];var dbH=require(_0xbb10('0x6'))[_0xbb10('0x7')];var logger=require(_0xbb10('0x8'))('analytics');var EXTRACTED_REPORT_ID=Number(process[_0xbb10('0x9')][0x2]);var QUERY=process[_0xbb10('0x9')][0x3];var PATH=process['argv'][0x4];var NAME=process[_0xbb10('0x9')][0x5];var FORMAT=_0xbb10('0xa');var _extractedReport;function analyticExtractedReport(_0x21370f,_0x1c3ee5){var _0x2353ef={'status':_0x21370f};var _0x1ce33e={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x1c3ee5){_0x2353ef[_0xbb10('0xb')]=_0x1c3ee5;}return db[_0xbb10('0xc')]['update'](_0x2353ef,_0x1ce33e);}function getHeader(_0x4e47f8){var _0x20bd61=[];for(var _0x118a74 in _0x4e47f8){if(_0x4e47f8[_0xbb10('0xd')](_0x118a74)){_0x20bd61['push']({'text':_0x118a74,'style':_0xbb10('0xe')});}}return _0x20bd61;}function extractReport(_0x5be7e0){var _0x44fb19=0x1388;var _0x916a32;if(!_0x5be7e0[0x0][_0xbb10('0xf')]){return analyticExtractedReport(_0xbb10('0x10'));}var _0x442548=[];var _0x147230=0x0;var _0x58a612=!![];var _0x26e021=path[_0xbb10('0x11')](PATH);var _0x45b9d6=path[_0xbb10('0x12')](PATH,_0xbb10('0x13'));var _0x2f2ebf=![];var _0x24a57b=[];return db[_0xbb10('0x14')][_0xbb10('0x15')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0xbb10('0x16'),'splitSizePdf']})[_0xbb10('0x17')](function(_0x1145f1){if(_0x1145f1){_0x916a32=_0x1145f1;_0x44fb19=_0x916a32[_0xbb10('0x18')]||0x3e8;}})[_0xbb10('0x17')](function(){if(_0x5be7e0&&_0x5be7e0[_0xbb10('0x19')]){var _0x1682a4=_0x5be7e0[0x0][_0xbb10('0xf')]%(_0x147230+_0x44fb19);if(_0x916a32[_0xbb10('0x16')]){for(;_0x58a612;_0x147230+=_0x44fb19,_0x1682a4=_0x5be7e0[0x0][_0xbb10('0xf')]%(_0x147230+_0x44fb19)){if(_0x1682a4==0x0||_0x1682a4==_0x5be7e0[0x0][_0xbb10('0xf')]){_0x58a612=![];}_0x442548['push'](dbH[_0xbb10('0x1a')][_0xbb10('0x1b')](util[_0xbb10('0x1c')](_0xbb10('0x1d'),QUERY,_0x44fb19,_0x147230),{'type':dbH[_0xbb10('0x1a')][_0xbb10('0x1e')]['SELECT']}));}}else{_0x442548[_0xbb10('0x1f')](dbH[_0xbb10('0x1a')]['query'](QUERY,{'type':dbH['sequelize'][_0xbb10('0x1e')][_0xbb10('0x20')]}));}}_0x2f2ebf=_0x916a32[_0xbb10('0x16')]&&_0x442548[_0xbb10('0x19')]>0x1;if(!fs[_0xbb10('0x21')](path[_0xbb10('0x22')](_0x26e021,_0x45b9d6))&&_0x2f2ebf){fs[_0xbb10('0x23')](path[_0xbb10('0x22')](_0x26e021,_0x45b9d6));}return BPromise[_0xbb10('0x24')](_0x442548,function(_0x395404){_0x24a57b[_0xbb10('0x1f')](_0x395404);});})[_0xbb10('0x17')](function(){return BPromise['each'](_0x442548,function(_0x4fedac,_0x4fb5e0){var _0xc93a04;var _0x3c5ae7=util[_0xbb10('0x1c')]('Name:\x20%s\x0aReport:\x20%s\x0aFrom:\x20%s\x20To:\x20%s',NAME,_extractedReport[_0xbb10('0x25')],moment(_extractedReport[_0xbb10('0x26')])[_0xbb10('0x1c')](FORMAT),moment(_extractedReport[_0xbb10('0x27')])[_0xbb10('0x1c')](FORMAT));var _0x20d946={'pageSize':'A4','pageOrientation':_0xbb10('0x28'),'content':[{'text':_0x3c5ae7,'style':'header'}],'styles':{'header':{'fontSize':0x12,'bold':!![],'margin':[0x0,0x0,0x0,0xa]},'tableHeader':{'bold':!![],'fontSize':0xd,'color':_0xbb10('0x29')}}};var _0x21ac54={'headerRows':0x1,'body':[]};_0x21ac54[_0xbb10('0x2a')][_0xbb10('0x1f')](getHeader(_0x4fedac[0x0]));var _0x1d30aa;for(var _0x2ff4c1=0x0;_0x2ff4c1<_0x4fedac['length'];_0x2ff4c1+=0x1){_0x1d30aa=[];for(var _0x221624 in _0x4fedac[_0x2ff4c1]){if(_0x4fedac[_0x2ff4c1]['hasOwnProperty'](_0x221624)){_0x1d30aa[_0xbb10('0x1f')](_0x4fedac[_0x2ff4c1][_0x221624]?_['toString'](_0x4fedac[_0x2ff4c1][_0x221624]):'');}}_0x21ac54[_0xbb10('0x2a')][_0xbb10('0x1f')](_0x1d30aa);}_0x20d946[_0xbb10('0x2b')]['push']({'table':_0x21ac54});return new BPromise(function(_0x518d47,_0x4c3744){var _0x34f65e=new PdfPrinter({'Roboto':{'normal':__dirname+'/fonts/Roboto-Regular.ttf','bold':__dirname+_0xbb10('0x2c'),'italics':__dirname+_0xbb10('0x2d'),'bolditalics':__dirname+_0xbb10('0x2e')}});var _0x1c0b57=_0x34f65e[_0xbb10('0x2f')](_0x20d946);if(_0x2f2ebf){_0xc93a04=path[_0xbb10('0x22')](_0x26e021,_0x45b9d6,util[_0xbb10('0x1c')]('%s%d.%s',_0x45b9d6,_0x4fb5e0,_0xbb10('0x30')));}else{_0xc93a04=path[_0xbb10('0x22')](_0x26e021,util[_0xbb10('0x1c')](_0xbb10('0x31'),_0x45b9d6,_0xbb10('0x30')));}var _0x9de708=_0x1c0b57[_0xbb10('0x32')](fs[_0xbb10('0x33')](_0xc93a04));_0x9de708['on'](_0xbb10('0x34'),function(){_0x518d47();});_0x9de708['on']('error',function(_0x2b5352){console[_0xbb10('0x35')](_0xbb10('0x36'),_0x2b5352);_0x4c3744(_0x2b5352);});_0x1c0b57[_0xbb10('0x37')]();});});})['then'](function(){if(_0x2f2ebf){return new BPromise(function(_0x111762,_0x5de37b){zipdir(path['join'](_0x26e021,_0x45b9d6),{'saveTo':path[_0xbb10('0x22')](_0x26e021,util[_0xbb10('0x1c')](_0xbb10('0x31'),_0x45b9d6,_0xbb10('0x38')))},function(_0x15d895){if(_0x15d895){_0x5de37b(_0x15d895);}else{_0x111762();}});});}})[_0xbb10('0x17')](function(){if(_0x2f2ebf){rimraf(path['join'](_0x26e021,_0x45b9d6),function(){});}})[_0xbb10('0x17')](function(){logger[_0xbb10('0x39')](util['format']('Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed',EXTRACTED_REPORT_ID,'CSV'));return analyticExtractedReport(_0xbb10('0x3a'),_0x2f2ebf?util[_0xbb10('0x1c')](_0xbb10('0x31'),_0x45b9d6,_0x2f2ebf?'zip':_0xbb10('0x30')):null);});}function main(){logger[_0xbb10('0x39')](util[_0xbb10('0x1c')]('Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,_0xbb10('0x3b')));return db[_0xbb10('0xc')][_0xbb10('0x3c')]({'where':{'id':EXTRACTED_REPORT_ID}})[_0xbb10('0x17')](function(_0x4f1cdd){_extractedReport=_0x4f1cdd;return dbH[_0xbb10('0x1a')][_0xbb10('0x1b')](util['format'](_0xbb10('0x3d'),QUERY),{'type':dbH[_0xbb10('0x1a')][_0xbb10('0x1e')][_0xbb10('0x20')]});})[_0xbb10('0x17')](extractReport)[_0xbb10('0x3e')](function(_0x5f3d67){logger[_0xbb10('0x39')](util[_0xbb10('0x1c')](_0xbb10('0x3f'),EXTRACTED_REPORT_ID,_0xbb10('0x3b')),util['inspect'](_0x5f3d67,{'showHidden':![],'depth':null}));return analyticExtractedReport(_0xbb10('0x40'));});}main(); \ No newline at end of file diff --git a/server/components/export/xlsx.js b/server/components/export/xlsx.js index b6e20e3..eddbf22 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 _0x3e49=['.xlsx','existsSync','join','mkdirSync','xlsx','%s.%s','writeFileSync','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','Failed','util','path','lodash','json2xls','zip-dir','rimraf','analytics','argv','savename','AnalyticExtractedReport','info','format','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','XLSX','Setting','split','splitSizeXlsx','then','query','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','sequelize','SELECT','num','Empty','length','push','%s\x20limit\x20%d\x20OFFSET\x20%d','QueryTypes','basename'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x3e49,0xfb));var _0x93e4=function(_0x1a1cdf,_0x3b662f){_0x1a1cdf=_0x1a1cdf-0x0;var _0x1a9ea4=_0x3e49[_0x1a1cdf];return _0x1a9ea4;};'use strict';var util=require(_0x93e4('0x0'));var path=require(_0x93e4('0x1'));var _=require(_0x93e4('0x2'));var fs=require('fs');var json2xls=require(_0x93e4('0x3'));var BPromise=require('bluebird');var zipdir=require(_0x93e4('0x4'));var rimraf=require(_0x93e4('0x5'));var db=require('../../mysqldb')['db'];var dbH=require('../../mysqldb')['dbH'];var logger=require('../../config/logger')(_0x93e4('0x6'));var EXTRACTED_REPORT_ID=Number(process[_0x93e4('0x7')][0x2]);var QUERY=process['argv'][0x3];var PATH=process[_0x93e4('0x7')][0x4];function analyticExtractedReport(_0x438831,_0x33390d){var _0x195909={'status':_0x438831};var _0x206a64={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x33390d){_0x195909[_0x93e4('0x8')]=_0x33390d;}return db[_0x93e4('0x9')]['update'](_0x195909,_0x206a64);}function main(){var _0x113d53=0x1388;var _0x53a943;logger[_0x93e4('0xa')](util[_0x93e4('0xb')](_0x93e4('0xc'),EXTRACTED_REPORT_ID,_0x93e4('0xd')));return db[_0x93e4('0xe')]['find']({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x93e4('0xf'),_0x93e4('0x10')]})[_0x93e4('0x11')](function(_0x4d5d66){if(_0x4d5d66){_0x53a943=_0x4d5d66;_0x113d53=_0x53a943[_0x93e4('0x10')]||0x1388;}})[_0x93e4('0x11')](function(){return dbH['sequelize'][_0x93e4('0x12')](util[_0x93e4('0xb')](_0x93e4('0x13'),QUERY),{'type':dbH[_0x93e4('0x14')]['QueryTypes'][_0x93e4('0x15')]});})['then'](function(_0x4ba240){if(!_0x4ba240[0x0][_0x93e4('0x16')]){return analyticExtractedReport(_0x93e4('0x17'));}var _0x5b1a67=[];var _0x123da8=0x0;var _0x1e869d=!![];if(_0x53a943['split']){if(_0x4ba240&&_0x4ba240[_0x93e4('0x18')]){var _0x3dcd64=_0x4ba240[0x0]['num']%(_0x123da8+_0x113d53);for(;_0x1e869d;_0x123da8+=_0x113d53,_0x3dcd64=_0x4ba240[0x0][_0x93e4('0x16')]%(_0x123da8+_0x113d53)){if(_0x3dcd64==0x0||_0x3dcd64==_0x4ba240[0x0]['num']){_0x1e869d=![];}_0x5b1a67[_0x93e4('0x19')](dbH[_0x93e4('0x14')]['query'](util[_0x93e4('0xb')](_0x93e4('0x1a'),QUERY,_0x113d53,_0x123da8),{'type':dbH[_0x93e4('0x14')][_0x93e4('0x1b')][_0x93e4('0x15')]}));}}}else{_0x5b1a67[_0x93e4('0x19')](dbH['sequelize']['query'](QUERY,{'type':dbH[_0x93e4('0x14')][_0x93e4('0x1b')][_0x93e4('0x15')]}));}var _0x5e5d80=path['dirname'](PATH);var _0x24d823=path[_0x93e4('0x1c')](PATH,_0x93e4('0x1d'));var _0x134b06=_0x53a943[_0x93e4('0xf')]&&_0x5b1a67[_0x93e4('0x18')]>0x1;var _0xfb0f51=[];if(!fs[_0x93e4('0x1e')](path[_0x93e4('0x1f')](_0x5e5d80,_0x24d823))&&_0x134b06){fs[_0x93e4('0x20')](path[_0x93e4('0x1f')](_0x5e5d80,_0x24d823));}return BPromise['each'](_0x5b1a67,function(_0xd3559e){_0xfb0f51[_0x93e4('0x19')](_0xd3559e);})[_0x93e4('0x11')](function(){for(var _0x2f259b=0x0;_0x2f259b<_0xfb0f51[_0x93e4('0x18')];_0x2f259b+=0x1){var _0xd292c;var _0x3761c9=_0xfb0f51[_0x2f259b];if(_0x134b06){_0xd292c=path[_0x93e4('0x1f')](_0x5e5d80,_0x24d823,util[_0x93e4('0xb')]('%s%d.%s',_0x24d823,_0x2f259b,_0x93e4('0x21')));}else{_0xd292c=path[_0x93e4('0x1f')](_0x5e5d80,util['format'](_0x93e4('0x22'),_0x24d823,_0x93e4('0x21')));}fs[_0x93e4('0x23')](_0xd292c,json2xls(_0x3761c9),'binary');}})[_0x93e4('0x11')](function(){if(_0x134b06){zipdir(path[_0x93e4('0x1f')](_0x5e5d80,_0x24d823),{'saveTo':path[_0x93e4('0x1f')](_0x5e5d80,util['format']('%s.%s',_0x24d823,'zip'))},function(_0x29ecec,_0x1091e7){});rimraf(path[_0x93e4('0x1f')](_0x5e5d80,_0x24d823),function(){});}})[_0x93e4('0x11')](function(){logger[_0x93e4('0xa')](util[_0x93e4('0xb')](_0x93e4('0x24'),EXTRACTED_REPORT_ID,_0x93e4('0xd')));return analyticExtractedReport('Completed',_0x134b06?util[_0x93e4('0xb')](_0x93e4('0x22'),_0x24d823,_0x134b06?'zip':_0x93e4('0x21')):null);});})['catch'](function(_0x173746){logger['info'](util[_0x93e4('0xb')](_0x93e4('0x25'),EXTRACTED_REPORT_ID,_0x93e4('0xd')),util[_0x93e4('0x26')](_0x173746,{'showHidden':![],'depth':null}));return analyticExtractedReport(_0x93e4('0x27'));});}main(); \ No newline at end of file +var _0x853e=['sequelize','query','format','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','num','Empty','length','push','QueryTypes','SELECT','dirname','basename','.xlsx','existsSync','join','each','%s%d.%s','%s.%s','xlsx','writeFileSync','binary','zip','info','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','XLSX','Completed','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','Failed','path','json2xls','zip-dir','../../mysqldb','dbH','../../config/logger','analytics','argv','savename','AnalyticExtractedReport','update','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','find','split','splitSizeXlsx','then'];(function(_0x9729d7,_0x1b79a8){var _0x3c4ac6=function(_0x401ba6){while(--_0x401ba6){_0x9729d7['push'](_0x9729d7['shift']());}};_0x3c4ac6(++_0x1b79a8);}(_0x853e,0x1ea));var _0xe853=function(_0x5988c3,_0x552fa9){_0x5988c3=_0x5988c3-0x0;var _0x429c0a=_0x853e[_0x5988c3];return _0x429c0a;};'use strict';var util=require('util');var path=require(_0xe853('0x0'));var _=require('lodash');var fs=require('fs');var json2xls=require(_0xe853('0x1'));var BPromise=require('bluebird');var zipdir=require(_0xe853('0x2'));var rimraf=require('rimraf');var db=require(_0xe853('0x3'))['db'];var dbH=require(_0xe853('0x3'))[_0xe853('0x4')];var logger=require(_0xe853('0x5'))(_0xe853('0x6'));var EXTRACTED_REPORT_ID=Number(process['argv'][0x2]);var QUERY=process[_0xe853('0x7')][0x3];var PATH=process[_0xe853('0x7')][0x4];function analyticExtractedReport(_0xab8d0d,_0x25e6e1){var _0xe3d468={'status':_0xab8d0d};var _0x36d502={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x25e6e1){_0xe3d468[_0xe853('0x8')]=_0x25e6e1;}return db[_0xe853('0x9')][_0xe853('0xa')](_0xe3d468,_0x36d502);}function main(){var _0x15bfe2=0x1388;var _0x478b19;logger['info'](util['format'](_0xe853('0xb'),EXTRACTED_REPORT_ID,'XLSX'));return db['Setting'][_0xe853('0xc')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0xe853('0xd'),_0xe853('0xe')]})['then'](function(_0x88883f){if(_0x88883f){_0x478b19=_0x88883f;_0x15bfe2=_0x478b19[_0xe853('0xe')]||0x1388;}})[_0xe853('0xf')](function(){return dbH[_0xe853('0x10')][_0xe853('0x11')](util[_0xe853('0x12')](_0xe853('0x13'),QUERY),{'type':dbH['sequelize']['QueryTypes']['SELECT']});})['then'](function(_0x156940){if(!_0x156940[0x0][_0xe853('0x14')]){return analyticExtractedReport(_0xe853('0x15'));}var _0x11e4a0=[];var _0x21c5f0=0x0;var _0x9309a5=!![];if(_0x478b19[_0xe853('0xd')]){if(_0x156940&&_0x156940[_0xe853('0x16')]){var _0x2a98fa=_0x156940[0x0][_0xe853('0x14')]%(_0x21c5f0+_0x15bfe2);for(;_0x9309a5;_0x21c5f0+=_0x15bfe2,_0x2a98fa=_0x156940[0x0][_0xe853('0x14')]%(_0x21c5f0+_0x15bfe2)){if(_0x2a98fa==0x0||_0x2a98fa==_0x156940[0x0][_0xe853('0x14')]){_0x9309a5=![];}_0x11e4a0[_0xe853('0x17')](dbH[_0xe853('0x10')][_0xe853('0x11')](util[_0xe853('0x12')]('%s\x20limit\x20%d\x20OFFSET\x20%d',QUERY,_0x15bfe2,_0x21c5f0),{'type':dbH[_0xe853('0x10')][_0xe853('0x18')][_0xe853('0x19')]}));}}}else{_0x11e4a0[_0xe853('0x17')](dbH[_0xe853('0x10')][_0xe853('0x11')](QUERY,{'type':dbH[_0xe853('0x10')][_0xe853('0x18')][_0xe853('0x19')]}));}var _0x16ca53=path[_0xe853('0x1a')](PATH);var _0x4d895e=path[_0xe853('0x1b')](PATH,_0xe853('0x1c'));var _0xfadfc6=_0x478b19[_0xe853('0xd')]&&_0x11e4a0[_0xe853('0x16')]>0x1;var _0xc875b2=[];if(!fs[_0xe853('0x1d')](path[_0xe853('0x1e')](_0x16ca53,_0x4d895e))&&_0xfadfc6){fs['mkdirSync'](path[_0xe853('0x1e')](_0x16ca53,_0x4d895e));}return BPromise[_0xe853('0x1f')](_0x11e4a0,function(_0x198895){_0xc875b2[_0xe853('0x17')](_0x198895);})[_0xe853('0xf')](function(){for(var _0x58454e=0x0;_0x58454e<_0xc875b2[_0xe853('0x16')];_0x58454e+=0x1){var _0x33e0b0;var _0x49d8ed=_0xc875b2[_0x58454e];if(_0xfadfc6){_0x33e0b0=path[_0xe853('0x1e')](_0x16ca53,_0x4d895e,util['format'](_0xe853('0x20'),_0x4d895e,_0x58454e,'xlsx'));}else{_0x33e0b0=path['join'](_0x16ca53,util[_0xe853('0x12')](_0xe853('0x21'),_0x4d895e,_0xe853('0x22')));}fs[_0xe853('0x23')](_0x33e0b0,json2xls(_0x49d8ed),_0xe853('0x24'));}})[_0xe853('0xf')](function(){if(_0xfadfc6){zipdir(path[_0xe853('0x1e')](_0x16ca53,_0x4d895e),{'saveTo':path[_0xe853('0x1e')](_0x16ca53,util[_0xe853('0x12')](_0xe853('0x21'),_0x4d895e,_0xe853('0x25')))},function(_0x5d4876,_0x139fa2){});rimraf(path[_0xe853('0x1e')](_0x16ca53,_0x4d895e),function(){});}})['then'](function(){logger[_0xe853('0x26')](util['format'](_0xe853('0x27'),EXTRACTED_REPORT_ID,_0xe853('0x28')));return analyticExtractedReport(_0xe853('0x29'),_0xfadfc6?util['format'](_0xe853('0x21'),_0x4d895e,_0xfadfc6?_0xe853('0x25'):_0xe853('0x22')):null);});})[_0xe853('0x2a')](function(_0x245fda){logger[_0xe853('0x26')](util[_0xe853('0x12')](_0xe853('0x2b'),EXTRACTED_REPORT_ID,_0xe853('0x28')),util[_0xe853('0x2c')](_0x245fda,{'showHidden':![],'depth':null}));return analyticExtractedReport(_0xe853('0x2d'));});}main(); \ No newline at end of file diff --git a/server/components/extensions/rewrite.js b/server/components/extensions/rewrite.js index d014f33..3c3e48a 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 _0x0c39=['CDR(type)=%s','type','priority','VoiceExtensionId','outbound','CDR(destination)=','cutdigits','${EXTEN}','context','ExecIf','CDR(prefix)=${EXTEN:0:','CDR(prefix)=noprefix','outboundrouteid=','recordingFormat','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','wav','XCALLY-MOTION-ANSWER=0','XCALLY-MOTION-PROGRESS=0','toLowerCase','createdAt','interval','IntervalId','tag','length','callerID','answer','indexOf','app','appType','custom','$[${XCALLY-MOTION-ANSWER}=0]?Answer','XCALLY-MOTION-ANSWER=1','$[${XCALLY-MOTION-PROGRESS}=0]?Progress','XCALLY-MOTION-PROGRESS=1','GotoIfTime',',${EXTEN},','last','concat','Hangup','transaction','destroy','bulkCreate','catch','error','rewrite','lodash','util','models','Interval','findAll','intervals','VoiceExtension','uniq','map','exten','then','filter','queue','hasOwnProperty','extension','find','extensions','push','Set','format'];(function(_0x1f683b,_0x46d82f){var _0x5d3942=function(_0x244c11){while(--_0x244c11){_0x1f683b['push'](_0x1f683b['shift']());}};_0x5d3942(++_0x46d82f);}(_0x0c39,0x1b3));var _0x90c3=function(_0x17e742,_0xea41ae){_0x17e742=_0x17e742-0x0;var _0x59692b=_0x0c39[_0x17e742];return _0x59692b;};'use strict';var _=require(_0x90c3('0x0'));var util=require(_0x90c3('0x1'));function rewrite(_0x4ad325,_0x2aed18){var _0x5760f9=this;return _0x4ad325[_0x90c3('0x2')][_0x90c3('0x3')][_0x90c3('0x4')]({'raw':!![]})['then'](function(_0xdb1e35){_0x5760f9[_0x90c3('0x5')]=_0xdb1e35;return _0x4ad325[_0x90c3('0x2')][_0x90c3('0x6')][_0x90c3('0x4')]({'where':{'IntervalId':_0x2aed18['IntervalId']},'raw':!![]});})['then'](function(_0x292444){return _0x4ad325[_0x90c3('0x2')][_0x90c3('0x6')][_0x90c3('0x4')]({'where':{'exten':{'$in':_[_0x90c3('0x7')](_[_0x90c3('0x8')](_0x292444,_0x90c3('0x9')))}},'order':[{'raw':'CAST(priority\x20AS\x20UNSIGNED)'}],'raw':!![]});})[_0x90c3('0xa')](function(_0x34ba1e){var _0x5b351c=_[_0x90c3('0xb')](_0x34ba1e,{'priority':'1'});var _0x391d1b=_[_0x90c3('0xb')](_0x34ba1e,{'isApp':0x1});var _0x1fdf57=_['groupBy'](_0x391d1b,_0x90c3('0x9'));var _0x4be865=[_0x90c3('0xc'),'playback'];var _0x13f5dd=[];var _0x1992a8=[];for(var _0x527ae0 in _0x1fdf57){if(_0x1fdf57[_0x90c3('0xd')](_0x527ae0)){_0x5760f9['priority']=0x2;_0x5760f9['extensions']=[];_0x5760f9[_0x90c3('0xe')]=_[_0x90c3('0xf')](_0x5b351c,{'exten':_0x1fdf57[_0x527ae0][0x0][_0x90c3('0x9')]});_0x5760f9[_0x90c3('0x10')][_0x90c3('0x11')]({'type':_0x1fdf57[_0x527ae0][0x0]['type'],'app':_0x90c3('0x12'),'appdata':util[_0x90c3('0x13')](_0x90c3('0x14'),_0x1fdf57[_0x527ae0][0x0][_0x90c3('0x15')]),'context':_0x1fdf57[_0x527ae0][0x0]['context'],'exten':_0x1fdf57[_0x527ae0][0x0][_0x90c3('0x9')],'priority':_0x5760f9[_0x90c3('0x16')]++,'VoiceExtensionId':_0x1fdf57[_0x527ae0][0x0][_0x90c3('0x17')]});if(_0x1fdf57[_0x527ae0][0x0][_0x90c3('0x15')]===_0x90c3('0x18')){if(_0x5760f9['extension']){_0x5760f9[_0x90c3('0x10')][_0x90c3('0x11')]({'type':_0x1fdf57[_0x527ae0][0x0]['type'],'app':_0x90c3('0x12'),'appdata':_0x90c3('0x19')+(_0x5760f9['extension'][_0x90c3('0x1a')]?'${EXTEN:'+_0x5760f9['extension'][_0x90c3('0x1a')]+'}':_0x90c3('0x1b')),'context':_0x1fdf57[_0x527ae0][0x0][_0x90c3('0x1c')],'exten':_0x1fdf57[_0x527ae0][0x0][_0x90c3('0x9')],'priority':_0x5760f9['priority']++,'VoiceExtensionId':_0x1fdf57[_0x527ae0][0x0][_0x90c3('0x17')]});}_0x5760f9[_0x90c3('0x10')][_0x90c3('0x11')]({'type':_0x1fdf57[_0x527ae0][0x0][_0x90c3('0x15')],'app':_0x90c3('0x12'),'appdata':'CDR(routeid)='+_0x1fdf57[_0x527ae0][0x0][_0x90c3('0x17')],'context':_0x1fdf57[_0x527ae0][0x0][_0x90c3('0x1c')],'exten':_0x1fdf57[_0x527ae0][0x0][_0x90c3('0x9')],'priority':_0x5760f9[_0x90c3('0x16')]++,'VoiceExtensionId':_0x1fdf57[_0x527ae0][0x0][_0x90c3('0x17')]});var _0x3ac883=_0x5760f9['priority']++;_0x5760f9['extensions'][_0x90c3('0x11')]({'type':_0x1fdf57[_0x527ae0][0x0][_0x90c3('0x15')],'app':_0x90c3('0x1d'),'appdata':'$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto('+(_0x3ac883+0x2)+'):Goto('+(_0x3ac883+0x1)+')','context':_0x1fdf57[_0x527ae0][0x0]['context'],'exten':_0x1fdf57[_0x527ae0][0x0][_0x90c3('0x9')],'priority':_0x3ac883,'VoiceExtensionId':_0x1fdf57[_0x527ae0][0x0][_0x90c3('0x17')]});if(_0x5760f9['extension']){_0x5760f9['extensions']['push']({'type':_0x1fdf57[_0x527ae0][0x0][_0x90c3('0x15')],'app':_0x90c3('0x12'),'appdata':_0x5760f9[_0x90c3('0xe')][_0x90c3('0x1a')]?_0x90c3('0x1e')+_0x5760f9[_0x90c3('0xe')][_0x90c3('0x1a')]+'}':_0x90c3('0x1f'),'context':_0x1fdf57[_0x527ae0][0x0][_0x90c3('0x1c')],'exten':_0x1fdf57[_0x527ae0][0x0][_0x90c3('0x9')],'priority':_0x5760f9[_0x90c3('0x16')]++,'VoiceExtensionId':_0x1fdf57[_0x527ae0][0x0][_0x90c3('0x17')]});}_0x5760f9[_0x90c3('0x10')][_0x90c3('0x11')]({'type':_0x1fdf57[_0x527ae0][0x0]['type'],'app':'Set','appdata':_0x90c3('0x20')+_0x1fdf57[_0x527ae0][0x0][_0x90c3('0x17')],'context':_0x1fdf57[_0x527ae0][0x0][_0x90c3('0x1c')],'exten':_0x1fdf57[_0x527ae0][0x0][_0x90c3('0x9')],'priority':_0x5760f9[_0x90c3('0x16')]++,'VoiceExtensionId':_0x1fdf57[_0x527ae0][0x0][_0x90c3('0x17')]});if(_0x5760f9[_0x90c3('0xe')]&&_0x5760f9[_0x90c3('0xe')]['hasOwnProperty'](_0x90c3('0x21'))&&_0x5760f9[_0x90c3('0xe')][_0x90c3('0x21')]!=='none'){_0x5760f9[_0x90c3('0x10')]['push']({'type':_0x1fdf57[_0x527ae0][0x0][_0x90c3('0x15')],'app':_0x90c3('0x12'),'appdata':_0x90c3('0x22'),'context':_0x1fdf57[_0x527ae0][0x0]['context'],'exten':_0x1fdf57[_0x527ae0][0x0][_0x90c3('0x9')],'priority':_0x5760f9[_0x90c3('0x16')]++,'VoiceExtensionId':_0x1fdf57[_0x527ae0][0x0][_0x90c3('0x17')]});_0x5760f9[_0x90c3('0x10')][_0x90c3('0x11')]({'type':_0x1fdf57[_0x527ae0][0x0][_0x90c3('0x15')],'app':'Set','appdata':'_XCALLY_MIXMONITOR_FORMAT='+_0x5760f9[_0x90c3('0xe')][_0x90c3('0x21')]||_0x90c3('0x23'),'context':_0x1fdf57[_0x527ae0][0x0][_0x90c3('0x1c')],'exten':_0x1fdf57[_0x527ae0][0x0][_0x90c3('0x9')],'priority':_0x5760f9[_0x90c3('0x16')]++,'VoiceExtensionId':_0x1fdf57[_0x527ae0][0x0]['VoiceExtensionId']});}}_0x5760f9[_0x90c3('0x10')][_0x90c3('0x11')]({'type':_0x1fdf57[_0x527ae0][0x0][_0x90c3('0x15')],'app':_0x90c3('0x12'),'appdata':_0x90c3('0x24'),'context':_0x1fdf57[_0x527ae0][0x0][_0x90c3('0x1c')],'exten':_0x1fdf57[_0x527ae0][0x0][_0x90c3('0x9')],'priority':_0x5760f9['priority']++,'VoiceExtensionId':_0x1fdf57[_0x527ae0][0x0][_0x90c3('0x17')]});_0x5760f9[_0x90c3('0x10')][_0x90c3('0x11')]({'type':_0x1fdf57[_0x527ae0][0x0][_0x90c3('0x15')],'app':_0x90c3('0x12'),'appdata':_0x90c3('0x25'),'context':_0x1fdf57[_0x527ae0][0x0][_0x90c3('0x1c')],'exten':_0x1fdf57[_0x527ae0][0x0][_0x90c3('0x9')],'priority':_0x5760f9[_0x90c3('0x16')]++,'VoiceExtensionId':_0x1fdf57[_0x527ae0][0x0][_0x90c3('0x17')]});_0x5760f9[_0x90c3('0x10')][_0x90c3('0x11')]({'type':_0x1fdf57[_0x527ae0][0x0][_0x90c3('0x15')],'app':'Set','appdata':'MONITOR_OPTIONS=ab','context':_0x1fdf57[_0x527ae0][0x0][_0x90c3('0x1c')],'exten':_0x1fdf57[_0x527ae0][0x0][_0x90c3('0x9')],'priority':_0x5760f9[_0x90c3('0x16')]++,'VoiceExtensionId':_0x1fdf57[_0x527ae0][0x0][_0x90c3('0x17')]});for(var _0x44616f=0x0,_0x1c1adf=0x0;_0x44616f<_0x1fdf57[_0x527ae0]['length'];_0x44616f+=0x1,_0x1c1adf=0x0){var _0x58c0f0=_0x1fdf57[_0x527ae0][_0x44616f];if(_0x58c0f0['type']){_0x58c0f0[_0x90c3('0x15')]=_0x58c0f0[_0x90c3('0x15')][_0x90c3('0x26')]();}var _0x421803=[];var _0x50e1f0=[];delete _0x58c0f0['id'];delete _0x58c0f0[_0x90c3('0x27')];delete _0x58c0f0['updatedAt'];var _0x50bef=_0x58c0f0[_0x90c3('0x28')]!=='*,*,*,*'?[_0x58c0f0['interval']]:_0x58c0f0[_0x90c3('0x29')]?_['map'](_[_0x90c3('0xb')](_0x5760f9[_0x90c3('0x5')],{'IntervalId':_0x58c0f0[_0x90c3('0x29')]}),_0x90c3('0x28')):[];if(_0x58c0f0[_0x90c3('0xd')]('tag')){if(_0x58c0f0['tag']&&_0x58c0f0[_0x90c3('0x2a')]!=='--'){_0x421803[_0x90c3('0x11')]({'type':_0x58c0f0[_0x90c3('0x15')],'app':_0x90c3('0x12'),'appdata':'CDR(tag)='+_0x58c0f0[_0x90c3('0x2a')],'context':_0x58c0f0['context'],'exten':_0x58c0f0['exten'],'priority':_0x50bef[_0x90c3('0x2b')]+_0x5760f9[_0x90c3('0x16')]+_0x1c1adf++,'VoiceExtensionId':_0x58c0f0[_0x90c3('0x17')]});}}if(_0x58c0f0['type']===_0x90c3('0x18')&&_0x58c0f0[_0x90c3('0xd')](_0x90c3('0x2c'))){if(_0x58c0f0[_0x90c3('0x2c')]){_0x421803[_0x90c3('0x11')]({'type':_0x58c0f0['type'],'app':_0x90c3('0x1d'),'appdata':'$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):Set(CALLERID(all)='+_0x58c0f0[_0x90c3('0x2c')]+')','context':_0x58c0f0['context'],'exten':_0x58c0f0[_0x90c3('0x9')],'priority':_0x50bef['length']+_0x5760f9[_0x90c3('0x16')]+_0x1c1adf++,'VoiceExtensionId':_0x58c0f0[_0x90c3('0x17')]});}else{_0x421803[_0x90c3('0x11')]({'type':_0x58c0f0['type'],'app':_0x90c3('0x1d'),'appdata':'$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):NoOp(No\x20number\x20available)','context':_0x58c0f0[_0x90c3('0x1c')],'exten':_0x58c0f0[_0x90c3('0x9')],'priority':_0x50bef['length']+_0x5760f9[_0x90c3('0x16')]+_0x1c1adf++,'VoiceExtensionId':_0x58c0f0['VoiceExtensionId']});}}if(_0x58c0f0[_0x90c3('0xd')](_0x90c3('0x2d'))){if(_0x4be865[_0x90c3('0x2e')](_0x58c0f0[_0x90c3('0x2f')][_0x90c3('0x26')]())>=0x0&&_0x58c0f0[_0x90c3('0x30')]!==_0x90c3('0x31')){if(_0x58c0f0['answer']){_0x421803[_0x90c3('0x11')]({'type':_0x58c0f0[_0x90c3('0x15')],'app':_0x90c3('0x1d'),'appdata':_0x90c3('0x32'),'context':_0x58c0f0[_0x90c3('0x1c')],'exten':_0x58c0f0[_0x90c3('0x9')],'priority':_0x50bef[_0x90c3('0x2b')]+_0x5760f9[_0x90c3('0x16')]+_0x1c1adf++,'VoiceExtensionId':_0x58c0f0[_0x90c3('0x17')]});_0x421803[_0x90c3('0x11')]({'type':_0x58c0f0[_0x90c3('0x15')],'app':_0x90c3('0x12'),'appdata':_0x90c3('0x33'),'context':_0x58c0f0[_0x90c3('0x1c')],'exten':_0x58c0f0[_0x90c3('0x9')],'priority':_0x50bef[_0x90c3('0x2b')]+_0x5760f9[_0x90c3('0x16')]+_0x1c1adf++,'VoiceExtensionId':_0x58c0f0['VoiceExtensionId']});}else{_0x421803[_0x90c3('0x11')]({'type':_0x58c0f0[_0x90c3('0x15')],'app':_0x90c3('0x1d'),'appdata':_0x90c3('0x34'),'context':_0x58c0f0[_0x90c3('0x1c')],'exten':_0x58c0f0[_0x90c3('0x9')],'priority':_0x50bef['length']+_0x5760f9[_0x90c3('0x16')]+_0x1c1adf++,'VoiceExtensionId':_0x58c0f0[_0x90c3('0x17')]});_0x421803[_0x90c3('0x11')]({'type':_0x58c0f0[_0x90c3('0x15')],'app':_0x90c3('0x12'),'appdata':_0x90c3('0x35'),'context':_0x58c0f0[_0x90c3('0x1c')],'exten':_0x58c0f0[_0x90c3('0x9')],'priority':_0x50bef[_0x90c3('0x2b')]+_0x5760f9[_0x90c3('0x16')]+_0x1c1adf++,'VoiceExtensionId':_0x58c0f0[_0x90c3('0x17')]});}}}for(var _0x1e6373=0x0;_0x1e6373<_0x50bef[_0x90c3('0x2b')];_0x1e6373+=0x1){var _0x390b08=_0x5760f9[_0x90c3('0x16')]+_0x50bef[_0x90c3('0x2b')];var _0x7f1467=_0x1e6373===_0x50bef[_0x90c3('0x2b')]-0x1?_0x5760f9[_0x90c3('0x16')]+_0x421803[_0x90c3('0x2b')]+_0x50e1f0['length']+0x2:_0x5760f9[_0x90c3('0x16')]+_0x1e6373+0x1;_0x421803['splice'](_0x1e6373,0x0,{'type':_0x58c0f0['type'],'app':_0x90c3('0x36'),'appdata':_0x50bef[_0x1e6373]+'?'+_0x58c0f0[_0x90c3('0x1c')]+_0x90c3('0x37')+_0x390b08+':'+_0x58c0f0[_0x90c3('0x1c')]+_0x90c3('0x37')+_0x7f1467,'exten':_0x58c0f0[_0x90c3('0x9')],'context':_0x58c0f0[_0x90c3('0x1c')],'priority':_0x5760f9[_0x90c3('0x16')]+_0x1e6373,'VoiceExtensionId':_0x1fdf57[_0x527ae0][0x0][_0x90c3('0x17')]});}_0x58c0f0[_0x90c3('0x16')]=_0x421803[_0x90c3('0x2b')]?_[_0x90c3('0x38')](_0x421803)[_0x90c3('0x16')]+0x1:_0x5760f9[_0x90c3('0x16')];_0x5760f9[_0x90c3('0x16')]=(_0x50e1f0['length']?_[_0x90c3('0x38')](_0x50e1f0)[_0x90c3('0x16')]:_0x58c0f0[_0x90c3('0x16')])+0x1;_0x5760f9[_0x90c3('0x10')]=_[_0x90c3('0x39')](_0x5760f9[_0x90c3('0x10')],_0x421803,[_0x58c0f0],_0x50e1f0);}_0x5760f9[_0x90c3('0x10')]['push']({'type':_0x1fdf57[_0x527ae0][0x0][_0x90c3('0x15')],'app':_0x90c3('0x3a'),'exten':_0x1fdf57[_0x527ae0][0x0][_0x90c3('0x9')],'context':_0x1fdf57[_0x527ae0][0x0][_0x90c3('0x1c')],'priority':_0x5760f9[_0x90c3('0x16')],'VoiceExtensionId':_0x1fdf57[_0x527ae0][0x0][_0x90c3('0x17')]});_0x13f5dd['push'](_0x1fdf57[_0x527ae0][0x0][_0x90c3('0x17')]);_0x1992a8=_['concat'](_0x1992a8,_0x5760f9['extensions']);}}return _0x4ad325[_0x90c3('0x3b')](function(_0x2a0646){return _0x4ad325[_0x90c3('0x2')]['VoiceExtension'][_0x90c3('0x3c')]({'where':{'VoiceExtensionId':{'$in':_0x13f5dd}},'transaction':_0x2a0646})[_0x90c3('0xa')](function(_0x463209){return _0x4ad325[_0x90c3('0x2')][_0x90c3('0x6')][_0x90c3('0x3d')](_['sortBy'](_0x1992a8,_0x90c3('0x16')),{'transaction':_0x2a0646});});});})[_0x90c3('0x3e')](function(_0xf5891e){console[_0x90c3('0x3f')](_0xf5891e);});}exports[_0x90c3('0x40')]=rewrite; \ No newline at end of file +var _0x8cfd=['VoiceExtension','uniq','map','CAST(priority\x20AS\x20UNSIGNED)','filter','groupBy','exten','queue','hasOwnProperty','extensions','extension','find','type','Set','format','CDR(type)=%s','context','priority','VoiceExtensionId','outbound','push','CDR(destination)=','cutdigits','${EXTEN:','${EXTEN}','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','XCALLY-MOTION-PROGRESS=0','MONITOR_OPTIONS=ab','length','toLowerCase','createdAt','updatedAt','*,*,*,*','IntervalId','interval','tag','CDR(tag)=','callerID','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):Set(CALLERID(all)=','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):NoOp(No\x20number\x20available)','indexOf','app','appType','custom','answer','$[${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','destroy','bulkCreate','sortBy','catch','error','rewrite','lodash','util','models','findAll','then','intervals'];(function(_0x5b8a43,_0x451c94){var _0x4f899f=function(_0x5273be){while(--_0x5273be){_0x5b8a43['push'](_0x5b8a43['shift']());}};_0x4f899f(++_0x451c94);}(_0x8cfd,0xe4));var _0xd8cf=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0x8cfd[_0x19950b];return _0x3c6b41;};'use strict';var _=require(_0xd8cf('0x0'));var util=require(_0xd8cf('0x1'));function rewrite(_0x370288,_0x1935a9){var _0x6ea39=this;return _0x370288[_0xd8cf('0x2')]['Interval'][_0xd8cf('0x3')]({'raw':!![]})[_0xd8cf('0x4')](function(_0x35b295){_0x6ea39[_0xd8cf('0x5')]=_0x35b295;return _0x370288[_0xd8cf('0x2')][_0xd8cf('0x6')][_0xd8cf('0x3')]({'where':{'IntervalId':_0x1935a9['IntervalId']},'raw':!![]});})['then'](function(_0x3fe2d2){return _0x370288[_0xd8cf('0x2')][_0xd8cf('0x6')][_0xd8cf('0x3')]({'where':{'exten':{'$in':_[_0xd8cf('0x7')](_[_0xd8cf('0x8')](_0x3fe2d2,'exten'))}},'order':[{'raw':_0xd8cf('0x9')}],'raw':!![]});})[_0xd8cf('0x4')](function(_0x34aeff){var _0x895caf=_[_0xd8cf('0xa')](_0x34aeff,{'priority':'1'});var _0xb8081=_[_0xd8cf('0xa')](_0x34aeff,{'isApp':0x1});var _0x2c267a=_[_0xd8cf('0xb')](_0xb8081,_0xd8cf('0xc'));var _0x2df373=[_0xd8cf('0xd'),'playback'];var _0x8e55f2=[];var _0x507c1d=[];for(var _0x293985 in _0x2c267a){if(_0x2c267a[_0xd8cf('0xe')](_0x293985)){_0x6ea39['priority']=0x2;_0x6ea39[_0xd8cf('0xf')]=[];_0x6ea39[_0xd8cf('0x10')]=_[_0xd8cf('0x11')](_0x895caf,{'exten':_0x2c267a[_0x293985][0x0]['exten']});_0x6ea39[_0xd8cf('0xf')]['push']({'type':_0x2c267a[_0x293985][0x0][_0xd8cf('0x12')],'app':_0xd8cf('0x13'),'appdata':util[_0xd8cf('0x14')](_0xd8cf('0x15'),_0x2c267a[_0x293985][0x0][_0xd8cf('0x12')]),'context':_0x2c267a[_0x293985][0x0][_0xd8cf('0x16')],'exten':_0x2c267a[_0x293985][0x0]['exten'],'priority':_0x6ea39[_0xd8cf('0x17')]++,'VoiceExtensionId':_0x2c267a[_0x293985][0x0][_0xd8cf('0x18')]});if(_0x2c267a[_0x293985][0x0][_0xd8cf('0x12')]===_0xd8cf('0x19')){if(_0x6ea39[_0xd8cf('0x10')]){_0x6ea39[_0xd8cf('0xf')][_0xd8cf('0x1a')]({'type':_0x2c267a[_0x293985][0x0][_0xd8cf('0x12')],'app':_0xd8cf('0x13'),'appdata':_0xd8cf('0x1b')+(_0x6ea39[_0xd8cf('0x10')][_0xd8cf('0x1c')]?_0xd8cf('0x1d')+_0x6ea39[_0xd8cf('0x10')]['cutdigits']+'}':_0xd8cf('0x1e')),'context':_0x2c267a[_0x293985][0x0][_0xd8cf('0x16')],'exten':_0x2c267a[_0x293985][0x0][_0xd8cf('0xc')],'priority':_0x6ea39[_0xd8cf('0x17')]++,'VoiceExtensionId':_0x2c267a[_0x293985][0x0][_0xd8cf('0x18')]});}_0x6ea39['extensions'][_0xd8cf('0x1a')]({'type':_0x2c267a[_0x293985][0x0]['type'],'app':'Set','appdata':'CDR(routeid)='+_0x2c267a[_0x293985][0x0][_0xd8cf('0x18')],'context':_0x2c267a[_0x293985][0x0]['context'],'exten':_0x2c267a[_0x293985][0x0][_0xd8cf('0xc')],'priority':_0x6ea39[_0xd8cf('0x17')]++,'VoiceExtensionId':_0x2c267a[_0x293985][0x0][_0xd8cf('0x18')]});var _0x667f44=_0x6ea39['priority']++;_0x6ea39[_0xd8cf('0xf')][_0xd8cf('0x1a')]({'type':_0x2c267a[_0x293985][0x0][_0xd8cf('0x12')],'app':_0xd8cf('0x1f'),'appdata':_0xd8cf('0x20')+(_0x667f44+0x2)+_0xd8cf('0x21')+(_0x667f44+0x1)+')','context':_0x2c267a[_0x293985][0x0]['context'],'exten':_0x2c267a[_0x293985][0x0][_0xd8cf('0xc')],'priority':_0x667f44,'VoiceExtensionId':_0x2c267a[_0x293985][0x0][_0xd8cf('0x18')]});if(_0x6ea39['extension']){_0x6ea39[_0xd8cf('0xf')][_0xd8cf('0x1a')]({'type':_0x2c267a[_0x293985][0x0][_0xd8cf('0x12')],'app':_0xd8cf('0x13'),'appdata':_0x6ea39[_0xd8cf('0x10')]['cutdigits']?_0xd8cf('0x22')+_0x6ea39[_0xd8cf('0x10')][_0xd8cf('0x1c')]+'}':_0xd8cf('0x23'),'context':_0x2c267a[_0x293985][0x0][_0xd8cf('0x16')],'exten':_0x2c267a[_0x293985][0x0]['exten'],'priority':_0x6ea39[_0xd8cf('0x17')]++,'VoiceExtensionId':_0x2c267a[_0x293985][0x0][_0xd8cf('0x18')]});}_0x6ea39['extensions'][_0xd8cf('0x1a')]({'type':_0x2c267a[_0x293985][0x0][_0xd8cf('0x12')],'app':'Set','appdata':_0xd8cf('0x24')+_0x2c267a[_0x293985][0x0][_0xd8cf('0x18')],'context':_0x2c267a[_0x293985][0x0][_0xd8cf('0x16')],'exten':_0x2c267a[_0x293985][0x0]['exten'],'priority':_0x6ea39[_0xd8cf('0x17')]++,'VoiceExtensionId':_0x2c267a[_0x293985][0x0]['VoiceExtensionId']});if(_0x6ea39[_0xd8cf('0x10')]&&_0x6ea39[_0xd8cf('0x10')][_0xd8cf('0xe')](_0xd8cf('0x25'))&&_0x6ea39[_0xd8cf('0x10')][_0xd8cf('0x25')]!==_0xd8cf('0x26')){_0x6ea39[_0xd8cf('0xf')][_0xd8cf('0x1a')]({'type':_0x2c267a[_0x293985][0x0][_0xd8cf('0x12')],'app':_0xd8cf('0x13'),'appdata':'_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','context':_0x2c267a[_0x293985][0x0][_0xd8cf('0x16')],'exten':_0x2c267a[_0x293985][0x0][_0xd8cf('0xc')],'priority':_0x6ea39['priority']++,'VoiceExtensionId':_0x2c267a[_0x293985][0x0][_0xd8cf('0x18')]});_0x6ea39[_0xd8cf('0xf')]['push']({'type':_0x2c267a[_0x293985][0x0][_0xd8cf('0x12')],'app':_0xd8cf('0x13'),'appdata':_0xd8cf('0x27')+_0x6ea39[_0xd8cf('0x10')][_0xd8cf('0x25')]||_0xd8cf('0x28'),'context':_0x2c267a[_0x293985][0x0][_0xd8cf('0x16')],'exten':_0x2c267a[_0x293985][0x0][_0xd8cf('0xc')],'priority':_0x6ea39['priority']++,'VoiceExtensionId':_0x2c267a[_0x293985][0x0][_0xd8cf('0x18')]});}}_0x6ea39[_0xd8cf('0xf')][_0xd8cf('0x1a')]({'type':_0x2c267a[_0x293985][0x0]['type'],'app':_0xd8cf('0x13'),'appdata':_0xd8cf('0x29'),'context':_0x2c267a[_0x293985][0x0][_0xd8cf('0x16')],'exten':_0x2c267a[_0x293985][0x0][_0xd8cf('0xc')],'priority':_0x6ea39[_0xd8cf('0x17')]++,'VoiceExtensionId':_0x2c267a[_0x293985][0x0][_0xd8cf('0x18')]});_0x6ea39[_0xd8cf('0xf')][_0xd8cf('0x1a')]({'type':_0x2c267a[_0x293985][0x0][_0xd8cf('0x12')],'app':_0xd8cf('0x13'),'appdata':_0xd8cf('0x2a'),'context':_0x2c267a[_0x293985][0x0]['context'],'exten':_0x2c267a[_0x293985][0x0]['exten'],'priority':_0x6ea39['priority']++,'VoiceExtensionId':_0x2c267a[_0x293985][0x0][_0xd8cf('0x18')]});_0x6ea39['extensions']['push']({'type':_0x2c267a[_0x293985][0x0]['type'],'app':_0xd8cf('0x13'),'appdata':_0xd8cf('0x2b'),'context':_0x2c267a[_0x293985][0x0][_0xd8cf('0x16')],'exten':_0x2c267a[_0x293985][0x0][_0xd8cf('0xc')],'priority':_0x6ea39[_0xd8cf('0x17')]++,'VoiceExtensionId':_0x2c267a[_0x293985][0x0][_0xd8cf('0x18')]});for(var _0x59de32=0x0,_0x242696=0x0;_0x59de32<_0x2c267a[_0x293985][_0xd8cf('0x2c')];_0x59de32+=0x1,_0x242696=0x0){var _0x43f650=_0x2c267a[_0x293985][_0x59de32];if(_0x43f650[_0xd8cf('0x12')]){_0x43f650[_0xd8cf('0x12')]=_0x43f650[_0xd8cf('0x12')][_0xd8cf('0x2d')]();}var _0x3e0abb=[];var _0x533e48=[];delete _0x43f650['id'];delete _0x43f650[_0xd8cf('0x2e')];delete _0x43f650[_0xd8cf('0x2f')];var _0x3972aa=_0x43f650['interval']!==_0xd8cf('0x30')?[_0x43f650['interval']]:_0x43f650[_0xd8cf('0x31')]?_['map'](_['filter'](_0x6ea39['intervals'],{'IntervalId':_0x43f650['IntervalId']}),_0xd8cf('0x32')):[];if(_0x43f650[_0xd8cf('0xe')](_0xd8cf('0x33'))){if(_0x43f650['tag']&&_0x43f650['tag']!=='--'){_0x3e0abb[_0xd8cf('0x1a')]({'type':_0x43f650[_0xd8cf('0x12')],'app':_0xd8cf('0x13'),'appdata':_0xd8cf('0x34')+_0x43f650['tag'],'context':_0x43f650[_0xd8cf('0x16')],'exten':_0x43f650[_0xd8cf('0xc')],'priority':_0x3972aa[_0xd8cf('0x2c')]+_0x6ea39['priority']+_0x242696++,'VoiceExtensionId':_0x43f650[_0xd8cf('0x18')]});}}if(_0x43f650[_0xd8cf('0x12')]===_0xd8cf('0x19')&&_0x43f650[_0xd8cf('0xe')](_0xd8cf('0x35'))){if(_0x43f650[_0xd8cf('0x35')]){_0x3e0abb['push']({'type':_0x43f650[_0xd8cf('0x12')],'app':_0xd8cf('0x1f'),'appdata':_0xd8cf('0x36')+_0x43f650[_0xd8cf('0x35')]+')','context':_0x43f650[_0xd8cf('0x16')],'exten':_0x43f650[_0xd8cf('0xc')],'priority':_0x3972aa['length']+_0x6ea39[_0xd8cf('0x17')]+_0x242696++,'VoiceExtensionId':_0x43f650[_0xd8cf('0x18')]});}else{_0x3e0abb[_0xd8cf('0x1a')]({'type':_0x43f650['type'],'app':_0xd8cf('0x1f'),'appdata':_0xd8cf('0x37'),'context':_0x43f650[_0xd8cf('0x16')],'exten':_0x43f650[_0xd8cf('0xc')],'priority':_0x3972aa[_0xd8cf('0x2c')]+_0x6ea39[_0xd8cf('0x17')]+_0x242696++,'VoiceExtensionId':_0x43f650[_0xd8cf('0x18')]});}}if(_0x43f650[_0xd8cf('0xe')]('answer')){if(_0x2df373[_0xd8cf('0x38')](_0x43f650[_0xd8cf('0x39')][_0xd8cf('0x2d')]())>=0x0&&_0x43f650[_0xd8cf('0x3a')]!==_0xd8cf('0x3b')){if(_0x43f650[_0xd8cf('0x3c')]){_0x3e0abb[_0xd8cf('0x1a')]({'type':_0x43f650[_0xd8cf('0x12')],'app':_0xd8cf('0x1f'),'appdata':_0xd8cf('0x3d'),'context':_0x43f650[_0xd8cf('0x16')],'exten':_0x43f650[_0xd8cf('0xc')],'priority':_0x3972aa[_0xd8cf('0x2c')]+_0x6ea39[_0xd8cf('0x17')]+_0x242696++,'VoiceExtensionId':_0x43f650[_0xd8cf('0x18')]});_0x3e0abb[_0xd8cf('0x1a')]({'type':_0x43f650[_0xd8cf('0x12')],'app':_0xd8cf('0x13'),'appdata':_0xd8cf('0x3e'),'context':_0x43f650[_0xd8cf('0x16')],'exten':_0x43f650['exten'],'priority':_0x3972aa[_0xd8cf('0x2c')]+_0x6ea39[_0xd8cf('0x17')]+_0x242696++,'VoiceExtensionId':_0x43f650[_0xd8cf('0x18')]});}else{_0x3e0abb['push']({'type':_0x43f650[_0xd8cf('0x12')],'app':_0xd8cf('0x1f'),'appdata':_0xd8cf('0x3f'),'context':_0x43f650[_0xd8cf('0x16')],'exten':_0x43f650[_0xd8cf('0xc')],'priority':_0x3972aa[_0xd8cf('0x2c')]+_0x6ea39['priority']+_0x242696++,'VoiceExtensionId':_0x43f650['VoiceExtensionId']});_0x3e0abb[_0xd8cf('0x1a')]({'type':_0x43f650['type'],'app':_0xd8cf('0x13'),'appdata':_0xd8cf('0x40'),'context':_0x43f650[_0xd8cf('0x16')],'exten':_0x43f650['exten'],'priority':_0x3972aa[_0xd8cf('0x2c')]+_0x6ea39[_0xd8cf('0x17')]+_0x242696++,'VoiceExtensionId':_0x43f650[_0xd8cf('0x18')]});}}}for(var _0x326592=0x0;_0x326592<_0x3972aa[_0xd8cf('0x2c')];_0x326592+=0x1){var _0x1e247e=_0x6ea39[_0xd8cf('0x17')]+_0x3972aa['length'];var _0x399beb=_0x326592===_0x3972aa[_0xd8cf('0x2c')]-0x1?_0x6ea39[_0xd8cf('0x17')]+_0x3e0abb['length']+_0x533e48[_0xd8cf('0x2c')]+0x2:_0x6ea39[_0xd8cf('0x17')]+_0x326592+0x1;_0x3e0abb[_0xd8cf('0x41')](_0x326592,0x0,{'type':_0x43f650[_0xd8cf('0x12')],'app':_0xd8cf('0x42'),'appdata':_0x3972aa[_0x326592]+'?'+_0x43f650[_0xd8cf('0x16')]+_0xd8cf('0x43')+_0x1e247e+':'+_0x43f650['context']+_0xd8cf('0x43')+_0x399beb,'exten':_0x43f650[_0xd8cf('0xc')],'context':_0x43f650[_0xd8cf('0x16')],'priority':_0x6ea39['priority']+_0x326592,'VoiceExtensionId':_0x2c267a[_0x293985][0x0][_0xd8cf('0x18')]});}_0x43f650['priority']=_0x3e0abb[_0xd8cf('0x2c')]?_[_0xd8cf('0x44')](_0x3e0abb)['priority']+0x1:_0x6ea39[_0xd8cf('0x17')];_0x6ea39[_0xd8cf('0x17')]=(_0x533e48[_0xd8cf('0x2c')]?_['last'](_0x533e48)[_0xd8cf('0x17')]:_0x43f650['priority'])+0x1;_0x6ea39[_0xd8cf('0xf')]=_[_0xd8cf('0x45')](_0x6ea39[_0xd8cf('0xf')],_0x3e0abb,[_0x43f650],_0x533e48);}_0x6ea39['extensions'][_0xd8cf('0x1a')]({'type':_0x2c267a[_0x293985][0x0][_0xd8cf('0x12')],'app':_0xd8cf('0x46'),'exten':_0x2c267a[_0x293985][0x0][_0xd8cf('0xc')],'context':_0x2c267a[_0x293985][0x0][_0xd8cf('0x16')],'priority':_0x6ea39[_0xd8cf('0x17')],'VoiceExtensionId':_0x2c267a[_0x293985][0x0][_0xd8cf('0x18')]});_0x8e55f2[_0xd8cf('0x1a')](_0x2c267a[_0x293985][0x0][_0xd8cf('0x18')]);_0x507c1d=_[_0xd8cf('0x45')](_0x507c1d,_0x6ea39[_0xd8cf('0xf')]);}}return _0x370288[_0xd8cf('0x47')](function(_0x36317b){return _0x370288[_0xd8cf('0x2')][_0xd8cf('0x6')][_0xd8cf('0x48')]({'where':{'VoiceExtensionId':{'$in':_0x8e55f2}},'transaction':_0x36317b})['then'](function(_0x2f9459){return _0x370288['models'][_0xd8cf('0x6')][_0xd8cf('0x49')](_[_0xd8cf('0x4a')](_0x507c1d,_0xd8cf('0x17')),{'transaction':_0x36317b});});});})[_0xd8cf('0x4b')](function(_0x342d48){console[_0xd8cf('0x4c')](_0x342d48);});}exports[_0xd8cf('0x4d')]=rewrite; \ No newline at end of file diff --git a/server/components/import/cm/csv.js b/server/components/import/cm/csv.js index 6434891..3140179 100644 --- a/server/components/import/cm/csv.js +++ b/server/components/import/cm/csv.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0713=['papaparse','ioredis','../../../mysqldb','../../../config/logger','api','redis','defaults','localhost','socket.io-emitter','../../../api/cmContact/cmContact.socket','register','argv','undefined','null','Missing\x20filepath\x20parameter!','Missing\x20binding\x20parameters!','split','Missing\x20ListId\x20parameter!','error','contact','index','isNil','The\x20row\x20is\x20empty\x20or\x20the\x20number\x20of\x20parameters\x20does\x20not\x20match\x20the\x20columns!','errors','length','map','message','join','hasOwnProperty','data','firstName','firstName\x20not\x20specified!','phone\x20not\x20specified!','birthDate','YYYY-MM-DD','isValid','birthDate\x20format\x20is\x20invalid,\x20YYYY-MM-DD\x20format\x20is\x20supported!','email\x20format\x20is\x20not\x20valid!','ListId','find','duplicate','Duplicate\x20Contact','CmContact','create','keys','then','catch','Error\x20while\x20creating\x20contact:\x20','stringify','checkHopper','inspect','insert','fromQuery','phone','scheduledAt','updatedAt','field','NOW()','ContactId','toString','createdAt','from','ListId\x20=\x20?','where','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','select','cm_hopper','\x20=\x20?','into','deletedAt\x20IS\x20NULL','id\x20IN\x20?','str','calleridnum','cm_hopper_final','cm_hopper_black','cm_contacts','VoiceQueue','findAll','outbound','dialCheckDuplicateType','Lists','get','sequelize','query','VoiceQueueId','onlyIfOpen','push','all','CmList','Campaign','CampaignId','BlackLists','cmContact,\x20%s,\x20%s','Error\x20processing\x20rows\x20block:','emit','contact:csv_','resume','unlinkSync','Unable\x20to\x20delete\x20temp\x20file:','exit','SIGINT','info','CSV\x20import\x20process\x20stopped!','resolve','pause','CSV\x20parsed\x20correctly!','CSV\x20parse\x20error','Error\x20executing\x20contact\x20csv\x20import:','lodash','squel'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var BPromise=require('bluebird');var util=require('util');var _=require(_0x3071('0x0'));var fs=require('fs');var squel=require(_0x3071('0x1'));var Papa=require(_0x3071('0x2'));var Redis=require(_0x3071('0x3'));var db=require(_0x3071('0x4'))['db'];var config=require('../../../config/environment');var logger=require(_0x3071('0x5'))(_0x3071('0x6'));config[_0x3071('0x7')]=_[_0x3071('0x8')](config[_0x3071('0x7')],{'host':_0x3071('0x9'),'port':0x18eb});var socket=require(_0x3071('0xa'))(new Redis(config[_0x3071('0x7')]));require(_0x3071('0xb'))[_0x3071('0xc')](socket);try{if(!process[_0x3071('0xd')][0x2]||process[_0x3071('0xd')][0x2]===_0x3071('0xe')||process['argv'][0x2]===_0x3071('0xf')){throw new Error(_0x3071('0x10'));}var FILEPATH=process[_0x3071('0xd')][0x2];if(!process[_0x3071('0xd')][0x3]||process[_0x3071('0xd')][0x3]==='undefined'||process[_0x3071('0xd')][0x3]===_0x3071('0xf')||!process[_0x3071('0xd')][0x4]||process[_0x3071('0xd')][0x4]===_0x3071('0xe')||process['argv'][0x4]==='null'){throw new Error(_0x3071('0x11'));}var FIELDS=_['zipObject'](process[_0x3071('0xd')][0x3][_0x3071('0x12')](','),process['argv'][0x4][_0x3071('0x12')](','));if(!process['argv'][0x5]||process[_0x3071('0xd')][0x5]===_0x3071('0xe')||process[_0x3071('0xd')][0x5]===_0x3071('0xf')){throw new Error(_0x3071('0x13'));}var LISTID=process[_0x3071('0xd')][0x5];var COMPANYID=process[_0x3071('0xd')][0x6]&&process[_0x3071('0xd')][0x6]!==_0x3071('0xe')&&process[_0x3071('0xd')][0x6]!=='null'?process[_0x3071('0xd')][0x6]:null;var DUPLICATES=process[_0x3071('0xd')][0x7]&&process[_0x3071('0xd')][0x7]!==_0x3071('0xe')&&process[_0x3071('0xd')][0x7]!==_0x3071('0xf')?process[_0x3071('0xd')][0x7]:null;if(!process[_0x3071('0xd')][0x8]||process['argv'][0x8]===_0x3071('0xe')||process[_0x3071('0xd')][0x8]===_0x3071('0xf')){throw new Error('Missing\x20socket_timestamp\x20parameter!');}var SOCKET_TIMESTAMP=process[_0x3071('0xd')][0x8];}catch(_0x5cd80d){logger[_0x3071('0x14')](_0x5cd80d);endCsv();}var total=0x0;var pTotal=0x0;var success=0x0;var errors=0x0;var duplicates=0x0;var rows=[];var hopperContacts='';var promises=[];var index=0x0;var alreadyInvalid=![];function handleCheckRowError(_0x43128c,_0x3762d8,_0x457b57,_0x33090c){var _0x34c50e={'message':_0x3762d8};_0x34c50e[_0x43128c]=!![];if(_0x457b57){_0x34c50e[_0x3071('0x15')]=_0x457b57;}if(_0x33090c){_0x34c50e[_0x3071('0x16')]=_0x33090c;}return _0x34c50e;}function isEmail(_0x542646){return/^([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x22([^\x0d\x22\x5c\x80-\xff]|\x5c[\x00-\x7f])*\x22)(\x2e([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x22([^\x0d\x22\x5c\x80-\xff]|\x5c[\x00-\x7f])*\x22))*\x40([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x5b([^\x0d\x5b-\x5d\x80-\xff]|\x5c[\x00-\x7f])*\x5d)(\x2e([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x5b([^\x0d\x5b-\x5d\x80-\xff]|\x5c[\x00-\x7f])*\x5d))*$/['test'](_0x542646);}function checkRow(_0x2ce48a,_0xb05b1d,_0x412652){return new BPromise(function(_0x13df9f,_0x2793ef){if(_[_0x3071('0x17')](_0x2ce48a)){return _0x2793ef(handleCheckRowError(_0x3071('0x14'),_0x3071('0x18'),null,_0x412652));}if(_0x2ce48a[_0x3071('0x19')]&&_0x2ce48a['errors'][_0x3071('0x1a')]){var _0x3f1e6e=_[_0x3071('0x1b')](_0x2ce48a['errors'],_0x3071('0x1c'))[_0x3071('0x1d')](';');return _0x2793ef(handleCheckRowError(_0x3071('0x14'),_0x3f1e6e,null,_0x412652));}var _0x950fde={};for(var _0x3fa3b8 in FIELDS){if(FIELDS[_0x3071('0x1e')](_0x3fa3b8)&&FIELDS[_0x3fa3b8]){_0x950fde[_0x3fa3b8]=_0x2ce48a[_0x3071('0x1f')][0x0][FIELDS[_0x3fa3b8]]||_0x2ce48a[_0x3071('0x1f')][0x0]['\ufeff'+FIELDS[_0x3fa3b8]];}}if(!_0x950fde[_0x3071('0x20')]){return _0x2793ef(handleCheckRowError(_0x3071('0x14'),_0x3071('0x21'),null,_0x412652));}if(!_0x950fde['phone']){return _0x2793ef(handleCheckRowError('error',_0x3071('0x22'),null,_0x412652));}if(_0x950fde[_0x3071('0x23')]){var _0x6ddf96=moment(_0x950fde[_0x3071('0x23')],_0x3071('0x24'));if(!_0x6ddf96[_0x3071('0x25')]()){return _0x2793ef(handleCheckRowError(_0x3071('0x14'),_0x3071('0x26'),null,_0x412652));}}if(_0x950fde['email']){if(!isEmail(_0x950fde['email'])){return _0x2793ef(handleCheckRowError('error',_0x3071('0x27'),null,_0x412652));}}_0x950fde[_0x3071('0x28')]=LISTID;_0x950fde['CompanyId']=COMPANYID||undefined;if(DUPLICATES&&DUPLICATES[_0x3071('0x1a')]&&_0xb05b1d){var _0x28747d={};for(var _0x25250e=0x0,_0x13ae2c=DUPLICATES['length'];_0x25250e<_0x13ae2c;_0x25250e+=0x1){_0x28747d[DUPLICATES[_0x25250e]]=_0x950fde[DUPLICATES[_0x25250e]];}var _0x218a82=_[_0x3071('0x29')](_0xb05b1d,_0x28747d);if(_0x218a82){return _0x2793ef(handleCheckRowError(_0x3071('0x2a'),_0x3071('0x2b'),_0x218a82,_0x412652));}}return db[_0x3071('0x2c')][_0x3071('0x2d')](_0x950fde,{'raw':!![],'hooks':![],'fields':_[_0x3071('0x2e')](_0x950fde)})[_0x3071('0x2f')](function(_0x596cc3){if(DUPLICATES&&DUPLICATES[_0x3071('0x1a')]&&_0xb05b1d){_0xb05b1d['push'](_['pick'](_0x950fde,DUPLICATES));}hopperContacts+=(hopperContacts?',':'')+_0x596cc3['id'];return _0x13df9f();})[_0x3071('0x30')](function(_0xa3a7ae){return _0x2793ef(handleCheckRowError('error',_0x3071('0x31')+(_0xa3a7ae[_0x3071('0x1c')]||JSON[_0x3071('0x32')](_0xa3a7ae)),null,_0x412652));});});}function checkHopper(){function _0x14ac42(){return function(_0xc60572){logger[_0x3071('0x14')]('cmContact',_0x3071('0x33'),util[_0x3071('0x34')](_0xc60572,{'showHidden':![],'depth':null}));};}var _0x4ce6d4=function(_0x44ad05,_0x5b1392){var _0x28f855=squel[_0x3071('0x35')]()['into']('cm_hopper')[_0x3071('0x36')]([_0x3071('0x37'),_0x3071('0x38'),'ContactId',_0x3071('0x28'),_0x5b1392,'createdAt',_0x3071('0x39')],squel['select']()[_0x3071('0x3a')](_0x3071('0x37'),_0x3071('0x37'))[_0x3071('0x3a')](_0x3071('0x3b'),'scheduledAt')['field']('id',_0x3071('0x3c'))[_0x3071('0x3a')](LISTID[_0x3071('0x3d')](),_0x3071('0x28'))['field'](_0x44ad05['id'][_0x3071('0x3d')](),_0x5b1392)[_0x3071('0x3a')](_0x3071('0x3b'),_0x3071('0x3e'))[_0x3071('0x3a')](_0x3071('0x3b'),'updatedAt')[_0x3071('0x3f')]('cm_contacts')['where']('deletedAt\x20IS\x20NULL')['where'](_0x3071('0x40'),LISTID[_0x3071('0x3d')]())[_0x3071('0x41')](_0x3071('0x42'))[_0x3071('0x41')](_0x3071('0x43'),squel[_0x3071('0x44')]()[_0x3071('0x3a')]('phone')[_0x3071('0x3f')](_0x3071('0x45'))[_0x3071('0x41')](_0x5b1392+_0x3071('0x46'),_0x44ad05['id'][_0x3071('0x3d')]())))['toString']();return _0x28f855;};var _0x5c93c7=function(_0x1721d0,_0x3c2f5e){var _0x1fe5e0=squel[_0x3071('0x35')]()[_0x3071('0x47')]('cm_hopper')[_0x3071('0x36')](['phone',_0x3071('0x38'),'ContactId','ListId',_0x3c2f5e,_0x3071('0x3e'),'updatedAt'],squel[_0x3071('0x44')]()['field'](_0x3071('0x37'),_0x3071('0x37'))[_0x3071('0x3a')](_0x3071('0x3b'),'scheduledAt')[_0x3071('0x3a')]('id','ContactId')[_0x3071('0x3a')](LISTID['toString'](),_0x3071('0x28'))[_0x3071('0x3a')](_0x1721d0['id']['toString'](),_0x3c2f5e)[_0x3071('0x3a')](_0x3071('0x3b'),_0x3071('0x3e'))[_0x3071('0x3a')](_0x3071('0x3b'),_0x3071('0x39'))[_0x3071('0x3f')]('cm_contacts')[_0x3071('0x41')](_0x3071('0x48'))[_0x3071('0x41')](_0x3071('0x40'),LISTID['toString']())[_0x3071('0x41')](_0x3071('0x49'),squel[_0x3071('0x4a')](hopperContacts))[_0x3071('0x41')](_0x3071('0x42'))[_0x3071('0x41')](_0x3071('0x43'),squel[_0x3071('0x44')]()[_0x3071('0x3a')](_0x3071('0x4b'))[_0x3071('0x3f')](_0x3071('0x4c'))[_0x3071('0x41')](_0x3c2f5e+_0x3071('0x46'),_0x1721d0['id'][_0x3071('0x3d')]()))[_0x3071('0x41')]('phone\x20NOT\x20IN\x20(?)',squel['select']()[_0x3071('0x3a')]('phone')[_0x3071('0x3f')](_0x3071('0x45'))[_0x3071('0x41')](_0x3c2f5e+'\x20=\x20?',_0x1721d0['id'][_0x3071('0x3d')]())))[_0x3071('0x3d')]();return _0x1fe5e0;};function _0x5bc69e(_0x4b8ec0,_0x1b89ea){var _0x15abc4=squel[_0x3071('0x35')]()[_0x3071('0x47')]('cm_hopper')[_0x3071('0x36')]([_0x3071('0x37'),_0x3071('0x38'),_0x3071('0x3c'),_0x3071('0x28'),_0x1b89ea,'createdAt',_0x3071('0x39')],squel[_0x3071('0x44')]()[_0x3071('0x3a')](_0x3071('0x37'),_0x3071('0x37'))[_0x3071('0x3a')](_0x3071('0x3b'),'scheduledAt')['field']('id',_0x3071('0x3c'))['field'](LISTID[_0x3071('0x3d')](),_0x3071('0x28'))['field'](_0x4b8ec0['id'][_0x3071('0x3d')](),_0x1b89ea)[_0x3071('0x3a')]('NOW()',_0x3071('0x3e'))[_0x3071('0x3a')](_0x3071('0x3b'),_0x3071('0x39'))[_0x3071('0x3f')]('cm_contacts')[_0x3071('0x41')](_0x3071('0x48'))[_0x3071('0x41')]('ListId\x20=\x20?',LISTID[_0x3071('0x3d')]())[_0x3071('0x41')](_0x3071('0x49'),squel[_0x3071('0x4a')](hopperContacts))[_0x3071('0x41')](_0x3071('0x42')))[_0x3071('0x3d')]();return _0x15abc4;}function _0x2e39ff(_0x3b47e8,_0x5cb3b3){var _0x5d1316=squel[_0x3071('0x35')]()[_0x3071('0x47')](_0x3071('0x4d'))[_0x3071('0x36')]([_0x3071('0x37'),_0x3071('0x3c'),_0x3071('0x28'),_0x5cb3b3,_0x3071('0x3e'),_0x3071('0x39')],squel[_0x3071('0x44')]()['field'](_0x3071('0x37'),_0x3071('0x37'))[_0x3071('0x3a')]('id',_0x3071('0x3c'))[_0x3071('0x3a')](LISTID[_0x3071('0x3d')](),_0x3071('0x28'))[_0x3071('0x3a')](_0x3b47e8['id']['toString'](),_0x5cb3b3)[_0x3071('0x3a')](_0x3071('0x3b'),'createdAt')['field'](_0x3071('0x3b'),_0x3071('0x39'))[_0x3071('0x3f')](_0x3071('0x4e'))['where']('deletedAt\x20IS\x20NULL')[_0x3071('0x41')]('ListId\x20=\x20?',LISTID['toString']())['where']('id\x20IN\x20?',squel[_0x3071('0x4a')](hopperContacts))[_0x3071('0x41')](_0x3071('0x42')))['toString']();return _0x5d1316;}return db[_0x3071('0x4f')][_0x3071('0x50')]({'where':{'type':_0x3071('0x51')},'attributes':['id',_0x3071('0x52')],'include':[{'model':db['CmList'],'as':_0x3071('0x53'),'where':{'id':LISTID}}]})[_0x3071('0x2f')](function(_0x588406){var _0x1b35d3=[];if(_0x588406){var _0x29ee70;for(var _0x388cd1=0x0,_0x40c258;_0x388cd1<_0x588406[_0x3071('0x1a')];_0x388cd1+=0x1){_0x40c258=_0x588406[_0x388cd1][_0x3071('0x54')]({'plain':!![]});switch(_0x40c258[_0x3071('0x52')]){case'always':_0x1b35d3['push'](db[_0x3071('0x55')][_0x3071('0x56')](_0x5c93c7(_0x40c258,_0x3071('0x57')))['then'](function(){})['catch'](_0x14ac42()));break;case _0x3071('0x58'):_0x1b35d3[_0x3071('0x59')](db[_0x3071('0x55')][_0x3071('0x56')](_0x4ce6d4(_0x40c258,_0x3071('0x57')))[_0x3071('0x2f')](function(){})[_0x3071('0x30')](_0x14ac42()));break;default:_0x1b35d3[_0x3071('0x59')](db['sequelize'][_0x3071('0x56')](_0x5bc69e(_0x40c258,'VoiceQueueId'))[_0x3071('0x2f')](function(){})[_0x3071('0x30')](_0x14ac42()));}}}return _0x1b35d3;})[_0x3071('0x5a')]()[_0x3071('0x2f')](function(){return db[_0x3071('0x4f')][_0x3071('0x50')]({'where':{'type':_0x3071('0x51')},'attributes':['id'],'include':[{'model':db[_0x3071('0x5b')],'as':'BlackLists','where':{'id':LISTID}}]})[_0x3071('0x2f')](function(_0x138a94){var _0x1da477=[];if(_0x138a94){var _0x4f06c0;for(var _0x2a2e7a=0x0,_0x22ec7b;_0x2a2e7a<_0x138a94[_0x3071('0x1a')];_0x2a2e7a+=0x1){_0x22ec7b=_0x138a94[_0x2a2e7a]['get']({'plain':!![]});_0x1da477['push'](db[_0x3071('0x55')]['query'](_0x2e39ff(_0x22ec7b,_0x3071('0x57')))[_0x3071('0x2f')](function(){})[_0x3071('0x30')](_0x14ac42()));}}return _0x1da477;})[_0x3071('0x5a')]();})[_0x3071('0x2f')](function(){return db[_0x3071('0x5c')][_0x3071('0x50')]({'attributes':['id','dialCheckDuplicateType'],'include':[{'model':db[_0x3071('0x5b')],'as':_0x3071('0x53'),'where':{'id':LISTID}}]})[_0x3071('0x2f')](function(_0x3cc937){var _0x98d0fb=[];if(_0x3cc937){for(var _0x1fea60=0x0,_0x435dcb;_0x1fea60<_0x3cc937[_0x3071('0x1a')];_0x1fea60+=0x1){_0x435dcb=_0x3cc937[_0x1fea60]['get']({'plain':!![]});switch(_0x435dcb[_0x3071('0x52')]){case'always':_0x98d0fb[_0x3071('0x59')](db[_0x3071('0x55')][_0x3071('0x56')](_0x5c93c7(_0x435dcb,_0x3071('0x5d')))[_0x3071('0x2f')](function(){})[_0x3071('0x30')](_0x14ac42()));break;case _0x3071('0x58'):_0x98d0fb[_0x3071('0x59')](db[_0x3071('0x55')][_0x3071('0x56')](_0x4ce6d4(_0x435dcb,'CampaignId'))[_0x3071('0x2f')](function(){})[_0x3071('0x30')](_0x14ac42()));break;default:_0x98d0fb['push'](db[_0x3071('0x55')][_0x3071('0x56')](_0x5bc69e(_0x435dcb,_0x3071('0x5d')))[_0x3071('0x2f')](function(){})[_0x3071('0x30')](_0x14ac42()));}}}return _0x98d0fb;})['all']();})['then'](function(){return db[_0x3071('0x5c')]['findAll']({'attributes':['id'],'include':[{'model':db[_0x3071('0x5b')],'as':_0x3071('0x5e'),'where':{'id':LISTID}}]})[_0x3071('0x2f')](function(_0x136278){var _0x22783b=[];if(_0x136278){for(var _0x2f31b7=0x0,_0x568386;_0x2f31b7<_0x136278[_0x3071('0x1a')];_0x2f31b7+=0x1){_0x568386=_0x136278[_0x2f31b7][_0x3071('0x54')]({'plain':!![]});_0x22783b[_0x3071('0x59')](db[_0x3071('0x55')]['query'](_0x2e39ff(_0x568386,_0x3071('0x5d')))[_0x3071('0x2f')](function(){})['catch'](_0x14ac42()));}}return _0x22783b;})[_0x3071('0x5a')]();})[_0x3071('0x30')](function(_0x391887){logger[_0x3071('0x14')](_0x3071('0x5f'),'generalCheckHopper',_0x391887[_0x3071('0x1c')]);});}var processPromises=function(_0x479fe7){return BPromise[_0x3071('0x5a')](promises)[_0x3071('0x2f')](function(_0x39060f){})[_0x3071('0x30')](function(_0x1120ec){logger[_0x3071('0x14')](_0x3071('0x60'),JSON[_0x3071('0x32')](_0x1120ec));})['finally'](function(){socket[_0x3071('0x61')](_0x3071('0x62')+SOCKET_TIMESTAMP,{'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});promises=[];success=0x0;errors=0x0;duplicates=0x0;rows=[];if(_0x479fe7){return _0x479fe7[_0x3071('0x63')]();}});};var endCsv=function(){return BPromise['resolve']()[_0x3071('0x2f')](function(){if(hopperContacts){return checkHopper();}})['then'](function(){socket[_0x3071('0x61')](_0x3071('0x62')+SOCKET_TIMESTAMP,{'finished':!![],'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});try{fs[_0x3071('0x64')](FILEPATH);}catch(_0x5e0cbd){logger[_0x3071('0x14')](_0x3071('0x65'),JSON[_0x3071('0x32')](_0x5e0cbd));}finally{process[_0x3071('0x66')](0x0);}});};process['on'](_0x3071('0x67'),function(){logger[_0x3071('0x68')](_0x3071('0x69'));endCsv();});function main(){return BPromise[_0x3071('0x6a')]()[_0x3071('0x2f')](function(){if(DUPLICATES){DUPLICATES=DUPLICATES['split'](',');return db[_0x3071('0x2c')][_0x3071('0x50')]({'where':{'ListId':LISTID},'attributes':DUPLICATES,'raw':!![]});}})[_0x3071('0x2f')](function(_0x5b2830){var _0x561030=fs['createReadStream'](FILEPATH,{'highWaterMark':0xf*0x400*0x400});Papa['parse'](_0x561030,{'header':!![],'skipEmptyLines':!![],'step':function(_0x4eb9e2,_0x8c77b7){total+=0x1;var _0x44b4c9=total;promises['push'](checkRow(_0x4eb9e2,_0x5b2830,_0x44b4c9)[_0x3071('0x2f')](function(){success+=0x1;})[_0x3071('0x30')](function(_0x1f61df){if(_0x1f61df['error']){errors+=0x1;delete _0x1f61df['error'];}else if(_0x1f61df[_0x3071('0x2a')]){duplicates+=0x1;delete _0x1f61df[_0x3071('0x2a')];}rows[_0x3071('0x59')](_0x1f61df);}));if(total%0xc8===0x0){_0x8c77b7[_0x3071('0x6b')]();return processPromises(_0x8c77b7);}},'complete':function(){return processPromises()[_0x3071('0x2f')](function(){logger[_0x3071('0x68')](_0x3071('0x6c'));endCsv();});},'error':function(_0x5eb60d,_0x58b62c){logger[_0x3071('0x68')](_0x3071('0x6d'),JSON[_0x3071('0x32')](_0x5eb60d));endCsv();}});})[_0x3071('0x30')](function(_0x5a3b64){logger[_0x3071('0x14')](_0x3071('0x6e'),JSON[_0x3071('0x32')](_0x5a3b64));});}main(); \ No newline at end of file +var _0xe706=['toString','ListId','from','cm_contacts','deletedAt\x20IS\x20NULL','where','ListId\x20=\x20?','insert','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','calleridnum','cm_hopper_final','\x20=\x20?','cm_hopper_black','VoiceQueue','findAll','outbound','CmList','Lists','get','dialCheckDuplicateType','always','push','sequelize','VoiceQueueId','catch','onlyIfOpen','query','all','Campaign','CampaignId','BlackLists','cmContact,\x20%s,\x20%s','generalCheckHopper','Error\x20processing\x20rows\x20block:','finally','contact:csv_','resume','resolve','emit','Unable\x20to\x20delete\x20temp\x20file:','info','CSV\x20import\x20process\x20stopped!','split','parse','pause','CSV\x20parsed\x20correctly!','Error\x20executing\x20contact\x20csv\x20import:','bluebird','util','lodash','papaparse','ioredis','../../../mysqldb','../../../config/environment','../../../config/logger','api','redis','defaults','localhost','socket.io-emitter','../../../api/cmContact/cmContact.socket','register','argv','undefined','null','Missing\x20filepath\x20parameter!','Missing\x20binding\x20parameters!','zipObject','Missing\x20socket_timestamp\x20parameter!','error','contact','index','isNil','The\x20row\x20is\x20empty\x20or\x20the\x20number\x20of\x20parameters\x20does\x20not\x20match\x20the\x20columns!','errors','length','map','join','hasOwnProperty','data','firstName','firstName\x20not\x20specified!','phone','phone\x20not\x20specified!','birthDate','isValid','birthDate\x20format\x20is\x20invalid,\x20YYYY-MM-DD\x20format\x20is\x20supported!','email','email\x20format\x20is\x20not\x20valid!','CompanyId','find','duplicate','Duplicate\x20Contact','CmContact','create','keys','then','pick','Error\x20while\x20creating\x20contact:\x20','message','stringify','cmContact','checkHopper','inspect','into','cm_hopper','fromQuery','scheduledAt','ContactId','createdAt','updatedAt','select','field','NOW()'];(function(_0xf6ad79,_0x49fd00){var _0x52efe0=function(_0x3b5d65){while(--_0x3b5d65){_0xf6ad79['push'](_0xf6ad79['shift']());}};_0x52efe0(++_0x49fd00);}(_0xe706,0xa3));var _0x6e70=function(_0x1a4528,_0x54d423){_0x1a4528=_0x1a4528-0x0;var _0x368a2c=_0xe706[_0x1a4528];return _0x368a2c;};'use strict';var BPromise=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var _=require(_0x6e70('0x2'));var fs=require('fs');var squel=require('squel');var Papa=require(_0x6e70('0x3'));var Redis=require(_0x6e70('0x4'));var db=require(_0x6e70('0x5'))['db'];var config=require(_0x6e70('0x6'));var logger=require(_0x6e70('0x7'))(_0x6e70('0x8'));config[_0x6e70('0x9')]=_[_0x6e70('0xa')](config[_0x6e70('0x9')],{'host':_0x6e70('0xb'),'port':0x18eb});var socket=require(_0x6e70('0xc'))(new Redis(config[_0x6e70('0x9')]));require(_0x6e70('0xd'))[_0x6e70('0xe')](socket);try{if(!process[_0x6e70('0xf')][0x2]||process[_0x6e70('0xf')][0x2]===_0x6e70('0x10')||process[_0x6e70('0xf')][0x2]===_0x6e70('0x11')){throw new Error(_0x6e70('0x12'));}var FILEPATH=process[_0x6e70('0xf')][0x2];if(!process[_0x6e70('0xf')][0x3]||process[_0x6e70('0xf')][0x3]===_0x6e70('0x10')||process['argv'][0x3]==='null'||!process[_0x6e70('0xf')][0x4]||process[_0x6e70('0xf')][0x4]===_0x6e70('0x10')||process[_0x6e70('0xf')][0x4]===_0x6e70('0x11')){throw new Error(_0x6e70('0x13'));}var FIELDS=_[_0x6e70('0x14')](process[_0x6e70('0xf')][0x3]['split'](','),process['argv'][0x4]['split'](','));if(!process[_0x6e70('0xf')][0x5]||process['argv'][0x5]==='undefined'||process[_0x6e70('0xf')][0x5]===_0x6e70('0x11')){throw new Error('Missing\x20ListId\x20parameter!');}var LISTID=process[_0x6e70('0xf')][0x5];var COMPANYID=process['argv'][0x6]&&process[_0x6e70('0xf')][0x6]!==_0x6e70('0x10')&&process['argv'][0x6]!=='null'?process[_0x6e70('0xf')][0x6]:null;var DUPLICATES=process['argv'][0x7]&&process[_0x6e70('0xf')][0x7]!==_0x6e70('0x10')&&process['argv'][0x7]!=='null'?process[_0x6e70('0xf')][0x7]:null;if(!process[_0x6e70('0xf')][0x8]||process[_0x6e70('0xf')][0x8]===_0x6e70('0x10')||process[_0x6e70('0xf')][0x8]===_0x6e70('0x11')){throw new Error(_0x6e70('0x15'));}var SOCKET_TIMESTAMP=process[_0x6e70('0xf')][0x8];}catch(_0x29326f){logger[_0x6e70('0x16')](_0x29326f);endCsv();}var total=0x0;var pTotal=0x0;var success=0x0;var errors=0x0;var duplicates=0x0;var rows=[];var hopperContacts='';var promises=[];var index=0x0;var alreadyInvalid=![];function handleCheckRowError(_0x4a0cfe,_0x228350,_0x344b65,_0x27b294){var _0x502b2d={'message':_0x228350};_0x502b2d[_0x4a0cfe]=!![];if(_0x344b65){_0x502b2d[_0x6e70('0x17')]=_0x344b65;}if(_0x27b294){_0x502b2d[_0x6e70('0x18')]=_0x27b294;}return _0x502b2d;}function isEmail(_0x3337a6){return/^([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x22([^\x0d\x22\x5c\x80-\xff]|\x5c[\x00-\x7f])*\x22)(\x2e([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x22([^\x0d\x22\x5c\x80-\xff]|\x5c[\x00-\x7f])*\x22))*\x40([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x5b([^\x0d\x5b-\x5d\x80-\xff]|\x5c[\x00-\x7f])*\x5d)(\x2e([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x5b([^\x0d\x5b-\x5d\x80-\xff]|\x5c[\x00-\x7f])*\x5d))*$/['test'](_0x3337a6);}function checkRow(_0x10fc91,_0x538b9c,_0x50aec2){return new BPromise(function(_0x4e97c7,_0x41e352){if(_[_0x6e70('0x19')](_0x10fc91)){return _0x41e352(handleCheckRowError('error',_0x6e70('0x1a'),null,_0x50aec2));}if(_0x10fc91[_0x6e70('0x1b')]&&_0x10fc91['errors'][_0x6e70('0x1c')]){var _0x67fb43=_[_0x6e70('0x1d')](_0x10fc91['errors'],'message')[_0x6e70('0x1e')](';');return _0x41e352(handleCheckRowError(_0x6e70('0x16'),_0x67fb43,null,_0x50aec2));}var _0x83c836={};for(var _0x114344 in FIELDS){if(FIELDS[_0x6e70('0x1f')](_0x114344)&&FIELDS[_0x114344]){_0x83c836[_0x114344]=_0x10fc91['data'][0x0][FIELDS[_0x114344]]||_0x10fc91[_0x6e70('0x20')][0x0]['\ufeff'+FIELDS[_0x114344]];}}if(!_0x83c836[_0x6e70('0x21')]){return _0x41e352(handleCheckRowError(_0x6e70('0x16'),_0x6e70('0x22'),null,_0x50aec2));}if(!_0x83c836[_0x6e70('0x23')]){return _0x41e352(handleCheckRowError(_0x6e70('0x16'),_0x6e70('0x24'),null,_0x50aec2));}if(_0x83c836[_0x6e70('0x25')]){var _0x3a0821=moment(_0x83c836[_0x6e70('0x25')],'YYYY-MM-DD');if(!_0x3a0821[_0x6e70('0x26')]()){return _0x41e352(handleCheckRowError('error',_0x6e70('0x27'),null,_0x50aec2));}}if(_0x83c836['email']){if(!isEmail(_0x83c836[_0x6e70('0x28')])){return _0x41e352(handleCheckRowError(_0x6e70('0x16'),_0x6e70('0x29'),null,_0x50aec2));}}_0x83c836['ListId']=LISTID;_0x83c836[_0x6e70('0x2a')]=COMPANYID||undefined;if(DUPLICATES&&DUPLICATES[_0x6e70('0x1c')]&&_0x538b9c){var _0x5780a1={};for(var _0x13d673=0x0,_0x154925=DUPLICATES['length'];_0x13d673<_0x154925;_0x13d673+=0x1){_0x5780a1[DUPLICATES[_0x13d673]]=_0x83c836[DUPLICATES[_0x13d673]];}var _0x10d8f6=_[_0x6e70('0x2b')](_0x538b9c,_0x5780a1);if(_0x10d8f6){return _0x41e352(handleCheckRowError(_0x6e70('0x2c'),_0x6e70('0x2d'),_0x10d8f6,_0x50aec2));}}return db[_0x6e70('0x2e')][_0x6e70('0x2f')](_0x83c836,{'raw':!![],'hooks':![],'fields':_[_0x6e70('0x30')](_0x83c836)})[_0x6e70('0x31')](function(_0xf146fd){if(DUPLICATES&&DUPLICATES[_0x6e70('0x1c')]&&_0x538b9c){_0x538b9c['push'](_[_0x6e70('0x32')](_0x83c836,DUPLICATES));}hopperContacts+=(hopperContacts?',':'')+_0xf146fd['id'];return _0x4e97c7();})['catch'](function(_0x23cd1a){return _0x41e352(handleCheckRowError(_0x6e70('0x16'),_0x6e70('0x33')+(_0x23cd1a[_0x6e70('0x34')]||JSON[_0x6e70('0x35')](_0x23cd1a)),null,_0x50aec2));});});}function checkHopper(){function _0x989b80(){return function(_0x2440be){logger[_0x6e70('0x16')](_0x6e70('0x36'),_0x6e70('0x37'),util[_0x6e70('0x38')](_0x2440be,{'showHidden':![],'depth':null}));};}var _0x23d5e2=function(_0x5594d3,_0x501b53){var _0x5446a2=squel['insert']()[_0x6e70('0x39')](_0x6e70('0x3a'))[_0x6e70('0x3b')]([_0x6e70('0x23'),_0x6e70('0x3c'),_0x6e70('0x3d'),'ListId',_0x501b53,_0x6e70('0x3e'),_0x6e70('0x3f')],squel[_0x6e70('0x40')]()[_0x6e70('0x41')](_0x6e70('0x23'),_0x6e70('0x23'))[_0x6e70('0x41')](_0x6e70('0x42'),'scheduledAt')[_0x6e70('0x41')]('id',_0x6e70('0x3d'))[_0x6e70('0x41')](LISTID[_0x6e70('0x43')](),_0x6e70('0x44'))[_0x6e70('0x41')](_0x5594d3['id'][_0x6e70('0x43')](),_0x501b53)['field']('NOW()','createdAt')[_0x6e70('0x41')](_0x6e70('0x42'),_0x6e70('0x3f'))[_0x6e70('0x45')](_0x6e70('0x46'))['where'](_0x6e70('0x47'))[_0x6e70('0x48')](_0x6e70('0x49'),LISTID['toString']())['where']('phone\x20IS\x20NOT\x20NULL')[_0x6e70('0x48')]('phone\x20NOT\x20IN\x20(?)',squel[_0x6e70('0x40')]()[_0x6e70('0x41')](_0x6e70('0x23'))[_0x6e70('0x45')]('cm_hopper')[_0x6e70('0x48')](_0x501b53+'\x20=\x20?',_0x5594d3['id'][_0x6e70('0x43')]())))[_0x6e70('0x43')]();return _0x5446a2;};var _0x2dafb5=function(_0x3478e2,_0x5bbc3a){var _0x291de6=squel[_0x6e70('0x4a')]()[_0x6e70('0x39')](_0x6e70('0x3a'))[_0x6e70('0x3b')]([_0x6e70('0x23'),_0x6e70('0x3c'),'ContactId',_0x6e70('0x44'),_0x5bbc3a,_0x6e70('0x3e'),_0x6e70('0x3f')],squel[_0x6e70('0x40')]()[_0x6e70('0x41')](_0x6e70('0x23'),_0x6e70('0x23'))['field'](_0x6e70('0x42'),'scheduledAt')[_0x6e70('0x41')]('id',_0x6e70('0x3d'))['field'](LISTID['toString'](),_0x6e70('0x44'))[_0x6e70('0x41')](_0x3478e2['id'][_0x6e70('0x43')](),_0x5bbc3a)['field']('NOW()',_0x6e70('0x3e'))[_0x6e70('0x41')](_0x6e70('0x42'),_0x6e70('0x3f'))[_0x6e70('0x45')](_0x6e70('0x46'))['where'](_0x6e70('0x47'))[_0x6e70('0x48')](_0x6e70('0x49'),LISTID[_0x6e70('0x43')]())[_0x6e70('0x48')]('id\x20IN\x20?',squel['str'](hopperContacts))[_0x6e70('0x48')](_0x6e70('0x4b'))[_0x6e70('0x48')](_0x6e70('0x4c'),squel[_0x6e70('0x40')]()['field'](_0x6e70('0x4d'))[_0x6e70('0x45')](_0x6e70('0x4e'))[_0x6e70('0x48')](_0x5bbc3a+_0x6e70('0x4f'),_0x3478e2['id']['toString']()))[_0x6e70('0x48')](_0x6e70('0x4c'),squel[_0x6e70('0x40')]()[_0x6e70('0x41')](_0x6e70('0x23'))[_0x6e70('0x45')]('cm_hopper')[_0x6e70('0x48')](_0x5bbc3a+_0x6e70('0x4f'),_0x3478e2['id']['toString']())))[_0x6e70('0x43')]();return _0x291de6;};function _0xebe5f7(_0x54efdf,_0x3cfaa9){var _0xb3f06c=squel[_0x6e70('0x4a')]()[_0x6e70('0x39')](_0x6e70('0x3a'))['fromQuery']([_0x6e70('0x23'),_0x6e70('0x3c'),_0x6e70('0x3d'),_0x6e70('0x44'),_0x3cfaa9,_0x6e70('0x3e'),_0x6e70('0x3f')],squel[_0x6e70('0x40')]()[_0x6e70('0x41')](_0x6e70('0x23'),_0x6e70('0x23'))[_0x6e70('0x41')](_0x6e70('0x42'),_0x6e70('0x3c'))[_0x6e70('0x41')]('id',_0x6e70('0x3d'))[_0x6e70('0x41')](LISTID[_0x6e70('0x43')](),_0x6e70('0x44'))[_0x6e70('0x41')](_0x54efdf['id'][_0x6e70('0x43')](),_0x3cfaa9)['field'](_0x6e70('0x42'),_0x6e70('0x3e'))[_0x6e70('0x41')](_0x6e70('0x42'),_0x6e70('0x3f'))[_0x6e70('0x45')]('cm_contacts')[_0x6e70('0x48')](_0x6e70('0x47'))['where'](_0x6e70('0x49'),LISTID[_0x6e70('0x43')]())[_0x6e70('0x48')]('id\x20IN\x20?',squel['str'](hopperContacts))[_0x6e70('0x48')](_0x6e70('0x4b')))[_0x6e70('0x43')]();return _0xb3f06c;}function _0x41a861(_0x10d299,_0x739946){var _0x30cd88=squel['insert']()['into'](_0x6e70('0x50'))[_0x6e70('0x3b')]([_0x6e70('0x23'),_0x6e70('0x3d'),'ListId',_0x739946,'createdAt',_0x6e70('0x3f')],squel[_0x6e70('0x40')]()['field']('phone',_0x6e70('0x23'))['field']('id',_0x6e70('0x3d'))[_0x6e70('0x41')](LISTID[_0x6e70('0x43')](),_0x6e70('0x44'))[_0x6e70('0x41')](_0x10d299['id'][_0x6e70('0x43')](),_0x739946)[_0x6e70('0x41')](_0x6e70('0x42'),'createdAt')[_0x6e70('0x41')](_0x6e70('0x42'),_0x6e70('0x3f'))[_0x6e70('0x45')](_0x6e70('0x46'))['where']('deletedAt\x20IS\x20NULL')['where'](_0x6e70('0x49'),LISTID[_0x6e70('0x43')]())[_0x6e70('0x48')]('id\x20IN\x20?',squel['str'](hopperContacts))[_0x6e70('0x48')](_0x6e70('0x4b')))[_0x6e70('0x43')]();return _0x30cd88;}return db[_0x6e70('0x51')][_0x6e70('0x52')]({'where':{'type':_0x6e70('0x53')},'attributes':['id','dialCheckDuplicateType'],'include':[{'model':db[_0x6e70('0x54')],'as':_0x6e70('0x55'),'where':{'id':LISTID}}]})[_0x6e70('0x31')](function(_0x82a9a){var _0x515c0c=[];if(_0x82a9a){var _0xce964b;for(var _0x531097=0x0,_0x5b4046;_0x531097<_0x82a9a[_0x6e70('0x1c')];_0x531097+=0x1){_0x5b4046=_0x82a9a[_0x531097][_0x6e70('0x56')]({'plain':!![]});switch(_0x5b4046[_0x6e70('0x57')]){case _0x6e70('0x58'):_0x515c0c[_0x6e70('0x59')](db[_0x6e70('0x5a')]['query'](_0x2dafb5(_0x5b4046,_0x6e70('0x5b')))[_0x6e70('0x31')](function(){})[_0x6e70('0x5c')](_0x989b80()));break;case _0x6e70('0x5d'):_0x515c0c[_0x6e70('0x59')](db[_0x6e70('0x5a')][_0x6e70('0x5e')](_0x23d5e2(_0x5b4046,_0x6e70('0x5b')))[_0x6e70('0x31')](function(){})[_0x6e70('0x5c')](_0x989b80()));break;default:_0x515c0c['push'](db[_0x6e70('0x5a')][_0x6e70('0x5e')](_0xebe5f7(_0x5b4046,_0x6e70('0x5b')))['then'](function(){})['catch'](_0x989b80()));}}}return _0x515c0c;})[_0x6e70('0x5f')]()[_0x6e70('0x31')](function(){return db[_0x6e70('0x51')][_0x6e70('0x52')]({'where':{'type':_0x6e70('0x53')},'attributes':['id'],'include':[{'model':db['CmList'],'as':'BlackLists','where':{'id':LISTID}}]})[_0x6e70('0x31')](function(_0x241a21){var _0x56d4d9=[];if(_0x241a21){var _0x58666a;for(var _0x1c7c5f=0x0,_0xf7a034;_0x1c7c5f<_0x241a21[_0x6e70('0x1c')];_0x1c7c5f+=0x1){_0xf7a034=_0x241a21[_0x1c7c5f][_0x6e70('0x56')]({'plain':!![]});_0x56d4d9[_0x6e70('0x59')](db[_0x6e70('0x5a')][_0x6e70('0x5e')](_0x41a861(_0xf7a034,_0x6e70('0x5b')))[_0x6e70('0x31')](function(){})[_0x6e70('0x5c')](_0x989b80()));}}return _0x56d4d9;})[_0x6e70('0x5f')]();})[_0x6e70('0x31')](function(){return db[_0x6e70('0x60')]['findAll']({'attributes':['id','dialCheckDuplicateType'],'include':[{'model':db[_0x6e70('0x54')],'as':'Lists','where':{'id':LISTID}}]})[_0x6e70('0x31')](function(_0x4b2d40){var _0x5b5471=[];if(_0x4b2d40){for(var _0x402f6f=0x0,_0x48e04b;_0x402f6f<_0x4b2d40['length'];_0x402f6f+=0x1){_0x48e04b=_0x4b2d40[_0x402f6f][_0x6e70('0x56')]({'plain':!![]});switch(_0x48e04b[_0x6e70('0x57')]){case _0x6e70('0x58'):_0x5b5471['push'](db['sequelize']['query'](_0x2dafb5(_0x48e04b,_0x6e70('0x61')))['then'](function(){})[_0x6e70('0x5c')](_0x989b80()));break;case _0x6e70('0x5d'):_0x5b5471[_0x6e70('0x59')](db[_0x6e70('0x5a')][_0x6e70('0x5e')](_0x23d5e2(_0x48e04b,_0x6e70('0x61')))[_0x6e70('0x31')](function(){})['catch'](_0x989b80()));break;default:_0x5b5471[_0x6e70('0x59')](db[_0x6e70('0x5a')][_0x6e70('0x5e')](_0xebe5f7(_0x48e04b,'CampaignId'))[_0x6e70('0x31')](function(){})[_0x6e70('0x5c')](_0x989b80()));}}}return _0x5b5471;})[_0x6e70('0x5f')]();})[_0x6e70('0x31')](function(){return db[_0x6e70('0x60')][_0x6e70('0x52')]({'attributes':['id'],'include':[{'model':db[_0x6e70('0x54')],'as':_0x6e70('0x62'),'where':{'id':LISTID}}]})[_0x6e70('0x31')](function(_0x48f6fd){var _0x463eed=[];if(_0x48f6fd){for(var _0x39e6db=0x0,_0x53acc8;_0x39e6db<_0x48f6fd[_0x6e70('0x1c')];_0x39e6db+=0x1){_0x53acc8=_0x48f6fd[_0x39e6db][_0x6e70('0x56')]({'plain':!![]});_0x463eed['push'](db['sequelize'][_0x6e70('0x5e')](_0x41a861(_0x53acc8,'CampaignId'))[_0x6e70('0x31')](function(){})['catch'](_0x989b80()));}}return _0x463eed;})[_0x6e70('0x5f')]();})[_0x6e70('0x5c')](function(_0x106f32){logger[_0x6e70('0x16')](_0x6e70('0x63'),_0x6e70('0x64'),_0x106f32[_0x6e70('0x34')]);});}var processPromises=function(_0x5afbf5){return BPromise['all'](promises)[_0x6e70('0x31')](function(_0x4bf451){})[_0x6e70('0x5c')](function(_0xa2a4d5){logger[_0x6e70('0x16')](_0x6e70('0x65'),JSON['stringify'](_0xa2a4d5));})[_0x6e70('0x66')](function(){socket['emit'](_0x6e70('0x67')+SOCKET_TIMESTAMP,{'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});promises=[];success=0x0;errors=0x0;duplicates=0x0;rows=[];if(_0x5afbf5){return _0x5afbf5[_0x6e70('0x68')]();}});};var endCsv=function(){return BPromise[_0x6e70('0x69')]()[_0x6e70('0x31')](function(){if(hopperContacts){return checkHopper();}})[_0x6e70('0x31')](function(){socket[_0x6e70('0x6a')](_0x6e70('0x67')+SOCKET_TIMESTAMP,{'finished':!![],'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});try{fs['unlinkSync'](FILEPATH);}catch(_0x1d6acf){logger['error'](_0x6e70('0x6b'),JSON['stringify'](_0x1d6acf));}finally{process['exit'](0x0);}});};process['on']('SIGINT',function(){logger[_0x6e70('0x6c')](_0x6e70('0x6d'));endCsv();});function main(){return BPromise[_0x6e70('0x69')]()[_0x6e70('0x31')](function(){if(DUPLICATES){DUPLICATES=DUPLICATES[_0x6e70('0x6e')](',');return db['CmContact'][_0x6e70('0x52')]({'where':{'ListId':LISTID},'attributes':DUPLICATES,'raw':!![]});}})[_0x6e70('0x31')](function(_0x48c30c){var _0x3c2d33=fs['createReadStream'](FILEPATH,{'highWaterMark':0xf*0x400*0x400});Papa[_0x6e70('0x6f')](_0x3c2d33,{'header':!![],'skipEmptyLines':!![],'step':function(_0x5d0585,_0x4a87e2){total+=0x1;var _0x25f60c=total;promises[_0x6e70('0x59')](checkRow(_0x5d0585,_0x48c30c,_0x25f60c)[_0x6e70('0x31')](function(){success+=0x1;})[_0x6e70('0x5c')](function(_0x3e6661){if(_0x3e6661[_0x6e70('0x16')]){errors+=0x1;delete _0x3e6661[_0x6e70('0x16')];}else if(_0x3e6661['duplicate']){duplicates+=0x1;delete _0x3e6661[_0x6e70('0x2c')];}rows['push'](_0x3e6661);}));if(total%0xc8===0x0){_0x4a87e2[_0x6e70('0x70')]();return processPromises(_0x4a87e2);}},'complete':function(){return processPromises()[_0x6e70('0x31')](function(){logger[_0x6e70('0x6c')](_0x6e70('0x71'));endCsv();});},'error':function(_0x4764d5,_0x41b7de){logger[_0x6e70('0x6c')]('CSV\x20parse\x20error',JSON[_0x6e70('0x35')](_0x4764d5));endCsv();}});})['catch'](function(_0x27bdf2){logger[_0x6e70('0x16')](_0x6e70('0x72'),JSON[_0x6e70('0x35')](_0x27bdf2));});}main(); \ No newline at end of file diff --git a/server/components/import/cm/csv2.js b/server/components/import/cm/csv2.js index e4f633e..1a7ec85 100644 --- a/server/components/import/cm/csv2.js +++ b/server/components/import/cm/csv2.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['.CmListId\x20=\x20?','toString','date_add(cm_contacts.scheduledat,interval\x20','cm_contacts.priority','UserId','\x20=\x20?','concat','keys','CompanyId',')\x20NOT\x20IN\x20?','ListId\x20=\x20?','deletedAt\x20IS\x20NULL','MIN(id)','min_id','group','info','Received\x20SIGINT','error','message','exit','errors','push','spread','campaigns.id','campaigns','campaigns_has_cm_lists','campaigns.id\x20=\x20campaigns_has_cm_lists.CampaignId','campaigns_has_cm_lists.CmListId=','sequelize','query','length','all','catch','voice_queues.id','voice_queues.dialTimezone','voice_queues','voice_queues.id\x20=\x20voice_queues_has_cm_lists.VoiceQueueId','voice_queues_has_cm_lists.CmListId=','timezones','dialTimezone','isNil','utcOffset','set','offset','main','stringify','send','start','binding','socket_timestamp','root','server/files/tmp','header',',utcOffset','writeFileSync','parse','createReadStream','data','hasOwnProperty','trim','replace','YYYY-MM-DD\x20HH:mm:ss','isValid','scheduledat\x20wrong\x20format\x20(YYYY-MM-DD\x20HH:mm:ss)','includes','agent\x20not\x20exists','email','email\x20wrong\x20format','dateOfBirth','dateOfBirth\x20wrong\x20format\x20(YYYY-MM-DD)','firstName','\x20not\x20specified','SystemRow','appendFileSync','rows','contact:import:','abort','SystemError','step','duplicates','cm_contacts_','\x20LIKE\x20cm_contacts;','campaigns_','CREATE\x20TABLE\x20','(id\x20int,dialTimezone\x20varchar(255),offset\x20int);','each','then','format','VoiceQueueId','voice_queues_has_cm_blacklists','CampaignId','campaigns_has_cm_blacklists','voice_queues_has_cm_lists','DROP\x20TABLE\x20','finish','affectedRows','emit','unlink','argv','arguments\x20\x20\x20','file\x20doesn\x27t\x20exists','binding\x20doesn\x27t\x20exists','firstName\x20is\x20mandatory','ListId\x20is\x20mandatory','body\x20id\x20mandatory','map','SIGINT','path','lodash','papaparse','bluebird','moment','ioredis','../../../mysqldb','../../../config/environment','../../../config/environment/shared','../../../config/logger','redis','localhost','test','select','field','phone','from','join','.id\x20=\x20','where','.dialCheckDuplicateType\x20IN\x20(','cm_contacts.phone','cm_contacts.scheduledat','cm_contacts.id','cm_contacts.ListId','cm_contacts.createdAt','cm_contacts.UserId','cm_hopper','fromQuery','scheduledat','ContactId','ListId','createdAt','updatedAt','priority','recallme','cm_contacts','.CmListId','cm_contacts.createdAt\x20=\x20?','cm_contacts.phone\x20NOT\x20IN\x20(?)','\x22always\x22','\x22onlyIfOpen\x22','cm_contacts.updatedAt','insert','into','cm_hopper_black','fields','cm_contacts.ListId\x20=\x20'];(function(_0xe15270,_0x227d06){var _0x1e813b=function(_0x1d590d){while(--_0x1d590d){_0xe15270['push'](_0xe15270['shift']());}};_0x1e813b(++_0x227d06);}(_0x7a54,0x106));var _0x47a5=function(_0x21caff,_0x5158a7){_0x21caff=_0x21caff-0x0;var _0x748c92=_0x7a54[_0x21caff];return _0x748c92;};'use strict';var fs=require('fs');var path=require(_0x47a5('0x0'));var _=require(_0x47a5('0x1'));var Papa=require(_0x47a5('0x2'));var util=require('util');var BPromise=require(_0x47a5('0x3'));var moment=require(_0x47a5('0x4'));var squel=require('squel');var Redis=require(_0x47a5('0x5'));var db=require(_0x47a5('0x6'))['db'];var config=require(_0x47a5('0x7'));var shared=require(_0x47a5('0x8'));var logger=require(_0x47a5('0x9'))('import');config[_0x47a5('0xa')]=_['defaults'](config[_0x47a5('0xa')],{'host':_0x47a5('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x47a5('0xa')]));var stats={'finish':![],'errors':[],'rows':0x0,'affectedRows':0x0};var results=[];var stopped=![];var tmp_voice_queues;var tmp_campaigns;var tzOffset=0x0;var hasTZ;var NOW=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');function isEmail(_0x582352){return/^([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x22([^\x0d\x22\x5c\x80-\xff]|\x5c[\x00-\x7f])*\x22)(\x2e([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x22([^\x0d\x22\x5c\x80-\xff]|\x5c[\x00-\x7f])*\x22))*\x40([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x5b([^\x0d\x5b-\x5d\x80-\xff]|\x5c[\x00-\x7f])*\x5d)(\x2e([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x5b([^\x0d\x5b-\x5d\x80-\xff]|\x5c[\x00-\x7f])*\x5d))*$/[_0x47a5('0xc')](_0x582352);}function selectNotIn(_0x2baee7,_0x5e31dd,_0x2eb0dd,_0x49e844,_0x5de6d7){return squel[_0x47a5('0xd')]()[_0x47a5('0xe')](_0x47a5('0xf'))[_0x47a5('0x10')](_0x49e844)[_0x47a5('0x11')](_0x5e31dd,null,_0x5e31dd+_0x47a5('0x12')+_0x49e844+'.'+_0x2eb0dd)[_0x47a5('0x13')](_0x49e844+'.'+_0x2eb0dd+'\x20=\x20'+_0x2baee7+'.'+_0x2eb0dd)[_0x47a5('0x13')](_0x5e31dd+_0x47a5('0x14')+_0x5de6d7[_0x47a5('0x11')]()+')');}function insertCmHopper(_0x711793,_0x139f25,_0x620ee9,_0x3c6c46,_0x190faa){var _0x4e99a8=[_0x47a5('0x15'),_0x47a5('0x16'),_0x47a5('0x17'),_0x47a5('0x18'),_0x139f25+'.'+_0x3c6c46,_0x47a5('0x19'),'cm_contacts.updatedAt','cm_contacts.priority',_0x47a5('0x1a'),'\x22'+_0x190faa+'\x22'];return squel['insert']()['into'](_0x47a5('0x1b'))[_0x47a5('0x1c')]([_0x47a5('0xf'),_0x47a5('0x1d'),_0x47a5('0x1e'),_0x47a5('0x1f'),_0x3c6c46,_0x47a5('0x20'),_0x47a5('0x21'),_0x47a5('0x22'),'UserId',_0x47a5('0x23')],squel[_0x47a5('0xd')]()['fields'](_0x4e99a8)[_0x47a5('0x10')](_0x139f25)[_0x47a5('0x11')](_0x47a5('0x24'),null,'cm_contacts.ListId\x20=\x20'+_0x139f25+_0x47a5('0x25'))[_0x47a5('0x11')](_0x620ee9,null,_0x620ee9+_0x47a5('0x12')+_0x139f25+'.'+_0x3c6c46)[_0x47a5('0x13')](_0x139f25+'.CmListId\x20=\x20?',_0x711793)[_0x47a5('0x13')](_0x47a5('0x26'),NOW)['where'](_0x47a5('0x27'),selectNotIn(_0x139f25,_0x620ee9,_0x3c6c46,_0x47a5('0x1b'),[_0x47a5('0x28'),_0x47a5('0x29')]))[_0x47a5('0x13')]('cm_contacts.phone\x20NOT\x20IN\x20(?)',selectNotIn(_0x139f25,_0x620ee9,_0x3c6c46,'cm_hopper',[_0x47a5('0x28')])))['toString']();}function insertCmHopperBlack(_0x1ea9c8,_0x5b6c4e,_0x23cb77,_0x378208){var _0x36ad34=[_0x47a5('0x15'),_0x47a5('0x17'),_0x47a5('0x18'),_0x5b6c4e+'.'+_0x378208,_0x47a5('0x19'),_0x47a5('0x2a')];return squel[_0x47a5('0x2b')]()[_0x47a5('0x2c')](_0x47a5('0x2d'))[_0x47a5('0x1c')]([_0x47a5('0xf'),'ContactId',_0x47a5('0x1f'),_0x378208,'createdAt',_0x47a5('0x21')],squel[_0x47a5('0xd')]()[_0x47a5('0x2e')](_0x36ad34)['from'](_0x5b6c4e)[_0x47a5('0x11')](_0x47a5('0x24'),null,_0x47a5('0x2f')+_0x5b6c4e+_0x47a5('0x25'))['join'](_0x23cb77,null,_0x23cb77+'.id\x20=\x20'+_0x5b6c4e+'.'+_0x378208)[_0x47a5('0x13')](_0x5b6c4e+_0x47a5('0x30'),_0x1ea9c8)['where']('cm_contacts.createdAt\x20=\x20?',NOW)[_0x47a5('0x13')](_0x47a5('0x27'),squel['select']()[_0x47a5('0xe')]('phone')[_0x47a5('0x10')](_0x47a5('0x2d'))['where']('ListId\x20=\x20?',_0x1ea9c8)[_0x47a5('0x13')](_0x378208+'\x20=\x20?',_0x5b6c4e+'.'+_0x378208)))[_0x47a5('0x31')]();}function insertTzCmHopper(_0x87e4c9,_0xf269a8,_0x52749b,_0x18f7e9,_0x50c086,_0x53c754){var _0x65542e=['cm_contacts.phone',_0x47a5('0x32')+_0x53c754+'.offset-cm_contacts.utcOffset\x20minute)',_0x47a5('0x17'),_0x47a5('0x18'),_0xf269a8+'.'+_0x18f7e9,_0x47a5('0x19'),_0x47a5('0x2a'),_0x47a5('0x33'),_0x47a5('0x1a'),'\x22'+_0x50c086+'\x22'];var _0xee582c=squel[_0x47a5('0x2b')]()[_0x47a5('0x2c')]('cm_hopper')[_0x47a5('0x1c')]([_0x47a5('0xf'),'scheduledat',_0x47a5('0x1e'),_0x47a5('0x1f'),_0x18f7e9,_0x47a5('0x20'),'updatedAt',_0x47a5('0x22'),_0x47a5('0x34'),'recallme'],squel[_0x47a5('0xd')]()[_0x47a5('0x2e')](_0x65542e)['from'](_0xf269a8)['join']('cm_contacts',null,_0x47a5('0x2f')+_0xf269a8+'.CmListId')[_0x47a5('0x11')](_0x52749b,null,_0x52749b+_0x47a5('0x12')+_0xf269a8+'.'+_0x18f7e9)[_0x47a5('0x11')](_0x53c754,null,_0x53c754+_0x47a5('0x12')+_0xf269a8+'.'+_0x18f7e9)[_0x47a5('0x13')](_0xf269a8+_0x47a5('0x30'),_0x87e4c9)[_0x47a5('0x13')](_0x47a5('0x26'),NOW)[_0x47a5('0x13')](_0x47a5('0x27'),selectNotIn(_0xf269a8,_0x52749b,_0x18f7e9,_0x47a5('0x1b'),[_0x47a5('0x28'),_0x47a5('0x29')]))['where'](_0x47a5('0x27'),selectNotIn(_0xf269a8,_0x52749b,_0x18f7e9,_0x47a5('0x1b'),[_0x47a5('0x28')])))[_0x47a5('0x31')]();return _0xee582c;}function insertTzCmHopperBlack(_0x586f4f,_0x7de536,_0x528ef3,_0x47c7a2){var _0x55c43d=['cm_contacts.phone',_0x47a5('0x17'),'cm_contacts.ListId',_0x7de536+'.'+_0x47c7a2,_0x47a5('0x19'),_0x47a5('0x2a')];return squel[_0x47a5('0x2b')]()['into'](_0x47a5('0x2d'))[_0x47a5('0x1c')](['phone','ContactId',_0x47a5('0x1f'),_0x47c7a2,'createdAt',_0x47a5('0x21')],squel[_0x47a5('0xd')]()[_0x47a5('0x2e')](_0x55c43d)[_0x47a5('0x10')](_0x7de536)[_0x47a5('0x11')](_0x47a5('0x24'),null,_0x47a5('0x2f')+_0x7de536+_0x47a5('0x25'))[_0x47a5('0x11')](_0x528ef3,null,_0x528ef3+_0x47a5('0x12')+_0x7de536+'.'+_0x47c7a2)[_0x47a5('0x13')](_0x7de536+_0x47a5('0x30'),_0x586f4f)[_0x47a5('0x13')](_0x47a5('0x26'),NOW)[_0x47a5('0x13')](_0x47a5('0x27'),squel['select']()[_0x47a5('0xe')](_0x47a5('0xf'))['from']('cm_hopper_black')[_0x47a5('0x13')]('ListId\x20=\x20?',_0x586f4f)[_0x47a5('0x13')](_0x47c7a2+_0x47a5('0x35'),_0x7de536+'.'+_0x47c7a2)))['toString']();}function insertCmContact(_0x4f62d3,_0x3d85cc,_0x52d409,_0x2d147c){var _0x1d1039=_[_0x47a5('0x36')](_[_0x47a5('0x37')](_0x2d147c),[_0x47a5('0x1f'),_0x47a5('0x38'),_0x47a5('0x20'),'updatedAt']);return squel['insert']()[_0x47a5('0x2c')](_0x47a5('0x24'))[_0x47a5('0x1c')](_0x1d1039,squel[_0x47a5('0xd')]()[_0x47a5('0x2e')](_0x1d1039)[_0x47a5('0x10')](_0x3d85cc)[_0x47a5('0x13')]('('+_0x52d409['join'](',')+_0x47a5('0x39'),squel[_0x47a5('0xd')]()[_0x47a5('0x2e')](_0x52d409)['from'](_0x47a5('0x24'))['where'](_0x47a5('0x3a'),_0x4f62d3)[_0x47a5('0x13')](_0x47a5('0x3b')))[_0x47a5('0x13')]('id\x20IN\x20?',squel[_0x47a5('0xd')]()[_0x47a5('0xe')](_0x47a5('0x3c'),_0x47a5('0x3d'))[_0x47a5('0x10')](_0x3d85cc)[_0x47a5('0x3e')](_0x52d409[_0x47a5('0x11')](','))))['toString']();}function handleStop(){logger[_0x47a5('0x3f')](_0x47a5('0x40'));stopped=!![];}function handleUncaughtException(_0x187d7e){logger[_0x47a5('0x41')](_0x187d7e[_0x47a5('0x42')]);process[_0x47a5('0x43')](0x1);}function handleError(_0x572233,_0x1ad6a9){stats[_0x47a5('0x44')][_0x47a5('0x45')]({'name':_0x1ad6a9['code'],'message':_0x1ad6a9[_0x47a5('0x42')],'row':_0x572233});}function handleQuery(_0x3c78b7){logger[_0x47a5('0x3f')](_0x3c78b7);return db['sequelize']['query'](_0x3c78b7)[_0x47a5('0x46')](function(_0x376e1d){results['push'](_0x376e1d);})['catch'](function(_0x6d6b2b){logger['error'](_0x6d6b2b[_0x47a5('0x42')]);});}function updateTzCampaigns(_0x5d383d){return new Promise(function(_0x482de6,_0x389ed9){var _0x46d2d3=squel['select']()[_0x47a5('0x2e')]([_0x47a5('0x47'),'campaigns.dialTimezone'])['from'](_0x47a5('0x48'))[_0x47a5('0x11')](_0x47a5('0x49'),null,_0x47a5('0x4a'))['where'](_0x47a5('0x4b')+_0x5d383d);db[_0x47a5('0x4c')][_0x47a5('0x4d')](_0x46d2d3['toString']())[_0x47a5('0x46')](function(_0x4db625){var _0x485e3c=[];for(var _0x470da6=0x0;_0x470da6<_0x4db625[_0x47a5('0x4e')];_0x470da6++){_0x485e3c[_0x47a5('0x45')](getTimezoneData(_0x4db625[_0x470da6],tmp_campaigns));}BPromise[_0x47a5('0x4f')](_0x485e3c)['then'](function(){_0x482de6({'val':0x1});});})[_0x47a5('0x50')](function(_0x5d1550){logger['error'](_0x5d1550['message']);_0x482de6({'val':0x0});});});}function updateTzVoiceQueues(_0x4f8564){return new Promise(function(_0x212d92,_0x6cd4ea){var _0x1e2bb4=squel['select']()['fields']([_0x47a5('0x51'),_0x47a5('0x52')])[_0x47a5('0x10')](_0x47a5('0x53'))[_0x47a5('0x11')]('voice_queues_has_cm_lists',null,_0x47a5('0x54'))['where'](_0x47a5('0x55')+_0x4f8564);db[_0x47a5('0x4c')]['query'](_0x1e2bb4[_0x47a5('0x31')]())[_0x47a5('0x46')](function(_0x132854){var _0x3e8274=[];for(var _0x2d6494=0x0;_0x2d6494<_0x132854[_0x47a5('0x4e')];_0x2d6494++){_0x3e8274[_0x47a5('0x45')](getTimezoneData(_0x132854[_0x2d6494],tmp_voice_queues));}BPromise[_0x47a5('0x4f')](_0x3e8274)['then'](function(){_0x212d92({'val':0x1});});})[_0x47a5('0x50')](function(_0x2a3a57){logger[_0x47a5('0x41')](_0x2a3a57[_0x47a5('0x42')]);_0x212d92({'val':0x0});});});}function getTimezoneData(_0x396cb0,_0x4bbe14){return new Promise(function(_0xbec033,_0xdfcecc){var _0x1224bc=shared[_0x47a5('0x56')];var _0x4228a3=_0x1224bc[_0x396cb0[_0x47a5('0x57')]];if(_[_0x47a5('0x58')](_0x4228a3)){_0xbec033({'ret':0x1});}else{var _0x149d34=_0x4228a3[_0x47a5('0x59')];var _0x44cb90=squel[_0x47a5('0x2b')]()[_0x47a5('0x2c')](_0x4bbe14)[_0x47a5('0x5a')]('id',_0x396cb0['id'])[_0x47a5('0x5a')](_0x47a5('0x5b'),_0x149d34)['set'](_0x47a5('0x57'),_0x396cb0[_0x47a5('0x57')])[_0x47a5('0x31')]();return db['sequelize'][_0x47a5('0x4d')](_0x44cb90)[_0x47a5('0x46')](function(_0x36c67){_0xbec033({'ret':0x1});})[_0x47a5('0x50')](function(_0x5d9822){logger[_0x47a5('0x41')](_0x5d9822['message']);_0xdfcecc({'ret':0x1});});}});}function handleTZQuery(_0x2d5ee6){logger['info'](_0x2d5ee6);return db[_0x47a5('0x4c')]['query'](_0x2d5ee6)[_0x47a5('0x46')](function(_0x2f27c3){})[_0x47a5('0x50')](function(_0x58473b){logger['error'](_0x58473b['message']);});}function main(_0x4164a3,_0x2b1303,_0xe3c0a7,_0x117510){logger['info'](_0x47a5('0x5c'),_0x4164a3,JSON[_0x47a5('0x5d')](_0x2b1303));process[_0x47a5('0x5e')](_0x47a5('0x5f'));var _0x308c9a=_0x2b1303[_0x47a5('0x60')];var _0x1155f6=_0x2b1303[_0x47a5('0x61')];var _0x4618a0=path[_0x47a5('0x11')](config[_0x47a5('0x62')],_0x47a5('0x63'),_0x1155f6+'.csv');hasTZ=_[_0x47a5('0x37')](_0x308c9a)['includes'](_0x47a5('0x57'));var _0x2ac30f=_[_0x47a5('0x37')](_0x308c9a)[_0x47a5('0x11')]();logger[_0x47a5('0x3f')](_0x47a5('0x64'),_0x2ac30f);if(hasTZ)_0x2ac30f+=_0x47a5('0x65');fs[_0x47a5('0x66')](_0x4618a0,_0x2ac30f+'\x0a');Papa[_0x47a5('0x67')](fs[_0x47a5('0x68')](_0x4164a3),{'header':!![],'skipEmptyLines':!![],'step':function(_0x1cfb37,_0x1f07ac){try{for(var _0x8f0035=0x0,_0x2d434c=[];_0x8f0035<_0x1cfb37[_0x47a5('0x69')]['length'];_0x8f0035++){stats['rows']+=0x1;if(_0x1cfb37['errors'][_0x8f0035]){handleError(_0x1cfb37['data'][_0x8f0035],_0x1cfb37[_0x47a5('0x44')][_0x8f0035]);}else{var _0x28b8e9=[];for(var _0x5d6916 in _0x308c9a){if(_0x308c9a[_0x47a5('0x6a')](_0x5d6916)){if(_0x1cfb37[_0x47a5('0x69')][_0x8f0035][_0x308c9a[_0x5d6916]]){var _0x1baa5a=_[_0x47a5('0x6b')](_0x1cfb37[_0x47a5('0x69')][_0x8f0035][_0x308c9a[_0x5d6916]][_0x47a5('0x6c')](/"/g,'\x27'));switch(_0x5d6916){case _0x47a5('0x1d'):var _0x1c7302=moment(_0x1baa5a,_0x47a5('0x6d'),!![]);if(_0x1c7302[_0x47a5('0x6e')]()){_0x2d434c[_0x47a5('0x45')]('\x22'+_0x1baa5a+'\x22');}else{_0x28b8e9['push'](_0x47a5('0x6f'));}break;case _0x47a5('0x22'):var _0x420671=parseInt(_0x1baa5a);_0x1baa5a=_['isNaN'](_0x420671)||_0x420671<0x0||_0x420671>0x4?_0x117510?0x3:0x2:_0x420671;_0x2d434c[_0x47a5('0x45')]('\x22'+_0x1baa5a+'\x22');break;case _0x47a5('0x34'):var _0x17b61d=parseInt(_0x1baa5a);if(_['isNumber'](_0x17b61d)&&_[_0x47a5('0x70')](_0xe3c0a7,_0x17b61d)){_0x2d434c['push']('\x22'+_0x17b61d+'\x22');}else{_0x28b8e9['push'](_0x47a5('0x71'));}break;case _0x47a5('0x72'):if(isEmail(_0x1baa5a)){_0x2d434c[_0x47a5('0x45')]('\x22'+_0x1baa5a+'\x22');}else{_0x28b8e9[_0x47a5('0x45')](_0x47a5('0x73'));}break;case _0x47a5('0x74'):var _0x479a82=moment(_0x1baa5a,'YYYY-MM-DD',!![]);if(_0x479a82[_0x47a5('0x6e')]()){_0x2d434c['push']('\x22'+_0x1baa5a+'\x22');}else{_0x28b8e9[_0x47a5('0x45')](_0x47a5('0x75'));}break;case _0x47a5('0x57'):var _0xb16bdd=shared['timezones'];var _0x3c66e3=_0xb16bdd[_0x1baa5a];if(!_['isNil'](_0x3c66e3)){var _0x5f3a04=_0x3c66e3[_0x47a5('0x59')];_0x2d434c[_0x47a5('0x45')]('\x22'+_0x1baa5a+'\x22');_0x2d434c['push']('\x22'+_0x5f3a04+'\x22');}break;default:_0x2d434c[_0x47a5('0x45')]('\x22'+_0x1baa5a+'\x22');}}else{switch(_0x5d6916){case _0x47a5('0x76'):case _0x47a5('0xf'):_0x28b8e9['push'](_0x5d6916+_0x47a5('0x77'));break;default:_0x2d434c['push']('\x22\x22');}}}}if(_0x28b8e9[_0x47a5('0x4e')]){handleError(_0x1cfb37[_0x47a5('0x69')][_0x8f0035],{'code':_0x47a5('0x78'),'message':_0x28b8e9['join']()});}else{fs[_0x47a5('0x79')](_0x4618a0,_0x2d434c[_0x47a5('0x11')]()+'\x0a');}_0x2d434c=[];}if(!(stats[_0x47a5('0x7a')]%0xc8)){socket['emit'](_0x47a5('0x7b')+_0x1155f6,stats);stats['errors']=[];}}if(stopped){logger[_0x47a5('0x3f')]('Abort\x20parser');_0x1f07ac[_0x47a5('0x7c')]();}}catch(_0x20d8bd){handleError(_0x1cfb37[_0x47a5('0x69')][_0x8f0035],{'code':_0x47a5('0x7d'),'message':_0x20d8bd['message']});logger[_0x47a5('0x41')](_0x47a5('0x7e'),_0x20d8bd[_0x47a5('0x42')]);}},'complete':function(){try{var _0x1bbfba=[];var _0x22d84a=[];var _0x57ac25='cm_contacts';if(_0x2b1303[_0x47a5('0x7f')]&&_0x2b1303['duplicates'][_0x47a5('0x4e')]){_0x57ac25=_0x47a5('0x80')+_0x1155f6;_0x1bbfba[_0x47a5('0x45')]('CREATE\x20TABLE\x20'+_0x57ac25+_0x47a5('0x81'));}tmp_campaigns=_0x47a5('0x82')+_0x1155f6;tmp_voice_queues='voice_queues_'+_0x1155f6;_0x22d84a[_0x47a5('0x45')](_0x47a5('0x83')+tmp_campaigns+_0x47a5('0x84'));_0x22d84a[_0x47a5('0x45')]('CREATE\x20TABLE\x20'+tmp_voice_queues+'(id\x20int,dialTimezone\x20varchar(255),offset\x20int);');BPromise[_0x47a5('0x85')](_0x22d84a,handleTZQuery)[_0x47a5('0x86')](function(_0x48e7f3){updateTzCampaigns(_0x2b1303[_0x47a5('0x1f')])[_0x47a5('0x86')](function(_0x5a0901){updateTzVoiceQueues(_0x2b1303[_0x47a5('0x1f')])[_0x47a5('0x86')](function(_0x2930d9){var _0x59f010=util[_0x47a5('0x87')]('LOAD\x20DATA\x20LOCAL\x20INFILE\x20\x27%s\x27\x20INTO\x20TABLE\x20%s\x20CHARACTER\x20SET\x20UTF8\x20FIELDS\x20TERMINATED\x20BY\x20\x27,\x27\x20ENCLOSED\x20BY\x20\x27\x22\x27\x20LINES\x20TERMINATED\x20BY\x20\x27\x0a\x27\x20IGNORE\x201\x20ROWS\x20(%s)\x20SET\x20id\x20=\x20NULL,\x20ListId\x20=\x20%s,\x20CompanyId\x20=\x20%s,\x20createdAt\x20=\x20\x27%s\x27,\x20updatedAt\x20=\x20\x27%s\x27',_0x4618a0,_0x57ac25,_0x2ac30f,_0x2b1303[_0x47a5('0x1f')],_0x2b1303['CompanyId']||null,NOW,NOW);if(_[_0x47a5('0x58')](_0x308c9a[_0x47a5('0x1d')])){_0x59f010+=',\x20scheduledAt\x20=\x20NOW()';}_0x1bbfba[_0x47a5('0x45')](_0x59f010);if(_0x2b1303['duplicates']&&_0x2b1303[_0x47a5('0x7f')][_0x47a5('0x4e')]){_0x1bbfba[_0x47a5('0x45')](insertCmContact(_0x2b1303[_0x47a5('0x1f')],_0x57ac25,_0x2b1303['duplicates'],_0x308c9a));}if(hasTZ){_0x1bbfba[_0x47a5('0x45')](insertTzCmHopper(_0x2b1303['ListId'],'voice_queues_has_cm_lists',_0x47a5('0x53'),_0x47a5('0x88'),_0x117510,tmp_voice_queues));_0x1bbfba[_0x47a5('0x45')](insertTzCmHopperBlack(_0x2b1303[_0x47a5('0x1f')],_0x47a5('0x89'),'voice_queues',_0x47a5('0x88')));_0x1bbfba[_0x47a5('0x45')](insertTzCmHopper(_0x2b1303[_0x47a5('0x1f')],_0x47a5('0x49'),'campaigns',_0x47a5('0x8a'),_0x117510,tmp_campaigns));_0x1bbfba['push'](insertTzCmHopperBlack(_0x2b1303[_0x47a5('0x1f')],_0x47a5('0x8b'),_0x47a5('0x48'),_0x47a5('0x8a')));}else{_0x1bbfba[_0x47a5('0x45')](insertCmHopper(_0x2b1303[_0x47a5('0x1f')],_0x47a5('0x8c'),_0x47a5('0x53'),_0x47a5('0x88'),_0x117510));_0x1bbfba['push'](insertCmHopperBlack(_0x2b1303[_0x47a5('0x1f')],_0x47a5('0x89'),'voice_queues',_0x47a5('0x88')));_0x1bbfba[_0x47a5('0x45')](insertCmHopper(_0x2b1303[_0x47a5('0x1f')],'campaigns_has_cm_lists','campaigns',_0x47a5('0x8a'),_0x117510));_0x1bbfba[_0x47a5('0x45')](insertCmHopperBlack(_0x2b1303['ListId'],'campaigns_has_cm_blacklists',_0x47a5('0x48'),_0x47a5('0x8a')));}_0x1bbfba['push'](_0x47a5('0x8d')+tmp_campaigns+';');_0x1bbfba[_0x47a5('0x45')]('DROP\x20TABLE\x20'+tmp_voice_queues+';');BPromise[_0x47a5('0x85')](_0x1bbfba,handleQuery)[_0x47a5('0x86')](function(_0x109805){stats[_0x47a5('0x8e')]=!![];stats[_0x47a5('0x8f')]=_0x2b1303[_0x47a5('0x7f')]&&_0x2b1303['duplicates']['length']?results[0x2]['affectedRows']:results[0x0][_0x47a5('0x8f')];socket[_0x47a5('0x90')]('contact:import:'+_0x1155f6,stats);fs[_0x47a5('0x91')](_0x4164a3);fs[_0x47a5('0x91')](_0x4618a0);process[_0x47a5('0x43')](0x0);})[_0x47a5('0x50')](function(_0xcdbfd7){logger['error'](_0xcdbfd7[_0x47a5('0x42')]);process['exit'](0x1);});})['catch'](function(_0x5db0ed){logger[_0x47a5('0x41')](_0x5db0ed['message']);process[_0x47a5('0x43')](0x1);});});});}catch(_0xf3edc8){logger[_0x47a5('0x41')]('complete',_0xf3edc8[_0x47a5('0x42')]);process[_0x47a5('0x43')](0x1);}},'error':function(_0x35bf37,_0x121750,_0x392ad7,_0x581a87){throw new Error(_0x581a87);}});}function validate(){if(process[_0x47a5('0x92')]&&process[_0x47a5('0x92')]['length']<0x4){throw new Error(_0x47a5('0x93'));}var _0x419870=path[_0x47a5('0x11')](config[_0x47a5('0x62')],_0x47a5('0x63'),process[_0x47a5('0x92')][0x2]);if(!fs['existsSync'](_0x419870)){throw new Error(_0x47a5('0x94'));}var _0x2e418d={};try{_0x2e418d=JSON['parse'](process[_0x47a5('0x92')][0x3]);if(!_0x2e418d[_0x47a5('0x60')]){throw new Error(_0x47a5('0x95'));}if(!_0x2e418d[_0x47a5('0x60')]['phone']){throw new Error('phone\x20is\x20mandatory');}if(!_0x2e418d['binding']['firstName']){throw new Error(_0x47a5('0x96'));}var _0x27793e=0x0;if(_0x2e418d[_0x47a5('0x60')][_0x47a5('0x34')]){_0x27793e=0x1;}if(!_0x2e418d[_0x47a5('0x1f')]){throw new Error(_0x47a5('0x97'));}}catch(_0xac1f9e){throw new Error(_0x47a5('0x98'));}var _0x4bd164=[];try{_0x4bd164=_[_0x47a5('0x99')](JSON[_0x47a5('0x67')](process[_0x47a5('0x92')][0x4]),'id');}catch(_0x399528){logger['info']('No\x20agent\x20available');}main(_0x419870,_0x2e418d,_0x4bd164,_0x27793e);}validate();process['on'](_0x47a5('0x9a'),handleStop);process['on']('uncaughtException',handleUncaughtException); \ No newline at end of file +var _0x7a54=['.CmListId\x20=\x20?','toString','date_add(cm_contacts.scheduledat,interval\x20','cm_contacts.priority','UserId','\x20=\x20?','concat','keys','CompanyId',')\x20NOT\x20IN\x20?','ListId\x20=\x20?','deletedAt\x20IS\x20NULL','MIN(id)','min_id','group','info','Received\x20SIGINT','error','message','exit','errors','push','spread','campaigns.id','campaigns','campaigns_has_cm_lists','campaigns.id\x20=\x20campaigns_has_cm_lists.CampaignId','campaigns_has_cm_lists.CmListId=','sequelize','query','length','all','catch','voice_queues.id','voice_queues.dialTimezone','voice_queues','voice_queues.id\x20=\x20voice_queues_has_cm_lists.VoiceQueueId','voice_queues_has_cm_lists.CmListId=','timezones','dialTimezone','isNil','utcOffset','set','offset','main','stringify','send','start','binding','socket_timestamp','root','server/files/tmp','header',',utcOffset','writeFileSync','parse','createReadStream','data','hasOwnProperty','trim','replace','YYYY-MM-DD\x20HH:mm:ss','isValid','scheduledat\x20wrong\x20format\x20(YYYY-MM-DD\x20HH:mm:ss)','includes','agent\x20not\x20exists','email','email\x20wrong\x20format','dateOfBirth','dateOfBirth\x20wrong\x20format\x20(YYYY-MM-DD)','firstName','\x20not\x20specified','SystemRow','appendFileSync','rows','contact:import:','abort','SystemError','step','duplicates','cm_contacts_','\x20LIKE\x20cm_contacts;','campaigns_','CREATE\x20TABLE\x20','(id\x20int,dialTimezone\x20varchar(255),offset\x20int);','each','then','format','VoiceQueueId','voice_queues_has_cm_blacklists','CampaignId','campaigns_has_cm_blacklists','voice_queues_has_cm_lists','DROP\x20TABLE\x20','finish','affectedRows','emit','unlink','argv','arguments\x20\x20\x20','file\x20doesn\x27t\x20exists','binding\x20doesn\x27t\x20exists','firstName\x20is\x20mandatory','ListId\x20is\x20mandatory','body\x20id\x20mandatory','map','SIGINT','path','lodash','papaparse','bluebird','moment','ioredis','../../../mysqldb','../../../config/environment','../../../config/environment/shared','../../../config/logger','redis','localhost','test','select','field','phone','from','join','.id\x20=\x20','where','.dialCheckDuplicateType\x20IN\x20(','cm_contacts.phone','cm_contacts.scheduledat','cm_contacts.id','cm_contacts.ListId','cm_contacts.createdAt','cm_contacts.UserId','cm_hopper','fromQuery','scheduledat','ContactId','ListId','createdAt','updatedAt','priority','recallme','cm_contacts','.CmListId','cm_contacts.createdAt\x20=\x20?','cm_contacts.phone\x20NOT\x20IN\x20(?)','\x22always\x22','\x22onlyIfOpen\x22','cm_contacts.updatedAt','insert','into','cm_hopper_black','fields','cm_contacts.ListId\x20=\x20'];(function(_0x5a6961,_0xd41ca6){var _0x4af0a6=function(_0x1201fe){while(--_0x1201fe){_0x5a6961['push'](_0x5a6961['shift']());}};_0x4af0a6(++_0xd41ca6);}(_0x7a54,0x106));var _0x47a5=function(_0x454fd6,_0xb29e29){_0x454fd6=_0x454fd6-0x0;var _0x116dd6=_0x7a54[_0x454fd6];return _0x116dd6;};'use strict';var fs=require('fs');var path=require(_0x47a5('0x0'));var _=require(_0x47a5('0x1'));var Papa=require(_0x47a5('0x2'));var util=require('util');var BPromise=require(_0x47a5('0x3'));var moment=require(_0x47a5('0x4'));var squel=require('squel');var Redis=require(_0x47a5('0x5'));var db=require(_0x47a5('0x6'))['db'];var config=require(_0x47a5('0x7'));var shared=require(_0x47a5('0x8'));var logger=require(_0x47a5('0x9'))('import');config[_0x47a5('0xa')]=_['defaults'](config[_0x47a5('0xa')],{'host':_0x47a5('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x47a5('0xa')]));var stats={'finish':![],'errors':[],'rows':0x0,'affectedRows':0x0};var results=[];var stopped=![];var tmp_voice_queues;var tmp_campaigns;var tzOffset=0x0;var hasTZ;var NOW=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');function isEmail(_0x582352){return/^([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x22([^\x0d\x22\x5c\x80-\xff]|\x5c[\x00-\x7f])*\x22)(\x2e([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x22([^\x0d\x22\x5c\x80-\xff]|\x5c[\x00-\x7f])*\x22))*\x40([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x5b([^\x0d\x5b-\x5d\x80-\xff]|\x5c[\x00-\x7f])*\x5d)(\x2e([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x5b([^\x0d\x5b-\x5d\x80-\xff]|\x5c[\x00-\x7f])*\x5d))*$/[_0x47a5('0xc')](_0x582352);}function selectNotIn(_0x2baee7,_0x5e31dd,_0x2eb0dd,_0x49e844,_0x5de6d7){return squel[_0x47a5('0xd')]()[_0x47a5('0xe')](_0x47a5('0xf'))[_0x47a5('0x10')](_0x49e844)[_0x47a5('0x11')](_0x5e31dd,null,_0x5e31dd+_0x47a5('0x12')+_0x49e844+'.'+_0x2eb0dd)[_0x47a5('0x13')](_0x49e844+'.'+_0x2eb0dd+'\x20=\x20'+_0x2baee7+'.'+_0x2eb0dd)[_0x47a5('0x13')](_0x5e31dd+_0x47a5('0x14')+_0x5de6d7[_0x47a5('0x11')]()+')');}function insertCmHopper(_0x711793,_0x139f25,_0x620ee9,_0x3c6c46,_0x190faa){var _0x4e99a8=[_0x47a5('0x15'),_0x47a5('0x16'),_0x47a5('0x17'),_0x47a5('0x18'),_0x139f25+'.'+_0x3c6c46,_0x47a5('0x19'),'cm_contacts.updatedAt','cm_contacts.priority',_0x47a5('0x1a'),'\x22'+_0x190faa+'\x22'];return squel['insert']()['into'](_0x47a5('0x1b'))[_0x47a5('0x1c')]([_0x47a5('0xf'),_0x47a5('0x1d'),_0x47a5('0x1e'),_0x47a5('0x1f'),_0x3c6c46,_0x47a5('0x20'),_0x47a5('0x21'),_0x47a5('0x22'),'UserId',_0x47a5('0x23')],squel[_0x47a5('0xd')]()['fields'](_0x4e99a8)[_0x47a5('0x10')](_0x139f25)[_0x47a5('0x11')](_0x47a5('0x24'),null,'cm_contacts.ListId\x20=\x20'+_0x139f25+_0x47a5('0x25'))[_0x47a5('0x11')](_0x620ee9,null,_0x620ee9+_0x47a5('0x12')+_0x139f25+'.'+_0x3c6c46)[_0x47a5('0x13')](_0x139f25+'.CmListId\x20=\x20?',_0x711793)[_0x47a5('0x13')](_0x47a5('0x26'),NOW)['where'](_0x47a5('0x27'),selectNotIn(_0x139f25,_0x620ee9,_0x3c6c46,_0x47a5('0x1b'),[_0x47a5('0x28'),_0x47a5('0x29')]))[_0x47a5('0x13')]('cm_contacts.phone\x20NOT\x20IN\x20(?)',selectNotIn(_0x139f25,_0x620ee9,_0x3c6c46,'cm_hopper',[_0x47a5('0x28')])))['toString']();}function insertCmHopperBlack(_0x1ea9c8,_0x5b6c4e,_0x23cb77,_0x378208){var _0x36ad34=[_0x47a5('0x15'),_0x47a5('0x17'),_0x47a5('0x18'),_0x5b6c4e+'.'+_0x378208,_0x47a5('0x19'),_0x47a5('0x2a')];return squel[_0x47a5('0x2b')]()[_0x47a5('0x2c')](_0x47a5('0x2d'))[_0x47a5('0x1c')]([_0x47a5('0xf'),'ContactId',_0x47a5('0x1f'),_0x378208,'createdAt',_0x47a5('0x21')],squel[_0x47a5('0xd')]()[_0x47a5('0x2e')](_0x36ad34)['from'](_0x5b6c4e)[_0x47a5('0x11')](_0x47a5('0x24'),null,_0x47a5('0x2f')+_0x5b6c4e+_0x47a5('0x25'))['join'](_0x23cb77,null,_0x23cb77+'.id\x20=\x20'+_0x5b6c4e+'.'+_0x378208)[_0x47a5('0x13')](_0x5b6c4e+_0x47a5('0x30'),_0x1ea9c8)['where']('cm_contacts.createdAt\x20=\x20?',NOW)[_0x47a5('0x13')](_0x47a5('0x27'),squel['select']()[_0x47a5('0xe')]('phone')[_0x47a5('0x10')](_0x47a5('0x2d'))['where']('ListId\x20=\x20?',_0x1ea9c8)[_0x47a5('0x13')](_0x378208+'\x20=\x20?',_0x5b6c4e+'.'+_0x378208)))[_0x47a5('0x31')]();}function insertTzCmHopper(_0x87e4c9,_0xf269a8,_0x52749b,_0x18f7e9,_0x50c086,_0x53c754){var _0x65542e=['cm_contacts.phone',_0x47a5('0x32')+_0x53c754+'.offset-cm_contacts.utcOffset\x20minute)',_0x47a5('0x17'),_0x47a5('0x18'),_0xf269a8+'.'+_0x18f7e9,_0x47a5('0x19'),_0x47a5('0x2a'),_0x47a5('0x33'),_0x47a5('0x1a'),'\x22'+_0x50c086+'\x22'];var _0xee582c=squel[_0x47a5('0x2b')]()[_0x47a5('0x2c')]('cm_hopper')[_0x47a5('0x1c')]([_0x47a5('0xf'),'scheduledat',_0x47a5('0x1e'),_0x47a5('0x1f'),_0x18f7e9,_0x47a5('0x20'),'updatedAt',_0x47a5('0x22'),_0x47a5('0x34'),'recallme'],squel[_0x47a5('0xd')]()[_0x47a5('0x2e')](_0x65542e)['from'](_0xf269a8)['join']('cm_contacts',null,_0x47a5('0x2f')+_0xf269a8+'.CmListId')[_0x47a5('0x11')](_0x52749b,null,_0x52749b+_0x47a5('0x12')+_0xf269a8+'.'+_0x18f7e9)[_0x47a5('0x11')](_0x53c754,null,_0x53c754+_0x47a5('0x12')+_0xf269a8+'.'+_0x18f7e9)[_0x47a5('0x13')](_0xf269a8+_0x47a5('0x30'),_0x87e4c9)[_0x47a5('0x13')](_0x47a5('0x26'),NOW)[_0x47a5('0x13')](_0x47a5('0x27'),selectNotIn(_0xf269a8,_0x52749b,_0x18f7e9,_0x47a5('0x1b'),[_0x47a5('0x28'),_0x47a5('0x29')]))['where'](_0x47a5('0x27'),selectNotIn(_0xf269a8,_0x52749b,_0x18f7e9,_0x47a5('0x1b'),[_0x47a5('0x28')])))[_0x47a5('0x31')]();return _0xee582c;}function insertTzCmHopperBlack(_0x586f4f,_0x7de536,_0x528ef3,_0x47c7a2){var _0x55c43d=['cm_contacts.phone',_0x47a5('0x17'),'cm_contacts.ListId',_0x7de536+'.'+_0x47c7a2,_0x47a5('0x19'),_0x47a5('0x2a')];return squel[_0x47a5('0x2b')]()['into'](_0x47a5('0x2d'))[_0x47a5('0x1c')](['phone','ContactId',_0x47a5('0x1f'),_0x47c7a2,'createdAt',_0x47a5('0x21')],squel[_0x47a5('0xd')]()[_0x47a5('0x2e')](_0x55c43d)[_0x47a5('0x10')](_0x7de536)[_0x47a5('0x11')](_0x47a5('0x24'),null,_0x47a5('0x2f')+_0x7de536+_0x47a5('0x25'))[_0x47a5('0x11')](_0x528ef3,null,_0x528ef3+_0x47a5('0x12')+_0x7de536+'.'+_0x47c7a2)[_0x47a5('0x13')](_0x7de536+_0x47a5('0x30'),_0x586f4f)[_0x47a5('0x13')](_0x47a5('0x26'),NOW)[_0x47a5('0x13')](_0x47a5('0x27'),squel['select']()[_0x47a5('0xe')](_0x47a5('0xf'))['from']('cm_hopper_black')[_0x47a5('0x13')]('ListId\x20=\x20?',_0x586f4f)[_0x47a5('0x13')](_0x47c7a2+_0x47a5('0x35'),_0x7de536+'.'+_0x47c7a2)))['toString']();}function insertCmContact(_0x4f62d3,_0x3d85cc,_0x52d409,_0x2d147c){var _0x1d1039=_[_0x47a5('0x36')](_[_0x47a5('0x37')](_0x2d147c),[_0x47a5('0x1f'),_0x47a5('0x38'),_0x47a5('0x20'),'updatedAt']);return squel['insert']()[_0x47a5('0x2c')](_0x47a5('0x24'))[_0x47a5('0x1c')](_0x1d1039,squel[_0x47a5('0xd')]()[_0x47a5('0x2e')](_0x1d1039)[_0x47a5('0x10')](_0x3d85cc)[_0x47a5('0x13')]('('+_0x52d409['join'](',')+_0x47a5('0x39'),squel[_0x47a5('0xd')]()[_0x47a5('0x2e')](_0x52d409)['from'](_0x47a5('0x24'))['where'](_0x47a5('0x3a'),_0x4f62d3)[_0x47a5('0x13')](_0x47a5('0x3b')))[_0x47a5('0x13')]('id\x20IN\x20?',squel[_0x47a5('0xd')]()[_0x47a5('0xe')](_0x47a5('0x3c'),_0x47a5('0x3d'))[_0x47a5('0x10')](_0x3d85cc)[_0x47a5('0x3e')](_0x52d409[_0x47a5('0x11')](','))))['toString']();}function handleStop(){logger[_0x47a5('0x3f')](_0x47a5('0x40'));stopped=!![];}function handleUncaughtException(_0x187d7e){logger[_0x47a5('0x41')](_0x187d7e[_0x47a5('0x42')]);process[_0x47a5('0x43')](0x1);}function handleError(_0x572233,_0x1ad6a9){stats[_0x47a5('0x44')][_0x47a5('0x45')]({'name':_0x1ad6a9['code'],'message':_0x1ad6a9[_0x47a5('0x42')],'row':_0x572233});}function handleQuery(_0x3c78b7){logger[_0x47a5('0x3f')](_0x3c78b7);return db['sequelize']['query'](_0x3c78b7)[_0x47a5('0x46')](function(_0x376e1d){results['push'](_0x376e1d);})['catch'](function(_0x6d6b2b){logger['error'](_0x6d6b2b[_0x47a5('0x42')]);});}function updateTzCampaigns(_0x5d383d){return new Promise(function(_0x482de6,_0x389ed9){var _0x46d2d3=squel['select']()[_0x47a5('0x2e')]([_0x47a5('0x47'),'campaigns.dialTimezone'])['from'](_0x47a5('0x48'))[_0x47a5('0x11')](_0x47a5('0x49'),null,_0x47a5('0x4a'))['where'](_0x47a5('0x4b')+_0x5d383d);db[_0x47a5('0x4c')][_0x47a5('0x4d')](_0x46d2d3['toString']())[_0x47a5('0x46')](function(_0x4db625){var _0x485e3c=[];for(var _0x470da6=0x0;_0x470da6<_0x4db625[_0x47a5('0x4e')];_0x470da6++){_0x485e3c[_0x47a5('0x45')](getTimezoneData(_0x4db625[_0x470da6],tmp_campaigns));}BPromise[_0x47a5('0x4f')](_0x485e3c)['then'](function(){_0x482de6({'val':0x1});});})[_0x47a5('0x50')](function(_0x5d1550){logger['error'](_0x5d1550['message']);_0x482de6({'val':0x0});});});}function updateTzVoiceQueues(_0x4f8564){return new Promise(function(_0x212d92,_0x6cd4ea){var _0x1e2bb4=squel['select']()['fields']([_0x47a5('0x51'),_0x47a5('0x52')])[_0x47a5('0x10')](_0x47a5('0x53'))[_0x47a5('0x11')]('voice_queues_has_cm_lists',null,_0x47a5('0x54'))['where'](_0x47a5('0x55')+_0x4f8564);db[_0x47a5('0x4c')]['query'](_0x1e2bb4[_0x47a5('0x31')]())[_0x47a5('0x46')](function(_0x132854){var _0x3e8274=[];for(var _0x2d6494=0x0;_0x2d6494<_0x132854[_0x47a5('0x4e')];_0x2d6494++){_0x3e8274[_0x47a5('0x45')](getTimezoneData(_0x132854[_0x2d6494],tmp_voice_queues));}BPromise[_0x47a5('0x4f')](_0x3e8274)['then'](function(){_0x212d92({'val':0x1});});})[_0x47a5('0x50')](function(_0x2a3a57){logger[_0x47a5('0x41')](_0x2a3a57[_0x47a5('0x42')]);_0x212d92({'val':0x0});});});}function getTimezoneData(_0x396cb0,_0x4bbe14){return new Promise(function(_0xbec033,_0xdfcecc){var _0x1224bc=shared[_0x47a5('0x56')];var _0x4228a3=_0x1224bc[_0x396cb0[_0x47a5('0x57')]];if(_[_0x47a5('0x58')](_0x4228a3)){_0xbec033({'ret':0x1});}else{var _0x149d34=_0x4228a3[_0x47a5('0x59')];var _0x44cb90=squel[_0x47a5('0x2b')]()[_0x47a5('0x2c')](_0x4bbe14)[_0x47a5('0x5a')]('id',_0x396cb0['id'])[_0x47a5('0x5a')](_0x47a5('0x5b'),_0x149d34)['set'](_0x47a5('0x57'),_0x396cb0[_0x47a5('0x57')])[_0x47a5('0x31')]();return db['sequelize'][_0x47a5('0x4d')](_0x44cb90)[_0x47a5('0x46')](function(_0x36c67){_0xbec033({'ret':0x1});})[_0x47a5('0x50')](function(_0x5d9822){logger[_0x47a5('0x41')](_0x5d9822['message']);_0xdfcecc({'ret':0x1});});}});}function handleTZQuery(_0x2d5ee6){logger['info'](_0x2d5ee6);return db[_0x47a5('0x4c')]['query'](_0x2d5ee6)[_0x47a5('0x46')](function(_0x2f27c3){})[_0x47a5('0x50')](function(_0x58473b){logger['error'](_0x58473b['message']);});}function main(_0x4164a3,_0x2b1303,_0xe3c0a7,_0x117510){logger['info'](_0x47a5('0x5c'),_0x4164a3,JSON[_0x47a5('0x5d')](_0x2b1303));process[_0x47a5('0x5e')](_0x47a5('0x5f'));var _0x308c9a=_0x2b1303[_0x47a5('0x60')];var _0x1155f6=_0x2b1303[_0x47a5('0x61')];var _0x4618a0=path[_0x47a5('0x11')](config[_0x47a5('0x62')],_0x47a5('0x63'),_0x1155f6+'.csv');hasTZ=_[_0x47a5('0x37')](_0x308c9a)['includes'](_0x47a5('0x57'));var _0x2ac30f=_[_0x47a5('0x37')](_0x308c9a)[_0x47a5('0x11')]();logger[_0x47a5('0x3f')](_0x47a5('0x64'),_0x2ac30f);if(hasTZ)_0x2ac30f+=_0x47a5('0x65');fs[_0x47a5('0x66')](_0x4618a0,_0x2ac30f+'\x0a');Papa[_0x47a5('0x67')](fs[_0x47a5('0x68')](_0x4164a3),{'header':!![],'skipEmptyLines':!![],'step':function(_0x1cfb37,_0x1f07ac){try{for(var _0x8f0035=0x0,_0x2d434c=[];_0x8f0035<_0x1cfb37[_0x47a5('0x69')]['length'];_0x8f0035++){stats['rows']+=0x1;if(_0x1cfb37['errors'][_0x8f0035]){handleError(_0x1cfb37['data'][_0x8f0035],_0x1cfb37[_0x47a5('0x44')][_0x8f0035]);}else{var _0x28b8e9=[];for(var _0x5d6916 in _0x308c9a){if(_0x308c9a[_0x47a5('0x6a')](_0x5d6916)){if(_0x1cfb37[_0x47a5('0x69')][_0x8f0035][_0x308c9a[_0x5d6916]]){var _0x1baa5a=_[_0x47a5('0x6b')](_0x1cfb37[_0x47a5('0x69')][_0x8f0035][_0x308c9a[_0x5d6916]][_0x47a5('0x6c')](/"/g,'\x27'));switch(_0x5d6916){case _0x47a5('0x1d'):var _0x1c7302=moment(_0x1baa5a,_0x47a5('0x6d'),!![]);if(_0x1c7302[_0x47a5('0x6e')]()){_0x2d434c[_0x47a5('0x45')]('\x22'+_0x1baa5a+'\x22');}else{_0x28b8e9['push'](_0x47a5('0x6f'));}break;case _0x47a5('0x22'):var _0x420671=parseInt(_0x1baa5a);_0x1baa5a=_['isNaN'](_0x420671)||_0x420671<0x0||_0x420671>0x4?_0x117510?0x3:0x2:_0x420671;_0x2d434c[_0x47a5('0x45')]('\x22'+_0x1baa5a+'\x22');break;case _0x47a5('0x34'):var _0x17b61d=parseInt(_0x1baa5a);if(_['isNumber'](_0x17b61d)&&_[_0x47a5('0x70')](_0xe3c0a7,_0x17b61d)){_0x2d434c['push']('\x22'+_0x17b61d+'\x22');}else{_0x28b8e9['push'](_0x47a5('0x71'));}break;case _0x47a5('0x72'):if(isEmail(_0x1baa5a)){_0x2d434c[_0x47a5('0x45')]('\x22'+_0x1baa5a+'\x22');}else{_0x28b8e9[_0x47a5('0x45')](_0x47a5('0x73'));}break;case _0x47a5('0x74'):var _0x479a82=moment(_0x1baa5a,'YYYY-MM-DD',!![]);if(_0x479a82[_0x47a5('0x6e')]()){_0x2d434c['push']('\x22'+_0x1baa5a+'\x22');}else{_0x28b8e9[_0x47a5('0x45')](_0x47a5('0x75'));}break;case _0x47a5('0x57'):var _0xb16bdd=shared['timezones'];var _0x3c66e3=_0xb16bdd[_0x1baa5a];if(!_['isNil'](_0x3c66e3)){var _0x5f3a04=_0x3c66e3[_0x47a5('0x59')];_0x2d434c[_0x47a5('0x45')]('\x22'+_0x1baa5a+'\x22');_0x2d434c['push']('\x22'+_0x5f3a04+'\x22');}break;default:_0x2d434c[_0x47a5('0x45')]('\x22'+_0x1baa5a+'\x22');}}else{switch(_0x5d6916){case _0x47a5('0x76'):case _0x47a5('0xf'):_0x28b8e9['push'](_0x5d6916+_0x47a5('0x77'));break;default:_0x2d434c['push']('\x22\x22');}}}}if(_0x28b8e9[_0x47a5('0x4e')]){handleError(_0x1cfb37[_0x47a5('0x69')][_0x8f0035],{'code':_0x47a5('0x78'),'message':_0x28b8e9['join']()});}else{fs[_0x47a5('0x79')](_0x4618a0,_0x2d434c[_0x47a5('0x11')]()+'\x0a');}_0x2d434c=[];}if(!(stats[_0x47a5('0x7a')]%0xc8)){socket['emit'](_0x47a5('0x7b')+_0x1155f6,stats);stats['errors']=[];}}if(stopped){logger[_0x47a5('0x3f')]('Abort\x20parser');_0x1f07ac[_0x47a5('0x7c')]();}}catch(_0x20d8bd){handleError(_0x1cfb37[_0x47a5('0x69')][_0x8f0035],{'code':_0x47a5('0x7d'),'message':_0x20d8bd['message']});logger[_0x47a5('0x41')](_0x47a5('0x7e'),_0x20d8bd[_0x47a5('0x42')]);}},'complete':function(){try{var _0x1bbfba=[];var _0x22d84a=[];var _0x57ac25='cm_contacts';if(_0x2b1303[_0x47a5('0x7f')]&&_0x2b1303['duplicates'][_0x47a5('0x4e')]){_0x57ac25=_0x47a5('0x80')+_0x1155f6;_0x1bbfba[_0x47a5('0x45')]('CREATE\x20TABLE\x20'+_0x57ac25+_0x47a5('0x81'));}tmp_campaigns=_0x47a5('0x82')+_0x1155f6;tmp_voice_queues='voice_queues_'+_0x1155f6;_0x22d84a[_0x47a5('0x45')](_0x47a5('0x83')+tmp_campaigns+_0x47a5('0x84'));_0x22d84a[_0x47a5('0x45')]('CREATE\x20TABLE\x20'+tmp_voice_queues+'(id\x20int,dialTimezone\x20varchar(255),offset\x20int);');BPromise[_0x47a5('0x85')](_0x22d84a,handleTZQuery)[_0x47a5('0x86')](function(_0x48e7f3){updateTzCampaigns(_0x2b1303[_0x47a5('0x1f')])[_0x47a5('0x86')](function(_0x5a0901){updateTzVoiceQueues(_0x2b1303[_0x47a5('0x1f')])[_0x47a5('0x86')](function(_0x2930d9){var _0x59f010=util[_0x47a5('0x87')]('LOAD\x20DATA\x20LOCAL\x20INFILE\x20\x27%s\x27\x20INTO\x20TABLE\x20%s\x20CHARACTER\x20SET\x20UTF8\x20FIELDS\x20TERMINATED\x20BY\x20\x27,\x27\x20ENCLOSED\x20BY\x20\x27\x22\x27\x20LINES\x20TERMINATED\x20BY\x20\x27\x0a\x27\x20IGNORE\x201\x20ROWS\x20(%s)\x20SET\x20id\x20=\x20NULL,\x20ListId\x20=\x20%s,\x20CompanyId\x20=\x20%s,\x20createdAt\x20=\x20\x27%s\x27,\x20updatedAt\x20=\x20\x27%s\x27',_0x4618a0,_0x57ac25,_0x2ac30f,_0x2b1303[_0x47a5('0x1f')],_0x2b1303['CompanyId']||null,NOW,NOW);if(_[_0x47a5('0x58')](_0x308c9a[_0x47a5('0x1d')])){_0x59f010+=',\x20scheduledAt\x20=\x20NOW()';}_0x1bbfba[_0x47a5('0x45')](_0x59f010);if(_0x2b1303['duplicates']&&_0x2b1303[_0x47a5('0x7f')][_0x47a5('0x4e')]){_0x1bbfba[_0x47a5('0x45')](insertCmContact(_0x2b1303[_0x47a5('0x1f')],_0x57ac25,_0x2b1303['duplicates'],_0x308c9a));}if(hasTZ){_0x1bbfba[_0x47a5('0x45')](insertTzCmHopper(_0x2b1303['ListId'],'voice_queues_has_cm_lists',_0x47a5('0x53'),_0x47a5('0x88'),_0x117510,tmp_voice_queues));_0x1bbfba[_0x47a5('0x45')](insertTzCmHopperBlack(_0x2b1303[_0x47a5('0x1f')],_0x47a5('0x89'),'voice_queues',_0x47a5('0x88')));_0x1bbfba[_0x47a5('0x45')](insertTzCmHopper(_0x2b1303[_0x47a5('0x1f')],_0x47a5('0x49'),'campaigns',_0x47a5('0x8a'),_0x117510,tmp_campaigns));_0x1bbfba['push'](insertTzCmHopperBlack(_0x2b1303[_0x47a5('0x1f')],_0x47a5('0x8b'),_0x47a5('0x48'),_0x47a5('0x8a')));}else{_0x1bbfba[_0x47a5('0x45')](insertCmHopper(_0x2b1303[_0x47a5('0x1f')],_0x47a5('0x8c'),_0x47a5('0x53'),_0x47a5('0x88'),_0x117510));_0x1bbfba['push'](insertCmHopperBlack(_0x2b1303[_0x47a5('0x1f')],_0x47a5('0x89'),'voice_queues',_0x47a5('0x88')));_0x1bbfba[_0x47a5('0x45')](insertCmHopper(_0x2b1303[_0x47a5('0x1f')],'campaigns_has_cm_lists','campaigns',_0x47a5('0x8a'),_0x117510));_0x1bbfba[_0x47a5('0x45')](insertCmHopperBlack(_0x2b1303['ListId'],'campaigns_has_cm_blacklists',_0x47a5('0x48'),_0x47a5('0x8a')));}_0x1bbfba['push'](_0x47a5('0x8d')+tmp_campaigns+';');_0x1bbfba[_0x47a5('0x45')]('DROP\x20TABLE\x20'+tmp_voice_queues+';');BPromise[_0x47a5('0x85')](_0x1bbfba,handleQuery)[_0x47a5('0x86')](function(_0x109805){stats[_0x47a5('0x8e')]=!![];stats[_0x47a5('0x8f')]=_0x2b1303[_0x47a5('0x7f')]&&_0x2b1303['duplicates']['length']?results[0x2]['affectedRows']:results[0x0][_0x47a5('0x8f')];socket[_0x47a5('0x90')]('contact:import:'+_0x1155f6,stats);fs[_0x47a5('0x91')](_0x4164a3);fs[_0x47a5('0x91')](_0x4618a0);process[_0x47a5('0x43')](0x0);})[_0x47a5('0x50')](function(_0xcdbfd7){logger['error'](_0xcdbfd7[_0x47a5('0x42')]);process['exit'](0x1);});})['catch'](function(_0x5db0ed){logger[_0x47a5('0x41')](_0x5db0ed['message']);process[_0x47a5('0x43')](0x1);});});});}catch(_0xf3edc8){logger[_0x47a5('0x41')]('complete',_0xf3edc8[_0x47a5('0x42')]);process[_0x47a5('0x43')](0x1);}},'error':function(_0x35bf37,_0x121750,_0x392ad7,_0x581a87){throw new Error(_0x581a87);}});}function validate(){if(process[_0x47a5('0x92')]&&process[_0x47a5('0x92')]['length']<0x4){throw new Error(_0x47a5('0x93'));}var _0x419870=path[_0x47a5('0x11')](config[_0x47a5('0x62')],_0x47a5('0x63'),process[_0x47a5('0x92')][0x2]);if(!fs['existsSync'](_0x419870)){throw new Error(_0x47a5('0x94'));}var _0x2e418d={};try{_0x2e418d=JSON['parse'](process[_0x47a5('0x92')][0x3]);if(!_0x2e418d[_0x47a5('0x60')]){throw new Error(_0x47a5('0x95'));}if(!_0x2e418d[_0x47a5('0x60')]['phone']){throw new Error('phone\x20is\x20mandatory');}if(!_0x2e418d['binding']['firstName']){throw new Error(_0x47a5('0x96'));}var _0x27793e=0x0;if(_0x2e418d[_0x47a5('0x60')][_0x47a5('0x34')]){_0x27793e=0x1;}if(!_0x2e418d[_0x47a5('0x1f')]){throw new Error(_0x47a5('0x97'));}}catch(_0xac1f9e){throw new Error(_0x47a5('0x98'));}var _0x4bd164=[];try{_0x4bd164=_[_0x47a5('0x99')](JSON[_0x47a5('0x67')](process[_0x47a5('0x92')][0x4]),'id');}catch(_0x399528){logger['info']('No\x20agent\x20available');}main(_0x419870,_0x2e418d,_0x4bd164,_0x27793e);}validate();process['on'](_0x47a5('0x9a'),handleStop);process['on']('uncaughtException',handleUncaughtException); \ No newline at end of file diff --git a/server/components/import/cm/csvUpdates.js b/server/components/import/cm/csvUpdates.js index 65ddbba..6a2b20a 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 _0x45b6=['SIGINT','uncaughtException','path','util','bluebird','moment','../../../mysqldb','../../../config/environment','../../../config/logger','import','redis','defaults','localhost','socket.io-emitter','format','YYYY-MM-DD\x20HH:mm:ss','cm_contacts_temp_','YYYYMMDDHHmmss','test','select','field','from','join','where','\x20=\x20','.dialCheckDuplicateType\x20IN\x20(','sequelize','query','select\x20*\x20from\x20','spread','length','isNil','AdditionalPhones','push','all','then','catch','error','message','split','filter','findOne','CmContactHasItem','update','updated','create','PHONE','CmHopper','phone','cm_contacts.scheduledat','cm_contacts.ListId','cm_contacts.createdAt','cm_contacts.updatedAt','cm_contacts.priority','cm_contacts.UserId','insert','into','cm_hopper','ContactId','ListId','createdAt','priority','UserId','recallme','fields','cm_contacts.ListId\x20=\x20','.CmListId','.id\x20=\x20','cm_contacts.createdAt\x20=\x20?','cm_contacts.phone\x20NOT\x20IN\x20(?)','\x22onlyIfOpen\x22','\x22always\x22','cm_contacts.phone','cm_contacts.id','cm_hopper_black','.CmListId\x20=\x20?','ListId\x20=\x20?','\x20=\x20?','toString','cm_contact_has_items.item','cm_contact_has_items.createdAt','cm_contact_has_items.updatedAt','fromQuery','CmHopperId','OrderBy','updatedAt','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','CompanyId',')\x20NOT\x20IN\x20?','id\x20IN\x20?','min_id','group','info','Received\x20SIGINT','exit','errors','code','main','send','binding','clone','socket_timestamp','root','body','ContactItemType','findAll','name','keys','header','writeFileSync','parse','createReadStream','data','rows','find','hasOwnProperty','trim','replace','scheduledat\x20wrong\x20format\x20(YYYY-MM-DD\x20HH:mm:ss)','isNumber','agent\x20not\x20exists','email','email\x20wrong\x20format','dateOfBirth','YYYY-MM-DD','isValid','dateOfBirth\x20wrong\x20format\x20(YYYY-MM-DD)','firstName','\x20not\x20specified','SystemRow','appendFileSync','emit','Abort\x20parser','abort','SystemError','CREATE\x20TABLE\x20','\x20LIKE\x20cm_contacts;','CIS\x20len','LOAD\x20DATA\x20LOCAL\x20INFILE\x20\x27%s\x27\x20INTO\x20TABLE\x20%s\x20CHARACTER\x20SET\x20UTF8\x20FIELDS\x20TERMINATED\x20BY\x20\x27,\x27\x20ENCLOSED\x20BY\x20\x27\x22\x27\x20LINES\x20TERMINATED\x20BY\x20\x27\x0a\x27\x20IGNORE\x201\x20ROWS\x20(%s)\x20SET\x20ListId\x20=\x20%s,\x20CompanyId\x20=\x20%s,\x20createdAt\x20=\x20\x27%s\x27,\x20updatedAt\x20=\x20\x27%s\x27',',\x20scheduledAt\x20=\x20NOW()','each','contact','contactId','contactTypeId','orderBy','DROP\x20TABLE\x20','contact:import:','unlink','complete','argv','server/files/tmp','file\x20doesn\x27t\x20exists','binding\x20doesn\x27t\x20exists','ListId\x20is\x20mandatory','map','No\x20agent\x20available'];(function(_0x216f8c,_0x149641){var _0x45e937=function(_0xe3527){while(--_0xe3527){_0x216f8c['push'](_0x216f8c['shift']());}};_0x45e937(++_0x149641);}(_0x45b6,0xa3));var _0x645b=function(_0x4a6c4d,_0x455768){_0x4a6c4d=_0x4a6c4d-0x0;var _0x31800b=_0x45b6[_0x4a6c4d];return _0x31800b;};'use strict';var fs=require('fs');var path=require(_0x645b('0x0'));var _=require('lodash');var Papa=require('papaparse');var util=require(_0x645b('0x1'));var BPromise=require(_0x645b('0x2'));var moment=require(_0x645b('0x3'));var squel=require('squel');var Redis=require('ioredis');var db=require(_0x645b('0x4'))['db'];var config=require(_0x645b('0x5'));var logger=require(_0x645b('0x6'))(_0x645b('0x7'));config[_0x645b('0x8')]=_[_0x645b('0x9')](config['redis'],{'host':_0x645b('0xa'),'port':0x18eb});var socket=require(_0x645b('0xb'))(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()[_0x645b('0xc')](_0x645b('0xd'));var tempTableName=_0x645b('0xe')+moment()[_0x645b('0xc')](_0x645b('0xf'));var contactItemTypes=[];var hasAdditionalPhones=![];function isEmail(_0x49caa3){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))*$/[_0x645b('0x10')](_0x49caa3);}function selectNotIn(_0x17e21c,_0x30da92,_0x40625b,_0x1ba0c7,_0x20e46b){return squel[_0x645b('0x11')]()[_0x645b('0x12')]('phone')[_0x645b('0x13')](_0x1ba0c7)[_0x645b('0x14')](_0x30da92,null,_0x30da92+'.id\x20=\x20'+_0x1ba0c7+'.'+_0x40625b)[_0x645b('0x15')](_0x1ba0c7+'.'+_0x40625b+_0x645b('0x16')+_0x17e21c+'.'+_0x40625b)[_0x645b('0x15')](_0x30da92+_0x645b('0x17')+_0x20e46b['join']()+')');}function handleAdditionalPhones(){return new Promise(function(_0x3067fd,_0x2b41bc){promisesAdditionalPhones=[];promisesContact=[];return db[_0x645b('0x18')][_0x645b('0x19')](_0x645b('0x1a')+tempTableName)[_0x645b('0x1b')](function(_0x2a18bf){if(_0x2a18bf!==null){var _0x440ccc=[];for(var _0xc1c642=0x0;_0xc1c642<_0x2a18bf[_0x645b('0x1c')];_0xc1c642++){var _0x42b2f0=_0x2a18bf[_0xc1c642];if(!_[_0x645b('0x1d')](_0x42b2f0['phone'])){if(!_[_0x645b('0x1d')](_0x42b2f0[_0x645b('0x1e')]))_0x440ccc[_0x645b('0x1f')](insertAdditionalPhones(_0x42b2f0));promisesContact[_0x645b('0x1f')]({'contact':_0x42b2f0});}}}Promise[_0x645b('0x20')](_0x440ccc)[_0x645b('0x21')](function(){_0x3067fd({'val':0x1});});})[_0x645b('0x22')](function(_0x13be9e){logger[_0x645b('0x23')](_0x13be9e[_0x645b('0x24')]);});});}function insertAdditionalPhones(_0x55fe1c){return new Promise(function(_0xc93810,_0x14a8f6){var _0x3e0420=_0x55fe1c['AdditionalPhones'];if(_[_0x645b('0x1d')](_0x3e0420))_0x14a8f6({'val':0x0});else{var _0x38ac2d=_0x3e0420[_0x645b('0x25')](';');var _0x5090a2=[];orderBy=0x0;for(var _0x447db8=0x0;_0x447db8<_0x38ac2d[_0x645b('0x1c')];_0x447db8++){_0x5090a2[_0x645b('0x1f')](splitAdditionalPhone(_0x55fe1c['id'],_0x38ac2d[_0x447db8]));}Promise[_0x645b('0x20')](_0x5090a2)[_0x645b('0x21')](function(){_0xc93810({'val':_0x38ac2d[_0x645b('0x1c')]});});}});}function splitAdditionalPhone(_0x471ad3,_0x65a9f4){return new Promise(function(_0x221964,_0x1692a7){var _0x109daa=_0x65a9f4[_0x645b('0x25')](':');var _0x31df8d=_0x109daa[0x0];var _0x300cc8=_0x109daa[0x1];if(_0x300cc8!==''){var _0x49c87f=_0x300cc8[_0x645b('0x25')]('|');var _0x2119b2=[];for(var _0x681c79=0x0;_0x681c79<_0x49c87f[_0x645b('0x1c')];_0x681c79++){if(_0x49c87f[_0x681c79]!==''){var _0x34cc11=_[_0x645b('0x26')](promisesAdditionalPhones,{'contactId':_0x471ad3,'phone':_0x49c87f[_0x681c79]});if(_0x34cc11[_0x645b('0x1c')]==0x0){orderBy++;promisesAdditionalPhones[_0x645b('0x1f')]({'contactId':_0x471ad3,'contactTypeId':_0x31df8d,'phone':_0x49c87f[_0x681c79],'orderBy':orderBy});}}}_0x221964({'ok':0x1});}else _0x221964({'res':0x0});});}function createAdditionalPhone(_0x7cdffb,_0x48971a,_0x2691cf,_0x38c9f5){return new Promise(function(_0xa86194,_0x4b28e2){return db['CmContactHasItem'][_0x645b('0x27')]({'where':{'CmContactId':_0x7cdffb,'item':_0x2691cf}})[_0x645b('0x21')](function(_0xfeb44){if(_0xfeb44){return db[_0x645b('0x28')][_0x645b('0x29')]({'ItemTypeId':_0x48971a,'OrderBy':_0x38c9f5},{'where':{'CmContactId':_0x7cdffb,'item':_0x2691cf}})[_0x645b('0x21')](function(_0x11c949){_0xa86194({'res':_0x645b('0x2a')});});}else{return db[_0x645b('0x28')][_0x645b('0x2b')]({'CmContactId':_0x7cdffb,'item':_0x2691cf,'ItemTypeId':_0x48971a,'OrderBy':_0x38c9f5,'ItemClass':_0x645b('0x2c')})[_0x645b('0x21')](function(_0x505924){_0xa86194({'res':'inserted'});});}});});}function updateContact(_0x589832){return new Promise(function(_0x273f24,_0x1bca7b){var _0x160408=_0x589832['id'];delete _0x589832['id'];return db['CmContact']['update'](_0x589832,{'where':{'id':_0x160408}})[_0x645b('0x21')](function(_0x23e0fc){updatedRows+=0x1;return db[_0x645b('0x2d')]['update']({'phone':_0x589832[_0x645b('0x2e')]},{'where':{'ContactId':_0x160408}})[_0x645b('0x21')](function(_0x4be3fc){_0x273f24({'ret':'OK'});});});});}function insertCmHopper(_0x1aa880,_0x435603,_0x776894,_0xda7441,_0x6cebf0){var _0x4b72b7=['cm_contacts.phone',_0x645b('0x2f'),'cm_contacts.id',_0x645b('0x30'),_0x435603+'.'+_0xda7441,_0x645b('0x31'),_0x645b('0x32'),_0x645b('0x33'),_0x645b('0x34'),'\x22'+_0x6cebf0+'\x22'];return squel[_0x645b('0x35')]()[_0x645b('0x36')](_0x645b('0x37'))['fromQuery']([_0x645b('0x2e'),'scheduledat',_0x645b('0x38'),_0x645b('0x39'),_0xda7441,_0x645b('0x3a'),'updatedAt',_0x645b('0x3b'),_0x645b('0x3c'),_0x645b('0x3d')],squel[_0x645b('0x11')]()[_0x645b('0x3e')](_0x4b72b7)[_0x645b('0x13')](_0x435603)[_0x645b('0x14')]('cm_contacts',null,_0x645b('0x3f')+_0x435603+_0x645b('0x40'))[_0x645b('0x14')](_0x776894,null,_0x776894+_0x645b('0x41')+_0x435603+'.'+_0xda7441)['where'](_0x435603+'.CmListId\x20=\x20?',_0x1aa880)['where'](_0x645b('0x42'),NOW)[_0x645b('0x15')](_0x645b('0x43'),selectNotIn(_0x435603,_0x776894,_0xda7441,_0x645b('0x37'),['\x22always\x22',_0x645b('0x44')]))[_0x645b('0x15')](_0x645b('0x43'),selectNotIn(_0x435603,_0x776894,_0xda7441,_0x645b('0x37'),[_0x645b('0x45')])))['toString']();}function insertCmHopperBlack(_0x3af387,_0x3aa4fa,_0x4696cd,_0x35b6b7){var _0x5c6b27=[_0x645b('0x46'),_0x645b('0x47'),_0x645b('0x30'),_0x3aa4fa+'.'+_0x35b6b7,_0x645b('0x31'),_0x645b('0x32')];return squel[_0x645b('0x35')]()[_0x645b('0x36')](_0x645b('0x48'))['fromQuery']([_0x645b('0x2e'),'ContactId','ListId',_0x35b6b7,'createdAt','updatedAt'],squel[_0x645b('0x11')]()[_0x645b('0x3e')](_0x5c6b27)[_0x645b('0x13')](_0x3aa4fa)[_0x645b('0x14')]('cm_contacts',null,_0x645b('0x3f')+_0x3aa4fa+'.CmListId')[_0x645b('0x14')](_0x4696cd,null,_0x4696cd+'.id\x20=\x20'+_0x3aa4fa+'.'+_0x35b6b7)['where'](_0x3aa4fa+_0x645b('0x49'),_0x3af387)[_0x645b('0x15')]('cm_contacts.createdAt\x20=\x20?',NOW)[_0x645b('0x15')](_0x645b('0x43'),squel[_0x645b('0x11')]()['field']('phone')[_0x645b('0x13')]('cm_hopper_black')[_0x645b('0x15')](_0x645b('0x4a'),_0x3af387)[_0x645b('0x15')](_0x35b6b7+_0x645b('0x4b'),_0x3aa4fa+'.'+_0x35b6b7)))[_0x645b('0x4c')]();}function insertCmHopperAdditionalPhones(_0x4f9d3d){var _0x5d3668=['cm_hopper.id',_0x645b('0x4d'),'cm_contact_has_items.OrderBy',_0x645b('0x4e'),_0x645b('0x4f')];return squel[_0x645b('0x35')]()[_0x645b('0x36')]('cm_hopper_additional_phones')[_0x645b('0x50')]([_0x645b('0x51'),_0x645b('0x2e'),_0x645b('0x52'),'createdAt',_0x645b('0x53')],squel[_0x645b('0x11')]()[_0x645b('0x3e')](_0x5d3668)[_0x645b('0x13')](_0x645b('0x37'))[_0x645b('0x14')](_0x645b('0x54'),null,_0x645b('0x55'))[_0x645b('0x14')](_0x645b('0x56'),null,_0x645b('0x57'))[_0x645b('0x15')](_0x645b('0x58'),_0x4f9d3d)[_0x645b('0x15')]('cm_contacts.createdAt\x20=\x20?',NOW))['toString']();}function insertCmContact(_0x32d4b1,_0x5940d1,_0x31bc45,_0x43fbcb){var _0x4cfbf1=_[_0x645b('0x59')](_['keys'](_0x43fbcb),[_0x645b('0x39'),_0x645b('0x5a'),'createdAt',_0x645b('0x53')]);return squel[_0x645b('0x35')]()['into'](_0x645b('0x54'))['fromQuery'](_0x4cfbf1,squel[_0x645b('0x11')]()[_0x645b('0x3e')](_0x4cfbf1)[_0x645b('0x13')](_0x5940d1)[_0x645b('0x15')]('('+_0x31bc45[_0x645b('0x14')](',')+_0x645b('0x5b'),squel[_0x645b('0x11')]()[_0x645b('0x3e')](_0x31bc45)[_0x645b('0x13')]('cm_contacts')[_0x645b('0x15')](_0x645b('0x4a'),_0x32d4b1))[_0x645b('0x15')](_0x645b('0x5c'),squel[_0x645b('0x11')]()[_0x645b('0x12')]('MIN(id)',_0x645b('0x5d'))[_0x645b('0x13')](_0x5940d1)[_0x645b('0x5e')](_0x31bc45[_0x645b('0x14')](','))))[_0x645b('0x4c')]();}function handleStop(){logger[_0x645b('0x5f')](_0x645b('0x60'));stopped=!![];}function handleUncaughtException(_0x2c34bd){logger[_0x645b('0x23')](_0x2c34bd[_0x645b('0x24')]);process[_0x645b('0x61')](0x1);}function handleError(_0x414695,_0x55c82f){stats[_0x645b('0x62')]['push']({'name':_0x55c82f[_0x645b('0x63')],'message':_0x55c82f[_0x645b('0x24')],'row':_0x414695});}function handleQuery(_0x273fff){logger[_0x645b('0x5f')](_0x273fff);return db[_0x645b('0x18')][_0x645b('0x19')](_0x273fff)['spread'](function(_0x1ed964){results[_0x645b('0x1f')](_0x1ed964);})[_0x645b('0x22')](function(_0x2ae805){logger[_0x645b('0x23')](_0x2ae805[_0x645b('0x24')]);});}function main(_0x53065e,_0x5b340d,_0x3d286d,_0x5cf729){logger[_0x645b('0x5f')](_0x645b('0x64'),_0x53065e,JSON['stringify'](_0x5b340d));process[_0x645b('0x65')]('start');var _0x56ecbd=_0x5b340d[_0x645b('0x66')];var _0x47be8f=_[_0x645b('0x67')](_0x56ecbd);var _0x5f2d63=_0x5b340d[_0x645b('0x68')];var _0x4adb83=path[_0x645b('0x14')](config[_0x645b('0x69')],'server/files/tmp',_0x5f2d63+'.csv');logger[_0x645b('0x5f')](_0x645b('0x6a'),_0x5b340d);db[_0x645b('0x6b')][_0x645b('0x6c')]({'raw':!![],'attributes':['id',_0x645b('0x6d')]})[_0x645b('0x21')](function(_0x2a413d){for(var _0x10ce49=0x0;_0x10ce49<_0x2a413d[_0x645b('0x1c')];_0x10ce49++){if(_0x2a413d[_0x10ce49][_0x645b('0x6d')]in _0x56ecbd){contactItemTypes[_0x645b('0x1f')](_0x2a413d[_0x10ce49]);delete _0x47be8f[_0x2a413d[_0x10ce49]['name']];hasAdditionalPhones=!![];}else{}}if(hasAdditionalPhones)_0x47be8f[_0x645b('0x1e')]='';var _0x437b90=_[_0x645b('0x6e')](_0x47be8f)[_0x645b('0x14')]();logger[_0x645b('0x5f')](_0x645b('0x6f'),_0x437b90);fs[_0x645b('0x70')](_0x4adb83,_0x437b90+'\x0a');Papa[_0x645b('0x71')](fs[_0x645b('0x72')](_0x53065e),{'header':!![],'skipEmptyLines':!![],'step':function(_0x3e3542,_0x141170){try{for(var _0x43a214=0x0,_0x558fb1=[];_0x43a214<_0x3e3542[_0x645b('0x73')][_0x645b('0x1c')];_0x43a214++){stats[_0x645b('0x74')]+=0x1;if(_0x3e3542[_0x645b('0x62')][_0x43a214]){handleError(_0x3e3542[_0x645b('0x73')][_0x43a214],_0x3e3542[_0x645b('0x62')][_0x43a214]);}else{var _0x32a8fa=[];var _0x44b2a3=[];for(var _0x1064e6 in _0x56ecbd){let _0x508537=contactItemTypes[_0x645b('0x75')](_0x3b209d=>_0x3b209d[_0x645b('0x6d')]===_0x1064e6);if(_[_0x645b('0x1d')](_0x508537)){if(_0x56ecbd[_0x645b('0x76')](_0x1064e6)){if(_0x3e3542[_0x645b('0x73')][_0x43a214][_0x56ecbd[_0x1064e6]]){var _0x2b5b87=_[_0x645b('0x77')](_0x3e3542[_0x645b('0x73')][_0x43a214][_0x56ecbd[_0x1064e6]][_0x645b('0x78')](/"/g,'\x27'));switch(_0x1064e6){case'scheduledat':var _0xe2f0c4=moment(_0x2b5b87,_0x645b('0xd'),!![]);if(_0xe2f0c4['isValid']()){_0x558fb1['push']('\x22'+_0x2b5b87+'\x22');}else{_0x32a8fa[_0x645b('0x1f')](_0x645b('0x79'));}break;case _0x645b('0x3b'):var _0x58d88d=parseInt(_0x2b5b87);_0x2b5b87=_['isNaN'](_0x58d88d)||_0x58d88d<0x0||_0x58d88d>0x4?_0x5cf729?0x3:0x2:_0x58d88d;_0x558fb1['push']('\x22'+_0x2b5b87+'\x22');break;case _0x645b('0x3c'):var _0xa477a4=parseInt(_0x2b5b87);if(_[_0x645b('0x7a')](_0xa477a4)&&_['includes'](_0x3d286d,_0xa477a4)){_0x558fb1[_0x645b('0x1f')]('\x22'+_0xa477a4+'\x22');}else{_0x32a8fa['push'](_0x645b('0x7b'));}break;case _0x645b('0x7c'):if(isEmail(_0x2b5b87)){_0x558fb1[_0x645b('0x1f')]('\x22'+_0x2b5b87+'\x22');}else{_0x32a8fa[_0x645b('0x1f')](_0x645b('0x7d'));}break;case _0x645b('0x7e'):var _0x1f93d5=moment(_0x2b5b87,_0x645b('0x7f'),!![]);if(_0x1f93d5[_0x645b('0x80')]()){_0x558fb1[_0x645b('0x1f')]('\x22'+_0x2b5b87+'\x22');}else{_0x32a8fa[_0x645b('0x1f')](_0x645b('0x81'));}break;default:_0x558fb1['push']('\x22'+_0x2b5b87+'\x22');}}else{switch(_0x1064e6){case _0x645b('0x82'):case _0x645b('0x2e'):_0x32a8fa[_0x645b('0x1f')](_0x1064e6+_0x645b('0x83'));break;default:_0x558fb1[_0x645b('0x1f')]('\x22\x22');}}}}else{var _0x1e55b2='';for(var _0x1d153b=0x0;_0x1d153b<_0x56ecbd[_0x1064e6][_0x645b('0x1c')];_0x1d153b++){var _0x2b5b87=_[_0x645b('0x77')](_0x3e3542[_0x645b('0x73')][_0x43a214][_0x56ecbd[_0x1064e6][_0x1d153b]][_0x645b('0x78')](/"/g,'\x27'));if(_0x1e55b2=='')_0x1e55b2=_0x2b5b87;else _0x1e55b2+='|'+_0x2b5b87;}_0x44b2a3['push'](_0x508537['id']+':'+_0x1e55b2);}}if(hasAdditionalPhones){_0x558fb1['push']('\x22'+_0x44b2a3[_0x645b('0x14')](';')+'\x22');}if(_0x32a8fa['length']){handleError(_0x3e3542['data'][_0x43a214],{'code':_0x645b('0x84'),'message':_0x32a8fa[_0x645b('0x14')]()});}else{fs[_0x645b('0x85')](_0x4adb83,_0x558fb1[_0x645b('0x14')]()+'\x0a');}_0x558fb1=[];}if(!(stats[_0x645b('0x74')]%0xc8)){socket[_0x645b('0x86')]('contact:import:'+_0x5f2d63,stats);stats[_0x645b('0x62')]=[];}}if(stopped){logger['info'](_0x645b('0x87'));_0x141170[_0x645b('0x88')]();}}catch(_0x452c58){handleError(_0x3e3542['data'][_0x43a214],{'code':_0x645b('0x89'),'message':_0x452c58[_0x645b('0x24')]});logger[_0x645b('0x23')]('step',_0x452c58[_0x645b('0x24')]);}},'complete':function(){try{var _0x50122a=[];var _0x1b392d=tempTableName;_0x50122a[_0x645b('0x1f')](_0x645b('0x8a')+_0x1b392d+_0x645b('0x8b'));logger['info'](_0x645b('0x8c'),contactItemTypes[_0x645b('0x1c')]);var _0x5063aa=util['format'](_0x645b('0x8d'),_0x4adb83,_0x1b392d,_0x437b90,_0x5b340d['ListId'],_0x5b340d[_0x645b('0x5a')]||null,NOW,NOW);if(_[_0x645b('0x1d')](_0x56ecbd['scheduledat'])){_0x5063aa+=_0x645b('0x8e');}_0x50122a['push'](_0x5063aa);BPromise[_0x645b('0x8f')](_0x50122a,handleQuery)['then'](function(_0x2516cd){BPromise[_0x645b('0x20')]([handleAdditionalPhones()])[_0x645b('0x21')](function(){_0x50122a=[];for(var _0x2d27cd=0x0;_0x2d27cd\x20\x20');}var _0x43faad=path[_0x645b('0x14')](config['root'],_0x645b('0x99'),process[_0x645b('0x98')][0x2]);if(!fs['existsSync'](_0x43faad)){throw new Error(_0x645b('0x9a'));}var _0x1f62ef={};try{_0x1f62ef=JSON[_0x645b('0x71')](process[_0x645b('0x98')][0x3]);if(!_0x1f62ef['binding']){throw new Error(_0x645b('0x9b'));}var _0x422f92=0x0;if(_0x1f62ef['binding']['UserId']){_0x422f92=0x1;}if(!_0x1f62ef[_0x645b('0x39')]){throw new Error(_0x645b('0x9c'));}}catch(_0x54f65f){throw new Error('body\x20id\x20mandatory');}var _0x5d9d3f=[];try{_0x5d9d3f=_[_0x645b('0x9d')](JSON[_0x645b('0x71')](process[_0x645b('0x98')][0x4]),'id');}catch(_0x32fe83){logger[_0x645b('0x5f')](_0x645b('0x9e'));}main(_0x43faad,_0x1f62ef,_0x5d9d3f,_0x422f92);}validate();process['on'](_0x645b('0x9f'),handleStop);process['on'](_0x645b('0xa0'),handleUncaughtException); \ No newline at end of file +var _0x8979=['YYYY-MM-DD','dateOfBirth\x20wrong\x20format\x20(YYYY-MM-DD)','firstName','\x20not\x20specified','replace','appendFileSync','emit','contact:import:','Abort\x20parser','abort','SystemError','CREATE\x20TABLE\x20','\x20LIKE\x20cm_contacts;','CIS\x20len','LOAD\x20DATA\x20LOCAL\x20INFILE\x20\x27%s\x27\x20INTO\x20TABLE\x20%s\x20CHARACTER\x20SET\x20UTF8\x20FIELDS\x20TERMINATED\x20BY\x20\x27,\x27\x20ENCLOSED\x20BY\x20\x27\x22\x27\x20LINES\x20TERMINATED\x20BY\x20\x27\x0a\x27\x20IGNORE\x201\x20ROWS\x20(%s)\x20SET\x20ListId\x20=\x20%s,\x20CompanyId\x20=\x20%s,\x20createdAt\x20=\x20\x27%s\x27,\x20updatedAt\x20=\x20\x27%s\x27',',\x20scheduledAt\x20=\x20NOW()','contact','contactId','DROP\x20TABLE\x20','each','finish','affectedRows','unlink','complete','argv','arguments\x20\x20\x20','file\x20doesn\x27t\x20exists','binding\x20doesn\x27t\x20exists','body\x20id\x20mandatory','map','SIGINT','path','papaparse','util','bluebird','ioredis','../../../mysqldb','../../../config/logger','defaults','redis','localhost','socket.io-emitter','format','YYYY-MM-DD\x20HH:mm:ss','test','select','field','phone','from','join','where','\x20=\x20','.dialCheckDuplicateType\x20IN\x20(','sequelize','query','select\x20*\x20from\x20','spread','length','isNil','push','then','message','AdditionalPhones','all','split','CmContactHasItem','PHONE','CmContact','update','CmHopper','cm_contacts.phone','cm_contacts.scheduledat','cm_contacts.id','cm_contacts.ListId','cm_contacts.updatedAt','cm_contacts.priority','insert','into','cm_hopper','scheduledat','ContactId','ListId','createdAt','priority','UserId','recallme','fields','cm_contacts','cm_contacts.ListId\x20=\x20','.CmListId','.CmListId\x20=\x20?','cm_contacts.createdAt\x20=\x20?','\x22onlyIfOpen\x22','cm_contacts.phone\x20NOT\x20IN\x20(?)','toString','cm_hopper_black','fromQuery','updatedAt','.id\x20=\x20','ListId\x20=\x20?','cm_hopper.id','cm_contact_has_items.item','cm_contact_has_items.createdAt','cm_hopper_additional_phones','CmHopperId','OrderBy','cm_contacts.id\x20=\x20cm_hopper.ContactId','cm_contact_has_items','cm_contacts.id\x20=\x20cm_contact_has_items.CmContactId','cm_hopper.ListId\x20=\x20?','concat','keys','CompanyId','id\x20IN\x20?','MIN(id)','min_id','info','Received\x20SIGINT','error','exit','errors','code','catch','main','send','start','binding','root','server/files/tmp','body','ContactItemType','findAll','name','parse','createReadStream','rows','data','find','hasOwnProperty','trim','isValid','scheduledat\x20wrong\x20format\x20(YYYY-MM-DD\x20HH:mm:ss)','isNaN','isNumber','includes','email\x20wrong\x20format','dateOfBirth'];(function(_0x26cb44,_0x2e96c0){var _0x40a431=function(_0x2708c8){while(--_0x2708c8){_0x26cb44['push'](_0x26cb44['shift']());}};_0x40a431(++_0x2e96c0);}(_0x8979,0xb2));var _0x9897=function(_0x1e24a9,_0x50df33){_0x1e24a9=_0x1e24a9-0x0;var _0x8e9211=_0x8979[_0x1e24a9];return _0x8e9211;};'use strict';var fs=require('fs');var path=require(_0x9897('0x0'));var _=require('lodash');var Papa=require(_0x9897('0x1'));var util=require(_0x9897('0x2'));var BPromise=require(_0x9897('0x3'));var moment=require('moment');var squel=require('squel');var Redis=require(_0x9897('0x4'));var db=require(_0x9897('0x5'))['db'];var config=require('../../../config/environment');var logger=require(_0x9897('0x6'))('import');config['redis']=_[_0x9897('0x7')](config[_0x9897('0x8')],{'host':_0x9897('0x9'),'port':0x18eb});var socket=require(_0x9897('0xa'))(new Redis(config[_0x9897('0x8')]));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()[_0x9897('0xb')](_0x9897('0xc'));var tempTableName='cm_contacts_temp_'+moment()['format']('YYYYMMDDHHmmss');var contactItemTypes=[];var hasAdditionalPhones=![];function isEmail(_0x40ef5a){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))*$/[_0x9897('0xd')](_0x40ef5a);}function selectNotIn(_0x3a2296,_0x4f5792,_0x16d419,_0xcf8268,_0x50d393){return squel[_0x9897('0xe')]()[_0x9897('0xf')](_0x9897('0x10'))[_0x9897('0x11')](_0xcf8268)[_0x9897('0x12')](_0x4f5792,null,_0x4f5792+'.id\x20=\x20'+_0xcf8268+'.'+_0x16d419)[_0x9897('0x13')](_0xcf8268+'.'+_0x16d419+_0x9897('0x14')+_0x3a2296+'.'+_0x16d419)[_0x9897('0x13')](_0x4f5792+_0x9897('0x15')+_0x50d393[_0x9897('0x12')]()+')');}function handleAdditionalPhones(){return new Promise(function(_0x4d1d24,_0x419929){promisesAdditionalPhones=[];promisesContact=[];return db[_0x9897('0x16')][_0x9897('0x17')](_0x9897('0x18')+tempTableName)[_0x9897('0x19')](function(_0x4aebcf){if(_0x4aebcf!==null){var _0x3820f9=[];for(var _0x11c23e=0x0;_0x11c23e<_0x4aebcf[_0x9897('0x1a')];_0x11c23e++){var _0x125ab7=_0x4aebcf[_0x11c23e];if(!_[_0x9897('0x1b')](_0x125ab7['phone'])){if(!_[_0x9897('0x1b')](_0x125ab7['AdditionalPhones']))_0x3820f9[_0x9897('0x1c')](insertAdditionalPhones(_0x125ab7));promisesContact[_0x9897('0x1c')]({'contact':_0x125ab7});}}}Promise['all'](_0x3820f9)[_0x9897('0x1d')](function(){_0x4d1d24({'val':0x1});});})['catch'](function(_0xf2cd38){logger['error'](_0xf2cd38[_0x9897('0x1e')]);});});}function insertAdditionalPhones(_0x164bf0){return new Promise(function(_0x3f8632,_0x5eb0ab){var _0x3915b2=_0x164bf0[_0x9897('0x1f')];if(_['isNil'](_0x3915b2))_0x5eb0ab({'val':0x0});else{var _0x1deb36=_0x3915b2['split'](';');var _0x735ba4=[];orderBy=0x0;for(var _0x5928d2=0x0;_0x5928d2<_0x1deb36[_0x9897('0x1a')];_0x5928d2++){_0x735ba4['push'](splitAdditionalPhone(_0x164bf0['id'],_0x1deb36[_0x5928d2]));}Promise[_0x9897('0x20')](_0x735ba4)[_0x9897('0x1d')](function(){_0x3f8632({'val':_0x1deb36['length']});});}});}function splitAdditionalPhone(_0xf51a9c,_0x2b0667){return new Promise(function(_0x58b8bd,_0x105dfd){var _0x5f5d30=_0x2b0667[_0x9897('0x21')](':');var _0x18dc06=_0x5f5d30[0x0];var _0x3c1223=_0x5f5d30[0x1];if(_0x3c1223!==''){var _0x17fdad=_0x3c1223[_0x9897('0x21')]('|');var _0x54e6f2=[];for(var _0x948d12=0x0;_0x948d12<_0x17fdad[_0x9897('0x1a')];_0x948d12++){if(_0x17fdad[_0x948d12]!==''){var _0x191386=_['filter'](promisesAdditionalPhones,{'contactId':_0xf51a9c,'phone':_0x17fdad[_0x948d12]});if(_0x191386['length']==0x0){orderBy++;promisesAdditionalPhones[_0x9897('0x1c')]({'contactId':_0xf51a9c,'contactTypeId':_0x18dc06,'phone':_0x17fdad[_0x948d12],'orderBy':orderBy});}}}_0x58b8bd({'ok':0x1});}else _0x58b8bd({'res':0x0});});}function createAdditionalPhone(_0x1d3143,_0x2c8aea,_0x38f24e,_0xf19293){return new Promise(function(_0x18c3f2,_0x49bbd8){return db['CmContactHasItem']['findOne']({'where':{'CmContactId':_0x1d3143,'item':_0x38f24e}})[_0x9897('0x1d')](function(_0x326aa4){if(_0x326aa4){return db[_0x9897('0x22')]['update']({'ItemTypeId':_0x2c8aea,'OrderBy':_0xf19293},{'where':{'CmContactId':_0x1d3143,'item':_0x38f24e}})[_0x9897('0x1d')](function(_0x240c92){_0x18c3f2({'res':'updated'});});}else{return db[_0x9897('0x22')]['create']({'CmContactId':_0x1d3143,'item':_0x38f24e,'ItemTypeId':_0x2c8aea,'OrderBy':_0xf19293,'ItemClass':_0x9897('0x23')})[_0x9897('0x1d')](function(_0x20fe50){_0x18c3f2({'res':'inserted'});});}});});}function updateContact(_0x4ebc9f){return new Promise(function(_0x5d96d5,_0x35113e){var _0x3135ec=_0x4ebc9f['id'];delete _0x4ebc9f['id'];return db[_0x9897('0x24')][_0x9897('0x25')](_0x4ebc9f,{'where':{'id':_0x3135ec}})[_0x9897('0x1d')](function(_0x1dc32){updatedRows+=0x1;return db[_0x9897('0x26')][_0x9897('0x25')]({'phone':_0x4ebc9f['phone']},{'where':{'ContactId':_0x3135ec}})[_0x9897('0x1d')](function(_0x5f424e){_0x5d96d5({'ret':'OK'});});});});}function insertCmHopper(_0x517a3f,_0x57acc9,_0x34c14c,_0x155fb6,_0x1c8ba5){var _0x462978=[_0x9897('0x27'),_0x9897('0x28'),_0x9897('0x29'),_0x9897('0x2a'),_0x57acc9+'.'+_0x155fb6,'cm_contacts.createdAt',_0x9897('0x2b'),_0x9897('0x2c'),'cm_contacts.UserId','\x22'+_0x1c8ba5+'\x22'];return squel[_0x9897('0x2d')]()[_0x9897('0x2e')](_0x9897('0x2f'))['fromQuery']([_0x9897('0x10'),_0x9897('0x30'),_0x9897('0x31'),_0x9897('0x32'),_0x155fb6,_0x9897('0x33'),'updatedAt',_0x9897('0x34'),_0x9897('0x35'),_0x9897('0x36')],squel['select']()[_0x9897('0x37')](_0x462978)[_0x9897('0x11')](_0x57acc9)['join'](_0x9897('0x38'),null,_0x9897('0x39')+_0x57acc9+_0x9897('0x3a'))[_0x9897('0x12')](_0x34c14c,null,_0x34c14c+'.id\x20=\x20'+_0x57acc9+'.'+_0x155fb6)[_0x9897('0x13')](_0x57acc9+_0x9897('0x3b'),_0x517a3f)['where'](_0x9897('0x3c'),NOW)[_0x9897('0x13')]('cm_contacts.phone\x20NOT\x20IN\x20(?)',selectNotIn(_0x57acc9,_0x34c14c,_0x155fb6,_0x9897('0x2f'),['\x22always\x22',_0x9897('0x3d')]))['where'](_0x9897('0x3e'),selectNotIn(_0x57acc9,_0x34c14c,_0x155fb6,_0x9897('0x2f'),['\x22always\x22'])))[_0x9897('0x3f')]();}function insertCmHopperBlack(_0xc4fc1c,_0x1b442b,_0x5c8e8c,_0x4d7d8f){var _0x4a879d=['cm_contacts.phone',_0x9897('0x29'),_0x9897('0x2a'),_0x1b442b+'.'+_0x4d7d8f,'cm_contacts.createdAt','cm_contacts.updatedAt'];return squel[_0x9897('0x2d')]()[_0x9897('0x2e')](_0x9897('0x40'))[_0x9897('0x41')]([_0x9897('0x10'),_0x9897('0x31'),_0x9897('0x32'),_0x4d7d8f,'createdAt',_0x9897('0x42')],squel[_0x9897('0xe')]()[_0x9897('0x37')](_0x4a879d)['from'](_0x1b442b)[_0x9897('0x12')]('cm_contacts',null,_0x9897('0x39')+_0x1b442b+_0x9897('0x3a'))[_0x9897('0x12')](_0x5c8e8c,null,_0x5c8e8c+_0x9897('0x43')+_0x1b442b+'.'+_0x4d7d8f)[_0x9897('0x13')](_0x1b442b+_0x9897('0x3b'),_0xc4fc1c)[_0x9897('0x13')](_0x9897('0x3c'),NOW)[_0x9897('0x13')]('cm_contacts.phone\x20NOT\x20IN\x20(?)',squel[_0x9897('0xe')]()[_0x9897('0xf')](_0x9897('0x10'))['from'](_0x9897('0x40'))[_0x9897('0x13')](_0x9897('0x44'),_0xc4fc1c)[_0x9897('0x13')](_0x4d7d8f+'\x20=\x20?',_0x1b442b+'.'+_0x4d7d8f)))[_0x9897('0x3f')]();}function insertCmHopperAdditionalPhones(_0x1a0d11){var _0x20fc0e=[_0x9897('0x45'),_0x9897('0x46'),'cm_contact_has_items.OrderBy',_0x9897('0x47'),'cm_contact_has_items.updatedAt'];return squel[_0x9897('0x2d')]()[_0x9897('0x2e')](_0x9897('0x48'))[_0x9897('0x41')]([_0x9897('0x49'),_0x9897('0x10'),_0x9897('0x4a'),_0x9897('0x33'),_0x9897('0x42')],squel[_0x9897('0xe')]()[_0x9897('0x37')](_0x20fc0e)[_0x9897('0x11')]('cm_hopper')[_0x9897('0x12')](_0x9897('0x38'),null,_0x9897('0x4b'))[_0x9897('0x12')](_0x9897('0x4c'),null,_0x9897('0x4d'))[_0x9897('0x13')](_0x9897('0x4e'),_0x1a0d11)['where'](_0x9897('0x3c'),NOW))['toString']();}function insertCmContact(_0x5030a9,_0xba3a28,_0x5cb6bf,_0x5a968c){var _0x390d9d=_[_0x9897('0x4f')](_[_0x9897('0x50')](_0x5a968c),[_0x9897('0x32'),_0x9897('0x51'),'createdAt',_0x9897('0x42')]);return squel[_0x9897('0x2d')]()[_0x9897('0x2e')](_0x9897('0x38'))['fromQuery'](_0x390d9d,squel[_0x9897('0xe')]()[_0x9897('0x37')](_0x390d9d)['from'](_0xba3a28)['where']('('+_0x5cb6bf[_0x9897('0x12')](',')+')\x20NOT\x20IN\x20?',squel['select']()['fields'](_0x5cb6bf)[_0x9897('0x11')](_0x9897('0x38'))[_0x9897('0x13')](_0x9897('0x44'),_0x5030a9))[_0x9897('0x13')](_0x9897('0x52'),squel[_0x9897('0xe')]()[_0x9897('0xf')](_0x9897('0x53'),_0x9897('0x54'))['from'](_0xba3a28)['group'](_0x5cb6bf[_0x9897('0x12')](','))))[_0x9897('0x3f')]();}function handleStop(){logger[_0x9897('0x55')](_0x9897('0x56'));stopped=!![];}function handleUncaughtException(_0x121945){logger[_0x9897('0x57')](_0x121945['message']);process[_0x9897('0x58')](0x1);}function handleError(_0x357021,_0x1d0c65){stats[_0x9897('0x59')][_0x9897('0x1c')]({'name':_0x1d0c65[_0x9897('0x5a')],'message':_0x1d0c65[_0x9897('0x1e')],'row':_0x357021});}function handleQuery(_0x59f6df){logger[_0x9897('0x55')](_0x59f6df);return db[_0x9897('0x16')][_0x9897('0x17')](_0x59f6df)[_0x9897('0x19')](function(_0x21b091){results['push'](_0x21b091);})[_0x9897('0x5b')](function(_0x4aea0c){logger[_0x9897('0x57')](_0x4aea0c['message']);});}function main(_0x20893d,_0x576cdc,_0x449595,_0x2035ea){logger[_0x9897('0x55')](_0x9897('0x5c'),_0x20893d,JSON['stringify'](_0x576cdc));process[_0x9897('0x5d')](_0x9897('0x5e'));var _0x8e8c84=_0x576cdc[_0x9897('0x5f')];var _0x221b0a=_['clone'](_0x8e8c84);var _0x173189=_0x576cdc['socket_timestamp'];var _0x4a8e5b=path[_0x9897('0x12')](config[_0x9897('0x60')],_0x9897('0x61'),_0x173189+'.csv');logger[_0x9897('0x55')](_0x9897('0x62'),_0x576cdc);db[_0x9897('0x63')][_0x9897('0x64')]({'raw':!![],'attributes':['id','name']})[_0x9897('0x1d')](function(_0x180772){for(var _0x3c5d62=0x0;_0x3c5d62<_0x180772[_0x9897('0x1a')];_0x3c5d62++){if(_0x180772[_0x3c5d62][_0x9897('0x65')]in _0x8e8c84){contactItemTypes['push'](_0x180772[_0x3c5d62]);delete _0x221b0a[_0x180772[_0x3c5d62]['name']];hasAdditionalPhones=!![];}else{}}if(hasAdditionalPhones)_0x221b0a[_0x9897('0x1f')]='';var _0x2b7264=_['keys'](_0x221b0a)['join']();logger[_0x9897('0x55')]('header',_0x2b7264);fs['writeFileSync'](_0x4a8e5b,_0x2b7264+'\x0a');Papa[_0x9897('0x66')](fs[_0x9897('0x67')](_0x20893d),{'header':!![],'skipEmptyLines':!![],'step':function(_0xd635c5,_0x465016){try{for(var _0x7614d3=0x0,_0x355559=[];_0x7614d3<_0xd635c5['data']['length'];_0x7614d3++){stats[_0x9897('0x68')]+=0x1;if(_0xd635c5[_0x9897('0x59')][_0x7614d3]){handleError(_0xd635c5[_0x9897('0x69')][_0x7614d3],_0xd635c5[_0x9897('0x59')][_0x7614d3]);}else{var _0x4f0760=[];var _0x325fcb=[];for(var _0x1a195f in _0x8e8c84){let _0x1f155f=contactItemTypes[_0x9897('0x6a')](_0xb05ee9=>_0xb05ee9[_0x9897('0x65')]===_0x1a195f);if(_[_0x9897('0x1b')](_0x1f155f)){if(_0x8e8c84[_0x9897('0x6b')](_0x1a195f)){if(_0xd635c5[_0x9897('0x69')][_0x7614d3][_0x8e8c84[_0x1a195f]]){var _0x468b82=_[_0x9897('0x6c')](_0xd635c5[_0x9897('0x69')][_0x7614d3][_0x8e8c84[_0x1a195f]]['replace'](/"/g,'\x27'));switch(_0x1a195f){case _0x9897('0x30'):var _0x2eccc9=moment(_0x468b82,_0x9897('0xc'),!![]);if(_0x2eccc9[_0x9897('0x6d')]()){_0x355559['push']('\x22'+_0x468b82+'\x22');}else{_0x4f0760[_0x9897('0x1c')](_0x9897('0x6e'));}break;case'priority':var _0x46475a=parseInt(_0x468b82);_0x468b82=_[_0x9897('0x6f')](_0x46475a)||_0x46475a<0x0||_0x46475a>0x4?_0x2035ea?0x3:0x2:_0x46475a;_0x355559['push']('\x22'+_0x468b82+'\x22');break;case _0x9897('0x35'):var _0x43b13a=parseInt(_0x468b82);if(_[_0x9897('0x70')](_0x43b13a)&&_[_0x9897('0x71')](_0x449595,_0x43b13a)){_0x355559[_0x9897('0x1c')]('\x22'+_0x43b13a+'\x22');}else{_0x4f0760[_0x9897('0x1c')]('agent\x20not\x20exists');}break;case'email':if(isEmail(_0x468b82)){_0x355559[_0x9897('0x1c')]('\x22'+_0x468b82+'\x22');}else{_0x4f0760['push'](_0x9897('0x72'));}break;case _0x9897('0x73'):var _0x40cdb8=moment(_0x468b82,_0x9897('0x74'),!![]);if(_0x40cdb8[_0x9897('0x6d')]()){_0x355559['push']('\x22'+_0x468b82+'\x22');}else{_0x4f0760[_0x9897('0x1c')](_0x9897('0x75'));}break;default:_0x355559['push']('\x22'+_0x468b82+'\x22');}}else{switch(_0x1a195f){case _0x9897('0x76'):case _0x9897('0x10'):_0x4f0760['push'](_0x1a195f+_0x9897('0x77'));break;default:_0x355559[_0x9897('0x1c')]('\x22\x22');}}}}else{var _0xb62092='';for(var _0x4057a7=0x0;_0x4057a7<_0x8e8c84[_0x1a195f][_0x9897('0x1a')];_0x4057a7++){var _0x468b82=_[_0x9897('0x6c')](_0xd635c5[_0x9897('0x69')][_0x7614d3][_0x8e8c84[_0x1a195f][_0x4057a7]][_0x9897('0x78')](/"/g,'\x27'));if(_0xb62092=='')_0xb62092=_0x468b82;else _0xb62092+='|'+_0x468b82;}_0x325fcb['push'](_0x1f155f['id']+':'+_0xb62092);}}if(hasAdditionalPhones){_0x355559[_0x9897('0x1c')]('\x22'+_0x325fcb[_0x9897('0x12')](';')+'\x22');}if(_0x4f0760[_0x9897('0x1a')]){handleError(_0xd635c5[_0x9897('0x69')][_0x7614d3],{'code':'SystemRow','message':_0x4f0760['join']()});}else{fs[_0x9897('0x79')](_0x4a8e5b,_0x355559[_0x9897('0x12')]()+'\x0a');}_0x355559=[];}if(!(stats['rows']%0xc8)){socket[_0x9897('0x7a')](_0x9897('0x7b')+_0x173189,stats);stats[_0x9897('0x59')]=[];}}if(stopped){logger['info'](_0x9897('0x7c'));_0x465016[_0x9897('0x7d')]();}}catch(_0x544d7d){handleError(_0xd635c5[_0x9897('0x69')][_0x7614d3],{'code':_0x9897('0x7e'),'message':_0x544d7d['message']});logger[_0x9897('0x57')]('step',_0x544d7d[_0x9897('0x1e')]);}},'complete':function(){try{var _0x4287fc=[];var _0x337d3b=tempTableName;_0x4287fc[_0x9897('0x1c')](_0x9897('0x7f')+_0x337d3b+_0x9897('0x80'));logger[_0x9897('0x55')](_0x9897('0x81'),contactItemTypes['length']);var _0x24c45c=util[_0x9897('0xb')](_0x9897('0x82'),_0x4a8e5b,_0x337d3b,_0x2b7264,_0x576cdc[_0x9897('0x32')],_0x576cdc['CompanyId']||null,NOW,NOW);if(_[_0x9897('0x1b')](_0x8e8c84[_0x9897('0x30')])){_0x24c45c+=_0x9897('0x83');}_0x4287fc[_0x9897('0x1c')](_0x24c45c);BPromise['each'](_0x4287fc,handleQuery)[_0x9897('0x1d')](function(_0x3a00ad){BPromise[_0x9897('0x20')]([handleAdditionalPhones()])[_0x9897('0x1d')](function(){_0x4287fc=[];for(var _0x2cdc7d=0x0;_0x2cdc7d=_0x4bc157){return _0x2fa0c1['status'](0x193)['json']({'message':util[_0x7ab1('0x8')]('Maximum\x20%s\x20limit\x20have\x20been\x20reached',_0x59fe2e)});}_0x3f765c();})[_0x7ab1('0x12')](function(_0x32c36f){_0x3f765c(_0x32c36f);});});}function isUserLimit(){return isLimit(_0x7ab1('0x13'),0x1,db[_0x7ab1('0x14')],{'where':{'$or':[{'role':'admin'},{'role':_0x7ab1('0x15')}]}});}exports[_0x7ab1('0x16')]=isUserLimit; \ No newline at end of file +var _0xc6cf=['../../config/environment','data1','license','split','%s:%s:%s','update','base64','utf8','final','parse','hasOwnProperty','use','License','findOne','then','status','format','Maximum\x20%s\x20limit\x20have\x20been\x20reached','catch','users','admin','isUserLimit','crypto','composable-middleware','../../mysqldb'];(function(_0x342f49,_0x364d5e){var _0x20799a=function(_0x7d1ef7){while(--_0x7d1ef7){_0x342f49['push'](_0x342f49['shift']());}};_0x20799a(++_0x364d5e);}(_0xc6cf,0x1d8));var _0xfc6c=function(_0x235a02,_0x31df6f){_0x235a02=_0x235a02-0x0;var _0x3218a4=_0xc6cf[_0x235a02];return _0x3218a4;};'use strict';var crypto=require(_0xfc6c('0x0'));var util=require('util');var compose=require(_0xfc6c('0x1'));var db=require(_0xfc6c('0x2'))['db'];var config=require(_0xfc6c('0x3'));function getValueFromLicense(_0x3e6963,_0x2af3a7){if(_0x3e6963&&_0x2af3a7){if(_0x2af3a7[_0xfc6c('0x4')]&&_0x2af3a7[_0xfc6c('0x5')]){var _0x38cf21=_0x2af3a7['data1'];var _0x5b74d2=_0x2af3a7['license'];var _0x2aa96e=_0x38cf21['split']('-')[0x4];var _0x263050=_0x38cf21[_0xfc6c('0x6')]('-')[0x0];var _0x4a0c0b=crypto['createDecipher']('aes-256-ctr',util['format'](_0xfc6c('0x7'),_0x2aa96e,_0x38cf21,_0x263050));var _0x5bd622=_0x4a0c0b[_0xfc6c('0x8')](_0x5b74d2,_0xfc6c('0x9'),_0xfc6c('0xa'));_0x5bd622+=_0x4a0c0b[_0xfc6c('0xb')]('utf8');var _0x4cb4a2=JSON[_0xfc6c('0xc')](_0x5bd622);return _0x4cb4a2[_0xfc6c('0xd')](_0x3e6963)?_0x4cb4a2[_0x3e6963]:null;}}return null;}function isLimit(_0x4cb18d,_0x21c7fc,_0x46a40a,_0x11ace4){var _0x4a6349=_0x21c7fc;return compose()[_0xfc6c('0xe')](function(_0x97adea,_0xef659f,_0x2d6825){return db[_0xfc6c('0xf')][_0xfc6c('0x10')]({'where':{'id':0x1},'raw':!![]})['then'](function(_0x49dfa2){var _0x4bd379=getValueFromLicense(_0x4cb18d,_0x49dfa2);return _0x4bd379?_0x4bd379:_0x4a6349;})[_0xfc6c('0x11')](function(_0x1c0a2d){_0x4a6349=_0x1c0a2d;return _0x46a40a['count'](_0x11ace4);})[_0xfc6c('0x11')](function(_0x1ff854){if(_0x1ff854>=_0x4a6349){return _0xef659f[_0xfc6c('0x12')](0x193)['json']({'message':util[_0xfc6c('0x13')](_0xfc6c('0x14'),_0x4cb18d)});}_0x2d6825();})[_0xfc6c('0x15')](function(_0x1a992a){_0x2d6825(_0x1a992a);});});}function isUserLimit(){return isLimit(_0xfc6c('0x16'),0x1,db['User'],{'where':{'$or':[{'role':_0xfc6c('0x17')},{'role':'user'}]}});}exports[_0xfc6c('0x18')]=isUserLimit; \ No newline at end of file diff --git a/server/components/parsers/advancedSearch.js b/server/components/parsers/advancedSearch.js index 80f80d3..485b846 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 _0x285c=['$gte','BETWEEN\x20?\x20AND\x20?','start','shift','pop','utcOffset','hours','seconds','moment','parseSearch','sqlOperator','startsWith','[$or]','and','replace','[$and]','split','length','forEach','match','filter','indexOf','buildExpression','DATE','$eq','operator','$between','value','includes','$gt','$lte','add','format','YYYY-MM-DD','castTo','text','CAST(','field','\x20AS\x20','$notIn','\x20IS\x20NULL)','$in','IN\x20?','$ne','<>\x20?','$substring','$startsWith','$endsWith','LIKE\x20?','$lt','<\x20?','>\x20?','<=\x20?'];(function(_0x5d9867,_0x5e9030){var _0x7d2118=function(_0x2e5149){while(--_0x2e5149){_0x5d9867['push'](_0x5d9867['shift']());}};_0x7d2118(++_0x5e9030);}(_0x285c,0x72));var _0xc285=function(_0x3318ef,_0x2cb6f4){_0x3318ef=_0x3318ef-0x0;var _0x59638a=_0x285c[_0x3318ef];return _0x59638a;};'use strict';var _=require('lodash');var moment=require(_0xc285('0x0'));exports[_0xc285('0x1')]=function(_0x845832){var _0x5babf1={'conditions':[]};_0x5babf1[_0xc285('0x2')]=_[_0xc285('0x3')](_0x845832,_0xc285('0x4'))?'or':_0xc285('0x5');var _0x27c4da=_0x845832[_0xc285('0x6')](_0xc285('0x7'),'')[_0xc285('0x6')](_0xc285('0x4'),'')[_0xc285('0x8')]('||');for(var _0x186d02=0x0;_0x186d02<_0x27c4da[_0xc285('0x9')];_0x186d02++){var _0x349956=_0x27c4da[_0x186d02][_0xc285('0x8')](':=');var _0x14b644=_0x349956[0x0];var _0x2eff6b=_0x349956['slice'](0x1);_0x2eff6b[_0xc285('0xa')](function(_0x5cc94a){var _0x4f4c8e=_0x5cc94a['split']('[')['shift']();var _0x494173=_0x5cc94a[_0xc285('0xb')](/\[(.*?)\]/g);_0x494173[_0xc285('0xa')](function(_0x4c2458){var _0x43cbde=_0x4c2458[_0xc285('0x8')]('[')[_0xc285('0xc')](function(_0x516012){return _0x516012[_0xc285('0xd')](']')>-0x1;})['map'](function(_0x196268){return _0x196268[_0xc285('0x8')](']')[0x0];})[0x0];_0x5babf1['conditions']['push']({'field':_0x14b644,'operator':_0x4f4c8e,'value':_0x43cbde});});});}return _0x5babf1;};exports[_0xc285('0xe')]=function(_0x291e03,_0x14be6e,_0x3fd878){var _0x52c72e={};if(_0x14be6e===_0xc285('0xf')){if(_0x3fd878['operator']===_0xc285('0x10')){_0x3fd878[_0xc285('0x11')]=_0xc285('0x12');_0x3fd878[_0xc285('0x13')]+=','+_0x3fd878[_0xc285('0x13')];}else if(_[_0xc285('0x14')]([_0xc285('0x15'),_0xc285('0x16')],_0x3fd878[_0xc285('0x11')])){_0x3fd878['value']=moment(_0x3fd878['value'])[_0xc285('0x17')](0x1,'days')[_0xc285('0x18')](_0xc285('0x19'));}}if(_0x3fd878[_0xc285('0x1a')]){_0x14be6e=_0x3fd878[_0xc285('0x1a')];_0x52c72e[_0xc285('0x1b')]=_0xc285('0x1c')+_0x291e03+'.'+_0x3fd878[_0xc285('0x1d')]+_0xc285('0x1e')+_0x3fd878[_0xc285('0x1a')]+')\x20'+parseOperator(_0x3fd878[_0xc285('0x11')]);}else{_0x52c72e['text']=_0x291e03+'.'+_0x3fd878[_0xc285('0x1d')]+'\x20'+parseOperator(_0x3fd878[_0xc285('0x11')]);}if(_[_0xc285('0x14')](['$ne',_0xc285('0x1f')],_0x3fd878[_0xc285('0x11')]))_0x52c72e['text']='('+_0x52c72e['text']+'\x20OR\x20'+_0x291e03+'.'+_0x3fd878[_0xc285('0x1d')]+_0xc285('0x20');_0x52c72e['value']=parseValue(_0x14be6e,_0x3fd878['operator'],_0x3fd878[_0xc285('0x13')]);return _0x52c72e;};function parseOperator(_0x58b2ea){var _0x1c085b;switch(_0x58b2ea){case _0xc285('0x21'):_0x1c085b=_0xc285('0x22');break;case _0xc285('0x1f'):_0x1c085b='NOT\x20IN\x20?';break;case _0xc285('0x10'):_0x1c085b='=\x20?';break;case _0xc285('0x23'):_0x1c085b=_0xc285('0x24');break;case _0xc285('0x25'):case _0xc285('0x26'):case _0xc285('0x27'):_0x1c085b=_0xc285('0x28');break;case _0xc285('0x29'):_0x1c085b=_0xc285('0x2a');break;case'$gt':_0x1c085b=_0xc285('0x2b');break;case _0xc285('0x16'):_0x1c085b=_0xc285('0x2c');break;case _0xc285('0x2d'):_0x1c085b='>=\x20?';break;case _0xc285('0x12'):_0x1c085b=_0xc285('0x2e');break;}return _0x1c085b;}function parseValue(_0x9ff102,_0x3b3646,_0x4b9bf4){var _0x4b6739={'start':undefined,'end':undefined};switch(_0x3b3646){case _0xc285('0x21'):case _0xc285('0x1f'):_0x4b6739[_0xc285('0x2f')]=_0x4b9bf4[_0xc285('0x8')](',');break;case'$substring':_0x4b6739['start']='%'+_0x4b9bf4+'%';break;case _0xc285('0x26'):_0x4b6739[_0xc285('0x2f')]=_0x4b9bf4+'%';break;case _0xc285('0x27'):_0x4b6739['start']='%'+_0x4b9bf4;break;case _0xc285('0x12'):var _0x30445f=_0x4b9bf4[_0xc285('0x8')](',');var _0x4b9bf4=_0x30445f[_0xc285('0x30')]();var _0x1bb1a4=_0x30445f[_0xc285('0x31')]();if(_0x9ff102==='DATE'){_0x4b9bf4=moment(_0x4b9bf4)[_0xc285('0x32')](0x0,!![])[_0xc285('0x18')]();_0x1bb1a4=moment(_0x1bb1a4)['utcOffset'](0x0,!![])['add'](0x17,_0xc285('0x33'))[_0xc285('0x17')](0x3b,'minutes')[_0xc285('0x17')](0x3b,_0xc285('0x34'))[_0xc285('0x18')]();}_0x4b6739={'start':_0x4b9bf4,'end':_0x1bb1a4};break;default:_0x4b6739[_0xc285('0x2f')]=_0x4b9bf4;break;}return _0x4b6739;} \ No newline at end of file +var _0x3175=['operator','$eq','value','includes','$gt','$lte','days','format','castTo','field','\x20AS\x20','$ne','$notIn','text','\x20IS\x20NULL)','IN\x20?','=\x20?','<>\x20?','$substring','$endsWith','LIKE\x20?','$lt','<\x20?','$gte','>=\x20?','BETWEEN\x20?\x20AND\x20?','start','$startsWith','shift','utcOffset','add','minutes','seconds','lodash','moment','parseSearch','sqlOperator','and','replace','[$or]','split','length','slice','forEach','indexOf','conditions','push','DATE'];(function(_0x532382,_0x42949f){var _0x2f7b66=function(_0xf73c69){while(--_0xf73c69){_0x532382['push'](_0x532382['shift']());}};_0x2f7b66(++_0x42949f);}(_0x3175,0xb1));var _0x5317=function(_0x11946c,_0x12152c){_0x11946c=_0x11946c-0x0;var _0x383935=_0x3175[_0x11946c];return _0x383935;};'use strict';var _=require(_0x5317('0x0'));var moment=require(_0x5317('0x1'));exports[_0x5317('0x2')]=function(_0x158950){var _0x5b708a={'conditions':[]};_0x5b708a[_0x5317('0x3')]=_['startsWith'](_0x158950,'[$or]')?'or':_0x5317('0x4');var _0x3187ab=_0x158950['replace']('[$and]','')[_0x5317('0x5')](_0x5317('0x6'),'')[_0x5317('0x7')]('||');for(var _0x768d70=0x0;_0x768d70<_0x3187ab[_0x5317('0x8')];_0x768d70++){var _0x36e185=_0x3187ab[_0x768d70][_0x5317('0x7')](':=');var _0x4f2193=_0x36e185[0x0];var _0x220397=_0x36e185[_0x5317('0x9')](0x1);_0x220397[_0x5317('0xa')](function(_0xc68645){var _0x3f0277=_0xc68645['split']('[')['shift']();var _0x122706=_0xc68645['match'](/\[(.*?)\]/g);_0x122706[_0x5317('0xa')](function(_0x3773c6){var _0x3bd706=_0x3773c6[_0x5317('0x7')]('[')['filter'](function(_0x252f4f){return _0x252f4f[_0x5317('0xb')](']')>-0x1;})['map'](function(_0x267087){return _0x267087[_0x5317('0x7')](']')[0x0];})[0x0];_0x5b708a[_0x5317('0xc')][_0x5317('0xd')]({'field':_0x4f2193,'operator':_0x3f0277,'value':_0x3bd706});});});}return _0x5b708a;};exports['buildExpression']=function(_0x16b299,_0x4c40ad,_0x24c1b){var _0x2bc039={};if(_0x4c40ad===_0x5317('0xe')){if(_0x24c1b[_0x5317('0xf')]===_0x5317('0x10')){_0x24c1b['operator']='$between';_0x24c1b[_0x5317('0x11')]+=','+_0x24c1b[_0x5317('0x11')];}else if(_[_0x5317('0x12')]([_0x5317('0x13'),_0x5317('0x14')],_0x24c1b[_0x5317('0xf')])){_0x24c1b[_0x5317('0x11')]=moment(_0x24c1b[_0x5317('0x11')])['add'](0x1,_0x5317('0x15'))[_0x5317('0x16')]('YYYY-MM-DD');}}if(_0x24c1b[_0x5317('0x17')]){_0x4c40ad=_0x24c1b['castTo'];_0x2bc039['text']='CAST('+_0x16b299+'.'+_0x24c1b[_0x5317('0x18')]+_0x5317('0x19')+_0x24c1b[_0x5317('0x17')]+')\x20'+parseOperator(_0x24c1b[_0x5317('0xf')]);}else{_0x2bc039['text']=_0x16b299+'.'+_0x24c1b[_0x5317('0x18')]+'\x20'+parseOperator(_0x24c1b['operator']);}if(_[_0x5317('0x12')]([_0x5317('0x1a'),_0x5317('0x1b')],_0x24c1b[_0x5317('0xf')]))_0x2bc039[_0x5317('0x1c')]='('+_0x2bc039['text']+'\x20OR\x20'+_0x16b299+'.'+_0x24c1b[_0x5317('0x18')]+_0x5317('0x1d');_0x2bc039[_0x5317('0x11')]=parseValue(_0x4c40ad,_0x24c1b['operator'],_0x24c1b['value']);return _0x2bc039;};function parseOperator(_0x6a342e){var _0x2d78a5;switch(_0x6a342e){case'$in':_0x2d78a5=_0x5317('0x1e');break;case _0x5317('0x1b'):_0x2d78a5='NOT\x20IN\x20?';break;case _0x5317('0x10'):_0x2d78a5=_0x5317('0x1f');break;case _0x5317('0x1a'):_0x2d78a5=_0x5317('0x20');break;case _0x5317('0x21'):case'$startsWith':case _0x5317('0x22'):_0x2d78a5=_0x5317('0x23');break;case _0x5317('0x24'):_0x2d78a5=_0x5317('0x25');break;case _0x5317('0x13'):_0x2d78a5='>\x20?';break;case _0x5317('0x14'):_0x2d78a5='<=\x20?';break;case _0x5317('0x26'):_0x2d78a5=_0x5317('0x27');break;case'$between':_0x2d78a5=_0x5317('0x28');break;}return _0x2d78a5;}function parseValue(_0x25faea,_0x4e85ba,_0x28ea09){var _0x12d622={'start':undefined,'end':undefined};switch(_0x4e85ba){case'$in':case _0x5317('0x1b'):_0x12d622[_0x5317('0x29')]=_0x28ea09[_0x5317('0x7')](',');break;case _0x5317('0x21'):_0x12d622[_0x5317('0x29')]='%'+_0x28ea09+'%';break;case _0x5317('0x2a'):_0x12d622[_0x5317('0x29')]=_0x28ea09+'%';break;case _0x5317('0x22'):_0x12d622[_0x5317('0x29')]='%'+_0x28ea09;break;case'$between':var _0x2903f4=_0x28ea09['split'](',');var _0x28ea09=_0x2903f4[_0x5317('0x2b')]();var _0x2f3401=_0x2903f4['pop']();if(_0x25faea==='DATE'){_0x28ea09=moment(_0x28ea09)[_0x5317('0x2c')](0x0,!![])[_0x5317('0x16')]();_0x2f3401=moment(_0x2f3401)[_0x5317('0x2c')](0x0,!![])[_0x5317('0x2d')](0x17,'hours')['add'](0x3b,_0x5317('0x2e'))[_0x5317('0x2d')](0x3b,_0x5317('0x2f'))[_0x5317('0x16')]();}_0x12d622={'start':_0x28ea09,'end':_0x2f3401};break;default:_0x12d622[_0x5317('0x29')]=_0x28ea09;break;}return _0x12d622;} \ No newline at end of file diff --git a/server/components/parsers/qs.js b/server/components/parsers/qs.js index 2a55ddc..4df8293 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 _0x4b5d=['sort','map','indexOf','priority','col','unsigned','substr','DESC','cast','ASC','omit','length','isString','^[0-9]*$','isEmail','getFullTextValue','forEach','push','toString','join','sequelize','moment','fields','split','filters','isEmpty','forOwn','type','isPlainObject','parse','$gte','format','YYYY-MM-DD','$lte','isArray','limit','offset'];(function(_0x2706da,_0x3856f5){var _0x3ba87e=function(_0x479a79){while(--_0x479a79){_0x2706da['push'](_0x2706da['shift']());}};_0x3ba87e(++_0x3856f5);}(_0x4b5d,0x1ab));var _0xd4b5=function(_0x27d0d8,_0x2b657d){_0x27d0d8=_0x27d0d8-0x0;var _0x2b79d1=_0x4b5d[_0x27d0d8];return _0x2b79d1;};'use strict';var _=require('lodash');var sequelize=require(_0xd4b5('0x0'));var moment=require(_0xd4b5('0x1'));var LIMIT_VALUE=0xfa;exports[_0xd4b5('0x2')]=function(_0x4eb60d){var _0xa81afe=null;if(_0x4eb60d){_0xa81afe=_0x4eb60d[_0xd4b5('0x3')](',');}return _0xa81afe;};exports[_0xd4b5('0x4')]=function(_0x15abce,_0x2d8bb0){var _0x29a626={};if(!_[_0xd4b5('0x5')](_0x15abce)){_[_0xd4b5('0x6')](_0x15abce,function(_0x5b6dda,_0xa767bb){try{if(_0x2d8bb0){var _0x459337=_['find'](_0x2d8bb0,{'name':_0xa767bb})||{};if(_0x459337[_0xd4b5('0x7')]==='DATE'&&_[_0xd4b5('0x8')](_0x5b6dda)){var _0x351a44=JSON[_0xd4b5('0x9')](_0x5b6dda);var _0x5c1695={'$gte':moment(moment(_0x351a44[_0xd4b5('0xa')])[_0xd4b5('0xb')](_0xd4b5('0xc')))['utc']()[_0xd4b5('0xb')](),'$lte':moment(moment(_0x351a44[_0xd4b5('0xd')])[_0xd4b5('0xb')](_0xd4b5('0xc')))['utc']()['subtract'](0x1,'s')[_0xd4b5('0xb')]()};_0x29a626[_0xa767bb]=_0x5c1695;}else{_0x29a626[_0xa767bb]=_[_0xd4b5('0xe')](_0x5b6dda)?_0x5b6dda:JSON[_0xd4b5('0x9')](_0x5b6dda);}}else{_0x29a626[_0xa767bb]=_[_0xd4b5('0xe')](_0x5b6dda)?_0x5b6dda:JSON[_0xd4b5('0x9')](_0x5b6dda);}}catch(_0x258603){_0x29a626[_0xa767bb]=_0x5b6dda[_0xd4b5('0x3')](',');}});}return _0x29a626;};exports[_0xd4b5('0xf')]=function(_0x1bbc0b){_0x1bbc0b=parseInt(_0x1bbc0b,0xa);if(!_0x1bbc0b||_0x1bbc0b<0x0){_0x1bbc0b=LIMIT_VALUE;}return _0x1bbc0b;};exports[_0xd4b5('0x10')]=function(_0x1ab690){_0x1ab690=parseInt(_0x1ab690,0xa);if(!_0x1ab690||_0x1ab690<0x0){_0x1ab690=0x0;}return _0x1ab690;};exports[_0xd4b5('0x11')]=function(_0x2fb47f){var _0x1eaa13,_0x4b892c=null;if(_0x2fb47f){_0x1eaa13=_0x2fb47f[_0xd4b5('0x3')](',');_0x4b892c=_[_0xd4b5('0x12')](_0x1eaa13,function(_0x5e4965){if(_0x5e4965[_0xd4b5('0x13')]('-')===0x0){return[_0x5e4965===_0xd4b5('0x14')?sequelize['cast'](sequelize[_0xd4b5('0x15')](_0xd4b5('0x14')),_0xd4b5('0x16')):_0x5e4965[_0xd4b5('0x17')](0x1),_0xd4b5('0x18')];}else{return[_0x5e4965===_0xd4b5('0x14')?sequelize[_0xd4b5('0x19')](sequelize['col'](_0xd4b5('0x14')),_0xd4b5('0x16')):_0x5e4965,_0xd4b5('0x1a')];}});}return _0x4b892c;};exports[_0xd4b5('0x1b')]=function(_0x190440,_0x5a99ef){if(_[_0xd4b5('0x5')](_0x190440)){return _0x190440;}if(_['isArray'](_0x190440)){for(var _0x75d185=0x0;_0x75d185<_0x190440[_0xd4b5('0x1c')];_0x75d185+=0x1){_0x190440[_0x75d185]=this['omit'](_0x190440[_0x75d185],_0x5a99ef);}return _0x190440;}if(!_['isObject'](_0x190440)){return _0x190440;}if(_[_0xd4b5('0x1d')](_0x5a99ef)){_0x5a99ef=[_0x5a99ef];}if(!_['isArray'](_0x5a99ef)){return _0x190440;}for(var _0x2005c2=0x0;_0x2005c2<_0x5a99ef[_0xd4b5('0x1c')];_0x2005c2+=0x1){_['unset'](_0x190440,_0x5a99ef[_0x2005c2]);}for(var _0x48b3d6 in _0x190440){if(_0x190440['hasOwnProperty'](_0x48b3d6)){_0x190440[_0x48b3d6]=this[_0xd4b5('0x1b')](_0x190440[_0x48b3d6],_0x5a99ef);}}return _0x190440;};exports['isNumeric']=function(_0x5925bb){return _0x5925bb['match'](RegExp(_0xd4b5('0x1e')))?!![]:![];};exports[_0xd4b5('0x1f')]=function(_0x29e1df){return _0x29e1df['match'](/^\S+@\S+$/)?!![]:![];};exports[_0xd4b5('0x20')]=function(_0x5db426){var _0x3dca08=[];_0x5db426[_0xd4b5('0x3')]('\x20')[_0xd4b5('0x21')](function(_0x4ab7ce){_0x3dca08[_0xd4b5('0x22')]('+'+_0x4ab7ce[_0xd4b5('0x23')]()+'*');});return _0x3dca08[_0xd4b5('0x24')]('\x20');}; \ No newline at end of file +var _0xec53=['utc','subtract','isArray','split','limit','map','priority','cast','col','unsigned','substr','ASC','omit','length','unset','isNumeric','^[0-9]*$','isEmail','forEach','toString','join','moment','filters','isEmpty','type','DATE','isPlainObject','parse','format','YYYY-MM-DD','$lte'];(function(_0xa7991d,_0x32459c){var _0x459970=function(_0x5f536f){while(--_0x5f536f){_0xa7991d['push'](_0xa7991d['shift']());}};_0x459970(++_0x32459c);}(_0xec53,0x1e6));var _0x3ec5=function(_0x5f348b,_0x2b45ab){_0x5f348b=_0x5f348b-0x0;var _0x2ed87b=_0xec53[_0x5f348b];return _0x2ed87b;};'use strict';var _=require('lodash');var sequelize=require('sequelize');var moment=require(_0x3ec5('0x0'));var LIMIT_VALUE=0xfa;exports['fields']=function(_0x1df5b8){var _0x440e6f=null;if(_0x1df5b8){_0x440e6f=_0x1df5b8['split'](',');}return _0x440e6f;};exports[_0x3ec5('0x1')]=function(_0x45da39,_0x4ecbe4){var _0x12b1b0={};if(!_[_0x3ec5('0x2')](_0x45da39)){_['forOwn'](_0x45da39,function(_0x4c4448,_0x5013bd){try{if(_0x4ecbe4){var _0x540d8c=_['find'](_0x4ecbe4,{'name':_0x5013bd})||{};if(_0x540d8c[_0x3ec5('0x3')]===_0x3ec5('0x4')&&_[_0x3ec5('0x5')](_0x4c4448)){var _0x1807e9=JSON[_0x3ec5('0x6')](_0x4c4448);var _0x10a7ca={'$gte':moment(moment(_0x1807e9['$gte'])[_0x3ec5('0x7')](_0x3ec5('0x8')))['utc']()[_0x3ec5('0x7')](),'$lte':moment(moment(_0x1807e9[_0x3ec5('0x9')])[_0x3ec5('0x7')](_0x3ec5('0x8')))[_0x3ec5('0xa')]()[_0x3ec5('0xb')](0x1,'s')[_0x3ec5('0x7')]()};_0x12b1b0[_0x5013bd]=_0x10a7ca;}else{_0x12b1b0[_0x5013bd]=_[_0x3ec5('0xc')](_0x4c4448)?_0x4c4448:JSON[_0x3ec5('0x6')](_0x4c4448);}}else{_0x12b1b0[_0x5013bd]=_[_0x3ec5('0xc')](_0x4c4448)?_0x4c4448:JSON[_0x3ec5('0x6')](_0x4c4448);}}catch(_0x52e0c4){_0x12b1b0[_0x5013bd]=_0x4c4448[_0x3ec5('0xd')](',');}});}return _0x12b1b0;};exports[_0x3ec5('0xe')]=function(_0x81c785){_0x81c785=parseInt(_0x81c785,0xa);if(!_0x81c785||_0x81c785<0x0){_0x81c785=LIMIT_VALUE;}return _0x81c785;};exports['offset']=function(_0x5cf63f){_0x5cf63f=parseInt(_0x5cf63f,0xa);if(!_0x5cf63f||_0x5cf63f<0x0){_0x5cf63f=0x0;}return _0x5cf63f;};exports['sort']=function(_0x1fcba4){var _0x582b99,_0x285eec=null;if(_0x1fcba4){_0x582b99=_0x1fcba4[_0x3ec5('0xd')](',');_0x285eec=_[_0x3ec5('0xf')](_0x582b99,function(_0x19bfd7){if(_0x19bfd7['indexOf']('-')===0x0){return[_0x19bfd7===_0x3ec5('0x10')?sequelize[_0x3ec5('0x11')](sequelize[_0x3ec5('0x12')](_0x3ec5('0x10')),_0x3ec5('0x13')):_0x19bfd7[_0x3ec5('0x14')](0x1),'DESC'];}else{return[_0x19bfd7===_0x3ec5('0x10')?sequelize['cast'](sequelize[_0x3ec5('0x12')](_0x3ec5('0x10')),_0x3ec5('0x13')):_0x19bfd7,_0x3ec5('0x15')];}});}return _0x285eec;};exports[_0x3ec5('0x16')]=function(_0xfec2a7,_0x35f716){if(_['isEmpty'](_0xfec2a7)){return _0xfec2a7;}if(_[_0x3ec5('0xc')](_0xfec2a7)){for(var _0x5b895a=0x0;_0x5b895a<_0xfec2a7[_0x3ec5('0x17')];_0x5b895a+=0x1){_0xfec2a7[_0x5b895a]=this[_0x3ec5('0x16')](_0xfec2a7[_0x5b895a],_0x35f716);}return _0xfec2a7;}if(!_['isObject'](_0xfec2a7)){return _0xfec2a7;}if(_['isString'](_0x35f716)){_0x35f716=[_0x35f716];}if(!_[_0x3ec5('0xc')](_0x35f716)){return _0xfec2a7;}for(var _0x48fad6=0x0;_0x48fad6<_0x35f716[_0x3ec5('0x17')];_0x48fad6+=0x1){_[_0x3ec5('0x18')](_0xfec2a7,_0x35f716[_0x48fad6]);}for(var _0x34ac5c in _0xfec2a7){if(_0xfec2a7['hasOwnProperty'](_0x34ac5c)){_0xfec2a7[_0x34ac5c]=this[_0x3ec5('0x16')](_0xfec2a7[_0x34ac5c],_0x35f716);}}return _0xfec2a7;};exports[_0x3ec5('0x19')]=function(_0x5e6c89){return _0x5e6c89['match'](RegExp(_0x3ec5('0x1a')))?!![]:![];};exports[_0x3ec5('0x1b')]=function(_0x4bb7b4){return _0x4bb7b4['match'](/^\S+@\S+$/)?!![]:![];};exports['getFullTextValue']=function(_0x1caac2){var _0x4e60ba=[];_0x1caac2['split']('\x20')[_0x3ec5('0x1c')](function(_0x2b266e){_0x4e60ba['push']('+'+_0x2b266e[_0x3ec5('0x1d')]()+'*');});return _0x4e60ba[_0x3ec5('0x1e')]('\x20');}; \ No newline at end of file diff --git a/server/config/express.js b/server/config/express.js index b066c93..3928847 100644 --- a/server/config/express.js +++ b/server/config/express.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3bd3=['join','test','client','use','toISOString','split','static','views','root','engine','html','renderFile','urlencoded','50mb','json','initialize','express','serve-favicon','path','moment','./environment','default','get','env','set','appPath'];(function(_0x1165c5,_0x1f8921){var _0x1c4139=function(_0x319f44){while(--_0x319f44){_0x1165c5['push'](_0x1165c5['shift']());}};_0x1c4139(++_0x1f8921);}(_0x3bd3,0x162));var _0x33bd=function(_0xb66224,_0x3a3f2f){_0xb66224=_0xb66224-0x0;var _0x346365=_0x3bd3[_0xb66224];return _0x346365;};'use strict';var express=require(_0x33bd('0x0'));var favicon=require(_0x33bd('0x1'));var bodyParser=require('body-parser');var methodOverride=require('method-override');var cookieParser=require('cookie-parser');var errorHandler=require('errorhandler');var path=require(_0x33bd('0x2'));var passport=require('passport');var cors=require('cors');var moment=require(_0x33bd('0x3'));var config=require(_0x33bd('0x4'));var db=require('../mysqldb')['db'];exports[_0x33bd('0x5')]=function(_0x25a2ff){var _0x5aecc4=_0x25a2ff[_0x33bd('0x6')](_0x33bd('0x7'));if(_0x5aecc4==='production'){_0x25a2ff[_0x33bd('0x8')](_0x33bd('0x9'),path[_0x33bd('0xa')](config['root'],'public'));}if(_0x5aecc4==='development'||_0x5aecc4===_0x33bd('0xb')){_0x25a2ff[_0x33bd('0x8')](_0x33bd('0x9'),path[_0x33bd('0xa')](config['root'],_0x33bd('0xc')));_0x25a2ff[_0x33bd('0xd')](errorHandler());}_0x25a2ff[_0x33bd('0x8')]('json\x20replacer',function(_0x2ddafa,_0x3a94f7){if(this[_0x2ddafa]instanceof Date){_0x3a94f7=this[_0x2ddafa][_0x33bd('0xe')]()[_0x33bd('0xf')]('.')[0x0]+'Z';}return _0x3a94f7;});_0x25a2ff[_0x33bd('0xd')](express[_0x33bd('0x10')](_0x25a2ff[_0x33bd('0x6')](_0x33bd('0x9'))));_0x25a2ff[_0x33bd('0x8')](_0x33bd('0x11'),config[_0x33bd('0x12')]+'/server/views');_0x25a2ff[_0x33bd('0x13')](_0x33bd('0x14'),require('ejs')[_0x33bd('0x15')]);_0x25a2ff[_0x33bd('0x8')]('view\x20engine','html');_0x25a2ff[_0x33bd('0xd')](bodyParser[_0x33bd('0x16')]({'limit':_0x33bd('0x17'),'extended':!![]}));_0x25a2ff[_0x33bd('0xd')](bodyParser[_0x33bd('0x18')]({'limit':_0x33bd('0x17')}));_0x25a2ff[_0x33bd('0xd')](cors());_0x25a2ff['use'](methodOverride());_0x25a2ff['use'](cookieParser());_0x25a2ff[_0x33bd('0xd')](passport[_0x33bd('0x19')]());}; \ No newline at end of file +var _0x60d2=['initialize','express','serve-favicon','method-override','errorhandler','path','passport','cors','moment','./environment','default','get','env','production','set','appPath','join','root','public','development','use','json\x20replacer','toISOString','static','engine','html','renderFile','view\x20engine'];(function(_0x50e86a,_0x326c7){var _0x57d539=function(_0x1156db){while(--_0x1156db){_0x50e86a['push'](_0x50e86a['shift']());}};_0x57d539(++_0x326c7);}(_0x60d2,0xfd));var _0x260d=function(_0x2070da,_0x45e586){_0x2070da=_0x2070da-0x0;var _0x4f9fe1=_0x60d2[_0x2070da];return _0x4f9fe1;};'use strict';var express=require(_0x260d('0x0'));var favicon=require(_0x260d('0x1'));var bodyParser=require('body-parser');var methodOverride=require(_0x260d('0x2'));var cookieParser=require('cookie-parser');var errorHandler=require(_0x260d('0x3'));var path=require(_0x260d('0x4'));var passport=require(_0x260d('0x5'));var cors=require(_0x260d('0x6'));var moment=require(_0x260d('0x7'));var config=require(_0x260d('0x8'));var db=require('../mysqldb')['db'];exports[_0x260d('0x9')]=function(_0x5bafe1){var _0x557594=_0x5bafe1[_0x260d('0xa')](_0x260d('0xb'));if(_0x557594===_0x260d('0xc')){_0x5bafe1[_0x260d('0xd')](_0x260d('0xe'),path[_0x260d('0xf')](config[_0x260d('0x10')],_0x260d('0x11')));}if(_0x557594===_0x260d('0x12')||_0x557594==='test'){_0x5bafe1[_0x260d('0xd')](_0x260d('0xe'),path[_0x260d('0xf')](config[_0x260d('0x10')],'client'));_0x5bafe1[_0x260d('0x13')](errorHandler());}_0x5bafe1[_0x260d('0xd')](_0x260d('0x14'),function(_0x3be784,_0x3c24c6){if(this[_0x3be784]instanceof Date){_0x3c24c6=this[_0x3be784][_0x260d('0x15')]()['split']('.')[0x0]+'Z';}return _0x3c24c6;});_0x5bafe1[_0x260d('0x13')](express[_0x260d('0x16')](_0x5bafe1['get']('appPath')));_0x5bafe1['set']('views',config[_0x260d('0x10')]+'/server/views');_0x5bafe1[_0x260d('0x17')](_0x260d('0x18'),require('ejs')[_0x260d('0x19')]);_0x5bafe1['set'](_0x260d('0x1a'),'html');_0x5bafe1[_0x260d('0x13')](bodyParser['urlencoded']({'limit':'50mb','extended':!![]}));_0x5bafe1[_0x260d('0x13')](bodyParser['json']({'limit':'50mb'}));_0x5bafe1[_0x260d('0x13')](cors());_0x5bafe1[_0x260d('0x13')](methodOverride());_0x5bafe1['use'](cookieParser());_0x5bafe1['use'](passport[_0x260d('0x1b')]());}; \ No newline at end of file diff --git a/server/config/license/hardware.js b/server/config/license/hardware.js index ffb28cc..7908b88 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 _0x43fd=['hex','getUuid','platform','replace','hostname','substring','crypto','execSync','networkInterfaces','orderBy','keys','length','filter','family','IPv4','concat','mac','00:00:00:00:00:00','address','getFirstInterface','cpus','map','model','join','createHash','md5','update'];(function(_0x2c4e1b,_0x48a2dc){var _0x335117=function(_0x3cac61){while(--_0x3cac61){_0x2c4e1b['push'](_0x2c4e1b['shift']());}};_0x335117(++_0x48a2dc);}(_0x43fd,0x1ec));var _0xd43f=function(_0x417e32,_0x216bae){_0x417e32=_0x417e32-0x0;var _0x2bb8a8=_0x43fd[_0x417e32];return _0x2bb8a8;};'use strict';var _=require('lodash');var os=require('os');var crypto=require(_0xd43f('0x0'));var machine=require('bimedia-machine-uuid');var exec=require('child_process')[_0xd43f('0x1')];function getInterfaces(){var _0x1ead65=[];var _0x484615=os[_0xd43f('0x2')]();var _0x48f953=_[_0xd43f('0x3')](_[_0xd43f('0x4')](_0x484615));for(var _0x1d36b7=0x0;_0x1d36b7<_0x48f953[_0xd43f('0x5')];_0x1d36b7++){var _0x52e75f=_0x484615[_0x48f953[_0x1d36b7]][_0xd43f('0x6')](function(_0xad5196){return _0xad5196[_0xd43f('0x7')]===_0xd43f('0x8')&&_0xad5196['internal']===![];});_0x1ead65=_0x1ead65[_0xd43f('0x9')](_0x52e75f);}return _0x1ead65;}function getFirstInterface(){var _0x20d066=_['head'](getInterfaces());return{'macAddress':_0x20d066&&_0x20d066[_0xd43f('0xa')]?_0x20d066[_0xd43f('0xa')]:_0xd43f('0xb'),'ipAddress':_0x20d066&&_0x20d066[_0xd43f('0xc')]?_0x20d066[_0xd43f('0xc')]:'127.0.0.1'};}exports[_0xd43f('0xd')]=getFirstInterface;function getCPUhash(){var _0x32e210=_[_0xd43f('0x3')](os[_0xd43f('0xe')]()[_0xd43f('0xf')](function(_0x396916){return _0x396916[_0xd43f('0x10')];}))[_0xd43f('0x11')](':');return crypto[_0xd43f('0x12')](_0xd43f('0x13'))[_0xd43f('0x14')](_0x32e210)['digest'](_0xd43f('0x15'));}exports[_0xd43f('0x16')]=function(){switch(os[_0xd43f('0x17')]()){case'win32':return exec('dmidecode\x20--string\x20system-uuid',{'encoding':'utf8'})[_0xd43f('0x18')]('\x0d\x0a','');default:var _0x3ca2d4=getFirstInterface();var _0x4f8862=getCPUhash();var _0x3c0953=_0x4f8862+'|'+os[_0xd43f('0x19')]()+'|'+_0x3ca2d4['macAddress']+'|'+_0x3ca2d4['ipAddress'];var _0x4fd639=crypto['createHash'](_0xd43f('0x13'))[_0xd43f('0x14')](_0x3c0953)['digest'](_0xd43f('0x15'));return _0x4fd639[_0xd43f('0x1a')](0x0,0x8)+'-'+_0x4fd639[_0xd43f('0x1a')](0x8,0xc)+'-'+_0x4fd639[_0xd43f('0x1a')](0xc,0x10)+'-'+_0x4fd639['substring'](0x10,0x14)+'-'+_0x4fd639[_0xd43f('0x1a')](0x14);}}; \ No newline at end of file +var _0x24ca=['update','digest','hex','getUuid','platform','win32','replace','hostname','macAddress','substring','lodash','bimedia-machine-uuid','child_process','execSync','networkInterfaces','orderBy','keys','length','filter','family','internal','concat','mac','00:00:00:00:00:00','address','127.0.0.1','getFirstInterface','map','model','join','md5'];(function(_0x3f68eb,_0x5968de){var _0x5b5604=function(_0xb496a9){while(--_0xb496a9){_0x3f68eb['push'](_0x3f68eb['shift']());}};_0x5b5604(++_0x5968de);}(_0x24ca,0x1bc));var _0xa24c=function(_0x258b93,_0x188ccc){_0x258b93=_0x258b93-0x0;var _0x35484b=_0x24ca[_0x258b93];return _0x35484b;};'use strict';var _=require(_0xa24c('0x0'));var os=require('os');var crypto=require('crypto');var machine=require(_0xa24c('0x1'));var exec=require(_0xa24c('0x2'))[_0xa24c('0x3')];function getInterfaces(){var _0x5876d6=[];var _0x18497e=os[_0xa24c('0x4')]();var _0x195e60=_[_0xa24c('0x5')](_[_0xa24c('0x6')](_0x18497e));for(var _0x15a5cd=0x0;_0x15a5cd<_0x195e60[_0xa24c('0x7')];_0x15a5cd++){var _0x3c0aaa=_0x18497e[_0x195e60[_0x15a5cd]][_0xa24c('0x8')](function(_0x257264){return _0x257264[_0xa24c('0x9')]==='IPv4'&&_0x257264[_0xa24c('0xa')]===![];});_0x5876d6=_0x5876d6[_0xa24c('0xb')](_0x3c0aaa);}return _0x5876d6;}function getFirstInterface(){var _0x2d645c=_['head'](getInterfaces());return{'macAddress':_0x2d645c&&_0x2d645c[_0xa24c('0xc')]?_0x2d645c[_0xa24c('0xc')]:_0xa24c('0xd'),'ipAddress':_0x2d645c&&_0x2d645c[_0xa24c('0xe')]?_0x2d645c[_0xa24c('0xe')]:_0xa24c('0xf')};}exports[_0xa24c('0x10')]=getFirstInterface;function getCPUhash(){var _0xc82af0=_[_0xa24c('0x5')](os['cpus']()[_0xa24c('0x11')](function(_0x11090c){return _0x11090c[_0xa24c('0x12')];}))[_0xa24c('0x13')](':');return crypto['createHash'](_0xa24c('0x14'))[_0xa24c('0x15')](_0xc82af0)[_0xa24c('0x16')](_0xa24c('0x17'));}exports[_0xa24c('0x18')]=function(){switch(os[_0xa24c('0x19')]()){case _0xa24c('0x1a'):return exec('dmidecode\x20--string\x20system-uuid',{'encoding':'utf8'})[_0xa24c('0x1b')]('\x0d\x0a','');default:var _0x87aa90=getFirstInterface();var _0x49ce53=getCPUhash();var _0x5babb5=_0x49ce53+'|'+os[_0xa24c('0x1c')]()+'|'+_0x87aa90[_0xa24c('0x1d')]+'|'+_0x87aa90['ipAddress'];var _0x2a64ff=crypto['createHash'](_0xa24c('0x14'))[_0xa24c('0x15')](_0x5babb5)[_0xa24c('0x16')](_0xa24c('0x17'));return _0x2a64ff['substring'](0x0,0x8)+'-'+_0x2a64ff[_0xa24c('0x1e')](0x8,0xc)+'-'+_0x2a64ff[_0xa24c('0x1e')](0xc,0x10)+'-'+_0x2a64ff[_0xa24c('0x1e')](0x10,0x14)+'-'+_0x2a64ff['substring'](0x14);}}; \ No newline at end of file diff --git a/server/config/license/index.js b/server/config/license/index.js index dce392b..7d7c988 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 _0xde9f=['|reason|','|uuid|','|machineUuid|','|name|','getFirstInterface','openIssue','MOTLICENSE','Alert','get','active','data2','info','THE\x20LICENSE\x20HAS\x20BEEN\x20UPDATED','data1','Disabled','Changed','uuid','%s\x20-\x20GRAY\x20PERIOD\x20STARTED\x20AT\x20%s','toUpperCase','YYYY-MM-DD\x20HH:mm','diff','days','NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s','error','finally','getUuid','License','findOrCreate','spread','SERVICE\x20LICENSE\x20STARTED\x20%s','message','default','util','request-promise','bluebird','version','../../mysqldb','./hardware','../logger','license','../../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','secrets','session','utf8','base64','final','createDecipher','update','User','findOne','admin','fullname','email'];(function(_0x1be96f,_0x6cf028){var _0x56019f=function(_0x185004){while(--_0x185004){_0x1be96f['push'](_0x1be96f['shift']());}};_0x56019f(++_0x6cf028);}(_0xde9f,0x118));var _0xfde9=function(_0x330414,_0x4f3207){_0x330414=_0x330414-0x0;var _0x99dbff=_0xde9f[_0x330414];return _0x99dbff;};'use strict';var util=require(_0xfde9('0x0'));var crypto=require('crypto');var moment=require('moment');var rp=require(_0xfde9('0x1'));var BPromise=require(_0xfde9('0x2'));var pkginfo=require('pkginfo')(module,_0xfde9('0x3'));var db=require(_0xfde9('0x4'))['db'];var config=require('../environment');var hardware=require(_0xfde9('0x5'));var logger=require(_0xfde9('0x6'))(_0xfde9('0x7'));var jira=require(_0xfde9('0x8'));var HOST='https://www.xcallymotion.com';var TIME=0x3c*0x1388;var DAYS=0x7;var GRAY_PERIOD_REASON;var ADMIN;var oldToken;function httpRequest(_0x4c3e01){return new BPromise(function(_0x179ee0,_0x18a202){var _0x5569c2=util[_0xfde9('0x9')](_0xfde9('0xa'),HOST,_0x4c3e01,module[_0xfde9('0xb')][_0xfde9('0x3')]);if(oldToken){_0x5569c2=util[_0xfde9('0x9')](_0xfde9('0xc'),HOST,_0x4c3e01,module[_0xfde9('0xb')][_0xfde9('0x3')],oldToken);}var _0x3fa916={'uri':_0x5569c2,'method':_0xfde9('0xd'),'timeout':0xea60,'json':!![]};return rp(_0x3fa916)[_0xfde9('0xe')](function(_0x350a86){_0x179ee0(_0x350a86);})[_0xfde9('0xf')](function(_0x3bdd36){_0x18a202(_0x3bdd36);});});}function encryptDate(_0x4d6825){var _0x5742c7=crypto[_0xfde9('0x10')](_0xfde9('0x11'),config[_0xfde9('0x12')][_0xfde9('0x13')]);var _0x52aacf=_0x5742c7['update'](_0x4d6825,_0xfde9('0x14'),_0xfde9('0x15'));_0x52aacf+=_0x5742c7[_0xfde9('0x16')](_0xfde9('0x15'));return _0x52aacf;}function decryptDate(_0x29fa8a){var _0x489841=crypto[_0xfde9('0x17')](_0xfde9('0x11'),config[_0xfde9('0x12')]['session']);var _0x31b1c7=_0x489841[_0xfde9('0x18')](_0x29fa8a,_0xfde9('0x15'),'utf8');_0x31b1c7+=_0x489841['final']('utf8');return _0x31b1c7;}function sendJiraAlert(_0x544f19,_0x166f1c,_0x3f1ab3){var _0x48aafd='||FIELD||VALUE||\x0a';return db[_0xfde9('0x19')][_0xfde9('0x1a')]({'where':{'role':_0xfde9('0x1b')},'attributes':[_0xfde9('0x1c'),_0xfde9('0x1d')],'raw':!![]})[_0xfde9('0xe')](function(_0x335e55){ADMIN=_0x335e55;_0x48aafd+=_0xfde9('0x1e')+_0x3f1ab3+'|\x0a';_0x48aafd+=_0xfde9('0x1f')+_0x544f19+'|\x0a';_0x48aafd+=_0xfde9('0x20')+_0x166f1c+'|\x0a';_0x48aafd+=_0xfde9('0x21')+ADMIN[_0xfde9('0x1c')]+'|\x0a';_0x48aafd+='|email|'+ADMIN[_0xfde9('0x1d')]+'|\x0a';return _0x48aafd;})['then'](function(_0x33e016){var _0x159141=hardware[_0xfde9('0x22')]()['ipAddress'];return jira[_0xfde9('0x23')]({'key':_0xfde9('0x24'),'summary':'Motion\x20License\x20Alert','description':_0x33e016,'issuetype':_0xfde9('0x25'),'oldToken':_0x544f19,'newToken':_0x166f1c,'email':ADMIN[_0xfde9('0x1d')],'name':ADMIN[_0xfde9('0x1c')],'reason':GRAY_PERIOD_REASON,'ip':_0x159141});});}function manageLicense(_0x242dae,_0x36967c){var _0x37ad02=_0x36967c[_0xfde9('0x26')]({'plain':!![]});httpRequest(_0x242dae)[_0xfde9('0xe')](function(_0x1457f8){if(oldToken){oldToken=undefined;}if(_0x1457f8[_0xfde9('0x27')]){if(!_0x37ad02[_0xfde9('0x7')]&&_0x37ad02[_0xfde9('0x7')]!=_0x1457f8[_0xfde9('0x7')]||_0x37ad02[_0xfde9('0x7')]&&_0x37ad02[_0xfde9('0x28')]){logger[_0xfde9('0x29')]('THE\x20LICENSE\x20HAS\x20BEEN\x20ENABLED');}if(_0x37ad02['license']&&!_0x37ad02[_0xfde9('0x28')]&&_0x37ad02[_0xfde9('0x7')]!=_0x1457f8['license']){logger[_0xfde9('0x29')](_0xfde9('0x2a'));}if(_0x37ad02[_0xfde9('0x7')]&&!_0x37ad02[_0xfde9('0x28')]&&_0x37ad02[_0xfde9('0x7')]==_0x1457f8['license']){return _0x36967c;}return _0x36967c[_0xfde9('0x18')]({'data1':_0x242dae,'data2':null,'license':_0x1457f8[_0xfde9('0x7')]});}else{if(_0x1457f8['license']||_0x37ad02[_0xfde9('0x7')]){if(!_0x37ad02[_0xfde9('0x28')]){if(_0x37ad02[_0xfde9('0x2b')]==_0x242dae){GRAY_PERIOD_REASON=_0xfde9('0x2c');logger[_0xfde9('0x29')]('THE\x20LICENSE\x20HAS\x20BEEN\x20DISABLED');}else{GRAY_PERIOD_REASON=_0xfde9('0x2d');oldToken=_0x37ad02['data1'];logger[_0xfde9('0x29')]('NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s',_0x37ad02[_0xfde9('0x2b')],_0x242dae);}sendJiraAlert(_0x37ad02['data1'],_0x1457f8[_0xfde9('0x2e')],GRAY_PERIOD_REASON);logger['info'](_0xfde9('0x2f'),GRAY_PERIOD_REASON[_0xfde9('0x30')](),moment()[_0xfde9('0x9')](_0xfde9('0x31')));return _0x36967c[_0xfde9('0x18')]({'data2':encryptDate(moment()[_0xfde9('0x9')](_0xfde9('0x31')))});}else{if(moment()[_0xfde9('0x32')](decryptDate(_0x37ad02[_0xfde9('0x28')]),_0xfde9('0x33'))>DAYS){logger[_0xfde9('0x29')]('DEMO\x20START\x20AT\x20%s',moment()[_0xfde9('0x9')](_0xfde9('0x31')));return _0x36967c[_0xfde9('0x18')]({'data1':_0x242dae,'data2':null,'license':null});}}}else{if(_0x37ad02[_0xfde9('0x2b')]!=_0x242dae){logger['info'](_0xfde9('0x34'),_0x37ad02[_0xfde9('0x2b')],_0x242dae);return _0x36967c[_0xfde9('0x18')]({'data1':_0x242dae,'data2':null,'license':null});}}}return _0x36967c;})[_0xfde9('0xe')](function(_0x21b30f){_0x36967c=_0x21b30f;})[_0xfde9('0xf')](function(_0x481488){logger[_0xfde9('0x35')](_0x481488['message']);})[_0xfde9('0x36')](function(){setTimeout(function(){manageLicense(hardware[_0xfde9('0x37')](),_0x36967c);},TIME);});}function defaultLicense(){var _0xbd5dd8=hardware['getUuid']();if(_0xbd5dd8){return db[_0xfde9('0x38')][_0xfde9('0x39')]({'where':{'id':0x1},'defaults':{'data1':_0xbd5dd8}})[_0xfde9('0x3a')](function(_0x2f8f83,_0x22e2dc){logger[_0xfde9('0x29')](_0xfde9('0x3b'),_0xbd5dd8);manageLicense(_0xbd5dd8,_0x2f8f83);})[_0xfde9('0xf')](function(_0x552d2d){logger[_0xfde9('0x35')](_0x552d2d[_0xfde9('0x3c')]);});}}exports[_0xfde9('0x3d')]=defaultLicense; \ No newline at end of file +var _0xb470=['request-promise','pkginfo','version','../../mysqldb','./hardware','../logger','license','../../api/jira/jira.controller','https://www.xcallymotion.com','format','exports','GET','then','catch','secrets','update','base64','final','createDecipher','aes-256-ctr','session','utf8','User','findOne','fullname','|reason|','|uuid|','|machineUuid|','|name|','|email|','email','getFirstInterface','ipAddress','MOTLICENSE','Motion\x20License\x20Alert','Alert','active','data2','info','THE\x20LICENSE\x20HAS\x20BEEN\x20ENABLED','THE\x20LICENSE\x20HAS\x20BEEN\x20UPDATED','data1','Disabled','THE\x20LICENSE\x20HAS\x20BEEN\x20DISABLED','Changed','uuid','%s\x20-\x20GRAY\x20PERIOD\x20STARTED\x20AT\x20%s','toUpperCase','YYYY-MM-DD\x20HH:mm','days','DEMO\x20START\x20AT\x20%s','error','message','getUuid','License','SERVICE\x20LICENSE\x20STARTED\x20%s','default','util','crypto','moment'];(function(_0x110e2a,_0x346f85){var _0x189aec=function(_0x51804c){while(--_0x51804c){_0x110e2a['push'](_0x110e2a['shift']());}};_0x189aec(++_0x346f85);}(_0xb470,0x75));var _0x0b47=function(_0x3ccc43,_0xe4e1b3){_0x3ccc43=_0x3ccc43-0x0;var _0x5e6b38=_0xb470[_0x3ccc43];return _0x5e6b38;};'use strict';var util=require(_0x0b47('0x0'));var crypto=require(_0x0b47('0x1'));var moment=require(_0x0b47('0x2'));var rp=require(_0x0b47('0x3'));var BPromise=require('bluebird');var pkginfo=require(_0x0b47('0x4'))(module,_0x0b47('0x5'));var db=require(_0x0b47('0x6'))['db'];var config=require('../environment');var hardware=require(_0x0b47('0x7'));var logger=require(_0x0b47('0x8'))(_0x0b47('0x9'));var jira=require(_0x0b47('0xa'));var HOST=_0x0b47('0xb');var TIME=0x3c*0x1388;var DAYS=0x7;var GRAY_PERIOD_REASON;var ADMIN;var oldToken;function httpRequest(_0x23d960){return new BPromise(function(_0x201ab2,_0x37eb18){var _0x4bfebf=util['format']('%s/api/servers/%s/check?version=%s',HOST,_0x23d960,module['exports'][_0x0b47('0x5')]);if(oldToken){_0x4bfebf=util[_0x0b47('0xc')]('%s/api/servers/%s/check?version=%s&oldtoken=%s',HOST,_0x23d960,module[_0x0b47('0xd')][_0x0b47('0x5')],oldToken);}var _0x243f01={'uri':_0x4bfebf,'method':_0x0b47('0xe'),'timeout':0xea60,'json':!![]};return rp(_0x243f01)[_0x0b47('0xf')](function(_0x26036){_0x201ab2(_0x26036);})[_0x0b47('0x10')](function(_0x457146){_0x37eb18(_0x457146);});});}function encryptDate(_0x58b8d){var _0x3d8949=crypto['createCipher']('aes-256-ctr',config[_0x0b47('0x11')]['session']);var _0x1e58a5=_0x3d8949[_0x0b47('0x12')](_0x58b8d,'utf8',_0x0b47('0x13'));_0x1e58a5+=_0x3d8949[_0x0b47('0x14')](_0x0b47('0x13'));return _0x1e58a5;}function decryptDate(_0x379c9d){var _0x387084=crypto[_0x0b47('0x15')](_0x0b47('0x16'),config[_0x0b47('0x11')][_0x0b47('0x17')]);var _0x1da847=_0x387084['update'](_0x379c9d,_0x0b47('0x13'),'utf8');_0x1da847+=_0x387084[_0x0b47('0x14')](_0x0b47('0x18'));return _0x1da847;}function sendJiraAlert(_0x2b1024,_0x478caa,_0x5cf426){var _0x5aee61='||FIELD||VALUE||\x0a';return db[_0x0b47('0x19')][_0x0b47('0x1a')]({'where':{'role':'admin'},'attributes':[_0x0b47('0x1b'),'email'],'raw':!![]})[_0x0b47('0xf')](function(_0x43e0e4){ADMIN=_0x43e0e4;_0x5aee61+=_0x0b47('0x1c')+_0x5cf426+'|\x0a';_0x5aee61+=_0x0b47('0x1d')+_0x2b1024+'|\x0a';_0x5aee61+=_0x0b47('0x1e')+_0x478caa+'|\x0a';_0x5aee61+=_0x0b47('0x1f')+ADMIN[_0x0b47('0x1b')]+'|\x0a';_0x5aee61+=_0x0b47('0x20')+ADMIN[_0x0b47('0x21')]+'|\x0a';return _0x5aee61;})[_0x0b47('0xf')](function(_0x3e37e8){var _0x4f79d4=hardware[_0x0b47('0x22')]()[_0x0b47('0x23')];return jira['openIssue']({'key':_0x0b47('0x24'),'summary':_0x0b47('0x25'),'description':_0x3e37e8,'issuetype':_0x0b47('0x26'),'oldToken':_0x2b1024,'newToken':_0x478caa,'email':ADMIN[_0x0b47('0x21')],'name':ADMIN['fullname'],'reason':GRAY_PERIOD_REASON,'ip':_0x4f79d4});});}function manageLicense(_0x47d1b2,_0x375983){var _0x4228e5=_0x375983['get']({'plain':!![]});httpRequest(_0x47d1b2)[_0x0b47('0xf')](function(_0x4509fc){if(oldToken){oldToken=undefined;}if(_0x4509fc[_0x0b47('0x27')]){if(!_0x4228e5[_0x0b47('0x9')]&&_0x4228e5[_0x0b47('0x9')]!=_0x4509fc[_0x0b47('0x9')]||_0x4228e5[_0x0b47('0x9')]&&_0x4228e5[_0x0b47('0x28')]){logger[_0x0b47('0x29')](_0x0b47('0x2a'));}if(_0x4228e5[_0x0b47('0x9')]&&!_0x4228e5['data2']&&_0x4228e5['license']!=_0x4509fc[_0x0b47('0x9')]){logger['info'](_0x0b47('0x2b'));}if(_0x4228e5[_0x0b47('0x9')]&&!_0x4228e5[_0x0b47('0x28')]&&_0x4228e5[_0x0b47('0x9')]==_0x4509fc[_0x0b47('0x9')]){return _0x375983;}return _0x375983['update']({'data1':_0x47d1b2,'data2':null,'license':_0x4509fc[_0x0b47('0x9')]});}else{if(_0x4509fc[_0x0b47('0x9')]||_0x4228e5[_0x0b47('0x9')]){if(!_0x4228e5['data2']){if(_0x4228e5[_0x0b47('0x2c')]==_0x47d1b2){GRAY_PERIOD_REASON=_0x0b47('0x2d');logger[_0x0b47('0x29')](_0x0b47('0x2e'));}else{GRAY_PERIOD_REASON=_0x0b47('0x2f');oldToken=_0x4228e5[_0x0b47('0x2c')];logger['info']('NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s',_0x4228e5[_0x0b47('0x2c')],_0x47d1b2);}sendJiraAlert(_0x4228e5[_0x0b47('0x2c')],_0x4509fc[_0x0b47('0x30')],GRAY_PERIOD_REASON);logger[_0x0b47('0x29')](_0x0b47('0x31'),GRAY_PERIOD_REASON[_0x0b47('0x32')](),moment()[_0x0b47('0xc')](_0x0b47('0x33')));return _0x375983[_0x0b47('0x12')]({'data2':encryptDate(moment()[_0x0b47('0xc')](_0x0b47('0x33')))});}else{if(moment()['diff'](decryptDate(_0x4228e5['data2']),_0x0b47('0x34'))>DAYS){logger['info'](_0x0b47('0x35'),moment()[_0x0b47('0xc')](_0x0b47('0x33')));return _0x375983[_0x0b47('0x12')]({'data1':_0x47d1b2,'data2':null,'license':null});}}}else{if(_0x4228e5[_0x0b47('0x2c')]!=_0x47d1b2){logger[_0x0b47('0x29')]('NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s',_0x4228e5['data1'],_0x47d1b2);return _0x375983['update']({'data1':_0x47d1b2,'data2':null,'license':null});}}}return _0x375983;})[_0x0b47('0xf')](function(_0x368c2a){_0x375983=_0x368c2a;})[_0x0b47('0x10')](function(_0x326653){logger[_0x0b47('0x36')](_0x326653[_0x0b47('0x37')]);})['finally'](function(){setTimeout(function(){manageLicense(hardware[_0x0b47('0x38')](),_0x375983);},TIME);});}function defaultLicense(){var _0x967bc1=hardware[_0x0b47('0x38')]();if(_0x967bc1){return db[_0x0b47('0x39')]['findOrCreate']({'where':{'id':0x1},'defaults':{'data1':_0x967bc1}})['spread'](function(_0x4648d6,_0x46f0cf){logger['info'](_0x0b47('0x3a'),_0x967bc1);manageLicense(_0x967bc1,_0x4648d6);})[_0x0b47('0x10')](function(_0xa332b7){logger['error'](_0xa332b7['message']);});}}exports[_0x0b47('0x3b')]=defaultLicense; \ No newline at end of file diff --git a/server/config/license/util.js b/server/config/license/util.js index b857264..e8a9244 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 _0x35f2=['then','checkLicense','util','lodash','moment','../../mysqldb','isEmpty','License\x20key\x20value\x20not\x20found','data1','data2','split','createDecipher','aes-256-ctr','format','%s:%s:%s','update','utf8','parse','demo','uuid','machineUuid','getUuid','secrets','base64','deadline','add','days','grayReason','changed','disabled','2027-01-01T00:00:00.000Z','Demo\x20license','License','find'];(function(_0x371187,_0xe7b303){var _0x37eaae=function(_0x51d843){while(--_0x51d843){_0x371187['push'](_0x371187['shift']());}};_0x37eaae(++_0xe7b303);}(_0x35f2,0x68));var _0x235f=function(_0x5a5c11,_0x358f6b){_0x5a5c11=_0x5a5c11-0x0;var _0x5d6ba7=_0x35f2[_0x5a5c11];return _0x5d6ba7;};'use strict';var crypto=require('crypto');var util=require(_0x235f('0x0'));var _=require(_0x235f('0x1'));var moment=require(_0x235f('0x2'));var hardware=require('./hardware');var config=require('../environment');var db=require(_0x235f('0x3'))['db'];function checkLicense(_0x48212c,_0x6622fa){if(_0x48212c){try{var _0x466de1=_0x6622fa||_0x48212c['license'];if(_[_0x235f('0x4')](_0x466de1)){throw new Error(_0x235f('0x5'));}var _0x31c167=_0x48212c[_0x235f('0x6')];var _0x2cd07b=_0x48212c[_0x235f('0x7')];var _0x4ca6c3=_0x31c167[_0x235f('0x8')]('-')[0x4];var _0x441c9b=_0x31c167[_0x235f('0x8')]('-')[0x0];var _0x2831aa=crypto[_0x235f('0x9')](_0x235f('0xa'),util[_0x235f('0xb')](_0x235f('0xc'),_0x4ca6c3,_0x31c167,_0x441c9b));var _0x189670=_0x2831aa[_0x235f('0xd')](_0x466de1,'base64',_0x235f('0xe'));_0x189670+=_0x2831aa['final'](_0x235f('0xe'));var _0x515cfd=JSON[_0x235f('0xf')](_0x189670);_0x515cfd[_0x235f('0x10')]=![];_0x515cfd[_0x235f('0x11')]=_0x31c167;_0x515cfd[_0x235f('0x12')]=hardware[_0x235f('0x13')]();if(_0x2cd07b){var _0x47214a=crypto[_0x235f('0x9')](_0x235f('0xa'),config[_0x235f('0x14')]['session']);var _0x4aa0f7=_0x47214a[_0x235f('0xd')](_0x2cd07b,_0x235f('0x15'),_0x235f('0xe'));_0x4aa0f7+=_0x47214a['final']('utf8');_0x515cfd['gray']=_0x4aa0f7;_0x515cfd[_0x235f('0x16')]=moment(_0x4aa0f7)[_0x235f('0x17')](0x7,_0x235f('0x18'))[_0x235f('0xb')]();_0x515cfd[_0x235f('0x19')]=_0x515cfd[_0x235f('0x11')]!=_0x515cfd[_0x235f('0x12')]?_0x235f('0x1a'):_0x235f('0x1b');}return _0x515cfd;}catch(_0xe05334){return{'breaking':!![],'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0x235f('0x1c'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'update':![],'description':'Breaking\x20license','uuid':_0x48212c[_0x235f('0x6')],'machineUuid':hardware[_0x235f('0x13')](),'message':_0xe05334['message'],'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};}}return{'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0x235f('0x1c'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'description':_0x235f('0x1d'),'uuid':_0x48212c[_0x235f('0x6')],'machineUuid':hardware[_0x235f('0x13')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};}exports['getLicense']=function(_0x1f925f){return db[_0x235f('0x1e')][_0x235f('0x1f')](_['defaults'](_0x1f925f,{'raw':!![],'where':{'id':0x1}}))[_0x235f('0x20')](function(_0x2ed6e2){return checkLicense(_0x2ed6e2,null);});};exports[_0x235f('0x21')]=checkLicense; \ No newline at end of file +var _0x1320=['final','gray','add','days','grayReason','changed','disabled','2027-01-01T00:00:00.000Z','Breaking\x20license','data1','message','Demo\x20license','getLicense','License','defaults','then','crypto','util','lodash','moment','./hardware','../environment','license','isEmpty','License\x20key\x20value\x20not\x20found','data2','split','createDecipher','aes-256-ctr','format','%s:%s:%s','base64','utf8','parse','uuid','machineUuid','getUuid','secrets','session','update'];(function(_0x2aa010,_0x13cf4b){var _0x5b30af=function(_0x360997){while(--_0x360997){_0x2aa010['push'](_0x2aa010['shift']());}};_0x5b30af(++_0x13cf4b);}(_0x1320,0x128));var _0x0132=function(_0x3f996d,_0x33c258){_0x3f996d=_0x3f996d-0x0;var _0x397e8a=_0x1320[_0x3f996d];return _0x397e8a;};'use strict';var crypto=require(_0x0132('0x0'));var util=require(_0x0132('0x1'));var _=require(_0x0132('0x2'));var moment=require(_0x0132('0x3'));var hardware=require(_0x0132('0x4'));var config=require(_0x0132('0x5'));var db=require('../../mysqldb')['db'];function checkLicense(_0x4f1267,_0x1a13a3){if(_0x4f1267){try{var _0x3dce73=_0x1a13a3||_0x4f1267[_0x0132('0x6')];if(_[_0x0132('0x7')](_0x3dce73)){throw new Error(_0x0132('0x8'));}var _0x34408b=_0x4f1267['data1'];var _0x442d09=_0x4f1267[_0x0132('0x9')];var _0x4baa1a=_0x34408b[_0x0132('0xa')]('-')[0x4];var _0x221db7=_0x34408b['split']('-')[0x0];var _0x56ae36=crypto[_0x0132('0xb')](_0x0132('0xc'),util[_0x0132('0xd')](_0x0132('0xe'),_0x4baa1a,_0x34408b,_0x221db7));var _0x2b4b4d=_0x56ae36['update'](_0x3dce73,_0x0132('0xf'),'utf8');_0x2b4b4d+=_0x56ae36['final'](_0x0132('0x10'));var _0x9c947c=JSON[_0x0132('0x11')](_0x2b4b4d);_0x9c947c['demo']=![];_0x9c947c[_0x0132('0x12')]=_0x34408b;_0x9c947c[_0x0132('0x13')]=hardware[_0x0132('0x14')]();if(_0x442d09){var _0x3b32b9=crypto[_0x0132('0xb')](_0x0132('0xc'),config[_0x0132('0x15')][_0x0132('0x16')]);var _0x34ffdc=_0x3b32b9[_0x0132('0x17')](_0x442d09,_0x0132('0xf'),_0x0132('0x10'));_0x34ffdc+=_0x3b32b9[_0x0132('0x18')](_0x0132('0x10'));_0x9c947c[_0x0132('0x19')]=_0x34ffdc;_0x9c947c['deadline']=moment(_0x34ffdc)[_0x0132('0x1a')](0x7,_0x0132('0x1b'))[_0x0132('0xd')]();_0x9c947c[_0x0132('0x1c')]=_0x9c947c[_0x0132('0x12')]!=_0x9c947c['machineUuid']?_0x0132('0x1d'):_0x0132('0x1e');}return _0x9c947c;}catch(_0x52798a){return{'breaking':!![],'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0x0132('0x1f'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'update':![],'description':_0x0132('0x20'),'uuid':_0x4f1267[_0x0132('0x21')],'machineUuid':hardware['getUuid'](),'message':_0x52798a[_0x0132('0x22')],'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};}}return{'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0x0132('0x1f'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'description':_0x0132('0x23'),'uuid':_0x4f1267[_0x0132('0x21')],'machineUuid':hardware[_0x0132('0x14')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};}exports[_0x0132('0x24')]=function(_0x51255d){return db[_0x0132('0x25')]['find'](_[_0x0132('0x26')](_0x51255d,{'raw':!![],'where':{'id':0x1}}))[_0x0132('0x27')](function(_0x940d8b){return checkLicense(_0x940d8b,null);});};exports['checkLicense']=checkLicense; \ No newline at end of file diff --git a/server/config/local.env.js b/server/config/local.env.js index 53d2b69..9391b61 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 _0x108a=['http://localhost:9000','myappanuglar-secret'];(function(_0xcde681,_0x2d0464){var _0x4e58bf=function(_0x36e953){while(--_0x36e953){_0xcde681['push'](_0xcde681['shift']());}};_0x4e58bf(++_0x2d0464);}(_0x108a,0x172));var _0xa108=function(_0x131f6e,_0x92b13d){_0x131f6e=_0x131f6e-0x0;var _0x4adf97=_0x108a[_0x131f6e];return _0x4adf97;};'use strict';module['exports']={'DOMAIN':_0xa108('0x0'),'SESSION_SECRET':_0xa108('0x1'),'GOOGLE_ID':'app-id','GOOGLE_SECRET':'secret','DEBUG':''}; \ No newline at end of file +var _0xc7ee=['secret','exports','http://localhost:9000','myappanuglar-secret','app-id'];(function(_0x5d7831,_0x18d6ce){var _0x39a223=function(_0x3b73ba){while(--_0x3b73ba){_0x5d7831['push'](_0x5d7831['shift']());}};_0x39a223(++_0x18d6ce);}(_0xc7ee,0x1aa));var _0xec7e=function(_0x167cc1,_0x56ef5a){_0x167cc1=_0x167cc1-0x0;var _0x10bc4b=_0xc7ee[_0x167cc1];return _0x10bc4b;};'use strict';module[_0xec7e('0x0')]={'DOMAIN':_0xec7e('0x1'),'SESSION_SECRET':_0xec7e('0x2'),'GOOGLE_ID':_0xec7e('0x3'),'GOOGLE_SECRET':_0xec7e('0x4'),'DEBUG':''}; \ No newline at end of file diff --git a/server/config/logger.js b/server/config/logger.js index 6c33a46..ae3a9b6 100644 --- a/server/config/logger.js +++ b/server/config/logger.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x16a4=['exports','transports','File','%s-%s','error','info','moment','winston','util','path','INFO','join','/var','log','format','%s-%s.log','[%s]\x20[%s]\x20%s\x20-\x20%s','YYYY-MM-DD\x20HH:mm:ss','level','toUpperCase','message'];(function(_0x56bdf8,_0x8bf571){var _0x2f44d9=function(_0x34ee87){while(--_0x34ee87){_0x56bdf8['push'](_0x56bdf8['shift']());}};_0x2f44d9(++_0x8bf571);}(_0x16a4,0x1d4));var _0x416a=function(_0x22e170,_0x267235){_0x22e170=_0x22e170-0x0;var _0x4d3dfe=_0x16a4[_0x22e170];return _0x4d3dfe;};'use strict';var moment=require(_0x416a('0x0'));var winston=require(_0x416a('0x1'));var util=require(_0x416a('0x2'));var path=require(_0x416a('0x3'));var debugLevel=_0x416a('0x4');function filename(_0x1e221d,_0x358c67){return path[_0x416a('0x5')](_0x416a('0x6'),_0x416a('0x7'),'xcally',util[_0x416a('0x8')](_0x416a('0x9'),_0x1e221d,_0x358c67));}function formatter(_0x2bb9e2,_0x128e22){return util[_0x416a('0x8')](_0x416a('0xa'),moment()[_0x416a('0x8')](_0x416a('0xb')),_0x128e22[_0x416a('0xc')][_0x416a('0xd')](),_0x2bb9e2,_0x128e22[_0x416a('0xe')]);}module[_0x416a('0xf')]=function(_0x48aad6){return new winston['Logger']({'transports':[new winston[(_0x416a('0x10'))][(_0x416a('0x11'))]({'name':util[_0x416a('0x8')](_0x416a('0x12'),_0x48aad6,_0x416a('0x13')),'filename':filename(_0x48aad6,'error'),'level':'error','json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x1f5ab4){return formatter(_0x48aad6,_0x1f5ab4);}}),new winston[(_0x416a('0x10'))][(_0x416a('0x11'))]({'name':util[_0x416a('0x8')](_0x416a('0x12'),_0x48aad6,_0x416a('0x14')),'filename':filename(_0x48aad6,'info'),'level':_0x416a('0x14'),'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x3d59ab){return formatter(_0x48aad6,_0x3d59ab);}}),new winston[(_0x416a('0x10'))]['Console']({'level':process['env']['debugLevel']||debugLevel,'json':![],'formatter':function(_0x49b2bf){return formatter(_0x48aad6,_0x49b2bf);}})]});}; \ No newline at end of file +var _0xbddc=['transports','error','File','%s-%s','info','Console','env','moment','winston','path','join','/var','log','xcally','format','[%s]\x20[%s]\x20%s\x20-\x20%s','YYYY-MM-DD\x20HH:mm:ss','level','toUpperCase','exports','Logger'];(function(_0x4e9d3c,_0x1f4b98){var _0x2d0825=function(_0x384676){while(--_0x384676){_0x4e9d3c['push'](_0x4e9d3c['shift']());}};_0x2d0825(++_0x1f4b98);}(_0xbddc,0x118));var _0xcbdd=function(_0x4a452b,_0x17e2f1){_0x4a452b=_0x4a452b-0x0;var _0x304b39=_0xbddc[_0x4a452b];return _0x304b39;};'use strict';var moment=require(_0xcbdd('0x0'));var winston=require(_0xcbdd('0x1'));var util=require('util');var path=require(_0xcbdd('0x2'));var debugLevel='INFO';function filename(_0x25487a,_0x119e76){return path[_0xcbdd('0x3')](_0xcbdd('0x4'),_0xcbdd('0x5'),_0xcbdd('0x6'),util['format']('%s-%s.log',_0x25487a,_0x119e76));}function formatter(_0x5e7edd,_0x337eee){return util[_0xcbdd('0x7')](_0xcbdd('0x8'),moment()[_0xcbdd('0x7')](_0xcbdd('0x9')),_0x337eee[_0xcbdd('0xa')][_0xcbdd('0xb')](),_0x5e7edd,_0x337eee['message']);}module[_0xcbdd('0xc')]=function(_0x44cfee){return new winston[(_0xcbdd('0xd'))]({'transports':[new winston[(_0xcbdd('0xe'))]['File']({'name':util[_0xcbdd('0x7')]('%s-%s',_0x44cfee,_0xcbdd('0xf')),'filename':filename(_0x44cfee,'error'),'level':_0xcbdd('0xf'),'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x14fc1a){return formatter(_0x44cfee,_0x14fc1a);}}),new winston[(_0xcbdd('0xe'))][(_0xcbdd('0x10'))]({'name':util[_0xcbdd('0x7')](_0xcbdd('0x11'),_0x44cfee,_0xcbdd('0x12')),'filename':filename(_0x44cfee,_0xcbdd('0x12')),'level':_0xcbdd('0x12'),'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x97957){return formatter(_0x44cfee,_0x97957);}}),new winston[(_0xcbdd('0xe'))][(_0xcbdd('0x13'))]({'level':process[_0xcbdd('0x14')]['debugLevel']||debugLevel,'json':![],'formatter':function(_0x52e563){return formatter(_0x44cfee,_0x52e563);}})]});}; \ No newline at end of file diff --git a/server/config/pm2/config.js b/server/config/pm2/config.js index 0f2e923..2581a6a 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 _0x1e69=['routing','../../services/routing/index.js','exports','path','../../services/express/index.js','ami','join','agi','../../services/agi/index.js','email'];(function(_0x1be35b,_0xa49780){var _0xd22f6=function(_0x4322a8){while(--_0x4322a8){_0x1be35b['push'](_0x1be35b['shift']());}};_0xd22f6(++_0xa49780);}(_0x1e69,0x19d));var _0x91e6=function(_0x50745e,_0x4722a9){_0x50745e=_0x50745e-0x0;var _0x17886c=_0x1e69[_0x50745e];return _0x17886c;};'use strict';var path=require(_0x91e6('0x0'));var os=require('os');var config={'apps':[{'name':'express','script':path['join'](__dirname,_0x91e6('0x1'))},{'name':_0x91e6('0x2'),'script':path[_0x91e6('0x3')](__dirname,'../../services/ami/index.js')},{'name':_0x91e6('0x4'),'script':path['join'](__dirname,_0x91e6('0x5'))},{'name':_0x91e6('0x6'),'script':path['join'](__dirname,'../../services/email/index.js')},{'name':_0x91e6('0x7'),'script':path['join'](__dirname,_0x91e6('0x8'))},{'name':'xdr','script':path[_0x91e6('0x3')](__dirname,'../../services/xdr/index.js')}]};module[_0x91e6('0x9')]=config; \ No newline at end of file +var _0x89c4=['path','express','join','../../services/express/index.js','ami','agi','email','../../services/email/index.js','routing','../../services/routing/index.js','xdr'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x89c4,0xc6));var _0x489c=function(_0x3cb466,_0x2d53df){_0x3cb466=_0x3cb466-0x0;var _0x3a7d00=_0x89c4[_0x3cb466];return _0x3a7d00;};'use strict';var path=require(_0x489c('0x0'));var os=require('os');var config={'apps':[{'name':_0x489c('0x1'),'script':path[_0x489c('0x2')](__dirname,_0x489c('0x3'))},{'name':_0x489c('0x4'),'script':path[_0x489c('0x2')](__dirname,'../../services/ami/index.js')},{'name':_0x489c('0x5'),'script':path[_0x489c('0x2')](__dirname,'../../services/agi/index.js')},{'name':_0x489c('0x6'),'script':path[_0x489c('0x2')](__dirname,_0x489c('0x7'))},{'name':_0x489c('0x8'),'script':path[_0x489c('0x2')](__dirname,_0x489c('0x9'))},{'name':_0x489c('0xa'),'script':path[_0x489c('0x2')](__dirname,'../../services/xdr/index.js')}]};module['exports']=config; \ No newline at end of file diff --git a/server/config/pm2/index.js b/server/config/pm2/index.js index beb1014..1624dcb 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 _0x3baf=['disconnect','restart','list','describe','delete','dump','saved','pm2','bluebird','./config','connect','connected','start','then','stop'];(function(_0x1bf45b,_0x1eee87){var _0x3a2d5d=function(_0x423951){while(--_0x423951){_0x1bf45b['push'](_0x1bf45b['shift']());}};_0x3a2d5d(++_0x1eee87);}(_0x3baf,0xf7));var _0xf3ba=function(_0x4fdd16,_0x3174cb){_0x4fdd16=_0x4fdd16-0x0;var _0x553370=_0x3baf[_0x4fdd16];return _0x553370;};'use strict';var pm2=require(_0xf3ba('0x0'));var BPromise=require(_0xf3ba('0x1'));var config=require(_0xf3ba('0x2'));function connect(){return new BPromise(function(_0x3979b3,_0x29bbc2){return pm2[_0xf3ba('0x3')](function(_0xfce22){if(_0xfce22){return _0x29bbc2(_0xfce22);}return _0x3979b3(_0xf3ba('0x4'));});});};exports[_0xf3ba('0x5')]=function(_0x1ae6e6){return connect()[_0xf3ba('0x6')](function(){return new BPromise(function(_0x1c7a62,_0x475268){return pm2[_0xf3ba('0x5')](_0x1ae6e6,function(_0x1284b7,_0x4de144){if(_0x1284b7){return _0x475268(_0x1284b7);}pm2['disconnect']();return _0x1c7a62(_0x4de144);});});});};exports['stop']=function(_0x32f810){return connect()['then'](function(){return new BPromise(function(_0x346f5b,_0x1a2166){return pm2[_0xf3ba('0x7')](_0x32f810,function(_0x40cff2,_0x3a5714){if(_0x40cff2){return _0x1a2166(_0x40cff2);}pm2[_0xf3ba('0x8')]();return _0x346f5b(_0x3a5714);});});});};exports[_0xf3ba('0x9')]=function(_0x318b41){return connect()[_0xf3ba('0x6')](function(){return new BPromise(function(_0x301ca1,_0x302bcb){return pm2[_0xf3ba('0x9')](_0x318b41,function(_0x46c2cf,_0x85939e){if(_0x46c2cf){return _0x302bcb(_0x46c2cf);}pm2[_0xf3ba('0x8')]();return _0x301ca1(_0x85939e);});});});};exports[_0xf3ba('0xa')]=function(){return connect()[_0xf3ba('0x6')](function(){return new BPromise(function(_0x3e44d6,_0x505b8d){return pm2[_0xf3ba('0xa')](function(_0x56816b,_0x815037){if(_0x56816b){return _0x505b8d(_0x56816b);}pm2[_0xf3ba('0x8')]();return _0x3e44d6(_0x815037);});});});};exports[_0xf3ba('0xb')]=function(_0x1e2969){return connect()[_0xf3ba('0x6')](function(){return new BPromise(function(_0x53f848,_0x301856){return pm2[_0xf3ba('0xb')](_0x1e2969,function(_0x13d899,_0x550dd3){if(_0x13d899){return _0x301856(_0x13d899);}pm2[_0xf3ba('0x8')]();return _0x53f848(_0x550dd3);});});});};exports[_0xf3ba('0xc')]=function(_0x430d64){return connect()[_0xf3ba('0x6')](function(){return new BPromise(function(_0x4d3c0a,_0x1e18ed){return pm2[_0xf3ba('0xc')](_0x430d64,function(_0x4e601c,_0x479d65){if(_0x4e601c){return _0x1e18ed(_0x4e601c);}pm2[_0xf3ba('0x8')]();return _0x4d3c0a(_0x479d65);});});});};exports[_0xf3ba('0xd')]=function(){return connect()[_0xf3ba('0x6')](function(){return new BPromise(function(_0x5d351f,_0x375bcf){return pm2[_0xf3ba('0xd')](function(_0x35d6d4){if(_0x35d6d4){return _0x375bcf(_0x35d6d4);}return _0x5d351f(_0xf3ba('0xe'));});});});}; \ No newline at end of file +var _0x2297=['bluebird','./config','connect','connected','start','disconnect','stop','then','restart','describe','delete','dump','saved'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x2297,0x186));var _0x7229=function(_0x534cd7,_0xc7c8d8){_0x534cd7=_0x534cd7-0x0;var _0x5bd431=_0x2297[_0x534cd7];return _0x5bd431;};'use strict';var pm2=require('pm2');var BPromise=require(_0x7229('0x0'));var config=require(_0x7229('0x1'));function connect(){return new BPromise(function(_0x7a9ae8,_0x565ffb){return pm2[_0x7229('0x2')](function(_0x150791){if(_0x150791){return _0x565ffb(_0x150791);}return _0x7a9ae8(_0x7229('0x3'));});});};exports['start']=function(_0x36caa5){return connect()['then'](function(){return new BPromise(function(_0x123933,_0x4b9909){return pm2[_0x7229('0x4')](_0x36caa5,function(_0x46f6bd,_0xf1a0a2){if(_0x46f6bd){return _0x4b9909(_0x46f6bd);}pm2[_0x7229('0x5')]();return _0x123933(_0xf1a0a2);});});});};exports[_0x7229('0x6')]=function(_0x3100bf){return connect()[_0x7229('0x7')](function(){return new BPromise(function(_0x3fa74f,_0x3c8a2f){return pm2[_0x7229('0x6')](_0x3100bf,function(_0x1ac8a4,_0x535c3e){if(_0x1ac8a4){return _0x3c8a2f(_0x1ac8a4);}pm2[_0x7229('0x5')]();return _0x3fa74f(_0x535c3e);});});});};exports[_0x7229('0x8')]=function(_0x3fcbc3){return connect()[_0x7229('0x7')](function(){return new BPromise(function(_0x2bb2e8,_0x48f1ba){return pm2['restart'](_0x3fcbc3,function(_0x1304ba,_0x3cb1b3){if(_0x1304ba){return _0x48f1ba(_0x1304ba);}pm2[_0x7229('0x5')]();return _0x2bb2e8(_0x3cb1b3);});});});};exports['list']=function(){return connect()[_0x7229('0x7')](function(){return new BPromise(function(_0x2006ba,_0x1582eb){return pm2['list'](function(_0x5c74fd,_0x2a99dc){if(_0x5c74fd){return _0x1582eb(_0x5c74fd);}pm2[_0x7229('0x5')]();return _0x2006ba(_0x2a99dc);});});});};exports[_0x7229('0x9')]=function(_0x5201a4){return connect()[_0x7229('0x7')](function(){return new BPromise(function(_0x28c88f,_0x3a5984){return pm2[_0x7229('0x9')](_0x5201a4,function(_0x4b1b53,_0x42b9c1){if(_0x4b1b53){return _0x3a5984(_0x4b1b53);}pm2[_0x7229('0x5')]();return _0x28c88f(_0x42b9c1);});});});};exports[_0x7229('0xa')]=function(_0x27cf20){return connect()[_0x7229('0x7')](function(){return new BPromise(function(_0x183828,_0xa536bf){return pm2[_0x7229('0xa')](_0x27cf20,function(_0x4f7bd2,_0x693a82){if(_0x4f7bd2){return _0xa536bf(_0x4f7bd2);}pm2[_0x7229('0x5')]();return _0x183828(_0x693a82);});});});};exports[_0x7229('0xb')]=function(){return connect()['then'](function(){return new BPromise(function(_0x3ccafd,_0x1802d7){return pm2['dump'](function(_0x1d25d9){if(_0x1d25d9){return _0x1802d7(_0x1d25d9);}return _0x3ccafd(_0x7229('0xc'));});});});}; \ No newline at end of file diff --git a/server/config/schedule/chat.js b/server/config/schedule/chat.js index 5156c56..ee84b14 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 _0xcf11=['chatTimeout','then','ChatInteraction','findAll','lastMsgAt','subtract','minutes','update','timeout','length','emit','error','start','moment','ioredis','../../mysqldb','../../config/environment','redis','defaults','socket.io-emitter','Setting','find'];(function(_0x2e5008,_0x34e9b2){var _0x375c23=function(_0x298543){while(--_0x298543){_0x2e5008['push'](_0x2e5008['shift']());}};_0x375c23(++_0x34e9b2);}(_0xcf11,0x183));var _0x1cf1=function(_0xc6879,_0x84a966){_0xc6879=_0xc6879-0x0;var _0x54f7a4=_0xcf11[_0xc6879];return _0x54f7a4;};'use strict';var _=require('lodash');var moment=require(_0x1cf1('0x0'));var Redis=require(_0x1cf1('0x1'));var db=require(_0x1cf1('0x2'))['db'];var config=require(_0x1cf1('0x3'));config[_0x1cf1('0x4')]=_[_0x1cf1('0x5')](config[_0x1cf1('0x4')],{'host':'localhost','port':0x18eb});var io=require(_0x1cf1('0x6'))(new Redis(config[_0x1cf1('0x4')]));function closeInteractions(){var _0x1d67b4=0x0;var _0x515983=[];return db[_0x1cf1('0x7')][_0x1cf1('0x8')]({'raw':!![],'attributes':['id',_0x1cf1('0x9')],'where':{'id':0x1}})[_0x1cf1('0xa')](function(_0x3ea3bb){_0x1d67b4=_0x3ea3bb[_0x1cf1('0x9')];if(_0x1d67b4){return db[_0x1cf1('0xb')][_0x1cf1('0xc')]({'raw':!![],'attributes':['id',_0x1cf1('0xd')],'where':{'closed':![],'lastMsgAt':{'$lt':moment()[_0x1cf1('0xe')](_0x3ea3bb[_0x1cf1('0x9')],_0x1cf1('0xf'))}}});}else{return[];}})[_0x1cf1('0xa')](function(_0x5a54a6){_0x515983=_0x5a54a6;if(_0x1d67b4){return db[_0x1cf1('0xb')][_0x1cf1('0x10')]({'closeReason':'system','disposition':_0x1cf1('0x11'),'closed':!![],'closedAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss')},{'where':{'id':_['map'](_0x515983||[],'id')}});}})[_0x1cf1('0xa')](function(_0x3de1f6){for(var _0x27e079=0x0;_0x27e079<_0x515983[_0x1cf1('0x12')];_0x27e079++){io[_0x1cf1('0x13')]('chatInteraction:update',{'id':_0x515983[_0x27e079]['id'],'closed':!![]});}})['catch'](function(_0x13dab2){console[_0x1cf1('0x14')](_0x13dab2);});}exports[_0x1cf1('0x15')]=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file +var _0xc5a0=['chatTimeout','ChatInteraction','findAll','lastMsgAt','minutes','update','system','timeout','format','YYYY-MM-DD\x20HH:mm:ss','map','length','emit','chatInteraction:update','catch','error','moment','ioredis','redis','defaults','localhost','Setting','then'];(function(_0xf365cf,_0x461f3d){var _0x1261a0=function(_0x2f0c99){while(--_0x2f0c99){_0xf365cf['push'](_0xf365cf['shift']());}};_0x1261a0(++_0x461f3d);}(_0xc5a0,0x10d));var _0x0c5a=function(_0x30d4eb,_0x377d52){_0x30d4eb=_0x30d4eb-0x0;var _0x1356e5=_0xc5a0[_0x30d4eb];return _0x1356e5;};'use strict';var _=require('lodash');var moment=require(_0x0c5a('0x0'));var Redis=require(_0x0c5a('0x1'));var db=require('../../mysqldb')['db'];var config=require('../../config/environment');config[_0x0c5a('0x2')]=_[_0x0c5a('0x3')](config['redis'],{'host':_0x0c5a('0x4'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x0c5a('0x2')]));function closeInteractions(){var _0x1a6654=0x0;var _0x5200e5=[];return db[_0x0c5a('0x5')]['find']({'raw':!![],'attributes':['id','chatTimeout'],'where':{'id':0x1}})[_0x0c5a('0x6')](function(_0x509195){_0x1a6654=_0x509195[_0x0c5a('0x7')];if(_0x1a6654){return db[_0x0c5a('0x8')][_0x0c5a('0x9')]({'raw':!![],'attributes':['id',_0x0c5a('0xa')],'where':{'closed':![],'lastMsgAt':{'$lt':moment()['subtract'](_0x509195['chatTimeout'],_0x0c5a('0xb'))}}});}else{return[];}})[_0x0c5a('0x6')](function(_0x4e0897){_0x5200e5=_0x4e0897;if(_0x1a6654){return db[_0x0c5a('0x8')][_0x0c5a('0xc')]({'closeReason':_0x0c5a('0xd'),'disposition':_0x0c5a('0xe'),'closed':!![],'closedAt':moment()[_0x0c5a('0xf')](_0x0c5a('0x10'))},{'where':{'id':_[_0x0c5a('0x11')](_0x5200e5||[],'id')}});}})[_0x0c5a('0x6')](function(_0xb67ea1){for(var _0x22b7b4=0x0;_0x22b7b4<_0x5200e5[_0x0c5a('0x12')];_0x22b7b4++){io[_0x0c5a('0x13')](_0x0c5a('0x14'),{'id':_0x5200e5[_0x22b7b4]['id'],'closed':!![]});}})[_0x0c5a('0x15')](function(_0x109730){console[_0x0c5a('0x16')](_0x109730);});}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 aaee876..9d9df40 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 _0xc550=['resolve','run\x20job','cron','isBetween','startAt','endAt','add','start','add\x20cron','stop\x20cron','active','update\x20cron','run','path','lodash','moment','cron-job-manager','jayson/promise','bluebird','../logger','schedule','../../mysqldb','../../api/analyticDefaultReport/analyticDefaultReport.controller','client','info','email','Smtp','service','MailAccount','host','port','secure','authentication','auth','user','format','\x22%s\x22\x20<%s>','name','bcc','Report\x20%s\x20last\x20%s\x20%s','subtractNumber','subtractUnit','%s.%s','basename','savename','extname','zip','join','status','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','stringify','Sent','empty\x20file,\x20email\x20not\x20sent','SendMail','then','error\x20mail','catch','error','data','isNil','subtractNumber\x20null\x20or\x20undefined','subtractUnit\x20null\x20or\x20undefined','subtract','YYYY-MM-DD\x20HH:mm:ss','output','DefaultReportId','runReport','exec\x20custom\x20report\x20id:%s','CustomReportId','no\x20report\x20id','Schedule','findAll','keys','toString','keyBy','difference','intersection','length','exists','stop','deleteJob','index','my\x20id'];(function(_0x3077c3,_0x44c4a9){var _0x134f18=function(_0xb9bf78){while(--_0xb9bf78){_0x3077c3['push'](_0x3077c3['shift']());}};_0x134f18(++_0x44c4a9);}(_0xc550,0x10f));var _0x0c55=function(_0x9ab282,_0x224526){_0x9ab282=_0x9ab282-0x0;var _0x3ae406=_0xc550[_0x9ab282];return _0x3ae406;};'use strict';var fs=require('fs');var util=require('util');var path=require(_0x0c55('0x0'));var _=require(_0x0c55('0x1'));var moment=require(_0x0c55('0x2'));var CronJobManager=require(_0x0c55('0x3'));var jayson=require(_0x0c55('0x4'));var BPromise=require(_0x0c55('0x5'));var logger=require(_0x0c55('0x6'))(_0x0c55('0x7'));var db=require(_0x0c55('0x8'))['db'];var analyticCustomReportController=require('../../api/analyticCustomReport/analyticCustomReport.controller');var analyticDefaultReportController=require(_0x0c55('0x9'));var client=jayson[_0x0c55('0xa')]['http']({'port':0x232b});var manager=new CronJobManager();function handleSendEmail(_0xa9e3a8,_0x5f158a){return function(){logger[_0x0c55('0xb')]('Try\x20to\x20send\x20a\x20mail\x20to',_0xa9e3a8[_0x0c55('0xc')]);var _0x34e658=!![];var _0x31f791={'tls':{'rejectUnauthorized':![]}};if(_0xa9e3a8['MailAccount'][_0x0c55('0xd')][_0x0c55('0xe')]){_0x31f791['service']=_0xa9e3a8[_0x0c55('0xf')][_0x0c55('0xd')][_0x0c55('0xe')];}else{_0x31f791[_0x0c55('0x10')]=_0xa9e3a8[_0x0c55('0xf')][_0x0c55('0xd')][_0x0c55('0x10')];_0x31f791[_0x0c55('0x11')]=_0xa9e3a8[_0x0c55('0xf')][_0x0c55('0xd')][_0x0c55('0x11')];_0x31f791[_0x0c55('0x12')]=_0xa9e3a8['MailAccount']['Smtp'][_0x0c55('0x12')];}if(_0xa9e3a8[_0x0c55('0xf')][_0x0c55('0xd')][_0x0c55('0x13')]){_0x31f791[_0x0c55('0x14')]={'user':_0xa9e3a8[_0x0c55('0xf')]['Smtp'][_0x0c55('0x15')],'pass':_0xa9e3a8[_0x0c55('0xf')][_0x0c55('0xd')]['pass']};}var _0xc4fc38={'account':_0x31f791,'message':{'from':util[_0x0c55('0x16')](_0x0c55('0x17'),_0xa9e3a8[_0x0c55('0xf')][_0x0c55('0x18')],_0xa9e3a8[_0x0c55('0xf')][_0x0c55('0xc')]||_0xa9e3a8['MailAccount'][_0x0c55('0xd')]['user']),'to':_0xa9e3a8[_0x0c55('0xc')],'cc':_0xa9e3a8['cc'],'bcc':_0xa9e3a8[_0x0c55('0x19')],'subject':util['format'](_0x0c55('0x1a'),_0x5f158a[_0x0c55('0x18')],_0xa9e3a8[_0x0c55('0x1b')],_0xa9e3a8[_0x0c55('0x1c')])}};var _0x118608=path['join'](__dirname,'../../files/reports');var _0xcc7978=_0x5f158a['savename'];var _0x9a7d91=util[_0x0c55('0x16')](_0x0c55('0x1d'),path[_0x0c55('0x1e')](_0x5f158a[_0x0c55('0x1f')],path[_0x0c55('0x20')](_0x5f158a[_0x0c55('0x1f')])),_0x0c55('0x21'));var _0x11d6c1=path[_0x0c55('0x22')](_0x118608,_0xcc7978);var _0x49b35e=path[_0x0c55('0x22')](_0x118608,_0x9a7d91);if(fs['existsSync'](_0x11d6c1)){_0x5f158a[_0x0c55('0x23')]='Sent';_0xc4fc38['message'][_0x0c55('0x24')]=[{'filename':_0xcc7978,'path':_0x11d6c1}];_0xc4fc38[_0x0c55('0x25')][_0x0c55('0x26')]=util[_0x0c55('0x16')](_0x0c55('0x27'),JSON[_0x0c55('0x28')](_0x5f158a,null,0x2));}else if(fs['existsSync'](_0x49b35e)){_0x5f158a[_0x0c55('0x23')]=_0x0c55('0x29');_0xc4fc38[_0x0c55('0x25')]['attachments']=[{'filename':_0x9a7d91,'path':_0x49b35e}];}else{_0xc4fc38['message'][_0x0c55('0x26')]='Report\x20empty\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a';if(!_0xa9e3a8['sendIfEmpty']){_0x34e658=![];logger[_0x0c55('0xb')](_0x0c55('0x2a'));}}if(_0x34e658){return client['request'](_0x0c55('0x2b'),_0xc4fc38)[_0x0c55('0x2c')](function(_0x535a37){if(_0x535a37['error']){return logger['error'](_0x0c55('0x2d'),JSON[_0x0c55('0x28')](_0x535a37));}return logger[_0x0c55('0xb')]('email\x20sent');})[_0x0c55('0x2e')](function(_0x200356){return logger[_0x0c55('0x2f')]('error\x20mail',JSON['stringify'](_0x200356));});}};}function handleError(){return function(_0x5eaeef){return logger[_0x0c55('0x2f')](JSON[_0x0c55('0x28')](_0x5eaeef));};}function handleResult(_0x1478cc){return function(_0x57c9a3){logger[_0x0c55('0xb')](_0x0c55('0x30'),JSON['stringify'](_0x57c9a3));if(_0x1478cc[_0x0c55('0xf')]&&_0x1478cc[_0x0c55('0xf')][_0x0c55('0xd')]&&!_[_0x0c55('0x31')](_0x1478cc[_0x0c55('0xc')])){setTimeout(handleSendEmail(_0x1478cc,_0x57c9a3),0x3c*0x3e8);}};}function handleJob(_0x5d9c13){return function(){try{if(_[_0x0c55('0x31')](_0x5d9c13[_0x0c55('0x1b')])){return logger['info'](_0x0c55('0x32'));}if(_[_0x0c55('0x31')](_0x5d9c13['subtractUnit'])){return logger[_0x0c55('0xb')](_0x0c55('0x33'));}var _0x4ebe62={'startDate':moment()[_0x0c55('0x34')](_0x5d9c13[_0x0c55('0x1b')],_0x5d9c13[_0x0c55('0x1c')])['format'](_0x0c55('0x35')),'endDate':moment()[_0x0c55('0x16')](_0x0c55('0x35')),'type':'scheduled','output':_0x5d9c13[_0x0c55('0x36')],'name':_0x5d9c13[_0x0c55('0x18')]};if(!_['isNil'](_0x5d9c13['DefaultReportId'])){logger[_0x0c55('0xb')]('exec\x20defaul\x20report\x20id:%s',_0x5d9c13[_0x0c55('0x37')]);return analyticDefaultReportController[_0x0c55('0x38')]({'id':_0x5d9c13[_0x0c55('0x37')]},_0x4ebe62)['then'](handleResult(_0x5d9c13))['catch'](handleError());}if(!_[_0x0c55('0x31')](_0x5d9c13['CustomReportId'])){logger[_0x0c55('0xb')](_0x0c55('0x39'),_0x5d9c13[_0x0c55('0x3a')]);return analyticCustomReportController[_0x0c55('0x38')]({'id':_0x5d9c13['CustomReportId']},_0x4ebe62)[_0x0c55('0x2c')](handleResult(_0x5d9c13))['catch'](handleError());}}catch(_0x38e625){logger[_0x0c55('0x2f')](JSON[_0x0c55('0x28')](_0x38e625));}return logger[_0x0c55('0xb')](_0x0c55('0x3b'));};}function getJobs(_0x5e7c46){var _0x3c1a1b={};if(_0x5e7c46){_0x3c1a1b['id']=_0x5e7c46;}return db[_0x0c55('0x3c')][_0x0c55('0x3d')]({'where':_0x3c1a1b,'include':[{'model':db[_0x0c55('0xf')],'attributes':['id',_0x0c55('0x18'),_0x0c55('0xc')],'include':[{'model':db['MailServerOut'],'as':_0x0c55('0xd')}]}]})['then'](function(_0x169f52){var _0x49a748=_[_0x0c55('0x3e')](manager['jobs']);var _0x37ff5a=_['map'](_0x169f52,function(_0x34e3f1){return _0x34e3f1['id'][_0x0c55('0x3f')]();});var _0x57abf6=_[_0x0c55('0x40')](_0x169f52,function(_0x71c947){return _0x71c947['id'][_0x0c55('0x3f')]();});var _0x253385=_0x5e7c46?_0x37ff5a:_[_0x0c55('0x41')](_0x37ff5a,_0x49a748);var _0x23b619=_[_0x0c55('0x42')](_0x37ff5a,_0x49a748);var _0x100395=_['difference'](_0x49a748,_0x37ff5a);var _0x2daec0;var _0x3fd471;for(_0x2daec0=0x0;_0x2daec0<_0x100395[_0x0c55('0x43')]&&!_0x5e7c46;_0x2daec0+=0x1){_0x3fd471=_0x100395[_0x2daec0][_0x0c55('0x3f')]();if(manager[_0x0c55('0x44')](_0x3fd471)){manager[_0x0c55('0x45')](_0x3fd471);manager[_0x0c55('0x46')](_0x3fd471);logger[_0x0c55('0xb')]('delete\x20cron',_0x3fd471);}}logger[_0x0c55('0xb')]('toRun',JSON[_0x0c55('0x28')](_0x253385));for(_0x2daec0=0x0;_0x2daec0<_0x253385[_0x0c55('0x43')];_0x2daec0+=0x1){_0x3fd471=_0x253385[_0x2daec0][_0x0c55('0x3f')]();logger[_0x0c55('0xb')](_0x0c55('0x47'),_0x3fd471);if(_0x5e7c46){logger[_0x0c55('0xb')](_0x0c55('0x48'),_0x5e7c46);logger['info'](JSON[_0x0c55('0x28')](_0x57abf6[_0x3fd471]));BPromise[_0x0c55('0x49')]()['then'](handleJob(_0x57abf6[_0x3fd471]));logger[_0x0c55('0xb')](_0x0c55('0x4a'),_0x57abf6[_0x3fd471][_0x0c55('0x18')],_0x57abf6[_0x3fd471][_0x0c55('0x4b')]);}else if(_0x57abf6[_0x3fd471][_0x0c55('0x4b')]&&_0x57abf6[_0x3fd471]['active']&&moment()[_0x0c55('0x4c')](_0x57abf6[_0x3fd471][_0x0c55('0x4d')],_0x57abf6[_0x3fd471][_0x0c55('0x4e')])){manager[_0x0c55('0x4f')](_0x3fd471,_0x57abf6[_0x3fd471][_0x0c55('0x4b')],handleJob(_0x57abf6[_0x3fd471]));manager[_0x0c55('0x50')](_0x3fd471);logger[_0x0c55('0xb')](_0x0c55('0x51'),_0x57abf6[_0x3fd471]['name'],_0x57abf6[_0x3fd471][_0x0c55('0x4b')]);}else if(manager[_0x0c55('0x44')](_0x3fd471)){manager[_0x0c55('0x45')](_0x3fd471);manager['deleteJob'](_0x3fd471);logger[_0x0c55('0xb')](_0x0c55('0x52'),_0x57abf6[_0x3fd471][_0x0c55('0x18')],_0x57abf6[_0x3fd471]['cron']);}}for(_0x2daec0=0x0,_0x3fd471;_0x2daec0<_0x23b619['length']&&!_0x5e7c46;_0x2daec0+=0x1){_0x3fd471=_0x23b619[_0x2daec0][_0x0c55('0x3f')]();if(manager[_0x0c55('0x44')](_0x3fd471)){if(_0x57abf6[_0x3fd471][_0x0c55('0x4b')]&&_0x57abf6[_0x3fd471][_0x0c55('0x53')]&&moment()[_0x0c55('0x4c')](_0x57abf6[_0x3fd471][_0x0c55('0x4d')],_0x57abf6[_0x3fd471][_0x0c55('0x4e')])){manager['update'](_0x3fd471,_0x57abf6[_0x3fd471][_0x0c55('0x4b')],handleJob(_0x57abf6[_0x3fd471]));logger[_0x0c55('0xb')](_0x0c55('0x54'),_0x57abf6[_0x3fd471][_0x0c55('0x18')],_0x57abf6[_0x3fd471][_0x0c55('0x4b')]);}else{manager['stop'](_0x3fd471);manager[_0x0c55('0x46')](_0x3fd471);logger[_0x0c55('0xb')](_0x0c55('0x52'),_0x57abf6[_0x3fd471][_0x0c55('0x18')],_0x57abf6[_0x3fd471]['cron']);}}}})[_0x0c55('0x2e')](function(_0x378a8b){logger[_0x0c55('0x2f')](JSON[_0x0c55('0x28')](_0x378a8b));});}exports[_0x0c55('0x55')]=function(_0x5d2282){return getJobs(_0x5d2282);};exports[_0x0c55('0x50')]=function(){setInterval(function(){return getJobs();},0x3c*0x3e8);return getJobs();}; \ No newline at end of file +var _0xd4fd=['endAt','add','add\x20cron','stop\x20cron','update','update\x20cron','run','util','path','lodash','moment','cron-job-manager','jayson/promise','bluebird','../logger','../../api/analyticDefaultReport/analyticDefaultReport.controller','client','http','email','MailAccount','Smtp','service','host','port','secure','authentication','auth','user','format','name','Report\x20%s\x20last\x20%s\x20%s','subtractNumber','join','../../files/reports','%s.%s','basename','savename','extname','zip','existsSync','status','Sent','message','attachments','Info\x20report:\x0a%s\x0aPlease\x20see\x20the\x20attachments\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20it.\x0a\x0a','stringify','text','Report\x20empty\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a','sendIfEmpty','info','empty\x20file,\x20email\x20not\x20sent','request','error','error\x20mail','catch','data','isNil','subtractUnit','subtractUnit\x20null\x20or\x20undefined','YYYY-MM-DD\x20HH:mm:ss','output','exec\x20defaul\x20report\x20id:%s','DefaultReportId','runReport','then','CustomReportId','exec\x20custom\x20report\x20id:%s','no\x20report\x20id','Schedule','findAll','MailServerOut','jobs','map','toString','keyBy','intersection','difference','length','exists','stop','deleteJob','delete\x20cron','index','my\x20id','resolve','run\x20job','cron','active','isBetween','startAt'];(function(_0x39c734,_0x2f3e06){var _0xb2a2f9=function(_0x502f3f){while(--_0x502f3f){_0x39c734['push'](_0x39c734['shift']());}};_0xb2a2f9(++_0x2f3e06);}(_0xd4fd,0x115));var _0xdd4f=function(_0x4a3e13,_0x24079d){_0x4a3e13=_0x4a3e13-0x0;var _0x54b398=_0xd4fd[_0x4a3e13];return _0x54b398;};'use strict';var fs=require('fs');var util=require(_0xdd4f('0x0'));var path=require(_0xdd4f('0x1'));var _=require(_0xdd4f('0x2'));var moment=require(_0xdd4f('0x3'));var CronJobManager=require(_0xdd4f('0x4'));var jayson=require(_0xdd4f('0x5'));var BPromise=require(_0xdd4f('0x6'));var logger=require(_0xdd4f('0x7'))('schedule');var db=require('../../mysqldb')['db'];var analyticCustomReportController=require('../../api/analyticCustomReport/analyticCustomReport.controller');var analyticDefaultReportController=require(_0xdd4f('0x8'));var client=jayson[_0xdd4f('0x9')][_0xdd4f('0xa')]({'port':0x232b});var manager=new CronJobManager();function handleSendEmail(_0xeaaf7,_0x17f26c){return function(){logger['info']('Try\x20to\x20send\x20a\x20mail\x20to',_0xeaaf7[_0xdd4f('0xb')]);var _0xa43da3=!![];var _0x45cf82={'tls':{'rejectUnauthorized':![]}};if(_0xeaaf7[_0xdd4f('0xc')][_0xdd4f('0xd')]['service']){_0x45cf82[_0xdd4f('0xe')]=_0xeaaf7[_0xdd4f('0xc')][_0xdd4f('0xd')][_0xdd4f('0xe')];}else{_0x45cf82[_0xdd4f('0xf')]=_0xeaaf7[_0xdd4f('0xc')]['Smtp']['host'];_0x45cf82[_0xdd4f('0x10')]=_0xeaaf7[_0xdd4f('0xc')][_0xdd4f('0xd')][_0xdd4f('0x10')];_0x45cf82[_0xdd4f('0x11')]=_0xeaaf7['MailAccount'][_0xdd4f('0xd')][_0xdd4f('0x11')];}if(_0xeaaf7[_0xdd4f('0xc')][_0xdd4f('0xd')][_0xdd4f('0x12')]){_0x45cf82[_0xdd4f('0x13')]={'user':_0xeaaf7[_0xdd4f('0xc')][_0xdd4f('0xd')][_0xdd4f('0x14')],'pass':_0xeaaf7['MailAccount']['Smtp']['pass']};}var _0x28be5d={'account':_0x45cf82,'message':{'from':util[_0xdd4f('0x15')]('\x22%s\x22\x20<%s>',_0xeaaf7[_0xdd4f('0xc')][_0xdd4f('0x16')],_0xeaaf7[_0xdd4f('0xc')][_0xdd4f('0xb')]||_0xeaaf7[_0xdd4f('0xc')][_0xdd4f('0xd')][_0xdd4f('0x14')]),'to':_0xeaaf7['email'],'cc':_0xeaaf7['cc'],'bcc':_0xeaaf7['bcc'],'subject':util['format'](_0xdd4f('0x17'),_0x17f26c[_0xdd4f('0x16')],_0xeaaf7[_0xdd4f('0x18')],_0xeaaf7['subtractUnit'])}};var _0x5d7449=path[_0xdd4f('0x19')](__dirname,_0xdd4f('0x1a'));var _0x3bf1d0=_0x17f26c['savename'];var _0x66de1a=util['format'](_0xdd4f('0x1b'),path[_0xdd4f('0x1c')](_0x17f26c[_0xdd4f('0x1d')],path[_0xdd4f('0x1e')](_0x17f26c['savename'])),_0xdd4f('0x1f'));var _0x4cd059=path[_0xdd4f('0x19')](_0x5d7449,_0x3bf1d0);var _0x5dcc83=path[_0xdd4f('0x19')](_0x5d7449,_0x66de1a);if(fs[_0xdd4f('0x20')](_0x4cd059)){_0x17f26c[_0xdd4f('0x21')]=_0xdd4f('0x22');_0x28be5d[_0xdd4f('0x23')][_0xdd4f('0x24')]=[{'filename':_0x3bf1d0,'path':_0x4cd059}];_0x28be5d['message']['text']=util[_0xdd4f('0x15')](_0xdd4f('0x25'),JSON[_0xdd4f('0x26')](_0x17f26c,null,0x2));}else if(fs['existsSync'](_0x5dcc83)){_0x17f26c['status']='Sent';_0x28be5d[_0xdd4f('0x23')][_0xdd4f('0x24')]=[{'filename':_0x66de1a,'path':_0x5dcc83}];}else{_0x28be5d[_0xdd4f('0x23')][_0xdd4f('0x27')]=_0xdd4f('0x28');if(!_0xeaaf7[_0xdd4f('0x29')]){_0xa43da3=![];logger[_0xdd4f('0x2a')](_0xdd4f('0x2b'));}}if(_0xa43da3){return client[_0xdd4f('0x2c')]('SendMail',_0x28be5d)['then'](function(_0x1727e2){if(_0x1727e2[_0xdd4f('0x2d')]){return logger['error'](_0xdd4f('0x2e'),JSON['stringify'](_0x1727e2));}return logger['info']('email\x20sent');})[_0xdd4f('0x2f')](function(_0x24fae6){return logger[_0xdd4f('0x2d')](_0xdd4f('0x2e'),JSON['stringify'](_0x24fae6));});}};}function handleError(){return function(_0x4554f2){return logger[_0xdd4f('0x2d')](JSON[_0xdd4f('0x26')](_0x4554f2));};}function handleResult(_0x297221){return function(_0x1fa598){logger[_0xdd4f('0x2a')](_0xdd4f('0x30'),JSON[_0xdd4f('0x26')](_0x1fa598));if(_0x297221[_0xdd4f('0xc')]&&_0x297221['MailAccount'][_0xdd4f('0xd')]&&!_[_0xdd4f('0x31')](_0x297221[_0xdd4f('0xb')])){setTimeout(handleSendEmail(_0x297221,_0x1fa598),0x3c*0x3e8);}};}function handleJob(_0x3904a1){return function(){try{if(_['isNil'](_0x3904a1['subtractNumber'])){return logger[_0xdd4f('0x2a')]('subtractNumber\x20null\x20or\x20undefined');}if(_[_0xdd4f('0x31')](_0x3904a1[_0xdd4f('0x32')])){return logger[_0xdd4f('0x2a')](_0xdd4f('0x33'));}var _0x4df04f={'startDate':moment()['subtract'](_0x3904a1[_0xdd4f('0x18')],_0x3904a1[_0xdd4f('0x32')])[_0xdd4f('0x15')](_0xdd4f('0x34')),'endDate':moment()[_0xdd4f('0x15')](_0xdd4f('0x34')),'type':'scheduled','output':_0x3904a1[_0xdd4f('0x35')],'name':_0x3904a1['name']};if(!_['isNil'](_0x3904a1['DefaultReportId'])){logger['info'](_0xdd4f('0x36'),_0x3904a1[_0xdd4f('0x37')]);return analyticDefaultReportController[_0xdd4f('0x38')]({'id':_0x3904a1[_0xdd4f('0x37')]},_0x4df04f)[_0xdd4f('0x39')](handleResult(_0x3904a1))['catch'](handleError());}if(!_[_0xdd4f('0x31')](_0x3904a1[_0xdd4f('0x3a')])){logger[_0xdd4f('0x2a')](_0xdd4f('0x3b'),_0x3904a1['CustomReportId']);return analyticCustomReportController[_0xdd4f('0x38')]({'id':_0x3904a1['CustomReportId']},_0x4df04f)[_0xdd4f('0x39')](handleResult(_0x3904a1))[_0xdd4f('0x2f')](handleError());}}catch(_0x39f71f){logger[_0xdd4f('0x2d')](JSON[_0xdd4f('0x26')](_0x39f71f));}return logger[_0xdd4f('0x2a')](_0xdd4f('0x3c'));};}function getJobs(_0x2b5f56){var _0x4f9d79={};if(_0x2b5f56){_0x4f9d79['id']=_0x2b5f56;}return db[_0xdd4f('0x3d')][_0xdd4f('0x3e')]({'where':_0x4f9d79,'include':[{'model':db['MailAccount'],'attributes':['id',_0xdd4f('0x16'),_0xdd4f('0xb')],'include':[{'model':db[_0xdd4f('0x3f')],'as':_0xdd4f('0xd')}]}]})[_0xdd4f('0x39')](function(_0x5ef05d){var _0x5a0e54=_['keys'](manager[_0xdd4f('0x40')]);var _0x2e782a=_[_0xdd4f('0x41')](_0x5ef05d,function(_0x24b251){return _0x24b251['id'][_0xdd4f('0x42')]();});var _0x3f2c4d=_[_0xdd4f('0x43')](_0x5ef05d,function(_0x1bf649){return _0x1bf649['id'][_0xdd4f('0x42')]();});var _0x1aa39d=_0x2b5f56?_0x2e782a:_['difference'](_0x2e782a,_0x5a0e54);var _0x53e0bd=_[_0xdd4f('0x44')](_0x2e782a,_0x5a0e54);var _0x3e35a0=_[_0xdd4f('0x45')](_0x5a0e54,_0x2e782a);var _0x3ac41a;var _0x35358e;for(_0x3ac41a=0x0;_0x3ac41a<_0x3e35a0[_0xdd4f('0x46')]&&!_0x2b5f56;_0x3ac41a+=0x1){_0x35358e=_0x3e35a0[_0x3ac41a]['toString']();if(manager[_0xdd4f('0x47')](_0x35358e)){manager[_0xdd4f('0x48')](_0x35358e);manager[_0xdd4f('0x49')](_0x35358e);logger[_0xdd4f('0x2a')](_0xdd4f('0x4a'),_0x35358e);}}logger[_0xdd4f('0x2a')]('toRun',JSON[_0xdd4f('0x26')](_0x1aa39d));for(_0x3ac41a=0x0;_0x3ac41a<_0x1aa39d[_0xdd4f('0x46')];_0x3ac41a+=0x1){_0x35358e=_0x1aa39d[_0x3ac41a][_0xdd4f('0x42')]();logger[_0xdd4f('0x2a')](_0xdd4f('0x4b'),_0x35358e);if(_0x2b5f56){logger[_0xdd4f('0x2a')](_0xdd4f('0x4c'),_0x2b5f56);logger['info'](JSON[_0xdd4f('0x26')](_0x3f2c4d[_0x35358e]));BPromise[_0xdd4f('0x4d')]()[_0xdd4f('0x39')](handleJob(_0x3f2c4d[_0x35358e]));logger[_0xdd4f('0x2a')](_0xdd4f('0x4e'),_0x3f2c4d[_0x35358e][_0xdd4f('0x16')],_0x3f2c4d[_0x35358e][_0xdd4f('0x4f')]);}else if(_0x3f2c4d[_0x35358e][_0xdd4f('0x4f')]&&_0x3f2c4d[_0x35358e][_0xdd4f('0x50')]&&moment()[_0xdd4f('0x51')](_0x3f2c4d[_0x35358e][_0xdd4f('0x52')],_0x3f2c4d[_0x35358e][_0xdd4f('0x53')])){manager[_0xdd4f('0x54')](_0x35358e,_0x3f2c4d[_0x35358e][_0xdd4f('0x4f')],handleJob(_0x3f2c4d[_0x35358e]));manager['start'](_0x35358e);logger['info'](_0xdd4f('0x55'),_0x3f2c4d[_0x35358e][_0xdd4f('0x16')],_0x3f2c4d[_0x35358e]['cron']);}else if(manager[_0xdd4f('0x47')](_0x35358e)){manager[_0xdd4f('0x48')](_0x35358e);manager['deleteJob'](_0x35358e);logger[_0xdd4f('0x2a')](_0xdd4f('0x56'),_0x3f2c4d[_0x35358e]['name'],_0x3f2c4d[_0x35358e][_0xdd4f('0x4f')]);}}for(_0x3ac41a=0x0,_0x35358e;_0x3ac41a<_0x53e0bd[_0xdd4f('0x46')]&&!_0x2b5f56;_0x3ac41a+=0x1){_0x35358e=_0x53e0bd[_0x3ac41a][_0xdd4f('0x42')]();if(manager['exists'](_0x35358e)){if(_0x3f2c4d[_0x35358e]['cron']&&_0x3f2c4d[_0x35358e][_0xdd4f('0x50')]&&moment()[_0xdd4f('0x51')](_0x3f2c4d[_0x35358e][_0xdd4f('0x52')],_0x3f2c4d[_0x35358e][_0xdd4f('0x53')])){manager[_0xdd4f('0x57')](_0x35358e,_0x3f2c4d[_0x35358e][_0xdd4f('0x4f')],handleJob(_0x3f2c4d[_0x35358e]));logger['info'](_0xdd4f('0x58'),_0x3f2c4d[_0x35358e][_0xdd4f('0x16')],_0x3f2c4d[_0x35358e][_0xdd4f('0x4f')]);}else{manager[_0xdd4f('0x48')](_0x35358e);manager[_0xdd4f('0x49')](_0x35358e);logger[_0xdd4f('0x2a')](_0xdd4f('0x56'),_0x3f2c4d[_0x35358e][_0xdd4f('0x16')],_0x3f2c4d[_0x35358e][_0xdd4f('0x4f')]);}}}})[_0xdd4f('0x2f')](function(_0x3fd070){logger['error'](JSON[_0xdd4f('0x26')](_0x3fd070));});}exports[_0xdd4f('0x59')]=function(_0x57055b){return getJobs(_0x57055b);};exports['start']=function(){setInterval(function(){return getJobs();},0x3c*0x3e8);return getJobs();}; \ No newline at end of file diff --git a/server/config/schedule/transcribe.js b/server/config/schedule/transcribe.js index 74034e8..ab38a84 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 _0x0a46=['results','transcripts','length','[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated','tempSentiment','Sentiment\x20Analysis\x20not\x20requested','sentimentAccountId','sentimentRegion','language','bucket','Sequelize','ValidationError','Sentiment\x20Analysis\x20not\x20configured','Transcript\x20not\x20available','CloudProvider','findOne','Cloud\x20Provider\x20not\x20available','[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis','[RECORDING:%d]\x20Sentiment\x20Analysis\x20available','update','Sentiment','SentimentScore','Positive','Mixed','Neutral','FAILED','FailureReason','[RECORDING:%d]\x20Transcript\x20Job\x20status\x20not\x20managed','resolve','sentiment','Cloud\x20Provider\x20not\x20configured','Negative','catch','name','SequelizeValidationError','inspect','VoiceRecording','IN_PROGRESS','Setting','Settings\x20not\x20available','transcribe','transcribeAccountId','transcribeRegion','Transcribe\x20not\x20configured','start','aws-sdk','util','../../mysqldb','../../config/logger','TranscribeService','getTranscriptionJob','detectSentiment','info','format','[RECORDING:%d]\x20Get\x20status\x20for\x20transcript\x20job\x20(%s)','transcribeName','data1','data2','then','fileText','TranscriptionJob','TranscriptionJobStatus','COMPLETED','Transcript','TranscriptFileUri','[RECORDING:%d]\x20Get\x20transcript'];(function(_0xb182c1,_0x293c93){var _0x43932d=function(_0x46d22f){while(--_0x46d22f){_0xb182c1['push'](_0xb182c1['shift']());}};_0x43932d(++_0x293c93);}(_0x0a46,0x177));var _0x60a4=function(_0x40248e,_0xbb7396){_0x40248e=_0x40248e-0x0;var _0x19b76=_0x0a46[_0x40248e];return _0x19b76;};var _=require('lodash');var AWS=require(_0x60a4('0x0'));var rp=require('request-promise');var util=require(_0x60a4('0x1'));var BPromise=require('bluebird');var db=require(_0x60a4('0x2'))['db'];var logger=require(_0x60a4('0x3'))('transcribe');function getTranscriptionJob(_0x116e0c,_0x2b5769,_0x3858cc,_0x5778dc){return new Promise(function(_0x4ec5c5,_0x36232b){var _0x51db14=new AWS[(_0x60a4('0x4'))]({'accessKeyId':_0x2b5769,'secretAccessKey':_0x116e0c,'region':_0x3858cc});_0x51db14[_0x60a4('0x5')]({'TranscriptionJobName':_0x5778dc},function(_0x4c030c,_0x477696){if(_0x4c030c){return _0x36232b(_0x4c030c);}else{return _0x4ec5c5(_0x477696);}});});}function sentiment(_0x424597,_0x97586e,_0x5d75e7,_0x365a92,_0x1e0057){return new Promise(function(_0x5d5536,_0x3d1669){var _0x211660=new AWS['Comprehend']({'accessKeyId':_0x97586e,'secretAccessKey':_0x424597,'region':_0x5d75e7});_0x211660[_0x60a4('0x6')]({'Text':_0x365a92,'LanguageCode':_0x1e0057['substring'](0x0,0x2)},function(_0x52efcc,_0x564381){if(_0x52efcc){return _0x3d1669(_0x52efcc);}else{return _0x5d5536(_0x564381);}});});}function checkTranscribeJob(_0x50b9a9,_0x1c12e5,_0x31a690){var _0x4e6a56;return new BPromise(function(_0x588a4e,_0xb7fd70){logger[_0x60a4('0x7')](util[_0x60a4('0x8')](_0x60a4('0x9'),_0x50b9a9['id'],_0x50b9a9[_0x60a4('0xa')]));return getTranscriptionJob(_0x31a690[_0x60a4('0xb')],_0x31a690[_0x60a4('0xc')],_0x1c12e5['transcribeRegion'],_0x50b9a9[_0x60a4('0xa')])[_0x60a4('0xd')](function(_0x4a7b00){logger[_0x60a4('0x7')](util[_0x60a4('0x8')]('[RECORDING:%d]\x20Status\x20of\x20transcript\x20job\x20(%s):\x20%s',_0x50b9a9['id'],_0x50b9a9[_0x60a4('0xa')],_0x4a7b00['TranscriptionJob']['TranscriptionJobStatus']));if(!_0x50b9a9[_0x60a4('0xe')]){switch(_0x4a7b00[_0x60a4('0xf')][_0x60a4('0x10')]){case _0x60a4('0x11'):var _0x524d45={'transcribeStatus':_0x4a7b00[_0x60a4('0xf')][_0x60a4('0x10')],'fileUri':_0x4a7b00[_0x60a4('0xf')][_0x60a4('0x12')][_0x60a4('0x13')]};logger[_0x60a4('0x7')](util[_0x60a4('0x8')](_0x60a4('0x14'),_0x50b9a9['id']));return rp({'uri':_0x4a7b00['TranscriptionJob']['Transcript']['TranscriptFileUri'],'json':!![]})['then'](function(_0x4dd76e){logger[_0x60a4('0x7')](util[_0x60a4('0x8')]('[RECORDING:%d]\x20Transcript\x20downloaded',_0x50b9a9['id']));if(_0x4dd76e&&_0x4dd76e[_0x60a4('0x15')]&&_0x4dd76e['results'][_0x60a4('0x16')]&&_0x4dd76e[_0x60a4('0x15')]['transcripts'][_0x60a4('0x17')]){_0x524d45[_0x60a4('0xe')]='';for(var _0x103151=0x0;_0x103151<_0x4dd76e['results']['transcripts']['length'];_0x103151++){_0x524d45[_0x60a4('0xe')]+=_0x4dd76e[_0x60a4('0x15')][_0x60a4('0x16')][_0x103151]['transcript']+'';}}return _0x50b9a9['update'](_0x524d45);})['then'](function(){logger[_0x60a4('0x7')](util[_0x60a4('0x8')](_0x60a4('0x18'),_0x50b9a9['id']));if(!_0x50b9a9[_0x60a4('0x19')]){throw new db['Sequelize']['ValidationError'](_0x60a4('0x1a'));}if(!_0x1c12e5['sentiment']||!_0x1c12e5[_0x60a4('0x1b')]||!_0x1c12e5[_0x60a4('0x1c')]||!_0x1c12e5[_0x60a4('0x1d')]||!_0x1c12e5[_0x60a4('0x1e')]){throw new db[(_0x60a4('0x1f'))][(_0x60a4('0x20'))](_0x60a4('0x21'));}if(!_0x524d45[_0x60a4('0xe')]){throw new Error(_0x60a4('0x22'));}if(_0x1c12e5['sentimentAccountId']===_0x31a690['id']){return _0x31a690;}else{return db[_0x60a4('0x23')][_0x60a4('0x24')]({'where':{'id':_settings[_0x60a4('0x1b')]}});}})[_0x60a4('0xd')](function(_0x1ef033){if(!_0x1ef033){throw new db[(_0x60a4('0x1f'))][(_0x60a4('0x20'))](_0x60a4('0x25'));}if(!_0x1ef033[_0x60a4('0xb')]||!_0x1ef033[_0x60a4('0xc')]){throw new db['Sequelize']['ValidationError']('Cloud\x20Provider\x20not\x20configured');}_0x4e6a56=_0x1ef033;logger[_0x60a4('0x7')](util[_0x60a4('0x8')](_0x60a4('0x26'),_0x50b9a9['id']));return sentiment(_0x4e6a56['data1'],_0x4e6a56['data2'],_0x1c12e5['sentimentRegion'],_0x524d45[_0x60a4('0xe')],_0x1c12e5[_0x60a4('0x1d')]);})['then'](function(_0x161b9c){logger[_0x60a4('0x7')](util[_0x60a4('0x8')](_0x60a4('0x27'),_0x50b9a9['id']));return _0x50b9a9[_0x60a4('0x28')]({'sentiment':_0x161b9c[_0x60a4('0x29')],'sPositive':_0x161b9c[_0x60a4('0x2a')][_0x60a4('0x2b')],'sNegative':_0x161b9c[_0x60a4('0x2a')]['Negative'],'sMixed':_0x161b9c['SentimentScore'][_0x60a4('0x2c')],'sNeutral':_0x161b9c['SentimentScore'][_0x60a4('0x2d')]});})['then'](function(){logger[_0x60a4('0x7')](util[_0x60a4('0x8')](_0x60a4('0x18'),_0x50b9a9['id']));_0x588a4e();});case _0x60a4('0x2e'):return _0x50b9a9['update']({'transcribeStatus':_0x60a4('0x2e'),'failureReason':_0x4a7b00['TranscriptionJob'][_0x60a4('0x2f')]})[_0x60a4('0xd')](function(){logger['info'](util['format'](_0x60a4('0x18'),_0x50b9a9['id']));_0x588a4e();});default:logger[_0x60a4('0x7')](util[_0x60a4('0x8')](_0x60a4('0x30'),_0x50b9a9['id']));break;}}else{return BPromise[_0x60a4('0x31')]()[_0x60a4('0xd')](function(){if(!_0x50b9a9['tempSentiment']){throw new db[(_0x60a4('0x1f'))][(_0x60a4('0x20'))](_0x60a4('0x1a'));}if(!_0x1c12e5[_0x60a4('0x32')]||!_0x1c12e5[_0x60a4('0x1b')]||!_0x1c12e5[_0x60a4('0x1c')]||!_0x1c12e5['language']||!_0x1c12e5['bucket']){throw new db[(_0x60a4('0x1f'))][(_0x60a4('0x20'))](_0x60a4('0x21'));}if(!_0x50b9a9[_0x60a4('0xe')]){throw new Error(_0x60a4('0x22'));}if(_0x1c12e5['sentimentAccountId']===_0x31a690['id']){return _0x31a690;}else{return db[_0x60a4('0x23')]['findOne']({'where':{'id':_settings[_0x60a4('0x1b')]}});}})[_0x60a4('0xd')](function(_0x120f7){if(!_0x120f7){throw new db[(_0x60a4('0x1f'))][(_0x60a4('0x20'))](_0x60a4('0x25'));}if(!_0x120f7['data1']||!_0x120f7['data2']){throw new db['Sequelize'][(_0x60a4('0x20'))](_0x60a4('0x33'));}_0x4e6a56=_0x120f7;logger[_0x60a4('0x7')](util['format'](_0x60a4('0x26'),_0x50b9a9['id']));return sentiment(_0x4e6a56[_0x60a4('0xb')],_0x4e6a56[_0x60a4('0xc')],_0x1c12e5[_0x60a4('0x1c')],_0x50b9a9[_0x60a4('0xe')],_0x1c12e5[_0x60a4('0x1d')]);})[_0x60a4('0xd')](function(_0x16bd23){logger['info'](util[_0x60a4('0x8')](_0x60a4('0x27'),_0x50b9a9['id']));return _0x50b9a9[_0x60a4('0x28')]({'sentiment':_0x16bd23[_0x60a4('0x29')],'sPositive':_0x16bd23[_0x60a4('0x2a')][_0x60a4('0x2b')],'sNegative':_0x16bd23[_0x60a4('0x2a')][_0x60a4('0x34')],'sMixed':_0x16bd23[_0x60a4('0x2a')][_0x60a4('0x2c')],'sNeutral':_0x16bd23[_0x60a4('0x2a')]['Neutral'],'transcribeStatus':_0x60a4('0x11')});})[_0x60a4('0xd')](function(){logger['info'](util[_0x60a4('0x8')](_0x60a4('0x18'),_0x50b9a9['id']));_0x588a4e();});}})[_0x60a4('0x35')](function(_0x364947){if(_0x364947){if(!_0x364947[_0x60a4('0x36')]||_0x364947['name']!==_0x60a4('0x37')){logger['error'](util[_0x60a4('0x8')]('[RECORDING:%d]\x20Error\x20running\x20Transcribe\x20&\x20Sentiment\x20Analysis',_0x50b9a9['id']),util[_0x60a4('0x38')](_0x364947,{'showHidden':![],'depth':null}));}}_0x588a4e();});});}function checkTranscribe(){var _0x3b06f2;var _0xa94d5a;var _0x18305d;return db[_0x60a4('0x39')]['findAll']({'where':{'transcribeStatus':_0x60a4('0x3a')}})[_0x60a4('0xd')](function(_0xf8d99b){if(!_0xf8d99b||!_0xf8d99b[_0x60a4('0x17')]){throw new db['Sequelize'][(_0x60a4('0x20'))]('No\x20transcribe\x20job\x20to\x20check');}_0x3b06f2=_0xf8d99b;return db[_0x60a4('0x3b')]['findOne']({'where':{'id':0x1}});})['then'](function(_0xae2aa0){if(!_0xae2aa0){throw new db['Sequelize']['ValidationError'](_0x60a4('0x3c'));}_0xa94d5a=_0xae2aa0;if(!_0xa94d5a[_0x60a4('0x3d')]||!_0xa94d5a[_0x60a4('0x3e')]||!_0xa94d5a[_0x60a4('0x3f')]||!_0xa94d5a[_0x60a4('0x1d')]||!_0xa94d5a[_0x60a4('0x1e')]){throw new db[(_0x60a4('0x1f'))][(_0x60a4('0x20'))](_0x60a4('0x40'));}return db[_0x60a4('0x23')][_0x60a4('0x24')]({'where':{'id':_0xa94d5a[_0x60a4('0x3e')]}});})[_0x60a4('0xd')](function(_0x20abad){if(!_0x20abad){throw new db[(_0x60a4('0x1f'))][(_0x60a4('0x20'))](_0x60a4('0x25'));}if(!_0x20abad[_0x60a4('0xb')]||!_0x20abad[_0x60a4('0xc')]){throw new db[(_0x60a4('0x1f'))]['ValidationError'](_0x60a4('0x33'));}_0x18305d=_0x20abad;var _0x4c29d8=[];_0x3b06f2['forEach'](function(_0xa56946){_0x4c29d8['push'](checkTranscribeJob(_0xa56946,_0xa94d5a,_0x18305d));});return BPromise['all'](_0x4c29d8);})[_0x60a4('0x35')](function(_0x4a2902){if(_0x4a2902){if(!_0x4a2902[_0x60a4('0x36')]||_0x4a2902[_0x60a4('0x36')]!==_0x60a4('0x37')){logger['error'](util[_0x60a4('0x38')](_0x4a2902,{'showHidden':![],'depth':null}));}}});}exports[_0x60a4('0x41')]=function(){setInterval(function(){return checkTranscribe();},0x3c*0x3e8);return checkTranscribe();}; \ No newline at end of file +var _0x16bd=['inspect','VoiceRecording','findAll','IN_PROGRESS','length','No\x20transcribe\x20job\x20to\x20check','Settings\x20not\x20available','transcribeAccountId','Transcribe\x20not\x20configured','forEach','push','all','request-promise','util','../../config/logger','transcribe','TranscribeService','Comprehend','detectSentiment','substring','format','[RECORDING:%d]\x20Get\x20status\x20for\x20transcript\x20job\x20(%s)','data1','data2','transcribeRegion','transcribeName','then','info','[RECORDING:%d]\x20Status\x20of\x20transcript\x20job\x20(%s):\x20%s','TranscriptionJob','TranscriptionJobStatus','fileText','Transcript','TranscriptFileUri','[RECORDING:%d]\x20Transcript\x20downloaded','results','transcripts','transcript','Sequelize','ValidationError','Sentiment\x20Analysis\x20not\x20requested','sentiment','sentimentAccountId','sentimentRegion','language','bucket','Sentiment\x20Analysis\x20not\x20configured','Transcript\x20not\x20available','CloudProvider','findOne','[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis','update','Positive','SentimentScore','Negative','Mixed','Neutral','[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated','FAILED','resolve','tempSentiment','Cloud\x20Provider\x20not\x20available','Cloud\x20Provider\x20not\x20configured','Sentiment','COMPLETED','catch','name','SequelizeValidationError','error','[RECORDING:%d]\x20Error\x20running\x20Transcribe\x20&\x20Sentiment\x20Analysis'];(function(_0x424ebf,_0x4c64d3){var _0x4c6aef=function(_0x3e17eb){while(--_0x3e17eb){_0x424ebf['push'](_0x424ebf['shift']());}};_0x4c6aef(++_0x4c64d3);}(_0x16bd,0x16a));var _0xd16b=function(_0x11b1b3,_0xf3cc69){_0x11b1b3=_0x11b1b3-0x0;var _0x437029=_0x16bd[_0x11b1b3];return _0x437029;};var _=require('lodash');var AWS=require('aws-sdk');var rp=require(_0xd16b('0x0'));var util=require(_0xd16b('0x1'));var BPromise=require('bluebird');var db=require('../../mysqldb')['db'];var logger=require(_0xd16b('0x2'))(_0xd16b('0x3'));function getTranscriptionJob(_0x68b591,_0x2b1f1b,_0x2f6163,_0x584e95){return new Promise(function(_0x2fafa5,_0x4ccb64){var _0x3cf684=new AWS[(_0xd16b('0x4'))]({'accessKeyId':_0x2b1f1b,'secretAccessKey':_0x68b591,'region':_0x2f6163});_0x3cf684['getTranscriptionJob']({'TranscriptionJobName':_0x584e95},function(_0x16e77e,_0x386c0e){if(_0x16e77e){return _0x4ccb64(_0x16e77e);}else{return _0x2fafa5(_0x386c0e);}});});}function sentiment(_0x33f52a,_0x46add8,_0xf382ae,_0x510104,_0x8df5c7){return new Promise(function(_0x329891,_0x43cfbc){var _0x376914=new AWS[(_0xd16b('0x5'))]({'accessKeyId':_0x46add8,'secretAccessKey':_0x33f52a,'region':_0xf382ae});_0x376914[_0xd16b('0x6')]({'Text':_0x510104,'LanguageCode':_0x8df5c7[_0xd16b('0x7')](0x0,0x2)},function(_0x495e3e,_0x4dc990){if(_0x495e3e){return _0x43cfbc(_0x495e3e);}else{return _0x329891(_0x4dc990);}});});}function checkTranscribeJob(_0x1962d2,_0x2fd3f6,_0x1182d4){var _0x449955;return new BPromise(function(_0x4fef4b,_0x2469eb){logger['info'](util[_0xd16b('0x8')](_0xd16b('0x9'),_0x1962d2['id'],_0x1962d2['transcribeName']));return getTranscriptionJob(_0x1182d4[_0xd16b('0xa')],_0x1182d4[_0xd16b('0xb')],_0x2fd3f6[_0xd16b('0xc')],_0x1962d2[_0xd16b('0xd')])[_0xd16b('0xe')](function(_0x28a37c){logger[_0xd16b('0xf')](util['format'](_0xd16b('0x10'),_0x1962d2['id'],_0x1962d2['transcribeName'],_0x28a37c[_0xd16b('0x11')][_0xd16b('0x12')]));if(!_0x1962d2[_0xd16b('0x13')]){switch(_0x28a37c['TranscriptionJob'][_0xd16b('0x12')]){case'COMPLETED':var _0x1d06e9={'transcribeStatus':_0x28a37c['TranscriptionJob'][_0xd16b('0x12')],'fileUri':_0x28a37c['TranscriptionJob'][_0xd16b('0x14')][_0xd16b('0x15')]};logger[_0xd16b('0xf')](util[_0xd16b('0x8')]('[RECORDING:%d]\x20Get\x20transcript',_0x1962d2['id']));return rp({'uri':_0x28a37c[_0xd16b('0x11')]['Transcript'][_0xd16b('0x15')],'json':!![]})[_0xd16b('0xe')](function(_0x529325){logger[_0xd16b('0xf')](util[_0xd16b('0x8')](_0xd16b('0x16'),_0x1962d2['id']));if(_0x529325&&_0x529325[_0xd16b('0x17')]&&_0x529325['results'][_0xd16b('0x18')]&&_0x529325[_0xd16b('0x17')]['transcripts']['length']){_0x1d06e9[_0xd16b('0x13')]='';for(var _0x428d41=0x0;_0x428d41<_0x529325[_0xd16b('0x17')][_0xd16b('0x18')]['length'];_0x428d41++){_0x1d06e9[_0xd16b('0x13')]+=_0x529325['results'][_0xd16b('0x18')][_0x428d41][_0xd16b('0x19')]+'';}}return _0x1962d2['update'](_0x1d06e9);})[_0xd16b('0xe')](function(){logger[_0xd16b('0xf')](util[_0xd16b('0x8')]('[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated',_0x1962d2['id']));if(!_0x1962d2['tempSentiment']){throw new db[(_0xd16b('0x1a'))][(_0xd16b('0x1b'))](_0xd16b('0x1c'));}if(!_0x2fd3f6[_0xd16b('0x1d')]||!_0x2fd3f6[_0xd16b('0x1e')]||!_0x2fd3f6[_0xd16b('0x1f')]||!_0x2fd3f6[_0xd16b('0x20')]||!_0x2fd3f6[_0xd16b('0x21')]){throw new db[(_0xd16b('0x1a'))][(_0xd16b('0x1b'))](_0xd16b('0x22'));}if(!_0x1d06e9[_0xd16b('0x13')]){throw new Error(_0xd16b('0x23'));}if(_0x2fd3f6[_0xd16b('0x1e')]===_0x1182d4['id']){return _0x1182d4;}else{return db[_0xd16b('0x24')][_0xd16b('0x25')]({'where':{'id':_settings[_0xd16b('0x1e')]}});}})[_0xd16b('0xe')](function(_0x4ed516){if(!_0x4ed516){throw new db[(_0xd16b('0x1a'))][(_0xd16b('0x1b'))]('Cloud\x20Provider\x20not\x20available');}if(!_0x4ed516[_0xd16b('0xa')]||!_0x4ed516[_0xd16b('0xb')]){throw new db[(_0xd16b('0x1a'))][(_0xd16b('0x1b'))]('Cloud\x20Provider\x20not\x20configured');}_0x449955=_0x4ed516;logger[_0xd16b('0xf')](util[_0xd16b('0x8')](_0xd16b('0x26'),_0x1962d2['id']));return sentiment(_0x449955[_0xd16b('0xa')],_0x449955[_0xd16b('0xb')],_0x2fd3f6[_0xd16b('0x1f')],_0x1d06e9[_0xd16b('0x13')],_0x2fd3f6[_0xd16b('0x20')]);})[_0xd16b('0xe')](function(_0x286192){logger[_0xd16b('0xf')](util[_0xd16b('0x8')]('[RECORDING:%d]\x20Sentiment\x20Analysis\x20available',_0x1962d2['id']));return _0x1962d2[_0xd16b('0x27')]({'sentiment':_0x286192['Sentiment'],'sPositive':_0x286192['SentimentScore'][_0xd16b('0x28')],'sNegative':_0x286192[_0xd16b('0x29')][_0xd16b('0x2a')],'sMixed':_0x286192[_0xd16b('0x29')][_0xd16b('0x2b')],'sNeutral':_0x286192[_0xd16b('0x29')][_0xd16b('0x2c')]});})[_0xd16b('0xe')](function(){logger[_0xd16b('0xf')](util[_0xd16b('0x8')](_0xd16b('0x2d'),_0x1962d2['id']));_0x4fef4b();});case _0xd16b('0x2e'):return _0x1962d2[_0xd16b('0x27')]({'transcribeStatus':'FAILED','failureReason':_0x28a37c[_0xd16b('0x11')]['FailureReason']})[_0xd16b('0xe')](function(){logger[_0xd16b('0xf')](util['format'](_0xd16b('0x2d'),_0x1962d2['id']));_0x4fef4b();});default:logger[_0xd16b('0xf')](util[_0xd16b('0x8')]('[RECORDING:%d]\x20Transcript\x20Job\x20status\x20not\x20managed',_0x1962d2['id']));break;}}else{return BPromise[_0xd16b('0x2f')]()[_0xd16b('0xe')](function(){if(!_0x1962d2[_0xd16b('0x30')]){throw new db[(_0xd16b('0x1a'))][(_0xd16b('0x1b'))]('Sentiment\x20Analysis\x20not\x20requested');}if(!_0x2fd3f6[_0xd16b('0x1d')]||!_0x2fd3f6['sentimentAccountId']||!_0x2fd3f6['sentimentRegion']||!_0x2fd3f6['language']||!_0x2fd3f6[_0xd16b('0x21')]){throw new db[(_0xd16b('0x1a'))][(_0xd16b('0x1b'))](_0xd16b('0x22'));}if(!_0x1962d2['fileText']){throw new Error(_0xd16b('0x23'));}if(_0x2fd3f6['sentimentAccountId']===_0x1182d4['id']){return _0x1182d4;}else{return db[_0xd16b('0x24')][_0xd16b('0x25')]({'where':{'id':_settings[_0xd16b('0x1e')]}});}})['then'](function(_0x267ed4){if(!_0x267ed4){throw new db['Sequelize'][(_0xd16b('0x1b'))](_0xd16b('0x31'));}if(!_0x267ed4[_0xd16b('0xa')]||!_0x267ed4['data2']){throw new db[(_0xd16b('0x1a'))][(_0xd16b('0x1b'))](_0xd16b('0x32'));}_0x449955=_0x267ed4;logger[_0xd16b('0xf')](util[_0xd16b('0x8')]('[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis',_0x1962d2['id']));return sentiment(_0x449955[_0xd16b('0xa')],_0x449955[_0xd16b('0xb')],_0x2fd3f6[_0xd16b('0x1f')],_0x1962d2[_0xd16b('0x13')],_0x2fd3f6[_0xd16b('0x20')]);})[_0xd16b('0xe')](function(_0x52240c){logger['info'](util['format']('[RECORDING:%d]\x20Sentiment\x20Analysis\x20available',_0x1962d2['id']));return _0x1962d2[_0xd16b('0x27')]({'sentiment':_0x52240c[_0xd16b('0x33')],'sPositive':_0x52240c[_0xd16b('0x29')][_0xd16b('0x28')],'sNegative':_0x52240c[_0xd16b('0x29')][_0xd16b('0x2a')],'sMixed':_0x52240c['SentimentScore'][_0xd16b('0x2b')],'sNeutral':_0x52240c[_0xd16b('0x29')][_0xd16b('0x2c')],'transcribeStatus':_0xd16b('0x34')});})[_0xd16b('0xe')](function(){logger[_0xd16b('0xf')](util[_0xd16b('0x8')](_0xd16b('0x2d'),_0x1962d2['id']));_0x4fef4b();});}})[_0xd16b('0x35')](function(_0x52c728){if(_0x52c728){if(!_0x52c728[_0xd16b('0x36')]||_0x52c728['name']!==_0xd16b('0x37')){logger[_0xd16b('0x38')](util[_0xd16b('0x8')](_0xd16b('0x39'),_0x1962d2['id']),util[_0xd16b('0x3a')](_0x52c728,{'showHidden':![],'depth':null}));}}_0x4fef4b();});});}function checkTranscribe(){var _0x49a375;var _0x1c6728;var _0x56c5f0;return db[_0xd16b('0x3b')][_0xd16b('0x3c')]({'where':{'transcribeStatus':_0xd16b('0x3d')}})[_0xd16b('0xe')](function(_0x2e72d4){if(!_0x2e72d4||!_0x2e72d4[_0xd16b('0x3e')]){throw new db[(_0xd16b('0x1a'))][(_0xd16b('0x1b'))](_0xd16b('0x3f'));}_0x49a375=_0x2e72d4;return db['Setting'][_0xd16b('0x25')]({'where':{'id':0x1}});})['then'](function(_0x245b8c){if(!_0x245b8c){throw new db['Sequelize'][(_0xd16b('0x1b'))](_0xd16b('0x40'));}_0x1c6728=_0x245b8c;if(!_0x1c6728[_0xd16b('0x3')]||!_0x1c6728[_0xd16b('0x41')]||!_0x1c6728[_0xd16b('0xc')]||!_0x1c6728[_0xd16b('0x20')]||!_0x1c6728['bucket']){throw new db['Sequelize'][(_0xd16b('0x1b'))](_0xd16b('0x42'));}return db[_0xd16b('0x24')][_0xd16b('0x25')]({'where':{'id':_0x1c6728[_0xd16b('0x41')]}});})[_0xd16b('0xe')](function(_0x528297){if(!_0x528297){throw new db[(_0xd16b('0x1a'))][(_0xd16b('0x1b'))](_0xd16b('0x31'));}if(!_0x528297['data1']||!_0x528297[_0xd16b('0xb')]){throw new db['Sequelize']['ValidationError'](_0xd16b('0x32'));}_0x56c5f0=_0x528297;var _0x3cc4ef=[];_0x49a375[_0xd16b('0x43')](function(_0x4ece6a){_0x3cc4ef[_0xd16b('0x44')](checkTranscribeJob(_0x4ece6a,_0x1c6728,_0x56c5f0));});return BPromise[_0xd16b('0x45')](_0x3cc4ef);})[_0xd16b('0x35')](function(_0x5a7f6d){if(_0x5a7f6d){if(!_0x5a7f6d[_0xd16b('0x36')]||_0x5a7f6d['name']!==_0xd16b('0x37')){logger[_0xd16b('0x38')](util['inspect'](_0x5a7f6d,{'showHidden':![],'depth':null}));}}});}exports['start']=function(){setInterval(function(){return checkTranscribe();},0x3c*0x3e8);return checkTranscribe();}; \ No newline at end of file diff --git a/server/config/seedContact.js b/server/config/seedContact.js index 3732726..2da2734 100644 --- a/server/config/seedContact.js +++ b/server/config/seedContact.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe87a=['finished\x20populating','contacts1','CmHopper','hopper1','hopper2','util','../mysqldb','push','Innocenzo','Biondo','innocenzo.biondo','@xcally.com','now','destroy','then','CmContact','bulkCreate','log'];(function(_0xdd9511,_0x365c33){var _0x36f266=function(_0x126cf6){while(--_0x126cf6){_0xdd9511['push'](_0xdd9511['shift']());}};_0x36f266(++_0x365c33);}(_0xe87a,0x15b));var _0xae87=function(_0x174ac2,_0xe1253){_0x174ac2=_0x174ac2-0x0;var _0x58a9a0=_0xe87a[_0x174ac2];return _0x58a9a0;};'use strict';var util=require(_0xae87('0x0'));var db=require(_0xae87('0x1'))['db'];var contacts=[];var hopper=[];var contacts2=[];var hopper2=[];for(var i=0x1;i<=0x4b0;i+=0x1){contacts[_0xae87('0x2')]({'id':i,'firstName':_0xae87('0x3')+i,'lastName':_0xae87('0x4')+i,'phone':0xf879fb460+i,'email':_0xae87('0x5')+i+_0xae87('0x6')});}for(var i=0x1;i<=0x4b0;i+=0x1){hopper[_0xae87('0x2')]({'id':i,'active':![],'scheduledat':Date[_0xae87('0x7')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0xae87('0x7')](),'updatedAt':Date[_0xae87('0x7')]()});}for(var i=0x4b1;i<=0x960;i+=0x1){contacts2['push']({'id':i,'firstName':'Innocenzo'+i,'lastName':_0xae87('0x4')+i,'phone':0xf879fb460+i,'email':_0xae87('0x5')+i+'@xcally.com'});}for(var i=0x4b1;i<=0x960;i+=0x1){hopper2['push']({'id':i,'active':![],'scheduledat':Date[_0xae87('0x7')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date['now'](),'updatedAt':Date[_0xae87('0x7')]()});}db['CmContact'][_0xae87('0x8')]({'where':{}})[_0xae87('0x9')](function(){return db[_0xae87('0xa')][_0xae87('0xb')](contacts);})[_0xae87('0x9')](function(){console[_0xae87('0xc')](_0xae87('0xd'),_0xae87('0xe'));return db[_0xae87('0xf')][_0xae87('0x8')]({'where':{}});})['then'](function(){return db[_0xae87('0xf')]['bulkCreate'](hopper);})['then'](function(){console[_0xae87('0xc')](_0xae87('0xd'),_0xae87('0x10'));return db[_0xae87('0xa')][_0xae87('0xb')](contacts2);})[_0xae87('0x9')](function(){console[_0xae87('0xc')](_0xae87('0xd'),'contacts2');return db[_0xae87('0xf')][_0xae87('0xb')](hopper2);})[_0xae87('0x9')](function(){console['log'](_0xae87('0xd'),_0xae87('0x11'));})['catch'](function(_0x40e18a){console[_0xae87('0xc')](_0x40e18a);}); \ No newline at end of file +var _0x9901=['bulkCreate','log','contacts1','CmHopper','destroy','finished\x20populating','contacts2','hopper2','catch','util','../mysqldb','Innocenzo','Biondo','push','innocenzo.biondo','@xcally.com','now','then','CmContact'];(function(_0x10e568,_0x4cdd92){var _0x2257de=function(_0x55ccc4){while(--_0x55ccc4){_0x10e568['push'](_0x10e568['shift']());}};_0x2257de(++_0x4cdd92);}(_0x9901,0x1d1));var _0x1990=function(_0x2c34ff,_0x1e8bee){_0x2c34ff=_0x2c34ff-0x0;var _0x476508=_0x9901[_0x2c34ff];return _0x476508;};'use strict';var util=require(_0x1990('0x0'));var db=require(_0x1990('0x1'))['db'];var contacts=[];var hopper=[];var contacts2=[];var hopper2=[];for(var i=0x1;i<=0x4b0;i+=0x1){contacts['push']({'id':i,'firstName':_0x1990('0x2')+i,'lastName':_0x1990('0x3')+i,'phone':0xf879fb460+i,'email':'innocenzo.biondo'+i+'@xcally.com'});}for(var i=0x1;i<=0x4b0;i+=0x1){hopper[_0x1990('0x4')]({'id':i,'active':![],'scheduledat':Date['now'](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date['now'](),'updatedAt':Date['now']()});}for(var i=0x4b1;i<=0x960;i+=0x1){contacts2[_0x1990('0x4')]({'id':i,'firstName':_0x1990('0x2')+i,'lastName':_0x1990('0x3')+i,'phone':0xf879fb460+i,'email':_0x1990('0x5')+i+_0x1990('0x6')});}for(var i=0x4b1;i<=0x960;i+=0x1){hopper2['push']({'id':i,'active':![],'scheduledat':Date[_0x1990('0x7')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0x1990('0x7')](),'updatedAt':Date[_0x1990('0x7')]()});}db['CmContact']['destroy']({'where':{}})[_0x1990('0x8')](function(){return db[_0x1990('0x9')][_0x1990('0xa')](contacts);})[_0x1990('0x8')](function(){console[_0x1990('0xb')]('finished\x20populating',_0x1990('0xc'));return db[_0x1990('0xd')][_0x1990('0xe')]({'where':{}});})['then'](function(){return db[_0x1990('0xd')][_0x1990('0xa')](hopper);})[_0x1990('0x8')](function(){console[_0x1990('0xb')](_0x1990('0xf'),'hopper1');return db[_0x1990('0x9')]['bulkCreate'](contacts2);})[_0x1990('0x8')](function(){console[_0x1990('0xb')](_0x1990('0xf'),_0x1990('0x10'));return db[_0x1990('0xd')][_0x1990('0xa')](hopper2);})[_0x1990('0x8')](function(){console[_0x1990('0xb')]('finished\x20populating',_0x1990('0x11'));})[_0x1990('0x12')](function(_0x1c25fb){console[_0x1990('0xb')](_0x1c25fb);}); \ No newline at end of file diff --git a/server/config/seedUsers.js b/server/config/seedUsers.js index fcd6bd0..1a68a8d 100644 --- a/server/config/seedUsers.js +++ b/server/config/seedUsers.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa951=['all','ulaw','yes','actpass','User','then','log','add\x20user','catch','util','../mysqldb','push','agent','format','%s%s','%s%s@xcally.com','password','friend','udp','wss'];(function(_0x3c57ef,_0x1d1b77){var _0x32fd64=function(_0x550361){while(--_0x550361){_0x3c57ef['push'](_0x3c57ef['shift']());}};_0x32fd64(++_0x1d1b77);}(_0xa951,0xf9));var _0x1a95=function(_0x42db5a,_0x27d793){_0x42db5a=_0x42db5a-0x0;var _0x5ba992=_0xa951[_0x42db5a];return _0x5ba992;};'use strict';var util=require(_0x1a95('0x0'));var db=require(_0x1a95('0x1'))['db'];var users=[];for(var i=0x1;i<=0xc8;i+=0x1){users[_0x1a95('0x2')]({'name':util['format']('%s%s',_0x1a95('0x3'),i),'fullname':util[_0x1a95('0x4')](_0x1a95('0x5'),'agent',i),'email':util[_0x1a95('0x4')](_0x1a95('0x6'),'agent',i),'role':_0x1a95('0x3'),'password':_0x1a95('0x7'),'internal':0xfa0+i,'type':_0x1a95('0x8'),'transport':[_0x1a95('0x9'),'ws',_0x1a95('0xa')],'disallow':[_0x1a95('0xb')],'allow':[_0x1a95('0xc')],'defaultuser':util['format'](_0x1a95('0x5'),_0x1a95('0x3'),i),'encryption':'yes','avpf':_0x1a95('0xd'),'force_avp':_0x1a95('0xd'),'icesupport':'yes','dtlsenable':_0x1a95('0xd'),'dtlsverify':'no','dtlscertfile':'/etc/pki/tls/certs/motion.crt','dtlsprivatekey':'/etc/pki/tls/private/motion.key','dtlssetup':_0x1a95('0xe'),'callerid':util[_0x1a95('0x4')]('\x22%s\x22\x20<%s>',util[_0x1a95('0x4')](_0x1a95('0x5'),_0x1a95('0x3'),i),0xfa0+i)});}db[_0x1a95('0xf')]['bulkCreate'](users)[_0x1a95('0x10')](function(){console[_0x1a95('0x11')](_0x1a95('0x12'));})[_0x1a95('0x13')](function(_0x3ae659){console[_0x1a95('0x11')](_0x3ae659);}); \ No newline at end of file +var _0x8981=['format','%s%s@xcally.com','password','udp','yes','/etc/pki/tls/certs/motion.crt','/etc/pki/tls/private/motion.key','\x22%s\x22\x20<%s>','User','bulkCreate','then','log','add\x20user','util','../mysqldb','push','%s%s','agent'];(function(_0x108cd1,_0xbfd7ff){var _0x2d205f=function(_0xce8f31){while(--_0xce8f31){_0x108cd1['push'](_0x108cd1['shift']());}};_0x2d205f(++_0xbfd7ff);}(_0x8981,0x79));var _0x1898=function(_0x61445a,_0x3ad70b){_0x61445a=_0x61445a-0x0;var _0x227eec=_0x8981[_0x61445a];return _0x227eec;};'use strict';var util=require(_0x1898('0x0'));var db=require(_0x1898('0x1'))['db'];var users=[];for(var i=0x1;i<=0xc8;i+=0x1){users[_0x1898('0x2')]({'name':util['format'](_0x1898('0x3'),_0x1898('0x4'),i),'fullname':util[_0x1898('0x5')]('%s%s',_0x1898('0x4'),i),'email':util[_0x1898('0x5')](_0x1898('0x6'),_0x1898('0x4'),i),'role':_0x1898('0x4'),'password':_0x1898('0x7'),'internal':0xfa0+i,'type':'friend','transport':[_0x1898('0x8'),'ws','wss'],'disallow':['all'],'allow':['ulaw'],'defaultuser':util[_0x1898('0x5')](_0x1898('0x3'),'agent',i),'encryption':_0x1898('0x9'),'avpf':_0x1898('0x9'),'force_avp':'yes','icesupport':_0x1898('0x9'),'dtlsenable':'yes','dtlsverify':'no','dtlscertfile':_0x1898('0xa'),'dtlsprivatekey':_0x1898('0xb'),'dtlssetup':'actpass','callerid':util[_0x1898('0x5')](_0x1898('0xc'),util[_0x1898('0x5')](_0x1898('0x3'),_0x1898('0x4'),i),0xfa0+i)});}db[_0x1898('0xd')][_0x1898('0xe')](users)[_0x1898('0xf')](function(){console[_0x1898('0x10')](_0x1898('0x11'));})['catch'](function(_0xfdfe66){console[_0x1898('0x10')](_0xfdfe66);}); \ No newline at end of file diff --git a/server/config/socketio.js b/server/config/socketio.js index d5f295e..54a6b06 100644 --- a/server/config/socketio.js +++ b/server/config/socketio.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4ce6=['hasOwnProperty','include','push','ChatQueue','FaxQueue','SmsQueue','OpenchannelQueue','WhatsappQueue','Trunk','user','VoiceQueues','userProfileId','VoiceQueue','SmsQueues','MailQueue','Campaign','getVoiceQueues','getFaxQueues','getSmsQueues','all','length','voice','chat','sms','mail','openchannel','whatsapp','telephone:%s','trunk:%s','campaign:%s:%s','leave','removeChatInteractions','user_has_chat_interactions:remove','removeMailInteractions','removeFaxInteractions','emit','user_has_fax_interactions:remove','removeSmsInteractions','user_has_sms_interactions:remove','user_has_openchannel_interactions:remove','catch','log','join','setMaxListeners','address','request','connection','remotePort','connectedAt','SocketIO\x20','nsp','disconnect','lodash','util','bluebird','../mysqldb','./environment','Agents','name','role','agent','telephone','type','ivr','UserProfileSection','findOne','autoAssociation','ChatQueues','FaxQueues','MailQueues','OpenchannelQueues','WhatsappQueues','findAll','Trunks','IvrCampaigns','UserProfileResource','resourceId','map','User','where','then','format','handshake','query','find','ChatInteraction','ChatInteractions','MailInteractions','FaxInteractions','SmsInteraction','SmsInteractions','OpenchannelInteractions','WhatsappInteraction','WhatsappInteractions','user:%s','admin','voice:inbound','voice:outbound'];(function(_0x313a89,_0xafa484){var _0x3cf3bf=function(_0x215908){while(--_0x215908){_0x313a89['push'](_0x313a89['shift']());}};_0x3cf3bf(++_0xafa484);}(_0x4ce6,0x15a));var _0x64ce=function(_0x245afe,_0x319cde){_0x245afe=_0x245afe-0x0;var _0x4eefde=_0x4ce6[_0x245afe];return _0x4eefde;};'use strict';var _=require(_0x64ce('0x0'));var util=require(_0x64ce('0x1'));var BPromise=require(_0x64ce('0x2'));var db=require(_0x64ce('0x3'))['db'];var config=require(_0x64ce('0x4'));var queryQueues={'attributes':['id','name'],'include':[{'as':_0x64ce('0x5'),'model':db['User'],'attributes':['id',_0x64ce('0x6'),_0x64ce('0x7')],'raw':!![],'where':{'role':_0x64ce('0x8')},'required':![]}]};var queryTelephones={'raw':!![],'attributes':['id',_0x64ce('0x6')],'where':{'role':_0x64ce('0x9')}};var queryTrunks={'raw':!![],'attributes':['id','name']};var queryAgents={'raw':!![],'attributes':['id',_0x64ce('0x6')],'where':{'role':'agent'}};var queryCampaigns={'raw':!![],'attributes':['id',_0x64ce('0x6'),_0x64ce('0xa')],'where':{'type':_0x64ce('0xb')}};function getAssociatedResources(_0x363a00,_0x54caed,_0x58baf6){return db[_0x64ce('0xc')][_0x64ce('0xd')]({'where':{'name':_0x363a00,'userProfileId':_0x54caed},'raw':!![]})['then'](function(_0x2f956f){if(_0x2f956f){if(_0x2f956f[_0x64ce('0xe')]){switch(_0x363a00){case'VoiceQueues':case _0x64ce('0xf'):case _0x64ce('0x10'):case'SmsQueues':case _0x64ce('0x11'):case _0x64ce('0x12'):case _0x64ce('0x13'):return db[_0x58baf6]['findAll'](queryQueues);case'Telephones':return db[_0x58baf6][_0x64ce('0x14')](queryTelephones);case _0x64ce('0x15'):return db[_0x58baf6][_0x64ce('0x14')](queryTrunks);case _0x64ce('0x16'):return db[_0x58baf6][_0x64ce('0x14')](queryCampaigns);}}else{return db[_0x64ce('0x17')]['findAll']({'attributes':[_0x64ce('0x18')],'where':{'sectionId':_0x2f956f['id']},'raw':!![]})['then'](function(_0x3f7aa7){if(_0x3f7aa7){var _0x572c4a={'where':{'id':_[_0x64ce('0x19')](_0x3f7aa7,_0x64ce('0x18'))},'raw':!![]};switch(_0x58baf6){case _0x64ce('0x1a'):_0x572c4a[_0x64ce('0x1b')][_0x64ce('0x7')]=_0x64ce('0x9');break;case'Campaign':_0x572c4a[_0x64ce('0x1b')][_0x64ce('0xa')]=_0x64ce('0xb');break;}return db[_0x58baf6][_0x64ce('0x14')](_0x572c4a);}else{return[];}});}}else{return[];}})[_0x64ce('0x1c')](function(_0x389eb1){return _0x389eb1;});}function joinOrLeaveQueues(_0x2e871b,_0x3a465b,_0x70239e,_0x281398){_0x2e871b[_0x3a465b](util[_0x64ce('0x1d')]('%s:queue:%s',_0x70239e,_0x281398['name']));if(_0x281398[_0x64ce('0x5')]){for(var _0x30f767=0x0;_0x30f767<_0x281398['Agents']['length'];_0x30f767+=0x1){_0x2e871b[_0x3a465b](util[_0x64ce('0x1d')]('user:%s',_0x281398[_0x64ce('0x5')][_0x30f767][_0x64ce('0x6')]));}}}function joinOrLeave(_0x40e475,_0x1974c1,_0xf13f0a){var _0x1db89f;if(_0x40e475[_0x64ce('0x1e')][_0x64ce('0x1f')]['id']){db[_0x64ce('0x1a')][_0x64ce('0x20')]({'attributes':['id',_0x64ce('0x6'),_0x64ce('0x7'),'userProfileId'],'where':{'id':_0x40e475[_0x64ce('0x1e')][_0x64ce('0x1f')]['id']},'include':[{'model':db[_0x64ce('0x21')],'as':_0x64ce('0x22'),'attributes':['id'],'raw':!![]},{'model':db['MailInteraction'],'as':_0x64ce('0x23'),'attributes':['id'],'raw':!![]},{'model':db['FaxInteraction'],'as':_0x64ce('0x24'),'attributes':['id'],'raw':!![]},{'model':db[_0x64ce('0x25')],'as':_0x64ce('0x26'),'attributes':['id'],'raw':!![]},{'model':db['OpenchannelInteraction'],'as':_0x64ce('0x27'),'attributes':['id'],'raw':!![]},{'model':db[_0x64ce('0x28')],'as':_0x64ce('0x29'),'attributes':['id'],'raw':!![]}]})[_0x64ce('0x1c')](function(_0x37c4f4){if(_0x37c4f4){_0x1db89f=_0x37c4f4;_0x40e475[_0x1974c1](util[_0x64ce('0x1d')](_0x64ce('0x2a'),_0x37c4f4[_0x64ce('0x6')]));var _0x3ecafc=[];switch(_0x37c4f4[_0x64ce('0x7')]){case _0x64ce('0x2b'):_0x40e475[_0x1974c1](_0x64ce('0x2c'));_0x40e475[_0x1974c1](_0x64ce('0x2d'));if(queryQueues[_0x64ce('0x2e')](_0x64ce('0x2f'))){delete queryQueues[_0x64ce('0x2f')];}_0x3ecafc['push'](db['VoiceQueue'][_0x64ce('0x14')](queryQueues));_0x3ecafc[_0x64ce('0x30')](db[_0x64ce('0x31')]['findAll'](queryQueues));_0x3ecafc[_0x64ce('0x30')](db[_0x64ce('0x32')][_0x64ce('0x14')](queryQueues));_0x3ecafc['push'](db[_0x64ce('0x33')]['findAll'](queryQueues));_0x3ecafc[_0x64ce('0x30')](db['MailQueue'][_0x64ce('0x14')](queryQueues));_0x3ecafc[_0x64ce('0x30')](db[_0x64ce('0x34')]['findAll'](queryQueues));_0x3ecafc[_0x64ce('0x30')](db[_0x64ce('0x35')][_0x64ce('0x14')](queryQueues));_0x3ecafc['push'](db['User']['findAll'](queryTelephones));_0x3ecafc[_0x64ce('0x30')](db[_0x64ce('0x36')]['findAll'](queryTrunks));_0x3ecafc[_0x64ce('0x30')](db['Campaign'][_0x64ce('0x14')](queryCampaigns));_0x3ecafc[_0x64ce('0x30')](db['User'][_0x64ce('0x14')](queryAgents));break;case _0x64ce('0x37'):_0x40e475[_0x1974c1](_0x64ce('0x2c'));_0x40e475[_0x1974c1](_0x64ce('0x2d'));_0x3ecafc[_0x64ce('0x30')](getAssociatedResources(_0x64ce('0x38'),_0x37c4f4[_0x64ce('0x39')],_0x64ce('0x3a')));_0x3ecafc[_0x64ce('0x30')](getAssociatedResources(_0x64ce('0xf'),_0x37c4f4['userProfileId'],_0x64ce('0x31')));_0x3ecafc[_0x64ce('0x30')](getAssociatedResources('FaxQueues',_0x37c4f4[_0x64ce('0x39')],_0x64ce('0x32')));_0x3ecafc[_0x64ce('0x30')](getAssociatedResources(_0x64ce('0x3b'),_0x37c4f4['userProfileId'],_0x64ce('0x33')));_0x3ecafc[_0x64ce('0x30')](getAssociatedResources(_0x64ce('0x11'),_0x37c4f4['userProfileId'],_0x64ce('0x3c')));_0x3ecafc[_0x64ce('0x30')](getAssociatedResources(_0x64ce('0x12'),_0x37c4f4[_0x64ce('0x39')],_0x64ce('0x34')));_0x3ecafc[_0x64ce('0x30')](getAssociatedResources(_0x64ce('0x13'),_0x37c4f4[_0x64ce('0x39')],_0x64ce('0x35')));_0x3ecafc['push'](getAssociatedResources('Telephones',_0x37c4f4[_0x64ce('0x39')],_0x64ce('0x1a')));_0x3ecafc['push'](getAssociatedResources(_0x64ce('0x15'),_0x37c4f4[_0x64ce('0x39')],_0x64ce('0x36')));_0x3ecafc[_0x64ce('0x30')](getAssociatedResources(_0x64ce('0x16'),_0x37c4f4['userProfileId'],_0x64ce('0x3d')));_0x3ecafc['push'](db[_0x64ce('0x1a')]['findAll'](queryAgents));break;case'agent':_0x40e475[_0x1974c1](_0x64ce('0x2c'));_0x40e475[_0x1974c1]('voice:outbound');_0x3ecafc[_0x64ce('0x30')](_0x37c4f4[_0x64ce('0x3e')]({'attributes':['id',_0x64ce('0x6')]}));_0x3ecafc['push'](_0x37c4f4['getChatQueues']({'attributes':['id',_0x64ce('0x6')]}));_0x3ecafc[_0x64ce('0x30')](_0x37c4f4[_0x64ce('0x3f')]({'attributes':['id',_0x64ce('0x6')]}));_0x3ecafc['push'](_0x37c4f4[_0x64ce('0x40')]({'attributes':['id',_0x64ce('0x6')]}));_0x3ecafc['push'](_0x37c4f4['getMailQueues']({'attributes':['id',_0x64ce('0x6')]}));_0x3ecafc[_0x64ce('0x30')](_0x37c4f4['getOpenchannelQueues']({'attributes':['id','name']}));_0x3ecafc[_0x64ce('0x30')](_0x37c4f4['getWhatsappQueues']({'attributes':['id','name']}));break;}return BPromise[_0x64ce('0x41')](_0x3ecafc);}})['then'](function(_0x3e59e3){if(_0x3e59e3&&_0x3e59e3[_0x64ce('0x42')]){for(var _0x3bb548=0x0;_0x3bb548<_0x3e59e3[_0x64ce('0x42')];_0x3bb548+=0x1){for(var _0x3deeba=0x0;_0x3deeba<_0x3e59e3[_0x3bb548][_0x64ce('0x42')];_0x3deeba+=0x1){switch(_0x3bb548){case 0x0:joinOrLeaveQueues(_0x40e475,_0x1974c1,_0x64ce('0x43'),_0x3e59e3[_0x3bb548][_0x3deeba]);break;case 0x1:joinOrLeaveQueues(_0x40e475,_0x1974c1,_0x64ce('0x44'),_0x3e59e3[_0x3bb548][_0x3deeba]);break;case 0x2:joinOrLeaveQueues(_0x40e475,_0x1974c1,'fax',_0x3e59e3[_0x3bb548][_0x3deeba]);break;case 0x3:joinOrLeaveQueues(_0x40e475,_0x1974c1,_0x64ce('0x45'),_0x3e59e3[_0x3bb548][_0x3deeba]);break;case 0x4:joinOrLeaveQueues(_0x40e475,_0x1974c1,_0x64ce('0x46'),_0x3e59e3[_0x3bb548][_0x3deeba]);break;case 0x5:joinOrLeaveQueues(_0x40e475,_0x1974c1,_0x64ce('0x47'),_0x3e59e3[_0x3bb548][_0x3deeba]);break;case 0x6:joinOrLeaveQueues(_0x40e475,_0x1974c1,_0x64ce('0x48'),_0x3e59e3[_0x3bb548][_0x3deeba]);break;case 0x7:_0x40e475[_0x1974c1](util[_0x64ce('0x1d')](_0x64ce('0x49'),_0x3e59e3[_0x3bb548][_0x3deeba]['name']));break;case 0x8:_0x40e475[_0x1974c1](util[_0x64ce('0x1d')](_0x64ce('0x4a'),_0x3e59e3[_0x3bb548][_0x3deeba][_0x64ce('0x6')]));break;case 0x9:_0x40e475[_0x1974c1](util[_0x64ce('0x1d')](_0x64ce('0x4b'),_0x3e59e3[_0x3bb548][_0x3deeba]['type'],_0x3e59e3[_0x3bb548][_0x3deeba][_0x64ce('0x6')]));break;case 0xa:_0x40e475[_0x1974c1](util[_0x64ce('0x1d')](_0x64ce('0x2a'),_0x3e59e3[_0x3bb548][_0x3deeba]['name']));break;}}}}})['then'](function(){if(_0x1974c1===_0x64ce('0x4c')){var _0x519618=_[_0x64ce('0x19')](_0x1db89f[_0x64ce('0x22')],'id');return _0x1db89f[_0x64ce('0x4d')](_0x519618)[_0x64ce('0x1c')](function(){for(var _0x13b7da=0x0;_0x13b7da<_0x519618['length'];_0x13b7da+=0x1){_0xf13f0a['emit'](_0x64ce('0x4e'),{'ChatInteractionId':Number(_0x519618[_0x13b7da]),'UserId':Number(_0x1db89f['id'])});}});}})[_0x64ce('0x1c')](function(){if(_0x1974c1===_0x64ce('0x4c')){var _0x20c2a5=_[_0x64ce('0x19')](_0x1db89f[_0x64ce('0x23')],'id');return _0x1db89f[_0x64ce('0x4f')](_0x20c2a5)[_0x64ce('0x1c')](function(){for(var _0x3c8b2d=0x0;_0x3c8b2d<_0x20c2a5[_0x64ce('0x42')];_0x3c8b2d+=0x1){_0xf13f0a['emit']('user_has_mail_interactions:remove',{'MailInteractionId':Number(_0x20c2a5[_0x3c8b2d]),'UserId':Number(_0x1db89f['id'])});}});}})[_0x64ce('0x1c')](function(){if(_0x1974c1===_0x64ce('0x4c')){var _0x4a5cc5=_['map'](_0x1db89f[_0x64ce('0x24')],'id');return _0x1db89f[_0x64ce('0x50')](_0x4a5cc5)[_0x64ce('0x1c')](function(){for(var _0x4fc876=0x0;_0x4fc876<_0x4a5cc5[_0x64ce('0x42')];_0x4fc876+=0x1){_0xf13f0a[_0x64ce('0x51')](_0x64ce('0x52'),{'FaxInteractionId':Number(_0x4a5cc5[_0x4fc876]),'UserId':Number(_0x1db89f['id'])});}});}})[_0x64ce('0x1c')](function(){if(_0x1974c1===_0x64ce('0x4c')){var _0x2eb82a=_[_0x64ce('0x19')](_0x1db89f['SmsInteractions'],'id');return _0x1db89f[_0x64ce('0x53')](_0x2eb82a)[_0x64ce('0x1c')](function(){for(var _0x26072c=0x0;_0x26072c<_0x2eb82a[_0x64ce('0x42')];_0x26072c+=0x1){_0xf13f0a[_0x64ce('0x51')](_0x64ce('0x54'),{'SmsInteractionId':Number(_0x2eb82a[_0x26072c]),'UserId':Number(_0x1db89f['id'])});}});}})[_0x64ce('0x1c')](function(){if(_0x1974c1==='leave'){var _0x576ac6=_[_0x64ce('0x19')](_0x1db89f[_0x64ce('0x27')],'id');return _0x1db89f['removeOpenchannelInteractions'](_0x576ac6)[_0x64ce('0x1c')](function(){for(var _0x175afd=0x0;_0x175afd<_0x576ac6[_0x64ce('0x42')];_0x175afd+=0x1){_0xf13f0a[_0x64ce('0x51')](_0x64ce('0x55'),{'OpenchannelInteractionId':Number(_0x576ac6[_0x175afd]),'UserId':Number(_0x1db89f['id'])});}});}})[_0x64ce('0x1c')](function(){if(_0x1974c1===_0x64ce('0x4c')){var _0x80ab89=_[_0x64ce('0x19')](_0x1db89f[_0x64ce('0x29')],'id');return _0x1db89f['removeWhatsappInteractions'](_0x80ab89)[_0x64ce('0x1c')](function(){for(var _0x5381a7=0x0;_0x5381a7<_0x80ab89[_0x64ce('0x42')];_0x5381a7+=0x1){_0xf13f0a[_0x64ce('0x51')]('user_has_whatsapp_interactions:remove',{'WhatsappInteractionId':Number(_0x80ab89[_0x5381a7]),'UserId':Number(_0x1db89f['id'])});}});}})[_0x64ce('0x56')](function(_0x2d8818){_0x40e475[_0x64ce('0x57')](_0x2d8818);});}}function onDisconnect(_0x3c9fd4,_0xfe3a3a){joinOrLeave(_0x3c9fd4,'leave',_0xfe3a3a);}function onConnect(_0x2e2583){joinOrLeave(_0x2e2583,_0x64ce('0x58'));}exports['default']=function(_0x5a7d58){_0x5a7d58['on']('connection',function(_0x8a268){_0x8a268[_0x64ce('0x59')](0x0);_0x8a268[_0x64ce('0x5a')]=_0x8a268['request']['connection']['remoteAddress']+':'+_0x8a268[_0x64ce('0x5b')][_0x64ce('0x5c')][_0x64ce('0x5d')];_0x8a268[_0x64ce('0x5e')]=new Date();_0x8a268[_0x64ce('0x57')]=function(_0x53213e){console[_0x64ce('0x57')](_0x64ce('0x5f')+_0x8a268[_0x64ce('0x60')]['name']+'['+_0x8a268[_0x64ce('0x5a')]+']',_0x53213e);};_0x8a268['on'](_0x64ce('0x61'),function(){onDisconnect(_0x8a268,_0x5a7d58);_0x8a268[_0x64ce('0x57')]('DISCONNECTED');});onConnect(_0x8a268);_0x8a268[_0x64ce('0x57')]('CONNECTED');});}; \ No newline at end of file +var _0x4a45=['SocketIO\x20','DISCONNECTED','CONNECTED','lodash','util','bluebird','../mysqldb','./environment','Agents','User','name','role','agent','telephone','type','ivr','findOne','then','autoAssociation','FaxQueues','SmsQueues','MailQueues','WhatsappQueues','findAll','Telephones','Trunks','IvrCampaigns','UserProfileResource','resourceId','map','format','%s:queue:%s','user:%s','handshake','query','find','userProfileId','ChatInteraction','ChatInteractions','MailInteraction','MailInteractions','FaxInteraction','FaxInteractions','SmsInteraction','SmsInteractions','OpenchannelInteractions','WhatsappInteraction','WhatsappInteractions','admin','voice:inbound','voice:outbound','hasOwnProperty','include','push','ChatQueue','FaxQueue','SmsQueue','MailQueue','OpenchannelQueue','WhatsappQueue','Trunk','Campaign','user','VoiceQueue','ChatQueues','OpenchannelQueues','getVoiceQueues','getChatQueues','getFaxQueues','getSmsQueues','getMailQueues','getOpenchannelQueues','getWhatsappQueues','all','length','voice','fax','sms','openchannel','telephone:%s','campaign:%s:%s','leave','removeChatInteractions','user_has_chat_interactions:remove','removeMailInteractions','emit','user_has_mail_interactions:remove','removeFaxInteractions','user_has_fax_interactions:remove','removeSmsInteractions','user_has_sms_interactions:remove','removeOpenchannelInteractions','user_has_openchannel_interactions:remove','removeWhatsappInteractions','user_has_whatsapp_interactions:remove','catch','log','join','connection','address','request','remoteAddress','remotePort','connectedAt'];(function(_0x56a12d,_0x13960b){var _0x2b06cd=function(_0x151282){while(--_0x151282){_0x56a12d['push'](_0x56a12d['shift']());}};_0x2b06cd(++_0x13960b);}(_0x4a45,0x6b));var _0x54a4=function(_0x178b54,_0x2ddb75){_0x178b54=_0x178b54-0x0;var _0x169aff=_0x4a45[_0x178b54];return _0x169aff;};'use strict';var _=require(_0x54a4('0x0'));var util=require(_0x54a4('0x1'));var BPromise=require(_0x54a4('0x2'));var db=require(_0x54a4('0x3'))['db'];var config=require(_0x54a4('0x4'));var queryQueues={'attributes':['id','name'],'include':[{'as':_0x54a4('0x5'),'model':db[_0x54a4('0x6')],'attributes':['id',_0x54a4('0x7'),_0x54a4('0x8')],'raw':!![],'where':{'role':_0x54a4('0x9')},'required':![]}]};var queryTelephones={'raw':!![],'attributes':['id','name'],'where':{'role':_0x54a4('0xa')}};var queryTrunks={'raw':!![],'attributes':['id',_0x54a4('0x7')]};var queryAgents={'raw':!![],'attributes':['id',_0x54a4('0x7')],'where':{'role':'agent'}};var queryCampaigns={'raw':!![],'attributes':['id','name',_0x54a4('0xb')],'where':{'type':_0x54a4('0xc')}};function getAssociatedResources(_0x260b8a,_0x3169ee,_0x1501bd){return db['UserProfileSection'][_0x54a4('0xd')]({'where':{'name':_0x260b8a,'userProfileId':_0x3169ee},'raw':!![]})[_0x54a4('0xe')](function(_0x311171){if(_0x311171){if(_0x311171[_0x54a4('0xf')]){switch(_0x260b8a){case'VoiceQueues':case'ChatQueues':case _0x54a4('0x10'):case _0x54a4('0x11'):case _0x54a4('0x12'):case'OpenchannelQueues':case _0x54a4('0x13'):return db[_0x1501bd][_0x54a4('0x14')](queryQueues);case _0x54a4('0x15'):return db[_0x1501bd]['findAll'](queryTelephones);case _0x54a4('0x16'):return db[_0x1501bd][_0x54a4('0x14')](queryTrunks);case _0x54a4('0x17'):return db[_0x1501bd][_0x54a4('0x14')](queryCampaigns);}}else{return db[_0x54a4('0x18')]['findAll']({'attributes':[_0x54a4('0x19')],'where':{'sectionId':_0x311171['id']},'raw':!![]})[_0x54a4('0xe')](function(_0x5081f5){if(_0x5081f5){var _0x231087={'where':{'id':_[_0x54a4('0x1a')](_0x5081f5,_0x54a4('0x19'))},'raw':!![]};switch(_0x1501bd){case _0x54a4('0x6'):_0x231087['where'][_0x54a4('0x8')]=_0x54a4('0xa');break;case'Campaign':_0x231087['where'][_0x54a4('0xb')]=_0x54a4('0xc');break;}return db[_0x1501bd][_0x54a4('0x14')](_0x231087);}else{return[];}});}}else{return[];}})[_0x54a4('0xe')](function(_0x20d422){return _0x20d422;});}function joinOrLeaveQueues(_0x46b8be,_0x3cf39b,_0x15f9cd,_0x388d48){_0x46b8be[_0x3cf39b](util[_0x54a4('0x1b')](_0x54a4('0x1c'),_0x15f9cd,_0x388d48[_0x54a4('0x7')]));if(_0x388d48[_0x54a4('0x5')]){for(var _0x5d8656=0x0;_0x5d8656<_0x388d48[_0x54a4('0x5')]['length'];_0x5d8656+=0x1){_0x46b8be[_0x3cf39b](util[_0x54a4('0x1b')](_0x54a4('0x1d'),_0x388d48[_0x54a4('0x5')][_0x5d8656][_0x54a4('0x7')]));}}}function joinOrLeave(_0x4d8e50,_0x4bff0f,_0x5d927e){var _0x31a870;if(_0x4d8e50[_0x54a4('0x1e')][_0x54a4('0x1f')]['id']){db['User'][_0x54a4('0x20')]({'attributes':['id',_0x54a4('0x7'),_0x54a4('0x8'),_0x54a4('0x21')],'where':{'id':_0x4d8e50[_0x54a4('0x1e')][_0x54a4('0x1f')]['id']},'include':[{'model':db[_0x54a4('0x22')],'as':_0x54a4('0x23'),'attributes':['id'],'raw':!![]},{'model':db[_0x54a4('0x24')],'as':_0x54a4('0x25'),'attributes':['id'],'raw':!![]},{'model':db[_0x54a4('0x26')],'as':_0x54a4('0x27'),'attributes':['id'],'raw':!![]},{'model':db[_0x54a4('0x28')],'as':_0x54a4('0x29'),'attributes':['id'],'raw':!![]},{'model':db['OpenchannelInteraction'],'as':_0x54a4('0x2a'),'attributes':['id'],'raw':!![]},{'model':db[_0x54a4('0x2b')],'as':_0x54a4('0x2c'),'attributes':['id'],'raw':!![]}]})[_0x54a4('0xe')](function(_0x5262d6){if(_0x5262d6){_0x31a870=_0x5262d6;_0x4d8e50[_0x4bff0f](util['format'](_0x54a4('0x1d'),_0x5262d6[_0x54a4('0x7')]));var _0x5a016b=[];switch(_0x5262d6[_0x54a4('0x8')]){case _0x54a4('0x2d'):_0x4d8e50[_0x4bff0f](_0x54a4('0x2e'));_0x4d8e50[_0x4bff0f](_0x54a4('0x2f'));if(queryQueues[_0x54a4('0x30')](_0x54a4('0x31'))){delete queryQueues[_0x54a4('0x31')];}_0x5a016b['push'](db['VoiceQueue'][_0x54a4('0x14')](queryQueues));_0x5a016b[_0x54a4('0x32')](db[_0x54a4('0x33')][_0x54a4('0x14')](queryQueues));_0x5a016b[_0x54a4('0x32')](db[_0x54a4('0x34')][_0x54a4('0x14')](queryQueues));_0x5a016b[_0x54a4('0x32')](db[_0x54a4('0x35')]['findAll'](queryQueues));_0x5a016b[_0x54a4('0x32')](db[_0x54a4('0x36')]['findAll'](queryQueues));_0x5a016b[_0x54a4('0x32')](db[_0x54a4('0x37')][_0x54a4('0x14')](queryQueues));_0x5a016b['push'](db[_0x54a4('0x38')]['findAll'](queryQueues));_0x5a016b[_0x54a4('0x32')](db['User'][_0x54a4('0x14')](queryTelephones));_0x5a016b['push'](db[_0x54a4('0x39')][_0x54a4('0x14')](queryTrunks));_0x5a016b[_0x54a4('0x32')](db[_0x54a4('0x3a')][_0x54a4('0x14')](queryCampaigns));_0x5a016b['push'](db[_0x54a4('0x6')][_0x54a4('0x14')](queryAgents));break;case _0x54a4('0x3b'):_0x4d8e50[_0x4bff0f](_0x54a4('0x2e'));_0x4d8e50[_0x4bff0f](_0x54a4('0x2f'));_0x5a016b[_0x54a4('0x32')](getAssociatedResources('VoiceQueues',_0x5262d6['userProfileId'],_0x54a4('0x3c')));_0x5a016b[_0x54a4('0x32')](getAssociatedResources(_0x54a4('0x3d'),_0x5262d6[_0x54a4('0x21')],'ChatQueue'));_0x5a016b[_0x54a4('0x32')](getAssociatedResources(_0x54a4('0x10'),_0x5262d6[_0x54a4('0x21')],_0x54a4('0x34')));_0x5a016b[_0x54a4('0x32')](getAssociatedResources(_0x54a4('0x11'),_0x5262d6[_0x54a4('0x21')],'SmsQueue'));_0x5a016b[_0x54a4('0x32')](getAssociatedResources(_0x54a4('0x12'),_0x5262d6['userProfileId'],_0x54a4('0x36')));_0x5a016b[_0x54a4('0x32')](getAssociatedResources(_0x54a4('0x3e'),_0x5262d6[_0x54a4('0x21')],_0x54a4('0x37')));_0x5a016b[_0x54a4('0x32')](getAssociatedResources(_0x54a4('0x13'),_0x5262d6[_0x54a4('0x21')],_0x54a4('0x38')));_0x5a016b['push'](getAssociatedResources(_0x54a4('0x15'),_0x5262d6[_0x54a4('0x21')],'User'));_0x5a016b[_0x54a4('0x32')](getAssociatedResources(_0x54a4('0x16'),_0x5262d6[_0x54a4('0x21')],_0x54a4('0x39')));_0x5a016b[_0x54a4('0x32')](getAssociatedResources('IvrCampaigns',_0x5262d6['userProfileId'],'Campaign'));_0x5a016b[_0x54a4('0x32')](db['User'][_0x54a4('0x14')](queryAgents));break;case _0x54a4('0x9'):_0x4d8e50[_0x4bff0f](_0x54a4('0x2e'));_0x4d8e50[_0x4bff0f](_0x54a4('0x2f'));_0x5a016b['push'](_0x5262d6[_0x54a4('0x3f')]({'attributes':['id','name']}));_0x5a016b[_0x54a4('0x32')](_0x5262d6[_0x54a4('0x40')]({'attributes':['id',_0x54a4('0x7')]}));_0x5a016b[_0x54a4('0x32')](_0x5262d6[_0x54a4('0x41')]({'attributes':['id','name']}));_0x5a016b['push'](_0x5262d6[_0x54a4('0x42')]({'attributes':['id',_0x54a4('0x7')]}));_0x5a016b[_0x54a4('0x32')](_0x5262d6[_0x54a4('0x43')]({'attributes':['id','name']}));_0x5a016b['push'](_0x5262d6[_0x54a4('0x44')]({'attributes':['id','name']}));_0x5a016b[_0x54a4('0x32')](_0x5262d6[_0x54a4('0x45')]({'attributes':['id',_0x54a4('0x7')]}));break;}return BPromise[_0x54a4('0x46')](_0x5a016b);}})['then'](function(_0x4e3034){if(_0x4e3034&&_0x4e3034[_0x54a4('0x47')]){for(var _0x525559=0x0;_0x525559<_0x4e3034[_0x54a4('0x47')];_0x525559+=0x1){for(var _0x598742=0x0;_0x598742<_0x4e3034[_0x525559][_0x54a4('0x47')];_0x598742+=0x1){switch(_0x525559){case 0x0:joinOrLeaveQueues(_0x4d8e50,_0x4bff0f,_0x54a4('0x48'),_0x4e3034[_0x525559][_0x598742]);break;case 0x1:joinOrLeaveQueues(_0x4d8e50,_0x4bff0f,'chat',_0x4e3034[_0x525559][_0x598742]);break;case 0x2:joinOrLeaveQueues(_0x4d8e50,_0x4bff0f,_0x54a4('0x49'),_0x4e3034[_0x525559][_0x598742]);break;case 0x3:joinOrLeaveQueues(_0x4d8e50,_0x4bff0f,_0x54a4('0x4a'),_0x4e3034[_0x525559][_0x598742]);break;case 0x4:joinOrLeaveQueues(_0x4d8e50,_0x4bff0f,'mail',_0x4e3034[_0x525559][_0x598742]);break;case 0x5:joinOrLeaveQueues(_0x4d8e50,_0x4bff0f,_0x54a4('0x4b'),_0x4e3034[_0x525559][_0x598742]);break;case 0x6:joinOrLeaveQueues(_0x4d8e50,_0x4bff0f,'whatsapp',_0x4e3034[_0x525559][_0x598742]);break;case 0x7:_0x4d8e50[_0x4bff0f](util['format'](_0x54a4('0x4c'),_0x4e3034[_0x525559][_0x598742][_0x54a4('0x7')]));break;case 0x8:_0x4d8e50[_0x4bff0f](util['format']('trunk:%s',_0x4e3034[_0x525559][_0x598742]['name']));break;case 0x9:_0x4d8e50[_0x4bff0f](util['format'](_0x54a4('0x4d'),_0x4e3034[_0x525559][_0x598742][_0x54a4('0xb')],_0x4e3034[_0x525559][_0x598742][_0x54a4('0x7')]));break;case 0xa:_0x4d8e50[_0x4bff0f](util['format']('user:%s',_0x4e3034[_0x525559][_0x598742][_0x54a4('0x7')]));break;}}}}})[_0x54a4('0xe')](function(){if(_0x4bff0f===_0x54a4('0x4e')){var _0x1c1279=_[_0x54a4('0x1a')](_0x31a870[_0x54a4('0x23')],'id');return _0x31a870[_0x54a4('0x4f')](_0x1c1279)['then'](function(){for(var _0x5f0437=0x0;_0x5f0437<_0x1c1279[_0x54a4('0x47')];_0x5f0437+=0x1){_0x5d927e['emit'](_0x54a4('0x50'),{'ChatInteractionId':Number(_0x1c1279[_0x5f0437]),'UserId':Number(_0x31a870['id'])});}});}})[_0x54a4('0xe')](function(){if(_0x4bff0f===_0x54a4('0x4e')){var _0x394e44=_[_0x54a4('0x1a')](_0x31a870['MailInteractions'],'id');return _0x31a870[_0x54a4('0x51')](_0x394e44)['then'](function(){for(var _0x3ac0db=0x0;_0x3ac0db<_0x394e44['length'];_0x3ac0db+=0x1){_0x5d927e[_0x54a4('0x52')](_0x54a4('0x53'),{'MailInteractionId':Number(_0x394e44[_0x3ac0db]),'UserId':Number(_0x31a870['id'])});}});}})['then'](function(){if(_0x4bff0f===_0x54a4('0x4e')){var _0x479f92=_[_0x54a4('0x1a')](_0x31a870[_0x54a4('0x27')],'id');return _0x31a870[_0x54a4('0x54')](_0x479f92)['then'](function(){for(var _0x31c5bf=0x0;_0x31c5bf<_0x479f92[_0x54a4('0x47')];_0x31c5bf+=0x1){_0x5d927e['emit'](_0x54a4('0x55'),{'FaxInteractionId':Number(_0x479f92[_0x31c5bf]),'UserId':Number(_0x31a870['id'])});}});}})[_0x54a4('0xe')](function(){if(_0x4bff0f===_0x54a4('0x4e')){var _0x56c732=_[_0x54a4('0x1a')](_0x31a870[_0x54a4('0x29')],'id');return _0x31a870[_0x54a4('0x56')](_0x56c732)[_0x54a4('0xe')](function(){for(var _0x5f046f=0x0;_0x5f046f<_0x56c732[_0x54a4('0x47')];_0x5f046f+=0x1){_0x5d927e[_0x54a4('0x52')](_0x54a4('0x57'),{'SmsInteractionId':Number(_0x56c732[_0x5f046f]),'UserId':Number(_0x31a870['id'])});}});}})[_0x54a4('0xe')](function(){if(_0x4bff0f===_0x54a4('0x4e')){var _0x796a25=_['map'](_0x31a870['OpenchannelInteractions'],'id');return _0x31a870[_0x54a4('0x58')](_0x796a25)[_0x54a4('0xe')](function(){for(var _0x3571eb=0x0;_0x3571eb<_0x796a25[_0x54a4('0x47')];_0x3571eb+=0x1){_0x5d927e[_0x54a4('0x52')](_0x54a4('0x59'),{'OpenchannelInteractionId':Number(_0x796a25[_0x3571eb]),'UserId':Number(_0x31a870['id'])});}});}})[_0x54a4('0xe')](function(){if(_0x4bff0f===_0x54a4('0x4e')){var _0x32f262=_[_0x54a4('0x1a')](_0x31a870[_0x54a4('0x2c')],'id');return _0x31a870[_0x54a4('0x5a')](_0x32f262)[_0x54a4('0xe')](function(){for(var _0x65465e=0x0;_0x65465e<_0x32f262['length'];_0x65465e+=0x1){_0x5d927e['emit'](_0x54a4('0x5b'),{'WhatsappInteractionId':Number(_0x32f262[_0x65465e]),'UserId':Number(_0x31a870['id'])});}});}})[_0x54a4('0x5c')](function(_0x50467a){_0x4d8e50[_0x54a4('0x5d')](_0x50467a);});}}function onDisconnect(_0x4b869f,_0xef3d31){joinOrLeave(_0x4b869f,'leave',_0xef3d31);}function onConnect(_0x34e0f3){joinOrLeave(_0x34e0f3,_0x54a4('0x5e'));}exports['default']=function(_0x1054dc){_0x1054dc['on'](_0x54a4('0x5f'),function(_0x302592){_0x302592['setMaxListeners'](0x0);_0x302592[_0x54a4('0x60')]=_0x302592[_0x54a4('0x61')][_0x54a4('0x5f')][_0x54a4('0x62')]+':'+_0x302592[_0x54a4('0x61')][_0x54a4('0x5f')][_0x54a4('0x63')];_0x302592[_0x54a4('0x64')]=new Date();_0x302592[_0x54a4('0x5d')]=function(_0x201163){console[_0x54a4('0x5d')](_0x54a4('0x65')+_0x302592['nsp']['name']+'['+_0x302592[_0x54a4('0x60')]+']',_0x201163);};_0x302592['on']('disconnect',function(){onDisconnect(_0x302592,_0x1054dc);_0x302592[_0x54a4('0x5d')](_0x54a4('0x66'));});onConnect(_0x302592);_0x302592[_0x54a4('0x5d')](_0x54a4('0x67'));});}; \ No newline at end of file diff --git a/server/config/triggers/index.js b/server/config/triggers/index.js index 52ec154..ae83774 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 _0x2236=['incomingmessage','outgoingmessage','opened','changed','closed','UserId','interface','default','length','hasOwnProperty','model','hook','callback','toLowerCase','condition','util','../../mysqldb','jayson/promise','../logger','triggers','client','http','Chat','ChatInteraction','afterCreate','newinteraction','ChatMessage','newmessage','Sms','SmsInteraction','closedinteraction','SmsMessage','Whatsapp','WhatsappInteraction','WhatsappMessage','Fax','FaxInteraction','afterUpdate','FaxMessage','Mail','MailInteraction','MailMessage','Openchannel','OpenchannelInteraction','OpenchannelMessage','request','EventManager','then','Trigger,\x20%s','error','code','catch','get','channel','event','direction','find','name','format','SIP/%s'];(function(_0xed6f46,_0x1c9006){var _0x5b267c=function(_0x59f0d2){while(--_0x59f0d2){_0xed6f46['push'](_0xed6f46['shift']());}};_0x5b267c(++_0x1c9006);}(_0x2236,0x87));var _0x6223=function(_0x56ba92,_0xb3c986){_0x56ba92=_0x56ba92-0x0;var _0x8fe94d=_0x2236[_0x56ba92];return _0x8fe94d;};'use strict';var util=require(_0x6223('0x0'));var db=require(_0x6223('0x1'))['db'];var jayson=require(_0x6223('0x2'));var logger=require(_0x6223('0x3'))(_0x6223('0x4'));var client=jayson[_0x6223('0x5')][_0x6223('0x6')]({'port':0x232a});var triggers=[{'channel':_0x6223('0x7'),'model':_0x6223('0x8'),'event':_0x6223('0x9'),'condition':_0x6223('0xa'),'callback':afterCreate},{'channel':_0x6223('0x7'),'model':_0x6223('0x8'),'event':'afterUpdate','condition':'closedinteraction','callback':afterUpdate},{'channel':'Chat','model':_0x6223('0xb'),'event':_0x6223('0x9'),'condition':_0x6223('0xc'),'callback':afterCreateMessage},{'channel':_0x6223('0xd'),'model':'SmsInteraction','event':_0x6223('0x9'),'condition':_0x6223('0xa'),'callback':afterCreate},{'channel':_0x6223('0xd'),'model':_0x6223('0xe'),'event':'afterUpdate','condition':_0x6223('0xf'),'callback':afterUpdate},{'channel':_0x6223('0xd'),'model':_0x6223('0x10'),'event':'afterCreate','condition':_0x6223('0xc'),'callback':afterCreateMessage},{'channel':'Whatsapp','model':'WhatsappInteraction','event':_0x6223('0x9'),'condition':_0x6223('0xa'),'callback':afterCreate},{'channel':_0x6223('0x11'),'model':_0x6223('0x12'),'event':'afterUpdate','condition':_0x6223('0xf'),'callback':afterUpdate},{'channel':'Whatsapp','model':_0x6223('0x13'),'event':'afterCreate','condition':'newmessage','callback':afterCreateMessage},{'channel':_0x6223('0x14'),'model':_0x6223('0x15'),'event':'afterCreate','condition':_0x6223('0xa'),'callback':afterCreate},{'channel':'Fax','model':_0x6223('0x15'),'event':_0x6223('0x16'),'condition':_0x6223('0xf'),'callback':afterUpdate},{'channel':_0x6223('0x14'),'model':_0x6223('0x17'),'event':_0x6223('0x9'),'condition':_0x6223('0xc'),'callback':afterCreateMessage},{'channel':_0x6223('0x18'),'model':_0x6223('0x19'),'event':_0x6223('0x9'),'condition':'newinteraction','callback':afterCreate},{'channel':_0x6223('0x18'),'model':_0x6223('0x19'),'event':'afterUpdate','condition':_0x6223('0xf'),'callback':afterUpdate},{'channel':_0x6223('0x18'),'model':_0x6223('0x1a'),'event':'afterCreate','condition':_0x6223('0xc'),'callback':afterCreateMessage},{'channel':_0x6223('0x1b'),'model':_0x6223('0x1c'),'event':_0x6223('0x9'),'condition':_0x6223('0xa'),'callback':afterCreate},{'channel':'Openchannel','model':_0x6223('0x1c'),'event':'afterUpdate','condition':'closedinteraction','callback':afterUpdate},{'channel':_0x6223('0x1b'),'model':_0x6223('0x1d'),'event':_0x6223('0x9'),'condition':_0x6223('0xc'),'callback':afterCreateMessage}];function request(_0x12c806){return client[_0x6223('0x1e')](_0x6223('0x1f'),_0x12c806)[_0x6223('0x20')](function(_0x12bd82){logger['info'](_0x6223('0x21'),_0x6223('0x1f'),_0x12bd82);if(_0x12bd82['error']){if(_0x12bd82[_0x6223('0x22')][_0x6223('0x23')]===0x1f4){logger[_0x6223('0x22')](_0x6223('0x21'),_0x6223('0x1f'),_0x12bd82[_0x6223('0x22')]);}}})[_0x6223('0x24')](function(_0x5f5534){logger[_0x6223('0x22')](_0x6223('0x21'),'EventManager',_0x5f5534);});}function afterCreateMessage(_0x4b5081,_0x3bf5de){return function(_0x55f9a6,_0x48ba9d){_0x55f9a6=_0x55f9a6[_0x6223('0x25')]({'plain':!![]});_0x55f9a6[_0x6223('0x26')]=_0x4b5081;_0x55f9a6[_0x6223('0x27')]=_0x55f9a6[_0x6223('0x28')];if(_0x55f9a6['UserId']){return db['User'][_0x6223('0x29')]({'where':{'id':_0x55f9a6['UserId']},'attributes':['id',_0x6223('0x2a')],'raw':!![]})[_0x6223('0x20')](function(_0xa8e088){_0x55f9a6['interface']=util[_0x6223('0x2b')](_0x6223('0x2c'),_0xa8e088[_0x6223('0x2a')]);_0x55f9a6[_0x6223('0x26')]=_0x4b5081;return request({'event':_0x6223('0x2d'),'message':_0x55f9a6});})[_0x6223('0x24')](function(_0x4ea762){console[_0x6223('0x22')](_0x4ea762);});}else{return request({'event':_0x6223('0x2e'),'message':_0x55f9a6});}};}function afterCreate(_0x358aa5,_0x58ee9e){return function(_0xecc4bb,_0x515ef5){_0xecc4bb=_0xecc4bb['get']({'plain':!![]});_0xecc4bb[_0x6223('0x26')]=_0x358aa5;_0xecc4bb[_0x6223('0x27')]=_0x6223('0x2f');return request({'event':_0x58ee9e,'message':_0xecc4bb});};}function afterUpdate(_0x4bd79e,_0x37b1f8){return function(_0x7a0571,_0x580e6f){if(_0x7a0571[_0x6223('0x30')](_0x6223('0x31'))&&_0x7a0571[_0x6223('0x31')]){_0x7a0571=_0x7a0571['get']({'plain':!![]});_0x7a0571[_0x6223('0x26')]=_0x4bd79e;_0x7a0571[_0x6223('0x27')]='closed';if(_0x7a0571['UserId']){return db['User'][_0x6223('0x29')]({'where':{'id':_0x7a0571[_0x6223('0x32')]},'attributes':['id',_0x6223('0x2a')],'raw':!![]})['then'](function(_0x2fadd4){_0x7a0571[_0x6223('0x33')]=util[_0x6223('0x2b')](_0x6223('0x2c'),_0x2fadd4['name']);return request({'event':_0x37b1f8,'message':_0x7a0571});})['catch'](function(_0x2dc085){console[_0x6223('0x22')](_0x2dc085);});}else{return request({'event':_0x37b1f8,'message':_0x7a0571});}}};}exports[_0x6223('0x34')]=function(){for(var _0x1619d0=0x0;_0x1619d0=_0x58355d['agents']){throw Error('Maximum\x20login\x20has\x20been\x20reached');}_0x576877(_0x516a1f);})['catch'](function(_0x5f1306){_0x5162b2(_0x5f1306);});});}; \ No newline at end of file +var _0x3f9e=['lodash','../mysqldb','./license/util','voice','mail','fax','sms','whatsapp','openchannel','getChannels','isValidChannel','toLowerCase','includes','clearBlockUser','isUndefined','updateAttributes','agent','agents','Maximum\x20login\x20has\x20been\x20reached','catch'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0x3f9e,0x190));var _0xe3f9=function(_0x31a576,_0x424419){_0x31a576=_0x31a576-0x0;var _0x30b1d3=_0x3f9e[_0x31a576];return _0x30b1d3;};'use strict';var _=require(_0xe3f9('0x0'));var BPromise=require('bluebird');var db=require(_0xe3f9('0x1'))['db'];var util=require(_0xe3f9('0x2'));var channels=[_0xe3f9('0x3'),_0xe3f9('0x4'),'chat',_0xe3f9('0x5'),_0xe3f9('0x6'),_0xe3f9('0x7'),_0xe3f9('0x8')];exports[_0xe3f9('0x9')]=function(){return channels;};exports[_0xe3f9('0xa')]=function(_0x4217eb){_0x4217eb=_0x4217eb[_0xe3f9('0xb')]();return _[_0xe3f9('0xc')](channels,_0x4217eb);};exports[_0xe3f9('0xd')]=function(_0x3de544,_0x23588a,_0x150353,_0x23456c){var _0x37e6fe={'loginAttempts':_0x23588a,'blocked':_0x150353};if(!_[_0xe3f9('0xe')](_0x23456c)){_0x37e6fe['blockedAt']=_0x23456c;}return _0x3de544[_0xe3f9('0xf')](_0x37e6fe);};exports['getLicense']=function(_0x3b2697){return new BPromise(function(_0x33a7af,_0x103309){var _0xeeea8e=0x0;if(_0x3b2697['role']!==_0xe3f9('0x10')){_0x33a7af(_0x3b2697);}db['User']['count']({'where':{'role':_0xe3f9('0x10'),'online':!![],'id':{'$ne':_0x3b2697['id']}}})['then'](function(_0x4b575b){_0xeeea8e=_0x4b575b;return util['getLicense']();})['then'](function(_0x2f7078){if(_0x2f7078&&_0x2f7078[_0xe3f9('0x11')]&&_0xeeea8e>=_0x2f7078['agents']){throw Error(_0xe3f9('0x12'));}_0x33a7af(_0x3b2697);})[_0xe3f9('0x13')](function(_0x1ccfd7){_0x103309(_0x1ccfd7);});});}; \ No newline at end of file diff --git a/server/errors/index.js b/server/errors/index.js index 178190e..91d0a8c 100644 --- a/server/errors/index.js +++ b/server/errors/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x380c=['render','json','exports','404','status'];(function(_0x286a12,_0x4d60ac){var _0x2157fc=function(_0x27638e){while(--_0x27638e){_0x286a12['push'](_0x286a12['shift']());}};_0x2157fc(++_0x4d60ac);}(_0x380c,0x1e2));var _0xc380=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x380c[_0xa464c9];return _0x3d73c4;};'use strict';module[_0xc380('0x0')][0x194]=function pageNotFound(_0x1471a0,_0xad8823){var _0x183e93=_0xc380('0x1');var _0xc6d7b7=0x194;var _0x40e00a={'status':_0xc6d7b7};_0xad8823[_0xc380('0x2')](_0x40e00a[_0xc380('0x2')]);_0xad8823[_0xc380('0x3')](_0x183e93,{},function(_0x37b269,_0x316c52){if(_0x37b269){return _0xad8823[_0xc380('0x2')](_0x40e00a[_0xc380('0x2')])[_0xc380('0x4')](_0x40e00a);}_0xad8823['send'](_0x316c52);});}; \ No newline at end of file +var _0x6c23=['status','json','send','exports'];(function(_0x16aaef,_0x410651){var _0x1c82ef=function(_0x3d802b){while(--_0x3d802b){_0x16aaef['push'](_0x16aaef['shift']());}};_0x1c82ef(++_0x410651);}(_0x6c23,0xbb));var _0x36c2=function(_0xdc3dc0,_0x127c86){_0xdc3dc0=_0xdc3dc0-0x0;var _0x534389=_0x6c23[_0xdc3dc0];return _0x534389;};'use strict';module[_0x36c2('0x0')][0x194]=function pageNotFound(_0x235476,_0x3e2ed4){var _0x207fc0='404';var _0x5e73e8=0x194;var _0x3cc20={'status':_0x5e73e8};_0x3e2ed4[_0x36c2('0x1')](_0x3cc20['status']);_0x3e2ed4['render'](_0x207fc0,{},function(_0x466b3a,_0x2efd6a){if(_0x466b3a){return _0x3e2ed4[_0x36c2('0x1')](_0x3cc20['status'])[_0x36c2('0x2')](_0x3cc20);}_0x3e2ed4[_0x36c2('0x3')](_0x2efd6a);});}; \ No newline at end of file diff --git a/server/mysqldb/index.js b/server/mysqldb/index.js index a76c8fe..0bb44a7 100644 --- a/server/mysqldb/index.js +++ b/server/mysqldb/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x44e8=['FaxInteractions','Notifications','SenderId','belongsToMany','Groups','Contacts','cm_user_has_contacts','cm_user_has_lists','MailInteractions','ChatInteractions','SmsInteractions','user_has_sms_interactions','WhatsappInteractions','VoiceQueue','VoiceQueues','ChatQueues','FaxQueues','UserFaxQueue','SmsQueue','SmsQueues','UserOpenchannelQueue','WhatsappQueue','WhatsappQueues','CmList','user_has_voice_prefixes','ChatWebsites','user_has_chat_websites','FaxAccount','FaxAccounts','user_has_fax_accounts','user_has_mail_accounts','OpenchannelAccount','OpenchannelAccounts','user_has_openchannel_accounts','SmsAccounts','WhatsappAccount','WhatsappAccounts','user_has_whatsapp_accounts','SquareProjects','user_has_square_projects','SpiedAgents','Sound','Sounds','moh_has_sounds','Members','VoiceQueueId','Hoppers','CmHopperFinal','HopperHistories','CmHopperBlack','belongsTo','TrunkId','TrunkBackup','TrunkBackupId','Interval','Pause','mandatoryDispositionPause','mandatoryDispositionPauseId','Lists','voice_queues_has_cm_lists','Agents','Teams','team_has_voice_queues','voice_queues_has_cm_blacklists','Messages','mailboxuser','mailbox','QueueCalls','uniqueid','Contact','ContactId','MailServerOut','Smtp','Disposition','Dispositions','MailAccountId','Applications','List','ListId','Template','TemplateId','team_has_mail_queues','MailInteractionId','Account','Owner','mail_interaction_has_tags','Tags','Users','user_has_mail_interactions','Interaction','restrict','IntervalId','Items','FaxAccountId','Interactions','Exntensions','FaxInteractionId','fax_interaction_has_tags','user_has_fax_interactions','AttachmentId','team_has_fax_queues','SmsAccountId','user_has_sms_accounts','TagId','SmsInteractionId','sms_interaction_has_tags','SmsQueueId','team_has_sms_queues','OpenchannelAccountId','OpenchannelQueueId','OpenchannelInteractionId','openchannel_interaction_has_tags','ThroughTags','user_has_openchannel_interactions','team_has_openchannel_queues','Answers','ChatWebsiteId','ChatProactiveAction','ProactiveActions','Website','ChatInteractionId','team_has_chat_queues','ChatGroupId','chat_group_has_users','CmCompany','JscriptySessions','Company','cm_contact_has_tags','Queue','CampaignId','OwnerId','All','AutomationAllId','Actions','Intervals','MailApplications','ChatApplications','FaxApplications','SmsApplications','DefaultReportId','AnalyticCustomReport','CustomReportId','chat_interaction_has_tags','AnyConditions','AnyCondition','TriggerAnyId','Fields','AnalyticMetric','MetricId','Configurations','AccountId','Subjects','SubjectId','Descriptions','DescriptionId','Subject','Description','Field','FieldId','VariableId','DeskAccount','DeskConfiguration','int_desk_configuration_has_tags','FreshdeskConfiguration','int_freshdesk_configuration_has_tags','VtigerAccount','VtigerConfiguration','VtigerField','ServicenowField','FreshsalesConfiguration','ChatQueueReport','FromId','ToId','JscriptyQuestionReport','SessionId','ProjectId','MailQueues','HopperBlacks','campaigns_has_cm_lists','BlackLists','campaigns_has_cm_blacklists','FromMailAccountId','FromAccount','FromAgent','ToUserId','ToAgent','ToMailQueueId','ToQueue','ToMailAccountId','ToAccount','ToChatQueueId','ToChatWebsiteId','FromFaxAccountId','ToFaxQueueId','ToFaxAccountId','FromUserId','ToOpenchannelQueueId','ToOpenchannelAccountId','FromSmsAccountId','ToSmsQueueId','CustomFields','Queues','userProfileId','UserProfileSections','Resources','WhatsappAccountId','WhatsappInteractionId','whatsapp_interaction_has_tags','user_has_whatsapp_interactions','WhatsappTransferReport','FromWhatsappAccountId','ToQueueId','WhatsappQueueId','team_has_whatsapp_queues','exports','path','lodash','jstz','determine','sequelize','motion2','xcall','xC@LL1234','mysql','utf8mb4','name','utf8','sequelizeHistory','defaultsDeep','utf8_general_ci','database','username','options','password','User','import','../api/user/user.model','VoiceChanSpy','VoiceContext','VoiceExtension','../api/voiceExtension/voiceExtension.model','VoiceMusicOnHold','../api/voiceMusicOnHold/voiceMusicOnHold.model','VoiceRecording','../api/voiceRecording/voiceRecording.model','VoiceMail','../api/voiceMail/voiceMail.model','VoiceMailMessage','../api/voiceMailMessage/voiceMailMessage.model','VoiceCallReport','../api/voiceCallReport/voiceCallReport.model','VoiceAgentReport','VoiceQueueReport','MemberReport','../api/memberReport/memberReport.model','Trunk','../api/trunk/trunk.model','VoiceTransferReport','../api/voiceTransferReport/voiceTransferReport.model','UserVoiceQueueRt','../api/userVoiceQueueRt/userVoiceQueueRt.model','UserVoiceQueue','../api/userVoiceQueue/userVoiceQueue.model','UserChatQueue','../api/userChatQueue/userChatQueue.model','UserMailQueue','../api/userMailQueue/userMailQueue.model','../api/userFaxQueue/userFaxQueue.model','UserSmsQueue','../api/userSmsQueue/userSmsQueue.model','../api/userOpenchannelQueue/userOpenchannelQueue.model','UserWhatsappQueue','../api/userWhatsappQueue/userWhatsappQueue.model','MailServerIn','../api/mailServerIn/mailServerIn.model','../api/mailServerOut/mailServerOut.model','MailAccount','../api/mailAccount/mailAccount.model','MailQueue','MailSubstatus','MailInteraction','../api/mailInteraction/mailInteraction.model','MailMessage','../api/mailMessage/mailMessage.model','MailApplication','../api/mailApplication/mailApplication.model','MailQueueReport','../api/mailQueueReport/mailQueueReport.model','Dashboard','../api/dashboard/dashboard.model','DashboardItem','../api/faxAccount/faxAccount.model','FaxApplication','FaxInteraction','../api/faxInteraction/faxInteraction.model','FaxMessage','FaxQueue','FaxQueueReport','../api/faxQueueReport/faxQueueReport.model','SmsAccount','../api/smsAccount/smsAccount.model','SmsApplication','../api/smsApplication/smsApplication.model','SmsInteraction','../api/smsInteraction/smsInteraction.model','SmsMessage','../api/smsMessage/smsMessage.model','../api/smsQueue/smsQueue.model','../api/openchannelAccount/openchannelAccount.model','OpenchannelApplication','../api/openchannelApplication/openchannelApplication.model','../api/openchannelInteraction/openchannelInteraction.model','OpenchannelMessage','../api/openchannelMessage/openchannelMessage.model','OpenchannelQueue','../api/openchannelQueue/openchannelQueue.model','ChatWebsite','../api/chatWebsite/chatWebsite.model','OpenchannelQueueReport','../api/openchannelQueueReport/openchannelQueueReport.model','ChatApplication','../api/chatApplication/chatApplication.model','../api/chatInteraction/chatInteraction.model','ChatMessage','../api/chatMessage/chatMessage.model','ChatOfflineMessage','../api/chatOfflineMessage/chatOfflineMessage.model','ChatQueue','ChatGroup','../api/chatGroup/chatGroup.model','../api/chatProactiveAction/chatProactiveAction.model','../api/cmCompany/cmCompany.model','CmContact','CmHopper','../api/cmHopper/cmHopper.model','../api/cmHopperBlack/cmHopperBlack.model','../api/cmHopperFinal/cmHopperFinal.model','CmHopperHistory','../api/cmHopperHistory/cmHopperHistory.model','ReportAgentPreview','../api/reportAgentPreview/reportAgentPreview.model','CmCustomField','../api/cmCustomField/cmCustomField.model','Action','Automation','../api/automation/automation.model','CannedAnswer','../api/cannedAnswer/cannedAnswer.model','Condition','../api/condition/condition.model','../api/pause/pause.model','Cdr','../api/cdr/cdr.model','../api/voiceQueuesLog/voiceQueuesLog.model','Schedule','../api/sound/sound.model','Tag','../api/template/template.model','Trigger','Variable','../api/variable/variable.model','Integration','../api/integration/integration.model','IntegrationReport','../api/analyticCustomReport/analyticCustomReport.model','AnalyticDefaultReport','../api/analyticDefaultReport/analyticDefaultReport.model','AnalyticExtractedReport','../api/analyticExtractedReport/analyticExtractedReport.model','../api/analyticMetric/analyticMetric.model','AnalyticFieldReport','AnalyticTreeReport','../api/analyticTreeReport/analyticTreeReport.model','SalesforceAccount','SalesforceConfiguration','../api/intSalesforceConfiguration/intSalesforceConfiguration.model','SalesforceField','SugarcrmAccount','../api/intSugarcrmAccount/intSugarcrmAccount.model','SugarcrmConfiguration','../api/intSugarcrmConfiguration/intSugarcrmConfiguration.model','SugarcrmField','../api/intSugarcrmField/intSugarcrmField.model','../api/intDeskAccount/intDeskAccount.model','DeskField','../api/intDeskField/intDeskField.model','ZohoAccount','../api/intZohoAccount/intZohoAccount.model','ZohoConfiguration','../api/intZohoConfiguration/intZohoConfiguration.model','ZohoField','../api/intZohoField/intZohoField.model','../api/intZendeskAccount/intZendeskAccount.model','ZendeskConfiguration','../api/intZendeskConfiguration/intZendeskConfiguration.model','ZendeskField','../api/intZendeskField/intZendeskField.model','FreshdeskAccount','../api/intFreshdeskAccount/intFreshdeskAccount.model','../api/intFreshdeskConfiguration/intFreshdeskConfiguration.model','FreshdeskField','../api/intFreshdeskField/intFreshdeskField.model','../api/intVtigerAccount/intVtigerAccount.model','../api/intVtigerConfiguration/intVtigerConfiguration.model','../api/intVtigerField/intVtigerField.model','ServicenowAccount','../api/intServicenowAccount/intServicenowAccount.model','ServicenowConfiguration','../api/intServicenowConfiguration/intServicenowConfiguration.model','../api/intServicenowField/intServicenowField.model','Dynamics365Account','../api/intDynamics365Account/intDynamics365Account.model','Dynamics365Configuration','../api/intDynamics365Configuration/intDynamics365Configuration.model','Dynamics365Field','FreshsalesAccount','FreshsalesField','../api/intFreshsalesField/intFreshsalesField.model','Network','../api/network/network.model','../api/chatQueueReport/chatQueueReport.model','ChatInternalMessage','JscriptyAnswerReport','../api/jscriptyAnswerReport/jscriptyAnswerReport.model','../api/jscriptyQuestionReport/jscriptyQuestionReport.model','JscriptySessionReport','../api/jscriptySessionReport/jscriptySessionReport.model','SmsQueueReport','../api/smsQueueReport/smsQueueReport.model','SquareReport','SquareDetailsReport','../api/squareReportDetail/squareReportDetail.model','JscriptyProject','../api/setting/setting.model','../api/squareOdbc/squareOdbc.model','SquareProject','../api/squareProject/squareProject.model','SquareRecording','../api/squareRecording/squareRecording.model','../api/squareMessage/squareMessage.model','Team','License','../api/license/license.model','Campaign','../api/campaign/campaign.model','Migration','../api/migration/migration.model','Attachment','../api/plugin/plugin.model','MailTransferReport','../api/mailTransferReport/mailTransferReport.model','ChatTransferReport','FaxTransferReport','OpenchannelTransferReport','../api/openchannelTransferReport/openchannelTransferReport.model','SmsTransferReport','../api/cmList/cmList.model','VoicePrefix','UserProfile','../api/userProfile/userProfile.model','UserProfileSection','UserProfileResource','Notification','WhatsappApplication','../api/whatsappApplication/whatsappApplication.model','WhatsappInteraction','../api/whatsappInteraction/whatsappInteraction.model','WhatsappMessage','WhatsappQueueReport','../api/whatsappQueueReport/whatsappQueueReport.model','../api/whatsappQueue/whatsappQueue.model','../api/cloudProvider/cloudProvider.model','hasOne','cascade','UserId','Recordings','hasMany','VoiceQueuesRt','Extensions','HopperFinals','HopperHistory','OpenchannelInteraction','OpenchannelInteractions','ChatInteraction'];(function(_0x56c2bd,_0x307141){var _0x1edc9c=function(_0x12d5e2){while(--_0x12d5e2){_0x56c2bd['push'](_0x56c2bd['shift']());}};_0x1edc9c(++_0x307141);}(_0x44e8,0xd7));var _0x844e=function(_0x4b2611,_0x381474){_0x4b2611=_0x4b2611-0x0;var _0x1ea173=_0x44e8[_0x4b2611];return _0x1ea173;};'use strict';var path=require(_0x844e('0x0'));var config=require('../config/environment');var Sequelize=require('sequelize');var _=require(_0x844e('0x1'));var jstz=require(_0x844e('0x2'));var timezone=jstz[_0x844e('0x3')]();config[_0x844e('0x4')]=_['defaultsDeep'](config[_0x844e('0x4')],{'database':_0x844e('0x5'),'username':_0x844e('0x6'),'password':_0x844e('0x7'),'options':{'host':'127.0.0.1','port':0xcea,'dialect':_0x844e('0x8'),'dialectOptions':{'charset':_0x844e('0x9')},'logging':![],'timezone':timezone[_0x844e('0xa')](),'define':{'charset':_0x844e('0xb'),'collate':'utf8_general_ci'}}});config[_0x844e('0xc')]=_[_0x844e('0xd')](config[_0x844e('0xc')],{'database':_0x844e('0x5'),'username':_0x844e('0x6'),'password':_0x844e('0x7'),'options':{'host':'127.0.0.1','port':0xcea,'dialect':_0x844e('0x8'),'dialectOptions':{'charset':_0x844e('0x9')},'logging':![],'timezone':timezone[_0x844e('0xa')](),'define':{'charset':_0x844e('0xb'),'collate':_0x844e('0xe')}}});var db={'Sequelize':Sequelize,'sequelize':new Sequelize(config[_0x844e('0x4')][_0x844e('0xf')],config['sequelize'][_0x844e('0x10')],config[_0x844e('0x4')]['password'],config[_0x844e('0x4')][_0x844e('0x11')])};var dbH={'Sequelize':Sequelize,'sequelize':new Sequelize(config['sequelizeHistory'][_0x844e('0xf')],config[_0x844e('0xc')][_0x844e('0x10')],config['sequelizeHistory'][_0x844e('0x12')],config[_0x844e('0xc')][_0x844e('0x11')])};db[_0x844e('0x13')]=db[_0x844e('0x4')][_0x844e('0x14')](_0x844e('0x15'));db[_0x844e('0x16')]=db['sequelize'][_0x844e('0x14')]('../api/voiceChanSpy/voiceChanSpy.model');db[_0x844e('0x17')]=db['sequelize'][_0x844e('0x14')]('../api/voiceContext/voiceContext.model');db[_0x844e('0x18')]=db[_0x844e('0x4')][_0x844e('0x14')](_0x844e('0x19'));db[_0x844e('0x1a')]=db[_0x844e('0x4')][_0x844e('0x14')](_0x844e('0x1b'));db['VoiceQueue']=db[_0x844e('0x4')]['import']('../api/voiceQueue/voiceQueue.model');db[_0x844e('0x1c')]=db[_0x844e('0x4')][_0x844e('0x14')](_0x844e('0x1d'));db['ScreenRecording']=db[_0x844e('0x4')][_0x844e('0x14')]('../api/screenRecording/screenRecording.model');db[_0x844e('0x1e')]=db[_0x844e('0x4')][_0x844e('0x14')](_0x844e('0x1f'));db[_0x844e('0x20')]=db[_0x844e('0x4')]['import'](_0x844e('0x21'));db[_0x844e('0x22')]=db[_0x844e('0x4')][_0x844e('0x14')](_0x844e('0x23'));db['VoiceDialReport']=db[_0x844e('0x4')]['import']('../api/voiceDialReport/voiceDialReport.model');db[_0x844e('0x24')]=db[_0x844e('0x4')][_0x844e('0x14')]('../api/voiceAgentReport/voiceAgentReport.model');db[_0x844e('0x25')]=db[_0x844e('0x4')][_0x844e('0x14')]('../api/voiceQueueReport/voiceQueueReport.model');db[_0x844e('0x26')]=db[_0x844e('0x4')][_0x844e('0x14')](_0x844e('0x27'));db[_0x844e('0x28')]=db[_0x844e('0x4')][_0x844e('0x14')](_0x844e('0x29'));db[_0x844e('0x2a')]=db[_0x844e('0x4')]['import'](_0x844e('0x2b'));db[_0x844e('0x2c')]=db[_0x844e('0x4')][_0x844e('0x14')](_0x844e('0x2d'));db[_0x844e('0x2e')]=db[_0x844e('0x4')]['import'](_0x844e('0x2f'));db[_0x844e('0x30')]=db[_0x844e('0x4')]['import'](_0x844e('0x31'));db[_0x844e('0x32')]=db['sequelize'][_0x844e('0x14')](_0x844e('0x33'));db['UserFaxQueue']=db[_0x844e('0x4')][_0x844e('0x14')](_0x844e('0x34'));db[_0x844e('0x35')]=db[_0x844e('0x4')][_0x844e('0x14')](_0x844e('0x36'));db['UserOpenchannelQueue']=db[_0x844e('0x4')][_0x844e('0x14')](_0x844e('0x37'));db[_0x844e('0x38')]=db[_0x844e('0x4')][_0x844e('0x14')](_0x844e('0x39'));db[_0x844e('0x3a')]=db[_0x844e('0x4')][_0x844e('0x14')](_0x844e('0x3b'));db['MailServerOut']=db['sequelize'][_0x844e('0x14')](_0x844e('0x3c'));db[_0x844e('0x3d')]=db[_0x844e('0x4')][_0x844e('0x14')](_0x844e('0x3e'));db[_0x844e('0x3f')]=db[_0x844e('0x4')][_0x844e('0x14')]('../api/mailQueue/mailQueue.model');db[_0x844e('0x40')]=db['sequelize'][_0x844e('0x14')]('../api/mailSubstatus/mailSubstatus.model');db[_0x844e('0x41')]=db['sequelize'][_0x844e('0x14')](_0x844e('0x42'));db[_0x844e('0x43')]=db[_0x844e('0x4')][_0x844e('0x14')](_0x844e('0x44'));db[_0x844e('0x45')]=db[_0x844e('0x4')][_0x844e('0x14')](_0x844e('0x46'));db[_0x844e('0x47')]=db['sequelize'][_0x844e('0x14')](_0x844e('0x48'));db[_0x844e('0x49')]=db['sequelize']['import'](_0x844e('0x4a'));db[_0x844e('0x4b')]=db[_0x844e('0x4')]['import']('../api/dashboardItem/dashboardItem.model');db['FaxAccount']=db['sequelize'][_0x844e('0x14')](_0x844e('0x4c'));db[_0x844e('0x4d')]=db[_0x844e('0x4')][_0x844e('0x14')]('../api/faxApplication/faxApplication.model');db[_0x844e('0x4e')]=db['sequelize']['import'](_0x844e('0x4f'));db[_0x844e('0x50')]=db[_0x844e('0x4')][_0x844e('0x14')]('../api/faxMessage/faxMessage.model');db[_0x844e('0x51')]=db[_0x844e('0x4')][_0x844e('0x14')]('../api/faxQueue/faxQueue.model');db[_0x844e('0x52')]=db[_0x844e('0x4')]['import'](_0x844e('0x53'));db[_0x844e('0x54')]=db[_0x844e('0x4')][_0x844e('0x14')](_0x844e('0x55'));db[_0x844e('0x56')]=db['sequelize'][_0x844e('0x14')](_0x844e('0x57'));db[_0x844e('0x58')]=db[_0x844e('0x4')][_0x844e('0x14')](_0x844e('0x59'));db[_0x844e('0x5a')]=db[_0x844e('0x4')][_0x844e('0x14')](_0x844e('0x5b'));db['SmsQueue']=db[_0x844e('0x4')][_0x844e('0x14')](_0x844e('0x5c'));db['OpenchannelAccount']=db[_0x844e('0x4')][_0x844e('0x14')](_0x844e('0x5d'));db[_0x844e('0x5e')]=db[_0x844e('0x4')][_0x844e('0x14')](_0x844e('0x5f'));db['OpenchannelInteraction']=db[_0x844e('0x4')][_0x844e('0x14')](_0x844e('0x60'));db[_0x844e('0x61')]=db[_0x844e('0x4')][_0x844e('0x14')](_0x844e('0x62'));db[_0x844e('0x63')]=db[_0x844e('0x4')][_0x844e('0x14')](_0x844e('0x64'));db[_0x844e('0x65')]=db[_0x844e('0x4')]['import'](_0x844e('0x66'));db[_0x844e('0x67')]=db[_0x844e('0x4')][_0x844e('0x14')](_0x844e('0x68'));db[_0x844e('0x69')]=db['sequelize'][_0x844e('0x14')](_0x844e('0x6a'));db['ChatInteraction']=db[_0x844e('0x4')][_0x844e('0x14')](_0x844e('0x6b'));db[_0x844e('0x6c')]=db[_0x844e('0x4')][_0x844e('0x14')](_0x844e('0x6d'));db[_0x844e('0x6e')]=db[_0x844e('0x4')][_0x844e('0x14')](_0x844e('0x6f'));db[_0x844e('0x70')]=db[_0x844e('0x4')][_0x844e('0x14')]('../api/chatQueue/chatQueue.model');db[_0x844e('0x71')]=db[_0x844e('0x4')]['import'](_0x844e('0x72'));db['ChatProactiveAction']=db[_0x844e('0x4')][_0x844e('0x14')](_0x844e('0x73'));db['CmCompany']=db['sequelize'][_0x844e('0x14')](_0x844e('0x74'));db[_0x844e('0x75')]=db[_0x844e('0x4')][_0x844e('0x14')]('../api/cmContact/cmContact.model');db[_0x844e('0x76')]=db[_0x844e('0x4')][_0x844e('0x14')](_0x844e('0x77'));db['CmHopperBlack']=db[_0x844e('0x4')][_0x844e('0x14')](_0x844e('0x78'));db['CmHopperFinal']=db['sequelize'][_0x844e('0x14')](_0x844e('0x79'));db[_0x844e('0x7a')]=db['sequelize']['import'](_0x844e('0x7b'));db[_0x844e('0x7c')]=db[_0x844e('0x4')]['import'](_0x844e('0x7d'));db[_0x844e('0x7e')]=db[_0x844e('0x4')]['import'](_0x844e('0x7f'));db[_0x844e('0x80')]=db[_0x844e('0x4')][_0x844e('0x14')]('../api/action/action.model');db[_0x844e('0x81')]=db[_0x844e('0x4')][_0x844e('0x14')](_0x844e('0x82'));db[_0x844e('0x83')]=db[_0x844e('0x4')][_0x844e('0x14')](_0x844e('0x84'));db['Disposition']=db['sequelize'][_0x844e('0x14')]('../api/disposition/disposition.model');db[_0x844e('0x85')]=db[_0x844e('0x4')][_0x844e('0x14')](_0x844e('0x86'));db['Interval']=db['sequelize']['import']('../api/interval/interval.model');db['Pause']=db['sequelize'][_0x844e('0x14')](_0x844e('0x87'));db[_0x844e('0x88')]=db['sequelize'][_0x844e('0x14')](_0x844e('0x89'));db['VoiceQueuesLog']=db[_0x844e('0x4')]['import'](_0x844e('0x8a'));db[_0x844e('0x8b')]=db[_0x844e('0x4')][_0x844e('0x14')]('../api/schedule/schedule.model');db['Sound']=db['sequelize'][_0x844e('0x14')](_0x844e('0x8c'));db[_0x844e('0x8d')]=db[_0x844e('0x4')][_0x844e('0x14')]('../api/tag/tag.model');db['Template']=db[_0x844e('0x4')][_0x844e('0x14')](_0x844e('0x8e'));db[_0x844e('0x8f')]=db[_0x844e('0x4')][_0x844e('0x14')]('../api/trigger/trigger.model');db[_0x844e('0x90')]=db[_0x844e('0x4')]['import'](_0x844e('0x91'));db[_0x844e('0x92')]=db['sequelize']['import'](_0x844e('0x93'));db[_0x844e('0x94')]=db[_0x844e('0x4')]['import']('../api/integrationReport/integrationReport.model');db['AnalyticCustomReport']=db[_0x844e('0x4')]['import'](_0x844e('0x95'));db[_0x844e('0x96')]=db[_0x844e('0x4')][_0x844e('0x14')](_0x844e('0x97'));db[_0x844e('0x98')]=db['sequelize'][_0x844e('0x14')](_0x844e('0x99'));db['AnalyticMetric']=db[_0x844e('0x4')][_0x844e('0x14')](_0x844e('0x9a'));db[_0x844e('0x9b')]=db[_0x844e('0x4')]['import']('../api/analyticFieldReport/analyticFieldReport.model');db[_0x844e('0x9c')]=db[_0x844e('0x4')][_0x844e('0x14')](_0x844e('0x9d'));db[_0x844e('0x9e')]=db[_0x844e('0x4')][_0x844e('0x14')]('../api/intSalesforceAccount/intSalesforceAccount.model');db[_0x844e('0x9f')]=db[_0x844e('0x4')]['import'](_0x844e('0xa0'));db[_0x844e('0xa1')]=db[_0x844e('0x4')]['import']('../api/intSalesforceField/intSalesforceField.model');db[_0x844e('0xa2')]=db[_0x844e('0x4')]['import'](_0x844e('0xa3'));db[_0x844e('0xa4')]=db[_0x844e('0x4')][_0x844e('0x14')](_0x844e('0xa5'));db[_0x844e('0xa6')]=db[_0x844e('0x4')]['import'](_0x844e('0xa7'));db['DeskAccount']=db[_0x844e('0x4')]['import'](_0x844e('0xa8'));db['DeskConfiguration']=db[_0x844e('0x4')][_0x844e('0x14')]('../api/intDeskConfiguration/intDeskConfiguration.model');db[_0x844e('0xa9')]=db[_0x844e('0x4')][_0x844e('0x14')](_0x844e('0xaa'));db[_0x844e('0xab')]=db['sequelize'][_0x844e('0x14')](_0x844e('0xac'));db[_0x844e('0xad')]=db[_0x844e('0x4')][_0x844e('0x14')](_0x844e('0xae'));db[_0x844e('0xaf')]=db[_0x844e('0x4')][_0x844e('0x14')](_0x844e('0xb0'));db['ZendeskAccount']=db[_0x844e('0x4')][_0x844e('0x14')](_0x844e('0xb1'));db[_0x844e('0xb2')]=db[_0x844e('0x4')][_0x844e('0x14')](_0x844e('0xb3'));db[_0x844e('0xb4')]=db[_0x844e('0x4')][_0x844e('0x14')](_0x844e('0xb5'));db[_0x844e('0xb6')]=db[_0x844e('0x4')][_0x844e('0x14')](_0x844e('0xb7'));db['FreshdeskConfiguration']=db[_0x844e('0x4')]['import'](_0x844e('0xb8'));db[_0x844e('0xb9')]=db[_0x844e('0x4')][_0x844e('0x14')](_0x844e('0xba'));db['VtigerAccount']=db[_0x844e('0x4')][_0x844e('0x14')](_0x844e('0xbb'));db['VtigerConfiguration']=db['sequelize'][_0x844e('0x14')](_0x844e('0xbc'));db['VtigerField']=db[_0x844e('0x4')][_0x844e('0x14')](_0x844e('0xbd'));db[_0x844e('0xbe')]=db[_0x844e('0x4')][_0x844e('0x14')](_0x844e('0xbf'));db[_0x844e('0xc0')]=db[_0x844e('0x4')]['import'](_0x844e('0xc1'));db['ServicenowField']=db[_0x844e('0x4')][_0x844e('0x14')](_0x844e('0xc2'));db[_0x844e('0xc3')]=db[_0x844e('0x4')]['import'](_0x844e('0xc4'));db[_0x844e('0xc5')]=db['sequelize'][_0x844e('0x14')](_0x844e('0xc6'));db[_0x844e('0xc7')]=db[_0x844e('0x4')][_0x844e('0x14')]('../api/intDynamics365Field/intDynamics365Field.model');db[_0x844e('0xc8')]=db[_0x844e('0x4')]['import']('../api/intFreshsalesAccount/intFreshsalesAccount.model');db['FreshsalesConfiguration']=db[_0x844e('0x4')][_0x844e('0x14')]('../api/intFreshsalesConfiguration/intFreshsalesConfiguration.model');db[_0x844e('0xc9')]=db[_0x844e('0x4')][_0x844e('0x14')](_0x844e('0xca'));db[_0x844e('0x92')]=db['sequelize']['import']('../api/integration/integration.model');db[_0x844e('0xcb')]=db[_0x844e('0x4')][_0x844e('0x14')](_0x844e('0xcc'));db['ChatQueueReport']=db['sequelize'][_0x844e('0x14')](_0x844e('0xcd'));db[_0x844e('0xce')]=db[_0x844e('0x4')][_0x844e('0x14')]('../api/chatInternalMessage/chatInternalMessage.model');db[_0x844e('0xcf')]=db[_0x844e('0x4')]['import'](_0x844e('0xd0'));db['JscriptyQuestionReport']=db[_0x844e('0x4')][_0x844e('0x14')](_0x844e('0xd1'));db[_0x844e('0xd2')]=db[_0x844e('0x4')][_0x844e('0x14')](_0x844e('0xd3'));db[_0x844e('0xd4')]=db['sequelize'][_0x844e('0x14')](_0x844e('0xd5'));db[_0x844e('0xd6')]=db[_0x844e('0x4')][_0x844e('0x14')]('../api/squareReport/squareReport.model');db[_0x844e('0xd7')]=db[_0x844e('0x4')][_0x844e('0x14')](_0x844e('0xd8'));db[_0x844e('0xd9')]=db[_0x844e('0x4')][_0x844e('0x14')]('../api/jscriptyProject/jscriptyProject.model');db['Setting']=db[_0x844e('0x4')][_0x844e('0x14')](_0x844e('0xda'));db['SquareOdbc']=db[_0x844e('0x4')][_0x844e('0x14')](_0x844e('0xdb'));db[_0x844e('0xdc')]=db['sequelize'][_0x844e('0x14')](_0x844e('0xdd'));db[_0x844e('0xde')]=db['sequelize'][_0x844e('0x14')](_0x844e('0xdf'));db['SquareMessage']=db[_0x844e('0x4')][_0x844e('0x14')](_0x844e('0xe0'));db[_0x844e('0xe1')]=db[_0x844e('0x4')][_0x844e('0x14')]('../api/team/team.model');db[_0x844e('0xe2')]=db[_0x844e('0x4')][_0x844e('0x14')](_0x844e('0xe3'));db[_0x844e('0xe4')]=db[_0x844e('0x4')]['import'](_0x844e('0xe5'));db[_0x844e('0xe6')]=db[_0x844e('0x4')][_0x844e('0x14')](_0x844e('0xe7'));db[_0x844e('0xe8')]=db[_0x844e('0x4')]['import']('../api/attachment/attachment.model');db['Plugin']=db[_0x844e('0x4')][_0x844e('0x14')](_0x844e('0xe9'));db[_0x844e('0xea')]=db[_0x844e('0x4')][_0x844e('0x14')](_0x844e('0xeb'));db[_0x844e('0xec')]=db[_0x844e('0x4')]['import']('../api/chatTransferReport/chatTransferReport.model');db[_0x844e('0xed')]=db['sequelize'][_0x844e('0x14')]('../api/faxTransferReport/faxTransferReport.model');db[_0x844e('0xee')]=db[_0x844e('0x4')][_0x844e('0x14')](_0x844e('0xef'));db[_0x844e('0xf0')]=db[_0x844e('0x4')]['import']('../api/smsTransferReport/smsTransferReport.model');db['CmList']=db[_0x844e('0x4')][_0x844e('0x14')](_0x844e('0xf1'));db[_0x844e('0xf2')]=db['sequelize']['import']('../api/voicePrefix/voicePrefix.model');db[_0x844e('0xf3')]=db[_0x844e('0x4')][_0x844e('0x14')](_0x844e('0xf4'));db[_0x844e('0xf5')]=db[_0x844e('0x4')][_0x844e('0x14')]('../api/userProfileSection/userProfileSection.model');db[_0x844e('0xf6')]=db[_0x844e('0x4')][_0x844e('0x14')]('../api/userProfileResource/userProfileResource.model');db[_0x844e('0xf7')]=db[_0x844e('0x4')][_0x844e('0x14')]('../api/notification/notification.model');db['WhatsappAccount']=db[_0x844e('0x4')]['import']('../api/whatsappAccount/whatsappAccount.model');db[_0x844e('0xf8')]=db[_0x844e('0x4')]['import'](_0x844e('0xf9'));db[_0x844e('0xfa')]=db[_0x844e('0x4')]['import'](_0x844e('0xfb'));db[_0x844e('0xfc')]=db[_0x844e('0x4')][_0x844e('0x14')]('../api/whatsappMessage/whatsappMessage.model');db[_0x844e('0xfd')]=db[_0x844e('0x4')][_0x844e('0x14')](_0x844e('0xfe'));db['WhatsappTransferReport']=db[_0x844e('0x4')][_0x844e('0x14')]('../api/whatsappTransferReport/whatsappTransferReport.model');db['WhatsappQueue']=db[_0x844e('0x4')][_0x844e('0x14')](_0x844e('0xff'));db['CloudProvider']=db[_0x844e('0x4')][_0x844e('0x14')](_0x844e('0x100'));db['User'][_0x844e('0x101')](db[_0x844e('0x1e')],{'as':'VoiceMail','onDelete':_0x844e('0x102'),'foreignKey':_0x844e('0x103')});db[_0x844e('0x13')]['hasMany'](db[_0x844e('0x1c')],{'as':_0x844e('0x104'),'foreignKey':'UserId'});db[_0x844e('0x13')][_0x844e('0x105')](db[_0x844e('0x2c')],{'as':_0x844e('0x106'),'foreignKey':'UserId'});db[_0x844e('0x13')]['hasMany'](db[_0x844e('0x18')],{'as':_0x844e('0x107'),'onDelete':_0x844e('0x102'),'hooks':!![]});db['User'][_0x844e('0x105')](db['CmHopperFinal'],{'as':_0x844e('0x108'),'foreignKey':_0x844e('0x103')});db[_0x844e('0x13')]['hasMany'](db[_0x844e('0x7a')],{'as':_0x844e('0x109'),'foreignKey':_0x844e('0x103')});db[_0x844e('0x13')][_0x844e('0x105')](db[_0x844e('0x7c')],{'as':_0x844e('0x7c'),'foreignKey':_0x844e('0x103')});db[_0x844e('0x13')][_0x844e('0x105')](db[_0x844e('0x10a')],{'as':_0x844e('0x10b'),'foreignKey':_0x844e('0x103')});db[_0x844e('0x13')][_0x844e('0x105')](db[_0x844e('0x10c')],{'as':'ChatInteractions','foreignKey':_0x844e('0x103')});db[_0x844e('0x13')][_0x844e('0x105')](db['SmsInteraction'],{'as':'SmsInteractions','foreignKey':_0x844e('0x103')});db[_0x844e('0x13')][_0x844e('0x105')](db[_0x844e('0x4e')],{'as':_0x844e('0x10d'),'foreignKey':'UserId'});db[_0x844e('0x13')][_0x844e('0x105')](db[_0x844e('0x41')],{'as':'MailInteractions','foreignKey':'UserId'});db[_0x844e('0x13')][_0x844e('0x105')](db['WhatsappInteraction'],{'as':'WhatsappInteractions','foreignKey':_0x844e('0x103')});db[_0x844e('0x13')][_0x844e('0x105')](db['Notification'],{'as':_0x844e('0x10e'),'foreignKey':_0x844e('0x10f')});db['User']['belongsTo'](db['UserProfile'],{'as':'UserProfile','foreignKey':'userProfileId'});db[_0x844e('0x13')][_0x844e('0x110')](db[_0x844e('0x71')],{'as':_0x844e('0x111'),'through':'chat_group_has_users'});db['User'][_0x844e('0x110')](db['CmContact'],{'as':_0x844e('0x112'),'through':_0x844e('0x113')});db[_0x844e('0x13')][_0x844e('0x110')](db['CmList'],{'as':'Lists','through':_0x844e('0x114')});db['User'][_0x844e('0x110')](db['Team'],{'through':'user_has_teams'});db[_0x844e('0x13')][_0x844e('0x110')](db['MailInteraction'],{'as':_0x844e('0x115'),'through':'user_has_mail_interactions'});db[_0x844e('0x13')][_0x844e('0x110')](db[_0x844e('0x10c')],{'as':_0x844e('0x116'),'through':'user_has_chat_interactions'});db[_0x844e('0x13')][_0x844e('0x110')](db[_0x844e('0x4e')],{'as':'FaxInteractions','through':'user_has_fax_interactions'});db[_0x844e('0x13')][_0x844e('0x110')](db[_0x844e('0x58')],{'as':_0x844e('0x117'),'through':_0x844e('0x118')});db[_0x844e('0x13')][_0x844e('0x110')](db[_0x844e('0x10a')],{'as':_0x844e('0x10b'),'through':'user_has_openchannel_interactions'});db[_0x844e('0x13')]['belongsToMany'](db[_0x844e('0xfa')],{'as':_0x844e('0x119'),'through':'user_has_whatsapp_interactions'});db[_0x844e('0x13')][_0x844e('0x110')](db[_0x844e('0x11a')],{'as':_0x844e('0x11b'),'through':'UserVoiceQueue','required':![]});db['User'][_0x844e('0x110')](db[_0x844e('0x3f')],{'as':'MailQueues','through':_0x844e('0x32'),'required':![]});db[_0x844e('0x13')]['belongsToMany'](db[_0x844e('0x70')],{'as':_0x844e('0x11c'),'through':'UserChatQueue','required':![],'hooks':!![]});db['User'][_0x844e('0x110')](db[_0x844e('0x51')],{'as':_0x844e('0x11d'),'through':_0x844e('0x11e'),'required':![]});db['User'][_0x844e('0x110')](db[_0x844e('0x11f')],{'as':_0x844e('0x120'),'through':_0x844e('0x35'),'required':![]});db[_0x844e('0x13')]['belongsToMany'](db['OpenchannelQueue'],{'as':'OpenchannelQueues','through':_0x844e('0x121'),'required':![]});db[_0x844e('0x13')]['belongsToMany'](db[_0x844e('0x122')],{'as':_0x844e('0x123'),'through':_0x844e('0x38'),'required':![]});db['User'][_0x844e('0x110')](db[_0x844e('0x124')],{'through':_0x844e('0x114')});db[_0x844e('0x13')][_0x844e('0x110')](db[_0x844e('0xf2')],{'as':'VoicePrefixes','through':_0x844e('0x125'),'required':![]});db[_0x844e('0x13')][_0x844e('0x110')](db[_0x844e('0x65')],{'as':_0x844e('0x126'),'through':_0x844e('0x127')});db[_0x844e('0x13')][_0x844e('0x110')](db[_0x844e('0x128')],{'as':_0x844e('0x129'),'through':_0x844e('0x12a')});db[_0x844e('0x13')][_0x844e('0x110')](db[_0x844e('0x3d')],{'as':'MailAccounts','through':_0x844e('0x12b')});db[_0x844e('0x13')][_0x844e('0x110')](db[_0x844e('0x12c')],{'as':_0x844e('0x12d'),'through':_0x844e('0x12e')});db[_0x844e('0x13')][_0x844e('0x110')](db[_0x844e('0x54')],{'as':_0x844e('0x12f'),'through':'user_has_sms_accounts'});db[_0x844e('0x13')]['belongsToMany'](db[_0x844e('0x130')],{'as':_0x844e('0x131'),'through':_0x844e('0x132')});db[_0x844e('0x13')][_0x844e('0x110')](db[_0x844e('0xdc')],{'as':_0x844e('0x133'),'through':_0x844e('0x134')});db[_0x844e('0x16')][_0x844e('0x105')](db['VoiceExtension'],{'as':_0x844e('0x135'),'onDelete':'cascade','foreignKey':'ChanSpyId'});db[_0x844e('0x17')]['hasMany'](db[_0x844e('0x18')],{'onDelete':'cascade'});db[_0x844e('0x18')]['hasMany'](db[_0x844e('0x18')],{'as':'Applications','onDelete':_0x844e('0x102')});db[_0x844e('0x1a')]['belongsToMany'](db[_0x844e('0x136')],{'as':_0x844e('0x137'),'through':_0x844e('0x138')});db['VoiceQueue'][_0x844e('0x105')](db[_0x844e('0x2c')],{'as':_0x844e('0x139'),'foreignKey':_0x844e('0x13a')});db[_0x844e('0x11a')]['hasMany'](db['CmHopper'],{'as':_0x844e('0x13b'),'foreignKey':_0x844e('0x13a')});db[_0x844e('0x11a')][_0x844e('0x105')](db[_0x844e('0x13c')],{'as':_0x844e('0x108'),'foreignKey':_0x844e('0x13a')});db[_0x844e('0x11a')][_0x844e('0x105')](db[_0x844e('0x7a')],{'as':_0x844e('0x13d'),'foreignKey':_0x844e('0x13a')});db[_0x844e('0x11a')]['hasMany'](db['ReportAgentPreview'],{'as':_0x844e('0x7c'),'foreignKey':'VoiceQueueId'});db[_0x844e('0x11a')]['hasMany'](db[_0x844e('0x13e')],{'as':'HopperBlacks','foreignKey':_0x844e('0x13a')});db[_0x844e('0x11a')][_0x844e('0x105')](db[_0x844e('0xd2')],{'as':'JscriptySessions','foreignKey':_0x844e('0x13a')});db[_0x844e('0x11a')][_0x844e('0x13f')](db[_0x844e('0x28')],{'as':_0x844e('0x28'),'foreignKey':_0x844e('0x140')});db[_0x844e('0x11a')][_0x844e('0x13f')](db[_0x844e('0x28')],{'as':_0x844e('0x141'),'foreignKey':_0x844e('0x142')});db[_0x844e('0x11a')][_0x844e('0x13f')](db[_0x844e('0x143')],{'as':_0x844e('0x143'),'foreignKey':'IntervalId'});db[_0x844e('0x11a')][_0x844e('0x13f')](db[_0x844e('0x144')],{'as':_0x844e('0x145'),'foreignKey':_0x844e('0x146')});db[_0x844e('0x11a')][_0x844e('0x110')](db['CmList'],{'as':_0x844e('0x147'),'through':_0x844e('0x148')});db[_0x844e('0x11a')]['belongsToMany'](db[_0x844e('0x13')],{'as':_0x844e('0x149'),'through':_0x844e('0x2e')});db[_0x844e('0x11a')]['belongsToMany'](db[_0x844e('0xe1')],{'as':_0x844e('0x14a'),'through':_0x844e('0x14b')});db[_0x844e('0x11a')]['belongsToMany'](db[_0x844e('0x124')],{'as':'BlackLists','through':_0x844e('0x14c')});db[_0x844e('0x1c')]['belongsTo'](db[_0x844e('0x13')],{'as':_0x844e('0x13'),'foreignKey':_0x844e('0x103')});db['ScreenRecording'][_0x844e('0x13f')](db[_0x844e('0x13')],{'as':'User','foreignKey':_0x844e('0x103')});db[_0x844e('0x1e')][_0x844e('0x105')](db[_0x844e('0x20')],{'as':_0x844e('0x14d'),'onDelete':_0x844e('0x102'),'foreignKey':_0x844e('0x14e'),'sourceKey':'mailbox'});db[_0x844e('0x20')][_0x844e('0x13f')](db[_0x844e('0x1e')],{'foreignKey':_0x844e('0x14e'),'targetKey':_0x844e('0x14f')});db[_0x844e('0x22')]['hasMany'](db[_0x844e('0x25')],{'as':_0x844e('0x150'),'foreignKey':_0x844e('0x151'),'constraints':![]});db[_0x844e('0x22')][_0x844e('0x105')](db[_0x844e('0x24')],{'as':'AgentReports','foreignKey':'uniqueid','constraints':![]});db['VoiceCallReport'][_0x844e('0x13f')](db[_0x844e('0x13')],{'as':_0x844e('0x13'),'foreignKey':_0x844e('0x103')});db[_0x844e('0x22')][_0x844e('0x13f')](db[_0x844e('0x75')],{'as':_0x844e('0x152'),'foreignKey':_0x844e('0x153')});db[_0x844e('0x3a')][_0x844e('0x13f')](db['MailAccount'],{'as':'MailAccount','foreignKey':'MailAccountId'});db[_0x844e('0x154')][_0x844e('0x13f')](db['MailAccount'],{'as':_0x844e('0x3d'),'foreignKey':'MailAccountId'});db[_0x844e('0x3d')][_0x844e('0x101')](db['MailServerIn'],{'as':'Imap','onDelete':_0x844e('0x102')});db[_0x844e('0x3d')][_0x844e('0x101')](db['MailServerOut'],{'as':_0x844e('0x155'),'onDelete':_0x844e('0x102')});db[_0x844e('0x3d')]['hasMany'](db[_0x844e('0x156')],{'as':_0x844e('0x157'),'foreignKey':'MailAccountId'});db['MailAccount'][_0x844e('0x105')](db[_0x844e('0x83')],{'as':'Answers','foreignKey':_0x844e('0x158')});db[_0x844e('0x3d')]['hasMany'](db[_0x844e('0x43')],{'as':'Messages','foreignKey':'MailAccountId'});db['MailAccount']['hasMany'](db['MailInteraction'],{'as':'Interactions'});db['MailAccount'][_0x844e('0x105')](db[_0x844e('0x45')],{'as':_0x844e('0x159')});db[_0x844e('0x3d')][_0x844e('0x13f')](db[_0x844e('0x124')],{'as':_0x844e('0x15a'),'foreignKey':_0x844e('0x15b')});db[_0x844e('0x3d')][_0x844e('0x13f')](db[_0x844e('0x15c')],{'as':'Template','foreignKey':_0x844e('0x15d')});db[_0x844e('0x3d')][_0x844e('0x13f')](db['Pause'],{'as':'mandatoryDispositionPause','foreignKey':_0x844e('0x146')});db[_0x844e('0x3d')][_0x844e('0x110')](db['User'],{'as':'Agents','through':_0x844e('0x12b')});db[_0x844e('0x3f')][_0x844e('0x110')](db[_0x844e('0x13')],{'as':_0x844e('0x149'),'through':'UserMailQueue'});db[_0x844e('0x3f')][_0x844e('0x110')](db[_0x844e('0xe1')],{'through':_0x844e('0x15e'),'as':_0x844e('0x14a')});db[_0x844e('0x41')][_0x844e('0x105')](db[_0x844e('0x43')],{'as':'Messages','onDelete':_0x844e('0x102'),'foreignKey':_0x844e('0x15f')});db[_0x844e('0x41')][_0x844e('0x13f')](db['MailAccount'],{'as':_0x844e('0x160'),'foreignKey':_0x844e('0x158')});db['MailInteraction']['belongsTo'](db[_0x844e('0x75')],{'as':_0x844e('0x152'),'foreignKey':_0x844e('0x153')});db[_0x844e('0x41')][_0x844e('0x13f')](db[_0x844e('0x13')],{'as':_0x844e('0x161'),'foreignKey':'UserId'});db[_0x844e('0x41')][_0x844e('0x110')](db[_0x844e('0x8d')],{'through':_0x844e('0x162'),'as':_0x844e('0x163')});db[_0x844e('0x41')][_0x844e('0x110')](db[_0x844e('0x8d')],{'through':_0x844e('0x162'),'as':'ThroughTags'});db[_0x844e('0x41')][_0x844e('0x110')](db[_0x844e('0x13')],{'as':_0x844e('0x164'),'through':_0x844e('0x165'),'foreignKey':_0x844e('0x15f')});db[_0x844e('0x43')][_0x844e('0x105')](db[_0x844e('0xe8')],{'as':'Attachments','onDelete':'cascade'});db['MailMessage'][_0x844e('0x13f')](db[_0x844e('0x13')],{'as':_0x844e('0x13')});db[_0x844e('0x43')]['belongsTo'](db[_0x844e('0x75')],{'onDelete':_0x844e('0x102'),'as':_0x844e('0x152')});db[_0x844e('0x43')]['belongsTo'](db[_0x844e('0x41')],{'as':_0x844e('0x166'),'foreignKey':_0x844e('0x15f')});db[_0x844e('0x43')][_0x844e('0x13f')](db[_0x844e('0x3d')],{'as':_0x844e('0x160'),'foreignKey':_0x844e('0x158')});db[_0x844e('0x45')]['belongsTo'](db[_0x844e('0x13')],{'onDelete':_0x844e('0x167')});db[_0x844e('0x45')][_0x844e('0x13f')](db[_0x844e('0x3f')],{'onDelete':_0x844e('0x167')});db['MailApplication'][_0x844e('0x13f')](db[_0x844e('0x3d')],{'onDelete':_0x844e('0x167')});db[_0x844e('0x45')][_0x844e('0x13f')](db['Interval'],{'onDelete':_0x844e('0x167'),'foreignKey':_0x844e('0x168')});db[_0x844e('0x45')][_0x844e('0x13f')](db[_0x844e('0x8d')],{'onDelete':_0x844e('0x167'),'foreignKey':'TagId'});db['MailQueueReport']['belongsTo'](db[_0x844e('0x3d')],{});db[_0x844e('0x47')]['belongsTo'](db[_0x844e('0x124')],{'as':_0x844e('0x15a'),'foreignKey':_0x844e('0x15b')});db['MailQueueReport'][_0x844e('0x13f')](db[_0x844e('0x75')],{'as':_0x844e('0x152'),'foreignKey':_0x844e('0x153')});db[_0x844e('0x47')]['belongsTo'](db[_0x844e('0x41')],{});db[_0x844e('0x47')]['belongsTo'](db[_0x844e('0x43')],{});db[_0x844e('0x47')]['belongsTo'](db[_0x844e('0x13')],{});db[_0x844e('0x47')]['belongsTo'](db[_0x844e('0x3f')],{});db[_0x844e('0x49')][_0x844e('0x105')](db[_0x844e('0x4b')],{'as':_0x844e('0x169'),'onDelete':_0x844e('0x102')});db[_0x844e('0x128')][_0x844e('0x105')](db[_0x844e('0x156')],{'as':_0x844e('0x157'),'foreignKey':_0x844e('0x16a')});db[_0x844e('0x128')][_0x844e('0x105')](db[_0x844e('0x83')],{'as':'Answers','foreignKey':_0x844e('0x16a')});db[_0x844e('0x128')]['hasMany'](db[_0x844e('0x4e')],{'as':_0x844e('0x16b')});db[_0x844e('0x128')][_0x844e('0x105')](db[_0x844e('0x4d')],{'as':_0x844e('0x159')});db['FaxAccount'][_0x844e('0x105')](db['VoiceExtension'],{'as':_0x844e('0x16c'),'onDelete':_0x844e('0x102')});db[_0x844e('0x128')][_0x844e('0x105')](db[_0x844e('0x50')],{'as':_0x844e('0x14d')});db[_0x844e('0x128')]['belongsTo'](db[_0x844e('0x28')],{'as':'Trunk'});db['FaxAccount']['belongsTo'](db[_0x844e('0x124')],{'as':_0x844e('0x15a'),'foreignKey':_0x844e('0x15b')});db['FaxAccount'][_0x844e('0x13f')](db[_0x844e('0x144')],{'as':_0x844e('0x145'),'foreignKey':_0x844e('0x146')});db[_0x844e('0x128')][_0x844e('0x110')](db[_0x844e('0x13')],{'as':'Agents','through':'user_has_fax_accounts'});db[_0x844e('0x4d')]['belongsTo'](db[_0x844e('0x13')],{'onDelete':_0x844e('0x167')});db[_0x844e('0x4d')][_0x844e('0x13f')](db['FaxQueue'],{'onDelete':_0x844e('0x167')});db[_0x844e('0x4d')][_0x844e('0x13f')](db[_0x844e('0x128')],{'onDelete':_0x844e('0x167')});db[_0x844e('0x4d')]['belongsTo'](db['Tag'],{'onDelete':_0x844e('0x167'),'foreignKey':'TagId'});db[_0x844e('0x4e')]['hasMany'](db[_0x844e('0x50')],{'as':_0x844e('0x14d'),'onDelete':'cascade','foreignKey':_0x844e('0x16d')});db[_0x844e('0x4e')][_0x844e('0x13f')](db[_0x844e('0x128')],{'as':_0x844e('0x160'),'foreignKey':_0x844e('0x16a')});db['FaxInteraction']['belongsTo'](db['CmContact'],{'as':'Contact','foreignKey':_0x844e('0x153')});db[_0x844e('0x4e')][_0x844e('0x13f')](db['User'],{'as':_0x844e('0x161'),'foreignKey':_0x844e('0x103')});db[_0x844e('0x4e')][_0x844e('0x110')](db['Tag'],{'through':_0x844e('0x16e'),'as':_0x844e('0x163')});db['FaxInteraction'][_0x844e('0x110')](db[_0x844e('0x8d')],{'through':_0x844e('0x16e'),'as':'ThroughTags'});db[_0x844e('0x4e')][_0x844e('0x110')](db[_0x844e('0x13')],{'as':'Users','through':_0x844e('0x16f'),'foreignKey':'FaxInteractionId'});db[_0x844e('0x50')][_0x844e('0x13f')](db[_0x844e('0x13')],{'onDelete':_0x844e('0x102'),'as':_0x844e('0x13')});db[_0x844e('0x50')][_0x844e('0x13f')](db[_0x844e('0x4e')],{'as':_0x844e('0x166'),'foreignKey':_0x844e('0x16d')});db[_0x844e('0x50')][_0x844e('0x13f')](db['CmContact'],{'onDelete':_0x844e('0x102'),'as':_0x844e('0x152')});db['FaxMessage'][_0x844e('0x13f')](db[_0x844e('0xe8')],{'as':_0x844e('0xe8'),'foreignKey':_0x844e('0x170')});db[_0x844e('0x50')][_0x844e('0x13f')](db[_0x844e('0x128')],{'as':_0x844e('0x160'),'foreignKey':'FaxAccountId'});db[_0x844e('0x51')]['belongsToMany'](db[_0x844e('0x13')],{'as':_0x844e('0x149'),'through':_0x844e('0x11e')});db[_0x844e('0x51')][_0x844e('0x110')](db['Team'],{'through':_0x844e('0x171'),'as':'Teams'});db[_0x844e('0x52')][_0x844e('0x13f')](db[_0x844e('0x128')],{});db['FaxQueueReport'][_0x844e('0x13f')](db[_0x844e('0x124')],{'as':_0x844e('0x15a'),'foreignKey':_0x844e('0x15b')});db[_0x844e('0x52')]['belongsTo'](db['CmContact'],{'as':_0x844e('0x152'),'foreignKey':_0x844e('0x153')});db[_0x844e('0x52')][_0x844e('0x13f')](db[_0x844e('0x4e')],{});db[_0x844e('0x52')][_0x844e('0x13f')](db[_0x844e('0x50')],{});db[_0x844e('0x52')]['belongsTo'](db[_0x844e('0x13')],{});db['FaxQueueReport'][_0x844e('0x13f')](db[_0x844e('0x51')],{});db['SmsAccount'][_0x844e('0x105')](db[_0x844e('0x156')],{'as':_0x844e('0x157'),'foreignKey':_0x844e('0x172')});db[_0x844e('0x54')]['hasMany'](db[_0x844e('0x83')],{'as':'Answers','foreignKey':_0x844e('0x172')});db[_0x844e('0x54')]['hasMany'](db['SmsMessage'],{'as':_0x844e('0x14d'),'foreignKey':_0x844e('0x172')});db[_0x844e('0x54')][_0x844e('0x105')](db['SmsInteraction'],{'as':_0x844e('0x16b')});db[_0x844e('0x54')][_0x844e('0x105')](db[_0x844e('0x56')],{'as':_0x844e('0x159')});db['SmsAccount'][_0x844e('0x13f')](db[_0x844e('0x124')],{'as':_0x844e('0x15a'),'foreignKey':'ListId'});db[_0x844e('0x54')]['belongsTo'](db[_0x844e('0x144')],{'as':_0x844e('0x145'),'foreignKey':_0x844e('0x146')});db[_0x844e('0x54')]['belongsToMany'](db[_0x844e('0x13')],{'as':_0x844e('0x149'),'through':_0x844e('0x173')});db[_0x844e('0x56')][_0x844e('0x13f')](db[_0x844e('0x13')],{'onDelete':'restrict'});db[_0x844e('0x56')]['belongsTo'](db[_0x844e('0x11f')],{'onDelete':'restrict'});db[_0x844e('0x56')][_0x844e('0x13f')](db[_0x844e('0x54')],{'onDelete':_0x844e('0x167')});db[_0x844e('0x56')][_0x844e('0x13f')](db[_0x844e('0x143')],{'onDelete':'restrict','foreignKey':_0x844e('0x168')});db['SmsApplication'][_0x844e('0x13f')](db['Tag'],{'onDelete':_0x844e('0x167'),'foreignKey':_0x844e('0x174')});db[_0x844e('0x58')][_0x844e('0x105')](db[_0x844e('0x5a')],{'as':'Messages','onDelete':'cascade','foreignKey':_0x844e('0x175')});db['SmsInteraction'][_0x844e('0x13f')](db['SmsAccount'],{'as':_0x844e('0x160'),'foreignKey':_0x844e('0x172')});db[_0x844e('0x58')]['belongsTo'](db[_0x844e('0x75')],{'as':'Contact','foreignKey':_0x844e('0x153')});db[_0x844e('0x58')][_0x844e('0x13f')](db[_0x844e('0x13')],{'as':_0x844e('0x161'),'foreignKey':_0x844e('0x103')});db[_0x844e('0x58')][_0x844e('0x110')](db[_0x844e('0x8d')],{'through':_0x844e('0x176'),'as':_0x844e('0x163')});db['SmsInteraction'][_0x844e('0x110')](db['Tag'],{'through':_0x844e('0x176'),'as':'ThroughTags'});db[_0x844e('0x58')][_0x844e('0x110')](db[_0x844e('0x13')],{'as':_0x844e('0x164'),'through':_0x844e('0x118'),'foreignKey':_0x844e('0x175')});db[_0x844e('0x5a')]['belongsTo'](db[_0x844e('0x13')],{'as':_0x844e('0x13')});db[_0x844e('0x5a')][_0x844e('0x13f')](db[_0x844e('0x75')],{'onDelete':_0x844e('0x102'),'as':_0x844e('0x152')});db[_0x844e('0x5a')]['belongsTo'](db[_0x844e('0x58')],{'onDelete':_0x844e('0x102'),'as':'Interaction','foreignKey':_0x844e('0x175')});db[_0x844e('0x5a')][_0x844e('0x13f')](db[_0x844e('0x54')],{'as':_0x844e('0x160'),'foreignKey':'SmsAccountId'});db[_0x844e('0x11f')][_0x844e('0x110')](db[_0x844e('0x13')],{'as':_0x844e('0x149'),'through':_0x844e('0x35'),'foreignKey':_0x844e('0x177')});db[_0x844e('0x11f')]['belongsToMany'](db[_0x844e('0xe1')],{'through':_0x844e('0x178'),'as':'Teams'});db['OpenchannelAccount'][_0x844e('0x105')](db['Disposition'],{'as':_0x844e('0x157'),'foreignKey':'OpenchannelAccountId'});db[_0x844e('0x12c')][_0x844e('0x105')](db['CannedAnswer'],{'as':'Answers','foreignKey':'OpenchannelAccountId'});db[_0x844e('0x12c')][_0x844e('0x105')](db[_0x844e('0x10a')],{'as':_0x844e('0x16b'),'foreignKey':_0x844e('0x179')});db[_0x844e('0x12c')][_0x844e('0x105')](db[_0x844e('0x61')],{'as':_0x844e('0x14d'),'foreignKey':_0x844e('0x179')});db['OpenchannelAccount'][_0x844e('0x105')](db[_0x844e('0x5e')],{'as':_0x844e('0x159'),'foreignKey':_0x844e('0x179')});db[_0x844e('0x12c')]['belongsTo'](db[_0x844e('0x124')],{'as':_0x844e('0x15a'),'foreignKey':_0x844e('0x15b')});db[_0x844e('0x12c')][_0x844e('0x13f')](db[_0x844e('0x144')],{'as':_0x844e('0x145'),'foreignKey':_0x844e('0x146')});db[_0x844e('0x12c')]['belongsToMany'](db[_0x844e('0x13')],{'as':_0x844e('0x149'),'through':_0x844e('0x12e')});db[_0x844e('0x5e')][_0x844e('0x13f')](db['User'],{'onDelete':'restrict'});db[_0x844e('0x5e')][_0x844e('0x13f')](db[_0x844e('0x63')],{'onDelete':'restrict','foreignKey':_0x844e('0x17a')});db[_0x844e('0x5e')]['belongsTo'](db[_0x844e('0x12c')],{'onDelete':_0x844e('0x167'),'foreignKey':_0x844e('0x179')});db[_0x844e('0x5e')][_0x844e('0x13f')](db[_0x844e('0x143')],{'onDelete':_0x844e('0x167'),'foreignKey':_0x844e('0x168')});db[_0x844e('0x5e')][_0x844e('0x13f')](db[_0x844e('0x8d')],{'onDelete':_0x844e('0x167'),'foreignKey':_0x844e('0x174')});db[_0x844e('0x10a')][_0x844e('0x105')](db['OpenchannelMessage'],{'as':_0x844e('0x14d'),'onDelete':_0x844e('0x102'),'foreignKey':_0x844e('0x17b')});db[_0x844e('0x10a')][_0x844e('0x13f')](db[_0x844e('0x12c')],{'as':_0x844e('0x160'),'foreignKey':_0x844e('0x179')});db[_0x844e('0x10a')][_0x844e('0x13f')](db['CmContact'],{'as':_0x844e('0x152'),'foreignKey':_0x844e('0x153')});db['OpenchannelInteraction']['belongsTo'](db[_0x844e('0x13')],{'as':_0x844e('0x161'),'foreignKey':'UserId'});db[_0x844e('0x10a')][_0x844e('0x110')](db[_0x844e('0x8d')],{'through':_0x844e('0x17c'),'as':'Tags'});db[_0x844e('0x10a')][_0x844e('0x110')](db[_0x844e('0x8d')],{'through':'openchannel_interaction_has_tags','as':_0x844e('0x17d')});db[_0x844e('0x10a')][_0x844e('0x110')](db[_0x844e('0x13')],{'as':_0x844e('0x164'),'through':_0x844e('0x17e'),'foreignKey':_0x844e('0x17b')});db[_0x844e('0x61')]['belongsTo'](db['User'],{'onDelete':_0x844e('0x102'),'as':_0x844e('0x13')});db[_0x844e('0x61')][_0x844e('0x13f')](db['CmContact'],{'onDelete':_0x844e('0x102'),'as':_0x844e('0x152')});db[_0x844e('0x61')][_0x844e('0x13f')](db['OpenchannelInteraction'],{'onDelete':_0x844e('0x102'),'as':_0x844e('0x166'),'foreignKey':'OpenchannelInteractionId'});db[_0x844e('0x61')]['belongsTo'](db['Attachment'],{'as':'Attachment','foreignKey':_0x844e('0x170')});db['OpenchannelMessage'][_0x844e('0x13f')](db[_0x844e('0x12c')],{'as':_0x844e('0x160'),'foreignKey':_0x844e('0x179')});db['OpenchannelQueue']['belongsToMany'](db[_0x844e('0x13')],{'as':_0x844e('0x149'),'through':_0x844e('0x121'),'foreignKey':_0x844e('0x17a')});db[_0x844e('0x63')]['belongsToMany'](db[_0x844e('0xe1')],{'through':_0x844e('0x17f'),'as':_0x844e('0x14a')});db[_0x844e('0x65')][_0x844e('0x105')](db[_0x844e('0x156')],{'as':_0x844e('0x157'),'foreignKey':'ChatWebsiteId'});db[_0x844e('0x65')][_0x844e('0x105')](db[_0x844e('0x83')],{'as':_0x844e('0x180'),'foreignKey':_0x844e('0x181')});db[_0x844e('0x65')][_0x844e('0x105')](db[_0x844e('0x182')],{'as':_0x844e('0x183')});db['ChatWebsite'][_0x844e('0x105')](db['ChatInteraction'],{'as':'Interactions'});db[_0x844e('0x65')][_0x844e('0x105')](db[_0x844e('0x69')],{'as':_0x844e('0x159')});db['ChatWebsite'][_0x844e('0x105')](db[_0x844e('0x6c')],{'as':_0x844e('0x14d')});db['ChatWebsite']['belongsTo'](db['CmList'],{'as':_0x844e('0x15a'),'foreignKey':_0x844e('0x15b')});db[_0x844e('0x65')][_0x844e('0x13f')](db[_0x844e('0x143')],{'as':'Interval','foreignKey':_0x844e('0x168')});db[_0x844e('0x65')][_0x844e('0x13f')](db[_0x844e('0x144')],{'as':_0x844e('0x145'),'foreignKey':_0x844e('0x146')});db[_0x844e('0x65')][_0x844e('0x110')](db['User'],{'as':_0x844e('0x149'),'through':_0x844e('0x127')});db[_0x844e('0x67')][_0x844e('0x13f')](db[_0x844e('0x12c')],{});db[_0x844e('0x67')]['belongsTo'](db[_0x844e('0x124')],{'as':_0x844e('0x15a'),'foreignKey':_0x844e('0x15b')});db[_0x844e('0x67')][_0x844e('0x13f')](db[_0x844e('0x75')],{'as':_0x844e('0x152'),'foreignKey':'ContactId'});db[_0x844e('0x67')][_0x844e('0x13f')](db[_0x844e('0x10a')],{});db[_0x844e('0x67')][_0x844e('0x13f')](db[_0x844e('0x61')],{});db[_0x844e('0x67')][_0x844e('0x13f')](db[_0x844e('0x13')],{});db[_0x844e('0x67')][_0x844e('0x13f')](db[_0x844e('0x63')],{});db[_0x844e('0x69')][_0x844e('0x13f')](db[_0x844e('0x13')],{'as':'Agent','foreignKey':_0x844e('0x103'),'onDelete':_0x844e('0x167')});db[_0x844e('0x69')][_0x844e('0x13f')](db[_0x844e('0x70')],{'as':'Queue','foreignKey':'ChatQueueId','onDelete':_0x844e('0x167')});db[_0x844e('0x69')][_0x844e('0x13f')](db['ChatWebsite'],{'as':_0x844e('0x184'),'foreignKey':_0x844e('0x181'),'onDelete':'restrict'});db[_0x844e('0x69')][_0x844e('0x13f')](db[_0x844e('0x8d')],{'onDelete':_0x844e('0x167'),'foreignKey':_0x844e('0x174')});db[_0x844e('0x10c')][_0x844e('0x105')](db[_0x844e('0x6c')],{'as':_0x844e('0x14d'),'onDelete':_0x844e('0x102'),'foreignKey':_0x844e('0x185')});db['ChatInteraction']['belongsTo'](db[_0x844e('0x65')],{'as':_0x844e('0x160'),'foreignKey':'ChatWebsiteId'});db[_0x844e('0x10c')][_0x844e('0x13f')](db[_0x844e('0x75')],{'as':'Contact','foreignKey':_0x844e('0x153')});db['ChatInteraction'][_0x844e('0x13f')](db[_0x844e('0x13')],{'as':_0x844e('0x161'),'foreignKey':_0x844e('0x103')});db['ChatInteraction'][_0x844e('0x110')](db['Tag'],{'through':'chat_interaction_has_tags','as':_0x844e('0x163')});db[_0x844e('0x10c')][_0x844e('0x110')](db[_0x844e('0x8d')],{'through':'chat_interaction_has_tags','as':_0x844e('0x17d')});db[_0x844e('0x10c')]['belongsToMany'](db[_0x844e('0x13')],{'as':_0x844e('0x164'),'through':'user_has_chat_interactions','foreignKey':'ChatInteractionId'});db[_0x844e('0x6c')][_0x844e('0x13f')](db[_0x844e('0x13')],{'onDelete':_0x844e('0x102'),'as':_0x844e('0x13')});db[_0x844e('0x6c')][_0x844e('0x13f')](db['CmContact'],{'onDelete':_0x844e('0x102'),'as':'Contact','foreignKey':_0x844e('0x153')});db['ChatMessage'][_0x844e('0x13f')](db['ChatInteraction'],{'onDelete':_0x844e('0x102'),'as':_0x844e('0x166'),'foreignKey':'ChatInteractionId'});db[_0x844e('0x6c')][_0x844e('0x13f')](db[_0x844e('0xe8')],{'as':_0x844e('0xe8'),'foreignKey':_0x844e('0x170')});db[_0x844e('0x6c')][_0x844e('0x13f')](db[_0x844e('0x65')],{'as':_0x844e('0x160'),'foreignKey':_0x844e('0x181')});db[_0x844e('0x6e')][_0x844e('0x13f')](db[_0x844e('0x75')],{'onDelete':_0x844e('0x102'),'as':_0x844e('0x152'),'foreignKey':_0x844e('0x153')});db[_0x844e('0x6e')]['belongsTo'](db[_0x844e('0x65')],{'as':_0x844e('0x160'),'foreignKey':'ChatWebsiteId'});db[_0x844e('0x70')][_0x844e('0x110')](db['User'],{'as':'Agents','through':_0x844e('0x30'),'hooks':!![]});db[_0x844e('0x70')][_0x844e('0x110')](db[_0x844e('0xe1')],{'through':_0x844e('0x186'),'as':'Teams'});db[_0x844e('0x71')][_0x844e('0x105')](db['ChatInternalMessage'],{'as':_0x844e('0x14d'),'foreignKey':_0x844e('0x187'),'onDelete':_0x844e('0x102')});db['ChatGroup'][_0x844e('0x110')](db[_0x844e('0x13')],{'as':_0x844e('0x139'),'through':_0x844e('0x188')});db[_0x844e('0x182')]['belongsTo'](db[_0x844e('0x65')],{'as':'Website','foreignKey':_0x844e('0x181')});db[_0x844e('0x189')][_0x844e('0x105')](db[_0x844e('0x75')],{'as':'Contacts','foreignKey':'CompanyId'});db[_0x844e('0x75')]['hasMany'](db[_0x844e('0x76')],{'as':_0x844e('0x13b'),'foreignKey':_0x844e('0x153')});db[_0x844e('0x75')][_0x844e('0x105')](db[_0x844e('0x13c')],{'as':'HopperFinals','foreignKey':_0x844e('0x153')});db[_0x844e('0x75')][_0x844e('0x105')](db[_0x844e('0x7a')],{'as':_0x844e('0x13d'),'foreignKey':'ContactId'});db[_0x844e('0x75')][_0x844e('0x105')](db[_0x844e('0x7c')],{'as':_0x844e('0x7c'),'foreignKey':'ContactId'});db['CmContact'][_0x844e('0x105')](db[_0x844e('0xd2')],{'as':_0x844e('0x18a'),'foreignKey':'ContactId'});db['CmContact'][_0x844e('0x105')](db[_0x844e('0x10a')],{'as':_0x844e('0x10b'),'foreignKey':_0x844e('0x153'),'onDelete':_0x844e('0x167')});db[_0x844e('0x75')][_0x844e('0x105')](db['ChatInteraction'],{'as':_0x844e('0x116'),'foreignKey':'ContactId','onDelete':_0x844e('0x167')});db[_0x844e('0x75')][_0x844e('0x105')](db[_0x844e('0x58')],{'as':_0x844e('0x117'),'foreignKey':_0x844e('0x153'),'onDelete':_0x844e('0x167')});db['CmContact'][_0x844e('0x105')](db[_0x844e('0x4e')],{'as':'FaxInteractions','foreignKey':_0x844e('0x153'),'onDelete':_0x844e('0x167')});db[_0x844e('0x75')][_0x844e('0x105')](db[_0x844e('0x41')],{'as':_0x844e('0x115'),'foreignKey':_0x844e('0x153'),'onDelete':_0x844e('0x167')});db[_0x844e('0x75')]['belongsTo'](db[_0x844e('0x189')],{'as':_0x844e('0x18b'),'foreignKey':'CompanyId'});db['CmContact'][_0x844e('0x13f')](db[_0x844e('0x124')],{'as':'List','foreignKey':'ListId','onDelete':_0x844e('0x102')});db[_0x844e('0x75')]['belongsToMany'](db[_0x844e('0x13')],{'as':_0x844e('0x164'),'through':'cm_user_has_contacts'});db['CmContact']['belongsToMany'](db['Tag'],{'as':'Tags','through':_0x844e('0x18c')});db[_0x844e('0x75')][_0x844e('0x110')](db['Tag'],{'through':_0x844e('0x18c'),'as':_0x844e('0x17d')});db[_0x844e('0x76')]['belongsTo'](db['CmContact'],{'as':_0x844e('0x152'),'foreignKey':_0x844e('0x153'),'onDelete':_0x844e('0x102')});db[_0x844e('0x76')][_0x844e('0x13f')](db[_0x844e('0x124')],{'as':_0x844e('0x15a'),'foreignKey':'ListId','onDelete':_0x844e('0x102')});db[_0x844e('0x76')][_0x844e('0x13f')](db[_0x844e('0x13')],{'as':'Agent','foreignKey':_0x844e('0x103')});db[_0x844e('0x76')][_0x844e('0x13f')](db[_0x844e('0x11a')],{'as':_0x844e('0x18d'),'foreignKey':_0x844e('0x13a'),'onDelete':_0x844e('0x102')});db[_0x844e('0x76')][_0x844e('0x13f')](db[_0x844e('0xe4')],{'as':_0x844e('0xe4'),'foreignKey':_0x844e('0x18e'),'onDelete':_0x844e('0x102')});db['CmHopper']['belongsTo'](db[_0x844e('0x13')],{'as':_0x844e('0x161'),'foreignKey':_0x844e('0x18f')});db[_0x844e('0x13e')][_0x844e('0x13f')](db[_0x844e('0x75')],{'as':_0x844e('0x152'),'foreignKey':'ContactId','onDelete':_0x844e('0x102')});db['CmHopperBlack'][_0x844e('0x13f')](db['CmList'],{'as':_0x844e('0x15a'),'foreignKey':_0x844e('0x15b'),'onDelete':_0x844e('0x102')});db['CmHopperBlack'][_0x844e('0x13f')](db['VoiceQueue'],{'as':'Queue','foreignKey':_0x844e('0x13a'),'onDelete':'cascade'});db[_0x844e('0x13e')][_0x844e('0x13f')](db[_0x844e('0xe4')],{'as':_0x844e('0xe4'),'foreignKey':_0x844e('0x18e'),'onDelete':_0x844e('0x102')});db[_0x844e('0x81')][_0x844e('0x105')](db[_0x844e('0x85')],{'as':{'plural':_0x844e('0x190'),'singular':'OneAll'},'foreignKey':_0x844e('0x191'),'onDelete':_0x844e('0x102'),'hooks':!![]});db[_0x844e('0x81')][_0x844e('0x105')](db['Condition'],{'as':{'plural':'Any','singular':'OneAny'},'foreignKey':'AutomationAnyId','onDelete':_0x844e('0x102'),'hooks':!![]});db[_0x844e('0x81')][_0x844e('0x105')](db[_0x844e('0x80')],{'as':_0x844e('0x192'),'foreignKey':'AutomationId','onDelete':_0x844e('0x102'),'hooks':!![]});db[_0x844e('0x143')]['hasMany'](db[_0x844e('0x143')],{'as':_0x844e('0x193'),'foreignKey':'IntervalId','onDelete':_0x844e('0x102'),'hooks':!![],'required':![]});db[_0x844e('0x143')][_0x844e('0x105')](db['VoiceExtension'],{'as':_0x844e('0x107'),'foreignKey':_0x844e('0x168'),'onDelete':_0x844e('0x167')});db[_0x844e('0x143')][_0x844e('0x105')](db[_0x844e('0x45')],{'as':_0x844e('0x194'),'foreignKey':_0x844e('0x168')});db['Interval'][_0x844e('0x105')](db[_0x844e('0x69')],{'as':_0x844e('0x195'),'foreignKey':'IntervalId'});db[_0x844e('0x143')]['hasMany'](db[_0x844e('0x4d')],{'as':_0x844e('0x196'),'foreignKey':_0x844e('0x168')});db[_0x844e('0x143')]['hasMany'](db[_0x844e('0x56')],{'as':_0x844e('0x197'),'foreignKey':'IntervalId'});db[_0x844e('0x8b')][_0x844e('0x13f')](db[_0x844e('0x3d')],{});db['Schedule'][_0x844e('0x13f')](db[_0x844e('0x96')],{'foreignKey':_0x844e('0x198')});db['Schedule']['belongsTo'](db[_0x844e('0x199')],{'foreignKey':_0x844e('0x19a')});db[_0x844e('0x136')][_0x844e('0x110')](db[_0x844e('0x1a')],{'as':'Mohs','through':_0x844e('0x138'),'onDelete':'restrict'});db['Tag'][_0x844e('0x110')](db[_0x844e('0x75')],{'through':_0x844e('0x18c')});db['Tag']['belongsToMany'](db['ChatInteraction'],{'through':_0x844e('0x19b')});db[_0x844e('0x8d')][_0x844e('0x110')](db['MailInteraction'],{'through':'mail_interaction_has_tags'});db[_0x844e('0x8d')][_0x844e('0x110')](db[_0x844e('0x58')],{'through':_0x844e('0x176')});db['Tag'][_0x844e('0x110')](db[_0x844e('0x4e')],{'through':'fax_interaction_has_tags'});db[_0x844e('0x8d')][_0x844e('0x110')](db[_0x844e('0x10a')],{'through':_0x844e('0x17c')});db[_0x844e('0x8d')][_0x844e('0x110')](db[_0x844e('0xfa')],{'through':'whatsapp_interaction_has_tags'});db[_0x844e('0x8f')][_0x844e('0x105')](db[_0x844e('0x85')],{'as':{'plural':'AllConditions','singular':'AllCondition'},'foreignKey':'TriggerAllId','onDelete':_0x844e('0x102'),'hooks':!![]});db['Trigger'][_0x844e('0x105')](db['Condition'],{'as':{'plural':_0x844e('0x19c'),'singular':_0x844e('0x19d')},'foreignKey':_0x844e('0x19e'),'onDelete':_0x844e('0x102'),'hooks':!![]});db['Trigger'][_0x844e('0x105')](db[_0x844e('0x80')],{'as':'Actions','foreignKey':'TriggerId','onDelete':_0x844e('0x102'),'hooks':!![]});db[_0x844e('0x199')][_0x844e('0x105')](db[_0x844e('0x9b')],{'as':_0x844e('0x19f'),'onDelete':_0x844e('0x102'),'foreignKey':_0x844e('0x19a'),'hooks':!![]});db[_0x844e('0x96')][_0x844e('0x105')](db[_0x844e('0x9b')],{'as':_0x844e('0x19f'),'onDelete':_0x844e('0x102'),'foreignKey':_0x844e('0x198')});db['AnalyticMetric'][_0x844e('0x105')](db['AnalyticFieldReport'],{'as':_0x844e('0x19f'),'onDelete':_0x844e('0x102'),'foreignKey':'MetricId'});db[_0x844e('0x9b')]['belongsTo'](db[_0x844e('0x1a0')],{'foreignKey':_0x844e('0x1a1')});db[_0x844e('0x9e')][_0x844e('0x105')](db[_0x844e('0x9f')],{'as':_0x844e('0x1a2'),'onDelete':'cascade','foreignKey':_0x844e('0x1a3')});db[_0x844e('0x9f')][_0x844e('0x105')](db[_0x844e('0xa1')],{'as':_0x844e('0x1a4'),'onDelete':_0x844e('0x102'),'foreignKey':_0x844e('0x1a5')});db[_0x844e('0x9f')][_0x844e('0x105')](db[_0x844e('0xa1')],{'as':_0x844e('0x1a6'),'onDelete':_0x844e('0x102'),'foreignKey':_0x844e('0x1a7')});db[_0x844e('0x9f')][_0x844e('0x105')](db[_0x844e('0xa1')],{'as':_0x844e('0x19f'),'onDelete':_0x844e('0x102'),'foreignKey':'FieldId'});db[_0x844e('0x9f')][_0x844e('0x13f')](db[_0x844e('0x9e')],{'as':_0x844e('0x160'),'foreignKey':'AccountId'});db[_0x844e('0xa1')]['hasMany'](db[_0x844e('0xa1')],{'as':_0x844e('0x1a8'),'foreignKey':_0x844e('0x1a5')});db[_0x844e('0xa1')]['hasMany'](db[_0x844e('0xa1')],{'as':_0x844e('0x1a9'),'foreignKey':'DescriptionId'});db[_0x844e('0xa1')][_0x844e('0x105')](db[_0x844e('0xa1')],{'as':_0x844e('0x1aa'),'foreignKey':_0x844e('0x1ab')});db[_0x844e('0xa1')][_0x844e('0x13f')](db[_0x844e('0x90')],{'as':_0x844e('0x90'),'foreignKey':_0x844e('0x1ac')});db[_0x844e('0xa2')][_0x844e('0x105')](db['SugarcrmConfiguration'],{'as':_0x844e('0x1a2'),'onDelete':_0x844e('0x102'),'foreignKey':_0x844e('0x1a3')});db[_0x844e('0xa4')][_0x844e('0x105')](db[_0x844e('0xa6')],{'as':_0x844e('0x1a4'),'onDelete':_0x844e('0x102'),'foreignKey':_0x844e('0x1a5')});db['SugarcrmConfiguration']['hasMany'](db[_0x844e('0xa6')],{'as':_0x844e('0x1a6'),'onDelete':'cascade','foreignKey':_0x844e('0x1a7')});db[_0x844e('0xa4')]['hasMany'](db[_0x844e('0xa6')],{'as':'Fields','onDelete':_0x844e('0x102'),'foreignKey':'FieldId'});db['SugarcrmConfiguration']['belongsTo'](db['SugarcrmAccount'],{'as':_0x844e('0x160'),'foreignKey':_0x844e('0x1a3')});db[_0x844e('0xa6')][_0x844e('0x105')](db[_0x844e('0xa6')],{'as':_0x844e('0x1a8'),'foreignKey':'SubjectId'});db[_0x844e('0xa6')][_0x844e('0x105')](db[_0x844e('0xa6')],{'as':_0x844e('0x1a9'),'foreignKey':_0x844e('0x1a7')});db[_0x844e('0xa6')][_0x844e('0x105')](db[_0x844e('0xa6')],{'as':_0x844e('0x1aa'),'foreignKey':'FieldId'});db['SugarcrmField'][_0x844e('0x13f')](db[_0x844e('0x90')],{'as':_0x844e('0x90'),'foreignKey':_0x844e('0x1ac')});db[_0x844e('0x1ad')]['hasMany'](db[_0x844e('0x1ae')],{'as':_0x844e('0x1a2'),'onDelete':_0x844e('0x102'),'foreignKey':'AccountId'});db['DeskConfiguration'][_0x844e('0x105')](db[_0x844e('0xa9')],{'as':_0x844e('0x1a4'),'onDelete':_0x844e('0x102'),'foreignKey':_0x844e('0x1a5')});db[_0x844e('0x1ae')]['hasMany'](db['DeskField'],{'as':_0x844e('0x1a6'),'onDelete':_0x844e('0x102'),'foreignKey':'DescriptionId'});db[_0x844e('0x1ae')][_0x844e('0x105')](db[_0x844e('0xa9')],{'as':_0x844e('0x19f'),'onDelete':'cascade','foreignKey':_0x844e('0x1ab')});db[_0x844e('0x1ae')][_0x844e('0x13f')](db['DeskAccount'],{'as':_0x844e('0x160'),'foreignKey':'AccountId'});db[_0x844e('0x1ae')]['belongsToMany'](db['Tag'],{'through':_0x844e('0x1af')});db['DeskField'][_0x844e('0x105')](db[_0x844e('0xa9')],{'as':_0x844e('0x1a8'),'foreignKey':'SubjectId'});db[_0x844e('0xa9')][_0x844e('0x105')](db[_0x844e('0xa9')],{'as':_0x844e('0x1a9'),'foreignKey':_0x844e('0x1a7')});db['DeskField']['hasMany'](db[_0x844e('0xa9')],{'as':_0x844e('0x1aa'),'foreignKey':'FieldId'});db[_0x844e('0xa9')][_0x844e('0x13f')](db['Variable'],{'as':_0x844e('0x90'),'foreignKey':_0x844e('0x1ac')});db['ZohoAccount'][_0x844e('0x105')](db[_0x844e('0xad')],{'as':'Configurations','onDelete':_0x844e('0x102'),'foreignKey':_0x844e('0x1a3')});db[_0x844e('0xad')][_0x844e('0x105')](db[_0x844e('0xaf')],{'as':_0x844e('0x1a4'),'onDelete':_0x844e('0x102'),'foreignKey':_0x844e('0x1a5')});db[_0x844e('0xad')]['hasMany'](db[_0x844e('0xaf')],{'as':_0x844e('0x1a6'),'onDelete':_0x844e('0x102'),'foreignKey':'DescriptionId'});db['ZohoConfiguration'][_0x844e('0x105')](db['ZohoField'],{'as':_0x844e('0x19f'),'onDelete':_0x844e('0x102'),'foreignKey':_0x844e('0x1ab')});db[_0x844e('0xad')][_0x844e('0x13f')](db[_0x844e('0xab')],{'as':'Account','foreignKey':_0x844e('0x1a3')});db['ZohoField'][_0x844e('0x105')](db[_0x844e('0xaf')],{'as':_0x844e('0x1a8'),'foreignKey':'SubjectId'});db['ZohoField']['hasMany'](db[_0x844e('0xaf')],{'as':'Description','foreignKey':_0x844e('0x1a7')});db[_0x844e('0xaf')]['hasMany'](db[_0x844e('0xaf')],{'as':'Field','foreignKey':'FieldId'});db['ZohoField'][_0x844e('0x13f')](db[_0x844e('0x90')],{'as':_0x844e('0x90'),'foreignKey':_0x844e('0x1ac')});db['ZendeskAccount'][_0x844e('0x105')](db[_0x844e('0xb2')],{'as':_0x844e('0x1a2'),'onDelete':_0x844e('0x102'),'foreignKey':_0x844e('0x1a3')});db['ZendeskConfiguration']['hasMany'](db[_0x844e('0xb4')],{'as':'Subjects','foreignKey':_0x844e('0x1a5')});db['ZendeskConfiguration'][_0x844e('0x105')](db['ZendeskField'],{'as':_0x844e('0x1a6'),'foreignKey':_0x844e('0x1a7')});db['ZendeskConfiguration']['hasMany'](db['ZendeskField'],{'as':'Fields','foreignKey':_0x844e('0x1ab')});db[_0x844e('0xb2')][_0x844e('0x13f')](db['ZendeskAccount'],{'as':_0x844e('0x160'),'foreignKey':_0x844e('0x1a3')});db[_0x844e('0xb2')][_0x844e('0x110')](db['Tag'],{'through':'int_zendesk_configuration_has_tags'});db['ZendeskField'][_0x844e('0x105')](db['ZendeskField'],{'as':'Subject','foreignKey':_0x844e('0x1a5')});db[_0x844e('0xb4')][_0x844e('0x105')](db[_0x844e('0xb4')],{'as':'Description','foreignKey':_0x844e('0x1a7')});db[_0x844e('0xb4')][_0x844e('0x105')](db[_0x844e('0xb4')],{'as':_0x844e('0x1aa'),'foreignKey':_0x844e('0x1ab')});db[_0x844e('0xb4')][_0x844e('0x13f')](db['Variable'],{'as':'Variable','foreignKey':_0x844e('0x1ac')});db['FreshdeskAccount']['hasMany'](db[_0x844e('0x1b0')],{'as':_0x844e('0x1a2'),'onDelete':_0x844e('0x102'),'foreignKey':_0x844e('0x1a3')});db[_0x844e('0x1b0')][_0x844e('0x105')](db[_0x844e('0xb9')],{'as':_0x844e('0x1a4'),'onDelete':_0x844e('0x102'),'foreignKey':_0x844e('0x1a5')});db[_0x844e('0x1b0')]['hasMany'](db[_0x844e('0xb9')],{'as':_0x844e('0x1a6'),'onDelete':_0x844e('0x102'),'foreignKey':_0x844e('0x1a7')});db[_0x844e('0x1b0')][_0x844e('0x105')](db[_0x844e('0xb9')],{'as':_0x844e('0x19f'),'onDelete':_0x844e('0x102'),'foreignKey':_0x844e('0x1ab')});db[_0x844e('0x1b0')]['belongsTo'](db['FreshdeskAccount'],{'as':_0x844e('0x160'),'foreignKey':_0x844e('0x1a3')});db[_0x844e('0x1b0')][_0x844e('0x110')](db[_0x844e('0x8d')],{'through':_0x844e('0x1b1')});db[_0x844e('0xb9')][_0x844e('0x105')](db[_0x844e('0xb9')],{'as':'Subject','foreignKey':_0x844e('0x1a5')});db[_0x844e('0xb9')]['hasMany'](db[_0x844e('0xb9')],{'as':'Description','foreignKey':_0x844e('0x1a7')});db[_0x844e('0xb9')][_0x844e('0x105')](db[_0x844e('0xb9')],{'as':_0x844e('0x1aa'),'foreignKey':_0x844e('0x1ab')});db[_0x844e('0xb9')][_0x844e('0x13f')](db[_0x844e('0x90')],{'as':_0x844e('0x90'),'foreignKey':_0x844e('0x1ac')});db[_0x844e('0x1b2')][_0x844e('0x105')](db[_0x844e('0x1b3')],{'as':'Configurations','onDelete':_0x844e('0x102'),'foreignKey':_0x844e('0x1a3')});db['VtigerConfiguration']['hasMany'](db['VtigerField'],{'as':_0x844e('0x1a4'),'foreignKey':_0x844e('0x1a5')});db[_0x844e('0x1b3')]['hasMany'](db['VtigerField'],{'as':_0x844e('0x1a6'),'foreignKey':_0x844e('0x1a7')});db['VtigerConfiguration']['hasMany'](db[_0x844e('0x1b4')],{'as':_0x844e('0x19f'),'foreignKey':'FieldId'});db[_0x844e('0x1b3')][_0x844e('0x13f')](db[_0x844e('0x1b2')],{'as':'Account','foreignKey':_0x844e('0x1a3')});db['VtigerField']['hasMany'](db['VtigerField'],{'as':'Subject','foreignKey':_0x844e('0x1a5')});db[_0x844e('0x1b4')][_0x844e('0x105')](db[_0x844e('0x1b4')],{'as':_0x844e('0x1a9'),'foreignKey':_0x844e('0x1a7')});db[_0x844e('0x1b4')][_0x844e('0x105')](db[_0x844e('0x1b4')],{'as':_0x844e('0x1aa'),'foreignKey':_0x844e('0x1ab')});db[_0x844e('0x1b4')][_0x844e('0x13f')](db[_0x844e('0x90')],{'as':_0x844e('0x90'),'foreignKey':_0x844e('0x1ac')});db[_0x844e('0xbe')][_0x844e('0x105')](db[_0x844e('0xc0')],{'as':_0x844e('0x1a2'),'onDelete':'cascade','foreignKey':_0x844e('0x1a3')});db[_0x844e('0xc0')][_0x844e('0x105')](db[_0x844e('0x1b5')],{'as':_0x844e('0x1a4'),'foreignKey':_0x844e('0x1a5')});db['ServicenowConfiguration'][_0x844e('0x105')](db[_0x844e('0x1b5')],{'as':'Descriptions','foreignKey':_0x844e('0x1a7')});db['ServicenowConfiguration'][_0x844e('0x105')](db[_0x844e('0x1b5')],{'as':_0x844e('0x19f'),'foreignKey':_0x844e('0x1ab')});db[_0x844e('0xc0')][_0x844e('0x13f')](db[_0x844e('0xbe')],{'as':_0x844e('0x160'),'foreignKey':_0x844e('0x1a3')});db[_0x844e('0x1b5')]['hasMany'](db[_0x844e('0x1b5')],{'as':_0x844e('0x1a8'),'foreignKey':'SubjectId'});db[_0x844e('0x1b5')]['hasMany'](db['ServicenowField'],{'as':'Description','foreignKey':_0x844e('0x1a7')});db[_0x844e('0x1b5')][_0x844e('0x105')](db[_0x844e('0x1b5')],{'as':_0x844e('0x1aa'),'foreignKey':_0x844e('0x1ab')});db[_0x844e('0x1b5')][_0x844e('0x13f')](db[_0x844e('0x90')],{'as':_0x844e('0x90'),'foreignKey':'VariableId'});db[_0x844e('0xc3')][_0x844e('0x105')](db['Dynamics365Configuration'],{'as':_0x844e('0x1a2'),'onDelete':'cascade','foreignKey':_0x844e('0x1a3')});db['Dynamics365Configuration'][_0x844e('0x105')](db[_0x844e('0xc7')],{'as':'Subjects','onDelete':_0x844e('0x102'),'foreignKey':_0x844e('0x1a5')});db[_0x844e('0xc5')][_0x844e('0x105')](db[_0x844e('0xc7')],{'as':_0x844e('0x1a6'),'onDelete':_0x844e('0x102'),'foreignKey':_0x844e('0x1a7')});db[_0x844e('0xc5')][_0x844e('0x105')](db[_0x844e('0xc7')],{'as':_0x844e('0x19f'),'onDelete':'cascade','foreignKey':'FieldId'});db[_0x844e('0xc5')]['belongsTo'](db['Dynamics365Account'],{'as':'Account','foreignKey':'AccountId'});db[_0x844e('0xc7')][_0x844e('0x105')](db[_0x844e('0xc7')],{'as':_0x844e('0x1a8'),'foreignKey':_0x844e('0x1a5')});db['Dynamics365Field']['hasMany'](db[_0x844e('0xc7')],{'as':_0x844e('0x1a9'),'foreignKey':_0x844e('0x1a7')});db[_0x844e('0xc7')][_0x844e('0x105')](db[_0x844e('0xc7')],{'as':_0x844e('0x1aa'),'foreignKey':'FieldId'});db[_0x844e('0xc7')][_0x844e('0x13f')](db['Variable'],{'as':_0x844e('0x90'),'foreignKey':_0x844e('0x1ac')});db[_0x844e('0xc8')][_0x844e('0x105')](db[_0x844e('0x1b6')],{'as':_0x844e('0x1a2'),'onDelete':'cascade','foreignKey':_0x844e('0x1a3')});db['FreshsalesConfiguration'][_0x844e('0x105')](db['FreshsalesField'],{'as':_0x844e('0x1a4'),'foreignKey':'SubjectId'});db[_0x844e('0x1b6')]['hasMany'](db[_0x844e('0xc9')],{'as':_0x844e('0x1a6'),'foreignKey':_0x844e('0x1a7')});db[_0x844e('0x1b6')]['hasMany'](db[_0x844e('0xc9')],{'as':_0x844e('0x19f'),'foreignKey':_0x844e('0x1ab')});db[_0x844e('0x1b6')]['belongsTo'](db[_0x844e('0xc8')],{'as':_0x844e('0x160'),'foreignKey':_0x844e('0x1a3')});db['FreshsalesField']['hasMany'](db[_0x844e('0xc9')],{'as':_0x844e('0x1a8'),'foreignKey':'SubjectId'});db[_0x844e('0xc9')][_0x844e('0x105')](db['FreshsalesField'],{'as':_0x844e('0x1a9'),'foreignKey':'DescriptionId'});db['FreshsalesField']['hasMany'](db[_0x844e('0xc9')],{'as':_0x844e('0x1aa'),'foreignKey':_0x844e('0x1ab')});db[_0x844e('0xc9')][_0x844e('0x13f')](db['Variable'],{'as':_0x844e('0x90'),'foreignKey':_0x844e('0x1ac')});db[_0x844e('0x1b7')]['belongsTo'](db['ChatWebsite'],{});db[_0x844e('0x1b7')][_0x844e('0x13f')](db[_0x844e('0x124')],{'as':'List','foreignKey':'ListId'});db[_0x844e('0x1b7')][_0x844e('0x13f')](db[_0x844e('0x75')],{'as':_0x844e('0x152'),'foreignKey':_0x844e('0x153')});db[_0x844e('0x1b7')]['belongsTo'](db[_0x844e('0x10c')],{});db[_0x844e('0x1b7')][_0x844e('0x13f')](db[_0x844e('0x6c')],{});db[_0x844e('0x1b7')][_0x844e('0x13f')](db[_0x844e('0x13')],{});db[_0x844e('0x1b7')]['belongsTo'](db[_0x844e('0x70')],{});db[_0x844e('0xce')]['belongsTo'](db['User'],{'onDelete':_0x844e('0x102'),'foreignKey':_0x844e('0x1b8')});db[_0x844e('0xce')][_0x844e('0x13f')](db[_0x844e('0x13')],{'onDelete':'cascade','foreignKey':_0x844e('0x1b9')});db['JscriptySessionReport'][_0x844e('0x105')](db[_0x844e('0x1ba')],{'foreignKey':_0x844e('0x1bb'),'onDelete':'cascade'});db[_0x844e('0xd2')]['hasMany'](db[_0x844e('0xcf')],{'foreignKey':_0x844e('0x1bb'),'onDelete':_0x844e('0x102')});db['SmsQueueReport'][_0x844e('0x13f')](db[_0x844e('0x54')],{});db[_0x844e('0xd4')]['belongsTo'](db[_0x844e('0x124')],{'as':'List','foreignKey':'ListId'});db[_0x844e('0xd4')][_0x844e('0x13f')](db[_0x844e('0x75')],{'as':_0x844e('0x152'),'foreignKey':_0x844e('0x153')});db['SmsQueueReport']['belongsTo'](db[_0x844e('0x58')],{});db[_0x844e('0xd4')][_0x844e('0x13f')](db[_0x844e('0x5a')],{});db[_0x844e('0xd4')]['belongsTo'](db['User'],{});db[_0x844e('0xd4')]['belongsTo'](db[_0x844e('0x11f')],{});db[_0x844e('0xd9')][_0x844e('0x105')](db[_0x844e('0xd2')],{'foreignKey':_0x844e('0x1bc')});db[_0x844e('0xd9')][_0x844e('0x105')](db[_0x844e('0x1ba')],{'foreignKey':_0x844e('0x1bc')});db[_0x844e('0xd9')][_0x844e('0x105')](db[_0x844e('0xcf')],{'foreignKey':_0x844e('0x1bc')});db['SquareProject']['belongsToMany'](db[_0x844e('0x13')],{'as':_0x844e('0x164'),'through':'user_has_square_projects'});db[_0x844e('0xe1')][_0x844e('0x110')](db[_0x844e('0x13')],{'as':'Agents','through':'user_has_teams'});db[_0x844e('0xe1')]['belongsToMany'](db[_0x844e('0x11a')],{'through':_0x844e('0x14b'),'as':_0x844e('0x11b')});db['Team'][_0x844e('0x110')](db[_0x844e('0x3f')],{'through':_0x844e('0x15e'),'as':_0x844e('0x1bd')});db[_0x844e('0xe1')][_0x844e('0x110')](db[_0x844e('0x70')],{'through':_0x844e('0x186'),'as':_0x844e('0x11c')});db[_0x844e('0xe1')][_0x844e('0x110')](db[_0x844e('0x51')],{'through':_0x844e('0x171'),'as':_0x844e('0x11d')});db[_0x844e('0xe1')]['belongsToMany'](db['SmsQueue'],{'through':_0x844e('0x178'),'as':_0x844e('0x120')});db[_0x844e('0xe1')][_0x844e('0x110')](db[_0x844e('0x63')],{'through':_0x844e('0x17f'),'as':'OpenchannelQueues'});db[_0x844e('0xe1')][_0x844e('0x110')](db[_0x844e('0x122')],{'through':'team_has_whatsapp_queues','as':'WhatsappQueues'});db[_0x844e('0xe4')][_0x844e('0x105')](db[_0x844e('0x76')],{'as':'Hoppers','foreignKey':_0x844e('0x18e')});db[_0x844e('0xe4')]['hasMany'](db[_0x844e('0x13c')],{'as':_0x844e('0x108'),'foreignKey':_0x844e('0x18e')});db[_0x844e('0xe4')][_0x844e('0x105')](db[_0x844e('0x7a')],{'as':_0x844e('0x13d'),'foreignKey':_0x844e('0x18e')});db[_0x844e('0xe4')][_0x844e('0x105')](db['CmHopperBlack'],{'as':_0x844e('0x1be'),'foreignKey':_0x844e('0x18e')});db['Campaign'][_0x844e('0x13f')](db[_0x844e('0x28')],{'as':_0x844e('0x28'),'foreignKey':_0x844e('0x140')});db[_0x844e('0xe4')]['belongsTo'](db['Trunk'],{'as':_0x844e('0x141'),'foreignKey':'TrunkBackupId'});db[_0x844e('0xe4')][_0x844e('0x13f')](db[_0x844e('0x143')],{'as':_0x844e('0x143'),'foreignKey':_0x844e('0x168')});db['Campaign'][_0x844e('0x13f')](db[_0x844e('0xdc')],{'as':_0x844e('0xdc'),'foreignKey':'SquareProjectId'});db[_0x844e('0xe4')]['belongsToMany'](db[_0x844e('0x124')],{'as':_0x844e('0x147'),'through':_0x844e('0x1bf')});db[_0x844e('0xe4')][_0x844e('0x110')](db[_0x844e('0x124')],{'as':_0x844e('0x1c0'),'through':_0x844e('0x1c1')});db[_0x844e('0xea')][_0x844e('0x13f')](db[_0x844e('0x43')],{});db[_0x844e('0xea')][_0x844e('0x13f')](db[_0x844e('0x41')],{});db[_0x844e('0xea')][_0x844e('0x13f')](db[_0x844e('0x3d')],{'foreignKey':_0x844e('0x1c2'),'as':_0x844e('0x1c3')});db[_0x844e('0xea')][_0x844e('0x13f')](db['User'],{'foreignKey':'FromUserId','as':_0x844e('0x1c4')});db[_0x844e('0xea')][_0x844e('0x13f')](db[_0x844e('0x13')],{'foreignKey':_0x844e('0x1c5'),'as':_0x844e('0x1c6')});db['MailTransferReport'][_0x844e('0x13f')](db[_0x844e('0x3f')],{'foreignKey':_0x844e('0x1c7'),'as':_0x844e('0x1c8')});db[_0x844e('0xea')][_0x844e('0x13f')](db[_0x844e('0x3d')],{'foreignKey':_0x844e('0x1c9'),'as':_0x844e('0x1ca')});db[_0x844e('0xec')]['belongsTo'](db[_0x844e('0x6c')],{});db[_0x844e('0xec')][_0x844e('0x13f')](db[_0x844e('0x10c')],{});db[_0x844e('0xec')][_0x844e('0x13f')](db[_0x844e('0x65')],{'foreignKey':'FromChatWebsiteId','as':'FromAccount'});db['ChatTransferReport']['belongsTo'](db[_0x844e('0x13')],{'foreignKey':'FromUserId','as':_0x844e('0x1c4')});db['ChatTransferReport'][_0x844e('0x13f')](db['User'],{'foreignKey':_0x844e('0x1c5'),'as':'ToAgent'});db[_0x844e('0xec')][_0x844e('0x13f')](db[_0x844e('0x70')],{'foreignKey':_0x844e('0x1cb'),'as':'ToQueue'});db[_0x844e('0xec')][_0x844e('0x13f')](db[_0x844e('0x65')],{'foreignKey':_0x844e('0x1cc'),'as':'ToAccount'});db[_0x844e('0xed')][_0x844e('0x13f')](db['FaxMessage'],{});db[_0x844e('0xed')][_0x844e('0x13f')](db[_0x844e('0x4e')],{});db[_0x844e('0xed')][_0x844e('0x13f')](db['FaxAccount'],{'foreignKey':_0x844e('0x1cd'),'as':_0x844e('0x1c3')});db[_0x844e('0xed')][_0x844e('0x13f')](db[_0x844e('0x13')],{'foreignKey':'FromUserId','as':_0x844e('0x1c4')});db[_0x844e('0xed')]['belongsTo'](db[_0x844e('0x13')],{'foreignKey':_0x844e('0x1c5'),'as':_0x844e('0x1c6')});db[_0x844e('0xed')][_0x844e('0x13f')](db[_0x844e('0x51')],{'foreignKey':_0x844e('0x1ce'),'as':_0x844e('0x1c8')});db[_0x844e('0xed')][_0x844e('0x13f')](db[_0x844e('0x128')],{'foreignKey':_0x844e('0x1cf'),'as':_0x844e('0x1ca')});db[_0x844e('0xee')][_0x844e('0x13f')](db[_0x844e('0x61')],{});db[_0x844e('0xee')][_0x844e('0x13f')](db[_0x844e('0x10a')],{});db[_0x844e('0xee')]['belongsTo'](db[_0x844e('0x12c')],{'foreignKey':'FromOpenchannelAccountId','as':_0x844e('0x1c3')});db[_0x844e('0xee')][_0x844e('0x13f')](db[_0x844e('0x13')],{'foreignKey':_0x844e('0x1d0'),'as':_0x844e('0x1c4')});db[_0x844e('0xee')][_0x844e('0x13f')](db[_0x844e('0x13')],{'foreignKey':_0x844e('0x1c5'),'as':'ToAgent'});db['OpenchannelTransferReport'][_0x844e('0x13f')](db['OpenchannelQueue'],{'foreignKey':_0x844e('0x1d1'),'as':'ToQueue'});db[_0x844e('0xee')][_0x844e('0x13f')](db[_0x844e('0x12c')],{'foreignKey':_0x844e('0x1d2'),'as':_0x844e('0x1ca')});db[_0x844e('0xf0')][_0x844e('0x13f')](db['SmsMessage'],{});db['SmsTransferReport'][_0x844e('0x13f')](db[_0x844e('0x58')],{});db[_0x844e('0xf0')][_0x844e('0x13f')](db[_0x844e('0x54')],{'foreignKey':_0x844e('0x1d3'),'as':'FromAccount'});db[_0x844e('0xf0')][_0x844e('0x13f')](db[_0x844e('0x13')],{'foreignKey':'FromUserId','as':'FromAgent'});db[_0x844e('0xf0')]['belongsTo'](db[_0x844e('0x13')],{'foreignKey':_0x844e('0x1c5'),'as':'ToAgent'});db[_0x844e('0xf0')]['belongsTo'](db[_0x844e('0x11f')],{'foreignKey':_0x844e('0x1d4'),'as':'ToQueue'});db[_0x844e('0xf0')][_0x844e('0x13f')](db[_0x844e('0x54')],{'foreignKey':'ToSmsAccountId','as':'ToAccount'});db[_0x844e('0x124')][_0x844e('0x105')](db['Disposition'],{'as':_0x844e('0x157'),'foreignKey':_0x844e('0x15b')});db[_0x844e('0x124')][_0x844e('0x105')](db[_0x844e('0x7e')],{'as':_0x844e('0x1d5'),'foreignKey':_0x844e('0x15b')});db['CmList'][_0x844e('0x105')](db[_0x844e('0x75')],{'as':'Contacts','onDelete':_0x844e('0x102'),'foreignKey':_0x844e('0x15b')});db['CmList'][_0x844e('0x105')](db['CmHopperFinal'],{'as':'HopperFinals','foreignKey':_0x844e('0x15b')});db[_0x844e('0x124')][_0x844e('0x105')](db[_0x844e('0x7a')],{'as':_0x844e('0x109'),'foreignKey':_0x844e('0x15b')});db[_0x844e('0x124')][_0x844e('0x105')](db[_0x844e('0x7c')],{'as':_0x844e('0x7c'),'foreignKey':_0x844e('0x15b')});db['CmList']['belongsToMany'](db[_0x844e('0x11a')],{'as':_0x844e('0x1d6'),'through':_0x844e('0x148')});db[_0x844e('0x124')]['belongsToMany'](db['User'],{'as':_0x844e('0x149'),'through':'cm_user_has_lists'});db[_0x844e('0xf2')][_0x844e('0x105')](db[_0x844e('0x18')],{'as':'Extensions','onDelete':_0x844e('0x102')});db['VoicePrefix'][_0x844e('0x110')](db['User'],{'as':_0x844e('0x149'),'through':'user_has_voice_prefixes'});db[_0x844e('0xf3')][_0x844e('0x105')](db[_0x844e('0x13')],{'as':_0x844e('0x164'),'foreignKey':_0x844e('0x1d7')});db[_0x844e('0xf3')][_0x844e('0x105')](db[_0x844e('0xf5')],{'as':_0x844e('0x1d8'),'foreignKey':'userProfileId','onDelete':_0x844e('0x102')});db['UserProfileSection'][_0x844e('0x105')](db[_0x844e('0xf6')],{'as':_0x844e('0x1d9'),'foreignKey':'sectionId','onDelete':_0x844e('0x102')});db[_0x844e('0x130')][_0x844e('0x105')](db['Disposition'],{'as':_0x844e('0x157'),'foreignKey':'WhatsappAccountId'});db['WhatsappAccount'][_0x844e('0x105')](db[_0x844e('0x83')],{'as':_0x844e('0x180'),'foreignKey':_0x844e('0x1da')});db[_0x844e('0x130')][_0x844e('0x105')](db[_0x844e('0xfc')],{'as':_0x844e('0x14d'),'foreignKey':_0x844e('0x1da')});db['WhatsappAccount'][_0x844e('0x105')](db['WhatsappInteraction'],{'as':_0x844e('0x16b')});db[_0x844e('0x130')][_0x844e('0x105')](db[_0x844e('0xf8')],{'as':_0x844e('0x159')});db['WhatsappAccount'][_0x844e('0x13f')](db[_0x844e('0x124')],{'as':_0x844e('0x15a'),'foreignKey':'ListId'});db[_0x844e('0x130')][_0x844e('0x13f')](db[_0x844e('0x144')],{'as':_0x844e('0x145'),'foreignKey':_0x844e('0x146')});db['WhatsappAccount'][_0x844e('0x110')](db[_0x844e('0x13')],{'as':_0x844e('0x149'),'through':_0x844e('0x132')});db[_0x844e('0xf8')][_0x844e('0x13f')](db['User'],{'onDelete':_0x844e('0x167')});db[_0x844e('0xf8')][_0x844e('0x13f')](db[_0x844e('0x122')],{'onDelete':_0x844e('0x167')});db[_0x844e('0xf8')]['belongsTo'](db[_0x844e('0x130')],{'onDelete':_0x844e('0x167')});db[_0x844e('0xf8')][_0x844e('0x13f')](db['Interval'],{'onDelete':_0x844e('0x167'),'foreignKey':_0x844e('0x168')});db[_0x844e('0xf8')][_0x844e('0x13f')](db[_0x844e('0x8d')],{'onDelete':_0x844e('0x167'),'foreignKey':_0x844e('0x174')});db[_0x844e('0xfa')]['hasMany'](db[_0x844e('0xfc')],{'as':_0x844e('0x14d'),'onDelete':_0x844e('0x102'),'foreignKey':_0x844e('0x1db')});db[_0x844e('0xfa')][_0x844e('0x13f')](db[_0x844e('0x130')],{'as':_0x844e('0x160'),'foreignKey':_0x844e('0x1da')});db[_0x844e('0xfa')]['belongsTo'](db[_0x844e('0x75')],{'as':_0x844e('0x152'),'foreignKey':_0x844e('0x153')});db['WhatsappInteraction']['belongsTo'](db[_0x844e('0x13')],{'as':'Owner','foreignKey':_0x844e('0x103')});db[_0x844e('0xfa')]['belongsToMany'](db[_0x844e('0x8d')],{'through':_0x844e('0x1dc'),'as':_0x844e('0x163')});db[_0x844e('0xfa')][_0x844e('0x110')](db[_0x844e('0x8d')],{'through':_0x844e('0x1dc'),'as':_0x844e('0x17d')});db[_0x844e('0xfa')]['belongsToMany'](db[_0x844e('0x13')],{'as':_0x844e('0x164'),'through':_0x844e('0x1dd'),'foreignKey':_0x844e('0x1db')});db[_0x844e('0xfc')]['belongsTo'](db[_0x844e('0x13')],{'as':'User'});db[_0x844e('0xfc')]['belongsTo'](db[_0x844e('0x75')],{'onDelete':_0x844e('0x102'),'as':_0x844e('0x152')});db['WhatsappMessage'][_0x844e('0x13f')](db[_0x844e('0xfa')],{'onDelete':_0x844e('0x102'),'as':_0x844e('0x166'),'foreignKey':'WhatsappInteractionId'});db[_0x844e('0xfc')][_0x844e('0x13f')](db[_0x844e('0x130')],{'as':'Account','foreignKey':_0x844e('0x1da')});db[_0x844e('0xfd')]['belongsTo'](db[_0x844e('0x130')],{});db[_0x844e('0xfd')][_0x844e('0x13f')](db[_0x844e('0x124')],{'as':_0x844e('0x15a'),'foreignKey':_0x844e('0x15b')});db[_0x844e('0xfd')]['belongsTo'](db[_0x844e('0x75')],{'as':'Contact','foreignKey':_0x844e('0x153')});db[_0x844e('0xfd')][_0x844e('0x13f')](db[_0x844e('0xfa')],{});db[_0x844e('0xfd')][_0x844e('0x13f')](db[_0x844e('0x122')],{});db['WhatsappQueueReport'][_0x844e('0x13f')](db[_0x844e('0xfc')],{});db[_0x844e('0xfd')]['belongsTo'](db['User'],{});db[_0x844e('0x1de')][_0x844e('0x13f')](db['WhatsappMessage'],{});db[_0x844e('0x1de')][_0x844e('0x13f')](db[_0x844e('0xfa')],{});db['WhatsappTransferReport'][_0x844e('0x13f')](db[_0x844e('0x130')],{'foreignKey':_0x844e('0x1df'),'as':_0x844e('0x1c3')});db[_0x844e('0x1de')][_0x844e('0x13f')](db[_0x844e('0x130')],{'foreignKey':'ToWhatsappAccountId','as':'ToAccount'});db['WhatsappTransferReport']['belongsTo'](db[_0x844e('0x122')],{'foreignKey':_0x844e('0x1e0'),'as':_0x844e('0x1c8')});db[_0x844e('0x1de')]['belongsTo'](db[_0x844e('0x13')],{'foreignKey':'FromUserId','as':_0x844e('0x1c4')});db[_0x844e('0x1de')][_0x844e('0x13f')](db[_0x844e('0x13')],{'foreignKey':'ToUserId','as':_0x844e('0x1c6')});db[_0x844e('0x122')]['belongsToMany'](db[_0x844e('0x13')],{'as':_0x844e('0x149'),'through':'UserWhatsappQueue','foreignKey':_0x844e('0x1e1')});db[_0x844e('0x122')]['belongsToMany'](db[_0x844e('0xe1')],{'through':_0x844e('0x1e2'),'as':_0x844e('0x14a')});module[_0x844e('0x1e3')]={'db':db,'dbH':dbH}; \ No newline at end of file +var _0x536e=['../api/intSugarcrmConfiguration/intSugarcrmConfiguration.model','SugarcrmField','../api/intSugarcrmField/intSugarcrmField.model','DeskAccount','DeskConfiguration','../api/intDeskConfiguration/intDeskConfiguration.model','DeskField','../api/intDeskField/intDeskField.model','ZohoAccount','ZohoConfiguration','../api/intZohoConfiguration/intZohoConfiguration.model','../api/intZohoField/intZohoField.model','ZendeskAccount','ZendeskConfiguration','../api/intZendeskConfiguration/intZendeskConfiguration.model','ZendeskField','../api/intZendeskField/intZendeskField.model','FreshdeskAccount','../api/intFreshdeskAccount/intFreshdeskAccount.model','FreshdeskConfiguration','../api/intFreshdeskConfiguration/intFreshdeskConfiguration.model','FreshdeskField','../api/intFreshdeskField/intFreshdeskField.model','VtigerAccount','../api/intVtigerAccount/intVtigerAccount.model','VtigerConfiguration','../api/intVtigerConfiguration/intVtigerConfiguration.model','VtigerField','../api/intVtigerField/intVtigerField.model','ServicenowAccount','../api/intServicenowAccount/intServicenowAccount.model','ServicenowField','../api/intServicenowField/intServicenowField.model','Dynamics365Account','../api/intDynamics365Account/intDynamics365Account.model','Dynamics365Configuration','../api/intDynamics365Configuration/intDynamics365Configuration.model','Dynamics365Field','../api/intDynamics365Field/intDynamics365Field.model','FreshsalesAccount','../api/intFreshsalesAccount/intFreshsalesAccount.model','FreshsalesConfiguration','../api/intFreshsalesConfiguration/intFreshsalesConfiguration.model','FreshsalesField','Network','../api/network/network.model','ChatQueueReport','ChatInternalMessage','../api/chatInternalMessage/chatInternalMessage.model','../api/jscriptyAnswerReport/jscriptyAnswerReport.model','../api/jscriptyQuestionReport/jscriptyQuestionReport.model','JscriptySessionReport','../api/jscriptySessionReport/jscriptySessionReport.model','../api/smsQueueReport/smsQueueReport.model','SquareReport','../api/squareReport/squareReport.model','../api/squareReportDetail/squareReportDetail.model','../api/jscriptyProject/jscriptyProject.model','Setting','../api/setting/setting.model','SquareOdbc','../api/squareOdbc/squareOdbc.model','SquareProject','../api/squareRecording/squareRecording.model','SquareMessage','License','../api/license/license.model','Campaign','Migration','Attachment','../api/attachment/attachment.model','Plugin','../api/plugin/plugin.model','../api/mailTransferReport/mailTransferReport.model','ChatTransferReport','../api/chatTransferReport/chatTransferReport.model','../api/faxTransferReport/faxTransferReport.model','OpenchannelTransferReport','../api/openchannelTransferReport/openchannelTransferReport.model','SmsTransferReport','../api/smsTransferReport/smsTransferReport.model','VoicePrefix','../api/voicePrefix/voicePrefix.model','UserProfile','../api/userProfile/userProfile.model','../api/userProfileSection/userProfileSection.model','UserProfileResource','../api/userProfileResource/userProfileResource.model','Notification','../api/notification/notification.model','../api/whatsappAccount/whatsappAccount.model','WhatsappInteraction','WhatsappMessage','../api/whatsappMessage/whatsappMessage.model','WhatsappQueueReport','../api/whatsappQueueReport/whatsappQueueReport.model','../api/whatsappTransferReport/whatsappTransferReport.model','../api/whatsappQueue/whatsappQueue.model','CloudProvider','../api/cloudProvider/cloudProvider.model','hasOne','UserId','hasMany','Recordings','VoiceQueuesRt','cascade','HopperFinals','OpenchannelInteractions','SmsInteractions','FaxInteractions','MailInteraction','Notifications','userProfileId','Groups','chat_group_has_users','belongsToMany','Contacts','cm_user_has_contacts','CmList','Lists','cm_user_has_lists','Team','MailInteractions','user_has_mail_interactions','ChatInteractions','user_has_chat_interactions','user_has_fax_interactions','user_has_sms_interactions','WhatsappInteractions','user_has_whatsapp_interactions','VoiceQueues','UserVoiceQueue','MailQueues','UserMailQueue','ChatQueues','FaxQueues','UserFaxQueue','SmsQueues','WhatsappQueue','WhatsappQueues','VoicePrefixes','user_has_voice_prefixes','ChatWebsites','FaxAccounts','user_has_mail_accounts','OpenchannelAccounts','user_has_openchannel_accounts','SmsAccounts','user_has_sms_accounts','WhatsappAccounts','SquareProjects','VoiceExtension','SpiedAgents','Sound','moh_has_sounds','UserVoiceQueueRt','VoiceQueueId','Hoppers','HopperHistories','JscriptySessions','TrunkId','TrunkBackup','TrunkBackupId','IntervalId','belongsTo','mandatoryDispositionPause','mandatoryDispositionPauseId','voice_queues_has_cm_lists','Agents','Teams','team_has_voice_queues','BlackLists','voice_queues_has_cm_blacklists','Messages','mailboxuser','mailbox','QueueCalls','uniqueid','Contact','MailServerIn','MailAccountId','MailServerOut','Smtp','Dispositions','Answers','Interactions','List','ListId','Template','TemplateId','team_has_mail_queues','ContactId','Owner','mail_interaction_has_tags','Tags','Tag','ThroughTags','Users','MailInteractionId','Attachments','restrict','TagId','Items','FaxAccountId','FaxApplication','Applications','Exntensions','user_has_fax_accounts','FaxMessage','Account','fax_interaction_has_tags','Interaction','FaxInteractionId','SmsAccountId','sms_interaction_has_tags','SmsInteractionId','SmsQueueId','team_has_sms_queues','OpenchannelAccountId','OpenchannelQueueId','OpenchannelInteractionId','openchannel_interaction_has_tags','AttachmentId','ChatWebsiteId','ProactiveActions','user_has_chat_websites','OpenchannelQueueReport','Agent','ChatQueue','Queue','ChatQueueId','Website','ChatInteractionId','chat_interaction_has_tags','ChatOfflineMessage','team_has_chat_queues','Members','CompanyId','CmHopperFinal','CmCompany','Company','cm_contact_has_tags','OwnerId','CampaignId','All','OneAll','AutomationAllId','Any','OneAny','AutomationAnyId','AutomationId','Intervals','Extensions','MailApplications','ChatApplications','FaxApplications','SmsApplications','AnalyticCustomReport','CustomReportId','Mohs','whatsapp_interaction_has_tags','AllConditions','AllCondition','AnyConditions','TriggerAnyId','Actions','Fields','DefaultReportId','MetricId','SalesforceAccount','SalesforceConfiguration','Configurations','AccountId','Descriptions','DescriptionId','FieldId','Subject','SubjectId','Description','Variable','VariableId','SugarcrmConfiguration','Subjects','Field','int_desk_configuration_has_tags','ZohoField','int_zendesk_configuration_has_tags','int_freshdesk_configuration_has_tags','ServicenowConfiguration','FromId','ToId','JscriptyQuestionReport','SessionId','JscriptyAnswerReport','SmsQueueReport','JscriptyProject','ProjectId','user_has_square_projects','user_has_teams','team_has_openchannel_queues','OpenchannelQueues','team_has_whatsapp_queues','HopperBlacks','SquareProjectId','campaigns_has_cm_blacklists','MailTransferReport','FromAccount','FromAgent','ToUserId','ToAgent','ToMailQueueId','ToMailAccountId','FromChatWebsiteId','FromUserId','ToQueue','ToChatWebsiteId','FaxTransferReport','FromFaxAccountId','ToFaxQueueId','ToAccount','FromOpenchannelAccountId','ToOpenchannelQueueId','FromSmsAccountId','ToSmsQueueId','CmCustomField','Queues','UserProfileSection','UserProfileSections','Resources','sectionId','WhatsappAccount','WhatsappAccountId','user_has_whatsapp_accounts','WhatsappApplication','WhatsappInteractionId','WhatsappTransferReport','FromWhatsappAccountId','ToWhatsappAccountId','ToQueueId','WhatsappQueueId','exports','path','../config/environment','sequelize','lodash','jstz','determine','defaultsDeep','motion2','xcall','xC@LL1234','127.0.0.1','mysql','utf8','utf8_general_ci','sequelizeHistory','database','username','password','options','User','import','../api/user/user.model','VoiceChanSpy','VoiceContext','../api/voiceContext/voiceContext.model','../api/voiceExtension/voiceExtension.model','VoiceMusicOnHold','../api/voiceMusicOnHold/voiceMusicOnHold.model','VoiceQueue','../api/voiceQueue/voiceQueue.model','VoiceRecording','../api/voiceRecording/voiceRecording.model','ScreenRecording','../api/screenRecording/screenRecording.model','VoiceMail','../api/voiceMail/voiceMail.model','VoiceMailMessage','VoiceCallReport','../api/voiceCallReport/voiceCallReport.model','VoiceAgentReport','../api/voiceAgentReport/voiceAgentReport.model','VoiceQueueReport','../api/voiceQueueReport/voiceQueueReport.model','../api/memberReport/memberReport.model','Trunk','../api/trunk/trunk.model','VoiceTransferReport','../api/voiceTransferReport/voiceTransferReport.model','../api/userVoiceQueueRt/userVoiceQueueRt.model','../api/userVoiceQueue/userVoiceQueue.model','UserChatQueue','../api/userChatQueue/userChatQueue.model','../api/userMailQueue/userMailQueue.model','UserSmsQueue','UserOpenchannelQueue','UserWhatsappQueue','../api/userWhatsappQueue/userWhatsappQueue.model','../api/mailServerOut/mailServerOut.model','MailAccount','../api/mailAccount/mailAccount.model','MailQueue','MailSubstatus','../api/mailInteraction/mailInteraction.model','MailMessage','MailApplication','../api/mailApplication/mailApplication.model','MailQueueReport','Dashboard','../api/dashboard/dashboard.model','DashboardItem','../api/dashboardItem/dashboardItem.model','FaxAccount','FaxInteraction','../api/faxInteraction/faxInteraction.model','../api/faxMessage/faxMessage.model','FaxQueue','../api/faxQueue/faxQueue.model','FaxQueueReport','../api/faxQueueReport/faxQueueReport.model','SmsAccount','SmsApplication','../api/smsApplication/smsApplication.model','SmsInteraction','../api/smsInteraction/smsInteraction.model','SmsMessage','../api/smsMessage/smsMessage.model','SmsQueue','OpenchannelAccount','OpenchannelApplication','../api/openchannelApplication/openchannelApplication.model','OpenchannelInteraction','OpenchannelMessage','../api/openchannelMessage/openchannelMessage.model','OpenchannelQueue','../api/openchannelQueue/openchannelQueue.model','ChatWebsite','../api/chatWebsite/chatWebsite.model','../api/openchannelQueueReport/openchannelQueueReport.model','ChatApplication','../api/chatApplication/chatApplication.model','ChatInteraction','../api/chatInteraction/chatInteraction.model','ChatMessage','../api/chatMessage/chatMessage.model','../api/chatOfflineMessage/chatOfflineMessage.model','ChatGroup','../api/chatGroup/chatGroup.model','ChatProactiveAction','../api/chatProactiveAction/chatProactiveAction.model','CmContact','../api/cmContact/cmContact.model','CmHopper','../api/cmHopper/cmHopper.model','CmHopperBlack','../api/cmHopperFinal/cmHopperFinal.model','CmHopperHistory','../api/cmHopperHistory/cmHopperHistory.model','ReportAgentPreview','../api/reportAgentPreview/reportAgentPreview.model','../api/cmCustomField/cmCustomField.model','Action','../api/action/action.model','Automation','../api/automation/automation.model','CannedAnswer','../api/cannedAnswer/cannedAnswer.model','Disposition','Condition','../api/condition/condition.model','Interval','../api/interval/interval.model','Pause','../api/pause/pause.model','Cdr','../api/cdr/cdr.model','Schedule','../api/schedule/schedule.model','../api/sound/sound.model','../api/tag/tag.model','../api/template/template.model','Trigger','../api/trigger/trigger.model','../api/variable/variable.model','Integration','../api/integration/integration.model','../api/integrationReport/integrationReport.model','../api/analyticCustomReport/analyticCustomReport.model','AnalyticDefaultReport','../api/analyticDefaultReport/analyticDefaultReport.model','AnalyticExtractedReport','../api/analyticExtractedReport/analyticExtractedReport.model','AnalyticMetric','../api/analyticMetric/analyticMetric.model','AnalyticFieldReport','AnalyticTreeReport','../api/analyticTreeReport/analyticTreeReport.model','../api/intSalesforceAccount/intSalesforceAccount.model','../api/intSalesforceConfiguration/intSalesforceConfiguration.model','SalesforceField','../api/intSalesforceField/intSalesforceField.model','SugarcrmAccount'];(function(_0x4d120d,_0x55a2c9){var _0x12b156=function(_0x3b0aae){while(--_0x3b0aae){_0x4d120d['push'](_0x4d120d['shift']());}};_0x12b156(++_0x55a2c9);}(_0x536e,0x155));var _0xe536=function(_0x37dd9d,_0x317c54){_0x37dd9d=_0x37dd9d-0x0;var _0x33ec83=_0x536e[_0x37dd9d];return _0x33ec83;};'use strict';var path=require(_0xe536('0x0'));var config=require(_0xe536('0x1'));var Sequelize=require(_0xe536('0x2'));var _=require(_0xe536('0x3'));var jstz=require(_0xe536('0x4'));var timezone=jstz[_0xe536('0x5')]();config[_0xe536('0x2')]=_[_0xe536('0x6')](config[_0xe536('0x2')],{'database':_0xe536('0x7'),'username':_0xe536('0x8'),'password':_0xe536('0x9'),'options':{'host':_0xe536('0xa'),'port':0xcea,'dialect':_0xe536('0xb'),'dialectOptions':{'charset':'utf8mb4'},'logging':![],'timezone':timezone['name'](),'define':{'charset':_0xe536('0xc'),'collate':_0xe536('0xd')}}});config['sequelizeHistory']=_[_0xe536('0x6')](config[_0xe536('0xe')],{'database':_0xe536('0x7'),'username':_0xe536('0x8'),'password':_0xe536('0x9'),'options':{'host':_0xe536('0xa'),'port':0xcea,'dialect':_0xe536('0xb'),'dialectOptions':{'charset':'utf8mb4'},'logging':![],'timezone':timezone['name'](),'define':{'charset':_0xe536('0xc'),'collate':_0xe536('0xd')}}});var db={'Sequelize':Sequelize,'sequelize':new Sequelize(config['sequelize'][_0xe536('0xf')],config[_0xe536('0x2')][_0xe536('0x10')],config[_0xe536('0x2')][_0xe536('0x11')],config[_0xe536('0x2')]['options'])};var dbH={'Sequelize':Sequelize,'sequelize':new Sequelize(config[_0xe536('0xe')][_0xe536('0xf')],config[_0xe536('0xe')][_0xe536('0x10')],config[_0xe536('0xe')]['password'],config[_0xe536('0xe')][_0xe536('0x12')])};db[_0xe536('0x13')]=db['sequelize'][_0xe536('0x14')](_0xe536('0x15'));db[_0xe536('0x16')]=db[_0xe536('0x2')]['import']('../api/voiceChanSpy/voiceChanSpy.model');db[_0xe536('0x17')]=db[_0xe536('0x2')][_0xe536('0x14')](_0xe536('0x18'));db['VoiceExtension']=db['sequelize'][_0xe536('0x14')](_0xe536('0x19'));db[_0xe536('0x1a')]=db[_0xe536('0x2')][_0xe536('0x14')](_0xe536('0x1b'));db[_0xe536('0x1c')]=db[_0xe536('0x2')][_0xe536('0x14')](_0xe536('0x1d'));db[_0xe536('0x1e')]=db['sequelize']['import'](_0xe536('0x1f'));db[_0xe536('0x20')]=db[_0xe536('0x2')]['import'](_0xe536('0x21'));db[_0xe536('0x22')]=db[_0xe536('0x2')][_0xe536('0x14')](_0xe536('0x23'));db[_0xe536('0x24')]=db['sequelize'][_0xe536('0x14')]('../api/voiceMailMessage/voiceMailMessage.model');db[_0xe536('0x25')]=db[_0xe536('0x2')][_0xe536('0x14')](_0xe536('0x26'));db['VoiceDialReport']=db[_0xe536('0x2')][_0xe536('0x14')]('../api/voiceDialReport/voiceDialReport.model');db[_0xe536('0x27')]=db[_0xe536('0x2')]['import'](_0xe536('0x28'));db[_0xe536('0x29')]=db[_0xe536('0x2')][_0xe536('0x14')](_0xe536('0x2a'));db['MemberReport']=db[_0xe536('0x2')][_0xe536('0x14')](_0xe536('0x2b'));db[_0xe536('0x2c')]=db[_0xe536('0x2')][_0xe536('0x14')](_0xe536('0x2d'));db[_0xe536('0x2e')]=db['sequelize'][_0xe536('0x14')](_0xe536('0x2f'));db['UserVoiceQueueRt']=db['sequelize']['import'](_0xe536('0x30'));db['UserVoiceQueue']=db[_0xe536('0x2')][_0xe536('0x14')](_0xe536('0x31'));db[_0xe536('0x32')]=db[_0xe536('0x2')][_0xe536('0x14')](_0xe536('0x33'));db['UserMailQueue']=db[_0xe536('0x2')][_0xe536('0x14')](_0xe536('0x34'));db['UserFaxQueue']=db['sequelize'][_0xe536('0x14')]('../api/userFaxQueue/userFaxQueue.model');db[_0xe536('0x35')]=db[_0xe536('0x2')]['import']('../api/userSmsQueue/userSmsQueue.model');db[_0xe536('0x36')]=db['sequelize'][_0xe536('0x14')]('../api/userOpenchannelQueue/userOpenchannelQueue.model');db[_0xe536('0x37')]=db[_0xe536('0x2')][_0xe536('0x14')](_0xe536('0x38'));db['MailServerIn']=db[_0xe536('0x2')][_0xe536('0x14')]('../api/mailServerIn/mailServerIn.model');db['MailServerOut']=db[_0xe536('0x2')][_0xe536('0x14')](_0xe536('0x39'));db[_0xe536('0x3a')]=db[_0xe536('0x2')][_0xe536('0x14')](_0xe536('0x3b'));db[_0xe536('0x3c')]=db[_0xe536('0x2')][_0xe536('0x14')]('../api/mailQueue/mailQueue.model');db[_0xe536('0x3d')]=db[_0xe536('0x2')][_0xe536('0x14')]('../api/mailSubstatus/mailSubstatus.model');db['MailInteraction']=db[_0xe536('0x2')][_0xe536('0x14')](_0xe536('0x3e'));db[_0xe536('0x3f')]=db[_0xe536('0x2')]['import']('../api/mailMessage/mailMessage.model');db[_0xe536('0x40')]=db['sequelize']['import'](_0xe536('0x41'));db[_0xe536('0x42')]=db[_0xe536('0x2')][_0xe536('0x14')]('../api/mailQueueReport/mailQueueReport.model');db[_0xe536('0x43')]=db[_0xe536('0x2')]['import'](_0xe536('0x44'));db[_0xe536('0x45')]=db['sequelize'][_0xe536('0x14')](_0xe536('0x46'));db[_0xe536('0x47')]=db[_0xe536('0x2')][_0xe536('0x14')]('../api/faxAccount/faxAccount.model');db['FaxApplication']=db[_0xe536('0x2')][_0xe536('0x14')]('../api/faxApplication/faxApplication.model');db[_0xe536('0x48')]=db[_0xe536('0x2')]['import'](_0xe536('0x49'));db['FaxMessage']=db[_0xe536('0x2')][_0xe536('0x14')](_0xe536('0x4a'));db[_0xe536('0x4b')]=db['sequelize'][_0xe536('0x14')](_0xe536('0x4c'));db[_0xe536('0x4d')]=db[_0xe536('0x2')]['import'](_0xe536('0x4e'));db[_0xe536('0x4f')]=db['sequelize'][_0xe536('0x14')]('../api/smsAccount/smsAccount.model');db[_0xe536('0x50')]=db[_0xe536('0x2')][_0xe536('0x14')](_0xe536('0x51'));db[_0xe536('0x52')]=db[_0xe536('0x2')]['import'](_0xe536('0x53'));db[_0xe536('0x54')]=db[_0xe536('0x2')][_0xe536('0x14')](_0xe536('0x55'));db[_0xe536('0x56')]=db['sequelize'][_0xe536('0x14')]('../api/smsQueue/smsQueue.model');db[_0xe536('0x57')]=db['sequelize'][_0xe536('0x14')]('../api/openchannelAccount/openchannelAccount.model');db[_0xe536('0x58')]=db['sequelize'][_0xe536('0x14')](_0xe536('0x59'));db[_0xe536('0x5a')]=db[_0xe536('0x2')][_0xe536('0x14')]('../api/openchannelInteraction/openchannelInteraction.model');db[_0xe536('0x5b')]=db['sequelize']['import'](_0xe536('0x5c'));db[_0xe536('0x5d')]=db[_0xe536('0x2')][_0xe536('0x14')](_0xe536('0x5e'));db[_0xe536('0x5f')]=db['sequelize']['import'](_0xe536('0x60'));db['OpenchannelQueueReport']=db[_0xe536('0x2')][_0xe536('0x14')](_0xe536('0x61'));db[_0xe536('0x62')]=db[_0xe536('0x2')]['import'](_0xe536('0x63'));db[_0xe536('0x64')]=db[_0xe536('0x2')][_0xe536('0x14')](_0xe536('0x65'));db[_0xe536('0x66')]=db['sequelize'][_0xe536('0x14')](_0xe536('0x67'));db['ChatOfflineMessage']=db[_0xe536('0x2')][_0xe536('0x14')](_0xe536('0x68'));db['ChatQueue']=db[_0xe536('0x2')]['import']('../api/chatQueue/chatQueue.model');db[_0xe536('0x69')]=db[_0xe536('0x2')][_0xe536('0x14')](_0xe536('0x6a'));db[_0xe536('0x6b')]=db['sequelize'][_0xe536('0x14')](_0xe536('0x6c'));db['CmCompany']=db[_0xe536('0x2')]['import']('../api/cmCompany/cmCompany.model');db[_0xe536('0x6d')]=db['sequelize'][_0xe536('0x14')](_0xe536('0x6e'));db[_0xe536('0x6f')]=db['sequelize'][_0xe536('0x14')](_0xe536('0x70'));db[_0xe536('0x71')]=db[_0xe536('0x2')][_0xe536('0x14')]('../api/cmHopperBlack/cmHopperBlack.model');db['CmHopperFinal']=db[_0xe536('0x2')]['import'](_0xe536('0x72'));db[_0xe536('0x73')]=db[_0xe536('0x2')][_0xe536('0x14')](_0xe536('0x74'));db[_0xe536('0x75')]=db[_0xe536('0x2')][_0xe536('0x14')](_0xe536('0x76'));db['CmCustomField']=db[_0xe536('0x2')][_0xe536('0x14')](_0xe536('0x77'));db[_0xe536('0x78')]=db['sequelize'][_0xe536('0x14')](_0xe536('0x79'));db[_0xe536('0x7a')]=db[_0xe536('0x2')][_0xe536('0x14')](_0xe536('0x7b'));db[_0xe536('0x7c')]=db['sequelize'][_0xe536('0x14')](_0xe536('0x7d'));db[_0xe536('0x7e')]=db[_0xe536('0x2')]['import']('../api/disposition/disposition.model');db[_0xe536('0x7f')]=db[_0xe536('0x2')][_0xe536('0x14')](_0xe536('0x80'));db[_0xe536('0x81')]=db[_0xe536('0x2')][_0xe536('0x14')](_0xe536('0x82'));db[_0xe536('0x83')]=db[_0xe536('0x2')]['import'](_0xe536('0x84'));db[_0xe536('0x85')]=db[_0xe536('0x2')][_0xe536('0x14')](_0xe536('0x86'));db['VoiceQueuesLog']=db[_0xe536('0x2')][_0xe536('0x14')]('../api/voiceQueuesLog/voiceQueuesLog.model');db[_0xe536('0x87')]=db['sequelize']['import'](_0xe536('0x88'));db['Sound']=db[_0xe536('0x2')][_0xe536('0x14')](_0xe536('0x89'));db['Tag']=db['sequelize'][_0xe536('0x14')](_0xe536('0x8a'));db['Template']=db[_0xe536('0x2')][_0xe536('0x14')](_0xe536('0x8b'));db[_0xe536('0x8c')]=db[_0xe536('0x2')][_0xe536('0x14')](_0xe536('0x8d'));db['Variable']=db[_0xe536('0x2')][_0xe536('0x14')](_0xe536('0x8e'));db[_0xe536('0x8f')]=db['sequelize'][_0xe536('0x14')](_0xe536('0x90'));db['IntegrationReport']=db[_0xe536('0x2')][_0xe536('0x14')](_0xe536('0x91'));db['AnalyticCustomReport']=db[_0xe536('0x2')][_0xe536('0x14')](_0xe536('0x92'));db[_0xe536('0x93')]=db[_0xe536('0x2')][_0xe536('0x14')](_0xe536('0x94'));db[_0xe536('0x95')]=db[_0xe536('0x2')][_0xe536('0x14')](_0xe536('0x96'));db[_0xe536('0x97')]=db[_0xe536('0x2')][_0xe536('0x14')](_0xe536('0x98'));db[_0xe536('0x99')]=db[_0xe536('0x2')][_0xe536('0x14')]('../api/analyticFieldReport/analyticFieldReport.model');db[_0xe536('0x9a')]=db['sequelize'][_0xe536('0x14')](_0xe536('0x9b'));db['SalesforceAccount']=db[_0xe536('0x2')]['import'](_0xe536('0x9c'));db['SalesforceConfiguration']=db[_0xe536('0x2')][_0xe536('0x14')](_0xe536('0x9d'));db[_0xe536('0x9e')]=db[_0xe536('0x2')][_0xe536('0x14')](_0xe536('0x9f'));db[_0xe536('0xa0')]=db['sequelize']['import']('../api/intSugarcrmAccount/intSugarcrmAccount.model');db['SugarcrmConfiguration']=db[_0xe536('0x2')][_0xe536('0x14')](_0xe536('0xa1'));db[_0xe536('0xa2')]=db['sequelize'][_0xe536('0x14')](_0xe536('0xa3'));db[_0xe536('0xa4')]=db[_0xe536('0x2')]['import']('../api/intDeskAccount/intDeskAccount.model');db[_0xe536('0xa5')]=db['sequelize'][_0xe536('0x14')](_0xe536('0xa6'));db[_0xe536('0xa7')]=db[_0xe536('0x2')]['import'](_0xe536('0xa8'));db[_0xe536('0xa9')]=db[_0xe536('0x2')]['import']('../api/intZohoAccount/intZohoAccount.model');db[_0xe536('0xaa')]=db['sequelize']['import'](_0xe536('0xab'));db['ZohoField']=db[_0xe536('0x2')][_0xe536('0x14')](_0xe536('0xac'));db[_0xe536('0xad')]=db[_0xe536('0x2')][_0xe536('0x14')]('../api/intZendeskAccount/intZendeskAccount.model');db[_0xe536('0xae')]=db[_0xe536('0x2')][_0xe536('0x14')](_0xe536('0xaf'));db[_0xe536('0xb0')]=db[_0xe536('0x2')][_0xe536('0x14')](_0xe536('0xb1'));db[_0xe536('0xb2')]=db[_0xe536('0x2')][_0xe536('0x14')](_0xe536('0xb3'));db[_0xe536('0xb4')]=db[_0xe536('0x2')]['import'](_0xe536('0xb5'));db[_0xe536('0xb6')]=db['sequelize'][_0xe536('0x14')](_0xe536('0xb7'));db[_0xe536('0xb8')]=db[_0xe536('0x2')]['import'](_0xe536('0xb9'));db[_0xe536('0xba')]=db[_0xe536('0x2')][_0xe536('0x14')](_0xe536('0xbb'));db[_0xe536('0xbc')]=db[_0xe536('0x2')][_0xe536('0x14')](_0xe536('0xbd'));db[_0xe536('0xbe')]=db[_0xe536('0x2')]['import'](_0xe536('0xbf'));db['ServicenowConfiguration']=db['sequelize'][_0xe536('0x14')]('../api/intServicenowConfiguration/intServicenowConfiguration.model');db[_0xe536('0xc0')]=db['sequelize']['import'](_0xe536('0xc1'));db[_0xe536('0xc2')]=db[_0xe536('0x2')][_0xe536('0x14')](_0xe536('0xc3'));db[_0xe536('0xc4')]=db['sequelize']['import'](_0xe536('0xc5'));db[_0xe536('0xc6')]=db['sequelize'][_0xe536('0x14')](_0xe536('0xc7'));db[_0xe536('0xc8')]=db[_0xe536('0x2')]['import'](_0xe536('0xc9'));db[_0xe536('0xca')]=db[_0xe536('0x2')][_0xe536('0x14')](_0xe536('0xcb'));db[_0xe536('0xcc')]=db[_0xe536('0x2')][_0xe536('0x14')]('../api/intFreshsalesField/intFreshsalesField.model');db['Integration']=db[_0xe536('0x2')][_0xe536('0x14')](_0xe536('0x90'));db[_0xe536('0xcd')]=db[_0xe536('0x2')]['import'](_0xe536('0xce'));db[_0xe536('0xcf')]=db['sequelize']['import']('../api/chatQueueReport/chatQueueReport.model');db[_0xe536('0xd0')]=db[_0xe536('0x2')][_0xe536('0x14')](_0xe536('0xd1'));db['JscriptyAnswerReport']=db[_0xe536('0x2')][_0xe536('0x14')](_0xe536('0xd2'));db['JscriptyQuestionReport']=db[_0xe536('0x2')][_0xe536('0x14')](_0xe536('0xd3'));db[_0xe536('0xd4')]=db[_0xe536('0x2')][_0xe536('0x14')](_0xe536('0xd5'));db['SmsQueueReport']=db[_0xe536('0x2')][_0xe536('0x14')](_0xe536('0xd6'));db[_0xe536('0xd7')]=db[_0xe536('0x2')]['import'](_0xe536('0xd8'));db['SquareDetailsReport']=db[_0xe536('0x2')][_0xe536('0x14')](_0xe536('0xd9'));db['JscriptyProject']=db[_0xe536('0x2')][_0xe536('0x14')](_0xe536('0xda'));db[_0xe536('0xdb')]=db[_0xe536('0x2')]['import'](_0xe536('0xdc'));db[_0xe536('0xdd')]=db[_0xe536('0x2')][_0xe536('0x14')](_0xe536('0xde'));db[_0xe536('0xdf')]=db['sequelize'][_0xe536('0x14')]('../api/squareProject/squareProject.model');db['SquareRecording']=db[_0xe536('0x2')][_0xe536('0x14')](_0xe536('0xe0'));db[_0xe536('0xe1')]=db[_0xe536('0x2')][_0xe536('0x14')]('../api/squareMessage/squareMessage.model');db['Team']=db['sequelize'][_0xe536('0x14')]('../api/team/team.model');db[_0xe536('0xe2')]=db['sequelize'][_0xe536('0x14')](_0xe536('0xe3'));db[_0xe536('0xe4')]=db['sequelize'][_0xe536('0x14')]('../api/campaign/campaign.model');db[_0xe536('0xe5')]=db[_0xe536('0x2')][_0xe536('0x14')]('../api/migration/migration.model');db[_0xe536('0xe6')]=db[_0xe536('0x2')][_0xe536('0x14')](_0xe536('0xe7'));db[_0xe536('0xe8')]=db[_0xe536('0x2')]['import'](_0xe536('0xe9'));db['MailTransferReport']=db[_0xe536('0x2')][_0xe536('0x14')](_0xe536('0xea'));db[_0xe536('0xeb')]=db['sequelize'][_0xe536('0x14')](_0xe536('0xec'));db['FaxTransferReport']=db['sequelize'][_0xe536('0x14')](_0xe536('0xed'));db[_0xe536('0xee')]=db[_0xe536('0x2')][_0xe536('0x14')](_0xe536('0xef'));db[_0xe536('0xf0')]=db[_0xe536('0x2')][_0xe536('0x14')](_0xe536('0xf1'));db['CmList']=db[_0xe536('0x2')]['import']('../api/cmList/cmList.model');db[_0xe536('0xf2')]=db[_0xe536('0x2')]['import'](_0xe536('0xf3'));db[_0xe536('0xf4')]=db[_0xe536('0x2')]['import'](_0xe536('0xf5'));db['UserProfileSection']=db[_0xe536('0x2')][_0xe536('0x14')](_0xe536('0xf6'));db[_0xe536('0xf7')]=db[_0xe536('0x2')][_0xe536('0x14')](_0xe536('0xf8'));db[_0xe536('0xf9')]=db[_0xe536('0x2')]['import'](_0xe536('0xfa'));db['WhatsappAccount']=db[_0xe536('0x2')][_0xe536('0x14')](_0xe536('0xfb'));db['WhatsappApplication']=db[_0xe536('0x2')]['import']('../api/whatsappApplication/whatsappApplication.model');db[_0xe536('0xfc')]=db[_0xe536('0x2')][_0xe536('0x14')]('../api/whatsappInteraction/whatsappInteraction.model');db[_0xe536('0xfd')]=db[_0xe536('0x2')]['import'](_0xe536('0xfe'));db[_0xe536('0xff')]=db[_0xe536('0x2')][_0xe536('0x14')](_0xe536('0x100'));db['WhatsappTransferReport']=db[_0xe536('0x2')][_0xe536('0x14')](_0xe536('0x101'));db['WhatsappQueue']=db[_0xe536('0x2')][_0xe536('0x14')](_0xe536('0x102'));db[_0xe536('0x103')]=db['sequelize'][_0xe536('0x14')](_0xe536('0x104'));db[_0xe536('0x13')][_0xe536('0x105')](db[_0xe536('0x22')],{'as':'VoiceMail','onDelete':'cascade','foreignKey':_0xe536('0x106')});db[_0xe536('0x13')][_0xe536('0x107')](db[_0xe536('0x1e')],{'as':_0xe536('0x108'),'foreignKey':_0xe536('0x106')});db[_0xe536('0x13')][_0xe536('0x107')](db['UserVoiceQueueRt'],{'as':_0xe536('0x109'),'foreignKey':_0xe536('0x106')});db['User'][_0xe536('0x107')](db['VoiceExtension'],{'as':'Extensions','onDelete':_0xe536('0x10a'),'hooks':!![]});db[_0xe536('0x13')][_0xe536('0x107')](db['CmHopperFinal'],{'as':_0xe536('0x10b'),'foreignKey':'UserId'});db[_0xe536('0x13')][_0xe536('0x107')](db[_0xe536('0x73')],{'as':'HopperHistory','foreignKey':'UserId'});db[_0xe536('0x13')][_0xe536('0x107')](db['ReportAgentPreview'],{'as':_0xe536('0x75'),'foreignKey':_0xe536('0x106')});db[_0xe536('0x13')][_0xe536('0x107')](db['OpenchannelInteraction'],{'as':_0xe536('0x10c'),'foreignKey':'UserId'});db[_0xe536('0x13')][_0xe536('0x107')](db[_0xe536('0x64')],{'as':'ChatInteractions','foreignKey':'UserId'});db['User'][_0xe536('0x107')](db[_0xe536('0x52')],{'as':_0xe536('0x10d'),'foreignKey':_0xe536('0x106')});db[_0xe536('0x13')][_0xe536('0x107')](db[_0xe536('0x48')],{'as':_0xe536('0x10e'),'foreignKey':_0xe536('0x106')});db[_0xe536('0x13')][_0xe536('0x107')](db[_0xe536('0x10f')],{'as':'MailInteractions','foreignKey':_0xe536('0x106')});db[_0xe536('0x13')][_0xe536('0x107')](db['WhatsappInteraction'],{'as':'WhatsappInteractions','foreignKey':_0xe536('0x106')});db[_0xe536('0x13')][_0xe536('0x107')](db[_0xe536('0xf9')],{'as':_0xe536('0x110'),'foreignKey':'SenderId'});db[_0xe536('0x13')]['belongsTo'](db[_0xe536('0xf4')],{'as':'UserProfile','foreignKey':_0xe536('0x111')});db[_0xe536('0x13')]['belongsToMany'](db['ChatGroup'],{'as':_0xe536('0x112'),'through':_0xe536('0x113')});db[_0xe536('0x13')][_0xe536('0x114')](db[_0xe536('0x6d')],{'as':_0xe536('0x115'),'through':_0xe536('0x116')});db[_0xe536('0x13')][_0xe536('0x114')](db[_0xe536('0x117')],{'as':_0xe536('0x118'),'through':_0xe536('0x119')});db[_0xe536('0x13')][_0xe536('0x114')](db[_0xe536('0x11a')],{'through':'user_has_teams'});db[_0xe536('0x13')]['belongsToMany'](db[_0xe536('0x10f')],{'as':_0xe536('0x11b'),'through':_0xe536('0x11c')});db[_0xe536('0x13')][_0xe536('0x114')](db['ChatInteraction'],{'as':_0xe536('0x11d'),'through':_0xe536('0x11e')});db[_0xe536('0x13')]['belongsToMany'](db[_0xe536('0x48')],{'as':_0xe536('0x10e'),'through':_0xe536('0x11f')});db[_0xe536('0x13')]['belongsToMany'](db[_0xe536('0x52')],{'as':_0xe536('0x10d'),'through':_0xe536('0x120')});db[_0xe536('0x13')][_0xe536('0x114')](db[_0xe536('0x5a')],{'as':_0xe536('0x10c'),'through':'user_has_openchannel_interactions'});db[_0xe536('0x13')]['belongsToMany'](db[_0xe536('0xfc')],{'as':_0xe536('0x121'),'through':_0xe536('0x122')});db['User'][_0xe536('0x114')](db[_0xe536('0x1c')],{'as':_0xe536('0x123'),'through':_0xe536('0x124'),'required':![]});db[_0xe536('0x13')][_0xe536('0x114')](db['MailQueue'],{'as':_0xe536('0x125'),'through':_0xe536('0x126'),'required':![]});db[_0xe536('0x13')][_0xe536('0x114')](db['ChatQueue'],{'as':_0xe536('0x127'),'through':_0xe536('0x32'),'required':![],'hooks':!![]});db[_0xe536('0x13')][_0xe536('0x114')](db[_0xe536('0x4b')],{'as':_0xe536('0x128'),'through':_0xe536('0x129'),'required':![]});db[_0xe536('0x13')][_0xe536('0x114')](db[_0xe536('0x56')],{'as':_0xe536('0x12a'),'through':'UserSmsQueue','required':![]});db['User'][_0xe536('0x114')](db[_0xe536('0x5d')],{'as':'OpenchannelQueues','through':_0xe536('0x36'),'required':![]});db[_0xe536('0x13')][_0xe536('0x114')](db[_0xe536('0x12b')],{'as':_0xe536('0x12c'),'through':'UserWhatsappQueue','required':![]});db[_0xe536('0x13')]['belongsToMany'](db[_0xe536('0x117')],{'through':_0xe536('0x119')});db[_0xe536('0x13')][_0xe536('0x114')](db['VoicePrefix'],{'as':_0xe536('0x12d'),'through':_0xe536('0x12e'),'required':![]});db['User']['belongsToMany'](db[_0xe536('0x5f')],{'as':_0xe536('0x12f'),'through':'user_has_chat_websites'});db[_0xe536('0x13')][_0xe536('0x114')](db[_0xe536('0x47')],{'as':_0xe536('0x130'),'through':'user_has_fax_accounts'});db[_0xe536('0x13')][_0xe536('0x114')](db[_0xe536('0x3a')],{'as':'MailAccounts','through':_0xe536('0x131')});db[_0xe536('0x13')][_0xe536('0x114')](db['OpenchannelAccount'],{'as':_0xe536('0x132'),'through':_0xe536('0x133')});db[_0xe536('0x13')][_0xe536('0x114')](db[_0xe536('0x4f')],{'as':_0xe536('0x134'),'through':_0xe536('0x135')});db[_0xe536('0x13')][_0xe536('0x114')](db['WhatsappAccount'],{'as':_0xe536('0x136'),'through':'user_has_whatsapp_accounts'});db[_0xe536('0x13')][_0xe536('0x114')](db[_0xe536('0xdf')],{'as':_0xe536('0x137'),'through':'user_has_square_projects'});db[_0xe536('0x16')][_0xe536('0x107')](db[_0xe536('0x138')],{'as':_0xe536('0x139'),'onDelete':_0xe536('0x10a'),'foreignKey':'ChanSpyId'});db['VoiceContext'][_0xe536('0x107')](db['VoiceExtension'],{'onDelete':'cascade'});db[_0xe536('0x138')]['hasMany'](db['VoiceExtension'],{'as':'Applications','onDelete':_0xe536('0x10a')});db[_0xe536('0x1a')]['belongsToMany'](db[_0xe536('0x13a')],{'as':'Sounds','through':_0xe536('0x13b')});db['VoiceQueue'][_0xe536('0x107')](db[_0xe536('0x13c')],{'as':'Members','foreignKey':_0xe536('0x13d')});db[_0xe536('0x1c')][_0xe536('0x107')](db[_0xe536('0x6f')],{'as':_0xe536('0x13e'),'foreignKey':_0xe536('0x13d')});db[_0xe536('0x1c')]['hasMany'](db['CmHopperFinal'],{'as':_0xe536('0x10b'),'foreignKey':_0xe536('0x13d')});db[_0xe536('0x1c')][_0xe536('0x107')](db[_0xe536('0x73')],{'as':_0xe536('0x13f'),'foreignKey':_0xe536('0x13d')});db['VoiceQueue'][_0xe536('0x107')](db['ReportAgentPreview'],{'as':'ReportAgentPreview','foreignKey':_0xe536('0x13d')});db[_0xe536('0x1c')]['hasMany'](db['CmHopperBlack'],{'as':'HopperBlacks','foreignKey':_0xe536('0x13d')});db[_0xe536('0x1c')][_0xe536('0x107')](db[_0xe536('0xd4')],{'as':_0xe536('0x140'),'foreignKey':'VoiceQueueId'});db[_0xe536('0x1c')]['belongsTo'](db[_0xe536('0x2c')],{'as':_0xe536('0x2c'),'foreignKey':_0xe536('0x141')});db['VoiceQueue']['belongsTo'](db[_0xe536('0x2c')],{'as':_0xe536('0x142'),'foreignKey':_0xe536('0x143')});db['VoiceQueue']['belongsTo'](db[_0xe536('0x81')],{'as':_0xe536('0x81'),'foreignKey':_0xe536('0x144')});db[_0xe536('0x1c')][_0xe536('0x145')](db['Pause'],{'as':_0xe536('0x146'),'foreignKey':_0xe536('0x147')});db[_0xe536('0x1c')][_0xe536('0x114')](db[_0xe536('0x117')],{'as':'Lists','through':_0xe536('0x148')});db[_0xe536('0x1c')][_0xe536('0x114')](db[_0xe536('0x13')],{'as':_0xe536('0x149'),'through':_0xe536('0x124')});db[_0xe536('0x1c')][_0xe536('0x114')](db['Team'],{'as':_0xe536('0x14a'),'through':_0xe536('0x14b')});db[_0xe536('0x1c')][_0xe536('0x114')](db[_0xe536('0x117')],{'as':_0xe536('0x14c'),'through':_0xe536('0x14d')});db[_0xe536('0x1e')]['belongsTo'](db[_0xe536('0x13')],{'as':'User','foreignKey':_0xe536('0x106')});db[_0xe536('0x20')]['belongsTo'](db[_0xe536('0x13')],{'as':'User','foreignKey':'UserId'});db[_0xe536('0x22')]['hasMany'](db[_0xe536('0x24')],{'as':_0xe536('0x14e'),'onDelete':_0xe536('0x10a'),'foreignKey':_0xe536('0x14f'),'sourceKey':'mailbox'});db[_0xe536('0x24')]['belongsTo'](db[_0xe536('0x22')],{'foreignKey':_0xe536('0x14f'),'targetKey':_0xe536('0x150')});db[_0xe536('0x25')][_0xe536('0x107')](db[_0xe536('0x29')],{'as':_0xe536('0x151'),'foreignKey':_0xe536('0x152'),'constraints':![]});db[_0xe536('0x25')][_0xe536('0x107')](db[_0xe536('0x27')],{'as':'AgentReports','foreignKey':_0xe536('0x152'),'constraints':![]});db['VoiceCallReport'][_0xe536('0x145')](db[_0xe536('0x13')],{'as':_0xe536('0x13'),'foreignKey':_0xe536('0x106')});db[_0xe536('0x25')][_0xe536('0x145')](db[_0xe536('0x6d')],{'as':_0xe536('0x153'),'foreignKey':'ContactId'});db[_0xe536('0x154')][_0xe536('0x145')](db[_0xe536('0x3a')],{'as':_0xe536('0x3a'),'foreignKey':_0xe536('0x155')});db[_0xe536('0x156')][_0xe536('0x145')](db[_0xe536('0x3a')],{'as':_0xe536('0x3a'),'foreignKey':_0xe536('0x155')});db[_0xe536('0x3a')][_0xe536('0x105')](db[_0xe536('0x154')],{'as':'Imap','onDelete':_0xe536('0x10a')});db['MailAccount'][_0xe536('0x105')](db[_0xe536('0x156')],{'as':_0xe536('0x157'),'onDelete':'cascade'});db[_0xe536('0x3a')]['hasMany'](db[_0xe536('0x7e')],{'as':_0xe536('0x158'),'foreignKey':'MailAccountId'});db[_0xe536('0x3a')][_0xe536('0x107')](db['CannedAnswer'],{'as':_0xe536('0x159'),'foreignKey':_0xe536('0x155')});db['MailAccount'][_0xe536('0x107')](db['MailMessage'],{'as':_0xe536('0x14e'),'foreignKey':_0xe536('0x155')});db[_0xe536('0x3a')]['hasMany'](db[_0xe536('0x10f')],{'as':_0xe536('0x15a')});db[_0xe536('0x3a')]['hasMany'](db[_0xe536('0x40')],{'as':'Applications'});db['MailAccount'][_0xe536('0x145')](db[_0xe536('0x117')],{'as':_0xe536('0x15b'),'foreignKey':_0xe536('0x15c')});db['MailAccount'][_0xe536('0x145')](db[_0xe536('0x15d')],{'as':_0xe536('0x15d'),'foreignKey':_0xe536('0x15e')});db['MailAccount'][_0xe536('0x145')](db[_0xe536('0x83')],{'as':_0xe536('0x146'),'foreignKey':_0xe536('0x147')});db[_0xe536('0x3a')]['belongsToMany'](db['User'],{'as':_0xe536('0x149'),'through':_0xe536('0x131')});db[_0xe536('0x3c')][_0xe536('0x114')](db[_0xe536('0x13')],{'as':_0xe536('0x149'),'through':'UserMailQueue'});db[_0xe536('0x3c')][_0xe536('0x114')](db[_0xe536('0x11a')],{'through':_0xe536('0x15f'),'as':'Teams'});db[_0xe536('0x10f')][_0xe536('0x107')](db[_0xe536('0x3f')],{'as':'Messages','onDelete':_0xe536('0x10a'),'foreignKey':'MailInteractionId'});db[_0xe536('0x10f')]['belongsTo'](db[_0xe536('0x3a')],{'as':'Account','foreignKey':_0xe536('0x155')});db[_0xe536('0x10f')][_0xe536('0x145')](db[_0xe536('0x6d')],{'as':'Contact','foreignKey':_0xe536('0x160')});db['MailInteraction'][_0xe536('0x145')](db[_0xe536('0x13')],{'as':_0xe536('0x161'),'foreignKey':'UserId'});db['MailInteraction'][_0xe536('0x114')](db['Tag'],{'through':_0xe536('0x162'),'as':_0xe536('0x163')});db[_0xe536('0x10f')][_0xe536('0x114')](db[_0xe536('0x164')],{'through':_0xe536('0x162'),'as':_0xe536('0x165')});db[_0xe536('0x10f')][_0xe536('0x114')](db['User'],{'as':_0xe536('0x166'),'through':_0xe536('0x11c'),'foreignKey':_0xe536('0x167')});db[_0xe536('0x3f')][_0xe536('0x107')](db[_0xe536('0xe6')],{'as':_0xe536('0x168'),'onDelete':_0xe536('0x10a')});db[_0xe536('0x3f')][_0xe536('0x145')](db[_0xe536('0x13')],{'as':_0xe536('0x13')});db[_0xe536('0x3f')]['belongsTo'](db['CmContact'],{'onDelete':'cascade','as':'Contact'});db[_0xe536('0x3f')][_0xe536('0x145')](db[_0xe536('0x10f')],{'as':'Interaction','foreignKey':_0xe536('0x167')});db[_0xe536('0x3f')][_0xe536('0x145')](db[_0xe536('0x3a')],{'as':'Account','foreignKey':_0xe536('0x155')});db[_0xe536('0x40')][_0xe536('0x145')](db[_0xe536('0x13')],{'onDelete':_0xe536('0x169')});db[_0xe536('0x40')][_0xe536('0x145')](db[_0xe536('0x3c')],{'onDelete':'restrict'});db[_0xe536('0x40')]['belongsTo'](db[_0xe536('0x3a')],{'onDelete':'restrict'});db['MailApplication'][_0xe536('0x145')](db[_0xe536('0x81')],{'onDelete':_0xe536('0x169'),'foreignKey':'IntervalId'});db[_0xe536('0x40')][_0xe536('0x145')](db[_0xe536('0x164')],{'onDelete':_0xe536('0x169'),'foreignKey':_0xe536('0x16a')});db[_0xe536('0x42')][_0xe536('0x145')](db['MailAccount'],{});db[_0xe536('0x42')]['belongsTo'](db[_0xe536('0x117')],{'as':_0xe536('0x15b'),'foreignKey':_0xe536('0x15c')});db[_0xe536('0x42')]['belongsTo'](db[_0xe536('0x6d')],{'as':_0xe536('0x153'),'foreignKey':'ContactId'});db['MailQueueReport']['belongsTo'](db[_0xe536('0x10f')],{});db[_0xe536('0x42')]['belongsTo'](db['MailMessage'],{});db[_0xe536('0x42')][_0xe536('0x145')](db['User'],{});db[_0xe536('0x42')][_0xe536('0x145')](db[_0xe536('0x3c')],{});db['Dashboard'][_0xe536('0x107')](db[_0xe536('0x45')],{'as':_0xe536('0x16b'),'onDelete':'cascade'});db[_0xe536('0x47')][_0xe536('0x107')](db[_0xe536('0x7e')],{'as':'Dispositions','foreignKey':_0xe536('0x16c')});db[_0xe536('0x47')][_0xe536('0x107')](db[_0xe536('0x7c')],{'as':_0xe536('0x159'),'foreignKey':_0xe536('0x16c')});db[_0xe536('0x47')][_0xe536('0x107')](db['FaxInteraction'],{'as':_0xe536('0x15a')});db[_0xe536('0x47')][_0xe536('0x107')](db[_0xe536('0x16d')],{'as':_0xe536('0x16e')});db['FaxAccount'][_0xe536('0x107')](db['VoiceExtension'],{'as':_0xe536('0x16f'),'onDelete':_0xe536('0x10a')});db[_0xe536('0x47')]['hasMany'](db['FaxMessage'],{'as':_0xe536('0x14e')});db[_0xe536('0x47')]['belongsTo'](db[_0xe536('0x2c')],{'as':'Trunk'});db[_0xe536('0x47')][_0xe536('0x145')](db[_0xe536('0x117')],{'as':_0xe536('0x15b'),'foreignKey':_0xe536('0x15c')});db[_0xe536('0x47')][_0xe536('0x145')](db[_0xe536('0x83')],{'as':_0xe536('0x146'),'foreignKey':_0xe536('0x147')});db[_0xe536('0x47')][_0xe536('0x114')](db[_0xe536('0x13')],{'as':_0xe536('0x149'),'through':_0xe536('0x170')});db['FaxApplication']['belongsTo'](db[_0xe536('0x13')],{'onDelete':_0xe536('0x169')});db['FaxApplication'][_0xe536('0x145')](db[_0xe536('0x4b')],{'onDelete':_0xe536('0x169')});db[_0xe536('0x16d')][_0xe536('0x145')](db['FaxAccount'],{'onDelete':_0xe536('0x169')});db[_0xe536('0x16d')][_0xe536('0x145')](db[_0xe536('0x164')],{'onDelete':_0xe536('0x169'),'foreignKey':_0xe536('0x16a')});db['FaxInteraction'][_0xe536('0x107')](db[_0xe536('0x171')],{'as':_0xe536('0x14e'),'onDelete':_0xe536('0x10a'),'foreignKey':'FaxInteractionId'});db['FaxInteraction'][_0xe536('0x145')](db[_0xe536('0x47')],{'as':_0xe536('0x172'),'foreignKey':_0xe536('0x16c')});db[_0xe536('0x48')][_0xe536('0x145')](db['CmContact'],{'as':'Contact','foreignKey':_0xe536('0x160')});db['FaxInteraction']['belongsTo'](db['User'],{'as':_0xe536('0x161'),'foreignKey':_0xe536('0x106')});db['FaxInteraction'][_0xe536('0x114')](db['Tag'],{'through':_0xe536('0x173'),'as':_0xe536('0x163')});db[_0xe536('0x48')][_0xe536('0x114')](db[_0xe536('0x164')],{'through':_0xe536('0x173'),'as':'ThroughTags'});db[_0xe536('0x48')][_0xe536('0x114')](db['User'],{'as':'Users','through':_0xe536('0x11f'),'foreignKey':'FaxInteractionId'});db[_0xe536('0x171')][_0xe536('0x145')](db[_0xe536('0x13')],{'onDelete':_0xe536('0x10a'),'as':_0xe536('0x13')});db['FaxMessage']['belongsTo'](db[_0xe536('0x48')],{'as':_0xe536('0x174'),'foreignKey':_0xe536('0x175')});db['FaxMessage'][_0xe536('0x145')](db[_0xe536('0x6d')],{'onDelete':_0xe536('0x10a'),'as':_0xe536('0x153')});db[_0xe536('0x171')][_0xe536('0x145')](db[_0xe536('0xe6')],{'as':'Attachment','foreignKey':'AttachmentId'});db[_0xe536('0x171')][_0xe536('0x145')](db[_0xe536('0x47')],{'as':_0xe536('0x172'),'foreignKey':_0xe536('0x16c')});db['FaxQueue']['belongsToMany'](db[_0xe536('0x13')],{'as':_0xe536('0x149'),'through':_0xe536('0x129')});db[_0xe536('0x4b')][_0xe536('0x114')](db[_0xe536('0x11a')],{'through':'team_has_fax_queues','as':_0xe536('0x14a')});db[_0xe536('0x4d')][_0xe536('0x145')](db[_0xe536('0x47')],{});db['FaxQueueReport']['belongsTo'](db[_0xe536('0x117')],{'as':_0xe536('0x15b'),'foreignKey':_0xe536('0x15c')});db[_0xe536('0x4d')][_0xe536('0x145')](db['CmContact'],{'as':'Contact','foreignKey':_0xe536('0x160')});db[_0xe536('0x4d')][_0xe536('0x145')](db[_0xe536('0x48')],{});db['FaxQueueReport'][_0xe536('0x145')](db[_0xe536('0x171')],{});db[_0xe536('0x4d')][_0xe536('0x145')](db[_0xe536('0x13')],{});db[_0xe536('0x4d')][_0xe536('0x145')](db[_0xe536('0x4b')],{});db[_0xe536('0x4f')][_0xe536('0x107')](db[_0xe536('0x7e')],{'as':_0xe536('0x158'),'foreignKey':_0xe536('0x176')});db[_0xe536('0x4f')][_0xe536('0x107')](db[_0xe536('0x7c')],{'as':_0xe536('0x159'),'foreignKey':'SmsAccountId'});db['SmsAccount']['hasMany'](db['SmsMessage'],{'as':_0xe536('0x14e'),'foreignKey':_0xe536('0x176')});db[_0xe536('0x4f')][_0xe536('0x107')](db['SmsInteraction'],{'as':_0xe536('0x15a')});db[_0xe536('0x4f')]['hasMany'](db[_0xe536('0x50')],{'as':_0xe536('0x16e')});db[_0xe536('0x4f')][_0xe536('0x145')](db['CmList'],{'as':_0xe536('0x15b'),'foreignKey':'ListId'});db[_0xe536('0x4f')][_0xe536('0x145')](db[_0xe536('0x83')],{'as':_0xe536('0x146'),'foreignKey':'mandatoryDispositionPauseId'});db[_0xe536('0x4f')]['belongsToMany'](db[_0xe536('0x13')],{'as':_0xe536('0x149'),'through':'user_has_sms_accounts'});db[_0xe536('0x50')]['belongsTo'](db[_0xe536('0x13')],{'onDelete':_0xe536('0x169')});db[_0xe536('0x50')]['belongsTo'](db[_0xe536('0x56')],{'onDelete':_0xe536('0x169')});db[_0xe536('0x50')][_0xe536('0x145')](db[_0xe536('0x4f')],{'onDelete':'restrict'});db[_0xe536('0x50')][_0xe536('0x145')](db['Interval'],{'onDelete':'restrict','foreignKey':'IntervalId'});db[_0xe536('0x50')]['belongsTo'](db[_0xe536('0x164')],{'onDelete':'restrict','foreignKey':_0xe536('0x16a')});db[_0xe536('0x52')][_0xe536('0x107')](db[_0xe536('0x54')],{'as':_0xe536('0x14e'),'onDelete':_0xe536('0x10a'),'foreignKey':'SmsInteractionId'});db[_0xe536('0x52')][_0xe536('0x145')](db['SmsAccount'],{'as':'Account','foreignKey':_0xe536('0x176')});db[_0xe536('0x52')][_0xe536('0x145')](db['CmContact'],{'as':_0xe536('0x153'),'foreignKey':_0xe536('0x160')});db[_0xe536('0x52')]['belongsTo'](db['User'],{'as':'Owner','foreignKey':_0xe536('0x106')});db['SmsInteraction'][_0xe536('0x114')](db[_0xe536('0x164')],{'through':'sms_interaction_has_tags','as':_0xe536('0x163')});db[_0xe536('0x52')][_0xe536('0x114')](db[_0xe536('0x164')],{'through':_0xe536('0x177'),'as':_0xe536('0x165')});db[_0xe536('0x52')]['belongsToMany'](db[_0xe536('0x13')],{'as':_0xe536('0x166'),'through':_0xe536('0x120'),'foreignKey':'SmsInteractionId'});db[_0xe536('0x54')][_0xe536('0x145')](db[_0xe536('0x13')],{'as':_0xe536('0x13')});db[_0xe536('0x54')][_0xe536('0x145')](db[_0xe536('0x6d')],{'onDelete':_0xe536('0x10a'),'as':_0xe536('0x153')});db[_0xe536('0x54')][_0xe536('0x145')](db[_0xe536('0x52')],{'onDelete':_0xe536('0x10a'),'as':_0xe536('0x174'),'foreignKey':_0xe536('0x178')});db['SmsMessage'][_0xe536('0x145')](db['SmsAccount'],{'as':_0xe536('0x172'),'foreignKey':_0xe536('0x176')});db['SmsQueue'][_0xe536('0x114')](db[_0xe536('0x13')],{'as':_0xe536('0x149'),'through':'UserSmsQueue','foreignKey':_0xe536('0x179')});db['SmsQueue'][_0xe536('0x114')](db['Team'],{'through':_0xe536('0x17a'),'as':_0xe536('0x14a')});db[_0xe536('0x57')][_0xe536('0x107')](db['Disposition'],{'as':'Dispositions','foreignKey':'OpenchannelAccountId'});db['OpenchannelAccount'][_0xe536('0x107')](db[_0xe536('0x7c')],{'as':_0xe536('0x159'),'foreignKey':_0xe536('0x17b')});db['OpenchannelAccount'][_0xe536('0x107')](db['OpenchannelInteraction'],{'as':_0xe536('0x15a'),'foreignKey':_0xe536('0x17b')});db['OpenchannelAccount'][_0xe536('0x107')](db[_0xe536('0x5b')],{'as':_0xe536('0x14e'),'foreignKey':'OpenchannelAccountId'});db[_0xe536('0x57')][_0xe536('0x107')](db[_0xe536('0x58')],{'as':'Applications','foreignKey':_0xe536('0x17b')});db[_0xe536('0x57')][_0xe536('0x145')](db['CmList'],{'as':_0xe536('0x15b'),'foreignKey':_0xe536('0x15c')});db[_0xe536('0x57')][_0xe536('0x145')](db[_0xe536('0x83')],{'as':_0xe536('0x146'),'foreignKey':'mandatoryDispositionPauseId'});db[_0xe536('0x57')][_0xe536('0x114')](db[_0xe536('0x13')],{'as':'Agents','through':_0xe536('0x133')});db[_0xe536('0x58')][_0xe536('0x145')](db[_0xe536('0x13')],{'onDelete':_0xe536('0x169')});db[_0xe536('0x58')]['belongsTo'](db['OpenchannelQueue'],{'onDelete':_0xe536('0x169'),'foreignKey':_0xe536('0x17c')});db['OpenchannelApplication'][_0xe536('0x145')](db[_0xe536('0x57')],{'onDelete':_0xe536('0x169'),'foreignKey':_0xe536('0x17b')});db[_0xe536('0x58')]['belongsTo'](db[_0xe536('0x81')],{'onDelete':_0xe536('0x169'),'foreignKey':_0xe536('0x144')});db[_0xe536('0x58')]['belongsTo'](db[_0xe536('0x164')],{'onDelete':'restrict','foreignKey':_0xe536('0x16a')});db[_0xe536('0x5a')]['hasMany'](db['OpenchannelMessage'],{'as':_0xe536('0x14e'),'onDelete':'cascade','foreignKey':_0xe536('0x17d')});db[_0xe536('0x5a')][_0xe536('0x145')](db[_0xe536('0x57')],{'as':_0xe536('0x172'),'foreignKey':_0xe536('0x17b')});db[_0xe536('0x5a')][_0xe536('0x145')](db[_0xe536('0x6d')],{'as':_0xe536('0x153'),'foreignKey':'ContactId'});db[_0xe536('0x5a')][_0xe536('0x145')](db[_0xe536('0x13')],{'as':'Owner','foreignKey':'UserId'});db['OpenchannelInteraction'][_0xe536('0x114')](db[_0xe536('0x164')],{'through':'openchannel_interaction_has_tags','as':_0xe536('0x163')});db[_0xe536('0x5a')]['belongsToMany'](db[_0xe536('0x164')],{'through':_0xe536('0x17e'),'as':_0xe536('0x165')});db[_0xe536('0x5a')][_0xe536('0x114')](db[_0xe536('0x13')],{'as':_0xe536('0x166'),'through':'user_has_openchannel_interactions','foreignKey':_0xe536('0x17d')});db[_0xe536('0x5b')][_0xe536('0x145')](db['User'],{'onDelete':_0xe536('0x10a'),'as':_0xe536('0x13')});db[_0xe536('0x5b')][_0xe536('0x145')](db[_0xe536('0x6d')],{'onDelete':'cascade','as':_0xe536('0x153')});db[_0xe536('0x5b')][_0xe536('0x145')](db['OpenchannelInteraction'],{'onDelete':_0xe536('0x10a'),'as':_0xe536('0x174'),'foreignKey':_0xe536('0x17d')});db[_0xe536('0x5b')][_0xe536('0x145')](db[_0xe536('0xe6')],{'as':_0xe536('0xe6'),'foreignKey':_0xe536('0x17f')});db[_0xe536('0x5b')]['belongsTo'](db[_0xe536('0x57')],{'as':_0xe536('0x172'),'foreignKey':_0xe536('0x17b')});db[_0xe536('0x5d')][_0xe536('0x114')](db['User'],{'as':_0xe536('0x149'),'through':_0xe536('0x36'),'foreignKey':_0xe536('0x17c')});db[_0xe536('0x5d')]['belongsToMany'](db[_0xe536('0x11a')],{'through':'team_has_openchannel_queues','as':_0xe536('0x14a')});db[_0xe536('0x5f')][_0xe536('0x107')](db[_0xe536('0x7e')],{'as':_0xe536('0x158'),'foreignKey':_0xe536('0x180')});db[_0xe536('0x5f')][_0xe536('0x107')](db[_0xe536('0x7c')],{'as':_0xe536('0x159'),'foreignKey':_0xe536('0x180')});db[_0xe536('0x5f')][_0xe536('0x107')](db[_0xe536('0x6b')],{'as':_0xe536('0x181')});db[_0xe536('0x5f')][_0xe536('0x107')](db[_0xe536('0x64')],{'as':'Interactions'});db[_0xe536('0x5f')][_0xe536('0x107')](db[_0xe536('0x62')],{'as':_0xe536('0x16e')});db[_0xe536('0x5f')][_0xe536('0x107')](db[_0xe536('0x66')],{'as':'Messages'});db['ChatWebsite'][_0xe536('0x145')](db['CmList'],{'as':'List','foreignKey':'ListId'});db[_0xe536('0x5f')][_0xe536('0x145')](db[_0xe536('0x81')],{'as':_0xe536('0x81'),'foreignKey':_0xe536('0x144')});db['ChatWebsite'][_0xe536('0x145')](db[_0xe536('0x83')],{'as':'mandatoryDispositionPause','foreignKey':_0xe536('0x147')});db['ChatWebsite'][_0xe536('0x114')](db[_0xe536('0x13')],{'as':_0xe536('0x149'),'through':_0xe536('0x182')});db[_0xe536('0x183')][_0xe536('0x145')](db['OpenchannelAccount'],{});db[_0xe536('0x183')]['belongsTo'](db[_0xe536('0x117')],{'as':_0xe536('0x15b'),'foreignKey':'ListId'});db[_0xe536('0x183')][_0xe536('0x145')](db['CmContact'],{'as':_0xe536('0x153'),'foreignKey':'ContactId'});db['OpenchannelQueueReport'][_0xe536('0x145')](db[_0xe536('0x5a')],{});db[_0xe536('0x183')]['belongsTo'](db[_0xe536('0x5b')],{});db[_0xe536('0x183')][_0xe536('0x145')](db[_0xe536('0x13')],{});db[_0xe536('0x183')]['belongsTo'](db[_0xe536('0x5d')],{});db['ChatApplication'][_0xe536('0x145')](db['User'],{'as':_0xe536('0x184'),'foreignKey':_0xe536('0x106'),'onDelete':_0xe536('0x169')});db[_0xe536('0x62')][_0xe536('0x145')](db[_0xe536('0x185')],{'as':_0xe536('0x186'),'foreignKey':_0xe536('0x187'),'onDelete':_0xe536('0x169')});db[_0xe536('0x62')][_0xe536('0x145')](db[_0xe536('0x5f')],{'as':_0xe536('0x188'),'foreignKey':_0xe536('0x180'),'onDelete':_0xe536('0x169')});db[_0xe536('0x62')][_0xe536('0x145')](db['Tag'],{'onDelete':_0xe536('0x169'),'foreignKey':_0xe536('0x16a')});db[_0xe536('0x64')]['hasMany'](db[_0xe536('0x66')],{'as':_0xe536('0x14e'),'onDelete':'cascade','foreignKey':_0xe536('0x189')});db[_0xe536('0x64')][_0xe536('0x145')](db[_0xe536('0x5f')],{'as':_0xe536('0x172'),'foreignKey':'ChatWebsiteId'});db[_0xe536('0x64')]['belongsTo'](db[_0xe536('0x6d')],{'as':'Contact','foreignKey':_0xe536('0x160')});db[_0xe536('0x64')]['belongsTo'](db[_0xe536('0x13')],{'as':_0xe536('0x161'),'foreignKey':'UserId'});db['ChatInteraction']['belongsToMany'](db[_0xe536('0x164')],{'through':_0xe536('0x18a'),'as':'Tags'});db['ChatInteraction'][_0xe536('0x114')](db[_0xe536('0x164')],{'through':_0xe536('0x18a'),'as':_0xe536('0x165')});db[_0xe536('0x64')][_0xe536('0x114')](db[_0xe536('0x13')],{'as':_0xe536('0x166'),'through':_0xe536('0x11e'),'foreignKey':'ChatInteractionId'});db[_0xe536('0x66')][_0xe536('0x145')](db[_0xe536('0x13')],{'onDelete':'cascade','as':'User'});db[_0xe536('0x66')][_0xe536('0x145')](db['CmContact'],{'onDelete':_0xe536('0x10a'),'as':_0xe536('0x153'),'foreignKey':_0xe536('0x160')});db[_0xe536('0x66')]['belongsTo'](db[_0xe536('0x64')],{'onDelete':_0xe536('0x10a'),'as':_0xe536('0x174'),'foreignKey':_0xe536('0x189')});db[_0xe536('0x66')][_0xe536('0x145')](db[_0xe536('0xe6')],{'as':_0xe536('0xe6'),'foreignKey':_0xe536('0x17f')});db[_0xe536('0x66')][_0xe536('0x145')](db[_0xe536('0x5f')],{'as':'Account','foreignKey':_0xe536('0x180')});db[_0xe536('0x18b')][_0xe536('0x145')](db[_0xe536('0x6d')],{'onDelete':_0xe536('0x10a'),'as':_0xe536('0x153'),'foreignKey':_0xe536('0x160')});db['ChatOfflineMessage'][_0xe536('0x145')](db[_0xe536('0x5f')],{'as':_0xe536('0x172'),'foreignKey':_0xe536('0x180')});db['ChatQueue'][_0xe536('0x114')](db[_0xe536('0x13')],{'as':'Agents','through':_0xe536('0x32'),'hooks':!![]});db['ChatQueue']['belongsToMany'](db[_0xe536('0x11a')],{'through':_0xe536('0x18c'),'as':'Teams'});db[_0xe536('0x69')][_0xe536('0x107')](db[_0xe536('0xd0')],{'as':_0xe536('0x14e'),'foreignKey':'ChatGroupId','onDelete':'cascade'});db['ChatGroup'][_0xe536('0x114')](db[_0xe536('0x13')],{'as':_0xe536('0x18d'),'through':_0xe536('0x113')});db[_0xe536('0x6b')][_0xe536('0x145')](db[_0xe536('0x5f')],{'as':'Website','foreignKey':_0xe536('0x180')});db['CmCompany'][_0xe536('0x107')](db[_0xe536('0x6d')],{'as':_0xe536('0x115'),'foreignKey':_0xe536('0x18e')});db[_0xe536('0x6d')]['hasMany'](db['CmHopper'],{'as':'Hoppers','foreignKey':'ContactId'});db['CmContact']['hasMany'](db[_0xe536('0x18f')],{'as':_0xe536('0x10b'),'foreignKey':'ContactId'});db[_0xe536('0x6d')]['hasMany'](db[_0xe536('0x73')],{'as':_0xe536('0x13f'),'foreignKey':'ContactId'});db[_0xe536('0x6d')][_0xe536('0x107')](db[_0xe536('0x75')],{'as':_0xe536('0x75'),'foreignKey':_0xe536('0x160')});db[_0xe536('0x6d')][_0xe536('0x107')](db['JscriptySessionReport'],{'as':_0xe536('0x140'),'foreignKey':_0xe536('0x160')});db[_0xe536('0x6d')][_0xe536('0x107')](db[_0xe536('0x5a')],{'as':_0xe536('0x10c'),'foreignKey':'ContactId','onDelete':_0xe536('0x169')});db[_0xe536('0x6d')]['hasMany'](db[_0xe536('0x64')],{'as':_0xe536('0x11d'),'foreignKey':_0xe536('0x160'),'onDelete':_0xe536('0x169')});db[_0xe536('0x6d')][_0xe536('0x107')](db[_0xe536('0x52')],{'as':_0xe536('0x10d'),'foreignKey':_0xe536('0x160'),'onDelete':_0xe536('0x169')});db[_0xe536('0x6d')][_0xe536('0x107')](db['FaxInteraction'],{'as':_0xe536('0x10e'),'foreignKey':_0xe536('0x160'),'onDelete':_0xe536('0x169')});db[_0xe536('0x6d')]['hasMany'](db[_0xe536('0x10f')],{'as':_0xe536('0x11b'),'foreignKey':'ContactId','onDelete':_0xe536('0x169')});db[_0xe536('0x6d')]['belongsTo'](db[_0xe536('0x190')],{'as':_0xe536('0x191'),'foreignKey':_0xe536('0x18e')});db[_0xe536('0x6d')][_0xe536('0x145')](db[_0xe536('0x117')],{'as':_0xe536('0x15b'),'foreignKey':'ListId','onDelete':'cascade'});db[_0xe536('0x6d')][_0xe536('0x114')](db['User'],{'as':_0xe536('0x166'),'through':'cm_user_has_contacts'});db[_0xe536('0x6d')][_0xe536('0x114')](db[_0xe536('0x164')],{'as':'Tags','through':'cm_contact_has_tags'});db[_0xe536('0x6d')]['belongsToMany'](db[_0xe536('0x164')],{'through':_0xe536('0x192'),'as':_0xe536('0x165')});db[_0xe536('0x6f')][_0xe536('0x145')](db[_0xe536('0x6d')],{'as':'Contact','foreignKey':_0xe536('0x160'),'onDelete':_0xe536('0x10a')});db[_0xe536('0x6f')]['belongsTo'](db[_0xe536('0x117')],{'as':'List','foreignKey':_0xe536('0x15c'),'onDelete':_0xe536('0x10a')});db[_0xe536('0x6f')]['belongsTo'](db['User'],{'as':_0xe536('0x184'),'foreignKey':_0xe536('0x106')});db[_0xe536('0x6f')][_0xe536('0x145')](db[_0xe536('0x1c')],{'as':_0xe536('0x186'),'foreignKey':'VoiceQueueId','onDelete':'cascade'});db[_0xe536('0x6f')]['belongsTo'](db[_0xe536('0xe4')],{'as':_0xe536('0xe4'),'foreignKey':'CampaignId','onDelete':_0xe536('0x10a')});db[_0xe536('0x6f')]['belongsTo'](db[_0xe536('0x13')],{'as':_0xe536('0x161'),'foreignKey':_0xe536('0x193')});db[_0xe536('0x71')][_0xe536('0x145')](db[_0xe536('0x6d')],{'as':_0xe536('0x153'),'foreignKey':_0xe536('0x160'),'onDelete':_0xe536('0x10a')});db[_0xe536('0x71')][_0xe536('0x145')](db[_0xe536('0x117')],{'as':_0xe536('0x15b'),'foreignKey':_0xe536('0x15c'),'onDelete':_0xe536('0x10a')});db[_0xe536('0x71')]['belongsTo'](db[_0xe536('0x1c')],{'as':_0xe536('0x186'),'foreignKey':'VoiceQueueId','onDelete':'cascade'});db[_0xe536('0x71')][_0xe536('0x145')](db['Campaign'],{'as':_0xe536('0xe4'),'foreignKey':_0xe536('0x194'),'onDelete':_0xe536('0x10a')});db[_0xe536('0x7a')][_0xe536('0x107')](db['Condition'],{'as':{'plural':_0xe536('0x195'),'singular':_0xe536('0x196')},'foreignKey':_0xe536('0x197'),'onDelete':_0xe536('0x10a'),'hooks':!![]});db[_0xe536('0x7a')][_0xe536('0x107')](db[_0xe536('0x7f')],{'as':{'plural':_0xe536('0x198'),'singular':_0xe536('0x199')},'foreignKey':_0xe536('0x19a'),'onDelete':_0xe536('0x10a'),'hooks':!![]});db[_0xe536('0x7a')][_0xe536('0x107')](db['Action'],{'as':'Actions','foreignKey':_0xe536('0x19b'),'onDelete':'cascade','hooks':!![]});db['Interval'][_0xe536('0x107')](db[_0xe536('0x81')],{'as':_0xe536('0x19c'),'foreignKey':'IntervalId','onDelete':_0xe536('0x10a'),'hooks':!![],'required':![]});db[_0xe536('0x81')][_0xe536('0x107')](db[_0xe536('0x138')],{'as':_0xe536('0x19d'),'foreignKey':_0xe536('0x144'),'onDelete':_0xe536('0x169')});db['Interval']['hasMany'](db['MailApplication'],{'as':_0xe536('0x19e'),'foreignKey':_0xe536('0x144')});db[_0xe536('0x81')][_0xe536('0x107')](db[_0xe536('0x62')],{'as':_0xe536('0x19f'),'foreignKey':_0xe536('0x144')});db['Interval'][_0xe536('0x107')](db[_0xe536('0x16d')],{'as':_0xe536('0x1a0'),'foreignKey':'IntervalId'});db[_0xe536('0x81')]['hasMany'](db['SmsApplication'],{'as':_0xe536('0x1a1'),'foreignKey':_0xe536('0x144')});db[_0xe536('0x87')]['belongsTo'](db['MailAccount'],{});db['Schedule'][_0xe536('0x145')](db[_0xe536('0x93')],{'foreignKey':'DefaultReportId'});db['Schedule']['belongsTo'](db[_0xe536('0x1a2')],{'foreignKey':_0xe536('0x1a3')});db[_0xe536('0x13a')]['belongsToMany'](db['VoiceMusicOnHold'],{'as':_0xe536('0x1a4'),'through':_0xe536('0x13b'),'onDelete':_0xe536('0x169')});db[_0xe536('0x164')][_0xe536('0x114')](db[_0xe536('0x6d')],{'through':_0xe536('0x192')});db[_0xe536('0x164')][_0xe536('0x114')](db[_0xe536('0x64')],{'through':_0xe536('0x18a')});db['Tag'][_0xe536('0x114')](db[_0xe536('0x10f')],{'through':_0xe536('0x162')});db[_0xe536('0x164')]['belongsToMany'](db[_0xe536('0x52')],{'through':_0xe536('0x177')});db[_0xe536('0x164')]['belongsToMany'](db[_0xe536('0x48')],{'through':_0xe536('0x173')});db[_0xe536('0x164')]['belongsToMany'](db['OpenchannelInteraction'],{'through':_0xe536('0x17e')});db[_0xe536('0x164')][_0xe536('0x114')](db[_0xe536('0xfc')],{'through':_0xe536('0x1a5')});db[_0xe536('0x8c')][_0xe536('0x107')](db[_0xe536('0x7f')],{'as':{'plural':_0xe536('0x1a6'),'singular':_0xe536('0x1a7')},'foreignKey':'TriggerAllId','onDelete':_0xe536('0x10a'),'hooks':!![]});db[_0xe536('0x8c')][_0xe536('0x107')](db[_0xe536('0x7f')],{'as':{'plural':_0xe536('0x1a8'),'singular':'AnyCondition'},'foreignKey':_0xe536('0x1a9'),'onDelete':_0xe536('0x10a'),'hooks':!![]});db[_0xe536('0x8c')]['hasMany'](db[_0xe536('0x78')],{'as':_0xe536('0x1aa'),'foreignKey':'TriggerId','onDelete':_0xe536('0x10a'),'hooks':!![]});db['AnalyticCustomReport'][_0xe536('0x107')](db[_0xe536('0x99')],{'as':_0xe536('0x1ab'),'onDelete':_0xe536('0x10a'),'foreignKey':_0xe536('0x1a3'),'hooks':!![]});db[_0xe536('0x93')][_0xe536('0x107')](db[_0xe536('0x99')],{'as':_0xe536('0x1ab'),'onDelete':_0xe536('0x10a'),'foreignKey':_0xe536('0x1ac')});db[_0xe536('0x97')][_0xe536('0x107')](db[_0xe536('0x99')],{'as':_0xe536('0x1ab'),'onDelete':'cascade','foreignKey':_0xe536('0x1ad')});db['AnalyticFieldReport']['belongsTo'](db[_0xe536('0x97')],{'foreignKey':_0xe536('0x1ad')});db[_0xe536('0x1ae')][_0xe536('0x107')](db[_0xe536('0x1af')],{'as':_0xe536('0x1b0'),'onDelete':'cascade','foreignKey':_0xe536('0x1b1')});db[_0xe536('0x1af')]['hasMany'](db[_0xe536('0x9e')],{'as':'Subjects','onDelete':_0xe536('0x10a'),'foreignKey':'SubjectId'});db['SalesforceConfiguration'][_0xe536('0x107')](db['SalesforceField'],{'as':_0xe536('0x1b2'),'onDelete':'cascade','foreignKey':_0xe536('0x1b3')});db['SalesforceConfiguration'][_0xe536('0x107')](db[_0xe536('0x9e')],{'as':_0xe536('0x1ab'),'onDelete':'cascade','foreignKey':_0xe536('0x1b4')});db[_0xe536('0x1af')][_0xe536('0x145')](db[_0xe536('0x1ae')],{'as':_0xe536('0x172'),'foreignKey':_0xe536('0x1b1')});db[_0xe536('0x9e')][_0xe536('0x107')](db['SalesforceField'],{'as':_0xe536('0x1b5'),'foreignKey':_0xe536('0x1b6')});db[_0xe536('0x9e')][_0xe536('0x107')](db['SalesforceField'],{'as':_0xe536('0x1b7'),'foreignKey':_0xe536('0x1b3')});db[_0xe536('0x9e')]['hasMany'](db[_0xe536('0x9e')],{'as':'Field','foreignKey':_0xe536('0x1b4')});db['SalesforceField'][_0xe536('0x145')](db[_0xe536('0x1b8')],{'as':_0xe536('0x1b8'),'foreignKey':_0xe536('0x1b9')});db[_0xe536('0xa0')][_0xe536('0x107')](db[_0xe536('0x1ba')],{'as':_0xe536('0x1b0'),'onDelete':_0xe536('0x10a'),'foreignKey':_0xe536('0x1b1')});db[_0xe536('0x1ba')][_0xe536('0x107')](db[_0xe536('0xa2')],{'as':_0xe536('0x1bb'),'onDelete':_0xe536('0x10a'),'foreignKey':_0xe536('0x1b6')});db[_0xe536('0x1ba')]['hasMany'](db[_0xe536('0xa2')],{'as':_0xe536('0x1b2'),'onDelete':_0xe536('0x10a'),'foreignKey':_0xe536('0x1b3')});db[_0xe536('0x1ba')][_0xe536('0x107')](db['SugarcrmField'],{'as':'Fields','onDelete':'cascade','foreignKey':'FieldId'});db[_0xe536('0x1ba')][_0xe536('0x145')](db[_0xe536('0xa0')],{'as':'Account','foreignKey':'AccountId'});db[_0xe536('0xa2')][_0xe536('0x107')](db['SugarcrmField'],{'as':_0xe536('0x1b5'),'foreignKey':_0xe536('0x1b6')});db[_0xe536('0xa2')][_0xe536('0x107')](db[_0xe536('0xa2')],{'as':_0xe536('0x1b7'),'foreignKey':'DescriptionId'});db[_0xe536('0xa2')][_0xe536('0x107')](db[_0xe536('0xa2')],{'as':_0xe536('0x1bc'),'foreignKey':_0xe536('0x1b4')});db[_0xe536('0xa2')][_0xe536('0x145')](db[_0xe536('0x1b8')],{'as':_0xe536('0x1b8'),'foreignKey':'VariableId'});db['DeskAccount'][_0xe536('0x107')](db[_0xe536('0xa5')],{'as':_0xe536('0x1b0'),'onDelete':'cascade','foreignKey':_0xe536('0x1b1')});db[_0xe536('0xa5')][_0xe536('0x107')](db['DeskField'],{'as':_0xe536('0x1bb'),'onDelete':_0xe536('0x10a'),'foreignKey':_0xe536('0x1b6')});db[_0xe536('0xa5')][_0xe536('0x107')](db[_0xe536('0xa7')],{'as':_0xe536('0x1b2'),'onDelete':_0xe536('0x10a'),'foreignKey':_0xe536('0x1b3')});db[_0xe536('0xa5')]['hasMany'](db['DeskField'],{'as':_0xe536('0x1ab'),'onDelete':_0xe536('0x10a'),'foreignKey':_0xe536('0x1b4')});db[_0xe536('0xa5')][_0xe536('0x145')](db[_0xe536('0xa4')],{'as':'Account','foreignKey':_0xe536('0x1b1')});db[_0xe536('0xa5')][_0xe536('0x114')](db[_0xe536('0x164')],{'through':_0xe536('0x1bd')});db['DeskField']['hasMany'](db[_0xe536('0xa7')],{'as':_0xe536('0x1b5'),'foreignKey':'SubjectId'});db[_0xe536('0xa7')]['hasMany'](db[_0xe536('0xa7')],{'as':'Description','foreignKey':_0xe536('0x1b3')});db[_0xe536('0xa7')][_0xe536('0x107')](db[_0xe536('0xa7')],{'as':_0xe536('0x1bc'),'foreignKey':_0xe536('0x1b4')});db['DeskField'][_0xe536('0x145')](db[_0xe536('0x1b8')],{'as':_0xe536('0x1b8'),'foreignKey':_0xe536('0x1b9')});db['ZohoAccount'][_0xe536('0x107')](db[_0xe536('0xaa')],{'as':'Configurations','onDelete':_0xe536('0x10a'),'foreignKey':_0xe536('0x1b1')});db['ZohoConfiguration'][_0xe536('0x107')](db[_0xe536('0x1be')],{'as':_0xe536('0x1bb'),'onDelete':_0xe536('0x10a'),'foreignKey':_0xe536('0x1b6')});db[_0xe536('0xaa')][_0xe536('0x107')](db['ZohoField'],{'as':'Descriptions','onDelete':_0xe536('0x10a'),'foreignKey':_0xe536('0x1b3')});db['ZohoConfiguration'][_0xe536('0x107')](db[_0xe536('0x1be')],{'as':_0xe536('0x1ab'),'onDelete':_0xe536('0x10a'),'foreignKey':'FieldId'});db['ZohoConfiguration'][_0xe536('0x145')](db[_0xe536('0xa9')],{'as':_0xe536('0x172'),'foreignKey':_0xe536('0x1b1')});db[_0xe536('0x1be')][_0xe536('0x107')](db[_0xe536('0x1be')],{'as':_0xe536('0x1b5'),'foreignKey':_0xe536('0x1b6')});db[_0xe536('0x1be')][_0xe536('0x107')](db[_0xe536('0x1be')],{'as':_0xe536('0x1b7'),'foreignKey':_0xe536('0x1b3')});db[_0xe536('0x1be')][_0xe536('0x107')](db[_0xe536('0x1be')],{'as':_0xe536('0x1bc'),'foreignKey':'FieldId'});db['ZohoField'][_0xe536('0x145')](db['Variable'],{'as':_0xe536('0x1b8'),'foreignKey':_0xe536('0x1b9')});db['ZendeskAccount'][_0xe536('0x107')](db['ZendeskConfiguration'],{'as':_0xe536('0x1b0'),'onDelete':_0xe536('0x10a'),'foreignKey':_0xe536('0x1b1')});db[_0xe536('0xae')]['hasMany'](db[_0xe536('0xb0')],{'as':_0xe536('0x1bb'),'foreignKey':'SubjectId'});db[_0xe536('0xae')][_0xe536('0x107')](db[_0xe536('0xb0')],{'as':_0xe536('0x1b2'),'foreignKey':_0xe536('0x1b3')});db['ZendeskConfiguration'][_0xe536('0x107')](db[_0xe536('0xb0')],{'as':_0xe536('0x1ab'),'foreignKey':'FieldId'});db[_0xe536('0xae')]['belongsTo'](db['ZendeskAccount'],{'as':_0xe536('0x172'),'foreignKey':_0xe536('0x1b1')});db[_0xe536('0xae')][_0xe536('0x114')](db['Tag'],{'through':_0xe536('0x1bf')});db[_0xe536('0xb0')][_0xe536('0x107')](db[_0xe536('0xb0')],{'as':_0xe536('0x1b5'),'foreignKey':_0xe536('0x1b6')});db['ZendeskField'][_0xe536('0x107')](db[_0xe536('0xb0')],{'as':_0xe536('0x1b7'),'foreignKey':_0xe536('0x1b3')});db[_0xe536('0xb0')][_0xe536('0x107')](db['ZendeskField'],{'as':_0xe536('0x1bc'),'foreignKey':_0xe536('0x1b4')});db[_0xe536('0xb0')][_0xe536('0x145')](db[_0xe536('0x1b8')],{'as':_0xe536('0x1b8'),'foreignKey':_0xe536('0x1b9')});db[_0xe536('0xb2')][_0xe536('0x107')](db['FreshdeskConfiguration'],{'as':_0xe536('0x1b0'),'onDelete':'cascade','foreignKey':_0xe536('0x1b1')});db[_0xe536('0xb4')][_0xe536('0x107')](db[_0xe536('0xb6')],{'as':_0xe536('0x1bb'),'onDelete':_0xe536('0x10a'),'foreignKey':_0xe536('0x1b6')});db[_0xe536('0xb4')]['hasMany'](db[_0xe536('0xb6')],{'as':'Descriptions','onDelete':_0xe536('0x10a'),'foreignKey':_0xe536('0x1b3')});db[_0xe536('0xb4')][_0xe536('0x107')](db['FreshdeskField'],{'as':'Fields','onDelete':_0xe536('0x10a'),'foreignKey':_0xe536('0x1b4')});db[_0xe536('0xb4')]['belongsTo'](db[_0xe536('0xb2')],{'as':_0xe536('0x172'),'foreignKey':_0xe536('0x1b1')});db[_0xe536('0xb4')][_0xe536('0x114')](db['Tag'],{'through':_0xe536('0x1c0')});db['FreshdeskField'][_0xe536('0x107')](db[_0xe536('0xb6')],{'as':_0xe536('0x1b5'),'foreignKey':_0xe536('0x1b6')});db[_0xe536('0xb6')][_0xe536('0x107')](db[_0xe536('0xb6')],{'as':'Description','foreignKey':_0xe536('0x1b3')});db['FreshdeskField'][_0xe536('0x107')](db[_0xe536('0xb6')],{'as':_0xe536('0x1bc'),'foreignKey':_0xe536('0x1b4')});db['FreshdeskField']['belongsTo'](db[_0xe536('0x1b8')],{'as':_0xe536('0x1b8'),'foreignKey':_0xe536('0x1b9')});db['VtigerAccount']['hasMany'](db[_0xe536('0xba')],{'as':_0xe536('0x1b0'),'onDelete':_0xe536('0x10a'),'foreignKey':_0xe536('0x1b1')});db[_0xe536('0xba')][_0xe536('0x107')](db[_0xe536('0xbc')],{'as':'Subjects','foreignKey':_0xe536('0x1b6')});db['VtigerConfiguration'][_0xe536('0x107')](db[_0xe536('0xbc')],{'as':_0xe536('0x1b2'),'foreignKey':'DescriptionId'});db['VtigerConfiguration'][_0xe536('0x107')](db['VtigerField'],{'as':_0xe536('0x1ab'),'foreignKey':_0xe536('0x1b4')});db[_0xe536('0xba')][_0xe536('0x145')](db['VtigerAccount'],{'as':_0xe536('0x172'),'foreignKey':_0xe536('0x1b1')});db[_0xe536('0xbc')]['hasMany'](db[_0xe536('0xbc')],{'as':'Subject','foreignKey':_0xe536('0x1b6')});db[_0xe536('0xbc')]['hasMany'](db['VtigerField'],{'as':_0xe536('0x1b7'),'foreignKey':_0xe536('0x1b3')});db[_0xe536('0xbc')][_0xe536('0x107')](db[_0xe536('0xbc')],{'as':_0xe536('0x1bc'),'foreignKey':_0xe536('0x1b4')});db[_0xe536('0xbc')][_0xe536('0x145')](db['Variable'],{'as':'Variable','foreignKey':_0xe536('0x1b9')});db[_0xe536('0xbe')][_0xe536('0x107')](db[_0xe536('0x1c1')],{'as':_0xe536('0x1b0'),'onDelete':_0xe536('0x10a'),'foreignKey':_0xe536('0x1b1')});db[_0xe536('0x1c1')]['hasMany'](db[_0xe536('0xc0')],{'as':_0xe536('0x1bb'),'foreignKey':'SubjectId'});db[_0xe536('0x1c1')][_0xe536('0x107')](db[_0xe536('0xc0')],{'as':_0xe536('0x1b2'),'foreignKey':_0xe536('0x1b3')});db[_0xe536('0x1c1')][_0xe536('0x107')](db[_0xe536('0xc0')],{'as':'Fields','foreignKey':_0xe536('0x1b4')});db[_0xe536('0x1c1')][_0xe536('0x145')](db['ServicenowAccount'],{'as':_0xe536('0x172'),'foreignKey':'AccountId'});db[_0xe536('0xc0')]['hasMany'](db[_0xe536('0xc0')],{'as':_0xe536('0x1b5'),'foreignKey':_0xe536('0x1b6')});db[_0xe536('0xc0')][_0xe536('0x107')](db[_0xe536('0xc0')],{'as':_0xe536('0x1b7'),'foreignKey':_0xe536('0x1b3')});db[_0xe536('0xc0')]['hasMany'](db['ServicenowField'],{'as':'Field','foreignKey':_0xe536('0x1b4')});db[_0xe536('0xc0')][_0xe536('0x145')](db[_0xe536('0x1b8')],{'as':_0xe536('0x1b8'),'foreignKey':_0xe536('0x1b9')});db[_0xe536('0xc2')][_0xe536('0x107')](db[_0xe536('0xc4')],{'as':_0xe536('0x1b0'),'onDelete':_0xe536('0x10a'),'foreignKey':_0xe536('0x1b1')});db[_0xe536('0xc4')]['hasMany'](db['Dynamics365Field'],{'as':'Subjects','onDelete':'cascade','foreignKey':'SubjectId'});db['Dynamics365Configuration'][_0xe536('0x107')](db[_0xe536('0xc6')],{'as':_0xe536('0x1b2'),'onDelete':_0xe536('0x10a'),'foreignKey':_0xe536('0x1b3')});db[_0xe536('0xc4')][_0xe536('0x107')](db[_0xe536('0xc6')],{'as':_0xe536('0x1ab'),'onDelete':'cascade','foreignKey':_0xe536('0x1b4')});db['Dynamics365Configuration']['belongsTo'](db[_0xe536('0xc2')],{'as':_0xe536('0x172'),'foreignKey':_0xe536('0x1b1')});db[_0xe536('0xc6')][_0xe536('0x107')](db[_0xe536('0xc6')],{'as':_0xe536('0x1b5'),'foreignKey':_0xe536('0x1b6')});db[_0xe536('0xc6')][_0xe536('0x107')](db['Dynamics365Field'],{'as':_0xe536('0x1b7'),'foreignKey':'DescriptionId'});db['Dynamics365Field']['hasMany'](db['Dynamics365Field'],{'as':'Field','foreignKey':_0xe536('0x1b4')});db[_0xe536('0xc6')][_0xe536('0x145')](db['Variable'],{'as':'Variable','foreignKey':_0xe536('0x1b9')});db[_0xe536('0xc8')]['hasMany'](db[_0xe536('0xca')],{'as':_0xe536('0x1b0'),'onDelete':_0xe536('0x10a'),'foreignKey':_0xe536('0x1b1')});db[_0xe536('0xca')][_0xe536('0x107')](db[_0xe536('0xcc')],{'as':_0xe536('0x1bb'),'foreignKey':_0xe536('0x1b6')});db[_0xe536('0xca')][_0xe536('0x107')](db[_0xe536('0xcc')],{'as':'Descriptions','foreignKey':_0xe536('0x1b3')});db[_0xe536('0xca')][_0xe536('0x107')](db[_0xe536('0xcc')],{'as':_0xe536('0x1ab'),'foreignKey':'FieldId'});db[_0xe536('0xca')][_0xe536('0x145')](db[_0xe536('0xc8')],{'as':_0xe536('0x172'),'foreignKey':_0xe536('0x1b1')});db[_0xe536('0xcc')][_0xe536('0x107')](db[_0xe536('0xcc')],{'as':'Subject','foreignKey':'SubjectId'});db[_0xe536('0xcc')][_0xe536('0x107')](db[_0xe536('0xcc')],{'as':_0xe536('0x1b7'),'foreignKey':_0xe536('0x1b3')});db[_0xe536('0xcc')][_0xe536('0x107')](db[_0xe536('0xcc')],{'as':_0xe536('0x1bc'),'foreignKey':'FieldId'});db[_0xe536('0xcc')][_0xe536('0x145')](db[_0xe536('0x1b8')],{'as':_0xe536('0x1b8'),'foreignKey':_0xe536('0x1b9')});db[_0xe536('0xcf')][_0xe536('0x145')](db[_0xe536('0x5f')],{});db[_0xe536('0xcf')][_0xe536('0x145')](db[_0xe536('0x117')],{'as':_0xe536('0x15b'),'foreignKey':_0xe536('0x15c')});db[_0xe536('0xcf')][_0xe536('0x145')](db[_0xe536('0x6d')],{'as':_0xe536('0x153'),'foreignKey':_0xe536('0x160')});db[_0xe536('0xcf')][_0xe536('0x145')](db['ChatInteraction'],{});db[_0xe536('0xcf')][_0xe536('0x145')](db['ChatMessage'],{});db[_0xe536('0xcf')][_0xe536('0x145')](db[_0xe536('0x13')],{});db[_0xe536('0xcf')]['belongsTo'](db[_0xe536('0x185')],{});db[_0xe536('0xd0')][_0xe536('0x145')](db[_0xe536('0x13')],{'onDelete':_0xe536('0x10a'),'foreignKey':_0xe536('0x1c2')});db[_0xe536('0xd0')][_0xe536('0x145')](db[_0xe536('0x13')],{'onDelete':'cascade','foreignKey':_0xe536('0x1c3')});db[_0xe536('0xd4')]['hasMany'](db[_0xe536('0x1c4')],{'foreignKey':_0xe536('0x1c5'),'onDelete':'cascade'});db[_0xe536('0xd4')][_0xe536('0x107')](db[_0xe536('0x1c6')],{'foreignKey':_0xe536('0x1c5'),'onDelete':_0xe536('0x10a')});db[_0xe536('0x1c7')]['belongsTo'](db[_0xe536('0x4f')],{});db[_0xe536('0x1c7')][_0xe536('0x145')](db[_0xe536('0x117')],{'as':_0xe536('0x15b'),'foreignKey':_0xe536('0x15c')});db['SmsQueueReport']['belongsTo'](db[_0xe536('0x6d')],{'as':'Contact','foreignKey':_0xe536('0x160')});db['SmsQueueReport']['belongsTo'](db[_0xe536('0x52')],{});db[_0xe536('0x1c7')][_0xe536('0x145')](db['SmsMessage'],{});db[_0xe536('0x1c7')]['belongsTo'](db[_0xe536('0x13')],{});db[_0xe536('0x1c7')]['belongsTo'](db['SmsQueue'],{});db[_0xe536('0x1c8')]['hasMany'](db['JscriptySessionReport'],{'foreignKey':'ProjectId'});db[_0xe536('0x1c8')][_0xe536('0x107')](db[_0xe536('0x1c4')],{'foreignKey':_0xe536('0x1c9')});db[_0xe536('0x1c8')]['hasMany'](db['JscriptyAnswerReport'],{'foreignKey':'ProjectId'});db[_0xe536('0xdf')][_0xe536('0x114')](db[_0xe536('0x13')],{'as':'Users','through':_0xe536('0x1ca')});db[_0xe536('0x11a')][_0xe536('0x114')](db[_0xe536('0x13')],{'as':_0xe536('0x149'),'through':_0xe536('0x1cb')});db[_0xe536('0x11a')][_0xe536('0x114')](db[_0xe536('0x1c')],{'through':_0xe536('0x14b'),'as':'VoiceQueues'});db[_0xe536('0x11a')][_0xe536('0x114')](db[_0xe536('0x3c')],{'through':'team_has_mail_queues','as':'MailQueues'});db[_0xe536('0x11a')][_0xe536('0x114')](db[_0xe536('0x185')],{'through':_0xe536('0x18c'),'as':_0xe536('0x127')});db[_0xe536('0x11a')][_0xe536('0x114')](db[_0xe536('0x4b')],{'through':'team_has_fax_queues','as':_0xe536('0x128')});db[_0xe536('0x11a')][_0xe536('0x114')](db['SmsQueue'],{'through':_0xe536('0x17a'),'as':'SmsQueues'});db['Team'][_0xe536('0x114')](db['OpenchannelQueue'],{'through':_0xe536('0x1cc'),'as':_0xe536('0x1cd')});db['Team'][_0xe536('0x114')](db[_0xe536('0x12b')],{'through':_0xe536('0x1ce'),'as':_0xe536('0x12c')});db[_0xe536('0xe4')][_0xe536('0x107')](db[_0xe536('0x6f')],{'as':_0xe536('0x13e'),'foreignKey':_0xe536('0x194')});db[_0xe536('0xe4')][_0xe536('0x107')](db['CmHopperFinal'],{'as':'HopperFinals','foreignKey':_0xe536('0x194')});db['Campaign'][_0xe536('0x107')](db[_0xe536('0x73')],{'as':_0xe536('0x13f'),'foreignKey':_0xe536('0x194')});db[_0xe536('0xe4')]['hasMany'](db[_0xe536('0x71')],{'as':_0xe536('0x1cf'),'foreignKey':'CampaignId'});db[_0xe536('0xe4')]['belongsTo'](db[_0xe536('0x2c')],{'as':'Trunk','foreignKey':_0xe536('0x141')});db[_0xe536('0xe4')][_0xe536('0x145')](db[_0xe536('0x2c')],{'as':_0xe536('0x142'),'foreignKey':_0xe536('0x143')});db[_0xe536('0xe4')][_0xe536('0x145')](db[_0xe536('0x81')],{'as':'Interval','foreignKey':_0xe536('0x144')});db['Campaign'][_0xe536('0x145')](db[_0xe536('0xdf')],{'as':_0xe536('0xdf'),'foreignKey':_0xe536('0x1d0')});db[_0xe536('0xe4')][_0xe536('0x114')](db[_0xe536('0x117')],{'as':'Lists','through':'campaigns_has_cm_lists'});db[_0xe536('0xe4')][_0xe536('0x114')](db['CmList'],{'as':'BlackLists','through':_0xe536('0x1d1')});db[_0xe536('0x1d2')][_0xe536('0x145')](db[_0xe536('0x3f')],{});db['MailTransferReport']['belongsTo'](db[_0xe536('0x10f')],{});db[_0xe536('0x1d2')][_0xe536('0x145')](db['MailAccount'],{'foreignKey':'FromMailAccountId','as':_0xe536('0x1d3')});db['MailTransferReport'][_0xe536('0x145')](db[_0xe536('0x13')],{'foreignKey':'FromUserId','as':_0xe536('0x1d4')});db[_0xe536('0x1d2')][_0xe536('0x145')](db[_0xe536('0x13')],{'foreignKey':_0xe536('0x1d5'),'as':_0xe536('0x1d6')});db[_0xe536('0x1d2')]['belongsTo'](db[_0xe536('0x3c')],{'foreignKey':_0xe536('0x1d7'),'as':'ToQueue'});db[_0xe536('0x1d2')]['belongsTo'](db[_0xe536('0x3a')],{'foreignKey':_0xe536('0x1d8'),'as':'ToAccount'});db[_0xe536('0xeb')]['belongsTo'](db[_0xe536('0x66')],{});db[_0xe536('0xeb')][_0xe536('0x145')](db[_0xe536('0x64')],{});db[_0xe536('0xeb')]['belongsTo'](db[_0xe536('0x5f')],{'foreignKey':_0xe536('0x1d9'),'as':'FromAccount'});db['ChatTransferReport'][_0xe536('0x145')](db[_0xe536('0x13')],{'foreignKey':_0xe536('0x1da'),'as':_0xe536('0x1d4')});db[_0xe536('0xeb')][_0xe536('0x145')](db[_0xe536('0x13')],{'foreignKey':'ToUserId','as':'ToAgent'});db[_0xe536('0xeb')][_0xe536('0x145')](db[_0xe536('0x185')],{'foreignKey':'ToChatQueueId','as':_0xe536('0x1db')});db['ChatTransferReport'][_0xe536('0x145')](db[_0xe536('0x5f')],{'foreignKey':_0xe536('0x1dc'),'as':'ToAccount'});db['FaxTransferReport'][_0xe536('0x145')](db[_0xe536('0x171')],{});db['FaxTransferReport'][_0xe536('0x145')](db[_0xe536('0x48')],{});db[_0xe536('0x1dd')][_0xe536('0x145')](db['FaxAccount'],{'foreignKey':_0xe536('0x1de'),'as':_0xe536('0x1d3')});db['FaxTransferReport'][_0xe536('0x145')](db['User'],{'foreignKey':_0xe536('0x1da'),'as':'FromAgent'});db['FaxTransferReport'][_0xe536('0x145')](db['User'],{'foreignKey':'ToUserId','as':'ToAgent'});db[_0xe536('0x1dd')][_0xe536('0x145')](db[_0xe536('0x4b')],{'foreignKey':_0xe536('0x1df'),'as':'ToQueue'});db[_0xe536('0x1dd')]['belongsTo'](db[_0xe536('0x47')],{'foreignKey':'ToFaxAccountId','as':_0xe536('0x1e0')});db['OpenchannelTransferReport'][_0xe536('0x145')](db['OpenchannelMessage'],{});db[_0xe536('0xee')][_0xe536('0x145')](db['OpenchannelInteraction'],{});db['OpenchannelTransferReport'][_0xe536('0x145')](db['OpenchannelAccount'],{'foreignKey':_0xe536('0x1e1'),'as':_0xe536('0x1d3')});db[_0xe536('0xee')][_0xe536('0x145')](db['User'],{'foreignKey':_0xe536('0x1da'),'as':_0xe536('0x1d4')});db['OpenchannelTransferReport'][_0xe536('0x145')](db['User'],{'foreignKey':'ToUserId','as':_0xe536('0x1d6')});db[_0xe536('0xee')][_0xe536('0x145')](db[_0xe536('0x5d')],{'foreignKey':_0xe536('0x1e2'),'as':_0xe536('0x1db')});db[_0xe536('0xee')][_0xe536('0x145')](db[_0xe536('0x57')],{'foreignKey':'ToOpenchannelAccountId','as':_0xe536('0x1e0')});db[_0xe536('0xf0')]['belongsTo'](db['SmsMessage'],{});db[_0xe536('0xf0')][_0xe536('0x145')](db[_0xe536('0x52')],{});db[_0xe536('0xf0')][_0xe536('0x145')](db[_0xe536('0x4f')],{'foreignKey':_0xe536('0x1e3'),'as':_0xe536('0x1d3')});db[_0xe536('0xf0')][_0xe536('0x145')](db['User'],{'foreignKey':_0xe536('0x1da'),'as':_0xe536('0x1d4')});db[_0xe536('0xf0')]['belongsTo'](db[_0xe536('0x13')],{'foreignKey':_0xe536('0x1d5'),'as':_0xe536('0x1d6')});db[_0xe536('0xf0')]['belongsTo'](db[_0xe536('0x56')],{'foreignKey':_0xe536('0x1e4'),'as':_0xe536('0x1db')});db[_0xe536('0xf0')][_0xe536('0x145')](db[_0xe536('0x4f')],{'foreignKey':'ToSmsAccountId','as':'ToAccount'});db[_0xe536('0x117')][_0xe536('0x107')](db[_0xe536('0x7e')],{'as':'Dispositions','foreignKey':_0xe536('0x15c')});db[_0xe536('0x117')]['hasMany'](db[_0xe536('0x1e5')],{'as':'CustomFields','foreignKey':_0xe536('0x15c')});db[_0xe536('0x117')][_0xe536('0x107')](db[_0xe536('0x6d')],{'as':_0xe536('0x115'),'onDelete':_0xe536('0x10a'),'foreignKey':'ListId'});db[_0xe536('0x117')][_0xe536('0x107')](db[_0xe536('0x18f')],{'as':_0xe536('0x10b'),'foreignKey':_0xe536('0x15c')});db[_0xe536('0x117')][_0xe536('0x107')](db[_0xe536('0x73')],{'as':'HopperHistory','foreignKey':_0xe536('0x15c')});db[_0xe536('0x117')][_0xe536('0x107')](db['ReportAgentPreview'],{'as':_0xe536('0x75'),'foreignKey':'ListId'});db['CmList'][_0xe536('0x114')](db[_0xe536('0x1c')],{'as':_0xe536('0x1e6'),'through':_0xe536('0x148')});db[_0xe536('0x117')][_0xe536('0x114')](db[_0xe536('0x13')],{'as':_0xe536('0x149'),'through':_0xe536('0x119')});db[_0xe536('0xf2')][_0xe536('0x107')](db['VoiceExtension'],{'as':_0xe536('0x19d'),'onDelete':_0xe536('0x10a')});db[_0xe536('0xf2')]['belongsToMany'](db[_0xe536('0x13')],{'as':_0xe536('0x149'),'through':_0xe536('0x12e')});db[_0xe536('0xf4')]['hasMany'](db['User'],{'as':'Users','foreignKey':_0xe536('0x111')});db['UserProfile'][_0xe536('0x107')](db[_0xe536('0x1e7')],{'as':_0xe536('0x1e8'),'foreignKey':_0xe536('0x111'),'onDelete':_0xe536('0x10a')});db[_0xe536('0x1e7')][_0xe536('0x107')](db['UserProfileResource'],{'as':_0xe536('0x1e9'),'foreignKey':_0xe536('0x1ea'),'onDelete':_0xe536('0x10a')});db['WhatsappAccount'][_0xe536('0x107')](db['Disposition'],{'as':_0xe536('0x158'),'foreignKey':'WhatsappAccountId'});db[_0xe536('0x1eb')][_0xe536('0x107')](db['CannedAnswer'],{'as':_0xe536('0x159'),'foreignKey':_0xe536('0x1ec')});db[_0xe536('0x1eb')][_0xe536('0x107')](db[_0xe536('0xfd')],{'as':_0xe536('0x14e'),'foreignKey':_0xe536('0x1ec')});db[_0xe536('0x1eb')]['hasMany'](db[_0xe536('0xfc')],{'as':_0xe536('0x15a')});db[_0xe536('0x1eb')][_0xe536('0x107')](db['WhatsappApplication'],{'as':'Applications'});db[_0xe536('0x1eb')][_0xe536('0x145')](db[_0xe536('0x117')],{'as':_0xe536('0x15b'),'foreignKey':'ListId'});db['WhatsappAccount']['belongsTo'](db[_0xe536('0x83')],{'as':_0xe536('0x146'),'foreignKey':_0xe536('0x147')});db[_0xe536('0x1eb')][_0xe536('0x114')](db['User'],{'as':'Agents','through':_0xe536('0x1ed')});db[_0xe536('0x1ee')]['belongsTo'](db['User'],{'onDelete':_0xe536('0x169')});db[_0xe536('0x1ee')][_0xe536('0x145')](db[_0xe536('0x12b')],{'onDelete':_0xe536('0x169')});db[_0xe536('0x1ee')][_0xe536('0x145')](db[_0xe536('0x1eb')],{'onDelete':'restrict'});db[_0xe536('0x1ee')][_0xe536('0x145')](db[_0xe536('0x81')],{'onDelete':'restrict','foreignKey':_0xe536('0x144')});db[_0xe536('0x1ee')]['belongsTo'](db['Tag'],{'onDelete':_0xe536('0x169'),'foreignKey':_0xe536('0x16a')});db['WhatsappInteraction']['hasMany'](db[_0xe536('0xfd')],{'as':_0xe536('0x14e'),'onDelete':_0xe536('0x10a'),'foreignKey':_0xe536('0x1ef')});db[_0xe536('0xfc')][_0xe536('0x145')](db[_0xe536('0x1eb')],{'as':_0xe536('0x172'),'foreignKey':_0xe536('0x1ec')});db[_0xe536('0xfc')]['belongsTo'](db[_0xe536('0x6d')],{'as':'Contact','foreignKey':_0xe536('0x160')});db[_0xe536('0xfc')][_0xe536('0x145')](db[_0xe536('0x13')],{'as':'Owner','foreignKey':_0xe536('0x106')});db['WhatsappInteraction']['belongsToMany'](db[_0xe536('0x164')],{'through':_0xe536('0x1a5'),'as':_0xe536('0x163')});db['WhatsappInteraction']['belongsToMany'](db[_0xe536('0x164')],{'through':_0xe536('0x1a5'),'as':_0xe536('0x165')});db[_0xe536('0xfc')]['belongsToMany'](db[_0xe536('0x13')],{'as':_0xe536('0x166'),'through':_0xe536('0x122'),'foreignKey':_0xe536('0x1ef')});db['WhatsappMessage'][_0xe536('0x145')](db[_0xe536('0x13')],{'as':_0xe536('0x13')});db[_0xe536('0xfd')][_0xe536('0x145')](db['CmContact'],{'onDelete':'cascade','as':_0xe536('0x153')});db['WhatsappMessage'][_0xe536('0x145')](db['WhatsappInteraction'],{'onDelete':'cascade','as':_0xe536('0x174'),'foreignKey':'WhatsappInteractionId'});db[_0xe536('0xfd')][_0xe536('0x145')](db['WhatsappAccount'],{'as':_0xe536('0x172'),'foreignKey':_0xe536('0x1ec')});db['WhatsappQueueReport'][_0xe536('0x145')](db[_0xe536('0x1eb')],{});db[_0xe536('0xff')]['belongsTo'](db[_0xe536('0x117')],{'as':_0xe536('0x15b'),'foreignKey':'ListId'});db[_0xe536('0xff')][_0xe536('0x145')](db[_0xe536('0x6d')],{'as':_0xe536('0x153'),'foreignKey':_0xe536('0x160')});db['WhatsappQueueReport'][_0xe536('0x145')](db[_0xe536('0xfc')],{});db[_0xe536('0xff')][_0xe536('0x145')](db[_0xe536('0x12b')],{});db['WhatsappQueueReport'][_0xe536('0x145')](db[_0xe536('0xfd')],{});db['WhatsappQueueReport'][_0xe536('0x145')](db[_0xe536('0x13')],{});db[_0xe536('0x1f0')][_0xe536('0x145')](db['WhatsappMessage'],{});db[_0xe536('0x1f0')]['belongsTo'](db['WhatsappInteraction'],{});db[_0xe536('0x1f0')][_0xe536('0x145')](db[_0xe536('0x1eb')],{'foreignKey':_0xe536('0x1f1'),'as':_0xe536('0x1d3')});db[_0xe536('0x1f0')][_0xe536('0x145')](db[_0xe536('0x1eb')],{'foreignKey':_0xe536('0x1f2'),'as':_0xe536('0x1e0')});db['WhatsappTransferReport'][_0xe536('0x145')](db[_0xe536('0x12b')],{'foreignKey':_0xe536('0x1f3'),'as':_0xe536('0x1db')});db['WhatsappTransferReport'][_0xe536('0x145')](db[_0xe536('0x13')],{'foreignKey':_0xe536('0x1da'),'as':_0xe536('0x1d4')});db[_0xe536('0x1f0')][_0xe536('0x145')](db[_0xe536('0x13')],{'foreignKey':'ToUserId','as':_0xe536('0x1d6')});db[_0xe536('0x12b')][_0xe536('0x114')](db[_0xe536('0x13')],{'as':'Agents','through':_0xe536('0x37'),'foreignKey':_0xe536('0x1f4')});db['WhatsappQueue']['belongsToMany'](db[_0xe536('0x11a')],{'through':_0xe536('0x1ce'),'as':_0xe536('0x14a')});module[_0xe536('0x1f5')]={'db':db,'dbH':dbH}; \ No newline at end of file diff --git a/server/routes.js b/server/routes.js index 415bf1b..3e84961 100644 --- a/server/routes.js +++ b/server/routes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9511=['api','logger','format','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s','method','headers','x-forwarded-for','connection','remoteAddress','url','statusCode','user','name','role','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s','body','device','agent_id','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s\x20(id=%s\x20name=%s)','other','agent_name','test','/api/users','./api/user','/api/voice/chanspy','./api/voiceChanSpy','use','/api/voice/contexts','./api/voiceExtension','/api/voice/mohs','/api/voice/queues','./api/voiceQueue','./api/voiceRecording','/api/screen/recordings','./api/screenRecording','/api/voice/mails/messages','/api/voice/calls/reports','./api/voiceDialReport','/api/voice/agents/reports','./api/voiceAgentReport','/api/voice/queues/reports','./api/memberReport','/api/trunks','/api/voice/transfers/reports','./api/voiceTransferReport','/api/mail/out_servers','./api/mailServerOut','./api/mailAccount','/api/mail/queues','/api/mail/substatuses','./api/mailSubstatus','./api/mailInteraction','/api/mail/applications','./api/mailQueueReport','/api/dashboards','./api/dashboard','./api/dashboardItem','./api/faxAccount','/api/fax/applications','./api/faxMessage','/api/fax/reports/queue','./api/faxQueueReport','/api/sms/accounts','/api/sms/applications','./api/smsApplication','./api/smsInteraction','/api/sms/messages','./api/smsMessage','/api/sms/queues','./api/smsQueue','/api/openchannel/accounts','./api/openchannelAccount','/api/openchannel/applications','./api/openchannelApplication','/api/openchannel/messages','./api/openchannelQueue','/api/chat/websites','/api/openchannel/reports/queue','./api/openchannelQueueReport','/api/chat/applications','./api/chatApplication','/api/chat/interactions','./api/chatMessage','/api/chat/offline_messages','./api/chatOfflineMessage','/api/chat/queues','./api/chatQueue','/api/chat/groups','./api/chatGroup','/api/chat/proactive_actions','./api/chatProactiveAction','/api/cm/companies','./api/cmCompany','/api/cm/contacts','./api/cmContact','/api/cm/hopper','./api/cmHopper','./api/cmHopperBlack','/api/cm/hopper_final','/api/cm/hopper_history','/api/cm/custom_fields','./api/cmCustomField','/api/actions','./api/action','/api/automations','./api/automation','/api/canned_answers','/api/dispositions','./api/disposition','/api/conditions','./api/condition','/api/intervals','/api/pauses','./api/pause','/api/cdr','./api/cdr','./api/voiceQueuesLog','/api/schedules','./api/schedule','/api/sounds','./api/sound','/api/tags','./api/tag','./api/template','./api/trigger','/api/variables','./api/variable','/api/integrations','./api/integrationReport','/api/analytics/custom_reports','./api/analyticCustomReport','/api/analytics/default_reports','./api/analyticDefaultReport','/api/analytics/extracted_reports','./api/analyticExtractedReport','/api/analytics/metrics','./api/analyticMetric','./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/intSugarcrmAccount','/api/integrations/sugarcrm/configurations','./api/intSugarcrmConfiguration','/api/integrations/sugarcrm/fields','./api/intSugarcrmField','/api/integrations/desk/accounts','./api/intDeskAccount','/api/integrations/desk/configurations','/api/integrations/desk/fields','./api/intDeskField','/api/integrations/zoho/accounts','./api/intZohoAccount','/api/integrations/zoho/configurations','/api/integrations/zoho/fields','/api/integrations/zendesk/accounts','/api/integrations/zendesk/configurations','./api/intZendeskConfiguration','/api/integrations/zendesk/fields','./api/intFreshdeskAccount','./api/intFreshdeskConfiguration','/api/integrations/freshdesk/fields','./api/intFreshdeskField','/api/integrations/vtiger/accounts','/api/integrations/vtiger/configurations','./api/intVtigerConfiguration','/api/integrations/vtiger/fields','./api/intVtigerField','/api/integrations/servicenow/accounts','./api/intServicenowAccount','/api/integrations/servicenow/fields','./api/intDynamics365Account','./api/intDynamics365Field','/api/integrations/freshsales/accounts','/api/integrations/freshsales/configurations','./api/intFreshsalesConfiguration','/api/integrations/freshsales/fields','./api/intFreshsalesField','/api/networks','/api/chat/reports/queue','./api/chatQueueReport','/api/chat/internal/messages','./api/chatInternalMessage','/api/jscripty/questions/reports','./api/jscriptyQuestionReport','/api/jscripty/sessions/reports','./api/jscriptySessionReport','./api/smsQueueReport','/api/square/reports','./api/squareReport','/api/square/details/reports','./api/squareReportDetail','/api/jscripty/projects','./api/jscriptyProject','/api/settings','./api/squareOdbc','/api/square/projects','/api/square/recordings','./api/squareRecording','/api/square/messages','./api/squareMessage','/api/teams','./api/team','/api/migrations','./api/migration','/api/attachments','./api/attachment','/api/plugins','./api/plugin','/api/mail/reports/transfer','./api/mailTransferReport','/api/chat/reports/transfer','./api/chatTransferReport','./api/faxTransferReport','/api/openchannel/reports/transfer','/api/sms/reports/transfer','./api/smsTransferReport','./api/cmList','/api/voice/prefixes','./api/userProfile','./api/userProfileSection','./api/userProfileResource','/api/notifications','./api/whatsappAccount','/api/whatsapp/applications','./api/whatsappApplication','/api/whatsapp/interactions','./api/whatsappInteraction','/api/whatsapp/messages','./api/whatsappMessage','/api/whatsapp/reports/queue','./api/whatsappQueueReport','/api/whatsapp/reports/transfer','/api/whatsapp/queues','./api/whatsappQueue','./api/cloudProvider','/api/auth/local','./api/authLocal','/api/auth/google','./api/authGoogle','/api/jira','./api/jira','./api/rpc','/api/system','./api/system','/api/pm2','/api/webbar','./api/webbar','/apidoc','join','root','/www','static','/demo','/snippet','snippet','1.0.16','/server/files/plugins','route','/:url(api|auth|components|app|bower_components|assets)/*','get','appPath','/index.html','path','express-winston','util','./errors','./config/environment'];(function(_0xbca1b1,_0x33f0ce){var _0x4e1686=function(_0x58a80c){while(--_0x58a80c){_0xbca1b1['push'](_0xbca1b1['shift']());}};_0x4e1686(++_0x33f0ce);}(_0x9511,0x10c));var _0x1951=function(_0xc31458,_0x45ee76){_0xc31458=_0xc31458-0x0;var _0x1b4a90=_0x9511[_0xc31458];return _0x1b4a90;};'use strict';var path=require(_0x1951('0x0'));var express=require('express');var ewinston=require(_0x1951('0x1'));var util=require(_0x1951('0x2'));var errors=require(_0x1951('0x3'));var config=require(_0x1951('0x4'));var logger=require('./config/logger')(_0x1951('0x5'));var authLogger=require('./config/logger')('auth');exports['default']=function(_0x1759bc){_0x1759bc['use'](ewinston[_0x1951('0x6')]({'winstonInstance':logger,'meta':![],'statusLevels':!![],'msg':function(_0xed37fd,_0x22cff3){return util[_0x1951('0x7')](_0x1951('0x8'),_0xed37fd[_0x1951('0x9')],_0xed37fd[_0x1951('0xa')][_0x1951('0xb')]?_0xed37fd[_0x1951('0xa')]['x-forwarded-for']:_0xed37fd[_0x1951('0xc')][_0x1951('0xd')]||_0xed37fd['ip'],_0xed37fd[_0x1951('0xe')],_0x22cff3[_0x1951('0xf')],_0x22cff3['responseTime'],_0xed37fd[_0x1951('0x10')]?_0xed37fd['user']['id']:null,_0xed37fd['user']?_0xed37fd['user'][_0x1951('0x11')]:null,_0xed37fd['user']?_0xed37fd[_0x1951('0x10')][_0x1951('0x12')]:null);}}));_0x1759bc['use'](ewinston[_0x1951('0x6')]({'winstonInstance':authLogger,'meta':![],'statusLevels':!![],'msg':function(_0x9f33c4,_0x5dcf38){var _0x36391d=_0x1951('0x13');if(_0x9f33c4[_0x1951('0x14')]&&_0x9f33c4['body'][_0x1951('0x15')]&&_0x9f33c4[_0x1951('0x14')][_0x1951('0x16')]){_0x36391d=_0x1951('0x17');}return util[_0x1951('0x7')](_0x36391d,_0x9f33c4[_0x1951('0x9')],_0x9f33c4[_0x1951('0xa')][_0x1951('0xb')]?_0x9f33c4[_0x1951('0xa')][_0x1951('0xb')]:_0x9f33c4[_0x1951('0xc')][_0x1951('0xd')]||_0x9f33c4['ip'],_0x9f33c4[_0x1951('0xe')],_0x5dcf38[_0x1951('0xf')],_0x5dcf38['responseTime'],_0x9f33c4[_0x1951('0x10')]?_0x9f33c4[_0x1951('0x10')]['id']:null,_0x9f33c4[_0x1951('0x10')]?_0x9f33c4['user']['name']:null,_0x9f33c4[_0x1951('0x10')]?_0x9f33c4[_0x1951('0x10')]['role']:null,_0x9f33c4[_0x1951('0x14')]&&_0x9f33c4[_0x1951('0x14')][_0x1951('0x15')]?_0x9f33c4['body']['device']:_0x1951('0x18'),_0x9f33c4[_0x1951('0x14')]&&_0x9f33c4[_0x1951('0x14')][_0x1951('0x16')]?_0x9f33c4[_0x1951('0x14')]['agent_id']:'',_0x9f33c4[_0x1951('0x14')]&&_0x9f33c4[_0x1951('0x14')][_0x1951('0x19')]?_0x9f33c4[_0x1951('0x14')][_0x1951('0x19')]:'');},'ignoreRoute':function(_0x5604ec){var _0x25b593=/\/api\/users\/[0-9]+\/(login|logout)/gi;return!_0x25b593[_0x1951('0x1a')](_0x5604ec[_0x1951('0xe')]);}}));_0x1759bc['use'](_0x1951('0x1b'),require(_0x1951('0x1c')));_0x1759bc['use'](_0x1951('0x1d'),require(_0x1951('0x1e')));_0x1759bc[_0x1951('0x1f')](_0x1951('0x20'),require('./api/voiceContext'));_0x1759bc[_0x1951('0x1f')]('/api/voice/extensions',require(_0x1951('0x21')));_0x1759bc['use'](_0x1951('0x22'),require('./api/voiceMusicOnHold'));_0x1759bc['use'](_0x1951('0x23'),require(_0x1951('0x24')));_0x1759bc['use']('/api/voice/recordings',require(_0x1951('0x25')));_0x1759bc[_0x1951('0x1f')](_0x1951('0x26'),require(_0x1951('0x27')));_0x1759bc[_0x1951('0x1f')]('/api/voice/mails',require('./api/voiceMail'));_0x1759bc[_0x1951('0x1f')](_0x1951('0x28'),require('./api/voiceMailMessage'));_0x1759bc[_0x1951('0x1f')](_0x1951('0x29'),require('./api/voiceCallReport'));_0x1759bc[_0x1951('0x1f')]('/api/voice/dials/reports',require(_0x1951('0x2a')));_0x1759bc[_0x1951('0x1f')](_0x1951('0x2b'),require(_0x1951('0x2c')));_0x1759bc[_0x1951('0x1f')](_0x1951('0x2d'),require('./api/voiceQueueReport'));_0x1759bc[_0x1951('0x1f')]('/api/members/reports',require(_0x1951('0x2e')));_0x1759bc[_0x1951('0x1f')](_0x1951('0x2f'),require('./api/trunk'));_0x1759bc[_0x1951('0x1f')](_0x1951('0x30'),require(_0x1951('0x31')));_0x1759bc['use'](_0x1951('0x32'),require(_0x1951('0x33')));_0x1759bc[_0x1951('0x1f')]('/api/mail/accounts',require(_0x1951('0x34')));_0x1759bc[_0x1951('0x1f')](_0x1951('0x35'),require('./api/mailQueue'));_0x1759bc[_0x1951('0x1f')](_0x1951('0x36'),require(_0x1951('0x37')));_0x1759bc[_0x1951('0x1f')]('/api/mail/interactions',require(_0x1951('0x38')));_0x1759bc[_0x1951('0x1f')]('/api/mail/messages',require('./api/mailMessage'));_0x1759bc[_0x1951('0x1f')](_0x1951('0x39'),require('./api/mailApplication'));_0x1759bc['use']('/api/mail/reports/queue',require(_0x1951('0x3a')));_0x1759bc[_0x1951('0x1f')](_0x1951('0x3b'),require(_0x1951('0x3c')));_0x1759bc[_0x1951('0x1f')]('/api/dashboards/items',require(_0x1951('0x3d')));_0x1759bc[_0x1951('0x1f')]('/api/fax/accounts',require(_0x1951('0x3e')));_0x1759bc[_0x1951('0x1f')](_0x1951('0x3f'),require('./api/faxApplication'));_0x1759bc[_0x1951('0x1f')]('/api/fax/interactions',require('./api/faxInteraction'));_0x1759bc[_0x1951('0x1f')]('/api/fax/messages',require(_0x1951('0x40')));_0x1759bc[_0x1951('0x1f')]('/api/fax/queues',require('./api/faxQueue'));_0x1759bc[_0x1951('0x1f')](_0x1951('0x41'),require(_0x1951('0x42')));_0x1759bc[_0x1951('0x1f')](_0x1951('0x43'),require('./api/smsAccount'));_0x1759bc[_0x1951('0x1f')](_0x1951('0x44'),require(_0x1951('0x45')));_0x1759bc[_0x1951('0x1f')]('/api/sms/interactions',require(_0x1951('0x46')));_0x1759bc[_0x1951('0x1f')](_0x1951('0x47'),require(_0x1951('0x48')));_0x1759bc[_0x1951('0x1f')](_0x1951('0x49'),require(_0x1951('0x4a')));_0x1759bc[_0x1951('0x1f')](_0x1951('0x4b'),require(_0x1951('0x4c')));_0x1759bc[_0x1951('0x1f')](_0x1951('0x4d'),require(_0x1951('0x4e')));_0x1759bc['use']('/api/openchannel/interactions',require('./api/openchannelInteraction'));_0x1759bc[_0x1951('0x1f')](_0x1951('0x4f'),require('./api/openchannelMessage'));_0x1759bc[_0x1951('0x1f')]('/api/openchannel/queues',require(_0x1951('0x50')));_0x1759bc['use'](_0x1951('0x51'),require('./api/chatWebsite'));_0x1759bc[_0x1951('0x1f')](_0x1951('0x52'),require(_0x1951('0x53')));_0x1759bc[_0x1951('0x1f')](_0x1951('0x54'),require(_0x1951('0x55')));_0x1759bc[_0x1951('0x1f')](_0x1951('0x56'),require('./api/chatInteraction'));_0x1759bc[_0x1951('0x1f')]('/api/chat/messages',require(_0x1951('0x57')));_0x1759bc[_0x1951('0x1f')](_0x1951('0x58'),require(_0x1951('0x59')));_0x1759bc['use'](_0x1951('0x5a'),require(_0x1951('0x5b')));_0x1759bc[_0x1951('0x1f')](_0x1951('0x5c'),require(_0x1951('0x5d')));_0x1759bc[_0x1951('0x1f')](_0x1951('0x5e'),require(_0x1951('0x5f')));_0x1759bc['use'](_0x1951('0x60'),require(_0x1951('0x61')));_0x1759bc[_0x1951('0x1f')](_0x1951('0x62'),require(_0x1951('0x63')));_0x1759bc[_0x1951('0x1f')](_0x1951('0x64'),require(_0x1951('0x65')));_0x1759bc[_0x1951('0x1f')]('/api/cm/hopper_black',require(_0x1951('0x66')));_0x1759bc[_0x1951('0x1f')](_0x1951('0x67'),require('./api/cmHopperFinal'));_0x1759bc[_0x1951('0x1f')](_0x1951('0x68'),require('./api/cmHopperHistory'));_0x1759bc[_0x1951('0x1f')](_0x1951('0x69'),require(_0x1951('0x6a')));_0x1759bc['use'](_0x1951('0x6b'),require(_0x1951('0x6c')));_0x1759bc[_0x1951('0x1f')](_0x1951('0x6d'),require(_0x1951('0x6e')));_0x1759bc[_0x1951('0x1f')](_0x1951('0x6f'),require('./api/cannedAnswer'));_0x1759bc[_0x1951('0x1f')](_0x1951('0x70'),require(_0x1951('0x71')));_0x1759bc['use'](_0x1951('0x72'),require(_0x1951('0x73')));_0x1759bc[_0x1951('0x1f')](_0x1951('0x74'),require('./api/interval'));_0x1759bc[_0x1951('0x1f')](_0x1951('0x75'),require(_0x1951('0x76')));_0x1759bc[_0x1951('0x1f')](_0x1951('0x77'),require(_0x1951('0x78')));_0x1759bc['use']('/api/voiceQueuesLog',require(_0x1951('0x79')));_0x1759bc['use'](_0x1951('0x7a'),require(_0x1951('0x7b')));_0x1759bc[_0x1951('0x1f')](_0x1951('0x7c'),require(_0x1951('0x7d')));_0x1759bc[_0x1951('0x1f')](_0x1951('0x7e'),require(_0x1951('0x7f')));_0x1759bc[_0x1951('0x1f')]('/api/templates',require(_0x1951('0x80')));_0x1759bc[_0x1951('0x1f')]('/api/triggers',require(_0x1951('0x81')));_0x1759bc[_0x1951('0x1f')](_0x1951('0x82'),require(_0x1951('0x83')));_0x1759bc['use'](_0x1951('0x84'),require('./api/integration'));_0x1759bc[_0x1951('0x1f')]('/api/integrations/reports',require(_0x1951('0x85')));_0x1759bc[_0x1951('0x1f')](_0x1951('0x86'),require(_0x1951('0x87')));_0x1759bc[_0x1951('0x1f')](_0x1951('0x88'),require(_0x1951('0x89')));_0x1759bc['use'](_0x1951('0x8a'),require(_0x1951('0x8b')));_0x1759bc[_0x1951('0x1f')](_0x1951('0x8c'),require(_0x1951('0x8d')));_0x1759bc[_0x1951('0x1f')]('/api/analytics/field_reports',require(_0x1951('0x8e')));_0x1759bc[_0x1951('0x1f')](_0x1951('0x8f'),require(_0x1951('0x90')));_0x1759bc[_0x1951('0x1f')](_0x1951('0x91'),require(_0x1951('0x92')));_0x1759bc[_0x1951('0x1f')](_0x1951('0x93'),require(_0x1951('0x94')));_0x1759bc[_0x1951('0x1f')](_0x1951('0x95'),require(_0x1951('0x96')));_0x1759bc[_0x1951('0x1f')]('/api/integrations/sugarcrm/accounts',require(_0x1951('0x97')));_0x1759bc[_0x1951('0x1f')](_0x1951('0x98'),require(_0x1951('0x99')));_0x1759bc['use'](_0x1951('0x9a'),require(_0x1951('0x9b')));_0x1759bc[_0x1951('0x1f')](_0x1951('0x9c'),require(_0x1951('0x9d')));_0x1759bc[_0x1951('0x1f')](_0x1951('0x9e'),require('./api/intDeskConfiguration'));_0x1759bc[_0x1951('0x1f')](_0x1951('0x9f'),require(_0x1951('0xa0')));_0x1759bc[_0x1951('0x1f')](_0x1951('0xa1'),require(_0x1951('0xa2')));_0x1759bc[_0x1951('0x1f')](_0x1951('0xa3'),require('./api/intZohoConfiguration'));_0x1759bc['use'](_0x1951('0xa4'),require('./api/intZohoField'));_0x1759bc[_0x1951('0x1f')](_0x1951('0xa5'),require('./api/intZendeskAccount'));_0x1759bc[_0x1951('0x1f')](_0x1951('0xa6'),require(_0x1951('0xa7')));_0x1759bc['use'](_0x1951('0xa8'),require('./api/intZendeskField'));_0x1759bc[_0x1951('0x1f')]('/api/integrations/freshdesk/accounts',require(_0x1951('0xa9')));_0x1759bc[_0x1951('0x1f')]('/api/integrations/freshdesk/configurations',require(_0x1951('0xaa')));_0x1759bc[_0x1951('0x1f')](_0x1951('0xab'),require(_0x1951('0xac')));_0x1759bc[_0x1951('0x1f')](_0x1951('0xad'),require('./api/intVtigerAccount'));_0x1759bc[_0x1951('0x1f')](_0x1951('0xae'),require(_0x1951('0xaf')));_0x1759bc[_0x1951('0x1f')](_0x1951('0xb0'),require(_0x1951('0xb1')));_0x1759bc['use'](_0x1951('0xb2'),require(_0x1951('0xb3')));_0x1759bc[_0x1951('0x1f')]('/api/integrations/servicenow/configurations',require('./api/intServicenowConfiguration'));_0x1759bc[_0x1951('0x1f')](_0x1951('0xb4'),require('./api/intServicenowField'));_0x1759bc[_0x1951('0x1f')]('/api/integrations/dynamics365/accounts',require(_0x1951('0xb5')));_0x1759bc[_0x1951('0x1f')]('/api/integrations/dynamics365/configurations',require('./api/intDynamics365Configuration'));_0x1759bc['use']('/api/integrations/dynamics365/fields',require(_0x1951('0xb6')));_0x1759bc[_0x1951('0x1f')](_0x1951('0xb7'),require('./api/intFreshsalesAccount'));_0x1759bc['use'](_0x1951('0xb8'),require(_0x1951('0xb9')));_0x1759bc[_0x1951('0x1f')](_0x1951('0xba'),require(_0x1951('0xbb')));_0x1759bc['use'](_0x1951('0xbc'),require('./api/network'));_0x1759bc['use'](_0x1951('0xbd'),require(_0x1951('0xbe')));_0x1759bc['use'](_0x1951('0xbf'),require(_0x1951('0xc0')));_0x1759bc[_0x1951('0x1f')]('/api/jscripty/answers/reports',require('./api/jscriptyAnswerReport'));_0x1759bc[_0x1951('0x1f')](_0x1951('0xc1'),require(_0x1951('0xc2')));_0x1759bc[_0x1951('0x1f')](_0x1951('0xc3'),require(_0x1951('0xc4')));_0x1759bc[_0x1951('0x1f')]('/api/sms/reports/queue',require(_0x1951('0xc5')));_0x1759bc[_0x1951('0x1f')](_0x1951('0xc6'),require(_0x1951('0xc7')));_0x1759bc[_0x1951('0x1f')](_0x1951('0xc8'),require(_0x1951('0xc9')));_0x1759bc[_0x1951('0x1f')](_0x1951('0xca'),require(_0x1951('0xcb')));_0x1759bc['use'](_0x1951('0xcc'),require('./api/setting'));_0x1759bc[_0x1951('0x1f')]('/api/square/odbc',require(_0x1951('0xcd')));_0x1759bc[_0x1951('0x1f')](_0x1951('0xce'),require('./api/squareProject'));_0x1759bc[_0x1951('0x1f')](_0x1951('0xcf'),require(_0x1951('0xd0')));_0x1759bc['use'](_0x1951('0xd1'),require(_0x1951('0xd2')));_0x1759bc[_0x1951('0x1f')](_0x1951('0xd3'),require(_0x1951('0xd4')));_0x1759bc[_0x1951('0x1f')]('/api/license',require('./api/license'));_0x1759bc['use']('/api/campaigns',require('./api/campaign'));_0x1759bc[_0x1951('0x1f')](_0x1951('0xd5'),require(_0x1951('0xd6')));_0x1759bc[_0x1951('0x1f')](_0x1951('0xd7'),require(_0x1951('0xd8')));_0x1759bc[_0x1951('0x1f')](_0x1951('0xd9'),require(_0x1951('0xda')));_0x1759bc[_0x1951('0x1f')](_0x1951('0xdb'),require(_0x1951('0xdc')));_0x1759bc['use'](_0x1951('0xdd'),require(_0x1951('0xde')));_0x1759bc[_0x1951('0x1f')]('/api/fax/reports/transfer',require(_0x1951('0xdf')));_0x1759bc[_0x1951('0x1f')](_0x1951('0xe0'),require('./api/openchannelTransferReport'));_0x1759bc[_0x1951('0x1f')](_0x1951('0xe1'),require(_0x1951('0xe2')));_0x1759bc['use']('/api/cm/lists',require(_0x1951('0xe3')));_0x1759bc[_0x1951('0x1f')](_0x1951('0xe4'),require('./api/voicePrefix'));_0x1759bc[_0x1951('0x1f')]('/api/userProfiles',require(_0x1951('0xe5')));_0x1759bc[_0x1951('0x1f')]('/api/userProfile/sections',require(_0x1951('0xe6')));_0x1759bc[_0x1951('0x1f')]('/api/userProfile/resources',require(_0x1951('0xe7')));_0x1759bc[_0x1951('0x1f')](_0x1951('0xe8'),require('./api/notification'));_0x1759bc[_0x1951('0x1f')]('/api/whatsapp/accounts',require(_0x1951('0xe9')));_0x1759bc[_0x1951('0x1f')](_0x1951('0xea'),require(_0x1951('0xeb')));_0x1759bc[_0x1951('0x1f')](_0x1951('0xec'),require(_0x1951('0xed')));_0x1759bc[_0x1951('0x1f')](_0x1951('0xee'),require(_0x1951('0xef')));_0x1759bc[_0x1951('0x1f')](_0x1951('0xf0'),require(_0x1951('0xf1')));_0x1759bc[_0x1951('0x1f')](_0x1951('0xf2'),require('./api/whatsappTransferReport'));_0x1759bc['use'](_0x1951('0xf3'),require(_0x1951('0xf4')));_0x1759bc[_0x1951('0x1f')]('/api/cloudProviders',require(_0x1951('0xf5')));_0x1759bc['use'](_0x1951('0xf6'),require(_0x1951('0xf7')));_0x1759bc[_0x1951('0x1f')](_0x1951('0xf8'),require(_0x1951('0xf9')));_0x1759bc[_0x1951('0x1f')](_0x1951('0xfa'),require(_0x1951('0xfb')));_0x1759bc[_0x1951('0x1f')]('/api/rpc',require(_0x1951('0xfc')));_0x1759bc[_0x1951('0x1f')]('/api/version',require('./api/version'));_0x1759bc[_0x1951('0x1f')](_0x1951('0xfd'),require(_0x1951('0xfe')));_0x1759bc['use'](_0x1951('0xff'),require('./api/pm2'));_0x1759bc['use'](_0x1951('0x100'),require(_0x1951('0x101')));_0x1759bc[_0x1951('0x1f')](_0x1951('0x102'),express['static'](path[_0x1951('0x103')](config[_0x1951('0x104')],'/apidoc')));_0x1759bc[_0x1951('0x1f')](_0x1951('0x105'),express[_0x1951('0x106')](path[_0x1951('0x103')](config['root'],_0x1951('0x105'))));_0x1759bc['use'](_0x1951('0x107'),express['static'](path[_0x1951('0x103')](config[_0x1951('0x104')],_0x1951('0x107'))));_0x1759bc[_0x1951('0x1f')](_0x1951('0x108'),express[_0x1951('0x106')](path['join'](config[_0x1951('0x104')],_0x1951('0x109'),_0x1951('0x10a'))));_0x1759bc[_0x1951('0x1f')]('/plugins',express[_0x1951('0x106')](path[_0x1951('0x103')](config[_0x1951('0x104')],_0x1951('0x10b'))));_0x1759bc[_0x1951('0x10c')](_0x1951('0x10d'))[_0x1951('0x10e')](errors[0x194]);_0x1759bc['route']('/*')['get'](function(_0x5083e0,_0x535b3a){_0x535b3a['sendFile'](path['resolve'](_0x1759bc[_0x1951('0x10e')](_0x1951('0x10f'))+_0x1951('0x110')));});}; \ No newline at end of file +var _0xa101=['./api/intDynamics365Configuration','/api/integrations/dynamics365/fields','./api/intDynamics365Field','/api/integrations/freshsales/accounts','/api/integrations/freshsales/configurations','./api/intFreshsalesConfiguration','/api/integrations/freshsales/fields','/api/networks','./api/network','/api/chat/reports/queue','./api/chatQueueReport','/api/chat/internal/messages','./api/chatInternalMessage','/api/jscripty/answers/reports','./api/jscriptyAnswerReport','/api/jscripty/questions/reports','./api/jscriptyQuestionReport','/api/jscripty/sessions/reports','./api/jscriptySessionReport','/api/sms/reports/queue','./api/smsQueueReport','./api/squareReport','/api/square/details/reports','./api/squareReportDetail','/api/jscripty/projects','./api/jscriptyProject','/api/settings','/api/square/odbc','./api/squareOdbc','/api/square/projects','./api/squareProject','/api/square/recordings','./api/squareRecording','/api/square/messages','./api/squareMessage','/api/teams','./api/team','/api/license','./api/license','/api/campaigns','/api/migrations','./api/migration','/api/plugins','./api/plugin','./api/mailTransferReport','/api/chat/reports/transfer','./api/chatTransferReport','/api/fax/reports/transfer','./api/faxTransferReport','./api/openchannelTransferReport','/api/cm/lists','./api/cmList','./api/voicePrefix','./api/userProfile','/api/userProfile/sections','./api/userProfileSection','/api/userProfile/resources','./api/userProfileResource','/api/notifications','./api/notification','./api/whatsappAccount','/api/whatsapp/applications','./api/whatsappInteraction','/api/whatsapp/messages','./api/whatsappMessage','./api/whatsappQueueReport','/api/whatsapp/queues','./api/whatsappQueue','/api/cloudProviders','/api/auth/local','./api/authLocal','/api/auth/google','./api/authGoogle','/api/jira','./api/jira','/api/rpc','/api/version','./api/version','/api/system','./api/system','/api/webbar','./api/webbar','/apidoc','static','join','root','/www','/demo','/snippet','snippet','1.0.16','/plugins','/server/files/plugins','route','/:url(api|auth|components|app|bower_components|assets)/*','get','sendFile','resolve','/index.html','path','express','express-winston','util','./errors','./config/environment','api','auth','format','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s','method','headers','x-forwarded-for','connection','remoteAddress','statusCode','responseTime','user','name','role','use','logger','body','device','agent_id','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s\x20(id=%s\x20name=%s)','url','agent_name','test','/api/users','./api/user','/api/voice/chanspy','./api/voiceChanSpy','./api/voiceContext','/api/voice/extensions','./api/voiceExtension','/api/voice/mohs','./api/voiceMusicOnHold','/api/voice/queues','./api/voiceQueue','/api/voice/recordings','./api/voiceRecording','/api/screen/recordings','./api/screenRecording','./api/voiceMailMessage','/api/voice/calls/reports','/api/voice/dials/reports','./api/voiceDialReport','./api/voiceAgentReport','/api/voice/queues/reports','/api/members/reports','./api/memberReport','./api/trunk','/api/voice/transfers/reports','./api/mailServerOut','/api/mail/accounts','/api/mail/queues','./api/mailQueue','/api/mail/substatuses','/api/mail/interactions','/api/mail/messages','./api/mailMessage','./api/mailApplication','/api/mail/reports/queue','./api/mailQueueReport','/api/dashboards','./api/dashboard','/api/fax/accounts','./api/faxAccount','/api/fax/applications','/api/fax/interactions','./api/faxInteraction','/api/fax/messages','./api/faxMessage','/api/fax/queues','./api/faxQueue','./api/faxQueueReport','./api/smsApplication','/api/sms/interactions','./api/smsInteraction','/api/sms/messages','./api/smsMessage','./api/smsQueue','./api/openchannelAccount','/api/openchannel/applications','./api/openchannelApplication','./api/openchannelInteraction','/api/openchannel/messages','./api/openchannelMessage','/api/openchannel/queues','./api/openchannelQueue','./api/openchannelQueueReport','/api/chat/applications','./api/chatApplication','/api/chat/interactions','./api/chatInteraction','/api/chat/messages','./api/chatMessage','./api/chatOfflineMessage','/api/chat/queues','./api/chatQueue','/api/chat/groups','./api/chatGroup','./api/chatProactiveAction','/api/cm/companies','/api/cm/contacts','/api/cm/hopper','./api/cmHopper','/api/cm/hopper_black','./api/cmHopperBlack','/api/cm/hopper_final','./api/cmHopperFinal','/api/cm/hopper_history','./api/cmHopperHistory','./api/cmCustomField','/api/actions','./api/action','./api/cannedAnswer','/api/dispositions','./api/disposition','./api/condition','/api/intervals','./api/interval','/api/pauses','/api/cdr','./api/cdr','/api/voiceQueuesLog','./api/voiceQueuesLog','/api/sounds','/api/tags','./api/tag','/api/templates','./api/template','./api/trigger','/api/variables','./api/variable','/api/integrations','./api/integration','/api/integrations/reports','./api/integrationReport','/api/analytics/custom_reports','/api/analytics/default_reports','./api/analyticDefaultReport','/api/analytics/extracted_reports','./api/analyticMetric','/api/analytics/field_reports','/api/analytics/tree_reports','./api/analyticTreeReport','/api/integrations/salesforce/accounts','./api/intSalesforceAccount','/api/integrations/salesforce/configurations','./api/intSalesforceConfiguration','/api/integrations/salesforce/fields','./api/intSugarcrmAccount','./api/intSugarcrmConfiguration','./api/intSugarcrmField','/api/integrations/desk/accounts','./api/intDeskAccount','./api/intDeskConfiguration','/api/integrations/desk/fields','./api/intDeskField','/api/integrations/zoho/accounts','./api/intZohoAccount','/api/integrations/zoho/configurations','./api/intZohoConfiguration','./api/intZohoField','/api/integrations/zendesk/accounts','./api/intZendeskAccount','/api/integrations/zendesk/configurations','/api/integrations/zendesk/fields','./api/intZendeskField','/api/integrations/freshdesk/accounts','./api/intFreshdeskAccount','/api/integrations/freshdesk/configurations','./api/intFreshdeskConfiguration','/api/integrations/freshdesk/fields','./api/intFreshdeskField','/api/integrations/vtiger/accounts','./api/intVtigerAccount','/api/integrations/vtiger/configurations','./api/intVtigerConfiguration','/api/integrations/vtiger/fields','./api/intVtigerField','./api/intServicenowConfiguration','./api/intServicenowField','/api/integrations/dynamics365/accounts','./api/intDynamics365Account','/api/integrations/dynamics365/configurations'];(function(_0x54abd7,_0x1013da){var _0x57ac1c=function(_0x313b20){while(--_0x313b20){_0x54abd7['push'](_0x54abd7['shift']());}};_0x57ac1c(++_0x1013da);}(_0xa101,0x182));var _0x1a10=function(_0x2c7dc6,_0x3c4ce0){_0x2c7dc6=_0x2c7dc6-0x0;var _0x10002b=_0xa101[_0x2c7dc6];return _0x10002b;};'use strict';var path=require(_0x1a10('0x0'));var express=require(_0x1a10('0x1'));var ewinston=require(_0x1a10('0x2'));var util=require(_0x1a10('0x3'));var errors=require(_0x1a10('0x4'));var config=require(_0x1a10('0x5'));var logger=require('./config/logger')(_0x1a10('0x6'));var authLogger=require('./config/logger')(_0x1a10('0x7'));exports['default']=function(_0x56b87f){_0x56b87f['use'](ewinston['logger']({'winstonInstance':logger,'meta':![],'statusLevels':!![],'msg':function(_0x5eee27,_0x289375){return util[_0x1a10('0x8')](_0x1a10('0x9'),_0x5eee27[_0x1a10('0xa')],_0x5eee27[_0x1a10('0xb')][_0x1a10('0xc')]?_0x5eee27[_0x1a10('0xb')][_0x1a10('0xc')]:_0x5eee27[_0x1a10('0xd')][_0x1a10('0xe')]||_0x5eee27['ip'],_0x5eee27['url'],_0x289375[_0x1a10('0xf')],_0x289375[_0x1a10('0x10')],_0x5eee27[_0x1a10('0x11')]?_0x5eee27[_0x1a10('0x11')]['id']:null,_0x5eee27[_0x1a10('0x11')]?_0x5eee27[_0x1a10('0x11')][_0x1a10('0x12')]:null,_0x5eee27[_0x1a10('0x11')]?_0x5eee27['user'][_0x1a10('0x13')]:null);}}));_0x56b87f[_0x1a10('0x14')](ewinston[_0x1a10('0x15')]({'winstonInstance':authLogger,'meta':![],'statusLevels':!![],'msg':function(_0x4cf6bd,_0x73120c){var _0x206bc3='%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s';if(_0x4cf6bd[_0x1a10('0x16')]&&_0x4cf6bd[_0x1a10('0x16')][_0x1a10('0x17')]&&_0x4cf6bd[_0x1a10('0x16')][_0x1a10('0x18')]){_0x206bc3=_0x1a10('0x19');}return util[_0x1a10('0x8')](_0x206bc3,_0x4cf6bd[_0x1a10('0xa')],_0x4cf6bd[_0x1a10('0xb')][_0x1a10('0xc')]?_0x4cf6bd[_0x1a10('0xb')][_0x1a10('0xc')]:_0x4cf6bd[_0x1a10('0xd')][_0x1a10('0xe')]||_0x4cf6bd['ip'],_0x4cf6bd[_0x1a10('0x1a')],_0x73120c[_0x1a10('0xf')],_0x73120c['responseTime'],_0x4cf6bd[_0x1a10('0x11')]?_0x4cf6bd['user']['id']:null,_0x4cf6bd['user']?_0x4cf6bd[_0x1a10('0x11')][_0x1a10('0x12')]:null,_0x4cf6bd[_0x1a10('0x11')]?_0x4cf6bd[_0x1a10('0x11')][_0x1a10('0x13')]:null,_0x4cf6bd[_0x1a10('0x16')]&&_0x4cf6bd['body'][_0x1a10('0x17')]?_0x4cf6bd[_0x1a10('0x16')][_0x1a10('0x17')]:'other',_0x4cf6bd[_0x1a10('0x16')]&&_0x4cf6bd['body'][_0x1a10('0x18')]?_0x4cf6bd[_0x1a10('0x16')][_0x1a10('0x18')]:'',_0x4cf6bd[_0x1a10('0x16')]&&_0x4cf6bd[_0x1a10('0x16')][_0x1a10('0x1b')]?_0x4cf6bd['body'][_0x1a10('0x1b')]:'');},'ignoreRoute':function(_0xf8783f){var _0x10e121=/\/api\/users\/[0-9]+\/(login|logout)/gi;return!_0x10e121[_0x1a10('0x1c')](_0xf8783f['url']);}}));_0x56b87f[_0x1a10('0x14')](_0x1a10('0x1d'),require(_0x1a10('0x1e')));_0x56b87f['use'](_0x1a10('0x1f'),require(_0x1a10('0x20')));_0x56b87f[_0x1a10('0x14')]('/api/voice/contexts',require(_0x1a10('0x21')));_0x56b87f['use'](_0x1a10('0x22'),require(_0x1a10('0x23')));_0x56b87f[_0x1a10('0x14')](_0x1a10('0x24'),require(_0x1a10('0x25')));_0x56b87f[_0x1a10('0x14')](_0x1a10('0x26'),require(_0x1a10('0x27')));_0x56b87f['use'](_0x1a10('0x28'),require(_0x1a10('0x29')));_0x56b87f[_0x1a10('0x14')](_0x1a10('0x2a'),require(_0x1a10('0x2b')));_0x56b87f['use']('/api/voice/mails',require('./api/voiceMail'));_0x56b87f[_0x1a10('0x14')]('/api/voice/mails/messages',require(_0x1a10('0x2c')));_0x56b87f['use'](_0x1a10('0x2d'),require('./api/voiceCallReport'));_0x56b87f[_0x1a10('0x14')](_0x1a10('0x2e'),require(_0x1a10('0x2f')));_0x56b87f[_0x1a10('0x14')]('/api/voice/agents/reports',require(_0x1a10('0x30')));_0x56b87f['use'](_0x1a10('0x31'),require('./api/voiceQueueReport'));_0x56b87f[_0x1a10('0x14')](_0x1a10('0x32'),require(_0x1a10('0x33')));_0x56b87f['use']('/api/trunks',require(_0x1a10('0x34')));_0x56b87f[_0x1a10('0x14')](_0x1a10('0x35'),require('./api/voiceTransferReport'));_0x56b87f[_0x1a10('0x14')]('/api/mail/out_servers',require(_0x1a10('0x36')));_0x56b87f['use'](_0x1a10('0x37'),require('./api/mailAccount'));_0x56b87f[_0x1a10('0x14')](_0x1a10('0x38'),require(_0x1a10('0x39')));_0x56b87f[_0x1a10('0x14')](_0x1a10('0x3a'),require('./api/mailSubstatus'));_0x56b87f['use'](_0x1a10('0x3b'),require('./api/mailInteraction'));_0x56b87f[_0x1a10('0x14')](_0x1a10('0x3c'),require(_0x1a10('0x3d')));_0x56b87f['use']('/api/mail/applications',require(_0x1a10('0x3e')));_0x56b87f[_0x1a10('0x14')](_0x1a10('0x3f'),require(_0x1a10('0x40')));_0x56b87f[_0x1a10('0x14')](_0x1a10('0x41'),require(_0x1a10('0x42')));_0x56b87f[_0x1a10('0x14')]('/api/dashboards/items',require('./api/dashboardItem'));_0x56b87f[_0x1a10('0x14')](_0x1a10('0x43'),require(_0x1a10('0x44')));_0x56b87f['use'](_0x1a10('0x45'),require('./api/faxApplication'));_0x56b87f[_0x1a10('0x14')](_0x1a10('0x46'),require(_0x1a10('0x47')));_0x56b87f[_0x1a10('0x14')](_0x1a10('0x48'),require(_0x1a10('0x49')));_0x56b87f[_0x1a10('0x14')](_0x1a10('0x4a'),require(_0x1a10('0x4b')));_0x56b87f[_0x1a10('0x14')]('/api/fax/reports/queue',require(_0x1a10('0x4c')));_0x56b87f[_0x1a10('0x14')]('/api/sms/accounts',require('./api/smsAccount'));_0x56b87f[_0x1a10('0x14')]('/api/sms/applications',require(_0x1a10('0x4d')));_0x56b87f[_0x1a10('0x14')](_0x1a10('0x4e'),require(_0x1a10('0x4f')));_0x56b87f[_0x1a10('0x14')](_0x1a10('0x50'),require(_0x1a10('0x51')));_0x56b87f[_0x1a10('0x14')]('/api/sms/queues',require(_0x1a10('0x52')));_0x56b87f['use']('/api/openchannel/accounts',require(_0x1a10('0x53')));_0x56b87f[_0x1a10('0x14')](_0x1a10('0x54'),require(_0x1a10('0x55')));_0x56b87f[_0x1a10('0x14')]('/api/openchannel/interactions',require(_0x1a10('0x56')));_0x56b87f['use'](_0x1a10('0x57'),require(_0x1a10('0x58')));_0x56b87f[_0x1a10('0x14')](_0x1a10('0x59'),require(_0x1a10('0x5a')));_0x56b87f[_0x1a10('0x14')]('/api/chat/websites',require('./api/chatWebsite'));_0x56b87f[_0x1a10('0x14')]('/api/openchannel/reports/queue',require(_0x1a10('0x5b')));_0x56b87f['use'](_0x1a10('0x5c'),require(_0x1a10('0x5d')));_0x56b87f[_0x1a10('0x14')](_0x1a10('0x5e'),require(_0x1a10('0x5f')));_0x56b87f[_0x1a10('0x14')](_0x1a10('0x60'),require(_0x1a10('0x61')));_0x56b87f[_0x1a10('0x14')]('/api/chat/offline_messages',require(_0x1a10('0x62')));_0x56b87f['use'](_0x1a10('0x63'),require(_0x1a10('0x64')));_0x56b87f[_0x1a10('0x14')](_0x1a10('0x65'),require(_0x1a10('0x66')));_0x56b87f[_0x1a10('0x14')]('/api/chat/proactive_actions',require(_0x1a10('0x67')));_0x56b87f['use'](_0x1a10('0x68'),require('./api/cmCompany'));_0x56b87f[_0x1a10('0x14')](_0x1a10('0x69'),require('./api/cmContact'));_0x56b87f['use'](_0x1a10('0x6a'),require(_0x1a10('0x6b')));_0x56b87f[_0x1a10('0x14')](_0x1a10('0x6c'),require(_0x1a10('0x6d')));_0x56b87f[_0x1a10('0x14')](_0x1a10('0x6e'),require(_0x1a10('0x6f')));_0x56b87f[_0x1a10('0x14')](_0x1a10('0x70'),require(_0x1a10('0x71')));_0x56b87f[_0x1a10('0x14')]('/api/cm/custom_fields',require(_0x1a10('0x72')));_0x56b87f[_0x1a10('0x14')](_0x1a10('0x73'),require(_0x1a10('0x74')));_0x56b87f[_0x1a10('0x14')]('/api/automations',require('./api/automation'));_0x56b87f[_0x1a10('0x14')]('/api/canned_answers',require(_0x1a10('0x75')));_0x56b87f[_0x1a10('0x14')](_0x1a10('0x76'),require(_0x1a10('0x77')));_0x56b87f['use']('/api/conditions',require(_0x1a10('0x78')));_0x56b87f[_0x1a10('0x14')](_0x1a10('0x79'),require(_0x1a10('0x7a')));_0x56b87f[_0x1a10('0x14')](_0x1a10('0x7b'),require('./api/pause'));_0x56b87f[_0x1a10('0x14')](_0x1a10('0x7c'),require(_0x1a10('0x7d')));_0x56b87f[_0x1a10('0x14')](_0x1a10('0x7e'),require(_0x1a10('0x7f')));_0x56b87f['use']('/api/schedules',require('./api/schedule'));_0x56b87f[_0x1a10('0x14')](_0x1a10('0x80'),require('./api/sound'));_0x56b87f[_0x1a10('0x14')](_0x1a10('0x81'),require(_0x1a10('0x82')));_0x56b87f[_0x1a10('0x14')](_0x1a10('0x83'),require(_0x1a10('0x84')));_0x56b87f[_0x1a10('0x14')]('/api/triggers',require(_0x1a10('0x85')));_0x56b87f[_0x1a10('0x14')](_0x1a10('0x86'),require(_0x1a10('0x87')));_0x56b87f[_0x1a10('0x14')](_0x1a10('0x88'),require(_0x1a10('0x89')));_0x56b87f[_0x1a10('0x14')](_0x1a10('0x8a'),require(_0x1a10('0x8b')));_0x56b87f[_0x1a10('0x14')](_0x1a10('0x8c'),require('./api/analyticCustomReport'));_0x56b87f[_0x1a10('0x14')](_0x1a10('0x8d'),require(_0x1a10('0x8e')));_0x56b87f[_0x1a10('0x14')](_0x1a10('0x8f'),require('./api/analyticExtractedReport'));_0x56b87f['use']('/api/analytics/metrics',require(_0x1a10('0x90')));_0x56b87f[_0x1a10('0x14')](_0x1a10('0x91'),require('./api/analyticFieldReport'));_0x56b87f[_0x1a10('0x14')](_0x1a10('0x92'),require(_0x1a10('0x93')));_0x56b87f[_0x1a10('0x14')](_0x1a10('0x94'),require(_0x1a10('0x95')));_0x56b87f[_0x1a10('0x14')](_0x1a10('0x96'),require(_0x1a10('0x97')));_0x56b87f['use'](_0x1a10('0x98'),require('./api/intSalesforceField'));_0x56b87f[_0x1a10('0x14')]('/api/integrations/sugarcrm/accounts',require(_0x1a10('0x99')));_0x56b87f[_0x1a10('0x14')]('/api/integrations/sugarcrm/configurations',require(_0x1a10('0x9a')));_0x56b87f[_0x1a10('0x14')]('/api/integrations/sugarcrm/fields',require(_0x1a10('0x9b')));_0x56b87f[_0x1a10('0x14')](_0x1a10('0x9c'),require(_0x1a10('0x9d')));_0x56b87f[_0x1a10('0x14')]('/api/integrations/desk/configurations',require(_0x1a10('0x9e')));_0x56b87f['use'](_0x1a10('0x9f'),require(_0x1a10('0xa0')));_0x56b87f[_0x1a10('0x14')](_0x1a10('0xa1'),require(_0x1a10('0xa2')));_0x56b87f['use'](_0x1a10('0xa3'),require(_0x1a10('0xa4')));_0x56b87f[_0x1a10('0x14')]('/api/integrations/zoho/fields',require(_0x1a10('0xa5')));_0x56b87f[_0x1a10('0x14')](_0x1a10('0xa6'),require(_0x1a10('0xa7')));_0x56b87f[_0x1a10('0x14')](_0x1a10('0xa8'),require('./api/intZendeskConfiguration'));_0x56b87f['use'](_0x1a10('0xa9'),require(_0x1a10('0xaa')));_0x56b87f[_0x1a10('0x14')](_0x1a10('0xab'),require(_0x1a10('0xac')));_0x56b87f['use'](_0x1a10('0xad'),require(_0x1a10('0xae')));_0x56b87f['use'](_0x1a10('0xaf'),require(_0x1a10('0xb0')));_0x56b87f['use'](_0x1a10('0xb1'),require(_0x1a10('0xb2')));_0x56b87f['use'](_0x1a10('0xb3'),require(_0x1a10('0xb4')));_0x56b87f[_0x1a10('0x14')](_0x1a10('0xb5'),require(_0x1a10('0xb6')));_0x56b87f[_0x1a10('0x14')]('/api/integrations/servicenow/accounts',require('./api/intServicenowAccount'));_0x56b87f['use']('/api/integrations/servicenow/configurations',require(_0x1a10('0xb7')));_0x56b87f[_0x1a10('0x14')]('/api/integrations/servicenow/fields',require(_0x1a10('0xb8')));_0x56b87f[_0x1a10('0x14')](_0x1a10('0xb9'),require(_0x1a10('0xba')));_0x56b87f['use'](_0x1a10('0xbb'),require(_0x1a10('0xbc')));_0x56b87f[_0x1a10('0x14')](_0x1a10('0xbd'),require(_0x1a10('0xbe')));_0x56b87f['use'](_0x1a10('0xbf'),require('./api/intFreshsalesAccount'));_0x56b87f[_0x1a10('0x14')](_0x1a10('0xc0'),require(_0x1a10('0xc1')));_0x56b87f['use'](_0x1a10('0xc2'),require('./api/intFreshsalesField'));_0x56b87f[_0x1a10('0x14')](_0x1a10('0xc3'),require(_0x1a10('0xc4')));_0x56b87f[_0x1a10('0x14')](_0x1a10('0xc5'),require(_0x1a10('0xc6')));_0x56b87f[_0x1a10('0x14')](_0x1a10('0xc7'),require(_0x1a10('0xc8')));_0x56b87f[_0x1a10('0x14')](_0x1a10('0xc9'),require(_0x1a10('0xca')));_0x56b87f[_0x1a10('0x14')](_0x1a10('0xcb'),require(_0x1a10('0xcc')));_0x56b87f[_0x1a10('0x14')](_0x1a10('0xcd'),require(_0x1a10('0xce')));_0x56b87f[_0x1a10('0x14')](_0x1a10('0xcf'),require(_0x1a10('0xd0')));_0x56b87f[_0x1a10('0x14')]('/api/square/reports',require(_0x1a10('0xd1')));_0x56b87f[_0x1a10('0x14')](_0x1a10('0xd2'),require(_0x1a10('0xd3')));_0x56b87f[_0x1a10('0x14')](_0x1a10('0xd4'),require(_0x1a10('0xd5')));_0x56b87f[_0x1a10('0x14')](_0x1a10('0xd6'),require('./api/setting'));_0x56b87f[_0x1a10('0x14')](_0x1a10('0xd7'),require(_0x1a10('0xd8')));_0x56b87f[_0x1a10('0x14')](_0x1a10('0xd9'),require(_0x1a10('0xda')));_0x56b87f[_0x1a10('0x14')](_0x1a10('0xdb'),require(_0x1a10('0xdc')));_0x56b87f[_0x1a10('0x14')](_0x1a10('0xdd'),require(_0x1a10('0xde')));_0x56b87f[_0x1a10('0x14')](_0x1a10('0xdf'),require(_0x1a10('0xe0')));_0x56b87f[_0x1a10('0x14')](_0x1a10('0xe1'),require(_0x1a10('0xe2')));_0x56b87f[_0x1a10('0x14')](_0x1a10('0xe3'),require('./api/campaign'));_0x56b87f[_0x1a10('0x14')](_0x1a10('0xe4'),require(_0x1a10('0xe5')));_0x56b87f[_0x1a10('0x14')]('/api/attachments',require('./api/attachment'));_0x56b87f[_0x1a10('0x14')](_0x1a10('0xe6'),require(_0x1a10('0xe7')));_0x56b87f[_0x1a10('0x14')]('/api/mail/reports/transfer',require(_0x1a10('0xe8')));_0x56b87f['use'](_0x1a10('0xe9'),require(_0x1a10('0xea')));_0x56b87f[_0x1a10('0x14')](_0x1a10('0xeb'),require(_0x1a10('0xec')));_0x56b87f['use']('/api/openchannel/reports/transfer',require(_0x1a10('0xed')));_0x56b87f[_0x1a10('0x14')]('/api/sms/reports/transfer',require('./api/smsTransferReport'));_0x56b87f['use'](_0x1a10('0xee'),require(_0x1a10('0xef')));_0x56b87f[_0x1a10('0x14')]('/api/voice/prefixes',require(_0x1a10('0xf0')));_0x56b87f[_0x1a10('0x14')]('/api/userProfiles',require(_0x1a10('0xf1')));_0x56b87f[_0x1a10('0x14')](_0x1a10('0xf2'),require(_0x1a10('0xf3')));_0x56b87f['use'](_0x1a10('0xf4'),require(_0x1a10('0xf5')));_0x56b87f[_0x1a10('0x14')](_0x1a10('0xf6'),require(_0x1a10('0xf7')));_0x56b87f[_0x1a10('0x14')]('/api/whatsapp/accounts',require(_0x1a10('0xf8')));_0x56b87f['use'](_0x1a10('0xf9'),require('./api/whatsappApplication'));_0x56b87f['use']('/api/whatsapp/interactions',require(_0x1a10('0xfa')));_0x56b87f[_0x1a10('0x14')](_0x1a10('0xfb'),require(_0x1a10('0xfc')));_0x56b87f[_0x1a10('0x14')]('/api/whatsapp/reports/queue',require(_0x1a10('0xfd')));_0x56b87f[_0x1a10('0x14')]('/api/whatsapp/reports/transfer',require('./api/whatsappTransferReport'));_0x56b87f[_0x1a10('0x14')](_0x1a10('0xfe'),require(_0x1a10('0xff')));_0x56b87f[_0x1a10('0x14')](_0x1a10('0x100'),require('./api/cloudProvider'));_0x56b87f['use'](_0x1a10('0x101'),require(_0x1a10('0x102')));_0x56b87f[_0x1a10('0x14')](_0x1a10('0x103'),require(_0x1a10('0x104')));_0x56b87f[_0x1a10('0x14')](_0x1a10('0x105'),require(_0x1a10('0x106')));_0x56b87f[_0x1a10('0x14')](_0x1a10('0x107'),require('./api/rpc'));_0x56b87f[_0x1a10('0x14')](_0x1a10('0x108'),require(_0x1a10('0x109')));_0x56b87f['use'](_0x1a10('0x10a'),require(_0x1a10('0x10b')));_0x56b87f[_0x1a10('0x14')]('/api/pm2',require('./api/pm2'));_0x56b87f[_0x1a10('0x14')](_0x1a10('0x10c'),require(_0x1a10('0x10d')));_0x56b87f['use'](_0x1a10('0x10e'),express[_0x1a10('0x10f')](path['join'](config['root'],'/apidoc')));_0x56b87f[_0x1a10('0x14')]('/www',express[_0x1a10('0x10f')](path[_0x1a10('0x110')](config[_0x1a10('0x111')],_0x1a10('0x112'))));_0x56b87f[_0x1a10('0x14')](_0x1a10('0x113'),express[_0x1a10('0x10f')](path[_0x1a10('0x110')](config[_0x1a10('0x111')],'/demo')));_0x56b87f['use'](_0x1a10('0x114'),express[_0x1a10('0x10f')](path[_0x1a10('0x110')](config['root'],_0x1a10('0x115'),_0x1a10('0x116'))));_0x56b87f[_0x1a10('0x14')](_0x1a10('0x117'),express[_0x1a10('0x10f')](path[_0x1a10('0x110')](config[_0x1a10('0x111')],_0x1a10('0x118'))));_0x56b87f[_0x1a10('0x119')](_0x1a10('0x11a'))[_0x1a10('0x11b')](errors[0x194]);_0x56b87f[_0x1a10('0x119')]('/*')[_0x1a10('0x11b')](function(_0x2502e4,_0x5da05e){_0x5da05e[_0x1a10('0x11c')](path[_0x1a10('0x11d')](_0x56b87f[_0x1a10('0x11b')]('appPath')+_0x1a10('0x11e')));});}; \ No newline at end of file diff --git a/server/rpc/index.js b/server/rpc/index.js index c53e0d8..dfb0fa7 100644 --- a/server/rpc/index.js +++ b/server/rpc/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9af4=['../api/squareMessage/squareMessage.rpc','../api/attachment/attachment.rpc','../api/plugin/plugin.rpc','../api/whatsappAccount/whatsappAccount.rpc','../api/whatsappMessage/whatsappMessage.rpc','../api/whatsappQueue/whatsappQueue.rpc','server','http','rpc','port','localhost','listen','log','Express\x20RPC\x20server\x20listening\x20on\x20%s:%d!','../config/triggers','default','RPC\x20listening\x20on\x20','jayson/promise','lodash','../config/environment','merge','../api/user/user.rpc','../api/voiceQueue/voiceQueue.rpc','../api/voiceCallReport/voiceCallReport.rpc','../api/voiceDialReport/voiceDialReport.rpc','../api/voiceAgentReport/voiceAgentReport.rpc','../api/voiceQueueReport/voiceQueueReport.rpc','../api/memberReport/memberReport.rpc','../api/trunk/trunk.rpc','../api/mailServerIn/mailServerIn.rpc','../api/mailAccount/mailAccount.rpc','../api/mailInteraction/mailInteraction.rpc','../api/mailMessage/mailMessage.rpc','../api/mailApplication/mailApplication.rpc','../api/faxAccount/faxAccount.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/smsQueue/smsQueue.rpc','../api/openchannelApplication/openchannelApplication.rpc','../api/openchannelInteraction/openchannelInteraction.rpc','../api/openchannelMessage/openchannelMessage.rpc','../api/openchannelQueueReport/openchannelQueueReport.rpc','../api/chatMessage/chatMessage.rpc','../api/chatQueue/chatQueue.rpc','../api/cmContact/cmContact.rpc','../api/cmHopper/cmHopper.rpc','../api/cmHopperBlack/cmHopperBlack.rpc','../api/cmHopperFinal/cmHopperFinal.rpc','../api/reportAgentPreview/reportAgentPreview.rpc','../api/interval/interval.rpc','../api/pause/pause.rpc','../api/sound/sound.rpc','../api/template/template.rpc','../api/trigger/trigger.rpc','../api/intSugarcrmAccount/intSugarcrmAccount.rpc','../api/intDeskAccount/intDeskAccount.rpc','../api/intFreshdeskAccount/intFreshdeskAccount.rpc','../api/intServicenowAccount/intServicenowAccount.rpc','../api/intDynamics365Account/intDynamics365Account.rpc','../api/intFreshsalesAccount/intFreshsalesAccount.rpc','../api/chatQueueReport/chatQueueReport.rpc','../api/squareReport/squareReport.rpc','../api/squareReportDetail/squareReportDetail.rpc','../api/squareProject/squareProject.rpc','../api/squareRecording/squareRecording.rpc'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x9af4,0x1af));var _0x49af=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0x9af4[_0x397e5f];return _0x5302b8;};'use strict';var jayson=require(_0x49af('0x0'));var BPromise=require('bluebird');var _=require(_0x49af('0x1'));var config=require(_0x49af('0x2'));exports['listen']=function(){return new BPromise(function(_0xe213b6,_0x486661){var _0x5efd2c={};_0x5efd2c=_[_0x49af('0x3')](_0x5efd2c,require(_0x49af('0x4')));_0x5efd2c=_['merge'](_0x5efd2c,require('../api/voiceExtension/voiceExtension.rpc'));_0x5efd2c=_['merge'](_0x5efd2c,require(_0x49af('0x5')));_0x5efd2c=_['merge'](_0x5efd2c,require('../api/voiceRecording/voiceRecording.rpc'));_0x5efd2c=_[_0x49af('0x3')](_0x5efd2c,require(_0x49af('0x6')));_0x5efd2c=_[_0x49af('0x3')](_0x5efd2c,require(_0x49af('0x7')));_0x5efd2c=_['merge'](_0x5efd2c,require(_0x49af('0x8')));_0x5efd2c=_[_0x49af('0x3')](_0x5efd2c,require(_0x49af('0x9')));_0x5efd2c=_[_0x49af('0x3')](_0x5efd2c,require(_0x49af('0xa')));_0x5efd2c=_[_0x49af('0x3')](_0x5efd2c,require(_0x49af('0xb')));_0x5efd2c=_[_0x49af('0x3')](_0x5efd2c,require('../api/voiceTransferReport/voiceTransferReport.rpc'));_0x5efd2c=_['merge'](_0x5efd2c,require('../api/userVoiceQueueRt/userVoiceQueueRt.rpc'));_0x5efd2c=_[_0x49af('0x3')](_0x5efd2c,require(_0x49af('0xc')));_0x5efd2c=_[_0x49af('0x3')](_0x5efd2c,require(_0x49af('0xd')));_0x5efd2c=_[_0x49af('0x3')](_0x5efd2c,require('../api/mailQueue/mailQueue.rpc'));_0x5efd2c=_[_0x49af('0x3')](_0x5efd2c,require(_0x49af('0xe')));_0x5efd2c=_[_0x49af('0x3')](_0x5efd2c,require(_0x49af('0xf')));_0x5efd2c=_['merge'](_0x5efd2c,require(_0x49af('0x10')));_0x5efd2c=_[_0x49af('0x3')](_0x5efd2c,require('../api/mailQueueReport/mailQueueReport.rpc'));_0x5efd2c=_[_0x49af('0x3')](_0x5efd2c,require(_0x49af('0x11')));_0x5efd2c=_[_0x49af('0x3')](_0x5efd2c,require('../api/faxApplication/faxApplication.rpc'));_0x5efd2c=_['merge'](_0x5efd2c,require('../api/faxInteraction/faxInteraction.rpc'));_0x5efd2c=_[_0x49af('0x3')](_0x5efd2c,require(_0x49af('0x12')));_0x5efd2c=_[_0x49af('0x3')](_0x5efd2c,require(_0x49af('0x13')));_0x5efd2c=_[_0x49af('0x3')](_0x5efd2c,require(_0x49af('0x14')));_0x5efd2c=_[_0x49af('0x3')](_0x5efd2c,require(_0x49af('0x15')));_0x5efd2c=_[_0x49af('0x3')](_0x5efd2c,require(_0x49af('0x16')));_0x5efd2c=_['merge'](_0x5efd2c,require(_0x49af('0x17')));_0x5efd2c=_[_0x49af('0x3')](_0x5efd2c,require(_0x49af('0x18')));_0x5efd2c=_['merge'](_0x5efd2c,require(_0x49af('0x19')));_0x5efd2c=_[_0x49af('0x3')](_0x5efd2c,require(_0x49af('0x1a')));_0x5efd2c=_['merge'](_0x5efd2c,require(_0x49af('0x1b')));_0x5efd2c=_[_0x49af('0x3')](_0x5efd2c,require('../api/openchannelQueue/openchannelQueue.rpc'));_0x5efd2c=_[_0x49af('0x3')](_0x5efd2c,require(_0x49af('0x1c')));_0x5efd2c=_['merge'](_0x5efd2c,require('../api/chatInteraction/chatInteraction.rpc'));_0x5efd2c=_[_0x49af('0x3')](_0x5efd2c,require(_0x49af('0x1d')));_0x5efd2c=_[_0x49af('0x3')](_0x5efd2c,require(_0x49af('0x1e')));_0x5efd2c=_[_0x49af('0x3')](_0x5efd2c,require(_0x49af('0x1f')));_0x5efd2c=_[_0x49af('0x3')](_0x5efd2c,require(_0x49af('0x20')));_0x5efd2c=_['merge'](_0x5efd2c,require(_0x49af('0x21')));_0x5efd2c=_['merge'](_0x5efd2c,require(_0x49af('0x22')));_0x5efd2c=_[_0x49af('0x3')](_0x5efd2c,require('../api/cmHopperHistory/cmHopperHistory.rpc'));_0x5efd2c=_[_0x49af('0x3')](_0x5efd2c,require(_0x49af('0x23')));_0x5efd2c=_['merge'](_0x5efd2c,require(_0x49af('0x24')));_0x5efd2c=_[_0x49af('0x3')](_0x5efd2c,require(_0x49af('0x25')));_0x5efd2c=_[_0x49af('0x3')](_0x5efd2c,require(_0x49af('0x26')));_0x5efd2c=_[_0x49af('0x3')](_0x5efd2c,require(_0x49af('0x27')));_0x5efd2c=_['merge'](_0x5efd2c,require(_0x49af('0x28')));_0x5efd2c=_[_0x49af('0x3')](_0x5efd2c,require('../api/variable/variable.rpc'));_0x5efd2c=_['merge'](_0x5efd2c,require('../api/intSalesforceAccount/intSalesforceAccount.rpc'));_0x5efd2c=_[_0x49af('0x3')](_0x5efd2c,require(_0x49af('0x29')));_0x5efd2c=_['merge'](_0x5efd2c,require(_0x49af('0x2a')));_0x5efd2c=_[_0x49af('0x3')](_0x5efd2c,require('../api/intZohoAccount/intZohoAccount.rpc'));_0x5efd2c=_[_0x49af('0x3')](_0x5efd2c,require('../api/intZendeskAccount/intZendeskAccount.rpc'));_0x5efd2c=_['merge'](_0x5efd2c,require(_0x49af('0x2b')));_0x5efd2c=_[_0x49af('0x3')](_0x5efd2c,require('../api/intVtigerAccount/intVtigerAccount.rpc'));_0x5efd2c=_[_0x49af('0x3')](_0x5efd2c,require(_0x49af('0x2c')));_0x5efd2c=_[_0x49af('0x3')](_0x5efd2c,require(_0x49af('0x2d')));_0x5efd2c=_[_0x49af('0x3')](_0x5efd2c,require(_0x49af('0x2e')));_0x5efd2c=_['merge'](_0x5efd2c,require(_0x49af('0x2f')));_0x5efd2c=_[_0x49af('0x3')](_0x5efd2c,require('../api/smsQueueReport/smsQueueReport.rpc'));_0x5efd2c=_[_0x49af('0x3')](_0x5efd2c,require(_0x49af('0x30')));_0x5efd2c=_[_0x49af('0x3')](_0x5efd2c,require(_0x49af('0x31')));_0x5efd2c=_[_0x49af('0x3')](_0x5efd2c,require('../api/squareOdbc/squareOdbc.rpc'));_0x5efd2c=_[_0x49af('0x3')](_0x5efd2c,require(_0x49af('0x32')));_0x5efd2c=_['merge'](_0x5efd2c,require(_0x49af('0x33')));_0x5efd2c=_[_0x49af('0x3')](_0x5efd2c,require(_0x49af('0x34')));_0x5efd2c=_[_0x49af('0x3')](_0x5efd2c,require('../api/campaign/campaign.rpc'));_0x5efd2c=_[_0x49af('0x3')](_0x5efd2c,require(_0x49af('0x35')));_0x5efd2c=_['merge'](_0x5efd2c,require(_0x49af('0x36')));_0x5efd2c=_[_0x49af('0x3')](_0x5efd2c,require(_0x49af('0x37')));_0x5efd2c=_['merge'](_0x5efd2c,require('../api/whatsappInteraction/whatsappInteraction.rpc'));_0x5efd2c=_['merge'](_0x5efd2c,require(_0x49af('0x38')));_0x5efd2c=_[_0x49af('0x3')](_0x5efd2c,require('../api/whatsappQueueReport/whatsappQueueReport.rpc'));_0x5efd2c=_[_0x49af('0x3')](_0x5efd2c,require(_0x49af('0x39')));var _0xa2cdf8=jayson[_0x49af('0x3a')](_0x5efd2c)[_0x49af('0x3b')]();var _0xd029b7=config[_0x49af('0x3c')][_0x49af('0x3d')]||config['port']+0x1;var _0x33a467=config[_0x49af('0x3c')]['ip']||_0x49af('0x3e');_0xa2cdf8['on']('error',function(_0x4850af){return _0x486661(_0x4850af);});_0xa2cdf8[_0x49af('0x3f')](_0xd029b7,_0x33a467,function(){console[_0x49af('0x40')](_0x49af('0x41'),_0x33a467,_0xd029b7);require(_0x49af('0x42'))[_0x49af('0x43')]();return _0xe213b6(_0x49af('0x44')+_0x33a467+':'+_0xd029b7);});});}; \ No newline at end of file +var _0xa5df=['port','localhost','error','listen','log','Express\x20RPC\x20server\x20listening\x20on\x20%s:%d!','../config/triggers','default','jayson/promise','bluebird','lodash','../config/environment','merge','../api/voiceExtension/voiceExtension.rpc','../api/voiceQueue/voiceQueue.rpc','../api/voiceRecording/voiceRecording.rpc','../api/voiceDialReport/voiceDialReport.rpc','../api/voiceAgentReport/voiceAgentReport.rpc','../api/voiceQueueReport/voiceQueueReport.rpc','../api/memberReport/memberReport.rpc','../api/userVoiceQueueRt/userVoiceQueueRt.rpc','../api/mailServerIn/mailServerIn.rpc','../api/mailQueue/mailQueue.rpc','../api/mailInteraction/mailInteraction.rpc','../api/mailApplication/mailApplication.rpc','../api/mailQueueReport/mailQueueReport.rpc','../api/faxAccount/faxAccount.rpc','../api/faxInteraction/faxInteraction.rpc','../api/faxMessage/faxMessage.rpc','../api/faxQueueReport/faxQueueReport.rpc','../api/smsInteraction/smsInteraction.rpc','../api/smsMessage/smsMessage.rpc','../api/smsQueue/smsQueue.rpc','../api/openchannelInteraction/openchannelInteraction.rpc','../api/openchannelQueue/openchannelQueue.rpc','../api/openchannelQueueReport/openchannelQueueReport.rpc','../api/chatInteraction/chatInteraction.rpc','../api/chatMessage/chatMessage.rpc','../api/cmHopper/cmHopper.rpc','../api/cmHopperHistory/cmHopperHistory.rpc','../api/interval/interval.rpc','../api/template/template.rpc','../api/intSalesforceAccount/intSalesforceAccount.rpc','../api/intSugarcrmAccount/intSugarcrmAccount.rpc','../api/intDeskAccount/intDeskAccount.rpc','../api/intZohoAccount/intZohoAccount.rpc','../api/intFreshdeskAccount/intFreshdeskAccount.rpc','../api/intDynamics365Account/intDynamics365Account.rpc','../api/intFreshsalesAccount/intFreshsalesAccount.rpc','../api/chatQueueReport/chatQueueReport.rpc','../api/smsQueueReport/smsQueueReport.rpc','../api/squareReport/squareReport.rpc','../api/squareOdbc/squareOdbc.rpc','../api/campaign/campaign.rpc','../api/attachment/attachment.rpc','../api/plugin/plugin.rpc','../api/whatsappAccount/whatsappAccount.rpc','../api/whatsappMessage/whatsappMessage.rpc','../api/whatsappQueueReport/whatsappQueueReport.rpc','http','rpc'];(function(_0x3c7b85,_0x53410e){var _0x1c6258=function(_0x3c57da){while(--_0x3c57da){_0x3c7b85['push'](_0x3c7b85['shift']());}};_0x1c6258(++_0x53410e);}(_0xa5df,0xbf));var _0xfa5d=function(_0xd0a3ac,_0x3fb515){_0xd0a3ac=_0xd0a3ac-0x0;var _0x5acada=_0xa5df[_0xd0a3ac];return _0x5acada;};'use strict';var jayson=require(_0xfa5d('0x0'));var BPromise=require(_0xfa5d('0x1'));var _=require(_0xfa5d('0x2'));var config=require(_0xfa5d('0x3'));exports['listen']=function(){return new BPromise(function(_0x24bf38,_0x569c0f){var _0x27e18a={};_0x27e18a=_[_0xfa5d('0x4')](_0x27e18a,require('../api/user/user.rpc'));_0x27e18a=_[_0xfa5d('0x4')](_0x27e18a,require(_0xfa5d('0x5')));_0x27e18a=_[_0xfa5d('0x4')](_0x27e18a,require(_0xfa5d('0x6')));_0x27e18a=_[_0xfa5d('0x4')](_0x27e18a,require(_0xfa5d('0x7')));_0x27e18a=_['merge'](_0x27e18a,require('../api/voiceCallReport/voiceCallReport.rpc'));_0x27e18a=_[_0xfa5d('0x4')](_0x27e18a,require(_0xfa5d('0x8')));_0x27e18a=_[_0xfa5d('0x4')](_0x27e18a,require(_0xfa5d('0x9')));_0x27e18a=_[_0xfa5d('0x4')](_0x27e18a,require(_0xfa5d('0xa')));_0x27e18a=_['merge'](_0x27e18a,require(_0xfa5d('0xb')));_0x27e18a=_['merge'](_0x27e18a,require('../api/trunk/trunk.rpc'));_0x27e18a=_[_0xfa5d('0x4')](_0x27e18a,require('../api/voiceTransferReport/voiceTransferReport.rpc'));_0x27e18a=_[_0xfa5d('0x4')](_0x27e18a,require(_0xfa5d('0xc')));_0x27e18a=_[_0xfa5d('0x4')](_0x27e18a,require(_0xfa5d('0xd')));_0x27e18a=_[_0xfa5d('0x4')](_0x27e18a,require('../api/mailAccount/mailAccount.rpc'));_0x27e18a=_['merge'](_0x27e18a,require(_0xfa5d('0xe')));_0x27e18a=_['merge'](_0x27e18a,require(_0xfa5d('0xf')));_0x27e18a=_['merge'](_0x27e18a,require('../api/mailMessage/mailMessage.rpc'));_0x27e18a=_[_0xfa5d('0x4')](_0x27e18a,require(_0xfa5d('0x10')));_0x27e18a=_[_0xfa5d('0x4')](_0x27e18a,require(_0xfa5d('0x11')));_0x27e18a=_[_0xfa5d('0x4')](_0x27e18a,require(_0xfa5d('0x12')));_0x27e18a=_[_0xfa5d('0x4')](_0x27e18a,require('../api/faxApplication/faxApplication.rpc'));_0x27e18a=_[_0xfa5d('0x4')](_0x27e18a,require(_0xfa5d('0x13')));_0x27e18a=_[_0xfa5d('0x4')](_0x27e18a,require(_0xfa5d('0x14')));_0x27e18a=_['merge'](_0x27e18a,require('../api/faxQueue/faxQueue.rpc'));_0x27e18a=_[_0xfa5d('0x4')](_0x27e18a,require(_0xfa5d('0x15')));_0x27e18a=_[_0xfa5d('0x4')](_0x27e18a,require('../api/smsAccount/smsAccount.rpc'));_0x27e18a=_[_0xfa5d('0x4')](_0x27e18a,require(_0xfa5d('0x16')));_0x27e18a=_[_0xfa5d('0x4')](_0x27e18a,require(_0xfa5d('0x17')));_0x27e18a=_['merge'](_0x27e18a,require(_0xfa5d('0x18')));_0x27e18a=_['merge'](_0x27e18a,require('../api/openchannelApplication/openchannelApplication.rpc'));_0x27e18a=_[_0xfa5d('0x4')](_0x27e18a,require(_0xfa5d('0x19')));_0x27e18a=_[_0xfa5d('0x4')](_0x27e18a,require('../api/openchannelMessage/openchannelMessage.rpc'));_0x27e18a=_[_0xfa5d('0x4')](_0x27e18a,require(_0xfa5d('0x1a')));_0x27e18a=_['merge'](_0x27e18a,require(_0xfa5d('0x1b')));_0x27e18a=_[_0xfa5d('0x4')](_0x27e18a,require(_0xfa5d('0x1c')));_0x27e18a=_[_0xfa5d('0x4')](_0x27e18a,require(_0xfa5d('0x1d')));_0x27e18a=_['merge'](_0x27e18a,require('../api/chatQueue/chatQueue.rpc'));_0x27e18a=_['merge'](_0x27e18a,require('../api/cmContact/cmContact.rpc'));_0x27e18a=_['merge'](_0x27e18a,require(_0xfa5d('0x1e')));_0x27e18a=_[_0xfa5d('0x4')](_0x27e18a,require('../api/cmHopperBlack/cmHopperBlack.rpc'));_0x27e18a=_[_0xfa5d('0x4')](_0x27e18a,require('../api/cmHopperFinal/cmHopperFinal.rpc'));_0x27e18a=_[_0xfa5d('0x4')](_0x27e18a,require(_0xfa5d('0x1f')));_0x27e18a=_[_0xfa5d('0x4')](_0x27e18a,require('../api/reportAgentPreview/reportAgentPreview.rpc'));_0x27e18a=_[_0xfa5d('0x4')](_0x27e18a,require(_0xfa5d('0x20')));_0x27e18a=_['merge'](_0x27e18a,require('../api/pause/pause.rpc'));_0x27e18a=_[_0xfa5d('0x4')](_0x27e18a,require('../api/sound/sound.rpc'));_0x27e18a=_[_0xfa5d('0x4')](_0x27e18a,require(_0xfa5d('0x21')));_0x27e18a=_[_0xfa5d('0x4')](_0x27e18a,require('../api/trigger/trigger.rpc'));_0x27e18a=_[_0xfa5d('0x4')](_0x27e18a,require('../api/variable/variable.rpc'));_0x27e18a=_[_0xfa5d('0x4')](_0x27e18a,require(_0xfa5d('0x22')));_0x27e18a=_[_0xfa5d('0x4')](_0x27e18a,require(_0xfa5d('0x23')));_0x27e18a=_[_0xfa5d('0x4')](_0x27e18a,require(_0xfa5d('0x24')));_0x27e18a=_[_0xfa5d('0x4')](_0x27e18a,require(_0xfa5d('0x25')));_0x27e18a=_[_0xfa5d('0x4')](_0x27e18a,require('../api/intZendeskAccount/intZendeskAccount.rpc'));_0x27e18a=_[_0xfa5d('0x4')](_0x27e18a,require(_0xfa5d('0x26')));_0x27e18a=_['merge'](_0x27e18a,require('../api/intVtigerAccount/intVtigerAccount.rpc'));_0x27e18a=_[_0xfa5d('0x4')](_0x27e18a,require('../api/intServicenowAccount/intServicenowAccount.rpc'));_0x27e18a=_['merge'](_0x27e18a,require(_0xfa5d('0x27')));_0x27e18a=_[_0xfa5d('0x4')](_0x27e18a,require(_0xfa5d('0x28')));_0x27e18a=_[_0xfa5d('0x4')](_0x27e18a,require(_0xfa5d('0x29')));_0x27e18a=_[_0xfa5d('0x4')](_0x27e18a,require(_0xfa5d('0x2a')));_0x27e18a=_[_0xfa5d('0x4')](_0x27e18a,require(_0xfa5d('0x2b')));_0x27e18a=_[_0xfa5d('0x4')](_0x27e18a,require('../api/squareReportDetail/squareReportDetail.rpc'));_0x27e18a=_['merge'](_0x27e18a,require(_0xfa5d('0x2c')));_0x27e18a=_[_0xfa5d('0x4')](_0x27e18a,require('../api/squareProject/squareProject.rpc'));_0x27e18a=_[_0xfa5d('0x4')](_0x27e18a,require('../api/squareRecording/squareRecording.rpc'));_0x27e18a=_[_0xfa5d('0x4')](_0x27e18a,require('../api/squareMessage/squareMessage.rpc'));_0x27e18a=_[_0xfa5d('0x4')](_0x27e18a,require(_0xfa5d('0x2d')));_0x27e18a=_['merge'](_0x27e18a,require(_0xfa5d('0x2e')));_0x27e18a=_[_0xfa5d('0x4')](_0x27e18a,require(_0xfa5d('0x2f')));_0x27e18a=_[_0xfa5d('0x4')](_0x27e18a,require(_0xfa5d('0x30')));_0x27e18a=_[_0xfa5d('0x4')](_0x27e18a,require('../api/whatsappInteraction/whatsappInteraction.rpc'));_0x27e18a=_[_0xfa5d('0x4')](_0x27e18a,require(_0xfa5d('0x31')));_0x27e18a=_[_0xfa5d('0x4')](_0x27e18a,require(_0xfa5d('0x32')));_0x27e18a=_[_0xfa5d('0x4')](_0x27e18a,require('../api/whatsappQueue/whatsappQueue.rpc'));var _0x4c94dc=jayson['server'](_0x27e18a)[_0xfa5d('0x33')]();var _0x40f598=config[_0xfa5d('0x34')][_0xfa5d('0x35')]||config['port']+0x1;var _0x1ca6ed=config[_0xfa5d('0x34')]['ip']||_0xfa5d('0x36');_0x4c94dc['on'](_0xfa5d('0x37'),function(_0x4ab462){return _0x569c0f(_0x4ab462);});_0x4c94dc[_0xfa5d('0x38')](_0x40f598,_0x1ca6ed,function(){console[_0xfa5d('0x39')](_0xfa5d('0x3a'),_0x1ca6ed,_0x40f598);require(_0xfa5d('0x3b'))[_0xfa5d('0x3c')]();return _0x24bf38('RPC\x20listening\x20on\x20'+_0x1ca6ed+':'+_0x40f598);});});}; \ No newline at end of file diff --git a/server/services/agi/channel.js b/server/services/agi/channel.js index f61621c..89723d4 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 _0x86bf=['SET\x20VARIABLE\x20%s\x20\x22%s\x22','toString','replace','sayNumber','SAY\x20DIGITS\x20%s\x20%s','sayPhonetic','SAY\x20PHONETIC\x20\x22%s\x22\x20%s','extension','noop','GOTO\x20%s\x20%s\x20%s','getVariable','wav','RECORD\x20FILE\x20\x22%s\x22\x20\x22%s\x22\x20\x22%s\x22\x20%s\x20%s\x20%s','streamFile','STREAM\x20FILE\x20\x22%s\x22\x20\x22%s\x22','agi','AGI','WAIT','label','exports','util','lodash','events','./error','call','setEncoding','utf8','setTimeout','headers','emit','ready','line','toLowerCase','hangup','substring','520-Invalid','search','520\x20End\x20of\x20proper','no\x20code','result=','indexOf','substr','startsWith','split','length','error','code','close','E_AGI_SOCKET_CLOSE','timeout','E_AGI_SOCKET_TIMEOUT','pipe','command','log','command=','function','destroy','inherits','prototype','sendRequest','sync','ANSWER','getData','beep','format','GET\x20DATA\x20\x22%s\x22\x20%s\x20%s','VERBOSE\x20\x22%s\x22','exec','isArray','setContext','SET\x20CONTEXT\x20%s','setExtension','setPriority','HANGUP','setVariable'];(function(_0x12fc8d,_0x19ee33){var _0x3f9d04=function(_0x52e51c){while(--_0x52e51c){_0x12fc8d['push'](_0x12fc8d['shift']());}};_0x3f9d04(++_0x19ee33);}(_0x86bf,0x1d6));var _0xf86b=function(_0x7de7fd,_0x2a0693){_0x7de7fd=_0x7de7fd-0x0;var _0x1c975f=_0x86bf[_0x7de7fd];return _0x1c975f;};'use strict';var util=require(_0xf86b('0x0'));var _=require(_0xf86b('0x1'));var EventEmitter=require(_0xf86b('0x2'))['EventEmitter'];var AGIReply=require('./reply');var AGIError=require(_0xf86b('0x3'));function AGIChannel(_0x5d2498){var _0x2ae23c=this,_0x47b80a=new AGIReply(),_0x221b72=![],_0x274727={};EventEmitter[_0xf86b('0x4')](_0x2ae23c);_0x5d2498[_0xf86b('0x5')](_0xf86b('0x6'));_0x5d2498[_0xf86b('0x7')](0x8*0x3c*0x3c*0x3e8);_0x47b80a[_0xf86b('0x5')](_0xf86b('0x6'));_0x47b80a['on'](_0xf86b('0x8'),function(_0x1e88e6){for(var _0x2dd0da in _0x1e88e6){_0x2ae23c[_0x2dd0da]=_0x1e88e6[_0x2dd0da];}_0x2ae23c[_0xf86b('0x9')](_0xf86b('0xa'));});_0x47b80a['on'](_0xf86b('0xb'),function(_0x3683ea){if(_0x3683ea[_0xf86b('0xc')]()=='hangup'){_0x2ae23c['emit'](_0xf86b('0xd'));return;}if(_0x3683ea[_0xf86b('0xe')](0x0,0xb)==_0xf86b('0xf')){_0x221b72=!![];}if(_0x221b72){_0x274727['rx']+=_0x3683ea+'\x0a';if(_0x3683ea[_0xf86b('0x10')](_0xf86b('0x11'))!=-0x1){_0x221b72=![];}}else{_0x274727['rx']=_0x3683ea;}if(_0x221b72){return;}if(typeof _0x274727['cb']=='function'){var _0x3c1db3=_0x274727['rx']['substring'](0x0,0x3),_0x41bf28=null,_0x3077aa=null;_0x3c1db3=parseInt(_0x3c1db3);if(isNaN(_0x3c1db3)){_0x274727['cb'](null,{'code':0x1f4,'result':-0x1,'extra':_0xf86b('0x12')});return;}if(_0x3c1db3!=0xc8){_0x274727['cb'](null,{'code':_0x3c1db3,'result':-0x1,'extra':'KO'});return;}_0x41bf28=_0x274727['rx']['substring'](0x4)['replace'](_0xf86b('0x13'),'');if(_0x41bf28[_0xf86b('0x14')]('\x20')!=-0x1){_0x41bf28=_0x41bf28[_0xf86b('0x15')](0x0,_0x41bf28['indexOf']('\x20'));}if(_[_0xf86b('0x16')](_0x41bf28,'-1')){_0x41bf28=parseInt(_0x41bf28);}_0x3077aa=_0x274727['rx'][_0xf86b('0x17')]('\x20');if(_0x3077aa['length']==0x3){_0x3077aa=_0x3077aa[0x2]['substring'](0x1,_0x3077aa[0x2][_0xf86b('0x18')]-0x1);}else if(_0x3077aa[_0xf86b('0x18')]>0x3){var _0x1814c5=/\((.+)\)/;var _0x4e0230=_0x274727['rx']['match'](_0x1814c5);if(_0x4e0230){_0x3077aa=_0x4e0230[0x1];}else{_0x3077aa=null;}}else{_0x3077aa=null;}_0x274727['cb'](null,{'code':_0x3c1db3,'result':_0x41bf28,'extra':_0x3077aa});}});_0x5d2498['on'](_0xf86b('0x19'),function(_0x542faa){_0x2ae23c['emit']('error',new AGIError('E_AGI_SOCKET_ERROR',_0x542faa[_0xf86b('0x1a')]));});_0x5d2498['on'](_0xf86b('0x1b'),function(){_0x2ae23c[_0xf86b('0x9')]('close',new AGIError(_0xf86b('0x1c')));});_0x5d2498['on']('timeout',function(){_0x2ae23c[_0xf86b('0x9')](_0xf86b('0x1d'),new AGIError(_0xf86b('0x1e')));_0x5d2498['destroy']();});_0x5d2498[_0xf86b('0x1f')](_0x47b80a);this[_0xf86b('0x20')]=function(_0xb5147f,_0x44197e){console[_0xf86b('0x21')](_0xf86b('0x22'),_0xb5147f);var _0xb5147f=_0xb5147f||'',_0x44197e=typeof _0x44197e==_0xf86b('0x23')?_0x44197e:new Function();_0x274727={'tx':_0xb5147f,'rx':'','cb':_0x44197e};_0x5d2498['write'](_0xb5147f+'\x0a');},this[_0xf86b('0x1b')]=function(){_0x5d2498[_0xf86b('0x24')]();};}util[_0xf86b('0x25')](AGIChannel,EventEmitter);AGIChannel[_0xf86b('0x26')][_0xf86b('0x27')]=function(_0x26e59b){return this[_0xf86b('0x20')][_0xf86b('0x28')](this,_0x26e59b);};AGIChannel[_0xf86b('0x26')]['answer']=function(){return this['sendRequest'](_0xf86b('0x29'));};AGIChannel[_0xf86b('0x26')][_0xf86b('0x2a')]=function(_0x23ca3b,_0x2b3c44,_0x495cd2){_0x23ca3b=_0x23ca3b===undefined?_0xf86b('0x2b'):_0x23ca3b;_0x2b3c44=_0x2b3c44===undefined?'5':_0x2b3c44;_0x495cd2=_0x495cd2===undefined?'1':_0x495cd2;return this[_0xf86b('0x27')](util[_0xf86b('0x2c')](_0xf86b('0x2d'),_0x23ca3b,_0x2b3c44*0x3e8,_0x495cd2));};AGIChannel['prototype']['noop']=function(_0xdf0bf3){_0xdf0bf3=_0xdf0bf3||'NO\x20MESSAGE';return this[_0xf86b('0x27')](util[_0xf86b('0x2c')](_0xf86b('0x2e'),_0xdf0bf3));};AGIChannel[_0xf86b('0x26')][_0xf86b('0x2f')]=function(_0xfc8efa,_0x1670fa){if(_[_0xf86b('0x30')](_0x1670fa)){return this[_0xf86b('0x27')](util[_0xf86b('0x2c')]('EXEC\x20%s\x20%s',_0xfc8efa,_0x1670fa['join'](',')));}return this[_0xf86b('0x27')](util[_0xf86b('0x2c')]('EXEC\x20%s\x20%s',_0xfc8efa,_0x1670fa));};AGIChannel['prototype'][_0xf86b('0x31')]=function(_0x5d6007){return this[_0xf86b('0x27')](util[_0xf86b('0x2c')](_0xf86b('0x32'),_0x5d6007));};AGIChannel['prototype'][_0xf86b('0x33')]=function(_0x5246da){return this[_0xf86b('0x27')](util[_0xf86b('0x2c')]('SET\x20EXTENSION\x20%s',_0x5246da));};AGIChannel[_0xf86b('0x26')][_0xf86b('0x34')]=function(_0x1f4ef1){return this[_0xf86b('0x27')](util['format']('SET\x20PRIORITY\x20%s',_0x1f4ef1));};AGIChannel[_0xf86b('0x26')][_0xf86b('0xd')]=function(){return this[_0xf86b('0x27')](_0xf86b('0x35'));};AGIChannel[_0xf86b('0x26')][_0xf86b('0x36')]=function(_0x4d6db2,_0x5afe1e){var _0x52f530=_['isBoolean'](_0x5afe1e)||_['isNumber'](_0x5afe1e)?_0x5afe1e['toString']():_0x5afe1e;return this['sendRequest'](util[_0xf86b('0x2c')](_0xf86b('0x37'),_0x4d6db2,_0x52f530?_0x52f530[_0xf86b('0x38')]()[_0xf86b('0x39')](/(\r\n|\n|\r)/gm,'\x20'):''));};AGIChannel['prototype'][_0xf86b('0x3a')]=function(_0x200fe4,_0x595203){return this['sendRequest'](util[_0xf86b('0x2c')]('SAY\x20NUMBER\x20%s\x20%s',_0x200fe4,_0x595203));};AGIChannel[_0xf86b('0x26')]['sayDigits']=function(_0x20a51f,_0x34661b){return this['sendRequest'](util['format'](_0xf86b('0x3b'),_0x20a51f,_0x34661b));};AGIChannel['prototype'][_0xf86b('0x3c')]=function(_0x1ce84a,_0x415f8f){return this[_0xf86b('0x27')](util['format'](_0xf86b('0x3d'),_0x1ce84a,_0x415f8f));};AGIChannel['prototype']['continueAt']=function(_0x48ae57,_0x556cdb,_0x55e210){_0x556cdb=_0x556cdb||this[_0xf86b('0x3e')];_0x55e210=_0x55e210||0x1;this[_0xf86b('0x31')](_0x48ae57);this['setExtension'](_0x556cdb);this[_0xf86b('0x34')](_0x55e210);return this[_0xf86b('0x3f')](util['format'](_0xf86b('0x40'),_0x48ae57,_0x556cdb,_0x55e210));};AGIChannel['prototype'][_0xf86b('0x41')]=function(_0x37c000){console[_0xf86b('0x21')]('getvariable',_0x37c000);return this[_0xf86b('0x27')](util[_0xf86b('0x2c')]('GET\x20VARIABLE\x20\x22%s\x22',_0x37c000));};AGIChannel[_0xf86b('0x26')]['recordFile']=function(_0x530e37,_0x2ae2cb,_0x20e613,_0x3f37f9,_0x202eb1,_0x1975f3){_0x2ae2cb=_0x2ae2cb||_0xf86b('0x42');_0x20e613=_0x20e613||'';_0x3f37f9=_0x3f37f9===undefined?-0x1:_0x3f37f9==='-1'?-0x1:_0x3f37f9*0x3e8;_0x202eb1=_0x202eb1===undefined?'':'s='+_0x202eb1;_0x1975f3=_0x1975f3?'BEEP':'';return this[_0xf86b('0x27')](util['format'](_0xf86b('0x43'),_0x530e37,_0x2ae2cb,_0x20e613,_0x3f37f9,_0x1975f3,_0x202eb1));};AGIChannel[_0xf86b('0x26')][_0xf86b('0x44')]=function(_0x35d31f,_0x2c7a34){_0x2c7a34=_0x2c7a34||'';return this[_0xf86b('0x27')](util['format'](_0xf86b('0x45'),_0x35d31f,_0x2c7a34));};AGIChannel['prototype'][_0xf86b('0x46')]=function(_0x3fdf67){return this[_0xf86b('0x2f')](_0xf86b('0x47'),_0x3fdf67);};AGIChannel[_0xf86b('0x26')]['wait']=function(_0x18907c){return this[_0xf86b('0x2f')](_0xf86b('0x48'),_0x18907c);};AGIChannel[_0xf86b('0x26')][_0xf86b('0x19')]=function(_0xe52acf,_0x12d92e){this[_0xf86b('0x3f')](util['format']('ID:%s\x20-\x20LABEL:\x20%s\x20-\x20MSG:\x20%s',_0xe52acf['id'],_0xe52acf[_0xf86b('0x49')],_0x12d92e));return{'code':0x1f4,'result':'-1','extra':''};};module[_0xf86b('0x4a')]=AGIChannel; \ No newline at end of file +var _0x4483=['sayDigits','SAY\x20DIGITS\x20%s\x20%s','extension','GOTO\x20%s\x20%s\x20%s','getVariable','getvariable','GET\x20VARIABLE\x20\x22%s\x22','BEEP','RECORD\x20FILE\x20\x22%s\x22\x20\x22%s\x22\x20\x22%s\x22\x20%s\x20%s\x20%s','streamFile','STREAM\x20FILE\x20\x22%s\x22\x20\x22%s\x22','AGI','label','exports','events','EventEmitter','./reply','./error','setEncoding','utf8','headers','emit','ready','hangup','substring','520-Invalid','search','520\x20End\x20of\x20proper','function','no\x20code','replace','indexOf','substr','startsWith','length','match','error','E_AGI_SOCKET_ERROR','close','E_AGI_SOCKET_CLOSE','timeout','E_AGI_SOCKET_TIMEOUT','destroy','command','log','command=','write','prototype','sendRequest','sync','answer','ANSWER','beep','GET\x20DATA\x20\x22%s\x22\x20%s\x20%s','noop','NO\x20MESSAGE','format','exec','EXEC\x20%s\x20%s','join','setContext','SET\x20CONTEXT\x20%s','setExtension','SET\x20EXTENSION\x20%s','setPriority','SET\x20PRIORITY\x20%s','HANGUP','setVariable','isBoolean','isNumber','toString','SET\x20VARIABLE\x20%s\x20\x22%s\x22','SAY\x20NUMBER\x20%s\x20%s'];(function(_0x322aff,_0x27d047){var _0x29d3d9=function(_0x64e14){while(--_0x64e14){_0x322aff['push'](_0x322aff['shift']());}};_0x29d3d9(++_0x27d047);}(_0x4483,0x17b));var _0x3448=function(_0x40fddc,_0x19e482){_0x40fddc=_0x40fddc-0x0;var _0x23cfc4=_0x4483[_0x40fddc];return _0x23cfc4;};'use strict';var util=require('util');var _=require('lodash');var EventEmitter=require(_0x3448('0x0'))[_0x3448('0x1')];var AGIReply=require(_0x3448('0x2'));var AGIError=require(_0x3448('0x3'));function AGIChannel(_0x4f1d5d){var _0x2b0fef=this,_0x567248=new AGIReply(),_0xc9c196=![],_0x36d2d4={};EventEmitter['call'](_0x2b0fef);_0x4f1d5d[_0x3448('0x4')](_0x3448('0x5'));_0x4f1d5d['setTimeout'](0x8*0x3c*0x3c*0x3e8);_0x567248[_0x3448('0x4')]('utf8');_0x567248['on'](_0x3448('0x6'),function(_0x35dd54){for(var _0x345c9b in _0x35dd54){_0x2b0fef[_0x345c9b]=_0x35dd54[_0x345c9b];}_0x2b0fef[_0x3448('0x7')](_0x3448('0x8'));});_0x567248['on']('line',function(_0x48178a){if(_0x48178a['toLowerCase']()==_0x3448('0x9')){_0x2b0fef['emit'](_0x3448('0x9'));return;}if(_0x48178a[_0x3448('0xa')](0x0,0xb)==_0x3448('0xb')){_0xc9c196=!![];}if(_0xc9c196){_0x36d2d4['rx']+=_0x48178a+'\x0a';if(_0x48178a[_0x3448('0xc')](_0x3448('0xd'))!=-0x1){_0xc9c196=![];}}else{_0x36d2d4['rx']=_0x48178a;}if(_0xc9c196){return;}if(typeof _0x36d2d4['cb']==_0x3448('0xe')){var _0x3e3533=_0x36d2d4['rx'][_0x3448('0xa')](0x0,0x3),_0x25a87a=null,_0x20b8bd=null;_0x3e3533=parseInt(_0x3e3533);if(isNaN(_0x3e3533)){_0x36d2d4['cb'](null,{'code':0x1f4,'result':-0x1,'extra':_0x3448('0xf')});return;}if(_0x3e3533!=0xc8){_0x36d2d4['cb'](null,{'code':_0x3e3533,'result':-0x1,'extra':'KO'});return;}_0x25a87a=_0x36d2d4['rx']['substring'](0x4)[_0x3448('0x10')]('result=','');if(_0x25a87a[_0x3448('0x11')]('\x20')!=-0x1){_0x25a87a=_0x25a87a[_0x3448('0x12')](0x0,_0x25a87a['indexOf']('\x20'));}if(_[_0x3448('0x13')](_0x25a87a,'-1')){_0x25a87a=parseInt(_0x25a87a);}_0x20b8bd=_0x36d2d4['rx']['split']('\x20');if(_0x20b8bd[_0x3448('0x14')]==0x3){_0x20b8bd=_0x20b8bd[0x2][_0x3448('0xa')](0x1,_0x20b8bd[0x2]['length']-0x1);}else if(_0x20b8bd['length']>0x3){var _0x33945e=/\((.+)\)/;var _0x50fa14=_0x36d2d4['rx'][_0x3448('0x15')](_0x33945e);if(_0x50fa14){_0x20b8bd=_0x50fa14[0x1];}else{_0x20b8bd=null;}}else{_0x20b8bd=null;}_0x36d2d4['cb'](null,{'code':_0x3e3533,'result':_0x25a87a,'extra':_0x20b8bd});}});_0x4f1d5d['on'](_0x3448('0x16'),function(_0x347dc2){_0x2b0fef[_0x3448('0x7')](_0x3448('0x16'),new AGIError(_0x3448('0x17'),_0x347dc2['code']));});_0x4f1d5d['on']('close',function(){_0x2b0fef[_0x3448('0x7')](_0x3448('0x18'),new AGIError(_0x3448('0x19')));});_0x4f1d5d['on'](_0x3448('0x1a'),function(){_0x2b0fef[_0x3448('0x7')]('timeout',new AGIError(_0x3448('0x1b')));_0x4f1d5d[_0x3448('0x1c')]();});_0x4f1d5d['pipe'](_0x567248);this[_0x3448('0x1d')]=function(_0x57e890,_0x4527a2){console[_0x3448('0x1e')](_0x3448('0x1f'),_0x57e890);var _0x57e890=_0x57e890||'',_0x4527a2=typeof _0x4527a2==_0x3448('0xe')?_0x4527a2:new Function();_0x36d2d4={'tx':_0x57e890,'rx':'','cb':_0x4527a2};_0x4f1d5d[_0x3448('0x20')](_0x57e890+'\x0a');},this[_0x3448('0x18')]=function(){_0x4f1d5d['destroy']();};}util['inherits'](AGIChannel,EventEmitter);AGIChannel[_0x3448('0x21')][_0x3448('0x22')]=function(_0x43122d){return this[_0x3448('0x1d')][_0x3448('0x23')](this,_0x43122d);};AGIChannel[_0x3448('0x21')][_0x3448('0x24')]=function(){return this[_0x3448('0x22')](_0x3448('0x25'));};AGIChannel[_0x3448('0x21')]['getData']=function(_0x70564b,_0x15b90d,_0x101ca2){_0x70564b=_0x70564b===undefined?_0x3448('0x26'):_0x70564b;_0x15b90d=_0x15b90d===undefined?'5':_0x15b90d;_0x101ca2=_0x101ca2===undefined?'1':_0x101ca2;return this[_0x3448('0x22')](util['format'](_0x3448('0x27'),_0x70564b,_0x15b90d*0x3e8,_0x101ca2));};AGIChannel['prototype'][_0x3448('0x28')]=function(_0x2df785){_0x2df785=_0x2df785||_0x3448('0x29');return this[_0x3448('0x22')](util[_0x3448('0x2a')]('VERBOSE\x20\x22%s\x22',_0x2df785));};AGIChannel['prototype'][_0x3448('0x2b')]=function(_0x28cec5,_0x29f8bf){if(_['isArray'](_0x29f8bf)){return this[_0x3448('0x22')](util['format'](_0x3448('0x2c'),_0x28cec5,_0x29f8bf[_0x3448('0x2d')](',')));}return this[_0x3448('0x22')](util[_0x3448('0x2a')](_0x3448('0x2c'),_0x28cec5,_0x29f8bf));};AGIChannel[_0x3448('0x21')][_0x3448('0x2e')]=function(_0x46ff58){return this['sendRequest'](util[_0x3448('0x2a')](_0x3448('0x2f'),_0x46ff58));};AGIChannel[_0x3448('0x21')][_0x3448('0x30')]=function(_0x19747f){return this[_0x3448('0x22')](util['format'](_0x3448('0x31'),_0x19747f));};AGIChannel[_0x3448('0x21')][_0x3448('0x32')]=function(_0x1b8e33){return this[_0x3448('0x22')](util[_0x3448('0x2a')](_0x3448('0x33'),_0x1b8e33));};AGIChannel[_0x3448('0x21')][_0x3448('0x9')]=function(){return this[_0x3448('0x22')](_0x3448('0x34'));};AGIChannel[_0x3448('0x21')][_0x3448('0x35')]=function(_0x42b407,_0x41a0b6){var _0x2670fd=_[_0x3448('0x36')](_0x41a0b6)||_[_0x3448('0x37')](_0x41a0b6)?_0x41a0b6[_0x3448('0x38')]():_0x41a0b6;return this[_0x3448('0x22')](util['format'](_0x3448('0x39'),_0x42b407,_0x2670fd?_0x2670fd[_0x3448('0x38')]()[_0x3448('0x10')](/(\r\n|\n|\r)/gm,'\x20'):''));};AGIChannel[_0x3448('0x21')]['sayNumber']=function(_0xb8eaaf,_0x580f3a){return this[_0x3448('0x22')](util[_0x3448('0x2a')](_0x3448('0x3a'),_0xb8eaaf,_0x580f3a));};AGIChannel['prototype'][_0x3448('0x3b')]=function(_0x247729,_0xf72e0f){return this[_0x3448('0x22')](util[_0x3448('0x2a')](_0x3448('0x3c'),_0x247729,_0xf72e0f));};AGIChannel[_0x3448('0x21')]['sayPhonetic']=function(_0x1d0a9d,_0x5107f8){return this[_0x3448('0x22')](util[_0x3448('0x2a')]('SAY\x20PHONETIC\x20\x22%s\x22\x20%s',_0x1d0a9d,_0x5107f8));};AGIChannel['prototype']['continueAt']=function(_0x2bb97d,_0x315daf,_0x59ede1){_0x315daf=_0x315daf||this[_0x3448('0x3d')];_0x59ede1=_0x59ede1||0x1;this[_0x3448('0x2e')](_0x2bb97d);this[_0x3448('0x30')](_0x315daf);this[_0x3448('0x32')](_0x59ede1);return this[_0x3448('0x28')](util[_0x3448('0x2a')](_0x3448('0x3e'),_0x2bb97d,_0x315daf,_0x59ede1));};AGIChannel['prototype'][_0x3448('0x3f')]=function(_0x576bbe){console['log'](_0x3448('0x40'),_0x576bbe);return this[_0x3448('0x22')](util['format'](_0x3448('0x41'),_0x576bbe));};AGIChannel['prototype']['recordFile']=function(_0x503d4a,_0x228901,_0x55c6e4,_0x3bc489,_0x65759c,_0x2dca4d){_0x228901=_0x228901||'wav';_0x55c6e4=_0x55c6e4||'';_0x3bc489=_0x3bc489===undefined?-0x1:_0x3bc489==='-1'?-0x1:_0x3bc489*0x3e8;_0x65759c=_0x65759c===undefined?'':'s='+_0x65759c;_0x2dca4d=_0x2dca4d?_0x3448('0x42'):'';return this[_0x3448('0x22')](util['format'](_0x3448('0x43'),_0x503d4a,_0x228901,_0x55c6e4,_0x3bc489,_0x2dca4d,_0x65759c));};AGIChannel['prototype'][_0x3448('0x44')]=function(_0x2a76ac,_0x54bb60){_0x54bb60=_0x54bb60||'';return this[_0x3448('0x22')](util[_0x3448('0x2a')](_0x3448('0x45'),_0x2a76ac,_0x54bb60));};AGIChannel['prototype']['agi']=function(_0x45ea0b){return this[_0x3448('0x2b')](_0x3448('0x46'),_0x45ea0b);};AGIChannel[_0x3448('0x21')]['wait']=function(_0x2d79a3){return this[_0x3448('0x2b')]('WAIT',_0x2d79a3);};AGIChannel[_0x3448('0x21')][_0x3448('0x16')]=function(_0x331177,_0x137bd6){this[_0x3448('0x28')](util[_0x3448('0x2a')]('ID:%s\x20-\x20LABEL:\x20%s\x20-\x20MSG:\x20%s',_0x331177['id'],_0x331177[_0x3448('0x47')],_0x137bd6));return{'code':0x1f4,'result':'-1','extra':''};};module[_0x3448('0x48')]=AGIChannel; \ No newline at end of file diff --git a/server/services/agi/error.js b/server/services/agi/error.js index e6c9351..2500aa9 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 _0xb613=['apply','message','name','exports','util','Undefined\x20error.','Server\x20closed.','[LICENSE]\x20Server\x20max\x20connection.\x20Count:\x20%s.','Socket\x20error.\x20Code:\x20%s.','Socket\x20closed.','Socket\x20timeout.','Empty\x20command.','Missing\x20\x27ivr.agi_network_script\x27.','Missing\x20\x27ivr.entry\x27\x20menu.','E_AGI_UNDEFINED','push','format'];(function(_0x2cb3da,_0x4c84c0){var _0x4c50c6=function(_0x46735b){while(--_0x46735b){_0x2cb3da['push'](_0x2cb3da['shift']());}};_0x4c50c6(++_0x4c84c0);}(_0xb613,0x9d));var _0x3b61=function(_0x2f87cd,_0xcaf299){_0x2f87cd=_0x2f87cd-0x0;var _0x5d7eda=_0xb613[_0x2f87cd];return _0x5d7eda;};'use strict';var util=require(_0x3b61('0x0'));var error={'E_AGI_UNDEFINED':_0x3b61('0x1'),'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':_0x3b61('0x2'),'E_AGI_SERVER_MAXCONNECTION':_0x3b61('0x3'),'E_AGI_SERVER_VOICE_DISABLED':'[LICENSE\x20VOICE]\x20Server\x20license\x20voice\x20disabled.','E_AGI_SOCKET_ERROR':_0x3b61('0x4'),'E_AGI_SOCKET_CLOSE':_0x3b61('0x5'),'E_AGI_SOCKET_TIMEOUT':_0x3b61('0x6'),'E_AGI_COMMAND_EMPTY':_0x3b61('0x7'),'E_AGI_IVR_AGI_NETWORK_SCRIPT':_0x3b61('0x8'),'E_AGI_IVR_ENTRY':_0x3b61('0x9')};function AGIError(_0x167261){var _0x167261=_0x167261||null,_0x3d3c71=_0x3d3c71||[],_0x4282e4=0x1,_0x2e0a08='';if(!error[_0x167261]){_0x167261=_0x3b61('0xa');}_0x3d3c71[_0x3b61('0xb')](error[_0x167261]);while(arguments[_0x4282e4]){_0x3d3c71[_0x3b61('0xb')](arguments[_0x4282e4]);_0x4282e4++;}_0x2e0a08=util[_0x3b61('0xc')][_0x3b61('0xd')](util,_0x3d3c71);this[_0x3b61('0xe')]=_0x2e0a08;this[_0x3b61('0xf')]=_0x167261;}module[_0x3b61('0x10')]=AGIError; \ No newline at end of file +var _0x8137=['apply','message','name','util','[LICENSE]\x20Server\x20max\x20connection.\x20Count:\x20%s.','[LICENSE\x20VOICE]\x20Server\x20license\x20voice\x20disabled.','Missing\x20\x27ivr.agi_network_script\x27.','Missing\x20\x27ivr.entry\x27\x20menu.','E_AGI_UNDEFINED'];(function(_0x5b784f,_0x541ec9){var _0x9ca401=function(_0x5af700){while(--_0x5af700){_0x5b784f['push'](_0x5b784f['shift']());}};_0x9ca401(++_0x541ec9);}(_0x8137,0x16b));var _0x7813=function(_0x5d6456,_0x58ecc7){_0x5d6456=_0x5d6456-0x0;var _0x4d66c1=_0x8137[_0x5d6456];return _0x4d66c1;};'use strict';var util=require(_0x7813('0x0'));var error={'E_AGI_UNDEFINED':'Undefined\x20error.','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':_0x7813('0x1'),'E_AGI_SERVER_VOICE_DISABLED':_0x7813('0x2'),'E_AGI_SOCKET_ERROR':'Socket\x20error.\x20Code:\x20%s.','E_AGI_SOCKET_CLOSE':'Socket\x20closed.','E_AGI_SOCKET_TIMEOUT':'Socket\x20timeout.','E_AGI_COMMAND_EMPTY':'Empty\x20command.','E_AGI_IVR_AGI_NETWORK_SCRIPT':_0x7813('0x3'),'E_AGI_IVR_ENTRY':_0x7813('0x4')};function AGIError(_0x2ec7d6){var _0x2ec7d6=_0x2ec7d6||null,_0x33022c=_0x33022c||[],_0x39f179=0x1,_0x3531d6='';if(!error[_0x2ec7d6]){_0x2ec7d6=_0x7813('0x5');}_0x33022c['push'](error[_0x2ec7d6]);while(arguments[_0x39f179]){_0x33022c['push'](arguments[_0x39f179]);_0x39f179++;}_0x3531d6=util['format'][_0x7813('0x6')](util,_0x33022c);this[_0x7813('0x7')]=_0x3531d6;this[_0x7813('0x8')]=_0x2ec7d6;}module['exports']=AGIError; \ No newline at end of file diff --git a/server/services/agi/graph/index.js b/server/services/agi/graph/index.js index c42ae22..c990888 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 _0x7d98=['agi','menu','getdigits','getsecretdigits','edges','numberOfEdges','addVertex','prototype','addEdge','push','size','vertices','relations','getVertex','traverseBFS','info','no\x20vertex\x20found','length','condition','split','agicommand','target','invalid','default\x20on\x20switch\x20not\x20found','includes','max\x20retry\x20reach','condition\x20not\x20found','exports','lodash'];(function(_0x1d3fd8,_0x396539){var _0x5b6fc4=function(_0xb41bb1){while(--_0xb41bb1){_0x1d3fd8['push'](_0x1d3fd8['shift']());}};_0x5b6fc4(++_0x396539);}(_0x7d98,0xe7));var _0x87d9=function(_0x1a0ef3,_0x535bbf){_0x1a0ef3=_0x1a0ef3-0x0;var _0x2b86da=_0x7d98[_0x1a0ef3];return _0x2b86da;};'use strict';var _=require(_0x87d9('0x0'));var logger=require('../../../config/logger')(_0x87d9('0x1'));var verticesWithRetry=[_0x87d9('0x2'),_0x87d9('0x3'),_0x87d9('0x4')];var Graph=function(){this['vertices']={};this[_0x87d9('0x5')]={};this[_0x87d9('0x6')]=0x0;};Graph['prototype'][_0x87d9('0x7')]=function(_0x589ad8){this['vertices'][_0x589ad8['id']]=_0x589ad8;this['edges'][_0x589ad8['id']]=[];};Graph[_0x87d9('0x8')][_0x87d9('0x9')]=function(_0x2dc542,_0x5f2693,_0x2aa885){this[_0x87d9('0x5')][_0x2dc542][_0x87d9('0xa')]({'target':_0x5f2693,'condition':_0x2aa885});this['numberOfEdges']+=0x1;};Graph[_0x87d9('0x8')][_0x87d9('0xb')]=function(){return _[_0x87d9('0xb')](this[_0x87d9('0xc')]);};Graph[_0x87d9('0x8')][_0x87d9('0xd')]=function(){return this[_0x87d9('0x6')];};Graph[_0x87d9('0x8')][_0x87d9('0xe')]=function(_0x36890e){return this[_0x87d9('0xc')][_0x36890e];};Graph[_0x87d9('0x8')][_0x87d9('0xf')]=function(_0x22758,_0x205b52){if(!this[_0x87d9('0xc')][_0x22758]){return logger[_0x87d9('0x10')](_0x87d9('0x11'));}var _0x380836=_0x205b52(this[_0x87d9('0xc')][_0x22758]);if(!_0x380836){return logger['info']('stop\x20traverse');}if(this[_0x87d9('0x5')][_0x22758][_0x87d9('0x12')]===0x0){return logger[_0x87d9('0x10')]('no\x20edge/s\x20available');}for(var _0x4c7997=0x0,_0x407c62=[],_0x109d61=![];_0x4c7997\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','LOOP\x20through\x20graph','traverseBFS','clear','VERTEX','gotoc','context','extension','priority','vresponse','response','isUndefined','result','toString','agicommand\x20not\x20found','finally','[FINALLY\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','[END]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','continueAt','Project\x20%s\x20not\x20published','Project\x20%s\x20not\x20found','getLicense','callysquare','[LICENSE]\x20CHANNELS:\x20%s','[LICENSE]\x20VOICE\x20IS\x20DISABLED','[LICENSE]','listening','connection','xml2json','syncho','util','moment','../../config/environment','../../config/logger','../../config/license/util','./mailRpc','./graph','./vertices','agi','defaults','127.0.0.1','nextTick','error','log','port','name','message','format','[ERROR]\x20%s','stack','info','[CLOSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','arg_1','calleridname','callerid','dnid','uniqueid','[TIMEOUT]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','[HANGUP]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','evtHangup','toJson','mxGraphModel','root','agicommand','hasOwnProperty','retry','maxRetry','addVertex','mxCell','length','source','target','addEdge'];(function(_0x10b67e,_0x440062){var _0x2d688a=function(_0x4e9982){while(--_0x4e9982){_0x10b67e['push'](_0x10b67e['shift']());}};_0x2d688a(++_0x440062);}(_0xc306,0x1a9));var _0x6c30=function(_0x2ff56a,_0x305966){_0x2ff56a=_0x2ff56a-0x0;var _0x18a66d=_0xc306[_0x2ff56a];return _0x18a66d;};'use strict';var parser=require(_0x6c30('0x0'));var _=require('lodash');var syncho=require(_0x6c30('0x1'));var util=require(_0x6c30('0x2'));var moment=require(_0x6c30('0x3'));var config=require(_0x6c30('0x4'));var logger=require(_0x6c30('0x5'))('agi');var utilLicense=require(_0x6c30('0x6'));var rpc=require('./rpc');var mailRpc=require(_0x6c30('0x7'));var Graph=require(_0x6c30('0x8'));var Vertices=require(_0x6c30('0x9'));var AGI_CODE_SUCCESS=0xc8;var AGI_RESULT_ERROR=-0x1;config[_0x6c30('0xa')]=_[_0x6c30('0xb')](config[_0x6c30('0xa')],{'ip':_0x6c30('0xc'),'port':0x11dd});function connectionHandler(_0x4e0017){process[_0x6c30('0xd')](function(){syncho(function(){try{setChannelVariables(_0x4e0017);agiHandler(_0x4e0017);}catch(_0x3f937a){logger[_0x6c30('0xe')](_0x3f937a['stack']);}});});}function listeningHandler(){console[_0x6c30('0xf')]('Cally\x20Square\x20server\x20listening\x20on\x20port\x20%d!',config['agi'][_0x6c30('0x10')]);logger['info'](util['format']('[LISTENING]\x20Cally\x20Square\x20listening\x20%s:%d',config[_0x6c30('0xa')]['ip'],config[_0x6c30('0xa')][_0x6c30('0x10')]));}function errorHandler(_0x4db908){if(_0x4db908&&_0x4db908[_0x6c30('0x11')]&&_0x4db908['message']){logger[_0x6c30('0xe')](util['format']('[%s]\x20%s',_0x4db908[_0x6c30('0x11')],_0x4db908[_0x6c30('0x12')]));}else{logger['error'](util[_0x6c30('0x13')](_0x6c30('0x14'),_0x4db908[_0x6c30('0x15')]));}}function closeHandler(){logger[_0x6c30('0x16')](util['format'](_0x6c30('0x17'),this[_0x6c30('0x18')],this[_0x6c30('0x19')],this[_0x6c30('0x1a')],this[_0x6c30('0x1b')],this[_0x6c30('0x1c')]));try{createSquareReport(this);}catch(_0x439581){logger[_0x6c30('0xe')](_0x439581[_0x6c30('0x15')]);}}function timeoutHandler(){logger[_0x6c30('0x16')](util['format'](_0x6c30('0x1d'),this[_0x6c30('0x18')],this[_0x6c30('0x19')],this[_0x6c30('0x1a')],this[_0x6c30('0x1b')],this['uniqueid']));}function hangupHandler(){logger[_0x6c30('0x16')](util[_0x6c30('0x13')](_0x6c30('0x1e'),this[_0x6c30('0x18')],this[_0x6c30('0x19')],this[_0x6c30('0x1a')],this['dnid'],this['uniqueid']));this[_0x6c30('0x1f')]=!![];}function getRoot(_0x4688fa){return parser[_0x6c30('0x20')](_0x4688fa,{'object':!![]})[_0x6c30('0x21')][_0x6c30('0x22')];}function addVertex(_0x34ddb6,_0x17c025,_0x726de6){_0x17c025[_0x6c30('0x23')]=_0x726de6;if(_0x17c025[_0x6c30('0x24')](_0x6c30('0x25'))){_0x17c025[_0x6c30('0x26')]=parseInt(_0x17c025[_0x6c30('0x25')],0xa);}_0x34ddb6[_0x6c30('0x27')](_['omit'](_0x17c025,_0x6c30('0x28')));}function initGraph(_0x1152f3,_0x56f3eb){var _0x190693=new Graph();for(var _0x6fc3f8 in _0x1152f3){if(_0x1152f3[_0x6c30('0x24')](_0x6fc3f8)){if(_['isArray'](_0x1152f3[_0x6fc3f8])){for(var _0x2706ae=0x0;_0x2706ae<_0x1152f3[_0x6fc3f8][_0x6c30('0x29')];_0x2706ae+=0x1){addVertex(_0x190693,_0x1152f3[_0x6fc3f8][_0x2706ae],_0x6fc3f8);}}else{addVertex(_0x190693,_0x1152f3[_0x6fc3f8],_0x6fc3f8);}}}for(var _0x3471dc=0x0;_0x3471dc<_0x56f3eb[_0x6c30('0x29')];_0x3471dc+=0x1){if(_0x56f3eb[_0x3471dc][_0x6c30('0x2a')]&&_0x56f3eb[_0x3471dc][_0x6c30('0x2b')]){_0x190693[_0x6c30('0x2c')](_0x56f3eb[_0x3471dc][_0x6c30('0x2a')],_0x56f3eb[_0x3471dc]['target'],_0x56f3eb[_0x3471dc][_0x6c30('0x2d')]);}}return _0x190693;}function getSquareProject(_0x2ff96a,_0x231ec0){rpc[_0x6c30('0x2e')](_0x2ff96a)['then'](function(_0x5b0990){_0x231ec0(null,_0x5b0990);})[_0x6c30('0x2f')](function(_0x53551f){_0x231ec0(null,_0x53551f);});}function createSquareReport(_0x29bc69,_0x428f61){rpc[_0x6c30('0x30')](_0x29bc69)[_0x6c30('0x31')](function(_0x2a14f7){if(_0x428f61){_0x428f61(null,_0x2a14f7);}})[_0x6c30('0x2f')](function(_0x16dd6f){if(_0x428f61){_0x428f61(null,_0x16dd6f);}});}function setChannelVariables(_0x27ddc4){for(var _0x4ec2a9 in _0x27ddc4){if(_0x27ddc4[_0x6c30('0x24')](_0x4ec2a9)){if(_0x4ec2a9[_0x6c30('0x32')]('agi_')===0x0){_0x27ddc4[_0x4ec2a9[_0x6c30('0x33')](0x4)]=_0x27ddc4[_0x4ec2a9];delete _0x27ddc4[_0x4ec2a9];}}}}function getLogFromObject(_0x1e9997){return util[_0x6c30('0x34')](_0x1e9997,{'showHidden':![],'depth':null});}function agiHandler(_0x4cf1c5){var _0x57153e,_0x11612c,_0x4c5a45,_0x5e852c,_0x5d1f3e;logger[_0x6c30('0x35')](_0x6c30('0x36'),JSON[_0x6c30('0x37')](_0x4cf1c5,null,0x2));logger[_0x6c30('0x16')](util[_0x6c30('0x13')]('[START]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',_0x4cf1c5['arg_1'],_0x4cf1c5[_0x6c30('0x19')],_0x4cf1c5['callerid'],_0x4cf1c5['dnid'],_0x4cf1c5[_0x6c30('0x1c')]));_0x4cf1c5['on'](_0x6c30('0xe'),errorHandler);_0x4cf1c5['on'](_0x6c30('0x38'),closeHandler);_0x4cf1c5['on'](_0x6c30('0x39'),timeoutHandler);_0x4cf1c5[_0x6c30('0x1f')]=![];_0x4cf1c5['on'](_0x6c30('0x3a'),hangupHandler);var _0x472664=getSquareProject[_0x6c30('0x3b')](null,_0x4cf1c5[_0x6c30('0x18')]);if(_0x472664){if(_0x472664[_0x6c30('0x3c')]){_0x57153e=getRoot(_0x472664[_0x6c30('0x3c')]);console[_0x6c30('0xf')](_0x6c30('0x3d'),_0x57153e);if(_0x57153e&&_0x57153e['start']){logger[_0x6c30('0x35')](_0x6c30('0x22'),JSON[_0x6c30('0x37')](_0x57153e,null,0x2));_0x4cf1c5[_0x6c30('0x3e')]=moment()[_0x6c30('0x13')](_0x6c30('0x3f'));_0x11612c=initGraph(_[_0x6c30('0x40')](_0x57153e,_0x6c30('0x28')),_0x57153e[_0x6c30('0x28')]);_0x4c5a45=new Vertices(_0x4cf1c5,rpc,mailRpc);console['log'](_0x6c30('0x41'),_0x4c5a45);logger[_0x6c30('0x16')](util[_0x6c30('0x13')](_0x6c30('0x42'),_0x4cf1c5[_0x6c30('0x18')],_0x4cf1c5['calleridname'],_0x4cf1c5[_0x6c30('0x1a')],_0x4cf1c5[_0x6c30('0x1b')],_0x4cf1c5[_0x6c30('0x1c')]));console[_0x6c30('0xf')](_0x6c30('0x43'));_0x11612c[_0x6c30('0x44')](_0x57153e['start']['id'],function(_0x3e29a1){try{_0x3e29a1=_0x4c5a45[_0x6c30('0x45')](_0x3e29a1);logger['debug']('vertex',JSON[_0x6c30('0x37')](_0x3e29a1,null,0x2));console[_0x6c30('0xf')](_0x6c30('0x46'),_0x3e29a1);if(_0x3e29a1[_0x6c30('0x23')]===_0x6c30('0x47')){logger[_0x6c30('0x16')]('gotoc\x20block\x20stop\x20traverse\x20BFS');_0x4cf1c5[_0x6c30('0x48')]=_0x3e29a1['context']||_0x4cf1c5[_0x6c30('0x48')];_0x4cf1c5[_0x6c30('0x49')]=_0x3e29a1[_0x6c30('0x49')];_0x4cf1c5['priority']=_0x3e29a1[_0x6c30('0x4a')]?_0x3e29a1[_0x6c30('0x4a')]-0x1:0x1;return null;}else if(_0x3e29a1&&_0x4c5a45[_0x3e29a1['agicommand']]){_0x5d1f3e=_0x4c5a45[_0x3e29a1[_0x6c30('0x23')]](_0x3e29a1);console[_0x6c30('0xf')](_0x6c30('0x4b'),_0x5d1f3e);logger['info'](_0x6c30('0x4c'),JSON['stringify'](_0x5d1f3e,null,0x2));if(_0x5d1f3e&&_0x5d1f3e['code']===AGI_CODE_SUCCESS&&_0x5d1f3e['result']!==AGI_RESULT_ERROR&&!_0x4cf1c5[_0x6c30('0x1f')]){logger[_0x6c30('0x35')](_0x6c30('0x4c'),getLogFromObject(_0x5d1f3e));return _[_0x6c30('0x4d')](_0x5d1f3e['result'])?null:_0x5d1f3e[_0x6c30('0x4e')][_0x6c30('0x4f')]();}else{logger[_0x6c30('0xe')](_0x6c30('0x4c'),getLogFromObject(_0x5d1f3e));return null;}}else{logger['error'](_0x6c30('0x50'));return null;}}catch(_0x20891a){logger[_0x6c30('0xe')](_0x20891a[_0x6c30('0x15')]);return null;}});if(_0x57153e[_0x6c30('0x51')]){logger[_0x6c30('0x16')](util['format'](_0x6c30('0x52'),_0x4cf1c5[_0x6c30('0x18')],_0x4cf1c5[_0x6c30('0x19')],_0x4cf1c5['callerid'],_0x4cf1c5['dnid'],_0x4cf1c5['uniqueid']));_0x11612c[_0x6c30('0x44')](_0x57153e[_0x6c30('0x51')]['id'],function(_0x1c02c2){try{_0x1c02c2=_0x4c5a45[_0x6c30('0x45')](_0x1c02c2);logger[_0x6c30('0x35')]('vertex',JSON[_0x6c30('0x37')](_0x1c02c2,null,0x2));if(_0x1c02c2&&_0x4c5a45[_0x1c02c2[_0x6c30('0x23')]]){_0x5d1f3e=_0x4c5a45[_0x1c02c2[_0x6c30('0x23')]](_0x1c02c2);if(_0x5d1f3e){logger[_0x6c30('0x35')](_0x6c30('0x4c'),getLogFromObject(_0x5d1f3e));return _[_0x6c30('0x4d')](_0x5d1f3e[_0x6c30('0x4e')])?null:_0x5d1f3e[_0x6c30('0x4e')][_0x6c30('0x4f')]();}else{logger[_0x6c30('0xe')](_0x6c30('0x4c'),getLogFromObject(_0x5d1f3e));return null;}}else{logger['error'](_0x6c30('0x50'));return null;}}catch(_0x29f9d0){logger[_0x6c30('0xe')](_0x29f9d0[_0x6c30('0x15')]);return null;}});}logger[_0x6c30('0x16')](util[_0x6c30('0x13')](_0x6c30('0x53'),_0x4cf1c5[_0x6c30('0x18')],_0x4cf1c5[_0x6c30('0x19')],_0x4cf1c5['callerid'],_0x4cf1c5[_0x6c30('0x1b')],_0x4cf1c5[_0x6c30('0x1c')]));logger['info'](util[_0x6c30('0x13')]('[GOTO]\x20context:\x20%s\x20extension:\x20%s\x20priority:\x20%s',_0x4cf1c5[_0x6c30('0x48')],_0x4cf1c5['extension'],parseInt(_0x4cf1c5[_0x6c30('0x4a')],0xa)+0x1));_0x4cf1c5[_0x6c30('0x54')](_0x4cf1c5[_0x6c30('0x48')],_0x4cf1c5[_0x6c30('0x49')],parseInt(_0x4cf1c5[_0x6c30('0x4a')],0xa)+0x1);_0x4cf1c5[_0x6c30('0x38')]();}}else{logger[_0x6c30('0xe')](util[_0x6c30('0x13')](_0x6c30('0x55'),_0x4cf1c5[_0x6c30('0x18')]));_0x4cf1c5[_0x6c30('0x54')](_0x4cf1c5['context'],_0x4cf1c5['extension'],parseInt(_0x4cf1c5['priority'],0xa)+0x1);_0x4cf1c5[_0x6c30('0x38')]();}}else{logger['error'](util['format'](_0x6c30('0x56'),_0x4cf1c5[_0x6c30('0x18')]));_0x4cf1c5[_0x6c30('0x54')](_0x4cf1c5[_0x6c30('0x48')],_0x4cf1c5[_0x6c30('0x49')],parseInt(_0x4cf1c5['priority'],0xa)+0x1);_0x4cf1c5[_0x6c30('0x38')]();}}function main(){var _0x5d7432;return utilLicense[_0x6c30('0x57')]()[_0x6c30('0x31')](function(_0x11df70){if(_0x11df70){if(_0x11df70['voice']){if(_0x11df70[_0x6c30('0x58')]&&_0x11df70[_0x6c30('0x58')]>0x0){logger[_0x6c30('0x16')](util[_0x6c30('0x13')](_0x6c30('0x59'),_0x11df70[_0x6c30('0x58')]));_0x5d7432=_0x11df70[_0x6c30('0x58')];}else{logger[_0x6c30('0x16')]('[LICENSE]\x20CHANNELS:\x20UNLIMITED');}}else{logger[_0x6c30('0x16')](_0x6c30('0x5a'));_0x5d7432=-0x1;}}})[_0x6c30('0x2f')](function(_0x33cbf8){logger[_0x6c30('0xe')](_0x6c30('0x5b'),_0x33cbf8['stack']);})['finally'](function(){var _0x115efb=require('./server')(config[_0x6c30('0xa')][_0x6c30('0x10')],config[_0x6c30('0xa')]['ip'],_0x5d7432);_0x115efb['on'](_0x6c30('0xe'),errorHandler);_0x115efb['on'](_0x6c30('0x5c'),listeningHandler);_0x115efb['on'](_0x6c30('0x5d'),connectionHandler);_0x115efb['on'](_0x6c30('0x38'),closeHandler);});}main(); \ No newline at end of file +var _0x8cde=['isUndefined','result','agicommand\x20not\x20found','finally','[FINALLY\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','toString','[END]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','[GOTO]\x20context:\x20%s\x20extension:\x20%s\x20priority:\x20%s','continueAt','Project\x20%s\x20not\x20published','Project\x20%s\x20not\x20found','getLicense','voice','callysquare','[LICENSE]\x20CHANNELS:\x20%s','[LICENSE]\x20VOICE\x20IS\x20DISABLED','./server','listening','connection','xml2json','util','agi','../../config/license/util','./graph','./vertices','defaults','nextTick','error','format','[LISTENING]\x20Cally\x20Square\x20listening\x20%s:%d','port','[%s]\x20%s','name','message','[ERROR]\x20%s','stack','info','[CLOSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','arg_1','calleridname','callerid','uniqueid','[TIMEOUT]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','dnid','[HANGUP]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','evtHangup','toJson','mxGraphModel','root','agicommand','hasOwnProperty','retry','maxRetry','addVertex','omit','mxCell','isArray','length','source','target','getSquareProject','then','catch','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','close','timeout','hangup','sync','production','log','SQUAREROOT','joinAt','LOOP\x20through\x20graph','traverseBFS','clear','vertex','gotoc','gotoc\x20block\x20stop\x20traverse\x20BFS','context','extension','priority','vresponse','response','code'];(function(_0x5447fd,_0x52a6b5){var _0x15b28a=function(_0x370d4f){while(--_0x370d4f){_0x5447fd['push'](_0x5447fd['shift']());}};_0x15b28a(++_0x52a6b5);}(_0x8cde,0x1d5));var _0xe8cd=function(_0x359bbe,_0x5b7fcc){_0x359bbe=_0x359bbe-0x0;var _0x1b3353=_0x8cde[_0x359bbe];return _0x1b3353;};'use strict';var parser=require(_0xe8cd('0x0'));var _=require('lodash');var syncho=require('syncho');var util=require(_0xe8cd('0x1'));var moment=require('moment');var config=require('../../config/environment');var logger=require('../../config/logger')(_0xe8cd('0x2'));var utilLicense=require(_0xe8cd('0x3'));var rpc=require('./rpc');var mailRpc=require('./mailRpc');var Graph=require(_0xe8cd('0x4'));var Vertices=require(_0xe8cd('0x5'));var AGI_CODE_SUCCESS=0xc8;var AGI_RESULT_ERROR=-0x1;config['agi']=_[_0xe8cd('0x6')](config['agi'],{'ip':'127.0.0.1','port':0x11dd});function connectionHandler(_0x444d83){process[_0xe8cd('0x7')](function(){syncho(function(){try{setChannelVariables(_0x444d83);agiHandler(_0x444d83);}catch(_0x473fac){logger[_0xe8cd('0x8')](_0x473fac['stack']);}});});}function listeningHandler(){console['log']('Cally\x20Square\x20server\x20listening\x20on\x20port\x20%d!',config['agi']['port']);logger['info'](util[_0xe8cd('0x9')](_0xe8cd('0xa'),config['agi']['ip'],config['agi'][_0xe8cd('0xb')]));}function errorHandler(_0x48d4c3){if(_0x48d4c3&&_0x48d4c3['name']&&_0x48d4c3['message']){logger[_0xe8cd('0x8')](util['format'](_0xe8cd('0xc'),_0x48d4c3[_0xe8cd('0xd')],_0x48d4c3[_0xe8cd('0xe')]));}else{logger[_0xe8cd('0x8')](util['format'](_0xe8cd('0xf'),_0x48d4c3[_0xe8cd('0x10')]));}}function closeHandler(){logger[_0xe8cd('0x11')](util[_0xe8cd('0x9')](_0xe8cd('0x12'),this[_0xe8cd('0x13')],this[_0xe8cd('0x14')],this[_0xe8cd('0x15')],this['dnid'],this[_0xe8cd('0x16')]));try{createSquareReport(this);}catch(_0x3c8350){logger[_0xe8cd('0x8')](_0x3c8350[_0xe8cd('0x10')]);}}function timeoutHandler(){logger[_0xe8cd('0x11')](util[_0xe8cd('0x9')](_0xe8cd('0x17'),this[_0xe8cd('0x13')],this[_0xe8cd('0x14')],this[_0xe8cd('0x15')],this[_0xe8cd('0x18')],this['uniqueid']));}function hangupHandler(){logger[_0xe8cd('0x11')](util[_0xe8cd('0x9')](_0xe8cd('0x19'),this[_0xe8cd('0x13')],this[_0xe8cd('0x14')],this[_0xe8cd('0x15')],this[_0xe8cd('0x18')],this[_0xe8cd('0x16')]));this[_0xe8cd('0x1a')]=!![];}function getRoot(_0x360611){return parser[_0xe8cd('0x1b')](_0x360611,{'object':!![]})[_0xe8cd('0x1c')][_0xe8cd('0x1d')];}function addVertex(_0x374858,_0x4ec01c,_0x15487e){_0x4ec01c[_0xe8cd('0x1e')]=_0x15487e;if(_0x4ec01c[_0xe8cd('0x1f')](_0xe8cd('0x20'))){_0x4ec01c[_0xe8cd('0x21')]=parseInt(_0x4ec01c[_0xe8cd('0x20')],0xa);}_0x374858[_0xe8cd('0x22')](_[_0xe8cd('0x23')](_0x4ec01c,_0xe8cd('0x24')));}function initGraph(_0x5aa818,_0x4f41f6){var _0x50d836=new Graph();for(var _0x1d6232 in _0x5aa818){if(_0x5aa818['hasOwnProperty'](_0x1d6232)){if(_[_0xe8cd('0x25')](_0x5aa818[_0x1d6232])){for(var _0x7284=0x0;_0x7284<_0x5aa818[_0x1d6232][_0xe8cd('0x26')];_0x7284+=0x1){addVertex(_0x50d836,_0x5aa818[_0x1d6232][_0x7284],_0x1d6232);}}else{addVertex(_0x50d836,_0x5aa818[_0x1d6232],_0x1d6232);}}}for(var _0x43b8af=0x0;_0x43b8af<_0x4f41f6[_0xe8cd('0x26')];_0x43b8af+=0x1){if(_0x4f41f6[_0x43b8af][_0xe8cd('0x27')]&&_0x4f41f6[_0x43b8af][_0xe8cd('0x28')]){_0x50d836['addEdge'](_0x4f41f6[_0x43b8af][_0xe8cd('0x27')],_0x4f41f6[_0x43b8af]['target'],_0x4f41f6[_0x43b8af]['value']);}}return _0x50d836;}function getSquareProject(_0x4fc2d2,_0x57edf5){rpc[_0xe8cd('0x29')](_0x4fc2d2)[_0xe8cd('0x2a')](function(_0x878364){_0x57edf5(null,_0x878364);})[_0xe8cd('0x2b')](function(_0x4b94fa){_0x57edf5(null,_0x4b94fa);});}function createSquareReport(_0x52f4f2,_0x181bbe){rpc['createSquareReport'](_0x52f4f2)[_0xe8cd('0x2a')](function(_0x51f3ba){if(_0x181bbe){_0x181bbe(null,_0x51f3ba);}})[_0xe8cd('0x2b')](function(_0x23d00e){if(_0x181bbe){_0x181bbe(null,_0x23d00e);}});}function setChannelVariables(_0x38488b){for(var _0xd40484 in _0x38488b){if(_0x38488b[_0xe8cd('0x1f')](_0xd40484)){if(_0xd40484[_0xe8cd('0x2c')]('agi_')===0x0){_0x38488b[_0xd40484[_0xe8cd('0x2d')](0x4)]=_0x38488b[_0xd40484];delete _0x38488b[_0xd40484];}}}}function getLogFromObject(_0x362130){return util[_0xe8cd('0x2e')](_0x362130,{'showHidden':![],'depth':null});}function agiHandler(_0x2d36ea){var _0x33c0d3,_0x55f147,_0x40d570,_0x55b6ce,_0x199401;logger[_0xe8cd('0x2f')](_0xe8cd('0x30'),JSON[_0xe8cd('0x31')](_0x2d36ea,null,0x2));logger[_0xe8cd('0x11')](util[_0xe8cd('0x9')](_0xe8cd('0x32'),_0x2d36ea['arg_1'],_0x2d36ea['calleridname'],_0x2d36ea['callerid'],_0x2d36ea['dnid'],_0x2d36ea['uniqueid']));_0x2d36ea['on'](_0xe8cd('0x8'),errorHandler);_0x2d36ea['on'](_0xe8cd('0x33'),closeHandler);_0x2d36ea['on'](_0xe8cd('0x34'),timeoutHandler);_0x2d36ea[_0xe8cd('0x1a')]=![];_0x2d36ea['on'](_0xe8cd('0x35'),hangupHandler);var _0x3f7deb=getSquareProject[_0xe8cd('0x36')](null,_0x2d36ea[_0xe8cd('0x13')]);if(_0x3f7deb){if(_0x3f7deb[_0xe8cd('0x37')]){_0x33c0d3=getRoot(_0x3f7deb[_0xe8cd('0x37')]);console[_0xe8cd('0x38')](_0xe8cd('0x39'),_0x33c0d3);if(_0x33c0d3&&_0x33c0d3['start']){logger['debug'](_0xe8cd('0x1d'),JSON['stringify'](_0x33c0d3,null,0x2));_0x2d36ea[_0xe8cd('0x3a')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x55f147=initGraph(_[_0xe8cd('0x23')](_0x33c0d3,_0xe8cd('0x24')),_0x33c0d3[_0xe8cd('0x24')]);_0x40d570=new Vertices(_0x2d36ea,rpc,mailRpc);console[_0xe8cd('0x38')]('vertices',_0x40d570);logger[_0xe8cd('0x11')](util[_0xe8cd('0x9')]('[START\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',_0x2d36ea[_0xe8cd('0x13')],_0x2d36ea[_0xe8cd('0x14')],_0x2d36ea['callerid'],_0x2d36ea['dnid'],_0x2d36ea['uniqueid']));console[_0xe8cd('0x38')](_0xe8cd('0x3b'));_0x55f147[_0xe8cd('0x3c')](_0x33c0d3['start']['id'],function(_0x4973d2){try{_0x4973d2=_0x40d570[_0xe8cd('0x3d')](_0x4973d2);logger[_0xe8cd('0x2f')](_0xe8cd('0x3e'),JSON[_0xe8cd('0x31')](_0x4973d2,null,0x2));console[_0xe8cd('0x38')]('VERTEX',_0x4973d2);if(_0x4973d2['agicommand']===_0xe8cd('0x3f')){logger['info'](_0xe8cd('0x40'));_0x2d36ea[_0xe8cd('0x41')]=_0x4973d2['context']||_0x2d36ea[_0xe8cd('0x41')];_0x2d36ea[_0xe8cd('0x42')]=_0x4973d2[_0xe8cd('0x42')];_0x2d36ea['priority']=_0x4973d2[_0xe8cd('0x43')]?_0x4973d2['priority']-0x1:0x1;return null;}else if(_0x4973d2&&_0x40d570[_0x4973d2[_0xe8cd('0x1e')]]){_0x199401=_0x40d570[_0x4973d2[_0xe8cd('0x1e')]](_0x4973d2);console[_0xe8cd('0x38')](_0xe8cd('0x44'),_0x199401);logger[_0xe8cd('0x11')](_0xe8cd('0x45'),JSON['stringify'](_0x199401,null,0x2));if(_0x199401&&_0x199401[_0xe8cd('0x46')]===AGI_CODE_SUCCESS&&_0x199401['result']!==AGI_RESULT_ERROR&&!_0x2d36ea[_0xe8cd('0x1a')]){logger[_0xe8cd('0x2f')]('response',getLogFromObject(_0x199401));return _[_0xe8cd('0x47')](_0x199401['result'])?null:_0x199401[_0xe8cd('0x48')]['toString']();}else{logger['error']('response',getLogFromObject(_0x199401));return null;}}else{logger[_0xe8cd('0x8')](_0xe8cd('0x49'));return null;}}catch(_0x3a69af){logger['error'](_0x3a69af[_0xe8cd('0x10')]);return null;}});if(_0x33c0d3[_0xe8cd('0x4a')]){logger[_0xe8cd('0x11')](util['format'](_0xe8cd('0x4b'),_0x2d36ea['arg_1'],_0x2d36ea[_0xe8cd('0x14')],_0x2d36ea[_0xe8cd('0x15')],_0x2d36ea[_0xe8cd('0x18')],_0x2d36ea[_0xe8cd('0x16')]));_0x55f147['traverseBFS'](_0x33c0d3[_0xe8cd('0x4a')]['id'],function(_0x1abccd){try{_0x1abccd=_0x40d570['clear'](_0x1abccd);logger[_0xe8cd('0x2f')]('vertex',JSON[_0xe8cd('0x31')](_0x1abccd,null,0x2));if(_0x1abccd&&_0x40d570[_0x1abccd[_0xe8cd('0x1e')]]){_0x199401=_0x40d570[_0x1abccd['agicommand']](_0x1abccd);if(_0x199401){logger[_0xe8cd('0x2f')](_0xe8cd('0x45'),getLogFromObject(_0x199401));return _[_0xe8cd('0x47')](_0x199401[_0xe8cd('0x48')])?null:_0x199401[_0xe8cd('0x48')][_0xe8cd('0x4c')]();}else{logger[_0xe8cd('0x8')](_0xe8cd('0x45'),getLogFromObject(_0x199401));return null;}}else{logger['error']('agicommand\x20not\x20found');return null;}}catch(_0x4db058){logger[_0xe8cd('0x8')](_0x4db058[_0xe8cd('0x10')]);return null;}});}logger[_0xe8cd('0x11')](util['format'](_0xe8cd('0x4d'),_0x2d36ea['arg_1'],_0x2d36ea[_0xe8cd('0x14')],_0x2d36ea[_0xe8cd('0x15')],_0x2d36ea[_0xe8cd('0x18')],_0x2d36ea[_0xe8cd('0x16')]));logger['info'](util[_0xe8cd('0x9')](_0xe8cd('0x4e'),_0x2d36ea[_0xe8cd('0x41')],_0x2d36ea[_0xe8cd('0x42')],parseInt(_0x2d36ea['priority'],0xa)+0x1));_0x2d36ea[_0xe8cd('0x4f')](_0x2d36ea['context'],_0x2d36ea[_0xe8cd('0x42')],parseInt(_0x2d36ea[_0xe8cd('0x43')],0xa)+0x1);_0x2d36ea[_0xe8cd('0x33')]();}}else{logger['error'](util[_0xe8cd('0x9')](_0xe8cd('0x50'),_0x2d36ea[_0xe8cd('0x13')]));_0x2d36ea[_0xe8cd('0x4f')](_0x2d36ea[_0xe8cd('0x41')],_0x2d36ea[_0xe8cd('0x42')],parseInt(_0x2d36ea[_0xe8cd('0x43')],0xa)+0x1);_0x2d36ea[_0xe8cd('0x33')]();}}else{logger[_0xe8cd('0x8')](util[_0xe8cd('0x9')](_0xe8cd('0x51'),_0x2d36ea[_0xe8cd('0x13')]));_0x2d36ea[_0xe8cd('0x4f')](_0x2d36ea[_0xe8cd('0x41')],_0x2d36ea[_0xe8cd('0x42')],parseInt(_0x2d36ea['priority'],0xa)+0x1);_0x2d36ea[_0xe8cd('0x33')]();}}function main(){var _0x51492c;return utilLicense[_0xe8cd('0x52')]()[_0xe8cd('0x2a')](function(_0x50785a){if(_0x50785a){if(_0x50785a[_0xe8cd('0x53')]){if(_0x50785a[_0xe8cd('0x54')]&&_0x50785a['callysquare']>0x0){logger[_0xe8cd('0x11')](util['format'](_0xe8cd('0x55'),_0x50785a[_0xe8cd('0x54')]));_0x51492c=_0x50785a['callysquare'];}else{logger[_0xe8cd('0x11')]('[LICENSE]\x20CHANNELS:\x20UNLIMITED');}}else{logger[_0xe8cd('0x11')](_0xe8cd('0x56'));_0x51492c=-0x1;}}})[_0xe8cd('0x2b')](function(_0xb2354e){logger[_0xe8cd('0x8')]('[LICENSE]',_0xb2354e[_0xe8cd('0x10')]);})['finally'](function(){var _0x588c50=require(_0xe8cd('0x57'))(config[_0xe8cd('0x2')]['port'],config[_0xe8cd('0x2')]['ip'],_0x51492c);_0x588c50['on'](_0xe8cd('0x8'),errorHandler);_0x588c50['on'](_0xe8cd('0x58'),listeningHandler);_0x588c50['on'](_0xe8cd('0x59'),connectionHandler);_0x588c50['on'](_0xe8cd('0x33'),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 3ec557d..1422b58 100644 --- a/server/services/agi/mailRpc/index.js +++ b/server/services/agi/mailRpc/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['result','catch','sendMailMessage','SendMail','bluebird','jayson/promise','client','http','request','error','message'];(function(_0x59a19f,_0x180d37){var _0x22418b=function(_0xb17b8b){while(--_0xb17b8b){_0x59a19f['push'](_0x59a19f['shift']());}};_0x22418b(++_0x180d37);}(_0x9957,0x93));var _0x7995=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0x9957[_0x6c993a];return _0x27f547;};'use strict';var BPromise=require(_0x7995('0x0'));var jayson=require(_0x7995('0x1'));var client=jayson[_0x7995('0x2')][_0x7995('0x3')]({'port':0x232b});function request(_0x5b96eb,_0x86c128){return new BPromise(function(_0x3c58eb,_0x1902b4){return client[_0x7995('0x4')](_0x5b96eb,_0x86c128)['then'](function(_0x744bea){if(_0x744bea[_0x7995('0x5')]){return _0x1902b4(_0x744bea[_0x7995('0x5')][_0x7995('0x6')]);}else{return _0x3c58eb(_0x744bea[_0x7995('0x7')]);}})[_0x7995('0x8')](function(_0x4996ca){return _0x1902b4(_0x4996ca);});});}exports[_0x7995('0x9')]=function(_0x1cad37,_0x4a64f7){return request(_0x7995('0xa'),{'account':_0x1cad37,'message':_0x4a64f7});}; \ No newline at end of file +var _0x814b=['bluebird','jayson/promise','client','http','request','then','error','result','catch','sendMailMessage','SendMail'];(function(_0x5db3dd,_0x15091a){var _0x3f20bf=function(_0x543b48){while(--_0x543b48){_0x5db3dd['push'](_0x5db3dd['shift']());}};_0x3f20bf(++_0x15091a);}(_0x814b,0x1a2));var _0xb814=function(_0x250f95,_0x5a5728){_0x250f95=_0x250f95-0x0;var _0x4ada97=_0x814b[_0x250f95];return _0x4ada97;};'use strict';var BPromise=require(_0xb814('0x0'));var jayson=require(_0xb814('0x1'));var client=jayson[_0xb814('0x2')][_0xb814('0x3')]({'port':0x232b});function request(_0xfbb64b,_0x477725){return new BPromise(function(_0x4a98af,_0x38c21a){return client[_0xb814('0x4')](_0xfbb64b,_0x477725)[_0xb814('0x5')](function(_0x4237bc){if(_0x4237bc[_0xb814('0x6')]){return _0x38c21a(_0x4237bc[_0xb814('0x6')]['message']);}else{return _0x4a98af(_0x4237bc[_0xb814('0x7')]);}})[_0xb814('0x8')](function(_0x5c8539){return _0x38c21a(_0x5c8539);});});}exports[_0xb814('0x9')]=function(_0x2913a6,_0x186d5a){return request(_0xb814('0xa'),{'account':_0x2913a6,'message':_0x186d5a});}; \ No newline at end of file diff --git a/server/services/agi/reply.js b/server/services/agi/reply.js index 975d025..d19f664 100644 --- a/server/services/agi/reply.js +++ b/server/services/agi/reply.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5f2f=['exports','util','stream','Transform','call','_localBuffer','_inBody','inherits','\x0d\x0a\x0d\x0a','toString','substring','length','split','slice','trim','headers','indexOf','emit','line'];(function(_0x919445,_0x5467dc){var _0x511b3e=function(_0xde10f3){while(--_0xde10f3){_0x919445['push'](_0x919445['shift']());}};_0x511b3e(++_0x5467dc);}(_0x5f2f,0x73));var _0xf5f2=function(_0x2fca8a,_0x321893){_0x2fca8a=_0x2fca8a-0x0;var _0xe6cada=_0x5f2f[_0x2fca8a];return _0xe6cada;};'use strict';var util=require(_0xf5f2('0x0'));var Transform=require(_0xf5f2('0x1'))[_0xf5f2('0x2')];function AGIReply(_0x1a7be1){Transform[_0xf5f2('0x3')](this,_0x1a7be1);this[_0xf5f2('0x4')]='';this[_0xf5f2('0x5')]=![];}util[_0xf5f2('0x6')](AGIReply,Transform);AGIReply['prototype']['_transform']=function(_0x1665c7,_0x192215,_0xad7f65){var _0x3eebf6='\x0a',_0x3133bc=['\x0a\x0a',_0xf5f2('0x7')],_0x473100=-0x1,_0x5907aa=-0x1,_0x466882='',_0x46cd9c=0x0,_0x2ec345='',_0x56a69f='';this[_0xf5f2('0x4')]+=_0x1665c7[_0xf5f2('0x8')]();_0x2ec345=this['_localBuffer'];if(!this[_0xf5f2('0x5')]){_0x46cd9c=0x0;while(_0x3133bc[_0x46cd9c]){while((_0x5907aa=_0x2ec345['indexOf'](_0x3133bc[_0x46cd9c]))!=-0x1){_0x466882=_0x3133bc[_0x46cd9c];_0x56a69f=_0x2ec345['substring'](0x0,_0x5907aa);_0x2ec345=_0x2ec345[_0xf5f2('0x9')](_0x5907aa+_0x466882[_0xf5f2('0xa')]);var _0x4b78cd=_0x56a69f[_0xf5f2('0xb')](_0x3eebf6),_0x336f6b=0x0,_0x14b51f={},_0x331482='',_0x3f2997='',_0x59bb6c=-0x1;while(_0x4b78cd[_0x336f6b]){_0x59bb6c=_0x4b78cd[_0x336f6b]['indexOf'](':');if(_0x59bb6c!=-0x1){_0x331482=_0x4b78cd[_0x336f6b][_0xf5f2('0xc')](0x0,_0x59bb6c)[_0xf5f2('0xd')]();_0x3f2997=_0x4b78cd[_0x336f6b][_0xf5f2('0xc')](_0x59bb6c+0x1)[_0xf5f2('0xd')]();if(_0x331482[_0xf5f2('0xa')]>0x0){_0x14b51f[_0x331482]=_0x3f2997;}}else{}_0x336f6b++;}this['emit'](_0xf5f2('0xe'),_0x14b51f);this[_0xf5f2('0x5')]=!![];}_0x46cd9c++;}this[_0xf5f2('0x4')]=_0x2ec345;}else{while((_0x473100=_0x2ec345[_0xf5f2('0xf')](_0x3eebf6))!=-0x1){_0x56a69f=_0x2ec345[_0xf5f2('0x9')](0x0,_0x473100);this[_0xf5f2('0x10')](_0xf5f2('0x11'),_0x56a69f);_0x2ec345=_0x2ec345[_0xf5f2('0x9')](_0x473100+_0x3eebf6[_0xf5f2('0xa')]);}this[_0xf5f2('0x4')]=_0x2ec345;}_0xad7f65();};module[_0xf5f2('0x12')]=AGIReply; \ No newline at end of file +var _0x5f2f=['exports','util','stream','Transform','call','_localBuffer','_inBody','inherits','\x0d\x0a\x0d\x0a','toString','substring','length','split','slice','trim','headers','indexOf','emit','line'];(function(_0x299d67,_0x52c048){var _0xb8027b=function(_0x47543d){while(--_0x47543d){_0x299d67['push'](_0x299d67['shift']());}};_0xb8027b(++_0x52c048);}(_0x5f2f,0x73));var _0xf5f2=function(_0x2e0ce0,_0x1f23eb){_0x2e0ce0=_0x2e0ce0-0x0;var _0x2f3dd7=_0x5f2f[_0x2e0ce0];return _0x2f3dd7;};'use strict';var util=require(_0xf5f2('0x0'));var Transform=require(_0xf5f2('0x1'))[_0xf5f2('0x2')];function AGIReply(_0x1a7be1){Transform[_0xf5f2('0x3')](this,_0x1a7be1);this[_0xf5f2('0x4')]='';this[_0xf5f2('0x5')]=![];}util[_0xf5f2('0x6')](AGIReply,Transform);AGIReply['prototype']['_transform']=function(_0x1665c7,_0x192215,_0xad7f65){var _0x3eebf6='\x0a',_0x3133bc=['\x0a\x0a',_0xf5f2('0x7')],_0x473100=-0x1,_0x5907aa=-0x1,_0x466882='',_0x46cd9c=0x0,_0x2ec345='',_0x56a69f='';this[_0xf5f2('0x4')]+=_0x1665c7[_0xf5f2('0x8')]();_0x2ec345=this['_localBuffer'];if(!this[_0xf5f2('0x5')]){_0x46cd9c=0x0;while(_0x3133bc[_0x46cd9c]){while((_0x5907aa=_0x2ec345['indexOf'](_0x3133bc[_0x46cd9c]))!=-0x1){_0x466882=_0x3133bc[_0x46cd9c];_0x56a69f=_0x2ec345['substring'](0x0,_0x5907aa);_0x2ec345=_0x2ec345[_0xf5f2('0x9')](_0x5907aa+_0x466882[_0xf5f2('0xa')]);var _0x4b78cd=_0x56a69f[_0xf5f2('0xb')](_0x3eebf6),_0x336f6b=0x0,_0x14b51f={},_0x331482='',_0x3f2997='',_0x59bb6c=-0x1;while(_0x4b78cd[_0x336f6b]){_0x59bb6c=_0x4b78cd[_0x336f6b]['indexOf'](':');if(_0x59bb6c!=-0x1){_0x331482=_0x4b78cd[_0x336f6b][_0xf5f2('0xc')](0x0,_0x59bb6c)[_0xf5f2('0xd')]();_0x3f2997=_0x4b78cd[_0x336f6b][_0xf5f2('0xc')](_0x59bb6c+0x1)[_0xf5f2('0xd')]();if(_0x331482[_0xf5f2('0xa')]>0x0){_0x14b51f[_0x331482]=_0x3f2997;}}else{}_0x336f6b++;}this['emit'](_0xf5f2('0xe'),_0x14b51f);this[_0xf5f2('0x5')]=!![];}_0x46cd9c++;}this[_0xf5f2('0x4')]=_0x2ec345;}else{while((_0x473100=_0x2ec345[_0xf5f2('0xf')](_0x3eebf6))!=-0x1){_0x56a69f=_0x2ec345[_0xf5f2('0x9')](0x0,_0x473100);this[_0xf5f2('0x10')](_0xf5f2('0x11'),_0x56a69f);_0x2ec345=_0x2ec345[_0xf5f2('0x9')](_0x473100+_0x3eebf6[_0xf5f2('0xa')]);}this[_0xf5f2('0x4')]=_0x2ec345;}_0xad7f65();};module[_0xf5f2('0x12')]=AGIReply; \ No newline at end of file diff --git a/server/services/agi/rpc/index.js b/server/services/agi/rpc/index.js index eb28809..a23ed0e 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 _0xfc4e=['ShowMailAccount','MailServerOut','Smtp','name','getSquareProjectById','getVoiceQueueById','getVariableById','ShowVariable','getSquareOdbcById','ShowSquareOdbc','getUserById','ShowUser','getContactByPhone','log','rpcreq','GetContactByPhone','getTrunkById','ShowTrunk','getSoundById','ShowSound','save_name','Interval','Intervals','getSmsAccountById','createSmsMessage','CreateSmsMessage','CreateSquareDetailsReport','createSquareReport','CreateSquareReport','merge','arg_2','format','YYYY-MM-DD\x20HH:mm:ss','createSquareRecording','CreateSquareRecording','CreateSquareMessage','ShowCmHopper','ListId','CreateCmContact','ShowPause','LoginUser','agentPause','PauseUser','agentLogout','LogoutUser','moment','lodash','jayson/promise','client','request','then','error','message','result','catch','getSquareProject','ShowSquareProject','production'];(function(_0x540de6,_0x594803){var _0x1df335=function(_0x30b552){while(--_0x30b552){_0x540de6['push'](_0x540de6['shift']());}};_0x1df335(++_0x594803);}(_0xfc4e,0x67));var _0xefc4=function(_0x1d1779,_0x284147){_0x1d1779=_0x1d1779-0x0;var _0x2377e9=_0xfc4e[_0x1d1779];return _0x2377e9;};'use strict';var BPromise=require('bluebird');var moment=require(_0xefc4('0x0'));var _=require(_0xefc4('0x1'));var util=require('util');var jayson=require(_0xefc4('0x2'));var client=jayson[_0xefc4('0x3')]['http']({'port':0x2329});function request(_0x5f14ef,_0x3888a8){return new BPromise(function(_0x430a67,_0x2af421){return client[_0xefc4('0x4')](_0x5f14ef,_0x3888a8)[_0xefc4('0x5')](function(_0x218dde){if(_0x218dde[_0xefc4('0x6')]){return _0x2af421(_0x218dde['error'][_0xefc4('0x7')]);}else{return _0x430a67(_0x218dde[_0xefc4('0x8')]);}})[_0xefc4('0x9')](function(_0x42280d){return _0x2af421(_0x42280d);});});}exports[_0xefc4('0xa')]=function(_0x417aaf){return request(_0xefc4('0xb'),{'options':{'raw':![],'where':{'name':_0x417aaf},'attributes':[_0xefc4('0xc')]}});};exports['getMailAccountById']=function(_0x6cd01a){return request(_0xefc4('0xd'),{'options':{'raw':![],'where':{'id':_0x6cd01a},'include':[{'model':_0xefc4('0xe'),'as':_0xefc4('0xf')}],'attributes':['id',_0xefc4('0x10'),'email']}});};exports[_0xefc4('0x11')]=function(_0x4c7b07){return request(_0xefc4('0xb'),{'options':{'where':{'id':_0x4c7b07},'attributes':[_0xefc4('0x10')]}});};exports[_0xefc4('0x12')]=function(_0x5e74e8){return request('ShowVoiceQueue',{'options':{'where':{'id':_0x5e74e8},'attributes':['name']}});};exports[_0xefc4('0x13')]=function(_0x25db4b){return request(_0xefc4('0x14'),{'options':{'where':{'id':_0x25db4b},'attributes':[_0xefc4('0x10')]}});};exports[_0xefc4('0x15')]=function(_0x2fc301){return request(_0xefc4('0x16'),{'options':{'where':{'id':_0x2fc301},'attributes':['dsn']}});};exports[_0xefc4('0x17')]=function(_0x5e9ffb){return request(_0xefc4('0x18'),{'options':{'where':{'id':_0x5e9ffb},'attributes':['name']}});};exports[_0xefc4('0x19')]=function(_0x21169a){console[_0xefc4('0x1a')](_0xefc4('0x1b'),_0x21169a);return request(_0xefc4('0x1c'),{'options':{'where':{'phone':_0x21169a},'attributes':['id']}});};exports[_0xefc4('0x1d')]=function(_0x1af760){return request(_0xefc4('0x1e'),{'options':{'where':{'id':_0x1af760},'attributes':[_0xefc4('0x10')]}});};exports[_0xefc4('0x1f')]=function(_0x3cca2c){return request(_0xefc4('0x20'),{'options':{'where':{'id':_0x3cca2c},'attributes':[_0xefc4('0x21')]}});};exports['getIntervalById']=function(_0x26d8ff){return request('ShowInterval',{'options':{'raw':![],'where':{'id':_0x26d8ff},'include':[{'model':_0xefc4('0x22'),'as':_0xefc4('0x23')}]}});};exports[_0xefc4('0x24')]=function(_0x5bb17b){return request('ShowSmsAccount',{'options':{'where':{'id':_0x5bb17b},'attributes':['id',_0xefc4('0x10')]}});};exports[_0xefc4('0x25')]=function(_0xdeea64){return request(_0xefc4('0x26'),{'body':_0xdeea64});};exports['createSquareDetailsReport']=function(_0x1af5fc){return request(_0xefc4('0x27'),{'body':_0x1af5fc});};exports[_0xefc4('0x28')]=function(_0x13838b){return request(_0xefc4('0x29'),{'body':_[_0xefc4('0x2a')](_0x13838b,{'project_name':_0x13838b['arg_1'],'prev_project_name':_0x13838b[_0xefc4('0x2b')]||'','is_subproject':_0x13838b[_0xefc4('0x2b')]?!![]:![],'leaveAt':moment()[_0xefc4('0x2c')](_0xefc4('0x2d'))})});};exports[_0xefc4('0x2e')]=function(_0x2d4538){return request(_0xefc4('0x2f'),{'body':_0x2d4538});};exports['createSquareMessage']=function(_0x55b19f){return request(_0xefc4('0x30'),{'body':_0x55b19f});};exports['createCmContact']=function(_0x4b430c){return request(_0xefc4('0x31'),{'options':{'raw':![],'where':{'phone':_0x4b430c['phone'],'ListId':_0x4b430c[_0xefc4('0x32')]}}})[_0xefc4('0x5')](function(_0x1ea3c8){if(_0x1ea3c8){return _0x1ea3c8;}return request(_0xefc4('0x33'),{'body':_0x4b430c});});};exports['getPauseById']=function(_0x1a5863){return request(_0xefc4('0x34'),{'options':{'where':{'id':_0x1a5863},'attributes':[_0xefc4('0x10')]}});};exports['agentLogin']=function(_0x3f0096,_0x5dc910){return request(_0xefc4('0x35'),{'body':{'interface':_0x5dc910},'options':{'where':_0x3f0096}});};exports[_0xefc4('0x36')]=function(_0x494ca1,_0x1e22f5,_0x18479f){return request(_0xefc4('0x37'),{'body':{'type':_0x1e22f5,'uniqueid':_0x18479f},'options':{'where':_0x494ca1}});};exports['agentUnpause']=function(_0x5d395f){return request('UnpauseUser',{'body':{},'options':{'where':_0x5d395f}});};exports[_0xefc4('0x38')]=function(_0x2e57d0){return request(_0xefc4('0x39'),{'body':{},'options':{'where':_0x2e57d0}});}; \ No newline at end of file +var _0x7825=['createCmContact','ShowCmHopper','ListId','CreateCmContact','getPauseById','ShowPause','LoginUser','agentPause','PauseUser','agentUnpause','UnpauseUser','agentLogout','bluebird','moment','util','jayson/promise','client','then','error','message','catch','getSquareProject','getMailAccountById','MailServerOut','Smtp','name','email','ShowSquareProject','ShowVoiceQueue','getVariableById','ShowVariable','ShowSquareOdbc','dsn','ShowUser','getContactByPhone','getTrunkById','getSoundById','save_name','getIntervalById','ShowInterval','Interval','Intervals','ShowSmsAccount','createSmsMessage','CreateSmsMessage','CreateSquareReport','merge','arg_1','arg_2','format','YYYY-MM-DD\x20HH:mm:ss','createSquareRecording','CreateSquareRecording','createSquareMessage','CreateSquareMessage'];(function(_0x6ece45,_0x296347){var _0x410be4=function(_0x3d0314){while(--_0x3d0314){_0x6ece45['push'](_0x6ece45['shift']());}};_0x410be4(++_0x296347);}(_0x7825,0x7a));var _0x5782=function(_0x30eab3,_0x5abc1c){_0x30eab3=_0x30eab3-0x0;var _0x1ef923=_0x7825[_0x30eab3];return _0x1ef923;};'use strict';var BPromise=require(_0x5782('0x0'));var moment=require(_0x5782('0x1'));var _=require('lodash');var util=require(_0x5782('0x2'));var jayson=require(_0x5782('0x3'));var client=jayson[_0x5782('0x4')]['http']({'port':0x2329});function request(_0x56d935,_0x2da41e){return new BPromise(function(_0x44a639,_0x4c51b6){return client['request'](_0x56d935,_0x2da41e)[_0x5782('0x5')](function(_0x37293c){if(_0x37293c['error']){return _0x4c51b6(_0x37293c[_0x5782('0x6')][_0x5782('0x7')]);}else{return _0x44a639(_0x37293c['result']);}})[_0x5782('0x8')](function(_0x16a95e){return _0x4c51b6(_0x16a95e);});});}exports[_0x5782('0x9')]=function(_0x265476){return request('ShowSquareProject',{'options':{'raw':![],'where':{'name':_0x265476},'attributes':['production']}});};exports[_0x5782('0xa')]=function(_0x2071b8){return request('ShowMailAccount',{'options':{'raw':![],'where':{'id':_0x2071b8},'include':[{'model':_0x5782('0xb'),'as':_0x5782('0xc')}],'attributes':['id',_0x5782('0xd'),_0x5782('0xe')]}});};exports['getSquareProjectById']=function(_0x4b5c06){return request(_0x5782('0xf'),{'options':{'where':{'id':_0x4b5c06},'attributes':['name']}});};exports['getVoiceQueueById']=function(_0xd3eaa4){return request(_0x5782('0x10'),{'options':{'where':{'id':_0xd3eaa4},'attributes':['name']}});};exports[_0x5782('0x11')]=function(_0x43ac44){return request(_0x5782('0x12'),{'options':{'where':{'id':_0x43ac44},'attributes':[_0x5782('0xd')]}});};exports['getSquareOdbcById']=function(_0x118138){return request(_0x5782('0x13'),{'options':{'where':{'id':_0x118138},'attributes':[_0x5782('0x14')]}});};exports['getUserById']=function(_0x339532){return request(_0x5782('0x15'),{'options':{'where':{'id':_0x339532},'attributes':[_0x5782('0xd')]}});};exports[_0x5782('0x16')]=function(_0x36783d){console['log']('rpcreq',_0x36783d);return request('GetContactByPhone',{'options':{'where':{'phone':_0x36783d},'attributes':['id']}});};exports[_0x5782('0x17')]=function(_0x1385e4){return request('ShowTrunk',{'options':{'where':{'id':_0x1385e4},'attributes':['name']}});};exports[_0x5782('0x18')]=function(_0x220222){return request('ShowSound',{'options':{'where':{'id':_0x220222},'attributes':[_0x5782('0x19')]}});};exports[_0x5782('0x1a')]=function(_0x65a4eb){return request(_0x5782('0x1b'),{'options':{'raw':![],'where':{'id':_0x65a4eb},'include':[{'model':_0x5782('0x1c'),'as':_0x5782('0x1d')}]}});};exports['getSmsAccountById']=function(_0x4cbf17){return request(_0x5782('0x1e'),{'options':{'where':{'id':_0x4cbf17},'attributes':['id',_0x5782('0xd')]}});};exports[_0x5782('0x1f')]=function(_0x192947){return request(_0x5782('0x20'),{'body':_0x192947});};exports['createSquareDetailsReport']=function(_0x537d3e){return request('CreateSquareDetailsReport',{'body':_0x537d3e});};exports['createSquareReport']=function(_0x3eb771){return request(_0x5782('0x21'),{'body':_[_0x5782('0x22')](_0x3eb771,{'project_name':_0x3eb771[_0x5782('0x23')],'prev_project_name':_0x3eb771[_0x5782('0x24')]||'','is_subproject':_0x3eb771[_0x5782('0x24')]?!![]:![],'leaveAt':moment()[_0x5782('0x25')](_0x5782('0x26'))})});};exports[_0x5782('0x27')]=function(_0x4b8717){return request(_0x5782('0x28'),{'body':_0x4b8717});};exports[_0x5782('0x29')]=function(_0x3a36d4){return request(_0x5782('0x2a'),{'body':_0x3a36d4});};exports[_0x5782('0x2b')]=function(_0x3fa959){return request(_0x5782('0x2c'),{'options':{'raw':![],'where':{'phone':_0x3fa959['phone'],'ListId':_0x3fa959[_0x5782('0x2d')]}}})[_0x5782('0x5')](function(_0x486a7f){if(_0x486a7f){return _0x486a7f;}return request(_0x5782('0x2e'),{'body':_0x3fa959});});};exports[_0x5782('0x2f')]=function(_0x2ecb4f){return request(_0x5782('0x30'),{'options':{'where':{'id':_0x2ecb4f},'attributes':[_0x5782('0xd')]}});};exports['agentLogin']=function(_0xf574f2,_0x38ae0e){return request(_0x5782('0x31'),{'body':{'interface':_0x38ae0e},'options':{'where':_0xf574f2}});};exports[_0x5782('0x32')]=function(_0x5d750b,_0x465f72,_0x22a49e){return request(_0x5782('0x33'),{'body':{'type':_0x465f72,'uniqueid':_0x22a49e},'options':{'where':_0x5d750b}});};exports[_0x5782('0x34')]=function(_0x4c5544){return request(_0x5782('0x35'),{'body':{},'options':{'where':_0x4c5544}});};exports[_0x5782('0x36')]=function(_0x4b187c){return request('LogoutUser',{'body':{},'options':{'where':_0x4b187c}});}; \ 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 6e7ead8..ad6ccc1 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 _0x0ba7=['exports','./polly'];(function(_0x12a3ee,_0x492ca0){var _0x263f16=function(_0x4f28e8){while(--_0x4f28e8){_0x12a3ee['push'](_0x12a3ee['shift']());}};_0x263f16(++_0x492ca0);}(_0x0ba7,0x16d));var _0x70ba=function(_0x50081a,_0x5968dc){_0x50081a=_0x50081a-0x0;var _0x3be578=_0x0ba7[_0x50081a];return _0x3be578;};var polly=require(_0x70ba('0x0'));var lex=require('./lex');module[_0x70ba('0x1')]={'polly':polly,'lex':lex}; \ No newline at end of file +var _0x9f62=['./lex'];(function(_0x170a36,_0x3894aa){var _0x8fcff1=function(_0x3c3ebd){while(--_0x3c3ebd){_0x170a36['push'](_0x170a36['shift']());}};_0x8fcff1(++_0x3894aa);}(_0x9f62,0x154));var _0x29f6=function(_0x158bf9,_0x2a2731){_0x158bf9=_0x158bf9-0x0;var _0x2baad0=_0x9f62[_0x158bf9];return _0x2baad0;};var polly=require('./polly');var lex=require(_0x29f6('0x0'));module['exports']={'polly':polly,'lex':lex}; \ No newline at end of file diff --git a/server/services/agi/scripts/aws/lex/index.js b/server/services/agi/scripts/aws/lex/index.js index dddd11c..5d9137c 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 _0xde9d=['./lib/api','exports'];(function(_0x1e746c,_0x372d4c){var _0x17d8e2=function(_0x20039d){while(--_0x20039d){_0x1e746c['push'](_0x1e746c['shift']());}};_0x17d8e2(++_0x372d4c);}(_0xde9d,0x156));var _0xdde9=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xde9d[_0xa464c9];return _0x3d73c4;};'use strict';var lex=require(_0xdde9('0x0'));module[_0xdde9('0x1')]=function(_0x207feb,_0x4013c5,_0x20ab4a,_0x49fbbe,_0x2a7fa7,_0x28cc44){return lex(_0x207feb,_0x4013c5,_0x20ab4a,_0x49fbbe,_0x2a7fa7,_0x28cc44);}; \ No newline at end of file +'use strict';var lex=require('./lib/api');module['exports']=function(_0x1c27bb,_0x4a4906,_0x3f643d,_0x306b6e,_0x2221f1,_0x10d2c4){return lex(_0x1c27bb,_0x4a4906,_0x3f643d,_0x306b6e,_0x2221f1,_0x10d2c4);}; \ 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 ce0bb11..695fe45 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 _0x6bcf=['$LATEST','bluebird','aws-sdk','slots','slot_','exports','LexRuntime'];(function(_0x4a90df,_0x23954a){var _0x115f05=function(_0x36eb97){while(--_0x36eb97){_0x4a90df['push'](_0x4a90df['shift']());}};_0x115f05(++_0x23954a);}(_0x6bcf,0xb7));var _0xf6bc=function(_0x4173d0,_0x3d5eff){_0x4173d0=_0x4173d0-0x0;var _0xaee602=_0x6bcf[_0x4173d0];return _0xaee602;};'use strict';var BPromise=require(_0xf6bc('0x0'));var AWS=require(_0xf6bc('0x1'));function lexResult(_0xdebb85,_0x41019e){return new BPromise(function(_0x13b4ff,_0x5d1424){_0xdebb85['postText'](_0x41019e,function(_0x87b9b9,_0x422b09){if(_0x87b9b9){_0x5d1424(_0x87b9b9);}if(_0x422b09[_0xf6bc('0x2')]){for(const _0x45d0fd in _0x422b09['slots']){if(_0x422b09['slots']['hasOwnProperty'](_0x45d0fd)){var _0x2756f9=_0x422b09[_0xf6bc('0x2')][_0x45d0fd];_0x422b09[_0xf6bc('0x3')+_0x45d0fd]=_0x2756f9;}}}_0x13b4ff(_0x422b09);});});}module[_0xf6bc('0x4')]=function(_0x5f0c00,_0xeb9ff5,_0x567f51,_0x42fc1c,_0x1b6359,_0x3de9d3){var _0x17c369=new AWS[(_0xf6bc('0x5'))]({'accessKeyId':_0xeb9ff5,'secretAccessKey':_0x567f51,'region':_0x42fc1c});var _0x343a20={'botAlias':_0xf6bc('0x6'),'botName':_0x3de9d3,'inputText':_0x1b6359,'userId':_0x5f0c00};return lexResult(_0x17c369,_0x343a20);}; \ No newline at end of file +var _0xb563=['bluebird','aws-sdk','slots','exports','$LATEST'];(function(_0xbf3f20,_0x5bf459){var _0x4b8870=function(_0x59962d){while(--_0x59962d){_0xbf3f20['push'](_0xbf3f20['shift']());}};_0x4b8870(++_0x5bf459);}(_0xb563,0xb4));var _0x3b56=function(_0x42664d,_0x2b17fa){_0x42664d=_0x42664d-0x0;var _0x18688c=_0xb563[_0x42664d];return _0x18688c;};'use strict';var BPromise=require(_0x3b56('0x0'));var AWS=require(_0x3b56('0x1'));function lexResult(_0x38184e,_0x3a87f0){return new BPromise(function(_0x358915,_0x5953ab){_0x38184e['postText'](_0x3a87f0,function(_0x4de2fb,_0x194d9e){if(_0x4de2fb){_0x5953ab(_0x4de2fb);}if(_0x194d9e[_0x3b56('0x2')]){for(const _0x58d29b in _0x194d9e[_0x3b56('0x2')]){if(_0x194d9e[_0x3b56('0x2')]['hasOwnProperty'](_0x58d29b)){var _0x123ca0=_0x194d9e['slots'][_0x58d29b];_0x194d9e['slot_'+_0x58d29b]=_0x123ca0;}}}_0x358915(_0x194d9e);});});}module[_0x3b56('0x3')]=function(_0x3c01da,_0x182769,_0x54938b,_0x2b7010,_0x5968d7,_0x707be){var _0x154013=new AWS['LexRuntime']({'accessKeyId':_0x182769,'secretAccessKey':_0x54938b,'region':_0x2b7010});var _0x570c0c={'botAlias':_0x3b56('0x4'),'botName':_0x707be,'inputText':_0x5968d7,'userId':_0x3c01da};return lexResult(_0x154013,_0x570c0c);}; \ 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 36df02c..52e9ad9 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 _0x83a4=['./lib/api'];(function(_0x36ba3b,_0x3bf009){var _0x5f2390=function(_0xf32888){while(--_0xf32888){_0x36ba3b['push'](_0x36ba3b['shift']());}};_0x5f2390(++_0x3bf009);}(_0x83a4,0x17e));var _0x483a=function(_0x5608a3,_0x5b33c5){_0x5608a3=_0x5608a3-0x0;var _0x1ed50a=_0x83a4[_0x5608a3];return _0x1ed50a;};'use strict';var polly=require(_0x483a('0x0'));module['exports']=function(_0x55297d,_0x2d8da0,_0x5c0b9c,_0x4ec294,_0x41afea,_0xda7289,_0x8f96d2){return polly(_0x55297d,_0x2d8da0,_0x5c0b9c,_0x4ec294,_0x41afea,_0xda7289,_0x8f96d2);}; \ No newline at end of file +var _0x7923=['./lib/api'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0x7923,0x184));var _0x3792=function(_0x31c2e,_0x127193){_0x31c2e=_0x31c2e-0x0;var _0x6f6873=_0x7923[_0x31c2e];return _0x6f6873;};'use strict';var polly=require(_0x3792('0x0'));module['exports']=function(_0x54ca58,_0x1ba2b4,_0x539863,_0x1e1c05,_0x5eb82a,_0x18b3a5,_0x477028){return polly(_0x54ca58,_0x1ba2b4,_0x539863,_0x1e1c05,_0x5eb82a,_0x18b3a5,_0x477028);}; \ 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 01fc6f5..04a98b2 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 _0x55f7=['No\x20data\x20response\x20from\x20aws\x20Polly!','exports','Polly','mp3','path','bluebird','randomstring','aws-sdk','synthesizeSpeech','AudioStream','Invalid\x20data\x20response\x20from\x20aws\x20Polly!'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x55f7,0x1e8));var _0x755f=function(_0x39dba1,_0x4d0883){_0x39dba1=_0x39dba1-0x0;var _0x2c28e7=_0x55f7[_0x39dba1];return _0x2c28e7;};'use strict';var fs=require('fs');var path=require(_0x755f('0x0'));var BPromise=require(_0x755f('0x1'));var rs=require(_0x755f('0x2'));var AWS=require(_0x755f('0x3'));function pollyResult(_0x4b95f5,_0x5a97e9,_0x256714){return new BPromise(function(_0x2a4549,_0x445398){_0x4b95f5[_0x755f('0x4')](_0x5a97e9,function(_0x45cba7,_0x29e93e){if(_0x45cba7){_0x445398(_0x45cba7);}else if(_0x29e93e){if(_0x29e93e[_0x755f('0x5')]instanceof Buffer){fs['writeFile'](_0x256714,_0x29e93e[_0x755f('0x5')],function(_0x226d6d){if(_0x226d6d){_0x445398(_0x226d6d);}else{_0x2a4549();}});}else{_0x445398(new Error(_0x755f('0x6')));}}else{_0x445398(new Error(_0x755f('0x7')));}});});}module[_0x755f('0x8')]=function(_0x30a9ba,_0x54dbd1,_0x3c08ae,_0xd8b06b,_0xabcd8a,_0x170c6d,_0x340c24){var _0x37da2e=new AWS[(_0x755f('0x9'))]({'accessKeyId':_0x30a9ba,'secretAccessKey':_0x54dbd1,'region':_0x3c08ae});var _0x577d41={'Text':_0xabcd8a,'TextType':_0x170c6d||'text','OutputFormat':_0x755f('0xa'),'VoiceId':_0xd8b06b};return pollyResult(_0x37da2e,_0x577d41,_0x340c24);}; \ No newline at end of file +var _0x4734=['aws-sdk','synthesizeSpeech','AudioStream','No\x20data\x20response\x20from\x20aws\x20Polly!','exports','text','path','randomstring'];(function(_0xf1998e,_0x277f5){var _0x4c91c1=function(_0x53de13){while(--_0x53de13){_0xf1998e['push'](_0xf1998e['shift']());}};_0x4c91c1(++_0x277f5);}(_0x4734,0x106));var _0x4473=function(_0x167c4e,_0x5b60d7){_0x167c4e=_0x167c4e-0x0;var _0x3ed21d=_0x4734[_0x167c4e];return _0x3ed21d;};'use strict';var fs=require('fs');var path=require(_0x4473('0x0'));var BPromise=require('bluebird');var rs=require(_0x4473('0x1'));var AWS=require(_0x4473('0x2'));function pollyResult(_0x190ea7,_0x443472,_0x3adfc0){return new BPromise(function(_0x7e118a,_0x7c884f){_0x190ea7[_0x4473('0x3')](_0x443472,function(_0x1c4703,_0x966f60){if(_0x1c4703){_0x7c884f(_0x1c4703);}else if(_0x966f60){if(_0x966f60['AudioStream']instanceof Buffer){fs['writeFile'](_0x3adfc0,_0x966f60[_0x4473('0x4')],function(_0x20af35){if(_0x20af35){_0x7c884f(_0x20af35);}else{_0x7e118a();}});}else{_0x7c884f(new Error('Invalid\x20data\x20response\x20from\x20aws\x20Polly!'));}}else{_0x7c884f(new Error(_0x4473('0x5')));}});});}module[_0x4473('0x6')]=function(_0xffb90c,_0x13c4d7,_0x5bd7cd,_0x375833,_0xb261f,_0x2be6ac,_0x46d61d){var _0x2234ff=new AWS['Polly']({'accessKeyId':_0xffb90c,'secretAccessKey':_0x13c4d7,'region':_0x5bd7cd});var _0x4ecb64={'Text':_0xb261f,'TextType':_0x2be6ac||_0x4473('0x7'),'OutputFormat':'mp3','VoiceId':_0x375833};return pollyResult(_0x2234ff,_0x4ecb64,_0x46d61d);}; \ 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 379e0ec..9bb4942 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 _0x34af=['exports'];(function(_0x3cb1f4,_0x247a6c){var _0x5ce790=function(_0xd84742){while(--_0xd84742){_0x3cb1f4['push'](_0x3cb1f4['shift']());}};_0x5ce790(++_0x247a6c);}(_0x34af,0x110));var _0xf34a=function(_0xfc5ab8,_0x3d0e85){_0xfc5ab8=_0xfc5ab8-0x0;var _0x4c0211=_0x34af[_0xfc5ab8];return _0x4c0211;};'use strict';var asr=require('./lib/api');module[_0xf34a('0x0')]=function(_0x4361cf,_0x230572,_0x1a5e3a,_0x4706fb){return asr(_0x4361cf,_0x230572,_0x1a5e3a);}; \ No newline at end of file +var _0x76f9=['./lib/api'];(function(_0xaa1b3e,_0x47d976){var _0x454d7d=function(_0x575b32){while(--_0x575b32){_0xaa1b3e['push'](_0xaa1b3e['shift']());}};_0x454d7d(++_0x47d976);}(_0x76f9,0x1c1));var _0x976f=function(_0x410e82,_0x51d5eb){_0x410e82=_0x410e82-0x0;var _0xa04bb6=_0x76f9[_0x410e82];return _0xa04bb6;};'use strict';var asr=require(_0x976f('0x0'));module['exports']=function(_0x527312,_0x3e0b41,_0x17b782,_0x59e092){return asr(_0x527312,_0x3e0b41,_0x17b782);}; \ 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 6b28c6f..3ea7f06 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 _0x1283=['undefined','readFileSync','toString','POST','/v1/speech:recognize?key=','8000','url','bluebird','exports','length','filepath\x20should\x20be\x20a\x20string','string','key\x20should\x20be\x20a\x20string'];(function(_0x224810,_0x523695){var _0x53f0de=function(_0x494ffb){while(--_0x494ffb){_0x224810['push'](_0x224810['shift']());}};_0x53f0de(++_0x523695);}(_0x1283,0x1c0));var _0x3128=function(_0x2567f0,_0x4fa60){_0x2567f0=_0x2567f0-0x0;var _0x14852a=_0x1283[_0x2567f0];return _0x14852a;};'use strict';var url=require(_0x3128('0x0'));var BPromise=require(_0x3128('0x1'));var fs=require('fs');var host='https://speech.googleapis.com';module[_0x3128('0x2')]=function(_0x529d1c,_0x30d65d,_0x24fd46){return new BPromise(function(_0x41f62b,_0x450b3d){var _0x5a028e;if(typeof _0x529d1c!=='string'||_0x529d1c[_0x3128('0x3')]===0x0){return _0x450b3d(_0x3128('0x4'));}if(typeof _0x30d65d!==_0x3128('0x5')||_0x30d65d[_0x3128('0x3')]===0x0){return _0x450b3d(_0x3128('0x6'));}if(typeof _0x24fd46!==_0x3128('0x7')&&(typeof _0x24fd46!==_0x3128('0x5')||_0x24fd46['length']===0x0)){return _0x450b3d('lang\x20should\x20be\x20a\x20string');}try{_0x5a028e=fs[_0x3128('0x8')](_0x529d1c)[_0x3128('0x9')]('base64');}catch(_0x1b2112){return _0x450b3d(_0x1b2112);}return _0x41f62b({'method':_0x3128('0xa'),'uri':host+_0x3128('0xb')+_0x30d65d,'body':{'config':{'encoding':'LINEAR16','sampleRateHertz':_0x3128('0xc'),'languageCode':_0x24fd46},'audio':{'content':_0x5a028e}},'json':!![]});});}; \ No newline at end of file +var _0xdf1a=['key\x20should\x20be\x20a\x20string','readFileSync','toString','base64','8000','url','https://speech.googleapis.com','exports','string','length'];(function(_0x4e753f,_0x17dbd7){var _0x3ec076=function(_0x169a55){while(--_0x169a55){_0x4e753f['push'](_0x4e753f['shift']());}};_0x3ec076(++_0x17dbd7);}(_0xdf1a,0xeb));var _0xadf1=function(_0x4a9beb,_0x159482){_0x4a9beb=_0x4a9beb-0x0;var _0x2d4c58=_0xdf1a[_0x4a9beb];return _0x2d4c58;};'use strict';var url=require(_0xadf1('0x0'));var BPromise=require('bluebird');var fs=require('fs');var host=_0xadf1('0x1');module[_0xadf1('0x2')]=function(_0x8d65f9,_0x4d84d7,_0xcdcca9){return new BPromise(function(_0x2a4254,_0x1d8e26){var _0x52eaab;if(typeof _0x8d65f9!==_0xadf1('0x3')||_0x8d65f9[_0xadf1('0x4')]===0x0){return _0x1d8e26('filepath\x20should\x20be\x20a\x20string');}if(typeof _0x4d84d7!==_0xadf1('0x3')||_0x4d84d7[_0xadf1('0x4')]===0x0){return _0x1d8e26(_0xadf1('0x5'));}if(typeof _0xcdcca9!=='undefined'&&(typeof _0xcdcca9!==_0xadf1('0x3')||_0xcdcca9[_0xadf1('0x4')]===0x0)){return _0x1d8e26('lang\x20should\x20be\x20a\x20string');}try{_0x52eaab=fs[_0xadf1('0x6')](_0x8d65f9)[_0xadf1('0x7')](_0xadf1('0x8'));}catch(_0x25ca57){return _0x1d8e26(_0x25ca57);}return _0x2a4254({'method':'POST','uri':host+'/v1/speech:recognize?key='+_0x4d84d7,'body':{'config':{'encoding':'LINEAR16','sampleRateHertz':_0xadf1('0x9'),'languageCode':_0xcdcca9},'audio':{'content':_0x52eaab}},'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 3021518..20a7df7 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 _0x7e27=['exports','./asr'];(function(_0x1ec904,_0x524ad0){var _0x3f11c1=function(_0x2250a5){while(--_0x2250a5){_0x1ec904['push'](_0x1ec904['shift']());}};_0x3f11c1(++_0x524ad0);}(_0x7e27,0xdd));var _0x77e2=function(_0x548924,_0x2d19b7){_0x548924=_0x548924-0x0;var _0x4b716f=_0x7e27[_0x548924];return _0x4b716f;};var asr=require(_0x77e2('0x0'));module[_0x77e2('0x1')]={'asr':asr}; \ No newline at end of file +var _0xe56e=['./asr'];(function(_0x5f6a8a,_0x45f474){var _0x2cce4d=function(_0x590b80){while(--_0x590b80){_0x5f6a8a['push'](_0x5f6a8a['shift']());}};_0x2cce4d(++_0x45f474);}(_0xe56e,0xd8));var _0xee56=function(_0x2186bc,_0x136d12){_0x2186bc=_0x2186bc-0x0;var _0x25e4d8=_0xe56e[_0x2186bc];return _0x25e4d8;};var asr=require(_0xee56('0x0'));module['exports']={'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 c8737bc..941c224 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 _0x6bf8=['voice','MP3','text:synthesize','POST','resolve','from','audioContent','writeFile','chmodSync','googleCloudTTS\x20path','goggleTTS\x20path','googleASR','asr','uri','results','map','alternatives','transcript','join','confidence','googleASR\x20transcription','googleASR\x20confidence','catch','[%s]\x20%s:%s','name','googleDialogflow','stringify','result','source','resolvedQuery','speech','score','status','metadata','endConversation','isFallbackIntent','Tilde\x20ASR\x20transcription','Tilde\x20ASR\x20confidence','awsPolly','.mp3','polly','awsLex','lex','ispeechTTS','%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','format','model=%s','freeform=3','sestekNDA','text','channelData','CustomActionData','AudioFromTts','Data','audiofile','dirName','path','http','url','bluebird','randomstring','request-promise','querystring','google-tts-api','apiai-promise','md5','./google','./aws','./tilde','../../../config/logger','agi','https://api.ispeech.org/api/rest','host','WHAT_EVER','get','error','request\x20to\x20','\x20failed,\x20status\x20code\x20=\x20','statusMessage','finish','info','close','unlink','https:','statusCode','data','end','transcode','finish\x20to\x20convert','start','tmp','generate','.wav','writeFileSync','base64','then','777','split','readFileSync','toString','googleCloudTTS','https://texttospeech.googleapis.com/v1/','?key=','ssml','input'];(function(_0x1e4360,_0x930b9b){var _0x31e6b4=function(_0x49dd8e){while(--_0x49dd8e){_0x1e4360['push'](_0x1e4360['shift']());}};_0x31e6b4(++_0x930b9b);}(_0x6bf8,0x177));var _0x86bf=function(_0x2b5494,_0x56fe1d){_0x2b5494=_0x2b5494-0x0;var _0x419d6d=_0x6bf8[_0x2b5494];return _0x419d6d;};'use strict';var fs=require('fs');var path=require(_0x86bf('0x0'));var http=require(_0x86bf('0x1'));var https=require('https');var urlParse=require(_0x86bf('0x2'))['parse'];var BPromise=require(_0x86bf('0x3'));var rs=require(_0x86bf('0x4'));var sox=require('sox');var rp=require(_0x86bf('0x5'));var util=require('util');var querystring=require(_0x86bf('0x6'));var tts=require(_0x86bf('0x7'));var apiai=require(_0x86bf('0x8'));var md5=require(_0x86bf('0x9'));var google=require(_0x86bf('0xa'));var aws=require(_0x86bf('0xb'));var tilde=require(_0x86bf('0xc'));var sestek=require('./sestek');var logger=require(_0x86bf('0xd'))(_0x86bf('0xe'));var ISPEECH_API=_0x86bf('0xf');function downloadFile(_0x44d01a,_0xc5c2ec){return new BPromise(function(_0x3db067,_0x4a4187){var _0x2714bf=urlParse(_0x44d01a);var _0x5c3eff=_0x2714bf['protocol']==='https:'?https:http;var _0x30aa95={'host':_0x2714bf[_0x86bf('0x10')],'path':_0x2714bf[_0x86bf('0x0')],'headers':{'user-agent':_0x86bf('0x11')}};_0x5c3eff[_0x86bf('0x12')](_0x30aa95,function(_0x1e3c10){if(_0x1e3c10['statusCode']!==0xc8){logger[_0x86bf('0x13')](_0x86bf('0x14')+_0x44d01a+_0x86bf('0x15')+_0x1e3c10['statusCode']+'\x20('+_0x1e3c10[_0x86bf('0x16')]+')');_0x4a4187(new Error(_0x86bf('0x14')+_0x44d01a+'\x20failed,\x20status\x20code\x20=\x20'+_0x1e3c10['statusCode']+'\x20('+_0x1e3c10['statusMessage']+')'));return;}var _0x20d402=fs['createWriteStream'](_0xc5c2ec);_0x20d402['on'](_0x86bf('0x17'),function(){logger[_0x86bf('0x18')]('finish\x20download\x20file');_0x20d402[_0x86bf('0x19')](_0x3db067);});_0x20d402['on'](_0x86bf('0x13'),function(_0x51c5d2){fs[_0x86bf('0x1a')](_0xc5c2ec);logger[_0x86bf('0x13')]('download\x20error',_0x51c5d2);_0x4a4187(_0x51c5d2);});_0x1e3c10['pipe'](_0x20d402);})['on'](_0x86bf('0x13'),function(_0x2d92eb){logger[_0x86bf('0x13')](_0x2d92eb);_0x4a4187(_0x2d92eb);})['end']();});}function uploadFile(_0x404daa){return new BPromise(function(_0x3e60b4,_0x49b473){var _0x205d6d=urlParse(_0x404daa);var _0x2cd432=_0x205d6d['protocol']===_0x86bf('0x1b')?https:http;var _0x3cb4cb={'host':_0x205d6d[_0x86bf('0x10')],'path':_0x205d6d[_0x86bf('0x0')],'headers':{'user-agent':_0x86bf('0x11')}};_0x2cd432[_0x86bf('0x12')](_0x3cb4cb,function(_0x5f8b0){if(_0x5f8b0[_0x86bf('0x1c')]!==0xc8){_0x49b473(new Error(_0x86bf('0x14')+_0x404daa+_0x86bf('0x15')+_0x5f8b0[_0x86bf('0x1c')]+'\x20('+_0x5f8b0[_0x86bf('0x16')]+')'));return;}var _0x51aa31='';_0x5f8b0['on'](_0x86bf('0x1d'),function(_0x4b1525){_0x51aa31+=_0x4b1525;});_0x5f8b0['on']('end',function(){_0x3e60b4(_0x51aa31);});})['on']('error',function(_0x22ed49){_0x49b473(_0x22ed49);})[_0x86bf('0x1e')]();});}function convertFile(_0xfe850f,_0x1f6f16){return new BPromise(function(_0x1a774f,_0x420e8f){var _0xeaa613=sox[_0x86bf('0x1f')](_0xfe850f,_0x1f6f16,{'sampleRate':0x1f40,'format':'wav','channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0xeaa613['on'](_0x86bf('0x13'),function(_0x3c618b){logger[_0x86bf('0x13')]('error\x20convert',_0x3c618b);_0x420e8f(_0x3c618b);});_0xeaa613['on'](_0x86bf('0x1e'),function(){logger[_0x86bf('0x18')](_0x86bf('0x20'));_0x1a774f();});_0xeaa613[_0x86bf('0x21')]();});}function base64Decode(_0x3e35,_0x4cf47b){var _0x28cc37=path['resolve'](__dirname,_0x86bf('0x22'),rs[_0x86bf('0x23')](0x4)+_0x86bf('0x24'));fs[_0x86bf('0x25')](_0x28cc37,_0x3e35,_0x86bf('0x26'));return convertFile(_0x28cc37,_0x4cf47b)[_0x86bf('0x27')](function(){try{fs[_0x86bf('0x1a')](_0x28cc37);fs['chmodSync'](_0x4cf47b,_0x86bf('0x28'));}catch(_0x721625){logger[_0x86bf('0x13')](_0x721625);}return _0x4cf47b[_0x86bf('0x29')]('.')[0x0];});}function base64Encode(_0x1ef8db){var _0x306403=fs[_0x86bf('0x2a')](_0x1ef8db);return new Buffer(_0x306403)[_0x86bf('0x2b')]('base64');}exports[_0x86bf('0x2c')]=function(_0x2252b5,_0xf97345,_0x2af80f,_0x2fa724,_0x58606c,_0x23936d){var _0x1d33b1,_0x220930;var _0x4f8433=_0x86bf('0x2d');var _0x38d0f4=_0x86bf('0x2e')+_0x2252b5;var _0xed8d4={};if(_0xf97345===_0x86bf('0x2f')){_0xed8d4[_0x86bf('0x30')]={'ssml':_0x2af80f};}else{_0xed8d4[_0x86bf('0x30')]={'text':_0x2af80f};};_0xed8d4[_0x86bf('0x31')]={'languageCode':_0x2fa724,'ssmlGender':_0x58606c};_0xed8d4['audioConfig']={'audioEncoding':_0x86bf('0x32'),'sampleRateHertz':0x1f40};var _0x586682={'url':_0x4f8433+_0x86bf('0x33')+_0x38d0f4,'method':_0x86bf('0x34'),'json':!![],'body':_0xed8d4};return rp(_0x586682)['then'](function(_0x399a38){return new BPromise(function(_0x4feaab,_0x9e1e89){_0x1d33b1=path[_0x86bf('0x35')](__dirname,'tmp',rs[_0x86bf('0x23')](0x4)+'.mp3');var _0x4aaa4b=Buffer[_0x86bf('0x36')](_0x399a38[_0x86bf('0x37')],_0x86bf('0x26'));return fs[_0x86bf('0x38')](_0x1d33b1,_0x4aaa4b,function(_0x3ee23d){_0x9e1e89(_0x3ee23d);},function(_0xec15fa){fs[_0x86bf('0x39')](_0x1d33b1,_0x86bf('0x28'));_0x4feaab(_0xec15fa);});});})[_0x86bf('0x27')](function(_0x375485){_0x220930=path['resolve'](__dirname,_0x86bf('0x22'),rs[_0x86bf('0x23')](0x4)+'.wav');return convertFile(_0x1d33b1,_0x220930);})[_0x86bf('0x27')](function(){try{fs[_0x86bf('0x1a')](_0x1d33b1);fs[_0x86bf('0x39')](_0x220930,_0x86bf('0x28'));}catch(_0x4d16aa){logger[_0x86bf('0x13')](_0x4d16aa);}logger['info'](_0x86bf('0x3a'),_0x220930['split']('.')[0x0]);return _0x220930[_0x86bf('0x29')]('.')[0x0];});};exports['googleTTS']=function(_0x4e8c1f,_0x56cf9c){var _0x12296f,_0xe55270;return tts(_0x4e8c1f,_0x56cf9c||'en',0x1)['then'](function(_0x3022b1){logger[_0x86bf('0x18')](_0x3022b1);_0x12296f=path[_0x86bf('0x35')](__dirname,_0x86bf('0x22'),rs[_0x86bf('0x23')](0x4)+'.mp3');return downloadFile(_0x3022b1,_0x12296f);})[_0x86bf('0x27')](function(){_0xe55270=path['resolve'](__dirname,_0x86bf('0x22'),rs[_0x86bf('0x23')](0x4)+_0x86bf('0x24'));return convertFile(_0x12296f,_0xe55270);})[_0x86bf('0x27')](function(){try{fs['unlink'](_0x12296f);fs[_0x86bf('0x39')](_0xe55270,_0x86bf('0x28'));}catch(_0x70342b){logger['error'](_0x70342b);}logger['info'](_0x86bf('0x3b'),_0xe55270[_0x86bf('0x29')]('.')[0x0]);return _0xe55270['split']('.')[0x0];});};exports[_0x86bf('0x3c')]=function(_0x488630,_0x574a51,_0x401371){return google[_0x86bf('0x3d')](_0x488630,_0x574a51,_0x401371)[_0x86bf('0x27')](function(_0x5bccb2){logger['info'](_0x5bccb2[_0x86bf('0x3e')]);return rp(_0x5bccb2);})['then'](function(_0x2ca222){var _0xbc49a6='';var _0x22a96e=0x0;try{fs['unlink'](_0x488630);}catch(_0x375768){logger['error'](_0x375768);}if(_0x2ca222&&_0x2ca222[_0x86bf('0x3f')]){_0xbc49a6=_0x2ca222[_0x86bf('0x3f')][_0x86bf('0x40')](function(_0x258c30){return _0x258c30&&_0x258c30[_0x86bf('0x41')][0x0]&&_0x258c30['alternatives'][0x0]['transcript']?_0x258c30['alternatives'][0x0][_0x86bf('0x42')]:'';})[_0x86bf('0x43')]('\x0a');_0x22a96e=_0x2ca222[_0x86bf('0x3f')]['map'](function(_0x45f6e7){return _0x45f6e7&&_0x45f6e7[_0x86bf('0x41')][0x0]&&_0x45f6e7['alternatives'][0x0][_0x86bf('0x44')]?_0x45f6e7[_0x86bf('0x41')][0x0]['confidence']:0x0;})[_0x86bf('0x43')]('\x0a');}logger['info'](_0x86bf('0x45'),_0xbc49a6);logger[_0x86bf('0x18')](_0x86bf('0x46'),_0x22a96e);return{'transcript':_0xbc49a6,'confidence':_0x22a96e};})[_0x86bf('0x47')](function(_0x4acf17){logger['error'](_0x86bf('0x48'),_0x4acf17[_0x86bf('0x1c')],_0x4acf17[_0x86bf('0x49')],_0x4acf17['message']);});};exports[_0x86bf('0x4a')]=function(_0x302d89,_0x3613c7,_0x50f136,_0x1c41b1){var _0x576920=apiai(_0x3613c7,{'language':_0x1c41b1||'en'});return _0x576920['textRequest'](_0x50f136,{'sessionId':md5(_0x302d89)})[_0x86bf('0x27')](function(_0x258db5){logger[_0x86bf('0x18')](JSON[_0x86bf('0x4b')](_0x258db5));return{'source':_0x258db5[_0x86bf('0x4c')][_0x86bf('0x4d')],'resolvedQuery':_0x258db5['result'][_0x86bf('0x4e')],'action':_0x258db5['result']['action'],'actionIncomplete':_0x258db5[_0x86bf('0x4c')]['actionIncomplete'],'speech':_0x258db5['result']['fulfillment'][_0x86bf('0x4f')],'score':_0x258db5[_0x86bf('0x4c')][_0x86bf('0x50')],'statusCode':_0x258db5[_0x86bf('0x51')]['code'],'endConversation':_0x258db5[_0x86bf('0x4c')][_0x86bf('0x52')][_0x86bf('0x53')]||![],'isFallbackIntent':_0x258db5[_0x86bf('0x4c')][_0x86bf('0x52')][_0x86bf('0x54')]};});};exports['tildeASR']=function(_0x111b94,_0xa8f391,_0x165ab1,_0x100088){return tilde[_0x86bf('0x3d')](_0x111b94,_0xa8f391,_0x165ab1,_0x100088)[_0x86bf('0x27')](function(_0x2fc258){try{fs['unlink'](_0x111b94);}catch(_0x3834bd){logger[_0x86bf('0x13')](_0x3834bd);}logger[_0x86bf('0x18')](_0x86bf('0x55'),_0x2fc258[_0x86bf('0x42')]);logger['info'](_0x86bf('0x56'),_0x2fc258[_0x86bf('0x44')]);return _0x2fc258;});};exports[_0x86bf('0x57')]=function(_0x46adf0,_0x737afe,_0x305b83,_0x579af8,_0x4d1491,_0x3a6e80){var _0x5a5646=path[_0x86bf('0x35')](__dirname,'tmp',rs[_0x86bf('0x23')](0x4)+_0x86bf('0x58'));var _0x4f5009;return aws[_0x86bf('0x59')](_0x46adf0,_0x737afe,_0x305b83,_0x579af8,_0x4d1491,_0x3a6e80,_0x5a5646)[_0x86bf('0x27')](function(){_0x4f5009=path[_0x86bf('0x35')](__dirname,_0x86bf('0x22'),rs[_0x86bf('0x23')](0x4)+_0x86bf('0x24'));return convertFile(_0x5a5646,_0x4f5009);})[_0x86bf('0x27')](function(){try{fs[_0x86bf('0x1a')](_0x5a5646);fs[_0x86bf('0x39')](_0x4f5009,_0x86bf('0x28'));}catch(_0x56e59a){logger[_0x86bf('0x13')](_0x56e59a);}return _0x4f5009[_0x86bf('0x29')]('.')[0x0];});};exports[_0x86bf('0x5a')]=function(_0x3627ba,_0x43f79f,_0x3870ac,_0x1eed27,_0x1685c1,_0x5baff7){return aws[_0x86bf('0x5b')](_0x3627ba,_0x43f79f,_0x3870ac,_0x1eed27,_0x1685c1,_0x5baff7)[_0x86bf('0x27')](function(_0x121c1b){logger[_0x86bf('0x18')](JSON[_0x86bf('0x4b')](_0x121c1b));return _0x121c1b;});};exports[_0x86bf('0x5c')]=function(_0xafd03b,_0x6095e9,_0x24ce34,_0x473ba1){var _0x29d1c3=util['format'](_0x86bf('0x5d'),ISPEECH_API,_0xafd03b,encodeURIComponent(_0x6095e9),_0x24ce34,_0x473ba1);var _0x5534a4=path[_0x86bf('0x35')](__dirname,_0x86bf('0x22'),rs['generate'](0x4)+_0x86bf('0x58'));var _0x5a2075;return downloadFile(_0x29d1c3,_0x5534a4)['then'](function(){_0x5a2075=path[_0x86bf('0x35')](__dirname,_0x86bf('0x22'),rs[_0x86bf('0x23')](0x4)+_0x86bf('0x24'));return convertFile(_0x5534a4,_0x5a2075);})[_0x86bf('0x27')](function(){try{fs['unlink'](_0x5534a4);fs[_0x86bf('0x39')](_0x5a2075,_0x86bf('0x28'));}catch(_0x2d4978){logger[_0x86bf('0x13')](_0x2d4978);}return _0x5a2075[_0x86bf('0x29')]('.')[0x0];});};exports['ispeechASR']=function(_0x348189,_0x369099,_0x4bef02,_0x107a33){var _0x3deda2=util['format'](_0x86bf('0x5e'),ISPEECH_API,_0x369099,_0x4bef02,base64Encode(_0x348189),_0x107a33?util[_0x86bf('0x5f')](_0x86bf('0x60'),encodeURIComponent(_0x107a33)):_0x86bf('0x61'));return uploadFile(_0x3deda2)[_0x86bf('0x27')](function(_0x172cf0){return querystring['parse'](_0x172cf0);});};exports[_0x86bf('0x62')]=function(_0x4999c0,_0x3b5bf8){return sestek['nda'](_0x4999c0,_0x3b5bf8)['then'](function(_0x518d32){logger[_0x86bf('0x18')](JSON[_0x86bf('0x4b')](_0x518d32));var _0x7c547d={'speech':_0x518d32[_0x86bf('0x63')],'action':_0x518d32[_0x86bf('0x64')]?_0x518d32[_0x86bf('0x64')]['CustomAction']:undefined,'actiondata':_0x518d32[_0x86bf('0x64')]?_0x518d32[_0x86bf('0x64')][_0x86bf('0x65')]:undefined};if(_0x518d32[_0x86bf('0x64')]&&_0x518d32[_0x86bf('0x64')][_0x86bf('0x66')]){return base64Decode(_0x518d32['channelData'][_0x86bf('0x66')][_0x86bf('0x67')],path[_0x86bf('0x35')](__dirname,_0x86bf('0x22'),rs[_0x86bf('0x23')](0x4)+_0x86bf('0x24')))['then'](function(_0x4d831a){_0x7c547d[_0x86bf('0x68')]=_0x4d831a;return _0x7c547d;});}return _0x7c547d;});};exports[_0x86bf('0x69')]=function(){return __dirname;}; \ No newline at end of file +var _0x83b4=['info','finish\x20to\x20convert','resolve','tmp','generate','.wav','writeFileSync','base64','then','toString','googleCloudTTS','https://texttospeech.googleapis.com/v1/','?key=','input','voice','audioConfig','MP3','text:synthesize','POST','.mp3','from','audioContent','chmodSync','777','googleCloudTTS\x20path','split','googleTTS','goggleTTS\x20path','googleASR','asr','uri','results','alternatives','transcript','join','map','confidence','googleASR\x20transcription','googleASR\x20confidence','catch','name','message','googleDialogflow','textRequest','stringify','source','result','resolvedQuery','action','actionIncomplete','fulfillment','status','code','metadata','endConversation','isFallbackIntent','Tilde\x20ASR\x20confidence','awsPolly','awsLex','ispeechTTS','%s?apikey=%s&action=convert&text=%s&voice=%s&speed=%s&format=mp3','format','%s?apikey=%s&action=recognize&locale=%s&content-type=audio/x-wav&audio=%s&%s','freeform=3','sestekNDA','nda','text','channelData','CustomActionData','AudioFromTts','Data','dirName','path','http','url','parse','bluebird','sox','request-promise','apiai-promise','md5','./google','./aws','./tilde','./sestek','../../../config/logger','https://api.ispeech.org/api/rest','protocol','https:','get','statusCode','error','request\x20to\x20','\x20failed,\x20status\x20code\x20=\x20','statusMessage','createWriteStream','finish\x20download\x20file','unlink','download\x20error','pipe','end','host','WHAT_EVER','data','transcode','error\x20convert'];(function(_0x4a5cb1,_0x42580d){var _0x410a2b=function(_0x426dc3){while(--_0x426dc3){_0x4a5cb1['push'](_0x4a5cb1['shift']());}};_0x410a2b(++_0x42580d);}(_0x83b4,0x11c));var _0x483b=function(_0x41dbad,_0x4c5186){_0x41dbad=_0x41dbad-0x0;var _0x52fa4e=_0x83b4[_0x41dbad];return _0x52fa4e;};'use strict';var fs=require('fs');var path=require(_0x483b('0x0'));var http=require(_0x483b('0x1'));var https=require('https');var urlParse=require(_0x483b('0x2'))[_0x483b('0x3')];var BPromise=require(_0x483b('0x4'));var rs=require('randomstring');var sox=require(_0x483b('0x5'));var rp=require(_0x483b('0x6'));var util=require('util');var querystring=require('querystring');var tts=require('google-tts-api');var apiai=require(_0x483b('0x7'));var md5=require(_0x483b('0x8'));var google=require(_0x483b('0x9'));var aws=require(_0x483b('0xa'));var tilde=require(_0x483b('0xb'));var sestek=require(_0x483b('0xc'));var logger=require(_0x483b('0xd'))('agi');var ISPEECH_API=_0x483b('0xe');function downloadFile(_0x20772d,_0x4c0250){return new BPromise(function(_0x4f6d5f,_0x34584d){var _0x5d64ed=urlParse(_0x20772d);var _0x3c38e5=_0x5d64ed[_0x483b('0xf')]===_0x483b('0x10')?https:http;var _0x30040a={'host':_0x5d64ed['host'],'path':_0x5d64ed[_0x483b('0x0')],'headers':{'user-agent':'WHAT_EVER'}};_0x3c38e5[_0x483b('0x11')](_0x30040a,function(_0x8756a4){if(_0x8756a4[_0x483b('0x12')]!==0xc8){logger[_0x483b('0x13')](_0x483b('0x14')+_0x20772d+_0x483b('0x15')+_0x8756a4[_0x483b('0x12')]+'\x20('+_0x8756a4[_0x483b('0x16')]+')');_0x34584d(new Error(_0x483b('0x14')+_0x20772d+_0x483b('0x15')+_0x8756a4[_0x483b('0x12')]+'\x20('+_0x8756a4[_0x483b('0x16')]+')'));return;}var _0x559dfe=fs[_0x483b('0x17')](_0x4c0250);_0x559dfe['on']('finish',function(){logger['info'](_0x483b('0x18'));_0x559dfe['close'](_0x4f6d5f);});_0x559dfe['on']('error',function(_0x29ac6b){fs[_0x483b('0x19')](_0x4c0250);logger[_0x483b('0x13')](_0x483b('0x1a'),_0x29ac6b);_0x34584d(_0x29ac6b);});_0x8756a4[_0x483b('0x1b')](_0x559dfe);})['on']('error',function(_0x38ff38){logger[_0x483b('0x13')](_0x38ff38);_0x34584d(_0x38ff38);})[_0x483b('0x1c')]();});}function uploadFile(_0x30042d){return new BPromise(function(_0xc27ec0,_0x47ccbb){var _0x104256=urlParse(_0x30042d);var _0x73c7f5=_0x104256[_0x483b('0xf')]===_0x483b('0x10')?https:http;var _0x1a5613={'host':_0x104256[_0x483b('0x1d')],'path':_0x104256[_0x483b('0x0')],'headers':{'user-agent':_0x483b('0x1e')}};_0x73c7f5[_0x483b('0x11')](_0x1a5613,function(_0x5d6402){if(_0x5d6402[_0x483b('0x12')]!==0xc8){_0x47ccbb(new Error(_0x483b('0x14')+_0x30042d+_0x483b('0x15')+_0x5d6402[_0x483b('0x12')]+'\x20('+_0x5d6402['statusMessage']+')'));return;}var _0x2144de='';_0x5d6402['on'](_0x483b('0x1f'),function(_0x36cba8){_0x2144de+=_0x36cba8;});_0x5d6402['on'](_0x483b('0x1c'),function(){_0xc27ec0(_0x2144de);});})['on'](_0x483b('0x13'),function(_0x4756c6){_0x47ccbb(_0x4756c6);})[_0x483b('0x1c')]();});}function convertFile(_0x1c6358,_0x2da9fa){return new BPromise(function(_0x756982,_0x5e0e4b){var _0x29d650=sox[_0x483b('0x20')](_0x1c6358,_0x2da9fa,{'sampleRate':0x1f40,'format':'wav','channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x29d650['on']('error',function(_0x58aac5){logger['error'](_0x483b('0x21'),_0x58aac5);_0x5e0e4b(_0x58aac5);});_0x29d650['on']('end',function(){logger[_0x483b('0x22')](_0x483b('0x23'));_0x756982();});_0x29d650['start']();});}function base64Decode(_0x182e3d,_0x33471f){var _0x6da921=path[_0x483b('0x24')](__dirname,_0x483b('0x25'),rs[_0x483b('0x26')](0x4)+_0x483b('0x27'));fs[_0x483b('0x28')](_0x6da921,_0x182e3d,_0x483b('0x29'));return convertFile(_0x6da921,_0x33471f)[_0x483b('0x2a')](function(){try{fs[_0x483b('0x19')](_0x6da921);fs['chmodSync'](_0x33471f,'777');}catch(_0x2f5073){logger[_0x483b('0x13')](_0x2f5073);}return _0x33471f['split']('.')[0x0];});}function base64Encode(_0x31f213){var _0x322a7b=fs['readFileSync'](_0x31f213);return new Buffer(_0x322a7b)[_0x483b('0x2b')]('base64');}exports[_0x483b('0x2c')]=function(_0x3486b1,_0x49db8d,_0x42bc14,_0x3f08cb,_0x428196,_0x56ddcc){var _0x12e6a7,_0x37d9c3;var _0x5a6962=_0x483b('0x2d');var _0x4a6d96=_0x483b('0x2e')+_0x3486b1;var _0x3d49d7={};if(_0x49db8d==='ssml'){_0x3d49d7[_0x483b('0x2f')]={'ssml':_0x42bc14};}else{_0x3d49d7[_0x483b('0x2f')]={'text':_0x42bc14};};_0x3d49d7[_0x483b('0x30')]={'languageCode':_0x3f08cb,'ssmlGender':_0x428196};_0x3d49d7[_0x483b('0x31')]={'audioEncoding':_0x483b('0x32'),'sampleRateHertz':0x1f40};var _0x1ae52b={'url':_0x5a6962+_0x483b('0x33')+_0x4a6d96,'method':_0x483b('0x34'),'json':!![],'body':_0x3d49d7};return rp(_0x1ae52b)[_0x483b('0x2a')](function(_0xbb89a5){return new BPromise(function(_0x512b02,_0x4802ea){_0x12e6a7=path[_0x483b('0x24')](__dirname,_0x483b('0x25'),rs[_0x483b('0x26')](0x4)+_0x483b('0x35'));var _0x355a47=Buffer[_0x483b('0x36')](_0xbb89a5[_0x483b('0x37')],_0x483b('0x29'));return fs['writeFile'](_0x12e6a7,_0x355a47,function(_0x3e8103){_0x4802ea(_0x3e8103);},function(_0x1319ce){fs[_0x483b('0x38')](_0x12e6a7,'777');_0x512b02(_0x1319ce);});});})[_0x483b('0x2a')](function(_0x4173a7){_0x37d9c3=path[_0x483b('0x24')](__dirname,_0x483b('0x25'),rs[_0x483b('0x26')](0x4)+_0x483b('0x27'));return convertFile(_0x12e6a7,_0x37d9c3);})['then'](function(){try{fs[_0x483b('0x19')](_0x12e6a7);fs[_0x483b('0x38')](_0x37d9c3,_0x483b('0x39'));}catch(_0x276b55){logger[_0x483b('0x13')](_0x276b55);}logger[_0x483b('0x22')](_0x483b('0x3a'),_0x37d9c3[_0x483b('0x3b')]('.')[0x0]);return _0x37d9c3[_0x483b('0x3b')]('.')[0x0];});};exports[_0x483b('0x3c')]=function(_0x50f000,_0x3b483e){var _0x2748b5,_0x3bde4a;return tts(_0x50f000,_0x3b483e||'en',0x1)[_0x483b('0x2a')](function(_0x10b1d1){logger[_0x483b('0x22')](_0x10b1d1);_0x2748b5=path[_0x483b('0x24')](__dirname,_0x483b('0x25'),rs['generate'](0x4)+_0x483b('0x35'));return downloadFile(_0x10b1d1,_0x2748b5);})[_0x483b('0x2a')](function(){_0x3bde4a=path['resolve'](__dirname,_0x483b('0x25'),rs['generate'](0x4)+_0x483b('0x27'));return convertFile(_0x2748b5,_0x3bde4a);})['then'](function(){try{fs[_0x483b('0x19')](_0x2748b5);fs[_0x483b('0x38')](_0x3bde4a,_0x483b('0x39'));}catch(_0x4a4192){logger[_0x483b('0x13')](_0x4a4192);}logger[_0x483b('0x22')](_0x483b('0x3d'),_0x3bde4a[_0x483b('0x3b')]('.')[0x0]);return _0x3bde4a[_0x483b('0x3b')]('.')[0x0];});};exports[_0x483b('0x3e')]=function(_0x587863,_0x2a12b1,_0x562d38){return google[_0x483b('0x3f')](_0x587863,_0x2a12b1,_0x562d38)[_0x483b('0x2a')](function(_0x122c0a){logger[_0x483b('0x22')](_0x122c0a[_0x483b('0x40')]);return rp(_0x122c0a);})[_0x483b('0x2a')](function(_0x5d064b){var _0x2ea77a='';var _0x40640b=0x0;try{fs[_0x483b('0x19')](_0x587863);}catch(_0x573e82){logger[_0x483b('0x13')](_0x573e82);}if(_0x5d064b&&_0x5d064b[_0x483b('0x41')]){_0x2ea77a=_0x5d064b['results']['map'](function(_0x5665ae){return _0x5665ae&&_0x5665ae[_0x483b('0x42')][0x0]&&_0x5665ae[_0x483b('0x42')][0x0][_0x483b('0x43')]?_0x5665ae[_0x483b('0x42')][0x0][_0x483b('0x43')]:'';})[_0x483b('0x44')]('\x0a');_0x40640b=_0x5d064b[_0x483b('0x41')][_0x483b('0x45')](function(_0x142cc2){return _0x142cc2&&_0x142cc2[_0x483b('0x42')][0x0]&&_0x142cc2[_0x483b('0x42')][0x0]['confidence']?_0x142cc2['alternatives'][0x0][_0x483b('0x46')]:0x0;})['join']('\x0a');}logger[_0x483b('0x22')](_0x483b('0x47'),_0x2ea77a);logger['info'](_0x483b('0x48'),_0x40640b);return{'transcript':_0x2ea77a,'confidence':_0x40640b};})[_0x483b('0x49')](function(_0x5e98df){logger['error']('[%s]\x20%s:%s',_0x5e98df[_0x483b('0x12')],_0x5e98df[_0x483b('0x4a')],_0x5e98df[_0x483b('0x4b')]);});};exports[_0x483b('0x4c')]=function(_0x4bd1da,_0x5305ce,_0x43fa7a,_0x2aaa55){var _0x126573=apiai(_0x5305ce,{'language':_0x2aaa55||'en'});return _0x126573[_0x483b('0x4d')](_0x43fa7a,{'sessionId':md5(_0x4bd1da)})[_0x483b('0x2a')](function(_0x4a1abb){logger[_0x483b('0x22')](JSON[_0x483b('0x4e')](_0x4a1abb));return{'source':_0x4a1abb['result'][_0x483b('0x4f')],'resolvedQuery':_0x4a1abb[_0x483b('0x50')][_0x483b('0x51')],'action':_0x4a1abb['result'][_0x483b('0x52')],'actionIncomplete':_0x4a1abb['result'][_0x483b('0x53')],'speech':_0x4a1abb[_0x483b('0x50')][_0x483b('0x54')]['speech'],'score':_0x4a1abb['result']['score'],'statusCode':_0x4a1abb[_0x483b('0x55')][_0x483b('0x56')],'endConversation':_0x4a1abb['result'][_0x483b('0x57')][_0x483b('0x58')]||![],'isFallbackIntent':_0x4a1abb[_0x483b('0x50')][_0x483b('0x57')][_0x483b('0x59')]};});};exports['tildeASR']=function(_0x56b4f5,_0x40acad,_0x5549c1,_0x5d269c){return tilde[_0x483b('0x3f')](_0x56b4f5,_0x40acad,_0x5549c1,_0x5d269c)[_0x483b('0x2a')](function(_0x112db7){try{fs['unlink'](_0x56b4f5);}catch(_0x2e24d8){logger[_0x483b('0x13')](_0x2e24d8);}logger[_0x483b('0x22')]('Tilde\x20ASR\x20transcription',_0x112db7[_0x483b('0x43')]);logger[_0x483b('0x22')](_0x483b('0x5a'),_0x112db7[_0x483b('0x46')]);return _0x112db7;});};exports[_0x483b('0x5b')]=function(_0x3551a1,_0x6866be,_0x1997d1,_0x2bc3a9,_0x3ebc7e,_0x546eb2){var _0x4e32dc=path[_0x483b('0x24')](__dirname,_0x483b('0x25'),rs[_0x483b('0x26')](0x4)+'.mp3');var _0x44e06e;return aws['polly'](_0x3551a1,_0x6866be,_0x1997d1,_0x2bc3a9,_0x3ebc7e,_0x546eb2,_0x4e32dc)[_0x483b('0x2a')](function(){_0x44e06e=path['resolve'](__dirname,'tmp',rs[_0x483b('0x26')](0x4)+'.wav');return convertFile(_0x4e32dc,_0x44e06e);})[_0x483b('0x2a')](function(){try{fs[_0x483b('0x19')](_0x4e32dc);fs[_0x483b('0x38')](_0x44e06e,_0x483b('0x39'));}catch(_0x3efcf2){logger[_0x483b('0x13')](_0x3efcf2);}return _0x44e06e[_0x483b('0x3b')]('.')[0x0];});};exports[_0x483b('0x5c')]=function(_0x1bb126,_0x8c6a17,_0x3b58ad,_0x4c0476,_0xd2b704,_0x2df3e1){return aws['lex'](_0x1bb126,_0x8c6a17,_0x3b58ad,_0x4c0476,_0xd2b704,_0x2df3e1)[_0x483b('0x2a')](function(_0x2ecd16){logger[_0x483b('0x22')](JSON[_0x483b('0x4e')](_0x2ecd16));return _0x2ecd16;});};exports[_0x483b('0x5d')]=function(_0x5e7f47,_0x442ec8,_0x2f41b4,_0x5c3485){var _0x2b797a=util['format'](_0x483b('0x5e'),ISPEECH_API,_0x5e7f47,encodeURIComponent(_0x442ec8),_0x2f41b4,_0x5c3485);var _0x14812c=path[_0x483b('0x24')](__dirname,_0x483b('0x25'),rs[_0x483b('0x26')](0x4)+_0x483b('0x35'));var _0x281e10;return downloadFile(_0x2b797a,_0x14812c)[_0x483b('0x2a')](function(){_0x281e10=path[_0x483b('0x24')](__dirname,'tmp',rs[_0x483b('0x26')](0x4)+_0x483b('0x27'));return convertFile(_0x14812c,_0x281e10);})['then'](function(){try{fs[_0x483b('0x19')](_0x14812c);fs[_0x483b('0x38')](_0x281e10,'777');}catch(_0x13f265){logger['error'](_0x13f265);}return _0x281e10[_0x483b('0x3b')]('.')[0x0];});};exports['ispeechASR']=function(_0x27e717,_0x452233,_0x232278,_0x2c516f){var _0x17ce4c=util[_0x483b('0x5f')](_0x483b('0x60'),ISPEECH_API,_0x452233,_0x232278,base64Encode(_0x27e717),_0x2c516f?util['format']('model=%s',encodeURIComponent(_0x2c516f)):_0x483b('0x61'));return uploadFile(_0x17ce4c)[_0x483b('0x2a')](function(_0x477b07){return querystring[_0x483b('0x3')](_0x477b07);});};exports[_0x483b('0x62')]=function(_0xd5aca2,_0x13d88b){return sestek[_0x483b('0x63')](_0xd5aca2,_0x13d88b)[_0x483b('0x2a')](function(_0x3ec6cc){logger[_0x483b('0x22')](JSON[_0x483b('0x4e')](_0x3ec6cc));var _0x15efa8={'speech':_0x3ec6cc[_0x483b('0x64')],'action':_0x3ec6cc['channelData']?_0x3ec6cc[_0x483b('0x65')]['CustomAction']:undefined,'actiondata':_0x3ec6cc[_0x483b('0x65')]?_0x3ec6cc[_0x483b('0x65')][_0x483b('0x66')]:undefined};if(_0x3ec6cc[_0x483b('0x65')]&&_0x3ec6cc[_0x483b('0x65')][_0x483b('0x67')]){return base64Decode(_0x3ec6cc['channelData'][_0x483b('0x67')][_0x483b('0x68')],path[_0x483b('0x24')](__dirname,_0x483b('0x25'),rs['generate'](0x4)+'.wav'))[_0x483b('0x2a')](function(_0x3b56b1){_0x15efa8['audiofile']=_0x3b56b1;return _0x15efa8;});}return _0x15efa8;});};exports[_0x483b('0x69')]=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 e5694a9..6dd1b31 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 _0x3521=['exports'];(function(_0x25148e,_0x2dbfff){var _0x36284a=function(_0x117b04){while(--_0x117b04){_0x25148e['push'](_0x25148e['shift']());}};_0x36284a(++_0x2dbfff);}(_0x3521,0x179));var _0x1352=function(_0x4b824a,_0x275d05){_0x4b824a=_0x4b824a-0x0;var _0x3779ab=_0x3521[_0x4b824a];return _0x3779ab;};var nda=require('./nda');module[_0x1352('0x0')]={'nda':nda}; \ No newline at end of file +var _0xf278=['exports','./nda'];(function(_0x48d7d8,_0xf470ef){var _0x37f3d0=function(_0x1162f3){while(--_0x1162f3){_0x48d7d8['push'](_0x48d7d8['shift']());}};_0x37f3d0(++_0xf470ef);}(_0xf278,0x185));var _0x8f27=function(_0x551ece,_0x23d845){_0x551ece=_0x551ece-0x0;var _0x24ac88=_0xf278[_0x551ece];return _0x24ac88;};var nda=require(_0x8f27('0x0'));module[_0x8f27('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 92cc040..aecad22 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 _0xc0f6=['Nda','callerid','calleridname','dnid','extension','Bearer\x20','access_token','project','body','ProjectName','ndagenerate_audio','channelData','AudioOutputSettings','audio/wav','custom_action','CustomAction','custom_action_data','CustomActionData','info','stringify','request-promise','url','../../../../../config/logger','agi','resolve','ndauth_url','/token','username','then','ndassistant_url','/api/NaturalDialogAssistant/v1/Run','ndaactivity_type','message'];(function(_0x50583c,_0x2d2dee){var _0x358ba5=function(_0x1aa091){while(--_0x1aa091){_0x50583c['push'](_0x50583c['shift']());}};_0x358ba5(++_0x2d2dee);}(_0xc0f6,0xb9));var _0x6c0f=function(_0x23da4d,_0x63498c){_0x23da4d=_0x23da4d-0x0;var _0x4ae55=_0xc0f6[_0x23da4d];return _0x4ae55;};'use strict';var rp=require(_0x6c0f('0x0'));var url=require(_0x6c0f('0x1'));var logger=require(_0x6c0f('0x2'))(_0x6c0f('0x3'));module['exports']=function(_0x317d90,_0x2198eb){var _0x1f1184={'method':'POST','uri':url[_0x6c0f('0x4')](_0x2198eb[_0x6c0f('0x5')],_0x6c0f('0x6')),'form':{'grant_type':'password','username':_0x2198eb[_0x6c0f('0x7')],'password':_0x2198eb['password']},'json':!![]};return rp(_0x1f1184)[_0x6c0f('0x8')](function(_0x1fd684){var _0x35c56b={'method':'POST','uri':url[_0x6c0f('0x4')](_0x2198eb[_0x6c0f('0x9')],_0x6c0f('0xa')),'body':{'type':_0x2198eb[_0x6c0f('0xb')]||_0x6c0f('0xc'),'channelId':_0x6c0f('0xd'),'conversation':{'id':_0x317d90['uniqueid']},'from':{'id':_0x317d90[_0x6c0f('0xe')],'name':_0x317d90[_0x6c0f('0xf')]},'recipient':{'id':_0x317d90[_0x6c0f('0x10')],'name':_0x317d90[_0x6c0f('0x11')]},'text':_0x2198eb['text'],'channelData':{}},'headers':{'Authorization':_0x6c0f('0x12')+_0x1fd684[_0x6c0f('0x13')]},'json':!![]};if(_0x2198eb[_0x6c0f('0x14')]){_0x35c56b[_0x6c0f('0x15')]['channelData'][_0x6c0f('0x16')]=_0x2198eb[_0x6c0f('0x14')];}if(_0x2198eb[_0x6c0f('0x17')]=='1'){_0x35c56b[_0x6c0f('0x15')][_0x6c0f('0x18')][_0x6c0f('0x19')]={'Generate':!![],'PutInStructuredPart':![],'ExpectedFormat':_0x6c0f('0x1a')};}if(_0x2198eb[_0x6c0f('0x1b')]){_0x35c56b['body'][_0x6c0f('0x18')][_0x6c0f('0x1c')]=_0x2198eb[_0x6c0f('0x1b')];if(_0x2198eb[_0x6c0f('0x1d')]){_0x35c56b['body']['channelData'][_0x6c0f('0x1e')]=_0x2198eb[_0x6c0f('0x1d')];}}logger[_0x6c0f('0x1f')](JSON[_0x6c0f('0x20')](_0x35c56b));return rp(_0x35c56b);});}; \ No newline at end of file +var _0x8477=['request-promise','url','../../../../../config/logger','agi','POST','resolve','ndauth_url','/token','password','then','ndassistant_url','/api/NaturalDialogAssistant/v1/Run','ndaactivity_type','message','Nda','callerid','calleridname','dnid','extension','text','Bearer\x20','access_token','project','body','channelData','ProjectName','AudioOutputSettings','custom_action','CustomActionData','custom_action_data','info','stringify'];(function(_0x4b80e0,_0x2dc469){var _0x4266df=function(_0xcd7b1f){while(--_0xcd7b1f){_0x4b80e0['push'](_0x4b80e0['shift']());}};_0x4266df(++_0x2dc469);}(_0x8477,0xe0));var _0x7847=function(_0x4b7e4d,_0x82d2ab){_0x4b7e4d=_0x4b7e4d-0x0;var _0x38d6af=_0x8477[_0x4b7e4d];return _0x38d6af;};'use strict';var rp=require(_0x7847('0x0'));var url=require(_0x7847('0x1'));var logger=require(_0x7847('0x2'))(_0x7847('0x3'));module['exports']=function(_0x5119f7,_0x4eeba3){var _0x1c487f={'method':_0x7847('0x4'),'uri':url[_0x7847('0x5')](_0x4eeba3[_0x7847('0x6')],_0x7847('0x7')),'form':{'grant_type':_0x7847('0x8'),'username':_0x4eeba3['username'],'password':_0x4eeba3[_0x7847('0x8')]},'json':!![]};return rp(_0x1c487f)[_0x7847('0x9')](function(_0x53aae6){var _0x14e6ae={'method':_0x7847('0x4'),'uri':url['resolve'](_0x4eeba3[_0x7847('0xa')],_0x7847('0xb')),'body':{'type':_0x4eeba3[_0x7847('0xc')]||_0x7847('0xd'),'channelId':_0x7847('0xe'),'conversation':{'id':_0x5119f7['uniqueid']},'from':{'id':_0x5119f7[_0x7847('0xf')],'name':_0x5119f7[_0x7847('0x10')]},'recipient':{'id':_0x5119f7[_0x7847('0x11')],'name':_0x5119f7[_0x7847('0x12')]},'text':_0x4eeba3[_0x7847('0x13')],'channelData':{}},'headers':{'Authorization':_0x7847('0x14')+_0x53aae6[_0x7847('0x15')]},'json':!![]};if(_0x4eeba3[_0x7847('0x16')]){_0x14e6ae[_0x7847('0x17')][_0x7847('0x18')][_0x7847('0x19')]=_0x4eeba3[_0x7847('0x16')];}if(_0x4eeba3['ndagenerate_audio']=='1'){_0x14e6ae[_0x7847('0x17')][_0x7847('0x18')][_0x7847('0x1a')]={'Generate':!![],'PutInStructuredPart':![],'ExpectedFormat':'audio/wav'};}if(_0x4eeba3['custom_action']){_0x14e6ae['body']['channelData']['CustomAction']=_0x4eeba3[_0x7847('0x1b')];if(_0x4eeba3['custom_action_data']){_0x14e6ae['body'][_0x7847('0x18')][_0x7847('0x1c')]=_0x4eeba3[_0x7847('0x1d')];}}logger[_0x7847('0x1e')](JSON[_0x7847('0x1f')](_0x14e6ae));return rp(_0x14e6ae);});}; \ 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 9555e1c..f43b77a 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 _0x9633=['./lib/api','exports'];(function(_0x2faddb,_0xc18b78){var _0x273c05=function(_0x1a3785){while(--_0x1a3785){_0x2faddb['push'](_0x2faddb['shift']());}};_0x273c05(++_0xc18b78);}(_0x9633,0x148));var _0x3963=function(_0x5a61f9,_0x537e3e){_0x5a61f9=_0x5a61f9-0x0;var _0xae67b2=_0x9633[_0x5a61f9];return _0xae67b2;};'use strict';var asr=require(_0x3963('0x0'));module[_0x3963('0x1')]=function(_0x6abcc5,_0x293560,_0xde15fb,_0x382452){return asr(_0x6abcc5,_0x293560,_0xde15fb,_0x382452);}; \ No newline at end of file +var _0x9498=['./lib/api','exports'];(function(_0x46596d,_0x52918c){var _0x5d017f=function(_0x476740){while(--_0x476740){_0x46596d['push'](_0x46596d['shift']());}};_0x5d017f(++_0x52918c);}(_0x9498,0x1e8));var _0x8949=function(_0x3a30f8,_0x3cfeec){_0x3a30f8=_0x3a30f8-0x0;var _0x18958e=_0x9498[_0x3a30f8];return _0x18958e;};'use strict';var asr=require(_0x8949('0x0'));module[_0x8949('0x1')]=function(_0x28e247,_0x130114,_0x1ba9b2,_0x9dcedf){return asr(_0x28e247,_0x130114,_0x1ba9b2,_0x9dcedf);}; \ 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 0094c42..347a283 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 _0xc6b5=['isNil','isObject','open','message','bluebird','crypto','../../../../../../config/logger','agi','exports','info','Tilde\x20URI','wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE','No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech','createHash','sha1','update','digest','hex','Open\x20Tilde\x20ASR\x20socket','unix','send','createReadStream','data','close','EOS','error','Tilde\x20ASR\x20send\x20error','stringify','terminate','parse','status','result','Tilde\x20ASR\x20hypoteses','transcript','hypotheses','Success.','Aborted.\x20Recognition\x20was\x20aborted\x20for\x20some\x20reason.','Authentication\x20failed.','All\x20recognition\x20workers\x20are\x20currently\x20in\x20use\x20and\x20real-time\x20recognition\x20is\x20not\x20possible.','Tilde\x20ASR\x20parse\x20error','Close\x20Tilde\x20ASR\x20socket','Error\x20Tilde\x20ASR\x20socket'];(function(_0x5ebf10,_0x2f1aaa){var _0x3ecc0a=function(_0x38383f){while(--_0x38383f){_0x5ebf10['push'](_0x5ebf10['shift']());}};_0x3ecc0a(++_0x2f1aaa);}(_0xc6b5,0xac));var _0x5c6b=function(_0x491e10,_0x266113){_0x491e10=_0x491e10-0x0;var _0x1a5d6e=_0xc6b5[_0x491e10];return _0x1a5d6e;};'use strict';var BPromise=require(_0x5c6b('0x0'));var _=require('lodash');var fs=require('fs');var WebSocket=require('ws');var moment=require('moment');var crypto=require(_0x5c6b('0x1'));var logger=require(_0x5c6b('0x2'))(_0x5c6b('0x3'));module[_0x5c6b('0x4')]=function(_0x4a53e0,_0x294d9c,_0xa25be2,_0x4ef39d){return new BPromise(function(_0x15abc4,_0x59824d){logger[_0x5c6b('0x5')](_0x5c6b('0x6'),_0x4ef39d||_0x5c6b('0x7'));var _0x1e629d=new WebSocket(_0x4ef39d||_0x5c6b('0x7'),{'perMessageDeflate':![]});var _0x1ef61a='';var _0x4f3c9a='0';var _0x435aec='1';var _0x99b725=_0x5c6b('0x8');function _0x283928(_0x3639a0){var _0x255354=crypto[_0x5c6b('0x9')](_0x5c6b('0xa'));_0x255354[_0x5c6b('0xb')](_0x3639a0);return _0x255354[_0x5c6b('0xc')](_0x5c6b('0xd'));}function _0xc6e7b3(){try{logger[_0x5c6b('0x5')](_0x5c6b('0xe'));var _0x57cac8=moment()[_0x5c6b('0xf')]();var _0x575117=_0x283928(_0x57cac8+_0x294d9c+_0xa25be2);_0x1e629d[_0x5c6b('0x10')](JSON['stringify']({'appID':_0x294d9c,'timestamp':_0x57cac8,'appKey':_0x575117}));var _0x375bc9=fs[_0x5c6b('0x11')](_0x4a53e0);_0x375bc9['on'](_0x5c6b('0x12'),function(_0x3e1e10){_0x1e629d[_0x5c6b('0x10')](_0x3e1e10);});_0x375bc9['on'](_0x5c6b('0x13'),function(){_0x1e629d[_0x5c6b('0x10')](_0x5c6b('0x14'));});}catch(_0x536996){logger[_0x5c6b('0x15')](_0x5c6b('0x16'),JSON[_0x5c6b('0x17')](_0x536996));_0x1e629d[_0x5c6b('0x18')]();}}function _0x18bec0(_0x116abb){try{if(_0x116abb){var _0x5af775=JSON[_0x5c6b('0x19')](_0x116abb);switch(_0x5af775[_0x5c6b('0x1a')]){case 0x0:if(_0x5af775[_0x5c6b('0x1b')]){if(_0x5af775['result']['final']){logger[_0x5c6b('0x5')](_0x5c6b('0x1c'),JSON[_0x5c6b('0x17')](_0x5af775[_0x5c6b('0x1b')]['hypotheses']));_0x1ef61a=_0x5af775[_0x5c6b('0x1b')]['hypotheses'][0x0][_0x5c6b('0x1d')];_0x4f3c9a=_0x5af775['result'][_0x5c6b('0x1e')][0x0]['likelihood'];_0x435aec='0';_0x99b725=_0x5c6b('0x1f');_0x1e629d['terminate']();}}break;case 0x1:logger[_0x5c6b('0x5')](_0x5c6b('0x8'));_0x435aec='1';_0x99b725=_0x5c6b('0x8');break;case 0x2:logger[_0x5c6b('0x5')](_0x5c6b('0x20'));_0x435aec='2';_0x99b725='Aborted.\x20Recognition\x20was\x20aborted\x20for\x20some\x20reason.';break;case 0x9:logger[_0x5c6b('0x5')]('Not\x20available.\x20Max\x20load\x20limit\x20reached.');_0x435aec='9';_0x99b725='Not\x20available.\x20Max\x20load\x20limit\x20reached.';break;case 0xa:logger['info']('Authentication\x20failed.');_0x435aec='10';_0x99b725=_0x5c6b('0x21');break;case 0xb:logger[_0x5c6b('0x5')](_0x5c6b('0x22'));_0x435aec='11';_0x99b725='All\x20recognition\x20workers\x20are\x20currently\x20in\x20use\x20and\x20real-time\x20recognition\x20is\x20not\x20possible.';}}}catch(_0x51863f){logger[_0x5c6b('0x15')](_0x5c6b('0x23'),JSON[_0x5c6b('0x17')](_0x51863f));_0x1e629d[_0x5c6b('0x18')]();}}function _0xe22ca0(){logger[_0x5c6b('0x5')](_0x5c6b('0x24'));_0x15abc4({'transcript':_0x1ef61a,'confidence':_0x4f3c9a,'status':_0x435aec,'status_message':_0x99b725});}function _0xcadc07(_0x3c1baa){logger[_0x5c6b('0x15')](_0x5c6b('0x25'));if(!_[_0x5c6b('0x26')](_0x3c1baa)){logger[_0x5c6b('0x15')](_[_0x5c6b('0x27')](_0x3c1baa)?JSON['stringify'](_0x3c1baa):_0x3c1baa);}}_0x1e629d['on'](_0x5c6b('0x28'),_0xc6e7b3);_0x1e629d['on'](_0x5c6b('0x29'),_0x18bec0);_0x1e629d['on'](_0x5c6b('0x13'),_0xe22ca0);_0x1e629d['on']('error',_0xcadc07);});}; \ No newline at end of file +var _0xea79=['isNil','isObject','message','moment','crypto','../../../../../../config/logger','agi','exports','info','Tilde\x20URI','wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE','No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech','createHash','sha1','update','digest','hex','Open\x20Tilde\x20ASR\x20socket','unix','send','stringify','createReadStream','close','error','terminate','parse','status','result','final','Tilde\x20ASR\x20hypoteses','hypotheses','transcript','Success.','Aborted.\x20Recognition\x20was\x20aborted\x20for\x20some\x20reason.','Not\x20available.\x20Max\x20load\x20limit\x20reached.','Authentication\x20failed.','All\x20recognition\x20workers\x20are\x20currently\x20in\x20use\x20and\x20real-time\x20recognition\x20is\x20not\x20possible.','Tilde\x20ASR\x20parse\x20error','Close\x20Tilde\x20ASR\x20socket'];(function(_0x1e49ee,_0x3257b6){var _0x3dcf1e=function(_0x62a4fa){while(--_0x62a4fa){_0x1e49ee['push'](_0x1e49ee['shift']());}};_0x3dcf1e(++_0x3257b6);}(_0xea79,0x162));var _0x9ea7=function(_0x310504,_0x26ad95){_0x310504=_0x310504-0x0;var _0x5b36d0=_0xea79[_0x310504];return _0x5b36d0;};'use strict';var BPromise=require('bluebird');var _=require('lodash');var fs=require('fs');var WebSocket=require('ws');var moment=require(_0x9ea7('0x0'));var crypto=require(_0x9ea7('0x1'));var logger=require(_0x9ea7('0x2'))(_0x9ea7('0x3'));module[_0x9ea7('0x4')]=function(_0x49e791,_0x70bcd6,_0x175c86,_0x53181b){return new BPromise(function(_0x262f22,_0x2f34d4){logger[_0x9ea7('0x5')](_0x9ea7('0x6'),_0x53181b||_0x9ea7('0x7'));var _0x527f09=new WebSocket(_0x53181b||_0x9ea7('0x7'),{'perMessageDeflate':![]});var _0x9ae1f5='';var _0x410091='0';var _0x50cc1b='1';var _0x3be103=_0x9ea7('0x8');function _0x54ef05(_0x30cdee){var _0x339221=crypto[_0x9ea7('0x9')](_0x9ea7('0xa'));_0x339221[_0x9ea7('0xb')](_0x30cdee);return _0x339221[_0x9ea7('0xc')](_0x9ea7('0xd'));}function _0x1d8859(){try{logger[_0x9ea7('0x5')](_0x9ea7('0xe'));var _0x1b7b03=moment()[_0x9ea7('0xf')]();var _0x25af97=_0x54ef05(_0x1b7b03+_0x70bcd6+_0x175c86);_0x527f09[_0x9ea7('0x10')](JSON[_0x9ea7('0x11')]({'appID':_0x70bcd6,'timestamp':_0x1b7b03,'appKey':_0x25af97}));var _0xe91f38=fs[_0x9ea7('0x12')](_0x49e791);_0xe91f38['on']('data',function(_0x3c4131){_0x527f09[_0x9ea7('0x10')](_0x3c4131);});_0xe91f38['on'](_0x9ea7('0x13'),function(){_0x527f09[_0x9ea7('0x10')]('EOS');});}catch(_0x38a24e){logger[_0x9ea7('0x14')]('Tilde\x20ASR\x20send\x20error',JSON[_0x9ea7('0x11')](_0x38a24e));_0x527f09[_0x9ea7('0x15')]();}}function _0x131cc4(_0x3748a1){try{if(_0x3748a1){var _0x5640e8=JSON[_0x9ea7('0x16')](_0x3748a1);switch(_0x5640e8[_0x9ea7('0x17')]){case 0x0:if(_0x5640e8['result']){if(_0x5640e8[_0x9ea7('0x18')][_0x9ea7('0x19')]){logger['info'](_0x9ea7('0x1a'),JSON[_0x9ea7('0x11')](_0x5640e8[_0x9ea7('0x18')][_0x9ea7('0x1b')]));_0x9ae1f5=_0x5640e8[_0x9ea7('0x18')][_0x9ea7('0x1b')][0x0][_0x9ea7('0x1c')];_0x410091=_0x5640e8[_0x9ea7('0x18')][_0x9ea7('0x1b')][0x0]['likelihood'];_0x50cc1b='0';_0x3be103=_0x9ea7('0x1d');_0x527f09[_0x9ea7('0x15')]();}}break;case 0x1:logger['info'](_0x9ea7('0x8'));_0x50cc1b='1';_0x3be103=_0x9ea7('0x8');break;case 0x2:logger['info']('Aborted.\x20Recognition\x20was\x20aborted\x20for\x20some\x20reason.');_0x50cc1b='2';_0x3be103=_0x9ea7('0x1e');break;case 0x9:logger['info'](_0x9ea7('0x1f'));_0x50cc1b='9';_0x3be103=_0x9ea7('0x1f');break;case 0xa:logger[_0x9ea7('0x5')](_0x9ea7('0x20'));_0x50cc1b='10';_0x3be103='Authentication\x20failed.';break;case 0xb:logger[_0x9ea7('0x5')](_0x9ea7('0x21'));_0x50cc1b='11';_0x3be103=_0x9ea7('0x21');}}}catch(_0x540235){logger[_0x9ea7('0x14')](_0x9ea7('0x22'),JSON[_0x9ea7('0x11')](_0x540235));_0x527f09[_0x9ea7('0x15')]();}}function _0x21f89a(){logger[_0x9ea7('0x5')](_0x9ea7('0x23'));_0x262f22({'transcript':_0x9ae1f5,'confidence':_0x410091,'status':_0x50cc1b,'status_message':_0x3be103});}function _0x342a2b(_0x29d7c3){logger[_0x9ea7('0x14')]('Error\x20Tilde\x20ASR\x20socket');if(!_[_0x9ea7('0x24')](_0x29d7c3)){logger[_0x9ea7('0x14')](_[_0x9ea7('0x25')](_0x29d7c3)?JSON[_0x9ea7('0x11')](_0x29d7c3):_0x29d7c3);}}_0x527f09['on']('open',_0x1d8859);_0x527f09['on'](_0x9ea7('0x26'),_0x131cc4);_0x527f09['on']('close',_0x21f89a);_0x527f09['on'](_0x9ea7('0x14'),_0x342a2b);});}; \ No newline at end of file diff --git a/server/services/agi/scripts/tilde/index.js b/server/services/agi/scripts/tilde/index.js index 10cb4be..98092c7 100644 --- a/server/services/agi/scripts/tilde/index.js +++ b/server/services/agi/scripts/tilde/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var asr=require('./asr');module['exports']={'asr':asr}; \ No newline at end of file +var _0x8b6c=['exports','./asr'];(function(_0xd9dd19,_0x3f788b){var _0x3d25f8=function(_0xc22ddc){while(--_0xc22ddc){_0xd9dd19['push'](_0xd9dd19['shift']());}};_0x3d25f8(++_0x3f788b);}(_0x8b6c,0x1b7));var _0xc8b6=function(_0x432ac3,_0x123070){_0x432ac3=_0x432ac3-0x0;var _0x39d07e=_0x8b6c[_0x432ac3];return _0x39d07e;};var asr=require(_0xc8b6('0x0'));module[_0xc8b6('0x1')]={'asr':asr}; \ No newline at end of file diff --git a/server/services/agi/server.js b/server/services/agi/server.js index 71e6f27..75f881b 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 _0xdb13=['error','E_AGI_ARGUMENT_PORT','createServer','listen','listening','connection','getConnections','E_AGI_SERVER_VOICE_DISABLED','destroy','ready','E_AGI_SERVER_ERROR','code','close','nextTick','exports','net','events','EventEmitter','./error','./channel','127.0.0.1','call','emit'];(function(_0x1bd51d,_0x46f25e){var _0x116b83=function(_0x2d447c){while(--_0x2d447c){_0x1bd51d['push'](_0x1bd51d['shift']());}};_0x116b83(++_0x46f25e);}(_0xdb13,0x10c));var _0x3db1=function(_0x4348e5,_0x4dec8b){_0x4348e5=_0x4348e5-0x0;var _0x458d2f=_0xdb13[_0x4348e5];return _0x458d2f;};'use strict';var util=require('util');var net=require(_0x3db1('0x0'));var EventEmitter=require(_0x3db1('0x1'))[_0x3db1('0x2')];var AGIError=require(_0x3db1('0x3'));var AGIChannel=require(_0x3db1('0x4'));var AGIServer=function(_0xd23f18,_0x581a73,_0x3352e3){var _0x41fb5d=this,_0xd23f18=_0xd23f18||0x11dd,_0x581a73=_0x581a73||_0x3db1('0x5'),_0x342b84=null,_0x5a2345=0x0;EventEmitter[_0x3db1('0x6')](_0x41fb5d);function _0x28e7b6(){if(!_0xd23f18){_0x41fb5d[_0x3db1('0x7')](_0x3db1('0x8'),new AGIError(_0x3db1('0x9')));return![];}_0x342b84=net[_0x3db1('0xa')]();_0x342b84[_0x3db1('0xb')](_0xd23f18,_0x581a73);_0x342b84['on'](_0x3db1('0xc'),function(){_0x41fb5d[_0x3db1('0x7')](_0x3db1('0xc'));});_0x342b84['on'](_0x3db1('0xd'),function(_0x51d421){_0x342b84[_0x3db1('0xe')](function(_0xad7eab,_0x2bab87){if(_0xad7eab){_0x41fb5d[_0x3db1('0x7')]('error',new AGIError('E_AGI_SERVER_ERROR',_0xad7eab));}else if(_0x3352e3&&_0x3352e3<0x0){_0x41fb5d[_0x3db1('0x7')](_0x3db1('0x8'),new AGIError(_0x3db1('0xf')));_0x51d421[_0x3db1('0x10')]();}else if(_0x3352e3&&_0x3352e3>0x0&&_0x3352e3<_0x2bab87){_0x5a2345+=0x1;_0x41fb5d[_0x3db1('0x7')]('error',new AGIError('E_AGI_SERVER_MAXCONNECTION',_0x5a2345));_0x51d421['destroy']();}else{var _0x5f1633=new AGIChannel(_0x51d421);_0x5f1633['on'](_0x3db1('0x11'),function(){_0x41fb5d[_0x3db1('0x7')](_0x3db1('0xd'),_0x5f1633);});}});});_0x342b84['on'](_0x3db1('0x8'),function(_0xe390b3){_0x41fb5d[_0x3db1('0x7')]('error',new AGIError(_0x3db1('0x12'),_0xe390b3[_0x3db1('0x13')]));});_0x342b84['on']('close',function(){_0x41fb5d[_0x3db1('0x7')](_0x3db1('0x14'),new AGIError('E_AGI_SERVER_CLOSE'));});}process[_0x3db1('0x15')](function(){_0x28e7b6();});};util['inherits'](AGIServer,EventEmitter);module[_0x3db1('0x16')]=function(_0x475208,_0x1eb147,_0x435a76){return new AGIServer(_0x475208,_0x1eb147,_0x435a76);}; \ No newline at end of file +var _0xdfcc=['./error','./channel','call','emit','error','createServer','listening','connection','getConnections','destroy','code','close','E_AGI_SERVER_CLOSE','nextTick','exports','util','net','events'];(function(_0x2cc7ad,_0x32c01a){var _0x2de1d7=function(_0x215a29){while(--_0x215a29){_0x2cc7ad['push'](_0x2cc7ad['shift']());}};_0x2de1d7(++_0x32c01a);}(_0xdfcc,0x8d));var _0xcdfc=function(_0x2feb53,_0x264ef7){_0x2feb53=_0x2feb53-0x0;var _0x5700ee=_0xdfcc[_0x2feb53];return _0x5700ee;};'use strict';var util=require(_0xcdfc('0x0'));var net=require(_0xcdfc('0x1'));var EventEmitter=require(_0xcdfc('0x2'))['EventEmitter'];var AGIError=require(_0xcdfc('0x3'));var AGIChannel=require(_0xcdfc('0x4'));var AGIServer=function(_0x54bd16,_0x4aef49,_0x468275){var _0x4e9e63=this,_0x54bd16=_0x54bd16||0x11dd,_0x4aef49=_0x4aef49||'127.0.0.1',_0xa928f6=null,_0x155d4c=0x0;EventEmitter[_0xcdfc('0x5')](_0x4e9e63);function _0x35a524(){if(!_0x54bd16){_0x4e9e63[_0xcdfc('0x6')](_0xcdfc('0x7'),new AGIError('E_AGI_ARGUMENT_PORT'));return![];}_0xa928f6=net[_0xcdfc('0x8')]();_0xa928f6['listen'](_0x54bd16,_0x4aef49);_0xa928f6['on'](_0xcdfc('0x9'),function(){_0x4e9e63[_0xcdfc('0x6')](_0xcdfc('0x9'));});_0xa928f6['on'](_0xcdfc('0xa'),function(_0x4537b6){_0xa928f6[_0xcdfc('0xb')](function(_0x5575e5,_0x5f1d46){if(_0x5575e5){_0x4e9e63[_0xcdfc('0x6')](_0xcdfc('0x7'),new AGIError('E_AGI_SERVER_ERROR',_0x5575e5));}else if(_0x468275&&_0x468275<0x0){_0x4e9e63[_0xcdfc('0x6')](_0xcdfc('0x7'),new AGIError('E_AGI_SERVER_VOICE_DISABLED'));_0x4537b6[_0xcdfc('0xc')]();}else if(_0x468275&&_0x468275>0x0&&_0x468275<_0x5f1d46){_0x155d4c+=0x1;_0x4e9e63[_0xcdfc('0x6')](_0xcdfc('0x7'),new AGIError('E_AGI_SERVER_MAXCONNECTION',_0x155d4c));_0x4537b6[_0xcdfc('0xc')]();}else{var _0xb5a56a=new AGIChannel(_0x4537b6);_0xb5a56a['on']('ready',function(){_0x4e9e63[_0xcdfc('0x6')](_0xcdfc('0xa'),_0xb5a56a);});}});});_0xa928f6['on'](_0xcdfc('0x7'),function(_0x5189bd){_0x4e9e63[_0xcdfc('0x6')](_0xcdfc('0x7'),new AGIError('E_AGI_SERVER_ERROR',_0x5189bd[_0xcdfc('0xd')]));});_0xa928f6['on'](_0xcdfc('0xe'),function(){_0x4e9e63['emit'](_0xcdfc('0xe'),new AGIError(_0xcdfc('0xf')));});}process[_0xcdfc('0x10')](function(){_0x35a524();});};util['inherits'](AGIServer,EventEmitter);module[_0xcdfc('0x11')]=function(_0x8daa88,_0x5ad601,_0x3e1707){return new AGIServer(_0x8daa88,_0x5ad601,_0x3e1707);}; \ No newline at end of file diff --git a/server/services/agi/vertices.js b/server/services/agi/vertices.js index b7e7c37..c571893 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 _0xddee=['moment','mustache','request-promise','../../config/logger','agi','../../config/environment','../../config/environment/shared','./scripts','/var/opt/motion2/server/files','rawHeaders','menu','getdigits','getsecretdigits','channel','prototype','getVariable','getVariableById','then','name','catch','rpc','getVoiceQueueById','getSquareProject','getSquareProjectById','getSquareOdbc','getSquareOdbcById','dsn','getUser','getUserById','getTrunk','getSoundById','getSoundPath','getMailAccountById','sendMailMessage','mailRpc','getIntervalById','IntervalId','map','Intervals','interval','format','%s/sounds/converted/%s','getQueryOdbc','error','Error\x20getting\x20ODBC\x20connection\x20%s','info','ODBC\x20connection\x20successfully','query','Error\x20executing\x20query\x20%s','Query\x20executed\x20correctly\x20%s','close','Error\x20closing\x20connection\x20to\x20odbc\x20%s','getSmsAccount','getSmsAccountById','createSmsMessage','createSquareDetailsReport','uniqueid','agicommand','arg_1','callerid','createSquareRecording','calleridname','extension','priority','dnid','file','createSquareMessage','createCmContact','in\x20createcmcontact','in\x20createcmcontact\x20callback','has','dialTimezone','isNil','log','VALUE\x20TZ','getContactByPhone','RETVALRPC','TZ\x20found\x20in\x20shared:','isEmpty','callback_','lastName','phone','list_id','callback','Callback\x20scheduled\x20at\x20','scheduledAt','toString','getPause','getPauseById','agentPause','agentUnpause','agent','agentLogout','agentLogin','internal','%s/%s@from-sip/n','LOCAL','shellCommand','googleCloudTTS','apiKey','text','languageCode','en-US','MALE','audioEncoding','MP3','googleTTS','google_tts_language','restAPI','url','method','timeout','number','includes','POST','PUT','toUpperCase','rawBody','parse','An\x20incorrect\x20formatted\x20json\x20body\x20has\x20been\x20passed\x20to\x20the\x20function','headers','An\x20incorrect\x20formatted\x20json\x20headers\x20has\x20been\x20passed\x20to\x20the\x20function','computedVariables','sync','uri','render','stringify','body','statusCode','statusMessage','options','googleDialogflow','key','dialogflow_language','sestekNDA','ispeechTTS','ispeech_tts_language','speed','ispeechASR','isConfigured','awsPolly','aws_access_key_id','aws_secret_access_key','aws_polly_region','Amy','awsLex','aws_lex_region','googleASR','google_asr_language','tildeASR','appid','appsecret','clear','clone','hasOwnProperty','replaceObjectAllVariables','replaceAllVariables','recursiveNodeIndex','isArray','length','isString','saveRestApiResult','isPlainObject','%s.%s','setVariable','replaceall\x20init','split','nextbracket','extra','The\x20\x22%s\x22\x20variable\x20value\x20is:\x20%s','maxRetry','retry','mrcpsynth','Enter\x20in\x20MRCPSynth\x20(%s)\x20block','label','noop','exec','result','Executed\x20command\x20MRCPSynth\x20%s','mrcprecog','grammar','no\x20grammar\x20configured','MRCPRecog','getAndSetVariable','RECOG_CONFIDENCE()','RECOG_INPUT()','MRCP_RECOG_TRANSCRIPT','MRCP_RECOG_INSTANCE','Executed\x20command\x20MRCPRecog\x20%s','command','args','answer','Wait\x20%s\x20seconds\x20before\x20answer','wait','enter\x20in\x20callbackblock','Enter\x20in\x20CALLBACK\x20(%s)\x20block','add','minutes','callback_priority','before\x20createcmcontact','CALLBACK\x20added\x20phone:\x20%s\x20on\x20list:\x20%s\x20at\x20%s','custom_app','Enter\x20in\x20CUSTOM\x20APP\x20(%s)\x20block','lumenvoxtts','Enter\x20in\x20LUMENVOXTTS\x20(%s)\x20block','Enter\x20in\x20SESTEKTTS\x20(%s)\x20block','no\x20text\x20configured','MRCPSynth','Enter\x20in\x20LUMENVOXASR\x20(%s)\x20block','LUMENVOX_ASR_TRANSCRIPT','RECOG_INSTANCE()','LUMENVOX_ASR_INSTANCE','sestekasr','Enter\x20in\x20SESTEKASR\x20(%s)\x20block','SESTEK_ASR_TRANSCRIPT','SESTEK_ASR_INSTANCE','database','Enter\x20in\x20DATABASE\x20(%s)\x20block','odbc_id','no\x20database\x20selected','no\x20odbc\x20database\x20found','no\x20query\x20configured','replace','query:\x20%s','no\x20variable\x20selected\x20for\x20the\x20result','variable_id','forEach','keys','variable\x20%s\x20set','dial','debug','Enter\x20in\x20DIAL\x20(%s)\x20block','sip_id','DIAL','opts','Executed\x20command\x20%s','dialogflow','Enter\x20in\x20DIALOGFLOW\x20(%s)\x20block','no\x20key\x20configured','bot','Trying\x20Dialogflow:\x20%s','DIALOGFLOW_%s','speech','out','Dialogflow\x20is\x20unreachable','sesteknda','Enter\x20in\x20SESTEKNDA\x20(%s)\x20block','ndauth_url','username','no\x20username\x20configured','password','no\x20password\x20configured','ndassistant_url','Trying\x20SestekNDA:\x20%s','SESTEK_NDA_%s','audiofile','Sestek\x20NDA\x20%s\x20file\x20created','streamFile','unlink','.wav','SestekNDA\x20Result\x20%s','SestekNDA\x20is\x20unreachable','end','ext_dial','Enter\x20in\x20EXTERNAL\x20DIAL\x20(%s)\x20block','trunk_id','no\x20trunk\x20found','trunk_name','no\x20trunk\x20selected','SIP/%s/%s','Enter\x20in\x20FINALLY\x20(%s)\x20block','Enter\x20in\x20GETDIGITS\x20(%s)\x20block','file_id','no\x20file\x20audio\x20selected','getSound','no\x20file\x20audio\x20found','getData','response','maxdigit','test','mindigit','no\x20variable\x20found','hiddendigitsnum','generate','hiddendigitspos','substr','goal','Enter\x20in\x20GOAL\x20(%s)\x20block','goalname','GOAL\x20%s','awspolly','no\x20valid\x20credentials\x20configured','aws\x20Polly\x20%s\x20file\x20created','aws\x20Polly\x20is\x20unreachable','awslex','Enter\x20in\x20Amazon\x20Lex\x20(%s)\x20block','aws_bot_name','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','wav','%s/recordings/%s','beep','NOBEEP','recordFile','intKey','google\x20%s\x20file\x20created','GOOGLE_ASR_%s','tildeasr','Enter\x20in\x20TILDEASR\x20(%s)\x20block','no\x20appid\x20configured','no\x20appsecret\x20configured','tilde\x20%s\x20file\x20created','TILDE_ASR_%s','continueAt','gotoif','Enter\x20in\x20GOTOIF\x20(%s)\x20block','condition','no\x20condition\x20configured','false','EVAL\x20CONDITION\x20%s\x20%s','gotoiftime','Enter\x20in\x20GOTOIFTIME\x20(%s)\x20block','no\x20interval\x20configured','interval_id','no\x20intervals\x20found','IFTIME(%s?true:false)','IFTIME\x20%s\x20%s','true','hangup','Enter\x20in\x20HANGUP\x20(%s)\x20block','ispeechasr','Enter\x20in\x20ISPEECHASR\x20(%s)\x20block','ispeech\x20%s\x20file\x20created','ISPEECH_ASR_%s','IspeechASR\x20Result\x20%s','ispeechtts','Enter\x20in\x20ISPEECHTTS\x20(%s)\x20block','ispeech\x20TTS\x20is\x20unreachable','login','Enter\x20in\x20LOGIN\x20(%s)\x20block','no\x20find\x20by\x20configured','FIND\x20AGENT\x20%s\x20BY\x20%s','findBy','AGENT\x20%s\x20FOUND\x20BY','success','AGENT\x20%s\x20NOT\x20FOUND\x20BY','logout','Enter\x20in\x20LOGOUT\x20(%s)\x20block','math','Enter\x20in\x20MATH\x20(%s)\x20block','operation','no\x20operation\x20configured','math\x20%s','%s[%s]','variable\x20%s[key]\x20set','Enter\x20in\x20MENU\x20(%s)\x20block','Enter\x20in\x20NOOP\x20(%s)\x20block','output','Enter\x20in\x20PAUSE\x20(%s)\x20block','pause_id','failure','Enter\x20in\x20PLAYBACK\x20(%s)\x20block','PLAYBACK','queue','Enter\x20in\x20QUEUE\x20(%s)\x20block','queue_id','no\x20queue\x20selected','getVoiceQueue','no\x20queue\x20found','indexOf','QUEUE','macro','gosub','position','Executed\x20command\x20%s\x20%s','Enter\x20in\x20RECORD\x20(%s)\x20block','recordingFormat','%s/recordings/%s.%s','RECORDING_SAVENAME','Recording\x20%s\x20%s\x20%s\x20%s','escape_digits','restapi','no\x20url\x20configured','Response:','inspect','no\x20variable\x20selected\x20for\x20the\x20response','%s_STATUS_MESSAGE','Unable\x20to\x20set\x20result\x20in\x20variable\x20%s','saydigits','Enter\x20in\x20SAYDIGITS\x20(%s)\x20block','sayDigits','digits','saynumber','Enter\x20in\x20SAYNUMBER\x20(%s)\x20block','sayNumber','Enter\x20in\x20SAYPHONETIC\x20(%s)\x20block','sayPhonetic','Enter\x20in\x20SENDMAIL\x20(%s)\x20block','account_id','no\x20mail\x20account\x20configured','getMailAccount','Smtp','no\x20mail\x20account\x20found','\x22%s\x22\x20<%s>','email','bcc','service','host','secure','auth','user','pass','template_id','sendMail\x20message','Trying\x20SendMail\x20with\x20account\x20%s','sendFax','no\x20sms\x20account\x20configured','no\x20sms\x20account\x20found','sms_text','sendSMS\x20message','sms_account_id','Trying\x20SendSMS\x20with\x20account\x20%s','set','Enter\x20in\x20SET\x20(%s)\x20block','no\x20variable\x20selected','variable_value','start','Enter\x20in\x20START\x20(%s)\x20block','START\x20CALLY\x20SQUARE','yes','Skipped\x20Answer','subproject','Enter\x20in\x20SUBPROJECT\x20(%s)\x20block','project_id','no\x20subproject\x20selected','no\x20subproject\x20found\x20with\x20id\x20%d','AGI','127.0.0.1','system','sh\x20command:\x20%s\x20result\x20on\x20variable:\x20%s','sh\x20command:\x20%s\x20result\x20no\x20stored','Enter\x20in\x20Google\x20Cloud\x20TTS\x20(%s)\x20block','Trying\x20Google\x20Cloud\x20TTS\x20%s','Google\x20Cloud\x20TTS\x20%s\x20file\x20created','Google\x20Cloud\x20TTS\x20is\x20unreachable','tts','Enter\x20in\x20GOOGLETTS\x20(%s)\x20block','Google\x20TTS\x20%s\x20file\x20created','Google\x20TTS\x20is\x20unreachable','unpause','Enter\x20in\x20UNPAUSE\x20(%s)\x20block','voicemail','Enter\x20in\x20VOICEMAIL\x20(%s)\x20block','VOICEMAIL','mailbox','vswitch','Enter\x20in\x20SWITCH\x20(%s)\x20block','replaceAll','join','lodash','shelljs','odbc'];(function(_0x61c01a,_0x3fca41){var _0x498cbd=function(_0x135f4b){while(--_0x135f4b){_0x61c01a['push'](_0x61c01a['shift']());}};_0x498cbd(++_0x3fca41);}(_0xddee,0x1d2));var _0xedde=function(_0x4e7d25,_0x58285f){_0x4e7d25=_0x4e7d25-0x0;var _0x526fe6=_0xddee[_0x4e7d25];return _0x526fe6;};'use strict';var fs=require('fs');var path=require('path');var util=require('util');var _=require(_0xedde('0x0'));var sh=require(_0xedde('0x1'));var odbc=require(_0xedde('0x2'))();var rs=require('randomstring');var moment=require(_0xedde('0x3'));var Mustache=require(_0xedde('0x4'));var rp=require(_0xedde('0x5'));var logger=require(_0xedde('0x6'))(_0xedde('0x7'));var config=require(_0xedde('0x8'));var shared=require(_0xedde('0x9'));var scripts=require(_0xedde('0xa'));var FILES_PATH=_0xedde('0xb');var recursiveMapAttributes=[_0xedde('0xc'),'rawBody'];var verticesWithRetry=[_0xedde('0xd'),_0xedde('0xe'),_0xedde('0xf')];var AGIVertices=function(_0x209964,_0x2c83e9,_0x2a13c8){this[_0xedde('0x10')]=_0x209964;this['rpc']=_0x2c83e9;this['mailRpc']=_0x2a13c8;};AGIVertices[_0xedde('0x11')][_0xedde('0x12')]=function(_0x2d555f,_0x3e3a15){this['rpc'][_0xedde('0x13')](_0x2d555f)[_0xedde('0x14')](function(_0x3fc766){_0x3e3a15(null,_0x3fc766?_0x3fc766[_0xedde('0x15')]:![]);})[_0xedde('0x16')](function(_0x431bb8){_0x3e3a15(_0x431bb8);});};AGIVertices['prototype']['getVoiceQueue']=function(_0x6995cd,_0x59efae){this[_0xedde('0x17')][_0xedde('0x18')](_0x6995cd)[_0xedde('0x14')](function(_0x25ec5b){_0x59efae(null,_0x25ec5b?_0x25ec5b['name']:![]);})[_0xedde('0x16')](function(_0x11fe07){_0x59efae(_0x11fe07);});};AGIVertices[_0xedde('0x11')][_0xedde('0x19')]=function(_0x2ed3fc,_0x11a989){this[_0xedde('0x17')][_0xedde('0x1a')](_0x2ed3fc)[_0xedde('0x14')](function(_0x5abe1f){_0x11a989(null,_0x5abe1f?_0x5abe1f[_0xedde('0x15')]:![]);})[_0xedde('0x16')](function(_0x2b1b79){_0x11a989(_0x2b1b79);});};AGIVertices[_0xedde('0x11')][_0xedde('0x1b')]=function(_0xd43a19,_0x591c6b){this[_0xedde('0x17')][_0xedde('0x1c')](_0xd43a19)[_0xedde('0x14')](function(_0x488cad){_0x591c6b(null,_0x488cad?_0x488cad[_0xedde('0x1d')]:![]);})[_0xedde('0x16')](function(_0x3e189a){_0x591c6b(_0x3e189a);});};AGIVertices['prototype'][_0xedde('0x1e')]=function(_0x48f78b,_0x5e7058){this['rpc'][_0xedde('0x1f')](_0x48f78b)[_0xedde('0x14')](function(_0x33548e){_0x5e7058(null,_0x33548e?_0x33548e[_0xedde('0x15')]:![]);})['catch'](function(_0x5c0c1e){_0x5e7058(_0x5c0c1e);});};AGIVertices['prototype'][_0xedde('0x20')]=function(_0x5924a3,_0x2f3c8c){this['rpc']['getTrunkById'](_0x5924a3)[_0xedde('0x14')](function(_0x221f21){_0x2f3c8c(null,_0x221f21?_0x221f21[_0xedde('0x15')]:![]);})[_0xedde('0x16')](function(_0x21c847){_0x2f3c8c(_0x21c847);});};AGIVertices['prototype']['getSound']=function(_0x2c8a24,_0x5e1866){var _0x48b896=this;this[_0xedde('0x17')][_0xedde('0x21')](_0x2c8a24)['then'](function(_0x8e8c6e){_0x5e1866(null,_0x8e8c6e?_0x48b896[_0xedde('0x22')](_0x8e8c6e['save_name']):![]);})[_0xedde('0x16')](function(_0x3b6903){_0x5e1866(_0x3b6903);});};AGIVertices[_0xedde('0x11')]['getMailAccount']=function(_0x47cf2d,_0x3e7b9d){this[_0xedde('0x17')][_0xedde('0x23')](_0x47cf2d)[_0xedde('0x14')](function(_0x46e717){_0x3e7b9d(null,_0x46e717?_0x46e717:![]);})['catch'](function(_0x5a3327){_0x3e7b9d(_0x5a3327);});};AGIVertices[_0xedde('0x11')][_0xedde('0x24')]=function(_0x16a8fe,_0x263601,_0x513f99){this[_0xedde('0x25')]['sendMailMessage'](_0x16a8fe,_0x263601)['then'](function(){_0x513f99(null);})[_0xedde('0x16')](function(_0x45a9ae){_0x513f99(_0x45a9ae);});};AGIVertices['prototype']['getIntervals']=function(_0x144cbe,_0x4ef0be){this[_0xedde('0x17')][_0xedde('0x26')](_0x144cbe)[_0xedde('0x14')](function(_0x242827){if(_0x242827){if(_0x242827[_0xedde('0x27')]){_0x4ef0be(null,[_0x242827['interval']]);}else{_0x4ef0be(null,_[_0xedde('0x28')](_0x242827[_0xedde('0x29')],_0xedde('0x2a')));}}else{_0x4ef0be(null,![]);}})['catch'](function(_0x1eeaf8){_0x4ef0be(_0x1eeaf8);});};AGIVertices['prototype'][_0xedde('0x22')]=function(_0x1f5904){return util[_0xedde('0x2b')](_0xedde('0x2c'),FILES_PATH,_0x1f5904);};AGIVertices['prototype'][_0xedde('0x2d')]=function(_0x4fbd8d,_0x750e2a,_0xb3362a){odbc['open'](_0x4fbd8d,function(_0x48af61){if(_0x48af61){logger[_0xedde('0x2e')](_0xedde('0x2f'),_0x48af61);_0xb3362a(_0x48af61);}else{logger[_0xedde('0x30')](_0xedde('0x31'));odbc[_0xedde('0x32')](_0x750e2a,function(_0x3ef35e,_0x2c76c8){if(_0x3ef35e){logger[_0xedde('0x30')](_0xedde('0x33'),_0x750e2a);_0xb3362a(_0x3ef35e);}else{logger[_0xedde('0x30')](_0xedde('0x34'),_0x750e2a);odbc[_0xedde('0x35')](function(_0x3e3322){if(_0x3e3322){logger[_0xedde('0x2e')](_0xedde('0x36'),_0x3e3322);}_0xb3362a(null,_0x2c76c8);});}});}});};AGIVertices[_0xedde('0x11')][_0xedde('0x37')]=function(_0x2e3da4,_0x8802fa){this[_0xedde('0x17')][_0xedde('0x38')](_0x2e3da4)[_0xedde('0x14')](function(_0x4d7a84){_0x8802fa(null,_0x4d7a84?_0x4d7a84:![]);})[_0xedde('0x16')](function(_0x3120be){_0x8802fa(_0x3120be);});};AGIVertices[_0xedde('0x11')][_0xedde('0x39')]=function(_0x9d3d1c,_0x57cbfd){this['rpc'][_0xedde('0x39')](_0x9d3d1c)['then'](function(_0x4e1c7d){_0x57cbfd(null,_0x4e1c7d);})[_0xedde('0x16')](function(_0x225b68){_0x57cbfd(_0x225b68);});};AGIVertices[_0xedde('0x11')][_0xedde('0x3a')]=function(_0x4aa8b4,_0x42fa0f,_0x4a5c2f){this[_0xedde('0x17')][_0xedde('0x3a')]({'uniqueid':this[_0xedde('0x10')][_0xedde('0x3b')],'node':_0x4aa8b4['label'],'application':_0x4aa8b4[_0xedde('0x3c')],'data':_0x42fa0f||null,'project_name':this['channel'][_0xedde('0x3d')],'callerid':this[_0xedde('0x10')][_0xedde('0x3e')]})['then'](function(_0x347889){if(_0x4a5c2f){_0x4a5c2f(null,_0x347889);}})['catch'](function(_0xdd82b8){if(_0x4a5c2f){_0x4a5c2f(_0xdd82b8);}});};AGIVertices[_0xedde('0x11')][_0xedde('0x3f')]=function(_0x464760,_0x2a22d8,_0x571ad5,_0xadb0d8){this[_0xedde('0x17')][_0xedde('0x3f')]({'uniqueid':this[_0xedde('0x10')][_0xedde('0x3b')],'callerid':this[_0xedde('0x10')][_0xedde('0x3e')],'calleridname':this[_0xedde('0x10')][_0xedde('0x40')],'context':this[_0xedde('0x10')]['context'],'extension':this['channel'][_0xedde('0x41')],'priority':this[_0xedde('0x10')][_0xedde('0x42')],'accountcode':this['channel']['accountcode'],'dnid':this['channel'][_0xedde('0x43')],'projectName':this[_0xedde('0x10')][_0xedde('0x3d')],'saveName':_0x2a22d8,'filename':_0x464760[_0xedde('0x44')]||_0x2a22d8,'savePath':_0x571ad5})[_0xedde('0x14')](function(_0xecd12b){_0xadb0d8(null,_0xecd12b);})[_0xedde('0x16')](function(_0x57c62b){_0xadb0d8(_0x57c62b);});};AGIVertices[_0xedde('0x11')][_0xedde('0x45')]=function(_0x45b792,_0x16af5e,_0x4232c9){this['rpc'][_0xedde('0x45')]({'uniqueid':this['channel']['uniqueid'],'body':_0x45b792,'direction':_0x16af5e})[_0xedde('0x14')](function(_0x27bc51){if(_0x4232c9){_0x4232c9(null,_0x27bc51);}})[_0xedde('0x16')](function(_0x52a17a){if(_0x4232c9){_0x4232c9(_0x52a17a);}});};AGIVertices[_0xedde('0x11')][_0xedde('0x46')]=function(_0x1d9c4b,_0x119ca1){console['log'](_0xedde('0x47'),_0x1d9c4b);console['log'](_0xedde('0x48'),_0x119ca1);var _0x1c7309=0x0;if(_[_0xedde('0x49')](_0x1d9c4b,_0xedde('0x4a'))){if(!_[_0xedde('0x4b')](_0x1d9c4b[_0xedde('0x4a')])){var _0xb18fcb=_0x1d9c4b[_0xedde('0x4a')];console[_0xedde('0x4c')](_0xedde('0x4d'),_0xb18fcb);if(_0x1d9c4b['dialTimezone']=='CALLERID(dialTimezone)'){this[_0xedde('0x17')][_0xedde('0x4e')]({'phone':_0x1d9c4b['phone']})[_0xedde('0x14')](function(_0x352676){console['log'](_0xedde('0x4f'),_0x352676);_0x119ca1(null,_0x352676);});}else{console[_0xedde('0x4c')](_0xedde('0x50'),shared[_0xb18fcb]);}}}this[_0xedde('0x17')][_0xedde('0x46')]({'firstName':_[_0xedde('0x51')](_0x1d9c4b[_0xedde('0x15')])||_[_0xedde('0x4b')](_0x1d9c4b['name'])?_0xedde('0x52')+Math['random']():_0x1d9c4b['name'],'lastName':_[_0xedde('0x51')](_0x1d9c4b[_0xedde('0x53')])||_[_0xedde('0x4b')](_0x1d9c4b[_0xedde('0x53')])?null:_0x1d9c4b[_0xedde('0x53')],'phone':_0x1d9c4b[_0xedde('0x54')],'ListId':_0x1d9c4b[_0xedde('0x55')],'scheduledat':_0x1d9c4b['scheduledAt'],'callbackUniqueid':this[_0xedde('0x10')][_0xedde('0x3b')],'tags':_0xedde('0x56'),'description':_0xedde('0x57')+_0x1d9c4b[_0xedde('0x58')][_0xedde('0x59')](),'priority':_0x1d9c4b['callback_priority']})[_0xedde('0x14')](function(_0x4bb7be){_0x119ca1(null,_0x4bb7be);})[_0xedde('0x16')](function(_0x327b05){_0x119ca1(_0x327b05);});};AGIVertices['prototype'][_0xedde('0x5a')]=function(_0xe8f3c4,_0x42cb0a){this[_0xedde('0x17')][_0xedde('0x5b')](_0xe8f3c4)[_0xedde('0x14')](function(_0x3b8aaa){_0x42cb0a(null,_0x3b8aaa?_0x3b8aaa[_0xedde('0x15')]:![]);})[_0xedde('0x16')](function(_0x1e70af){_0x42cb0a(_0x1e70af);});};AGIVertices[_0xedde('0x11')][_0xedde('0x5c')]=function(_0x53bbff,_0x49577a,_0x2ad9b1){var _0x47f555={'role':'agent'};_0x47f555[_0x53bbff]=this[_0xedde('0x10')][_0xedde('0x3e')];this[_0xedde('0x17')]['agentPause'](_0x47f555,_0x49577a,this[_0xedde('0x10')][_0xedde('0x3b')])[_0xedde('0x14')](function(_0x514377){_0x2ad9b1(null,_['isNil'](_0x514377)?![]:!![]);})[_0xedde('0x16')](function(_0x22b26f){logger['error'](_0x22b26f);_0x2ad9b1(null,![]);});};AGIVertices[_0xedde('0x11')][_0xedde('0x5d')]=function(_0x51df79,_0x2fb10d){var _0x1dab83={'role':_0xedde('0x5e')};_0x1dab83[_0x51df79]=this[_0xedde('0x10')]['callerid'];this[_0xedde('0x17')][_0xedde('0x5d')](_0x1dab83)[_0xedde('0x14')](function(_0x2014c6){_0x2fb10d(null,_[_0xedde('0x4b')](_0x2014c6)?![]:!![]);})['catch'](function(_0x50c3a3){logger[_0xedde('0x2e')](_0x50c3a3);_0x2fb10d(null,![]);});};AGIVertices[_0xedde('0x11')][_0xedde('0x5f')]=function(_0x4dd5aa,_0x30b634){var _0x1439b4={'role':_0xedde('0x5e')};_0x1439b4[_0x4dd5aa]=this[_0xedde('0x10')][_0xedde('0x3e')];this[_0xedde('0x17')][_0xedde('0x5f')](_0x1439b4)[_0xedde('0x14')](function(_0x5c9a2f){_0x30b634(null,_['isNil'](_0x5c9a2f)?![]:!![]);})[_0xedde('0x16')](function(_0x21a9e5){logger['error'](_0x21a9e5);_0x30b634(null,![]);});};AGIVertices[_0xedde('0x11')][_0xedde('0x60')]=function(_0x5a1d98,_0x4fc555){var _0x380f69={'role':_0xedde('0x5e')};_0x380f69[_0x5a1d98]=this[_0xedde('0x10')][_0xedde('0x3e')];var _0xb7c76f=_0x5a1d98!=_0xedde('0x61')?util['format'](_0xedde('0x62'),_0xedde('0x63'),this[_0xedde('0x10')]['callerid']):undefined;this[_0xedde('0x17')]['agentLogin'](_0x380f69,_0xb7c76f)[_0xedde('0x14')](function(_0x4cae93){_0x4fc555(null,_['isNil'](_0x4cae93)?![]:!![]);})[_0xedde('0x16')](function(_0x192412){logger[_0xedde('0x2e')](_0x192412);_0x4fc555(null,![]);});};AGIVertices[_0xedde('0x11')][_0xedde('0x64')]=function(_0x46df96,_0x533554){sh['exec'](_['trim'](_0x46df96),function(_0x3c544a,_0x423d74){var _0x5c6827=_0x423d74['replace'](/(\r\n|\n|\r)/gm,'');_0x533554(null,_0x5c6827);});};AGIVertices[_0xedde('0x11')][_0xedde('0x65')]=function(_0x3d92b0,_0x2c60e1){scripts[_0xedde('0x65')](_0x3d92b0[_0xedde('0x66')],_0x3d92b0['google_cloud_tts_text_type']||'text',_0x3d92b0[_0xedde('0x67')],_0x3d92b0[_0xedde('0x68')]||_0xedde('0x69'),_0x3d92b0['ssmlGender']||_0xedde('0x6a'),_0x3d92b0[_0xedde('0x6b')]||_0xedde('0x6c'))['then'](function(_0x4202ac){_0x2c60e1(null,_0x4202ac);})[_0xedde('0x16')](function(_0x2cb2c0){_0x2c60e1(_0x2cb2c0);});};AGIVertices[_0xedde('0x11')][_0xedde('0x6d')]=function(_0x47cc06,_0x2da882){scripts[_0xedde('0x6d')](_0x47cc06[_0xedde('0x67')],_0x47cc06[_0xedde('0x6e')]||'en',0x1)[_0xedde('0x14')](function(_0x15b353){_0x2da882(null,_0x15b353);})[_0xedde('0x16')](function(_0x273a25){_0x2da882(_0x273a25);});};AGIVertices[_0xedde('0x11')][_0xedde('0x6f')]=function(_0x363df5,_0x1f8f8b){var _0x2ea4fa={'uri':_0x363df5[_0xedde('0x70')],'method':_0x363df5[_0xedde('0x71')],'json':!![],'resolveWithFullResponse':!![],'timeout':typeof parseInt(_0x363df5[_0xedde('0x72')])===_0xedde('0x73')&&parseInt(_0x363df5[_0xedde('0x72')])>=0x1?parseInt(_0x363df5['timeout'])*0x3e8:0x5*0x3e8};if(_[_0xedde('0x74')]([_0xedde('0x75'),_0xedde('0x76')],_0x2ea4fa[_0xedde('0x71')][_0xedde('0x77')]())){try{_0x2ea4fa['body']=_0x363df5[_0xedde('0x78')]?JSON[_0xedde('0x79')](_0x363df5['rawBody']):{};}catch(_0x264dfd){logger[_0xedde('0x2e')](_0xedde('0x7a'),_0x264dfd);}}try{_0x2ea4fa[_0xedde('0x7b')]=_0x363df5['rawHeaders']?JSON[_0xedde('0x79')](_0x363df5[_0xedde('0xc')]):{};}catch(_0x26daae){logger[_0xedde('0x2e')](_0xedde('0x7c'),_0x26daae);}if(_0x363df5[_0xedde('0x7d')]){try{var _0x1be4be=require(_0x363df5['computedVariables'])[_0xedde('0x7e')](this,_0x2ea4fa);_0x2ea4fa[_0xedde('0x7f')]=Mustache[_0xedde('0x80')](_0x363df5[_0xedde('0x70')],_0x1be4be,{},['$$','$$']);if(_0x2ea4fa[_0xedde('0x7b')]){_0x2ea4fa[_0xedde('0x7b')]=JSON['parse'](Mustache[_0xedde('0x80')](JSON[_0xedde('0x81')](_0x2ea4fa[_0xedde('0x7b')]),_0x1be4be,{},['$$','$$']));}if(_0x2ea4fa['body']){_0x2ea4fa['body']=JSON[_0xedde('0x79')](Mustache[_0xedde('0x80')](JSON['stringify'](_0x2ea4fa[_0xedde('0x82')]),_0x1be4be,{},['$$','$$']));}}catch(_0x2aa27a){logger[_0xedde('0x2e')]('An\x20incorrect\x20formatted\x20json\x20has\x20been\x20passed\x20to\x20the\x20function',_0x2aa27a);}}rp(_0x2ea4fa)['then'](function(_0x390b9){var _0x1ee03f={'statusCode':_0x390b9[_0xedde('0x83')]||0xc8,'statusMessage':_0x390b9[_0xedde('0x84')]||'OK','headers':_0x390b9['headers']||{},'body':_0x390b9[_0xedde('0x82')]||{}};_0x1f8f8b(null,_0x1ee03f);})[_0xedde('0x16')](function(_0x2be0c4){var _0x1971ed={'statusCode':_0x2be0c4[_0xedde('0x83')]||0x1f4,'statusMessage':_0x2be0c4['message']||'500\x20-\x20Internal\x20Server\x20Error','headers':_0x2be0c4[_0xedde('0x85')][_0xedde('0x7b')]||{},'body':_0x2be0c4['options']['body']||{}};_0x1f8f8b(null,_0x1971ed);});};AGIVertices[_0xedde('0x11')][_0xedde('0x86')]=function(_0x212eff,_0x13ec46){scripts[_0xedde('0x86')](this['channel'][_0xedde('0x3b')],_0x212eff[_0xedde('0x87')],_0x212eff[_0xedde('0x67')],_0x212eff[_0xedde('0x88')]||'en')[_0xedde('0x14')](function(_0x500b43){_0x13ec46(null,_0x500b43);})[_0xedde('0x16')](function(_0x20aa0e){_0x13ec46(_0x20aa0e);});};AGIVertices[_0xedde('0x11')]['sestekNDA']=function(_0x489bad,_0x4fdbab){scripts[_0xedde('0x89')](this[_0xedde('0x10')],_0x489bad)[_0xedde('0x14')](function(_0x2aafad){_0x4fdbab(null,_0x2aafad);})[_0xedde('0x16')](function(_0x44c078){_0x4fdbab(_0x44c078);});};AGIVertices[_0xedde('0x11')]['ispeechTTS']=function(_0x2b5e3b,_0x1abbf0){scripts[_0xedde('0x8a')](_0x2b5e3b['key'],_0x2b5e3b[_0xedde('0x67')],_0x2b5e3b[_0xedde('0x8b')]||'en-US',_0x2b5e3b[_0xedde('0x8c')])[_0xedde('0x14')](function(_0x29abb0){_0x1abbf0(null,_0x29abb0);})[_0xedde('0x16')](function(_0x5a5efd){_0x1abbf0(_0x5a5efd);});};AGIVertices[_0xedde('0x11')][_0xedde('0x8d')]=function(_0x17e0cc,_0x326009,_0x270949){scripts['ispeechASR'](_0x326009,_0x17e0cc[_0xedde('0x87')],_0x17e0cc['ispeech_asr_language']||_0xedde('0x69'),this[_0xedde('0x8e')](_0x17e0cc['model'])?_0x17e0cc['model']:undefined)['then'](function(_0x1dbf2d){_0x270949(null,_0x1dbf2d);})[_0xedde('0x16')](function(_0x1e569d){_0x270949(_0x1e569d);});};AGIVertices['prototype']['awsPolly']=function(_0x18db3b,_0x5cfbfc){scripts[_0xedde('0x8f')](_0x18db3b[_0xedde('0x90')],_0x18db3b[_0xedde('0x91')],_0x18db3b[_0xedde('0x92')],_0x18db3b['aws_polly_voice']||_0xedde('0x93'),_0x18db3b[_0xedde('0x67')],_0x18db3b['aws_text_type']||_0xedde('0x67'))[_0xedde('0x14')](function(_0x5a5350){_0x5cfbfc(null,_0x5a5350);})[_0xedde('0x16')](function(_0xd6aff7){_0x5cfbfc(_0xd6aff7);});};AGIVertices[_0xedde('0x11')][_0xedde('0x94')]=function(_0x5154c3,_0x2f63a9){scripts['awsLex'](this[_0xedde('0x10')]['uniqueid'],_0x5154c3['aws_access_key_id'],_0x5154c3['aws_secret_access_key'],_0x5154c3[_0xedde('0x95')],_0x5154c3[_0xedde('0x67')],_0x5154c3['aws_bot_name'])[_0xedde('0x14')](function(_0x11e015){_0x2f63a9(null,_0x11e015);})[_0xedde('0x16')](function(_0x19358c){_0x2f63a9(_0x19358c);});};AGIVertices[_0xedde('0x11')][_0xedde('0x96')]=function(_0x1ffaf5,_0x317388,_0x112c5a){scripts[_0xedde('0x96')](_0x317388,_0x1ffaf5[_0xedde('0x87')],_0x1ffaf5[_0xedde('0x97')]||_0xedde('0x69'))[_0xedde('0x14')](function(_0x2fa793){_0x112c5a(null,_0x2fa793);})['catch'](function(_0x4427a6){_0x112c5a(_0x4427a6);});};AGIVertices[_0xedde('0x11')][_0xedde('0x98')]=function(_0x4bae7a,_0x122e9c,_0x48dc10){scripts['tildeASR'](_0x122e9c,_0x4bae7a[_0xedde('0x99')],_0x4bae7a[_0xedde('0x9a')],_0x4bae7a[_0xedde('0x7f')])['then'](function(_0x39e9eb){_0x48dc10(null,_0x39e9eb);})['catch'](function(_0x7c6f0e){_0x48dc10(_0x7c6f0e);});};AGIVertices[_0xedde('0x11')][_0xedde('0x9b')]=function(_0x557225){var _0x13300b=_['includes'](verticesWithRetry,_0x557225[_0xedde('0x3c')])?_0x557225:_[_0xedde('0x9c')](_0x557225);for(var _0xeef56d in _0x13300b){if(_0x13300b[_0xedde('0x9d')](_0xeef56d)){if(_0x13300b[_0xeef56d]&&_['isString'](_0x13300b[_0xeef56d])){if(_['includes'](recursiveMapAttributes,_0xeef56d)){_0x13300b[_0xeef56d]=this[_0xedde('0x9e')](_0x13300b[_0xeef56d]);}else{_0x13300b[_0xeef56d]=this[_0xedde('0x9f')](_0x13300b[_0xeef56d]);}}}}return _0x13300b;};AGIVertices[_0xedde('0x11')][_0xedde('0xa0')]=function(_0x27f48d){for(var _0x50c8ca in _0x27f48d){if(_0x27f48d[_0xedde('0x9d')](_0x50c8ca)){if(_['isPlainObject'](_0x27f48d[_0x50c8ca])){this[_0xedde('0xa0')](_0x27f48d[_0x50c8ca]);}else if(_[_0xedde('0xa1')](_0x27f48d[_0x50c8ca])){for(var _0x408fc4=0x0;_0x408fc4<_0x27f48d[_0x50c8ca][_0xedde('0xa2')];_0x408fc4++){this[_0xedde('0xa0')](_0x27f48d[_0x50c8ca][_0x408fc4]);}}else if(_[_0xedde('0xa3')](_0x27f48d[_0x50c8ca])){_0x27f48d[_0x50c8ca]=this['replaceAllVariables'](_0x27f48d[_0x50c8ca]);}}}};AGIVertices[_0xedde('0x11')][_0xedde('0xa4')]=function(_0x29d0a3,_0x6097f2){for(var _0x564d6a in _0x29d0a3){if(_0x29d0a3[_0xedde('0x9d')](_0x564d6a)){if(_[_0xedde('0xa5')](_0x29d0a3[_0x564d6a])){if(!_[_0xedde('0x51')](_0x29d0a3[_0x564d6a])){this[_0xedde('0xa4')](_0x29d0a3[_0x564d6a],util[_0xedde('0x2b')]('%s.%s',_0x6097f2,_0x564d6a));}}else if(_[_0xedde('0xa1')](_0x29d0a3[_0x564d6a])){for(var _0x46c236=0x0;_0x46c236<_0x29d0a3[_0x564d6a]['length'];_0x46c236++){this[_0xedde('0xa4')](_0x29d0a3[_0x564d6a][_0x46c236],util[_0xedde('0x2b')](_0xedde('0xa6'),_0x6097f2,_0x564d6a+'['+_0x46c236+']'));}}else{if(!_['isNil'](_0x29d0a3[_0x564d6a])){this[_0xedde('0x10')][_0xedde('0xa7')](util['format'](_0xedde('0xa6'),_0x6097f2,_0x564d6a),_0x29d0a3[_0x564d6a]);}}}}};AGIVertices[_0xedde('0x11')][_0xedde('0x9e')]=function(_0x32e51f){try{var _0x2a8e4b=JSON['parse'](_0x32e51f);this[_0xedde('0xa0')](_0x2a8e4b);return JSON[_0xedde('0x81')](_0x2a8e4b);}catch(_0x1ea148){return this['replaceAllVariables'](_0x32e51f);}};AGIVertices[_0xedde('0x11')][_0xedde('0x9f')]=function(_0x267c2e){console['log'](_0xedde('0xa8'),_0x267c2e);var _0x544812=_0x267c2e['split']('{');for(var _0x3efa02=0x1;_0x3efa02<_0x544812[_0xedde('0xa2')];_0x3efa02+=0x1){var _0x51e966=_0x544812[_0x3efa02][_0xedde('0xa9')]('}');console[_0xedde('0x4c')](_0xedde('0xaa'),_0x51e966);if(_0x51e966[_0xedde('0xa2')]>0x1){_0x267c2e=_0x267c2e['replaceAll']('{'+_0x51e966[0x0]+'}',this[_0xedde('0x10')]['getVariable'](_0x51e966[0x0])[_0xedde('0xab')]||_0x51e966[0x0]);}}if(_0x544812[_0xedde('0xa2')]===0x1){return _0x267c2e['toString']();}console['log']('replaceall\x20end',_0x267c2e);return this[_0xedde('0x9f')](_0x267c2e);};AGIVertices[_0xedde('0x11')]['getAndSetVariable']=function(_0x16b924,_0x20c485){var _0x4cd5f9=this['channel'][_0xedde('0x12')](_0x16b924);if(_0x4cd5f9['result']===-0x1){return _0x4cd5f9;}logger['info'](util[_0xedde('0x2b')](_0xedde('0xac'),_0x20c485,_0x4cd5f9[_0xedde('0xab')]));return this[_0xedde('0x10')][_0xedde('0xa7')](_0x20c485,_0x4cd5f9[_0xedde('0xab')]);};AGIVertices['prototype'][_0xedde('0x8e')]=function(_0x56392c){return _0x56392c&&_0x56392c!=='0'&&_0x56392c!=='-1'&&_0x56392c!=='';};AGIVertices[_0xedde('0x11')][_0xedde('0xad')]=function(_0x3c33b7){this[_0xedde('0x3a')]['sync'](this,_0x3c33b7,'-');_0x3c33b7[_0xedde('0xae')]=_0x3c33b7[_0xedde('0xad')];return{'code':0xc8,'result':'-'};};AGIVertices[_0xedde('0x11')][_0xedde('0xaf')]=function(_0x398f57){logger['info'](util[_0xedde('0x2b')](_0xedde('0xb0'),_0x398f57[_0xedde('0xb1')]));if(!this[_0xedde('0x8e')](_0x398f57[_0xedde('0x67')])){return this['channel'][_0xedde('0xb2')]('no\x20text\x20configured');}var _0x24acf2='\x22'+_0x398f57[_0xedde('0x67')]+'\x22';if(this[_0xedde('0x8e')](_0x398f57[_0xedde('0x85')])){_0x24acf2+=','+_0x398f57['options'];}var _0x2c4c06=this[_0xedde('0x10')][_0xedde('0xb3')]('MRCPSynth',_0x24acf2);if(_0x2c4c06[_0xedde('0xb4')]===-0x1){return _0x2c4c06;}return this[_0xedde('0x10')][_0xedde('0xb2')](util['format'](_0xedde('0xb5'),_0x24acf2));};AGIVertices[_0xedde('0x11')][_0xedde('0xb6')]=function(_0x1f7c8d){logger[_0xedde('0x30')](util[_0xedde('0x2b')]('Enter\x20in\x20MRCPRecog\x20(%s)\x20block',_0x1f7c8d[_0xedde('0xb1')]));if(!this[_0xedde('0x8e')](_0x1f7c8d[_0xedde('0xb7')])){return this[_0xedde('0x10')][_0xedde('0xb2')](_0xedde('0xb8'));}var _0x2c5454=_0x1f7c8d[_0xedde('0xb7')];if(this[_0xedde('0x8e')](_0x1f7c8d[_0xedde('0x85')])){_0x2c5454+=','+_0x1f7c8d[_0xedde('0x85')];}var _0x362ced=this[_0xedde('0x10')][_0xedde('0xb3')](_0xedde('0xb9'),_0x2c5454);if(_0x362ced[_0xedde('0xb4')]===-0x1){return _0x362ced;}var _0x20f1b9=this[_0xedde('0xba')](_0xedde('0xbb'),'MRCP_RECOG_CONFIDENCE');if(_0x20f1b9[_0xedde('0xb4')]===-0x1){return _0x20f1b9;}var _0x14eab1=this['getAndSetVariable'](_0xedde('0xbc'),_0xedde('0xbd'));if(_0x14eab1[_0xedde('0xb4')]===-0x1){return _0x14eab1;}var _0x2794fb=this[_0xedde('0xba')]('RECOG_INSTANCE()',_0xedde('0xbe'));if(_0x2794fb[_0xedde('0xb4')]===-0x1){return _0x2794fb;}return this[_0xedde('0x10')][_0xedde('0xb2')](util[_0xedde('0x2b')](_0xedde('0xbf'),_0x2c5454));};AGIVertices[_0xedde('0x11')]['agi']=function(_0x177827){logger[_0xedde('0x30')](util[_0xedde('0x2b')]('Enter\x20in\x20AGI\x20(%s)\x20block',_0x177827['label']));return this['channel'][_0xedde('0x7')]([_0x177827[_0xedde('0xc0')],_0x177827[_0xedde('0xc1')]]);};AGIVertices['prototype'][_0xedde('0xc2')]=function(_0x23541e){logger[_0xedde('0x30')](util['format']('Enter\x20in\x20ANSWER\x20(%s)\x20block',_0x23541e['label']));if(this[_0xedde('0x8e')](_0x23541e[_0xedde('0x72')])){logger['info'](util[_0xedde('0x2b')](_0xedde('0xc3'),_0x23541e[_0xedde('0x72')]));var _0xb4523c=this['channel'][_0xedde('0xc4')](_0x23541e[_0xedde('0x72')]);if(_0xb4523c[_0xedde('0xb4')]===-0x1){return _0xb4523c;}}return this[_0xedde('0x10')][_0xedde('0xc2')]();};AGIVertices[_0xedde('0x11')][_0xedde('0x56')]=function(_0x4ba3c8){console[_0xedde('0x4c')](_0xedde('0xc5'),_0x4ba3c8);logger[_0xedde('0x30')](util['format'](_0xedde('0xc6'),_0x4ba3c8['label']));if(!this[_0xedde('0x8e')](_0x4ba3c8[_0xedde('0x55')])){return this['channel'][_0xedde('0x2e')](_0x4ba3c8,'no\x20list\x20selected');}_0x4ba3c8[_0xedde('0x58')]=moment();if(this[_0xedde('0x8e')](_0x4ba3c8['delay'])){_0x4ba3c8[_0xedde('0x58')]=moment()[_0xedde('0xc7')](_0x4ba3c8['delay'],_0xedde('0xc8'));}if(!this[_0xedde('0x8e')](_0x4ba3c8[_0xedde('0xc9')])){_0x4ba3c8[_0xedde('0xc9')]=0x2;}console[_0xedde('0x4c')](_0xedde('0xca'),_0x4ba3c8);this[_0xedde('0x46')]['sync'](this,_0x4ba3c8);return this[_0xedde('0x10')][_0xedde('0xb2')](util[_0xedde('0x2b')](_0xedde('0xcb'),_0x4ba3c8[_0xedde('0x54')],_0x4ba3c8[_0xedde('0x55')],_0x4ba3c8['scheduledAt']));};AGIVertices[_0xedde('0x11')][_0xedde('0xcc')]=function(_0xab3c6f){logger[_0xedde('0x30')](util[_0xedde('0x2b')](_0xedde('0xcd'),_0xab3c6f[_0xedde('0xb1')]));var _0x35b5e6=this[_0xedde('0x10')][_0xedde('0xb3')](_0xab3c6f['application'],_0xab3c6f[_0xedde('0x85')]);if(_0x35b5e6[_0xedde('0xb4')]===-0x1){return _0x35b5e6;}return this['channel'][_0xedde('0xb2')](util['format']('Executed\x20command\x20%s\x20%s',_0xab3c6f['application'],_0xab3c6f[_0xedde('0x85')]));};AGIVertices[_0xedde('0x11')][_0xedde('0xce')]=function(_0x4b2b8f){logger['info'](util[_0xedde('0x2b')](_0xedde('0xcf'),_0x4b2b8f['label']));if(!this[_0xedde('0x8e')](_0x4b2b8f['text'])){return this['channel'][_0xedde('0xb2')]('no\x20text\x20configured');}var _0x1f7fd4='\x22'+_0x4b2b8f[_0xedde('0x67')]+'\x22';if(this[_0xedde('0x8e')](_0x4b2b8f[_0xedde('0x85')])){_0x1f7fd4+=','+_0x4b2b8f['options'];}var _0x24de14=this[_0xedde('0x10')][_0xedde('0xb3')]('MRCPSynth',_0x1f7fd4);if(_0x24de14[_0xedde('0xb4')]===-0x1){return _0x24de14;}return this[_0xedde('0x10')][_0xedde('0xb2')](util['format'](_0xedde('0xb5'),_0x1f7fd4));};AGIVertices[_0xedde('0x11')]['sestektts']=function(_0x3435f3){logger['info'](util['format'](_0xedde('0xd0'),_0x3435f3[_0xedde('0xb1')]));if(!this[_0xedde('0x8e')](_0x3435f3['text'])){return this[_0xedde('0x10')][_0xedde('0xb2')](_0xedde('0xd1'));}var _0x1e50d1='\x22'+_0x3435f3[_0xedde('0x67')]+'\x22';if(this[_0xedde('0x8e')](_0x3435f3[_0xedde('0x85')])){_0x1e50d1+=','+_0x3435f3[_0xedde('0x85')];}var _0x1a12cf=this['channel'][_0xedde('0xb3')](_0xedde('0xd2'),_0x1e50d1);if(_0x1a12cf[_0xedde('0xb4')]===-0x1){return _0x1a12cf;}return this['channel']['noop'](util[_0xedde('0x2b')]('Executed\x20command\x20MRCPSynth\x20%s',_0x1e50d1));};AGIVertices[_0xedde('0x11')]['lumenvoxasr']=function(_0x4af9e1){logger[_0xedde('0x30')](util[_0xedde('0x2b')](_0xedde('0xd3'),_0x4af9e1['label']));if(!this['isConfigured'](_0x4af9e1['grammar'])){return this['channel'][_0xedde('0xb2')](_0xedde('0xb8'));}var _0x2c5746=_0x4af9e1['grammar'];if(this[_0xedde('0x8e')](_0x4af9e1[_0xedde('0x85')])){_0x2c5746+=','+_0x4af9e1[_0xedde('0x85')];}var _0xad0777=this['channel'][_0xedde('0xb3')]('MRCPRecog',_0x2c5746);if(_0xad0777['result']===-0x1){return _0xad0777;}var _0x319049=this[_0xedde('0xba')]('RECOG_CONFIDENCE()','LUMENVOX_ASR_CONFIDENCE');if(_0x319049[_0xedde('0xb4')]===-0x1){return _0x319049;}var _0x4b8880=this[_0xedde('0xba')](_0xedde('0xbc'),_0xedde('0xd4'));if(_0x4b8880[_0xedde('0xb4')]===-0x1){return _0x4b8880;}var _0x2d6d65=this[_0xedde('0xba')](_0xedde('0xd5'),_0xedde('0xd6'));if(_0x2d6d65[_0xedde('0xb4')]===-0x1){return _0x2d6d65;}return this[_0xedde('0x10')][_0xedde('0xb2')](util[_0xedde('0x2b')](_0xedde('0xbf'),_0x2c5746));};AGIVertices[_0xedde('0x11')][_0xedde('0xd7')]=function(_0x27f15c){logger[_0xedde('0x30')](util[_0xedde('0x2b')](_0xedde('0xd8'),_0x27f15c[_0xedde('0xb1')]));if(!this['isConfigured'](_0x27f15c[_0xedde('0xb7')])){return this[_0xedde('0x10')][_0xedde('0xb2')]('no\x20grammar\x20configured');}var _0x391d38=_0x27f15c['grammar'];if(this[_0xedde('0x8e')](_0x27f15c[_0xedde('0x85')])){_0x391d38+=','+_0x27f15c[_0xedde('0x85')];}var _0x423482=this[_0xedde('0x10')][_0xedde('0xb3')](_0xedde('0xb9'),_0x391d38);if(_0x423482['result']===-0x1){return _0x423482;}var _0x2f2bc1=this[_0xedde('0xba')](_0xedde('0xbb'),'SESTEK_ASR_CONFIDENCE');if(_0x2f2bc1[_0xedde('0xb4')]===-0x1){return _0x2f2bc1;}var _0x55423a=this[_0xedde('0xba')](_0xedde('0xbc'),_0xedde('0xd9'));if(_0x55423a['result']===-0x1){return _0x55423a;}var _0x1fb6d3=this[_0xedde('0xba')](_0xedde('0xd5'),_0xedde('0xda'));if(_0x1fb6d3[_0xedde('0xb4')]===-0x1){return _0x1fb6d3;}return this['channel'][_0xedde('0xb2')](util[_0xedde('0x2b')]('Executed\x20command\x20MRCPRecog\x20%s',_0x391d38));};AGIVertices['prototype'][_0xedde('0xdb')]=function(_0x2b3178){logger[_0xedde('0x30')](util[_0xedde('0x2b')](_0xedde('0xdc'),_0x2b3178[_0xedde('0xb1')]));if(!this[_0xedde('0x8e')](_0x2b3178[_0xedde('0xdd')])){return this[_0xedde('0x10')]['error'](_0x2b3178,_0xedde('0xde'));}var _0x1e0a79=this[_0xedde('0x1b')]['sync'](this,_0x2b3178[_0xedde('0xdd')]);if(!_0x1e0a79){return this[_0xedde('0x10')]['error'](_0x2b3178,_0xedde('0xdf'));}if(!this[_0xedde('0x8e')](_0x2b3178[_0xedde('0x32')])){return this[_0xedde('0x10')][_0xedde('0x2e')](_0x2b3178,_0xedde('0xe0'));}var _0x53bc21=_0x2b3178['query'][_0xedde('0xe1')](/(\r\n|\n|\r)/gm,'\x20');this[_0xedde('0x10')][_0xedde('0xb2')](util[_0xedde('0x2b')](_0xedde('0xe2'),_0x53bc21));var _0x1c1d51=this['getQueryOdbc'][_0xedde('0x7e')](this,_0x1e0a79,_0x53bc21);this[_0xedde('0x3a')][_0xedde('0x7e')](this,_0x2b3178,_0x53bc21);if(!this[_0xedde('0x8e')](_0x2b3178['variable_id'])){return this[_0xedde('0x10')][_0xedde('0xb2')](_0xedde('0xe3'));}var _0x1bebb1=this[_0xedde('0x12')][_0xedde('0x7e')](this,_0x2b3178[_0xedde('0xe4')]);if(!_0x1bebb1){return this[_0xedde('0x10')]['error'](_0x2b3178,'no\x20variable\x20found');}var _0x3322eb=this;_0x1c1d51[_0xedde('0xe5')](function(_0x3c029b,_0x44ef36){Object[_0xedde('0xe6')](_0x3c029b)['forEach'](function(_0x261119){_0x3322eb[_0xedde('0x10')][_0xedde('0xa7')](util['format']('%s[%s][%s]',_0x1bebb1,_0x44ef36,_0x261119),_0x3c029b[_0x261119]);});});this[_0xedde('0x10')][_0xedde('0xa7')](util[_0xedde('0x2b')]('%s_ROWS_COUNT',_0x1bebb1),_0x1c1d51['length']);return this['channel'][_0xedde('0xb2')](util[_0xedde('0x2b')](_0xedde('0xe7'),_0x1bebb1));};AGIVertices[_0xedde('0x11')][_0xedde('0xe8')]=function(_0x2526e5){logger[_0xedde('0xe9')](util[_0xedde('0x2b')](_0xedde('0xea'),_0x2526e5[_0xedde('0xb1')]));if(!this[_0xedde('0x8e')](_0x2526e5[_0xedde('0xeb')])){return this[_0xedde('0x10')]['error'](_0x2526e5,'no\x20user\x20selected');}var _0x2fc8b0=this['getUser'][_0xedde('0x7e')](this,_0x2526e5[_0xedde('0xeb')]);if(!_0x2fc8b0){return this['channel'][_0xedde('0x2e')](_0x2526e5,'no\x20user\x20found');}var _0x31b653=this['channel'][_0xedde('0xb3')](_0xedde('0xec'),[util['format']('SIP/%s',_0x2fc8b0),_0x2526e5[_0xedde('0x72')],_0x2526e5[_0xedde('0xed')],_0x2526e5[_0xedde('0x70')]]);if(_0x31b653[_0xedde('0xb4')]===-0x1){return _0x31b653;}return this[_0xedde('0x10')]['noop'](util['format'](_0xedde('0xee'),_0xedde('0xec')));};AGIVertices[_0xedde('0x11')][_0xedde('0xef')]=function(_0x5e45c0){logger['info'](util[_0xedde('0x2b')](_0xedde('0xf0'),_0x5e45c0[_0xedde('0xb1')]));if(!this[_0xedde('0x8e')](_0x5e45c0['key'])){return this[_0xedde('0x10')][_0xedde('0xb2')](_0xedde('0xf1'));}if(!this['isConfigured'](_0x5e45c0['text'])){return this['channel'][_0xedde('0xb2')]('no\x20text\x20configured');}this[_0xedde('0x10')][_0xedde('0xf2')]=!![];this[_0xedde('0x3a')](_0x5e45c0);this['createSquareMessage'](_0x5e45c0[_0xedde('0x67')],'in');this[_0xedde('0x10')][_0xedde('0xb2')](util[_0xedde('0x2b')](_0xedde('0xf3'),_0x5e45c0['text']));var _0x5958ce=this['googleDialogflow']['sync'](this,_0x5e45c0);if(_0x5958ce){for(var _0x2cb507 in _0x5958ce){if(_0x5958ce[_0xedde('0x9d')](_0x2cb507)){this[_0xedde('0x10')]['setVariable'](util[_0xedde('0x2b')](_0xedde('0xf4'),_0x2cb507['toUpperCase']()),_0x5958ce[_0x2cb507]);}}this[_0xedde('0x45')](_0x5958ce[_0xedde('0xf5')],_0xedde('0xf6'));return this['channel'][_0xedde('0xb2')](util[_0xedde('0x2b')]('Dialogflow\x20Result\x20%s',_0x5958ce[_0xedde('0xf5')]));}return this[_0xedde('0x10')][_0xedde('0x2e')](_0x5e45c0,_0xedde('0xf7'));};AGIVertices[_0xedde('0x11')][_0xedde('0xf8')]=function(_0x5275a5){logger['info'](util[_0xedde('0x2b')](_0xedde('0xf9'),_0x5275a5['label']));if(!this['isConfigured'](_0x5275a5[_0xedde('0xfa')])){return this['channel'][_0xedde('0xb2')]('no\x20ndauth\x20url\x20configured');}if(!this[_0xedde('0x8e')](_0x5275a5[_0xedde('0xfb')])){return this[_0xedde('0x10')][_0xedde('0xb2')](_0xedde('0xfc'));}if(!this[_0xedde('0x8e')](_0x5275a5[_0xedde('0xfd')])){return this[_0xedde('0x10')][_0xedde('0xb2')](_0xedde('0xfe'));}if(!this[_0xedde('0x8e')](_0x5275a5[_0xedde('0xff')])){return this[_0xedde('0x10')]['noop'](_0xedde('0xd1'));}this[_0xedde('0x10')][_0xedde('0xf2')]=!![];this[_0xedde('0x3a')](_0x5275a5);this[_0xedde('0x45')](_0x5275a5[_0xedde('0x67')],'in');this['channel'][_0xedde('0xb2')](util[_0xedde('0x2b')](_0xedde('0x100'),_0x5275a5[_0xedde('0x67')]));var _0x28f7de=this['sestekNDA'][_0xedde('0x7e')](this,_0x5275a5);if(_0x28f7de){for(var _0x137713 in _0x28f7de){if(_0x28f7de['hasOwnProperty'](_0x137713)){this[_0xedde('0x10')][_0xedde('0xa7')](util[_0xedde('0x2b')](_0xedde('0x101'),_0x137713[_0xedde('0x77')]()),_0x28f7de[_0x137713]);}}this['createSquareMessage'](_0x28f7de[_0xedde('0xf5')],'out');if(_0x28f7de[_0xedde('0x102')]){this[_0xedde('0x10')][_0xedde('0xb2')](util[_0xedde('0x2b')](_0xedde('0x103'),_0x28f7de[_0xedde('0x102')]));var _0xd24882=this['channel'][_0xedde('0x104')](_0x28f7de['audiofile']);try{fs[_0xedde('0x105')](_0x28f7de[_0xedde('0x102')]+_0xedde('0x106'));}catch(_0x1ed47c){logger['error'](_0x1ed47c);}return _0xd24882;}else{return this[_0xedde('0x10')][_0xedde('0xb2')](util[_0xedde('0x2b')](_0xedde('0x107'),_0x28f7de[_0xedde('0xf5')]));}}return this['channel']['error'](_0x5275a5,_0xedde('0x108'));};AGIVertices[_0xedde('0x11')]['end']=function(_0x1297b){logger[_0xedde('0x30')](util['format']('Enter\x20in\x20END\x20(%s)\x20block',_0x1297b[_0xedde('0xb1')]));return this[_0xedde('0x10')][_0xedde('0xb2')](_0xedde('0x109'));};AGIVertices[_0xedde('0x11')][_0xedde('0x10a')]=function(_0x43b526){logger[_0xedde('0x30')](util[_0xedde('0x2b')](_0xedde('0x10b'),_0x43b526[_0xedde('0xb1')]));var _0x57383b='';if(_0x43b526[_0xedde('0x10c')]){if(!this[_0xedde('0x8e')](_0x43b526['trunk_id'])){return this[_0xedde('0x10')]['error'](_0x43b526,'no\x20trunk\x20selected');}else{var _0x39f74f=parseInt(_0x43b526[_0xedde('0x10c')],0xa);if(isNaN(_0x39f74f)){_0x57383b=_0x43b526[_0xedde('0x10c')];}else{_0x57383b=this['getTrunk'][_0xedde('0x7e')](this,_0x43b526[_0xedde('0x10c')]);if(!_0x57383b){return this[_0xedde('0x10')]['error'](_0x43b526,_0xedde('0x10d'));}}}}else if(_0x43b526[_0xedde('0x10e')]){_0x57383b=_0x43b526[_0xedde('0x10e')];}else{return this[_0xedde('0x10')][_0xedde('0x2e')](_0x43b526,_0xedde('0x10f'));}var _0x308ffa=this['channel']['exec'](_0xedde('0xec'),[util[_0xedde('0x2b')](_0xedde('0x110'),_0x57383b,_0x43b526['phone']),_0x43b526[_0xedde('0x72')],_0x43b526[_0xedde('0xed')],_0x43b526[_0xedde('0x70')]]);if(_0x308ffa[_0xedde('0xb4')]===-0x1){return _0x308ffa;}return this['channel'][_0xedde('0xb2')](util['format'](_0xedde('0xee'),_0xedde('0xec')));};AGIVertices['prototype']['finally']=function(_0x29feab){logger[_0xedde('0x30')](util['format'](_0xedde('0x111'),_0x29feab['label']));return this[_0xedde('0x10')][_0xedde('0xb2')]('finally');};AGIVertices[_0xedde('0x11')][_0xedde('0xe')]=function(_0xceef23){logger[_0xedde('0x30')](util['format'](_0xedde('0x112'),_0xceef23[_0xedde('0xb1')]));if(_0xceef23[_0xedde('0xae')]===0x0){return this[_0xedde('0xad')](_0xceef23);}_0xceef23[_0xedde('0xae')]-=0x1;if(!this[_0xedde('0x8e')](_0xceef23[_0xedde('0x113')])){return this[_0xedde('0x10')][_0xedde('0x2e')](_0xceef23,_0xedde('0x114'));}var _0x4fa1c5=this[_0xedde('0x115')]['sync'](this,_0xceef23['file_id']);if(!_0x4fa1c5){return this[_0xedde('0x10')][_0xedde('0x2e')](_0xceef23,_0xedde('0x116'));}if(!this['isConfigured'](_0xceef23['variable_id'])){return this[_0xedde('0x10')][_0xedde('0x2e')]('no\x20variable\x20selected\x20for\x20the\x20result');}var _0x3a2b10=this[_0xedde('0x10')][_0xedde('0x117')](_0x4fa1c5,_0xceef23[_0xedde('0x118')],_0xceef23[_0xedde('0x119')]);var _0x33c7eb=_0x3a2b10[_0xedde('0xb4')]?_0x3a2b10[_0xedde('0xb4')][_0xedde('0x59')]():'';logger['info'](_0xedde('0x11a'),JSON[_0xedde('0x81')](_0x3a2b10));if(_0x3a2b10[_0xedde('0xb4')]===-0x1){this['createSquareDetailsReport'][_0xedde('0x7e')](this,_0xceef23,_0x33c7eb);return _0x3a2b10;}else if(_0x3a2b10['extra']===_0xedde('0x72')){_0x3a2b10['result']=_0x33c7eb[_0xedde('0xa2')]>=parseInt(_0xceef23[_0xedde('0x11b')])?'x':'i';}else{_0x3a2b10['result']=_0x33c7eb[_0xedde('0xa2')]>=parseInt(_0xceef23['mindigit'])&&_0x33c7eb['length']<=parseInt(_0xceef23[_0xedde('0x119')])?'x':'i';}var _0x4a987c=this[_0xedde('0x12')][_0xedde('0x7e')](this,_0xceef23[_0xedde('0xe4')]);if(!_0x4a987c){return this['channel'][_0xedde('0x2e')](_0xceef23,_0xedde('0x11c'));}this[_0xedde('0x10')][_0xedde('0xa7')](_0x4a987c,_0x33c7eb);if(this[_0xedde('0x8e')](_0xceef23[_0xedde('0x11d')])){var _0x5320b6=parseInt(_0xceef23[_0xedde('0x11d')],0xa);var _0x8fa85e=rs[_0xedde('0x11e')]({'charset':'*','length':_0x5320b6});var _0xdcd35c=_0x33c7eb[_0xedde('0xa2')];if(_0xdcd35c>0x0){if(_0xdcd35c>_0x5320b6){this['createSquareDetailsReport']['sync'](this,_0xceef23,_0xceef23[_0xedde('0x11f')]==='first'?_0x8fa85e+_0x33c7eb['substr'](_0x5320b6):_0x33c7eb[_0xedde('0x120')](0x0,_0xdcd35c-_0x5320b6)+_0x8fa85e);}else{this[_0xedde('0x3a')][_0xedde('0x7e')](this,_0xceef23,rs[_0xedde('0x11e')]({'charset':'*','length':_0xdcd35c}));}}else{this[_0xedde('0x3a')][_0xedde('0x7e')](this,_0xceef23,'');}}else{this[_0xedde('0x3a')][_0xedde('0x7e')](this,_0xceef23,_0x33c7eb);}return _0x3a2b10;};AGIVertices[_0xedde('0x11')][_0xedde('0xf')]=function(_0x289022){logger['info'](util[_0xedde('0x2b')]('Enter\x20in\x20GETSECRETDIGITS\x20(%s)\x20block',_0x289022[_0xedde('0xb1')]));return this[_0xedde('0xe')](_0x289022);};AGIVertices[_0xedde('0x11')][_0xedde('0x121')]=function(_0x14e145){logger[_0xedde('0x30')](util[_0xedde('0x2b')](_0xedde('0x122'),_0x14e145['label']));this[_0xedde('0x3a')][_0xedde('0x7e')](this,_0x14e145,_0x14e145[_0xedde('0x123')]);return this[_0xedde('0x10')][_0xedde('0xb2')](util['format'](_0xedde('0x124'),_0x14e145['goalname']));};AGIVertices[_0xedde('0x11')][_0xedde('0x125')]=function(_0x31b2c0){logger[_0xedde('0x30')](util['format']('[AGI]\x20Enter\x20in\x20AWSPOLLY\x20(%s)\x20block',_0x31b2c0[_0xedde('0xb1')]));if(!this[_0xedde('0x8e')](_0x31b2c0[_0xedde('0x90')])||!this[_0xedde('0x8e')](_0x31b2c0[_0xedde('0x91')])){return this['channel'][_0xedde('0xb2')](_0xedde('0x126'));}if(!this[_0xedde('0x8e')](_0x31b2c0[_0xedde('0x67')])){return this['channel'][_0xedde('0xb2')](_0xedde('0xd1'));}this['channel']['noop'](util[_0xedde('0x2b')]('Trying\x20aws\x20Polly\x20%s',_0x31b2c0[_0xedde('0x67')]));var _0x3bde46=this[_0xedde('0x8f')]['sync'](this,_0x31b2c0);if(_0x3bde46){this[_0xedde('0x10')]['noop'](util[_0xedde('0x2b')](_0xedde('0x127'),_0x3bde46));var _0x5bf4e1=this[_0xedde('0x10')]['streamFile'](_0x3bde46);try{fs['unlink'](_0x3bde46+_0xedde('0x106'));}catch(_0x1950fd){logger['error'](_0x1950fd);}return _0x5bf4e1;}return this['channel'][_0xedde('0x2e')](_0x31b2c0,_0xedde('0x128'));};AGIVertices[_0xedde('0x11')][_0xedde('0x129')]=function(_0x1f5612){logger[_0xedde('0x30')](util[_0xedde('0x2b')](_0xedde('0x12a'),_0x1f5612[_0xedde('0xb1')]));if(!this[_0xedde('0x8e')](_0x1f5612[_0xedde('0x90')])||!this[_0xedde('0x8e')](_0x1f5612[_0xedde('0x91')])){return this['channel'][_0xedde('0xb2')](_0xedde('0x126'));}if(!this[_0xedde('0x8e')](_0x1f5612[_0xedde('0x12b')])){return this[_0xedde('0x10')][_0xedde('0xb2')](_0xedde('0x12c'));}if(!this['isConfigured'](_0x1f5612['text'])){return this[_0xedde('0x10')]['noop'](_0xedde('0xd1'));}this[_0xedde('0x10')][_0xedde('0xf2')]=!![];this[_0xedde('0x3a')](_0x1f5612);this[_0xedde('0x45')](_0x1f5612[_0xedde('0x67')],'in');this[_0xedde('0x10')]['noop'](util[_0xedde('0x2b')](_0xedde('0x12d'),_0x1f5612[_0xedde('0x67')]));var _0x2c605c=this[_0xedde('0x94')][_0xedde('0x7e')](this,_0x1f5612);if(_0x2c605c){for(var _0x229110 in _0x2c605c){if(_0x2c605c[_0xedde('0x9d')](_0x229110)&&_[_0xedde('0xa3')](_0x2c605c[_0x229110])){this[_0xedde('0x10')]['setVariable'](util['format'](_0xedde('0x12e'),_0x229110[_0xedde('0x77')]()),_0x2c605c[_0x229110]);}}if(_['isNil'](_0x2c605c[_0xedde('0x12f')])){return this[_0xedde('0x10')]['noop'](_0xedde('0x130'));}else{this[_0xedde('0x45')](_0x2c605c['message'],_0xedde('0xf6'));return this['channel'][_0xedde('0xb2')](util[_0xedde('0x2b')](_0xedde('0x131'),_0x2c605c['message']));}}return this[_0xedde('0x10')][_0xedde('0x2e')](_0x1f5612,_0xedde('0x132'));};AGIVertices[_0xedde('0x11')][_0xedde('0x133')]=function(_0x32e88b){logger['info'](util['format'](_0xedde('0x134'),_0x32e88b[_0xedde('0xb1')],_0x32e88b[_0xedde('0x72')]));if(!this['isConfigured'](_0x32e88b[_0xedde('0x87')])){return this['channel'][_0xedde('0xb2')](_0xedde('0xf1'));}var _0x495021=_0xedde('0x135');var _0x39f738=util['format'](_0xedde('0x136'),FILES_PATH,rs[_0xedde('0x11e')](0x4));var _0x3af4af=util[_0xedde('0x2b')](_0xedde('0xa6'),_0x39f738,_0x495021);var _0x2e4e16=!![];if(_0x32e88b[_0xedde('0x137')]===_0xedde('0x138')){_0x2e4e16=![];}var _0x679f0a=this[_0xedde('0x10')][_0xedde('0x139')](_0x39f738,_0x495021,_0x32e88b[_0xedde('0x13a')],_0x32e88b[_0xedde('0x72')],undefined,_0x2e4e16);if(_0x679f0a[_0xedde('0xb4')]!==-0x1){this[_0xedde('0x10')][_0xedde('0xb2')](util[_0xedde('0x2b')](_0xedde('0x13b'),_0x3af4af));var _0x58739e=this['googleASR'][_0xedde('0x7e')](this,_0x32e88b,_0x3af4af);if(_0x58739e){for(var _0x547cb2 in _0x58739e){if(_0x58739e[_0xedde('0x9d')](_0x547cb2)){this[_0xedde('0x10')][_0xedde('0xa7')](util[_0xedde('0x2b')](_0xedde('0x13c'),_0x547cb2[_0xedde('0x77')]()),_0x58739e[_0x547cb2]);}}return this['channel'][_0xedde('0xb2')](util[_0xedde('0x2b')]('GoogleASR\x20Result\x20%s',JSON[_0xedde('0x81')](_0x58739e)));}}return _0x679f0a;};AGIVertices[_0xedde('0x11')][_0xedde('0x13d')]=function(_0x2ba7bc){logger[_0xedde('0x30')](util[_0xedde('0x2b')](_0xedde('0x13e'),_0x2ba7bc[_0xedde('0xb1')]));if(!this[_0xedde('0x8e')](_0x2ba7bc[_0xedde('0x99')])){return this[_0xedde('0x10')]['noop'](_0xedde('0x13f'));}if(!this['isConfigured'](_0x2ba7bc[_0xedde('0x9a')])){return this[_0xedde('0x10')][_0xedde('0xb2')](_0xedde('0x140'));}var _0x1b0eb0=_0xedde('0x135');var _0x46c440=util[_0xedde('0x2b')](_0xedde('0x136'),FILES_PATH,rs[_0xedde('0x11e')](0x4));var _0x33c5e6=util[_0xedde('0x2b')](_0xedde('0xa6'),_0x46c440,_0x1b0eb0);var _0x3614d3=!![];if(_0x2ba7bc[_0xedde('0x137')]===_0xedde('0x138')){_0x3614d3=![];}var _0x36d10c=this['channel']['recordFile'](_0x46c440,_0x1b0eb0,_0x2ba7bc[_0xedde('0x13a')],_0x2ba7bc['timeout'],undefined,_0x3614d3);if(_0x36d10c[_0xedde('0xb4')]!==-0x1){this[_0xedde('0x10')]['noop'](util[_0xedde('0x2b')](_0xedde('0x141'),_0x33c5e6));var _0x310c9d=this[_0xedde('0x98')][_0xedde('0x7e')](this,_0x2ba7bc,_0x33c5e6);if(_0x310c9d){for(var _0x5bf804 in _0x310c9d){if(_0x310c9d[_0xedde('0x9d')](_0x5bf804)){this[_0xedde('0x10')][_0xedde('0xa7')](util['format'](_0xedde('0x142'),_0x5bf804[_0xedde('0x77')]()),_0x310c9d[_0x5bf804]);}}return this[_0xedde('0x10')][_0xedde('0xb2')](util[_0xedde('0x2b')]('TildeASR\x20Result\x20%s',JSON[_0xedde('0x81')](_0x310c9d)));}}return _0x36d10c;};AGIVertices[_0xedde('0x11')]['gotoc']=function(_0x1a8974){logger['info'](util[_0xedde('0x2b')]('Enter\x20in\x20GOTO\x20(%s)\x20block',_0x1a8974[_0xedde('0xb1')]));return this['channel'][_0xedde('0x143')](_0x1a8974['context'],_0x1a8974[_0xedde('0x41')],_0x1a8974[_0xedde('0x42')]);};AGIVertices['prototype'][_0xedde('0x144')]=function(_0x4bd6b2){logger[_0xedde('0x30')](util[_0xedde('0x2b')](_0xedde('0x145'),_0x4bd6b2[_0xedde('0xb1')]));if(!this[_0xedde('0x8e')](_0x4bd6b2[_0xedde('0x146')])){return this[_0xedde('0x10')][_0xedde('0x2e')](_0x4bd6b2,_0xedde('0x147'));}try{var _0x40ee6d=eval(_0x4bd6b2[_0xedde('0x146')])?'true':_0xedde('0x148');this[_0xedde('0x10')][_0xedde('0xb2')](util[_0xedde('0x2b')](_0xedde('0x149'),_0x4bd6b2['condition'],_0x40ee6d));return{'code':0xc8,'result':_0x40ee6d};}catch(_0x5adecd){return{'code':0xc8,'result':_0xedde('0x148')};}};AGIVertices['prototype'][_0xedde('0x14a')]=function(_0x5a36cd){logger[_0xedde('0x30')](util[_0xedde('0x2b')](_0xedde('0x14b'),_0x5a36cd['label']));if(!this[_0xedde('0x8e')](_0x5a36cd['interval_id'])){return this['channel'][_0xedde('0x2e')](_0x5a36cd,_0xedde('0x14c'));}var _0x4e1a80=this['getIntervals'][_0xedde('0x7e')](this,_0x5a36cd[_0xedde('0x14d')]);if(!_0x4e1a80){return this[_0xedde('0x10')]['error'](_0x5a36cd,_0xedde('0x14e'));}for(var _0x22a06b=0x0;_0x22a06b<_0x4e1a80['length'];_0x22a06b+=0x1){var _0x32c0ab=this['channel'][_0xedde('0x12')](util[_0xedde('0x2b')](_0xedde('0x14f'),_0x4e1a80[_0x22a06b]));if(_0x32c0ab['result']===-0x1){return _0x32c0ab;}logger['info'](util['format'](_0xedde('0x150'),_0x4e1a80[_0x22a06b],_0x32c0ab[_0xedde('0xab')]));if(_0x32c0ab[_0xedde('0xab')]==='true'){logger[_0xedde('0x30')](util[_0xedde('0x2b')]('IFTIME\x20%s\x20%s',_0x4e1a80[_0x22a06b],'true'));this[_0xedde('0x10')][_0xedde('0xb2')](util[_0xedde('0x2b')](_0xedde('0x150'),_0x4e1a80[_0x22a06b],_0xedde('0x151')));return{'code':0xc8,'result':_0xedde('0x151')};}else{logger[_0xedde('0x30')](util[_0xedde('0x2b')](_0xedde('0x150'),_0x4e1a80[_0x22a06b],_0xedde('0x148')));this['channel'][_0xedde('0xb2')](util[_0xedde('0x2b')]('IFTIME\x20%s\x20%s',_0x4e1a80[_0x22a06b],_0xedde('0x148')));}}return{'code':0xc8,'result':_0xedde('0x148')};};AGIVertices[_0xedde('0x11')][_0xedde('0x152')]=function(_0x35bbaf){logger[_0xedde('0x30')](util[_0xedde('0x2b')](_0xedde('0x153'),_0x35bbaf['label']));return this[_0xedde('0x10')][_0xedde('0x152')]();};AGIVertices[_0xedde('0x11')][_0xedde('0x154')]=function(_0x2a51f9){logger['info'](util[_0xedde('0x2b')](_0xedde('0x155'),_0x2a51f9[_0xedde('0xb1')]));if(!this[_0xedde('0x8e')](_0x2a51f9[_0xedde('0x87')])){return this[_0xedde('0x10')][_0xedde('0xb2')]('no\x20key\x20configured');}var _0x1fa1bb='wav';var _0x41431e=util[_0xedde('0x2b')](_0xedde('0x136'),FILES_PATH,rs[_0xedde('0x11e')](0x4));var _0x392706=util[_0xedde('0x2b')](_0xedde('0xa6'),_0x41431e,_0x1fa1bb);var _0x3980f3=!![];if(_0x2a51f9[_0xedde('0x137')]===_0xedde('0x138')){_0x3980f3=![];}var _0x57e101=this[_0xedde('0x10')]['recordFile'](_0x41431e,_0x1fa1bb,_0x2a51f9[_0xedde('0x13a')],_0x2a51f9[_0xedde('0x72')],undefined,_0x3980f3);if(_0x57e101[_0xedde('0xb4')]!==-0x1){this[_0xedde('0x10')][_0xedde('0xb2')](util[_0xedde('0x2b')](_0xedde('0x156'),_0x392706));var _0x53af34=this['ispeechASR']['sync'](this,_0x2a51f9,_0x392706);if(_0x53af34){for(var _0xfd1137 in _0x53af34){if(_0x53af34[_0xedde('0x9d')](_0xfd1137)){this[_0xedde('0x10')][_0xedde('0xa7')](util[_0xedde('0x2b')](_0xedde('0x157'),_0xfd1137[_0xedde('0x77')]()),_0x53af34[_0xfd1137]);}}return this['channel'][_0xedde('0xb2')](util[_0xedde('0x2b')](_0xedde('0x158'),JSON[_0xedde('0x81')](_0x53af34)));}}return _0x57e101;};AGIVertices[_0xedde('0x11')][_0xedde('0x159')]=function(_0x25e33a){logger[_0xedde('0x30')](util[_0xedde('0x2b')](_0xedde('0x15a'),_0x25e33a['label']));if(!this[_0xedde('0x8e')](_0x25e33a[_0xedde('0x87')])){return this[_0xedde('0x10')][_0xedde('0xb2')](_0xedde('0xf1'));}if(!this[_0xedde('0x8e')](_0x25e33a[_0xedde('0x67')])){return this[_0xedde('0x10')]['noop'](_0xedde('0xd1'));}this[_0xedde('0x10')][_0xedde('0xb2')](util[_0xedde('0x2b')]('Trying\x20ispeech\x20TTS\x20%s',_0x25e33a[_0xedde('0x67')]));var _0x54bd2d=this['ispeechTTS'][_0xedde('0x7e')](this,_0x25e33a);if(_0x54bd2d){this[_0xedde('0x10')][_0xedde('0xb2')](util[_0xedde('0x2b')]('ispeech\x20%s\x20file\x20created',_0x54bd2d));var _0x2376ac=this[_0xedde('0x10')][_0xedde('0x104')](_0x54bd2d,_0x25e33a[_0xedde('0x13a')]);try{fs[_0xedde('0x105')](_0x54bd2d+_0xedde('0x106'));}catch(_0x43e48e){logger[_0xedde('0x2e')](_0x43e48e);}return _0x2376ac;}return this[_0xedde('0x10')][_0xedde('0x2e')](_0x25e33a,_0xedde('0x15b'));};AGIVertices[_0xedde('0x11')][_0xedde('0x15c')]=function(_0x49bc7c){logger[_0xedde('0x30')](util[_0xedde('0x2b')](_0xedde('0x15d'),_0x49bc7c[_0xedde('0xb1')]));if(!this[_0xedde('0x8e')](_0x49bc7c['findBy'])){return this['channel']['error'](_0x49bc7c,_0xedde('0x15e'));}logger[_0xedde('0x30')](util['format'](_0xedde('0x15f'),this[_0xedde('0x10')]['callerid'],_0x49bc7c[_0xedde('0x160')]));var _0x22f31d=this[_0xedde('0x60')]['sync'](this,_0x49bc7c[_0xedde('0x160')]);if(_0x22f31d){logger[_0xedde('0x30')](util['format'](_0xedde('0x161'),this[_0xedde('0x10')]['callerid'],_0x49bc7c[_0xedde('0x160')]));this[_0xedde('0x10')][_0xedde('0xb2')](util[_0xedde('0x2b')](_0xedde('0x161'),this[_0xedde('0x10')][_0xedde('0x3e')],_0x49bc7c['findBy']));return{'code':0xc8,'result':_0xedde('0x162')};}else{logger['info'](util['format'](_0xedde('0x163'),this[_0xedde('0x10')][_0xedde('0x3e')],_0x49bc7c[_0xedde('0x160')]));this[_0xedde('0x10')]['noop'](util[_0xedde('0x2b')](_0xedde('0x163'),this[_0xedde('0x10')][_0xedde('0x3e')],_0x49bc7c[_0xedde('0x160')]));return{'code':0xc8,'result':'failure'};}};AGIVertices[_0xedde('0x11')][_0xedde('0x164')]=function(_0x48c697){logger[_0xedde('0x30')](util[_0xedde('0x2b')](_0xedde('0x165'),_0x48c697[_0xedde('0xb1')]));if(!this[_0xedde('0x8e')](_0x48c697[_0xedde('0x160')])){return this[_0xedde('0x10')][_0xedde('0x2e')](_0x48c697,_0xedde('0x15e'));}logger['info'](util['format'](_0xedde('0x15f'),this[_0xedde('0x10')][_0xedde('0x3e')],_0x48c697[_0xedde('0x160')]));var _0x34da2e=this[_0xedde('0x5f')][_0xedde('0x7e')](this,_0x48c697[_0xedde('0x160')]);if(_0x34da2e){logger[_0xedde('0x30')](util[_0xedde('0x2b')](_0xedde('0x161'),this['channel'][_0xedde('0x3e')],_0x48c697['findBy']));this[_0xedde('0x10')]['noop'](util[_0xedde('0x2b')]('AGENT\x20%s\x20FOUND\x20BY',this[_0xedde('0x10')][_0xedde('0x3e')],_0x48c697[_0xedde('0x160')]));return{'code':0xc8,'result':'success'};}else{logger[_0xedde('0x30')](util['format'](_0xedde('0x163'),this[_0xedde('0x10')]['callerid'],_0x48c697[_0xedde('0x160')]));this[_0xedde('0x10')][_0xedde('0xb2')](util[_0xedde('0x2b')](_0xedde('0x163'),this[_0xedde('0x10')][_0xedde('0x3e')],_0x48c697[_0xedde('0x160')]));return{'code':0xc8,'result':'failure'};}};AGIVertices[_0xedde('0x11')][_0xedde('0x166')]=function(_0x1ece8f){logger[_0xedde('0x30')](util[_0xedde('0x2b')](_0xedde('0x167'),_0x1ece8f[_0xedde('0xb1')]));if(!this[_0xedde('0x8e')](_0x1ece8f[_0xedde('0x168')])){return this[_0xedde('0x10')]['error'](_0x1ece8f,_0xedde('0x169'));}this[_0xedde('0x10')][_0xedde('0xb2')](util[_0xedde('0x2b')](_0xedde('0x16a'),_0x1ece8f[_0xedde('0x168')]));var _0x292bb5=eval(_0x1ece8f[_0xedde('0x168')]);if(!this[_0xedde('0x8e')](_0x1ece8f[_0xedde('0xe4')])){return this['channel'][_0xedde('0xb2')](_0xedde('0xe3'));}var _0x47f4d5=this[_0xedde('0x12')]['sync'](this,_0x1ece8f[_0xedde('0xe4')]);if(!_0x47f4d5){return this[_0xedde('0x10')]['error'](_0x1ece8f,'no\x20variable\x20found');}if(_[_0xedde('0xa1')](_0x292bb5)){var _0x5b365c=this;_0x292bb5[_0xedde('0xe5')](function(_0x21ae8a,_0x344585){_0x5b365c[_0xedde('0x10')]['setVariable'](util[_0xedde('0x2b')](_0xedde('0x16b'),_0x47f4d5,_0x344585),_0x21ae8a);});return this['channel'][_0xedde('0xb2')](util[_0xedde('0x2b')](_0xedde('0x16c'),_0x47f4d5));}else{return this['channel']['setVariable'](_0x47f4d5,_0x292bb5);}};AGIVertices[_0xedde('0x11')][_0xedde('0xd')]=function(_0x2c55e3){logger[_0xedde('0x30')](util['format'](_0xedde('0x16d'),_0x2c55e3[_0xedde('0xb1')]));if(_0x2c55e3[_0xedde('0xae')]===0x0){return this[_0xedde('0xad')](_0x2c55e3);}_0x2c55e3[_0xedde('0xae')]-=0x1;if(!this[_0xedde('0x8e')](_0x2c55e3[_0xedde('0x113')])){return this[_0xedde('0x10')][_0xedde('0x2e')](_0x2c55e3,_0xedde('0x114'));}var _0xbe46f0=this[_0xedde('0x115')][_0xedde('0x7e')](this,_0x2c55e3[_0xedde('0x113')]);if(!_0xbe46f0){return this['channel'][_0xedde('0x2e')](_0x2c55e3,'no\x20file\x20audio\x20found');}var _0x5aaeb0=this['channel']['getData'](_0xbe46f0,_0x2c55e3[_0xedde('0x118')],_0x2c55e3['digit']);var _0x3619b6=_0x5aaeb0[_0xedde('0xb4')];if(_0x5aaeb0[_0xedde('0xb4')]===-0x1){this[_0xedde('0x3a')]['sync'](this,_0x2c55e3,'-1');return _0x5aaeb0;}else if(_0x5aaeb0[_0xedde('0xab')]===_0xedde('0x72')){_0x5aaeb0[_0xedde('0xb4')]=_0x5aaeb0[_0xedde('0xb4')][_0xedde('0xa2')]>0x0?_0x5aaeb0[_0xedde('0xb4')]:'t';}else if(_[_0xedde('0x51')](_0x5aaeb0[_0xedde('0xb4')])){_0x5aaeb0[_0xedde('0xb4')]='#';_0x3619b6='#';}if(!this[_0xedde('0x8e')](_0x2c55e3['variable_id'])){this[_0xedde('0x10')][_0xedde('0xb2')]('no\x20variable\x20selected\x20for\x20the\x20result');}else{var _0x2f030d=this[_0xedde('0x12')][_0xedde('0x7e')](this,_0x2c55e3['variable_id']);if(!_0x2f030d){return this[_0xedde('0x10')][_0xedde('0x2e')](_0x2c55e3,_0xedde('0x11c'));}this[_0xedde('0x10')][_0xedde('0xa7')](_0x2f030d,_0x3619b6);}this[_0xedde('0x3a')][_0xedde('0x7e')](this,_0x2c55e3,_0x3619b6);return _0x5aaeb0;};AGIVertices[_0xedde('0x11')][_0xedde('0xb2')]=function(_0x26efbc){logger[_0xedde('0x30')](util[_0xedde('0x2b')](_0xedde('0x16e'),_0x26efbc['label']));return this['channel'][_0xedde('0xb2')](_0x26efbc[_0xedde('0x16f')]||_0x26efbc[_0xedde('0xb1')]);};AGIVertices[_0xedde('0x11')]['pause']=function(_0x50ec06){logger[_0xedde('0x30')](util[_0xedde('0x2b')](_0xedde('0x170'),_0x50ec06[_0xedde('0xb1')]));if(!this[_0xedde('0x8e')](_0x50ec06[_0xedde('0x160')])){return this[_0xedde('0x10')][_0xedde('0x2e')](_0x50ec06,'no\x20find\x20by\x20configured');}logger[_0xedde('0x30')](util['format'](_0xedde('0x15f'),this[_0xedde('0x10')]['callerid'],_0x50ec06[_0xedde('0x160')]));var _0x247bd6=this['getPause'][_0xedde('0x7e')](this,_0x50ec06[_0xedde('0x171')]);var _0x194267=this[_0xedde('0x5c')][_0xedde('0x7e')](this,_0x50ec06[_0xedde('0x160')],_0x247bd6);if(_0x194267){logger[_0xedde('0x30')](util[_0xedde('0x2b')]('AGENT\x20%s\x20FOUND\x20BY',this[_0xedde('0x10')]['callerid'],_0x50ec06[_0xedde('0x160')]));this[_0xedde('0x10')][_0xedde('0xb2')](util[_0xedde('0x2b')](_0xedde('0x161'),this['channel'][_0xedde('0x3e')],_0x50ec06[_0xedde('0x160')]));return{'code':0xc8,'result':_0xedde('0x162')};}else{logger['info'](util['format']('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this[_0xedde('0x10')][_0xedde('0x3e')],_0x50ec06[_0xedde('0x160')]));this[_0xedde('0x10')][_0xedde('0xb2')](util['format']('AGENT\x20%s\x20FOUND\x20BY',this[_0xedde('0x10')][_0xedde('0x3e')],_0x50ec06[_0xedde('0x160')]));return{'code':0xc8,'result':_0xedde('0x172')};}};AGIVertices[_0xedde('0x11')]['playback']=function(_0x5bbfb2){logger[_0xedde('0x30')](util['format'](_0xedde('0x173'),_0x5bbfb2[_0xedde('0xb1')]));if(!this[_0xedde('0x8e')](_0x5bbfb2[_0xedde('0x113')])){return this[_0xedde('0x10')][_0xedde('0x2e')](_0x5bbfb2,_0xedde('0x114'));}var _0x3f37e1=this[_0xedde('0x115')]['sync'](this,_0x5bbfb2[_0xedde('0x113')]);if(!_0x3f37e1){return this[_0xedde('0x10')][_0xedde('0x2e')](_0x5bbfb2,_0xedde('0x116'));}var _0x479e30=this[_0xedde('0x10')][_0xedde('0xb3')](_0xedde('0x174'),[_0x3f37e1,_0x5bbfb2[_0xedde('0xed')]]);if(_0x479e30[_0xedde('0xb4')]===-0x1){return _0x479e30;}return this[_0xedde('0x10')][_0xedde('0xb2')](util[_0xedde('0x2b')]('Executed\x20command\x20%s\x20%s','PLAYBACK',_0x3f37e1));};AGIVertices[_0xedde('0x11')][_0xedde('0x175')]=function(_0x559ba8){logger[_0xedde('0x30')](util[_0xedde('0x2b')](_0xedde('0x176'),_0x559ba8['label']));if(!this[_0xedde('0x8e')](_0x559ba8[_0xedde('0x177')])){return this['channel']['error'](_0x559ba8,_0xedde('0x178'));}var _0x5e059e='';var _0x3165fe=parseInt(_0x559ba8[_0xedde('0x177')],0xa);if(isNaN(_0x3165fe)){_0x5e059e=_0x559ba8['queue_id'];}else{_0x5e059e=this[_0xedde('0x179')][_0xedde('0x7e')](this,_0x559ba8[_0xedde('0x177')]);if(!_0x5e059e){return this[_0xedde('0x10')][_0xedde('0x2e')](_0x559ba8,_0xedde('0x17a'));}}var _0x113a71='';if(this[_0xedde('0x8e')](_0x559ba8[_0xedde('0x113')])){var _0xee5db8=this['getSound']['sync'](this,_0x559ba8[_0xedde('0x113')]);if(_0xee5db8){_0x113a71=_0xee5db8;}}this['createSquareDetailsReport'][_0xedde('0x7e')](this,_0x559ba8,_0x5e059e);if(_0x559ba8[_0xedde('0xed')][_0xedde('0x17b')]('x')<0x0){_0x559ba8[_0xedde('0xed')]+='x';}if(_0x559ba8[_0xedde('0xed')][_0xedde('0x17b')]('X')<0x0){_0x559ba8[_0xedde('0xed')]+='X';}this['channel']['setVariable']('XMCS-QUEUE',_0x5e059e?_0x5e059e['toLowerCase']():'');var _0x9250c8=this['channel'][_0xedde('0xb3')](_0xedde('0x17c'),[_0x5e059e,_0x559ba8[_0xedde('0xed')],_0x559ba8[_0xedde('0x70')],_0x113a71,_0x559ba8[_0xedde('0x72')],_0x559ba8[_0xedde('0x7')],_0x559ba8[_0xedde('0x17d')],_0x559ba8[_0xedde('0x17e')],'',_0x559ba8[_0xedde('0x17f')]]);if(_0x9250c8[_0xedde('0xb4')]===-0x1){return _0x9250c8;}return this[_0xedde('0x10')][_0xedde('0xb2')](util['format'](_0xedde('0x180'),_0xedde('0x17c'),_0x5e059e));};AGIVertices[_0xedde('0x11')]['record']=function(_0x54b770){logger['info'](util['format'](_0xedde('0x181'),_0x54b770[_0xedde('0xb1')]));var _0x5104d0=_0x54b770[_0xedde('0x182')]||'wav';var _0x5a59fd=util[_0xedde('0x2b')]('%s_%s',this['channel'][_0xedde('0x3b')],rs['generate'](0x5));var _0x649d47=util[_0xedde('0x2b')](_0xedde('0x183'),FILES_PATH,_0x5a59fd,_0x5104d0);var _0x3373cf=util['format'](_0xedde('0x136'),FILES_PATH,_0x5a59fd);this[_0xedde('0x3f')][_0xedde('0x7e')](this,_0x54b770,_0x5a59fd,_0x649d47);this[_0xedde('0x10')][_0xedde('0xa7')](_0xedde('0x184'),_0x5a59fd);logger[_0xedde('0x30')](_0xedde('0x185'),_0x3373cf,_0x5104d0,_0x54b770[_0xedde('0x186')],_0x54b770[_0xedde('0x72')]);return this[_0xedde('0x10')][_0xedde('0x139')](_0x3373cf,_0x5104d0,_0x54b770[_0xedde('0x186')],_0x54b770[_0xedde('0x72')],undefined,!![]);};AGIVertices['prototype'][_0xedde('0x187')]=function(_0x44ad6d){logger[_0xedde('0x30')](util[_0xedde('0x2b')]('Enter\x20in\x20RESTAPI\x20(%s)\x20block',_0x44ad6d[_0xedde('0xb1')]));if(!this['isConfigured'](_0x44ad6d['url'])){return this[_0xedde('0x10')][_0xedde('0xb2')](_0xedde('0x188'));}var _0x446af=this[_0xedde('0x6f')]['sync'](this,_0x44ad6d);logger['info'](util['format'](_0xedde('0x189'),util[_0xedde('0x18a')](_0x446af,{'showHidden':![],'depth':null})));if(!this[_0xedde('0x8e')](_0x44ad6d[_0xedde('0xe4')])){return this[_0xedde('0x10')][_0xedde('0xb2')](_0xedde('0x18b'));}var _0x5ad2dd=this['getVariable'][_0xedde('0x7e')](this,_0x44ad6d[_0xedde('0xe4')]);if(!_0x5ad2dd){return this[_0xedde('0x10')]['error'](_0x44ad6d,'no\x20variable\x20found');}this['channel']['setVariable'](util[_0xedde('0x2b')]('%s_STATUS_CODE',_0x5ad2dd),_0x446af[_0xedde('0x83')]?_0x446af[_0xedde('0x83')]:'200');this[_0xedde('0x10')][_0xedde('0xa7')](util['format'](_0xedde('0x18c'),_0x5ad2dd),_0x446af[_0xedde('0x84')]?_0x446af['statusMessage']:'OK');if(_0x446af['body']){try{this[_0xedde('0xa4')](_0x446af['body'],_0x5ad2dd);}catch(_0x52a842){logger[_0xedde('0x2e')](util[_0xedde('0x2b')](_0xedde('0x18d'),_0x5ad2dd));}}return this[_0xedde('0x10')][_0xedde('0xb2')](util[_0xedde('0x2b')](_0xedde('0xe7'),_0x5ad2dd));};AGIVertices[_0xedde('0x11')][_0xedde('0x18e')]=function(_0x2a0efd){logger[_0xedde('0x30')](util[_0xedde('0x2b')](_0xedde('0x18f'),_0x2a0efd['label']));return this[_0xedde('0x10')][_0xedde('0x190')](_0x2a0efd[_0xedde('0x191')][_0xedde('0xe1')](/\s+/g,''),_0x2a0efd['escape_digits']);};AGIVertices[_0xedde('0x11')][_0xedde('0x192')]=function(_0x1b3521){logger[_0xedde('0x30')](util['format'](_0xedde('0x193'),_0x1b3521['label']));return this[_0xedde('0x10')][_0xedde('0x194')](_0x1b3521['number'][_0xedde('0xe1')](/\s+/g,''),_0x1b3521[_0xedde('0x186')]);};AGIVertices['prototype']['sayphonetic']=function(_0x26e66b){logger[_0xedde('0x30')](util['format'](_0xedde('0x195'),_0x26e66b['label']));return this[_0xedde('0x10')][_0xedde('0x196')](_0x26e66b[_0xedde('0x67')],_0x26e66b[_0xedde('0x186')]);};AGIVertices[_0xedde('0x11')]['sendMail']=function(_0x3cedb6){logger[_0xedde('0x30')](util[_0xedde('0x2b')](_0xedde('0x197'),_0x3cedb6[_0xedde('0xb1')]));if(!this[_0xedde('0x8e')](_0x3cedb6[_0xedde('0x198')])){return this[_0xedde('0x10')]['noop'](_0xedde('0x199'));}var _0x30e1de=this[_0xedde('0x19a')][_0xedde('0x7e')](this,_0x3cedb6[_0xedde('0x198')]);if(!_0x30e1de||!_0x30e1de[_0xedde('0x19b')]){return this['channel'][_0xedde('0x2e')](_0x3cedb6,_0xedde('0x19c'));}var _0x36a607={'from':util['format'](_0xedde('0x19d'),_0x30e1de[_0xedde('0x15')],_0x30e1de[_0xedde('0x19e')]||_0x30e1de[_0xedde('0x19b')]['user']),'to':_0x3cedb6['to']||'','cc':_0x3cedb6['cc']||'','bcc':_0x3cedb6[_0xedde('0x19f')]||'','subject':_0x3cedb6['subject'],'html':_0x3cedb6[_0xedde('0x67')],'text':_0x3cedb6['text']};var _0x6fc309={'tls':{'rejectUnauthorized':![]}};if(_0x30e1de[_0xedde('0x19b')]['service']){_0x6fc309[_0xedde('0x1a0')]=_0x30e1de[_0xedde('0x19b')][_0xedde('0x1a0')];}else{_0x6fc309[_0xedde('0x1a1')]=_0x30e1de[_0xedde('0x19b')][_0xedde('0x1a1')];_0x6fc309['port']=_0x30e1de[_0xedde('0x19b')]['port'];_0x6fc309[_0xedde('0x1a2')]=_0x30e1de['Smtp'][_0xedde('0x1a2')];}if(_0x30e1de[_0xedde('0x19b')]['authentication']){_0x6fc309[_0xedde('0x1a3')]={'user':_0x30e1de[_0xedde('0x19b')][_0xedde('0x1a4')],'pass':_0x30e1de['Smtp'][_0xedde('0x1a5')]};}if(this[_0xedde('0x8e')](_0x3cedb6[_0xedde('0x1a6')])){}logger[_0xedde('0xe9')](_0xedde('0x1a7'),JSON[_0xedde('0x81')](_0x36a607));this[_0xedde('0x3a')]['sync'](this,_0x3cedb6,_0x3cedb6['account_id']);this[_0xedde('0x10')][_0xedde('0xb2')](util[_0xedde('0x2b')](_0xedde('0x1a8'),_0x30e1de['name']));this[_0xedde('0x24')]['sync'](this,_0x6fc309,_0x36a607);return this[_0xedde('0x10')][_0xedde('0xb2')]('Mail\x20message\x20added\x20to\x20outgoing\x20process');};AGIVertices['prototype'][_0xedde('0x1a9')]=function(_0x291f77){logger[_0xedde('0x30')](util[_0xedde('0x2b')]('Enter\x20in\x20SENDFAX\x20(%s)\x20block',_0x291f77['label']));return this[_0xedde('0x10')][_0xedde('0xb2')]('SENDFAX\x20block\x20not\x20implemented');};AGIVertices[_0xedde('0x11')]['sendSMS']=function(_0x4bd7d6){logger[_0xedde('0x30')](util['format']('Enter\x20in\x20SENDSMS\x20(%s)\x20block',_0x4bd7d6[_0xedde('0xb1')]));if(!this['isConfigured'](_0x4bd7d6['sms_account_id'])){return this['channel'][_0xedde('0xb2')](_0xedde('0x1aa'));}var _0x300519=this[_0xedde('0x37')][_0xedde('0x7e')](this,_0x4bd7d6['sms_account_id']);if(!_0x300519){return this[_0xedde('0x10')][_0xedde('0x2e')](_0x4bd7d6,_0xedde('0x1ab'));}var _0x2e5d42={'body':_0x4bd7d6[_0xedde('0x1ac')],'phone':_0x4bd7d6['to']||'','SmsAccountId':_0x300519['id']};logger[_0xedde('0xe9')](_0xedde('0x1ad'),JSON['stringify'](_0x2e5d42));this[_0xedde('0x3a')]['sync'](this,_0x4bd7d6,_0x4bd7d6[_0xedde('0x1ae')]);this['channel'][_0xedde('0xb2')](util[_0xedde('0x2b')](_0xedde('0x1af'),_0x300519['name']));this[_0xedde('0x39')][_0xedde('0x7e')](this,_0x2e5d42);return this['channel'][_0xedde('0xb2')]('Sms\x20message\x20added\x20to\x20outgoing\x20process');};AGIVertices[_0xedde('0x11')][_0xedde('0x1b0')]=function(_0x448ea4){logger['info'](util['format'](_0xedde('0x1b1'),_0x448ea4[_0xedde('0xb1')]));if(!this[_0xedde('0x8e')](_0x448ea4[_0xedde('0xe4')])){return this['channel']['error'](_0x448ea4,_0xedde('0x1b2'));}var _0x17feaf=this[_0xedde('0x12')][_0xedde('0x7e')](this,_0x448ea4[_0xedde('0xe4')]);if(!_0x17feaf){return this['channel'][_0xedde('0x2e')](_0x448ea4,'no\x20variable\x20found');}return this[_0xedde('0x10')]['setVariable'](_0x17feaf,_0x448ea4[_0xedde('0x1b3')]);};AGIVertices['prototype'][_0xedde('0x1b4')]=function(_0x464f89){logger[_0xedde('0x30')](util[_0xedde('0x2b')](_0xedde('0x1b5'),_0x464f89[_0xedde('0xb1')]));this[_0xedde('0x10')][_0xedde('0xb2')](_0xedde('0x1b6'));if(_0x464f89[_0xedde('0xc2')]===_0xedde('0x1b7')){this['channel']['noop']('Answer');return this[_0xedde('0x10')][_0xedde('0xc2')]();}return this[_0xedde('0x10')][_0xedde('0xb2')](_0xedde('0x1b8'));};AGIVertices[_0xedde('0x11')][_0xedde('0x1b9')]=function(_0x2d37c2){logger['info'](util[_0xedde('0x2b')](_0xedde('0x1ba'),_0x2d37c2[_0xedde('0xb1')]));if(!this[_0xedde('0x8e')](_0x2d37c2[_0xedde('0x1bb')])){return this[_0xedde('0x10')][_0xedde('0x2e')](_0x2d37c2,_0xedde('0x1bc'));}var _0x374756=this[_0xedde('0x19')]['sync'](this,_0x2d37c2[_0xedde('0x1bb')]);if(!this[_0xedde('0x8e')](_0x374756)){return this['channel'][_0xedde('0x2e')](_0x2d37c2,util[_0xedde('0x2b')](_0xedde('0x1bd'),_0x2d37c2[_0xedde('0x1bb')]));}if(_0x374756===this['channel'][_0xedde('0x3d')]){return this['channel'][_0xedde('0x2e')](_0x2d37c2,'project\x20in\x20subproject\x20must\x20be\x20different\x20from\x20the\x20called\x20project');}this['createSquareDetailsReport'][_0xedde('0x7e')](this,_0x2d37c2,_0x374756);var _0x273d4c=this['channel'][_0xedde('0xb3')](_0xedde('0x1be'),util['format']('agi://%s/square,\x22%s\x22,\x22%s\x22',config[_0xedde('0x7')][_0xedde('0x1a1')]||_0xedde('0x1bf'),_0x374756,this[_0xedde('0x10')][_0xedde('0x3d')]));if(_0x273d4c[_0xedde('0xb4')]===-0x1){return _0x273d4c;}return this[_0xedde('0x10')][_0xedde('0xb2')](util[_0xedde('0x2b')](_0xedde('0x180'),'AGI',_0x374756));};AGIVertices[_0xedde('0x11')][_0xedde('0x1c0')]=function(_0x1888fa){logger[_0xedde('0x30')](util[_0xedde('0x2b')]('Enter\x20in\x20SYSTEM\x20(%s)\x20block',_0x1888fa[_0xedde('0xb1')]));var _0x5d43e6=this[_0xedde('0x64')][_0xedde('0x7e')](this,_0x1888fa[_0xedde('0xc0')]);this[_0xedde('0x3a')][_0xedde('0x7e')](this,_0x1888fa,_0x1888fa[_0xedde('0xc0')]);if(this[_0xedde('0x8e')](_0x1888fa[_0xedde('0xe4')])){var _0x374d28=this['getVariable'][_0xedde('0x7e')](this,_0x1888fa[_0xedde('0xe4')]);if(_0x374d28){this[_0xedde('0x10')][_0xedde('0xa7')](_0x374d28,_0x5d43e6);return this[_0xedde('0x10')][_0xedde('0xb2')](util[_0xedde('0x2b')](_0xedde('0x1c1'),_0x1888fa[_0xedde('0xc0')],_0x374d28));}}return this['channel'][_0xedde('0xb2')](util[_0xedde('0x2b')](_0xedde('0x1c2'),_0x1888fa['command']));};AGIVertices[_0xedde('0x11')]['google_cloud_tts']=function(_0x1b62f2){logger[_0xedde('0x30')](util[_0xedde('0x2b')](_0xedde('0x1c3'),_0x1b62f2[_0xedde('0xb1')]));_0x1b62f2[_0xedde('0x67')]=_0x1b62f2['text']['replace'](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0xedde('0x8e')](_0x1b62f2['apiKey'])){return this[_0xedde('0x10')][_0xedde('0xb2')]('no\x20apiKey\x20configured');}if(!this[_0xedde('0x8e')](_0x1b62f2['text'])){return this[_0xedde('0x10')][_0xedde('0xb2')]('no\x20text\x20configured');}this[_0xedde('0x10')][_0xedde('0xb2')](util[_0xedde('0x2b')](_0xedde('0x1c4'),_0x1b62f2[_0xedde('0x67')]));var _0x4ebba7=this[_0xedde('0x65')]['sync'](this,_0x1b62f2);if(_0x4ebba7){this['channel']['noop'](util[_0xedde('0x2b')](_0xedde('0x1c5'),_0x4ebba7));var _0x3070e6=this[_0xedde('0x10')][_0xedde('0x104')](_0x4ebba7);try{fs[_0xedde('0x105')](_0x4ebba7+_0xedde('0x106'));}catch(_0x5c0be7){logger['error'](_0x5c0be7);}return _0x3070e6;}return this[_0xedde('0x10')][_0xedde('0x2e')](_0x1b62f2,_0xedde('0x1c6'));};AGIVertices[_0xedde('0x11')][_0xedde('0x1c7')]=function(_0x4cc30c){logger['info'](util[_0xedde('0x2b')](_0xedde('0x1c8'),_0x4cc30c['label']));_0x4cc30c[_0xedde('0x67')]=_0x4cc30c[_0xedde('0x67')][_0xedde('0xe1')](/(\r\n|\n|\r)/gm,'\x20');if(!this['isConfigured'](_0x4cc30c['text'])){return this[_0xedde('0x10')][_0xedde('0xb2')](_0xedde('0xd1'));}this[_0xedde('0x10')][_0xedde('0xb2')](util['format']('Trying\x20Google\x20TTS\x20%s',_0x4cc30c[_0xedde('0x67')]));var _0x2b3961=this[_0xedde('0x6d')][_0xedde('0x7e')](this,_0x4cc30c);if(_0x2b3961){this['channel'][_0xedde('0xb2')](util['format'](_0xedde('0x1c9'),_0x2b3961));var _0x4d99d8=this[_0xedde('0x10')][_0xedde('0x104')](_0x2b3961);try{fs[_0xedde('0x105')](_0x2b3961+_0xedde('0x106'));}catch(_0x1ac5e0){logger[_0xedde('0x2e')](_0x1ac5e0);}return _0x4d99d8;}return this[_0xedde('0x10')][_0xedde('0x2e')](_0x4cc30c,_0xedde('0x1ca'));};AGIVertices[_0xedde('0x11')][_0xedde('0x1cb')]=function(_0x52a8fb){logger[_0xedde('0x30')](util[_0xedde('0x2b')](_0xedde('0x1cc'),_0x52a8fb['label']));if(!this['isConfigured'](_0x52a8fb[_0xedde('0x160')])){return this[_0xedde('0x10')][_0xedde('0x2e')](_0x52a8fb,_0xedde('0x15e'));}logger[_0xedde('0x30')](util[_0xedde('0x2b')](_0xedde('0x15f'),this[_0xedde('0x10')][_0xedde('0x3e')],_0x52a8fb[_0xedde('0x160')]));var _0x269fda=this['agentUnpause'][_0xedde('0x7e')](this,_0x52a8fb[_0xedde('0x160')]);if(_0x269fda){logger['info'](util[_0xedde('0x2b')](_0xedde('0x161'),this[_0xedde('0x10')][_0xedde('0x3e')],_0x52a8fb[_0xedde('0x160')]));this[_0xedde('0x10')][_0xedde('0xb2')](util['format'](_0xedde('0x161'),this[_0xedde('0x10')][_0xedde('0x3e')],_0x52a8fb['findBy']));return{'code':0xc8,'result':_0xedde('0x162')};}else{logger[_0xedde('0x30')](util[_0xedde('0x2b')](_0xedde('0x163'),this[_0xedde('0x10')][_0xedde('0x3e')],_0x52a8fb['findBy']));this[_0xedde('0x10')][_0xedde('0xb2')](util[_0xedde('0x2b')](_0xedde('0x163'),this[_0xedde('0x10')][_0xedde('0x3e')],_0x52a8fb[_0xedde('0x160')]));return{'code':0xc8,'result':_0xedde('0x172')};}};AGIVertices[_0xedde('0x11')][_0xedde('0x1cd')]=function(_0x45fdbc){logger[_0xedde('0x30')](util[_0xedde('0x2b')](_0xedde('0x1ce'),_0x45fdbc[_0xedde('0xb1')]));var _0x42d7ec=this['channel']['exec'](_0xedde('0x1cf'),[_0x45fdbc['mailbox'],_0x45fdbc[_0xedde('0x85')]]);if(_0x42d7ec[_0xedde('0xb4')]===-0x1){return _0x42d7ec;}return this[_0xedde('0x10')][_0xedde('0xb2')](util[_0xedde('0x2b')](_0xedde('0x180'),_0xedde('0x1cf'),_0x45fdbc[_0xedde('0x1d0')]));};AGIVertices[_0xedde('0x11')][_0xedde('0x1d1')]=function(_0x20c09f){logger[_0xedde('0x30')](util['format'](_0xedde('0x1d2'),_0x20c09f[_0xedde('0xb1')]));if(!this[_0xedde('0x8e')](_0x20c09f[_0xedde('0xe4')])){return this['channel']['error'](_0x20c09f,_0xedde('0x1b2'));}var _0x2aebc0=this[_0xedde('0x12')]['sync'](this,_0x20c09f['variable_id']);if(!_0x2aebc0){return this[_0xedde('0x10')][_0xedde('0x2e')](_0x20c09f,_0xedde('0x11c'));}var _0x594681=this[_0xedde('0x10')][_0xedde('0x12')](_0x2aebc0);return{'code':0xc8,'result':_0x594681[_0xedde('0xab')]?_0x594681[_0xedde('0xab')]:'-'};};String[_0xedde('0x11')][_0xedde('0x1d3')]=function(_0x2e2bbe,_0x59f0e7){return this[_0xedde('0xa9')](_0x2e2bbe)[_0xedde('0x1d4')](_0x59f0e7);};module['exports']=AGIVertices; \ No newline at end of file +var _0x73bd=['variable\x20%s[key]\x20set','no\x20file\x20audio\x20found','response','digit','Enter\x20in\x20NOOP\x20(%s)\x20block','pause','Enter\x20in\x20PAUSE\x20(%s)\x20block','pause_id','playback','Enter\x20in\x20PLAYBACK\x20(%s)\x20block','PLAYBACK','queue','Enter\x20in\x20QUEUE\x20(%s)\x20block','queue_id','no\x20queue\x20selected','no\x20queue\x20found','indexOf','toLowerCase','QUEUE','macro','gosub','position','record','recordingFormat','%s_%s','RECORDING_SAVENAME','escape_digits','Enter\x20in\x20RESTAPI\x20(%s)\x20block','no\x20url\x20configured','Response:','inspect','no\x20variable\x20selected\x20for\x20the\x20response','%s_STATUS_CODE','200','%s_STATUS_MESSAGE','statusMessage','Unable\x20to\x20set\x20result\x20in\x20variable\x20%s','variable\x20%s\x20set','saydigits','Enter\x20in\x20SAYDIGITS\x20(%s)\x20block','sayDigits','digits','Enter\x20in\x20SAYNUMBER\x20(%s)\x20block','Enter\x20in\x20SAYPHONETIC\x20(%s)\x20block','sayPhonetic','sendMail','account_id','no\x20mail\x20account\x20configured','Smtp','no\x20mail\x20account\x20found','\x22%s\x22\x20<%s>','email','subject','service','host','port','secure','authentication','auth','template_id','sendMail\x20message','Trying\x20SendMail\x20with\x20account\x20%s','Mail\x20message\x20added\x20to\x20outgoing\x20process','sendFax','SENDFAX\x20block\x20not\x20implemented','sendSMS','sms_account_id','no\x20sms\x20account\x20configured','no\x20sms\x20account\x20found','sms_text','sendSMS\x20message','Trying\x20SendSMS\x20with\x20account\x20%s','Sms\x20message\x20added\x20to\x20outgoing\x20process','Enter\x20in\x20SET\x20(%s)\x20block','no\x20variable\x20selected','variable_value','START\x20CALLY\x20SQUARE','yes','subproject','Enter\x20in\x20SUBPROJECT\x20(%s)\x20block','project_id','project\x20in\x20subproject\x20must\x20be\x20different\x20from\x20the\x20called\x20project','AGI','agi://%s/square,\x22%s\x22,\x22%s\x22','127.0.0.1','system','Enter\x20in\x20SYSTEM\x20(%s)\x20block','shellCommand','command','sh\x20command:\x20%s\x20result\x20on\x20variable:\x20%s','sh\x20command:\x20%s\x20result\x20no\x20stored','apiKey','no\x20apiKey\x20configured','tts','Enter\x20in\x20GOOGLETTS\x20(%s)\x20block','Trying\x20Google\x20TTS\x20%s','Google\x20TTS\x20%s\x20file\x20created','unpause','Enter\x20in\x20UNPAUSE\x20(%s)\x20block','voicemail','Enter\x20in\x20VOICEMAIL\x20(%s)\x20block','VOICEMAIL','mailbox','vswitch','Enter\x20in\x20SWITCH\x20(%s)\x20block','join','exports','path','lodash','shelljs','odbc','randomstring','mustache','request-promise','agi','./scripts','/var/opt/motion2/server/files','rawHeaders','rawBody','menu','getdigits','rpc','mailRpc','prototype','getVariable','then','getVoiceQueue','getVoiceQueueById','name','catch','getSquareProject','getSquareProjectById','getSquareOdbcById','getUserById','getTrunk','getTrunkById','getSound','getSoundById','getSoundPath','save_name','getMailAccount','sendMailMessage','getIntervals','IntervalId','interval','map','format','%s/sounds/converted/%s','open','error','info','query','Query\x20executed\x20correctly\x20%s','Error\x20closing\x20connection\x20to\x20odbc\x20%s','getSmsAccount','getSmsAccountById','createSmsMessage','createSquareDetailsReport','channel','uniqueid','agicommand','arg_1','createSquareRecording','callerid','calleridname','extension','priority','accountcode','dnid','createSquareMessage','log','in\x20createcmcontact\x20callback','has','dialTimezone','isNil','VALUE\x20TZ','CALLERID(dialTimezone)','getContactByPhone','phone','RETVALRPC','TZ\x20found\x20in\x20shared:','createCmContact','callback_','isEmpty','lastName','scheduledAt','Callback\x20scheduled\x20at\x20','callback_priority','getPause','agent','agentPause','agentUnpause','agentLogout','agentLogin','%s/%s@from-sip/n','LOCAL','exec','trim','googleCloudTTS','google_cloud_tts_text_type','text','languageCode','en-US','MALE','MP3','googleTTS','restAPI','url','method','timeout','includes','POST','PUT','toUpperCase','body','parse','An\x20incorrect\x20formatted\x20json\x20body\x20has\x20been\x20passed\x20to\x20the\x20function','headers','An\x20incorrect\x20formatted\x20json\x20headers\x20has\x20been\x20passed\x20to\x20the\x20function','computedVariables','sync','uri','render','stringify','An\x20incorrect\x20formatted\x20json\x20has\x20been\x20passed\x20to\x20the\x20function','statusCode','message','options','googleDialogflow','key','sestekNDA','ispeechTTS','ispeech_tts_language','speed','ispeechASR','ispeech_asr_language','model','awsPolly','aws_polly_region','awsLex','aws_secret_access_key','aws_bot_name','googleASR','google_asr_language','tildeASR','appsecret','clone','isString','replaceObjectAllVariables','replaceAllVariables','recursiveNodeIndex','hasOwnProperty','isPlainObject','isArray','saveRestApiResult','%s.%s','setVariable','replaceall\x20init','split','length','replaceAll','toString','replaceall\x20end','result','The\x20\x22%s\x22\x20variable\x20value\x20is:\x20%s','extra','isConfigured','maxRetry','retry','mrcpsynth','Enter\x20in\x20MRCPSynth\x20(%s)\x20block','noop','no\x20text\x20configured','MRCPSynth','Executed\x20command\x20MRCPSynth\x20%s','mrcprecog','Enter\x20in\x20MRCPRecog\x20(%s)\x20block','grammar','getAndSetVariable','RECOG_CONFIDENCE()','MRCP_RECOG_CONFIDENCE','RECOG_INPUT()','MRCP_RECOG_TRANSCRIPT','RECOG_INSTANCE()','MRCP_RECOG_INSTANCE','Executed\x20command\x20MRCPRecog\x20%s','Enter\x20in\x20AGI\x20(%s)\x20block','label','args','answer','Enter\x20in\x20ANSWER\x20(%s)\x20block','Wait\x20%s\x20seconds\x20before\x20answer','callback','enter\x20in\x20callbackblock','Enter\x20in\x20CALLBACK\x20(%s)\x20block','list_id','no\x20list\x20selected','delay','add','minutes','before\x20createcmcontact','CALLBACK\x20added\x20phone:\x20%s\x20on\x20list:\x20%s\x20at\x20%s','custom_app','application','Executed\x20command\x20%s\x20%s','lumenvoxtts','Enter\x20in\x20LUMENVOXTTS\x20(%s)\x20block','sestektts','Enter\x20in\x20SESTEKTTS\x20(%s)\x20block','lumenvoxasr','Enter\x20in\x20LUMENVOXASR\x20(%s)\x20block','no\x20grammar\x20configured','MRCPRecog','LUMENVOX_ASR_CONFIDENCE','LUMENVOX_ASR_TRANSCRIPT','LUMENVOX_ASR_INSTANCE','sestekasr','Enter\x20in\x20SESTEKASR\x20(%s)\x20block','SESTEK_ASR_TRANSCRIPT','SESTEK_ASR_INSTANCE','database','no\x20odbc\x20database\x20found','replace','query:\x20%s','getQueryOdbc','variable_id','no\x20variable\x20found','keys','%s[%s][%s]','dial','debug','sip_id','no\x20user\x20selected','getUser','no\x20user\x20found','DIAL','opts','Executed\x20command\x20%s','dialogflow','Enter\x20in\x20DIALOGFLOW\x20(%s)\x20block','no\x20key\x20configured','bot','DIALOGFLOW_%s','Dialogflow\x20is\x20unreachable','sesteknda','ndauth_url','no\x20ndauth\x20url\x20configured','username','no\x20username\x20configured','password','no\x20password\x20configured','SESTEK_NDA_%s','speech','out','Sestek\x20NDA\x20%s\x20file\x20created','audiofile','.wav','end','ext_dial','Enter\x20in\x20EXTERNAL\x20DIAL\x20(%s)\x20block','trunk_id','no\x20trunk\x20selected','no\x20trunk\x20found','trunk_name','SIP/%s/%s','finally','Enter\x20in\x20GETDIGITS\x20(%s)\x20block','file_id','no\x20file\x20audio\x20selected','getData','test','mindigit','maxdigit','hiddendigitsnum','generate','substr','getsecretdigits','goal','Enter\x20in\x20GOAL\x20(%s)\x20block','goalname','GOAL\x20%s','awspolly','aws_access_key_id','no\x20valid\x20credentials\x20configured','Trying\x20aws\x20Polly\x20%s','aws\x20Polly\x20%s\x20file\x20created','streamFile','unlink','aws\x20Polly\x20is\x20unreachable','Enter\x20in\x20Amazon\x20Lex\x20(%s)\x20block','no\x20bot\x20name\x20configured','Trying\x20Amazon\x20Lex:\x20%s','AWS_LEX_%s','Amazon\x20Lex\x20is\x20unreachable','googleasr','Enter\x20in\x20GOOGLEASR\x20(%s)\x20block\x20%s','wav','%s/recordings/%s','beep','NOBEEP','recordFile','intKey','google\x20%s\x20file\x20created','GOOGLE_ASR_%s','GoogleASR\x20Result\x20%s','tildeasr','Enter\x20in\x20TILDEASR\x20(%s)\x20block','appid','no\x20appid\x20configured','no\x20appsecret\x20configured','tilde\x20%s\x20file\x20created','TILDE_ASR_%s','Enter\x20in\x20GOTO\x20(%s)\x20block','continueAt','context','gotoif','Enter\x20in\x20GOTOIF\x20(%s)\x20block','condition','true','false','EVAL\x20CONDITION\x20%s\x20%s','Enter\x20in\x20GOTOIFTIME\x20(%s)\x20block','interval_id','no\x20intervals\x20found','IFTIME(%s?true:false)','IFTIME\x20%s\x20%s','hangup','Enter\x20in\x20HANGUP\x20(%s)\x20block','ispeechasr','ISPEECH_ASR_%s','IspeechASR\x20Result\x20%s','ispeechtts','Enter\x20in\x20ISPEECHTTS\x20(%s)\x20block','Trying\x20ispeech\x20TTS\x20%s','ispeech\x20%s\x20file\x20created','login','no\x20find\x20by\x20configured','FIND\x20AGENT\x20%s\x20BY\x20%s','findBy','AGENT\x20%s\x20FOUND\x20BY','AGENT\x20%s\x20NOT\x20FOUND\x20BY','logout','Enter\x20in\x20LOGOUT\x20(%s)\x20block','success','failure','math','operation','math\x20%s','no\x20variable\x20selected\x20for\x20the\x20result','forEach','%s[%s]'];(function(_0x2f5ac5,_0x1ee939){var _0x37c9a8=function(_0x15031f){while(--_0x15031f){_0x2f5ac5['push'](_0x2f5ac5['shift']());}};_0x37c9a8(++_0x1ee939);}(_0x73bd,0x6b));var _0xd73b=function(_0x21a9d9,_0x4d5ac8){_0x21a9d9=_0x21a9d9-0x0;var _0x46adce=_0x73bd[_0x21a9d9];return _0x46adce;};'use strict';var fs=require('fs');var path=require(_0xd73b('0x0'));var util=require('util');var _=require(_0xd73b('0x1'));var sh=require(_0xd73b('0x2'));var odbc=require(_0xd73b('0x3'))();var rs=require(_0xd73b('0x4'));var moment=require('moment');var Mustache=require(_0xd73b('0x5'));var rp=require(_0xd73b('0x6'));var logger=require('../../config/logger')(_0xd73b('0x7'));var config=require('../../config/environment');var shared=require('../../config/environment/shared');var scripts=require(_0xd73b('0x8'));var FILES_PATH=_0xd73b('0x9');var recursiveMapAttributes=[_0xd73b('0xa'),_0xd73b('0xb')];var verticesWithRetry=[_0xd73b('0xc'),_0xd73b('0xd'),'getsecretdigits'];var AGIVertices=function(_0x1840d4,_0x18b10c,_0x5ccecb){this['channel']=_0x1840d4;this[_0xd73b('0xe')]=_0x18b10c;this[_0xd73b('0xf')]=_0x5ccecb;};AGIVertices[_0xd73b('0x10')][_0xd73b('0x11')]=function(_0x575ba3,_0x60879a){this[_0xd73b('0xe')]['getVariableById'](_0x575ba3)[_0xd73b('0x12')](function(_0x4a3d61){_0x60879a(null,_0x4a3d61?_0x4a3d61['name']:![]);})['catch'](function(_0x195817){_0x60879a(_0x195817);});};AGIVertices[_0xd73b('0x10')][_0xd73b('0x13')]=function(_0x132782,_0x3142bb){this[_0xd73b('0xe')][_0xd73b('0x14')](_0x132782)[_0xd73b('0x12')](function(_0x4ee79d){_0x3142bb(null,_0x4ee79d?_0x4ee79d[_0xd73b('0x15')]:![]);})[_0xd73b('0x16')](function(_0x3fefaa){_0x3142bb(_0x3fefaa);});};AGIVertices[_0xd73b('0x10')][_0xd73b('0x17')]=function(_0x5b9558,_0x163c64){this[_0xd73b('0xe')][_0xd73b('0x18')](_0x5b9558)[_0xd73b('0x12')](function(_0x53a909){_0x163c64(null,_0x53a909?_0x53a909['name']:![]);})['catch'](function(_0x529576){_0x163c64(_0x529576);});};AGIVertices[_0xd73b('0x10')]['getSquareOdbc']=function(_0x55ed89,_0x42a79c){this[_0xd73b('0xe')][_0xd73b('0x19')](_0x55ed89)[_0xd73b('0x12')](function(_0x19b50e){_0x42a79c(null,_0x19b50e?_0x19b50e['dsn']:![]);})[_0xd73b('0x16')](function(_0x354a9c){_0x42a79c(_0x354a9c);});};AGIVertices['prototype']['getUser']=function(_0xc948f8,_0x4ee410){this[_0xd73b('0xe')][_0xd73b('0x1a')](_0xc948f8)[_0xd73b('0x12')](function(_0x197dd7){_0x4ee410(null,_0x197dd7?_0x197dd7[_0xd73b('0x15')]:![]);})['catch'](function(_0x5607f2){_0x4ee410(_0x5607f2);});};AGIVertices[_0xd73b('0x10')][_0xd73b('0x1b')]=function(_0x5ee402,_0x27f071){this['rpc'][_0xd73b('0x1c')](_0x5ee402)['then'](function(_0x41b090){_0x27f071(null,_0x41b090?_0x41b090[_0xd73b('0x15')]:![]);})['catch'](function(_0x978f69){_0x27f071(_0x978f69);});};AGIVertices[_0xd73b('0x10')][_0xd73b('0x1d')]=function(_0x1ea0e6,_0x25204d){var _0x4aa1a4=this;this[_0xd73b('0xe')][_0xd73b('0x1e')](_0x1ea0e6)[_0xd73b('0x12')](function(_0xb6a6a2){_0x25204d(null,_0xb6a6a2?_0x4aa1a4[_0xd73b('0x1f')](_0xb6a6a2[_0xd73b('0x20')]):![]);})['catch'](function(_0x222e08){_0x25204d(_0x222e08);});};AGIVertices[_0xd73b('0x10')][_0xd73b('0x21')]=function(_0x1e7414,_0x19f676){this[_0xd73b('0xe')]['getMailAccountById'](_0x1e7414)['then'](function(_0x51325a){_0x19f676(null,_0x51325a?_0x51325a:![]);})[_0xd73b('0x16')](function(_0x3e0e8d){_0x19f676(_0x3e0e8d);});};AGIVertices[_0xd73b('0x10')][_0xd73b('0x22')]=function(_0x4bd1b2,_0x534887,_0x5d3f9e){this[_0xd73b('0xf')][_0xd73b('0x22')](_0x4bd1b2,_0x534887)[_0xd73b('0x12')](function(){_0x5d3f9e(null);})['catch'](function(_0x536bd0){_0x5d3f9e(_0x536bd0);});};AGIVertices['prototype'][_0xd73b('0x23')]=function(_0xb16eec,_0x42b9e4){this[_0xd73b('0xe')]['getIntervalById'](_0xb16eec)[_0xd73b('0x12')](function(_0x378076){if(_0x378076){if(_0x378076[_0xd73b('0x24')]){_0x42b9e4(null,[_0x378076[_0xd73b('0x25')]]);}else{_0x42b9e4(null,_[_0xd73b('0x26')](_0x378076['Intervals'],_0xd73b('0x25')));}}else{_0x42b9e4(null,![]);}})[_0xd73b('0x16')](function(_0xb3563){_0x42b9e4(_0xb3563);});};AGIVertices[_0xd73b('0x10')][_0xd73b('0x1f')]=function(_0x41a188){return util[_0xd73b('0x27')](_0xd73b('0x28'),FILES_PATH,_0x41a188);};AGIVertices['prototype']['getQueryOdbc']=function(_0x5d75f2,_0x373ed9,_0x59b128){odbc[_0xd73b('0x29')](_0x5d75f2,function(_0x42f8dd){if(_0x42f8dd){logger[_0xd73b('0x2a')]('Error\x20getting\x20ODBC\x20connection\x20%s',_0x42f8dd);_0x59b128(_0x42f8dd);}else{logger[_0xd73b('0x2b')]('ODBC\x20connection\x20successfully');odbc[_0xd73b('0x2c')](_0x373ed9,function(_0x418608,_0x33135a){if(_0x418608){logger[_0xd73b('0x2b')]('Error\x20executing\x20query\x20%s',_0x373ed9);_0x59b128(_0x418608);}else{logger[_0xd73b('0x2b')](_0xd73b('0x2d'),_0x373ed9);odbc['close'](function(_0x557411){if(_0x557411){logger[_0xd73b('0x2a')](_0xd73b('0x2e'),_0x557411);}_0x59b128(null,_0x33135a);});}});}});};AGIVertices[_0xd73b('0x10')][_0xd73b('0x2f')]=function(_0x5156a7,_0x3ebfa1){this[_0xd73b('0xe')][_0xd73b('0x30')](_0x5156a7)['then'](function(_0x529347){_0x3ebfa1(null,_0x529347?_0x529347:![]);})['catch'](function(_0x5b8f4f){_0x3ebfa1(_0x5b8f4f);});};AGIVertices[_0xd73b('0x10')][_0xd73b('0x31')]=function(_0x48e2fa,_0x593646){this[_0xd73b('0xe')]['createSmsMessage'](_0x48e2fa)[_0xd73b('0x12')](function(_0x143562){_0x593646(null,_0x143562);})[_0xd73b('0x16')](function(_0x26b275){_0x593646(_0x26b275);});};AGIVertices['prototype']['createSquareDetailsReport']=function(_0x2c82ec,_0x415476,_0x2ad83e){this[_0xd73b('0xe')][_0xd73b('0x32')]({'uniqueid':this[_0xd73b('0x33')][_0xd73b('0x34')],'node':_0x2c82ec['label'],'application':_0x2c82ec[_0xd73b('0x35')],'data':_0x415476||null,'project_name':this[_0xd73b('0x33')][_0xd73b('0x36')],'callerid':this[_0xd73b('0x33')]['callerid']})[_0xd73b('0x12')](function(_0x484dea){if(_0x2ad83e){_0x2ad83e(null,_0x484dea);}})[_0xd73b('0x16')](function(_0x45c017){if(_0x2ad83e){_0x2ad83e(_0x45c017);}});};AGIVertices[_0xd73b('0x10')][_0xd73b('0x37')]=function(_0x326c68,_0x2277ef,_0x825860,_0x212970){this[_0xd73b('0xe')][_0xd73b('0x37')]({'uniqueid':this[_0xd73b('0x33')]['uniqueid'],'callerid':this[_0xd73b('0x33')][_0xd73b('0x38')],'calleridname':this[_0xd73b('0x33')][_0xd73b('0x39')],'context':this['channel']['context'],'extension':this[_0xd73b('0x33')][_0xd73b('0x3a')],'priority':this[_0xd73b('0x33')][_0xd73b('0x3b')],'accountcode':this[_0xd73b('0x33')][_0xd73b('0x3c')],'dnid':this['channel'][_0xd73b('0x3d')],'projectName':this[_0xd73b('0x33')][_0xd73b('0x36')],'saveName':_0x2277ef,'filename':_0x326c68['file']||_0x2277ef,'savePath':_0x825860})['then'](function(_0x590948){_0x212970(null,_0x590948);})[_0xd73b('0x16')](function(_0x5f1473){_0x212970(_0x5f1473);});};AGIVertices[_0xd73b('0x10')][_0xd73b('0x3e')]=function(_0x5c48c0,_0x4add6e,_0x2c9fbd){this[_0xd73b('0xe')]['createSquareMessage']({'uniqueid':this[_0xd73b('0x33')]['uniqueid'],'body':_0x5c48c0,'direction':_0x4add6e})['then'](function(_0x5c1764){if(_0x2c9fbd){_0x2c9fbd(null,_0x5c1764);}})['catch'](function(_0xcf20b2){if(_0x2c9fbd){_0x2c9fbd(_0xcf20b2);}});};AGIVertices['prototype']['createCmContact']=function(_0x41091d,_0x5efb7c){console[_0xd73b('0x3f')]('in\x20createcmcontact',_0x41091d);console['log'](_0xd73b('0x40'),_0x5efb7c);var _0x3e2f40=0x0;if(_[_0xd73b('0x41')](_0x41091d,_0xd73b('0x42'))){if(!_[_0xd73b('0x43')](_0x41091d[_0xd73b('0x42')])){var _0x1fadd2=_0x41091d[_0xd73b('0x42')];console[_0xd73b('0x3f')](_0xd73b('0x44'),_0x1fadd2);if(_0x41091d['dialTimezone']==_0xd73b('0x45')){this[_0xd73b('0xe')][_0xd73b('0x46')]({'phone':_0x41091d[_0xd73b('0x47')]})[_0xd73b('0x12')](function(_0x58c639){console[_0xd73b('0x3f')](_0xd73b('0x48'),_0x58c639);_0x5efb7c(null,_0x58c639);});}else{console[_0xd73b('0x3f')](_0xd73b('0x49'),shared[_0x1fadd2]);}}}this['rpc'][_0xd73b('0x4a')]({'firstName':_['isEmpty'](_0x41091d[_0xd73b('0x15')])||_[_0xd73b('0x43')](_0x41091d[_0xd73b('0x15')])?_0xd73b('0x4b')+Math['random']():_0x41091d[_0xd73b('0x15')],'lastName':_[_0xd73b('0x4c')](_0x41091d[_0xd73b('0x4d')])||_[_0xd73b('0x43')](_0x41091d[_0xd73b('0x4d')])?null:_0x41091d[_0xd73b('0x4d')],'phone':_0x41091d[_0xd73b('0x47')],'ListId':_0x41091d['list_id'],'scheduledat':_0x41091d[_0xd73b('0x4e')],'callbackUniqueid':this[_0xd73b('0x33')][_0xd73b('0x34')],'tags':'callback','description':_0xd73b('0x4f')+_0x41091d[_0xd73b('0x4e')]['toString'](),'priority':_0x41091d[_0xd73b('0x50')]})['then'](function(_0x26f5b7){_0x5efb7c(null,_0x26f5b7);})['catch'](function(_0x32eb29){_0x5efb7c(_0x32eb29);});};AGIVertices[_0xd73b('0x10')][_0xd73b('0x51')]=function(_0x2381c9,_0x4614b8){this[_0xd73b('0xe')]['getPauseById'](_0x2381c9)[_0xd73b('0x12')](function(_0x5d6faa){_0x4614b8(null,_0x5d6faa?_0x5d6faa[_0xd73b('0x15')]:![]);})['catch'](function(_0x104d4e){_0x4614b8(_0x104d4e);});};AGIVertices[_0xd73b('0x10')]['agentPause']=function(_0x45dcc5,_0x4b095e,_0x5112a9){var _0x33c1b8={'role':_0xd73b('0x52')};_0x33c1b8[_0x45dcc5]=this['channel']['callerid'];this[_0xd73b('0xe')][_0xd73b('0x53')](_0x33c1b8,_0x4b095e,this[_0xd73b('0x33')][_0xd73b('0x34')])['then'](function(_0x5d2206){_0x5112a9(null,_[_0xd73b('0x43')](_0x5d2206)?![]:!![]);})[_0xd73b('0x16')](function(_0x350f14){logger[_0xd73b('0x2a')](_0x350f14);_0x5112a9(null,![]);});};AGIVertices['prototype'][_0xd73b('0x54')]=function(_0x481cfb,_0x4964c3){var _0x2ebb3e={'role':_0xd73b('0x52')};_0x2ebb3e[_0x481cfb]=this[_0xd73b('0x33')][_0xd73b('0x38')];this[_0xd73b('0xe')][_0xd73b('0x54')](_0x2ebb3e)[_0xd73b('0x12')](function(_0xd4d0ab){_0x4964c3(null,_[_0xd73b('0x43')](_0xd4d0ab)?![]:!![]);})[_0xd73b('0x16')](function(_0x5aa38b){logger[_0xd73b('0x2a')](_0x5aa38b);_0x4964c3(null,![]);});};AGIVertices['prototype'][_0xd73b('0x55')]=function(_0x2a4b72,_0x100b10){var _0x1eb661={'role':_0xd73b('0x52')};_0x1eb661[_0x2a4b72]=this['channel'][_0xd73b('0x38')];this[_0xd73b('0xe')][_0xd73b('0x55')](_0x1eb661)['then'](function(_0x2200ed){_0x100b10(null,_[_0xd73b('0x43')](_0x2200ed)?![]:!![]);})[_0xd73b('0x16')](function(_0x593606){logger[_0xd73b('0x2a')](_0x593606);_0x100b10(null,![]);});};AGIVertices[_0xd73b('0x10')][_0xd73b('0x56')]=function(_0x42cfd7,_0x584b99){var _0x39ef41={'role':_0xd73b('0x52')};_0x39ef41[_0x42cfd7]=this[_0xd73b('0x33')][_0xd73b('0x38')];var _0x3a9689=_0x42cfd7!='internal'?util[_0xd73b('0x27')](_0xd73b('0x57'),_0xd73b('0x58'),this['channel']['callerid']):undefined;this[_0xd73b('0xe')][_0xd73b('0x56')](_0x39ef41,_0x3a9689)[_0xd73b('0x12')](function(_0x49947f){_0x584b99(null,_[_0xd73b('0x43')](_0x49947f)?![]:!![]);})[_0xd73b('0x16')](function(_0x5677b4){logger[_0xd73b('0x2a')](_0x5677b4);_0x584b99(null,![]);});};AGIVertices[_0xd73b('0x10')]['shellCommand']=function(_0x1b9fe1,_0x2f426c){sh[_0xd73b('0x59')](_[_0xd73b('0x5a')](_0x1b9fe1),function(_0x58cab9,_0xbdf41e){var _0x2c6511=_0xbdf41e['replace'](/(\r\n|\n|\r)/gm,'');_0x2f426c(null,_0x2c6511);});};AGIVertices['prototype'][_0xd73b('0x5b')]=function(_0x7e5182,_0x1a81cb){scripts[_0xd73b('0x5b')](_0x7e5182['apiKey'],_0x7e5182[_0xd73b('0x5c')]||_0xd73b('0x5d'),_0x7e5182[_0xd73b('0x5d')],_0x7e5182[_0xd73b('0x5e')]||_0xd73b('0x5f'),_0x7e5182['ssmlGender']||_0xd73b('0x60'),_0x7e5182['audioEncoding']||_0xd73b('0x61'))[_0xd73b('0x12')](function(_0x594c76){_0x1a81cb(null,_0x594c76);})[_0xd73b('0x16')](function(_0x34c4d3){_0x1a81cb(_0x34c4d3);});};AGIVertices[_0xd73b('0x10')][_0xd73b('0x62')]=function(_0x47960d,_0x15d09d){scripts['googleTTS'](_0x47960d[_0xd73b('0x5d')],_0x47960d['google_tts_language']||'en',0x1)[_0xd73b('0x12')](function(_0x963746){_0x15d09d(null,_0x963746);})[_0xd73b('0x16')](function(_0x1739c8){_0x15d09d(_0x1739c8);});};AGIVertices['prototype'][_0xd73b('0x63')]=function(_0xbad79a,_0x2851e2){var _0x179b1d={'uri':_0xbad79a[_0xd73b('0x64')],'method':_0xbad79a[_0xd73b('0x65')],'json':!![],'resolveWithFullResponse':!![],'timeout':typeof parseInt(_0xbad79a['timeout'])==='number'&&parseInt(_0xbad79a[_0xd73b('0x66')])>=0x1?parseInt(_0xbad79a['timeout'])*0x3e8:0x5*0x3e8};if(_[_0xd73b('0x67')]([_0xd73b('0x68'),_0xd73b('0x69')],_0x179b1d[_0xd73b('0x65')][_0xd73b('0x6a')]())){try{_0x179b1d[_0xd73b('0x6b')]=_0xbad79a[_0xd73b('0xb')]?JSON[_0xd73b('0x6c')](_0xbad79a[_0xd73b('0xb')]):{};}catch(_0x211e23){logger[_0xd73b('0x2a')](_0xd73b('0x6d'),_0x211e23);}}try{_0x179b1d[_0xd73b('0x6e')]=_0xbad79a[_0xd73b('0xa')]?JSON[_0xd73b('0x6c')](_0xbad79a[_0xd73b('0xa')]):{};}catch(_0x7255ee){logger[_0xd73b('0x2a')](_0xd73b('0x6f'),_0x7255ee);}if(_0xbad79a[_0xd73b('0x70')]){try{var _0x500090=require(_0xbad79a['computedVariables'])[_0xd73b('0x71')](this,_0x179b1d);_0x179b1d[_0xd73b('0x72')]=Mustache['render'](_0xbad79a[_0xd73b('0x64')],_0x500090,{},['$$','$$']);if(_0x179b1d[_0xd73b('0x6e')]){_0x179b1d[_0xd73b('0x6e')]=JSON[_0xd73b('0x6c')](Mustache[_0xd73b('0x73')](JSON[_0xd73b('0x74')](_0x179b1d['headers']),_0x500090,{},['$$','$$']));}if(_0x179b1d['body']){_0x179b1d['body']=JSON[_0xd73b('0x6c')](Mustache['render'](JSON[_0xd73b('0x74')](_0x179b1d[_0xd73b('0x6b')]),_0x500090,{},['$$','$$']));}}catch(_0xd54ddb){logger['error'](_0xd73b('0x75'),_0xd54ddb);}}rp(_0x179b1d)['then'](function(_0x488b2d){var _0x39c0e4={'statusCode':_0x488b2d[_0xd73b('0x76')]||0xc8,'statusMessage':_0x488b2d['statusMessage']||'OK','headers':_0x488b2d[_0xd73b('0x6e')]||{},'body':_0x488b2d[_0xd73b('0x6b')]||{}};_0x2851e2(null,_0x39c0e4);})[_0xd73b('0x16')](function(_0x4ca124){var _0x34514c={'statusCode':_0x4ca124['statusCode']||0x1f4,'statusMessage':_0x4ca124[_0xd73b('0x77')]||'500\x20-\x20Internal\x20Server\x20Error','headers':_0x4ca124[_0xd73b('0x78')]['headers']||{},'body':_0x4ca124[_0xd73b('0x78')][_0xd73b('0x6b')]||{}};_0x2851e2(null,_0x34514c);});};AGIVertices['prototype'][_0xd73b('0x79')]=function(_0x43e294,_0x31eb69){scripts[_0xd73b('0x79')](this[_0xd73b('0x33')]['uniqueid'],_0x43e294[_0xd73b('0x7a')],_0x43e294[_0xd73b('0x5d')],_0x43e294['dialogflow_language']||'en')[_0xd73b('0x12')](function(_0x1c2337){_0x31eb69(null,_0x1c2337);})[_0xd73b('0x16')](function(_0x3f19ef){_0x31eb69(_0x3f19ef);});};AGIVertices['prototype'][_0xd73b('0x7b')]=function(_0x5d19d1,_0x39e1e8){scripts[_0xd73b('0x7b')](this['channel'],_0x5d19d1)[_0xd73b('0x12')](function(_0x1f95b4){_0x39e1e8(null,_0x1f95b4);})['catch'](function(_0x1d8862){_0x39e1e8(_0x1d8862);});};AGIVertices['prototype'][_0xd73b('0x7c')]=function(_0x9b4769,_0x5373e9){scripts[_0xd73b('0x7c')](_0x9b4769[_0xd73b('0x7a')],_0x9b4769['text'],_0x9b4769[_0xd73b('0x7d')]||_0xd73b('0x5f'),_0x9b4769[_0xd73b('0x7e')])[_0xd73b('0x12')](function(_0x228d51){_0x5373e9(null,_0x228d51);})[_0xd73b('0x16')](function(_0x2fcbd1){_0x5373e9(_0x2fcbd1);});};AGIVertices[_0xd73b('0x10')][_0xd73b('0x7f')]=function(_0x2c07c6,_0x28efd0,_0x137ec8){scripts[_0xd73b('0x7f')](_0x28efd0,_0x2c07c6[_0xd73b('0x7a')],_0x2c07c6[_0xd73b('0x80')]||_0xd73b('0x5f'),this['isConfigured'](_0x2c07c6[_0xd73b('0x81')])?_0x2c07c6['model']:undefined)[_0xd73b('0x12')](function(_0x4d6d49){_0x137ec8(null,_0x4d6d49);})[_0xd73b('0x16')](function(_0x3f1347){_0x137ec8(_0x3f1347);});};AGIVertices[_0xd73b('0x10')][_0xd73b('0x82')]=function(_0xde6554,_0x4fdca0){scripts['awsPolly'](_0xde6554['aws_access_key_id'],_0xde6554['aws_secret_access_key'],_0xde6554[_0xd73b('0x83')],_0xde6554['aws_polly_voice']||'Amy',_0xde6554['text'],_0xde6554['aws_text_type']||'text')['then'](function(_0xbf7cfb){_0x4fdca0(null,_0xbf7cfb);})['catch'](function(_0x56f02c){_0x4fdca0(_0x56f02c);});};AGIVertices[_0xd73b('0x10')][_0xd73b('0x84')]=function(_0x39765f,_0x34d04e){scripts[_0xd73b('0x84')](this[_0xd73b('0x33')][_0xd73b('0x34')],_0x39765f['aws_access_key_id'],_0x39765f[_0xd73b('0x85')],_0x39765f['aws_lex_region'],_0x39765f[_0xd73b('0x5d')],_0x39765f[_0xd73b('0x86')])['then'](function(_0x568995){_0x34d04e(null,_0x568995);})['catch'](function(_0x14fef5){_0x34d04e(_0x14fef5);});};AGIVertices['prototype'][_0xd73b('0x87')]=function(_0x3b1a8d,_0x4410ae,_0x2187dc){scripts[_0xd73b('0x87')](_0x4410ae,_0x3b1a8d['key'],_0x3b1a8d[_0xd73b('0x88')]||_0xd73b('0x5f'))[_0xd73b('0x12')](function(_0x27a81e){_0x2187dc(null,_0x27a81e);})[_0xd73b('0x16')](function(_0x22ba9f){_0x2187dc(_0x22ba9f);});};AGIVertices[_0xd73b('0x10')][_0xd73b('0x89')]=function(_0xd2a634,_0x5dcbd5,_0x341c10){scripts[_0xd73b('0x89')](_0x5dcbd5,_0xd2a634['appid'],_0xd2a634[_0xd73b('0x8a')],_0xd2a634[_0xd73b('0x72')])[_0xd73b('0x12')](function(_0x4d0fd0){_0x341c10(null,_0x4d0fd0);})[_0xd73b('0x16')](function(_0x10e289){_0x341c10(_0x10e289);});};AGIVertices[_0xd73b('0x10')]['clear']=function(_0x56ba5d){var _0x283721=_[_0xd73b('0x67')](verticesWithRetry,_0x56ba5d[_0xd73b('0x35')])?_0x56ba5d:_[_0xd73b('0x8b')](_0x56ba5d);for(var _0x295e72 in _0x283721){if(_0x283721['hasOwnProperty'](_0x295e72)){if(_0x283721[_0x295e72]&&_[_0xd73b('0x8c')](_0x283721[_0x295e72])){if(_[_0xd73b('0x67')](recursiveMapAttributes,_0x295e72)){_0x283721[_0x295e72]=this[_0xd73b('0x8d')](_0x283721[_0x295e72]);}else{_0x283721[_0x295e72]=this[_0xd73b('0x8e')](_0x283721[_0x295e72]);}}}}return _0x283721;};AGIVertices[_0xd73b('0x10')][_0xd73b('0x8f')]=function(_0x349f43){for(var _0x2ae4d1 in _0x349f43){if(_0x349f43[_0xd73b('0x90')](_0x2ae4d1)){if(_[_0xd73b('0x91')](_0x349f43[_0x2ae4d1])){this['recursiveNodeIndex'](_0x349f43[_0x2ae4d1]);}else if(_[_0xd73b('0x92')](_0x349f43[_0x2ae4d1])){for(var _0x2bb27a=0x0;_0x2bb27a<_0x349f43[_0x2ae4d1]['length'];_0x2bb27a++){this[_0xd73b('0x8f')](_0x349f43[_0x2ae4d1][_0x2bb27a]);}}else if(_['isString'](_0x349f43[_0x2ae4d1])){_0x349f43[_0x2ae4d1]=this[_0xd73b('0x8e')](_0x349f43[_0x2ae4d1]);}}}};AGIVertices['prototype'][_0xd73b('0x93')]=function(_0x4de56c,_0x2fcf0d){for(var _0x4c4cad in _0x4de56c){if(_0x4de56c[_0xd73b('0x90')](_0x4c4cad)){if(_[_0xd73b('0x91')](_0x4de56c[_0x4c4cad])){if(!_[_0xd73b('0x4c')](_0x4de56c[_0x4c4cad])){this[_0xd73b('0x93')](_0x4de56c[_0x4c4cad],util[_0xd73b('0x27')](_0xd73b('0x94'),_0x2fcf0d,_0x4c4cad));}}else if(_[_0xd73b('0x92')](_0x4de56c[_0x4c4cad])){for(var _0x1e2569=0x0;_0x1e2569<_0x4de56c[_0x4c4cad]['length'];_0x1e2569++){this[_0xd73b('0x93')](_0x4de56c[_0x4c4cad][_0x1e2569],util['format'](_0xd73b('0x94'),_0x2fcf0d,_0x4c4cad+'['+_0x1e2569+']'));}}else{if(!_['isNil'](_0x4de56c[_0x4c4cad])){this[_0xd73b('0x33')][_0xd73b('0x95')](util[_0xd73b('0x27')](_0xd73b('0x94'),_0x2fcf0d,_0x4c4cad),_0x4de56c[_0x4c4cad]);}}}}};AGIVertices[_0xd73b('0x10')][_0xd73b('0x8d')]=function(_0x4d276e){try{var _0x191f4b=JSON['parse'](_0x4d276e);this[_0xd73b('0x8f')](_0x191f4b);return JSON[_0xd73b('0x74')](_0x191f4b);}catch(_0x42e1bc){return this[_0xd73b('0x8e')](_0x4d276e);}};AGIVertices['prototype'][_0xd73b('0x8e')]=function(_0x5f55f2){console['log'](_0xd73b('0x96'),_0x5f55f2);var _0x12fe93=_0x5f55f2['split']('{');for(var _0x54f5d0=0x1;_0x54f5d0<_0x12fe93['length'];_0x54f5d0+=0x1){var _0x25287b=_0x12fe93[_0x54f5d0][_0xd73b('0x97')]('}');console[_0xd73b('0x3f')]('nextbracket',_0x25287b);if(_0x25287b[_0xd73b('0x98')]>0x1){_0x5f55f2=_0x5f55f2[_0xd73b('0x99')]('{'+_0x25287b[0x0]+'}',this['channel']['getVariable'](_0x25287b[0x0])['extra']||_0x25287b[0x0]);}}if(_0x12fe93[_0xd73b('0x98')]===0x1){return _0x5f55f2[_0xd73b('0x9a')]();}console['log'](_0xd73b('0x9b'),_0x5f55f2);return this[_0xd73b('0x8e')](_0x5f55f2);};AGIVertices[_0xd73b('0x10')]['getAndSetVariable']=function(_0x5d7c3d,_0x374f32){var _0x54729a=this['channel']['getVariable'](_0x5d7c3d);if(_0x54729a[_0xd73b('0x9c')]===-0x1){return _0x54729a;}logger[_0xd73b('0x2b')](util[_0xd73b('0x27')](_0xd73b('0x9d'),_0x374f32,_0x54729a['extra']));return this[_0xd73b('0x33')][_0xd73b('0x95')](_0x374f32,_0x54729a[_0xd73b('0x9e')]);};AGIVertices['prototype'][_0xd73b('0x9f')]=function(_0x4a11ca){return _0x4a11ca&&_0x4a11ca!=='0'&&_0x4a11ca!=='-1'&&_0x4a11ca!=='';};AGIVertices[_0xd73b('0x10')][_0xd73b('0xa0')]=function(_0x2e7568){this['createSquareDetailsReport']['sync'](this,_0x2e7568,'-');_0x2e7568[_0xd73b('0xa1')]=_0x2e7568[_0xd73b('0xa0')];return{'code':0xc8,'result':'-'};};AGIVertices[_0xd73b('0x10')][_0xd73b('0xa2')]=function(_0x185bd2){logger[_0xd73b('0x2b')](util['format'](_0xd73b('0xa3'),_0x185bd2['label']));if(!this[_0xd73b('0x9f')](_0x185bd2['text'])){return this[_0xd73b('0x33')][_0xd73b('0xa4')](_0xd73b('0xa5'));}var _0x11db80='\x22'+_0x185bd2['text']+'\x22';if(this[_0xd73b('0x9f')](_0x185bd2[_0xd73b('0x78')])){_0x11db80+=','+_0x185bd2['options'];}var _0x481149=this['channel'][_0xd73b('0x59')](_0xd73b('0xa6'),_0x11db80);if(_0x481149[_0xd73b('0x9c')]===-0x1){return _0x481149;}return this[_0xd73b('0x33')]['noop'](util[_0xd73b('0x27')](_0xd73b('0xa7'),_0x11db80));};AGIVertices[_0xd73b('0x10')][_0xd73b('0xa8')]=function(_0x122eb){logger['info'](util[_0xd73b('0x27')](_0xd73b('0xa9'),_0x122eb['label']));if(!this[_0xd73b('0x9f')](_0x122eb[_0xd73b('0xaa')])){return this[_0xd73b('0x33')][_0xd73b('0xa4')]('no\x20grammar\x20configured');}var _0x35864b=_0x122eb[_0xd73b('0xaa')];if(this[_0xd73b('0x9f')](_0x122eb[_0xd73b('0x78')])){_0x35864b+=','+_0x122eb[_0xd73b('0x78')];}var _0x2acd77=this[_0xd73b('0x33')][_0xd73b('0x59')]('MRCPRecog',_0x35864b);if(_0x2acd77[_0xd73b('0x9c')]===-0x1){return _0x2acd77;}var _0x468a20=this[_0xd73b('0xab')](_0xd73b('0xac'),_0xd73b('0xad'));if(_0x468a20[_0xd73b('0x9c')]===-0x1){return _0x468a20;}var _0x1309e7=this[_0xd73b('0xab')](_0xd73b('0xae'),_0xd73b('0xaf'));if(_0x1309e7[_0xd73b('0x9c')]===-0x1){return _0x1309e7;}var _0x29c721=this['getAndSetVariable'](_0xd73b('0xb0'),_0xd73b('0xb1'));if(_0x29c721[_0xd73b('0x9c')]===-0x1){return _0x29c721;}return this['channel'][_0xd73b('0xa4')](util[_0xd73b('0x27')](_0xd73b('0xb2'),_0x35864b));};AGIVertices[_0xd73b('0x10')][_0xd73b('0x7')]=function(_0x29f796){logger[_0xd73b('0x2b')](util[_0xd73b('0x27')](_0xd73b('0xb3'),_0x29f796[_0xd73b('0xb4')]));return this[_0xd73b('0x33')]['agi']([_0x29f796['command'],_0x29f796[_0xd73b('0xb5')]]);};AGIVertices[_0xd73b('0x10')][_0xd73b('0xb6')]=function(_0xa7e8c6){logger['info'](util[_0xd73b('0x27')](_0xd73b('0xb7'),_0xa7e8c6['label']));if(this[_0xd73b('0x9f')](_0xa7e8c6[_0xd73b('0x66')])){logger[_0xd73b('0x2b')](util[_0xd73b('0x27')](_0xd73b('0xb8'),_0xa7e8c6['timeout']));var _0x28ba0a=this[_0xd73b('0x33')]['wait'](_0xa7e8c6[_0xd73b('0x66')]);if(_0x28ba0a[_0xd73b('0x9c')]===-0x1){return _0x28ba0a;}}return this[_0xd73b('0x33')][_0xd73b('0xb6')]();};AGIVertices['prototype'][_0xd73b('0xb9')]=function(_0x519269){console['log'](_0xd73b('0xba'),_0x519269);logger[_0xd73b('0x2b')](util[_0xd73b('0x27')](_0xd73b('0xbb'),_0x519269[_0xd73b('0xb4')]));if(!this[_0xd73b('0x9f')](_0x519269[_0xd73b('0xbc')])){return this[_0xd73b('0x33')][_0xd73b('0x2a')](_0x519269,_0xd73b('0xbd'));}_0x519269['scheduledAt']=moment();if(this[_0xd73b('0x9f')](_0x519269[_0xd73b('0xbe')])){_0x519269[_0xd73b('0x4e')]=moment()[_0xd73b('0xbf')](_0x519269[_0xd73b('0xbe')],_0xd73b('0xc0'));}if(!this[_0xd73b('0x9f')](_0x519269[_0xd73b('0x50')])){_0x519269[_0xd73b('0x50')]=0x2;}console[_0xd73b('0x3f')](_0xd73b('0xc1'),_0x519269);this[_0xd73b('0x4a')][_0xd73b('0x71')](this,_0x519269);return this['channel'][_0xd73b('0xa4')](util['format'](_0xd73b('0xc2'),_0x519269[_0xd73b('0x47')],_0x519269[_0xd73b('0xbc')],_0x519269[_0xd73b('0x4e')]));};AGIVertices['prototype'][_0xd73b('0xc3')]=function(_0x12d1dd){logger[_0xd73b('0x2b')](util[_0xd73b('0x27')]('Enter\x20in\x20CUSTOM\x20APP\x20(%s)\x20block',_0x12d1dd['label']));var _0xaa4775=this[_0xd73b('0x33')][_0xd73b('0x59')](_0x12d1dd[_0xd73b('0xc4')],_0x12d1dd[_0xd73b('0x78')]);if(_0xaa4775[_0xd73b('0x9c')]===-0x1){return _0xaa4775;}return this[_0xd73b('0x33')][_0xd73b('0xa4')](util[_0xd73b('0x27')](_0xd73b('0xc5'),_0x12d1dd['application'],_0x12d1dd[_0xd73b('0x78')]));};AGIVertices[_0xd73b('0x10')][_0xd73b('0xc6')]=function(_0x4bc33e){logger['info'](util[_0xd73b('0x27')](_0xd73b('0xc7'),_0x4bc33e[_0xd73b('0xb4')]));if(!this[_0xd73b('0x9f')](_0x4bc33e[_0xd73b('0x5d')])){return this[_0xd73b('0x33')][_0xd73b('0xa4')]('no\x20text\x20configured');}var _0x2ef41e='\x22'+_0x4bc33e[_0xd73b('0x5d')]+'\x22';if(this[_0xd73b('0x9f')](_0x4bc33e[_0xd73b('0x78')])){_0x2ef41e+=','+_0x4bc33e['options'];}var _0x3c1e9d=this[_0xd73b('0x33')][_0xd73b('0x59')](_0xd73b('0xa6'),_0x2ef41e);if(_0x3c1e9d['result']===-0x1){return _0x3c1e9d;}return this[_0xd73b('0x33')][_0xd73b('0xa4')](util[_0xd73b('0x27')]('Executed\x20command\x20MRCPSynth\x20%s',_0x2ef41e));};AGIVertices[_0xd73b('0x10')][_0xd73b('0xc8')]=function(_0x2df483){logger[_0xd73b('0x2b')](util[_0xd73b('0x27')](_0xd73b('0xc9'),_0x2df483[_0xd73b('0xb4')]));if(!this['isConfigured'](_0x2df483[_0xd73b('0x5d')])){return this[_0xd73b('0x33')][_0xd73b('0xa4')]('no\x20text\x20configured');}var _0x48d48f='\x22'+_0x2df483[_0xd73b('0x5d')]+'\x22';if(this[_0xd73b('0x9f')](_0x2df483[_0xd73b('0x78')])){_0x48d48f+=','+_0x2df483['options'];}var _0x20c6ad=this[_0xd73b('0x33')][_0xd73b('0x59')]('MRCPSynth',_0x48d48f);if(_0x20c6ad[_0xd73b('0x9c')]===-0x1){return _0x20c6ad;}return this[_0xd73b('0x33')][_0xd73b('0xa4')](util['format']('Executed\x20command\x20MRCPSynth\x20%s',_0x48d48f));};AGIVertices[_0xd73b('0x10')][_0xd73b('0xca')]=function(_0x2c483a){logger[_0xd73b('0x2b')](util[_0xd73b('0x27')](_0xd73b('0xcb'),_0x2c483a[_0xd73b('0xb4')]));if(!this[_0xd73b('0x9f')](_0x2c483a[_0xd73b('0xaa')])){return this[_0xd73b('0x33')][_0xd73b('0xa4')](_0xd73b('0xcc'));}var _0x5dc88f=_0x2c483a['grammar'];if(this[_0xd73b('0x9f')](_0x2c483a[_0xd73b('0x78')])){_0x5dc88f+=','+_0x2c483a['options'];}var _0x421887=this['channel'][_0xd73b('0x59')](_0xd73b('0xcd'),_0x5dc88f);if(_0x421887['result']===-0x1){return _0x421887;}var _0x241c13=this[_0xd73b('0xab')]('RECOG_CONFIDENCE()',_0xd73b('0xce'));if(_0x241c13['result']===-0x1){return _0x241c13;}var _0x4eb970=this['getAndSetVariable'](_0xd73b('0xae'),_0xd73b('0xcf'));if(_0x4eb970[_0xd73b('0x9c')]===-0x1){return _0x4eb970;}var _0x5bdebd=this[_0xd73b('0xab')](_0xd73b('0xb0'),_0xd73b('0xd0'));if(_0x5bdebd[_0xd73b('0x9c')]===-0x1){return _0x5bdebd;}return this[_0xd73b('0x33')][_0xd73b('0xa4')](util[_0xd73b('0x27')]('Executed\x20command\x20MRCPRecog\x20%s',_0x5dc88f));};AGIVertices[_0xd73b('0x10')][_0xd73b('0xd1')]=function(_0x52f7d1){logger[_0xd73b('0x2b')](util[_0xd73b('0x27')](_0xd73b('0xd2'),_0x52f7d1[_0xd73b('0xb4')]));if(!this[_0xd73b('0x9f')](_0x52f7d1[_0xd73b('0xaa')])){return this[_0xd73b('0x33')][_0xd73b('0xa4')](_0xd73b('0xcc'));}var _0x574940=_0x52f7d1[_0xd73b('0xaa')];if(this['isConfigured'](_0x52f7d1['options'])){_0x574940+=','+_0x52f7d1[_0xd73b('0x78')];}var _0x201f40=this[_0xd73b('0x33')][_0xd73b('0x59')](_0xd73b('0xcd'),_0x574940);if(_0x201f40['result']===-0x1){return _0x201f40;}var _0x47d7a8=this[_0xd73b('0xab')](_0xd73b('0xac'),'SESTEK_ASR_CONFIDENCE');if(_0x47d7a8['result']===-0x1){return _0x47d7a8;}var _0xc84431=this[_0xd73b('0xab')](_0xd73b('0xae'),_0xd73b('0xd3'));if(_0xc84431[_0xd73b('0x9c')]===-0x1){return _0xc84431;}var _0x71534d=this[_0xd73b('0xab')]('RECOG_INSTANCE()',_0xd73b('0xd4'));if(_0x71534d[_0xd73b('0x9c')]===-0x1){return _0x71534d;}return this[_0xd73b('0x33')][_0xd73b('0xa4')](util[_0xd73b('0x27')]('Executed\x20command\x20MRCPRecog\x20%s',_0x574940));};AGIVertices[_0xd73b('0x10')][_0xd73b('0xd5')]=function(_0x5c5a9b){logger[_0xd73b('0x2b')](util[_0xd73b('0x27')]('Enter\x20in\x20DATABASE\x20(%s)\x20block',_0x5c5a9b[_0xd73b('0xb4')]));if(!this[_0xd73b('0x9f')](_0x5c5a9b['odbc_id'])){return this[_0xd73b('0x33')][_0xd73b('0x2a')](_0x5c5a9b,'no\x20database\x20selected');}var _0x35107a=this['getSquareOdbc'][_0xd73b('0x71')](this,_0x5c5a9b['odbc_id']);if(!_0x35107a){return this[_0xd73b('0x33')]['error'](_0x5c5a9b,_0xd73b('0xd6'));}if(!this[_0xd73b('0x9f')](_0x5c5a9b[_0xd73b('0x2c')])){return this['channel'][_0xd73b('0x2a')](_0x5c5a9b,'no\x20query\x20configured');}var _0x5e99c9=_0x5c5a9b[_0xd73b('0x2c')][_0xd73b('0xd7')](/(\r\n|\n|\r)/gm,'\x20');this['channel'][_0xd73b('0xa4')](util[_0xd73b('0x27')](_0xd73b('0xd8'),_0x5e99c9));var _0x247988=this[_0xd73b('0xd9')][_0xd73b('0x71')](this,_0x35107a,_0x5e99c9);this[_0xd73b('0x32')]['sync'](this,_0x5c5a9b,_0x5e99c9);if(!this[_0xd73b('0x9f')](_0x5c5a9b[_0xd73b('0xda')])){return this['channel']['noop']('no\x20variable\x20selected\x20for\x20the\x20result');}var _0x8c52a8=this[_0xd73b('0x11')][_0xd73b('0x71')](this,_0x5c5a9b['variable_id']);if(!_0x8c52a8){return this['channel'][_0xd73b('0x2a')](_0x5c5a9b,_0xd73b('0xdb'));}var _0x2cad2f=this;_0x247988['forEach'](function(_0xb3e848,_0x5c037d){Object[_0xd73b('0xdc')](_0xb3e848)['forEach'](function(_0x1eb1e0){_0x2cad2f[_0xd73b('0x33')][_0xd73b('0x95')](util[_0xd73b('0x27')](_0xd73b('0xdd'),_0x8c52a8,_0x5c037d,_0x1eb1e0),_0xb3e848[_0x1eb1e0]);});});this[_0xd73b('0x33')][_0xd73b('0x95')](util[_0xd73b('0x27')]('%s_ROWS_COUNT',_0x8c52a8),_0x247988[_0xd73b('0x98')]);return this[_0xd73b('0x33')][_0xd73b('0xa4')](util[_0xd73b('0x27')]('variable\x20%s\x20set',_0x8c52a8));};AGIVertices[_0xd73b('0x10')][_0xd73b('0xde')]=function(_0x47dc4b){logger[_0xd73b('0xdf')](util['format']('Enter\x20in\x20DIAL\x20(%s)\x20block',_0x47dc4b[_0xd73b('0xb4')]));if(!this[_0xd73b('0x9f')](_0x47dc4b[_0xd73b('0xe0')])){return this['channel'][_0xd73b('0x2a')](_0x47dc4b,_0xd73b('0xe1'));}var _0x456af9=this[_0xd73b('0xe2')][_0xd73b('0x71')](this,_0x47dc4b[_0xd73b('0xe0')]);if(!_0x456af9){return this['channel'][_0xd73b('0x2a')](_0x47dc4b,_0xd73b('0xe3'));}var _0x4e1bca=this[_0xd73b('0x33')][_0xd73b('0x59')](_0xd73b('0xe4'),[util[_0xd73b('0x27')]('SIP/%s',_0x456af9),_0x47dc4b[_0xd73b('0x66')],_0x47dc4b[_0xd73b('0xe5')],_0x47dc4b['url']]);if(_0x4e1bca['result']===-0x1){return _0x4e1bca;}return this[_0xd73b('0x33')][_0xd73b('0xa4')](util[_0xd73b('0x27')](_0xd73b('0xe6'),'DIAL'));};AGIVertices[_0xd73b('0x10')][_0xd73b('0xe7')]=function(_0x1a03e1){logger['info'](util[_0xd73b('0x27')](_0xd73b('0xe8'),_0x1a03e1[_0xd73b('0xb4')]));if(!this[_0xd73b('0x9f')](_0x1a03e1[_0xd73b('0x7a')])){return this[_0xd73b('0x33')][_0xd73b('0xa4')](_0xd73b('0xe9'));}if(!this[_0xd73b('0x9f')](_0x1a03e1[_0xd73b('0x5d')])){return this[_0xd73b('0x33')][_0xd73b('0xa4')](_0xd73b('0xa5'));}this[_0xd73b('0x33')][_0xd73b('0xea')]=!![];this[_0xd73b('0x32')](_0x1a03e1);this[_0xd73b('0x3e')](_0x1a03e1['text'],'in');this['channel'][_0xd73b('0xa4')](util['format']('Trying\x20Dialogflow:\x20%s',_0x1a03e1[_0xd73b('0x5d')]));var _0x39951f=this[_0xd73b('0x79')][_0xd73b('0x71')](this,_0x1a03e1);if(_0x39951f){for(var _0x195a59 in _0x39951f){if(_0x39951f[_0xd73b('0x90')](_0x195a59)){this[_0xd73b('0x33')]['setVariable'](util[_0xd73b('0x27')](_0xd73b('0xeb'),_0x195a59[_0xd73b('0x6a')]()),_0x39951f[_0x195a59]);}}this[_0xd73b('0x3e')](_0x39951f['speech'],'out');return this[_0xd73b('0x33')][_0xd73b('0xa4')](util[_0xd73b('0x27')]('Dialogflow\x20Result\x20%s',_0x39951f['speech']));}return this[_0xd73b('0x33')]['error'](_0x1a03e1,_0xd73b('0xec'));};AGIVertices[_0xd73b('0x10')][_0xd73b('0xed')]=function(_0x116756){logger[_0xd73b('0x2b')](util[_0xd73b('0x27')]('Enter\x20in\x20SESTEKNDA\x20(%s)\x20block',_0x116756[_0xd73b('0xb4')]));if(!this['isConfigured'](_0x116756[_0xd73b('0xee')])){return this[_0xd73b('0x33')][_0xd73b('0xa4')](_0xd73b('0xef'));}if(!this['isConfigured'](_0x116756[_0xd73b('0xf0')])){return this['channel']['noop'](_0xd73b('0xf1'));}if(!this[_0xd73b('0x9f')](_0x116756[_0xd73b('0xf2')])){return this[_0xd73b('0x33')][_0xd73b('0xa4')](_0xd73b('0xf3'));}if(!this['isConfigured'](_0x116756['ndassistant_url'])){return this['channel'][_0xd73b('0xa4')](_0xd73b('0xa5'));}this[_0xd73b('0x33')]['bot']=!![];this['createSquareDetailsReport'](_0x116756);this['createSquareMessage'](_0x116756[_0xd73b('0x5d')],'in');this[_0xd73b('0x33')][_0xd73b('0xa4')](util[_0xd73b('0x27')]('Trying\x20SestekNDA:\x20%s',_0x116756[_0xd73b('0x5d')]));var _0x3e5607=this[_0xd73b('0x7b')][_0xd73b('0x71')](this,_0x116756);if(_0x3e5607){for(var _0x17aa79 in _0x3e5607){if(_0x3e5607['hasOwnProperty'](_0x17aa79)){this['channel'][_0xd73b('0x95')](util[_0xd73b('0x27')](_0xd73b('0xf4'),_0x17aa79[_0xd73b('0x6a')]()),_0x3e5607[_0x17aa79]);}}this['createSquareMessage'](_0x3e5607[_0xd73b('0xf5')],_0xd73b('0xf6'));if(_0x3e5607['audiofile']){this['channel'][_0xd73b('0xa4')](util[_0xd73b('0x27')](_0xd73b('0xf7'),_0x3e5607[_0xd73b('0xf8')]));var _0x56533b=this[_0xd73b('0x33')]['streamFile'](_0x3e5607['audiofile']);try{fs['unlink'](_0x3e5607[_0xd73b('0xf8')]+_0xd73b('0xf9'));}catch(_0x57540b){logger[_0xd73b('0x2a')](_0x57540b);}return _0x56533b;}else{return this[_0xd73b('0x33')]['noop'](util[_0xd73b('0x27')]('SestekNDA\x20Result\x20%s',_0x3e5607[_0xd73b('0xf5')]));}}return this[_0xd73b('0x33')][_0xd73b('0x2a')](_0x116756,'SestekNDA\x20is\x20unreachable');};AGIVertices['prototype'][_0xd73b('0xfa')]=function(_0x5286e8){logger['info'](util['format']('Enter\x20in\x20END\x20(%s)\x20block',_0x5286e8[_0xd73b('0xb4')]));return this[_0xd73b('0x33')][_0xd73b('0xa4')](_0xd73b('0xfa'));};AGIVertices['prototype'][_0xd73b('0xfb')]=function(_0x475893){logger['info'](util[_0xd73b('0x27')](_0xd73b('0xfc'),_0x475893['label']));var _0x3c2d66='';if(_0x475893[_0xd73b('0xfd')]){if(!this[_0xd73b('0x9f')](_0x475893['trunk_id'])){return this[_0xd73b('0x33')][_0xd73b('0x2a')](_0x475893,_0xd73b('0xfe'));}else{var _0x4e8308=parseInt(_0x475893[_0xd73b('0xfd')],0xa);if(isNaN(_0x4e8308)){_0x3c2d66=_0x475893[_0xd73b('0xfd')];}else{_0x3c2d66=this[_0xd73b('0x1b')][_0xd73b('0x71')](this,_0x475893[_0xd73b('0xfd')]);if(!_0x3c2d66){return this['channel'][_0xd73b('0x2a')](_0x475893,_0xd73b('0xff'));}}}}else if(_0x475893[_0xd73b('0x100')]){_0x3c2d66=_0x475893[_0xd73b('0x100')];}else{return this[_0xd73b('0x33')][_0xd73b('0x2a')](_0x475893,'no\x20trunk\x20selected');}var _0x262ec2=this[_0xd73b('0x33')][_0xd73b('0x59')](_0xd73b('0xe4'),[util[_0xd73b('0x27')](_0xd73b('0x101'),_0x3c2d66,_0x475893[_0xd73b('0x47')]),_0x475893[_0xd73b('0x66')],_0x475893[_0xd73b('0xe5')],_0x475893[_0xd73b('0x64')]]);if(_0x262ec2['result']===-0x1){return _0x262ec2;}return this[_0xd73b('0x33')]['noop'](util[_0xd73b('0x27')](_0xd73b('0xe6'),_0xd73b('0xe4')));};AGIVertices[_0xd73b('0x10')][_0xd73b('0x102')]=function(_0x5c4529){logger['info'](util[_0xd73b('0x27')]('Enter\x20in\x20FINALLY\x20(%s)\x20block',_0x5c4529[_0xd73b('0xb4')]));return this[_0xd73b('0x33')]['noop'](_0xd73b('0x102'));};AGIVertices[_0xd73b('0x10')]['getdigits']=function(_0x3c33b3){logger['info'](util[_0xd73b('0x27')](_0xd73b('0x103'),_0x3c33b3[_0xd73b('0xb4')]));if(_0x3c33b3['retry']===0x0){return this[_0xd73b('0xa0')](_0x3c33b3);}_0x3c33b3[_0xd73b('0xa1')]-=0x1;if(!this[_0xd73b('0x9f')](_0x3c33b3[_0xd73b('0x104')])){return this[_0xd73b('0x33')]['error'](_0x3c33b3,_0xd73b('0x105'));}var _0xc333e4=this[_0xd73b('0x1d')][_0xd73b('0x71')](this,_0x3c33b3['file_id']);if(!_0xc333e4){return this[_0xd73b('0x33')][_0xd73b('0x2a')](_0x3c33b3,'no\x20file\x20audio\x20found');}if(!this[_0xd73b('0x9f')](_0x3c33b3[_0xd73b('0xda')])){return this[_0xd73b('0x33')][_0xd73b('0x2a')]('no\x20variable\x20selected\x20for\x20the\x20result');}var _0x18dcb4=this[_0xd73b('0x33')][_0xd73b('0x106')](_0xc333e4,_0x3c33b3['response'],_0x3c33b3['maxdigit']);var _0x4859ef=_0x18dcb4[_0xd73b('0x9c')]?_0x18dcb4[_0xd73b('0x9c')][_0xd73b('0x9a')]():'';logger[_0xd73b('0x2b')](_0xd73b('0x107'),JSON[_0xd73b('0x74')](_0x18dcb4));if(_0x18dcb4['result']===-0x1){this[_0xd73b('0x32')][_0xd73b('0x71')](this,_0x3c33b3,_0x4859ef);return _0x18dcb4;}else if(_0x18dcb4['extra']===_0xd73b('0x66')){_0x18dcb4[_0xd73b('0x9c')]=_0x4859ef[_0xd73b('0x98')]>=parseInt(_0x3c33b3[_0xd73b('0x108')])?'x':'i';}else{_0x18dcb4[_0xd73b('0x9c')]=_0x4859ef[_0xd73b('0x98')]>=parseInt(_0x3c33b3['mindigit'])&&_0x4859ef[_0xd73b('0x98')]<=parseInt(_0x3c33b3[_0xd73b('0x109')])?'x':'i';}var _0x5f44a0=this['getVariable'][_0xd73b('0x71')](this,_0x3c33b3[_0xd73b('0xda')]);if(!_0x5f44a0){return this[_0xd73b('0x33')][_0xd73b('0x2a')](_0x3c33b3,'no\x20variable\x20found');}this[_0xd73b('0x33')][_0xd73b('0x95')](_0x5f44a0,_0x4859ef);if(this[_0xd73b('0x9f')](_0x3c33b3[_0xd73b('0x10a')])){var _0x541d91=parseInt(_0x3c33b3['hiddendigitsnum'],0xa);var _0x2a2eee=rs[_0xd73b('0x10b')]({'charset':'*','length':_0x541d91});var _0x11992d=_0x4859ef[_0xd73b('0x98')];if(_0x11992d>0x0){if(_0x11992d>_0x541d91){this[_0xd73b('0x32')]['sync'](this,_0x3c33b3,_0x3c33b3['hiddendigitspos']==='first'?_0x2a2eee+_0x4859ef[_0xd73b('0x10c')](_0x541d91):_0x4859ef[_0xd73b('0x10c')](0x0,_0x11992d-_0x541d91)+_0x2a2eee);}else{this[_0xd73b('0x32')][_0xd73b('0x71')](this,_0x3c33b3,rs['generate']({'charset':'*','length':_0x11992d}));}}else{this[_0xd73b('0x32')][_0xd73b('0x71')](this,_0x3c33b3,'');}}else{this[_0xd73b('0x32')][_0xd73b('0x71')](this,_0x3c33b3,_0x4859ef);}return _0x18dcb4;};AGIVertices[_0xd73b('0x10')][_0xd73b('0x10d')]=function(_0x43fdac){logger[_0xd73b('0x2b')](util[_0xd73b('0x27')]('Enter\x20in\x20GETSECRETDIGITS\x20(%s)\x20block',_0x43fdac[_0xd73b('0xb4')]));return this['getdigits'](_0x43fdac);};AGIVertices['prototype'][_0xd73b('0x10e')]=function(_0x3b5740){logger[_0xd73b('0x2b')](util[_0xd73b('0x27')](_0xd73b('0x10f'),_0x3b5740[_0xd73b('0xb4')]));this[_0xd73b('0x32')][_0xd73b('0x71')](this,_0x3b5740,_0x3b5740[_0xd73b('0x110')]);return this[_0xd73b('0x33')][_0xd73b('0xa4')](util['format'](_0xd73b('0x111'),_0x3b5740['goalname']));};AGIVertices[_0xd73b('0x10')][_0xd73b('0x112')]=function(_0x2d3645){logger[_0xd73b('0x2b')](util['format']('[AGI]\x20Enter\x20in\x20AWSPOLLY\x20(%s)\x20block',_0x2d3645[_0xd73b('0xb4')]));if(!this[_0xd73b('0x9f')](_0x2d3645[_0xd73b('0x113')])||!this['isConfigured'](_0x2d3645[_0xd73b('0x85')])){return this[_0xd73b('0x33')][_0xd73b('0xa4')](_0xd73b('0x114'));}if(!this[_0xd73b('0x9f')](_0x2d3645['text'])){return this[_0xd73b('0x33')][_0xd73b('0xa4')](_0xd73b('0xa5'));}this[_0xd73b('0x33')]['noop'](util[_0xd73b('0x27')](_0xd73b('0x115'),_0x2d3645[_0xd73b('0x5d')]));var _0x3c8a84=this[_0xd73b('0x82')][_0xd73b('0x71')](this,_0x2d3645);if(_0x3c8a84){this[_0xd73b('0x33')][_0xd73b('0xa4')](util[_0xd73b('0x27')](_0xd73b('0x116'),_0x3c8a84));var _0x523c74=this[_0xd73b('0x33')][_0xd73b('0x117')](_0x3c8a84);try{fs[_0xd73b('0x118')](_0x3c8a84+'.wav');}catch(_0x24f92a){logger[_0xd73b('0x2a')](_0x24f92a);}return _0x523c74;}return this['channel']['error'](_0x2d3645,_0xd73b('0x119'));};AGIVertices[_0xd73b('0x10')]['awslex']=function(_0x5420b3){logger[_0xd73b('0x2b')](util[_0xd73b('0x27')](_0xd73b('0x11a'),_0x5420b3[_0xd73b('0xb4')]));if(!this[_0xd73b('0x9f')](_0x5420b3[_0xd73b('0x113')])||!this[_0xd73b('0x9f')](_0x5420b3['aws_secret_access_key'])){return this[_0xd73b('0x33')][_0xd73b('0xa4')]('no\x20valid\x20credentials\x20configured');}if(!this[_0xd73b('0x9f')](_0x5420b3[_0xd73b('0x86')])){return this[_0xd73b('0x33')]['noop'](_0xd73b('0x11b'));}if(!this[_0xd73b('0x9f')](_0x5420b3[_0xd73b('0x5d')])){return this[_0xd73b('0x33')][_0xd73b('0xa4')](_0xd73b('0xa5'));}this[_0xd73b('0x33')][_0xd73b('0xea')]=!![];this[_0xd73b('0x32')](_0x5420b3);this[_0xd73b('0x3e')](_0x5420b3['text'],'in');this[_0xd73b('0x33')][_0xd73b('0xa4')](util[_0xd73b('0x27')](_0xd73b('0x11c'),_0x5420b3[_0xd73b('0x5d')]));var _0x7cc87c=this[_0xd73b('0x84')]['sync'](this,_0x5420b3);if(_0x7cc87c){for(var _0x597d48 in _0x7cc87c){if(_0x7cc87c[_0xd73b('0x90')](_0x597d48)&&_[_0xd73b('0x8c')](_0x7cc87c[_0x597d48])){this[_0xd73b('0x33')][_0xd73b('0x95')](util[_0xd73b('0x27')](_0xd73b('0x11d'),_0x597d48[_0xd73b('0x6a')]()),_0x7cc87c[_0x597d48]);}}if(_[_0xd73b('0x43')](_0x7cc87c[_0xd73b('0x77')])){return this[_0xd73b('0x33')][_0xd73b('0xa4')]('Amazon\x20Lex\x20ready\x20for\x20fulfillment');}else{this[_0xd73b('0x3e')](_0x7cc87c[_0xd73b('0x77')],_0xd73b('0xf6'));return this[_0xd73b('0x33')][_0xd73b('0xa4')](util['format']('Amazon\x20Lex\x20Result\x20%s',_0x7cc87c[_0xd73b('0x77')]));}}return this[_0xd73b('0x33')][_0xd73b('0x2a')](_0x5420b3,_0xd73b('0x11e'));};AGIVertices[_0xd73b('0x10')][_0xd73b('0x11f')]=function(_0x4309cc){logger[_0xd73b('0x2b')](util[_0xd73b('0x27')](_0xd73b('0x120'),_0x4309cc['label'],_0x4309cc[_0xd73b('0x66')]));if(!this[_0xd73b('0x9f')](_0x4309cc['key'])){return this[_0xd73b('0x33')][_0xd73b('0xa4')]('no\x20key\x20configured');}var _0x262886=_0xd73b('0x121');var _0xadad16=util[_0xd73b('0x27')](_0xd73b('0x122'),FILES_PATH,rs[_0xd73b('0x10b')](0x4));var _0xaabb9b=util[_0xd73b('0x27')](_0xd73b('0x94'),_0xadad16,_0x262886);var _0x5a5b0f=!![];if(_0x4309cc[_0xd73b('0x123')]===_0xd73b('0x124')){_0x5a5b0f=![];}var _0x4beb23=this[_0xd73b('0x33')][_0xd73b('0x125')](_0xadad16,_0x262886,_0x4309cc[_0xd73b('0x126')],_0x4309cc[_0xd73b('0x66')],undefined,_0x5a5b0f);if(_0x4beb23[_0xd73b('0x9c')]!==-0x1){this[_0xd73b('0x33')]['noop'](util['format'](_0xd73b('0x127'),_0xaabb9b));var _0xae64b2=this[_0xd73b('0x87')][_0xd73b('0x71')](this,_0x4309cc,_0xaabb9b);if(_0xae64b2){for(var _0x15accb in _0xae64b2){if(_0xae64b2[_0xd73b('0x90')](_0x15accb)){this[_0xd73b('0x33')][_0xd73b('0x95')](util[_0xd73b('0x27')](_0xd73b('0x128'),_0x15accb[_0xd73b('0x6a')]()),_0xae64b2[_0x15accb]);}}return this[_0xd73b('0x33')][_0xd73b('0xa4')](util[_0xd73b('0x27')](_0xd73b('0x129'),JSON[_0xd73b('0x74')](_0xae64b2)));}}return _0x4beb23;};AGIVertices[_0xd73b('0x10')][_0xd73b('0x12a')]=function(_0x424431){logger[_0xd73b('0x2b')](util[_0xd73b('0x27')](_0xd73b('0x12b'),_0x424431['label']));if(!this[_0xd73b('0x9f')](_0x424431[_0xd73b('0x12c')])){return this[_0xd73b('0x33')][_0xd73b('0xa4')](_0xd73b('0x12d'));}if(!this[_0xd73b('0x9f')](_0x424431[_0xd73b('0x8a')])){return this[_0xd73b('0x33')]['noop'](_0xd73b('0x12e'));}var _0x1047b6=_0xd73b('0x121');var _0x5b7b13=util[_0xd73b('0x27')](_0xd73b('0x122'),FILES_PATH,rs['generate'](0x4));var _0x5706bd=util[_0xd73b('0x27')]('%s.%s',_0x5b7b13,_0x1047b6);var _0x39b855=!![];if(_0x424431[_0xd73b('0x123')]===_0xd73b('0x124')){_0x39b855=![];}var _0xc7c1b5=this[_0xd73b('0x33')][_0xd73b('0x125')](_0x5b7b13,_0x1047b6,_0x424431['intKey'],_0x424431[_0xd73b('0x66')],undefined,_0x39b855);if(_0xc7c1b5[_0xd73b('0x9c')]!==-0x1){this['channel'][_0xd73b('0xa4')](util[_0xd73b('0x27')](_0xd73b('0x12f'),_0x5706bd));var _0x2827bf=this['tildeASR']['sync'](this,_0x424431,_0x5706bd);if(_0x2827bf){for(var _0x11f622 in _0x2827bf){if(_0x2827bf[_0xd73b('0x90')](_0x11f622)){this[_0xd73b('0x33')][_0xd73b('0x95')](util[_0xd73b('0x27')](_0xd73b('0x130'),_0x11f622[_0xd73b('0x6a')]()),_0x2827bf[_0x11f622]);}}return this[_0xd73b('0x33')]['noop'](util['format']('TildeASR\x20Result\x20%s',JSON['stringify'](_0x2827bf)));}}return _0xc7c1b5;};AGIVertices[_0xd73b('0x10')]['gotoc']=function(_0x4467dc){logger[_0xd73b('0x2b')](util[_0xd73b('0x27')](_0xd73b('0x131'),_0x4467dc[_0xd73b('0xb4')]));return this[_0xd73b('0x33')][_0xd73b('0x132')](_0x4467dc[_0xd73b('0x133')],_0x4467dc[_0xd73b('0x3a')],_0x4467dc[_0xd73b('0x3b')]);};AGIVertices[_0xd73b('0x10')][_0xd73b('0x134')]=function(_0xe7d5be){logger[_0xd73b('0x2b')](util[_0xd73b('0x27')](_0xd73b('0x135'),_0xe7d5be[_0xd73b('0xb4')]));if(!this[_0xd73b('0x9f')](_0xe7d5be[_0xd73b('0x136')])){return this[_0xd73b('0x33')][_0xd73b('0x2a')](_0xe7d5be,'no\x20condition\x20configured');}try{var _0x4dd5cb=eval(_0xe7d5be[_0xd73b('0x136')])?_0xd73b('0x137'):_0xd73b('0x138');this[_0xd73b('0x33')][_0xd73b('0xa4')](util[_0xd73b('0x27')](_0xd73b('0x139'),_0xe7d5be[_0xd73b('0x136')],_0x4dd5cb));return{'code':0xc8,'result':_0x4dd5cb};}catch(_0x30a92f){return{'code':0xc8,'result':_0xd73b('0x138')};}};AGIVertices[_0xd73b('0x10')]['gotoiftime']=function(_0x1152a0){logger[_0xd73b('0x2b')](util[_0xd73b('0x27')](_0xd73b('0x13a'),_0x1152a0[_0xd73b('0xb4')]));if(!this[_0xd73b('0x9f')](_0x1152a0[_0xd73b('0x13b')])){return this['channel']['error'](_0x1152a0,'no\x20interval\x20configured');}var _0x34acbc=this[_0xd73b('0x23')]['sync'](this,_0x1152a0[_0xd73b('0x13b')]);if(!_0x34acbc){return this[_0xd73b('0x33')][_0xd73b('0x2a')](_0x1152a0,_0xd73b('0x13c'));}for(var _0x4e7559=0x0;_0x4e7559<_0x34acbc[_0xd73b('0x98')];_0x4e7559+=0x1){var _0x3ffd03=this[_0xd73b('0x33')][_0xd73b('0x11')](util[_0xd73b('0x27')](_0xd73b('0x13d'),_0x34acbc[_0x4e7559]));if(_0x3ffd03[_0xd73b('0x9c')]===-0x1){return _0x3ffd03;}logger[_0xd73b('0x2b')](util[_0xd73b('0x27')]('IFTIME\x20%s\x20%s',_0x34acbc[_0x4e7559],_0x3ffd03['extra']));if(_0x3ffd03[_0xd73b('0x9e')]===_0xd73b('0x137')){logger[_0xd73b('0x2b')](util[_0xd73b('0x27')]('IFTIME\x20%s\x20%s',_0x34acbc[_0x4e7559],_0xd73b('0x137')));this[_0xd73b('0x33')][_0xd73b('0xa4')](util[_0xd73b('0x27')]('IFTIME\x20%s\x20%s',_0x34acbc[_0x4e7559],_0xd73b('0x137')));return{'code':0xc8,'result':_0xd73b('0x137')};}else{logger[_0xd73b('0x2b')](util['format'](_0xd73b('0x13e'),_0x34acbc[_0x4e7559],_0xd73b('0x138')));this[_0xd73b('0x33')][_0xd73b('0xa4')](util[_0xd73b('0x27')](_0xd73b('0x13e'),_0x34acbc[_0x4e7559],_0xd73b('0x138')));}}return{'code':0xc8,'result':'false'};};AGIVertices['prototype'][_0xd73b('0x13f')]=function(_0x213a90){logger[_0xd73b('0x2b')](util['format'](_0xd73b('0x140'),_0x213a90[_0xd73b('0xb4')]));return this['channel'][_0xd73b('0x13f')]();};AGIVertices[_0xd73b('0x10')][_0xd73b('0x141')]=function(_0x479c8f){logger['info'](util['format']('Enter\x20in\x20ISPEECHASR\x20(%s)\x20block',_0x479c8f['label']));if(!this[_0xd73b('0x9f')](_0x479c8f[_0xd73b('0x7a')])){return this['channel']['noop']('no\x20key\x20configured');}var _0x3f7c89=_0xd73b('0x121');var _0x5b0540=util['format'](_0xd73b('0x122'),FILES_PATH,rs[_0xd73b('0x10b')](0x4));var _0x5e65a3=util[_0xd73b('0x27')](_0xd73b('0x94'),_0x5b0540,_0x3f7c89);var _0x581283=!![];if(_0x479c8f[_0xd73b('0x123')]==='NOBEEP'){_0x581283=![];}var _0x1433a2=this[_0xd73b('0x33')][_0xd73b('0x125')](_0x5b0540,_0x3f7c89,_0x479c8f['intKey'],_0x479c8f['timeout'],undefined,_0x581283);if(_0x1433a2['result']!==-0x1){this[_0xd73b('0x33')][_0xd73b('0xa4')](util[_0xd73b('0x27')]('ispeech\x20%s\x20file\x20created',_0x5e65a3));var _0x794bfe=this[_0xd73b('0x7f')]['sync'](this,_0x479c8f,_0x5e65a3);if(_0x794bfe){for(var _0x1a3141 in _0x794bfe){if(_0x794bfe[_0xd73b('0x90')](_0x1a3141)){this[_0xd73b('0x33')][_0xd73b('0x95')](util['format'](_0xd73b('0x142'),_0x1a3141['toUpperCase']()),_0x794bfe[_0x1a3141]);}}return this[_0xd73b('0x33')][_0xd73b('0xa4')](util[_0xd73b('0x27')](_0xd73b('0x143'),JSON[_0xd73b('0x74')](_0x794bfe)));}}return _0x1433a2;};AGIVertices[_0xd73b('0x10')][_0xd73b('0x144')]=function(_0x62755e){logger['info'](util[_0xd73b('0x27')](_0xd73b('0x145'),_0x62755e[_0xd73b('0xb4')]));if(!this[_0xd73b('0x9f')](_0x62755e[_0xd73b('0x7a')])){return this[_0xd73b('0x33')][_0xd73b('0xa4')](_0xd73b('0xe9'));}if(!this['isConfigured'](_0x62755e[_0xd73b('0x5d')])){return this[_0xd73b('0x33')]['noop'](_0xd73b('0xa5'));}this[_0xd73b('0x33')][_0xd73b('0xa4')](util[_0xd73b('0x27')](_0xd73b('0x146'),_0x62755e['text']));var _0x340e37=this['ispeechTTS'][_0xd73b('0x71')](this,_0x62755e);if(_0x340e37){this[_0xd73b('0x33')]['noop'](util[_0xd73b('0x27')](_0xd73b('0x147'),_0x340e37));var _0x431892=this[_0xd73b('0x33')]['streamFile'](_0x340e37,_0x62755e[_0xd73b('0x126')]);try{fs[_0xd73b('0x118')](_0x340e37+_0xd73b('0xf9'));}catch(_0x5d1d57){logger[_0xd73b('0x2a')](_0x5d1d57);}return _0x431892;}return this['channel'][_0xd73b('0x2a')](_0x62755e,'ispeech\x20TTS\x20is\x20unreachable');};AGIVertices['prototype'][_0xd73b('0x148')]=function(_0x597553){logger['info'](util[_0xd73b('0x27')]('Enter\x20in\x20LOGIN\x20(%s)\x20block',_0x597553[_0xd73b('0xb4')]));if(!this[_0xd73b('0x9f')](_0x597553['findBy'])){return this[_0xd73b('0x33')]['error'](_0x597553,_0xd73b('0x149'));}logger[_0xd73b('0x2b')](util[_0xd73b('0x27')](_0xd73b('0x14a'),this[_0xd73b('0x33')][_0xd73b('0x38')],_0x597553[_0xd73b('0x14b')]));var _0x151911=this[_0xd73b('0x56')][_0xd73b('0x71')](this,_0x597553['findBy']);if(_0x151911){logger[_0xd73b('0x2b')](util[_0xd73b('0x27')](_0xd73b('0x14c'),this[_0xd73b('0x33')][_0xd73b('0x38')],_0x597553[_0xd73b('0x14b')]));this['channel'][_0xd73b('0xa4')](util[_0xd73b('0x27')](_0xd73b('0x14c'),this[_0xd73b('0x33')][_0xd73b('0x38')],_0x597553[_0xd73b('0x14b')]));return{'code':0xc8,'result':'success'};}else{logger[_0xd73b('0x2b')](util['format'](_0xd73b('0x14d'),this['channel'][_0xd73b('0x38')],_0x597553[_0xd73b('0x14b')]));this[_0xd73b('0x33')]['noop'](util['format'](_0xd73b('0x14d'),this[_0xd73b('0x33')][_0xd73b('0x38')],_0x597553['findBy']));return{'code':0xc8,'result':'failure'};}};AGIVertices[_0xd73b('0x10')][_0xd73b('0x14e')]=function(_0x5a62dc){logger['info'](util[_0xd73b('0x27')](_0xd73b('0x14f'),_0x5a62dc['label']));if(!this[_0xd73b('0x9f')](_0x5a62dc[_0xd73b('0x14b')])){return this[_0xd73b('0x33')]['error'](_0x5a62dc,_0xd73b('0x149'));}logger[_0xd73b('0x2b')](util[_0xd73b('0x27')](_0xd73b('0x14a'),this['channel'][_0xd73b('0x38')],_0x5a62dc[_0xd73b('0x14b')]));var _0x1e4c8d=this[_0xd73b('0x55')][_0xd73b('0x71')](this,_0x5a62dc[_0xd73b('0x14b')]);if(_0x1e4c8d){logger['info'](util[_0xd73b('0x27')](_0xd73b('0x14c'),this[_0xd73b('0x33')][_0xd73b('0x38')],_0x5a62dc[_0xd73b('0x14b')]));this['channel'][_0xd73b('0xa4')](util[_0xd73b('0x27')](_0xd73b('0x14c'),this['channel'][_0xd73b('0x38')],_0x5a62dc['findBy']));return{'code':0xc8,'result':_0xd73b('0x150')};}else{logger['info'](util[_0xd73b('0x27')](_0xd73b('0x14d'),this[_0xd73b('0x33')][_0xd73b('0x38')],_0x5a62dc[_0xd73b('0x14b')]));this[_0xd73b('0x33')][_0xd73b('0xa4')](util[_0xd73b('0x27')](_0xd73b('0x14d'),this[_0xd73b('0x33')]['callerid'],_0x5a62dc[_0xd73b('0x14b')]));return{'code':0xc8,'result':_0xd73b('0x151')};}};AGIVertices['prototype'][_0xd73b('0x152')]=function(_0x28005a){logger[_0xd73b('0x2b')](util[_0xd73b('0x27')]('Enter\x20in\x20MATH\x20(%s)\x20block',_0x28005a[_0xd73b('0xb4')]));if(!this[_0xd73b('0x9f')](_0x28005a[_0xd73b('0x153')])){return this['channel'][_0xd73b('0x2a')](_0x28005a,'no\x20operation\x20configured');}this[_0xd73b('0x33')][_0xd73b('0xa4')](util[_0xd73b('0x27')](_0xd73b('0x154'),_0x28005a[_0xd73b('0x153')]));var _0xd4669a=eval(_0x28005a[_0xd73b('0x153')]);if(!this[_0xd73b('0x9f')](_0x28005a[_0xd73b('0xda')])){return this[_0xd73b('0x33')][_0xd73b('0xa4')](_0xd73b('0x155'));}var _0x12efb=this[_0xd73b('0x11')][_0xd73b('0x71')](this,_0x28005a[_0xd73b('0xda')]);if(!_0x12efb){return this[_0xd73b('0x33')]['error'](_0x28005a,'no\x20variable\x20found');}if(_[_0xd73b('0x92')](_0xd4669a)){var _0x4ecf85=this;_0xd4669a[_0xd73b('0x156')](function(_0x1f8d16,_0x5f3c76){_0x4ecf85[_0xd73b('0x33')][_0xd73b('0x95')](util[_0xd73b('0x27')](_0xd73b('0x157'),_0x12efb,_0x5f3c76),_0x1f8d16);});return this['channel'][_0xd73b('0xa4')](util[_0xd73b('0x27')](_0xd73b('0x158'),_0x12efb));}else{return this[_0xd73b('0x33')][_0xd73b('0x95')](_0x12efb,_0xd4669a);}};AGIVertices['prototype'][_0xd73b('0xc')]=function(_0x249635){logger[_0xd73b('0x2b')](util[_0xd73b('0x27')]('Enter\x20in\x20MENU\x20(%s)\x20block',_0x249635[_0xd73b('0xb4')]));if(_0x249635['retry']===0x0){return this[_0xd73b('0xa0')](_0x249635);}_0x249635[_0xd73b('0xa1')]-=0x1;if(!this[_0xd73b('0x9f')](_0x249635[_0xd73b('0x104')])){return this[_0xd73b('0x33')][_0xd73b('0x2a')](_0x249635,_0xd73b('0x105'));}var _0x188683=this[_0xd73b('0x1d')][_0xd73b('0x71')](this,_0x249635[_0xd73b('0x104')]);if(!_0x188683){return this[_0xd73b('0x33')][_0xd73b('0x2a')](_0x249635,_0xd73b('0x159'));}var _0x4855e9=this['channel']['getData'](_0x188683,_0x249635[_0xd73b('0x15a')],_0x249635[_0xd73b('0x15b')]);var _0xe17ef0=_0x4855e9[_0xd73b('0x9c')];if(_0x4855e9[_0xd73b('0x9c')]===-0x1){this['createSquareDetailsReport'][_0xd73b('0x71')](this,_0x249635,'-1');return _0x4855e9;}else if(_0x4855e9['extra']===_0xd73b('0x66')){_0x4855e9['result']=_0x4855e9[_0xd73b('0x9c')][_0xd73b('0x98')]>0x0?_0x4855e9[_0xd73b('0x9c')]:'t';}else if(_['isEmpty'](_0x4855e9[_0xd73b('0x9c')])){_0x4855e9[_0xd73b('0x9c')]='#';_0xe17ef0='#';}if(!this[_0xd73b('0x9f')](_0x249635[_0xd73b('0xda')])){this[_0xd73b('0x33')][_0xd73b('0xa4')]('no\x20variable\x20selected\x20for\x20the\x20result');}else{var _0x52c51d=this[_0xd73b('0x11')][_0xd73b('0x71')](this,_0x249635['variable_id']);if(!_0x52c51d){return this[_0xd73b('0x33')][_0xd73b('0x2a')](_0x249635,'no\x20variable\x20found');}this[_0xd73b('0x33')]['setVariable'](_0x52c51d,_0xe17ef0);}this[_0xd73b('0x32')][_0xd73b('0x71')](this,_0x249635,_0xe17ef0);return _0x4855e9;};AGIVertices['prototype'][_0xd73b('0xa4')]=function(_0x568183){logger[_0xd73b('0x2b')](util[_0xd73b('0x27')](_0xd73b('0x15c'),_0x568183['label']));return this[_0xd73b('0x33')][_0xd73b('0xa4')](_0x568183['output']||_0x568183[_0xd73b('0xb4')]);};AGIVertices[_0xd73b('0x10')][_0xd73b('0x15d')]=function(_0x5e2380){logger[_0xd73b('0x2b')](util[_0xd73b('0x27')](_0xd73b('0x15e'),_0x5e2380[_0xd73b('0xb4')]));if(!this[_0xd73b('0x9f')](_0x5e2380[_0xd73b('0x14b')])){return this[_0xd73b('0x33')][_0xd73b('0x2a')](_0x5e2380,_0xd73b('0x149'));}logger[_0xd73b('0x2b')](util['format']('FIND\x20AGENT\x20%s\x20BY\x20%s',this[_0xd73b('0x33')][_0xd73b('0x38')],_0x5e2380[_0xd73b('0x14b')]));var _0x1f5994=this[_0xd73b('0x51')][_0xd73b('0x71')](this,_0x5e2380[_0xd73b('0x15f')]);var _0x33de69=this[_0xd73b('0x53')][_0xd73b('0x71')](this,_0x5e2380['findBy'],_0x1f5994);if(_0x33de69){logger['info'](util['format']('AGENT\x20%s\x20FOUND\x20BY',this['channel'][_0xd73b('0x38')],_0x5e2380['findBy']));this[_0xd73b('0x33')][_0xd73b('0xa4')](util[_0xd73b('0x27')](_0xd73b('0x14c'),this[_0xd73b('0x33')]['callerid'],_0x5e2380[_0xd73b('0x14b')]));return{'code':0xc8,'result':_0xd73b('0x150')};}else{logger[_0xd73b('0x2b')](util[_0xd73b('0x27')]('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this[_0xd73b('0x33')][_0xd73b('0x38')],_0x5e2380['findBy']));this[_0xd73b('0x33')][_0xd73b('0xa4')](util[_0xd73b('0x27')]('AGENT\x20%s\x20FOUND\x20BY',this[_0xd73b('0x33')][_0xd73b('0x38')],_0x5e2380[_0xd73b('0x14b')]));return{'code':0xc8,'result':'failure'};}};AGIVertices[_0xd73b('0x10')][_0xd73b('0x160')]=function(_0x4fb19d){logger[_0xd73b('0x2b')](util[_0xd73b('0x27')](_0xd73b('0x161'),_0x4fb19d[_0xd73b('0xb4')]));if(!this[_0xd73b('0x9f')](_0x4fb19d['file_id'])){return this[_0xd73b('0x33')][_0xd73b('0x2a')](_0x4fb19d,_0xd73b('0x105'));}var _0x16e7d8=this[_0xd73b('0x1d')][_0xd73b('0x71')](this,_0x4fb19d[_0xd73b('0x104')]);if(!_0x16e7d8){return this[_0xd73b('0x33')][_0xd73b('0x2a')](_0x4fb19d,_0xd73b('0x159'));}var _0x317987=this[_0xd73b('0x33')][_0xd73b('0x59')](_0xd73b('0x162'),[_0x16e7d8,_0x4fb19d[_0xd73b('0xe5')]]);if(_0x317987[_0xd73b('0x9c')]===-0x1){return _0x317987;}return this[_0xd73b('0x33')][_0xd73b('0xa4')](util['format']('Executed\x20command\x20%s\x20%s',_0xd73b('0x162'),_0x16e7d8));};AGIVertices[_0xd73b('0x10')][_0xd73b('0x163')]=function(_0x3f34a0){logger['info'](util['format'](_0xd73b('0x164'),_0x3f34a0[_0xd73b('0xb4')]));if(!this[_0xd73b('0x9f')](_0x3f34a0[_0xd73b('0x165')])){return this[_0xd73b('0x33')][_0xd73b('0x2a')](_0x3f34a0,_0xd73b('0x166'));}var _0x508ba1='';var _0x51c5e9=parseInt(_0x3f34a0['queue_id'],0xa);if(isNaN(_0x51c5e9)){_0x508ba1=_0x3f34a0[_0xd73b('0x165')];}else{_0x508ba1=this[_0xd73b('0x13')]['sync'](this,_0x3f34a0[_0xd73b('0x165')]);if(!_0x508ba1){return this[_0xd73b('0x33')][_0xd73b('0x2a')](_0x3f34a0,_0xd73b('0x167'));}}var _0x2fe3c3='';if(this['isConfigured'](_0x3f34a0[_0xd73b('0x104')])){var _0x3af351=this[_0xd73b('0x1d')][_0xd73b('0x71')](this,_0x3f34a0[_0xd73b('0x104')]);if(_0x3af351){_0x2fe3c3=_0x3af351;}}this[_0xd73b('0x32')][_0xd73b('0x71')](this,_0x3f34a0,_0x508ba1);if(_0x3f34a0['opts'][_0xd73b('0x168')]('x')<0x0){_0x3f34a0[_0xd73b('0xe5')]+='x';}if(_0x3f34a0['opts'][_0xd73b('0x168')]('X')<0x0){_0x3f34a0[_0xd73b('0xe5')]+='X';}this[_0xd73b('0x33')][_0xd73b('0x95')]('XMCS-QUEUE',_0x508ba1?_0x508ba1[_0xd73b('0x169')]():'');var _0x6e13fd=this[_0xd73b('0x33')]['exec'](_0xd73b('0x16a'),[_0x508ba1,_0x3f34a0[_0xd73b('0xe5')],_0x3f34a0[_0xd73b('0x64')],_0x2fe3c3,_0x3f34a0[_0xd73b('0x66')],_0x3f34a0[_0xd73b('0x7')],_0x3f34a0[_0xd73b('0x16b')],_0x3f34a0[_0xd73b('0x16c')],'',_0x3f34a0[_0xd73b('0x16d')]]);if(_0x6e13fd[_0xd73b('0x9c')]===-0x1){return _0x6e13fd;}return this[_0xd73b('0x33')][_0xd73b('0xa4')](util[_0xd73b('0x27')](_0xd73b('0xc5'),_0xd73b('0x16a'),_0x508ba1));};AGIVertices[_0xd73b('0x10')][_0xd73b('0x16e')]=function(_0x377685){logger['info'](util[_0xd73b('0x27')]('Enter\x20in\x20RECORD\x20(%s)\x20block',_0x377685[_0xd73b('0xb4')]));var _0x1de58f=_0x377685[_0xd73b('0x16f')]||_0xd73b('0x121');var _0x3535ec=util[_0xd73b('0x27')](_0xd73b('0x170'),this[_0xd73b('0x33')]['uniqueid'],rs[_0xd73b('0x10b')](0x5));var _0x2f4e08=util['format']('%s/recordings/%s.%s',FILES_PATH,_0x3535ec,_0x1de58f);var _0xd808f9=util['format'](_0xd73b('0x122'),FILES_PATH,_0x3535ec);this['createSquareRecording']['sync'](this,_0x377685,_0x3535ec,_0x2f4e08);this['channel']['setVariable'](_0xd73b('0x171'),_0x3535ec);logger[_0xd73b('0x2b')]('Recording\x20%s\x20%s\x20%s\x20%s',_0xd808f9,_0x1de58f,_0x377685['escape_digits'],_0x377685[_0xd73b('0x66')]);return this[_0xd73b('0x33')][_0xd73b('0x125')](_0xd808f9,_0x1de58f,_0x377685[_0xd73b('0x172')],_0x377685[_0xd73b('0x66')],undefined,!![]);};AGIVertices['prototype']['restapi']=function(_0x48591d){logger['info'](util['format'](_0xd73b('0x173'),_0x48591d[_0xd73b('0xb4')]));if(!this[_0xd73b('0x9f')](_0x48591d[_0xd73b('0x64')])){return this['channel'][_0xd73b('0xa4')](_0xd73b('0x174'));}var _0x55d7bf=this[_0xd73b('0x63')][_0xd73b('0x71')](this,_0x48591d);logger[_0xd73b('0x2b')](util[_0xd73b('0x27')](_0xd73b('0x175'),util[_0xd73b('0x176')](_0x55d7bf,{'showHidden':![],'depth':null})));if(!this[_0xd73b('0x9f')](_0x48591d[_0xd73b('0xda')])){return this[_0xd73b('0x33')][_0xd73b('0xa4')](_0xd73b('0x177'));}var _0x54fe73=this[_0xd73b('0x11')][_0xd73b('0x71')](this,_0x48591d[_0xd73b('0xda')]);if(!_0x54fe73){return this['channel']['error'](_0x48591d,'no\x20variable\x20found');}this['channel']['setVariable'](util['format'](_0xd73b('0x178'),_0x54fe73),_0x55d7bf[_0xd73b('0x76')]?_0x55d7bf[_0xd73b('0x76')]:_0xd73b('0x179'));this[_0xd73b('0x33')]['setVariable'](util[_0xd73b('0x27')](_0xd73b('0x17a'),_0x54fe73),_0x55d7bf[_0xd73b('0x17b')]?_0x55d7bf[_0xd73b('0x17b')]:'OK');if(_0x55d7bf[_0xd73b('0x6b')]){try{this[_0xd73b('0x93')](_0x55d7bf[_0xd73b('0x6b')],_0x54fe73);}catch(_0x2ee7a8){logger[_0xd73b('0x2a')](util[_0xd73b('0x27')](_0xd73b('0x17c'),_0x54fe73));}}return this[_0xd73b('0x33')]['noop'](util[_0xd73b('0x27')](_0xd73b('0x17d'),_0x54fe73));};AGIVertices['prototype'][_0xd73b('0x17e')]=function(_0x5e1514){logger['info'](util[_0xd73b('0x27')](_0xd73b('0x17f'),_0x5e1514[_0xd73b('0xb4')]));return this['channel'][_0xd73b('0x180')](_0x5e1514[_0xd73b('0x181')][_0xd73b('0xd7')](/\s+/g,''),_0x5e1514[_0xd73b('0x172')]);};AGIVertices[_0xd73b('0x10')]['saynumber']=function(_0x1f12ae){logger[_0xd73b('0x2b')](util['format'](_0xd73b('0x182'),_0x1f12ae[_0xd73b('0xb4')]));return this[_0xd73b('0x33')]['sayNumber'](_0x1f12ae['number']['replace'](/\s+/g,''),_0x1f12ae[_0xd73b('0x172')]);};AGIVertices[_0xd73b('0x10')]['sayphonetic']=function(_0x55376f){logger[_0xd73b('0x2b')](util[_0xd73b('0x27')](_0xd73b('0x183'),_0x55376f['label']));return this[_0xd73b('0x33')][_0xd73b('0x184')](_0x55376f[_0xd73b('0x5d')],_0x55376f[_0xd73b('0x172')]);};AGIVertices[_0xd73b('0x10')][_0xd73b('0x185')]=function(_0x30dc50){logger['info'](util[_0xd73b('0x27')]('Enter\x20in\x20SENDMAIL\x20(%s)\x20block',_0x30dc50[_0xd73b('0xb4')]));if(!this[_0xd73b('0x9f')](_0x30dc50[_0xd73b('0x186')])){return this[_0xd73b('0x33')]['noop'](_0xd73b('0x187'));}var _0x19f9ad=this[_0xd73b('0x21')][_0xd73b('0x71')](this,_0x30dc50[_0xd73b('0x186')]);if(!_0x19f9ad||!_0x19f9ad[_0xd73b('0x188')]){return this['channel'][_0xd73b('0x2a')](_0x30dc50,_0xd73b('0x189'));}var _0x1df58a={'from':util['format'](_0xd73b('0x18a'),_0x19f9ad[_0xd73b('0x15')],_0x19f9ad[_0xd73b('0x18b')]||_0x19f9ad['Smtp']['user']),'to':_0x30dc50['to']||'','cc':_0x30dc50['cc']||'','bcc':_0x30dc50['bcc']||'','subject':_0x30dc50[_0xd73b('0x18c')],'html':_0x30dc50[_0xd73b('0x5d')],'text':_0x30dc50[_0xd73b('0x5d')]};var _0x2ecfe2={'tls':{'rejectUnauthorized':![]}};if(_0x19f9ad[_0xd73b('0x188')]['service']){_0x2ecfe2[_0xd73b('0x18d')]=_0x19f9ad[_0xd73b('0x188')][_0xd73b('0x18d')];}else{_0x2ecfe2[_0xd73b('0x18e')]=_0x19f9ad['Smtp']['host'];_0x2ecfe2[_0xd73b('0x18f')]=_0x19f9ad[_0xd73b('0x188')][_0xd73b('0x18f')];_0x2ecfe2[_0xd73b('0x190')]=_0x19f9ad['Smtp']['secure'];}if(_0x19f9ad[_0xd73b('0x188')][_0xd73b('0x191')]){_0x2ecfe2[_0xd73b('0x192')]={'user':_0x19f9ad['Smtp']['user'],'pass':_0x19f9ad[_0xd73b('0x188')]['pass']};}if(this['isConfigured'](_0x30dc50[_0xd73b('0x193')])){}logger[_0xd73b('0xdf')](_0xd73b('0x194'),JSON[_0xd73b('0x74')](_0x1df58a));this[_0xd73b('0x32')]['sync'](this,_0x30dc50,_0x30dc50[_0xd73b('0x186')]);this[_0xd73b('0x33')][_0xd73b('0xa4')](util['format'](_0xd73b('0x195'),_0x19f9ad[_0xd73b('0x15')]));this['sendMailMessage'][_0xd73b('0x71')](this,_0x2ecfe2,_0x1df58a);return this[_0xd73b('0x33')][_0xd73b('0xa4')](_0xd73b('0x196'));};AGIVertices['prototype'][_0xd73b('0x197')]=function(_0x3e320b){logger[_0xd73b('0x2b')](util['format']('Enter\x20in\x20SENDFAX\x20(%s)\x20block',_0x3e320b[_0xd73b('0xb4')]));return this[_0xd73b('0x33')][_0xd73b('0xa4')](_0xd73b('0x198'));};AGIVertices[_0xd73b('0x10')][_0xd73b('0x199')]=function(_0x205afa){logger[_0xd73b('0x2b')](util[_0xd73b('0x27')]('Enter\x20in\x20SENDSMS\x20(%s)\x20block',_0x205afa[_0xd73b('0xb4')]));if(!this['isConfigured'](_0x205afa[_0xd73b('0x19a')])){return this[_0xd73b('0x33')][_0xd73b('0xa4')](_0xd73b('0x19b'));}var _0x363cf7=this['getSmsAccount'][_0xd73b('0x71')](this,_0x205afa[_0xd73b('0x19a')]);if(!_0x363cf7){return this[_0xd73b('0x33')]['error'](_0x205afa,_0xd73b('0x19c'));}var _0x47c2e7={'body':_0x205afa[_0xd73b('0x19d')],'phone':_0x205afa['to']||'','SmsAccountId':_0x363cf7['id']};logger['debug'](_0xd73b('0x19e'),JSON['stringify'](_0x47c2e7));this[_0xd73b('0x32')][_0xd73b('0x71')](this,_0x205afa,_0x205afa[_0xd73b('0x19a')]);this[_0xd73b('0x33')]['noop'](util[_0xd73b('0x27')](_0xd73b('0x19f'),_0x363cf7[_0xd73b('0x15')]));this[_0xd73b('0x31')][_0xd73b('0x71')](this,_0x47c2e7);return this[_0xd73b('0x33')]['noop'](_0xd73b('0x1a0'));};AGIVertices[_0xd73b('0x10')]['set']=function(_0x7df637){logger['info'](util[_0xd73b('0x27')](_0xd73b('0x1a1'),_0x7df637[_0xd73b('0xb4')]));if(!this['isConfigured'](_0x7df637[_0xd73b('0xda')])){return this['channel'][_0xd73b('0x2a')](_0x7df637,_0xd73b('0x1a2'));}var _0x3e6b0d=this[_0xd73b('0x11')]['sync'](this,_0x7df637[_0xd73b('0xda')]);if(!_0x3e6b0d){return this['channel'][_0xd73b('0x2a')](_0x7df637,_0xd73b('0xdb'));}return this[_0xd73b('0x33')][_0xd73b('0x95')](_0x3e6b0d,_0x7df637[_0xd73b('0x1a3')]);};AGIVertices['prototype']['start']=function(_0x18d2da){logger[_0xd73b('0x2b')](util['format']('Enter\x20in\x20START\x20(%s)\x20block',_0x18d2da[_0xd73b('0xb4')]));this[_0xd73b('0x33')][_0xd73b('0xa4')](_0xd73b('0x1a4'));if(_0x18d2da['answer']===_0xd73b('0x1a5')){this[_0xd73b('0x33')][_0xd73b('0xa4')]('Answer');return this[_0xd73b('0x33')][_0xd73b('0xb6')]();}return this[_0xd73b('0x33')][_0xd73b('0xa4')]('Skipped\x20Answer');};AGIVertices[_0xd73b('0x10')][_0xd73b('0x1a6')]=function(_0x4f35df){logger[_0xd73b('0x2b')](util[_0xd73b('0x27')](_0xd73b('0x1a7'),_0x4f35df[_0xd73b('0xb4')]));if(!this[_0xd73b('0x9f')](_0x4f35df[_0xd73b('0x1a8')])){return this[_0xd73b('0x33')][_0xd73b('0x2a')](_0x4f35df,'no\x20subproject\x20selected');}var _0x527d2a=this['getSquareProject'][_0xd73b('0x71')](this,_0x4f35df['project_id']);if(!this[_0xd73b('0x9f')](_0x527d2a)){return this[_0xd73b('0x33')][_0xd73b('0x2a')](_0x4f35df,util['format']('no\x20subproject\x20found\x20with\x20id\x20%d',_0x4f35df['project_id']));}if(_0x527d2a===this[_0xd73b('0x33')][_0xd73b('0x36')]){return this['channel'][_0xd73b('0x2a')](_0x4f35df,_0xd73b('0x1a9'));}this[_0xd73b('0x32')][_0xd73b('0x71')](this,_0x4f35df,_0x527d2a);var _0x21bef5=this[_0xd73b('0x33')][_0xd73b('0x59')](_0xd73b('0x1aa'),util['format'](_0xd73b('0x1ab'),config[_0xd73b('0x7')][_0xd73b('0x18e')]||_0xd73b('0x1ac'),_0x527d2a,this[_0xd73b('0x33')][_0xd73b('0x36')]));if(_0x21bef5[_0xd73b('0x9c')]===-0x1){return _0x21bef5;}return this[_0xd73b('0x33')][_0xd73b('0xa4')](util[_0xd73b('0x27')]('Executed\x20command\x20%s\x20%s',_0xd73b('0x1aa'),_0x527d2a));};AGIVertices[_0xd73b('0x10')][_0xd73b('0x1ad')]=function(_0x14eca8){logger[_0xd73b('0x2b')](util[_0xd73b('0x27')](_0xd73b('0x1ae'),_0x14eca8[_0xd73b('0xb4')]));var _0x3807ff=this[_0xd73b('0x1af')][_0xd73b('0x71')](this,_0x14eca8[_0xd73b('0x1b0')]);this[_0xd73b('0x32')]['sync'](this,_0x14eca8,_0x14eca8['command']);if(this[_0xd73b('0x9f')](_0x14eca8['variable_id'])){var _0xdcc0e7=this[_0xd73b('0x11')][_0xd73b('0x71')](this,_0x14eca8['variable_id']);if(_0xdcc0e7){this['channel'][_0xd73b('0x95')](_0xdcc0e7,_0x3807ff);return this[_0xd73b('0x33')][_0xd73b('0xa4')](util['format'](_0xd73b('0x1b1'),_0x14eca8[_0xd73b('0x1b0')],_0xdcc0e7));}}return this[_0xd73b('0x33')][_0xd73b('0xa4')](util[_0xd73b('0x27')](_0xd73b('0x1b2'),_0x14eca8[_0xd73b('0x1b0')]));};AGIVertices[_0xd73b('0x10')]['google_cloud_tts']=function(_0xaa47b2){logger[_0xd73b('0x2b')](util[_0xd73b('0x27')]('Enter\x20in\x20Google\x20Cloud\x20TTS\x20(%s)\x20block',_0xaa47b2[_0xd73b('0xb4')]));_0xaa47b2['text']=_0xaa47b2[_0xd73b('0x5d')][_0xd73b('0xd7')](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0xd73b('0x9f')](_0xaa47b2[_0xd73b('0x1b3')])){return this[_0xd73b('0x33')][_0xd73b('0xa4')](_0xd73b('0x1b4'));}if(!this[_0xd73b('0x9f')](_0xaa47b2['text'])){return this[_0xd73b('0x33')]['noop'](_0xd73b('0xa5'));}this['channel'][_0xd73b('0xa4')](util[_0xd73b('0x27')]('Trying\x20Google\x20Cloud\x20TTS\x20%s',_0xaa47b2['text']));var _0x1db312=this[_0xd73b('0x5b')][_0xd73b('0x71')](this,_0xaa47b2);if(_0x1db312){this[_0xd73b('0x33')][_0xd73b('0xa4')](util[_0xd73b('0x27')]('Google\x20Cloud\x20TTS\x20%s\x20file\x20created',_0x1db312));var _0x2aa278=this['channel']['streamFile'](_0x1db312);try{fs[_0xd73b('0x118')](_0x1db312+_0xd73b('0xf9'));}catch(_0x4543c6){logger['error'](_0x4543c6);}return _0x2aa278;}return this[_0xd73b('0x33')][_0xd73b('0x2a')](_0xaa47b2,'Google\x20Cloud\x20TTS\x20is\x20unreachable');};AGIVertices['prototype'][_0xd73b('0x1b5')]=function(_0x1d3ef6){logger[_0xd73b('0x2b')](util['format'](_0xd73b('0x1b6'),_0x1d3ef6[_0xd73b('0xb4')]));_0x1d3ef6[_0xd73b('0x5d')]=_0x1d3ef6[_0xd73b('0x5d')][_0xd73b('0xd7')](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0xd73b('0x9f')](_0x1d3ef6['text'])){return this[_0xd73b('0x33')][_0xd73b('0xa4')](_0xd73b('0xa5'));}this['channel'][_0xd73b('0xa4')](util['format'](_0xd73b('0x1b7'),_0x1d3ef6[_0xd73b('0x5d')]));var _0x36ce0e=this[_0xd73b('0x62')][_0xd73b('0x71')](this,_0x1d3ef6);if(_0x36ce0e){this[_0xd73b('0x33')][_0xd73b('0xa4')](util['format'](_0xd73b('0x1b8'),_0x36ce0e));var _0x355acc=this[_0xd73b('0x33')][_0xd73b('0x117')](_0x36ce0e);try{fs[_0xd73b('0x118')](_0x36ce0e+_0xd73b('0xf9'));}catch(_0x8aeeac){logger[_0xd73b('0x2a')](_0x8aeeac);}return _0x355acc;}return this[_0xd73b('0x33')][_0xd73b('0x2a')](_0x1d3ef6,'Google\x20TTS\x20is\x20unreachable');};AGIVertices[_0xd73b('0x10')][_0xd73b('0x1b9')]=function(_0x1877b5){logger[_0xd73b('0x2b')](util['format'](_0xd73b('0x1ba'),_0x1877b5[_0xd73b('0xb4')]));if(!this[_0xd73b('0x9f')](_0x1877b5['findBy'])){return this[_0xd73b('0x33')][_0xd73b('0x2a')](_0x1877b5,'no\x20find\x20by\x20configured');}logger['info'](util[_0xd73b('0x27')]('FIND\x20AGENT\x20%s\x20BY\x20%s',this['channel'][_0xd73b('0x38')],_0x1877b5[_0xd73b('0x14b')]));var _0x29571a=this[_0xd73b('0x54')][_0xd73b('0x71')](this,_0x1877b5[_0xd73b('0x14b')]);if(_0x29571a){logger[_0xd73b('0x2b')](util[_0xd73b('0x27')](_0xd73b('0x14c'),this[_0xd73b('0x33')][_0xd73b('0x38')],_0x1877b5[_0xd73b('0x14b')]));this[_0xd73b('0x33')][_0xd73b('0xa4')](util[_0xd73b('0x27')]('AGENT\x20%s\x20FOUND\x20BY',this[_0xd73b('0x33')][_0xd73b('0x38')],_0x1877b5[_0xd73b('0x14b')]));return{'code':0xc8,'result':'success'};}else{logger['info'](util['format'](_0xd73b('0x14d'),this[_0xd73b('0x33')][_0xd73b('0x38')],_0x1877b5[_0xd73b('0x14b')]));this[_0xd73b('0x33')][_0xd73b('0xa4')](util[_0xd73b('0x27')]('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this[_0xd73b('0x33')][_0xd73b('0x38')],_0x1877b5[_0xd73b('0x14b')]));return{'code':0xc8,'result':_0xd73b('0x151')};}};AGIVertices[_0xd73b('0x10')][_0xd73b('0x1bb')]=function(_0xe8aec2){logger[_0xd73b('0x2b')](util['format'](_0xd73b('0x1bc'),_0xe8aec2[_0xd73b('0xb4')]));var _0x49a239=this[_0xd73b('0x33')]['exec'](_0xd73b('0x1bd'),[_0xe8aec2['mailbox'],_0xe8aec2['options']]);if(_0x49a239[_0xd73b('0x9c')]===-0x1){return _0x49a239;}return this[_0xd73b('0x33')][_0xd73b('0xa4')](util[_0xd73b('0x27')]('Executed\x20command\x20%s\x20%s',_0xd73b('0x1bd'),_0xe8aec2[_0xd73b('0x1be')]));};AGIVertices['prototype'][_0xd73b('0x1bf')]=function(_0x185e6a){logger[_0xd73b('0x2b')](util[_0xd73b('0x27')](_0xd73b('0x1c0'),_0x185e6a[_0xd73b('0xb4')]));if(!this['isConfigured'](_0x185e6a[_0xd73b('0xda')])){return this['channel']['error'](_0x185e6a,_0xd73b('0x1a2'));}var _0x192b5d=this[_0xd73b('0x11')][_0xd73b('0x71')](this,_0x185e6a[_0xd73b('0xda')]);if(!_0x192b5d){return this[_0xd73b('0x33')][_0xd73b('0x2a')](_0x185e6a,_0xd73b('0xdb'));}var _0x230e18=this['channel']['getVariable'](_0x192b5d);return{'code':0xc8,'result':_0x230e18[_0xd73b('0x9e')]?_0x230e18[_0xd73b('0x9e')]:'-'};};String['prototype']['replaceAll']=function(_0x4d2e23,_0x2d3a59){return this[_0xd73b('0x97')](_0x4d2e23)[_0xd73b('0x1c1')](_0x2d3a59);};module[_0xd73b('0x1c2')]=AGIVertices; \ No newline at end of file diff --git a/server/services/ami/acw/index.js b/server/services/ami/acw/index.js index 45eb3df..24d4c2a 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 _0x98a8=['destlinkedid','savePause','acwTimeout','timer','stopAcw','uniqueid','updateAcw','lastPauseAt','update','catch','error','[%s][INPAUSE][AGENT:%s][QUEUE:%s]','[%s][TIMER:%s][AGENT:%s][QUEUE:%s]','finally','message','saveUnpause','[%s][UPDATE][ACWTIME:%s]','[%s][UPDATE][ERRORS:%s]','[ACW][TIMERS]','stringify','[ACW][STOP]\x20%s','prototype','syncAgentConnect','mandatoryDisposition','interface','syncAgentConnectPreview','isUndefined','attended','[%s][HANGUP:UNIQUEID]','linkedid','[%s][HANGUP:LINKEDID]','[ACW][syncHangupRequest]\x20%s','[%s][HANGUPATTENDEDTRANSFER:UNIQUEID]','isNil','transfereeuniqueid','secondtransfereruniqueid','transfertargetuniqueid','origtransfereruniqueid','[ACW][syncAttendedTransfer]\x20%s','[%s][BLINDTRANSFER:UNIQUEID]','transfereruniqueid','transfererlinkedid','[%s][BLINDTRANSFER:LINKEDID]','[ACW][syncBlindTransfer]\x20%s','[%s][AUTOPAUSE][AGENT:%s][QUEUE:%]','Auto-Pause','[ACW][syncAgentRingNoAnswer]\x20%s','exports','util','lodash','moment','../ami','../../../config/logger','acw','../rpc/user','voiceQueues','agents','timers','agentconnect','bind','hanguprequest','syncHangupRequest','hangup','syncHangup','agentringnoanswer','syncAgentRingNoAnswer','attendedtransfer','syncBlindTransfer','custom:agentConnectPreview','milliseconds','diff','seconds','startAcw','channels','queue','mandatoryDispositionPause','name','Action','QueuePause','then','getAgent','voicePause','info','[%s][START][AGENT:%s][QUEUE:%s]'];(function(_0x3b74bc,_0x21b50e){var _0x5a3fdc=function(_0x161f1c){while(--_0x161f1c){_0x3b74bc['push'](_0x3b74bc['shift']());}};_0x5a3fdc(++_0x21b50e);}(_0x98a8,0x12c));var _0x898a=function(_0x3bd3cf,_0x3813e7){_0x3bd3cf=_0x3bd3cf-0x0;var _0x8e4ca3=_0x98a8[_0x3bd3cf];return _0x8e4ca3;};'use strict';var util=require(_0x898a('0x0'));var _=require(_0x898a('0x1'));var moment=require(_0x898a('0x2'));var ami=require(_0x898a('0x3'));var logger=require(_0x898a('0x4'))(_0x898a('0x5'));var RpcUser=require(_0x898a('0x6'));var RpcVoiceAgentReport=require('../rpc/voiceAgentReport');function Acw(_0x2bb3e2){this[_0x898a('0x7')]=_0x2bb3e2[_0x898a('0x7')];this[_0x898a('0x8')]=_0x2bb3e2[_0x898a('0x8')];this['timers']=_0x2bb3e2[_0x898a('0x9')];this['channels']={};ami['on'](_0x898a('0xa'),this['syncAgentConnect'][_0x898a('0xb')](this));ami['on'](_0x898a('0xc'),this[_0x898a('0xd')][_0x898a('0xb')](this));ami['on'](_0x898a('0xe'),this[_0x898a('0xf')][_0x898a('0xb')](this));ami['on'](_0x898a('0x10'),this[_0x898a('0x11')]['bind'](this));ami['on'](_0x898a('0x12'),this['syncAttendedTransfer'][_0x898a('0xb')](this));ami['on']('blindtransfer',this[_0x898a('0x13')][_0x898a('0xb')](this));ami['on'](_0x898a('0x14'),this['syncAgentConnectPreview']['bind'](this));}function getDiff(_0x5b5c9c){var _0x373d53=moment()[_0x898a('0x15')](0x0);var _0xb24335=moment(_0x5b5c9c)[_0x898a('0x15')](0x0);return _0x373d53[_0x898a('0x16')](_0xb24335,_0x898a('0x17'));}Acw['prototype'][_0x898a('0x18')]=function(_0x53a4b8){try{var _0x3fec7a=this;var _0x5c96a6=this[_0x898a('0x19')][_0x53a4b8]['interface'];var _0x18d167=this['channels'][_0x53a4b8][_0x898a('0x1a')];var _0x3197f7=this[_0x898a('0x7')][_0x18d167];var _0x4ddd4d=![];var _0x1faf4c='ACW';if(_0x3197f7['mandatoryDisposition']){if(_0x3197f7[_0x898a('0x1b')][_0x898a('0x1c')]){_0x4ddd4d=!![];_0x1faf4c=_0x3197f7['mandatoryDispositionPause']['name'];}}ami[_0x898a('0x1d')]({'action':_0x898a('0x1e'),'interface':_0x5c96a6,'paused':!![],'reason':_0x1faf4c})[_0x898a('0x1f')](function(_0x2917ff){if(_0x3fec7a[_0x898a('0x8')][_0x5c96a6]){return RpcUser[_0x898a('0x20')](_0x3fec7a[_0x898a('0x8')][_0x5c96a6]['id'])['then'](function(_0x247cfc){if(_0x247cfc&&!_0x247cfc[_0x898a('0x21')]){logger[_0x898a('0x22')](_0x898a('0x23'),_0x53a4b8,_0x5c96a6,_0x18d167);var _0x30495a=_0x3fec7a[_0x898a('0x19')][_0x53a4b8]['attended']&&_0x3fec7a[_0x898a('0x19')][_0x53a4b8][_0x898a('0x24')]?_0x3fec7a[_0x898a('0x19')][_0x53a4b8][_0x898a('0x24')]:_0x53a4b8;return RpcUser[_0x898a('0x25')](_0x3fec7a[_0x898a('0x8')][_0x5c96a6],_0x1faf4c,_0x30495a)['then'](function(_0x20bde0){if(!_0x4ddd4d){_0x3fec7a['timers'][_0x5c96a6]={};logger['info']('[%s][TIMER:%s][AGENT:%s][QUEUE:%s]',_0x53a4b8,_0x3fec7a[_0x898a('0x7')][_0x18d167][_0x898a('0x26')],_0x5c96a6,_0x18d167);_0x3fec7a[_0x898a('0x9')][_0x5c96a6][_0x898a('0x27')]=setTimeout(_0x3fec7a[_0x898a('0x28')][_0x898a('0xb')](_0x3fec7a,_0x5c96a6),_0x3fec7a[_0x898a('0x7')][_0x18d167][_0x898a('0x26')]*0x3e8);_0x3fec7a[_0x898a('0x9')][_0x5c96a6]['lastPauseAt']=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x3fec7a[_0x898a('0x9')][_0x5c96a6][_0x898a('0x29')]=_0x53a4b8;_0x3fec7a[_0x898a('0x9')][_0x5c96a6][_0x898a('0x1a')]=_0x18d167;_0x3fec7a[_0x898a('0x9')][_0x5c96a6][_0x898a('0x2a')]=function(){var _0xe3c983=getDiff(_0x3fec7a[_0x898a('0x9')][_0x5c96a6][_0x898a('0x2b')]);clearTimeout(_0x3fec7a[_0x898a('0x9')][_0x5c96a6][_0x898a('0x27')]);_0x3fec7a[_0x898a('0x9')][_0x5c96a6]['timer']=![];RpcVoiceAgentReport[_0x898a('0x2c')]({'acwtime':_0xe3c983},_0x3fec7a[_0x898a('0x9')][_0x5c96a6][_0x898a('0x29')],_0x5c96a6)[_0x898a('0x1f')](function(_0x2aa99e){logger['info']('[%s][UPDATE][ACWTIME:%s]',_0x53a4b8,_0xe3c983,_0x2aa99e);})[_0x898a('0x2d')](function(_0x1e2fd4){logger[_0x898a('0x2e')]('[%s][UPDATE][ERRORS:%s]',_0x53a4b8,_0x1e2fd4);});delete _0x3fec7a[_0x898a('0x9')][_0x5c96a6];};}});}else{logger[_0x898a('0x22')](_0x898a('0x2f'),_0x53a4b8,_0x5c96a6,_0x18d167);}});}})[_0x898a('0x2d')](function(_0x41cd46){logger[_0x898a('0x2e')](_0x898a('0x30'),_0x53a4b8,_0x3fec7a[_0x898a('0x7')][_0x18d167]['acwTimeout'],_0x5c96a6,_0x18d167);})[_0x898a('0x31')](function(){delete _0x3fec7a['channels'][_0x53a4b8];});}catch(_0x573eb3){logger[_0x898a('0x2e')]('[ACW][START]\x20%s',_0x573eb3[_0x898a('0x32')]);}};Acw['prototype'][_0x898a('0x28')]=function(_0x4f202c){try{var _0x299371=this;if(_0x299371[_0x898a('0x9')][_0x4f202c]){_0x299371[_0x898a('0x9')][_0x4f202c]['timer']=![];var _0x554897=_0x299371['timers'][_0x4f202c][_0x898a('0x29')];var _0x429c32=_0x299371['timers'][_0x4f202c][_0x898a('0x1a')];var _0x3d3463=_0x299371[_0x898a('0x7')][_0x429c32][_0x898a('0x26')];logger['info']('[TIMER][STOP][AGENT:%s]',_0x4f202c);RpcUser[_0x898a('0x33')](this[_0x898a('0x8')][_0x4f202c]);RpcVoiceAgentReport['update']({'acwtime':_0x3d3463,'agentacw':!![]},_0x554897,_0x4f202c)['then'](function(_0x168f92){logger[_0x898a('0x22')](_0x898a('0x34'),_0x554897,_0x3d3463,_0x168f92);})[_0x898a('0x2d')](function(_0x51681f){logger[_0x898a('0x2e')](_0x898a('0x35'),_0x554897,_0x51681f);});}else{logger['error']('[ACW][STOP]\x20Interface\x20%s\x20doesn\x27t\x20have\x20timer',_0x4f202c);if(_0x299371['timers']){logger[_0x898a('0x22')](_0x898a('0x36'),JSON[_0x898a('0x37')](_0x299371[_0x898a('0x9')]));}}}catch(_0x20a6eb){logger[_0x898a('0x2e')](_0x898a('0x38'),_0x20a6eb[_0x898a('0x32')]);}};Acw[_0x898a('0x39')][_0x898a('0x3a')]=function(_0x246048){try{if(this[_0x898a('0x7')][_0x246048[_0x898a('0x1a')]]&&(this[_0x898a('0x7')][_0x246048[_0x898a('0x1a')]]['acw']||this[_0x898a('0x7')][_0x246048[_0x898a('0x1a')]][_0x898a('0x3b')])){if(this['agents'][_0x246048[_0x898a('0x3c')]]){this[_0x898a('0x19')][_0x246048[_0x898a('0x29')]]={'queue':_0x246048[_0x898a('0x1a')],'interface':_0x246048[_0x898a('0x3c')],'destlinkedid':_0x246048[_0x898a('0x24')]};}}}catch(_0x2d1323){logger[_0x898a('0x2e')]('[ACW][syncAgentConnect]\x20%s',_0x2d1323[_0x898a('0x32')]);}};Acw[_0x898a('0x39')][_0x898a('0x3d')]=function(_0x21a990){try{if(this['voiceQueues'][_0x21a990[_0x898a('0x1a')]]&&(this[_0x898a('0x7')][_0x21a990['queue']][_0x898a('0x5')]||this['voiceQueues'][_0x21a990[_0x898a('0x1a')]]['mandatoryDisposition'])){if(this['agents'][_0x21a990[_0x898a('0x3c')]]){this['channels'][_0x21a990[_0x898a('0x29')]]={'queue':_0x21a990[_0x898a('0x1a')],'interface':_0x21a990['interface']};}}}catch(_0x247347){logger[_0x898a('0x2e')]('[ACW][syncAgentConnectPreview]\x20%s',_0x247347[_0x898a('0x32')]);}};Acw[_0x898a('0x39')][_0x898a('0xd')]=function(_0x118240){try{if(this['channels'][_0x118240[_0x898a('0x29')]]&&_[_0x898a('0x3e')](this['channels'][_0x118240[_0x898a('0x29')]][_0x898a('0x3f')])){logger['info'](_0x898a('0x40'),_0x118240['uniqueid']);this[_0x898a('0x18')](_0x118240[_0x898a('0x29')]);}else if(this[_0x898a('0x19')][_0x118240['linkedid']]&&_[_0x898a('0x3e')](this[_0x898a('0x19')][_0x118240[_0x898a('0x41')]][_0x898a('0x3f')])){logger['info'](_0x898a('0x42'),_0x118240['linkedid']);this[_0x898a('0x18')](_0x118240[_0x898a('0x41')]);}}catch(_0x3159d0){logger['error'](_0x898a('0x43'),_0x3159d0[_0x898a('0x32')]);}};Acw[_0x898a('0x39')]['syncHangup']=function(_0x52f8c6){try{if(this[_0x898a('0x19')][_0x52f8c6[_0x898a('0x29')]]&&this[_0x898a('0x19')][_0x52f8c6[_0x898a('0x29')]][_0x898a('0x3f')]){logger[_0x898a('0x22')](_0x898a('0x44'),_0x52f8c6[_0x898a('0x29')]);this[_0x898a('0x18')](_0x52f8c6[_0x898a('0x29')]);}else if(this[_0x898a('0x19')][_0x52f8c6['linkedid']]&&this[_0x898a('0x19')][_0x52f8c6[_0x898a('0x41')]]['attended']){logger[_0x898a('0x22')]('[%s][HANGUPATTENDEDTRANSFER:LINKEDID]',_0x52f8c6['linkedid']);this[_0x898a('0x18')](_0x52f8c6[_0x898a('0x41')]);}}catch(_0x209529){logger['error']('[ACW][syncHangup]\x20%s',_0x209529[_0x898a('0x32')]);}};Acw[_0x898a('0x39')]['syncAttendedTransfer']=function(_0xaa96f7){try{if(!_[_0x898a('0x45')](this['channels'][_0xaa96f7[_0x898a('0x46')]])){this[_0x898a('0x18')](_0xaa96f7[_0x898a('0x46')]);if(this['channels'][_0xaa96f7[_0x898a('0x47')]]){this[_0x898a('0x19')][_0xaa96f7[_0x898a('0x47')]][_0x898a('0x3f')]=!![];this[_0x898a('0x19')][_0xaa96f7[_0x898a('0x48')]]=this['channels'][_0xaa96f7[_0x898a('0x47')]];delete this['channels'][_0xaa96f7[_0x898a('0x47')]];}}else if(!_[_0x898a('0x45')](this[_0x898a('0x19')][_0xaa96f7[_0x898a('0x48')]])){this[_0x898a('0x18')](_0xaa96f7[_0x898a('0x48')]);if(this[_0x898a('0x19')][_0xaa96f7[_0x898a('0x49')]]){this[_0x898a('0x19')][_0xaa96f7['origtransfereruniqueid']][_0x898a('0x3f')]=!![];this[_0x898a('0x19')][_0xaa96f7[_0x898a('0x46')]]=this[_0x898a('0x19')][_0xaa96f7[_0x898a('0x49')]];delete this[_0x898a('0x19')][_0xaa96f7[_0x898a('0x49')]];}}}catch(_0x68fd81){logger[_0x898a('0x2e')](_0x898a('0x4a'),_0x68fd81[_0x898a('0x32')]);}};Acw[_0x898a('0x39')][_0x898a('0x13')]=function(_0x3f76e1){try{if(this[_0x898a('0x19')][_0x3f76e1['transfereruniqueid']]){logger[_0x898a('0x22')](_0x898a('0x4b'),JSON['stringify'](_0x3f76e1[_0x898a('0x4c')]));this[_0x898a('0x18')](_0x3f76e1['transfereruniqueid']);}else if(this[_0x898a('0x19')][_0x3f76e1[_0x898a('0x4d')]]){logger[_0x898a('0x22')](_0x898a('0x4e'),JSON['stringify'](_0x3f76e1[_0x898a('0x4d')]));this[_0x898a('0x18')](_0x3f76e1[_0x898a('0x4d')]);}}catch(_0xf86633){logger['error'](_0x898a('0x4f'),_0xf86633[_0x898a('0x32')]);}};Acw['prototype'][_0x898a('0x11')]=function(_0x3c0bf6){try{if(this['voiceQueues'][_0x3c0bf6[_0x898a('0x1a')]]&&this['voiceQueues'][_0x3c0bf6[_0x898a('0x1a')]]['autopause']==='all'){if(this['agents'][_0x3c0bf6[_0x898a('0x3c')]]){logger[_0x898a('0x22')](_0x898a('0x50'),_0x3c0bf6[_0x898a('0x29')],_0x3c0bf6['interface'],_0x3c0bf6['queue']);return RpcUser[_0x898a('0x25')](this[_0x898a('0x8')][_0x3c0bf6[_0x898a('0x3c')]],_0x898a('0x51'),_0x3c0bf6[_0x898a('0x29')]);}}}catch(_0x41cf94){logger[_0x898a('0x2e')](_0x898a('0x52'),_0x41cf94['message']);}};module[_0x898a('0x53')]=Acw; \ No newline at end of file +var _0x3e74=['acwTimeout','format','YYYY-MM-DD\x20HH:mm:ss','uniqueid','queue','updateAcw','lastPauseAt','update','[%s][UPDATE][ACWTIME:%s]','catch','error','[%s][INPAUSE][AGENT:%s][QUEUE:%s]','[TIMER][STOP][AGENT:%s]','saveUnpause','[%s][UPDATE][ERRORS:%s]','[ACW][STOP]\x20Interface\x20%s\x20doesn\x27t\x20have\x20timer','stringify','[ACW][STOP]\x20%s','acw','[ACW][syncAgentConnect]\x20%s','[ACW][syncAgentConnectPreview]\x20%s','message','attended','isUndefined','linkedid','[%s][HANGUP:LINKEDID]','[ACW][syncHangupRequest]\x20%s','syncHangup','[%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','syncAgentRingNoAnswer','autopause','all','exports','util','moment','../ami','../../../config/logger','../rpc/voiceAgentReport','voiceQueues','agents','timers','channels','agentconnect','syncAgentConnect','bind','hanguprequest','agentringnoanswer','syncAttendedTransfer','syncBlindTransfer','custom:agentConnectPreview','syncAgentConnectPreview','milliseconds','seconds','prototype','startAcw','interface','ACW','mandatoryDisposition','mandatoryDispositionPause','name','Action','QueuePause','then','voicePause','info','[%s][START][AGENT:%s][QUEUE:%s]','destlinkedid','savePause','[%s][TIMER:%s][AGENT:%s][QUEUE:%s]','timer'];(function(_0x1694f5,_0x49b7c3){var _0x5b4321=function(_0x58c183){while(--_0x58c183){_0x1694f5['push'](_0x1694f5['shift']());}};_0x5b4321(++_0x49b7c3);}(_0x3e74,0x175));var _0x43e7=function(_0xa2f415,_0xde87d){_0xa2f415=_0xa2f415-0x0;var _0x435dde=_0x3e74[_0xa2f415];return _0x435dde;};'use strict';var util=require(_0x43e7('0x0'));var _=require('lodash');var moment=require(_0x43e7('0x1'));var ami=require(_0x43e7('0x2'));var logger=require(_0x43e7('0x3'))('acw');var RpcUser=require('../rpc/user');var RpcVoiceAgentReport=require(_0x43e7('0x4'));function Acw(_0x4f9bbe){this[_0x43e7('0x5')]=_0x4f9bbe[_0x43e7('0x5')];this[_0x43e7('0x6')]=_0x4f9bbe[_0x43e7('0x6')];this[_0x43e7('0x7')]=_0x4f9bbe['timers'];this[_0x43e7('0x8')]={};ami['on'](_0x43e7('0x9'),this[_0x43e7('0xa')][_0x43e7('0xb')](this));ami['on'](_0x43e7('0xc'),this['syncHangupRequest'][_0x43e7('0xb')](this));ami['on']('hangup',this['syncHangup'][_0x43e7('0xb')](this));ami['on'](_0x43e7('0xd'),this['syncAgentRingNoAnswer'][_0x43e7('0xb')](this));ami['on']('attendedtransfer',this[_0x43e7('0xe')][_0x43e7('0xb')](this));ami['on']('blindtransfer',this[_0x43e7('0xf')][_0x43e7('0xb')](this));ami['on'](_0x43e7('0x10'),this[_0x43e7('0x11')]['bind'](this));}function getDiff(_0x583d85){var _0x2fcb36=moment()[_0x43e7('0x12')](0x0);var _0x44b0bd=moment(_0x583d85)['milliseconds'](0x0);return _0x2fcb36['diff'](_0x44b0bd,_0x43e7('0x13'));}Acw[_0x43e7('0x14')][_0x43e7('0x15')]=function(_0x328445){try{var _0x4de324=this;var _0x5c4eaa=this[_0x43e7('0x8')][_0x328445][_0x43e7('0x16')];var _0x273a32=this['channels'][_0x328445]['queue'];var _0x446986=this[_0x43e7('0x5')][_0x273a32];var _0x9037d3=![];var _0x140657=_0x43e7('0x17');if(_0x446986[_0x43e7('0x18')]){if(_0x446986[_0x43e7('0x19')][_0x43e7('0x1a')]){_0x9037d3=!![];_0x140657=_0x446986[_0x43e7('0x19')][_0x43e7('0x1a')];}}ami[_0x43e7('0x1b')]({'action':_0x43e7('0x1c'),'interface':_0x5c4eaa,'paused':!![],'reason':_0x140657})['then'](function(_0xef1a5a){if(_0x4de324[_0x43e7('0x6')][_0x5c4eaa]){return RpcUser['getAgent'](_0x4de324[_0x43e7('0x6')][_0x5c4eaa]['id'])[_0x43e7('0x1d')](function(_0x3945bb){if(_0x3945bb&&!_0x3945bb[_0x43e7('0x1e')]){logger[_0x43e7('0x1f')](_0x43e7('0x20'),_0x328445,_0x5c4eaa,_0x273a32);var _0x54a9e7=_0x4de324[_0x43e7('0x8')][_0x328445]['attended']&&_0x4de324['channels'][_0x328445][_0x43e7('0x21')]?_0x4de324[_0x43e7('0x8')][_0x328445]['destlinkedid']:_0x328445;return RpcUser[_0x43e7('0x22')](_0x4de324['agents'][_0x5c4eaa],_0x140657,_0x54a9e7)[_0x43e7('0x1d')](function(_0x5c5e67){if(!_0x9037d3){_0x4de324[_0x43e7('0x7')][_0x5c4eaa]={};logger[_0x43e7('0x1f')](_0x43e7('0x23'),_0x328445,_0x4de324[_0x43e7('0x5')][_0x273a32]['acwTimeout'],_0x5c4eaa,_0x273a32);_0x4de324['timers'][_0x5c4eaa][_0x43e7('0x24')]=setTimeout(_0x4de324['stopAcw'][_0x43e7('0xb')](_0x4de324,_0x5c4eaa),_0x4de324[_0x43e7('0x5')][_0x273a32][_0x43e7('0x25')]*0x3e8);_0x4de324[_0x43e7('0x7')][_0x5c4eaa]['lastPauseAt']=moment()[_0x43e7('0x26')](_0x43e7('0x27'));_0x4de324[_0x43e7('0x7')][_0x5c4eaa][_0x43e7('0x28')]=_0x328445;_0x4de324[_0x43e7('0x7')][_0x5c4eaa][_0x43e7('0x29')]=_0x273a32;_0x4de324[_0x43e7('0x7')][_0x5c4eaa][_0x43e7('0x2a')]=function(){var _0x3bf475=getDiff(_0x4de324[_0x43e7('0x7')][_0x5c4eaa][_0x43e7('0x2b')]);clearTimeout(_0x4de324[_0x43e7('0x7')][_0x5c4eaa][_0x43e7('0x24')]);_0x4de324[_0x43e7('0x7')][_0x5c4eaa]['timer']=![];RpcVoiceAgentReport[_0x43e7('0x2c')]({'acwtime':_0x3bf475},_0x4de324[_0x43e7('0x7')][_0x5c4eaa][_0x43e7('0x28')],_0x5c4eaa)[_0x43e7('0x1d')](function(_0x4251c8){logger['info'](_0x43e7('0x2d'),_0x328445,_0x3bf475,_0x4251c8);})[_0x43e7('0x2e')](function(_0x30d47e){logger[_0x43e7('0x2f')]('[%s][UPDATE][ERRORS:%s]',_0x328445,_0x30d47e);});delete _0x4de324['timers'][_0x5c4eaa];};}});}else{logger['info'](_0x43e7('0x30'),_0x328445,_0x5c4eaa,_0x273a32);}});}})[_0x43e7('0x2e')](function(_0x117c07){logger[_0x43e7('0x2f')](_0x43e7('0x23'),_0x328445,_0x4de324[_0x43e7('0x5')][_0x273a32]['acwTimeout'],_0x5c4eaa,_0x273a32);})['finally'](function(){delete _0x4de324['channels'][_0x328445];});}catch(_0x59e5b2){logger['error']('[ACW][START]\x20%s',_0x59e5b2['message']);}};Acw[_0x43e7('0x14')]['stopAcw']=function(_0x2b4bfd){try{var _0x8e9f40=this;if(_0x8e9f40[_0x43e7('0x7')][_0x2b4bfd]){_0x8e9f40[_0x43e7('0x7')][_0x2b4bfd][_0x43e7('0x24')]=![];var _0x449803=_0x8e9f40[_0x43e7('0x7')][_0x2b4bfd]['uniqueid'];var _0x5332d9=_0x8e9f40['timers'][_0x2b4bfd][_0x43e7('0x29')];var _0xfe70e9=_0x8e9f40[_0x43e7('0x5')][_0x5332d9][_0x43e7('0x25')];logger[_0x43e7('0x1f')](_0x43e7('0x31'),_0x2b4bfd);RpcUser[_0x43e7('0x32')](this[_0x43e7('0x6')][_0x2b4bfd]);RpcVoiceAgentReport['update']({'acwtime':_0xfe70e9,'agentacw':!![]},_0x449803,_0x2b4bfd)[_0x43e7('0x1d')](function(_0x2b0ffe){logger['info'](_0x43e7('0x2d'),_0x449803,_0xfe70e9,_0x2b0ffe);})['catch'](function(_0x44d8e4){logger[_0x43e7('0x2f')](_0x43e7('0x33'),_0x449803,_0x44d8e4);});}else{logger[_0x43e7('0x2f')](_0x43e7('0x34'),_0x2b4bfd);if(_0x8e9f40[_0x43e7('0x7')]){logger['info']('[ACW][TIMERS]',JSON[_0x43e7('0x35')](_0x8e9f40[_0x43e7('0x7')]));}}}catch(_0x44b6ae){logger[_0x43e7('0x2f')](_0x43e7('0x36'),_0x44b6ae['message']);}};Acw[_0x43e7('0x14')][_0x43e7('0xa')]=function(_0x575439){try{if(this[_0x43e7('0x5')][_0x575439['queue']]&&(this[_0x43e7('0x5')][_0x575439['queue']][_0x43e7('0x37')]||this[_0x43e7('0x5')][_0x575439[_0x43e7('0x29')]][_0x43e7('0x18')])){if(this['agents'][_0x575439['interface']]){this[_0x43e7('0x8')][_0x575439[_0x43e7('0x28')]]={'queue':_0x575439[_0x43e7('0x29')],'interface':_0x575439[_0x43e7('0x16')],'destlinkedid':_0x575439['destlinkedid']};}}}catch(_0x583047){logger['error'](_0x43e7('0x38'),_0x583047['message']);}};Acw[_0x43e7('0x14')]['syncAgentConnectPreview']=function(_0x5b28db){try{if(this[_0x43e7('0x5')][_0x5b28db['queue']]&&(this[_0x43e7('0x5')][_0x5b28db[_0x43e7('0x29')]][_0x43e7('0x37')]||this[_0x43e7('0x5')][_0x5b28db['queue']][_0x43e7('0x18')])){if(this[_0x43e7('0x6')][_0x5b28db[_0x43e7('0x16')]]){this[_0x43e7('0x8')][_0x5b28db[_0x43e7('0x28')]]={'queue':_0x5b28db[_0x43e7('0x29')],'interface':_0x5b28db['interface']};}}}catch(_0x4930a2){logger[_0x43e7('0x2f')](_0x43e7('0x39'),_0x4930a2[_0x43e7('0x3a')]);}};Acw['prototype']['syncHangupRequest']=function(_0x56489b){try{if(this[_0x43e7('0x8')][_0x56489b[_0x43e7('0x28')]]&&_['isUndefined'](this[_0x43e7('0x8')][_0x56489b[_0x43e7('0x28')]][_0x43e7('0x3b')])){logger['info']('[%s][HANGUP:UNIQUEID]',_0x56489b['uniqueid']);this['startAcw'](_0x56489b[_0x43e7('0x28')]);}else if(this[_0x43e7('0x8')][_0x56489b['linkedid']]&&_[_0x43e7('0x3c')](this[_0x43e7('0x8')][_0x56489b[_0x43e7('0x3d')]][_0x43e7('0x3b')])){logger['info'](_0x43e7('0x3e'),_0x56489b['linkedid']);this['startAcw'](_0x56489b[_0x43e7('0x3d')]);}}catch(_0x12f9ba){logger[_0x43e7('0x2f')](_0x43e7('0x3f'),_0x12f9ba[_0x43e7('0x3a')]);}};Acw[_0x43e7('0x14')][_0x43e7('0x40')]=function(_0x256ddd){try{if(this[_0x43e7('0x8')][_0x256ddd[_0x43e7('0x28')]]&&this['channels'][_0x256ddd[_0x43e7('0x28')]][_0x43e7('0x3b')]){logger['info'](_0x43e7('0x41'),_0x256ddd['uniqueid']);this[_0x43e7('0x15')](_0x256ddd[_0x43e7('0x28')]);}else if(this[_0x43e7('0x8')][_0x256ddd[_0x43e7('0x3d')]]&&this[_0x43e7('0x8')][_0x256ddd['linkedid']]['attended']){logger[_0x43e7('0x1f')](_0x43e7('0x42'),_0x256ddd[_0x43e7('0x3d')]);this[_0x43e7('0x15')](_0x256ddd[_0x43e7('0x3d')]);}}catch(_0x25bb44){logger[_0x43e7('0x2f')](_0x43e7('0x43'),_0x25bb44[_0x43e7('0x3a')]);}};Acw[_0x43e7('0x14')][_0x43e7('0xe')]=function(_0x4ace49){try{if(!_[_0x43e7('0x44')](this[_0x43e7('0x8')][_0x4ace49['transfereeuniqueid']])){this[_0x43e7('0x15')](_0x4ace49[_0x43e7('0x45')]);if(this[_0x43e7('0x8')][_0x4ace49['secondtransfereruniqueid']]){this['channels'][_0x4ace49[_0x43e7('0x46')]][_0x43e7('0x3b')]=!![];this['channels'][_0x4ace49[_0x43e7('0x47')]]=this['channels'][_0x4ace49['secondtransfereruniqueid']];delete this[_0x43e7('0x8')][_0x4ace49[_0x43e7('0x46')]];}}else if(!_[_0x43e7('0x44')](this[_0x43e7('0x8')][_0x4ace49[_0x43e7('0x47')]])){this['startAcw'](_0x4ace49[_0x43e7('0x47')]);if(this[_0x43e7('0x8')][_0x4ace49['origtransfereruniqueid']]){this[_0x43e7('0x8')][_0x4ace49[_0x43e7('0x48')]][_0x43e7('0x3b')]=!![];this['channels'][_0x4ace49['transfereeuniqueid']]=this['channels'][_0x4ace49[_0x43e7('0x48')]];delete this[_0x43e7('0x8')][_0x4ace49[_0x43e7('0x48')]];}}}catch(_0x3a6404){logger['error']('[ACW][syncAttendedTransfer]\x20%s',_0x3a6404[_0x43e7('0x3a')]);}};Acw[_0x43e7('0x14')][_0x43e7('0xf')]=function(_0x5dd349){try{if(this['channels'][_0x5dd349[_0x43e7('0x49')]]){logger[_0x43e7('0x1f')](_0x43e7('0x4a'),JSON[_0x43e7('0x35')](_0x5dd349[_0x43e7('0x49')]));this[_0x43e7('0x15')](_0x5dd349[_0x43e7('0x49')]);}else if(this[_0x43e7('0x8')][_0x5dd349[_0x43e7('0x4b')]]){logger[_0x43e7('0x1f')](_0x43e7('0x4c'),JSON['stringify'](_0x5dd349['transfererlinkedid']));this[_0x43e7('0x15')](_0x5dd349['transfererlinkedid']);}}catch(_0x501616){logger['error'](_0x43e7('0x4d'),_0x501616[_0x43e7('0x3a')]);}};Acw['prototype'][_0x43e7('0x4e')]=function(_0x135791){try{if(this[_0x43e7('0x5')][_0x135791['queue']]&&this[_0x43e7('0x5')][_0x135791[_0x43e7('0x29')]][_0x43e7('0x4f')]===_0x43e7('0x50')){if(this[_0x43e7('0x6')][_0x135791[_0x43e7('0x16')]]){logger[_0x43e7('0x1f')]('[%s][AUTOPAUSE][AGENT:%s][QUEUE:%]',_0x135791[_0x43e7('0x28')],_0x135791[_0x43e7('0x16')],_0x135791[_0x43e7('0x29')]);return RpcUser['savePause'](this['agents'][_0x135791[_0x43e7('0x16')]],'Auto-Pause',_0x135791['uniqueid']);}}}catch(_0x1b793d){logger[_0x43e7('0x2f')]('[ACW][syncAgentRingNoAnswer]\x20%s',_0x1b793d[_0x43e7('0x3a')]);}};module[_0x43e7('0x51')]=Acw; \ No newline at end of file diff --git a/server/services/ami/ami.js b/server/services/ami/ami.js index 1433cc6..c3c54bd 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 _0xda25=['Manager\x20\x22%s\x22\x20logged\x20on\x20to\x20%s:%s','once','close','connect','info','Shutdown\x20\x22%s\x22\x20to\x20%s:%s\x20with:\x0a%s','fullybooted','Fullybooted\x20\x22%s\x22\x20to\x20%s:%s','resolve','then','catch','exports','asterisk-manager','bluebird','moment','lodash','../../config/logger','ami','asterisk','username','password','keepConnected','Action','error','Manager\x20\x22%s\x22\x20error\x20to\x20%s:%s\x20with:\x0a%s','port','format','actionSipShowRegistry','actionDeviceStateList','actionSipPeerStatus','sippeerstatus','actionQueueSummary','queuesummary','coreshowchannels'];(function(_0xc01be5,_0x529a48){var _0x2e93d0=function(_0x204bd3){while(--_0x204bd3){_0xc01be5['push'](_0xc01be5['shift']());}};_0x2e93d0(++_0x529a48);}(_0xda25,0x72));var _0x5da2=function(_0x44bcb0,_0x235aa9){_0x44bcb0=_0x44bcb0-0x0;var _0xfaf881=_0xda25[_0x44bcb0];return _0xfaf881;};'use strict';var Manager=require(_0x5da2('0x0'));var BPromise=require(_0x5da2('0x1'));var moment=require(_0x5da2('0x2'));var util=require('util');var _=require(_0x5da2('0x3'));var logger=require(_0x5da2('0x4'))(_0x5da2('0x5'));var config=require('../../config/environment');var ami=new Manager(config['asterisk']['port'],config[_0x5da2('0x6')]['ip'],config[_0x5da2('0x6')][_0x5da2('0x7')],config[_0x5da2('0x6')][_0x5da2('0x8')],!![]);ami[_0x5da2('0x9')]();ami[_0x5da2('0xa')]=BPromise['promisify'](ami['action']);function error(_0x4a6705){logger[_0x5da2('0xb')](util['format'](_0x5da2('0xc'),config['asterisk']['username'],config[_0x5da2('0x6')]['ip'],config['asterisk'][_0x5da2('0xd')],util['inspect'](_0x4a6705,![],null)));}function close(){logger[_0x5da2('0xb')](util[_0x5da2('0xe')]('Manager\x20\x22%s\x22\x20closed\x20to\x20%s:%s',config['asterisk']['username'],config[_0x5da2('0x6')]['ip'],config[_0x5da2('0x6')][_0x5da2('0xd')]));}ami[_0x5da2('0xf')]=function(){return function(){return ami[_0x5da2('0xa')]({'action':'sipshowregistry'});};};ami[_0x5da2('0x10')]=function(){return function(){return ami[_0x5da2('0xa')]({'action':'devicestatelist'});};};ami[_0x5da2('0x11')]=function(){return function(){return ami[_0x5da2('0xa')]({'action':_0x5da2('0x12')});};};ami[_0x5da2('0x13')]=function(){return function(){return ami[_0x5da2('0xa')]({'action':_0x5da2('0x14')});};};ami['actionCoreShowChannels']=function(){return function(){return ami['Action']({'action':_0x5da2('0x15')});};};function connect(_0x2f19f0){logger['info'](util['format'](_0x5da2('0x16'),config[_0x5da2('0x6')]['username'],config[_0x5da2('0x6')]['ip'],config[_0x5da2('0x6')]['port']));ami[_0x5da2('0x17')](_0x5da2('0xb'),error);ami[_0x5da2('0x17')](_0x5da2('0x18'),close);}ami['on'](_0x5da2('0x19'),connect);ami['on']('shutdown',function(_0x28f0b6){logger[_0x5da2('0x1a')](util[_0x5da2('0xe')](_0x5da2('0x1b'),config['asterisk'][_0x5da2('0x7')],config[_0x5da2('0x6')]['ip'],config[_0x5da2('0x6')][_0x5da2('0xd')],util['inspect'](_0x28f0b6,![],null)));});ami['on'](_0x5da2('0x1c'),function(_0x2d1351){logger[_0x5da2('0x1a')](util[_0x5da2('0xe')](_0x5da2('0x1d'),config['asterisk'][_0x5da2('0x7')],config['asterisk']['ip'],config[_0x5da2('0x6')][_0x5da2('0xd')]));return BPromise[_0x5da2('0x1e')]()['then'](ami[_0x5da2('0xf')]())[_0x5da2('0x1f')](ami['actionDeviceStateList']())[_0x5da2('0x1f')](ami[_0x5da2('0x11')]())[_0x5da2('0x1f')](ami[_0x5da2('0x13')]())[_0x5da2('0x1f')](ami['actionCoreShowChannels']())[_0x5da2('0x20')](function(_0x5681e3){console['log'](_0x5681e3);});});ami[_0x5da2('0x17')](_0x5da2('0xb'),error);ami['once'](_0x5da2('0x18'),close);module[_0x5da2('0x21')]=ami; \ No newline at end of file +var _0x5624=['actionQueueSummary','queuesummary','actionCoreShowChannels','info','format','Manager\x20\x22%s\x22\x20logged\x20on\x20to\x20%s:%s','once','close','shutdown','username','inspect','fullybooted','resolve','then','log','exports','asterisk-manager','bluebird','moment','../../config/logger','ami','../../config/environment','asterisk','password','keepConnected','Action','action','error','port','Manager\x20\x22%s\x22\x20closed\x20to\x20%s:%s','actionSipShowRegistry','actionDeviceStateList','sippeerstatus'];(function(_0x3e19ca,_0x5a88a0){var _0x51b3b8=function(_0x3e822c){while(--_0x3e822c){_0x3e19ca['push'](_0x3e19ca['shift']());}};_0x51b3b8(++_0x5a88a0);}(_0x5624,0x19c));var _0x4562=function(_0x527372,_0x173b25){_0x527372=_0x527372-0x0;var _0x4f88b2=_0x5624[_0x527372];return _0x4f88b2;};'use strict';var Manager=require(_0x4562('0x0'));var BPromise=require(_0x4562('0x1'));var moment=require(_0x4562('0x2'));var util=require('util');var _=require('lodash');var logger=require(_0x4562('0x3'))(_0x4562('0x4'));var config=require(_0x4562('0x5'));var ami=new Manager(config[_0x4562('0x6')]['port'],config[_0x4562('0x6')]['ip'],config[_0x4562('0x6')]['username'],config[_0x4562('0x6')][_0x4562('0x7')],!![]);ami[_0x4562('0x8')]();ami[_0x4562('0x9')]=BPromise['promisify'](ami[_0x4562('0xa')]);function error(_0x145769){logger[_0x4562('0xb')](util['format']('Manager\x20\x22%s\x22\x20error\x20to\x20%s:%s\x20with:\x0a%s',config[_0x4562('0x6')]['username'],config[_0x4562('0x6')]['ip'],config['asterisk'][_0x4562('0xc')],util['inspect'](_0x145769,![],null)));}function close(){logger[_0x4562('0xb')](util['format'](_0x4562('0xd'),config['asterisk']['username'],config['asterisk']['ip'],config[_0x4562('0x6')]['port']));}ami[_0x4562('0xe')]=function(){return function(){return ami['Action']({'action':'sipshowregistry'});};};ami[_0x4562('0xf')]=function(){return function(){return ami[_0x4562('0x9')]({'action':'devicestatelist'});};};ami['actionSipPeerStatus']=function(){return function(){return ami[_0x4562('0x9')]({'action':_0x4562('0x10')});};};ami[_0x4562('0x11')]=function(){return function(){return ami[_0x4562('0x9')]({'action':_0x4562('0x12')});};};ami[_0x4562('0x13')]=function(){return function(){return ami[_0x4562('0x9')]({'action':'coreshowchannels'});};};function connect(_0x5e8f1f){logger[_0x4562('0x14')](util[_0x4562('0x15')](_0x4562('0x16'),config['asterisk']['username'],config['asterisk']['ip'],config['asterisk'][_0x4562('0xc')]));ami[_0x4562('0x17')](_0x4562('0xb'),error);ami['once'](_0x4562('0x18'),close);}ami['on']('connect',connect);ami['on'](_0x4562('0x19'),function(_0x19ac8a){logger['info'](util[_0x4562('0x15')]('Shutdown\x20\x22%s\x22\x20to\x20%s:%s\x20with:\x0a%s',config['asterisk'][_0x4562('0x1a')],config[_0x4562('0x6')]['ip'],config[_0x4562('0x6')][_0x4562('0xc')],util[_0x4562('0x1b')](_0x19ac8a,![],null)));});ami['on'](_0x4562('0x1c'),function(_0x1a32ae){logger[_0x4562('0x14')](util[_0x4562('0x15')]('Fullybooted\x20\x22%s\x22\x20to\x20%s:%s',config['asterisk'][_0x4562('0x1a')],config[_0x4562('0x6')]['ip'],config[_0x4562('0x6')][_0x4562('0xc')]));return BPromise[_0x4562('0x1d')]()['then'](ami[_0x4562('0xe')]())[_0x4562('0x1e')](ami[_0x4562('0xf')]())[_0x4562('0x1e')](ami['actionSipPeerStatus']())[_0x4562('0x1e')](ami[_0x4562('0x11')]())[_0x4562('0x1e')](ami[_0x4562('0x13')]())['catch'](function(_0x3c700e){console[_0x4562('0x1f')](_0x3c700e);});});ami[_0x4562('0x17')](_0x4562('0xb'),error);ami[_0x4562('0x17')]('close',close);module[_0x4562('0x20')]=ami; \ No newline at end of file diff --git a/server/services/ami/client.js b/server/services/ami/client.js index 883bbb0..a591cca 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 _0xe0db=['error','message','result','exports','bluebird','client','http','request','then','debug','rpc','memberReport'];(function(_0x541b9a,_0x169793){var _0x52c418=function(_0x33bc73){while(--_0x33bc73){_0x541b9a['push'](_0x541b9a['shift']());}};_0x52c418(++_0x169793);}(_0xe0db,0xb8));var _0xbe0d=function(_0x28947d,_0x4cc9c6){_0x28947d=_0x28947d-0x0;var _0x12d2ee=_0xe0db[_0x28947d];return _0x12d2ee;};'use strict';var jayson=require('jayson/promise');var BPromise=require(_0xbe0d('0x0'));var logger=require('../../config/logger')('ami');var client=jayson[_0xbe0d('0x1')][_0xbe0d('0x2')]({'port':0x2329});client['Request']=function(_0xb9fba4,_0x830f8f){return new BPromise(function(_0x27cf4b,_0x574e5d){return client[_0xbe0d('0x3')](_0xb9fba4,_0x830f8f)[_0xbe0d('0x4')](function(_0x4e179d){logger[_0xbe0d('0x5')](_0xbe0d('0x6'),_0xbe0d('0x7'),_0xb9fba4,_0x830f8f,_0x4e179d);if(_0x4e179d[_0xbe0d('0x8')]){logger[_0xbe0d('0x8')](_0xbe0d('0x6'),'memberReport',_0xb9fba4,_0x4e179d[_0xbe0d('0x8')][_0xbe0d('0x9')],_0x830f8f);return _0x574e5d(_0x4e179d['error'][_0xbe0d('0x9')]);}else{return _0x27cf4b(_0x4e179d[_0xbe0d('0xa')]);}})['catch'](function(_0x27fcfb){logger['error']('rpc',_0xbe0d('0x7'),_0xb9fba4,_0x27fcfb,_0x830f8f);return _0x574e5d(_0x27fcfb);});});};module[_0xbe0d('0xb')]=client; \ No newline at end of file +var _0x810c=['jayson/promise','../../config/logger','ami','client','Request','request','memberReport','error','rpc','message','catch','exports'];(function(_0x552c27,_0x478dc2){var _0x2a0922=function(_0x22617c){while(--_0x22617c){_0x552c27['push'](_0x552c27['shift']());}};_0x2a0922(++_0x478dc2);}(_0x810c,0x15c));var _0xc810=function(_0x230df3,_0x2a972e){_0x230df3=_0x230df3-0x0;var _0x14c031=_0x810c[_0x230df3];return _0x14c031;};'use strict';var jayson=require(_0xc810('0x0'));var BPromise=require('bluebird');var logger=require(_0xc810('0x1'))(_0xc810('0x2'));var client=jayson[_0xc810('0x3')]['http']({'port':0x2329});client[_0xc810('0x4')]=function(_0x33793a,_0x87dc6){return new BPromise(function(_0x46aef8,_0x4586e0){return client[_0xc810('0x5')](_0x33793a,_0x87dc6)['then'](function(_0x2b6c81){logger['debug']('rpc',_0xc810('0x6'),_0x33793a,_0x87dc6,_0x2b6c81);if(_0x2b6c81[_0xc810('0x7')]){logger[_0xc810('0x7')](_0xc810('0x8'),_0xc810('0x6'),_0x33793a,_0x2b6c81[_0xc810('0x7')][_0xc810('0x9')],_0x87dc6);return _0x4586e0(_0x2b6c81[_0xc810('0x7')][_0xc810('0x9')]);}else{return _0x46aef8(_0x2b6c81['result']);}})[_0xc810('0xa')](function(_0x4d718c){logger['error'](_0xc810('0x8'),'memberReport',_0x33793a,_0x4d718c,_0x87dc6);return _0x4586e0(_0x4d718c);});});};module[_0xc810('0xb')]=client; \ No newline at end of file diff --git a/server/services/ami/dialer/action.js b/server/services/ami/dialer/action.js index 4972376..3c887d2 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 _0x48bc=['countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','ContactId','ListId','UserId','VoiceQueueId','idHopper','starttime','format','YYYY-MM-DD\x20HH:mm:ss','callback','callbackuniqueid','callbackat','recallme','originatecalleridnum','originatecalleridname','prototype','getCaller','\x22%s\x22\x20<%s>','dialCutDigit','substring','getQueue','util','lodash','moment','isNil','string','voiceQueue','uniqueid','Contact','firstName','lastName','number','phone','queue','name','active','type','dialQueueTimeout','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x48bc,0x1b6));var _0xc48b=function(_0x3deffc,_0x38d990){_0x3deffc=_0x3deffc-0x0;var _0x302890=_0x48bc[_0x3deffc];return _0x302890;};'use strict';var util=require(_0xc48b('0x0'));var _=require(_0xc48b('0x1'));var moment=require(_0xc48b('0x2'));function checkNameSurname(_0x48f245,_0x29e2d4,_0x427753){var _0x15b642='';if(!_[_0xc48b('0x3')](_0x29e2d4)&&_0xc48b('0x4')===typeof _0x29e2d4){_0x15b642+=_0x29e2d4;}if(!_[_0xc48b('0x3')](_0x427753)&&_0xc48b('0x4')===typeof _0x427753){_0x15b642+='\x20'+_0x427753;}if(_0x15b642!==''){return _0x15b642;}return _0x48f245;}function Action(_0x52796c,_0x221555,_0x4c001c){this[_0xc48b('0x5')]=_0x52796c;this[_0xc48b('0x6')]=_0x4c001c||undefined;this['name']=checkNameSurname(_0x221555[_0xc48b('0x7')]['phone'],_0x221555[_0xc48b('0x7')][_0xc48b('0x8')],_0x221555['Contact'][_0xc48b('0x9')]);this[_0xc48b('0xa')]=_0x221555[_0xc48b('0x7')][_0xc48b('0xb')];this[_0xc48b('0xc')]=_0x52796c[_0xc48b('0xd')];this[_0xc48b('0xe')]=_0x221555[_0xc48b('0xe')]||![];this[_0xc48b('0xf')]=_0x52796c[_0xc48b('0xf')];this[_0xc48b('0x10')]=_0x52796c[_0xc48b('0x10')]||0x3;this['scheduledat']=_0x221555[_0xc48b('0x11')];this[_0xc48b('0x12')]=_0x221555[_0xc48b('0x12')];this['countcongestionretry']=_0x221555[_0xc48b('0x13')];this[_0xc48b('0x14')]=_0x221555[_0xc48b('0x14')];this[_0xc48b('0x15')]=_0x221555[_0xc48b('0x15')];this[_0xc48b('0x16')]=_0x221555[_0xc48b('0x16')];this[_0xc48b('0x17')]=_0x221555['countabandonedretry'];this[_0xc48b('0x18')]=_0x221555['countmachineretry'];this['countagentrejectretry']=_0x221555[_0xc48b('0x19')];this['ContactId']=_0x221555[_0xc48b('0x1a')];this['ListId']=_0x221555[_0xc48b('0x1b')];this['UserId']=_0x221555[_0xc48b('0x1c')];this[_0xc48b('0x1d')]=_0x221555[_0xc48b('0x1d')];this['CampaignId']=_0x221555['CampaignId'];this[_0xc48b('0x1e')]=_0x221555['id'];this['ContactFirstName']=_0x221555[_0xc48b('0x7')][_0xc48b('0x8')]||'';this[_0xc48b('0x1f')]=moment()[_0xc48b('0x20')](_0xc48b('0x21'));this[_0xc48b('0x22')]=_0x221555[_0xc48b('0x22')];this[_0xc48b('0x23')]=_0x221555[_0xc48b('0x23')];this['callbackat']=_0x221555[_0xc48b('0x24')];this[_0xc48b('0x25')]=_0x221555[_0xc48b('0x25')];this[_0xc48b('0x26')]='';this[_0xc48b('0x27')]='';}Action[_0xc48b('0x28')][_0xc48b('0x29')]=function(){return util[_0xc48b('0x20')](_0xc48b('0x2a'),this[_0xc48b('0xd')],this[_0xc48b('0x5')][_0xc48b('0x2b')]>0x0?this['number'][_0xc48b('0x2c')](this[_0xc48b('0x5')][_0xc48b('0x2b')]):this[_0xc48b('0xa')]);};Action[_0xc48b('0x28')][_0xc48b('0x2d')]=function(){return this[_0xc48b('0xc')];};module['exports']=Action; \ No newline at end of file +var _0x0d74=['countnosuchnumberretry','countdropretry','countabandonedretry','countagentrejectretry','ListId','UserId','VoiceQueueId','CampaignId','idHopper','ContactFirstName','YYYY-MM-DD\x20HH:mm:ss','callback','callbackuniqueid','callbackat','recallme','originatecalleridnum','originatecalleridname','prototype','getCaller','\x22%s\x22\x20<%s>','voiceQueue','dialCutDigit','getQueue','queue','exports','util','lodash','string','isNil','uniqueid','Contact','phone','firstName','lastName','number','name','active','type','dialQueueTimeout','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry'];(function(_0x1a3dd5,_0x497e31){var _0x2749a2=function(_0x52c4ec){while(--_0x52c4ec){_0x1a3dd5['push'](_0x1a3dd5['shift']());}};_0x2749a2(++_0x497e31);}(_0x0d74,0x146));var _0x40d7=function(_0x130b96,_0x16244d){_0x130b96=_0x130b96-0x0;var _0xac0d23=_0x0d74[_0x130b96];return _0xac0d23;};'use strict';var util=require(_0x40d7('0x0'));var _=require(_0x40d7('0x1'));var moment=require('moment');function checkNameSurname(_0x4d472e,_0x325b84,_0x30c393){var _0x5c22af='';if(!_['isNil'](_0x325b84)&&_0x40d7('0x2')===typeof _0x325b84){_0x5c22af+=_0x325b84;}if(!_[_0x40d7('0x3')](_0x30c393)&&_0x40d7('0x2')===typeof _0x30c393){_0x5c22af+='\x20'+_0x30c393;}if(_0x5c22af!==''){return _0x5c22af;}return _0x4d472e;}function Action(_0x41b9cb,_0x5edb57,_0x5280f0){this['voiceQueue']=_0x41b9cb;this[_0x40d7('0x4')]=_0x5280f0||undefined;this['name']=checkNameSurname(_0x5edb57[_0x40d7('0x5')][_0x40d7('0x6')],_0x5edb57['Contact'][_0x40d7('0x7')],_0x5edb57[_0x40d7('0x5')][_0x40d7('0x8')]);this[_0x40d7('0x9')]=_0x5edb57[_0x40d7('0x5')][_0x40d7('0x6')];this['queue']=_0x41b9cb[_0x40d7('0xa')];this[_0x40d7('0xb')]=_0x5edb57[_0x40d7('0xb')]||![];this[_0x40d7('0xc')]=_0x41b9cb[_0x40d7('0xc')];this['dialQueueTimeout']=_0x41b9cb[_0x40d7('0xd')]||0x3;this[_0x40d7('0xe')]=_0x5edb57[_0x40d7('0xe')];this[_0x40d7('0xf')]=_0x5edb57['countbusyretry'];this[_0x40d7('0x10')]=_0x5edb57[_0x40d7('0x10')];this[_0x40d7('0x11')]=_0x5edb57[_0x40d7('0x11')];this[_0x40d7('0x12')]=_0x5edb57[_0x40d7('0x12')];this[_0x40d7('0x13')]=_0x5edb57[_0x40d7('0x13')];this[_0x40d7('0x14')]=_0x5edb57['countabandonedretry'];this['countmachineretry']=_0x5edb57['countmachineretry'];this[_0x40d7('0x15')]=_0x5edb57[_0x40d7('0x15')];this['ContactId']=_0x5edb57['ContactId'];this[_0x40d7('0x16')]=_0x5edb57['ListId'];this['UserId']=_0x5edb57[_0x40d7('0x17')];this[_0x40d7('0x18')]=_0x5edb57[_0x40d7('0x18')];this[_0x40d7('0x19')]=_0x5edb57[_0x40d7('0x19')];this[_0x40d7('0x1a')]=_0x5edb57['id'];this[_0x40d7('0x1b')]=_0x5edb57[_0x40d7('0x5')]['firstName']||'';this['starttime']=moment()['format'](_0x40d7('0x1c'));this['callback']=_0x5edb57[_0x40d7('0x1d')];this[_0x40d7('0x1e')]=_0x5edb57[_0x40d7('0x1e')];this[_0x40d7('0x1f')]=_0x5edb57[_0x40d7('0x1f')];this[_0x40d7('0x20')]=_0x5edb57[_0x40d7('0x20')];this[_0x40d7('0x21')]='';this[_0x40d7('0x22')]='';}Action[_0x40d7('0x23')][_0x40d7('0x24')]=function(){return util['format'](_0x40d7('0x25'),this[_0x40d7('0xa')],this[_0x40d7('0x26')][_0x40d7('0x27')]>0x0?this['number']['substring'](this[_0x40d7('0x26')]['dialCutDigit']):this['number']);};Action[_0x40d7('0x23')][_0x40d7('0x28')]=function(){return this[_0x40d7('0x29')];};module[_0x40d7('0x2a')]=Action; \ No newline at end of file diff --git a/server/services/ami/dialer/additionalPhone.js b/server/services/ami/dialer/additionalPhone.js index 8a57c07..dad936a 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 _0xa4d7=['callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','moment','milliseconds','diff','seconds','uniqueid','scheduledat','type','campaigntype','queue','countbusyretry','countcongestionretry','countnoanswerretry','countabandonedretry','countagentrejectretry','countnosuchnumberretry','countdropretry','countmachineretry','calleridname','name','calleridnum','number','starttime','responsetime','endtime','ringtime','talktime','callback','callbackuniqueid'];(function(_0x5ff517,_0x3e4ee0){var _0x19a245=function(_0x4c00ac){while(--_0x4c00ac){_0x5ff517['push'](_0x5ff517['shift']());}};_0x19a245(++_0x3e4ee0);}(_0xa4d7,0xc8));var _0x7a4d=function(_0x210b24,_0x11eea6){_0x210b24=_0x210b24-0x0;var _0x267fad=_0xa4d7[_0x210b24];return _0x267fad;};'use strict';var util=require('util');var _=require('lodash');var moment=require(_0x7a4d('0x0'));function getSeconds(_0xead091,_0x254d3a){var _0x541e0f=moment(_0xead091)[_0x7a4d('0x1')](0x0);var _0x46ab8c=moment(_0x254d3a)[_0x7a4d('0x1')](0x0);return _0x541e0f[_0x7a4d('0x2')](_0x46ab8c,_0x7a4d('0x3'));}function AdditionalPhone(_0x8770bc){this[_0x7a4d('0x4')]=_0x8770bc[_0x7a4d('0x4')];this[_0x7a4d('0x5')]=_0x8770bc[_0x7a4d('0x5')]||undefined;this[_0x7a4d('0x6')]=_0x8770bc['type'];this[_0x7a4d('0x7')]=_0x8770bc[_0x7a4d('0x6')]==='outbound'?_0x7a4d('0x8'):_0x8770bc['type'];this[_0x7a4d('0x9')]=_0x8770bc[_0x7a4d('0x9')];this[_0x7a4d('0xa')]=_0x8770bc[_0x7a4d('0xa')];this[_0x7a4d('0xb')]=_0x8770bc[_0x7a4d('0xb')];this['countglobal']=_0x8770bc[_0x7a4d('0x9')]+_0x8770bc[_0x7a4d('0xa')]+_0x8770bc[_0x7a4d('0xb')]+_0x8770bc['countnosuchnumberretry']+_0x8770bc['countdropretry']+_0x8770bc[_0x7a4d('0xc')]+_0x8770bc['countmachineretry']+_0x8770bc[_0x7a4d('0xd')];this[_0x7a4d('0xe')]=_0x8770bc[_0x7a4d('0xe')];this[_0x7a4d('0xf')]=_0x8770bc['countdropretry'];this[_0x7a4d('0xc')]=_0x8770bc[_0x7a4d('0xc')];this[_0x7a4d('0x10')]=_0x8770bc['countmachineretry'];this[_0x7a4d('0xd')]=_0x8770bc['countagentrejectretry'];this[_0x7a4d('0x8')]=_0x8770bc[_0x7a4d('0x8')];this[_0x7a4d('0x11')]=_0x8770bc[_0x7a4d('0x12')];this[_0x7a4d('0x13')]=_0x8770bc[_0x7a4d('0x14')];this[_0x7a4d('0x15')]=_0x8770bc['starttime'];this[_0x7a4d('0x16')]=_0x8770bc['responsetime'];this[_0x7a4d('0x17')]=_0x8770bc[_0x7a4d('0x16')];this[_0x7a4d('0x18')]=getSeconds(_0x8770bc[_0x7a4d('0x16')],_0x8770bc['starttime']);this['holdtime']=0x0;this[_0x7a4d('0x19')]=0x0;this[_0x7a4d('0x1a')]=_0x8770bc[_0x7a4d('0x1a')];this['callbackuniqueid']=_0x8770bc[_0x7a4d('0x1b')];this[_0x7a4d('0x1c')]=_0x8770bc['callbackat'];this['recallme']=_0x8770bc[_0x7a4d('0x1d')];this[_0x7a4d('0x1e')]=_0x8770bc[_0x7a4d('0x1e')];this[_0x7a4d('0x1f')]=_0x8770bc[_0x7a4d('0x1f')];this[_0x7a4d('0x20')]=_0x8770bc['UserId'];this['VoiceQueueId']=_0x8770bc[_0x7a4d('0x21')];this[_0x7a4d('0x22')]=_0x8770bc['CampaignId'];this[_0x7a4d('0x23')]=_0x8770bc['originatecalleridnum']||'';this[_0x7a4d('0x24')]=_0x8770bc['originatecalleridname']||'';}module[_0x7a4d('0x25')]=History; \ No newline at end of file +var _0xb7c2=['originatecalleridnum','originatecalleridname','exports','util','lodash','moment','milliseconds','diff','seconds','uniqueid','scheduledat','type','campaigntype','outbound','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countabandonedretry','countmachineretry','countagentrejectretry','queue','name','calleridnum','number','responsetime','endtime','ringtime','starttime','holdtime','talktime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xb7c2,0x114));var _0x2b7c=function(_0x28cb93,_0x3a63e8){_0x28cb93=_0x28cb93-0x0;var _0xe43116=_0xb7c2[_0x28cb93];return _0xe43116;};'use strict';var util=require(_0x2b7c('0x0'));var _=require(_0x2b7c('0x1'));var moment=require(_0x2b7c('0x2'));function getSeconds(_0x3dd0d8,_0x1de8ae){var _0x25e203=moment(_0x3dd0d8)[_0x2b7c('0x3')](0x0);var _0x2c22b9=moment(_0x1de8ae)[_0x2b7c('0x3')](0x0);return _0x25e203[_0x2b7c('0x4')](_0x2c22b9,_0x2b7c('0x5'));}function AdditionalPhone(_0x387efe){this[_0x2b7c('0x6')]=_0x387efe[_0x2b7c('0x6')];this[_0x2b7c('0x7')]=_0x387efe[_0x2b7c('0x7')]||undefined;this[_0x2b7c('0x8')]=_0x387efe[_0x2b7c('0x8')];this[_0x2b7c('0x9')]=_0x387efe[_0x2b7c('0x8')]===_0x2b7c('0xa')?'queue':_0x387efe[_0x2b7c('0x8')];this[_0x2b7c('0xb')]=_0x387efe[_0x2b7c('0xb')];this[_0x2b7c('0xc')]=_0x387efe[_0x2b7c('0xc')];this[_0x2b7c('0xd')]=_0x387efe[_0x2b7c('0xd')];this['countglobal']=_0x387efe['countbusyretry']+_0x387efe['countcongestionretry']+_0x387efe[_0x2b7c('0xd')]+_0x387efe[_0x2b7c('0xe')]+_0x387efe['countdropretry']+_0x387efe[_0x2b7c('0xf')]+_0x387efe[_0x2b7c('0x10')]+_0x387efe[_0x2b7c('0x11')];this[_0x2b7c('0xe')]=_0x387efe[_0x2b7c('0xe')];this['countdropretry']=_0x387efe['countdropretry'];this[_0x2b7c('0xf')]=_0x387efe[_0x2b7c('0xf')];this[_0x2b7c('0x10')]=_0x387efe[_0x2b7c('0x10')];this[_0x2b7c('0x11')]=_0x387efe[_0x2b7c('0x11')];this['queue']=_0x387efe[_0x2b7c('0x12')];this['calleridname']=_0x387efe[_0x2b7c('0x13')];this[_0x2b7c('0x14')]=_0x387efe[_0x2b7c('0x15')];this['starttime']=_0x387efe['starttime'];this[_0x2b7c('0x16')]=_0x387efe[_0x2b7c('0x16')];this[_0x2b7c('0x17')]=_0x387efe[_0x2b7c('0x16')];this[_0x2b7c('0x18')]=getSeconds(_0x387efe['responsetime'],_0x387efe[_0x2b7c('0x19')]);this[_0x2b7c('0x1a')]=0x0;this[_0x2b7c('0x1b')]=0x0;this[_0x2b7c('0x1c')]=_0x387efe['callback'];this[_0x2b7c('0x1d')]=_0x387efe[_0x2b7c('0x1d')];this[_0x2b7c('0x1e')]=_0x387efe[_0x2b7c('0x1e')];this[_0x2b7c('0x1f')]=_0x387efe[_0x2b7c('0x1f')];this['ContactId']=_0x387efe[_0x2b7c('0x20')];this[_0x2b7c('0x21')]=_0x387efe[_0x2b7c('0x21')];this[_0x2b7c('0x22')]=_0x387efe[_0x2b7c('0x22')];this[_0x2b7c('0x23')]=_0x387efe[_0x2b7c('0x23')];this['CampaignId']=_0x387efe['CampaignId'];this[_0x2b7c('0x24')]=_0x387efe[_0x2b7c('0x24')]||'';this[_0x2b7c('0x25')]=_0x387efe[_0x2b7c('0x25')]||'';}module[_0x2b7c('0x26')]=History; \ No newline at end of file diff --git a/server/services/ami/dialer/agentComplete.js b/server/services/ami/dialer/agentComplete.js index 0d17203..dcf1410 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 _0x9c78=['membername','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','lodash','moment','milliseconds','seconds','state','statedesc','Answer','scheduledat','type','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','uniqueid','calleridname','calleridnum','number','starttime','responsetime','answertime','endtime','format','YYYY-MM-DD\x20HH:mm:ss','holdtime','talktime'];(function(_0x440917,_0x20ea7b){var _0x5e906b=function(_0x27cba5){while(--_0x27cba5){_0x440917['push'](_0x440917['shift']());}};_0x5e906b(++_0x20ea7b);}(_0x9c78,0x1da));var _0x89c7=function(_0x1d2ce2,_0x4e0f33){_0x1d2ce2=_0x1d2ce2-0x0;var _0x3afba0=_0x9c78[_0x1d2ce2];return _0x3afba0;};'use strict';var util=require('util');var _=require(_0x89c7('0x0'));var moment=require(_0x89c7('0x1'));function getSeconds(_0x1f5e5e,_0x15bf6d){var _0x597a38=moment(_0x1f5e5e)[_0x89c7('0x2')](0x0);var _0x4b2aca=moment(_0x15bf6d)[_0x89c7('0x2')](0x0);return _0x597a38['diff'](_0x4b2aca,_0x89c7('0x3'));}function AgentComplete(_0x31b873,_0x5cdbfb){this[_0x89c7('0x4')]=0x4;this[_0x89c7('0x5')]=_0x89c7('0x6');this['scheduledat']=_0x31b873[_0x89c7('0x7')];this[_0x89c7('0x8')]=_0x31b873[_0x89c7('0x8')];this['campaigntype']=_0x31b873[_0x89c7('0x8')]===_0x89c7('0x9')?_0x89c7('0xa'):_0x31b873[_0x89c7('0x8')];this[_0x89c7('0xb')]=_0x31b873[_0x89c7('0xb')];this[_0x89c7('0xc')]=_0x31b873[_0x89c7('0xc')];this['countnoanswerretry']=_0x31b873[_0x89c7('0xd')];this[_0x89c7('0xe')]=_0x31b873[_0x89c7('0xb')]+_0x31b873[_0x89c7('0xc')]+_0x31b873[_0x89c7('0xd')]+_0x31b873[_0x89c7('0xf')]+_0x31b873[_0x89c7('0x10')]+_0x31b873[_0x89c7('0x11')]+_0x31b873[_0x89c7('0x12')]+_0x31b873[_0x89c7('0x13')];this[_0x89c7('0xf')]=_0x31b873[_0x89c7('0xf')];this[_0x89c7('0x10')]=_0x31b873[_0x89c7('0x10')];this['countabandonedretry']=_0x31b873[_0x89c7('0x11')];this[_0x89c7('0x12')]=_0x31b873['countmachineretry'];this[_0x89c7('0x13')]=_0x31b873[_0x89c7('0x13')];this[_0x89c7('0x14')]=_0x5cdbfb[_0x89c7('0x14')];this[_0x89c7('0x15')]=_0x31b873['name'];this[_0x89c7('0x16')]=_0x31b873[_0x89c7('0x17')];this['starttime']=_0x31b873[_0x89c7('0x18')];this[_0x89c7('0x19')]=_0x31b873['responsetime'];this[_0x89c7('0x1a')]=_0x31b873[_0x89c7('0x1a')];this[_0x89c7('0x1b')]=moment()[_0x89c7('0x1c')](_0x89c7('0x1d'));this['ringtime']=getSeconds(_0x31b873[_0x89c7('0x19')],_0x31b873[_0x89c7('0x18')]);this[_0x89c7('0x1e')]=getSeconds(_0x31b873[_0x89c7('0x1a')],_0x31b873[_0x89c7('0x19')]);this[_0x89c7('0x1f')]=getSeconds(this[_0x89c7('0x1b')],_0x31b873[_0x89c7('0x1a')]);this['queue']=_0x5cdbfb[_0x89c7('0xa')];this[_0x89c7('0x20')]=_0x5cdbfb['membername'];this[_0x89c7('0x21')]=_0x5cdbfb['reason'];this[_0x89c7('0x22')]=_0x31b873['callback'];this[_0x89c7('0x23')]=_0x31b873[_0x89c7('0x23')];this[_0x89c7('0x24')]=_0x31b873[_0x89c7('0x24')];this[_0x89c7('0x25')]=_0x31b873['recallme'];this[_0x89c7('0x26')]=_0x31b873[_0x89c7('0x26')];this[_0x89c7('0x27')]=_0x31b873[_0x89c7('0x27')];this[_0x89c7('0x28')]=_0x31b873[_0x89c7('0x28')];this[_0x89c7('0x29')]=_0x31b873[_0x89c7('0x29')];this[_0x89c7('0x2a')]=_0x31b873[_0x89c7('0x2a')];this['originatecalleridnum']=_0x31b873[_0x89c7('0x2b')]||'';this[_0x89c7('0x2c')]=_0x31b873[_0x89c7('0x2c')]||'';}module[_0x89c7('0x2d')]=AgentComplete; \ No newline at end of file +var _0x3a2d=['countbusyretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','uniqueid','calleridnum','number','starttime','responsetime','answertime','format','ringtime','holdtime','talktime','endtime','membername','reason','callback','callbackuniqueid','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','lodash','milliseconds','diff','seconds','state','statedesc','Answer','scheduledat','type','campaigntype','outbound','queue','countcongestionretry','countnoanswerretry'];(function(_0x1dee76,_0x145b16){var _0x41ab9a=function(_0x356ea8){while(--_0x356ea8){_0x1dee76['push'](_0x1dee76['shift']());}};_0x41ab9a(++_0x145b16);}(_0x3a2d,0x76));var _0xd3a2=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3a2d[_0x3dd15e];return _0x231fd0;};'use strict';var util=require('util');var _=require(_0xd3a2('0x0'));var moment=require('moment');function getSeconds(_0x448c1e,_0x1d4c5e){var _0x3ed309=moment(_0x448c1e)['milliseconds'](0x0);var _0x277aac=moment(_0x1d4c5e)[_0xd3a2('0x1')](0x0);return _0x3ed309[_0xd3a2('0x2')](_0x277aac,_0xd3a2('0x3'));}function AgentComplete(_0x1b8119,_0x3fbd6f){this[_0xd3a2('0x4')]=0x4;this[_0xd3a2('0x5')]=_0xd3a2('0x6');this[_0xd3a2('0x7')]=_0x1b8119['scheduledat'];this[_0xd3a2('0x8')]=_0x1b8119[_0xd3a2('0x8')];this[_0xd3a2('0x9')]=_0x1b8119[_0xd3a2('0x8')]===_0xd3a2('0xa')?_0xd3a2('0xb'):_0x1b8119[_0xd3a2('0x8')];this['countbusyretry']=_0x1b8119['countbusyretry'];this[_0xd3a2('0xc')]=_0x1b8119[_0xd3a2('0xc')];this[_0xd3a2('0xd')]=_0x1b8119[_0xd3a2('0xd')];this['countglobal']=_0x1b8119[_0xd3a2('0xe')]+_0x1b8119[_0xd3a2('0xc')]+_0x1b8119[_0xd3a2('0xd')]+_0x1b8119[_0xd3a2('0xf')]+_0x1b8119[_0xd3a2('0x10')]+_0x1b8119[_0xd3a2('0x11')]+_0x1b8119[_0xd3a2('0x12')]+_0x1b8119['countagentrejectretry'];this[_0xd3a2('0xf')]=_0x1b8119[_0xd3a2('0xf')];this[_0xd3a2('0x10')]=_0x1b8119[_0xd3a2('0x10')];this[_0xd3a2('0x11')]=_0x1b8119[_0xd3a2('0x11')];this[_0xd3a2('0x12')]=_0x1b8119[_0xd3a2('0x12')];this['countagentrejectretry']=_0x1b8119[_0xd3a2('0x13')];this[_0xd3a2('0x14')]=_0x3fbd6f[_0xd3a2('0x14')];this['calleridname']=_0x1b8119['name'];this[_0xd3a2('0x15')]=_0x1b8119[_0xd3a2('0x16')];this['starttime']=_0x1b8119[_0xd3a2('0x17')];this[_0xd3a2('0x18')]=_0x1b8119[_0xd3a2('0x18')];this['answertime']=_0x1b8119[_0xd3a2('0x19')];this['endtime']=moment()[_0xd3a2('0x1a')]('YYYY-MM-DD\x20HH:mm:ss');this[_0xd3a2('0x1b')]=getSeconds(_0x1b8119['responsetime'],_0x1b8119['starttime']);this[_0xd3a2('0x1c')]=getSeconds(_0x1b8119[_0xd3a2('0x19')],_0x1b8119[_0xd3a2('0x18')]);this[_0xd3a2('0x1d')]=getSeconds(this[_0xd3a2('0x1e')],_0x1b8119[_0xd3a2('0x19')]);this['queue']=_0x3fbd6f['queue'];this[_0xd3a2('0x1f')]=_0x3fbd6f[_0xd3a2('0x1f')];this[_0xd3a2('0x20')]=_0x3fbd6f[_0xd3a2('0x20')];this['callback']=_0x1b8119[_0xd3a2('0x21')];this[_0xd3a2('0x22')]=_0x1b8119[_0xd3a2('0x22')];this['callbackat']=_0x1b8119['callbackat'];this[_0xd3a2('0x23')]=_0x1b8119[_0xd3a2('0x23')];this[_0xd3a2('0x24')]=_0x1b8119[_0xd3a2('0x24')];this[_0xd3a2('0x25')]=_0x1b8119[_0xd3a2('0x25')];this[_0xd3a2('0x26')]=_0x1b8119[_0xd3a2('0x26')];this[_0xd3a2('0x27')]=_0x1b8119[_0xd3a2('0x27')];this[_0xd3a2('0x28')]=_0x1b8119[_0xd3a2('0x28')];this[_0xd3a2('0x29')]=_0x1b8119[_0xd3a2('0x29')]||'';this['originatecalleridname']=_0x1b8119[_0xd3a2('0x2a')]||'';}module[_0xd3a2('0x2b')]=AgentComplete; \ No newline at end of file diff --git a/server/services/ami/dialer/final.js b/server/services/ami/dialer/final.js index 4c0acf2..d3c3bb5 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 _0x1b1f=['responsetime','endtime','ringtime','holdtime','talktime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','util','lodash','moment','milliseconds','diff','seconds','uniqueid','scheduledat','type','campaigntype','outbound','countcongestionretry','countnoanswerretry','countglobal','countbusyretry','countnosuchnumberretry','countdropretry','countmachineretry','countagentrejectretry','countabandonedretry','queue','calleridname','calleridnum','starttime'];(function(_0xbc544b,_0xda1fbb){var _0x3a507e=function(_0x5ba812){while(--_0x5ba812){_0xbc544b['push'](_0xbc544b['shift']());}};_0x3a507e(++_0xda1fbb);}(_0x1b1f,0x128));var _0xf1b1=function(_0x181067,_0x1be5b1){_0x181067=_0x181067-0x0;var _0x25f99b=_0x1b1f[_0x181067];return _0x25f99b;};'use strict';var util=require(_0xf1b1('0x0'));var _=require(_0xf1b1('0x1'));var moment=require(_0xf1b1('0x2'));function getSeconds(_0x4542e8,_0x3bf816){var _0x5baa66=moment(_0x4542e8)[_0xf1b1('0x3')](0x0);var _0x47968e=moment(_0x3bf816)['milliseconds'](0x0);return _0x5baa66[_0xf1b1('0x4')](_0x47968e,_0xf1b1('0x5'));}function Final(_0x5184e5){this[_0xf1b1('0x6')]=_0x5184e5[_0xf1b1('0x6')];this[_0xf1b1('0x7')]=_0x5184e5[_0xf1b1('0x7')];this[_0xf1b1('0x8')]=_0x5184e5[_0xf1b1('0x8')];this[_0xf1b1('0x9')]=_0x5184e5['type']===_0xf1b1('0xa')?'queue':_0x5184e5[_0xf1b1('0x8')];this['countbusyretry']=_0x5184e5['countbusyretry'];this['countcongestionretry']=_0x5184e5[_0xf1b1('0xb')];this[_0xf1b1('0xc')]=_0x5184e5[_0xf1b1('0xc')];this[_0xf1b1('0xd')]=_0x5184e5[_0xf1b1('0xe')]+_0x5184e5[_0xf1b1('0xb')]+_0x5184e5[_0xf1b1('0xc')]+_0x5184e5[_0xf1b1('0xf')]+_0x5184e5[_0xf1b1('0x10')]+_0x5184e5['countabandonedretry']+_0x5184e5[_0xf1b1('0x11')]+_0x5184e5[_0xf1b1('0x12')];this['countnosuchnumberretry']=_0x5184e5['countnosuchnumberretry'];this[_0xf1b1('0x10')]=_0x5184e5[_0xf1b1('0x10')];this['countabandonedretry']=_0x5184e5[_0xf1b1('0x13')];this[_0xf1b1('0x11')]=_0x5184e5[_0xf1b1('0x11')];this[_0xf1b1('0x12')]=_0x5184e5[_0xf1b1('0x12')];this[_0xf1b1('0x14')]=_0x5184e5['queue'];this[_0xf1b1('0x15')]=_0x5184e5[_0xf1b1('0x15')];this[_0xf1b1('0x16')]=_0x5184e5['calleridnum'];this[_0xf1b1('0x17')]=_0x5184e5[_0xf1b1('0x17')];this[_0xf1b1('0x18')]=_0x5184e5[_0xf1b1('0x18')];this[_0xf1b1('0x19')]=_0x5184e5[_0xf1b1('0x18')];this[_0xf1b1('0x1a')]=_0x5184e5[_0xf1b1('0x1a')]||0x0;this[_0xf1b1('0x1b')]=_0x5184e5[_0xf1b1('0x1b')]||0x0;this[_0xf1b1('0x1c')]=_0x5184e5['talktime']||0x0;this['callback']=_0x5184e5[_0xf1b1('0x1d')];this[_0xf1b1('0x1e')]=_0x5184e5[_0xf1b1('0x1e')];this[_0xf1b1('0x1f')]=_0x5184e5['callbackat'];this[_0xf1b1('0x20')]=_0x5184e5[_0xf1b1('0x20')];this[_0xf1b1('0x21')]=_0x5184e5[_0xf1b1('0x21')];this[_0xf1b1('0x22')]=_0x5184e5[_0xf1b1('0x22')];this['UserId']=_0x5184e5['UserId'];this[_0xf1b1('0x23')]=_0x5184e5[_0xf1b1('0x23')];this[_0xf1b1('0x24')]=_0x5184e5['CampaignId'];this[_0xf1b1('0x25')]=_0x5184e5[_0xf1b1('0x25')]||'';this[_0xf1b1('0x26')]=_0x5184e5['originatecalleridname']||'';}module[_0xf1b1('0x27')]=Final; \ No newline at end of file +var _0xbc4c=['type','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','calleridname','calleridnum','starttime','responsetime','holdtime','talktime','callback','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','util','moment','milliseconds','diff','seconds','uniqueid','scheduledat'];(function(_0x5c0e95,_0x4d0c46){var _0x5e6279=function(_0x52505a){while(--_0x52505a){_0x5c0e95['push'](_0x5c0e95['shift']());}};_0x5e6279(++_0x4d0c46);}(_0xbc4c,0xee));var _0xcbc4=function(_0x9e0cb3,_0x9cd497){_0x9e0cb3=_0x9e0cb3-0x0;var _0x5926b7=_0xbc4c[_0x9e0cb3];return _0x5926b7;};'use strict';var util=require(_0xcbc4('0x0'));var _=require('lodash');var moment=require(_0xcbc4('0x1'));function getSeconds(_0x119122,_0x350d4e){var _0x2a22fd=moment(_0x119122)['milliseconds'](0x0);var _0x536331=moment(_0x350d4e)[_0xcbc4('0x2')](0x0);return _0x2a22fd[_0xcbc4('0x3')](_0x536331,_0xcbc4('0x4'));}function Final(_0x37e646){this[_0xcbc4('0x5')]=_0x37e646[_0xcbc4('0x5')];this['scheduledat']=_0x37e646[_0xcbc4('0x6')];this[_0xcbc4('0x7')]=_0x37e646[_0xcbc4('0x7')];this['campaigntype']=_0x37e646['type']===_0xcbc4('0x8')?_0xcbc4('0x9'):_0x37e646[_0xcbc4('0x7')];this[_0xcbc4('0xa')]=_0x37e646[_0xcbc4('0xa')];this[_0xcbc4('0xb')]=_0x37e646[_0xcbc4('0xb')];this[_0xcbc4('0xc')]=_0x37e646['countnoanswerretry'];this[_0xcbc4('0xd')]=_0x37e646[_0xcbc4('0xa')]+_0x37e646['countcongestionretry']+_0x37e646['countnoanswerretry']+_0x37e646[_0xcbc4('0xe')]+_0x37e646[_0xcbc4('0xf')]+_0x37e646[_0xcbc4('0x10')]+_0x37e646[_0xcbc4('0x11')]+_0x37e646[_0xcbc4('0x12')];this[_0xcbc4('0xe')]=_0x37e646[_0xcbc4('0xe')];this[_0xcbc4('0xf')]=_0x37e646[_0xcbc4('0xf')];this['countabandonedretry']=_0x37e646[_0xcbc4('0x10')];this[_0xcbc4('0x11')]=_0x37e646[_0xcbc4('0x11')];this[_0xcbc4('0x12')]=_0x37e646['countagentrejectretry'];this[_0xcbc4('0x9')]=_0x37e646['queue'];this[_0xcbc4('0x13')]=_0x37e646[_0xcbc4('0x13')];this[_0xcbc4('0x14')]=_0x37e646['calleridnum'];this[_0xcbc4('0x15')]=_0x37e646['starttime'];this[_0xcbc4('0x16')]=_0x37e646[_0xcbc4('0x16')];this['endtime']=_0x37e646[_0xcbc4('0x16')];this['ringtime']=_0x37e646['ringtime']||0x0;this['holdtime']=_0x37e646[_0xcbc4('0x17')]||0x0;this[_0xcbc4('0x18')]=_0x37e646[_0xcbc4('0x18')]||0x0;this['callback']=_0x37e646[_0xcbc4('0x19')];this['callbackuniqueid']=_0x37e646['callbackuniqueid'];this['callbackat']=_0x37e646[_0xcbc4('0x1a')];this['recallme']=_0x37e646[_0xcbc4('0x1b')];this[_0xcbc4('0x1c')]=_0x37e646[_0xcbc4('0x1c')];this[_0xcbc4('0x1d')]=_0x37e646['ListId'];this['UserId']=_0x37e646[_0xcbc4('0x1e')];this[_0xcbc4('0x1f')]=_0x37e646['VoiceQueueId'];this[_0xcbc4('0x20')]=_0x37e646[_0xcbc4('0x20')];this[_0xcbc4('0x21')]=_0x37e646['originatecalleridnum']||'';this[_0xcbc4('0x22')]=_0x37e646[_0xcbc4('0x22')]||'';}module['exports']=Final; \ No newline at end of file diff --git a/server/services/ami/dialer/hangup.js b/server/services/ami/dialer/hangup.js index 3ecf0ee..f860728 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 _0x55f8=['countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','calleridname','number','starttime','responsetime','endtime','format','ringtime','holdtime','membername','IVR','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','exports','util','lodash','moment','seconds','state','Answer','scheduledat','type','campaigntype','queue','countbusyretry','countnoanswerretry','countnosuchnumberretry'];(function(_0x546033,_0x5b7e36){var _0x393c71=function(_0x1ad8f9){while(--_0x1ad8f9){_0x546033['push'](_0x546033['shift']());}};_0x393c71(++_0x5b7e36);}(_0x55f8,0x1e1));var _0x855f=function(_0x4e8b59,_0x2207ff){_0x4e8b59=_0x4e8b59-0x0;var _0x41de06=_0x55f8[_0x4e8b59];return _0x41de06;};'use strict';var util=require(_0x855f('0x0'));var _=require(_0x855f('0x1'));var moment=require(_0x855f('0x2'));function getSeconds(_0x18b6ef,_0x4132cd){var _0x2c7926=moment(_0x18b6ef)['milliseconds'](0x0);var _0x334641=moment(_0x4132cd)['milliseconds'](0x0);return _0x2c7926['diff'](_0x334641,_0x855f('0x3'));}function Hangup(_0x257d89,_0x1cbea5){this[_0x855f('0x4')]=0x4;this['statedesc']=_0x855f('0x5');this[_0x855f('0x6')]=_0x257d89[_0x855f('0x6')];this[_0x855f('0x7')]=_0x257d89[_0x855f('0x7')];this[_0x855f('0x8')]=_0x257d89[_0x855f('0x7')]==='outbound'?_0x855f('0x9'):_0x257d89[_0x855f('0x7')];this['countbusyretry']=_0x257d89[_0x855f('0xa')];this['countcongestionretry']=_0x257d89['countcongestionretry'];this[_0x855f('0xb')]=_0x257d89[_0x855f('0xb')];this['countglobal']=_0x257d89[_0x855f('0xa')]+_0x257d89['countcongestionretry']+_0x257d89['countnoanswerretry']+_0x257d89[_0x855f('0xc')]+_0x257d89[_0x855f('0xd')]+_0x257d89[_0x855f('0xe')]+_0x257d89[_0x855f('0xf')]+_0x257d89['countagentrejectretry'];this[_0x855f('0xc')]=_0x257d89[_0x855f('0xc')];this[_0x855f('0xd')]=_0x257d89[_0x855f('0xd')];this[_0x855f('0xe')]=_0x257d89['countabandonedretry'];this[_0x855f('0xf')]=_0x257d89[_0x855f('0xf')];this[_0x855f('0x10')]=_0x257d89[_0x855f('0x10')];this['uniqueid']=_0x1cbea5['uniqueid'];this[_0x855f('0x11')]=_0x257d89['name'];this['calleridnum']=_0x257d89[_0x855f('0x12')];this[_0x855f('0x13')]=_0x257d89[_0x855f('0x13')];this[_0x855f('0x14')]=_0x257d89[_0x855f('0x14')];this[_0x855f('0x15')]=moment()[_0x855f('0x16')]('YYYY-MM-DD\x20HH:mm:ss');this[_0x855f('0x17')]=getSeconds(_0x257d89[_0x855f('0x14')],_0x257d89[_0x855f('0x13')]);this[_0x855f('0x18')]=0x0;this['talktime']=getSeconds(this[_0x855f('0x15')],_0x257d89[_0x855f('0x14')]);this[_0x855f('0x9')]=_0x257d89[_0x855f('0x9')];this[_0x855f('0x19')]=_0x855f('0x1a');this[_0x855f('0x1b')]=_0x1cbea5['cause-txt'];this[_0x855f('0x1c')]=_0x257d89[_0x855f('0x1c')];this[_0x855f('0x1d')]=_0x257d89[_0x855f('0x1d')];this[_0x855f('0x1e')]=_0x257d89[_0x855f('0x1e')];this[_0x855f('0x1f')]=_0x257d89[_0x855f('0x1f')];this['ContactId']=_0x257d89[_0x855f('0x20')];this[_0x855f('0x21')]=_0x257d89[_0x855f('0x21')];this[_0x855f('0x22')]=_0x257d89[_0x855f('0x22')];this[_0x855f('0x23')]=_0x257d89[_0x855f('0x23')];this[_0x855f('0x24')]=_0x257d89[_0x855f('0x24')];}module[_0x855f('0x25')]=Hangup; \ No newline at end of file +var _0x4090=['campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countagentrejectretry','countmachineretry','uniqueid','calleridname','calleridnum','number','starttime','responsetime','endtime','format','ringtime','holdtime','membername','IVR','cause-txt','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','util','lodash','moment','milliseconds','diff','seconds','state','statedesc','Answer','scheduledat','type'];(function(_0x5afa04,_0x2221ed){var _0x2ac04e=function(_0x32c963){while(--_0x32c963){_0x5afa04['push'](_0x5afa04['shift']());}};_0x2ac04e(++_0x2221ed);}(_0x4090,0x1e4));var _0x0409=function(_0x31b7b6,_0x164709){_0x31b7b6=_0x31b7b6-0x0;var _0x1408bb=_0x4090[_0x31b7b6];return _0x1408bb;};'use strict';var util=require(_0x0409('0x0'));var _=require(_0x0409('0x1'));var moment=require(_0x0409('0x2'));function getSeconds(_0x56d38b,_0x23449f){var _0x214a01=moment(_0x56d38b)[_0x0409('0x3')](0x0);var _0x153c95=moment(_0x23449f)[_0x0409('0x3')](0x0);return _0x214a01[_0x0409('0x4')](_0x153c95,_0x0409('0x5'));}function Hangup(_0x166848,_0x28ee7a){this[_0x0409('0x6')]=0x4;this[_0x0409('0x7')]=_0x0409('0x8');this['scheduledat']=_0x166848[_0x0409('0x9')];this[_0x0409('0xa')]=_0x166848[_0x0409('0xa')];this[_0x0409('0xb')]=_0x166848['type']===_0x0409('0xc')?_0x0409('0xd'):_0x166848[_0x0409('0xa')];this['countbusyretry']=_0x166848[_0x0409('0xe')];this[_0x0409('0xf')]=_0x166848[_0x0409('0xf')];this[_0x0409('0x10')]=_0x166848[_0x0409('0x10')];this[_0x0409('0x11')]=_0x166848[_0x0409('0xe')]+_0x166848['countcongestionretry']+_0x166848[_0x0409('0x10')]+_0x166848[_0x0409('0x12')]+_0x166848[_0x0409('0x13')]+_0x166848[_0x0409('0x14')]+_0x166848['countmachineretry']+_0x166848[_0x0409('0x15')];this['countnosuchnumberretry']=_0x166848[_0x0409('0x12')];this[_0x0409('0x13')]=_0x166848[_0x0409('0x13')];this[_0x0409('0x14')]=_0x166848['countabandonedretry'];this[_0x0409('0x16')]=_0x166848['countmachineretry'];this[_0x0409('0x15')]=_0x166848[_0x0409('0x15')];this[_0x0409('0x17')]=_0x28ee7a[_0x0409('0x17')];this[_0x0409('0x18')]=_0x166848['name'];this[_0x0409('0x19')]=_0x166848[_0x0409('0x1a')];this[_0x0409('0x1b')]=_0x166848[_0x0409('0x1b')];this[_0x0409('0x1c')]=_0x166848['responsetime'];this[_0x0409('0x1d')]=moment()[_0x0409('0x1e')]('YYYY-MM-DD\x20HH:mm:ss');this[_0x0409('0x1f')]=getSeconds(_0x166848[_0x0409('0x1c')],_0x166848[_0x0409('0x1b')]);this[_0x0409('0x20')]=0x0;this['talktime']=getSeconds(this[_0x0409('0x1d')],_0x166848[_0x0409('0x1c')]);this[_0x0409('0xd')]=_0x166848[_0x0409('0xd')];this[_0x0409('0x21')]=_0x0409('0x22');this['reason']=_0x28ee7a[_0x0409('0x23')];this[_0x0409('0x24')]=_0x166848[_0x0409('0x24')];this[_0x0409('0x25')]=_0x166848[_0x0409('0x25')];this[_0x0409('0x26')]=_0x166848[_0x0409('0x26')];this[_0x0409('0x27')]=_0x166848[_0x0409('0x27')];this[_0x0409('0x28')]=_0x166848[_0x0409('0x28')];this['ListId']=_0x166848[_0x0409('0x29')];this[_0x0409('0x2a')]=_0x166848[_0x0409('0x2a')];this[_0x0409('0x2b')]=_0x166848[_0x0409('0x2b')];this['CampaignId']=_0x166848[_0x0409('0x2c')];}module['exports']=Hangup; \ No newline at end of file diff --git a/server/services/ami/dialer/history.js b/server/services/ami/dialer/history.js index 16335fc..81c6b44 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 _0x5e67=['outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','calleridname','name','calleridnum','number','starttime','responsetime','endtime','ringtime','holdtime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','util','lodash','moment','milliseconds','diff','seconds','type','campaigntype'];(function(_0x1bc762,_0x523eb3){var _0x40f70c=function(_0x3c206e){while(--_0x3c206e){_0x1bc762['push'](_0x1bc762['shift']());}};_0x40f70c(++_0x523eb3);}(_0x5e67,0x70));var _0x75e6=function(_0x36f6b3,_0xfc71a6){_0x36f6b3=_0x36f6b3-0x0;var _0x4983d3=_0x5e67[_0x36f6b3];return _0x4983d3;};'use strict';var util=require(_0x75e6('0x0'));var _=require(_0x75e6('0x1'));var moment=require(_0x75e6('0x2'));function getSeconds(_0x307d03,_0x2f7528){var _0x2d5d89=moment(_0x307d03)[_0x75e6('0x3')](0x0);var _0x2f3320=moment(_0x2f7528)[_0x75e6('0x3')](0x0);return _0x2d5d89[_0x75e6('0x4')](_0x2f3320,_0x75e6('0x5'));}function History(_0x172f8a){this['uniqueid']=_0x172f8a['uniqueid'];this['scheduledat']=_0x172f8a['scheduledat']||undefined;this[_0x75e6('0x6')]=_0x172f8a['type'];this[_0x75e6('0x7')]=_0x172f8a[_0x75e6('0x6')]===_0x75e6('0x8')?_0x75e6('0x9'):_0x172f8a['type'];this[_0x75e6('0xa')]=_0x172f8a[_0x75e6('0xa')];this[_0x75e6('0xb')]=_0x172f8a['countcongestionretry'];this['countnoanswerretry']=_0x172f8a[_0x75e6('0xc')];this[_0x75e6('0xd')]=_0x172f8a['countbusyretry']+_0x172f8a['countcongestionretry']+_0x172f8a[_0x75e6('0xc')]+_0x172f8a[_0x75e6('0xe')]+_0x172f8a[_0x75e6('0xf')]+_0x172f8a[_0x75e6('0x10')]+_0x172f8a[_0x75e6('0x11')]+_0x172f8a[_0x75e6('0x12')];this[_0x75e6('0xe')]=_0x172f8a[_0x75e6('0xe')];this['countdropretry']=_0x172f8a[_0x75e6('0xf')];this[_0x75e6('0x10')]=_0x172f8a[_0x75e6('0x10')];this[_0x75e6('0x11')]=_0x172f8a['countmachineretry'];this[_0x75e6('0x12')]=_0x172f8a[_0x75e6('0x12')];this['queue']=_0x172f8a['queue'];this[_0x75e6('0x13')]=_0x172f8a[_0x75e6('0x14')];this[_0x75e6('0x15')]=_0x172f8a[_0x75e6('0x16')];this[_0x75e6('0x17')]=_0x172f8a[_0x75e6('0x17')];this[_0x75e6('0x18')]=_0x172f8a['responsetime'];this[_0x75e6('0x19')]=_0x172f8a[_0x75e6('0x18')];this[_0x75e6('0x1a')]=getSeconds(_0x172f8a['responsetime'],_0x172f8a[_0x75e6('0x17')]);this[_0x75e6('0x1b')]=0x0;this['talktime']=0x0;this[_0x75e6('0x1c')]=_0x172f8a[_0x75e6('0x1c')];this['callbackuniqueid']=_0x172f8a[_0x75e6('0x1d')];this[_0x75e6('0x1e')]=_0x172f8a['callbackat'];this[_0x75e6('0x1f')]=_0x172f8a[_0x75e6('0x1f')];this[_0x75e6('0x20')]=_0x172f8a['ContactId'];this[_0x75e6('0x21')]=_0x172f8a[_0x75e6('0x21')];this[_0x75e6('0x22')]=_0x172f8a[_0x75e6('0x22')];this[_0x75e6('0x23')]=_0x172f8a[_0x75e6('0x23')];this[_0x75e6('0x24')]=_0x172f8a[_0x75e6('0x24')];this[_0x75e6('0x25')]=_0x172f8a[_0x75e6('0x25')]||'';this[_0x75e6('0x26')]=_0x172f8a[_0x75e6('0x26')]||'';}module[_0x75e6('0x27')]=History; \ No newline at end of file +var _0x19b9=['number','starttime','responsetime','endtime','ringtime','holdtime','talktime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','util','lodash','moment','milliseconds','diff','seconds','type','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countagentrejectretry','countmachineretry','calleridname','calleridnum'];(function(_0x2a40b2,_0x35c0c1){var _0x6c4056=function(_0xa1a401){while(--_0xa1a401){_0x2a40b2['push'](_0x2a40b2['shift']());}};_0x6c4056(++_0x35c0c1);}(_0x19b9,0x169));var _0x919b=function(_0x583f82,_0xf23fcd){_0x583f82=_0x583f82-0x0;var _0x710688=_0x19b9[_0x583f82];return _0x710688;};'use strict';var util=require(_0x919b('0x0'));var _=require(_0x919b('0x1'));var moment=require(_0x919b('0x2'));function getSeconds(_0x42045b,_0x2c3320){var _0x541a61=moment(_0x42045b)[_0x919b('0x3')](0x0);var _0xaa0ab=moment(_0x2c3320)[_0x919b('0x3')](0x0);return _0x541a61[_0x919b('0x4')](_0xaa0ab,_0x919b('0x5'));}function History(_0x47e9c5){this['uniqueid']=_0x47e9c5['uniqueid'];this['scheduledat']=_0x47e9c5['scheduledat']||undefined;this['type']=_0x47e9c5[_0x919b('0x6')];this['campaigntype']=_0x47e9c5['type']===_0x919b('0x7')?_0x919b('0x8'):_0x47e9c5[_0x919b('0x6')];this[_0x919b('0x9')]=_0x47e9c5[_0x919b('0x9')];this[_0x919b('0xa')]=_0x47e9c5[_0x919b('0xa')];this[_0x919b('0xb')]=_0x47e9c5['countnoanswerretry'];this['countglobal']=_0x47e9c5[_0x919b('0x9')]+_0x47e9c5[_0x919b('0xa')]+_0x47e9c5[_0x919b('0xb')]+_0x47e9c5[_0x919b('0xc')]+_0x47e9c5[_0x919b('0xd')]+_0x47e9c5[_0x919b('0xe')]+_0x47e9c5['countmachineretry']+_0x47e9c5[_0x919b('0xf')];this[_0x919b('0xc')]=_0x47e9c5['countnosuchnumberretry'];this[_0x919b('0xd')]=_0x47e9c5[_0x919b('0xd')];this[_0x919b('0xe')]=_0x47e9c5[_0x919b('0xe')];this[_0x919b('0x10')]=_0x47e9c5[_0x919b('0x10')];this[_0x919b('0xf')]=_0x47e9c5[_0x919b('0xf')];this[_0x919b('0x8')]=_0x47e9c5[_0x919b('0x8')];this[_0x919b('0x11')]=_0x47e9c5['name'];this[_0x919b('0x12')]=_0x47e9c5[_0x919b('0x13')];this[_0x919b('0x14')]=_0x47e9c5[_0x919b('0x14')];this[_0x919b('0x15')]=_0x47e9c5[_0x919b('0x15')];this[_0x919b('0x16')]=_0x47e9c5['responsetime'];this[_0x919b('0x17')]=getSeconds(_0x47e9c5[_0x919b('0x15')],_0x47e9c5['starttime']);this[_0x919b('0x18')]=0x0;this[_0x919b('0x19')]=0x0;this[_0x919b('0x1a')]=_0x47e9c5[_0x919b('0x1a')];this[_0x919b('0x1b')]=_0x47e9c5['callbackuniqueid'];this[_0x919b('0x1c')]=_0x47e9c5[_0x919b('0x1c')];this[_0x919b('0x1d')]=_0x47e9c5[_0x919b('0x1d')];this[_0x919b('0x1e')]=_0x47e9c5[_0x919b('0x1e')];this[_0x919b('0x1f')]=_0x47e9c5[_0x919b('0x1f')];this[_0x919b('0x20')]=_0x47e9c5['UserId'];this[_0x919b('0x21')]=_0x47e9c5[_0x919b('0x21')];this['CampaignId']=_0x47e9c5[_0x919b('0x22')];this['originatecalleridnum']=_0x47e9c5[_0x919b('0x23')]||'';this[_0x919b('0x24')]=_0x47e9c5['originatecalleridname']||'';}module[_0x919b('0x25')]=History; \ No newline at end of file diff --git a/server/services/ami/dialer/index.js b/server/services/ami/dialer/index.js index c36259c..f4823ed 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 _0x580a=['syncCampaigns','checkIsTrunkReachable','TrunkBackup','TRUNK_IS_NOT_REACHABLE','\x20trunk\x20is\x20not\x20reachable','checkIfTime','ifTime','Failure','\x20Intervals\x20is\x20null\x20','\x20Intervals\x20is\x20empty\x20','command','iftime\x20%s,%s','timezones','content','indexOf','true','some','GLOBAL_INTERVAL_IS_OVERTIME','[ifTime][promiseAll]','Global:\x20','\x20Interval\x20is\x20overtime:\x20','Timezone:\x20','checkDialMethod','dialMethod','progressive','dialPowerLevel','predictive','handlePower','Queue','method\x20not\x20recognized','launchHandleIvr','handleIvr','dialTimezone','checkIfTimeIntervals','[syncQueueSummary]','dialGlobalInterval','[syncCampaigns]','\x5cw{0,','pow','replace','random','match','object','originate','Contact','phone','getCaller','\x22agi://%s/square,%s\x22','dialQueueOptions','dialAgiAfterHangupAgent','NONE','XMD-AMDINITIALSILENCE','XMD-AMDGREETING','dialAMDGreeting','XMD-AMDAFTERGREETINGSILENCE','dialAMDTotalAnalysisTime','XMD-AMDMINWORDLENGTH','dialAMDMinWordLength','XMD-AMDBETWEENWORDSSILENCE','dialAMDBetweenWordsSilence','XMD-AMDSILENCETHRESHOLD','dialAMDSilenceThreshold','XMD-AMDMAXIMUMWORDLENGTH','dialAMDMaximumWordLength','XMD-CAMPAIGNID','updatedAt','XMD-','toUpper','dialRandomLastDigitCallerIdNumber','XMD-ORIGINATECALLERIDNAME','originatecalleridname','originatecalleridnum','SIP/%s/%s%s','dialPrefix','trim','dialCutDigit','substring','from-sip','[originateError]:\x20%s','OriginateError','[originate][error]','responsetime','response','[callProgressDetecting]\x20','checkRetriveMax','dialNoAnswerMaxRetry','[rescheduleContact][NoAnswer]','dialBusyMaxRetry','dialBusyRetryFrequency','dialCongestionMaxRetry','[rescheduleContact]\x20[Congestion]','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','[rescheduleContact][Drop]','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','[rescheduleContact][AgentReject]','callProgressDetecting','[callProgressDetecting]','evt\x20is\x20undefine','custom:agentnosuchnumber','stateGlobal','reason\x200\x20no\x20such\x20number....','buildObj','noanswer','[syncAgentComplete][createHistory][3]','outboundBusyCallsDay','Busy','custom:agentbusy','busy','[syncAgentComplete][createHistory][5]','reason\x205\x20busy','Congestion','custom:agentcongestion','congestion','reason\x208\x20congestion','outboundAbandonedCallsDay','[syncAgentComplete][createHistory][11]','reason\x2011\x20abandoned','custom:agentreject','agentreject','[syncAgentComplete][createHistory][20]','reason\x2020\x20agentreject','reason','[syncAgentComplete][createHistory][?]','Global','[moveContactManagedDialer][0]','contact\x20not\x20moved','dialPredictiveOptimizationPercentage','round','predictiveIntervalMaxThreshold','predictiveIntervalMinThreshold','floor','[startMethodPredictive][StartProgressive]','check\x20handlePredictive\x20is\x20not\x20undefine','collection\x20data\x20in\x20progressive\x20at','dialPredictiveInterval','[startMethodPredictive][StartProgressive][Loop]','dialPredictiveOptimization','dropRate','[stopMethodPredictive][ReStartProgressive][ExceededDropInterval]','Max\x20Drop\x20','Drop\x20in\x20this\x20interval','startMethodPredictive','Predictive\x20after\x20first\x20interval','recalculate\x20predictive\x20at','getDataPredictive','Predictive\x20for\x20every\x20interval','abandonmentRate','busyFactor','[getDataPredictive]','check\x20failure','getDataPredictiveOld','outboundQueuePauses','[CatchErlangB]','agentBusyFactor','one\x20call\x20every:','[handlePredictive]','fail\x20to\x20scheduled\x20calls','checkContactBlack','recallme','[booked][checkContactBlack]','queueStatusComplete:\x20','queuestatus','[unlockOriginate][syncQueueStatusComplete]','Queue:\x20','dialRecallMeTimeout','Agent','voicePause','log','Contact\x20updated','[rescheduleContact][dialRecallInQueue]','RECALLINQUEUE','RecallInQueue','[Originate][HistoryDialRecallInQueue][historyCatch]','RECALLFAILEDTIMEOUT','RecallFailedTimeout','[Originate][HistoryRecallClose][historyCatch]','[Originate][HistoryRecallClose]','Blacklist','[Originate][historyBlacklist]','[Originate][MoveBlacklist]','temp','dialOrderByScheduledAt','[getContactCampaign2][Empty]','ivrTotalCallsDays','[actionOriginate]\x20','Contact.phone','[actionOriginateIvr]\x20','[getContactCampaign2]','dialLimitQueue','countReScheduled','[countReScheduled]\x20','ACTIVE','emptyContact','checkIsBlackList','[getContactDialer2]','tryOriginatePredictive','[handlePredictive][limitChannel]','not_inuse','reachable','RUNNING','[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','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','Ts\x20=\x20','p\x20=\x20','interval\x20=\x20','----\x20Agent\x20Busy\x20Factor\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','[busyFactor]','Umin\x20=\x20','exports','util','lodash','uuid','moment','md5','ioredis','../../../config/logger','dialer','booked','syncQueueSummary','../ami','redis','defaults','localhost','../rpc/cmHopper','../rpc/cmHopperFinal','../rpc/cmHopperBlack','../rpc/voiceQueueRt','./action','./history','./final','./agentComplete','./queueCallerAbandon','env','XCALLY_IP_AGI','127.0.0.1','rrmemory','roundrobin','prototype','enqueue','tail','finally','sequence','voiceQueues','campaigns','agents','trunks','maxNumberOriginate','channels','actions','startProgressive','queueBooked','queueBookedRR','agentconnect','bind','queuecallerabandon','syncQueueCallerAbandon','originateresponse','syncOriginateResponse','syncAgentComplete','custom:queuesummary','hangup','syncHangup','newexten','syncNewExten','syncVarSet','queuemember','syncQueueMember','queuestatuscomplete','loopCampaigns','isUndefined','AGENTS_NOT_LOGGED','name','\x20AGENTS\x20NOT\x20LOGGED','NOT_ACTIVE','\x20NOT\x20Active','message','INTERVAL_IS_NULL','\x20INTERVAL_IS_NULL','Interval','Intervals','isEmpty','[ifTime][Action]','Error','stringify','milliseconds','diff','seconds','emit','type','outbound','answered','available','loggedIn','pTalking','sumBillable','sumDuration','sumHoldTime','total','unmanaged','abandoned','dialActive','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','predictiveIntervalAvgHoldtime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalTotalCalls','originated','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','Trunk','active','callerid','format','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','predictiveIntervalAnsweredCalls','Dropped\x20Timeout:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalDroppedCallsTimeout','Dropped\x20Exit:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','AVG\x20Hold\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','AVG\x20Talk\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalAvgTalktime','---------------------------','Avg\x20Hold\x20Time\x20is\x20not\x20enough\x20for\x20predictive','History\x20information\x20are\x20empty','---------\x20ErlangB\x20---------','Agent\x20Busy\x20Factor:\x20\x20\x20\x20\x20\x20\x20\x20\x20','Drop\x20Rate:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','merge','clearing\x20variable\x20start\x20progressive','startPredictive','clearing\x20variable\x20start\x20predictive','handlePredictive','clearing\x20variable\x20handle\x20predictive','preview','string','\x22%s\x22\x20<%s>','\x22\x22\x20<>','error','inspect','stack','length','hasOwnProperty','[decremetOriginate]\x20object\x20originated\x20is\x20negative','contactsRescheduled','RESCHEDULED_CONTACTS','[getContactDialer2][ReScheduled]','contacts','AVAILABLE_CONTACTS_FINISHED','[getContactDialer2][Empty]','sendMessageOneNotActive','talking','waiting','is\x20not\x20active','IS_DISACTIVED','[syncQueueSummary]\x20Campaign\x20Queue:\x20','is\x20disactive','[syncQueueSummary]\x20Campaign\x20Ivr:\x20','endtime','starttime','loopClearZombieChannels','clearZombieChannels','uniqueId','[uniqueid]','[actions]','isNil','Action','status','catch','updateOriginated','queue','[Dialer][checkChannel]','[Dialer][checkChannel][ivr]','resolve','then','[checkIsBlackList]\x20','checkIsBlackListIvr','[checkIsBlackListIvr]\x20','averageHandleTime','rescheduleContact','unlockContact','[unlockContact]\x20','getContactDialer','[getContactDialer]\x20','getContactDialerIvr','getVoiceQueueRtPauses','[getVoiceQueueRtPauses]\x20','moveContactManagedDialer','[moveContactManagedDialer]\x20','createHistory','[updateOriginated]\x20object\x20originated\x20is\x20negative','[updateOriginated]\x20is\x20null\x20or\x20undefined','loggerHandler','notFound','saveInDb','pick','ContactId','ListId','CampaignId','[emptyContact][createHistory]','[emptyContact]','isSuccess','Success','isTrunkReachable','SIP/%s','unmonitored','uniqueid','variable','exten','xcally-motion-dialer','dialAMDActive','value','HANGUP','state','statedesc','HangupInAMD','AMD','[syncHangupInAMD][createHistory]','[syncHangupInAMD]','MACHINE','membername','countmachineretry','countglobal','amd','[syncAgentComplete][createHistory][0]','countbusyretry','countcongestionretry','countdropretry','countagentrejectretry','dialGlobalMaxRetry','reason19\x20machine....','dialMachineMaxRetry','createStateFinal','reason\x2019\x20machine....','add','dialMachineRetryFrequency','minutes','YYYY-MM-DD\x20HH:mm:ss','VoiceQueueId','[rescheduleContact][Machine]','[syncHangupInAMDIvr][createHistory]','[syncHangupInAMDIvr]','Machine','countnoanswerretry','countnosuchnumberretry','ivrAnswerCallsDay','[syncHangupIvr][createHistory]','[syncHangupIvr]','AnswerAGI','dialQueueProject','cause-txt','agent','agiafterat','[syncAgentComplete][createHistory]','[syncAgentComplete]','syncAgentConnect','answertime','queueCallerAbandonCreateState','[syncQueueCallerAbandon]\x20[Drop]','dialQueueTimeout','Drop','TIMEOUT','dialQueueProject2','dialDropRetryFrequency','calleridname','calleridnum','[syncAgentComplete][createHistory][10]','Abandoned','dropreason','CALLEREXIT','dialAbandonedMaxRetry','countabandonedretry','dialAbandonedRetryFrequency','[rescheduleContact][Abandoned]','channel','actionid','strategy','locked','paused','stateinterface','push','idHopper','queueStatusComplete','[unlockQueueStatus][undefined]','[booked][unlockQueueStatus]','syncQueueStatusComplete','run','[Catch][Preview][syncQueueStatusComplete]','[unlock][syncQueueStatusComplete]','_rr','unlockRR','[booked][RR]','Agent:\x20','contactAgent-idHopper:\x20','[booked][unlock2]','[unlock2][syncQueueStatusComplete]','[booked][unlock3]'];(function(_0x43f0d3,_0x529d98){var _0x459008=function(_0x1bb3d6){while(--_0x1bb3d6){_0x43f0d3['push'](_0x43f0d3['shift']());}};_0x459008(++_0x529d98);}(_0x580a,0xda));var _0xa580=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x580a[_0x20a584];return _0x4b41a8;};'use strict';var util=require(_0xa580('0x0'));var _=require(_0xa580('0x1'));var BPromise=require('bluebird');var uuid=require(_0xa580('0x2'));var moment=require(_0xa580('0x3'));var rr=require('rr');var md5=require(_0xa580('0x4'));var Redis=require(_0xa580('0x5'));var ut=require('../preview/util/util');var config=require('../../../config/environment/');var logger=require(_0xa580('0x6'))(_0xa580('0x7'));var loggerBooked=require(_0xa580('0x6'))(_0xa580('0x8'));var loggerPredictive=require(_0xa580('0x6'))('predictive');var loggerPredictiveCalls=require('../../../config/logger')('predictiveCalls');var loggerSyncQueueSummary=require(_0xa580('0x6'))(_0xa580('0x9'));var ami=require(_0xa580('0xa'));config[_0xa580('0xb')]=_[_0xa580('0xc')](config[_0xa580('0xb')],{'host':_0xa580('0xd'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xa580('0xb')]));var cmHopper=require(_0xa580('0xe'));var cmHopperFinal=require(_0xa580('0xf'));var cmHopperHistory=require('../rpc/cmHopperHistory');var cmHopperBlack=require(_0xa580('0x10'));var voiceQueueRt=require(_0xa580('0x11'));var Action=require(_0xa580('0x12'));var History=require(_0xa580('0x13'));var Final=require(_0xa580('0x14'));var AgentComplete=require(_0xa580('0x15'));var QueueCallerAbandon=require(_0xa580('0x16'));var Hangup=require('./hangup');var ipAgi=process[_0xa580('0x17')][_0xa580('0x18')]||_0xa580('0x19');var strategy={'rrmemory':_0xa580('0x1a'),'roundrobin':_0xa580('0x1b')};var Sequence=function(){};Sequence[_0xa580('0x1c')][_0xa580('0x1d')]=function(_0x354fc4){this[_0xa580('0x1e')]=this['tail']?this[_0xa580('0x1e')][_0xa580('0x1f')](_0x354fc4):_0x354fc4();};function Dialer(_0x357e64,_0x252104){this[_0xa580('0x20')]=new Sequence();this['preview']=_0x252104;this[_0xa580('0x21')]=_0x357e64[_0xa580('0x21')];this[_0xa580('0x22')]=_0x357e64[_0xa580('0x22')];this[_0xa580('0x23')]=_0x357e64[_0xa580('0x23')];this[_0xa580('0x24')]=_0x357e64['trunks'];this[_0xa580('0x25')]=config[_0xa580('0x25')]||0x2;this[_0xa580('0x26')]={};this[_0xa580('0x27')]={};this['contactsId']={};this['uniqueId']={};this['optionPredictive']={};this['startPredictive']={};this[_0xa580('0x28')]={};this['ivrOriginated']={};this[_0xa580('0x29')]={};this[_0xa580('0x2a')]={};ami['on'](_0xa580('0x2b'),this['syncAgentConnect'][_0xa580('0x2c')](this));ami['on'](_0xa580('0x2d'),this[_0xa580('0x2e')]['bind'](this));ami['on'](_0xa580('0x2f'),this[_0xa580('0x30')][_0xa580('0x2c')](this));ami['on']('agentcomplete',this[_0xa580('0x31')][_0xa580('0x2c')](this));ami['on'](_0xa580('0x32'),this['syncQueueSummary'][_0xa580('0x2c')](this));ami['on'](_0xa580('0x33'),this[_0xa580('0x34')]['bind'](this));ami['on'](_0xa580('0x35'),this[_0xa580('0x36')]['bind'](this));ami['on']('varset',this[_0xa580('0x37')][_0xa580('0x2c')](this));ami['on'](_0xa580('0x38'),this[_0xa580('0x39')][_0xa580('0x2c')](this));ami['on'](_0xa580('0x3a'),this['syncQueueStatusComplete'][_0xa580('0x2c')](this));this[_0xa580('0x3b')]();this['loopClearZombieChannels']();}function isNotNull(_0x4e7ef2){return _0x4e7ef2!==null&&!_[_0xa580('0x3c')](_0x4e7ef2);}function checkIsLoggedIn(_0x1e3f1e,_0x190294){return function(){if(_0x190294<=0x0){_0x1e3f1e['message']=_0xa580('0x3d');throw _0x1e3f1e[_0xa580('0x3e')]+_0xa580('0x3f');}};}function isActive(_0x5af69b){return _0x5af69b;}function checkIsActive(_0x469840,_0x3c242d){return function(){if(!isActive(_0x3c242d)){_0x469840['message']=_0xa580('0x40');throw _0x469840['name']+_0xa580('0x41');}};}function checkInterval(_0x1cabff){return function(){if(!isNotNull(_0x1cabff['Interval'])){_0x1cabff[_0xa580('0x42')]=_0xa580('0x43');throw _0x1cabff[_0xa580('0x3e')]+_0xa580('0x44');}if(!isNotNull(_0x1cabff[_0xa580('0x45')][_0xa580('0x46')])){_0x1cabff[_0xa580('0x42')]=_0xa580('0x43');throw _0x1cabff[_0xa580('0x3e')]+'\x20INTERVAL_IS_NULL';}if(!isNotNull(_[_0xa580('0x47')](_0x1cabff[_0xa580('0x45')][_0xa580('0x46')]))){_0x1cabff[_0xa580('0x42')]='INTERVAL_IS_NULL';throw _0x1cabff['name']+_0xa580('0x44');}};}function msgResponse(_0x5b7b7c,_0x23633f,_0x2f4647){return{'action':_0x5b7b7c,'response':_0x23633f,'message':_0x2f4647,'stack':_0x2f4647};}function myreject(_0x53342d){return function(_0x277893){return _0x53342d(msgResponse(_0xa580('0x48'),_0xa580('0x49'),JSON[_0xa580('0x4a')](_0x277893)));};}function getSeconds(_0x284da3,_0xa01831){var _0x5a53ff=moment(_0x284da3)[_0xa580('0x4b')](0x0);var _0x5c0629=moment(_0xa01831)[_0xa580('0x4b')](0x0);return _0x5a53ff[_0xa580('0x4c')](_0x5c0629,_0xa580('0x4d'));}function emit(_0x885544,_0x333387,_0x222197){io['to'](_0x885544)[_0xa580('0x4e')](_0x333387,_0x222197);}function emitVoiceQueueSummary(_0x350c1a){if(_0x350c1a[_0xa580('0x4f')]===_0xa580('0x50')){var _0x2e2025={'id':_0x350c1a['id'],'name':_0x350c1a[_0xa580('0x3e')],'strategy':_0x350c1a['strategy'],'answered':_0x350c1a[_0xa580('0x51')],'available':_0x350c1a[_0xa580('0x52')],'loggedIn':_0x350c1a[_0xa580('0x53')],'pTalking':_0x350c1a[_0xa580('0x54')],'sumBillable':_0x350c1a[_0xa580('0x55')],'sumDuration':_0x350c1a[_0xa580('0x56')],'sumHoldTime':_0x350c1a[_0xa580('0x57')]||0x0,'talking':_0x350c1a['talking'],'total':_0x350c1a[_0xa580('0x58')],'type':_0x350c1a[_0xa580('0x4f')],'unmanaged':_0x350c1a[_0xa580('0x59')],'abandoned':_0x350c1a[_0xa580('0x5a')],'waiting':_0x350c1a['waiting'],'loggedInDb':_0x350c1a['loggedInDb'],'dialActive':_0x350c1a[_0xa580('0x5b')],'dialMethod':_0x350c1a['dialMethod'],'dialOriginateCallerIdName':_0x350c1a[_0xa580('0x5c')],'dialOriginateCallerIdNumber':_0x350c1a[_0xa580('0x5d')],'dialOriginateTimeout':_0x350c1a[_0xa580('0x5e')],'dialPrefix':_0x350c1a['dialPrefix'],'outboundAnswerAgiCallsDay':_0x350c1a[_0xa580('0x5f')],'outboundAnswerCallsDay':_0x350c1a[_0xa580('0x60')],'outboundBlacklistCallsDay':_0x350c1a[_0xa580('0x61')],'outboundBusyCallsDay':_0x350c1a['outboundBusyCallsDay'],'outboundCongestionCallsDay':_0x350c1a['outboundCongestionCallsDay'],'outboundDropCallsDayACS':_0x350c1a['outboundDropCallsDayACS'],'outboundDropCallsDayCallersExit':_0x350c1a[_0xa580('0x62')],'outboundDropCallsDayTimeout':_0x350c1a[_0xa580('0x63')],'outboundNoAnswerCallsDay':_0x350c1a[_0xa580('0x64')],'outboundNoSuchCallsDay':_0x350c1a[_0xa580('0x65')],'outboundOriginateFailureCallsDay':_0x350c1a[_0xa580('0x66')],'outboundReCallsDay':_0x350c1a['outboundReCallsDay'],'outboundRejectCallsDay':_0x350c1a[_0xa580('0x67')],'outboundUnknownCallsDay':_0x350c1a[_0xa580('0x68')],'predictiveIntervalAnsweredCalls':_0x350c1a['predictiveIntervalAnsweredCalls'],'predictiveIntervalAvgHoldtime':_0x350c1a[_0xa580('0x69')],'predictiveIntervalAvgTalktime':_0x350c1a['predictiveIntervalAvgTalktime'],'predictiveIntervalDroppedCallsCallersExit':_0x350c1a[_0xa580('0x6a')],'predictiveIntervalDroppedCallsTimeout':_0x350c1a['predictiveIntervalDroppedCallsTimeout'],'predictiveIntervalErlangCalls':_0x350c1a[_0xa580('0x6b')],'predictiveIntervalErlangCallsDroppedCalls':_0x350c1a[_0xa580('0x6c')],'predictiveIntervalHitRate':_0x350c1a[_0xa580('0x6d')],'predictiveIntervalMultiplicativeFactor':_0x350c1a[_0xa580('0x6e')],'predictiveIntervalPauses':_0x350c1a[_0xa580('0x6f')],'predictiveIntervalAvailable':_0x350c1a[_0xa580('0x70')],'predictiveIntervalTotalCalls':_0x350c1a[_0xa580('0x71')],'message':_0x350c1a['message'],'originated':_0x350c1a[_0xa580('0x72')],'erlangCalls':_0x350c1a[_0xa580('0x73')],'erlangCallToSecond':_0x350c1a[_0xa580('0x74')],'erlangAbandonmentRate':_0x350c1a[_0xa580('0x75')],'erlangBusyFactor':_0x350c1a[_0xa580('0x76')],'startPredictive':_0x350c1a['startPredictive'],'startProgressive':_0x350c1a[_0xa580('0x28')]};if(_0x350c1a['Trunk']){_0x2e2025[_0xa580('0x77')]={'id':_0x350c1a[_0xa580('0x77')]['id'],'name':_0x350c1a[_0xa580('0x77')][_0xa580('0x3e')],'active':_0x350c1a['Trunk'][_0xa580('0x78')],'callerid':_0x350c1a[_0xa580('0x77')][_0xa580('0x79')]};}if(_0x350c1a[_0xa580('0x45')]){_0x2e2025[_0xa580('0x45')]={'id':_0x350c1a['Interval']['id'],'name':_0x350c1a[_0xa580('0x45')][_0xa580('0x3e')]};}var _0x2e4e33=md5(JSON[_0xa580('0x4a')](_0x2e2025));if(_0x350c1a[_0xa580('0x4')]!==_0x2e4e33){_0x350c1a[_0xa580('0x4')]=_0x2e4e33;emit(util[_0xa580('0x7a')]('voice:queue:%s',_0x2e2025[_0xa580('0x3e')]),_0xa580('0x7b'),_0x2e2025);}}}function emitCampaignSummary(_0x3f0057){if(_0x3f0057[_0xa580('0x4f')]===_0xa580('0x7c')){emit(util['format'](_0xa580('0x7d'),_0x3f0057[_0xa580('0x3e')]),_0xa580('0x7e'),_0x3f0057);}}function checkGetDataPredictive(_0x54c97e){if(isNotNull(_0x54c97e)){if(!_[_0xa580('0x47')](_0x54c97e)){loggerPredictive[_0xa580('0x7f')]('-----\x20Stats\x20Predictive\x20---');loggerPredictive[_0xa580('0x7f')](_0xa580('0x80'),_0x54c97e[_0xa580('0x71')]);loggerPredictive['info'](_0xa580('0x81'),_0x54c97e[_0xa580('0x82')]);loggerPredictive[_0xa580('0x7f')](_0xa580('0x83'),_0x54c97e[_0xa580('0x84')]);loggerPredictive['info'](_0xa580('0x85'),_0x54c97e[_0xa580('0x6a')]);loggerPredictive[_0xa580('0x7f')](_0xa580('0x86'),_0x54c97e[_0xa580('0x69')]);loggerPredictive[_0xa580('0x7f')](_0xa580('0x87'),_0x54c97e[_0xa580('0x88')]);loggerPredictive['info'](_0xa580('0x89'));if(_0x54c97e[_0xa580('0x71')]>0x0){if(!_[_0xa580('0x3c')](_0x54c97e[_0xa580('0x88')])&&_0x54c97e[_0xa580('0x88')]>0x0){return!![];}else{loggerPredictive['info']('Avg\x20Talk\x20Time\x20is\x20not\x20enough\x20for\x20predictive');}if(!_['isUndefined'](_0x54c97e[_0xa580('0x69')])&&_0x54c97e[_0xa580('0x69')]>0x0){return!![];}else{loggerPredictive[_0xa580('0x7f')](_0xa580('0x8a'));}}else{loggerPredictive[_0xa580('0x7f')]('Total\x20Calls\x20are\x20not\x20enough\x20for\x20predictive');}}else{loggerPredictive['info'](_0xa580('0x8b'));}}else{loggerPredictive[_0xa580('0x7f')](_0xa580('0x8b'));}return![];}function mergeDataErlangB(_0x4e4585){return function(_0x1e2149){loggerPredictive['info'](_0xa580('0x8c'));loggerPredictive['info']('Scheduled\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x1e2149['erlangCalls']);loggerPredictive[_0xa580('0x7f')]('One\x20call\x20every:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x1e2149['erlangCallToSecond']);loggerPredictive[_0xa580('0x7f')]('Drop\x20Rate:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x1e2149['erlangAbandonmentRate']);loggerPredictive[_0xa580('0x7f')](_0xa580('0x8d'),_0x1e2149[_0xa580('0x76')]);loggerPredictive['info'](_0xa580('0x8e'),_0x1e2149[_0xa580('0x75')]);loggerPredictive[_0xa580('0x7f')](_0xa580('0x89'));_[_0xa580('0x8f')](_0x4e4585,_0x1e2149);};}function getDiff(_0x3fce23){var _0x55bc18=moment()['milliseconds'](0x0);var _0x21e94e=moment(_0x3fce23)[_0xa580('0x4b')](0x0);return _0x55bc18['diff'](_0x21e94e,_0xa580('0x4d'));}function ifInterval(_0x5d9873,_0x396991){if(_[_0xa580('0x3c')](_0x396991)){return![];}if(getDiff(_0x396991)<_0x5d9873*0x3c){return!![];}else{return![];}}function freeVariablesPredictive(_0x2fb53c){if(isNotNull(_0x2fb53c)){if(!_['isUndefined'](_0x2fb53c[_0xa580('0x28')])){_0x2fb53c['startProgressive']=undefined;loggerPredictive[_0xa580('0x7f')](_0x2fb53c[_0xa580('0x3e')],_0xa580('0x90'));}if(!_['isUndefined'](_0x2fb53c['startPredictive'])){_0x2fb53c[_0xa580('0x91')]=undefined;loggerPredictive['info'](_0x2fb53c[_0xa580('0x3e')],_0xa580('0x92'));}if(!_[_0xa580('0x3c')](_0x2fb53c[_0xa580('0x93')])){clearInterval(_0x2fb53c[_0xa580('0x93')]);_0x2fb53c[_0xa580('0x93')]=undefined;loggerPredictive['info'](_0x2fb53c[_0xa580('0x3e')],_0xa580('0x94'));}}}function erlangb(_0x5b8c12,_0x3724da){if(_0x3724da===0x0){return 0x0;}var _0x3c8b82=0x1;for(var _0x5a0faa=0x1;_0x5a0faa<=_0x3724da;_0x5a0faa+=0x1){_0x3c8b82=0x1+_0x3c8b82*_0x5a0faa/_0x5b8c12;}return 0x1/_0x3c8b82;}function isVoiceQueueOutbound(_0x4df2cf){return _0x4df2cf===_0xa580('0x50');}function isNotPreview(_0x377780){return _0x377780!==_0xa580('0x95');}function isCampaignIvr(_0x484586){return _0x484586==='ivr';}function getCallerId(_0x3a0054,_0x4e241e,_0x37210d){if(!_[_0xa580('0x3c')](_0x37210d)&&_0xa580('0x96')===typeof _0x37210d&&!_[_0xa580('0x47')](_0x37210d)){if(!_[_0xa580('0x3c')](_0x4e241e)&&_0xa580('0x96')===typeof _0x4e241e&&!_[_0xa580('0x47')](_0x4e241e)){return util['format'](_0xa580('0x97'),_0x4e241e,_0x37210d);}return util[_0xa580('0x7a')](_0xa580('0x97'),_0x37210d,_0x37210d);}if(!_['isUndefined'](_0x3a0054)&&_0xa580('0x96')===typeof _0x3a0054&&!_[_0xa580('0x47')](_0x3a0054)){return _0x3a0054;}return _0xa580('0x98');}function loggerCatchQueueSummary(_0x1501b1,_0x124cec){return function(_0x3e5bc9){freeVariablesPredictive(_0x124cec);emitVoiceQueueSummary(_0x124cec);emitCampaignSummary(_0x124cec);loggerSyncQueueSummary[_0xa580('0x99')](_0x1501b1,util[_0xa580('0x9a')](_0x3e5bc9,{'showHidden':![],'depth':null}));};}function loggerCatchPredictive(_0x4c5129,_0x224850){return function(_0x47bc81){loggerPredictive['error'](_0x224850[_0xa580('0x3e')],_0x4c5129);loggerPredictive[_0xa580('0x99')](_0x47bc81[_0xa580('0x9b')]);freeVariablesPredictive(_0x224850);};}function loggerCatch(_0x35e091){return function(_0xe906af){logger[_0xa580('0x99')](_0x35e091,util[_0xa580('0x9a')](_0xe906af,{'showHidden':![],'depth':null}));};}function checkContactEmpty(_0x45a3ab){return _0x45a3ab&&!_[_0xa580('0x3c')](_0x45a3ab)&&_0x45a3ab[_0xa580('0x9c')]>0x0;}function decremetOriginate(_0x11f808){if(!_[_0xa580('0x3c')](_0x11f808)&&_0x11f808!==null){if(_0x11f808[_0xa580('0x9d')](_0xa580('0x72'))){if(_0x11f808['originated']>0x0){_0x11f808[_0xa580('0x72')]-=0x1;}else{logger[_0xa580('0x99')](_0xa580('0x9e'));}}}else{logger['error']('[decremetOriginate]\x20is\x20null\x20or\x20undefined');}}function checkContactLowerLimitOriginate(_0x4ecb7c,_0x3ec737,_0x4273b4){if(_0x3ec737>_0x4273b4){for(var _0x6b5a78=0x0;_0x6b5a78<_0x3ec737-_0x4273b4;_0x6b5a78+=0x1){decremetOriginate(_0x4ecb7c);}}}function loggerGetContactDialer(_0x47e5a9,_0x379d28,_0x37ef1e){return function(_0x2cc0aa){checkContactLowerLimitOriginate(_0x379d28,_0x37ef1e,0x0);logger[_0xa580('0x99')](_0x47e5a9,util[_0xa580('0x9a')](_0x2cc0aa,{'showHidden':![],'depth':null}));};}function sendMessageReschedule(_0xfb92cd){return function(_0x2a129c){if(isNotNull(_0x2a129c)&&isNotNull(_0x2a129c[0x0])){if(_0x2a129c[0x0][_0xa580('0x9f')]>0x0){_0xfb92cd[_0xa580('0x42')]=_0xa580('0xa0');logger[_0xa580('0x7f')](_0xa580('0xa1')+_0xfb92cd['name'],_0x2a129c[0x0]['contactsRescheduled'],_0xa580('0xa2'));}else{_0xfb92cd[_0xa580('0x42')]=_0xa580('0xa3');logger[_0xa580('0x7f')](_0xa580('0xa4')+_0xfb92cd[_0xa580('0x3e')]);}}};}function notSendMessagesQueue(_0x2ed072){if(_0x2ed072[_0xa580('0xa5')]){freeVariablesPredictive(_0x2ed072);if(_0x2ed072['originated']===0x0&&_0x2ed072[_0xa580('0xa6')]===0x0&&_0x2ed072[_0xa580('0xa7')]===0x0&&(_0x2ed072[_0xa580('0x54')]||0x0)===0x0){_0x2ed072[_0xa580('0xa5')]=![];_0x2ed072['available']=0x0;_0x2ed072[_0xa580('0x42')]=_0xa580('0x40');loggerSyncQueueSummary['error']('[syncQueueSummary]\x20Campaign\x20Queue:\x20',_0x2ed072[_0xa580('0x3e')],_0xa580('0xa8'));}else{_0x2ed072['message']=_0xa580('0xa9');loggerSyncQueueSummary['error'](_0xa580('0xaa'),_0x2ed072[_0xa580('0x3e')],_0xa580('0xab'));}emitVoiceQueueSummary(_0x2ed072);}}function notSendMessagesCampaign(_0x365b22){if(_0x365b22['sendMessageOneNotActive']){if(_0x365b22[_0xa580('0x72')]===0x0){_0x365b22[_0xa580('0xa5')]=![];_0x365b22[_0xa580('0x42')]=_0xa580('0x40');loggerSyncQueueSummary[_0xa580('0x99')](_0xa580('0xac'),_0x365b22[_0xa580('0x3e')],_0xa580('0xa8'));}else{_0x365b22['message']=_0xa580('0xa9');loggerSyncQueueSummary[_0xa580('0x99')](_0xa580('0xac'),_0x365b22[_0xa580('0x3e')],'is\x20disactive');}emitCampaignSummary(_0x365b22);}}function createObjHistory(_0x2083ab,_0x75f615,_0x145300,_0x1b85d5,_0x14bcbc){_0x2083ab[_0xa580('0x42')]=_0x145300;var _0x4dfcec=new Action(_0x2083ab,_0x75f615);var _0x4d42c6=new History(_0x4dfcec);_0x4d42c6['state']=_0x1b85d5;_0x4d42c6['statedesc']=_0x14bcbc;_0x4d42c6[_0xa580('0xad')]=_0x4dfcec[_0xa580('0xae')];return _0x4d42c6;}Dialer[_0xa580('0x1c')][_0xa580('0xaf')]=function(){var _0x1faf0e=this;setInterval(function(){_0x1faf0e[_0xa580('0xb0')](_0x1faf0e[_0xa580('0xb1')],_0xa580('0xb2'));_0x1faf0e[_0xa580('0xb0')](_0x1faf0e['actions'],_0xa580('0xb3'));},0x32c8);};Dialer[_0xa580('0x1c')][_0xa580('0xb0')]=function(_0x44f493,_0x28c845){var _0x186fc8=this;for(var _0x2e9380 in _0x44f493){if(_0x44f493[_0xa580('0x9d')](_0x2e9380)){this[_0xa580('0x20')][_0xa580('0x1d')](function(){if(!_[_0xa580('0xb4')](_0x44f493[_0x2e9380])){return ami[_0xa580('0xb5')]({'action':_0xa580('0xb6'),'channel':_0x44f493[_0x2e9380]['channel']})[_0xa580('0xb7')](function(_0x5a72d7){if(_0x5a72d7[_0xa580('0x42')]==='No\x20such\x20channel'){setTimeout(function(){if(_0x44f493[_0x2e9380]&&_0x44f493[_0x2e9380][_0xa580('0x4f')]!==_0xa580('0x7c')){_0x186fc8[_0xa580('0xb8')](_0x186fc8['voiceQueues'][_0x44f493[_0x2e9380][_0xa580('0xb9')]]);logger[_0xa580('0x99')](_0xa580('0xba'),_0x28c845,_0x2e9380,_0x44f493[_0x2e9380][_0xa580('0xb9')]);delete _0x44f493[_0x2e9380];}if(_0x44f493[_0x2e9380]&&_0x44f493[_0x2e9380]['type']===_0xa580('0x7c')){_0x186fc8[_0xa580('0xb8')](_0x186fc8[_0xa580('0x22')][_0x44f493[_0x2e9380][_0xa580('0xb9')]]);logger[_0xa580('0x99')](_0xa580('0xbb'),_0x28c845,_0x2e9380,_0x44f493[_0x2e9380][_0xa580('0xb9')]);delete _0x44f493[_0x2e9380];}},0x2328);}});}});}}};Dialer[_0xa580('0x1c')]['countReScheduled']=function(_0x15dd9c){return BPromise[_0xa580('0xbc')]()[_0xa580('0xbd')](cmHopper['countReScheduled'](_0x15dd9c))[_0xa580('0xb7')](loggerCatch('[countReScheduled]\x20'));};Dialer[_0xa580('0x1c')]['checkIsBlackList']=function(_0x2fedfd){return BPromise[_0xa580('0xbc')]()[_0xa580('0xbd')](cmHopperBlack['checkIsBlackList'](_0x2fedfd))[_0xa580('0xb7')](loggerCatch(_0xa580('0xbe')));};Dialer[_0xa580('0x1c')][_0xa580('0xbf')]=function(_0xf5f428){return BPromise['resolve']()[_0xa580('0xbd')](cmHopperBlack[_0xa580('0xbf')](_0xf5f428))['catch'](loggerCatch(_0xa580('0xc0')));};Dialer[_0xa580('0x1c')][_0xa580('0xc1')]=function(_0x289148){return BPromise[_0xa580('0xbc')]()['then'](cmHopperHistory['avgHandleTime'](_0x289148))[_0xa580('0xb7')](loggerCatch('[averageHandleTime]\x20'));};Dialer[_0xa580('0x1c')][_0xa580('0xc2')]=function(_0x3acc8f){return BPromise[_0xa580('0xbc')]()[_0xa580('0xbd')](cmHopper[_0xa580('0xc2')](_0x3acc8f))[_0xa580('0xb7')](loggerCatch('[rescheduleContact]\x20'));};Dialer[_0xa580('0x1c')][_0xa580('0xc3')]=function(_0x55dece,_0x12ee74,_0x2ada34){return BPromise[_0xa580('0xbc')]()[_0xa580('0xbd')](cmHopper[_0xa580('0xc3')](_0x55dece,_0x12ee74,_0x2ada34))[_0xa580('0xb7')](loggerCatch(_0xa580('0xc4')));};Dialer[_0xa580('0x1c')][_0xa580('0xc5')]=function(_0x44b0dc,_0x50b0fe,_0x4d06bd,_0x2c238a){return BPromise[_0xa580('0xbc')]()[_0xa580('0xbd')](cmHopper['getContactDialer'](_0x44b0dc,_0x50b0fe,_0x4d06bd,_0x2c238a))['catch'](loggerCatch(_0xa580('0xc6')));};Dialer[_0xa580('0x1c')][_0xa580('0xc7')]=function(_0x49546e,_0x46c1de,_0x21d00e){return BPromise['resolve']()['then'](cmHopper[_0xa580('0xc7')](_0x49546e,_0x46c1de,_0x21d00e))[_0xa580('0xb7')](loggerCatch('[getContactDialer]\x20'));};Dialer[_0xa580('0x1c')][_0xa580('0xc8')]=function(_0x135a4b){return BPromise[_0xa580('0xbc')]()[_0xa580('0xbd')](voiceQueueRt[_0xa580('0xc8')](_0x135a4b))[_0xa580('0xb7')](loggerCatch(_0xa580('0xc9')));};Dialer[_0xa580('0x1c')][_0xa580('0xca')]=function(_0x37f8ac){return BPromise[_0xa580('0xbc')]()[_0xa580('0xbd')](cmHopper[_0xa580('0xca')](_0x37f8ac))['catch'](loggerCatch(_0xa580('0xcb')));};Dialer[_0xa580('0x1c')][_0xa580('0xcc')]=function(_0x3791c4){return BPromise[_0xa580('0xbc')]()[_0xa580('0xbd')](cmHopperHistory['createHistory'](_0x3791c4))['catch'](loggerCatch('[createHistory]\x20'));};Dialer[_0xa580('0x1c')]['updateOriginated']=function(_0x1d2bb6){if(!_[_0xa580('0x3c')](_0x1d2bb6)&&_0x1d2bb6!==null){if(_0x1d2bb6[_0xa580('0x9d')](_0xa580('0x72'))){if(_0x1d2bb6[_0xa580('0x72')]>0x0){_0x1d2bb6[_0xa580('0x72')]-=0x1;}else{logger[_0xa580('0x99')](_0xa580('0xcd'));}}}else{logger['error'](_0xa580('0xce'));}};Dialer[_0xa580('0x1c')][_0xa580('0xcf')]=function(_0xc80661,_0x24709e){var _0x366caf=this;return function(_0x1e617d){_0x366caf[_0xa580('0xb8')](_0x24709e);logger['error'](_0xc80661,util[_0xa580('0x9a')](_0x1e617d,{'showHidden':![],'depth':null}));};};Dialer[_0xa580('0x1c')]['emptyContact']=function(_0x2b409a,_0x4d1929,_0xd39958){var _0x38a00d={'state':0x19,'statedesc':_0xa580('0xd0')};this[_0xa580('0xb8')](_0x4d1929);this[_0xa580('0xd1')](_[_0xa580('0x8f')](_0x38a00d,_[_0xa580('0xd2')](_0xd39958,[_0xa580('0xd3'),_0xa580('0xd4'),'UserId','VoiceQueueId',_0xa580('0xd5')])),_0xa580('0xd6'),_0xa580('0xd7'));logger['error'](_0x2b409a);};Dialer[_0xa580('0x1c')][_0xa580('0xd8')]=function(_0x479308){return _0x479308===_0xa580('0xd9');};Dialer[_0xa580('0x1c')][_0xa580('0xda')]=function(_0x1e966c){return!_[_0xa580('0x3c')](_0x1e966c)&&_0x1e966c&&!_[_0xa580('0x3c')](_0x1e966c[_0xa580('0x3e')])&&!_[_0xa580('0x3c')](_0x1e966c[_0xa580('0x78')])&&_0x1e966c[_0xa580('0x78')]&&(this['trunks'][util[_0xa580('0x7a')](_0xa580('0xdb'),_0x1e966c[_0xa580('0x3e')])][_0xa580('0xb6')]==='reachable'||this[_0xa580('0x24')][util[_0xa580('0x7a')](_0xa580('0xdb'),_0x1e966c['name'])][_0xa580('0xb6')]===_0xa580('0xdc'));};Dialer[_0xa580('0x1c')]['saveInDb']=function(_0x12940e,_0xe651fa,_0x5e88f7){this['createHistory'](_0x12940e)[_0xa580('0xb7')](loggerCatch(_0xe651fa));this['moveContactManagedDialer'](_0x12940e)[_0xa580('0xb7')](loggerCatch(_0x5e88f7));};Dialer[_0xa580('0x1c')]['syncVarSet']=function(_0x4a67dd){var _0x3ff8db=this['uniqueId'][_0x4a67dd[_0xa580('0xdd')]];var _0x311014;if(!_[_0xa580('0xb4')](_0x4a67dd)&&!_[_0xa580('0xb4')](_0x4a67dd[_0xa580('0xde')])&&!_[_0xa580('0xb4')](_0x4a67dd[_0xa580('0xde')]['amdstatus'])&&_0x4a67dd[_0xa580('0xdf')]===_0xa580('0xe0')&&_0x3ff8db){if(_0x3ff8db[_0xa580('0x4f')]!==_0xa580('0x7c')&&this[_0xa580('0x21')][_0x3ff8db[_0xa580('0xb9')]][_0xa580('0xe1')]&&_0x4a67dd[_0xa580('0xe2')]===_0xa580('0xe3')){delete this[_0xa580('0xb1')][_0x4a67dd[_0xa580('0xdd')]];this[_0xa580('0xb8')](this[_0xa580('0x21')][_0x3ff8db[_0xa580('0xb9')]]);this[_0xa580('0x21')][_0x3ff8db['queue']]['outboundAnswerCallsDay']+=0x1;this[_0xa580('0x21')][_0x3ff8db[_0xa580('0xb9')]][_0xa580('0x5f')]+=0x1;_0x311014=new Hangup(_0x3ff8db,_0x4a67dd);_0x311014[_0xa580('0xe4')]=0x12;_0x311014[_0xa580('0xe5')]=_0xa580('0xe6');_0x311014['membername']=_0xa580('0xe7');this['saveInDb'](_0x311014,_0xa580('0xe8'),_0xa580('0xe9'));}if(_0x3ff8db['type']!==_0xa580('0x7c')&&this[_0xa580('0x21')][_0x3ff8db['queue']][_0xa580('0xe1')]&&_0x4a67dd[_0xa580('0xe2')]===_0xa580('0xea')){var _0x3804ce=this;return new BPromise(function(_0x54c7a2,_0x2c23c9){delete _0x3804ce['uniqueId'][_0x4a67dd['uniqueid']];_0x3804ce['updateOriginated'](_0x3804ce[_0xa580('0x21')][_0x3ff8db[_0xa580('0xb9')]]);_0x3804ce['voiceQueues'][_0x3ff8db['queue']][_0xa580('0x60')]+=0x1;_0x3804ce[_0xa580('0x21')][_0x3ff8db['queue']][_0xa580('0x5f')]+=0x1;var _0x3c0454=_0x3804ce['voiceQueues'][_0x3ff8db['queue']];var _0x5b4638=new Hangup(_0x3ff8db,_0x4a67dd);_0x5b4638[_0xa580('0xe4')]=0x13;_0x5b4638[_0xa580('0xe5')]='Machine';_0x5b4638[_0xa580('0xeb')]=_0xa580('0xe7');_0x5b4638[_0xa580('0xec')]+=0x1;_0x5b4638[_0xa580('0xed')]+=0x1;_0x5b4638[_0xa580('0xee')]=!![];_0x3804ce['createHistory'](_0x5b4638)[_0xa580('0xb7')](loggerCatch(_0xa580('0xef')));if(_0x5b4638[_0xa580('0xf0')]+_0x5b4638[_0xa580('0xf1')]+_0x5b4638['countnoanswerretry']+_0x5b4638['countnosuchnumberretry']+_0x5b4638[_0xa580('0xf2')]+_0x5b4638['countabandonedretry']+_0x5b4638['countmachineretry']+_0x5b4638[_0xa580('0xf3')]>=_0x3c0454[_0xa580('0xf4')]){_0x3804ce['stateGlobal'](_0x5b4638,_0x54c7a2,_0x2c23c9,_0xa580('0xf5'));}else{if(_0x5b4638['countmachineretry']>=_0x3c0454[_0xa580('0xf6')]){_0x3804ce[_0xa580('0xf7')](_0x5b4638,_0x54c7a2,_0x2c23c9,_0xa580('0xf8'));}else{_0x3804ce[_0xa580('0xc2')]({'active':![],'countmachineretry':_0x5b4638['countmachineretry'],'scheduledat':moment()[_0xa580('0xf9')](_0x3c0454[_0xa580('0xfa')],_0xa580('0xfb'))['format'](_0xa580('0xfc')),'ContactId':_0x5b4638[_0xa580('0xd3')],'ListId':_0x5b4638['ListId'],'VoiceQueueId':_0x5b4638[_0xa580('0xfd')]||undefined,'CampaignId':_0x5b4638[_0xa580('0xd5')]||undefined})[_0xa580('0xb7')](loggerCatch(_0xa580('0xfe')));_0x54c7a2({'reschedule':0x1});}}});}if(_0x3ff8db[_0xa580('0x4f')]===_0xa580('0x7c')&&this[_0xa580('0x22')][_0x3ff8db[_0xa580('0xb9')]][_0xa580('0xe1')]&&_0x4a67dd['value']==='HANGUP'){delete this[_0xa580('0xb1')][_0x4a67dd[_0xa580('0xdd')]];this[_0xa580('0xb8')](this[_0xa580('0x22')][_0x3ff8db[_0xa580('0xb9')]]);_0x311014=new Hangup(_0x3ff8db,_0x4a67dd);_0x311014[_0xa580('0xe4')]=0x12;_0x311014[_0xa580('0xe5')]=_0xa580('0xe6');_0x311014['membername']=_0xa580('0xe7');this['saveInDb'](_0x311014,_0xa580('0xff'),_0xa580('0x100'));}if(_0x3ff8db[_0xa580('0x4f')]===_0xa580('0x7c')&&this['campaigns'][_0x3ff8db[_0xa580('0xb9')]]['dialAMDActive']&&_0x4a67dd[_0xa580('0xe2')]==='MACHINE'){var _0x3804ce=this;return new BPromise(function(_0x5bb6ae,_0x5e2860){delete _0x3804ce[_0xa580('0xb1')][_0x4a67dd[_0xa580('0xdd')]];_0x3804ce[_0xa580('0xb8')](_0x3804ce['campaigns'][_0x3ff8db['queue']]);_0x3804ce[_0xa580('0x22')][_0x3ff8db['queue']][_0xa580('0x60')]+=0x1;_0x3804ce[_0xa580('0x22')][_0x3ff8db[_0xa580('0xb9')]][_0xa580('0x5f')]+=0x1;var _0xf4e83f=_0x3804ce[_0xa580('0x22')][_0x3ff8db[_0xa580('0xb9')]];var _0x4cd723=new Hangup(_0x3ff8db,_0x4a67dd);_0x4cd723[_0xa580('0xe4')]=0x13;_0x4cd723[_0xa580('0xe5')]=_0xa580('0x101');_0x4cd723[_0xa580('0xeb')]=_0xa580('0xe7');_0x4cd723[_0xa580('0xec')]+=0x1;_0x4cd723['countglobal']+=0x1;_0x4cd723[_0xa580('0xee')]=!![];_0x3804ce[_0xa580('0xcc')](_0x4cd723)[_0xa580('0xb7')](loggerCatch(_0xa580('0xef')));if(_0x4cd723[_0xa580('0xf0')]+_0x4cd723[_0xa580('0xf1')]+_0x4cd723[_0xa580('0x102')]+_0x4cd723[_0xa580('0x103')]+_0x4cd723[_0xa580('0xf2')]+_0x4cd723['countabandonedretry']+_0x4cd723['countmachineretry']+_0x4cd723[_0xa580('0xf3')]>=_0xf4e83f[_0xa580('0xf4')]){_0x3804ce['stateGlobal'](_0x4cd723,_0x5bb6ae,_0x5e2860,_0xa580('0xf5'));}else{if(_0x4cd723['countmachineretry']>=_0xf4e83f[_0xa580('0xf6')]){_0x3804ce[_0xa580('0xf7')](_0x4cd723,_0x5bb6ae,_0x5e2860,_0xa580('0xf8'));}else{_0x3804ce[_0xa580('0xc2')]({'active':![],'countmachineretry':_0x4cd723[_0xa580('0xec')],'scheduledat':moment()[_0xa580('0xf9')](_0xf4e83f['dialMachineRetryFrequency'],_0xa580('0xfb'))['format'](_0xa580('0xfc')),'ContactId':_0x4cd723['ContactId'],'ListId':_0x4cd723['ListId'],'VoiceQueueId':_0x4cd723[_0xa580('0xfd')]||undefined,'CampaignId':_0x4cd723[_0xa580('0xd5')]||undefined})[_0xa580('0xb7')](loggerCatch(_0xa580('0xfe')));_0x5bb6ae({'reschedule':0x1});}}});}}};Dialer['prototype']['syncHangup']=function(_0x4f3314){var _0x452717=this['uniqueId'][_0x4f3314[_0xa580('0xdd')]];var _0x1058ba=this;var _0x131df6;if(_0x452717&&_0x452717[_0xa580('0x4f')]===_0xa580('0x7c')){delete this['uniqueId'][_0x4f3314[_0xa580('0xdd')]];this[_0xa580('0xb8')](this[_0xa580('0x22')][_0x452717[_0xa580('0xb9')]]);this[_0xa580('0x22')][_0x452717[_0xa580('0xb9')]][_0xa580('0x104')]+=0x1;_0x131df6=new Hangup(_0x452717,_0x4f3314);this[_0xa580('0xcc')](_0x131df6)[_0xa580('0xb7')](loggerCatch(_0xa580('0x105')));this[_0xa580('0xca')](_0x131df6)[_0xa580('0xb7')](loggerCatch(_0xa580('0x106')));}if(_0x452717&&_0x452717[_0xa580('0x4f')]!=='ivr'&&isNotNull(this[_0xa580('0x21')][_0x452717[_0xa580('0xb9')]]['dialQueueProject'])){delete this[_0xa580('0xb1')][_0x4f3314['uniqueid']];this[_0xa580('0xb8')](this['voiceQueues'][_0x452717[_0xa580('0xb9')]]);this[_0xa580('0x21')][_0x452717[_0xa580('0xb9')]][_0xa580('0x60')]+=0x1;this[_0xa580('0x21')][_0x452717[_0xa580('0xb9')]][_0xa580('0x5f')]+=0x1;_0x131df6=new Hangup(_0x452717,_0x4f3314);_0x131df6['state']=0x10;_0x131df6[_0xa580('0xe5')]=_0xa580('0x107');_0x131df6[_0xa580('0xeb')]='AGI';this[_0xa580('0xcc')](_0x131df6)[_0xa580('0xb7')](loggerCatch('[syncHangupIvr][createHistory]'));this[_0xa580('0xca')](_0x131df6)[_0xa580('0xb7')](loggerCatch(_0xa580('0x106')));}if(_0x452717&&_0x452717['type']!=='ivr'&&!isNotNull(this[_0xa580('0x21')][_0x452717[_0xa580('0xb9')]][_0xa580('0x108')])){delete this['uniqueId'][_0x4f3314[_0xa580('0xdd')]];this[_0xa580('0xb8')](this['voiceQueues'][_0x452717[_0xa580('0xb9')]]);this['voiceQueues'][_0x452717[_0xa580('0xb9')]][_0xa580('0x68')]+=0x1;_0x131df6=new Hangup(_0x452717,_0x4f3314);_0x131df6['state']=0xc;_0x131df6[_0xa580('0xe5')]=_0x4f3314[_0xa580('0x109')];_0x131df6['membername']='Unknow';this['createHistory'](_0x131df6)['catch'](loggerCatch('[syncHangupIvr][createHistory]'));this[_0xa580('0xca')](_0x131df6)[_0xa580('0xb7')](loggerCatch(_0xa580('0x106')));}};Dialer[_0xa580('0x1c')][_0xa580('0x31')]=function(_0x4e9429){var _0x16771c=this['uniqueId'][_0x4e9429['uniqueid']];var _0x4c705d=this;if(this[_0xa580('0x21')][_0x4e9429[_0xa580('0xb9')]]){if(_0x16771c&&_0x16771c[_0xa580('0x4f')]!==_0xa580('0x7c')){delete this[_0xa580('0xb1')][_0x4e9429[_0xa580('0xdd')]];this[_0xa580('0x21')][_0x4e9429[_0xa580('0xb9')]][_0xa580('0x60')]+=0x1;var _0x446538=new AgentComplete(_0x16771c,_0x4e9429);if(_0x4e9429['reason']===_0xa580('0x10a')){_0x446538[_0xa580('0x10b')]=this[_0xa580('0x21')][_0x4e9429['queue']]['dialQueueProject2']&&this[_0xa580('0x21')][_0x4e9429[_0xa580('0xb9')]]['dialAgiAfterHangupAgent']?moment()['format'](_0xa580('0xfc')):undefined;}this['createHistory'](_0x446538)[_0xa580('0xb7')](loggerCatch(_0xa580('0x10c')));this['moveContactManagedDialer'](_0x446538)[_0xa580('0xb7')](loggerCatch(_0xa580('0x10d')));}}};Dialer[_0xa580('0x1c')][_0xa580('0x10e')]=function(_0x5c29cd){if(this[_0xa580('0x21')][_0x5c29cd[_0xa580('0xb9')]]){if(this[_0xa580('0xb1')][_0x5c29cd['uniqueid']]&&this[_0xa580('0xb1')][_0x5c29cd['uniqueid']]['type']!==_0xa580('0x7c')){this[_0xa580('0xb8')](this[_0xa580('0x21')][_0x5c29cd[_0xa580('0xb9')]]);this[_0xa580('0xb1')][_0x5c29cd[_0xa580('0xdd')]][_0xa580('0x10f')]=moment()[_0xa580('0x7a')](_0xa580('0xfc'));}}};Dialer['prototype'][_0xa580('0x110')]=function(_0x479dbf){this['createHistory'](_0x479dbf)[_0xa580('0xb7')](loggerCatch(_0xa580('0x10c')));this[_0xa580('0xca')](_0x479dbf)[_0xa580('0xb7')](loggerCatch(_0xa580('0x111')));};Dialer[_0xa580('0x1c')]['syncQueueCallerAbandon']=function(_0x4c4a8a){var _0x461c5b=this[_0xa580('0xb1')][_0x4c4a8a[_0xa580('0xdd')]];var _0x75b99c=this;if(this[_0xa580('0x21')][_0x4c4a8a[_0xa580('0xb9')]]){if(_0x461c5b&&_0x461c5b['type']!=='ivr'){delete this[_0xa580('0xb1')][_0x4c4a8a[_0xa580('0xdd')]];this[_0xa580('0xb8')](this[_0xa580('0x21')][_0x4c4a8a[_0xa580('0xb9')]]);_0x461c5b['droptime']=moment()['format'](_0xa580('0xfc'));var _0xefa6cc=new QueueCallerAbandon(_0x461c5b,_0x4c4a8a);if(getSeconds(_0x461c5b['droptime'],_0x461c5b['responsetime'])>=_0x461c5b[_0xa580('0x112')]){this['voiceQueues'][_0x4c4a8a[_0xa580('0xb9')]][_0xa580('0x84')]+=0x1;this['voiceQueues'][_0x4c4a8a[_0xa580('0xb9')]][_0xa580('0x63')]+=0x1;this[_0xa580('0x21')][_0x4c4a8a[_0xa580('0xb9')]][_0xa580('0x6c')]+=0x1;_0xefa6cc[_0xa580('0xe4')]=0xa;_0xefa6cc[_0xa580('0xe5')]=_0xa580('0x113');_0xefa6cc['dropreason']=_0xa580('0x114');_0xefa6cc[_0xa580('0x10b')]=this[_0xa580('0x21')][_0x4c4a8a[_0xa580('0xb9')]][_0xa580('0x115')]?moment()[_0xa580('0x7a')](_0xa580('0xfc')):undefined;_0xefa6cc[_0xa580('0xf2')]+=0x1;_0xefa6cc[_0xa580('0xed')]+=0x1;if(_0xefa6cc[_0xa580('0xf2')]>=this[_0xa580('0x21')][_0x4c4a8a[_0xa580('0xb9')]]['dialDropMaxRetry']){this[_0xa580('0x110')](_0xefa6cc);}else{this[_0xa580('0xc2')]({'active':![],'countdropretry':_0xefa6cc[_0xa580('0xf2')],'scheduledat':moment()[_0xa580('0xf9')](this['voiceQueues'][_0x4c4a8a[_0xa580('0xb9')]][_0xa580('0x116')],'minutes')[_0xa580('0x7a')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x461c5b['ContactId'],'ListId':_0x461c5b['ListId'],'VoiceQueueId':_0x461c5b[_0xa580('0xfd')]||undefined,'CampaignId':_0x461c5b[_0xa580('0xd5')]||undefined})['catch'](loggerCatch('[rescheduleContact][Drop]'));var _0x430de7=new History(_0xefa6cc);_0x430de7[_0xa580('0xe4')]=0xa;_0x430de7['statedesc']=_0xa580('0x113');_0x430de7[_0xa580('0xae')]=moment()[_0xa580('0x7a')](_0xa580('0xfc'));_0x430de7[_0xa580('0xad')]=_0x430de7[_0xa580('0xae')];_0x430de7['calleridname']=_0xefa6cc[_0xa580('0x117')];_0x430de7[_0xa580('0x118')]=_0xefa6cc['calleridnum'];this['createHistory'](_0x430de7)[_0xa580('0xb7')](loggerCatch(_0xa580('0x119')));}}else{this['voiceQueues'][_0x4c4a8a['queue']][_0xa580('0x6a')]+=0x1;this[_0xa580('0x21')][_0x4c4a8a['queue']][_0xa580('0x62')]+=0x1;_0xefa6cc[_0xa580('0xe4')]=0xb;_0xefa6cc['statedesc']=_0xa580('0x11a');_0xefa6cc[_0xa580('0x11b')]=_0xa580('0x11c');_0xefa6cc['countabandonedretry']+=0x1;_0xefa6cc[_0xa580('0xed')]+=0x1;if(_0xefa6cc['countabandonedretry']>=this['voiceQueues'][_0x4c4a8a[_0xa580('0xb9')]][_0xa580('0x11d')]){this['queueCallerAbandonCreateState'](_0xefa6cc);}else{this[_0xa580('0xc2')]({'active':![],'countabandonedretry':_0xefa6cc[_0xa580('0x11e')],'scheduledat':moment()[_0xa580('0xf9')](this['voiceQueues'][_0x4c4a8a[_0xa580('0xb9')]][_0xa580('0x11f')],_0xa580('0xfb'))[_0xa580('0x7a')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x461c5b[_0xa580('0xd3')],'ListId':_0x461c5b['ListId'],'VoiceQueueId':_0x461c5b[_0xa580('0xfd')]||undefined,'CampaignId':_0x461c5b['CampaignId']||undefined})[_0xa580('0xb7')](loggerCatch(_0xa580('0x120')));var _0x430de7=new History(_0xefa6cc);_0x430de7[_0xa580('0xe4')]=0xb;_0x430de7[_0xa580('0xe5')]=_0xa580('0x11a');_0x430de7[_0xa580('0xae')]=moment()[_0xa580('0x7a')](_0xa580('0xfc'));_0x430de7[_0xa580('0xad')]=_0x430de7[_0xa580('0xae')];_0x430de7[_0xa580('0x117')]=_0xefa6cc[_0xa580('0x117')];_0x430de7[_0xa580('0x118')]=_0xefa6cc[_0xa580('0x118')];this[_0xa580('0xcc')](_0x430de7)[_0xa580('0xb7')](loggerCatch('[syncAgentComplete][createHistory][11]'));}}}}};Dialer[_0xa580('0x1c')][_0xa580('0x36')]=function(_0x19c281){if(this['actions'][_0x19c281[_0xa580('0xdd')]]){this[_0xa580('0x27')][_0x19c281['uniqueid']]['channel']=_0x19c281[_0xa580('0x121')];}if(this[_0xa580('0xb1')][_0x19c281[_0xa580('0xdd')]]){this['uniqueId'][_0x19c281[_0xa580('0xdd')]][_0xa580('0x121')]=_0x19c281[_0xa580('0x121')];}};Dialer[_0xa580('0x1c')][_0xa580('0x39')]=function(_0x5ca46e){if(strategy[this[_0xa580('0x21')][this[_0xa580('0x27')][_0x5ca46e[_0xa580('0x122')]][_0xa580('0xb9')]][_0xa580('0x123')]]===_0xa580('0x1b')){if(this[_0xa580('0x27')][_0x5ca46e['actionid']]&&_[_0xa580('0xb4')](this[_0xa580('0x27')][_0x5ca46e[_0xa580('0x122')]][_0xa580('0x124')])&&_0x5ca46e[_0xa580('0xb6')]==='1'&&_0x5ca46e[_0xa580('0x125')]==='0'){if(this['agents'][_0x5ca46e[_0xa580('0x126')]]){if(!this['agents'][_0x5ca46e[_0xa580('0x126')]]['locked']){this['agents'][_0x5ca46e[_0xa580('0x126')]][_0xa580('0x124')]=!![];this['actions'][_0x5ca46e[_0xa580('0x122')]][_0xa580('0x124')]=!![];this[_0xa580('0x27')][_0x5ca46e[_0xa580('0x122')]][_0xa580('0x126')]=_0x5ca46e[_0xa580('0x126')];}}}}else if((strategy[this[_0xa580('0x21')][this[_0xa580('0x27')][_0x5ca46e[_0xa580('0x122')]][_0xa580('0xb9')]][_0xa580('0x123')]]||'rrmemory')==='rrmemory'){if(this[_0xa580('0x27')][_0x5ca46e[_0xa580('0x122')]]){if(this[_0xa580('0x23')][_0x5ca46e[_0xa580('0x126')]]){this[_0xa580('0x27')][_0x5ca46e[_0xa580('0x122')]][_0xa580('0x126')]=_0x5ca46e[_0xa580('0x126')];if(_['isNil'](this[_0xa580('0x29')][this[_0xa580('0x27')][_0x5ca46e[_0xa580('0x122')]][_0xa580('0xb9')]])){this[_0xa580('0x29')][this['actions'][_0x5ca46e['actionid']]['queue']]=[];}this[_0xa580('0x29')][this[_0xa580('0x27')][_0x5ca46e[_0xa580('0x122')]][_0xa580('0xb9')]][_0xa580('0x127')](_[_0xa580('0x8f')](_[_0xa580('0xd2')](this[_0xa580('0x27')][_0x5ca46e[_0xa580('0x122')]],[_0xa580('0x128'),_0xa580('0x126')]),{'status':_0x5ca46e[_0xa580('0xb6')],'paused':_0x5ca46e[_0xa580('0x125')]}));}}}};function unlockQueueStatus(_0x25a983,_0x1c5771){setTimeout(function(){if(_[_0xa580('0x3c')](_0x25a983[_0xa580('0x129')])){loggerBooked[_0xa580('0x99')](_0xa580('0x12a'),_0x1c5771);}_0x25a983[_0xa580('0x129')]=!![];loggerBooked[_0xa580('0x7f')](_0xa580('0x12b'),_0x1c5771,JSON[_0xa580('0x4a')](_['pick'](_0x25a983,[_0xa580('0x3e'),'queueStatusComplete'])));},0x1f3);}Dialer[_0xa580('0x1c')][_0xa580('0x12c')]=function(_0x1bff93){var _0xa6a114=this;var _0x366e12=_0xa6a114[_0xa580('0x21')][_0xa6a114['actions'][_0x1bff93[_0xa580('0x122')]][_0xa580('0xb9')]];if(strategy[this['voiceQueues'][this[_0xa580('0x27')][_0x1bff93[_0xa580('0x122')]][_0xa580('0xb9')]][_0xa580('0x123')]]===_0xa580('0x1b')){if(this[_0xa580('0x27')][_0x1bff93['actionid']]&&this[_0xa580('0x27')][_0x1bff93['actionid']][_0xa580('0x126')]){this[_0xa580('0x95')][_0xa580('0x12d')](this[_0xa580('0x27')][_0x1bff93[_0xa580('0x122')]][_0xa580('0x128')],this[_0xa580('0x27')][_0x1bff93[_0xa580('0x122')]][_0xa580('0x126')])[_0xa580('0xb7')](function(_0x63b57f){logger[_0xa580('0x99')](_0xa580('0x12e'),util[_0xa580('0x9a')](_0x63b57f,{'showHidden':![],'depth':null}));})[_0xa580('0x1f')](function(){_0xa6a114[_0xa580('0xb8')](_0xa6a114[_0xa580('0x21')][_0xa6a114['actions'][_0x1bff93['actionid']][_0xa580('0xb9')]]);_0xa6a114[_0xa580('0x23')][_0xa6a114[_0xa580('0x27')][_0x1bff93[_0xa580('0x122')]]['stateinterface']]['locked']=![];delete _0xa6a114[_0xa580('0x27')][_0x1bff93['actionid']];unlockQueueStatus(_0x366e12);});}else{this['updateOriginated'](this[_0xa580('0x21')][this['actions'][_0x1bff93[_0xa580('0x122')]][_0xa580('0xb9')]]);this[_0xa580('0xc2')]({'active':![],'ContactId':this[_0xa580('0x27')][_0x1bff93[_0xa580('0x122')]]['ContactId'],'ListId':this[_0xa580('0x27')][_0x1bff93['actionid']]['ListId'],'VoiceQueueId':this[_0xa580('0x27')][_0x1bff93['actionid']][_0xa580('0xfd')]||undefined,'CampaignId':this['actions'][_0x1bff93['actionid']][_0xa580('0xd5')]||undefined})[_0xa580('0xb7')](loggerCatch(_0xa580('0x12f')));delete this[_0xa580('0x27')][_0x1bff93[_0xa580('0x122')]];unlockQueueStatus(_0x366e12);}}else if((strategy[this['voiceQueues'][this['actions'][_0x1bff93[_0xa580('0x122')]][_0xa580('0xb9')]][_0xa580('0x123')]]||_0xa580('0x1a'))===_0xa580('0x1a')){var _0x5d765a;if(this['actions'][_0x1bff93[_0xa580('0x122')]]&&!_[_0xa580('0x47')](this[_0xa580('0x29')][this[_0xa580('0x27')][_0x1bff93[_0xa580('0x122')]][_0xa580('0xb9')]])){if(this[_0xa580('0x2a')][_0xa6a114[_0xa580('0x27')][_0x1bff93[_0xa580('0x122')]][_0xa580('0xb9')]]){this[_0xa580('0x2a')][_0xa6a114[_0xa580('0x27')][_0x1bff93[_0xa580('0x122')]][_0xa580('0xb9')]]=this[_0xa580('0x2a')][this[_0xa580('0x27')][_0x1bff93[_0xa580('0x122')]][_0xa580('0xb9')]]?this['queueBookedRR'][this['actions'][_0x1bff93[_0xa580('0x122')]][_0xa580('0xb9')]]:this[_0xa580('0x29')][this['actions'][_0x1bff93[_0xa580('0x122')]]['queue']]?this[_0xa580('0x29')][this['actions'][_0x1bff93['actionid']][_0xa580('0xb9')]][_0xa580('0x130')]||0x0:0x0;}this[_0xa580('0x29')][this['actions'][_0x1bff93[_0xa580('0x122')]][_0xa580('0xb9')]][_0xa580('0x130')]=this[_0xa580('0x2a')][this[_0xa580('0x27')][_0x1bff93[_0xa580('0x122')]]['queue']];for(var _0x5036db=0x0;_0x5036db=0x0?!![]:![];})[_0xa580('0xb7')](myreject(_0x19358b)));}}else{_0x41c8f6[_0xa580('0x127')](ami[_0xa580('0xb5')]({'action':_0xa580('0x142'),'command':util[_0xa580('0x7a')](_0xa580('0x143'),_0x3b5c59,!_[_0xa580('0x3c')](config['timezones'][_0x45cf21])?_0x45cf21:'')})[_0xa580('0xbd')](function(_0x2bb413){return _0x2bb413[_0xa580('0x145')][_0xa580('0x146')](_0xa580('0x147'))>=0x0?!![]:![];})[_0xa580('0xb7')](myreject(_0x19358b)));}BPromise['all'](_0x41c8f6)[_0xa580('0xbd')](function(_0x95189){var _0x40cb5e=_[_0xa580('0x148')](_0x95189);if(_0x40cb5e){return _0x291ab3(_0x40cb5e);}else{_0x10e33d[_0xa580('0x42')]=_0x341bcc?_0xa580('0x149'):'INTERVAL_IS_OVERTIME';return _0x19358b(msgResponse(_0xa580('0x14a'),_0xa580('0x13f'),_0xa580('0x14b')+_0x341bcc+'\x20'+_0x5469d8+_0xa580('0x14c')+util[_0xa580('0x9a')](_0x3b5c59,{'showHidden':![],'depth':null})+_0xa580('0x14d')+_0x45cf21));}})[_0xa580('0xb7')](function(_0x528c8d){return _0x19358b(msgResponse(_0xa580('0x13e'),'Failure',JSON['stringify'](_0x528c8d)));});});};Dialer[_0xa580('0x1c')][_0xa580('0x14e')]=function(_0x3b3978){var _0x1000ee=this;return function(){switch(_0x3b3978[_0xa580('0x14f')]){case _0xa580('0x150'):freeVariablesPredictive(_0x3b3978);_0x1000ee['handlePower'](_0x3b3978,0x1);break;case'power':freeVariablesPredictive(_0x3b3978);_0x1000ee['handlePower'](_0x3b3978,_0x3b3978[_0xa580('0x151')]);break;case _0xa580('0x152'):_0x1000ee[_0xa580('0x152')](_0x3b3978);break;case _0xa580('0x8'):freeVariablesPredictive(_0x3b3978);_0x1000ee[_0xa580('0x153')](_0x3b3978,0x1);break;default:freeVariablesPredictive(_0x3b3978);logger[_0xa580('0x99')](_0xa580('0x154'),_0x3b3978[_0xa580('0x3e')],_0xa580('0x155'));}};};Dialer[_0xa580('0x1c')][_0xa580('0x156')]=function(_0x23f33c){var _0x573ce6=this;return function(){_0x573ce6[_0xa580('0x157')](_0x23f33c);};};Dialer[_0xa580('0x1c')]['syncQueueSummary']=function(_0x311fdf){var _0x200f06=this;if(isNotPreview(_0x311fdf[_0xa580('0x14f')])){if(isVoiceQueueOutbound(_0x311fdf[_0xa580('0x4f')])&&isActive(_0x311fdf[_0xa580('0x5b')])){_0x311fdf[_0xa580('0xa5')]=!![];BPromise[_0xa580('0xbc')]()['then'](checkIsLoggedIn(_0x311fdf,_0x311fdf[_0xa580('0x53')]))['then'](checkIsActive(_0x311fdf,_0x311fdf[_0xa580('0x5b')]))['then'](checkInterval(_0x311fdf))['then'](_0x200f06[_0xa580('0x139')](_0x311fdf))['then'](_0x200f06[_0xa580('0x13d')](_0x311fdf['dialGlobalInterval'],_0x311fdf[_0xa580('0x158')],_0x311fdf[_0xa580('0x3e')],_0x311fdf))[_0xa580('0xbd')](_0x200f06[_0xa580('0x159')](_0x311fdf[_0xa580('0x45')],_0x311fdf[_0xa580('0x158')],_0x311fdf[_0xa580('0x3e')],_0x311fdf))[_0xa580('0xbd')](_0x200f06[_0xa580('0x14e')](_0x311fdf))[_0xa580('0xb7')](loggerCatchQueueSummary(_0xa580('0x15a'),_0x311fdf));}else{notSendMessagesQueue(_0x311fdf);}}else{freeVariablesPredictive(_0x311fdf);}};Dialer[_0xa580('0x1c')][_0xa580('0x138')]=function(){var _0x350bbb=this;var _0x3eae17;for(var _0x28477a in this[_0xa580('0x22')]){if(this['campaigns']['hasOwnProperty'](_0x28477a)){_0x3eae17=this[_0xa580('0x22')][_0x28477a];if(isCampaignIvr(_0x3eae17[_0xa580('0x4f')])&&isActive(_0x3eae17['active'])){_0x3eae17[_0xa580('0xa5')]=!![];BPromise['resolve']()[_0xa580('0xbd')](checkIsActive(_0x3eae17,_0x3eae17[_0xa580('0x78')]))['then'](checkInterval(_0x3eae17))[_0xa580('0xbd')](_0x350bbb[_0xa580('0x139')](_0x3eae17))[_0xa580('0xbd')](_0x350bbb[_0xa580('0x13d')](_0x3eae17[_0xa580('0x15b')],_0x3eae17[_0xa580('0x158')],_0x3eae17[_0xa580('0x3e')],_0x3eae17))[_0xa580('0xbd')](_0x350bbb[_0xa580('0x159')](_0x3eae17['Interval'],_0x3eae17[_0xa580('0x158')],_0x3eae17[_0xa580('0x3e')],_0x3eae17))[_0xa580('0xbd')](_0x350bbb[_0xa580('0x156')](_0x3eae17))['catch'](loggerCatchQueueSummary(_0xa580('0x15c'),_0x3eae17));}else{notSendMessagesCampaign(_0x3eae17);}}}};function getCallerIdRandom(_0x14fcda,_0x47fe74){var _0x465365,_0x7fe8a5,_0x4459cf;if(_0x47fe74<=0x0){_0x47fe74=0x1;}_0x465365=new RegExp(_0xa580('0x15d')+_0x47fe74+'}$');_0x7fe8a5=Math[_0xa580('0x15e')](0xa,_0x47fe74-0x1);_0x4459cf=Math[_0xa580('0x15e')](0xa,_0x47fe74)-0x1;return util[_0xa580('0x7a')]('%s',_[_0xa580('0x15f')](_0x14fcda,_0x465365,_[_0xa580('0x160')](_0x7fe8a5,_0x4459cf)));}function extractCalleridName(_0x54966b){var _0x53a0a3=_0x54966b[_0xa580('0x161')](/"(.*?)"/);return _0x53a0a3?_0x53a0a3[0x1]:_0x54966b;}function extractCalleridNumber(_0x323e05){var _0x527e72=_0x323e05['match'](/<(.*?)>/);return _0x527e72?_0x527e72[0x1]:_0x323e05;}Dialer[_0xa580('0x1c')]['actionOriginate']=function(_0x4e4734,_0x12f3ca){var _0x5a494a=this;var _0x1783d7=uuid['v4']();this[_0xa580('0x27')][_0x1783d7]=new Action(_0x4e4734,_0x12f3ca,_0x1783d7);return new BPromise(function(_0x3a8698,_0x2c1f85){if(_[_0xa580('0x3c')](_0x4e4734)&&_0xa580('0x162')!==typeof _0x4e4734){return _0x2c1f85(msgResponse(_0xa580('0x163'),_0xa580('0x13f'),'voiceQueue\x20is\x20undefine'));}if(_[_0xa580('0x3c')](_0x12f3ca[_0xa580('0x164')][_0xa580('0x165')])||_0x12f3ca[_0xa580('0x164')][_0xa580('0x165')]===null){return _0x2c1f85(msgResponse(_0xa580('0x163'),_0xa580('0x13f'),'contact\x20is\x20undefine'));}var _0x11d214={'XMD-CALLERID':_0x5a494a[_0xa580('0x27')][_0x1783d7][_0xa580('0x166')](),'XMD-AGI':_0x4e4734[_0xa580('0x108')]?util[_0xa580('0x7a')]('\x22agi://%s/square,%s\x22',ipAgi,_0x4e4734[_0xa580('0x108')]):'NONE','XMD-AGIAFTER':_0x4e4734[_0xa580('0x115')]?util[_0xa580('0x7a')](_0xa580('0x167'),ipAgi,_0x4e4734[_0xa580('0x115')]):'NONE','XMD-QUEUE':_0x4e4734[_0xa580('0x4f')]===_0xa580('0x50')?util[_0xa580('0x7a')]('\x22%s,%s%s,,,%s\x22',_0x4e4734['name'],_0x4e4734[_0xa580('0x168')]||'',_0x4e4734[_0xa580('0x169')]?'c':'',_0x4e4734[_0xa580('0x112')]||0x3):'NONE','XMD-CONTACTID':_0x12f3ca['ContactId'],'XMD-CDRTYPE':'dialer','CALLERID(all)':_0x5a494a['actions'][_0x1783d7]['getCaller'](),'XMD-AMD':_0x4e4734[_0xa580('0xe1')]?'ACTIVE':_0xa580('0x16a'),'XMD-DESTINATION':_0xa580('0xe0')};if(_0x4e4734[_0xa580('0xe1')]){_0x11d214[_0xa580('0x16b')]=_0x4e4734['dialAMDInitialSilence']||0x9c4;_0x11d214[_0xa580('0x16c')]=_0x4e4734[_0xa580('0x16d')]||0x5dc;_0x11d214[_0xa580('0x16e')]=_0x4e4734['dialAMDAfterGreetingSilence']||0x320;_0x11d214['XMD-AMDTOTALANALYSISTIME']=_0x4e4734[_0xa580('0x16f')]||0x1388;_0x11d214[_0xa580('0x170')]=_0x4e4734[_0xa580('0x171')]||0x64;_0x11d214[_0xa580('0x172')]=_0x4e4734[_0xa580('0x173')]||0x32;_0x11d214['XMD-AMDMAXIMUMNUMBEROFWORDS']=_0x4e4734['dialAMDMaximumNumberOfWords']||0x3;_0x11d214[_0xa580('0x174')]=_0x4e4734[_0xa580('0x175')]||0x100;_0x11d214[_0xa580('0x176')]=_0x4e4734[_0xa580('0x177')]||0x1388;}if(_0x4e4734[_0xa580('0x4f')]===_0xa580('0x50')){_0x11d214['XMD-VOICEQUEUEID']=_0x12f3ca['VoiceQueueId'];}else{_0x11d214[_0xa580('0x178')]=_0x12f3ca[_0xa580('0xd5')];}for(var _0x4796b4 in _0x12f3ca[_0xa580('0x164')]){if(_0x12f3ca['Contact']['hasOwnProperty'](_0x4796b4)){if(isNotNull(_0x12f3ca['Contact'][_0x4796b4])&&_0x4796b4!=='id'&&_0x4796b4!=='tags'&&_0x4796b4!=='createdAt'&&_0x4796b4!==_0xa580('0x179')){_0x11d214[util[_0xa580('0x7a')]('%s%s',_0xa580('0x17a'),_[_0xa580('0x17b')](_0x4796b4))]=_0x12f3ca[_0xa580('0x164')][_0x4796b4];}}}var _0x3d76ea=_0x5a494a['isTrunkReachable'](_0x4e4734['Trunk'])?getCallerId(_0x4e4734[_0xa580('0x77')]['callerid'],_0x4e4734[_0xa580('0x5c')],_0x4e4734[_0xa580('0x17c')]>0x0?getCallerIdRandom(_0x4e4734[_0xa580('0x5d')],_0x4e4734[_0xa580('0x17c')]):_0x4e4734[_0xa580('0x5d')]):getCallerId(_[_0xa580('0xb4')](_0x4e4734[_0xa580('0x13a')])?_0x4e4734[_0xa580('0x77')][_0xa580('0x79')]:_0x4e4734[_0xa580('0x13a')]['callerid'],_0x4e4734[_0xa580('0x5c')],_0x4e4734[_0xa580('0x17c')]>0x0?getCallerIdRandom(_0x4e4734[_0xa580('0x5d')],_0x4e4734['dialRandomLastDigitCallerIdNumber']):_0x4e4734['dialOriginateCallerIdNumber']);if(_0x3d76ea){_0x11d214[_0xa580('0x17d')]=_0x5a494a['actions'][_0x1783d7][_0xa580('0x17e')]=extractCalleridName(_0x3d76ea);_0x11d214['XMD-ORIGINATECALLERIDNUM']=_0x5a494a[_0xa580('0x27')][_0x1783d7][_0xa580('0x17f')]=extractCalleridNumber(_0x3d76ea);}return ami[_0xa580('0xb5')]({'actionid':_0x1783d7,'action':_0xa580('0x163'),'channel':_0x5a494a[_0xa580('0xda')](_0x4e4734[_0xa580('0x77')])?util[_0xa580('0x7a')](_0xa580('0x180'),_0x4e4734[_0xa580('0x77')]['name'],isNotNull(_0x4e4734[_0xa580('0x181')])?_0x4e4734[_0xa580('0x181')][_0xa580('0x182')]()||'':'',_0x4e4734[_0xa580('0x183')]>0x0?_0x12f3ca[_0xa580('0x164')][_0xa580('0x165')][_0xa580('0x184')](_0x4e4734[_0xa580('0x183')]):_0x12f3ca[_0xa580('0x164')][_0xa580('0x165')]):util[_0xa580('0x7a')](_0xa580('0x180'),_['isNil'](_0x4e4734[_0xa580('0x13a')])?_0x4e4734[_0xa580('0x77')][_0xa580('0x3e')]:_0x4e4734[_0xa580('0x13a')][_0xa580('0x3e')],isNotNull(_0x4e4734[_0xa580('0x181')])?_0x4e4734[_0xa580('0x181')][_0xa580('0x182')]()||'':'',_0x4e4734[_0xa580('0x183')]>0x0?_0x12f3ca['Contact']['phone'][_0xa580('0x184')](_0x4e4734[_0xa580('0x183')]):_0x12f3ca['Contact']['phone']),'callerid':_0x3d76ea,'Exten':_0xa580('0xe0'),'Context':_0xa580('0x185'),'Priority':'1','variable':_0x11d214,'timeout':(_0x4e4734[_0xa580('0x5e')]||0x1e)*0x3e8,'async':!![],'channelid':_0x1783d7})['then'](function(_0x3e3afa){return _0x3a8698(_0x3e3afa);})[_0xa580('0xb7')](function(_0x25b2f0){_0x4e4734['outboundOriginateFailureCallsDay']+=0x1;var _0xbd37b3=new History(_0x5a494a['actions'][_0x1783d7]);logger['error'](util['format'](_0xa580('0x186'),JSON['stringify'](_0x25b2f0)));_0xbd37b3[_0xa580('0xe4')]=0xe;_0xbd37b3[_0xa580('0xe5')]=_0xa580('0x187');_0xbd37b3[_0xa580('0xae')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0xbd37b3[_0xa580('0xad')]=_0xbd37b3[_0xa580('0xae')];_0x5a494a[_0xa580('0xcc')](_0xbd37b3)[_0xa580('0xb7')](loggerCatch(_0xa580('0x188')));_0x5a494a[_0xa580('0xca')](_0xbd37b3)[_0xa580('0xb7')](loggerCatch(_0xa580('0x188')))[_0xa580('0x1f')](function(){delete _0x5a494a[_0xa580('0x27')][_0x1783d7];return _0x2c1f85(msgResponse(_0xa580('0x163'),_0xa580('0x49'),'originate\x20action\x20Error'));});});});};Dialer['prototype']['syncOriginateResponse']=function(_0x3c97bf){var _0x23e90f=this[_0xa580('0x27')][_0x3c97bf[_0xa580('0x122')]];var _0x2f894b=this;if(_0x23e90f){delete this['actions'][_0x3c97bf[_0xa580('0x122')]];_0x23e90f[_0xa580('0x189')]=moment()['format'](_0xa580('0xfc'));var _0x3c328c=_0x23e90f[_0xa580('0x4f')]===_0xa580('0x7c')?this['campaigns'][_0x23e90f[_0xa580('0xb9')]]:this[_0xa580('0x21')][_0x23e90f['getQueue']()];if(!this[_0xa580('0xd8')](_0x3c97bf[_0xa580('0x18a')])){this[_0xa580('0xb8')](_0x3c328c);return this['callProgressDetecting'](_0x23e90f,_0x3c328c,_0x3c97bf)[_0xa580('0xbd')](function(_0x4a434e){})[_0xa580('0xb7')](loggerCatch(_0xa580('0x18b')));}else{this[_0xa580('0xb1')][_0x3c97bf['uniqueid']]=_0x23e90f;}}};Dialer['prototype'][_0xa580('0x18c')]=function(_0x46b0c7,_0x5232dd,_0x29c508){var _0x509b16=new History(_0x5232dd);if(_0x509b16['countbusyretry']+_0x509b16[_0xa580('0xf1')]+_0x509b16[_0xa580('0x102')]+_0x509b16[_0xa580('0x103')]+_0x509b16[_0xa580('0xf2')]+_0x509b16[_0xa580('0x11e')]+_0x509b16[_0xa580('0xec')]+_0x509b16[_0xa580('0xf3')]>=_0x29c508[_0xa580('0xf4')]-0x1){return!![];}switch(_0x46b0c7){case 0x3:if(_0x509b16[_0xa580('0x102')]>=_0x29c508[_0xa580('0x18d')]-0x1){return!![];}else{this[_0xa580('0xc2')]({'active':![],'countnoanswerretry':_0x509b16[_0xa580('0x102')]+=0x1,'scheduledat':moment()['add'](_0x29c508['dialNoAnswerRetryFrequency'],_0xa580('0xfb'))[_0xa580('0x7a')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x509b16[_0xa580('0xd3')],'ListId':_0x509b16['ListId'],'VoiceQueueId':_0x509b16[_0xa580('0xfd')]||undefined,'CampaignId':_0x509b16[_0xa580('0xd5')]||undefined})[_0xa580('0xb7')](loggerCatch(_0xa580('0x18e')));}break;case 0x5:if(_0x509b16[_0xa580('0xf0')]>=_0x29c508[_0xa580('0x18f')]-0x1){return!![];}else{this[_0xa580('0xc2')]({'active':![],'countbusyretry':_0x509b16[_0xa580('0xf0')]+=0x1,'scheduledat':moment()[_0xa580('0xf9')](_0x29c508[_0xa580('0x190')],_0xa580('0xfb'))[_0xa580('0x7a')](_0xa580('0xfc')),'ContactId':_0x509b16[_0xa580('0xd3')],'ListId':_0x509b16[_0xa580('0xd4')],'VoiceQueueId':_0x509b16[_0xa580('0xfd')]||undefined,'CampaignId':_0x509b16['CampaignId']||undefined})[_0xa580('0xb7')](loggerCatch('[rescheduleContact]\x20[Busy]'));}break;case 0x8:if(_0x509b16[_0xa580('0xf1')]>=_0x29c508[_0xa580('0x191')]-0x1){return!![];}else{this[_0xa580('0xc2')]({'active':![],'countcongestionretry':_0x509b16['countcongestionretry']+=0x1,'scheduledat':moment()[_0xa580('0xf9')](_0x29c508['dialCongestionRetryFrequency'],_0xa580('0xfb'))[_0xa580('0x7a')](_0xa580('0xfc')),'ContactId':_0x509b16['ContactId'],'ListId':_0x509b16[_0xa580('0xd4')],'VoiceQueueId':_0x509b16[_0xa580('0xfd')]||undefined,'CampaignId':_0x509b16[_0xa580('0xd5')]||undefined})[_0xa580('0xb7')](loggerCatch(_0xa580('0x192')));}break;case 0x0:if(_0x509b16[_0xa580('0x103')]>=_0x29c508[_0xa580('0x193')]-0x1){return!![];}else{this[_0xa580('0xc2')]({'active':![],'countnosuchnumberretry':_0x509b16[_0xa580('0x103')]+=0x1,'scheduledat':moment()[_0xa580('0xf9')](_0x29c508[_0xa580('0x194')],'minutes')['format'](_0xa580('0xfc')),'ContactId':_0x509b16[_0xa580('0xd3')],'ListId':_0x509b16['ListId'],'VoiceQueueId':_0x509b16[_0xa580('0xfd')]||undefined,'CampaignId':_0x509b16['CampaignId']||undefined})[_0xa580('0xb7')](loggerCatch('[rescheduleContact][NoSuchNumber]'));}break;case 0xa:if(_0x509b16[_0xa580('0xf2')]>=_0x29c508['dialDropMaxRetry']-0x1){return!![];}else{this[_0xa580('0xc2')]({'active':![],'countdropretry':_0x509b16[_0xa580('0xf2')]+=0x1,'scheduledat':moment()[_0xa580('0xf9')](_0x29c508['dialDropRetryFrequency'],_0xa580('0xfb'))[_0xa580('0x7a')](_0xa580('0xfc')),'ContactId':_0x509b16[_0xa580('0xd3')],'ListId':_0x509b16[_0xa580('0xd4')],'VoiceQueueId':_0x509b16[_0xa580('0xfd')]||undefined,'CampaignId':_0x509b16[_0xa580('0xd5')]||undefined})['catch'](loggerCatch(_0xa580('0x195')));}break;case 0xb:if(_0x509b16[_0xa580('0x11e')]>=_0x29c508[_0xa580('0x11d')]-0x1){return!![];}else{this[_0xa580('0xc2')]({'active':![],'countabandonedretry':_0x509b16[_0xa580('0x11e')]+=0x1,'scheduledat':moment()[_0xa580('0xf9')](_0x29c508['dialAbandonedRetryFrequency'],_0xa580('0xfb'))[_0xa580('0x7a')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x509b16[_0xa580('0xd3')],'ListId':_0x509b16['ListId'],'VoiceQueueId':_0x509b16['VoiceQueueId']||undefined,'CampaignId':_0x509b16['CampaignId']||undefined})[_0xa580('0xb7')](loggerCatch(_0xa580('0x120')));}break;case 0x13:if(_0x509b16[_0xa580('0xec')]>=_0x29c508[_0xa580('0xf6')]-0x1){return!![];}else{this[_0xa580('0xc2')]({'active':![],'countmachineretry':_0x509b16[_0xa580('0xec')]+=0x1,'scheduledat':moment()['add'](_0x29c508[_0xa580('0xfa')],'minutes')[_0xa580('0x7a')](_0xa580('0xfc')),'ContactId':_0x509b16[_0xa580('0xd3')],'ListId':_0x509b16[_0xa580('0xd4')],'VoiceQueueId':_0x509b16[_0xa580('0xfd')]||undefined,'CampaignId':_0x509b16[_0xa580('0xd5')]||undefined})[_0xa580('0xb7')](loggerCatch(_0xa580('0xfe')));}break;case 0x14:if(_0x509b16['countagentrejectretry']>=_0x29c508[_0xa580('0x196')]-0x1){return!![];}else{this[_0xa580('0xc2')]({'active':![],'countagentrejectretry':_0x509b16['countagentrejectretry']+=0x1,'scheduledat':moment()['add'](_0x29c508[_0xa580('0x197')],_0xa580('0xfb'))[_0xa580('0x7a')](_0xa580('0xfc')),'ContactId':_0x509b16[_0xa580('0xd3')],'ListId':_0x509b16[_0xa580('0xd4')],'VoiceQueueId':_0x509b16['VoiceQueueId']||undefined,'CampaignId':_0x509b16[_0xa580('0xd5')]||undefined})[_0xa580('0xb7')](loggerCatch(_0xa580('0x198')));}break;default:return!![];}};Dialer['prototype'][_0xa580('0x199')]=function(_0x559de8,_0x44429a,_0x216d31){var _0x357262=this;var _0x1440ad=new History(_0x559de8);return new BPromise(function(_0x5d02af,_0x3d1036){if(_[_0xa580('0x3c')](_0x44429a)&&_0xa580('0x162')!==typeof _0x44429a){return _0x3d1036(msgResponse('[callProgressDetecting]',_0xa580('0x13f'),'entity\x20is\x20undefine'));}if(_[_0xa580('0x3c')](_0x216d31)&&_0xa580('0x162')!==typeof _0x216d31){return _0x3d1036(msgResponse(_0xa580('0x19a'),'Failure',_0xa580('0x19b')));}switch(_0x216d31['reason']){case'0':_0x44429a['outboundNoSuchCallsDay']+=0x1;_0x1440ad[_0xa580('0xe4')]=0x0;_0x1440ad[_0xa580('0xe5')]='NoSuchNumber';_0x1440ad[_0xa580('0x103')]+=0x1;_0x1440ad[_0xa580('0xed')]+=0x1;ami[_0xa580('0x4e')](_0xa580('0x19c'),ut['buildObj'](_0x559de8,'nosuchnumber'));_0x357262['createHistory'](_0x1440ad)[_0xa580('0xb7')](loggerCatch(_0xa580('0xef')));if(_0x357262['checkRetriveMax'](0x0,_0x559de8,_0x44429a)){if(_0x1440ad[_0xa580('0x103')]>=_0x44429a[_0xa580('0x193')]){_0x357262[_0xa580('0xf7')](_0x1440ad,_0x5d02af,_0x3d1036,'reason\x200\x20no\x20such\x20number....');}else{_0x357262[_0xa580('0x19d')](_0x1440ad,_0x5d02af,_0x3d1036,_0xa580('0x19e'));}}break;case'3':_0x44429a['outboundNoAnswerCallsDay']+=0x1;_0x1440ad[_0xa580('0xe4')]=0x3;_0x1440ad[_0xa580('0xe5')]='NoAnswer';_0x1440ad[_0xa580('0x102')]+=0x1;_0x1440ad[_0xa580('0xed')]+=0x1;ami[_0xa580('0x4e')]('custom:agentnoanswer',ut[_0xa580('0x19f')](_0x559de8,_0xa580('0x1a0')));_0x357262[_0xa580('0xcc')](_0x1440ad)['catch'](loggerCatch(_0xa580('0x1a1')));if(_0x357262[_0xa580('0x18c')](0x3,_0x559de8,_0x44429a)){if(_0x1440ad[_0xa580('0x102')]>=_0x44429a[_0xa580('0x18d')]){_0x357262['createStateFinal'](_0x1440ad,_0x5d02af,_0x3d1036,'reason\x203\x20ringing\x20no\x20answer');}else{_0x357262[_0xa580('0x19d')](_0x1440ad,_0x5d02af,_0x3d1036,'reason\x203\x20ringing\x20no\x20answer');}}break;case'5':_0x44429a[_0xa580('0x1a2')]+=0x1;_0x1440ad['state']=0x5;_0x1440ad['statedesc']=_0xa580('0x1a3');_0x1440ad[_0xa580('0xf0')]+=0x1;_0x1440ad[_0xa580('0xed')]+=0x1;ami[_0xa580('0x4e')](_0xa580('0x1a4'),ut['buildObj'](_0x559de8,_0xa580('0x1a5')));_0x357262[_0xa580('0xcc')](_0x1440ad)['catch'](loggerCatch(_0xa580('0x1a6')));if(_0x357262[_0xa580('0x18c')](0x5,_0x559de8,_0x44429a)){if(_0x1440ad['countbusyretry']>=_0x44429a['dialBusyMaxRetry']){_0x357262[_0xa580('0xf7')](_0x1440ad,_0x5d02af,_0x3d1036,_0xa580('0x1a7'));}else{_0x357262[_0xa580('0x19d')](_0x1440ad,_0x5d02af,_0x3d1036,_0xa580('0x1a7'));}}break;case'8':_0x44429a['outboundCongestionCallsDay']+=0x1;_0x1440ad[_0xa580('0xe4')]=0x8;_0x1440ad[_0xa580('0xe5')]=_0xa580('0x1a8');_0x1440ad['countcongestionretry']+=0x1;_0x1440ad[_0xa580('0xed')]+=0x1;ami[_0xa580('0x4e')](_0xa580('0x1a9'),ut[_0xa580('0x19f')](_0x559de8,_0xa580('0x1aa')));_0x357262[_0xa580('0xcc')](_0x1440ad)['catch'](loggerCatch('[syncAgentComplete][createHistory][8]'));if(_0x357262['checkRetriveMax'](0x8,_0x559de8,_0x44429a)){if(_0x1440ad['countcongestionretry']>=_0x44429a[_0xa580('0x191')]){_0x357262[_0xa580('0xf7')](_0x1440ad,_0x5d02af,_0x3d1036,_0xa580('0x1ab'));}else{_0x357262[_0xa580('0x19d')](_0x1440ad,_0x5d02af,_0x3d1036,_0xa580('0x1ab'));}}break;case'11':_0x44429a[_0xa580('0x1ac')]+=0x1;_0x1440ad['state']=0xb;_0x1440ad[_0xa580('0xe5')]='Abandoned';_0x1440ad[_0xa580('0x11e')]+=0x1;_0x1440ad[_0xa580('0xed')]+=0x1;_0x357262[_0xa580('0xcc')](_0x1440ad)['catch'](loggerCatch(_0xa580('0x1ad')));if(_0x357262[_0xa580('0x18c')](0xb,_0x559de8,_0x44429a)){if(_0x1440ad[_0xa580('0x11e')]>=_0x44429a[_0xa580('0x11d')]){_0x357262[_0xa580('0xf7')](_0x1440ad,_0x5d02af,_0x3d1036,_0xa580('0x1ae'));}else{_0x357262[_0xa580('0x19d')](_0x1440ad,_0x5d02af,_0x3d1036,_0xa580('0x1ae'));}}break;case'20':_0x44429a['outboundRejectCallsDay']+=0x1;_0x1440ad[_0xa580('0xe4')]=0x14;_0x1440ad[_0xa580('0xe5')]='AgentReject';_0x1440ad[_0xa580('0xf3')]+=0x1;_0x1440ad[_0xa580('0xed')]+=0x1;ami[_0xa580('0x4e')](_0xa580('0x1af'),ut[_0xa580('0x19f')](_0x559de8,_0xa580('0x1b0')));_0x357262[_0xa580('0xcc')](_0x1440ad)[_0xa580('0xb7')](loggerCatch(_0xa580('0x1b1')));if(_0x357262[_0xa580('0x18c')](0x14,_0x559de8,_0x44429a)){if(_0x1440ad[_0xa580('0xf3')]>=_0x44429a[_0xa580('0x196')]){_0x357262[_0xa580('0xf7')](_0x1440ad,_0x5d02af,_0x3d1036,_0xa580('0x1b2'));}else{_0x357262['stateGlobal'](_0x1440ad,_0x5d02af,_0x3d1036,_0xa580('0x1b2'));}}break;default:_0x44429a[_0xa580('0x68')]+=0x1;_0x1440ad[_0xa580('0xe4')]=0xc;_0x1440ad[_0xa580('0xe5')]=_0x216d31[_0xa580('0x1b3')];_0x357262[_0xa580('0xcc')](_0x1440ad)[_0xa580('0xb7')](loggerCatch(_0xa580('0x1b4')));if(_0x357262[_0xa580('0x18c')](_0x216d31[_0xa580('0x1b3')],_0x559de8,_0x44429a)){if(_0x1440ad[_0xa580('0xf0')]+_0x1440ad[_0xa580('0xf1')]+_0x1440ad[_0xa580('0x102')]+_0x1440ad[_0xa580('0x103')]+_0x1440ad[_0xa580('0xf2')]+_0x1440ad[_0xa580('0x11e')]+_0x1440ad[_0xa580('0xec')]+_0x1440ad[_0xa580('0xf3')]>=_0x44429a[_0xa580('0xf4')]){_0x357262[_0xa580('0x19d')](_0x1440ad,_0x5d02af,_0x3d1036,_0x216d31[_0xa580('0x1b3')]);}else{_0x357262[_0xa580('0xf7')](_0x1440ad,_0x5d02af,_0x3d1036,_0x216d31['reason']);}}}});};Dialer['prototype'][_0xa580('0x19d')]=function(_0x126f79,_0x3fb0d7,_0x7355aa,_0x1267f1){var _0x414fb8=new Final(_0x126f79);_0x414fb8[_0xa580('0xe4')]=0xf;_0x414fb8['statedesc']=_0xa580('0x1b5');this[_0xa580('0xf7')](_0x414fb8,_0x3fb0d7,_0x7355aa,_0x1267f1);};Dialer['prototype']['createStateFinal']=function(_0x5f3466,_0x56f0c6,_0x3bcc04,_0x3252bd){this[_0xa580('0xca')](_0x5f3466)[_0xa580('0xbd')](function(_0x12b7aa){return _0x56f0c6(msgResponse('[callProgressDetecting]',_0xa580('0xd9'),_0x3252bd));})[_0xa580('0xb7')](function(_0x48ec3b){return _0x3bcc04(msgResponse(_0xa580('0x1b6'),_0xa580('0x13f'),_0xa580('0x1b7')));});};Dialer['prototype'][_0xa580('0x152')]=function(_0x33838e){var _0x232832=this;var _0x37c4ad=_0x33838e[_0xa580('0x1b8')]/0x64;var _0x1279b7=_0x33838e[_0xa580('0x63')]/(_0x33838e[_0xa580('0x63')]+_0x33838e[_0xa580('0x60')]);var _0x27b0fa=Math[_0xa580('0x1b9')](_0x33838e[_0xa580('0x70')]*(_0x33838e[_0xa580('0x1ba')]/0x64));var _0x3ec4f0=Math[_0xa580('0x1b9')](_0x33838e[_0xa580('0x70')]*(_0x33838e[_0xa580('0x1bb')]/0x64));var _0x5cb918=_0x33838e[_0xa580('0x52')]+_0x33838e['talking'];var _0x45248a=Math[_0xa580('0x1bc')](_0x33838e['erlangCalls']*_0x33838e[_0xa580('0x75')]*_0x33838e[_0xa580('0x6d')]*_0x33838e[_0xa580('0x6e')]);if(_[_0xa580('0x3c')](_0x33838e[_0xa580('0x28')])){if(!_[_0xa580('0x3c')](_0x33838e[_0xa580('0x91')])){_0x33838e[_0xa580('0x91')]=undefined;loggerPredictive[_0xa580('0x99')](_0xa580('0x1bd'),'check\x20predictive\x20is\x20not\x20undefine');}if(!_[_0xa580('0x3c')](_0x33838e[_0xa580('0x93')])){loggerPredictive[_0xa580('0x99')](_0xa580('0x1bd'),_0xa580('0x1be'));clearInterval(_0x33838e[_0xa580('0x93')]);_0x33838e[_0xa580('0x93')]=undefined;}_0x33838e[_0xa580('0x28')]=moment()[_0xa580('0x7a')](_0xa580('0xfc'));loggerPredictive[_0xa580('0x7f')](_0x33838e[_0xa580('0x3e')],_0xa580('0x1bf'),_0x33838e[_0xa580('0x28')]);this[_0xa580('0x153')](_0x33838e,0x1);}else if(ifInterval(_0x33838e[_0xa580('0x1c0')],_0x33838e[_0xa580('0x28')])){this[_0xa580('0x153')](_0x33838e,0x1);loggerPredictiveCalls[_0xa580('0x7f')](_0xa580('0x1c1'),_0x33838e[_0xa580('0x28')],_0x33838e[_0xa580('0x3e')]);_0x33838e[_0xa580('0x73')]=0x0;_0x33838e[_0xa580('0x6c')]=0x0;}else if(_0x37c4ad<_0x1279b7&&_0x33838e[_0xa580('0x1c2')]===_0xa580('0x1c3')){freeVariablesPredictive(_0x33838e);loggerPredictive['info']('[stopMethodPredictive][ReStartProgressive][ExceededDropDay]','Dropped\x20calls\x20day',_0x1279b7,_0xa580('0x28'),_0x33838e[_0xa580('0x3e')]);}else if(_0x45248a<_0x33838e[_0xa580('0x6c')]&&_0x33838e[_0xa580('0x1c2')]===_0xa580('0x1c3')){freeVariablesPredictive(_0x33838e);loggerPredictive[_0xa580('0x7f')](_0xa580('0x1c4'),_0xa580('0x1c5'),_0x45248a,_0xa580('0x1c6'),_0x33838e['predictiveIntervalErlangCallsDroppedCalls'],'startProgressive',_0x33838e[_0xa580('0x3e')]);}else if(!ifInterval(_0x33838e[_0xa580('0x1c0')],_0x33838e[_0xa580('0x28')])&&_['isUndefined'](_0x33838e[_0xa580('0x91')])&&!_[_0xa580('0x3c')](_0x33838e['startProgressive'])){_0x33838e[_0xa580('0x91')]=moment()[_0xa580('0x7a')](_0xa580('0xfc'));loggerPredictive[_0xa580('0x7f')](_0x33838e[_0xa580('0x3e')],'started\x20in\x20predictive\x20at',_0x33838e['startPredictive']);this[_0xa580('0xc1')](_0x33838e[_0xa580('0x1c0')])[_0xa580('0xbd')](this['getDataPredictive'](_0x33838e))[_0xa580('0xbd')](mergeDataErlangB(_0x33838e))[_0xa580('0xbd')](this[_0xa580('0x1c7')](_0x33838e))[_0xa580('0xb7')](loggerCatchPredictive(_0xa580('0x1c8'),_0x33838e));}else if(!ifInterval(_0x33838e[_0xa580('0x1c0')],_0x33838e[_0xa580('0x91')])){_0x33838e[_0xa580('0x6c')]=0x0;_0x33838e['startPredictive']=moment()['format'](_0xa580('0xfc'));loggerPredictive[_0xa580('0x7f')](_0x33838e[_0xa580('0x3e')],_0xa580('0x1c9'),_0x33838e[_0xa580('0x91')]);clearInterval(_0x33838e[_0xa580('0x93')]);_0x33838e['handlePredictive']=undefined;this[_0xa580('0xc1')](_0x33838e[_0xa580('0x1c0')])['then'](this[_0xa580('0x1ca')](_0x33838e))[_0xa580('0xbd')](mergeDataErlangB(_0x33838e))['then'](this[_0xa580('0x1c7')](_0x33838e))[_0xa580('0xb7')](loggerCatchPredictive(_0xa580('0x1cb'),_0x33838e));}else if(_0x33838e[_0xa580('0x70')]&&_0x5cb918<_0x33838e[_0xa580('0x70')]-_0x3ec4f0){freeVariablesPredictive(_0x33838e);loggerPredictive[_0xa580('0x7f')](_0x33838e[_0xa580('0x3e')],'switch\x20in\x20progressive\x20because\x20available\x20agents\x20(',_0x5cb918,')\x20are\x20less\x20than\x20threshold\x20(',_0x33838e[_0xa580('0x70')],'-',_0x3ec4f0,'=',_0x33838e['predictiveIntervalAvailable']-_0x3ec4f0,')');}else if(_0x33838e['predictiveIntervalAvailable']&&_0x5cb918>_0x33838e[_0xa580('0x70')]+_0x27b0fa){freeVariablesPredictive(_0x33838e);loggerPredictive[_0xa580('0x7f')](_0x33838e[_0xa580('0x3e')],'switch\x20in\x20progressive\x20because\x20available\x20agents\x20(',_0x5cb918,')\x20are\x20more\x20than\x20threshold\x20(',_0x33838e['predictiveIntervalAvailable'],'+',_0x27b0fa,'=',_0x33838e['predictiveIntervalAvailable']+_0x27b0fa,')');}};Dialer[_0xa580('0x1c')]['getDataPredictive']=function(_0x28359c){var _0x1397a6=this;return function(_0x532a8d){return new BPromise(function(_0x57b3c0,_0x463356){_['merge'](_0x28359c,_0x532a8d[0x0]);if(checkGetDataPredictive(_0x532a8d[0x0])){var _0x2ab91a=_0x28359c[_0xa580('0x70')]=_0x28359c[_0xa580('0xa6')]+_0x28359c[_0xa580('0x52')];var _0x92f3c6=_0x28359c[_0xa580('0x1c0')]*0x3c;var _0x166ace=_0x532a8d[0x0][_0xa580('0x88')]+_0x532a8d[0x0][_0xa580('0x69')];var _0x5e6b49=(_0x532a8d[0x0][_0xa580('0x82')]+_0x532a8d[0x0][_0xa580('0x84')]+_0x532a8d[0x0][_0xa580('0x6a')])/_0x532a8d[0x0][_0xa580('0x71')];_0x28359c[_0xa580('0x6d')]=_0x5e6b49>0x0?_0x5e6b49:0x1;switch(_0x28359c[_0xa580('0x1c2')]){case'dropRate':var _0x34fe27=_0x28359c[_0xa580('0x1b8')]/0x64;return _0x1397a6[_0xa580('0x1cc')](_0x2ab91a,_0x92f3c6,_0x166ace,_0x5e6b49,_0x34fe27)[_0xa580('0xbd')](function(_0x158c3b){return _0x57b3c0(_0x158c3b);});case'agentBusyFactor':var _0xc47e31=_0x28359c[_0xa580('0x1b8')]/0x64;return _0x1397a6[_0xa580('0x1cd')](_0x2ab91a,_0x92f3c6,_0x166ace,_0x5e6b49,_0xc47e31)['then'](function(_0x5f0834){return _0x57b3c0(_0x5f0834);});default:return _0x463356(msgResponse(_0xa580('0x1ce'),_0xa580('0x13f'),'Unknown\x20Predictive'));}}else{return _0x463356(msgResponse(_0xa580('0x1ce'),_0xa580('0x13f'),_0xa580('0x1cf')));}});};};Dialer[_0xa580('0x1c')][_0xa580('0x1d0')]=function(_0x43e9f0){var _0x126815=this;return function(_0x5a9449){return new BPromise(function(_0x1ccc2,_0x1576ad){_[_0xa580('0x8f')](_0x43e9f0,_0x5a9449[0x0]);if(checkGetDataPredictive(_0x5a9449[0x0])){loggerPredictive[_0xa580('0x7f')](JSON[_0xa580('0x4a')](_0x5a9449[0x0]));if(_0x43e9f0[_0xa580('0x1c2')]==='dropRate'){return _0x126815[_0xa580('0xc8')](_0x43e9f0['id'])[_0xa580('0xbd')](function(_0x3d160a){var _0x44771e=_0x43e9f0[_0xa580('0x53')]-_0x3d160a[0x0]['outboundQueuePauses'];var _0xe50ba=_0x43e9f0['dialPredictiveInterval']*0x3c;var _0xe77130=_0x5a9449[0x0][_0xa580('0x88')]+_0x5a9449[0x0]['predictiveIntervalAvgHoldtime'];var _0x5bb07f=(_0x5a9449[0x0][_0xa580('0x82')]+_0x5a9449[0x0][_0xa580('0x84')]+_0x5a9449[0x0]['predictiveIntervalDroppedCallsCallersExit'])/_0x5a9449[0x0][_0xa580('0x71')];var _0x1a2e4f=_0x43e9f0[_0xa580('0x1b8')]/0x64;_0x43e9f0[_0xa580('0x6f')]=_0x3d160a[0x0][_0xa580('0x1d1')]||0x0;_0x43e9f0[_0xa580('0x6d')]=_0x5bb07f>0x0?_0x5bb07f:0x1;return _0x126815[_0xa580('0x1cc')](_0x44771e,_0xe50ba,_0xe77130,_0x5bb07f,_0x1a2e4f);})[_0xa580('0xbd')](function(_0x1351f7){return _0x1ccc2(_0x1351f7);})[_0xa580('0xb7')](function(_0x2229f7){return _0x1576ad(msgResponse(_0xa580('0x1d2'),_0xa580('0x13f'),JSON[_0xa580('0x4a')](_0x2229f7)));});}if(_0x43e9f0[_0xa580('0x1c2')]===_0xa580('0x1d3')){return _0x126815[_0xa580('0xc8')](_0x43e9f0['id'])['then'](function(_0x551cc0){var _0x2581dc=_0x43e9f0[_0xa580('0x53')]-_0x551cc0[0x0]['outboundQueuePauses'];var _0x280a7c=_0x43e9f0[_0xa580('0x1c0')]*0x3c;var _0x59bf85=_0x5a9449[0x0]['predictiveIntervalAvgTalktime']+_0x5a9449[0x0][_0xa580('0x69')];var _0x6accc2=(_0x5a9449[0x0][_0xa580('0x82')]+_0x5a9449[0x0][_0xa580('0x84')]+_0x5a9449[0x0]['predictiveIntervalDroppedCallsCallersExit'])/_0x5a9449[0x0][_0xa580('0x71')];var _0x2968ef=_0x43e9f0[_0xa580('0x1b8')]/0x64;_0x43e9f0[_0xa580('0x6f')]=_0x551cc0[0x0][_0xa580('0x1d1')]||0x0;_0x43e9f0[_0xa580('0x6d')]=_0x6accc2>0x0?_0x6accc2:0x1;return _0x126815['busyFactor'](_0x2581dc,_0x280a7c,_0x59bf85,_0x6accc2,_0x2968ef);})[_0xa580('0xbd')](function(_0x3eb2bb){return _0x1ccc2(_0x3eb2bb);})['catch'](function(_0x1d2a2d){return _0x1576ad(msgResponse(_0xa580('0x1d2'),_0xa580('0x13f'),JSON['stringify'](_0x1d2a2d)));});}}else{return _0x1576ad(msgResponse('[getDataPredictive]',_0xa580('0x13f'),_0xa580('0x1cf')));}});};};Dialer[_0xa580('0x1c')]['startMethodPredictive']=function(_0x1eae85){var _0x57b1b8=this;return function(){var _0x3bfde7=0x0;var _0x329d7e=Math['floor'](_0x1eae85['erlangCallToSecond']*0x3e8);if(_0x329d7e>0x0){_0x329d7e=_0x329d7e<0x64?0x64:_0x329d7e;loggerPredictive['info'](_0x1eae85[_0xa580('0x3e')],_0xa580('0x1d4'),_0x329d7e,_0xa580('0x4b'));_0x1eae85['handlePredictive']=setInterval(function(){_0x57b1b8['handlePredictive'](_0x1eae85);loggerPredictiveCalls[_0xa580('0x7f')](_0xa580('0x1d5'),_0x3bfde7+=0x1);},_0x329d7e);}else{loggerPredictive['info'](_0x1eae85[_0xa580('0x3e')],_0xa580('0x1d6'));}};};Dialer[_0xa580('0x1c')][_0xa580('0x1d7')]=function(_0x34a589,_0x376f76){var _0x8d060c=this;return function(_0x263b2d){if(_[_0xa580('0x47')](_0x263b2d)){if(_[_0xa580('0xb4')](_0x376f76['UserId'])||!_0x376f76[_0xa580('0x1d8')]){if(_0x34a589[_0xa580('0x14f')]==='booked'){_0x34a589[_0xa580('0x129')]=_[_0xa580('0x3c')](_0x34a589[_0xa580('0x129')])?!![]:_0x34a589[_0xa580('0x129')];var _0x1644e1=uuid['v4']();_0x8d060c['actions'][_0x1644e1]=new Action(_0x34a589,_0x376f76,_0x1644e1);loggerBooked[_0xa580('0x7f')](_0xa580('0x1d9'),_0x1644e1,_0xa580('0x1da'),JSON[_0xa580('0x4a')](_0x34a589[_0xa580('0x129')]),'Queue:\x20',_0x34a589[_0xa580('0x3e')]);if(_0x34a589['queueStatusComplete']){_0x34a589['queueStatusComplete']=![];_0x8d060c[_0xa580('0x29')][_0x8d060c[_0xa580('0x27')][_0x1644e1][_0xa580('0xb9')]]=[];ami['Action']({'actionid':_0x1644e1,'action':_0xa580('0x1db'),'queue':_0x34a589[_0xa580('0x3e')]})[_0xa580('0xb7')](function(_0x5344e9){_0x8d060c[_0xa580('0xb8')](_0x34a589);_0x8d060c[_0xa580('0xc2')]({'active':![],'ContactId':_0x8d060c[_0xa580('0x27')][_0x1644e1]['ContactId'],'ListId':_0x8d060c[_0xa580('0x27')][_0x1644e1]['ListId'],'VoiceQueueId':_0x8d060c[_0xa580('0x27')][_0x1644e1][_0xa580('0xfd')]||undefined,'CampaignId':_0x8d060c[_0xa580('0x27')][_0x1644e1][_0xa580('0xd5')]||undefined})[_0xa580('0xb7')](loggerCatch(_0xa580('0x1dc')));delete _0x8d060c[_0xa580('0x27')][_0x1644e1];});}else{loggerBooked[_0xa580('0x7f')]('[booked][checkContactBlack][else]',JSON[_0xa580('0x4a')](_0x34a589[_0xa580('0x129')]),_0xa580('0x1dd'),_0x34a589[_0xa580('0x3e')]);_0x8d060c['updateOriginated'](_0x34a589);_0x8d060c[_0xa580('0xc2')]({'active':![],'ContactId':_0x8d060c[_0xa580('0x27')][_0x1644e1][_0xa580('0xd3')],'ListId':_0x8d060c[_0xa580('0x27')][_0x1644e1][_0xa580('0xd4')],'VoiceQueueId':_0x8d060c[_0xa580('0x27')][_0x1644e1]['VoiceQueueId']||undefined,'CampaignId':_0x8d060c[_0xa580('0x27')][_0x1644e1]['CampaignId']||undefined})[_0xa580('0xb7')](loggerCatch(_0xa580('0x1dc')));delete _0x8d060c[_0xa580('0x27')][_0x1644e1];}}else{return _0x8d060c['actionOriginate'](_0x34a589,_0x376f76);}}else{if(getDiff(_0x376f76['scheduledat'])<_0x34a589[_0xa580('0x1de')]*0x3c){if(_0x376f76[_0xa580('0x1df')]&&!_0x376f76[_0xa580('0x1df')][_0xa580('0x1e0')]){_0x8d060c[_0xa580('0x95')]['run'](_0x376f76['id'])[_0xa580('0x1f')](function(){_0x8d060c['updateOriginated'](_0x34a589);});}else{_0x8d060c[_0xa580('0xc3')]({'active':![]},_0x376f76['id'],0x1)[_0xa580('0x1f')](function(){console[_0xa580('0x1e1')](_0xa580('0x1e2'));_0x8d060c[_0xa580('0xb8')](_0x34a589);});}}else{_0x34a589['outboundReCallsDay']+=0x1;_0x8d060c['updateOriginated'](_0x34a589);if(_0x34a589['dialRecallInQueue']){_0x8d060c['rescheduleContact']({'active':![],'recallme':![],'UserId':null,'ContactId':_0x376f76['ContactId'],'ListId':_0x376f76[_0xa580('0xd4')],'VoiceQueueId':_0x376f76[_0xa580('0xfd')]||undefined,'CampaignId':_0x376f76['CampaignId']||undefined})[_0xa580('0xb7')](loggerCatch(_0xa580('0x1e3')));_0x8d060c['createHistory'](createObjHistory(_0x34a589,_0x376f76,_0xa580('0x1e4'),0x17,_0xa580('0x1e5')))[_0xa580('0xb7')](loggerCatch(_0xa580('0x1e6')));}else{_0x8d060c[_0xa580('0xd1')](createObjHistory(_0x34a589,_0x376f76,_0xa580('0x1e7'),0x16,_0xa580('0x1e8')),_0xa580('0x1e9'),_0xa580('0x1ea'));}}}}else{_0x34a589[_0xa580('0x61')]+=0x1;_0x8d060c[_0xa580('0xd1')](createObjHistory(_0x34a589,_0x376f76,'BLACKLIST',0xd,_0xa580('0x1eb')),_0xa580('0x1ec'),_0xa580('0x1ed'));throw'inBlackList';}};};Dialer[_0xa580('0x1c')][_0xa580('0x157')]=function(_0x5dd296){var _0x4cc3f5=this;var _0x4397a5=[];var _0x466447=_0x5dd296['limitCalls']-_0x5dd296[_0xa580('0x72')]-_0x5dd296[_0xa580('0x1ee')];emitCampaignSummary(_0x5dd296);if(_0x466447>0x0){if(_0x466447>this[_0xa580('0x25')]){_0x466447=this['maxNumberOriginate'];}_0x5dd296[_0xa580('0x1ee')]+=_0x466447;this[_0xa580('0xc7')](_0x5dd296['id'],_0x466447,_0x5dd296[_0xa580('0x1ef')])[_0xa580('0xbd')](function(_0x2b9685){_0x5dd296['temp']-=_0x466447;_0x5dd296['temp']=_0x5dd296[_0xa580('0x1ee')]>0x0?_0x5dd296['temp']:0x0;if(!checkContactEmpty(_0x2b9685)){_0x5dd296['message']=_0xa580('0xa3');logger['info'](_0xa580('0x1f0')+_0x5dd296[_0xa580('0x3e')]);}else{_0x5dd296[_0xa580('0x72')]+=_0x2b9685[_0xa580('0x9c')];_0x5dd296[_0xa580('0x42')]='RUNNING';for(var _0x32d235=0x0;_0x32d235<_0x2b9685[_0xa580('0x9c')];_0x32d235+=0x1){_0x5dd296[_0xa580('0x1f1')]+=0x1;if(_[_0xa580('0xb4')](_0x2b9685[_0x32d235])||_[_0xa580('0xb4')](_0x2b9685[_0x32d235][_0xa580('0x164')])||_[_0xa580('0xb4')](_0x2b9685[_0x32d235][_0xa580('0x164')][_0xa580('0x165')])){_0x4cc3f5['emptyContact'](_0xa580('0x1f2'),_0x5dd296,_0x2b9685[_0x32d235]);}else{_0x4cc3f5['checkIsBlackListIvr'](_[_0xa580('0xd2')](_0x2b9685[_0x32d235],[_0xa580('0xd5'),_0xa580('0x1f3')]))[_0xa580('0xbd')](_0x4cc3f5['checkContactBlack'](_0x5dd296,_0x2b9685[_0x32d235]))[_0xa580('0xb7')](_0x4cc3f5[_0xa580('0xcf')](_0xa580('0x1f4'),_0x5dd296));}}}})['catch'](loggerGetContactDialer(_0xa580('0x1f5'),_0x5dd296,_0x466447));}};Dialer[_0xa580('0x1c')][_0xa580('0x153')]=function(_0x443823,_0x52ede9){var _0x2e899a=this;var _0x4634ee=[];var _0x52d0d6=_0x52ede9>=0x1?_0x52ede9:0x1;var _0x44909c=[];if(_0x443823[_0xa580('0x14f')]===_0xa580('0x8')){_0x52d0d6=0x1;}var _0x483646=Math['floor'](_0x443823[_0xa580('0x52')]*_0x52d0d6)-_0x443823[_0xa580('0x72')]-_0x443823[_0xa580('0x1ee')];emitVoiceQueueSummary(_0x443823);if(_0x443823['dialLimitQueue']>0x0){var _0x1b53f1=_0x443823[_0xa580('0x1f6')]-_0x443823['originated']-_0x443823['talking']-_0x443823[_0xa580('0x1ee')]-_0x443823[_0xa580('0x54')];if(_0x483646>_0x1b53f1){_0x483646=_0x1b53f1;}}if(_0x483646>0x0){if(_0x443823['dialMethod']===_0xa580('0x8')){_0x483646=0x1;}if(_0x483646>this[_0xa580('0x25')]){_0x483646=this['maxNumberOriginate'];}_0x443823['temp']+=_0x483646;for(var _0x29c405 in this['agents']){if(this[_0xa580('0x23')]['hasOwnProperty'](_0x29c405)){if(this[_0xa580('0x23')][_0x29c405][_0xa580('0xe4')]==='not_inuse'&&this[_0xa580('0x23')][_0x29c405]['status']==='reachable'){_0x4634ee['push'](this[_0xa580('0x23')][_0x29c405]['id']);}}}this[_0xa580('0xc5')](_0x443823['id'],_0x4634ee,_0x483646,_0x443823[_0xa580('0x1ef')])[_0xa580('0xbd')](function(_0x29d231){_0x443823[_0xa580('0x1ee')]-=_0x483646;_0x443823['temp']=_0x443823[_0xa580('0x1ee')]>0x0?_0x443823[_0xa580('0x1ee')]:0x0;if(!checkContactEmpty(_0x29d231)){_0x2e899a[_0xa580('0x1f7')](_0x443823)[_0xa580('0xbd')](sendMessageReschedule(_0x443823))['catch'](loggerCatch(_0xa580('0x1f8')));}else{_0x443823[_0xa580('0x72')]+=_0x29d231['length'];_0x443823['message']=_0x443823[_0xa580('0x14f')]===_0xa580('0x8')?_0xa580('0x1f9'):'RUNNING';for(var _0x1db23e=0x0;_0x1db23e<_0x29d231[_0xa580('0x9c')];_0x1db23e+=0x1){if(_[_0xa580('0xb4')](_0x29d231[_0x1db23e])||_[_0xa580('0xb4')](_0x29d231[_0x1db23e][_0xa580('0x164')])||_['isNil'](_0x29d231[_0x1db23e]['Contact'][_0xa580('0x165')])){_0x2e899a[_0xa580('0x1fa')](_0xa580('0x1f2'),_0x443823,_0x29d231[_0x1db23e]);}else{_0x2e899a[_0xa580('0x1fb')](_[_0xa580('0xd2')](_0x29d231[_0x1db23e],[_0xa580('0xfd'),_0xa580('0x1f3')]))[_0xa580('0xbd')](_0x2e899a[_0xa580('0x1d7')](_0x443823,_0x29d231[_0x1db23e]))[_0xa580('0xb7')](_0x2e899a[_0xa580('0xcf')](_0xa580('0x1f2'),_0x443823));}}}})[_0xa580('0xb7')](loggerGetContactDialer(_0xa580('0x1fc'),_0x443823,_0x483646));}};Dialer[_0xa580('0x1c')]['handlePredictive']=function(_0x1c4c78){var _0x32ba9d=this;if(_0x1c4c78[_0xa580('0x1f6')]>0x0){var _0x46687d=_0x1c4c78['dialLimitQueue']-_0x1c4c78['originated']-_0x1c4c78['talking'];if(_0x46687d>0x0){this[_0xa580('0x1fd')](_0x1c4c78);}else{loggerPredictiveCalls[_0xa580('0x7f')](_0xa580('0x1fe'));}}else{this[_0xa580('0x1fd')](_0x1c4c78);}};Dialer[_0xa580('0x1c')][_0xa580('0x1fd')]=function(_0x34afe4){var _0x579ac0=this;var _0x3f764e=[];_0x34afe4['originated']+=0x1;for(var _0x7b3d8e in this[_0xa580('0x23')]){if(this[_0xa580('0x23')]['hasOwnProperty'](_0x7b3d8e)){if(this[_0xa580('0x23')][_0x7b3d8e][_0xa580('0xe4')]===_0xa580('0x1ff')&&this['agents'][_0x7b3d8e][_0xa580('0xb6')]===_0xa580('0x200')){_0x3f764e[_0xa580('0x127')](this[_0xa580('0x23')][_0x7b3d8e]['id']);}}}this[_0xa580('0xc5')](_0x34afe4['id'],_0x3f764e,0x1,_0x34afe4[_0xa580('0x1ef')])[_0xa580('0xbd')](function(_0x387e10){if(!checkContactEmpty(_0x387e10)){checkContactLowerLimitOriginate(_0x34afe4,0x1,0x0);_0x579ac0[_0xa580('0x1f7')](_0x34afe4)[_0xa580('0xbd')](sendMessageReschedule(_0x34afe4))['catch'](loggerCatch(_0xa580('0x1f8')));}else{_0x34afe4[_0xa580('0x42')]=_0xa580('0x201');if(_[_0xa580('0xb4')](_0x387e10[0x0])||_[_0xa580('0xb4')](_0x387e10[0x0][_0xa580('0x164')])||_[_0xa580('0xb4')](_0x387e10[0x0][_0xa580('0x164')][_0xa580('0x165')])){_0x579ac0[_0xa580('0x1fa')](_0xa580('0x1f2'),_0x34afe4,_0x387e10[0x0]);}else{_0x579ac0['checkIsBlackList'](_[_0xa580('0xd2')](_0x387e10[0x0],[_0xa580('0xfd'),_0xa580('0x1f3')]))['then'](_0x579ac0['checkContactBlack'](_0x34afe4,_0x387e10[0x0]))[_0xa580('0xb7')](_0x579ac0[_0xa580('0xcf')](_0xa580('0x202'),_0x34afe4));}}})[_0xa580('0xb7')](loggerGetContactDialer(_0xa580('0x203'),_0x34afe4,0x1));emitVoiceQueueSummary(_0x34afe4);};Dialer[_0xa580('0x1c')][_0xa580('0x1cc')]=function(_0x580ba6,_0x10a939,_0x8a3016,_0x58d682,_0x4f62a3,_0x24b64b){loggerPredictive[_0xa580('0x7f')]('--------\x20Drop\x20Rate\x20--------');loggerPredictive['info'](_0xa580('0x204'),_0x580ba6);loggerPredictive[_0xa580('0x7f')](_0xa580('0x205'),_0x10a939);loggerPredictive[_0xa580('0x7f')](_0xa580('0x206'),_0x8a3016);loggerPredictive[_0xa580('0x7f')]('P:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x58d682);loggerPredictive[_0xa580('0x7f')](_0xa580('0x207'),_0x4f62a3);loggerPredictive[_0xa580('0x7f')](_0xa580('0x89'));return new BPromise(function(_0x13cc22,_0xaccc27){if(_0x580ba6<=0x0||isNaN(_0x580ba6)){return _0xaccc27(msgResponse(_0xa580('0x208'),_0xa580('0x49'),_0xa580('0x209')+_0x580ba6));}if(_0x8a3016<=0x0||isNaN(_0x8a3016)){return _0xaccc27(msgResponse(_0xa580('0x208'),_0xa580('0x49'),_0xa580('0x20a')+_0x8a3016));}if(_0x58d682<=0x0||isNaN(_0x58d682)){return _0xaccc27(msgResponse(_0xa580('0x208'),'Error',_0xa580('0x20b')+_0x58d682));}if(_0x10a939<=0x0||isNaN(_0x10a939)){return _0xaccc27(msgResponse(_0xa580('0x208'),_0xa580('0x49'),_0xa580('0x20c')+_0x10a939));}if(_0x4f62a3<=0x0||isNaN(_0x4f62a3)){return _0xaccc27(msgResponse(_0xa580('0x208'),'Error','Amax\x20=\x20'+_0x4f62a3));}_0x24b64b=_0x24b64b||0x0;var _0x2402de=0x1/_0x8a3016;var _0x115d68=0x0;var _0x18b975=0x0;var _0x88050f=0x0;var _0xe40498=0x0;for(var _0x628c93=0x0;_0x88050f<_0x4f62a3;_0x628c93+=0x1){_0x18b975=_0x628c93/_0x10a939;_0x115d68=(_0x58d682*_0x18b975+_0x24b64b)/_0x2402de;_0x88050f=erlangb(_0x115d68,_0x580ba6);_0xe40498=_0x115d68/_0x580ba6*(0x1-erlangb(_0x115d68,_0x580ba6));}return _0x13cc22({'erlangCalls':_0x628c93,'erlangCallToSecond':_0x10a939/_0x628c93,'erlangAbandonmentRate':_0x88050f,'erlangBusyFactor':_0xe40498});});};Dialer['prototype'][_0xa580('0x1cd')]=function(_0x2b8de3,_0x1de9ab,_0x22f30d,_0x159e8d,_0x4c9f57,_0x281f87){loggerPredictive[_0xa580('0x7f')](_0xa580('0x20d'));loggerPredictive[_0xa580('0x7f')](_0xa580('0x204'),_0x2b8de3);loggerPredictive[_0xa580('0x7f')](_0xa580('0x205'),_0x1de9ab);loggerPredictive[_0xa580('0x7f')](_0xa580('0x206'),_0x22f30d);loggerPredictive[_0xa580('0x7f')](_0xa580('0x20e'),_0x159e8d);loggerPredictive[_0xa580('0x7f')]('Umin:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x4c9f57);loggerPredictive[_0xa580('0x7f')](_0xa580('0x89'));return new BPromise(function(_0x116acc,_0x2d66fb){if(_0x2b8de3<=0x0||isNaN(_0x2b8de3)){return _0x2d66fb(msgResponse(_0xa580('0x20f'),'Error',_0xa580('0x209')+_0x2b8de3));}if(_0x22f30d<=0x0||isNaN(_0x22f30d)){return _0x2d66fb(msgResponse(_0xa580('0x20f'),'Error',_0xa580('0x20a')+_0x22f30d));}if(_0x159e8d<=0x0||isNaN(_0x159e8d)){return _0x2d66fb(msgResponse('[busyFactor]',_0xa580('0x49'),_0xa580('0x20b')+_0x159e8d));}if(_0x1de9ab<=0x0||isNaN(_0x1de9ab)){return _0x2d66fb(msgResponse('[busyFactor]',_0xa580('0x49'),_0xa580('0x20c')+_0x1de9ab));}if(_0x4c9f57<=0x0||isNaN(_0x4c9f57)){return _0x2d66fb(msgResponse(_0xa580('0x20f'),_0xa580('0x49'),_0xa580('0x210')+_0x4c9f57));}_0x281f87=_0x281f87||0x0;var _0x11d4f6=0x1/_0x22f30d;var _0x46c7da=0x0;var _0x338b57=0x0;var _0x205b11=0x0;var _0x319a6e=0x0;for(var _0x4051cf=0x0;_0x319a6e<_0x4c9f57;_0x4051cf+=0x1){_0x338b57=_0x4051cf/_0x1de9ab;_0x46c7da=(_0x159e8d*_0x338b57+_0x281f87)/_0x11d4f6;_0x205b11=erlangb(_0x46c7da,_0x2b8de3);_0x319a6e=_0x46c7da/_0x2b8de3*(0x1-erlangb(_0x46c7da,_0x2b8de3));}return _0x116acc({'erlangCalls':_0x4051cf,'erlangCallToSecond':_0x1de9ab/_0x4051cf,'erlangAbandonmentRate':_0x205b11,'erlangBusyFactor':_0x319a6e});});};module[_0xa580('0x211')]=Dialer; \ No newline at end of file +var _0x497d=['[getContactDialer]\x20','getContactDialerIvr','getVoiceQueueRtPauses','[getVoiceQueueRtPauses]\x20','moveContactManagedDialer','[moveContactManagedDialer]\x20','[createHistory]\x20','[updateOriginated]\x20object\x20originated\x20is\x20negative','[updateOriginated]\x20is\x20null\x20or\x20undefined','loggerHandler','emptyContact','notFound','merge','pick','ListId','UserId','VoiceQueueId','CampaignId','[emptyContact][createHistory]','[emptyContact]','isSuccess','Success','isTrunkReachable','SIP/%s','unmonitored','saveInDb','createHistory','uniqueid','variable','amdstatus','xcally-motion-dialer','HANGUP','outboundAnswerCallsDay','membername','AMD','[syncHangupInAMD]','dialAMDActive','MACHINE','Machine','countglobal','amd','[syncAgentComplete][createHistory][0]','countbusyretry','countcongestionretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','dialGlobalMaxRetry','stateGlobal','reason19\x20machine....','dialMachineMaxRetry','reason\x2019\x20machine....','add','dialMachineRetryFrequency','YYYY-MM-DD\x20HH:mm:ss','ContactId','[rescheduleContact][Machine]','value','HangupInAMD','countnoanswerretry','createStateFinal','minutes','ivrAnswerCallsDay','[syncHangupIvr][createHistory]','dialQueueProject','AnswerAGI','AGI','[syncHangupIvr]','cause-txt','Unknow','reason','agent','agiafterat','dialQueueProject2','dialAgiAfterHangupAgent','[syncAgentComplete][createHistory]','syncAgentConnect','queueCallerAbandonCreateState','[syncQueueCallerAbandon]\x20[Drop]','droptime','responsetime','dialQueueTimeout','outboundDropCallsDayTimeout','TIMEOUT','dialDropRetryFrequency','[rescheduleContact][Drop]','Drop','calleridname','calleridnum','[syncAgentComplete][createHistory][10]','Abandoned','dropreason','dialAbandonedRetryFrequency','[rescheduleContact][Abandoned]','[syncAgentComplete][createHistory][11]','syncNewExten','syncQueueMember','actionid','stateinterface','locked','rrmemory','push','idHopper','queueStatusComplete','[unlockQueueStatus][undefined]','[booked][unlockQueueStatus]','[Catch][Preview][syncQueueStatusComplete]','_rr','paused','unlockRR','[booked][RR]','Agent:\x20','contactAgent-idHopper:\x20','[booked][RR][finaly]','[booked][unlock]','[booked][unlock2]','[booked][unlock3]','loopCampaigns','syncCampaigns','TRUNK_IS_NOT_REACHABLE','checkIfTime','ifTime','checkIfTimeIntervals','\x20Intervals\x20is\x20null\x20','\x20Intervals\x20is\x20empty\x20','timezones','TIMEZONE_UNKNOW','Failure','\x20Timezone\x20unknow\x20','command','iftime\x20%s,%s','interval','content','indexOf','true','all','GLOBAL_INTERVAL_IS_OVERTIME','INTERVAL_IS_OVERTIME','[ifTime][promiseAll]','\x20Interval\x20is\x20overtime:\x20','Timezone:\x20','checkDialMethod','handlePower','power','Queue','method\x20not\x20recognized','launchHandleIvr','handleIvr','checkIsTrunkReachable','dialGlobalInterval','dialTimezone','[syncQueueSummary]','active','[syncCampaigns]','\x5cw{0,','pow','replace','random','match','actionOriginate','object','originate','voiceQueue\x20is\x20undefine','Contact','phone','contact\x20is\x20undefine','getCaller','\x22agi://%s/square,%s\x22','NONE','outbound','\x22%s,%s%s,,,%s\x22','XMD-AMDINITIALSILENCE','dialAMDInitialSilence','XMD-AMDGREETING','dialAMDGreeting','XMD-AMDAFTERGREETINGSILENCE','dialAMDAfterGreetingSilence','XMD-AMDTOTALANALYSISTIME','dialAMDTotalAnalysisTime','XMD-AMDMINWORDLENGTH','dialAMDMinWordLength','XMD-AMDBETWEENWORDSSILENCE','dialAMDBetweenWordsSilence','XMD-AMDMAXIMUMNUMBEROFWORDS','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','XMD-AMDMAXIMUMWORDLENGTH','dialAMDMaximumWordLength','XMD-VOICEQUEUEID','createdAt','updatedAt','%s%s','toUpper','dialOriginateCallerIdName','dialRandomLastDigitCallerIdNumber','TrunkBackup','XMD-ORIGINATECALLERIDNAME','originatecalleridname','XMD-ORIGINATECALLERIDNUM','trim','substring','dialCutDigit','SIP/%s/%s%s','dialPrefix','from-sip','[originateError]:\x20%s','[originate][error]','getQueue','callProgressDetecting','[callProgressDetecting]\x20','checkRetriveMax','dialNoAnswerRetryFrequency','[rescheduleContact][NoAnswer]','dialBusyMaxRetry','[rescheduleContact]\x20[Busy]','dialCongestionMaxRetry','dialCongestionRetryFrequency','[rescheduleContact]\x20[Congestion]','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialAbandonedMaxRetry','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','[rescheduleContact][AgentReject]','[callProgressDetecting]','entity\x20is\x20undefine','evt\x20is\x20undefine','NoSuchNumber','custom:agentnosuchnumber','buildObj','nosuchnumber','reason\x200\x20no\x20such\x20number....','NoAnswer','custom:agentnoanswer','noanswer','[syncAgentComplete][createHistory][3]','dialNoAnswerMaxRetry','reason\x203\x20ringing\x20no\x20answer','outboundBusyCallsDay','Busy','busy','[syncAgentComplete][createHistory][5]','reason\x205\x20busy','Congestion','custom:agentcongestion','congestion','[syncAgentComplete][createHistory][8]','reason\x208\x20congestion','outboundAbandonedCallsDay','reason\x2011\x20abandoned','AgentReject','custom:agentreject','agentreject','reason\x2020\x20agentreject','Global','[moveContactManagedDialer][0]','contact\x20not\x20moved','dialPredictiveOptimizationPercentage','round','predictiveIntervalMinThreshold','floor','[startMethodPredictive][StartProgressive]','check\x20handlePredictive\x20is\x20not\x20undefine','collection\x20data\x20in\x20progressive\x20at','dialPredictiveInterval','predictiveIntervalErlangCallsDroppedCalls','dialPredictiveOptimization','[stopMethodPredictive][ReStartProgressive][ExceededDropInterval]','Drop\x20in\x20this\x20interval','started\x20in\x20predictive\x20at','startMethodPredictive','Predictive\x20after\x20first\x20interval','recalculate\x20predictive\x20at','getDataPredictive','Predictive\x20for\x20every\x20interval',')\x20are\x20more\x20than\x20threshold\x20(','abandonmentRate','agentBusyFactor','busyFactor','[getDataPredictive]','Unknown\x20Predictive','check\x20failure','getDataPredictiveOld','dropRate','outboundQueuePauses','[CatchErlangB]','checkContactBlack','recallme','[booked][checkContactBlack]','queueStatusComplete:\x20','Queue:\x20','[unlockOriginate][syncQueueStatusComplete]','dialRecallMeTimeout','Agent','voicePause','run','log','dialRecallInQueue','[rescheduleContact][dialRecallInQueue]','RecallInQueue','[Originate][HistoryDialRecallInQueue][historyCatch]','RECALLFAILEDTIMEOUT','RecallFailedTimeout','[Originate][HistoryRecallClose][historyCatch]','[Originate][HistoryRecallClose]','BLACKLIST','Blacklist','[Originate][MoveBlacklist]','inBlackList','limitCalls','temp','ivrTotalCallsDays','[actionOriginate]\x20','[actionOriginateIvr]\x20','[getContactCampaign2]','dialLimitQueue','not_inuse','dialOrderByScheduledAt','RUNNING','Contact.phone','[getContactDialer2]','tryOriginatePredictive','[handlePredictive][limitChannel]','reachable','[actionOriginatePredictive]\x20','[getContactDialerPredictive]','--------\x20Drop\x20Rate\x20--------','M:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Interval:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Ts:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','P:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','[abandonmentRate]','p\x20=\x20','Amax\x20=\x20','----\x20Agent\x20Busy\x20Factor\x20----','Umin:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','---------------------------','m\x20=\x20','[busyFactor]','Ts\x20=\x20','Umin\x20=\x20','exports','util','lodash','bluebird','moment','ioredis','../preview/util/util','../../../config/environment/','../../../config/logger','booked','predictive','predictiveCalls','syncQueueSummary','../ami','redis','localhost','../rpc/cmHopper','../rpc/cmHopperFinal','../rpc/cmHopperHistory','../rpc/voiceQueueRt','./action','./history','./agentComplete','./queueCallerAbandon','./hangup','env','127.0.0.1','roundrobin','prototype','enqueue','tail','finally','preview','voiceQueues','campaigns','agents','trunks','maxNumberOriginate','channels','uniqueId','optionPredictive','startProgressive','ivrOriginated','queueBooked','queueBookedRR','agentconnect','bind','queuecallerabandon','syncQueueCallerAbandon','originateresponse','syncOriginateResponse','syncAgentComplete','custom:queuesummary','hangup','syncHangup','newexten','varset','syncVarSet','queuemember','queuestatuscomplete','syncQueueStatusComplete','loopClearZombieChannels','isUndefined','message','\x20AGENTS\x20NOT\x20LOGGED','NOT_ACTIVE','name','\x20NOT\x20Active','Interval','INTERVAL_IS_NULL','\x20INTERVAL_IS_NULL','Intervals','isEmpty','[ifTime][Action]','Error','milliseconds','diff','seconds','emit','strategy','answered','available','loggedIn','pTalking','sumBillable','sumDuration','talking','total','abandoned','waiting','loggedInDb','dialActive','dialMethod','dialOriginateCallerIdNumber','dialOriginateTimeout','outboundAnswerAgiCallsDay','outboundBlacklistCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundReCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalHitRate','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalTotalCalls','originated','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','startPredictive','Trunk','callerid','stringify','md5','format','voice:queue:%s','voice_queue:save','type','ivr','campaign:save','-----\x20Stats\x20Predictive\x20---','info','Total\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Answered\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Dropped\x20Timeout:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Dropped\x20Exit:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalDroppedCallsCallersExit','AVG\x20Hold\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','AVG\x20Talk\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Avg\x20Talk\x20Time\x20is\x20not\x20enough\x20for\x20predictive','Avg\x20Hold\x20Time\x20is\x20not\x20enough\x20for\x20predictive','Total\x20Calls\x20are\x20not\x20enough\x20for\x20predictive','History\x20information\x20are\x20empty','---------\x20ErlangB\x20---------','Scheduled\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Drop\x20Rate:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Agent\x20Busy\x20Factor:\x20\x20\x20\x20\x20\x20\x20\x20\x20','clearing\x20variable\x20start\x20progressive','clearing\x20variable\x20start\x20predictive','handlePredictive','clearing\x20variable\x20handle\x20predictive','string','\x22\x22\x20<>','error','inspect','length','hasOwnProperty','[decremetOriginate]\x20object\x20originated\x20is\x20negative','contactsRescheduled','RESCHEDULED_CONTACTS','[getContactDialer2][ReScheduled]','AVAILABLE_CONTACTS_FINISHED','[getContactDialer2][Empty]','sendMessageOneNotActive','[syncQueueSummary]\x20Campaign\x20Queue:\x20','is\x20not\x20active','IS_DISACTIVED','is\x20disactive','[syncQueueSummary]\x20Campaign\x20Ivr:\x20','state','statedesc','endtime','starttime','clearZombieChannels','actions','[actions]','sequence','isNil','Action','status','channel','catch','No\x20such\x20channel','updateOriginated','queue','[Dialer][checkChannel]','[Dialer][checkChannel][ivr]','countReScheduled','resolve','then','[countReScheduled]\x20','checkIsBlackList','checkIsBlackListIvr','[checkIsBlackListIvr]\x20','averageHandleTime','avgHandleTime','rescheduleContact','[rescheduleContact]\x20','unlockContact','[unlockContact]\x20','getContactDialer'];(function(_0x313c5d,_0x27a148){var _0x413006=function(_0x2c9f49){while(--_0x2c9f49){_0x313c5d['push'](_0x313c5d['shift']());}};_0x413006(++_0x27a148);}(_0x497d,0x159));var _0xd497=function(_0x394a6d,_0xf90d2b){_0x394a6d=_0x394a6d-0x0;var _0x29ab22=_0x497d[_0x394a6d];return _0x29ab22;};'use strict';var util=require(_0xd497('0x0'));var _=require(_0xd497('0x1'));var BPromise=require(_0xd497('0x2'));var uuid=require('uuid');var moment=require(_0xd497('0x3'));var rr=require('rr');var md5=require('md5');var Redis=require(_0xd497('0x4'));var ut=require(_0xd497('0x5'));var config=require(_0xd497('0x6'));var logger=require('../../../config/logger')('dialer');var loggerBooked=require(_0xd497('0x7'))(_0xd497('0x8'));var loggerPredictive=require('../../../config/logger')(_0xd497('0x9'));var loggerPredictiveCalls=require(_0xd497('0x7'))(_0xd497('0xa'));var loggerSyncQueueSummary=require(_0xd497('0x7'))(_0xd497('0xb'));var ami=require(_0xd497('0xc'));config[_0xd497('0xd')]=_['defaults'](config[_0xd497('0xd')],{'host':_0xd497('0xe'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xd497('0xd')]));var cmHopper=require(_0xd497('0xf'));var cmHopperFinal=require(_0xd497('0x10'));var cmHopperHistory=require(_0xd497('0x11'));var cmHopperBlack=require('../rpc/cmHopperBlack');var voiceQueueRt=require(_0xd497('0x12'));var Action=require(_0xd497('0x13'));var History=require(_0xd497('0x14'));var Final=require('./final');var AgentComplete=require(_0xd497('0x15'));var QueueCallerAbandon=require(_0xd497('0x16'));var Hangup=require(_0xd497('0x17'));var ipAgi=process[_0xd497('0x18')]['XCALLY_IP_AGI']||_0xd497('0x19');var strategy={'rrmemory':'rrmemory','roundrobin':_0xd497('0x1a')};var Sequence=function(){};Sequence[_0xd497('0x1b')][_0xd497('0x1c')]=function(_0x2d17a0){this['tail']=this[_0xd497('0x1d')]?this[_0xd497('0x1d')][_0xd497('0x1e')](_0x2d17a0):_0x2d17a0();};function Dialer(_0x35cfcd,_0x216822){this['sequence']=new Sequence();this[_0xd497('0x1f')]=_0x216822;this[_0xd497('0x20')]=_0x35cfcd['voiceQueues'];this[_0xd497('0x21')]=_0x35cfcd[_0xd497('0x21')];this[_0xd497('0x22')]=_0x35cfcd[_0xd497('0x22')];this[_0xd497('0x23')]=_0x35cfcd[_0xd497('0x23')];this[_0xd497('0x24')]=config[_0xd497('0x24')]||0x2;this[_0xd497('0x25')]={};this['actions']={};this['contactsId']={};this[_0xd497('0x26')]={};this[_0xd497('0x27')]={};this['startPredictive']={};this[_0xd497('0x28')]={};this[_0xd497('0x29')]={};this[_0xd497('0x2a')]={};this[_0xd497('0x2b')]={};ami['on'](_0xd497('0x2c'),this['syncAgentConnect'][_0xd497('0x2d')](this));ami['on'](_0xd497('0x2e'),this[_0xd497('0x2f')][_0xd497('0x2d')](this));ami['on'](_0xd497('0x30'),this[_0xd497('0x31')][_0xd497('0x2d')](this));ami['on']('agentcomplete',this[_0xd497('0x32')][_0xd497('0x2d')](this));ami['on'](_0xd497('0x33'),this[_0xd497('0xb')][_0xd497('0x2d')](this));ami['on'](_0xd497('0x34'),this[_0xd497('0x35')]['bind'](this));ami['on'](_0xd497('0x36'),this['syncNewExten'][_0xd497('0x2d')](this));ami['on'](_0xd497('0x37'),this[_0xd497('0x38')][_0xd497('0x2d')](this));ami['on'](_0xd497('0x39'),this['syncQueueMember'][_0xd497('0x2d')](this));ami['on'](_0xd497('0x3a'),this[_0xd497('0x3b')]['bind'](this));this['loopCampaigns']();this[_0xd497('0x3c')]();}function isNotNull(_0x102c02){return _0x102c02!==null&&!_[_0xd497('0x3d')](_0x102c02);}function checkIsLoggedIn(_0x3c07a4,_0xe49e33){return function(){if(_0xe49e33<=0x0){_0x3c07a4[_0xd497('0x3e')]='AGENTS_NOT_LOGGED';throw _0x3c07a4['name']+_0xd497('0x3f');}};}function isActive(_0xb46ecf){return _0xb46ecf;}function checkIsActive(_0x153686,_0x2dbf6a){return function(){if(!isActive(_0x2dbf6a)){_0x153686[_0xd497('0x3e')]=_0xd497('0x40');throw _0x153686[_0xd497('0x41')]+_0xd497('0x42');}};}function checkInterval(_0x3e58a1){return function(){if(!isNotNull(_0x3e58a1[_0xd497('0x43')])){_0x3e58a1[_0xd497('0x3e')]=_0xd497('0x44');throw _0x3e58a1['name']+_0xd497('0x45');}if(!isNotNull(_0x3e58a1['Interval'][_0xd497('0x46')])){_0x3e58a1['message']='INTERVAL_IS_NULL';throw _0x3e58a1[_0xd497('0x41')]+_0xd497('0x45');}if(!isNotNull(_[_0xd497('0x47')](_0x3e58a1[_0xd497('0x43')][_0xd497('0x46')]))){_0x3e58a1[_0xd497('0x3e')]=_0xd497('0x44');throw _0x3e58a1[_0xd497('0x41')]+_0xd497('0x45');}};}function msgResponse(_0x5e423f,_0x3fa9f3,_0x9128fb){return{'action':_0x5e423f,'response':_0x3fa9f3,'message':_0x9128fb,'stack':_0x9128fb};}function myreject(_0x5e2a1a){return function(_0x544d24){return _0x5e2a1a(msgResponse(_0xd497('0x48'),_0xd497('0x49'),JSON['stringify'](_0x544d24)));};}function getSeconds(_0x3f5a46,_0xb19b60){var _0x50ccbb=moment(_0x3f5a46)[_0xd497('0x4a')](0x0);var _0x5bd2f4=moment(_0xb19b60)[_0xd497('0x4a')](0x0);return _0x50ccbb[_0xd497('0x4b')](_0x5bd2f4,_0xd497('0x4c'));}function emit(_0x381e61,_0x1c38be,_0x1c371b){io['to'](_0x381e61)[_0xd497('0x4d')](_0x1c38be,_0x1c371b);}function emitVoiceQueueSummary(_0x3d0f95){if(_0x3d0f95['type']==='outbound'){var _0x23242a={'id':_0x3d0f95['id'],'name':_0x3d0f95[_0xd497('0x41')],'strategy':_0x3d0f95[_0xd497('0x4e')],'answered':_0x3d0f95[_0xd497('0x4f')],'available':_0x3d0f95[_0xd497('0x50')],'loggedIn':_0x3d0f95[_0xd497('0x51')],'pTalking':_0x3d0f95[_0xd497('0x52')],'sumBillable':_0x3d0f95[_0xd497('0x53')],'sumDuration':_0x3d0f95[_0xd497('0x54')],'sumHoldTime':_0x3d0f95['sumHoldTime']||0x0,'talking':_0x3d0f95[_0xd497('0x55')],'total':_0x3d0f95[_0xd497('0x56')],'type':_0x3d0f95['type'],'unmanaged':_0x3d0f95['unmanaged'],'abandoned':_0x3d0f95[_0xd497('0x57')],'waiting':_0x3d0f95[_0xd497('0x58')],'loggedInDb':_0x3d0f95[_0xd497('0x59')],'dialActive':_0x3d0f95[_0xd497('0x5a')],'dialMethod':_0x3d0f95[_0xd497('0x5b')],'dialOriginateCallerIdName':_0x3d0f95['dialOriginateCallerIdName'],'dialOriginateCallerIdNumber':_0x3d0f95[_0xd497('0x5c')],'dialOriginateTimeout':_0x3d0f95[_0xd497('0x5d')],'dialPrefix':_0x3d0f95['dialPrefix'],'outboundAnswerAgiCallsDay':_0x3d0f95[_0xd497('0x5e')],'outboundAnswerCallsDay':_0x3d0f95['outboundAnswerCallsDay'],'outboundBlacklistCallsDay':_0x3d0f95[_0xd497('0x5f')],'outboundBusyCallsDay':_0x3d0f95['outboundBusyCallsDay'],'outboundCongestionCallsDay':_0x3d0f95['outboundCongestionCallsDay'],'outboundDropCallsDayACS':_0x3d0f95[_0xd497('0x60')],'outboundDropCallsDayCallersExit':_0x3d0f95[_0xd497('0x61')],'outboundDropCallsDayTimeout':_0x3d0f95['outboundDropCallsDayTimeout'],'outboundNoAnswerCallsDay':_0x3d0f95[_0xd497('0x62')],'outboundNoSuchCallsDay':_0x3d0f95[_0xd497('0x63')],'outboundOriginateFailureCallsDay':_0x3d0f95[_0xd497('0x64')],'outboundReCallsDay':_0x3d0f95[_0xd497('0x65')],'outboundRejectCallsDay':_0x3d0f95[_0xd497('0x66')],'outboundUnknownCallsDay':_0x3d0f95[_0xd497('0x67')],'predictiveIntervalAnsweredCalls':_0x3d0f95[_0xd497('0x68')],'predictiveIntervalAvgHoldtime':_0x3d0f95[_0xd497('0x69')],'predictiveIntervalAvgTalktime':_0x3d0f95[_0xd497('0x6a')],'predictiveIntervalDroppedCallsCallersExit':_0x3d0f95['predictiveIntervalDroppedCallsCallersExit'],'predictiveIntervalDroppedCallsTimeout':_0x3d0f95[_0xd497('0x6b')],'predictiveIntervalErlangCalls':_0x3d0f95[_0xd497('0x6c')],'predictiveIntervalErlangCallsDroppedCalls':_0x3d0f95['predictiveIntervalErlangCallsDroppedCalls'],'predictiveIntervalHitRate':_0x3d0f95[_0xd497('0x6d')],'predictiveIntervalMultiplicativeFactor':_0x3d0f95['predictiveIntervalMultiplicativeFactor'],'predictiveIntervalPauses':_0x3d0f95[_0xd497('0x6e')],'predictiveIntervalAvailable':_0x3d0f95[_0xd497('0x6f')],'predictiveIntervalTotalCalls':_0x3d0f95[_0xd497('0x70')],'message':_0x3d0f95['message'],'originated':_0x3d0f95[_0xd497('0x71')],'erlangCalls':_0x3d0f95[_0xd497('0x72')],'erlangCallToSecond':_0x3d0f95[_0xd497('0x73')],'erlangAbandonmentRate':_0x3d0f95[_0xd497('0x74')],'erlangBusyFactor':_0x3d0f95[_0xd497('0x75')],'startPredictive':_0x3d0f95[_0xd497('0x76')],'startProgressive':_0x3d0f95[_0xd497('0x28')]};if(_0x3d0f95[_0xd497('0x77')]){_0x23242a['Trunk']={'id':_0x3d0f95[_0xd497('0x77')]['id'],'name':_0x3d0f95[_0xd497('0x77')]['name'],'active':_0x3d0f95[_0xd497('0x77')]['active'],'callerid':_0x3d0f95[_0xd497('0x77')][_0xd497('0x78')]};}if(_0x3d0f95[_0xd497('0x43')]){_0x23242a[_0xd497('0x43')]={'id':_0x3d0f95[_0xd497('0x43')]['id'],'name':_0x3d0f95[_0xd497('0x43')][_0xd497('0x41')]};}var _0x23a9b4=md5(JSON[_0xd497('0x79')](_0x23242a));if(_0x3d0f95[_0xd497('0x7a')]!==_0x23a9b4){_0x3d0f95[_0xd497('0x7a')]=_0x23a9b4;emit(util[_0xd497('0x7b')](_0xd497('0x7c'),_0x23242a['name']),_0xd497('0x7d'),_0x23242a);}}}function emitCampaignSummary(_0x287616){if(_0x287616[_0xd497('0x7e')]===_0xd497('0x7f')){emit(util['format']('campaign:ivr:%s',_0x287616[_0xd497('0x41')]),_0xd497('0x80'),_0x287616);}}function checkGetDataPredictive(_0x2e82e8){if(isNotNull(_0x2e82e8)){if(!_['isEmpty'](_0x2e82e8)){loggerPredictive['info'](_0xd497('0x81'));loggerPredictive[_0xd497('0x82')](_0xd497('0x83'),_0x2e82e8[_0xd497('0x70')]);loggerPredictive[_0xd497('0x82')](_0xd497('0x84'),_0x2e82e8[_0xd497('0x68')]);loggerPredictive[_0xd497('0x82')](_0xd497('0x85'),_0x2e82e8[_0xd497('0x6b')]);loggerPredictive['info'](_0xd497('0x86'),_0x2e82e8[_0xd497('0x87')]);loggerPredictive[_0xd497('0x82')](_0xd497('0x88'),_0x2e82e8['predictiveIntervalAvgHoldtime']);loggerPredictive['info'](_0xd497('0x89'),_0x2e82e8[_0xd497('0x6a')]);loggerPredictive['info']('---------------------------');if(_0x2e82e8['predictiveIntervalTotalCalls']>0x0){if(!_[_0xd497('0x3d')](_0x2e82e8[_0xd497('0x6a')])&&_0x2e82e8[_0xd497('0x6a')]>0x0){return!![];}else{loggerPredictive[_0xd497('0x82')](_0xd497('0x8a'));}if(!_['isUndefined'](_0x2e82e8[_0xd497('0x69')])&&_0x2e82e8[_0xd497('0x69')]>0x0){return!![];}else{loggerPredictive[_0xd497('0x82')](_0xd497('0x8b'));}}else{loggerPredictive[_0xd497('0x82')](_0xd497('0x8c'));}}else{loggerPredictive[_0xd497('0x82')](_0xd497('0x8d'));}}else{loggerPredictive[_0xd497('0x82')](_0xd497('0x8d'));}return![];}function mergeDataErlangB(_0x50cec8){return function(_0xd36925){loggerPredictive[_0xd497('0x82')](_0xd497('0x8e'));loggerPredictive[_0xd497('0x82')](_0xd497('0x8f'),_0xd36925[_0xd497('0x72')]);loggerPredictive[_0xd497('0x82')]('One\x20call\x20every:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0xd36925['erlangCallToSecond']);loggerPredictive['info'](_0xd497('0x90'),_0xd36925[_0xd497('0x74')]);loggerPredictive[_0xd497('0x82')](_0xd497('0x91'),_0xd36925[_0xd497('0x75')]);loggerPredictive[_0xd497('0x82')](_0xd497('0x90'),_0xd36925[_0xd497('0x74')]);loggerPredictive[_0xd497('0x82')]('---------------------------');_['merge'](_0x50cec8,_0xd36925);};}function getDiff(_0xd3f1cf){var _0x2bbc81=moment()['milliseconds'](0x0);var _0x17d0d3=moment(_0xd3f1cf)['milliseconds'](0x0);return _0x2bbc81[_0xd497('0x4b')](_0x17d0d3,'seconds');}function ifInterval(_0x4f929a,_0x4b2029){if(_['isUndefined'](_0x4b2029)){return![];}if(getDiff(_0x4b2029)<_0x4f929a*0x3c){return!![];}else{return![];}}function freeVariablesPredictive(_0x3ae2ab){if(isNotNull(_0x3ae2ab)){if(!_['isUndefined'](_0x3ae2ab[_0xd497('0x28')])){_0x3ae2ab['startProgressive']=undefined;loggerPredictive[_0xd497('0x82')](_0x3ae2ab[_0xd497('0x41')],_0xd497('0x92'));}if(!_['isUndefined'](_0x3ae2ab[_0xd497('0x76')])){_0x3ae2ab[_0xd497('0x76')]=undefined;loggerPredictive[_0xd497('0x82')](_0x3ae2ab['name'],_0xd497('0x93'));}if(!_[_0xd497('0x3d')](_0x3ae2ab['handlePredictive'])){clearInterval(_0x3ae2ab[_0xd497('0x94')]);_0x3ae2ab[_0xd497('0x94')]=undefined;loggerPredictive['info'](_0x3ae2ab['name'],_0xd497('0x95'));}}}function erlangb(_0x262f4d,_0x1aea24){if(_0x1aea24===0x0){return 0x0;}var _0x10fe6a=0x1;for(var _0x4c3e74=0x1;_0x4c3e74<=_0x1aea24;_0x4c3e74+=0x1){_0x10fe6a=0x1+_0x10fe6a*_0x4c3e74/_0x262f4d;}return 0x1/_0x10fe6a;}function isVoiceQueueOutbound(_0xdd30d1){return _0xdd30d1==='outbound';}function isNotPreview(_0x1bc22e){return _0x1bc22e!==_0xd497('0x1f');}function isCampaignIvr(_0xd984b0){return _0xd984b0===_0xd497('0x7f');}function getCallerId(_0x4c1d43,_0x411de6,_0x2dfa8b){if(!_[_0xd497('0x3d')](_0x2dfa8b)&&_0xd497('0x96')===typeof _0x2dfa8b&&!_['isEmpty'](_0x2dfa8b)){if(!_[_0xd497('0x3d')](_0x411de6)&&_0xd497('0x96')===typeof _0x411de6&&!_[_0xd497('0x47')](_0x411de6)){return util[_0xd497('0x7b')]('\x22%s\x22\x20<%s>',_0x411de6,_0x2dfa8b);}return util['format']('\x22%s\x22\x20<%s>',_0x2dfa8b,_0x2dfa8b);}if(!_[_0xd497('0x3d')](_0x4c1d43)&&_0xd497('0x96')===typeof _0x4c1d43&&!_[_0xd497('0x47')](_0x4c1d43)){return _0x4c1d43;}return _0xd497('0x97');}function loggerCatchQueueSummary(_0x1372d5,_0x1b8804){return function(_0x1f673a){freeVariablesPredictive(_0x1b8804);emitVoiceQueueSummary(_0x1b8804);emitCampaignSummary(_0x1b8804);loggerSyncQueueSummary[_0xd497('0x98')](_0x1372d5,util['inspect'](_0x1f673a,{'showHidden':![],'depth':null}));};}function loggerCatchPredictive(_0x1dc391,_0x10c5d3){return function(_0x1fc42f){loggerPredictive[_0xd497('0x98')](_0x10c5d3['name'],_0x1dc391);loggerPredictive[_0xd497('0x98')](_0x1fc42f['stack']);freeVariablesPredictive(_0x10c5d3);};}function loggerCatch(_0x5a6e79){return function(_0x3f3d59){logger[_0xd497('0x98')](_0x5a6e79,util[_0xd497('0x99')](_0x3f3d59,{'showHidden':![],'depth':null}));};}function checkContactEmpty(_0x49fec9){return _0x49fec9&&!_[_0xd497('0x3d')](_0x49fec9)&&_0x49fec9[_0xd497('0x9a')]>0x0;}function decremetOriginate(_0x13643d){if(!_[_0xd497('0x3d')](_0x13643d)&&_0x13643d!==null){if(_0x13643d[_0xd497('0x9b')](_0xd497('0x71'))){if(_0x13643d[_0xd497('0x71')]>0x0){_0x13643d[_0xd497('0x71')]-=0x1;}else{logger[_0xd497('0x98')](_0xd497('0x9c'));}}}else{logger[_0xd497('0x98')]('[decremetOriginate]\x20is\x20null\x20or\x20undefined');}}function checkContactLowerLimitOriginate(_0x190ba5,_0x3b2c59,_0x43b373){if(_0x3b2c59>_0x43b373){for(var _0x10ff23=0x0;_0x10ff23<_0x3b2c59-_0x43b373;_0x10ff23+=0x1){decremetOriginate(_0x190ba5);}}}function loggerGetContactDialer(_0xb4a238,_0x1e0940,_0x5b2511){return function(_0x55ab64){checkContactLowerLimitOriginate(_0x1e0940,_0x5b2511,0x0);logger[_0xd497('0x98')](_0xb4a238,util[_0xd497('0x99')](_0x55ab64,{'showHidden':![],'depth':null}));};}function sendMessageReschedule(_0x1d2d8d){return function(_0x38b46b){if(isNotNull(_0x38b46b)&&isNotNull(_0x38b46b[0x0])){if(_0x38b46b[0x0][_0xd497('0x9d')]>0x0){_0x1d2d8d[_0xd497('0x3e')]=_0xd497('0x9e');logger[_0xd497('0x82')](_0xd497('0x9f')+_0x1d2d8d['name'],_0x38b46b[0x0][_0xd497('0x9d')],'contacts');}else{_0x1d2d8d[_0xd497('0x3e')]=_0xd497('0xa0');logger[_0xd497('0x82')](_0xd497('0xa1')+_0x1d2d8d[_0xd497('0x41')]);}}};}function notSendMessagesQueue(_0x2df6bf){if(_0x2df6bf[_0xd497('0xa2')]){freeVariablesPredictive(_0x2df6bf);if(_0x2df6bf[_0xd497('0x71')]===0x0&&_0x2df6bf[_0xd497('0x55')]===0x0&&_0x2df6bf['waiting']===0x0&&(_0x2df6bf[_0xd497('0x52')]||0x0)===0x0){_0x2df6bf[_0xd497('0xa2')]=![];_0x2df6bf[_0xd497('0x50')]=0x0;_0x2df6bf[_0xd497('0x3e')]=_0xd497('0x40');loggerSyncQueueSummary[_0xd497('0x98')](_0xd497('0xa3'),_0x2df6bf[_0xd497('0x41')],_0xd497('0xa4'));}else{_0x2df6bf[_0xd497('0x3e')]=_0xd497('0xa5');loggerSyncQueueSummary[_0xd497('0x98')](_0xd497('0xa3'),_0x2df6bf[_0xd497('0x41')],_0xd497('0xa6'));}emitVoiceQueueSummary(_0x2df6bf);}}function notSendMessagesCampaign(_0xe33105){if(_0xe33105[_0xd497('0xa2')]){if(_0xe33105['originated']===0x0){_0xe33105[_0xd497('0xa2')]=![];_0xe33105[_0xd497('0x3e')]='NOT_ACTIVE';loggerSyncQueueSummary[_0xd497('0x98')](_0xd497('0xa7'),_0xe33105[_0xd497('0x41')],_0xd497('0xa4'));}else{_0xe33105['message']='IS_DISACTIVED';loggerSyncQueueSummary[_0xd497('0x98')](_0xd497('0xa7'),_0xe33105[_0xd497('0x41')],_0xd497('0xa6'));}emitCampaignSummary(_0xe33105);}}function createObjHistory(_0x4e6cfc,_0x272a36,_0x7ab611,_0x523276,_0x2f506c){_0x4e6cfc[_0xd497('0x3e')]=_0x7ab611;var _0x51fcd6=new Action(_0x4e6cfc,_0x272a36);var _0x1fdc77=new History(_0x51fcd6);_0x1fdc77[_0xd497('0xa8')]=_0x523276;_0x1fdc77[_0xd497('0xa9')]=_0x2f506c;_0x1fdc77[_0xd497('0xaa')]=_0x51fcd6[_0xd497('0xab')];return _0x1fdc77;}Dialer[_0xd497('0x1b')]['loopClearZombieChannels']=function(){var _0x3198ba=this;setInterval(function(){_0x3198ba[_0xd497('0xac')](_0x3198ba[_0xd497('0x26')],'[uniqueid]');_0x3198ba[_0xd497('0xac')](_0x3198ba[_0xd497('0xad')],_0xd497('0xae'));},0x32c8);};Dialer['prototype'][_0xd497('0xac')]=function(_0x5cdb7e,_0x5df463){var _0x26621f=this;for(var _0x2cf507 in _0x5cdb7e){if(_0x5cdb7e['hasOwnProperty'](_0x2cf507)){this[_0xd497('0xaf')]['enqueue'](function(){if(!_[_0xd497('0xb0')](_0x5cdb7e[_0x2cf507])){return ami[_0xd497('0xb1')]({'action':_0xd497('0xb2'),'channel':_0x5cdb7e[_0x2cf507][_0xd497('0xb3')]})[_0xd497('0xb4')](function(_0x592711){if(_0x592711['message']===_0xd497('0xb5')){setTimeout(function(){if(_0x5cdb7e[_0x2cf507]&&_0x5cdb7e[_0x2cf507][_0xd497('0x7e')]!=='ivr'){_0x26621f[_0xd497('0xb6')](_0x26621f[_0xd497('0x20')][_0x5cdb7e[_0x2cf507][_0xd497('0xb7')]]);logger[_0xd497('0x98')](_0xd497('0xb8'),_0x5df463,_0x2cf507,_0x5cdb7e[_0x2cf507]['queue']);delete _0x5cdb7e[_0x2cf507];}if(_0x5cdb7e[_0x2cf507]&&_0x5cdb7e[_0x2cf507]['type']==='ivr'){_0x26621f[_0xd497('0xb6')](_0x26621f[_0xd497('0x21')][_0x5cdb7e[_0x2cf507][_0xd497('0xb7')]]);logger[_0xd497('0x98')](_0xd497('0xb9'),_0x5df463,_0x2cf507,_0x5cdb7e[_0x2cf507][_0xd497('0xb7')]);delete _0x5cdb7e[_0x2cf507];}},0x2328);}});}});}}};Dialer[_0xd497('0x1b')][_0xd497('0xba')]=function(_0x1bed55){return BPromise[_0xd497('0xbb')]()[_0xd497('0xbc')](cmHopper[_0xd497('0xba')](_0x1bed55))['catch'](loggerCatch(_0xd497('0xbd')));};Dialer[_0xd497('0x1b')]['checkIsBlackList']=function(_0x1b3395){return BPromise['resolve']()[_0xd497('0xbc')](cmHopperBlack[_0xd497('0xbe')](_0x1b3395))['catch'](loggerCatch('[checkIsBlackList]\x20'));};Dialer[_0xd497('0x1b')][_0xd497('0xbf')]=function(_0x3a6db0){return BPromise['resolve']()[_0xd497('0xbc')](cmHopperBlack[_0xd497('0xbf')](_0x3a6db0))['catch'](loggerCatch(_0xd497('0xc0')));};Dialer[_0xd497('0x1b')][_0xd497('0xc1')]=function(_0x159da0){return BPromise['resolve']()[_0xd497('0xbc')](cmHopperHistory[_0xd497('0xc2')](_0x159da0))['catch'](loggerCatch('[averageHandleTime]\x20'));};Dialer['prototype'][_0xd497('0xc3')]=function(_0x582a3d){return BPromise['resolve']()['then'](cmHopper[_0xd497('0xc3')](_0x582a3d))[_0xd497('0xb4')](loggerCatch(_0xd497('0xc4')));};Dialer[_0xd497('0x1b')][_0xd497('0xc5')]=function(_0x5d0a76,_0x3ec278,_0x596f0e){return BPromise[_0xd497('0xbb')]()[_0xd497('0xbc')](cmHopper[_0xd497('0xc5')](_0x5d0a76,_0x3ec278,_0x596f0e))[_0xd497('0xb4')](loggerCatch(_0xd497('0xc6')));};Dialer[_0xd497('0x1b')]['getContactDialer']=function(_0x3a2333,_0x2dbf29,_0x1c1fae,_0x18d75a){return BPromise['resolve']()[_0xd497('0xbc')](cmHopper[_0xd497('0xc7')](_0x3a2333,_0x2dbf29,_0x1c1fae,_0x18d75a))[_0xd497('0xb4')](loggerCatch(_0xd497('0xc8')));};Dialer[_0xd497('0x1b')]['getContactDialerIvr']=function(_0x495721,_0x165d78,_0x373f8d){return BPromise[_0xd497('0xbb')]()[_0xd497('0xbc')](cmHopper[_0xd497('0xc9')](_0x495721,_0x165d78,_0x373f8d))['catch'](loggerCatch(_0xd497('0xc8')));};Dialer[_0xd497('0x1b')][_0xd497('0xca')]=function(_0x209812){return BPromise['resolve']()['then'](voiceQueueRt[_0xd497('0xca')](_0x209812))[_0xd497('0xb4')](loggerCatch(_0xd497('0xcb')));};Dialer['prototype'][_0xd497('0xcc')]=function(_0xab01db){return BPromise['resolve']()[_0xd497('0xbc')](cmHopper[_0xd497('0xcc')](_0xab01db))[_0xd497('0xb4')](loggerCatch(_0xd497('0xcd')));};Dialer[_0xd497('0x1b')]['createHistory']=function(_0x2e8450){return BPromise[_0xd497('0xbb')]()[_0xd497('0xbc')](cmHopperHistory['createHistory'](_0x2e8450))[_0xd497('0xb4')](loggerCatch(_0xd497('0xce')));};Dialer[_0xd497('0x1b')][_0xd497('0xb6')]=function(_0x4d7f40){if(!_[_0xd497('0x3d')](_0x4d7f40)&&_0x4d7f40!==null){if(_0x4d7f40['hasOwnProperty'](_0xd497('0x71'))){if(_0x4d7f40[_0xd497('0x71')]>0x0){_0x4d7f40[_0xd497('0x71')]-=0x1;}else{logger[_0xd497('0x98')](_0xd497('0xcf'));}}}else{logger[_0xd497('0x98')](_0xd497('0xd0'));}};Dialer[_0xd497('0x1b')][_0xd497('0xd1')]=function(_0x2bd7e8,_0x2d8d7c){var _0x2e7882=this;return function(_0x54f1aa){_0x2e7882[_0xd497('0xb6')](_0x2d8d7c);logger[_0xd497('0x98')](_0x2bd7e8,util[_0xd497('0x99')](_0x54f1aa,{'showHidden':![],'depth':null}));};};Dialer[_0xd497('0x1b')][_0xd497('0xd2')]=function(_0x681c1b,_0x504d85,_0x3da667){var _0x4315fc={'state':0x19,'statedesc':_0xd497('0xd3')};this[_0xd497('0xb6')](_0x504d85);this['saveInDb'](_[_0xd497('0xd4')](_0x4315fc,_[_0xd497('0xd5')](_0x3da667,['ContactId',_0xd497('0xd6'),_0xd497('0xd7'),_0xd497('0xd8'),_0xd497('0xd9')])),_0xd497('0xda'),_0xd497('0xdb'));logger[_0xd497('0x98')](_0x681c1b);};Dialer[_0xd497('0x1b')][_0xd497('0xdc')]=function(_0x4636b3){return _0x4636b3===_0xd497('0xdd');};Dialer['prototype'][_0xd497('0xde')]=function(_0x19456e){return!_['isUndefined'](_0x19456e)&&_0x19456e&&!_[_0xd497('0x3d')](_0x19456e[_0xd497('0x41')])&&!_['isUndefined'](_0x19456e['active'])&&_0x19456e['active']&&(this['trunks'][util[_0xd497('0x7b')](_0xd497('0xdf'),_0x19456e['name'])][_0xd497('0xb2')]==='reachable'||this[_0xd497('0x23')][util[_0xd497('0x7b')](_0xd497('0xdf'),_0x19456e[_0xd497('0x41')])]['status']===_0xd497('0xe0'));};Dialer['prototype'][_0xd497('0xe1')]=function(_0x14a904,_0x5c6e62,_0x2fafed){this[_0xd497('0xe2')](_0x14a904)[_0xd497('0xb4')](loggerCatch(_0x5c6e62));this[_0xd497('0xcc')](_0x14a904)['catch'](loggerCatch(_0x2fafed));};Dialer[_0xd497('0x1b')][_0xd497('0x38')]=function(_0x238445){var _0x9c1379=this['uniqueId'][_0x238445[_0xd497('0xe3')]];var _0x2ed6d4;if(!_[_0xd497('0xb0')](_0x238445)&&!_[_0xd497('0xb0')](_0x238445[_0xd497('0xe4')])&&!_[_0xd497('0xb0')](_0x238445['variable'][_0xd497('0xe5')])&&_0x238445['exten']===_0xd497('0xe6')&&_0x9c1379){if(_0x9c1379[_0xd497('0x7e')]!==_0xd497('0x7f')&&this[_0xd497('0x20')][_0x9c1379[_0xd497('0xb7')]]['dialAMDActive']&&_0x238445['value']===_0xd497('0xe7')){delete this[_0xd497('0x26')][_0x238445['uniqueid']];this[_0xd497('0xb6')](this['voiceQueues'][_0x9c1379['queue']]);this[_0xd497('0x20')][_0x9c1379[_0xd497('0xb7')]][_0xd497('0xe8')]+=0x1;this[_0xd497('0x20')][_0x9c1379[_0xd497('0xb7')]][_0xd497('0x5e')]+=0x1;_0x2ed6d4=new Hangup(_0x9c1379,_0x238445);_0x2ed6d4['state']=0x12;_0x2ed6d4[_0xd497('0xa9')]='HangupInAMD';_0x2ed6d4[_0xd497('0xe9')]=_0xd497('0xea');this[_0xd497('0xe1')](_0x2ed6d4,'[syncHangupInAMD][createHistory]',_0xd497('0xeb'));}if(_0x9c1379[_0xd497('0x7e')]!==_0xd497('0x7f')&&this[_0xd497('0x20')][_0x9c1379[_0xd497('0xb7')]][_0xd497('0xec')]&&_0x238445['value']===_0xd497('0xed')){var _0x498b5a=this;return new BPromise(function(_0x1bea56,_0x3e4782){delete _0x498b5a[_0xd497('0x26')][_0x238445[_0xd497('0xe3')]];_0x498b5a[_0xd497('0xb6')](_0x498b5a['voiceQueues'][_0x9c1379[_0xd497('0xb7')]]);_0x498b5a[_0xd497('0x20')][_0x9c1379['queue']][_0xd497('0xe8')]+=0x1;_0x498b5a['voiceQueues'][_0x9c1379[_0xd497('0xb7')]][_0xd497('0x5e')]+=0x1;var _0x3ff885=_0x498b5a[_0xd497('0x20')][_0x9c1379[_0xd497('0xb7')]];var _0x93147e=new Hangup(_0x9c1379,_0x238445);_0x93147e[_0xd497('0xa8')]=0x13;_0x93147e[_0xd497('0xa9')]=_0xd497('0xee');_0x93147e[_0xd497('0xe9')]=_0xd497('0xea');_0x93147e['countmachineretry']+=0x1;_0x93147e[_0xd497('0xef')]+=0x1;_0x93147e[_0xd497('0xf0')]=!![];_0x498b5a[_0xd497('0xe2')](_0x93147e)[_0xd497('0xb4')](loggerCatch(_0xd497('0xf1')));if(_0x93147e[_0xd497('0xf2')]+_0x93147e[_0xd497('0xf3')]+_0x93147e['countnoanswerretry']+_0x93147e[_0xd497('0xf4')]+_0x93147e[_0xd497('0xf5')]+_0x93147e[_0xd497('0xf6')]+_0x93147e[_0xd497('0xf7')]+_0x93147e[_0xd497('0xf8')]>=_0x3ff885[_0xd497('0xf9')]){_0x498b5a[_0xd497('0xfa')](_0x93147e,_0x1bea56,_0x3e4782,_0xd497('0xfb'));}else{if(_0x93147e[_0xd497('0xf7')]>=_0x3ff885[_0xd497('0xfc')]){_0x498b5a['createStateFinal'](_0x93147e,_0x1bea56,_0x3e4782,_0xd497('0xfd'));}else{_0x498b5a[_0xd497('0xc3')]({'active':![],'countmachineretry':_0x93147e[_0xd497('0xf7')],'scheduledat':moment()[_0xd497('0xfe')](_0x3ff885[_0xd497('0xff')],'minutes')['format'](_0xd497('0x100')),'ContactId':_0x93147e[_0xd497('0x101')],'ListId':_0x93147e[_0xd497('0xd6')],'VoiceQueueId':_0x93147e['VoiceQueueId']||undefined,'CampaignId':_0x93147e[_0xd497('0xd9')]||undefined})[_0xd497('0xb4')](loggerCatch(_0xd497('0x102')));_0x1bea56({'reschedule':0x1});}}});}if(_0x9c1379[_0xd497('0x7e')]===_0xd497('0x7f')&&this['campaigns'][_0x9c1379['queue']]['dialAMDActive']&&_0x238445[_0xd497('0x103')]===_0xd497('0xe7')){delete this[_0xd497('0x26')][_0x238445[_0xd497('0xe3')]];this[_0xd497('0xb6')](this[_0xd497('0x21')][_0x9c1379[_0xd497('0xb7')]]);_0x2ed6d4=new Hangup(_0x9c1379,_0x238445);_0x2ed6d4[_0xd497('0xa8')]=0x12;_0x2ed6d4[_0xd497('0xa9')]=_0xd497('0x104');_0x2ed6d4[_0xd497('0xe9')]='AMD';this[_0xd497('0xe1')](_0x2ed6d4,'[syncHangupInAMDIvr][createHistory]','[syncHangupInAMDIvr]');}if(_0x9c1379[_0xd497('0x7e')]===_0xd497('0x7f')&&this[_0xd497('0x21')][_0x9c1379[_0xd497('0xb7')]][_0xd497('0xec')]&&_0x238445[_0xd497('0x103')]===_0xd497('0xed')){var _0x498b5a=this;return new BPromise(function(_0x293829,_0x43c6ff){delete _0x498b5a[_0xd497('0x26')][_0x238445[_0xd497('0xe3')]];_0x498b5a[_0xd497('0xb6')](_0x498b5a[_0xd497('0x21')][_0x9c1379['queue']]);_0x498b5a[_0xd497('0x21')][_0x9c1379[_0xd497('0xb7')]][_0xd497('0xe8')]+=0x1;_0x498b5a[_0xd497('0x21')][_0x9c1379[_0xd497('0xb7')]][_0xd497('0x5e')]+=0x1;var _0x3ba5e0=_0x498b5a['campaigns'][_0x9c1379[_0xd497('0xb7')]];var _0x535185=new Hangup(_0x9c1379,_0x238445);_0x535185[_0xd497('0xa8')]=0x13;_0x535185['statedesc']='Machine';_0x535185[_0xd497('0xe9')]=_0xd497('0xea');_0x535185['countmachineretry']+=0x1;_0x535185['countglobal']+=0x1;_0x535185[_0xd497('0xf0')]=!![];_0x498b5a[_0xd497('0xe2')](_0x535185)[_0xd497('0xb4')](loggerCatch(_0xd497('0xf1')));if(_0x535185[_0xd497('0xf2')]+_0x535185[_0xd497('0xf3')]+_0x535185[_0xd497('0x105')]+_0x535185[_0xd497('0xf4')]+_0x535185[_0xd497('0xf5')]+_0x535185[_0xd497('0xf6')]+_0x535185[_0xd497('0xf7')]+_0x535185['countagentrejectretry']>=_0x3ba5e0['dialGlobalMaxRetry']){_0x498b5a[_0xd497('0xfa')](_0x535185,_0x293829,_0x43c6ff,_0xd497('0xfb'));}else{if(_0x535185[_0xd497('0xf7')]>=_0x3ba5e0[_0xd497('0xfc')]){_0x498b5a[_0xd497('0x106')](_0x535185,_0x293829,_0x43c6ff,_0xd497('0xfd'));}else{_0x498b5a[_0xd497('0xc3')]({'active':![],'countmachineretry':_0x535185[_0xd497('0xf7')],'scheduledat':moment()[_0xd497('0xfe')](_0x3ba5e0[_0xd497('0xff')],_0xd497('0x107'))[_0xd497('0x7b')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x535185[_0xd497('0x101')],'ListId':_0x535185[_0xd497('0xd6')],'VoiceQueueId':_0x535185[_0xd497('0xd8')]||undefined,'CampaignId':_0x535185[_0xd497('0xd9')]||undefined})[_0xd497('0xb4')](loggerCatch(_0xd497('0x102')));_0x293829({'reschedule':0x1});}}});}}};Dialer[_0xd497('0x1b')]['syncHangup']=function(_0x3e85f7){var _0x29019f=this[_0xd497('0x26')][_0x3e85f7['uniqueid']];var _0x366ee4=this;var _0x458276;if(_0x29019f&&_0x29019f['type']===_0xd497('0x7f')){delete this[_0xd497('0x26')][_0x3e85f7[_0xd497('0xe3')]];this[_0xd497('0xb6')](this[_0xd497('0x21')][_0x29019f[_0xd497('0xb7')]]);this[_0xd497('0x21')][_0x29019f[_0xd497('0xb7')]][_0xd497('0x108')]+=0x1;_0x458276=new Hangup(_0x29019f,_0x3e85f7);this['createHistory'](_0x458276)[_0xd497('0xb4')](loggerCatch(_0xd497('0x109')));this[_0xd497('0xcc')](_0x458276)[_0xd497('0xb4')](loggerCatch('[syncHangupIvr]'));}if(_0x29019f&&_0x29019f[_0xd497('0x7e')]!=='ivr'&&isNotNull(this[_0xd497('0x20')][_0x29019f[_0xd497('0xb7')]][_0xd497('0x10a')])){delete this[_0xd497('0x26')][_0x3e85f7[_0xd497('0xe3')]];this[_0xd497('0xb6')](this[_0xd497('0x20')][_0x29019f[_0xd497('0xb7')]]);this[_0xd497('0x20')][_0x29019f[_0xd497('0xb7')]][_0xd497('0xe8')]+=0x1;this['voiceQueues'][_0x29019f[_0xd497('0xb7')]]['outboundAnswerAgiCallsDay']+=0x1;_0x458276=new Hangup(_0x29019f,_0x3e85f7);_0x458276[_0xd497('0xa8')]=0x10;_0x458276[_0xd497('0xa9')]=_0xd497('0x10b');_0x458276['membername']=_0xd497('0x10c');this[_0xd497('0xe2')](_0x458276)['catch'](loggerCatch(_0xd497('0x109')));this['moveContactManagedDialer'](_0x458276)[_0xd497('0xb4')](loggerCatch(_0xd497('0x10d')));}if(_0x29019f&&_0x29019f[_0xd497('0x7e')]!=='ivr'&&!isNotNull(this['voiceQueues'][_0x29019f[_0xd497('0xb7')]][_0xd497('0x10a')])){delete this[_0xd497('0x26')][_0x3e85f7['uniqueid']];this[_0xd497('0xb6')](this['voiceQueues'][_0x29019f['queue']]);this[_0xd497('0x20')][_0x29019f[_0xd497('0xb7')]]['outboundUnknownCallsDay']+=0x1;_0x458276=new Hangup(_0x29019f,_0x3e85f7);_0x458276[_0xd497('0xa8')]=0xc;_0x458276[_0xd497('0xa9')]=_0x3e85f7[_0xd497('0x10e')];_0x458276['membername']=_0xd497('0x10f');this[_0xd497('0xe2')](_0x458276)['catch'](loggerCatch(_0xd497('0x109')));this[_0xd497('0xcc')](_0x458276)[_0xd497('0xb4')](loggerCatch(_0xd497('0x10d')));}};Dialer[_0xd497('0x1b')][_0xd497('0x32')]=function(_0x21bb57){var _0x116866=this[_0xd497('0x26')][_0x21bb57['uniqueid']];var _0x1f789a=this;if(this[_0xd497('0x20')][_0x21bb57['queue']]){if(_0x116866&&_0x116866[_0xd497('0x7e')]!==_0xd497('0x7f')){delete this[_0xd497('0x26')][_0x21bb57[_0xd497('0xe3')]];this[_0xd497('0x20')][_0x21bb57[_0xd497('0xb7')]][_0xd497('0xe8')]+=0x1;var _0x263955=new AgentComplete(_0x116866,_0x21bb57);if(_0x21bb57[_0xd497('0x110')]===_0xd497('0x111')){_0x263955[_0xd497('0x112')]=this[_0xd497('0x20')][_0x21bb57[_0xd497('0xb7')]][_0xd497('0x113')]&&this['voiceQueues'][_0x21bb57['queue']][_0xd497('0x114')]?moment()[_0xd497('0x7b')](_0xd497('0x100')):undefined;}this[_0xd497('0xe2')](_0x263955)[_0xd497('0xb4')](loggerCatch(_0xd497('0x115')));this[_0xd497('0xcc')](_0x263955)['catch'](loggerCatch('[syncAgentComplete]'));}}};Dialer[_0xd497('0x1b')][_0xd497('0x116')]=function(_0x56f040){if(this[_0xd497('0x20')][_0x56f040[_0xd497('0xb7')]]){if(this[_0xd497('0x26')][_0x56f040['uniqueid']]&&this[_0xd497('0x26')][_0x56f040[_0xd497('0xe3')]][_0xd497('0x7e')]!==_0xd497('0x7f')){this[_0xd497('0xb6')](this[_0xd497('0x20')][_0x56f040[_0xd497('0xb7')]]);this[_0xd497('0x26')][_0x56f040[_0xd497('0xe3')]]['answertime']=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');}}};Dialer[_0xd497('0x1b')][_0xd497('0x117')]=function(_0x100a35){this[_0xd497('0xe2')](_0x100a35)['catch'](loggerCatch(_0xd497('0x115')));this['moveContactManagedDialer'](_0x100a35)[_0xd497('0xb4')](loggerCatch(_0xd497('0x118')));};Dialer[_0xd497('0x1b')][_0xd497('0x2f')]=function(_0x5745d6){var _0x4fe4ca=this[_0xd497('0x26')][_0x5745d6[_0xd497('0xe3')]];var _0x1d1d79=this;if(this[_0xd497('0x20')][_0x5745d6[_0xd497('0xb7')]]){if(_0x4fe4ca&&_0x4fe4ca[_0xd497('0x7e')]!==_0xd497('0x7f')){delete this[_0xd497('0x26')][_0x5745d6[_0xd497('0xe3')]];this['updateOriginated'](this[_0xd497('0x20')][_0x5745d6[_0xd497('0xb7')]]);_0x4fe4ca[_0xd497('0x119')]=moment()[_0xd497('0x7b')](_0xd497('0x100'));var _0x163322=new QueueCallerAbandon(_0x4fe4ca,_0x5745d6);if(getSeconds(_0x4fe4ca[_0xd497('0x119')],_0x4fe4ca[_0xd497('0x11a')])>=_0x4fe4ca[_0xd497('0x11b')]){this[_0xd497('0x20')][_0x5745d6[_0xd497('0xb7')]][_0xd497('0x6b')]+=0x1;this[_0xd497('0x20')][_0x5745d6[_0xd497('0xb7')]][_0xd497('0x11c')]+=0x1;this[_0xd497('0x20')][_0x5745d6[_0xd497('0xb7')]]['predictiveIntervalErlangCallsDroppedCalls']+=0x1;_0x163322[_0xd497('0xa8')]=0xa;_0x163322[_0xd497('0xa9')]='Drop';_0x163322['dropreason']=_0xd497('0x11d');_0x163322[_0xd497('0x112')]=this[_0xd497('0x20')][_0x5745d6[_0xd497('0xb7')]][_0xd497('0x113')]?moment()[_0xd497('0x7b')]('YYYY-MM-DD\x20HH:mm:ss'):undefined;_0x163322['countdropretry']+=0x1;_0x163322[_0xd497('0xef')]+=0x1;if(_0x163322[_0xd497('0xf5')]>=this[_0xd497('0x20')][_0x5745d6['queue']]['dialDropMaxRetry']){this[_0xd497('0x117')](_0x163322);}else{this[_0xd497('0xc3')]({'active':![],'countdropretry':_0x163322[_0xd497('0xf5')],'scheduledat':moment()[_0xd497('0xfe')](this[_0xd497('0x20')][_0x5745d6[_0xd497('0xb7')]][_0xd497('0x11e')],_0xd497('0x107'))['format'](_0xd497('0x100')),'ContactId':_0x4fe4ca[_0xd497('0x101')],'ListId':_0x4fe4ca[_0xd497('0xd6')],'VoiceQueueId':_0x4fe4ca[_0xd497('0xd8')]||undefined,'CampaignId':_0x4fe4ca[_0xd497('0xd9')]||undefined})['catch'](loggerCatch(_0xd497('0x11f')));var _0x28f3a4=new History(_0x163322);_0x28f3a4[_0xd497('0xa8')]=0xa;_0x28f3a4[_0xd497('0xa9')]=_0xd497('0x120');_0x28f3a4[_0xd497('0xab')]=moment()[_0xd497('0x7b')](_0xd497('0x100'));_0x28f3a4[_0xd497('0xaa')]=_0x28f3a4[_0xd497('0xab')];_0x28f3a4['calleridname']=_0x163322[_0xd497('0x121')];_0x28f3a4[_0xd497('0x122')]=_0x163322[_0xd497('0x122')];this['createHistory'](_0x28f3a4)[_0xd497('0xb4')](loggerCatch(_0xd497('0x123')));}}else{this[_0xd497('0x20')][_0x5745d6['queue']][_0xd497('0x87')]+=0x1;this[_0xd497('0x20')][_0x5745d6['queue']][_0xd497('0x61')]+=0x1;_0x163322[_0xd497('0xa8')]=0xb;_0x163322[_0xd497('0xa9')]=_0xd497('0x124');_0x163322[_0xd497('0x125')]='CALLEREXIT';_0x163322[_0xd497('0xf6')]+=0x1;_0x163322[_0xd497('0xef')]+=0x1;if(_0x163322[_0xd497('0xf6')]>=this['voiceQueues'][_0x5745d6[_0xd497('0xb7')]]['dialAbandonedMaxRetry']){this[_0xd497('0x117')](_0x163322);}else{this[_0xd497('0xc3')]({'active':![],'countabandonedretry':_0x163322[_0xd497('0xf6')],'scheduledat':moment()['add'](this[_0xd497('0x20')][_0x5745d6[_0xd497('0xb7')]][_0xd497('0x126')],_0xd497('0x107'))[_0xd497('0x7b')](_0xd497('0x100')),'ContactId':_0x4fe4ca[_0xd497('0x101')],'ListId':_0x4fe4ca[_0xd497('0xd6')],'VoiceQueueId':_0x4fe4ca[_0xd497('0xd8')]||undefined,'CampaignId':_0x4fe4ca[_0xd497('0xd9')]||undefined})[_0xd497('0xb4')](loggerCatch(_0xd497('0x127')));var _0x28f3a4=new History(_0x163322);_0x28f3a4['state']=0xb;_0x28f3a4[_0xd497('0xa9')]='Abandoned';_0x28f3a4[_0xd497('0xab')]=moment()[_0xd497('0x7b')](_0xd497('0x100'));_0x28f3a4[_0xd497('0xaa')]=_0x28f3a4['starttime'];_0x28f3a4['calleridname']=_0x163322['calleridname'];_0x28f3a4[_0xd497('0x122')]=_0x163322[_0xd497('0x122')];this['createHistory'](_0x28f3a4)['catch'](loggerCatch(_0xd497('0x128')));}}}}};Dialer[_0xd497('0x1b')][_0xd497('0x129')]=function(_0x507e1c){if(this[_0xd497('0xad')][_0x507e1c['uniqueid']]){this['actions'][_0x507e1c[_0xd497('0xe3')]][_0xd497('0xb3')]=_0x507e1c[_0xd497('0xb3')];}if(this['uniqueId'][_0x507e1c[_0xd497('0xe3')]]){this[_0xd497('0x26')][_0x507e1c[_0xd497('0xe3')]][_0xd497('0xb3')]=_0x507e1c[_0xd497('0xb3')];}};Dialer['prototype'][_0xd497('0x12a')]=function(_0x502246){if(strategy[this[_0xd497('0x20')][this[_0xd497('0xad')][_0x502246[_0xd497('0x12b')]][_0xd497('0xb7')]][_0xd497('0x4e')]]==='roundrobin'){if(this['actions'][_0x502246['actionid']]&&_[_0xd497('0xb0')](this[_0xd497('0xad')][_0x502246['actionid']]['locked'])&&_0x502246['status']==='1'&&_0x502246['paused']==='0'){if(this[_0xd497('0x22')][_0x502246[_0xd497('0x12c')]]){if(!this[_0xd497('0x22')][_0x502246['stateinterface']][_0xd497('0x12d')]){this[_0xd497('0x22')][_0x502246[_0xd497('0x12c')]]['locked']=!![];this['actions'][_0x502246['actionid']][_0xd497('0x12d')]=!![];this[_0xd497('0xad')][_0x502246['actionid']][_0xd497('0x12c')]=_0x502246[_0xd497('0x12c')];}}}}else if((strategy[this[_0xd497('0x20')][this[_0xd497('0xad')][_0x502246[_0xd497('0x12b')]][_0xd497('0xb7')]][_0xd497('0x4e')]]||_0xd497('0x12e'))===_0xd497('0x12e')){if(this[_0xd497('0xad')][_0x502246[_0xd497('0x12b')]]){if(this[_0xd497('0x22')][_0x502246[_0xd497('0x12c')]]){this['actions'][_0x502246[_0xd497('0x12b')]][_0xd497('0x12c')]=_0x502246['stateinterface'];if(_[_0xd497('0xb0')](this[_0xd497('0x2a')][this['actions'][_0x502246[_0xd497('0x12b')]][_0xd497('0xb7')]])){this['queueBooked'][this[_0xd497('0xad')][_0x502246[_0xd497('0x12b')]]['queue']]=[];}this['queueBooked'][this[_0xd497('0xad')][_0x502246[_0xd497('0x12b')]][_0xd497('0xb7')]][_0xd497('0x12f')](_[_0xd497('0xd4')](_[_0xd497('0xd5')](this['actions'][_0x502246[_0xd497('0x12b')]],[_0xd497('0x130'),_0xd497('0x12c')]),{'status':_0x502246[_0xd497('0xb2')],'paused':_0x502246['paused']}));}}}};function unlockQueueStatus(_0x4662f0,_0x4c554c){setTimeout(function(){if(_[_0xd497('0x3d')](_0x4662f0[_0xd497('0x131')])){loggerBooked[_0xd497('0x98')](_0xd497('0x132'),_0x4c554c);}_0x4662f0[_0xd497('0x131')]=!![];loggerBooked['info'](_0xd497('0x133'),_0x4c554c,JSON[_0xd497('0x79')](_[_0xd497('0xd5')](_0x4662f0,['name',_0xd497('0x131')])));},0x1f3);}Dialer[_0xd497('0x1b')][_0xd497('0x3b')]=function(_0xf098a0){var _0x5449e9=this;var _0x43bfbb=_0x5449e9[_0xd497('0x20')][_0x5449e9[_0xd497('0xad')][_0xf098a0[_0xd497('0x12b')]][_0xd497('0xb7')]];if(strategy[this['voiceQueues'][this[_0xd497('0xad')][_0xf098a0[_0xd497('0x12b')]][_0xd497('0xb7')]][_0xd497('0x4e')]]==='roundrobin'){if(this[_0xd497('0xad')][_0xf098a0[_0xd497('0x12b')]]&&this[_0xd497('0xad')][_0xf098a0['actionid']]['stateinterface']){this['preview']['run'](this[_0xd497('0xad')][_0xf098a0[_0xd497('0x12b')]][_0xd497('0x130')],this[_0xd497('0xad')][_0xf098a0[_0xd497('0x12b')]][_0xd497('0x12c')])[_0xd497('0xb4')](function(_0x169c6a){logger[_0xd497('0x98')](_0xd497('0x134'),util[_0xd497('0x99')](_0x169c6a,{'showHidden':![],'depth':null}));})['finally'](function(){_0x5449e9[_0xd497('0xb6')](_0x5449e9[_0xd497('0x20')][_0x5449e9[_0xd497('0xad')][_0xf098a0[_0xd497('0x12b')]][_0xd497('0xb7')]]);_0x5449e9[_0xd497('0x22')][_0x5449e9[_0xd497('0xad')][_0xf098a0[_0xd497('0x12b')]][_0xd497('0x12c')]][_0xd497('0x12d')]=![];delete _0x5449e9[_0xd497('0xad')][_0xf098a0[_0xd497('0x12b')]];unlockQueueStatus(_0x43bfbb);});}else{this[_0xd497('0xb6')](this[_0xd497('0x20')][this['actions'][_0xf098a0[_0xd497('0x12b')]][_0xd497('0xb7')]]);this['rescheduleContact']({'active':![],'ContactId':this[_0xd497('0xad')][_0xf098a0[_0xd497('0x12b')]][_0xd497('0x101')],'ListId':this['actions'][_0xf098a0[_0xd497('0x12b')]][_0xd497('0xd6')],'VoiceQueueId':this['actions'][_0xf098a0[_0xd497('0x12b')]]['VoiceQueueId']||undefined,'CampaignId':this[_0xd497('0xad')][_0xf098a0['actionid']][_0xd497('0xd9')]||undefined})[_0xd497('0xb4')](loggerCatch('[unlock][syncQueueStatusComplete]'));delete this[_0xd497('0xad')][_0xf098a0[_0xd497('0x12b')]];unlockQueueStatus(_0x43bfbb);}}else if((strategy[this['voiceQueues'][this[_0xd497('0xad')][_0xf098a0[_0xd497('0x12b')]][_0xd497('0xb7')]][_0xd497('0x4e')]]||_0xd497('0x12e'))===_0xd497('0x12e')){var _0x3bf0e4;if(this[_0xd497('0xad')][_0xf098a0[_0xd497('0x12b')]]&&!_[_0xd497('0x47')](this[_0xd497('0x2a')][this['actions'][_0xf098a0[_0xd497('0x12b')]][_0xd497('0xb7')]])){if(this[_0xd497('0x2b')][_0x5449e9[_0xd497('0xad')][_0xf098a0[_0xd497('0x12b')]][_0xd497('0xb7')]]){this[_0xd497('0x2b')][_0x5449e9['actions'][_0xf098a0[_0xd497('0x12b')]][_0xd497('0xb7')]]=this[_0xd497('0x2b')][this[_0xd497('0xad')][_0xf098a0['actionid']][_0xd497('0xb7')]]?this[_0xd497('0x2b')][this['actions'][_0xf098a0[_0xd497('0x12b')]][_0xd497('0xb7')]]:this[_0xd497('0x2a')][this[_0xd497('0xad')][_0xf098a0[_0xd497('0x12b')]][_0xd497('0xb7')]]?this['queueBooked'][this[_0xd497('0xad')][_0xf098a0[_0xd497('0x12b')]][_0xd497('0xb7')]][_0xd497('0x135')]||0x0:0x0;}this[_0xd497('0x2a')][this[_0xd497('0xad')][_0xf098a0[_0xd497('0x12b')]][_0xd497('0xb7')]][_0xd497('0x135')]=this['queueBookedRR'][this[_0xd497('0xad')][_0xf098a0[_0xd497('0x12b')]][_0xd497('0xb7')]];for(var _0x439ea3=0x0;_0x439ea3=0x0?!![]:![];})[_0xd497('0xb4')](myreject(_0x811f41)));}}else{_0x3301d6[_0xd497('0x12f')](ami[_0xd497('0xb1')]({'action':'command','command':util[_0xd497('0x7b')]('iftime\x20%s,%s',_0x51f2e6,!_[_0xd497('0x3d')](config[_0xd497('0x147')][_0x1ba51b])?_0x1ba51b:'')})[_0xd497('0xbc')](function(_0x46cfcc){return _0x46cfcc['content'][_0xd497('0x14f')](_0xd497('0x150'))>=0x0?!![]:![];})[_0xd497('0xb4')](myreject(_0x811f41)));}BPromise[_0xd497('0x151')](_0x3301d6)[_0xd497('0xbc')](function(_0x1c117f){var _0x582ef4=_['some'](_0x1c117f);if(_0x582ef4){return _0x413459(_0x582ef4);}else{_0x1c1d6c[_0xd497('0x3e')]=_0x2f8fe9?_0xd497('0x152'):_0xd497('0x153');return _0x811f41(msgResponse(_0xd497('0x154'),'Failure','Global:\x20'+_0x2f8fe9+'\x20'+_0x4041f9+_0xd497('0x155')+util[_0xd497('0x99')](_0x51f2e6,{'showHidden':![],'depth':null})+_0xd497('0x156')+_0x1ba51b));}})[_0xd497('0xb4')](function(_0x5bd20e){return _0x811f41(msgResponse(_0xd497('0x143'),_0xd497('0x149'),JSON[_0xd497('0x79')](_0x5bd20e)));});});};Dialer[_0xd497('0x1b')][_0xd497('0x157')]=function(_0x335947){var _0x18bd71=this;return function(){switch(_0x335947[_0xd497('0x5b')]){case'progressive':freeVariablesPredictive(_0x335947);_0x18bd71[_0xd497('0x158')](_0x335947,0x1);break;case _0xd497('0x159'):freeVariablesPredictive(_0x335947);_0x18bd71[_0xd497('0x158')](_0x335947,_0x335947['dialPowerLevel']);break;case _0xd497('0x9'):_0x18bd71[_0xd497('0x9')](_0x335947);break;case'booked':freeVariablesPredictive(_0x335947);_0x18bd71[_0xd497('0x158')](_0x335947,0x1);break;default:freeVariablesPredictive(_0x335947);logger[_0xd497('0x98')](_0xd497('0x15a'),_0x335947[_0xd497('0x41')],_0xd497('0x15b'));}};};Dialer[_0xd497('0x1b')][_0xd497('0x15c')]=function(_0x58e86e){var _0x516959=this;return function(){_0x516959[_0xd497('0x15d')](_0x58e86e);};};Dialer[_0xd497('0x1b')][_0xd497('0xb')]=function(_0x1dea12){var _0x49246b=this;if(isNotPreview(_0x1dea12['dialMethod'])){if(isVoiceQueueOutbound(_0x1dea12['type'])&&isActive(_0x1dea12[_0xd497('0x5a')])){_0x1dea12[_0xd497('0xa2')]=!![];BPromise[_0xd497('0xbb')]()['then'](checkIsLoggedIn(_0x1dea12,_0x1dea12[_0xd497('0x51')]))[_0xd497('0xbc')](checkIsActive(_0x1dea12,_0x1dea12[_0xd497('0x5a')]))[_0xd497('0xbc')](checkInterval(_0x1dea12))[_0xd497('0xbc')](_0x49246b[_0xd497('0x15e')](_0x1dea12))[_0xd497('0xbc')](_0x49246b[_0xd497('0x142')](_0x1dea12[_0xd497('0x15f')],_0x1dea12[_0xd497('0x160')],_0x1dea12[_0xd497('0x41')],_0x1dea12))[_0xd497('0xbc')](_0x49246b['checkIfTimeIntervals'](_0x1dea12[_0xd497('0x43')],_0x1dea12[_0xd497('0x160')],_0x1dea12[_0xd497('0x41')],_0x1dea12))[_0xd497('0xbc')](_0x49246b['checkDialMethod'](_0x1dea12))[_0xd497('0xb4')](loggerCatchQueueSummary(_0xd497('0x161'),_0x1dea12));}else{notSendMessagesQueue(_0x1dea12);}}else{freeVariablesPredictive(_0x1dea12);}};Dialer[_0xd497('0x1b')][_0xd497('0x140')]=function(){var _0x56b39e=this;var _0xae3465;for(var _0xed9a74 in this['campaigns']){if(this['campaigns'][_0xd497('0x9b')](_0xed9a74)){_0xae3465=this[_0xd497('0x21')][_0xed9a74];if(isCampaignIvr(_0xae3465['type'])&&isActive(_0xae3465[_0xd497('0x162')])){_0xae3465[_0xd497('0xa2')]=!![];BPromise[_0xd497('0xbb')]()['then'](checkIsActive(_0xae3465,_0xae3465['active']))[_0xd497('0xbc')](checkInterval(_0xae3465))[_0xd497('0xbc')](_0x56b39e[_0xd497('0x15e')](_0xae3465))[_0xd497('0xbc')](_0x56b39e[_0xd497('0x142')](_0xae3465[_0xd497('0x15f')],_0xae3465[_0xd497('0x160')],_0xae3465[_0xd497('0x41')],_0xae3465))[_0xd497('0xbc')](_0x56b39e[_0xd497('0x144')](_0xae3465[_0xd497('0x43')],_0xae3465[_0xd497('0x160')],_0xae3465[_0xd497('0x41')],_0xae3465))[_0xd497('0xbc')](_0x56b39e[_0xd497('0x15c')](_0xae3465))[_0xd497('0xb4')](loggerCatchQueueSummary(_0xd497('0x163'),_0xae3465));}else{notSendMessagesCampaign(_0xae3465);}}}};function getCallerIdRandom(_0x3f07bf,_0x19c971){var _0x429aaf,_0x1b55a1,_0x1ddfce;if(_0x19c971<=0x0){_0x19c971=0x1;}_0x429aaf=new RegExp(_0xd497('0x164')+_0x19c971+'}$');_0x1b55a1=Math[_0xd497('0x165')](0xa,_0x19c971-0x1);_0x1ddfce=Math['pow'](0xa,_0x19c971)-0x1;return util[_0xd497('0x7b')]('%s',_[_0xd497('0x166')](_0x3f07bf,_0x429aaf,_[_0xd497('0x167')](_0x1b55a1,_0x1ddfce)));}function extractCalleridName(_0x53749d){var _0x367035=_0x53749d[_0xd497('0x168')](/"(.*?)"/);return _0x367035?_0x367035[0x1]:_0x53749d;}function extractCalleridNumber(_0xd06c5b){var _0x39ef94=_0xd06c5b[_0xd497('0x168')](/<(.*?)>/);return _0x39ef94?_0x39ef94[0x1]:_0xd06c5b;}Dialer[_0xd497('0x1b')][_0xd497('0x169')]=function(_0x410793,_0x5284cd){var _0x2c8b26=this;var _0x328fc7=uuid['v4']();this[_0xd497('0xad')][_0x328fc7]=new Action(_0x410793,_0x5284cd,_0x328fc7);return new BPromise(function(_0x4b3e93,_0x3ffa9d){if(_[_0xd497('0x3d')](_0x410793)&&_0xd497('0x16a')!==typeof _0x410793){return _0x3ffa9d(msgResponse(_0xd497('0x16b'),_0xd497('0x149'),_0xd497('0x16c')));}if(_[_0xd497('0x3d')](_0x5284cd[_0xd497('0x16d')][_0xd497('0x16e')])||_0x5284cd[_0xd497('0x16d')][_0xd497('0x16e')]===null){return _0x3ffa9d(msgResponse(_0xd497('0x16b'),'Failure',_0xd497('0x16f')));}var _0x5c8c95={'XMD-CALLERID':_0x2c8b26['actions'][_0x328fc7][_0xd497('0x170')](),'XMD-AGI':_0x410793[_0xd497('0x10a')]?util[_0xd497('0x7b')](_0xd497('0x171'),ipAgi,_0x410793[_0xd497('0x10a')]):'NONE','XMD-AGIAFTER':_0x410793[_0xd497('0x113')]?util[_0xd497('0x7b')]('\x22agi://%s/square,%s\x22',ipAgi,_0x410793[_0xd497('0x113')]):_0xd497('0x172'),'XMD-QUEUE':_0x410793['type']===_0xd497('0x173')?util[_0xd497('0x7b')](_0xd497('0x174'),_0x410793[_0xd497('0x41')],_0x410793['dialQueueOptions']||'',_0x410793[_0xd497('0x114')]?'c':'',_0x410793[_0xd497('0x11b')]||0x3):_0xd497('0x172'),'XMD-CONTACTID':_0x5284cd[_0xd497('0x101')],'XMD-CDRTYPE':'dialer','CALLERID(all)':_0x2c8b26[_0xd497('0xad')][_0x328fc7][_0xd497('0x170')](),'XMD-AMD':_0x410793['dialAMDActive']?'ACTIVE':'NONE','XMD-DESTINATION':_0xd497('0xe6')};if(_0x410793[_0xd497('0xec')]){_0x5c8c95[_0xd497('0x175')]=_0x410793[_0xd497('0x176')]||0x9c4;_0x5c8c95[_0xd497('0x177')]=_0x410793[_0xd497('0x178')]||0x5dc;_0x5c8c95[_0xd497('0x179')]=_0x410793[_0xd497('0x17a')]||0x320;_0x5c8c95[_0xd497('0x17b')]=_0x410793[_0xd497('0x17c')]||0x1388;_0x5c8c95[_0xd497('0x17d')]=_0x410793[_0xd497('0x17e')]||0x64;_0x5c8c95[_0xd497('0x17f')]=_0x410793[_0xd497('0x180')]||0x32;_0x5c8c95[_0xd497('0x181')]=_0x410793[_0xd497('0x182')]||0x3;_0x5c8c95['XMD-AMDSILENCETHRESHOLD']=_0x410793[_0xd497('0x183')]||0x100;_0x5c8c95[_0xd497('0x184')]=_0x410793[_0xd497('0x185')]||0x1388;}if(_0x410793['type']===_0xd497('0x173')){_0x5c8c95[_0xd497('0x186')]=_0x5284cd[_0xd497('0xd8')];}else{_0x5c8c95['XMD-CAMPAIGNID']=_0x5284cd[_0xd497('0xd9')];}for(var _0x2638a7 in _0x5284cd[_0xd497('0x16d')]){if(_0x5284cd[_0xd497('0x16d')][_0xd497('0x9b')](_0x2638a7)){if(isNotNull(_0x5284cd[_0xd497('0x16d')][_0x2638a7])&&_0x2638a7!=='id'&&_0x2638a7!=='tags'&&_0x2638a7!==_0xd497('0x187')&&_0x2638a7!==_0xd497('0x188')){_0x5c8c95[util[_0xd497('0x7b')](_0xd497('0x189'),'XMD-',_[_0xd497('0x18a')](_0x2638a7))]=_0x5284cd[_0xd497('0x16d')][_0x2638a7];}}}var _0x2edece=_0x2c8b26['isTrunkReachable'](_0x410793[_0xd497('0x77')])?getCallerId(_0x410793['Trunk'][_0xd497('0x78')],_0x410793[_0xd497('0x18b')],_0x410793[_0xd497('0x18c')]>0x0?getCallerIdRandom(_0x410793['dialOriginateCallerIdNumber'],_0x410793[_0xd497('0x18c')]):_0x410793[_0xd497('0x5c')]):getCallerId(_['isNil'](_0x410793[_0xd497('0x18d')])?_0x410793[_0xd497('0x77')]['callerid']:_0x410793[_0xd497('0x18d')][_0xd497('0x78')],_0x410793['dialOriginateCallerIdName'],_0x410793[_0xd497('0x18c')]>0x0?getCallerIdRandom(_0x410793[_0xd497('0x5c')],_0x410793[_0xd497('0x18c')]):_0x410793['dialOriginateCallerIdNumber']);if(_0x2edece){_0x5c8c95[_0xd497('0x18e')]=_0x2c8b26[_0xd497('0xad')][_0x328fc7][_0xd497('0x18f')]=extractCalleridName(_0x2edece);_0x5c8c95[_0xd497('0x190')]=_0x2c8b26['actions'][_0x328fc7]['originatecalleridnum']=extractCalleridNumber(_0x2edece);}return ami[_0xd497('0xb1')]({'actionid':_0x328fc7,'action':'originate','channel':_0x2c8b26[_0xd497('0xde')](_0x410793[_0xd497('0x77')])?util[_0xd497('0x7b')]('SIP/%s/%s%s',_0x410793[_0xd497('0x77')][_0xd497('0x41')],isNotNull(_0x410793['dialPrefix'])?_0x410793['dialPrefix'][_0xd497('0x191')]()||'':'',_0x410793['dialCutDigit']>0x0?_0x5284cd[_0xd497('0x16d')]['phone'][_0xd497('0x192')](_0x410793[_0xd497('0x193')]):_0x5284cd[_0xd497('0x16d')]['phone']):util[_0xd497('0x7b')](_0xd497('0x194'),_[_0xd497('0xb0')](_0x410793['TrunkBackup'])?_0x410793[_0xd497('0x77')][_0xd497('0x41')]:_0x410793[_0xd497('0x18d')]['name'],isNotNull(_0x410793[_0xd497('0x195')])?_0x410793[_0xd497('0x195')][_0xd497('0x191')]()||'':'',_0x410793[_0xd497('0x193')]>0x0?_0x5284cd[_0xd497('0x16d')][_0xd497('0x16e')][_0xd497('0x192')](_0x410793['dialCutDigit']):_0x5284cd[_0xd497('0x16d')]['phone']),'callerid':_0x2edece,'Exten':_0xd497('0xe6'),'Context':_0xd497('0x196'),'Priority':'1','variable':_0x5c8c95,'timeout':(_0x410793[_0xd497('0x5d')]||0x1e)*0x3e8,'async':!![],'channelid':_0x328fc7})['then'](function(_0x493f6d){return _0x4b3e93(_0x493f6d);})['catch'](function(_0xd6760e){_0x410793[_0xd497('0x64')]+=0x1;var _0x520ccf=new History(_0x2c8b26[_0xd497('0xad')][_0x328fc7]);logger[_0xd497('0x98')](util[_0xd497('0x7b')](_0xd497('0x197'),JSON[_0xd497('0x79')](_0xd6760e)));_0x520ccf[_0xd497('0xa8')]=0xe;_0x520ccf[_0xd497('0xa9')]='OriginateError';_0x520ccf[_0xd497('0xab')]=moment()[_0xd497('0x7b')](_0xd497('0x100'));_0x520ccf[_0xd497('0xaa')]=_0x520ccf['starttime'];_0x2c8b26[_0xd497('0xe2')](_0x520ccf)[_0xd497('0xb4')](loggerCatch(_0xd497('0x198')));_0x2c8b26['moveContactManagedDialer'](_0x520ccf)[_0xd497('0xb4')](loggerCatch(_0xd497('0x198')))['finally'](function(){delete _0x2c8b26[_0xd497('0xad')][_0x328fc7];return _0x3ffa9d(msgResponse(_0xd497('0x16b'),_0xd497('0x49'),'originate\x20action\x20Error'));});});});};Dialer[_0xd497('0x1b')]['syncOriginateResponse']=function(_0x1a42dd){var _0x5f0cf6=this['actions'][_0x1a42dd['actionid']];var _0x532d66=this;if(_0x5f0cf6){delete this[_0xd497('0xad')][_0x1a42dd['actionid']];_0x5f0cf6[_0xd497('0x11a')]=moment()[_0xd497('0x7b')](_0xd497('0x100'));var _0x1d9741=_0x5f0cf6[_0xd497('0x7e')]===_0xd497('0x7f')?this['campaigns'][_0x5f0cf6['queue']]:this[_0xd497('0x20')][_0x5f0cf6[_0xd497('0x199')]()];if(!this[_0xd497('0xdc')](_0x1a42dd['response'])){this[_0xd497('0xb6')](_0x1d9741);return this[_0xd497('0x19a')](_0x5f0cf6,_0x1d9741,_0x1a42dd)['then'](function(_0x539286){})[_0xd497('0xb4')](loggerCatch(_0xd497('0x19b')));}else{this[_0xd497('0x26')][_0x1a42dd[_0xd497('0xe3')]]=_0x5f0cf6;}}};Dialer[_0xd497('0x1b')][_0xd497('0x19c')]=function(_0x5d8978,_0x3a0106,_0x7ef2c2){var _0x9c6906=new History(_0x3a0106);if(_0x9c6906[_0xd497('0xf2')]+_0x9c6906[_0xd497('0xf3')]+_0x9c6906[_0xd497('0x105')]+_0x9c6906[_0xd497('0xf4')]+_0x9c6906[_0xd497('0xf5')]+_0x9c6906[_0xd497('0xf6')]+_0x9c6906[_0xd497('0xf7')]+_0x9c6906[_0xd497('0xf8')]>=_0x7ef2c2[_0xd497('0xf9')]-0x1){return!![];}switch(_0x5d8978){case 0x3:if(_0x9c6906['countnoanswerretry']>=_0x7ef2c2['dialNoAnswerMaxRetry']-0x1){return!![];}else{this[_0xd497('0xc3')]({'active':![],'countnoanswerretry':_0x9c6906[_0xd497('0x105')]+=0x1,'scheduledat':moment()['add'](_0x7ef2c2[_0xd497('0x19d')],_0xd497('0x107'))[_0xd497('0x7b')](_0xd497('0x100')),'ContactId':_0x9c6906[_0xd497('0x101')],'ListId':_0x9c6906['ListId'],'VoiceQueueId':_0x9c6906[_0xd497('0xd8')]||undefined,'CampaignId':_0x9c6906[_0xd497('0xd9')]||undefined})[_0xd497('0xb4')](loggerCatch(_0xd497('0x19e')));}break;case 0x5:if(_0x9c6906[_0xd497('0xf2')]>=_0x7ef2c2[_0xd497('0x19f')]-0x1){return!![];}else{this['rescheduleContact']({'active':![],'countbusyretry':_0x9c6906[_0xd497('0xf2')]+=0x1,'scheduledat':moment()['add'](_0x7ef2c2['dialBusyRetryFrequency'],_0xd497('0x107'))[_0xd497('0x7b')](_0xd497('0x100')),'ContactId':_0x9c6906['ContactId'],'ListId':_0x9c6906['ListId'],'VoiceQueueId':_0x9c6906[_0xd497('0xd8')]||undefined,'CampaignId':_0x9c6906[_0xd497('0xd9')]||undefined})['catch'](loggerCatch(_0xd497('0x1a0')));}break;case 0x8:if(_0x9c6906[_0xd497('0xf3')]>=_0x7ef2c2[_0xd497('0x1a1')]-0x1){return!![];}else{this[_0xd497('0xc3')]({'active':![],'countcongestionretry':_0x9c6906[_0xd497('0xf3')]+=0x1,'scheduledat':moment()[_0xd497('0xfe')](_0x7ef2c2[_0xd497('0x1a2')],_0xd497('0x107'))[_0xd497('0x7b')](_0xd497('0x100')),'ContactId':_0x9c6906['ContactId'],'ListId':_0x9c6906[_0xd497('0xd6')],'VoiceQueueId':_0x9c6906[_0xd497('0xd8')]||undefined,'CampaignId':_0x9c6906['CampaignId']||undefined})[_0xd497('0xb4')](loggerCatch(_0xd497('0x1a3')));}break;case 0x0:if(_0x9c6906[_0xd497('0xf4')]>=_0x7ef2c2[_0xd497('0x1a4')]-0x1){return!![];}else{this['rescheduleContact']({'active':![],'countnosuchnumberretry':_0x9c6906['countnosuchnumberretry']+=0x1,'scheduledat':moment()['add'](_0x7ef2c2[_0xd497('0x1a5')],_0xd497('0x107'))[_0xd497('0x7b')](_0xd497('0x100')),'ContactId':_0x9c6906['ContactId'],'ListId':_0x9c6906[_0xd497('0xd6')],'VoiceQueueId':_0x9c6906[_0xd497('0xd8')]||undefined,'CampaignId':_0x9c6906[_0xd497('0xd9')]||undefined})['catch'](loggerCatch('[rescheduleContact][NoSuchNumber]'));}break;case 0xa:if(_0x9c6906[_0xd497('0xf5')]>=_0x7ef2c2[_0xd497('0x1a6')]-0x1){return!![];}else{this[_0xd497('0xc3')]({'active':![],'countdropretry':_0x9c6906[_0xd497('0xf5')]+=0x1,'scheduledat':moment()[_0xd497('0xfe')](_0x7ef2c2['dialDropRetryFrequency'],_0xd497('0x107'))['format'](_0xd497('0x100')),'ContactId':_0x9c6906[_0xd497('0x101')],'ListId':_0x9c6906[_0xd497('0xd6')],'VoiceQueueId':_0x9c6906[_0xd497('0xd8')]||undefined,'CampaignId':_0x9c6906['CampaignId']||undefined})[_0xd497('0xb4')](loggerCatch(_0xd497('0x11f')));}break;case 0xb:if(_0x9c6906[_0xd497('0xf6')]>=_0x7ef2c2[_0xd497('0x1a7')]-0x1){return!![];}else{this[_0xd497('0xc3')]({'active':![],'countabandonedretry':_0x9c6906[_0xd497('0xf6')]+=0x1,'scheduledat':moment()[_0xd497('0xfe')](_0x7ef2c2[_0xd497('0x126')],'minutes')['format'](_0xd497('0x100')),'ContactId':_0x9c6906[_0xd497('0x101')],'ListId':_0x9c6906['ListId'],'VoiceQueueId':_0x9c6906[_0xd497('0xd8')]||undefined,'CampaignId':_0x9c6906['CampaignId']||undefined})[_0xd497('0xb4')](loggerCatch(_0xd497('0x127')));}break;case 0x13:if(_0x9c6906[_0xd497('0xf7')]>=_0x7ef2c2[_0xd497('0xfc')]-0x1){return!![];}else{this[_0xd497('0xc3')]({'active':![],'countmachineretry':_0x9c6906[_0xd497('0xf7')]+=0x1,'scheduledat':moment()[_0xd497('0xfe')](_0x7ef2c2[_0xd497('0xff')],_0xd497('0x107'))['format']('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x9c6906[_0xd497('0x101')],'ListId':_0x9c6906[_0xd497('0xd6')],'VoiceQueueId':_0x9c6906[_0xd497('0xd8')]||undefined,'CampaignId':_0x9c6906[_0xd497('0xd9')]||undefined})[_0xd497('0xb4')](loggerCatch(_0xd497('0x102')));}break;case 0x14:if(_0x9c6906['countagentrejectretry']>=_0x7ef2c2[_0xd497('0x1a8')]-0x1){return!![];}else{this[_0xd497('0xc3')]({'active':![],'countagentrejectretry':_0x9c6906[_0xd497('0xf8')]+=0x1,'scheduledat':moment()[_0xd497('0xfe')](_0x7ef2c2[_0xd497('0x1a9')],_0xd497('0x107'))[_0xd497('0x7b')](_0xd497('0x100')),'ContactId':_0x9c6906['ContactId'],'ListId':_0x9c6906[_0xd497('0xd6')],'VoiceQueueId':_0x9c6906['VoiceQueueId']||undefined,'CampaignId':_0x9c6906[_0xd497('0xd9')]||undefined})[_0xd497('0xb4')](loggerCatch(_0xd497('0x1aa')));}break;default:return!![];}};Dialer[_0xd497('0x1b')][_0xd497('0x19a')]=function(_0x498b27,_0x252ccd,_0x4411ba){var _0x1c439a=this;var _0x499cc3=new History(_0x498b27);return new BPromise(function(_0x426500,_0x38351d){if(_[_0xd497('0x3d')](_0x252ccd)&&_0xd497('0x16a')!==typeof _0x252ccd){return _0x38351d(msgResponse(_0xd497('0x1ab'),_0xd497('0x149'),_0xd497('0x1ac')));}if(_['isUndefined'](_0x4411ba)&&'object'!==typeof _0x4411ba){return _0x38351d(msgResponse('[callProgressDetecting]',_0xd497('0x149'),_0xd497('0x1ad')));}switch(_0x4411ba['reason']){case'0':_0x252ccd[_0xd497('0x63')]+=0x1;_0x499cc3[_0xd497('0xa8')]=0x0;_0x499cc3[_0xd497('0xa9')]=_0xd497('0x1ae');_0x499cc3[_0xd497('0xf4')]+=0x1;_0x499cc3[_0xd497('0xef')]+=0x1;ami[_0xd497('0x4d')](_0xd497('0x1af'),ut[_0xd497('0x1b0')](_0x498b27,_0xd497('0x1b1')));_0x1c439a['createHistory'](_0x499cc3)[_0xd497('0xb4')](loggerCatch(_0xd497('0xf1')));if(_0x1c439a[_0xd497('0x19c')](0x0,_0x498b27,_0x252ccd)){if(_0x499cc3['countnosuchnumberretry']>=_0x252ccd[_0xd497('0x1a4')]){_0x1c439a[_0xd497('0x106')](_0x499cc3,_0x426500,_0x38351d,_0xd497('0x1b2'));}else{_0x1c439a[_0xd497('0xfa')](_0x499cc3,_0x426500,_0x38351d,_0xd497('0x1b2'));}}break;case'3':_0x252ccd[_0xd497('0x62')]+=0x1;_0x499cc3[_0xd497('0xa8')]=0x3;_0x499cc3[_0xd497('0xa9')]=_0xd497('0x1b3');_0x499cc3[_0xd497('0x105')]+=0x1;_0x499cc3[_0xd497('0xef')]+=0x1;ami[_0xd497('0x4d')](_0xd497('0x1b4'),ut[_0xd497('0x1b0')](_0x498b27,_0xd497('0x1b5')));_0x1c439a[_0xd497('0xe2')](_0x499cc3)[_0xd497('0xb4')](loggerCatch(_0xd497('0x1b6')));if(_0x1c439a[_0xd497('0x19c')](0x3,_0x498b27,_0x252ccd)){if(_0x499cc3[_0xd497('0x105')]>=_0x252ccd[_0xd497('0x1b7')]){_0x1c439a['createStateFinal'](_0x499cc3,_0x426500,_0x38351d,_0xd497('0x1b8'));}else{_0x1c439a[_0xd497('0xfa')](_0x499cc3,_0x426500,_0x38351d,_0xd497('0x1b8'));}}break;case'5':_0x252ccd[_0xd497('0x1b9')]+=0x1;_0x499cc3[_0xd497('0xa8')]=0x5;_0x499cc3['statedesc']=_0xd497('0x1ba');_0x499cc3[_0xd497('0xf2')]+=0x1;_0x499cc3[_0xd497('0xef')]+=0x1;ami[_0xd497('0x4d')]('custom:agentbusy',ut[_0xd497('0x1b0')](_0x498b27,_0xd497('0x1bb')));_0x1c439a[_0xd497('0xe2')](_0x499cc3)[_0xd497('0xb4')](loggerCatch(_0xd497('0x1bc')));if(_0x1c439a[_0xd497('0x19c')](0x5,_0x498b27,_0x252ccd)){if(_0x499cc3['countbusyretry']>=_0x252ccd['dialBusyMaxRetry']){_0x1c439a['createStateFinal'](_0x499cc3,_0x426500,_0x38351d,'reason\x205\x20busy');}else{_0x1c439a[_0xd497('0xfa')](_0x499cc3,_0x426500,_0x38351d,_0xd497('0x1bd'));}}break;case'8':_0x252ccd['outboundCongestionCallsDay']+=0x1;_0x499cc3[_0xd497('0xa8')]=0x8;_0x499cc3[_0xd497('0xa9')]=_0xd497('0x1be');_0x499cc3[_0xd497('0xf3')]+=0x1;_0x499cc3[_0xd497('0xef')]+=0x1;ami[_0xd497('0x4d')](_0xd497('0x1bf'),ut[_0xd497('0x1b0')](_0x498b27,_0xd497('0x1c0')));_0x1c439a[_0xd497('0xe2')](_0x499cc3)[_0xd497('0xb4')](loggerCatch(_0xd497('0x1c1')));if(_0x1c439a['checkRetriveMax'](0x8,_0x498b27,_0x252ccd)){if(_0x499cc3[_0xd497('0xf3')]>=_0x252ccd[_0xd497('0x1a1')]){_0x1c439a[_0xd497('0x106')](_0x499cc3,_0x426500,_0x38351d,_0xd497('0x1c2'));}else{_0x1c439a[_0xd497('0xfa')](_0x499cc3,_0x426500,_0x38351d,_0xd497('0x1c2'));}}break;case'11':_0x252ccd[_0xd497('0x1c3')]+=0x1;_0x499cc3[_0xd497('0xa8')]=0xb;_0x499cc3['statedesc']=_0xd497('0x124');_0x499cc3[_0xd497('0xf6')]+=0x1;_0x499cc3[_0xd497('0xef')]+=0x1;_0x1c439a[_0xd497('0xe2')](_0x499cc3)[_0xd497('0xb4')](loggerCatch(_0xd497('0x128')));if(_0x1c439a['checkRetriveMax'](0xb,_0x498b27,_0x252ccd)){if(_0x499cc3[_0xd497('0xf6')]>=_0x252ccd[_0xd497('0x1a7')]){_0x1c439a[_0xd497('0x106')](_0x499cc3,_0x426500,_0x38351d,_0xd497('0x1c4'));}else{_0x1c439a[_0xd497('0xfa')](_0x499cc3,_0x426500,_0x38351d,_0xd497('0x1c4'));}}break;case'20':_0x252ccd[_0xd497('0x66')]+=0x1;_0x499cc3[_0xd497('0xa8')]=0x14;_0x499cc3[_0xd497('0xa9')]=_0xd497('0x1c5');_0x499cc3[_0xd497('0xf8')]+=0x1;_0x499cc3[_0xd497('0xef')]+=0x1;ami['emit'](_0xd497('0x1c6'),ut[_0xd497('0x1b0')](_0x498b27,_0xd497('0x1c7')));_0x1c439a[_0xd497('0xe2')](_0x499cc3)[_0xd497('0xb4')](loggerCatch('[syncAgentComplete][createHistory][20]'));if(_0x1c439a[_0xd497('0x19c')](0x14,_0x498b27,_0x252ccd)){if(_0x499cc3[_0xd497('0xf8')]>=_0x252ccd[_0xd497('0x1a8')]){_0x1c439a[_0xd497('0x106')](_0x499cc3,_0x426500,_0x38351d,_0xd497('0x1c8'));}else{_0x1c439a[_0xd497('0xfa')](_0x499cc3,_0x426500,_0x38351d,_0xd497('0x1c8'));}}break;default:_0x252ccd[_0xd497('0x67')]+=0x1;_0x499cc3[_0xd497('0xa8')]=0xc;_0x499cc3[_0xd497('0xa9')]=_0x4411ba[_0xd497('0x110')];_0x1c439a[_0xd497('0xe2')](_0x499cc3)[_0xd497('0xb4')](loggerCatch('[syncAgentComplete][createHistory][?]'));if(_0x1c439a[_0xd497('0x19c')](_0x4411ba[_0xd497('0x110')],_0x498b27,_0x252ccd)){if(_0x499cc3[_0xd497('0xf2')]+_0x499cc3[_0xd497('0xf3')]+_0x499cc3[_0xd497('0x105')]+_0x499cc3['countnosuchnumberretry']+_0x499cc3[_0xd497('0xf5')]+_0x499cc3[_0xd497('0xf6')]+_0x499cc3[_0xd497('0xf7')]+_0x499cc3[_0xd497('0xf8')]>=_0x252ccd[_0xd497('0xf9')]){_0x1c439a['stateGlobal'](_0x499cc3,_0x426500,_0x38351d,_0x4411ba['reason']);}else{_0x1c439a[_0xd497('0x106')](_0x499cc3,_0x426500,_0x38351d,_0x4411ba[_0xd497('0x110')]);}}}});};Dialer[_0xd497('0x1b')][_0xd497('0xfa')]=function(_0xf0a9f7,_0x526711,_0x2b4c70,_0x1535ad){var _0x5ab60e=new Final(_0xf0a9f7);_0x5ab60e[_0xd497('0xa8')]=0xf;_0x5ab60e['statedesc']=_0xd497('0x1c9');this[_0xd497('0x106')](_0x5ab60e,_0x526711,_0x2b4c70,_0x1535ad);};Dialer[_0xd497('0x1b')][_0xd497('0x106')]=function(_0x370033,_0x58deb2,_0x455223,_0x9ed40a){this[_0xd497('0xcc')](_0x370033)['then'](function(_0x42d0ab){return _0x58deb2(msgResponse(_0xd497('0x1ab'),_0xd497('0xdd'),_0x9ed40a));})[_0xd497('0xb4')](function(_0x5cdbee){return _0x455223(msgResponse(_0xd497('0x1ca'),_0xd497('0x149'),_0xd497('0x1cb')));});};Dialer[_0xd497('0x1b')][_0xd497('0x9')]=function(_0x527f70){var _0x132ae4=this;var _0x28f0c7=_0x527f70[_0xd497('0x1cc')]/0x64;var _0xb4db2e=_0x527f70[_0xd497('0x11c')]/(_0x527f70[_0xd497('0x11c')]+_0x527f70[_0xd497('0xe8')]);var _0x2983a8=Math[_0xd497('0x1cd')](_0x527f70['predictiveIntervalAvailable']*(_0x527f70['predictiveIntervalMaxThreshold']/0x64));var _0x5496d8=Math[_0xd497('0x1cd')](_0x527f70['predictiveIntervalAvailable']*(_0x527f70[_0xd497('0x1ce')]/0x64));var _0x514e10=_0x527f70[_0xd497('0x50')]+_0x527f70['talking'];var _0x5d4da3=Math[_0xd497('0x1cf')](_0x527f70[_0xd497('0x72')]*_0x527f70[_0xd497('0x74')]*_0x527f70['predictiveIntervalHitRate']*_0x527f70['predictiveIntervalMultiplicativeFactor']);if(_[_0xd497('0x3d')](_0x527f70[_0xd497('0x28')])){if(!_[_0xd497('0x3d')](_0x527f70[_0xd497('0x76')])){_0x527f70[_0xd497('0x76')]=undefined;loggerPredictive[_0xd497('0x98')](_0xd497('0x1d0'),'check\x20predictive\x20is\x20not\x20undefine');}if(!_[_0xd497('0x3d')](_0x527f70[_0xd497('0x94')])){loggerPredictive['error']('[startMethodPredictive][StartProgressive]',_0xd497('0x1d1'));clearInterval(_0x527f70[_0xd497('0x94')]);_0x527f70[_0xd497('0x94')]=undefined;}_0x527f70[_0xd497('0x28')]=moment()[_0xd497('0x7b')](_0xd497('0x100'));loggerPredictive[_0xd497('0x82')](_0x527f70[_0xd497('0x41')],_0xd497('0x1d2'),_0x527f70[_0xd497('0x28')]);this[_0xd497('0x158')](_0x527f70,0x1);}else if(ifInterval(_0x527f70[_0xd497('0x1d3')],_0x527f70[_0xd497('0x28')])){this[_0xd497('0x158')](_0x527f70,0x1);loggerPredictiveCalls['info']('[startMethodPredictive][StartProgressive][Loop]',_0x527f70['startProgressive'],_0x527f70[_0xd497('0x41')]);_0x527f70['erlangCalls']=0x0;_0x527f70[_0xd497('0x1d4')]=0x0;}else if(_0x28f0c7<_0xb4db2e&&_0x527f70[_0xd497('0x1d5')]==='dropRate'){freeVariablesPredictive(_0x527f70);loggerPredictive[_0xd497('0x82')]('[stopMethodPredictive][ReStartProgressive][ExceededDropDay]','Dropped\x20calls\x20day',_0xb4db2e,_0xd497('0x28'),_0x527f70['name']);}else if(_0x5d4da3<_0x527f70['predictiveIntervalErlangCallsDroppedCalls']&&_0x527f70[_0xd497('0x1d5')]==='dropRate'){freeVariablesPredictive(_0x527f70);loggerPredictive['info'](_0xd497('0x1d6'),'Max\x20Drop\x20',_0x5d4da3,_0xd497('0x1d7'),_0x527f70[_0xd497('0x1d4')],'startProgressive',_0x527f70[_0xd497('0x41')]);}else if(!ifInterval(_0x527f70[_0xd497('0x1d3')],_0x527f70[_0xd497('0x28')])&&_[_0xd497('0x3d')](_0x527f70[_0xd497('0x76')])&&!_[_0xd497('0x3d')](_0x527f70[_0xd497('0x28')])){_0x527f70['startPredictive']=moment()[_0xd497('0x7b')](_0xd497('0x100'));loggerPredictive['info'](_0x527f70[_0xd497('0x41')],_0xd497('0x1d8'),_0x527f70[_0xd497('0x76')]);this[_0xd497('0xc1')](_0x527f70['dialPredictiveInterval'])[_0xd497('0xbc')](this['getDataPredictive'](_0x527f70))[_0xd497('0xbc')](mergeDataErlangB(_0x527f70))['then'](this[_0xd497('0x1d9')](_0x527f70))[_0xd497('0xb4')](loggerCatchPredictive(_0xd497('0x1da'),_0x527f70));}else if(!ifInterval(_0x527f70[_0xd497('0x1d3')],_0x527f70[_0xd497('0x76')])){_0x527f70[_0xd497('0x1d4')]=0x0;_0x527f70['startPredictive']=moment()[_0xd497('0x7b')](_0xd497('0x100'));loggerPredictive[_0xd497('0x82')](_0x527f70[_0xd497('0x41')],_0xd497('0x1db'),_0x527f70['startPredictive']);clearInterval(_0x527f70[_0xd497('0x94')]);_0x527f70[_0xd497('0x94')]=undefined;this[_0xd497('0xc1')](_0x527f70['dialPredictiveInterval'])[_0xd497('0xbc')](this[_0xd497('0x1dc')](_0x527f70))[_0xd497('0xbc')](mergeDataErlangB(_0x527f70))[_0xd497('0xbc')](this[_0xd497('0x1d9')](_0x527f70))[_0xd497('0xb4')](loggerCatchPredictive(_0xd497('0x1dd'),_0x527f70));}else if(_0x527f70[_0xd497('0x6f')]&&_0x514e10<_0x527f70['predictiveIntervalAvailable']-_0x5496d8){freeVariablesPredictive(_0x527f70);loggerPredictive[_0xd497('0x82')](_0x527f70[_0xd497('0x41')],'switch\x20in\x20progressive\x20because\x20available\x20agents\x20(',_0x514e10,')\x20are\x20less\x20than\x20threshold\x20(',_0x527f70['predictiveIntervalAvailable'],'-',_0x5496d8,'=',_0x527f70[_0xd497('0x6f')]-_0x5496d8,')');}else if(_0x527f70[_0xd497('0x6f')]&&_0x514e10>_0x527f70['predictiveIntervalAvailable']+_0x2983a8){freeVariablesPredictive(_0x527f70);loggerPredictive[_0xd497('0x82')](_0x527f70[_0xd497('0x41')],'switch\x20in\x20progressive\x20because\x20available\x20agents\x20(',_0x514e10,_0xd497('0x1de'),_0x527f70[_0xd497('0x6f')],'+',_0x2983a8,'=',_0x527f70[_0xd497('0x6f')]+_0x2983a8,')');}};Dialer['prototype']['getDataPredictive']=function(_0x5c4c11){var _0x2b3632=this;return function(_0x28aff8){return new BPromise(function(_0x4bb2f7,_0x506abe){_[_0xd497('0xd4')](_0x5c4c11,_0x28aff8[0x0]);if(checkGetDataPredictive(_0x28aff8[0x0])){var _0x136a6a=_0x5c4c11[_0xd497('0x6f')]=_0x5c4c11[_0xd497('0x55')]+_0x5c4c11[_0xd497('0x50')];var _0x413d44=_0x5c4c11[_0xd497('0x1d3')]*0x3c;var _0x18d5da=_0x28aff8[0x0][_0xd497('0x6a')]+_0x28aff8[0x0]['predictiveIntervalAvgHoldtime'];var _0x39405d=(_0x28aff8[0x0][_0xd497('0x68')]+_0x28aff8[0x0][_0xd497('0x6b')]+_0x28aff8[0x0][_0xd497('0x87')])/_0x28aff8[0x0][_0xd497('0x70')];_0x5c4c11[_0xd497('0x6d')]=_0x39405d>0x0?_0x39405d:0x1;switch(_0x5c4c11[_0xd497('0x1d5')]){case'dropRate':var _0x3f5712=_0x5c4c11['dialPredictiveOptimizationPercentage']/0x64;return _0x2b3632[_0xd497('0x1df')](_0x136a6a,_0x413d44,_0x18d5da,_0x39405d,_0x3f5712)['then'](function(_0x2a4c26){return _0x4bb2f7(_0x2a4c26);});case _0xd497('0x1e0'):var _0x50f379=_0x5c4c11[_0xd497('0x1cc')]/0x64;return _0x2b3632[_0xd497('0x1e1')](_0x136a6a,_0x413d44,_0x18d5da,_0x39405d,_0x50f379)[_0xd497('0xbc')](function(_0x13d85a){return _0x4bb2f7(_0x13d85a);});default:return _0x506abe(msgResponse(_0xd497('0x1e2'),'Failure',_0xd497('0x1e3')));}}else{return _0x506abe(msgResponse('[getDataPredictive]',_0xd497('0x149'),_0xd497('0x1e4')));}});};};Dialer[_0xd497('0x1b')][_0xd497('0x1e5')]=function(_0x4d665d){var _0x2bcc16=this;return function(_0x2042fc){return new BPromise(function(_0x479f82,_0x26cd2f){_[_0xd497('0xd4')](_0x4d665d,_0x2042fc[0x0]);if(checkGetDataPredictive(_0x2042fc[0x0])){loggerPredictive[_0xd497('0x82')](JSON[_0xd497('0x79')](_0x2042fc[0x0]));if(_0x4d665d[_0xd497('0x1d5')]===_0xd497('0x1e6')){return _0x2bcc16[_0xd497('0xca')](_0x4d665d['id'])['then'](function(_0x33ca51){var _0xec5fca=_0x4d665d[_0xd497('0x51')]-_0x33ca51[0x0][_0xd497('0x1e7')];var _0x4f2290=_0x4d665d[_0xd497('0x1d3')]*0x3c;var _0x1f5c8b=_0x2042fc[0x0]['predictiveIntervalAvgTalktime']+_0x2042fc[0x0][_0xd497('0x69')];var _0x229c5f=(_0x2042fc[0x0][_0xd497('0x68')]+_0x2042fc[0x0][_0xd497('0x6b')]+_0x2042fc[0x0]['predictiveIntervalDroppedCallsCallersExit'])/_0x2042fc[0x0]['predictiveIntervalTotalCalls'];var _0x25c414=_0x4d665d[_0xd497('0x1cc')]/0x64;_0x4d665d[_0xd497('0x6e')]=_0x33ca51[0x0][_0xd497('0x1e7')]||0x0;_0x4d665d['predictiveIntervalHitRate']=_0x229c5f>0x0?_0x229c5f:0x1;return _0x2bcc16[_0xd497('0x1df')](_0xec5fca,_0x4f2290,_0x1f5c8b,_0x229c5f,_0x25c414);})[_0xd497('0xbc')](function(_0x225f23){return _0x479f82(_0x225f23);})['catch'](function(_0x49602d){return _0x26cd2f(msgResponse(_0xd497('0x1e8'),_0xd497('0x149'),JSON['stringify'](_0x49602d)));});}if(_0x4d665d[_0xd497('0x1d5')]===_0xd497('0x1e0')){return _0x2bcc16[_0xd497('0xca')](_0x4d665d['id'])['then'](function(_0x26a293){var _0x1a1abd=_0x4d665d[_0xd497('0x51')]-_0x26a293[0x0][_0xd497('0x1e7')];var _0xf87e03=_0x4d665d['dialPredictiveInterval']*0x3c;var _0x1ee77b=_0x2042fc[0x0]['predictiveIntervalAvgTalktime']+_0x2042fc[0x0][_0xd497('0x69')];var _0x16ab8c=(_0x2042fc[0x0][_0xd497('0x68')]+_0x2042fc[0x0][_0xd497('0x6b')]+_0x2042fc[0x0]['predictiveIntervalDroppedCallsCallersExit'])/_0x2042fc[0x0]['predictiveIntervalTotalCalls'];var _0xbceace=_0x4d665d['dialPredictiveOptimizationPercentage']/0x64;_0x4d665d[_0xd497('0x6e')]=_0x26a293[0x0][_0xd497('0x1e7')]||0x0;_0x4d665d[_0xd497('0x6d')]=_0x16ab8c>0x0?_0x16ab8c:0x1;return _0x2bcc16[_0xd497('0x1e1')](_0x1a1abd,_0xf87e03,_0x1ee77b,_0x16ab8c,_0xbceace);})[_0xd497('0xbc')](function(_0x121ef8){return _0x479f82(_0x121ef8);})[_0xd497('0xb4')](function(_0x1bf2f9){return _0x26cd2f(msgResponse('[CatchErlangB]',_0xd497('0x149'),JSON['stringify'](_0x1bf2f9)));});}}else{return _0x26cd2f(msgResponse(_0xd497('0x1e2'),_0xd497('0x149'),'check\x20failure'));}});};};Dialer[_0xd497('0x1b')][_0xd497('0x1d9')]=function(_0xc7575){var _0x310a6d=this;return function(){var _0xbfab31=0x0;var _0x38fd25=Math[_0xd497('0x1cf')](_0xc7575[_0xd497('0x73')]*0x3e8);if(_0x38fd25>0x0){_0x38fd25=_0x38fd25<0x64?0x64:_0x38fd25;loggerPredictive[_0xd497('0x82')](_0xc7575[_0xd497('0x41')],'one\x20call\x20every:',_0x38fd25,_0xd497('0x4a'));_0xc7575['handlePredictive']=setInterval(function(){_0x310a6d[_0xd497('0x94')](_0xc7575);loggerPredictiveCalls['info']('[handlePredictive]',_0xbfab31+=0x1);},_0x38fd25);}else{loggerPredictive[_0xd497('0x82')](_0xc7575[_0xd497('0x41')],'fail\x20to\x20scheduled\x20calls');}};};Dialer[_0xd497('0x1b')][_0xd497('0x1e9')]=function(_0x4e8ff8,_0x185387){var _0x4e13c2=this;return function(_0x3317cd){if(_[_0xd497('0x47')](_0x3317cd)){if(_[_0xd497('0xb0')](_0x185387[_0xd497('0xd7')])||!_0x185387[_0xd497('0x1ea')]){if(_0x4e8ff8[_0xd497('0x5b')]===_0xd497('0x8')){_0x4e8ff8[_0xd497('0x131')]=_['isUndefined'](_0x4e8ff8[_0xd497('0x131')])?!![]:_0x4e8ff8['queueStatusComplete'];var _0x9bd9af=uuid['v4']();_0x4e13c2[_0xd497('0xad')][_0x9bd9af]=new Action(_0x4e8ff8,_0x185387,_0x9bd9af);loggerBooked[_0xd497('0x82')](_0xd497('0x1eb'),_0x9bd9af,_0xd497('0x1ec'),JSON['stringify'](_0x4e8ff8[_0xd497('0x131')]),_0xd497('0x1ed'),_0x4e8ff8['name']);if(_0x4e8ff8['queueStatusComplete']){_0x4e8ff8[_0xd497('0x131')]=![];_0x4e13c2[_0xd497('0x2a')][_0x4e13c2[_0xd497('0xad')][_0x9bd9af]['queue']]=[];ami[_0xd497('0xb1')]({'actionid':_0x9bd9af,'action':'queuestatus','queue':_0x4e8ff8[_0xd497('0x41')]})['catch'](function(_0x51f188){_0x4e13c2['updateOriginated'](_0x4e8ff8);_0x4e13c2[_0xd497('0xc3')]({'active':![],'ContactId':_0x4e13c2[_0xd497('0xad')][_0x9bd9af][_0xd497('0x101')],'ListId':_0x4e13c2[_0xd497('0xad')][_0x9bd9af][_0xd497('0xd6')],'VoiceQueueId':_0x4e13c2[_0xd497('0xad')][_0x9bd9af][_0xd497('0xd8')]||undefined,'CampaignId':_0x4e13c2[_0xd497('0xad')][_0x9bd9af][_0xd497('0xd9')]||undefined})[_0xd497('0xb4')](loggerCatch(_0xd497('0x1ee')));delete _0x4e13c2[_0xd497('0xad')][_0x9bd9af];});}else{loggerBooked['info']('[booked][checkContactBlack][else]',JSON[_0xd497('0x79')](_0x4e8ff8[_0xd497('0x131')]),'Queue:\x20',_0x4e8ff8['name']);_0x4e13c2[_0xd497('0xb6')](_0x4e8ff8);_0x4e13c2['rescheduleContact']({'active':![],'ContactId':_0x4e13c2[_0xd497('0xad')][_0x9bd9af][_0xd497('0x101')],'ListId':_0x4e13c2[_0xd497('0xad')][_0x9bd9af][_0xd497('0xd6')],'VoiceQueueId':_0x4e13c2[_0xd497('0xad')][_0x9bd9af]['VoiceQueueId']||undefined,'CampaignId':_0x4e13c2[_0xd497('0xad')][_0x9bd9af][_0xd497('0xd9')]||undefined})[_0xd497('0xb4')](loggerCatch(_0xd497('0x1ee')));delete _0x4e13c2[_0xd497('0xad')][_0x9bd9af];}}else{return _0x4e13c2['actionOriginate'](_0x4e8ff8,_0x185387);}}else{if(getDiff(_0x185387['scheduledat'])<_0x4e8ff8[_0xd497('0x1ef')]*0x3c){if(_0x185387['Agent']&&!_0x185387[_0xd497('0x1f0')][_0xd497('0x1f1')]){_0x4e13c2[_0xd497('0x1f')][_0xd497('0x1f2')](_0x185387['id'])[_0xd497('0x1e')](function(){_0x4e13c2[_0xd497('0xb6')](_0x4e8ff8);});}else{_0x4e13c2['unlockContact']({'active':![]},_0x185387['id'],0x1)[_0xd497('0x1e')](function(){console[_0xd497('0x1f3')]('Contact\x20updated');_0x4e13c2[_0xd497('0xb6')](_0x4e8ff8);});}}else{_0x4e8ff8[_0xd497('0x65')]+=0x1;_0x4e13c2[_0xd497('0xb6')](_0x4e8ff8);if(_0x4e8ff8[_0xd497('0x1f4')]){_0x4e13c2[_0xd497('0xc3')]({'active':![],'recallme':![],'UserId':null,'ContactId':_0x185387[_0xd497('0x101')],'ListId':_0x185387['ListId'],'VoiceQueueId':_0x185387['VoiceQueueId']||undefined,'CampaignId':_0x185387[_0xd497('0xd9')]||undefined})['catch'](loggerCatch(_0xd497('0x1f5')));_0x4e13c2[_0xd497('0xe2')](createObjHistory(_0x4e8ff8,_0x185387,'RECALLINQUEUE',0x17,_0xd497('0x1f6')))[_0xd497('0xb4')](loggerCatch(_0xd497('0x1f7')));}else{_0x4e13c2[_0xd497('0xe1')](createObjHistory(_0x4e8ff8,_0x185387,_0xd497('0x1f8'),0x16,_0xd497('0x1f9')),_0xd497('0x1fa'),_0xd497('0x1fb'));}}}}else{_0x4e8ff8[_0xd497('0x5f')]+=0x1;_0x4e13c2[_0xd497('0xe1')](createObjHistory(_0x4e8ff8,_0x185387,_0xd497('0x1fc'),0xd,_0xd497('0x1fd')),'[Originate][historyBlacklist]',_0xd497('0x1fe'));throw _0xd497('0x1ff');}};};Dialer[_0xd497('0x1b')][_0xd497('0x15d')]=function(_0x249bd0){var _0x4f080e=this;var _0x285a37=[];var _0x2ffae6=_0x249bd0[_0xd497('0x200')]-_0x249bd0[_0xd497('0x71')]-_0x249bd0[_0xd497('0x201')];emitCampaignSummary(_0x249bd0);if(_0x2ffae6>0x0){if(_0x2ffae6>this['maxNumberOriginate']){_0x2ffae6=this[_0xd497('0x24')];}_0x249bd0[_0xd497('0x201')]+=_0x2ffae6;this[_0xd497('0xc9')](_0x249bd0['id'],_0x2ffae6,_0x249bd0['dialOrderByScheduledAt'])[_0xd497('0xbc')](function(_0x2459f7){_0x249bd0[_0xd497('0x201')]-=_0x2ffae6;_0x249bd0['temp']=_0x249bd0[_0xd497('0x201')]>0x0?_0x249bd0[_0xd497('0x201')]:0x0;if(!checkContactEmpty(_0x2459f7)){_0x249bd0[_0xd497('0x3e')]=_0xd497('0xa0');logger[_0xd497('0x82')]('[getContactCampaign2][Empty]'+_0x249bd0[_0xd497('0x41')]);}else{_0x249bd0[_0xd497('0x71')]+=_0x2459f7[_0xd497('0x9a')];_0x249bd0['message']='RUNNING';for(var _0xb80f5a=0x0;_0xb80f5a<_0x2459f7[_0xd497('0x9a')];_0xb80f5a+=0x1){_0x249bd0[_0xd497('0x202')]+=0x1;if(_[_0xd497('0xb0')](_0x2459f7[_0xb80f5a])||_['isNil'](_0x2459f7[_0xb80f5a][_0xd497('0x16d')])||_['isNil'](_0x2459f7[_0xb80f5a][_0xd497('0x16d')][_0xd497('0x16e')])){_0x4f080e[_0xd497('0xd2')](_0xd497('0x203'),_0x249bd0,_0x2459f7[_0xb80f5a]);}else{_0x4f080e[_0xd497('0xbf')](_[_0xd497('0xd5')](_0x2459f7[_0xb80f5a],['CampaignId','Contact.phone']))['then'](_0x4f080e[_0xd497('0x1e9')](_0x249bd0,_0x2459f7[_0xb80f5a]))[_0xd497('0xb4')](_0x4f080e[_0xd497('0xd1')](_0xd497('0x204'),_0x249bd0));}}}})['catch'](loggerGetContactDialer(_0xd497('0x205'),_0x249bd0,_0x2ffae6));}};Dialer[_0xd497('0x1b')][_0xd497('0x158')]=function(_0x23e45e,_0xd08ffb){var _0x4db406=this;var _0x22a736=[];var _0x1f1e28=_0xd08ffb>=0x1?_0xd08ffb:0x1;var _0x22df3a=[];if(_0x23e45e[_0xd497('0x5b')]===_0xd497('0x8')){_0x1f1e28=0x1;}var _0x297986=Math[_0xd497('0x1cf')](_0x23e45e[_0xd497('0x50')]*_0x1f1e28)-_0x23e45e[_0xd497('0x71')]-_0x23e45e[_0xd497('0x201')];emitVoiceQueueSummary(_0x23e45e);if(_0x23e45e[_0xd497('0x206')]>0x0){var _0x2b7112=_0x23e45e['dialLimitQueue']-_0x23e45e[_0xd497('0x71')]-_0x23e45e[_0xd497('0x55')]-_0x23e45e[_0xd497('0x201')]-_0x23e45e[_0xd497('0x52')];if(_0x297986>_0x2b7112){_0x297986=_0x2b7112;}}if(_0x297986>0x0){if(_0x23e45e[_0xd497('0x5b')]==='booked'){_0x297986=0x1;}if(_0x297986>this[_0xd497('0x24')]){_0x297986=this[_0xd497('0x24')];}_0x23e45e[_0xd497('0x201')]+=_0x297986;for(var _0x377559 in this[_0xd497('0x22')]){if(this[_0xd497('0x22')][_0xd497('0x9b')](_0x377559)){if(this[_0xd497('0x22')][_0x377559][_0xd497('0xa8')]===_0xd497('0x207')&&this[_0xd497('0x22')][_0x377559][_0xd497('0xb2')]==='reachable'){_0x22a736[_0xd497('0x12f')](this[_0xd497('0x22')][_0x377559]['id']);}}}this['getContactDialer'](_0x23e45e['id'],_0x22a736,_0x297986,_0x23e45e[_0xd497('0x208')])[_0xd497('0xbc')](function(_0x2f069b){_0x23e45e['temp']-=_0x297986;_0x23e45e[_0xd497('0x201')]=_0x23e45e[_0xd497('0x201')]>0x0?_0x23e45e['temp']:0x0;if(!checkContactEmpty(_0x2f069b)){_0x4db406[_0xd497('0xba')](_0x23e45e)[_0xd497('0xbc')](sendMessageReschedule(_0x23e45e))[_0xd497('0xb4')](loggerCatch(_0xd497('0xbd')));}else{_0x23e45e[_0xd497('0x71')]+=_0x2f069b[_0xd497('0x9a')];_0x23e45e[_0xd497('0x3e')]=_0x23e45e[_0xd497('0x5b')]==='booked'?'ACTIVE':_0xd497('0x209');for(var _0x2499af=0x0;_0x2499af<_0x2f069b['length'];_0x2499af+=0x1){if(_[_0xd497('0xb0')](_0x2f069b[_0x2499af])||_[_0xd497('0xb0')](_0x2f069b[_0x2499af][_0xd497('0x16d')])||_[_0xd497('0xb0')](_0x2f069b[_0x2499af][_0xd497('0x16d')]['phone'])){_0x4db406[_0xd497('0xd2')](_0xd497('0x203'),_0x23e45e,_0x2f069b[_0x2499af]);}else{_0x4db406[_0xd497('0xbe')](_['pick'](_0x2f069b[_0x2499af],[_0xd497('0xd8'),_0xd497('0x20a')]))[_0xd497('0xbc')](_0x4db406['checkContactBlack'](_0x23e45e,_0x2f069b[_0x2499af]))[_0xd497('0xb4')](_0x4db406['loggerHandler'](_0xd497('0x203'),_0x23e45e));}}}})['catch'](loggerGetContactDialer(_0xd497('0x20b'),_0x23e45e,_0x297986));}};Dialer[_0xd497('0x1b')][_0xd497('0x94')]=function(_0x171eb5){var _0x5c4971=this;if(_0x171eb5[_0xd497('0x206')]>0x0){var _0x4cc5e=_0x171eb5['dialLimitQueue']-_0x171eb5[_0xd497('0x71')]-_0x171eb5[_0xd497('0x55')];if(_0x4cc5e>0x0){this[_0xd497('0x20c')](_0x171eb5);}else{loggerPredictiveCalls['info'](_0xd497('0x20d'));}}else{this[_0xd497('0x20c')](_0x171eb5);}};Dialer[_0xd497('0x1b')][_0xd497('0x20c')]=function(_0x1aea57){var _0x833c2f=this;var _0x492057=[];_0x1aea57[_0xd497('0x71')]+=0x1;for(var _0x219a4b in this[_0xd497('0x22')]){if(this[_0xd497('0x22')]['hasOwnProperty'](_0x219a4b)){if(this[_0xd497('0x22')][_0x219a4b]['state']===_0xd497('0x207')&&this['agents'][_0x219a4b]['status']===_0xd497('0x20e')){_0x492057[_0xd497('0x12f')](this['agents'][_0x219a4b]['id']);}}}this[_0xd497('0xc7')](_0x1aea57['id'],_0x492057,0x1,_0x1aea57[_0xd497('0x208')])[_0xd497('0xbc')](function(_0x138d0a){if(!checkContactEmpty(_0x138d0a)){checkContactLowerLimitOriginate(_0x1aea57,0x1,0x0);_0x833c2f[_0xd497('0xba')](_0x1aea57)[_0xd497('0xbc')](sendMessageReschedule(_0x1aea57))[_0xd497('0xb4')](loggerCatch(_0xd497('0xbd')));}else{_0x1aea57['message']=_0xd497('0x209');if(_[_0xd497('0xb0')](_0x138d0a[0x0])||_[_0xd497('0xb0')](_0x138d0a[0x0][_0xd497('0x16d')])||_['isNil'](_0x138d0a[0x0][_0xd497('0x16d')][_0xd497('0x16e')])){_0x833c2f[_0xd497('0xd2')](_0xd497('0x203'),_0x1aea57,_0x138d0a[0x0]);}else{_0x833c2f[_0xd497('0xbe')](_['pick'](_0x138d0a[0x0],[_0xd497('0xd8'),'Contact.phone']))[_0xd497('0xbc')](_0x833c2f[_0xd497('0x1e9')](_0x1aea57,_0x138d0a[0x0]))['catch'](_0x833c2f['loggerHandler'](_0xd497('0x20f'),_0x1aea57));}}})[_0xd497('0xb4')](loggerGetContactDialer(_0xd497('0x210'),_0x1aea57,0x1));emitVoiceQueueSummary(_0x1aea57);};Dialer[_0xd497('0x1b')][_0xd497('0x1df')]=function(_0x326cbb,_0x2fb4d7,_0x123283,_0x351576,_0x807670,_0x43b14b){loggerPredictive['info'](_0xd497('0x211'));loggerPredictive['info'](_0xd497('0x212'),_0x326cbb);loggerPredictive[_0xd497('0x82')](_0xd497('0x213'),_0x2fb4d7);loggerPredictive[_0xd497('0x82')](_0xd497('0x214'),_0x123283);loggerPredictive[_0xd497('0x82')](_0xd497('0x215'),_0x351576);loggerPredictive[_0xd497('0x82')]('Amax:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x807670);loggerPredictive['info']('---------------------------');return new BPromise(function(_0x54ca88,_0x5d0ca5){if(_0x326cbb<=0x0||isNaN(_0x326cbb)){return _0x5d0ca5(msgResponse(_0xd497('0x216'),'Error','m\x20=\x20'+_0x326cbb));}if(_0x123283<=0x0||isNaN(_0x123283)){return _0x5d0ca5(msgResponse(_0xd497('0x216'),_0xd497('0x49'),'Ts\x20=\x20'+_0x123283));}if(_0x351576<=0x0||isNaN(_0x351576)){return _0x5d0ca5(msgResponse(_0xd497('0x216'),_0xd497('0x49'),_0xd497('0x217')+_0x351576));}if(_0x2fb4d7<=0x0||isNaN(_0x2fb4d7)){return _0x5d0ca5(msgResponse(_0xd497('0x216'),_0xd497('0x49'),'interval\x20=\x20'+_0x2fb4d7));}if(_0x807670<=0x0||isNaN(_0x807670)){return _0x5d0ca5(msgResponse(_0xd497('0x216'),'Error',_0xd497('0x218')+_0x807670));}_0x43b14b=_0x43b14b||0x0;var _0x4f4bcf=0x1/_0x123283;var _0x331f63=0x0;var _0x1c5078=0x0;var _0x1b9ebc=0x0;var _0x5a8def=0x0;for(var _0x296b2d=0x0;_0x1b9ebc<_0x807670;_0x296b2d+=0x1){_0x1c5078=_0x296b2d/_0x2fb4d7;_0x331f63=(_0x351576*_0x1c5078+_0x43b14b)/_0x4f4bcf;_0x1b9ebc=erlangb(_0x331f63,_0x326cbb);_0x5a8def=_0x331f63/_0x326cbb*(0x1-erlangb(_0x331f63,_0x326cbb));}return _0x54ca88({'erlangCalls':_0x296b2d,'erlangCallToSecond':_0x2fb4d7/_0x296b2d,'erlangAbandonmentRate':_0x1b9ebc,'erlangBusyFactor':_0x5a8def});});};Dialer['prototype'][_0xd497('0x1e1')]=function(_0x25e7cd,_0x2cfef2,_0x1c8e96,_0x55a80d,_0x37beae,_0x29e7fa){loggerPredictive[_0xd497('0x82')](_0xd497('0x219'));loggerPredictive[_0xd497('0x82')](_0xd497('0x212'),_0x25e7cd);loggerPredictive[_0xd497('0x82')](_0xd497('0x213'),_0x2cfef2);loggerPredictive[_0xd497('0x82')](_0xd497('0x214'),_0x1c8e96);loggerPredictive[_0xd497('0x82')](_0xd497('0x215'),_0x55a80d);loggerPredictive[_0xd497('0x82')](_0xd497('0x21a'),_0x37beae);loggerPredictive[_0xd497('0x82')](_0xd497('0x21b'));return new BPromise(function(_0x33541a,_0x5f237e){if(_0x25e7cd<=0x0||isNaN(_0x25e7cd)){return _0x5f237e(msgResponse('[busyFactor]','Error',_0xd497('0x21c')+_0x25e7cd));}if(_0x1c8e96<=0x0||isNaN(_0x1c8e96)){return _0x5f237e(msgResponse(_0xd497('0x21d'),'Error',_0xd497('0x21e')+_0x1c8e96));}if(_0x55a80d<=0x0||isNaN(_0x55a80d)){return _0x5f237e(msgResponse(_0xd497('0x21d'),_0xd497('0x49'),'p\x20=\x20'+_0x55a80d));}if(_0x2cfef2<=0x0||isNaN(_0x2cfef2)){return _0x5f237e(msgResponse(_0xd497('0x21d'),_0xd497('0x49'),'interval\x20=\x20'+_0x2cfef2));}if(_0x37beae<=0x0||isNaN(_0x37beae)){return _0x5f237e(msgResponse(_0xd497('0x21d'),_0xd497('0x49'),_0xd497('0x21f')+_0x37beae));}_0x29e7fa=_0x29e7fa||0x0;var _0x37756c=0x1/_0x1c8e96;var _0x58081a=0x0;var _0x42eb93=0x0;var _0x129ca3=0x0;var _0x3471f9=0x0;for(var _0x2d4cdd=0x0;_0x3471f9<_0x37beae;_0x2d4cdd+=0x1){_0x42eb93=_0x2d4cdd/_0x2cfef2;_0x58081a=(_0x55a80d*_0x42eb93+_0x29e7fa)/_0x37756c;_0x129ca3=erlangb(_0x58081a,_0x25e7cd);_0x3471f9=_0x58081a/_0x25e7cd*(0x1-erlangb(_0x58081a,_0x25e7cd));}return _0x33541a({'erlangCalls':_0x2d4cdd,'erlangCallToSecond':_0x2cfef2/_0x2d4cdd,'erlangAbandonmentRate':_0x129ca3,'erlangBusyFactor':_0x3471f9});});};module[_0xd497('0x220')]=Dialer; \ No newline at end of file diff --git a/server/services/ami/dialer/queueCallerAbandon.js b/server/services/ami/dialer/queueCallerAbandon.js index 3d9cc10..3c44974 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 _0x3060=['ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','exports','lodash','moment','milliseconds','diff','seconds','scheduledat','type','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','uniqueid','calleridname','starttime','responsetime','endtime','droptime','ringtime','holdtime','talktime','queue','connectedlinename','reason','callback','callbackuniqueid','callbackat','recallme'];(function(_0x284bb4,_0x598e6c){var _0x574d5b=function(_0x4e3dac){while(--_0x4e3dac){_0x284bb4['push'](_0x284bb4['shift']());}};_0x574d5b(++_0x598e6c);}(_0x3060,0xeb));var _0x0306=function(_0x56138f,_0x1e9ebb){_0x56138f=_0x56138f-0x0;var _0x1acaf7=_0x3060[_0x56138f];return _0x1acaf7;};'use strict';var util=require('util');var _=require(_0x0306('0x0'));var moment=require(_0x0306('0x1'));function getSeconds(_0x11e354,_0x388170){var _0xd37d3f=moment(_0x11e354)[_0x0306('0x2')](0x0);var _0x577457=moment(_0x388170)[_0x0306('0x2')](0x0);return _0xd37d3f[_0x0306('0x3')](_0x577457,_0x0306('0x4'));}function QueueCallerAbandon(_0x4f3a76,_0x5a32e7){this[_0x0306('0x5')]=_0x4f3a76[_0x0306('0x5')];this[_0x0306('0x6')]=_0x4f3a76['type'];this['campaigntype']=_0x4f3a76[_0x0306('0x6')]==='outbound'?'queue':_0x4f3a76[_0x0306('0x6')];this[_0x0306('0x7')]=_0x4f3a76[_0x0306('0x7')];this[_0x0306('0x8')]=_0x4f3a76['countcongestionretry'];this['countnoanswerretry']=_0x4f3a76[_0x0306('0x9')];this['countglobal']=_0x4f3a76[_0x0306('0x7')]+_0x4f3a76['countcongestionretry']+_0x4f3a76['countnoanswerretry']+_0x4f3a76[_0x0306('0xa')]+_0x4f3a76[_0x0306('0xb')]+_0x4f3a76[_0x0306('0xc')]+_0x4f3a76['countmachineretry']+_0x4f3a76['countagentrejectretry'];this['countnosuchnumberretry']=_0x4f3a76[_0x0306('0xa')];this[_0x0306('0xb')]=_0x4f3a76[_0x0306('0xb')];this[_0x0306('0xc')]=_0x4f3a76[_0x0306('0xc')];this[_0x0306('0xd')]=_0x4f3a76[_0x0306('0xd')];this[_0x0306('0xe')]=_0x4f3a76['countagentrejectretry'];this[_0x0306('0xf')]=_0x5a32e7[_0x0306('0xf')];this[_0x0306('0x10')]=_0x4f3a76['name'];this['calleridnum']=_0x4f3a76['number'];this[_0x0306('0x11')]=_0x4f3a76[_0x0306('0x11')];this[_0x0306('0x12')]=_0x4f3a76['responsetime'];this['droptime']=_0x4f3a76['droptime'];this[_0x0306('0x13')]=this[_0x0306('0x14')];this[_0x0306('0x15')]=getSeconds(_0x4f3a76['responsetime'],_0x4f3a76[_0x0306('0x11')]);this[_0x0306('0x16')]=getSeconds(this[_0x0306('0x14')],_0x4f3a76[_0x0306('0x12')]);this[_0x0306('0x17')]=0x0;this[_0x0306('0x18')]=_0x5a32e7[_0x0306('0x18')];this['membername']=_0x5a32e7[_0x0306('0x19')];this[_0x0306('0x1a')]=_0x5a32e7[_0x0306('0x1a')];this[_0x0306('0x1b')]=_0x4f3a76['callback'];this[_0x0306('0x1c')]=_0x4f3a76[_0x0306('0x1c')];this['callbackat']=_0x4f3a76[_0x0306('0x1d')];this[_0x0306('0x1e')]=_0x4f3a76['recallme'];this[_0x0306('0x1f')]=_0x4f3a76[_0x0306('0x1f')];this[_0x0306('0x20')]=_0x4f3a76[_0x0306('0x20')];this[_0x0306('0x21')]=_0x4f3a76['UserId'];this[_0x0306('0x22')]=_0x4f3a76[_0x0306('0x22')];this[_0x0306('0x23')]=_0x4f3a76[_0x0306('0x23')];this[_0x0306('0x24')]=_0x4f3a76[_0x0306('0x24')]||'';this['originatecalleridname']=_0x4f3a76['originatecalleridname']||'';}module[_0x0306('0x25')]=QueueCallerAbandon; \ No newline at end of file +var _0x9f25=['countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','uniqueid','calleridname','calleridnum','number','responsetime','droptime','endtime','ringtime','reason','callback','callbackuniqueid','recallme','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','util','lodash','moment','milliseconds','diff','seconds','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry'];(function(_0x5b6e9e,_0x2111c1){var _0x903b5b=function(_0x3b22f1){while(--_0x3b22f1){_0x5b6e9e['push'](_0x5b6e9e['shift']());}};_0x903b5b(++_0x2111c1);}(_0x9f25,0xb3));var _0x59f2=function(_0xc905bf,_0x3fb45d){_0xc905bf=_0xc905bf-0x0;var _0x3ffd14=_0x9f25[_0xc905bf];return _0x3ffd14;};'use strict';var util=require(_0x59f2('0x0'));var _=require(_0x59f2('0x1'));var moment=require(_0x59f2('0x2'));function getSeconds(_0x2f84c8,_0x2d6c7b){var _0x41d27a=moment(_0x2f84c8)[_0x59f2('0x3')](0x0);var _0x22dd8c=moment(_0x2d6c7b)[_0x59f2('0x3')](0x0);return _0x41d27a[_0x59f2('0x4')](_0x22dd8c,_0x59f2('0x5'));}function QueueCallerAbandon(_0x1835d3,_0x16eeb1){this['scheduledat']=_0x1835d3[_0x59f2('0x6')];this[_0x59f2('0x7')]=_0x1835d3[_0x59f2('0x7')];this[_0x59f2('0x8')]=_0x1835d3[_0x59f2('0x7')]===_0x59f2('0x9')?_0x59f2('0xa'):_0x1835d3[_0x59f2('0x7')];this[_0x59f2('0xb')]=_0x1835d3[_0x59f2('0xb')];this[_0x59f2('0xc')]=_0x1835d3['countcongestionretry'];this[_0x59f2('0xd')]=_0x1835d3['countnoanswerretry'];this[_0x59f2('0xe')]=_0x1835d3[_0x59f2('0xb')]+_0x1835d3[_0x59f2('0xc')]+_0x1835d3[_0x59f2('0xd')]+_0x1835d3[_0x59f2('0xf')]+_0x1835d3[_0x59f2('0x10')]+_0x1835d3[_0x59f2('0x11')]+_0x1835d3[_0x59f2('0x12')]+_0x1835d3['countagentrejectretry'];this['countnosuchnumberretry']=_0x1835d3[_0x59f2('0xf')];this[_0x59f2('0x10')]=_0x1835d3['countdropretry'];this[_0x59f2('0x11')]=_0x1835d3[_0x59f2('0x11')];this['countmachineretry']=_0x1835d3[_0x59f2('0x12')];this[_0x59f2('0x13')]=_0x1835d3[_0x59f2('0x13')];this[_0x59f2('0x14')]=_0x16eeb1['uniqueid'];this[_0x59f2('0x15')]=_0x1835d3['name'];this[_0x59f2('0x16')]=_0x1835d3[_0x59f2('0x17')];this['starttime']=_0x1835d3['starttime'];this[_0x59f2('0x18')]=_0x1835d3[_0x59f2('0x18')];this[_0x59f2('0x19')]=_0x1835d3[_0x59f2('0x19')];this[_0x59f2('0x1a')]=this[_0x59f2('0x19')];this[_0x59f2('0x1b')]=getSeconds(_0x1835d3['responsetime'],_0x1835d3['starttime']);this['holdtime']=getSeconds(this[_0x59f2('0x19')],_0x1835d3['responsetime']);this['talktime']=0x0;this[_0x59f2('0xa')]=_0x16eeb1[_0x59f2('0xa')];this['membername']=_0x16eeb1['connectedlinename'];this[_0x59f2('0x1c')]=_0x16eeb1['reason'];this[_0x59f2('0x1d')]=_0x1835d3[_0x59f2('0x1d')];this[_0x59f2('0x1e')]=_0x1835d3[_0x59f2('0x1e')];this['callbackat']=_0x1835d3['callbackat'];this[_0x59f2('0x1f')]=_0x1835d3[_0x59f2('0x1f')];this['ContactId']=_0x1835d3['ContactId'];this[_0x59f2('0x20')]=_0x1835d3[_0x59f2('0x20')];this[_0x59f2('0x21')]=_0x1835d3[_0x59f2('0x21')];this[_0x59f2('0x22')]=_0x1835d3[_0x59f2('0x22')];this[_0x59f2('0x23')]=_0x1835d3['CampaignId'];this[_0x59f2('0x24')]=_0x1835d3['originatecalleridnum']||'';this['originatecalleridname']=_0x1835d3[_0x59f2('0x25')]||'';}module[_0x59f2('0x26')]=QueueCallerAbandon; \ No newline at end of file diff --git a/server/services/ami/fax/action.js b/server/services/ami/fax/action.js index c4d22f6..0bb5e47 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 _0x182c=['util','lodash','uniqueid','channel','format','%s/%s/%s','tech','Trunk','name','localstationid','headerinfo','path','AttachmentId'];(function(_0x4ab3fb,_0x776775){var _0x34fe1e=function(_0x1c94c5){while(--_0x1c94c5){_0x4ab3fb['push'](_0x4ab3fb['shift']());}};_0x34fe1e(++_0x776775);}(_0x182c,0x179));var _0xc182=function(_0xaec7d,_0x44dce6){_0xaec7d=_0xaec7d-0x0;var _0x54a0ce=_0x182c[_0xaec7d];return _0x54a0ce;};'use strict';var util=require(_0xc182('0x0'));var _=require(_0xc182('0x1'));var moment=require('moment');function Action(_0x388b5e,_0x5625a6,_0x1c0524){this[_0xc182('0x2')]=_0x388b5e||undefined;this[_0xc182('0x3')]=util[_0xc182('0x4')](_0xc182('0x5'),_0x5625a6[_0xc182('0x6')],_0x5625a6[_0xc182('0x7')][_0xc182('0x8')],_0x1c0524['fax']);this['localstationid']=_0x5625a6[_0xc182('0x9')];this['headerinfo']=_0x5625a6[_0xc182('0xa')];this['path']=_0x1c0524[_0xc182('0xb')];this[_0xc182('0xc')]=_0x1c0524[_0xc182('0xc')];}module['exports']=Action; \ No newline at end of file +var _0x72fd=['util','lodash','moment','uniqueid','channel','format','Trunk','name','fax','localstationid','headerinfo','path','AttachmentId','exports'];(function(_0x3a966d,_0x3a5994){var _0x3f3880=function(_0x1846fc){while(--_0x1846fc){_0x3a966d['push'](_0x3a966d['shift']());}};_0x3f3880(++_0x3a5994);}(_0x72fd,0xfc));var _0xd72f=function(_0x57b756,_0x39346b){_0x57b756=_0x57b756-0x0;var _0xd3580e=_0x72fd[_0x57b756];return _0xd3580e;};'use strict';var util=require(_0xd72f('0x0'));var _=require(_0xd72f('0x1'));var moment=require(_0xd72f('0x2'));function Action(_0x397cd6,_0x24e752,_0x1b1d57){this[_0xd72f('0x3')]=_0x397cd6||undefined;this[_0xd72f('0x4')]=util[_0xd72f('0x5')]('%s/%s/%s',_0x24e752['tech'],_0x24e752[_0xd72f('0x6')][_0xd72f('0x7')],_0x1b1d57[_0xd72f('0x8')]);this[_0xd72f('0x9')]=_0x24e752[_0xd72f('0x9')];this[_0xd72f('0xa')]=_0x24e752[_0xd72f('0xa')];this[_0xd72f('0xb')]=_0x1b1d57[_0xd72f('0xb')];this[_0xd72f('0xc')]=_0x1b1d57[_0xd72f('0xc')];}module[_0xd72f('0xd')]=Action; \ No newline at end of file diff --git a/server/services/ami/fax/index.js b/server/services/ami/fax/index.js index d0dc1e1..95fa7cd 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 _0xfa7d=['uniqueid','channel','name','info','\x20syncNewchannel\x20','variable','value','syncNewState','channelstate','channelstatedesc','operation','status','filename','\x20syncFaxStatus\x20','remotestationid','pagestransferred','resolution','transferrate','calleridnum','\x20result\x20conversion\x20file\x20','message','create','parse','then','notify','fax','.pdf','catch','error','\x20receiveFax\x20','stringify','syncOriginateResponse','actions','merge','pick','response','AttachmentId','update','logger','[Fax][Message][Error][Updated]','[Fax][Message][Error][NoUpdate1]','[Fax][Message][Error][NoUpdate2]','[Fax][Message][NoUpdate1]','[Fax][Message][NoUpdate2]','syncHangup','\x20hangup\x20sendFile\x20','\x20hangup\x20faxRiceive\x20','faxpages','SUCCESS','SENDING\x20FAILED:\x20','faxstatusstring','SENDING\x20FAILED','send','execOriginate','Fax\x20received','[Fax][execOriginate][failure]','Fax\x20failed','checkAfterSend','checkTrunk','FaxAccountId','Trunk','Trunk\x20Reachable','format','gs\x20-q\x20-dNOPAUSE\x20-dBATCH\x20-sDEVICE=tiffg4\x20-sPAPERSIZE=letter\x20-sOutputFile=/var/opt/motion2/server/files/attachments/%s.tif\x20\x20%s\x20-c\x20quit','execute','%s/%s.tif','dir','XMF-PATH','Convert\x20pdf\x20to\x20tif','Action','variablesAction','addVariables','ext','isTrunkReachable','isNil','active','SIP/%s','reachable','unmonitored','[Fax][checkTrunk][Trunk\x20not\x20work]','Trunk\x20not\x20working','[Fax][checkTrunk][Empty\x20Fax]','Empty\x20Fax','[Fax][checkTrunk][Empty\x20path]','Empty\x20path','util','lodash','uuid','moment','path','./util/gs','../../../config/logger','../ami','./rpcDb','./channel','./action','../rpc/faxAccount','../rpc/attachment','channels','faxAccounts','trunks','newchannel','bind','varset','syncVarSet','newstate','newexten','syncNewExten','faxstatus','syncFaxStatus','syncReceiveFax','hangup','originateresponse','prototype','syncNewchannel','from-voip-provider','hasOwnProperty','exten','localstationid'];(function(_0x4cf98e,_0xba4b79){var _0x1623ac=function(_0x459bc0){while(--_0x459bc0){_0x4cf98e['push'](_0x4cf98e['shift']());}};_0x1623ac(++_0xba4b79);}(_0xfa7d,0xcc));var _0xdfa7=function(_0x16d10f,_0x2ba2d5){_0x16d10f=_0x16d10f-0x0;var _0x50c823=_0xfa7d[_0x16d10f];return _0x50c823;};'use strict';var util=require(_0xdfa7('0x0'));var _=require(_0xdfa7('0x1'));var BPromise=require('bluebird');var uuid=require(_0xdfa7('0x2'));var moment=require(_0xdfa7('0x3'));var path=require(_0xdfa7('0x4'));var tiff2pdf=require('tiff2pdf');var gs=require(_0xdfa7('0x5'));var logger=require(_0xdfa7('0x6'))('fax');var ami=require(_0xdfa7('0x7'));var rpcDb=require(_0xdfa7('0x8'));var Channel=require(_0xdfa7('0x9'));var ut=require('./util/util');var Action=require(_0xdfa7('0xa'));var faxAccount=require(_0xdfa7('0xb'));var attachment=require(_0xdfa7('0xc'));var faxMessage=require('../rpc/faxMessage');function Fax(_0x50b7f3){this[_0xdfa7('0xd')]={};this[_0xdfa7('0xe')]=_0x50b7f3[_0xdfa7('0xe')];this[_0xdfa7('0xf')]=_0x50b7f3[_0xdfa7('0xf')];this['actions']={};ami['on'](_0xdfa7('0x10'),this['syncNewchannel'][_0xdfa7('0x11')](this));ami['on'](_0xdfa7('0x12'),this[_0xdfa7('0x13')][_0xdfa7('0x11')](this));ami['on'](_0xdfa7('0x14'),this['syncNewState']['bind'](this));ami['on'](_0xdfa7('0x15'),this[_0xdfa7('0x16')]['bind'](this));ami['on'](_0xdfa7('0x17'),this[_0xdfa7('0x18')][_0xdfa7('0x11')](this));ami['on']('receivefax',this[_0xdfa7('0x19')][_0xdfa7('0x11')](this));ami['on'](_0xdfa7('0x1a'),this['syncHangup'][_0xdfa7('0x11')](this));ami['on'](_0xdfa7('0x1b'),this['syncOriginateResponse'][_0xdfa7('0x11')](this));}Fax[_0xdfa7('0x1c')][_0xdfa7('0x1d')]=function(_0x455abe){if(_0x455abe['context']===_0xdfa7('0x1e')){for(var _0x2f857c in this['faxAccounts']){if(this[_0xdfa7('0xe')][_0xdfa7('0x1f')](_0x2f857c)){if(_0x455abe[_0xdfa7('0x20')]===this[_0xdfa7('0xe')][_0x2f857c][_0xdfa7('0x21')]){this['channels'][_0x455abe[_0xdfa7('0x22')]]={};this[_0xdfa7('0xd')][_0x455abe[_0xdfa7('0x22')]][_0xdfa7('0x23')]=_0x455abe[_0xdfa7('0x23')];this[_0xdfa7('0xd')][_0x455abe['uniqueid']]['id']=this[_0xdfa7('0xe')][_0x2f857c]['id'];this[_0xdfa7('0xd')][_0x455abe[_0xdfa7('0x22')]][_0xdfa7('0x24')]=this['faxAccounts'][_0x2f857c][_0xdfa7('0x24')];logger[_0xdfa7('0x25')](_0x455abe['uniqueid'],_0xdfa7('0x26'));}}}}if(this['actions'][_0x455abe['uniqueid']]){this[_0xdfa7('0xd')][_0x455abe[_0xdfa7('0x22')]]={};this[_0xdfa7('0xd')][_0x455abe[_0xdfa7('0x22')]][_0xdfa7('0x23')]=_0x455abe[_0xdfa7('0x23')];logger[_0xdfa7('0x25')](_0x455abe[_0xdfa7('0x22')],_0xdfa7('0x26'));}};Fax[_0xdfa7('0x1c')][_0xdfa7('0x13')]=function(_0xa9c32a){if(this[_0xdfa7('0xd')][_0xa9c32a[_0xdfa7('0x22')]]){for(var _0x198eec in _0xa9c32a[_0xdfa7('0x27')]){if(_0xa9c32a[_0xdfa7('0x27')]['hasOwnProperty'](_0x198eec)){this[_0xdfa7('0xd')][_0xa9c32a[_0xdfa7('0x22')]][_0x198eec]=_0xa9c32a[_0xdfa7('0x28')];}}}};Fax[_0xdfa7('0x1c')][_0xdfa7('0x29')]=function(_0x49ced7){if(this[_0xdfa7('0xd')][_0x49ced7[_0xdfa7('0x22')]]){this[_0xdfa7('0xd')][_0x49ced7[_0xdfa7('0x22')]][_0xdfa7('0x2a')]=_0x49ced7[_0xdfa7('0x2a')];this[_0xdfa7('0xd')][_0x49ced7['uniqueid']][_0xdfa7('0x2b')]=_0x49ced7['channelstatedesc'];}};Fax[_0xdfa7('0x1c')]['syncNewExten']=function(_0x250a33){if(this['channels'][_0x250a33[_0xdfa7('0x22')]]){for(var _0x29fa64 in _0x250a33[_0xdfa7('0x27')]){if(_0x250a33[_0xdfa7('0x27')][_0xdfa7('0x1f')](_0x29fa64)){this[_0xdfa7('0xd')][_0x250a33[_0xdfa7('0x22')]][_0x29fa64]=_0x250a33['value'];}}}};Fax[_0xdfa7('0x1c')]['syncFaxStatus']=function(_0x5a985d){if(this[_0xdfa7('0xd')][_0x5a985d[_0xdfa7('0x22')]]){this['channels'][_0x5a985d[_0xdfa7('0x22')]][_0xdfa7('0x2c')]=_0x5a985d['operation'];this[_0xdfa7('0xd')][_0x5a985d['uniqueid']][_0xdfa7('0x2d')]=_0x5a985d['status'];this[_0xdfa7('0xd')][_0x5a985d['uniqueid']][_0xdfa7('0x21')]=_0x5a985d[_0xdfa7('0x21')];this[_0xdfa7('0xd')][_0x5a985d[_0xdfa7('0x22')]][_0xdfa7('0x2e')]=_0x5a985d[_0xdfa7('0x2e')];logger[_0xdfa7('0x25')](_0x5a985d[_0xdfa7('0x22')],_0xdfa7('0x2f'));}};Fax[_0xdfa7('0x1c')][_0xdfa7('0x19')]=function(_0x4ae484){var _0x51799f=this;if(this['channels'][_0x4ae484[_0xdfa7('0x22')]]){var _0x430317=this[_0xdfa7('0xd')][_0x4ae484[_0xdfa7('0x22')]]['id'];this[_0xdfa7('0xd')][_0x4ae484[_0xdfa7('0x22')]][_0xdfa7('0x30')]=_0x4ae484[_0xdfa7('0x30')];this['channels'][_0x4ae484['uniqueid']][_0xdfa7('0x31')]=_0x4ae484['pagestransferred'];this[_0xdfa7('0xd')][_0x4ae484['uniqueid']][_0xdfa7('0x21')]=_0x4ae484[_0xdfa7('0x21')];this['channels'][_0x4ae484[_0xdfa7('0x22')]][_0xdfa7('0x32')]=_0x4ae484[_0xdfa7('0x32')];this['channels'][_0x4ae484['uniqueid']][_0xdfa7('0x33')]=_0x4ae484[_0xdfa7('0x33')];this[_0xdfa7('0xd')][_0x4ae484[_0xdfa7('0x22')]][_0xdfa7('0x2e')]=_0x4ae484[_0xdfa7('0x2e')];this[_0xdfa7('0xd')][_0x4ae484[_0xdfa7('0x22')]][_0xdfa7('0x34')]=_0x4ae484[_0xdfa7('0x34')];if(this[_0xdfa7('0xd')][_0x4ae484[_0xdfa7('0x22')]][_0xdfa7('0x31')]>0x0){tiff2pdf(_0x4ae484[_0xdfa7('0x2e')],'/var/opt/motion2/server/files/attachments/',function(_0x54e4e0){logger[_0xdfa7('0x25')](_0x4ae484['uniqueid'],_0xdfa7('0x35'),_0x54e4e0[_0xdfa7('0x36')]);attachment[_0xdfa7('0x37')]({'name':path[_0xdfa7('0x38')](_0x4ae484['filename'])[_0xdfa7('0x24')],'basename':path[_0xdfa7('0x38')](_0x4ae484[_0xdfa7('0x2e')])[_0xdfa7('0x24')]+'.pdf','type':'application/pdf'})[_0xdfa7('0x39')](function(_0x42447f){faxAccount[_0xdfa7('0x3a')](_0x430317,{'from':_0x4ae484[_0xdfa7('0x34')],'mapKey':_0xdfa7('0x3b'),'body':path[_0xdfa7('0x38')](_0x4ae484[_0xdfa7('0x2e')])[_0xdfa7('0x24')]+_0xdfa7('0x3c'),'AttachmentId':_0x42447f['id']})[_0xdfa7('0x3d')](function(_0xba0d12){logger[_0xdfa7('0x3e')](_0x4ae484[_0xdfa7('0x22')],'\x20notify\x20',JSON['stringify'](_0xba0d12));});})[_0xdfa7('0x3d')](function(_0x3f4410){logger[_0xdfa7('0x3e')](_0x4ae484['uniqueid'],_0xdfa7('0x3f'),JSON[_0xdfa7('0x40')](_0x3f4410));});});}logger[_0xdfa7('0x25')](_0x4ae484[_0xdfa7('0x22')],_0xdfa7('0x3f'));}};Fax[_0xdfa7('0x1c')][_0xdfa7('0x41')]=function(_0x2dd7d9){if(this[_0xdfa7('0x42')][_0x2dd7d9[_0xdfa7('0x22')]]){_[_0xdfa7('0x43')](this[_0xdfa7('0xd')][_0x2dd7d9[_0xdfa7('0x22')]],_[_0xdfa7('0x44')](_0x2dd7d9,[_0xdfa7('0x45'),'reason']));}};function updateStatus(_0x5cccdc){if(_0x5cccdc[_0xdfa7('0x46')]){faxMessage[_0xdfa7('0x47')](_0x5cccdc[_0xdfa7('0x46')],{'failMessage':'SENDING\x20FAILED\x20'})[_0xdfa7('0x39')](function(_0x4a4f11){ut[_0xdfa7('0x48')](_0xdfa7('0x49'),_0x4a4f11);})['catch'](function(_0x7e04c7){ut[_0xdfa7('0x48')](_0xdfa7('0x4a'),_0x7e04c7);});}else{ut[_0xdfa7('0x48')](_0xdfa7('0x4b'));}}Fax[_0xdfa7('0x1c')]['updateStatus']=function(_0x3b0666,_0x40b250,_0x2c7f9f){var _0x5b56ad=this;var _0xd288d4={};if(_0x40b250){_0xd288d4={'read':_0x40b250};}else{_0xd288d4={'failMessage':_0x2c7f9f};}if(this['actions'][_0x3b0666][_0xdfa7('0x46')]){faxMessage['update'](this[_0xdfa7('0x42')][_0x3b0666][_0xdfa7('0x46')],_0xd288d4)['then'](function(_0x50e620){ut[_0xdfa7('0x48')]('[Fax][Message][Updated]',_0x50e620);})[_0xdfa7('0x3d')](function(_0x231def){ut[_0xdfa7('0x48')](_0xdfa7('0x4c'),_0x231def);})['finally'](function(){delete _0x5b56ad[_0xdfa7('0xd')][_0x3b0666];delete _0x5b56ad['actions'][_0x3b0666];});}else{ut[_0xdfa7('0x48')](_0xdfa7('0x4d'));delete this[_0xdfa7('0xd')][_0x3b0666];delete this[_0xdfa7('0x42')][_0x3b0666];}};Fax[_0xdfa7('0x1c')][_0xdfa7('0x4e')]=function(_0x117709){var _0x154f30=this;if(this[_0xdfa7('0xd')][_0x117709['uniqueid']]){if(this['actions'][_0x117709[_0xdfa7('0x22')]]){this['channels'][_0x117709[_0xdfa7('0x22')]]['id']=this['actions'][_0x117709['uniqueid']]['id'];this['channels'][_0x117709['uniqueid']]['name']=this[_0xdfa7('0x42')][_0x117709['uniqueid']][_0xdfa7('0x24')];}logger['info'](_0x117709['uniqueid'],this['actions'][_0x117709['uniqueid']]?_0xdfa7('0x4f'):_0xdfa7('0x50'),JSON[_0xdfa7('0x40')](this['channels'][_0x117709[_0xdfa7('0x22')]]));if(this[_0xdfa7('0x42')][_0x117709[_0xdfa7('0x22')]]){if(this[_0xdfa7('0xd')][_0x117709['uniqueid']][_0xdfa7('0x51')]>0x0&&this[_0xdfa7('0xd')][_0x117709[_0xdfa7('0x22')]][_0xdfa7('0x17')]===_0xdfa7('0x52')){this['updateStatus'](_0x117709['uniqueid'],!![]);}else{this['updateStatus'](_0x117709[_0xdfa7('0x22')],![],this[_0xdfa7('0xd')][_0x117709[_0xdfa7('0x22')]]['faxstatusstring']?_0xdfa7('0x53')+this[_0xdfa7('0xd')][_0x117709[_0xdfa7('0x22')]][_0xdfa7('0x54')]:_0xdfa7('0x55'));}}}};Fax[_0xdfa7('0x1c')][_0xdfa7('0x56')]=function(_0x5dcf51){var _0x46b365=this;return new BPromise(function(_0x1c2f99,_0x102c33){_0x46b365[_0xdfa7('0x57')](_0x5dcf51,_0x46b365[_0xdfa7('0xe')][_0x5dcf51['FaxAccountId']])[_0xdfa7('0x39')](function(_0x36f685){ut[_0xdfa7('0x48')]('[Fax][execOriginate][success]',_0x36f685);_0x1c2f99(ut[_0xdfa7('0x36')](_0xdfa7('0x58')));})[_0xdfa7('0x3d')](function(_0x16b8fb){ut[_0xdfa7('0x48')](_0xdfa7('0x59'),_0x16b8fb);updateStatus(_0x5dcf51);_0x102c33(ut[_0xdfa7('0x36')](_0xdfa7('0x5a')));});});};Fax[_0xdfa7('0x1c')][_0xdfa7('0x5b')]=function(_0x2ba77e){var _0x566f25=this;return new BPromise(function(_0x14d08c,_0x9f5ad9){var _0x5378a9=_0x566f25[_0xdfa7('0x5c')](_0x566f25[_0xdfa7('0xe')][_0x2ba77e[_0xdfa7('0x5d')]][_0xdfa7('0x5e')],_0x2ba77e);if(_0x5378a9['isValid']){_0x14d08c(ut['message'](_0xdfa7('0x5f')));}else{_0x9f5ad9(ut[_0xdfa7('0x36')](_0x5378a9[_0xdfa7('0x36')]));}});};function originate(_0x40d7d1,_0x4f6f01,_0x584ec6){return new BPromise(function(_0x24c50d,_0x4c2e37){if(_0x584ec6){var _0x1f6956=util[_0xdfa7('0x60')](_0xdfa7('0x61'),path[_0xdfa7('0x38')](_0x40d7d1[_0xdfa7('0x4')])[_0xdfa7('0x24')],_0x40d7d1[_0xdfa7('0x4')]);gs[_0xdfa7('0x62')](_0x1f6956)[_0xdfa7('0x39')](function(){_0x40d7d1[_0xdfa7('0x4')]=util[_0xdfa7('0x60')](_0xdfa7('0x63'),path[_0xdfa7('0x38')](_0x40d7d1[_0xdfa7('0x4')])[_0xdfa7('0x64')],path[_0xdfa7('0x38')](_0x40d7d1['path'])[_0xdfa7('0x24')]);_0x4f6f01[_0xdfa7('0x65')]=_0x40d7d1['path'];ut[_0xdfa7('0x48')](_0xdfa7('0x66'),'');ami[_0xdfa7('0x67')](ut[_0xdfa7('0x68')](_0x40d7d1,_0x4f6f01))[_0xdfa7('0x39')](function(_0x1ebc88){_0x24c50d(_0x1ebc88);})['catch'](function(_0x5a6b84){_0x4c2e37(_0x5a6b84);});})[_0xdfa7('0x3d')](function(_0x17e7bf){_0x4c2e37(_0x17e7bf);});}else{ami['Action'](ut[_0xdfa7('0x68')](_0x40d7d1,_0x4f6f01))[_0xdfa7('0x39')](function(_0x242cc6){_0x24c50d(_0x242cc6);})['catch'](function(_0xaecbfb){_0x4c2e37(_0xaecbfb);});}});}Fax[_0xdfa7('0x1c')][_0xdfa7('0x57')]=function(_0x53f165,_0x36046b){var _0x524ae4=this;return new BPromise(function(_0x1014c7,_0x5d663f){var _0x51decc=uuid['v4']();var _0x5adb12=ut[_0xdfa7('0x69')](_0x53f165,_0x36046b);_0x524ae4[_0xdfa7('0x42')][_0x51decc]=new Action(_0x51decc,_0x36046b,_0x53f165);var _0x481b49=_0x524ae4[_0xdfa7('0x42')][_0x51decc];if(path['parse'](_0x53f165[_0xdfa7('0x4')])[_0xdfa7('0x6a')]==='.pdf'){originate(_0x481b49,_0x5adb12,!![])[_0xdfa7('0x39')](function(_0x51065f){_0x1014c7(_0x51065f);})[_0xdfa7('0x3d')](function(_0x39c958){_0x5d663f(_0x39c958);});}else{originate(_0x481b49,_0x5adb12,![])[_0xdfa7('0x39')](function(_0xa90492){_0x1014c7(_0xa90492);})[_0xdfa7('0x3d')](function(_0x501426){_0x5d663f(_0x501426);});}});};Fax[_0xdfa7('0x1c')][_0xdfa7('0x6b')]=function(_0x2c1b8b){return!_[_0xdfa7('0x6c')](_0x2c1b8b)&&!_[_0xdfa7('0x6c')](_0x2c1b8b[_0xdfa7('0x24')])&&!_[_0xdfa7('0x6c')](_0x2c1b8b[_0xdfa7('0x6d')])&&_0x2c1b8b[_0xdfa7('0x6d')]&&!_[_0xdfa7('0x6c')](this[_0xdfa7('0xf')][util[_0xdfa7('0x60')](_0xdfa7('0x6e'),_0x2c1b8b[_0xdfa7('0x24')])])&&!_[_0xdfa7('0x6c')](this[_0xdfa7('0xf')][util[_0xdfa7('0x60')](_0xdfa7('0x6e'),_0x2c1b8b[_0xdfa7('0x24')])][_0xdfa7('0x2d')])&&(this[_0xdfa7('0xf')][util['format']('SIP/%s',_0x2c1b8b[_0xdfa7('0x24')])][_0xdfa7('0x2d')]===_0xdfa7('0x6f')||this[_0xdfa7('0xf')][util[_0xdfa7('0x60')](_0xdfa7('0x6e'),_0x2c1b8b['name'])][_0xdfa7('0x2d')]===_0xdfa7('0x70'));};Fax[_0xdfa7('0x1c')]['checkTrunk']=function(_0x3304fd,_0x279693){if(!this[_0xdfa7('0x6b')](_0x3304fd)){ut[_0xdfa7('0x48')](_0xdfa7('0x71'),_[_0xdfa7('0x6c')](_0x3304fd)?'':_0x3304fd[_0xdfa7('0x24')]+'\x20Trunk\x20is\x20not\x20active');return{'isValid':![],'message':_0xdfa7('0x72')};}if(_[_0xdfa7('0x6c')](_0x279693['fax'])){ut['logger'](_0xdfa7('0x73'),JSON['stringify'](_0x279693));return{'isValid':![],'message':_0xdfa7('0x74')};}if(_[_0xdfa7('0x6c')](_0x279693[_0xdfa7('0x4')])){ut[_0xdfa7('0x48')](_0xdfa7('0x75'),JSON[_0xdfa7('0x40')](_0x279693));return{'isValid':![],'message':_0xdfa7('0x76')};}return{'isValid':!![],'message':'Is\x20Valid'};};module['exports']=Fax; \ No newline at end of file +var _0xedea=['isTrunkReachable','isNil','active','SIP/%s','unmonitored','[Fax][checkTrunk][Trunk\x20not\x20work]','\x20Trunk\x20is\x20not\x20active','Trunk\x20not\x20working','[Fax][checkTrunk][Empty\x20Fax]','Empty\x20Fax','Empty\x20path','Is\x20Valid','exports','util','lodash','uuid','path','./util/gs','../../../config/logger','fax','./rpcDb','./channel','./action','../rpc/faxAccount','../rpc/attachment','../rpc/faxMessage','channels','faxAccounts','trunks','syncNewchannel','varset','syncVarSet','bind','newstate','syncNewState','faxstatus','receivefax','syncReceiveFax','syncOriginateResponse','prototype','context','from-voip-provider','hasOwnProperty','channel','uniqueid','name','info','\x20syncNewchannel\x20','actions','variable','channelstate','syncNewExten','value','operation','status','localstationid','filename','remotestationid','pagestransferred','resolution','transferrate','calleridnum','/var/opt/motion2/server/files/attachments/','message','parse','.pdf','application/pdf','then','notify','error','\x20notify\x20','catch','\x20receiveFax\x20','stringify','merge','pick','response','AttachmentId','update','SENDING\x20FAILED\x20','logger','[Fax][Message][Error][NoUpdate1]','[Fax][Message][Updated]','[Fax][Message][NoUpdate1]','finally','syncHangup','\x20hangup\x20sendFile\x20','\x20hangup\x20faxRiceive\x20','SUCCESS','updateStatus','faxstatusstring','SENDING\x20FAILED','send','[Fax][execOriginate][success]','Fax\x20received','[Fax][execOriginate][failure]','FaxAccountId','Trunk','isValid','Trunk\x20Reachable','format','gs\x20-q\x20-dNOPAUSE\x20-dBATCH\x20-sDEVICE=tiffg4\x20-sPAPERSIZE=letter\x20-sOutputFile=/var/opt/motion2/server/files/attachments/%s.tif\x20\x20%s\x20-c\x20quit','execute','%s/%s.tif','dir','Convert\x20pdf\x20to\x20tif','Action','variablesAction','execOriginate','addVariables','ext'];(function(_0x16cab8,_0x130774){var _0x252212=function(_0x2bc113){while(--_0x2bc113){_0x16cab8['push'](_0x16cab8['shift']());}};_0x252212(++_0x130774);}(_0xedea,0x1c9));var _0xaede=function(_0x36a66e,_0x51d84a){_0x36a66e=_0x36a66e-0x0;var _0x1a0f79=_0xedea[_0x36a66e];return _0x1a0f79;};'use strict';var util=require(_0xaede('0x0'));var _=require(_0xaede('0x1'));var BPromise=require('bluebird');var uuid=require(_0xaede('0x2'));var moment=require('moment');var path=require(_0xaede('0x3'));var tiff2pdf=require('tiff2pdf');var gs=require(_0xaede('0x4'));var logger=require(_0xaede('0x5'))(_0xaede('0x6'));var ami=require('../ami');var rpcDb=require(_0xaede('0x7'));var Channel=require(_0xaede('0x8'));var ut=require('./util/util');var Action=require(_0xaede('0x9'));var faxAccount=require(_0xaede('0xa'));var attachment=require(_0xaede('0xb'));var faxMessage=require(_0xaede('0xc'));function Fax(_0x813a00){this[_0xaede('0xd')]={};this[_0xaede('0xe')]=_0x813a00['faxAccounts'];this[_0xaede('0xf')]=_0x813a00['trunks'];this['actions']={};ami['on']('newchannel',this[_0xaede('0x10')]['bind'](this));ami['on'](_0xaede('0x11'),this[_0xaede('0x12')][_0xaede('0x13')](this));ami['on'](_0xaede('0x14'),this[_0xaede('0x15')]['bind'](this));ami['on']('newexten',this['syncNewExten'][_0xaede('0x13')](this));ami['on'](_0xaede('0x16'),this['syncFaxStatus'][_0xaede('0x13')](this));ami['on'](_0xaede('0x17'),this[_0xaede('0x18')][_0xaede('0x13')](this));ami['on']('hangup',this['syncHangup'][_0xaede('0x13')](this));ami['on']('originateresponse',this[_0xaede('0x19')][_0xaede('0x13')](this));}Fax[_0xaede('0x1a')][_0xaede('0x10')]=function(_0x558821){if(_0x558821[_0xaede('0x1b')]===_0xaede('0x1c')){for(var _0x269434 in this[_0xaede('0xe')]){if(this[_0xaede('0xe')][_0xaede('0x1d')](_0x269434)){if(_0x558821['exten']===this['faxAccounts'][_0x269434]['localstationid']){this[_0xaede('0xd')][_0x558821['uniqueid']]={};this[_0xaede('0xd')][_0x558821['uniqueid']][_0xaede('0x1e')]=_0x558821[_0xaede('0x1e')];this[_0xaede('0xd')][_0x558821[_0xaede('0x1f')]]['id']=this[_0xaede('0xe')][_0x269434]['id'];this[_0xaede('0xd')][_0x558821[_0xaede('0x1f')]]['name']=this[_0xaede('0xe')][_0x269434][_0xaede('0x20')];logger[_0xaede('0x21')](_0x558821[_0xaede('0x1f')],_0xaede('0x22'));}}}}if(this[_0xaede('0x23')][_0x558821[_0xaede('0x1f')]]){this[_0xaede('0xd')][_0x558821[_0xaede('0x1f')]]={};this['channels'][_0x558821[_0xaede('0x1f')]][_0xaede('0x1e')]=_0x558821[_0xaede('0x1e')];logger[_0xaede('0x21')](_0x558821[_0xaede('0x1f')],_0xaede('0x22'));}};Fax[_0xaede('0x1a')][_0xaede('0x12')]=function(_0x2d420c){if(this[_0xaede('0xd')][_0x2d420c[_0xaede('0x1f')]]){for(var _0x14719f in _0x2d420c[_0xaede('0x24')]){if(_0x2d420c[_0xaede('0x24')][_0xaede('0x1d')](_0x14719f)){this['channels'][_0x2d420c[_0xaede('0x1f')]][_0x14719f]=_0x2d420c['value'];}}}};Fax[_0xaede('0x1a')][_0xaede('0x15')]=function(_0x1384a2){if(this[_0xaede('0xd')][_0x1384a2[_0xaede('0x1f')]]){this['channels'][_0x1384a2['uniqueid']][_0xaede('0x25')]=_0x1384a2[_0xaede('0x25')];this[_0xaede('0xd')][_0x1384a2['uniqueid']]['channelstatedesc']=_0x1384a2['channelstatedesc'];}};Fax['prototype'][_0xaede('0x26')]=function(_0x26673e){if(this[_0xaede('0xd')][_0x26673e[_0xaede('0x1f')]]){for(var _0xcaf1c4 in _0x26673e[_0xaede('0x24')]){if(_0x26673e[_0xaede('0x24')]['hasOwnProperty'](_0xcaf1c4)){this[_0xaede('0xd')][_0x26673e[_0xaede('0x1f')]][_0xcaf1c4]=_0x26673e[_0xaede('0x27')];}}}};Fax[_0xaede('0x1a')]['syncFaxStatus']=function(_0xdc4386){if(this[_0xaede('0xd')][_0xdc4386[_0xaede('0x1f')]]){this[_0xaede('0xd')][_0xdc4386[_0xaede('0x1f')]]['operation']=_0xdc4386[_0xaede('0x28')];this[_0xaede('0xd')][_0xdc4386[_0xaede('0x1f')]][_0xaede('0x29')]=_0xdc4386[_0xaede('0x29')];this[_0xaede('0xd')][_0xdc4386[_0xaede('0x1f')]][_0xaede('0x2a')]=_0xdc4386[_0xaede('0x2a')];this[_0xaede('0xd')][_0xdc4386[_0xaede('0x1f')]][_0xaede('0x2b')]=_0xdc4386['filename'];logger['info'](_0xdc4386[_0xaede('0x1f')],'\x20syncFaxStatus\x20');}};Fax['prototype'][_0xaede('0x18')]=function(_0x217e64){var _0x450452=this;if(this['channels'][_0x217e64['uniqueid']]){var _0x4e074d=this['channels'][_0x217e64['uniqueid']]['id'];this[_0xaede('0xd')][_0x217e64[_0xaede('0x1f')]]['remotestationid']=_0x217e64[_0xaede('0x2c')];this[_0xaede('0xd')][_0x217e64[_0xaede('0x1f')]][_0xaede('0x2d')]=_0x217e64['pagestransferred'];this['channels'][_0x217e64[_0xaede('0x1f')]][_0xaede('0x2a')]=_0x217e64[_0xaede('0x2a')];this[_0xaede('0xd')][_0x217e64[_0xaede('0x1f')]]['resolution']=_0x217e64[_0xaede('0x2e')];this[_0xaede('0xd')][_0x217e64[_0xaede('0x1f')]][_0xaede('0x2f')]=_0x217e64[_0xaede('0x2f')];this[_0xaede('0xd')][_0x217e64[_0xaede('0x1f')]][_0xaede('0x2b')]=_0x217e64[_0xaede('0x2b')];this['channels'][_0x217e64[_0xaede('0x1f')]][_0xaede('0x30')]=_0x217e64[_0xaede('0x30')];if(this[_0xaede('0xd')][_0x217e64['uniqueid']][_0xaede('0x2d')]>0x0){tiff2pdf(_0x217e64['filename'],_0xaede('0x31'),function(_0x5cf09e){logger['info'](_0x217e64['uniqueid'],'\x20result\x20conversion\x20file\x20',_0x5cf09e[_0xaede('0x32')]);attachment['create']({'name':path[_0xaede('0x33')](_0x217e64[_0xaede('0x2b')])[_0xaede('0x20')],'basename':path[_0xaede('0x33')](_0x217e64[_0xaede('0x2b')])['name']+_0xaede('0x34'),'type':_0xaede('0x35')})[_0xaede('0x36')](function(_0x4d0ea1){faxAccount[_0xaede('0x37')](_0x4e074d,{'from':_0x217e64[_0xaede('0x30')],'mapKey':_0xaede('0x6'),'body':path['parse'](_0x217e64['filename'])['name']+_0xaede('0x34'),'AttachmentId':_0x4d0ea1['id']})['catch'](function(_0x44b3be){logger[_0xaede('0x38')](_0x217e64[_0xaede('0x1f')],_0xaede('0x39'),JSON['stringify'](_0x44b3be));});})[_0xaede('0x3a')](function(_0x3a9af1){logger[_0xaede('0x38')](_0x217e64[_0xaede('0x1f')],_0xaede('0x3b'),JSON[_0xaede('0x3c')](_0x3a9af1));});});}logger[_0xaede('0x21')](_0x217e64[_0xaede('0x1f')],'\x20receiveFax\x20');}};Fax[_0xaede('0x1a')][_0xaede('0x19')]=function(_0x294a8d){if(this[_0xaede('0x23')][_0x294a8d[_0xaede('0x1f')]]){_[_0xaede('0x3d')](this[_0xaede('0xd')][_0x294a8d[_0xaede('0x1f')]],_[_0xaede('0x3e')](_0x294a8d,[_0xaede('0x3f'),'reason']));}};function updateStatus(_0x205be1){if(_0x205be1[_0xaede('0x40')]){faxMessage[_0xaede('0x41')](_0x205be1[_0xaede('0x40')],{'failMessage':_0xaede('0x42')})[_0xaede('0x36')](function(_0x450c47){ut['logger']('[Fax][Message][Error][Updated]',_0x450c47);})[_0xaede('0x3a')](function(_0x4620bc){ut[_0xaede('0x43')](_0xaede('0x44'),_0x4620bc);});}else{ut[_0xaede('0x43')]('[Fax][Message][Error][NoUpdate2]');}}Fax[_0xaede('0x1a')]['updateStatus']=function(_0x4d4366,_0x23c227,_0x576783){var _0xfffdc1=this;var _0x32573f={};if(_0x23c227){_0x32573f={'read':_0x23c227};}else{_0x32573f={'failMessage':_0x576783};}if(this[_0xaede('0x23')][_0x4d4366][_0xaede('0x40')]){faxMessage[_0xaede('0x41')](this[_0xaede('0x23')][_0x4d4366][_0xaede('0x40')],_0x32573f)[_0xaede('0x36')](function(_0xab2fd1){ut['logger'](_0xaede('0x45'),_0xab2fd1);})[_0xaede('0x3a')](function(_0x50e267){ut[_0xaede('0x43')](_0xaede('0x46'),_0x50e267);})[_0xaede('0x47')](function(){delete _0xfffdc1[_0xaede('0xd')][_0x4d4366];delete _0xfffdc1[_0xaede('0x23')][_0x4d4366];});}else{ut[_0xaede('0x43')]('[Fax][Message][NoUpdate2]');delete this['channels'][_0x4d4366];delete this[_0xaede('0x23')][_0x4d4366];}};Fax[_0xaede('0x1a')][_0xaede('0x48')]=function(_0x23487d){var _0x7c68a5=this;if(this[_0xaede('0xd')][_0x23487d[_0xaede('0x1f')]]){if(this[_0xaede('0x23')][_0x23487d[_0xaede('0x1f')]]){this['channels'][_0x23487d['uniqueid']]['id']=this['actions'][_0x23487d[_0xaede('0x1f')]]['id'];this[_0xaede('0xd')][_0x23487d[_0xaede('0x1f')]][_0xaede('0x20')]=this['actions'][_0x23487d[_0xaede('0x1f')]]['name'];}logger[_0xaede('0x21')](_0x23487d[_0xaede('0x1f')],this[_0xaede('0x23')][_0x23487d[_0xaede('0x1f')]]?_0xaede('0x49'):_0xaede('0x4a'),JSON[_0xaede('0x3c')](this[_0xaede('0xd')][_0x23487d[_0xaede('0x1f')]]));if(this[_0xaede('0x23')][_0x23487d[_0xaede('0x1f')]]){if(this[_0xaede('0xd')][_0x23487d[_0xaede('0x1f')]]['faxpages']>0x0&&this[_0xaede('0xd')][_0x23487d[_0xaede('0x1f')]][_0xaede('0x16')]===_0xaede('0x4b')){this[_0xaede('0x4c')](_0x23487d[_0xaede('0x1f')],!![]);}else{this[_0xaede('0x4c')](_0x23487d[_0xaede('0x1f')],![],this['channels'][_0x23487d[_0xaede('0x1f')]][_0xaede('0x4d')]?'SENDING\x20FAILED:\x20'+this[_0xaede('0xd')][_0x23487d[_0xaede('0x1f')]][_0xaede('0x4d')]:_0xaede('0x4e'));}}}};Fax[_0xaede('0x1a')][_0xaede('0x4f')]=function(_0x751b1e){var _0x9e6385=this;return new BPromise(function(_0xdb843,_0x12e853){_0x9e6385['execOriginate'](_0x751b1e,_0x9e6385['faxAccounts'][_0x751b1e['FaxAccountId']])[_0xaede('0x36')](function(_0x3f9f80){ut[_0xaede('0x43')](_0xaede('0x50'),_0x3f9f80);_0xdb843(ut[_0xaede('0x32')](_0xaede('0x51')));})[_0xaede('0x3a')](function(_0xf84b86){ut[_0xaede('0x43')](_0xaede('0x52'),_0xf84b86);updateStatus(_0x751b1e);_0x12e853(ut[_0xaede('0x32')]('Fax\x20failed'));});});};Fax['prototype']['checkAfterSend']=function(_0x3e51e3){var _0x2d42c1=this;return new BPromise(function(_0x411b30,_0x57e960){var _0x4c50e6=_0x2d42c1['checkTrunk'](_0x2d42c1['faxAccounts'][_0x3e51e3[_0xaede('0x53')]][_0xaede('0x54')],_0x3e51e3);if(_0x4c50e6[_0xaede('0x55')]){_0x411b30(ut[_0xaede('0x32')](_0xaede('0x56')));}else{_0x57e960(ut[_0xaede('0x32')](_0x4c50e6[_0xaede('0x32')]));}});};function originate(_0x4716e1,_0x5948ca,_0x397de1){return new BPromise(function(_0x4a4bad,_0x225227){if(_0x397de1){var _0x27f64b=util[_0xaede('0x57')](_0xaede('0x58'),path[_0xaede('0x33')](_0x4716e1[_0xaede('0x3')])[_0xaede('0x20')],_0x4716e1[_0xaede('0x3')]);gs[_0xaede('0x59')](_0x27f64b)[_0xaede('0x36')](function(){_0x4716e1[_0xaede('0x3')]=util[_0xaede('0x57')](_0xaede('0x5a'),path[_0xaede('0x33')](_0x4716e1[_0xaede('0x3')])[_0xaede('0x5b')],path[_0xaede('0x33')](_0x4716e1['path'])[_0xaede('0x20')]);_0x5948ca['XMF-PATH']=_0x4716e1[_0xaede('0x3')];ut[_0xaede('0x43')](_0xaede('0x5c'),'');ami[_0xaede('0x5d')](ut[_0xaede('0x5e')](_0x4716e1,_0x5948ca))[_0xaede('0x36')](function(_0x23ce85){_0x4a4bad(_0x23ce85);})[_0xaede('0x3a')](function(_0x5dc860){_0x225227(_0x5dc860);});})[_0xaede('0x3a')](function(_0x56b952){_0x225227(_0x56b952);});}else{ami[_0xaede('0x5d')](ut['variablesAction'](_0x4716e1,_0x5948ca))[_0xaede('0x36')](function(_0xf7e430){_0x4a4bad(_0xf7e430);})[_0xaede('0x3a')](function(_0x221caf){_0x225227(_0x221caf);});}});}Fax[_0xaede('0x1a')][_0xaede('0x5f')]=function(_0x3453d6,_0x2b0b28){var _0x538f57=this;return new BPromise(function(_0x40dcd8,_0x3836f6){var _0x2e9ae4=uuid['v4']();var _0x31fb04=ut[_0xaede('0x60')](_0x3453d6,_0x2b0b28);_0x538f57[_0xaede('0x23')][_0x2e9ae4]=new Action(_0x2e9ae4,_0x2b0b28,_0x3453d6);var _0x250359=_0x538f57[_0xaede('0x23')][_0x2e9ae4];if(path['parse'](_0x3453d6['path'])[_0xaede('0x61')]===_0xaede('0x34')){originate(_0x250359,_0x31fb04,!![])[_0xaede('0x36')](function(_0xa28c7f){_0x40dcd8(_0xa28c7f);})[_0xaede('0x3a')](function(_0x40267e){_0x3836f6(_0x40267e);});}else{originate(_0x250359,_0x31fb04,![])[_0xaede('0x36')](function(_0xc9f38c){_0x40dcd8(_0xc9f38c);})['catch'](function(_0x59aa42){_0x3836f6(_0x59aa42);});}});};Fax[_0xaede('0x1a')][_0xaede('0x62')]=function(_0x3565eb){return!_[_0xaede('0x63')](_0x3565eb)&&!_['isNil'](_0x3565eb['name'])&&!_[_0xaede('0x63')](_0x3565eb[_0xaede('0x64')])&&_0x3565eb[_0xaede('0x64')]&&!_[_0xaede('0x63')](this[_0xaede('0xf')][util[_0xaede('0x57')](_0xaede('0x65'),_0x3565eb[_0xaede('0x20')])])&&!_[_0xaede('0x63')](this[_0xaede('0xf')][util['format']('SIP/%s',_0x3565eb[_0xaede('0x20')])]['status'])&&(this[_0xaede('0xf')][util[_0xaede('0x57')](_0xaede('0x65'),_0x3565eb['name'])][_0xaede('0x29')]==='reachable'||this['trunks'][util['format']('SIP/%s',_0x3565eb[_0xaede('0x20')])][_0xaede('0x29')]===_0xaede('0x66'));};Fax[_0xaede('0x1a')]['checkTrunk']=function(_0xd9687f,_0x32affd){if(!this['isTrunkReachable'](_0xd9687f)){ut[_0xaede('0x43')](_0xaede('0x67'),_[_0xaede('0x63')](_0xd9687f)?'':_0xd9687f['name']+_0xaede('0x68'));return{'isValid':![],'message':_0xaede('0x69')};}if(_[_0xaede('0x63')](_0x32affd['fax'])){ut[_0xaede('0x43')](_0xaede('0x6a'),JSON['stringify'](_0x32affd));return{'isValid':![],'message':_0xaede('0x6b')};}if(_['isNil'](_0x32affd[_0xaede('0x3')])){ut['logger']('[Fax][checkTrunk][Empty\x20path]',JSON[_0xaede('0x3c')](_0x32affd));return{'isValid':![],'message':_0xaede('0x6c')};}return{'isValid':!![],'message':_0xaede('0x6d')};};module[_0xaede('0x6e')]=Fax; \ No newline at end of file diff --git a/server/services/ami/fax/rpcDb.js b/server/services/ami/fax/rpcDb.js index b1d8d1f..145e1cb 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 _0x3932=['[Notify]\x20','util','../../../config/logger','preview','lodash','../rpc/faxAccount','error','notify','resolve','then','catch'];(function(_0x1f19da,_0x2cd3d3){var _0x18ff49=function(_0x40a555){while(--_0x40a555){_0x1f19da['push'](_0x1f19da['shift']());}};_0x18ff49(++_0x2cd3d3);}(_0x3932,0x6f));var _0x2393=function(_0x1a04a6,_0x1b9764){_0x1a04a6=_0x1a04a6-0x0;var _0xb3f005=_0x3932[_0x1a04a6];return _0xb3f005;};'use strict';var util=require(_0x2393('0x0'));var BPromise=require('bluebird');var logger=require(_0x2393('0x1'))(_0x2393('0x2'));var _=require(_0x2393('0x3'));var faxAccount=require(_0x2393('0x4'));function loggerCatch(_0xa8e3f4){return function(_0x9c4139){logger[_0x2393('0x5')](_0xa8e3f4,util['inspect'](_0x9c4139,{'showHidden':![],'depth':null}));};}exports[_0x2393('0x6')]=function(_0x2445e7,_0x75716c){return BPromise[_0x2393('0x7')]()[_0x2393('0x8')](faxAccount[_0x2393('0x6')](_0x2445e7,_0x75716c))[_0x2393('0x9')](loggerCatch(_0x2393('0xa')));}; \ No newline at end of file +var _0x743b=['catch','[Notify]\x20','util','bluebird','../../../config/logger','preview','lodash','error','notify','then'];(function(_0x4d4d9f,_0x50f769){var _0x57b383=function(_0x5027b5){while(--_0x5027b5){_0x4d4d9f['push'](_0x4d4d9f['shift']());}};_0x57b383(++_0x50f769);}(_0x743b,0x124));var _0xb743=function(_0x459ef9,_0x5624fe){_0x459ef9=_0x459ef9-0x0;var _0x2751b8=_0x743b[_0x459ef9];return _0x2751b8;};'use strict';var util=require(_0xb743('0x0'));var BPromise=require(_0xb743('0x1'));var logger=require(_0xb743('0x2'))(_0xb743('0x3'));var _=require(_0xb743('0x4'));var faxAccount=require('../rpc/faxAccount');function loggerCatch(_0x7a7d06){return function(_0x40b261){logger[_0xb743('0x5')](_0x7a7d06,util['inspect'](_0x40b261,{'showHidden':![],'depth':null}));};}exports[_0xb743('0x6')]=function(_0x3e8b83,_0x536cd7){return BPromise['resolve']()[_0xb743('0x7')](faxAccount['notify'](_0x3e8b83,_0x536cd7))[_0xb743('0x8')](loggerCatch(_0xb743('0x9')));}; \ 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 450be31..0ce28d2 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 _0x044e=['\x20Error\x20:','inspect','util','../../../../config/logger','fax','child_process','exec','execute','info','Exec\x20gs'];(function(_0x59b48b,_0x584733){var _0x4c3f79=function(_0x3f2e94){while(--_0x3f2e94){_0x59b48b['push'](_0x59b48b['shift']());}};_0x4c3f79(++_0x584733);}(_0x044e,0x1b0));var _0xe044=function(_0x4998f7,_0x43137b){_0x4998f7=_0x4998f7-0x0;var _0x15cab9=_0x044e[_0x4998f7];return _0x15cab9;};'use strict';var util=require(_0xe044('0x0'));var logger=require(_0xe044('0x1'))(_0xe044('0x2'));var BPromise=require('bluebird');var exec=require(_0xe044('0x3'))[_0xe044('0x4')];exports[_0xe044('0x5')]=function(_0x30fe5f){return new BPromise(function(_0x4c4885,_0x457f3a){exec(_0x30fe5f,function(_0x23f176,_0x490d30,_0x46b46c){logger[_0xe044('0x6')](_0xe044('0x7'),_0x490d30);if(_0x23f176){logger[_0xe044('0x6')]('Exec\x20gs',_0xe044('0x8'),util[_0xe044('0x9')](_0x23f176,{'showHidden':![],'depth':null}),_0x490d30,_0x46b46c);_0x457f3a(_0x23f176);}_0x4c4885(_0x490d30);});});}; \ No newline at end of file +var _0x40c1=['util','../../../../config/logger','bluebird','exec','Exec\x20gs','info','\x20Error\x20:','inspect'];(function(_0x261b8a,_0x553ec4){var _0x3455e8=function(_0xdf10d4){while(--_0xdf10d4){_0x261b8a['push'](_0x261b8a['shift']());}};_0x3455e8(++_0x553ec4);}(_0x40c1,0x130));var _0x140c=function(_0x17a495,_0x7e24ed){_0x17a495=_0x17a495-0x0;var _0x53bf9b=_0x40c1[_0x17a495];return _0x53bf9b;};'use strict';var util=require(_0x140c('0x0'));var logger=require(_0x140c('0x1'))('fax');var BPromise=require(_0x140c('0x2'));var exec=require('child_process')[_0x140c('0x3')];exports['execute']=function(_0x428ac3){return new BPromise(function(_0x16936b,_0x4b2845){exec(_0x428ac3,function(_0x16cb06,_0x282246,_0x420b56){logger['info'](_0x140c('0x4'),_0x282246);if(_0x16cb06){logger[_0x140c('0x5')]('Exec\x20gs',_0x140c('0x6'),util[_0x140c('0x7')](_0x16cb06,{'showHidden':![],'depth':null}),_0x282246,_0x420b56);_0x4b2845(_0x16cb06);}_0x16936b(_0x282246);});});}; \ 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 2bf0044..89f7131 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 _0x524a=['gateway','t38timeout','localstationid','uniqueid','xcally-motion-fax','util','lodash','moment','../../../../config/logger','message','logger','info','inspect','addVariables','ecm','headerinfo','maxrate','format','\x22%s\x22','modem'];(function(_0x52de9b,_0x19df61){var _0x1ad0c7=function(_0x26a38c){while(--_0x26a38c){_0x52de9b['push'](_0x52de9b['shift']());}};_0x1ad0c7(++_0x19df61);}(_0x524a,0xf5));var _0xa524=function(_0x5410bf,_0x5f5356){_0x5410bf=_0x5410bf-0x0;var _0x287ded=_0x524a[_0x5410bf];return _0x287ded;};'use strict';var util=require(_0xa524('0x0'));var _=require(_0xa524('0x1'));var moment=require(_0xa524('0x2'));var logger=require(_0xa524('0x3'))('fax');exports[_0xa524('0x4')]=function(_0x2ef77c){return{'message':_0x2ef77c};};exports[_0xa524('0x5')]=function(_0x56ab08,_0x50ec75){logger[_0xa524('0x6')](_0x56ab08,util[_0xa524('0x7')](_0x50ec75,{'showHidden':![],'depth':null}));};exports[_0xa524('0x8')]=function(_0x5f472f,_0x460738){var _0x56bd0e={'XMF-ECM':_0x460738[_0xa524('0x9')],'XMF-HEADERINFO':_0x460738[_0xa524('0xa')],'XMF-MINRATE':_0x460738['minrate'],'XMF-MAXRATE':_0x460738[_0xa524('0xb')],'XMF-MODEM':util[_0xa524('0xc')](_0xa524('0xd'),_0x460738[_0xa524('0xe')]),'XMF-GATEWAY':_0x460738[_0xa524('0xf')],'XMF-FAXDETECT':_0x460738['faxdetect'],'XMF-T38TIMEOUT':_0x460738[_0xa524('0x10')],'XMF-LOCALSTATIONID':_0x460738[_0xa524('0x11')],'XMF-PATH':_0x5f472f['path']};return _0x56bd0e;};exports['variablesAction']=function(_0x2fc0f9,_0xdbba15){return{'actionid':_0x2fc0f9[_0xa524('0x12')],'action':'originate','channel':_0x2fc0f9['channel'],'Exten':_0xa524('0x13'),'Context':'from-sip','Priority':'1','callerid':util[_0xa524('0xc')]('\x22%s\x22\x20<%s>',_0x2fc0f9[_0xa524('0xa')]?_0x2fc0f9['headerinfo']:'',_0x2fc0f9[_0xa524('0x11')]),'variable':_0xdbba15,'timeout':0x1e*0x3e8,'async':!![],'channelid':_0x2fc0f9[_0xa524('0x12')]};}; \ No newline at end of file +var _0xbb53=['modem','faxdetect','path','variablesAction','originate','from-sip','\x22%s\x22\x20<%s>','headerinfo','localstationid','util','lodash','moment','../../../../config/logger','fax','message','logger','addVariables','ecm','format','\x22%s\x22'];(function(_0xd3a712,_0x33cd67){var _0x50e8f9=function(_0x501d63){while(--_0x501d63){_0xd3a712['push'](_0xd3a712['shift']());}};_0x50e8f9(++_0x33cd67);}(_0xbb53,0x121));var _0x3bb5=function(_0x4dee51,_0x290293){_0x4dee51=_0x4dee51-0x0;var _0x7b92d1=_0xbb53[_0x4dee51];return _0x7b92d1;};'use strict';var util=require(_0x3bb5('0x0'));var _=require(_0x3bb5('0x1'));var moment=require(_0x3bb5('0x2'));var logger=require(_0x3bb5('0x3'))(_0x3bb5('0x4'));exports[_0x3bb5('0x5')]=function(_0x414da7){return{'message':_0x414da7};};exports[_0x3bb5('0x6')]=function(_0x83e44b,_0x450d9e){logger['info'](_0x83e44b,util['inspect'](_0x450d9e,{'showHidden':![],'depth':null}));};exports[_0x3bb5('0x7')]=function(_0x2460b0,_0x28aa7d){var _0x157e04={'XMF-ECM':_0x28aa7d[_0x3bb5('0x8')],'XMF-HEADERINFO':_0x28aa7d['headerinfo'],'XMF-MINRATE':_0x28aa7d['minrate'],'XMF-MAXRATE':_0x28aa7d['maxrate'],'XMF-MODEM':util[_0x3bb5('0x9')](_0x3bb5('0xa'),_0x28aa7d[_0x3bb5('0xb')]),'XMF-GATEWAY':_0x28aa7d['gateway'],'XMF-FAXDETECT':_0x28aa7d[_0x3bb5('0xc')],'XMF-T38TIMEOUT':_0x28aa7d['t38timeout'],'XMF-LOCALSTATIONID':_0x28aa7d['localstationid'],'XMF-PATH':_0x2460b0[_0x3bb5('0xd')]};return _0x157e04;};exports[_0x3bb5('0xe')]=function(_0x5cfc6b,_0xe00ace){return{'actionid':_0x5cfc6b['uniqueid'],'action':_0x3bb5('0xf'),'channel':_0x5cfc6b['channel'],'Exten':'xcally-motion-fax','Context':_0x3bb5('0x10'),'Priority':'1','callerid':util[_0x3bb5('0x9')](_0x3bb5('0x11'),_0x5cfc6b['headerinfo']?_0x5cfc6b[_0x3bb5('0x12')]:'',_0x5cfc6b[_0x3bb5('0x13')]),'variable':_0xe00ace,'timeout':0x1e*0x3e8,'async':!![],'channelid':_0x5cfc6b['uniqueid']};}; \ No newline at end of file diff --git a/server/services/ami/index.js b/server/services/ami/index.js index bb11c06..c219033 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 _0x020e=['./report','./acw','./trigger','./dialer','./preview','./fax','./rpc/voiceQueue','./rpc/voiceQueueReport','./rpc/trunk','./rpc/trigger','./rpc/template','./rpc/cmHopperHistory','./rpc/campaign','./rpc/integrations/zendesk','./rpc/integrations/salesforce','./rpc/integrations/desk','./rpc/integrations/zoho','./rpc/integrations/vtiger','./rpc/integrations/freshsales','./rpc/integrations/servicenow','./rpc/integrations/dynamics365','get','hour','then','initAgents','getTelephones','initTelephones','getTrunks','initTrunks','getVoiceQueues','initVoiceQueues','getTriggers','getZendeskAccounts','initZendeskAccounts','getSalesforceAccounts','initSalesforceAccounts','getSugarcrmAccounts','initSugarcrmAccounts','getFreshdeskAccounts','initFreshdeskAccounts','getDeskAccounts','initDeskAccounts','getZohoAccounts','initVtigerAccounts','getFreshsalesAccounts','initFreshsalesAccounts','getServicenowAccounts','initServicenowAccounts','getDynamics365Accounts','initDynamics365Accounts','getCampaigns','getVoiceExtensions','getFaxAccounts','initFaxAccounts','resolve','getVoiceQueueReports','getVoiceQueueHopperHistory','initVoiceQueueHopperHistory','getCampaignHopperHistory','initCampaignHopperHistory','getVoiceCallReports','catch','bluebird','moment','./server'];(function(_0x1b95a6,_0x45d97a){var _0x496ac8=function(_0x1b35a1){while(--_0x1b35a1){_0x1b95a6['push'](_0x1b95a6['shift']());}};_0x496ac8(++_0x45d97a);}(_0x020e,0xc0));var _0xe020=function(_0x20fcfa,_0x40d572){_0x20fcfa=_0x20fcfa-0x0;var _0x2c48c8=_0x020e[_0x20fcfa];return _0x2c48c8;};'use strict';var BPromise=require(_0xe020('0x0'));var util=require('util');var moment=require(_0xe020('0x1'));var server=require(_0xe020('0x2'));var Realtime=require('./realtime');var Report=require(_0xe020('0x3'));var Acw=require(_0xe020('0x4'));var Trigger=require(_0xe020('0x5'));var Dialer=require(_0xe020('0x6'));var Preview=require(_0xe020('0x7'));var Fax=require(_0xe020('0x8'));var user=require('./rpc/user');var voiceQueue=require(_0xe020('0x9'));var voiceQueueReport=require(_0xe020('0xa'));var voiceCallReport=require('./rpc/voiceCallReport');var trunk=require(_0xe020('0xb'));var trigger=require(_0xe020('0xc'));var template=require(_0xe020('0xd'));var cmHopperHistory=require(_0xe020('0xe'));var campaign=require(_0xe020('0xf'));var voiceExtension=require('./rpc/voiceExtension');var faxAccount=require('./rpc/faxAccount');var zendesk=require(_0xe020('0x10'));var salesforce=require(_0xe020('0x11'));var sugarcrm=require('./rpc/integrations/sugarcrm');var freshdesk=require('./rpc/integrations/freshdesk');var desk=require(_0xe020('0x12'));var zoho=require(_0xe020('0x13'));var vtiger=require(_0xe020('0x14'));var freshsales=require(_0xe020('0x15'));var servicenow=require(_0xe020('0x16'));var dynamics365=require(_0xe020('0x17'));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()[_0xe020('0x18')]('hour')===0x0&&initP){initP=![];isTrue=!![];initParams();}if(moment()[_0xe020('0x18')](_0xe020('0x19'))===0x1&&isTrue){isTrue=![];initP=!![];}}function initRealtime(){ifMidnight();return BPromise['resolve']()[_0xe020('0x1a')](user['getAgents']())[_0xe020('0x1a')](realtime[_0xe020('0x1b')]())[_0xe020('0x1a')](user[_0xe020('0x1c')]())[_0xe020('0x1a')](realtime[_0xe020('0x1d')]())[_0xe020('0x1a')](trunk[_0xe020('0x1e')]())[_0xe020('0x1a')](realtime[_0xe020('0x1f')]())[_0xe020('0x1a')](voiceQueue[_0xe020('0x20')]())['then'](realtime[_0xe020('0x21')]())['then'](trigger[_0xe020('0x22')]())['then'](realtime['initTriggers']())[_0xe020('0x1a')](template['getTemplates']())[_0xe020('0x1a')](realtime['initTemplates']())[_0xe020('0x1a')](zendesk[_0xe020('0x23')]())[_0xe020('0x1a')](realtime[_0xe020('0x24')]())[_0xe020('0x1a')](salesforce[_0xe020('0x25')]())[_0xe020('0x1a')](realtime[_0xe020('0x26')]())[_0xe020('0x1a')](sugarcrm[_0xe020('0x27')]())[_0xe020('0x1a')](realtime[_0xe020('0x28')]())['then'](freshdesk[_0xe020('0x29')]())[_0xe020('0x1a')](realtime[_0xe020('0x2a')]())['then'](desk[_0xe020('0x2b')]())['then'](realtime[_0xe020('0x2c')]())[_0xe020('0x1a')](zoho[_0xe020('0x2d')]())[_0xe020('0x1a')](realtime['initZohoAccounts']())[_0xe020('0x1a')](vtiger['getVtigerAccounts']())[_0xe020('0x1a')](realtime[_0xe020('0x2e')]())[_0xe020('0x1a')](freshsales[_0xe020('0x2f')]())[_0xe020('0x1a')](realtime[_0xe020('0x30')]())['then'](servicenow[_0xe020('0x31')]())[_0xe020('0x1a')](realtime[_0xe020('0x32')]())['then'](dynamics365[_0xe020('0x33')]())[_0xe020('0x1a')](realtime[_0xe020('0x34')]())[_0xe020('0x1a')](campaign[_0xe020('0x35')]())[_0xe020('0x1a')](realtime['initCampaigns']())[_0xe020('0x1a')](voiceExtension[_0xe020('0x36')]())[_0xe020('0x1a')](realtime['initVoiceExtensions']())['then'](faxAccount[_0xe020('0x37')]())[_0xe020('0x1a')](realtime[_0xe020('0x38')]())[_0xe020('0x1a')](function(){return realtime;});}function initParams(){return BPromise[_0xe020('0x39')]()[_0xe020('0x1a')](voiceQueueReport[_0xe020('0x3a')]())[_0xe020('0x1a')](realtime['initVoiceQueueReports']())[_0xe020('0x1a')](cmHopperHistory[_0xe020('0x3b')]())[_0xe020('0x1a')](realtime[_0xe020('0x3c')]())[_0xe020('0x1a')](cmHopperHistory[_0xe020('0x3d')]())[_0xe020('0x1a')](realtime[_0xe020('0x3e')]())[_0xe020('0x1a')](voiceCallReport[_0xe020('0x3f')]())[_0xe020('0x1a')](realtime['initVoiceCallReports']())[_0xe020('0x1a')](function(_0x1cf65c){})['catch'](function(_0x698a3f){console['log'](_0x698a3f);});}function main(){return server['listen'](realtime,preview,fax)[_0xe020('0x1a')](function(_0x45b47b){return initRealtime();})['then'](function(){return initParams();})[_0xe020('0x1a')](function(){report['sync']();setInterval(initRealtime,0x1388);})[_0xe020('0x40')](function(_0x56065b){console['log'](_0x56065b);});}main(); \ No newline at end of file +var _0xb7e8=['sync','bluebird','moment','./server','./realtime','./report','./trigger','./dialer','./fax','./rpc/user','./rpc/voiceQueue','./rpc/voiceCallReport','./rpc/trigger','./rpc/template','./rpc/cmHopperHistory','./rpc/campaign','./rpc/faxAccount','./rpc/integrations/salesforce','./rpc/integrations/sugarcrm','./rpc/integrations/servicenow','./rpc/integrations/dynamics365','get','hour','resolve','then','getAgents','initAgents','getTelephones','getTrunks','initTrunks','initVoiceQueues','initTriggers','initTemplates','initZendeskAccounts','getSalesforceAccounts','initSugarcrmAccounts','getFreshdeskAccounts','initFreshdeskAccounts','initDeskAccounts','initZohoAccounts','getVtigerAccounts','getFreshsalesAccounts','initFreshsalesAccounts','getServicenowAccounts','initServicenowAccounts','getDynamics365Accounts','initDynamics365Accounts','getCampaigns','initCampaigns','getVoiceExtensions','initVoiceExtensions','getFaxAccounts','initFaxAccounts','initVoiceQueueReports','getVoiceQueueHopperHistory','initVoiceQueueHopperHistory','getVoiceCallReports','initVoiceCallReports','catch','log','listen'];(function(_0xfa49d0,_0x4437d1){var _0x12184e=function(_0x1029d7){while(--_0x1029d7){_0xfa49d0['push'](_0xfa49d0['shift']());}};_0x12184e(++_0x4437d1);}(_0xb7e8,0x1e9));var _0x8b7e=function(_0x1aab74,_0x38a57b){_0x1aab74=_0x1aab74-0x0;var _0x396af2=_0xb7e8[_0x1aab74];return _0x396af2;};'use strict';var BPromise=require(_0x8b7e('0x0'));var util=require('util');var moment=require(_0x8b7e('0x1'));var server=require(_0x8b7e('0x2'));var Realtime=require(_0x8b7e('0x3'));var Report=require(_0x8b7e('0x4'));var Acw=require('./acw');var Trigger=require(_0x8b7e('0x5'));var Dialer=require(_0x8b7e('0x6'));var Preview=require('./preview');var Fax=require(_0x8b7e('0x7'));var user=require(_0x8b7e('0x8'));var voiceQueue=require(_0x8b7e('0x9'));var voiceQueueReport=require('./rpc/voiceQueueReport');var voiceCallReport=require(_0x8b7e('0xa'));var trunk=require('./rpc/trunk');var trigger=require(_0x8b7e('0xb'));var template=require(_0x8b7e('0xc'));var cmHopperHistory=require(_0x8b7e('0xd'));var campaign=require(_0x8b7e('0xe'));var voiceExtension=require('./rpc/voiceExtension');var faxAccount=require(_0x8b7e('0xf'));var zendesk=require('./rpc/integrations/zendesk');var salesforce=require(_0x8b7e('0x10'));var sugarcrm=require(_0x8b7e('0x11'));var freshdesk=require('./rpc/integrations/freshdesk');var desk=require('./rpc/integrations/desk');var zoho=require('./rpc/integrations/zoho');var vtiger=require('./rpc/integrations/vtiger');var freshsales=require('./rpc/integrations/freshsales');var servicenow=require(_0x8b7e('0x12'));var dynamics365=require(_0x8b7e('0x13'));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()[_0x8b7e('0x14')](_0x8b7e('0x15'))===0x0&&initP){initP=![];isTrue=!![];initParams();}if(moment()[_0x8b7e('0x14')](_0x8b7e('0x15'))===0x1&&isTrue){isTrue=![];initP=!![];}}function initRealtime(){ifMidnight();return BPromise[_0x8b7e('0x16')]()[_0x8b7e('0x17')](user[_0x8b7e('0x18')]())[_0x8b7e('0x17')](realtime[_0x8b7e('0x19')]())[_0x8b7e('0x17')](user[_0x8b7e('0x1a')]())[_0x8b7e('0x17')](realtime['initTelephones']())[_0x8b7e('0x17')](trunk[_0x8b7e('0x1b')]())['then'](realtime[_0x8b7e('0x1c')]())[_0x8b7e('0x17')](voiceQueue['getVoiceQueues']())['then'](realtime[_0x8b7e('0x1d')]())[_0x8b7e('0x17')](trigger['getTriggers']())[_0x8b7e('0x17')](realtime[_0x8b7e('0x1e')]())['then'](template['getTemplates']())[_0x8b7e('0x17')](realtime[_0x8b7e('0x1f')]())[_0x8b7e('0x17')](zendesk['getZendeskAccounts']())[_0x8b7e('0x17')](realtime[_0x8b7e('0x20')]())[_0x8b7e('0x17')](salesforce[_0x8b7e('0x21')]())[_0x8b7e('0x17')](realtime['initSalesforceAccounts']())['then'](sugarcrm['getSugarcrmAccounts']())[_0x8b7e('0x17')](realtime[_0x8b7e('0x22')]())[_0x8b7e('0x17')](freshdesk[_0x8b7e('0x23')]())[_0x8b7e('0x17')](realtime[_0x8b7e('0x24')]())[_0x8b7e('0x17')](desk['getDeskAccounts']())['then'](realtime[_0x8b7e('0x25')]())[_0x8b7e('0x17')](zoho['getZohoAccounts']())[_0x8b7e('0x17')](realtime[_0x8b7e('0x26')]())[_0x8b7e('0x17')](vtiger[_0x8b7e('0x27')]())[_0x8b7e('0x17')](realtime['initVtigerAccounts']())[_0x8b7e('0x17')](freshsales[_0x8b7e('0x28')]())[_0x8b7e('0x17')](realtime[_0x8b7e('0x29')]())['then'](servicenow[_0x8b7e('0x2a')]())[_0x8b7e('0x17')](realtime[_0x8b7e('0x2b')]())[_0x8b7e('0x17')](dynamics365[_0x8b7e('0x2c')]())[_0x8b7e('0x17')](realtime[_0x8b7e('0x2d')]())[_0x8b7e('0x17')](campaign[_0x8b7e('0x2e')]())[_0x8b7e('0x17')](realtime[_0x8b7e('0x2f')]())[_0x8b7e('0x17')](voiceExtension[_0x8b7e('0x30')]())[_0x8b7e('0x17')](realtime[_0x8b7e('0x31')]())['then'](faxAccount[_0x8b7e('0x32')]())[_0x8b7e('0x17')](realtime[_0x8b7e('0x33')]())[_0x8b7e('0x17')](function(){return realtime;});}function initParams(){return BPromise[_0x8b7e('0x16')]()[_0x8b7e('0x17')](voiceQueueReport['getVoiceQueueReports']())['then'](realtime[_0x8b7e('0x34')]())[_0x8b7e('0x17')](cmHopperHistory[_0x8b7e('0x35')]())[_0x8b7e('0x17')](realtime[_0x8b7e('0x36')]())[_0x8b7e('0x17')](cmHopperHistory['getCampaignHopperHistory']())[_0x8b7e('0x17')](realtime['initCampaignHopperHistory']())[_0x8b7e('0x17')](voiceCallReport[_0x8b7e('0x37')]())[_0x8b7e('0x17')](realtime[_0x8b7e('0x38')]())[_0x8b7e('0x17')](function(_0xf9e6f0){})[_0x8b7e('0x39')](function(_0x4fa775){console[_0x8b7e('0x3a')](_0x4fa775);});}function main(){return server[_0x8b7e('0x3b')](realtime,preview,fax)['then'](function(_0x1d6762){return initRealtime();})[_0x8b7e('0x17')](function(){return initParams();})[_0x8b7e('0x17')](function(){report[_0x8b7e('0x3c')]();setInterval(initRealtime,0x1388);})['catch'](function(_0x3372be){console[_0x8b7e('0x3a')](_0x3372be);});}main(); \ No newline at end of file diff --git a/server/services/ami/model/agent.js b/server/services/ami/model/agent.js index 0c45efd..1da24b8 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 _0x7b44=['unknown','address','phone','mobile','interface','online','voiceStatusTime','onhold','md5','updateStatusRealtime','toLowerCase','not_inuse','idle','talking','voiceStatus','format','stateTime','status','voiceStatusCallerIdNumber','voiceStatusQueue','stringify','user:%s','emit','exports','lodash','util','ioredis','../../../config/environment','redis','defaults','localhost','name','email','accountcode','fullname','state'];(function(_0x11de10,_0x3f7597){var _0x492991=function(_0x262282){while(--_0x262282){_0x11de10['push'](_0x11de10['shift']());}};_0x492991(++_0x3f7597);}(_0x7b44,0x1c8));var _0x47b4=function(_0x3c0c76,_0x10018a){_0x3c0c76=_0x3c0c76-0x0;var _0x137ea7=_0x7b44[_0x3c0c76];return _0x137ea7;};'use strict';var _=require(_0x47b4('0x0'));var util=require(_0x47b4('0x1'));var moment=require('moment');var md5=require('md5');var Redis=require(_0x47b4('0x2'));var config=require(_0x47b4('0x3'));config[_0x47b4('0x4')]=_[_0x47b4('0x5')](config[_0x47b4('0x4')],{'host':_0x47b4('0x6'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x47b4('0x4')]));function Agent(_0x41c285){this['id']=_0x41c285['id']||0x0;this[_0x47b4('0x7')]=_0x41c285[_0x47b4('0x7')]||'';this['email']=_0x41c285[_0x47b4('0x8')]||'';this[_0x47b4('0x9')]=_0x41c285[_0x47b4('0x9')]||'';this[_0x47b4('0xa')]=_0x41c285[_0x47b4('0xa')]||'';this[_0x47b4('0xb')]='unknown';this['stateTime']=0x0;this['status']=_0x47b4('0xc');this[_0x47b4('0xd')]='';this[_0x47b4('0xe')]='';this[_0x47b4('0xf')]='';this[_0x47b4('0x10')]='';this[_0x47b4('0x11')]=_0x41c285[_0x47b4('0x11')]||![];this['voiceStatus']=_0x47b4('0xc');this[_0x47b4('0x12')]=0x0;this['voiceStatusCallerIdNumber']='';this['voiceStatusQueue']='';this[_0x47b4('0x13')]=![];this['local']=![];this[_0x47b4('0x14')]='';}Agent['prototype'][_0x47b4('0x15')]=function(_0x14a323){var _0x21729e;if(_0x14a323&&_0x14a323[_0x47b4('0xb')]){_0x21729e=_0x14a323[_0x47b4('0xb')][_0x47b4('0x16')]();switch(_0x21729e){case _0x47b4('0x17'):_0x21729e=_0x47b4('0x18');break;case'inuse':_0x21729e=_0x47b4('0x19');break;}}if(_0x21729e&&this[_0x47b4('0x1a')]!==_0x21729e||_0x14a323['statePause']){this[_0x47b4('0x12')]=_['toNumber'](moment()[_0x47b4('0x1b')]('x'));}if(_0x21729e){this['voiceStatus']=_0x21729e;}var _0x4283fe={'id':this['id'],'name':this[_0x47b4('0x7')],'email':this['email'],'accountcode':this['accountcode'],'fullname':this[_0x47b4('0xa')],'state':this['state'],'stateTime':this[_0x47b4('0x1c')],'status':this[_0x47b4('0x1d')],'address':this[_0x47b4('0xd')],'online':this[_0x47b4('0x11')],'voiceStatus':this[_0x47b4('0x1a')],'voiceStatusTime':this[_0x47b4('0x12')],'voiceStatusCallerIdNumber':this[_0x47b4('0x1e')],'voiceStatusQueue':this[_0x47b4('0x1f')],'interface':this[_0x47b4('0x10')],'onhold':this[_0x47b4('0x13')]};var _0x2f44fa=md5(JSON[_0x47b4('0x20')](_0x4283fe));if(this[_0x47b4('0x14')]!==_0x2f44fa){this[_0x47b4('0x14')]=_0x2f44fa;io['to'](util[_0x47b4('0x1b')](_0x47b4('0x21'),_0x4283fe[_0x47b4('0x7')]))[_0x47b4('0x22')]('user:save',_0x4283fe);}};module[_0x47b4('0x23')]=Agent; \ No newline at end of file +var _0xf22c=['ioredis','redis','localhost','socket.io-emitter','name','email','accountcode','fullname','state','stateTime','status','unknown','address','mobile','online','voiceStatus','voiceStatusTime','voiceStatusCallerIdNumber','prototype','toLowerCase','not_inuse','talking','toNumber','format','voiceStatusQueue','onhold','stringify','user:%s','emit','user:save','exports','lodash','util','moment','md5'];(function(_0xfd066f,_0x192341){var _0x28767d=function(_0x1b962b){while(--_0x1b962b){_0xfd066f['push'](_0xfd066f['shift']());}};_0x28767d(++_0x192341);}(_0xf22c,0x88));var _0xcf22=function(_0x46697f,_0x45e50e){_0x46697f=_0x46697f-0x0;var _0xd0ad9=_0xf22c[_0x46697f];return _0xd0ad9;};'use strict';var _=require(_0xcf22('0x0'));var util=require(_0xcf22('0x1'));var moment=require(_0xcf22('0x2'));var md5=require(_0xcf22('0x3'));var Redis=require(_0xcf22('0x4'));var config=require('../../../config/environment');config['redis']=_['defaults'](config[_0xcf22('0x5')],{'host':_0xcf22('0x6'),'port':0x18eb});var io=require(_0xcf22('0x7'))(new Redis(config['redis']));function Agent(_0x44e306){this['id']=_0x44e306['id']||0x0;this[_0xcf22('0x8')]=_0x44e306[_0xcf22('0x8')]||'';this[_0xcf22('0x9')]=_0x44e306[_0xcf22('0x9')]||'';this[_0xcf22('0xa')]=_0x44e306[_0xcf22('0xa')]||'';this[_0xcf22('0xb')]=_0x44e306[_0xcf22('0xb')]||'';this[_0xcf22('0xc')]='unknown';this[_0xcf22('0xd')]=0x0;this[_0xcf22('0xe')]=_0xcf22('0xf');this[_0xcf22('0x10')]='';this['phone']='';this[_0xcf22('0x11')]='';this['interface']='';this[_0xcf22('0x12')]=_0x44e306['online']||![];this[_0xcf22('0x13')]=_0xcf22('0xf');this[_0xcf22('0x14')]=0x0;this[_0xcf22('0x15')]='';this['voiceStatusQueue']='';this['onhold']=![];this['local']=![];this[_0xcf22('0x3')]='';}Agent[_0xcf22('0x16')]['updateStatusRealtime']=function(_0x4b93de){var _0x4f91b9;if(_0x4b93de&&_0x4b93de['state']){_0x4f91b9=_0x4b93de[_0xcf22('0xc')][_0xcf22('0x17')]();switch(_0x4f91b9){case _0xcf22('0x18'):_0x4f91b9='idle';break;case'inuse':_0x4f91b9=_0xcf22('0x19');break;}}if(_0x4f91b9&&this[_0xcf22('0x13')]!==_0x4f91b9||_0x4b93de['statePause']){this[_0xcf22('0x14')]=_[_0xcf22('0x1a')](moment()[_0xcf22('0x1b')]('x'));}if(_0x4f91b9){this['voiceStatus']=_0x4f91b9;}var _0x3fa154={'id':this['id'],'name':this[_0xcf22('0x8')],'email':this[_0xcf22('0x9')],'accountcode':this['accountcode'],'fullname':this[_0xcf22('0xb')],'state':this['state'],'stateTime':this['stateTime'],'status':this['status'],'address':this['address'],'online':this[_0xcf22('0x12')],'voiceStatus':this[_0xcf22('0x13')],'voiceStatusTime':this[_0xcf22('0x14')],'voiceStatusCallerIdNumber':this[_0xcf22('0x15')],'voiceStatusQueue':this[_0xcf22('0x1c')],'interface':this['interface'],'onhold':this[_0xcf22('0x1d')]};var _0x2fac88=md5(JSON[_0xcf22('0x1e')](_0x3fa154));if(this['md5']!==_0x2fac88){this['md5']=_0x2fac88;io['to'](util['format'](_0xcf22('0x1f'),_0x3fa154['name']))[_0xcf22('0x20')](_0xcf22('0x21'),_0x3fa154);}};module[_0xcf22('0x22')]=Agent; \ No newline at end of file diff --git a/server/services/ami/model/campaign.js b/server/services/ami/model/campaign.js index 120088d..6a0d806 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 _0xad99=['name','type','campaign','originated','ivrAnswerCallsDay','ivrTotalCallsDays','message','sendMessageOneNotActive','active','limitCalls','dialTimezone','dialGlobalInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialOrderByScheduledAt','DESC','dialPrefix','dialRandomLastDigitCallerIdNumber','dialCutDigit','TrunkBackup','Trunk','Interval','SquareProject','dialQueueProject','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDMaximumWordLength'];(function(_0x2605dc,_0x50cf7e){var _0x4568c9=function(_0x447f7c){while(--_0x447f7c){_0x2605dc['push'](_0x2605dc['shift']());}};_0x4568c9(++_0x50cf7e);}(_0xad99,0x64));var _0x9ad9=function(_0x495f44,_0x20ec8b){_0x495f44=_0x495f44-0x0;var _0x3761a0=_0xad99[_0x495f44];return _0x3761a0;};'use strict';function Campaign(_0x4672de){this['id']=_0x4672de['id']||0x0;this[_0x9ad9('0x0')]=_0x4672de[_0x9ad9('0x0')]||'';this['type']=_0x4672de[_0x9ad9('0x1')]||_0x9ad9('0x2');this[_0x9ad9('0x3')]=0x0;this['temp']=0x0;this[_0x9ad9('0x4')]=0x0;this[_0x9ad9('0x5')]=0x0;this[_0x9ad9('0x6')]='';this[_0x9ad9('0x7')]=!![];this[_0x9ad9('0x8')]=_0x4672de[_0x9ad9('0x8')];this[_0x9ad9('0x9')]=_0x4672de[_0x9ad9('0x9')];this[_0x9ad9('0xa')]=_0x4672de[_0x9ad9('0xa')]||null;this[_0x9ad9('0xb')]=_0x4672de['dialGlobalInterval']?_0x4672de[_0x9ad9('0xb')]:null;this[_0x9ad9('0xc')]=_0x4672de[_0x9ad9('0xc')];this['dialOriginateCallerIdNumber']=_0x4672de[_0x9ad9('0xd')];this[_0x9ad9('0xe')]=_0x4672de[_0x9ad9('0xe')]||0x1e;this['dialCongestionMaxRetry']=_0x4672de[_0x9ad9('0xf')];this[_0x9ad9('0x10')]=_0x4672de[_0x9ad9('0x10')];this[_0x9ad9('0x11')]=_0x4672de['dialBusyMaxRetry'];this['dialBusyRetryFrequency']=_0x4672de[_0x9ad9('0x12')];this[_0x9ad9('0x13')]=_0x4672de[_0x9ad9('0x13')];this[_0x9ad9('0x14')]=_0x4672de[_0x9ad9('0x14')];this[_0x9ad9('0x15')]=_0x4672de[_0x9ad9('0x15')];this[_0x9ad9('0x16')]=_0x4672de[_0x9ad9('0x16')]||0x3;this[_0x9ad9('0x17')]=_0x4672de[_0x9ad9('0x17')]||0x96;this[_0x9ad9('0x18')]=_0x4672de[_0x9ad9('0x18')]||0x3;this[_0x9ad9('0x19')]=_0x4672de[_0x9ad9('0x19')]||0x96;this[_0x9ad9('0x1a')]=_0x4672de[_0x9ad9('0x1a')]||0x3;this[_0x9ad9('0x1b')]=_0x4672de[_0x9ad9('0x1b')]||0x96;this[_0x9ad9('0x1c')]=_0x4672de[_0x9ad9('0x1c')]||0x3;this['dialMachineRetryFrequency']=_0x4672de['dialMachineRetryFrequency']||0x96;this['dialAgentRejectMaxRetry']=_0x4672de[_0x9ad9('0x1d')]||0x3;this['dialAgentRejectRetryFrequency']=_0x4672de[_0x9ad9('0x1e')]||0x96;this[_0x9ad9('0x1f')]=_0x4672de[_0x9ad9('0x1f')]||_0x9ad9('0x20');this['dialPrefix']=_0x4672de[_0x9ad9('0x21')]||undefined;this[_0x9ad9('0x22')]=_0x4672de[_0x9ad9('0x22')]||undefined;this['dialCutDigit']=_0x4672de[_0x9ad9('0x23')]||undefined;this[_0x9ad9('0x24')]=_0x4672de['TrunkBackup']?_0x4672de[_0x9ad9('0x24')]:undefined;this[_0x9ad9('0x25')]=_0x4672de[_0x9ad9('0x25')]?_0x4672de[_0x9ad9('0x25')]:undefined;this[_0x9ad9('0x26')]=_0x4672de[_0x9ad9('0x26')]?_0x4672de[_0x9ad9('0x26')]:undefined;this[_0x9ad9('0x27')]=_0x4672de['SquareProject']?_0x4672de[_0x9ad9('0x27')]:undefined;this[_0x9ad9('0x28')]=_0x4672de[_0x9ad9('0x27')]?_0x4672de['SquareProject'][_0x9ad9('0x0')]:undefined;this[_0x9ad9('0x29')]=_0x4672de[_0x9ad9('0x29')]||![];this[_0x9ad9('0x2a')]=_0x4672de[_0x9ad9('0x2a')];this['dialAMDGreeting']=_0x4672de[_0x9ad9('0x2b')];this[_0x9ad9('0x2c')]=_0x4672de[_0x9ad9('0x2c')];this['dialAMDTotalAnalysisTime']=_0x4672de[_0x9ad9('0x2d')];this[_0x9ad9('0x2e')]=_0x4672de['dialAMDMinWordLength'];this[_0x9ad9('0x2f')]=_0x4672de[_0x9ad9('0x2f')];this[_0x9ad9('0x30')]=_0x4672de[_0x9ad9('0x30')];this['dialAMDSilenceThreshold']=_0x4672de['dialAMDSilenceThreshold'];this[_0x9ad9('0x31')]=_0x4672de[_0x9ad9('0x31')];}module['exports']=Campaign; \ No newline at end of file +var _0x9b15=['dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialOrderByScheduledAt','DESC','dialPrefix','dialRandomLastDigitCallerIdNumber','dialCutDigit','TrunkBackup','Trunk','Interval','SquareProject','dialQueueProject','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','exports','name','type','campaign','originated','temp','ivrAnswerCallsDay','ivrTotalCallsDays','message','sendMessageOneNotActive','active','limitCalls','dialTimezone','dialGlobalInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry'];(function(_0x114e73,_0x1ccb13){var _0x673e28=function(_0x5e894a){while(--_0x5e894a){_0x114e73['push'](_0x114e73['shift']());}};_0x673e28(++_0x1ccb13);}(_0x9b15,0x191));var _0x59b1=function(_0x5e9ff7,_0x327315){_0x5e9ff7=_0x5e9ff7-0x0;var _0x49f6a2=_0x9b15[_0x5e9ff7];return _0x49f6a2;};'use strict';function Campaign(_0x23303e){this['id']=_0x23303e['id']||0x0;this[_0x59b1('0x0')]=_0x23303e[_0x59b1('0x0')]||'';this[_0x59b1('0x1')]=_0x23303e[_0x59b1('0x1')]||_0x59b1('0x2');this[_0x59b1('0x3')]=0x0;this[_0x59b1('0x4')]=0x0;this[_0x59b1('0x5')]=0x0;this[_0x59b1('0x6')]=0x0;this[_0x59b1('0x7')]='';this[_0x59b1('0x8')]=!![];this[_0x59b1('0x9')]=_0x23303e[_0x59b1('0x9')];this['limitCalls']=_0x23303e[_0x59b1('0xa')];this['dialTimezone']=_0x23303e[_0x59b1('0xb')]||null;this[_0x59b1('0xc')]=_0x23303e[_0x59b1('0xc')]?_0x23303e['dialGlobalInterval']:null;this[_0x59b1('0xd')]=_0x23303e[_0x59b1('0xd')];this[_0x59b1('0xe')]=_0x23303e[_0x59b1('0xe')];this[_0x59b1('0xf')]=_0x23303e[_0x59b1('0xf')]||0x1e;this[_0x59b1('0x10')]=_0x23303e[_0x59b1('0x10')];this[_0x59b1('0x11')]=_0x23303e[_0x59b1('0x11')];this[_0x59b1('0x12')]=_0x23303e[_0x59b1('0x12')];this['dialBusyRetryFrequency']=_0x23303e[_0x59b1('0x13')];this[_0x59b1('0x14')]=_0x23303e['dialNoAnswerMaxRetry'];this[_0x59b1('0x15')]=_0x23303e[_0x59b1('0x15')];this[_0x59b1('0x16')]=_0x23303e[_0x59b1('0x16')];this[_0x59b1('0x17')]=_0x23303e[_0x59b1('0x17')]||0x3;this[_0x59b1('0x18')]=_0x23303e[_0x59b1('0x18')]||0x96;this[_0x59b1('0x19')]=_0x23303e[_0x59b1('0x19')]||0x3;this[_0x59b1('0x1a')]=_0x23303e[_0x59b1('0x1a')]||0x96;this['dialAbandonedMaxRetry']=_0x23303e['dialAbandonedMaxRetry']||0x3;this[_0x59b1('0x1b')]=_0x23303e['dialAbandonedRetryFrequency']||0x96;this[_0x59b1('0x1c')]=_0x23303e['dialMachineMaxRetry']||0x3;this[_0x59b1('0x1d')]=_0x23303e[_0x59b1('0x1d')]||0x96;this[_0x59b1('0x1e')]=_0x23303e['dialAgentRejectMaxRetry']||0x3;this[_0x59b1('0x1f')]=_0x23303e[_0x59b1('0x1f')]||0x96;this[_0x59b1('0x20')]=_0x23303e[_0x59b1('0x20')]||_0x59b1('0x21');this['dialPrefix']=_0x23303e[_0x59b1('0x22')]||undefined;this[_0x59b1('0x23')]=_0x23303e[_0x59b1('0x23')]||undefined;this['dialCutDigit']=_0x23303e[_0x59b1('0x24')]||undefined;this[_0x59b1('0x25')]=_0x23303e[_0x59b1('0x25')]?_0x23303e[_0x59b1('0x25')]:undefined;this[_0x59b1('0x26')]=_0x23303e[_0x59b1('0x26')]?_0x23303e[_0x59b1('0x26')]:undefined;this['Interval']=_0x23303e[_0x59b1('0x27')]?_0x23303e[_0x59b1('0x27')]:undefined;this[_0x59b1('0x28')]=_0x23303e[_0x59b1('0x28')]?_0x23303e[_0x59b1('0x28')]:undefined;this[_0x59b1('0x29')]=_0x23303e[_0x59b1('0x28')]?_0x23303e[_0x59b1('0x28')]['name']:undefined;this[_0x59b1('0x2a')]=_0x23303e[_0x59b1('0x2a')]||![];this[_0x59b1('0x2b')]=_0x23303e[_0x59b1('0x2b')];this[_0x59b1('0x2c')]=_0x23303e[_0x59b1('0x2c')];this[_0x59b1('0x2d')]=_0x23303e[_0x59b1('0x2d')];this[_0x59b1('0x2e')]=_0x23303e['dialAMDTotalAnalysisTime'];this[_0x59b1('0x2f')]=_0x23303e[_0x59b1('0x2f')];this[_0x59b1('0x30')]=_0x23303e[_0x59b1('0x30')];this[_0x59b1('0x31')]=_0x23303e[_0x59b1('0x31')];this[_0x59b1('0x32')]=_0x23303e['dialAMDSilenceThreshold'];this[_0x59b1('0x33')]=_0x23303e[_0x59b1('0x33')];}module[_0x59b1('0x34')]=Campaign; \ No newline at end of file diff --git a/server/services/ami/model/channel.js b/server/services/ami/model/channel.js index 2b5f7bd..855f77b 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 _0x7d37=['answertime','unmanaged','abandoned','duration','billableseconds','type','disposition','monitorFilename','monitors','transfercalleridnum','transferconnectedlinenum','mohtime','exports','starttime','channel','destinationchannel','calleridname','connectedlinenum','connectedlinename','context','uniqueid','exten'];(function(_0x3a10e3,_0x3cdb35){var _0xf067c8=function(_0x184beb){while(--_0x184beb){_0x3a10e3['push'](_0x3a10e3['shift']());}};_0xf067c8(++_0x3cdb35);}(_0x7d37,0x1db));var _0x77d3=function(_0x1d8e12,_0x35b2fd){_0x1d8e12=_0x1d8e12-0x0;var _0x220407=_0x7d37[_0x1d8e12];return _0x220407;};'use strict';function Channel(){this[_0x77d3('0x0')]=null;this[_0x77d3('0x1')]='';this[_0x77d3('0x2')]='';this['calleridnum']=0x0;this[_0x77d3('0x3')]='';this[_0x77d3('0x4')]=undefined;this[_0x77d3('0x5')]=undefined;this['accountcode']=0x0;this[_0x77d3('0x6')]='';this[_0x77d3('0x7')]=0x0;this['linkedid']=0x0;this[_0x77d3('0x8')]=0x0;this['answered']=![];this[_0x77d3('0x9')]=null;this['endtime']=null;this[_0x77d3('0xa')]=![];this[_0x77d3('0xb')]=![];this['lastapplication']='';this['lastdata']='';this[_0x77d3('0xc')]=0x0;this[_0x77d3('0xd')]=0x0;this['holdtime']=0x0;this[_0x77d3('0xe')]=null;this['tag']=null;this[_0x77d3('0xf')]=null;this['monitor']=![];this[_0x77d3('0x10')]=null;this['queue']=null;this[_0x77d3('0x11')]=[];this[_0x77d3('0x12')]=undefined;this[_0x77d3('0x13')]=undefined;this[_0x77d3('0x14')]=0x0;}module[_0x77d3('0x15')]=Channel; \ No newline at end of file +var _0x1c45=['lastdata','holdtime','type','tag','disposition','monitor','monitorFilename','monitors','transfercalleridnum','transferconnectedlinenum','mohtime','exports','starttime','channel','destinationchannel','calleridnum','calleridname','connectedlinenum','connectedlinename','accountcode','linkedid','exten','answered','answertime','endtime','unmanaged','abandoned','lastapplication'];(function(_0x47b6fc,_0x125766){var _0x2e424b=function(_0x2db4d0){while(--_0x2db4d0){_0x47b6fc['push'](_0x47b6fc['shift']());}};_0x2e424b(++_0x125766);}(_0x1c45,0x1b0));var _0x51c4=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x1c45[_0xa464c9];return _0x3d73c4;};'use strict';function Channel(){this[_0x51c4('0x0')]=null;this[_0x51c4('0x1')]='';this[_0x51c4('0x2')]='';this[_0x51c4('0x3')]=0x0;this[_0x51c4('0x4')]='';this[_0x51c4('0x5')]=undefined;this[_0x51c4('0x6')]=undefined;this[_0x51c4('0x7')]=0x0;this['context']='';this['uniqueid']=0x0;this[_0x51c4('0x8')]=0x0;this[_0x51c4('0x9')]=0x0;this[_0x51c4('0xa')]=![];this[_0x51c4('0xb')]=null;this[_0x51c4('0xc')]=null;this[_0x51c4('0xd')]=![];this[_0x51c4('0xe')]=![];this[_0x51c4('0xf')]='';this[_0x51c4('0x10')]='';this['duration']=0x0;this['billableseconds']=0x0;this[_0x51c4('0x11')]=0x0;this[_0x51c4('0x12')]=null;this[_0x51c4('0x13')]=null;this[_0x51c4('0x14')]=null;this[_0x51c4('0x15')]=![];this[_0x51c4('0x16')]=null;this['queue']=null;this[_0x51c4('0x17')]=[];this[_0x51c4('0x18')]=undefined;this[_0x51c4('0x19')]=undefined;this[_0x51c4('0x1a')]=0x0;}module[_0x51c4('0x1b')]=Channel; \ No newline at end of file diff --git a/server/services/ami/model/deskAccount.js b/server/services/ami/model/deskAccount.js index e23ff84..9ad882d 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 _0x0d4e=['serverUrl','Configurations','exports','name','username','remoteUri','authType','password','consumerKey','consumerSecret','token','tokenSecret','type'];(function(_0x15abaf,_0x25193c){var _0x2de8fd=function(_0x1f7a56){while(--_0x1f7a56){_0x15abaf['push'](_0x15abaf['shift']());}};_0x2de8fd(++_0x25193c);}(_0x0d4e,0x1ca));var _0xe0d4=function(_0x4e676e,_0x2a7c6d){_0x4e676e=_0x4e676e-0x0;var _0x336a3c=_0x0d4e[_0x4e676e];return _0x336a3c;};'use strict';function DeskAccount(_0x176261){this['id']=_0x176261['id']||0x0;this[_0xe0d4('0x0')]=_0x176261[_0xe0d4('0x0')]||'';this[_0xe0d4('0x1')]=_0x176261[_0xe0d4('0x1')]||'';this[_0xe0d4('0x2')]=_0x176261[_0xe0d4('0x2')]||'';this[_0xe0d4('0x3')]=_0x176261[_0xe0d4('0x3')]||'';this['password']=_0x176261[_0xe0d4('0x4')]||'';this[_0xe0d4('0x5')]=_0x176261[_0xe0d4('0x5')]||'';this[_0xe0d4('0x6')]=_0x176261['consumerSecret']||'';this['token']=_0x176261[_0xe0d4('0x7')]||'';this[_0xe0d4('0x8')]=_0x176261[_0xe0d4('0x8')]||'';this[_0xe0d4('0x9')]=_0x176261[_0xe0d4('0x9')]||'';this[_0xe0d4('0xa')]=_0x176261[_0xe0d4('0xa')]||'';this[_0xe0d4('0xb')]=_0x176261[_0xe0d4('0xb')]||{};}module[_0xe0d4('0xc')]=DeskAccount; \ No newline at end of file +var _0xea03=['remoteUri','password','consumerKey','consumerSecret','token','tokenSecret','type','serverUrl','Configurations','exports','name','username'];(function(_0x211632,_0x378e2e){var _0x5a1da1=function(_0x44aff2){while(--_0x44aff2){_0x211632['push'](_0x211632['shift']());}};_0x5a1da1(++_0x378e2e);}(_0xea03,0x1ba));var _0x3ea0=function(_0x31e29a,_0x349c9b){_0x31e29a=_0x31e29a-0x0;var _0x32d892=_0xea03[_0x31e29a];return _0x32d892;};'use strict';function DeskAccount(_0x3fb489){this['id']=_0x3fb489['id']||0x0;this['name']=_0x3fb489[_0x3ea0('0x0')]||'';this[_0x3ea0('0x1')]=_0x3fb489[_0x3ea0('0x1')]||'';this[_0x3ea0('0x2')]=_0x3fb489[_0x3ea0('0x2')]||'';this['authType']=_0x3fb489['authType']||'';this['password']=_0x3fb489[_0x3ea0('0x3')]||'';this[_0x3ea0('0x4')]=_0x3fb489[_0x3ea0('0x4')]||'';this[_0x3ea0('0x5')]=_0x3fb489[_0x3ea0('0x5')]||'';this['token']=_0x3fb489[_0x3ea0('0x6')]||'';this[_0x3ea0('0x7')]=_0x3fb489[_0x3ea0('0x7')]||'';this[_0x3ea0('0x8')]=_0x3fb489[_0x3ea0('0x8')]||'';this[_0x3ea0('0x9')]=_0x3fb489[_0x3ea0('0x9')]||'';this['Configurations']=_0x3fb489[_0x3ea0('0xa')]||{};}module[_0x3ea0('0xb')]=DeskAccount; \ No newline at end of file diff --git a/server/services/ami/model/dynamics365Account.js b/server/services/ami/model/dynamics365Account.js index 37d5ac2..1790b92 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 _0x67ad=['tenantId','clientId','clientSecret','serverUrl','Configurations','exports','name','username','password','remoteUri'];(function(_0x53e518,_0x42c044){var _0xca67bc=function(_0xa05cf0){while(--_0xa05cf0){_0x53e518['push'](_0x53e518['shift']());}};_0xca67bc(++_0x42c044);}(_0x67ad,0x1f0));var _0xd67a=function(_0xc4e8bb,_0x197ca8){_0xc4e8bb=_0xc4e8bb-0x0;var _0x4069fb=_0x67ad[_0xc4e8bb];return _0x4069fb;};'use strict';function Dynamics365Account(_0x27d9ea){this['id']=_0x27d9ea['id']||0x0;this[_0xd67a('0x0')]=_0x27d9ea['name']||'';this[_0xd67a('0x1')]=_0x27d9ea[_0xd67a('0x1')]||'';this['password']=_0x27d9ea[_0xd67a('0x2')]||'';this['remoteUri']=_0x27d9ea[_0xd67a('0x3')]||'';this[_0xd67a('0x4')]=_0x27d9ea[_0xd67a('0x4')]||'';this[_0xd67a('0x5')]=_0x27d9ea[_0xd67a('0x5')]||'';this['clientSecret']=_0x27d9ea[_0xd67a('0x6')]||{};this[_0xd67a('0x7')]=_0x27d9ea['serverUrl']||'';this[_0xd67a('0x8')]=_0x27d9ea[_0xd67a('0x8')]||{};}module[_0xd67a('0x9')]=Dynamics365Account; \ No newline at end of file +var _0xc196=['clientId','clientSecret','serverUrl','Configurations','name','password','remoteUri','tenantId'];(function(_0x2467bf,_0x16eb13){var _0x5a8e82=function(_0xb16ad1){while(--_0xb16ad1){_0x2467bf['push'](_0x2467bf['shift']());}};_0x5a8e82(++_0x16eb13);}(_0xc196,0x9c));var _0x6c19=function(_0xd75577,_0x4f6e3d){_0xd75577=_0xd75577-0x0;var _0xb081cc=_0xc196[_0xd75577];return _0xb081cc;};'use strict';function Dynamics365Account(_0x31be2f){this['id']=_0x31be2f['id']||0x0;this[_0x6c19('0x0')]=_0x31be2f[_0x6c19('0x0')]||'';this['username']=_0x31be2f['username']||'';this[_0x6c19('0x1')]=_0x31be2f[_0x6c19('0x1')]||'';this[_0x6c19('0x2')]=_0x31be2f['remoteUri']||'';this[_0x6c19('0x3')]=_0x31be2f[_0x6c19('0x3')]||'';this[_0x6c19('0x4')]=_0x31be2f[_0x6c19('0x4')]||'';this[_0x6c19('0x5')]=_0x31be2f['clientSecret']||{};this[_0x6c19('0x6')]=_0x31be2f[_0x6c19('0x6')]||'';this[_0x6c19('0x7')]=_0x31be2f[_0x6c19('0x7')]||{};}module['exports']=Dynamics365Account; \ No newline at end of file diff --git a/server/services/ami/model/faxAccount.js b/server/services/ami/model/faxAccount.js index 55991e5..2d1f3b2 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 _0x01db=['modem','v17,v27,v29','faxdetect','t38timeout','tech','Trunk','ListId','key','exports','description','ecm','headerinfo','localstationid','minrate','maxrate'];(function(_0x3b0c5a,_0x4c00f0){var _0x726852=function(_0x2d610e){while(--_0x2d610e){_0x3b0c5a['push'](_0x3b0c5a['shift']());}};_0x726852(++_0x4c00f0);}(_0x01db,0x171));var _0xb01d=function(_0x1dc463,_0x11db3d){_0x1dc463=_0x1dc463-0x0;var _0x5af4fb=_0x01db[_0x1dc463];return _0x5af4fb;};'use strict';function FaxAccount(_0x123688){this['id']=_0x123688['id']||0x0;this['name']=_0x123688['name']||'';this[_0xb01d('0x0')]=_0x123688[_0xb01d('0x0')];this[_0xb01d('0x1')]=_0x123688['ecm'];this[_0xb01d('0x2')]=_0x123688['headerinfo'];this['localstationid']=_0x123688[_0xb01d('0x3')];this[_0xb01d('0x4')]=_0x123688[_0xb01d('0x4')]||0x960;this[_0xb01d('0x5')]=_0x123688[_0xb01d('0x5')]||0x3840;this[_0xb01d('0x6')]=_0x123688[_0xb01d('0x6')]||_0xb01d('0x7');this['gateway']=_0x123688['gateway']||'no';this[_0xb01d('0x8')]=_0x123688[_0xb01d('0x8')]||'no';this[_0xb01d('0x9')]=_0x123688[_0xb01d('0x9')]||0x1388;this[_0xb01d('0xa')]=_0x123688[_0xb01d('0xa')]||'SIP';this['Trunk']=_0x123688[_0xb01d('0xb')]?_0x123688[_0xb01d('0xb')]:undefined;this[_0xb01d('0xc')]=_0x123688[_0xb01d('0xc')];this[_0xb01d('0xd')]=_0x123688[_0xb01d('0xd')];}module[_0xb01d('0xe')]=FaxAccount; \ No newline at end of file +var _0xc558=['key','exports','description','ecm','headerinfo','localstationid','minrate','maxrate','modem','v17,v27,v29','gateway','faxdetect','t38timeout','tech','SIP','Trunk','ListId'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0xc558,0x79));var _0x8c55=function(_0x3f988a,_0x1ce0be){_0x3f988a=_0x3f988a-0x0;var _0x37c39b=_0xc558[_0x3f988a];return _0x37c39b;};'use strict';function FaxAccount(_0x1e2796){this['id']=_0x1e2796['id']||0x0;this['name']=_0x1e2796['name']||'';this[_0x8c55('0x0')]=_0x1e2796['description'];this[_0x8c55('0x1')]=_0x1e2796['ecm'];this[_0x8c55('0x2')]=_0x1e2796[_0x8c55('0x2')];this['localstationid']=_0x1e2796[_0x8c55('0x3')];this[_0x8c55('0x4')]=_0x1e2796['minrate']||0x960;this['maxrate']=_0x1e2796[_0x8c55('0x5')]||0x3840;this[_0x8c55('0x6')]=_0x1e2796[_0x8c55('0x6')]||_0x8c55('0x7');this[_0x8c55('0x8')]=_0x1e2796[_0x8c55('0x8')]||'no';this[_0x8c55('0x9')]=_0x1e2796[_0x8c55('0x9')]||'no';this['t38timeout']=_0x1e2796[_0x8c55('0xa')]||0x1388;this[_0x8c55('0xb')]=_0x1e2796['tech']||_0x8c55('0xc');this[_0x8c55('0xd')]=_0x1e2796[_0x8c55('0xd')]?_0x1e2796[_0x8c55('0xd')]:undefined;this['ListId']=_0x1e2796[_0x8c55('0xe')];this[_0x8c55('0xf')]=_0x1e2796[_0x8c55('0xf')];}module[_0x8c55('0x10')]=FaxAccount; \ No newline at end of file diff --git a/server/services/ami/model/freshdeskAccount.js b/server/services/ami/model/freshdeskAccount.js index b2ef666..f9e7bb1 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 _0x4016=['Configurations','exports','name','username','token','remoteUri'];(function(_0xd6f5a1,_0x2666e3){var _0xb0814=function(_0x46c73){while(--_0x46c73){_0xd6f5a1['push'](_0xd6f5a1['shift']());}};_0xb0814(++_0x2666e3);}(_0x4016,0x140));var _0x6401=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x4016[_0xa464c9];return _0x3d73c4;};'use strict';function FreshdeskAccount(_0x2a0ef6){this['id']=_0x2a0ef6['id']||0x0;this[_0x6401('0x0')]=_0x2a0ef6['name']||'';this[_0x6401('0x1')]=_0x2a0ef6['username']||'';this['apiKey']=_0x2a0ef6[_0x6401('0x2')]||'';this[_0x6401('0x3')]=_0x2a0ef6[_0x6401('0x3')]||'';this['serverUrl']=_0x2a0ef6['serverUrl']||'';this[_0x6401('0x4')]=_0x2a0ef6[_0x6401('0x4')]||{};}module[_0x6401('0x5')]=FreshdeskAccount; \ No newline at end of file +var _0x1744=['Configurations','exports','username','apiKey','token','remoteUri','serverUrl'];(function(_0x4e9f1a,_0x35e3f3){var _0x441f20=function(_0x25f063){while(--_0x25f063){_0x4e9f1a['push'](_0x4e9f1a['shift']());}};_0x441f20(++_0x35e3f3);}(_0x1744,0xf7));var _0x4174=function(_0x2fb453,_0x19dc6f){_0x2fb453=_0x2fb453-0x0;var _0x3e47be=_0x1744[_0x2fb453];return _0x3e47be;};'use strict';function FreshdeskAccount(_0x5ab4d8){this['id']=_0x5ab4d8['id']||0x0;this['name']=_0x5ab4d8['name']||'';this[_0x4174('0x0')]=_0x5ab4d8['username']||'';this[_0x4174('0x1')]=_0x5ab4d8[_0x4174('0x2')]||'';this['remoteUri']=_0x5ab4d8[_0x4174('0x3')]||'';this[_0x4174('0x4')]=_0x5ab4d8[_0x4174('0x4')]||'';this[_0x4174('0x5')]=_0x5ab4d8[_0x4174('0x5')]||{};}module[_0x4174('0x6')]=FreshdeskAccount; \ No newline at end of file diff --git a/server/services/ami/model/freshsalesAccount.js b/server/services/ami/model/freshsalesAccount.js index 10e6a64..e768fcb 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 _0xc9e6=['username','apiKey','token','serverUrl','Configurations','exports','name'];(function(_0x4c06a3,_0x1e6b6f){var _0x7ff53c=function(_0x559eff){while(--_0x559eff){_0x4c06a3['push'](_0x4c06a3['shift']());}};_0x7ff53c(++_0x1e6b6f);}(_0xc9e6,0x172));var _0x6c9e=function(_0x4630c9,_0xd229d3){_0x4630c9=_0x4630c9-0x0;var _0x10b8bd=_0xc9e6[_0x4630c9];return _0x10b8bd;};'use strict';function FreshsalesAccount(_0x33f0a2){this['id']=_0x33f0a2['id']||0x0;this[_0x6c9e('0x0')]=_0x33f0a2['name']||'';this[_0x6c9e('0x1')]=_0x33f0a2[_0x6c9e('0x1')]||'';this[_0x6c9e('0x2')]=_0x33f0a2[_0x6c9e('0x3')]||'';this['remoteUri']=_0x33f0a2['remoteUri']||'';this[_0x6c9e('0x4')]=_0x33f0a2[_0x6c9e('0x4')]||'';this[_0x6c9e('0x5')]=_0x33f0a2['Configurations']||{};}module[_0x6c9e('0x6')]=FreshsalesAccount; \ No newline at end of file +var _0xf6a4=['name','username','token','serverUrl','Configurations','exports'];(function(_0xf63d4e,_0xbc63d6){var _0x4aa0d3=function(_0xcd69cf){while(--_0xcd69cf){_0xf63d4e['push'](_0xf63d4e['shift']());}};_0x4aa0d3(++_0xbc63d6);}(_0xf6a4,0xb4));var _0x4f6a=function(_0xa4262b,_0x19294f){_0xa4262b=_0xa4262b-0x0;var _0x37480e=_0xf6a4[_0xa4262b];return _0x37480e;};'use strict';function FreshsalesAccount(_0x251175){this['id']=_0x251175['id']||0x0;this[_0x4f6a('0x0')]=_0x251175[_0x4f6a('0x0')]||'';this[_0x4f6a('0x1')]=_0x251175[_0x4f6a('0x1')]||'';this['apiKey']=_0x251175[_0x4f6a('0x2')]||'';this['remoteUri']=_0x251175['remoteUri']||'';this[_0x4f6a('0x3')]=_0x251175[_0x4f6a('0x3')]||'';this[_0x4f6a('0x4')]=_0x251175[_0x4f6a('0x4')]||{};}module[_0x4f6a('0x5')]=FreshsalesAccount; \ No newline at end of file diff --git a/server/services/ami/model/queueReport.js b/server/services/ami/model/queueReport.js index 2b3e950..1292690 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 _0x89b9=['queuecallerexitAt','originalposition','channel','connectedlinenum','connectedlinename','accountcode','context','exten','holdtime','lastAssignedTo','mohtime','inbound','uniqueid','calleridnum','queuecallerleaveAt','count','queuecallerabandon','queuecallerabandonAt','queuecallercomplete','queuecallercompleteAt','queuecallerexit'];(function(_0x53ccf2,_0x13cb67){var _0x5a2964=function(_0x3b0514){while(--_0x3b0514){_0x53ccf2['push'](_0x53ccf2['shift']());}};_0x5a2964(++_0x13cb67);}(_0x89b9,0x9e));var _0x989b=function(_0x1b68ca,_0x324020){_0x1b68ca=_0x1b68ca-0x0;var _0x1a14d4=_0x89b9[_0x1b68ca];return _0x1a14d4;};'use strict';function QueueReport(){this['type']=_0x989b('0x0');this[_0x989b('0x1')]='';this[_0x989b('0x2')]='';this['calleridname']='';this['queue']='';this['queuecallerjoinAt']=null;this[_0x989b('0x3')]=null;this['position']=0x1;this[_0x989b('0x4')]=0x1;this[_0x989b('0x5')]=![];this[_0x989b('0x6')]=null;this[_0x989b('0x7')]=![];this[_0x989b('0x8')]=null;this[_0x989b('0x9')]=![];this[_0x989b('0xa')]=null;this[_0x989b('0xb')]=0x1;this[_0x989b('0xc')]='';this[_0x989b('0xd')]='';this[_0x989b('0xe')]='';this[_0x989b('0xf')]='';this[_0x989b('0x10')]='';this[_0x989b('0x11')]='';this['priority']='';this[_0x989b('0x12')]=0x0;this['assigned']=![];this[_0x989b('0x13')]='';this[_0x989b('0x14')]=0x0;this['variables']={};}module['exports']=QueueReport; \ No newline at end of file +var _0x1b55=['queuecallercomplete','queuecallercompleteAt','queuecallerexitAt','originalposition','connectedlinenum','connectedlinename','accountcode','context','exten','priority','holdtime','assigned','lastAssignedTo','mohtime','variables','exports','type','inbound','uniqueid','calleridnum','queue','queuecallerjoinAt','queuecallerleaveAt','position','queuecallerabandon','queuecallerabandonAt'];(function(_0x341c67,_0x471a5f){var _0x1966db=function(_0x10e062){while(--_0x10e062){_0x341c67['push'](_0x341c67['shift']());}};_0x1966db(++_0x471a5f);}(_0x1b55,0x1ca));var _0x51b5=function(_0x133442,_0x5c14f1){_0x133442=_0x133442-0x0;var _0x49d417=_0x1b55[_0x133442];return _0x49d417;};'use strict';function QueueReport(){this[_0x51b5('0x0')]=_0x51b5('0x1');this[_0x51b5('0x2')]='';this[_0x51b5('0x3')]='';this['calleridname']='';this[_0x51b5('0x4')]='';this[_0x51b5('0x5')]=null;this[_0x51b5('0x6')]=null;this[_0x51b5('0x7')]=0x1;this['count']=0x1;this[_0x51b5('0x8')]=![];this[_0x51b5('0x9')]=null;this[_0x51b5('0xa')]=![];this[_0x51b5('0xb')]=null;this['queuecallerexit']=![];this[_0x51b5('0xc')]=null;this[_0x51b5('0xd')]=0x1;this['channel']='';this[_0x51b5('0xe')]='';this[_0x51b5('0xf')]='';this[_0x51b5('0x10')]='';this[_0x51b5('0x11')]='';this[_0x51b5('0x12')]='';this[_0x51b5('0x13')]='';this[_0x51b5('0x14')]=0x0;this[_0x51b5('0x15')]=![];this[_0x51b5('0x16')]='';this[_0x51b5('0x17')]=0x0;this[_0x51b5('0x18')]={};}module[_0x51b5('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 b59be54..ee854e6 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 _0x36e9=['remoteUri','password','clientId','clientSecret','securityToken','type','integrationTab','Configurations','exports','name','username'];(function(_0x460f42,_0x52a23a){var _0x2f8ab9=function(_0x15d6cf){while(--_0x15d6cf){_0x460f42['push'](_0x460f42['shift']());}};_0x2f8ab9(++_0x52a23a);}(_0x36e9,0x106));var _0x936e=function(_0x164eca,_0x555e28){_0x164eca=_0x164eca-0x0;var _0x2ce562=_0x36e9[_0x164eca];return _0x2ce562;};'use strict';function SalesforceAccount(_0x3f4b39){this['id']=_0x3f4b39['id']||0x0;this[_0x936e('0x0')]=_0x3f4b39[_0x936e('0x0')]||'';this['username']=_0x3f4b39[_0x936e('0x1')]||'';this[_0x936e('0x2')]=_0x3f4b39[_0x936e('0x2')]||'';this[_0x936e('0x3')]=_0x3f4b39[_0x936e('0x3')]||'';this[_0x936e('0x4')]=_0x3f4b39[_0x936e('0x4')]||'';this[_0x936e('0x5')]=_0x3f4b39[_0x936e('0x5')]||'';this[_0x936e('0x6')]=_0x3f4b39['securityToken']||'';this[_0x936e('0x7')]=_0x3f4b39[_0x936e('0x7')]||_0x936e('0x8');this['serverUrl']=_0x3f4b39['serverUrl']||'';this['Configurations']=_0x3f4b39[_0x936e('0x9')]||{};}module[_0x936e('0xa')]=SalesforceAccount; \ No newline at end of file +var _0xeb01=['securityToken','type','integrationTab','serverUrl','Configurations','name','username','remoteUri','password','clientId','clientSecret'];(function(_0x2ff41f,_0x154b66){var _0x137429=function(_0x366b95){while(--_0x366b95){_0x2ff41f['push'](_0x2ff41f['shift']());}};_0x137429(++_0x154b66);}(_0xeb01,0x17b));var _0x1eb0=function(_0x36fdfb,_0x46ecf7){_0x36fdfb=_0x36fdfb-0x0;var _0x4c9e03=_0xeb01[_0x36fdfb];return _0x4c9e03;};'use strict';function SalesforceAccount(_0x141a13){this['id']=_0x141a13['id']||0x0;this[_0x1eb0('0x0')]=_0x141a13[_0x1eb0('0x0')]||'';this[_0x1eb0('0x1')]=_0x141a13[_0x1eb0('0x1')]||'';this['remoteUri']=_0x141a13[_0x1eb0('0x2')]||'';this['password']=_0x141a13[_0x1eb0('0x3')]||'';this['clientId']=_0x141a13[_0x1eb0('0x4')]||'';this[_0x1eb0('0x5')]=_0x141a13[_0x1eb0('0x5')]||'';this[_0x1eb0('0x6')]=_0x141a13[_0x1eb0('0x6')]||'';this[_0x1eb0('0x7')]=_0x141a13[_0x1eb0('0x7')]||_0x1eb0('0x8');this[_0x1eb0('0x9')]=_0x141a13['serverUrl']||'';this[_0x1eb0('0xa')]=_0x141a13[_0x1eb0('0xa')]||{};}module['exports']=SalesforceAccount; \ No newline at end of file diff --git a/server/services/ami/model/servicenowAccount.js b/server/services/ami/model/servicenowAccount.js index aedde76..31fdf7a 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 _0x25d9=['exports','username','password','remoteUri','Configurations'];(function(_0x246b0b,_0xa02c6e){var _0x57f051=function(_0x431516){while(--_0x431516){_0x246b0b['push'](_0x246b0b['shift']());}};_0x57f051(++_0xa02c6e);}(_0x25d9,0xe7));var _0x925d=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0x25d9[_0x19950b];return _0x3c6b41;};'use strict';function ServicenowAccount(_0x1de1c0){this['id']=_0x1de1c0['id']||0x0;this['name']=_0x1de1c0['name']||'';this[_0x925d('0x0')]=_0x1de1c0[_0x925d('0x0')]||'';this[_0x925d('0x1')]=_0x1de1c0[_0x925d('0x1')]||'';this[_0x925d('0x2')]=_0x1de1c0['remoteUri']||'';this['serverUrl']=_0x1de1c0['serverUrl']||'';this[_0x925d('0x3')]=_0x1de1c0[_0x925d('0x3')]||{};}module[_0x925d('0x4')]=ServicenowAccount; \ No newline at end of file +var _0x1db1=['name','username','password','remoteUri','serverUrl','Configurations'];(function(_0x1da72c,_0x15d2e9){var _0x58d9e7=function(_0x1487e3){while(--_0x1487e3){_0x1da72c['push'](_0x1da72c['shift']());}};_0x58d9e7(++_0x15d2e9);}(_0x1db1,0x168));var _0x11db=function(_0x360fa9,_0x40e248){_0x360fa9=_0x360fa9-0x0;var _0x1bf5e6=_0x1db1[_0x360fa9];return _0x1bf5e6;};'use strict';function ServicenowAccount(_0x4a95c0){this['id']=_0x4a95c0['id']||0x0;this[_0x11db('0x0')]=_0x4a95c0[_0x11db('0x0')]||'';this[_0x11db('0x1')]=_0x4a95c0[_0x11db('0x1')]||'';this['password']=_0x4a95c0[_0x11db('0x2')]||'';this[_0x11db('0x3')]=_0x4a95c0[_0x11db('0x3')]||'';this[_0x11db('0x4')]=_0x4a95c0[_0x11db('0x4')]||'';this['Configurations']=_0x4a95c0[_0x11db('0x5')]||{};}module['exports']=ServicenowAccount; \ No newline at end of file diff --git a/server/services/ami/model/sugarcrmAccount.js b/server/services/ami/model/sugarcrmAccount.js index 56d989a..321298c 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 _0x7fc9=['name','username','remoteUri','serverUrl','Configurations','exports'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0x7fc9,0xae));var _0x97fc=function(_0x3256c6,_0x3166f8){_0x3256c6=_0x3256c6-0x0;var _0x19ae14=_0x7fc9[_0x3256c6];return _0x19ae14;};'use strict';function SugarcrmAccount(_0x518053){this['id']=_0x518053['id']||0x0;this[_0x97fc('0x0')]=_0x518053[_0x97fc('0x0')]||'';this[_0x97fc('0x1')]=_0x518053[_0x97fc('0x1')]||'';this['password']=_0x518053['password']||'';this[_0x97fc('0x2')]=_0x518053[_0x97fc('0x2')]||'';this[_0x97fc('0x3')]=_0x518053[_0x97fc('0x3')]||'';this[_0x97fc('0x4')]=_0x518053[_0x97fc('0x4')]||{};}module[_0x97fc('0x5')]=SugarcrmAccount; \ No newline at end of file +var _0xcbfa=['Configurations','name','username','password','remoteUri','serverUrl'];(function(_0xc40c93,_0x204fea){var _0x2ce727=function(_0x20dafa){while(--_0x20dafa){_0xc40c93['push'](_0xc40c93['shift']());}};_0x2ce727(++_0x204fea);}(_0xcbfa,0x19f));var _0xacbf=function(_0x17788a,_0x150887){_0x17788a=_0x17788a-0x0;var _0x33f47c=_0xcbfa[_0x17788a];return _0x33f47c;};'use strict';function SugarcrmAccount(_0x1bc78f){this['id']=_0x1bc78f['id']||0x0;this[_0xacbf('0x0')]=_0x1bc78f[_0xacbf('0x0')]||'';this[_0xacbf('0x1')]=_0x1bc78f['username']||'';this[_0xacbf('0x2')]=_0x1bc78f[_0xacbf('0x2')]||'';this[_0xacbf('0x3')]=_0x1bc78f[_0xacbf('0x3')]||'';this[_0xacbf('0x4')]=_0x1bc78f[_0xacbf('0x4')]||'';this[_0xacbf('0x5')]=_0x1bc78f[_0xacbf('0x5')]||{};}module['exports']=SugarcrmAccount; \ No newline at end of file diff --git a/server/services/ami/model/telephone.js b/server/services/ami/model/telephone.js index 10b506a..c15aa3f 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 _0xb272=['unknown','stateTime','status','address','exports','name','accountcode','state'];(function(_0x33c98e,_0x4eb3d0){var _0x39a756=function(_0x3cfded){while(--_0x3cfded){_0x33c98e['push'](_0x33c98e['shift']());}};_0x39a756(++_0x4eb3d0);}(_0xb272,0xed));var _0x2b27=function(_0x19a0bc,_0x2f7125){_0x19a0bc=_0x19a0bc-0x0;var _0x4d6c30=_0xb272[_0x19a0bc];return _0x4d6c30;};'use strict';function Telephone(_0x8143ac){this['id']=_0x8143ac['id']||0x0;this[_0x2b27('0x0')]=_0x8143ac[_0x2b27('0x0')]||'';this[_0x2b27('0x1')]=_0x8143ac[_0x2b27('0x1')]||'';this[_0x2b27('0x2')]=_0x2b27('0x3');this[_0x2b27('0x4')]=0x0;this[_0x2b27('0x5')]=_0x2b27('0x3');this[_0x2b27('0x6')]='';}module[_0x2b27('0x7')]=Telephone; \ No newline at end of file +var _0x7e7b=['name','accountcode','state','stateTime','status','unknown','address','exports'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x7e7b,0x150));var _0xb7e7=function(_0xd01db9,_0x2cc3a5){_0xd01db9=_0xd01db9-0x0;var _0x288624=_0x7e7b[_0xd01db9];return _0x288624;};'use strict';function Telephone(_0x27bf5c){this['id']=_0x27bf5c['id']||0x0;this['name']=_0x27bf5c[_0xb7e7('0x0')]||'';this[_0xb7e7('0x1')]=_0x27bf5c['accountcode']||'';this[_0xb7e7('0x2')]='unknown';this[_0xb7e7('0x3')]=0x0;this[_0xb7e7('0x4')]=_0xb7e7('0x5');this[_0xb7e7('0x6')]='';}module[_0xb7e7('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 96fa39a..24424c4 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 _0x515f=['name','html','exports'];(function(_0xc8069a,_0x2968fc){var _0x16bc69=function(_0x4e8a44){while(--_0x4e8a44){_0xc8069a['push'](_0xc8069a['shift']());}};_0x16bc69(++_0x2968fc);}(_0x515f,0x165));var _0xf515=function(_0x4a0984,_0x4060df){_0x4a0984=_0x4a0984-0x0;var _0x4be527=_0x515f[_0x4a0984];return _0x4be527;};'use strict';function template(_0x2e4c38){this['id']=_0x2e4c38['id']||0x0;this[_0xf515('0x0')]=_0x2e4c38['name']||'';this[_0xf515('0x1')]=_0x2e4c38[_0xf515('0x1')]||'';}module[_0xf515('0x2')]=template; \ No newline at end of file +var _0xea44=['exports','name','html'];(function(_0x4f1ee6,_0x3a0ac1){var _0x331ef3=function(_0x2ca0dd){while(--_0x2ca0dd){_0x4f1ee6['push'](_0x4f1ee6['shift']());}};_0x331ef3(++_0x3a0ac1);}(_0xea44,0x1a5));var _0x4ea4=function(_0x2fbb93,_0x1ca17d){_0x2fbb93=_0x2fbb93-0x0;var _0x3433b0=_0xea44[_0x2fbb93];return _0x3433b0;};'use strict';function template(_0x3b4dcc){this['id']=_0x3b4dcc['id']||0x0;this[_0x4ea4('0x0')]=_0x3b4dcc[_0x4ea4('0x0')]||'';this[_0x4ea4('0x1')]=_0x3b4dcc['html']||'';}module[_0x4ea4('0x2')]=template; \ No newline at end of file diff --git a/server/services/ami/model/trigger.js b/server/services/ami/model/trigger.js index 74e2696..5d57f82 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 _0x8ef6=['status','AllConditions','AnyConditions','exports','name','channel','voice'];(function(_0x3d1bc4,_0x1de49f){var _0x5a93b5=function(_0x21a128){while(--_0x21a128){_0x3d1bc4['push'](_0x3d1bc4['shift']());}};_0x5a93b5(++_0x1de49f);}(_0x8ef6,0xf2));var _0x68ef=function(_0x48fa45,_0x421f38){_0x48fa45=_0x48fa45-0x0;var _0x314faa=_0x8ef6[_0x48fa45];return _0x314faa;};'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 +var _0x9957=['AnyConditions','Actions','exports','name','channel','voice','status','AllConditions'];(function(_0x243cca,_0x514c2d){var _0xf94771=function(_0x42d3de){while(--_0x42d3de){_0x243cca['push'](_0x243cca['shift']());}};_0xf94771(++_0x514c2d);}(_0x9957,0x93));var _0x7995=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x9957[_0x3947c9];return _0x2e7871;};'use strict';function Trigger(_0x202794){this['id']=_0x202794['id']||0x0;this[_0x7995('0x0')]=_0x202794[_0x7995('0x0')]||'';this[_0x7995('0x1')]=_0x202794['channel']||_0x7995('0x2');this[_0x7995('0x3')]=_0x202794[_0x7995('0x3')]||![];this[_0x7995('0x4')]=_0x202794['AllConditions']||[];this[_0x7995('0x5')]=_0x202794[_0x7995('0x5')]||[];this[_0x7995('0x6')]=_0x202794[_0x7995('0x6')]||[];}module[_0x7995('0x7')]=Trigger; \ No newline at end of file diff --git a/server/services/ami/model/trunk.js b/server/services/ami/model/trunk.js index 4a19c4a..87d638a 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 _0x8fc1=['exports','active','name','state','unknown','stateTime','status','registry','indexOf','split','host','port','domain','stateRegistry','registrationtime','address'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0x8fc1,0x141));var _0x18fc=function(_0x5d1ae9,_0x1279b1){_0x5d1ae9=_0x5d1ae9-0x0;var _0x40d737=_0x8fc1[_0x5d1ae9];return _0x40d737;};'use strict';function Trunk(_0x31b82d){this['id']=_0x31b82d['id']||0x0;this[_0x18fc('0x0')]=_0x31b82d[_0x18fc('0x0')]||![];this[_0x18fc('0x1')]=_0x31b82d[_0x18fc('0x1')]||'';this[_0x18fc('0x2')]=_0x18fc('0x3');this[_0x18fc('0x4')]=0x0;this[_0x18fc('0x5')]=_0x18fc('0x3');this[_0x18fc('0x6')]=_0x31b82d[_0x18fc('0x6')]&&_0x31b82d['registry'][_0x18fc('0x7')](':')?_0x31b82d[_0x18fc('0x6')][_0x18fc('0x8')](':')[0x0]:'';this[_0x18fc('0x9')]='';this[_0x18fc('0xa')]='';this[_0x18fc('0xb')]='';this['domainport']='';this['refresh']='';this[_0x18fc('0xc')]=_0x18fc('0x3');this[_0x18fc('0xd')]='';this[_0x18fc('0xe')]='';}module[_0x18fc('0xf')]=Trunk; \ No newline at end of file +var _0x0267=['stateTime','status','registry','split','port','domainport','refresh','stateRegistry','registrationtime','address','exports','active','name','state','unknown'];(function(_0x567391,_0x1da640){var _0x1a9eca=function(_0x11f3ea){while(--_0x11f3ea){_0x567391['push'](_0x567391['shift']());}};_0x1a9eca(++_0x1da640);}(_0x0267,0xb0));var _0x7026=function(_0x606c39,_0x2cc86d){_0x606c39=_0x606c39-0x0;var _0x1efcd8=_0x0267[_0x606c39];return _0x1efcd8;};'use strict';function Trunk(_0x1e1c23){this['id']=_0x1e1c23['id']||0x0;this[_0x7026('0x0')]=_0x1e1c23[_0x7026('0x0')]||![];this['name']=_0x1e1c23[_0x7026('0x1')]||'';this[_0x7026('0x2')]=_0x7026('0x3');this[_0x7026('0x4')]=0x0;this[_0x7026('0x5')]=_0x7026('0x3');this['registry']=_0x1e1c23['registry']&&_0x1e1c23[_0x7026('0x6')]['indexOf'](':')?_0x1e1c23[_0x7026('0x6')][_0x7026('0x7')](':')[0x0]:'';this['host']='';this[_0x7026('0x8')]='';this['domain']='';this[_0x7026('0x9')]='';this[_0x7026('0xa')]='';this[_0x7026('0xb')]=_0x7026('0x3');this[_0x7026('0xc')]='';this[_0x7026('0xd')]='';}module[_0x7026('0xe')]=Trunk; \ No newline at end of file diff --git a/server/services/ami/model/voiceExtension.js b/server/services/ami/model/voiceExtension.js index 21afd57..6cecc91 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 _0xcb14=['recordingFormat','none','mandatoryDisposition','exten'];(function(_0x54a892,_0x1a4eeb){var _0x1f24f1=function(_0x2044d5){while(--_0x2044d5){_0x54a892['push'](_0x54a892['shift']());}};_0x1f24f1(++_0x1a4eeb);}(_0xcb14,0x9f));var _0x4cb1=function(_0x75caa,_0x390e63){_0x75caa=_0x75caa-0x0;var _0x8c7804=_0xcb14[_0x75caa];return _0x8c7804;};'use strict';function voiceExtension(_0x462ab1){this['id']=_0x462ab1['id']||0x0;this[_0x4cb1('0x0')]=_0x462ab1[_0x4cb1('0x0')]||'';this[_0x4cb1('0x1')]=_0x462ab1[_0x4cb1('0x1')]||_0x4cb1('0x2');this[_0x4cb1('0x3')]=_0x462ab1[_0x4cb1('0x3')]||![];}module['exports']=voiceExtension; \ No newline at end of file +var _0x81ce=['exten','recordingFormat','exports'];(function(_0x44f728,_0x2ca620){var _0x41c2a3=function(_0x45d226){while(--_0x45d226){_0x44f728['push'](_0x44f728['shift']());}};_0x41c2a3(++_0x2ca620);}(_0x81ce,0xe7));var _0xe81c=function(_0x22bd74,_0x3b231b){_0x22bd74=_0x22bd74-0x0;var _0x4b9505=_0x81ce[_0x22bd74];return _0x4b9505;};'use strict';function voiceExtension(_0x27f4ce){this['id']=_0x27f4ce['id']||0x0;this['exten']=_0x27f4ce[_0xe81c('0x0')]||'';this['recordingFormat']=_0x27f4ce[_0xe81c('0x1')]||'none';this['mandatoryDisposition']=_0x27f4ce['mandatoryDisposition']||![];}module[_0xe81c('0x2')]=voiceExtension; \ No newline at end of file diff --git a/server/services/ami/model/voiceQueue.js b/server/services/ami/model/voiceQueue.js index 887b882..2c5e106 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 _0x488f=['dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialGlobalMaxRetry','Trunk','TrunkBackup','dialPrefix','Interval','dialOrderByScheduledAt','DESC','dialRandomLastDigitCallerIdNumber','dialCutDigit','strategy','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','pTalking','timeout','outboundAnswerCallsDay','outboundAnswerAgiCallsDay','outboundNoAnswerCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundNoSuchCallsDay','outboundUnknownCallsDay','outboundBlacklistCallsDay','outboundOriginateFailureCallsDay','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundDropCallsDayACS','outboundReCallsDay','outboundAbandonedDay','handlePredictive','predictiveIntervalMultiplicativeFactor','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalAvgTalktime','predictiveIntervalPauses','predictiveIntervalMaxThreshold','dialPredictiveIntervalMaxThreshold','predictiveIntervalMinThreshold','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','erlangCalls','erlangAbandonmentRate','erlangBusyFactor','dialRecallMeTimeout','dialRecallInQueue','dialQueueProject2','dialAgiAfterHangupClient','dialAgiAfterHangupAgent','mandatoryDisposition','mandatoryDispositionPause','exports','not_inuse','inuse','busy','invalid','ringinuse','onhold','wav','gsm','rrmemory','roundrobin','name','monitor_format','type','waiting','talking','total','sumDuration','sumHoldTime','sumBillable','abandoned','loggedIn','available','acw','acwTimeout','autopause','sendMessageOneNotActive','message','temp','dialTimezone','dialGlobalInterval','dialActive','dialMethod','progressive','dialLimitChannel','dialLimitQueue','dialPowerLevel','dialPredictiveOptimization','dropRate','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdName','anonymous','dialOriginateCallerIdNumber','dialOriginateTimeout','dialQueueOptions','dialQueueTimeout','dialQueueProject','dialCongestionMaxRetry','dialCongestionRetryFrequency'];(function(_0x3c8f59,_0x454ec3){var _0x168fe7=function(_0x24c9d2){while(--_0x24c9d2){_0x3c8f59['push'](_0x3c8f59['shift']());}};_0x168fe7(++_0x454ec3);}(_0x488f,0xbf));var _0xf488=function(_0xfc36d,_0x1a875e){_0xfc36d=_0xfc36d-0x0;var _0x5b711b=_0x488f[_0xfc36d];return _0x5b711b;};'use strict';var statusDesc=['unknown',_0xf488('0x0'),_0xf488('0x1'),_0xf488('0x2'),_0xf488('0x3'),'unavailable','ringing',_0xf488('0x4'),_0xf488('0x5')];var monitorFormat={'wav':_0xf488('0x6'),'wav49':'wav49','gsm':_0xf488('0x7')};var strategy={'rrmemory':_0xf488('0x8'),'roundrobin':_0xf488('0x9')};function VoiceQueue(_0x75eac){this['id']=_0x75eac['id']||0x0;this[_0xf488('0xa')]=_0x75eac[_0xf488('0xa')]||'';this['monitor_format']=_0x75eac[_0xf488('0xb')]||'';this[_0xf488('0xc')]=_0x75eac[_0xf488('0xc')]||'inbound';this[_0xf488('0xd')]=0x0;this[_0xf488('0xe')]=0x0;this[_0xf488('0xf')]=0x0;this['answered']=0x0;this[_0xf488('0x10')]=0x0;this[_0xf488('0x11')]=0x0;this[_0xf488('0x12')]=0x0;this['unmanaged']=0x0;this[_0xf488('0x13')]=0x0;this[_0xf488('0x14')]=0x0;this[_0xf488('0x15')]=0x0;this[_0xf488('0x16')]=_0x75eac['acw']||![];this[_0xf488('0x17')]=_0x75eac['acwTimeout']||0xa;this[_0xf488('0x18')]=_0x75eac[_0xf488('0x18')]||'no';this[_0xf488('0x19')]=!![];this[_0xf488('0x1a')]='';this['originated']=0x0;this[_0xf488('0x1b')]=0x0;this['dialTimezone']=_0x75eac[_0xf488('0x1c')]||null;this['dialGlobalInterval']=_0x75eac['dialGlobalInterval']?_0x75eac[_0xf488('0x1d')]:null;this[_0xf488('0x1e')]=_0x75eac[_0xf488('0x1e')];this[_0xf488('0x1f')]=_0x75eac['dialMethod']||_0xf488('0x20');this[_0xf488('0x21')]=_0x75eac[_0xf488('0x21')]||0x0;this[_0xf488('0x22')]=_0x75eac['dialLimitQueue']||0x0;this[_0xf488('0x23')]=_0x75eac[_0xf488('0x23')]||0x1;this['dialPredictiveOptimization']=_0x75eac[_0xf488('0x24')]||_0xf488('0x25');this['dialPredictiveOptimizationPercentage']=_0x75eac[_0xf488('0x26')]||0.03;this[_0xf488('0x27')]=_0x75eac[_0xf488('0x27')]||0x258;this[_0xf488('0x28')]=_0x75eac[_0xf488('0x28')]||_0xf488('0x29');this[_0xf488('0x2a')]=_0x75eac[_0xf488('0x2a')]||_0xf488('0x29');this[_0xf488('0x2b')]=_0x75eac[_0xf488('0x2b')]||0x1e;this[_0xf488('0x2c')]=_0x75eac[_0xf488('0x2c')]||'tTxX';this[_0xf488('0x2d')]=_0x75eac['dialQueueTimeout']||0x3;this[_0xf488('0x2e')]=_0x75eac[_0xf488('0x2e')]||undefined;this['dialCongestionMaxRetry']=_0x75eac[_0xf488('0x2f')]||0x3;this[_0xf488('0x30')]=_0x75eac[_0xf488('0x30')]||0x96;this[_0xf488('0x31')]=_0x75eac[_0xf488('0x31')]||0x3;this[_0xf488('0x32')]=_0x75eac[_0xf488('0x32')]||0x96;this[_0xf488('0x33')]=_0x75eac[_0xf488('0x33')]||0x3;this['dialNoAnswerRetryFrequency']=_0x75eac['dialNoAnswerRetryFrequency']||0x96;this[_0xf488('0x34')]=_0x75eac[_0xf488('0x34')]||0x3;this[_0xf488('0x35')]=_0x75eac[_0xf488('0x35')]||0x96;this[_0xf488('0x36')]=_0x75eac[_0xf488('0x36')]||0x3;this['dialDropRetryFrequency']=_0x75eac[_0xf488('0x37')]||0x96;this[_0xf488('0x38')]=_0x75eac['dialAbandonedMaxRetry']||0x3;this[_0xf488('0x39')]=_0x75eac[_0xf488('0x39')]||0x96;this['dialMachineMaxRetry']=_0x75eac[_0xf488('0x3a')]||0x3;this[_0xf488('0x3b')]=_0x75eac[_0xf488('0x3b')]||0x96;this[_0xf488('0x3c')]=_0x75eac[_0xf488('0x3c')]||0x3;this[_0xf488('0x3d')]=_0x75eac[_0xf488('0x3d')]||0x96;this[_0xf488('0x3e')]=_0x75eac[_0xf488('0x3e')]||0x4;this[_0xf488('0x3f')]=_0x75eac[_0xf488('0x3f')]?_0x75eac[_0xf488('0x3f')]:undefined;this[_0xf488('0x40')]=_0x75eac[_0xf488('0x40')]?_0x75eac[_0xf488('0x40')]:undefined;this['dialPrefix']=_0x75eac[_0xf488('0x41')]||undefined;this['Interval']=_0x75eac['Interval']?_0x75eac[_0xf488('0x42')]:undefined;this[_0xf488('0x43')]=_0x75eac[_0xf488('0x43')]||_0xf488('0x44');this[_0xf488('0x45')]=_0x75eac[_0xf488('0x45')]||undefined;this['dialCutDigit']=_0x75eac[_0xf488('0x46')]||undefined;this[_0xf488('0x47')]=strategy[_0x75eac['strategy']]||_0xf488('0x8');this['queueStatusComplete']=!![];this[_0xf488('0x48')]=_0x75eac['dialAMDActive']||![];this[_0xf488('0x49')]=_0x75eac[_0xf488('0x49')];this[_0xf488('0x4a')]=_0x75eac[_0xf488('0x4a')];this[_0xf488('0x4b')]=_0x75eac[_0xf488('0x4b')];this[_0xf488('0x4c')]=_0x75eac[_0xf488('0x4c')];this['dialAMDMinWordLength']=_0x75eac['dialAMDMinWordLength'];this['dialAMDBetweenWordsSilence']=_0x75eac[_0xf488('0x4d')];this[_0xf488('0x4e')]=_0x75eac[_0xf488('0x4e')];this[_0xf488('0x4f')]=_0x75eac[_0xf488('0x4f')];this[_0xf488('0x50')]=_0x75eac['dialAMDMaximumWordLength'];this['outboundRejectCallsDay']=0x0;this[_0xf488('0x51')]=0x0;this[_0xf488('0x52')]=_0x75eac[_0xf488('0x52')];this[_0xf488('0x53')]=0x0;this[_0xf488('0x54')]=0x0;this[_0xf488('0x55')]=0x0;this[_0xf488('0x56')]=0x0;this[_0xf488('0x57')]=0x0;this[_0xf488('0x58')]=0x0;this[_0xf488('0x59')]=0x0;this[_0xf488('0x5a')]=0x0;this[_0xf488('0x5b')]=0x0;this[_0xf488('0x5c')]=0x0;this[_0xf488('0x5d')]=0x0;this[_0xf488('0x5e')]=0x0;this[_0xf488('0x5f')]=0x0;this[_0xf488('0x60')]=0x0;this['startProgressive']=undefined;this['startPredictive']=undefined;this[_0xf488('0x61')]=undefined;this[_0xf488('0x62')]=1.05;this['predictiveIntervalTotalCalls']=0x0;this[_0xf488('0x63')]=0x0;this[_0xf488('0x64')]=0x0;this[_0xf488('0x65')]=0x0;this['predictiveIntervalAvgHoldtime']=0x0;this[_0xf488('0x66')]=0x0;this[_0xf488('0x67')]=0x0;this['predictiveIntervalAvailable']=0x0;this[_0xf488('0x68')]=_0x75eac[_0xf488('0x69')]||0x14;this[_0xf488('0x6a')]=_0x75eac[_0xf488('0x69')]||0xa;this[_0xf488('0x6b')]=0x0;this[_0xf488('0x6c')]=0x0;this['predictiveIntervalHitRate']=0x1;this[_0xf488('0x6d')]=0x0;this['erlangCallToSecond']=0x0;this[_0xf488('0x6e')]=0x0;this[_0xf488('0x6f')]=0x0;this['dialRecallMeTimeout']=_0x75eac[_0xf488('0x70')]||0x1e;this['dialRecallInQueue']=_0x75eac[_0xf488('0x71')]||![];this[_0xf488('0x72')]=_0x75eac['dialQueueProject2']||undefined;this['dialAgiAfterHangupClient']=_0x75eac[_0xf488('0x73')]||![];this[_0xf488('0x74')]=_0x75eac[_0xf488('0x74')]||![];this[_0xf488('0xb')]=monitorFormat[_0x75eac[_0xf488('0xb')]]?monitorFormat[_0x75eac[_0xf488('0xb')]]:undefined;this[_0xf488('0x75')]=_0x75eac['mandatoryDisposition']||![];this['mandatoryDispositionPause']=_0x75eac[_0xf488('0x76')]?_0x75eac[_0xf488('0x76')]:undefined;}module[_0xf488('0x77')]=VoiceQueue; \ No newline at end of file +var _0xc76f=['Interval','dialOrderByScheduledAt','DESC','dialRandomLastDigitCallerIdNumber','dialCutDigit','strategy','queueStatusComplete','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','outboundRejectCallsDay','pTalking','timeout','outboundAnswerCallsDay','outboundAnswerAgiCallsDay','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundUnknownCallsDay','outboundBlacklistCallsDay','outboundOriginateFailureCallsDay','outboundDropCallsDayCallersExit','outboundDropCallsDayACS','outboundReCallsDay','outboundAbandonedDay','startProgressive','startPredictive','handlePredictive','predictiveIntervalTotalCalls','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsTimeout','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalMaxThreshold','dialPredictiveIntervalMaxThreshold','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','erlangCalls','erlangAbandonmentRate','dialRecallMeTimeout','dialRecallInQueue','dialQueueProject2','dialAgiAfterHangupClient','dialAgiAfterHangupAgent','mandatoryDisposition','mandatoryDispositionPause','exports','not_inuse','busy','invalid','unavailable','ringing','onhold','wav','wav49','gsm','rrmemory','roundrobin','name','monitor_format','type','inbound','waiting','talking','total','sumBillable','loggedIn','available','acw','acwTimeout','autopause','sendMessageOneNotActive','message','originated','temp','dialTimezone','dialGlobalInterval','dialActive','dialMethod','progressive','dialLimitChannel','dialLimitQueue','dialPowerLevel','dialPredictiveOptimization','dropRate','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdName','anonymous','dialOriginateCallerIdNumber','dialOriginateTimeout','dialQueueOptions','tTxX','dialQueueTimeout','dialQueueProject','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialGlobalMaxRetry','Trunk','TrunkBackup','dialPrefix'];(function(_0x3f3fe2,_0x579235){var _0x39514d=function(_0x5146d4){while(--_0x5146d4){_0x3f3fe2['push'](_0x3f3fe2['shift']());}};_0x39514d(++_0x579235);}(_0xc76f,0xb1));var _0xfc76=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xc76f[_0x3dd15e];return _0x231fd0;};'use strict';var statusDesc=['unknown',_0xfc76('0x0'),'inuse',_0xfc76('0x1'),_0xfc76('0x2'),_0xfc76('0x3'),_0xfc76('0x4'),'ringinuse',_0xfc76('0x5')];var monitorFormat={'wav':_0xfc76('0x6'),'wav49':_0xfc76('0x7'),'gsm':_0xfc76('0x8')};var strategy={'rrmemory':_0xfc76('0x9'),'roundrobin':_0xfc76('0xa')};function VoiceQueue(_0x2ad338){this['id']=_0x2ad338['id']||0x0;this[_0xfc76('0xb')]=_0x2ad338[_0xfc76('0xb')]||'';this['monitor_format']=_0x2ad338[_0xfc76('0xc')]||'';this[_0xfc76('0xd')]=_0x2ad338['type']||_0xfc76('0xe');this[_0xfc76('0xf')]=0x0;this[_0xfc76('0x10')]=0x0;this[_0xfc76('0x11')]=0x0;this['answered']=0x0;this['sumDuration']=0x0;this['sumHoldTime']=0x0;this[_0xfc76('0x12')]=0x0;this['unmanaged']=0x0;this['abandoned']=0x0;this[_0xfc76('0x13')]=0x0;this[_0xfc76('0x14')]=0x0;this['acw']=_0x2ad338[_0xfc76('0x15')]||![];this[_0xfc76('0x16')]=_0x2ad338[_0xfc76('0x16')]||0xa;this[_0xfc76('0x17')]=_0x2ad338[_0xfc76('0x17')]||'no';this[_0xfc76('0x18')]=!![];this[_0xfc76('0x19')]='';this[_0xfc76('0x1a')]=0x0;this[_0xfc76('0x1b')]=0x0;this[_0xfc76('0x1c')]=_0x2ad338[_0xfc76('0x1c')]||null;this[_0xfc76('0x1d')]=_0x2ad338['dialGlobalInterval']?_0x2ad338[_0xfc76('0x1d')]:null;this[_0xfc76('0x1e')]=_0x2ad338[_0xfc76('0x1e')];this[_0xfc76('0x1f')]=_0x2ad338[_0xfc76('0x1f')]||_0xfc76('0x20');this['dialLimitChannel']=_0x2ad338[_0xfc76('0x21')]||0x0;this[_0xfc76('0x22')]=_0x2ad338[_0xfc76('0x22')]||0x0;this[_0xfc76('0x23')]=_0x2ad338[_0xfc76('0x23')]||0x1;this[_0xfc76('0x24')]=_0x2ad338[_0xfc76('0x24')]||_0xfc76('0x25');this[_0xfc76('0x26')]=_0x2ad338[_0xfc76('0x26')]||0.03;this[_0xfc76('0x27')]=_0x2ad338['dialPredictiveInterval']||0x258;this[_0xfc76('0x28')]=_0x2ad338[_0xfc76('0x28')]||_0xfc76('0x29');this[_0xfc76('0x2a')]=_0x2ad338['dialOriginateCallerIdNumber']||'anonymous';this[_0xfc76('0x2b')]=_0x2ad338[_0xfc76('0x2b')]||0x1e;this[_0xfc76('0x2c')]=_0x2ad338[_0xfc76('0x2c')]||_0xfc76('0x2d');this['dialQueueTimeout']=_0x2ad338[_0xfc76('0x2e')]||0x3;this[_0xfc76('0x2f')]=_0x2ad338[_0xfc76('0x2f')]||undefined;this[_0xfc76('0x30')]=_0x2ad338[_0xfc76('0x30')]||0x3;this[_0xfc76('0x31')]=_0x2ad338[_0xfc76('0x31')]||0x96;this['dialBusyMaxRetry']=_0x2ad338[_0xfc76('0x32')]||0x3;this[_0xfc76('0x33')]=_0x2ad338['dialBusyRetryFrequency']||0x96;this[_0xfc76('0x34')]=_0x2ad338[_0xfc76('0x34')]||0x3;this[_0xfc76('0x35')]=_0x2ad338[_0xfc76('0x35')]||0x96;this['dialNoSuchNumberMaxRetry']=_0x2ad338[_0xfc76('0x36')]||0x3;this[_0xfc76('0x37')]=_0x2ad338[_0xfc76('0x37')]||0x96;this[_0xfc76('0x38')]=_0x2ad338[_0xfc76('0x38')]||0x3;this[_0xfc76('0x39')]=_0x2ad338[_0xfc76('0x39')]||0x96;this['dialAbandonedMaxRetry']=_0x2ad338[_0xfc76('0x3a')]||0x3;this[_0xfc76('0x3b')]=_0x2ad338[_0xfc76('0x3b')]||0x96;this[_0xfc76('0x3c')]=_0x2ad338['dialMachineMaxRetry']||0x3;this[_0xfc76('0x3d')]=_0x2ad338[_0xfc76('0x3d')]||0x96;this[_0xfc76('0x3e')]=_0x2ad338[_0xfc76('0x3e')]||0x3;this['dialAgentRejectRetryFrequency']=_0x2ad338['dialAgentRejectRetryFrequency']||0x96;this[_0xfc76('0x3f')]=_0x2ad338[_0xfc76('0x3f')]||0x4;this['Trunk']=_0x2ad338[_0xfc76('0x40')]?_0x2ad338[_0xfc76('0x40')]:undefined;this[_0xfc76('0x41')]=_0x2ad338[_0xfc76('0x41')]?_0x2ad338['TrunkBackup']:undefined;this['dialPrefix']=_0x2ad338[_0xfc76('0x42')]||undefined;this[_0xfc76('0x43')]=_0x2ad338['Interval']?_0x2ad338['Interval']:undefined;this['dialOrderByScheduledAt']=_0x2ad338[_0xfc76('0x44')]||_0xfc76('0x45');this[_0xfc76('0x46')]=_0x2ad338['dialRandomLastDigitCallerIdNumber']||undefined;this[_0xfc76('0x47')]=_0x2ad338['dialCutDigit']||undefined;this[_0xfc76('0x48')]=strategy[_0x2ad338[_0xfc76('0x48')]]||'rrmemory';this[_0xfc76('0x49')]=!![];this['dialAMDActive']=_0x2ad338['dialAMDActive']||![];this[_0xfc76('0x4a')]=_0x2ad338[_0xfc76('0x4a')];this[_0xfc76('0x4b')]=_0x2ad338[_0xfc76('0x4b')];this[_0xfc76('0x4c')]=_0x2ad338[_0xfc76('0x4c')];this[_0xfc76('0x4d')]=_0x2ad338[_0xfc76('0x4d')];this[_0xfc76('0x4e')]=_0x2ad338['dialAMDMinWordLength'];this[_0xfc76('0x4f')]=_0x2ad338[_0xfc76('0x4f')];this['dialAMDMaximumNumberOfWords']=_0x2ad338[_0xfc76('0x50')];this[_0xfc76('0x51')]=_0x2ad338[_0xfc76('0x51')];this[_0xfc76('0x52')]=_0x2ad338[_0xfc76('0x52')];this[_0xfc76('0x53')]=0x0;this[_0xfc76('0x54')]=0x0;this[_0xfc76('0x55')]=_0x2ad338[_0xfc76('0x55')];this[_0xfc76('0x56')]=0x0;this[_0xfc76('0x57')]=0x0;this[_0xfc76('0x58')]=0x0;this['outboundBusyCallsDay']=0x0;this['outboundCongestionCallsDay']=0x0;this[_0xfc76('0x59')]=0x0;this[_0xfc76('0x5a')]=0x0;this[_0xfc76('0x5b')]=0x0;this[_0xfc76('0x5c')]=0x0;this[_0xfc76('0x5d')]=0x0;this['outboundDropCallsDayTimeout']=0x0;this[_0xfc76('0x5e')]=0x0;this[_0xfc76('0x5f')]=0x0;this[_0xfc76('0x60')]=0x0;this[_0xfc76('0x61')]=undefined;this[_0xfc76('0x62')]=undefined;this[_0xfc76('0x63')]=undefined;this['predictiveIntervalMultiplicativeFactor']=1.05;this[_0xfc76('0x64')]=0x0;this[_0xfc76('0x65')]=0x0;this['predictiveIntervalDroppedCallsCallersExit']=0x0;this[_0xfc76('0x66')]=0x0;this[_0xfc76('0x67')]=0x0;this[_0xfc76('0x68')]=0x0;this[_0xfc76('0x69')]=0x0;this[_0xfc76('0x6a')]=0x0;this[_0xfc76('0x6b')]=_0x2ad338[_0xfc76('0x6c')]||0x14;this['predictiveIntervalMinThreshold']=_0x2ad338[_0xfc76('0x6c')]||0xa;this[_0xfc76('0x6d')]=0x0;this[_0xfc76('0x6e')]=0x0;this[_0xfc76('0x6f')]=0x1;this[_0xfc76('0x70')]=0x0;this['erlangCallToSecond']=0x0;this[_0xfc76('0x71')]=0x0;this['erlangBusyFactor']=0x0;this[_0xfc76('0x72')]=_0x2ad338[_0xfc76('0x72')]||0x1e;this[_0xfc76('0x73')]=_0x2ad338[_0xfc76('0x73')]||![];this[_0xfc76('0x74')]=_0x2ad338['dialQueueProject2']||undefined;this['dialAgiAfterHangupClient']=_0x2ad338[_0xfc76('0x75')]||![];this[_0xfc76('0x76')]=_0x2ad338[_0xfc76('0x76')]||![];this['monitor_format']=monitorFormat[_0x2ad338['monitor_format']]?monitorFormat[_0x2ad338[_0xfc76('0xc')]]:undefined;this[_0xfc76('0x77')]=_0x2ad338[_0xfc76('0x77')]||![];this['mandatoryDispositionPause']=_0x2ad338[_0xfc76('0x78')]?_0x2ad338[_0xfc76('0x78')]:undefined;}module[_0xfc76('0x79')]=VoiceQueue; \ No newline at end of file diff --git a/server/services/ami/model/vtigerAccount.js b/server/services/ami/model/vtigerAccount.js index 192128d..f697be9 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 _0x7e46=['serverUrl','Configurations','name','username','accessKey','remoteUri'];(function(_0x457f4e,_0x2d1d0a){var _0x241e9a=function(_0x5d81e8){while(--_0x5d81e8){_0x457f4e['push'](_0x457f4e['shift']());}};_0x241e9a(++_0x2d1d0a);}(_0x7e46,0x1a6));var _0x67e4=function(_0x440976,_0x272140){_0x440976=_0x440976-0x0;var _0x45e5a0=_0x7e46[_0x440976];return _0x45e5a0;};'use strict';function VtigerAccount(_0x353afb){this['id']=_0x353afb['id']||0x0;this[_0x67e4('0x0')]=_0x353afb[_0x67e4('0x0')]||'';this[_0x67e4('0x1')]=_0x353afb['username']||'';this[_0x67e4('0x2')]=_0x353afb[_0x67e4('0x2')]||'';this[_0x67e4('0x3')]=_0x353afb['remoteUri']||'';this[_0x67e4('0x4')]=_0x353afb[_0x67e4('0x4')]||'';this[_0x67e4('0x5')]=_0x353afb[_0x67e4('0x5')]||{};}module['exports']=VtigerAccount; \ No newline at end of file +var _0xd03a=['remoteUri','Configurations','name','username'];(function(_0x273fd1,_0x388bbe){var _0x5d3dbf=function(_0xd435e7){while(--_0xd435e7){_0x273fd1['push'](_0x273fd1['shift']());}};_0x5d3dbf(++_0x388bbe);}(_0xd03a,0x1a2));var _0xad03=function(_0x34f533,_0x251aee){_0x34f533=_0x34f533-0x0;var _0x1b37d2=_0xd03a[_0x34f533];return _0x1b37d2;};'use strict';function VtigerAccount(_0x31cbfb){this['id']=_0x31cbfb['id']||0x0;this[_0xad03('0x0')]=_0x31cbfb[_0xad03('0x0')]||'';this[_0xad03('0x1')]=_0x31cbfb[_0xad03('0x1')]||'';this['accessKey']=_0x31cbfb['accessKey']||'';this[_0xad03('0x2')]=_0x31cbfb[_0xad03('0x2')]||'';this['serverUrl']=_0x31cbfb['serverUrl']||'';this[_0xad03('0x3')]=_0x31cbfb['Configurations']||{};}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 ad4e2a6..e0036f5 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 _0xdb28=['Configurations','exports','name','username','password','token','remoteUri','authType','integrationTab','serverUrl'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xdb28,0x106));var _0x8db2=function(_0x3c2b46,_0x34e6a3){_0x3c2b46=_0x3c2b46-0x0;var _0x14e29d=_0xdb28[_0x3c2b46];return _0x14e29d;};'use strict';function ZendeskAccount(_0x2f1285){this['id']=_0x2f1285['id']||0x0;this[_0x8db2('0x0')]=_0x2f1285[_0x8db2('0x0')]||'';this[_0x8db2('0x1')]=_0x2f1285['username']||'';this[_0x8db2('0x2')]=_0x2f1285[_0x8db2('0x2')]||'';this[_0x8db2('0x3')]=_0x2f1285[_0x8db2('0x3')]||'';this[_0x8db2('0x4')]=_0x2f1285['remoteUri']||'';this[_0x8db2('0x5')]=_0x2f1285[_0x8db2('0x5')]||'';this['type']=_0x2f1285['type']||_0x8db2('0x6');this[_0x8db2('0x7')]=_0x2f1285[_0x8db2('0x7')]||'';this[_0x8db2('0x8')]=_0x2f1285[_0x8db2('0x8')]||{};}module[_0x8db2('0x9')]=ZendeskAccount; \ No newline at end of file +var _0xdb28=['Configurations','exports','name','username','password','token','remoteUri','authType','integrationTab','serverUrl'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xdb28,0x106));var _0x8db2=function(_0x45837d,_0x2f0f81){_0x45837d=_0x45837d-0x0;var _0xa4d0c6=_0xdb28[_0x45837d];return _0xa4d0c6;};'use strict';function ZendeskAccount(_0x2f1285){this['id']=_0x2f1285['id']||0x0;this[_0x8db2('0x0')]=_0x2f1285[_0x8db2('0x0')]||'';this[_0x8db2('0x1')]=_0x2f1285['username']||'';this[_0x8db2('0x2')]=_0x2f1285[_0x8db2('0x2')]||'';this[_0x8db2('0x3')]=_0x2f1285[_0x8db2('0x3')]||'';this[_0x8db2('0x4')]=_0x2f1285['remoteUri']||'';this[_0x8db2('0x5')]=_0x2f1285[_0x8db2('0x5')]||'';this['type']=_0x2f1285['type']||_0x8db2('0x6');this[_0x8db2('0x7')]=_0x2f1285[_0x8db2('0x7')]||'';this[_0x8db2('0x8')]=_0x2f1285[_0x8db2('0x8')]||{};}module[_0x8db2('0x9')]=ZendeskAccount; \ No newline at end of file diff --git a/server/services/ami/model/zohoAccount.js b/server/services/ami/model/zohoAccount.js index c705302..7d60c03 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 _0xf5b6=['serverUrl','refreshToken','Configurations','exports','name','description','host','zone','clientId'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xf5b6,0x1b4));var _0x6f5b=function(_0x5d1b38,_0x12c2cf){_0x5d1b38=_0x5d1b38-0x0;var _0x46a311=_0xf5b6[_0x5d1b38];return _0x46a311;};'use strict';function ZohoAccount(_0x42c7f9){this['id']=_0x42c7f9['id']||0x0;this['name']=_0x42c7f9[_0x6f5b('0x0')]||'';this[_0x6f5b('0x1')]=_0x42c7f9[_0x6f5b('0x1')]||'';this[_0x6f5b('0x2')]=_0x42c7f9['host']||'';this[_0x6f5b('0x3')]=_0x42c7f9[_0x6f5b('0x3')]||'';this[_0x6f5b('0x4')]=_0x42c7f9[_0x6f5b('0x4')]||'';this['clientSecret']=_0x42c7f9['clientSecret']||'';this[_0x6f5b('0x5')]=_0x42c7f9[_0x6f5b('0x5')]||'';this['code']=_0x42c7f9['code']||'';this[_0x6f5b('0x6')]=_0x42c7f9['refreshToken']||'';this[_0x6f5b('0x7')]=_0x42c7f9[_0x6f5b('0x7')]||{};}module[_0x6f5b('0x8')]=ZohoAccount; \ No newline at end of file +var _0xa664=['name','description','host','clientId','clientSecret','serverUrl','code','refreshToken','Configurations'];(function(_0x160951,_0x4508b3){var _0x4e30a2=function(_0x143629){while(--_0x143629){_0x160951['push'](_0x160951['shift']());}};_0x4e30a2(++_0x4508b3);}(_0xa664,0x132));var _0x4a66=function(_0x14481a,_0x10fd61){_0x14481a=_0x14481a-0x0;var _0x5da7c9=_0xa664[_0x14481a];return _0x5da7c9;};'use strict';function ZohoAccount(_0xa8e91a){this['id']=_0xa8e91a['id']||0x0;this[_0x4a66('0x0')]=_0xa8e91a[_0x4a66('0x0')]||'';this[_0x4a66('0x1')]=_0xa8e91a[_0x4a66('0x1')]||'';this['host']=_0xa8e91a[_0x4a66('0x2')]||'';this['zone']=_0xa8e91a['zone']||'';this[_0x4a66('0x3')]=_0xa8e91a[_0x4a66('0x3')]||'';this[_0x4a66('0x4')]=_0xa8e91a[_0x4a66('0x4')]||'';this[_0x4a66('0x5')]=_0xa8e91a[_0x4a66('0x5')]||'';this[_0x4a66('0x6')]=_0xa8e91a['code']||'';this[_0x4a66('0x7')]=_0xa8e91a[_0x4a66('0x7')]||'';this[_0x4a66('0x8')]=_0xa8e91a[_0x4a66('0x8')]||{};}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 302972b..6c80dbc 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 _0xa141=['dialAnswer','Agent','channelAgent','membername','format','SIP/%s','calleridname','Contact','phone','firstName','active','calleridnum','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','countnosuchnumberretry','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','originatecalleridnum','originatecalleridname','prototype','getCaller','\x22%s\x22\x20<%s>','number','exports','lodash','moment','string','isNil','uniqueid','idContact','name','type','campaigntype'];(function(_0x178e48,_0x3c9509){var _0x440d7e=function(_0xc2f8a0){while(--_0xc2f8a0){_0x178e48['push'](_0x178e48['shift']());}};_0x440d7e(++_0x3c9509);}(_0xa141,0x1c3));var _0x1a14=function(_0x5583d3,_0x3b6d76){_0x5583d3=_0x5583d3-0x0;var _0x2d8923=_0xa141[_0x5583d3];return _0x2d8923;};'use strict';var util=require('util');var _=require(_0x1a14('0x0'));var moment=require(_0x1a14('0x1'));function checkNameSurname(_0x1f9942,_0x527baa,_0x4b8c70){var _0x1e4b3e='';if(!_['isNil'](_0x527baa)&&_0x1a14('0x2')===typeof _0x527baa){_0x1e4b3e+=_0x527baa;}if(!_[_0x1a14('0x3')](_0x4b8c70)&&_0x1a14('0x2')===typeof _0x4b8c70){_0x1e4b3e+='\x20'+_0x4b8c70;}if(_0x1e4b3e!==''){return _0x1e4b3e;}return _0x1f9942;}function Action(_0x4ecf7d,_0x491d07,_0xbfecc0,_0x207a10,_0x2c6957){this[_0x1a14('0x4')]=_0xbfecc0||undefined;this[_0x1a14('0x5')]=_0x4ecf7d['id'];this['queue']=_0x491d07[_0x1a14('0x6')];this[_0x1a14('0x7')]=_0x491d07[_0x1a14('0x7')];this[_0x1a14('0x8')]='queue';this[_0x1a14('0x9')]=![];this['membername']=_[_0x1a14('0x3')](_0x4ecf7d[_0x1a14('0xa')])?undefined:_0x4ecf7d[_0x1a14('0xa')][_0x1a14('0x6')];this[_0x1a14('0xb')]=this[_0x1a14('0xc')]?util[_0x1a14('0xd')](_0x1a14('0xe'),this[_0x1a14('0xc')]):_0x207a10||undefined;this[_0x1a14('0xf')]=checkNameSurname(_0x4ecf7d[_0x1a14('0x10')][_0x1a14('0x11')],_0x4ecf7d[_0x1a14('0x10')][_0x1a14('0x12')],_0x4ecf7d[_0x1a14('0x10')]['lastName']);this[_0x1a14('0x13')]=_0x4ecf7d[_0x1a14('0x13')]||![];this[_0x1a14('0x14')]=_0x4ecf7d[_0x1a14('0x10')][_0x1a14('0x11')];this[_0x1a14('0x15')]=_0x4ecf7d[_0x1a14('0x15')];this[_0x1a14('0x16')]=_0x4ecf7d['countbusyretry']||0x0;this[_0x1a14('0x17')]=_0x4ecf7d[_0x1a14('0x17')]||0x0;this[_0x1a14('0x18')]=_0x4ecf7d[_0x1a14('0x18')]||0x0;this[_0x1a14('0x19')]=(_0x4ecf7d[_0x1a14('0x16')]||0x0)+(_0x4ecf7d[_0x1a14('0x17')]||0x0)+(_0x4ecf7d[_0x1a14('0x18')]||0x0)+(_0x4ecf7d['countnosuchnumberretry']||0x0)+(_0x4ecf7d[_0x1a14('0x1a')]||0x0)+(_0x4ecf7d[_0x1a14('0x1b')]||0x0)+(_0x4ecf7d[_0x1a14('0x1c')]||0x0)+(_0x4ecf7d[_0x1a14('0x1d')]||0x0);this['countnosuchnumberretry']=_0x4ecf7d[_0x1a14('0x1e')]||0x0;this[_0x1a14('0x1a')]=_0x4ecf7d[_0x1a14('0x1a')]||0x0;this[_0x1a14('0x1b')]=_0x4ecf7d[_0x1a14('0x1b')]||0x0;this['countmachineretry']=_0x4ecf7d['countmachineretry']||0x0;this[_0x1a14('0x1d')]=_0x4ecf7d[_0x1a14('0x1d')]||0x0;this[_0x1a14('0x1f')]=_0x4ecf7d[_0x1a14('0x1f')];this[_0x1a14('0x20')]=_0x4ecf7d[_0x1a14('0x20')];this[_0x1a14('0x21')]=_0x4ecf7d[_0x1a14('0x21')];this[_0x1a14('0x22')]=_0x4ecf7d['recallme'];this[_0x1a14('0x23')]=_0x4ecf7d['ContactId'];this[_0x1a14('0x24')]=_0x4ecf7d[_0x1a14('0x24')];this[_0x1a14('0x25')]=_[_0x1a14('0x3')](_0x4ecf7d[_0x1a14('0xa')])?_0x4ecf7d['UserId']:_0x4ecf7d['Agent']['id'];this[_0x1a14('0x26')]=_0x4ecf7d[_0x1a14('0x26')];this[_0x1a14('0x27')]='';this[_0x1a14('0x28')]='';}Action[_0x1a14('0x29')][_0x1a14('0x2a')]=function(){return util['format'](_0x1a14('0x2b'),this[_0x1a14('0xf')],this[_0x1a14('0x2c')]);};module[_0x1a14('0x2d')]=Action; \ No newline at end of file +var _0x733e=['lastName','active','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countabandonedretry','countmachineretry','countagentrejectretry','countdropretry','callback','callbackuniqueid','recallme','ContactId','ListId','UserId','VoiceQueueId','prototype','getCaller','\x22%s\x22\x20<%s>','exports','util','lodash','moment','isNil','string','idContact','queue','name','type','campaigntype','dialAnswer','membername','Agent','channelAgent','format','SIP/%s','calleridname','Contact','phone'];(function(_0x650e11,_0x284f86){var _0x1a9b47=function(_0x6e15e3){while(--_0x6e15e3){_0x650e11['push'](_0x650e11['shift']());}};_0x1a9b47(++_0x284f86);}(_0x733e,0x1b0));var _0xe733=function(_0x566168,_0x4c39af){_0x566168=_0x566168-0x0;var _0x4e1f7a=_0x733e[_0x566168];return _0x4e1f7a;};'use strict';var util=require(_0xe733('0x0'));var _=require(_0xe733('0x1'));var moment=require(_0xe733('0x2'));function checkNameSurname(_0x313aaf,_0x34122d,_0xa8f4a5){var _0x2993c6='';if(!_[_0xe733('0x3')](_0x34122d)&&_0xe733('0x4')===typeof _0x34122d){_0x2993c6+=_0x34122d;}if(!_[_0xe733('0x3')](_0xa8f4a5)&&'string'===typeof _0xa8f4a5){_0x2993c6+='\x20'+_0xa8f4a5;}if(_0x2993c6!==''){return _0x2993c6;}return _0x313aaf;}function Action(_0x43ba34,_0x481fc1,_0x448706,_0x108a28,_0x9b3d84){this['uniqueid']=_0x448706||undefined;this[_0xe733('0x5')]=_0x43ba34['id'];this[_0xe733('0x6')]=_0x481fc1[_0xe733('0x7')];this[_0xe733('0x8')]=_0x481fc1[_0xe733('0x8')];this[_0xe733('0x9')]='queue';this[_0xe733('0xa')]=![];this[_0xe733('0xb')]=_[_0xe733('0x3')](_0x43ba34[_0xe733('0xc')])?undefined:_0x43ba34['Agent'][_0xe733('0x7')];this[_0xe733('0xd')]=this[_0xe733('0xb')]?util[_0xe733('0xe')](_0xe733('0xf'),this[_0xe733('0xb')]):_0x108a28||undefined;this[_0xe733('0x10')]=checkNameSurname(_0x43ba34[_0xe733('0x11')][_0xe733('0x12')],_0x43ba34[_0xe733('0x11')]['firstName'],_0x43ba34[_0xe733('0x11')][_0xe733('0x13')]);this[_0xe733('0x14')]=_0x43ba34[_0xe733('0x14')]||![];this['calleridnum']=_0x43ba34[_0xe733('0x11')][_0xe733('0x12')];this[_0xe733('0x15')]=_0x43ba34[_0xe733('0x15')];this[_0xe733('0x16')]=_0x43ba34[_0xe733('0x16')]||0x0;this[_0xe733('0x17')]=_0x43ba34[_0xe733('0x17')]||0x0;this[_0xe733('0x18')]=_0x43ba34['countnoanswerretry']||0x0;this['countglobal']=(_0x43ba34[_0xe733('0x16')]||0x0)+(_0x43ba34[_0xe733('0x17')]||0x0)+(_0x43ba34['countnoanswerretry']||0x0)+(_0x43ba34[_0xe733('0x19')]||0x0)+(_0x43ba34['countdropretry']||0x0)+(_0x43ba34[_0xe733('0x1a')]||0x0)+(_0x43ba34[_0xe733('0x1b')]||0x0)+(_0x43ba34[_0xe733('0x1c')]||0x0);this[_0xe733('0x19')]=_0x43ba34[_0xe733('0x19')]||0x0;this['countdropretry']=_0x43ba34[_0xe733('0x1d')]||0x0;this['countabandonedretry']=_0x43ba34[_0xe733('0x1a')]||0x0;this[_0xe733('0x1b')]=_0x43ba34[_0xe733('0x1b')]||0x0;this[_0xe733('0x1c')]=_0x43ba34[_0xe733('0x1c')]||0x0;this[_0xe733('0x1e')]=_0x43ba34[_0xe733('0x1e')];this[_0xe733('0x1f')]=_0x43ba34[_0xe733('0x1f')];this['callbackat']=_0x43ba34['callbackat'];this[_0xe733('0x20')]=_0x43ba34[_0xe733('0x20')];this[_0xe733('0x21')]=_0x43ba34[_0xe733('0x21')];this[_0xe733('0x22')]=_0x43ba34['ListId'];this[_0xe733('0x23')]=_[_0xe733('0x3')](_0x43ba34[_0xe733('0xc')])?_0x43ba34[_0xe733('0x23')]:_0x43ba34[_0xe733('0xc')]['id'];this[_0xe733('0x24')]=_0x43ba34['VoiceQueueId'];this['originatecalleridnum']='';this['originatecalleridname']='';}Action[_0xe733('0x25')][_0xe733('0x26')]=function(){return util[_0xe733('0xe')](_0xe733('0x27'),this[_0xe733('0x10')],this['number']);};module[_0xe733('0x28')]=Action; \ No newline at end of file diff --git a/server/services/ami/preview/index.js b/server/services/ami/preview/index.js index 3ded321..ab55527 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 _0xba4b=['cause-txt','dialstatus','[callProgressDetectingCustomer][logUnknown]','[callProgressDetectingCustomer][logUnknownGlobal]','linkedid','[callProgressDetectingCustomer]','[originated][decrement][callProgressDetectingCustomer]','ANSWER','destlinkedid','callProgressDetectingAgent','isUndefined','object','logAgent','[callProgressDetectingAgent][logNoSuch]','createAgentHistory','[callProgressDetectingAgent][logNoAnswer]','[callProgressDetectingAgent][logBusy]','[callProgressDetectingAgent][logCongestion]','AnswerAGI','reason','[originated][decrement][callProgressDetectingAgent]','checkInBlack','Contact','phone','Contact\x20is\x20undefined','Queue','isEmpty','execCall','[Preview][execCall][success]','\x20IdHopper:\x20','idContact','custom:agentcalled','[Preview][execCall][failure]','Call\x20failed','createHistory','[Blacklist][error]','SIP/%s','reachable','unlock','unlockContact','execRun','getContactPreview','recallme','validateContact','isValid','checkIsBlackList','Contact.phone','[Preview][checkIsBlackList]','Call\x20unsuccessful','[Preview][getContactPreview]','[Preview][validateContact][Empty\x20Contact]','Empty\x20Contact','Empty\x20Campaign','[Preview][validateContact][Trunk\x20not\x20work]','campaign\x20Name:\x20','\x20Trunk\x20Backup\x20is\x20not\x20active','Trunk\x20not\x20work','[Preview][validateContact][Campaign\x20Active]','\x20Not\x20Active','Is\x20Valid','SIP/%s/%s%s','substring','dialCutDigit','TrunkBackup','trim','getCallerId','callerid','dialRandomLastDigitCallerIdNumber','getCallerIdRandom','originatecalleridname','originatecalleridnum','extractCalleridNumber','addVariables','merge','[originated][increment]','OriginateError','[originateFailure][logOriginateFailure]','syncOriginateResponse','actionid','lookAgent','clone','responsetime','isFailure','[callProgressDetectingAgent][logAnswer]','cause','[syncHangup][talking][cause]','channelstate','transfer','[syncHangup][talking][transfer]','destuniqueid','addVariable','variables','filterKey','keys','variable','error','[syncVarSet][Preview]','transfertargetlinkedid','transfererlinkedid','exports','lodash','bluebird','uuid','moment','../../../config/environment','preview','../../../config/logger','actionPreview','../ami','./rpcDb','./action','./util/util','redis','localhost','enqueue','tail','finally','sequence','voiceQueues','trunks','actions','agents','clockClearZombieChannels','originateresponse','hangup','syncHangup','hanguprequest','syncHangupRequest','bind','dialend','syncDialEnd','syncNewExten','varset','syncVarSet','attendedtransfer','syncAttendedTransfer','blindtransfer','syncBlindTransfer','campaignsPreview','emit','type','outbound','answered','available','loggedIn','pTalking','sumDuration','sumHoldTime','total','unmanaged','abandoned','waiting','loggedInDb','dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','outboundAnswerAgiCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoAnswerCallsDay','outboundOriginateFailureCallsDay','outboundReCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalTotalCalls','originated','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','startPredictive','Trunk','name','active','Interval','stringify','md5','voice:queue:%s','voice_queue:save','[DEBUG]\x20Emit\x20voice_queue_channel:remove\x20event','format','voice_queue_channel:remove','sendMessageOneNotActive','paused','message','NOT_ACTIVE','logger','\x20is\x20not\x20active','IS_DISACTIVED','\x20is\x20disactive','prototype','loopCampaigns','syncCampaigns','hasOwnProperty','booked','clearZombieChannels','recallMe','clearZombieChannel','info','[clearZombieChannels][talking]','queue','originated:\x20','pTalking:\x20','dialAnswer','pick','contactId','UserId','VoiceQueueId','ListId','Action','status','channel','updateOriginated','[clearZombieChannel]','decrementTalkink','loggerError','[Dialer][checkChannel][pTalking][Preview]','[Dialer][checkChannel][Preview]','size','getContactRecallMe','agentReadyId','then','isNil','length','scheduledat','dialRecallMeTimeout','Agent','voicePause','run','[RecallMe]','disableContact','starttime','YYYY-MM-DD\x20HH:mm:ss','logCustomer','RecallInQueue','dialRecallInQueue','createBody','createCustomerHistory','[HistoryDialRecallInQueue][historyCatch]','RecallFailedTimeout','[HistoryRecallClose]','createCustomerFinal','catch','logger2','setMessage','IsNotLoggedIn','AGENTS_NOT_LOGGED','isTrunkReachable','TRUNK_IS_NOT_REACHABLE','ACTIVE','callProgressDetectingCustomer','outboundNoSuchCallsDay','countnosuchnumberretry','countglobal','totalGlobal','NoSuchNumber','buildObj','nosuchnumber','[callProgressDetectingCustomer][logNoSuch]','dialGlobalMaxRetry','cloneAction','Global','[callProgressDetectingCustomer][logNoSuchGlobal]','dialNoSuchNumberMaxRetry','rescheduleContact','scheduledAt','dialNoSuchNumberRetryFrequency','unlockAgent','activeContact','[syncHangup][talking][increment]','uniqueid','\x20Queue','connect','custom:agentConnectPreview','buildAcw','complete','outboundAnswerCallsDay','Answer','[callProgressDetectingCustomer][logAnswer]','crateCustomerReportQueue','talktime','sumBillable','BUSY','countbusyretry','Busy','busy','[callProgressDetectingCustomer][logBusy]','NOANSWER','NoAnswer','noanswer','countnoanswerretry','dialNoAnswerMaxRetry','[callProgressDetectingCustomer][logNoAnswer]','dialNoAnswerRetryFrequency','CONGESTION','countcongestionretry','Congestion','custom:agentcongestion','congestion','[callProgressDetectingCustomer][logCongestion]','[callProgressDetectingCustomer][logCongestionGlobal]','dialBusyRetryFrequency','countagentrejectretry','AgentReject','custom:agentreject','agentreject','[syncHangupRequest][logAgentReject]','[callProgressDetectingCustomer][logAgentReject]','dialAgentRejectMaxRetry','ABANDONED','outboundAbandonedCallsDay','countabandonedretry','[callProgressDetectingCustomer][logAbandoned]','countabandonedetry','[Dialer][decrementTalkink][no\x20Hangup][Preview]'];(function(_0x404991,_0x2729b3){var _0x379bbb=function(_0x3a4310){while(--_0x3a4310){_0x404991['push'](_0x404991['shift']());}};_0x379bbb(++_0x2729b3);}(_0xba4b,0x1af));var _0xbba4=function(_0x5783e5,_0x480b90){_0x5783e5=_0x5783e5-0x0;var _0x3021e4=_0xba4b[_0x5783e5];return _0x3021e4;};'use strict';var util=require('util');var _=require(_0xbba4('0x0'));var BPromise=require(_0xbba4('0x1'));var uuid=require(_0xbba4('0x2'));var moment=require(_0xbba4('0x3'));var md5=require('md5');var Redis=require('ioredis');var config=require(_0xbba4('0x4'));var logger=require('../../../config/logger')(_0xbba4('0x5'));var loggerAction=require(_0xbba4('0x6'))(_0xbba4('0x7'));var ami=require(_0xbba4('0x8'));var rpcDb=require(_0xbba4('0x9'));var Action=require(_0xbba4('0xa'));var ut=require(_0xbba4('0xb'));config[_0xbba4('0xc')]=_['defaults'](config['redis'],{'host':_0xbba4('0xd'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xbba4('0xc')]));var Sequence=function(){};Sequence['prototype'][_0xbba4('0xe')]=function(_0xb97e13){this['tail']=this[_0xbba4('0xf')]?this[_0xbba4('0xf')][_0xbba4('0x10')](_0xb97e13):_0xb97e13();};function Preview(_0x4a859f){this[_0xbba4('0x11')]=new Sequence();this['campaignsPreview']=_0x4a859f[_0xbba4('0x12')];this[_0xbba4('0x13')]=_0x4a859f['trunks'];this[_0xbba4('0x14')]={};this[_0xbba4('0x15')]=_0x4a859f[_0xbba4('0x15')];this[_0xbba4('0x16')]=0x0;ami['on'](_0xbba4('0x17'),this['syncOriginateResponse']['bind'](this));ami['on'](_0xbba4('0x18'),this[_0xbba4('0x19')]['bind'](this));ami['on'](_0xbba4('0x1a'),this[_0xbba4('0x1b')][_0xbba4('0x1c')](this));ami['on'](_0xbba4('0x1d'),this[_0xbba4('0x1e')][_0xbba4('0x1c')](this));ami['on']('newexten',this[_0xbba4('0x1f')][_0xbba4('0x1c')](this));ami['on'](_0xbba4('0x20'),this[_0xbba4('0x21')][_0xbba4('0x1c')](this));ami['on'](_0xbba4('0x22'),this[_0xbba4('0x23')][_0xbba4('0x1c')](this));ami['on'](_0xbba4('0x24'),this[_0xbba4('0x25')]['bind'](this));this['loopCampaigns'](this[_0xbba4('0x26')]);}function emit(_0x3bc54b,_0x423417,_0x1db993){io['to'](_0x3bc54b)[_0xbba4('0x27')](_0x423417,_0x1db993);}function emitCampaignPreview(_0x3243a7){if(_0x3243a7[_0xbba4('0x28')]===_0xbba4('0x29')){var _0xb3a1d9={'id':_0x3243a7['id'],'name':_0x3243a7['name'],'strategy':_0x3243a7['strategy'],'answered':_0x3243a7[_0xbba4('0x2a')],'available':_0x3243a7[_0xbba4('0x2b')],'loggedIn':_0x3243a7[_0xbba4('0x2c')],'pTalking':_0x3243a7[_0xbba4('0x2d')],'sumBillable':_0x3243a7['sumBillable'],'sumDuration':_0x3243a7[_0xbba4('0x2e')],'sumHoldTime':_0x3243a7[_0xbba4('0x2f')]||0x0,'talking':_0x3243a7['talking'],'total':_0x3243a7[_0xbba4('0x30')],'type':_0x3243a7[_0xbba4('0x28')],'unmanaged':_0x3243a7[_0xbba4('0x31')],'abandoned':_0x3243a7[_0xbba4('0x32')],'waiting':_0x3243a7[_0xbba4('0x33')],'loggedInDb':_0x3243a7[_0xbba4('0x34')],'dialActive':_0x3243a7[_0xbba4('0x35')],'dialMethod':_0x3243a7[_0xbba4('0x36')],'dialOriginateCallerIdName':_0x3243a7[_0xbba4('0x37')],'dialOriginateCallerIdNumber':_0x3243a7[_0xbba4('0x38')],'dialOriginateTimeout':_0x3243a7[_0xbba4('0x39')],'dialPrefix':_0x3243a7[_0xbba4('0x3a')],'outboundAnswerAgiCallsDay':_0x3243a7[_0xbba4('0x3b')],'outboundAnswerCallsDay':_0x3243a7['outboundAnswerCallsDay'],'outboundBlacklistCallsDay':_0x3243a7[_0xbba4('0x3c')],'outboundBusyCallsDay':_0x3243a7[_0xbba4('0x3d')],'outboundCongestionCallsDay':_0x3243a7[_0xbba4('0x3e')],'outboundDropCallsDayACS':_0x3243a7[_0xbba4('0x3f')],'outboundDropCallsDayCallersExit':_0x3243a7[_0xbba4('0x40')],'outboundDropCallsDayTimeout':_0x3243a7[_0xbba4('0x41')],'outboundNoAnswerCallsDay':_0x3243a7[_0xbba4('0x42')],'outboundNoSuchCallsDay':_0x3243a7['outboundNoSuchCallsDay'],'outboundOriginateFailureCallsDay':_0x3243a7[_0xbba4('0x43')],'outboundReCallsDay':_0x3243a7[_0xbba4('0x44')],'outboundRejectCallsDay':_0x3243a7[_0xbba4('0x45')],'outboundUnknownCallsDay':_0x3243a7[_0xbba4('0x46')],'outboundAbandonedCallsDay':_0x3243a7['outboundAbandonedCallsDay'],'predictiveIntervalAnsweredCalls':_0x3243a7['predictiveIntervalAnsweredCalls'],'predictiveIntervalAvgHoldtime':_0x3243a7['predictiveIntervalAvgHoldtime'],'predictiveIntervalAvgTalktime':_0x3243a7[_0xbba4('0x47')],'predictiveIntervalDroppedCallsCallersExit':_0x3243a7[_0xbba4('0x48')],'predictiveIntervalDroppedCallsTimeout':_0x3243a7[_0xbba4('0x49')],'predictiveIntervalErlangCalls':_0x3243a7[_0xbba4('0x4a')],'predictiveIntervalErlangCallsDroppedCalls':_0x3243a7[_0xbba4('0x4b')],'predictiveIntervalHitRate':_0x3243a7[_0xbba4('0x4c')],'predictiveIntervalMultiplicativeFactor':_0x3243a7[_0xbba4('0x4d')],'predictiveIntervalPauses':_0x3243a7[_0xbba4('0x4e')],'predictiveIntervalAvailable':_0x3243a7[_0xbba4('0x4f')],'predictiveIntervalTotalCalls':_0x3243a7[_0xbba4('0x50')],'message':_0x3243a7['message'],'originated':_0x3243a7[_0xbba4('0x51')],'erlangCalls':_0x3243a7[_0xbba4('0x52')],'erlangCallToSecond':_0x3243a7[_0xbba4('0x53')],'erlangAbandonmentRate':_0x3243a7[_0xbba4('0x54')],'erlangBusyFactor':_0x3243a7[_0xbba4('0x55')],'startPredictive':_0x3243a7[_0xbba4('0x56')],'startProgressive':_0x3243a7['startProgressive']};if(_0x3243a7[_0xbba4('0x57')]){_0xb3a1d9[_0xbba4('0x57')]={'id':_0x3243a7['Trunk']['id'],'name':_0x3243a7[_0xbba4('0x57')][_0xbba4('0x58')],'active':_0x3243a7['Trunk'][_0xbba4('0x59')],'callerid':_0x3243a7[_0xbba4('0x57')]['callerid']};}if(_0x3243a7[_0xbba4('0x5a')]){_0xb3a1d9['Interval']={'id':_0x3243a7[_0xbba4('0x5a')]['id'],'name':_0x3243a7[_0xbba4('0x5a')][_0xbba4('0x58')]};}var _0x211b5e=md5(JSON[_0xbba4('0x5b')](_0xb3a1d9));if(_0x3243a7[_0xbba4('0x5c')]!==_0x211b5e){_0x3243a7[_0xbba4('0x5c')]=_0x211b5e;emit(util['format'](_0xbba4('0x5d'),_0xb3a1d9[_0xbba4('0x58')]),_0xbba4('0x5e'),_0xb3a1d9);}}}function emitVoiceQueueChannelRemove(_0x4537c8){logger['info'](_0xbba4('0x5f'),JSON[_0xbba4('0x5b')](_0x4537c8));emit(util[_0xbba4('0x60')](_0xbba4('0x5d'),_0x4537c8[_0xbba4('0x58')]),_0xbba4('0x61'),_0x4537c8);}function notSendMessagesQueue(_0x36b159){if(_0x36b159[_0xbba4('0x62')]){if(_0x36b159[_0xbba4('0x51')]===0x0&&_0x36b159['pTalking']===0x0){_0x36b159[_0xbba4('0x62')]=![];_0x36b159[_0xbba4('0x2b')]=0x0;_0x36b159[_0xbba4('0x63')]=0x0;_0x36b159[_0xbba4('0x64')]=_0xbba4('0x65');ut[_0xbba4('0x66')]('[CampaignPreview]\x20Campaign\x20Queue:\x20',_0x36b159[_0xbba4('0x58')]+_0xbba4('0x67'));}else{_0x36b159['message']=_0xbba4('0x68');ut[_0xbba4('0x66')]('[CampaignPreview]\x20Campaign\x20Queue:\x20',_0x36b159[_0xbba4('0x58')]+_0xbba4('0x69'));}emitCampaignPreview(_0x36b159);}}Preview[_0xbba4('0x6a')][_0xbba4('0x6b')]=function(){var _0x1ed9cc=this;setInterval(function(){_0x1ed9cc[_0xbba4('0x6c')]();},0x7cf);};Preview[_0xbba4('0x6a')][_0xbba4('0x6c')]=function(){var _0x558620=this[_0xbba4('0x26')];this['clockClearZombieChannels']+=0x1;for(var _0x30717d in _0x558620){if(_0x558620[_0xbba4('0x6d')](_0x30717d)&&(_0x558620[_0x30717d][_0xbba4('0x36')]===_0xbba4('0x5')||_0x558620[_0x30717d][_0xbba4('0x36')]===_0xbba4('0x6e'))&&_0x558620[_0x30717d]['type']===_0xbba4('0x29')){if(this[_0xbba4('0x16')]>0x7){this[_0xbba4('0x16')]=0x0;this[_0xbba4('0x6f')]();}}if(_0x558620[_0xbba4('0x6d')](_0x30717d)&&_0x558620[_0x30717d][_0xbba4('0x36')]===_0xbba4('0x5')&&_0x558620[_0x30717d][_0xbba4('0x28')]===_0xbba4('0x29')){if(_0x558620[_0x30717d][_0xbba4('0x35')]){this['setMessage'](_0x558620[_0x30717d]);this[_0xbba4('0x70')](_0x558620[_0x30717d]);}else{notSendMessagesQueue(_0x558620[_0x30717d]);}}}};Preview['prototype'][_0xbba4('0x71')]=function(_0x1dc1d1){var _0x3cd4df=this;this['sequence'][_0xbba4('0xe')](function(){if(!_['isNil'](_0x3cd4df['actions'][_0x1dc1d1])){loggerAction[_0xbba4('0x72')](_0xbba4('0x73'),_0x1dc1d1,'Queue',_0x3cd4df[_0xbba4('0x14')][_0x1dc1d1][_0xbba4('0x74')],_0xbba4('0x75'),JSON[_0xbba4('0x5b')](_0x3cd4df[_0xbba4('0x26')][_0x3cd4df[_0xbba4('0x14')][_0x1dc1d1][_0xbba4('0x74')]][_0xbba4('0x51')]),_0xbba4('0x76'),JSON[_0xbba4('0x5b')](_0x3cd4df[_0xbba4('0x26')][_0x3cd4df[_0xbba4('0x14')][_0x1dc1d1][_0xbba4('0x74')]][_0xbba4('0x2d')]),JSON[_0xbba4('0x5b')](_0x3cd4df['actions'][_0x1dc1d1][_0xbba4('0x77')]),JSON[_0xbba4('0x5b')](_[_0xbba4('0x78')](_0x3cd4df[_0xbba4('0x14')][_0x1dc1d1],[_0xbba4('0x79'),_0xbba4('0x7a'),_0xbba4('0x7b'),_0xbba4('0x7c')])));return ami[_0xbba4('0x7d')]({'action':_0xbba4('0x7e'),'channel':_0x3cd4df[_0xbba4('0x14')][_0x1dc1d1][_0xbba4('0x7f')]})['catch'](function(_0x24bbea){if(_0x24bbea[_0xbba4('0x64')]==='No\x20such\x20channel'){setTimeout(function(){if(_0x3cd4df['actions'][_0x1dc1d1]){ut[_0xbba4('0x80')](_0x3cd4df['campaignsPreview'][_0x3cd4df['actions'][_0x1dc1d1][_0xbba4('0x74')]],_0xbba4('0x81'));if(_0x3cd4df[_0xbba4('0x14')][_0x1dc1d1][_0xbba4('0x77')]===!![]){ut[_0xbba4('0x82')](_0x3cd4df[_0xbba4('0x26')][_0x3cd4df[_0xbba4('0x14')][_0x1dc1d1][_0xbba4('0x74')]],'[clearZombieChannel]');ut[_0xbba4('0x83')](_0xbba4('0x84')+_0x1dc1d1,_0x3cd4df[_0xbba4('0x14')][_0x1dc1d1][_0xbba4('0x74')]);}ut[_0xbba4('0x83')](_0xbba4('0x85')+_0x1dc1d1,_0x3cd4df[_0xbba4('0x14')][_0x1dc1d1][_0xbba4('0x74')]);delete _0x3cd4df['actions'][_0x1dc1d1];}},0x2328);}});}});};Preview[_0xbba4('0x6a')]['clearZombieChannels']=function(){var _0x2555cc=this;loggerAction['info']('[action]',_[_0xbba4('0x86')](this[_0xbba4('0x14')]));for(var _0x55a674 in this[_0xbba4('0x14')]){if(_0x2555cc['actions'][_0xbba4('0x6d')](_0x55a674)){_0x2555cc['clearZombieChannel'](_0x55a674);}}};Preview[_0xbba4('0x6a')][_0xbba4('0x70')]=function(_0x1258fe){var _0xb26d4d=this;rpcDb[_0xbba4('0x87')](_0x1258fe['id'],ut[_0xbba4('0x88')](this[_0xbba4('0x15')]))[_0xbba4('0x89')](function(_0x2a53a0){if(!_[_0xbba4('0x8a')](_0x2a53a0)){for(var _0x57247a=0x0;_0x57247a<_0x2a53a0[_0xbba4('0x8b')];_0x57247a+=0x1){if(ut['getDiff'](_0x2a53a0[_0x57247a][_0xbba4('0x8c')])<_0x1258fe[_0xbba4('0x8d')]*0x3c){if(_0x2a53a0[_0x57247a][_0xbba4('0x8e')]&&!_0x2a53a0[_0x57247a][_0xbba4('0x8e')][_0xbba4('0x8f')]){_0xb26d4d[_0xbba4('0x90')](_0x2a53a0[_0x57247a]['id'])[_0xbba4('0x89')](ut['logger2'](_0xbba4('0x91')))['catch'](ut['logger2'](_0xbba4('0x91')));}else{rpcDb[_0xbba4('0x92')](_0x2a53a0[_0x57247a]['id']);}}else{var _0x2a036f=new Action(_0x2a53a0[_0x57247a],_0x1258fe);_0x2a036f[_0xbba4('0x93')]=moment()[_0xbba4('0x60')](_0xbba4('0x94'));_0x1258fe[_0xbba4('0x44')]+=0x1;ut[_0xbba4('0x95')](_0x2a036f,0x17,_0xbba4('0x96'));if(_0x1258fe[_0xbba4('0x97')]){rpcDb['rescheduleContactInQueue'](ut[_0xbba4('0x98')](_0x2a53a0[_0x57247a]));rpcDb[_0xbba4('0x99')](_0x2a036f,_0xbba4('0x9a'));}else{ut['logCustomer'](_0x2a036f,0x16,_0xbba4('0x9b'));rpcDb[_0xbba4('0x99')](_0x2a036f,_0xbba4('0x9c'));rpcDb[_0xbba4('0x9d')](_0x2a036f,'[HistoryRecallClose]');}}}}})[_0xbba4('0x9e')](ut[_0xbba4('0x9f')]('[getContactRecallMe]'));};Preview['prototype'][_0xbba4('0xa0')]=function(_0x46c3f3){_0x46c3f3[_0xbba4('0x62')]=!![];if(ut[_0xbba4('0xa1')](_0x46c3f3[_0xbba4('0x2c')])){_0x46c3f3[_0xbba4('0x64')]=_0xbba4('0xa2');}else if(!ut['isActive'](_0x46c3f3[_0xbba4('0x35')])){_0x46c3f3[_0xbba4('0x64')]=_0xbba4('0x65');}else if(!this[_0xbba4('0xa3')](_0x46c3f3['Trunk'])){if(!this[_0xbba4('0xa3')](_0x46c3f3['TrunkBackup'])){_0x46c3f3[_0xbba4('0x64')]=_0xbba4('0xa4');}else{_0x46c3f3[_0xbba4('0x64')]=_0xbba4('0xa5');}}else{_0x46c3f3['message']='ACTIVE';}emitCampaignPreview(_0x46c3f3);};Preview[_0xbba4('0x6a')][_0xbba4('0xa6')]=function(_0x33bc12,_0x3750b8,_0x2789ee){var _0x4e9746=this;var _0x219037=this[_0xbba4('0x14')][_0x3750b8];var _0x382a77=this[_0xbba4('0x26')][_0x219037[_0xbba4('0x74')]];var _0x32ee02;if(_0x382a77){switch(_0x2789ee){case'1':_0x382a77[_0xbba4('0xa7')]+=0x1;_0x219037[_0xbba4('0xa8')]+=0x1;_0x219037[_0xbba4('0xa9')]=ut[_0xbba4('0xaa')](_0x219037);ut[_0xbba4('0x95')](_0x219037,0x0,_0xbba4('0xab'));ami['emit']('custom:agentnosuchnumber',ut[_0xbba4('0xac')](_0x219037,_0xbba4('0xad')));rpcDb[_0xbba4('0x99')](_0x219037,_0xbba4('0xae'));if(ut['totalGlobal'](_0x219037)>=_0x382a77[_0xbba4('0xaf')]){_0x32ee02=ut[_0xbba4('0xb0')](_0x219037,0xf,_0xbba4('0xb1'));rpcDb[_0xbba4('0x9d')](_0x32ee02,_0xbba4('0xb2'));}else{if(_0x219037[_0xbba4('0xa8')]>=_0x382a77[_0xbba4('0xb3')]){rpcDb['createCustomerFinal'](_0x219037,_0xbba4('0xb2'));}else{rpcDb[_0xbba4('0xb4')](ut[_0xbba4('0xb5')](_0x219037,_0xbba4('0xa8'),_0x382a77[_0xbba4('0xb6')]),_0x219037[_0xbba4('0xb7')],_0x219037[_0xbba4('0xb8')]);}}delete this[_0xbba4('0x14')][_0x33bc12['linkedid']];break;case'ANSWER':var _0x4e3006=moment()[_0xbba4('0x60')](_0xbba4('0x94'));_0x219037['responsetime']=_0x4e3006;_0x219037['answertime']=_0x4e3006;_0x219037[_0xbba4('0x77')]=!![];_0x382a77['pTalking']+=0x1;logger[_0xbba4('0x72')](_0xbba4('0xb9'),_0x219037[_0xbba4('0xba')],_0xbba4('0xbb'),_0x382a77[_0xbba4('0x58')],'pTalking:\x20',_0x382a77['pTalking']);ami[_0xbba4('0x27')]('custom:agentconnect',ut[_0xbba4('0xac')](_0x219037,_0xbba4('0xbc')));if(_0x382a77['acw']){ami['emit'](_0xbba4('0xbd'),ut[_0xbba4('0xbe')](_0x219037));}break;case'16':ami[_0xbba4('0x27')]('custom:agentcomplete',ut['buildObj'](_0x219037,_0xbba4('0xbf')));emitVoiceQueueChannelRemove(ut[_0xbba4('0xac')](_0x219037,'complete'));_0x382a77[_0xbba4('0xc0')]+=0x1;_0x382a77[_0xbba4('0x30')]+=0x1;_0x382a77[_0xbba4('0x2a')]+=0x1;ut[_0xbba4('0x82')](_0x382a77,'[16]');_0x219037[_0xbba4('0xa9')]=ut[_0xbba4('0xaa')](_0x219037);ut[_0xbba4('0x95')](_0x219037,0x4,_0xbba4('0xc1'));rpcDb[_0xbba4('0x99')](_0x219037,_0xbba4('0xc2'));rpcDb[_0xbba4('0x9d')](_0x219037,'[callProgressDetectingCustomer][logAnswerGlobal]');rpcDb[_0xbba4('0xc3')](_0x219037);_0x382a77[_0xbba4('0x2e')]+=_0x219037[_0xbba4('0xc4')];_0x382a77[_0xbba4('0xc5')]+=_0x219037['talktime'];logger[_0xbba4('0x72')]('[syncHangup][talking][decrement]',_0x219037[_0xbba4('0xba')],_0xbba4('0xbb'),_0x382a77[_0xbba4('0x58')],_0xbba4('0x76'),_0x382a77[_0xbba4('0x2d')]);delete this[_0xbba4('0x14')][_0x33bc12['linkedid']];break;case _0xbba4('0xc6'):_0x382a77[_0xbba4('0x3d')]+=0x1;_0x219037[_0xbba4('0xc7')]+=0x1;_0x219037['countglobal']=ut[_0xbba4('0xaa')](_0x219037);ut[_0xbba4('0x95')](_0x219037,0x5,_0xbba4('0xc8'));ami[_0xbba4('0x27')]('custom:agentbusy',ut[_0xbba4('0xac')](_0x219037,_0xbba4('0xc9')));rpcDb[_0xbba4('0x99')](_0x219037,_0xbba4('0xca'));if(ut[_0xbba4('0xaa')](_0x219037)>=_0x382a77[_0xbba4('0xaf')]){_0x32ee02=ut['cloneAction'](_0x219037,0xf,'Global');rpcDb[_0xbba4('0x9d')](_0x32ee02,'[callProgressDetectingCustomer][logBusyGlobal]');}else{if(_0x219037[_0xbba4('0xc7')]>=_0x382a77['dialBusyMaxRetry']){rpcDb[_0xbba4('0x9d')](_0x219037,_0xbba4('0xca'));}else{rpcDb[_0xbba4('0xb4')](ut[_0xbba4('0xb5')](_0x219037,_0xbba4('0xc7'),_0x382a77['dialBusyRetryFrequency']),_0x219037[_0xbba4('0xb7')],_0x219037[_0xbba4('0xb8')]);}}break;case _0xbba4('0xcb'):_0x382a77['outboundNoAnswerCallsDay']+=0x1;_0x219037['countnoanswerretry']+=0x1;_0x219037['countglobal']=ut[_0xbba4('0xaa')](_0x219037);ut[_0xbba4('0x95')](_0x219037,0x3,_0xbba4('0xcc'));ami['emit']('custom:agentnoanswer',ut[_0xbba4('0xac')](_0x219037,_0xbba4('0xcd')));rpcDb[_0xbba4('0x99')](_0x219037,'[callProgressDetectingCustomer][logNoAnswer]');if(ut[_0xbba4('0xaa')](_0x219037)>=_0x382a77[_0xbba4('0xaf')]){_0x32ee02=ut[_0xbba4('0xb0')](_0x219037,0xf,_0xbba4('0xb1'));rpcDb[_0xbba4('0x9d')](_0x32ee02,'[callProgressDetectingCustomer][logNoAnswerGlobal]');}else{if(_0x219037[_0xbba4('0xce')]>=_0x382a77[_0xbba4('0xcf')]){rpcDb['createCustomerFinal'](_0x219037,_0xbba4('0xd0'));}else{rpcDb[_0xbba4('0xb4')](ut[_0xbba4('0xb5')](_0x219037,'countnoanswerretry',_0x382a77[_0xbba4('0xd1')]),_0x219037[_0xbba4('0xb7')],_0x219037[_0xbba4('0xb8')]);}}break;case _0xbba4('0xd2'):_0x382a77[_0xbba4('0x3e')]+=0x1;_0x219037[_0xbba4('0xd3')]+=0x1;_0x219037[_0xbba4('0xa9')]=ut[_0xbba4('0xaa')](_0x219037);ut[_0xbba4('0x95')](_0x219037,0x8,_0xbba4('0xd4'));ami[_0xbba4('0x27')](_0xbba4('0xd5'),ut[_0xbba4('0xac')](_0x219037,_0xbba4('0xd6')));rpcDb[_0xbba4('0x99')](_0x219037,_0xbba4('0xd7'));if(ut[_0xbba4('0xaa')](_0x219037)>=_0x382a77['dialGlobalMaxRetry']){_0x32ee02=ut[_0xbba4('0xb0')](_0x219037,0xf,'Global');rpcDb[_0xbba4('0x9d')](_0x32ee02,_0xbba4('0xd8'));}else{if(_0x219037[_0xbba4('0xd3')]>=_0x382a77['dialCongestionMaxRetry']){rpcDb[_0xbba4('0x9d')](_0x219037,'[callProgressDetectingCustomer][logCongestion]');}else{rpcDb[_0xbba4('0xb4')](ut[_0xbba4('0xb5')](_0x219037,_0xbba4('0xd3'),_0x382a77[_0xbba4('0xd9')]),_0x219037['unlockAgent'],_0x219037['activeContact']);}}break;case'CANCEL':_0x382a77[_0xbba4('0x45')]+=0x1;_0x219037[_0xbba4('0xda')]+=0x1;_0x219037[_0xbba4('0xa9')]=ut[_0xbba4('0xaa')](_0x219037);ut['logCustomer'](_0x219037,0x14,_0xbba4('0xdb'));ami[_0xbba4('0x27')](_0xbba4('0xdc'),ut['buildObj'](_0x219037,_0xbba4('0xdd')));rpcDb[_0xbba4('0x99')](_0x219037,_0xbba4('0xde'));if(ut['totalGlobal'](_0x219037)>=_0x382a77[_0xbba4('0xaf')]){_0x32ee02=ut['cloneAction'](_0x219037,0x14,_0xbba4('0xdb'));rpcDb['createCustomerFinal'](_0x32ee02,_0xbba4('0xdf'));}else{if(_0x219037[_0xbba4('0xda')]>=_0x382a77[_0xbba4('0xe0')]){rpcDb[_0xbba4('0x9d')](_0x219037,_0xbba4('0xdf'));}else{rpcDb[_0xbba4('0xb4')](ut['scheduledAt'](_0x219037,_0xbba4('0xda'),_0x382a77['dialAgentRejectRetryFrequency']),_0x219037[_0xbba4('0xb7')],_0x219037[_0xbba4('0xb8')]);}}break;case _0xbba4('0xe1'):_0x382a77[_0xbba4('0xe2')]+=0x1;_0x219037[_0xbba4('0xe3')]+=0x1;_0x219037[_0xbba4('0xa9')]=ut['totalGlobal'](_0x219037);ut['logCustomer'](_0x219037,0xb,'Abandoned');rpcDb[_0xbba4('0x99')](_0x219037,'[callProgressDetectingCustomer][logAbandoned]');if(ut[_0xbba4('0xaa')](_0x219037)>=_0x382a77[_0xbba4('0xaf')]){_0x32ee02=ut[_0xbba4('0xb0')](_0x219037,0xf,_0xbba4('0xb1'));rpcDb[_0xbba4('0x9d')](_0x32ee02,_0xbba4('0xe4'));}else{if(_0x219037[_0xbba4('0xe5')]>=_0x382a77['dialAbandonedMaxRety']){rpcDb[_0xbba4('0x9d')](_0x219037,'[callProgressDetectingCustomer][logAbandoned]');}else{rpcDb[_0xbba4('0xb4')](ut['scheduledAt'](_0x219037,_0xbba4('0xe3'),_0x382a77['dialAbandonedRetryFrequency']),_0x219037['unlockAgent'],_0x219037[_0xbba4('0xb8')]);}}break;default:if(_0x219037['dialAnswer']){ut[_0xbba4('0x82')](_0x382a77,'[default]');ut['loggerError'](_0xbba4('0xe6')+_0x382a77[_0xbba4('0x58')],_0x33bc12);}_0x382a77[_0xbba4('0x46')]+=0x1;_0x219037[_0xbba4('0xa9')]=ut[_0xbba4('0xaa')](_0x219037);ut[_0xbba4('0x95')](_0x219037,0xc,_0x33bc12[_0xbba4('0xe7')]||_0x33bc12[_0xbba4('0xe8')]);rpcDb['createCustomerHistory'](_0x219037,_0xbba4('0xe9'));if(ut[_0xbba4('0xaa')](_0x219037)>=_0x382a77[_0xbba4('0xaf')]){_0x32ee02=ut['cloneAction'](_0x219037,0xf,_0xbba4('0xb1'));rpcDb[_0xbba4('0x9d')](_0x32ee02,_0xbba4('0xea'));}else{rpcDb[_0xbba4('0x9d')](_0x219037,_0xbba4('0xea'));}delete this['actions'][_0x33bc12[_0xbba4('0xeb')]];}if(!(_0x219037[_0xbba4('0x77')]&&_0x2789ee==='16')){ut[_0xbba4('0x80')](_0x382a77,_0xbba4('0xec'));logger['info'](_0xbba4('0xed'),_0x219037[_0xbba4('0xba')],'\x20Queue',_0x382a77[_0xbba4('0x58')],_0xbba4('0x75'),_0x382a77[_0xbba4('0x51')]);}if(_0x2789ee!==_0xbba4('0xee')){delete this[_0xbba4('0x14')][_0x33bc12[_0xbba4('0xeb')]];delete this['actions'][_0x33bc12[_0xbba4('0xef')]];}}};Preview[_0xbba4('0x6a')][_0xbba4('0xf0')]=function(_0x5c3bfd,_0x1d83e3,_0x5962bc){if(_[_0xbba4('0xf1')](_0x1d83e3)&&_0xbba4('0xf2')!==typeof _0x1d83e3){return;}if(_[_0xbba4('0xf1')](_0x5962bc)&&_0xbba4('0xf2')!==typeof _0x5962bc){return;}switch(_0x5962bc['reason']){case'0':ut[_0xbba4('0xf3')](_0x5c3bfd,0x0,_0xbba4('0xab'));rpcDb['createAgentHistory'](_0x5c3bfd,_0xbba4('0xf4'));break;case'3':ut['logAgent'](_0x5c3bfd,0x3,'NoAnswer');rpcDb[_0xbba4('0xf5')](_0x5c3bfd,_0xbba4('0xf6'));break;case'5':ut['logAgent'](_0x5c3bfd,0x5,'Busy');rpcDb[_0xbba4('0xf5')](_0x5c3bfd,_0xbba4('0xf7'));break;case'8':ut[_0xbba4('0xf3')](_0x5c3bfd,0x8,_0xbba4('0xd4'));rpcDb[_0xbba4('0xf5')](_0x5c3bfd,_0xbba4('0xf8'));break;case'22':ut['logAgent'](_0x5c3bfd,0x16,_0xbba4('0xf9'));rpcDb[_0xbba4('0xf5')](_0x5c3bfd,'[callProgressDetectingAgent][logAnswerAGI]');break;default:ut[_0xbba4('0xf3')](_0x5c3bfd,0xc,_0x5962bc[_0xbba4('0xfa')]);rpcDb['createAgentHistory'](_0x5c3bfd,'[callProgressDetectingAgent][logCongestion]');}ut[_0xbba4('0x80')](_0x1d83e3,'[callProgressDetectingAgent]');logger[_0xbba4('0x72')](_0xbba4('0xfb'),_0x5c3bfd[_0xbba4('0xba')],_0xbba4('0xbb'),_0x1d83e3[_0xbba4('0x58')],_0xbba4('0x75'),_0x1d83e3['originated']);delete this[_0xbba4('0x14')][_0x5c3bfd[_0xbba4('0xba')]];};Preview[_0xbba4('0x6a')][_0xbba4('0xfc')]=function(_0x4089c0,_0x3506b2,_0x58dac2,_0xfe1516,_0x12b653){var _0x242511=this;return new BPromise(function(_0x3b0332,_0x5b3c59){if(_[_0xbba4('0x8a')](_0x3506b2)||_[_0xbba4('0x8a')](_0x3506b2['Contact'])||_['isNil'](_0x3506b2[_0xbba4('0xfd')][_0xbba4('0xfe')])||_[_0xbba4('0x8a')](_0x3506b2['VoiceQueueId'])){_0x5b3c59(ut[_0xbba4('0x64')](_0xbba4('0xff'),_0xfe1516,_0x12b653));return;}var _0x4803de=uuid['v4']();var _0x39683d=_0x242511[_0xbba4('0x26')][_0x3506b2[_0xbba4('0x100')][_0xbba4('0x58')]];var _0x54e2b7=_0x58dac2?_0x242511[_0xbba4('0x15')][_0x58dac2]['id']:undefined;_0x242511[_0xbba4('0x14')][_0x4803de]=new Action(_0x3506b2,_0x39683d,_0x4803de,_0x58dac2,_0x54e2b7);var _0x378aee=_0x242511[_0xbba4('0x14')][_0x4803de];_0x378aee['unlockAgent']=_0xfe1516;_0x378aee[_0xbba4('0xb8')]=_0x12b653;_0x378aee['lookAgent']=_0x58dac2;if(_[_0xbba4('0x101')](_0x4089c0)){_0x242511[_0xbba4('0x102')](_0x378aee,_0x39683d,_0x3506b2,_0x58dac2)[_0xbba4('0x89')](function(_0x5eba97){logger[_0xbba4('0x72')](_0xbba4('0x103'),'Queue:\x20'+_0x378aee[_0xbba4('0x74')]+_0xbba4('0x104')+_0x378aee[_0xbba4('0x105')],JSON[_0xbba4('0x5b')](_0x5eba97));ami[_0xbba4('0x27')](_0xbba4('0x106'),ut[_0xbba4('0xac')](_0x378aee,'called'));_0x3b0332(ut[_0xbba4('0x64')]('Calling'));})['catch'](function(_0x16c849){ut['logger'](_0xbba4('0x107'),_0x16c849);_0x5b3c59(ut[_0xbba4('0x64')](_0xbba4('0x108'),_0xfe1516,_0x12b653));});}else{_0x39683d[_0xbba4('0x3c')]+=0x1;ut['logBlacklist'](_0x378aee);rpcDb[_0xbba4('0x109')](_0x378aee,_0xbba4('0x10a'));delete _0x242511[_0xbba4('0x14')][_0x4803de];_0x5b3c59(ut[_0xbba4('0x64')]('Contact\x20in\x20black\x20List',_0xfe1516,_0x12b653));}});};Preview[_0xbba4('0x6a')][_0xbba4('0xa3')]=function(_0x400491){return!_[_0xbba4('0x8a')](_0x400491)&&!_[_0xbba4('0x8a')](_0x400491[_0xbba4('0x58')])&&!_[_0xbba4('0x8a')](_0x400491[_0xbba4('0x59')])&&_0x400491[_0xbba4('0x59')]&&!_['isNil'](this[_0xbba4('0x13')][util[_0xbba4('0x60')](_0xbba4('0x10b'),_0x400491[_0xbba4('0x58')])])&&!_['isNil'](this[_0xbba4('0x13')][util[_0xbba4('0x60')](_0xbba4('0x10b'),_0x400491[_0xbba4('0x58')])]['status'])&&(this[_0xbba4('0x13')][util[_0xbba4('0x60')](_0xbba4('0x10b'),_0x400491[_0xbba4('0x58')])][_0xbba4('0x7e')]===_0xbba4('0x10c')||this['trunks'][util['format']('SIP/%s',_0x400491['name'])]['status']==='unmonitored');};Preview[_0xbba4('0x6a')][_0xbba4('0x90')]=function(_0x27149e,_0x34cc1e){var _0x32d0d6=this;return new BPromise(function(_0xf913,_0x132154){_0x32d0d6['execRun'](_0x27149e,_0x34cc1e)[_0xbba4('0x89')](function(_0x454d47){_0xf913(_[_0xbba4('0x78')](_0x454d47,[_0xbba4('0x64')]));})[_0xbba4('0x9e')](function(_0x322ec4){if(_0x322ec4[_0xbba4('0x10d')]){rpcDb[_0xbba4('0x10e')](_0x27149e);}if(_0x322ec4['active']){rpcDb['disableContact'](_0x27149e);}_0x132154(_[_0xbba4('0x78')](_0x322ec4,[_0xbba4('0x64')]));});});};Preview[_0xbba4('0x6a')][_0xbba4('0x10f')]=function(_0xdf0648,_0x404ec3){var _0x210b2b=this;return new BPromise(function(_0x4b47da,_0x39c948){var _0x133f1f,_0x4cf012;rpcDb[_0xbba4('0x110')](_0xdf0648)[_0xbba4('0x89')](function(_0xb69459){if(!_['isNil'](_0xb69459[0x0])){_0x4cf012=_0xb69459[0x0]['recallme']?![]:!![];_0x133f1f=_0xb69459[0x0][_0xbba4('0x111')]?!![]:![];_0x133f1f=_0x404ec3?!![]:_0x133f1f;}var _0x3eb613=_0x210b2b[_0xbba4('0x112')](_0xb69459);if(_0x3eb613[_0xbba4('0x113')]){rpcDb[_0xbba4('0x114')](_[_0xbba4('0x78')](_0xb69459[0x0],[_0xbba4('0x7b'),_0xbba4('0x115')]))[_0xbba4('0x89')](function(_0x40bdf0){_0x210b2b[_0xbba4('0xfc')](_0x40bdf0,_0xb69459[0x0],_0x404ec3,_0x4cf012,_0x133f1f)[_0xbba4('0x89')](function(_0x4d998a){_0x4b47da(_0x4d998a);})[_0xbba4('0x9e')](function(_0x1dc281){_0x39c948(_0x1dc281);});})[_0xbba4('0x9e')](function(_0x934c2d){ut['logger'](_0xbba4('0x116'),_0x934c2d);_0x39c948(ut[_0xbba4('0x64')](_0xbba4('0x117'),_0x4cf012,_0x133f1f));});}else{_0x39c948(ut['message'](_0x3eb613['message'],_0x4cf012,_0x133f1f));}})['catch'](function(_0x47eac5){ut['logger'](_0xbba4('0x118'),_0x47eac5);_0x39c948(ut[_0xbba4('0x64')](_0xbba4('0x117'),![],!![]));});});};Preview['prototype'][_0xbba4('0x112')]=function(_0x21edf1){if(_['isNil'](_0x21edf1)||_[_0xbba4('0x101')](_0x21edf1)||!_[_0xbba4('0x8a')](_0x21edf1[0x0][_0xbba4('0x8e')])&&_[_0xbba4('0x8a')](_0x21edf1[0x0][_0xbba4('0x8e')][_0xbba4('0x58')])){ut['logger'](_0xbba4('0x119'),_0x21edf1);return{'isValid':![],'message':_0xbba4('0x11a')};}var _0x5eb92a=this[_0xbba4('0x26')][_0x21edf1[0x0][_0xbba4('0x100')][_0xbba4('0x58')]];_0x5eb92a[_0xbba4('0x64')]='ACTIVE';if(_[_0xbba4('0x8a')](_0x5eb92a)){ut[_0xbba4('0x66')]('[Preview][validateContact][Empty\x20Campaign]',_0x5eb92a);return{'isValid':![],'message':_0xbba4('0x11b')};}if(!this[_0xbba4('0xa3')](_0x5eb92a[_0xbba4('0x57')])){ut['logger'](_0xbba4('0x11c'),_0xbba4('0x11d')+_0x5eb92a[_0xbba4('0x58')]+'\x20Trunk\x20is\x20not\x20active');if(!this[_0xbba4('0xa3')](_0x5eb92a['TrunkBackup'])){ut[_0xbba4('0x66')]('[Preview][validateContact][Trunk\x20not\x20work]',_0x5eb92a['name']+_0xbba4('0x11e'));return{'isValid':![],'message':_0xbba4('0x11f')};}}if(!ut['isActive'](_0x5eb92a['dialActive'])){ut[_0xbba4('0x66')](_0xbba4('0x120'),_0x5eb92a['name']+_0xbba4('0x121'));return{'isValid':![],'message':_0xbba4('0x11d')+_0x5eb92a[_0xbba4('0x58')]+_0xbba4('0x121')};}return{'isValid':!![],'message':_0xbba4('0x122')};};Preview[_0xbba4('0x6a')][_0xbba4('0x102')]=function(_0x2e6c8b,_0x2c8343,_0x1cbc53,_0x535a43){var _0x2093fa=this;return new BPromise(function(_0x186a86,_0x9bc490){var _0x2dd617=_0x2e6c8b[_0xbba4('0xba')];var _0x465ce0=_0x2093fa[_0xbba4('0xa3')](_0x2c8343[_0xbba4('0x57')])?util[_0xbba4('0x60')](_0xbba4('0x123'),_0x2c8343[_0xbba4('0x57')]['name'],_[_0xbba4('0x8a')](_0x2c8343[_0xbba4('0x3a')])?'':_0x2c8343[_0xbba4('0x3a')]['trim']()||'',_0x2c8343['dialCutDigit']>0x0?_0x1cbc53[_0xbba4('0xfd')][_0xbba4('0xfe')][_0xbba4('0x124')](_0x2c8343[_0xbba4('0x125')]):_0x1cbc53[_0xbba4('0xfd')][_0xbba4('0xfe')]):util[_0xbba4('0x60')](_0xbba4('0x123'),_['isNil'](_0x2c8343[_0xbba4('0x126')])?_0x2c8343[_0xbba4('0x57')][_0xbba4('0x58')]:_0x2c8343['TrunkBackup'][_0xbba4('0x58')],_[_0xbba4('0x8a')](_0x2c8343['dialPrefix'])?'':_0x2c8343['dialPrefix'][_0xbba4('0x127')]()||'',_0x2c8343[_0xbba4('0x125')]>0x0?_0x1cbc53['Contact']['phone'][_0xbba4('0x124')](_0x2c8343[_0xbba4('0x125')]):_0x1cbc53[_0xbba4('0xfd')][_0xbba4('0xfe')]);var _0x1d92d3=_0x2093fa[_0xbba4('0xa3')](_0x2c8343['Trunk'])?ut[_0xbba4('0x128')](_0x2c8343[_0xbba4('0x57')][_0xbba4('0x129')],_0x2c8343[_0xbba4('0x37')],_0x2c8343[_0xbba4('0x12a')]>0x0?ut[_0xbba4('0x12b')](_0x2c8343[_0xbba4('0x38')],_0x2c8343['dialRandomLastDigitCallerIdNumber']):_0x2c8343[_0xbba4('0x38')]):ut['getCallerId'](_[_0xbba4('0x8a')](_0x2c8343[_0xbba4('0x126')])?_0x2c8343[_0xbba4('0x57')][_0xbba4('0x129')]:_0x2c8343[_0xbba4('0x126')]['callerid'],_0x2c8343['dialOriginateCallerIdName'],_0x2c8343[_0xbba4('0x12a')]>0x0?ut[_0xbba4('0x12b')](_0x2c8343['dialOriginateCallerIdNumber'],_0x2c8343[_0xbba4('0x12a')]):_0x2c8343[_0xbba4('0x38')]);if(_0x1d92d3){_0x2e6c8b[_0xbba4('0x12c')]=ut['extractCalleridName'](_0x1d92d3);_0x2e6c8b[_0xbba4('0x12d')]=ut[_0xbba4('0x12e')](_0x1d92d3);}var _0x265313=ut[_0xbba4('0x12f')](_0x2c8343,_0x1cbc53,_0x465ce0,_0x1d92d3,_0x2dd617,_0x2e6c8b);_[_0xbba4('0x130')](_0x2e6c8b,ut['toLowerVariables'](_0x265313));_0x2e6c8b[_0xbba4('0x93')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');ami[_0xbba4('0x7d')](ut['variablesAction'](_0x2e6c8b,_0x2c8343,_0x265313,_0x2e6c8b['activeContact'],_0x535a43))['then'](function(_0x1e8214){_0x2c8343[_0xbba4('0x51')]+=0x1;logger[_0xbba4('0x72')](_0xbba4('0x131'),_0x2dd617,'\x20Queue',_0x2c8343[_0xbba4('0x58')],_0xbba4('0x75'),_0x2c8343['originated']);_0x186a86(_0x1e8214);})['catch'](function(_0x2ee4df){ut[_0xbba4('0xf3')](_0x2e6c8b,0xe,_0xbba4('0x132'));rpcDb[_0xbba4('0xf5')](_0x2e6c8b,_0xbba4('0x133'));_0x9bc490(_0x2ee4df);});});};Preview[_0xbba4('0x6a')][_0xbba4('0x1f')]=function(_0x34e6a5){if(this[_0xbba4('0x14')][_0x34e6a5['linkedid']]){this[_0xbba4('0x14')][_0x34e6a5[_0xbba4('0xeb')]][_0xbba4('0x7f')]=_0x34e6a5[_0xbba4('0x7f')];}};Preview[_0xbba4('0x6a')][_0xbba4('0x134')]=function(_0x21bdcc){var _0x3e908a=this;var _0x43af97=this[_0xbba4('0x14')][_0x21bdcc[_0xbba4('0x135')]];if(_0x43af97){if(_0x43af97['lookAgent']&&this['agents'][_0x43af97[_0xbba4('0x136')]]){ut['logLookAgent'](_0x43af97,this[_0xbba4('0x15')][_0x43af97['lookAgent']]['name'],this[_0xbba4('0x15')][_0x43af97[_0xbba4('0x136')]]['id']);}var _0x8c97e0=_[_0xbba4('0x137')](_0x43af97);_0x8c97e0[_0xbba4('0x138')]=moment()[_0xbba4('0x60')]('YYYY-MM-DD\x20HH:mm:ss');var _0x395e1b=_0x3e908a['campaignsPreview'][_0x43af97[_0xbba4('0x74')]];if(ut[_0xbba4('0x139')](_0x21bdcc['response'])){if(_0x43af97[_0xbba4('0xb7')]){rpcDb[_0xbba4('0x10e')](_0x43af97[_0xbba4('0x105')]);}if(_0x43af97[_0xbba4('0xb8')]){rpcDb[_0xbba4('0x92')](_0x43af97['idContact']);}ami[_0xbba4('0x27')]('custom:agentringnoanswer',ut['buildObj'](_0x43af97,'rejected'));this[_0xbba4('0xf0')](_0x8c97e0,_0x395e1b,_0x21bdcc);}else{_0x43af97['starttime']=moment()[_0xbba4('0x60')](_0xbba4('0x94'));ut[_0xbba4('0xf3')](_0x8c97e0,0x4,_0xbba4('0xc1'));rpcDb[_0xbba4('0xf5')](_0x8c97e0,_0xbba4('0x13a'));}}};Preview[_0xbba4('0x6a')][_0xbba4('0x19')]=function(_0x4ca9ae){var _0x52a16d=this;var _0x3401f7=this[_0xbba4('0x14')][_0x4ca9ae[_0xbba4('0xeb')]];var _0xfb5caf;if(_0x3401f7){_0xfb5caf=this[_0xbba4('0x26')][_0x3401f7['queue']];logger[_0xbba4('0x72')]('[syncHangup][talking]',_0x4ca9ae['linkedid'],_0xbba4('0xbb'),_0xfb5caf[_0xbba4('0x58')],_0xbba4('0x76'),_0xfb5caf[_0xbba4('0x2d')]);}if(this[_0xbba4('0x14')][_0x4ca9ae[_0xbba4('0xeb')]]&&_0x4ca9ae[_0xbba4('0xeb')]!==_0x4ca9ae[_0xbba4('0xba')]){if(_0x4ca9ae[_0xbba4('0x13b')]==='16'&&this[_0xbba4('0x14')][_0x4ca9ae[_0xbba4('0xeb')]]['dialAnswer']){this['callProgressDetectingCustomer'](_0x4ca9ae,_0x4ca9ae[_0xbba4('0xeb')],_0x4ca9ae[_0xbba4('0x13b')]);}else if(this[_0xbba4('0x14')][_0x4ca9ae[_0xbba4('0xeb')]][_0xbba4('0x77')]){logger[_0xbba4('0x72')](_0xbba4('0x13c'),_0x4ca9ae[_0xbba4('0xeb')],_0x4ca9ae[_0xbba4('0x13b')],_0xbba4('0xbb'),_0xfb5caf[_0xbba4('0x58')],_0xbba4('0x76'),_0xfb5caf[_0xbba4('0x2d')]);this[_0xbba4('0xa6')](_0x4ca9ae,_0x4ca9ae[_0xbba4('0xeb')],_0x4ca9ae[_0xbba4('0x13b')]);}}else if(_0x3401f7&&_[_0xbba4('0x8a')](_0x3401f7['statedesc'])&&_0xfb5caf['dialQueueProject']&&_0x4ca9ae['linkedid']===_0x4ca9ae[_0xbba4('0xba')]&&_[_0xbba4('0x8a')](_0x4ca9ae['reason'])&&_0x4ca9ae['cause']==='16'&&_0x4ca9ae[_0xbba4('0x13d')]==='6'&&_[_0xbba4('0xf1')](_0x3401f7[_0xbba4('0x13e')])){if(_0x3401f7[_0xbba4('0xb7')]){rpcDb[_0xbba4('0x10e')](_0x3401f7['idContact']);}if(_0x3401f7['activeContact']){rpcDb[_0xbba4('0x92')](_0x3401f7['idContact']);}_0x4ca9ae[_0xbba4('0xfa')]='22';this[_0xbba4('0xf0')](_0x3401f7,_0xfb5caf,_0x4ca9ae);}else if(_0x3401f7&&_0x3401f7['transfer']){if(_0x4ca9ae['cause']==='16'&&this[_0xbba4('0x14')][_0x4ca9ae[_0xbba4('0xeb')]][_0xbba4('0x77')]){logger[_0xbba4('0x72')](_0xbba4('0x13f'),_0x4ca9ae[_0xbba4('0xeb')],_0x4ca9ae['cause'],'\x20Queue',_0xfb5caf[_0xbba4('0x58')],_0xbba4('0x76'),_0xfb5caf[_0xbba4('0x2d')]);this[_0xbba4('0xa6')](_0x4ca9ae,_0x4ca9ae[_0xbba4('0xeb')],_0x4ca9ae[_0xbba4('0x13b')]);}else if(this[_0xbba4('0x14')][_0x4ca9ae[_0xbba4('0xeb')]][_0xbba4('0x77')]){logger['info'](_0xbba4('0x13c'),_0x4ca9ae['linkedid'],_0x4ca9ae[_0xbba4('0x13b')],'\x20Queue',_0xfb5caf[_0xbba4('0x58')],_0xbba4('0x76'),_0xfb5caf['pTalking']);this[_0xbba4('0xa6')](_0x4ca9ae,_0x4ca9ae[_0xbba4('0xeb')],_0x4ca9ae[_0xbba4('0x13b')]);}}};Preview[_0xbba4('0x6a')][_0xbba4('0x1e')]=function(_0x9cd099){if(this[_0xbba4('0x14')][_0x9cd099['destlinkedid']]&&_0x9cd099['destlinkedid']!==_0x9cd099[_0xbba4('0x140')]){this[_0xbba4('0xa6')](_0x9cd099,_0x9cd099[_0xbba4('0xef')],_0x9cd099[_0xbba4('0xe8')]);}};Preview[_0xbba4('0x6a')][_0xbba4('0x1b')]=function(_0x465b45){if(this['actions'][_0x465b45[_0xbba4('0xeb')]]&&_0x465b45[_0xbba4('0xeb')]!==_0x465b45[_0xbba4('0xba')]&&!this['actions'][_0x465b45[_0xbba4('0xeb')]][_0xbba4('0x77')]){if(_0x465b45[_0xbba4('0x13b')]==='1'){this['callProgressDetectingCustomer'](_0x465b45,_0x465b45[_0xbba4('0xeb')],_0x465b45['cause']);}}};Preview['prototype'][_0xbba4('0x141')]=function(_0x56253,_0x22a2a7,_0x302875){if(this[_0xbba4('0x14')][_0x56253]){if(_[_0xbba4('0x8a')](this[_0xbba4('0x14')][_0x56253][_0xbba4('0x142')])){this['actions'][_0x56253][_0xbba4('0x142')]={};}this[_0xbba4('0x14')][_0x56253][_0xbba4('0x142')][_0x22a2a7]=_0x302875;}};Preview[_0xbba4('0x6a')][_0xbba4('0x21')]=function(_0x2181ce){try{if(!_[_0xbba4('0x8a')](_0x2181ce)){if(ut[_0xbba4('0x143')](_[_0xbba4('0x144')](_0x2181ce[_0xbba4('0x145')])[0x0])){this[_0xbba4('0x141')](_0x2181ce[_0xbba4('0xba')],_[_0xbba4('0x144')](_0x2181ce['variable'])[0x0],_0x2181ce['value']);}}}catch(_0x361373){logger[_0xbba4('0x146')](_0xbba4('0x147'),util['inspect'](_0x361373,{'showHidden':![],'depth':null}));}};Preview['prototype']['syncAttendedTransfer']=function(_0x560860){if(_0x560860){if(this[_0xbba4('0x14')][_0x560860[_0xbba4('0x148')]]){this[_0xbba4('0x14')][_0x560860['transfertargetlinkedid']][_0xbba4('0x13e')]=!![];}}};Preview['prototype'][_0xbba4('0x25')]=function(_0x5062fb){if(_0x5062fb){if(this[_0xbba4('0x14')][_0x5062fb[_0xbba4('0x149')]]){this[_0xbba4('0x14')][_0x5062fb['transfererlinkedid']]['transfer']=!![];}}};module[_0xbba4('0x14a')]=Preview; \ No newline at end of file +var _0xc462=['custom:agentringnoanswer','rejected','[callProgressDetectingAgent][logAnswer]','[syncHangup][talking]','cause','dialQueueProject','channelstate','transfer','[syncHangup][talking][transfer]','[syncHangup][talking][cause]','destlinkedid','destuniqueid','addVariable','variables','syncVarSet','filterKey','keys','error','[syncVarSet][Preview]','inspect','transfertargetlinkedid','transfererlinkedid','util','lodash','bluebird','uuid','moment','md5','ioredis','../../../config/logger','preview','actionPreview','./rpcDb','./action','./util/util','defaults','redis','socket.io-emitter','enqueue','tail','finally','sequence','campaignsPreview','voiceQueues','trunks','actions','agents','clockClearZombieChannels','bind','hangup','syncHangup','syncHangupRequest','dialend','syncDialEnd','newexten','varset','attendedtransfer','syncAttendedTransfer','syncBlindTransfer','loopCampaigns','emit','type','outbound','name','answered','available','loggedIn','sumBillable','sumHoldTime','talking','total','abandoned','dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateTimeout','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundReCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','outboundAbandonedCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalAvailable','predictiveIntervalTotalCalls','message','originated','erlangCalls','erlangAbandonmentRate','startPredictive','startProgressive','Trunk','active','Interval','format','voice_queue:save','info','[DEBUG]\x20Emit\x20voice_queue_channel:remove\x20event','stringify','voice:queue:%s','voice_queue_channel:remove','pTalking','sendMessageOneNotActive','paused','logger','[CampaignPreview]\x20Campaign\x20Queue:\x20','\x20is\x20not\x20active','\x20is\x20disactive','prototype','syncCampaigns','hasOwnProperty','booked','clearZombieChannels','setMessage','recallMe','clearZombieChannel','isNil','[clearZombieChannels][talking]','Queue','queue','pTalking:\x20','dialAnswer','pick','contactId','UserId','VoiceQueueId','ListId','status','channel','catch','No\x20such\x20channel','updateOriginated','decrementTalkink','[clearZombieChannel]','loggerError','[Dialer][checkChannel][pTalking][Preview]','[action]','size','then','length','getDiff','Agent','voicePause','run','logger2','[RecallMe]','disableContact','starttime','YYYY-MM-DD\x20HH:mm:ss','RecallInQueue','rescheduleContactInQueue','createBody','createCustomerHistory','logCustomer','createCustomerFinal','[HistoryRecallClose]','isActive','NOT_ACTIVE','isTrunkReachable','TrunkBackup','callProgressDetectingCustomer','countnosuchnumberretry','totalGlobal','NoSuchNumber','custom:agentnosuchnumber','buildObj','[callProgressDetectingCustomer][logNoSuch]','cloneAction','Global','[callProgressDetectingCustomer][logNoSuchGlobal]','dialNoSuchNumberMaxRetry','rescheduleContact','scheduledAt','unlockAgent','activeContact','linkedid','responsetime','answertime','[syncHangup][talking][increment]','uniqueid','\x20Queue','connect','acw','custom:agentConnectPreview','custom:agentcomplete','complete','countglobal','Answer','[callProgressDetectingCustomer][logAnswer]','crateCustomerReportQueue','sumDuration','talktime','[syncHangup][talking][decrement]','BUSY','countbusyretry','Busy','custom:agentbusy','[callProgressDetectingCustomer][logBusy]','dialBusyRetryFrequency','NOANSWER','countnoanswerretry','NoAnswer','custom:agentnoanswer','[callProgressDetectingCustomer][logNoAnswer]','dialGlobalMaxRetry','[callProgressDetectingCustomer][logNoAnswerGlobal]','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','CONGESTION','countcongestionretry','Congestion','custom:agentcongestion','congestion','[callProgressDetectingCustomer][logCongestion]','[callProgressDetectingCustomer][logCongestionGlobal]','dialCongestionMaxRetry','AgentReject','custom:agentreject','agentreject','[syncHangupRequest][logAgentReject]','[callProgressDetectingCustomer][logAgentReject]','countagentrejectretry','ABANDONED','countabandonedretry','Abandoned','[callProgressDetectingCustomer][logAbandoned]','countabandonedetry','[Dialer][decrementTalkink][no\x20Hangup][Preview]','dialstatus','[callProgressDetectingCustomer][logUnknown]','[callProgressDetectingCustomer][logUnknownGlobal]','[originated][decrement][callProgressDetectingCustomer]','originated:\x20','ANSWER','callProgressDetectingAgent','isUndefined','object','reason','createAgentHistory','[callProgressDetectingAgent][logNoSuch]','logAgent','[callProgressDetectingAgent][logBusy]','[callProgressDetectingAgent][logCongestion]','AnswerAGI','[callProgressDetectingAgent][logAnswerAGI]','[callProgressDetectingAgent]','checkInBlack','Contact','lookAgent','isEmpty','[Preview][execCall][success]','\x20IdHopper:\x20','idContact','custom:agentcalled','called','Call\x20failed','[Blacklist][error]','Contact\x20in\x20black\x20List','SIP/%s','reachable','unmonitored','execRun','unlock','unlockContact','getContactPreview','recallme','validateContact','isValid','checkIsBlackList','Contact.phone','[Preview][checkIsBlackList]','Call\x20unsuccessful','[Preview][getContactPreview]','[Preview][validateContact][Empty\x20Contact]','Empty\x20Contact','ACTIVE','[Preview][validateContact][Empty\x20Campaign]','Empty\x20Campaign','[Preview][validateContact][Trunk\x20not\x20work]','campaign\x20Name:\x20','\x20Trunk\x20is\x20not\x20active','Trunk\x20not\x20work','[Preview][validateContact][Campaign\x20Active]','\x20Not\x20Active','Is\x20Valid','execCall','dialPrefix','trim','dialCutDigit','phone','substring','getCallerId','callerid','dialRandomLastDigitCallerIdNumber','dialOriginateCallerIdNumber','getCallerIdRandom','originatecalleridname','extractCalleridName','originatecalleridnum','extractCalleridNumber','addVariables','merge','toLowerVariables','Action','variablesAction','[originated][increment]','OriginateError','[originateFailure][logOriginateFailure]','syncOriginateResponse','actionid','logLookAgent','clone','isFailure','response'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0xc462,0x15e));var _0x2c46=function(_0x4f9b18,_0x2cb5ca){_0x4f9b18=_0x4f9b18-0x0;var _0x29f20c=_0xc462[_0x4f9b18];return _0x29f20c;};'use strict';var util=require(_0x2c46('0x0'));var _=require(_0x2c46('0x1'));var BPromise=require(_0x2c46('0x2'));var uuid=require(_0x2c46('0x3'));var moment=require(_0x2c46('0x4'));var md5=require(_0x2c46('0x5'));var Redis=require(_0x2c46('0x6'));var config=require('../../../config/environment');var logger=require(_0x2c46('0x7'))(_0x2c46('0x8'));var loggerAction=require(_0x2c46('0x7'))(_0x2c46('0x9'));var ami=require('../ami');var rpcDb=require(_0x2c46('0xa'));var Action=require(_0x2c46('0xb'));var ut=require(_0x2c46('0xc'));config['redis']=_[_0x2c46('0xd')](config[_0x2c46('0xe')],{'host':'localhost','port':0x18eb});var io=require(_0x2c46('0xf'))(new Redis(config[_0x2c46('0xe')]));var Sequence=function(){};Sequence['prototype'][_0x2c46('0x10')]=function(_0x51e7f4){this[_0x2c46('0x11')]=this[_0x2c46('0x11')]?this[_0x2c46('0x11')][_0x2c46('0x12')](_0x51e7f4):_0x51e7f4();};function Preview(_0x309c42){this[_0x2c46('0x13')]=new Sequence();this[_0x2c46('0x14')]=_0x309c42[_0x2c46('0x15')];this[_0x2c46('0x16')]=_0x309c42[_0x2c46('0x16')];this[_0x2c46('0x17')]={};this[_0x2c46('0x18')]=_0x309c42[_0x2c46('0x18')];this[_0x2c46('0x19')]=0x0;ami['on']('originateresponse',this['syncOriginateResponse'][_0x2c46('0x1a')](this));ami['on'](_0x2c46('0x1b'),this[_0x2c46('0x1c')][_0x2c46('0x1a')](this));ami['on']('hanguprequest',this[_0x2c46('0x1d')][_0x2c46('0x1a')](this));ami['on'](_0x2c46('0x1e'),this[_0x2c46('0x1f')][_0x2c46('0x1a')](this));ami['on'](_0x2c46('0x20'),this['syncNewExten'][_0x2c46('0x1a')](this));ami['on'](_0x2c46('0x21'),this['syncVarSet'][_0x2c46('0x1a')](this));ami['on'](_0x2c46('0x22'),this[_0x2c46('0x23')][_0x2c46('0x1a')](this));ami['on']('blindtransfer',this[_0x2c46('0x24')][_0x2c46('0x1a')](this));this[_0x2c46('0x25')](this[_0x2c46('0x14')]);}function emit(_0x576c04,_0x3fb034,_0x458b18){io['to'](_0x576c04)[_0x2c46('0x26')](_0x3fb034,_0x458b18);}function emitCampaignPreview(_0x3ddf3f){if(_0x3ddf3f[_0x2c46('0x27')]===_0x2c46('0x28')){var _0x5751b5={'id':_0x3ddf3f['id'],'name':_0x3ddf3f[_0x2c46('0x29')],'strategy':_0x3ddf3f['strategy'],'answered':_0x3ddf3f[_0x2c46('0x2a')],'available':_0x3ddf3f[_0x2c46('0x2b')],'loggedIn':_0x3ddf3f[_0x2c46('0x2c')],'pTalking':_0x3ddf3f['pTalking'],'sumBillable':_0x3ddf3f[_0x2c46('0x2d')],'sumDuration':_0x3ddf3f['sumDuration'],'sumHoldTime':_0x3ddf3f[_0x2c46('0x2e')]||0x0,'talking':_0x3ddf3f[_0x2c46('0x2f')],'total':_0x3ddf3f[_0x2c46('0x30')],'type':_0x3ddf3f['type'],'unmanaged':_0x3ddf3f['unmanaged'],'abandoned':_0x3ddf3f[_0x2c46('0x31')],'waiting':_0x3ddf3f['waiting'],'loggedInDb':_0x3ddf3f['loggedInDb'],'dialActive':_0x3ddf3f[_0x2c46('0x32')],'dialMethod':_0x3ddf3f[_0x2c46('0x33')],'dialOriginateCallerIdName':_0x3ddf3f[_0x2c46('0x34')],'dialOriginateCallerIdNumber':_0x3ddf3f['dialOriginateCallerIdNumber'],'dialOriginateTimeout':_0x3ddf3f[_0x2c46('0x35')],'dialPrefix':_0x3ddf3f['dialPrefix'],'outboundAnswerAgiCallsDay':_0x3ddf3f[_0x2c46('0x36')],'outboundAnswerCallsDay':_0x3ddf3f[_0x2c46('0x37')],'outboundBlacklistCallsDay':_0x3ddf3f[_0x2c46('0x38')],'outboundBusyCallsDay':_0x3ddf3f[_0x2c46('0x39')],'outboundCongestionCallsDay':_0x3ddf3f[_0x2c46('0x3a')],'outboundDropCallsDayACS':_0x3ddf3f['outboundDropCallsDayACS'],'outboundDropCallsDayCallersExit':_0x3ddf3f[_0x2c46('0x3b')],'outboundDropCallsDayTimeout':_0x3ddf3f[_0x2c46('0x3c')],'outboundNoAnswerCallsDay':_0x3ddf3f[_0x2c46('0x3d')],'outboundNoSuchCallsDay':_0x3ddf3f[_0x2c46('0x3e')],'outboundOriginateFailureCallsDay':_0x3ddf3f[_0x2c46('0x3f')],'outboundReCallsDay':_0x3ddf3f[_0x2c46('0x40')],'outboundRejectCallsDay':_0x3ddf3f[_0x2c46('0x41')],'outboundUnknownCallsDay':_0x3ddf3f[_0x2c46('0x42')],'outboundAbandonedCallsDay':_0x3ddf3f[_0x2c46('0x43')],'predictiveIntervalAnsweredCalls':_0x3ddf3f[_0x2c46('0x44')],'predictiveIntervalAvgHoldtime':_0x3ddf3f[_0x2c46('0x45')],'predictiveIntervalAvgTalktime':_0x3ddf3f[_0x2c46('0x46')],'predictiveIntervalDroppedCallsCallersExit':_0x3ddf3f['predictiveIntervalDroppedCallsCallersExit'],'predictiveIntervalDroppedCallsTimeout':_0x3ddf3f[_0x2c46('0x47')],'predictiveIntervalErlangCalls':_0x3ddf3f['predictiveIntervalErlangCalls'],'predictiveIntervalErlangCallsDroppedCalls':_0x3ddf3f[_0x2c46('0x48')],'predictiveIntervalHitRate':_0x3ddf3f[_0x2c46('0x49')],'predictiveIntervalMultiplicativeFactor':_0x3ddf3f[_0x2c46('0x4a')],'predictiveIntervalPauses':_0x3ddf3f['predictiveIntervalPauses'],'predictiveIntervalAvailable':_0x3ddf3f[_0x2c46('0x4b')],'predictiveIntervalTotalCalls':_0x3ddf3f[_0x2c46('0x4c')],'message':_0x3ddf3f[_0x2c46('0x4d')],'originated':_0x3ddf3f[_0x2c46('0x4e')],'erlangCalls':_0x3ddf3f[_0x2c46('0x4f')],'erlangCallToSecond':_0x3ddf3f['erlangCallToSecond'],'erlangAbandonmentRate':_0x3ddf3f[_0x2c46('0x50')],'erlangBusyFactor':_0x3ddf3f['erlangBusyFactor'],'startPredictive':_0x3ddf3f[_0x2c46('0x51')],'startProgressive':_0x3ddf3f[_0x2c46('0x52')]};if(_0x3ddf3f[_0x2c46('0x53')]){_0x5751b5[_0x2c46('0x53')]={'id':_0x3ddf3f['Trunk']['id'],'name':_0x3ddf3f[_0x2c46('0x53')]['name'],'active':_0x3ddf3f[_0x2c46('0x53')][_0x2c46('0x54')],'callerid':_0x3ddf3f[_0x2c46('0x53')]['callerid']};}if(_0x3ddf3f[_0x2c46('0x55')]){_0x5751b5['Interval']={'id':_0x3ddf3f['Interval']['id'],'name':_0x3ddf3f['Interval']['name']};}var _0x1b3dcc=md5(JSON['stringify'](_0x5751b5));if(_0x3ddf3f[_0x2c46('0x5')]!==_0x1b3dcc){_0x3ddf3f[_0x2c46('0x5')]=_0x1b3dcc;emit(util[_0x2c46('0x56')]('voice:queue:%s',_0x5751b5[_0x2c46('0x29')]),_0x2c46('0x57'),_0x5751b5);}}}function emitVoiceQueueChannelRemove(_0x39fd03){logger[_0x2c46('0x58')](_0x2c46('0x59'),JSON[_0x2c46('0x5a')](_0x39fd03));emit(util[_0x2c46('0x56')](_0x2c46('0x5b'),_0x39fd03[_0x2c46('0x29')]),_0x2c46('0x5c'),_0x39fd03);}function notSendMessagesQueue(_0x2e6ff1){if(_0x2e6ff1['sendMessageOneNotActive']){if(_0x2e6ff1[_0x2c46('0x4e')]===0x0&&_0x2e6ff1[_0x2c46('0x5d')]===0x0){_0x2e6ff1[_0x2c46('0x5e')]=![];_0x2e6ff1[_0x2c46('0x2b')]=0x0;_0x2e6ff1[_0x2c46('0x5f')]=0x0;_0x2e6ff1[_0x2c46('0x4d')]='NOT_ACTIVE';ut[_0x2c46('0x60')](_0x2c46('0x61'),_0x2e6ff1[_0x2c46('0x29')]+_0x2c46('0x62'));}else{_0x2e6ff1[_0x2c46('0x4d')]='IS_DISACTIVED';ut[_0x2c46('0x60')](_0x2c46('0x61'),_0x2e6ff1[_0x2c46('0x29')]+_0x2c46('0x63'));}emitCampaignPreview(_0x2e6ff1);}}Preview[_0x2c46('0x64')][_0x2c46('0x25')]=function(){var _0x543930=this;setInterval(function(){_0x543930[_0x2c46('0x65')]();},0x7cf);};Preview[_0x2c46('0x64')][_0x2c46('0x65')]=function(){var _0x43f123=this[_0x2c46('0x14')];this[_0x2c46('0x19')]+=0x1;for(var _0x159f64 in _0x43f123){if(_0x43f123[_0x2c46('0x66')](_0x159f64)&&(_0x43f123[_0x159f64][_0x2c46('0x33')]===_0x2c46('0x8')||_0x43f123[_0x159f64][_0x2c46('0x33')]===_0x2c46('0x67'))&&_0x43f123[_0x159f64][_0x2c46('0x27')]===_0x2c46('0x28')){if(this[_0x2c46('0x19')]>0x7){this['clockClearZombieChannels']=0x0;this[_0x2c46('0x68')]();}}if(_0x43f123[_0x2c46('0x66')](_0x159f64)&&_0x43f123[_0x159f64][_0x2c46('0x33')]===_0x2c46('0x8')&&_0x43f123[_0x159f64]['type']===_0x2c46('0x28')){if(_0x43f123[_0x159f64]['dialActive']){this[_0x2c46('0x69')](_0x43f123[_0x159f64]);this[_0x2c46('0x6a')](_0x43f123[_0x159f64]);}else{notSendMessagesQueue(_0x43f123[_0x159f64]);}}}};Preview[_0x2c46('0x64')][_0x2c46('0x6b')]=function(_0x4d9202){var _0x4f22f1=this;this[_0x2c46('0x13')][_0x2c46('0x10')](function(){if(!_[_0x2c46('0x6c')](_0x4f22f1[_0x2c46('0x17')][_0x4d9202])){loggerAction[_0x2c46('0x58')](_0x2c46('0x6d'),_0x4d9202,_0x2c46('0x6e'),_0x4f22f1['actions'][_0x4d9202][_0x2c46('0x6f')],'originated:\x20',JSON['stringify'](_0x4f22f1['campaignsPreview'][_0x4f22f1[_0x2c46('0x17')][_0x4d9202][_0x2c46('0x6f')]][_0x2c46('0x4e')]),_0x2c46('0x70'),JSON['stringify'](_0x4f22f1[_0x2c46('0x14')][_0x4f22f1[_0x2c46('0x17')][_0x4d9202][_0x2c46('0x6f')]][_0x2c46('0x5d')]),JSON[_0x2c46('0x5a')](_0x4f22f1['actions'][_0x4d9202][_0x2c46('0x71')]),JSON[_0x2c46('0x5a')](_[_0x2c46('0x72')](_0x4f22f1[_0x2c46('0x17')][_0x4d9202],[_0x2c46('0x73'),_0x2c46('0x74'),_0x2c46('0x75'),_0x2c46('0x76')])));return ami['Action']({'action':_0x2c46('0x77'),'channel':_0x4f22f1['actions'][_0x4d9202][_0x2c46('0x78')]})[_0x2c46('0x79')](function(_0x17504b){if(_0x17504b['message']===_0x2c46('0x7a')){setTimeout(function(){if(_0x4f22f1[_0x2c46('0x17')][_0x4d9202]){ut[_0x2c46('0x7b')](_0x4f22f1[_0x2c46('0x14')][_0x4f22f1[_0x2c46('0x17')][_0x4d9202]['queue']],'[clearZombieChannel]');if(_0x4f22f1[_0x2c46('0x17')][_0x4d9202]['dialAnswer']===!![]){ut[_0x2c46('0x7c')](_0x4f22f1['campaignsPreview'][_0x4f22f1[_0x2c46('0x17')][_0x4d9202][_0x2c46('0x6f')]],_0x2c46('0x7d'));ut[_0x2c46('0x7e')](_0x2c46('0x7f')+_0x4d9202,_0x4f22f1[_0x2c46('0x17')][_0x4d9202][_0x2c46('0x6f')]);}ut[_0x2c46('0x7e')]('[Dialer][checkChannel][Preview]'+_0x4d9202,_0x4f22f1[_0x2c46('0x17')][_0x4d9202][_0x2c46('0x6f')]);delete _0x4f22f1[_0x2c46('0x17')][_0x4d9202];}},0x2328);}});}});};Preview['prototype']['clearZombieChannels']=function(){var _0x3b1555=this;loggerAction[_0x2c46('0x58')](_0x2c46('0x80'),_[_0x2c46('0x81')](this[_0x2c46('0x17')]));for(var _0x5c5e06 in this[_0x2c46('0x17')]){if(_0x3b1555['actions'][_0x2c46('0x66')](_0x5c5e06)){_0x3b1555[_0x2c46('0x6b')](_0x5c5e06);}}};Preview[_0x2c46('0x64')][_0x2c46('0x6a')]=function(_0x5688a8){var _0x1d4049=this;rpcDb['getContactRecallMe'](_0x5688a8['id'],ut['agentReadyId'](this[_0x2c46('0x18')]))[_0x2c46('0x82')](function(_0x5d9474){if(!_[_0x2c46('0x6c')](_0x5d9474)){for(var _0x55bc70=0x0;_0x55bc70<_0x5d9474[_0x2c46('0x83')];_0x55bc70+=0x1){if(ut[_0x2c46('0x84')](_0x5d9474[_0x55bc70]['scheduledat'])<_0x5688a8['dialRecallMeTimeout']*0x3c){if(_0x5d9474[_0x55bc70][_0x2c46('0x85')]&&!_0x5d9474[_0x55bc70][_0x2c46('0x85')][_0x2c46('0x86')]){_0x1d4049[_0x2c46('0x87')](_0x5d9474[_0x55bc70]['id'])['then'](ut[_0x2c46('0x88')](_0x2c46('0x89')))[_0x2c46('0x79')](ut['logger2'](_0x2c46('0x89')));}else{rpcDb[_0x2c46('0x8a')](_0x5d9474[_0x55bc70]['id']);}}else{var _0x510e5c=new Action(_0x5d9474[_0x55bc70],_0x5688a8);_0x510e5c[_0x2c46('0x8b')]=moment()['format'](_0x2c46('0x8c'));_0x5688a8[_0x2c46('0x40')]+=0x1;ut['logCustomer'](_0x510e5c,0x17,_0x2c46('0x8d'));if(_0x5688a8['dialRecallInQueue']){rpcDb[_0x2c46('0x8e')](ut[_0x2c46('0x8f')](_0x5d9474[_0x55bc70]));rpcDb[_0x2c46('0x90')](_0x510e5c,'[HistoryDialRecallInQueue][historyCatch]');}else{ut[_0x2c46('0x91')](_0x510e5c,0x16,'RecallFailedTimeout');rpcDb[_0x2c46('0x90')](_0x510e5c,'[HistoryRecallClose]');rpcDb[_0x2c46('0x92')](_0x510e5c,_0x2c46('0x93'));}}}}})[_0x2c46('0x79')](ut['logger2']('[getContactRecallMe]'));};Preview[_0x2c46('0x64')][_0x2c46('0x69')]=function(_0x16e16e){_0x16e16e[_0x2c46('0x5e')]=!![];if(ut['IsNotLoggedIn'](_0x16e16e['loggedIn'])){_0x16e16e[_0x2c46('0x4d')]='AGENTS_NOT_LOGGED';}else if(!ut[_0x2c46('0x94')](_0x16e16e[_0x2c46('0x32')])){_0x16e16e[_0x2c46('0x4d')]=_0x2c46('0x95');}else if(!this[_0x2c46('0x96')](_0x16e16e[_0x2c46('0x53')])){if(!this[_0x2c46('0x96')](_0x16e16e[_0x2c46('0x97')])){_0x16e16e['message']='TRUNK_IS_NOT_REACHABLE';}else{_0x16e16e['message']='ACTIVE';}}else{_0x16e16e[_0x2c46('0x4d')]='ACTIVE';}emitCampaignPreview(_0x16e16e);};Preview[_0x2c46('0x64')][_0x2c46('0x98')]=function(_0x32c1f8,_0x2a3105,_0x4592ff){var _0x39db5a=this;var _0x580f2e=this[_0x2c46('0x17')][_0x2a3105];var _0x3e0e3e=this[_0x2c46('0x14')][_0x580f2e[_0x2c46('0x6f')]];var _0x5e0219;if(_0x3e0e3e){switch(_0x4592ff){case'1':_0x3e0e3e[_0x2c46('0x3e')]+=0x1;_0x580f2e[_0x2c46('0x99')]+=0x1;_0x580f2e['countglobal']=ut[_0x2c46('0x9a')](_0x580f2e);ut['logCustomer'](_0x580f2e,0x0,_0x2c46('0x9b'));ami[_0x2c46('0x26')](_0x2c46('0x9c'),ut[_0x2c46('0x9d')](_0x580f2e,'nosuchnumber'));rpcDb[_0x2c46('0x90')](_0x580f2e,_0x2c46('0x9e'));if(ut[_0x2c46('0x9a')](_0x580f2e)>=_0x3e0e3e['dialGlobalMaxRetry']){_0x5e0219=ut[_0x2c46('0x9f')](_0x580f2e,0xf,_0x2c46('0xa0'));rpcDb[_0x2c46('0x92')](_0x5e0219,_0x2c46('0xa1'));}else{if(_0x580f2e['countnosuchnumberretry']>=_0x3e0e3e[_0x2c46('0xa2')]){rpcDb[_0x2c46('0x92')](_0x580f2e,_0x2c46('0xa1'));}else{rpcDb[_0x2c46('0xa3')](ut[_0x2c46('0xa4')](_0x580f2e,_0x2c46('0x99'),_0x3e0e3e['dialNoSuchNumberRetryFrequency']),_0x580f2e[_0x2c46('0xa5')],_0x580f2e[_0x2c46('0xa6')]);}}delete this['actions'][_0x32c1f8[_0x2c46('0xa7')]];break;case'ANSWER':var _0x5c7c17=moment()[_0x2c46('0x56')](_0x2c46('0x8c'));_0x580f2e[_0x2c46('0xa8')]=_0x5c7c17;_0x580f2e[_0x2c46('0xa9')]=_0x5c7c17;_0x580f2e[_0x2c46('0x71')]=!![];_0x3e0e3e[_0x2c46('0x5d')]+=0x1;logger['info'](_0x2c46('0xaa'),_0x580f2e[_0x2c46('0xab')],_0x2c46('0xac'),_0x3e0e3e[_0x2c46('0x29')],'pTalking:\x20',_0x3e0e3e[_0x2c46('0x5d')]);ami[_0x2c46('0x26')]('custom:agentconnect',ut[_0x2c46('0x9d')](_0x580f2e,_0x2c46('0xad')));if(_0x3e0e3e[_0x2c46('0xae')]){ami[_0x2c46('0x26')](_0x2c46('0xaf'),ut['buildAcw'](_0x580f2e));}break;case'16':ami['emit'](_0x2c46('0xb0'),ut[_0x2c46('0x9d')](_0x580f2e,_0x2c46('0xb1')));emitVoiceQueueChannelRemove(ut[_0x2c46('0x9d')](_0x580f2e,'complete'));_0x3e0e3e[_0x2c46('0x37')]+=0x1;_0x3e0e3e[_0x2c46('0x30')]+=0x1;_0x3e0e3e[_0x2c46('0x2a')]+=0x1;ut[_0x2c46('0x7c')](_0x3e0e3e,'[16]');_0x580f2e[_0x2c46('0xb2')]=ut[_0x2c46('0x9a')](_0x580f2e);ut[_0x2c46('0x91')](_0x580f2e,0x4,_0x2c46('0xb3'));rpcDb['createCustomerHistory'](_0x580f2e,_0x2c46('0xb4'));rpcDb[_0x2c46('0x92')](_0x580f2e,'[callProgressDetectingCustomer][logAnswerGlobal]');rpcDb[_0x2c46('0xb5')](_0x580f2e);_0x3e0e3e[_0x2c46('0xb6')]+=_0x580f2e[_0x2c46('0xb7')];_0x3e0e3e[_0x2c46('0x2d')]+=_0x580f2e[_0x2c46('0xb7')];logger[_0x2c46('0x58')](_0x2c46('0xb8'),_0x580f2e[_0x2c46('0xab')],_0x2c46('0xac'),_0x3e0e3e[_0x2c46('0x29')],_0x2c46('0x70'),_0x3e0e3e[_0x2c46('0x5d')]);delete this[_0x2c46('0x17')][_0x32c1f8[_0x2c46('0xa7')]];break;case _0x2c46('0xb9'):_0x3e0e3e[_0x2c46('0x39')]+=0x1;_0x580f2e[_0x2c46('0xba')]+=0x1;_0x580f2e[_0x2c46('0xb2')]=ut[_0x2c46('0x9a')](_0x580f2e);ut[_0x2c46('0x91')](_0x580f2e,0x5,_0x2c46('0xbb'));ami['emit'](_0x2c46('0xbc'),ut[_0x2c46('0x9d')](_0x580f2e,'busy'));rpcDb[_0x2c46('0x90')](_0x580f2e,_0x2c46('0xbd'));if(ut[_0x2c46('0x9a')](_0x580f2e)>=_0x3e0e3e['dialGlobalMaxRetry']){_0x5e0219=ut[_0x2c46('0x9f')](_0x580f2e,0xf,_0x2c46('0xa0'));rpcDb['createCustomerFinal'](_0x5e0219,'[callProgressDetectingCustomer][logBusyGlobal]');}else{if(_0x580f2e['countbusyretry']>=_0x3e0e3e['dialBusyMaxRetry']){rpcDb[_0x2c46('0x92')](_0x580f2e,_0x2c46('0xbd'));}else{rpcDb['rescheduleContact'](ut[_0x2c46('0xa4')](_0x580f2e,_0x2c46('0xba'),_0x3e0e3e[_0x2c46('0xbe')]),_0x580f2e[_0x2c46('0xa5')],_0x580f2e[_0x2c46('0xa6')]);}}break;case _0x2c46('0xbf'):_0x3e0e3e[_0x2c46('0x3d')]+=0x1;_0x580f2e[_0x2c46('0xc0')]+=0x1;_0x580f2e[_0x2c46('0xb2')]=ut['totalGlobal'](_0x580f2e);ut['logCustomer'](_0x580f2e,0x3,_0x2c46('0xc1'));ami[_0x2c46('0x26')](_0x2c46('0xc2'),ut[_0x2c46('0x9d')](_0x580f2e,'noanswer'));rpcDb[_0x2c46('0x90')](_0x580f2e,_0x2c46('0xc3'));if(ut[_0x2c46('0x9a')](_0x580f2e)>=_0x3e0e3e[_0x2c46('0xc4')]){_0x5e0219=ut[_0x2c46('0x9f')](_0x580f2e,0xf,_0x2c46('0xa0'));rpcDb[_0x2c46('0x92')](_0x5e0219,_0x2c46('0xc5'));}else{if(_0x580f2e['countnoanswerretry']>=_0x3e0e3e[_0x2c46('0xc6')]){rpcDb['createCustomerFinal'](_0x580f2e,'[callProgressDetectingCustomer][logNoAnswer]');}else{rpcDb['rescheduleContact'](ut[_0x2c46('0xa4')](_0x580f2e,_0x2c46('0xc0'),_0x3e0e3e[_0x2c46('0xc7')]),_0x580f2e[_0x2c46('0xa5')],_0x580f2e['activeContact']);}}break;case _0x2c46('0xc8'):_0x3e0e3e[_0x2c46('0x3a')]+=0x1;_0x580f2e[_0x2c46('0xc9')]+=0x1;_0x580f2e[_0x2c46('0xb2')]=ut[_0x2c46('0x9a')](_0x580f2e);ut['logCustomer'](_0x580f2e,0x8,_0x2c46('0xca'));ami[_0x2c46('0x26')](_0x2c46('0xcb'),ut[_0x2c46('0x9d')](_0x580f2e,_0x2c46('0xcc')));rpcDb[_0x2c46('0x90')](_0x580f2e,_0x2c46('0xcd'));if(ut[_0x2c46('0x9a')](_0x580f2e)>=_0x3e0e3e[_0x2c46('0xc4')]){_0x5e0219=ut[_0x2c46('0x9f')](_0x580f2e,0xf,_0x2c46('0xa0'));rpcDb[_0x2c46('0x92')](_0x5e0219,_0x2c46('0xce'));}else{if(_0x580f2e[_0x2c46('0xc9')]>=_0x3e0e3e[_0x2c46('0xcf')]){rpcDb[_0x2c46('0x92')](_0x580f2e,_0x2c46('0xcd'));}else{rpcDb[_0x2c46('0xa3')](ut['scheduledAt'](_0x580f2e,_0x2c46('0xc9'),_0x3e0e3e[_0x2c46('0xbe')]),_0x580f2e[_0x2c46('0xa5')],_0x580f2e[_0x2c46('0xa6')]);}}break;case'CANCEL':_0x3e0e3e[_0x2c46('0x41')]+=0x1;_0x580f2e['countagentrejectretry']+=0x1;_0x580f2e[_0x2c46('0xb2')]=ut['totalGlobal'](_0x580f2e);ut[_0x2c46('0x91')](_0x580f2e,0x14,_0x2c46('0xd0'));ami[_0x2c46('0x26')](_0x2c46('0xd1'),ut[_0x2c46('0x9d')](_0x580f2e,_0x2c46('0xd2')));rpcDb[_0x2c46('0x90')](_0x580f2e,_0x2c46('0xd3'));if(ut[_0x2c46('0x9a')](_0x580f2e)>=_0x3e0e3e[_0x2c46('0xc4')]){_0x5e0219=ut['cloneAction'](_0x580f2e,0x14,'AgentReject');rpcDb['createCustomerFinal'](_0x5e0219,_0x2c46('0xd4'));}else{if(_0x580f2e[_0x2c46('0xd5')]>=_0x3e0e3e['dialAgentRejectMaxRetry']){rpcDb['createCustomerFinal'](_0x580f2e,_0x2c46('0xd4'));}else{rpcDb[_0x2c46('0xa3')](ut[_0x2c46('0xa4')](_0x580f2e,_0x2c46('0xd5'),_0x3e0e3e['dialAgentRejectRetryFrequency']),_0x580f2e['unlockAgent'],_0x580f2e[_0x2c46('0xa6')]);}}break;case _0x2c46('0xd6'):_0x3e0e3e['outboundAbandonedCallsDay']+=0x1;_0x580f2e[_0x2c46('0xd7')]+=0x1;_0x580f2e[_0x2c46('0xb2')]=ut[_0x2c46('0x9a')](_0x580f2e);ut['logCustomer'](_0x580f2e,0xb,_0x2c46('0xd8'));rpcDb[_0x2c46('0x90')](_0x580f2e,'[callProgressDetectingCustomer][logAbandoned]');if(ut[_0x2c46('0x9a')](_0x580f2e)>=_0x3e0e3e[_0x2c46('0xc4')]){_0x5e0219=ut[_0x2c46('0x9f')](_0x580f2e,0xf,_0x2c46('0xa0'));rpcDb[_0x2c46('0x92')](_0x5e0219,_0x2c46('0xd9'));}else{if(_0x580f2e[_0x2c46('0xda')]>=_0x3e0e3e['dialAbandonedMaxRety']){rpcDb[_0x2c46('0x92')](_0x580f2e,_0x2c46('0xd9'));}else{rpcDb[_0x2c46('0xa3')](ut[_0x2c46('0xa4')](_0x580f2e,'countabandonedretry',_0x3e0e3e['dialAbandonedRetryFrequency']),_0x580f2e[_0x2c46('0xa5')],_0x580f2e['activeContact']);}}break;default:if(_0x580f2e[_0x2c46('0x71')]){ut['decrementTalkink'](_0x3e0e3e,'[default]');ut[_0x2c46('0x7e')](_0x2c46('0xdb')+_0x3e0e3e['name'],_0x32c1f8);}_0x3e0e3e['outboundUnknownCallsDay']+=0x1;_0x580f2e[_0x2c46('0xb2')]=ut['totalGlobal'](_0x580f2e);ut[_0x2c46('0x91')](_0x580f2e,0xc,_0x32c1f8['cause-txt']||_0x32c1f8[_0x2c46('0xdc')]);rpcDb['createCustomerHistory'](_0x580f2e,_0x2c46('0xdd'));if(ut[_0x2c46('0x9a')](_0x580f2e)>=_0x3e0e3e[_0x2c46('0xc4')]){_0x5e0219=ut['cloneAction'](_0x580f2e,0xf,'Global');rpcDb[_0x2c46('0x92')](_0x5e0219,_0x2c46('0xde'));}else{rpcDb[_0x2c46('0x92')](_0x580f2e,'[callProgressDetectingCustomer][logUnknownGlobal]');}delete this[_0x2c46('0x17')][_0x32c1f8['linkedid']];}if(!(_0x580f2e[_0x2c46('0x71')]&&_0x4592ff==='16')){ut[_0x2c46('0x7b')](_0x3e0e3e,'[callProgressDetectingCustomer]');logger['info'](_0x2c46('0xdf'),_0x580f2e['uniqueid'],_0x2c46('0xac'),_0x3e0e3e['name'],_0x2c46('0xe0'),_0x3e0e3e[_0x2c46('0x4e')]);}if(_0x4592ff!==_0x2c46('0xe1')){delete this['actions'][_0x32c1f8[_0x2c46('0xa7')]];delete this['actions'][_0x32c1f8['destlinkedid']];}}};Preview[_0x2c46('0x64')][_0x2c46('0xe2')]=function(_0x52fe37,_0x5143b8,_0x186674){if(_[_0x2c46('0xe3')](_0x5143b8)&&_0x2c46('0xe4')!==typeof _0x5143b8){return;}if(_[_0x2c46('0xe3')](_0x186674)&&_0x2c46('0xe4')!==typeof _0x186674){return;}switch(_0x186674[_0x2c46('0xe5')]){case'0':ut['logAgent'](_0x52fe37,0x0,_0x2c46('0x9b'));rpcDb[_0x2c46('0xe6')](_0x52fe37,_0x2c46('0xe7'));break;case'3':ut[_0x2c46('0xe8')](_0x52fe37,0x3,_0x2c46('0xc1'));rpcDb[_0x2c46('0xe6')](_0x52fe37,'[callProgressDetectingAgent][logNoAnswer]');break;case'5':ut[_0x2c46('0xe8')](_0x52fe37,0x5,_0x2c46('0xbb'));rpcDb[_0x2c46('0xe6')](_0x52fe37,_0x2c46('0xe9'));break;case'8':ut[_0x2c46('0xe8')](_0x52fe37,0x8,_0x2c46('0xca'));rpcDb[_0x2c46('0xe6')](_0x52fe37,_0x2c46('0xea'));break;case'22':ut[_0x2c46('0xe8')](_0x52fe37,0x16,_0x2c46('0xeb'));rpcDb[_0x2c46('0xe6')](_0x52fe37,_0x2c46('0xec'));break;default:ut[_0x2c46('0xe8')](_0x52fe37,0xc,_0x186674['reason']);rpcDb[_0x2c46('0xe6')](_0x52fe37,_0x2c46('0xea'));}ut[_0x2c46('0x7b')](_0x5143b8,_0x2c46('0xed'));logger[_0x2c46('0x58')]('[originated][decrement][callProgressDetectingAgent]',_0x52fe37['uniqueid'],_0x2c46('0xac'),_0x5143b8[_0x2c46('0x29')],_0x2c46('0xe0'),_0x5143b8[_0x2c46('0x4e')]);delete this['actions'][_0x52fe37['uniqueid']];};Preview[_0x2c46('0x64')][_0x2c46('0xee')]=function(_0x3b361e,_0x3b2dfb,_0x524b55,_0x5e979d,_0x43ca69){var _0x39b563=this;return new BPromise(function(_0x30fc81,_0x344a89){if(_[_0x2c46('0x6c')](_0x3b2dfb)||_[_0x2c46('0x6c')](_0x3b2dfb[_0x2c46('0xef')])||_[_0x2c46('0x6c')](_0x3b2dfb[_0x2c46('0xef')]['phone'])||_[_0x2c46('0x6c')](_0x3b2dfb[_0x2c46('0x75')])){_0x344a89(ut['message']('Contact\x20is\x20undefined',_0x5e979d,_0x43ca69));return;}var _0x200a6a=uuid['v4']();var _0x2851a7=_0x39b563[_0x2c46('0x14')][_0x3b2dfb[_0x2c46('0x6e')][_0x2c46('0x29')]];var _0x43c4d0=_0x524b55?_0x39b563[_0x2c46('0x18')][_0x524b55]['id']:undefined;_0x39b563[_0x2c46('0x17')][_0x200a6a]=new Action(_0x3b2dfb,_0x2851a7,_0x200a6a,_0x524b55,_0x43c4d0);var _0x263f25=_0x39b563[_0x2c46('0x17')][_0x200a6a];_0x263f25[_0x2c46('0xa5')]=_0x5e979d;_0x263f25[_0x2c46('0xa6')]=_0x43ca69;_0x263f25[_0x2c46('0xf0')]=_0x524b55;if(_[_0x2c46('0xf1')](_0x3b361e)){_0x39b563['execCall'](_0x263f25,_0x2851a7,_0x3b2dfb,_0x524b55)[_0x2c46('0x82')](function(_0x233a2e){logger[_0x2c46('0x58')](_0x2c46('0xf2'),'Queue:\x20'+_0x263f25['queue']+_0x2c46('0xf3')+_0x263f25[_0x2c46('0xf4')],JSON[_0x2c46('0x5a')](_0x233a2e));ami['emit'](_0x2c46('0xf5'),ut[_0x2c46('0x9d')](_0x263f25,_0x2c46('0xf6')));_0x30fc81(ut[_0x2c46('0x4d')]('Calling'));})[_0x2c46('0x79')](function(_0x3e546a){ut[_0x2c46('0x60')]('[Preview][execCall][failure]',_0x3e546a);_0x344a89(ut[_0x2c46('0x4d')](_0x2c46('0xf7'),_0x5e979d,_0x43ca69));});}else{_0x2851a7[_0x2c46('0x38')]+=0x1;ut['logBlacklist'](_0x263f25);rpcDb['createHistory'](_0x263f25,_0x2c46('0xf8'));delete _0x39b563[_0x2c46('0x17')][_0x200a6a];_0x344a89(ut[_0x2c46('0x4d')](_0x2c46('0xf9'),_0x5e979d,_0x43ca69));}});};Preview['prototype']['isTrunkReachable']=function(_0xf2e9ed){return!_[_0x2c46('0x6c')](_0xf2e9ed)&&!_[_0x2c46('0x6c')](_0xf2e9ed[_0x2c46('0x29')])&&!_[_0x2c46('0x6c')](_0xf2e9ed[_0x2c46('0x54')])&&_0xf2e9ed['active']&&!_['isNil'](this[_0x2c46('0x16')][util['format'](_0x2c46('0xfa'),_0xf2e9ed[_0x2c46('0x29')])])&&!_['isNil'](this['trunks'][util[_0x2c46('0x56')](_0x2c46('0xfa'),_0xf2e9ed['name'])][_0x2c46('0x77')])&&(this['trunks'][util['format'](_0x2c46('0xfa'),_0xf2e9ed[_0x2c46('0x29')])][_0x2c46('0x77')]===_0x2c46('0xfb')||this['trunks'][util['format']('SIP/%s',_0xf2e9ed[_0x2c46('0x29')])]['status']===_0x2c46('0xfc'));};Preview[_0x2c46('0x64')][_0x2c46('0x87')]=function(_0x428be0,_0x28dd61){var _0x2cf46d=this;return new BPromise(function(_0x408a37,_0x19d296){_0x2cf46d[_0x2c46('0xfd')](_0x428be0,_0x28dd61)[_0x2c46('0x82')](function(_0x55a0d7){_0x408a37(_[_0x2c46('0x72')](_0x55a0d7,['message']));})[_0x2c46('0x79')](function(_0x16a8b4){if(_0x16a8b4[_0x2c46('0xfe')]){rpcDb[_0x2c46('0xff')](_0x428be0);}if(_0x16a8b4['active']){rpcDb[_0x2c46('0x8a')](_0x428be0);}_0x19d296(_['pick'](_0x16a8b4,[_0x2c46('0x4d')]));});});};Preview[_0x2c46('0x64')][_0x2c46('0xfd')]=function(_0x151f94,_0x3c1e55){var _0x5d6542=this;return new BPromise(function(_0xffb877,_0x39a485){var _0x1560e3,_0x4a2805;rpcDb[_0x2c46('0x100')](_0x151f94)[_0x2c46('0x82')](function(_0xc97661){if(!_['isNil'](_0xc97661[0x0])){_0x4a2805=_0xc97661[0x0][_0x2c46('0x101')]?![]:!![];_0x1560e3=_0xc97661[0x0][_0x2c46('0x101')]?!![]:![];_0x1560e3=_0x3c1e55?!![]:_0x1560e3;}var _0x41b09c=_0x5d6542[_0x2c46('0x102')](_0xc97661);if(_0x41b09c[_0x2c46('0x103')]){rpcDb[_0x2c46('0x104')](_[_0x2c46('0x72')](_0xc97661[0x0],[_0x2c46('0x75'),_0x2c46('0x105')]))['then'](function(_0x5d13ce){_0x5d6542['checkInBlack'](_0x5d13ce,_0xc97661[0x0],_0x3c1e55,_0x4a2805,_0x1560e3)[_0x2c46('0x82')](function(_0x317ae4){_0xffb877(_0x317ae4);})[_0x2c46('0x79')](function(_0xedb9d1){_0x39a485(_0xedb9d1);});})[_0x2c46('0x79')](function(_0x2eba34){ut['logger'](_0x2c46('0x106'),_0x2eba34);_0x39a485(ut['message'](_0x2c46('0x107'),_0x4a2805,_0x1560e3));});}else{_0x39a485(ut['message'](_0x41b09c['message'],_0x4a2805,_0x1560e3));}})[_0x2c46('0x79')](function(_0x5f2ea8){ut[_0x2c46('0x60')](_0x2c46('0x108'),_0x5f2ea8);_0x39a485(ut['message'](_0x2c46('0x107'),![],!![]));});});};Preview[_0x2c46('0x64')][_0x2c46('0x102')]=function(_0x319d98){if(_[_0x2c46('0x6c')](_0x319d98)||_[_0x2c46('0xf1')](_0x319d98)||!_[_0x2c46('0x6c')](_0x319d98[0x0][_0x2c46('0x85')])&&_[_0x2c46('0x6c')](_0x319d98[0x0][_0x2c46('0x85')][_0x2c46('0x29')])){ut[_0x2c46('0x60')](_0x2c46('0x109'),_0x319d98);return{'isValid':![],'message':_0x2c46('0x10a')};}var _0x249496=this[_0x2c46('0x14')][_0x319d98[0x0]['Queue'][_0x2c46('0x29')]];_0x249496['message']=_0x2c46('0x10b');if(_[_0x2c46('0x6c')](_0x249496)){ut[_0x2c46('0x60')](_0x2c46('0x10c'),_0x249496);return{'isValid':![],'message':_0x2c46('0x10d')};}if(!this['isTrunkReachable'](_0x249496[_0x2c46('0x53')])){ut[_0x2c46('0x60')](_0x2c46('0x10e'),_0x2c46('0x10f')+_0x249496[_0x2c46('0x29')]+_0x2c46('0x110'));if(!this['isTrunkReachable'](_0x249496[_0x2c46('0x97')])){ut['logger'](_0x2c46('0x10e'),_0x249496[_0x2c46('0x29')]+'\x20Trunk\x20Backup\x20is\x20not\x20active');return{'isValid':![],'message':_0x2c46('0x111')};}}if(!ut['isActive'](_0x249496[_0x2c46('0x32')])){ut[_0x2c46('0x60')](_0x2c46('0x112'),_0x249496[_0x2c46('0x29')]+_0x2c46('0x113'));return{'isValid':![],'message':_0x2c46('0x10f')+_0x249496[_0x2c46('0x29')]+_0x2c46('0x113')};}return{'isValid':!![],'message':_0x2c46('0x114')};};Preview['prototype'][_0x2c46('0x115')]=function(_0x5c1310,_0x47f4ea,_0xe22e2e,_0x92b495){var _0x3eb4b3=this;return new BPromise(function(_0x3f174b,_0x5235db){var _0x30dcfe=_0x5c1310[_0x2c46('0xab')];var _0x3f0f69=_0x3eb4b3[_0x2c46('0x96')](_0x47f4ea[_0x2c46('0x53')])?util[_0x2c46('0x56')]('SIP/%s/%s%s',_0x47f4ea[_0x2c46('0x53')][_0x2c46('0x29')],_[_0x2c46('0x6c')](_0x47f4ea[_0x2c46('0x116')])?'':_0x47f4ea[_0x2c46('0x116')][_0x2c46('0x117')]()||'',_0x47f4ea[_0x2c46('0x118')]>0x0?_0xe22e2e[_0x2c46('0xef')][_0x2c46('0x119')][_0x2c46('0x11a')](_0x47f4ea['dialCutDigit']):_0xe22e2e[_0x2c46('0xef')]['phone']):util['format']('SIP/%s/%s%s',_['isNil'](_0x47f4ea[_0x2c46('0x97')])?_0x47f4ea['Trunk'][_0x2c46('0x29')]:_0x47f4ea[_0x2c46('0x97')]['name'],_[_0x2c46('0x6c')](_0x47f4ea[_0x2c46('0x116')])?'':_0x47f4ea[_0x2c46('0x116')][_0x2c46('0x117')]()||'',_0x47f4ea[_0x2c46('0x118')]>0x0?_0xe22e2e[_0x2c46('0xef')][_0x2c46('0x119')][_0x2c46('0x11a')](_0x47f4ea[_0x2c46('0x118')]):_0xe22e2e['Contact'][_0x2c46('0x119')]);var _0x2802da=_0x3eb4b3[_0x2c46('0x96')](_0x47f4ea[_0x2c46('0x53')])?ut[_0x2c46('0x11b')](_0x47f4ea[_0x2c46('0x53')][_0x2c46('0x11c')],_0x47f4ea[_0x2c46('0x34')],_0x47f4ea[_0x2c46('0x11d')]>0x0?ut['getCallerIdRandom'](_0x47f4ea['dialOriginateCallerIdNumber'],_0x47f4ea[_0x2c46('0x11d')]):_0x47f4ea[_0x2c46('0x11e')]):ut[_0x2c46('0x11b')](_[_0x2c46('0x6c')](_0x47f4ea[_0x2c46('0x97')])?_0x47f4ea[_0x2c46('0x53')]['callerid']:_0x47f4ea[_0x2c46('0x97')]['callerid'],_0x47f4ea[_0x2c46('0x34')],_0x47f4ea[_0x2c46('0x11d')]>0x0?ut[_0x2c46('0x11f')](_0x47f4ea['dialOriginateCallerIdNumber'],_0x47f4ea[_0x2c46('0x11d')]):_0x47f4ea['dialOriginateCallerIdNumber']);if(_0x2802da){_0x5c1310[_0x2c46('0x120')]=ut[_0x2c46('0x121')](_0x2802da);_0x5c1310[_0x2c46('0x122')]=ut[_0x2c46('0x123')](_0x2802da);}var _0x28694b=ut[_0x2c46('0x124')](_0x47f4ea,_0xe22e2e,_0x3f0f69,_0x2802da,_0x30dcfe,_0x5c1310);_[_0x2c46('0x125')](_0x5c1310,ut[_0x2c46('0x126')](_0x28694b));_0x5c1310['starttime']=moment()['format'](_0x2c46('0x8c'));ami[_0x2c46('0x127')](ut[_0x2c46('0x128')](_0x5c1310,_0x47f4ea,_0x28694b,_0x5c1310[_0x2c46('0xa6')],_0x92b495))[_0x2c46('0x82')](function(_0x308890){_0x47f4ea[_0x2c46('0x4e')]+=0x1;logger[_0x2c46('0x58')](_0x2c46('0x129'),_0x30dcfe,_0x2c46('0xac'),_0x47f4ea[_0x2c46('0x29')],_0x2c46('0xe0'),_0x47f4ea[_0x2c46('0x4e')]);_0x3f174b(_0x308890);})['catch'](function(_0x171f72){ut[_0x2c46('0xe8')](_0x5c1310,0xe,_0x2c46('0x12a'));rpcDb[_0x2c46('0xe6')](_0x5c1310,_0x2c46('0x12b'));_0x5235db(_0x171f72);});});};Preview[_0x2c46('0x64')]['syncNewExten']=function(_0x403fcf){if(this[_0x2c46('0x17')][_0x403fcf[_0x2c46('0xa7')]]){this[_0x2c46('0x17')][_0x403fcf[_0x2c46('0xa7')]]['channel']=_0x403fcf[_0x2c46('0x78')];}};Preview[_0x2c46('0x64')][_0x2c46('0x12c')]=function(_0x377109){var _0x3e85fa=this;var _0x2e8104=this[_0x2c46('0x17')][_0x377109[_0x2c46('0x12d')]];if(_0x2e8104){if(_0x2e8104['lookAgent']&&this[_0x2c46('0x18')][_0x2e8104[_0x2c46('0xf0')]]){ut[_0x2c46('0x12e')](_0x2e8104,this[_0x2c46('0x18')][_0x2e8104[_0x2c46('0xf0')]][_0x2c46('0x29')],this['agents'][_0x2e8104['lookAgent']]['id']);}var _0x3338c4=_[_0x2c46('0x12f')](_0x2e8104);_0x3338c4[_0x2c46('0xa8')]=moment()['format'](_0x2c46('0x8c'));var _0x42c168=_0x3e85fa[_0x2c46('0x14')][_0x2e8104['queue']];if(ut[_0x2c46('0x130')](_0x377109[_0x2c46('0x131')])){if(_0x2e8104[_0x2c46('0xa5')]){rpcDb['unlockContact'](_0x2e8104[_0x2c46('0xf4')]);}if(_0x2e8104[_0x2c46('0xa6')]){rpcDb[_0x2c46('0x8a')](_0x2e8104[_0x2c46('0xf4')]);}ami[_0x2c46('0x26')](_0x2c46('0x132'),ut[_0x2c46('0x9d')](_0x2e8104,_0x2c46('0x133')));this[_0x2c46('0xe2')](_0x3338c4,_0x42c168,_0x377109);}else{_0x2e8104['starttime']=moment()[_0x2c46('0x56')](_0x2c46('0x8c'));ut[_0x2c46('0xe8')](_0x3338c4,0x4,'Answer');rpcDb[_0x2c46('0xe6')](_0x3338c4,_0x2c46('0x134'));}}};Preview[_0x2c46('0x64')]['syncHangup']=function(_0x5afd8d){var _0x1a6282=this;var _0xdd991=this[_0x2c46('0x17')][_0x5afd8d['linkedid']];var _0x18bff6;if(_0xdd991){_0x18bff6=this[_0x2c46('0x14')][_0xdd991[_0x2c46('0x6f')]];logger[_0x2c46('0x58')](_0x2c46('0x135'),_0x5afd8d[_0x2c46('0xa7')],'\x20Queue',_0x18bff6[_0x2c46('0x29')],_0x2c46('0x70'),_0x18bff6[_0x2c46('0x5d')]);}if(this[_0x2c46('0x17')][_0x5afd8d['linkedid']]&&_0x5afd8d[_0x2c46('0xa7')]!==_0x5afd8d[_0x2c46('0xab')]){if(_0x5afd8d[_0x2c46('0x136')]==='16'&&this[_0x2c46('0x17')][_0x5afd8d[_0x2c46('0xa7')]]['dialAnswer']){this[_0x2c46('0x98')](_0x5afd8d,_0x5afd8d[_0x2c46('0xa7')],_0x5afd8d[_0x2c46('0x136')]);}else if(this['actions'][_0x5afd8d[_0x2c46('0xa7')]][_0x2c46('0x71')]){logger['info']('[syncHangup][talking][cause]',_0x5afd8d[_0x2c46('0xa7')],_0x5afd8d[_0x2c46('0x136')],_0x2c46('0xac'),_0x18bff6['name'],_0x2c46('0x70'),_0x18bff6[_0x2c46('0x5d')]);this[_0x2c46('0x98')](_0x5afd8d,_0x5afd8d[_0x2c46('0xa7')],_0x5afd8d[_0x2c46('0x136')]);}}else if(_0xdd991&&_[_0x2c46('0x6c')](_0xdd991['statedesc'])&&_0x18bff6[_0x2c46('0x137')]&&_0x5afd8d['linkedid']===_0x5afd8d[_0x2c46('0xab')]&&_[_0x2c46('0x6c')](_0x5afd8d[_0x2c46('0xe5')])&&_0x5afd8d[_0x2c46('0x136')]==='16'&&_0x5afd8d[_0x2c46('0x138')]==='6'&&_['isUndefined'](_0xdd991[_0x2c46('0x139')])){if(_0xdd991['unlockAgent']){rpcDb['unlockContact'](_0xdd991[_0x2c46('0xf4')]);}if(_0xdd991[_0x2c46('0xa6')]){rpcDb[_0x2c46('0x8a')](_0xdd991[_0x2c46('0xf4')]);}_0x5afd8d['reason']='22';this[_0x2c46('0xe2')](_0xdd991,_0x18bff6,_0x5afd8d);}else if(_0xdd991&&_0xdd991[_0x2c46('0x139')]){if(_0x5afd8d[_0x2c46('0x136')]==='16'&&this['actions'][_0x5afd8d[_0x2c46('0xa7')]][_0x2c46('0x71')]){logger[_0x2c46('0x58')](_0x2c46('0x13a'),_0x5afd8d[_0x2c46('0xa7')],_0x5afd8d[_0x2c46('0x136')],'\x20Queue',_0x18bff6[_0x2c46('0x29')],'pTalking:\x20',_0x18bff6[_0x2c46('0x5d')]);this[_0x2c46('0x98')](_0x5afd8d,_0x5afd8d['linkedid'],_0x5afd8d[_0x2c46('0x136')]);}else if(this[_0x2c46('0x17')][_0x5afd8d[_0x2c46('0xa7')]][_0x2c46('0x71')]){logger[_0x2c46('0x58')](_0x2c46('0x13b'),_0x5afd8d[_0x2c46('0xa7')],_0x5afd8d[_0x2c46('0x136')],_0x2c46('0xac'),_0x18bff6[_0x2c46('0x29')],'pTalking:\x20',_0x18bff6[_0x2c46('0x5d')]);this[_0x2c46('0x98')](_0x5afd8d,_0x5afd8d['linkedid'],_0x5afd8d[_0x2c46('0x136')]);}}};Preview[_0x2c46('0x64')][_0x2c46('0x1f')]=function(_0x1b79c4){if(this[_0x2c46('0x17')][_0x1b79c4[_0x2c46('0x13c')]]&&_0x1b79c4[_0x2c46('0x13c')]!==_0x1b79c4[_0x2c46('0x13d')]){this[_0x2c46('0x98')](_0x1b79c4,_0x1b79c4[_0x2c46('0x13c')],_0x1b79c4['dialstatus']);}};Preview[_0x2c46('0x64')][_0x2c46('0x1d')]=function(_0x5ebbbf){if(this[_0x2c46('0x17')][_0x5ebbbf[_0x2c46('0xa7')]]&&_0x5ebbbf[_0x2c46('0xa7')]!==_0x5ebbbf[_0x2c46('0xab')]&&!this[_0x2c46('0x17')][_0x5ebbbf[_0x2c46('0xa7')]][_0x2c46('0x71')]){if(_0x5ebbbf['cause']==='1'){this[_0x2c46('0x98')](_0x5ebbbf,_0x5ebbbf[_0x2c46('0xa7')],_0x5ebbbf[_0x2c46('0x136')]);}}};Preview[_0x2c46('0x64')][_0x2c46('0x13e')]=function(_0x1854cf,_0x6c7dc4,_0x479806){if(this['actions'][_0x1854cf]){if(_['isNil'](this[_0x2c46('0x17')][_0x1854cf][_0x2c46('0x13f')])){this[_0x2c46('0x17')][_0x1854cf][_0x2c46('0x13f')]={};}this[_0x2c46('0x17')][_0x1854cf]['variables'][_0x6c7dc4]=_0x479806;}};Preview[_0x2c46('0x64')][_0x2c46('0x140')]=function(_0x39191a){try{if(!_[_0x2c46('0x6c')](_0x39191a)){if(ut[_0x2c46('0x141')](_['keys'](_0x39191a['variable'])[0x0])){this[_0x2c46('0x13e')](_0x39191a[_0x2c46('0xab')],_[_0x2c46('0x142')](_0x39191a['variable'])[0x0],_0x39191a['value']);}}}catch(_0x42bc7f){logger[_0x2c46('0x143')](_0x2c46('0x144'),util[_0x2c46('0x145')](_0x42bc7f,{'showHidden':![],'depth':null}));}};Preview[_0x2c46('0x64')][_0x2c46('0x23')]=function(_0x348ab3){if(_0x348ab3){if(this[_0x2c46('0x17')][_0x348ab3[_0x2c46('0x146')]]){this['actions'][_0x348ab3[_0x2c46('0x146')]]['transfer']=!![];}}};Preview[_0x2c46('0x64')][_0x2c46('0x24')]=function(_0x15f364){if(_0x15f364){if(this[_0x2c46('0x17')][_0x15f364['transfererlinkedid']]){this[_0x2c46('0x17')][_0x15f364[_0x2c46('0x147')]]['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 cf9a1a0..30af602 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 _0x56a4=['catch','createHistory','[createHistory]\x20','moveContactManagedDialer','checkIsBlackList','[checkIsBlackList]\x20','getContactPreview','[getContactPreview]\x20','createCustomerFinal','rescheduleContact','active','countReScheduled','[countReScheduled]\x20','unlockContact','disableContact','[activeContact]\x20','crateCustomerReportQueue','uniqueid','calleridnum','calleridname','queue','queuecallerjoinAt','queuecallerleaveAt','answertime','queuecallercomplete','endtime','connectedlinename','context','from-sip','exten','xcally-motion-preview','holdtime','lastAssignedTo','membername','queuecallerexitreason','getContactRecallMe','rescheduleContactInQueue','[rescheduleContactInQueue]\x20','util','bluebird','preview','lodash','../rpc/cmHopperHistory','../rpc/cmHopperBlack','../rpc/voiceQueueRt','../rpc/agentReportPreview','../rpc/voiceQueueReport','resolve','then'];(function(_0x52a0f9,_0x1613f8){var _0x43dafa=function(_0x8f2924){while(--_0x8f2924){_0x52a0f9['push'](_0x52a0f9['shift']());}};_0x43dafa(++_0x1613f8);}(_0x56a4,0x11b));var _0x456a=function(_0x4e4061,_0x26503b){_0x4e4061=_0x4e4061-0x0;var _0x371dbd=_0x56a4[_0x4e4061];return _0x371dbd;};'use strict';var util=require(_0x456a('0x0'));var BPromise=require(_0x456a('0x1'));var logger=require('../../../config/logger')(_0x456a('0x2'));var _=require(_0x456a('0x3'));var cmHopper=require('../rpc/cmHopper');var cmHopperFinal=require('../rpc/cmHopperFinal');var cmHopperHistory=require(_0x456a('0x4'));var cmHopperBlack=require(_0x456a('0x5'));var voiceQueueRt=require(_0x456a('0x6'));var agentReportPreview=require(_0x456a('0x7'));var voiceQueueReport=require(_0x456a('0x8'));function loggerCatch(_0x4b8eec){return function(_0x3b0145){logger['error'](_0x4b8eec,util['inspect'](_0x3b0145,{'showHidden':![],'depth':null}));};}function create(_0x2b6329){return BPromise[_0x456a('0x9')]()[_0x456a('0xa')](cmHopperHistory['createHistory'](_0x2b6329))[_0x456a('0xb')](loggerCatch('[createHistory]\x20'));}function createAgent(_0xb56df){return BPromise[_0x456a('0x9')]()[_0x456a('0xa')](agentReportPreview[_0x456a('0xc')](_0xb56df))[_0x456a('0xb')](loggerCatch(_0x456a('0xd')));}function moveContact(_0x1179fa){return BPromise[_0x456a('0x9')]()[_0x456a('0xa')](cmHopper[_0x456a('0xe')](_0x1179fa,!![]))[_0x456a('0xb')](loggerCatch('[moveContactManagedDialer]\x20'));}exports[_0x456a('0xf')]=function(_0x5284ce){return BPromise['resolve']()[_0x456a('0xa')](cmHopperBlack[_0x456a('0xf')](_0x5284ce))[_0x456a('0xb')](loggerCatch(_0x456a('0x10')));};exports['getContactPreview']=function(_0x10cc0d){return BPromise[_0x456a('0x9')]()[_0x456a('0xa')](cmHopper[_0x456a('0x11')](_0x10cc0d))[_0x456a('0xb')](loggerCatch(_0x456a('0x12')));};exports['createHistory']=function(_0x410df4,_0x42f7d8){create(_0x410df4)[_0x456a('0xb')](loggerCatch(_0x42f7d8));moveContact(_0x410df4)[_0x456a('0xb')](loggerCatch(_0x42f7d8));};exports['createAgentHistory']=function(_0x200eda,_0x448fd6){createAgent(_0x200eda)[_0x456a('0xb')](loggerCatch(_0x448fd6));};exports['createCustomerHistory']=function(_0x3d06b4,_0x520f2f){create(_0x3d06b4)['catch'](loggerCatch(_0x520f2f));};exports[_0x456a('0x13')]=function(_0x562cfa,_0x44d79a){moveContact(_0x562cfa)['catch'](loggerCatch(_0x44d79a));};exports[_0x456a('0x14')]=function(_0x17d0ae,_0x55054e,_0x55a795){if(_0x55054e){_0x17d0ae['UserId']=null;}if(_0x55a795){_0x17d0ae[_0x456a('0x15')]=![];}return BPromise[_0x456a('0x9')]()[_0x456a('0xa')](cmHopper['rescheduleContact'](_0x17d0ae))[_0x456a('0xb')](loggerCatch('[rescheduleContact]\x20'));};exports['countReScheduled']=function(_0x59b47e){return BPromise[_0x456a('0x9')]()[_0x456a('0xa')](cmHopper[_0x456a('0x16')](_0x59b47e))['catch'](loggerCatch(_0x456a('0x17')));};exports[_0x456a('0x18')]=function(_0x5b3bef){return BPromise[_0x456a('0x9')]()['then'](cmHopper['unlockContact']({'UserId':null},_0x5b3bef,0x1))[_0x456a('0xb')](loggerCatch('[unlockContact]\x20'));};exports[_0x456a('0x19')]=function(_0x5e6de5){return BPromise[_0x456a('0x9')]()[_0x456a('0xa')](cmHopper[_0x456a('0x18')]({'active':![]},_0x5e6de5,0x1))[_0x456a('0xb')](loggerCatch(_0x456a('0x1a')));};exports[_0x456a('0x1b')]=function(_0x46f3b3){var _0x25da31={};_0x25da31['type']=_0x46f3b3['type'];_0x25da31['uniqueid']=_0x46f3b3[_0x456a('0x1c')];_0x25da31[_0x456a('0x1d')]=_0x46f3b3['calleridnum'];_0x25da31[_0x456a('0x1e')]=_0x46f3b3[_0x456a('0x1e')];_0x25da31[_0x456a('0x1f')]=_0x46f3b3[_0x456a('0x1f')];_0x25da31[_0x456a('0x20')]=_0x46f3b3['answertime'];_0x25da31[_0x456a('0x21')]=_0x46f3b3[_0x456a('0x22')];_0x25da31[_0x456a('0x23')]=0x1;_0x25da31['queuecallercompleteAt']=_0x46f3b3[_0x456a('0x24')];_0x25da31[_0x456a('0x25')]=_0x46f3b3['membername'];_0x25da31[_0x456a('0x26')]=_0x456a('0x27');_0x25da31[_0x456a('0x28')]=_0x456a('0x29');_0x25da31[_0x456a('0x2a')]=0x0;_0x25da31['assigned']=0x1;_0x25da31[_0x456a('0x2b')]=_0x46f3b3[_0x456a('0x2c')];_0x25da31[_0x456a('0x2d')]='COMPLETED';return BPromise['resolve']()[_0x456a('0xa')](voiceQueueReport['create'](_0x25da31))['catch'](loggerCatch('[voiceQueueReport]\x20'));};exports[_0x456a('0x2e')]=function(_0x7f1a33,_0x425055){return BPromise[_0x456a('0x9')]()['then'](cmHopper[_0x456a('0x2e')](_0x7f1a33,_0x425055))[_0x456a('0xb')](loggerCatch('[GetContactRecallMe]\x20'));};exports[_0x456a('0x2f')]=function(_0x1dddef){return BPromise[_0x456a('0x9')]()[_0x456a('0xa')](cmHopper[_0x456a('0x14')](_0x1dddef,!![],!![]))['catch'](loggerCatch(_0x456a('0x30')));}; \ No newline at end of file +var _0x4b19=['queuecallerjoinAt','answertime','queuecallerleaveAt','queuecallercomplete','queuecallercompleteAt','connectedlinename','context','xcally-motion-preview','holdtime','assigned','lastAssignedTo','membername','queuecallerexitreason','COMPLETED','create','[voiceQueueReport]\x20','getContactRecallMe','[GetContactRecallMe]\x20','rescheduleContactInQueue','[rescheduleContactInQueue]\x20','util','../../../config/logger','preview','lodash','../rpc/cmHopperFinal','../rpc/cmHopperHistory','../rpc/cmHopperBlack','../rpc/agentReportPreview','../rpc/voiceQueueReport','error','resolve','then','catch','createHistory','[createHistory]\x20','moveContactManagedDialer','[moveContactManagedDialer]\x20','[checkIsBlackList]\x20','getContactPreview','[getContactPreview]\x20','createAgentHistory','createCustomerHistory','createCustomerFinal','UserId','active','rescheduleContact','[rescheduleContact]\x20','unlockContact','[unlockContact]\x20','crateCustomerReportQueue','type','uniqueid','calleridnum','calleridname','queue'];(function(_0x3535b8,_0x13a753){var _0xf2e2f3=function(_0x5c9928){while(--_0x5c9928){_0x3535b8['push'](_0x3535b8['shift']());}};_0xf2e2f3(++_0x13a753);}(_0x4b19,0x195));var _0x94b1=function(_0x2508ce,_0x1c2d31){_0x2508ce=_0x2508ce-0x0;var _0x470995=_0x4b19[_0x2508ce];return _0x470995;};'use strict';var util=require(_0x94b1('0x0'));var BPromise=require('bluebird');var logger=require(_0x94b1('0x1'))(_0x94b1('0x2'));var _=require(_0x94b1('0x3'));var cmHopper=require('../rpc/cmHopper');var cmHopperFinal=require(_0x94b1('0x4'));var cmHopperHistory=require(_0x94b1('0x5'));var cmHopperBlack=require(_0x94b1('0x6'));var voiceQueueRt=require('../rpc/voiceQueueRt');var agentReportPreview=require(_0x94b1('0x7'));var voiceQueueReport=require(_0x94b1('0x8'));function loggerCatch(_0x52d6c1){return function(_0x24df76){logger[_0x94b1('0x9')](_0x52d6c1,util['inspect'](_0x24df76,{'showHidden':![],'depth':null}));};}function create(_0x40c69c){return BPromise[_0x94b1('0xa')]()[_0x94b1('0xb')](cmHopperHistory['createHistory'](_0x40c69c))[_0x94b1('0xc')](loggerCatch('[createHistory]\x20'));}function createAgent(_0x4aafcc){return BPromise[_0x94b1('0xa')]()[_0x94b1('0xb')](agentReportPreview[_0x94b1('0xd')](_0x4aafcc))[_0x94b1('0xc')](loggerCatch(_0x94b1('0xe')));}function moveContact(_0x3aeb91){return BPromise['resolve']()[_0x94b1('0xb')](cmHopper[_0x94b1('0xf')](_0x3aeb91,!![]))[_0x94b1('0xc')](loggerCatch(_0x94b1('0x10')));}exports['checkIsBlackList']=function(_0x4a4fe6){return BPromise[_0x94b1('0xa')]()[_0x94b1('0xb')](cmHopperBlack['checkIsBlackList'](_0x4a4fe6))['catch'](loggerCatch(_0x94b1('0x11')));};exports[_0x94b1('0x12')]=function(_0x48a13c){return BPromise[_0x94b1('0xa')]()['then'](cmHopper['getContactPreview'](_0x48a13c))[_0x94b1('0xc')](loggerCatch(_0x94b1('0x13')));};exports[_0x94b1('0xd')]=function(_0x1977f4,_0x494138){create(_0x1977f4)[_0x94b1('0xc')](loggerCatch(_0x494138));moveContact(_0x1977f4)[_0x94b1('0xc')](loggerCatch(_0x494138));};exports[_0x94b1('0x14')]=function(_0x224099,_0x3a6ae0){createAgent(_0x224099)[_0x94b1('0xc')](loggerCatch(_0x3a6ae0));};exports[_0x94b1('0x15')]=function(_0x59d7cf,_0x30f969){create(_0x59d7cf)[_0x94b1('0xc')](loggerCatch(_0x30f969));};exports[_0x94b1('0x16')]=function(_0x5deb20,_0x4490c9){moveContact(_0x5deb20)[_0x94b1('0xc')](loggerCatch(_0x4490c9));};exports['rescheduleContact']=function(_0x602c3b,_0x310b9f,_0x29af54){if(_0x310b9f){_0x602c3b[_0x94b1('0x17')]=null;}if(_0x29af54){_0x602c3b[_0x94b1('0x18')]=![];}return BPromise[_0x94b1('0xa')]()[_0x94b1('0xb')](cmHopper[_0x94b1('0x19')](_0x602c3b))[_0x94b1('0xc')](loggerCatch(_0x94b1('0x1a')));};exports['countReScheduled']=function(_0xa333a8){return BPromise[_0x94b1('0xa')]()[_0x94b1('0xb')](cmHopper['countReScheduled'](_0xa333a8))[_0x94b1('0xc')](loggerCatch('[countReScheduled]\x20'));};exports[_0x94b1('0x1b')]=function(_0x3d10ea){return BPromise[_0x94b1('0xa')]()[_0x94b1('0xb')](cmHopper['unlockContact']({'UserId':null},_0x3d10ea,0x1))['catch'](loggerCatch(_0x94b1('0x1c')));};exports['disableContact']=function(_0x1aa525){return BPromise['resolve']()[_0x94b1('0xb')](cmHopper[_0x94b1('0x1b')]({'active':![]},_0x1aa525,0x1))[_0x94b1('0xc')](loggerCatch('[activeContact]\x20'));};exports[_0x94b1('0x1d')]=function(_0x1d86bd){var _0x467c42={};_0x467c42[_0x94b1('0x1e')]=_0x1d86bd[_0x94b1('0x1e')];_0x467c42[_0x94b1('0x1f')]=_0x1d86bd[_0x94b1('0x1f')];_0x467c42[_0x94b1('0x20')]=_0x1d86bd[_0x94b1('0x20')];_0x467c42['calleridname']=_0x1d86bd[_0x94b1('0x21')];_0x467c42[_0x94b1('0x22')]=_0x1d86bd['queue'];_0x467c42[_0x94b1('0x23')]=_0x1d86bd[_0x94b1('0x24')];_0x467c42[_0x94b1('0x25')]=_0x1d86bd[_0x94b1('0x24')];_0x467c42[_0x94b1('0x26')]=0x1;_0x467c42[_0x94b1('0x27')]=_0x1d86bd['endtime'];_0x467c42[_0x94b1('0x28')]=_0x1d86bd['membername'];_0x467c42[_0x94b1('0x29')]='from-sip';_0x467c42['exten']=_0x94b1('0x2a');_0x467c42[_0x94b1('0x2b')]=0x0;_0x467c42[_0x94b1('0x2c')]=0x1;_0x467c42[_0x94b1('0x2d')]=_0x1d86bd[_0x94b1('0x2e')];_0x467c42[_0x94b1('0x2f')]=_0x94b1('0x30');return BPromise[_0x94b1('0xa')]()[_0x94b1('0xb')](voiceQueueReport[_0x94b1('0x31')](_0x467c42))[_0x94b1('0xc')](loggerCatch(_0x94b1('0x32')));};exports['getContactRecallMe']=function(_0x58e4d0,_0x2da4ac){return BPromise[_0x94b1('0xa')]()[_0x94b1('0xb')](cmHopper[_0x94b1('0x33')](_0x58e4d0,_0x2da4ac))[_0x94b1('0xc')](loggerCatch(_0x94b1('0x34')));};exports[_0x94b1('0x35')]=function(_0x36a2f8){return BPromise[_0x94b1('0xa')]()['then'](cmHopper[_0x94b1('0x19')](_0x36a2f8,!![],!![]))['catch'](loggerCatch(_0x94b1('0x36')));}; \ No newline at end of file diff --git a/server/services/ami/preview/util/util.js b/server/services/ami/preview/util/util.js index 285dc77..348bce1 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 _0xef0f=['state','statedesc','Blacklist','starttime','responsetime','endtime','logAgent','ringtime','logLookAgent','logCustomer','talktime','answertime','isFailure','variablesAction','BOOKED','uniqueid','originate','from-sip','totalGlobal','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','clone','Global','active','scheduledat','add','minutes','ListId','decrementTalkink','pTalking','[decrementTalkink]\x20object\x20talking\x20is\x20negative','[decrementTalkink]\x20is\x20null\x20or\x20undefined','IsNotLoggedIn','lastevent','name','queue','channelAgent','buildAcw','interface','push','getDiff','createBody','filterKey','idContact','type','campaigntype','membername','countglobal','callback','callbackuniqueid','callbackat','recallme','UserId','sipcallid','xmd-voicequeueid','xmd-queue','xmd-phone','xmd-listid','xmd-dialtimeout','xmd-dialoptions','xmd-dialid','xmd-dialchannel','xmd-contactid','xmd-cdrtype','xmd-callerid','xmd-agiafter','xmd-agi','rtpaudioqos','rtpaudioqosjitter','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrttbridged','rtpaudioqosbridged','rtpaudioqosjitterbridged','rtpaudioqosrtt','bridgepvtcallid','getCallerIdRandom','\x5cw{0,','pow','replace','extractCalleridName','match','util','moment','../../../../config/logger','preview','XCALLY_IP_AGI','127.0.0.1','milliseconds','diff','seconds','error','inspect','logger','info','loggerError','logger2','message','getCallerId','isEmpty','isUndefined','string','format','\x22%s\x22\x20<%s>','\x22\x22\x20<>','isActive','addVariables','Queue','calleridname','ContactId','dialer','VoiceQueueId','dialOriginateTimeout','\x22rtTxX%s%s\x22','monitor_format','U(xcally-mixmonitor-context)','dialPreviewUrl','dialQueueProject','\x22agi://%s/square,%s\x22','NONE','dialQueueProject2','originatecalleridnum','originatecalleridname','xcally-motion-preview','_XCALLY_MIXMONITOR_FORMAT','Contact','hasOwnProperty','%s%s','XMD-','updateOriginated','isNil','originated','[updateOriginated]\x20object\x20originated\x20is\x20negative','[updateOriginated]\x20is\x20null\x20or\x20undefined','logBlacklist','YYYY-MM-DD\x20HH:mm:ss'];(function(_0x229128,_0x273558){var _0x1875b9=function(_0x275e35){while(--_0x275e35){_0x229128['push'](_0x229128['shift']());}};_0x1875b9(++_0x273558);}(_0xef0f,0x168));var _0xfef0=function(_0xea6117,_0x58cb1c){_0xea6117=_0xea6117-0x0;var _0x42a6db=_0xef0f[_0xea6117];return _0x42a6db;};'use strict';var util=require(_0xfef0('0x0'));var _=require('lodash');var moment=require(_0xfef0('0x1'));var logger=require(_0xfef0('0x2'))(_0xfef0('0x3'));var ipAgi=process['env'][_0xfef0('0x4')]||_0xfef0('0x5');function getSeconds(_0x4618fb,_0x4e1af6){var _0x2a6fcf=moment(_0x4618fb)[_0xfef0('0x6')](0x0);var _0x2697df=moment(_0x4e1af6)[_0xfef0('0x6')](0x0);return _0x2a6fcf[_0xfef0('0x7')](_0x2697df,_0xfef0('0x8'));}exports['loggerCatch']=function(_0x41ec94){return function(_0x58cf6d){logger[_0xfef0('0x9')](_0x41ec94,util[_0xfef0('0xa')](_0x58cf6d,{'showHidden':![],'depth':null}));};};exports[_0xfef0('0xb')]=function(_0x2d42dc,_0x334e74){logger[_0xfef0('0xc')](_0x2d42dc,util[_0xfef0('0xa')](_0x334e74,{'showHidden':![],'depth':null}));};exports[_0xfef0('0xd')]=function(_0x11bbca,_0x111878){logger[_0xfef0('0x9')](_0x11bbca,util[_0xfef0('0xa')](_0x111878,{'showHidden':![],'depth':null}));};exports[_0xfef0('0xe')]=function(_0x1bdb7b){return function(_0x546c7a){logger[_0xfef0('0xc')](_0x1bdb7b,util[_0xfef0('0xa')](_0x546c7a,{'showHidden':![],'depth':null}));};};exports[_0xfef0('0xf')]=function(_0x30d61d,_0xe9f78d,_0x45599a){return{'message':_0x30d61d,'unlock':_0xe9f78d,'active':_0x45599a};};exports[_0xfef0('0x10')]=function(_0x573ae7,_0x3d1f02,_0x554aaa){if(!_['isUndefined'](_0x554aaa)&&'string'===typeof _0x554aaa&&!_[_0xfef0('0x11')](_0x554aaa)){if(!_[_0xfef0('0x12')](_0x3d1f02)&&_0xfef0('0x13')===typeof _0x3d1f02&&!_[_0xfef0('0x11')](_0x3d1f02)){return util[_0xfef0('0x14')](_0xfef0('0x15'),_0x3d1f02,_0x554aaa);}return util[_0xfef0('0x14')](_0xfef0('0x15'),_0x554aaa,_0x554aaa);}if(!_['isUndefined'](_0x573ae7)&&_0xfef0('0x13')===typeof _0x573ae7&&!_[_0xfef0('0x11')](_0x573ae7)){return _0x573ae7;}return _0xfef0('0x16');};exports[_0xfef0('0x17')]=function(_0x1ad020){if(_['isNil'](_0x1ad020)){return![];}return _0x1ad020;};exports[_0xfef0('0x18')]=function(_0x4e24de,_0x20826b,_0x1a0aa0,_0x28dee1,_0x48408a,_0x2be956){var _0x4c304d={'XMD-QUEUE':_0x20826b[_0xfef0('0x19')]?_0x20826b[_0xfef0('0x19')]['name']:'','XMD-CALLERID':_0x28dee1,'XMD-CALLERID-PREVIEW':_0x2be956?util['format']('\x22%s\x22\x20<%s>',_0x2be956[_0xfef0('0x1a')],_0x2be956['calleridnum']):_0x28dee1,'XMD-DIALID':_0x48408a,'XMD-CONTACTID':_0x20826b[_0xfef0('0x1b')],'XMD-CDRTYPE':_0xfef0('0x1c'),'CALLERID(all)':_0x28dee1,'XMD-VOICEQUEUEID':_0x20826b[_0xfef0('0x1d')],'XMD-DIALCHANNEL':_0x1a0aa0,'XMD-DIALTIMEOUT':_0x4e24de[_0xfef0('0x1e')]||0x1e,'XMD-DIALOPTIONS':util[_0xfef0('0x14')](_0xfef0('0x1f'),_0x4e24de['dialQueueProject2']?'g':'',_['isEmpty'](_0x4e24de[_0xfef0('0x20')])?'':_0xfef0('0x21')),'XMD-DIALURL':_0x4e24de[_0xfef0('0x22')]||'','XMD-AGI':_0x4e24de[_0xfef0('0x23')]?util[_0xfef0('0x14')](_0xfef0('0x24'),ipAgi,_0x4e24de[_0xfef0('0x23')]):_0xfef0('0x25'),'XMD-AGIAFTER':_0x4e24de[_0xfef0('0x26')]?util['format'](_0xfef0('0x24'),ipAgi,_0x4e24de[_0xfef0('0x26')]):_0xfef0('0x25'),'XMD-ORIGINATECALLERIDNUM':_0x2be956?_0x2be956[_0xfef0('0x27')]:'','XMD-ORIGINATECALLERIDNAME':_0x2be956?_0x2be956[_0xfef0('0x28')]:'','XMD-DESTINATION':_0xfef0('0x29')};if(!_[_0xfef0('0x11')](_0x4e24de[_0xfef0('0x20')])){_0x4c304d[util[_0xfef0('0x14')]('%s',_0xfef0('0x2a'))]=_0x4e24de[_0xfef0('0x20')];_0x4c304d[util[_0xfef0('0x14')]('%s','_XCALLY_MIXMONITOR_UNIQUEID')]=_0x48408a;}if(_0x20826b&&_0x20826b[_0xfef0('0x2b')]){for(var _0x5806bd in _0x20826b['Contact']){if(_0x20826b[_0xfef0('0x2b')][_0xfef0('0x2c')](_0x5806bd)){if(!_['isNil'](_0x20826b['Contact'][_0x5806bd])&&_0x5806bd!=='id'&&_0x5806bd!=='tags'&&_0x5806bd!=='createdAt'&&_0x5806bd!=='updatedAt'){_0x4c304d[util[_0xfef0('0x14')](_0xfef0('0x2d'),_0xfef0('0x2e'),_['toUpper'](_0x5806bd))]=_0x20826b['Contact'][_0x5806bd];}}}}return _0x4c304d;};exports['toLowerVariables']=function(_0x1f8110){var _0x55c458={};for(var _0x215032 in _0x1f8110){if(_0x1f8110[_0xfef0('0x2c')](_0x215032)){_0x55c458[util[_0xfef0('0x14')]('%s',_['toLower'](_0x215032))]=_0x1f8110[_0x215032];}}return{'variables':_0x55c458};};exports[_0xfef0('0x2f')]=function(_0x4c3a0f,_0x4234e4){if(!_[_0xfef0('0x30')](_0x4c3a0f)){if(_0x4c3a0f[_0xfef0('0x2c')](_0xfef0('0x31'))){if(_0x4c3a0f[_0xfef0('0x31')]>0x0){_0x4c3a0f[_0xfef0('0x31')]-=0x1;}else{logger[_0xfef0('0x9')](_0xfef0('0x32'),_0x4234e4);}}}else{logger['error'](_0xfef0('0x33'),_0x4234e4);}};exports[_0xfef0('0x34')]=function(_0x388518){var _0x36b2d1=moment()[_0xfef0('0x14')](_0xfef0('0x35'));_0x388518[_0xfef0('0x36')]=0xd;_0x388518[_0xfef0('0x37')]=_0xfef0('0x38');_0x388518[_0xfef0('0x39')]=_0x36b2d1;_0x388518[_0xfef0('0x3a')]=_0x36b2d1;_0x388518[_0xfef0('0x3b')]=_0x36b2d1;};exports[_0xfef0('0x3c')]=function(_0x4a8af4,_0x1f4a1e,_0x4a42a3){var _0x28e5c1=moment()[_0xfef0('0x14')](_0xfef0('0x35'));_0x4a8af4['state']=_0x1f4a1e;_0x4a8af4[_0xfef0('0x37')]=_0x4a42a3;_0x4a8af4[_0xfef0('0x3a')]=_0x28e5c1;_0x4a8af4[_0xfef0('0x3d')]=getSeconds(_0x4a8af4['responsetime'],_0x4a8af4[_0xfef0('0x39')]);};exports[_0xfef0('0x3e')]=function(_0x39b5c2,_0x5577f4,_0x3a6667){_0x39b5c2['membername']=_0x5577f4;_0x39b5c2['UserId']=_0x3a6667;};exports[_0xfef0('0x3f')]=function(_0x547a5d,_0x5c3305,_0xbf6ddd){var _0x61f1ce=moment()[_0xfef0('0x14')](_0xfef0('0x35'));_0x547a5d[_0xfef0('0x36')]=_0x5c3305;_0x547a5d[_0xfef0('0x37')]=_0xbf6ddd;_0x547a5d['responsetime']=_0x547a5d[_0xfef0('0x3a')]?_0x547a5d[_0xfef0('0x3a')]:_0x61f1ce;_0x547a5d['endtime']=_0x547a5d['endtime']?_0x547a5d[_0xfef0('0x3b')]:_0x61f1ce;_0x547a5d['ringtime']=getSeconds(_0x547a5d[_0xfef0('0x3a')]||0x0,_0x547a5d[_0xfef0('0x39')]||0x0);_0x547a5d[_0xfef0('0x40')]=_0x547a5d[_0xfef0('0x41')]?getSeconds(_0x547a5d[_0xfef0('0x3b')],_0x547a5d[_0xfef0('0x41')]):0x0;};exports[_0xfef0('0x42')]=function(_0x15b4a6){return _0x15b4a6==='Failure';};exports[_0xfef0('0x43')]=function(_0x50e372,_0x4b6da1,_0x18c656,_0x17d7f2,_0x5bf416){var _0x2af79f=_0x17d7f2?'RECALL':_0x50e372[_0xfef0('0x1a')];_0x2af79f=_0x5bf416?_0xfef0('0x44'):_0x2af79f;return{'actionid':_0x50e372[_0xfef0('0x45')],'action':_0xfef0('0x46'),'channel':_0x50e372['channelAgent'],'callerid':util[_0xfef0('0x14')](_0xfef0('0x15'),_0x2af79f,_0x50e372['calleridnum']),'Exten':'xcally-motion-preview','Context':_0xfef0('0x47'),'Priority':'1','variable':_0x18c656,'timeout':(_0x4b6da1['timeout']||0x1e)*0x3e8,'async':!![],'channelid':_0x50e372[_0xfef0('0x45')]};};exports[_0xfef0('0x48')]=function(_0x390247){return _0x390247[_0xfef0('0x49')]+_0x390247[_0xfef0('0x4a')]+_0x390247[_0xfef0('0x4b')]+_0x390247['countagentrejectretry']+_0x390247[_0xfef0('0x4c')];};exports['cloneAction']=function(_0x5a417e){var _0x2f11cb=_[_0xfef0('0x4d')](_0x5a417e);_0x2f11cb[_0xfef0('0x36')]=0xf;_0x2f11cb['statedesc']=_0xfef0('0x4e');return _0x2f11cb;};exports['scheduledAt']=function(_0x5dd26b,_0x51f207,_0x3a475a){var _0x3d471c={};_0x3d471c[_0x51f207]=_0x5dd26b[_0x51f207];_0x3d471c[_0xfef0('0x4f')]=![];_0x3d471c[_0xfef0('0x50')]=moment()[_0xfef0('0x51')](_0x3a475a,_0xfef0('0x52'))[_0xfef0('0x14')](_0xfef0('0x35'));_0x3d471c[_0xfef0('0x1b')]=_0x5dd26b['ContactId'];_0x3d471c['ListId']=_0x5dd26b[_0xfef0('0x53')];_0x3d471c[_0xfef0('0x1d')]=_0x5dd26b[_0xfef0('0x1d')]||undefined;return _0x3d471c;};exports[_0xfef0('0x54')]=function(_0x393fee,_0x1e1458){if(!_[_0xfef0('0x30')](_0x393fee)){if(_0x393fee[_0xfef0('0x55')]>0x0){_0x393fee['pTalking']-=0x1;}else{logger[_0xfef0('0x9')](_0x1e1458,_0xfef0('0x56'));}}else{logger[_0xfef0('0x9')](_0x1e1458,_0xfef0('0x57'));}};exports[_0xfef0('0x58')]=function(_0x5a00db){if(_0x5a00db<=0x0){return!![];}return![];};exports['buildObj']=function(_0x523763,_0x445f3f){_0x523763[_0xfef0('0x59')]=_0x445f3f;_0x523763[_0xfef0('0x5a')]=_0x523763[_0xfef0('0x5b')];_0x523763['interface']=_0x523763[_0xfef0('0x5c')];return _0x523763;};exports[_0xfef0('0x5d')]=function(_0x302908){var _0x28b90c={};_0x28b90c[_0xfef0('0x5b')]=_0x302908[_0xfef0('0x5b')];_0x28b90c[_0xfef0('0x5e')]=_0x302908['channelAgent'];_0x28b90c[_0xfef0('0x45')]=_0x302908[_0xfef0('0x45')];return _0x28b90c;};exports['agentReadyId']=function(_0x291f3f){var _0x59e7c4=[];for(var _0x175e97 in _0x291f3f){if(_0x291f3f[_0xfef0('0x2c')](_0x175e97)){if(!_['isNil'](_0x291f3f[_0x175e97])&&_0x291f3f[_0x175e97][_0xfef0('0x36')]==='not_inuse'&&_0x291f3f[_0x175e97]['status']==='reachable'){_0x59e7c4[_0xfef0('0x5f')](_0x291f3f[_0x175e97]['id']);}}}return _0x59e7c4;};exports[_0xfef0('0x60')]=function(_0x455923){var _0x34fda3=moment()[_0xfef0('0x6')](0x0);var _0x2d63e8=moment(_0x455923)['milliseconds'](0x0);return _0x34fda3[_0xfef0('0x7')](_0x2d63e8,_0xfef0('0x8'));};exports[_0xfef0('0x61')]=function(_0x45abb3){return{'active':![],'recallme':![],'UserId':null,'ContactId':_0x45abb3[_0xfef0('0x1b')],'ListId':_0x45abb3['ListId'],'VoiceQueueId':_0x45abb3[_0xfef0('0x1d')]||undefined,'CampaignId':_0x45abb3['CampaignId']||undefined};};exports[_0xfef0('0x62')]=function(_0x5d1c21){if(_0x5d1c21===_0xfef0('0x45')||_0x5d1c21===_0xfef0('0x63')||_0x5d1c21===_0xfef0('0x5b')||_0x5d1c21===_0xfef0('0x64')||_0x5d1c21===_0xfef0('0x65')||_0x5d1c21==='dialAnswer'||_0x5d1c21===_0xfef0('0x66')||_0x5d1c21==='channelAgent'||_0x5d1c21===_0xfef0('0x1a')||_0x5d1c21===_0xfef0('0x4f')||_0x5d1c21==='calleridnum'||_0x5d1c21===_0xfef0('0x50')||_0x5d1c21===_0xfef0('0x49')||_0x5d1c21===_0xfef0('0x4a')||_0x5d1c21===_0xfef0('0x4b')||_0x5d1c21===_0xfef0('0x67')||_0x5d1c21===_0xfef0('0x68')||_0x5d1c21===_0xfef0('0x69')||_0x5d1c21===_0xfef0('0x6a')||_0x5d1c21===_0xfef0('0x6b')||_0x5d1c21===_0xfef0('0x1b')||_0x5d1c21===_0xfef0('0x53')||_0x5d1c21===_0xfef0('0x6c')||_0x5d1c21==='VoiceQueueId'||_0x5d1c21===_0xfef0('0x6d')||_0x5d1c21===_0xfef0('0x6e')||_0x5d1c21===_0xfef0('0x6f')||_0x5d1c21===_0xfef0('0x70')||_0x5d1c21===_0xfef0('0x71')||_0x5d1c21==='xmd-dialurl'||_0x5d1c21===_0xfef0('0x72')||_0x5d1c21===_0xfef0('0x73')||_0x5d1c21===_0xfef0('0x74')||_0x5d1c21===_0xfef0('0x75')||_0x5d1c21===_0xfef0('0x76')||_0x5d1c21===_0xfef0('0x77')||_0x5d1c21===_0xfef0('0x78')||_0x5d1c21===_0xfef0('0x79')||_0x5d1c21===_0xfef0('0x7a')||_0x5d1c21===_0xfef0('0x7b')||_0x5d1c21==='rtpaudioqosbridged'||_0x5d1c21===_0xfef0('0x7c')||_0x5d1c21==='rtpaudioqosjitterbridged'||_0x5d1c21===_0xfef0('0x7d')||_0x5d1c21===_0xfef0('0x7e')||_0x5d1c21==='rtpaudioqosrtt'||_0x5d1c21===_0xfef0('0x7f')||_0x5d1c21===_0xfef0('0x7b')||_0x5d1c21===_0xfef0('0x80')||_0x5d1c21===_0xfef0('0x7c')||_0x5d1c21===_0xfef0('0x81')||_0x5d1c21==='rtpaudioqosloss'||_0x5d1c21===_0xfef0('0x7e')||_0x5d1c21===_0xfef0('0x82')||_0x5d1c21===_0xfef0('0x7f')||_0x5d1c21==='bridgepeer'||_0x5d1c21===_0xfef0('0x83')||_0x5d1c21===_0xfef0('0x36')||_0x5d1c21===_0xfef0('0x37')){return![];}return!![];};exports[_0xfef0('0x84')]=function(_0x7186c8,_0x3cfe32){var _0x45ba65,_0x48c2e1,_0x389181;if(_0x3cfe32<=0x0){_0x3cfe32=0x1;}_0x45ba65=new RegExp(_0xfef0('0x85')+_0x3cfe32+'}$');_0x48c2e1=Math[_0xfef0('0x86')](0xa,_0x3cfe32-0x1);_0x389181=Math[_0xfef0('0x86')](0xa,_0x3cfe32)-0x1;return util[_0xfef0('0x14')]('%s',_[_0xfef0('0x87')](_0x7186c8,_0x45ba65,_['random'](_0x48c2e1,_0x389181)));};exports[_0xfef0('0x88')]=function(_0x3e9a2f){var _0x100fc4=_0x3e9a2f[_0xfef0('0x89')](/"(.*?)"/);return _0x100fc4?_0x100fc4[0x1]:_0x3e9a2f;};exports['extractCalleridNumber']=function(_0x3221a1){var _0x24b25e=_0x3221a1['match'](/<(.*?)>/);return _0x24b25e?_0x24b25e[0x1]:_0x3221a1;}; \ No newline at end of file +var _0xffb1=['rtpaudioqosrtt','rtpaudioqosrttbridged','bridgepvtcallid','getCallerIdRandom','\x5cw{0,','pow','replace','random','extractCalleridName','match','extractCalleridNumber','util','lodash','moment','../../../../config/logger','preview','env','XCALLY_IP_AGI','127.0.0.1','milliseconds','diff','seconds','inspect','logger','loggerError','logger2','info','string','isEmpty','format','\x22%s\x22\x20<%s>','\x22\x22\x20<>','isActive','addVariables','Queue','name','calleridnum','ContactId','monitor_format','dialPreviewUrl','dialQueueProject','\x22agi://%s/square,%s\x22','NONE','dialQueueProject2','originatecalleridname','xcally-motion-preview','_XCALLY_MIXMONITOR_FORMAT','_XCALLY_MIXMONITOR_UNIQUEID','Contact','hasOwnProperty','isNil','tags','%s%s','XMD-','toLowerVariables','toLower','updateOriginated','originated','error','[updateOriginated]\x20object\x20originated\x20is\x20negative','logBlacklist','YYYY-MM-DD\x20HH:mm:ss','state','statedesc','Blacklist','starttime','responsetime','logAgent','ringtime','logLookAgent','membername','UserId','logCustomer','endtime','answertime','isFailure','Failure','RECALL','calleridname','BOOKED','uniqueid','channelAgent','timeout','countbusyretry','countnoanswerretry','countagentrejectretry','countnosuchnumberretry','cloneAction','clone','Global','scheduledAt','active','scheduledat','add','minutes','ListId','VoiceQueueId','decrementTalkink','pTalking','[decrementTalkink]\x20object\x20talking\x20is\x20negative','[decrementTalkink]\x20is\x20null\x20or\x20undefined','IsNotLoggedIn','lastevent','queue','interface','buildAcw','not_inuse','getDiff','createBody','CampaignId','filterKey','type','dialAnswer','countcongestionretry','countglobal','callback','callbackuniqueid','callbackat','xmd-voicequeueid','xmd-queue','xmd-phone','xmd-listid','xmd-dialurl','xmd-dialtimeout','xmd-dialoptions','xmd-dialchannel','xmd-contactid','xmd-cdrtype','xmd-callerid','xmd-agiafter','xmd-agi','rtpaudioqos','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqoslossbridged'];(function(_0x59522a,_0x14d1e5){var _0x30f09d=function(_0x5cab74){while(--_0x5cab74){_0x59522a['push'](_0x59522a['shift']());}};_0x30f09d(++_0x14d1e5);}(_0xffb1,0x93));var _0x1ffb=function(_0x1cfe2e,_0x1ebbcd){_0x1cfe2e=_0x1cfe2e-0x0;var _0x39233f=_0xffb1[_0x1cfe2e];return _0x39233f;};'use strict';var util=require(_0x1ffb('0x0'));var _=require(_0x1ffb('0x1'));var moment=require(_0x1ffb('0x2'));var logger=require(_0x1ffb('0x3'))(_0x1ffb('0x4'));var ipAgi=process[_0x1ffb('0x5')][_0x1ffb('0x6')]||_0x1ffb('0x7');function getSeconds(_0x41a84c,_0xc36826){var _0x53c232=moment(_0x41a84c)[_0x1ffb('0x8')](0x0);var _0x677ad0=moment(_0xc36826)[_0x1ffb('0x8')](0x0);return _0x53c232[_0x1ffb('0x9')](_0x677ad0,_0x1ffb('0xa'));}exports['loggerCatch']=function(_0x1787b1){return function(_0x4bcfb6){logger['error'](_0x1787b1,util[_0x1ffb('0xb')](_0x4bcfb6,{'showHidden':![],'depth':null}));};};exports[_0x1ffb('0xc')]=function(_0x88a91b,_0x5d1736){logger['info'](_0x88a91b,util[_0x1ffb('0xb')](_0x5d1736,{'showHidden':![],'depth':null}));};exports[_0x1ffb('0xd')]=function(_0x4feca5,_0x2594fe){logger['error'](_0x4feca5,util[_0x1ffb('0xb')](_0x2594fe,{'showHidden':![],'depth':null}));};exports[_0x1ffb('0xe')]=function(_0x327ef0){return function(_0x351de7){logger[_0x1ffb('0xf')](_0x327ef0,util[_0x1ffb('0xb')](_0x351de7,{'showHidden':![],'depth':null}));};};exports['message']=function(_0x192a16,_0x308bbf,_0x379a1e){return{'message':_0x192a16,'unlock':_0x308bbf,'active':_0x379a1e};};exports['getCallerId']=function(_0x208c0b,_0x5d1fba,_0x4c9431){if(!_['isUndefined'](_0x4c9431)&&_0x1ffb('0x10')===typeof _0x4c9431&&!_[_0x1ffb('0x11')](_0x4c9431)){if(!_['isUndefined'](_0x5d1fba)&&_0x1ffb('0x10')===typeof _0x5d1fba&&!_[_0x1ffb('0x11')](_0x5d1fba)){return util[_0x1ffb('0x12')](_0x1ffb('0x13'),_0x5d1fba,_0x4c9431);}return util['format'](_0x1ffb('0x13'),_0x4c9431,_0x4c9431);}if(!_['isUndefined'](_0x208c0b)&&_0x1ffb('0x10')===typeof _0x208c0b&&!_[_0x1ffb('0x11')](_0x208c0b)){return _0x208c0b;}return _0x1ffb('0x14');};exports[_0x1ffb('0x15')]=function(_0x650c2f){if(_['isNil'](_0x650c2f)){return![];}return _0x650c2f;};exports[_0x1ffb('0x16')]=function(_0x59539e,_0x30e2fd,_0x1d5d3f,_0x34dede,_0x5f4c16,_0x1ad8a9){var _0x4dd0ba={'XMD-QUEUE':_0x30e2fd[_0x1ffb('0x17')]?_0x30e2fd['Queue'][_0x1ffb('0x18')]:'','XMD-CALLERID':_0x34dede,'XMD-CALLERID-PREVIEW':_0x1ad8a9?util['format'](_0x1ffb('0x13'),_0x1ad8a9['calleridname'],_0x1ad8a9[_0x1ffb('0x19')]):_0x34dede,'XMD-DIALID':_0x5f4c16,'XMD-CONTACTID':_0x30e2fd[_0x1ffb('0x1a')],'XMD-CDRTYPE':'dialer','CALLERID(all)':_0x34dede,'XMD-VOICEQUEUEID':_0x30e2fd['VoiceQueueId'],'XMD-DIALCHANNEL':_0x1d5d3f,'XMD-DIALTIMEOUT':_0x59539e['dialOriginateTimeout']||0x1e,'XMD-DIALOPTIONS':util[_0x1ffb('0x12')]('\x22rtTxX%s%s\x22',_0x59539e['dialQueueProject2']?'g':'',_[_0x1ffb('0x11')](_0x59539e[_0x1ffb('0x1b')])?'':'U(xcally-mixmonitor-context)'),'XMD-DIALURL':_0x59539e[_0x1ffb('0x1c')]||'','XMD-AGI':_0x59539e[_0x1ffb('0x1d')]?util[_0x1ffb('0x12')](_0x1ffb('0x1e'),ipAgi,_0x59539e[_0x1ffb('0x1d')]):_0x1ffb('0x1f'),'XMD-AGIAFTER':_0x59539e[_0x1ffb('0x20')]?util['format'](_0x1ffb('0x1e'),ipAgi,_0x59539e[_0x1ffb('0x20')]):_0x1ffb('0x1f'),'XMD-ORIGINATECALLERIDNUM':_0x1ad8a9?_0x1ad8a9['originatecalleridnum']:'','XMD-ORIGINATECALLERIDNAME':_0x1ad8a9?_0x1ad8a9[_0x1ffb('0x21')]:'','XMD-DESTINATION':_0x1ffb('0x22')};if(!_[_0x1ffb('0x11')](_0x59539e['monitor_format'])){_0x4dd0ba[util[_0x1ffb('0x12')]('%s',_0x1ffb('0x23'))]=_0x59539e[_0x1ffb('0x1b')];_0x4dd0ba[util[_0x1ffb('0x12')]('%s',_0x1ffb('0x24'))]=_0x5f4c16;}if(_0x30e2fd&&_0x30e2fd[_0x1ffb('0x25')]){for(var _0x3f2d64 in _0x30e2fd[_0x1ffb('0x25')]){if(_0x30e2fd['Contact'][_0x1ffb('0x26')](_0x3f2d64)){if(!_[_0x1ffb('0x27')](_0x30e2fd['Contact'][_0x3f2d64])&&_0x3f2d64!=='id'&&_0x3f2d64!==_0x1ffb('0x28')&&_0x3f2d64!=='createdAt'&&_0x3f2d64!=='updatedAt'){_0x4dd0ba[util[_0x1ffb('0x12')](_0x1ffb('0x29'),_0x1ffb('0x2a'),_['toUpper'](_0x3f2d64))]=_0x30e2fd[_0x1ffb('0x25')][_0x3f2d64];}}}}return _0x4dd0ba;};exports[_0x1ffb('0x2b')]=function(_0xd6d6f3){var _0x3d6eda={};for(var _0x43e4b7 in _0xd6d6f3){if(_0xd6d6f3[_0x1ffb('0x26')](_0x43e4b7)){_0x3d6eda[util[_0x1ffb('0x12')]('%s',_[_0x1ffb('0x2c')](_0x43e4b7))]=_0xd6d6f3[_0x43e4b7];}}return{'variables':_0x3d6eda};};exports[_0x1ffb('0x2d')]=function(_0x58e887,_0x456554){if(!_[_0x1ffb('0x27')](_0x58e887)){if(_0x58e887[_0x1ffb('0x26')](_0x1ffb('0x2e'))){if(_0x58e887[_0x1ffb('0x2e')]>0x0){_0x58e887[_0x1ffb('0x2e')]-=0x1;}else{logger[_0x1ffb('0x2f')](_0x1ffb('0x30'),_0x456554);}}}else{logger[_0x1ffb('0x2f')]('[updateOriginated]\x20is\x20null\x20or\x20undefined',_0x456554);}};exports[_0x1ffb('0x31')]=function(_0x493fff){var _0x26f226=moment()['format'](_0x1ffb('0x32'));_0x493fff[_0x1ffb('0x33')]=0xd;_0x493fff[_0x1ffb('0x34')]=_0x1ffb('0x35');_0x493fff[_0x1ffb('0x36')]=_0x26f226;_0x493fff[_0x1ffb('0x37')]=_0x26f226;_0x493fff['endtime']=_0x26f226;};exports[_0x1ffb('0x38')]=function(_0x2b05fc,_0x1bb59e,_0x4f4335){var _0x4f9a94=moment()['format'](_0x1ffb('0x32'));_0x2b05fc[_0x1ffb('0x33')]=_0x1bb59e;_0x2b05fc[_0x1ffb('0x34')]=_0x4f4335;_0x2b05fc[_0x1ffb('0x37')]=_0x4f9a94;_0x2b05fc[_0x1ffb('0x39')]=getSeconds(_0x2b05fc['responsetime'],_0x2b05fc[_0x1ffb('0x36')]);};exports[_0x1ffb('0x3a')]=function(_0x27d9d3,_0x1a55d6,_0x19d715){_0x27d9d3[_0x1ffb('0x3b')]=_0x1a55d6;_0x27d9d3[_0x1ffb('0x3c')]=_0x19d715;};exports[_0x1ffb('0x3d')]=function(_0x35fc15,_0xfd72d0,_0x487ac9){var _0x1ee2f6=moment()[_0x1ffb('0x12')](_0x1ffb('0x32'));_0x35fc15[_0x1ffb('0x33')]=_0xfd72d0;_0x35fc15['statedesc']=_0x487ac9;_0x35fc15[_0x1ffb('0x37')]=_0x35fc15['responsetime']?_0x35fc15['responsetime']:_0x1ee2f6;_0x35fc15['endtime']=_0x35fc15[_0x1ffb('0x3e')]?_0x35fc15[_0x1ffb('0x3e')]:_0x1ee2f6;_0x35fc15[_0x1ffb('0x39')]=getSeconds(_0x35fc15[_0x1ffb('0x37')]||0x0,_0x35fc15[_0x1ffb('0x36')]||0x0);_0x35fc15['talktime']=_0x35fc15['answertime']?getSeconds(_0x35fc15[_0x1ffb('0x3e')],_0x35fc15[_0x1ffb('0x3f')]):0x0;};exports[_0x1ffb('0x40')]=function(_0x19f82a){return _0x19f82a===_0x1ffb('0x41');};exports['variablesAction']=function(_0x3a3d3c,_0x2afb62,_0x530bf4,_0x271e42,_0x5db0d1){var _0x2474b4=_0x271e42?_0x1ffb('0x42'):_0x3a3d3c[_0x1ffb('0x43')];_0x2474b4=_0x5db0d1?_0x1ffb('0x44'):_0x2474b4;return{'actionid':_0x3a3d3c[_0x1ffb('0x45')],'action':'originate','channel':_0x3a3d3c[_0x1ffb('0x46')],'callerid':util[_0x1ffb('0x12')](_0x1ffb('0x13'),_0x2474b4,_0x3a3d3c[_0x1ffb('0x19')]),'Exten':'xcally-motion-preview','Context':'from-sip','Priority':'1','variable':_0x530bf4,'timeout':(_0x2afb62[_0x1ffb('0x47')]||0x1e)*0x3e8,'async':!![],'channelid':_0x3a3d3c[_0x1ffb('0x45')]};};exports['totalGlobal']=function(_0x50c00a){return _0x50c00a[_0x1ffb('0x48')]+_0x50c00a['countcongestionretry']+_0x50c00a[_0x1ffb('0x49')]+_0x50c00a[_0x1ffb('0x4a')]+_0x50c00a[_0x1ffb('0x4b')];};exports[_0x1ffb('0x4c')]=function(_0x953c27){var _0x3ecaa2=_[_0x1ffb('0x4d')](_0x953c27);_0x3ecaa2['state']=0xf;_0x3ecaa2[_0x1ffb('0x34')]=_0x1ffb('0x4e');return _0x3ecaa2;};exports[_0x1ffb('0x4f')]=function(_0xdd59b1,_0x4860f1,_0x1d965b){var _0x17ca4a={};_0x17ca4a[_0x4860f1]=_0xdd59b1[_0x4860f1];_0x17ca4a[_0x1ffb('0x50')]=![];_0x17ca4a[_0x1ffb('0x51')]=moment()[_0x1ffb('0x52')](_0x1d965b,_0x1ffb('0x53'))[_0x1ffb('0x12')](_0x1ffb('0x32'));_0x17ca4a[_0x1ffb('0x1a')]=_0xdd59b1[_0x1ffb('0x1a')];_0x17ca4a[_0x1ffb('0x54')]=_0xdd59b1[_0x1ffb('0x54')];_0x17ca4a[_0x1ffb('0x55')]=_0xdd59b1[_0x1ffb('0x55')]||undefined;return _0x17ca4a;};exports[_0x1ffb('0x56')]=function(_0x5e23c,_0x1297fc){if(!_[_0x1ffb('0x27')](_0x5e23c)){if(_0x5e23c['pTalking']>0x0){_0x5e23c[_0x1ffb('0x57')]-=0x1;}else{logger['error'](_0x1297fc,_0x1ffb('0x58'));}}else{logger['error'](_0x1297fc,_0x1ffb('0x59'));}};exports[_0x1ffb('0x5a')]=function(_0x51428c){if(_0x51428c<=0x0){return!![];}return![];};exports['buildObj']=function(_0x4918c8,_0x5099ab){_0x4918c8[_0x1ffb('0x5b')]=_0x5099ab;_0x4918c8[_0x1ffb('0x18')]=_0x4918c8[_0x1ffb('0x5c')];_0x4918c8[_0x1ffb('0x5d')]=_0x4918c8[_0x1ffb('0x46')];return _0x4918c8;};exports[_0x1ffb('0x5e')]=function(_0x26f8c9){var _0xe4f2aa={};_0xe4f2aa[_0x1ffb('0x5c')]=_0x26f8c9[_0x1ffb('0x5c')];_0xe4f2aa['interface']=_0x26f8c9[_0x1ffb('0x46')];_0xe4f2aa[_0x1ffb('0x45')]=_0x26f8c9[_0x1ffb('0x45')];return _0xe4f2aa;};exports['agentReadyId']=function(_0x58db97){var _0x42b572=[];for(var _0x442a7b in _0x58db97){if(_0x58db97[_0x1ffb('0x26')](_0x442a7b)){if(!_['isNil'](_0x58db97[_0x442a7b])&&_0x58db97[_0x442a7b][_0x1ffb('0x33')]===_0x1ffb('0x5f')&&_0x58db97[_0x442a7b]['status']==='reachable'){_0x42b572['push'](_0x58db97[_0x442a7b]['id']);}}}return _0x42b572;};exports[_0x1ffb('0x60')]=function(_0x4a070c){var _0x487a2e=moment()[_0x1ffb('0x8')](0x0);var _0x33e25f=moment(_0x4a070c)[_0x1ffb('0x8')](0x0);return _0x487a2e[_0x1ffb('0x9')](_0x33e25f,_0x1ffb('0xa'));};exports[_0x1ffb('0x61')]=function(_0x5bdff3){return{'active':![],'recallme':![],'UserId':null,'ContactId':_0x5bdff3['ContactId'],'ListId':_0x5bdff3['ListId'],'VoiceQueueId':_0x5bdff3[_0x1ffb('0x55')]||undefined,'CampaignId':_0x5bdff3[_0x1ffb('0x62')]||undefined};};exports[_0x1ffb('0x63')]=function(_0x4c2679){if(_0x4c2679===_0x1ffb('0x45')||_0x4c2679==='idContact'||_0x4c2679==='queue'||_0x4c2679===_0x1ffb('0x64')||_0x4c2679==='campaigntype'||_0x4c2679===_0x1ffb('0x65')||_0x4c2679===_0x1ffb('0x3b')||_0x4c2679===_0x1ffb('0x46')||_0x4c2679===_0x1ffb('0x43')||_0x4c2679===_0x1ffb('0x50')||_0x4c2679==='calleridnum'||_0x4c2679===_0x1ffb('0x51')||_0x4c2679===_0x1ffb('0x48')||_0x4c2679===_0x1ffb('0x66')||_0x4c2679==='countnoanswerretry'||_0x4c2679===_0x1ffb('0x67')||_0x4c2679===_0x1ffb('0x68')||_0x4c2679===_0x1ffb('0x69')||_0x4c2679===_0x1ffb('0x6a')||_0x4c2679==='recallme'||_0x4c2679===_0x1ffb('0x1a')||_0x4c2679===_0x1ffb('0x54')||_0x4c2679===_0x1ffb('0x3c')||_0x4c2679==='VoiceQueueId'||_0x4c2679==='sipcallid'||_0x4c2679===_0x1ffb('0x6b')||_0x4c2679===_0x1ffb('0x6c')||_0x4c2679===_0x1ffb('0x6d')||_0x4c2679===_0x1ffb('0x6e')||_0x4c2679===_0x1ffb('0x6f')||_0x4c2679===_0x1ffb('0x70')||_0x4c2679===_0x1ffb('0x71')||_0x4c2679==='xmd-dialid'||_0x4c2679===_0x1ffb('0x72')||_0x4c2679===_0x1ffb('0x73')||_0x4c2679===_0x1ffb('0x74')||_0x4c2679===_0x1ffb('0x75')||_0x4c2679===_0x1ffb('0x76')||_0x4c2679===_0x1ffb('0x77')||_0x4c2679===_0x1ffb('0x78')||_0x4c2679==='rtpaudioqosbridged'||_0x4c2679===_0x1ffb('0x79')||_0x4c2679===_0x1ffb('0x7a')||_0x4c2679===_0x1ffb('0x7b')||_0x4c2679===_0x1ffb('0x7c')||_0x4c2679===_0x1ffb('0x7d')||_0x4c2679===_0x1ffb('0x7e')||_0x4c2679===_0x1ffb('0x78')||_0x4c2679==='rtpaudioqosbridged'||_0x4c2679===_0x1ffb('0x79')||_0x4c2679===_0x1ffb('0x7a')||_0x4c2679===_0x1ffb('0x7b')||_0x4c2679===_0x1ffb('0x7c')||_0x4c2679===_0x1ffb('0x7d')||_0x4c2679==='rtpaudioqosrttbridged'||_0x4c2679==='bridgepeer'||_0x4c2679===_0x1ffb('0x7f')||_0x4c2679===_0x1ffb('0x33')||_0x4c2679==='statedesc'){return![];}return!![];};exports[_0x1ffb('0x80')]=function(_0x2a1cc3,_0x417b26){var _0x3ac821,_0x276600,_0x345813;if(_0x417b26<=0x0){_0x417b26=0x1;}_0x3ac821=new RegExp(_0x1ffb('0x81')+_0x417b26+'}$');_0x276600=Math['pow'](0xa,_0x417b26-0x1);_0x345813=Math[_0x1ffb('0x82')](0xa,_0x417b26)-0x1;return util[_0x1ffb('0x12')]('%s',_[_0x1ffb('0x83')](_0x2a1cc3,_0x3ac821,_[_0x1ffb('0x84')](_0x276600,_0x345813)));};exports[_0x1ffb('0x85')]=function(_0x470e8e){var _0x470d36=_0x470e8e[_0x1ffb('0x86')](/"(.*?)"/);return _0x470d36?_0x470d36[0x1]:_0x470e8e;};exports[_0x1ffb('0x87')]=function(_0x377d4b){var _0x1db54d=_0x377d4b['match'](/<(.*?)>/);return _0x1db54d?_0x1db54d[0x1]:_0x377d4b;}; \ No newline at end of file diff --git a/server/services/ami/properties.js b/server/services/ami/properties.js index f745a9e..10b17a7 100644 --- a/server/services/ami/properties.js +++ b/server/services/ami/properties.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5f2f=['number','boolean','queueremove','reload','voicequeuechannel','voicechannel','voicequeuechannelhangup','queueadd','string'];(function(_0x4006c6,_0x200194){var _0x3b634d=function(_0x3ae4f1){while(--_0x3ae4f1){_0x4006c6['push'](_0x4006c6['shift']());}};_0x3b634d(++_0x200194);}(_0x5f2f,0x73));var _0xf5f2=function(_0x5538a,_0x2870b8){_0x5538a=_0x5538a-0x0;var _0x427c68=_0x5f2f[_0x5538a];return _0x427c68;};'use strict';exports[_0xf5f2('0x0')]={'queue':{'type':_0xf5f2('0x1'),'required':!![]},'interface':{'type':_0xf5f2('0x1'),'required':!![]},'membername':{'type':_0xf5f2('0x1'),'required':!![]},'penalty':{'type':_0xf5f2('0x2'),'required':![]},'paused':{'type':_0xf5f2('0x3'),'required':![]}};exports[_0xf5f2('0x4')]={'queue':{'type':_0xf5f2('0x1'),'required':!![]},'interface':{'type':'string','required':!![]}};exports['queuepause']={'interface':{'type':_0xf5f2('0x1'),'required':!![]},'paused':{'type':_0xf5f2('0x3')},'reason':{'type':_0xf5f2('0x1'),'required':![]}};exports[_0xf5f2('0x5')]={'module':{'type':_0xf5f2('0x1'),'required':![]}};exports[_0xf5f2('0x6')]={'uniqueid':{'type':'string','required':!![]}};exports[_0xf5f2('0x7')]={'uniqueid':{'type':_0xf5f2('0x1'),'required':!![]},'filename':{'type':_0xf5f2('0x1')},'format':{'type':'string'},'mixmonitorid':{'type':_0xf5f2('0x1')}};exports[_0xf5f2('0x8')]={'uniqueid':{'type':_0xf5f2('0x1'),'required':!![]}};exports['voicequeuechannelredirect']={'uniqueid':{'type':_0xf5f2('0x1'),'required':!![]},'exten':{'type':'string','required':!![]},'context':{'type':'string'}}; \ No newline at end of file +var _0xb10b=['voicequeuechannelhangup','queueadd','string','number','queueremove','queuepause','boolean','reload','voicechannel'];(function(_0x3e3c8f,_0x4b97ac){var _0x1d976a=function(_0x46e1be){while(--_0x46e1be){_0x3e3c8f['push'](_0x3e3c8f['shift']());}};_0x1d976a(++_0x4b97ac);}(_0xb10b,0x12a));var _0xbb10=function(_0x98cb08,_0x3212b4){_0x98cb08=_0x98cb08-0x0;var _0x23473c=_0xb10b[_0x98cb08];return _0x23473c;};'use strict';exports[_0xbb10('0x0')]={'queue':{'type':'string','required':!![]},'interface':{'type':_0xbb10('0x1'),'required':!![]},'membername':{'type':_0xbb10('0x1'),'required':!![]},'penalty':{'type':_0xbb10('0x2'),'required':![]},'paused':{'type':'boolean','required':![]}};exports[_0xbb10('0x3')]={'queue':{'type':_0xbb10('0x1'),'required':!![]},'interface':{'type':_0xbb10('0x1'),'required':!![]}};exports[_0xbb10('0x4')]={'interface':{'type':_0xbb10('0x1'),'required':!![]},'paused':{'type':_0xbb10('0x5')},'reason':{'type':'string','required':![]}};exports[_0xbb10('0x6')]={'module':{'type':_0xbb10('0x1'),'required':![]}};exports['voicequeuechannel']={'uniqueid':{'type':_0xbb10('0x1'),'required':!![]}};exports[_0xbb10('0x7')]={'uniqueid':{'type':_0xbb10('0x1'),'required':!![]},'filename':{'type':_0xbb10('0x1')},'format':{'type':_0xbb10('0x1')},'mixmonitorid':{'type':_0xbb10('0x1')}};exports[_0xbb10('0x8')]={'uniqueid':{'type':_0xbb10('0x1'),'required':!![]}};exports['voicequeuechannelredirect']={'uniqueid':{'type':'string','required':!![]},'exten':{'type':_0xbb10('0x1'),'required':!![]},'context':{'type':_0xbb10('0x1')}}; \ No newline at end of file diff --git a/server/services/ami/realtime/index.js b/server/services/ami/realtime/index.js index a1007dc..39691f7 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 _0xeae4=['initVoiceExtensions','faxAccounts','exports','util','lodash','moment','../model/telephone','../model/trunk','../model/campaign','../model/zendeskAccount','../model/salesforceAccount','../model/freshdeskAccount','../model/sugarcrmAccount','../model/deskAccount','../model/vtigerAccount','../model/dynamics365Account','../model/freshsalesAccount','agents','telephones','trunks','voiceQueues','triggers','campaigns','templates','outbound','voiceExtensions','channels','queueChannels','zendeskAccounts','salesforceAccounts','sugarcrmAccounts','freshdeskAccounts','zohoAccounts','servicenowAccounts','dynamics365Accounts','freshsalesAccounts','hasOwnProperty','mapKeys','format','SIP/%s','name','interface','sumDuration','sumBillable','ivrTotalCallsDays','isEmpty','unmanaged','abandoned','sumHoldTime','outboundAnswerAgiCallsDay','outboundNoAnswerCallsDay','outboundCongestionCallsDay','outboundNoSuchCallsDay','outboundUnknownCallsDay','outboundDropCallsDayTimeout','outboundDropCallsDayCallersExit','outboundBlacklistCallsDay','outboundOriginateFailureCallsDay','outboundRejectCallsDay','outboundReCallsDay','outboundAnswerCallsDay','prototype','mergeFromDatabase','initAgents','length','isNil','isUndefined','initTelephones','initTrunks','initVoiceQueues','initTriggers','initTemplates','initFreshdeskAccounts','initZohoAccounts','initDeskAccounts','deskAccounts','initSugarcrmAccounts','initVtigerAccounts','vtigerAccounts','initServicenowAccounts','initDynamics365Accounts','initFreshsalesAccounts','initVoiceQueueHopperHistory','merge','initVoiceQueueReports','uniqueid','queue','queuecallerexit','queuecallerabandon','queuecallerleaveAt','diff','seconds','queuecallercompleteAt','queuecallerabandonAt','queuecallerexitAt','queuecallerjoinAt','total','queuecallercomplete','initVoiceCallReports','disposition','duration','billableseconds','initCampaigns','SquareProject'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xeae4,0x13b));var _0x4eae=function(_0x5ab463,_0x1dc76a){_0x5ab463=_0x5ab463-0x0;var _0xf6b784=_0xeae4[_0x5ab463];return _0xf6b784;};'use strict';var BPromise=require('bluebird');var util=require(_0x4eae('0x0'));var _=require(_0x4eae('0x1'));var moment=require(_0x4eae('0x2'));var Agent=require('../model/agent');var Telephone=require(_0x4eae('0x3'));var Trunk=require(_0x4eae('0x4'));var VoiceQueue=require('../model/voiceQueue');var Trigger=require('../model/trigger');var Template=require('../model/template');var Campaign=require(_0x4eae('0x5'));var VoiceExtension=require('../model/voiceExtension');var ZendeskAccount=require(_0x4eae('0x6'));var SalesforceAccount=require(_0x4eae('0x7'));var FreshdeskAccount=require(_0x4eae('0x8'));var SugarcrmAccount=require(_0x4eae('0x9'));var ZohoAccount=require('../model/zohoAccount');var DeskAccount=require(_0x4eae('0xa'));var VtigerAccount=require(_0x4eae('0xb'));var ServicenowAccount=require('../model/servicenowAccount');var Dynamics365Account=require(_0x4eae('0xc'));var FreshsalesAccount=require(_0x4eae('0xd'));var FaxAccount=require('../model/faxAccount');var Realtime=function(){this[_0x4eae('0xe')]={};this[_0x4eae('0xf')]={};this[_0x4eae('0x10')]={};this[_0x4eae('0x11')]={};this[_0x4eae('0x12')]={};this[_0x4eae('0x13')]={};this[_0x4eae('0x14')]={};this[_0x4eae('0x15')]={'total':0x0,'answered':0x0,'sumHoldTime':0x0,'sumDuration':0x0,'sumBillable':0x0};this[_0x4eae('0x16')]={};this[_0x4eae('0x17')]={};this[_0x4eae('0x18')]={};this['outboundChannels']={};this['timers']={};this[_0x4eae('0x19')]={};this[_0x4eae('0x1a')]={};this[_0x4eae('0x1b')]={};this[_0x4eae('0x1c')]={};this[_0x4eae('0x1d')]={};this['deskAccounts']={};this['vtigerAccounts']={};this[_0x4eae('0x1e')]={};this[_0x4eae('0x1f')]={};this[_0x4eae('0x20')]={};this['faxAccounts']={};};function freeIsNotKey(_0x54ff48,_0x306f68,_0x293ccd){var _0x19ad93=_['mapKeys'](_0x54ff48,function(_0x3edb9b,_0x467e87){return _0x3edb9b[_0x293ccd];});for(var _0x163be7 in _0x306f68){if(_0x306f68[_0x4eae('0x21')](_0x163be7)){if(!_0x19ad93[_0x163be7]){delete _0x306f68[_0x163be7];}}}}function freeIsNotKeySip(_0xf8a600,_0x462209){var _0x436903=_[_0x4eae('0x22')](_0xf8a600,function(_0x20886d,_0x21337a){return util[_0x4eae('0x23')](_0x4eae('0x24'),_0x20886d[_0x4eae('0x25')]);});for(var _0x1c6402 in _0x462209){if(_0x462209[_0x4eae('0x21')](_0x1c6402)){if(!_0x436903[_0x1c6402]){delete _0x462209[_0x1c6402];}}}}function freeIsNotKeyAgent(_0x2229da,_0x569377){var _0x25e9de=_[_0x4eae('0x22')](_0x2229da,function(_0x1fc24f,_0x319d34){var _0xb27c6d=_['isNil'](_0x1fc24f[_0x4eae('0x26')])?util[_0x4eae('0x23')](_0x4eae('0x24'),_0x1fc24f[_0x4eae('0x25')]):_0x1fc24f[_0x4eae('0x26')];return _0xb27c6d;});for(var _0x585509 in _0x569377){if(_0x569377['hasOwnProperty'](_0x585509)){if(!_0x25e9de[_0x585509]){delete _0x569377[_0x585509];}}}}function clearVoiceCallReports(_0x389973){_0x389973['total']=0x0;_0x389973['answered']=0x0;_0x389973['sumHoldTime']=0x0;_0x389973[_0x4eae('0x27')]=0x0;_0x389973[_0x4eae('0x28')]=0x0;}function clearCampaigns(_0x52c6b8){if(!_['isEmpty'](_0x52c6b8)){for(var _0x230d7f in _0x52c6b8){if(_0x52c6b8[_0x4eae('0x21')](_0x230d7f)){_0x52c6b8[_0x230d7f][_0x4eae('0x29')]=0x0;_0x52c6b8[_0x230d7f]['ivrAnswerCallsDay']=0x0;}}}}function clearVoiceQueues(_0x252004){if(!_[_0x4eae('0x2a')](_0x252004)){for(var _0x51ae86 in _0x252004){if(_0x252004[_0x4eae('0x21')](_0x51ae86)){_0x252004[_0x51ae86]['total']=0x0;_0x252004[_0x51ae86]['answered']=0x0;_0x252004[_0x51ae86][_0x4eae('0x2b')]=0x0;_0x252004[_0x51ae86][_0x4eae('0x2c')]=0x0;_0x252004[_0x51ae86][_0x4eae('0x2d')]=0x0;_0x252004[_0x51ae86]['sumDuration']=0x0;_0x252004[_0x51ae86][_0x4eae('0x28')]=0x0;_0x252004[_0x51ae86][_0x4eae('0x2e')]=0x0;_0x252004[_0x51ae86][_0x4eae('0x2f')]=0x0;_0x252004[_0x51ae86]['outboundBusyCallsDay']=0x0;_0x252004[_0x51ae86][_0x4eae('0x30')]=0x0;_0x252004[_0x51ae86][_0x4eae('0x31')]=0x0;_0x252004[_0x51ae86][_0x4eae('0x32')]=0x0;_0x252004[_0x51ae86][_0x4eae('0x33')]=0x0;_0x252004[_0x51ae86][_0x4eae('0x34')]=0x0;_0x252004[_0x51ae86][_0x4eae('0x35')]=0x0;_0x252004[_0x51ae86][_0x4eae('0x36')]=0x0;_0x252004[_0x51ae86][_0x4eae('0x37')]=0x0;_0x252004[_0x51ae86][_0x4eae('0x38')]=0x0;_0x252004[_0x51ae86]['outboundAnswerAgiCallsDay']=0x0;_0x252004[_0x51ae86][_0x4eae('0x39')]=0x0;_0x252004[_0x51ae86]['queueStatusComplete']=!![];}}}}Realtime[_0x4eae('0x3a')][_0x4eae('0x3b')]=function(_0x25ee43,_0x185389){for(var _0x246b83 in _0x185389){if(_0x25ee43[_0x4eae('0x21')](_0x246b83)){_0x25ee43[_0x246b83]=_0x185389[_0x246b83];}}};Realtime['prototype'][_0x4eae('0x3c')]=function(){var _0x206145=this;return function(_0x73f085){if(_0x73f085){freeIsNotKeyAgent(_0x73f085,_0x206145[_0x4eae('0xe')]);for(var _0x23ebfb=0x0,_0x1a5d7e={},_0x4509eb={};_0x23ebfb<_0x73f085[_0x4eae('0x3d')];_0x23ebfb+=0x1){_0x1a5d7e=_0x73f085[_0x23ebfb];var _0x4c1cfb=_[_0x4eae('0x3e')](_0x1a5d7e[_0x4eae('0x26')])?util[_0x4eae('0x23')]('SIP/%s',_0x1a5d7e[_0x4eae('0x25')]):_0x1a5d7e['interface'];if(_[_0x4eae('0x3f')](_0x206145[_0x4eae('0xe')][_0x4c1cfb])){_0x206145[_0x4eae('0xe')][_0x4c1cfb]=new Agent(_0x1a5d7e);}else{_0x206145[_0x4eae('0x3b')](_0x206145[_0x4eae('0xe')][_0x4c1cfb],_0x1a5d7e);}}}return _0x206145[_0x4eae('0xe')];};};Realtime['prototype'][_0x4eae('0x40')]=function(){var _0x528d8c=this;return function(_0x19a96c){if(_0x19a96c){freeIsNotKeySip(_0x19a96c,_0x528d8c[_0x4eae('0xf')]);for(var _0x42c6ac=0x0,_0x13237c={},_0x3c4d2d={};_0x42c6ac<_0x19a96c[_0x4eae('0x3d')];_0x42c6ac+=0x1){_0x13237c=_0x19a96c[_0x42c6ac];if(_[_0x4eae('0x3f')](_0x528d8c[_0x4eae('0xf')][util[_0x4eae('0x23')](_0x4eae('0x24'),_0x13237c[_0x4eae('0x25')])])){_0x528d8c[_0x4eae('0xf')][util['format'](_0x4eae('0x24'),_0x13237c[_0x4eae('0x25')])]=new Telephone(_0x13237c);}else{_0x528d8c[_0x4eae('0x3b')](_0x528d8c['telephones'][util[_0x4eae('0x23')]('SIP/%s',_0x13237c[_0x4eae('0x25')])],_0x13237c);}}}return _0x528d8c[_0x4eae('0xf')];};};Realtime[_0x4eae('0x3a')][_0x4eae('0x41')]=function(){var _0x3e1da9=this;return function(_0x488606){if(_0x488606){freeIsNotKeySip(_0x488606,_0x3e1da9[_0x4eae('0x10')]);for(var _0x5ab396=0x0,_0x113246={},_0x5ac4c4={};_0x5ab396<_0x488606['length'];_0x5ab396+=0x1){_0x113246=_0x488606[_0x5ab396];if(_[_0x4eae('0x3f')](_0x3e1da9[_0x4eae('0x10')][util[_0x4eae('0x23')](_0x4eae('0x24'),_0x113246[_0x4eae('0x25')])])){_0x3e1da9[_0x4eae('0x10')][util['format']('SIP/%s',_0x113246[_0x4eae('0x25')])]=new Trunk(_0x113246);}else{_0x3e1da9['mergeFromDatabase'](_0x3e1da9[_0x4eae('0x10')][util[_0x4eae('0x23')]('SIP/%s',_0x113246[_0x4eae('0x25')])],_0x113246);}}}return _0x3e1da9[_0x4eae('0x10')];};};Realtime[_0x4eae('0x3a')][_0x4eae('0x42')]=function(){var _0x1a8ad8=this;return function(_0x18188b){if(_0x18188b){freeIsNotKey(_0x18188b,_0x1a8ad8[_0x4eae('0x11')],_0x4eae('0x25'));for(var _0x51f29e=0x0,_0x37e68e={},_0x513c93={};_0x51f29e<_0x18188b[_0x4eae('0x3d')];_0x51f29e+=0x1){_0x37e68e=_0x18188b[_0x51f29e];if(_[_0x4eae('0x3f')](_0x1a8ad8['voiceQueues'][_0x37e68e['name']])){_0x1a8ad8[_0x4eae('0x11')][_0x37e68e['name']]=new VoiceQueue(_0x37e68e);}else{_0x1a8ad8['mergeFromDatabase'](_0x1a8ad8[_0x4eae('0x11')][_0x37e68e[_0x4eae('0x25')]],_0x37e68e);}}}return _0x1a8ad8[_0x4eae('0x11')];};};Realtime[_0x4eae('0x3a')][_0x4eae('0x43')]=function(){var _0x21d990=this;return function(_0x2b1f35){if(_0x2b1f35){freeIsNotKey(_0x2b1f35,_0x21d990[_0x4eae('0x12')],'id');for(var _0x4d6916=0x0,_0x43dfd5={},_0x48c76b={};_0x4d6916<_0x2b1f35['length'];_0x4d6916+=0x1){_0x43dfd5=_0x2b1f35[_0x4d6916];if(_[_0x4eae('0x3f')](_0x21d990['triggers'][_0x43dfd5['id']])){_0x21d990['triggers'][_0x43dfd5['id']]=new Trigger(_0x43dfd5);}else{_0x21d990[_0x4eae('0x3b')](_0x21d990[_0x4eae('0x12')][_0x43dfd5['id']],_0x43dfd5);}}}return _0x21d990[_0x4eae('0x12')];};};Realtime[_0x4eae('0x3a')][_0x4eae('0x44')]=function(){var _0x1d4456=this;return function(_0x5ef392){if(_0x5ef392){freeIsNotKey(_0x5ef392,_0x1d4456[_0x4eae('0x14')],'id');for(var _0x4cd617=0x0,_0x52cf7d={},_0xab7b75={};_0x4cd617<_0x5ef392[_0x4eae('0x3d')];_0x4cd617+=0x1){_0x52cf7d=_0x5ef392[_0x4cd617];if(_[_0x4eae('0x3f')](_0x1d4456[_0x4eae('0x14')][_0x52cf7d['id']])){_0x1d4456[_0x4eae('0x14')][_0x52cf7d['id']]=new Template(_0x52cf7d);}else{_0x1d4456[_0x4eae('0x3b')](_0x1d4456[_0x4eae('0x14')][_0x52cf7d['id']],_0x52cf7d);}}}return _0x1d4456[_0x4eae('0x14')];};};Realtime[_0x4eae('0x3a')]['initZendeskAccounts']=function(){var _0x47d5e2=this;return function(_0x54bd4a){if(_0x54bd4a){freeIsNotKey(_0x54bd4a,_0x47d5e2[_0x4eae('0x19')],'id');for(var _0x3ac8be=0x0,_0x30cc4c={},_0x9f8b17={};_0x3ac8be<_0x54bd4a[_0x4eae('0x3d')];_0x3ac8be+=0x1){_0x30cc4c=_0x54bd4a[_0x3ac8be];if(_[_0x4eae('0x3f')](_0x47d5e2['zendeskAccounts'][_0x30cc4c['id']])){_0x47d5e2[_0x4eae('0x19')][_0x30cc4c['id']]=new ZendeskAccount(_0x30cc4c);}else{_0x47d5e2[_0x4eae('0x3b')](_0x47d5e2[_0x4eae('0x19')][_0x30cc4c['id']],_0x30cc4c);}}}return _0x47d5e2[_0x4eae('0x19')];};};Realtime[_0x4eae('0x3a')]['initSalesforceAccounts']=function(){var _0x5d5ec7=this;return function(_0x234cbe){if(_0x234cbe){freeIsNotKey(_0x234cbe,_0x5d5ec7[_0x4eae('0x1a')],'id');for(var _0x50e88e=0x0,_0x563bdd={},_0x52c1fe={};_0x50e88e<_0x234cbe[_0x4eae('0x3d')];_0x50e88e+=0x1){_0x563bdd=_0x234cbe[_0x50e88e];if(_[_0x4eae('0x3f')](_0x5d5ec7[_0x4eae('0x1a')][_0x563bdd['id']])){_0x5d5ec7[_0x4eae('0x1a')][_0x563bdd['id']]=new SalesforceAccount(_0x563bdd);}else{_0x5d5ec7[_0x4eae('0x3b')](_0x5d5ec7[_0x4eae('0x1a')][_0x563bdd['id']],_0x563bdd);}}}return _0x5d5ec7['salesforceAccounts'];};};Realtime[_0x4eae('0x3a')][_0x4eae('0x45')]=function(){var _0x16e82d=this;return function(_0x3628c4){if(_0x3628c4){freeIsNotKey(_0x3628c4,_0x16e82d[_0x4eae('0x1c')],'id');for(var _0x13f3a9=0x0,_0x4b2efe={},_0xce1637={};_0x13f3a9<_0x3628c4[_0x4eae('0x3d')];_0x13f3a9+=0x1){_0x4b2efe=_0x3628c4[_0x13f3a9];if(_[_0x4eae('0x3f')](_0x16e82d[_0x4eae('0x1c')][_0x4b2efe['id']])){_0x16e82d[_0x4eae('0x1c')][_0x4b2efe['id']]=new FreshdeskAccount(_0x4b2efe);}else{_0x16e82d['mergeFromDatabase'](_0x16e82d['freshdeskAccounts'][_0x4b2efe['id']],_0x4b2efe);}}}return _0x16e82d[_0x4eae('0x1c')];};};Realtime[_0x4eae('0x3a')][_0x4eae('0x46')]=function(){var _0x8c58de=this;return function(_0x15eab8){if(_0x15eab8){freeIsNotKey(_0x15eab8,_0x8c58de[_0x4eae('0x1d')],'id');for(var _0x5e6ba6=0x0,_0x430c9c={},_0x2117ad={};_0x5e6ba6<_0x15eab8[_0x4eae('0x3d')];_0x5e6ba6+=0x1){_0x430c9c=_0x15eab8[_0x5e6ba6];if(_[_0x4eae('0x3f')](_0x8c58de[_0x4eae('0x1d')][_0x430c9c['id']])){_0x8c58de['zohoAccounts'][_0x430c9c['id']]=new ZohoAccount(_0x430c9c);}else{_0x8c58de[_0x4eae('0x3b')](_0x8c58de['zohoAccounts'][_0x430c9c['id']],_0x430c9c);}}}return _0x8c58de[_0x4eae('0x1d')];};};Realtime[_0x4eae('0x3a')][_0x4eae('0x47')]=function(){var _0x589eee=this;return function(_0x1c8ebc){if(_0x1c8ebc){freeIsNotKey(_0x1c8ebc,_0x589eee[_0x4eae('0x48')],'id');for(var _0x240d28=0x0,_0x339057={},_0x1ccfbe={};_0x240d28<_0x1c8ebc[_0x4eae('0x3d')];_0x240d28+=0x1){_0x339057=_0x1c8ebc[_0x240d28];if(_[_0x4eae('0x3f')](_0x589eee['deskAccounts'][_0x339057['id']])){_0x589eee[_0x4eae('0x48')][_0x339057['id']]=new DeskAccount(_0x339057);}else{_0x589eee[_0x4eae('0x3b')](_0x589eee[_0x4eae('0x48')][_0x339057['id']],_0x339057);}}}return _0x589eee[_0x4eae('0x48')];};};Realtime[_0x4eae('0x3a')][_0x4eae('0x49')]=function(){var _0x46a837=this;return function(_0x235dac){if(_0x235dac){freeIsNotKey(_0x235dac,_0x46a837[_0x4eae('0x1b')],'id');for(var _0x223ba8=0x0,_0x434964={},_0x26f4c3={};_0x223ba8<_0x235dac[_0x4eae('0x3d')];_0x223ba8+=0x1){_0x434964=_0x235dac[_0x223ba8];if(_[_0x4eae('0x3f')](_0x46a837['sugarcrmAccounts'][_0x434964['id']])){_0x46a837[_0x4eae('0x1b')][_0x434964['id']]=new SugarcrmAccount(_0x434964);}else{_0x46a837[_0x4eae('0x3b')](_0x46a837[_0x4eae('0x1b')][_0x434964['id']],_0x434964);}}}return _0x46a837['sugarcrmAccounts'];};};Realtime[_0x4eae('0x3a')][_0x4eae('0x4a')]=function(){var _0x3262e0=this;return function(_0x4785a3){if(_0x4785a3){freeIsNotKey(_0x4785a3,_0x3262e0['vtigerAccounts'],'id');for(var _0x5bc5ac=0x0,_0x112e9b={},_0x29fb2f={};_0x5bc5ac<_0x4785a3[_0x4eae('0x3d')];_0x5bc5ac+=0x1){_0x112e9b=_0x4785a3[_0x5bc5ac];if(_[_0x4eae('0x3f')](_0x3262e0['vtigerAccounts'][_0x112e9b['id']])){_0x3262e0[_0x4eae('0x4b')][_0x112e9b['id']]=new VtigerAccount(_0x112e9b);}else{_0x3262e0[_0x4eae('0x3b')](_0x3262e0['vtigerAccounts'][_0x112e9b['id']],_0x112e9b);}}}return _0x3262e0['vtigerAccounts'];};};Realtime[_0x4eae('0x3a')][_0x4eae('0x4c')]=function(){var _0x46c1c7=this;return function(_0x1d8489){if(_0x1d8489){freeIsNotKey(_0x1d8489,_0x46c1c7['servicenowAccounts'],'id');for(var _0x350aeb=0x0,_0x1875ed={},_0x49a215={};_0x350aeb<_0x1d8489[_0x4eae('0x3d')];_0x350aeb+=0x1){_0x1875ed=_0x1d8489[_0x350aeb];if(_[_0x4eae('0x3f')](_0x46c1c7['servicenowAccounts'][_0x1875ed['id']])){_0x46c1c7['servicenowAccounts'][_0x1875ed['id']]=new ServicenowAccount(_0x1875ed);}else{_0x46c1c7[_0x4eae('0x3b')](_0x46c1c7[_0x4eae('0x1e')][_0x1875ed['id']],_0x1875ed);}}}return _0x46c1c7[_0x4eae('0x1e')];};};Realtime[_0x4eae('0x3a')][_0x4eae('0x4d')]=function(){var _0x199068=this;return function(_0x2b77b0){if(_0x2b77b0){freeIsNotKey(_0x2b77b0,_0x199068[_0x4eae('0x1f')],'id');for(var _0x5826d0=0x0,_0x185efe={},_0xa9b7ee={};_0x5826d0<_0x2b77b0[_0x4eae('0x3d')];_0x5826d0+=0x1){_0x185efe=_0x2b77b0[_0x5826d0];if(_['isUndefined'](_0x199068[_0x4eae('0x1f')][_0x185efe['id']])){_0x199068[_0x4eae('0x1f')][_0x185efe['id']]=new Dynamics365Account(_0x185efe);}else{_0x199068[_0x4eae('0x3b')](_0x199068[_0x4eae('0x1f')][_0x185efe['id']],_0x185efe);}}}return _0x199068[_0x4eae('0x1f')];};};Realtime[_0x4eae('0x3a')][_0x4eae('0x4e')]=function(){var _0x122406=this;return function(_0x1f2244){if(_0x1f2244){freeIsNotKey(_0x1f2244,_0x122406[_0x4eae('0x20')],'id');for(var _0x4e65ec=0x0,_0x334d85={},_0x4e7658={};_0x4e65ec<_0x1f2244[_0x4eae('0x3d')];_0x4e65ec+=0x1){_0x334d85=_0x1f2244[_0x4e65ec];if(_[_0x4eae('0x3f')](_0x122406[_0x4eae('0x20')][_0x334d85['id']])){_0x122406[_0x4eae('0x20')][_0x334d85['id']]=new FreshsalesAccount(_0x334d85);}else{_0x122406[_0x4eae('0x3b')](_0x122406['freshsalesAccounts'][_0x334d85['id']],_0x334d85);}}}return _0x122406[_0x4eae('0x20')];};};Realtime[_0x4eae('0x3a')][_0x4eae('0x4f')]=function(){var _0x1d0c8f=this;return function(_0x248598){for(var _0x75c147=0x0;_0x75c147<_0x248598[_0x4eae('0x3d')];_0x75c147+=0x1){_[_0x4eae('0x50')](_0x1d0c8f[_0x4eae('0x11')][_0x248598[_0x75c147][_0x4eae('0x25')]],_0x248598[_0x75c147]);}return _0x1d0c8f[_0x4eae('0x11')];};};Realtime[_0x4eae('0x3a')][_0x4eae('0x51')]=function(){var _0x5f4362=this;return function(_0x2e7b20){clearVoiceQueues(_0x5f4362[_0x4eae('0x11')]);if(_0x2e7b20){_0x2e7b20=_['groupBy'](_0x2e7b20,_0x4eae('0x52'));for(var _0x3810bd in _0x2e7b20){if(_0x2e7b20[_0x4eae('0x21')](_0x3810bd)){var _0x3bec5b={};for(var _0x1a97b2=0x0;_0x1a97b2<_0x2e7b20[_0x3810bd][_0x4eae('0x3d')];_0x1a97b2+=0x1){var _0x4a229c=_0x2e7b20[_0x3810bd][_0x1a97b2][_0x4eae('0x53')];if(_0x5f4362[_0x4eae('0x11')][_0x4a229c]){if(_0x2e7b20[_0x3810bd][_0x1a97b2][_0x4eae('0x54')]){_0x5f4362['voiceQueues'][_0x4a229c][_0x4eae('0x2b')]+=0x1;}if(_0x2e7b20[_0x3810bd][_0x1a97b2][_0x4eae('0x55')]){_0x5f4362[_0x4eae('0x11')][_0x4a229c]['abandoned']+=0x1;}_0x5f4362[_0x4eae('0x11')][_0x4a229c][_0x4eae('0x2d')]+=moment(_0x2e7b20[_0x3810bd][_0x1a97b2][_0x4eae('0x56')])[_0x4eae('0x57')](moment(_0x2e7b20[_0x3810bd][_0x1a97b2]['queuecallerjoinAt']),_0x4eae('0x58'))||0x0;if(_0x1a97b2===_0x2e7b20[_0x3810bd][_0x4eae('0x3d')]-0x1){_0x5f4362[_0x4eae('0x11')][_0x4a229c][_0x4eae('0x27')]+=moment(_0x2e7b20[_0x3810bd][_0x1a97b2][_0x4eae('0x59')]||_0x2e7b20[_0x3810bd][_0x1a97b2][_0x4eae('0x5a')]||_0x2e7b20[_0x3810bd][_0x1a97b2][_0x4eae('0x5b')])[_0x4eae('0x57')](moment(_0x2e7b20[_0x3810bd][_0x1a97b2][_0x4eae('0x5c')]),_0x4eae('0x58'))||0x0;_0x5f4362['voiceQueues'][_0x4a229c][_0x4eae('0x5d')]+=0x1;if(_0x2e7b20[_0x3810bd][_0x1a97b2][_0x4eae('0x5e')]){_0x5f4362[_0x4eae('0x11')][_0x4a229c]['answered']+=0x1;_0x5f4362[_0x4eae('0x11')][_0x4a229c][_0x4eae('0x28')]+=moment(_0x2e7b20[_0x3810bd][_0x1a97b2]['queuecallercompleteAt'])[_0x4eae('0x57')](moment(_0x2e7b20[_0x3810bd][_0x1a97b2][_0x4eae('0x56')]),'seconds')||0x0;}}else{_0x5f4362['voiceQueues'][_0x4a229c][_0x4eae('0x27')]+=_0x5f4362[_0x4eae('0x11')][_0x4a229c]['sumHoldTime']||0x0;}}}}}}return _0x5f4362['voiceQueues'];};};Realtime[_0x4eae('0x3a')][_0x4eae('0x5f')]=function(){var _0x4588cd=this;return function(_0x537213){clearVoiceCallReports(_0x4588cd[_0x4eae('0x15')]);if(_0x537213){for(var _0x4b1f9c=0x0;_0x4b1f9c<_0x537213['length'];_0x4b1f9c+=0x1){_0x4588cd[_0x4eae('0x15')][_0x4eae('0x5d')]+=0x1;_0x4588cd[_0x4eae('0x15')][_0x4eae('0x27')]+=_0x537213[_0x4b1f9c]['duration'];if(_0x537213[_0x4b1f9c][_0x4eae('0x60')]==='ANSWERED'){_0x4588cd[_0x4eae('0x15')]['answered']+=0x1;_0x4588cd[_0x4eae('0x15')][_0x4eae('0x2d')]+=_0x537213[_0x4b1f9c][_0x4eae('0x61')]-_0x537213[_0x4b1f9c][_0x4eae('0x62')]||0x0;_0x4588cd[_0x4eae('0x15')][_0x4eae('0x28')]+=_0x537213[_0x4b1f9c][_0x4eae('0x62')];}}}return _0x4588cd[_0x4eae('0x15')];};};Realtime[_0x4eae('0x3a')][_0x4eae('0x63')]=function(){var _0x386b37=this;return function(_0x206419){if(_0x206419){freeIsNotKey(_0x206419,_0x386b37['campaigns'],_0x4eae('0x25'));for(var _0x5cf7c0=0x0,_0x50da42={};_0x5cf7c0<_0x206419[_0x4eae('0x3d')];_0x5cf7c0+=0x1){_0x50da42=_0x206419[_0x5cf7c0];if(_['isUndefined'](_0x386b37['campaigns'][_0x50da42[_0x4eae('0x25')]])){_0x386b37['campaigns'][_0x50da42['name']]=new Campaign(_0x50da42);}else{_0x386b37[_0x4eae('0x3b')](_0x386b37[_0x4eae('0x13')][_0x50da42[_0x4eae('0x25')]],_0x50da42);_0x386b37['campaigns'][_0x50da42[_0x4eae('0x25')]]['dialQueueProject']=_0x50da42[_0x4eae('0x64')]?_0x50da42['SquareProject']['name']:undefined;}}}return _0x386b37[_0x4eae('0x13')];};};Realtime[_0x4eae('0x3a')][_0x4eae('0x65')]=function(){var _0x224255=this;return function(_0x16c981){if(_0x16c981){freeIsNotKey(_0x16c981,_0x224255[_0x4eae('0x16')],'id');for(var _0x45e2bc=0x0,_0xc33441={};_0x45e2bc<_0x16c981[_0x4eae('0x3d')];_0x45e2bc+=0x1){_0xc33441=_0x16c981[_0x45e2bc];if(_[_0x4eae('0x3f')](_0x224255[_0x4eae('0x16')][_0xc33441['id']])){_0x224255['voiceExtensions'][_0xc33441['id']]=new VoiceExtension(_0xc33441);}else{_0x224255[_0x4eae('0x3b')](_0x224255['voiceExtensions'][_0xc33441['id']],_0xc33441);}}}return _0x224255['voiceExtensions'];};};Realtime[_0x4eae('0x3a')]['initCampaignHopperHistory']=function(){var _0x3b734e=this;return function(_0x55045a){clearCampaigns(_0x3b734e[_0x4eae('0x13')]);for(var _0x16af22=0x0;_0x16af22<_0x55045a['length'];_0x16af22+=0x1){_['merge'](_0x3b734e[_0x4eae('0x13')][_0x55045a[_0x16af22]['name']],_0x55045a[_0x16af22]);}return _0x3b734e[_0x4eae('0x13')];};};Realtime[_0x4eae('0x3a')]['initFaxAccounts']=function(){var _0x4088f3=this;return function(_0x52adcc){if(_0x52adcc){freeIsNotKey(_0x52adcc,_0x4088f3[_0x4eae('0x66')],'id');for(var _0x1f84af=0x0,_0x4dcdf2={},_0xc959ca={};_0x1f84af<_0x52adcc[_0x4eae('0x3d')];_0x1f84af+=0x1){_0x4dcdf2=_0x52adcc[_0x1f84af];if(_[_0x4eae('0x3f')](_0x4088f3[_0x4eae('0x66')][_0x4dcdf2['id']])){_0x4088f3['faxAccounts'][_0x4dcdf2['id']]=new FaxAccount(_0x4dcdf2);}else{_0x4088f3[_0x4eae('0x3b')](_0x4088f3[_0x4eae('0x66')][_0x4dcdf2['id']],_0x4dcdf2);}}}return _0x4088f3['faxAccounts'];};};module[_0x4eae('0x67')]=Realtime; \ No newline at end of file +var _0xcfef=['../model/sugarcrmAccount','../model/zohoAccount','../model/deskAccount','../model/vtigerAccount','../model/freshsalesAccount','../model/faxAccount','agents','telephones','trunks','voiceQueues','triggers','campaigns','templates','voiceExtensions','channels','outboundChannels','zendeskAccounts','salesforceAccounts','sugarcrmAccounts','zohoAccounts','deskAccounts','dynamics365Accounts','faxAccounts','mapKeys','hasOwnProperty','format','name','isNil','SIP/%s','interface','total','sumHoldTime','sumBillable','isEmpty','ivrTotalCallsDays','ivrAnswerCallsDay','answered','unmanaged','abandoned','sumDuration','outboundAnswerAgiCallsDay','outboundNoAnswerCallsDay','outboundBusyCallsDay','outboundDropCallsDayTimeout','outboundDropCallsDayCallersExit','outboundBlacklistCallsDay','outboundRejectCallsDay','outboundReCallsDay','queueStatusComplete','mergeFromDatabase','prototype','initAgents','length','isUndefined','initVoiceQueues','initTemplates','initFreshdeskAccounts','freshdeskAccounts','initZohoAccounts','initDeskAccounts','initSugarcrmAccounts','initVtigerAccounts','vtigerAccounts','initServicenowAccounts','servicenowAccounts','initDynamics365Accounts','initFreshsalesAccounts','freshsalesAccounts','initVoiceQueueHopperHistory','initVoiceQueueReports','groupBy','uniqueid','queue','queuecallerexit','queuecallerabandon','queuecallerleaveAt','diff','queuecallerjoinAt','seconds','queuecallercompleteAt','queuecallerexitAt','outbound','duration','ANSWERED','billableseconds','dialQueueProject','SquareProject','initVoiceExtensions','merge','exports','bluebird','lodash','moment','../model/agent','../model/telephone','../model/trunk','../model/voiceQueue','../model/trigger','../model/template','../model/campaign','../model/zendeskAccount','../model/salesforceAccount','../model/freshdeskAccount'];(function(_0x469873,_0x3801d6){var _0x564636=function(_0x5b2af4){while(--_0x5b2af4){_0x469873['push'](_0x469873['shift']());}};_0x564636(++_0x3801d6);}(_0xcfef,0xc1));var _0xfcfe=function(_0x56c852,_0x62d64f){_0x56c852=_0x56c852-0x0;var _0x3baa00=_0xcfef[_0x56c852];return _0x3baa00;};'use strict';var BPromise=require(_0xfcfe('0x0'));var util=require('util');var _=require(_0xfcfe('0x1'));var moment=require(_0xfcfe('0x2'));var Agent=require(_0xfcfe('0x3'));var Telephone=require(_0xfcfe('0x4'));var Trunk=require(_0xfcfe('0x5'));var VoiceQueue=require(_0xfcfe('0x6'));var Trigger=require(_0xfcfe('0x7'));var Template=require(_0xfcfe('0x8'));var Campaign=require(_0xfcfe('0x9'));var VoiceExtension=require('../model/voiceExtension');var ZendeskAccount=require(_0xfcfe('0xa'));var SalesforceAccount=require(_0xfcfe('0xb'));var FreshdeskAccount=require(_0xfcfe('0xc'));var SugarcrmAccount=require(_0xfcfe('0xd'));var ZohoAccount=require(_0xfcfe('0xe'));var DeskAccount=require(_0xfcfe('0xf'));var VtigerAccount=require(_0xfcfe('0x10'));var ServicenowAccount=require('../model/servicenowAccount');var Dynamics365Account=require('../model/dynamics365Account');var FreshsalesAccount=require(_0xfcfe('0x11'));var FaxAccount=require(_0xfcfe('0x12'));var Realtime=function(){this[_0xfcfe('0x13')]={};this[_0xfcfe('0x14')]={};this[_0xfcfe('0x15')]={};this[_0xfcfe('0x16')]={};this[_0xfcfe('0x17')]={};this[_0xfcfe('0x18')]={};this[_0xfcfe('0x19')]={};this['outbound']={'total':0x0,'answered':0x0,'sumHoldTime':0x0,'sumDuration':0x0,'sumBillable':0x0};this[_0xfcfe('0x1a')]={};this[_0xfcfe('0x1b')]={};this['queueChannels']={};this[_0xfcfe('0x1c')]={};this['timers']={};this[_0xfcfe('0x1d')]={};this[_0xfcfe('0x1e')]={};this[_0xfcfe('0x1f')]={};this['freshdeskAccounts']={};this[_0xfcfe('0x20')]={};this[_0xfcfe('0x21')]={};this['vtigerAccounts']={};this['servicenowAccounts']={};this[_0xfcfe('0x22')]={};this['freshsalesAccounts']={};this[_0xfcfe('0x23')]={};};function freeIsNotKey(_0x138cca,_0x4f29b0,_0x313ef9){var _0x1a8f27=_[_0xfcfe('0x24')](_0x138cca,function(_0x277cb,_0x217534){return _0x277cb[_0x313ef9];});for(var _0x66b4c3 in _0x4f29b0){if(_0x4f29b0[_0xfcfe('0x25')](_0x66b4c3)){if(!_0x1a8f27[_0x66b4c3]){delete _0x4f29b0[_0x66b4c3];}}}}function freeIsNotKeySip(_0x4a445f,_0x25c873){var _0x2811a5=_[_0xfcfe('0x24')](_0x4a445f,function(_0x68cc31,_0x43d8a4){return util[_0xfcfe('0x26')]('SIP/%s',_0x68cc31[_0xfcfe('0x27')]);});for(var _0x2fcd90 in _0x25c873){if(_0x25c873['hasOwnProperty'](_0x2fcd90)){if(!_0x2811a5[_0x2fcd90]){delete _0x25c873[_0x2fcd90];}}}}function freeIsNotKeyAgent(_0xea77c5,_0x5d4170){var _0x268a35=_['mapKeys'](_0xea77c5,function(_0x29d64f,_0x144902){var _0x39276a=_[_0xfcfe('0x28')](_0x29d64f['interface'])?util['format'](_0xfcfe('0x29'),_0x29d64f[_0xfcfe('0x27')]):_0x29d64f[_0xfcfe('0x2a')];return _0x39276a;});for(var _0xa697b1 in _0x5d4170){if(_0x5d4170[_0xfcfe('0x25')](_0xa697b1)){if(!_0x268a35[_0xa697b1]){delete _0x5d4170[_0xa697b1];}}}}function clearVoiceCallReports(_0x35a337){_0x35a337[_0xfcfe('0x2b')]=0x0;_0x35a337['answered']=0x0;_0x35a337[_0xfcfe('0x2c')]=0x0;_0x35a337['sumDuration']=0x0;_0x35a337[_0xfcfe('0x2d')]=0x0;}function clearCampaigns(_0x2fb7bc){if(!_[_0xfcfe('0x2e')](_0x2fb7bc)){for(var _0x1fdd5b in _0x2fb7bc){if(_0x2fb7bc[_0xfcfe('0x25')](_0x1fdd5b)){_0x2fb7bc[_0x1fdd5b][_0xfcfe('0x2f')]=0x0;_0x2fb7bc[_0x1fdd5b][_0xfcfe('0x30')]=0x0;}}}}function clearVoiceQueues(_0x2f047d){if(!_['isEmpty'](_0x2f047d)){for(var _0x2cbec7 in _0x2f047d){if(_0x2f047d['hasOwnProperty'](_0x2cbec7)){_0x2f047d[_0x2cbec7][_0xfcfe('0x2b')]=0x0;_0x2f047d[_0x2cbec7][_0xfcfe('0x31')]=0x0;_0x2f047d[_0x2cbec7][_0xfcfe('0x32')]=0x0;_0x2f047d[_0x2cbec7][_0xfcfe('0x33')]=0x0;_0x2f047d[_0x2cbec7]['sumHoldTime']=0x0;_0x2f047d[_0x2cbec7][_0xfcfe('0x34')]=0x0;_0x2f047d[_0x2cbec7][_0xfcfe('0x2d')]=0x0;_0x2f047d[_0x2cbec7][_0xfcfe('0x35')]=0x0;_0x2f047d[_0x2cbec7][_0xfcfe('0x36')]=0x0;_0x2f047d[_0x2cbec7][_0xfcfe('0x37')]=0x0;_0x2f047d[_0x2cbec7]['outboundCongestionCallsDay']=0x0;_0x2f047d[_0x2cbec7]['outboundNoSuchCallsDay']=0x0;_0x2f047d[_0x2cbec7]['outboundUnknownCallsDay']=0x0;_0x2f047d[_0x2cbec7][_0xfcfe('0x38')]=0x0;_0x2f047d[_0x2cbec7][_0xfcfe('0x39')]=0x0;_0x2f047d[_0x2cbec7][_0xfcfe('0x3a')]=0x0;_0x2f047d[_0x2cbec7]['outboundOriginateFailureCallsDay']=0x0;_0x2f047d[_0x2cbec7][_0xfcfe('0x3b')]=0x0;_0x2f047d[_0x2cbec7][_0xfcfe('0x3c')]=0x0;_0x2f047d[_0x2cbec7]['outboundAnswerAgiCallsDay']=0x0;_0x2f047d[_0x2cbec7]['outboundAnswerCallsDay']=0x0;_0x2f047d[_0x2cbec7][_0xfcfe('0x3d')]=!![];}}}}Realtime['prototype'][_0xfcfe('0x3e')]=function(_0x13fa77,_0x4403b1){for(var _0x4b799a in _0x4403b1){if(_0x13fa77[_0xfcfe('0x25')](_0x4b799a)){_0x13fa77[_0x4b799a]=_0x4403b1[_0x4b799a];}}};Realtime[_0xfcfe('0x3f')][_0xfcfe('0x40')]=function(){var _0x435a71=this;return function(_0x1eb182){if(_0x1eb182){freeIsNotKeyAgent(_0x1eb182,_0x435a71['agents']);for(var _0x4a1481=0x0,_0x9b619d={},_0x298324={};_0x4a1481<_0x1eb182[_0xfcfe('0x41')];_0x4a1481+=0x1){_0x9b619d=_0x1eb182[_0x4a1481];var _0x2e5a89=_['isNil'](_0x9b619d['interface'])?util[_0xfcfe('0x26')](_0xfcfe('0x29'),_0x9b619d[_0xfcfe('0x27')]):_0x9b619d[_0xfcfe('0x2a')];if(_[_0xfcfe('0x42')](_0x435a71[_0xfcfe('0x13')][_0x2e5a89])){_0x435a71[_0xfcfe('0x13')][_0x2e5a89]=new Agent(_0x9b619d);}else{_0x435a71[_0xfcfe('0x3e')](_0x435a71['agents'][_0x2e5a89],_0x9b619d);}}}return _0x435a71['agents'];};};Realtime[_0xfcfe('0x3f')]['initTelephones']=function(){var _0x532305=this;return function(_0x27197b){if(_0x27197b){freeIsNotKeySip(_0x27197b,_0x532305[_0xfcfe('0x14')]);for(var _0x190c8c=0x0,_0x3796ce={},_0x41f8cb={};_0x190c8c<_0x27197b[_0xfcfe('0x41')];_0x190c8c+=0x1){_0x3796ce=_0x27197b[_0x190c8c];if(_['isUndefined'](_0x532305['telephones'][util[_0xfcfe('0x26')](_0xfcfe('0x29'),_0x3796ce['name'])])){_0x532305[_0xfcfe('0x14')][util[_0xfcfe('0x26')](_0xfcfe('0x29'),_0x3796ce[_0xfcfe('0x27')])]=new Telephone(_0x3796ce);}else{_0x532305['mergeFromDatabase'](_0x532305['telephones'][util[_0xfcfe('0x26')](_0xfcfe('0x29'),_0x3796ce['name'])],_0x3796ce);}}}return _0x532305[_0xfcfe('0x14')];};};Realtime[_0xfcfe('0x3f')]['initTrunks']=function(){var _0x1b9a4d=this;return function(_0x4ea2bc){if(_0x4ea2bc){freeIsNotKeySip(_0x4ea2bc,_0x1b9a4d[_0xfcfe('0x15')]);for(var _0x5d51ec=0x0,_0x58a0f1={},_0x2b4f5a={};_0x5d51ec<_0x4ea2bc[_0xfcfe('0x41')];_0x5d51ec+=0x1){_0x58a0f1=_0x4ea2bc[_0x5d51ec];if(_[_0xfcfe('0x42')](_0x1b9a4d[_0xfcfe('0x15')][util[_0xfcfe('0x26')](_0xfcfe('0x29'),_0x58a0f1[_0xfcfe('0x27')])])){_0x1b9a4d[_0xfcfe('0x15')][util[_0xfcfe('0x26')](_0xfcfe('0x29'),_0x58a0f1[_0xfcfe('0x27')])]=new Trunk(_0x58a0f1);}else{_0x1b9a4d['mergeFromDatabase'](_0x1b9a4d['trunks'][util[_0xfcfe('0x26')](_0xfcfe('0x29'),_0x58a0f1[_0xfcfe('0x27')])],_0x58a0f1);}}}return _0x1b9a4d[_0xfcfe('0x15')];};};Realtime['prototype'][_0xfcfe('0x43')]=function(){var _0x1bb77e=this;return function(_0x477135){if(_0x477135){freeIsNotKey(_0x477135,_0x1bb77e[_0xfcfe('0x16')],_0xfcfe('0x27'));for(var _0x1d4002=0x0,_0x6d94be={},_0x18cfd3={};_0x1d4002<_0x477135[_0xfcfe('0x41')];_0x1d4002+=0x1){_0x6d94be=_0x477135[_0x1d4002];if(_[_0xfcfe('0x42')](_0x1bb77e[_0xfcfe('0x16')][_0x6d94be[_0xfcfe('0x27')]])){_0x1bb77e[_0xfcfe('0x16')][_0x6d94be[_0xfcfe('0x27')]]=new VoiceQueue(_0x6d94be);}else{_0x1bb77e[_0xfcfe('0x3e')](_0x1bb77e[_0xfcfe('0x16')][_0x6d94be['name']],_0x6d94be);}}}return _0x1bb77e['voiceQueues'];};};Realtime[_0xfcfe('0x3f')]['initTriggers']=function(){var _0x28a1e1=this;return function(_0x5dc4cc){if(_0x5dc4cc){freeIsNotKey(_0x5dc4cc,_0x28a1e1[_0xfcfe('0x17')],'id');for(var _0x293396=0x0,_0x1c4b12={},_0x3c2ce2={};_0x293396<_0x5dc4cc[_0xfcfe('0x41')];_0x293396+=0x1){_0x1c4b12=_0x5dc4cc[_0x293396];if(_['isUndefined'](_0x28a1e1['triggers'][_0x1c4b12['id']])){_0x28a1e1[_0xfcfe('0x17')][_0x1c4b12['id']]=new Trigger(_0x1c4b12);}else{_0x28a1e1[_0xfcfe('0x3e')](_0x28a1e1[_0xfcfe('0x17')][_0x1c4b12['id']],_0x1c4b12);}}}return _0x28a1e1['triggers'];};};Realtime['prototype'][_0xfcfe('0x44')]=function(){var _0x2bcc81=this;return function(_0x30fc62){if(_0x30fc62){freeIsNotKey(_0x30fc62,_0x2bcc81[_0xfcfe('0x19')],'id');for(var _0x51a710=0x0,_0x2f6ea2={},_0x59a54c={};_0x51a710<_0x30fc62[_0xfcfe('0x41')];_0x51a710+=0x1){_0x2f6ea2=_0x30fc62[_0x51a710];if(_[_0xfcfe('0x42')](_0x2bcc81[_0xfcfe('0x19')][_0x2f6ea2['id']])){_0x2bcc81['templates'][_0x2f6ea2['id']]=new Template(_0x2f6ea2);}else{_0x2bcc81[_0xfcfe('0x3e')](_0x2bcc81[_0xfcfe('0x19')][_0x2f6ea2['id']],_0x2f6ea2);}}}return _0x2bcc81[_0xfcfe('0x19')];};};Realtime[_0xfcfe('0x3f')]['initZendeskAccounts']=function(){var _0x2c4335=this;return function(_0x5bfd21){if(_0x5bfd21){freeIsNotKey(_0x5bfd21,_0x2c4335[_0xfcfe('0x1d')],'id');for(var _0x53258c=0x0,_0x556ad6={},_0x3c328a={};_0x53258c<_0x5bfd21[_0xfcfe('0x41')];_0x53258c+=0x1){_0x556ad6=_0x5bfd21[_0x53258c];if(_[_0xfcfe('0x42')](_0x2c4335[_0xfcfe('0x1d')][_0x556ad6['id']])){_0x2c4335[_0xfcfe('0x1d')][_0x556ad6['id']]=new ZendeskAccount(_0x556ad6);}else{_0x2c4335['mergeFromDatabase'](_0x2c4335[_0xfcfe('0x1d')][_0x556ad6['id']],_0x556ad6);}}}return _0x2c4335[_0xfcfe('0x1d')];};};Realtime[_0xfcfe('0x3f')]['initSalesforceAccounts']=function(){var _0x21ce83=this;return function(_0x179610){if(_0x179610){freeIsNotKey(_0x179610,_0x21ce83[_0xfcfe('0x1e')],'id');for(var _0x276a39=0x0,_0x136cc1={},_0x282a94={};_0x276a39<_0x179610[_0xfcfe('0x41')];_0x276a39+=0x1){_0x136cc1=_0x179610[_0x276a39];if(_[_0xfcfe('0x42')](_0x21ce83[_0xfcfe('0x1e')][_0x136cc1['id']])){_0x21ce83['salesforceAccounts'][_0x136cc1['id']]=new SalesforceAccount(_0x136cc1);}else{_0x21ce83['mergeFromDatabase'](_0x21ce83[_0xfcfe('0x1e')][_0x136cc1['id']],_0x136cc1);}}}return _0x21ce83[_0xfcfe('0x1e')];};};Realtime[_0xfcfe('0x3f')][_0xfcfe('0x45')]=function(){var _0x226e9e=this;return function(_0x421869){if(_0x421869){freeIsNotKey(_0x421869,_0x226e9e['freshdeskAccounts'],'id');for(var _0x3137c4=0x0,_0x16833d={},_0x813930={};_0x3137c4<_0x421869['length'];_0x3137c4+=0x1){_0x16833d=_0x421869[_0x3137c4];if(_[_0xfcfe('0x42')](_0x226e9e[_0xfcfe('0x46')][_0x16833d['id']])){_0x226e9e[_0xfcfe('0x46')][_0x16833d['id']]=new FreshdeskAccount(_0x16833d);}else{_0x226e9e[_0xfcfe('0x3e')](_0x226e9e[_0xfcfe('0x46')][_0x16833d['id']],_0x16833d);}}}return _0x226e9e[_0xfcfe('0x46')];};};Realtime[_0xfcfe('0x3f')][_0xfcfe('0x47')]=function(){var _0x52bc45=this;return function(_0x15ed17){if(_0x15ed17){freeIsNotKey(_0x15ed17,_0x52bc45[_0xfcfe('0x20')],'id');for(var _0x34d1d2=0x0,_0x2d7ae0={},_0x175e54={};_0x34d1d2<_0x15ed17[_0xfcfe('0x41')];_0x34d1d2+=0x1){_0x2d7ae0=_0x15ed17[_0x34d1d2];if(_[_0xfcfe('0x42')](_0x52bc45[_0xfcfe('0x20')][_0x2d7ae0['id']])){_0x52bc45[_0xfcfe('0x20')][_0x2d7ae0['id']]=new ZohoAccount(_0x2d7ae0);}else{_0x52bc45[_0xfcfe('0x3e')](_0x52bc45[_0xfcfe('0x20')][_0x2d7ae0['id']],_0x2d7ae0);}}}return _0x52bc45[_0xfcfe('0x20')];};};Realtime[_0xfcfe('0x3f')][_0xfcfe('0x48')]=function(){var _0x4213d8=this;return function(_0x40e5b7){if(_0x40e5b7){freeIsNotKey(_0x40e5b7,_0x4213d8[_0xfcfe('0x21')],'id');for(var _0x470f90=0x0,_0x1c8922={},_0x1f9400={};_0x470f90<_0x40e5b7[_0xfcfe('0x41')];_0x470f90+=0x1){_0x1c8922=_0x40e5b7[_0x470f90];if(_[_0xfcfe('0x42')](_0x4213d8['deskAccounts'][_0x1c8922['id']])){_0x4213d8['deskAccounts'][_0x1c8922['id']]=new DeskAccount(_0x1c8922);}else{_0x4213d8[_0xfcfe('0x3e')](_0x4213d8[_0xfcfe('0x21')][_0x1c8922['id']],_0x1c8922);}}}return _0x4213d8[_0xfcfe('0x21')];};};Realtime[_0xfcfe('0x3f')][_0xfcfe('0x49')]=function(){var _0x56e72d=this;return function(_0x24df27){if(_0x24df27){freeIsNotKey(_0x24df27,_0x56e72d[_0xfcfe('0x1f')],'id');for(var _0x26858b=0x0,_0x26555e={},_0x3b6325={};_0x26858b<_0x24df27['length'];_0x26858b+=0x1){_0x26555e=_0x24df27[_0x26858b];if(_[_0xfcfe('0x42')](_0x56e72d[_0xfcfe('0x1f')][_0x26555e['id']])){_0x56e72d['sugarcrmAccounts'][_0x26555e['id']]=new SugarcrmAccount(_0x26555e);}else{_0x56e72d['mergeFromDatabase'](_0x56e72d[_0xfcfe('0x1f')][_0x26555e['id']],_0x26555e);}}}return _0x56e72d[_0xfcfe('0x1f')];};};Realtime[_0xfcfe('0x3f')][_0xfcfe('0x4a')]=function(){var _0x2bb101=this;return function(_0x48d941){if(_0x48d941){freeIsNotKey(_0x48d941,_0x2bb101[_0xfcfe('0x4b')],'id');for(var _0x44114f=0x0,_0xa21ba2={},_0x243bad={};_0x44114f<_0x48d941[_0xfcfe('0x41')];_0x44114f+=0x1){_0xa21ba2=_0x48d941[_0x44114f];if(_['isUndefined'](_0x2bb101[_0xfcfe('0x4b')][_0xa21ba2['id']])){_0x2bb101[_0xfcfe('0x4b')][_0xa21ba2['id']]=new VtigerAccount(_0xa21ba2);}else{_0x2bb101[_0xfcfe('0x3e')](_0x2bb101['vtigerAccounts'][_0xa21ba2['id']],_0xa21ba2);}}}return _0x2bb101[_0xfcfe('0x4b')];};};Realtime[_0xfcfe('0x3f')][_0xfcfe('0x4c')]=function(){var _0x4d71d3=this;return function(_0x4e36eb){if(_0x4e36eb){freeIsNotKey(_0x4e36eb,_0x4d71d3[_0xfcfe('0x4d')],'id');for(var _0x3a2ffa=0x0,_0xe903df={},_0x479455={};_0x3a2ffa<_0x4e36eb[_0xfcfe('0x41')];_0x3a2ffa+=0x1){_0xe903df=_0x4e36eb[_0x3a2ffa];if(_[_0xfcfe('0x42')](_0x4d71d3[_0xfcfe('0x4d')][_0xe903df['id']])){_0x4d71d3[_0xfcfe('0x4d')][_0xe903df['id']]=new ServicenowAccount(_0xe903df);}else{_0x4d71d3[_0xfcfe('0x3e')](_0x4d71d3[_0xfcfe('0x4d')][_0xe903df['id']],_0xe903df);}}}return _0x4d71d3[_0xfcfe('0x4d')];};};Realtime[_0xfcfe('0x3f')][_0xfcfe('0x4e')]=function(){var _0x2ee9ac=this;return function(_0x14428d){if(_0x14428d){freeIsNotKey(_0x14428d,_0x2ee9ac[_0xfcfe('0x22')],'id');for(var _0x3258f8=0x0,_0x5d34da={},_0x55dbc6={};_0x3258f8<_0x14428d[_0xfcfe('0x41')];_0x3258f8+=0x1){_0x5d34da=_0x14428d[_0x3258f8];if(_[_0xfcfe('0x42')](_0x2ee9ac[_0xfcfe('0x22')][_0x5d34da['id']])){_0x2ee9ac[_0xfcfe('0x22')][_0x5d34da['id']]=new Dynamics365Account(_0x5d34da);}else{_0x2ee9ac[_0xfcfe('0x3e')](_0x2ee9ac[_0xfcfe('0x22')][_0x5d34da['id']],_0x5d34da);}}}return _0x2ee9ac[_0xfcfe('0x22')];};};Realtime[_0xfcfe('0x3f')][_0xfcfe('0x4f')]=function(){var _0x45bf2e=this;return function(_0x5502e1){if(_0x5502e1){freeIsNotKey(_0x5502e1,_0x45bf2e['freshsalesAccounts'],'id');for(var _0x1802ac=0x0,_0xc65104={},_0x1f28e1={};_0x1802ac<_0x5502e1['length'];_0x1802ac+=0x1){_0xc65104=_0x5502e1[_0x1802ac];if(_[_0xfcfe('0x42')](_0x45bf2e[_0xfcfe('0x50')][_0xc65104['id']])){_0x45bf2e[_0xfcfe('0x50')][_0xc65104['id']]=new FreshsalesAccount(_0xc65104);}else{_0x45bf2e[_0xfcfe('0x3e')](_0x45bf2e['freshsalesAccounts'][_0xc65104['id']],_0xc65104);}}}return _0x45bf2e[_0xfcfe('0x50')];};};Realtime[_0xfcfe('0x3f')][_0xfcfe('0x51')]=function(){var _0x4db4b8=this;return function(_0xaeabe){for(var _0x294405=0x0;_0x294405<_0xaeabe[_0xfcfe('0x41')];_0x294405+=0x1){_['merge'](_0x4db4b8[_0xfcfe('0x16')][_0xaeabe[_0x294405][_0xfcfe('0x27')]],_0xaeabe[_0x294405]);}return _0x4db4b8['voiceQueues'];};};Realtime[_0xfcfe('0x3f')][_0xfcfe('0x52')]=function(){var _0x464a04=this;return function(_0x50241f){clearVoiceQueues(_0x464a04['voiceQueues']);if(_0x50241f){_0x50241f=_[_0xfcfe('0x53')](_0x50241f,_0xfcfe('0x54'));for(var _0x3fb576 in _0x50241f){if(_0x50241f[_0xfcfe('0x25')](_0x3fb576)){var _0xb22338={};for(var _0x46bf73=0x0;_0x46bf73<_0x50241f[_0x3fb576][_0xfcfe('0x41')];_0x46bf73+=0x1){var _0x2495ca=_0x50241f[_0x3fb576][_0x46bf73][_0xfcfe('0x55')];if(_0x464a04['voiceQueues'][_0x2495ca]){if(_0x50241f[_0x3fb576][_0x46bf73][_0xfcfe('0x56')]){_0x464a04['voiceQueues'][_0x2495ca][_0xfcfe('0x32')]+=0x1;}if(_0x50241f[_0x3fb576][_0x46bf73][_0xfcfe('0x57')]){_0x464a04[_0xfcfe('0x16')][_0x2495ca][_0xfcfe('0x33')]+=0x1;}_0x464a04['voiceQueues'][_0x2495ca][_0xfcfe('0x2c')]+=moment(_0x50241f[_0x3fb576][_0x46bf73][_0xfcfe('0x58')])[_0xfcfe('0x59')](moment(_0x50241f[_0x3fb576][_0x46bf73][_0xfcfe('0x5a')]),_0xfcfe('0x5b'))||0x0;if(_0x46bf73===_0x50241f[_0x3fb576][_0xfcfe('0x41')]-0x1){_0x464a04['voiceQueues'][_0x2495ca][_0xfcfe('0x34')]+=moment(_0x50241f[_0x3fb576][_0x46bf73][_0xfcfe('0x5c')]||_0x50241f[_0x3fb576][_0x46bf73]['queuecallerabandonAt']||_0x50241f[_0x3fb576][_0x46bf73][_0xfcfe('0x5d')])[_0xfcfe('0x59')](moment(_0x50241f[_0x3fb576][_0x46bf73]['queuecallerjoinAt']),_0xfcfe('0x5b'))||0x0;_0x464a04[_0xfcfe('0x16')][_0x2495ca]['total']+=0x1;if(_0x50241f[_0x3fb576][_0x46bf73]['queuecallercomplete']){_0x464a04[_0xfcfe('0x16')][_0x2495ca][_0xfcfe('0x31')]+=0x1;_0x464a04[_0xfcfe('0x16')][_0x2495ca][_0xfcfe('0x2d')]+=moment(_0x50241f[_0x3fb576][_0x46bf73][_0xfcfe('0x5c')])['diff'](moment(_0x50241f[_0x3fb576][_0x46bf73][_0xfcfe('0x58')]),_0xfcfe('0x5b'))||0x0;}}else{_0x464a04[_0xfcfe('0x16')][_0x2495ca][_0xfcfe('0x34')]+=_0x464a04['voiceQueues'][_0x2495ca][_0xfcfe('0x2c')]||0x0;}}}}}}return _0x464a04[_0xfcfe('0x16')];};};Realtime[_0xfcfe('0x3f')]['initVoiceCallReports']=function(){var _0x51f941=this;return function(_0x358411){clearVoiceCallReports(_0x51f941[_0xfcfe('0x5e')]);if(_0x358411){for(var _0x5caa98=0x0;_0x5caa98<_0x358411[_0xfcfe('0x41')];_0x5caa98+=0x1){_0x51f941[_0xfcfe('0x5e')][_0xfcfe('0x2b')]+=0x1;_0x51f941[_0xfcfe('0x5e')]['sumDuration']+=_0x358411[_0x5caa98][_0xfcfe('0x5f')];if(_0x358411[_0x5caa98]['disposition']===_0xfcfe('0x60')){_0x51f941[_0xfcfe('0x5e')][_0xfcfe('0x31')]+=0x1;_0x51f941[_0xfcfe('0x5e')][_0xfcfe('0x2c')]+=_0x358411[_0x5caa98][_0xfcfe('0x5f')]-_0x358411[_0x5caa98]['billableseconds']||0x0;_0x51f941[_0xfcfe('0x5e')][_0xfcfe('0x2d')]+=_0x358411[_0x5caa98][_0xfcfe('0x61')];}}}return _0x51f941[_0xfcfe('0x5e')];};};Realtime[_0xfcfe('0x3f')]['initCampaigns']=function(){var _0x3abb63=this;return function(_0x4dc5bb){if(_0x4dc5bb){freeIsNotKey(_0x4dc5bb,_0x3abb63[_0xfcfe('0x18')],_0xfcfe('0x27'));for(var _0x4fa622=0x0,_0x219900={};_0x4fa622<_0x4dc5bb[_0xfcfe('0x41')];_0x4fa622+=0x1){_0x219900=_0x4dc5bb[_0x4fa622];if(_[_0xfcfe('0x42')](_0x3abb63[_0xfcfe('0x18')][_0x219900[_0xfcfe('0x27')]])){_0x3abb63[_0xfcfe('0x18')][_0x219900[_0xfcfe('0x27')]]=new Campaign(_0x219900);}else{_0x3abb63[_0xfcfe('0x3e')](_0x3abb63['campaigns'][_0x219900[_0xfcfe('0x27')]],_0x219900);_0x3abb63['campaigns'][_0x219900[_0xfcfe('0x27')]][_0xfcfe('0x62')]=_0x219900[_0xfcfe('0x63')]?_0x219900[_0xfcfe('0x63')][_0xfcfe('0x27')]:undefined;}}}return _0x3abb63[_0xfcfe('0x18')];};};Realtime['prototype'][_0xfcfe('0x64')]=function(){var _0x5b2525=this;return function(_0x186422){if(_0x186422){freeIsNotKey(_0x186422,_0x5b2525[_0xfcfe('0x1a')],'id');for(var _0x672a1=0x0,_0xe705b0={};_0x672a1<_0x186422[_0xfcfe('0x41')];_0x672a1+=0x1){_0xe705b0=_0x186422[_0x672a1];if(_[_0xfcfe('0x42')](_0x5b2525[_0xfcfe('0x1a')][_0xe705b0['id']])){_0x5b2525[_0xfcfe('0x1a')][_0xe705b0['id']]=new VoiceExtension(_0xe705b0);}else{_0x5b2525[_0xfcfe('0x3e')](_0x5b2525[_0xfcfe('0x1a')][_0xe705b0['id']],_0xe705b0);}}}return _0x5b2525[_0xfcfe('0x1a')];};};Realtime[_0xfcfe('0x3f')]['initCampaignHopperHistory']=function(){var _0x18790e=this;return function(_0x554303){clearCampaigns(_0x18790e[_0xfcfe('0x18')]);for(var _0x51bf5c=0x0;_0x51bf5c<_0x554303['length'];_0x51bf5c+=0x1){_[_0xfcfe('0x65')](_0x18790e[_0xfcfe('0x18')][_0x554303[_0x51bf5c][_0xfcfe('0x27')]],_0x554303[_0x51bf5c]);}return _0x18790e[_0xfcfe('0x18')];};};Realtime['prototype']['initFaxAccounts']=function(){var _0x468724=this;return function(_0x1d46c5){if(_0x1d46c5){freeIsNotKey(_0x1d46c5,_0x468724['faxAccounts'],'id');for(var _0x1e58cc=0x0,_0x1f991b={},_0x506e99={};_0x1e58cc<_0x1d46c5['length'];_0x1e58cc+=0x1){_0x1f991b=_0x1d46c5[_0x1e58cc];if(_[_0xfcfe('0x42')](_0x468724[_0xfcfe('0x23')][_0x1f991b['id']])){_0x468724[_0xfcfe('0x23')][_0x1f991b['id']]=new FaxAccount(_0x1f991b);}else{_0x468724[_0xfcfe('0x3e')](_0x468724[_0xfcfe('0x23')][_0x1f991b['id']],_0x1f991b);}}}return _0x468724[_0xfcfe('0x23')];};};module[_0xfcfe('0x66')]=Realtime; \ No newline at end of file diff --git a/server/services/ami/report/index.js b/server/services/ami/report/index.js index d927390..8a19aae 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 _0xe637=['originatecalleridnum','disposition','connectedlinenum','calleridname','monitor','monitors','createdAt','connectedlinename','xcally-motion-dialer','voiceAgentReport','isArray','startsWith','indexOf','mobile','phone','substring','blindTransfer','attendedTransfer','exports','lodash','moment','util','../../../config/environment','ami','../ami','../rpc/memberReport','../rpc/voiceQueueReport','../rpc/voiceRecording','../rpc/voiceTransferReport','./voiceQueueReport','./voiceCallReport','./voiceDialReport','realtime','agents','telephones','prototype','xdr','disabled','custom:voiceQueueReport','voiceQueueReport','bind','custom:voiceCallReport','custom:voiceAgentReport','custom:voiceDialReport','voiceDialReport','blindtransfer','findAgent','accountcode','name','find','interface','format','SIP/%s','length','lastAssignedTo','isNil','queuecallercomplete','queuecallercompleteAt','YYYY-MM-DD\x20HH:mm:ss','queuecallerexit','queuecallerexitAt','create','match','voiceCallReport','exten','type','lastapplication','queue','from-voip-provider','destination','callerid','context','from-sip','xcally-motion-preview','calleridpreview','calleridnum','channel','destinationchannel'];(function(_0x133277,_0xb1d6b2){var _0x5b4a22=function(_0x484c26){while(--_0x484c26){_0x133277['push'](_0x133277['shift']());}};_0x5b4a22(++_0xb1d6b2);}(_0xe637,0x14b));var _0x7e63=function(_0x150e99,_0x24f975){_0x150e99=_0x150e99-0x0;var _0x3e17ca=_0xe637[_0x150e99];return _0x3e17ca;};'use strict';var BPromise=require('bluebird');var _=require(_0x7e63('0x0'));var moment=require(_0x7e63('0x1'));var util=require(_0x7e63('0x2'));var config=require(_0x7e63('0x3'));var logger=require('../../../config/logger')(_0x7e63('0x4'));var ami=require(_0x7e63('0x5'));var RpcVoiceAgentReport=require('../rpc/voiceAgentReport');var RpcVoiceCallReport=require('../rpc/voiceCallReport');var RpcVoiceDialReport=require('../rpc/voiceDialReport');var RpcMemberReport=require(_0x7e63('0x6'));var RpcVoiceQueueReport=require(_0x7e63('0x7'));var RpcVoiceRecording=require(_0x7e63('0x8'));var RpcVoiceTransferReport=require(_0x7e63('0x9'));var VoiceQueueReport=require(_0x7e63('0xa'));var VoiceCallReport=require(_0x7e63('0xb'));var VoiceAgentReport=require('./voiceAgentReport');var VoiceDialReport=require(_0x7e63('0xc'));var UserReport=require('./userReport');function Report(_0x278c90){this[_0x7e63('0xd')]=_0x278c90;this[_0x7e63('0xe')]=_0x278c90[_0x7e63('0xe')];this[_0x7e63('0xf')]=_0x278c90[_0x7e63('0xf')];}Report[_0x7e63('0x10')]['sync']=function(_0x45e555){var _0xcd8cc9=new VoiceQueueReport(this['realtime']);var _0x318938=new VoiceAgentReport(this['realtime']);var _0x263b13=new VoiceDialReport(this['realtime']);var _0x330aa5=new VoiceCallReport(this[_0x7e63('0xd')]);var _0x422454=new UserReport(this[_0x7e63('0xd')]);if(config['xdr']&&config[_0x7e63('0x11')][_0x7e63('0x12')]){ami['on'](_0x7e63('0x13'),this[_0x7e63('0x14')][_0x7e63('0x15')](this));ami['on'](_0x7e63('0x16'),this['voiceCallReport'][_0x7e63('0x15')](this));ami['on'](_0x7e63('0x17'),this['voiceAgentReport'][_0x7e63('0x15')](this));ami['on'](_0x7e63('0x18'),this[_0x7e63('0x19')][_0x7e63('0x15')](this));ami['on'](_0x7e63('0x1a'),this['blindTransfer'][_0x7e63('0x15')](this));ami['on']('attendedtransfer',this['attendedTransfer'][_0x7e63('0x15')](this));}};Report[_0x7e63('0x10')][_0x7e63('0x1b')]=function(_0x21ea59){var _0x132928=undefined;_0x132928=_['find'](this[_0x7e63('0xe')],function(_0x306d83){return _0x306d83[_0x7e63('0x1c')]==_0x21ea59||_0x306d83[_0x7e63('0x1d')]==_0x21ea59;});if(_['isNil'](_0x132928)){var _0x205748=_[_0x7e63('0x1e')](this[_0x7e63('0xf')],function(_0x569a20){return _0x569a20[_0x7e63('0x1c')]==_0x21ea59||_0x569a20[_0x7e63('0x1d')]==_0x21ea59;});if(_0x205748){_0x132928=_[_0x7e63('0x1e')](this[_0x7e63('0xe')],function(_0x52c017){return _0x52c017[_0x7e63('0x1f')]==util[_0x7e63('0x20')](_0x7e63('0x21'),_0x205748['name']);});}}return _0x132928;};Report[_0x7e63('0x10')][_0x7e63('0x14')]=function(_0x6916c9){for(var _0x2f5da6=0x0;_0x2f5da6<_0x6916c9[_0x7e63('0x22')];_0x2f5da6+=0x1){var _0x29234f=this[_0x7e63('0x1b')](_0x6916c9[_0x2f5da6]['connectedlinenum']);if(_0x29234f){_0x6916c9[_0x2f5da6][_0x7e63('0x1c')]=_0x29234f['accountcode'];_0x6916c9[_0x2f5da6]['assigned']=!![];_0x6916c9[_0x2f5da6][_0x7e63('0x23')]=_0x29234f[_0x7e63('0x1d')];_0x6916c9[_0x2f5da6]['interface']=_[_0x7e63('0x24')](_0x29234f[_0x7e63('0x1f')])?util['format'](_0x7e63('0x21'),_0x29234f['name']):_0x29234f[_0x7e63('0x1f')];if(_0x6916c9[_0x2f5da6][_0x7e63('0x25')]){_0x6916c9[_0x2f5da6][_0x7e63('0x26')]=moment()[_0x7e63('0x20')](_0x7e63('0x27'));}if(_0x6916c9[_0x2f5da6][_0x7e63('0x28')]){_0x6916c9[_0x2f5da6][_0x7e63('0x29')]=moment()[_0x7e63('0x20')](_0x7e63('0x27'));}RpcMemberReport[_0x7e63('0x14')](_0x6916c9[_0x2f5da6]);}RpcVoiceQueueReport[_0x7e63('0x2a')](_0x6916c9[_0x2f5da6]);}};function extractCalleridNumber(_0x33c94a){var _0x2a52b8=_0x33c94a[_0x7e63('0x2b')](/<(.*?)>/);return _0x2a52b8?_0x2a52b8[0x1]:_0x33c94a;}Report[_0x7e63('0x10')][_0x7e63('0x2c')]=function(_0x1dfbe9){_0x1dfbe9['destination']=_0x1dfbe9['destination']||_0x1dfbe9[_0x7e63('0x2d')];if(_0x1dfbe9[_0x7e63('0x2e')]=='dialer'){_0x1dfbe9[_0x7e63('0x2f')]='queue';_0x1dfbe9['lastdata']=_0x1dfbe9[_0x7e63('0x30')];if(_0x1dfbe9['context']==_0x7e63('0x31')){_0x1dfbe9[_0x7e63('0x1c')]='';_0x1dfbe9[_0x7e63('0x32')]=extractCalleridNumber(_0x1dfbe9[_0x7e63('0x33')]);}else if(_0x1dfbe9[_0x7e63('0x34')]==_0x7e63('0x35')){if(_0x1dfbe9['destination']==_0x7e63('0x36')){_0x1dfbe9[_0x7e63('0x32')]=extractCalleridNumber(_0x1dfbe9[_0x7e63('0x37')]);_0x1dfbe9[_0x7e63('0x38')]=_0x1dfbe9['originatecalleridnum'];_0x1dfbe9['destinationchannel']=[_0x1dfbe9['channel'],_0x1dfbe9[_0x7e63('0x39')]=_0x1dfbe9[_0x7e63('0x3a')]][0x0];_0x1dfbe9[_0x7e63('0x33')]=_0x1dfbe9[_0x7e63('0x37')];}else{_0x1dfbe9['destination']=_0x1dfbe9['calleridnum'];_0x1dfbe9['calleridnum']=_0x1dfbe9[_0x7e63('0x3b')];if(_0x1dfbe9[_0x7e63('0x3c')]=='ANSWERED'){_0x1dfbe9[_0x7e63('0x1c')]=_0x1dfbe9[_0x7e63('0x3d')];}else{_0x1dfbe9['accountcode']='';}}}}else{_0x1dfbe9[_0x7e63('0x33')]=util[_0x7e63('0x20')]('\x22%s\x22\x20<%s>',_0x1dfbe9[_0x7e63('0x3e')],_0x1dfbe9[_0x7e63('0x38')]);}RpcVoiceCallReport[_0x7e63('0x2a')](_0x1dfbe9);if(_0x1dfbe9[_0x7e63('0x3f')]){for(var _0x4301a5=0x0;_0x4301a5<_0x1dfbe9[_0x7e63('0x40')][_0x7e63('0x22')];_0x4301a5+=0x1){_0x1dfbe9['monitorFilename']=_0x1dfbe9[_0x7e63('0x40')][_0x4301a5]['filename'];_0x1dfbe9[_0x7e63('0x41')]=_0x1dfbe9['monitors'][_0x4301a5][_0x7e63('0x41')];if(_0x1dfbe9['exten']==_0x7e63('0x36')){_0x1dfbe9[_0x7e63('0x38')]=_0x1dfbe9[_0x7e63('0x3d')];_0x1dfbe9[_0x7e63('0x3e')]=_0x1dfbe9[_0x7e63('0x42')];_0x1dfbe9[_0x7e63('0x3d')]=_0x1dfbe9['accountcode'];_0x1dfbe9[_0x7e63('0x42')]=_0x1dfbe9['membername'];_0x1dfbe9[_0x7e63('0x2d')]=_0x1dfbe9[_0x7e63('0x3b')];}else if(_0x1dfbe9[_0x7e63('0x2d')]==_0x7e63('0x43')){_0x1dfbe9[_0x7e63('0x38')]=_0x1dfbe9['destination'];_0x1dfbe9[_0x7e63('0x2d')]=_0x1dfbe9[_0x7e63('0x3b')];}RpcVoiceRecording['create'](_0x1dfbe9);}}};Report[_0x7e63('0x10')][_0x7e63('0x44')]=function(_0x5af72d){if(_[_0x7e63('0x45')](_0x5af72d)){_0x5af72d['forEach'](function(_0x30cb0f){RpcVoiceAgentReport[_0x7e63('0x2a')](_0x30cb0f);});}else{RpcVoiceAgentReport[_0x7e63('0x2a')](_0x5af72d);}};Report[_0x7e63('0x10')][_0x7e63('0x19')]=function(_0x5498d8){RpcVoiceDialReport['create'](_0x5498d8);var _0x40d72b=undefined;var _0x358aa5=_0x5498d8['channel'];if(_[_0x7e63('0x46')](_0x358aa5,'Local')){var _0x353bc0=_0x358aa5['substring'](_0x358aa5[_0x7e63('0x47')]('/')+0x1,_0x358aa5[_0x7e63('0x47')]('@'));_0x40d72b=_['find'](this['agents'],function(_0x21aee3){return _0x21aee3[_0x7e63('0x48')]==_0x353bc0||_0x21aee3[_0x7e63('0x49')]==_0x353bc0||_0x21aee3['accountcode']==_0x353bc0;});}else{var _0x353bc0=_0x358aa5[_0x7e63('0x4a')](_0x358aa5[_0x7e63('0x47')]('/')+0x1,_0x358aa5['lastIndexOf']('-'));_0x40d72b=this[_0x7e63('0x1b')](_0x353bc0);}if(_0x40d72b){_0x5498d8[_0x7e63('0x1f')]=_[_0x7e63('0x24')](_0x40d72b[_0x7e63('0x1f')])?util[_0x7e63('0x20')](_0x7e63('0x21'),_0x40d72b[_0x7e63('0x1d')]):_0x40d72b[_0x7e63('0x1f')];_0x5498d8['membername']=_0x40d72b[_0x7e63('0x1d')];_0x5498d8['accountcode']=_0x40d72b[_0x7e63('0x1c')];RpcMemberReport[_0x7e63('0x19')](_0x5498d8);}};Report[_0x7e63('0x10')][_0x7e63('0x4b')]=function(_0x581a8d){RpcVoiceTransferReport[_0x7e63('0x4b')](_0x581a8d);};Report[_0x7e63('0x10')]['attendedTransfer']=function(_0xef2fec){RpcVoiceTransferReport[_0x7e63('0x4c')](_0xef2fec);};module[_0x7e63('0x4d')]=Report; \ No newline at end of file +var _0xdee3=['SIP/%s','queuecallercomplete','YYYY-MM-DD\x20HH:mm:ss','queuecallerexit','queuecallerexitAt','create','match','exten','type','lastdata','from-voip-provider','destination','callerid','from-sip','xcally-motion-preview','calleridpreview','calleridnum','originatecalleridnum','disposition','\x22%s\x22\x20<%s>','calleridname','monitor','monitors','monitorFilename','filename','createdAt','connectedlinename','xcally-motion-dialer','isArray','forEach','channel','Local','substring','indexOf','lastIndexOf','membername','exports','bluebird','moment','util','../../../config/environment','../../../config/logger','ami','../ami','../rpc/voiceAgentReport','../rpc/voiceCallReport','../rpc/voiceDialReport','../rpc/memberReport','../rpc/voiceTransferReport','./voiceQueueReport','./voiceCallReport','realtime','agents','telephones','prototype','sync','xdr','disabled','custom:voiceQueueReport','voiceQueueReport','voiceCallReport','bind','custom:voiceAgentReport','voiceAgentReport','voiceDialReport','blindtransfer','blindTransfer','attendedtransfer','attendedTransfer','findAgent','accountcode','name','isNil','find','interface','format','length','connectedlinenum','assigned'];(function(_0x1c0153,_0x45562f){var _0x3fffe5=function(_0x13155a){while(--_0x13155a){_0x1c0153['push'](_0x1c0153['shift']());}};_0x3fffe5(++_0x45562f);}(_0xdee3,0x1b0));var _0x3dee=function(_0x34bbd9,_0x4850d7){_0x34bbd9=_0x34bbd9-0x0;var _0x474191=_0xdee3[_0x34bbd9];return _0x474191;};'use strict';var BPromise=require(_0x3dee('0x0'));var _=require('lodash');var moment=require(_0x3dee('0x1'));var util=require(_0x3dee('0x2'));var config=require(_0x3dee('0x3'));var logger=require(_0x3dee('0x4'))(_0x3dee('0x5'));var ami=require(_0x3dee('0x6'));var RpcVoiceAgentReport=require(_0x3dee('0x7'));var RpcVoiceCallReport=require(_0x3dee('0x8'));var RpcVoiceDialReport=require(_0x3dee('0x9'));var RpcMemberReport=require(_0x3dee('0xa'));var RpcVoiceQueueReport=require('../rpc/voiceQueueReport');var RpcVoiceRecording=require('../rpc/voiceRecording');var RpcVoiceTransferReport=require(_0x3dee('0xb'));var VoiceQueueReport=require(_0x3dee('0xc'));var VoiceCallReport=require(_0x3dee('0xd'));var VoiceAgentReport=require('./voiceAgentReport');var VoiceDialReport=require('./voiceDialReport');var UserReport=require('./userReport');function Report(_0xe5e7d2){this[_0x3dee('0xe')]=_0xe5e7d2;this[_0x3dee('0xf')]=_0xe5e7d2[_0x3dee('0xf')];this['telephones']=_0xe5e7d2[_0x3dee('0x10')];}Report[_0x3dee('0x11')][_0x3dee('0x12')]=function(_0x104da7){var _0x16a1fc=new VoiceQueueReport(this[_0x3dee('0xe')]);var _0x116695=new VoiceAgentReport(this[_0x3dee('0xe')]);var _0x4ab697=new VoiceDialReport(this[_0x3dee('0xe')]);var _0x65affe=new VoiceCallReport(this[_0x3dee('0xe')]);var _0x11ee35=new UserReport(this['realtime']);if(config[_0x3dee('0x13')]&&config[_0x3dee('0x13')][_0x3dee('0x14')]){ami['on'](_0x3dee('0x15'),this[_0x3dee('0x16')]['bind'](this));ami['on']('custom:voiceCallReport',this[_0x3dee('0x17')][_0x3dee('0x18')](this));ami['on'](_0x3dee('0x19'),this[_0x3dee('0x1a')][_0x3dee('0x18')](this));ami['on']('custom:voiceDialReport',this[_0x3dee('0x1b')][_0x3dee('0x18')](this));ami['on'](_0x3dee('0x1c'),this[_0x3dee('0x1d')][_0x3dee('0x18')](this));ami['on'](_0x3dee('0x1e'),this[_0x3dee('0x1f')][_0x3dee('0x18')](this));}};Report[_0x3dee('0x11')][_0x3dee('0x20')]=function(_0x1c37b3){var _0x344dc6=undefined;_0x344dc6=_['find'](this['agents'],function(_0x54a4b5){return _0x54a4b5[_0x3dee('0x21')]==_0x1c37b3||_0x54a4b5[_0x3dee('0x22')]==_0x1c37b3;});if(_[_0x3dee('0x23')](_0x344dc6)){var _0x1ef812=_[_0x3dee('0x24')](this[_0x3dee('0x10')],function(_0x22571c){return _0x22571c[_0x3dee('0x21')]==_0x1c37b3||_0x22571c[_0x3dee('0x22')]==_0x1c37b3;});if(_0x1ef812){_0x344dc6=_[_0x3dee('0x24')](this[_0x3dee('0xf')],function(_0x40eaa6){return _0x40eaa6[_0x3dee('0x25')]==util[_0x3dee('0x26')]('SIP/%s',_0x1ef812['name']);});}}return _0x344dc6;};Report[_0x3dee('0x11')]['voiceQueueReport']=function(_0x54ca5e){for(var _0x1a1db0=0x0;_0x1a1db0<_0x54ca5e[_0x3dee('0x27')];_0x1a1db0+=0x1){var _0x3e7728=this['findAgent'](_0x54ca5e[_0x1a1db0][_0x3dee('0x28')]);if(_0x3e7728){_0x54ca5e[_0x1a1db0][_0x3dee('0x21')]=_0x3e7728['accountcode'];_0x54ca5e[_0x1a1db0][_0x3dee('0x29')]=!![];_0x54ca5e[_0x1a1db0]['lastAssignedTo']=_0x3e7728[_0x3dee('0x22')];_0x54ca5e[_0x1a1db0][_0x3dee('0x25')]=_[_0x3dee('0x23')](_0x3e7728[_0x3dee('0x25')])?util[_0x3dee('0x26')](_0x3dee('0x2a'),_0x3e7728['name']):_0x3e7728[_0x3dee('0x25')];if(_0x54ca5e[_0x1a1db0][_0x3dee('0x2b')]){_0x54ca5e[_0x1a1db0]['queuecallercompleteAt']=moment()['format'](_0x3dee('0x2c'));}if(_0x54ca5e[_0x1a1db0][_0x3dee('0x2d')]){_0x54ca5e[_0x1a1db0][_0x3dee('0x2e')]=moment()[_0x3dee('0x26')](_0x3dee('0x2c'));}RpcMemberReport[_0x3dee('0x16')](_0x54ca5e[_0x1a1db0]);}RpcVoiceQueueReport[_0x3dee('0x2f')](_0x54ca5e[_0x1a1db0]);}};function extractCalleridNumber(_0x3d2609){var _0x5e639a=_0x3d2609[_0x3dee('0x30')](/<(.*?)>/);return _0x5e639a?_0x5e639a[0x1]:_0x3d2609;}Report[_0x3dee('0x11')]['voiceCallReport']=function(_0x18f73d){_0x18f73d['destination']=_0x18f73d['destination']||_0x18f73d[_0x3dee('0x31')];if(_0x18f73d[_0x3dee('0x32')]=='dialer'){_0x18f73d['lastapplication']='queue';_0x18f73d[_0x3dee('0x33')]=_0x18f73d['queue'];if(_0x18f73d['context']==_0x3dee('0x34')){_0x18f73d['accountcode']='';_0x18f73d[_0x3dee('0x35')]=extractCalleridNumber(_0x18f73d[_0x3dee('0x36')]);}else if(_0x18f73d['context']==_0x3dee('0x37')){if(_0x18f73d[_0x3dee('0x35')]==_0x3dee('0x38')){_0x18f73d[_0x3dee('0x35')]=extractCalleridNumber(_0x18f73d[_0x3dee('0x39')]);_0x18f73d[_0x3dee('0x3a')]=_0x18f73d[_0x3dee('0x3b')];_0x18f73d['destinationchannel']=[_0x18f73d['channel'],_0x18f73d['channel']=_0x18f73d['destinationchannel']][0x0];_0x18f73d['callerid']=_0x18f73d[_0x3dee('0x39')];}else{_0x18f73d[_0x3dee('0x35')]=_0x18f73d['calleridnum'];_0x18f73d[_0x3dee('0x3a')]=_0x18f73d[_0x3dee('0x3b')];if(_0x18f73d[_0x3dee('0x3c')]=='ANSWERED'){_0x18f73d[_0x3dee('0x21')]=_0x18f73d['connectedlinenum'];}else{_0x18f73d['accountcode']='';}}}}else{_0x18f73d[_0x3dee('0x36')]=util['format'](_0x3dee('0x3d'),_0x18f73d[_0x3dee('0x3e')],_0x18f73d[_0x3dee('0x3a')]);}RpcVoiceCallReport[_0x3dee('0x2f')](_0x18f73d);if(_0x18f73d[_0x3dee('0x3f')]){for(var _0x5a67f7=0x0;_0x5a67f7<_0x18f73d[_0x3dee('0x40')][_0x3dee('0x27')];_0x5a67f7+=0x1){_0x18f73d[_0x3dee('0x41')]=_0x18f73d[_0x3dee('0x40')][_0x5a67f7][_0x3dee('0x42')];_0x18f73d[_0x3dee('0x43')]=_0x18f73d['monitors'][_0x5a67f7]['createdAt'];if(_0x18f73d['exten']==_0x3dee('0x38')){_0x18f73d[_0x3dee('0x3a')]=_0x18f73d[_0x3dee('0x28')];_0x18f73d[_0x3dee('0x3e')]=_0x18f73d[_0x3dee('0x44')];_0x18f73d[_0x3dee('0x28')]=_0x18f73d[_0x3dee('0x21')];_0x18f73d[_0x3dee('0x44')]=_0x18f73d['membername'];_0x18f73d[_0x3dee('0x31')]=_0x18f73d[_0x3dee('0x3b')];}else if(_0x18f73d[_0x3dee('0x31')]==_0x3dee('0x45')){_0x18f73d['calleridnum']=_0x18f73d[_0x3dee('0x35')];_0x18f73d[_0x3dee('0x31')]=_0x18f73d[_0x3dee('0x3b')];}RpcVoiceRecording[_0x3dee('0x2f')](_0x18f73d);}}};Report[_0x3dee('0x11')]['voiceAgentReport']=function(_0x442d04){if(_[_0x3dee('0x46')](_0x442d04)){_0x442d04[_0x3dee('0x47')](function(_0x319ade){RpcVoiceAgentReport['create'](_0x319ade);});}else{RpcVoiceAgentReport[_0x3dee('0x2f')](_0x442d04);}};Report['prototype']['voiceDialReport']=function(_0x3021da){RpcVoiceDialReport[_0x3dee('0x2f')](_0x3021da);var _0x513459=undefined;var _0x56b25f=_0x3021da[_0x3dee('0x48')];if(_['startsWith'](_0x56b25f,_0x3dee('0x49'))){var _0x18be3=_0x56b25f[_0x3dee('0x4a')](_0x56b25f['indexOf']('/')+0x1,_0x56b25f['indexOf']('@'));_0x513459=_['find'](this[_0x3dee('0xf')],function(_0x2c4d32){return _0x2c4d32['mobile']==_0x18be3||_0x2c4d32['phone']==_0x18be3||_0x2c4d32[_0x3dee('0x21')]==_0x18be3;});}else{var _0x18be3=_0x56b25f[_0x3dee('0x4a')](_0x56b25f[_0x3dee('0x4b')]('/')+0x1,_0x56b25f[_0x3dee('0x4c')]('-'));_0x513459=this[_0x3dee('0x20')](_0x18be3);}if(_0x513459){_0x3021da['interface']=_[_0x3dee('0x23')](_0x513459[_0x3dee('0x25')])?util[_0x3dee('0x26')](_0x3dee('0x2a'),_0x513459[_0x3dee('0x22')]):_0x513459[_0x3dee('0x25')];_0x3021da[_0x3dee('0x4d')]=_0x513459[_0x3dee('0x22')];_0x3021da[_0x3dee('0x21')]=_0x513459['accountcode'];RpcMemberReport[_0x3dee('0x1b')](_0x3021da);}};Report[_0x3dee('0x11')]['blindTransfer']=function(_0x1c0601){RpcVoiceTransferReport[_0x3dee('0x1d')](_0x1c0601);};Report[_0x3dee('0x11')][_0x3dee('0x1f')]=function(_0x2ff2f3){RpcVoiceTransferReport[_0x3dee('0x1f')](_0x2ff2f3);};module[_0x3dee('0x4e')]=Report; \ No newline at end of file diff --git a/server/services/ami/report/userReport.js b/server/services/ami/report/userReport.js index 6f0be32..432c0bd 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 _0xe48a=['phone','accountcode','peer','status','address','trunk:save','[syncPeerStatus][UserReport]','lodash','bluebird','util','ioredis','../../../config/environment','ami','../ami','redis','defaults','localhost','socket.io-emitter','trunks','agents','telephones','syncRegistry','bind','devicestatechange','syncDeviceState','peerstatus','syncPeerStatus','loopSyncRealTimeShow','resolve','actionSipShowRegistry','then','actionSipPeerStatus','[loopSyncRealTimeShow]','error','inspect','prototype','actionDeviceStateList','catch','emit','isNotNull','find','stateRegistry','state','merge','actionid','username','format','name','[syncRegistry][UserReport]','device','toLowerCase','stateTime','toNumber','updateStatusRealtime','telephone:%s','trunk:%s','substring','indexOf','mobile'];(function(_0x3dbf08,_0x1bbc94){var _0x258697=function(_0x7e2111){while(--_0x7e2111){_0x3dbf08['push'](_0x3dbf08['shift']());}};_0x258697(++_0x1bbc94);}(_0xe48a,0x1df));var _0xae48=function(_0x4d2169,_0x353eb9){_0x4d2169=_0x4d2169-0x0;var _0x52e417=_0xe48a[_0x4d2169];return _0x52e417;};'use strict';var _=require(_0xae48('0x0'));var moment=require('moment');var BPromise=require(_0xae48('0x1'));var util=require(_0xae48('0x2'));var Redis=require(_0xae48('0x3'));var config=require(_0xae48('0x4'));var logger=require('../../../config/logger')(_0xae48('0x5'));var ami=require(_0xae48('0x6'));config[_0xae48('0x7')]=_[_0xae48('0x8')](config['redis'],{'host':_0xae48('0x9'),'port':0x18eb});var io=require(_0xae48('0xa'))(new Redis(config[_0xae48('0x7')]));function UserReport(_0x284f5c){this[_0xae48('0xb')]=_0x284f5c[_0xae48('0xb')];this[_0xae48('0xc')]=_0x284f5c['agents'];this[_0xae48('0xd')]=_0x284f5c[_0xae48('0xd')];ami['on']('registryentry',this[_0xae48('0xe')][_0xae48('0xf')](this));ami['on']('registry',this['syncRegistry']['bind'](this));ami['on'](_0xae48('0x10'),this[_0xae48('0x11')][_0xae48('0xf')](this));ami['on'](_0xae48('0x12'),this[_0xae48('0x13')][_0xae48('0xf')](this));this[_0xae48('0x14')]();return BPromise[_0xae48('0x15')]()['then'](ami[_0xae48('0x16')]())[_0xae48('0x17')](ami['actionDeviceStateList']())[_0xae48('0x17')](ami[_0xae48('0x18')]())['catch'](loggerCatch(_0xae48('0x19')));}function loggerCatch(_0x246c81){return function(_0x19d574){logger[_0xae48('0x1a')](_0x246c81,util[_0xae48('0x1b')](_0x19d574,{'showHidden':![],'depth':null}));};}UserReport[_0xae48('0x1c')][_0xae48('0x14')]=function(){setInterval(function(){BPromise[_0xae48('0x15')]()[_0xae48('0x17')](ami[_0xae48('0x16')]())[_0xae48('0x17')](ami[_0xae48('0x1d')]())['then'](ami['actionSipPeerStatus']())[_0xae48('0x1e')](loggerCatch(_0xae48('0x19')));},0x32c8);};UserReport['prototype']['isNotNull']=function(_0x159879){return _0x159879!==null&&!_['isUndefined'](_0x159879);};UserReport[_0xae48('0x1c')][_0xae48('0x1f')]=function(_0x17e2de,_0x5eaaae,_0x8d83d5){io['to'](_0x17e2de)['emit'](_0x5eaaae,_0x8d83d5);};UserReport[_0xae48('0x1c')][_0xae48('0xe')]=function(_0x59ed49){try{if(this[_0xae48('0x20')](_0x59ed49)){var _0x4aa93b=_[_0xae48('0x21')](this[_0xae48('0xb')],{'registry':_0x59ed49['username']});if(_0x4aa93b){_0x59ed49[_0xae48('0x22')]=_0x59ed49[_0xae48('0x23')];_[_0xae48('0x24')](_0x4aa93b,_['omit'](_0x59ed49,['event',_0xae48('0x25'),_0xae48('0x26'),_0xae48('0x23')]));this[_0xae48('0x1f')](util[_0xae48('0x27')]('trunk:%s',_0x4aa93b[_0xae48('0x28')]),'trunk:save',_0x4aa93b);}}}catch(_0x529948){logger[_0xae48('0x1a')](_0xae48('0x29'),util['inspect'](_0x529948,{'showHidden':![],'depth':null}));}};UserReport[_0xae48('0x1c')][_0xae48('0x11')]=function(_0x2b4a22){try{if(this[_0xae48('0x20')](_0x2b4a22)){if(this['agents'][_0x2b4a22['device']]){if(!this[_0xae48('0xc')][_0x2b4a22[_0xae48('0x2a')]]['local']||_0x2b4a22[_0xae48('0x23')]['toLowerCase']()=='inuse'){this['agents'][_0x2b4a22['device']]['local']=![];if(this[_0xae48('0xc')][_0x2b4a22[_0xae48('0x2a')]]['state']!==_0x2b4a22[_0xae48('0x23')][_0xae48('0x2b')]()){this['agents'][_0x2b4a22[_0xae48('0x2a')]][_0xae48('0x2c')]=_[_0xae48('0x2d')](moment()[_0xae48('0x27')]('x'));}this[_0xae48('0xc')][_0x2b4a22['device']][_0xae48('0x23')]=_0x2b4a22[_0xae48('0x23')]['toLowerCase']();this['agents'][_0x2b4a22[_0xae48('0x2a')]][_0xae48('0x2e')](_0x2b4a22);}}else if(this['telephones'][_0x2b4a22['device']]){if(this['telephones'][_0x2b4a22[_0xae48('0x2a')]][_0xae48('0x23')]!==_0x2b4a22['state'][_0xae48('0x2b')]()){this[_0xae48('0xd')][_0x2b4a22[_0xae48('0x2a')]]['stateTime']=_[_0xae48('0x2d')](moment()[_0xae48('0x27')]('x'));}this[_0xae48('0xd')][_0x2b4a22['device']][_0xae48('0x23')]=_0x2b4a22['state'][_0xae48('0x2b')]();this[_0xae48('0x1f')](util[_0xae48('0x27')](_0xae48('0x2f'),this[_0xae48('0xd')][_0x2b4a22[_0xae48('0x2a')]][_0xae48('0x28')]),'telephone:save',this[_0xae48('0xd')][_0x2b4a22[_0xae48('0x2a')]]);}else if(this[_0xae48('0xb')][_0x2b4a22['device']]){if(this[_0xae48('0xb')][_0x2b4a22['device']]['state']!==_0x2b4a22['state'][_0xae48('0x2b')]()){this[_0xae48('0xb')][_0x2b4a22['device']][_0xae48('0x2c')]=_[_0xae48('0x2d')](moment()[_0xae48('0x27')]('x'));}this[_0xae48('0xb')][_0x2b4a22['device']][_0xae48('0x23')]=_0x2b4a22[_0xae48('0x23')][_0xae48('0x2b')]();this['emit'](util['format'](_0xae48('0x30'),this[_0xae48('0xb')][_0x2b4a22[_0xae48('0x2a')]][_0xae48('0x28')]),'trunk:save',this['trunks'][_0x2b4a22[_0xae48('0x2a')]]);}else if(_['startsWith'](_0x2b4a22['device'],'Queue')){}else if(_['startsWith'](_0x2b4a22[_0xae48('0x2a')],'Local')){var _0x334f86=_0x2b4a22['device'];var _0x2cab6e=_0x334f86[_0xae48('0x31')](_0x334f86[_0xae48('0x32')]('/')+0x1,_0x334f86[_0xae48('0x32')]('@'));var _0x38044c=_['find'](this[_0xae48('0xc')],function(_0x10f3fa){return _0x10f3fa[_0xae48('0x33')]==_0x2cab6e||_0x10f3fa[_0xae48('0x34')]==_0x2cab6e||_0x10f3fa[_0xae48('0x35')]==_0x2cab6e;});if(_0x38044c){if(_0x38044c['state']!==_0x2b4a22[_0xae48('0x23')][_0xae48('0x2b')]()){_0x38044c[_0xae48('0x2c')]=_[_0xae48('0x2d')](moment()[_0xae48('0x27')]('x'));}_0x38044c['state']=_0x2b4a22[_0xae48('0x23')][_0xae48('0x2b')]();_0x38044c['local']=!![];_0x38044c[_0xae48('0x2e')](_0x2b4a22);}}else{}}}catch(_0x48205b){logger['error']('[syncDeviceState][UserReport]',util[_0xae48('0x1b')](_0x48205b,{'showHidden':![],'depth':null}));}};UserReport[_0xae48('0x1c')][_0xae48('0x13')]=function(_0xb7535c){try{if(this['isNotNull'](_0xb7535c)&&this[_0xae48('0x20')](_0xb7535c[_0xae48('0x12')])){if(this['agents'][_0xb7535c[_0xae48('0x36')]]){if(!this[_0xae48('0xc')][_0xb7535c[_0xae48('0x36')]]['local']||_0xb7535c[_0xae48('0x12')][_0xae48('0x2b')]()=='registered'){this[_0xae48('0xc')][_0xb7535c[_0xae48('0x36')]]['local']=![];this[_0xae48('0xc')][_0xb7535c['peer']][_0xae48('0x37')]=_0xb7535c[_0xae48('0x12')][_0xae48('0x2b')]();this['agents'][_0xb7535c[_0xae48('0x36')]][_0xae48('0x38')]=_0xb7535c[_0xae48('0x38')];this[_0xae48('0xc')][_0xb7535c['peer']]['updateStatusRealtime'](_0xb7535c);}}else if(this[_0xae48('0xd')][_0xb7535c[_0xae48('0x36')]]){this[_0xae48('0xd')][_0xb7535c[_0xae48('0x36')]][_0xae48('0x37')]=_0xb7535c[_0xae48('0x12')][_0xae48('0x2b')]();this[_0xae48('0xd')][_0xb7535c[_0xae48('0x36')]][_0xae48('0x38')]=_0xb7535c[_0xae48('0x38')];this[_0xae48('0x1f')](util[_0xae48('0x27')]('telephone:%s',this[_0xae48('0xd')][_0xb7535c[_0xae48('0x36')]][_0xae48('0x28')]),'telephone:save',this[_0xae48('0xd')][_0xb7535c[_0xae48('0x36')]]);}else if(this[_0xae48('0xb')][_0xb7535c[_0xae48('0x36')]]){this[_0xae48('0xb')][_0xb7535c[_0xae48('0x36')]]['status']=_0xb7535c[_0xae48('0x12')][_0xae48('0x2b')]();this[_0xae48('0xb')][_0xb7535c[_0xae48('0x36')]][_0xae48('0x38')]=_0xb7535c[_0xae48('0x38')];this['emit'](util[_0xae48('0x27')]('trunk:%s',this[_0xae48('0xb')][_0xb7535c[_0xae48('0x36')]][_0xae48('0x28')]),_0xae48('0x39'),this[_0xae48('0xb')][_0xb7535c[_0xae48('0x36')]]);}else{}}}catch(_0x207018){logger['error'](_0xae48('0x3a'),util['inspect'](_0x207018,{'showHidden':![],'depth':null}));}};module['exports']=UserReport; \ No newline at end of file +var _0xe0da=['name','trunk:save','[syncRegistry][UserReport]','device','toLowerCase','inuse','local','toNumber','updateStatusRealtime','stateTime','telephone:%s','telephone:save','startsWith','indexOf','mobile','phone','accountcode','[syncDeviceState][UserReport]','registered','peer','address','status','[syncPeerStatus][UserReport]','exports','lodash','bluebird','util','ioredis','../../../config/environment','../../../config/logger','ami','../ami','redis','defaults','localhost','socket.io-emitter','trunks','agents','telephones','registryentry','syncRegistry','registry','bind','syncDeviceState','peerstatus','syncPeerStatus','resolve','then','actionSipShowRegistry','actionDeviceStateList','catch','[loopSyncRealTimeShow]','error','inspect','prototype','loopSyncRealTimeShow','isNotNull','isUndefined','emit','find','username','stateRegistry','state','merge','omit','actionid','format','trunk:%s'];(function(_0x569729,_0x271db2){var _0x490d8d=function(_0x57a02b){while(--_0x57a02b){_0x569729['push'](_0x569729['shift']());}};_0x490d8d(++_0x271db2);}(_0xe0da,0xe4));var _0xae0d=function(_0x1fe495,_0xcf2f5f){_0x1fe495=_0x1fe495-0x0;var _0x831a05=_0xe0da[_0x1fe495];return _0x831a05;};'use strict';var _=require(_0xae0d('0x0'));var moment=require('moment');var BPromise=require(_0xae0d('0x1'));var util=require(_0xae0d('0x2'));var Redis=require(_0xae0d('0x3'));var config=require(_0xae0d('0x4'));var logger=require(_0xae0d('0x5'))(_0xae0d('0x6'));var ami=require(_0xae0d('0x7'));config[_0xae0d('0x8')]=_[_0xae0d('0x9')](config[_0xae0d('0x8')],{'host':_0xae0d('0xa'),'port':0x18eb});var io=require(_0xae0d('0xb'))(new Redis(config[_0xae0d('0x8')]));function UserReport(_0x3d4e67){this[_0xae0d('0xc')]=_0x3d4e67['trunks'];this[_0xae0d('0xd')]=_0x3d4e67['agents'];this[_0xae0d('0xe')]=_0x3d4e67[_0xae0d('0xe')];ami['on'](_0xae0d('0xf'),this[_0xae0d('0x10')]['bind'](this));ami['on'](_0xae0d('0x11'),this[_0xae0d('0x10')][_0xae0d('0x12')](this));ami['on']('devicestatechange',this[_0xae0d('0x13')][_0xae0d('0x12')](this));ami['on'](_0xae0d('0x14'),this[_0xae0d('0x15')][_0xae0d('0x12')](this));this['loopSyncRealTimeShow']();return BPromise[_0xae0d('0x16')]()[_0xae0d('0x17')](ami[_0xae0d('0x18')]())[_0xae0d('0x17')](ami[_0xae0d('0x19')]())[_0xae0d('0x17')](ami['actionSipPeerStatus']())[_0xae0d('0x1a')](loggerCatch(_0xae0d('0x1b')));}function loggerCatch(_0x43795e){return function(_0x2c64f5){logger[_0xae0d('0x1c')](_0x43795e,util[_0xae0d('0x1d')](_0x2c64f5,{'showHidden':![],'depth':null}));};}UserReport[_0xae0d('0x1e')][_0xae0d('0x1f')]=function(){setInterval(function(){BPromise[_0xae0d('0x16')]()[_0xae0d('0x17')](ami[_0xae0d('0x18')]())[_0xae0d('0x17')](ami[_0xae0d('0x19')]())['then'](ami['actionSipPeerStatus']())[_0xae0d('0x1a')](loggerCatch(_0xae0d('0x1b')));},0x32c8);};UserReport[_0xae0d('0x1e')][_0xae0d('0x20')]=function(_0x4322f0){return _0x4322f0!==null&&!_[_0xae0d('0x21')](_0x4322f0);};UserReport['prototype'][_0xae0d('0x22')]=function(_0x4d5e13,_0x17c3ae,_0x1b64ad){io['to'](_0x4d5e13)[_0xae0d('0x22')](_0x17c3ae,_0x1b64ad);};UserReport[_0xae0d('0x1e')][_0xae0d('0x10')]=function(_0x39b979){try{if(this['isNotNull'](_0x39b979)){var _0x59dde3=_[_0xae0d('0x23')](this['trunks'],{'registry':_0x39b979[_0xae0d('0x24')]});if(_0x59dde3){_0x39b979[_0xae0d('0x25')]=_0x39b979[_0xae0d('0x26')];_[_0xae0d('0x27')](_0x59dde3,_[_0xae0d('0x28')](_0x39b979,['event',_0xae0d('0x29'),_0xae0d('0x24'),'state']));this[_0xae0d('0x22')](util[_0xae0d('0x2a')](_0xae0d('0x2b'),_0x59dde3[_0xae0d('0x2c')]),_0xae0d('0x2d'),_0x59dde3);}}}catch(_0x39051a){logger[_0xae0d('0x1c')](_0xae0d('0x2e'),util[_0xae0d('0x1d')](_0x39051a,{'showHidden':![],'depth':null}));}};UserReport[_0xae0d('0x1e')]['syncDeviceState']=function(_0x4e16c7){try{if(this[_0xae0d('0x20')](_0x4e16c7)){if(this[_0xae0d('0xd')][_0x4e16c7[_0xae0d('0x2f')]]){if(!this['agents'][_0x4e16c7['device']]['local']||_0x4e16c7[_0xae0d('0x26')][_0xae0d('0x30')]()==_0xae0d('0x31')){this['agents'][_0x4e16c7[_0xae0d('0x2f')]][_0xae0d('0x32')]=![];if(this[_0xae0d('0xd')][_0x4e16c7[_0xae0d('0x2f')]][_0xae0d('0x26')]!==_0x4e16c7[_0xae0d('0x26')][_0xae0d('0x30')]()){this[_0xae0d('0xd')][_0x4e16c7['device']]['stateTime']=_[_0xae0d('0x33')](moment()[_0xae0d('0x2a')]('x'));}this[_0xae0d('0xd')][_0x4e16c7[_0xae0d('0x2f')]]['state']=_0x4e16c7[_0xae0d('0x26')][_0xae0d('0x30')]();this['agents'][_0x4e16c7[_0xae0d('0x2f')]][_0xae0d('0x34')](_0x4e16c7);}}else if(this[_0xae0d('0xe')][_0x4e16c7[_0xae0d('0x2f')]]){if(this['telephones'][_0x4e16c7[_0xae0d('0x2f')]][_0xae0d('0x26')]!==_0x4e16c7[_0xae0d('0x26')][_0xae0d('0x30')]()){this[_0xae0d('0xe')][_0x4e16c7[_0xae0d('0x2f')]][_0xae0d('0x35')]=_[_0xae0d('0x33')](moment()[_0xae0d('0x2a')]('x'));}this[_0xae0d('0xe')][_0x4e16c7[_0xae0d('0x2f')]][_0xae0d('0x26')]=_0x4e16c7[_0xae0d('0x26')][_0xae0d('0x30')]();this[_0xae0d('0x22')](util['format'](_0xae0d('0x36'),this['telephones'][_0x4e16c7[_0xae0d('0x2f')]]['name']),_0xae0d('0x37'),this['telephones'][_0x4e16c7['device']]);}else if(this[_0xae0d('0xc')][_0x4e16c7['device']]){if(this['trunks'][_0x4e16c7['device']][_0xae0d('0x26')]!==_0x4e16c7[_0xae0d('0x26')][_0xae0d('0x30')]()){this[_0xae0d('0xc')][_0x4e16c7[_0xae0d('0x2f')]][_0xae0d('0x35')]=_[_0xae0d('0x33')](moment()[_0xae0d('0x2a')]('x'));}this['trunks'][_0x4e16c7[_0xae0d('0x2f')]][_0xae0d('0x26')]=_0x4e16c7[_0xae0d('0x26')][_0xae0d('0x30')]();this[_0xae0d('0x22')](util['format'](_0xae0d('0x2b'),this['trunks'][_0x4e16c7[_0xae0d('0x2f')]][_0xae0d('0x2c')]),_0xae0d('0x2d'),this['trunks'][_0x4e16c7[_0xae0d('0x2f')]]);}else if(_[_0xae0d('0x38')](_0x4e16c7[_0xae0d('0x2f')],'Queue')){}else if(_[_0xae0d('0x38')](_0x4e16c7[_0xae0d('0x2f')],'Local')){var _0x2289fd=_0x4e16c7['device'];var _0x5598aa=_0x2289fd['substring'](_0x2289fd[_0xae0d('0x39')]('/')+0x1,_0x2289fd[_0xae0d('0x39')]('@'));var _0x9b28da=_[_0xae0d('0x23')](this[_0xae0d('0xd')],function(_0x1fae7a){return _0x1fae7a[_0xae0d('0x3a')]==_0x5598aa||_0x1fae7a[_0xae0d('0x3b')]==_0x5598aa||_0x1fae7a[_0xae0d('0x3c')]==_0x5598aa;});if(_0x9b28da){if(_0x9b28da[_0xae0d('0x26')]!==_0x4e16c7[_0xae0d('0x26')]['toLowerCase']()){_0x9b28da[_0xae0d('0x35')]=_[_0xae0d('0x33')](moment()['format']('x'));}_0x9b28da[_0xae0d('0x26')]=_0x4e16c7[_0xae0d('0x26')]['toLowerCase']();_0x9b28da[_0xae0d('0x32')]=!![];_0x9b28da['updateStatusRealtime'](_0x4e16c7);}}else{}}}catch(_0x9d2234){logger['error'](_0xae0d('0x3d'),util[_0xae0d('0x1d')](_0x9d2234,{'showHidden':![],'depth':null}));}};UserReport[_0xae0d('0x1e')]['syncPeerStatus']=function(_0x89986f){try{if(this['isNotNull'](_0x89986f)&&this[_0xae0d('0x20')](_0x89986f[_0xae0d('0x14')])){if(this[_0xae0d('0xd')][_0x89986f['peer']]){if(!this[_0xae0d('0xd')][_0x89986f['peer']][_0xae0d('0x32')]||_0x89986f[_0xae0d('0x14')]['toLowerCase']()==_0xae0d('0x3e')){this['agents'][_0x89986f[_0xae0d('0x3f')]][_0xae0d('0x32')]=![];this['agents'][_0x89986f[_0xae0d('0x3f')]]['status']=_0x89986f[_0xae0d('0x14')][_0xae0d('0x30')]();this['agents'][_0x89986f[_0xae0d('0x3f')]][_0xae0d('0x40')]=_0x89986f['address'];this[_0xae0d('0xd')][_0x89986f['peer']][_0xae0d('0x34')](_0x89986f);}}else if(this[_0xae0d('0xe')][_0x89986f[_0xae0d('0x3f')]]){this[_0xae0d('0xe')][_0x89986f[_0xae0d('0x3f')]]['status']=_0x89986f['peerstatus'][_0xae0d('0x30')]();this['telephones'][_0x89986f[_0xae0d('0x3f')]]['address']=_0x89986f[_0xae0d('0x40')];this[_0xae0d('0x22')](util['format'](_0xae0d('0x36'),this[_0xae0d('0xe')][_0x89986f['peer']][_0xae0d('0x2c')]),_0xae0d('0x37'),this['telephones'][_0x89986f[_0xae0d('0x3f')]]);}else if(this[_0xae0d('0xc')][_0x89986f[_0xae0d('0x3f')]]){this['trunks'][_0x89986f[_0xae0d('0x3f')]][_0xae0d('0x41')]=_0x89986f[_0xae0d('0x14')][_0xae0d('0x30')]();this[_0xae0d('0xc')][_0x89986f[_0xae0d('0x3f')]][_0xae0d('0x40')]=_0x89986f[_0xae0d('0x40')];this['emit'](util['format']('trunk:%s',this[_0xae0d('0xc')][_0x89986f[_0xae0d('0x3f')]][_0xae0d('0x2c')]),'trunk:save',this['trunks'][_0x89986f[_0xae0d('0x3f')]]);}else{}}}catch(_0x535b46){logger[_0xae0d('0x1c')](_0xae0d('0x42'),util[_0xae0d('0x1d')](_0x535b46,{'showHidden':![],'depth':null}));}};module[_0xae0d('0x43')]=UserReport; \ No newline at end of file diff --git a/server/services/ami/report/voiceAgentReport.js b/server/services/ami/report/voiceAgentReport.js index 7fad160..74dabf2 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 _0x4f72=['agents','variables','agentcalled','agentconnect','syncAgentConnect','syncAgentRingNoAnswer','queuecallerabandon','bind','varset','hangup','musiconholdstart','musiconholdstop','syncMusicOnHoldStop','attendedtransfer','syncAttendedTransfer','blindtransfer','syncBlindTransfer','emit','prototype','isNotNull','isUndefined','syncAgentCalled','uniqueid','destuniqueid','format','YYYY-MM-DD\x20HH:mm:ss','called','queue','type','inbound','merge','omit','event','privilege','custom:agentcalled','membername','user:called','error','inspect','agentconnectAt','lastevent','holdtime','connectedlinenum','connectedlinename','destchannelstate','destchannelstatedesc','interface','user:%s','user:agentconnect','agentringnoanswer','agentcomplete','answered_elsewhere','answeredelsewheredestinationuniqueid','answeredelsewheremembername','custom:agentansweredelsewhere','[syncAgentConnect][VoiceAgentReport]','agentringnoanswerAt','reason','rejected','custom:agentringnoanswer','[syncAgentRingNoAnswer][VoiceAgentReport]','syncQueueCallerAbandon','hasOwnProperty','custom:agentqueuecallerabandon','syncAgentComplete','complete','talktime','transfer','acw','agentacw','acwTimeout','[syncAgentComplete][VoiceAgentReport]','syncVarSet','addVariable','keys','variable','value','[syncVarSet][VoiceAgentReport]','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrtt','rtpaudioqosrttbridged','sipcallid','sipuri','bridgepeer','bridgepvtcallid','membercalls','memberdynamic','memberinterface','memberlastcall','memberpenalty','memberrealtime','isNil','includes','agentcompleteAt','custom:voiceAgentReport','values','[syncHangup][VoiceAgentReport]','transfereeuniqueid','secondtransfereruniqueid','[syncAttendedTransfer][VoiceAgentReport]','transfereruniqueid','diff','seconds','[syncBlindTransfer][VoiceAgentReport]','channel','substring','lastIndexOf','onhold','[syncMusicOnHoldStart][VoiceAgentReport]','lodash','moment','util','../../../config/logger','redis','defaults','localhost','channels','voiceQueues'];(function(_0xc26f41,_0x207afc){var _0x1b2580=function(_0x3b19ea){while(--_0x3b19ea){_0xc26f41['push'](_0xc26f41['shift']());}};_0x1b2580(++_0x207afc);}(_0x4f72,0x168));var _0x24f7=function(_0x5b3c32,_0x9ee272){_0x5b3c32=_0x5b3c32-0x0;var _0x2a8404=_0x4f72[_0x5b3c32];return _0x2a8404;};'use strict';var _=require(_0x24f7('0x0'));var moment=require(_0x24f7('0x1'));var util=require(_0x24f7('0x2'));var Redis=require('ioredis');var config=require('../../../config/environment');var logger=require(_0x24f7('0x3'))('ami');var ami=require('../ami');config[_0x24f7('0x4')]=_[_0x24f7('0x5')](config[_0x24f7('0x4')],{'host':_0x24f7('0x6'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x24f7('0x4')]));function VoiceAgentReport(_0x71c14b){this[_0x24f7('0x7')]={};this['voiceQueues']=_0x71c14b[_0x24f7('0x8')];this['agents']=_0x71c14b[_0x24f7('0x9')];this[_0x24f7('0xa')]={};ami['on'](_0x24f7('0xb'),this['syncAgentCalled']['bind'](this));ami['on'](_0x24f7('0xc'),this[_0x24f7('0xd')]['bind'](this));ami['on']('agentringnoanswer',this[_0x24f7('0xe')]['bind'](this));ami['on'](_0x24f7('0xf'),this['syncQueueCallerAbandon'][_0x24f7('0x10')](this));ami['on']('agentcomplete',this['syncAgentComplete']['bind'](this));ami['on'](_0x24f7('0x11'),this['syncVarSet'][_0x24f7('0x10')](this));ami['on'](_0x24f7('0x12'),this['syncHangup']['bind'](this));ami['on'](_0x24f7('0x13'),this['syncMusicOnHoldStart']['bind'](this));ami['on'](_0x24f7('0x14'),this[_0x24f7('0x15')][_0x24f7('0x10')](this));ami['on'](_0x24f7('0x16'),this[_0x24f7('0x17')][_0x24f7('0x10')](this));ami['on'](_0x24f7('0x18'),this[_0x24f7('0x19')][_0x24f7('0x10')](this));}VoiceAgentReport['prototype'][_0x24f7('0x1a')]=function(_0x257068,_0x55d342,_0x4200d3){io['to'](_0x257068)[_0x24f7('0x1a')](_0x55d342,_0x4200d3);};VoiceAgentReport[_0x24f7('0x1b')][_0x24f7('0x1c')]=function(_0x38a0c4){return _0x38a0c4!==null&&!_[_0x24f7('0x1d')](_0x38a0c4);};VoiceAgentReport[_0x24f7('0x1b')][_0x24f7('0x1e')]=function(_0x499655){try{if(this[_0x24f7('0x1c')](_0x499655)){if(_[_0x24f7('0x1d')](this[_0x24f7('0x7')][_0x499655['uniqueid']])){this[_0x24f7('0x7')][_0x499655[_0x24f7('0x1f')]]={};}if(_[_0x24f7('0x1d')](this[_0x24f7('0x7')][_0x499655['uniqueid']][_0x499655[_0x24f7('0x20')]])){this[_0x24f7('0x7')][_0x499655['uniqueid']][_0x499655['destuniqueid']]={'agentcalledAt':moment()[_0x24f7('0x21')](_0x24f7('0x22')),'lastevent':_0x24f7('0x23'),'variables':this['variables'][_0x499655['uniqueid']],'type':this[_0x24f7('0x8')][_0x499655[_0x24f7('0x24')]]?this[_0x24f7('0x8')][_0x499655[_0x24f7('0x24')]][_0x24f7('0x25')]||_0x24f7('0x26'):_0x24f7('0x26')};}_[_0x24f7('0x27')](this[_0x24f7('0x7')][_0x499655[_0x24f7('0x1f')]][_0x499655[_0x24f7('0x20')]],_[_0x24f7('0x28')](_0x499655,[_0x24f7('0x29'),_0x24f7('0x2a')]));ami[_0x24f7('0x1a')](_0x24f7('0x2b'),this['channels'][_0x499655[_0x24f7('0x1f')]][_0x499655[_0x24f7('0x20')]]);this[_0x24f7('0x1a')](util[_0x24f7('0x21')]('user:%s',_0x499655[_0x24f7('0x2c')]),_0x24f7('0x2d'),this[_0x24f7('0x7')][_0x499655[_0x24f7('0x1f')]][_0x499655[_0x24f7('0x20')]]);}}catch(_0x4c17ed){logger[_0x24f7('0x2e')]('[syncAgentCalled][VoiceAgentReport]',util[_0x24f7('0x2f')](_0x4c17ed,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x24f7('0x1b')][_0x24f7('0xd')]=function(_0x1e9de9){try{if(this[_0x24f7('0x1c')](_0x1e9de9)){if(this[_0x24f7('0x7')][_0x1e9de9[_0x24f7('0x1f')]]){for(var _0x5a59be in this[_0x24f7('0x7')][_0x1e9de9[_0x24f7('0x1f')]]){if(this['channels'][_0x1e9de9[_0x24f7('0x1f')]]['hasOwnProperty'](_0x5a59be)){if(_0x1e9de9[_0x24f7('0x20')]===_0x5a59be){this[_0x24f7('0x7')][_0x1e9de9[_0x24f7('0x1f')]][_0x5a59be][_0x24f7('0x30')]=moment()[_0x24f7('0x21')](_0x24f7('0x22'));this[_0x24f7('0x7')][_0x1e9de9['uniqueid']][_0x5a59be][_0x24f7('0x31')]='connect';this[_0x24f7('0x7')][_0x1e9de9['uniqueid']][_0x5a59be][_0x24f7('0x32')]=_0x1e9de9[_0x24f7('0x32')];this[_0x24f7('0x7')][_0x1e9de9[_0x24f7('0x1f')]][_0x5a59be][_0x24f7('0x33')]=_0x1e9de9[_0x24f7('0x33')];this[_0x24f7('0x7')][_0x1e9de9[_0x24f7('0x1f')]][_0x5a59be][_0x24f7('0x34')]=_0x1e9de9['connectedlinename'];this[_0x24f7('0x7')][_0x1e9de9[_0x24f7('0x1f')]][_0x5a59be][_0x24f7('0x35')]=_0x1e9de9[_0x24f7('0x35')];this[_0x24f7('0x7')][_0x1e9de9[_0x24f7('0x1f')]][_0x5a59be][_0x24f7('0x36')]=_0x1e9de9[_0x24f7('0x36')];_['merge'](this['agents'][_0x1e9de9[_0x24f7('0x37')]],_['pick'](_0x1e9de9,[_0x24f7('0x24'),'destconnectedlinenum']));this[_0x24f7('0x1a')](util['format'](_0x24f7('0x38'),_0x1e9de9[_0x24f7('0x2c')]),_0x24f7('0x39'),this[_0x24f7('0x7')][_0x1e9de9[_0x24f7('0x1f')]][_0x1e9de9[_0x24f7('0x20')]]);ami[_0x24f7('0x1a')]('custom:agentconnect',this['channels'][_0x1e9de9[_0x24f7('0x1f')]][_0x5a59be]);}else if(!this[_0x24f7('0x7')][_0x1e9de9['uniqueid']][_0x5a59be][_0x24f7('0x3a')]&&!this[_0x24f7('0x7')][_0x1e9de9[_0x24f7('0x1f')]][_0x5a59be][_0x24f7('0x3b')]){this['channels'][_0x1e9de9[_0x24f7('0x1f')]][_0x5a59be][_0x24f7('0x3a')]=!![];this['channels'][_0x1e9de9[_0x24f7('0x1f')]][_0x5a59be]['agentringnoanswerAt']=moment()['format'](_0x24f7('0x22'));this[_0x24f7('0x7')][_0x1e9de9[_0x24f7('0x1f')]][_0x5a59be]['reason']=_0x24f7('0x3c');this[_0x24f7('0x7')][_0x1e9de9[_0x24f7('0x1f')]][_0x5a59be]['lastevent']=_0x24f7('0x3c');this[_0x24f7('0x7')][_0x1e9de9[_0x24f7('0x1f')]][_0x5a59be][_0x24f7('0x3d')]=_0x1e9de9[_0x24f7('0x20')];this[_0x24f7('0x7')][_0x1e9de9[_0x24f7('0x1f')]][_0x5a59be][_0x24f7('0x3e')]=_0x1e9de9[_0x24f7('0x2c')];ami[_0x24f7('0x1a')](_0x24f7('0x3f'),this['channels'][_0x1e9de9[_0x24f7('0x1f')]][_0x5a59be]);}}}}}}catch(_0x151aa9){logger[_0x24f7('0x2e')](_0x24f7('0x40'),util[_0x24f7('0x2f')](_0x151aa9,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x24f7('0x1b')]['syncAgentRingNoAnswer']=function(_0x40eb47){try{if(this[_0x24f7('0x1c')](_0x40eb47)){if(this[_0x24f7('0x7')][_0x40eb47[_0x24f7('0x1f')]]&&this['channels'][_0x40eb47[_0x24f7('0x1f')]][_0x40eb47[_0x24f7('0x20')]]){this['channels'][_0x40eb47[_0x24f7('0x1f')]][_0x40eb47[_0x24f7('0x20')]][_0x24f7('0x3a')]=!![];this[_0x24f7('0x7')][_0x40eb47[_0x24f7('0x1f')]][_0x40eb47[_0x24f7('0x20')]][_0x24f7('0x41')]=moment()[_0x24f7('0x21')](_0x24f7('0x22'));this[_0x24f7('0x7')][_0x40eb47[_0x24f7('0x1f')]][_0x40eb47[_0x24f7('0x20')]][_0x24f7('0x42')]=_0x24f7('0x43');this[_0x24f7('0x7')][_0x40eb47[_0x24f7('0x1f')]][_0x40eb47[_0x24f7('0x20')]][_0x24f7('0x31')]=_0x24f7('0x43');ami[_0x24f7('0x1a')](_0x24f7('0x44'),this[_0x24f7('0x7')][_0x40eb47['uniqueid']][_0x40eb47[_0x24f7('0x20')]]);}}}catch(_0x494b49){logger[_0x24f7('0x2e')](_0x24f7('0x45'),util[_0x24f7('0x2f')](_0x494b49,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x24f7('0x1b')][_0x24f7('0x46')]=function(_0x3b463b){try{if(this[_0x24f7('0x1c')](_0x3b463b)){if(this[_0x24f7('0x7')][_0x3b463b[_0x24f7('0x1f')]]){for(var _0x36058b in this[_0x24f7('0x7')][_0x3b463b[_0x24f7('0x1f')]]){if(this[_0x24f7('0x7')][_0x3b463b[_0x24f7('0x1f')]][_0x24f7('0x47')](_0x36058b)&&!this[_0x24f7('0x7')][_0x3b463b[_0x24f7('0x1f')]][_0x36058b][_0x24f7('0x3a')]&&!this['channels'][_0x3b463b[_0x24f7('0x1f')]][_0x36058b][_0x24f7('0x3b')]){this[_0x24f7('0x7')][_0x3b463b[_0x24f7('0x1f')]][_0x36058b][_0x24f7('0x3a')]=!![];this['channels'][_0x3b463b['uniqueid']][_0x36058b][_0x24f7('0x41')]=moment()[_0x24f7('0x21')]('YYYY-MM-DD\x20HH:mm:ss');this[_0x24f7('0x7')][_0x3b463b['uniqueid']][_0x36058b][_0x24f7('0x42')]='abandoned';this['channels'][_0x3b463b[_0x24f7('0x1f')]][_0x36058b][_0x24f7('0x31')]='abandoned';ami['emit'](_0x24f7('0x48'),this[_0x24f7('0x7')][_0x3b463b[_0x24f7('0x1f')]][_0x36058b]);}}}}}catch(_0x35d296){logger[_0x24f7('0x2e')]('[syncQueueCallerAbandon][VoiceAgentReport]',util[_0x24f7('0x2f')](_0x35d296,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x24f7('0x1b')][_0x24f7('0x49')]=function(_0x3a25fe){try{if(this['isNotNull'](_0x3a25fe)){if(this[_0x24f7('0x7')][_0x3a25fe['uniqueid']]){for(var _0x145476 in this[_0x24f7('0x7')][_0x3a25fe['uniqueid']]){if(this['channels'][_0x3a25fe['uniqueid']][_0x24f7('0x47')](_0x145476)){if(this[_0x24f7('0x7')][_0x3a25fe['uniqueid']][_0x145476][_0x24f7('0x30')]&&!this['channels'][_0x3a25fe[_0x24f7('0x1f')]][_0x145476][_0x24f7('0x3b')]){this[_0x24f7('0x7')][_0x3a25fe[_0x24f7('0x1f')]][_0x145476][_0x24f7('0x3b')]=!![];this[_0x24f7('0x7')][_0x3a25fe[_0x24f7('0x1f')]][_0x145476]['agentcompleteAt']=moment()[_0x24f7('0x21')]('YYYY-MM-DD\x20HH:mm:ss');this[_0x24f7('0x7')][_0x3a25fe[_0x24f7('0x1f')]][_0x145476][_0x24f7('0x31')]=_0x24f7('0x4a');this[_0x24f7('0x7')][_0x3a25fe[_0x24f7('0x1f')]][_0x145476][_0x24f7('0x4b')]=_0x3a25fe[_0x24f7('0x4b')];this[_0x24f7('0x7')][_0x3a25fe[_0x24f7('0x1f')]][_0x145476][_0x24f7('0x42')]=_0x3a25fe[_0x24f7('0x42')]==_0x24f7('0x4c')?'agent':_0x3a25fe[_0x24f7('0x42')];if(this[_0x24f7('0x8')][_0x3a25fe[_0x24f7('0x24')]]&&this['voiceQueues'][_0x3a25fe['queue']][_0x24f7('0x4d')]){this['channels'][_0x3a25fe[_0x24f7('0x1f')]][_0x145476][_0x24f7('0x4e')]=!![];this[_0x24f7('0x7')][_0x3a25fe['uniqueid']][_0x145476]['acwtime']=this[_0x24f7('0x8')][_0x3a25fe[_0x24f7('0x24')]][_0x24f7('0x4f')];}this[_0x24f7('0x9')][_0x3a25fe[_0x24f7('0x37')]]=_[_0x24f7('0x28')](this[_0x24f7('0x9')][_0x3a25fe[_0x24f7('0x37')]],[_0x24f7('0x24'),'destconnectedlinenum']);this[_0x24f7('0x1a')](util[_0x24f7('0x21')](_0x24f7('0x38'),_0x3a25fe[_0x24f7('0x2c')]),'user:agentcomplete',this[_0x24f7('0x7')][_0x3a25fe[_0x24f7('0x1f')]][_0x145476]);ami[_0x24f7('0x1a')]('custom:agentcomplete',this[_0x24f7('0x7')][_0x3a25fe['uniqueid']][_0x145476]);}}}}}}catch(_0x4c78a5){logger['error'](_0x24f7('0x50'),util[_0x24f7('0x2f')](_0x4c78a5,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x24f7('0x1b')][_0x24f7('0x51')]=function(_0x31205d){try{if(this[_0x24f7('0x1c')](_0x31205d)){this[_0x24f7('0x52')](_0x31205d[_0x24f7('0x1f')],_[_0x24f7('0x53')](_0x31205d[_0x24f7('0x54')])[0x0],_0x31205d[_0x24f7('0x55')]);if(this[_0x24f7('0x7')][_0x31205d[_0x24f7('0x1f')]]){for(var _0x3992b7 in this['channels'][_0x31205d[_0x24f7('0x1f')]]){if(this[_0x24f7('0x7')][_0x31205d[_0x24f7('0x1f')]][_0x24f7('0x47')](_0x3992b7)){if(_['isUndefined'](this[_0x24f7('0x7')][_0x31205d[_0x24f7('0x1f')]][_0x3992b7][_0x24f7('0xa')])){this['channels'][_0x31205d[_0x24f7('0x1f')]][_0x3992b7][_0x24f7('0xa')]={};}this[_0x24f7('0x7')][_0x31205d[_0x24f7('0x1f')]][_0x3992b7][_0x24f7('0xa')]=this[_0x24f7('0xa')][_0x31205d[_0x24f7('0x1f')]];}}}}}catch(_0xb69df8){logger[_0x24f7('0x2e')](_0x24f7('0x56'),util[_0x24f7('0x2f')](_0xb69df8,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x24f7('0x1b')][_0x24f7('0x52')]=function(_0x395ea3,_0x1c6a71,_0x36b948){var _0x4a54dc=[_0x24f7('0x57'),_0x24f7('0x58'),_0x24f7('0x59'),_0x24f7('0x5a'),_0x24f7('0x5b'),_0x24f7('0x5c'),_0x24f7('0x5d'),_0x24f7('0x5e'),_0x24f7('0x5f'),_0x24f7('0x60'),_0x24f7('0x61'),_0x24f7('0x62'),_0x24f7('0x63'),_0x24f7('0x64'),_0x24f7('0x65'),_0x24f7('0x66'),_0x24f7('0x2c'),_0x24f7('0x67'),_0x24f7('0x68')];if(!_[_0x24f7('0x69')](_0x1c6a71)&&!_[_0x24f7('0x6a')](_0x4a54dc,_0x1c6a71)){if(_[_0x24f7('0x1d')](this['variables'][_0x395ea3])){this[_0x24f7('0xa')][_0x395ea3]={};}this[_0x24f7('0xa')][_0x395ea3][_0x1c6a71]=_0x36b948;}};VoiceAgentReport[_0x24f7('0x1b')]['syncHangup']=function(_0x58f05a){try{if(this['isNotNull'](_0x58f05a)){if(this[_0x24f7('0x7')][_0x58f05a[_0x24f7('0x1f')]]){for(var _0x5600da in this[_0x24f7('0x7')][_0x58f05a[_0x24f7('0x1f')]]){if(this[_0x24f7('0x7')][_0x58f05a[_0x24f7('0x1f')]][_0x24f7('0x47')](_0x5600da)){if(this[_0x24f7('0x7')][_0x58f05a[_0x24f7('0x1f')]][_0x5600da][_0x24f7('0x42')]==_0x24f7('0x4c')&&this[_0x24f7('0x7')][_0x58f05a[_0x24f7('0x1f')]][_0x5600da][_0x24f7('0x3b')]){this[_0x24f7('0x7')][_0x58f05a[_0x24f7('0x1f')]][_0x5600da][_0x24f7('0x6b')]=moment()[_0x24f7('0x21')](_0x24f7('0x22'));}}}ami[_0x24f7('0x1a')](_0x24f7('0x6c'),_[_0x24f7('0x6d')](this[_0x24f7('0x7')][_0x58f05a[_0x24f7('0x1f')]]));delete this[_0x24f7('0x7')][_0x58f05a[_0x24f7('0x1f')]];}if(this[_0x24f7('0xa')][_0x58f05a[_0x24f7('0x1f')]]){delete this[_0x24f7('0xa')][_0x58f05a[_0x24f7('0x1f')]];}}}catch(_0x6d1b7a){logger[_0x24f7('0x2e')](_0x24f7('0x6e'),util[_0x24f7('0x2f')](_0x6d1b7a,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype'][_0x24f7('0x17')]=function(_0x368cb2){try{if(this[_0x24f7('0x1c')](_0x368cb2)){if(this[_0x24f7('0x7')][_0x368cb2['transfereeuniqueid']]){for(var _0x1ddc08 in this[_0x24f7('0x7')][_0x368cb2[_0x24f7('0x6f')]]){if(this[_0x24f7('0x7')][_0x368cb2['transfereeuniqueid']][_0x24f7('0x47')](_0x1ddc08)){if(_0x368cb2['origtransfereruniqueid']===_0x1ddc08){var _0x540285=moment();this[_0x24f7('0x7')][_0x368cb2['transfereeuniqueid']][_0x1ddc08][_0x24f7('0x3b')]=!![];this[_0x24f7('0x7')][_0x368cb2[_0x24f7('0x6f')]][_0x1ddc08][_0x24f7('0x6b')]=moment()['format'](_0x24f7('0x22'));this[_0x24f7('0x7')][_0x368cb2[_0x24f7('0x6f')]][_0x1ddc08][_0x24f7('0x42')]=_0x24f7('0x4c');this['channels'][_0x368cb2['transfereeuniqueid']][_0x1ddc08][_0x24f7('0x31')]='complete';this[_0x24f7('0x7')][_0x368cb2[_0x24f7('0x6f')]][_0x1ddc08][_0x24f7('0x4b')]=_0x540285['diff'](this[_0x24f7('0x7')][_0x368cb2[_0x24f7('0x6f')]][_0x1ddc08]['agentconnectAt'],'seconds');}}}}if(this[_0x24f7('0x7')][_0x368cb2['secondtransfereruniqueid']]){var _0x55d269=this[_0x24f7('0x7')][_0x368cb2['secondtransfereruniqueid']];this[_0x24f7('0x7')][_0x368cb2[_0x24f7('0x70')]]=this[_0x24f7('0x7')][_0x368cb2[_0x24f7('0x6f')]];this[_0x24f7('0x7')][_0x368cb2[_0x24f7('0x6f')]]=_0x55d269;}}}catch(_0x30e95a){logger[_0x24f7('0x2e')](_0x24f7('0x71'),util[_0x24f7('0x2f')](_0x30e95a,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x24f7('0x1b')]['syncBlindTransfer']=function(_0x35a3a4){try{if(this[_0x24f7('0x1c')](_0x35a3a4)){if(this[_0x24f7('0x7')][_0x35a3a4[_0x24f7('0x6f')]]){for(var _0x4b450b in this[_0x24f7('0x7')][_0x35a3a4['transfereeuniqueid']]){if(this['channels'][_0x35a3a4[_0x24f7('0x6f')]][_0x24f7('0x47')](_0x4b450b)){if(_0x35a3a4[_0x24f7('0x72')]===_0x4b450b){var _0x23d46b=moment();this[_0x24f7('0x7')][_0x35a3a4['transfereeuniqueid']][_0x4b450b][_0x24f7('0x3b')]=!![];this['channels'][_0x35a3a4[_0x24f7('0x6f')]][_0x4b450b][_0x24f7('0x6b')]=_0x23d46b;this[_0x24f7('0x7')][_0x35a3a4[_0x24f7('0x6f')]][_0x4b450b]['reason']=_0x24f7('0x4c');this['channels'][_0x35a3a4[_0x24f7('0x6f')]][_0x4b450b][_0x24f7('0x31')]=_0x24f7('0x4a');this[_0x24f7('0x7')][_0x35a3a4['transfereeuniqueid']][_0x4b450b][_0x24f7('0x4b')]=_0x23d46b[_0x24f7('0x73')](this['channels'][_0x35a3a4['transfereeuniqueid']][_0x4b450b][_0x24f7('0x30')],_0x24f7('0x74'));}}}}}}catch(_0x2689d){logger['error'](_0x24f7('0x75'),util[_0x24f7('0x2f')](_0x2689d,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype']['syncMusicOnHoldStart']=function(_0x442b89){var _0x4aa49c='';try{if(this[_0x24f7('0x1c')](_0x442b89)){if(_0x442b89[_0x24f7('0x76')]){_0x4aa49c=_0x442b89[_0x24f7('0x76')][_0x24f7('0x77')](0x0,_0x442b89['channel'][_0x24f7('0x78')]('-'));if(this[_0x24f7('0x9')][_0x4aa49c]){this['agents'][_0x4aa49c][_0x24f7('0x79')]=!![];}}}}catch(_0x134e17){logger[_0x24f7('0x2e')](_0x24f7('0x7a'),util[_0x24f7('0x2f')](_0x134e17,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x24f7('0x1b')][_0x24f7('0x15')]=function(_0x1f0430){var _0x460b45='';try{if(this[_0x24f7('0x1c')](_0x1f0430)){if(_0x1f0430[_0x24f7('0x76')]){_0x460b45=_0x1f0430[_0x24f7('0x76')][_0x24f7('0x77')](0x0,_0x1f0430[_0x24f7('0x76')][_0x24f7('0x78')]('-'));if(this[_0x24f7('0x9')][_0x460b45]){this[_0x24f7('0x9')][_0x460b45][_0x24f7('0x79')]=![];}}}}catch(_0x388bf5){logger['error']('[syncMusicOnHoldStop][VoiceAgentReport]',util[_0x24f7('0x2f')](_0x388bf5,{'showHidden':![],'depth':null}));}};module['exports']=VoiceAgentReport; \ No newline at end of file +var _0x2bb9=['queuecallerabandon','syncAgentComplete','hangup','musiconholdstart','syncMusicOnHoldStart','musiconholdstop','syncMusicOnHoldStop','attendedtransfer','syncAttendedTransfer','blindtransfer','syncBlindTransfer','prototype','isNotNull','isUndefined','uniqueid','destuniqueid','YYYY-MM-DD\x20HH:mm:ss','called','queue','type','inbound','omit','event','custom:agentcalled','emit','format','user:%s','membername','error','[syncAgentCalled][VoiceAgentReport]','inspect','agentconnectAt','lastevent','holdtime','connectedlinenum','destchannelstate','destchannelstatedesc','pick','destconnectedlinenum','user:agentconnect','agentringnoanswer','agentcomplete','reason','answered_elsewhere','answeredelsewheredestinationuniqueid','custom:agentansweredelsewhere','[syncAgentConnect][VoiceAgentReport]','syncAgentRingNoAnswer','agentringnoanswerAt','rejected','custom:agentringnoanswer','[syncAgentRingNoAnswer][VoiceAgentReport]','syncQueueCallerAbandon','abandoned','custom:agentqueuecallerabandon','[syncQueueCallerAbandon][VoiceAgentReport]','hasOwnProperty','agentcompleteAt','complete','talktime','transfer','acw','agentacw','acwtime','acwTimeout','interface','user:agentcomplete','custom:agentcomplete','[syncAgentComplete][VoiceAgentReport]','syncVarSet','keys','value','[syncVarSet][VoiceAgentReport]','addVariable','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrtt','rtpaudioqosrttbridged','sipuri','bridgepeer','bridgepvtcallid','memberdynamic','memberinterface','memberlastcall','memberpenalty','memberrealtime','isNil','includes','custom:voiceAgentReport','values','transfereeuniqueid','origtransfereruniqueid','diff','secondtransfereruniqueid','[syncAttendedTransfer][VoiceAgentReport]','transfereruniqueid','seconds','[syncMusicOnHoldStart][VoiceAgentReport]','channel','substring','lastIndexOf','onhold','exports','lodash','moment','util','ioredis','../../../config/environment','../../../config/logger','ami','../ami','redis','defaults','localhost','socket.io-emitter','channels','voiceQueues','agents','variables','syncAgentCalled','agentconnect','syncAgentConnect','bind'];(function(_0x480396,_0x290389){var _0x27f5dd=function(_0x30ef10){while(--_0x30ef10){_0x480396['push'](_0x480396['shift']());}};_0x27f5dd(++_0x290389);}(_0x2bb9,0x166));var _0x92bb=function(_0x291d65,_0x25bc0b){_0x291d65=_0x291d65-0x0;var _0x59e8f0=_0x2bb9[_0x291d65];return _0x59e8f0;};'use strict';var _=require(_0x92bb('0x0'));var moment=require(_0x92bb('0x1'));var util=require(_0x92bb('0x2'));var Redis=require(_0x92bb('0x3'));var config=require(_0x92bb('0x4'));var logger=require(_0x92bb('0x5'))(_0x92bb('0x6'));var ami=require(_0x92bb('0x7'));config[_0x92bb('0x8')]=_[_0x92bb('0x9')](config[_0x92bb('0x8')],{'host':_0x92bb('0xa'),'port':0x18eb});var io=require(_0x92bb('0xb'))(new Redis(config[_0x92bb('0x8')]));function VoiceAgentReport(_0x2a10ea){this[_0x92bb('0xc')]={};this[_0x92bb('0xd')]=_0x2a10ea[_0x92bb('0xd')];this['agents']=_0x2a10ea[_0x92bb('0xe')];this[_0x92bb('0xf')]={};ami['on']('agentcalled',this[_0x92bb('0x10')]['bind'](this));ami['on'](_0x92bb('0x11'),this[_0x92bb('0x12')][_0x92bb('0x13')](this));ami['on']('agentringnoanswer',this['syncAgentRingNoAnswer']['bind'](this));ami['on'](_0x92bb('0x14'),this['syncQueueCallerAbandon']['bind'](this));ami['on']('agentcomplete',this[_0x92bb('0x15')]['bind'](this));ami['on']('varset',this['syncVarSet'][_0x92bb('0x13')](this));ami['on'](_0x92bb('0x16'),this['syncHangup']['bind'](this));ami['on'](_0x92bb('0x17'),this[_0x92bb('0x18')][_0x92bb('0x13')](this));ami['on'](_0x92bb('0x19'),this[_0x92bb('0x1a')][_0x92bb('0x13')](this));ami['on'](_0x92bb('0x1b'),this[_0x92bb('0x1c')][_0x92bb('0x13')](this));ami['on'](_0x92bb('0x1d'),this[_0x92bb('0x1e')][_0x92bb('0x13')](this));}VoiceAgentReport['prototype']['emit']=function(_0x214aca,_0x5c44d1,_0x1f6f91){io['to'](_0x214aca)['emit'](_0x5c44d1,_0x1f6f91);};VoiceAgentReport[_0x92bb('0x1f')][_0x92bb('0x20')]=function(_0x4e78cd){return _0x4e78cd!==null&&!_[_0x92bb('0x21')](_0x4e78cd);};VoiceAgentReport[_0x92bb('0x1f')][_0x92bb('0x10')]=function(_0xe1ffc5){try{if(this['isNotNull'](_0xe1ffc5)){if(_[_0x92bb('0x21')](this[_0x92bb('0xc')][_0xe1ffc5[_0x92bb('0x22')]])){this[_0x92bb('0xc')][_0xe1ffc5['uniqueid']]={};}if(_[_0x92bb('0x21')](this[_0x92bb('0xc')][_0xe1ffc5[_0x92bb('0x22')]][_0xe1ffc5[_0x92bb('0x23')]])){this[_0x92bb('0xc')][_0xe1ffc5[_0x92bb('0x22')]][_0xe1ffc5[_0x92bb('0x23')]]={'agentcalledAt':moment()['format'](_0x92bb('0x24')),'lastevent':_0x92bb('0x25'),'variables':this[_0x92bb('0xf')][_0xe1ffc5[_0x92bb('0x22')]],'type':this[_0x92bb('0xd')][_0xe1ffc5[_0x92bb('0x26')]]?this[_0x92bb('0xd')][_0xe1ffc5[_0x92bb('0x26')]][_0x92bb('0x27')]||_0x92bb('0x28'):_0x92bb('0x28')};}_['merge'](this['channels'][_0xe1ffc5[_0x92bb('0x22')]][_0xe1ffc5['destuniqueid']],_[_0x92bb('0x29')](_0xe1ffc5,[_0x92bb('0x2a'),'privilege']));ami['emit'](_0x92bb('0x2b'),this[_0x92bb('0xc')][_0xe1ffc5[_0x92bb('0x22')]][_0xe1ffc5[_0x92bb('0x23')]]);this[_0x92bb('0x2c')](util[_0x92bb('0x2d')](_0x92bb('0x2e'),_0xe1ffc5[_0x92bb('0x2f')]),'user:called',this['channels'][_0xe1ffc5[_0x92bb('0x22')]][_0xe1ffc5[_0x92bb('0x23')]]);}}catch(_0x173497){logger[_0x92bb('0x30')](_0x92bb('0x31'),util[_0x92bb('0x32')](_0x173497,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x92bb('0x1f')][_0x92bb('0x12')]=function(_0x1234e7){try{if(this[_0x92bb('0x20')](_0x1234e7)){if(this['channels'][_0x1234e7['uniqueid']]){for(var _0x248868 in this[_0x92bb('0xc')][_0x1234e7[_0x92bb('0x22')]]){if(this[_0x92bb('0xc')][_0x1234e7[_0x92bb('0x22')]]['hasOwnProperty'](_0x248868)){if(_0x1234e7[_0x92bb('0x23')]===_0x248868){this['channels'][_0x1234e7[_0x92bb('0x22')]][_0x248868][_0x92bb('0x33')]=moment()[_0x92bb('0x2d')](_0x92bb('0x24'));this[_0x92bb('0xc')][_0x1234e7['uniqueid']][_0x248868][_0x92bb('0x34')]='connect';this[_0x92bb('0xc')][_0x1234e7['uniqueid']][_0x248868][_0x92bb('0x35')]=_0x1234e7[_0x92bb('0x35')];this['channels'][_0x1234e7[_0x92bb('0x22')]][_0x248868][_0x92bb('0x36')]=_0x1234e7[_0x92bb('0x36')];this[_0x92bb('0xc')][_0x1234e7[_0x92bb('0x22')]][_0x248868]['connectedlinename']=_0x1234e7['connectedlinename'];this['channels'][_0x1234e7['uniqueid']][_0x248868][_0x92bb('0x37')]=_0x1234e7[_0x92bb('0x37')];this[_0x92bb('0xc')][_0x1234e7[_0x92bb('0x22')]][_0x248868][_0x92bb('0x38')]=_0x1234e7[_0x92bb('0x38')];_['merge'](this[_0x92bb('0xe')][_0x1234e7['interface']],_[_0x92bb('0x39')](_0x1234e7,[_0x92bb('0x26'),_0x92bb('0x3a')]));this[_0x92bb('0x2c')](util[_0x92bb('0x2d')](_0x92bb('0x2e'),_0x1234e7[_0x92bb('0x2f')]),_0x92bb('0x3b'),this['channels'][_0x1234e7[_0x92bb('0x22')]][_0x1234e7['destuniqueid']]);ami[_0x92bb('0x2c')]('custom:agentconnect',this[_0x92bb('0xc')][_0x1234e7[_0x92bb('0x22')]][_0x248868]);}else if(!this[_0x92bb('0xc')][_0x1234e7[_0x92bb('0x22')]][_0x248868][_0x92bb('0x3c')]&&!this['channels'][_0x1234e7[_0x92bb('0x22')]][_0x248868][_0x92bb('0x3d')]){this[_0x92bb('0xc')][_0x1234e7[_0x92bb('0x22')]][_0x248868][_0x92bb('0x3c')]=!![];this['channels'][_0x1234e7['uniqueid']][_0x248868]['agentringnoanswerAt']=moment()[_0x92bb('0x2d')](_0x92bb('0x24'));this['channels'][_0x1234e7[_0x92bb('0x22')]][_0x248868][_0x92bb('0x3e')]=_0x92bb('0x3f');this[_0x92bb('0xc')][_0x1234e7['uniqueid']][_0x248868][_0x92bb('0x34')]=_0x92bb('0x3f');this[_0x92bb('0xc')][_0x1234e7[_0x92bb('0x22')]][_0x248868][_0x92bb('0x40')]=_0x1234e7['destuniqueid'];this[_0x92bb('0xc')][_0x1234e7[_0x92bb('0x22')]][_0x248868]['answeredelsewheremembername']=_0x1234e7[_0x92bb('0x2f')];ami[_0x92bb('0x2c')](_0x92bb('0x41'),this[_0x92bb('0xc')][_0x1234e7['uniqueid']][_0x248868]);}}}}}}catch(_0x2c293e){logger[_0x92bb('0x30')](_0x92bb('0x42'),util[_0x92bb('0x32')](_0x2c293e,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x92bb('0x1f')][_0x92bb('0x43')]=function(_0x2aa6b8){try{if(this[_0x92bb('0x20')](_0x2aa6b8)){if(this[_0x92bb('0xc')][_0x2aa6b8[_0x92bb('0x22')]]&&this[_0x92bb('0xc')][_0x2aa6b8[_0x92bb('0x22')]][_0x2aa6b8[_0x92bb('0x23')]]){this[_0x92bb('0xc')][_0x2aa6b8[_0x92bb('0x22')]][_0x2aa6b8[_0x92bb('0x23')]]['agentringnoanswer']=!![];this[_0x92bb('0xc')][_0x2aa6b8[_0x92bb('0x22')]][_0x2aa6b8['destuniqueid']][_0x92bb('0x44')]=moment()[_0x92bb('0x2d')](_0x92bb('0x24'));this[_0x92bb('0xc')][_0x2aa6b8[_0x92bb('0x22')]][_0x2aa6b8[_0x92bb('0x23')]][_0x92bb('0x3e')]=_0x92bb('0x45');this['channels'][_0x2aa6b8['uniqueid']][_0x2aa6b8[_0x92bb('0x23')]][_0x92bb('0x34')]=_0x92bb('0x45');ami['emit'](_0x92bb('0x46'),this['channels'][_0x2aa6b8['uniqueid']][_0x2aa6b8['destuniqueid']]);}}}catch(_0x5b8268){logger[_0x92bb('0x30')](_0x92bb('0x47'),util['inspect'](_0x5b8268,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x92bb('0x1f')][_0x92bb('0x48')]=function(_0x57181b){try{if(this[_0x92bb('0x20')](_0x57181b)){if(this[_0x92bb('0xc')][_0x57181b['uniqueid']]){for(var _0x2090ee in this[_0x92bb('0xc')][_0x57181b[_0x92bb('0x22')]]){if(this[_0x92bb('0xc')][_0x57181b[_0x92bb('0x22')]]['hasOwnProperty'](_0x2090ee)&&!this[_0x92bb('0xc')][_0x57181b[_0x92bb('0x22')]][_0x2090ee][_0x92bb('0x3c')]&&!this[_0x92bb('0xc')][_0x57181b[_0x92bb('0x22')]][_0x2090ee][_0x92bb('0x3d')]){this['channels'][_0x57181b[_0x92bb('0x22')]][_0x2090ee][_0x92bb('0x3c')]=!![];this[_0x92bb('0xc')][_0x57181b[_0x92bb('0x22')]][_0x2090ee][_0x92bb('0x44')]=moment()['format'](_0x92bb('0x24'));this[_0x92bb('0xc')][_0x57181b[_0x92bb('0x22')]][_0x2090ee][_0x92bb('0x3e')]=_0x92bb('0x49');this[_0x92bb('0xc')][_0x57181b[_0x92bb('0x22')]][_0x2090ee]['lastevent']=_0x92bb('0x49');ami[_0x92bb('0x2c')](_0x92bb('0x4a'),this[_0x92bb('0xc')][_0x57181b[_0x92bb('0x22')]][_0x2090ee]);}}}}}catch(_0x46350b){logger[_0x92bb('0x30')](_0x92bb('0x4b'),util['inspect'](_0x46350b,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype']['syncAgentComplete']=function(_0x4b809b){try{if(this['isNotNull'](_0x4b809b)){if(this[_0x92bb('0xc')][_0x4b809b['uniqueid']]){for(var _0x4714ed in this[_0x92bb('0xc')][_0x4b809b[_0x92bb('0x22')]]){if(this[_0x92bb('0xc')][_0x4b809b['uniqueid']][_0x92bb('0x4c')](_0x4714ed)){if(this[_0x92bb('0xc')][_0x4b809b[_0x92bb('0x22')]][_0x4714ed]['agentconnectAt']&&!this['channels'][_0x4b809b[_0x92bb('0x22')]][_0x4714ed][_0x92bb('0x3d')]){this[_0x92bb('0xc')][_0x4b809b[_0x92bb('0x22')]][_0x4714ed][_0x92bb('0x3d')]=!![];this[_0x92bb('0xc')][_0x4b809b[_0x92bb('0x22')]][_0x4714ed][_0x92bb('0x4d')]=moment()[_0x92bb('0x2d')](_0x92bb('0x24'));this[_0x92bb('0xc')][_0x4b809b[_0x92bb('0x22')]][_0x4714ed][_0x92bb('0x34')]=_0x92bb('0x4e');this[_0x92bb('0xc')][_0x4b809b[_0x92bb('0x22')]][_0x4714ed][_0x92bb('0x4f')]=_0x4b809b[_0x92bb('0x4f')];this[_0x92bb('0xc')][_0x4b809b['uniqueid']][_0x4714ed]['reason']=_0x4b809b[_0x92bb('0x3e')]==_0x92bb('0x50')?'agent':_0x4b809b[_0x92bb('0x3e')];if(this[_0x92bb('0xd')][_0x4b809b[_0x92bb('0x26')]]&&this[_0x92bb('0xd')][_0x4b809b[_0x92bb('0x26')]][_0x92bb('0x51')]){this[_0x92bb('0xc')][_0x4b809b[_0x92bb('0x22')]][_0x4714ed][_0x92bb('0x52')]=!![];this[_0x92bb('0xc')][_0x4b809b['uniqueid']][_0x4714ed][_0x92bb('0x53')]=this[_0x92bb('0xd')][_0x4b809b['queue']][_0x92bb('0x54')];}this[_0x92bb('0xe')][_0x4b809b[_0x92bb('0x55')]]=_[_0x92bb('0x29')](this[_0x92bb('0xe')][_0x4b809b[_0x92bb('0x55')]],[_0x92bb('0x26'),_0x92bb('0x3a')]);this[_0x92bb('0x2c')](util[_0x92bb('0x2d')]('user:%s',_0x4b809b['membername']),_0x92bb('0x56'),this[_0x92bb('0xc')][_0x4b809b[_0x92bb('0x22')]][_0x4714ed]);ami['emit'](_0x92bb('0x57'),this[_0x92bb('0xc')][_0x4b809b[_0x92bb('0x22')]][_0x4714ed]);}}}}}}catch(_0x443251){logger[_0x92bb('0x30')](_0x92bb('0x58'),util[_0x92bb('0x32')](_0x443251,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x92bb('0x1f')][_0x92bb('0x59')]=function(_0x55ce06){try{if(this[_0x92bb('0x20')](_0x55ce06)){this['addVariable'](_0x55ce06[_0x92bb('0x22')],_[_0x92bb('0x5a')](_0x55ce06['variable'])[0x0],_0x55ce06[_0x92bb('0x5b')]);if(this[_0x92bb('0xc')][_0x55ce06[_0x92bb('0x22')]]){for(var _0x1986fa in this[_0x92bb('0xc')][_0x55ce06[_0x92bb('0x22')]]){if(this[_0x92bb('0xc')][_0x55ce06['uniqueid']]['hasOwnProperty'](_0x1986fa)){if(_[_0x92bb('0x21')](this[_0x92bb('0xc')][_0x55ce06[_0x92bb('0x22')]][_0x1986fa][_0x92bb('0xf')])){this[_0x92bb('0xc')][_0x55ce06[_0x92bb('0x22')]][_0x1986fa][_0x92bb('0xf')]={};}this['channels'][_0x55ce06['uniqueid']][_0x1986fa][_0x92bb('0xf')]=this[_0x92bb('0xf')][_0x55ce06['uniqueid']];}}}}}catch(_0x16e39c){logger[_0x92bb('0x30')](_0x92bb('0x5c'),util['inspect'](_0x16e39c,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x92bb('0x1f')][_0x92bb('0x5d')]=function(_0x43c1d9,_0x37a53f,_0x1dc519){var _0x5d9a1c=[_0x92bb('0x5e'),_0x92bb('0x5f'),'rtpaudioqosjitter',_0x92bb('0x60'),_0x92bb('0x61'),_0x92bb('0x62'),_0x92bb('0x63'),_0x92bb('0x64'),'sipcallid',_0x92bb('0x65'),_0x92bb('0x66'),_0x92bb('0x67'),'membercalls',_0x92bb('0x68'),_0x92bb('0x69'),_0x92bb('0x6a'),_0x92bb('0x2f'),_0x92bb('0x6b'),_0x92bb('0x6c')];if(!_[_0x92bb('0x6d')](_0x37a53f)&&!_[_0x92bb('0x6e')](_0x5d9a1c,_0x37a53f)){if(_[_0x92bb('0x21')](this['variables'][_0x43c1d9])){this[_0x92bb('0xf')][_0x43c1d9]={};}this[_0x92bb('0xf')][_0x43c1d9][_0x37a53f]=_0x1dc519;}};VoiceAgentReport['prototype']['syncHangup']=function(_0xd42119){try{if(this[_0x92bb('0x20')](_0xd42119)){if(this[_0x92bb('0xc')][_0xd42119[_0x92bb('0x22')]]){for(var _0x4ef94d in this[_0x92bb('0xc')][_0xd42119[_0x92bb('0x22')]]){if(this[_0x92bb('0xc')][_0xd42119[_0x92bb('0x22')]]['hasOwnProperty'](_0x4ef94d)){if(this[_0x92bb('0xc')][_0xd42119[_0x92bb('0x22')]][_0x4ef94d][_0x92bb('0x3e')]==_0x92bb('0x50')&&this['channels'][_0xd42119['uniqueid']][_0x4ef94d][_0x92bb('0x3d')]){this['channels'][_0xd42119['uniqueid']][_0x4ef94d][_0x92bb('0x4d')]=moment()[_0x92bb('0x2d')]('YYYY-MM-DD\x20HH:mm:ss');}}}ami['emit'](_0x92bb('0x6f'),_[_0x92bb('0x70')](this[_0x92bb('0xc')][_0xd42119[_0x92bb('0x22')]]));delete this[_0x92bb('0xc')][_0xd42119['uniqueid']];}if(this[_0x92bb('0xf')][_0xd42119[_0x92bb('0x22')]]){delete this[_0x92bb('0xf')][_0xd42119['uniqueid']];}}}catch(_0x12a7c8){logger[_0x92bb('0x30')]('[syncHangup][VoiceAgentReport]',util[_0x92bb('0x32')](_0x12a7c8,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x92bb('0x1f')]['syncAttendedTransfer']=function(_0x366ec6){try{if(this[_0x92bb('0x20')](_0x366ec6)){if(this[_0x92bb('0xc')][_0x366ec6[_0x92bb('0x71')]]){for(var _0x4a0f4e in this['channels'][_0x366ec6[_0x92bb('0x71')]]){if(this[_0x92bb('0xc')][_0x366ec6['transfereeuniqueid']][_0x92bb('0x4c')](_0x4a0f4e)){if(_0x366ec6[_0x92bb('0x72')]===_0x4a0f4e){var _0x3fb8ea=moment();this[_0x92bb('0xc')][_0x366ec6[_0x92bb('0x71')]][_0x4a0f4e][_0x92bb('0x3d')]=!![];this[_0x92bb('0xc')][_0x366ec6[_0x92bb('0x71')]][_0x4a0f4e][_0x92bb('0x4d')]=moment()[_0x92bb('0x2d')](_0x92bb('0x24'));this[_0x92bb('0xc')][_0x366ec6['transfereeuniqueid']][_0x4a0f4e][_0x92bb('0x3e')]=_0x92bb('0x50');this[_0x92bb('0xc')][_0x366ec6[_0x92bb('0x71')]][_0x4a0f4e][_0x92bb('0x34')]='complete';this['channels'][_0x366ec6[_0x92bb('0x71')]][_0x4a0f4e][_0x92bb('0x4f')]=_0x3fb8ea[_0x92bb('0x73')](this[_0x92bb('0xc')][_0x366ec6[_0x92bb('0x71')]][_0x4a0f4e][_0x92bb('0x33')],'seconds');}}}}if(this[_0x92bb('0xc')][_0x366ec6[_0x92bb('0x74')]]){var _0xc5319d=this[_0x92bb('0xc')][_0x366ec6[_0x92bb('0x74')]];this[_0x92bb('0xc')][_0x366ec6['secondtransfereruniqueid']]=this['channels'][_0x366ec6[_0x92bb('0x71')]];this[_0x92bb('0xc')][_0x366ec6[_0x92bb('0x71')]]=_0xc5319d;}}}catch(_0x131f3b){logger[_0x92bb('0x30')](_0x92bb('0x75'),util[_0x92bb('0x32')](_0x131f3b,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype'][_0x92bb('0x1e')]=function(_0x261cd7){try{if(this['isNotNull'](_0x261cd7)){if(this[_0x92bb('0xc')][_0x261cd7['transfereeuniqueid']]){for(var _0x9ce419 in this[_0x92bb('0xc')][_0x261cd7[_0x92bb('0x71')]]){if(this['channels'][_0x261cd7['transfereeuniqueid']][_0x92bb('0x4c')](_0x9ce419)){if(_0x261cd7[_0x92bb('0x76')]===_0x9ce419){var _0x508558=moment();this['channels'][_0x261cd7[_0x92bb('0x71')]][_0x9ce419][_0x92bb('0x3d')]=!![];this[_0x92bb('0xc')][_0x261cd7[_0x92bb('0x71')]][_0x9ce419][_0x92bb('0x4d')]=_0x508558;this[_0x92bb('0xc')][_0x261cd7[_0x92bb('0x71')]][_0x9ce419][_0x92bb('0x3e')]='transfer';this[_0x92bb('0xc')][_0x261cd7[_0x92bb('0x71')]][_0x9ce419][_0x92bb('0x34')]=_0x92bb('0x4e');this['channels'][_0x261cd7[_0x92bb('0x71')]][_0x9ce419][_0x92bb('0x4f')]=_0x508558[_0x92bb('0x73')](this[_0x92bb('0xc')][_0x261cd7[_0x92bb('0x71')]][_0x9ce419][_0x92bb('0x33')],_0x92bb('0x77'));}}}}}}catch(_0x5d5e83){logger['error']('[syncBlindTransfer][VoiceAgentReport]',util[_0x92bb('0x32')](_0x5d5e83,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x92bb('0x1f')][_0x92bb('0x18')]=function(_0x129582){var _0x4e1a85='';try{if(this['isNotNull'](_0x129582)){if(_0x129582['channel']){_0x4e1a85=_0x129582['channel']['substring'](0x0,_0x129582['channel']['lastIndexOf']('-'));if(this[_0x92bb('0xe')][_0x4e1a85]){this[_0x92bb('0xe')][_0x4e1a85]['onhold']=!![];}}}}catch(_0x241f5e){logger[_0x92bb('0x30')](_0x92bb('0x78'),util[_0x92bb('0x32')](_0x241f5e,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x92bb('0x1f')][_0x92bb('0x1a')]=function(_0x4d6bf0){var _0xe8e9a5='';try{if(this[_0x92bb('0x20')](_0x4d6bf0)){if(_0x4d6bf0[_0x92bb('0x79')]){_0xe8e9a5=_0x4d6bf0[_0x92bb('0x79')][_0x92bb('0x7a')](0x0,_0x4d6bf0[_0x92bb('0x79')][_0x92bb('0x7b')]('-'));if(this['agents'][_0xe8e9a5]){this[_0x92bb('0xe')][_0xe8e9a5][_0x92bb('0x7c')]=![];}}}}catch(_0x51e92c){logger[_0x92bb('0x30')]('[syncMusicOnHoldStop][VoiceAgentReport]',util[_0x92bb('0x32')](_0x51e92c,{'showHidden':![],'depth':null}));}};module[_0x92bb('0x7d')]=VoiceAgentReport; \ No newline at end of file diff --git a/server/services/ami/report/voiceCallReport.js b/server/services/ami/report/voiceCallReport.js index 22d50c2..4d73135 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 _0x4745=['pick','keys','context','channel','split','destconnectedlinenum','exten','user:%s','name','user:agentconnect','[syncNewChannel][VoiceCallReport]','application','toLowerCase','applicationdata','appdata','duration','subtract','seconds','lastapplication','lastdata','startsWith','cdr(','match','[syncNewExten][VoiceCallReport]','syncNewState','answered','answertime','holdtime','diff','calleridnum','connectedlinename','calleridname','destinationchannel','UserId','membername','[syncNewState][VoiceCallReport]','syncMixMonitorFilename','monitor','replace','.wav49','.WAV','find','monitors','push','syncVarSet','variable','mixmonitor_filename','value','callerid','xmd-cdrtype','type','xmd-queue','xmd-originatecalleridnum','originatecalleridnum','xmd-destination','destination','xmd-callerid-preview','sipcallid','sipcalluniqueid','parse','[syncVarSet][VoiceCallReport]','endtime','billableseconds','from-sip','omit','user:agentcomplete','custom:voiceCallReport','[syncHangup][VoiceCallReport]','transfereeuniqueid','transfercalleridnum','origtransferercalleridnum','transferconnectedlinenum','transfertargetcalleridnum','secondtransfereruniqueid','transfertargetuniqueid','origtransfereruniqueid','[syncAttendedTransfer][VoiceCallReport]','syncBlindTransfer','transfereecalleridnum','extension','transfererchannel','[syncBlindTransfer][VoiceCallReport]','mohstarttime','[syncMusicOnHoldStart][VoiceCallReport]','isNil','mohtime','[syncMusicOnHoldStop][VoiceCallReport]','bluebird','lodash','moment','util','path','ioredis','../../../config/environment','../../../config/logger','ami','../model/channel','unknown','inuse','busy','unavailable','ringing','onhold','set','queue','agi','dial','playback','voicemail','NO\x20ANSWER','FAILED','ANSWERED','BUSY','redis','localhost','channels','agents','coreshowchannel','syncNewExten','bind','newexten','newchannel','syncNewChannel','newstate','hangup','syncHangup','newcallerid','syncNewCallerId','attendedtransfer','syncAttendedTransfer','blindtransfer','musiconholdstart','syncMusicOnHoldStart','musiconholdstop','syncMusicOnHoldStop','resolve','then','actionCoreShowChannels','log','isNotNull','prototype','emit','uniqueid','linkedid','merge','error','[syncNewCallerId][VoiceCallReport]','inspect','OutgoingSpoolFailed','isUndefined','starttime','format','YYYY-MM-DD\x20HH:mm:ss','disposition','toNumber','channelstate'];(function(_0x98ac1f,_0x2effb0){var _0x1579d1=function(_0x54b8d7){while(--_0x54b8d7){_0x98ac1f['push'](_0x98ac1f['shift']());}};_0x1579d1(++_0x2effb0);}(_0x4745,0xf3));var _0x5474=function(_0x411add,_0x1aed38){_0x411add=_0x411add-0x0;var _0x238242=_0x4745[_0x411add];return _0x238242;};'use strict';var BPromise=require(_0x5474('0x0'));var _=require(_0x5474('0x1'));var moment=require(_0x5474('0x2'));var util=require(_0x5474('0x3'));var path=require(_0x5474('0x4'));var Redis=require(_0x5474('0x5'));var config=require(_0x5474('0x6'));var logger=require(_0x5474('0x7'))(_0x5474('0x8'));var ami=require('../ami');var Channel=require(_0x5474('0x9'));var statusDesc=[_0x5474('0xa'),'not_inuse',_0x5474('0xb'),_0x5474('0xc'),'invalid',_0x5474('0xd'),_0x5474('0xe'),'ringinuse',_0x5474('0xf')];var applications=[_0x5474('0x10'),_0x5474('0x11'),_0x5474('0x12'),_0x5474('0x13'),_0x5474('0x14'),_0x5474('0x15')];var dispositions=[_0x5474('0x16'),_0x5474('0x17'),_0x5474('0x17'),'NO\x20ANSWER','NO\x20ANSWER',_0x5474('0x16'),_0x5474('0x18'),_0x5474('0x19'),_0x5474('0x17'),'FAILED','FAILED'];var actions={};config[_0x5474('0x1a')]=_['defaults'](config[_0x5474('0x1a')],{'host':_0x5474('0x1b'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x5474('0x1a')]));function VoiceCallReport(_0x443f01){this['channels']=_0x443f01[_0x5474('0x1c')];this[_0x5474('0x1d')]=_0x443f01[_0x5474('0x1d')];ami['on'](_0x5474('0x1e'),this[_0x5474('0x1f')][_0x5474('0x20')](this));ami['on'](_0x5474('0x21'),this[_0x5474('0x1f')][_0x5474('0x20')](this));ami['on'](_0x5474('0x22'),this[_0x5474('0x23')]['bind'](this));ami['on'](_0x5474('0x24'),this['syncNewState']['bind'](this));ami['on']('varset',this['syncVarSet']['bind'](this));ami['on'](_0x5474('0x25'),this[_0x5474('0x26')][_0x5474('0x20')](this));ami['on'](_0x5474('0x27'),this[_0x5474('0x28')]['bind'](this));ami['on'](_0x5474('0x29'),this[_0x5474('0x2a')][_0x5474('0x20')](this));ami['on'](_0x5474('0x2b'),this['syncBlindTransfer'][_0x5474('0x20')](this));ami['on'](_0x5474('0x2c'),this[_0x5474('0x2d')]['bind'](this));ami['on'](_0x5474('0x2e'),this[_0x5474('0x2f')][_0x5474('0x20')](this));return BPromise[_0x5474('0x30')]()[_0x5474('0x31')](ami[_0x5474('0x32')]())['catch'](function(_0x37dd50){console[_0x5474('0x33')](_0x37dd50);});}VoiceCallReport['prototype'][_0x5474('0x34')]=function(_0x202ea8){return _0x202ea8!==null&&!_['isUndefined'](_0x202ea8);};VoiceCallReport[_0x5474('0x35')][_0x5474('0x36')]=function(_0x2680aa,_0x15a200,_0x5f0936){io['to'](_0x2680aa)['emit'](_0x15a200,_0x5f0936);};VoiceCallReport[_0x5474('0x35')][_0x5474('0x28')]=function(_0x2881d6){try{if(this[_0x5474('0x34')](_0x2881d6)){if(_0x2881d6[_0x5474('0x37')]===_0x2881d6[_0x5474('0x38')]){if(!_['isUndefined'](this[_0x5474('0x1c')][_0x2881d6[_0x5474('0x37')]])){_[_0x5474('0x39')](this[_0x5474('0x1c')][_0x2881d6['uniqueid']],_['pick'](_0x2881d6,_['keys'](this[_0x5474('0x1c')][_0x2881d6[_0x5474('0x37')]])));}}}}catch(_0x2f75c6){logger[_0x5474('0x3a')](_0x5474('0x3b'),util[_0x5474('0x3c')](_0x2f75c6,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x5474('0x35')][_0x5474('0x23')]=function(_0x30e223){try{if(this[_0x5474('0x34')](_0x30e223)){if(_0x30e223[_0x5474('0x37')]===_0x30e223[_0x5474('0x38')]&&_0x30e223['channel']!=_0x5474('0x3d')){if(_[_0x5474('0x3e')](this['channels'][_0x30e223[_0x5474('0x37')]])){this['channels'][_0x30e223[_0x5474('0x37')]]=new Channel();this[_0x5474('0x1c')][_0x30e223[_0x5474('0x37')]][_0x5474('0x3f')]=moment()[_0x5474('0x40')](_0x5474('0x41'));this[_0x5474('0x1c')][_0x30e223['uniqueid']][_0x5474('0x42')]=dispositions[_[_0x5474('0x43')](_0x30e223[_0x5474('0x44')])];_[_0x5474('0x39')](this[_0x5474('0x1c')][_0x30e223[_0x5474('0x37')]],_[_0x5474('0x45')](_0x30e223,_[_0x5474('0x46')](this[_0x5474('0x1c')][_0x30e223[_0x5474('0x37')]])));if(_0x30e223[_0x5474('0x47')]==='from-sip'){if(this[_0x5474('0x1d')][_0x30e223[_0x5474('0x48')]['split']('-')[0x0]]){this[_0x5474('0x1d')][_0x30e223[_0x5474('0x48')][_0x5474('0x49')]('-')[0x0]][_0x5474('0x4a')]=_0x30e223[_0x5474('0x4b')];this[_0x5474('0x36')](util[_0x5474('0x40')](_0x5474('0x4c'),this[_0x5474('0x1d')][_0x30e223[_0x5474('0x48')][_0x5474('0x49')]('-')[0x0]][_0x5474('0x4d')]),_0x5474('0x4e'),{'destaccountcode':this[_0x5474('0x1d')][_0x30e223['channel'][_0x5474('0x49')]('-')[0x0]]['accountcode'],'destconnectedlinenum':_0x30e223['exten']});}}}}}}catch(_0x261541){logger[_0x5474('0x3a')](_0x5474('0x4f'),util[_0x5474('0x3c')](_0x261541,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x5474('0x35')][_0x5474('0x1f')]=function(_0x405661){try{if(this[_0x5474('0x34')](_0x405661)){if(_0x405661[_0x5474('0x37')]===_0x405661[_0x5474('0x38')]&&_0x405661[_0x5474('0x4b')]!='h'&&_0x405661[_0x5474('0x48')]!=_0x5474('0x3d')){_0x405661[_0x5474('0x50')]=_0x405661['application'][_0x5474('0x51')]();_0x405661[_0x5474('0x52')]=(_0x405661[_0x5474('0x53')]||_0x405661[_0x5474('0x52')])[_0x5474('0x51')]();if(_[_0x5474('0x3e')](this['channels'][_0x405661[_0x5474('0x37')]])){this[_0x5474('0x1c')][_0x405661['uniqueid']]=new Channel();this['channels'][_0x405661[_0x5474('0x37')]][_0x5474('0x3f')]=_0x405661[_0x5474('0x54')]?moment()[_0x5474('0x55')](moment[_0x5474('0x54')](_0x405661[_0x5474('0x54')])[_0x5474('0x56')](),_0x5474('0x56'))['format'](_0x5474('0x41')):moment()[_0x5474('0x40')]('YYYY-MM-DD\x20HH:mm:ss');this[_0x5474('0x1c')][_0x405661[_0x5474('0x37')]][_0x5474('0x42')]=_0x5474('0x16');}_[_0x5474('0x39')](this[_0x5474('0x1c')][_0x405661[_0x5474('0x37')]],_[_0x5474('0x45')](_0x405661,_['keys'](this[_0x5474('0x1c')][_0x405661['uniqueid']])));if(_['includes'](applications,_0x405661[_0x5474('0x50')])){this[_0x5474('0x1c')][_0x405661[_0x5474('0x37')]][_0x5474('0x57')]=_0x405661['application'];this[_0x5474('0x1c')][_0x405661[_0x5474('0x37')]][_0x5474('0x58')]=_0x405661['applicationdata'];if(_0x405661['application']===_0x5474('0x10')&&_[_0x5474('0x59')](_0x405661[_0x5474('0x52')],_0x5474('0x5a'))){var _0x16f3bd=_0x405661[_0x5474('0x52')][_0x5474('0x49')]('=');var _0x1baeb6=_0x16f3bd[0x0][_0x5474('0x5b')](/cdr\((.*)\)/);if(_0x1baeb6){this['channels'][_0x405661[_0x5474('0x37')]][_0x1baeb6[0x1]]=_0x16f3bd[0x1];}}else if(_0x405661['application']==='queue'){this[_0x5474('0x1c')][_0x405661[_0x5474('0x37')]][_0x5474('0x11')]=_0x405661[_0x5474('0x52')][_0x5474('0x49')](',')[0x0];}}}}}catch(_0x20844b){logger[_0x5474('0x3a')](_0x5474('0x5c'),util[_0x5474('0x3c')](_0x20844b,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x5474('0x35')][_0x5474('0x5d')]=function(_0x47de07){try{if(this[_0x5474('0x34')](_0x47de07)){if(_0x47de07[_0x5474('0x37')]!==_0x47de07[_0x5474('0x38')]){if(this[_0x5474('0x1c')][_0x47de07['linkedid']]){if(_0x47de07[_0x5474('0x44')]==='6'){if(!this[_0x5474('0x1c')][_0x47de07[_0x5474('0x38')]]['answered']){var _0x1ca0db=moment();this[_0x5474('0x1c')][_0x47de07[_0x5474('0x38')]][_0x5474('0x5e')]=!![];this['channels'][_0x47de07[_0x5474('0x38')]][_0x5474('0x5f')]=_0x1ca0db['format'](_0x5474('0x41'));if(this[_0x5474('0x1c')][_0x47de07[_0x5474('0x38')]][_0x5474('0x3f')]){this['channels'][_0x47de07[_0x5474('0x38')]][_0x5474('0x60')]=_0x1ca0db[_0x5474('0x61')](this[_0x5474('0x1c')][_0x47de07[_0x5474('0x38')]][_0x5474('0x3f')],_0x5474('0x56'));}}this['channels'][_0x47de07[_0x5474('0x38')]][_0x5474('0x38')]=_0x47de07[_0x5474('0x37')];if(_0x47de07['calleridnum']!=='xcally-motion-preview'){this['channels'][_0x47de07[_0x5474('0x38')]]['connectedlinenum']=_0x47de07[_0x5474('0x62')];}this[_0x5474('0x1c')][_0x47de07[_0x5474('0x38')]][_0x5474('0x63')]=_0x47de07[_0x5474('0x64')];this[_0x5474('0x1c')][_0x47de07['linkedid']][_0x5474('0x65')]=_0x47de07['channel'];this['channels'][_0x47de07['linkedid']]['disposition']=dispositions[_[_0x5474('0x43')](_0x47de07[_0x5474('0x44')])];if(this[_0x5474('0x1d')][_0x47de07[_0x5474('0x48')][_0x5474('0x49')]('-')[0x0]]){this[_0x5474('0x1c')][_0x47de07['linkedid']][_0x5474('0x66')]=this['agents'][_0x47de07['channel'][_0x5474('0x49')]('-')[0x0]]['id'];this['channels'][_0x47de07[_0x5474('0x38')]]['membername']=this[_0x5474('0x1d')][_0x47de07[_0x5474('0x48')][_0x5474('0x49')]('-')[0x0]][_0x5474('0x4d')];}}}}else{if(this[_0x5474('0x1c')][_0x47de07[_0x5474('0x37')]]){if(_0x47de07[_0x5474('0x44')]==='6'){if(this[_0x5474('0x1d')][_0x47de07[_0x5474('0x48')][_0x5474('0x49')]('-')[0x0]]){this[_0x5474('0x1c')][_0x47de07[_0x5474('0x37')]]['UserId']=this[_0x5474('0x1d')][_0x47de07['channel'][_0x5474('0x49')]('-')[0x0]]['id'];this[_0x5474('0x1c')][_0x47de07['uniqueid']][_0x5474('0x67')]=this[_0x5474('0x1d')][_0x47de07[_0x5474('0x48')][_0x5474('0x49')]('-')[0x0]][_0x5474('0x4d')];}}}}}}catch(_0x120f18){logger[_0x5474('0x3a')](_0x5474('0x68'),util[_0x5474('0x3c')](_0x120f18,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x5474('0x35')][_0x5474('0x69')]=function(_0x39622e,_0x3f6bdd){if(this[_0x5474('0x1c')][_0x39622e]){this[_0x5474('0x1c')][_0x39622e][_0x5474('0x6a')]=!![];if(_['endsWith'](_0x3f6bdd,'.wav49')){_0x3f6bdd=_0x3f6bdd[_0x5474('0x6b')](_0x5474('0x6c'),_0x5474('0x6d'));}this[_0x5474('0x1c')][_0x39622e]['monitorFilename']=_0x3f6bdd;var _0x373bdb=_[_0x5474('0x6e')](this[_0x5474('0x1c')][_0x39622e][_0x5474('0x6f')],{'filename':_0x3f6bdd});if(_['isNil'](_0x373bdb)){this[_0x5474('0x1c')][_0x39622e]['monitors'][_0x5474('0x70')]({'filename':_0x3f6bdd,'createdAt':moment()[_0x5474('0x40')](_0x5474('0x41')),'mixmonitorid':'','status':'rec'});}}};VoiceCallReport[_0x5474('0x35')][_0x5474('0x71')]=function(_0x3488f1){try{if(this['isNotNull'](_0x3488f1)){if(this[_0x5474('0x1c')][_0x3488f1['uniqueid']]&&_0x3488f1[_0x5474('0x48')]!=_0x5474('0x3d')){if(this[_0x5474('0x34')](_0x3488f1[_0x5474('0x72')])){if(this['isNotNull'](_0x3488f1['variable'][_0x5474('0x73')])){this['syncMixMonitorFilename'](_0x3488f1['uniqueid'],_0x3488f1[_0x5474('0x74')]);}else if(this[_0x5474('0x34')](_0x3488f1[_0x5474('0x72')]['xmd-phone'])){this[_0x5474('0x1c')][_0x3488f1[_0x5474('0x37')]][_0x5474('0x62')]=_0x3488f1['value'];}else if(this[_0x5474('0x34')](_0x3488f1[_0x5474('0x72')]['xmd-callerid'])){this[_0x5474('0x1c')][_0x3488f1[_0x5474('0x37')]][_0x5474('0x75')]=_0x3488f1[_0x5474('0x74')];}else if(this[_0x5474('0x34')](_0x3488f1[_0x5474('0x72')][_0x5474('0x76')])){this['channels'][_0x3488f1['uniqueid']][_0x5474('0x77')]=_0x3488f1[_0x5474('0x74')];}else if(this['isNotNull'](_0x3488f1[_0x5474('0x72')][_0x5474('0x78')])){this['channels'][_0x3488f1[_0x5474('0x37')]]['queue']=_0x3488f1[_0x5474('0x74')][_0x5474('0x49')](',')[0x0];}else if(this[_0x5474('0x34')](_0x3488f1[_0x5474('0x72')][_0x5474('0x79')])){this[_0x5474('0x1c')][_0x3488f1[_0x5474('0x37')]][_0x5474('0x7a')]=_0x3488f1[_0x5474('0x74')];}else if(this[_0x5474('0x34')](_0x3488f1[_0x5474('0x72')][_0x5474('0x7b')])){this[_0x5474('0x1c')][_0x3488f1[_0x5474('0x37')]][_0x5474('0x7c')]=_0x3488f1[_0x5474('0x74')];}else if(this[_0x5474('0x34')](_0x3488f1['variable'][_0x5474('0x7d')])){this[_0x5474('0x1c')][_0x3488f1['uniqueid']]['calleridpreview']=_0x3488f1[_0x5474('0x74')];}else if(this[_0x5474('0x34')](_0x3488f1[_0x5474('0x72')]['xmcs-queue'])){this[_0x5474('0x1c')][_0x3488f1[_0x5474('0x37')]][_0x5474('0x11')]=_0x3488f1[_0x5474('0x74')];}else if(this[_0x5474('0x34')](_0x3488f1[_0x5474('0x72')][_0x5474('0x7e')])){this[_0x5474('0x1c')][_0x3488f1[_0x5474('0x37')]][_0x5474('0x7f')]=_0x3488f1[_0x5474('0x74')];}}}else if(this[_0x5474('0x34')](_0x3488f1['variable'][_0x5474('0x73')])){if(_0x3488f1[_0x5474('0x74')]){var _0x5e595f=path[_0x5474('0x80')](_0x3488f1[_0x5474('0x74')])[_0x5474('0x4d')];this[_0x5474('0x69')](_0x5e595f,_0x3488f1['value']);}}else if(this[_0x5474('0x1c')][_0x3488f1[_0x5474('0x38')]]){if(this['isNotNull'](_0x3488f1[_0x5474('0x72')])){if(this[_0x5474('0x34')](_0x3488f1['variable'][_0x5474('0x7e')])){this[_0x5474('0x1c')][_0x3488f1['linkedid']]['sipcalllinkedid']=_0x3488f1[_0x5474('0x74')];}}}}}catch(_0xe96cf2){logger['error'](_0x5474('0x81'),util[_0x5474('0x3c')](_0xe96cf2,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x5474('0x35')][_0x5474('0x26')]=function(_0x130fca){try{if(this[_0x5474('0x34')](_0x130fca)){if(this[_0x5474('0x1c')][_0x130fca['uniqueid']]){var _0x1ac943=moment();this[_0x5474('0x1c')][_0x130fca[_0x5474('0x37')]][_0x5474('0x82')]=_0x1ac943[_0x5474('0x40')](_0x5474('0x41'));this[_0x5474('0x1c')][_0x130fca['uniqueid']][_0x5474('0x54')]=_0x1ac943['diff'](this['channels'][_0x130fca['uniqueid']]['starttime'],_0x5474('0x56'));if(this[_0x5474('0x1c')][_0x130fca['uniqueid']][_0x5474('0x5e')]){this['channels'][_0x130fca[_0x5474('0x37')]][_0x5474('0x83')]=_0x1ac943[_0x5474('0x61')](this['channels'][_0x130fca[_0x5474('0x37')]][_0x5474('0x5f')],'seconds');this[_0x5474('0x1c')][_0x130fca[_0x5474('0x37')]][_0x5474('0x60')]=this[_0x5474('0x1c')][_0x130fca[_0x5474('0x37')]][_0x5474('0x54')]-this[_0x5474('0x1c')][_0x130fca[_0x5474('0x37')]]['billableseconds'];}if(_0x130fca[_0x5474('0x47')]===_0x5474('0x84')){if(this[_0x5474('0x1d')][_0x130fca[_0x5474('0x48')][_0x5474('0x49')]('-')[0x0]]){this['agents'][_0x130fca['channel']['split']('-')[0x0]]=_[_0x5474('0x85')](this[_0x5474('0x1d')][_0x130fca[_0x5474('0x48')][_0x5474('0x49')]('-')[0x0]],[_0x5474('0x4a')]);this[_0x5474('0x36')](util[_0x5474('0x40')](_0x5474('0x4c'),this[_0x5474('0x1d')][_0x130fca[_0x5474('0x48')][_0x5474('0x49')]('-')[0x0]][_0x5474('0x4d')]),_0x5474('0x86'),{'destaccountcode':this[_0x5474('0x1d')][_0x130fca[_0x5474('0x48')][_0x5474('0x49')]('-')[0x0]]['accountcode']});}}ami[_0x5474('0x36')](_0x5474('0x87'),this[_0x5474('0x1c')][_0x130fca['uniqueid']]);delete this[_0x5474('0x1c')][_0x130fca[_0x5474('0x37')]];}}}catch(_0x2c39e2){logger[_0x5474('0x3a')](_0x5474('0x88'),util['inspect'](_0x2c39e2,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x5474('0x35')][_0x5474('0x2a')]=function(_0x9bd8dc){try{if(this['isNotNull'](_0x9bd8dc)){if(this[_0x5474('0x1c')][_0x9bd8dc[_0x5474('0x89')]]){this[_0x5474('0x1c')][_0x9bd8dc[_0x5474('0x89')]][_0x5474('0x8a')]=_0x9bd8dc[_0x5474('0x8b')];this['channels'][_0x9bd8dc[_0x5474('0x89')]][_0x5474('0x8c')]=_0x9bd8dc[_0x5474('0x8d')];if(this[_0x5474('0x1c')][_0x9bd8dc[_0x5474('0x8e')]]){var _0x404bc0=this[_0x5474('0x1c')][_0x9bd8dc['secondtransfereruniqueid']];this[_0x5474('0x1c')][_0x9bd8dc[_0x5474('0x8e')]]=this[_0x5474('0x1c')][_0x9bd8dc['transfereeuniqueid']];this[_0x5474('0x1c')][_0x9bd8dc['transfereeuniqueid']]=_0x404bc0;}}else if(this['channels'][_0x9bd8dc[_0x5474('0x8f')]]){this[_0x5474('0x1c')][_0x9bd8dc[_0x5474('0x8f')]][_0x5474('0x8a')]=_0x9bd8dc[_0x5474('0x8b')];this[_0x5474('0x1c')][_0x9bd8dc[_0x5474('0x8f')]][_0x5474('0x8c')]=_0x9bd8dc[_0x5474('0x8d')];if(this[_0x5474('0x1c')][_0x9bd8dc['origtransfereruniqueid']]){var _0x404bc0=this[_0x5474('0x1c')][_0x9bd8dc['origtransfereruniqueid']];this[_0x5474('0x1c')][_0x9bd8dc[_0x5474('0x90')]]=this[_0x5474('0x1c')][_0x9bd8dc[_0x5474('0x8f')]];this[_0x5474('0x1c')][_0x9bd8dc[_0x5474('0x8f')]]=_0x404bc0;}}}}catch(_0x1296d8){logger[_0x5474('0x3a')](_0x5474('0x91'),util[_0x5474('0x3c')](_0x1296d8,{'showHidden':![],'depth':null}));}};VoiceCallReport['prototype'][_0x5474('0x92')]=function(_0x43e8e3){try{if(this[_0x5474('0x34')](_0x43e8e3)){if(this[_0x5474('0x1c')][_0x43e8e3[_0x5474('0x89')]]){this['channels'][_0x43e8e3[_0x5474('0x89')]][_0x5474('0x8a')]=_0x43e8e3[_0x5474('0x93')];this[_0x5474('0x1c')][_0x43e8e3['transfereeuniqueid']][_0x5474('0x8c')]=_0x43e8e3[_0x5474('0x94')];this[_0x5474('0x26')]({'event':'BlindTransfer','uniqueid':_0x43e8e3[_0x5474('0x89')],'context':_0x43e8e3[_0x5474('0x47')],'channel':_0x43e8e3[_0x5474('0x95')]});}}}catch(_0x39c4af){logger[_0x5474('0x3a')](_0x5474('0x96'),util[_0x5474('0x3c')](_0x39c4af,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x5474('0x35')][_0x5474('0x2d')]=function(_0x4859c4){try{if(this[_0x5474('0x34')](_0x4859c4)){if(this['channels'][_0x4859c4[_0x5474('0x37')]]){if(!_['isNil'](this[_0x5474('0x1c')][_0x4859c4['uniqueid']][_0x5474('0x5f')])){this[_0x5474('0x1c')][_0x4859c4[_0x5474('0x37')]][_0x5474('0x97')]=moment()[_0x5474('0x40')](_0x5474('0x41'));}}}}catch(_0x59c70b){logger['error'](_0x5474('0x98'),util[_0x5474('0x3c')](_0x59c70b,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x5474('0x35')][_0x5474('0x2f')]=function(_0x41ecd5){try{if(this['isNotNull'](_0x41ecd5)){if(this['channels'][_0x41ecd5[_0x5474('0x37')]]){if(!_[_0x5474('0x99')](this[_0x5474('0x1c')][_0x41ecd5[_0x5474('0x37')]][_0x5474('0x97')])){this['channels'][_0x41ecd5[_0x5474('0x37')]][_0x5474('0x9a')]+=moment()['milliseconds'](0x0)[_0x5474('0x61')](this[_0x5474('0x1c')][_0x41ecd5[_0x5474('0x37')]][_0x5474('0x97')],'seconds');delete this['channels'][_0x41ecd5[_0x5474('0x37')]][_0x5474('0x97')];}}}}catch(_0x34ec5e){logger['error'](_0x5474('0x9b'),util['inspect'](_0x34ec5e,{'showHidden':![],'depth':null}));}};module['exports']=VoiceCallReport; \ No newline at end of file +var _0x530a=['NO\x20ANSWER','FAILED','BUSY','redis','localhost','socket.io-emitter','agents','syncNewExten','bind','newexten','newchannel','syncNewChannel','syncNewState','syncVarSet','newcallerid','syncNewCallerId','attendedtransfer','syncAttendedTransfer','syncBlindTransfer','musiconholdstart','syncMusicOnHoldStart','musiconholdstop','syncMusicOnHoldStop','resolve','then','actionCoreShowChannels','log','isNotNull','isUndefined','prototype','emit','uniqueid','linkedid','channels','merge','pick','error','channel','OutgoingSpoolFailed','starttime','format','YYYY-MM-DD\x20HH:mm:ss','disposition','channelstate','keys','from-sip','split','destconnectedlinenum','exten','user:%s','name','accountcode','[syncNewChannel][VoiceCallReport]','inspect','application','toLowerCase','applicationdata','appdata','duration','subtract','seconds','includes','lastapplication','lastdata','startsWith','cdr(','match','answered','answertime','holdtime','diff','calleridnum','xcally-motion-preview','connectedlinenum','connectedlinename','calleridname','destinationchannel','toNumber','UserId','[syncNewState][VoiceCallReport]','syncMixMonitorFilename','.wav49','.WAV','monitorFilename','isNil','variable','value','xmd-phone','xmd-callerid','callerid','xmd-cdrtype','xmd-queue','xmd-originatecalleridnum','originatecalleridnum','destination','xmd-callerid-preview','calleridpreview','xmcs-queue','sipcallid','sipcalluniqueid','mixmonitor_filename','parse','syncHangup','endtime','billableseconds','omit','user:agentcomplete','custom:voiceCallReport','[syncHangup][VoiceCallReport]','transfereeuniqueid','transfercalleridnum','origtransferercalleridnum','transferconnectedlinenum','transfertargetcalleridnum','secondtransfereruniqueid','transfertargetuniqueid','origtransfereruniqueid','[syncAttendedTransfer][VoiceCallReport]','transfereecalleridnum','extension','BlindTransfer','transfererchannel','[syncBlindTransfer][VoiceCallReport]','mohstarttime','[syncMusicOnHoldStart][VoiceCallReport]','mohtime','milliseconds','[syncMusicOnHoldStop][VoiceCallReport]','exports','lodash','moment','util','path','ioredis','../../../config/environment','ami','../ami','not_inuse','inuse','invalid','unavailable','ringing','onhold','set','queue','agi','playback'];(function(_0x4911ce,_0xdf92db){var _0x20e35d=function(_0x55b200){while(--_0x55b200){_0x4911ce['push'](_0x4911ce['shift']());}};_0x20e35d(++_0xdf92db);}(_0x530a,0x81));var _0xa530=function(_0xcd784e,_0xd3402c){_0xcd784e=_0xcd784e-0x0;var _0x4f661e=_0x530a[_0xcd784e];return _0x4f661e;};'use strict';var BPromise=require('bluebird');var _=require(_0xa530('0x0'));var moment=require(_0xa530('0x1'));var util=require(_0xa530('0x2'));var path=require(_0xa530('0x3'));var Redis=require(_0xa530('0x4'));var config=require(_0xa530('0x5'));var logger=require('../../../config/logger')(_0xa530('0x6'));var ami=require(_0xa530('0x7'));var Channel=require('../model/channel');var statusDesc=['unknown',_0xa530('0x8'),_0xa530('0x9'),'busy',_0xa530('0xa'),_0xa530('0xb'),_0xa530('0xc'),'ringinuse',_0xa530('0xd')];var applications=[_0xa530('0xe'),_0xa530('0xf'),_0xa530('0x10'),'dial',_0xa530('0x11'),'voicemail'];var dispositions=[_0xa530('0x12'),_0xa530('0x13'),_0xa530('0x13'),_0xa530('0x12'),'NO\x20ANSWER',_0xa530('0x12'),'ANSWERED',_0xa530('0x14'),'FAILED',_0xa530('0x13'),_0xa530('0x13')];var actions={};config['redis']=_['defaults'](config[_0xa530('0x15')],{'host':_0xa530('0x16'),'port':0x18eb});var io=require(_0xa530('0x17'))(new Redis(config[_0xa530('0x15')]));function VoiceCallReport(_0xdda513){this['channels']=_0xdda513['channels'];this['agents']=_0xdda513[_0xa530('0x18')];ami['on']('coreshowchannel',this[_0xa530('0x19')][_0xa530('0x1a')](this));ami['on'](_0xa530('0x1b'),this[_0xa530('0x19')][_0xa530('0x1a')](this));ami['on'](_0xa530('0x1c'),this[_0xa530('0x1d')][_0xa530('0x1a')](this));ami['on']('newstate',this[_0xa530('0x1e')]['bind'](this));ami['on']('varset',this[_0xa530('0x1f')]['bind'](this));ami['on']('hangup',this['syncHangup'][_0xa530('0x1a')](this));ami['on'](_0xa530('0x20'),this[_0xa530('0x21')]['bind'](this));ami['on'](_0xa530('0x22'),this[_0xa530('0x23')][_0xa530('0x1a')](this));ami['on']('blindtransfer',this[_0xa530('0x24')][_0xa530('0x1a')](this));ami['on'](_0xa530('0x25'),this[_0xa530('0x26')][_0xa530('0x1a')](this));ami['on'](_0xa530('0x27'),this[_0xa530('0x28')][_0xa530('0x1a')](this));return BPromise[_0xa530('0x29')]()[_0xa530('0x2a')](ami[_0xa530('0x2b')]())['catch'](function(_0x127165){console[_0xa530('0x2c')](_0x127165);});}VoiceCallReport['prototype'][_0xa530('0x2d')]=function(_0x5c318d){return _0x5c318d!==null&&!_[_0xa530('0x2e')](_0x5c318d);};VoiceCallReport[_0xa530('0x2f')][_0xa530('0x30')]=function(_0xdd58ac,_0x375665,_0x2be990){io['to'](_0xdd58ac)[_0xa530('0x30')](_0x375665,_0x2be990);};VoiceCallReport[_0xa530('0x2f')][_0xa530('0x21')]=function(_0x1ba1c6){try{if(this['isNotNull'](_0x1ba1c6)){if(_0x1ba1c6[_0xa530('0x31')]===_0x1ba1c6[_0xa530('0x32')]){if(!_[_0xa530('0x2e')](this[_0xa530('0x33')][_0x1ba1c6[_0xa530('0x31')]])){_[_0xa530('0x34')](this['channels'][_0x1ba1c6[_0xa530('0x31')]],_[_0xa530('0x35')](_0x1ba1c6,_['keys'](this[_0xa530('0x33')][_0x1ba1c6[_0xa530('0x31')]])));}}}}catch(_0x333aed){logger[_0xa530('0x36')]('[syncNewCallerId][VoiceCallReport]',util['inspect'](_0x333aed,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xa530('0x2f')]['syncNewChannel']=function(_0x56e571){try{if(this[_0xa530('0x2d')](_0x56e571)){if(_0x56e571[_0xa530('0x31')]===_0x56e571['linkedid']&&_0x56e571[_0xa530('0x37')]!=_0xa530('0x38')){if(_['isUndefined'](this[_0xa530('0x33')][_0x56e571[_0xa530('0x31')]])){this[_0xa530('0x33')][_0x56e571[_0xa530('0x31')]]=new Channel();this[_0xa530('0x33')][_0x56e571[_0xa530('0x31')]][_0xa530('0x39')]=moment()[_0xa530('0x3a')](_0xa530('0x3b'));this[_0xa530('0x33')][_0x56e571[_0xa530('0x31')]][_0xa530('0x3c')]=dispositions[_['toNumber'](_0x56e571[_0xa530('0x3d')])];_[_0xa530('0x34')](this[_0xa530('0x33')][_0x56e571['uniqueid']],_[_0xa530('0x35')](_0x56e571,_[_0xa530('0x3e')](this[_0xa530('0x33')][_0x56e571[_0xa530('0x31')]])));if(_0x56e571['context']===_0xa530('0x3f')){if(this[_0xa530('0x18')][_0x56e571[_0xa530('0x37')][_0xa530('0x40')]('-')[0x0]]){this[_0xa530('0x18')][_0x56e571[_0xa530('0x37')]['split']('-')[0x0]][_0xa530('0x41')]=_0x56e571[_0xa530('0x42')];this[_0xa530('0x30')](util[_0xa530('0x3a')](_0xa530('0x43'),this['agents'][_0x56e571[_0xa530('0x37')][_0xa530('0x40')]('-')[0x0]][_0xa530('0x44')]),'user:agentconnect',{'destaccountcode':this[_0xa530('0x18')][_0x56e571[_0xa530('0x37')][_0xa530('0x40')]('-')[0x0]][_0xa530('0x45')],'destconnectedlinenum':_0x56e571[_0xa530('0x42')]});}}}}}}catch(_0x42931a){logger[_0xa530('0x36')](_0xa530('0x46'),util[_0xa530('0x47')](_0x42931a,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xa530('0x2f')][_0xa530('0x19')]=function(_0x56eb73){try{if(this[_0xa530('0x2d')](_0x56eb73)){if(_0x56eb73[_0xa530('0x31')]===_0x56eb73[_0xa530('0x32')]&&_0x56eb73[_0xa530('0x42')]!='h'&&_0x56eb73[_0xa530('0x37')]!=_0xa530('0x38')){_0x56eb73['application']=_0x56eb73[_0xa530('0x48')][_0xa530('0x49')]();_0x56eb73[_0xa530('0x4a')]=(_0x56eb73[_0xa530('0x4b')]||_0x56eb73[_0xa530('0x4a')])[_0xa530('0x49')]();if(_[_0xa530('0x2e')](this[_0xa530('0x33')][_0x56eb73['uniqueid']])){this[_0xa530('0x33')][_0x56eb73[_0xa530('0x31')]]=new Channel();this[_0xa530('0x33')][_0x56eb73['uniqueid']]['starttime']=_0x56eb73[_0xa530('0x4c')]?moment()[_0xa530('0x4d')](moment[_0xa530('0x4c')](_0x56eb73['duration'])['seconds'](),_0xa530('0x4e'))[_0xa530('0x3a')](_0xa530('0x3b')):moment()[_0xa530('0x3a')](_0xa530('0x3b'));this[_0xa530('0x33')][_0x56eb73['uniqueid']]['disposition']='NO\x20ANSWER';}_[_0xa530('0x34')](this[_0xa530('0x33')][_0x56eb73[_0xa530('0x31')]],_[_0xa530('0x35')](_0x56eb73,_[_0xa530('0x3e')](this[_0xa530('0x33')][_0x56eb73[_0xa530('0x31')]])));if(_[_0xa530('0x4f')](applications,_0x56eb73[_0xa530('0x48')])){this[_0xa530('0x33')][_0x56eb73[_0xa530('0x31')]][_0xa530('0x50')]=_0x56eb73[_0xa530('0x48')];this[_0xa530('0x33')][_0x56eb73['uniqueid']][_0xa530('0x51')]=_0x56eb73[_0xa530('0x4a')];if(_0x56eb73[_0xa530('0x48')]===_0xa530('0xe')&&_[_0xa530('0x52')](_0x56eb73[_0xa530('0x4a')],_0xa530('0x53'))){var _0x411640=_0x56eb73[_0xa530('0x4a')][_0xa530('0x40')]('=');var _0x4cd23a=_0x411640[0x0][_0xa530('0x54')](/cdr\((.*)\)/);if(_0x4cd23a){this[_0xa530('0x33')][_0x56eb73[_0xa530('0x31')]][_0x4cd23a[0x1]]=_0x411640[0x1];}}else if(_0x56eb73[_0xa530('0x48')]===_0xa530('0xf')){this[_0xa530('0x33')][_0x56eb73[_0xa530('0x31')]][_0xa530('0xf')]=_0x56eb73[_0xa530('0x4a')][_0xa530('0x40')](',')[0x0];}}}}}catch(_0x2fd72f){logger[_0xa530('0x36')]('[syncNewExten][VoiceCallReport]',util[_0xa530('0x47')](_0x2fd72f,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xa530('0x2f')]['syncNewState']=function(_0x55a790){try{if(this[_0xa530('0x2d')](_0x55a790)){if(_0x55a790[_0xa530('0x31')]!==_0x55a790['linkedid']){if(this['channels'][_0x55a790[_0xa530('0x32')]]){if(_0x55a790[_0xa530('0x3d')]==='6'){if(!this['channels'][_0x55a790[_0xa530('0x32')]][_0xa530('0x55')]){var _0x831fe1=moment();this[_0xa530('0x33')][_0x55a790['linkedid']]['answered']=!![];this[_0xa530('0x33')][_0x55a790[_0xa530('0x32')]][_0xa530('0x56')]=_0x831fe1['format']('YYYY-MM-DD\x20HH:mm:ss');if(this[_0xa530('0x33')][_0x55a790['linkedid']][_0xa530('0x39')]){this[_0xa530('0x33')][_0x55a790[_0xa530('0x32')]][_0xa530('0x57')]=_0x831fe1[_0xa530('0x58')](this[_0xa530('0x33')][_0x55a790['linkedid']][_0xa530('0x39')],_0xa530('0x4e'));}}this[_0xa530('0x33')][_0x55a790[_0xa530('0x32')]][_0xa530('0x32')]=_0x55a790['uniqueid'];if(_0x55a790[_0xa530('0x59')]!==_0xa530('0x5a')){this[_0xa530('0x33')][_0x55a790[_0xa530('0x32')]][_0xa530('0x5b')]=_0x55a790['calleridnum'];}this[_0xa530('0x33')][_0x55a790[_0xa530('0x32')]][_0xa530('0x5c')]=_0x55a790[_0xa530('0x5d')];this[_0xa530('0x33')][_0x55a790[_0xa530('0x32')]][_0xa530('0x5e')]=_0x55a790[_0xa530('0x37')];this[_0xa530('0x33')][_0x55a790[_0xa530('0x32')]][_0xa530('0x3c')]=dispositions[_[_0xa530('0x5f')](_0x55a790[_0xa530('0x3d')])];if(this[_0xa530('0x18')][_0x55a790[_0xa530('0x37')]['split']('-')[0x0]]){this[_0xa530('0x33')][_0x55a790[_0xa530('0x32')]][_0xa530('0x60')]=this['agents'][_0x55a790['channel']['split']('-')[0x0]]['id'];this[_0xa530('0x33')][_0x55a790['linkedid']]['membername']=this[_0xa530('0x18')][_0x55a790['channel'][_0xa530('0x40')]('-')[0x0]][_0xa530('0x44')];}}}}else{if(this['channels'][_0x55a790[_0xa530('0x31')]]){if(_0x55a790[_0xa530('0x3d')]==='6'){if(this[_0xa530('0x18')][_0x55a790[_0xa530('0x37')]['split']('-')[0x0]]){this['channels'][_0x55a790[_0xa530('0x31')]][_0xa530('0x60')]=this[_0xa530('0x18')][_0x55a790[_0xa530('0x37')]['split']('-')[0x0]]['id'];this[_0xa530('0x33')][_0x55a790[_0xa530('0x31')]]['membername']=this[_0xa530('0x18')][_0x55a790['channel'][_0xa530('0x40')]('-')[0x0]][_0xa530('0x44')];}}}}}}catch(_0x55eeca){logger[_0xa530('0x36')](_0xa530('0x61'),util[_0xa530('0x47')](_0x55eeca,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xa530('0x2f')][_0xa530('0x62')]=function(_0xe45304,_0x150f0f){if(this[_0xa530('0x33')][_0xe45304]){this['channels'][_0xe45304]['monitor']=!![];if(_['endsWith'](_0x150f0f,_0xa530('0x63'))){_0x150f0f=_0x150f0f['replace'](_0xa530('0x63'),_0xa530('0x64'));}this['channels'][_0xe45304][_0xa530('0x65')]=_0x150f0f;var _0x48e17b=_['find'](this[_0xa530('0x33')][_0xe45304]['monitors'],{'filename':_0x150f0f});if(_[_0xa530('0x66')](_0x48e17b)){this[_0xa530('0x33')][_0xe45304]['monitors']['push']({'filename':_0x150f0f,'createdAt':moment()[_0xa530('0x3a')]('YYYY-MM-DD\x20HH:mm:ss'),'mixmonitorid':'','status':'rec'});}}};VoiceCallReport[_0xa530('0x2f')][_0xa530('0x1f')]=function(_0x5ddaa7){try{if(this['isNotNull'](_0x5ddaa7)){if(this['channels'][_0x5ddaa7[_0xa530('0x31')]]&&_0x5ddaa7[_0xa530('0x37')]!=_0xa530('0x38')){if(this[_0xa530('0x2d')](_0x5ddaa7[_0xa530('0x67')])){if(this[_0xa530('0x2d')](_0x5ddaa7['variable']['mixmonitor_filename'])){this[_0xa530('0x62')](_0x5ddaa7[_0xa530('0x31')],_0x5ddaa7[_0xa530('0x68')]);}else if(this[_0xa530('0x2d')](_0x5ddaa7['variable'][_0xa530('0x69')])){this['channels'][_0x5ddaa7['uniqueid']][_0xa530('0x59')]=_0x5ddaa7['value'];}else if(this[_0xa530('0x2d')](_0x5ddaa7[_0xa530('0x67')][_0xa530('0x6a')])){this[_0xa530('0x33')][_0x5ddaa7[_0xa530('0x31')]][_0xa530('0x6b')]=_0x5ddaa7['value'];}else if(this[_0xa530('0x2d')](_0x5ddaa7[_0xa530('0x67')][_0xa530('0x6c')])){this[_0xa530('0x33')][_0x5ddaa7['uniqueid']]['type']=_0x5ddaa7[_0xa530('0x68')];}else if(this[_0xa530('0x2d')](_0x5ddaa7['variable'][_0xa530('0x6d')])){this['channels'][_0x5ddaa7[_0xa530('0x31')]][_0xa530('0xf')]=_0x5ddaa7[_0xa530('0x68')]['split'](',')[0x0];}else if(this[_0xa530('0x2d')](_0x5ddaa7['variable'][_0xa530('0x6e')])){this[_0xa530('0x33')][_0x5ddaa7[_0xa530('0x31')]][_0xa530('0x6f')]=_0x5ddaa7['value'];}else if(this['isNotNull'](_0x5ddaa7[_0xa530('0x67')]['xmd-destination'])){this['channels'][_0x5ddaa7['uniqueid']][_0xa530('0x70')]=_0x5ddaa7['value'];}else if(this['isNotNull'](_0x5ddaa7[_0xa530('0x67')][_0xa530('0x71')])){this[_0xa530('0x33')][_0x5ddaa7['uniqueid']][_0xa530('0x72')]=_0x5ddaa7[_0xa530('0x68')];}else if(this['isNotNull'](_0x5ddaa7[_0xa530('0x67')][_0xa530('0x73')])){this[_0xa530('0x33')][_0x5ddaa7[_0xa530('0x31')]]['queue']=_0x5ddaa7[_0xa530('0x68')];}else if(this[_0xa530('0x2d')](_0x5ddaa7[_0xa530('0x67')][_0xa530('0x74')])){this['channels'][_0x5ddaa7[_0xa530('0x31')]][_0xa530('0x75')]=_0x5ddaa7[_0xa530('0x68')];}}}else if(this[_0xa530('0x2d')](_0x5ddaa7[_0xa530('0x67')][_0xa530('0x76')])){if(_0x5ddaa7[_0xa530('0x68')]){var _0x519f7c=path[_0xa530('0x77')](_0x5ddaa7[_0xa530('0x68')])[_0xa530('0x44')];this[_0xa530('0x62')](_0x519f7c,_0x5ddaa7[_0xa530('0x68')]);}}else if(this['channels'][_0x5ddaa7[_0xa530('0x32')]]){if(this[_0xa530('0x2d')](_0x5ddaa7[_0xa530('0x67')])){if(this[_0xa530('0x2d')](_0x5ddaa7[_0xa530('0x67')][_0xa530('0x74')])){this[_0xa530('0x33')][_0x5ddaa7['linkedid']]['sipcalllinkedid']=_0x5ddaa7['value'];}}}}}catch(_0x5597fc){logger['error']('[syncVarSet][VoiceCallReport]',util[_0xa530('0x47')](_0x5597fc,{'showHidden':![],'depth':null}));}};VoiceCallReport['prototype'][_0xa530('0x78')]=function(_0x4d51a8){try{if(this[_0xa530('0x2d')](_0x4d51a8)){if(this['channels'][_0x4d51a8[_0xa530('0x31')]]){var _0x372db9=moment();this['channels'][_0x4d51a8[_0xa530('0x31')]][_0xa530('0x79')]=_0x372db9[_0xa530('0x3a')](_0xa530('0x3b'));this[_0xa530('0x33')][_0x4d51a8[_0xa530('0x31')]][_0xa530('0x4c')]=_0x372db9[_0xa530('0x58')](this[_0xa530('0x33')][_0x4d51a8[_0xa530('0x31')]][_0xa530('0x39')],_0xa530('0x4e'));if(this['channels'][_0x4d51a8[_0xa530('0x31')]][_0xa530('0x55')]){this[_0xa530('0x33')][_0x4d51a8[_0xa530('0x31')]][_0xa530('0x7a')]=_0x372db9[_0xa530('0x58')](this[_0xa530('0x33')][_0x4d51a8[_0xa530('0x31')]]['answertime'],_0xa530('0x4e'));this[_0xa530('0x33')][_0x4d51a8[_0xa530('0x31')]][_0xa530('0x57')]=this['channels'][_0x4d51a8['uniqueid']][_0xa530('0x4c')]-this['channels'][_0x4d51a8[_0xa530('0x31')]][_0xa530('0x7a')];}if(_0x4d51a8['context']===_0xa530('0x3f')){if(this['agents'][_0x4d51a8[_0xa530('0x37')]['split']('-')[0x0]]){this[_0xa530('0x18')][_0x4d51a8[_0xa530('0x37')][_0xa530('0x40')]('-')[0x0]]=_[_0xa530('0x7b')](this[_0xa530('0x18')][_0x4d51a8[_0xa530('0x37')][_0xa530('0x40')]('-')[0x0]],[_0xa530('0x41')]);this['emit'](util[_0xa530('0x3a')](_0xa530('0x43'),this[_0xa530('0x18')][_0x4d51a8[_0xa530('0x37')][_0xa530('0x40')]('-')[0x0]]['name']),_0xa530('0x7c'),{'destaccountcode':this['agents'][_0x4d51a8[_0xa530('0x37')][_0xa530('0x40')]('-')[0x0]][_0xa530('0x45')]});}}ami[_0xa530('0x30')](_0xa530('0x7d'),this[_0xa530('0x33')][_0x4d51a8[_0xa530('0x31')]]);delete this['channels'][_0x4d51a8[_0xa530('0x31')]];}}}catch(_0x4ae645){logger[_0xa530('0x36')](_0xa530('0x7e'),util[_0xa530('0x47')](_0x4ae645,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xa530('0x2f')][_0xa530('0x23')]=function(_0x10a7ff){try{if(this[_0xa530('0x2d')](_0x10a7ff)){if(this[_0xa530('0x33')][_0x10a7ff[_0xa530('0x7f')]]){this[_0xa530('0x33')][_0x10a7ff[_0xa530('0x7f')]][_0xa530('0x80')]=_0x10a7ff[_0xa530('0x81')];this[_0xa530('0x33')][_0x10a7ff[_0xa530('0x7f')]][_0xa530('0x82')]=_0x10a7ff[_0xa530('0x83')];if(this[_0xa530('0x33')][_0x10a7ff[_0xa530('0x84')]]){var _0x10e353=this[_0xa530('0x33')][_0x10a7ff['secondtransfereruniqueid']];this[_0xa530('0x33')][_0x10a7ff['secondtransfereruniqueid']]=this[_0xa530('0x33')][_0x10a7ff[_0xa530('0x7f')]];this[_0xa530('0x33')][_0x10a7ff[_0xa530('0x7f')]]=_0x10e353;}}else if(this[_0xa530('0x33')][_0x10a7ff[_0xa530('0x85')]]){this[_0xa530('0x33')][_0x10a7ff[_0xa530('0x85')]][_0xa530('0x80')]=_0x10a7ff[_0xa530('0x81')];this[_0xa530('0x33')][_0x10a7ff['transfertargetuniqueid']][_0xa530('0x82')]=_0x10a7ff[_0xa530('0x83')];if(this[_0xa530('0x33')][_0x10a7ff[_0xa530('0x86')]]){var _0x10e353=this[_0xa530('0x33')][_0x10a7ff['origtransfereruniqueid']];this[_0xa530('0x33')][_0x10a7ff[_0xa530('0x86')]]=this[_0xa530('0x33')][_0x10a7ff['transfertargetuniqueid']];this['channels'][_0x10a7ff[_0xa530('0x85')]]=_0x10e353;}}}}catch(_0x25fd8b){logger[_0xa530('0x36')](_0xa530('0x87'),util[_0xa530('0x47')](_0x25fd8b,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xa530('0x2f')][_0xa530('0x24')]=function(_0x59a7f2){try{if(this[_0xa530('0x2d')](_0x59a7f2)){if(this[_0xa530('0x33')][_0x59a7f2[_0xa530('0x7f')]]){this[_0xa530('0x33')][_0x59a7f2[_0xa530('0x7f')]][_0xa530('0x80')]=_0x59a7f2[_0xa530('0x88')];this[_0xa530('0x33')][_0x59a7f2[_0xa530('0x7f')]][_0xa530('0x82')]=_0x59a7f2[_0xa530('0x89')];this[_0xa530('0x78')]({'event':_0xa530('0x8a'),'uniqueid':_0x59a7f2['transfereeuniqueid'],'context':_0x59a7f2['context'],'channel':_0x59a7f2[_0xa530('0x8b')]});}}}catch(_0x1772ec){logger['error'](_0xa530('0x8c'),util[_0xa530('0x47')](_0x1772ec,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xa530('0x2f')]['syncMusicOnHoldStart']=function(_0x57ee2a){try{if(this[_0xa530('0x2d')](_0x57ee2a)){if(this[_0xa530('0x33')][_0x57ee2a[_0xa530('0x31')]]){if(!_[_0xa530('0x66')](this[_0xa530('0x33')][_0x57ee2a[_0xa530('0x31')]][_0xa530('0x56')])){this['channels'][_0x57ee2a['uniqueid']][_0xa530('0x8d')]=moment()[_0xa530('0x3a')](_0xa530('0x3b'));}}}}catch(_0xd1a6a4){logger[_0xa530('0x36')](_0xa530('0x8e'),util[_0xa530('0x47')](_0xd1a6a4,{'showHidden':![],'depth':null}));}};VoiceCallReport['prototype'][_0xa530('0x28')]=function(_0x5ca8f2){try{if(this[_0xa530('0x2d')](_0x5ca8f2)){if(this[_0xa530('0x33')][_0x5ca8f2[_0xa530('0x31')]]){if(!_['isNil'](this[_0xa530('0x33')][_0x5ca8f2[_0xa530('0x31')]][_0xa530('0x8d')])){this[_0xa530('0x33')][_0x5ca8f2[_0xa530('0x31')]][_0xa530('0x8f')]+=moment()[_0xa530('0x90')](0x0)[_0xa530('0x58')](this[_0xa530('0x33')][_0x5ca8f2[_0xa530('0x31')]]['mohstarttime'],_0xa530('0x4e'));delete this['channels'][_0x5ca8f2['uniqueid']][_0xa530('0x8d')];}}}}catch(_0x5d56a4){logger[_0xa530('0x36')](_0xa530('0x91'),util[_0xa530('0x47')](_0x5d56a4,{'showHidden':![],'depth':null}));}};module[_0xa530('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 fa36c41..2acb28f 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 _0x76ed=['YYYY-MM-DD\x20HH:mm:ss','duration','endtime','diff','starttime','seconds','total','answertime','answered','holdtime','billableseconds','sumHoldTime','custom:dialend','voice_outbound:save','info','[DEBUG]\x20Emit\x20voice_outbound_channel:remove\x20event','stringify','voice_outbound_channel:remove','[syncHangup][VoiceDialReport]','lodash','moment','ioredis','../../../config/environment','../../../config/logger','ami','../ami','redis','localhost','socket.io-emitter','channels','outboundChannels','outbound','dialbegin','syncDialBegin','bind','dialend','varset','hangup','syncHangup','isNotNull','prototype','emit','uniqueid','format','substring','channel','lastIndexOf','omit','event','privilege','voice:outbound','error','[syncDialBegin][VoiceDialReport]','inspect','syncDialEnd','dialstatus','ANSWER','connectedlinenum','connectedlinename','lastevent','connect','custom:dialconnect','voice_outbound_channel:save','[syncDialEnd][VoiceDialReport]','syncVarSet','addVariable','keys','variable','value','outboundrouteid','isUndefined','variables','[syncVarSet][VoiceDialReport]','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitterbridged','rtpaudioqosrtt','rtpaudioqosrttbridged','sipcallid','sipuri','bridgepeer','bridgepvtcallid','membercalls','memberdynamic','memberlastcall','membername','memberpenalty','memberrealtime','includes'];(function(_0x74746c,_0x4b0a70){var _0xfdb2f6=function(_0x1daf23){while(--_0x1daf23){_0x74746c['push'](_0x74746c['shift']());}};_0xfdb2f6(++_0x4b0a70);}(_0x76ed,0x1d0));var _0xd76e=function(_0x3660fc,_0x441e0e){_0x3660fc=_0x3660fc-0x0;var _0x4cec89=_0x76ed[_0x3660fc];return _0x4cec89;};'use strict';var _=require(_0xd76e('0x0'));var moment=require(_0xd76e('0x1'));var util=require('util');var Redis=require(_0xd76e('0x2'));var config=require(_0xd76e('0x3'));var logger=require(_0xd76e('0x4'))(_0xd76e('0x5'));var ami=require(_0xd76e('0x6'));config[_0xd76e('0x7')]=_['defaults'](config['redis'],{'host':_0xd76e('0x8'),'port':0x18eb});var io=require(_0xd76e('0x9'))(new Redis(config[_0xd76e('0x7')]));function VoiceDialReport(_0xb3682c){this[_0xd76e('0xa')]=_0xb3682c[_0xd76e('0xb')];this[_0xd76e('0xc')]=_0xb3682c[_0xd76e('0xc')];this['variables']={};ami['on'](_0xd76e('0xd'),this[_0xd76e('0xe')][_0xd76e('0xf')](this));ami['on'](_0xd76e('0x10'),this['syncDialEnd'][_0xd76e('0xf')](this));ami['on'](_0xd76e('0x11'),this['syncVarSet'][_0xd76e('0xf')](this));ami['on'](_0xd76e('0x12'),this[_0xd76e('0x13')]['bind'](this));}VoiceDialReport['prototype'][_0xd76e('0x14')]=function(_0x58b1d4){return _0x58b1d4!==null&&!_['isUndefined'](_0x58b1d4);};VoiceDialReport[_0xd76e('0x15')][_0xd76e('0x16')]=function(_0x843bff,_0x11219e,_0x36013f){io['to'](_0x843bff)[_0xd76e('0x16')](_0x11219e,_0x36013f);};VoiceDialReport['prototype'][_0xd76e('0xe')]=function(_0x74ad97){try{if(this[_0xd76e('0x14')](_0x74ad97)){if(this['channels'][_0x74ad97[_0xd76e('0x17')]]){_['merge'](this[_0xd76e('0xa')][_0x74ad97['uniqueid']],{'starttime':moment()[_0xd76e('0x18')]('YYYY-MM-DD\x20HH:mm:ss'),'lastevent':'called','interface':_0x74ad97['channel'][_0xd76e('0x19')](0x0,_0x74ad97[_0xd76e('0x1a')]['lastIndexOf']('-')),'membername':_0x74ad97[_0xd76e('0x1a')][_0xd76e('0x19')](_0x74ad97[_0xd76e('0x1a')]['lastIndexOf']('/')+0x1,_0x74ad97[_0xd76e('0x1a')][_0xd76e('0x1b')]('-'))},_[_0xd76e('0x1c')](_0x74ad97,[_0xd76e('0x1d'),_0xd76e('0x1e')]));this[_0xd76e('0x16')](_0xd76e('0x1f'),'voice_outbound_channel:save',this[_0xd76e('0xa')][_0x74ad97[_0xd76e('0x17')]]);ami[_0xd76e('0x16')]('custom:dialbegin',this[_0xd76e('0xa')][_0x74ad97[_0xd76e('0x17')]]);}}}catch(_0x111f31){logger[_0xd76e('0x20')](_0xd76e('0x21'),util[_0xd76e('0x22')](_0x111f31,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0xd76e('0x15')][_0xd76e('0x23')]=function(_0x3aa0d3){try{if(this[_0xd76e('0x14')](_0x3aa0d3)){if(this[_0xd76e('0xa')][_0x3aa0d3[_0xd76e('0x17')]]){this[_0xd76e('0xa')][_0x3aa0d3[_0xd76e('0x17')]][_0xd76e('0x24')]=_0x3aa0d3[_0xd76e('0x24')];if(_0x3aa0d3[_0xd76e('0x24')]===_0xd76e('0x25')){this[_0xd76e('0xa')][_0x3aa0d3['uniqueid']]['connectedlinenum']=_0x3aa0d3[_0xd76e('0x26')];this[_0xd76e('0xa')][_0x3aa0d3[_0xd76e('0x17')]][_0xd76e('0x27')]=_0x3aa0d3[_0xd76e('0x27')];this['channels'][_0x3aa0d3[_0xd76e('0x17')]]['answertime']=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');this['channels'][_0x3aa0d3[_0xd76e('0x17')]][_0xd76e('0x28')]=_0xd76e('0x29');ami[_0xd76e('0x16')](_0xd76e('0x2a'),this[_0xd76e('0xa')][_0x3aa0d3[_0xd76e('0x17')]]);}this[_0xd76e('0x16')](_0xd76e('0x1f'),_0xd76e('0x2b'),this[_0xd76e('0xa')][_0x3aa0d3['uniqueid']]);}}}catch(_0x24e550){logger[_0xd76e('0x20')](_0xd76e('0x2c'),util[_0xd76e('0x22')](_0x24e550,{'showHidden':![],'depth':null}));}};VoiceDialReport['prototype'][_0xd76e('0x2d')]=function(_0xa8d903){try{if(this[_0xd76e('0x14')](_0xa8d903)){this[_0xd76e('0x2e')](_0xa8d903[_0xd76e('0x17')],_[_0xd76e('0x2f')](_0xa8d903[_0xd76e('0x30')])[0x0],_0xa8d903[_0xd76e('0x31')]);if(this[_0xd76e('0x14')](_0xa8d903[_0xd76e('0x30')])&&this[_0xd76e('0x14')](_0xa8d903[_0xd76e('0x30')][_0xd76e('0x32')])){if(_[_0xd76e('0x33')](this['channels'][_0xa8d903[_0xd76e('0x17')]])){this[_0xd76e('0xa')][_0xa8d903[_0xd76e('0x17')]]={'routeId':_0xa8d903['value'],'variables':this[_0xd76e('0x34')][_0xa8d903['uniqueid']]};this[_0xd76e('0x16')](_0xd76e('0x1f'),_0xd76e('0x2b'),this[_0xd76e('0xa')][_0xa8d903['uniqueid']]);}}}}catch(_0x55c23d){logger[_0xd76e('0x20')](_0xd76e('0x35'),util[_0xd76e('0x22')](_0x55c23d,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0xd76e('0x15')][_0xd76e('0x2e')]=function(_0x475dc7,_0x46a50b,_0x394994){var _0x5d9715=[_0xd76e('0x36'),_0xd76e('0x37'),'rtpaudioqosjitter',_0xd76e('0x38'),'rtpaudioqosloss','rtpaudioqoslossbridged',_0xd76e('0x39'),_0xd76e('0x3a'),_0xd76e('0x3b'),_0xd76e('0x3c'),_0xd76e('0x3d'),_0xd76e('0x3e'),_0xd76e('0x3f'),_0xd76e('0x40'),'memberinterface',_0xd76e('0x41'),_0xd76e('0x42'),_0xd76e('0x43'),_0xd76e('0x44')];if(!_['isNil'](_0x46a50b)&&!_[_0xd76e('0x45')](_0x5d9715,_0x46a50b)){if(_[_0xd76e('0x33')](this['variables'][_0x475dc7])){this[_0xd76e('0x34')][_0x475dc7]={};}this[_0xd76e('0x34')][_0x475dc7][_0x46a50b]=_0x394994;}};VoiceDialReport[_0xd76e('0x15')][_0xd76e('0x13')]=function(_0x106b85){try{if(this['isNotNull'](_0x106b85)){if(this[_0xd76e('0xa')][_0x106b85[_0xd76e('0x17')]]){this[_0xd76e('0xa')][_0x106b85[_0xd76e('0x17')]]['endtime']=moment()[_0xd76e('0x18')](_0xd76e('0x46'));this[_0xd76e('0xa')][_0x106b85[_0xd76e('0x17')]][_0xd76e('0x47')]=moment(this['channels'][_0x106b85[_0xd76e('0x17')]][_0xd76e('0x48')])[_0xd76e('0x49')](this[_0xd76e('0xa')][_0x106b85[_0xd76e('0x17')]][_0xd76e('0x4a')],_0xd76e('0x4b'));this[_0xd76e('0xa')][_0x106b85['uniqueid']][_0xd76e('0x28')]='complete';this['outbound'][_0xd76e('0x4c')]+=0x1;if(this[_0xd76e('0xa')][_0x106b85[_0xd76e('0x17')]][_0xd76e('0x4d')]){this[_0xd76e('0xc')][_0xd76e('0x4e')]+=0x1;this['channels'][_0x106b85['uniqueid']][_0xd76e('0x4f')]=moment(this[_0xd76e('0xa')][_0x106b85[_0xd76e('0x17')]][_0xd76e('0x4d')])[_0xd76e('0x49')](this[_0xd76e('0xa')][_0x106b85[_0xd76e('0x17')]][_0xd76e('0x4a')],_0xd76e('0x4b'));this[_0xd76e('0xa')][_0x106b85['uniqueid']][_0xd76e('0x50')]=moment(this[_0xd76e('0xa')][_0x106b85[_0xd76e('0x17')]][_0xd76e('0x48')])['diff'](this[_0xd76e('0xa')][_0x106b85[_0xd76e('0x17')]][_0xd76e('0x4d')],_0xd76e('0x4b'));this[_0xd76e('0xc')][_0xd76e('0x51')]+=this[_0xd76e('0xa')][_0x106b85[_0xd76e('0x17')]][_0xd76e('0x4f')]||0x0;this[_0xd76e('0xc')]['sumBillable']+=this[_0xd76e('0xa')][_0x106b85[_0xd76e('0x17')]][_0xd76e('0x50')];}this[_0xd76e('0xc')]['sumDuration']+=this[_0xd76e('0xa')][_0x106b85[_0xd76e('0x17')]][_0xd76e('0x47')];ami[_0xd76e('0x16')]('custom:voiceDialReport',this['channels'][_0x106b85['uniqueid']]);ami['emit'](_0xd76e('0x52'),this[_0xd76e('0xa')][_0x106b85['uniqueid']]);this[_0xd76e('0x16')](_0xd76e('0x1f'),_0xd76e('0x53'),this[_0xd76e('0xc')]);logger[_0xd76e('0x54')](_0xd76e('0x55'),JSON[_0xd76e('0x56')](this[_0xd76e('0xa')][_0x106b85[_0xd76e('0x17')]]));this[_0xd76e('0x16')](_0xd76e('0x1f'),_0xd76e('0x57'),this[_0xd76e('0xa')][_0x106b85[_0xd76e('0x17')]]);delete this[_0xd76e('0xa')][_0x106b85['uniqueid']];}if(this['variables'][_0x106b85[_0xd76e('0x17')]]){delete this[_0xd76e('0x34')][_0x106b85[_0xd76e('0x17')]];}}}catch(_0x181ccd){logger['error'](_0xd76e('0x58'),util['inspect'](_0x181ccd,{'showHidden':![],'depth':null}));}};module['exports']=VoiceDialReport; \ No newline at end of file +var _0xe5ef=['addVariable','value','variable','outboundrouteid','[syncVarSet][VoiceDialReport]','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrttbridged','sipcallid','sipuri','bridgepeer','bridgepvtcallid','membercalls','memberdynamic','memberinterface','memberlastcall','memberpenalty','memberrealtime','isNil','includes','endtime','duration','diff','starttime','seconds','lastevent','complete','total','answertime','answered','holdtime','billableseconds','sumBillable','custom:voiceDialReport','custom:dialend','voice_outbound:save','info','[DEBUG]\x20Emit\x20voice_outbound_channel:remove\x20event','voice_outbound_channel:remove','[syncHangup][VoiceDialReport]','exports','lodash','moment','util','ioredis','../../../config/logger','ami','../ami','redis','localhost','outbound','variables','syncDialBegin','dialend','syncDialEnd','varset','syncVarSet','bind','hangup','syncHangup','prototype','isUndefined','emit','uniqueid','merge','channels','format','called','channel','substring','lastIndexOf','omit','event','privilege','voice:outbound','voice_outbound_channel:save','error','inspect','isNotNull','dialstatus','ANSWER','connectedlinenum','connectedlinename','YYYY-MM-DD\x20HH:mm:ss','connect','custom:dialconnect','[syncDialEnd][VoiceDialReport]'];(function(_0x4128ff,_0x2ac10f){var _0x316caf=function(_0x537a15){while(--_0x537a15){_0x4128ff['push'](_0x4128ff['shift']());}};_0x316caf(++_0x2ac10f);}(_0xe5ef,0x13a));var _0xfe5e=function(_0x306767,_0x5f0270){_0x306767=_0x306767-0x0;var _0x521324=_0xe5ef[_0x306767];return _0x521324;};'use strict';var _=require(_0xfe5e('0x0'));var moment=require(_0xfe5e('0x1'));var util=require(_0xfe5e('0x2'));var Redis=require(_0xfe5e('0x3'));var config=require('../../../config/environment');var logger=require(_0xfe5e('0x4'))(_0xfe5e('0x5'));var ami=require(_0xfe5e('0x6'));config['redis']=_['defaults'](config[_0xfe5e('0x7')],{'host':_0xfe5e('0x8'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xfe5e('0x7')]));function VoiceDialReport(_0xd0aaac){this['channels']=_0xd0aaac['outboundChannels'];this[_0xfe5e('0x9')]=_0xd0aaac[_0xfe5e('0x9')];this[_0xfe5e('0xa')]={};ami['on']('dialbegin',this[_0xfe5e('0xb')]['bind'](this));ami['on'](_0xfe5e('0xc'),this[_0xfe5e('0xd')]['bind'](this));ami['on'](_0xfe5e('0xe'),this[_0xfe5e('0xf')][_0xfe5e('0x10')](this));ami['on'](_0xfe5e('0x11'),this[_0xfe5e('0x12')][_0xfe5e('0x10')](this));}VoiceDialReport[_0xfe5e('0x13')]['isNotNull']=function(_0x3c736c){return _0x3c736c!==null&&!_[_0xfe5e('0x14')](_0x3c736c);};VoiceDialReport[_0xfe5e('0x13')][_0xfe5e('0x15')]=function(_0x3153dd,_0x380ae4,_0x42dfcb){io['to'](_0x3153dd)[_0xfe5e('0x15')](_0x380ae4,_0x42dfcb);};VoiceDialReport[_0xfe5e('0x13')]['syncDialBegin']=function(_0x351bbf){try{if(this['isNotNull'](_0x351bbf)){if(this['channels'][_0x351bbf[_0xfe5e('0x16')]]){_[_0xfe5e('0x17')](this[_0xfe5e('0x18')][_0x351bbf['uniqueid']],{'starttime':moment()[_0xfe5e('0x19')]('YYYY-MM-DD\x20HH:mm:ss'),'lastevent':_0xfe5e('0x1a'),'interface':_0x351bbf[_0xfe5e('0x1b')][_0xfe5e('0x1c')](0x0,_0x351bbf[_0xfe5e('0x1b')][_0xfe5e('0x1d')]('-')),'membername':_0x351bbf[_0xfe5e('0x1b')][_0xfe5e('0x1c')](_0x351bbf['channel'][_0xfe5e('0x1d')]('/')+0x1,_0x351bbf[_0xfe5e('0x1b')]['lastIndexOf']('-'))},_[_0xfe5e('0x1e')](_0x351bbf,[_0xfe5e('0x1f'),_0xfe5e('0x20')]));this[_0xfe5e('0x15')](_0xfe5e('0x21'),_0xfe5e('0x22'),this['channels'][_0x351bbf[_0xfe5e('0x16')]]);ami[_0xfe5e('0x15')]('custom:dialbegin',this[_0xfe5e('0x18')][_0x351bbf['uniqueid']]);}}}catch(_0x1dfe30){logger[_0xfe5e('0x23')]('[syncDialBegin][VoiceDialReport]',util[_0xfe5e('0x24')](_0x1dfe30,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0xfe5e('0x13')][_0xfe5e('0xd')]=function(_0xcaa88a){try{if(this[_0xfe5e('0x25')](_0xcaa88a)){if(this['channels'][_0xcaa88a[_0xfe5e('0x16')]]){this[_0xfe5e('0x18')][_0xcaa88a[_0xfe5e('0x16')]][_0xfe5e('0x26')]=_0xcaa88a[_0xfe5e('0x26')];if(_0xcaa88a[_0xfe5e('0x26')]===_0xfe5e('0x27')){this['channels'][_0xcaa88a[_0xfe5e('0x16')]][_0xfe5e('0x28')]=_0xcaa88a[_0xfe5e('0x28')];this[_0xfe5e('0x18')][_0xcaa88a[_0xfe5e('0x16')]][_0xfe5e('0x29')]=_0xcaa88a['connectedlinename'];this['channels'][_0xcaa88a[_0xfe5e('0x16')]]['answertime']=moment()[_0xfe5e('0x19')](_0xfe5e('0x2a'));this[_0xfe5e('0x18')][_0xcaa88a[_0xfe5e('0x16')]]['lastevent']=_0xfe5e('0x2b');ami[_0xfe5e('0x15')](_0xfe5e('0x2c'),this[_0xfe5e('0x18')][_0xcaa88a[_0xfe5e('0x16')]]);}this[_0xfe5e('0x15')](_0xfe5e('0x21'),_0xfe5e('0x22'),this['channels'][_0xcaa88a[_0xfe5e('0x16')]]);}}}catch(_0x96051f){logger[_0xfe5e('0x23')](_0xfe5e('0x2d'),util[_0xfe5e('0x24')](_0x96051f,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0xfe5e('0x13')][_0xfe5e('0xf')]=function(_0x3800c3){try{if(this['isNotNull'](_0x3800c3)){this[_0xfe5e('0x2e')](_0x3800c3[_0xfe5e('0x16')],_['keys'](_0x3800c3['variable'])[0x0],_0x3800c3[_0xfe5e('0x2f')]);if(this[_0xfe5e('0x25')](_0x3800c3[_0xfe5e('0x30')])&&this[_0xfe5e('0x25')](_0x3800c3[_0xfe5e('0x30')][_0xfe5e('0x31')])){if(_['isUndefined'](this['channels'][_0x3800c3['uniqueid']])){this['channels'][_0x3800c3['uniqueid']]={'routeId':_0x3800c3[_0xfe5e('0x2f')],'variables':this[_0xfe5e('0xa')][_0x3800c3[_0xfe5e('0x16')]]};this[_0xfe5e('0x15')](_0xfe5e('0x21'),'voice_outbound_channel:save',this[_0xfe5e('0x18')][_0x3800c3[_0xfe5e('0x16')]]);}}}}catch(_0x13601e){logger[_0xfe5e('0x23')](_0xfe5e('0x32'),util[_0xfe5e('0x24')](_0x13601e,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0xfe5e('0x13')][_0xfe5e('0x2e')]=function(_0x1dffac,_0x4c3477,_0x16983b){var _0x5ea733=[_0xfe5e('0x33'),_0xfe5e('0x34'),_0xfe5e('0x35'),'rtpaudioqosjitterbridged',_0xfe5e('0x36'),_0xfe5e('0x37'),'rtpaudioqosrtt',_0xfe5e('0x38'),_0xfe5e('0x39'),_0xfe5e('0x3a'),_0xfe5e('0x3b'),_0xfe5e('0x3c'),_0xfe5e('0x3d'),_0xfe5e('0x3e'),_0xfe5e('0x3f'),_0xfe5e('0x40'),'membername',_0xfe5e('0x41'),_0xfe5e('0x42')];if(!_[_0xfe5e('0x43')](_0x4c3477)&&!_[_0xfe5e('0x44')](_0x5ea733,_0x4c3477)){if(_['isUndefined'](this[_0xfe5e('0xa')][_0x1dffac])){this[_0xfe5e('0xa')][_0x1dffac]={};}this[_0xfe5e('0xa')][_0x1dffac][_0x4c3477]=_0x16983b;}};VoiceDialReport[_0xfe5e('0x13')][_0xfe5e('0x12')]=function(_0x53e698){try{if(this['isNotNull'](_0x53e698)){if(this[_0xfe5e('0x18')][_0x53e698[_0xfe5e('0x16')]]){this['channels'][_0x53e698[_0xfe5e('0x16')]][_0xfe5e('0x45')]=moment()[_0xfe5e('0x19')](_0xfe5e('0x2a'));this[_0xfe5e('0x18')][_0x53e698[_0xfe5e('0x16')]][_0xfe5e('0x46')]=moment(this[_0xfe5e('0x18')][_0x53e698[_0xfe5e('0x16')]][_0xfe5e('0x45')])[_0xfe5e('0x47')](this[_0xfe5e('0x18')][_0x53e698[_0xfe5e('0x16')]][_0xfe5e('0x48')],_0xfe5e('0x49'));this[_0xfe5e('0x18')][_0x53e698[_0xfe5e('0x16')]][_0xfe5e('0x4a')]=_0xfe5e('0x4b');this[_0xfe5e('0x9')][_0xfe5e('0x4c')]+=0x1;if(this[_0xfe5e('0x18')][_0x53e698[_0xfe5e('0x16')]][_0xfe5e('0x4d')]){this[_0xfe5e('0x9')][_0xfe5e('0x4e')]+=0x1;this['channels'][_0x53e698[_0xfe5e('0x16')]][_0xfe5e('0x4f')]=moment(this[_0xfe5e('0x18')][_0x53e698['uniqueid']][_0xfe5e('0x4d')])[_0xfe5e('0x47')](this['channels'][_0x53e698[_0xfe5e('0x16')]][_0xfe5e('0x48')],'seconds');this[_0xfe5e('0x18')][_0x53e698['uniqueid']][_0xfe5e('0x50')]=moment(this[_0xfe5e('0x18')][_0x53e698[_0xfe5e('0x16')]]['endtime'])[_0xfe5e('0x47')](this[_0xfe5e('0x18')][_0x53e698[_0xfe5e('0x16')]]['answertime'],_0xfe5e('0x49'));this['outbound']['sumHoldTime']+=this[_0xfe5e('0x18')][_0x53e698[_0xfe5e('0x16')]]['holdtime']||0x0;this['outbound'][_0xfe5e('0x51')]+=this['channels'][_0x53e698['uniqueid']][_0xfe5e('0x50')];}this[_0xfe5e('0x9')]['sumDuration']+=this[_0xfe5e('0x18')][_0x53e698['uniqueid']][_0xfe5e('0x46')];ami[_0xfe5e('0x15')](_0xfe5e('0x52'),this[_0xfe5e('0x18')][_0x53e698[_0xfe5e('0x16')]]);ami[_0xfe5e('0x15')](_0xfe5e('0x53'),this['channels'][_0x53e698[_0xfe5e('0x16')]]);this[_0xfe5e('0x15')]('voice:outbound',_0xfe5e('0x54'),this['outbound']);logger[_0xfe5e('0x55')](_0xfe5e('0x56'),JSON['stringify'](this[_0xfe5e('0x18')][_0x53e698['uniqueid']]));this[_0xfe5e('0x15')](_0xfe5e('0x21'),_0xfe5e('0x57'),this[_0xfe5e('0x18')][_0x53e698[_0xfe5e('0x16')]]);delete this[_0xfe5e('0x18')][_0x53e698[_0xfe5e('0x16')]];}if(this[_0xfe5e('0xa')][_0x53e698[_0xfe5e('0x16')]]){delete this[_0xfe5e('0xa')][_0x53e698['uniqueid']];}}}catch(_0x45daf6){logger['error'](_0xfe5e('0x58'),util[_0xfe5e('0x24')](_0x45daf6,{'showHidden':![],'depth':null}));}};module[_0xfe5e('0x59')]=VoiceDialReport; \ No newline at end of file diff --git a/server/services/ami/report/voiceQueueReport.js b/server/services/ami/report/voiceQueueReport.js index f1e30cd..7014896 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 _0x5123=['[queuesummary]','isNotNull','queue','countBy','toNumber','callers','loggedin','available','custom:queuesummary','[syncQueueSummary][VoiceQueueReport]','inspect','uniqueid','queuecallerjoinAt','YYYY-MM-DD\x20HH:mm:ss','position','count','merge','keys','push','[syncQueueCallerJoin][VoiceQueueReport]','last','queuecallercomplete','queuecallercompleteAt','holdtime','originalposition','queuecallerabandonAt','lastAssignedTo','[syncQueueCallerAbandon][VoiceQueueReport]','queuecallerleaveAt','connectedlinenum','connectedlinename','[syncQueueCallerLeave][VoiceQueueReport]','queuecallerexitreason','[syncAgentConnect][VoiceQueueReport]','queuecallerabandon','queuecallerexit','queuecallerexitAt','transfer','reason','startsWith','toLowerCase','local/','add','seconds','FORWARDTRANSFER','transfertype','FORWARD','destexten','transferuniqueid','linkedid','COMPLETEDBY','variable','value','CONTINUE','lastevent','timeout','queueposition','EXITWITHKEY','[syncVarSet][VoiceQueueReport]','rtpaudioqos','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrtt','rtpaudioqosrttbridged','sipcallid','bridgepeer','bridgepvtcallid','membercalls','memberdynamic','memberinterface','memberpenalty','memberrealtime','length','milliseconds','diff','custom:queuecallerunmanaged','custom:voiceQueueReport','[syncHangup][VoiceQueueReport]','syncAttendedTransfer','transfereeuniqueid','transferexten','secondtransfereruniqueid','ATTENDEDTRANSFER','ATTENDED','transfertargetuniqueid','origtransfererexten','origtransfereruniqueid','[syncAttendedTransfer][VoiceQueueReport]','BLINDTRANSFER','BLIND','extension','syncHangup','BlindTransfer','context','transfererchannel','[syncBlindTransfer][VoiceQueueReport]','mohstarttime','[syncMusicOnHoldStart][VoiceQueueReport]','mohtime','[syncMusicOnHoldStop][VoiceQueueReport]','exports','bluebird','md5','ioredis','../../../config/environment','../../../config/logger','ami','../model/queueReport','defaults','redis','localhost','socket.io-emitter','prototype','enqueue','tail','sequence','queueReports','agents','channels','queueChannels','voiceQueues','campaigns','syncQueueSummary','bind','queuesummarycomplete','syncQueueSummaryComplete','syncQueueCallerJoin','syncQueueCallerAbandon','queuecallerleave','syncQueueCallerLeave','agentcomplete','syncAgentComplete','syncAgentConnect','varset','syncVarSet','syncFullyBooted','musiconholdstart','syncMusicOnHoldStart','musiconholdstop','syncMusicOnHoldStop','blindtransfer','syncBlindTransfer','loopQueueSummary','loopQueueShow','isEmpty','hasOwnProperty','originated','talking','waiting','unlockRR','switch','isNil','Action','status','channel','catch','No\x20such\x20channel','error','[voiceQueueReport][checkChannel]','variables','clearQueueReport','emitVoiceQueueChannelRemove','emit','emitVoiceQueueChannelSave','format','voice:queue:%s','name','voice_queue_channel:save','stringify','emitVoiceQueueSummary','type','inbound','strategy','answered','loggedIn','sumBillable','sumDuration','sumHoldTime','total','unmanaged','abandoned','Trunk','active','callerid','Interval','isUndefined','clearZombieChannels','queues','[queues]','queuesummary','then','flagQueueSummary'];(function(_0x19ad0f,_0x3ac423){var _0x125108=function(_0x5ee547){while(--_0x5ee547){_0x19ad0f['push'](_0x19ad0f['shift']());}};_0x125108(++_0x3ac423);}(_0x5123,0x1eb));var _0x3512=function(_0x2a2f36,_0x49405b){_0x2a2f36=_0x2a2f36-0x0;var _0x21e08e=_0x5123[_0x2a2f36];return _0x21e08e;};'use strict';var _=require('lodash');var moment=require('moment');var BPromise=require(_0x3512('0x0'));var util=require('util');var md5=require(_0x3512('0x1'));var Redis=require(_0x3512('0x2'));var config=require(_0x3512('0x3'));var logger=require(_0x3512('0x4'))(_0x3512('0x5'));var ami=require('../ami');var QueueReport=require(_0x3512('0x6'));config['redis']=_[_0x3512('0x7')](config[_0x3512('0x8')],{'host':_0x3512('0x9'),'port':0x18eb});var io=require(_0x3512('0xa'))(new Redis(config[_0x3512('0x8')]));var Sequence=function(){};Sequence[_0x3512('0xb')][_0x3512('0xc')]=function(_0x4395f4){this[_0x3512('0xd')]=this[_0x3512('0xd')]?this[_0x3512('0xd')]['finally'](_0x4395f4):_0x4395f4();};function VoiceQueueReport(_0x7c9420){this[_0x3512('0xe')]=new Sequence();this[_0x3512('0xf')]={};this[_0x3512('0x10')]=_0x7c9420[_0x3512('0x10')];this[_0x3512('0x11')]=_0x7c9420[_0x3512('0x12')];this['voiceQueues']=_0x7c9420[_0x3512('0x13')];this['flagQueueSummary']=!![];this[_0x3512('0x14')]=_0x7c9420[_0x3512('0x14')];this['variables']={};ami['on']('queuesummary',this[_0x3512('0x15')][_0x3512('0x16')](this));ami['on'](_0x3512('0x17'),this[_0x3512('0x18')][_0x3512('0x16')](this));ami['on']('queuecallerjoin',this[_0x3512('0x19')][_0x3512('0x16')](this));ami['on']('queuecallerabandon',this[_0x3512('0x1a')]['bind'](this));ami['on'](_0x3512('0x1b'),this[_0x3512('0x1c')][_0x3512('0x16')](this));ami['on'](_0x3512('0x1d'),this[_0x3512('0x1e')]['bind'](this));ami['on']('agentconnect',this[_0x3512('0x1f')][_0x3512('0x16')](this));ami['on'](_0x3512('0x20'),this[_0x3512('0x21')]['bind'](this));ami['on']('hangup',this['syncHangup'][_0x3512('0x16')](this));ami['on']('fullybooted',this[_0x3512('0x22')][_0x3512('0x16')](this));ami['on'](_0x3512('0x23'),this[_0x3512('0x24')][_0x3512('0x16')](this));ami['on'](_0x3512('0x25'),this[_0x3512('0x26')][_0x3512('0x16')](this));ami['on']('attendedtransfer',this['syncAttendedTransfer']['bind'](this));ami['on'](_0x3512('0x27'),this[_0x3512('0x28')][_0x3512('0x16')](this));this[_0x3512('0x29')]();this[_0x3512('0x2a')]();}function isNotNull(_0x1a4355){return _0x1a4355!==null&&!_['isUndefined'](_0x1a4355);}function clearChannels(_0x499a75){if(!_[_0x3512('0x2b')](_0x499a75)){for(var _0x332696 in _0x499a75){if(_0x499a75['hasOwnProperty'](_0x332696)){delete _0x499a75[_0x332696];}}}}function clearCampaigns(_0x1f9d7b){if(!_[_0x3512('0x2b')](_0x1f9d7b)){for(var _0x16709d in _0x1f9d7b){if(_0x1f9d7b[_0x3512('0x2c')](_0x16709d)){_0x1f9d7b[_0x16709d][_0x3512('0x2d')]=0x0;}}}}function clearVoiceQueues(_0x2dfaaa){if(!_['isEmpty'](_0x2dfaaa)){for(var _0x510a5d in _0x2dfaaa){if(_0x2dfaaa[_0x3512('0x2c')](_0x510a5d)){_0x2dfaaa[_0x510a5d]['originated']=0x0;_0x2dfaaa[_0x510a5d][_0x3512('0x2e')]=0x0;_0x2dfaaa[_0x510a5d]['pTalking']=0x0;_0x2dfaaa[_0x510a5d][_0x3512('0x2f')]=0x0;_0x2dfaaa[_0x510a5d]['queueStatusComplete']=!![];}}}}function clearAgentBooked(_0x2fb8a4){if(!_[_0x3512('0x2b')](_0x2fb8a4)){for(var _0x195282 in _0x2fb8a4){if(_0x2fb8a4['hasOwnProperty'](_0x195282)){_0x2fb8a4[_0x195282][_0x3512('0x30')]=!![];}}}}VoiceQueueReport[_0x3512('0xb')]['clearZombieChannels']=function(){var _0x5c4d8a=this;for(var _0x3432fc in this[_0x3512('0x11')]){if(this[_0x3512('0x11')]['hasOwnProperty'](_0x3432fc)&&!this['channels'][_0x3432fc][_0x3512('0x31')]){this['sequence'][_0x3512('0xc')](function(){if(!_[_0x3512('0x32')](_0x5c4d8a['channels'][_0x3432fc])){return ami[_0x3512('0x33')]({'action':_0x3512('0x34'),'channel':_0x5c4d8a[_0x3512('0x11')][_0x3432fc][_0x3512('0x35')]})[_0x3512('0x36')](function(_0x3a98e2){if(_0x3a98e2['message']===_0x3512('0x37')){setTimeout(function(){if(_0x5c4d8a[_0x3512('0x11')][_0x3432fc]){delete _0x5c4d8a[_0x3512('0x11')][_0x3432fc];logger[_0x3512('0x38')](_0x3512('0x39'),_0x3432fc);}if(_0x5c4d8a[_0x3512('0xf')][_0x3432fc]){delete _0x5c4d8a[_0x3512('0xf')][_0x3432fc];logger[_0x3512('0x38')]('[voiceQueueReport][checkQueueReport]',_0x3432fc);}if(_0x5c4d8a[_0x3512('0x3a')][_0x3432fc]){delete _0x5c4d8a['variables'][_0x3432fc];logger[_0x3512('0x38')]('[voiceQueueReport][checkVariables]',_0x3432fc);}},0x1f40);}});}});}}};VoiceQueueReport[_0x3512('0xb')][_0x3512('0x22')]=function(){logger[_0x3512('0x38')]('[FullyBooted]\x20clear\x20realtime');clearChannels(this[_0x3512('0x11')]);this['clearQueueReport'](this[_0x3512('0xf')]);clearAgentBooked(this[_0x3512('0x10')]);clearVoiceQueues(this[_0x3512('0x13')]);clearCampaigns(this[_0x3512('0x14')]);};VoiceQueueReport['prototype'][_0x3512('0x3b')]=function(_0x4e0700){var _0x28a5e7=this;if(!_[_0x3512('0x2b')](_0x4e0700)){for(var _0x43848d in _0x4e0700){if(_0x4e0700[_0x3512('0x2c')](_0x43848d)){_0x28a5e7[_0x3512('0x3c')](_0x4e0700[_0x43848d]);delete _0x4e0700[_0x43848d];}}}};function loggerCatch(_0x2edea3){return function(_0x2d22d0){logger[_0x3512('0x38')](_0x2edea3,util['inspect'](_0x2d22d0,{'showHidden':![],'depth':null}));};}VoiceQueueReport[_0x3512('0xb')][_0x3512('0x3d')]=function(_0x21f149,_0x38e9c2,_0x99e2cc){io['to'](_0x21f149)[_0x3512('0x3d')](_0x38e9c2,_0x99e2cc);};VoiceQueueReport[_0x3512('0xb')][_0x3512('0x3e')]=function(_0xadbc3c){this[_0x3512('0x3d')](util[_0x3512('0x3f')](_0x3512('0x40'),_0xadbc3c[_0x3512('0x41')]),_0x3512('0x42'),_0xadbc3c);};VoiceQueueReport[_0x3512('0xb')][_0x3512('0x3c')]=function(_0x565953){logger['info']('[DEBUG]\x20Emit\x20voice_queue_channel:remove\x20event',JSON[_0x3512('0x43')](_0x565953));this['emit'](util[_0x3512('0x3f')](_0x3512('0x40'),_0x565953[_0x3512('0x41')]),'voice_queue_channel:remove',_0x565953);};VoiceQueueReport[_0x3512('0xb')][_0x3512('0x44')]=function(_0x52457d){if(_0x52457d[_0x3512('0x45')]===_0x3512('0x46')){var _0x41a102={'id':_0x52457d['id'],'name':_0x52457d[_0x3512('0x41')],'strategy':_0x52457d[_0x3512('0x47')],'answered':_0x52457d[_0x3512('0x48')],'available':_0x52457d['available'],'loggedIn':_0x52457d[_0x3512('0x49')],'pTalking':_0x52457d['pTalking'],'sumBillable':_0x52457d[_0x3512('0x4a')],'sumDuration':_0x52457d[_0x3512('0x4b')],'sumHoldTime':_0x52457d[_0x3512('0x4c')]||0x0,'talking':_0x52457d['talking'],'total':_0x52457d[_0x3512('0x4d')],'type':_0x52457d[_0x3512('0x45')],'unmanaged':_0x52457d[_0x3512('0x4e')],'abandoned':_0x52457d[_0x3512('0x4f')],'waiting':_0x52457d[_0x3512('0x2f')]};if(_0x52457d[_0x3512('0x50')]){_0x41a102[_0x3512('0x50')]={'id':_0x52457d[_0x3512('0x50')]['id'],'name':_0x52457d[_0x3512('0x50')][_0x3512('0x41')],'active':_0x52457d[_0x3512('0x50')][_0x3512('0x51')],'callerid':_0x52457d[_0x3512('0x50')][_0x3512('0x52')]};}if(_0x52457d[_0x3512('0x53')]){_0x41a102['Interval']={'id':_0x52457d[_0x3512('0x53')]['id'],'name':_0x52457d[_0x3512('0x53')][_0x3512('0x41')]};}var _0x224c12=md5(JSON['stringify'](_0x41a102));if(_0x52457d[_0x3512('0x1')]!==_0x224c12){_0x52457d[_0x3512('0x1')]=_0x224c12;this['emit'](util[_0x3512('0x3f')](_0x3512('0x40'),_0x41a102[_0x3512('0x41')]),'voice_queue:save',_0x41a102);}}};VoiceQueueReport[_0x3512('0xb')]['isNotNull']=function(_0x440805){return _0x440805!==null&&!_[_0x3512('0x54')](_0x440805);};VoiceQueueReport['prototype'][_0x3512('0x2a')]=function(){var _0x55b94d=this;setInterval(function(){_0x55b94d[_0x3512('0x55')]();ami[_0x3512('0x33')]({'action':_0x3512('0x56')})['catch'](loggerCatch(_0x3512('0x57')));},0x2710);};VoiceQueueReport['prototype'][_0x3512('0x29')]=function(){var _0x3a2811=this;setInterval(function(){if(_0x3a2811['flagQueueSummary']){return ami[_0x3512('0x33')]({'action':_0x3512('0x58')})[_0x3512('0x59')](function(_0x2e5e60){_0x3a2811[_0x3512('0x5a')]=![];})[_0x3512('0x36')](loggerCatch(_0x3512('0x5b')));}},0x3e8);};VoiceQueueReport['prototype'][_0x3512('0x15')]=function(_0x38a3a7){try{if(this[_0x3512('0x5c')](_0x38a3a7)&&this[_0x3512('0x5c')](_0x38a3a7['queue'])){if(this[_0x3512('0x13')][_0x38a3a7[_0x3512('0x5d')]]){var _0x4ab8be=_[_0x3512('0x5e')](this[_0x3512('0x11')],_0x3512('0x5d'))[_0x38a3a7[_0x3512('0x5d')]]||0x0;var _0x4ca175=_0x4ab8be-_0x38a3a7['callers'];if(this['voiceQueues'][_0x38a3a7[_0x3512('0x5d')]][_0x3512('0x2f')]!==_[_0x3512('0x5f')](_0x38a3a7[_0x3512('0x60')])||this[_0x3512('0x13')][_0x38a3a7[_0x3512('0x5d')]][_0x3512('0x49')]!==_[_0x3512('0x5f')](_0x38a3a7[_0x3512('0x61')])||this[_0x3512('0x13')][_0x38a3a7['queue']][_0x3512('0x62')]!==_[_0x3512('0x5f')](_0x38a3a7['available'])||this[_0x3512('0x13')][_0x38a3a7[_0x3512('0x5d')]][_0x3512('0x2e')]!==_0x4ca175){this[_0x3512('0x13')][_0x38a3a7[_0x3512('0x5d')]][_0x3512('0x2f')]=_['toNumber'](_0x38a3a7[_0x3512('0x60')]);this[_0x3512('0x13')][_0x38a3a7['queue']][_0x3512('0x49')]=_['toNumber'](_0x38a3a7[_0x3512('0x61')]);this['voiceQueues'][_0x38a3a7[_0x3512('0x5d')]][_0x3512('0x62')]=_[_0x3512('0x5f')](_0x38a3a7[_0x3512('0x62')]);this[_0x3512('0x13')][_0x38a3a7[_0x3512('0x5d')]]['talking']=_0x4ca175>0x0?_0x4ca175:0x0;this[_0x3512('0x13')][_0x38a3a7[_0x3512('0x5d')]][_0x3512('0x2e')]=this['voiceQueues'][_0x38a3a7[_0x3512('0x5d')]][_0x3512('0x2e')]>_[_0x3512('0x5f')](_0x38a3a7['loggedin'])?_[_0x3512('0x5f')](_0x38a3a7[_0x3512('0x61')]):this[_0x3512('0x13')][_0x38a3a7[_0x3512('0x5d')]][_0x3512('0x2e')];this[_0x3512('0x44')](this['voiceQueues'][_0x38a3a7['queue']]);}ami[_0x3512('0x3d')](_0x3512('0x63'),this[_0x3512('0x13')][_0x38a3a7[_0x3512('0x5d')]]);}}}catch(_0x5ee759){logger[_0x3512('0x38')](_0x3512('0x64'),util[_0x3512('0x65')](_0x5ee759,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x3512('0xb')]['syncQueueSummaryComplete']=function(_0x2f75f2){this[_0x3512('0x5a')]=!![];};VoiceQueueReport[_0x3512('0xb')]['syncNewExten']=function(_0x5db312){};VoiceQueueReport[_0x3512('0xb')][_0x3512('0x19')]=function(_0x46e073){try{if(this['isNotNull'](_0x46e073)){if(_[_0x3512('0x54')](this['queueReports'][_0x46e073[_0x3512('0x66')]])){this[_0x3512('0xf')][_0x46e073[_0x3512('0x66')]]=[];this['channels'][_0x46e073[_0x3512('0x66')]]={};}var _0xa285b9=new QueueReport();_0xa285b9['name']=_0x46e073[_0x3512('0x5d')];_0xa285b9[_0x3512('0x45')]=this[_0x3512('0x13')][_0xa285b9[_0x3512('0x41')]]&&this[_0x3512('0x13')][_0xa285b9['name']][_0x3512('0x45')]?this[_0x3512('0x13')][_0xa285b9[_0x3512('0x41')]][_0x3512('0x45')]||_0x3512('0x46'):_0x3512('0x46');_0xa285b9[_0x3512('0x5d')]=_0x46e073['queue'];_0xa285b9[_0x3512('0x67')]=moment()[_0x3512('0x3f')](_0x3512('0x68'));_0xa285b9['position']=_0x46e073[_0x3512('0x69')];_0xa285b9[_0x3512('0x6a')]=_0x46e073[_0x3512('0x6a')];_[_0x3512('0x6b')](_0xa285b9,_['pick'](_0x46e073,_[_0x3512('0x6c')](_0xa285b9)));this[_0x3512('0xf')][_0x46e073[_0x3512('0x66')]][_0x3512('0x6d')](_0xa285b9);this[_0x3512('0x11')][_0x46e073[_0x3512('0x66')]]=_0xa285b9;this['emitVoiceQueueChannelSave'](_0xa285b9);}}catch(_0x1db831){logger[_0x3512('0x38')](_0x3512('0x6e'),util[_0x3512('0x65')](_0x1db831,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x3512('0xb')][_0x3512('0x1a')]=function(_0x495975){try{if(this[_0x3512('0x5c')](_0x495975)){if(this['queueReports'][_0x495975[_0x3512('0x66')]]){var _0x19aa6f=_[_0x3512('0x6f')](this['queueReports'][_0x495975[_0x3512('0x66')]]);_0x19aa6f[_0x3512('0x70')]=![];_0x19aa6f[_0x3512('0x71')]=null;_0x19aa6f[_0x3512('0x72')]=_0x495975[_0x3512('0x72')];_0x19aa6f[_0x3512('0x73')]=_0x495975[_0x3512('0x73')];_0x19aa6f['queuecallerabandon']=!![];_0x19aa6f[_0x3512('0x74')]=moment()[_0x3512('0x3f')](_0x3512('0x68'));_0x19aa6f['queuecallerexitreason']='ABANDONED';_0x19aa6f[_0x3512('0x75')]=null;this['channels'][_0x495975[_0x3512('0x66')]]=_0x19aa6f;this[_0x3512('0x3c')](_0x19aa6f);}}}catch(_0x5a86e3){logger[_0x3512('0x38')](_0x3512('0x76'),util[_0x3512('0x65')](_0x5a86e3,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x3512('0xb')][_0x3512('0x1c')]=function(_0x2e594d){try{if(this[_0x3512('0x5c')](_0x2e594d)){if(this[_0x3512('0xf')][_0x2e594d[_0x3512('0x66')]]){var _0x56d2d6=_['last'](this[_0x3512('0xf')][_0x2e594d[_0x3512('0x66')]]);_0x56d2d6[_0x3512('0x77')]=moment()[_0x3512('0x3f')](_0x3512('0x68'));_0x56d2d6[_0x3512('0x78')]=_0x2e594d[_0x3512('0x78')];_0x56d2d6[_0x3512('0x79')]=_0x2e594d[_0x3512('0x79')];this[_0x3512('0x11')][_0x2e594d[_0x3512('0x66')]]=_0x56d2d6;this[_0x3512('0x3e')](_0x56d2d6);}}}catch(_0x1bf895){logger[_0x3512('0x38')](_0x3512('0x7a'),util[_0x3512('0x65')](_0x1bf895,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x3512('0xb')][_0x3512('0x1f')]=function(_0x3ebd5a){try{if(this['isNotNull'](_0x3ebd5a)){if(this[_0x3512('0xf')][_0x3ebd5a['uniqueid']]){var _0x4d60d4=_[_0x3512('0x6f')](this[_0x3512('0xf')][_0x3ebd5a['uniqueid']]);_0x4d60d4['queuecallercomplete']=!![];_0x4d60d4[_0x3512('0x7b')]='COMPLETEDBYAGENT';}}}catch(_0x4c85b7){logger[_0x3512('0x38')](_0x3512('0x7c'),util[_0x3512('0x65')](_0x4c85b7,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x3512('0xb')][_0x3512('0x1e')]=function(_0x128b7e){try{if(this[_0x3512('0x5c')](_0x128b7e)){if(this[_0x3512('0xf')][_0x128b7e[_0x3512('0x66')]]){var _0x5d2239=_[_0x3512('0x6f')](this['queueReports'][_0x128b7e['uniqueid']]);_0x5d2239[_0x3512('0x7d')]=![];_0x5d2239[_0x3512('0x74')]=null;_0x5d2239['assigned']=!![];_0x5d2239['lastAssignedTo']=_0x128b7e['membername'];_0x5d2239[_0x3512('0x72')]=_0x128b7e[_0x3512('0x72')];_0x5d2239[_0x3512('0x70')]=!![];_0x5d2239[_0x3512('0x7e')]=![];_0x5d2239[_0x3512('0x7f')]=null;if(!_0x5d2239[_0x3512('0x80')]){if(_0x128b7e[_0x3512('0x81')]=='transfer'){_0x5d2239[_0x3512('0x7b')]='COMPLETED';}else{if(_[_0x3512('0x82')](_0x128b7e[_0x3512('0x35')][_0x3512('0x83')](),_0x3512('0x84'))){if(this[_0x3512('0xf')][_0x128b7e['linkedid']]){var _0x1072aa=_[_0x3512('0x6f')](this[_0x3512('0xf')][_0x128b7e['linkedid']]);_0x1072aa[_0x3512('0x70')]=![];_0x1072aa[_0x3512('0x7e')]=!![];_0x1072aa['queuecallerexitAt']=moment(_0x5d2239[_0x3512('0x67')])[_0x3512('0x85')](_0x128b7e['holdtime'],_0x3512('0x86'))[_0x3512('0x3f')](_0x3512('0x68'));_0x1072aa['queuecallerexitreason']=_0x3512('0x87');_0x1072aa[_0x3512('0x80')]=!![];_0x1072aa[_0x3512('0x88')]=_0x3512('0x89');_0x1072aa['transferexten']=_0x128b7e[_0x3512('0x8a')];_0x1072aa[_0x3512('0x8b')]=_0x128b7e[_0x3512('0x66')];var _0xa07d93=this[_0x3512('0xf')][_0x128b7e[_0x3512('0x8c')]];this[_0x3512('0xf')][_0x128b7e[_0x3512('0x8c')]]=this['queueReports'][_0x128b7e['uniqueid']];this['queueReports'][_0x128b7e[_0x3512('0x66')]]=_0xa07d93;}}else{_0x5d2239[_0x3512('0x7b')]=_0x3512('0x8d')+_0x128b7e[_0x3512('0x81')]['toUpperCase']();}}}this[_0x3512('0x11')][_0x128b7e[_0x3512('0x66')]]=_0x5d2239;this[_0x3512('0x3c')](_0x5d2239);}}}catch(_0x1fe790){logger[_0x3512('0x38')]('[syncAgentComplete][VoiceQueueReport]',util[_0x3512('0x65')](_0x1fe790,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x3512('0xb')][_0x3512('0x21')]=function(_0x4af6e7){try{if(this[_0x3512('0x5c')](_0x4af6e7)){this['addVariable'](_0x4af6e7[_0x3512('0x66')],_['keys'](_0x4af6e7[_0x3512('0x8e')])[0x0],_0x4af6e7[_0x3512('0x8f')]);if(this['queueReports'][_0x4af6e7[_0x3512('0x66')]]){var _0x11dcdc=_['last'](this[_0x3512('0xf')][_0x4af6e7['uniqueid']]);if(_0x11dcdc){if(this['isNotNull'](_0x4af6e7['variable'])&&this['isNotNull'](_0x4af6e7[_0x3512('0x8e')]['queuestatus'])){switch(_0x4af6e7[_0x3512('0x8f')]){case _0x3512('0x90'):_0x11dcdc[_0x3512('0x7e')]=![];_0x11dcdc[_0x3512('0x7f')]=null;break;case'TIMEOUT':_0x11dcdc[_0x3512('0x91')]=_0x3512('0x92');ami[_0x3512('0x3d')]('custom:timeout',_0x11dcdc);break;default:_0x11dcdc['queuecallerexit']=!![];_0x11dcdc[_0x3512('0x7f')]=moment()['format'](_0x3512('0x68'));_0x11dcdc[_0x3512('0x77')]=moment()['format'](_0x3512('0x68'));}_0x11dcdc[_0x3512('0x7d')]=![];_0x11dcdc['queuecallerabandonAt']=null;_0x11dcdc[_0x3512('0x7b')]=_0x4af6e7['value'];this[_0x3512('0x11')][_0x4af6e7[_0x3512('0x66')]]=_0x11dcdc;this[_0x3512('0x3c')](_0x11dcdc);}else if(this[_0x3512('0x5c')](_0x4af6e7[_0x3512('0x8e')])&&this[_0x3512('0x5c')](_0x4af6e7[_0x3512('0x8e')][_0x3512('0x93')])){if(!_0x11dcdc[_0x3512('0x7d')]){_0x11dcdc[_0x3512('0x7e')]=!![];_0x11dcdc[_0x3512('0x7f')]=moment()[_0x3512('0x3f')]('YYYY-MM-DD\x20HH:mm:ss');_0x11dcdc[_0x3512('0x7b')]=_0x3512('0x94');_0x11dcdc[_0x3512('0x77')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');this[_0x3512('0x11')][_0x4af6e7[_0x3512('0x66')]]=_0x11dcdc;}}_0x11dcdc[_0x3512('0x3a')]=this[_0x3512('0x3a')][_0x4af6e7[_0x3512('0x66')]];}}}}catch(_0x398ceb){logger[_0x3512('0x38')](_0x3512('0x95'),util['inspect'](_0x398ceb,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x3512('0xb')]['addVariable']=function(_0x24f5d1,_0x30ee5e,_0x27c076){var _0x23e349=[_0x3512('0x96'),'rtpaudioqosbridged',_0x3512('0x97'),_0x3512('0x98'),_0x3512('0x99'),_0x3512('0x9a'),_0x3512('0x9b'),_0x3512('0x9c'),_0x3512('0x9d'),'sipuri',_0x3512('0x9e'),_0x3512('0x9f'),_0x3512('0xa0'),_0x3512('0xa1'),_0x3512('0xa2'),'memberlastcall','membername',_0x3512('0xa3'),_0x3512('0xa4')];if(!_['isNil'](_0x30ee5e)&&!_['includes'](_0x23e349,_0x30ee5e)){if(_[_0x3512('0x54')](this[_0x3512('0x3a')][_0x24f5d1])){this['variables'][_0x24f5d1]={};}this[_0x3512('0x3a')][_0x24f5d1][_0x30ee5e]=_0x27c076;}};VoiceQueueReport[_0x3512('0xb')]['syncHangup']=function(_0x22dcc3){try{if(this[_0x3512('0x5c')](_0x22dcc3)){if(this[_0x3512('0xf')][_0x22dcc3[_0x3512('0x66')]]){for(var _0x1fa94e=0x0,_0x4fe06d={};_0x1fa94e0x0?_0x26b7a5:0x0;this[_0xd004('0x14')][_0x451b23[_0xd004('0x60')]]['talking']=this['voiceQueues'][_0x451b23['queue']][_0xd004('0x32')]>_[_0xd004('0x61')](_0x451b23['loggedin'])?_[_0xd004('0x61')](_0x451b23['loggedin']):this[_0xd004('0x14')][_0x451b23[_0xd004('0x60')]][_0xd004('0x32')];this['emitVoiceQueueSummary'](this[_0xd004('0x14')][_0x451b23[_0xd004('0x60')]]);}ami[_0xd004('0x3f')](_0xd004('0x64'),this['voiceQueues'][_0x451b23[_0xd004('0x60')]]);}}}catch(_0x108887){logger[_0xd004('0x3b')](_0xd004('0x65'),util[_0xd004('0x66')](_0x108887,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0xd004('0x1c')]=function(_0x459d25){this['flagQueueSummary']=!![];};VoiceQueueReport[_0xd004('0xd')][_0xd004('0x67')]=function(_0x5c30ef){};VoiceQueueReport['prototype'][_0xd004('0x68')]=function(_0xf03af7){try{if(this[_0xd004('0x5e')](_0xf03af7)){if(_[_0xd004('0x2e')](this[_0xd004('0x11')][_0xf03af7[_0xd004('0x69')]])){this['queueReports'][_0xf03af7[_0xd004('0x69')]]=[];this[_0xd004('0x13')][_0xf03af7[_0xd004('0x69')]]={};}var _0xc30150=new QueueReport();_0xc30150[_0xd004('0x42')]=_0xf03af7[_0xd004('0x60')];_0xc30150[_0xd004('0x47')]=this[_0xd004('0x14')][_0xc30150[_0xd004('0x42')]]&&this['voiceQueues'][_0xc30150['name']]['type']?this[_0xd004('0x14')][_0xc30150[_0xd004('0x42')]][_0xd004('0x47')]||_0xd004('0x48'):_0xd004('0x48');_0xc30150[_0xd004('0x60')]=_0xf03af7[_0xd004('0x60')];_0xc30150[_0xd004('0x6a')]=moment()[_0xd004('0x41')](_0xd004('0x6b'));_0xc30150[_0xd004('0x6c')]=_0xf03af7['position'];_0xc30150[_0xd004('0x6d')]=_0xf03af7['count'];_[_0xd004('0x6e')](_0xc30150,_[_0xd004('0x6f')](_0xf03af7,_[_0xd004('0x70')](_0xc30150)));this['queueReports'][_0xf03af7['uniqueid']]['push'](_0xc30150);this[_0xd004('0x13')][_0xf03af7[_0xd004('0x69')]]=_0xc30150;this[_0xd004('0x40')](_0xc30150);}}catch(_0x985b2){logger[_0xd004('0x3b')]('[syncQueueCallerJoin][VoiceQueueReport]',util[_0xd004('0x66')](_0x985b2,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xd004('0xd')][_0xd004('0x1f')]=function(_0xd114d){try{if(this['isNotNull'](_0xd114d)){if(this[_0xd004('0x11')][_0xd114d[_0xd004('0x69')]]){var _0x284acd=_[_0xd004('0x71')](this[_0xd004('0x11')][_0xd114d['uniqueid']]);_0x284acd[_0xd004('0x72')]=![];_0x284acd[_0xd004('0x73')]=null;_0x284acd[_0xd004('0x74')]=_0xd114d['holdtime'];_0x284acd['originalposition']=_0xd114d[_0xd004('0x75')];_0x284acd[_0xd004('0x1e')]=!![];_0x284acd['queuecallerabandonAt']=moment()[_0xd004('0x41')]('YYYY-MM-DD\x20HH:mm:ss');_0x284acd['queuecallerexitreason']='ABANDONED';_0x284acd['lastAssignedTo']=null;this[_0xd004('0x13')][_0xd114d[_0xd004('0x69')]]=_0x284acd;this[_0xd004('0x76')](_0x284acd);}}}catch(_0x4eac7b){logger[_0xd004('0x3b')]('[syncQueueCallerAbandon][VoiceQueueReport]',util[_0xd004('0x66')](_0x4eac7b,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xd004('0xd')][_0xd004('0x20')]=function(_0x2cd62c){try{if(this['isNotNull'](_0x2cd62c)){if(this['queueReports'][_0x2cd62c[_0xd004('0x69')]]){var _0x20d358=_[_0xd004('0x71')](this[_0xd004('0x11')][_0x2cd62c['uniqueid']]);_0x20d358[_0xd004('0x77')]=moment()['format'](_0xd004('0x6b'));_0x20d358[_0xd004('0x78')]=_0x2cd62c[_0xd004('0x78')];_0x20d358[_0xd004('0x79')]=_0x2cd62c[_0xd004('0x79')];this['channels'][_0x2cd62c[_0xd004('0x69')]]=_0x20d358;this['emitVoiceQueueChannelSave'](_0x20d358);}}}catch(_0xb8c1af){logger[_0xd004('0x3b')](_0xd004('0x7a'),util[_0xd004('0x66')](_0xb8c1af,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype']['syncAgentConnect']=function(_0x39c428){try{if(this['isNotNull'](_0x39c428)){if(this[_0xd004('0x11')][_0x39c428[_0xd004('0x69')]]){var _0x4d402f=_['last'](this[_0xd004('0x11')][_0x39c428[_0xd004('0x69')]]);_0x4d402f[_0xd004('0x72')]=!![];_0x4d402f[_0xd004('0x7b')]=_0xd004('0x7c');}}}catch(_0x41cb6f){logger[_0xd004('0x3b')](_0xd004('0x7d'),util[_0xd004('0x66')](_0x41cb6f,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xd004('0xd')][_0xd004('0x7e')]=function(_0x3f18e5){try{if(this['isNotNull'](_0x3f18e5)){if(this[_0xd004('0x11')][_0x3f18e5[_0xd004('0x69')]]){var _0x142fb3=_['last'](this[_0xd004('0x11')][_0x3f18e5[_0xd004('0x69')]]);_0x142fb3['queuecallerabandon']=![];_0x142fb3[_0xd004('0x7f')]=null;_0x142fb3[_0xd004('0x80')]=!![];_0x142fb3[_0xd004('0x81')]=_0x3f18e5[_0xd004('0x82')];_0x142fb3[_0xd004('0x74')]=_0x3f18e5[_0xd004('0x74')];_0x142fb3['queuecallercomplete']=!![];_0x142fb3[_0xd004('0x83')]=![];_0x142fb3[_0xd004('0x84')]=null;if(!_0x142fb3[_0xd004('0x85')]){if(_0x3f18e5['reason']==_0xd004('0x85')){_0x142fb3[_0xd004('0x7b')]=_0xd004('0x86');}else{if(_['startsWith'](_0x3f18e5[_0xd004('0x87')][_0xd004('0x88')](),_0xd004('0x89'))){if(this[_0xd004('0x11')][_0x3f18e5[_0xd004('0x8a')]]){var _0x507a82=_[_0xd004('0x71')](this[_0xd004('0x11')][_0x3f18e5['linkedid']]);_0x507a82['queuecallercomplete']=![];_0x507a82[_0xd004('0x83')]=!![];_0x507a82[_0xd004('0x84')]=moment(_0x142fb3[_0xd004('0x6a')])[_0xd004('0x8b')](_0x3f18e5['holdtime'],'seconds')[_0xd004('0x41')](_0xd004('0x6b'));_0x507a82['queuecallerexitreason']=_0xd004('0x8c');_0x507a82[_0xd004('0x85')]=!![];_0x507a82[_0xd004('0x8d')]=_0xd004('0x8e');_0x507a82['transferexten']=_0x3f18e5[_0xd004('0x8f')];_0x507a82['transferuniqueid']=_0x3f18e5[_0xd004('0x69')];var _0x6cbff2=this['queueReports'][_0x3f18e5[_0xd004('0x8a')]];this[_0xd004('0x11')][_0x3f18e5[_0xd004('0x8a')]]=this['queueReports'][_0x3f18e5[_0xd004('0x69')]];this['queueReports'][_0x3f18e5['uniqueid']]=_0x6cbff2;}}else{_0x142fb3[_0xd004('0x7b')]=_0xd004('0x90')+_0x3f18e5[_0xd004('0x91')][_0xd004('0x92')]();}}}this[_0xd004('0x13')][_0x3f18e5['uniqueid']]=_0x142fb3;this['emitVoiceQueueChannelRemove'](_0x142fb3);}}}catch(_0x591114){logger[_0xd004('0x3b')]('[syncAgentComplete][VoiceQueueReport]',util[_0xd004('0x66')](_0x591114,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0xd004('0x25')]=function(_0x6c6e9){try{if(this[_0xd004('0x5e')](_0x6c6e9)){this[_0xd004('0x93')](_0x6c6e9[_0xd004('0x69')],_[_0xd004('0x70')](_0x6c6e9[_0xd004('0x94')])[0x0],_0x6c6e9[_0xd004('0x95')]);if(this[_0xd004('0x11')][_0x6c6e9[_0xd004('0x69')]]){var _0x2beb7e=_[_0xd004('0x71')](this[_0xd004('0x11')][_0x6c6e9[_0xd004('0x69')]]);if(_0x2beb7e){if(this['isNotNull'](_0x6c6e9[_0xd004('0x94')])&&this[_0xd004('0x5e')](_0x6c6e9['variable']['queuestatus'])){switch(_0x6c6e9[_0xd004('0x95')]){case'CONTINUE':_0x2beb7e[_0xd004('0x83')]=![];_0x2beb7e['queuecallerexitAt']=null;break;case'TIMEOUT':_0x2beb7e[_0xd004('0x96')]=_0xd004('0x97');ami[_0xd004('0x3f')](_0xd004('0x98'),_0x2beb7e);break;default:_0x2beb7e[_0xd004('0x83')]=!![];_0x2beb7e[_0xd004('0x84')]=moment()[_0xd004('0x41')]('YYYY-MM-DD\x20HH:mm:ss');_0x2beb7e[_0xd004('0x77')]=moment()[_0xd004('0x41')](_0xd004('0x6b'));}_0x2beb7e[_0xd004('0x1e')]=![];_0x2beb7e[_0xd004('0x7f')]=null;_0x2beb7e[_0xd004('0x7b')]=_0x6c6e9['value'];this[_0xd004('0x13')][_0x6c6e9[_0xd004('0x69')]]=_0x2beb7e;this[_0xd004('0x76')](_0x2beb7e);}else if(this[_0xd004('0x5e')](_0x6c6e9[_0xd004('0x94')])&&this['isNotNull'](_0x6c6e9[_0xd004('0x94')][_0xd004('0x99')])){if(!_0x2beb7e[_0xd004('0x1e')]){_0x2beb7e[_0xd004('0x83')]=!![];_0x2beb7e[_0xd004('0x84')]=moment()['format'](_0xd004('0x6b'));_0x2beb7e['queuecallerexitreason']='EXITWITHKEY';_0x2beb7e[_0xd004('0x77')]=moment()[_0xd004('0x41')](_0xd004('0x6b'));this[_0xd004('0x13')][_0x6c6e9[_0xd004('0x69')]]=_0x2beb7e;}}_0x2beb7e['variables']=this[_0xd004('0x17')][_0x6c6e9[_0xd004('0x69')]];}}}}catch(_0x51eee2){logger['error']('[syncVarSet][VoiceQueueReport]',util['inspect'](_0x51eee2,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xd004('0xd')][_0xd004('0x93')]=function(_0x634c88,_0x1ec8f4,_0x415a68){var _0x3d7ae4=['rtpaudioqos','rtpaudioqosbridged',_0xd004('0x9a'),_0xd004('0x9b'),_0xd004('0x9c'),'rtpaudioqoslossbridged',_0xd004('0x9d'),_0xd004('0x9e'),'sipcallid','sipuri','bridgepeer','bridgepvtcallid',_0xd004('0x9f'),'memberdynamic',_0xd004('0xa0'),_0xd004('0xa1'),_0xd004('0x82'),_0xd004('0xa2'),_0xd004('0xa3')];if(!_[_0xd004('0x38')](_0x1ec8f4)&&!_['includes'](_0x3d7ae4,_0x1ec8f4)){if(_[_0xd004('0x2e')](this[_0xd004('0x17')][_0x634c88])){this[_0xd004('0x17')][_0x634c88]={};}this[_0xd004('0x17')][_0x634c88][_0x1ec8f4]=_0x415a68;}};VoiceQueueReport['prototype'][_0xd004('0xa4')]=function(_0x5a70b2){try{if(this[_0xd004('0x5e')](_0x5a70b2)){if(this[_0xd004('0x11')][_0x5a70b2['uniqueid']]){for(var _0x428171=0x0,_0x1c80dc={};_0x428171=0x0?moment(_0x4244e4[_0x7110('0x15')])[_0x7110('0xb')](_0x4244e4[_0x7110('0x16')],_0x7110('0x17')):null,'data1':'outbound','data2':_0x4244e4[_0x7110('0xf')],'data3':_0x4244e4[_0x7110('0xc')],'data4':_0x4244e4[_0x7110('0x18')]||null,'role':'agent','internal':_0x4244e4[_0x7110('0xf')]?_[_0x7110('0x10')](_0x4244e4[_0x7110('0xf')]):undefined,'uniqueid':_0x4244e4[_0x7110('0x11')]},'log':_0x7110('0x13')});}; \ No newline at end of file +var _0x776d=['diff','seconds','inbound','calleridnum','exten','agent','toNumber','accountcode','uniqueid','voiceDialReport','Request','membername','starttime','endtime','outbound','moment','util','../client','voiceQueueReport','queuecallercompleteAt','queuecallerexitAt','CreateMemberReport','voice','lastAssignedTo','isNil','interface','SIP/%s','TALKING','queuecallerleaveAt'];(function(_0x4a6cf8,_0x5534ef){var _0x22205e=function(_0x3f4d0d){while(--_0x3f4d0d){_0x4a6cf8['push'](_0x4a6cf8['shift']());}};_0x22205e(++_0x5534ef);}(_0x776d,0x188));var _0xd776=function(_0x491073,_0x1fc7f6){_0x491073=_0x491073-0x0;var _0x5d9e7e=_0x776d[_0x491073];return _0x5d9e7e;};'use strict';var moment=require(_0xd776('0x0'));var _=require('lodash');var util=require(_0xd776('0x1'));var client=require(_0xd776('0x2'));exports[_0xd776('0x3')]=function(_0x299c6f){var _0x5b41be=_0x299c6f[_0xd776('0x4')]||_0x299c6f[_0xd776('0x5')];return client['Request'](_0xd776('0x6'),{'body':{'channel':_0xd776('0x7'),'membername':_0x299c6f[_0xd776('0x8')],'interface':_[_0xd776('0x9')](_0x299c6f[_0xd776('0xa')])?util['format'](_0xd776('0xb'),_0x299c6f[_0xd776('0x8')]):_0x299c6f[_0xd776('0xa')],'type':_0xd776('0xc'),'enterAt':_0x299c6f[_0xd776('0xd')],'exitAt':_0x5b41be,'duration':moment(_0x5b41be)[_0xd776('0xe')](_0x299c6f['queuecallerleaveAt'],_0xd776('0xf')),'data1':_0xd776('0x10'),'data2':_0x299c6f[_0xd776('0x11')],'data3':_0x299c6f[_0xd776('0x12')],'data4':null,'data5':_0x299c6f['queue'],'role':_0xd776('0x13'),'internal':_0x299c6f['accountcode']?_[_0xd776('0x14')](_0x299c6f[_0xd776('0x15')]):undefined,'uniqueid':_0x299c6f[_0xd776('0x16')]},'log':_0xd776('0x6')});};exports[_0xd776('0x17')]=function(_0x5e51af){return client[_0xd776('0x18')]('CreateMemberReport',{'body':{'channel':_0xd776('0x7'),'membername':_0x5e51af[_0xd776('0x19')],'interface':_0x5e51af[_0xd776('0xa')],'type':_0xd776('0xc'),'enterAt':_0x5e51af[_0xd776('0x1a')],'exitAt':_0x5e51af['endtime'],'duration':moment(_0x5e51af[_0xd776('0x1b')])[_0xd776('0xe')](_0x5e51af['starttime'],'seconds')>=0x0?moment(_0x5e51af[_0xd776('0x1b')])[_0xd776('0xe')](_0x5e51af[_0xd776('0x1a')],_0xd776('0xf')):null,'data1':_0xd776('0x1c'),'data2':_0x5e51af['accountcode'],'data3':_0x5e51af['exten'],'data4':_0x5e51af['dialstring']||null,'role':_0xd776('0x13'),'internal':_0x5e51af['accountcode']?_[_0xd776('0x14')](_0x5e51af[_0xd776('0x15')]):undefined,'uniqueid':_0x5e51af[_0xd776('0x16')]},'log':_0xd776('0x6')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/template.js b/server/services/ami/rpc/template.js index df2020f..b6f4b82 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 _0x6e6c=['getTemplates','Request','html','../client'];(function(_0x4a61fd,_0x144cf0){var _0xfa1b8f=function(_0x24fdf7){while(--_0x24fdf7){_0x4a61fd['push'](_0x4a61fd['shift']());}};_0xfa1b8f(++_0x144cf0);}(_0x6e6c,0xc3));var _0xc6e6=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x6e6c[_0x14add3];return _0x4a174f;};'use strict';var client=require(_0xc6e6('0x0'));exports[_0xc6e6('0x1')]=function(_0x545f2c){return function(_0x370b21){return client[_0xc6e6('0x2')]('GetTemplate',{'options':{'raw':!![],'attributes':['id','name',_0xc6e6('0x3')]},'log':'GetTemplate'});};}; \ No newline at end of file +var _0x263f=['html','../client','getTemplates','Request','GetTemplate'];(function(_0x3dd0a1,_0x152dcb){var _0x3c624d=function(_0x144274){while(--_0x144274){_0x3dd0a1['push'](_0x3dd0a1['shift']());}};_0x3c624d(++_0x152dcb);}(_0x263f,0x182));var _0xf263=function(_0x5353af,_0x2ed70c){_0x5353af=_0x5353af-0x0;var _0x1e3cd5=_0x263f[_0x5353af];return _0x1e3cd5;};'use strict';var client=require(_0xf263('0x0'));exports[_0xf263('0x1')]=function(_0x1c3e9e){return function(_0x40eadb){return client[_0xf263('0x2')](_0xf263('0x3'),{'options':{'raw':!![],'attributes':['id','name',_0xf263('0x4')]},'log':_0xf263('0x3')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/trigger.js b/server/services/ami/rpc/trigger.js index 5b8795a..b5b01b2 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 _0xe9fe=['channel','operator','value','AnyConditions','Action','Actions','data1','data2','data3','data4','data5','data7','GetTrigger','../client','getTriggers'];(function(_0x324f31,_0x498d91){var _0x1e9dd8=function(_0x25c173){while(--_0x25c173){_0x324f31['push'](_0x324f31['shift']());}};_0x1e9dd8(++_0x498d91);}(_0xe9fe,0x1a2));var _0xee9f=function(_0x58c86a,_0x602654){_0x58c86a=_0x58c86a-0x0;var _0x2bb374=_0xe9fe[_0x58c86a];return _0x2bb374;};'use strict';var client=require(_0xee9f('0x0'));exports[_0xee9f('0x1')]=function(_0x503ebf){return function(_0x581dc7){return client['Request']('GetTrigger',{'options':{'raw':![],'attributes':['id','name',_0xee9f('0x2'),'status'],'include':[{'model':'Condition','as':'AllConditions','attributes':['id','field',_0xee9f('0x3'),_0xee9f('0x4')]},{'model':'Condition','as':_0xee9f('0x5'),'attributes':['id','field',_0xee9f('0x3'),_0xee9f('0x4')]},{'model':_0xee9f('0x6'),'as':_0xee9f('0x7'),'attributes':['id','action',_0xee9f('0x8'),_0xee9f('0x9'),_0xee9f('0xa'),_0xee9f('0xb'),_0xee9f('0xc'),'data6',_0xee9f('0xd')]}]},'log':_0xee9f('0xe')});};}; \ No newline at end of file +var _0xfd1a=['field','value','AnyConditions','operator','Action','data1','data2','data3','data4','data7','getTriggers','GetTrigger','name','channel','status','Condition'];(function(_0x5f309e,_0x66e31){var _0x487b5e=function(_0x44f203){while(--_0x44f203){_0x5f309e['push'](_0x5f309e['shift']());}};_0x487b5e(++_0x66e31);}(_0xfd1a,0xda));var _0xafd1=function(_0x4dd4e3,_0x1c7e93){_0x4dd4e3=_0x4dd4e3-0x0;var _0xfb56d6=_0xfd1a[_0x4dd4e3];return _0xfb56d6;};'use strict';var client=require('../client');exports[_0xafd1('0x0')]=function(_0x3d4c46){return function(_0x124a9d){return client['Request'](_0xafd1('0x1'),{'options':{'raw':![],'attributes':['id',_0xafd1('0x2'),_0xafd1('0x3'),_0xafd1('0x4')],'include':[{'model':_0xafd1('0x5'),'as':'AllConditions','attributes':['id',_0xafd1('0x6'),'operator',_0xafd1('0x7')]},{'model':_0xafd1('0x5'),'as':_0xafd1('0x8'),'attributes':['id',_0xafd1('0x6'),_0xafd1('0x9'),_0xafd1('0x7')]},{'model':_0xafd1('0xa'),'as':'Actions','attributes':['id','action',_0xafd1('0xb'),_0xafd1('0xc'),_0xafd1('0xd'),_0xafd1('0xe'),'data5','data6',_0xafd1('0xf')]}]},'log':_0xafd1('0x1')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/trunk.js b/server/services/ami/rpc/trunk.js index 862435c..f44ba38 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 _0x590a=['../client','Request','registry','GetTrunk'];(function(_0x4c8ced,_0x59a65d){var _0x31d98f=function(_0x5e3531){while(--_0x5e3531){_0x4c8ced['push'](_0x4c8ced['shift']());}};_0x31d98f(++_0x59a65d);}(_0x590a,0x1ac));var _0xa590=function(_0x595e2f,_0x434543){_0x595e2f=_0x595e2f-0x0;var _0x438770=_0x590a[_0x595e2f];return _0x438770;};'use strict';var client=require(_0xa590('0x0'));exports['getTrunks']=function(_0x5b0ebd){return function(_0x172f92){return client[_0xa590('0x1')]('GetTrunk',{'options':{'raw':!![],'where':{'active':0x1},'attributes':['id','name',_0xa590('0x2')]},'log':_0xa590('0x3')});};}; \ No newline at end of file +var _0x92e8=['getTrunks','Request','GetTrunk','name'];(function(_0x38071e,_0x598d39){var _0x48f0f1=function(_0xc7c3ea){while(--_0xc7c3ea){_0x38071e['push'](_0x38071e['shift']());}};_0x48f0f1(++_0x598d39);}(_0x92e8,0x16c));var _0x892e=function(_0xf34109,_0x380779){_0xf34109=_0xf34109-0x0;var _0x570bfc=_0x92e8[_0xf34109];return _0x570bfc;};'use strict';var client=require('../client');exports[_0x892e('0x0')]=function(_0x1d5460){return function(_0x13de98){return client[_0x892e('0x1')](_0x892e('0x2'),{'options':{'raw':!![],'where':{'active':0x1},'attributes':['id',_0x892e('0x3'),'registry']},'log':'GetTrunk'});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/user.js b/server/services/ami/rpc/user.js index 62d9982..99ef6b3 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 _0x06a5=['agent','email','accountcode','fullname','online','lastLoginAt','pauseType','lastPauseAt','phone','mobile','interface','name','internal','getTelephones','PauseUser','savePause','saveUnpause','UnpauseUser','ShowUser','voicePause','getAgent','../client','getAgents','Request','GetUser'];(function(_0x11cb9e,_0x611ac4){var _0x4bfdbc=function(_0x4ff722){while(--_0x4ff722){_0x11cb9e['push'](_0x11cb9e['shift']());}};_0x4bfdbc(++_0x611ac4);}(_0x06a5,0x128));var _0x506a=function(_0x21f5ed,_0x30755f){_0x21f5ed=_0x21f5ed-0x0;var _0x4f68a2=_0x06a5[_0x21f5ed];return _0x4f68a2;};'use strict';var client=require(_0x506a('0x0'));exports[_0x506a('0x1')]=function(){return function(){return client[_0x506a('0x2')](_0x506a('0x3'),{'options':{'raw':![],'where':{'role':_0x506a('0x4')},'attributes':['id','name',_0x506a('0x5'),_0x506a('0x6'),_0x506a('0x7'),_0x506a('0x8'),_0x506a('0x9'),_0x506a('0xa'),_0x506a('0xb'),'voicePause',_0x506a('0xc'),_0x506a('0xd'),_0x506a('0xe')]},'log':'getAgents'});};};exports['getTelephones']=function(){return function(){return client[_0x506a('0x2')](_0x506a('0x3'),{'options':{'raw':!![],'where':{'role':'telephone'},'attributes':['id',_0x506a('0xf'),_0x506a('0x6'),_0x506a('0x10')]},'log':_0x506a('0x11')});};};exports['savePause']=function(_0xb6ef1,_0x4eb53f,_0x345d95){return client['Request'](_0x506a('0x12'),{'body':{'type':_0x4eb53f,'uniqueid':_0x345d95},'options':{'where':{'id':_0xb6ef1['id']}},'log':_0x506a('0x13')});};exports[_0x506a('0x14')]=function(_0x79d7b1){return client[_0x506a('0x2')](_0x506a('0x15'),{'body':{},'options':{'where':{'id':_0x79d7b1['id']}},'log':'savePause'});};exports['getAgent']=function(_0x7bf29b){return client[_0x506a('0x2')](_0x506a('0x16'),{'options':{'raw':![],'where':{'role':_0x506a('0x4'),'id':_0x7bf29b},'attributes':['id',_0x506a('0xf'),'email','accountcode',_0x506a('0x7'),_0x506a('0x8'),'lastLoginAt','pauseType',_0x506a('0xb'),_0x506a('0x17'),_0x506a('0xe')]},'log':_0x506a('0x18')});}; \ No newline at end of file +var _0xfea7=['accountcode','online','lastLoginAt','pauseType','lastPauseAt','voicePause','phone','mobile','interface','getTelephones','telephone','internal','savePause','PauseUser','saveUnpause','UnpauseUser','getAgent','email','fullname','../client','getAgents','Request','GetUser','agent'];(function(_0x101802,_0x11f913){var _0x5d61ce=function(_0x4acc0){while(--_0x4acc0){_0x101802['push'](_0x101802['shift']());}};_0x5d61ce(++_0x11f913);}(_0xfea7,0xeb));var _0x7fea=function(_0xd8004,_0x2e5fec){_0xd8004=_0xd8004-0x0;var _0x287332=_0xfea7[_0xd8004];return _0x287332;};'use strict';var client=require(_0x7fea('0x0'));exports[_0x7fea('0x1')]=function(){return function(){return client[_0x7fea('0x2')](_0x7fea('0x3'),{'options':{'raw':![],'where':{'role':_0x7fea('0x4')},'attributes':['id','name','email',_0x7fea('0x5'),'fullname',_0x7fea('0x6'),_0x7fea('0x7'),_0x7fea('0x8'),_0x7fea('0x9'),_0x7fea('0xa'),_0x7fea('0xb'),_0x7fea('0xc'),_0x7fea('0xd')]},'log':_0x7fea('0x1')});};};exports[_0x7fea('0xe')]=function(){return function(){return client['Request'](_0x7fea('0x3'),{'options':{'raw':!![],'where':{'role':_0x7fea('0xf')},'attributes':['id','name',_0x7fea('0x5'),_0x7fea('0x10')]},'log':'getTelephones'});};};exports[_0x7fea('0x11')]=function(_0x5ba9b8,_0xff3f9c,_0x6c4dce){return client['Request'](_0x7fea('0x12'),{'body':{'type':_0xff3f9c,'uniqueid':_0x6c4dce},'options':{'where':{'id':_0x5ba9b8['id']}},'log':_0x7fea('0x11')});};exports[_0x7fea('0x13')]=function(_0x11be49){return client[_0x7fea('0x2')](_0x7fea('0x14'),{'body':{},'options':{'where':{'id':_0x11be49['id']}},'log':_0x7fea('0x11')});};exports[_0x7fea('0x15')]=function(_0x16b5e0){return client[_0x7fea('0x2')]('ShowUser',{'options':{'raw':![],'where':{'role':_0x7fea('0x4'),'id':_0x16b5e0},'attributes':['id','name',_0x7fea('0x16'),_0x7fea('0x5'),_0x7fea('0x17'),'online',_0x7fea('0x7'),_0x7fea('0x8'),'lastPauseAt',_0x7fea('0xa'),_0x7fea('0xd')]},'log':_0x7fea('0x15')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceAgentReport.js b/server/services/ami/rpc/voiceAgentReport.js index 9410807..5a1270d 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 _0xbc5e=['update','UpdateVoiceAgentReport','../client','create','Request','CreateVoiceAgentReport'];(function(_0x191c44,_0x20a896){var _0x1086cd=function(_0x2e2cac){while(--_0x2e2cac){_0x191c44['push'](_0x191c44['shift']());}};_0x1086cd(++_0x20a896);}(_0xbc5e,0xda));var _0xebc5=function(_0x527acd,_0x32b758){_0x527acd=_0x527acd-0x0;var _0x2c990f=_0xbc5e[_0x527acd];return _0x2c990f;};'use strict';var client=require(_0xebc5('0x0'));exports[_0xebc5('0x1')]=function(_0x840ec2){return client[_0xebc5('0x2')](_0xebc5('0x3'),{'body':_0x840ec2,'log':_0xebc5('0x3')});};exports[_0xebc5('0x4')]=function(_0x4aeadd,_0xfdeee0,_0x37c47d){return client[_0xebc5('0x2')]('UpdateVoiceAgentReport',{'body':_0x4aeadd,'options':{'where':{'uniqueid':_0xfdeee0,'interface':_0x37c47d,'agentcomplete':!![]}},'log':_0xebc5('0x5')});}; \ No newline at end of file +var _0x69a2=['Request','UpdateVoiceAgentReport','create'];(function(_0x136d68,_0x2dbad8){var _0x9561c1=function(_0x412077){while(--_0x412077){_0x136d68['push'](_0x136d68['shift']());}};_0x9561c1(++_0x2dbad8);}(_0x69a2,0xbf));var _0x269a=function(_0x2d6f95,_0x4088c7){_0x2d6f95=_0x2d6f95-0x0;var _0x3c838e=_0x69a2[_0x2d6f95];return _0x3c838e;};'use strict';var client=require('../client');exports[_0x269a('0x0')]=function(_0x1a942a){return client[_0x269a('0x1')]('CreateVoiceAgentReport',{'body':_0x1a942a,'log':'CreateVoiceAgentReport'});};exports['update']=function(_0x249b82,_0x471bbb,_0x5e85ab){return client['Request']('UpdateVoiceAgentReport',{'body':_0x249b82,'options':{'where':{'uniqueid':_0x471bbb,'interface':_0x5e85ab,'agentcomplete':!![]}},'log':_0x269a('0x2')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceCallReport.js b/server/services/ami/rpc/voiceCallReport.js index fbf83bc..ca9dd84 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 _0xedcb=['../client','create','Request','CreateVoiceCallReport','merge','calleridnum','context','callerid','DOCUMENTATION','getVoiceCallReports','startOf','format','endOf','day','YYYY-MM-DD\x20HH:mm:ss','type','disposition','duration','GetVoiceCallReports','moment'];(function(_0x356525,_0x12d354){var _0x26f4c5=function(_0x58b2c7){while(--_0x58b2c7){_0x356525['push'](_0x356525['shift']());}};_0x26f4c5(++_0x12d354);}(_0xedcb,0xef));var _0xbedc=function(_0x351931,_0xe53e64){_0x351931=_0x351931-0x0;var _0x116876=_0xedcb[_0x351931];return _0x116876;};'use strict';var moment=require(_0xbedc('0x0'));var util=require('util');var _=require('lodash');var client=require(_0xbedc('0x1'));exports[_0xbedc('0x2')]=function(_0x1672cd){return client[_0xbedc('0x3')](_0xbedc('0x4'),{'body':_[_0xbedc('0x5')](_0x1672cd,{'source':_0x1672cd[_0xbedc('0x6')],'destinationcontext':_0x1672cd[_0xbedc('0x7')],'callerid':_0x1672cd[_0xbedc('0x8')],'amaflags':_0xbedc('0x9')}),'log':_0xbedc('0x4')});};exports[_0xbedc('0xa')]=function(){return function(){return client[_0xbedc('0x3')]('GetVoiceCallReport',{'options':{'where':{'type':['outbound'],'createdAt':{'$between':[moment()[_0xbedc('0xb')]('day')[_0xbedc('0xc')]('YYYY-MM-DD\x20HH:mm:ss'),moment()[_0xbedc('0xd')](_0xbedc('0xe'))[_0xbedc('0xc')](_0xbedc('0xf'))]}},'attributes':[_0xbedc('0x10'),_0xbedc('0x11'),_0xbedc('0x12'),'billableseconds']},'log':_0xbedc('0x13')});};}; \ No newline at end of file +var _0x7790=['util','lodash','create','merge','calleridnum','context','callerid','DOCUMENTATION','getVoiceCallReports','Request','startOf','format','YYYY-MM-DD\x20HH:mm:ss','endOf','type','disposition','duration','billableseconds','moment'];(function(_0x44a517,_0x12e53d){var _0x1c7761=function(_0xb74fc4){while(--_0xb74fc4){_0x44a517['push'](_0x44a517['shift']());}};_0x1c7761(++_0x12e53d);}(_0x7790,0x11c));var _0x0779=function(_0x4b0d06,_0x48a5a0){_0x4b0d06=_0x4b0d06-0x0;var _0x38a9ac=_0x7790[_0x4b0d06];return _0x38a9ac;};'use strict';var moment=require(_0x0779('0x0'));var util=require(_0x0779('0x1'));var _=require(_0x0779('0x2'));var client=require('../client');exports[_0x0779('0x3')]=function(_0xe90bc7){return client['Request']('CreateVoiceCallReport',{'body':_[_0x0779('0x4')](_0xe90bc7,{'source':_0xe90bc7[_0x0779('0x5')],'destinationcontext':_0xe90bc7[_0x0779('0x6')],'callerid':_0xe90bc7[_0x0779('0x7')],'amaflags':_0x0779('0x8')}),'log':'CreateVoiceCallReport'});};exports[_0x0779('0x9')]=function(){return function(){return client[_0x0779('0xa')]('GetVoiceCallReport',{'options':{'where':{'type':['outbound'],'createdAt':{'$between':[moment()[_0x0779('0xb')]('day')[_0x0779('0xc')](_0x0779('0xd')),moment()[_0x0779('0xe')]('day')['format'](_0x0779('0xd'))]}},'attributes':[_0x0779('0xf'),_0x0779('0x10'),_0x0779('0x11'),_0x0779('0x12')]},'log':'GetVoiceCallReports'});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceDialReport.js b/server/services/ami/rpc/voiceDialReport.js index fb00492..0fa7566 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 _0xd00e=['CreateVoiceDialReport','Request'];(function(_0x101647,_0x260c9f){var _0x2662cd=function(_0x4f03f9){while(--_0x4f03f9){_0x101647['push'](_0x101647['shift']());}};_0x2662cd(++_0x260c9f);}(_0xd00e,0xd9));var _0xed00=function(_0x2e1af3,_0x2a077b){_0x2e1af3=_0x2e1af3-0x0;var _0x4150cd=_0xd00e[_0x2e1af3];return _0x4150cd;};'use strict';var client=require('../client');exports['create']=function(_0x3348f4){return client[_0xed00('0x0')](_0xed00('0x1'),{'body':_0x3348f4,'log':'CreateVoiceDialReport'});}; \ No newline at end of file +var _0xc94d=['../client','create','CreateVoiceDialReport'];(function(_0x198881,_0x574e6c){var _0x284d84=function(_0x3c0f8a){while(--_0x3c0f8a){_0x198881['push'](_0x198881['shift']());}};_0x284d84(++_0x574e6c);}(_0xc94d,0x1da));var _0xdc94=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xc94d[_0x20a584];return _0x4b41a8;};'use strict';var client=require(_0xdc94('0x0'));exports[_0xdc94('0x1')]=function(_0x3f7abc){return client['Request']('CreateVoiceDialReport',{'body':_0x3f7abc,'log':_0xdc94('0x2')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceExtension.js b/server/services/ami/rpc/voiceExtension.js index 6807d2c..e67e2da 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 _0x174b=['exten','recordingFormat','getVoiceExtensions','../client','GetVoiceExtension'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x174b,0x19d));var _0xb174=function(_0x3240d6,_0x5a9c83){_0x3240d6=_0x3240d6-0x0;var _0x3294d6=_0x174b[_0x3240d6];return _0x3294d6;};'use strict';var client=require(_0xb174('0x0'));exports['getVoiceExtensions']=function(){return function(){return client['Request'](_0xb174('0x1'),{'options':{'raw':!![],'attributes':['id',_0xb174('0x2'),_0xb174('0x3')],'where':{'VoiceExtensionId':null}},'log':_0xb174('0x4')});};}; \ No newline at end of file +var _0x57f8=['GetVoiceExtension','exten','recordingFormat','getVoiceExtensions','Request'];(function(_0x131e60,_0x5352ce){var _0x4bc497=function(_0x2a758e){while(--_0x2a758e){_0x131e60['push'](_0x131e60['shift']());}};_0x4bc497(++_0x5352ce);}(_0x57f8,0x198));var _0x857f=function(_0x1d60d0,_0x2cfa88){_0x1d60d0=_0x1d60d0-0x0;var _0x1a0917=_0x57f8[_0x1d60d0];return _0x1a0917;};'use strict';var client=require('../client');exports[_0x857f('0x0')]=function(){return function(){return client[_0x857f('0x1')](_0x857f('0x2'),{'options':{'raw':!![],'attributes':['id',_0x857f('0x3'),_0x857f('0x4')],'where':{'VoiceExtensionId':null}},'log':_0x857f('0x0')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceQueue.js b/server/services/ami/rpc/voiceQueue.js index 004c35d..c1e77d0 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 _0x3479=['dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumWordLength','dialRecallMeTimeout','dialOrderByScheduledAt','dialAgiAfterHangupClient','dialQueueProject2','dialRandomLastDigitCallerIdNumber','dialCutDigit','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropRetryFrequency','dialAbandonedMaxRetry','dialMachineMaxRetry','dialAgentRejectRetryFrequency','mandatoryDisposition','dialPredictiveIntervalMaxThreshold','Trunk','callerid','active','Pause','mandatoryDispositionPause','TrunkBackup','Interval','Intervals','interval','getVoiceQueues','Request','GetVoiceQueue','name','autopause','monitor_format','type','dialActive','dialMethod','dialLimitChannel','dialLimitQueue','dialPowerLevel','dialPredictiveOptimization','dialPredictiveOptimizationPercentage','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialQueueOptions','dialQueueTimeout','dialQueueProject','dialBusyMaxRetry','dialBusyRetryFrequency','dialGlobalMaxRetry','dialTimezone','dialGlobalInterval','dialAMDInitialSilence','dialAMDTotalAnalysisTime'];(function(_0x560486,_0x6857cf){var _0x5cae14=function(_0x34ad54){while(--_0x34ad54){_0x560486['push'](_0x560486['shift']());}};_0x5cae14(++_0x6857cf);}(_0x3479,0x18d));var _0x9347=function(_0x5941f8,_0x4aee3e){_0x5941f8=_0x5941f8-0x0;var _0xb94b96=_0x3479[_0x5941f8];return _0xb94b96;};'use strict';var client=require('../client');exports[_0x9347('0x0')]=function(){return function(){return client[_0x9347('0x1')](_0x9347('0x2'),{'options':{'raw':![],'attributes':['id',_0x9347('0x3'),'acw','acwTimeout',_0x9347('0x4'),_0x9347('0x5'),_0x9347('0x6'),_0x9347('0x7'),_0x9347('0x8'),_0x9347('0x9'),_0x9347('0xa'),_0x9347('0xb'),_0x9347('0xc'),_0x9347('0xd'),'dialPredictiveInterval',_0x9347('0xe'),_0x9347('0xf'),_0x9347('0x10'),_0x9347('0x11'),_0x9347('0x12'),_0x9347('0x13'),'dialCongestionMaxRetry','dialCongestionRetryFrequency',_0x9347('0x14'),_0x9347('0x15'),'dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency',_0x9347('0x16'),_0x9347('0x17'),_0x9347('0x18'),'dialPrefix','dialCheckDuplicateType','dialAMDActive',_0x9347('0x19'),'dialAMDGreeting','dialAMDAfterGreetingSilence',_0x9347('0x1a'),_0x9347('0x1b'),_0x9347('0x1c'),'dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold',_0x9347('0x1d'),'timeout',_0x9347('0x1e'),'dialRecallInQueue',_0x9347('0x1f'),'dialAgiAfterHangupAgent',_0x9347('0x20'),_0x9347('0x21'),'monitor_format','strategy',_0x9347('0x22'),_0x9347('0x23'),_0x9347('0x24'),_0x9347('0x25'),'dialDropMaxRetry',_0x9347('0x26'),_0x9347('0x27'),'dialAbandonedRetryFrequency',_0x9347('0x28'),'dialMachineRetryFrequency','dialAgentRejectMaxRetry',_0x9347('0x29'),_0x9347('0x2a'),_0x9347('0x2b'),'dialPredictiveIntervalMinThreshold'],'include':[{'model':_0x9347('0x2c'),'as':'Trunk','attributes':['id',_0x9347('0x3'),_0x9347('0x2d'),_0x9347('0x2e')]},{'model':_0x9347('0x2f'),'as':_0x9347('0x30'),'attributes':['id',_0x9347('0x3')]},{'model':_0x9347('0x2c'),'as':_0x9347('0x31'),'attributes':['id',_0x9347('0x3'),_0x9347('0x2d'),_0x9347('0x2e')]},{'model':_0x9347('0x32'),'as':_0x9347('0x32'),'attributes':['id',_0x9347('0x3')],'include':[{'model':_0x9347('0x32'),'as':_0x9347('0x33'),'attributes':['id',_0x9347('0x3'),_0x9347('0x34')]}]}]},'log':_0x9347('0x0')});};}; \ No newline at end of file +var _0x75d6=['mandatoryDisposition','dialPredictiveIntervalMaxThreshold','dialPredictiveIntervalMinThreshold','Trunk','callerid','Pause','TrunkBackup','Interval','Intervals','interval','../client','getVoiceQueues','Request','GetVoiceQueue','name','acw','acwTimeout','autopause','monitor_format','type','dialActive','dialMethod','dialLimitChannel','dialLimitQueue','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateTimeout','dialQueueOptions','dialQueueTimeout','dialQueueProject','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialGlobalInterval','dialCheckDuplicateType','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','timeout','dialRecallMeTimeout','dialRecallInQueue','dialAgiAfterHangupAgent','dialAgiAfterHangupClient','dialQueueProject2','strategy','dialCutDigit','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectRetryFrequency'];(function(_0x339129,_0x86dcc6){var _0x1570df=function(_0x3b537e){while(--_0x3b537e){_0x339129['push'](_0x339129['shift']());}};_0x1570df(++_0x86dcc6);}(_0x75d6,0x184));var _0x675d=function(_0xd1b4d7,_0x28b2c1){_0xd1b4d7=_0xd1b4d7-0x0;var _0x3002ec=_0x75d6[_0xd1b4d7];return _0x3002ec;};'use strict';var client=require(_0x675d('0x0'));exports[_0x675d('0x1')]=function(){return function(){return client[_0x675d('0x2')](_0x675d('0x3'),{'options':{'raw':![],'attributes':['id',_0x675d('0x4'),_0x675d('0x5'),_0x675d('0x6'),_0x675d('0x7'),_0x675d('0x8'),_0x675d('0x9'),_0x675d('0xa'),_0x675d('0xb'),_0x675d('0xc'),_0x675d('0xd'),'dialPowerLevel','dialPredictiveOptimization',_0x675d('0xe'),_0x675d('0xf'),'dialOriginateCallerIdName','dialOriginateCallerIdNumber',_0x675d('0x10'),_0x675d('0x11'),_0x675d('0x12'),_0x675d('0x13'),_0x675d('0x14'),_0x675d('0x15'),_0x675d('0x16'),_0x675d('0x17'),_0x675d('0x18'),_0x675d('0x19'),_0x675d('0x1a'),'dialTimezone',_0x675d('0x1b'),'dialPrefix',_0x675d('0x1c'),_0x675d('0x1d'),_0x675d('0x1e'),_0x675d('0x1f'),_0x675d('0x20'),_0x675d('0x21'),_0x675d('0x22'),_0x675d('0x23'),_0x675d('0x24'),_0x675d('0x25'),'dialAMDMaximumWordLength',_0x675d('0x26'),_0x675d('0x27'),_0x675d('0x28'),'dialOrderByScheduledAt',_0x675d('0x29'),_0x675d('0x2a'),_0x675d('0x2b'),_0x675d('0x8'),_0x675d('0x2c'),'dialRandomLastDigitCallerIdNumber',_0x675d('0x2d'),_0x675d('0x2e'),_0x675d('0x2f'),_0x675d('0x30'),_0x675d('0x31'),'dialAbandonedMaxRetry','dialAbandonedRetryFrequency',_0x675d('0x32'),_0x675d('0x33'),'dialAgentRejectMaxRetry',_0x675d('0x34'),_0x675d('0x35'),_0x675d('0x36'),_0x675d('0x37')],'include':[{'model':_0x675d('0x38'),'as':_0x675d('0x38'),'attributes':['id',_0x675d('0x4'),_0x675d('0x39'),'active']},{'model':_0x675d('0x3a'),'as':'mandatoryDispositionPause','attributes':['id',_0x675d('0x4')]},{'model':_0x675d('0x38'),'as':_0x675d('0x3b'),'attributes':['id',_0x675d('0x4'),_0x675d('0x39'),'active']},{'model':_0x675d('0x3c'),'as':_0x675d('0x3c'),'attributes':['id',_0x675d('0x4')],'include':[{'model':'Interval','as':_0x675d('0x3d'),'attributes':['id','name',_0x675d('0x3e')]}]}]},'log':_0x675d('0x1')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceQueueReport.js b/server/services/ami/rpc/voiceQueueReport.js index 19a2685..b39dd12 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 _0x9352=['Request','CreateVoiceQueueReport','startOf','day','format','YYYY-MM-DD\x20HH:mm:ss','endOf','uniqueid','queue','queuecallerjoinAt','queuecallerleaveAt','queuecallercomplete','queuecallercompleteAt','queuecallerexit','queuecallerexitAt','queuecallerabandonAt','GetVoiceQueueReports','moment','lodash','../client','create'];(function(_0x10e627,_0x26b1a7){var _0x12153a=function(_0x54bb6b){while(--_0x54bb6b){_0x10e627['push'](_0x10e627['shift']());}};_0x12153a(++_0x26b1a7);}(_0x9352,0x1ca));var _0x2935=function(_0x57a58b,_0x5710cb){_0x57a58b=_0x57a58b-0x0;var _0x6679d7=_0x9352[_0x57a58b];return _0x6679d7;};'use strict';var moment=require(_0x2935('0x0'));var _=require(_0x2935('0x1'));var client=require(_0x2935('0x2'));exports[_0x2935('0x3')]=function(_0x21d8f9){return client[_0x2935('0x4')](_0x2935('0x5'),{'body':_0x21d8f9,'log':_0x2935('0x5')});};exports['getVoiceQueueReports']=function(){return function(){return client['Request']('GetVoiceQueueReport',{'options':{'where':{'createdAt':{'$between':[moment()[_0x2935('0x6')](_0x2935('0x7'))[_0x2935('0x8')](_0x2935('0x9')),moment()[_0x2935('0xa')](_0x2935('0x7'))[_0x2935('0x8')]('YYYY-MM-DD\x20HH:mm:ss')]}},'attributes':[_0x2935('0xb'),_0x2935('0xc'),_0x2935('0xd'),_0x2935('0xe'),_0x2935('0xf'),_0x2935('0x10'),_0x2935('0x11'),_0x2935('0x12'),'queuecallerabandon',_0x2935('0x13')]},'log':_0x2935('0x14')});};}; \ No newline at end of file +var _0xffcc=['queuecallerjoinAt','queuecallerleaveAt','queuecallercomplete','queuecallercompleteAt','queuecallerexit','queuecallerabandon','GetVoiceQueueReports','moment','../client','Request','getVoiceQueueReports','GetVoiceQueueReport','startOf','day','format','queue'];(function(_0x5a3d7e,_0x28dbe4){var _0x514299=function(_0x40ded8){while(--_0x40ded8){_0x5a3d7e['push'](_0x5a3d7e['shift']());}};_0x514299(++_0x28dbe4);}(_0xffcc,0x147));var _0xcffc=function(_0x4e79b9,_0x442805){_0x4e79b9=_0x4e79b9-0x0;var _0xc93ffb=_0xffcc[_0x4e79b9];return _0xc93ffb;};'use strict';var moment=require(_0xcffc('0x0'));var _=require('lodash');var client=require(_0xcffc('0x1'));exports['create']=function(_0x1e95d2){return client[_0xcffc('0x2')]('CreateVoiceQueueReport',{'body':_0x1e95d2,'log':'CreateVoiceQueueReport'});};exports[_0xcffc('0x3')]=function(){return function(){return client[_0xcffc('0x2')](_0xcffc('0x4'),{'options':{'where':{'createdAt':{'$between':[moment()[_0xcffc('0x5')](_0xcffc('0x6'))[_0xcffc('0x7')]('YYYY-MM-DD\x20HH:mm:ss'),moment()['endOf'](_0xcffc('0x6'))[_0xcffc('0x7')]('YYYY-MM-DD\x20HH:mm:ss')]}},'attributes':['uniqueid',_0xcffc('0x8'),_0xcffc('0x9'),_0xcffc('0xa'),_0xcffc('0xb'),_0xcffc('0xc'),_0xcffc('0xd'),'queuecallerexitAt',_0xcffc('0xe'),'queuecallerabandonAt']},'log':_0xcffc('0xf')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceQueueRt.js b/server/services/ami/rpc/voiceQueueRt.js index 9fe4912..d9051bf 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 _0x036f=['../client','getVoiceQueueRtPauses','Request','GetVoiceQueueRtPauses'];(function(_0x441bc0,_0x5b8718){var _0x432cdc=function(_0x320d70){while(--_0x320d70){_0x441bc0['push'](_0x441bc0['shift']());}};_0x432cdc(++_0x5b8718);}(_0x036f,0x13c));var _0xf036=function(_0x5b174b,_0x404869){_0x5b174b=_0x5b174b-0x0;var _0x47ee37=_0x036f[_0x5b174b];return _0x47ee37;};'use strict';var client=require(_0xf036('0x0'));exports[_0xf036('0x1')]=function(_0x36a487){return function(){return client[_0xf036('0x2')](_0xf036('0x3'),{'options':{'where':{'VoiceQueueId':_0x36a487,'paused':!![]},'raw':!![]},'log':_0xf036('0x1')});};}; \ No newline at end of file +var _0x7d64=['getVoiceQueueRtPauses','Request','GetVoiceQueueRtPauses','../client'];(function(_0x1d6a82,_0x37c315){var _0x5834ac=function(_0x2402ba){while(--_0x2402ba){_0x1d6a82['push'](_0x1d6a82['shift']());}};_0x5834ac(++_0x37c315);}(_0x7d64,0x103));var _0x47d6=function(_0x3e5962,_0x37d1ed){_0x3e5962=_0x3e5962-0x0;var _0x309e56=_0x7d64[_0x3e5962];return _0x309e56;};'use strict';var client=require(_0x47d6('0x0'));exports[_0x47d6('0x1')]=function(_0x5960a8){return function(){return client[_0x47d6('0x2')](_0x47d6('0x3'),{'options':{'where':{'VoiceQueueId':_0x5960a8,'paused':!![]},'raw':!![]},'log':_0x47d6('0x1')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceRecording.js b/server/services/ami/rpc/voiceRecording.js index 80667dd..03bbe46 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 _0xe2e0=['monitorFilename','lodash','Request','CreateVoiceRecording'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xe2e0,0x121));var _0x0e2e=function(_0x35cf05,_0x801e3a){_0x35cf05=_0x35cf05-0x0;var _0x57ca7c=_0xe2e0[_0x35cf05];return _0x57ca7c;};'use strict';var _=require(_0x0e2e('0x0'));var client=require('../client');exports['create']=function(_0xc4243c){return client[_0x0e2e('0x1')](_0x0e2e('0x2'),{'body':_['merge'](_0xc4243c,{'value':_0xc4243c[_0x0e2e('0x3')]}),'log':_0x0e2e('0x2')});}; \ No newline at end of file +var _0x2349=['CreateVoiceRecording','merge','monitorFilename','../client'];(function(_0x50a0c2,_0x4befab){var _0x5ebadd=function(_0x3a3342){while(--_0x3a3342){_0x50a0c2['push'](_0x50a0c2['shift']());}};_0x5ebadd(++_0x4befab);}(_0x2349,0x1cf));var _0x9234=function(_0x2067e9,_0x5e6a97){_0x2067e9=_0x2067e9-0x0;var _0x280ce4=_0x2349[_0x2067e9];return _0x280ce4;};'use strict';var _=require('lodash');var client=require(_0x9234('0x0'));exports['create']=function(_0x35b506){return client['Request'](_0x9234('0x1'),{'body':_[_0x9234('0x2')](_0x35b506,{'value':_0x35b506[_0x9234('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 1f4d296..33360ca 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 _0xd90f=['origtransferercontext','origtransfererexten','../client','blindTransfer','Request','CreateVoiceTransferReport','result','transferercalleridname','transfererconnectedlinename','transferercontext','transfererexten','transfererlinkedid','transfereechannel','transfereecalleridnum','transfereeaccountcode','transfereecontext','transfereeexten','isexternal','context','extension','blind','attendedTransfer','origtransfererchannel','origtransferercalleridnum','origtransferercalleridname','secondtransfererconnectedlinenum','secondtransfererconnectedlinename','origtransfereraccountcode','secondtransfererexten','origtransfererlinkedid','transfertargetchannel','transfertargetcalleridname','transfertargetconnectedlinenum','transfertargetaccountcode','transfertargetlinkedid'];(function(_0xb1cf84,_0x813740){var _0x4bad2e=function(_0x53e6f2){while(--_0x53e6f2){_0xb1cf84['push'](_0xb1cf84['shift']());}};_0x4bad2e(++_0x813740);}(_0xd90f,0x13d));var _0xfd90=function(_0x5f00ea,_0x1f4a70){_0x5f00ea=_0x5f00ea-0x0;var _0x353dc1=_0xd90f[_0x5f00ea];return _0x353dc1;};'use strict';var client=require(_0xfd90('0x0'));exports[_0xfd90('0x1')]=function(_0x1908a6){return client[_0xfd90('0x2')](_0xfd90('0x3'),{'body':{'result':_0x1908a6[_0xfd90('0x4')],'transfererchannel':_0x1908a6['transfererchannel'],'transferercalleridnum':_0x1908a6['transferercalleridnum'],'transferercalleridname':_0x1908a6[_0xfd90('0x5')],'transfererconnectedlinenum':_0x1908a6['transfererconnectedlinenum'],'transfererconnectedlinename':_0x1908a6[_0xfd90('0x6')],'transfereraccountcode':_0x1908a6['transfereraccountcode'],'transferercontext':_0x1908a6[_0xfd90('0x7')],'transfererexten':_0x1908a6[_0xfd90('0x8')],'transfererlinkedid':_0x1908a6[_0xfd90('0x9')],'transfereechannel':_0x1908a6[_0xfd90('0xa')],'transfereecalleridnum':_0x1908a6[_0xfd90('0xb')],'transfereecalleridname':_0x1908a6['transfereecalleridname'],'transfereeconnectedlinenum':_0x1908a6['transfereeconnectedlinenum'],'transfereeconnectedlinename':_0x1908a6['transfereeconnectedlinename'],'transfereeaccountcode':_0x1908a6[_0xfd90('0xc')],'transfereecontext':_0x1908a6[_0xfd90('0xd')],'transfereeexten':_0x1908a6[_0xfd90('0xe')],'transfereelinkedid':_0x1908a6['transfereelinkedid'],'isexternal':_0x1908a6[_0xfd90('0xf')],'context':_0x1908a6[_0xfd90('0x10')],'extension':_0x1908a6[_0xfd90('0x11')],'type':_0xfd90('0x12')},'log':_0xfd90('0x3')});};exports[_0xfd90('0x13')]=function(_0x54bac3){return client['Request']('CreateVoiceTransferReport',{'body':{'result':_0x54bac3[_0xfd90('0x4')],'transfererchannel':_0x54bac3[_0xfd90('0x14')],'transferercalleridnum':_0x54bac3[_0xfd90('0x15')],'transferercalleridname':_0x54bac3[_0xfd90('0x16')],'transfererconnectedlinenum':_0x54bac3[_0xfd90('0x17')],'transfererconnectedlinename':_0x54bac3[_0xfd90('0x18')],'transfereraccountcode':_0x54bac3[_0xfd90('0x19')],'transferercontext':_0x54bac3['secondtransferercontext'],'transfererexten':_0x54bac3[_0xfd90('0x1a')],'transfererlinkedid':_0x54bac3[_0xfd90('0x1b')],'transfereechannel':_0x54bac3[_0xfd90('0x1c')],'transfereecalleridnum':_0x54bac3['transfertargetcalleridnum'],'transfereecalleridname':_0x54bac3[_0xfd90('0x1d')],'transfereeconnectedlinenum':_0x54bac3[_0xfd90('0x1e')],'transfereeconnectedlinename':_0x54bac3['transfertargetconnectedlinename'],'transfereeaccountcode':_0x54bac3[_0xfd90('0x1f')],'transfereecontext':_0x54bac3['transfertargetcontext'],'transfereeexten':_0x54bac3['transfertargetexten'],'transfereelinkedid':_0x54bac3[_0xfd90('0x20')],'isexternal':_0x54bac3['isexternal'],'context':_0x54bac3[_0xfd90('0x21')],'extension':_0x54bac3[_0xfd90('0x22')],'type':'attended'},'log':'CreateVoiceTransferReport'});}; \ No newline at end of file +var _0xa656=['Request','CreateVoiceTransferReport','result','transfererchannel','transferercalleridname','transfererconnectedlinenum','transfererconnectedlinename','transfereraccountcode','transferercontext','transfererexten','transfererlinkedid','transfereechannel','transfereecalleridnum','transfereecalleridname','transfereeconnectedlinename','transfereeaccountcode','transfereeexten','transfereelinkedid','isexternal','context','extension','attendedTransfer','origtransfererchannel','origtransferercalleridnum','origtransferercalleridname','secondtransfererconnectedlinenum','secondtransfererconnectedlinename','origtransfereraccountcode','secondtransferercontext','secondtransfererexten','transfertargetcalleridname','transfertargetconnectedlinenum','transfertargetconnectedlinename','transfertargetaccountcode','transfertargetcontext','transfertargetexten','transfertargetlinkedid','origtransferercontext','origtransfererexten','attended','../client','blindTransfer'];(function(_0x3e803c,_0x53abc9){var _0x5ec5b3=function(_0x49a570){while(--_0x49a570){_0x3e803c['push'](_0x3e803c['shift']());}};_0x5ec5b3(++_0x53abc9);}(_0xa656,0xa6));var _0x6a65=function(_0x41db38,_0x1213e0){_0x41db38=_0x41db38-0x0;var _0x201f68=_0xa656[_0x41db38];return _0x201f68;};'use strict';var client=require(_0x6a65('0x0'));exports[_0x6a65('0x1')]=function(_0x497c2c){return client[_0x6a65('0x2')](_0x6a65('0x3'),{'body':{'result':_0x497c2c[_0x6a65('0x4')],'transfererchannel':_0x497c2c[_0x6a65('0x5')],'transferercalleridnum':_0x497c2c['transferercalleridnum'],'transferercalleridname':_0x497c2c[_0x6a65('0x6')],'transfererconnectedlinenum':_0x497c2c[_0x6a65('0x7')],'transfererconnectedlinename':_0x497c2c[_0x6a65('0x8')],'transfereraccountcode':_0x497c2c[_0x6a65('0x9')],'transferercontext':_0x497c2c[_0x6a65('0xa')],'transfererexten':_0x497c2c[_0x6a65('0xb')],'transfererlinkedid':_0x497c2c[_0x6a65('0xc')],'transfereechannel':_0x497c2c[_0x6a65('0xd')],'transfereecalleridnum':_0x497c2c[_0x6a65('0xe')],'transfereecalleridname':_0x497c2c[_0x6a65('0xf')],'transfereeconnectedlinenum':_0x497c2c['transfereeconnectedlinenum'],'transfereeconnectedlinename':_0x497c2c[_0x6a65('0x10')],'transfereeaccountcode':_0x497c2c[_0x6a65('0x11')],'transfereecontext':_0x497c2c['transfereecontext'],'transfereeexten':_0x497c2c[_0x6a65('0x12')],'transfereelinkedid':_0x497c2c[_0x6a65('0x13')],'isexternal':_0x497c2c[_0x6a65('0x14')],'context':_0x497c2c[_0x6a65('0x15')],'extension':_0x497c2c[_0x6a65('0x16')],'type':'blind'},'log':_0x6a65('0x3')});};exports[_0x6a65('0x17')]=function(_0x1dd926){return client['Request'](_0x6a65('0x3'),{'body':{'result':_0x1dd926[_0x6a65('0x4')],'transfererchannel':_0x1dd926[_0x6a65('0x18')],'transferercalleridnum':_0x1dd926[_0x6a65('0x19')],'transferercalleridname':_0x1dd926[_0x6a65('0x1a')],'transfererconnectedlinenum':_0x1dd926[_0x6a65('0x1b')],'transfererconnectedlinename':_0x1dd926[_0x6a65('0x1c')],'transfereraccountcode':_0x1dd926[_0x6a65('0x1d')],'transferercontext':_0x1dd926[_0x6a65('0x1e')],'transfererexten':_0x1dd926[_0x6a65('0x1f')],'transfererlinkedid':_0x1dd926['origtransfererlinkedid'],'transfereechannel':_0x1dd926['transfertargetchannel'],'transfereecalleridnum':_0x1dd926['transfertargetcalleridnum'],'transfereecalleridname':_0x1dd926[_0x6a65('0x20')],'transfereeconnectedlinenum':_0x1dd926[_0x6a65('0x21')],'transfereeconnectedlinename':_0x1dd926[_0x6a65('0x22')],'transfereeaccountcode':_0x1dd926[_0x6a65('0x23')],'transfereecontext':_0x1dd926[_0x6a65('0x24')],'transfereeexten':_0x1dd926[_0x6a65('0x25')],'transfereelinkedid':_0x1dd926[_0x6a65('0x26')],'isexternal':_0x1dd926['isexternal'],'context':_0x1dd926[_0x6a65('0x27')],'extension':_0x1dd926[_0x6a65('0x28')],'type':_0x6a65('0x29')},'log':_0x6a65('0x3')});}; \ No newline at end of file diff --git a/server/services/ami/server/index.js b/server/services/ami/server/index.js index c5bdffb..6628d33 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 _0xff8e=['available','loggedIn','pTalking','sumBillable','sumDuration','sumHoldTime','talking','total','type','unmanaged','abandoned','waiting','outbound','dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundReCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalTotalCalls','originated','erlangCalls','erlangAbandonmentRate','erlangBusyFactor','startPredictive','startProgressive','Trunk','active','callerid','Interval','push','length','values','channels','voicechannel','validate','map','channel','filename','uniqueid','wav','MixMonitor','find','monitors','isNil','YYYY-MM-DD\x20HH:mm:ss','mixmonitorid','rec','status','MixMonitor\x20Success','toLowerCase','Channel\x20doesn\x27t\x20exist','ami\x20disconnected','resolve','StopMixMonitor','destinationchannel','stop','%s.%s','StopMixMonitor\x20Success','queueChannels','voicequeuechannelhangup','Hangup','voicequeuechannelredirect','Redirect','exten','context','trunks','outboundChannels','campaigns','run','event','emit','custom:','server','http','listen','127.0.0.1','log','RPC\x20listening\x20on\x20port:','lodash','util','jayson/promise','bluebird','moment','../../../config/environment','../ami','format','%s/%s','SIP','name','timers','timer','updateAcw','pause','QueuePause','asterisk','username','join','pick','keys','module','action','Reload','Action','then','message','error','isConnected','command','Command','content','catch','voiceQueues','hasOwnProperty','answered'];(function(_0xf7463f,_0x31f89d){var _0x5e57f2=function(_0x1a96c0){while(--_0x1a96c0){_0xf7463f['push'](_0xf7463f['shift']());}};_0x5e57f2(++_0x31f89d);}(_0xff8e,0x66));var _0xeff8=function(_0x446489,_0x4f6fc9){_0x446489=_0x446489-0x0;var _0x30a44e=_0xff8e[_0x446489];return _0x30a44e;};'use strict';var _=require(_0xeff8('0x0'));var util=require(_0xeff8('0x1'));var jayson=require(_0xeff8('0x2'));var schema=require('validate');var BPromise=require(_0xeff8('0x3'));var moment=require(_0xeff8('0x4'));var config=require(_0xeff8('0x5'));var properties=require('../properties');var ami=require(_0xeff8('0x6'));exports['listen']=function(_0x38353c,_0x116fee,_0x5e2ec4){return new BPromise(function(_0x12a2a8,_0x33302f){var _0xcb130b={'QueuePause':function(_0x3dcda0){return new Promise(function(_0x5bb69d,_0x52e287){var _0x58459d=util[_0xeff8('0x7')](_0xeff8('0x8'),_0xeff8('0x9'),_0x3dcda0[_0xeff8('0xa')]);if(_0x38353c[_0xeff8('0xb')]&&_0x38353c[_0xeff8('0xb')][_0x58459d]&&_0x38353c[_0xeff8('0xb')][_0x58459d][_0xeff8('0xc')]){_0x38353c[_0xeff8('0xb')][_0x58459d][_0xeff8('0xd')]();}if(_0x38353c['agents'][_0x58459d]){_0x38353c['agents'][_0x58459d]['updateStatusRealtime']({'statePause':_0x3dcda0[_0xeff8('0xe')]?!![]:![]});}_0x5bb69d({'code':0xc8,'message':_0xeff8('0xf')});});},'Reload':function(_0x44f02){var _0x243ce6=this;return new Promise(function(_0x3694fb,_0xa82b74){if(ami['isConnected']()==![]){return _0xa82b74(_0x243ce6['error'](0x1f4,[config[_0xeff8('0x10')]['ip'],config[_0xeff8('0x10')][_0xeff8('0x11')],'ami\x20disconnected'][_0xeff8('0x12')]('\x20')));}_0x44f02=_[_0xeff8('0x13')](_0x44f02,_[_0xeff8('0x14')](properties[_0xeff8('0x15')]));_0x44f02[_0xeff8('0x16')]=_0xeff8('0x17');return ami[_0xeff8('0x18')](_0x44f02)[_0xeff8('0x19')](function(_0x111788){_0x3694fb({'code':0xc8,'message':_0x111788[_0xeff8('0x1a')]});})['catch'](function(_0x186b4f){_0xa82b74(_0x243ce6[_0xeff8('0x1b')](0x1f5,_0x186b4f[_0xeff8('0x1a')]));});});},'Command':function(_0x14f324){var _0x18230e=this;return new Promise(function(_0x4d192b,_0x29c335){if(ami[_0xeff8('0x1c')]()==![]){return _0x29c335(_0x18230e[_0xeff8('0x1b')](0x1f4,[config[_0xeff8('0x10')]['ip'],config[_0xeff8('0x10')][_0xeff8('0x11')],'ami\x20disconnected']['join']('\x20')));}_0x14f324=_[_0xeff8('0x13')](_0x14f324,_0xeff8('0x1d'));_0x14f324[_0xeff8('0x16')]=_0xeff8('0x1e');return ami['Action'](_0x14f324)[_0xeff8('0x19')](function(_0x11012e){_0x4d192b({'code':0xc8,'message':_0x11012e[_0xeff8('0x1f')]});})[_0xeff8('0x20')](function(_0x59cd43){_0x29c335(_0x18230e['error'](0x1f5,_0x59cd43[_0xeff8('0x1a')]));});});},'VoiceQueues':function(_0xc7083){return new Promise(function(_0x5728af,_0x21d405){var _0x820b65=[];for(var _0xfd925d in _0x38353c['voiceQueues']){if(_0x38353c[_0xeff8('0x21')][_0xeff8('0x22')](_0xfd925d)){var _0x6bc8e4=_0x38353c[_0xeff8('0x21')][_0xfd925d];var _0x17a39c={'id':_0x6bc8e4['id'],'name':_0x6bc8e4[_0xeff8('0xa')],'strategy':_0x6bc8e4['strategy'],'answered':_0x6bc8e4[_0xeff8('0x23')],'available':_0x6bc8e4[_0xeff8('0x24')],'loggedIn':_0x6bc8e4[_0xeff8('0x25')],'pTalking':_0x6bc8e4[_0xeff8('0x26')],'sumBillable':_0x6bc8e4[_0xeff8('0x27')],'sumDuration':_0x6bc8e4[_0xeff8('0x28')],'sumHoldTime':_0x6bc8e4[_0xeff8('0x29')]||0x0,'talking':_0x6bc8e4[_0xeff8('0x2a')],'total':_0x6bc8e4[_0xeff8('0x2b')],'type':_0x6bc8e4[_0xeff8('0x2c')],'unmanaged':_0x6bc8e4[_0xeff8('0x2d')],'abandoned':_0x6bc8e4[_0xeff8('0x2e')],'waiting':_0x6bc8e4[_0xeff8('0x2f')],'loggedInDb':_0x6bc8e4['loggedInDb']};if(_0x6bc8e4[_0xeff8('0x2c')]===_0xeff8('0x30')){_0x17a39c[_0xeff8('0x31')]=_0x6bc8e4[_0xeff8('0x31')];_0x17a39c['dialMethod']=_0x6bc8e4[_0xeff8('0x32')];_0x17a39c['dialOriginateCallerIdName']=_0x6bc8e4[_0xeff8('0x33')];_0x17a39c[_0xeff8('0x34')]=_0x6bc8e4['dialOriginateCallerIdNumber'];_0x17a39c['dialOriginateTimeout']=_0x6bc8e4[_0xeff8('0x35')];_0x17a39c[_0xeff8('0x36')]=_0x6bc8e4['dialPrefix'];_0x17a39c[_0xeff8('0x37')]=_0x6bc8e4['outboundAnswerAgiCallsDay'];_0x17a39c[_0xeff8('0x38')]=_0x6bc8e4[_0xeff8('0x38')];_0x17a39c[_0xeff8('0x39')]=_0x6bc8e4[_0xeff8('0x39')];_0x17a39c[_0xeff8('0x3a')]=_0x6bc8e4['outboundBusyCallsDay'];_0x17a39c[_0xeff8('0x3b')]=_0x6bc8e4[_0xeff8('0x3b')];_0x17a39c[_0xeff8('0x3c')]=_0x6bc8e4[_0xeff8('0x3c')];_0x17a39c[_0xeff8('0x3d')]=_0x6bc8e4[_0xeff8('0x3d')];_0x17a39c[_0xeff8('0x3e')]=_0x6bc8e4[_0xeff8('0x3e')];_0x17a39c['outboundNoAnswerCallsDay']=_0x6bc8e4['outboundNoAnswerCallsDay'];_0x17a39c[_0xeff8('0x3f')]=_0x6bc8e4['outboundNoSuchCallsDay'];_0x17a39c[_0xeff8('0x40')]=_0x6bc8e4['outboundOriginateFailureCallsDay'];_0x17a39c[_0xeff8('0x41')]=_0x6bc8e4['outboundReCallsDay'];_0x17a39c['outboundRejectCallsDay']=_0x6bc8e4[_0xeff8('0x42')];_0x17a39c[_0xeff8('0x43')]=_0x6bc8e4[_0xeff8('0x43')];_0x17a39c[_0xeff8('0x44')]=_0x6bc8e4[_0xeff8('0x44')];_0x17a39c[_0xeff8('0x45')]=_0x6bc8e4[_0xeff8('0x45')];_0x17a39c[_0xeff8('0x46')]=_0x6bc8e4[_0xeff8('0x46')];_0x17a39c[_0xeff8('0x47')]=_0x6bc8e4['predictiveIntervalDroppedCallsCallersExit'];_0x17a39c[_0xeff8('0x48')]=_0x6bc8e4[_0xeff8('0x48')];_0x17a39c['predictiveIntervalErlangCalls']=_0x6bc8e4[_0xeff8('0x49')];_0x17a39c['predictiveIntervalErlangCallsDroppedCalls']=_0x6bc8e4['predictiveIntervalErlangCallsDroppedCalls'];_0x17a39c['predictiveIntervalHitRate']=_0x6bc8e4[_0xeff8('0x4a')];_0x17a39c[_0xeff8('0x4b')]=_0x6bc8e4[_0xeff8('0x4b')];_0x17a39c[_0xeff8('0x4c')]=_0x6bc8e4[_0xeff8('0x4c')];_0x17a39c['predictiveIntervalAvailable']=_0x6bc8e4[_0xeff8('0x4d')];_0x17a39c[_0xeff8('0x4e')]=_0x6bc8e4['predictiveIntervalTotalCalls'];_0x17a39c['message']=_0x6bc8e4[_0xeff8('0x1a')];_0x17a39c[_0xeff8('0x4f')]=_0x6bc8e4[_0xeff8('0x4f')];_0x17a39c[_0xeff8('0x50')]=_0x6bc8e4['erlangCalls'];_0x17a39c['erlangCallToSecond']=_0x6bc8e4['erlangCallToSecond'];_0x17a39c['erlangAbandonmentRate']=_0x6bc8e4[_0xeff8('0x51')];_0x17a39c['erlangBusyFactor']=_0x6bc8e4[_0xeff8('0x52')];_0x17a39c[_0xeff8('0x53')]=_0x6bc8e4[_0xeff8('0x53')];_0x17a39c['startProgressive']=_0x6bc8e4[_0xeff8('0x54')];}if(_0x6bc8e4[_0xeff8('0x55')]){_0x17a39c[_0xeff8('0x55')]={'id':_0x6bc8e4[_0xeff8('0x55')]['id'],'name':_0x6bc8e4[_0xeff8('0x55')]['name'],'active':_0x6bc8e4[_0xeff8('0x55')][_0xeff8('0x56')],'callerid':_0x6bc8e4[_0xeff8('0x55')][_0xeff8('0x57')]};}if(_0x6bc8e4['Interval']){_0x17a39c[_0xeff8('0x58')]={'id':_0x6bc8e4[_0xeff8('0x58')]['id'],'name':_0x6bc8e4['Interval'][_0xeff8('0xa')]};}_0x820b65[_0xeff8('0x59')](_0x17a39c);}}_0x5728af({'count':_0x820b65[_0xeff8('0x5a')],'rows':_0x820b65});});},'VoiceChannels':function(_0x253dc9){return new Promise(function(_0x2437b1,_0x4b6df7){var _0x52ab1b=_[_0xeff8('0x5b')](_0x38353c[_0xeff8('0x5c')]);_0x2437b1({'count':_0x52ab1b['length'],'rows':_0x52ab1b});});},'VoiceChannelMixMonitor':function(_0x4834c2){var _0x38bbb6=this;return new Promise(function(_0x3d13ee,_0x2a47c7){if(ami[_0xeff8('0x1c')]()==![]){return _0x2a47c7(_0x38bbb6[_0xeff8('0x1b')](0x1f4,[config[_0xeff8('0x10')]['ip'],config[_0xeff8('0x10')][_0xeff8('0x11')],'ami\x20disconnected'][_0xeff8('0x12')]('\x20')));}var _0x10a027=schema(properties[_0xeff8('0x5d')])[_0xeff8('0x5e')](_0x4834c2);if(_0x10a027[_0xeff8('0x5a')]>0x0){return _0x2a47c7(_0x38bbb6['error'](0x1f4,_[_0xeff8('0x5f')](_0x10a027,_0xeff8('0x1a'))['join'](',\x20')));}var _0xc84228=_['find'](_0x38353c[_0xeff8('0x5c')],{'uniqueid':_0x4834c2['uniqueid']});if(_0xc84228&&_0xc84228[_0xeff8('0x60')]){var _0x53b8e8=util[_0xeff8('0x7')]('%s.%s',_0x4834c2[_0xeff8('0x61')]||_0x4834c2[_0xeff8('0x62')],_0x4834c2['format']||_0xeff8('0x63'));return ami[_0xeff8('0x18')]({'action':_0xeff8('0x64'),'channel':_0xc84228[_0xeff8('0x60')],'file':_0x53b8e8,'options':'ai(mixmonitorid)'})[_0xeff8('0x19')](function(_0x3db3d6){var _0xf551dc=_[_0xeff8('0x65')](_0xc84228[_0xeff8('0x66')],{'filename':'/var/spool/asterisk/monitor/'+_0x53b8e8['toLowerCase']()});if(_[_0xeff8('0x67')](_0xf551dc)){_0xc84228[_0xeff8('0x66')][_0xeff8('0x59')]({'filename':'/var/spool/asterisk/monitor/'+_0x53b8e8['toLowerCase'](),'createdAt':moment()[_0xeff8('0x7')](_0xeff8('0x68')),'mixmonitorid':_0x3db3d6[_0xeff8('0x69')],'status':_0xeff8('0x6a')});}else{_0xf551dc[_0xeff8('0x69')]=_0x3db3d6['mixmonitorid'];_0xf551dc[_0xeff8('0x6b')]=_0xeff8('0x6a');}_0x3d13ee({'code':0xc8,'message':[_0x4834c2['uniqueid'],_0xeff8('0x6c'),_0x3db3d6['mixmonitorid']][_0xeff8('0x12')]('\x20'),'mixmonitorid':_0x3db3d6[_0xeff8('0x69')]});})[_0xeff8('0x20')](function(_0x31f63c){_0x2a47c7(_0x38bbb6[_0xeff8('0x1b')](0x1f5,[_0x4834c2[_0xeff8('0x62')],_0x31f63c['message'][_0xeff8('0x6d')]()][_0xeff8('0x12')]('\x20')));});}else{return _0x2a47c7(_0x38bbb6[_0xeff8('0x1b')](0x1f5,_0xeff8('0x6e')));}});},'VoiceChannelStopMixMonitor':function(_0x19d7ae){var _0x5182b5=this;return new Promise(function(_0x435756,_0x253beb){if(ami['isConnected']()==![]){return _0x253beb(_0x5182b5['error'](0x1f4,[config[_0xeff8('0x10')]['ip'],config[_0xeff8('0x10')][_0xeff8('0x11')],_0xeff8('0x6f')][_0xeff8('0x12')]('\x20')));}var _0x34ecfb=schema(properties[_0xeff8('0x5d')])[_0xeff8('0x5e')](_0x19d7ae);if(_0x34ecfb[_0xeff8('0x5a')]>0x0){return _0x253beb(_0x5182b5[_0xeff8('0x1b')](0x1f4,_[_0xeff8('0x5f')](_0x34ecfb,'message')['join'](',\x20')));}var _0x5ebd42=_[_0xeff8('0x65')](_0x38353c['channels'],{'uniqueid':_0x19d7ae[_0xeff8('0x62')]});if(_0x5ebd42){return BPromise[_0xeff8('0x70')]()[_0xeff8('0x19')](function(){if(_0x5ebd42['channel']){return ami[_0xeff8('0x18')]({'action':_0xeff8('0x71'),'channel':_0x5ebd42[_0xeff8('0x60')],'mixmonitorid':_0x19d7ae['mixmonitorid']})[_0xeff8('0x20')](function(_0x5a90f4){});}})[_0xeff8('0x19')](function(){if(_0x5ebd42[_0xeff8('0x72')]){return ami[_0xeff8('0x18')]({'action':_0xeff8('0x71'),'channel':_0x5ebd42[_0xeff8('0x72')],'mixmonitorid':_0x19d7ae[_0xeff8('0x69')]})['catch'](function(_0x1de898){});}})[_0xeff8('0x19')](function(_0x267c16){var _0x5d1cd2=_['find'](_0x5ebd42['monitors'],{'mixmonitorid':_0x19d7ae[_0xeff8('0x69')]});if(_0x5d1cd2){_0x5d1cd2[_0xeff8('0x6b')]=_0xeff8('0x73');}})[_0xeff8('0x19')](function(){var _0x4beffe=util[_0xeff8('0x7')](_0xeff8('0x74'),_0x19d7ae['filename']||_0x19d7ae[_0xeff8('0x62')],_0x19d7ae[_0xeff8('0x7')]||'wav');var _0x39cb83=_['find'](_0x5ebd42['monitors'],{'filename':'/var/spool/asterisk/monitor/'+_0x4beffe[_0xeff8('0x6d')]()});if(_0x39cb83){_0x39cb83['status']=_0xeff8('0x73');}})['then'](function(){_0x435756({'code':0xc8,'message':[_0x19d7ae['uniqueid'],_0xeff8('0x75')]['join']('\x20')});})[_0xeff8('0x20')](function(_0x4b9ae2){_0x253beb(_0x5182b5[_0xeff8('0x1b')](0x1f5,[_0x19d7ae[_0xeff8('0x62')],_0x4b9ae2['message'][_0xeff8('0x6d')]()][_0xeff8('0x12')]('\x20')));});}else{return _0x253beb(_0x5182b5[_0xeff8('0x1b')](0x1f5,'Channel\x20doesn\x27t\x20exist'));}});},'VoiceQueuesChannels':function(_0x2c5aa6){return new Promise(function(_0x1acf44,_0x229fbd){var _0x854121=_[_0xeff8('0x5b')](_0x38353c[_0xeff8('0x76')]);_0x1acf44({'count':_0x854121[_0xeff8('0x5a')],'rows':_0x854121});});},'VoiceQueuesChannel':function(_0x202d62){var _0x2fb582=this;return new Promise(function(_0x1a224d,_0x2902c9){var _0xfd3396=schema(properties['voicequeuechannel'])[_0xeff8('0x5e')](_0x202d62);if(_0xfd3396[_0xeff8('0x5a')]>0x0){return _0x2902c9(_0x2fb582[_0xeff8('0x1b')](0x1f4,_[_0xeff8('0x5f')](_0xfd3396,_0xeff8('0x1a'))[_0xeff8('0x12')](',\x20')));}var _0x244efe=_['find'](_0x38353c['queueChannels'],{'uniqueid':_0x202d62[_0xeff8('0x62')]});if(_0x244efe){_0x1a224d(_0x244efe);}else{return _0x2902c9(_0x2fb582[_0xeff8('0x1b')](0x1f5,'Channel\x20doesn\x27t\x20exist'));}});},'VoiceQueuesChannelHangup':function(_0x2eb570){var _0x8c4997=this;return new Promise(function(_0x414f61,_0x459c4b){if(ami[_0xeff8('0x1c')]()==![]){return _0x459c4b(_0x8c4997[_0xeff8('0x1b')](0x1f4,[config[_0xeff8('0x10')]['ip'],config[_0xeff8('0x10')][_0xeff8('0x11')],_0xeff8('0x6f')][_0xeff8('0x12')]('\x20')));}var _0x5883a1=schema(properties[_0xeff8('0x77')])[_0xeff8('0x5e')](_0x2eb570);if(_0x5883a1[_0xeff8('0x5a')]>0x0){return _0x459c4b(_0x8c4997['error'](0x1f4,_[_0xeff8('0x5f')](_0x5883a1,_0xeff8('0x1a'))[_0xeff8('0x12')](',\x20')));}var _0x42480a=_['find'](_0x38353c[_0xeff8('0x76')],{'uniqueid':_0x2eb570['uniqueid']});if(_0x42480a&&_0x42480a['channel']){return ami[_0xeff8('0x18')]({'action':_0xeff8('0x78'),'channel':_0x42480a['channel']})[_0xeff8('0x19')](function(_0x403092){_0x414f61({'code':0xc8,'message':[_0x2eb570[_0xeff8('0x62')],_0x403092[_0xeff8('0x1a')]['toLowerCase']()][_0xeff8('0x12')]('\x20')});})[_0xeff8('0x20')](function(_0x3e3ae7){_0x459c4b(_0x8c4997[_0xeff8('0x1b')](0x1f5,[_0x2eb570[_0xeff8('0x62')],_0x3e3ae7['message'][_0xeff8('0x6d')]()][_0xeff8('0x12')]('\x20')));});}else{return _0x459c4b(_0x8c4997['error'](0x1f5,_0xeff8('0x6e')));}});},'VoiceQueuesChannelRedirect':function(_0x3423b6){var _0x142dc9=this;return new Promise(function(_0xb5a1ce,_0x546509){if(ami[_0xeff8('0x1c')]()==![]){return _0x546509(_0x142dc9[_0xeff8('0x1b')](0x1f4,[config['asterisk']['ip'],config[_0xeff8('0x10')]['username'],_0xeff8('0x6f')][_0xeff8('0x12')]('\x20')));}var _0x1227ce=schema(properties[_0xeff8('0x79')])[_0xeff8('0x5e')](_0x3423b6);if(_0x1227ce[_0xeff8('0x5a')]>0x0){return _0x546509(_0x142dc9['error'](0x1f4,_[_0xeff8('0x5f')](_0x1227ce,_0xeff8('0x1a'))[_0xeff8('0x12')](',\x20')));}var _0x1e0103=_[_0xeff8('0x65')](_0x38353c[_0xeff8('0x76')],{'uniqueid':_0x3423b6[_0xeff8('0x62')]});if(_0x1e0103&&_0x1e0103['channel']){return ami[_0xeff8('0x18')]({'action':_0xeff8('0x7a'),'channel':_0x1e0103[_0xeff8('0x60')],'exten':_0x3423b6[_0xeff8('0x7b')],'context':_0x3423b6['context']||_0x1e0103[_0xeff8('0x7c')],'priority':0x1})[_0xeff8('0x19')](function(_0x49f6fa){_0xb5a1ce({'code':0xc8,'message':[_0x3423b6[_0xeff8('0x62')],_0x49f6fa[_0xeff8('0x1a')][_0xeff8('0x6d')]()][_0xeff8('0x12')]('\x20')});})[_0xeff8('0x20')](function(_0x3c3bdb){_0x546509(_0x142dc9[_0xeff8('0x1b')](0x1f5,[_0x3423b6['uniqueid'],_0x3c3bdb[_0xeff8('0x1a')]['toLowerCase']()][_0xeff8('0x12')]('\x20')));});}else{return _0x546509(_0x142dc9[_0xeff8('0x1b')](0x1f5,_0xeff8('0x6e')));}});},'Agents':function(_0x281fe6){return new Promise(function(_0x20d859,_0x4da4ca){var _0x42ddd5=_[_0xeff8('0x5b')](_0x38353c['agents']);_0x20d859({'count':_0x42ddd5[_0xeff8('0x5a')],'rows':_0x42ddd5});});},'Telephones':function(_0xa9e0de){return new Promise(function(_0x33a860,_0x530a8e){var _0x291f31=_[_0xeff8('0x5b')](_0x38353c['telephones']);_0x33a860({'count':_0x291f31['length'],'rows':_0x291f31});});},'Trunks':function(_0x280a41){return new Promise(function(_0x577997,_0x3be36f){var _0x651326=_[_0xeff8('0x5b')](_0x38353c[_0xeff8('0x7d')]);_0x577997({'count':_0x651326[_0xeff8('0x5a')],'rows':_0x651326});});},'OutboundChannels':function(_0x320790){return new Promise(function(_0x45f7b9,_0x755ef5){var _0x21e3a4=_['values'](_0x38353c[_0xeff8('0x7e')]);_0x45f7b9({'count':_0x21e3a4['length'],'rows':_0x21e3a4});});},'Outbound':function(_0x219836){return new Promise(function(_0x46f83d,_0x2514af){_0x46f83d(_0x38353c['outbound']);});},'Campaigns':function(_0x1ec481){return new Promise(function(_0x56f2b4,_0x25e8c3){var _0x179ad1=_[_0xeff8('0x5b')](_0x38353c[_0xeff8('0x7f')]);_0x56f2b4({'count':_0x179ad1[_0xeff8('0x5a')],'rows':_0x179ad1});});},'VoiceQueuesPreview':function(_0x47be93){var _0x59e728=this;return new Promise(function(_0x26f675,_0x4972fb){_0x116fee[_0xeff8('0x80')](_0x47be93['id'])[_0xeff8('0x19')](function(_0x637ef7){_0x26f675({'code':0xc8,'message':_0x637ef7[_0xeff8('0x1a')]});})[_0xeff8('0x20')](function(_0x2518b5){_0x4972fb(_0x59e728[_0xeff8('0x1b')](0x1f4,_0x2518b5[_0xeff8('0x1a')]));});});},'EventManager':function(_0xb72ce){var _0x306ea9=this;return new Promise(function(_0x218e1f,_0x56fd61){if(!_0xb72ce[_0xeff8('0x81')]){return _0x56fd61(_0x306ea9[_0xeff8('0x1b')](0x1f4,'Event\x20name\x20mandatory'));}ami[_0xeff8('0x82')](_0xeff8('0x83')+_0xb72ce[_0xeff8('0x81')],_0xb72ce[_0xeff8('0x1a')]);_0x218e1f({'code':0xc8,'message':_0xb72ce});});},'FaxAccounts':function(_0x28309a){return new Promise(function(_0x11c810,_0x28ec7a){var _0x355a94=_[_0xeff8('0x5b')](_0x38353c['faxAccounts']);_0x11c810({'count':_0x355a94[_0xeff8('0x5a')],'rows':_0x355a94});});},'SendFax':function(_0x3265dc){var _0xbb4155=this;return new Promise(function(_0x588f5d,_0x1254e4){_0x5e2ec4['send'](_0x3265dc)[_0xeff8('0x19')](function(_0x3ba1ce){_0x588f5d({'code':0xc8,'message':_0x3ba1ce[_0xeff8('0x1a')]});})[_0xeff8('0x20')](function(_0x563432){_0x1254e4(_0xbb4155[_0xeff8('0x1b')](0x1f4,_0x563432[_0xeff8('0x1a')]));});});},'CheckAfterSend':function(_0x34f975){var _0x18e659=this;return new Promise(function(_0x55cfbb,_0x3f51b1){_0x5e2ec4['checkAfterSend'](_0x34f975)[_0xeff8('0x19')](function(_0x1c6324){_0x55cfbb({'code':0xc8,'message':_0x1c6324['message']});})[_0xeff8('0x20')](function(_0x121cae){_0x3f51b1(_0x18e659[_0xeff8('0x1b')](0x1f4,_0x121cae[_0xeff8('0x1a')]));});});}};var _0x3de173=jayson[_0xeff8('0x84')](_0xcb130b)[_0xeff8('0x85')]();_0x3de173['on'](_0xeff8('0x1b'),function(_0x4a524e){return _0x33302f(_0x4a524e);});_0x3de173[_0xeff8('0x86')](0x232a,_0xeff8('0x87'),function(){console[_0xeff8('0x88')]('AMI\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!',0x232a);return _0x12a2a8(_0xeff8('0x89')+0x232a);});});}; \ No newline at end of file +var _0xd53d=['map','resolve','StopMixMonitor','destinationchannel','stop','filename','queueChannels','voicequeuechannel','voicequeuechannelhangup','Hangup','Redirect','exten','context','telephones','trunks','outboundChannels','campaigns','run','event','Event\x20name\x20mandatory','emit','custom:','faxAccounts','checkAfterSend','server','http','127.0.0.1','log','AMI\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:','util','jayson/promise','validate','bluebird','moment','../properties','listen','format','SIP','name','timers','timer','updateAcw','agents','updateStatusRealtime','pause','isConnected','error','asterisk','username','ami\x20disconnected','module','action','Reload','Action','then','message','catch','command','Command','voiceQueues','hasOwnProperty','strategy','pTalking','sumDuration','sumHoldTime','talking','type','unmanaged','abandoned','waiting','loggedInDb','outbound','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','outboundAnswerAgiCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundReCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalTotalCalls','originated','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','startPredictive','startProgressive','Trunk','active','callerid','Interval','push','length','values','channels','voicechannel','join','find','uniqueid','channel','%s.%s','MixMonitor','ai(mixmonitorid)','monitors','/var/spool/asterisk/monitor/','toLowerCase','isNil','YYYY-MM-DD\x20HH:mm:ss','rec','mixmonitorid','status','MixMonitor\x20Success','Channel\x20doesn\x27t\x20exist'];(function(_0x5a3e41,_0x1cd3af){var _0x5835e0=function(_0x172371){while(--_0x172371){_0x5a3e41['push'](_0x5a3e41['shift']());}};_0x5835e0(++_0x1cd3af);}(_0xd53d,0xa6));var _0xdd53=function(_0x5b86ea,_0x488ce9){_0x5b86ea=_0x5b86ea-0x0;var _0x51dd6e=_0xd53d[_0x5b86ea];return _0x51dd6e;};'use strict';var _=require('lodash');var util=require(_0xdd53('0x0'));var jayson=require(_0xdd53('0x1'));var schema=require(_0xdd53('0x2'));var BPromise=require(_0xdd53('0x3'));var moment=require(_0xdd53('0x4'));var config=require('../../../config/environment');var properties=require(_0xdd53('0x5'));var ami=require('../ami');exports[_0xdd53('0x6')]=function(_0x1c3d3e,_0x1e29f4,_0x1a99f7){return new BPromise(function(_0x105b7b,_0x1b9fcf){var _0x10432f={'QueuePause':function(_0x2b1536){return new Promise(function(_0x4cd643,_0x31f352){var _0x5f3be3=util[_0xdd53('0x7')]('%s/%s',_0xdd53('0x8'),_0x2b1536[_0xdd53('0x9')]);if(_0x1c3d3e[_0xdd53('0xa')]&&_0x1c3d3e[_0xdd53('0xa')][_0x5f3be3]&&_0x1c3d3e[_0xdd53('0xa')][_0x5f3be3][_0xdd53('0xb')]){_0x1c3d3e['timers'][_0x5f3be3][_0xdd53('0xc')]();}if(_0x1c3d3e[_0xdd53('0xd')][_0x5f3be3]){_0x1c3d3e[_0xdd53('0xd')][_0x5f3be3][_0xdd53('0xe')]({'statePause':_0x2b1536[_0xdd53('0xf')]?!![]:![]});}_0x4cd643({'code':0xc8,'message':'QueuePause'});});},'Reload':function(_0x16f5ae){var _0x1a7eb4=this;return new Promise(function(_0x2da250,_0x4feb89){if(ami[_0xdd53('0x10')]()==![]){return _0x4feb89(_0x1a7eb4[_0xdd53('0x11')](0x1f4,[config['asterisk']['ip'],config[_0xdd53('0x12')][_0xdd53('0x13')],_0xdd53('0x14')]['join']('\x20')));}_0x16f5ae=_['pick'](_0x16f5ae,_['keys'](properties[_0xdd53('0x15')]));_0x16f5ae[_0xdd53('0x16')]=_0xdd53('0x17');return ami[_0xdd53('0x18')](_0x16f5ae)[_0xdd53('0x19')](function(_0x336fca){_0x2da250({'code':0xc8,'message':_0x336fca[_0xdd53('0x1a')]});})[_0xdd53('0x1b')](function(_0x1162e1){_0x4feb89(_0x1a7eb4[_0xdd53('0x11')](0x1f5,_0x1162e1[_0xdd53('0x1a')]));});});},'Command':function(_0x313b37){var _0x5c5eb3=this;return new Promise(function(_0x282b67,_0xd81704){if(ami[_0xdd53('0x10')]()==![]){return _0xd81704(_0x5c5eb3[_0xdd53('0x11')](0x1f4,[config[_0xdd53('0x12')]['ip'],config[_0xdd53('0x12')][_0xdd53('0x13')],'ami\x20disconnected']['join']('\x20')));}_0x313b37=_['pick'](_0x313b37,_0xdd53('0x1c'));_0x313b37[_0xdd53('0x16')]=_0xdd53('0x1d');return ami[_0xdd53('0x18')](_0x313b37)[_0xdd53('0x19')](function(_0x249278){_0x282b67({'code':0xc8,'message':_0x249278['content']});})[_0xdd53('0x1b')](function(_0x8d7cd2){_0xd81704(_0x5c5eb3[_0xdd53('0x11')](0x1f5,_0x8d7cd2[_0xdd53('0x1a')]));});});},'VoiceQueues':function(_0x3ff759){return new Promise(function(_0x118d43,_0x829ac2){var _0x2a1f3e=[];for(var _0x608632 in _0x1c3d3e[_0xdd53('0x1e')]){if(_0x1c3d3e['voiceQueues'][_0xdd53('0x1f')](_0x608632)){var _0x22f06c=_0x1c3d3e[_0xdd53('0x1e')][_0x608632];var _0x32314c={'id':_0x22f06c['id'],'name':_0x22f06c[_0xdd53('0x9')],'strategy':_0x22f06c[_0xdd53('0x20')],'answered':_0x22f06c['answered'],'available':_0x22f06c['available'],'loggedIn':_0x22f06c['loggedIn'],'pTalking':_0x22f06c[_0xdd53('0x21')],'sumBillable':_0x22f06c['sumBillable'],'sumDuration':_0x22f06c[_0xdd53('0x22')],'sumHoldTime':_0x22f06c[_0xdd53('0x23')]||0x0,'talking':_0x22f06c[_0xdd53('0x24')],'total':_0x22f06c['total'],'type':_0x22f06c[_0xdd53('0x25')],'unmanaged':_0x22f06c[_0xdd53('0x26')],'abandoned':_0x22f06c[_0xdd53('0x27')],'waiting':_0x22f06c[_0xdd53('0x28')],'loggedInDb':_0x22f06c[_0xdd53('0x29')]};if(_0x22f06c[_0xdd53('0x25')]===_0xdd53('0x2a')){_0x32314c['dialActive']=_0x22f06c['dialActive'];_0x32314c[_0xdd53('0x2b')]=_0x22f06c[_0xdd53('0x2b')];_0x32314c['dialOriginateCallerIdName']=_0x22f06c[_0xdd53('0x2c')];_0x32314c[_0xdd53('0x2d')]=_0x22f06c['dialOriginateCallerIdNumber'];_0x32314c[_0xdd53('0x2e')]=_0x22f06c[_0xdd53('0x2e')];_0x32314c[_0xdd53('0x2f')]=_0x22f06c['dialPrefix'];_0x32314c[_0xdd53('0x30')]=_0x22f06c[_0xdd53('0x30')];_0x32314c['outboundAnswerCallsDay']=_0x22f06c['outboundAnswerCallsDay'];_0x32314c[_0xdd53('0x31')]=_0x22f06c[_0xdd53('0x31')];_0x32314c[_0xdd53('0x32')]=_0x22f06c[_0xdd53('0x32')];_0x32314c[_0xdd53('0x33')]=_0x22f06c[_0xdd53('0x33')];_0x32314c[_0xdd53('0x34')]=_0x22f06c[_0xdd53('0x34')];_0x32314c[_0xdd53('0x35')]=_0x22f06c[_0xdd53('0x35')];_0x32314c[_0xdd53('0x36')]=_0x22f06c[_0xdd53('0x36')];_0x32314c['outboundNoAnswerCallsDay']=_0x22f06c[_0xdd53('0x37')];_0x32314c[_0xdd53('0x38')]=_0x22f06c['outboundNoSuchCallsDay'];_0x32314c[_0xdd53('0x39')]=_0x22f06c[_0xdd53('0x39')];_0x32314c[_0xdd53('0x3a')]=_0x22f06c['outboundReCallsDay'];_0x32314c[_0xdd53('0x3b')]=_0x22f06c[_0xdd53('0x3b')];_0x32314c['outboundUnknownCallsDay']=_0x22f06c[_0xdd53('0x3c')];_0x32314c[_0xdd53('0x3d')]=_0x22f06c[_0xdd53('0x3d')];_0x32314c['predictiveIntervalAvgHoldtime']=_0x22f06c[_0xdd53('0x3e')];_0x32314c[_0xdd53('0x3f')]=_0x22f06c[_0xdd53('0x3f')];_0x32314c[_0xdd53('0x40')]=_0x22f06c['predictiveIntervalDroppedCallsCallersExit'];_0x32314c[_0xdd53('0x41')]=_0x22f06c[_0xdd53('0x41')];_0x32314c[_0xdd53('0x42')]=_0x22f06c[_0xdd53('0x42')];_0x32314c['predictiveIntervalErlangCallsDroppedCalls']=_0x22f06c[_0xdd53('0x43')];_0x32314c['predictiveIntervalHitRate']=_0x22f06c[_0xdd53('0x44')];_0x32314c[_0xdd53('0x45')]=_0x22f06c['predictiveIntervalMultiplicativeFactor'];_0x32314c[_0xdd53('0x46')]=_0x22f06c['predictiveIntervalPauses'];_0x32314c[_0xdd53('0x47')]=_0x22f06c['predictiveIntervalAvailable'];_0x32314c[_0xdd53('0x48')]=_0x22f06c[_0xdd53('0x48')];_0x32314c[_0xdd53('0x1a')]=_0x22f06c[_0xdd53('0x1a')];_0x32314c[_0xdd53('0x49')]=_0x22f06c[_0xdd53('0x49')];_0x32314c[_0xdd53('0x4a')]=_0x22f06c[_0xdd53('0x4a')];_0x32314c['erlangCallToSecond']=_0x22f06c[_0xdd53('0x4b')];_0x32314c[_0xdd53('0x4c')]=_0x22f06c[_0xdd53('0x4c')];_0x32314c[_0xdd53('0x4d')]=_0x22f06c[_0xdd53('0x4d')];_0x32314c[_0xdd53('0x4e')]=_0x22f06c[_0xdd53('0x4e')];_0x32314c['startProgressive']=_0x22f06c[_0xdd53('0x4f')];}if(_0x22f06c[_0xdd53('0x50')]){_0x32314c[_0xdd53('0x50')]={'id':_0x22f06c[_0xdd53('0x50')]['id'],'name':_0x22f06c['Trunk']['name'],'active':_0x22f06c['Trunk'][_0xdd53('0x51')],'callerid':_0x22f06c['Trunk'][_0xdd53('0x52')]};}if(_0x22f06c['Interval']){_0x32314c['Interval']={'id':_0x22f06c[_0xdd53('0x53')]['id'],'name':_0x22f06c['Interval']['name']};}_0x2a1f3e[_0xdd53('0x54')](_0x32314c);}}_0x118d43({'count':_0x2a1f3e[_0xdd53('0x55')],'rows':_0x2a1f3e});});},'VoiceChannels':function(_0x30b0af){return new Promise(function(_0x4531f9,_0x2b68ea){var _0x5a1d6d=_[_0xdd53('0x56')](_0x1c3d3e[_0xdd53('0x57')]);_0x4531f9({'count':_0x5a1d6d[_0xdd53('0x55')],'rows':_0x5a1d6d});});},'VoiceChannelMixMonitor':function(_0x58d49c){var _0x2ae9d1=this;return new Promise(function(_0x3b557f,_0x2348d2){if(ami['isConnected']()==![]){return _0x2348d2(_0x2ae9d1[_0xdd53('0x11')](0x1f4,[config['asterisk']['ip'],config[_0xdd53('0x12')][_0xdd53('0x13')],_0xdd53('0x14')]['join']('\x20')));}var _0x564547=schema(properties[_0xdd53('0x58')])['validate'](_0x58d49c);if(_0x564547[_0xdd53('0x55')]>0x0){return _0x2348d2(_0x2ae9d1['error'](0x1f4,_['map'](_0x564547,_0xdd53('0x1a'))[_0xdd53('0x59')](',\x20')));}var _0x5c6dc5=_[_0xdd53('0x5a')](_0x1c3d3e[_0xdd53('0x57')],{'uniqueid':_0x58d49c[_0xdd53('0x5b')]});if(_0x5c6dc5&&_0x5c6dc5[_0xdd53('0x5c')]){var _0x5535fd=util[_0xdd53('0x7')](_0xdd53('0x5d'),_0x58d49c['filename']||_0x58d49c[_0xdd53('0x5b')],_0x58d49c[_0xdd53('0x7')]||'wav');return ami[_0xdd53('0x18')]({'action':_0xdd53('0x5e'),'channel':_0x5c6dc5[_0xdd53('0x5c')],'file':_0x5535fd,'options':_0xdd53('0x5f')})[_0xdd53('0x19')](function(_0x7f9060){var _0x1752c7=_[_0xdd53('0x5a')](_0x5c6dc5[_0xdd53('0x60')],{'filename':_0xdd53('0x61')+_0x5535fd[_0xdd53('0x62')]()});if(_[_0xdd53('0x63')](_0x1752c7)){_0x5c6dc5['monitors'][_0xdd53('0x54')]({'filename':'/var/spool/asterisk/monitor/'+_0x5535fd[_0xdd53('0x62')](),'createdAt':moment()['format'](_0xdd53('0x64')),'mixmonitorid':_0x7f9060['mixmonitorid'],'status':_0xdd53('0x65')});}else{_0x1752c7[_0xdd53('0x66')]=_0x7f9060['mixmonitorid'];_0x1752c7[_0xdd53('0x67')]=_0xdd53('0x65');}_0x3b557f({'code':0xc8,'message':[_0x58d49c[_0xdd53('0x5b')],_0xdd53('0x68'),_0x7f9060[_0xdd53('0x66')]][_0xdd53('0x59')]('\x20'),'mixmonitorid':_0x7f9060[_0xdd53('0x66')]});})[_0xdd53('0x1b')](function(_0x2f62b1){_0x2348d2(_0x2ae9d1[_0xdd53('0x11')](0x1f5,[_0x58d49c[_0xdd53('0x5b')],_0x2f62b1[_0xdd53('0x1a')][_0xdd53('0x62')]()][_0xdd53('0x59')]('\x20')));});}else{return _0x2348d2(_0x2ae9d1[_0xdd53('0x11')](0x1f5,_0xdd53('0x69')));}});},'VoiceChannelStopMixMonitor':function(_0x1e8cf5){var _0x5aed11=this;return new Promise(function(_0x8a83bc,_0x1bd7ee){if(ami['isConnected']()==![]){return _0x1bd7ee(_0x5aed11[_0xdd53('0x11')](0x1f4,[config[_0xdd53('0x12')]['ip'],config[_0xdd53('0x12')][_0xdd53('0x13')],_0xdd53('0x14')][_0xdd53('0x59')]('\x20')));}var _0x33eda2=schema(properties['voicechannel'])['validate'](_0x1e8cf5);if(_0x33eda2[_0xdd53('0x55')]>0x0){return _0x1bd7ee(_0x5aed11[_0xdd53('0x11')](0x1f4,_[_0xdd53('0x6a')](_0x33eda2,'message')[_0xdd53('0x59')](',\x20')));}var _0x5d95ce=_[_0xdd53('0x5a')](_0x1c3d3e[_0xdd53('0x57')],{'uniqueid':_0x1e8cf5[_0xdd53('0x5b')]});if(_0x5d95ce){return BPromise[_0xdd53('0x6b')]()['then'](function(){if(_0x5d95ce[_0xdd53('0x5c')]){return ami[_0xdd53('0x18')]({'action':_0xdd53('0x6c'),'channel':_0x5d95ce[_0xdd53('0x5c')],'mixmonitorid':_0x1e8cf5['mixmonitorid']})['catch'](function(_0x135de7){});}})[_0xdd53('0x19')](function(){if(_0x5d95ce[_0xdd53('0x6d')]){return ami['Action']({'action':'StopMixMonitor','channel':_0x5d95ce[_0xdd53('0x6d')],'mixmonitorid':_0x1e8cf5[_0xdd53('0x66')]})[_0xdd53('0x1b')](function(_0x3e208d){});}})[_0xdd53('0x19')](function(_0x1f376a){var _0x3652f2=_['find'](_0x5d95ce[_0xdd53('0x60')],{'mixmonitorid':_0x1e8cf5[_0xdd53('0x66')]});if(_0x3652f2){_0x3652f2[_0xdd53('0x67')]=_0xdd53('0x6e');}})['then'](function(){var _0x4e62da=util['format'](_0xdd53('0x5d'),_0x1e8cf5[_0xdd53('0x6f')]||_0x1e8cf5[_0xdd53('0x5b')],_0x1e8cf5[_0xdd53('0x7')]||'wav');var _0x374b29=_[_0xdd53('0x5a')](_0x5d95ce[_0xdd53('0x60')],{'filename':_0xdd53('0x61')+_0x4e62da[_0xdd53('0x62')]()});if(_0x374b29){_0x374b29['status']='stop';}})['then'](function(){_0x8a83bc({'code':0xc8,'message':[_0x1e8cf5[_0xdd53('0x5b')],'StopMixMonitor\x20Success'][_0xdd53('0x59')]('\x20')});})['catch'](function(_0x4e90a1){_0x1bd7ee(_0x5aed11[_0xdd53('0x11')](0x1f5,[_0x1e8cf5[_0xdd53('0x5b')],_0x4e90a1['message'][_0xdd53('0x62')]()][_0xdd53('0x59')]('\x20')));});}else{return _0x1bd7ee(_0x5aed11[_0xdd53('0x11')](0x1f5,_0xdd53('0x69')));}});},'VoiceQueuesChannels':function(_0x2e1307){return new Promise(function(_0x16fa85,_0xcd2e99){var _0x334ce2=_['values'](_0x1c3d3e[_0xdd53('0x70')]);_0x16fa85({'count':_0x334ce2[_0xdd53('0x55')],'rows':_0x334ce2});});},'VoiceQueuesChannel':function(_0x4f31b9){var _0x1c8da4=this;return new Promise(function(_0x142d7e,_0x4b90eb){var _0x464376=schema(properties[_0xdd53('0x71')])['validate'](_0x4f31b9);if(_0x464376[_0xdd53('0x55')]>0x0){return _0x4b90eb(_0x1c8da4['error'](0x1f4,_['map'](_0x464376,_0xdd53('0x1a'))[_0xdd53('0x59')](',\x20')));}var _0x1edba7=_[_0xdd53('0x5a')](_0x1c3d3e[_0xdd53('0x70')],{'uniqueid':_0x4f31b9[_0xdd53('0x5b')]});if(_0x1edba7){_0x142d7e(_0x1edba7);}else{return _0x4b90eb(_0x1c8da4['error'](0x1f5,_0xdd53('0x69')));}});},'VoiceQueuesChannelHangup':function(_0x362ce9){var _0x3927db=this;return new Promise(function(_0x2dac53,_0x576cc8){if(ami[_0xdd53('0x10')]()==![]){return _0x576cc8(_0x3927db[_0xdd53('0x11')](0x1f4,[config[_0xdd53('0x12')]['ip'],config[_0xdd53('0x12')]['username'],_0xdd53('0x14')][_0xdd53('0x59')]('\x20')));}var _0x26059a=schema(properties[_0xdd53('0x72')])['validate'](_0x362ce9);if(_0x26059a[_0xdd53('0x55')]>0x0){return _0x576cc8(_0x3927db[_0xdd53('0x11')](0x1f4,_[_0xdd53('0x6a')](_0x26059a,_0xdd53('0x1a'))[_0xdd53('0x59')](',\x20')));}var _0x1fbd06=_['find'](_0x1c3d3e[_0xdd53('0x70')],{'uniqueid':_0x362ce9[_0xdd53('0x5b')]});if(_0x1fbd06&&_0x1fbd06[_0xdd53('0x5c')]){return ami[_0xdd53('0x18')]({'action':_0xdd53('0x73'),'channel':_0x1fbd06[_0xdd53('0x5c')]})[_0xdd53('0x19')](function(_0x100b6e){_0x2dac53({'code':0xc8,'message':[_0x362ce9[_0xdd53('0x5b')],_0x100b6e[_0xdd53('0x1a')][_0xdd53('0x62')]()][_0xdd53('0x59')]('\x20')});})['catch'](function(_0xf19bec){_0x576cc8(_0x3927db['error'](0x1f5,[_0x362ce9[_0xdd53('0x5b')],_0xf19bec[_0xdd53('0x1a')]['toLowerCase']()][_0xdd53('0x59')]('\x20')));});}else{return _0x576cc8(_0x3927db[_0xdd53('0x11')](0x1f5,'Channel\x20doesn\x27t\x20exist'));}});},'VoiceQueuesChannelRedirect':function(_0x48707f){var _0x4e3f49=this;return new Promise(function(_0x255a8a,_0x40a62c){if(ami[_0xdd53('0x10')]()==![]){return _0x40a62c(_0x4e3f49[_0xdd53('0x11')](0x1f4,[config[_0xdd53('0x12')]['ip'],config[_0xdd53('0x12')][_0xdd53('0x13')],_0xdd53('0x14')][_0xdd53('0x59')]('\x20')));}var _0x3c3dfb=schema(properties['voicequeuechannelredirect'])[_0xdd53('0x2')](_0x48707f);if(_0x3c3dfb['length']>0x0){return _0x40a62c(_0x4e3f49[_0xdd53('0x11')](0x1f4,_['map'](_0x3c3dfb,_0xdd53('0x1a'))['join'](',\x20')));}var _0x4f26cc=_[_0xdd53('0x5a')](_0x1c3d3e[_0xdd53('0x70')],{'uniqueid':_0x48707f[_0xdd53('0x5b')]});if(_0x4f26cc&&_0x4f26cc[_0xdd53('0x5c')]){return ami[_0xdd53('0x18')]({'action':_0xdd53('0x74'),'channel':_0x4f26cc[_0xdd53('0x5c')],'exten':_0x48707f[_0xdd53('0x75')],'context':_0x48707f[_0xdd53('0x76')]||_0x4f26cc['context'],'priority':0x1})['then'](function(_0x50858b){_0x255a8a({'code':0xc8,'message':[_0x48707f[_0xdd53('0x5b')],_0x50858b['message'][_0xdd53('0x62')]()][_0xdd53('0x59')]('\x20')});})[_0xdd53('0x1b')](function(_0x3c0ca2){_0x40a62c(_0x4e3f49[_0xdd53('0x11')](0x1f5,[_0x48707f['uniqueid'],_0x3c0ca2[_0xdd53('0x1a')]['toLowerCase']()][_0xdd53('0x59')]('\x20')));});}else{return _0x40a62c(_0x4e3f49[_0xdd53('0x11')](0x1f5,_0xdd53('0x69')));}});},'Agents':function(_0x413201){return new Promise(function(_0x1d9bed,_0x3f61bd){var _0x4b4038=_[_0xdd53('0x56')](_0x1c3d3e['agents']);_0x1d9bed({'count':_0x4b4038[_0xdd53('0x55')],'rows':_0x4b4038});});},'Telephones':function(_0x492559){return new Promise(function(_0x2e460c,_0x21d11c){var _0x3b8df8=_['values'](_0x1c3d3e[_0xdd53('0x77')]);_0x2e460c({'count':_0x3b8df8[_0xdd53('0x55')],'rows':_0x3b8df8});});},'Trunks':function(_0x180567){return new Promise(function(_0x3a7bbc,_0x33dbc2){var _0x51518e=_[_0xdd53('0x56')](_0x1c3d3e[_0xdd53('0x78')]);_0x3a7bbc({'count':_0x51518e[_0xdd53('0x55')],'rows':_0x51518e});});},'OutboundChannels':function(_0x551a4d){return new Promise(function(_0x126b29,_0x13476e){var _0x2c7003=_[_0xdd53('0x56')](_0x1c3d3e[_0xdd53('0x79')]);_0x126b29({'count':_0x2c7003[_0xdd53('0x55')],'rows':_0x2c7003});});},'Outbound':function(_0x144666){return new Promise(function(_0x25774a,_0x477060){_0x25774a(_0x1c3d3e['outbound']);});},'Campaigns':function(_0x2f701a){return new Promise(function(_0x2fc0fb,_0x97d69e){var _0x58b001=_['values'](_0x1c3d3e[_0xdd53('0x7a')]);_0x2fc0fb({'count':_0x58b001[_0xdd53('0x55')],'rows':_0x58b001});});},'VoiceQueuesPreview':function(_0x54da22){var _0x280f9f=this;return new Promise(function(_0x2ce34f,_0x4b8238){_0x1e29f4[_0xdd53('0x7b')](_0x54da22['id'])['then'](function(_0x143361){_0x2ce34f({'code':0xc8,'message':_0x143361[_0xdd53('0x1a')]});})['catch'](function(_0x412b60){_0x4b8238(_0x280f9f[_0xdd53('0x11')](0x1f4,_0x412b60[_0xdd53('0x1a')]));});});},'EventManager':function(_0x49d2d2){var _0x1343f2=this;return new Promise(function(_0x295728,_0x443403){if(!_0x49d2d2[_0xdd53('0x7c')]){return _0x443403(_0x1343f2[_0xdd53('0x11')](0x1f4,_0xdd53('0x7d')));}ami[_0xdd53('0x7e')](_0xdd53('0x7f')+_0x49d2d2['event'],_0x49d2d2[_0xdd53('0x1a')]);_0x295728({'code':0xc8,'message':_0x49d2d2});});},'FaxAccounts':function(_0x48d3f1){return new Promise(function(_0x5d9631,_0x1ac7b0){var _0x4b1f20=_['values'](_0x1c3d3e[_0xdd53('0x80')]);_0x5d9631({'count':_0x4b1f20['length'],'rows':_0x4b1f20});});},'SendFax':function(_0x2ad10f){var _0x5c045b=this;return new Promise(function(_0x4106e3,_0xd3bb1b){_0x1a99f7['send'](_0x2ad10f)['then'](function(_0x67c247){_0x4106e3({'code':0xc8,'message':_0x67c247[_0xdd53('0x1a')]});})[_0xdd53('0x1b')](function(_0x467b64){_0xd3bb1b(_0x5c045b[_0xdd53('0x11')](0x1f4,_0x467b64[_0xdd53('0x1a')]));});});},'CheckAfterSend':function(_0x3ccfd2){var _0x5da453=this;return new Promise(function(_0x26aeac,_0x31ecf6){_0x1a99f7[_0xdd53('0x81')](_0x3ccfd2)[_0xdd53('0x19')](function(_0x139607){_0x26aeac({'code':0xc8,'message':_0x139607['message']});})[_0xdd53('0x1b')](function(_0x4bfe14){_0x31ecf6(_0x5da453['error'](0x1f4,_0x4bfe14['message']));});});}};var _0x43426b=jayson[_0xdd53('0x82')](_0x10432f)[_0xdd53('0x83')]();_0x43426b['on'](_0xdd53('0x11'),function(_0x253002){return _0x1b9fcf(_0x253002);});_0x43426b[_0xdd53('0x6')](0x232a,_0xdd53('0x84'),function(){console[_0xdd53('0x85')](_0xdd53('0x86'),0x232a);return _0x105b7b(_0xdd53('0x87')+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 84390aa..0b436df 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 _0x2a43=['then','[%s][%s]\x20Contact\x20found:%s','xmd-contactid2','format','trigger:%s','action','[%s][%s]\x20Contact\x20not\x20found','resolve','[%s][%s]\x20Contact\x20created:%s','user:%s','name','toLowerCase','merge','catch','[%s][%s]\x20Error\x20creating\x20contact','[%s][%s]\x20Autocreate\x20disabled','bluebird','util','lodash','ioredis','../../../../config/environment','../../../../config/logger','trigger','../../rpc/cmContact','defaults','redis','localhost','socket.io-emitter','info','[%s][%s]','stringify','autoCreate','data2','data1','isNil','routeId','firstName','calleridname','','calleridnum','destcalleridname','destcalleridnum','uniqueid','phone','showContact','omit'];(function(_0x47e549,_0x2e53d6){var _0x251374=function(_0x400458){while(--_0x400458){_0x47e549['push'](_0x47e549['shift']());}};_0x251374(++_0x2e53d6);}(_0x2a43,0x9a));var _0x32a4=function(_0x5217cf,_0x1b81c0){_0x5217cf=_0x5217cf-0x0;var _0x46b605=_0x2a43[_0x5217cf];return _0x46b605;};'use strict';var BPromise=require(_0x32a4('0x0'));var util=require(_0x32a4('0x1'));var _=require(_0x32a4('0x2'));var Redis=require(_0x32a4('0x3'));var config=require(_0x32a4('0x4'));var logger=require(_0x32a4('0x5'))(_0x32a4('0x6'));var cmContactRpc=require(_0x32a4('0x7'));config['redis']=_[_0x32a4('0x8')](config[_0x32a4('0x9')],{'host':_0x32a4('0xa'),'port':0x18eb});var io=require(_0x32a4('0xb'))(new Redis(config[_0x32a4('0x9')]));function emit(_0x4bf642,_0x34b4dd,_0x1f023d,_0x20535e){logger[_0x32a4('0xc')](_0x32a4('0xd'),_0x4bf642,'',_0x34b4dd,_0x1f023d,JSON[_0x32a4('0xe')](_0x20535e));io['to'](_0x34b4dd)['emit'](_0x1f023d,_0x20535e);}exports['exec']=function(_0x3dd115,_0x54cedc,_0x4fbd93){_0x4fbd93[_0x32a4('0xf')]=0x0;if(_0x54cedc['data2']&&parseInt(_0x54cedc[_0x32a4('0x10')],0xa)){var _0x22de91={'ListId':parseInt(_0x54cedc[_0x32a4('0x11')],0xa),'phone':_0x4fbd93['calleridnum']};if(_[_0x32a4('0x12')](_0x4fbd93[_0x32a4('0x13')])){_0x22de91[_0x32a4('0x14')]=_0x4fbd93[_0x32a4('0x15')]&&_0x4fbd93[_0x32a4('0x15')]!==_0x32a4('0x16')?_0x4fbd93['calleridname']:_0x4fbd93[_0x32a4('0x17')]||_0x4fbd93['uniqueid'];}else{_0x22de91[_0x32a4('0x14')]=_0x4fbd93['destcalleridname']&&_0x4fbd93[_0x32a4('0x18')]!==_0x32a4('0x16')?_0x4fbd93[_0x32a4('0x18')]:_0x4fbd93[_0x32a4('0x19')]||_0x4fbd93[_0x32a4('0x1a')];_0x22de91[_0x32a4('0x1b')]=_0x4fbd93[_0x32a4('0x18')]&&_0x4fbd93['destcalleridname']!==''?_0x4fbd93[_0x32a4('0x18')]:_0x4fbd93[_0x32a4('0x19')]||_0x4fbd93[_0x32a4('0x1a')];}BPromise['resolve']()['then'](cmContactRpc[_0x32a4('0x1c')]({'where':_[_0x32a4('0x1d')](_0x22de91,[_0x32a4('0x14')])}))[_0x32a4('0x1e')](function(_0x36d5a2){if(_0x36d5a2){logger[_0x32a4('0xc')](_0x32a4('0x1f'),_0x4fbd93['uniqueid'],'',_0x36d5a2['id']);if(_0x3dd115){_0x4fbd93[_0x32a4('0x20')]=_0x36d5a2['id'];emit(_0x4fbd93[_0x32a4('0x1a')],util[_0x32a4('0x21')]('user:%s',_0x3dd115['name']),util['format'](_0x32a4('0x22'),_0x54cedc[_0x32a4('0x23')]['toLowerCase']()),_['merge'](_0x4fbd93,{'ListId':parseInt(_0x54cedc[_0x32a4('0x11')],0xa)}));}return;}else{logger['info'](_0x32a4('0x24'),_0x4fbd93[_0x32a4('0x1a')],'');return BPromise[_0x32a4('0x25')]()[_0x32a4('0x1e')](cmContactRpc['createContact'](_0x22de91));}})[_0x32a4('0x1e')](function(_0x294779){if(_0x294779){logger[_0x32a4('0xc')](_0x32a4('0x26'),_0x4fbd93['uniqueid'],'',_0x294779['id']);if(_0x3dd115){_0x4fbd93[_0x32a4('0x20')]=_0x294779['id'];emit(_0x4fbd93[_0x32a4('0x1a')],util[_0x32a4('0x21')](_0x32a4('0x27'),_0x3dd115[_0x32a4('0x28')]),util['format'](_0x32a4('0x22'),_0x54cedc[_0x32a4('0x23')][_0x32a4('0x29')]()),_[_0x32a4('0x2a')](_0x4fbd93,{'ListId':parseInt(_0x54cedc[_0x32a4('0x11')],0xa)}));}}})[_0x32a4('0x2b')](function(_0x44670a){logger['error'](_0x32a4('0x2c'),_0x4fbd93[_0x32a4('0x1a')],'',JSON['stringify'](_0x44670a));});}else{if(_0x3dd115){logger[_0x32a4('0xc')](_0x32a4('0x2d'),_0x4fbd93[_0x32a4('0x1a')],'');emit(_0x4fbd93[_0x32a4('0x1a')],util[_0x32a4('0x21')](_0x32a4('0x27'),_0x3dd115[_0x32a4('0x28')]),util[_0x32a4('0x21')](_0x32a4('0x22'),_0x54cedc[_0x32a4('0x23')]['toLowerCase']()),_[_0x32a4('0x2a')]({'ListId':parseInt(_0x54cedc[_0x32a4('0x11')],0xa)},_0x4fbd93));}}}; \ No newline at end of file +var _0xee9c=['action','merge','data1','createContact','[%s][%s]\x20Contact\x20created:%s','xmd-contactid2','toLowerCase','error','[%s][%s]\x20Error\x20creating\x20contact','stringify','[%s][%s]\x20Autocreate\x20disabled','user:%s','name','util','lodash','ioredis','../../../../config/environment','../../rpc/cmContact','redis','localhost','info','[%s][%s]','emit','exec','autoCreate','data2','calleridnum','isNil','routeId','calleridname','','destcalleridname','destcalleridnum','uniqueid','phone','resolve','then','showContact','omit','firstName','[%s][%s]\x20Contact\x20found:%s','format','trigger:%s'];(function(_0x23cc4b,_0xbb5095){var _0x3d0286=function(_0x16b2b3){while(--_0x16b2b3){_0x23cc4b['push'](_0x23cc4b['shift']());}};_0x3d0286(++_0xbb5095);}(_0xee9c,0x1e6));var _0xcee9=function(_0x22c684,_0x753309){_0x22c684=_0x22c684-0x0;var _0x39fcbb=_0xee9c[_0x22c684];return _0x39fcbb;};'use strict';var BPromise=require('bluebird');var util=require(_0xcee9('0x0'));var _=require(_0xcee9('0x1'));var Redis=require(_0xcee9('0x2'));var config=require(_0xcee9('0x3'));var logger=require('../../../../config/logger')('trigger');var cmContactRpc=require(_0xcee9('0x4'));config[_0xcee9('0x5')]=_['defaults'](config['redis'],{'host':_0xcee9('0x6'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xcee9('0x5')]));function emit(_0x2bc2cb,_0x34819a,_0x58636f,_0x4d1f9a){logger[_0xcee9('0x7')](_0xcee9('0x8'),_0x2bc2cb,'',_0x34819a,_0x58636f,JSON['stringify'](_0x4d1f9a));io['to'](_0x34819a)[_0xcee9('0x9')](_0x58636f,_0x4d1f9a);}exports[_0xcee9('0xa')]=function(_0x3e08b2,_0x13d681,_0x10f960){_0x10f960[_0xcee9('0xb')]=0x0;if(_0x13d681['data2']&&parseInt(_0x13d681[_0xcee9('0xc')],0xa)){var _0x3c28b6={'ListId':parseInt(_0x13d681['data1'],0xa),'phone':_0x10f960[_0xcee9('0xd')]};if(_[_0xcee9('0xe')](_0x10f960[_0xcee9('0xf')])){_0x3c28b6['firstName']=_0x10f960[_0xcee9('0x10')]&&_0x10f960[_0xcee9('0x10')]!==_0xcee9('0x11')?_0x10f960[_0xcee9('0x10')]:_0x10f960[_0xcee9('0xd')]||_0x10f960['uniqueid'];}else{_0x3c28b6['firstName']=_0x10f960[_0xcee9('0x12')]&&_0x10f960[_0xcee9('0x12')]!==_0xcee9('0x11')?_0x10f960[_0xcee9('0x12')]:_0x10f960[_0xcee9('0x13')]||_0x10f960[_0xcee9('0x14')];_0x3c28b6[_0xcee9('0x15')]=_0x10f960[_0xcee9('0x12')]&&_0x10f960[_0xcee9('0x12')]!==_0xcee9('0x11')?_0x10f960[_0xcee9('0x12')]:_0x10f960[_0xcee9('0x13')]||_0x10f960['uniqueid'];}BPromise[_0xcee9('0x16')]()[_0xcee9('0x17')](cmContactRpc[_0xcee9('0x18')]({'where':_[_0xcee9('0x19')](_0x3c28b6,[_0xcee9('0x1a')])}))['then'](function(_0x23c186){if(_0x23c186){logger[_0xcee9('0x7')](_0xcee9('0x1b'),_0x10f960[_0xcee9('0x14')],'',_0x23c186['id']);if(_0x3e08b2){_0x10f960['xmd-contactid2']=_0x23c186['id'];emit(_0x10f960[_0xcee9('0x14')],util[_0xcee9('0x1c')]('user:%s',_0x3e08b2['name']),util[_0xcee9('0x1c')](_0xcee9('0x1d'),_0x13d681[_0xcee9('0x1e')]['toLowerCase']()),_[_0xcee9('0x1f')](_0x10f960,{'ListId':parseInt(_0x13d681[_0xcee9('0x20')],0xa)}));}return;}else{logger[_0xcee9('0x7')]('[%s][%s]\x20Contact\x20not\x20found',_0x10f960[_0xcee9('0x14')],'');return BPromise['resolve']()[_0xcee9('0x17')](cmContactRpc[_0xcee9('0x21')](_0x3c28b6));}})[_0xcee9('0x17')](function(_0x2f0185){if(_0x2f0185){logger[_0xcee9('0x7')](_0xcee9('0x22'),_0x10f960[_0xcee9('0x14')],'',_0x2f0185['id']);if(_0x3e08b2){_0x10f960[_0xcee9('0x23')]=_0x2f0185['id'];emit(_0x10f960[_0xcee9('0x14')],util[_0xcee9('0x1c')]('user:%s',_0x3e08b2['name']),util[_0xcee9('0x1c')]('trigger:%s',_0x13d681[_0xcee9('0x1e')][_0xcee9('0x24')]()),_[_0xcee9('0x1f')](_0x10f960,{'ListId':parseInt(_0x13d681[_0xcee9('0x20')],0xa)}));}}})['catch'](function(_0x277262){logger[_0xcee9('0x25')](_0xcee9('0x26'),_0x10f960['uniqueid'],'',JSON[_0xcee9('0x27')](_0x277262));});}else{if(_0x3e08b2){logger[_0xcee9('0x7')](_0xcee9('0x28'),_0x10f960['uniqueid'],'');emit(_0x10f960[_0xcee9('0x14')],util[_0xcee9('0x1c')](_0xcee9('0x29'),_0x3e08b2[_0xcee9('0x2a')]),util['format'](_0xcee9('0x1d'),_0x13d681[_0xcee9('0x1e')]['toLowerCase']()),_[_0xcee9('0x1f')]({'ListId':parseInt(_0x13d681[_0xcee9('0x20')],0xa)},_0x10f960));}}}; \ No newline at end of file diff --git a/server/services/ami/trigger/index.js b/server/services/ami/trigger/index.js index 5b8f7a4..89bfdd1 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 _0x5a17=['popup','winapp','triggers','agents','voiceQueues','templates','voiceExtensions','zendeskAccounts','freshdeskAccounts','salesforceAccounts','sugarcrmAccounts','zohoAccounts','deskAccounts','vtigerAccounts','servicenowAccounts','dynamics365Accounts','freshsalesAccounts','accounts','custom:agentcalled','syncCustomEvent','bind','custom:agentcomplete','custom:agentnosuchnumber','custom:agentnoanswer','custom:agentbusy','custom:agentcongestion','custom:queuecallerabandon','custom:timeout','custom:dialbegin','custom:dialconnect','syncAgentDial','custom:dialend','custom:newinteraction','custom:closedinteraction','custom:incomingmessage','custom:outgoingmessage','custom:acceptmessage','custom:rejectmessage','prototype','emit','info','stringify','clone','interface','checkTriggers','hasOwnProperty','status','checkTrigger','merge','action','contactmanager','motionbar','browser','data1','TemplateId','html','data2','render','template\x20not\x20found','isNil','data3','location','data4','windowWidth','data5','800','windowHeight','data6','winApplication','winArguments','format','user:%s','trigger:%s:%s','toLowerCase','jscripty','name','trigger:%s','exec','integration','routeId','script','parse','query','search','replace','every','AllConditions','channel','AnyConditions','length','some','checkConditions','field','account','chat','ChatWebsiteId','operator','value','upperFirst','message','event','queue','agent','lastevent','url','ioredis','./urlforward','./integration','trigger','../ami','redis','defaults','localhost','socket.io-emitter'];(function(_0xc848f9,_0x8e51fb){var _0x3436d4=function(_0xd7954a){while(--_0xd7954a){_0xc848f9['push'](_0xc848f9['shift']());}};_0x3436d4(++_0x8e51fb);}(_0x5a17,0xda));var _0x75a1=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x5a17[_0x3dd15e];return _0x231fd0;};'use strict';var util=require('util');var _=require('lodash');var url=require(_0x75a1('0x0'));var Mustache=require('mustache');var Redis=require(_0x75a1('0x1'));var urlforward=require(_0x75a1('0x2'));var integration=require(_0x75a1('0x3'));var cmContact=require('./cmContact');var script=require('./script');var cmContactRpc=require('../rpc/cmContact');var config=require('../../../config/environment');var logger=require('../../../config/logger')(_0x75a1('0x4'));var ami=require(_0x75a1('0x5'));config[_0x75a1('0x6')]=_[_0x75a1('0x7')](config['redis'],{'host':_0x75a1('0x8'),'port':0x18eb});var io=require(_0x75a1('0x9'))(new Redis(config[_0x75a1('0x6')]));var operators={'equals':function(_0xf6856a,_0x5b0a5c){return _0xf6856a==_0x5b0a5c;},'not_equals':function(_0x125d1e,_0x32cf5c){return _0x125d1e!=_0x32cf5c;}};var barAndWebActions=[_0x75a1('0xa'),_0x75a1('0x0'),_0x75a1('0xb')];function Trigger(_0x42157b){this[_0x75a1('0xc')]=_0x42157b[_0x75a1('0xc')];this[_0x75a1('0xd')]=_0x42157b[_0x75a1('0xd')];this['voiceQueues']=_0x42157b[_0x75a1('0xe')];this[_0x75a1('0xf')]=_0x42157b[_0x75a1('0xf')];this[_0x75a1('0x10')]=_0x42157b[_0x75a1('0x10')];this[_0x75a1('0x11')]=_0x42157b['zendeskAccounts'];this[_0x75a1('0x12')]=_0x42157b['freshdeskAccounts'];this['salesforceAccounts']=_0x42157b[_0x75a1('0x13')];this[_0x75a1('0x14')]=_0x42157b[_0x75a1('0x14')];this['zohoAccounts']=_0x42157b[_0x75a1('0x15')];this[_0x75a1('0x16')]=_0x42157b['deskAccounts'];this[_0x75a1('0x17')]=_0x42157b['vtigerAccounts'];this['servicenowAccounts']=_0x42157b[_0x75a1('0x18')];this[_0x75a1('0x19')]=_0x42157b[_0x75a1('0x19')];this[_0x75a1('0x1a')]=_0x42157b[_0x75a1('0x1a')];this[_0x75a1('0x1b')]={'zendesk':this['zendeskAccounts'],'salesforce':this[_0x75a1('0x13')],'freshdesk':this[_0x75a1('0x12')],'sugarcrm':this[_0x75a1('0x14')],'zoho':this['zohoAccounts'],'desk':this[_0x75a1('0x16')],'vtiger':this['vtigerAccounts'],'dynamics365':this[_0x75a1('0x19')],'freshsales':this[_0x75a1('0x1a')],'servicenow':this['servicenowAccounts']};ami['on'](_0x75a1('0x1c'),this[_0x75a1('0x1d')][_0x75a1('0x1e')](this));ami['on']('custom:agentconnect',this[_0x75a1('0x1d')][_0x75a1('0x1e')](this));ami['on']('custom:agentringnoanswer',this[_0x75a1('0x1d')][_0x75a1('0x1e')](this));ami['on'](_0x75a1('0x1f'),this[_0x75a1('0x1d')][_0x75a1('0x1e')](this));ami['on'](_0x75a1('0x20'),this[_0x75a1('0x1d')][_0x75a1('0x1e')](this));ami['on'](_0x75a1('0x21'),this['syncCustomEvent'][_0x75a1('0x1e')](this));ami['on'](_0x75a1('0x22'),this[_0x75a1('0x1d')][_0x75a1('0x1e')](this));ami['on'](_0x75a1('0x23'),this[_0x75a1('0x1d')]['bind'](this));ami['on']('custom:agentreject',this['syncCustomEvent']['bind'](this));ami['on'](_0x75a1('0x24'),this[_0x75a1('0x1d')][_0x75a1('0x1e')](this));ami['on'](_0x75a1('0x25'),this[_0x75a1('0x1d')]['bind'](this));ami['on'](_0x75a1('0x26'),this['syncAgentDial'][_0x75a1('0x1e')](this));ami['on'](_0x75a1('0x27'),this[_0x75a1('0x28')][_0x75a1('0x1e')](this));ami['on'](_0x75a1('0x29'),this[_0x75a1('0x28')]['bind'](this));ami['on'](_0x75a1('0x2a'),this[_0x75a1('0x1d')][_0x75a1('0x1e')](this));ami['on'](_0x75a1('0x2b'),this[_0x75a1('0x1d')][_0x75a1('0x1e')](this));ami['on'](_0x75a1('0x2c'),this[_0x75a1('0x1d')][_0x75a1('0x1e')](this));ami['on'](_0x75a1('0x2d'),this[_0x75a1('0x1d')][_0x75a1('0x1e')](this));ami['on'](_0x75a1('0x2e'),this[_0x75a1('0x1d')]['bind'](this));ami['on'](_0x75a1('0x2f'),this[_0x75a1('0x1d')][_0x75a1('0x1e')](this));}Trigger[_0x75a1('0x30')][_0x75a1('0x31')]=function(_0x5226f6,_0x421a28,_0x555e18){logger[_0x75a1('0x32')](_0x5226f6,_0x421a28,JSON[_0x75a1('0x33')](_0x555e18));io['to'](_0x5226f6)[_0x75a1('0x31')](_0x421a28,_0x555e18);};Trigger[_0x75a1('0x30')][_0x75a1('0x1d')]=function(_0x95a2ca){var _0x32483c=_[_0x75a1('0x34')](_0x95a2ca);this['checkTriggers'](_0x32483c);};Trigger[_0x75a1('0x30')][_0x75a1('0x28')]=function(_0x1bc659){if(this[_0x75a1('0xd')][_0x1bc659[_0x75a1('0x35')]]){this[_0x75a1('0x1d')](_0x1bc659);}};Trigger[_0x75a1('0x30')][_0x75a1('0x36')]=function(_0x45e49a){var _0x40e199;for(var _0x8a28c0 in this[_0x75a1('0xc')]){if(this['triggers'][_0x75a1('0x37')](_0x8a28c0)){if(this[_0x75a1('0xc')][_0x8a28c0][_0x75a1('0x38')]){_0x40e199=this[_0x75a1('0x39')](this[_0x75a1('0xc')][_0x8a28c0],_0x45e49a);if(_0x40e199){_[_0x75a1('0x3a')](_0x45e49a,_0x45e49a['variables']);for(var _0x2e4337=0x0,_0x4e8cad,_0x44ac97,_0x209d98;_0x2e43370x0){_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(_0x5783f4,_0x4a9e0a){var _0x28e380=function(_0x1ffc49){while(--_0x1ffc49){_0x5783f4['push'](_0x5783f4['shift']());}};_0x28e380(++_0x4a9e0a);}(_0xa9e0,0x123));var _0x0a9e=function(_0x29b609,_0x19d388){_0x29b609=_0x29b609-0x0;var _0x54c952=_0xa9e0[_0x29b609];return _0x54c952;};'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 47f8e95..763f652 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 _0x3db4=['recordingFormat','none','[OUTBOUND]',']\x20The\x20Enduser\x20phone\x20is:',']\x20The\x20%s\x20ID\x20is:\x20%s',']\x20Call\x20direction:\x20%s','Displaying\x20call\x20in\x20a\x20new\x20tab...','inspect','lodash','bluebird','request-promise','util','./util','md5','ioredis','../../../../config/logger','../../../../config/environment','redis','localhost','POST','clientId','remoteUri','username','password','clientSecret','then','catch','toUpperCase',']\x20Wrong\x20credentials!','message','GET','systemusers?$select=internalemailaddress,isdisabled,systemuserid','Bearer\x20','4.0','value','isNil','validateEmail','email','userEmail','length','isdisabled','info',']\x20Agent\x20found\x20','systemuserid',']\x20Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','userId','toLowerCase','destcalleridnum','calleridnum','contacts','/systemusers(','odata-entityid','substring','lastIndexOf','enduserId','contacts?$select=telephone1','telephone1','contactid',']\x20Enduser\x20created!',']\x20Enduser\x20Created!','forEach','type','nameField','customField','idField','indexOf','content','ticketType','incident','incidents','assign','Subjects','getString','Descriptions','/contacts(','Fields','phonecalls','callDirection','queue','headers','ticketId','format','%s/main.aspx?pagetype=entityrecord&etn=%s&id=%s','user:%s','emit','stripTrailingSlash','serverUrl','unmanaged','outbound','%s/api/data/v9.0/','tenantId','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL'];(function(_0xd8f696,_0x44ea51){var _0x408d82=function(_0x1616f1){while(--_0x1616f1){_0xd8f696['push'](_0xd8f696['shift']());}};_0x408d82(++_0x44ea51);}(_0x3db4,0x1ed));var _0x43db=function(_0x1f182b,_0x29eff5){_0x1f182b=_0x1f182b-0x0;var _0x4f602e=_0x3db4[_0x1f182b];return _0x4f602e;};'use strict';var _=require(_0x43db('0x0'));var BPromise=require(_0x43db('0x1'));var rp=require(_0x43db('0x2'));var util=require(_0x43db('0x3'));var intUtil=require(_0x43db('0x4'));var md5=require(_0x43db('0x5'));var Redis=require(_0x43db('0x6'));var logger=require(_0x43db('0x7'))('dynamics365');var config=require(_0x43db('0x8'));config[_0x43db('0x9')]=_['defaults'](config[_0x43db('0x9')],{'host':_0x43db('0xa'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x43db('0x9')]));function getAuthToken(_0x264da7,_0x5b902c,_0x3704a9){var _0x551fd7={'method':_0x43db('0xb'),'uri':_0x5b902c,'form':{'client_id':_0x264da7[_0x43db('0xc')],'resource':_0x264da7[_0x43db('0xd')],'username':_0x264da7[_0x43db('0xe')],'password':_0x264da7[_0x43db('0xf')],'grant_type':_0x43db('0xf'),'client_secret':_0x264da7[_0x43db('0x10')]},'json':!![]};return rp(_0x551fd7)[_0x43db('0x11')](function(_0xa58bbf){return _0xa58bbf['access_token'];})[_0x43db('0x12')](function(_0x5b3d3f){logger['error']('['+[_0x3704a9[_0x43db('0x13')]()]+_0x43db('0x14'));return _0x5b3d3f[_0x43db('0x15')];});}function getUser(_0x37ca3f,_0x13646a,_0x444c1c,_0x3a9540,_0x19c5b8,_0x5d9db6){return new BPromise(function(_0x41f167,_0x1b895a){return getAuthToken(_0x13646a,_0x3a9540,_0x5d9db6)['then'](function(_0x2cf016){var _0x3c74e9={'method':_0x43db('0x16'),'uri':_0x19c5b8+_0x43db('0x17'),'headers':{'Authorization':_0x43db('0x18')+_0x2cf016,'OData-Version':_0x43db('0x19')},'json':!![]};return rp(_0x3c74e9);})['then'](function(_0x2e2f0d){var _0x14ad2d=_0x2e2f0d[_0x43db('0x1a')];var _0x28219b=![];var _0x46fbb1=null;if(!_[_0x43db('0x1b')](_0x444c1c)){if(intUtil[_0x43db('0x1c')](_0x444c1c[_0x43db('0x1d')])){_0x37ca3f[_0x43db('0x1e')]=_0x444c1c[_0x43db('0x1d')];for(_0x46fbb1=0x0;_0x46fbb1<_0x14ad2d[_0x43db('0x1f')];_0x46fbb1++){if(_0x14ad2d[_0x46fbb1]['internalemailaddress']===_0x444c1c[_0x43db('0x1d')]&&!_0x14ad2d[_0x46fbb1][_0x43db('0x20')]){_0x28219b=!![];logger[_0x43db('0x21')]('['+[_0x5d9db6['toUpperCase']()]+_0x43db('0x22')+_0x14ad2d[_0x46fbb1][_0x43db('0x23')]+'!');_0x37ca3f['userId']=_0x14ad2d[_0x46fbb1][_0x43db('0x23')];}}}}if(!_0x28219b){logger[_0x43db('0x21')]('['+[_0x5d9db6[_0x43db('0x13')]()]+_0x43db('0x24'));_0x37ca3f[_0x43db('0x1e')]=_0x13646a[_0x43db('0xe')];for(_0x46fbb1=0x0;_0x46fbb1<_0x14ad2d['length'];_0x46fbb1++){if(_0x14ad2d[_0x46fbb1]['internalemailaddress']===_0x13646a[_0x43db('0xe')]){_0x37ca3f[_0x43db('0x25')]=_0x14ad2d[_0x46fbb1][_0x43db('0x23')];}}}_0x41f167(_0x37ca3f);})[_0x43db('0x12')](function(_0x1c77f0){_0x1b895a(_0x1c77f0[_0x43db('0x15')]);});});}function createEndUser(_0x34d25b,_0x48d7cd,_0x29e1d2,_0x19e550,_0x449c60,_0x4c1b4f){return new BPromise(function(_0x375c02,_0x8db51f){return getAuthToken(_0x48d7cd,_0x29e1d2,_0x4c1b4f)[_0x43db('0x11')](function(_0xe9ae82){var _0x31600f=_0x4c1b4f[_0x43db('0x26')]()==='outbound'?_0x449c60[_0x43db('0x27')]:_0x449c60[_0x43db('0x28')];var _0x2b3c05={'method':_0x43db('0xb'),'uri':_0x19e550+_0x43db('0x29'),'body':{'telephone1':_0x31600f,'fullname':_0x31600f,'firstname':_0x31600f,'lastname':'_','mobilephone':null,'address1_telephone1':null,'ownerid@odata.bind':_0x43db('0x2a')+_0x34d25b[_0x43db('0x25')]+')'},'headers':{'Authorization':_0x43db('0x18')+_0xe9ae82,'OData-Version':_0x43db('0x19')},'json':!![],'resolveWithFullResponse':!![]};return rp(_0x2b3c05);})[_0x43db('0x11')](function(_0x3ffed7){var _0x3201f1=_0x3ffed7['headers'][_0x43db('0x2b')];var _0x38a2a8=_0x3201f1[_0x43db('0x2c')](_0x3201f1[_0x43db('0x2d')]('(')+0x1,_0x3201f1[_0x43db('0x2d')](')'));_0x34d25b[_0x43db('0x2e')]=_0x38a2a8;_0x375c02(_0x34d25b);})['catch'](function(_0xc90ab5){_0x8db51f(_0xc90ab5[_0x43db('0x15')]);});});}function getEndUser(_0x35a91a,_0x3746d7,_0x44e1d8,_0x364302,_0x59e1da,_0xc219d){return new BPromise(function(_0x11c24f,_0x4b240a){return getAuthToken(_0x3746d7,_0x44e1d8,_0xc219d)[_0x43db('0x11')](function(_0x361727){var _0x28c9d4={'method':'GET','uri':_0x364302+_0x43db('0x2f'),'headers':{'Authorization':_0x43db('0x18')+_0x361727,'If-None-Match':null,'OData-Version':_0x43db('0x19')},'json':!![]};return rp(_0x28c9d4);})[_0x43db('0x11')](function(_0x26297c){var _0x2d2062=null;if(_0x26297c){var _0x3b68e9=_0x26297c[_0x43db('0x1a')];var _0x15d401=![];for(_0x2d2062=0x0;_0x2d2062<_0x3b68e9[_0x43db('0x1f')];_0x2d2062++){var _0x929345=_0xc219d[_0x43db('0x26')]()==='outbound'?_0x59e1da[_0x43db('0x27')]:_0x59e1da[_0x43db('0x28')];if(_0x3b68e9[_0x2d2062][_0x43db('0x30')]===_0x929345){_0x15d401=!![];_0x35a91a[_0x43db('0x2e')]=_0x3b68e9[_0x2d2062][_0x43db('0x31')];}}if(_0x15d401){_0x11c24f(_0x35a91a);}else{return createEndUser(_0x35a91a,_0x3746d7,_0x44e1d8,_0x364302,_0x59e1da,_0xc219d)[_0x43db('0x11')](function(_0x178f67){logger['info']('['+[_0xc219d[_0x43db('0x13')]()]+_0x43db('0x32'),_0x178f67[_0x43db('0x2e')]);_0x11c24f(_0x178f67);});}}else{return createEndUser(_0x35a91a,_0x3746d7,_0x44e1d8,_0x364302,_0x59e1da,_0xc219d)[_0x43db('0x11')](function(_0x8e04ee){logger[_0x43db('0x21')]('['+[_0xc219d[_0x43db('0x13')]()]+_0x43db('0x33'),_0x8e04ee[_0x43db('0x2e')]);_0x11c24f(_0x8e04ee);});}});});}function getCustomFields(_0x589b00,_0x31a9c,_0x250eeb){var _0x56aa72={};if(_0x589b00[_0x43db('0x1f')]>0x0){_[_0x43db('0x34')](_0x589b00,function(_0x41d185){if(_0x41d185[_0x43db('0x35')]==='string'&&_0x41d185[_0x43db('0x36')]&&!_0x41d185[_0x43db('0x37')]){var _0x47deb8=_0x41d185[_0x43db('0x38')][_0x43db('0x26')]();var _0x1b81ea=_0x47deb8[_0x43db('0x2c')](0x0,_0x47deb8[_0x43db('0x39')]('_'));var _0x5674d6=_0x47deb8['substring'](_0x47deb8[_0x43db('0x39')]('_')+0x1);if(_0x1b81ea===_0x250eeb){_0x56aa72[_0x5674d6]=_0x41d185[_0x43db('0x3a')];}}});}return _0x56aa72;}function getTicket(_0x2832fe,_0x202a98,_0x28c87a,_0x874447,_0x3ab231,_0x59464e,_0x2b9c51){return new BPromise(function(_0x3d3eb8,_0xb3d68c){var _0x4a20a4;return getAuthToken(_0x202a98,_0x28c87a,_0x2b9c51)['then'](function(_0x11a2ed){if(_0x59464e[_0x43db('0x3b')]===_0x43db('0x3c')){_0x4a20a4={'method':'POST','uri':_0x874447+_0x43db('0x3d'),'body':Object[_0x43db('0x3e')]({},{'title':intUtil['getString'](_0x59464e[_0x43db('0x3f')],_0x3ab231,'\x20'),'description':intUtil[_0x43db('0x40')](_0x59464e[_0x43db('0x41')],_0x3ab231,'\x0a'),'customerid_contact@odata.bind':_0x43db('0x42')+_0x2832fe[_0x43db('0x2e')]+')','ownerid@odata.bind':_0x43db('0x2a')+_0x2832fe[_0x43db('0x25')]+')','caseorigincode':'1'},getCustomFields(_0x59464e[_0x43db('0x43')],_0x3ab231,_0x59464e[_0x43db('0x3b')])),'headers':{'Authorization':_0x43db('0x18')+_0x11a2ed,'OData-Version':_0x43db('0x19')},'json':!![],'resolveWithFullResponse':!![]};}if(_0x59464e['ticketType']==='phonecall'){_0x4a20a4={'method':_0x43db('0xb'),'uri':_0x874447+_0x43db('0x44'),'body':Object[_0x43db('0x3e')]({},{'subject':intUtil[_0x43db('0x40')](_0x59464e['Subjects'],_0x3ab231,'\x20'),'phonenumber':String(_0x3ab231['calleridnum']),'description':intUtil[_0x43db('0x40')](_0x59464e[_0x43db('0x41')],_0x3ab231,'\x0a'),'regardingobjectid_contact@odata.bind':_0x43db('0x42')+_0x2832fe[_0x43db('0x2e')]+')','ownerid@odata.bind':'/systemusers('+_0x2832fe['userId']+')','directioncode':_0x2832fe[_0x43db('0x45')]===_0x43db('0x46')?![]:!![],'phonecall_activity_parties':[{'partyid_systemuser@odata.bind':'/systemusers('+_0x2832fe['userId']+')','participationtypemask':_0x2832fe[_0x43db('0x45')]===_0x43db('0x46')?0x2:0x1},{'partyid_contact@odata.bind':_0x43db('0x42')+_0x2832fe[_0x43db('0x2e')]+')','participationtypemask':_0x2832fe[_0x43db('0x45')]===_0x43db('0x46')?0x1:0x2}]},getCustomFields(_0x59464e[_0x43db('0x43')],_0x3ab231,_0x59464e['ticketType'])),'headers':{'Authorization':_0x43db('0x18')+_0x11a2ed,'OData-Version':_0x43db('0x19')},'json':!![],'resolveWithFullResponse':!![]};}return rp(_0x4a20a4);})['then'](function(_0x122a83){var _0x4d7cf6=_0x122a83[_0x43db('0x47')][_0x43db('0x2b')];var _0xeb4fe1=_0x4d7cf6['substring'](_0x4d7cf6[_0x43db('0x2d')]('(')+0x1,_0x4d7cf6[_0x43db('0x2d')](')'));_0x2832fe[_0x43db('0x48')]=_0xeb4fe1;_0x3d3eb8(_0x2832fe);})[_0x43db('0x12')](function(_0x4e5618){_0xb3d68c(_0x4e5618[_0x43db('0x15')]);});});}function emit(_0x39906d,_0x2be0aa,_0x17e315,_0x44b33e){var _0x1764ad={'uri':util[_0x43db('0x49')](_0x43db('0x4a'),_0x39906d,_0x17e315,_0x44b33e)};io['to'](util[_0x43db('0x49')](_0x43db('0x4b'),_0x2be0aa))[_0x43db('0x4c')]('trigger:browser:url',_0x1764ad);}exports['cs']=function(_0x4ae0a6,_0x1653d2,_0x34fef0,_0x4693e2,_0x795934,_0x3e1bc9,_0x350838,_0x4a0188){var _0x1b4e5b={};_0x3e1bc9[_0x43db('0xd')]=intUtil[_0x43db('0x4d')](_0x3e1bc9[_0x43db('0xd')]);_0x3e1bc9[_0x43db('0x4e')]=intUtil[_0x43db('0x4d')](_0x3e1bc9[_0x43db('0x4e')]);_0x1b4e5b[_0x43db('0x45')]=_0x4a0188===_0x43db('0x46')||_0x4a0188===_0x43db('0x4f')?_0x43db('0x46'):_0x43db('0x50');var _0x56ba90=util[_0x43db('0x49')](_0x43db('0x51'),_0x3e1bc9[_0x43db('0xd')]);var _0x472b75=util[_0x43db('0x49')]('https://login.microsoftonline.com/%s/oauth2/token',_0x3e1bc9[_0x43db('0x52')]);var _0x3fe2fa=util['format'](_0x43db('0x53'),_0x3e1bc9[_0x43db('0x4e')],_0x1653d2[_0x43db('0x54')],md5(_0x1653d2[_0x43db('0x54')]));if(_0x795934&&_0x795934[_0x43db('0x55')]){logger['info'](_0x43db('0x56'),_0x43db('0x57'));_0x1653d2[_0x43db('0x58')]=_0x3fe2fa;}else if(_0x350838&&_0x350838[_0x43db('0x59')]&&_0x350838[_0x43db('0x59')]!==_0x43db('0x5a')){logger[_0x43db('0x21')](_0x43db('0x5b'),'Recording\x20is\x20enabled!');_0x1653d2[_0x43db('0x58')]=_0x3fe2fa;}else{_0x1653d2[_0x43db('0x58')]='';}return getUser(_0x1b4e5b,_0x3e1bc9,_0x4693e2,_0x472b75,_0x56ba90,_0x4a0188)['then'](function(_0x10009f){logger['info']('['+_0x4a0188[_0x43db('0x13')]()+']\x20The\x20User\x20ID\x20is:',_0x10009f[_0x43db('0x25')]);logger['info']('['+_0x4a0188['toUpperCase']()+']\x20The\x20User\x20email\x20is:',_0x10009f['userEmail']);return getEndUser(_0x10009f,_0x3e1bc9,_0x472b75,_0x56ba90,_0x1653d2,_0x4a0188);})[_0x43db('0x11')](function(_0x406bec){logger['info']('['+_0x4a0188[_0x43db('0x13')]()+']\x20The\x20Enduser\x20ID\x20is:',_0x406bec[_0x43db('0x2e')]);logger[_0x43db('0x21')]('['+_0x4a0188[_0x43db('0x13')]()+_0x43db('0x5c'),_0x1653d2['calleridnum']);return getTicket(_0x406bec,_0x3e1bc9,_0x472b75,_0x56ba90,_0x1653d2,_0x34fef0,_0x4a0188);})['then'](function(_0x2cdeec){logger['info'](util[_0x43db('0x49')]('['+_0x4a0188[_0x43db('0x13')]()+_0x43db('0x5d'),_0x34fef0['ticketType'],_0x2cdeec[_0x43db('0x48')]));logger[_0x43db('0x21')](util[_0x43db('0x49')]('['+_0x4a0188[_0x43db('0x13')]()+_0x43db('0x5e'),_0x4a0188));if(_0x4a0188!=='unmanaged'){logger['info']('['+_0x4a0188[_0x43db('0x13')]()+']',_0x43db('0x5f'));emit(_0x3e1bc9['remoteUri'],_0x4693e2['name'],_0x34fef0[_0x43db('0x3b')],_0x2cdeec[_0x43db('0x48')]);}})['catch'](function(_0x54dd1d){logger['error']('['+_0x4a0188[_0x43db('0x13')]()+']\x20Error\x20running\x20Dynamics365\x20integration',util[_0x43db('0x60')](_0x54dd1d,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0x3303=['value','isNil','validateEmail','email','userEmail','length','info',']\x20Agent\x20found\x20','systemuserid','userId','toUpperCase',']\x20Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','username','internalemailaddress','message','toLowerCase','destcalleridnum','POST','contacts','/systemusers(','Bearer\x20','headers','odata-entityid','substring','lastIndexOf','enduserId','4.0','outbound','telephone1',']\x20Enduser\x20Created!','forEach','type','nameField','customField','idField','indexOf','content','ticketType','assign','getString','/contacts(','Fields','phonecalls','Subjects','calleridnum','Descriptions','callDirection','queue','format','%s/main.aspx?pagetype=entityrecord&etn=%s&id=%s','trigger:browser:url','stripTrailingSlash','serverUrl','unmanaged','%s/api/data/v9.0/','https://login.microsoftonline.com/%s/oauth2/token','tenantId','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','Recording\x20is\x20enabled!','recordingURL','recordingFormat','none','[OUTBOUND]',']\x20The\x20User\x20ID\x20is:',']\x20The\x20Enduser\x20ID\x20is:',']\x20The\x20%s\x20ID\x20is:\x20%s','ticketId',']\x20Call\x20direction:\x20%s','Displaying\x20call\x20in\x20a\x20new\x20tab...','name','inspect','request-promise','util','./util','md5','ioredis','../../../../config/logger','dynamics365','../../../../config/environment','redis','localhost','socket.io-emitter','remoteUri','password','clientSecret','access_token','catch','error','GET','systemusers?$select=internalemailaddress,isdisabled,systemuserid','then'];(function(_0x222aee,_0x12e6d9){var _0x1c3f37=function(_0x5872cc){while(--_0x5872cc){_0x222aee['push'](_0x222aee['shift']());}};_0x1c3f37(++_0x12e6d9);}(_0x3303,0x103));var _0x3330=function(_0x59026e,_0x3a36cb){_0x59026e=_0x59026e-0x0;var _0xe9c58b=_0x3303[_0x59026e];return _0xe9c58b;};'use strict';var _=require('lodash');var BPromise=require('bluebird');var rp=require(_0x3330('0x0'));var util=require(_0x3330('0x1'));var intUtil=require(_0x3330('0x2'));var md5=require(_0x3330('0x3'));var Redis=require(_0x3330('0x4'));var logger=require(_0x3330('0x5'))(_0x3330('0x6'));var config=require(_0x3330('0x7'));config['redis']=_['defaults'](config[_0x3330('0x8')],{'host':_0x3330('0x9'),'port':0x18eb});var io=require(_0x3330('0xa'))(new Redis(config['redis']));function getAuthToken(_0x16e64e,_0xa68c3e,_0x36b88a){var _0x3d0ebe={'method':'POST','uri':_0xa68c3e,'form':{'client_id':_0x16e64e['clientId'],'resource':_0x16e64e[_0x3330('0xb')],'username':_0x16e64e['username'],'password':_0x16e64e[_0x3330('0xc')],'grant_type':'password','client_secret':_0x16e64e[_0x3330('0xd')]},'json':!![]};return rp(_0x3d0ebe)['then'](function(_0x3db810){return _0x3db810[_0x3330('0xe')];})[_0x3330('0xf')](function(_0x29d33e){logger[_0x3330('0x10')]('['+[_0x36b88a['toUpperCase']()]+']\x20Wrong\x20credentials!');return _0x29d33e['message'];});}function getUser(_0x337f9a,_0x2f71ed,_0x27491b,_0x295768,_0x1377de,_0x1158a5){return new BPromise(function(_0x74cb8,_0x25c469){return getAuthToken(_0x2f71ed,_0x295768,_0x1158a5)['then'](function(_0x1a116c){var _0x3afcf1={'method':_0x3330('0x11'),'uri':_0x1377de+_0x3330('0x12'),'headers':{'Authorization':'Bearer\x20'+_0x1a116c,'OData-Version':'4.0'},'json':!![]};return rp(_0x3afcf1);})[_0x3330('0x13')](function(_0x1f1cea){var _0x4d2146=_0x1f1cea[_0x3330('0x14')];var _0x2d877f=![];var _0x23c867=null;if(!_[_0x3330('0x15')](_0x27491b)){if(intUtil[_0x3330('0x16')](_0x27491b[_0x3330('0x17')])){_0x337f9a[_0x3330('0x18')]=_0x27491b[_0x3330('0x17')];for(_0x23c867=0x0;_0x23c867<_0x4d2146[_0x3330('0x19')];_0x23c867++){if(_0x4d2146[_0x23c867]['internalemailaddress']===_0x27491b['email']&&!_0x4d2146[_0x23c867]['isdisabled']){_0x2d877f=!![];logger[_0x3330('0x1a')]('['+[_0x1158a5['toUpperCase']()]+_0x3330('0x1b')+_0x4d2146[_0x23c867][_0x3330('0x1c')]+'!');_0x337f9a[_0x3330('0x1d')]=_0x4d2146[_0x23c867][_0x3330('0x1c')];}}}}if(!_0x2d877f){logger[_0x3330('0x1a')]('['+[_0x1158a5[_0x3330('0x1e')]()]+_0x3330('0x1f'));_0x337f9a[_0x3330('0x18')]=_0x2f71ed[_0x3330('0x20')];for(_0x23c867=0x0;_0x23c867<_0x4d2146[_0x3330('0x19')];_0x23c867++){if(_0x4d2146[_0x23c867][_0x3330('0x21')]===_0x2f71ed[_0x3330('0x20')]){_0x337f9a[_0x3330('0x1d')]=_0x4d2146[_0x23c867][_0x3330('0x1c')];}}}_0x74cb8(_0x337f9a);})[_0x3330('0xf')](function(_0x5d2ec4){_0x25c469(_0x5d2ec4[_0x3330('0x22')]);});});}function createEndUser(_0x27094d,_0x51a58e,_0x144ad4,_0x1d0f5d,_0x11fcc1,_0x3a2ba3){return new BPromise(function(_0x13eda9,_0x370540){return getAuthToken(_0x51a58e,_0x144ad4,_0x3a2ba3)[_0x3330('0x13')](function(_0x4daea0){var _0x4b64a2=_0x3a2ba3[_0x3330('0x23')]()==='outbound'?_0x11fcc1[_0x3330('0x24')]:_0x11fcc1['calleridnum'];var _0x459edd={'method':_0x3330('0x25'),'uri':_0x1d0f5d+_0x3330('0x26'),'body':{'telephone1':_0x4b64a2,'fullname':_0x4b64a2,'firstname':_0x4b64a2,'lastname':'_','mobilephone':null,'address1_telephone1':null,'ownerid@odata.bind':_0x3330('0x27')+_0x27094d[_0x3330('0x1d')]+')'},'headers':{'Authorization':_0x3330('0x28')+_0x4daea0,'OData-Version':'4.0'},'json':!![],'resolveWithFullResponse':!![]};return rp(_0x459edd);})[_0x3330('0x13')](function(_0x932a62){var _0xe7f4c5=_0x932a62[_0x3330('0x29')][_0x3330('0x2a')];var _0x557f79=_0xe7f4c5[_0x3330('0x2b')](_0xe7f4c5[_0x3330('0x2c')]('(')+0x1,_0xe7f4c5['lastIndexOf'](')'));_0x27094d[_0x3330('0x2d')]=_0x557f79;_0x13eda9(_0x27094d);})[_0x3330('0xf')](function(_0x31bd7c){_0x370540(_0x31bd7c[_0x3330('0x22')]);});});}function getEndUser(_0x5dfa03,_0x3ad988,_0x476234,_0x3218a5,_0x486380,_0x23e787){return new BPromise(function(_0x51c613,_0x486f10){return getAuthToken(_0x3ad988,_0x476234,_0x23e787)[_0x3330('0x13')](function(_0x550515){var _0xae70fd={'method':_0x3330('0x11'),'uri':_0x3218a5+'contacts?$select=telephone1','headers':{'Authorization':_0x3330('0x28')+_0x550515,'If-None-Match':null,'OData-Version':_0x3330('0x2e')},'json':!![]};return rp(_0xae70fd);})['then'](function(_0x383790){var _0x29a192=null;if(_0x383790){var _0x21d46b=_0x383790[_0x3330('0x14')];var _0x25042e=![];for(_0x29a192=0x0;_0x29a192<_0x21d46b[_0x3330('0x19')];_0x29a192++){var _0x429a09=_0x23e787[_0x3330('0x23')]()===_0x3330('0x2f')?_0x486380[_0x3330('0x24')]:_0x486380['calleridnum'];if(_0x21d46b[_0x29a192][_0x3330('0x30')]===_0x429a09){_0x25042e=!![];_0x5dfa03[_0x3330('0x2d')]=_0x21d46b[_0x29a192]['contactid'];}}if(_0x25042e){_0x51c613(_0x5dfa03);}else{return createEndUser(_0x5dfa03,_0x3ad988,_0x476234,_0x3218a5,_0x486380,_0x23e787)['then'](function(_0x5d528b){logger['info']('['+[_0x23e787['toUpperCase']()]+']\x20Enduser\x20created!',_0x5d528b[_0x3330('0x2d')]);_0x51c613(_0x5d528b);});}}else{return createEndUser(_0x5dfa03,_0x3ad988,_0x476234,_0x3218a5,_0x486380,_0x23e787)[_0x3330('0x13')](function(_0x1687fa){logger['info']('['+[_0x23e787[_0x3330('0x1e')]()]+_0x3330('0x31'),_0x1687fa[_0x3330('0x2d')]);_0x51c613(_0x1687fa);});}});});}function getCustomFields(_0x3d979a,_0x370931,_0x4cb319){var _0x19676f={};if(_0x3d979a[_0x3330('0x19')]>0x0){_[_0x3330('0x32')](_0x3d979a,function(_0x3c334f){if(_0x3c334f[_0x3330('0x33')]==='string'&&_0x3c334f[_0x3330('0x34')]&&!_0x3c334f[_0x3330('0x35')]){var _0x5b4d97=_0x3c334f[_0x3330('0x36')][_0x3330('0x23')]();var _0x1acabd=_0x5b4d97[_0x3330('0x2b')](0x0,_0x5b4d97['indexOf']('_'));var _0x5c0b50=_0x5b4d97[_0x3330('0x2b')](_0x5b4d97[_0x3330('0x37')]('_')+0x1);if(_0x1acabd===_0x4cb319){_0x19676f[_0x5c0b50]=_0x3c334f[_0x3330('0x38')];}}});}return _0x19676f;}function getTicket(_0x1f5a98,_0x18797f,_0x450da8,_0x5b3c9b,_0x2117de,_0x4db739,_0x3fec26){return new BPromise(function(_0x2622c3,_0x227317){var _0x1cd822;return getAuthToken(_0x18797f,_0x450da8,_0x3fec26)[_0x3330('0x13')](function(_0x16a3a2){if(_0x4db739[_0x3330('0x39')]==='incident'){_0x1cd822={'method':'POST','uri':_0x5b3c9b+'incidents','body':Object[_0x3330('0x3a')]({},{'title':intUtil[_0x3330('0x3b')](_0x4db739['Subjects'],_0x2117de,'\x20'),'description':intUtil['getString'](_0x4db739['Descriptions'],_0x2117de,'\x0a'),'customerid_contact@odata.bind':_0x3330('0x3c')+_0x1f5a98['enduserId']+')','ownerid@odata.bind':_0x3330('0x27')+_0x1f5a98[_0x3330('0x1d')]+')','caseorigincode':'1'},getCustomFields(_0x4db739[_0x3330('0x3d')],_0x2117de,_0x4db739[_0x3330('0x39')])),'headers':{'Authorization':'Bearer\x20'+_0x16a3a2,'OData-Version':_0x3330('0x2e')},'json':!![],'resolveWithFullResponse':!![]};}if(_0x4db739[_0x3330('0x39')]==='phonecall'){_0x1cd822={'method':_0x3330('0x25'),'uri':_0x5b3c9b+_0x3330('0x3e'),'body':Object[_0x3330('0x3a')]({},{'subject':intUtil[_0x3330('0x3b')](_0x4db739[_0x3330('0x3f')],_0x2117de,'\x20'),'phonenumber':String(_0x2117de[_0x3330('0x40')]),'description':intUtil[_0x3330('0x3b')](_0x4db739[_0x3330('0x41')],_0x2117de,'\x0a'),'regardingobjectid_contact@odata.bind':'/contacts('+_0x1f5a98[_0x3330('0x2d')]+')','ownerid@odata.bind':_0x3330('0x27')+_0x1f5a98[_0x3330('0x1d')]+')','directioncode':_0x1f5a98[_0x3330('0x42')]===_0x3330('0x43')?![]:!![],'phonecall_activity_parties':[{'partyid_systemuser@odata.bind':_0x3330('0x27')+_0x1f5a98['userId']+')','participationtypemask':_0x1f5a98[_0x3330('0x42')]===_0x3330('0x43')?0x2:0x1},{'partyid_contact@odata.bind':_0x3330('0x3c')+_0x1f5a98[_0x3330('0x2d')]+')','participationtypemask':_0x1f5a98['callDirection']===_0x3330('0x43')?0x1:0x2}]},getCustomFields(_0x4db739['Fields'],_0x2117de,_0x4db739[_0x3330('0x39')])),'headers':{'Authorization':'Bearer\x20'+_0x16a3a2,'OData-Version':_0x3330('0x2e')},'json':!![],'resolveWithFullResponse':!![]};}return rp(_0x1cd822);})[_0x3330('0x13')](function(_0x14f8e5){var _0x2e482a=_0x14f8e5[_0x3330('0x29')][_0x3330('0x2a')];var _0x4fdfde=_0x2e482a[_0x3330('0x2b')](_0x2e482a[_0x3330('0x2c')]('(')+0x1,_0x2e482a['lastIndexOf'](')'));_0x1f5a98['ticketId']=_0x4fdfde;_0x2622c3(_0x1f5a98);})[_0x3330('0xf')](function(_0x3067e5){_0x227317(_0x3067e5[_0x3330('0x22')]);});});}function emit(_0x1060a3,_0xa5b5f7,_0x50b325,_0x2a8405){var _0xb64bff={'uri':util[_0x3330('0x44')](_0x3330('0x45'),_0x1060a3,_0x50b325,_0x2a8405)};io['to'](util['format']('user:%s',_0xa5b5f7))['emit'](_0x3330('0x46'),_0xb64bff);}exports['cs']=function(_0x5b5b74,_0x1c1c44,_0x597f46,_0x2977f7,_0x5e3f18,_0x99c16b,_0x51f261,_0x38dcb2){var _0xba8994={};_0x99c16b[_0x3330('0xb')]=intUtil[_0x3330('0x47')](_0x99c16b[_0x3330('0xb')]);_0x99c16b[_0x3330('0x48')]=intUtil[_0x3330('0x47')](_0x99c16b[_0x3330('0x48')]);_0xba8994[_0x3330('0x42')]=_0x38dcb2==='queue'||_0x38dcb2===_0x3330('0x49')?_0x3330('0x43'):'outbound';var _0x4aea8f=util[_0x3330('0x44')](_0x3330('0x4a'),_0x99c16b[_0x3330('0xb')]);var _0x549194=util['format'](_0x3330('0x4b'),_0x99c16b[_0x3330('0x4c')]);var _0xf4a860=util[_0x3330('0x44')](_0x3330('0x4d'),_0x99c16b[_0x3330('0x48')],_0x1c1c44[_0x3330('0x4e')],md5(_0x1c1c44[_0x3330('0x4e')]));if(_0x5e3f18&&_0x5e3f18[_0x3330('0x4f')]){logger[_0x3330('0x1a')]('[QUEUE]',_0x3330('0x50'));_0x1c1c44[_0x3330('0x51')]=_0xf4a860;}else if(_0x51f261&&_0x51f261[_0x3330('0x52')]&&_0x51f261[_0x3330('0x52')]!==_0x3330('0x53')){logger[_0x3330('0x1a')](_0x3330('0x54'),_0x3330('0x50'));_0x1c1c44[_0x3330('0x51')]=_0xf4a860;}else{_0x1c1c44[_0x3330('0x51')]='';}return getUser(_0xba8994,_0x99c16b,_0x2977f7,_0x549194,_0x4aea8f,_0x38dcb2)['then'](function(_0x41d43e){logger[_0x3330('0x1a')]('['+_0x38dcb2['toUpperCase']()+_0x3330('0x55'),_0x41d43e['userId']);logger[_0x3330('0x1a')]('['+_0x38dcb2['toUpperCase']()+']\x20The\x20User\x20email\x20is:',_0x41d43e[_0x3330('0x18')]);return getEndUser(_0x41d43e,_0x99c16b,_0x549194,_0x4aea8f,_0x1c1c44,_0x38dcb2);})[_0x3330('0x13')](function(_0x29b2c8){logger['info']('['+_0x38dcb2[_0x3330('0x1e')]()+_0x3330('0x56'),_0x29b2c8[_0x3330('0x2d')]);logger[_0x3330('0x1a')]('['+_0x38dcb2['toUpperCase']()+']\x20The\x20Enduser\x20phone\x20is:',_0x1c1c44[_0x3330('0x40')]);return getTicket(_0x29b2c8,_0x99c16b,_0x549194,_0x4aea8f,_0x1c1c44,_0x597f46,_0x38dcb2);})[_0x3330('0x13')](function(_0x2ca892){logger[_0x3330('0x1a')](util[_0x3330('0x44')]('['+_0x38dcb2[_0x3330('0x1e')]()+_0x3330('0x57'),_0x597f46[_0x3330('0x39')],_0x2ca892[_0x3330('0x58')]));logger['info'](util[_0x3330('0x44')]('['+_0x38dcb2[_0x3330('0x1e')]()+_0x3330('0x59'),_0x38dcb2));if(_0x38dcb2!==_0x3330('0x49')){logger[_0x3330('0x1a')]('['+_0x38dcb2[_0x3330('0x1e')]()+']',_0x3330('0x5a'));emit(_0x99c16b[_0x3330('0xb')],_0x2977f7[_0x3330('0x5b')],_0x597f46[_0x3330('0x39')],_0x2ca892[_0x3330('0x58')]);}})['catch'](function(_0x12f925){logger[_0x3330('0x10')]('['+_0x38dcb2[_0x3330('0x1e')]()+']\x20Error\x20running\x20Dynamics365\x20integration',util[_0x3330('0x5c')](_0x12f925,{'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 c6e8e66..e5fe621 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 _0xa866=['keyBy','custom_fields','value','remoteUri','then','validateEmail','%s/api/v2/agents','length','find','contact','email','%s/api/v2/agents/me','Admin\x20account\x20selected.','Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!','Searching\x20enduser\x20with\x20phone','%s/api/v2/contacts','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','POST','Enduser\x20created.','Basic\x20%s','toString','base64','debug','stringify','map','forEach','type','string','nameField','content','idField','push','variable','customField','variableName','customVariable','Variable','toLowerCase','queue','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','Authorization','The\x20User\x20ID\x20is:','The\x20Enduser\x20ID\x20is:','Ticket\x20created!','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','catch','error','outbound','recordingFormat','[OUTBOUND]','Recording\x20is\x20enabled!','destcalleridname','destcalleridnum','The\x20Ticket\x20ID\x20is:','unmanaged','lastevent','toUpperCase','md5','util','ioredis','./util','../../../../config/environment','redis','defaults','localhost','application/json','emit','info','merge','format','Caller\x20-\x20%s','calleridname','calleridnum','getString','Subjects','
','name','Fields'];(function(_0x23ae86,_0x1ca899){var _0x240cfd=function(_0x38f6d1){while(--_0x38f6d1){_0x23ae86['push'](_0x23ae86['shift']());}};_0x240cfd(++_0x1ca899);}(_0xa866,0x199));var _0x6a86=function(_0x1fc2d5,_0x54555c){_0x1fc2d5=_0x1fc2d5-0x0;var _0x315041=_0xa866[_0x1fc2d5];return _0x315041;};'use strict';var _=require('lodash');var rp=require('request-promise');var md5=require(_0x6a86('0x0'));var util=require(_0x6a86('0x1'));var Redis=require(_0x6a86('0x2'));var intUtil=require(_0x6a86('0x3'));var config=require(_0x6a86('0x4'));var logger=require('../../../../config/logger')('freshdesk');config[_0x6a86('0x5')]=_[_0x6a86('0x6')](config['redis'],{'host':_0x6a86('0x7'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x6a86('0x5')]));var headers={'Content-Type':'application/json','Accept':_0x6a86('0x8')};function emit(_0xdeb211,_0x2ad021,_0x4b7019){io['to'](_0xdeb211)[_0x6a86('0x9')](_0x2ad021,_0x4b7019);}function getTicket(_0x267549,_0x4d8c8d,_0x3fcc4b,_0x1981b8,_0x9ce961){logger[_0x6a86('0xa')]('Creating\x20new\x20ticket...');var _0x2152ed=_[_0x6a86('0xb')]({'responder_id':_0x4d8c8d['id'],'requester_id':_0x3fcc4b['id'],'name':util[_0x6a86('0xc')](_0x6a86('0xd'),_0x9ce961[_0x6a86('0xe')]),'phone':_0x9ce961[_0x6a86('0xf')],'source':0x3,'priority':0x1,'status':0x2,'subject':intUtil[_0x6a86('0x10')](_0x1981b8[_0x6a86('0x11')],_0x9ce961,'\x20'),'description':intUtil[_0x6a86('0x10')](_0x1981b8['Descriptions'],_0x9ce961,_0x6a86('0x12')),'tags':getTags(_0x1981b8['Tags'],_0x6a86('0x13'))},getCustomFields(_0x1981b8[_0x6a86('0x14')],_0x9ce961));_0x2152ed['custom_fields']=_['mapValues'](_[_0x6a86('0x15')](_0x2152ed[_0x6a86('0x16')],'id'),_0x6a86('0x17'));return request({'uri':util['format']('%s/api/v2/tickets',_0x267549[_0x6a86('0x18')]),'method':'POST','body':_0x2152ed})[_0x6a86('0x19')](function(_0x15457c){logger[_0x6a86('0xa')]('Ticket\x20created!');return _0x15457c;});}function getUser(_0x5ec17d,_0x3d1bdf){if(intUtil[_0x6a86('0x1a')](_0x3d1bdf)){return request({'uri':util[_0x6a86('0xc')](_0x6a86('0x1b'),_0x5ec17d[_0x6a86('0x18')]),'qs':{'email':_0x3d1bdf}})[_0x6a86('0x19')](function(_0x4f2e66){if(_0x4f2e66[_0x6a86('0x1c')]){logger[_0x6a86('0xa')]('Agent\x20found!');return _[_0x6a86('0x1d')](_0x4f2e66,function(_0xd5023a){return _0xd5023a[_0x6a86('0x1e')][_0x6a86('0x1f')]===_0x3d1bdf;});}else{logger['info']('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return request({'uri':util[_0x6a86('0xc')](_0x6a86('0x20'),_0x5ec17d[_0x6a86('0x18')])})[_0x6a86('0x19')](function(_0x83338){logger[_0x6a86('0xa')](_0x6a86('0x21'));return _0x83338;});}});}else{logger[_0x6a86('0xa')](_0x6a86('0x22'));return request({'uri':util['format'](_0x6a86('0x20'),_0x5ec17d[_0x6a86('0x18')])})[_0x6a86('0x19')](function(_0x334c95){logger[_0x6a86('0xa')]('Admin\x20account\x20selected.');return _0x334c95;});}}function getEndUser(_0x35a270,_0x4225cb,_0x4200c2){logger[_0x6a86('0xa')](_0x6a86('0x23'),_0x4200c2);return request({'uri':util[_0x6a86('0xc')](_0x6a86('0x24'),_0x35a270[_0x6a86('0x18')]),'qs':{'phone':_0x4200c2}})[_0x6a86('0x19')](function(_0x2fb5e8){if(_0x2fb5e8['length']){logger['info']('Enduser\x20found!');return _[_0x6a86('0x1d')](_0x2fb5e8,{'phone':_0x4200c2});}else{logger[_0x6a86('0xa')](_0x6a86('0x25'));return request({'uri':util[_0x6a86('0xc')](_0x6a86('0x24'),_0x35a270['remoteUri']),'method':_0x6a86('0x26'),'body':{'name':_0x4225cb,'phone':_0x4200c2}})[_0x6a86('0x19')](function(_0x541266){logger[_0x6a86('0xa')](_0x6a86('0x27'));return _0x541266;});}});}function getAuth(_0x26349b){return util[_0x6a86('0xc')](_0x6a86('0x28'),new Buffer(_0x26349b['apiKey']+':X')[_0x6a86('0x29')](_0x6a86('0x2a')));}function request(_0x30918c){logger[_0x6a86('0x2b')]('[HTTP]',JSON[_0x6a86('0x2c')](_0x30918c));return rp(_[_0x6a86('0x6')](_0x30918c,{'method':'GET','headers':headers,'json':!![]}));}function getTags(_0x213476,_0x44a217){var _0x36d3f1=[];if(_0x213476&&_0x213476['length']>0x0){_0x36d3f1=_[_0x6a86('0x2d')](_0x213476,_0x44a217);}return _0x36d3f1;}function getCustomFields(_0x31a8ae,_0x1dc8fb){var _0x4ba888=[];var _0xbb514a={'custom_fields':[]};if(_0x31a8ae['length']>0x0){_[_0x6a86('0x2e')](_0x31a8ae,function(_0xb517e4){if(_0xb517e4[_0x6a86('0x2f')]===_0x6a86('0x30')&&_0xb517e4[_0x6a86('0x31')]&&!_0xb517e4['customField']){_0xbb514a[_0xb517e4[_0x6a86('0x31')]['toLowerCase']()]=_0xb517e4[_0x6a86('0x32')]['toString']();}else if(_0xb517e4[_0x6a86('0x2f')]===_0x6a86('0x30')&&_0xb517e4[_0x6a86('0x33')]&&_0xb517e4['customField']){_0xbb514a[_0x6a86('0x16')][_0x6a86('0x34')]({'id':_0xb517e4[_0x6a86('0x33')],'value':_0xb517e4[_0x6a86('0x32')][_0x6a86('0x29')]()});}else if(_0xb517e4['type']===_0x6a86('0x35')&&_0xb517e4['variableName']&&_0xb517e4[_0x6a86('0x33')]&&_0xb517e4[_0x6a86('0x36')]){_0x1dc8fb[_0xb517e4[_0x6a86('0x37')]]&&_0xbb514a[_0x6a86('0x16')][_0x6a86('0x34')]({'id':_0xb517e4['idField'],'value':_0x1dc8fb[_0xb517e4[_0x6a86('0x37')]][_0x6a86('0x29')]()});}else if(_0xb517e4[_0x6a86('0x2f')]===_0x6a86('0x38')&&_0xb517e4[_0x6a86('0x39')]&&_0xb517e4[_0x6a86('0x39')][_0x6a86('0x13')]&&_0xb517e4['idField']&&_0xb517e4['customField']){_0x1dc8fb[_0xb517e4[_0x6a86('0x39')][_0x6a86('0x13')][_0x6a86('0x3a')]()]&&_0xbb514a[_0x6a86('0x16')][_0x6a86('0x34')]({'id':_0xb517e4['idField'],'value':_0x1dc8fb[_0xb517e4[_0x6a86('0x39')][_0x6a86('0x13')]['toLowerCase']()][_0x6a86('0x29')]()});}});}return _0xbb514a;}exports[_0x6a86('0x3b')]=function(_0x16956d,_0x3be704,_0x555818,_0x1a1182,_0x29c5eb,_0x40576a){var _0x190da7,_0x13fa95;_0x40576a['remoteUri']=intUtil[_0x6a86('0x3c')](_0x40576a['remoteUri']);_0x40576a[_0x6a86('0x3d')]=intUtil[_0x6a86('0x3c')](_0x40576a['serverUrl']);if(_0x29c5eb&&_0x29c5eb[_0x6a86('0x3e')]){logger[_0x6a86('0xa')](_0x6a86('0x3f'),'Recording\x20is\x20enabled!');_0x3be704[_0x6a86('0x40')]=util[_0x6a86('0xc')](_0x6a86('0x41'),_0x40576a[_0x6a86('0x3d')],_0x3be704[_0x6a86('0x42')],md5(_0x3be704[_0x6a86('0x42')]));}else{_0x3be704[_0x6a86('0x40')]='';}headers[_0x6a86('0x43')]=getAuth(_0x40576a);return getUser(_0x40576a,_0x1a1182[_0x6a86('0x1f')])[_0x6a86('0x19')](function(_0x294faf){_0x190da7=_0x294faf;logger[_0x6a86('0xa')](_0x6a86('0x44'),_0x190da7['id']);return getEndUser(_0x40576a,_0x3be704[_0x6a86('0xe')],_0x3be704[_0x6a86('0xf')]);})['then'](function(_0x28ec3d){_0x13fa95=_0x28ec3d;logger[_0x6a86('0xa')](_0x6a86('0x45'),_0x13fa95['id']);return getTicket(_0x40576a,_0x190da7,_0x13fa95,_0x555818,_0x3be704);})[_0x6a86('0x19')](function(_0x53bd6c){if(_0x53bd6c&&_0x53bd6c['id']){logger[_0x6a86('0xa')](_0x6a86('0x46'));logger['info']('The\x20Ticket\x20ID\x20is:',_0x53bd6c['id']);logger['info'](_0x6a86('0x3f'),_0x6a86('0x47'));emit(util[_0x6a86('0xc')](_0x6a86('0x48'),_0x1a1182['name']),_0x6a86('0x49'),{'uri':util['format']('%s/helpdesk/tickets/%d',_0x40576a[_0x6a86('0x18')],_0x53bd6c['id'])});}})[_0x6a86('0x4a')](function(_0x1b3391){logger[_0x6a86('0x4b')](_0x6a86('0x3f'),JSON[_0x6a86('0x2c')](_0x1b3391));});};exports[_0x6a86('0x4c')]=function(_0x1be9b4,_0x73d302,_0x32285f,_0x52a9fe,_0xeb6170,_0x3c8098,_0x29539e){var _0x506114,_0x4a178e;_0x3c8098['remoteUri']=intUtil[_0x6a86('0x3c')](_0x3c8098[_0x6a86('0x18')]);_0x3c8098[_0x6a86('0x3d')]=intUtil[_0x6a86('0x3c')](_0x3c8098[_0x6a86('0x3d')]);if(_0x29539e&&_0x29539e['recordingFormat']&&_0x29539e[_0x6a86('0x4d')]!=='none'){logger['info'](_0x6a86('0x4e'),_0x6a86('0x4f'));_0x73d302[_0x6a86('0x40')]=util[_0x6a86('0xc')](_0x6a86('0x41'),_0x3c8098[_0x6a86('0x3d')],_0x73d302[_0x6a86('0x42')],md5(_0x73d302[_0x6a86('0x42')]));}headers[_0x6a86('0x43')]=getAuth(_0x3c8098);return getUser(_0x3c8098,_0x52a9fe[_0x6a86('0x1f')])[_0x6a86('0x19')](function(_0x5a824b){_0x506114=_0x5a824b;logger[_0x6a86('0xa')](_0x6a86('0x44'),_0x506114['id']);return getEndUser(_0x3c8098,_0x73d302[_0x6a86('0x50')],_0x73d302[_0x6a86('0x51')]);})[_0x6a86('0x19')](function(_0x435c08){_0x4a178e=_0x435c08;logger[_0x6a86('0xa')](_0x6a86('0x45'),_0x4a178e['id']);return getTicket(_0x3c8098,_0x506114,_0x4a178e,_0x32285f,_0x73d302);})['then'](function(_0x528a87){if(_0x528a87&&_0x528a87['id']){logger['info'](_0x6a86('0x46'));logger[_0x6a86('0xa')](_0x6a86('0x52'),_0x528a87['id']);logger[_0x6a86('0xa')](_0x6a86('0x4e'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0x6a86('0xc')]('user:%s',_0x52a9fe[_0x6a86('0x13')]),_0x6a86('0x49'),{'uri':util[_0x6a86('0xc')]('%s/helpdesk/tickets/%d',_0x3c8098[_0x6a86('0x18')],_0x528a87['id'])});}})[_0x6a86('0x4a')](function(_0x225b12){logger[_0x6a86('0x4b')](_0x6a86('0x4e'),JSON['stringify'](_0x225b12));});};exports[_0x6a86('0x53')]=function(_0x56705b,_0x3751d7,_0x38861e,_0x525697,_0x552648,_0x367c67){var _0x3dac13,_0x44743b;_0x367c67[_0x6a86('0x18')]=intUtil[_0x6a86('0x3c')](_0x367c67[_0x6a86('0x18')]);_0x367c67[_0x6a86('0x3d')]=intUtil['stripTrailingSlash'](_0x367c67['serverUrl']);if(_0x552648&&_0x552648[_0x6a86('0x3e')]){logger['info']('['+_0x3751d7[_0x6a86('0x54')][_0x6a86('0x55')]()+']',_0x6a86('0x4f'));_0x3751d7[_0x6a86('0x40')]=util['format'](_0x6a86('0x41'),_0x367c67[_0x6a86('0x3d')],_0x3751d7[_0x6a86('0x42')],md5(_0x3751d7['uniqueid']));}else{_0x3751d7[_0x6a86('0x40')]='';}headers[_0x6a86('0x43')]=getAuth(_0x367c67);return getUser(_0x367c67,'')['then'](function(_0x4a219c){_0x3dac13=_0x4a219c;logger[_0x6a86('0xa')]('The\x20User\x20ID\x20is:',_0x3dac13['id']);return getEndUser(_0x367c67,_0x3751d7[_0x6a86('0xe')],_0x3751d7['calleridnum']);})[_0x6a86('0x19')](function(_0x3dd4b6){_0x44743b=_0x3dd4b6;logger['info'](_0x6a86('0x45'),_0x44743b['id']);return getTicket(_0x367c67,_0x3dac13,_0x44743b,_0x38861e,_0x3751d7);})[_0x6a86('0x19')](function(_0xdfcd3){if(_0xdfcd3){logger[_0x6a86('0xa')](_0x6a86('0x46'));logger[_0x6a86('0xa')]('The\x20Ticket\x20ID\x20is:',_0xdfcd3['id']);}})['catch'](function(_0x18d773){logger[_0x6a86('0x4b')]('['+_0x3751d7[_0x6a86('0x54')][_0x6a86('0x55')]()+']',JSON[_0x6a86('0x2c')](_0x18d773));});}; \ No newline at end of file +var _0x8a08=['toString','customField','customVariable','Variable','toLowerCase','queue','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','uniqueid','recordingURL','The\x20User\x20ID\x20is:','The\x20Enduser\x20ID\x20is:','The\x20Ticket\x20ID\x20is:','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','%s/helpdesk/tickets/%d','catch','error','outbound','recordingFormat','none','[OUTBOUND]','Authorization','destcalleridname','destcalleridnum','unmanaged','toUpperCase','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','lastevent','lodash','request-promise','md5','ioredis','./util','../../../../config/environment','../../../../config/logger','freshdesk','redis','defaults','localhost','socket.io-emitter','application/json','info','Creating\x20new\x20ticket...','merge','format','Caller\x20-\x20%s','calleridname','calleridnum','Descriptions','
','Tags','name','Fields','custom_fields','mapValues','value','%s/api/v2/tickets','Ticket\x20created!','validateEmail','%s/api/v2/agents','remoteUri','then','length','Agent\x20found!','find','contact','email','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/api/v2/agents/me','Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!','Admin\x20account\x20selected.','Searching\x20enduser\x20with\x20phone','%s/api/v2/contacts','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','POST','Basic\x20%s','apiKey','base64','[HTTP]','stringify','GET','map','forEach','string','nameField','idField','push','content'];(function(_0x2590fc,_0x5950b1){var _0x31aef1=function(_0x3d99e9){while(--_0x3d99e9){_0x2590fc['push'](_0x2590fc['shift']());}};_0x31aef1(++_0x5950b1);}(_0x8a08,0x138));var _0x88a0=function(_0x195d0a,_0x14edcb){_0x195d0a=_0x195d0a-0x0;var _0x11d125=_0x8a08[_0x195d0a];return _0x11d125;};'use strict';var _=require(_0x88a0('0x0'));var rp=require(_0x88a0('0x1'));var md5=require(_0x88a0('0x2'));var util=require('util');var Redis=require(_0x88a0('0x3'));var intUtil=require(_0x88a0('0x4'));var config=require(_0x88a0('0x5'));var logger=require(_0x88a0('0x6'))(_0x88a0('0x7'));config[_0x88a0('0x8')]=_[_0x88a0('0x9')](config['redis'],{'host':_0x88a0('0xa'),'port':0x18eb});var io=require(_0x88a0('0xb'))(new Redis(config[_0x88a0('0x8')]));var headers={'Content-Type':_0x88a0('0xc'),'Accept':'application/json'};function emit(_0x47579b,_0x123c81,_0x351314){io['to'](_0x47579b)['emit'](_0x123c81,_0x351314);}function getTicket(_0x586137,_0x25c265,_0x133e77,_0x590995,_0x33c83b){logger[_0x88a0('0xd')](_0x88a0('0xe'));var _0x3b991d=_[_0x88a0('0xf')]({'responder_id':_0x25c265['id'],'requester_id':_0x133e77['id'],'name':util[_0x88a0('0x10')](_0x88a0('0x11'),_0x33c83b[_0x88a0('0x12')]),'phone':_0x33c83b[_0x88a0('0x13')],'source':0x3,'priority':0x1,'status':0x2,'subject':intUtil['getString'](_0x590995['Subjects'],_0x33c83b,'\x20'),'description':intUtil['getString'](_0x590995[_0x88a0('0x14')],_0x33c83b,_0x88a0('0x15')),'tags':getTags(_0x590995[_0x88a0('0x16')],_0x88a0('0x17'))},getCustomFields(_0x590995[_0x88a0('0x18')],_0x33c83b));_0x3b991d[_0x88a0('0x19')]=_[_0x88a0('0x1a')](_['keyBy'](_0x3b991d[_0x88a0('0x19')],'id'),_0x88a0('0x1b'));return request({'uri':util['format'](_0x88a0('0x1c'),_0x586137['remoteUri']),'method':'POST','body':_0x3b991d})['then'](function(_0x4c84aa){logger[_0x88a0('0xd')](_0x88a0('0x1d'));return _0x4c84aa;});}function getUser(_0x27ae09,_0x2e4513){if(intUtil[_0x88a0('0x1e')](_0x2e4513)){return request({'uri':util['format'](_0x88a0('0x1f'),_0x27ae09[_0x88a0('0x20')]),'qs':{'email':_0x2e4513}})[_0x88a0('0x21')](function(_0x1e2cd0){if(_0x1e2cd0[_0x88a0('0x22')]){logger[_0x88a0('0xd')](_0x88a0('0x23'));return _[_0x88a0('0x24')](_0x1e2cd0,function(_0x5bf441){return _0x5bf441[_0x88a0('0x25')][_0x88a0('0x26')]===_0x2e4513;});}else{logger[_0x88a0('0xd')](_0x88a0('0x27'));return request({'uri':util[_0x88a0('0x10')](_0x88a0('0x28'),_0x27ae09[_0x88a0('0x20')])})[_0x88a0('0x21')](function(_0x36a9c3){logger[_0x88a0('0xd')]('Admin\x20account\x20selected.');return _0x36a9c3;});}});}else{logger[_0x88a0('0xd')](_0x88a0('0x29'));return request({'uri':util[_0x88a0('0x10')](_0x88a0('0x28'),_0x27ae09['remoteUri'])})[_0x88a0('0x21')](function(_0xba717e){logger[_0x88a0('0xd')](_0x88a0('0x2a'));return _0xba717e;});}}function getEndUser(_0x42707b,_0x391043,_0x5a3925){logger[_0x88a0('0xd')](_0x88a0('0x2b'),_0x5a3925);return request({'uri':util[_0x88a0('0x10')](_0x88a0('0x2c'),_0x42707b[_0x88a0('0x20')]),'qs':{'phone':_0x5a3925}})[_0x88a0('0x21')](function(_0x2aade5){if(_0x2aade5[_0x88a0('0x22')]){logger[_0x88a0('0xd')]('Enduser\x20found!');return _['find'](_0x2aade5,{'phone':_0x5a3925});}else{logger[_0x88a0('0xd')](_0x88a0('0x2d'));return request({'uri':util[_0x88a0('0x10')]('%s/api/v2/contacts',_0x42707b[_0x88a0('0x20')]),'method':_0x88a0('0x2e'),'body':{'name':_0x391043,'phone':_0x5a3925}})[_0x88a0('0x21')](function(_0x39d498){logger['info']('Enduser\x20created.');return _0x39d498;});}});}function getAuth(_0x489233){return util[_0x88a0('0x10')](_0x88a0('0x2f'),new Buffer(_0x489233[_0x88a0('0x30')]+':X')['toString'](_0x88a0('0x31')));}function request(_0x336a81){logger['debug'](_0x88a0('0x32'),JSON[_0x88a0('0x33')](_0x336a81));return rp(_['defaults'](_0x336a81,{'method':_0x88a0('0x34'),'headers':headers,'json':!![]}));}function getTags(_0x4c8699,_0x55d95a){var _0x3bcd7a=[];if(_0x4c8699&&_0x4c8699[_0x88a0('0x22')]>0x0){_0x3bcd7a=_[_0x88a0('0x35')](_0x4c8699,_0x55d95a);}return _0x3bcd7a;}function getCustomFields(_0x3f4f4b,_0x3d6748){var _0x18876b=[];var _0x5d668e={'custom_fields':[]};if(_0x3f4f4b[_0x88a0('0x22')]>0x0){_[_0x88a0('0x36')](_0x3f4f4b,function(_0x5e7397){if(_0x5e7397['type']===_0x88a0('0x37')&&_0x5e7397[_0x88a0('0x38')]&&!_0x5e7397['customField']){_0x5d668e[_0x5e7397['nameField']['toLowerCase']()]=_0x5e7397['content']['toString']();}else if(_0x5e7397['type']===_0x88a0('0x37')&&_0x5e7397[_0x88a0('0x39')]&&_0x5e7397['customField']){_0x5d668e['custom_fields'][_0x88a0('0x3a')]({'id':_0x5e7397[_0x88a0('0x39')],'value':_0x5e7397[_0x88a0('0x3b')][_0x88a0('0x3c')]()});}else if(_0x5e7397['type']==='variable'&&_0x5e7397['variableName']&&_0x5e7397[_0x88a0('0x39')]&&_0x5e7397[_0x88a0('0x3d')]){_0x3d6748[_0x5e7397['variableName']]&&_0x5d668e['custom_fields'][_0x88a0('0x3a')]({'id':_0x5e7397[_0x88a0('0x39')],'value':_0x3d6748[_0x5e7397['variableName']][_0x88a0('0x3c')]()});}else if(_0x5e7397['type']===_0x88a0('0x3e')&&_0x5e7397[_0x88a0('0x3f')]&&_0x5e7397[_0x88a0('0x3f')][_0x88a0('0x17')]&&_0x5e7397[_0x88a0('0x39')]&&_0x5e7397['customField']){_0x3d6748[_0x5e7397[_0x88a0('0x3f')]['name'][_0x88a0('0x40')]()]&&_0x5d668e['custom_fields'][_0x88a0('0x3a')]({'id':_0x5e7397[_0x88a0('0x39')],'value':_0x3d6748[_0x5e7397[_0x88a0('0x3f')][_0x88a0('0x17')]['toLowerCase']()]['toString']()});}});}return _0x5d668e;}exports[_0x88a0('0x41')]=function(_0x4f3cf7,_0x264675,_0x44dccc,_0x2a0c96,_0x23dc1e,_0x368970){var _0x4c6470,_0x2d473d;_0x368970[_0x88a0('0x20')]=intUtil[_0x88a0('0x42')](_0x368970['remoteUri']);_0x368970[_0x88a0('0x43')]=intUtil['stripTrailingSlash'](_0x368970[_0x88a0('0x43')]);if(_0x23dc1e&&_0x23dc1e[_0x88a0('0x44')]){logger['info'](_0x88a0('0x45'),_0x88a0('0x46'));_0x264675['recordingURL']=util[_0x88a0('0x10')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x368970[_0x88a0('0x43')],_0x264675[_0x88a0('0x47')],md5(_0x264675[_0x88a0('0x47')]));}else{_0x264675[_0x88a0('0x48')]='';}headers['Authorization']=getAuth(_0x368970);return getUser(_0x368970,_0x2a0c96[_0x88a0('0x26')])[_0x88a0('0x21')](function(_0x23facb){_0x4c6470=_0x23facb;logger[_0x88a0('0xd')](_0x88a0('0x49'),_0x4c6470['id']);return getEndUser(_0x368970,_0x264675[_0x88a0('0x12')],_0x264675['calleridnum']);})[_0x88a0('0x21')](function(_0x11e72b){_0x2d473d=_0x11e72b;logger[_0x88a0('0xd')](_0x88a0('0x4a'),_0x2d473d['id']);return getTicket(_0x368970,_0x4c6470,_0x2d473d,_0x44dccc,_0x264675);})[_0x88a0('0x21')](function(_0x11f83e){if(_0x11f83e&&_0x11f83e['id']){logger[_0x88a0('0xd')](_0x88a0('0x1d'));logger[_0x88a0('0xd')](_0x88a0('0x4b'),_0x11f83e['id']);logger[_0x88a0('0xd')](_0x88a0('0x45'),_0x88a0('0x4c'));emit(util[_0x88a0('0x10')](_0x88a0('0x4d'),_0x2a0c96[_0x88a0('0x17')]),_0x88a0('0x4e'),{'uri':util['format'](_0x88a0('0x4f'),_0x368970[_0x88a0('0x20')],_0x11f83e['id'])});}})[_0x88a0('0x50')](function(_0x2fcb96){logger[_0x88a0('0x51')](_0x88a0('0x45'),JSON[_0x88a0('0x33')](_0x2fcb96));});};exports[_0x88a0('0x52')]=function(_0x22bcae,_0x5a8533,_0x9b9136,_0x4a987c,_0x781776,_0xfcc761,_0x123801){var _0x2a4ec2,_0x16ab68;_0xfcc761[_0x88a0('0x20')]=intUtil[_0x88a0('0x42')](_0xfcc761[_0x88a0('0x20')]);_0xfcc761[_0x88a0('0x43')]=intUtil[_0x88a0('0x42')](_0xfcc761[_0x88a0('0x43')]);if(_0x123801&&_0x123801['recordingFormat']&&_0x123801[_0x88a0('0x53')]!==_0x88a0('0x54')){logger[_0x88a0('0xd')](_0x88a0('0x55'),_0x88a0('0x46'));_0x5a8533['recordingURL']=util[_0x88a0('0x10')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0xfcc761[_0x88a0('0x43')],_0x5a8533[_0x88a0('0x47')],md5(_0x5a8533[_0x88a0('0x47')]));}headers[_0x88a0('0x56')]=getAuth(_0xfcc761);return getUser(_0xfcc761,_0x4a987c['email'])[_0x88a0('0x21')](function(_0x572d32){_0x2a4ec2=_0x572d32;logger[_0x88a0('0xd')](_0x88a0('0x49'),_0x2a4ec2['id']);return getEndUser(_0xfcc761,_0x5a8533[_0x88a0('0x57')],_0x5a8533[_0x88a0('0x58')]);})[_0x88a0('0x21')](function(_0x249785){_0x16ab68=_0x249785;logger[_0x88a0('0xd')]('The\x20Enduser\x20ID\x20is:',_0x16ab68['id']);return getTicket(_0xfcc761,_0x2a4ec2,_0x16ab68,_0x9b9136,_0x5a8533);})[_0x88a0('0x21')](function(_0x2b76fd){if(_0x2b76fd&&_0x2b76fd['id']){logger[_0x88a0('0xd')]('Ticket\x20created!');logger['info'](_0x88a0('0x4b'),_0x2b76fd['id']);logger[_0x88a0('0xd')](_0x88a0('0x55'),_0x88a0('0x4c'));emit(util['format'](_0x88a0('0x4d'),_0x4a987c['name']),_0x88a0('0x4e'),{'uri':util[_0x88a0('0x10')](_0x88a0('0x4f'),_0xfcc761[_0x88a0('0x20')],_0x2b76fd['id'])});}})['catch'](function(_0x376385){logger[_0x88a0('0x51')](_0x88a0('0x55'),JSON[_0x88a0('0x33')](_0x376385));});};exports[_0x88a0('0x59')]=function(_0x133931,_0x394edf,_0x5a4ff6,_0x4a66fe,_0x54818f,_0x204c8f){var _0x1617c6,_0x267489;_0x204c8f[_0x88a0('0x20')]=intUtil['stripTrailingSlash'](_0x204c8f[_0x88a0('0x20')]);_0x204c8f['serverUrl']=intUtil['stripTrailingSlash'](_0x204c8f[_0x88a0('0x43')]);if(_0x54818f&&_0x54818f['monitor_format']){logger[_0x88a0('0xd')]('['+_0x394edf['lastevent'][_0x88a0('0x5a')]()+']',_0x88a0('0x46'));_0x394edf['recordingURL']=util['format'](_0x88a0('0x5b'),_0x204c8f[_0x88a0('0x43')],_0x394edf[_0x88a0('0x47')],md5(_0x394edf[_0x88a0('0x47')]));}else{_0x394edf[_0x88a0('0x48')]='';}headers[_0x88a0('0x56')]=getAuth(_0x204c8f);return getUser(_0x204c8f,'')[_0x88a0('0x21')](function(_0x2aa19b){_0x1617c6=_0x2aa19b;logger[_0x88a0('0xd')](_0x88a0('0x49'),_0x1617c6['id']);return getEndUser(_0x204c8f,_0x394edf[_0x88a0('0x12')],_0x394edf['calleridnum']);})['then'](function(_0x134591){_0x267489=_0x134591;logger[_0x88a0('0xd')](_0x88a0('0x4a'),_0x267489['id']);return getTicket(_0x204c8f,_0x1617c6,_0x267489,_0x5a4ff6,_0x394edf);})[_0x88a0('0x21')](function(_0x4c73bf){if(_0x4c73bf){logger['info'](_0x88a0('0x1d'));logger['info'](_0x88a0('0x4b'),_0x4c73bf['id']);}})[_0x88a0('0x50')](function(_0x2970de){logger[_0x88a0('0x51')]('['+_0x394edf[_0x88a0('0x5c')][_0x88a0('0x5a')]()+']',JSON[_0x88a0('0x33')](_0x2970de));});}; \ 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 5ee72f5..369ff31 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 _0x56eb=['Subjects','Contact','format','add','ticketId','task','emit','trigger:browser:url','Token\x20token=','apiKey','remoteUri','stripTrailingSlash','username','outbound','calleridnum','callDirection','queue','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','serverUrl','uniqueid','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','recordingFormat','none','unmanaged','name',']\x20Error\x20running\x20Freshsales\x20integration','inspect','request-promise','md5','util','bluebird','ioredis','../../../../config/environment','../../../../config/logger','freshsales','redis','defaults','localhost','socket.io-emitter','/api/selector/owners','headers','info','Getting\x20admin\x20information','then','users','length','email','adminEmail','adminId','Admin\x20found:','Requested\x20Resource\x20not\x20Found','catch','error','message','GET','Getting\x20user\x20with\x20email','agentEmail','userEmail','userId','User\x20found:','Admin\x20selected','Getting\x20contacts\x20filter','filters','All\x20Contacts','Getting\x20contact\x20list','/api/contacts/view/','Searching\x20contact\x20with\x20phone','contacts','find','work_number','contactNumber','endUserId','Contact\x20found:','/api/contacts','YYYY-MM-DDTHH:mm:ss','Contact\x20not\x20found,\x20creating\x20a\x20new\x20contact','contact','toUpperCase','Creating\x20new\x20task','/api/tasks','getString'];(function(_0x301442,_0x333302){var _0x48ca93=function(_0x2dce41){while(--_0x2dce41){_0x301442['push'](_0x301442['shift']());}};_0x48ca93(++_0x333302);}(_0x56eb,0x16e));var _0xb56e=function(_0x114bf3,_0x31a954){_0x114bf3=_0x114bf3-0x0;var _0x2551ea=_0x56eb[_0x114bf3];return _0x2551ea;};'use strict';var _=require('lodash');var rp=require(_0xb56e('0x0'));var md5=require(_0xb56e('0x1'));var util=require(_0xb56e('0x2'));var moment=require('moment');var Promise=require(_0xb56e('0x3'));var Redis=require(_0xb56e('0x4'));var intUtil=require('./util');var config=require(_0xb56e('0x5'));var logger=require(_0xb56e('0x6'))(_0xb56e('0x7'));config[_0xb56e('0x8')]=_[_0xb56e('0x9')](config[_0xb56e('0x8')],{'host':_0xb56e('0xa'),'port':0x18eb});var io=require(_0xb56e('0xb'))(new Redis(config[_0xb56e('0x8')]));function getAdminId(_0x347704,_0x2321db,_0x594e7e,_0x539f56){return new Promise(function(_0x7a4c1f,_0x22f177){var _0x4f2acd=![];var _0xbca050={'method':'GET','uri':_0x539f56+_0xb56e('0xc'),'json':!![]};_0xbca050[_0xb56e('0xd')]=_0x594e7e;logger[_0xb56e('0xe')](_0xb56e('0xf'));return rp(_0xbca050)[_0xb56e('0x10')](function(_0x1e6767){if(_0x1e6767){var _0x4c0b65=_0x1e6767[_0xb56e('0x11')];var _0x40e4aa=null;for(_0x40e4aa=0x0;_0x40e4aa<_0x4c0b65[_0xb56e('0x12')];_0x40e4aa++){if(_0x4c0b65[_0x40e4aa][_0xb56e('0x13')]===_0x347704[_0xb56e('0x14')]){_0x347704[_0xb56e('0x15')]=_0x4c0b65[_0x40e4aa]['id'];_0x4f2acd=!![];}}if(_0x4f2acd){logger[_0xb56e('0xe')](_0xb56e('0x16'),_0x347704[_0xb56e('0x15')]);_0x7a4c1f(_0x347704);}else{_0x22f177({'statusCode':0x194,'message':_0xb56e('0x17')});}}else{_0x22f177({'statusCode':0x194,'message':_0xb56e('0x17')});}})[_0xb56e('0x18')](function(_0x40f7a3){logger[_0xb56e('0x19')]('['+[_0x2321db['toUpperCase']()]+']',_0x40f7a3[_0xb56e('0x1a')]);_0x22f177(_0x40f7a3);});});}function getUser(_0x3c4424,_0x449e9f,_0x150c91){return function(_0x96cb9b){return new Promise(function(_0x421d01,_0x38c7f9){var _0x4294e4={'method':_0xb56e('0x1b'),'uri':_0x150c91+_0xb56e('0xc'),'json':!![]};_0x4294e4['headers']=_0x449e9f;logger['info']('Getting\x20user\x20list');return rp(_0x4294e4)[_0xb56e('0x10')](function(_0xd1b399){if(_0xd1b399){var _0x3e9795=_0xd1b399[_0xb56e('0x11')];var _0x555653=![];var _0x768790=null;if(_0x96cb9b['agentEmail']!==null){logger[_0xb56e('0xe')](_0xb56e('0x1c'),_0x96cb9b[_0xb56e('0x1d')]);_0x96cb9b[_0xb56e('0x1e')]=_0x96cb9b[_0xb56e('0x1d')];for(_0x768790=0x0;_0x768790<_0x3e9795[_0xb56e('0x12')];_0x768790++){if(_0x3e9795[_0x768790][_0xb56e('0x13')]===_0x96cb9b['agentEmail']){_0x555653=!![];_0x96cb9b[_0xb56e('0x1f')]=_0x3e9795[_0x768790]['id'];logger[_0xb56e('0xe')](_0xb56e('0x20'),_0x96cb9b['userId']);}}}if(!_0x555653){logger[_0xb56e('0xe')](_0xb56e('0x21'));_0x96cb9b['userEmail']=_0x96cb9b[_0xb56e('0x14')];_0x96cb9b[_0xb56e('0x1f')]=_0x96cb9b['adminId'];_0x555653=!![];}if(_0x555653){_0x421d01(_0x96cb9b);}else{_0x38c7f9({'statusCode':0x194,'message':_0xb56e('0x17')});}}else{_0x38c7f9({'statusCode':0x194,'message':_0xb56e('0x17')});}})[_0xb56e('0x18')](function(_0x58f181){logger[_0xb56e('0x19')]('['+[_0x3c4424['toUpperCase']()]+']',_0x58f181[_0xb56e('0x1a')]);_0x38c7f9(_0x58f181);});});};}function getEndUser(_0x888689,_0x5506ca,_0x341311){return function(_0x32048d){return new Promise(function(_0x1e67ce,_0x2ee50b){var _0xee51=0x0;var _0x5c5a17={'method':'GET','uri':_0x341311+'/api/contacts/filters','json':!![]};_0x5c5a17[_0xb56e('0xd')]=_0x5506ca;logger[_0xb56e('0xe')](_0xb56e('0x22'));return rp(_0x5c5a17)['then'](function(_0x582682){_0x582682[_0xb56e('0x23')]['forEach'](function(_0x4722dd){if(_0x4722dd['name']===_0xb56e('0x24')){_0xee51=_0x4722dd['id'];}});})[_0xb56e('0x10')](function(){logger[_0xb56e('0xe')](_0xb56e('0x25'));var _0x5e4441={'method':_0xb56e('0x1b'),'uri':_0x341311+_0xb56e('0x26')+_0xee51,'json':!![]};_0x5e4441[_0xb56e('0xd')]=_0x5506ca;return rp(_0x5e4441);})[_0xb56e('0x10')](function(_0x3eecc2){logger[_0xb56e('0xe')](_0xb56e('0x27'),_0x32048d['contactNumber']);if(_0x3eecc2[_0xb56e('0x28')]['length']>0x0){var _0x184d1f=_[_0xb56e('0x29')](_0x3eecc2[_0xb56e('0x28')],function(_0x8a1e89){if(_0x8a1e89[_0xb56e('0x2a')]===_0x32048d[_0xb56e('0x2b')]||_0x8a1e89['mobile_number']===_0x32048d[_0xb56e('0x2b')]){return _0x8a1e89;}});if(_0x184d1f){_0x32048d[_0xb56e('0x2c')]=_0x184d1f['id'];logger[_0xb56e('0xe')](_0xb56e('0x2d'),_0x32048d['endUserId']);_0x1e67ce(_0x32048d);}else{return createEndUser(_0x32048d,_0x888689,_0x5506ca,_0x341311)['then'](function(_0x2b7ce6){logger['info']('Contact\x20created:',_0x32048d[_0xb56e('0x2c')]);_0x1e67ce(_0x2b7ce6);});}}else{return createEndUser(_0x32048d,_0x888689,_0x5506ca,_0x341311)[_0xb56e('0x10')](function(_0x505405){logger[_0xb56e('0xe')]('Contact\x20created:',_0x32048d['endUserId']);_0x1e67ce(_0x505405);});}})[_0xb56e('0x18')](function(_0x10987c){throw new Error(_0x10987c[_0xb56e('0x1a')]);});});};}function createEndUser(_0x3e17d,_0x162a1f,_0x471c83,_0x1e66a7){return new Promise(function(_0x5ea8dc,_0x4af084){var _0x473185=moment();var _0x2a9341={'method':'POST','uri':_0x1e66a7+_0xb56e('0x2e'),'body':{'contact':{'last_name':_0x3e17d[_0xb56e('0x2b')],'work_number':_0x3e17d[_0xb56e('0x2b')],'mobile_number':_0x3e17d[_0xb56e('0x2b')],'owner_id':_0x3e17d[_0xb56e('0x1f')],'created_at':_0x473185['format'](_0xb56e('0x2f'))}},'json':!![]};_0x2a9341[_0xb56e('0xd')]=_0x471c83;logger[_0xb56e('0xe')](_0xb56e('0x30'));return rp(_0x2a9341)['then'](function(_0x2797bb){_0x3e17d[_0xb56e('0x2c')]=_0x2797bb[_0xb56e('0x31')]['id'];_0x5ea8dc(_0x3e17d);})[_0xb56e('0x18')](function(_0x180399){logger[_0xb56e('0x19')]('['+[_0x162a1f[_0xb56e('0x32')]()]+']',_0x180399[_0xb56e('0x1a')]);_0x4af084(_0x180399[_0xb56e('0x1a')]);});});}function getTicket(_0x4cdff7,_0xdf615e,_0x1d950e,_0x209c84,_0x137688){return function(_0x3efcbf){logger[_0xb56e('0xe')](_0xb56e('0x33'));return new Promise(function(_0x4d760,_0x529170){var _0x6da8a9=moment();var _0x34a1ba={'method':'POST','uri':_0x1d950e+_0xb56e('0x34'),'body':{'title':intUtil[_0xb56e('0x35')](_0x209c84[_0xb56e('0x36')],_0x137688,'\x20'),'description':intUtil[_0xb56e('0x35')](_0x209c84['Descriptions'],_0x137688,'\x0a'),'owner_id':_0x3efcbf[_0xb56e('0x1f')],'creater_id':_0x3efcbf[_0xb56e('0x15')],'targetable_id':_0x3efcbf['endUserId'],'targetable_type':_0xb56e('0x37'),'created_at':_0x6da8a9[_0xb56e('0x38')]('YYYY-MM-DDTHH:mm:ss'),'due_date':_0x6da8a9[_0xb56e('0x39')](0x1e,'m')[_0xb56e('0x38')](_0xb56e('0x2f'))},'json':!![]};_0x34a1ba['headers']=_0xdf615e;return rp(_0x34a1ba)[_0xb56e('0x10')](function(_0x19fcb5){_0x3efcbf[_0xb56e('0x3a')]=_0x19fcb5[_0xb56e('0x3b')]['id'];logger[_0xb56e('0xe')]('Task\x20created:',_0x3efcbf[_0xb56e('0x3a')]);_0x4d760(_0x3efcbf);})['catch'](function(_0x432530){logger['error']('['+[_0x4cdff7['toUpperCase']()]+']',_0x432530[_0xb56e('0x1a')]);_0x529170(_0x432530[_0xb56e('0x1a')]);});});};}function emit(_0x5063a2,_0x409a0a,_0x4e4f61){var _0xde829a={'uri':_0x5063a2+'/contacts/'+_0x4e4f61};io['to'](util['format']('user:%s',_0x409a0a))[_0xb56e('0x3c')](_0xb56e('0x3d'),_0xde829a);}exports['cs']=function(_0x1d1082,_0x257027,_0x10a003,_0x3823ed,_0x4076f5,_0x40f74a,_0x2116a2,_0x6f79a3){var _0x56ee2a={};var _0x456482={'Authorization':_0xb56e('0x3e')+_0x40f74a[_0xb56e('0x3f')]};_0x40f74a[_0xb56e('0x40')]=intUtil[_0xb56e('0x41')](_0x40f74a[_0xb56e('0x40')]);_0x40f74a['serverUrl']=intUtil[_0xb56e('0x41')](_0x40f74a['serverUrl']);var _0x5cc6a2=_0x40f74a[_0xb56e('0x40')];_0x56ee2a[_0xb56e('0x14')]=_0x40f74a[_0xb56e('0x42')];_0x56ee2a['contactNumber']=_0x6f79a3['toLowerCase']()===_0xb56e('0x43')?_0x257027['destcalleridnum']:_0x257027[_0xb56e('0x44')];_0x56ee2a[_0xb56e('0x45')]=_0x6f79a3===_0xb56e('0x46')||_0x6f79a3==='unmanaged'?'queue':'outbound';if(_0x3823ed){_0x56ee2a['agentEmail']=_0x3823ed['email'];}var _0x5c9a48=util[_0xb56e('0x38')](_0xb56e('0x47'),_0x40f74a[_0xb56e('0x48')],_0x257027[_0xb56e('0x49')],md5(_0x257027[_0xb56e('0x49')]));if(_0x4076f5&&_0x4076f5[_0xb56e('0x4a')]){logger[_0xb56e('0xe')](_0xb56e('0x4b'),_0xb56e('0x4c'));_0x257027[_0xb56e('0x4d')]=_0x5c9a48;}else if(_0x2116a2&&_0x2116a2[_0xb56e('0x4e')]&&_0x2116a2[_0xb56e('0x4e')]!==_0xb56e('0x4f')){logger[_0xb56e('0xe')]('[OUTBOUND]','Recording\x20is\x20enabled!');_0x257027[_0xb56e('0x4d')]=_0x5c9a48;}else{_0x257027[_0xb56e('0x4d')]='';}return getAdminId(_0x56ee2a,_0x6f79a3,_0x456482,_0x5cc6a2)[_0xb56e('0x10')](getUser(_0x6f79a3,_0x456482,_0x5cc6a2))[_0xb56e('0x10')](getEndUser(_0x6f79a3,_0x456482,_0x5cc6a2))['then'](getTicket(_0x6f79a3,_0x456482,_0x5cc6a2,_0x10a003,_0x257027))['then'](function(_0x2ff0b5){logger[_0xb56e('0xe')](util[_0xb56e('0x38')]('The\x20ticket\x20ID\x20is:\x20%s',_0x2ff0b5['ticketId']));if(_0x6f79a3!==_0xb56e('0x50')){logger[_0xb56e('0xe')]('['+[_0x6f79a3[_0xb56e('0x32')]()]+']','Displaying\x20task\x20in\x20a\x20new\x20tab...');emit(_0x5cc6a2,_0x3823ed[_0xb56e('0x51')],_0x2ff0b5[_0xb56e('0x2c')]);}})[_0xb56e('0x18')](function(_0x32ef09){logger[_0xb56e('0x19')]('['+[_0x6f79a3[_0xb56e('0x32')]()]+_0xb56e('0x52'),util[_0xb56e('0x53')](_0x32ef09,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0x58d3=['endUserId','POST','/api/contacts','format','YYYY-MM-DDTHH:mm:ss','contact','Creating\x20new\x20task','getString','Subjects','Descriptions','Contact','ticketId','task','Task\x20created:','user:%s','trigger:browser:url','Token\x20token=','apiKey','remoteUri','stripTrailingSlash','serverUrl','adminEmail','username','toLowerCase','destcalleridnum','calleridnum','callDirection','queue','unmanaged','email','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','recordingFormat','none','[OUTBOUND]','The\x20ticket\x20ID\x20is:\x20%s','Displaying\x20task\x20in\x20a\x20new\x20tab...',']\x20Error\x20running\x20Freshsales\x20integration','util','./util','../../../../config/environment','../../../../config/logger','freshsales','redis','defaults','localhost','socket.io-emitter','GET','/api/selector/owners','headers','info','Getting\x20admin\x20information','then','users','length','Requested\x20Resource\x20not\x20Found','catch','error','toUpperCase','message','Getting\x20user\x20list','Getting\x20user\x20with\x20email','userEmail','agentEmail','userId','User\x20found:','adminId','/api/contacts/filters','Getting\x20contacts\x20filter','filters','forEach','name','All\x20Contacts','Getting\x20contact\x20list','/api/contacts/view/','Searching\x20contact\x20with\x20phone','contactNumber','find','contacts','work_number','mobile_number'];(function(_0x5a4bb2,_0x258eb5){var _0x2821ce=function(_0x36fb9b){while(--_0x36fb9b){_0x5a4bb2['push'](_0x5a4bb2['shift']());}};_0x2821ce(++_0x258eb5);}(_0x58d3,0xd4));var _0x358d=function(_0x3d26b5,_0x36d92f){_0x3d26b5=_0x3d26b5-0x0;var _0x2f501b=_0x58d3[_0x3d26b5];return _0x2f501b;};'use strict';var _=require('lodash');var rp=require('request-promise');var md5=require('md5');var util=require(_0x358d('0x0'));var moment=require('moment');var Promise=require('bluebird');var Redis=require('ioredis');var intUtil=require(_0x358d('0x1'));var config=require(_0x358d('0x2'));var logger=require(_0x358d('0x3'))(_0x358d('0x4'));config[_0x358d('0x5')]=_[_0x358d('0x6')](config[_0x358d('0x5')],{'host':_0x358d('0x7'),'port':0x18eb});var io=require(_0x358d('0x8'))(new Redis(config[_0x358d('0x5')]));function getAdminId(_0x4e1f29,_0x20180a,_0x4dc0cf,_0x1a47a3){return new Promise(function(_0x464735,_0x151321){var _0x3bda14=![];var _0x9815de={'method':_0x358d('0x9'),'uri':_0x1a47a3+_0x358d('0xa'),'json':!![]};_0x9815de[_0x358d('0xb')]=_0x4dc0cf;logger[_0x358d('0xc')](_0x358d('0xd'));return rp(_0x9815de)[_0x358d('0xe')](function(_0x5b2104){if(_0x5b2104){var _0x5dd57a=_0x5b2104[_0x358d('0xf')];var _0x1cade7=null;for(_0x1cade7=0x0;_0x1cade7<_0x5dd57a[_0x358d('0x10')];_0x1cade7++){if(_0x5dd57a[_0x1cade7]['email']===_0x4e1f29['adminEmail']){_0x4e1f29['adminId']=_0x5dd57a[_0x1cade7]['id'];_0x3bda14=!![];}}if(_0x3bda14){logger[_0x358d('0xc')]('Admin\x20found:',_0x4e1f29['adminId']);_0x464735(_0x4e1f29);}else{_0x151321({'statusCode':0x194,'message':_0x358d('0x11')});}}else{_0x151321({'statusCode':0x194,'message':_0x358d('0x11')});}})[_0x358d('0x12')](function(_0xde2118){logger[_0x358d('0x13')]('['+[_0x20180a[_0x358d('0x14')]()]+']',_0xde2118[_0x358d('0x15')]);_0x151321(_0xde2118);});});}function getUser(_0x25a720,_0x51103a,_0x19b014){return function(_0x123732){return new Promise(function(_0x3ef03f,_0x3105dd){var _0x56f74b={'method':_0x358d('0x9'),'uri':_0x19b014+_0x358d('0xa'),'json':!![]};_0x56f74b[_0x358d('0xb')]=_0x51103a;logger['info'](_0x358d('0x16'));return rp(_0x56f74b)['then'](function(_0x5e6fcf){if(_0x5e6fcf){var _0x2ead0d=_0x5e6fcf[_0x358d('0xf')];var _0x35a6f8=![];var _0x360c2c=null;if(_0x123732['agentEmail']!==null){logger[_0x358d('0xc')](_0x358d('0x17'),_0x123732['agentEmail']);_0x123732[_0x358d('0x18')]=_0x123732[_0x358d('0x19')];for(_0x360c2c=0x0;_0x360c2c<_0x2ead0d['length'];_0x360c2c++){if(_0x2ead0d[_0x360c2c]['email']===_0x123732[_0x358d('0x19')]){_0x35a6f8=!![];_0x123732[_0x358d('0x1a')]=_0x2ead0d[_0x360c2c]['id'];logger[_0x358d('0xc')](_0x358d('0x1b'),_0x123732['userId']);}}}if(!_0x35a6f8){logger[_0x358d('0xc')]('Admin\x20selected');_0x123732[_0x358d('0x18')]=_0x123732['adminEmail'];_0x123732[_0x358d('0x1a')]=_0x123732[_0x358d('0x1c')];_0x35a6f8=!![];}if(_0x35a6f8){_0x3ef03f(_0x123732);}else{_0x3105dd({'statusCode':0x194,'message':'Requested\x20Resource\x20not\x20Found'});}}else{_0x3105dd({'statusCode':0x194,'message':_0x358d('0x11')});}})[_0x358d('0x12')](function(_0x385955){logger[_0x358d('0x13')]('['+[_0x25a720['toUpperCase']()]+']',_0x385955[_0x358d('0x15')]);_0x3105dd(_0x385955);});});};}function getEndUser(_0x30494a,_0x120aff,_0x337019){return function(_0x5dca6e){return new Promise(function(_0x575711,_0x28606d){var _0x9f9e9b=0x0;var _0x68e158={'method':_0x358d('0x9'),'uri':_0x337019+_0x358d('0x1d'),'json':!![]};_0x68e158['headers']=_0x120aff;logger[_0x358d('0xc')](_0x358d('0x1e'));return rp(_0x68e158)[_0x358d('0xe')](function(_0x3fd3b3){_0x3fd3b3[_0x358d('0x1f')][_0x358d('0x20')](function(_0x448885){if(_0x448885[_0x358d('0x21')]===_0x358d('0x22')){_0x9f9e9b=_0x448885['id'];}});})[_0x358d('0xe')](function(){logger[_0x358d('0xc')](_0x358d('0x23'));var _0x76dd70={'method':_0x358d('0x9'),'uri':_0x337019+_0x358d('0x24')+_0x9f9e9b,'json':!![]};_0x76dd70['headers']=_0x120aff;return rp(_0x76dd70);})[_0x358d('0xe')](function(_0x5e67e5){logger[_0x358d('0xc')](_0x358d('0x25'),_0x5dca6e[_0x358d('0x26')]);if(_0x5e67e5['contacts'][_0x358d('0x10')]>0x0){var _0x383645=_[_0x358d('0x27')](_0x5e67e5[_0x358d('0x28')],function(_0xa50ed2){if(_0xa50ed2[_0x358d('0x29')]===_0x5dca6e[_0x358d('0x26')]||_0xa50ed2[_0x358d('0x2a')]===_0x5dca6e[_0x358d('0x26')]){return _0xa50ed2;}});if(_0x383645){_0x5dca6e[_0x358d('0x2b')]=_0x383645['id'];logger['info']('Contact\x20found:',_0x5dca6e[_0x358d('0x2b')]);_0x575711(_0x5dca6e);}else{return createEndUser(_0x5dca6e,_0x30494a,_0x120aff,_0x337019)[_0x358d('0xe')](function(_0xd3b6e2){logger[_0x358d('0xc')]('Contact\x20created:',_0x5dca6e[_0x358d('0x2b')]);_0x575711(_0xd3b6e2);});}}else{return createEndUser(_0x5dca6e,_0x30494a,_0x120aff,_0x337019)['then'](function(_0x58c826){logger[_0x358d('0xc')]('Contact\x20created:',_0x5dca6e[_0x358d('0x2b')]);_0x575711(_0x58c826);});}})[_0x358d('0x12')](function(_0x46d388){throw new Error(_0x46d388[_0x358d('0x15')]);});});};}function createEndUser(_0x40adb3,_0x5082e3,_0x2d9c3b,_0x4edf9e){return new Promise(function(_0x2c9994,_0xd8fdf4){var _0x122163=moment();var _0x429d00={'method':_0x358d('0x2c'),'uri':_0x4edf9e+_0x358d('0x2d'),'body':{'contact':{'last_name':_0x40adb3[_0x358d('0x26')],'work_number':_0x40adb3['contactNumber'],'mobile_number':_0x40adb3[_0x358d('0x26')],'owner_id':_0x40adb3[_0x358d('0x1a')],'created_at':_0x122163[_0x358d('0x2e')](_0x358d('0x2f'))}},'json':!![]};_0x429d00[_0x358d('0xb')]=_0x2d9c3b;logger[_0x358d('0xc')]('Contact\x20not\x20found,\x20creating\x20a\x20new\x20contact');return rp(_0x429d00)[_0x358d('0xe')](function(_0x38ac6c){_0x40adb3[_0x358d('0x2b')]=_0x38ac6c[_0x358d('0x30')]['id'];_0x2c9994(_0x40adb3);})[_0x358d('0x12')](function(_0x3dad01){logger[_0x358d('0x13')]('['+[_0x5082e3[_0x358d('0x14')]()]+']',_0x3dad01[_0x358d('0x15')]);_0xd8fdf4(_0x3dad01[_0x358d('0x15')]);});});}function getTicket(_0x1ff34d,_0x504b27,_0x161306,_0x32b2fd,_0x2ec1a3){return function(_0x150b72){logger[_0x358d('0xc')](_0x358d('0x31'));return new Promise(function(_0x35bc78,_0x3b9ad8){var _0x3477a4=moment();var _0x31a6fc={'method':_0x358d('0x2c'),'uri':_0x161306+'/api/tasks','body':{'title':intUtil[_0x358d('0x32')](_0x32b2fd[_0x358d('0x33')],_0x2ec1a3,'\x20'),'description':intUtil['getString'](_0x32b2fd[_0x358d('0x34')],_0x2ec1a3,'\x0a'),'owner_id':_0x150b72[_0x358d('0x1a')],'creater_id':_0x150b72['adminId'],'targetable_id':_0x150b72[_0x358d('0x2b')],'targetable_type':_0x358d('0x35'),'created_at':_0x3477a4[_0x358d('0x2e')]('YYYY-MM-DDTHH:mm:ss'),'due_date':_0x3477a4['add'](0x1e,'m')[_0x358d('0x2e')]('YYYY-MM-DDTHH:mm:ss')},'json':!![]};_0x31a6fc['headers']=_0x504b27;return rp(_0x31a6fc)[_0x358d('0xe')](function(_0xbdeeb5){_0x150b72[_0x358d('0x36')]=_0xbdeeb5[_0x358d('0x37')]['id'];logger[_0x358d('0xc')](_0x358d('0x38'),_0x150b72[_0x358d('0x36')]);_0x35bc78(_0x150b72);})[_0x358d('0x12')](function(_0x2623a7){logger['error']('['+[_0x1ff34d[_0x358d('0x14')]()]+']',_0x2623a7['message']);_0x3b9ad8(_0x2623a7[_0x358d('0x15')]);});});};}function emit(_0x79cb83,_0x86d83,_0x181d50){var _0x54ef71={'uri':_0x79cb83+'/contacts/'+_0x181d50};io['to'](util[_0x358d('0x2e')](_0x358d('0x39'),_0x86d83))['emit'](_0x358d('0x3a'),_0x54ef71);}exports['cs']=function(_0x41c870,_0x5b43a0,_0x15e35d,_0x3aee43,_0x56f1b8,_0x2d47b8,_0xb37440,_0x31d9c5){var _0x286e12={};var _0x451a86={'Authorization':_0x358d('0x3b')+_0x2d47b8[_0x358d('0x3c')]};_0x2d47b8[_0x358d('0x3d')]=intUtil[_0x358d('0x3e')](_0x2d47b8[_0x358d('0x3d')]);_0x2d47b8[_0x358d('0x3f')]=intUtil['stripTrailingSlash'](_0x2d47b8[_0x358d('0x3f')]);var _0xb64eee=_0x2d47b8[_0x358d('0x3d')];_0x286e12[_0x358d('0x40')]=_0x2d47b8[_0x358d('0x41')];_0x286e12[_0x358d('0x26')]=_0x31d9c5[_0x358d('0x42')]()==='outbound'?_0x5b43a0[_0x358d('0x43')]:_0x5b43a0[_0x358d('0x44')];_0x286e12[_0x358d('0x45')]=_0x31d9c5===_0x358d('0x46')||_0x31d9c5===_0x358d('0x47')?_0x358d('0x46'):'outbound';if(_0x3aee43){_0x286e12[_0x358d('0x19')]=_0x3aee43[_0x358d('0x48')];}var _0x4bb321=util[_0x358d('0x2e')](_0x358d('0x49'),_0x2d47b8['serverUrl'],_0x5b43a0[_0x358d('0x4a')],md5(_0x5b43a0[_0x358d('0x4a')]));if(_0x56f1b8&&_0x56f1b8[_0x358d('0x4b')]){logger[_0x358d('0xc')](_0x358d('0x4c'),_0x358d('0x4d'));_0x5b43a0[_0x358d('0x4e')]=_0x4bb321;}else if(_0xb37440&&_0xb37440[_0x358d('0x4f')]&&_0xb37440[_0x358d('0x4f')]!==_0x358d('0x50')){logger[_0x358d('0xc')](_0x358d('0x51'),_0x358d('0x4d'));_0x5b43a0[_0x358d('0x4e')]=_0x4bb321;}else{_0x5b43a0[_0x358d('0x4e')]='';}return getAdminId(_0x286e12,_0x31d9c5,_0x451a86,_0xb64eee)[_0x358d('0xe')](getUser(_0x31d9c5,_0x451a86,_0xb64eee))['then'](getEndUser(_0x31d9c5,_0x451a86,_0xb64eee))[_0x358d('0xe')](getTicket(_0x31d9c5,_0x451a86,_0xb64eee,_0x15e35d,_0x5b43a0))[_0x358d('0xe')](function(_0x105c8f){logger[_0x358d('0xc')](util[_0x358d('0x2e')](_0x358d('0x52'),_0x105c8f[_0x358d('0x36')]));if(_0x31d9c5!=='unmanaged'){logger['info']('['+[_0x31d9c5[_0x358d('0x14')]()]+']',_0x358d('0x53'));emit(_0xb64eee,_0x3aee43[_0x358d('0x21')],_0x105c8f[_0x358d('0x2b')]);}})[_0x358d('0x12')](function(_0xb68f24){logger[_0x358d('0x13')]('['+[_0x31d9c5[_0x358d('0x14')]()]+_0x358d('0x54'),util['inspect'](_0xb68f24,{'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 00e4758..83c501c 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 _0x3266=['salesforce','sugarcrm','zoho','vtiger','dynamics365','freshsales','servicenow','exec','includes','data1','toLowerCase','Configurations','data3','queue','routeId','outbound','EVENT\x20UNKNOWN','freshdesk','desk','log','unknown\x20integration','../../../../config/logger','[EXEC]','%s\x20configuration\x20#%s\x20not\x20found','error','format','%s\x20account\x20#%s\x20not\x20found','data2','lodash','util','./zendesk','./salesforce','./sugarcrm','./freshdesk','./zoho','./desk','./vtiger','./dynamics365','zendesk'];(function(_0x1aa59b,_0x26612c){var _0x33011c=function(_0x29d625){while(--_0x29d625){_0x1aa59b['push'](_0x1aa59b['shift']());}};_0x33011c(++_0x26612c);}(_0x3266,0x6a));var _0x6326=function(_0x1d50f2,_0x3c3ec6){_0x1d50f2=_0x1d50f2-0x0;var _0x3769b8=_0x3266[_0x1d50f2];return _0x3769b8;};'use strict';var _=require(_0x6326('0x0'));var util=require(_0x6326('0x1'));var zendesk=require(_0x6326('0x2'));var salesforce=require(_0x6326('0x3'));var sugarcrm=require(_0x6326('0x4'));var freshdesk=require(_0x6326('0x5'));var zoho=require(_0x6326('0x6'));var desk=require(_0x6326('0x7'));var vtiger=require(_0x6326('0x8'));var servicenow=require('./servicenow');var dynamics365=require(_0x6326('0x9'));var freshsales=require('./freshsales');var integrations=[_0x6326('0xa'),_0x6326('0xb'),_0x6326('0xc'),'freshdesk',_0x6326('0xd'),'desk',_0x6326('0xe'),_0x6326('0xf'),_0x6326('0x10'),_0x6326('0x11')];exports[_0x6326('0x12')]=function(_0x53c3e1,_0x1b45a7,_0x464a36,_0x3590ab,_0x1e6909,_0x416844){if(_0x464a36){if(_[_0x6326('0x13')](integrations,_0x53c3e1[_0x6326('0x14')][_0x6326('0x15')]())){try{var _0x40a68a=null;var _0x379358='';var _0x5c07e1=_0x464a36[_0x53c3e1['data1'][_0x6326('0x15')]()];if(_0x5c07e1){var _0x136946=_0x5c07e1[_0x53c3e1['data2']];if(_0x136946){var _0x425878=_['find'](_0x136946[_0x6326('0x16')],{'id':parseInt(_0x53c3e1[_0x6326('0x17')],0xa)});if(_0x425878){if(_0x3590ab){if(_0x1e6909&&_0x1b45a7[_0x6326('0x18')]){_0x379358=_0x6326('0x18');}else if(_0x1b45a7[_0x6326('0x19')]){_0x379358=_0x6326('0x1a');}else{console['log'](_0x6326('0x1b'),_0x1b45a7);}}else{_0x379358='unmanaged';}switch(_0x53c3e1['data1']['toLowerCase']()){case'zendesk':zendesk[_0x379358](_0x53c3e1,_0x1b45a7,_0x425878,_0x3590ab,_0x1e6909,_0x136946,_0x416844);break;case'salesforce':salesforce[_0x379358](_0x53c3e1,_0x1b45a7,_0x425878,_0x3590ab,_0x1e6909,_0x136946,_0x416844);break;case'sugarcrm':sugarcrm[_0x379358](_0x53c3e1,_0x1b45a7,_0x425878,_0x3590ab,_0x1e6909,_0x136946,_0x416844);break;case _0x6326('0x1c'):freshdesk[_0x379358](_0x53c3e1,_0x1b45a7,_0x425878,_0x3590ab,_0x1e6909,_0x136946,_0x416844);break;case _0x6326('0xd'):zoho[_0x379358](_0x53c3e1,_0x1b45a7,_0x425878,_0x3590ab,_0x1e6909,_0x136946,_0x416844);break;case _0x6326('0x1d'):desk[_0x379358](_0x53c3e1,_0x1b45a7,_0x425878,_0x3590ab,_0x1e6909,_0x136946,_0x416844);break;case'vtiger':vtiger[_0x379358](_0x53c3e1,_0x1b45a7,_0x425878,_0x3590ab,_0x1e6909,_0x136946,_0x416844);break;case'freshsales':freshsales['cs'](_0x53c3e1,_0x1b45a7,_0x425878,_0x3590ab,_0x1e6909,_0x136946,_0x416844,_0x379358);break;case _0x6326('0x11'):servicenow['cs'](_0x53c3e1,_0x1b45a7,_0x425878,_0x3590ab,_0x1e6909,_0x136946,_0x416844,_0x379358);break;case _0x6326('0xf'):dynamics365['cs'](_0x53c3e1,_0x1b45a7,_0x425878,_0x3590ab,_0x1e6909,_0x136946,_0x416844,_0x379358);break;default:console[_0x6326('0x1e')](_0x6326('0x1f'));}}else{_0x40a68a=require(_0x6326('0x20'))(_0x53c3e1[_0x6326('0x14')][_0x6326('0x15')]());_0x40a68a['error'](_0x6326('0x21'),util['format'](_0x6326('0x22'),_0x53c3e1[_0x6326('0x14')][_0x6326('0x15')](),_0x53c3e1[_0x6326('0x17')]));}}else{_0x40a68a=require(_0x6326('0x20'))(_0x53c3e1[_0x6326('0x14')][_0x6326('0x15')]());_0x40a68a[_0x6326('0x23')](_0x6326('0x21'),util[_0x6326('0x24')](_0x6326('0x25'),_0x53c3e1['data1'][_0x6326('0x15')](),_0x53c3e1[_0x6326('0x26')]));}}else{}}catch(_0x575701){console['error'](_0x575701);}}}}; \ No newline at end of file +var _0x9c00=['./desk','./vtiger','./servicenow','./dynamics365','./freshsales','sugarcrm','freshdesk','zoho','desk','vtiger','freshsales','servicenow','exec','includes','data1','toLowerCase','data2','find','Configurations','data3','queue','routeId','unmanaged','zendesk','dynamics365','unknown\x20integration','../../../../config/logger','error','[EXEC]','format','%s\x20account\x20#%s\x20not\x20found','lodash','util','./sugarcrm','./freshdesk'];(function(_0x4a158e,_0x2a22d1){var _0x30013e=function(_0x417a81){while(--_0x417a81){_0x4a158e['push'](_0x4a158e['shift']());}};_0x30013e(++_0x2a22d1);}(_0x9c00,0x1a0));var _0x09c0=function(_0x4b432a,_0x578c42){_0x4b432a=_0x4b432a-0x0;var _0x505158=_0x9c00[_0x4b432a];return _0x505158;};'use strict';var _=require(_0x09c0('0x0'));var util=require(_0x09c0('0x1'));var zendesk=require('./zendesk');var salesforce=require('./salesforce');var sugarcrm=require(_0x09c0('0x2'));var freshdesk=require(_0x09c0('0x3'));var zoho=require('./zoho');var desk=require(_0x09c0('0x4'));var vtiger=require(_0x09c0('0x5'));var servicenow=require(_0x09c0('0x6'));var dynamics365=require(_0x09c0('0x7'));var freshsales=require(_0x09c0('0x8'));var integrations=['zendesk','salesforce',_0x09c0('0x9'),_0x09c0('0xa'),_0x09c0('0xb'),_0x09c0('0xc'),_0x09c0('0xd'),'dynamics365',_0x09c0('0xe'),_0x09c0('0xf')];exports[_0x09c0('0x10')]=function(_0x1feb1d,_0x27a33c,_0x1e16f4,_0x1fec4f,_0x36f26d,_0x278f8b){if(_0x1e16f4){if(_[_0x09c0('0x11')](integrations,_0x1feb1d[_0x09c0('0x12')][_0x09c0('0x13')]())){try{var _0x2929f1=null;var _0x144271='';var _0x3b95cc=_0x1e16f4[_0x1feb1d[_0x09c0('0x12')][_0x09c0('0x13')]()];if(_0x3b95cc){var _0x2a86da=_0x3b95cc[_0x1feb1d[_0x09c0('0x14')]];if(_0x2a86da){var _0x3649d2=_[_0x09c0('0x15')](_0x2a86da[_0x09c0('0x16')],{'id':parseInt(_0x1feb1d[_0x09c0('0x17')],0xa)});if(_0x3649d2){if(_0x1fec4f){if(_0x36f26d&&_0x27a33c[_0x09c0('0x18')]){_0x144271=_0x09c0('0x18');}else if(_0x27a33c[_0x09c0('0x19')]){_0x144271='outbound';}else{console['log']('EVENT\x20UNKNOWN',_0x27a33c);}}else{_0x144271=_0x09c0('0x1a');}switch(_0x1feb1d[_0x09c0('0x12')][_0x09c0('0x13')]()){case _0x09c0('0x1b'):zendesk[_0x144271](_0x1feb1d,_0x27a33c,_0x3649d2,_0x1fec4f,_0x36f26d,_0x2a86da,_0x278f8b);break;case'salesforce':salesforce[_0x144271](_0x1feb1d,_0x27a33c,_0x3649d2,_0x1fec4f,_0x36f26d,_0x2a86da,_0x278f8b);break;case _0x09c0('0x9'):sugarcrm[_0x144271](_0x1feb1d,_0x27a33c,_0x3649d2,_0x1fec4f,_0x36f26d,_0x2a86da,_0x278f8b);break;case'freshdesk':freshdesk[_0x144271](_0x1feb1d,_0x27a33c,_0x3649d2,_0x1fec4f,_0x36f26d,_0x2a86da,_0x278f8b);break;case'zoho':zoho[_0x144271](_0x1feb1d,_0x27a33c,_0x3649d2,_0x1fec4f,_0x36f26d,_0x2a86da,_0x278f8b);break;case _0x09c0('0xc'):desk[_0x144271](_0x1feb1d,_0x27a33c,_0x3649d2,_0x1fec4f,_0x36f26d,_0x2a86da,_0x278f8b);break;case'vtiger':vtiger[_0x144271](_0x1feb1d,_0x27a33c,_0x3649d2,_0x1fec4f,_0x36f26d,_0x2a86da,_0x278f8b);break;case _0x09c0('0xe'):freshsales['cs'](_0x1feb1d,_0x27a33c,_0x3649d2,_0x1fec4f,_0x36f26d,_0x2a86da,_0x278f8b,_0x144271);break;case _0x09c0('0xf'):servicenow['cs'](_0x1feb1d,_0x27a33c,_0x3649d2,_0x1fec4f,_0x36f26d,_0x2a86da,_0x278f8b,_0x144271);break;case _0x09c0('0x1c'):dynamics365['cs'](_0x1feb1d,_0x27a33c,_0x3649d2,_0x1fec4f,_0x36f26d,_0x2a86da,_0x278f8b,_0x144271);break;default:console['log'](_0x09c0('0x1d'));}}else{_0x2929f1=require(_0x09c0('0x1e'))(_0x1feb1d[_0x09c0('0x12')][_0x09c0('0x13')]());_0x2929f1[_0x09c0('0x1f')](_0x09c0('0x20'),util[_0x09c0('0x21')]('%s\x20configuration\x20#%s\x20not\x20found',_0x1feb1d[_0x09c0('0x12')][_0x09c0('0x13')](),_0x1feb1d[_0x09c0('0x17')]));}}else{_0x2929f1=require(_0x09c0('0x1e'))(_0x1feb1d['data1']['toLowerCase']());_0x2929f1[_0x09c0('0x1f')](_0x09c0('0x20'),util[_0x09c0('0x21')](_0x09c0('0x22'),_0x1feb1d['data1'][_0x09c0('0x13')](),_0x1feb1d[_0x09c0('0x14')]));}}else{}}catch(_0x56d883){console[_0x09c0('0x1f')](_0x56d883);}}}}; \ 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 3e5eb32..889f76d 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 _0x860c=['moduleCreate','Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.','No\x20Company','type','string','idField','toString','variableName','customVariable','Variable','name','toLowerCase','concat','securityToken','Connection','remoteUri','clientId','clientSecret','login','queue','serverUrl','stripTrailingSlash','monitor_format','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','recordingURL','email','calleridname','calleridnum','[QUEUE]\x20Ticket\x20%s\x20created','[QUEUE]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','user:%s','trigger:salesforce:display','trigger:browser:url','%s/%s/e','instanceUrl','error','[QUEUE]\x20Salesforce\x20account\x20type\x20not\x20recognized.','catch','[QUEUE]','stringify','recordingFormat','Recording\x20is\x20enabled!','uniqueid','destcalleridname','destcalleridnum','outbound','[OUTBOUND]\x20Ticket\x20%s\x20created.','integrationTab','newTab','Salesforce\x20account\x20type\x20not\x20recognized','[OUTBOUND]','unmanaged','lastevent','toUpperCase',']\x20Ticket\x20%s\x20created.',']\x20Integration\x20account\x20type\x20%s.','lodash','request-promise','moment','bluebird','md5','util','ioredis','../../../../config/logger','salesforce','redis','emit','ticketType','assign','utc','getString','Subjects','Descriptions','WhoId','Case','ContactId','sobject','create','isNil','validateEmail','User','find','then','length','Email','Agent\x20%s\x20found.','resolve','Name','info','Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.','identity','user_id','display_name','Searching\x20enduser\x20with\x20phone\x20%s.\x20Serching\x20method\x20used\x20%s.','contact_lead','Contact','execute','Lead','lead','contact','Phone','Enduser\x20with\x20phone\x20%s\x20found.','Enduser\x20with\x20phone\x20%s\x20not\x20found.','format'];(function(_0x3d8ca8,_0x1a9764){var _0x517e45=function(_0x641ad9){while(--_0x641ad9){_0x3d8ca8['push'](_0x3d8ca8['shift']());}};_0x517e45(++_0x1a9764);}(_0x860c,0x170));var _0xc860=function(_0x4e68a7,_0x436bfd){_0x4e68a7=_0x4e68a7-0x0;var _0x528435=_0x860c[_0x4e68a7];return _0x528435;};'use strict';var _=require(_0xc860('0x0'));var rp=require(_0xc860('0x1'));var moment=require(_0xc860('0x2'));var BPromise=require(_0xc860('0x3'));var md5=require(_0xc860('0x4'));var jsforce=require('jsforce');var util=require(_0xc860('0x5'));var Redis=require(_0xc860('0x6'));var intUtil=require('./util');var config=require('../../../../config/environment');var logger=require(_0xc860('0x7'))(_0xc860('0x8'));config[_0xc860('0x9')]=_['defaults'](config[_0xc860('0x9')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xc860('0x9')]));function emit(_0xec1434,_0x1b986f,_0x4243bf){io['to'](_0xec1434)[_0xc860('0xa')](_0x1b986f,_0x4243bf);}function getTicket(_0x30a158,_0x59457c,_0x2c6d0d,_0x247d4d,_0x4d9c4e,_0x3a983a,_0x15657d,_0x437d41){var _0xa3ad81={};if(_0x247d4d[_0xc860('0xb')]==='Task'){_0xa3ad81=Object[_0xc860('0xc')]({},{'OwnerId':_0x59457c['id'],'ActivityDate':moment[_0xc860('0xd')](),'IsReminderSet':![],'IsRecurrence':![],'Subject':intUtil[_0xc860('0xe')](_0x247d4d[_0xc860('0xf')],_0x4d9c4e,'\x20'),'Description':intUtil[_0xc860('0xe')](_0x247d4d[_0xc860('0x10')],_0x4d9c4e,'\x0a')},getCustomFields(_0x3a983a,_0x4d9c4e));if(_0x2c6d0d){_0xa3ad81[_0xc860('0x11')]=_0x2c6d0d['id'];}}else if(_0x247d4d['ticketType']===_0xc860('0x12')){_0xa3ad81=Object[_0xc860('0xc')]({},{'OwnerId':_0x59457c['id'],'Subject':intUtil[_0xc860('0xe')](_0x247d4d[_0xc860('0xf')],_0x4d9c4e,'\x20'),'Description':intUtil['getString'](_0x247d4d['Descriptions'],_0x4d9c4e,'\x0a')},getCustomFields(_0x3a983a,_0x4d9c4e));if(_0x2c6d0d){_0xa3ad81[_0xc860('0x13')]=_0x2c6d0d['id'];}}return _0x15657d[_0xc860('0x14')](_0x247d4d[_0xc860('0xb')])[_0xc860('0x15')](_0xa3ad81);}function getUser(_0x24e286,_0x50f59a,_0x5427e7){if(!_[_0xc860('0x16')](_0x50f59a)&&intUtil[_0xc860('0x17')](_0x50f59a)){var _0x45ea21={'Email':_0x50f59a};var _0x19baf5={'Id':!![],'Username':!![],'Name':!![],'Email':!![]};return _0x5427e7['sobject'](_0xc860('0x18'))[_0xc860('0x19')](_0x45ea21,_0x19baf5)['execute']()[_0xc860('0x1a')](function(_0x46fcef){if(_0x46fcef[_0xc860('0x1b')]){var _0x4368d6=_[_0xc860('0x19')](_0x46fcef,function(_0x41890a){return _0x41890a[_0xc860('0x1c')]===_0x50f59a;});if(_0x4368d6){logger['info'](_0xc860('0x1d'),_0x50f59a);return BPromise[_0xc860('0x1e')]({'id':_0x4368d6['Id'],'name':_0x4368d6[_0xc860('0x1f')]});}}else{logger[_0xc860('0x20')](_0xc860('0x21'),_0x50f59a);return _0x5427e7[_0xc860('0x22')]()['then'](function(_0x34d056){return BPromise[_0xc860('0x1e')]({'id':_0x34d056[_0xc860('0x23')],'name':_0x34d056['display_name']});});}});}else{logger[_0xc860('0x20')](_0xc860('0x21'),_0x50f59a);return _0x5427e7['identity']()[_0xc860('0x1a')](function(_0x3430c5){return BPromise[_0xc860('0x1e')]({'id':_0x3430c5[_0xc860('0x23')],'name':_0x3430c5[_0xc860('0x24')]});});}}function getEndUser(_0x54373b,_0x188bc4,_0xcdf293,_0xd1428e,_0x31013c){var _0x73c00b={'Phone':_0xd1428e};var _0x558861={'Id':!![],'Name':!![],'Phone':!![]};return BPromise[_0xc860('0x1e')]()[_0xc860('0x1a')](function(){if(_0x188bc4['ticketType']==='Task'){logger[_0xc860('0x20')](_0xc860('0x25'),_0xd1428e,_0x188bc4['moduleSearch']);switch(_0x188bc4['moduleSearch']){case _0xc860('0x26'):return _0x31013c['sobject'](_0xc860('0x27'))[_0xc860('0x19')](_0x73c00b,_0x558861)[_0xc860('0x28')]()['then'](function(_0x1db4d9){if(_0x1db4d9&&_0x1db4d9[_0xc860('0x1b')]){return _0x1db4d9;}else{return _0x31013c[_0xc860('0x14')](_0xc860('0x29'))['find'](_0x73c00b,_0x558861);}});case'contact':return _0x31013c[_0xc860('0x14')](_0xc860('0x27'))[_0xc860('0x19')](_0x73c00b,_0x558861)['execute']();case _0xc860('0x2a'):return _0x31013c[_0xc860('0x14')](_0xc860('0x29'))['find'](_0x73c00b,_0x558861);default:return null;}}else if(_0x188bc4[_0xc860('0xb')]===_0xc860('0x12')){logger[_0xc860('0x20')]('Searching\x20enduser\x20with\x20phone\x20%s.\x20Serching\x20method\x20used\x20%s.',_0xd1428e,_0xc860('0x2b'));return _0x31013c[_0xc860('0x14')](_0xc860('0x27'))['find'](_0x73c00b,_0x558861)[_0xc860('0x28')]();}})[_0xc860('0x1a')](function(_0x238e31){if(_0x238e31&&_0x238e31[_0xc860('0x1b')]){var _0x47e377=_[_0xc860('0x19')](_0x238e31,function(_0x998ad0){return _0x998ad0[_0xc860('0x2c')]===_0xd1428e;});if(_0x47e377){return BPromise[_0xc860('0x1e')]({'id':_0x47e377['Id'],'name':_0x47e377['Name'],'phone':_0x47e377[_0xc860('0x2c')]});}}})[_0xc860('0x1a')](function(_0x2ddff2){if(_0x2ddff2){logger[_0xc860('0x20')](_0xc860('0x2d'),_0xd1428e);return BPromise[_0xc860('0x1e')](_0x2ddff2);}else{logger[_0xc860('0x20')](_0xc860('0x2e'),_0xd1428e);var _0x233dd2={'LastName':_0xcdf293!==''?_0xcdf293:util[_0xc860('0x2f')]('Caller\x20-\x20%s',_0xd1428e),'Phone':_0xd1428e};if(_0x188bc4[_0xc860('0x30')]){if(_0x188bc4[_0xc860('0x30')]===_0xc860('0x2b')){logger['info'](_0xc860('0x31'),_0xd1428e,_0x188bc4[_0xc860('0x30')]);}else if(_0x188bc4[_0xc860('0x30')]===_0xc860('0x2a')&&_0x188bc4[_0xc860('0xb')]==='Task'){logger['info'](_0xc860('0x31'),_0xd1428e,_0x188bc4['moduleCreate']);_0x233dd2['Company']=_0xc860('0x32');}else{return null;}}return _0x31013c['sobject'](_['upperFirst'](_0x188bc4[_0xc860('0x30')]))[_0xc860('0x15')](_0x233dd2);}});}function getCustomFields(_0x355fc1,_0x555a63){var _0x5710a6={};if(_0x355fc1['length']>0x0){_['forEach'](_0x355fc1,function(_0x3da642){if(_0x3da642[_0xc860('0x33')]===_0xc860('0x34')&&_0x3da642[_0xc860('0x35')]){_0x5710a6[_0x3da642[_0xc860('0x35')]]=_0x3da642['content'][_0xc860('0x36')]();}else if(_0x3da642['type']==='variable'&&_0x3da642[_0xc860('0x37')]&&_0x3da642[_0xc860('0x35')]){_0x555a63[_0x3da642['variableName']]&&(_0x5710a6[_0x3da642[_0xc860('0x35')]]=_0x555a63[_0x3da642[_0xc860('0x37')]][_0xc860('0x36')]());}else if(_0x3da642[_0xc860('0x33')]===_0xc860('0x38')&&_0x3da642[_0xc860('0x39')]&&_0x3da642[_0xc860('0x39')][_0xc860('0x3a')]&&_0x3da642['idField']){_0x555a63[_0x3da642[_0xc860('0x39')][_0xc860('0x3a')][_0xc860('0x3b')]()]&&(_0x5710a6[_0x3da642[_0xc860('0x35')]]=_0x555a63[_0x3da642['Variable'][_0xc860('0x3a')]['toLowerCase']()][_0xc860('0x36')]());}});}return _0x5710a6;}function getConnection(_0x1e2349){var _0x1f6b95=_0x1e2349['password'][_0xc860('0x3c')](_0x1e2349[_0xc860('0x3d')]);var _0x54b5eb=new jsforce[(_0xc860('0x3e'))]({'oauth2':{'loginUrl':_0x1e2349[_0xc860('0x3f')]||'https://login.salesforce.com','clientId':_0x1e2349[_0xc860('0x40')],'clientSecret':_0x1e2349[_0xc860('0x41')]}});return _0x54b5eb[_0xc860('0x42')](_0x1e2349['username'],_0x1f6b95)[_0xc860('0x1a')](function(){logger[_0xc860('0x20')]('Connection\x20established.');return _0x54b5eb;});}exports[_0xc860('0x43')]=function(_0x582085,_0x2a4e48,_0x56840b,_0x11305b,_0x14809e,_0x26e31e){var _0x5f26a2,_0x168d78,_0x2f8ddf,_0x450b2d;_0x26e31e[_0xc860('0x44')]=intUtil[_0xc860('0x45')](_0x26e31e[_0xc860('0x44')]);_0x26e31e[_0xc860('0x3f')]=intUtil[_0xc860('0x45')](_0x26e31e[_0xc860('0x3f')]);if(_0x14809e&&_0x14809e[_0xc860('0x46')]){logger['info']('[QUEUE]','Recording\x20is\x20enabled!');_0x2a4e48['recordingURL']=util[_0xc860('0x2f')](_0xc860('0x47'),_0x26e31e[_0xc860('0x44')],_0x2a4e48['uniqueid'],md5(_0x2a4e48['uniqueid']));}else{_0x2a4e48[_0xc860('0x48')]='';}return getConnection(_0x26e31e)[_0xc860('0x1a')](function(_0x442116){_0x450b2d=_0x442116;return getUser(_0x26e31e,_0x11305b[_0xc860('0x49')],_0x450b2d);})[_0xc860('0x1a')](function(_0x3e050f){_0x5f26a2=_0x3e050f;return getEndUser(_0x26e31e,_0x56840b,_0x2a4e48[_0xc860('0x4a')],_0x2a4e48[_0xc860('0x4b')],_0x450b2d);})[_0xc860('0x1a')](function(_0x49a058){_0x168d78=_0x49a058;return getTicket(_0x26e31e,_0x5f26a2,_0x168d78,_0x56840b,_0x2a4e48,_0x56840b['Fields'],_0x450b2d,_0xc860('0x43'));})[_0xc860('0x1a')](function(_0xf07108){_0x2f8ddf=_0xf07108;logger[_0xc860('0x20')](_0xc860('0x4c'),_0x2f8ddf['id']);logger[_0xc860('0x20')](_0xc860('0x4d'),_0x2f8ddf['id'],_0x11305b[_0xc860('0x3a')],_0x26e31e['type']);switch(_0x26e31e[_0xc860('0x33')]){case'integrationTab':emit(util['format'](_0xc860('0x4e'),_0x11305b['name']),_0xc860('0x4f'),{'recordId':_0x2f8ddf['id']});break;case'newTab':emit(util['format'](_0xc860('0x4e'),_0x11305b['name']),_0xc860('0x50'),{'uri':util[_0xc860('0x2f')](_0xc860('0x51'),_0x450b2d[_0xc860('0x52')],_0x2f8ddf['id'])});break;default:logger[_0xc860('0x53')](_0xc860('0x54'));}})[_0xc860('0x55')](function(_0x293042){logger[_0xc860('0x53')](_0xc860('0x56'),JSON[_0xc860('0x57')](_0x293042));});};exports['outbound']=function(_0x3d69c7,_0xb3d544,_0x263ffb,_0x47cc6c,_0x38622c,_0x5cb62a,_0x1e4da7){var _0x15933a,_0x392f26,_0x1efeeb,_0x57cd01;_0x5cb62a[_0xc860('0x44')]=intUtil[_0xc860('0x45')](_0x5cb62a['serverUrl']);_0x5cb62a[_0xc860('0x3f')]=intUtil[_0xc860('0x45')](_0x5cb62a[_0xc860('0x3f')]);if(_0x1e4da7&&_0x1e4da7['recordingFormat']&&_0x1e4da7[_0xc860('0x58')]!=='none'){logger[_0xc860('0x20')]('[OUTBOUND]',_0xc860('0x59'));_0xb3d544['recordingURL']=util[_0xc860('0x2f')](_0xc860('0x47'),_0x5cb62a[_0xc860('0x44')],_0xb3d544[_0xc860('0x5a')],md5(_0xb3d544['uniqueid']));}return getConnection(_0x5cb62a)[_0xc860('0x1a')](function(_0x2c6384){_0x57cd01=_0x2c6384;return getUser(_0x5cb62a,_0x47cc6c['email'],_0x57cd01);})[_0xc860('0x1a')](function(_0x47a108){_0x15933a=_0x47a108;return getEndUser(_0x5cb62a,_0x263ffb,_0xb3d544[_0xc860('0x5b')],_0xb3d544[_0xc860('0x5c')],_0x57cd01);})[_0xc860('0x1a')](function(_0x53a6b4){_0x392f26=_0x53a6b4;return getTicket(_0x5cb62a,_0x15933a,_0x392f26,_0x263ffb,_0xb3d544,_0x263ffb['Fields'],_0x57cd01,_0xc860('0x5d'));})[_0xc860('0x1a')](function(_0x4a25b0){_0x1efeeb=_0x4a25b0;logger[_0xc860('0x20')](_0xc860('0x5e'),_0x1efeeb['id']);logger[_0xc860('0x20')]('[OUTBOUND]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.',_0x1efeeb['id'],_0x47cc6c[_0xc860('0x3a')],_0x5cb62a[_0xc860('0x33')]);switch(_0x5cb62a[_0xc860('0x33')]){case _0xc860('0x5f'):emit(util[_0xc860('0x2f')](_0xc860('0x4e'),_0x47cc6c[_0xc860('0x3a')]),_0xc860('0x4f'),{'recordId':_0x1efeeb['id']});break;case _0xc860('0x60'):emit(util['format']('user:%s',_0x47cc6c['name']),_0xc860('0x50'),{'uri':util[_0xc860('0x2f')](_0xc860('0x51'),_0x57cd01[_0xc860('0x52')],_0x1efeeb['id'])});break;default:logger[_0xc860('0x53')]('[OUTBOUND]',_0xc860('0x61'));}})[_0xc860('0x55')](function(_0x1aae1b){logger[_0xc860('0x53')](_0xc860('0x62'),JSON[_0xc860('0x57')](_0x1aae1b));});};exports[_0xc860('0x63')]=function(_0x138463,_0x520338,_0x511f4f,_0x1ea1f7,_0x1df7f1,_0x30cbc2){var _0x245a07,_0x28ed8c,_0x56955b,_0x279917;_0x30cbc2[_0xc860('0x44')]=intUtil[_0xc860('0x45')](_0x30cbc2[_0xc860('0x44')]);_0x30cbc2[_0xc860('0x3f')]=intUtil['stripTrailingSlash'](_0x30cbc2[_0xc860('0x3f')]);if(_0x1df7f1&&_0x1df7f1[_0xc860('0x46')]){logger['info']('['+_0x520338[_0xc860('0x64')][_0xc860('0x65')]()+']',_0xc860('0x59'));_0x520338[_0xc860('0x48')]=util['format']('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x30cbc2['serverUrl'],_0x520338[_0xc860('0x5a')],md5(_0x520338[_0xc860('0x5a')]));}else{_0x520338[_0xc860('0x48')]='';}return getConnection(_0x30cbc2)['then'](function(_0x4f47a3){_0x279917=_0x4f47a3;if(!_[_0xc860('0x16')](_0x1ea1f7)){return getUser(_0x30cbc2,_0x1ea1f7[_0xc860('0x3a')],_0x279917);}else{return getUser(_0x30cbc2,null,_0x279917);}})[_0xc860('0x1a')](function(_0x395361){_0x245a07=_0x395361;return getEndUser(_0x30cbc2,_0x511f4f,_0x520338['calleridname'],_0x520338[_0xc860('0x4b')],_0x279917);})[_0xc860('0x1a')](function(_0x45b04c){_0x28ed8c=_0x45b04c;return getTicket(_0x30cbc2,_0x245a07,_0x28ed8c,_0x511f4f,_0x520338,_0x511f4f['Fields'],_0x279917);})[_0xc860('0x1a')](function(_0x51eadd){_0x56955b=_0x51eadd;logger['info']('['+_0x520338[_0xc860('0x64')][_0xc860('0x65')]()+_0xc860('0x66'),_0x56955b['id']);logger[_0xc860('0x20')]('['+_0x520338[_0xc860('0x64')][_0xc860('0x65')]()+_0xc860('0x67'),_0x30cbc2['type']);})[_0xc860('0x55')](function(_0x25adb5){logger['error']('['+_0x520338[_0xc860('0x64')][_0xc860('0x65')]()+']',JSON[_0xc860('0x57')](_0x25adb5));});}; \ No newline at end of file +var _0x95c9=['type','idField','variable','variableName','toString','Variable','name','toLowerCase','password','securityToken','Connection','remoteUri','https://login.salesforce.com','clientId','clientSecret','username','Connection\x20established.','serverUrl','stripTrailingSlash','monitor_format','[QUEUE]','recordingURL','format','uniqueid','email','calleridname','queue','[QUEUE]\x20Ticket\x20%s\x20created','[QUEUE]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','integrationTab','user:%s','trigger:salesforce:display','%s/%s/e','instanceUrl','[QUEUE]\x20Salesforce\x20account\x20type\x20not\x20recognized.','catch','error','outbound','recordingFormat','none','[OUTBOUND]','Recording\x20is\x20enabled!','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','destcalleridname','destcalleridnum','Fields','[OUTBOUND]\x20Ticket\x20%s\x20created.','newTab','trigger:browser:url','Salesforce\x20account\x20type\x20not\x20recognized','calleridnum','lastevent','toUpperCase',']\x20Ticket\x20%s\x20created.',']\x20Integration\x20account\x20type\x20%s.','request-promise','moment','jsforce','ioredis','./util','../../../../config/logger','salesforce','redis','defaults','socket.io-emitter','emit','ticketType','assign','Descriptions','WhoId','Case','Subjects','getString','ContactId','sobject','create','isNil','validateEmail','User','find','execute','then','info','Agent\x20%s\x20found.','resolve','identity','user_id','display_name','Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.','Task','Searching\x20enduser\x20with\x20phone\x20%s.\x20Serching\x20method\x20used\x20%s.','moduleSearch','contact_lead','length','Lead','contact','Contact','lead','Name','Phone','Enduser\x20with\x20phone\x20%s\x20found.','Enduser\x20with\x20phone\x20%s\x20not\x20found.','moduleCreate','Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.','Company','No\x20Company','upperFirst','forEach'];(function(_0x2631e1,_0x334a1b){var _0x1ec0f6=function(_0x22e63e){while(--_0x22e63e){_0x2631e1['push'](_0x2631e1['shift']());}};_0x1ec0f6(++_0x334a1b);}(_0x95c9,0x1e7));var _0x995c=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x95c9[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var rp=require(_0x995c('0x0'));var moment=require(_0x995c('0x1'));var BPromise=require('bluebird');var md5=require('md5');var jsforce=require(_0x995c('0x2'));var util=require('util');var Redis=require(_0x995c('0x3'));var intUtil=require(_0x995c('0x4'));var config=require('../../../../config/environment');var logger=require(_0x995c('0x5'))(_0x995c('0x6'));config[_0x995c('0x7')]=_[_0x995c('0x8')](config[_0x995c('0x7')],{'host':'localhost','port':0x18eb});var io=require(_0x995c('0x9'))(new Redis(config['redis']));function emit(_0x5d193a,_0x560251,_0x2ac7c9){io['to'](_0x5d193a)[_0x995c('0xa')](_0x560251,_0x2ac7c9);}function getTicket(_0x2e6227,_0x1e51d6,_0x4434e6,_0x51c610,_0x358f18,_0xe8b469,_0x2fe28a,_0x4022f2){var _0x3611fb={};if(_0x51c610[_0x995c('0xb')]==='Task'){_0x3611fb=Object[_0x995c('0xc')]({},{'OwnerId':_0x1e51d6['id'],'ActivityDate':moment['utc'](),'IsReminderSet':![],'IsRecurrence':![],'Subject':intUtil['getString'](_0x51c610['Subjects'],_0x358f18,'\x20'),'Description':intUtil['getString'](_0x51c610[_0x995c('0xd')],_0x358f18,'\x0a')},getCustomFields(_0xe8b469,_0x358f18));if(_0x4434e6){_0x3611fb[_0x995c('0xe')]=_0x4434e6['id'];}}else if(_0x51c610[_0x995c('0xb')]===_0x995c('0xf')){_0x3611fb=Object[_0x995c('0xc')]({},{'OwnerId':_0x1e51d6['id'],'Subject':intUtil['getString'](_0x51c610[_0x995c('0x10')],_0x358f18,'\x20'),'Description':intUtil[_0x995c('0x11')](_0x51c610[_0x995c('0xd')],_0x358f18,'\x0a')},getCustomFields(_0xe8b469,_0x358f18));if(_0x4434e6){_0x3611fb[_0x995c('0x12')]=_0x4434e6['id'];}}return _0x2fe28a[_0x995c('0x13')](_0x51c610[_0x995c('0xb')])[_0x995c('0x14')](_0x3611fb);}function getUser(_0x3a2e38,_0xd0399c,_0x17057e){if(!_[_0x995c('0x15')](_0xd0399c)&&intUtil[_0x995c('0x16')](_0xd0399c)){var _0xfe7cb3={'Email':_0xd0399c};var _0x261b8c={'Id':!![],'Username':!![],'Name':!![],'Email':!![]};return _0x17057e['sobject'](_0x995c('0x17'))[_0x995c('0x18')](_0xfe7cb3,_0x261b8c)[_0x995c('0x19')]()[_0x995c('0x1a')](function(_0x233c08){if(_0x233c08['length']){var _0x22058a=_[_0x995c('0x18')](_0x233c08,function(_0x3d3e16){return _0x3d3e16['Email']===_0xd0399c;});if(_0x22058a){logger[_0x995c('0x1b')](_0x995c('0x1c'),_0xd0399c);return BPromise[_0x995c('0x1d')]({'id':_0x22058a['Id'],'name':_0x22058a['Name']});}}else{logger['info']('Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.',_0xd0399c);return _0x17057e[_0x995c('0x1e')]()[_0x995c('0x1a')](function(_0x1cb678){return BPromise['resolve']({'id':_0x1cb678[_0x995c('0x1f')],'name':_0x1cb678[_0x995c('0x20')]});});}});}else{logger[_0x995c('0x1b')](_0x995c('0x21'),_0xd0399c);return _0x17057e['identity']()[_0x995c('0x1a')](function(_0x2e35d0){return BPromise[_0x995c('0x1d')]({'id':_0x2e35d0[_0x995c('0x1f')],'name':_0x2e35d0[_0x995c('0x20')]});});}}function getEndUser(_0x18cf6a,_0x20aff6,_0x4ecb74,_0x9a9366,_0x517f38){var _0xbc860e={'Phone':_0x9a9366};var _0x38b196={'Id':!![],'Name':!![],'Phone':!![]};return BPromise[_0x995c('0x1d')]()[_0x995c('0x1a')](function(){if(_0x20aff6[_0x995c('0xb')]===_0x995c('0x22')){logger[_0x995c('0x1b')](_0x995c('0x23'),_0x9a9366,_0x20aff6[_0x995c('0x24')]);switch(_0x20aff6['moduleSearch']){case _0x995c('0x25'):return _0x517f38[_0x995c('0x13')]('Contact')[_0x995c('0x18')](_0xbc860e,_0x38b196)[_0x995c('0x19')]()[_0x995c('0x1a')](function(_0x4c55c8){if(_0x4c55c8&&_0x4c55c8[_0x995c('0x26')]){return _0x4c55c8;}else{return _0x517f38['sobject'](_0x995c('0x27'))['find'](_0xbc860e,_0x38b196);}});case _0x995c('0x28'):return _0x517f38[_0x995c('0x13')](_0x995c('0x29'))[_0x995c('0x18')](_0xbc860e,_0x38b196)[_0x995c('0x19')]();case _0x995c('0x2a'):return _0x517f38[_0x995c('0x13')](_0x995c('0x27'))['find'](_0xbc860e,_0x38b196);default:return null;}}else if(_0x20aff6['ticketType']===_0x995c('0xf')){logger[_0x995c('0x1b')](_0x995c('0x23'),_0x9a9366,'contact');return _0x517f38['sobject'](_0x995c('0x29'))[_0x995c('0x18')](_0xbc860e,_0x38b196)['execute']();}})[_0x995c('0x1a')](function(_0x19f20e){if(_0x19f20e&&_0x19f20e['length']){var _0xbbc712=_[_0x995c('0x18')](_0x19f20e,function(_0x5a1b7d){return _0x5a1b7d['Phone']===_0x9a9366;});if(_0xbbc712){return BPromise[_0x995c('0x1d')]({'id':_0xbbc712['Id'],'name':_0xbbc712[_0x995c('0x2b')],'phone':_0xbbc712[_0x995c('0x2c')]});}}})['then'](function(_0xed3e03){if(_0xed3e03){logger[_0x995c('0x1b')](_0x995c('0x2d'),_0x9a9366);return BPromise['resolve'](_0xed3e03);}else{logger[_0x995c('0x1b')](_0x995c('0x2e'),_0x9a9366);var _0x5f0c21={'LastName':_0x4ecb74!==''?_0x4ecb74:util['format']('Caller\x20-\x20%s',_0x9a9366),'Phone':_0x9a9366};if(_0x20aff6[_0x995c('0x2f')]){if(_0x20aff6[_0x995c('0x2f')]===_0x995c('0x28')){logger[_0x995c('0x1b')](_0x995c('0x30'),_0x9a9366,_0x20aff6[_0x995c('0x2f')]);}else if(_0x20aff6['moduleCreate']===_0x995c('0x2a')&&_0x20aff6[_0x995c('0xb')]===_0x995c('0x22')){logger['info'](_0x995c('0x30'),_0x9a9366,_0x20aff6[_0x995c('0x2f')]);_0x5f0c21[_0x995c('0x31')]=_0x995c('0x32');}else{return null;}}return _0x517f38[_0x995c('0x13')](_[_0x995c('0x33')](_0x20aff6[_0x995c('0x2f')]))[_0x995c('0x14')](_0x5f0c21);}});}function getCustomFields(_0x5e5321,_0x122c76){var _0x2036a7={};if(_0x5e5321[_0x995c('0x26')]>0x0){_[_0x995c('0x34')](_0x5e5321,function(_0x37eea1){if(_0x37eea1[_0x995c('0x35')]==='string'&&_0x37eea1[_0x995c('0x36')]){_0x2036a7[_0x37eea1[_0x995c('0x36')]]=_0x37eea1['content']['toString']();}else if(_0x37eea1['type']===_0x995c('0x37')&&_0x37eea1[_0x995c('0x38')]&&_0x37eea1[_0x995c('0x36')]){_0x122c76[_0x37eea1[_0x995c('0x38')]]&&(_0x2036a7[_0x37eea1['idField']]=_0x122c76[_0x37eea1[_0x995c('0x38')]][_0x995c('0x39')]());}else if(_0x37eea1['type']==='customVariable'&&_0x37eea1[_0x995c('0x3a')]&&_0x37eea1['Variable'][_0x995c('0x3b')]&&_0x37eea1[_0x995c('0x36')]){_0x122c76[_0x37eea1[_0x995c('0x3a')][_0x995c('0x3b')][_0x995c('0x3c')]()]&&(_0x2036a7[_0x37eea1[_0x995c('0x36')]]=_0x122c76[_0x37eea1[_0x995c('0x3a')][_0x995c('0x3b')][_0x995c('0x3c')]()][_0x995c('0x39')]());}});}return _0x2036a7;}function getConnection(_0xa27b22){var _0x23f92e=_0xa27b22[_0x995c('0x3d')]['concat'](_0xa27b22[_0x995c('0x3e')]);var _0x3caf98=new jsforce[(_0x995c('0x3f'))]({'oauth2':{'loginUrl':_0xa27b22[_0x995c('0x40')]||_0x995c('0x41'),'clientId':_0xa27b22[_0x995c('0x42')],'clientSecret':_0xa27b22[_0x995c('0x43')]}});return _0x3caf98['login'](_0xa27b22[_0x995c('0x44')],_0x23f92e)['then'](function(){logger[_0x995c('0x1b')](_0x995c('0x45'));return _0x3caf98;});}exports['queue']=function(_0x2b59a8,_0xd3f6e2,_0x2c3708,_0x4ced91,_0x5a8f15,_0x2fd8a7){var _0x888b4c,_0x7e5e2f,_0x48149c,_0x1de542;_0x2fd8a7[_0x995c('0x46')]=intUtil[_0x995c('0x47')](_0x2fd8a7[_0x995c('0x46')]);_0x2fd8a7[_0x995c('0x40')]=intUtil[_0x995c('0x47')](_0x2fd8a7[_0x995c('0x40')]);if(_0x5a8f15&&_0x5a8f15[_0x995c('0x48')]){logger[_0x995c('0x1b')](_0x995c('0x49'),'Recording\x20is\x20enabled!');_0xd3f6e2[_0x995c('0x4a')]=util[_0x995c('0x4b')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x2fd8a7[_0x995c('0x46')],_0xd3f6e2[_0x995c('0x4c')],md5(_0xd3f6e2[_0x995c('0x4c')]));}else{_0xd3f6e2['recordingURL']='';}return getConnection(_0x2fd8a7)['then'](function(_0x6c50e0){_0x1de542=_0x6c50e0;return getUser(_0x2fd8a7,_0x4ced91[_0x995c('0x4d')],_0x1de542);})['then'](function(_0x34e5a4){_0x888b4c=_0x34e5a4;return getEndUser(_0x2fd8a7,_0x2c3708,_0xd3f6e2[_0x995c('0x4e')],_0xd3f6e2['calleridnum'],_0x1de542);})[_0x995c('0x1a')](function(_0x313160){_0x7e5e2f=_0x313160;return getTicket(_0x2fd8a7,_0x888b4c,_0x7e5e2f,_0x2c3708,_0xd3f6e2,_0x2c3708['Fields'],_0x1de542,_0x995c('0x4f'));})[_0x995c('0x1a')](function(_0x161249){_0x48149c=_0x161249;logger[_0x995c('0x1b')](_0x995c('0x50'),_0x48149c['id']);logger[_0x995c('0x1b')](_0x995c('0x51'),_0x48149c['id'],_0x4ced91[_0x995c('0x3b')],_0x2fd8a7[_0x995c('0x35')]);switch(_0x2fd8a7[_0x995c('0x35')]){case _0x995c('0x52'):emit(util[_0x995c('0x4b')](_0x995c('0x53'),_0x4ced91['name']),_0x995c('0x54'),{'recordId':_0x48149c['id']});break;case'newTab':emit(util[_0x995c('0x4b')](_0x995c('0x53'),_0x4ced91['name']),'trigger:browser:url',{'uri':util[_0x995c('0x4b')](_0x995c('0x55'),_0x1de542[_0x995c('0x56')],_0x48149c['id'])});break;default:logger['error'](_0x995c('0x57'));}})[_0x995c('0x58')](function(_0x124e9b){logger[_0x995c('0x59')](_0x995c('0x49'),JSON['stringify'](_0x124e9b));});};exports[_0x995c('0x5a')]=function(_0x2f2fa1,_0x5657e2,_0x13be80,_0x36907a,_0x54bfe4,_0x2e25a5,_0x428091){var _0x3cf077,_0x291a4b,_0x7acf8d,_0x379a45;_0x2e25a5[_0x995c('0x46')]=intUtil['stripTrailingSlash'](_0x2e25a5[_0x995c('0x46')]);_0x2e25a5[_0x995c('0x40')]=intUtil[_0x995c('0x47')](_0x2e25a5['remoteUri']);if(_0x428091&&_0x428091['recordingFormat']&&_0x428091[_0x995c('0x5b')]!==_0x995c('0x5c')){logger[_0x995c('0x1b')](_0x995c('0x5d'),_0x995c('0x5e'));_0x5657e2['recordingURL']=util[_0x995c('0x4b')](_0x995c('0x5f'),_0x2e25a5[_0x995c('0x46')],_0x5657e2[_0x995c('0x4c')],md5(_0x5657e2[_0x995c('0x4c')]));}return getConnection(_0x2e25a5)['then'](function(_0x238ac7){_0x379a45=_0x238ac7;return getUser(_0x2e25a5,_0x36907a['email'],_0x379a45);})[_0x995c('0x1a')](function(_0x172d56){_0x3cf077=_0x172d56;return getEndUser(_0x2e25a5,_0x13be80,_0x5657e2[_0x995c('0x60')],_0x5657e2[_0x995c('0x61')],_0x379a45);})[_0x995c('0x1a')](function(_0x2bdbba){_0x291a4b=_0x2bdbba;return getTicket(_0x2e25a5,_0x3cf077,_0x291a4b,_0x13be80,_0x5657e2,_0x13be80[_0x995c('0x62')],_0x379a45,_0x995c('0x5a'));})[_0x995c('0x1a')](function(_0x3a0a74){_0x7acf8d=_0x3a0a74;logger['info'](_0x995c('0x63'),_0x7acf8d['id']);logger[_0x995c('0x1b')]('[OUTBOUND]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.',_0x7acf8d['id'],_0x36907a['name'],_0x2e25a5[_0x995c('0x35')]);switch(_0x2e25a5[_0x995c('0x35')]){case _0x995c('0x52'):emit(util[_0x995c('0x4b')]('user:%s',_0x36907a['name']),_0x995c('0x54'),{'recordId':_0x7acf8d['id']});break;case _0x995c('0x64'):emit(util[_0x995c('0x4b')](_0x995c('0x53'),_0x36907a['name']),_0x995c('0x65'),{'uri':util['format'](_0x995c('0x55'),_0x379a45[_0x995c('0x56')],_0x7acf8d['id'])});break;default:logger[_0x995c('0x59')]('[OUTBOUND]',_0x995c('0x66'));}})[_0x995c('0x58')](function(_0x2ffda0){logger['error'](_0x995c('0x5d'),JSON['stringify'](_0x2ffda0));});};exports['unmanaged']=function(_0xa0a76c,_0x2bafd5,_0x3c5c7d,_0x4d0331,_0x2f4c7c,_0xa6228f){var _0x1b6ca0,_0x1d015f,_0x58edb8,_0x39790d;_0xa6228f['serverUrl']=intUtil[_0x995c('0x47')](_0xa6228f[_0x995c('0x46')]);_0xa6228f['remoteUri']=intUtil['stripTrailingSlash'](_0xa6228f[_0x995c('0x40')]);if(_0x2f4c7c&&_0x2f4c7c[_0x995c('0x48')]){logger[_0x995c('0x1b')]('['+_0x2bafd5['lastevent']['toUpperCase']()+']',_0x995c('0x5e'));_0x2bafd5[_0x995c('0x4a')]=util[_0x995c('0x4b')](_0x995c('0x5f'),_0xa6228f[_0x995c('0x46')],_0x2bafd5['uniqueid'],md5(_0x2bafd5[_0x995c('0x4c')]));}else{_0x2bafd5[_0x995c('0x4a')]='';}return getConnection(_0xa6228f)[_0x995c('0x1a')](function(_0x3da746){_0x39790d=_0x3da746;if(!_[_0x995c('0x15')](_0x4d0331)){return getUser(_0xa6228f,_0x4d0331[_0x995c('0x3b')],_0x39790d);}else{return getUser(_0xa6228f,null,_0x39790d);}})[_0x995c('0x1a')](function(_0x26d89d){_0x1b6ca0=_0x26d89d;return getEndUser(_0xa6228f,_0x3c5c7d,_0x2bafd5[_0x995c('0x4e')],_0x2bafd5[_0x995c('0x67')],_0x39790d);})[_0x995c('0x1a')](function(_0x49afce){_0x1d015f=_0x49afce;return getTicket(_0xa6228f,_0x1b6ca0,_0x1d015f,_0x3c5c7d,_0x2bafd5,_0x3c5c7d[_0x995c('0x62')],_0x39790d);})[_0x995c('0x1a')](function(_0x13ccf9){_0x58edb8=_0x13ccf9;logger[_0x995c('0x1b')]('['+_0x2bafd5[_0x995c('0x68')][_0x995c('0x69')]()+_0x995c('0x6a'),_0x58edb8['id']);logger[_0x995c('0x1b')]('['+_0x2bafd5[_0x995c('0x68')][_0x995c('0x69')]()+_0x995c('0x6b'),_0xa6228f[_0x995c('0x35')]);})[_0x995c('0x58')](function(_0x266f13){logger[_0x995c('0x59')]('['+_0x2bafd5[_0x995c('0x68')]['toUpperCase']()+']',JSON['stringify'](_0x266f13));});}; \ 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 0750ba3..cbe3018 100644 --- a/server/services/ami/trigger/integration/servicenow.js +++ b/server/services/ami/trigger/integration/servicenow.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1261=['recordingURL','The\x20ticket\x20ID\x20is:\x20%s','format','call\x20direction:\x20%s',']\x20Error\x20running\x20ServiceNow\x20integration','inspect','bluebird','request-promise','util','md5','ioredis','./util','../../../../config/environment','../../../../config/logger','servicenow','redis','localhost','socket.io-emitter','sys_user?sysparm_query=user_name%3Dadmin','result','adminId','sys_id','info','toUpperCase','],\x20getAdminUser\x20crm','catch','error','message','GET','],\x20getUser\x20rp\x20obj','then','length','active','true','],\x20getUser\x20crm',']\x20using\x20admin\x20profile','userId','adminEmail','],\x20createEndUser\x20input\x20crm','POST','endUserNumber','System','],\x20EndUser\x20schema','endUserId','],\x20getEndUser\x20input\x20crm','],\x20getEndUser\x20crm','],\x20createEndUser\x20crm','forEach','type','string','nameField','toLowerCase','content','toString','idField','variable','variableName','customVariable','Variable','customField','name',']\x20getTicket\x20input\x20crm','incident','getString','Descriptions','Fields',']\x20POST\x20incident\x20entity\x20schema','ticketId','ticketNumber',']\x20getTicket\x20crm','?sysparm_query=name%3D','label_entry','Incident\x20-\x20',']\x20arrayPromises:\x20IDs\x20in\x20table\x20label','push','all','Tags','map','%26sysparm_record_target%3Dincident','%26sysparm_record_row%3D1%26sysparm_record_rows%3D39','%26sysparm_record_list%3Dactive%253Dtrue','%255EORDERBYDESCnumber','user:%s','emit','username','password','sysparm_display_value=true','remoteUri','serverUrl','stripTrailingSlash','userEmail','isNil','email','outbound','destcalleridnum','calleridnum','callDirection','queue','unmanaged','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingFormat','none'];(function(_0x5f4382,_0xcb3195){var _0x368006=function(_0x2c8062){while(--_0x2c8062){_0x5f4382['push'](_0x5f4382['shift']());}};_0x368006(++_0xcb3195);}(_0x1261,0x144));var _0x1126=function(_0x5fd828,_0xa7ede9){_0x5fd828=_0x5fd828-0x0;var _0x3c1eaa=_0x1261[_0x5fd828];return _0x3c1eaa;};'use strict';var _=require('lodash');var Promise=require(_0x1126('0x0'));var rp=require(_0x1126('0x1'));var util=require(_0x1126('0x2'));var md5=require(_0x1126('0x3'));var Redis=require(_0x1126('0x4'));var intUtil=require(_0x1126('0x5'));var config=require(_0x1126('0x6'));var logger=require(_0x1126('0x7'))(_0x1126('0x8'));config[_0x1126('0x9')]=_['defaults'](config['redis'],{'host':_0x1126('0xa'),'port':0x18eb});var io=require(_0x1126('0xb'))(new Redis(config['redis']));function getAdminUser(_0x17e5f0,_0x28772d,_0x245be9,_0x3abb0b,_0x2d9033,_0x59cfa1){return new Promise(function(_0x3f09ac,_0x18dbe6){var _0x167ef1={'method':'GET','uri':_0x3abb0b+_0x1126('0xc')+'&'+_0x2d9033+'&'+_0x59cfa1,'auth':_0x28772d,'json':!![]};return rp(_0x167ef1)['then'](function(_0x52ef15){if(_0x52ef15[_0x1126('0xd')]['length']>0x0){_0x245be9[_0x1126('0xe')]=_0x52ef15[_0x1126('0xd')][0x0][_0x1126('0xf')];}logger[_0x1126('0x10')]('['+[_0x17e5f0[_0x1126('0x11')]()]+_0x1126('0x12'),_0x245be9);_0x3f09ac(_0x245be9);})[_0x1126('0x13')](function(_0x2048ad){logger[_0x1126('0x14')]('['+[_0x17e5f0['toUpperCase']()]+']',_0x2048ad['message']);_0x18dbe6(_0x2048ad[_0x1126('0x15')]);});});}function getUser(_0x154e20,_0x279455,_0x4be0c6,_0x45149c,_0x4794a7){return function(_0x35fe9f){logger[_0x1126('0x10')]('['+[_0x154e20[_0x1126('0x11')]()]+'],\x20getUser\x20input\x20crm',_0x35fe9f);return new Promise(function(_0x245cd7,_0x1695f6){if(intUtil['validateEmail'](_0x35fe9f['userEmail'])){var _0x22ae0b={'method':_0x1126('0x16'),'uri':_0x4be0c6+'sys_user?sysparm_query=email%3D'+_0x35fe9f['userEmail']+'&'+_0x45149c+'&'+_0x4794a7,'auth':_0x279455,'json':!![]};logger[_0x1126('0x10')]('['+[_0x154e20['toUpperCase']()]+_0x1126('0x17'),_0x22ae0b);return rp(_0x22ae0b)[_0x1126('0x18')](function(_0x2f70ac){logger['info']('['+[_0x154e20[_0x1126('0x11')]()]+'],\x20getUser\x20entity',_0x2f70ac);if(_0x2f70ac['result'][_0x1126('0x19')]>0x0&&String(_0x2f70ac[_0x1126('0xd')][0x0][_0x1126('0x1a')])===_0x1126('0x1b')){_0x35fe9f['userId']=_0x2f70ac[_0x1126('0xd')][0x0][_0x1126('0xf')];}else{_0x35fe9f['userId']=_0x35fe9f[_0x1126('0xe')];_0x35fe9f['userEmail']=_0x35fe9f['adminEmail'];}logger['info']('['+[_0x154e20[_0x1126('0x11')]()]+_0x1126('0x1c'),_0x35fe9f);_0x245cd7(_0x35fe9f);})[_0x1126('0x13')](function(_0x34bcf1){logger[_0x1126('0x14')]('['+[_0x154e20[_0x1126('0x11')]()]+']',_0x34bcf1[_0x1126('0x15')]);_0x1695f6(_0x34bcf1[_0x1126('0x15')]);});}else{logger['info']('['+[_0x154e20[_0x1126('0x11')]()]+_0x1126('0x1d'));_0x35fe9f[_0x1126('0x1e')]=_0x35fe9f['adminId'];_0x35fe9f['userEmail']=_0x35fe9f[_0x1126('0x1f')];_0x245cd7(_0x35fe9f);}});};}function createEndUser(_0x39bf0e,_0x55e195,_0x2fb797,_0x23d2bc,_0x4a334a){logger[_0x1126('0x10')]('['+[_0x39bf0e['toUpperCase']()]+_0x1126('0x20'),_0x2fb797);return new Promise(function(_0x4bd50b,_0x771bb8){var _0x583ce6={'method':_0x1126('0x21'),'uri':_0x23d2bc+'sys_user?'+_0x4a334a,'body':{'user_name':_0x2fb797['endUserNumber'],'roles':'user','first_name':_0x2fb797[_0x1126('0x22')],'active':_0x1126('0x1b'),'date_format':_0x1126('0x23'),'phone':_0x2fb797['endUserNumber']},'auth':_0x55e195,'json':!![]};return rp(_0x583ce6)[_0x1126('0x18')](function(_0x226afb){logger['info']('['+[_0x39bf0e[_0x1126('0x11')]()]+_0x1126('0x24'),_0x226afb[_0x1126('0xd')]);_0x2fb797[_0x1126('0x25')]=_0x226afb['result']['sys_id'];_0x4bd50b(_0x2fb797);})[_0x1126('0x13')](function(_0x19e6e4){logger[_0x1126('0x14')]('['+[_0x39bf0e[_0x1126('0x11')]()]+']',_0x19e6e4['message']);_0x771bb8(_0x19e6e4[_0x1126('0x15')]);});});}function getEndUser(_0x6f4312,_0x313ebe,_0x22436c,_0x3b0f79,_0x5df232){return function(_0x2a0dfe){logger[_0x1126('0x10')]('['+[_0x6f4312[_0x1126('0x11')]()]+_0x1126('0x26'),_0x2a0dfe);return new Promise(function(_0x5c019d,_0x4ca51c){var _0x22827a={'method':_0x1126('0x16'),'uri':_0x22436c+'sys_user?sysparm_query=phone%3D'+_0x2a0dfe[_0x1126('0x22')]+'&'+_0x3b0f79+'&'+_0x5df232,'auth':_0x313ebe,'json':!![]};return rp(_0x22827a)[_0x1126('0x18')](function(_0x11b0f6){if(_0x11b0f6['result']['length']>0x0){_0x2a0dfe[_0x1126('0x25')]=_0x11b0f6[_0x1126('0xd')][0x0][_0x1126('0xf')];logger[_0x1126('0x10')]('['+[_0x6f4312['toUpperCase']()]+_0x1126('0x27'),_0x2a0dfe);_0x5c019d(_0x2a0dfe);}else{return createEndUser(_0x6f4312,_0x313ebe,_0x2a0dfe,_0x22436c,_0x3b0f79)['then'](function(_0x8abfe3){logger[_0x1126('0x10')]('['+[_0x6f4312[_0x1126('0x11')]()]+_0x1126('0x28'),_0x8abfe3);_0x5c019d(_0x8abfe3);});}})[_0x1126('0x13')](function(_0x5746f6){logger[_0x1126('0x14')]('['+[_0x6f4312[_0x1126('0x11')]()]+']',_0x5746f6[_0x1126('0x15')]);_0x4ca51c(_0x5746f6[_0x1126('0x15')]);});});};}function getCustomFields(_0x3469a2,_0x3442b8){var _0x3052f9={};if(_0x3469a2['length']>0x0){_[_0x1126('0x29')](_0x3469a2,function(_0x154c28){if(_0x154c28[_0x1126('0x2a')]===_0x1126('0x2b')&&_0x154c28[_0x1126('0x2c')]&&!_0x154c28['customField']){_0x3052f9[_0x154c28['idField'][_0x1126('0x2d')]()]=_0x154c28[_0x1126('0x2e')][_0x1126('0x2f')]();}else if(_0x154c28[_0x1126('0x2a')]===_0x1126('0x2b')&&_0x154c28[_0x1126('0x30')]&&_0x154c28['customField']){_0x3052f9[_0x154c28['idField']['toLowerCase']()]=_0x154c28[_0x1126('0x2e')]['toString']();}else if(_0x154c28[_0x1126('0x2a')]===_0x1126('0x31')&&_0x154c28[_0x1126('0x32')]&&_0x154c28[_0x1126('0x30')]&&_0x154c28['customField']){_0x3052f9[_0x154c28['idField'][_0x1126('0x2d')]()]=_0x3442b8[_0x154c28[_0x1126('0x32')]][_0x1126('0x2f')]();}else if(_0x154c28['type']===_0x1126('0x33')&&_0x154c28['Variable']&&_0x154c28[_0x1126('0x34')]['name']&&_0x154c28[_0x1126('0x30')]&&_0x154c28[_0x1126('0x35')]){_0x3052f9[_0x154c28[_0x1126('0x30')]['toLowerCase']()]=_0x3442b8[_0x154c28[_0x1126('0x34')][_0x1126('0x36')][_0x1126('0x2d')]()]['toString']();}});}return _0x3052f9;}function getTicket(_0x58ff3a,_0x4dd7f5,_0x6e78cf,_0x520b62,_0x1e197e,_0x507568){return function(_0x2f45b9){logger[_0x1126('0x10')]('['+[_0x58ff3a[_0x1126('0x11')]()]+_0x1126('0x37'),_0x2f45b9);return new Promise(function(_0xede3d8,_0x56732f){var _0x198173=_0x58ff3a[_0x1126('0x2d')]()==='outbound'?_0x2f45b9[_0x1126('0x1e')]:_0x2f45b9[_0x1126('0x25')];var _0x575f79={'method':_0x1126('0x21'),'uri':_0x6e78cf+_0x1126('0x38')+'?'+_0x507568,'body':Object['assign']({},{'active':_0x1126('0x1b'),'caller_id':_0x198173,'assigned_to':_0x2f45b9[_0x1126('0x1e')],'short_description':intUtil[_0x1126('0x39')](_0x520b62['Subjects'],_0x1e197e,'\x20'),'description':intUtil[_0x1126('0x39')](_0x520b62[_0x1126('0x3a')],_0x1e197e,'\x0a')},getCustomFields(_0x520b62[_0x1126('0x3b')],_0x1e197e)),'auth':_0x4dd7f5,'json':!![]};return rp(_0x575f79)[_0x1126('0x18')](function(_0x224456){logger[_0x1126('0x10')]('['+[_0x58ff3a[_0x1126('0x11')]()]+_0x1126('0x3c'),_0x224456['result']);_0x2f45b9[_0x1126('0x3d')]=_0x224456['result'][_0x1126('0xf')];_0x2f45b9[_0x1126('0x3e')]=_0x224456['result']['number'];logger[_0x1126('0x10')]('['+[_0x58ff3a[_0x1126('0x11')]()]+_0x1126('0x3f'),_0x2f45b9);_0xede3d8(_0x2f45b9);})['catch'](function(_0x3cb44c){logger[_0x1126('0x14')]('['+[_0x58ff3a[_0x1126('0x11')]()]+']',_0x3cb44c[_0x1126('0x15')]);_0x56732f(_0x3cb44c['message']);});});};}function createRemoteTag(_0x30d1b3,_0x46551f,_0x5c36b9,_0x4bcc08){return new Promise(function(_0x4abb4d,_0x526b07){var _0x386c10={'method':_0x1126('0x21'),'uri':_0x5c36b9+'label'+'?'+_0x4bcc08,'body':{'short_description':_0x30d1b3,'global':!![],'active':!![],'name':_0x30d1b3},'auth':_0x46551f,'json':!![]};return rp(_0x386c10)[_0x1126('0x18')](function(_0x1c7a2b){var _0x38093e=_0x1c7a2b[_0x1126('0xd')][_0x1126('0xf')];_0x4abb4d(_0x38093e);});});}function getRemoteTag(_0x4e4d49,_0x41cbb6,_0x267592,_0x5d6414,_0x322016){return new Promise(function(_0x476aca,_0xcc9499){var _0x36b61={'method':_0x1126('0x16'),'uri':_0x267592+'label'+_0x1126('0x40')+_0x4e4d49+'&'+_0x5d6414,'auth':_0x41cbb6,'json':!![]};return rp(_0x36b61)['then'](function(_0x868b2c){if(_0x868b2c[_0x1126('0xd')][_0x1126('0x19')]>0x0){var _0x590bc2=_0x868b2c[_0x1126('0xd')][0x0][_0x1126('0xf')];_0x476aca(_0x590bc2);}else{return createRemoteTag(_0x4e4d49,_0x41cbb6,_0x267592,_0x5d6414)['then'](function(_0x30812d){_0x476aca(_0x30812d);});}});});}function assignTagToIncident(_0x25038f,_0x9bad53,_0x5a5340,_0x2fe6dc,_0x3377db){return new Promise(function(_0x22ab18,_0x308ee4){var _0x128c94={'method':_0x1126('0x21'),'uri':_0x5a5340+_0x1126('0x41')+'?'+_0x3377db,'body':{'label':_0x25038f,'table':_0x1126('0x38'),'id_type':'Incident','table_key':_0x2fe6dc[_0x1126('0x3d')],'title':_0x1126('0x42')+_0x2fe6dc[_0x1126('0x3e')],'id_display':_0x2fe6dc[_0x1126('0x3e')]},'auth':_0x9bad53,'json':!![]};return rp(_0x128c94)[_0x1126('0x18')](function(_0x4f5772){_0x22ab18();})[_0x1126('0x13')](function(){_0x22ab18();});});}function manageTags(_0x315386,_0x5e0ea1,_0x3767e4,_0x5246aa,_0x272274,_0x10ff91,_0x478806){return new Promise(function(_0x3062d6,_0x21d4ef){var _0x375b76=[];_0x5e0ea1['forEach'](function(_0x13394f){_0x375b76['push'](getRemoteTag(_0x13394f,_0x3767e4,_0x5246aa,_0x10ff91,_0x478806));});return Promise['all'](_0x375b76)[_0x1126('0x18')](function(_0x40185f){if(_0x40185f[_0x1126('0x19')]){logger[_0x1126('0x10')]('['+[_0x315386[_0x1126('0x11')]()]+_0x1126('0x43'),_0x40185f);var _0x1a0e26=[];_0x40185f['forEach'](function(_0x191307){_0x1a0e26[_0x1126('0x44')](assignTagToIncident(_0x191307,_0x3767e4,_0x5246aa,_0x272274,_0x10ff91));});return Promise[_0x1126('0x45')](_0x1a0e26)[_0x1126('0x18')](function(){_0x3062d6();})[_0x1126('0x13')](function(){_0x3062d6();});}else{_0x3062d6();}});});}function getTags(_0x3cd788,_0x5a0804,_0x5b17d6,_0x16a343,_0x3921c2,_0x4bf2b3){return function(_0x5ee130){return new Promise(function(_0x5e9260,_0x51a28d){var _0x964a2=[];var _0x37b1ab=_0x16a343[_0x1126('0x46')];if(_0x37b1ab&&_0x37b1ab['length']>0x0){_0x964a2=_[_0x1126('0x47')](_0x37b1ab,_0x1126('0x36'));}if(_0x964a2[_0x1126('0x19')]>0x0){return manageTags(_0x3cd788,_0x964a2,_0x5a0804,_0x5b17d6,_0x5ee130,_0x3921c2,_0x4bf2b3)[_0x1126('0x18')](function(){_0x5e9260(_0x5ee130);});}else{_0x5e9260(_0x5ee130);}});};}function emit(_0x22d403,_0x3f007b,_0x131056){var _0x49a0a3=_0x1126('0x48')+_0x1126('0x49')+_0x1126('0x4a')+_0x1126('0x4b');var _0x288b9b={'uri':_0x22d403+'/nav_to.do?uri=incident.do?sys_id%3D'+_0x131056+_0x49a0a3};io['to'](util['format'](_0x1126('0x4c'),_0x3f007b))[_0x1126('0x4d')]('trigger:browser:url',_0x288b9b);}exports['cs']=function(_0x3bf25d,_0x1fb2f0,_0x366675,_0x6a41c0,_0x2828d4,_0x30d240,_0x41ce78,_0x247f12){var _0xd20fbe={};var _0x3d5e15={'user':_0x30d240[_0x1126('0x4e')],'pass':_0x30d240[_0x1126('0x4f')]};var _0x3dad39='sysparm_limit=1';var _0x111f49=_0x1126('0x50');_0x30d240[_0x1126('0x51')]=intUtil['stripTrailingSlash'](_0x30d240['remoteUri']);_0x30d240[_0x1126('0x52')]=intUtil[_0x1126('0x53')](_0x30d240[_0x1126('0x52')]);var _0x3bfeb8=util['format']('%s/api/now/table/',_0x30d240['remoteUri']);_0xd20fbe[_0x1126('0x54')]=!_[_0x1126('0x55')](_0x6a41c0)?_0x6a41c0[_0x1126('0x56')]:null;_0xd20fbe[_0x1126('0x1f')]=_0x30d240['email'];_0xd20fbe[_0x1126('0x22')]=_0x247f12['toLowerCase']()===_0x1126('0x57')?_0x1fb2f0[_0x1126('0x58')]:_0x1fb2f0[_0x1126('0x59')];_0xd20fbe[_0x1126('0x5a')]=_0x247f12===_0x1126('0x5b')||_0x247f12===_0x1126('0x5c')?_0x1126('0x5b'):'outbound';var _0xfd2d9=util['format'](_0x1126('0x5d'),_0x30d240[_0x1126('0x52')],_0x1fb2f0['uniqueid'],md5(_0x1fb2f0[_0x1126('0x5e')]));if(_0x2828d4&&_0x2828d4[_0x1126('0x5f')]){logger['info'](_0x1126('0x60'),_0x1126('0x61'));_0x1fb2f0['recordingURL']=_0xfd2d9;}else if(_0x41ce78&&_0x41ce78['recordingFormat']&&_0x41ce78[_0x1126('0x62')]!==_0x1126('0x63')){logger[_0x1126('0x10')]('[OUTBOUND]','Recording\x20is\x20enabled!');_0x1fb2f0['recordingURL']=_0xfd2d9;}else{_0x1fb2f0[_0x1126('0x64')]='';}return getAdminUser(_0x247f12,_0x3d5e15,_0xd20fbe,_0x3bfeb8,_0x111f49,_0x3dad39)['then'](getUser(_0x247f12,_0x3d5e15,_0x3bfeb8,_0x111f49,_0x3dad39))['then'](getEndUser(_0x247f12,_0x3d5e15,_0x3bfeb8,_0x111f49,_0x3dad39))[_0x1126('0x18')](getTicket(_0x247f12,_0x3d5e15,_0x3bfeb8,_0x366675,_0x1fb2f0,_0x111f49))['then'](function(_0x1f320e){logger[_0x1126('0x10')](util['format'](_0x1126('0x65'),_0x1f320e[_0x1126('0x3d')]));logger[_0x1126('0x10')](util[_0x1126('0x66')](_0x1126('0x67'),_0x247f12));if(_0x247f12!=='unmanaged'){logger[_0x1126('0x10')]('['+[_0x247f12[_0x1126('0x11')]()]+']','Displaying\x20call\x20in\x20a\x20new\x20tab...');emit(_0x30d240[_0x1126('0x51')],_0x6a41c0[_0x1126('0x36')],_0x1f320e[_0x1126('0x3d')]);}})[_0x1126('0x13')](function(_0x2598a7){logger[_0x1126('0x14')]('['+[_0x247f12[_0x1126('0x11')]()]+_0x1126('0x68'),util[_0x1126('0x69')](_0x2598a7,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0xc4aa=['all',']\x20arrayPromises:\x20IDs\x20in\x20table\x20label','Tags','map','%26sysparm_record_list%3Dactive%253Dtrue','%255EORDERBYDESCnumber','/nav_to.do?uri=incident.do?sys_id%3D','format','user:%s','emit','trigger:browser:url','username','sysparm_limit=1','remoteUri','stripTrailingSlash','isNil','email','destcalleridnum','calleridnum','queue','uniqueid','monitor_format','Recording\x20is\x20enabled!','recordingURL','none','[OUTBOUND]','call\x20direction:\x20%s','unmanaged','Displaying\x20call\x20in\x20a\x20new\x20tab...',']\x20Error\x20running\x20ServiceNow\x20integration','inspect','lodash','bluebird','request-promise','util','md5','ioredis','servicenow','redis','defaults','localhost','socket.io-emitter','GET','then','result','adminId','sys_id','toUpperCase','],\x20getAdminUser\x20crm','catch','error','message','info','],\x20getUser\x20input\x20crm','validateEmail','userEmail','sys_user?sysparm_query=email%3D','],\x20getUser\x20rp\x20obj','],\x20getUser\x20entity','length','active','true','userId','adminEmail','],\x20getUser\x20crm',']\x20using\x20admin\x20profile','],\x20createEndUser\x20input\x20crm','sys_user?','endUserNumber','user','],\x20EndUser\x20schema','endUserId','sys_user?sysparm_query=phone%3D','],\x20getEndUser\x20crm','forEach','type','string','nameField','customField','idField','toLowerCase','content','toString','variable','variableName','customVariable','Variable','name',']\x20getTicket\x20input\x20crm','outbound','incident','getString','Descriptions','Fields',']\x20POST\x20incident\x20entity\x20schema','ticketId','number',']\x20getTicket\x20crm','label','POST','ticketNumber','push'];(function(_0x99bd7d,_0x5509c7){var _0x5490e9=function(_0x252809){while(--_0x252809){_0x99bd7d['push'](_0x99bd7d['shift']());}};_0x5490e9(++_0x5509c7);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x1694f5,_0x49b7c3){_0x1694f5=_0x1694f5-0x0;var _0x5b4321=_0xc4aa[_0x1694f5];return _0x5b4321;};'use strict';var _=require(_0xac4a('0x0'));var Promise=require(_0xac4a('0x1'));var rp=require(_0xac4a('0x2'));var util=require(_0xac4a('0x3'));var md5=require(_0xac4a('0x4'));var Redis=require(_0xac4a('0x5'));var intUtil=require('./util');var config=require('../../../../config/environment');var logger=require('../../../../config/logger')(_0xac4a('0x6'));config[_0xac4a('0x7')]=_[_0xac4a('0x8')](config[_0xac4a('0x7')],{'host':_0xac4a('0x9'),'port':0x18eb});var io=require(_0xac4a('0xa'))(new Redis(config[_0xac4a('0x7')]));function getAdminUser(_0x10525b,_0x5c6179,_0x5b8339,_0x1aba6d,_0x2a4d53,_0x26ec84){return new Promise(function(_0x4f4146,_0x1d182e){var _0x3a82de={'method':_0xac4a('0xb'),'uri':_0x1aba6d+'sys_user?sysparm_query=user_name%3Dadmin'+'&'+_0x2a4d53+'&'+_0x26ec84,'auth':_0x5c6179,'json':!![]};return rp(_0x3a82de)[_0xac4a('0xc')](function(_0x488e3c){if(_0x488e3c[_0xac4a('0xd')]['length']>0x0){_0x5b8339[_0xac4a('0xe')]=_0x488e3c[_0xac4a('0xd')][0x0][_0xac4a('0xf')];}logger['info']('['+[_0x10525b[_0xac4a('0x10')]()]+_0xac4a('0x11'),_0x5b8339);_0x4f4146(_0x5b8339);})[_0xac4a('0x12')](function(_0x6e00d4){logger[_0xac4a('0x13')]('['+[_0x10525b[_0xac4a('0x10')]()]+']',_0x6e00d4[_0xac4a('0x14')]);_0x1d182e(_0x6e00d4[_0xac4a('0x14')]);});});}function getUser(_0x190418,_0x42c7fc,_0x11e101,_0x26dbb8,_0x4a2119){return function(_0x402fff){logger[_0xac4a('0x15')]('['+[_0x190418[_0xac4a('0x10')]()]+_0xac4a('0x16'),_0x402fff);return new Promise(function(_0x3e88e3,_0x387a54){if(intUtil[_0xac4a('0x17')](_0x402fff[_0xac4a('0x18')])){var _0x546c5d={'method':'GET','uri':_0x11e101+_0xac4a('0x19')+_0x402fff[_0xac4a('0x18')]+'&'+_0x26dbb8+'&'+_0x4a2119,'auth':_0x42c7fc,'json':!![]};logger[_0xac4a('0x15')]('['+[_0x190418['toUpperCase']()]+_0xac4a('0x1a'),_0x546c5d);return rp(_0x546c5d)[_0xac4a('0xc')](function(_0x3752e4){logger[_0xac4a('0x15')]('['+[_0x190418[_0xac4a('0x10')]()]+_0xac4a('0x1b'),_0x3752e4);if(_0x3752e4[_0xac4a('0xd')][_0xac4a('0x1c')]>0x0&&String(_0x3752e4['result'][0x0][_0xac4a('0x1d')])===_0xac4a('0x1e')){_0x402fff['userId']=_0x3752e4[_0xac4a('0xd')][0x0][_0xac4a('0xf')];}else{_0x402fff[_0xac4a('0x1f')]=_0x402fff[_0xac4a('0xe')];_0x402fff['userEmail']=_0x402fff[_0xac4a('0x20')];}logger[_0xac4a('0x15')]('['+[_0x190418[_0xac4a('0x10')]()]+_0xac4a('0x21'),_0x402fff);_0x3e88e3(_0x402fff);})[_0xac4a('0x12')](function(_0x2b0dc2){logger[_0xac4a('0x13')]('['+[_0x190418[_0xac4a('0x10')]()]+']',_0x2b0dc2[_0xac4a('0x14')]);_0x387a54(_0x2b0dc2[_0xac4a('0x14')]);});}else{logger[_0xac4a('0x15')]('['+[_0x190418[_0xac4a('0x10')]()]+_0xac4a('0x22'));_0x402fff[_0xac4a('0x1f')]=_0x402fff[_0xac4a('0xe')];_0x402fff[_0xac4a('0x18')]=_0x402fff['adminEmail'];_0x3e88e3(_0x402fff);}});};}function createEndUser(_0x23b061,_0x267a22,_0x42a33c,_0x2772fe,_0x116700){logger['info']('['+[_0x23b061['toUpperCase']()]+_0xac4a('0x23'),_0x42a33c);return new Promise(function(_0x7a948b,_0x1f12d5){var _0x546b65={'method':'POST','uri':_0x2772fe+_0xac4a('0x24')+_0x116700,'body':{'user_name':_0x42a33c[_0xac4a('0x25')],'roles':_0xac4a('0x26'),'first_name':_0x42a33c[_0xac4a('0x25')],'active':_0xac4a('0x1e'),'date_format':'System','phone':_0x42a33c[_0xac4a('0x25')]},'auth':_0x267a22,'json':!![]};return rp(_0x546b65)['then'](function(_0x30364b){logger['info']('['+[_0x23b061[_0xac4a('0x10')]()]+_0xac4a('0x27'),_0x30364b[_0xac4a('0xd')]);_0x42a33c[_0xac4a('0x28')]=_0x30364b[_0xac4a('0xd')][_0xac4a('0xf')];_0x7a948b(_0x42a33c);})[_0xac4a('0x12')](function(_0x1f13f3){logger[_0xac4a('0x13')]('['+[_0x23b061[_0xac4a('0x10')]()]+']',_0x1f13f3[_0xac4a('0x14')]);_0x1f12d5(_0x1f13f3[_0xac4a('0x14')]);});});}function getEndUser(_0x1a9be2,_0x1a9d4e,_0x5634e2,_0x30442d,_0x1c41fb){return function(_0x5a4e2b){logger[_0xac4a('0x15')]('['+[_0x1a9be2[_0xac4a('0x10')]()]+'],\x20getEndUser\x20input\x20crm',_0x5a4e2b);return new Promise(function(_0x58804b,_0x11f0be){var _0x1ba096={'method':_0xac4a('0xb'),'uri':_0x5634e2+_0xac4a('0x29')+_0x5a4e2b['endUserNumber']+'&'+_0x30442d+'&'+_0x1c41fb,'auth':_0x1a9d4e,'json':!![]};return rp(_0x1ba096)[_0xac4a('0xc')](function(_0x2e56c6){if(_0x2e56c6['result'][_0xac4a('0x1c')]>0x0){_0x5a4e2b[_0xac4a('0x28')]=_0x2e56c6[_0xac4a('0xd')][0x0]['sys_id'];logger[_0xac4a('0x15')]('['+[_0x1a9be2[_0xac4a('0x10')]()]+_0xac4a('0x2a'),_0x5a4e2b);_0x58804b(_0x5a4e2b);}else{return createEndUser(_0x1a9be2,_0x1a9d4e,_0x5a4e2b,_0x5634e2,_0x30442d)['then'](function(_0x35bc94){logger[_0xac4a('0x15')]('['+[_0x1a9be2['toUpperCase']()]+'],\x20createEndUser\x20crm',_0x35bc94);_0x58804b(_0x35bc94);});}})[_0xac4a('0x12')](function(_0x5e0926){logger['error']('['+[_0x1a9be2['toUpperCase']()]+']',_0x5e0926['message']);_0x11f0be(_0x5e0926[_0xac4a('0x14')]);});});};}function getCustomFields(_0x2bf8e8,_0x37834b){var _0x472484={};if(_0x2bf8e8[_0xac4a('0x1c')]>0x0){_[_0xac4a('0x2b')](_0x2bf8e8,function(_0x4220e2){if(_0x4220e2[_0xac4a('0x2c')]===_0xac4a('0x2d')&&_0x4220e2[_0xac4a('0x2e')]&&!_0x4220e2[_0xac4a('0x2f')]){_0x472484[_0x4220e2[_0xac4a('0x30')]['toLowerCase']()]=_0x4220e2['content']['toString']();}else if(_0x4220e2[_0xac4a('0x2c')]===_0xac4a('0x2d')&&_0x4220e2[_0xac4a('0x30')]&&_0x4220e2[_0xac4a('0x2f')]){_0x472484[_0x4220e2[_0xac4a('0x30')][_0xac4a('0x31')]()]=_0x4220e2[_0xac4a('0x32')][_0xac4a('0x33')]();}else if(_0x4220e2[_0xac4a('0x2c')]===_0xac4a('0x34')&&_0x4220e2['variableName']&&_0x4220e2[_0xac4a('0x30')]&&_0x4220e2[_0xac4a('0x2f')]){_0x472484[_0x4220e2[_0xac4a('0x30')][_0xac4a('0x31')]()]=_0x37834b[_0x4220e2[_0xac4a('0x35')]]['toString']();}else if(_0x4220e2[_0xac4a('0x2c')]===_0xac4a('0x36')&&_0x4220e2['Variable']&&_0x4220e2[_0xac4a('0x37')]['name']&&_0x4220e2[_0xac4a('0x30')]&&_0x4220e2[_0xac4a('0x2f')]){_0x472484[_0x4220e2[_0xac4a('0x30')][_0xac4a('0x31')]()]=_0x37834b[_0x4220e2[_0xac4a('0x37')][_0xac4a('0x38')][_0xac4a('0x31')]()][_0xac4a('0x33')]();}});}return _0x472484;}function getTicket(_0x98e0c4,_0xcb002b,_0x4fa9eb,_0x3b68b3,_0x569812,_0x1646ea){return function(_0x41d11d){logger[_0xac4a('0x15')]('['+[_0x98e0c4['toUpperCase']()]+_0xac4a('0x39'),_0x41d11d);return new Promise(function(_0x19276e,_0x5f54ff){var _0x42969b=_0x98e0c4['toLowerCase']()===_0xac4a('0x3a')?_0x41d11d[_0xac4a('0x1f')]:_0x41d11d[_0xac4a('0x28')];var _0x5e3581={'method':'POST','uri':_0x4fa9eb+_0xac4a('0x3b')+'?'+_0x1646ea,'body':Object['assign']({},{'active':_0xac4a('0x1e'),'caller_id':_0x42969b,'assigned_to':_0x41d11d['userId'],'short_description':intUtil[_0xac4a('0x3c')](_0x3b68b3['Subjects'],_0x569812,'\x20'),'description':intUtil[_0xac4a('0x3c')](_0x3b68b3[_0xac4a('0x3d')],_0x569812,'\x0a')},getCustomFields(_0x3b68b3[_0xac4a('0x3e')],_0x569812)),'auth':_0xcb002b,'json':!![]};return rp(_0x5e3581)[_0xac4a('0xc')](function(_0x54782f){logger[_0xac4a('0x15')]('['+[_0x98e0c4[_0xac4a('0x10')]()]+_0xac4a('0x3f'),_0x54782f[_0xac4a('0xd')]);_0x41d11d[_0xac4a('0x40')]=_0x54782f[_0xac4a('0xd')][_0xac4a('0xf')];_0x41d11d['ticketNumber']=_0x54782f[_0xac4a('0xd')][_0xac4a('0x41')];logger['info']('['+[_0x98e0c4[_0xac4a('0x10')]()]+_0xac4a('0x42'),_0x41d11d);_0x19276e(_0x41d11d);})[_0xac4a('0x12')](function(_0x3ac36e){logger['error']('['+[_0x98e0c4[_0xac4a('0x10')]()]+']',_0x3ac36e[_0xac4a('0x14')]);_0x5f54ff(_0x3ac36e[_0xac4a('0x14')]);});});};}function createRemoteTag(_0x129d58,_0x890910,_0x49fbc3,_0x179373){return new Promise(function(_0x564b10,_0x307441){var _0x2c04af={'method':'POST','uri':_0x49fbc3+'label'+'?'+_0x179373,'body':{'short_description':_0x129d58,'global':!![],'active':!![],'name':_0x129d58},'auth':_0x890910,'json':!![]};return rp(_0x2c04af)[_0xac4a('0xc')](function(_0x70fdc3){var _0x4d448f=_0x70fdc3[_0xac4a('0xd')][_0xac4a('0xf')];_0x564b10(_0x4d448f);});});}function getRemoteTag(_0x26b582,_0x103d05,_0x48900f,_0x3057d6,_0x108f7c){return new Promise(function(_0xb43fdb,_0xb5897b){var _0xdc80e3={'method':_0xac4a('0xb'),'uri':_0x48900f+_0xac4a('0x43')+'?sysparm_query=name%3D'+_0x26b582+'&'+_0x3057d6,'auth':_0x103d05,'json':!![]};return rp(_0xdc80e3)[_0xac4a('0xc')](function(_0xef51d0){if(_0xef51d0[_0xac4a('0xd')][_0xac4a('0x1c')]>0x0){var _0x1b7231=_0xef51d0[_0xac4a('0xd')][0x0][_0xac4a('0xf')];_0xb43fdb(_0x1b7231);}else{return createRemoteTag(_0x26b582,_0x103d05,_0x48900f,_0x3057d6)[_0xac4a('0xc')](function(_0x159e43){_0xb43fdb(_0x159e43);});}});});}function assignTagToIncident(_0x786d9,_0x3b175a,_0x38dd4f,_0x400ac4,_0x2fe7df){return new Promise(function(_0x5222f3,_0x11c753){var _0x492aae={'method':_0xac4a('0x44'),'uri':_0x38dd4f+'label_entry'+'?'+_0x2fe7df,'body':{'label':_0x786d9,'table':_0xac4a('0x3b'),'id_type':'Incident','table_key':_0x400ac4[_0xac4a('0x40')],'title':'Incident\x20-\x20'+_0x400ac4[_0xac4a('0x45')],'id_display':_0x400ac4['ticketNumber']},'auth':_0x3b175a,'json':!![]};return rp(_0x492aae)['then'](function(_0x52c957){_0x5222f3();})[_0xac4a('0x12')](function(){_0x5222f3();});});}function manageTags(_0x3bcae2,_0x3c2f84,_0x2f9940,_0xb7b884,_0x592a4b,_0x1e1ffa,_0x50dece){return new Promise(function(_0x34215e,_0x5d03e5){var _0x347880=[];_0x3c2f84[_0xac4a('0x2b')](function(_0x3da7e7){_0x347880[_0xac4a('0x46')](getRemoteTag(_0x3da7e7,_0x2f9940,_0xb7b884,_0x1e1ffa,_0x50dece));});return Promise[_0xac4a('0x47')](_0x347880)[_0xac4a('0xc')](function(_0x3abd57){if(_0x3abd57[_0xac4a('0x1c')]){logger[_0xac4a('0x15')]('['+[_0x3bcae2[_0xac4a('0x10')]()]+_0xac4a('0x48'),_0x3abd57);var _0x2498ad=[];_0x3abd57[_0xac4a('0x2b')](function(_0x2cc410){_0x2498ad[_0xac4a('0x46')](assignTagToIncident(_0x2cc410,_0x2f9940,_0xb7b884,_0x592a4b,_0x1e1ffa));});return Promise[_0xac4a('0x47')](_0x2498ad)[_0xac4a('0xc')](function(){_0x34215e();})['catch'](function(){_0x34215e();});}else{_0x34215e();}});});}function getTags(_0xa90d71,_0x1672c0,_0x4fb812,_0x3c3576,_0x34bd1c,_0x2d24c7){return function(_0x2b8562){return new Promise(function(_0x357cac,_0x4d1440){var _0x47c6d8=[];var _0x45f3c3=_0x3c3576[_0xac4a('0x49')];if(_0x45f3c3&&_0x45f3c3[_0xac4a('0x1c')]>0x0){_0x47c6d8=_[_0xac4a('0x4a')](_0x45f3c3,_0xac4a('0x38'));}if(_0x47c6d8[_0xac4a('0x1c')]>0x0){return manageTags(_0xa90d71,_0x47c6d8,_0x1672c0,_0x4fb812,_0x2b8562,_0x34bd1c,_0x2d24c7)[_0xac4a('0xc')](function(){_0x357cac(_0x2b8562);});}else{_0x357cac(_0x2b8562);}});};}function emit(_0x2988d7,_0x44c60b,_0x295f21){var _0x278c09='%26sysparm_record_target%3Dincident'+'%26sysparm_record_row%3D1%26sysparm_record_rows%3D39'+_0xac4a('0x4b')+_0xac4a('0x4c');var _0x2954fc={'uri':_0x2988d7+_0xac4a('0x4d')+_0x295f21+_0x278c09};io['to'](util[_0xac4a('0x4e')](_0xac4a('0x4f'),_0x44c60b))[_0xac4a('0x50')](_0xac4a('0x51'),_0x2954fc);}exports['cs']=function(_0x453d62,_0x2a5acc,_0xb09b89,_0xb12cc5,_0x5f0173,_0x13c854,_0xc74ce8,_0x26bd31){var _0x231932={};var _0x513976={'user':_0x13c854[_0xac4a('0x52')],'pass':_0x13c854['password']};var _0xab4305=_0xac4a('0x53');var _0x499abc='sysparm_display_value=true';_0x13c854[_0xac4a('0x54')]=intUtil[_0xac4a('0x55')](_0x13c854[_0xac4a('0x54')]);_0x13c854['serverUrl']=intUtil[_0xac4a('0x55')](_0x13c854['serverUrl']);var _0x114b11=util['format']('%s/api/now/table/',_0x13c854[_0xac4a('0x54')]);_0x231932['userEmail']=!_[_0xac4a('0x56')](_0xb12cc5)?_0xb12cc5['email']:null;_0x231932[_0xac4a('0x20')]=_0x13c854[_0xac4a('0x57')];_0x231932['endUserNumber']=_0x26bd31[_0xac4a('0x31')]()==='outbound'?_0x2a5acc[_0xac4a('0x58')]:_0x2a5acc[_0xac4a('0x59')];_0x231932['callDirection']=_0x26bd31===_0xac4a('0x5a')||_0x26bd31==='unmanaged'?'queue':_0xac4a('0x3a');var _0x4e3129=util[_0xac4a('0x4e')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x13c854['serverUrl'],_0x2a5acc[_0xac4a('0x5b')],md5(_0x2a5acc[_0xac4a('0x5b')]));if(_0x5f0173&&_0x5f0173[_0xac4a('0x5c')]){logger['info']('[QUEUE]',_0xac4a('0x5d'));_0x2a5acc[_0xac4a('0x5e')]=_0x4e3129;}else if(_0xc74ce8&&_0xc74ce8['recordingFormat']&&_0xc74ce8['recordingFormat']!==_0xac4a('0x5f')){logger[_0xac4a('0x15')](_0xac4a('0x60'),_0xac4a('0x5d'));_0x2a5acc[_0xac4a('0x5e')]=_0x4e3129;}else{_0x2a5acc[_0xac4a('0x5e')]='';}return getAdminUser(_0x26bd31,_0x513976,_0x231932,_0x114b11,_0x499abc,_0xab4305)[_0xac4a('0xc')](getUser(_0x26bd31,_0x513976,_0x114b11,_0x499abc,_0xab4305))[_0xac4a('0xc')](getEndUser(_0x26bd31,_0x513976,_0x114b11,_0x499abc,_0xab4305))[_0xac4a('0xc')](getTicket(_0x26bd31,_0x513976,_0x114b11,_0xb09b89,_0x2a5acc,_0x499abc))['then'](function(_0x1201e8){logger[_0xac4a('0x15')](util[_0xac4a('0x4e')]('The\x20ticket\x20ID\x20is:\x20%s',_0x1201e8[_0xac4a('0x40')]));logger[_0xac4a('0x15')](util[_0xac4a('0x4e')](_0xac4a('0x61'),_0x26bd31));if(_0x26bd31!==_0xac4a('0x62')){logger['info']('['+[_0x26bd31[_0xac4a('0x10')]()]+']',_0xac4a('0x63'));emit(_0x13c854[_0xac4a('0x54')],_0xb12cc5[_0xac4a('0x38')],_0x1201e8[_0xac4a('0x40')]);}})[_0xac4a('0x12')](function(_0xd7bdd6){logger['error']('['+[_0x26bd31[_0xac4a('0x10')]()]+_0xac4a('0x64'),util[_0xac4a('0x65')](_0xd7bdd6,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file diff --git a/server/services/ami/trigger/integration/sugarcrm.js b/server/services/ami/trigger/integration/sugarcrm.js index fefdae1..8d41868 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 _0x576b=['The\x20Ticket\x20ID\x20is:','md5','util','./util','../../../../config/environment','sugarcrm','redis','defaults','localhost','socket.io-emitter','POST','emit','info','name','getString','Subjects','assigned_user_id','created_by','description','Descriptions','date_start','duration_hours','duration_minutes','parent_id','parent_type','Contacts','parent_name','direction','length','variableName','push','idField','JSON','format','Basic\x20%s','apiKey','base64','get_server_info','stringify','isNil','Getting\x20agent\x20with\x20name','get_entry_list','Employees','INSTR\x20(\x20users.user_name,\x20\x22%s\x22)\x20>\x200','user_name','then','entry_list','find','name_value_list','value','Agent\x20found!','resolve','user_id','Agent\x20not\x20available,\x20using\x20the\x20admin\x20account!','Searching\x20enduser\x20with\x20phone','contacts.phone_home\x20=\x20\x22%s\x22','phone_home','Enduser\x20found!','set_entry','first_name','Caller\x20-\x20%s','Enduser\x20created.','debug','[HTTP]','merge','map','forEach','type','customField','content','toString','custom_fields','variable','customVariable','Variable','toLowerCase','login','Account\x20%d\x20is\x20not\x20valid','Calls','queue','stripTrailingSlash','serverUrl','%s/service/v4_1/rest.php','remoteUri','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','recordingURL','The\x20User\x20ID\x20is:','calleridname','calleridnum','The\x20Enduser\x20ID\x20is:','Fields','Inbound','Ticket\x20created!','contacts','charAt','%s/index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DCalls%26action%3DEditView%26record%3D%s','%s/#bwc/index.php?module=Calls&action=EditView&record=%s','catch','error','outbound','uri','recordingFormat','none','[OUTBOUND]','destcalleridnum','Outbound','users','version','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','unmanaged','lastevent','toUpperCase'];(function(_0x3ea0ce,_0x4e4a95){var _0x2fd827=function(_0x5a909d){while(--_0x5a909d){_0x3ea0ce['push'](_0x3ea0ce['shift']());}};_0x2fd827(++_0x4e4a95);}(_0x576b,0x1d9));var _0xb576=function(_0x315690,_0x464acf){_0x315690=_0x315690-0x0;var _0x5afde7=_0x576b[_0x315690];return _0x5afde7;};'use strict';var _=require('lodash');var rp=require('request-promise');var BPromise=require('bluebird');var md5=require(_0xb576('0x0'));var util=require(_0xb576('0x1'));var Redis=require('ioredis');var intUtil=require(_0xb576('0x2'));var config=require(_0xb576('0x3'));var logger=require('../../../../config/logger')(_0xb576('0x4'));config[_0xb576('0x5')]=_[_0xb576('0x6')](config[_0xb576('0x5')],{'host':_0xb576('0x7'),'port':0x18eb});var io=require(_0xb576('0x8'))(new Redis(config[_0xb576('0x5')]));var def={'method':_0xb576('0x9'),'json':!![]};function emit(_0xe6d2fd,_0x450f16,_0x1148c2){io['to'](_0xe6d2fd)[_0xb576('0xa')](_0x450f16,_0x1148c2);}function getTicket(_0x7cc721,_0x384fcc,_0x395bd2,_0x4b209b,_0x3e21fe,_0x4a3fbb,_0x282aa2,_0x2a0f32){logger[_0xb576('0xb')]('Creating\x20new\x20ticket...');var _0x4fa503=new Date();var _0x1e473a=[{'name':_0xb576('0xc'),'value':intUtil[_0xb576('0xd')](_0x4b209b[_0xb576('0xe')],_0x3e21fe,'\x20')},{'name':_0xb576('0xf'),'value':_0x384fcc['id']},{'name':_0xb576('0x10'),'value':_0x384fcc['id']},{'name':_0xb576('0x11'),'value':intUtil[_0xb576('0xd')](_0x4b209b[_0xb576('0x12')],_0x3e21fe,'\x0a')},{'name':_0xb576('0x13'),'value':_0x4fa503['toISOString']()['slice'](0x0,0x13)['replace']('T','\x20')},{'name':_0xb576('0x14'),'value':'0'},{'name':_0xb576('0x15'),'value':'15'},{'name':_0xb576('0x16'),'value':_0x395bd2['id']},{'name':_0xb576('0x17'),'value':_0xb576('0x18')},{'name':_0xb576('0x19'),'value':_0x395bd2['name']},{'name':_0xb576('0x1a'),'value':_0x2a0f32}];if(_0x4a3fbb[_0xb576('0x1b')]){_['forEach'](_0x4a3fbb,function(_0x52a0ca){if(_0x3e21fe[_0x52a0ca[_0xb576('0x1c')]]){_0x1e473a[_0xb576('0x1d')]({'name':_0x52a0ca[_0xb576('0x1e')],'value':_0x3e21fe[_0x52a0ca['variableName']]});}});}return request({'form':{'method':'set_entry','input_type':'JSON','response_type':_0xb576('0x1f'),'rest_data':JSON['stringify']({'session':_0x282aa2['id'],'module_name':'Calls','name_value_list':_0x1e473a})}});}function getAuth(_0x2243b1){return util[_0xb576('0x20')](_0xb576('0x21'),new Buffer(_0x2243b1[_0xb576('0x22')]+':X')['toString'](_0xb576('0x23')));}function getServerInfo(_0x38cf07){return request({'form':{'method':_0xb576('0x24'),'input_type':_0xb576('0x1f'),'response_type':_0xb576('0x1f'),'rest_data':JSON[_0xb576('0x25')]({'session':_0x38cf07['id']})}});}function getUser(_0x2b6074,_0x2a930d,_0x23d3e7){if(!_[_0xb576('0x26')](_0x2a930d)){logger[_0xb576('0xb')](_0xb576('0x27'),_0x2a930d);return request({'form':{'method':_0xb576('0x28'),'input_type':_0xb576('0x1f'),'response_type':'JSON','rest_data':JSON[_0xb576('0x25')]({'session':_0x23d3e7['id'],'module_name':_0xb576('0x29'),'query':util[_0xb576('0x20')](_0xb576('0x2a'),_0x2a930d),'order_by':'','offset':'0','select_fields':['id',_0xb576('0xc'),_0xb576('0x2b')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0xb576('0x2c')](function(_0x535bb9){if(_0x535bb9[_0xb576('0x2d')][_0xb576('0x1b')]){var _0x334bdd=_[_0xb576('0x2e')](_0x535bb9[_0xb576('0x2d')],function(_0x592dfc){return _0x592dfc[_0xb576('0x2f')]['user_name'][_0xb576('0x30')]===_0x2a930d;});if(_0x334bdd){logger[_0xb576('0xb')](_0xb576('0x31'));return BPromise[_0xb576('0x32')]({'id':_0x334bdd[_0xb576('0x2f')]['id']['value'],'name':_0x334bdd[_0xb576('0x2f')][_0xb576('0xc')][_0xb576('0x30')]});}}logger[_0xb576('0xb')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return BPromise[_0xb576('0x32')]({'id':_0x23d3e7[_0xb576('0x2f')][_0xb576('0x33')]['value'],'name':_0x23d3e7['name_value_list']['user_name'][_0xb576('0x30')]});});}else{logger[_0xb576('0xb')](_0xb576('0x34'));return BPromise[_0xb576('0x32')]({'id':_0x23d3e7[_0xb576('0x2f')][_0xb576('0x33')][_0xb576('0x30')],'name':_0x23d3e7[_0xb576('0x2f')][_0xb576('0x2b')]['value']});}}function getEndUser(_0x206292,_0x4a6e72,_0x550ee7,_0x18ed43){logger[_0xb576('0xb')](_0xb576('0x35'),_0x550ee7);return request({'form':{'method':'get_entry_list','input_type':_0xb576('0x1f'),'response_type':_0xb576('0x1f'),'rest_data':JSON['stringify']({'session':_0x18ed43['id'],'module_name':_0xb576('0x18'),'query':util[_0xb576('0x20')](_0xb576('0x36'),_0x550ee7),'order_by':'','offset':'0','select_fields':['id',_0xb576('0xc'),_0xb576('0x37')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0xb576('0x2c')](function(_0xe4afbc){if(_0xe4afbc[_0xb576('0x2d')][_0xb576('0x1b')]){var _0x217a88=_[_0xb576('0x2e')](_0xe4afbc['entry_list'],function(_0x5b9f8d){return _0x5b9f8d[_0xb576('0x2f')]['phone_home'][_0xb576('0x30')]===_0x550ee7;});if(_0x217a88){logger[_0xb576('0xb')](_0xb576('0x38'));return BPromise[_0xb576('0x32')]({'id':_0x217a88['name_value_list']['id'][_0xb576('0x30')],'name':_0x217a88['name_value_list'][_0xb576('0xc')][_0xb576('0x30')],'phone':_0x217a88[_0xb576('0x2f')]['phone_home'][_0xb576('0x30')]});}}else{logger['info']('Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!');return request({'form':{'method':_0xb576('0x39'),'input_type':_0xb576('0x1f'),'response_type':_0xb576('0x1f'),'rest_data':JSON[_0xb576('0x25')]({'session':_0x18ed43['id'],'module_name':_0xb576('0x18'),'name_value_list':[{'name':_0xb576('0x3a'),'value':_0x4a6e72!==''?_0x4a6e72:util[_0xb576('0x20')](_0xb576('0x3b'),_0x550ee7)},{'name':_0xb576('0x37'),'value':_0x550ee7}]})}})[_0xb576('0x2c')](function(_0x26f25f){logger[_0xb576('0xb')](_0xb576('0x3c'));return BPromise[_0xb576('0x32')]({'id':_0x26f25f['id'],'name':_0x26f25f[_0xb576('0x2d')]['first_name'][_0xb576('0x30')],'phone':_0x26f25f[_0xb576('0x2d')][_0xb576('0x37')][_0xb576('0x30')]});});}});}function request(_0x28a0cb){logger[_0xb576('0x3d')](_0xb576('0x3e'),JSON[_0xb576('0x25')](_0x28a0cb));return rp(_[_0xb576('0x3f')](def,_0x28a0cb));}function getTags(_0x1398fc,_0xca0406){var _0x52d89f=[];if(_0x1398fc&&_0x1398fc['length']>0x0){_0x52d89f=_[_0xb576('0x40')](_0x1398fc,_0xca0406);}return _0x52d89f;}function getCustomFields(_0x381ef1,_0x45db3d){var _0xf423df=[];var _0x470b75={'custom_fields':[]};if(_0x381ef1[_0xb576('0x1b')]>0x0){_[_0xb576('0x41')](_0x381ef1,function(_0x24f099){if(_0x24f099[_0xb576('0x42')]==='string'&&_0x24f099['nameField']&&!_0x24f099[_0xb576('0x43')]){_0x470b75[_0x24f099['nameField']['toLowerCase']()]=_0x24f099[_0xb576('0x44')][_0xb576('0x45')]();}else if(_0x24f099[_0xb576('0x42')]==='string'&&_0x24f099[_0xb576('0x1e')]&&_0x24f099[_0xb576('0x43')]){_0x470b75[_0xb576('0x46')]['push']({'id':_0x24f099['idField'],'value':_0x24f099[_0xb576('0x44')]['toString']()});}else if(_0x24f099[_0xb576('0x42')]===_0xb576('0x47')&&_0x24f099['variableName']&&_0x24f099['idField']&&_0x24f099[_0xb576('0x43')]){_0x45db3d[_0x24f099[_0xb576('0x1c')]]&&_0x470b75[_0xb576('0x46')]['push']({'id':_0x24f099[_0xb576('0x1e')],'value':_0x45db3d[_0x24f099[_0xb576('0x1c')]][_0xb576('0x45')]()});}else if(_0x24f099[_0xb576('0x42')]===_0xb576('0x48')&&_0x24f099[_0xb576('0x49')]&&_0x24f099[_0xb576('0x49')][_0xb576('0xc')]&&_0x24f099[_0xb576('0x1e')]&&_0x24f099[_0xb576('0x43')]){_0x45db3d[_0x24f099[_0xb576('0x49')][_0xb576('0xc')][_0xb576('0x4a')]()]&&_0x470b75[_0xb576('0x46')][_0xb576('0x1d')]({'id':_0x24f099[_0xb576('0x1e')],'value':_0x45db3d[_0x24f099[_0xb576('0x49')][_0xb576('0xc')]['toLowerCase']()][_0xb576('0x45')]()});}});}return _0x470b75;}function getConnection(_0x24d0c5){return request({'method':_0xb576('0x9'),'form':{'method':_0xb576('0x4b'),'input_type':_0xb576('0x1f'),'response_type':_0xb576('0x1f'),'rest_data':JSON[_0xb576('0x25')]({'user_auth':{'user_name':_0x24d0c5['username'],'password':_0x24d0c5['password'],'encryption':'PLAIN'},'application':'xCALLY\x20Motion\x20integration'})}})[_0xb576('0x2c')](function(_0x4e0edc){var _0xb0ffb1=_0x4e0edc;if(_0xb0ffb1['id']){def['sessionID']=_0xb0ffb1['id'];return BPromise[_0xb576('0x32')](_0xb0ffb1);}else{throw new Error(util['format'](_0xb576('0x4c'),_0x24d0c5['id']));}});}function setRelationship(_0x35961f,_0x1a25d8,_0x6e8217,_0x5a1484){return request({'form':{'method':'set_relationship','input_type':_0xb576('0x1f'),'response_type':'JSON','rest_data':JSON[_0xb576('0x25')]({'session':_0x35961f['id'],'module_name':_0xb576('0x4d'),'module_id':_0x6e8217['id'],'link_field_name':_0x5a1484,'related_ids':[_0x1a25d8['id']]})}});}exports[_0xb576('0x4e')]=function(_0x483b0b,_0x5cbcb9,_0x20f84f,_0x2c480a,_0x270ab1,_0x19f3c1){var _0x236f38,_0x1731ef,_0x409dd2,_0x551d55;_0x19f3c1['remoteUri']=intUtil[_0xb576('0x4f')](_0x19f3c1['remoteUri']);_0x19f3c1[_0xb576('0x50')]=intUtil[_0xb576('0x4f')](_0x19f3c1[_0xb576('0x50')]);def['uri']=util[_0xb576('0x20')](_0xb576('0x51'),_0x19f3c1[_0xb576('0x52')]);if(_0x270ab1&&_0x270ab1[_0xb576('0x53')]){logger[_0xb576('0xb')](_0xb576('0x54'),_0xb576('0x55'));_0x5cbcb9['recordingURL']=util['format'](_0xb576('0x56'),_0x19f3c1[_0xb576('0x50')],_0x5cbcb9[_0xb576('0x57')],md5(_0x5cbcb9[_0xb576('0x57')]));}else{_0x5cbcb9[_0xb576('0x58')]='';}return getConnection(_0x19f3c1)[_0xb576('0x2c')](function(_0x4e6a2f){_0x551d55=_0x4e6a2f;return getUser(_0x19f3c1,_0x2c480a[_0xb576('0xc')],_0x551d55);})['then'](function(_0x17bd79){_0x236f38=_0x17bd79;logger[_0xb576('0xb')](_0xb576('0x59'),_0x236f38['id']);return getEndUser(_0x19f3c1,_0x5cbcb9[_0xb576('0x5a')],_0x5cbcb9[_0xb576('0x5b')],_0x551d55);})['then'](function(_0x8089ff){_0x1731ef=_0x8089ff;logger['info'](_0xb576('0x5c'),_0x1731ef['id']);return getTicket(_0x19f3c1,_0x236f38,_0x1731ef,_0x20f84f,_0x5cbcb9,_0x20f84f[_0xb576('0x5d')],_0x551d55,_0xb576('0x5e'));})['then'](function(_0x29899d){_0x409dd2=_0x29899d;logger['info'](_0xb576('0x5f'));logger[_0xb576('0xb')]('The\x20Ticket\x20ID\x20is:',_0x409dd2['id']);return setRelationship(_0x551d55,_0x236f38,_0x409dd2,'users');})[_0xb576('0x2c')](function(){return setRelationship(_0x551d55,_0x1731ef,_0x409dd2,_0xb576('0x60'));})[_0xb576('0x2c')](function(){return getServerInfo(_0x551d55);})['then'](function(_0x384f54){var _0x2890e5=parseInt(_0x384f54['version'][_0xb576('0x61')](0x0));var _0x38d02e=util[_0xb576('0x20')](_0xb576('0x62'),_0x19f3c1['remoteUri'],_0x409dd2['id']);if(_0x2890e5>0x6){_0x38d02e=util[_0xb576('0x20')](_0xb576('0x63'),_0x19f3c1['remoteUri'],_0x409dd2['id']);}logger[_0xb576('0xb')](_0xb576('0x54'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util['format']('user:%s',_0x2c480a[_0xb576('0xc')]),'trigger:browser:url',{'uri':_0x38d02e});})[_0xb576('0x64')](function(_0x3ae087){logger[_0xb576('0x65')](_0xb576('0x54'),JSON[_0xb576('0x25')](_0x3ae087));});};exports[_0xb576('0x66')]=function(_0x50683a,_0x3e1805,_0x5656f5,_0x30f89d,_0x1d5703,_0x156509,_0x457438){var _0x31b5b6,_0x399eec,_0x228dcc,_0x2225f5;_0x156509['remoteUri']=intUtil[_0xb576('0x4f')](_0x156509[_0xb576('0x52')]);_0x156509[_0xb576('0x50')]=intUtil[_0xb576('0x4f')](_0x156509[_0xb576('0x50')]);def[_0xb576('0x67')]=util[_0xb576('0x20')](_0xb576('0x51'),_0x156509['remoteUri']);if(_0x457438&&_0x457438[_0xb576('0x68')]&&_0x457438['recordingFormat']!==_0xb576('0x69')){logger[_0xb576('0xb')](_0xb576('0x6a'),_0xb576('0x55'));_0x3e1805[_0xb576('0x58')]=util['format'](_0xb576('0x56'),_0x156509[_0xb576('0x50')],_0x3e1805[_0xb576('0x57')],md5(_0x3e1805[_0xb576('0x57')]));}return getConnection(_0x156509)['then'](function(_0x46e8dd){_0x2225f5=_0x46e8dd;return getUser(_0x156509,_0x30f89d[_0xb576('0xc')],_0x2225f5);})[_0xb576('0x2c')](function(_0x43beb1){_0x31b5b6=_0x43beb1;logger[_0xb576('0xb')](_0xb576('0x59'),_0x31b5b6['id']);return getEndUser(_0x156509,_0x3e1805['destcalleridname'],_0x3e1805[_0xb576('0x6b')],_0x2225f5);})[_0xb576('0x2c')](function(_0x1a5259){_0x399eec=_0x1a5259;logger[_0xb576('0xb')](_0xb576('0x5c'),_0x399eec['id']);return getTicket(_0x156509,_0x31b5b6,_0x399eec,_0x5656f5,_0x3e1805,_0x5656f5[_0xb576('0x5d')],_0x2225f5,_0xb576('0x6c'));})[_0xb576('0x2c')](function(_0x1cbc49){_0x228dcc=_0x1cbc49;logger['info'](_0xb576('0x5f'));logger[_0xb576('0xb')]('The\x20Ticket\x20ID\x20is:',_0x228dcc['id']);return setRelationship(_0x2225f5,_0x31b5b6,_0x228dcc,_0xb576('0x6d'));})[_0xb576('0x2c')](function(){return setRelationship(_0x2225f5,_0x399eec,_0x228dcc,_0xb576('0x60'));})[_0xb576('0x2c')](function(){return getServerInfo(_0x2225f5);})['then'](function(_0x34003c){var _0x43f407=parseInt(_0x34003c[_0xb576('0x6e')][_0xb576('0x61')](0x0));var _0x2e565e=util[_0xb576('0x20')](_0xb576('0x62'),_0x156509['remoteUri'],_0x228dcc['id']);if(_0x43f407>0x6){_0x2e565e=util[_0xb576('0x20')]('%s/#bwc/index.php?module=Calls&action=EditView&record=%s',_0x156509[_0xb576('0x52')],_0x228dcc['id']);}logger[_0xb576('0xb')](_0xb576('0x6a'),_0xb576('0x6f'));emit(util[_0xb576('0x20')](_0xb576('0x70'),_0x30f89d[_0xb576('0xc')]),_0xb576('0x71'),{'uri':_0x2e565e});})[_0xb576('0x64')](function(_0x34180d){logger[_0xb576('0x65')](_0xb576('0x6a'),JSON[_0xb576('0x25')](_0x34180d));});};exports[_0xb576('0x72')]=function(_0x413936,_0x487878,_0x128f34,_0x359edb,_0x5e28f4,_0x1b80b8){var _0x151b40,_0x31cf5c,_0x55d76e,_0xeffb60;_0x1b80b8[_0xb576('0x52')]=intUtil[_0xb576('0x4f')](_0x1b80b8[_0xb576('0x52')]);_0x1b80b8[_0xb576('0x50')]=intUtil[_0xb576('0x4f')](_0x1b80b8[_0xb576('0x50')]);def[_0xb576('0x67')]=util[_0xb576('0x20')](_0xb576('0x51'),_0x1b80b8['remoteUri']);if(_0x5e28f4&&_0x5e28f4['monitor_format']){logger['info']('['+_0x487878[_0xb576('0x73')][_0xb576('0x74')]()+']','Recording\x20is\x20enabled!');_0x487878[_0xb576('0x58')]=util[_0xb576('0x20')](_0xb576('0x56'),_0x1b80b8[_0xb576('0x50')],_0x487878['uniqueid'],md5(_0x487878['uniqueid']));}else{_0x487878['recordingURL']='';}return getConnection(_0x1b80b8)[_0xb576('0x2c')](function(_0xfae9ac){_0xeffb60=_0xfae9ac;if(!_[_0xb576('0x26')](_0x359edb)){return getUser(_0x1b80b8,_0x359edb[_0xb576('0xc')],_0xeffb60);}else{return getUser(_0x1b80b8,null,_0xeffb60);}})[_0xb576('0x2c')](function(_0x2967d1){_0x151b40=_0x2967d1;logger['info'](_0xb576('0x59'),_0x151b40['id']);return getEndUser(_0x1b80b8,_0x487878[_0xb576('0x5a')],_0x487878[_0xb576('0x5b')],_0xeffb60);})['then'](function(_0x5c7702){_0x31cf5c=_0x5c7702;logger[_0xb576('0xb')](_0xb576('0x5c'),_0x31cf5c['id']);return getTicket(_0x1b80b8,_0x151b40,_0x31cf5c,_0x128f34,_0x487878,_0x128f34[_0xb576('0x5d')],_0xeffb60,'Inbound');})[_0xb576('0x2c')](function(_0x102080){_0x55d76e=_0x102080;logger['info'](_0xb576('0x5f'));logger[_0xb576('0xb')](_0xb576('0x75'),_0x55d76e['id']);return setRelationship(_0xeffb60,_0x151b40,_0x55d76e,_0xb576('0x6d'));})['then'](function(){return setRelationship(_0xeffb60,_0x31cf5c,_0x55d76e,_0xb576('0x60'));})[_0xb576('0x2c')](function(){return getServerInfo(_0xeffb60);})[_0xb576('0x64')](function(_0x17dd61){logger[_0xb576('0x65')]('['+_0x487878[_0xb576('0x73')][_0xb576('0x74')]()+']',JSON[_0xb576('0x25')](_0x17dd61));});}; \ No newline at end of file +var _0x44ff=['redis','localhost','socket.io-emitter','POST','emit','info','name','getString','Subjects','assigned_user_id','created_by','Descriptions','replace','duration_hours','duration_minutes','parent_id','Contacts','direction','length','forEach','variableName','JSON','stringify','Calls','format','Basic\x20%s','toString','get_server_info','isNil','Getting\x20agent\x20with\x20name','get_entry_list','Employees','INSTR\x20(\x20users.user_name,\x20\x22%s\x22)\x20>\x200','user_name','then','entry_list','name_value_list','Agent\x20found!','resolve','value','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','user_id','Agent\x20not\x20available,\x20using\x20the\x20admin\x20account!','Searching\x20enduser\x20with\x20phone','phone_home','find','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','set_entry','','Caller\x20-\x20%s','Enduser\x20created.','first_name','debug','merge','map','type','nameField','customField','content','string','idField','custom_fields','push','variable','Variable','toLowerCase','login','username','password','xCALLY\x20Motion\x20integration','set_relationship','queue','remoteUri','stripTrailingSlash','serverUrl','uri','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','The\x20User\x20ID\x20is:','The\x20Enduser\x20ID\x20is:','Fields','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','users','version','charAt','%s/index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DCalls%26action%3DEditView%26record%3D%s','%s/#bwc/index.php?module=Calls&action=EditView&record=%s','user:%s','trigger:browser:url','error','%s/service/v4_1/rest.php','recordingFormat','none','[OUTBOUND]','destcalleridname','catch','unmanaged','lastevent','toUpperCase','calleridname','calleridnum','Inbound','contacts','request-promise','bluebird','md5','../../../../config/logger','sugarcrm'];(function(_0x467cb0,_0x303070){var _0x2153f7=function(_0x51775a){while(--_0x51775a){_0x467cb0['push'](_0x467cb0['shift']());}};_0x2153f7(++_0x303070);}(_0x44ff,0x1c3));var _0xf44f=function(_0x23c02b,_0x411b4d){_0x23c02b=_0x23c02b-0x0;var _0x25efc5=_0x44ff[_0x23c02b];return _0x25efc5;};'use strict';var _=require('lodash');var rp=require(_0xf44f('0x0'));var BPromise=require(_0xf44f('0x1'));var md5=require(_0xf44f('0x2'));var util=require('util');var Redis=require('ioredis');var intUtil=require('./util');var config=require('../../../../config/environment');var logger=require(_0xf44f('0x3'))(_0xf44f('0x4'));config['redis']=_['defaults'](config[_0xf44f('0x5')],{'host':_0xf44f('0x6'),'port':0x18eb});var io=require(_0xf44f('0x7'))(new Redis(config['redis']));var def={'method':_0xf44f('0x8'),'json':!![]};function emit(_0x2dae46,_0x1a1b8a,_0x4cce53){io['to'](_0x2dae46)[_0xf44f('0x9')](_0x1a1b8a,_0x4cce53);}function getTicket(_0x1f12d7,_0x1db73f,_0x1c132f,_0x278017,_0x21fb0e,_0x22531e,_0x2fdf76,_0x1acdc4){logger[_0xf44f('0xa')]('Creating\x20new\x20ticket...');var _0x349f3b=new Date();var _0x1c5c57=[{'name':_0xf44f('0xb'),'value':intUtil[_0xf44f('0xc')](_0x278017[_0xf44f('0xd')],_0x21fb0e,'\x20')},{'name':_0xf44f('0xe'),'value':_0x1db73f['id']},{'name':_0xf44f('0xf'),'value':_0x1db73f['id']},{'name':'description','value':intUtil['getString'](_0x278017[_0xf44f('0x10')],_0x21fb0e,'\x0a')},{'name':'date_start','value':_0x349f3b['toISOString']()['slice'](0x0,0x13)[_0xf44f('0x11')]('T','\x20')},{'name':_0xf44f('0x12'),'value':'0'},{'name':_0xf44f('0x13'),'value':'15'},{'name':_0xf44f('0x14'),'value':_0x1c132f['id']},{'name':'parent_type','value':_0xf44f('0x15')},{'name':'parent_name','value':_0x1c132f[_0xf44f('0xb')]},{'name':_0xf44f('0x16'),'value':_0x1acdc4}];if(_0x22531e[_0xf44f('0x17')]){_[_0xf44f('0x18')](_0x22531e,function(_0x542786){if(_0x21fb0e[_0x542786['variableName']]){_0x1c5c57['push']({'name':_0x542786['idField'],'value':_0x21fb0e[_0x542786[_0xf44f('0x19')]]});}});}return request({'form':{'method':'set_entry','input_type':'JSON','response_type':_0xf44f('0x1a'),'rest_data':JSON[_0xf44f('0x1b')]({'session':_0x2fdf76['id'],'module_name':_0xf44f('0x1c'),'name_value_list':_0x1c5c57})}});}function getAuth(_0x515ea6){return util[_0xf44f('0x1d')](_0xf44f('0x1e'),new Buffer(_0x515ea6['apiKey']+':X')[_0xf44f('0x1f')]('base64'));}function getServerInfo(_0x1cc24e){return request({'form':{'method':_0xf44f('0x20'),'input_type':_0xf44f('0x1a'),'response_type':'JSON','rest_data':JSON[_0xf44f('0x1b')]({'session':_0x1cc24e['id']})}});}function getUser(_0x1b9dc9,_0x329ed3,_0x58d4af){if(!_[_0xf44f('0x21')](_0x329ed3)){logger[_0xf44f('0xa')](_0xf44f('0x22'),_0x329ed3);return request({'form':{'method':_0xf44f('0x23'),'input_type':_0xf44f('0x1a'),'response_type':'JSON','rest_data':JSON[_0xf44f('0x1b')]({'session':_0x58d4af['id'],'module_name':_0xf44f('0x24'),'query':util[_0xf44f('0x1d')](_0xf44f('0x25'),_0x329ed3),'order_by':'','offset':'0','select_fields':['id','name',_0xf44f('0x26')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0xf44f('0x27')](function(_0x36e7a9){if(_0x36e7a9[_0xf44f('0x28')][_0xf44f('0x17')]){var _0x21bcc2=_['find'](_0x36e7a9[_0xf44f('0x28')],function(_0x5255eb){return _0x5255eb[_0xf44f('0x29')][_0xf44f('0x26')]['value']===_0x329ed3;});if(_0x21bcc2){logger['info'](_0xf44f('0x2a'));return BPromise[_0xf44f('0x2b')]({'id':_0x21bcc2[_0xf44f('0x29')]['id'][_0xf44f('0x2c')],'name':_0x21bcc2['name_value_list'][_0xf44f('0xb')][_0xf44f('0x2c')]});}}logger['info'](_0xf44f('0x2d'));return BPromise[_0xf44f('0x2b')]({'id':_0x58d4af[_0xf44f('0x29')][_0xf44f('0x2e')][_0xf44f('0x2c')],'name':_0x58d4af[_0xf44f('0x29')][_0xf44f('0x26')][_0xf44f('0x2c')]});});}else{logger[_0xf44f('0xa')](_0xf44f('0x2f'));return BPromise['resolve']({'id':_0x58d4af[_0xf44f('0x29')][_0xf44f('0x2e')]['value'],'name':_0x58d4af[_0xf44f('0x29')][_0xf44f('0x26')][_0xf44f('0x2c')]});}}function getEndUser(_0x15beb7,_0x2cf878,_0x583fa2,_0x1678ed){logger[_0xf44f('0xa')](_0xf44f('0x30'),_0x583fa2);return request({'form':{'method':_0xf44f('0x23'),'input_type':_0xf44f('0x1a'),'response_type':_0xf44f('0x1a'),'rest_data':JSON[_0xf44f('0x1b')]({'session':_0x1678ed['id'],'module_name':_0xf44f('0x15'),'query':util[_0xf44f('0x1d')]('contacts.phone_home\x20=\x20\x22%s\x22',_0x583fa2),'order_by':'','offset':'0','select_fields':['id',_0xf44f('0xb'),_0xf44f('0x31')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0xf44f('0x27')](function(_0x3abb6e){if(_0x3abb6e[_0xf44f('0x28')][_0xf44f('0x17')]){var _0x2936f4=_[_0xf44f('0x32')](_0x3abb6e[_0xf44f('0x28')],function(_0x4e1bfe){return _0x4e1bfe[_0xf44f('0x29')][_0xf44f('0x31')][_0xf44f('0x2c')]===_0x583fa2;});if(_0x2936f4){logger[_0xf44f('0xa')](_0xf44f('0x33'));return BPromise[_0xf44f('0x2b')]({'id':_0x2936f4[_0xf44f('0x29')]['id'][_0xf44f('0x2c')],'name':_0x2936f4[_0xf44f('0x29')][_0xf44f('0xb')][_0xf44f('0x2c')],'phone':_0x2936f4[_0xf44f('0x29')][_0xf44f('0x31')]['value']});}}else{logger[_0xf44f('0xa')](_0xf44f('0x34'));return request({'form':{'method':_0xf44f('0x35'),'input_type':_0xf44f('0x1a'),'response_type':'JSON','rest_data':JSON[_0xf44f('0x1b')]({'session':_0x1678ed['id'],'module_name':'Contacts','name_value_list':[{'name':'first_name','value':_0x2cf878!==_0xf44f('0x36')?_0x2cf878:util[_0xf44f('0x1d')](_0xf44f('0x37'),_0x583fa2)},{'name':_0xf44f('0x31'),'value':_0x583fa2}]})}})[_0xf44f('0x27')](function(_0x5f390d){logger[_0xf44f('0xa')](_0xf44f('0x38'));return BPromise['resolve']({'id':_0x5f390d['id'],'name':_0x5f390d[_0xf44f('0x28')][_0xf44f('0x39')][_0xf44f('0x2c')],'phone':_0x5f390d['entry_list'][_0xf44f('0x31')]['value']});});}});}function request(_0x28717a){logger[_0xf44f('0x3a')]('[HTTP]',JSON[_0xf44f('0x1b')](_0x28717a));return rp(_[_0xf44f('0x3b')](def,_0x28717a));}function getTags(_0x39b23d,_0x9f0204){var _0x37330c=[];if(_0x39b23d&&_0x39b23d[_0xf44f('0x17')]>0x0){_0x37330c=_[_0xf44f('0x3c')](_0x39b23d,_0x9f0204);}return _0x37330c;}function getCustomFields(_0x464638,_0x5c4933){var _0x142dd9=[];var _0x3d9acc={'custom_fields':[]};if(_0x464638[_0xf44f('0x17')]>0x0){_[_0xf44f('0x18')](_0x464638,function(_0x3c52e7){if(_0x3c52e7[_0xf44f('0x3d')]==='string'&&_0x3c52e7[_0xf44f('0x3e')]&&!_0x3c52e7[_0xf44f('0x3f')]){_0x3d9acc[_0x3c52e7[_0xf44f('0x3e')]['toLowerCase']()]=_0x3c52e7[_0xf44f('0x40')]['toString']();}else if(_0x3c52e7[_0xf44f('0x3d')]===_0xf44f('0x41')&&_0x3c52e7[_0xf44f('0x42')]&&_0x3c52e7['customField']){_0x3d9acc[_0xf44f('0x43')][_0xf44f('0x44')]({'id':_0x3c52e7[_0xf44f('0x42')],'value':_0x3c52e7['content']['toString']()});}else if(_0x3c52e7[_0xf44f('0x3d')]===_0xf44f('0x45')&&_0x3c52e7[_0xf44f('0x19')]&&_0x3c52e7[_0xf44f('0x42')]&&_0x3c52e7[_0xf44f('0x3f')]){_0x5c4933[_0x3c52e7[_0xf44f('0x19')]]&&_0x3d9acc[_0xf44f('0x43')]['push']({'id':_0x3c52e7[_0xf44f('0x42')],'value':_0x5c4933[_0x3c52e7[_0xf44f('0x19')]]['toString']()});}else if(_0x3c52e7['type']==='customVariable'&&_0x3c52e7[_0xf44f('0x46')]&&_0x3c52e7[_0xf44f('0x46')][_0xf44f('0xb')]&&_0x3c52e7['idField']&&_0x3c52e7['customField']){_0x5c4933[_0x3c52e7[_0xf44f('0x46')][_0xf44f('0xb')][_0xf44f('0x47')]()]&&_0x3d9acc[_0xf44f('0x43')][_0xf44f('0x44')]({'id':_0x3c52e7['idField'],'value':_0x5c4933[_0x3c52e7[_0xf44f('0x46')][_0xf44f('0xb')]['toLowerCase']()][_0xf44f('0x1f')]()});}});}return _0x3d9acc;}function getConnection(_0x5105b4){return request({'method':_0xf44f('0x8'),'form':{'method':_0xf44f('0x48'),'input_type':_0xf44f('0x1a'),'response_type':_0xf44f('0x1a'),'rest_data':JSON[_0xf44f('0x1b')]({'user_auth':{'user_name':_0x5105b4[_0xf44f('0x49')],'password':_0x5105b4[_0xf44f('0x4a')],'encryption':'PLAIN'},'application':_0xf44f('0x4b')})}})[_0xf44f('0x27')](function(_0x3b2210){var _0x3eefc8=_0x3b2210;if(_0x3eefc8['id']){def['sessionID']=_0x3eefc8['id'];return BPromise['resolve'](_0x3eefc8);}else{throw new Error(util['format']('Account\x20%d\x20is\x20not\x20valid',_0x5105b4['id']));}});}function setRelationship(_0x1604ac,_0x427ffc,_0x41f47a,_0x4bfaa5){return request({'form':{'method':_0xf44f('0x4c'),'input_type':_0xf44f('0x1a'),'response_type':'JSON','rest_data':JSON[_0xf44f('0x1b')]({'session':_0x1604ac['id'],'module_name':'Calls','module_id':_0x41f47a['id'],'link_field_name':_0x4bfaa5,'related_ids':[_0x427ffc['id']]})}});}exports[_0xf44f('0x4d')]=function(_0x3c330,_0xf4501f,_0x432fdc,_0x177098,_0x333926,_0xfb6d00){var _0xb89065,_0x3fdaac,_0x3d3f07,_0x46e3cf;_0xfb6d00[_0xf44f('0x4e')]=intUtil['stripTrailingSlash'](_0xfb6d00[_0xf44f('0x4e')]);_0xfb6d00['serverUrl']=intUtil[_0xf44f('0x4f')](_0xfb6d00[_0xf44f('0x50')]);def[_0xf44f('0x51')]=util['format']('%s/service/v4_1/rest.php',_0xfb6d00[_0xf44f('0x4e')]);if(_0x333926&&_0x333926[_0xf44f('0x52')]){logger[_0xf44f('0xa')](_0xf44f('0x53'),_0xf44f('0x54'));_0xf4501f[_0xf44f('0x55')]=util[_0xf44f('0x1d')](_0xf44f('0x56'),_0xfb6d00['serverUrl'],_0xf4501f[_0xf44f('0x57')],md5(_0xf4501f[_0xf44f('0x57')]));}else{_0xf4501f[_0xf44f('0x55')]='';}return getConnection(_0xfb6d00)['then'](function(_0x46197d){_0x46e3cf=_0x46197d;return getUser(_0xfb6d00,_0x177098['name'],_0x46e3cf);})[_0xf44f('0x27')](function(_0x21ae08){_0xb89065=_0x21ae08;logger[_0xf44f('0xa')](_0xf44f('0x58'),_0xb89065['id']);return getEndUser(_0xfb6d00,_0xf4501f['calleridname'],_0xf4501f['calleridnum'],_0x46e3cf);})['then'](function(_0x528f69){_0x3fdaac=_0x528f69;logger[_0xf44f('0xa')](_0xf44f('0x59'),_0x3fdaac['id']);return getTicket(_0xfb6d00,_0xb89065,_0x3fdaac,_0x432fdc,_0xf4501f,_0x432fdc[_0xf44f('0x5a')],_0x46e3cf,'Inbound');})[_0xf44f('0x27')](function(_0x43aa52){_0x3d3f07=_0x43aa52;logger[_0xf44f('0xa')](_0xf44f('0x5b'));logger[_0xf44f('0xa')](_0xf44f('0x5c'),_0x3d3f07['id']);return setRelationship(_0x46e3cf,_0xb89065,_0x3d3f07,_0xf44f('0x5d'));})['then'](function(){return setRelationship(_0x46e3cf,_0x3fdaac,_0x3d3f07,'contacts');})[_0xf44f('0x27')](function(){return getServerInfo(_0x46e3cf);})['then'](function(_0xba93ef){var _0x12cbdd=parseInt(_0xba93ef[_0xf44f('0x5e')][_0xf44f('0x5f')](0x0));var _0x54bcf1=util[_0xf44f('0x1d')](_0xf44f('0x60'),_0xfb6d00['remoteUri'],_0x3d3f07['id']);if(_0x12cbdd>0x6){_0x54bcf1=util['format'](_0xf44f('0x61'),_0xfb6d00[_0xf44f('0x4e')],_0x3d3f07['id']);}logger[_0xf44f('0xa')]('[QUEUE]','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0xf44f('0x1d')](_0xf44f('0x62'),_0x177098[_0xf44f('0xb')]),_0xf44f('0x63'),{'uri':_0x54bcf1});})['catch'](function(_0x2bfed6){logger[_0xf44f('0x64')](_0xf44f('0x53'),JSON['stringify'](_0x2bfed6));});};exports['outbound']=function(_0x3bc453,_0x9dfe6,_0x3b6845,_0x24c0b8,_0x241ff1,_0x2719f8,_0x1ad1ec){var _0xe6f6db,_0xef1dc6,_0x937357,_0xa2935b;_0x2719f8[_0xf44f('0x4e')]=intUtil[_0xf44f('0x4f')](_0x2719f8[_0xf44f('0x4e')]);_0x2719f8[_0xf44f('0x50')]=intUtil['stripTrailingSlash'](_0x2719f8['serverUrl']);def[_0xf44f('0x51')]=util[_0xf44f('0x1d')](_0xf44f('0x65'),_0x2719f8[_0xf44f('0x4e')]);if(_0x1ad1ec&&_0x1ad1ec[_0xf44f('0x66')]&&_0x1ad1ec['recordingFormat']!==_0xf44f('0x67')){logger[_0xf44f('0xa')](_0xf44f('0x68'),'Recording\x20is\x20enabled!');_0x9dfe6['recordingURL']=util[_0xf44f('0x1d')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x2719f8['serverUrl'],_0x9dfe6['uniqueid'],md5(_0x9dfe6[_0xf44f('0x57')]));}return getConnection(_0x2719f8)['then'](function(_0x1f6212){_0xa2935b=_0x1f6212;return getUser(_0x2719f8,_0x24c0b8[_0xf44f('0xb')],_0xa2935b);})[_0xf44f('0x27')](function(_0x515c7a){_0xe6f6db=_0x515c7a;logger[_0xf44f('0xa')](_0xf44f('0x58'),_0xe6f6db['id']);return getEndUser(_0x2719f8,_0x9dfe6[_0xf44f('0x69')],_0x9dfe6['destcalleridnum'],_0xa2935b);})[_0xf44f('0x27')](function(_0x325e11){_0xef1dc6=_0x325e11;logger[_0xf44f('0xa')](_0xf44f('0x59'),_0xef1dc6['id']);return getTicket(_0x2719f8,_0xe6f6db,_0xef1dc6,_0x3b6845,_0x9dfe6,_0x3b6845[_0xf44f('0x5a')],_0xa2935b,'Outbound');})['then'](function(_0x950219){_0x937357=_0x950219;logger['info'](_0xf44f('0x5b'));logger[_0xf44f('0xa')](_0xf44f('0x5c'),_0x937357['id']);return setRelationship(_0xa2935b,_0xe6f6db,_0x937357,_0xf44f('0x5d'));})['then'](function(){return setRelationship(_0xa2935b,_0xef1dc6,_0x937357,'contacts');})[_0xf44f('0x27')](function(){return getServerInfo(_0xa2935b);})[_0xf44f('0x27')](function(_0x1a4c08){var _0x1e70fe=parseInt(_0x1a4c08[_0xf44f('0x5e')][_0xf44f('0x5f')](0x0));var _0x43779e=util[_0xf44f('0x1d')]('%s/index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DCalls%26action%3DEditView%26record%3D%s',_0x2719f8['remoteUri'],_0x937357['id']);if(_0x1e70fe>0x6){_0x43779e=util[_0xf44f('0x1d')](_0xf44f('0x61'),_0x2719f8[_0xf44f('0x4e')],_0x937357['id']);}logger[_0xf44f('0xa')](_0xf44f('0x68'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util['format'](_0xf44f('0x62'),_0x24c0b8['name']),_0xf44f('0x63'),{'uri':_0x43779e});})[_0xf44f('0x6a')](function(_0x26e2aa){logger[_0xf44f('0x64')]('[OUTBOUND]',JSON[_0xf44f('0x1b')](_0x26e2aa));});};exports[_0xf44f('0x6b')]=function(_0x379c63,_0x314545,_0x5efe7e,_0x1a094,_0x541e08,_0x8cfb82){var _0x5d72b2,_0x1c1419,_0x2de672,_0x345d8a;_0x8cfb82['remoteUri']=intUtil[_0xf44f('0x4f')](_0x8cfb82[_0xf44f('0x4e')]);_0x8cfb82['serverUrl']=intUtil[_0xf44f('0x4f')](_0x8cfb82[_0xf44f('0x50')]);def['uri']=util[_0xf44f('0x1d')](_0xf44f('0x65'),_0x8cfb82[_0xf44f('0x4e')]);if(_0x541e08&&_0x541e08[_0xf44f('0x52')]){logger[_0xf44f('0xa')]('['+_0x314545[_0xf44f('0x6c')][_0xf44f('0x6d')]()+']',_0xf44f('0x54'));_0x314545['recordingURL']=util[_0xf44f('0x1d')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x8cfb82[_0xf44f('0x50')],_0x314545[_0xf44f('0x57')],md5(_0x314545[_0xf44f('0x57')]));}else{_0x314545[_0xf44f('0x55')]='';}return getConnection(_0x8cfb82)['then'](function(_0x3b2485){_0x345d8a=_0x3b2485;if(!_['isNil'](_0x1a094)){return getUser(_0x8cfb82,_0x1a094[_0xf44f('0xb')],_0x345d8a);}else{return getUser(_0x8cfb82,null,_0x345d8a);}})[_0xf44f('0x27')](function(_0x5b96a3){_0x5d72b2=_0x5b96a3;logger[_0xf44f('0xa')](_0xf44f('0x58'),_0x5d72b2['id']);return getEndUser(_0x8cfb82,_0x314545[_0xf44f('0x6e')],_0x314545[_0xf44f('0x6f')],_0x345d8a);})[_0xf44f('0x27')](function(_0x213e73){_0x1c1419=_0x213e73;logger[_0xf44f('0xa')]('The\x20Enduser\x20ID\x20is:',_0x1c1419['id']);return getTicket(_0x8cfb82,_0x5d72b2,_0x1c1419,_0x5efe7e,_0x314545,_0x5efe7e[_0xf44f('0x5a')],_0x345d8a,_0xf44f('0x70'));})['then'](function(_0x49d6f8){_0x2de672=_0x49d6f8;logger[_0xf44f('0xa')](_0xf44f('0x5b'));logger[_0xf44f('0xa')](_0xf44f('0x5c'),_0x2de672['id']);return setRelationship(_0x345d8a,_0x5d72b2,_0x2de672,_0xf44f('0x5d'));})[_0xf44f('0x27')](function(){return setRelationship(_0x345d8a,_0x1c1419,_0x2de672,_0xf44f('0x71'));})[_0xf44f('0x27')](function(){return getServerInfo(_0x345d8a);})[_0xf44f('0x6a')](function(_0x2192ae){logger['error']('['+_0x314545[_0xf44f('0x6c')][_0xf44f('0x6d')]()+']',JSON[_0xf44f('0x1b')](_0x2192ae));});}; \ 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 4666a5c..0f8acb9 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 _0x49d8=['keyType','key','%s:\x20%s','keyContent','format','customVariable','join','stripTrailingSlash','slice','substring','lastIndexOf','validateEmail','isNil','util','getString','length','string','content','type','variable','variableName','push','name','Variable','toLowerCase'];(function(_0x10dc60,_0x2fcce1){var _0x47dec5=function(_0x24b5e4){while(--_0x24b5e4){_0x10dc60['push'](_0x10dc60['shift']());}};_0x47dec5(++_0x2fcce1);}(_0x49d8,0x120));var _0x849d=function(_0x556c5a,_0x5d88d7){_0x556c5a=_0x556c5a-0x0;var _0x4bc0a1=_0x49d8[_0x556c5a];return _0x4bc0a1;};'use strict';var _=require('lodash');var util=require(_0x849d('0x0'));exports[_0x849d('0x1')]=function(_0x3e1eae,_0xc6e2a,_0x152cb5){var _0x229498=[];if(_0x3e1eae['length']>0x0){var _0x521119=_['sortBy'](_0x3e1eae,['id']);for(var _0x4d3ae3=0x0;_0x4d3ae3<_0x521119[_0x849d('0x2')];_0x4d3ae3++){var _0x804873=_0x521119[_0x4d3ae3];if(_0x804873['type']===_0x849d('0x3')){_0x229498['push'](_0x804873[_0x849d('0x4')]);}else if(_0x804873[_0x849d('0x5')]===_0x849d('0x6')&&_0x804873[_0x849d('0x7')]){_0xc6e2a[_0x804873[_0x849d('0x7')]]&&_0x229498[_0x849d('0x8')](_0xc6e2a[_0x804873[_0x849d('0x7')]]['toString']());}else if(_0x804873[_0x849d('0x5')]==='customVariable'&&_0x804873['Variable']&&_0x804873['Variable'][_0x849d('0x9')]){_0xc6e2a[_0x804873[_0x849d('0xa')]['name'][_0x849d('0xb')]()]&&_0x229498[_0x849d('0x8')](_0xc6e2a[_0x804873[_0x849d('0xa')][_0x849d('0x9')][_0x849d('0xb')]()]['toString']());}else if(_0x804873[_0x849d('0x5')]==='keyValue'){if(_0x804873[_0x849d('0xc')]==='string'&&_0x804873[_0x849d('0xd')]){_0x229498['push'](util['format'](_0x849d('0xe'),_0x804873[_0x849d('0xd')],_0x804873[_0x849d('0xf')]));}else if(_0x804873[_0x849d('0xc')]===_0x849d('0x6')&&_0x804873[_0x849d('0x7')]&&_0x804873[_0x849d('0xd')]){_0xc6e2a[_0x804873[_0x849d('0x7')]]&&_0x229498[_0x849d('0x8')](util[_0x849d('0x10')](_0x849d('0xe'),_0x804873[_0x849d('0xd')],_0xc6e2a[_0x804873['variableName']]));}else if(_0x804873[_0x849d('0xc')]===_0x849d('0x11')&&_0x804873[_0x849d('0xa')]&&_0x804873['Variable'][_0x849d('0x9')]&&_0x804873[_0x849d('0xd')]){_0xc6e2a[_0x804873[_0x849d('0xa')][_0x849d('0x9')]['toLowerCase']()]&&_0x229498[_0x849d('0x8')](util['format']('%s:\x20%s',_0x804873[_0x849d('0xd')],_0xc6e2a[_0x804873[_0x849d('0xa')][_0x849d('0x9')]['toLowerCase']()]));}}}}return _0x229498[_0x849d('0x12')](_0x152cb5);};exports[_0x849d('0x13')]=function(_0x347ae3){var _0x5ae0d0=_0x347ae3[_0x849d('0x14')](-0x1);if(_0x5ae0d0==='/'){_0x347ae3=_0x347ae3[_0x849d('0x15')](0x0,_0x347ae3[_0x849d('0x16')](_0x5ae0d0));}return _0x347ae3;};exports[_0x849d('0x17')]=function(_0x4fed38){if(!_[_0x849d('0x18')](_0x4fed38)&&_0x4fed38!==''){var _0x57babe=/^(([^<>()\[\]\\.,;:\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 _0x57babe['test'](String(_0x4fed38)[_0x849d('0xb')]());}else{return![];}}; \ No newline at end of file +var _0x6991=['slice','substring','lastIndexOf','validateEmail','isNil','lodash','util','getString','length','sortBy','type','string','push','content','variableName','toString','Variable','name','keyValue','keyType','format','%s:\x20%s','keyContent','variable','key','customVariable','toLowerCase','join','stripTrailingSlash'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x6991,0xed));var _0x1699=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0x6991[_0x17d9e3];return _0x14192d;};'use strict';var _=require(_0x1699('0x0'));var util=require(_0x1699('0x1'));exports[_0x1699('0x2')]=function(_0x44ddfd,_0x2e3624,_0x2526e7){var _0x465fcf=[];if(_0x44ddfd[_0x1699('0x3')]>0x0){var _0x4fd71b=_[_0x1699('0x4')](_0x44ddfd,['id']);for(var _0x4754f7=0x0;_0x4754f7<_0x4fd71b[_0x1699('0x3')];_0x4754f7++){var _0x5229d9=_0x4fd71b[_0x4754f7];if(_0x5229d9[_0x1699('0x5')]===_0x1699('0x6')){_0x465fcf[_0x1699('0x7')](_0x5229d9[_0x1699('0x8')]);}else if(_0x5229d9[_0x1699('0x5')]==='variable'&&_0x5229d9[_0x1699('0x9')]){_0x2e3624[_0x5229d9[_0x1699('0x9')]]&&_0x465fcf[_0x1699('0x7')](_0x2e3624[_0x5229d9[_0x1699('0x9')]][_0x1699('0xa')]());}else if(_0x5229d9[_0x1699('0x5')]==='customVariable'&&_0x5229d9['Variable']&&_0x5229d9[_0x1699('0xb')][_0x1699('0xc')]){_0x2e3624[_0x5229d9[_0x1699('0xb')]['name']['toLowerCase']()]&&_0x465fcf[_0x1699('0x7')](_0x2e3624[_0x5229d9[_0x1699('0xb')]['name']['toLowerCase']()][_0x1699('0xa')]());}else if(_0x5229d9[_0x1699('0x5')]===_0x1699('0xd')){if(_0x5229d9[_0x1699('0xe')]===_0x1699('0x6')&&_0x5229d9['key']){_0x465fcf[_0x1699('0x7')](util[_0x1699('0xf')](_0x1699('0x10'),_0x5229d9['key'],_0x5229d9[_0x1699('0x11')]));}else if(_0x5229d9['keyType']===_0x1699('0x12')&&_0x5229d9['variableName']&&_0x5229d9[_0x1699('0x13')]){_0x2e3624[_0x5229d9[_0x1699('0x9')]]&&_0x465fcf['push'](util[_0x1699('0xf')](_0x1699('0x10'),_0x5229d9[_0x1699('0x13')],_0x2e3624[_0x5229d9[_0x1699('0x9')]]));}else if(_0x5229d9['keyType']===_0x1699('0x14')&&_0x5229d9['Variable']&&_0x5229d9[_0x1699('0xb')][_0x1699('0xc')]&&_0x5229d9[_0x1699('0x13')]){_0x2e3624[_0x5229d9[_0x1699('0xb')][_0x1699('0xc')][_0x1699('0x15')]()]&&_0x465fcf[_0x1699('0x7')](util[_0x1699('0xf')](_0x1699('0x10'),_0x5229d9[_0x1699('0x13')],_0x2e3624[_0x5229d9['Variable'][_0x1699('0xc')][_0x1699('0x15')]()]));}}}}return _0x465fcf[_0x1699('0x16')](_0x2526e7);};exports[_0x1699('0x17')]=function(_0x3a8490){var _0x284d3b=_0x3a8490[_0x1699('0x18')](-0x1);if(_0x284d3b==='/'){_0x3a8490=_0x3a8490[_0x1699('0x19')](0x0,_0x3a8490[_0x1699('0x1a')](_0x284d3b));}return _0x3a8490;};exports[_0x1699('0x1b')]=function(_0x1d831a){if(!_[_0x1699('0x1c')](_0x1d831a)&&_0x1d831a!==''){var _0x1f04d1=/^(([^<>()\[\]\\.,;:\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 _0x1f04d1['test'](String(_0x1d831a)['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 888bfa0..af60288 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 _0xd6e6=['idField','content','toString','variable','variableName','customVariable','Variable','name','toLowerCase','info','Creating\x20new\x20ticket...','merge','Open','Subjects','getString','Descriptions','format','%s/webservice.php','remoteUri','create','sessionName','stringify','then','success','resolve','error','catch','statusCode','[vTiger],\x20%s,\x20%s,\x20%s','createTicket','validateEmail','Getting\x20agent\x20with\x20email','GET','query','username','SELECT\x20first_name,\x20last_name,\x20email1\x20FROM\x20Users\x20WHERE\x20email1=\x27%s\x27;','result','email1','first_name','last_name','userId','getUser','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','Enduser\x20found!','firstname','lastname','Enduser\x20created.','phone','accessKey','getchallenge','POST','token','Account\x20%d\x20is\x20not\x20valid','getConnection','[HTTP]','queue','stripTrailingSlash','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','recordingURL','email','The\x20User\x20ID\x20is:','calleridname','calleridnum','The\x20Enduser\x20ID\x20is:','The\x20Ticket\x20ID\x20is:','%s/index.php?module=HelpDesk&view=Detail&record=%s&app=SUPPORT','split','user:%s','trigger:browser:url','outbound','serverUrl','recordingFormat','none','[OUTBOUND]','destcalleridname','Ticket\x20created!','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','lastevent','toUpperCase','Fields','lodash','request-promise','bluebird','md5','util','ioredis','./util','../../../../config/environment','defaults','redis','localhost','socket.io-emitter','length','forEach','type','string'];(function(_0x444223,_0x2636cd){var _0x5110cb=function(_0x44295d){while(--_0x44295d){_0x444223['push'](_0x444223['shift']());}};_0x5110cb(++_0x2636cd);}(_0xd6e6,0x11c));var _0x6d6e=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd6e6[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x6d6e('0x0'));var rp=require(_0x6d6e('0x1'));var BPromise=require(_0x6d6e('0x2'));var md5=require(_0x6d6e('0x3'));var util=require(_0x6d6e('0x4'));var Redis=require(_0x6d6e('0x5'));var intUtil=require(_0x6d6e('0x6'));var config=require(_0x6d6e('0x7'));var logger=require('../../../../config/logger')('vTiger');config['redis']=_[_0x6d6e('0x8')](config[_0x6d6e('0x9')],{'host':_0x6d6e('0xa'),'port':0x18eb});var io=require(_0x6d6e('0xb'))(new Redis(config[_0x6d6e('0x9')]));function emit(_0x3aa4a2,_0x191446,_0x43b3c8){io['to'](_0x3aa4a2)['emit'](_0x191446,_0x43b3c8);}function getCustomFields(_0x127627,_0xdf3b4f){var _0x27a5f4={};if(_0x127627[_0x6d6e('0xc')]>0x0){_[_0x6d6e('0xd')](_0x127627,function(_0xad1997){if(_0xad1997[_0x6d6e('0xe')]===_0x6d6e('0xf')&&_0xad1997[_0x6d6e('0x10')]){_0x27a5f4[_0xad1997[_0x6d6e('0x10')]]=_0xad1997[_0x6d6e('0x11')][_0x6d6e('0x12')]();}else if(_0xad1997['type']===_0x6d6e('0x13')&&_0xad1997[_0x6d6e('0x14')]&&_0xad1997[_0x6d6e('0x10')]&&_0xdf3b4f[_0xad1997['variableName']]){_0x27a5f4[_0xad1997[_0x6d6e('0x10')]]=_0xdf3b4f[_0xad1997['variableName']][_0x6d6e('0x12')]();}else if(_0xad1997[_0x6d6e('0xe')]===_0x6d6e('0x15')&&_0xad1997[_0x6d6e('0x16')]&&_0xad1997[_0x6d6e('0x16')][_0x6d6e('0x17')]&&_0xad1997[_0x6d6e('0x10')]&&_0xdf3b4f[_0xad1997[_0x6d6e('0x16')][_0x6d6e('0x17')][_0x6d6e('0x18')]()]){_0x27a5f4[_0xad1997[_0x6d6e('0x10')]]=_0xdf3b4f[_0xad1997[_0x6d6e('0x16')]['name'][_0x6d6e('0x18')]()][_0x6d6e('0x12')]();}});}return _0x27a5f4;}function createTicket(_0x2d9cfd,_0x538a25,_0x30e777,_0x41cf8e,_0x51766d,_0x122b72,_0x39b08c){logger[_0x6d6e('0x19')](_0x6d6e('0x1a'));var _0x26af73=_[_0x6d6e('0x1b')]({'parent_id':'','assigned_user_id':_0x538a25['id'],'ticketpriorities':'Normal','ticketstatus':_0x6d6e('0x1c'),'ticket_title':intUtil['getString'](_0x41cf8e[_0x6d6e('0x1d')],_0x51766d,'\x20'),'description':intUtil[_0x6d6e('0x1e')](_0x41cf8e[_0x6d6e('0x1f')],_0x51766d,'\x0a'),'contact_id':_0x30e777['id']},getCustomFields(_0x122b72,_0x51766d));var _0x3cc0ee={'method':'POST','uri':util[_0x6d6e('0x20')](_0x6d6e('0x21'),_0x2d9cfd[_0x6d6e('0x22')]),'form':{'operation':_0x6d6e('0x23'),'username':_0x2d9cfd['username'],'sessionName':_0x39b08c[_0x6d6e('0x24')],'elementType':'HelpDesk','element':JSON[_0x6d6e('0x25')](_0x26af73)},'json':!![]};return request(_0x3cc0ee)[_0x6d6e('0x26')](function(_0x17324c){if(_0x17324c[_0x6d6e('0x27')]){return BPromise[_0x6d6e('0x28')]({'id':_0x17324c['result']['id']});}else{throw new Error(util['format']('Ticket\x20could\x20not\x20be\x20created\x20due\x20to:\x20%s',JSON[_0x6d6e('0x25')](_0x17324c[_0x6d6e('0x29')])));}})[_0x6d6e('0x2a')](function(_0x3788dc){var _0x3607c3=_0x3788dc[_0x6d6e('0x2b')]||0x1f4;logger['error'](_0x6d6e('0x2c'),_0x6d6e('0x2d'),_0x3607c3,JSON[_0x6d6e('0x25')](_0x3788dc));});}function getUser(_0x1fdfc0,_0x5ac76c,_0x1527e4){if(intUtil[_0x6d6e('0x2e')](_0x5ac76c)){logger[_0x6d6e('0x19')](_0x6d6e('0x2f'),_0x5ac76c);return request({'method':_0x6d6e('0x30'),'uri':util[_0x6d6e('0x20')](_0x6d6e('0x21'),_0x1fdfc0[_0x6d6e('0x22')]),'qs':{'operation':_0x6d6e('0x31'),'username':_0x1fdfc0[_0x6d6e('0x32')],'sessionName':_0x1527e4['sessionName'],'query':util[_0x6d6e('0x20')](_0x6d6e('0x33'),_0x5ac76c)},'json':!![]})[_0x6d6e('0x26')](function(_0x26dc12){if(_0x26dc12['success']&&_0x26dc12['result']['length']){logger[_0x6d6e('0x19')]('Agent\x20found!');return BPromise[_0x6d6e('0x28')]({'id':_0x26dc12[_0x6d6e('0x34')][0x0]['id'],'email':_0x26dc12[_0x6d6e('0x34')][0x0][_0x6d6e('0x35')],'name':_0x26dc12[_0x6d6e('0x34')][0x0][_0x6d6e('0x36')]+'\x20'+_0x26dc12[_0x6d6e('0x34')][_0x6d6e('0x37')]});}else{logger[_0x6d6e('0x19')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return BPromise['resolve']({'id':_0x1527e4[_0x6d6e('0x38')],'email':_0x1fdfc0[_0x6d6e('0x32')],'name':'admin'});}})[_0x6d6e('0x2a')](function(_0x44073a){var _0x15e0de=_0x44073a[_0x6d6e('0x2b')]||0x1f4;logger[_0x6d6e('0x29')](_0x6d6e('0x2c'),_0x6d6e('0x39'),_0x15e0de,JSON['stringify'](_0x44073a));});}else{logger[_0x6d6e('0x19')](_0x6d6e('0x3a'));return BPromise[_0x6d6e('0x28')]({'id':_0x1527e4[_0x6d6e('0x38')],'email':_0x1fdfc0[_0x6d6e('0x32')],'name':'admin'})['catch'](function(_0x4f5daa){var _0x4a84f6=_0x4f5daa[_0x6d6e('0x2b')]||0x1f4;logger[_0x6d6e('0x29')](_0x6d6e('0x2c'),'getUser',_0x4a84f6,JSON[_0x6d6e('0x25')](_0x4f5daa));});}}function getEndUser(_0x5874f7,_0x500108,_0x555572,_0x4a00b1){logger[_0x6d6e('0x19')]('Searching\x20end\x20user\x20with\x20phone',_0x555572);return request({'method':_0x6d6e('0x30'),'uri':util['format']('%s/webservice.php',_0x5874f7[_0x6d6e('0x22')]),'qs':{'operation':_0x6d6e('0x31'),'username':_0x5874f7['username'],'sessionName':_0x4a00b1[_0x6d6e('0x24')],'query':util[_0x6d6e('0x20')]('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;',_0x555572,_0x555572,_0x555572,_0x555572,_0x555572)},'json':!![]})[_0x6d6e('0x26')](function(_0xfcf056){if(_0xfcf056[_0x6d6e('0x27')]&&_0xfcf056[_0x6d6e('0x34')][_0x6d6e('0xc')]){logger[_0x6d6e('0x19')](_0x6d6e('0x3b'));return BPromise[_0x6d6e('0x28')]({'id':_0xfcf056[_0x6d6e('0x34')][0x0]['id'],'name':_0xfcf056[_0x6d6e('0x34')][0x0][_0x6d6e('0x3c')]+'\x20'+_0xfcf056['result'][0x0][_0x6d6e('0x3d')],'phone':_0x555572});}else{logger[_0x6d6e('0x19')]('Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!');return request({'method':'POST','uri':util[_0x6d6e('0x20')](_0x6d6e('0x21'),_0x5874f7[_0x6d6e('0x22')]),'form':{'operation':_0x6d6e('0x23'),'sessionName':_0x4a00b1[_0x6d6e('0x24')],'elementType':'Contacts','element':JSON[_0x6d6e('0x25')]({'lastname':_0x500108,'phone':_0x555572,'assigned_user_id':'\x20'})},'json':!![]})[_0x6d6e('0x26')](function(_0x194b33){logger[_0x6d6e('0x19')](_0x6d6e('0x3e'));return BPromise['resolve']({'id':_0x194b33['result']['id'],'name':_0x194b33[_0x6d6e('0x34')][_0x6d6e('0x3d')],'phone':_0x194b33[_0x6d6e('0x34')][_0x6d6e('0x3f')]});})[_0x6d6e('0x2a')](function(_0x1c3b06){var _0x9e7883=_0x1c3b06[_0x6d6e('0x2b')]||0x1f4;logger[_0x6d6e('0x29')](_0x6d6e('0x2c'),'getEndUser',_0x9e7883,JSON[_0x6d6e('0x25')](_0x1c3b06));});}});}function getConnection(_0x5e12a0){var _0x26087a=_0x5e12a0['username'];var _0x550e1b=_0x5e12a0[_0x6d6e('0x40')];return request({'method':'GET','uri':util['format'](_0x6d6e('0x21'),_0x5e12a0['remoteUri']),'qs':{'operation':_0x6d6e('0x41'),'username':_0x26087a},'json':!![]})[_0x6d6e('0x26')](function(_0x6bf31d){if(_0x6bf31d[_0x6d6e('0x27')]){return request({'method':_0x6d6e('0x42'),'uri':util[_0x6d6e('0x20')](_0x6d6e('0x21'),_0x5e12a0[_0x6d6e('0x22')]),'form':{'operation':'login','username':_0x26087a,'accessKey':md5(_0x6bf31d['result'][_0x6d6e('0x43')]+_0x550e1b)},'json':!![]});}})[_0x6d6e('0x26')](function(_0x267331){if(_0x267331[_0x6d6e('0x27')]){return BPromise['resolve'](_0x267331[_0x6d6e('0x34')]);}else{throw new Error(util[_0x6d6e('0x20')](_0x6d6e('0x44'),_0x5e12a0['id']));}})[_0x6d6e('0x2a')](function(_0xcf79e1){var _0x3b76c0=_0xcf79e1[_0x6d6e('0x2b')]||0x1f4;logger[_0x6d6e('0x29')](_0x6d6e('0x2c'),_0x6d6e('0x45'),_0x3b76c0,JSON[_0x6d6e('0x25')](_0xcf79e1));});}function request(_0x123f0b){logger[_0x6d6e('0x19')](_0x6d6e('0x46'),JSON[_0x6d6e('0x25')](_0x123f0b));return rp(_0x123f0b);}exports[_0x6d6e('0x47')]=function(_0x15fa86,_0x14b81c,_0x27e37a,_0x1aeab9,_0x46335d,_0x212173){var _0xa4e4d0,_0x4b7e17,_0x482e1a,_0x12bc68;_0x212173[_0x6d6e('0x22')]=intUtil[_0x6d6e('0x48')](_0x212173['remoteUri']);if(_0x46335d&&_0x46335d[_0x6d6e('0x49')]){logger[_0x6d6e('0x19')](_0x6d6e('0x4a'),_0x6d6e('0x4b'));_0x14b81c['recordingURL']=util['format'](_0x6d6e('0x4c'),_0x212173['serverUrl'],_0x14b81c[_0x6d6e('0x4d')],md5(_0x14b81c['uniqueid']));}else{_0x14b81c[_0x6d6e('0x4e')]='';}return getConnection(_0x212173)[_0x6d6e('0x26')](function(_0x2ff94b){_0x12bc68=_0x2ff94b;return getUser(_0x212173,_0x1aeab9[_0x6d6e('0x4f')],_0x12bc68);})[_0x6d6e('0x26')](function(_0x38b751){_0xa4e4d0=_0x38b751;logger['info'](_0x6d6e('0x50'),_0xa4e4d0['id']);return getEndUser(_0x212173,_0x14b81c[_0x6d6e('0x51')],_0x14b81c[_0x6d6e('0x52')],_0x12bc68);})['then'](function(_0x56a1b2){_0x4b7e17=_0x56a1b2;logger[_0x6d6e('0x19')](_0x6d6e('0x53'),_0x4b7e17['id']);return createTicket(_0x212173,_0xa4e4d0,_0x4b7e17,_0x27e37a,_0x14b81c,_0x27e37a['Fields'],_0x12bc68);})[_0x6d6e('0x26')](function(_0x417f7d){_0x482e1a=_0x417f7d;logger[_0x6d6e('0x19')]('Ticket\x20created!');logger[_0x6d6e('0x19')](_0x6d6e('0x54'),_0x482e1a['id']);var _0x4045df=util[_0x6d6e('0x20')](_0x6d6e('0x55'),_0x212173[_0x6d6e('0x22')],_[_0x6d6e('0x56')](_0x482e1a['id'],'x')[0x1]);logger[_0x6d6e('0x19')]('[QUEUE]','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0x6d6e('0x20')](_0x6d6e('0x57'),_0x1aeab9[_0x6d6e('0x17')]),_0x6d6e('0x58'),{'uri':_0x4045df});})['catch'](function(_0xff6542){logger[_0x6d6e('0x29')](_0x6d6e('0x4a'),JSON[_0x6d6e('0x25')](_0xff6542));});};exports[_0x6d6e('0x59')]=function(_0x27cba4,_0x18452e,_0x4095fc,_0x342886,_0x5ae46d,_0xe2fb84,_0x2e8ec4){var _0x1da459,_0x12eb9a,_0x4ec1e4,_0x4c426b;_0xe2fb84['remoteUri']=intUtil[_0x6d6e('0x48')](_0xe2fb84[_0x6d6e('0x22')]);_0xe2fb84[_0x6d6e('0x5a')]=intUtil['stripTrailingSlash'](_0xe2fb84[_0x6d6e('0x5a')]);if(_0x2e8ec4&&_0x2e8ec4[_0x6d6e('0x5b')]&&_0x2e8ec4[_0x6d6e('0x5b')]!==_0x6d6e('0x5c')){logger['info'](_0x6d6e('0x5d'),_0x6d6e('0x4b'));_0x18452e[_0x6d6e('0x4e')]=util['format'](_0x6d6e('0x4c'),_0xe2fb84[_0x6d6e('0x5a')],_0x18452e[_0x6d6e('0x4d')],md5(_0x18452e[_0x6d6e('0x4d')]));}return getConnection(_0xe2fb84)[_0x6d6e('0x26')](function(_0xc754ec){_0x4c426b=_0xc754ec;return getUser(_0xe2fb84,_0x342886[_0x6d6e('0x4f')],_0x4c426b);})['then'](function(_0x14f350){_0x1da459=_0x14f350;logger['info'](_0x6d6e('0x50'),_0x1da459['id']);return getEndUser(_0xe2fb84,_0x18452e[_0x6d6e('0x5e')],_0x18452e['destcalleridnum'],_0x4c426b);})[_0x6d6e('0x26')](function(_0x42c971){_0x12eb9a=_0x42c971;logger[_0x6d6e('0x19')](_0x6d6e('0x53'),_0x12eb9a['id']);return createTicket(_0xe2fb84,_0x1da459,_0x12eb9a,_0x4095fc,_0x18452e,_0x4095fc['Fields'],_0x4c426b);})[_0x6d6e('0x26')](function(_0x2fa278){_0x4ec1e4=_0x2fa278;logger[_0x6d6e('0x19')](_0x6d6e('0x5f'));logger[_0x6d6e('0x19')](_0x6d6e('0x54'),_0x4ec1e4['id']);var _0x4525a9=util['format'](_0x6d6e('0x55'),_0xe2fb84[_0x6d6e('0x22')],_[_0x6d6e('0x56')](_0x4ec1e4['id'],'x')[0x1]);logger[_0x6d6e('0x19')](_0x6d6e('0x5d'),_0x6d6e('0x60'));emit(util['format'](_0x6d6e('0x57'),_0x342886[_0x6d6e('0x17')]),_0x6d6e('0x58'),{'uri':_0x4525a9});})['catch'](function(_0x23b118){logger[_0x6d6e('0x29')](_0x6d6e('0x5d'),JSON[_0x6d6e('0x25')](_0x23b118));});};exports['unmanaged']=function(_0x977a4b,_0x1ecbdc,_0x55ff3f,_0x5af1b6,_0x46e7f6,_0x2786b9){var _0x24be0c,_0x363c1e,_0x3e7e55,_0x1a8138;_0x2786b9[_0x6d6e('0x22')]=intUtil[_0x6d6e('0x48')](_0x2786b9[_0x6d6e('0x22')]);_0x2786b9['serverUrl']=intUtil[_0x6d6e('0x48')](_0x2786b9[_0x6d6e('0x5a')]);if(_0x46e7f6&&_0x46e7f6[_0x6d6e('0x49')]){logger['info']('['+_0x1ecbdc[_0x6d6e('0x61')][_0x6d6e('0x62')]()+']',_0x6d6e('0x4b'));_0x1ecbdc[_0x6d6e('0x4e')]=util[_0x6d6e('0x20')](_0x6d6e('0x4c'),_0x2786b9['serverUrl'],_0x1ecbdc['uniqueid'],md5(_0x1ecbdc['uniqueid']));}else{_0x1ecbdc[_0x6d6e('0x4e')]='';}return getConnection(_0x2786b9)[_0x6d6e('0x26')](function(_0x524c99){_0x1a8138=_0x524c99;return getUser(_0x2786b9,'',_0x1a8138);})[_0x6d6e('0x26')](function(_0x2cb8f0){_0x24be0c=_0x2cb8f0;logger[_0x6d6e('0x19')]('The\x20User\x20ID\x20is:',_0x24be0c['id']);return getEndUser(_0x2786b9,_0x1ecbdc[_0x6d6e('0x51')],_0x1ecbdc[_0x6d6e('0x52')],_0x1a8138);})['then'](function(_0x5cf759){_0x363c1e=_0x5cf759;logger[_0x6d6e('0x19')]('The\x20Enduser\x20ID\x20is:',_0x363c1e['id']);return createTicket(_0x2786b9,_0x24be0c,_0x363c1e,_0x55ff3f,_0x1ecbdc,_0x55ff3f[_0x6d6e('0x63')],_0x1a8138);})[_0x6d6e('0x26')](function(_0x5e8ff8){_0x3e7e55=_0x5e8ff8;logger['info']('Ticket\x20created!');logger[_0x6d6e('0x19')](_0x6d6e('0x54'),_0x3e7e55['id']);})[_0x6d6e('0x2a')](function(_0x28fb84){logger[_0x6d6e('0x29')]('['+_0x1ecbdc[_0x6d6e('0x61')][_0x6d6e('0x62')]()+']',JSON['stringify'](_0x28fb84));});}; \ No newline at end of file +var _0x3689=['GET','query','SELECT\x20first_name,\x20last_name,\x20email1\x20FROM\x20Users\x20WHERE\x20email1=\x27%s\x27;','Agent\x20found!','result','email1','first_name','catch','getUser','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','userId','admin','Searching\x20end\x20user\x20with\x20phone','format','Enduser\x20found!','firstname','lastname','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','create','Contacts','phone','getEndUser','accessKey','token','Account\x20%d\x20is\x20not\x20valid','getConnection','queue','stripTrailingSlash','monitor_format','Recording\x20is\x20enabled!','serverUrl','uniqueid','email','The\x20User\x20ID\x20is:','calleridnum','The\x20Enduser\x20ID\x20is:','Fields','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','[QUEUE]','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','outbound','recordingFormat','none','[OUTBOUND]','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','destcalleridname','destcalleridnum','%s/index.php?module=HelpDesk&view=Detail&record=%s&app=SUPPORT','unmanaged','calleridname','lastevent','lodash','request-promise','bluebird','md5','util','./util','../../../../config/environment','../../../../config/logger','vTiger','redis','localhost','socket.io-emitter','length','type','idField','content','toString','variable','variableName','customVariable','Variable','name','toLowerCase','info','merge','Normal','getString','Subjects','POST','%s/webservice.php','remoteUri','username','sessionName','HelpDesk','then','success','resolve','Ticket\x20could\x20not\x20be\x20created\x20due\x20to:\x20%s','error','statusCode','[vTiger],\x20%s,\x20%s,\x20%s','createTicket','stringify','validateEmail','Getting\x20agent\x20with\x20email'];(function(_0x2c3854,_0x5e686c){var _0x529b76=function(_0x37857a){while(--_0x37857a){_0x2c3854['push'](_0x2c3854['shift']());}};_0x529b76(++_0x5e686c);}(_0x3689,0x9b));var _0x9368=function(_0x5c3422,_0x2eac66){_0x5c3422=_0x5c3422-0x0;var _0x102b03=_0x3689[_0x5c3422];return _0x102b03;};'use strict';var _=require(_0x9368('0x0'));var rp=require(_0x9368('0x1'));var BPromise=require(_0x9368('0x2'));var md5=require(_0x9368('0x3'));var util=require(_0x9368('0x4'));var Redis=require('ioredis');var intUtil=require(_0x9368('0x5'));var config=require(_0x9368('0x6'));var logger=require(_0x9368('0x7'))(_0x9368('0x8'));config['redis']=_['defaults'](config[_0x9368('0x9')],{'host':_0x9368('0xa'),'port':0x18eb});var io=require(_0x9368('0xb'))(new Redis(config['redis']));function emit(_0x4b95dc,_0x7749ed,_0x25e23b){io['to'](_0x4b95dc)['emit'](_0x7749ed,_0x25e23b);}function getCustomFields(_0x4b2c93,_0x1c4a6b){var _0x1ba353={};if(_0x4b2c93[_0x9368('0xc')]>0x0){_['forEach'](_0x4b2c93,function(_0x3bd6b9){if(_0x3bd6b9[_0x9368('0xd')]==='string'&&_0x3bd6b9[_0x9368('0xe')]){_0x1ba353[_0x3bd6b9[_0x9368('0xe')]]=_0x3bd6b9[_0x9368('0xf')][_0x9368('0x10')]();}else if(_0x3bd6b9[_0x9368('0xd')]===_0x9368('0x11')&&_0x3bd6b9['variableName']&&_0x3bd6b9[_0x9368('0xe')]&&_0x1c4a6b[_0x3bd6b9[_0x9368('0x12')]]){_0x1ba353[_0x3bd6b9[_0x9368('0xe')]]=_0x1c4a6b[_0x3bd6b9[_0x9368('0x12')]][_0x9368('0x10')]();}else if(_0x3bd6b9[_0x9368('0xd')]===_0x9368('0x13')&&_0x3bd6b9['Variable']&&_0x3bd6b9[_0x9368('0x14')]['name']&&_0x3bd6b9[_0x9368('0xe')]&&_0x1c4a6b[_0x3bd6b9['Variable'][_0x9368('0x15')][_0x9368('0x16')]()]){_0x1ba353[_0x3bd6b9[_0x9368('0xe')]]=_0x1c4a6b[_0x3bd6b9[_0x9368('0x14')][_0x9368('0x15')][_0x9368('0x16')]()][_0x9368('0x10')]();}});}return _0x1ba353;}function createTicket(_0x306eef,_0x30b7da,_0x157f73,_0x6d8a40,_0x45c091,_0x358497,_0x3cbf1c){logger[_0x9368('0x17')]('Creating\x20new\x20ticket...');var _0x28d681=_[_0x9368('0x18')]({'parent_id':'','assigned_user_id':_0x30b7da['id'],'ticketpriorities':_0x9368('0x19'),'ticketstatus':'Open','ticket_title':intUtil[_0x9368('0x1a')](_0x6d8a40[_0x9368('0x1b')],_0x45c091,'\x20'),'description':intUtil[_0x9368('0x1a')](_0x6d8a40['Descriptions'],_0x45c091,'\x0a'),'contact_id':_0x157f73['id']},getCustomFields(_0x358497,_0x45c091));var _0x2b2179={'method':_0x9368('0x1c'),'uri':util['format'](_0x9368('0x1d'),_0x306eef[_0x9368('0x1e')]),'form':{'operation':'create','username':_0x306eef[_0x9368('0x1f')],'sessionName':_0x3cbf1c[_0x9368('0x20')],'elementType':_0x9368('0x21'),'element':JSON['stringify'](_0x28d681)},'json':!![]};return request(_0x2b2179)[_0x9368('0x22')](function(_0xc08964){if(_0xc08964[_0x9368('0x23')]){return BPromise[_0x9368('0x24')]({'id':_0xc08964['result']['id']});}else{throw new Error(util['format'](_0x9368('0x25'),JSON['stringify'](_0xc08964[_0x9368('0x26')])));}})['catch'](function(_0x267861){var _0x3054a2=_0x267861[_0x9368('0x27')]||0x1f4;logger['error'](_0x9368('0x28'),_0x9368('0x29'),_0x3054a2,JSON[_0x9368('0x2a')](_0x267861));});}function getUser(_0x399b7e,_0x2bc82a,_0x339198){if(intUtil[_0x9368('0x2b')](_0x2bc82a)){logger[_0x9368('0x17')](_0x9368('0x2c'),_0x2bc82a);return request({'method':_0x9368('0x2d'),'uri':util['format'](_0x9368('0x1d'),_0x399b7e[_0x9368('0x1e')]),'qs':{'operation':_0x9368('0x2e'),'username':_0x399b7e['username'],'sessionName':_0x339198[_0x9368('0x20')],'query':util['format'](_0x9368('0x2f'),_0x2bc82a)},'json':!![]})[_0x9368('0x22')](function(_0x3aeee3){if(_0x3aeee3['success']&&_0x3aeee3['result'][_0x9368('0xc')]){logger[_0x9368('0x17')](_0x9368('0x30'));return BPromise[_0x9368('0x24')]({'id':_0x3aeee3[_0x9368('0x31')][0x0]['id'],'email':_0x3aeee3[_0x9368('0x31')][0x0][_0x9368('0x32')],'name':_0x3aeee3[_0x9368('0x31')][0x0][_0x9368('0x33')]+'\x20'+_0x3aeee3[_0x9368('0x31')]['last_name']});}else{logger[_0x9368('0x17')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return BPromise[_0x9368('0x24')]({'id':_0x339198['userId'],'email':_0x399b7e[_0x9368('0x1f')],'name':'admin'});}})[_0x9368('0x34')](function(_0xc52119){var _0x402b78=_0xc52119[_0x9368('0x27')]||0x1f4;logger[_0x9368('0x26')](_0x9368('0x28'),_0x9368('0x35'),_0x402b78,JSON[_0x9368('0x2a')](_0xc52119));});}else{logger[_0x9368('0x17')](_0x9368('0x36'));return BPromise['resolve']({'id':_0x339198[_0x9368('0x37')],'email':_0x399b7e[_0x9368('0x1f')],'name':_0x9368('0x38')})[_0x9368('0x34')](function(_0x257090){var _0x3578d0=_0x257090[_0x9368('0x27')]||0x1f4;logger[_0x9368('0x26')](_0x9368('0x28'),_0x9368('0x35'),_0x3578d0,JSON[_0x9368('0x2a')](_0x257090));});}}function getEndUser(_0x5b218a,_0x4a2744,_0x496990,_0x3169cb){logger[_0x9368('0x17')](_0x9368('0x39'),_0x496990);return request({'method':_0x9368('0x2d'),'uri':util['format'](_0x9368('0x1d'),_0x5b218a[_0x9368('0x1e')]),'qs':{'operation':_0x9368('0x2e'),'username':_0x5b218a[_0x9368('0x1f')],'sessionName':_0x3169cb[_0x9368('0x20')],'query':util[_0x9368('0x3a')]('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;',_0x496990,_0x496990,_0x496990,_0x496990,_0x496990)},'json':!![]})[_0x9368('0x22')](function(_0x2ced4b){if(_0x2ced4b[_0x9368('0x23')]&&_0x2ced4b[_0x9368('0x31')][_0x9368('0xc')]){logger['info'](_0x9368('0x3b'));return BPromise['resolve']({'id':_0x2ced4b[_0x9368('0x31')][0x0]['id'],'name':_0x2ced4b['result'][0x0][_0x9368('0x3c')]+'\x20'+_0x2ced4b[_0x9368('0x31')][0x0][_0x9368('0x3d')],'phone':_0x496990});}else{logger['info'](_0x9368('0x3e'));return request({'method':_0x9368('0x1c'),'uri':util[_0x9368('0x3a')]('%s/webservice.php',_0x5b218a[_0x9368('0x1e')]),'form':{'operation':_0x9368('0x3f'),'sessionName':_0x3169cb[_0x9368('0x20')],'elementType':_0x9368('0x40'),'element':JSON[_0x9368('0x2a')]({'lastname':_0x4a2744,'phone':_0x496990,'assigned_user_id':'\x20'})},'json':!![]})[_0x9368('0x22')](function(_0x987dfa){logger[_0x9368('0x17')]('Enduser\x20created.');return BPromise[_0x9368('0x24')]({'id':_0x987dfa[_0x9368('0x31')]['id'],'name':_0x987dfa[_0x9368('0x31')]['lastname'],'phone':_0x987dfa[_0x9368('0x31')][_0x9368('0x41')]});})['catch'](function(_0x4520ed){var _0x329e3d=_0x4520ed['statusCode']||0x1f4;logger['error']('[vTiger],\x20%s,\x20%s,\x20%s',_0x9368('0x42'),_0x329e3d,JSON[_0x9368('0x2a')](_0x4520ed));});}});}function getConnection(_0x15aedd){var _0x553db8=_0x15aedd[_0x9368('0x1f')];var _0x2eda61=_0x15aedd[_0x9368('0x43')];return request({'method':_0x9368('0x2d'),'uri':util[_0x9368('0x3a')](_0x9368('0x1d'),_0x15aedd[_0x9368('0x1e')]),'qs':{'operation':'getchallenge','username':_0x553db8},'json':!![]})[_0x9368('0x22')](function(_0x3e25fb){if(_0x3e25fb[_0x9368('0x23')]){return request({'method':_0x9368('0x1c'),'uri':util[_0x9368('0x3a')](_0x9368('0x1d'),_0x15aedd[_0x9368('0x1e')]),'form':{'operation':'login','username':_0x553db8,'accessKey':md5(_0x3e25fb[_0x9368('0x31')][_0x9368('0x44')]+_0x2eda61)},'json':!![]});}})[_0x9368('0x22')](function(_0x2aba21){if(_0x2aba21[_0x9368('0x23')]){return BPromise['resolve'](_0x2aba21[_0x9368('0x31')]);}else{throw new Error(util[_0x9368('0x3a')](_0x9368('0x45'),_0x15aedd['id']));}})[_0x9368('0x34')](function(_0x5716b8){var _0x39de52=_0x5716b8[_0x9368('0x27')]||0x1f4;logger[_0x9368('0x26')](_0x9368('0x28'),_0x9368('0x46'),_0x39de52,JSON[_0x9368('0x2a')](_0x5716b8));});}function request(_0x2d4519){logger['info']('[HTTP]',JSON[_0x9368('0x2a')](_0x2d4519));return rp(_0x2d4519);}exports[_0x9368('0x47')]=function(_0xe17ce,_0x4c7cca,_0x285247,_0x26b4e7,_0x1acbbd,_0xbf0de1){var _0x524cdc,_0x2fbe78,_0x2834e3,_0x1a9803;_0xbf0de1[_0x9368('0x1e')]=intUtil[_0x9368('0x48')](_0xbf0de1[_0x9368('0x1e')]);if(_0x1acbbd&&_0x1acbbd[_0x9368('0x49')]){logger['info']('[QUEUE]',_0x9368('0x4a'));_0x4c7cca['recordingURL']=util[_0x9368('0x3a')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0xbf0de1[_0x9368('0x4b')],_0x4c7cca[_0x9368('0x4c')],md5(_0x4c7cca[_0x9368('0x4c')]));}else{_0x4c7cca['recordingURL']='';}return getConnection(_0xbf0de1)[_0x9368('0x22')](function(_0x249c11){_0x1a9803=_0x249c11;return getUser(_0xbf0de1,_0x26b4e7[_0x9368('0x4d')],_0x1a9803);})[_0x9368('0x22')](function(_0x4152c5){_0x524cdc=_0x4152c5;logger[_0x9368('0x17')](_0x9368('0x4e'),_0x524cdc['id']);return getEndUser(_0xbf0de1,_0x4c7cca['calleridname'],_0x4c7cca[_0x9368('0x4f')],_0x1a9803);})[_0x9368('0x22')](function(_0x3e81d0){_0x2fbe78=_0x3e81d0;logger[_0x9368('0x17')](_0x9368('0x50'),_0x2fbe78['id']);return createTicket(_0xbf0de1,_0x524cdc,_0x2fbe78,_0x285247,_0x4c7cca,_0x285247[_0x9368('0x51')],_0x1a9803);})[_0x9368('0x22')](function(_0xf95f32){_0x2834e3=_0xf95f32;logger[_0x9368('0x17')](_0x9368('0x52'));logger[_0x9368('0x17')](_0x9368('0x53'),_0x2834e3['id']);var _0x1e7e35=util[_0x9368('0x3a')]('%s/index.php?module=HelpDesk&view=Detail&record=%s&app=SUPPORT',_0xbf0de1[_0x9368('0x1e')],_['split'](_0x2834e3['id'],'x')[0x1]);logger[_0x9368('0x17')](_0x9368('0x54'),_0x9368('0x55'));emit(util[_0x9368('0x3a')](_0x9368('0x56'),_0x26b4e7[_0x9368('0x15')]),_0x9368('0x57'),{'uri':_0x1e7e35});})[_0x9368('0x34')](function(_0x3ae4fb){logger['error'](_0x9368('0x54'),JSON[_0x9368('0x2a')](_0x3ae4fb));});};exports[_0x9368('0x58')]=function(_0x1a0b54,_0x399bca,_0x329803,_0x486887,_0x306c0b,_0x554a58,_0x4abd1e){var _0xf7772d,_0x2e812f,_0x177a22,_0x349376;_0x554a58[_0x9368('0x1e')]=intUtil[_0x9368('0x48')](_0x554a58['remoteUri']);_0x554a58['serverUrl']=intUtil[_0x9368('0x48')](_0x554a58[_0x9368('0x4b')]);if(_0x4abd1e&&_0x4abd1e[_0x9368('0x59')]&&_0x4abd1e['recordingFormat']!==_0x9368('0x5a')){logger['info'](_0x9368('0x5b'),_0x9368('0x4a'));_0x399bca[_0x9368('0x5c')]=util[_0x9368('0x3a')](_0x9368('0x5d'),_0x554a58[_0x9368('0x4b')],_0x399bca[_0x9368('0x4c')],md5(_0x399bca[_0x9368('0x4c')]));}return getConnection(_0x554a58)['then'](function(_0x47eb5a){_0x349376=_0x47eb5a;return getUser(_0x554a58,_0x486887[_0x9368('0x4d')],_0x349376);})['then'](function(_0x19bd6f){_0xf7772d=_0x19bd6f;logger[_0x9368('0x17')](_0x9368('0x4e'),_0xf7772d['id']);return getEndUser(_0x554a58,_0x399bca[_0x9368('0x5e')],_0x399bca[_0x9368('0x5f')],_0x349376);})[_0x9368('0x22')](function(_0x3fcbc8){_0x2e812f=_0x3fcbc8;logger[_0x9368('0x17')](_0x9368('0x50'),_0x2e812f['id']);return createTicket(_0x554a58,_0xf7772d,_0x2e812f,_0x329803,_0x399bca,_0x329803['Fields'],_0x349376);})[_0x9368('0x22')](function(_0x2741db){_0x177a22=_0x2741db;logger[_0x9368('0x17')]('Ticket\x20created!');logger[_0x9368('0x17')]('The\x20Ticket\x20ID\x20is:',_0x177a22['id']);var _0x537a47=util[_0x9368('0x3a')](_0x9368('0x60'),_0x554a58[_0x9368('0x1e')],_['split'](_0x177a22['id'],'x')[0x1]);logger['info'](_0x9368('0x5b'),_0x9368('0x55'));emit(util[_0x9368('0x3a')](_0x9368('0x56'),_0x486887[_0x9368('0x15')]),_0x9368('0x57'),{'uri':_0x537a47});})[_0x9368('0x34')](function(_0x34fa39){logger[_0x9368('0x26')](_0x9368('0x5b'),JSON[_0x9368('0x2a')](_0x34fa39));});};exports[_0x9368('0x61')]=function(_0x3d8b5e,_0x19c8f6,_0x360a46,_0x4eda70,_0x31def6,_0x230d35){var _0x1c0eaa,_0x5f245c,_0x360599,_0x37ca4b;_0x230d35[_0x9368('0x1e')]=intUtil[_0x9368('0x48')](_0x230d35[_0x9368('0x1e')]);_0x230d35['serverUrl']=intUtil[_0x9368('0x48')](_0x230d35[_0x9368('0x4b')]);if(_0x31def6&&_0x31def6['monitor_format']){logger['info']('['+_0x19c8f6['lastevent']['toUpperCase']()+']',_0x9368('0x4a'));_0x19c8f6[_0x9368('0x5c')]=util[_0x9368('0x3a')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x230d35['serverUrl'],_0x19c8f6['uniqueid'],md5(_0x19c8f6['uniqueid']));}else{_0x19c8f6[_0x9368('0x5c')]='';}return getConnection(_0x230d35)[_0x9368('0x22')](function(_0x2bd4c7){_0x37ca4b=_0x2bd4c7;return getUser(_0x230d35,'',_0x37ca4b);})[_0x9368('0x22')](function(_0x1f3c18){_0x1c0eaa=_0x1f3c18;logger[_0x9368('0x17')](_0x9368('0x4e'),_0x1c0eaa['id']);return getEndUser(_0x230d35,_0x19c8f6[_0x9368('0x62')],_0x19c8f6[_0x9368('0x4f')],_0x37ca4b);})[_0x9368('0x22')](function(_0x27e94e){_0x5f245c=_0x27e94e;logger[_0x9368('0x17')](_0x9368('0x50'),_0x5f245c['id']);return createTicket(_0x230d35,_0x1c0eaa,_0x5f245c,_0x360a46,_0x19c8f6,_0x360a46[_0x9368('0x51')],_0x37ca4b);})[_0x9368('0x22')](function(_0x302e25){_0x360599=_0x302e25;logger[_0x9368('0x17')](_0x9368('0x52'));logger['info']('The\x20Ticket\x20ID\x20is:',_0x360599['id']);})[_0x9368('0x34')](function(_0x2cbb0e){logger[_0x9368('0x26')]('['+_0x19c8f6[_0x9368('0x63')]['toUpperCase']()+']',JSON[_0x9368('0x2a')](_0x2cbb0e));});}; \ 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 f27a56a..1ef1dca 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 _0xd547=['variable','variableName','custom_fields','push','customVariable','Variable','queue','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','The\x20User\x20ID\x20is:','calleridname','The\x20Ticket\x20ID\x20is:','integrationTab','Displaying\x20ticket\x20to\x20agent...','%s/channels/voice/agents/%d/tickets/%d/display.json','user:%s','trigger:browser:url','%s/agent/tickets/%s','error','Zendesk\x20account\x20type\x20not\x20recognized','catch','[QUEUE]\x20Error\x20running\x20Zendesk\x20integration','inspect','outbound','destcalleridname','destcalleridnum','[OUTBOUND]','newTab','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','[OUTBOUND]\x20Error\x20running\x20Zendesk\x20integration','lastevent','calleridnum','The\x20Enduser\x20ID\x20is:','toUpperCase','\x20Error\x20running\x20Zendesk\x20integration','md5','util','ioredis','./util','zendesk','defaults','localhost','socket.io-emitter','redis','emit','application/json','Creating\x20new\x20ticket...','format','merge','Tags','name','Subjects','Descriptions','Fields','info','Ticket\x20created!','validateEmail','Getting\x20agent\x20with\x20email','remoteUri','then','Agent\x20found!','find','results','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/users/me.json','Admin\x20account\x20selected.','user','%s/search.json','length','end-user','first','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','POST','Caller\x20-\x20%s','Enduser\x20created.','authType','%s:%s','username','token','%s/token:%s','Basic\x20%s','base64','debug','[HTTP]','stringify','GET','map','forEach','string','customField','nameField','toString','type','idField','content'];(function(_0xbc346f,_0x3db5c0){var _0x9f9260=function(_0x37e6b9){while(--_0x37e6b9){_0xbc346f['push'](_0xbc346f['shift']());}};_0x9f9260(++_0x3db5c0);}(_0xd547,0x1c1));var _0x7d54=function(_0xa84046,_0x456128){_0xa84046=_0xa84046-0x0;var _0x156dae=_0xd547[_0xa84046];return _0x156dae;};'use strict';var _=require('lodash');var rp=require('request-promise');var md5=require(_0x7d54('0x0'));var util=require(_0x7d54('0x1'));var Redis=require(_0x7d54('0x2'));var intUtil=require(_0x7d54('0x3'));var config=require('../../../../config/environment');var logger=require('../../../../config/logger')(_0x7d54('0x4'));config['redis']=_[_0x7d54('0x5')](config['redis'],{'host':_0x7d54('0x6'),'port':0x18eb});var io=require(_0x7d54('0x7'))(new Redis(config[_0x7d54('0x8')]));function emit(_0x5186ae,_0x5b0b16,_0x478f9b){io['to'](_0x5186ae)[_0x7d54('0x9')](_0x5b0b16,_0x478f9b);}var headers={'Content-Type':_0x7d54('0xa'),'Accept':'application/json'};function getTicket(_0xa5b980,_0x48b250,_0x2bede6,_0x4d9dc3,_0x1d7ff7){logger['info'](_0x7d54('0xb'));return request({'uri':util[_0x7d54('0xc')]('%s/tickets.json',_0xa5b980['remoteUri']),'method':'POST','body':{'ticket':_[_0x7d54('0xd')]({'requester_id':_0x2bede6['id'],'submitter_id':_0x48b250?_0x48b250['id']:undefined,'assignee_id':_0x48b250?_0x48b250['id']:undefined,'tags':getTags(_0x4d9dc3[_0x7d54('0xe')],_0x7d54('0xf')),'subject':intUtil['getString'](_0x4d9dc3[_0x7d54('0x10')],_0x1d7ff7,'\x20'),'description':intUtil['getString'](_0x4d9dc3[_0x7d54('0x11')],_0x1d7ff7,'\x0a'),'comment':{'public':![],'body':intUtil['getString'](_0x4d9dc3[_0x7d54('0x11')],_0x1d7ff7,'\x0a')}},getCustomFields(_0x4d9dc3[_0x7d54('0x12')],_0x1d7ff7))}})['then'](function(_0x268b0c){logger[_0x7d54('0x13')](_0x7d54('0x14'));return _0x268b0c['ticket'];});}function getUser(_0x2b1b0f,_0x33a519){if(intUtil[_0x7d54('0x15')](_0x33a519)){logger[_0x7d54('0x13')](_0x7d54('0x16'),_0x33a519);return request({'uri':util[_0x7d54('0xc')]('%s/search.json',_0x2b1b0f[_0x7d54('0x17')]),'qs':{'query':util[_0x7d54('0xc')]('type:user\x20role:agent\x20email:%s',_0x33a519)}})[_0x7d54('0x18')](function(_0x4b9caf){if(_0x4b9caf['count']){logger[_0x7d54('0x13')](_0x7d54('0x19'));return _[_0x7d54('0x1a')](_0x4b9caf[_0x7d54('0x1b')],{'email':_0x33a519,'role':'agent'});}else{logger[_0x7d54('0x13')](_0x7d54('0x1c'));return request({'uri':util['format'](_0x7d54('0x1d'),_0x2b1b0f[_0x7d54('0x17')])})[_0x7d54('0x18')](function(_0x6cc88b){logger[_0x7d54('0x13')](_0x7d54('0x1e'));return _0x6cc88b[_0x7d54('0x1f')];});}});}else{logger['info']('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return request({'uri':util['format'](_0x7d54('0x1d'),_0x2b1b0f[_0x7d54('0x17')])})['then'](function(_0xbfa233){logger[_0x7d54('0x13')](_0x7d54('0x1e'));return _0xbfa233[_0x7d54('0x1f')];});}}function getEndUser(_0x3b611f,_0x6d0375,_0x3614aa){logger[_0x7d54('0x13')]('Searching\x20enduser\x20with\x20phone',_0x3614aa);return request({'uri':util[_0x7d54('0xc')](_0x7d54('0x20'),_0x3b611f['remoteUri']),'qs':{'query':util['format']('type:user\x20role:end-user\x20phone:%s',_0x3614aa)}})['then'](function(_0x24f2cc){var _0xa4c745;if(_0x24f2cc['results'][_0x7d54('0x21')]){_0x24f2cc[_0x7d54('0x1b')]=_['filter'](_0x24f2cc[_0x7d54('0x1b')],{'suspended':![],'role':_0x7d54('0x22')});if(_0x24f2cc[_0x7d54('0x1b')][_0x7d54('0x21')]){_0xa4c745=_[_0x7d54('0x23')](_0x24f2cc[_0x7d54('0x1b')]);}}if(_0xa4c745){logger[_0x7d54('0x13')](_0x7d54('0x24'));return _0xa4c745;}else{logger['info'](_0x7d54('0x25'));return request({'uri':util['format']('%s/users.json',_0x3b611f[_0x7d54('0x17')]),'method':_0x7d54('0x26'),'body':{'user':{'role':'end-user','name':util[_0x7d54('0xc')](_0x7d54('0x27'),_0x6d0375||_0x3614aa),'phone':_0x3614aa}}})[_0x7d54('0x18')](function(_0x21a01b){logger[_0x7d54('0x13')](_0x7d54('0x28'));return _0x21a01b[_0x7d54('0x1f')];});}});}function getAuth(_0x546604){var _0xa322a1;if(_0x546604[_0x7d54('0x29')]==='password'){_0xa322a1=util[_0x7d54('0xc')](_0x7d54('0x2a'),_0x546604[_0x7d54('0x2b')],_0x546604['password']);}else if(_0x546604[_0x7d54('0x29')]===_0x7d54('0x2c')){_0xa322a1=util[_0x7d54('0xc')](_0x7d54('0x2d'),_0x546604[_0x7d54('0x2b')],_0x546604['token']);}return util[_0x7d54('0xc')](_0x7d54('0x2e'),new Buffer(_0xa322a1)['toString'](_0x7d54('0x2f')));}function request(_0x24b935){logger[_0x7d54('0x30')](_0x7d54('0x31'),JSON[_0x7d54('0x32')](_0x24b935));return rp(_[_0x7d54('0x5')](_0x24b935,{'method':_0x7d54('0x33'),'headers':headers,'json':!![]}));}function getTags(_0x22dcbc,_0x125974){var _0x32b5fa=[];if(_0x22dcbc&&_0x22dcbc[_0x7d54('0x21')]>0x0){_0x32b5fa=_[_0x7d54('0x34')](_0x22dcbc,_0x125974);}return _0x32b5fa;}function getCustomFields(_0x4f637b,_0x4f52e9){var _0x319d36=[];var _0x3c1066={'custom_fields':[]};if(_0x4f637b[_0x7d54('0x21')]>0x0){_[_0x7d54('0x35')](_0x4f637b,function(_0x5a59fd){if(_0x5a59fd['type']===_0x7d54('0x36')&&_0x5a59fd['nameField']&&!_0x5a59fd[_0x7d54('0x37')]){_0x3c1066[_0x5a59fd[_0x7d54('0x38')]['toLowerCase']()]=_0x5a59fd['content'][_0x7d54('0x39')]();}else if(_0x5a59fd[_0x7d54('0x3a')]==='string'&&_0x5a59fd[_0x7d54('0x3b')]&&_0x5a59fd[_0x7d54('0x37')]){_0x3c1066['custom_fields']['push']({'id':_0x5a59fd[_0x7d54('0x3b')],'value':_0x5a59fd[_0x7d54('0x3c')][_0x7d54('0x39')]()});}else if(_0x5a59fd[_0x7d54('0x3a')]===_0x7d54('0x3d')&&_0x5a59fd[_0x7d54('0x3e')]&&_0x5a59fd[_0x7d54('0x3b')]&&_0x5a59fd[_0x7d54('0x37')]){_0x4f52e9[_0x5a59fd[_0x7d54('0x3e')]]&&_0x3c1066[_0x7d54('0x3f')][_0x7d54('0x40')]({'id':_0x5a59fd['idField'],'value':_0x4f52e9[_0x5a59fd['variableName']][_0x7d54('0x39')]()});}else if(_0x5a59fd[_0x7d54('0x3a')]===_0x7d54('0x41')&&_0x5a59fd[_0x7d54('0x42')]&&_0x5a59fd[_0x7d54('0x42')][_0x7d54('0xf')]&&_0x5a59fd[_0x7d54('0x3b')]&&_0x5a59fd['customField']){_0x4f52e9[_0x5a59fd[_0x7d54('0x42')]['name']['toLowerCase']()]&&_0x3c1066[_0x7d54('0x3f')][_0x7d54('0x40')]({'id':_0x5a59fd[_0x7d54('0x3b')],'value':_0x4f52e9[_0x5a59fd[_0x7d54('0x42')][_0x7d54('0xf')]['toLowerCase']()][_0x7d54('0x39')]()});}});}return _0x3c1066;}exports[_0x7d54('0x43')]=function(_0x5a16d7,_0x18ea23,_0x793350,_0x22e0a9,_0x3e7187,_0x163d65){var _0x3d6f39,_0x5a2fcb;_0x163d65[_0x7d54('0x17')]=intUtil[_0x7d54('0x44')](_0x163d65[_0x7d54('0x17')]);_0x163d65[_0x7d54('0x45')]=intUtil[_0x7d54('0x44')](_0x163d65[_0x7d54('0x45')]);if(_0x3e7187&&_0x3e7187[_0x7d54('0x46')]){logger['info'](_0x7d54('0x47'),_0x7d54('0x48'));_0x18ea23[_0x7d54('0x49')]=util[_0x7d54('0xc')](_0x7d54('0x4a'),_0x163d65['serverUrl'],_0x18ea23[_0x7d54('0x4b')],md5(_0x18ea23['uniqueid']));}else{_0x18ea23[_0x7d54('0x49')]='';}headers['Authorization']=getAuth(_0x163d65);return getUser(_0x163d65,_0x22e0a9['email'])[_0x7d54('0x18')](function(_0x59585d){_0x3d6f39=_0x59585d;logger['info'](_0x7d54('0x4c'),_0x3d6f39['id']);return getEndUser(_0x163d65,_0x18ea23[_0x7d54('0x4d')],_0x18ea23['calleridnum']);})[_0x7d54('0x18')](function(_0x1af735){_0x5a2fcb=_0x1af735;logger[_0x7d54('0x13')]('The\x20Enduser\x20ID\x20is:',_0x5a2fcb['id']);return getTicket(_0x163d65,_0x3d6f39,_0x5a2fcb,_0x793350,_0x18ea23);})[_0x7d54('0x18')](function(_0x57bb14){if(_0x57bb14){logger[_0x7d54('0x13')](_0x7d54('0x4e'),_0x57bb14['id']);switch(_0x163d65[_0x7d54('0x3a')]){case _0x7d54('0x4f'):logger['info']('[QUEUE]',_0x7d54('0x50'));return request({'uri':util[_0x7d54('0xc')](_0x7d54('0x51'),_0x163d65[_0x7d54('0x17')],_0x3d6f39['id'],_0x57bb14['id']),'method':_0x7d54('0x26')});case'newTab':logger[_0x7d54('0x13')](_0x7d54('0x47'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0x7d54('0xc')](_0x7d54('0x52'),_0x22e0a9[_0x7d54('0xf')]),_0x7d54('0x53'),{'uri':util[_0x7d54('0xc')](_0x7d54('0x54'),_0x163d65[_0x7d54('0x17')],_0x57bb14['id'])});break;default:logger[_0x7d54('0x55')]('[QUEUE]',_0x7d54('0x56'));}}})[_0x7d54('0x57')](function(_0x2938ac){logger['error'](_0x7d54('0x58'),util[_0x7d54('0x59')](_0x2938ac,{'showHidden':!![],'depth':null}));});};exports[_0x7d54('0x5a')]=function(_0x1cb1fc,_0x544dd7,_0x3e4d68,_0x238210,_0xe9db27,_0x55ee74,_0x5be8d3){var _0x508c46,_0x5a5bb1;_0x55ee74[_0x7d54('0x17')]=intUtil[_0x7d54('0x44')](_0x55ee74[_0x7d54('0x17')]);_0x55ee74[_0x7d54('0x45')]=intUtil[_0x7d54('0x44')](_0x55ee74['serverUrl']);if(_0x5be8d3&&_0x5be8d3['recordingFormat']&&_0x5be8d3['recordingFormat']!=='none'){logger[_0x7d54('0x13')]('[OUTBOUND]',_0x7d54('0x48'));_0x544dd7['recordingURL']=util[_0x7d54('0xc')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x55ee74[_0x7d54('0x45')],_0x544dd7[_0x7d54('0x4b')],md5(_0x544dd7['uniqueid']));}headers['Authorization']=getAuth(_0x55ee74);return getUser(_0x55ee74,_0x238210['email'])[_0x7d54('0x18')](function(_0x37bf9c){_0x508c46=_0x37bf9c;logger['info']('The\x20User\x20ID\x20is:',_0x508c46['id']);return getEndUser(_0x55ee74,_0x544dd7[_0x7d54('0x5b')],_0x544dd7[_0x7d54('0x5c')]);})[_0x7d54('0x18')](function(_0x450336){_0x5a5bb1=_0x450336;logger[_0x7d54('0x13')]('The\x20Enduser\x20ID\x20is:',_0x5a5bb1['id']);return getTicket(_0x55ee74,_0x508c46,_0x5a5bb1,_0x3e4d68,_0x544dd7);})[_0x7d54('0x18')](function(_0x50e69e){if(_0x50e69e){logger['info'](_0x7d54('0x4e'),_0x50e69e['id']);switch(_0x55ee74[_0x7d54('0x3a')]){case _0x7d54('0x4f'):logger[_0x7d54('0x13')](_0x7d54('0x5d'),'Displaying\x20ticket\x20to\x20agent...');return request({'uri':util['format']('%s/channels/voice/agents/%d/tickets/%d/display.json',_0x55ee74['remoteUri'],_0x508c46['id'],_0x50e69e['id']),'method':_0x7d54('0x26')});case _0x7d54('0x5e'):logger['info'](_0x7d54('0x5d'),_0x7d54('0x5f'));emit(util['format']('user:%s',_0x238210[_0x7d54('0xf')]),_0x7d54('0x53'),{'uri':util[_0x7d54('0xc')](_0x7d54('0x54'),_0x55ee74['remoteUri'],_0x50e69e['id'])});break;default:logger[_0x7d54('0x55')](_0x7d54('0x5d'),_0x7d54('0x56'));}}})[_0x7d54('0x57')](function(_0x151a47){logger[_0x7d54('0x55')](_0x7d54('0x60'),util['inspect'](_0x151a47,{'showHidden':!![],'depth':null}));});};exports['unmanaged']=function(_0x2e5956,_0x4f32d2,_0x770d4d,_0x37d990,_0xc2b893,_0x1b97da){var _0x3f0bdc,_0x454177;_0x1b97da['remoteUri']=intUtil[_0x7d54('0x44')](_0x1b97da[_0x7d54('0x17')]);_0x1b97da[_0x7d54('0x45')]=intUtil[_0x7d54('0x44')](_0x1b97da[_0x7d54('0x45')]);if(_0xc2b893&&_0xc2b893[_0x7d54('0x46')]){logger[_0x7d54('0x13')]('['+_0x4f32d2[_0x7d54('0x61')]['toUpperCase']()+']',_0x7d54('0x48'));_0x4f32d2[_0x7d54('0x49')]=util['format'](_0x7d54('0x4a'),_0x1b97da[_0x7d54('0x45')],_0x4f32d2['uniqueid'],md5(_0x4f32d2['uniqueid']));}else{_0x4f32d2[_0x7d54('0x49')]='';}headers['Authorization']=getAuth(_0x1b97da);return getUser(_0x1b97da)['then'](function(_0xb70943){_0x3f0bdc=_0xb70943;logger[_0x7d54('0x13')](_0x7d54('0x4c'),_0x3f0bdc['id']);return getEndUser(_0x1b97da,_0x4f32d2[_0x7d54('0x4d')],_0x4f32d2[_0x7d54('0x62')]);})['then'](function(_0x2f8d84){_0x454177=_0x2f8d84;logger[_0x7d54('0x13')](_0x7d54('0x63'),_0x454177['id']);return getTicket(_0x1b97da,_0x3f0bdc,_0x454177,_0x770d4d,_0x4f32d2);})['then'](function(_0x52baf0){if(_0x52baf0){logger['info'](_0x7d54('0x4e'),_0x52baf0['id']);}})['catch'](function(_0x4cd995){logger[_0x7d54('0x55')]('['+_0x4f32d2[_0x7d54('0x61')][_0x7d54('0x64')]()+']'+_0x7d54('0x65'),util[_0x7d54('0x59')](_0x4cd995,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0x0506=['Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/users/me.json','Admin\x20account\x20selected.','user','Searching\x20enduser\x20with\x20phone','type:user\x20role:end-user\x20phone:%s','length','filter','first','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','Caller\x20-\x20%s','%s:%s','password','authType','token','username','toString','base64','[HTTP]','defaults','forEach','type','string','nameField','toLowerCase','idField','customField','custom_fields','push','variable','variableName','customVariable','Variable','serverUrl','stripTrailingSlash','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','Authorization','The\x20User\x20ID\x20is:','calleridname','calleridnum','The\x20Ticket\x20ID\x20is:','integrationTab','[QUEUE]','Displaying\x20ticket\x20to\x20agent...','newTab','user:%s','trigger:browser:url','error','Zendesk\x20account\x20type\x20not\x20recognized','[QUEUE]\x20Error\x20running\x20Zendesk\x20integration','inspect','outbound','recordingFormat','[OUTBOUND]','destcalleridname','destcalleridnum','The\x20Enduser\x20ID\x20is:','%s/channels/voice/agents/%d/tickets/%d/display.json','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','%s/agent/tickets/%s','[OUTBOUND]\x20Error\x20running\x20Zendesk\x20integration','unmanaged','toUpperCase','catch','\x20Error\x20running\x20Zendesk\x20integration','lodash','request-promise','md5','../../../../config/logger','redis','localhost','socket.io-emitter','emit','application/json','info','Creating\x20new\x20ticket...','format','%s/tickets.json','remoteUri','POST','merge','name','Subjects','getString','Descriptions','Fields','Ticket\x20created!','ticket','validateEmail','Getting\x20agent\x20with\x20email','%s/search.json','type:user\x20role:agent\x20email:%s','then','results','agent'];(function(_0x19dc2d,_0x2b4a8b){var _0x145a78=function(_0x3385db){while(--_0x3385db){_0x19dc2d['push'](_0x19dc2d['shift']());}};_0x145a78(++_0x2b4a8b);}(_0x0506,0x1d1));var _0x6050=function(_0x13cb4f,_0x55405f){_0x13cb4f=_0x13cb4f-0x0;var _0x55bac8=_0x0506[_0x13cb4f];return _0x55bac8;};'use strict';var _=require(_0x6050('0x0'));var rp=require(_0x6050('0x1'));var md5=require(_0x6050('0x2'));var util=require('util');var Redis=require('ioredis');var intUtil=require('./util');var config=require('../../../../config/environment');var logger=require(_0x6050('0x3'))('zendesk');config[_0x6050('0x4')]=_['defaults'](config['redis'],{'host':_0x6050('0x5'),'port':0x18eb});var io=require(_0x6050('0x6'))(new Redis(config[_0x6050('0x4')]));function emit(_0x1a89fb,_0x3512ba,_0xf64de5){io['to'](_0x1a89fb)[_0x6050('0x7')](_0x3512ba,_0xf64de5);}var headers={'Content-Type':_0x6050('0x8'),'Accept':'application/json'};function getTicket(_0x312217,_0x4f149a,_0x15ad99,_0x1b0140,_0xd01ae7){logger[_0x6050('0x9')](_0x6050('0xa'));return request({'uri':util[_0x6050('0xb')](_0x6050('0xc'),_0x312217[_0x6050('0xd')]),'method':_0x6050('0xe'),'body':{'ticket':_[_0x6050('0xf')]({'requester_id':_0x15ad99['id'],'submitter_id':_0x4f149a?_0x4f149a['id']:undefined,'assignee_id':_0x4f149a?_0x4f149a['id']:undefined,'tags':getTags(_0x1b0140['Tags'],_0x6050('0x10')),'subject':intUtil['getString'](_0x1b0140[_0x6050('0x11')],_0xd01ae7,'\x20'),'description':intUtil[_0x6050('0x12')](_0x1b0140[_0x6050('0x13')],_0xd01ae7,'\x0a'),'comment':{'public':![],'body':intUtil[_0x6050('0x12')](_0x1b0140['Descriptions'],_0xd01ae7,'\x0a')}},getCustomFields(_0x1b0140[_0x6050('0x14')],_0xd01ae7))}})['then'](function(_0x377b42){logger[_0x6050('0x9')](_0x6050('0x15'));return _0x377b42[_0x6050('0x16')];});}function getUser(_0x4e33d1,_0x25976e){if(intUtil[_0x6050('0x17')](_0x25976e)){logger[_0x6050('0x9')](_0x6050('0x18'),_0x25976e);return request({'uri':util[_0x6050('0xb')](_0x6050('0x19'),_0x4e33d1[_0x6050('0xd')]),'qs':{'query':util['format'](_0x6050('0x1a'),_0x25976e)}})[_0x6050('0x1b')](function(_0x44e65d){if(_0x44e65d['count']){logger['info']('Agent\x20found!');return _['find'](_0x44e65d[_0x6050('0x1c')],{'email':_0x25976e,'role':_0x6050('0x1d')});}else{logger['info'](_0x6050('0x1e'));return request({'uri':util[_0x6050('0xb')](_0x6050('0x1f'),_0x4e33d1[_0x6050('0xd')])})[_0x6050('0x1b')](function(_0x295b97){logger['info'](_0x6050('0x20'));return _0x295b97[_0x6050('0x21')];});}});}else{logger[_0x6050('0x9')](_0x6050('0x1e'));return request({'uri':util[_0x6050('0xb')](_0x6050('0x1f'),_0x4e33d1[_0x6050('0xd')])})[_0x6050('0x1b')](function(_0x509c3a){logger[_0x6050('0x9')]('Admin\x20account\x20selected.');return _0x509c3a[_0x6050('0x21')];});}}function getEndUser(_0x411dc9,_0xd6c11d,_0x84d562){logger[_0x6050('0x9')](_0x6050('0x22'),_0x84d562);return request({'uri':util['format'](_0x6050('0x19'),_0x411dc9[_0x6050('0xd')]),'qs':{'query':util[_0x6050('0xb')](_0x6050('0x23'),_0x84d562)}})['then'](function(_0x1527ea){var _0xaf9ebe;if(_0x1527ea[_0x6050('0x1c')][_0x6050('0x24')]){_0x1527ea[_0x6050('0x1c')]=_[_0x6050('0x25')](_0x1527ea[_0x6050('0x1c')],{'suspended':![],'role':'end-user'});if(_0x1527ea[_0x6050('0x1c')][_0x6050('0x24')]){_0xaf9ebe=_[_0x6050('0x26')](_0x1527ea[_0x6050('0x1c')]);}}if(_0xaf9ebe){logger[_0x6050('0x9')](_0x6050('0x27'));return _0xaf9ebe;}else{logger[_0x6050('0x9')](_0x6050('0x28'));return request({'uri':util[_0x6050('0xb')]('%s/users.json',_0x411dc9[_0x6050('0xd')]),'method':'POST','body':{'user':{'role':'end-user','name':util[_0x6050('0xb')](_0x6050('0x29'),_0xd6c11d||_0x84d562),'phone':_0x84d562}}})[_0x6050('0x1b')](function(_0x536f51){logger[_0x6050('0x9')]('Enduser\x20created.');return _0x536f51['user'];});}});}function getAuth(_0x10ad58){var _0x130b0d;if(_0x10ad58['authType']==='password'){_0x130b0d=util[_0x6050('0xb')](_0x6050('0x2a'),_0x10ad58['username'],_0x10ad58[_0x6050('0x2b')]);}else if(_0x10ad58[_0x6050('0x2c')]===_0x6050('0x2d')){_0x130b0d=util[_0x6050('0xb')]('%s/token:%s',_0x10ad58[_0x6050('0x2e')],_0x10ad58['token']);}return util[_0x6050('0xb')]('Basic\x20%s',new Buffer(_0x130b0d)[_0x6050('0x2f')](_0x6050('0x30')));}function request(_0x162941){logger['debug'](_0x6050('0x31'),JSON['stringify'](_0x162941));return rp(_[_0x6050('0x32')](_0x162941,{'method':'GET','headers':headers,'json':!![]}));}function getTags(_0x38a834,_0x56aab2){var _0xd8d8bb=[];if(_0x38a834&&_0x38a834[_0x6050('0x24')]>0x0){_0xd8d8bb=_['map'](_0x38a834,_0x56aab2);}return _0xd8d8bb;}function getCustomFields(_0x36fb0b,_0x31482f){var _0x547190=[];var _0x3d0973={'custom_fields':[]};if(_0x36fb0b[_0x6050('0x24')]>0x0){_[_0x6050('0x33')](_0x36fb0b,function(_0x481bde){if(_0x481bde[_0x6050('0x34')]===_0x6050('0x35')&&_0x481bde[_0x6050('0x36')]&&!_0x481bde['customField']){_0x3d0973[_0x481bde[_0x6050('0x36')][_0x6050('0x37')]()]=_0x481bde['content'][_0x6050('0x2f')]();}else if(_0x481bde[_0x6050('0x34')]===_0x6050('0x35')&&_0x481bde[_0x6050('0x38')]&&_0x481bde[_0x6050('0x39')]){_0x3d0973[_0x6050('0x3a')][_0x6050('0x3b')]({'id':_0x481bde[_0x6050('0x38')],'value':_0x481bde['content']['toString']()});}else if(_0x481bde[_0x6050('0x34')]===_0x6050('0x3c')&&_0x481bde['variableName']&&_0x481bde[_0x6050('0x38')]&&_0x481bde['customField']){_0x31482f[_0x481bde[_0x6050('0x3d')]]&&_0x3d0973[_0x6050('0x3a')][_0x6050('0x3b')]({'id':_0x481bde[_0x6050('0x38')],'value':_0x31482f[_0x481bde[_0x6050('0x3d')]][_0x6050('0x2f')]()});}else if(_0x481bde[_0x6050('0x34')]===_0x6050('0x3e')&&_0x481bde['Variable']&&_0x481bde['Variable']['name']&&_0x481bde[_0x6050('0x38')]&&_0x481bde[_0x6050('0x39')]){_0x31482f[_0x481bde[_0x6050('0x3f')][_0x6050('0x10')][_0x6050('0x37')]()]&&_0x3d0973[_0x6050('0x3a')][_0x6050('0x3b')]({'id':_0x481bde[_0x6050('0x38')],'value':_0x31482f[_0x481bde[_0x6050('0x3f')][_0x6050('0x10')][_0x6050('0x37')]()][_0x6050('0x2f')]()});}});}return _0x3d0973;}exports['queue']=function(_0x5ebc99,_0x2da74d,_0x377aa2,_0x13bcbe,_0x750dd8,_0x4ff116){var _0x5c0464,_0x1eae98;_0x4ff116[_0x6050('0xd')]=intUtil['stripTrailingSlash'](_0x4ff116[_0x6050('0xd')]);_0x4ff116[_0x6050('0x40')]=intUtil[_0x6050('0x41')](_0x4ff116['serverUrl']);if(_0x750dd8&&_0x750dd8['monitor_format']){logger['info']('[QUEUE]',_0x6050('0x42'));_0x2da74d[_0x6050('0x43')]=util[_0x6050('0xb')](_0x6050('0x44'),_0x4ff116[_0x6050('0x40')],_0x2da74d[_0x6050('0x45')],md5(_0x2da74d[_0x6050('0x45')]));}else{_0x2da74d[_0x6050('0x43')]='';}headers[_0x6050('0x46')]=getAuth(_0x4ff116);return getUser(_0x4ff116,_0x13bcbe['email'])[_0x6050('0x1b')](function(_0x1ea604){_0x5c0464=_0x1ea604;logger[_0x6050('0x9')](_0x6050('0x47'),_0x5c0464['id']);return getEndUser(_0x4ff116,_0x2da74d[_0x6050('0x48')],_0x2da74d[_0x6050('0x49')]);})[_0x6050('0x1b')](function(_0x13008e){_0x1eae98=_0x13008e;logger['info']('The\x20Enduser\x20ID\x20is:',_0x1eae98['id']);return getTicket(_0x4ff116,_0x5c0464,_0x1eae98,_0x377aa2,_0x2da74d);})['then'](function(_0x3754c6){if(_0x3754c6){logger[_0x6050('0x9')](_0x6050('0x4a'),_0x3754c6['id']);switch(_0x4ff116[_0x6050('0x34')]){case _0x6050('0x4b'):logger['info'](_0x6050('0x4c'),_0x6050('0x4d'));return request({'uri':util[_0x6050('0xb')]('%s/channels/voice/agents/%d/tickets/%d/display.json',_0x4ff116[_0x6050('0xd')],_0x5c0464['id'],_0x3754c6['id']),'method':_0x6050('0xe')});case _0x6050('0x4e'):logger[_0x6050('0x9')](_0x6050('0x4c'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0x6050('0xb')](_0x6050('0x4f'),_0x13bcbe['name']),_0x6050('0x50'),{'uri':util[_0x6050('0xb')]('%s/agent/tickets/%s',_0x4ff116[_0x6050('0xd')],_0x3754c6['id'])});break;default:logger[_0x6050('0x51')](_0x6050('0x4c'),_0x6050('0x52'));}}})['catch'](function(_0x57972f){logger[_0x6050('0x51')](_0x6050('0x53'),util[_0x6050('0x54')](_0x57972f,{'showHidden':!![],'depth':null}));});};exports[_0x6050('0x55')]=function(_0x328424,_0x2377cb,_0x288336,_0x412f73,_0xe4df85,_0x232c9f,_0x3ba734){var _0x4661d0,_0x21774f;_0x232c9f['remoteUri']=intUtil['stripTrailingSlash'](_0x232c9f[_0x6050('0xd')]);_0x232c9f['serverUrl']=intUtil[_0x6050('0x41')](_0x232c9f['serverUrl']);if(_0x3ba734&&_0x3ba734[_0x6050('0x56')]&&_0x3ba734[_0x6050('0x56')]!=='none'){logger[_0x6050('0x9')](_0x6050('0x57'),_0x6050('0x42'));_0x2377cb[_0x6050('0x43')]=util[_0x6050('0xb')](_0x6050('0x44'),_0x232c9f[_0x6050('0x40')],_0x2377cb['uniqueid'],md5(_0x2377cb[_0x6050('0x45')]));}headers['Authorization']=getAuth(_0x232c9f);return getUser(_0x232c9f,_0x412f73['email'])[_0x6050('0x1b')](function(_0x551a79){_0x4661d0=_0x551a79;logger[_0x6050('0x9')](_0x6050('0x47'),_0x4661d0['id']);return getEndUser(_0x232c9f,_0x2377cb[_0x6050('0x58')],_0x2377cb[_0x6050('0x59')]);})['then'](function(_0x3e631a){_0x21774f=_0x3e631a;logger['info'](_0x6050('0x5a'),_0x21774f['id']);return getTicket(_0x232c9f,_0x4661d0,_0x21774f,_0x288336,_0x2377cb);})[_0x6050('0x1b')](function(_0x4e2f46){if(_0x4e2f46){logger[_0x6050('0x9')](_0x6050('0x4a'),_0x4e2f46['id']);switch(_0x232c9f[_0x6050('0x34')]){case _0x6050('0x4b'):logger[_0x6050('0x9')](_0x6050('0x57'),'Displaying\x20ticket\x20to\x20agent...');return request({'uri':util[_0x6050('0xb')](_0x6050('0x5b'),_0x232c9f[_0x6050('0xd')],_0x4661d0['id'],_0x4e2f46['id']),'method':_0x6050('0xe')});case _0x6050('0x4e'):logger[_0x6050('0x9')](_0x6050('0x57'),_0x6050('0x5c'));emit(util['format'](_0x6050('0x4f'),_0x412f73[_0x6050('0x10')]),_0x6050('0x50'),{'uri':util[_0x6050('0xb')](_0x6050('0x5d'),_0x232c9f[_0x6050('0xd')],_0x4e2f46['id'])});break;default:logger[_0x6050('0x51')](_0x6050('0x57'),'Zendesk\x20account\x20type\x20not\x20recognized');}}})['catch'](function(_0x48a6ac){logger['error'](_0x6050('0x5e'),util[_0x6050('0x54')](_0x48a6ac,{'showHidden':!![],'depth':null}));});};exports[_0x6050('0x5f')]=function(_0x551c9b,_0x1e9dd2,_0x10cb94,_0x4d7edf,_0x3d6b35,_0x56ce47){var _0x20534f,_0x10161f;_0x56ce47['remoteUri']=intUtil[_0x6050('0x41')](_0x56ce47[_0x6050('0xd')]);_0x56ce47[_0x6050('0x40')]=intUtil[_0x6050('0x41')](_0x56ce47[_0x6050('0x40')]);if(_0x3d6b35&&_0x3d6b35['monitor_format']){logger[_0x6050('0x9')]('['+_0x1e9dd2['lastevent'][_0x6050('0x60')]()+']',_0x6050('0x42'));_0x1e9dd2[_0x6050('0x43')]=util[_0x6050('0xb')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x56ce47[_0x6050('0x40')],_0x1e9dd2[_0x6050('0x45')],md5(_0x1e9dd2['uniqueid']));}else{_0x1e9dd2['recordingURL']='';}headers[_0x6050('0x46')]=getAuth(_0x56ce47);return getUser(_0x56ce47)[_0x6050('0x1b')](function(_0x416195){_0x20534f=_0x416195;logger[_0x6050('0x9')](_0x6050('0x47'),_0x20534f['id']);return getEndUser(_0x56ce47,_0x1e9dd2['calleridname'],_0x1e9dd2[_0x6050('0x49')]);})['then'](function(_0x228115){_0x10161f=_0x228115;logger[_0x6050('0x9')](_0x6050('0x5a'),_0x10161f['id']);return getTicket(_0x56ce47,_0x20534f,_0x10161f,_0x10cb94,_0x1e9dd2);})['then'](function(_0x37897f){if(_0x37897f){logger[_0x6050('0x9')](_0x6050('0x4a'),_0x37897f['id']);}})[_0x6050('0x61')](function(_0x2ee6ce){logger[_0x6050('0x51')]('['+_0x1e9dd2['lastevent'][_0x6050('0x60')]()+']'+_0x6050('0x62'),util[_0x6050('0x54')](_0x2ee6ce,{'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 3cf4f22..2e69b1b 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 _0x8caf=['idField','toString','variable','variableName','Variable','name','toLowerCase','split','isNil','access_token','expires_in','zone','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.com.cn','https://accounts.zoho.eu','/oauth/v2/token','refreshToken','clientId','clientSecret','refresh_token','then','add','seconds','catch','stack','GET','format','https://www.zohoapis.%s/crm/v2/users','Zoho-oauthtoken\x20','users','isArrayLikeObject','findIndex','email','info','Agent\x20found!','profile','user','Administrator','Using\x20the\x20admin\x20account!','The\x20failing\x20result\x20is','error','data','enduserType','POST','https://www.zohoapis.','/crm/v2/','startCase','role','first_name','last_name','code','SUCCESS','details','moduleCreate','CREATE\x20ERROR','moduleSearch','contact_lead','/crm/v2/Contacts/search?criteria=((Phone:equals:','Contacts','uri','Leads','nothing','contact','/crm/v2/Leads/search?criteria=((Phone:equals:','Owner','administrator','Subject','Subjects','Description','getString','Descriptions','Full_Name','First_Name','Last_Name','What_Id','$se_module','talktime','Call_Duration','utc','mm:ss','answertime','endtime','YYYY-MM-DDTHH:mm:ss','starttime','lastevent','called','Called','complete','connect','Call_Result','Answered','Rejected','abandoned','timeout','Timeout','Call_Start_Time','outbound','Call_Type','Inbound','merge','/crm/v2/Calls','Call\x20created!','err','queue','stripTrailingSlash','host','serverUrl','monitor_format','[QUEUE]','recordingURL','/api/voice/recordings/','uniqueid','/downloads?type=uniqueid&token=','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','https://crm.','/crm/EntityInfo.do?module=Calls&id=','recordingFormat','Recording\x20is\x20enabled!','destcalleridname','destcalleridnum','[OUTBOUND]','toUpperCase','calleridnum','request-promise','md5','util','./util','moment','ioredis','../../../../config/environment','../../../../config/logger','zoho','redis','defaults','socket.io-emitter','[HTTP]','stringify','length','forEach','type'];(function(_0x3ae516,_0x4b97c5){var _0x2b257a=function(_0x1aa718){while(--_0x1aa718){_0x3ae516['push'](_0x3ae516['shift']());}};_0x2b257a(++_0x4b97c5);}(_0x8caf,0x1ab));var _0xf8ca=function(_0x32665e,_0x12740e){_0x32665e=_0x32665e-0x0;var _0x10be45=_0x8caf[_0x32665e];return _0x10be45;};'use strict';var _=require('lodash');var rp=require(_0xf8ca('0x0'));var md5=require(_0xf8ca('0x1'));var util=require(_0xf8ca('0x2'));var intUtil=require(_0xf8ca('0x3'));var moment=require(_0xf8ca('0x4'));var Redis=require(_0xf8ca('0x5'));var BPromise=require('bluebird');var config=require(_0xf8ca('0x6'));var logger=require(_0xf8ca('0x7'))(_0xf8ca('0x8'));config[_0xf8ca('0x9')]=_[_0xf8ca('0xa')](config[_0xf8ca('0x9')],{'host':'localhost','port':0x18eb});var io=require(_0xf8ca('0xb'))(new Redis(config[_0xf8ca('0x9')]));function emit(_0x3a91d3,_0x31300c,_0x5b7eb8){io['to'](_0x3a91d3)['emit'](_0x31300c,_0x5b7eb8);}function request(_0x3a9674){logger['debug'](_0xf8ca('0xc'),JSON[_0xf8ca('0xd')](_0x3a9674));return rp(_0x3a9674);}function getCustomFields(_0x2daa43,_0x2be477){var _0x5c6c83={};if(_0x2daa43[_0xf8ca('0xe')]>0x0){_[_0xf8ca('0xf')](_0x2daa43,function(_0x16e3bb){if(_0x16e3bb[_0xf8ca('0x10')]==='string'&&_0x16e3bb[_0xf8ca('0x11')]){_0x5c6c83[_0x16e3bb[_0xf8ca('0x11')]]=_0x16e3bb['content'][_0xf8ca('0x12')]();}else if(_0x16e3bb[_0xf8ca('0x10')]===_0xf8ca('0x13')&&_0x16e3bb[_0xf8ca('0x14')]&&_0x16e3bb[_0xf8ca('0x11')]&&_0x2be477[_0x16e3bb[_0xf8ca('0x14')]]){_0x5c6c83[_0x16e3bb[_0xf8ca('0x11')]]=_0x2be477[_0x16e3bb[_0xf8ca('0x14')]][_0xf8ca('0x12')]();}else if(_0x16e3bb[_0xf8ca('0x10')]==='customVariable'&&_0x16e3bb[_0xf8ca('0x15')]&&_0x16e3bb[_0xf8ca('0x15')][_0xf8ca('0x16')]&&_0x16e3bb[_0xf8ca('0x11')]&&_0x2be477[_0x16e3bb[_0xf8ca('0x15')][_0xf8ca('0x16')][_0xf8ca('0x17')]()]){_0x5c6c83[_0x16e3bb[_0xf8ca('0x11')]]=_0x2be477[_0x16e3bb['Variable'][_0xf8ca('0x16')][_0xf8ca('0x17')]()][_0xf8ca('0x12')]();}});}return _0x5c6c83;}function getName(_0xda0419){if(_0xda0419['indexOf']('\x20')>0x0){var _0x1b6cf4=_0xda0419[_0xf8ca('0x18')](/ (.+)/);if(_0x1b6cf4[0x1]){return _0x1b6cf4;}}return[_0xda0419,_0xda0419];}var accountsTokens={};function getAccessToken(_0x32308c){return new Promise(function(_0x2ce194,_0x18e8da){if(!_[_0xf8ca('0x19')](accountsTokens[_0x32308c['id']])&&!_['isNil'](accountsTokens[_0x32308c['id']][_0xf8ca('0x1a')])){if(moment()['isBefore'](accountsTokens[_0x32308c['id']][_0xf8ca('0x1b')])){_0x2ce194(accountsTokens[_0x32308c['id']][_0xf8ca('0x1a')]);}}var _0x179a48;switch(_0x32308c[_0xf8ca('0x1c')]){case'US':_0x179a48=_0xf8ca('0x1d');break;case'AU':_0x179a48=_0xf8ca('0x1e');break;case'EU':_0x179a48='https://accounts.zoho.eu';break;case'IN':_0x179a48='https://accounts.zoho.in';break;case'CN':_0x179a48=_0xf8ca('0x1f');break;default:_0x179a48=_0xf8ca('0x20');break;}var _0x4962a5={'method':'POST','uri':_0x179a48+_0xf8ca('0x21'),'qs':{'refresh_token':_0x32308c[_0xf8ca('0x22')],'client_id':_0x32308c[_0xf8ca('0x23')],'client_secret':_0x32308c[_0xf8ca('0x24')],'grant_type':_0xf8ca('0x25')},'json':!![]};return rp(_0x4962a5)[_0xf8ca('0x26')](function(_0x59279d){accountsTokens[_0x32308c['id']]={'access_token':_0x59279d[_0xf8ca('0x1a')],'expires_in':moment()[_0xf8ca('0x27')](_0x59279d[_0xf8ca('0x1b')],_0xf8ca('0x28'))};_0x2ce194(_0x59279d[_0xf8ca('0x1a')]);})[_0xf8ca('0x29')](function(_0x815050){logger['error']('Failing\x20creating\x20the\x20access_token',_0x815050[_0xf8ca('0x2a')]);_0x18e8da(_0x815050);});});}function getUser(_0x873e43,_0x3a2ce4,_0x53b949,_0x1ff6c0){logger['info']('Search\x20user');return request({'method':_0xf8ca('0x2b'),'uri':util[_0xf8ca('0x2c')](_0xf8ca('0x2d'),_0x3a2ce4),'qs':{'type':'ActiveUsers'},'headers':{'Authorization':_0xf8ca('0x2e')+_0x873e43},'json':!![]})[_0xf8ca('0x26')](function(_0x48bbc5){if(_0x48bbc5[_0xf8ca('0x2f')]){var _0x5ab3a6=-0x1;if(_[_0xf8ca('0x30')](_0x48bbc5['users'])){if(!_['isNil'](_0x1ff6c0)){_0x5ab3a6=_[_0xf8ca('0x31')](_0x48bbc5[_0xf8ca('0x2f')],function(_0x22fda1){return _0x22fda1[_0xf8ca('0x32')]===_0x1ff6c0;});}if(_0x5ab3a6>=0x0){logger[_0xf8ca('0x33')](_0xf8ca('0x34'));}else{logger[_0xf8ca('0x33')]('Using\x20the\x20admin\x20account!');_0x5ab3a6=_[_0xf8ca('0x31')](_0x48bbc5[_0xf8ca('0x2f')],function(_0x176a58){return _0x176a58[_0xf8ca('0x35')][_0xf8ca('0x16')]==='Administrator';});}return _0x48bbc5[_0xf8ca('0x2f')][_0x5ab3a6];}else{if(_0x48bbc5[_0xf8ca('0x36')][_0xf8ca('0x35')][_0xf8ca('0x16')]===_0xf8ca('0x37')){logger[_0xf8ca('0x33')](_0xf8ca('0x38'));user=_0x48bbc5[_0xf8ca('0x36')];return user;}else{logger['error'](_0xf8ca('0x39'),JSON[_0xf8ca('0xd')](_0x48bbc5));throw new Error('Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20'+JSON[_0xf8ca('0xd')](_0x48bbc5));}}}else{logger[_0xf8ca('0x3a')](_0xf8ca('0x39'),JSON[_0xf8ca('0xd')](_0x48bbc5));throw new Error('Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20'+JSON['stringify'](_0x48bbc5));}})[_0xf8ca('0x29')](function(_0x1645e2){console['error'](_0x1645e2);});}function getZohoUser(_0x4cdaec,_0x4927bc){return new BPromise(function(_0x4a15a0,_0x3d697f){request(_0x4cdaec)[_0xf8ca('0x26')](function(_0x4a47ac){var _0x523904=null;if(_0x4a47ac){_0x523904=_0x4a47ac[_0xf8ca('0x3b')][0x0];_0x523904[_0xf8ca('0x3c')]=_0x4927bc;}_0x4a15a0(_0x523904);})[_0xf8ca('0x29')](function(_0x24ec1f){_0x3d697f(_0x24ec1f);});});}function createEndUser(_0x53ae43,_0xaf283e,_0x578f96,_0x219a0b,_0xdf3d08,_0x4cc29e){var _0x578f96=getName(_0x578f96);return request({'method':_0xf8ca('0x3d'),'uri':_0xf8ca('0x3e')+_0xaf283e+_0xf8ca('0x3f')+_[_0xf8ca('0x40')](_0x4cc29e['moduleCreate'])+'s','body':{'data':[{'Last_Name':_0x578f96[0x1],'First_Name':_0x578f96[0x0],'Phone':_0x219a0b,'Owner':{'name':!_[_0xf8ca('0x19')](_0xdf3d08[_0xf8ca('0x41')][_0xf8ca('0x16')])?_0xdf3d08[_0xf8ca('0x41')]['name']:!_[_0xf8ca('0x19')](_0xdf3d08[_0xf8ca('0x42')])?_0xdf3d08[_0xf8ca('0x42')]+'\x20'+_0xdf3d08[_0xf8ca('0x43')]:_0xdf3d08[_0xf8ca('0x43')],'id':_0xdf3d08['id']}}]},'headers':{'Authorization':_0xf8ca('0x2e')+_0x53ae43},'json':!![]})[_0xf8ca('0x26')](function(_0x9d924){if(_0x9d924&&_0x9d924[_0xf8ca('0x3b')][0x0][_0xf8ca('0x44')]===_0xf8ca('0x45')){var _0x5f6b06=_0x9d924[_0xf8ca('0x3b')][0x0][_0xf8ca('0x46')];_0x5f6b06['enduserType']=_[_0xf8ca('0x40')](_0x4cc29e[_0xf8ca('0x47')])+'s';return _0x5f6b06;}logger['error'](_0xf8ca('0x39'),JSON[_0xf8ca('0xd')](data));throw new Error('Error:\x20'+JSON[_0xf8ca('0xd')](data));})['catch'](function(_0x4d651c){console['log'](_0xf8ca('0x48'),_0x4d651c);});}function getEndUser(_0xa5470b,_0x1998f6,_0xd3aa4f,_0x11ff65,_0x322ccb,_0x48a3db,_0x3756cb){var _0x130e62={'method':_0xf8ca('0x2b'),'uri':'','headers':{'Authorization':'Zoho-oauthtoken\x20'+_0xa5470b},'json':!![]};switch(_0x3756cb[_0xf8ca('0x49')]){case _0xf8ca('0x4a'):_0x130e62['uri']=_0xf8ca('0x3e')+_0x1998f6+_0xf8ca('0x4b')+_0x322ccb+'))';return getZohoUser(_0x130e62,_0xf8ca('0x4c'))[_0xf8ca('0x26')](function(_0x37fd35){if(_0x37fd35)return _0x37fd35;_0x130e62[_0xf8ca('0x4d')]=_0xf8ca('0x3e')+_0x1998f6+'/crm/v2/Leads/search?criteria=((Phone:equals:'+_0x322ccb+'))';return getZohoUser(_0x130e62,_0xf8ca('0x4e'))[_0xf8ca('0x26')](function(_0x47e4a4){if(_0x47e4a4)return _0x47e4a4;if(_0x3756cb[_0xf8ca('0x47')]!=_0xf8ca('0x4f')){return createEndUser(_0xa5470b,_0x1998f6,_0x11ff65,_0x322ccb,_0x48a3db,_0x3756cb);}else{return{};}});});break;case _0xf8ca('0x50'):_0x130e62[_0xf8ca('0x4d')]=_0xf8ca('0x3e')+_0x1998f6+_0xf8ca('0x4b')+_0x322ccb+'))';return getZohoUser(_0x130e62,_0xf8ca('0x4c'))[_0xf8ca('0x26')](function(_0x3957b5){if(_0x3957b5)return _0x3957b5;if(_0x3756cb['moduleCreate']!=_0xf8ca('0x4f')){return createEndUser(_0xa5470b,_0x1998f6,_0x11ff65,_0x322ccb,_0x48a3db,_0x3756cb);}else{return{};}});break;case'lead':_0x130e62[_0xf8ca('0x4d')]=_0xf8ca('0x3e')+_0x1998f6+_0xf8ca('0x51')+_0x322ccb+'))';return getZohoUser(_0x130e62,_0xf8ca('0x4e'))['then'](function(_0x1b0643){if(_0x1b0643)return _0x1b0643;if(_0x3756cb[_0xf8ca('0x47')]!=_0xf8ca('0x4f')){return createEndUser(_0xa5470b,_0x1998f6,_0x11ff65,_0x322ccb,_0x48a3db,_0x3756cb);}else{return{};}});break;}}function getCall(_0x31685d,_0x45009a,_0x186358,_0xd7381a,_0x2dbd3b,_0x41eacc,_0x272a31,_0x31297f){logger[_0xf8ca('0x33')]('Creating\x20new\x20call...');var _0x5d1fdb={};_0x5d1fdb[_0xf8ca('0x52')]={'name':!_[_0xf8ca('0x19')](_0xd7381a[_0xf8ca('0x41')][_0xf8ca('0x16')])&&!_['isNil'](_0xd7381a[_0xf8ca('0x35')][_0xf8ca('0x16')])&&_0xd7381a[_0xf8ca('0x35')][_0xf8ca('0x16')]===_0xf8ca('0x53')?_0xd7381a[_0xf8ca('0x41')][_0xf8ca('0x16')]:!_[_0xf8ca('0x19')](_0xd7381a['first_name'])?_0xd7381a[_0xf8ca('0x42')]+'\x20'+_0xd7381a[_0xf8ca('0x43')]:_0xd7381a[_0xf8ca('0x43')],'id':_0xd7381a['id']};_0x5d1fdb[_0xf8ca('0x54')]=intUtil['getString'](_0x41eacc[_0xf8ca('0x55')],_0x272a31,'\x20');_0x5d1fdb[_0xf8ca('0x56')]=intUtil[_0xf8ca('0x57')](_0x41eacc[_0xf8ca('0x58')],_0x272a31,'\x0a');if(_0x2dbd3b['enduserType']===_0xf8ca('0x4c')){_0x5d1fdb['Who_Id']={'name':!_[_0xf8ca('0x19')](_0x2dbd3b[_0xf8ca('0x59')])?_0x2dbd3b[_0xf8ca('0x59')]:!_['isNil'](_0x2dbd3b[_0xf8ca('0x5a')])?_0x2dbd3b[_0xf8ca('0x5a')]+'\x20'+_0x2dbd3b[_0xf8ca('0x5b')]:_0x2dbd3b[_0xf8ca('0x5b')],'id':_0x2dbd3b['id']};}if(_0x2dbd3b[_0xf8ca('0x3c')]===_0xf8ca('0x4e')){_0x5d1fdb[_0xf8ca('0x5c')]={'name':!_[_0xf8ca('0x19')](_0x2dbd3b[_0xf8ca('0x59')])?_0x2dbd3b['Full_Name']:!_[_0xf8ca('0x19')](_0x2dbd3b[_0xf8ca('0x5a')])?_0x2dbd3b[_0xf8ca('0x5a')]+'\x20'+_0x2dbd3b[_0xf8ca('0x5b')]:_0x2dbd3b[_0xf8ca('0x5b')],'id':_0x2dbd3b['id']};_0x5d1fdb[_0xf8ca('0x5d')]=_[_0xf8ca('0x40')](_0x2dbd3b[_0xf8ca('0x3c')]);}if(_0x272a31[_0xf8ca('0x5e')]){_0x5d1fdb[_0xf8ca('0x5f')]=moment[_0xf8ca('0x60')](parseInt(_0x272a31['talktime'])*0x3e8)[_0xf8ca('0x2c')](_0xf8ca('0x61'));}else if(_0x272a31[_0xf8ca('0x62')]&&_0x272a31[_0xf8ca('0x63')]){_0x5d1fdb[_0xf8ca('0x5f')]=moment[_0xf8ca('0x60')](moment(_0x272a31[_0xf8ca('0x63')],_0xf8ca('0x64'))['diff'](moment(_0x272a31[_0xf8ca('0x65')],_0xf8ca('0x64'))))[_0xf8ca('0x2c')](_0xf8ca('0x61'));}switch(_0x272a31[_0xf8ca('0x66')]){case _0xf8ca('0x67'):_0x5d1fdb['Call_Result']=_0xf8ca('0x68');break;case _0xf8ca('0x69'):case _0xf8ca('0x6a'):_0x5d1fdb[_0xf8ca('0x6b')]=_0xf8ca('0x6c');break;case'rejected':_0x5d1fdb[_0xf8ca('0x6b')]=_0xf8ca('0x6d');break;case _0xf8ca('0x6e'):_0x5d1fdb[_0xf8ca('0x6b')]='Abandoned';break;case _0xf8ca('0x6f'):_0x5d1fdb['Call_Result']=_0xf8ca('0x70');default:}_0x5d1fdb[_0xf8ca('0x71')]=(_0x31297f===_0xf8ca('0x72')?moment(_0x272a31[_0xf8ca('0x65')])['format']('YYYY-MM-DDTHH:mm:ss'):moment(_0x272a31['agentcalledAt'])[_0xf8ca('0x2c')](_0xf8ca('0x64')))||moment()[_0xf8ca('0x2c')](_0xf8ca('0x64'));_0x5d1fdb[_0xf8ca('0x73')]=_0x31297f||_0xf8ca('0x74');_0x5d1fdb=_[_0xf8ca('0x75')](_0x5d1fdb,getCustomFields(_0x41eacc['Fields'],_0x272a31));return request({'method':_0xf8ca('0x3d'),'uri':_0xf8ca('0x3e')+_0x45009a+_0xf8ca('0x76'),'headers':{'Authorization':_0xf8ca('0x2e')+_0x31685d},'body':{'data':[_0x5d1fdb]},'json':!![]})[_0xf8ca('0x26')](function(_0x1d0a6f){if(_0x1d0a6f&&_0x1d0a6f[_0xf8ca('0x3b')][0x0]['code']===_0xf8ca('0x45')){logger[_0xf8ca('0x33')](_0xf8ca('0x77'));return{'id':_0x1d0a6f[_0xf8ca('0x3b')][0x0][_0xf8ca('0x46')]['id']};}})[_0xf8ca('0x29')](function(_0x3779f2){logger[_0xf8ca('0x33')]('err',_0x3779f2[_0xf8ca('0x2a')]);console['log'](_0xf8ca('0x78'),_0x3779f2);});}exports[_0xf8ca('0x79')]=function(_0x5c39c8,_0x1285ee,_0xa00768,_0x4c514f,_0xa7141e,_0x48e527){var _0x5a2cf1,_0x5ba366,_0x50a4d6;_0x48e527['host']=intUtil[_0xf8ca('0x7a')](_0x48e527[_0xf8ca('0x7b')]);_0x48e527[_0xf8ca('0x7c')]=intUtil[_0xf8ca('0x7a')](_0x48e527[_0xf8ca('0x7c')]);if(_0xa7141e&&_0xa7141e[_0xf8ca('0x7d')]){logger[_0xf8ca('0x33')](_0xf8ca('0x7e'),'Recording\x20is\x20enabled!');_0x1285ee[_0xf8ca('0x7f')]=_0x48e527[_0xf8ca('0x7c')]+_0xf8ca('0x80')+_0x1285ee[_0xf8ca('0x81')]+_0xf8ca('0x82')+md5(_0x1285ee[_0xf8ca('0x81')]);}else{_0x1285ee[_0xf8ca('0x7f')]='';}var _0x541294=_0x48e527[_0xf8ca('0x7b')]===_0xf8ca('0x83')?'eu':_0xf8ca('0x84');return getAccessToken(_0x48e527)[_0xf8ca('0x26')](function(_0x213ef0){_0x50a4d6=_0x213ef0;return getUser(_0x50a4d6,_0x541294,_0x48e527,_0x4c514f[_0xf8ca('0x32')]);})[_0xf8ca('0x26')](function(_0x5aff25){_0x5a2cf1=_0x5aff25;logger['info'](_0xf8ca('0x85'),_0x5a2cf1['id']);return getEndUser(_0x50a4d6,_0x541294,_0x48e527,_0x1285ee[_0xf8ca('0x86')],_0x1285ee['calleridnum'],_0x5a2cf1,_0xa00768);})['then'](function(_0x26ae7e){_0x5ba366=_0x26ae7e;return getCall(_0x50a4d6,_0x541294,_0x48e527,_0x5a2cf1,_0x5ba366,_0xa00768,_0x1285ee,_0xf8ca('0x74'));})[_0xf8ca('0x26')](function(_0x5351de){if(_0x5351de){logger['info'](_0xf8ca('0x87'),_0x5351de['id']);logger['info'](_0xf8ca('0x7e'),_0xf8ca('0x88'));emit(util[_0xf8ca('0x2c')](_0xf8ca('0x89'),_0x4c514f[_0xf8ca('0x16')]),_0xf8ca('0x8a'),{'uri':_0xf8ca('0x8b')+_0x48e527[_0xf8ca('0x7b')]+_0xf8ca('0x8c')+_0x5351de['id']});}})[_0xf8ca('0x29')](function(_0x4eb918){logger[_0xf8ca('0x3a')](_0xf8ca('0x7e'),JSON[_0xf8ca('0xd')](_0x4eb918));});};exports[_0xf8ca('0x72')]=function(_0x4c71b0,_0x44f1f7,_0x2c3e0b,_0x3ff65e,_0x3704ed,_0x718411,_0x206804){var _0x361084,_0x153b1d,_0x37f705;_0x718411[_0xf8ca('0x7b')]=intUtil[_0xf8ca('0x7a')](_0x718411['host']);_0x718411[_0xf8ca('0x7c')]=intUtil[_0xf8ca('0x7a')](_0x718411[_0xf8ca('0x7c')]);if(_0x206804&&_0x206804[_0xf8ca('0x8d')]&&_0x206804[_0xf8ca('0x8d')]!=='none'){logger['info']('[OUTBOUND]',_0xf8ca('0x8e'));_0x44f1f7[_0xf8ca('0x7f')]=_0x718411[_0xf8ca('0x7c')]+'/api/voice/recordings/'+_0x44f1f7[_0xf8ca('0x81')]+_0xf8ca('0x82')+md5(_0x44f1f7[_0xf8ca('0x81')]);}var _0x2f79fc=_0x718411[_0xf8ca('0x7b')]==='zoho.eu'?'eu':_0xf8ca('0x84');return getAccessToken(_0x718411)[_0xf8ca('0x26')](function(_0x52534f){_0x37f705=_0x52534f;return getUser(_0x37f705,_0x2f79fc,_0x718411,_0x3ff65e['email']);})[_0xf8ca('0x26')](function(_0x1cba2c){_0x361084=_0x1cba2c;logger[_0xf8ca('0x33')]('The\x20User\x20ID\x20is:',_0x361084['id']);return getEndUser(_0x37f705,_0x2f79fc,_0x718411,_0x44f1f7[_0xf8ca('0x8f')],_0x44f1f7[_0xf8ca('0x90')],_0x361084,_0x2c3e0b);})[_0xf8ca('0x26')](function(_0x553c21){_0x153b1d=_0x553c21;return getCall(_0x37f705,_0x2f79fc,_0x718411,_0x361084,_0x153b1d,_0x2c3e0b,_0x44f1f7,'Outbound');})[_0xf8ca('0x26')](function(_0x227c37){if(_0x227c37){logger['info'](_0xf8ca('0x87'),_0x227c37['id']);logger[_0xf8ca('0x33')](_0xf8ca('0x91'),'Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0xf8ca('0x2c')](_0xf8ca('0x89'),_0x3ff65e[_0xf8ca('0x16')]),_0xf8ca('0x8a'),{'uri':_0xf8ca('0x8b')+_0x718411[_0xf8ca('0x7b')]+_0xf8ca('0x8c')+_0x227c37['id']});}})[_0xf8ca('0x29')](function(_0x159219){logger['error'](_0xf8ca('0x91'),JSON[_0xf8ca('0xd')](_0x159219));});};exports['unmanaged']=function(_0x5cef15,_0x4429f4,_0x58d0a3,_0x419122,_0x6ee6f,_0x5d6699){var _0x35177b,_0x1d6287,_0x35e603;_0x5d6699[_0xf8ca('0x7b')]=intUtil[_0xf8ca('0x7a')](_0x5d6699[_0xf8ca('0x7b')]);_0x5d6699[_0xf8ca('0x7c')]=intUtil['stripTrailingSlash'](_0x5d6699[_0xf8ca('0x7c')]);if(_0x6ee6f&&_0x6ee6f['monitor_format']){logger[_0xf8ca('0x33')]('['+_0x4429f4['lastevent'][_0xf8ca('0x92')]()+']','Recording\x20is\x20enabled!');_0x4429f4[_0xf8ca('0x7f')]=_0x5d6699[_0xf8ca('0x7c')]+_0xf8ca('0x80')+_0x4429f4[_0xf8ca('0x81')]+_0xf8ca('0x82')+md5(_0x4429f4[_0xf8ca('0x81')]);}else{_0x4429f4[_0xf8ca('0x7f')]='';}var _0x423bb3=_0x5d6699[_0xf8ca('0x7b')]===_0xf8ca('0x83')?'eu':_0xf8ca('0x84');return getAccessToken(_0x5d6699)[_0xf8ca('0x26')](function(_0x153d8c){_0x35e603=_0x153d8c;return getUser(_0x35e603,_0x423bb3,_0x5d6699);})[_0xf8ca('0x26')](function(_0x2cdc2b){_0x35177b=_0x2cdc2b;logger[_0xf8ca('0x33')]('The\x20User\x20ID\x20is:',_0x35177b['id']);return getEndUser(_0x35e603,_0x423bb3,_0x5d6699,_0x4429f4[_0xf8ca('0x86')],_0x4429f4[_0xf8ca('0x93')],_0x35177b,_0x58d0a3);})[_0xf8ca('0x26')](function(_0x2a5319){_0x1d6287=_0x2a5319;return getCall(_0x35e603,_0x423bb3,_0x5d6699,_0x35177b,_0x1d6287,_0x58d0a3,_0x4429f4,_0xf8ca('0x74'));})['then'](function(_0x5b3fec){if(_0x5b3fec){logger[_0xf8ca('0x33')]('The\x20Call\x20ID\x20is:',_0x5b3fec['id']);}})[_0xf8ca('0x29')](function(_0xa14a9c){logger[_0xf8ca('0x3a')]('['+_0x4429f4[_0xf8ca('0x66')][_0xf8ca('0x92')]()+']',JSON['stringify'](_0xa14a9c));});}; \ No newline at end of file +var _0x7f48=['outbound','recordingFormat','none','[OUTBOUND]','recordingURL','/downloads?type=uniqueid&token=','destcalleridname','Outbound','trigger:browser:url','/crm/EntityInfo.do?module=Calls&id=','unmanaged','/api/voice/recordings/','com','calleridname','toUpperCase','lodash','request-promise','util','ioredis','bluebird','../../../../config/logger','zoho','redis','localhost','socket.io-emitter','emit','debug','[HTTP]','stringify','length','forEach','type','idField','content','variable','variableName','customVariable','Variable','name','toLowerCase','toString','indexOf','split','isNil','access_token','isBefore','expires_in','zone','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.eu','https://accounts.zoho.in','https://accounts.zoho.com.cn','/oauth/v2/token','refreshToken','clientId','clientSecret','refresh_token','then','add','catch','error','stack','info','Search\x20user','GET','format','ActiveUsers','isArrayLikeObject','users','findIndex','Agent\x20found!','Using\x20the\x20admin\x20account!','profile','Administrator','user','The\x20failing\x20result\x20is','Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20','data','POST','https://www.zohoapis.','/crm/v2/','startCase','moduleCreate','role','first_name','last_name','Zoho-oauthtoken\x20','code','SUCCESS','details','Error:\x20','log','CREATE\x20ERROR','moduleSearch','uri','/crm/v2/Contacts/search?criteria=((Phone:equals:','Contacts','Leads','nothing','lead','/crm/v2/Leads/search?criteria=((Phone:equals:','Creating\x20new\x20call...','Owner','administrator','getString','Subjects','Description','Descriptions','enduserType','Who_Id','Full_Name','First_Name','Last_Name','What_Id','$se_module','talktime','Call_Duration','mm:ss','answertime','endtime','utc','diff','starttime','lastevent','complete','connect','Answered','rejected','Call_Result','abandoned','Abandoned','timeout','Timeout','Call_Start_Time','YYYY-MM-DDTHH:mm:ss','agentcalledAt','Call_Type','merge','Fields','Call\x20created!','err','queue','host','serverUrl','stripTrailingSlash','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','uniqueid','zoho.eu','email','The\x20User\x20ID\x20is:','calleridnum','Inbound','The\x20Call\x20ID\x20is:','user:%s'];(function(_0x34c085,_0x47624b){var _0x9f7dc2=function(_0x3fcbed){while(--_0x3fcbed){_0x34c085['push'](_0x34c085['shift']());}};_0x9f7dc2(++_0x47624b);}(_0x7f48,0xac));var _0x87f4=function(_0x291f8b,_0x3b5591){_0x291f8b=_0x291f8b-0x0;var _0x275171=_0x7f48[_0x291f8b];return _0x275171;};'use strict';var _=require(_0x87f4('0x0'));var rp=require(_0x87f4('0x1'));var md5=require('md5');var util=require(_0x87f4('0x2'));var intUtil=require('./util');var moment=require('moment');var Redis=require(_0x87f4('0x3'));var BPromise=require(_0x87f4('0x4'));var config=require('../../../../config/environment');var logger=require(_0x87f4('0x5'))(_0x87f4('0x6'));config[_0x87f4('0x7')]=_['defaults'](config['redis'],{'host':_0x87f4('0x8'),'port':0x18eb});var io=require(_0x87f4('0x9'))(new Redis(config['redis']));function emit(_0x110be3,_0x26ee88,_0xa5c684){io['to'](_0x110be3)[_0x87f4('0xa')](_0x26ee88,_0xa5c684);}function request(_0x2efee0){logger[_0x87f4('0xb')](_0x87f4('0xc'),JSON[_0x87f4('0xd')](_0x2efee0));return rp(_0x2efee0);}function getCustomFields(_0x86348e,_0x13d6e3){var _0x50299a={};if(_0x86348e[_0x87f4('0xe')]>0x0){_[_0x87f4('0xf')](_0x86348e,function(_0x4da009){if(_0x4da009[_0x87f4('0x10')]==='string'&&_0x4da009[_0x87f4('0x11')]){_0x50299a[_0x4da009[_0x87f4('0x11')]]=_0x4da009[_0x87f4('0x12')]['toString']();}else if(_0x4da009[_0x87f4('0x10')]===_0x87f4('0x13')&&_0x4da009['variableName']&&_0x4da009['idField']&&_0x13d6e3[_0x4da009[_0x87f4('0x14')]]){_0x50299a[_0x4da009[_0x87f4('0x11')]]=_0x13d6e3[_0x4da009[_0x87f4('0x14')]]['toString']();}else if(_0x4da009[_0x87f4('0x10')]===_0x87f4('0x15')&&_0x4da009[_0x87f4('0x16')]&&_0x4da009['Variable']['name']&&_0x4da009['idField']&&_0x13d6e3[_0x4da009[_0x87f4('0x16')][_0x87f4('0x17')]['toLowerCase']()]){_0x50299a[_0x4da009[_0x87f4('0x11')]]=_0x13d6e3[_0x4da009['Variable'][_0x87f4('0x17')][_0x87f4('0x18')]()][_0x87f4('0x19')]();}});}return _0x50299a;}function getName(_0x3c09be){if(_0x3c09be[_0x87f4('0x1a')]('\x20')>0x0){var _0x466bbc=_0x3c09be[_0x87f4('0x1b')](/ (.+)/);if(_0x466bbc[0x1]){return _0x466bbc;}}return[_0x3c09be,_0x3c09be];}var accountsTokens={};function getAccessToken(_0x38e027){return new Promise(function(_0x1155ff,_0x71817d){if(!_[_0x87f4('0x1c')](accountsTokens[_0x38e027['id']])&&!_[_0x87f4('0x1c')](accountsTokens[_0x38e027['id']][_0x87f4('0x1d')])){if(moment()[_0x87f4('0x1e')](accountsTokens[_0x38e027['id']][_0x87f4('0x1f')])){_0x1155ff(accountsTokens[_0x38e027['id']][_0x87f4('0x1d')]);}}var _0x3c1e83;switch(_0x38e027[_0x87f4('0x20')]){case'US':_0x3c1e83=_0x87f4('0x21');break;case'AU':_0x3c1e83=_0x87f4('0x22');break;case'EU':_0x3c1e83=_0x87f4('0x23');break;case'IN':_0x3c1e83=_0x87f4('0x24');break;case'CN':_0x3c1e83=_0x87f4('0x25');break;default:_0x3c1e83=_0x87f4('0x23');break;}var _0x2eb33c={'method':'POST','uri':_0x3c1e83+_0x87f4('0x26'),'qs':{'refresh_token':_0x38e027[_0x87f4('0x27')],'client_id':_0x38e027[_0x87f4('0x28')],'client_secret':_0x38e027[_0x87f4('0x29')],'grant_type':_0x87f4('0x2a')},'json':!![]};return rp(_0x2eb33c)[_0x87f4('0x2b')](function(_0x22ac8c){accountsTokens[_0x38e027['id']]={'access_token':_0x22ac8c['access_token'],'expires_in':moment()[_0x87f4('0x2c')](_0x22ac8c[_0x87f4('0x1f')],'seconds')};_0x1155ff(_0x22ac8c['access_token']);})[_0x87f4('0x2d')](function(_0x41953f){logger[_0x87f4('0x2e')]('Failing\x20creating\x20the\x20access_token',_0x41953f[_0x87f4('0x2f')]);_0x71817d(_0x41953f);});});}function getUser(_0x6bb391,_0x918b6e,_0x12bcdd,_0x387866){logger[_0x87f4('0x30')](_0x87f4('0x31'));return request({'method':_0x87f4('0x32'),'uri':util[_0x87f4('0x33')]('https://www.zohoapis.%s/crm/v2/users',_0x918b6e),'qs':{'type':_0x87f4('0x34')},'headers':{'Authorization':'Zoho-oauthtoken\x20'+_0x6bb391},'json':!![]})[_0x87f4('0x2b')](function(_0x49e8ec){if(_0x49e8ec['users']){var _0x208e45=-0x1;if(_[_0x87f4('0x35')](_0x49e8ec[_0x87f4('0x36')])){if(!_[_0x87f4('0x1c')](_0x387866)){_0x208e45=_[_0x87f4('0x37')](_0x49e8ec[_0x87f4('0x36')],function(_0x3481db){return _0x3481db['email']===_0x387866;});}if(_0x208e45>=0x0){logger[_0x87f4('0x30')](_0x87f4('0x38'));}else{logger[_0x87f4('0x30')](_0x87f4('0x39'));_0x208e45=_[_0x87f4('0x37')](_0x49e8ec['users'],function(_0xbea413){return _0xbea413[_0x87f4('0x3a')][_0x87f4('0x17')]===_0x87f4('0x3b');});}return _0x49e8ec[_0x87f4('0x36')][_0x208e45];}else{if(_0x49e8ec[_0x87f4('0x3c')][_0x87f4('0x3a')][_0x87f4('0x17')]===_0x87f4('0x3b')){logger[_0x87f4('0x30')]('Using\x20the\x20admin\x20account!');user=_0x49e8ec[_0x87f4('0x3c')];return user;}else{logger[_0x87f4('0x2e')](_0x87f4('0x3d'),JSON[_0x87f4('0xd')](_0x49e8ec));throw new Error('Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20'+JSON[_0x87f4('0xd')](_0x49e8ec));}}}else{logger['error'](_0x87f4('0x3d'),JSON['stringify'](_0x49e8ec));throw new Error(_0x87f4('0x3e')+JSON['stringify'](_0x49e8ec));}})[_0x87f4('0x2d')](function(_0x2b34c7){console[_0x87f4('0x2e')](_0x2b34c7);});}function getZohoUser(_0xe04478,_0xf64a03){return new BPromise(function(_0x355023,_0x318b0c){request(_0xe04478)['then'](function(_0x4ef676){var _0x4bb12c=null;if(_0x4ef676){_0x4bb12c=_0x4ef676[_0x87f4('0x3f')][0x0];_0x4bb12c['enduserType']=_0xf64a03;}_0x355023(_0x4bb12c);})[_0x87f4('0x2d')](function(_0x278ff4){_0x318b0c(_0x278ff4);});});}function createEndUser(_0xec6c87,_0x8e3687,_0x4f4e26,_0x191d71,_0xf12c43,_0x3a7811){var _0x4f4e26=getName(_0x4f4e26);return request({'method':_0x87f4('0x40'),'uri':_0x87f4('0x41')+_0x8e3687+_0x87f4('0x42')+_[_0x87f4('0x43')](_0x3a7811[_0x87f4('0x44')])+'s','body':{'data':[{'Last_Name':_0x4f4e26[0x1],'First_Name':_0x4f4e26[0x0],'Phone':_0x191d71,'Owner':{'name':!_[_0x87f4('0x1c')](_0xf12c43[_0x87f4('0x45')]['name'])?_0xf12c43[_0x87f4('0x45')][_0x87f4('0x17')]:!_[_0x87f4('0x1c')](_0xf12c43[_0x87f4('0x46')])?_0xf12c43['first_name']+'\x20'+_0xf12c43[_0x87f4('0x47')]:_0xf12c43[_0x87f4('0x47')],'id':_0xf12c43['id']}}]},'headers':{'Authorization':_0x87f4('0x48')+_0xec6c87},'json':!![]})[_0x87f4('0x2b')](function(_0x23ad25){if(_0x23ad25&&_0x23ad25[_0x87f4('0x3f')][0x0][_0x87f4('0x49')]===_0x87f4('0x4a')){var _0x39e422=_0x23ad25[_0x87f4('0x3f')][0x0][_0x87f4('0x4b')];_0x39e422['enduserType']=_[_0x87f4('0x43')](_0x3a7811['moduleCreate'])+'s';return _0x39e422;}logger['error'](_0x87f4('0x3d'),JSON[_0x87f4('0xd')](data));throw new Error(_0x87f4('0x4c')+JSON[_0x87f4('0xd')](data));})[_0x87f4('0x2d')](function(_0x55a055){console[_0x87f4('0x4d')](_0x87f4('0x4e'),_0x55a055);});}function getEndUser(_0x165e6c,_0x2681af,_0x43de1f,_0x1ebd89,_0x5d936d,_0x834876,_0x52cef6){var _0x5dc402={'method':_0x87f4('0x32'),'uri':'','headers':{'Authorization':_0x87f4('0x48')+_0x165e6c},'json':!![]};switch(_0x52cef6[_0x87f4('0x4f')]){case'contact_lead':_0x5dc402[_0x87f4('0x50')]=_0x87f4('0x41')+_0x2681af+_0x87f4('0x51')+_0x5d936d+'))';return getZohoUser(_0x5dc402,_0x87f4('0x52'))[_0x87f4('0x2b')](function(_0x2180f9){if(_0x2180f9)return _0x2180f9;_0x5dc402[_0x87f4('0x50')]=_0x87f4('0x41')+_0x2681af+'/crm/v2/Leads/search?criteria=((Phone:equals:'+_0x5d936d+'))';return getZohoUser(_0x5dc402,_0x87f4('0x53'))[_0x87f4('0x2b')](function(_0x1fa942){if(_0x1fa942)return _0x1fa942;if(_0x52cef6[_0x87f4('0x44')]!='nothing'){return createEndUser(_0x165e6c,_0x2681af,_0x1ebd89,_0x5d936d,_0x834876,_0x52cef6);}else{return{};}});});break;case'contact':_0x5dc402[_0x87f4('0x50')]=_0x87f4('0x41')+_0x2681af+_0x87f4('0x51')+_0x5d936d+'))';return getZohoUser(_0x5dc402,_0x87f4('0x52'))[_0x87f4('0x2b')](function(_0x240988){if(_0x240988)return _0x240988;if(_0x52cef6[_0x87f4('0x44')]!=_0x87f4('0x54')){return createEndUser(_0x165e6c,_0x2681af,_0x1ebd89,_0x5d936d,_0x834876,_0x52cef6);}else{return{};}});break;case _0x87f4('0x55'):_0x5dc402['uri']=_0x87f4('0x41')+_0x2681af+_0x87f4('0x56')+_0x5d936d+'))';return getZohoUser(_0x5dc402,_0x87f4('0x53'))['then'](function(_0x4b6e50){if(_0x4b6e50)return _0x4b6e50;if(_0x52cef6[_0x87f4('0x44')]!=_0x87f4('0x54')){return createEndUser(_0x165e6c,_0x2681af,_0x1ebd89,_0x5d936d,_0x834876,_0x52cef6);}else{return{};}});break;}}function getCall(_0x23ee32,_0x145a99,_0x24c693,_0x1df95f,_0x218501,_0x3a9f07,_0x3363f6,_0x5e4e33){logger[_0x87f4('0x30')](_0x87f4('0x57'));var _0x3b1e93={};_0x3b1e93[_0x87f4('0x58')]={'name':!_['isNil'](_0x1df95f[_0x87f4('0x45')][_0x87f4('0x17')])&&!_[_0x87f4('0x1c')](_0x1df95f[_0x87f4('0x3a')][_0x87f4('0x17')])&&_0x1df95f[_0x87f4('0x3a')][_0x87f4('0x17')]===_0x87f4('0x59')?_0x1df95f[_0x87f4('0x45')]['name']:!_[_0x87f4('0x1c')](_0x1df95f[_0x87f4('0x46')])?_0x1df95f['first_name']+'\x20'+_0x1df95f['last_name']:_0x1df95f['last_name'],'id':_0x1df95f['id']};_0x3b1e93['Subject']=intUtil[_0x87f4('0x5a')](_0x3a9f07[_0x87f4('0x5b')],_0x3363f6,'\x20');_0x3b1e93[_0x87f4('0x5c')]=intUtil['getString'](_0x3a9f07[_0x87f4('0x5d')],_0x3363f6,'\x0a');if(_0x218501[_0x87f4('0x5e')]===_0x87f4('0x52')){_0x3b1e93[_0x87f4('0x5f')]={'name':!_[_0x87f4('0x1c')](_0x218501[_0x87f4('0x60')])?_0x218501['Full_Name']:!_['isNil'](_0x218501[_0x87f4('0x61')])?_0x218501['First_Name']+'\x20'+_0x218501[_0x87f4('0x62')]:_0x218501['Last_Name'],'id':_0x218501['id']};}if(_0x218501[_0x87f4('0x5e')]==='Leads'){_0x3b1e93[_0x87f4('0x63')]={'name':!_[_0x87f4('0x1c')](_0x218501[_0x87f4('0x60')])?_0x218501[_0x87f4('0x60')]:!_[_0x87f4('0x1c')](_0x218501[_0x87f4('0x61')])?_0x218501['First_Name']+'\x20'+_0x218501[_0x87f4('0x62')]:_0x218501['Last_Name'],'id':_0x218501['id']};_0x3b1e93[_0x87f4('0x64')]=_['startCase'](_0x218501[_0x87f4('0x5e')]);}if(_0x3363f6[_0x87f4('0x65')]){_0x3b1e93[_0x87f4('0x66')]=moment['utc'](parseInt(_0x3363f6[_0x87f4('0x65')])*0x3e8)['format'](_0x87f4('0x67'));}else if(_0x3363f6[_0x87f4('0x68')]&&_0x3363f6[_0x87f4('0x69')]){_0x3b1e93[_0x87f4('0x66')]=moment[_0x87f4('0x6a')](moment(_0x3363f6[_0x87f4('0x69')],'YYYY-MM-DDTHH:mm:ss')[_0x87f4('0x6b')](moment(_0x3363f6[_0x87f4('0x6c')],'YYYY-MM-DDTHH:mm:ss')))[_0x87f4('0x33')](_0x87f4('0x67'));}switch(_0x3363f6[_0x87f4('0x6d')]){case'called':_0x3b1e93['Call_Result']='Called';break;case _0x87f4('0x6e'):case _0x87f4('0x6f'):_0x3b1e93['Call_Result']=_0x87f4('0x70');break;case _0x87f4('0x71'):_0x3b1e93[_0x87f4('0x72')]='Rejected';break;case _0x87f4('0x73'):_0x3b1e93[_0x87f4('0x72')]=_0x87f4('0x74');break;case _0x87f4('0x75'):_0x3b1e93[_0x87f4('0x72')]=_0x87f4('0x76');default:}_0x3b1e93[_0x87f4('0x77')]=(_0x5e4e33==='outbound'?moment(_0x3363f6[_0x87f4('0x6c')])[_0x87f4('0x33')](_0x87f4('0x78')):moment(_0x3363f6[_0x87f4('0x79')])[_0x87f4('0x33')](_0x87f4('0x78')))||moment()[_0x87f4('0x33')](_0x87f4('0x78'));_0x3b1e93[_0x87f4('0x7a')]=_0x5e4e33||'Inbound';_0x3b1e93=_[_0x87f4('0x7b')](_0x3b1e93,getCustomFields(_0x3a9f07[_0x87f4('0x7c')],_0x3363f6));return request({'method':_0x87f4('0x40'),'uri':_0x87f4('0x41')+_0x145a99+'/crm/v2/Calls','headers':{'Authorization':_0x87f4('0x48')+_0x23ee32},'body':{'data':[_0x3b1e93]},'json':!![]})[_0x87f4('0x2b')](function(_0x4071b7){if(_0x4071b7&&_0x4071b7[_0x87f4('0x3f')][0x0][_0x87f4('0x49')]===_0x87f4('0x4a')){logger[_0x87f4('0x30')](_0x87f4('0x7d'));return{'id':_0x4071b7[_0x87f4('0x3f')][0x0]['details']['id']};}})[_0x87f4('0x2d')](function(_0x5b3a99){logger[_0x87f4('0x30')](_0x87f4('0x7e'),_0x5b3a99[_0x87f4('0x2f')]);console['log'](_0x87f4('0x7e'),_0x5b3a99);});}exports[_0x87f4('0x7f')]=function(_0x92a92a,_0x25bdc2,_0x195387,_0x4a6e13,_0x1b3a27,_0x299185){var _0x51c4b5,_0x2733d4,_0x3a5b3e;_0x299185[_0x87f4('0x80')]=intUtil['stripTrailingSlash'](_0x299185[_0x87f4('0x80')]);_0x299185[_0x87f4('0x81')]=intUtil[_0x87f4('0x82')](_0x299185['serverUrl']);if(_0x1b3a27&&_0x1b3a27[_0x87f4('0x83')]){logger[_0x87f4('0x30')](_0x87f4('0x84'),_0x87f4('0x85'));_0x25bdc2['recordingURL']=_0x299185[_0x87f4('0x81')]+'/api/voice/recordings/'+_0x25bdc2[_0x87f4('0x86')]+'/downloads?type=uniqueid&token='+md5(_0x25bdc2['uniqueid']);}else{_0x25bdc2['recordingURL']='';}var _0x4ca0ad=_0x299185[_0x87f4('0x80')]===_0x87f4('0x87')?'eu':'com';return getAccessToken(_0x299185)[_0x87f4('0x2b')](function(_0x49d854){_0x3a5b3e=_0x49d854;return getUser(_0x3a5b3e,_0x4ca0ad,_0x299185,_0x4a6e13[_0x87f4('0x88')]);})[_0x87f4('0x2b')](function(_0x5a2822){_0x51c4b5=_0x5a2822;logger[_0x87f4('0x30')](_0x87f4('0x89'),_0x51c4b5['id']);return getEndUser(_0x3a5b3e,_0x4ca0ad,_0x299185,_0x25bdc2['calleridname'],_0x25bdc2[_0x87f4('0x8a')],_0x51c4b5,_0x195387);})[_0x87f4('0x2b')](function(_0x2105c8){_0x2733d4=_0x2105c8;return getCall(_0x3a5b3e,_0x4ca0ad,_0x299185,_0x51c4b5,_0x2733d4,_0x195387,_0x25bdc2,_0x87f4('0x8b'));})[_0x87f4('0x2b')](function(_0x2ea0d2){if(_0x2ea0d2){logger[_0x87f4('0x30')](_0x87f4('0x8c'),_0x2ea0d2['id']);logger[_0x87f4('0x30')]('[QUEUE]','Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0x87f4('0x33')](_0x87f4('0x8d'),_0x4a6e13['name']),'trigger:browser:url',{'uri':'https://crm.'+_0x299185[_0x87f4('0x80')]+'/crm/EntityInfo.do?module=Calls&id='+_0x2ea0d2['id']});}})[_0x87f4('0x2d')](function(_0xb90ee){logger[_0x87f4('0x2e')](_0x87f4('0x84'),JSON[_0x87f4('0xd')](_0xb90ee));});};exports[_0x87f4('0x8e')]=function(_0x31a11f,_0x3fae86,_0x5bda61,_0x4ed68f,_0x5aa1c7,_0x1cfe8e,_0x449ee9){var _0x5a14c7,_0x1b82fc,_0x4e0d3c;_0x1cfe8e['host']=intUtil[_0x87f4('0x82')](_0x1cfe8e[_0x87f4('0x80')]);_0x1cfe8e[_0x87f4('0x81')]=intUtil['stripTrailingSlash'](_0x1cfe8e[_0x87f4('0x81')]);if(_0x449ee9&&_0x449ee9[_0x87f4('0x8f')]&&_0x449ee9[_0x87f4('0x8f')]!==_0x87f4('0x90')){logger[_0x87f4('0x30')](_0x87f4('0x91'),_0x87f4('0x85'));_0x3fae86[_0x87f4('0x92')]=_0x1cfe8e[_0x87f4('0x81')]+'/api/voice/recordings/'+_0x3fae86[_0x87f4('0x86')]+_0x87f4('0x93')+md5(_0x3fae86[_0x87f4('0x86')]);}var _0x2bff3c=_0x1cfe8e['host']==='zoho.eu'?'eu':'com';return getAccessToken(_0x1cfe8e)[_0x87f4('0x2b')](function(_0x5b3a2){_0x4e0d3c=_0x5b3a2;return getUser(_0x4e0d3c,_0x2bff3c,_0x1cfe8e,_0x4ed68f[_0x87f4('0x88')]);})[_0x87f4('0x2b')](function(_0x471c64){_0x5a14c7=_0x471c64;logger[_0x87f4('0x30')]('The\x20User\x20ID\x20is:',_0x5a14c7['id']);return getEndUser(_0x4e0d3c,_0x2bff3c,_0x1cfe8e,_0x3fae86[_0x87f4('0x94')],_0x3fae86['destcalleridnum'],_0x5a14c7,_0x5bda61);})[_0x87f4('0x2b')](function(_0x465dfa){_0x1b82fc=_0x465dfa;return getCall(_0x4e0d3c,_0x2bff3c,_0x1cfe8e,_0x5a14c7,_0x1b82fc,_0x5bda61,_0x3fae86,_0x87f4('0x95'));})['then'](function(_0x4af2f5){if(_0x4af2f5){logger[_0x87f4('0x30')](_0x87f4('0x8c'),_0x4af2f5['id']);logger['info'](_0x87f4('0x91'),'Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0x87f4('0x33')](_0x87f4('0x8d'),_0x4ed68f['name']),_0x87f4('0x96'),{'uri':'https://crm.'+_0x1cfe8e[_0x87f4('0x80')]+_0x87f4('0x97')+_0x4af2f5['id']});}})[_0x87f4('0x2d')](function(_0xb5c81){logger[_0x87f4('0x2e')]('[OUTBOUND]',JSON[_0x87f4('0xd')](_0xb5c81));});};exports[_0x87f4('0x98')]=function(_0x5b004d,_0x498132,_0x3cec16,_0x50a34f,_0x6a38cb,_0x24062a){var _0x2503f1,_0x1c65af,_0x2ac9f1;_0x24062a[_0x87f4('0x80')]=intUtil[_0x87f4('0x82')](_0x24062a['host']);_0x24062a[_0x87f4('0x81')]=intUtil[_0x87f4('0x82')](_0x24062a['serverUrl']);if(_0x6a38cb&&_0x6a38cb[_0x87f4('0x83')]){logger[_0x87f4('0x30')]('['+_0x498132[_0x87f4('0x6d')]['toUpperCase']()+']',_0x87f4('0x85'));_0x498132[_0x87f4('0x92')]=_0x24062a[_0x87f4('0x81')]+_0x87f4('0x99')+_0x498132[_0x87f4('0x86')]+'/downloads?type=uniqueid&token='+md5(_0x498132['uniqueid']);}else{_0x498132[_0x87f4('0x92')]='';}var _0x1fb884=_0x24062a[_0x87f4('0x80')]===_0x87f4('0x87')?'eu':_0x87f4('0x9a');return getAccessToken(_0x24062a)[_0x87f4('0x2b')](function(_0x362b7f){_0x2ac9f1=_0x362b7f;return getUser(_0x2ac9f1,_0x1fb884,_0x24062a);})['then'](function(_0x24eb16){_0x2503f1=_0x24eb16;logger['info'](_0x87f4('0x89'),_0x2503f1['id']);return getEndUser(_0x2ac9f1,_0x1fb884,_0x24062a,_0x498132[_0x87f4('0x9b')],_0x498132['calleridnum'],_0x2503f1,_0x3cec16);})[_0x87f4('0x2b')](function(_0x5639ed){_0x1c65af=_0x5639ed;return getCall(_0x2ac9f1,_0x1fb884,_0x24062a,_0x2503f1,_0x1c65af,_0x3cec16,_0x498132,'Inbound');})[_0x87f4('0x2b')](function(_0x453e3d){if(_0x453e3d){logger[_0x87f4('0x30')]('The\x20Call\x20ID\x20is:',_0x453e3d['id']);}})[_0x87f4('0x2d')](function(_0x40a0be){logger[_0x87f4('0x2e')]('['+_0x498132[_0x87f4('0x6d')][_0x87f4('0x9c')]()+']',JSON[_0x87f4('0xd')](_0x40a0be));});}; \ 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 edfab4d..15e46a8 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(_0x3204dd,_0x476dd8){var _0x1861cf=function(_0x388812){while(--_0x388812){_0x3204dd['push'](_0x3204dd['shift']());}};_0x1861cf(++_0x476dd8);}(_0x7a54,0x106));var _0x47a5=function(_0xae71a1,_0x182b6b){_0xae71a1=_0xae71a1-0x0;var _0x127ebe=_0x7a54[_0xae71a1];return _0x127ebe;};'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(_0x5f4cb6,_0x361194){var _0x26efe1=function(_0x34d743){while(--_0x34d743){_0x5f4cb6['push'](_0x5f4cb6['shift']());}};_0x26efe1(++_0x361194);}(_0x7a54,0x106));var _0x47a5=function(_0x1bf68e,_0x368bb7){_0x1bf68e=_0x1bf68e-0x0;var _0x5e5fda=_0x7a54[_0x1bf68e];return _0x5e5fda;};'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 e8313e3..0a63449 100644 --- a/server/services/ami/trigger/urlforward/index.js +++ b/server/services/ami/trigger/urlforward/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5f2f=['lodash','mustache','../../../../config/logger','trigger','exec','data1','toUpperCase','render','data2','number','data5','headers','data6','parse','stack','GET','DELETE','POST','PUT','data7','body','error','body\x20has\x20been\x20passed\x20to\x20URLforward\x20in\x20a\x20wrong\x20format','info','format','%s\x20%s\x20sending\x20request\x20with\x20following\x20options:\x20%s','stringify','then','isNil',',\x20request\x20body:\x20','object','%s\x20%s\x20succeeded\x20with\x20status:\x20%d\x20and\x20response:\x20%s','statusCode','catch','%s\x20%s\x20failed\x20with\x20status:\x20%d\x20and\x20error:\x20%s\x20%s','name','message','request-promise','util'];(function(_0x31f973,_0x1f4d1b){var _0x4d1758=function(_0xbf336b){while(--_0xbf336b){_0x31f973['push'](_0x31f973['shift']());}};_0x4d1758(++_0x1f4d1b);}(_0x5f2f,0x73));var _0xf5f2=function(_0x35296f,_0x38d28e){_0x35296f=_0x35296f-0x0;var _0x9f6288=_0x5f2f[_0x35296f];return _0x9f6288;};'use strict';var rp=require(_0xf5f2('0x0'));var util=require(_0xf5f2('0x1'));var _=require(_0xf5f2('0x2'));var Mustache=require(_0xf5f2('0x3'));var logger=require(_0xf5f2('0x4'))(_0xf5f2('0x5'));exports[_0xf5f2('0x6')]=function(_0x107cf,_0x501fbd){var _0x4854b6,_0x1665c7;var _0x192215={'method':_0x107cf[_0xf5f2('0x7')][_0xf5f2('0x8')](),'uri':Mustache[_0xf5f2('0x9')](_0x107cf[_0xf5f2('0xa')],_0x501fbd),'json':!![],'resolveWithFullResponse':!![],'timeout':typeof parseInt(_0x107cf['data5'])===_0xf5f2('0xb')&&parseInt(_0x107cf[_0xf5f2('0xc')])>=0x1&&parseInt(_0x107cf[_0xf5f2('0xc')])<=0xa?parseInt(_0x107cf['data5'])*0x3e8:0x5*0x3e8};try{_0x192215[_0xf5f2('0xd')]=_0x107cf[_0xf5f2('0xe')]?JSON[_0xf5f2('0xf')](Mustache['render'](_0x107cf[_0xf5f2('0xe')],_0x501fbd)):{};}catch(_0x4ebbbe){logger['error'](_0x4ebbbe[_0xf5f2('0x10')]);}switch(_0x107cf[_0xf5f2('0x7')]['toUpperCase']()){case _0xf5f2('0x11'):case _0xf5f2('0x12'):_0x4854b6=null;_0x192215['qs']=_0x501fbd;break;case _0xf5f2('0x13'):case _0xf5f2('0x14'):if(_0x107cf[_0xf5f2('0x15')]){try{_0x4854b6=JSON[_0xf5f2('0xf')](Mustache['render'](_0x107cf[_0xf5f2('0x15')],_0x501fbd));_0x192215[_0xf5f2('0x16')]=_0x4854b6;}catch(_0x269909){logger[_0xf5f2('0x17')](_0x269909[_0xf5f2('0x10')]);logger['error'](_0xf5f2('0x18'));}}else{_0x4854b6=_0x501fbd;_0x192215[_0xf5f2('0x16')]=_0x4854b6;}break;}logger[_0xf5f2('0x19')](util[_0xf5f2('0x1a')](_0xf5f2('0x1b'),_0x107cf[_0xf5f2('0x7')],_0x107cf[_0xf5f2('0xa')],JSON[_0xf5f2('0x1c')](_0x192215)));rp(_0x192215)[_0xf5f2('0x1d')](function(_0x228ace){_0x4854b6=!_[_0xf5f2('0x1e')](_0x4854b6)?_0xf5f2('0x1f')+_0x4854b6:'';_0x1665c7=typeof _0x228ace[_0xf5f2('0x16')]===_0xf5f2('0x20')?JSON[_0xf5f2('0x1c')](_0x228ace[_0xf5f2('0x16')]):_0x228ace[_0xf5f2('0x16')];logger['info'](util[_0xf5f2('0x1a')](_0xf5f2('0x21'),_0x107cf['data1'],_0x107cf['data2'],_0x228ace[_0xf5f2('0x22')],_0x1665c7));})[_0xf5f2('0x23')](function(_0x4ae323){logger[_0xf5f2('0x17')](util[_0xf5f2('0x1a')](_0xf5f2('0x24'),_0x107cf[_0xf5f2('0x7')],_0x107cf[_0xf5f2('0xa')],_0x4ae323['statusCode'],_0x4ae323[_0xf5f2('0x25')],_0x4ae323[_0xf5f2('0x26')]));});}; \ No newline at end of file +var _0xb10b=['number','headers','data6','parse','error','stack','DELETE','POST','PUT','data7','body','body\x20has\x20been\x20passed\x20to\x20URLforward\x20in\x20a\x20wrong\x20format','info','format','%s\x20%s\x20sending\x20request\x20with\x20following\x20options:\x20%s','data2','stringify','then','isNil',',\x20request\x20body:\x20','object','%s\x20%s\x20succeeded\x20with\x20status:\x20%d\x20and\x20response:\x20%s','data1','statusCode','name','message','request-promise','lodash','mustache','../../../../config/logger','exec','toUpperCase','render','data5'];(function(_0x52e1a2,_0xa9dde){var _0xb3b25a=function(_0x2b512d){while(--_0x2b512d){_0x52e1a2['push'](_0x52e1a2['shift']());}};_0xb3b25a(++_0xa9dde);}(_0xb10b,0x12a));var _0xbb10=function(_0x3f3f40,_0x4c71f4){_0x3f3f40=_0x3f3f40-0x0;var _0x403b7a=_0xb10b[_0x3f3f40];return _0x403b7a;};'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 d50bfe9..d1f9f2a 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 _0x8819=['then','rpc','error','message','result','../../config/logger','routing','client','http','Request','request'];(function(_0x43c3f9,_0x1861cb){var _0x4f4f54=function(_0x53ac81){while(--_0x53ac81){_0x43c3f9['push'](_0x43c3f9['shift']());}};_0x4f4f54(++_0x1861cb);}(_0x8819,0x94));var _0x9881=function(_0x227244,_0x58bfad){_0x227244=_0x227244-0x0;var _0x31b2ab=_0x8819[_0x227244];return _0x31b2ab;};'use strict';var jayson=require('jayson/promise');var BPromise=require('bluebird');var logger=require(_0x9881('0x0'))(_0x9881('0x1'));var client=jayson[_0x9881('0x2')][_0x9881('0x3')]({'port':0x2329});client[_0x9881('0x4')]=function(_0x5e52c5,_0x333d6f){return new BPromise(function(_0x446deb,_0xf41442){return client[_0x9881('0x5')](_0x5e52c5,_0x333d6f)[_0x9881('0x6')](function(_0x2a3664){logger['debug'](_0x9881('0x7'),'routing',_0x5e52c5,_0x333d6f,_0x2a3664);if(_0x2a3664['error']){logger[_0x9881('0x8')]('rpc','routing',_0x5e52c5,_0x2a3664[_0x9881('0x8')]['message'],_0x333d6f);return _0xf41442(_0x2a3664[_0x9881('0x8')][_0x9881('0x9')]);}else{return _0x446deb(_0x2a3664[_0x9881('0xa')]);}})['catch'](function(_0x1df0ba){logger[_0x9881('0x8')](_0x9881('0x7'),_0x9881('0x1'),_0x5e52c5,_0x1df0ba,_0x333d6f);return _0xf41442(_0x1df0ba);});});};module['exports']=client; \ No newline at end of file +var _0x55d2=['message','catch','exports','../../config/logger','routing','client','http','Request','request','then','rpc','error'];(function(_0x292f93,_0x2c6e8e){var _0x5a94b1=function(_0x25735e){while(--_0x25735e){_0x292f93['push'](_0x292f93['shift']());}};_0x5a94b1(++_0x2c6e8e);}(_0x55d2,0x9f));var _0x255d=function(_0x30dbb0,_0x59a6b7){_0x30dbb0=_0x30dbb0-0x0;var _0x7512b8=_0x55d2[_0x30dbb0];return _0x7512b8;};'use strict';var jayson=require('jayson/promise');var BPromise=require('bluebird');var logger=require(_0x255d('0x0'))(_0x255d('0x1'));var client=jayson[_0x255d('0x2')][_0x255d('0x3')]({'port':0x2329});client[_0x255d('0x4')]=function(_0x2c9d29,_0x57cbc1){return new BPromise(function(_0x44e16c,_0x217a7b){return client[_0x255d('0x5')](_0x2c9d29,_0x57cbc1)[_0x255d('0x6')](function(_0x58dae4){logger['debug'](_0x255d('0x7'),_0x255d('0x1'),_0x2c9d29,_0x57cbc1,_0x58dae4);if(_0x58dae4[_0x255d('0x8')]){logger[_0x255d('0x8')](_0x255d('0x7'),'routing',_0x2c9d29,_0x58dae4['error']['message'],_0x57cbc1);return _0x217a7b(_0x58dae4['error'][_0x255d('0x9')]);}else{return _0x44e16c(_0x58dae4['result']);}})[_0x255d('0xa')](function(_0x2c3754){logger[_0x255d('0x8')]('rpc','routing',_0x2c9d29,_0x2c3754,_0x57cbc1);return _0x217a7b(_0x2c3754);});});};module[_0x255d('0xb')]=client; \ No newline at end of file diff --git a/server/services/email/index.js b/server/services/email/index.js index 8dd6bd3..4086390 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 _0xf2ca=['./realtime','./rpc/mailAccount','../../mysqldb','resolve','then','getMailAccounts','refresh','mailAccounts','listen','Setting','loginMailFrequency','catch','bluebird','./server'];(function(_0x263a74,_0xc31414){var _0x2aa86c=function(_0x382896){while(--_0x382896){_0x263a74['push'](_0x263a74['shift']());}};_0x2aa86c(++_0xc31414);}(_0xf2ca,0x16a));var _0xaf2c=function(_0x415f7e,_0x4630b6){_0x415f7e=_0x415f7e-0x0;var _0x311ff4=_0xf2ca[_0x415f7e];return _0x311ff4;};'use strict';var BPromise=require(_0xaf2c('0x0'));var server=require(_0xaf2c('0x1'));var Realtime=require(_0xaf2c('0x2'));var EmailChannel=require('./lib/email');var mailAccount=require(_0xaf2c('0x3'));var realtime=new Realtime();var email=new EmailChannel(realtime);var db=require(_0xaf2c('0x4'))['db'];function initRealtime(){return BPromise[_0xaf2c('0x5')]()[_0xaf2c('0x6')](mailAccount[_0xaf2c('0x7')]())[_0xaf2c('0x6')](realtime['initMailAccounts']())[_0xaf2c('0x6')](function(){email[_0xaf2c('0x8')](realtime[_0xaf2c('0x9')]);return realtime;});}function main(){return server[_0xaf2c('0xa')](realtime,email)['then'](function(_0x37fedd){return initRealtime();})[_0xaf2c('0x6')](function(_0x4a7397){return db[_0xaf2c('0xb')]['findOne']({'attributes':['id',_0xaf2c('0xc')],'raw':!![]});})['then'](function(_0x2f5099){return setInterval(initRealtime,_0x2f5099[_0xaf2c('0xc')]*0x3e8);})[_0xaf2c('0xd')](function(_0xd891e9){console['log'](_0xd891e9);});}main(); \ No newline at end of file +var _0x455d=['getMailAccounts','initMailAccounts','refresh','mailAccounts','listen','Setting','findOne','loginMailFrequency','catch','log','./realtime','./lib/email','./rpc/mailAccount','resolve','then'];(function(_0xef6efc,_0x2813e2){var _0x515676=function(_0x48115d){while(--_0x48115d){_0xef6efc['push'](_0xef6efc['shift']());}};_0x515676(++_0x2813e2);}(_0x455d,0x190));var _0xd455=function(_0x457159,_0x3111e2){_0x457159=_0x457159-0x0;var _0x64539b=_0x455d[_0x457159];return _0x64539b;};'use strict';var BPromise=require('bluebird');var server=require('./server');var Realtime=require(_0xd455('0x0'));var EmailChannel=require(_0xd455('0x1'));var mailAccount=require(_0xd455('0x2'));var realtime=new Realtime();var email=new EmailChannel(realtime);var db=require('../../mysqldb')['db'];function initRealtime(){return BPromise[_0xd455('0x3')]()[_0xd455('0x4')](mailAccount[_0xd455('0x5')]())[_0xd455('0x4')](realtime[_0xd455('0x6')]())[_0xd455('0x4')](function(){email[_0xd455('0x7')](realtime[_0xd455('0x8')]);return realtime;});}function main(){return server[_0xd455('0x9')](realtime,email)['then'](function(_0x2bbebf){return initRealtime();})[_0xd455('0x4')](function(_0x4ef696){return db[_0xd455('0xa')][_0xd455('0xb')]({'attributes':['id',_0xd455('0xc')],'raw':!![]});})[_0xd455('0x4')](function(_0x5cdf73){return setInterval(initRealtime,_0x5cdf73[_0xd455('0xc')]*0x3e8);})[_0xd455('0xd')](function(_0x5a4f0f){console[_0xd455('0xe')](_0x5a4f0f);});}main(); \ No newline at end of file diff --git a/server/services/email/lib/email.js b/server/services/email/lib/email.js index 699e1ef..8a57824 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 _0x9b4c=['handleImapEnd','disabled','connected','total','New\x20email\x20from\x20%s\x20%s\x20%s\x20to\x20%s','firstName','from','notify','then','Mail\x20accepted\x20from\x20routing','catch','error','lastSync','handleImapError','sendMail','send','Smtp','verify','lodash','moment','bluebird','md5','../../../config/environment','email','redis','defaults','localhost','./imap','info','start\x20email\x20channel','mailAccounts','imapAccounts','smtp','prototype','emit','name','key','Imap','status','messageStatus','isNil','stringify','mailAccount:update','refresh','hasOwnProperty','active','box','handleImapBox','bind','handleImapEmail','end'];(function(_0x7e8491,_0x4c29ce){var _0x5bcada=function(_0x25a001){while(--_0x25a001){_0x7e8491['push'](_0x7e8491['shift']());}};_0x5bcada(++_0x4c29ce);}(_0x9b4c,0x177));var _0xc9b4=function(_0x50b1c5,_0x1cf2a9){_0x50b1c5=_0x50b1c5-0x0;var _0x344f99=_0x9b4c[_0x50b1c5];return _0x344f99;};'use strict';var _=require(_0xc9b4('0x0'));var moment=require(_0xc9b4('0x1'));var BPromise=require(_0xc9b4('0x2'));var md5=require(_0xc9b4('0x3'));var Redis=require('ioredis');var config=require(_0xc9b4('0x4'));var logger=require('../../../config/logger')(_0xc9b4('0x5'));config[_0xc9b4('0x6')]=_[_0xc9b4('0x7')](config['redis'],{'host':_0xc9b4('0x8'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xc9b4('0x6')]));var EmailImap=require(_0xc9b4('0x9'));var EmailSmtp=require('./smtp');var mailAccount=require('../rpc/mailAccount');var md5Accounts={};function EmailChannel(_0xda0da2){logger[_0xc9b4('0xa')](_0xc9b4('0xb'));this[_0xc9b4('0xc')]=_0xda0da2[_0xc9b4('0xc')];this[_0xc9b4('0xd')]={};this[_0xc9b4('0xe')]=new EmailSmtp();}EmailChannel[_0xc9b4('0xf')][_0xc9b4('0x10')]=function(_0x27bfb9){var _0x351720=this['mailAccounts'][_0x27bfb9];var _0x3c37dd={'id':_0x351720['id'],'name':_0x351720[_0xc9b4('0x11')],'key':_0x351720[_0xc9b4('0x12')],'active':_0x351720['active'],'Imap':{'status':_0x351720[_0xc9b4('0x13')][_0xc9b4('0x14')],'messageStatus':_0x351720[_0xc9b4('0x13')][_0xc9b4('0x15')],'total':_0x351720[_0xc9b4('0x13')]['total']}};if(_[_0xc9b4('0x16')](md5Accounts[_0x27bfb9])){md5Accounts[_0x27bfb9]={};}var _0x37efec=md5(JSON[_0xc9b4('0x17')](_0x3c37dd));if(md5Accounts[_0x27bfb9][_0xc9b4('0x3')]!==_0x37efec){md5Accounts[_0x27bfb9][_0xc9b4('0x3')]=_0x37efec;io[_0xc9b4('0x10')](_0xc9b4('0x18'),_0x3c37dd);}};EmailChannel['prototype'][_0xc9b4('0x19')]=function(_0x271e56){for(var _0x2572b2 in _0x271e56){if(_0x271e56[_0xc9b4('0x1a')](_0x2572b2)){if(_0x271e56[_0x2572b2][_0xc9b4('0x13')]&&_0x271e56[_0x2572b2][_0xc9b4('0x1b')]){var _0x44de87=_0x271e56[_0x2572b2]['Imap'];if(!this[_0xc9b4('0xd')]['hasOwnProperty'](_0x44de87['id'])){this[_0xc9b4('0xd')][_0x44de87['id']]=new EmailImap(_0x44de87,_0x271e56[_0x2572b2][_0xc9b4('0x5')]);this['imapAccounts'][_0x44de87['id']]['on'](_0xc9b4('0x1c'),this[_0xc9b4('0x1d')][_0xc9b4('0x1e')](this,_0x2572b2));this[_0xc9b4('0xd')][_0x44de87['id']]['on'](_0xc9b4('0x5'),this[_0xc9b4('0x1f')][_0xc9b4('0x1e')](this,_0x2572b2));this[_0xc9b4('0xd')][_0x44de87['id']]['on'](_0xc9b4('0x20'),this[_0xc9b4('0x21')][_0xc9b4('0x1e')](this,_0x2572b2));this[_0xc9b4('0xd')][_0x44de87['id']]['on']('error',this['handleImapError']['bind'](this,_0x2572b2));}}else{if(_[_0xc9b4('0x16')](this[_0xc9b4('0xc')][_0x2572b2][_0xc9b4('0x13')])){this[_0xc9b4('0xc')][_0x2572b2]['Imap']={};}this['mailAccounts'][_0x2572b2][_0xc9b4('0x13')]['status']=_0xc9b4('0x22');this[_0xc9b4('0xc')][_0x2572b2]['Imap']['messageStatus']='';this['emit'](_0x2572b2);}}}};EmailChannel[_0xc9b4('0xf')]['handleImapBox']=function(_0x8182f3,_0x172c0a){if(this[_0xc9b4('0xc')][_0x8182f3]){this[_0xc9b4('0xc')][_0x8182f3][_0xc9b4('0x13')][_0xc9b4('0x14')]=_0xc9b4('0x23');this[_0xc9b4('0xc')][_0x8182f3]['Imap']['messageStatus']=_0x172c0a[_0xc9b4('0x11')];if(_0x172c0a['messages']){this[_0xc9b4('0xc')][_0x8182f3]['Imap'][_0xc9b4('0x24')]=_0x172c0a['messages'][_0xc9b4('0x24')];}return this['emit'](_0x8182f3);}};EmailChannel[_0xc9b4('0xf')][_0xc9b4('0x1f')]=function(_0xde7bfd,_0x3c4b86){logger['info'](_0xc9b4('0x25'),_0x3c4b86[_0xc9b4('0x26')],_0x3c4b86['lastName'],_0x3c4b86[_0xc9b4('0x27')],_0xde7bfd);if(this[_0xc9b4('0xc')][_0xde7bfd]){return mailAccount[_0xc9b4('0x28')](_0xde7bfd,_0x3c4b86)[_0xc9b4('0x29')](function(_0x1edca8){if(_0x1edca8){logger[_0xc9b4('0xa')](_0xc9b4('0x2a'));}})[_0xc9b4('0x2b')](function(_0x416e1f){logger[_0xc9b4('0x2c')]('Mail\x20not\x20accepted\x20from\x20routing\x20%s',JSON[_0xc9b4('0x17')](_0x416e1f));});}};EmailChannel['prototype'][_0xc9b4('0x21')]=function(_0x3e35a3){if(this[_0xc9b4('0xc')][_0x3e35a3]&&this[_0xc9b4('0xc')][_0x3e35a3][_0xc9b4('0x13')]){if(this[_0xc9b4('0xd')][this[_0xc9b4('0xc')][_0x3e35a3][_0xc9b4('0x13')]['id']]){delete this[_0xc9b4('0xd')][this[_0xc9b4('0xc')][_0x3e35a3]['Imap']['id']];}this[_0xc9b4('0xc')][_0x3e35a3][_0xc9b4('0x13')][_0xc9b4('0x2d')]=moment();this['emit'](_0x3e35a3);}};EmailChannel[_0xc9b4('0xf')][_0xc9b4('0x2e')]=function(_0x243c5b,_0x37a849){if(this[_0xc9b4('0xc')][_0x243c5b]){this[_0xc9b4('0xc')][_0x243c5b][_0xc9b4('0x13')][_0xc9b4('0x14')]=_0xc9b4('0x2c');this['mailAccounts'][_0x243c5b][_0xc9b4('0x13')][_0xc9b4('0x15')]=_0x37a849;return this[_0xc9b4('0x10')](_0x243c5b);}};EmailChannel[_0xc9b4('0xf')][_0xc9b4('0x2f')]=function(_0x452640,_0x4910d3){return this[_0xc9b4('0xe')][_0xc9b4('0x30')](_0x452640,_0x4910d3);};EmailChannel[_0xc9b4('0xf')]['verifySmtp']=function(_0x2c2fb7){var _0x3655a9=this;if(this[_0xc9b4('0xc')][_0x2c2fb7['id']]){if(_[_0xc9b4('0x16')](this[_0xc9b4('0xc')][_0x2c2fb7['id']]['Smtp'])){this['mailAccounts'][_0x2c2fb7['id']][_0xc9b4('0x31')]={};}this['mailAccounts'][_0x2c2fb7['id']]['Smtp'][_0xc9b4('0x2d')]=moment();return new BPromise(function(_0x2d8c81,_0x2c67c1){return _0x3655a9['smtp'][_0xc9b4('0x32')](_0x2c2fb7)[_0xc9b4('0x29')](function(_0x48b4bd){_0x3655a9[_0xc9b4('0xc')][_0x2c2fb7['id']][_0xc9b4('0x31')][_0xc9b4('0x14')]='verified';_0x3655a9['mailAccounts'][_0x2c2fb7['id']][_0xc9b4('0x31')][_0xc9b4('0x15')]='';_0x3655a9[_0xc9b4('0x10')](_0x2c2fb7['id']);_0x2d8c81(_0x48b4bd);})[_0xc9b4('0x2b')](function(_0xdc9038){_0x3655a9[_0xc9b4('0xc')][_0x2c2fb7['id']][_0xc9b4('0x31')][_0xc9b4('0x14')]='error';_0x3655a9[_0xc9b4('0xc')][_0x2c2fb7['id']][_0xc9b4('0x31')][_0xc9b4('0x15')]=_0xdc9038;_0x3655a9[_0xc9b4('0x10')](_0x2c2fb7['id']);_0x2c67c1(_0xdc9038);});});}return this[_0xc9b4('0xe')]['verify'](_0x2c2fb7);};module['exports']=EmailChannel; \ No newline at end of file +var _0x24c3=['firstName','lastName','from','notify','then','lastSync','sendMail','send','verifySmtp','Smtp','verify','verified','catch','exports','lodash','moment','bluebird','md5','ioredis','../../../config/environment','../../../config/logger','email','redis','defaults','localhost','socket.io-emitter','./imap','./smtp','start\x20email\x20channel','mailAccounts','imapAccounts','smtp','prototype','emit','name','key','active','Imap','status','messageStatus','total','stringify','mailAccount:update','refresh','hasOwnProperty','box','handleImapBox','bind','handleImapEmail','end','handleImapEnd','error','handleImapError','isNil','disabled','connected','messages','info','New\x20email\x20from\x20%s\x20%s\x20%s\x20to\x20%s'];(function(_0x52e94f,_0x5285be){var _0x1bcad0=function(_0x2236ac){while(--_0x2236ac){_0x52e94f['push'](_0x52e94f['shift']());}};_0x1bcad0(++_0x5285be);}(_0x24c3,0x170));var _0x324c=function(_0x374bba,_0x2c2841){_0x374bba=_0x374bba-0x0;var _0x7735d2=_0x24c3[_0x374bba];return _0x7735d2;};'use strict';var _=require(_0x324c('0x0'));var moment=require(_0x324c('0x1'));var BPromise=require(_0x324c('0x2'));var md5=require(_0x324c('0x3'));var Redis=require(_0x324c('0x4'));var config=require(_0x324c('0x5'));var logger=require(_0x324c('0x6'))(_0x324c('0x7'));config[_0x324c('0x8')]=_[_0x324c('0x9')](config['redis'],{'host':_0x324c('0xa'),'port':0x18eb});var io=require(_0x324c('0xb'))(new Redis(config[_0x324c('0x8')]));var EmailImap=require(_0x324c('0xc'));var EmailSmtp=require(_0x324c('0xd'));var mailAccount=require('../rpc/mailAccount');var md5Accounts={};function EmailChannel(_0x2f61f1){logger['info'](_0x324c('0xe'));this[_0x324c('0xf')]=_0x2f61f1[_0x324c('0xf')];this[_0x324c('0x10')]={};this[_0x324c('0x11')]=new EmailSmtp();}EmailChannel[_0x324c('0x12')][_0x324c('0x13')]=function(_0x20dd1a){var _0x28c489=this[_0x324c('0xf')][_0x20dd1a];var _0x2a84a7={'id':_0x28c489['id'],'name':_0x28c489[_0x324c('0x14')],'key':_0x28c489[_0x324c('0x15')],'active':_0x28c489[_0x324c('0x16')],'Imap':{'status':_0x28c489[_0x324c('0x17')][_0x324c('0x18')],'messageStatus':_0x28c489[_0x324c('0x17')][_0x324c('0x19')],'total':_0x28c489[_0x324c('0x17')][_0x324c('0x1a')]}};if(_['isNil'](md5Accounts[_0x20dd1a])){md5Accounts[_0x20dd1a]={};}var _0x1ad90c=md5(JSON[_0x324c('0x1b')](_0x2a84a7));if(md5Accounts[_0x20dd1a]['md5']!==_0x1ad90c){md5Accounts[_0x20dd1a][_0x324c('0x3')]=_0x1ad90c;io[_0x324c('0x13')](_0x324c('0x1c'),_0x2a84a7);}};EmailChannel[_0x324c('0x12')][_0x324c('0x1d')]=function(_0x2e4c70){for(var _0x2e9e1a in _0x2e4c70){if(_0x2e4c70[_0x324c('0x1e')](_0x2e9e1a)){if(_0x2e4c70[_0x2e9e1a][_0x324c('0x17')]&&_0x2e4c70[_0x2e9e1a]['active']){var _0x169094=_0x2e4c70[_0x2e9e1a][_0x324c('0x17')];if(!this[_0x324c('0x10')][_0x324c('0x1e')](_0x169094['id'])){this[_0x324c('0x10')][_0x169094['id']]=new EmailImap(_0x169094,_0x2e4c70[_0x2e9e1a]['email']);this[_0x324c('0x10')][_0x169094['id']]['on'](_0x324c('0x1f'),this[_0x324c('0x20')][_0x324c('0x21')](this,_0x2e9e1a));this['imapAccounts'][_0x169094['id']]['on'](_0x324c('0x7'),this[_0x324c('0x22')][_0x324c('0x21')](this,_0x2e9e1a));this['imapAccounts'][_0x169094['id']]['on'](_0x324c('0x23'),this[_0x324c('0x24')][_0x324c('0x21')](this,_0x2e9e1a));this[_0x324c('0x10')][_0x169094['id']]['on'](_0x324c('0x25'),this[_0x324c('0x26')][_0x324c('0x21')](this,_0x2e9e1a));}}else{if(_[_0x324c('0x27')](this[_0x324c('0xf')][_0x2e9e1a][_0x324c('0x17')])){this[_0x324c('0xf')][_0x2e9e1a][_0x324c('0x17')]={};}this[_0x324c('0xf')][_0x2e9e1a]['Imap'][_0x324c('0x18')]=_0x324c('0x28');this[_0x324c('0xf')][_0x2e9e1a][_0x324c('0x17')][_0x324c('0x19')]='';this[_0x324c('0x13')](_0x2e9e1a);}}}};EmailChannel[_0x324c('0x12')]['handleImapBox']=function(_0x1a7123,_0x6f2de9){if(this['mailAccounts'][_0x1a7123]){this['mailAccounts'][_0x1a7123][_0x324c('0x17')][_0x324c('0x18')]=_0x324c('0x29');this[_0x324c('0xf')][_0x1a7123][_0x324c('0x17')][_0x324c('0x19')]=_0x6f2de9[_0x324c('0x14')];if(_0x6f2de9[_0x324c('0x2a')]){this[_0x324c('0xf')][_0x1a7123][_0x324c('0x17')][_0x324c('0x1a')]=_0x6f2de9['messages'][_0x324c('0x1a')];}return this[_0x324c('0x13')](_0x1a7123);}};EmailChannel[_0x324c('0x12')]['handleImapEmail']=function(_0x39d9ad,_0x45c97b){logger[_0x324c('0x2b')](_0x324c('0x2c'),_0x45c97b[_0x324c('0x2d')],_0x45c97b[_0x324c('0x2e')],_0x45c97b[_0x324c('0x2f')],_0x39d9ad);if(this['mailAccounts'][_0x39d9ad]){return mailAccount[_0x324c('0x30')](_0x39d9ad,_0x45c97b)[_0x324c('0x31')](function(_0x5377ed){if(_0x5377ed){logger[_0x324c('0x2b')]('Mail\x20accepted\x20from\x20routing');}})['catch'](function(_0x5f0a69){logger[_0x324c('0x25')]('Mail\x20not\x20accepted\x20from\x20routing\x20%s',JSON['stringify'](_0x5f0a69));});}};EmailChannel[_0x324c('0x12')][_0x324c('0x24')]=function(_0x1c5d93){if(this[_0x324c('0xf')][_0x1c5d93]&&this[_0x324c('0xf')][_0x1c5d93][_0x324c('0x17')]){if(this['imapAccounts'][this[_0x324c('0xf')][_0x1c5d93]['Imap']['id']]){delete this[_0x324c('0x10')][this[_0x324c('0xf')][_0x1c5d93][_0x324c('0x17')]['id']];}this['mailAccounts'][_0x1c5d93][_0x324c('0x17')][_0x324c('0x32')]=moment();this[_0x324c('0x13')](_0x1c5d93);}};EmailChannel[_0x324c('0x12')][_0x324c('0x26')]=function(_0x10c5fc,_0x5ac219){if(this[_0x324c('0xf')][_0x10c5fc]){this[_0x324c('0xf')][_0x10c5fc][_0x324c('0x17')][_0x324c('0x18')]=_0x324c('0x25');this[_0x324c('0xf')][_0x10c5fc][_0x324c('0x17')][_0x324c('0x19')]=_0x5ac219;return this[_0x324c('0x13')](_0x10c5fc);}};EmailChannel[_0x324c('0x12')][_0x324c('0x33')]=function(_0x4719a7,_0x47d191){return this[_0x324c('0x11')][_0x324c('0x34')](_0x4719a7,_0x47d191);};EmailChannel[_0x324c('0x12')][_0x324c('0x35')]=function(_0x30d2b4){var _0x482347=this;if(this[_0x324c('0xf')][_0x30d2b4['id']]){if(_[_0x324c('0x27')](this[_0x324c('0xf')][_0x30d2b4['id']][_0x324c('0x36')])){this['mailAccounts'][_0x30d2b4['id']][_0x324c('0x36')]={};}this[_0x324c('0xf')][_0x30d2b4['id']][_0x324c('0x36')]['lastSync']=moment();return new BPromise(function(_0xd39995,_0x406784){return _0x482347[_0x324c('0x11')][_0x324c('0x37')](_0x30d2b4)[_0x324c('0x31')](function(_0x47144a){_0x482347['mailAccounts'][_0x30d2b4['id']][_0x324c('0x36')]['status']=_0x324c('0x38');_0x482347[_0x324c('0xf')][_0x30d2b4['id']]['Smtp'][_0x324c('0x19')]='';_0x482347['emit'](_0x30d2b4['id']);_0xd39995(_0x47144a);})[_0x324c('0x39')](function(_0x9f9ff3){_0x482347['mailAccounts'][_0x30d2b4['id']][_0x324c('0x36')][_0x324c('0x18')]='error';_0x482347[_0x324c('0xf')][_0x30d2b4['id']][_0x324c('0x36')]['messageStatus']=_0x9f9ff3;_0x482347[_0x324c('0x13')](_0x30d2b4['id']);_0x406784(_0x9f9ff3);});});}return this[_0x324c('0x11')]['verify'](_0x30d2b4);};module[_0x324c('0x3a')]=EmailChannel; \ No newline at end of file diff --git a/server/services/email/lib/imap.js b/server/services/email/lib/imap.js index 989953e..82fa539 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 _0x7fec=['account','once','handleReady','bind','end','handleEnd','handleError','connect','inherits','connTimeout','authTimeout','isNil','service','authentication','user','password','host','port','tls','required','getHost','anonymous@xcally.com','prototype','openBox','handleOpenBox','emit','box','readUnseen','search','UNSEEN','handleReadUnseen','length','fetch','handleFetchMessage','handleFetchError','handleFetchEnd','closeBox','body','handleMessageBody','attributes','handleMessageAttributes','handleMessageEnd','handleSimpleParser','error','handleCloseBox','stringify','textCode','hasOwnProperty','path','util','imap','lodash','randomstring','mailparser','simpleParser','events','EventEmitter','../../../config/logger','email','mailbox','INBOX','getAccount'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x7fec,0x128));var _0xc7fe=function(_0xb24cb9,_0x13559c){_0xb24cb9=_0xb24cb9-0x0;var _0x439104=_0x7fec[_0xb24cb9];return _0x439104;};'use strict';var fs=require('fs');var path=require(_0xc7fe('0x0'));var util=require(_0xc7fe('0x1'));var Imap=require(_0xc7fe('0x2'));var _=require(_0xc7fe('0x3'));var rs=require(_0xc7fe('0x4'));var simpleParser=require(_0xc7fe('0x5'))[_0xc7fe('0x6')];var Iconv=require('iconv')['Iconv'];var EventEmitter=require(_0xc7fe('0x7'))[_0xc7fe('0x8')];var utils=require('./utils');var logger=require(_0xc7fe('0x9'))(_0xc7fe('0xa'));function EmailImap(_0x488e4b,_0x949b6e){this[_0xc7fe('0xb')]=_0xc7fe('0xc');this['account']=this[_0xc7fe('0xd')](_0x488e4b,_0x949b6e);this['imap']=new Imap(this[_0xc7fe('0xe')]);this[_0xc7fe('0x2')][_0xc7fe('0xf')]('ready',this[_0xc7fe('0x10')][_0xc7fe('0x11')](this));this[_0xc7fe('0x2')][_0xc7fe('0xf')](_0xc7fe('0x12'),this[_0xc7fe('0x13')][_0xc7fe('0x11')](this));this[_0xc7fe('0x2')]['on']('error',this[_0xc7fe('0x14')][_0xc7fe('0x11')](this));this[_0xc7fe('0x2')][_0xc7fe('0x15')]();}util[_0xc7fe('0x16')](EmailImap,EventEmitter);EmailImap['prototype'][_0xc7fe('0xd')]=function(_0x31f1d2,_0x98720d){var _0x3cb702={'connTimeout':_0x31f1d2[_0xc7fe('0x17')]?_0x31f1d2[_0xc7fe('0x17')]*0x3e8:0x2710,'authTimeout':_0x31f1d2['authTimeout']?_0x31f1d2[_0xc7fe('0x18')]*0x3e8:0x1388};if(_[_0xc7fe('0x19')](_0x31f1d2[_0xc7fe('0x1a')])){if(_0x31f1d2[_0xc7fe('0x1b')]){_0x3cb702['user']=_0x31f1d2[_0xc7fe('0x1c')];_0x3cb702[_0xc7fe('0x1d')]=_0x31f1d2[_0xc7fe('0x1d')];}_0x3cb702[_0xc7fe('0x1e')]=_0x31f1d2[_0xc7fe('0x1e')];_0x3cb702[_0xc7fe('0x1f')]=_0x31f1d2[_0xc7fe('0x1f')]||0x3e1;if(_0x31f1d2[_0xc7fe('0x20')]){_0x3cb702[_0xc7fe('0x20')]=!![];}else{_0x3cb702[_0xc7fe('0x20')]=![];_0x3cb702['autotls']=_0xc7fe('0x21');}}else{_0x3cb702[_0xc7fe('0x1c')]=_0x31f1d2[_0xc7fe('0x1c')];_0x3cb702[_0xc7fe('0x1d')]=_0x31f1d2[_0xc7fe('0x1d')];_0x3cb702[_0xc7fe('0x1e')]=utils[_0xc7fe('0x22')](_0x31f1d2[_0xc7fe('0x1a')]);_0x3cb702[_0xc7fe('0x1f')]=0x3e1;_0x3cb702[_0xc7fe('0x20')]=!![];}_0x3cb702[_0xc7fe('0xa')]=_0x98720d||_0x31f1d2['user']||_0xc7fe('0x23');return _0x3cb702;};EmailImap[_0xc7fe('0x24')]['handleReady']=function(){this[_0xc7fe('0x2')][_0xc7fe('0x25')](this[_0xc7fe('0xb')],![],this[_0xc7fe('0x26')][_0xc7fe('0x11')](this));};EmailImap[_0xc7fe('0x24')]['handleOpenBox']=function(_0x18f795,_0x3dd728){if(_0x18f795){this[_0xc7fe('0x14')](_0x18f795,!![]);}else{this[_0xc7fe('0x27')](_0xc7fe('0x28'),_0x3dd728);this[_0xc7fe('0x29')]();}};EmailImap[_0xc7fe('0x24')]['handleCloseBox']=function(_0x4e05d8){if(_0x4e05d8){this[_0xc7fe('0x14')](_0x4e05d8,!![]);}else{this[_0xc7fe('0x2')]['end']();}};EmailImap[_0xc7fe('0x24')][_0xc7fe('0x29')]=function(){this[_0xc7fe('0x2')][_0xc7fe('0x2a')]([_0xc7fe('0x2b')],this[_0xc7fe('0x2c')][_0xc7fe('0x11')](this));};EmailImap[_0xc7fe('0x24')][_0xc7fe('0x2c')]=function(_0x44d736,_0x2259bb){if(_0x44d736){this[_0xc7fe('0x14')](_0x44d736,!![]);}else{if(_0x2259bb[_0xc7fe('0x2d')]){try{var _0xc21765=this[_0xc7fe('0x2')][_0xc7fe('0x2e')](_0x2259bb,{'bodies':'','markSeen':!![]});_0xc21765['on']('message',this[_0xc7fe('0x2f')][_0xc7fe('0x11')](this));_0xc21765[_0xc7fe('0xf')]('error',this[_0xc7fe('0x30')]['bind'](this));_0xc21765['once'](_0xc7fe('0x12'),this[_0xc7fe('0x31')]['bind'](this));}catch(_0x34c4ec){logger['error'](_0x34c4ec);}}else{this['imap'][_0xc7fe('0x32')](!![],this['handleCloseBox'][_0xc7fe('0x11')](this));}}};EmailImap['prototype']['handleFetchMessage']=function(_0x473b76,_0x335765){_0x473b76['on'](_0xc7fe('0x33'),this[_0xc7fe('0x34')]['bind'](this));_0x473b76[_0xc7fe('0xf')](_0xc7fe('0x35'),this[_0xc7fe('0x36')]['bind'](this));_0x473b76[_0xc7fe('0xf')](_0xc7fe('0x12'),this[_0xc7fe('0x37')][_0xc7fe('0x11')](this));};EmailImap[_0xc7fe('0x24')][_0xc7fe('0x34')]=function(_0x4006cd,_0x5cdede){simpleParser(_0x4006cd,{'Iconv':Iconv},this[_0xc7fe('0x38')][_0xc7fe('0x11')](this));};EmailImap[_0xc7fe('0x24')][_0xc7fe('0x36')]=function(_0x68ae85){};EmailImap[_0xc7fe('0x24')][_0xc7fe('0x37')]=function(){};EmailImap[_0xc7fe('0x24')]['handleSimpleParser']=function(_0x14d640,_0x4ab194){if(_0x14d640){logger[_0xc7fe('0x39')](_0x14d640);}else{var _0x59a184=this;utils['parser'](this[_0xc7fe('0xe')],_0x4ab194,function(_0x48fcbd){_0x59a184['emit'](_0xc7fe('0xa'),_0x48fcbd);});}};EmailImap[_0xc7fe('0x24')]['handleFetchEnd']=function(){this[_0xc7fe('0x2')][_0xc7fe('0x32')](!![],this[_0xc7fe('0x3a')]['bind'](this));};EmailImap[_0xc7fe('0x24')][_0xc7fe('0x30')]=function(_0x7e9d83){this[_0xc7fe('0x14')](_0x7e9d83);this[_0xc7fe('0x2')]['closeBox'](!![],this[_0xc7fe('0x3a')][_0xc7fe('0x11')](this));};EmailImap[_0xc7fe('0x24')][_0xc7fe('0x13')]=function(){this['emit'](_0xc7fe('0x12'));};EmailImap[_0xc7fe('0x24')][_0xc7fe('0x14')]=function(_0x3bb658,_0x224168){logger[_0xc7fe('0x39')](_0xc7fe('0x14'),this[_0xc7fe('0xe')]['email'],JSON[_0xc7fe('0x3b')](_0x3bb658));var _0x4721b6='';if(_0x3bb658){if(_0x3bb658[_0xc7fe('0x3c')]){_0x4721b6=_0x3bb658[_0xc7fe('0x3c')];}else{for(var _0x26128c in _0x3bb658){if(_0x3bb658[_0xc7fe('0x3d')](_0x26128c)){_0x4721b6+=_['upperFirst'](_0x26128c)+':\x20'+_0x3bb658[_0x26128c]+'\x0a';}}}}if(_0x224168){this['imap'][_0xc7fe('0x12')]();}else{this[_0xc7fe('0x27')](_0xc7fe('0x39'),_0x4721b6);this['emit'](_0xc7fe('0x12'));}};module['exports']=EmailImap; \ No newline at end of file +var _0xc5e0=['readUnseen','search','UNSEEN','handleReadUnseen','handleError','length','fetch','message','handleFetchMessage','handleFetchError','handleFetchEnd','closeBox','handleCloseBox','body','attributes','handleMessageEnd','handleMessageAttributes','handleSimpleParser','parser','emit','stringify','textCode','exports','util','imap','Iconv','EventEmitter','email','INBOX','account','getAccount','once','ready','handleReady','bind','end','handleEnd','error','connect','inherits','prototype','connTimeout','authTimeout','isNil','service','user','host','port','tls','autotls','required','password','getHost','anonymous@xcally.com','openBox','mailbox','handleOpenBox','box'];(function(_0x5d9ec9,_0x4a9500){var _0x1fd9f4=function(_0x379788){while(--_0x379788){_0x5d9ec9['push'](_0x5d9ec9['shift']());}};_0x1fd9f4(++_0x4a9500);}(_0xc5e0,0x1ad));var _0x0c5e=function(_0x47a78b,_0x15d996){_0x47a78b=_0x47a78b-0x0;var _0x4718ae=_0xc5e0[_0x47a78b];return _0x4718ae;};'use strict';var fs=require('fs');var path=require('path');var util=require(_0x0c5e('0x0'));var Imap=require(_0x0c5e('0x1'));var _=require('lodash');var rs=require('randomstring');var simpleParser=require('mailparser')['simpleParser'];var Iconv=require('iconv')[_0x0c5e('0x2')];var EventEmitter=require('events')[_0x0c5e('0x3')];var utils=require('./utils');var logger=require('../../../config/logger')(_0x0c5e('0x4'));function EmailImap(_0x3067cd,_0x160d79){this['mailbox']=_0x0c5e('0x5');this[_0x0c5e('0x6')]=this[_0x0c5e('0x7')](_0x3067cd,_0x160d79);this[_0x0c5e('0x1')]=new Imap(this[_0x0c5e('0x6')]);this[_0x0c5e('0x1')][_0x0c5e('0x8')](_0x0c5e('0x9'),this[_0x0c5e('0xa')][_0x0c5e('0xb')](this));this['imap'][_0x0c5e('0x8')](_0x0c5e('0xc'),this[_0x0c5e('0xd')]['bind'](this));this[_0x0c5e('0x1')]['on'](_0x0c5e('0xe'),this['handleError'][_0x0c5e('0xb')](this));this[_0x0c5e('0x1')][_0x0c5e('0xf')]();}util[_0x0c5e('0x10')](EmailImap,EventEmitter);EmailImap[_0x0c5e('0x11')][_0x0c5e('0x7')]=function(_0x49953c,_0x114049){var _0x4280b1={'connTimeout':_0x49953c[_0x0c5e('0x12')]?_0x49953c[_0x0c5e('0x12')]*0x3e8:0x2710,'authTimeout':_0x49953c[_0x0c5e('0x13')]?_0x49953c[_0x0c5e('0x13')]*0x3e8:0x1388};if(_[_0x0c5e('0x14')](_0x49953c[_0x0c5e('0x15')])){if(_0x49953c['authentication']){_0x4280b1[_0x0c5e('0x16')]=_0x49953c[_0x0c5e('0x16')];_0x4280b1['password']=_0x49953c['password'];}_0x4280b1['host']=_0x49953c[_0x0c5e('0x17')];_0x4280b1[_0x0c5e('0x18')]=_0x49953c[_0x0c5e('0x18')]||0x3e1;if(_0x49953c[_0x0c5e('0x19')]){_0x4280b1['tls']=!![];}else{_0x4280b1[_0x0c5e('0x19')]=![];_0x4280b1[_0x0c5e('0x1a')]=_0x0c5e('0x1b');}}else{_0x4280b1[_0x0c5e('0x16')]=_0x49953c['user'];_0x4280b1[_0x0c5e('0x1c')]=_0x49953c[_0x0c5e('0x1c')];_0x4280b1['host']=utils[_0x0c5e('0x1d')](_0x49953c[_0x0c5e('0x15')]);_0x4280b1[_0x0c5e('0x18')]=0x3e1;_0x4280b1[_0x0c5e('0x19')]=!![];}_0x4280b1[_0x0c5e('0x4')]=_0x114049||_0x49953c[_0x0c5e('0x16')]||_0x0c5e('0x1e');return _0x4280b1;};EmailImap[_0x0c5e('0x11')][_0x0c5e('0xa')]=function(){this[_0x0c5e('0x1')][_0x0c5e('0x1f')](this[_0x0c5e('0x20')],![],this[_0x0c5e('0x21')][_0x0c5e('0xb')](this));};EmailImap[_0x0c5e('0x11')]['handleOpenBox']=function(_0x41b663,_0x5576d0){if(_0x41b663){this['handleError'](_0x41b663,!![]);}else{this['emit'](_0x0c5e('0x22'),_0x5576d0);this['readUnseen']();}};EmailImap[_0x0c5e('0x11')]['handleCloseBox']=function(_0x20acd){if(_0x20acd){this['handleError'](_0x20acd,!![]);}else{this[_0x0c5e('0x1')][_0x0c5e('0xc')]();}};EmailImap[_0x0c5e('0x11')][_0x0c5e('0x23')]=function(){this[_0x0c5e('0x1')][_0x0c5e('0x24')]([_0x0c5e('0x25')],this[_0x0c5e('0x26')][_0x0c5e('0xb')](this));};EmailImap[_0x0c5e('0x11')][_0x0c5e('0x26')]=function(_0xea6065,_0x5925f1){if(_0xea6065){this[_0x0c5e('0x27')](_0xea6065,!![]);}else{if(_0x5925f1[_0x0c5e('0x28')]){try{var _0xd0dc8c=this[_0x0c5e('0x1')][_0x0c5e('0x29')](_0x5925f1,{'bodies':'','markSeen':!![]});_0xd0dc8c['on'](_0x0c5e('0x2a'),this[_0x0c5e('0x2b')][_0x0c5e('0xb')](this));_0xd0dc8c[_0x0c5e('0x8')](_0x0c5e('0xe'),this[_0x0c5e('0x2c')]['bind'](this));_0xd0dc8c[_0x0c5e('0x8')](_0x0c5e('0xc'),this[_0x0c5e('0x2d')][_0x0c5e('0xb')](this));}catch(_0x239958){logger[_0x0c5e('0xe')](_0x239958);}}else{this[_0x0c5e('0x1')][_0x0c5e('0x2e')](!![],this[_0x0c5e('0x2f')][_0x0c5e('0xb')](this));}}};EmailImap[_0x0c5e('0x11')][_0x0c5e('0x2b')]=function(_0x253f13,_0x92a763){_0x253f13['on'](_0x0c5e('0x30'),this['handleMessageBody'][_0x0c5e('0xb')](this));_0x253f13[_0x0c5e('0x8')](_0x0c5e('0x31'),this['handleMessageAttributes']['bind'](this));_0x253f13[_0x0c5e('0x8')]('end',this[_0x0c5e('0x32')][_0x0c5e('0xb')](this));};EmailImap[_0x0c5e('0x11')]['handleMessageBody']=function(_0x401a60,_0x27e34b){simpleParser(_0x401a60,{'Iconv':Iconv},this['handleSimpleParser'][_0x0c5e('0xb')](this));};EmailImap[_0x0c5e('0x11')][_0x0c5e('0x33')]=function(_0x5d4127){};EmailImap[_0x0c5e('0x11')][_0x0c5e('0x32')]=function(){};EmailImap['prototype'][_0x0c5e('0x34')]=function(_0x23f1e7,_0x1561da){if(_0x23f1e7){logger[_0x0c5e('0xe')](_0x23f1e7);}else{var _0x57116b=this;utils[_0x0c5e('0x35')](this['account'],_0x1561da,function(_0x23cb95){_0x57116b[_0x0c5e('0x36')]('email',_0x23cb95);});}};EmailImap[_0x0c5e('0x11')][_0x0c5e('0x2d')]=function(){this[_0x0c5e('0x1')][_0x0c5e('0x2e')](!![],this[_0x0c5e('0x2f')][_0x0c5e('0xb')](this));};EmailImap[_0x0c5e('0x11')][_0x0c5e('0x2c')]=function(_0x371731){this[_0x0c5e('0x27')](_0x371731);this[_0x0c5e('0x1')][_0x0c5e('0x2e')](!![],this[_0x0c5e('0x2f')][_0x0c5e('0xb')](this));};EmailImap['prototype'][_0x0c5e('0xd')]=function(){this['emit'](_0x0c5e('0xc'));};EmailImap['prototype'][_0x0c5e('0x27')]=function(_0x29d97e,_0x20ab58){logger[_0x0c5e('0xe')]('handleError',this['account'][_0x0c5e('0x4')],JSON[_0x0c5e('0x37')](_0x29d97e));var _0x239afa='';if(_0x29d97e){if(_0x29d97e[_0x0c5e('0x38')]){_0x239afa=_0x29d97e[_0x0c5e('0x38')];}else{for(var _0x1bc3f7 in _0x29d97e){if(_0x29d97e['hasOwnProperty'](_0x1bc3f7)){_0x239afa+=_['upperFirst'](_0x1bc3f7)+':\x20'+_0x29d97e[_0x1bc3f7]+'\x0a';}}}}if(_0x20ab58){this[_0x0c5e('0x1')][_0x0c5e('0xc')]();}else{this['emit'](_0x0c5e('0xe'),_0x239afa);this['emit'](_0x0c5e('0xc'));}};module[_0x0c5e('0x39')]=EmailImap; \ No newline at end of file diff --git a/server/services/email/lib/smtp.js b/server/services/email/lib/smtp.js index 915e2ee..8fe81ed 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 _0x4d05=['Not\x20verifired','nodemailer','nodemailer-plugin-inline-base64','prototype','send','createTransport','use','compile','sendMail','verify','toString'];(function(_0x2c27a5,_0x11e01d){var _0x46aaa3=function(_0x22ddd3){while(--_0x22ddd3){_0x2c27a5['push'](_0x2c27a5['shift']());}};_0x46aaa3(++_0x11e01d);}(_0x4d05,0x1cf));var _0x54d0=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x4d05[_0x3b380d];return _0x54502b;};'use strict';var nodemailer=require(_0x54d0('0x0'));var BPromise=require('bluebird');var inlineBase64=require(_0x54d0('0x1'));function EmailSmtp(){}EmailSmtp[_0x54d0('0x2')][_0x54d0('0x3')]=function(_0x3965df,_0x3bdd7b){return new BPromise(function(_0x564f3d,_0x1dcd86){var _0x83bee4=nodemailer[_0x54d0('0x4')](_0x3965df);_0x83bee4[_0x54d0('0x5')](_0x54d0('0x6'),inlineBase64());_0x83bee4[_0x54d0('0x7')](_0x3bdd7b,function(_0xf9d088,_0x455c28){if(_0xf9d088){_0x1dcd86(_0xf9d088['toString']());}else{_0x564f3d(_0x455c28);}});});};EmailSmtp[_0x54d0('0x2')][_0x54d0('0x8')]=function(_0x19bdf7){return new BPromise(function(_0x118b03,_0x434e24){var _0x5ebcf0=nodemailer[_0x54d0('0x4')](_0x19bdf7);_0x5ebcf0[_0x54d0('0x8')](function(_0x3e025a,_0x5541d6){if(_0x3e025a){_0x434e24(_0x3e025a[_0x54d0('0x9')]());}else{if(_0x5541d6){_0x118b03(_0x5541d6);}else{_0x434e24(_0x54d0('0xa'));}}});});};module['exports']=EmailSmtp; \ No newline at end of file +var _0xd9c0=['send','createTransport','use','sendMail','toString','exports','nodemailer','bluebird','nodemailer-plugin-inline-base64','prototype'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xd9c0,0x1d2));var _0x0d9c=function(_0x113cf0,_0x147145){_0x113cf0=_0x113cf0-0x0;var _0x5f5181=_0xd9c0[_0x113cf0];return _0x5f5181;};'use strict';var nodemailer=require(_0x0d9c('0x0'));var BPromise=require(_0x0d9c('0x1'));var inlineBase64=require(_0x0d9c('0x2'));function EmailSmtp(){}EmailSmtp[_0x0d9c('0x3')][_0x0d9c('0x4')]=function(_0x207b91,_0x2c3896){return new BPromise(function(_0x234b20,_0x2a687c){var _0x52a2d4=nodemailer[_0x0d9c('0x5')](_0x207b91);_0x52a2d4[_0x0d9c('0x6')]('compile',inlineBase64());_0x52a2d4[_0x0d9c('0x7')](_0x2c3896,function(_0x39f20a,_0x404413){if(_0x39f20a){_0x2a687c(_0x39f20a[_0x0d9c('0x8')]());}else{_0x234b20(_0x404413);}});});};EmailSmtp['prototype']['verify']=function(_0x1ccae0){return new BPromise(function(_0x43f8bc,_0x311097){var _0x5e9109=nodemailer[_0x0d9c('0x5')](_0x1ccae0);_0x5e9109['verify'](function(_0x5b67b9,_0xb14da7){if(_0x5b67b9){_0x311097(_0x5b67b9[_0x0d9c('0x8')]());}else{if(_0xb14da7){_0x43f8bc(_0xb14da7);}else{_0x311097('Not\x20verifired');}}});});};module[_0x0d9c('0x9')]=EmailSmtp; \ No newline at end of file diff --git a/server/services/email/lib/utils.js b/server/services/email/lib/utils.js index d0100b6..f2f8970 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 _0x86c4=['join','name','Anonymous','pop','anonymous','test','html','replace','body','textAsHtml','Empty\x20message

','Attachments','Title','Data','getHost','imap.gmail.com','imap-mail.outlook.com','outlook365','outlook.office365.com','127.0.0.1','lodash','moment','randomstring','path','../../../config/logger','../../../config/environment','head','address','@xcally.com','value','split','length'];(function(_0x1c0483,_0x57b4b6){var _0x246f37=function(_0x567cfd){while(--_0x567cfd){_0x1c0483['push'](_0x1c0483['shift']());}};_0x246f37(++_0x57b4b6);}(_0x86c4,0xa8));var _0x486c=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0x86c4[_0x19e35c];return _0x3e1fe8;};'use strict';var _=require(_0x486c('0x0'));var moment=require(_0x486c('0x1'));var random=require(_0x486c('0x2'));var fs=require('fs');var path=require(_0x486c('0x3'));var util=require('util');var tnef=require('node-tnef');var logger=require(_0x486c('0x4'))('email');var config=require(_0x486c('0x5'));function getAddress(_0x5560e7){var _0x5ac050=_[_0x486c('0x6')](_0x5560e7['value']);return _0x5ac050&&_0x5ac050[_0x486c('0x7')]?_0x5ac050['address']:'anonymous'+random['generate'](0x6)+_0x486c('0x8');}function getFirstName(_0x582c35){var _0x512b02=_[_0x486c('0x6')](_0x582c35[_0x486c('0x9')]);if(_0x512b02&&_0x512b02['name']){var _0x2b1780=_0x512b02['name'][_0x486c('0xa')](/\s+/);return _0x2b1780[_0x486c('0xb')]?_0x2b1780['slice'](0x0,-0x1)[_0x486c('0xc')]('\x20'):_0x512b02[_0x486c('0xd')];}return _0x486c('0xe');}function getLastName(_0x50435a){var _0x4b89bd=_[_0x486c('0x6')](_0x50435a[_0x486c('0x9')]);if(_0x4b89bd&&_0x4b89bd[_0x486c('0xd')]){var _0x1d4150=_0x4b89bd['name'][_0x486c('0xa')](/\s+/);return _0x1d4150[_0x486c('0xb')]>0x1?_0x1d4150[_0x486c('0xf')]():'';}return'';}function getMails(_0xabb295,_0x33d6b9){var _0x478124='';for(var _0x575f06=0x0;_0x575f06<_0x33d6b9['value'][_0x486c('0xb')];_0x575f06+=0x1){if(_0x33d6b9[_0x486c('0x9')][_0x575f06][_0x486c('0x7')]!==_0xabb295){if(!_['isEmpty'](_0x478124)){_0x478124+=',';}_0x478124+=_0x33d6b9[_0x486c('0x9')][_0x575f06][_0x486c('0xd')]||_0x33d6b9[_0x486c('0x9')][_0x575f06][_0x486c('0x7')]||'';_0x478124+='\x20<';_0x478124+=_0x33d6b9[_0x486c('0x9')][_0x575f06][_0x486c('0x7')]?_0x33d6b9['value'][_0x575f06][_0x486c('0x7')]:_0x486c('0x10')+random['generate'](0x6)+_0x486c('0x8');_0x478124+='>';}}return _0x478124;}function parseEmail(_0x2e2266,_0x1d5c33,_0x30c41c){if(_0x1d5c33['html']){var _0x51804d=/)<[^<]*)*<\/script>/gi;while(_0x51804d[_0x486c('0x11')](_0x1d5c33[_0x486c('0x12')])){_0x1d5c33[_0x486c('0x12')]=_0x1d5c33[_0x486c('0x12')][_0x486c('0x13')](_0x51804d,'');}_0x30c41c[_0x486c('0x14')]=_0x1d5c33[_0x486c('0x12')];}else{_0x30c41c[_0x486c('0x14')]=_0x1d5c33[_0x486c('0x15')];}if(_0x30c41c[_0x486c('0x14')]){_0x30c41c[_0x486c('0x14')]=_0x30c41c[_0x486c('0x14')][_0x486c('0x13')](/Empty\x20message

','Attachments','Title','Data','getHost','gmail','imap.gmail.com','yahoo','imap.mail.yahoo.com','imap-mail.outlook.com','outlook365','outlook.office365.com','lodash','moment','randomstring','path','util','node-tnef','email'];(function(_0x342136,_0x55dab7){var _0x194c7f=function(_0x5e0924){while(--_0x5e0924){_0x342136['push'](_0x342136['shift']());}};_0x194c7f(++_0x55dab7);}(_0x94f2,0x18b));var _0x294f=function(_0x6de97b,_0x3c1340){_0x6de97b=_0x6de97b-0x0;var _0x3db771=_0x94f2[_0x6de97b];return _0x3db771;};'use strict';var _=require(_0x294f('0x0'));var moment=require(_0x294f('0x1'));var random=require(_0x294f('0x2'));var fs=require('fs');var path=require(_0x294f('0x3'));var util=require(_0x294f('0x4'));var tnef=require(_0x294f('0x5'));var logger=require('../../../config/logger')(_0x294f('0x6'));var config=require(_0x294f('0x7'));function getAddress(_0x403f0a){var _0x1b40e4=_[_0x294f('0x8')](_0x403f0a[_0x294f('0x9')]);return _0x1b40e4&&_0x1b40e4[_0x294f('0xa')]?_0x1b40e4[_0x294f('0xa')]:_0x294f('0xb')+random[_0x294f('0xc')](0x6)+_0x294f('0xd');}function getFirstName(_0x210547){var _0x306787=_['head'](_0x210547[_0x294f('0x9')]);if(_0x306787&&_0x306787[_0x294f('0xe')]){var _0x136d3b=_0x306787[_0x294f('0xe')][_0x294f('0xf')](/\s+/);return _0x136d3b['length']?_0x136d3b[_0x294f('0x10')](0x0,-0x1)[_0x294f('0x11')]('\x20'):_0x306787[_0x294f('0xe')];}return _0x294f('0x12');}function getLastName(_0x3c01fb){var _0x5e5339=_[_0x294f('0x8')](_0x3c01fb[_0x294f('0x9')]);if(_0x5e5339&&_0x5e5339[_0x294f('0xe')]){var _0x44cb20=_0x5e5339[_0x294f('0xe')]['split'](/\s+/);return _0x44cb20[_0x294f('0x13')]>0x1?_0x44cb20[_0x294f('0x14')]():'';}return'';}function getMails(_0x33740d,_0x8ac5fb){var _0x3f6be6='';for(var _0x368e82=0x0;_0x368e82<_0x8ac5fb[_0x294f('0x9')][_0x294f('0x13')];_0x368e82+=0x1){if(_0x8ac5fb[_0x294f('0x9')][_0x368e82][_0x294f('0xa')]!==_0x33740d){if(!_['isEmpty'](_0x3f6be6)){_0x3f6be6+=',';}_0x3f6be6+=_0x8ac5fb[_0x294f('0x9')][_0x368e82][_0x294f('0xe')]||_0x8ac5fb['value'][_0x368e82][_0x294f('0xa')]||'';_0x3f6be6+='\x20<';_0x3f6be6+=_0x8ac5fb[_0x294f('0x9')][_0x368e82][_0x294f('0xa')]?_0x8ac5fb[_0x294f('0x9')][_0x368e82][_0x294f('0xa')]:'anonymous'+random[_0x294f('0xc')](0x6)+_0x294f('0xd');_0x3f6be6+='>';}}return _0x3f6be6;}function parseEmail(_0x1cea8c,_0x184655,_0x4eaec8){if(_0x184655['html']){var _0x422f5a=/)<[^<]*)*<\/script>/gi;while(_0x422f5a[_0x294f('0x15')](_0x184655[_0x294f('0x16')])){_0x184655[_0x294f('0x16')]=_0x184655['html'][_0x294f('0x17')](_0x422f5a,'');}_0x4eaec8[_0x294f('0x18')]=_0x184655['html'];}else{_0x4eaec8['body']=_0x184655[_0x294f('0x19')];}if(_0x4eaec8['body']){_0x4eaec8[_0x294f('0x18')]=_0x4eaec8[_0x294f('0x18')]['replace'](/0x0){if(this[_0x1fc980+'Capacity']>0x0&&this[_0x1fc980+'CurrentCapacity']>=this[_0x1fc980+'Capacity']){return _0x2cae('0x27');}else{return _0x2cae('0x28');}}else{return'idle';}};Agent['prototype'][_0x2cae('0x25')]=function(){var _0x1c8063=[_0x2cae('0x29'),_0x2cae('0x2a'),_0x2cae('0x2b'),_0x2cae('0x2c'),_0x2cae('0x2d'),_0x2cae('0x2e')];for(var _0x214dba=0x0;_0x214dba<_0x1c8063[_0x2cae('0x2f')];_0x214dba+=0x1){var _0x2eeaf0=this[_0x2cae('0x30')](_0x1c8063[_0x214dba]);if(this[_0x1c8063[_0x214dba]+_0x2cae('0x31')]!==_0x2eeaf0){this[_0x1c8063[_0x214dba]+_0x2cae('0x32')]=_[_0x2cae('0x33')](moment()[_0x2cae('0x34')]('x'));}this[_0x1c8063[_0x214dba]+'Status']=_0x2eeaf0;}var _0x4a6e85={'id':this['id'],'name':this['name'],'online':this['online'],'voicePause':this[_0x2cae('0xb')],'chatPause':this[_0x2cae('0x35')],'mailPause':this[_0x2cae('0x36')],'smsPause':this[_0x2cae('0xd')],'faxPause':this['faxPause'],'openchannelPause':this[_0x2cae('0xe')],'chatStatus':this[_0x2cae('0x37')],'chatStatusTime':this[_0x2cae('0x38')],'chatCapacity':this['chatCapacity'],'chatCurrentCapacity':this[_0x2cae('0x11')],'mailStatus':this['mailStatus'],'mailStatusTime':this[_0x2cae('0x13')],'mailCapacity':this['mailCapacity'],'mailCurrentCapacity':this[_0x2cae('0x39')],'faxStatus':this[_0x2cae('0x15')],'faxStatusTime':this[_0x2cae('0x3a')],'faxCapacity':this['faxCapacity'],'faxCurrentCapacity':this[_0x2cae('0x17')],'smsStatus':this[_0x2cae('0x18')],'smsStatusTime':this[_0x2cae('0x19')],'smsCapacity':this[_0x2cae('0x1a')],'smsCurrentCapacity':this[_0x2cae('0x1b')],'whatsappStatus':this[_0x2cae('0x1c')],'whatsappStatusTime':this['whatsappStatusTime'],'whatsappCapacity':this['whatsappCapacity'],'whatsappCurrentCapacity':this[_0x2cae('0x1f')],'openchannelStatus':this[_0x2cae('0x20')],'openchannelStatusTime':this['openchannelStatusTime'],'openchannelCapacity':this['openchannelCapacity'],'openchannelCurrentCapacity':this['openchannelCurrentCapacity'],'busy':this[_0x2cae('0x23')],'busyQueue':this[_0x2cae('0x24')]};var _0x56ec52=md5(JSON['stringify'](_0x4a6e85));if(this['md5']!==_0x56ec52){this[_0x2cae('0x2')]=_0x56ec52;io[_0x2cae('0x3b')](_0x2cae('0x3c'),_0x4a6e85);}};module[_0x2cae('0x3d')]=Agent; \ No newline at end of file +var _0xb19a=['smsCapacity','smsCurrentCapacity','whatsappStatus','whatsappCapacity','openchannelStatus','openchannelStatusTime','busy','busyQueue','updateRealtime','getChannelStatus','CurrentCapacity','Capacity','maxcapacity','working','prototype','mail','chat','openchannel','fax','sms','length','Status','StatusTime','toNumber','format','mailStatus','faxCurrentCapacity','smsStatusTime','whatsappCurrentCapacity','openchannelCurrentCapacity','stringify','md5','emit','user:save','lodash','ioredis','defaults','redis','localhost','socket.io-emitter','name','online','voicePause','chatPause','mailPause','faxPause','smsPause','openchannelPause','chatStatus','unknown','chatStatusTime','chatCurrentCapacity','mailStatusTime','mailCapacity','mailCurrentCapacity','faxStatus','faxCapacity','smsStatus'];(function(_0x2aaf86,_0x375b59){var _0x289a37=function(_0x2ccc0d){while(--_0x2ccc0d){_0x2aaf86['push'](_0x2aaf86['shift']());}};_0x289a37(++_0x375b59);}(_0xb19a,0xd0));var _0xab19=function(_0xd770c4,_0x3f99dc){_0xd770c4=_0xd770c4-0x0;var _0xf8c9ae=_0xb19a[_0xd770c4];return _0xf8c9ae;};'use strict';var _=require(_0xab19('0x0'));var moment=require('moment');var md5=require('md5');var Redis=require(_0xab19('0x1'));var config=require('../../../config/environment');config['redis']=_[_0xab19('0x2')](config[_0xab19('0x3')],{'host':_0xab19('0x4'),'port':0x18eb});var io=require(_0xab19('0x5'))(new Redis(config[_0xab19('0x3')]));function Agent(_0x6ec577){this['id']=_0x6ec577['id']||0x0;this[_0xab19('0x6')]=_0x6ec577['name']||'';this[_0xab19('0x7')]=_0x6ec577[_0xab19('0x7')]||!![];this['voicePause']=_0x6ec577[_0xab19('0x8')]||![];this['chatPause']=_0x6ec577[_0xab19('0x9')]||![];this[_0xab19('0xa')]=_0x6ec577[_0xab19('0xa')]||![];this[_0xab19('0xb')]=_0x6ec577[_0xab19('0xb')]||![];this[_0xab19('0xc')]=_0x6ec577[_0xab19('0xc')]||![];this[_0xab19('0xd')]=_0x6ec577[_0xab19('0xd')]||![];this[_0xab19('0xe')]=_0xab19('0xf');this[_0xab19('0x10')]=0x0;this['chatCapacity']=_0x6ec577['chatCapacity']||0x0;this[_0xab19('0x11')]=0x0;this['mailStatus']=_0xab19('0xf');this[_0xab19('0x12')]=0x0;this[_0xab19('0x13')]=_0x6ec577[_0xab19('0x13')]||0x0;this[_0xab19('0x14')]=0x0;this[_0xab19('0x15')]=_0xab19('0xf');this['faxStatusTime']=0x0;this[_0xab19('0x16')]=_0x6ec577[_0xab19('0x16')]||0x0;this['faxCurrentCapacity']=0x0;this[_0xab19('0x17')]=_0xab19('0xf');this['smsStatusTime']=0x0;this['smsCapacity']=_0x6ec577[_0xab19('0x18')]||0x0;this[_0xab19('0x19')]=0x0;this[_0xab19('0x1a')]=_0xab19('0xf');this['whatsappStatusTime']=0x0;this[_0xab19('0x1b')]=_0x6ec577[_0xab19('0x1b')]||0x0;this['whatsappCurrentCapacity']=0x0;this[_0xab19('0x1c')]=_0xab19('0xf');this[_0xab19('0x1d')]=0x0;this['openchannelCapacity']=_0x6ec577['openchannelCapacity']||0x0;this['openchannelCurrentCapacity']=0x0;this[_0xab19('0x1e')]=![];this[_0xab19('0x1f')]=undefined;this['md5']='';this[_0xab19('0x20')]();}Agent['prototype'][_0xab19('0x21')]=function(_0x568f4f){if(this[_0x568f4f+_0xab19('0x22')]>0x0){if(this[_0x568f4f+_0xab19('0x23')]>0x0&&this[_0x568f4f+_0xab19('0x22')]>=this[_0x568f4f+_0xab19('0x23')]){return _0xab19('0x24');}else{return _0xab19('0x25');}}else{return'idle';}};Agent[_0xab19('0x26')][_0xab19('0x20')]=function(){var _0x3c681f=[_0xab19('0x27'),_0xab19('0x28'),_0xab19('0x29'),_0xab19('0x2a'),_0xab19('0x2b'),'whatsapp'];for(var _0x294d3f=0x0;_0x294d3f<_0x3c681f[_0xab19('0x2c')];_0x294d3f+=0x1){var _0x3dda13=this[_0xab19('0x21')](_0x3c681f[_0x294d3f]);if(this[_0x3c681f[_0x294d3f]+_0xab19('0x2d')]!==_0x3dda13){this[_0x3c681f[_0x294d3f]+_0xab19('0x2e')]=_[_0xab19('0x2f')](moment()[_0xab19('0x30')]('x'));}this[_0x3c681f[_0x294d3f]+'Status']=_0x3dda13;}var _0x2452c8={'id':this['id'],'name':this[_0xab19('0x6')],'online':this['online'],'voicePause':this[_0xab19('0x8')],'chatPause':this['chatPause'],'mailPause':this[_0xab19('0xa')],'smsPause':this[_0xab19('0xc')],'faxPause':this['faxPause'],'openchannelPause':this[_0xab19('0xd')],'chatStatus':this['chatStatus'],'chatStatusTime':this[_0xab19('0x10')],'chatCapacity':this['chatCapacity'],'chatCurrentCapacity':this[_0xab19('0x11')],'mailStatus':this[_0xab19('0x31')],'mailStatusTime':this['mailStatusTime'],'mailCapacity':this[_0xab19('0x13')],'mailCurrentCapacity':this[_0xab19('0x14')],'faxStatus':this[_0xab19('0x15')],'faxStatusTime':this['faxStatusTime'],'faxCapacity':this[_0xab19('0x16')],'faxCurrentCapacity':this[_0xab19('0x32')],'smsStatus':this['smsStatus'],'smsStatusTime':this[_0xab19('0x33')],'smsCapacity':this[_0xab19('0x18')],'smsCurrentCapacity':this[_0xab19('0x19')],'whatsappStatus':this[_0xab19('0x1a')],'whatsappStatusTime':this['whatsappStatusTime'],'whatsappCapacity':this[_0xab19('0x1b')],'whatsappCurrentCapacity':this[_0xab19('0x34')],'openchannelStatus':this[_0xab19('0x1c')],'openchannelStatusTime':this['openchannelStatusTime'],'openchannelCapacity':this['openchannelCapacity'],'openchannelCurrentCapacity':this[_0xab19('0x35')],'busy':this[_0xab19('0x1e')],'busyQueue':this[_0xab19('0x1f')]};var _0x48797b=md5(JSON[_0xab19('0x36')](_0x2452c8));if(this['md5']!==_0x48797b){this[_0xab19('0x37')]=_0x48797b;io[_0xab19('0x38')](_0xab19('0x39'),_0x2452c8);}};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 5cd9c8b..461e902 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 _0xa74d=['md5','updateRouting','updateRealtime','prototype','_rr','map','length','loggedIn','chatPause','paused','available','stringify','format','chat:queue:%s','emit','exports','../../../config/environment','redis','defaults','localhost','name','timeout','beepall','Agents','mapAgentsId','waiting'];(function(_0x2f8d39,_0x4df0d9){var _0x405763=function(_0xefa193){while(--_0xefa193){_0x2f8d39['push'](_0x2f8d39['shift']());}};_0x405763(++_0x4df0d9);}(_0xa74d,0x1e4));var _0xda74=function(_0x33a20c,_0x2d4372){_0x33a20c=_0x33a20c-0x0;var _0x13b28d=_0xa74d[_0x33a20c];return _0x13b28d;};'use strict';var _=require('lodash');var md5=require('md5');var util=require('util');var Redis=require('ioredis');var config=require(_0xda74('0x0'));config[_0xda74('0x1')]=_[_0xda74('0x2')](config['redis'],{'host':_0xda74('0x3'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));function ChatQueue(_0x6d0299){this['id']=_0x6d0299['id']||0x0;this[_0xda74('0x4')]=_0x6d0299[_0xda74('0x4')]||'';this[_0xda74('0x5')]=_0x6d0299[_0xda74('0x5')]||0xa;this['strategy']=_0x6d0299['strategy']||_0xda74('0x6');this[_0xda74('0x7')]=_0x6d0299['Agents'];this[_0xda74('0x8')]={};this[_0xda74('0x9')]=0x0;this[_0xda74('0xa')]='';this[_0xda74('0xb')]();this[_0xda74('0xc')]();}ChatQueue[_0xda74('0xd')][_0xda74('0xb')]=function(){var _0x3a5bd3=this[_0xda74('0x8')][_0xda74('0xe')];this['mapAgentsId']=_[_0xda74('0xf')](this[_0xda74('0x7')],'id');this[_0xda74('0x8')][_0xda74('0xe')]=_0x3a5bd3;};ChatQueue[_0xda74('0xd')][_0xda74('0xc')]=function(){this['loggedIn']=0x0;this['paused']=0x0;for(var _0x2f6cf6=0x0;_0x2f6cf6=0x0?this[_0xda74('0x14')]:0x0;var _0x4e119a={'id':this['id'],'available':this[_0xda74('0x14')],'loggedIn':this[_0xda74('0x11')],'name':this['name'],'paused':this[_0xda74('0x13')],'waiting':this['waiting']};var _0xd978a6=md5(JSON[_0xda74('0x15')](_0x4e119a));if(this[_0xda74('0xa')]!==_0xd978a6){this[_0xda74('0xa')]=_0xd978a6;io['to'](util[_0xda74('0x16')](_0xda74('0x17'),_0x4e119a[_0xda74('0x4')]))[_0xda74('0x18')]('chat_queue:save',_0x4e119a);}};module[_0xda74('0x19')]=ChatQueue; \ No newline at end of file +var _0x5fdd=['md5','util','ioredis','../../../config/environment','defaults','redis','localhost','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRouting','updateRealtime','_rr','map','loggedIn','paused','available','format','chat:queue:%s','emit','chat_queue:save','exports','lodash'];(function(_0x2a189e,_0x8130c3){var _0x46d76d=function(_0x5a87c6){while(--_0x5a87c6){_0x2a189e['push'](_0x2a189e['shift']());}};_0x46d76d(++_0x8130c3);}(_0x5fdd,0x194));var _0xd5fd=function(_0x12254f,_0x100cfe){_0x12254f=_0x12254f-0x0;var _0x3a4fa2=_0x5fdd[_0x12254f];return _0x3a4fa2;};'use strict';var _=require(_0xd5fd('0x0'));var md5=require(_0xd5fd('0x1'));var util=require(_0xd5fd('0x2'));var Redis=require(_0xd5fd('0x3'));var config=require(_0xd5fd('0x4'));config['redis']=_[_0xd5fd('0x5')](config[_0xd5fd('0x6')],{'host':_0xd5fd('0x7'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));function ChatQueue(_0x5cdc54){this['id']=_0x5cdc54['id']||0x0;this['name']=_0x5cdc54[_0xd5fd('0x8')]||'';this['timeout']=_0x5cdc54[_0xd5fd('0x9')]||0xa;this[_0xd5fd('0xa')]=_0x5cdc54[_0xd5fd('0xa')]||_0xd5fd('0xb');this['Agents']=_0x5cdc54[_0xd5fd('0xc')];this[_0xd5fd('0xd')]={};this[_0xd5fd('0xe')]=0x0;this[_0xd5fd('0x1')]='';this[_0xd5fd('0xf')]();this[_0xd5fd('0x10')]();}ChatQueue['prototype']['updateRouting']=function(){var _0x4283a4=this[_0xd5fd('0xd')][_0xd5fd('0x11')];this[_0xd5fd('0xd')]=_[_0xd5fd('0x12')](this[_0xd5fd('0xc')],'id');this[_0xd5fd('0xd')][_0xd5fd('0x11')]=_0x4283a4;};ChatQueue['prototype'][_0xd5fd('0x10')]=function(){this[_0xd5fd('0x13')]=0x0;this[_0xd5fd('0x14')]=0x0;for(var _0x1553c0=0x0;_0x1553c0=0x0?this[_0xd5fd('0x15')]:0x0;var _0x433d53={'id':this['id'],'available':this['available'],'loggedIn':this[_0xd5fd('0x13')],'name':this[_0xd5fd('0x8')],'paused':this[_0xd5fd('0x14')],'waiting':this[_0xd5fd('0xe')]};var _0x29f44b=md5(JSON['stringify'](_0x433d53));if(this[_0xd5fd('0x1')]!==_0x29f44b){this[_0xd5fd('0x1')]=_0x29f44b;io['to'](util[_0xd5fd('0x16')](_0xd5fd('0x17'),_0x433d53[_0xd5fd('0x8')]))[_0xd5fd('0x18')](_0xd5fd('0x19'),_0x433d53);}};module[_0xd5fd('0x1a')]=ChatQueue; \ No newline at end of file diff --git a/server/services/routing/model/faxQueue.js b/server/services/routing/model/faxQueue.js index 5d0f441..9fea6f1 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(_0x28f711,_0x5a8729){var _0x9337c7=function(_0x23c922){while(--_0x23c922){_0x28f711['push'](_0x28f711['shift']());}};_0x9337c7(++_0x5a8729);}(_0xa9e0,0x123));var _0x0a9e=function(_0xa1e3e3,_0x29fe0e){_0xa1e3e3=_0xa1e3e3-0x0;var _0xc980e9=_0xa9e0[_0xa1e3e3];return _0xc980e9;};'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(_0x27b199,_0x4d27e2){var _0x4402f1=function(_0x5ecd35){while(--_0x5ecd35){_0x27b199['push'](_0x27b199['shift']());}};_0x4402f1(++_0x4d27e2);}(_0xa9e0,0x123));var _0x0a9e=function(_0xa1e3e3,_0x29fe0e){_0xa1e3e3=_0xa1e3e3-0x0;var _0xc980e9=_0xa9e0[_0xa1e3e3];return _0xc980e9;};'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 60bb7b3..ad48849 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 _0x32b0=['Intervals','exports','name'];(function(_0x3ecc30,_0x75412b){var _0x2682bc=function(_0x34c384){while(--_0x34c384){_0x3ecc30['push'](_0x3ecc30['shift']());}};_0x2682bc(++_0x75412b);}(_0x32b0,0x14f));var _0x032b=function(_0x1f858a,_0xff7047){_0x1f858a=_0x1f858a-0x0;var _0x3e3b18=_0x32b0[_0x1f858a];return _0x3e3b18;};'use strict';function Interval(_0x138616){this['id']=_0x138616['id']||0x0;this[_0x032b('0x0')]=_0x138616[_0x032b('0x0')]||'';this['Intervals']=_0x138616[_0x032b('0x1')]||{};}module[_0x032b('0x2')]=Interval; \ No newline at end of file +var _0x8836=['Intervals','exports','name'];(function(_0xb13a01,_0x176a5d){var _0x10011a=function(_0x4cbb90){while(--_0x4cbb90){_0xb13a01['push'](_0xb13a01['shift']());}};_0x10011a(++_0x176a5d);}(_0x8836,0x6e));var _0x6883=function(_0x3c7dbb,_0x4226b6){_0x3c7dbb=_0x3c7dbb-0x0;var _0x5c1b2f=_0x8836[_0x3c7dbb];return _0x5c1b2f;};'use strict';function Interval(_0xd21063){this['id']=_0xd21063['id']||0x0;this[_0x6883('0x0')]=_0xd21063[_0x6883('0x0')]||'';this[_0x6883('0x1')]=_0xd21063[_0x6883('0x1')]||{};}module[_0x6883('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 b8ece93..c755acc 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 _0xe510=['redis','defaults','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','md5','updateRouting','updateRealtime','prototype','_rr','map','loggedIn','paused','length','online','mailPause','available','format','mail:queue:%s','exports','lodash','util','ioredis','../../../config/environment'];(function(_0x45b756,_0x77793d){var _0x4de9df=function(_0x434fe0){while(--_0x434fe0){_0x45b756['push'](_0x45b756['shift']());}};_0x4de9df(++_0x77793d);}(_0xe510,0x10a));var _0x0e51=function(_0x599f41,_0x4db732){_0x599f41=_0x599f41-0x0;var _0x2e4d58=_0xe510[_0x599f41];return _0x2e4d58;};'use strict';var _=require(_0x0e51('0x0'));var md5=require('md5');var util=require(_0x0e51('0x1'));var Redis=require(_0x0e51('0x2'));var config=require(_0x0e51('0x3'));config[_0x0e51('0x4')]=_[_0x0e51('0x5')](config[_0x0e51('0x4')],{'host':_0x0e51('0x6'),'port':0x18eb});var io=require(_0x0e51('0x7'))(new Redis(config['redis']));function MailQueue(_0x304d83){this['id']=_0x304d83['id']||0x0;this[_0x0e51('0x8')]=_0x304d83[_0x0e51('0x8')]||'';this['timeout']=_0x304d83[_0x0e51('0x9')]||0xa;this[_0x0e51('0xa')]=_0x304d83[_0x0e51('0xa')]||_0x0e51('0xb');this[_0x0e51('0xc')]=_0x304d83['Agents'];this[_0x0e51('0xd')]={};this[_0x0e51('0xe')]=0x0;this[_0x0e51('0xf')]='';this[_0x0e51('0x10')]();this[_0x0e51('0x11')]();}MailQueue[_0x0e51('0x12')]['updateRouting']=function(){var _0x1d8fa4=this[_0x0e51('0xd')][_0x0e51('0x13')];this[_0x0e51('0xd')]=_[_0x0e51('0x14')](this[_0x0e51('0xc')],'id');this[_0x0e51('0xd')]['_rr']=_0x1d8fa4;};MailQueue[_0x0e51('0x12')][_0x0e51('0x11')]=function(){this[_0x0e51('0x15')]=0x0;this[_0x0e51('0x16')]=0x0;for(var _0x3cf4ba=0x0;_0x3cf4ba=0x0?this['available']:0x0;var _0x184378={'id':this['id'],'available':this['available'],'loggedIn':this[_0x0e51('0x15')],'name':this[_0x0e51('0x8')],'paused':this[_0x0e51('0x16')],'waiting':this[_0x0e51('0xe')]};var _0x400874=md5(JSON['stringify'](_0x184378));if(this[_0x0e51('0xf')]!==_0x400874){this[_0x0e51('0xf')]=_0x400874;io['to'](util[_0x0e51('0x1b')](_0x0e51('0x1c'),_0x184378['name']))['emit']('mail_queue:save',_0x184378);}};module[_0x0e51('0x1d')]=MailQueue; \ No newline at end of file +var _0x0895=['updateRouting','_rr','map','loggedIn','paused','length','mailPause','available','waiting','format','exports','lodash','md5','ioredis','../../../config/environment','defaults','localhost','socket.io-emitter','redis','name','timeout','strategy','beepall','Agents','mapAgentsId','updateRealtime','prototype'];(function(_0x4d709c,_0x2c491e){var _0x47164f=function(_0x1ee76c){while(--_0x1ee76c){_0x4d709c['push'](_0x4d709c['shift']());}};_0x47164f(++_0x2c491e);}(_0x0895,0x1a0));var _0x5089=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0895[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x5089('0x0'));var md5=require(_0x5089('0x1'));var util=require('util');var Redis=require(_0x5089('0x2'));var config=require(_0x5089('0x3'));config['redis']=_[_0x5089('0x4')](config['redis'],{'host':_0x5089('0x5'),'port':0x18eb});var io=require(_0x5089('0x6'))(new Redis(config[_0x5089('0x7')]));function MailQueue(_0x50df6e){this['id']=_0x50df6e['id']||0x0;this[_0x5089('0x8')]=_0x50df6e[_0x5089('0x8')]||'';this[_0x5089('0x9')]=_0x50df6e[_0x5089('0x9')]||0xa;this[_0x5089('0xa')]=_0x50df6e[_0x5089('0xa')]||_0x5089('0xb');this[_0x5089('0xc')]=_0x50df6e[_0x5089('0xc')];this[_0x5089('0xd')]={};this['waiting']=0x0;this[_0x5089('0x1')]='';this['updateRouting']();this[_0x5089('0xe')]();}MailQueue[_0x5089('0xf')][_0x5089('0x10')]=function(){var _0x17fcd1=this[_0x5089('0xd')][_0x5089('0x11')];this[_0x5089('0xd')]=_[_0x5089('0x12')](this[_0x5089('0xc')],'id');this['mapAgentsId'][_0x5089('0x11')]=_0x17fcd1;};MailQueue['prototype'][_0x5089('0xe')]=function(){this[_0x5089('0x13')]=0x0;this[_0x5089('0x14')]=0x0;for(var _0x442e1f=0x0;_0x442e1f=0x0?this['available']:0x0;var _0x5c4e7f={'id':this['id'],'available':this['available'],'loggedIn':this[_0x5089('0x13')],'name':this[_0x5089('0x8')],'paused':this[_0x5089('0x14')],'waiting':this[_0x5089('0x18')]};var _0x55e9e0=md5(JSON['stringify'](_0x5c4e7f));if(this[_0x5089('0x1')]!==_0x55e9e0){this[_0x5089('0x1')]=_0x55e9e0;io['to'](util[_0x5089('0x19')]('mail:queue:%s',_0x5c4e7f[_0x5089('0x8')]))['emit']('mail_queue:save',_0x5c4e7f);}};module[_0x5089('0x1a')]=MailQueue; \ No newline at end of file diff --git a/server/services/routing/model/openchannelQueue.js b/server/services/routing/model/openchannelQueue.js index 59f3725..ff8fcbb 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 _0x8253=['openchannel:queue:%s','emit','openchannel_queue:save','exports','lodash','ioredis','../../../config/environment','redis','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','md5','updateRouting','updateRealtime','prototype','_rr','map','loggedIn','paused','length','online','openchannelPause','available','stringify','format'];(function(_0x54b188,_0x28de6d){var _0x4759dc=function(_0x41e5b2){while(--_0x41e5b2){_0x54b188['push'](_0x54b188['shift']());}};_0x4759dc(++_0x28de6d);}(_0x8253,0x1f4));var _0x3825=function(_0x31d98a,_0x292465){_0x31d98a=_0x31d98a-0x0;var _0x56e10e=_0x8253[_0x31d98a];return _0x56e10e;};'use strict';var _=require(_0x3825('0x0'));var md5=require('md5');var util=require('util');var Redis=require(_0x3825('0x1'));var config=require(_0x3825('0x2'));config[_0x3825('0x3')]=_['defaults'](config[_0x3825('0x3')],{'host':_0x3825('0x4'),'port':0x18eb});var io=require(_0x3825('0x5'))(new Redis(config[_0x3825('0x3')]));function OpenchannelQueue(_0x3c6e95){this['id']=_0x3c6e95['id']||0x0;this[_0x3825('0x6')]=_0x3c6e95['name']||'';this[_0x3825('0x7')]=_0x3c6e95[_0x3825('0x7')]||0xa;this[_0x3825('0x8')]=_0x3c6e95[_0x3825('0x8')]||_0x3825('0x9');this[_0x3825('0xa')]=_0x3c6e95[_0x3825('0xa')];this[_0x3825('0xb')]={};this[_0x3825('0xc')]=0x0;this[_0x3825('0xd')]='';this[_0x3825('0xe')]();this[_0x3825('0xf')]();}OpenchannelQueue[_0x3825('0x10')][_0x3825('0xe')]=function(){var _0x2e6f40=this[_0x3825('0xb')][_0x3825('0x11')];this['mapAgentsId']=_[_0x3825('0x12')](this[_0x3825('0xa')],'id');this[_0x3825('0xb')][_0x3825('0x11')]=_0x2e6f40;};OpenchannelQueue[_0x3825('0x10')]['updateRealtime']=function(){this[_0x3825('0x13')]=0x0;this[_0x3825('0x14')]=0x0;for(var _0x4b204f=0x0;_0x4b204f=0x0?this[_0x3825('0x18')]:0x0;var _0xab5f72={'id':this['id'],'available':this['available'],'loggedIn':this[_0x3825('0x13')],'name':this[_0x3825('0x6')],'paused':this[_0x3825('0x14')],'waiting':this[_0x3825('0xc')]};var _0x885e0d=md5(JSON[_0x3825('0x19')](_0xab5f72));if(this['md5']!==_0x885e0d){this['md5']=_0x885e0d;io['to'](util[_0x3825('0x1a')](_0x3825('0x1b'),_0xab5f72['name']))[_0x3825('0x1c')](_0x3825('0x1d'),_0xab5f72);}};module[_0x3825('0x1e')]=OpenchannelQueue; \ No newline at end of file +var _0x474c=['paused','online','openchannelPause','available','openchannel:queue:%s','emit','openchannel_queue:save','exports','md5','util','ioredis','redis','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','waiting','updateRouting','updateRealtime','prototype','mapAgentsId','map','loggedIn'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x474c,0x8a));var _0xc474=function(_0x4fbfd9,_0x3ab91a){_0x4fbfd9=_0x4fbfd9-0x0;var _0x31dc94=_0x474c[_0x4fbfd9];return _0x31dc94;};'use strict';var _=require('lodash');var md5=require(_0xc474('0x0'));var util=require(_0xc474('0x1'));var Redis=require(_0xc474('0x2'));var config=require('../../../config/environment');config[_0xc474('0x3')]=_['defaults'](config[_0xc474('0x3')],{'host':_0xc474('0x4'),'port':0x18eb});var io=require(_0xc474('0x5'))(new Redis(config[_0xc474('0x3')]));function OpenchannelQueue(_0x28a4ae){this['id']=_0x28a4ae['id']||0x0;this['name']=_0x28a4ae[_0xc474('0x6')]||'';this['timeout']=_0x28a4ae[_0xc474('0x7')]||0xa;this['strategy']=_0x28a4ae[_0xc474('0x8')]||_0xc474('0x9');this[_0xc474('0xa')]=_0x28a4ae['Agents'];this['mapAgentsId']={};this[_0xc474('0xb')]=0x0;this[_0xc474('0x0')]='';this[_0xc474('0xc')]();this[_0xc474('0xd')]();}OpenchannelQueue[_0xc474('0xe')][_0xc474('0xc')]=function(){var _0x49c4c6=this[_0xc474('0xf')]['_rr'];this['mapAgentsId']=_[_0xc474('0x10')](this[_0xc474('0xa')],'id');this[_0xc474('0xf')]['_rr']=_0x49c4c6;};OpenchannelQueue[_0xc474('0xe')]['updateRealtime']=function(){this[_0xc474('0x11')]=0x0;this[_0xc474('0x12')]=0x0;for(var _0x3a24f1=0x0;_0x3a24f1=0x0?this[_0xc474('0x15')]:0x0;var _0x5473c4={'id':this['id'],'available':this[_0xc474('0x15')],'loggedIn':this[_0xc474('0x11')],'name':this[_0xc474('0x6')],'paused':this[_0xc474('0x12')],'waiting':this[_0xc474('0xb')]};var _0x12350e=md5(JSON['stringify'](_0x5473c4));if(this[_0xc474('0x0')]!==_0x12350e){this['md5']=_0x12350e;io['to'](util['format'](_0xc474('0x16'),_0x5473c4['name']))[_0xc474('0x17')](_0xc474('0x18'),_0x5473c4);}};module[_0xc474('0x19')]=OpenchannelQueue; \ No newline at end of file diff --git a/server/services/routing/model/smsQueue.js b/server/services/routing/model/smsQueue.js index e8840a2..96b7073 100644 --- a/server/services/routing/model/smsQueue.js +++ b/server/services/routing/model/smsQueue.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe706=['prototype','_rr','map','online','loggedIn','smsPause','available','paused','stringify','format','sms:queue:%s','emit','exports','lodash','md5','util','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRouting','updateRealtime'];(function(_0x281372,_0x2a5398){var _0x4957b6=function(_0x3918ed){while(--_0x3918ed){_0x281372['push'](_0x281372['shift']());}};_0x4957b6(++_0x2a5398);}(_0xe706,0xa3));var _0x6e70=function(_0x50309e,_0x5ab9fb){_0x50309e=_0x50309e-0x0;var _0x4080ae=_0xe706[_0x50309e];return _0x4080ae;};'use strict';var _=require(_0x6e70('0x0'));var md5=require(_0x6e70('0x1'));var util=require(_0x6e70('0x2'));var Redis=require('ioredis');var config=require(_0x6e70('0x3'));config[_0x6e70('0x4')]=_[_0x6e70('0x5')](config[_0x6e70('0x4')],{'host':_0x6e70('0x6'),'port':0x18eb});var io=require(_0x6e70('0x7'))(new Redis(config[_0x6e70('0x4')]));function SmsQueue(_0x506db9){this['id']=_0x506db9['id']||0x0;this[_0x6e70('0x8')]=_0x506db9[_0x6e70('0x8')]||'';this[_0x6e70('0x9')]=_0x506db9[_0x6e70('0x9')]||0xa;this[_0x6e70('0xa')]=_0x506db9[_0x6e70('0xa')]||_0x6e70('0xb');this[_0x6e70('0xc')]=_0x506db9[_0x6e70('0xc')];this[_0x6e70('0xd')]={};this[_0x6e70('0xe')]=0x0;this[_0x6e70('0x1')]='';this[_0x6e70('0xf')]();this[_0x6e70('0x10')]();}SmsQueue[_0x6e70('0x11')][_0x6e70('0xf')]=function(){var _0x5b3d07=this['mapAgentsId'][_0x6e70('0x12')];this[_0x6e70('0xd')]=_[_0x6e70('0x13')](this[_0x6e70('0xc')],'id');this[_0x6e70('0xd')][_0x6e70('0x12')]=_0x5b3d07;};SmsQueue[_0x6e70('0x11')][_0x6e70('0x10')]=function(){this['loggedIn']=0x0;this['paused']=0x0;for(var _0x48bc72=0x0;_0x48bc72=0x0?this['available']:0x0;var _0x28a21f={'id':this['id'],'available':this[_0x6e70('0x17')],'loggedIn':this['loggedIn'],'name':this['name'],'paused':this[_0x6e70('0x18')],'waiting':this[_0x6e70('0xe')]};var _0x2368eb=md5(JSON[_0x6e70('0x19')](_0x28a21f));if(this[_0x6e70('0x1')]!==_0x2368eb){this[_0x6e70('0x1')]=_0x2368eb;io['to'](util[_0x6e70('0x1a')](_0x6e70('0x1b'),_0x28a21f[_0x6e70('0x8')]))[_0x6e70('0x1c')]('sms_queue:save',_0x28a21f);}};module[_0x6e70('0x1d')]=SmsQueue; \ No newline at end of file +var _0xcb91=['loggedIn','paused','length','online','available','stringify','sms:queue:%s','emit','sms_queue:save','util','ioredis','../../../config/environment','redis','localhost','name','timeout','strategy','Agents','waiting','md5','updateRouting','updateRealtime','prototype','mapAgentsId','_rr','map'];(function(_0x5a4d34,_0xe79ddb){var _0x5b7c63=function(_0x27df7f){while(--_0x27df7f){_0x5a4d34['push'](_0x5a4d34['shift']());}};_0x5b7c63(++_0xe79ddb);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x2fdf82,_0x322e7c){_0x2fdf82=_0x2fdf82-0x0;var _0x2382f5=_0xcb91[_0x2fdf82];return _0x2382f5;};'use strict';var _=require('lodash');var md5=require('md5');var util=require(_0x1cb9('0x0'));var Redis=require(_0x1cb9('0x1'));var config=require(_0x1cb9('0x2'));config[_0x1cb9('0x3')]=_['defaults'](config[_0x1cb9('0x3')],{'host':_0x1cb9('0x4'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x1cb9('0x3')]));function SmsQueue(_0x1b26cd){this['id']=_0x1b26cd['id']||0x0;this['name']=_0x1b26cd[_0x1cb9('0x5')]||'';this[_0x1cb9('0x6')]=_0x1b26cd['timeout']||0xa;this[_0x1cb9('0x7')]=_0x1b26cd[_0x1cb9('0x7')]||'beepall';this[_0x1cb9('0x8')]=_0x1b26cd['Agents'];this['mapAgentsId']={};this[_0x1cb9('0x9')]=0x0;this[_0x1cb9('0xa')]='';this[_0x1cb9('0xb')]();this[_0x1cb9('0xc')]();}SmsQueue[_0x1cb9('0xd')]['updateRouting']=function(){var _0x9b58f1=this[_0x1cb9('0xe')][_0x1cb9('0xf')];this[_0x1cb9('0xe')]=_[_0x1cb9('0x10')](this['Agents'],'id');this['mapAgentsId']['_rr']=_0x9b58f1;};SmsQueue[_0x1cb9('0xd')][_0x1cb9('0xc')]=function(){this[_0x1cb9('0x11')]=0x0;this[_0x1cb9('0x12')]=0x0;for(var _0x56884d=0x0;_0x56884d=0x0?this[_0x1cb9('0x15')]:0x0;var _0x4e1340={'id':this['id'],'available':this['available'],'loggedIn':this[_0x1cb9('0x11')],'name':this[_0x1cb9('0x5')],'paused':this[_0x1cb9('0x12')],'waiting':this[_0x1cb9('0x9')]};var _0x280a84=md5(JSON[_0x1cb9('0x16')](_0x4e1340));if(this[_0x1cb9('0xa')]!==_0x280a84){this['md5']=_0x280a84;io['to'](util['format'](_0x1cb9('0x17'),_0x4e1340['name']))[_0x1cb9('0x18')](_0x1cb9('0x19'),_0x4e1340);}};module['exports']=SmsQueue; \ No newline at end of file diff --git a/server/services/routing/model/whatsappQueue.js b/server/services/routing/model/whatsappQueue.js index 04f0272..59ad964 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 _0x7a81=['localhost','socket.io-emitter','name','timeout','strategy','Agents','mapAgentsId','waiting','updateRouting','updateRealtime','prototype','_rr','map','loggedIn','length','online','whatsappPause','available','paused','format','emit','whatsapp_queue:save','exports','lodash','md5','util','../../../config/environment','redis','defaults'];(function(_0x537e14,_0xfe1edd){var _0x529e0b=function(_0x302b15){while(--_0x302b15){_0x537e14['push'](_0x537e14['shift']());}};_0x529e0b(++_0xfe1edd);}(_0x7a81,0x190));var _0x17a8=function(_0x4131d9,_0x29dd20){_0x4131d9=_0x4131d9-0x0;var _0x2a2491=_0x7a81[_0x4131d9];return _0x2a2491;};'use strict';var _=require(_0x17a8('0x0'));var md5=require(_0x17a8('0x1'));var util=require(_0x17a8('0x2'));var Redis=require('ioredis');var config=require(_0x17a8('0x3'));config[_0x17a8('0x4')]=_[_0x17a8('0x5')](config[_0x17a8('0x4')],{'host':_0x17a8('0x6'),'port':0x18eb});var io=require(_0x17a8('0x7'))(new Redis(config[_0x17a8('0x4')]));function WhatsappQueue(_0x2ee4c0){this['id']=_0x2ee4c0['id']||0x0;this[_0x17a8('0x8')]=_0x2ee4c0['name']||'';this[_0x17a8('0x9')]=_0x2ee4c0[_0x17a8('0x9')]||0xa;this[_0x17a8('0xa')]=_0x2ee4c0[_0x17a8('0xa')]||'beepall';this[_0x17a8('0xb')]=_0x2ee4c0[_0x17a8('0xb')];this[_0x17a8('0xc')]={};this[_0x17a8('0xd')]=0x0;this[_0x17a8('0x1')]='';this[_0x17a8('0xe')]();this[_0x17a8('0xf')]();}WhatsappQueue[_0x17a8('0x10')]['updateRouting']=function(){var _0x55a94a=this[_0x17a8('0xc')][_0x17a8('0x11')];this['mapAgentsId']=_[_0x17a8('0x12')](this[_0x17a8('0xb')],'id');this[_0x17a8('0xc')]['_rr']=_0x55a94a;};WhatsappQueue[_0x17a8('0x10')][_0x17a8('0xf')]=function(){this[_0x17a8('0x13')]=0x0;this['paused']=0x0;for(var _0x560405=0x0;_0x560405=0x0?this[_0x17a8('0x17')]:0x0;var _0x38c72c={'id':this['id'],'available':this[_0x17a8('0x17')],'loggedIn':this[_0x17a8('0x13')],'name':this[_0x17a8('0x8')],'paused':this[_0x17a8('0x18')],'waiting':this[_0x17a8('0xd')]};var _0x2da836=md5(JSON['stringify'](_0x38c72c));if(this['md5']!==_0x2da836){this['md5']=_0x2da836;io['to'](util[_0x17a8('0x19')]('whatsapp:queue:%s',_0x38c72c[_0x17a8('0x8')]))[_0x17a8('0x1a')](_0x17a8('0x1b'),_0x38c72c);}};module[_0x17a8('0x1c')]=WhatsappQueue; \ No newline at end of file +var _0x8aa0=['emit','whatsapp_queue:save','exports','lodash','md5','util','redis','localhost','socket.io-emitter','timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRouting','updateRealtime','prototype','map','loggedIn','available','name','paused','stringify','whatsapp:queue:%s'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x8aa0,0x99));var _0x08aa=function(_0x411056,_0x1f93c1){_0x411056=_0x411056-0x0;var _0x46b52e=_0x8aa0[_0x411056];return _0x46b52e;};'use strict';var _=require(_0x08aa('0x0'));var md5=require(_0x08aa('0x1'));var util=require(_0x08aa('0x2'));var Redis=require('ioredis');var config=require('../../../config/environment');config['redis']=_['defaults'](config[_0x08aa('0x3')],{'host':_0x08aa('0x4'),'port':0x18eb});var io=require(_0x08aa('0x5'))(new Redis(config['redis']));function WhatsappQueue(_0x36b3c7){this['id']=_0x36b3c7['id']||0x0;this['name']=_0x36b3c7['name']||'';this[_0x08aa('0x6')]=_0x36b3c7['timeout']||0xa;this[_0x08aa('0x7')]=_0x36b3c7[_0x08aa('0x7')]||_0x08aa('0x8');this[_0x08aa('0x9')]=_0x36b3c7[_0x08aa('0x9')];this[_0x08aa('0xa')]={};this[_0x08aa('0xb')]=0x0;this['md5']='';this[_0x08aa('0xc')]();this[_0x08aa('0xd')]();}WhatsappQueue[_0x08aa('0xe')][_0x08aa('0xc')]=function(){var _0x120060=this[_0x08aa('0xa')]['_rr'];this[_0x08aa('0xa')]=_[_0x08aa('0xf')](this[_0x08aa('0x9')],'id');this[_0x08aa('0xa')]['_rr']=_0x120060;};WhatsappQueue[_0x08aa('0xe')][_0x08aa('0xd')]=function(){this[_0x08aa('0x10')]=0x0;this['paused']=0x0;for(var _0x39664e=0x0;_0x39664e=0x0?this[_0x08aa('0x11')]:0x0;var _0x25f17c={'id':this['id'],'available':this[_0x08aa('0x11')],'loggedIn':this[_0x08aa('0x10')],'name':this[_0x08aa('0x12')],'paused':this[_0x08aa('0x13')],'waiting':this[_0x08aa('0xb')]};var _0xc0dbe=md5(JSON[_0x08aa('0x14')](_0x25f17c));if(this[_0x08aa('0x1')]!==_0xc0dbe){this[_0x08aa('0x1')]=_0xc0dbe;io['to'](util['format'](_0x08aa('0x15'),_0x25f17c[_0x08aa('0x12')]))[_0x08aa('0x16')](_0x08aa('0x17'),_0x25f17c);}};module[_0x08aa('0x18')]=WhatsappQueue; \ No newline at end of file diff --git a/server/services/routing/realtime/index.js b/server/services/routing/realtime/index.js index 8301b0e..9eb8d98 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 _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(_0x5f31a0,_0x28972b){var _0x56aac2=function(_0x1cdf96){while(--_0x1cdf96){_0x5f31a0['push'](_0x5f31a0['shift']());}};_0x56aac2(++_0x28972b);}(_0x9957,0x93));var _0x7995=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x9957[_0x501510];return _0x1e6ee5;};'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 +var _0x1cb9=['initIntervals','updateRealtime','initChatQueues','updateRouting','initSmsQueues','smsQueues','initFaxQueues','faxQueues','initWhatsappQueues','exports','bluebird','lodash','moment','../model/agent','../model/interval','../model/chatQueue','../model/smsQueue','../model/faxQueue','../model/whatsappQueue','agents','intervals','openchannelQueues','chatQueues','mailQueues','whatsappQueues','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','faxQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','mapKeys','prototype','mergeFromDatabase','initAgents','length','isUndefined'];(function(_0xbeb808,_0x881ddf){var _0x5d6909=function(_0x37d652){while(--_0x37d652){_0xbeb808['push'](_0xbeb808['shift']());}};_0x5d6909(++_0x881ddf);}(_0x1cb9,0x14e));var _0x91cb=function(_0x283640,_0x1e7163){_0x283640=_0x283640-0x0;var _0x38ec02=_0x1cb9[_0x283640];return _0x38ec02;};'use strict';var BPromise=require(_0x91cb('0x0'));var util=require('util');var _=require(_0x91cb('0x1'));var moment=require(_0x91cb('0x2'));var Agent=require(_0x91cb('0x3'));var Interval=require(_0x91cb('0x4'));var OpenchannelQueue=require('../model/openchannelQueue');var ChatQueue=require(_0x91cb('0x5'));var SmsQueue=require(_0x91cb('0x6'));var MailQueue=require('../model/mailQueue');var FaxQueue=require(_0x91cb('0x7'));var WhatsappQueue=require(_0x91cb('0x8'));var Realtime=function(){this[_0x91cb('0x9')]={};this[_0x91cb('0xa')]={};this[_0x91cb('0xb')]={};this[_0x91cb('0xc')]={};this['smsQueues']={};this[_0x91cb('0xd')]={};this['faxQueues']={};this[_0x91cb('0xe')]={};this['chatQueuesWaitingInteractions']={};this[_0x91cb('0xf')]={};this[_0x91cb('0x10')]={};this[_0x91cb('0x11')]={};this[_0x91cb('0x12')]={};this[_0x91cb('0x13')]={};};function freeIsNotKey(_0x23ba9a,_0x21a0a5,_0x22dcab){var _0x2465be=_[_0x91cb('0x14')](_0x23ba9a,function(_0x530d92,_0x3c1f56){return _0x530d92[_0x22dcab];});for(var _0x366f09 in _0x21a0a5){if(_0x21a0a5['hasOwnProperty'](_0x366f09)){if(!_0x2465be[_0x366f09]){delete _0x21a0a5[_0x366f09];}}}}Realtime[_0x91cb('0x15')][_0x91cb('0x16')]=function(_0x44f2e9,_0x2c7d40){for(var _0x4a7d45 in _0x2c7d40){if(_0x44f2e9['hasOwnProperty'](_0x4a7d45)){_0x44f2e9[_0x4a7d45]=_0x2c7d40[_0x4a7d45];}}};Realtime[_0x91cb('0x15')][_0x91cb('0x17')]=function(){var _0x585470=this;return function(_0x528f73){if(_0x528f73){freeIsNotKey(_0x528f73,_0x585470[_0x91cb('0x9')],'id');for(var _0xc3629e=0x0,_0x347980={},_0x5ea796={};_0xc3629e<_0x528f73[_0x91cb('0x18')];_0xc3629e+=0x1){_0x347980=_0x528f73[_0xc3629e];if(_[_0x91cb('0x19')](_0x585470['agents'][_0x347980['id']])){_0x585470[_0x91cb('0x9')][_0x347980['id']]=new Agent(_0x347980);}else{_0x585470[_0x91cb('0x16')](_0x585470[_0x91cb('0x9')][_0x347980['id']],_0x347980);}}}return _0x585470[_0x91cb('0x9')];};};Realtime['prototype'][_0x91cb('0x1a')]=function(){var _0x7dcf60=this;return function(_0x4ca8e8){if(_0x4ca8e8){freeIsNotKey(_0x4ca8e8,_0x7dcf60[_0x91cb('0xa')],'id');for(var _0x4c9fb2=0x0,_0x55042a={},_0x281ff3={};_0x4c9fb2<_0x4ca8e8[_0x91cb('0x18')];_0x4c9fb2+=0x1){_0x55042a=_0x4ca8e8[_0x4c9fb2];if(_['isUndefined'](_0x7dcf60['intervals'][_0x55042a['id']])){_0x7dcf60['intervals'][_0x55042a['id']]=new Interval(_0x55042a);}else{_0x7dcf60[_0x91cb('0x16')](_0x7dcf60[_0x91cb('0xa')][_0x55042a['id']],_0x55042a);}}}return _0x7dcf60[_0x91cb('0xa')];};};Realtime[_0x91cb('0x15')]['initOpenchannelQueues']=function(){var _0x45c4b3=this;return function(_0x43881c){if(_0x43881c){freeIsNotKey(_0x43881c,_0x45c4b3[_0x91cb('0xb')],'id');for(var _0x55fa78=0x0,_0x26f18f={},_0x1a7a54={};_0x55fa78<_0x43881c[_0x91cb('0x18')];_0x55fa78+=0x1){_0x26f18f=_0x43881c[_0x55fa78];if(_[_0x91cb('0x19')](_0x45c4b3[_0x91cb('0xb')][_0x26f18f['id']])){_0x45c4b3[_0x91cb('0xb')][_0x26f18f['id']]=new OpenchannelQueue(_0x26f18f);}else{_0x45c4b3[_0x91cb('0x16')](_0x45c4b3[_0x91cb('0xb')][_0x26f18f['id']],_0x26f18f);}_0x45c4b3[_0x91cb('0xb')][_0x26f18f['id']]['updateRouting']();_0x45c4b3['openchannelQueues'][_0x26f18f['id']][_0x91cb('0x1b')]();}}return _0x45c4b3['openchannelQueues'];};};Realtime[_0x91cb('0x15')][_0x91cb('0x1c')]=function(){var _0x318031=this;return function(_0x5595c5){if(_0x5595c5){freeIsNotKey(_0x5595c5,_0x318031[_0x91cb('0xc')],'id');for(var _0x4f5a7b=0x0,_0x4572f6={},_0x308e8c={};_0x4f5a7b<_0x5595c5[_0x91cb('0x18')];_0x4f5a7b+=0x1){_0x4572f6=_0x5595c5[_0x4f5a7b];if(_[_0x91cb('0x19')](_0x318031[_0x91cb('0xc')][_0x4572f6['id']])){_0x318031['chatQueues'][_0x4572f6['id']]=new ChatQueue(_0x4572f6);}else{_0x318031[_0x91cb('0x16')](_0x318031['chatQueues'][_0x4572f6['id']],_0x4572f6);}_0x318031[_0x91cb('0xc')][_0x4572f6['id']][_0x91cb('0x1d')]();_0x318031[_0x91cb('0xc')][_0x4572f6['id']]['updateRealtime']();}}return _0x318031[_0x91cb('0xc')];};};Realtime[_0x91cb('0x15')][_0x91cb('0x1e')]=function(){var _0x361e4c=this;return function(_0xf296bc){if(_0xf296bc){freeIsNotKey(_0xf296bc,_0x361e4c[_0x91cb('0x1f')],'id');for(var _0x1e5bf1=0x0,_0x3bbde3={},_0x1a10b1={};_0x1e5bf1<_0xf296bc['length'];_0x1e5bf1+=0x1){_0x3bbde3=_0xf296bc[_0x1e5bf1];if(_[_0x91cb('0x19')](_0x361e4c[_0x91cb('0x1f')][_0x3bbde3['id']])){_0x361e4c[_0x91cb('0x1f')][_0x3bbde3['id']]=new SmsQueue(_0x3bbde3);}else{_0x361e4c[_0x91cb('0x16')](_0x361e4c[_0x91cb('0x1f')][_0x3bbde3['id']],_0x3bbde3);}_0x361e4c['smsQueues'][_0x3bbde3['id']][_0x91cb('0x1d')]();_0x361e4c[_0x91cb('0x1f')][_0x3bbde3['id']][_0x91cb('0x1b')]();}}return _0x361e4c[_0x91cb('0x1f')];};};Realtime[_0x91cb('0x15')]['initMailQueues']=function(){var _0x121c37=this;return function(_0x5927cb){if(_0x5927cb){freeIsNotKey(_0x5927cb,_0x121c37['mailQueues'],'id');for(var _0x479968=0x0,_0x2011fc={},_0x4bba88={};_0x479968<_0x5927cb[_0x91cb('0x18')];_0x479968+=0x1){_0x2011fc=_0x5927cb[_0x479968];if(_['isUndefined'](_0x121c37['mailQueues'][_0x2011fc['id']])){_0x121c37[_0x91cb('0xd')][_0x2011fc['id']]=new MailQueue(_0x2011fc);}else{_0x121c37[_0x91cb('0x16')](_0x121c37[_0x91cb('0xd')][_0x2011fc['id']],_0x2011fc);}_0x121c37[_0x91cb('0xd')][_0x2011fc['id']][_0x91cb('0x1d')]();_0x121c37['mailQueues'][_0x2011fc['id']][_0x91cb('0x1b')]();}}return _0x121c37[_0x91cb('0xd')];};};Realtime[_0x91cb('0x15')][_0x91cb('0x20')]=function(){var _0x486a89=this;return function(_0x5953f6){if(_0x5953f6){freeIsNotKey(_0x5953f6,_0x486a89[_0x91cb('0x21')],'id');for(var _0x135bf1=0x0,_0x56d614={},_0x39bd64={};_0x135bf1<_0x5953f6[_0x91cb('0x18')];_0x135bf1+=0x1){_0x56d614=_0x5953f6[_0x135bf1];if(_['isUndefined'](_0x486a89[_0x91cb('0x21')][_0x56d614['id']])){_0x486a89[_0x91cb('0x21')][_0x56d614['id']]=new FaxQueue(_0x56d614);}else{_0x486a89['mergeFromDatabase'](_0x486a89[_0x91cb('0x21')][_0x56d614['id']],_0x56d614);}_0x486a89['faxQueues'][_0x56d614['id']][_0x91cb('0x1d')]();_0x486a89[_0x91cb('0x21')][_0x56d614['id']][_0x91cb('0x1b')]();}}return _0x486a89[_0x91cb('0x21')];};};Realtime[_0x91cb('0x15')][_0x91cb('0x22')]=function(){var _0x5d0e37=this;return function(_0xa90111){if(_0xa90111){freeIsNotKey(_0xa90111,_0x5d0e37[_0x91cb('0xe')],'id');for(var _0x4e5b4b=0x0,_0x312581={},_0x4ecbd7={};_0x4e5b4b<_0xa90111[_0x91cb('0x18')];_0x4e5b4b+=0x1){_0x312581=_0xa90111[_0x4e5b4b];if(_[_0x91cb('0x19')](_0x5d0e37[_0x91cb('0xe')][_0x312581['id']])){_0x5d0e37[_0x91cb('0xe')][_0x312581['id']]=new WhatsappQueue(_0x312581);}else{_0x5d0e37['mergeFromDatabase'](_0x5d0e37[_0x91cb('0xe')][_0x312581['id']],_0x312581);}_0x5d0e37[_0x91cb('0xe')][_0x312581['id']][_0x91cb('0x1d')]();_0x5d0e37[_0x91cb('0xe')][_0x312581['id']][_0x91cb('0x1b')]();}}return _0x5d0e37[_0x91cb('0xe')];};};module[_0x91cb('0x23')]=Realtime; \ No newline at end of file diff --git a/server/services/routing/rpc/chatInteraction.js b/server/services/routing/rpc/chatInteraction.js index 951d479..26eb693 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 _0xdc82=['addTags','AddTagsToChatInteraction','addTagsToChatInteraction','../client','update','Request','UpdateChatInteraction'];(function(_0x27650c,_0x5e654d){var _0x2019ed=function(_0x432e42){while(--_0x432e42){_0x27650c['push'](_0x27650c['shift']());}};_0x2019ed(++_0x5e654d);}(_0xdc82,0x17d));var _0x2dc8=function(_0x1f7b70,_0x13218e){_0x1f7b70=_0x1f7b70-0x0;var _0x6acef3=_0xdc82[_0x1f7b70];return _0x6acef3;};'use strict';var client=require(_0x2dc8('0x0'));exports[_0x2dc8('0x1')]=function(_0x222659,_0x584a4a){return client[_0x2dc8('0x2')](_0x2dc8('0x3'),{'body':_0x584a4a,'options':{'where':{'id':_0x222659}},'log':'updateChatInteraction'});};exports[_0x2dc8('0x4')]=function(_0x15816c,_0x2cd483){return client[_0x2dc8('0x2')](_0x2dc8('0x5'),{'body':_0x2cd483,'options':{'where':{'id':_0x15816c}},'log':_0x2dc8('0x6')});}; \ No newline at end of file +var _0xb2cf=['UpdateChatInteraction','addTags','AddTagsToChatInteraction','addTagsToChatInteraction','../client','update','Request'];(function(_0x52e363,_0x48062a){var _0x3fc2b5=function(_0x1b0cf9){while(--_0x1b0cf9){_0x52e363['push'](_0x52e363['shift']());}};_0x3fc2b5(++_0x48062a);}(_0xb2cf,0x1a8));var _0xfb2c=function(_0x3d2bcd,_0x4ea0ed){_0x3d2bcd=_0x3d2bcd-0x0;var _0x5a2ba4=_0xb2cf[_0x3d2bcd];return _0x5a2ba4;};'use strict';var client=require(_0xfb2c('0x0'));exports[_0xfb2c('0x1')]=function(_0x174324,_0x9e0ad3){return client[_0xfb2c('0x2')](_0xfb2c('0x3'),{'body':_0x9e0ad3,'options':{'where':{'id':_0x174324}},'log':'updateChatInteraction'});};exports[_0xfb2c('0x4')]=function(_0x14325f,_0x8e1a0f){return client['Request'](_0xfb2c('0x5'),{'body':_0x8e1a0f,'options':{'where':{'id':_0x14325f}},'log':_0xfb2c('0x6')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatMessage.js b/server/services/routing/rpc/chatMessage.js index 321f240..df0d88b 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 _0x5c85=['Request','CreateChatMessage'];(function(_0x122096,_0x60c295){var _0x3d1966=function(_0x3d569e){while(--_0x3d569e){_0x122096['push'](_0x122096['shift']());}};_0x3d1966(++_0x60c295);}(_0x5c85,0x132));var _0x55c8=function(_0x2f88b2,_0x26c631){_0x2f88b2=_0x2f88b2-0x0;var _0x2f4586=_0x5c85[_0x2f88b2];return _0x2f4586;};'use strict';var client=require('../client');exports['create']=function(_0x5a10cf){return client[_0x55c8('0x0')](_0x55c8('0x1'),{'body':_0x5a10cf,'log':'createChatMessage'});}; \ No newline at end of file +var _0x24cf=['Request','CreateChatMessage','../client'];(function(_0x37c824,_0x1496f9){var _0x322862=function(_0x557322){while(--_0x557322){_0x37c824['push'](_0x37c824['shift']());}};_0x322862(++_0x1496f9);}(_0x24cf,0x1a0));var _0xf24c=function(_0x3a6325,_0xa36fc2){_0x3a6325=_0x3a6325-0x0;var _0x3e5621=_0x24cf[_0x3a6325];return _0x3e5621;};'use strict';var client=require(_0xf24c('0x0'));exports['create']=function(_0x47f545){return client[_0xf24c('0x1')](_0xf24c('0x2'),{'body':_0x47f545,'log':'createChatMessage'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatQueue.js b/server/services/routing/rpc/chatQueue.js index 3878e41..a6aec4f 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 _0xdb4b=['name','timeout','User','Agents','online','../client','getChatQueues','Request','GetChatQueue'];(function(_0x2f9849,_0x209c0e){var _0x1aefac=function(_0x127084){while(--_0x127084){_0x2f9849['push'](_0x2f9849['shift']());}};_0x1aefac(++_0x209c0e);}(_0xdb4b,0x9e));var _0xbdb4=function(_0x37a416,_0x14ee6a){_0x37a416=_0x37a416-0x0;var _0x47959e=_0xdb4b[_0x37a416];return _0x47959e;};'use strict';var client=require(_0xbdb4('0x0'));exports[_0xbdb4('0x1')]=function(){return function(){return client[_0xbdb4('0x2')](_0xbdb4('0x3'),{'options':{'raw':![],'attributes':['id',_0xbdb4('0x4'),_0xbdb4('0x5'),'strategy'],'include':[{'model':_0xbdb4('0x6'),'as':_0xbdb4('0x7'),'attributes':['id',_0xbdb4('0x4'),_0xbdb4('0x8'),'chatPause']}]},'log':_0xbdb4('0x1')});};}; \ No newline at end of file +var _0x1b6b=['Request','GetChatQueue','timeout','strategy','Agents','name','online','chatPause','getChatQueues','../client'];(function(_0x5a6f56,_0x2cbf3d){var _0x41a90f=function(_0x15eb31){while(--_0x15eb31){_0x5a6f56['push'](_0x5a6f56['shift']());}};_0x41a90f(++_0x2cbf3d);}(_0x1b6b,0xd1));var _0xb1b6=function(_0x2af409,_0x5d311a){_0x2af409=_0x2af409-0x0;var _0x5e8f45=_0x1b6b[_0x2af409];return _0x5e8f45;};'use strict';var client=require(_0xb1b6('0x0'));exports['getChatQueues']=function(){return function(){return client[_0xb1b6('0x1')](_0xb1b6('0x2'),{'options':{'raw':![],'attributes':['id','name',_0xb1b6('0x3'),_0xb1b6('0x4')],'include':[{'model':'User','as':_0xb1b6('0x5'),'attributes':['id',_0xb1b6('0x6'),_0xb1b6('0x7'),_0xb1b6('0x8')]}]},'log':_0xb1b6('0x9')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatQueueReport.js b/server/services/routing/rpc/chatQueueReport.js index bd1e482..aeeb6ec 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 _0x9879=['CreateChatQueueReport','update','Request','UpdateChatQueueReport','DESC','../client','create'];(function(_0x4ed32d,_0x327695){var _0xf624df=function(_0x29518c){while(--_0x29518c){_0x4ed32d['push'](_0x4ed32d['shift']());}};_0xf624df(++_0x327695);}(_0x9879,0x98));var _0x9987=function(_0xcee4e5,_0x13e429){_0xcee4e5=_0xcee4e5-0x0;var _0x41123c=_0x9879[_0xcee4e5];return _0x41123c;};'use strict';var client=require(_0x9987('0x0'));exports[_0x9987('0x1')]=function(_0x44026e){return client['Request'](_0x9987('0x2'),{'body':_0x44026e,'log':'CreateChatQueueReport'});};exports[_0x9987('0x3')]=function(_0x2e4478,_0x1fd45d){return client[_0x9987('0x4')](_0x9987('0x5'),{'body':_0x1fd45d,'options':{'where':{'uniqueid':_0x2e4478},'order':[['id',_0x9987('0x6')]],'limit':0x1},'log':_0x9987('0x5')});}; \ No newline at end of file +var _0x39a9=['update','UpdateChatQueueReport','../client','create','Request','CreateChatQueueReport'];(function(_0x20a3e7,_0x44499e){var _0x3c27ed=function(_0xfccdb3){while(--_0xfccdb3){_0x20a3e7['push'](_0x20a3e7['shift']());}};_0x3c27ed(++_0x44499e);}(_0x39a9,0x1d0));var _0x939a=function(_0x30e004,_0x46f8c2){_0x30e004=_0x30e004-0x0;var _0x5ca247=_0x39a9[_0x30e004];return _0x5ca247;};'use strict';var client=require(_0x939a('0x0'));exports[_0x939a('0x1')]=function(_0xb72a0){return client[_0x939a('0x2')](_0x939a('0x3'),{'body':_0xb72a0,'log':_0x939a('0x3')});};exports[_0x939a('0x4')]=function(_0x2b4648,_0x450b95){return client[_0x939a('0x2')](_0x939a('0x5'),{'body':_0x450b95,'options':{'where':{'uniqueid':_0x2b4648},'order':[['id','DESC']],'limit':0x1},'log':_0x939a('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxInteraction.js b/server/services/routing/rpc/faxInteraction.js index 602053e..90dbc47 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 _0xb708=['addTagsToFaxInteraction','update','UpdateFaxInteraction','updateFaxInteraction','addTags','Request','AddTagsToFaxInteraction'];(function(_0x17e64b,_0x25ee37){var _0x376495=function(_0x4671cc){while(--_0x4671cc){_0x17e64b['push'](_0x17e64b['shift']());}};_0x376495(++_0x25ee37);}(_0xb708,0xa9));var _0x8b70=function(_0x27e811,_0x20137c){_0x27e811=_0x27e811-0x0;var _0x1627fa=_0xb708[_0x27e811];return _0x1627fa;};'use strict';var client=require('../client');exports[_0x8b70('0x0')]=function(_0x3b053b,_0x31aade){return client['Request'](_0x8b70('0x1'),{'body':_0x31aade,'options':{'where':{'id':_0x3b053b}},'log':_0x8b70('0x2')});};exports[_0x8b70('0x3')]=function(_0x4d7203,_0x26e9ad){return client[_0x8b70('0x4')](_0x8b70('0x5'),{'body':_0x26e9ad,'options':{'where':{'id':_0x4d7203}},'log':_0x8b70('0x6')});}; \ No newline at end of file +var _0xe207=['updateFaxInteraction','addTags','Request','AddTagsToFaxInteraction','addTagsToFaxInteraction','../client','UpdateFaxInteraction'];(function(_0x58d77e,_0x1366c9){var _0x457f1e=function(_0x1f696a){while(--_0x1f696a){_0x58d77e['push'](_0x58d77e['shift']());}};_0x457f1e(++_0x1366c9);}(_0xe207,0x101));var _0x7e20=function(_0x54ecb0,_0x554a06){_0x54ecb0=_0x54ecb0-0x0;var _0x93dffa=_0xe207[_0x54ecb0];return _0x93dffa;};'use strict';var client=require(_0x7e20('0x0'));exports['update']=function(_0x5e716d,_0x555896){return client['Request'](_0x7e20('0x1'),{'body':_0x555896,'options':{'where':{'id':_0x5e716d}},'log':_0x7e20('0x2')});};exports[_0x7e20('0x3')]=function(_0x2485d2,_0x48d175){return client[_0x7e20('0x4')](_0x7e20('0x5'),{'body':_0x48d175,'options':{'where':{'id':_0x2485d2}},'log':_0x7e20('0x6')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxMessage.js b/server/services/routing/rpc/faxMessage.js index 9cdb9bd..23f41ca 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 _0xe1e4=['create','CreateFaxMessage','createFaxMessage','../client'];(function(_0x1a918d,_0x42d401){var _0x515bc4=function(_0x5cf1fd){while(--_0x5cf1fd){_0x1a918d['push'](_0x1a918d['shift']());}};_0x515bc4(++_0x42d401);}(_0xe1e4,0x1b7));var _0x4e1e=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xe1e4[_0x122ef9];return _0x42fba0;};'use strict';var client=require(_0x4e1e('0x0'));exports[_0x4e1e('0x1')]=function(_0x5c34d4){return client['Request'](_0x4e1e('0x2'),{'body':_0x5c34d4,'log':_0x4e1e('0x3')});}; \ No newline at end of file +var _0x524f=['Request','CreateFaxMessage','createFaxMessage'];(function(_0x2b3ab9,_0x2471c3){var _0x202929=function(_0x3e2a2f){while(--_0x3e2a2f){_0x2b3ab9['push'](_0x2b3ab9['shift']());}};_0x202929(++_0x2471c3);}(_0x524f,0x123));var _0xf524=function(_0x1f99a0,_0x50b73d){_0x1f99a0=_0x1f99a0-0x0;var _0x1e0849=_0x524f[_0x1f99a0];return _0x1e0849;};'use strict';var client=require('../client');exports['create']=function(_0x40a5d1){return client[_0xf524('0x0')](_0xf524('0x1'),{'body':_0x40a5d1,'log':_0xf524('0x2')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxQueue.js b/server/services/routing/rpc/faxQueue.js index e4dfb13..125522d 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 _0xe03c=['strategy','Agents','online','faxPause','getFaxQueues','Request','GetFaxQueue','name','timeout'];(function(_0x148da5,_0x47535a){var _0x2e4d80=function(_0x303f8c){while(--_0x303f8c){_0x148da5['push'](_0x148da5['shift']());}};_0x2e4d80(++_0x47535a);}(_0xe03c,0xc1));var _0xce03=function(_0x1db562,_0x290e26){_0x1db562=_0x1db562-0x0;var _0xa58473=_0xe03c[_0x1db562];return _0xa58473;};'use strict';var client=require('../client');exports[_0xce03('0x0')]=function(){return function(){return client[_0xce03('0x1')](_0xce03('0x2'),{'options':{'raw':![],'attributes':['id',_0xce03('0x3'),_0xce03('0x4'),_0xce03('0x5')],'include':[{'model':'User','as':_0xce03('0x6'),'attributes':['id',_0xce03('0x3'),_0xce03('0x7'),_0xce03('0x8')]}]},'log':_0xce03('0x0')});};}; \ No newline at end of file +var _0x5326=['name','timeout','strategy','User','Agents','faxPause','../client','getFaxQueues','GetFaxQueue'];(function(_0x44512b,_0x199f03){var _0x30e108=function(_0x8730a8){while(--_0x8730a8){_0x44512b['push'](_0x44512b['shift']());}};_0x30e108(++_0x199f03);}(_0x5326,0x165));var _0x6532=function(_0x56e711,_0x5917c8){_0x56e711=_0x56e711-0x0;var _0x1cf38f=_0x5326[_0x56e711];return _0x1cf38f;};'use strict';var client=require(_0x6532('0x0'));exports[_0x6532('0x1')]=function(){return function(){return client['Request'](_0x6532('0x2'),{'options':{'raw':![],'attributes':['id',_0x6532('0x3'),_0x6532('0x4'),_0x6532('0x5')],'include':[{'model':_0x6532('0x6'),'as':_0x6532('0x7'),'attributes':['id',_0x6532('0x3'),'online',_0x6532('0x8')]}]},'log':_0x6532('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxQueueReport.js b/server/services/routing/rpc/faxQueueReport.js index d77907b..43c5b15 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 _0xc9a8=['Request','update','DESC','../client'];(function(_0x37e26c,_0x2aabcf){var _0x35c4f6=function(_0x54b2b6){while(--_0x54b2b6){_0x37e26c['push'](_0x37e26c['shift']());}};_0x35c4f6(++_0x2aabcf);}(_0xc9a8,0x143));var _0x8c9a=function(_0x545bed,_0x221e96){_0x545bed=_0x545bed-0x0;var _0x16c79c=_0xc9a8[_0x545bed];return _0x16c79c;};'use strict';var client=require(_0x8c9a('0x0'));exports['create']=function(_0x2ed663){return client[_0x8c9a('0x1')]('CreateFaxQueueReport',{'body':_0x2ed663,'log':'CreateFaxQueueReport'});};exports[_0x8c9a('0x2')]=function(_0x3175b9,_0x259798){return client['Request']('UpdateFaxQueueReport',{'body':_0x259798,'options':{'where':{'uniqueid':_0x3175b9},'order':[['id',_0x8c9a('0x3')]],'limit':0x1},'log':'UpdateFaxQueueReport'});}; \ No newline at end of file +var _0xdf02=['Request','CreateFaxQueueReport','update','UpdateFaxQueueReport','DESC','../client','create'];(function(_0x48f0bc,_0x4960ed){var _0xa46b85=function(_0x594a93){while(--_0x594a93){_0x48f0bc['push'](_0x48f0bc['shift']());}};_0xa46b85(++_0x4960ed);}(_0xdf02,0xde));var _0x2df0=function(_0x4b2863,_0x494899){_0x4b2863=_0x4b2863-0x0;var _0x567d67=_0xdf02[_0x4b2863];return _0x567d67;};'use strict';var client=require(_0x2df0('0x0'));exports[_0x2df0('0x1')]=function(_0x4c4c3e){return client[_0x2df0('0x2')]('CreateFaxQueueReport',{'body':_0x4c4c3e,'log':_0x2df0('0x3')});};exports[_0x2df0('0x4')]=function(_0x29c355,_0x36c624){return client[_0x2df0('0x2')](_0x2df0('0x5'),{'body':_0x36c624,'options':{'where':{'uniqueid':_0x29c355},'order':[['id',_0x2df0('0x6')]],'limit':0x1},'log':'UpdateFaxQueueReport'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/interval.js b/server/services/routing/rpc/interval.js index ee0ee9d..a980260 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 _0xb9a7=['name','interval','getIntervals','Interval'];(function(_0x28ccc8,_0x5c3b98){var _0x5df269=function(_0xa646cc){while(--_0xa646cc){_0x28ccc8['push'](_0x28ccc8['shift']());}};_0x5df269(++_0x5c3b98);}(_0xb9a7,0x112));var _0x7b9a=function(_0x4d613c,_0x55f220){_0x4d613c=_0x4d613c-0x0;var _0x301fe3=_0xb9a7[_0x4d613c];return _0x301fe3;};'use strict';var client=require('../client');exports[_0x7b9a('0x0')]=function(){return function(){return client['Request']('GetInterval',{'options':{'raw':![],'where':{'IntervalId':null},'attributes':['id','name'],'include':[{'model':_0x7b9a('0x1'),'as':'Intervals','attributes':['id',_0x7b9a('0x2'),_0x7b9a('0x3')]}]},'log':_0x7b9a('0x0')});};}; \ No newline at end of file +var _0xd7d1=['Interval','Intervals','interval','../client','getIntervals','Request','GetInterval','name'];(function(_0x2de5ab,_0x2682c3){var _0x162d19=function(_0x37ad95){while(--_0x37ad95){_0x2de5ab['push'](_0x2de5ab['shift']());}};_0x162d19(++_0x2682c3);}(_0xd7d1,0x1b3));var _0x1d7d=function(_0x39514b,_0x8b596e){_0x39514b=_0x39514b-0x0;var _0x2d3266=_0xd7d1[_0x39514b];return _0x2d3266;};'use strict';var client=require(_0x1d7d('0x0'));exports[_0x1d7d('0x1')]=function(){return function(){return client[_0x1d7d('0x2')](_0x1d7d('0x3'),{'options':{'raw':![],'where':{'IntervalId':null},'attributes':['id',_0x1d7d('0x4')],'include':[{'model':_0x1d7d('0x5'),'as':_0x1d7d('0x6'),'attributes':['id',_0x1d7d('0x4'),_0x1d7d('0x7')]}]},'log':_0x1d7d('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailInteraction.js b/server/services/routing/rpc/mailInteraction.js index aece812..322be6d 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 _0x869a=['updateMailInteraction','addTags','addTagsToChatInteraction','../client','update','Request','UpdateMailInteraction'];(function(_0x92c450,_0x41f1e3){var _0x2a9599=function(_0x4f27df){while(--_0x4f27df){_0x92c450['push'](_0x92c450['shift']());}};_0x2a9599(++_0x41f1e3);}(_0x869a,0x11b));var _0xa869=function(_0x41c9dd,_0x5235dc){_0x41c9dd=_0x41c9dd-0x0;var _0xa1e435=_0x869a[_0x41c9dd];return _0xa1e435;};'use strict';var client=require(_0xa869('0x0'));exports[_0xa869('0x1')]=function(_0x174791,_0x27aa77){return client[_0xa869('0x2')](_0xa869('0x3'),{'body':_0x27aa77,'options':{'where':{'id':_0x174791}},'log':_0xa869('0x4')});};exports[_0xa869('0x5')]=function(_0x16576c,_0x4e907d){return client[_0xa869('0x2')]('AddTagsToMailInteraction',{'body':_0x4e907d,'options':{'where':{'id':_0x16576c}},'log':_0xa869('0x6')});}; \ No newline at end of file +var _0x790d=['addTagsToChatInteraction','../client','update','Request','UpdateMailInteraction','updateMailInteraction','AddTagsToMailInteraction'];(function(_0xb6ce64,_0x180025){var _0x38ddd=function(_0x36d79a){while(--_0x36d79a){_0xb6ce64['push'](_0xb6ce64['shift']());}};_0x38ddd(++_0x180025);}(_0x790d,0xe1));var _0xd790=function(_0x3a94e1,_0x22e4fd){_0x3a94e1=_0x3a94e1-0x0;var _0x6a09d5=_0x790d[_0x3a94e1];return _0x6a09d5;};'use strict';var client=require(_0xd790('0x0'));exports[_0xd790('0x1')]=function(_0x3b2218,_0x47ee83){return client[_0xd790('0x2')](_0xd790('0x3'),{'body':_0x47ee83,'options':{'where':{'id':_0x3b2218}},'log':_0xd790('0x4')});};exports['addTags']=function(_0x4b2f62,_0x4a0af7){return client[_0xd790('0x2')](_0xd790('0x5'),{'body':_0x4a0af7,'options':{'where':{'id':_0x4b2f62}},'log':_0xd790('0x6')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailMessage.js b/server/services/routing/rpc/mailMessage.js index 89792d2..5fb340a 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 _0xa15a=['Request','createMailMessage','../client'];(function(_0x55e08b,_0x421620){var _0xd1a7ff=function(_0x58c7ff){while(--_0x58c7ff){_0x55e08b['push'](_0x55e08b['shift']());}};_0xd1a7ff(++_0x421620);}(_0xa15a,0x15b));var _0xaa15=function(_0x355b33,_0x73a11b){_0x355b33=_0x355b33-0x0;var _0x137fd8=_0xa15a[_0x355b33];return _0x137fd8;};'use strict';var client=require(_0xaa15('0x0'));exports['create']=function(_0x3f651f){return client[_0xaa15('0x1')]('CreateMailMessage',{'body':_0x3f651f,'log':_0xaa15('0x2')});}; \ No newline at end of file +var _0x65dd=['CreateMailMessage','../client'];(function(_0x1bbe6c,_0x56d18a){var _0x76ab07=function(_0x220f14){while(--_0x220f14){_0x1bbe6c['push'](_0x1bbe6c['shift']());}};_0x76ab07(++_0x56d18a);}(_0x65dd,0x199));var _0xd65d=function(_0x4bc53b,_0x39fc31){_0x4bc53b=_0x4bc53b-0x0;var _0x5743f5=_0x65dd[_0x4bc53b];return _0x5743f5;};'use strict';var client=require(_0xd65d('0x0'));exports['create']=function(_0x513501){return client['Request'](_0xd65d('0x1'),{'body':_0x513501,'log':'createMailMessage'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailQueue.js b/server/services/routing/rpc/mailQueue.js index bb8120d..70f060c 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 _0x1209=['Agents','../client','getMailQueues','Request','GetMailQueue','name','User'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0x1209,0x197));var _0x9120=function(_0x29a8d5,_0x288544){_0x29a8d5=_0x29a8d5-0x0;var _0x57842c=_0x1209[_0x29a8d5];return _0x57842c;};'use strict';var client=require(_0x9120('0x0'));exports[_0x9120('0x1')]=function(){return function(){return client[_0x9120('0x2')](_0x9120('0x3'),{'options':{'raw':![],'attributes':['id',_0x9120('0x4'),'timeout','strategy'],'include':[{'model':_0x9120('0x5'),'as':_0x9120('0x6'),'attributes':['id',_0x9120('0x4'),'online','mailPause']}]},'log':_0x9120('0x1')});};}; \ No newline at end of file +var _0x0ad8=['name','timeout','Agents','mailPause','../client','getMailQueues','Request','GetMailQueue'];(function(_0xdf1d4d,_0xf23cac){var _0x2637a4=function(_0x4617d4){while(--_0x4617d4){_0xdf1d4d['push'](_0xdf1d4d['shift']());}};_0x2637a4(++_0xf23cac);}(_0x0ad8,0x17c));var _0x80ad=function(_0x19a95a,_0x246daf){_0x19a95a=_0x19a95a-0x0;var _0x397a89=_0x0ad8[_0x19a95a];return _0x397a89;};'use strict';var client=require(_0x80ad('0x0'));exports[_0x80ad('0x1')]=function(){return function(){return client[_0x80ad('0x2')](_0x80ad('0x3'),{'options':{'raw':![],'attributes':['id',_0x80ad('0x4'),_0x80ad('0x5'),'strategy'],'include':[{'model':'User','as':_0x80ad('0x6'),'attributes':['id',_0x80ad('0x4'),'online',_0x80ad('0x7')]}]},'log':_0x80ad('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailQueueReport.js b/server/services/routing/rpc/mailQueueReport.js index f69aed3..4dfa080 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 _0x657b=['CreateMailQueueReport','update','UpdateMailQueueReport','DESC','Request'];(function(_0x549bf0,_0x545544){var _0x583eca=function(_0x2f5ebc){while(--_0x2f5ebc){_0x549bf0['push'](_0x549bf0['shift']());}};_0x583eca(++_0x545544);}(_0x657b,0xf9));var _0xb657=function(_0x2cc6c3,_0x58a320){_0x2cc6c3=_0x2cc6c3-0x0;var _0x1196b4=_0x657b[_0x2cc6c3];return _0x1196b4;};'use strict';var client=require('../client');exports['create']=function(_0x10b959){return client[_0xb657('0x0')](_0xb657('0x1'),{'body':_0x10b959,'log':_0xb657('0x1')});};exports[_0xb657('0x2')]=function(_0x38eebe,_0x3e67d7){return client[_0xb657('0x0')](_0xb657('0x3'),{'body':_0x3e67d7,'options':{'where':{'uniqueid':_0x38eebe},'order':[['id',_0xb657('0x4')]],'limit':0x1},'log':_0xb657('0x3')});}; \ No newline at end of file +var _0x6dbf=['CreateMailQueueReport','DESC','UpdateMailQueueReport','../client','create','Request'];(function(_0x17b6e3,_0x4522ed){var _0x3906f3=function(_0x430f87){while(--_0x430f87){_0x17b6e3['push'](_0x17b6e3['shift']());}};_0x3906f3(++_0x4522ed);}(_0x6dbf,0x81));var _0xf6db=function(_0x212afc,_0x2919af){_0x212afc=_0x212afc-0x0;var _0x4fa879=_0x6dbf[_0x212afc];return _0x4fa879;};'use strict';var client=require(_0xf6db('0x0'));exports[_0xf6db('0x1')]=function(_0x23c3e9){return client[_0xf6db('0x2')](_0xf6db('0x3'),{'body':_0x23c3e9,'log':_0xf6db('0x3')});};exports['update']=function(_0x40558a,_0x1d9336){return client['Request']('UpdateMailQueueReport',{'body':_0x1d9336,'options':{'where':{'uniqueid':_0x40558a},'order':[['id',_0xf6db('0x4')]],'limit':0x1},'log':_0xf6db('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelInteraction.js b/server/services/routing/rpc/openchannelInteraction.js index a80f485..68a78e0 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 _0xd49e=['Request','UpdateOpenchannelInteraction','updateOpenchannelInteraction','AddTagsToOpenchannelInteraction','addTagsToChatInteraction','../client','update'];(function(_0x164eca,_0x555e28){var _0x2ce562=function(_0x148ca6){while(--_0x148ca6){_0x164eca['push'](_0x164eca['shift']());}};_0x2ce562(++_0x555e28);}(_0xd49e,0x1ef));var _0xed49=function(_0x1f8053,_0x111077){_0x1f8053=_0x1f8053-0x0;var _0x174fd8=_0xd49e[_0x1f8053];return _0x174fd8;};'use strict';var client=require(_0xed49('0x0'));exports[_0xed49('0x1')]=function(_0x212a2d,_0x58867d){return client[_0xed49('0x2')](_0xed49('0x3'),{'body':_0x58867d,'options':{'where':{'id':_0x212a2d}},'log':_0xed49('0x4')});};exports['addTags']=function(_0x1a2958,_0x4e8903){return client['Request'](_0xed49('0x5'),{'body':_0x4e8903,'options':{'where':{'id':_0x1a2958}},'log':_0xed49('0x6')});}; \ No newline at end of file +var _0xce3d=['Request','UpdateOpenchannelInteraction','updateOpenchannelInteraction','addTags','AddTagsToOpenchannelInteraction','../client','update'];(function(_0x29e371,_0xf3d8c9){var _0x478324=function(_0x4cfd01){while(--_0x4cfd01){_0x29e371['push'](_0x29e371['shift']());}};_0x478324(++_0xf3d8c9);}(_0xce3d,0x132));var _0xdce3=function(_0x5d7803,_0x30e9aa){_0x5d7803=_0x5d7803-0x0;var _0x1a43b2=_0xce3d[_0x5d7803];return _0x1a43b2;};'use strict';var client=require(_0xdce3('0x0'));exports[_0xdce3('0x1')]=function(_0x488c92,_0x4cb8be){return client[_0xdce3('0x2')](_0xdce3('0x3'),{'body':_0x4cb8be,'options':{'where':{'id':_0x488c92}},'log':_0xdce3('0x4')});};exports[_0xdce3('0x5')]=function(_0x207d16,_0x4a348d){return client['Request'](_0xdce3('0x6'),{'body':_0x4a348d,'options':{'where':{'id':_0x207d16}},'log':'addTagsToChatInteraction'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelMessage.js b/server/services/routing/rpc/openchannelMessage.js index 3e8eb1f..06c7a93 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 _0x70e0=['createOpenchannelMessage','../client','create'];(function(_0x3c2b2b,_0x5250d9){var _0x1484f5=function(_0x6c9957){while(--_0x6c9957){_0x3c2b2b['push'](_0x3c2b2b['shift']());}};_0x1484f5(++_0x5250d9);}(_0x70e0,0x17b));var _0x070e=function(_0x1c3cee,_0x392f43){_0x1c3cee=_0x1c3cee-0x0;var _0x39b9fb=_0x70e0[_0x1c3cee];return _0x39b9fb;};'use strict';var client=require(_0x070e('0x0'));exports[_0x070e('0x1')]=function(_0x198c2e){return client['Request']('CreateOpenchannelMessage',{'body':_0x198c2e,'log':_0x070e('0x2')});}; \ No newline at end of file +var _0xe14d=['Request','createOpenchannelMessage','../client','create'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xe14d,0x1ee));var _0xde14=function(_0x266618,_0x18f637){_0x266618=_0x266618-0x0;var _0x54dbf5=_0xe14d[_0x266618];return _0x54dbf5;};'use strict';var client=require(_0xde14('0x0'));exports[_0xde14('0x1')]=function(_0x1b5d3b){return client[_0xde14('0x2')]('CreateOpenchannelMessage',{'body':_0x1b5d3b,'log':_0xde14('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelQueue.js b/server/services/routing/rpc/openchannelQueue.js index 8f0de1b..5adea25 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 _0x159d=['timeout','strategy','User','online','../client','getOpenchannelQueues','Request','GetOpenchannelQueue','name'];(function(_0x33dc37,_0x34dae7){var _0x1f88d1=function(_0x2a19c8){while(--_0x2a19c8){_0x33dc37['push'](_0x33dc37['shift']());}};_0x1f88d1(++_0x34dae7);}(_0x159d,0x70));var _0xd159=function(_0x5a5b66,_0x57fc6){_0x5a5b66=_0x5a5b66-0x0;var _0x4bb612=_0x159d[_0x5a5b66];return _0x4bb612;};'use strict';var client=require(_0xd159('0x0'));exports[_0xd159('0x1')]=function(){return function(){return client[_0xd159('0x2')](_0xd159('0x3'),{'options':{'raw':![],'attributes':['id',_0xd159('0x4'),_0xd159('0x5'),_0xd159('0x6')],'include':[{'model':_0xd159('0x7'),'as':'Agents','attributes':['id','name',_0xd159('0x8'),'openchannelPause']}]},'log':'getOpenchannelQueues'});};}; \ No newline at end of file +var _0xc6f7=['../client','getOpenchannelQueues','GetOpenchannelQueue','name','timeout','strategy','User','Agents','online','openchannelPause'];(function(_0x2cb7df,_0x2196db){var _0x47863d=function(_0x5c0f3d){while(--_0x5c0f3d){_0x2cb7df['push'](_0x2cb7df['shift']());}};_0x47863d(++_0x2196db);}(_0xc6f7,0x122));var _0x7c6f=function(_0x459918,_0x3281f7){_0x459918=_0x459918-0x0;var _0x149a78=_0xc6f7[_0x459918];return _0x149a78;};'use strict';var client=require(_0x7c6f('0x0'));exports[_0x7c6f('0x1')]=function(){return function(){return client['Request'](_0x7c6f('0x2'),{'options':{'raw':![],'attributes':['id',_0x7c6f('0x3'),_0x7c6f('0x4'),_0x7c6f('0x5')],'include':[{'model':_0x7c6f('0x6'),'as':_0x7c6f('0x7'),'attributes':['id',_0x7c6f('0x3'),_0x7c6f('0x8'),_0x7c6f('0x9')]}]},'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 ec37f36..76f7481 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 _0xab29=['UpdateOpenchannelQueueReport','DESC','../client','create','Request','CreateOpenchannelQueueReport','update'];(function(_0x69188b,_0x550923){var _0x3320f4=function(_0x27d05b){while(--_0x27d05b){_0x69188b['push'](_0x69188b['shift']());}};_0x3320f4(++_0x550923);}(_0xab29,0x1ec));var _0x9ab2=function(_0x438531,_0x6c96c5){_0x438531=_0x438531-0x0;var _0x18febe=_0xab29[_0x438531];return _0x18febe;};'use strict';var client=require(_0x9ab2('0x0'));exports[_0x9ab2('0x1')]=function(_0x2f8a4d){return client[_0x9ab2('0x2')](_0x9ab2('0x3'),{'body':_0x2f8a4d,'log':_0x9ab2('0x3')});};exports[_0x9ab2('0x4')]=function(_0x4c4777,_0x1903d6){return client[_0x9ab2('0x2')](_0x9ab2('0x5'),{'body':_0x1903d6,'options':{'where':{'uniqueid':_0x4c4777},'order':[['id',_0x9ab2('0x6')]],'limit':0x1},'log':_0x9ab2('0x5')});}; \ No newline at end of file +var _0xf5ac=['DESC','../client','Request','CreateOpenchannelQueueReport','update','UpdateOpenchannelQueueReport'];(function(_0x559807,_0x5eba81){var _0x233bd2=function(_0x2c0fab){while(--_0x2c0fab){_0x559807['push'](_0x559807['shift']());}};_0x233bd2(++_0x5eba81);}(_0xf5ac,0x79));var _0xcf5a=function(_0x5c83c2,_0x60c559){_0x5c83c2=_0x5c83c2-0x0;var _0x1afef4=_0xf5ac[_0x5c83c2];return _0x1afef4;};'use strict';var client=require(_0xcf5a('0x0'));exports['create']=function(_0x26fb76){return client[_0xcf5a('0x1')](_0xcf5a('0x2'),{'body':_0x26fb76,'log':'CreateOpenchannelQueueReport'});};exports[_0xcf5a('0x3')]=function(_0x4971c8,_0x530e57){return client[_0xcf5a('0x1')](_0xcf5a('0x4'),{'body':_0x530e57,'options':{'where':{'uniqueid':_0x4971c8},'order':[['id',_0xcf5a('0x5')]],'limit':0x1},'log':'UpdateOpenchannelQueueReport'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsInteraction.js b/server/services/routing/rpc/smsInteraction.js index 8d3a1dc..f9cfe6e 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 _0xa012=['addTags','addTagsToSmsInteraction','update','Request','UpdateSmsInteraction','updateSmsInteraction'];(function(_0x502d21,_0x30aa2d){var _0x24777e=function(_0x48c117){while(--_0x48c117){_0x502d21['push'](_0x502d21['shift']());}};_0x24777e(++_0x30aa2d);}(_0xa012,0x134));var _0x2a01=function(_0x4126dc,_0x1430f8){_0x4126dc=_0x4126dc-0x0;var _0xef998b=_0xa012[_0x4126dc];return _0xef998b;};'use strict';var client=require('../client');exports[_0x2a01('0x0')]=function(_0x9e6e6a,_0x398e94){return client[_0x2a01('0x1')](_0x2a01('0x2'),{'body':_0x398e94,'options':{'where':{'id':_0x9e6e6a}},'log':_0x2a01('0x3')});};exports[_0x2a01('0x4')]=function(_0x9a1a8e,_0xf3f71f){return client[_0x2a01('0x1')]('AddTagsToSmsInteraction',{'body':_0xf3f71f,'options':{'where':{'id':_0x9a1a8e}},'log':_0x2a01('0x5')});}; \ No newline at end of file +var _0xc6f8=['addTags','addTagsToSmsInteraction','Request','UpdateSmsInteraction','updateSmsInteraction'];(function(_0x1a5332,_0xf73dde){var _0x3e7f32=function(_0x561607){while(--_0x561607){_0x1a5332['push'](_0x1a5332['shift']());}};_0x3e7f32(++_0xf73dde);}(_0xc6f8,0x14c));var _0x8c6f=function(_0x43904b,_0x1e1703){_0x43904b=_0x43904b-0x0;var _0x5274d5=_0xc6f8[_0x43904b];return _0x5274d5;};'use strict';var client=require('../client');exports['update']=function(_0x39f9d8,_0x54cf34){return client[_0x8c6f('0x0')](_0x8c6f('0x1'),{'body':_0x54cf34,'options':{'where':{'id':_0x39f9d8}},'log':_0x8c6f('0x2')});};exports[_0x8c6f('0x3')]=function(_0x29b9b0,_0x5da903){return client[_0x8c6f('0x0')]('AddTagsToSmsInteraction',{'body':_0x5da903,'options':{'where':{'id':_0x29b9b0}},'log':_0x8c6f('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsMessage.js b/server/services/routing/rpc/smsMessage.js index 93cf439..49a05b9 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 _0xd8ae=['CreateSmsMessage','createSmsMessage','../client','create','Request'];(function(_0xf71120,_0x25b7f9){var _0xbe2fd3=function(_0x1acbdd){while(--_0x1acbdd){_0xf71120['push'](_0xf71120['shift']());}};_0xbe2fd3(++_0x25b7f9);}(_0xd8ae,0x183));var _0xed8a=function(_0xc7c426,_0x4863dc){_0xc7c426=_0xc7c426-0x0;var _0x27d2bc=_0xd8ae[_0xc7c426];return _0x27d2bc;};'use strict';var client=require(_0xed8a('0x0'));exports[_0xed8a('0x1')]=function(_0x40ca24){return client[_0xed8a('0x2')](_0xed8a('0x3'),{'body':_0x40ca24,'log':_0xed8a('0x4')});}; \ No newline at end of file +var _0xf2f2=['createSmsMessage','../client','Request','CreateSmsMessage'];(function(_0x528228,_0x1e5394){var _0x1417d5=function(_0x5398fa){while(--_0x5398fa){_0x528228['push'](_0x528228['shift']());}};_0x1417d5(++_0x1e5394);}(_0xf2f2,0x101));var _0x2f2f=function(_0x119e7a,_0x3949d3){_0x119e7a=_0x119e7a-0x0;var _0x1fb90a=_0xf2f2[_0x119e7a];return _0x1fb90a;};'use strict';var client=require(_0x2f2f('0x0'));exports['create']=function(_0x36c969){return client[_0x2f2f('0x1')](_0x2f2f('0x2'),{'body':_0x36c969,'log':_0x2f2f('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsQueue.js b/server/services/routing/rpc/smsQueue.js index e242e2f..97759eb 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 _0x5d58=['getSmsQueues','timeout','strategy','Agents','name','smsPause'];(function(_0x5ca964,_0x1e1366){var _0x447a23=function(_0x5a53b7){while(--_0x5a53b7){_0x5ca964['push'](_0x5ca964['shift']());}};_0x447a23(++_0x1e1366);}(_0x5d58,0x187));var _0x85d5=function(_0x41df93,_0x560d0b){_0x41df93=_0x41df93-0x0;var _0x227e0c=_0x5d58[_0x41df93];return _0x227e0c;};'use strict';var client=require('../client');exports['getSmsQueues']=function(){return function(){return client['Request']('GetSmsQueue',{'options':{'raw':![],'attributes':['id','name',_0x85d5('0x0'),_0x85d5('0x1')],'include':[{'model':'User','as':_0x85d5('0x2'),'attributes':['id',_0x85d5('0x3'),'online',_0x85d5('0x4')]}]},'log':_0x85d5('0x5')});};}; \ No newline at end of file +var _0x5b1d=['Agents','online','smsPause','../client','getSmsQueues','Request','GetSmsQueue','name','timeout','strategy','User'];(function(_0x49ea88,_0x2dbea4){var _0x4ba86f=function(_0x3d94fc){while(--_0x3d94fc){_0x49ea88['push'](_0x49ea88['shift']());}};_0x4ba86f(++_0x2dbea4);}(_0x5b1d,0x92));var _0xd5b1=function(_0x5bebeb,_0x321512){_0x5bebeb=_0x5bebeb-0x0;var _0x3ea1f1=_0x5b1d[_0x5bebeb];return _0x3ea1f1;};'use strict';var client=require(_0xd5b1('0x0'));exports[_0xd5b1('0x1')]=function(){return function(){return client[_0xd5b1('0x2')](_0xd5b1('0x3'),{'options':{'raw':![],'attributes':['id',_0xd5b1('0x4'),_0xd5b1('0x5'),_0xd5b1('0x6')],'include':[{'model':_0xd5b1('0x7'),'as':_0xd5b1('0x8'),'attributes':['id',_0xd5b1('0x4'),_0xd5b1('0x9'),_0xd5b1('0xa')]}]},'log':_0xd5b1('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsQueueReport.js b/server/services/routing/rpc/smsQueueReport.js index 4bc59ed..825c79d 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 _0x5464=['CreateSmsQueueReport','update','DESC','UpdateSmsQueueReport','../client','Request'];(function(_0x46698a,_0x8de1e4){var _0x356db0=function(_0x19e83c){while(--_0x19e83c){_0x46698a['push'](_0x46698a['shift']());}};_0x356db0(++_0x8de1e4);}(_0x5464,0xb2));var _0x4546=function(_0x21e665,_0xddbc4f){_0x21e665=_0x21e665-0x0;var _0x7a0925=_0x5464[_0x21e665];return _0x7a0925;};'use strict';var client=require(_0x4546('0x0'));exports['create']=function(_0x40a817){return client[_0x4546('0x1')]('CreateSmsQueueReport',{'body':_0x40a817,'log':_0x4546('0x2')});};exports[_0x4546('0x3')]=function(_0x493d6b,_0x497a18){return client[_0x4546('0x1')]('UpdateSmsQueueReport',{'body':_0x497a18,'options':{'where':{'uniqueid':_0x493d6b},'order':[['id',_0x4546('0x4')]],'limit':0x1},'log':_0x4546('0x5')});}; \ No newline at end of file +var _0x36b1=['DESC','../client','create','Request','UpdateSmsQueueReport'];(function(_0x17249c,_0x168d62){var _0x324e7b=function(_0x1b1397){while(--_0x1b1397){_0x17249c['push'](_0x17249c['shift']());}};_0x324e7b(++_0x168d62);}(_0x36b1,0x1aa));var _0x136b=function(_0xa5aaf9,_0x51c384){_0xa5aaf9=_0xa5aaf9-0x0;var _0x2c05d0=_0x36b1[_0xa5aaf9];return _0x2c05d0;};'use strict';var client=require(_0x136b('0x0'));exports[_0x136b('0x1')]=function(_0x46dfb2){return client['Request']('CreateSmsQueueReport',{'body':_0x46dfb2,'log':'CreateSmsQueueReport'});};exports['update']=function(_0x1aa203,_0x534dac){return client[_0x136b('0x2')](_0x136b('0x3'),{'body':_0x534dac,'options':{'where':{'uniqueid':_0x1aa203},'order':[['id',_0x136b('0x4')]],'limit':0x1},'log':_0x136b('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/user.js b/server/services/routing/rpc/user.js index 97f9321..93dfc80 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 _0x95c2=['openchannelPause','chatCapacity','mailCapacity','smsCapacity','whatsappCapacity','openchannelCapacity','getAgents','../client','Request','agent','name','online','pauseType','lastPauseAt','voicePause','chatPause','faxPause','smsPause','whatsappPause'];(function(_0x576c9c,_0x1d38f3){var _0x1ca837=function(_0x27b926){while(--_0x27b926){_0x576c9c['push'](_0x576c9c['shift']());}};_0x1ca837(++_0x1d38f3);}(_0x95c2,0x79));var _0x295c=function(_0x247c20,_0x1bc755){_0x247c20=_0x247c20-0x0;var _0x11216c=_0x95c2[_0x247c20];return _0x11216c;};'use strict';var client=require(_0x295c('0x0'));exports['getAgents']=function(){return function(){return client[_0x295c('0x1')]('GetUser',{'options':{'raw':!![],'where':{'role':_0x295c('0x2')},'attributes':['id',_0x295c('0x3'),_0x295c('0x4'),_0x295c('0x5'),_0x295c('0x6'),_0x295c('0x7'),_0x295c('0x8'),'mailPause',_0x295c('0x9'),_0x295c('0xa'),_0x295c('0xb'),_0x295c('0xc'),_0x295c('0xd'),_0x295c('0xe'),'faxCapacity',_0x295c('0xf'),_0x295c('0x10'),_0x295c('0x11')]},'log':_0x295c('0x12')});};}; \ No newline at end of file +var _0x5723=['openchannelCapacity','../client','getAgents','GetUser','name','online','lastPauseAt','voicePause','chatPause','mailPause','faxPause','smsPause','whatsappPause','openchannelPause','chatCapacity','faxCapacity','smsCapacity'];(function(_0x2ceb47,_0x5c6f60){var _0x4a77b0=function(_0x3c5771){while(--_0x3c5771){_0x2ceb47['push'](_0x2ceb47['shift']());}};_0x4a77b0(++_0x5c6f60);}(_0x5723,0xef));var _0x3572=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x5723[_0x122ef9];return _0x42fba0;};'use strict';var client=require(_0x3572('0x0'));exports[_0x3572('0x1')]=function(){return function(){return client['Request'](_0x3572('0x2'),{'options':{'raw':!![],'where':{'role':'agent'},'attributes':['id',_0x3572('0x3'),_0x3572('0x4'),'pauseType',_0x3572('0x5'),_0x3572('0x6'),_0x3572('0x7'),_0x3572('0x8'),_0x3572('0x9'),_0x3572('0xa'),_0x3572('0xb'),_0x3572('0xc'),_0x3572('0xd'),'mailCapacity',_0x3572('0xe'),_0x3572('0xf'),'whatsappCapacity',_0x3572('0x10')]},'log':'getAgents'});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappInteraction.js b/server/services/routing/rpc/whatsappInteraction.js index 7a80d1b..716df61 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 _0xadec=['../client','update','Request'];(function(_0x934425,_0x5af72f){var _0x31d596=function(_0x219869){while(--_0x219869){_0x934425['push'](_0x934425['shift']());}};_0x31d596(++_0x5af72f);}(_0xadec,0x156));var _0xcade=function(_0x1549ae,_0x4ea436){_0x1549ae=_0x1549ae-0x0;var _0x141302=_0xadec[_0x1549ae];return _0x141302;};'use strict';var client=require(_0xcade('0x0'));exports[_0xcade('0x1')]=function(_0x11d900,_0x210817){return client[_0xcade('0x2')]('UpdateWhatsappInteraction',{'body':_0x210817,'options':{'where':{'id':_0x11d900}},'log':'updateWhatsappInteraction'});};exports['addTags']=function(_0x475533,_0x875b81){return client[_0xcade('0x2')]('AddTagsToWhatsappInteraction',{'body':_0x875b81,'options':{'where':{'id':_0x475533}},'log':'addTagsToWhatsappInteraction'});}; \ No newline at end of file +var _0x9b9b=['addTags','AddTagsToWhatsappInteraction','addTagsToWhatsappInteraction','update','Request','UpdateWhatsappInteraction','updateWhatsappInteraction'];(function(_0x27812f,_0x3b89ac){var _0xfe3084=function(_0x149d84){while(--_0x149d84){_0x27812f['push'](_0x27812f['shift']());}};_0xfe3084(++_0x3b89ac);}(_0x9b9b,0x114));var _0xb9b9=function(_0x4b14bb,_0xe7b4d3){_0x4b14bb=_0x4b14bb-0x0;var _0x285200=_0x9b9b[_0x4b14bb];return _0x285200;};'use strict';var client=require('../client');exports[_0xb9b9('0x0')]=function(_0x4980d7,_0x5010f5){return client[_0xb9b9('0x1')](_0xb9b9('0x2'),{'body':_0x5010f5,'options':{'where':{'id':_0x4980d7}},'log':_0xb9b9('0x3')});};exports[_0xb9b9('0x4')]=function(_0x1d6ab6,_0x43c8ff){return client[_0xb9b9('0x1')](_0xb9b9('0x5'),{'body':_0x43c8ff,'options':{'where':{'id':_0x1d6ab6}},'log':_0xb9b9('0x6')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappMessage.js b/server/services/routing/rpc/whatsappMessage.js index be33425..a4efe85 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 _0xff20=['Request','CreateWhatsappMessage','createWhatsappMessage','../client','create'];(function(_0x1d1a81,_0xc4a698){var _0x288bd1=function(_0x309520){while(--_0x309520){_0x1d1a81['push'](_0x1d1a81['shift']());}};_0x288bd1(++_0xc4a698);}(_0xff20,0x18e));var _0x0ff2=function(_0x44a380,_0x53e28b){_0x44a380=_0x44a380-0x0;var _0x115513=_0xff20[_0x44a380];return _0x115513;};'use strict';var client=require(_0x0ff2('0x0'));exports[_0x0ff2('0x1')]=function(_0x5a10e1){return client[_0x0ff2('0x2')](_0x0ff2('0x3'),{'body':_0x5a10e1,'log':_0x0ff2('0x4')});}; \ No newline at end of file +var _0x175d=['create','Request','CreateWhatsappMessage','createWhatsappMessage','../client'];(function(_0x41b4a9,_0x2a6605){var _0x4a0854=function(_0x16c60e){while(--_0x16c60e){_0x41b4a9['push'](_0x41b4a9['shift']());}};_0x4a0854(++_0x2a6605);}(_0x175d,0x18f));var _0xd175=function(_0x5bc4b4,_0x3144ba){_0x5bc4b4=_0x5bc4b4-0x0;var _0x7ffead=_0x175d[_0x5bc4b4];return _0x7ffead;};'use strict';var client=require(_0xd175('0x0'));exports[_0xd175('0x1')]=function(_0x5a61ff){return client[_0xd175('0x2')](_0xd175('0x3'),{'body':_0x5a61ff,'log':_0xd175('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappQueue.js b/server/services/routing/rpc/whatsappQueue.js index b344f93..09f07ad 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 _0x594d=['online','getWhatsappQueues','../client','GetWhatsappQueue','name','timeout','User','Agents'];(function(_0x10b538,_0x55835b){var _0x237331=function(_0xc2ab67){while(--_0xc2ab67){_0x10b538['push'](_0x10b538['shift']());}};_0x237331(++_0x55835b);}(_0x594d,0x92));var _0xd594=function(_0x48f7ec,_0xa5fb2c){_0x48f7ec=_0x48f7ec-0x0;var _0x3dbbe8=_0x594d[_0x48f7ec];return _0x3dbbe8;};'use strict';var client=require(_0xd594('0x0'));exports['getWhatsappQueues']=function(){return function(){return client['Request'](_0xd594('0x1'),{'options':{'raw':![],'attributes':['id',_0xd594('0x2'),_0xd594('0x3'),'strategy'],'include':[{'model':_0xd594('0x4'),'as':_0xd594('0x5'),'attributes':['id',_0xd594('0x2'),_0xd594('0x6'),'whatsappPause']}]},'log':_0xd594('0x7')});};}; \ No newline at end of file +var _0x6e6c=['name','User','whatsappPause','../client','getWhatsappQueues','GetWhatsappQueue'];(function(_0x37b3e5,_0x33b516){var _0x207f20=function(_0x5237fa){while(--_0x5237fa){_0x37b3e5['push'](_0x37b3e5['shift']());}};_0x207f20(++_0x33b516);}(_0x6e6c,0xc3));var _0xc6e6=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x6e6c[_0x2dafbe];return _0x58a45a;};'use strict';var client=require(_0xc6e6('0x0'));exports[_0xc6e6('0x1')]=function(){return function(){return client['Request'](_0xc6e6('0x2'),{'options':{'raw':![],'attributes':['id',_0xc6e6('0x3'),'timeout','strategy'],'include':[{'model':_0xc6e6('0x4'),'as':'Agents','attributes':['id',_0xc6e6('0x3'),'online',_0xc6e6('0x5')]}]},'log':_0xc6e6('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappQueueReport.js b/server/services/routing/rpc/whatsappQueueReport.js index 7fe6583..ee4cedd 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 _0x8183=['CreateWhatsappQueueReport','update','UpdateWhatsappQueueReport','DESC','create','Request'];(function(_0x76fea7,_0x164167){var _0x3183c0=function(_0x1f4a4f){while(--_0x1f4a4f){_0x76fea7['push'](_0x76fea7['shift']());}};_0x3183c0(++_0x164167);}(_0x8183,0x142));var _0x3818=function(_0x1992f1,_0x5c61f0){_0x1992f1=_0x1992f1-0x0;var _0x413dfe=_0x8183[_0x1992f1];return _0x413dfe;};'use strict';var client=require('../client');exports[_0x3818('0x0')]=function(_0x4c6599){return client[_0x3818('0x1')](_0x3818('0x2'),{'body':_0x4c6599,'log':_0x3818('0x2')});};exports[_0x3818('0x3')]=function(_0x339950,_0x1c98df){return client['Request'](_0x3818('0x4'),{'body':_0x1c98df,'options':{'where':{'uniqueid':_0x339950},'order':[['id',_0x3818('0x5')]],'limit':0x1},'log':_0x3818('0x4')});}; \ No newline at end of file +var _0x35a6=['CreateWhatsappQueueReport','UpdateWhatsappQueueReport','DESC','../client','create','Request'];(function(_0x5dbe03,_0x2941ff){var _0x8f51a9=function(_0x9fc00e){while(--_0x9fc00e){_0x5dbe03['push'](_0x5dbe03['shift']());}};_0x8f51a9(++_0x2941ff);}(_0x35a6,0x1a7));var _0x635a=function(_0x4dbdc3,_0x5a525d){_0x4dbdc3=_0x4dbdc3-0x0;var _0x1765ad=_0x35a6[_0x4dbdc3];return _0x1765ad;};'use strict';var client=require(_0x635a('0x0'));exports[_0x635a('0x1')]=function(_0x12e989){return client[_0x635a('0x2')](_0x635a('0x3'),{'body':_0x12e989,'log':_0x635a('0x3')});};exports['update']=function(_0x45c633,_0x545557){return client[_0x635a('0x2')](_0x635a('0x4'),{'body':_0x545557,'options':{'where':{'uniqueid':_0x45c633},'order':[['id',_0x635a('0x5')]],'limit':0x1},'log':_0x635a('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/server/applications/agent.js b/server/services/routing/server/applications/agent.js index c2dec6b..84e19d0 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 _0x7d64=['log','[%s][QUEUE]\x20%s','stack','validate','lodash','../../../../config/logger','routing','./strategy','string','number','timeout\x20is\x20a\x20number','info','[%s][AGENT][NAME:%s][STATUS:%s]','name','toLowerCase','consequence','length','[%s][AGENT]\x20%s','map','message','join','stop','find','agents','timeout','createQueue','atimeout','format','START:%s','rules','end','[%s][AGENT]\x20ROUTING\x20STOPPED','close','[%s][AGENT]\x20ROUTING\x20END','agent','[%s][AGENT]\x20agent\x20not\x20found\x20%s'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0x7d64,0xb7));var _0x47d6=function(_0x358f52,_0x4abfb0){_0x358f52=_0x358f52-0x0;var _0x4efb8b=_0x7d64[_0x358f52];return _0x4efb8b;};'use strict';var schema=require(_0x47d6('0x0'));var _=require(_0x47d6('0x1'));var util=require('util');var seqqueue=require('seq-queue');var logger=require(_0x47d6('0x2'))(_0x47d6('0x3'));var strategy=require(_0x47d6('0x4'));var queue=schema({'name':{'type':_0x47d6('0x5'),'required':!![],'message':'name\x20is\x20a\x20string\x20and\x20it\x20is\x20required'},'timeout':{'type':_0x47d6('0x6'),'message':_0x47d6('0x7')}});function writeLog(_0x2021b6,_0x2b2d99,_0x46a17a){return logger[_0x47d6('0x8')](util['format'](_0x47d6('0x9'),_0x2021b6,_0x2b2d99[_0x47d6('0xa')],_0x46a17a));}function handleFindAgent(_0x920eac){return function(_0xb57bbf){return _0xb57bbf['name'][_0x47d6('0xb')]()===_0x920eac[_0x47d6('0xb')]();};}exports[_0x47d6('0xc')]=function(_0x4bfca5,_0x18dfb6,_0x5f1f75,_0x5f5365){return function(_0xf93562){try{var _0x2b8935={'name':_0x18dfb6[0x0],'timeout':_0x18dfb6[0x1]};var _0xf853f0=queue['validate'](_0x2b8935,{'typecast':!![]});if(_0xf853f0[_0x47d6('0xd')]){logger['error'](_0x47d6('0xe'),_0x4bfca5,_[_0x47d6('0xf')](_0xf853f0,_0x47d6('0x10'))[_0x47d6('0x11')](',\x20'));_0xf93562[_0x47d6('0x12')]();}else{var _0xbfb206=_[_0x47d6('0x13')](_0x5f1f75[_0x47d6('0x14')],handleFindAgent(_0x2b8935[_0x47d6('0xa')]));if(_0xbfb206){var _0x5baead=(_0x2b8935[_0x47d6('0x15')]||0xa)*0x3e8;var _0x243c41,_0x507b5d;var _0x30942a=seqqueue[_0x47d6('0x16')](_0x5baead);_0x30942a['id']=_0x4bfca5;_0x30942a[_0x47d6('0x17')]=_0x5baead;_0x30942a['channel']=_0x5f5365['channel'];writeLog(_0x4bfca5,_0xbfb206,util[_0x47d6('0x18')](_0x47d6('0x19'),_0x5baead));_0x5f1f75[_0x47d6('0x1a')][_0x4bfca5]['on'](_0x47d6('0x1b'),function(){logger[_0x47d6('0x8')](_0x47d6('0x1c'),_0x4bfca5);clearTimeout(_0x507b5d);_0x507b5d=undefined;_0x30942a[_0x47d6('0x1d')]();if(_0x5f1f75['rules'][_0x4bfca5]){delete _0x5f1f75[_0x47d6('0x1a')][_0x4bfca5];}_0xf93562[_0x47d6('0x12')]();});_0x5f1f75['rules'][_0x4bfca5]['on']('complete',function(){if(_0x5f1f75[_0x47d6('0x1a')][_0x4bfca5]){delete _0x5f1f75[_0x47d6('0x1a')][_0x4bfca5];}});_0x507b5d=setTimeout(function(){logger[_0x47d6('0x8')](_0x47d6('0x1e'),_0x4bfca5);clearTimeout(_0x507b5d);_0x30942a[_0x47d6('0x1d')]();_0xf93562['next']();},_0x5baead);strategy[_0x47d6('0x1f')](_0x30942a,_0xbfb206,_0x5f1f75,_0x5f5365);}else{logger['error'](_0x47d6('0x20'),_0x4bfca5,_0x2b8935['name']);_0xf93562[_0x47d6('0x12')]();}}}catch(_0xcf1cf9){console[_0x47d6('0x21')](_0xcf1cf9);logger['error'](_0x47d6('0x22'),_0x4bfca5,_0xcf1cf9[_0x47d6('0x23')]);_0xf93562[_0x47d6('0x12')]();}};}; \ No newline at end of file +var _0xe6c9=['join','stop','find','agents','timeout','createQueue','atimeout','channel','START:%s','rules','end','info','[%s][AGENT]\x20ROUTING\x20STOPPED','close','[%s][AGENT]\x20ROUTING\x20END','agent','error','[%s][AGENT]\x20agent\x20not\x20found\x20%s','log','[%s][QUEUE]\x20%s','stack','validate','lodash','util','seq-queue','routing','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','format','[%s][AGENT][NAME:%s][STATUS:%s]','consequence','length','[%s][AGENT]\x20%s','map'];(function(_0x4ad202,_0x2b7325){var _0x5653c5=function(_0x144005){while(--_0x144005){_0x4ad202['push'](_0x4ad202['shift']());}};_0x5653c5(++_0x2b7325);}(_0xe6c9,0x1cf));var _0x9e6c=function(_0x1ff9a8,_0x3be674){_0x1ff9a8=_0x1ff9a8-0x0;var _0x284012=_0xe6c9[_0x1ff9a8];return _0x284012;};'use strict';var schema=require(_0x9e6c('0x0'));var _=require(_0x9e6c('0x1'));var util=require(_0x9e6c('0x2'));var seqqueue=require(_0x9e6c('0x3'));var logger=require('../../../../config/logger')(_0x9e6c('0x4'));var strategy=require('./strategy');var queue=schema({'name':{'type':'string','required':!![],'message':_0x9e6c('0x5')},'timeout':{'type':_0x9e6c('0x6'),'message':'timeout\x20is\x20a\x20number'}});function writeLog(_0xd75d62,_0x447a63,_0x3c0ade){return logger['info'](util[_0x9e6c('0x7')](_0x9e6c('0x8'),_0xd75d62,_0x447a63['name'],_0x3c0ade));}function handleFindAgent(_0x1a582a){return function(_0x331e7b){return _0x331e7b['name']['toLowerCase']()===_0x1a582a['toLowerCase']();};}exports[_0x9e6c('0x9')]=function(_0x9f516d,_0xc104a2,_0x1298b1,_0x21346c){return function(_0x1d3ef5){try{var _0x436a6d={'name':_0xc104a2[0x0],'timeout':_0xc104a2[0x1]};var _0x2ae42b=queue['validate'](_0x436a6d,{'typecast':!![]});if(_0x2ae42b[_0x9e6c('0xa')]){logger['error'](_0x9e6c('0xb'),_0x9f516d,_[_0x9e6c('0xc')](_0x2ae42b,'message')[_0x9e6c('0xd')](',\x20'));_0x1d3ef5[_0x9e6c('0xe')]();}else{var _0xf81236=_[_0x9e6c('0xf')](_0x1298b1[_0x9e6c('0x10')],handleFindAgent(_0x436a6d['name']));if(_0xf81236){var _0xd17e0d=(_0x436a6d[_0x9e6c('0x11')]||0xa)*0x3e8;var _0x4e68ad,_0x127aa0;var _0x4a6dc5=seqqueue[_0x9e6c('0x12')](_0xd17e0d);_0x4a6dc5['id']=_0x9f516d;_0x4a6dc5[_0x9e6c('0x13')]=_0xd17e0d;_0x4a6dc5['channel']=_0x21346c[_0x9e6c('0x14')];writeLog(_0x9f516d,_0xf81236,util['format'](_0x9e6c('0x15'),_0xd17e0d));_0x1298b1[_0x9e6c('0x16')][_0x9f516d]['on'](_0x9e6c('0x17'),function(){logger[_0x9e6c('0x18')](_0x9e6c('0x19'),_0x9f516d);clearTimeout(_0x127aa0);_0x127aa0=undefined;_0x4a6dc5[_0x9e6c('0x1a')]();if(_0x1298b1[_0x9e6c('0x16')][_0x9f516d]){delete _0x1298b1[_0x9e6c('0x16')][_0x9f516d];}_0x1d3ef5['stop']();});_0x1298b1[_0x9e6c('0x16')][_0x9f516d]['on']('complete',function(){if(_0x1298b1[_0x9e6c('0x16')][_0x9f516d]){delete _0x1298b1['rules'][_0x9f516d];}});_0x127aa0=setTimeout(function(){logger[_0x9e6c('0x18')](_0x9e6c('0x1b'),_0x9f516d);clearTimeout(_0x127aa0);_0x4a6dc5[_0x9e6c('0x1a')]();_0x1d3ef5['next']();},_0xd17e0d);strategy[_0x9e6c('0x1c')](_0x4a6dc5,_0xf81236,_0x1298b1,_0x21346c);}else{logger[_0x9e6c('0x1d')](_0x9e6c('0x1e'),_0x9f516d,_0x436a6d['name']);_0x1d3ef5['stop']();}}}catch(_0x28bc3c){console[_0x9e6c('0x1f')](_0x28bc3c);logger['error'](_0x9e6c('0x20'),_0x9f516d,_0x28bc3c[_0x9e6c('0x21')]);_0x1d3ef5[_0x9e6c('0xe')]();}};}; \ 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 ac19456..f12df63 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 _0x3f8a=['channel','chat','ChatWebsiteId','account','upperFirst','AccountId','InteractionId','isEmpty','body','getMustacheRender','create','then','catch','error','finally','[%s][AMAZONLEX]\x20Welcome\x20Message\x20has\x20been\x20sent!','stop','[%s][AMAZONLEX]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','LexRuntime','$LATEST','message','toString','postText','next','amazonlex','Message','dialogState','stringify','lodash','moment','aws-sdk','./utils','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','consequence','isNil','interaction','UserId','info','[%s][AMAZONLEX]\x20%s','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','contact','format','YYYY-MM-DD\x20HH:mm:ss'];(function(_0x4db525,_0x53113c){var _0x13ceda=function(_0x296cb){while(--_0x296cb){_0x4db525['push'](_0x4db525['shift']());}};_0x13ceda(++_0x53113c);}(_0x3f8a,0x1d5));var _0xa3f8=function(_0x1414fe,_0x2ce4a4){_0x1414fe=_0x1414fe-0x0;var _0x47f599=_0x3f8a[_0x1414fe];return _0x47f599;};'use strict';var _=require(_0xa3f8('0x0'));var moment=require(_0xa3f8('0x1'));var AWS=require(_0xa3f8('0x2'));var utils=require(_0xa3f8('0x3'));var logger=require('../../../../config/logger')(_0xa3f8('0x4'));var rpc={'chatMessage':require(_0xa3f8('0x5')),'openchannelMessage':require(_0xa3f8('0x6')),'mailMessage':require(_0xa3f8('0x7')),'smsMessage':require(_0xa3f8('0x8')),'faxMessage':require(_0xa3f8('0x9')),'whatsappMessage':require(_0xa3f8('0xa'))};exports[_0xa3f8('0xb')]=function(_0x1f160a,_0xf895d9){return function(_0xcfea5){try{if(!_[_0xa3f8('0xc')](this[_0xa3f8('0xd')][_0xa3f8('0xe')])){logger[_0xa3f8('0xf')](_0xa3f8('0x10'),_0x1f160a,_0xa3f8('0x11'));return _0xcfea5['next']();}var _0x47496a={'ContactId':this[_0xa3f8('0x12')]['id'],'sentAt':moment()[_0xa3f8('0x13')](_0xa3f8('0x14')),'direction':'out'};var _0x206b69=this[_0xa3f8('0x15')];if(_0x206b69===_0xa3f8('0x16')){_0x47496a[_0xa3f8('0x17')]=this[_0xa3f8('0x18')]['id'];}else{_0x47496a[_[_0xa3f8('0x19')](_0x206b69)+_0xa3f8('0x1a')]=this[_0xa3f8('0x18')]['id'];}_0x47496a[_[_0xa3f8('0x19')](_0x206b69)+_0xa3f8('0x1b')]=this[_0xa3f8('0xd')]['id'];if(this[_0xa3f8('0xd')]['created']){var _0x2d8f74=_0xf895d9[0x4];if(!_[_0xa3f8('0x1c')](_0x2d8f74)){_0x47496a[_0xa3f8('0x1d')]=utils[_0xa3f8('0x1e')](_0x2d8f74,this);return rpc[_0x206b69+'Message'][_0xa3f8('0x1f')](_0x47496a)[_0xa3f8('0x20')](function(_0x46a8d9){logger[_0xa3f8('0xf')](_0xa3f8('0x10'),_0x1f160a,_0x47496a[_0xa3f8('0x1d')]);})[_0xa3f8('0x21')](function(_0x3e2e1c){logger[_0xa3f8('0x22')](_0xa3f8('0x10'),_0x1f160a,JSON['stringify'](_0x3e2e1c));})[_0xa3f8('0x23')](function(){logger['info'](_0xa3f8('0x24'),_0x1f160a);_0xcfea5[_0xa3f8('0x25')]();});}else{logger[_0xa3f8('0xf')](_0xa3f8('0x26'),_0x1f160a);_0xcfea5['stop']();}}else{var _0x1f0bb8=this;var _0x5b0d57=new AWS[(_0xa3f8('0x27'))]({'accessKeyId':_0xf895d9[0x0],'secretAccessKey':_0xf895d9[0x1],'region':_0xf895d9[0x2]});var _0x58336d={'botAlias':_0xa3f8('0x28'),'botName':_0xf895d9[0x3],'inputText':this[_0xa3f8('0x29')][_0xa3f8('0x1d')],'userId':this[_0xa3f8('0x15')]+':'+this[_0xa3f8('0xd')]['id'][_0xa3f8('0x2a')]()};_0x5b0d57[_0xa3f8('0x2b')](_0x58336d,function(_0x490717,_0xae76ec){if(_0x490717){logger['error'](_0xa3f8('0x10'),_0x1f160a,_0x490717[_0xa3f8('0x29')]);_0xcfea5[_0xa3f8('0x2c')]();}else if(_0xae76ec&&_0xae76ec[_0xa3f8('0x29')]){_0x1f0bb8[_0xa3f8('0x1d')][_0xa3f8('0x2d')]=_0xae76ec;_0x47496a[_0xa3f8('0x1d')]=_0xae76ec[_0xa3f8('0x29')];return rpc[_0x206b69+_0xa3f8('0x2e')][_0xa3f8('0x1f')](_0x47496a)['then'](function(_0x1c3358){logger[_0xa3f8('0xf')](_0xa3f8('0x10'),_0x1f160a,_0x47496a['body']);if(_0xae76ec[_0xa3f8('0x2f')]=='Failed'){_0xcfea5[_0xa3f8('0x2c')]();}else{_0xcfea5[_0xa3f8('0x25')]();}})[_0xa3f8('0x21')](function(_0x4ea213){logger[_0xa3f8('0x22')]('[%s][AMAZONLEX]\x20%s',_0x1f160a,JSON[_0xa3f8('0x30')](_0x4ea213));_0xcfea5[_0xa3f8('0x2c')]();});}else{_0xcfea5[_0xa3f8('0x2c')]();}});}}catch(_0x406140){logger[_0xa3f8('0x22')](_0xa3f8('0x10'),_0x1f160a,JSON[_0xa3f8('0x30')](_0x406140));_0xcfea5[_0xa3f8('0x25')]();}};}; \ No newline at end of file +var _0x3f8a=['channel','chat','ChatWebsiteId','account','upperFirst','AccountId','InteractionId','isEmpty','body','getMustacheRender','create','then','catch','error','finally','[%s][AMAZONLEX]\x20Welcome\x20Message\x20has\x20been\x20sent!','stop','[%s][AMAZONLEX]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','LexRuntime','$LATEST','message','toString','postText','next','amazonlex','Message','dialogState','stringify','lodash','moment','aws-sdk','./utils','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','consequence','isNil','interaction','UserId','info','[%s][AMAZONLEX]\x20%s','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','contact','format','YYYY-MM-DD\x20HH:mm:ss'];(function(_0x2fb16a,_0x19e217){var _0x1bbd83=function(_0x4940d7){while(--_0x4940d7){_0x2fb16a['push'](_0x2fb16a['shift']());}};_0x1bbd83(++_0x19e217);}(_0x3f8a,0x1d5));var _0xa3f8=function(_0x27bae4,_0x3d2bf8){_0x27bae4=_0x27bae4-0x0;var _0x9733e6=_0x3f8a[_0x27bae4];return _0x9733e6;};'use strict';var _=require(_0xa3f8('0x0'));var moment=require(_0xa3f8('0x1'));var AWS=require(_0xa3f8('0x2'));var utils=require(_0xa3f8('0x3'));var logger=require('../../../../config/logger')(_0xa3f8('0x4'));var rpc={'chatMessage':require(_0xa3f8('0x5')),'openchannelMessage':require(_0xa3f8('0x6')),'mailMessage':require(_0xa3f8('0x7')),'smsMessage':require(_0xa3f8('0x8')),'faxMessage':require(_0xa3f8('0x9')),'whatsappMessage':require(_0xa3f8('0xa'))};exports[_0xa3f8('0xb')]=function(_0x1f160a,_0xf895d9){return function(_0xcfea5){try{if(!_[_0xa3f8('0xc')](this[_0xa3f8('0xd')][_0xa3f8('0xe')])){logger[_0xa3f8('0xf')](_0xa3f8('0x10'),_0x1f160a,_0xa3f8('0x11'));return _0xcfea5['next']();}var _0x47496a={'ContactId':this[_0xa3f8('0x12')]['id'],'sentAt':moment()[_0xa3f8('0x13')](_0xa3f8('0x14')),'direction':'out'};var _0x206b69=this[_0xa3f8('0x15')];if(_0x206b69===_0xa3f8('0x16')){_0x47496a[_0xa3f8('0x17')]=this[_0xa3f8('0x18')]['id'];}else{_0x47496a[_[_0xa3f8('0x19')](_0x206b69)+_0xa3f8('0x1a')]=this[_0xa3f8('0x18')]['id'];}_0x47496a[_[_0xa3f8('0x19')](_0x206b69)+_0xa3f8('0x1b')]=this[_0xa3f8('0xd')]['id'];if(this[_0xa3f8('0xd')]['created']){var _0x2d8f74=_0xf895d9[0x4];if(!_[_0xa3f8('0x1c')](_0x2d8f74)){_0x47496a[_0xa3f8('0x1d')]=utils[_0xa3f8('0x1e')](_0x2d8f74,this);return rpc[_0x206b69+'Message'][_0xa3f8('0x1f')](_0x47496a)[_0xa3f8('0x20')](function(_0x46a8d9){logger[_0xa3f8('0xf')](_0xa3f8('0x10'),_0x1f160a,_0x47496a[_0xa3f8('0x1d')]);})[_0xa3f8('0x21')](function(_0x3e2e1c){logger[_0xa3f8('0x22')](_0xa3f8('0x10'),_0x1f160a,JSON['stringify'](_0x3e2e1c));})[_0xa3f8('0x23')](function(){logger['info'](_0xa3f8('0x24'),_0x1f160a);_0xcfea5[_0xa3f8('0x25')]();});}else{logger[_0xa3f8('0xf')](_0xa3f8('0x26'),_0x1f160a);_0xcfea5['stop']();}}else{var _0x1f0bb8=this;var _0x5b0d57=new AWS[(_0xa3f8('0x27'))]({'accessKeyId':_0xf895d9[0x0],'secretAccessKey':_0xf895d9[0x1],'region':_0xf895d9[0x2]});var _0x58336d={'botAlias':_0xa3f8('0x28'),'botName':_0xf895d9[0x3],'inputText':this[_0xa3f8('0x29')][_0xa3f8('0x1d')],'userId':this[_0xa3f8('0x15')]+':'+this[_0xa3f8('0xd')]['id'][_0xa3f8('0x2a')]()};_0x5b0d57[_0xa3f8('0x2b')](_0x58336d,function(_0x490717,_0xae76ec){if(_0x490717){logger['error'](_0xa3f8('0x10'),_0x1f160a,_0x490717[_0xa3f8('0x29')]);_0xcfea5[_0xa3f8('0x2c')]();}else if(_0xae76ec&&_0xae76ec[_0xa3f8('0x29')]){_0x1f0bb8[_0xa3f8('0x1d')][_0xa3f8('0x2d')]=_0xae76ec;_0x47496a[_0xa3f8('0x1d')]=_0xae76ec[_0xa3f8('0x29')];return rpc[_0x206b69+_0xa3f8('0x2e')][_0xa3f8('0x1f')](_0x47496a)['then'](function(_0x1c3358){logger[_0xa3f8('0xf')](_0xa3f8('0x10'),_0x1f160a,_0x47496a['body']);if(_0xae76ec[_0xa3f8('0x2f')]=='Failed'){_0xcfea5[_0xa3f8('0x2c')]();}else{_0xcfea5[_0xa3f8('0x25')]();}})[_0xa3f8('0x21')](function(_0x4ea213){logger[_0xa3f8('0x22')]('[%s][AMAZONLEX]\x20%s',_0x1f160a,JSON[_0xa3f8('0x30')](_0x4ea213));_0xcfea5[_0xa3f8('0x2c')]();});}else{_0xcfea5[_0xa3f8('0x2c')]();}});}}catch(_0x406140){logger[_0xa3f8('0x22')](_0xa3f8('0x10'),_0x1f160a,JSON[_0xa3f8('0x30')](_0x406140));_0xcfea5[_0xa3f8('0x25')]();}};}; \ 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 d35bf79..a6a8cbc 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 _0x2a1a=['inReplyTo','messageId','html','replace','body','','sendMailMessage','then','info','[%s][AUTOREPLY]\x20SMTP\x20SENT','create','[%s][AUTOREPLY]\x20%s','stringify','catch','error','[RPC][%s][AUTOREPLY]\x20%s','finally','stop','moment','./utils','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','created','Autoreply\x20already\x20sent','next','channel','getMustacheRender','contact','YYYY-MM-DD\x20HH:mm:ss','out','message','from','phone','subject','Re:','Re:\x20','chat','ChatWebsiteId','account','upperFirst','AccountId','interaction','Message','mail','Smtp','service','host','port','secure','authentication','auth','user','pass'];(function(_0x5c6299,_0x11bd28){var _0x23b564=function(_0x329ed6){while(--_0x329ed6){_0x5c6299['push'](_0x5c6299['shift']());}};_0x23b564(++_0x11bd28);}(_0x2a1a,0x140));var _0xa2a1=function(_0x13a5b7,_0x29bc4d){_0x13a5b7=_0x13a5b7-0x0;var _0x235deb=_0x2a1a[_0x13a5b7];return _0x235deb;};'use strict';var _=require('lodash');var moment=require(_0xa2a1('0x0'));var utils=require(_0xa2a1('0x1'));var logger=require(_0xa2a1('0x2'))(_0xa2a1('0x3'));var rpc={'chatMessage':require(_0xa2a1('0x4')),'openchannelMessage':require(_0xa2a1('0x5')),'mailMessage':require(_0xa2a1('0x6')),'smsMessage':require('../../rpc/smsMessage'),'faxMessage':require(_0xa2a1('0x7')),'whatsappMessage':require(_0xa2a1('0x8'))};var mailRpc=require('../../mailRpc');exports['consequence']=function(_0x709040,_0x21b68b){return function(_0x5cec4e){try{if(_0x21b68b[0x0]==='1'&&(_['isNil'](this['interaction'][_0xa2a1('0x9')])||!this['interaction']['created'])){logger['info']('[%s][AUTOREPLY]\x20%s',_0x709040,_0xa2a1('0xa'));return _0x5cec4e[_0xa2a1('0xb')]();}var _0x5e6b23=this[_0xa2a1('0xc')];var _0x4557eb={'body':utils[_0xa2a1('0xd')](_0x21b68b[0x1],this),'ContactId':this[_0xa2a1('0xe')]['id'],'sentAt':moment()['format'](_0xa2a1('0xf')),'direction':_0xa2a1('0x10')};if(this[_0xa2a1('0x11')]){_0x4557eb['to']=this[_0xa2a1('0x11')]['from']||'';_0x4557eb['cc']=this[_0xa2a1('0x11')]['cc']||'';_0x4557eb[_0xa2a1('0x12')]=this[_0xa2a1('0x11')]['to']||'';_0x4557eb[_0xa2a1('0x13')]=this[_0xa2a1('0x11')]['phone']||'';_0x4557eb['read']=!![];if(this[_0xa2a1('0x11')][_0xa2a1('0x14')]){_0x4557eb[_0xa2a1('0x14')]='';_0x4557eb[_0xa2a1('0x14')]+=_['startsWith'](this['message']['subject'],_0xa2a1('0x15'))?'':_0xa2a1('0x16');_0x4557eb[_0xa2a1('0x14')]+=this['message'][_0xa2a1('0x14')];}}if(this[_0xa2a1('0xc')]===_0xa2a1('0x17')){_0x4557eb[_0xa2a1('0x18')]=this[_0xa2a1('0x19')]['id'];}else{_0x4557eb[_[_0xa2a1('0x1a')](this[_0xa2a1('0xc')])+_0xa2a1('0x1b')]=this[_0xa2a1('0x19')]['id'];}_0x4557eb[_['upperFirst'](this[_0xa2a1('0xc')])+'InteractionId']=this[_0xa2a1('0x1c')]['id'];if(rpc[this[_0xa2a1('0xc')]+_0xa2a1('0x1d')]){if(this['channel']===_0xa2a1('0x1e')){var _0x1067ea={'tls':{'rejectUnauthorized':![]}};if(this[_0xa2a1('0x19')][_0xa2a1('0x1f')][_0xa2a1('0x20')]){_0x1067ea['service']=this[_0xa2a1('0x19')][_0xa2a1('0x1f')][_0xa2a1('0x20')];}else{_0x1067ea[_0xa2a1('0x21')]=this[_0xa2a1('0x19')][_0xa2a1('0x1f')]['host'];_0x1067ea['port']=this[_0xa2a1('0x19')][_0xa2a1('0x1f')][_0xa2a1('0x22')];_0x1067ea[_0xa2a1('0x23')]=this[_0xa2a1('0x19')][_0xa2a1('0x1f')][_0xa2a1('0x23')];}if(this[_0xa2a1('0x19')]['Smtp'][_0xa2a1('0x24')]){_0x1067ea[_0xa2a1('0x25')]={'user':this['account']['Smtp'][_0xa2a1('0x26')],'pass':this[_0xa2a1('0x19')]['Smtp'][_0xa2a1('0x27')]};}_0x4557eb[_0xa2a1('0x28')]=this[_0xa2a1('0x11')][_0xa2a1('0x29')];_0x4557eb[_0xa2a1('0x2a')]=''+_[_0xa2a1('0x2b')](_0x4557eb[_0xa2a1('0x2c')],_0xa2a1('0x2d'),_0xa2a1('0x2e'))+_0xa2a1('0x2f');return mailRpc[_0xa2a1('0x30')](_0x1067ea,_0x4557eb)[_0xa2a1('0x31')](function(_0x5e2eee){logger[_0xa2a1('0x32')](_0xa2a1('0x33'),_0x709040);_0x4557eb[_0xa2a1('0x29')]=_0x5e2eee['message'][_0xa2a1('0x29')];return rpc[_0x5e6b23+_0xa2a1('0x1d')][_0xa2a1('0x34')](_0x4557eb);})[_0xa2a1('0x31')](function(_0x5f5caf){logger[_0xa2a1('0x32')](_0xa2a1('0x35'),_0x709040,JSON[_0xa2a1('0x36')](_0x5f5caf));})[_0xa2a1('0x37')](function(_0x411b97){logger[_0xa2a1('0x38')](_0xa2a1('0x39'),_0x709040,JSON[_0xa2a1('0x36')](_0x411b97));})[_0xa2a1('0x3a')](function(){_0x5cec4e[_0xa2a1('0xb')]();});}else{return rpc[this[_0xa2a1('0xc')]+_0xa2a1('0x1d')][_0xa2a1('0x34')](_0x4557eb)[_0xa2a1('0x31')](function(_0x4d53d4){logger[_0xa2a1('0x32')]('[%s][AUTOREPLY]\x20%s',_0x709040,_0x4557eb[_0xa2a1('0x2c')]);})[_0xa2a1('0x37')](function(_0x1890cf){logger[_0xa2a1('0x38')](_0xa2a1('0x35'),_0x709040,JSON[_0xa2a1('0x36')](_0x1890cf));})['finally'](function(){_0x5cec4e[_0xa2a1('0xb')]();});}}}catch(_0xd12040){logger[_0xa2a1('0x38')]('[%s][AUTOREPLY]\x20%s',_0x709040,JSON[_0xa2a1('0x36')](_0xd12040));_0x5cec4e[_0xa2a1('0x3b')]();}};}; \ No newline at end of file +var _0x7fbd=['consequence','isNil','interaction','created','info','[%s][AUTOREPLY]\x20%s','Autoreply\x20already\x20sent','next','channel','getMustacheRender','contact','YYYY-MM-DD\x20HH:mm:ss','message','from','phone','read','subject','Re:','Re:\x20','chat','ChatWebsiteId','account','upperFirst','AccountId','Message','mail','Smtp','service','host','port','secure','authentication','user','inReplyTo','replace','body','','sendMailMessage','messageId','create','then','stringify','catch','error','[RPC][%s][AUTOREPLY]\x20%s','finally','stop','lodash','moment','./utils','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','../../mailRpc'];(function(_0x3642a6,_0x36d827){var _0x369e1f=function(_0xd4d680){while(--_0xd4d680){_0x3642a6['push'](_0x3642a6['shift']());}};_0x369e1f(++_0x36d827);}(_0x7fbd,0x121));var _0xd7fb=function(_0xe1441d,_0x36fb8e){_0xe1441d=_0xe1441d-0x0;var _0x2ef242=_0x7fbd[_0xe1441d];return _0x2ef242;};'use strict';var _=require(_0xd7fb('0x0'));var moment=require(_0xd7fb('0x1'));var utils=require(_0xd7fb('0x2'));var logger=require(_0xd7fb('0x3'))(_0xd7fb('0x4'));var rpc={'chatMessage':require(_0xd7fb('0x5')),'openchannelMessage':require(_0xd7fb('0x6')),'mailMessage':require(_0xd7fb('0x7')),'smsMessage':require('../../rpc/smsMessage'),'faxMessage':require(_0xd7fb('0x8')),'whatsappMessage':require(_0xd7fb('0x9'))};var mailRpc=require(_0xd7fb('0xa'));exports[_0xd7fb('0xb')]=function(_0x5065c2,_0x2c166f){return function(_0x33604f){try{if(_0x2c166f[0x0]==='1'&&(_[_0xd7fb('0xc')](this[_0xd7fb('0xd')][_0xd7fb('0xe')])||!this[_0xd7fb('0xd')][_0xd7fb('0xe')])){logger[_0xd7fb('0xf')](_0xd7fb('0x10'),_0x5065c2,_0xd7fb('0x11'));return _0x33604f[_0xd7fb('0x12')]();}var _0x33b344=this[_0xd7fb('0x13')];var _0x4f1888={'body':utils[_0xd7fb('0x14')](_0x2c166f[0x1],this),'ContactId':this[_0xd7fb('0x15')]['id'],'sentAt':moment()['format'](_0xd7fb('0x16')),'direction':'out'};if(this['message']){_0x4f1888['to']=this[_0xd7fb('0x17')][_0xd7fb('0x18')]||'';_0x4f1888['cc']=this[_0xd7fb('0x17')]['cc']||'';_0x4f1888[_0xd7fb('0x18')]=this[_0xd7fb('0x17')]['to']||'';_0x4f1888[_0xd7fb('0x19')]=this['message'][_0xd7fb('0x19')]||'';_0x4f1888[_0xd7fb('0x1a')]=!![];if(this[_0xd7fb('0x17')][_0xd7fb('0x1b')]){_0x4f1888[_0xd7fb('0x1b')]='';_0x4f1888[_0xd7fb('0x1b')]+=_['startsWith'](this[_0xd7fb('0x17')]['subject'],_0xd7fb('0x1c'))?'':_0xd7fb('0x1d');_0x4f1888['subject']+=this[_0xd7fb('0x17')][_0xd7fb('0x1b')];}}if(this[_0xd7fb('0x13')]===_0xd7fb('0x1e')){_0x4f1888[_0xd7fb('0x1f')]=this[_0xd7fb('0x20')]['id'];}else{_0x4f1888[_[_0xd7fb('0x21')](this['channel'])+_0xd7fb('0x22')]=this[_0xd7fb('0x20')]['id'];}_0x4f1888[_['upperFirst'](this[_0xd7fb('0x13')])+'InteractionId']=this[_0xd7fb('0xd')]['id'];if(rpc[this[_0xd7fb('0x13')]+_0xd7fb('0x23')]){if(this['channel']===_0xd7fb('0x24')){var _0x5e8b20={'tls':{'rejectUnauthorized':![]}};if(this['account'][_0xd7fb('0x25')][_0xd7fb('0x26')]){_0x5e8b20[_0xd7fb('0x26')]=this[_0xd7fb('0x20')]['Smtp'][_0xd7fb('0x26')];}else{_0x5e8b20[_0xd7fb('0x27')]=this[_0xd7fb('0x20')]['Smtp'][_0xd7fb('0x27')];_0x5e8b20[_0xd7fb('0x28')]=this[_0xd7fb('0x20')][_0xd7fb('0x25')][_0xd7fb('0x28')];_0x5e8b20[_0xd7fb('0x29')]=this[_0xd7fb('0x20')][_0xd7fb('0x25')][_0xd7fb('0x29')];}if(this[_0xd7fb('0x20')]['Smtp'][_0xd7fb('0x2a')]){_0x5e8b20['auth']={'user':this[_0xd7fb('0x20')]['Smtp'][_0xd7fb('0x2b')],'pass':this[_0xd7fb('0x20')]['Smtp']['pass']};}_0x4f1888[_0xd7fb('0x2c')]=this[_0xd7fb('0x17')]['messageId'];_0x4f1888['html']=''+_[_0xd7fb('0x2d')](_0x4f1888[_0xd7fb('0x2e')],_0xd7fb('0x2f'),_0xd7fb('0x30'))+_0xd7fb('0x31');return mailRpc[_0xd7fb('0x32')](_0x5e8b20,_0x4f1888)['then'](function(_0x57fe40){logger[_0xd7fb('0xf')]('[%s][AUTOREPLY]\x20SMTP\x20SENT',_0x5065c2);_0x4f1888[_0xd7fb('0x33')]=_0x57fe40[_0xd7fb('0x17')]['messageId'];return rpc[_0x33b344+'Message'][_0xd7fb('0x34')](_0x4f1888);})[_0xd7fb('0x35')](function(_0x2e32ae){logger['info'](_0xd7fb('0x10'),_0x5065c2,JSON[_0xd7fb('0x36')](_0x2e32ae));})[_0xd7fb('0x37')](function(_0x54d6d3){logger[_0xd7fb('0x38')](_0xd7fb('0x39'),_0x5065c2,JSON[_0xd7fb('0x36')](_0x54d6d3));})[_0xd7fb('0x3a')](function(){_0x33604f[_0xd7fb('0x12')]();});}else{return rpc[this['channel']+'Message'][_0xd7fb('0x34')](_0x4f1888)[_0xd7fb('0x35')](function(_0x3a33f5){logger[_0xd7fb('0xf')](_0xd7fb('0x10'),_0x5065c2,_0x4f1888[_0xd7fb('0x2e')]);})[_0xd7fb('0x37')](function(_0x21525c){logger['error'](_0xd7fb('0x10'),_0x5065c2,JSON[_0xd7fb('0x36')](_0x21525c));})[_0xd7fb('0x3a')](function(){_0x33604f[_0xd7fb('0x12')]();});}}}catch(_0x1fdc59){logger[_0xd7fb('0x38')](_0xd7fb('0x10'),_0x5065c2,JSON[_0xd7fb('0x36')](_0x1fdc59));_0x33604f[_0xd7fb('0x3b')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/close.js b/server/services/routing/server/applications/close.js index 8115715..bcbd64f 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 _0xf03a=['../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/mailInteraction','../../rpc/faxInteraction','consequence','[%s][CLOSE]\x20reason\x20%s','format','YYYY-MM-DD\x20HH:mm:ss','system','channel','Interaction','update','interaction','then','info','[%s][CLOSE]\x20interaction\x20%s\x20has\x20been\x20closed!','catch','error','[%s][CLOSE]\x20%s','stop','../../../../config/logger','routing'];(function(_0x45d55e,_0x2fede3){var _0x29812a=function(_0x3c6830){while(--_0x3c6830){_0x45d55e['push'](_0x45d55e['shift']());}};_0x29812a(++_0x2fede3);}(_0xf03a,0x1a0));var _0xaf03=function(_0x13dbae,_0x11d6ef){_0x13dbae=_0x13dbae-0x0;var _0x12cb55=_0xf03a[_0x13dbae];return _0x12cb55;};'use strict';var moment=require('moment');var logger=require(_0xaf03('0x0'))(_0xaf03('0x1'));var rpc={'chatInteraction':require(_0xaf03('0x2')),'openchannelInteraction':require(_0xaf03('0x3')),'smsInteraction':require('../../rpc/smsInteraction'),'mailInteraction':require(_0xaf03('0x4')),'faxInteraction':require(_0xaf03('0x5')),'whatsappInteraction':require('../../rpc/whatsappInteraction')};exports[_0xaf03('0x6')]=function(_0x10a6a5,_0x120ee0,_0x2e05f7,_0x58a29b){return function(_0x2d19df){try{logger['info'](_0xaf03('0x7'),_0x10a6a5,_0x120ee0[0x0]);var _0x467e7c={'closed':0x1,'closedAt':moment()[_0xaf03('0x8')](_0xaf03('0x9')),'closeReason':_0xaf03('0xa'),'disposition':_0x120ee0[0x0]};if(rpc[_0x58a29b[_0xaf03('0xb')]+'Interaction']){rpc[_0x58a29b[_0xaf03('0xb')]+_0xaf03('0xc')][_0xaf03('0xd')](_0x58a29b[_0xaf03('0xe')]['id'],_0x467e7c)[_0xaf03('0xf')](function(_0x56eb85){logger[_0xaf03('0x10')](_0xaf03('0x11'),_0x10a6a5,_0x58a29b[_0xaf03('0xe')]['id']);})[_0xaf03('0x12')](function(_0x37156e){logger[_0xaf03('0x13')](_0xaf03('0x14'),_0x10a6a5,JSON['stringify'](_0x37156e));})['finally'](function(){_0x2d19df[_0xaf03('0x15')]();});}}catch(_0x525cfb){logger[_0xaf03('0x13')]('[%s][CLOSE]\x20%s',_0x10a6a5,JSON['stringify'](_0x525cfb));_0x2d19df[_0xaf03('0x15')]();}};}; \ No newline at end of file +var _0xf13b=['stringify','finally','stop','moment','../../rpc/openchannelInteraction','../../rpc/smsInteraction','../../rpc/mailInteraction','../../rpc/faxInteraction','[%s][CLOSE]\x20reason\x20%s','YYYY-MM-DD\x20HH:mm:ss','system','channel','Interaction','interaction','info','catch','error'];(function(_0xdbbbee,_0x18c495){var _0x172b8f=function(_0x46dfed){while(--_0x46dfed){_0xdbbbee['push'](_0xdbbbee['shift']());}};_0x172b8f(++_0x18c495);}(_0xf13b,0x1f0));var _0xbf13=function(_0x9bf5b9,_0x129b0f){_0x9bf5b9=_0x9bf5b9-0x0;var _0xdf1f35=_0xf13b[_0x9bf5b9];return _0xdf1f35;};'use strict';var moment=require(_0xbf13('0x0'));var logger=require('../../../../config/logger')('routing');var rpc={'chatInteraction':require('../../rpc/chatInteraction'),'openchannelInteraction':require(_0xbf13('0x1')),'smsInteraction':require(_0xbf13('0x2')),'mailInteraction':require(_0xbf13('0x3')),'faxInteraction':require(_0xbf13('0x4')),'whatsappInteraction':require('../../rpc/whatsappInteraction')};exports['consequence']=function(_0x179246,_0x1256ed,_0x5f4b13,_0x325b03){return function(_0x2316ad){try{logger['info'](_0xbf13('0x5'),_0x179246,_0x1256ed[0x0]);var _0x212fac={'closed':0x1,'closedAt':moment()['format'](_0xbf13('0x6')),'closeReason':_0xbf13('0x7'),'disposition':_0x1256ed[0x0]};if(rpc[_0x325b03[_0xbf13('0x8')]+_0xbf13('0x9')]){rpc[_0x325b03['channel']+_0xbf13('0x9')]['update'](_0x325b03[_0xbf13('0xa')]['id'],_0x212fac)['then'](function(_0x1ac7a8){logger[_0xbf13('0xb')]('[%s][CLOSE]\x20interaction\x20%s\x20has\x20been\x20closed!',_0x179246,_0x325b03[_0xbf13('0xa')]['id']);})[_0xbf13('0xc')](function(_0x1d6cc9){logger[_0xbf13('0xd')]('[%s][CLOSE]\x20%s',_0x179246,JSON[_0xbf13('0xe')](_0x1d6cc9));})[_0xbf13('0xf')](function(){_0x2316ad[_0xbf13('0x10')]();});}}catch(_0x1c0d95){logger['error']('[%s][CLOSE]\x20%s',_0x179246,JSON['stringify'](_0x1c0d95));_0x2316ad[_0xbf13('0x10')]();}};}; \ 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 b1c4fc1..68edd55 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 _0x43cf=['body','catch','error','stringify','finally','info','[%s][DIALOGFLOW]\x20Welcome\x20Message\x20has\x20been\x20sent!','stop','[%s][DIALOGFLOW]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','textRequest','message','dialogflow','result','speech','Message','create','metadata','endConversation','lodash','moment','md5','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','consequence','interaction','UserId','[%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','upperFirst','InteractionId','created','isEmpty','getMustacheRender','then'];(function(_0x1bc750,_0x23f442){var _0xcd51da=function(_0x323854){while(--_0x323854){_0x1bc750['push'](_0x1bc750['shift']());}};_0xcd51da(++_0x23f442);}(_0x43cf,0xfd));var _0xf43c=function(_0x5a1a51,_0x144c79){_0x5a1a51=_0x5a1a51-0x0;var _0x47edd7=_0x43cf[_0x5a1a51];return _0x47edd7;};'use strict';var _=require(_0xf43c('0x0'));var moment=require(_0xf43c('0x1'));var apiai=require('apiai-promise');var md5=require(_0xf43c('0x2'));var utils=require('./utils');var logger=require(_0xf43c('0x3'))(_0xf43c('0x4'));var rpc={'chatMessage':require(_0xf43c('0x5')),'openchannelMessage':require('../../rpc/openchannelMessage'),'mailMessage':require(_0xf43c('0x6')),'smsMessage':require(_0xf43c('0x7')),'faxMessage':require(_0xf43c('0x8')),'whatsappMessage':require('../../rpc/whatsappMessage')};exports[_0xf43c('0x9')]=function(_0x5118f0,_0x5ef391){return function(_0x125985){try{if(!_['isNil'](this[_0xf43c('0xa')][_0xf43c('0xb')])){logger['info'](_0xf43c('0xc'),_0x5118f0,_0xf43c('0xd'));return _0x125985[_0xf43c('0xe')]();}var _0x4db21e={'ContactId':this[_0xf43c('0xf')]['id'],'sentAt':moment()[_0xf43c('0x10')](_0xf43c('0x11')),'direction':_0xf43c('0x12')};var _0x46ec2a=this[_0xf43c('0x13')];if(_0x46ec2a===_0xf43c('0x14')){_0x4db21e[_0xf43c('0x15')]=this[_0xf43c('0x16')]['id'];}else{_0x4db21e[_[_0xf43c('0x17')](_0x46ec2a)+'AccountId']=this[_0xf43c('0x16')]['id'];}_0x4db21e[_[_0xf43c('0x17')](_0x46ec2a)+_0xf43c('0x18')]=this[_0xf43c('0xa')]['id'];if(this[_0xf43c('0xa')][_0xf43c('0x19')]){var _0x504d46=_0x5ef391[0x2];if(!_[_0xf43c('0x1a')](_0x504d46)){_0x4db21e['body']=utils[_0xf43c('0x1b')](_0x504d46,this);return rpc[_0x46ec2a+'Message']['create'](_0x4db21e)[_0xf43c('0x1c')](function(_0x586829){logger['info'](_0xf43c('0xc'),_0x5118f0,_0x4db21e[_0xf43c('0x1d')]);})[_0xf43c('0x1e')](function(_0x158062){logger[_0xf43c('0x1f')]('[%s][DIALOGFLOW]\x20%s',_0x5118f0,JSON[_0xf43c('0x20')](_0x158062));})[_0xf43c('0x21')](function(){logger[_0xf43c('0x22')](_0xf43c('0x23'),_0x5118f0);_0x125985[_0xf43c('0x24')]();});}else{logger[_0xf43c('0x22')](_0xf43c('0x25'),_0x5118f0);_0x125985[_0xf43c('0x24')]();}}else{var _0x5ba48b=this;var _0x33c764=apiai(_0x5ef391[0x0],{'language':_0x5ef391[0x1]||'en'});return _0x33c764[_0xf43c('0x26')](this[_0xf43c('0x27')][_0xf43c('0x1d')],{'sessionId':md5(this[_0xf43c('0xa')]['id'])})[_0xf43c('0x1c')](function(_0x59ac12){_0x5ba48b['body'][_0xf43c('0x28')]=_0x59ac12;_0x4db21e['body']=_0x59ac12[_0xf43c('0x29')]['fulfillment'][_0xf43c('0x2a')];return rpc[_0x46ec2a+_0xf43c('0x2b')][_0xf43c('0x2c')](_0x4db21e)['then'](function(_0x31f36f){logger[_0xf43c('0x22')](_0xf43c('0xc'),_0x5118f0,_0x4db21e[_0xf43c('0x1d')]);if(_0x59ac12[_0xf43c('0x29')][_0xf43c('0x2d')][_0xf43c('0x2e')]){_0x125985[_0xf43c('0xe')]();}else{_0x125985[_0xf43c('0x24')]();}})[_0xf43c('0x1e')](function(_0x593fe9){logger[_0xf43c('0x1f')](_0xf43c('0xc'),_0x5118f0,JSON[_0xf43c('0x20')](_0x593fe9));_0x125985[_0xf43c('0xe')]();});})['catch'](function(_0x39ae52){logger[_0xf43c('0x1f')]('[%s][DIALOGFLOW]\x20%s',_0x5118f0,_0x39ae52[_0xf43c('0x27')]);_0x125985[_0xf43c('0xe')]();});}}catch(_0x4a1f80){logger[_0xf43c('0x1f')](_0xf43c('0xc'),_0x5118f0,JSON[_0xf43c('0x20')](_0x4a1f80));_0x125985[_0xf43c('0x24')]();}};}; \ No newline at end of file +var _0x2a20=['contact','out','channel','ChatWebsiteId','account','upperFirst','AccountId','created','isEmpty','body','getMustacheRender','Message','create','then','catch','error','stringify','finally','[%s][DIALOGFLOW]\x20Welcome\x20Message\x20has\x20been\x20sent!','stop','textRequest','message','dialogflow','result','metadata','endConversation','lodash','moment','apiai-promise','./utils','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','consequence','isNil','interaction','info','[%s][DIALOGFLOW]\x20%s','next'];(function(_0x5eeadd,_0x24b979){var _0x3b08a1=function(_0x5890e1){while(--_0x5890e1){_0x5eeadd['push'](_0x5eeadd['shift']());}};_0x3b08a1(++_0x24b979);}(_0x2a20,0x1f3));var _0x02a2=function(_0x575556,_0x564e7e){_0x575556=_0x575556-0x0;var _0x10c6a0=_0x2a20[_0x575556];return _0x10c6a0;};'use strict';var _=require(_0x02a2('0x0'));var moment=require(_0x02a2('0x1'));var apiai=require(_0x02a2('0x2'));var md5=require('md5');var utils=require(_0x02a2('0x3'));var logger=require(_0x02a2('0x4'))(_0x02a2('0x5'));var rpc={'chatMessage':require(_0x02a2('0x6')),'openchannelMessage':require(_0x02a2('0x7')),'mailMessage':require('../../rpc/mailMessage'),'smsMessage':require(_0x02a2('0x8')),'faxMessage':require(_0x02a2('0x9')),'whatsappMessage':require(_0x02a2('0xa'))};exports[_0x02a2('0xb')]=function(_0x22613b,_0x121748){return function(_0x4ea425){try{if(!_[_0x02a2('0xc')](this[_0x02a2('0xd')]['UserId'])){logger[_0x02a2('0xe')](_0x02a2('0xf'),_0x22613b,'Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.');return _0x4ea425[_0x02a2('0x10')]();}var _0x3b92b0={'ContactId':this[_0x02a2('0x11')]['id'],'sentAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'direction':_0x02a2('0x12')};var _0x5b7fa5=this[_0x02a2('0x13')];if(_0x5b7fa5==='chat'){_0x3b92b0[_0x02a2('0x14')]=this[_0x02a2('0x15')]['id'];}else{_0x3b92b0[_[_0x02a2('0x16')](_0x5b7fa5)+_0x02a2('0x17')]=this[_0x02a2('0x15')]['id'];}_0x3b92b0[_[_0x02a2('0x16')](_0x5b7fa5)+'InteractionId']=this[_0x02a2('0xd')]['id'];if(this['interaction'][_0x02a2('0x18')]){var _0x349d70=_0x121748[0x2];if(!_[_0x02a2('0x19')](_0x349d70)){_0x3b92b0[_0x02a2('0x1a')]=utils[_0x02a2('0x1b')](_0x349d70,this);return rpc[_0x5b7fa5+_0x02a2('0x1c')][_0x02a2('0x1d')](_0x3b92b0)[_0x02a2('0x1e')](function(_0x2ee5bf){logger[_0x02a2('0xe')](_0x02a2('0xf'),_0x22613b,_0x3b92b0[_0x02a2('0x1a')]);})[_0x02a2('0x1f')](function(_0xa4b025){logger[_0x02a2('0x20')](_0x02a2('0xf'),_0x22613b,JSON[_0x02a2('0x21')](_0xa4b025));})[_0x02a2('0x22')](function(){logger[_0x02a2('0xe')](_0x02a2('0x23'),_0x22613b);_0x4ea425[_0x02a2('0x24')]();});}else{logger[_0x02a2('0xe')]('[%s][DIALOGFLOW]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!',_0x22613b);_0x4ea425[_0x02a2('0x24')]();}}else{var _0x40657e=this;var _0x7612e0=apiai(_0x121748[0x0],{'language':_0x121748[0x1]||'en'});return _0x7612e0[_0x02a2('0x25')](this[_0x02a2('0x26')][_0x02a2('0x1a')],{'sessionId':md5(this[_0x02a2('0xd')]['id'])})['then'](function(_0x17af87){_0x40657e[_0x02a2('0x1a')][_0x02a2('0x27')]=_0x17af87;_0x3b92b0[_0x02a2('0x1a')]=_0x17af87['result']['fulfillment']['speech'];return rpc[_0x5b7fa5+_0x02a2('0x1c')][_0x02a2('0x1d')](_0x3b92b0)['then'](function(_0x112032){logger['info']('[%s][DIALOGFLOW]\x20%s',_0x22613b,_0x3b92b0[_0x02a2('0x1a')]);if(_0x17af87[_0x02a2('0x28')][_0x02a2('0x29')][_0x02a2('0x2a')]){_0x4ea425['next']();}else{_0x4ea425['stop']();}})[_0x02a2('0x1f')](function(_0x45235d){logger[_0x02a2('0x20')](_0x02a2('0xf'),_0x22613b,JSON[_0x02a2('0x21')](_0x45235d));_0x4ea425[_0x02a2('0x10')]();});})[_0x02a2('0x1f')](function(_0x1f2668){logger['error'](_0x02a2('0xf'),_0x22613b,_0x1f2668['message']);_0x4ea425['next']();});}}catch(_0xc9517c){logger[_0x02a2('0x20')](_0x02a2('0xf'),_0x22613b,JSON[_0x02a2('0x21')](_0xc9517c));_0x4ea425[_0x02a2('0x24')]();}};}; \ 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 9f866f5..3881b3d 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 _0xc4b0=['html-to-text','./utils','routing','string','condition\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','priority\x20false\x20is\x20a\x20number','consequence','fromString','error','map','message','join','stop','condition','priorityTrue','info','[%s][GOTOIF]\x20condition\x20%s\x20is\x20%s\x20try\x20goto\x20priority\x20%s','next','findIndex','[%s][GOTOIF]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','[%s][GOTOIF]\x20eval\x20error:\x20%s','[%s][GOTOIF]\x20%s','stringify','validate','lodash'];(function(_0x5bfc5e,_0x80370e){var _0x242f9e=function(_0x49ac5b){while(--_0x49ac5b){_0x5bfc5e['push'](_0x5bfc5e['shift']());}};_0x242f9e(++_0x80370e);}(_0xc4b0,0x80));var _0x0c4b=function(_0x5caf82,_0x9591f7){_0x5caf82=_0x5caf82-0x0;var _0x5cf782=_0xc4b0[_0x5caf82];return _0x5cf782;};'use strict';var schema=require(_0x0c4b('0x0'));var _=require(_0x0c4b('0x1'));var htmlToText=require(_0x0c4b('0x2'));var utils=require(_0x0c4b('0x3'));var logger=require('../../../../config/logger')(_0x0c4b('0x4'));var gotoif=schema({'condition':{'type':_0x0c4b('0x5'),'required':!![],'message':_0x0c4b('0x6')},'priorityTrue':{'type':_0x0c4b('0x7'),'message':'priority\x20true\x20is\x20a\x20number'},'priorityFalse':{'type':_0x0c4b('0x7'),'message':_0x0c4b('0x8')}});exports[_0x0c4b('0x9')]=function(_0x11de37,_0x25d120){return function(_0x50be9a){try{var _0x302910={'condition':htmlToText[_0x0c4b('0xa')](utils['getMustacheRender'](_0x25d120[0x0],this),{'wordwrap':![]})['replace'](/<\/?[^>]+(>|$)/g,''),'priorityTrue':_0x25d120[0x1],'priorityFalse':_0x25d120[0x2]};var _0x30502e=gotoif[_0x0c4b('0x0')](_0x302910,{'typecast':!![]});if(_0x30502e['length']){logger[_0x0c4b('0xb')]('[%s][GOTOIF]\x20%s',_0x11de37,_[_0x0c4b('0xc')](_0x30502e,_0x0c4b('0xd'))[_0x0c4b('0xe')](',\x20'));_0x50be9a[_0x0c4b('0xf')]();}else{try{var _0x3bf132=eval('('+_0x302910[_0x0c4b('0x10')]+')');var _0x5b05b7=_0x3bf132?_0x302910[_0x0c4b('0x11')]:_0x302910['priorityFalse'];logger[_0x0c4b('0x12')](_0x0c4b('0x13'),_0x11de37,_0x302910['condition'],_0x3bf132,_0x5b05b7||_0x0c4b('0x14'));if(_0x5b05b7){var _0xb7cff1=_[_0x0c4b('0x15')](_0x50be9a['rules'](),{'p':_0x5b05b7});if(_0xb7cff1>=0x0){logger['info'](_0x0c4b('0x16'),_0x11de37,_0x5b05b7||_0x0c4b('0x14'),_0xb7cff1);_0x50be9a['next'](_0xb7cff1);}else{logger[_0x0c4b('0x12')]('[%s][GOTOIF]\x20priority\x20%s\x20not\x20found',_0x11de37,_0x5b05b7||_0x0c4b('0x14'));_0x50be9a[_0x0c4b('0xf')]();}}else{_0x50be9a[_0x0c4b('0x14')]();}}catch(_0x1ff805){logger['error'](_0x0c4b('0x17'),_0x11de37,_0x1ff805[_0x0c4b('0xd')]);_0x50be9a[_0x0c4b('0xf')]();}}}catch(_0x157e8b){logger[_0x0c4b('0xb')](_0x0c4b('0x18'),_0x11de37,JSON[_0x0c4b('0x19')](_0x157e8b));_0x50be9a['stop']();}};}; \ No newline at end of file +var _0x6839=['consequence','fromString','getMustacheRender','replace','length','[%s][GOTOIF]\x20%s','condition','priorityTrue','priorityFalse','[%s][GOTOIF]\x20condition\x20%s\x20is\x20%s\x20try\x20goto\x20priority\x20%s','next','findIndex','rules','info','[%s][GOTOIF]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','[%s][GOTOIF]\x20priority\x20%s\x20not\x20found','error','[%s][GOTOIF]\x20eval\x20error:\x20%s','message','stringify','validate','lodash','./utils','../../../../config/logger','routing','string','number','priority\x20true\x20is\x20a\x20number','priority\x20false\x20is\x20a\x20number'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x6839,0x136));var _0x9683=function(_0x424c0f,_0x31a27d){_0x424c0f=_0x424c0f-0x0;var _0x265bf4=_0x6839[_0x424c0f];return _0x265bf4;};'use strict';var schema=require(_0x9683('0x0'));var _=require(_0x9683('0x1'));var htmlToText=require('html-to-text');var utils=require(_0x9683('0x2'));var logger=require(_0x9683('0x3'))(_0x9683('0x4'));var gotoif=schema({'condition':{'type':_0x9683('0x5'),'required':!![],'message':'condition\x20is\x20a\x20string\x20and\x20it\x20is\x20required'},'priorityTrue':{'type':_0x9683('0x6'),'message':_0x9683('0x7')},'priorityFalse':{'type':_0x9683('0x6'),'message':_0x9683('0x8')}});exports[_0x9683('0x9')]=function(_0xe7b01a,_0x5b94b4){return function(_0x4f4f41){try{var _0x1b7fc5={'condition':htmlToText[_0x9683('0xa')](utils[_0x9683('0xb')](_0x5b94b4[0x0],this),{'wordwrap':![]})[_0x9683('0xc')](/<\/?[^>]+(>|$)/g,''),'priorityTrue':_0x5b94b4[0x1],'priorityFalse':_0x5b94b4[0x2]};var _0x3baffd=gotoif[_0x9683('0x0')](_0x1b7fc5,{'typecast':!![]});if(_0x3baffd[_0x9683('0xd')]){logger['error'](_0x9683('0xe'),_0xe7b01a,_['map'](_0x3baffd,'message')['join'](',\x20'));_0x4f4f41['stop']();}else{try{var _0x36dc2f=eval('('+_0x1b7fc5[_0x9683('0xf')]+')');var _0xbb4983=_0x36dc2f?_0x1b7fc5[_0x9683('0x10')]:_0x1b7fc5[_0x9683('0x11')];logger['info'](_0x9683('0x12'),_0xe7b01a,_0x1b7fc5[_0x9683('0xf')],_0x36dc2f,_0xbb4983||_0x9683('0x13'));if(_0xbb4983){var _0x4d0c5c=_[_0x9683('0x14')](_0x4f4f41[_0x9683('0x15')](),{'p':_0xbb4983});if(_0x4d0c5c>=0x0){logger[_0x9683('0x16')](_0x9683('0x17'),_0xe7b01a,_0xbb4983||_0x9683('0x13'),_0x4d0c5c);_0x4f4f41[_0x9683('0x13')](_0x4d0c5c);}else{logger[_0x9683('0x16')](_0x9683('0x18'),_0xe7b01a,_0xbb4983||_0x9683('0x13'));_0x4f4f41['stop']();}}else{_0x4f4f41['next']();}}catch(_0x3a7fc5){logger[_0x9683('0x19')](_0x9683('0x1a'),_0xe7b01a,_0x3a7fc5[_0x9683('0x1b')]);_0x4f4f41['stop']();}}}catch(_0x5d5b91){logger['error']('[%s][GOTOIF]\x20%s',_0xe7b01a,JSON[_0x9683('0x1c')](_0x5d5b91));_0x4f4f41['stop']();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/gotop.js b/server/services/routing/server/applications/gotop.js index d90b8f5..e0996de 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 _0x47cc=['../../../../config/logger','consequence','length','error','[%s][GOTOP]\x20%s','map','message','stop','priority','findIndex','rules','info','[%s][GOTOP]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','next','[%s][GOTOP]\x20priority\x20%s\x20not\x20found','stringify','validate','lodash'];(function(_0x54c98a,_0x2a6ec8){var _0x2d42d5=function(_0x1950e3){while(--_0x1950e3){_0x54c98a['push'](_0x54c98a['shift']());}};_0x2d42d5(++_0x2a6ec8);}(_0x47cc,0x1c0));var _0xc47c=function(_0x1a4b9e,_0x53648c){_0x1a4b9e=_0x1a4b9e-0x0;var _0x1587b1=_0x47cc[_0x1a4b9e];return _0x1587b1;};'use strict';var schema=require(_0xc47c('0x0'));var _=require(_0xc47c('0x1'));var logger=require(_0xc47c('0x2'))('routing');var gotop=schema({'priority':{'type':'number','required':!![],'message':'priority\x20is\x20a\x20number\x20and\x20it\x20is\x20required'}});exports[_0xc47c('0x3')]=function(_0x65c35e,_0x5231c6){return function(_0x58936f){try{var _0x383057={'priority':_0x5231c6[0x0]};var _0x1e73fa=gotop[_0xc47c('0x0')](_0x383057,{'typecast':!![]});if(_0x1e73fa[_0xc47c('0x4')]){logger[_0xc47c('0x5')](_0xc47c('0x6'),_0x65c35e,_[_0xc47c('0x7')](_0x1e73fa,_0xc47c('0x8'))['join'](',\x20'));_0x58936f[_0xc47c('0x9')]();}else{logger['info']('[%s][GOTOP]\x20priority\x20%s',_0x65c35e,_0x383057[_0xc47c('0xa')]);if(_0x383057[_0xc47c('0xa')]){var _0x4e87fe=_[_0xc47c('0xb')](_0x58936f[_0xc47c('0xc')](),{'p':_0x383057[_0xc47c('0xa')]});if(_0x4e87fe>=0x0){logger[_0xc47c('0xd')](_0xc47c('0xe'),_0x65c35e,_0x383057[_0xc47c('0xa')]||'next',_0x4e87fe);_0x58936f[_0xc47c('0xf')](_0x4e87fe);}else{logger[_0xc47c('0xd')](_0xc47c('0x10'),_0x65c35e,_0x383057[_0xc47c('0xa')]||_0xc47c('0xf'));_0x58936f[_0xc47c('0x9')]();}}else{_0x58936f[_0xc47c('0xf')]();}}}catch(_0x5887ee){logger[_0xc47c('0x5')](_0xc47c('0x6'),_0x65c35e,JSON[_0xc47c('0x11')](_0x5887ee));_0x58936f['stop']();}};}; \ No newline at end of file +var _0x6d13=['validate','lodash','../../../../config/logger','routing','priority\x20is\x20a\x20number\x20and\x20it\x20is\x20required','consequence','length','error','[%s][GOTOP]\x20%s','map','message','join','info','[%s][GOTOP]\x20priority\x20%s','priority','findIndex','rules','[%s][GOTOP]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','next','stringify','stop'];(function(_0x128cea,_0x615e4b){var _0x358597=function(_0x561acb){while(--_0x561acb){_0x128cea['push'](_0x128cea['shift']());}};_0x358597(++_0x615e4b);}(_0x6d13,0x150));var _0x36d1=function(_0x364048,_0x34dea3){_0x364048=_0x364048-0x0;var _0x591678=_0x6d13[_0x364048];return _0x591678;};'use strict';var schema=require(_0x36d1('0x0'));var _=require(_0x36d1('0x1'));var logger=require(_0x36d1('0x2'))(_0x36d1('0x3'));var gotop=schema({'priority':{'type':'number','required':!![],'message':_0x36d1('0x4')}});exports[_0x36d1('0x5')]=function(_0x3eaa6b,_0x1fe068){return function(_0x2144e5){try{var _0x10feed={'priority':_0x1fe068[0x0]};var _0x516b05=gotop[_0x36d1('0x0')](_0x10feed,{'typecast':!![]});if(_0x516b05[_0x36d1('0x6')]){logger[_0x36d1('0x7')](_0x36d1('0x8'),_0x3eaa6b,_[_0x36d1('0x9')](_0x516b05,_0x36d1('0xa'))[_0x36d1('0xb')](',\x20'));_0x2144e5['stop']();}else{logger[_0x36d1('0xc')](_0x36d1('0xd'),_0x3eaa6b,_0x10feed['priority']);if(_0x10feed[_0x36d1('0xe')]){var _0xc0dbca=_[_0x36d1('0xf')](_0x2144e5[_0x36d1('0x10')](),{'p':_0x10feed[_0x36d1('0xe')]});if(_0xc0dbca>=0x0){logger[_0x36d1('0xc')](_0x36d1('0x11'),_0x3eaa6b,_0x10feed[_0x36d1('0xe')]||_0x36d1('0x12'),_0xc0dbca);_0x2144e5[_0x36d1('0x12')](_0xc0dbca);}else{logger[_0x36d1('0xc')]('[%s][GOTOP]\x20priority\x20%s\x20not\x20found',_0x3eaa6b,_0x10feed[_0x36d1('0xe')]||'next');_0x2144e5['stop']();}}else{_0x2144e5['next']();}}}catch(_0x3760e7){logger[_0x36d1('0x7')]('[%s][GOTOP]\x20%s',_0x3eaa6b,JSON[_0x36d1('0x13')](_0x3760e7));_0x2144e5[_0x36d1('0x14')]();}};}; \ 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 81dbbaf..c0243f9 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 _0x7265=['error','stringify','stop','./utils','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','consequence','contact','channel','chat','ChatWebsiteId','account','upperFirst','AccountId','InteractionId','interaction','Message','create','info','[%s][MESSAGE]\x20%s','body','catch'];(function(_0x5e3b04,_0xbb6795){var _0x1fc44d=function(_0x3472a1){while(--_0x3472a1){_0x5e3b04['push'](_0x5e3b04['shift']());}};_0x1fc44d(++_0xbb6795);}(_0x7265,0x73));var _0x5726=function(_0x3fe629,_0x67f6f2){_0x3fe629=_0x3fe629-0x0;var _0xba59dd=_0x7265[_0x3fe629];return _0xba59dd;};'use strict';var _=require('lodash');var utils=require(_0x5726('0x0'));var logger=require(_0x5726('0x1'))(_0x5726('0x2'));var rpc={'chatMessage':require(_0x5726('0x3')),'openchannelMessage':require(_0x5726('0x4')),'mailMessage':require(_0x5726('0x5')),'smsMessage':require(_0x5726('0x6')),'faxMessage':require(_0x5726('0x7')),'whatsappMessage':require(_0x5726('0x8'))};exports[_0x5726('0x9')]=function(_0x1f0cec,_0x3337d8){return function(_0x592a56){try{var _0x52e65a={'body':utils['getMustacheRender'](_0x3337d8[0x0],this),'ContactId':this[_0x5726('0xa')]['id']};if(this[_0x5726('0xb')]===_0x5726('0xc')){_0x52e65a[_0x5726('0xd')]=this[_0x5726('0xe')]['id'];}else{_0x52e65a[_[_0x5726('0xf')](this[_0x5726('0xb')])+_0x5726('0x10')]=this['account']['id'];}_0x52e65a[_['upperFirst'](this['channel'])+_0x5726('0x11')]=this[_0x5726('0x12')]['id'];if(rpc[this[_0x5726('0xb')]+_0x5726('0x13')]){return rpc[this[_0x5726('0xb')]+'Message'][_0x5726('0x14')](_0x52e65a)['then'](function(_0x4f15bf){logger[_0x5726('0x15')](_0x5726('0x16'),_0x1f0cec,_0x52e65a[_0x5726('0x17')]);_0x592a56['next']();})[_0x5726('0x18')](function(_0x5aae96){logger[_0x5726('0x19')]('[%s][MESSAGE]\x20%s',_0x1f0cec,JSON[_0x5726('0x1a')](_0x5aae96));_0x592a56[_0x5726('0x1b')]();});}}catch(_0x419fe7){logger[_0x5726('0x19')]('[%s][MESSAGE]\x20%s',_0x1f0cec,JSON['stringify'](_0x419fe7));_0x592a56[_0x5726('0x1b')]();}};}; \ No newline at end of file +var _0xe899=['consequence','contact','channel','chat','AccountId','account','InteractionId','interaction','Message','create','then','info','[%s][MESSAGE]\x20%s','next','stringify','stop','error','lodash','./utils','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage'];(function(_0x36c417,_0x8b8eec){var _0x39d9a0=function(_0x2c685f){while(--_0x2c685f){_0x36c417['push'](_0x36c417['shift']());}};_0x39d9a0(++_0x8b8eec);}(_0xe899,0x8e));var _0x9e89=function(_0x138adb,_0x193fee){_0x138adb=_0x138adb-0x0;var _0x1b27f2=_0xe899[_0x138adb];return _0x1b27f2;};'use strict';var _=require(_0x9e89('0x0'));var utils=require(_0x9e89('0x1'));var logger=require('../../../../config/logger')(_0x9e89('0x2'));var rpc={'chatMessage':require(_0x9e89('0x3')),'openchannelMessage':require(_0x9e89('0x4')),'mailMessage':require(_0x9e89('0x5')),'smsMessage':require(_0x9e89('0x6')),'faxMessage':require(_0x9e89('0x7')),'whatsappMessage':require('../../rpc/whatsappMessage')};exports[_0x9e89('0x8')]=function(_0x1babc1,_0x5a8e2d){return function(_0x16cf11){try{var _0x5cd029={'body':utils['getMustacheRender'](_0x5a8e2d[0x0],this),'ContactId':this[_0x9e89('0x9')]['id']};if(this[_0x9e89('0xa')]===_0x9e89('0xb')){_0x5cd029['ChatWebsiteId']=this['account']['id'];}else{_0x5cd029[_['upperFirst'](this[_0x9e89('0xa')])+_0x9e89('0xc')]=this[_0x9e89('0xd')]['id'];}_0x5cd029[_['upperFirst'](this[_0x9e89('0xa')])+_0x9e89('0xe')]=this[_0x9e89('0xf')]['id'];if(rpc[this['channel']+_0x9e89('0x10')]){return rpc[this[_0x9e89('0xa')]+_0x9e89('0x10')][_0x9e89('0x11')](_0x5cd029)[_0x9e89('0x12')](function(_0x20afdf){logger[_0x9e89('0x13')](_0x9e89('0x14'),_0x1babc1,_0x5cd029['body']);_0x16cf11[_0x9e89('0x15')]();})['catch'](function(_0x2c8b99){logger['error'](_0x9e89('0x14'),_0x1babc1,JSON[_0x9e89('0x16')](_0x2c8b99));_0x16cf11[_0x9e89('0x17')]();});}}catch(_0x565758){logger[_0x9e89('0x18')](_0x9e89('0x14'),_0x1babc1,JSON[_0x9e89('0x16')](_0x565758));_0x16cf11[_0x9e89('0x17')]();}};}; \ 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 c19589b..28f84c6 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 _0x33f0=['routing','info','[%s][NOOP]\x20%s','getMustacheRender','next','error','stop','../../../../config/logger'];(function(_0x1dd88c,_0x5c8342){var _0x4c94f6=function(_0x1abb34){while(--_0x1abb34){_0x1dd88c['push'](_0x1dd88c['shift']());}};_0x4c94f6(++_0x5c8342);}(_0x33f0,0x177));var _0x033f=function(_0x434e22,_0x537310){_0x434e22=_0x434e22-0x0;var _0xf38879=_0x33f0[_0x434e22];return _0xf38879;};'use strict';var utils=require('./utils');var logger=require(_0x033f('0x0'))(_0x033f('0x1'));exports['consequence']=function(_0xa2ba1c,_0x2277bd){return function(_0x3e90f8){try{logger[_0x033f('0x2')](_0x033f('0x3'),_0xa2ba1c,utils[_0x033f('0x4')](_0x2277bd[0x0],this));_0x3e90f8[_0x033f('0x5')]();}catch(_0x47a9ac){logger[_0x033f('0x6')](_0x033f('0x3'),_0xa2ba1c,JSON['stringify'](_0x47a9ac));_0x3e90f8[_0x033f('0x7')]();}};}; \ No newline at end of file +var _0x7209=['next','error','stringify','./utils','../../../../config/logger','[%s][NOOP]\x20%s','getMustacheRender'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x7209,0x1df));var _0x9720=function(_0xbcd67e,_0x1c8a24){_0xbcd67e=_0xbcd67e-0x0;var _0x3c9acd=_0x7209[_0xbcd67e];return _0x3c9acd;};'use strict';var utils=require(_0x9720('0x0'));var logger=require(_0x9720('0x1'))('routing');exports['consequence']=function(_0x353f6f,_0x4f4cec){return function(_0x275e09){try{logger['info'](_0x9720('0x2'),_0x353f6f,utils[_0x9720('0x3')](_0x4f4cec[0x0],this));_0x275e09[_0x9720('0x4')]();}catch(_0x4a4923){logger[_0x9720('0x5')](_0x9720('0x2'),_0x353f6f,JSON[_0x9720('0x6')](_0x4a4923));_0x275e09['stop']();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/queue.js b/server/services/routing/server/applications/queue.js index 0a3ff2d..fbcea81 100644 --- a/server/services/routing/server/applications/queue.js +++ b/server/services/routing/server/applications/queue.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['seq-queue','ioredis','../../../../config/environment','../../../../config/logger','routing','redis','defaults','localhost','socket.io-emitter','account','queue','joinAt','emit','clone','queue_id','pick','format','%sQueuesWaitingInteractions','%s:queue:%s','%s_queue_waiting_interaction:%s','save','../../rpc/mailQueueReport','../../rpc/chatQueueReport','../../rpc/smsQueueReport','../../rpc/faxQueueReport','../../rpc/whatsappQueueReport','string','timeout\x20is\x20a\x20number','from','YYYY-MM-DD\x20HH:mm:ss','contact','list','upperFirst','channel','QueueId','InteractionId','interaction','MessageId','message','chat','WebsiteId','info','name','QueueReport','create','catch','error','waiting','accepted','body','[%s][END:QUEUE][NAME:%s]','update','update\x20queue\x20report','toLowerCase','length','[%s][QUEUE]\x20%s','join','stop','find','Queues','timeout','atimeout','end','[%s][QUEUE]\x20ROUTING\x20STOPPED','close','rules','[%s][QUEUE]\x20APPLICATION\x20END','strategy','rrmemory','beepall','[%s][QUEUE]\x20queue\x20not\x20found\x20%s','log','validate','lodash','util'];(function(_0x659f5f,_0x1800a0){var _0xcccfd7=function(_0x56b265){while(--_0x56b265){_0x659f5f['push'](_0x659f5f['shift']());}};_0xcccfd7(++_0x1800a0);}(_0x9957,0x93));var _0x7995=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x9957[_0x3947c9];return _0x2e7871;};'use strict';var schema=require(_0x7995('0x0'));var _=require(_0x7995('0x1'));var util=require(_0x7995('0x2'));var seqqueue=require(_0x7995('0x3'));var moment=require('moment');var Redis=require(_0x7995('0x4'));var config=require(_0x7995('0x5'));var logger=require(_0x7995('0x6'))(_0x7995('0x7'));var strategy=require('./strategy');config[_0x7995('0x8')]=_[_0x7995('0x9')](config[_0x7995('0x8')],{'host':_0x7995('0xa'),'port':0x18eb});var io=require(_0x7995('0xb'))(new Redis(config[_0x7995('0x8')]));var attributes=['id','queue_id',_0x7995('0xc'),_0x7995('0xd'),'from',_0x7995('0xe')];function emit(_0x3116fb,_0x18c8a3,_0x35b5fe){io['to'](_0x3116fb)[_0x7995('0xf')](_0x18c8a3,_0x35b5fe);}function emitChannelQueueInteraction(_0x1e400a,_0x341672,_0x524f7b,_0x245143,_0x41c652,_0x581f22,_0xb0c872,_0x2cb37a){var _0x19a27e=_[_0x7995('0x10')](_0x524f7b);_0x19a27e[_0x7995('0x11')]=_0x2cb37a;_0x19a27e[_0x7995('0xd')]=_0x341672;_0x19a27e[_0x7995('0xc')]=_0x245143;_0x19a27e['id']=_0x41c652;if(_0x581f22){_0xb0c872[util['format']('%sQueuesWaitingInteractions',_0x1e400a)][_0x41c652]=_[_0x7995('0x12')](_0x19a27e,attributes);}else{delete _0xb0c872[util[_0x7995('0x13')](_0x7995('0x14'),_0x1e400a)][_0x41c652];}emit(util[_0x7995('0x13')](_0x7995('0x15'),_0x1e400a,_0x341672),util[_0x7995('0x13')](_0x7995('0x16'),_0x1e400a,_0x581f22?_0x7995('0x17'):'remove'),_[_0x7995('0x12')](_0x19a27e,attributes));}var rpc={'openchannelQueueReport':require('../../rpc/openchannelQueueReport'),'mailQueueReport':require(_0x7995('0x18')),'chatQueueReport':require(_0x7995('0x19')),'smsQueueReport':require(_0x7995('0x1a')),'faxQueueReport':require(_0x7995('0x1b')),'whatsappQueueReport':require(_0x7995('0x1c'))};var queue=schema({'name':{'type':_0x7995('0x1d'),'required':!![],'message':'name\x20is\x20a\x20string\x20and\x20it\x20is\x20required'},'timeout':{'type':'number','message':_0x7995('0x1e')}});function startRouting(_0x5e6f90,_0x555f74,_0x3ec178,_0x3d463e){if(_0x5e6f90&&_0x555f74&&_0x3ec178){_0x555f74['waiting']+=0x1;var _0x3a9b54={'uniqueid':_0x5e6f90,'from':_0x3ec178['body']?_0x3ec178['body'][_0x7995('0x1f')]:'','joinAt':moment()[_0x7995('0x13')](_0x7995('0x20')),'ContactId':_0x3ec178[_0x7995('0x21')]?_0x3ec178[_0x7995('0x21')]['id']:null,'ListId':_0x3ec178[_0x7995('0x22')]?_0x3ec178['list']['id']:null};_0x3a9b54[_[_0x7995('0x23')](_0x3ec178[_0x7995('0x24')])+_0x7995('0x25')]=_0x555f74['id']||null;_0x3a9b54[_[_0x7995('0x23')](_0x3ec178[_0x7995('0x24')])+_0x7995('0x26')]=_0x3ec178[_0x7995('0x27')]?_0x3ec178[_0x7995('0x27')]['id']:null;_0x3a9b54[_['upperFirst'](_0x3ec178[_0x7995('0x24')])+_0x7995('0x28')]=_0x3ec178[_0x7995('0x29')]?_0x3ec178[_0x7995('0x29')]['id']:null;_0x3a9b54[_[_0x7995('0x23')](_0x3ec178[_0x7995('0x24')])+(_0x3ec178['channel']!==_0x7995('0x2a')?'AccountId':_0x7995('0x2b'))]=_0x3ec178[_0x7995('0xc')]?_0x3ec178[_0x7995('0xc')]['id']:null;logger[_0x7995('0x2c')](util[_0x7995('0x13')]('[%s][START:QUEUE][NAME:%s]',_0x5e6f90,_0x555f74[_0x7995('0x2d')]));emitChannelQueueInteraction(_0x3ec178['channel'],_0x555f74[_0x7995('0x2d')],_0x3a9b54,_0x3ec178[_0x7995('0xc')][_0x7995('0x2d')],_0x3ec178['message']['id'],!![],_0x3d463e,_0x555f74['id']);if(rpc[_0x3ec178['channel']+'QueueReport']){return rpc[_0x3ec178[_0x7995('0x24')]+_0x7995('0x2e')][_0x7995('0x2f')](_0x3a9b54)[_0x7995('0x30')](function(_0x2e3493){logger[_0x7995('0x31')]('create\x20queue\x20report');});}}}function stopRouting(_0x481c74,_0xfa8f15,_0x5524af,_0x553671){if(_0x481c74&&_0xfa8f15){_0xfa8f15[_0x7995('0x32')]-=0x1;var _0x29fac5={'leaveAt':moment()[_0x7995('0x13')](_0x7995('0x20')),'acceptAt':moment()['format'](_0x7995('0x20')),'reason':_0x7995('0x33')};logger['info'](util['format']('[%s][STOP:QUEUE][NAME:%s]',_0x481c74,_0xfa8f15[_0x7995('0x2d')]));emitChannelQueueInteraction(_0x5524af[_0x7995('0x24')],_0xfa8f15['name'],_0x5524af[_0x7995('0x34')],_0x5524af['account'][_0x7995('0x2d')],_0x5524af[_0x7995('0x29')]['id'],![],_0x553671,_0xfa8f15['id']);if(rpc[_0x5524af[_0x7995('0x24')]+'QueueReport']){return rpc[_0x5524af['channel']+_0x7995('0x2e')]['update'](_0x481c74,_0x29fac5)['catch'](function(_0x3e99cd){logger[_0x7995('0x31')]('update\x20queue\x20report');});}}}function endRouting(_0x1baa15,_0x1922b4,_0x2b772f,_0x18667c){if(_0x1baa15&&_0x1922b4){_0x1922b4[_0x7995('0x32')]-=0x1;var _0x53002a={'leaveAt':moment()[_0x7995('0x13')](_0x7995('0x20')),'exitAt':moment()[_0x7995('0x13')](_0x7995('0x20')),'reason':'timeout'};logger[_0x7995('0x2c')](util[_0x7995('0x13')](_0x7995('0x35'),_0x1baa15,_0x1922b4[_0x7995('0x2d')]));emitChannelQueueInteraction(_0x2b772f[_0x7995('0x24')],_0x1922b4[_0x7995('0x2d')],_0x2b772f['body'],_0x2b772f[_0x7995('0xc')][_0x7995('0x2d')],_0x2b772f[_0x7995('0x29')]['id'],![],_0x18667c);if(rpc[_0x2b772f[_0x7995('0x24')]+_0x7995('0x2e')]){return rpc[_0x2b772f[_0x7995('0x24')]+_0x7995('0x2e')][_0x7995('0x36')](_0x1baa15,_0x53002a)[_0x7995('0x30')](function(_0x447981){logger[_0x7995('0x31')](_0x7995('0x37'));});}}}function handleFindQueue(_0x7b4e67){return function(_0x53cda2){return _0x53cda2['name'][_0x7995('0x38')]()===_0x7b4e67[_0x7995('0x38')]();};}exports['consequence']=function(_0x4b0855,_0x3f8522,_0x4a9fef,_0x504a33){return function(_0x23da6b){try{var _0x36e28b={'name':_0x3f8522[0x0],'timeout':_0x3f8522[0x1]};var _0x35c8ff=queue['validate'](_0x36e28b,{'typecast':!![]});if(_0x35c8ff[_0x7995('0x39')]){logger['error'](_0x7995('0x3a'),_0x4b0855,_['map'](_0x35c8ff,'message')[_0x7995('0x3b')](',\x20'));_0x23da6b[_0x7995('0x3c')]();}else{var _0xc04e5=_[_0x7995('0x3d')](_0x4a9fef[_0x504a33['channel']+_0x7995('0x3e')],handleFindQueue(_0x36e28b[_0x7995('0x2d')]));if(_0xc04e5){startRouting(_0x4b0855,_0xc04e5,_0x504a33,_0x4a9fef);var _0x31b347=(_0xc04e5[_0x7995('0x3f')]||0xa)*0x3e8;var _0x4e09b7=(_0x36e28b['timeout']||0x14)*0x3e8;var _0x1c37c6,_0x55791b;if(_0x31b347>_0x4e09b7){_0x4e09b7=_0x31b347;}var _0x23c41d=seqqueue['createQueue'](_0x31b347);_0x23c41d['id']=_0x4b0855;_0x23c41d[_0x7995('0x40')]=_0x31b347;_0x23c41d['qtimeout']=_0x4e09b7;_0x23c41d[_0x7995('0x24')]=_0x504a33[_0x7995('0x24')];_0x4a9fef['rules'][_0x4b0855]['on'](_0x7995('0x41'),function(){logger[_0x7995('0x2c')](_0x7995('0x42'),_0x4b0855);stopRouting(_0x4b0855,_0xc04e5,_0x504a33,_0x4a9fef);clearTimeout(_0x1c37c6);_0x1c37c6=undefined;_0x23c41d[_0x7995('0x43')](!![]);if(_0x4a9fef['rules'][_0x4b0855]){delete _0x4a9fef[_0x7995('0x44')][_0x4b0855];}_0x23da6b[_0x7995('0x3c')]();});_0x4a9fef[_0x7995('0x44')][_0x4b0855]['on']('complete',function(){if(_0x4a9fef[_0x7995('0x44')][_0x4b0855]){delete _0x4a9fef[_0x7995('0x44')][_0x4b0855];}});_0x1c37c6=setTimeout(function(){logger[_0x7995('0x2c')](_0x7995('0x45'),_0x4b0855);endRouting(_0x4b0855,_0xc04e5,_0x504a33,_0x4a9fef);clearTimeout(_0x1c37c6);_0x23c41d[_0x7995('0x43')](!![]);_0x23da6b['next']();},_0x4e09b7);switch(_0xc04e5[_0x7995('0x46')]){case _0x7995('0x47'):strategy['rrmemory'](_0x23c41d,_0xc04e5,_0x4a9fef,_0x504a33);break;default:strategy[_0x7995('0x48')](_0x23c41d,_0xc04e5,_0x4a9fef,_0x504a33);}}else{logger['error'](_0x7995('0x49'),_0x4b0855,_0x36e28b[_0x7995('0x2d')]);_0x23da6b[_0x7995('0x3c')]();}}}catch(_0x30e220){console[_0x7995('0x4a')](_0x30e220);logger[_0x7995('0x31')](_0x7995('0x3a'),_0x4b0855,_0x30e220['stack']);_0x23da6b[_0x7995('0x3c')]();}};}; \ No newline at end of file +var _0x34e8=['../../rpc/faxQueueReport','../../rpc/whatsappQueueReport','string','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','timeout\x20is\x20a\x20number','waiting','body','YYYY-MM-DD\x20HH:mm:ss','contact','list','upperFirst','QueueId','InteractionId','interaction','channel','MessageId','chat','AccountId','WebsiteId','name','message','QueueReport','create','catch','error','accepted','info','[%s][STOP:QUEUE][NAME:%s]','update','timeout','[%s][END:QUEUE][NAME:%s]','toLowerCase','consequence','length','map','join','Queues','createQueue','atimeout','qtimeout','rules','[%s][QUEUE]\x20ROUTING\x20STOPPED','close','stop','[%s][QUEUE]\x20APPLICATION\x20END','next','strategy','rrmemory','beepall','[%s][QUEUE]\x20queue\x20not\x20found\x20%s','log','[%s][QUEUE]\x20%s','stack','validate','lodash','util','seq-queue','ioredis','../../../../config/environment','../../../../config/logger','routing','./strategy','redis','defaults','localhost','queue_id','account','queue','from','joinAt','emit','clone','format','%sQueuesWaitingInteractions','%s:queue:%s','%s_queue_waiting_interaction:%s','save','pick','../../rpc/openchannelQueueReport','../../rpc/mailQueueReport','../../rpc/smsQueueReport'];(function(_0x3c433f,_0xf49700){var _0x573591=function(_0x56c6e8){while(--_0x56c6e8){_0x3c433f['push'](_0x3c433f['shift']());}};_0x573591(++_0xf49700);}(_0x34e8,0x12c));var _0x834e=function(_0x3c0049,_0x172b98){_0x3c0049=_0x3c0049-0x0;var _0x4f5849=_0x34e8[_0x3c0049];return _0x4f5849;};'use strict';var schema=require(_0x834e('0x0'));var _=require(_0x834e('0x1'));var util=require(_0x834e('0x2'));var seqqueue=require(_0x834e('0x3'));var moment=require('moment');var Redis=require(_0x834e('0x4'));var config=require(_0x834e('0x5'));var logger=require(_0x834e('0x6'))(_0x834e('0x7'));var strategy=require(_0x834e('0x8'));config[_0x834e('0x9')]=_[_0x834e('0xa')](config['redis'],{'host':_0x834e('0xb'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x834e('0x9')]));var attributes=['id',_0x834e('0xc'),_0x834e('0xd'),_0x834e('0xe'),_0x834e('0xf'),_0x834e('0x10')];function emit(_0x363786,_0x1af45a,_0x3bdda9){io['to'](_0x363786)[_0x834e('0x11')](_0x1af45a,_0x3bdda9);}function emitChannelQueueInteraction(_0x1e41fe,_0x36e124,_0x14038b,_0x2e1a37,_0x293514,_0x1e00de,_0x2fd95c,_0x538bb3){var _0x5e5b6d=_[_0x834e('0x12')](_0x14038b);_0x5e5b6d['queue_id']=_0x538bb3;_0x5e5b6d[_0x834e('0xe')]=_0x36e124;_0x5e5b6d[_0x834e('0xd')]=_0x2e1a37;_0x5e5b6d['id']=_0x293514;if(_0x1e00de){_0x2fd95c[util[_0x834e('0x13')](_0x834e('0x14'),_0x1e41fe)][_0x293514]=_['pick'](_0x5e5b6d,attributes);}else{delete _0x2fd95c[util[_0x834e('0x13')](_0x834e('0x14'),_0x1e41fe)][_0x293514];}emit(util['format'](_0x834e('0x15'),_0x1e41fe,_0x36e124),util['format'](_0x834e('0x16'),_0x1e41fe,_0x1e00de?_0x834e('0x17'):'remove'),_[_0x834e('0x18')](_0x5e5b6d,attributes));}var rpc={'openchannelQueueReport':require(_0x834e('0x19')),'mailQueueReport':require(_0x834e('0x1a')),'chatQueueReport':require('../../rpc/chatQueueReport'),'smsQueueReport':require(_0x834e('0x1b')),'faxQueueReport':require(_0x834e('0x1c')),'whatsappQueueReport':require(_0x834e('0x1d'))};var queue=schema({'name':{'type':_0x834e('0x1e'),'required':!![],'message':_0x834e('0x1f')},'timeout':{'type':_0x834e('0x20'),'message':_0x834e('0x21')}});function startRouting(_0x595515,_0x2545b4,_0x1fd2c6,_0x113ff4){if(_0x595515&&_0x2545b4&&_0x1fd2c6){_0x2545b4[_0x834e('0x22')]+=0x1;var _0x4ab05d={'uniqueid':_0x595515,'from':_0x1fd2c6[_0x834e('0x23')]?_0x1fd2c6[_0x834e('0x23')]['from']:'','joinAt':moment()[_0x834e('0x13')](_0x834e('0x24')),'ContactId':_0x1fd2c6[_0x834e('0x25')]?_0x1fd2c6['contact']['id']:null,'ListId':_0x1fd2c6['list']?_0x1fd2c6[_0x834e('0x26')]['id']:null};_0x4ab05d[_[_0x834e('0x27')](_0x1fd2c6['channel'])+_0x834e('0x28')]=_0x2545b4['id']||null;_0x4ab05d[_[_0x834e('0x27')](_0x1fd2c6['channel'])+_0x834e('0x29')]=_0x1fd2c6[_0x834e('0x2a')]?_0x1fd2c6[_0x834e('0x2a')]['id']:null;_0x4ab05d[_['upperFirst'](_0x1fd2c6[_0x834e('0x2b')])+_0x834e('0x2c')]=_0x1fd2c6['message']?_0x1fd2c6['message']['id']:null;_0x4ab05d[_[_0x834e('0x27')](_0x1fd2c6['channel'])+(_0x1fd2c6[_0x834e('0x2b')]!==_0x834e('0x2d')?_0x834e('0x2e'):_0x834e('0x2f'))]=_0x1fd2c6[_0x834e('0xd')]?_0x1fd2c6[_0x834e('0xd')]['id']:null;logger['info'](util['format']('[%s][START:QUEUE][NAME:%s]',_0x595515,_0x2545b4['name']));emitChannelQueueInteraction(_0x1fd2c6[_0x834e('0x2b')],_0x2545b4[_0x834e('0x30')],_0x4ab05d,_0x1fd2c6[_0x834e('0xd')]['name'],_0x1fd2c6[_0x834e('0x31')]['id'],!![],_0x113ff4,_0x2545b4['id']);if(rpc[_0x1fd2c6[_0x834e('0x2b')]+_0x834e('0x32')]){return rpc[_0x1fd2c6[_0x834e('0x2b')]+_0x834e('0x32')][_0x834e('0x33')](_0x4ab05d)[_0x834e('0x34')](function(_0xfaf716){logger[_0x834e('0x35')]('create\x20queue\x20report');});}}}function stopRouting(_0xef9ec2,_0x5cad11,_0x2c75c2,_0x3787b0){if(_0xef9ec2&&_0x5cad11){_0x5cad11[_0x834e('0x22')]-=0x1;var _0x2b3418={'leaveAt':moment()[_0x834e('0x13')](_0x834e('0x24')),'acceptAt':moment()[_0x834e('0x13')](_0x834e('0x24')),'reason':_0x834e('0x36')};logger[_0x834e('0x37')](util['format'](_0x834e('0x38'),_0xef9ec2,_0x5cad11[_0x834e('0x30')]));emitChannelQueueInteraction(_0x2c75c2[_0x834e('0x2b')],_0x5cad11[_0x834e('0x30')],_0x2c75c2['body'],_0x2c75c2[_0x834e('0xd')][_0x834e('0x30')],_0x2c75c2['message']['id'],![],_0x3787b0,_0x5cad11['id']);if(rpc[_0x2c75c2['channel']+'QueueReport']){return rpc[_0x2c75c2[_0x834e('0x2b')]+_0x834e('0x32')][_0x834e('0x39')](_0xef9ec2,_0x2b3418)[_0x834e('0x34')](function(_0x339e28){logger[_0x834e('0x35')]('update\x20queue\x20report');});}}}function endRouting(_0x2c2d94,_0x513f36,_0xe103fe,_0x6a3ac){if(_0x2c2d94&&_0x513f36){_0x513f36['waiting']-=0x1;var _0x18ac3b={'leaveAt':moment()[_0x834e('0x13')]('YYYY-MM-DD\x20HH:mm:ss'),'exitAt':moment()['format'](_0x834e('0x24')),'reason':_0x834e('0x3a')};logger[_0x834e('0x37')](util[_0x834e('0x13')](_0x834e('0x3b'),_0x2c2d94,_0x513f36['name']));emitChannelQueueInteraction(_0xe103fe[_0x834e('0x2b')],_0x513f36['name'],_0xe103fe['body'],_0xe103fe[_0x834e('0xd')]['name'],_0xe103fe[_0x834e('0x31')]['id'],![],_0x6a3ac);if(rpc[_0xe103fe[_0x834e('0x2b')]+_0x834e('0x32')]){return rpc[_0xe103fe[_0x834e('0x2b')]+_0x834e('0x32')]['update'](_0x2c2d94,_0x18ac3b)[_0x834e('0x34')](function(_0x26b847){logger[_0x834e('0x35')]('update\x20queue\x20report');});}}}function handleFindQueue(_0x35380e){return function(_0x16ac45){return _0x16ac45['name'][_0x834e('0x3c')]()===_0x35380e['toLowerCase']();};}exports[_0x834e('0x3d')]=function(_0x585335,_0x4a18bb,_0x4a6942,_0x22ea21){return function(_0x16969b){try{var _0x3bcbf4={'name':_0x4a18bb[0x0],'timeout':_0x4a18bb[0x1]};var _0xbc1571=queue[_0x834e('0x0')](_0x3bcbf4,{'typecast':!![]});if(_0xbc1571[_0x834e('0x3e')]){logger[_0x834e('0x35')]('[%s][QUEUE]\x20%s',_0x585335,_[_0x834e('0x3f')](_0xbc1571,'message')[_0x834e('0x40')](',\x20'));_0x16969b['stop']();}else{var _0x1df5b0=_['find'](_0x4a6942[_0x22ea21[_0x834e('0x2b')]+_0x834e('0x41')],handleFindQueue(_0x3bcbf4['name']));if(_0x1df5b0){startRouting(_0x585335,_0x1df5b0,_0x22ea21,_0x4a6942);var _0x39e7b9=(_0x1df5b0[_0x834e('0x3a')]||0xa)*0x3e8;var _0xa880cb=(_0x3bcbf4[_0x834e('0x3a')]||0x14)*0x3e8;var _0x252ea0,_0x1a7149;if(_0x39e7b9>_0xa880cb){_0xa880cb=_0x39e7b9;}var _0xfa28da=seqqueue[_0x834e('0x42')](_0x39e7b9);_0xfa28da['id']=_0x585335;_0xfa28da[_0x834e('0x43')]=_0x39e7b9;_0xfa28da[_0x834e('0x44')]=_0xa880cb;_0xfa28da['channel']=_0x22ea21[_0x834e('0x2b')];_0x4a6942[_0x834e('0x45')][_0x585335]['on']('end',function(){logger[_0x834e('0x37')](_0x834e('0x46'),_0x585335);stopRouting(_0x585335,_0x1df5b0,_0x22ea21,_0x4a6942);clearTimeout(_0x252ea0);_0x252ea0=undefined;_0xfa28da[_0x834e('0x47')](!![]);if(_0x4a6942[_0x834e('0x45')][_0x585335]){delete _0x4a6942[_0x834e('0x45')][_0x585335];}_0x16969b[_0x834e('0x48')]();});_0x4a6942['rules'][_0x585335]['on']('complete',function(){if(_0x4a6942[_0x834e('0x45')][_0x585335]){delete _0x4a6942[_0x834e('0x45')][_0x585335];}});_0x252ea0=setTimeout(function(){logger[_0x834e('0x37')](_0x834e('0x49'),_0x585335);endRouting(_0x585335,_0x1df5b0,_0x22ea21,_0x4a6942);clearTimeout(_0x252ea0);_0xfa28da[_0x834e('0x47')](!![]);_0x16969b[_0x834e('0x4a')]();},_0xa880cb);switch(_0x1df5b0[_0x834e('0x4b')]){case _0x834e('0x4c'):strategy[_0x834e('0x4c')](_0xfa28da,_0x1df5b0,_0x4a6942,_0x22ea21);break;default:strategy[_0x834e('0x4d')](_0xfa28da,_0x1df5b0,_0x4a6942,_0x22ea21);}}else{logger[_0x834e('0x35')](_0x834e('0x4e'),_0x585335,_0x3bcbf4[_0x834e('0x30')]);_0x16969b[_0x834e('0x48')]();}}}catch(_0x2aa072){console[_0x834e('0x4f')](_0x2aa072);logger[_0x834e('0x35')](_0x834e('0x50'),_0x585335,_0x2aa072[_0x834e('0x51')]);_0x16969b[_0x834e('0x48')]();}};}; \ 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 89d959f..1054c72 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 _0x6008=['handleDrained','info','[%s][AGENT]\x20try\x20with\x20%s','isNil','realtime','agents','isAgentAvailable','channel','busy','busyQueue','showNotification','writeLog','RINGING','forcedOwnership',':FORCED','[%s][AGENT]\x20agent\x20%s\x20is\x20not\x20available','[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s','[%s][AGENT]\x20timeout\x20with\x20%s','hideNotification','STOP','TIMEOUT','exports','lodash','./util','../../../../../config/logger','routing','notificationId','squeue','agent','push','handleRun','bind','handleTimeout','drained','prototype'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0x6008,0x10b));var _0x8600=function(_0x4c9b7a,_0x2267cf){_0x4c9b7a=_0x4c9b7a-0x0;var _0x529f7b=_0x6008[_0x4c9b7a];return _0x529f7b;};'use strict';var _=require(_0x8600('0x0'));var uuid=require('uuid');var util=require(_0x8600('0x1'));var logger=require(_0x8600('0x2'))(_0x8600('0x3'));var Agent=function(_0x2ab83d,_0x38d794,_0x34c063,_0x468182){this[_0x8600('0x4')]=uuid['v4']();this[_0x8600('0x5')]=_0x2ab83d;this[_0x8600('0x6')]=_0x38d794;this['realtime']=_0x34c063;this['routing']=_0x468182;this[_0x8600('0x5')][_0x8600('0x7')](this[_0x8600('0x8')][_0x8600('0x9')](this),this[_0x8600('0xa')][_0x8600('0x9')](this));this[_0x8600('0x5')]['on']('timeout',this['handleTimeout'][_0x8600('0x9')](this));this['squeue']['on'](_0x8600('0xb'),this['handleDrained']['bind'](this));};Agent[_0x8600('0xc')][_0x8600('0x7')]=function(){this[_0x8600('0x5')][_0x8600('0x7')](this['handleRun'][_0x8600('0x9')](this),this['handleTimeout'][_0x8600('0x9')](this));};Agent[_0x8600('0xc')][_0x8600('0xd')]=function(){this[_0x8600('0xa')](!![]);};Agent[_0x8600('0xc')][_0x8600('0x8')]=function(_0x4b99dd){logger[_0x8600('0xe')](_0x8600('0xf'),this['squeue']['id'],this[_0x8600('0x6')]['id']);if(_[_0x8600('0x10')](this[_0x8600('0x11')][_0x8600('0x12')][this[_0x8600('0x6')]['id']])){logger[_0x8600('0xe')]('[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s',this[_0x8600('0x5')]['id'],this[_0x8600('0x6')]['id']);setTimeout(this[_0x8600('0x7')][_0x8600('0x9')](this),0x3e8);}else{if(this['routing']['forcedOwnership']||util[_0x8600('0x13')](this[_0x8600('0x5')]['id'],this[_0x8600('0x11')][_0x8600('0x12')][this[_0x8600('0x6')]['id']],this[_0x8600('0x5')][_0x8600('0x14')],![])){this[_0x8600('0x11')]['agents'][this[_0x8600('0x6')]['id']][_0x8600('0x15')]=!![];this[_0x8600('0x11')][_0x8600('0x12')][this[_0x8600('0x6')]['id']][_0x8600('0x16')]=undefined;util[_0x8600('0x17')](this['notificationId'],this[_0x8600('0x5')]['id'],this['realtime'][_0x8600('0x12')][this[_0x8600('0x6')]['id']],null,this[_0x8600('0x3')]);util[_0x8600('0x18')](this['squeue']['id'],this[_0x8600('0x11')]['agents'][this[_0x8600('0x6')]['id']],_0x8600('0x19')+(this[_0x8600('0x3')][_0x8600('0x1a')]?_0x8600('0x1b'):''));}else{logger[_0x8600('0xe')](_0x8600('0x1c'),this[_0x8600('0x5')]['id'],this[_0x8600('0x6')]['id']);setTimeout(this[_0x8600('0x7')]['bind'](this),0x3e8);}}};Agent[_0x8600('0xc')][_0x8600('0xa')]=function(_0x33851c){if(_[_0x8600('0x10')](this[_0x8600('0x11')][_0x8600('0x12')][this[_0x8600('0x6')]['id']])){return logger[_0x8600('0xe')](_0x8600('0x1d'),this[_0x8600('0x5')]['id'],this['agent']['id']);}else{logger[_0x8600('0xe')](_0x8600('0x1e'),this[_0x8600('0x5')]['id'],this[_0x8600('0x6')]['id']);util[_0x8600('0x1f')](this[_0x8600('0x4')],this[_0x8600('0x5')]['id'],this[_0x8600('0x11')][_0x8600('0x12')][this[_0x8600('0x6')]['id']],null,this[_0x8600('0x3')]);this[_0x8600('0x11')]['agents'][this[_0x8600('0x6')]['id']][_0x8600('0x15')]=![];this[_0x8600('0x11')][_0x8600('0x12')][this[_0x8600('0x6')]['id']][_0x8600('0x16')]=undefined;util['writeLog'](this[_0x8600('0x5')]['id'],this[_0x8600('0x11')][_0x8600('0x12')][this[_0x8600('0x6')]['id']],_0x33851c?_0x8600('0x20'):_0x8600('0x21'));}if(!_0x33851c){setTimeout(this[_0x8600('0x7')][_0x8600('0x9')](this),0x3e8);}};function agent(_0xe80a39,_0x375c5c,_0x5178c2,_0x229485){return new Agent(_0xe80a39,_0x375c5c,_0x5178c2,_0x229485);}module[_0x8600('0x22')]=agent; \ No newline at end of file +var _0xf825=['hideNotification','TIMEOUT','exports','lodash','uuid','routing','squeue','agent','realtime','handleRun','bind','handleTimeout','timeout','drained','handleDrained','push','prototype','info','isNil','agents','[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s','isAgentAvailable','channel','busy','busyQueue','showNotification','notificationId','RINGING','forcedOwnership',':FORCED','[%s][AGENT]\x20agent\x20%s\x20is\x20not\x20available','[%s][AGENT]\x20timeout\x20with\x20%s'];(function(_0xdac678,_0x5d1714){var _0x92c2fe=function(_0x1108c5){while(--_0x1108c5){_0xdac678['push'](_0xdac678['shift']());}};_0x92c2fe(++_0x5d1714);}(_0xf825,0xc3));var _0x5f82=function(_0x151200,_0x5b50a1){_0x151200=_0x151200-0x0;var _0x2041c2=_0xf825[_0x151200];return _0x2041c2;};'use strict';var _=require(_0x5f82('0x0'));var uuid=require(_0x5f82('0x1'));var util=require('./util');var logger=require('../../../../../config/logger')(_0x5f82('0x2'));var Agent=function(_0x22339a,_0x1b28bf,_0x57d917,_0x368f98){this['notificationId']=uuid['v4']();this[_0x5f82('0x3')]=_0x22339a;this[_0x5f82('0x4')]=_0x1b28bf;this[_0x5f82('0x5')]=_0x57d917;this[_0x5f82('0x2')]=_0x368f98;this[_0x5f82('0x3')]['push'](this[_0x5f82('0x6')][_0x5f82('0x7')](this),this[_0x5f82('0x8')][_0x5f82('0x7')](this));this[_0x5f82('0x3')]['on'](_0x5f82('0x9'),this['handleTimeout'][_0x5f82('0x7')](this));this['squeue']['on'](_0x5f82('0xa'),this[_0x5f82('0xb')][_0x5f82('0x7')](this));};Agent['prototype'][_0x5f82('0xc')]=function(){this['squeue'][_0x5f82('0xc')](this[_0x5f82('0x6')][_0x5f82('0x7')](this),this[_0x5f82('0x8')][_0x5f82('0x7')](this));};Agent[_0x5f82('0xd')][_0x5f82('0xb')]=function(){this[_0x5f82('0x8')](!![]);};Agent[_0x5f82('0xd')][_0x5f82('0x6')]=function(_0x531e6b){logger[_0x5f82('0xe')]('[%s][AGENT]\x20try\x20with\x20%s',this['squeue']['id'],this[_0x5f82('0x4')]['id']);if(_[_0x5f82('0xf')](this[_0x5f82('0x5')][_0x5f82('0x10')][this[_0x5f82('0x4')]['id']])){logger[_0x5f82('0xe')](_0x5f82('0x11'),this[_0x5f82('0x3')]['id'],this[_0x5f82('0x4')]['id']);setTimeout(this[_0x5f82('0xc')][_0x5f82('0x7')](this),0x3e8);}else{if(this[_0x5f82('0x2')]['forcedOwnership']||util[_0x5f82('0x12')](this[_0x5f82('0x3')]['id'],this[_0x5f82('0x5')][_0x5f82('0x10')][this['agent']['id']],this['squeue'][_0x5f82('0x13')],![])){this[_0x5f82('0x5')]['agents'][this[_0x5f82('0x4')]['id']][_0x5f82('0x14')]=!![];this[_0x5f82('0x5')][_0x5f82('0x10')][this['agent']['id']][_0x5f82('0x15')]=undefined;util[_0x5f82('0x16')](this[_0x5f82('0x17')],this[_0x5f82('0x3')]['id'],this[_0x5f82('0x5')]['agents'][this[_0x5f82('0x4')]['id']],null,this['routing']);util['writeLog'](this[_0x5f82('0x3')]['id'],this['realtime'][_0x5f82('0x10')][this[_0x5f82('0x4')]['id']],_0x5f82('0x18')+(this['routing'][_0x5f82('0x19')]?_0x5f82('0x1a'):''));}else{logger['info'](_0x5f82('0x1b'),this['squeue']['id'],this[_0x5f82('0x4')]['id']);setTimeout(this['push'][_0x5f82('0x7')](this),0x3e8);}}};Agent[_0x5f82('0xd')]['handleTimeout']=function(_0x4ca0cc){if(_[_0x5f82('0xf')](this['realtime'][_0x5f82('0x10')][this[_0x5f82('0x4')]['id']])){return logger[_0x5f82('0xe')](_0x5f82('0x11'),this[_0x5f82('0x3')]['id'],this[_0x5f82('0x4')]['id']);}else{logger['info'](_0x5f82('0x1c'),this[_0x5f82('0x3')]['id'],this[_0x5f82('0x4')]['id']);util[_0x5f82('0x1d')](this[_0x5f82('0x17')],this[_0x5f82('0x3')]['id'],this['realtime']['agents'][this['agent']['id']],null,this[_0x5f82('0x2')]);this[_0x5f82('0x5')][_0x5f82('0x10')][this[_0x5f82('0x4')]['id']][_0x5f82('0x14')]=![];this['realtime'][_0x5f82('0x10')][this['agent']['id']][_0x5f82('0x15')]=undefined;util['writeLog'](this[_0x5f82('0x3')]['id'],this[_0x5f82('0x5')][_0x5f82('0x10')][this[_0x5f82('0x4')]['id']],_0x4ca0cc?'STOP':_0x5f82('0x1e'));}if(!_0x4ca0cc){setTimeout(this['push'][_0x5f82('0x7')](this),0x3e8);}};function agent(_0x320209,_0x57037e,_0x3f43e5,_0x4278c5){return new Agent(_0x320209,_0x57037e,_0x3f43e5,_0x4278c5);}module[_0x5f82('0x1f')]=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 0909438..6562c54 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 _0xac99=['../../../../../config/logger','notificationId','squeue','realtime','routing','push','handleRun','bind','timeout','handleTimeout','drained','prototype','queue','isNil','Agents','length','info','[%s][QUEUE]\x20agent\x20skipped,\x20unknown\x20id\x20%s','agents','channel','writeLog','busy','busyQueue','showNotification','[%s][QUEUE]\x20ALL\x20AGENTS\x20ARE\x20BUSY','[%s][QUEUE]\x20EMPTY','hideNotification','STOP','TIMEOUT','exports','lodash','./util'];(function(_0x4d032b,_0x5e2f49){var _0x4b41ae=function(_0x16a900){while(--_0x16a900){_0x4d032b['push'](_0x4d032b['shift']());}};_0x4b41ae(++_0x5e2f49);}(_0xac99,0x1de));var _0x9ac9=function(_0x3e8bf8,_0x4e76d6){_0x3e8bf8=_0x3e8bf8-0x0;var _0x3391ce=_0xac99[_0x3e8bf8];return _0x3391ce;};'use strict';var _=require(_0x9ac9('0x0'));var uuid=require('uuid');var util=require(_0x9ac9('0x1'));var logger=require(_0x9ac9('0x2'))('routing');var Beepall=function(_0x34e2bf,_0xe05eed,_0x5324be,_0x26a48b){this[_0x9ac9('0x3')]=uuid['v4']();this[_0x9ac9('0x4')]=_0x34e2bf;this['queue']=_0xe05eed;this[_0x9ac9('0x5')]=_0x5324be;this[_0x9ac9('0x6')]=_0x26a48b;this[_0x9ac9('0x4')][_0x9ac9('0x7')](this[_0x9ac9('0x8')][_0x9ac9('0x9')](this),this['handleTimeout'][_0x9ac9('0x9')](this));this[_0x9ac9('0x4')]['on'](_0x9ac9('0xa'),this[_0x9ac9('0xb')][_0x9ac9('0x9')](this));this[_0x9ac9('0x4')]['on'](_0x9ac9('0xc'),this['handleDrained'][_0x9ac9('0x9')](this));};Beepall['prototype'][_0x9ac9('0x7')]=function(){this[_0x9ac9('0x4')][_0x9ac9('0x7')](this[_0x9ac9('0x8')][_0x9ac9('0x9')](this),this[_0x9ac9('0xb')][_0x9ac9('0x9')](this));};Beepall['prototype']['handleDrained']=function(_0x8efa0){this[_0x9ac9('0xb')](!![]);};Beepall[_0x9ac9('0xd')][_0x9ac9('0x8')]=function(_0x383f59){var _0x10a406=!![];if(!_['isNil'](this[_0x9ac9('0xe')])&&!_[_0x9ac9('0xf')](this['queue'][_0x9ac9('0x10')])&&this[_0x9ac9('0xe')]['Agents'][_0x9ac9('0x11')]>0x0){for(var _0x23ec81=0x0,_0x297621;_0x23ec810x0){for(var _0x148d8a=0x0,_0x21c4c5;_0x148d8a0x0&&_0x1ac33e[_0x1840e0+'CurrentCapacity']>=_0x1ac33e[_0x1840e0+'Capacity']){writeLog(_0x563d15,_0x1ac33e,_0x1840e0[_0x0f29('0x20')]()+'\x20MAXCAPACITY');return![];}}return!![];};exports['showNotification']=function(_0x57dcc7,_0x4dd0b0,_0x3c6ce9,_0x1f4ad2,_0x4cc5a0){return sendNotification(!![],_0x57dcc7,_0x4dd0b0,_0x3c6ce9,_0x1f4ad2,_0x4cc5a0);};exports[_0x0f29('0x21')]=function(_0x2ab528,_0x274c9d,_0x51e7dc,_0x56e729,_0x37ebcc){return sendNotification(![],_0x2ab528,_0x274c9d,_0x51e7dc,_0x56e729,_0x37ebcc);};exports['writeLog']=writeLog; \ No newline at end of file +var _0x61a5=['routing','redis','defaults','localhost','socket.io-emitter','emit','format','user:%s','name','split','\x20interaction','account','notificationSound','notificationShake','body','queue','msg','getMustacheRender','notificationTemplate','[%s][QUEUE]\x20%s','message','notification:%s','save','remove','[%s][QUEUE][AGENT:%s][STATUS:%s]','BUSY','Pause','PAUSE','CurrentCapacity','Capacity','\x20MAXCAPACITY','showNotification','hideNotification','writeLog','lodash','../utils','mustache','../../../../../config/environment'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x61a5,0x19e));var _0x561a=function(_0x20a68a,_0x54502e){_0x20a68a=_0x20a68a-0x0;var _0x56c5d4=_0x61a5[_0x20a68a];return _0x56c5d4;};'use strict';var _=require(_0x561a('0x0'));var util=require('util');var utils=require(_0x561a('0x1'));var Mustache=require(_0x561a('0x2'));var Redis=require('ioredis');var config=require(_0x561a('0x3'));var logger=require('../../../../../config/logger')(_0x561a('0x4'));config[_0x561a('0x5')]=_[_0x561a('0x6')](config[_0x561a('0x5')],{'host':_0x561a('0x7'),'port':0x18eb});var io=require(_0x561a('0x8'))(new Redis(config[_0x561a('0x5')]));function emit(_0x2a763a,_0x4c2853,_0x3d020c){io['to'](_0x2a763a)[_0x561a('0x9')](_0x4c2853,_0x3d020c);}function sendNotification(_0xe056b2,_0x5cd4f6,_0x95e2a0,_0x2a0fdb,_0x5a4e9b,_0x44b705){io['to'](util[_0x561a('0xa')](_0x561a('0xb'),_0x2a0fdb[_0x561a('0xc')]))['emit']('user:save',_0x2a0fdb);var _0x20c1f8=_0x44b705||{};var _0x448f83=_0x95e2a0[_0x561a('0xd')]('.');var _0x2ea318={'uniqueid':_0x5cd4f6,'channel':_0x448f83[0x0],'id':_0x448f83[0x1],'title':_0x448f83[0x0]+_0x561a('0xe'),'interactionId':_0x448f83[0x2],'queue':_0x5a4e9b?_0x5a4e9b[_0x561a('0xc')]:null,'sound':_0x20c1f8[_0x561a('0xf')][_0x561a('0x10')],'shake':_0x20c1f8['account'][_0x561a('0x11')]};try{if(!_0x20c1f8[_0x561a('0x12')]){_0x20c1f8[_0x561a('0x12')]={};}if(_0x5a4e9b){_0x20c1f8[_0x561a('0x12')]['queue']=_0x5a4e9b;}else if(_0x20c1f8[_0x561a('0x12')]['queue']){delete _0x20c1f8[_0x561a('0x12')][_0x561a('0x13')];}_0x2ea318[_0x561a('0x14')]=utils[_0x561a('0x15')](_0x20c1f8[_0x561a('0xf')][_0x561a('0x16')],_0x20c1f8);}catch(_0x495ded){_0x2ea318['msg']='I\x20can\x27t\x20render\x20your\x20template';logger['error'](util[_0x561a('0xa')](_0x561a('0x17'),_0x5cd4f6,_0x495ded[_0x561a('0x18')]));}io['to'](util['format']('user:%s',_0x2a0fdb['name']))[_0x561a('0x9')](util[_0x561a('0xa')](_0x561a('0x19'),_0xe056b2?_0x561a('0x1a'):_0x561a('0x1b')),_0x2ea318);}function writeLog(_0x5529d9,_0x1d8784,_0x374469){return logger['info'](util[_0x561a('0xa')](_0x561a('0x1c'),_0x5529d9,_0x1d8784['name'],_0x374469));}exports['isAgentAvailable']=function(_0xb88610,_0x544b7a,_0x593515,_0x562329){if(_0x544b7a['busy']){writeLog(_0xb88610,_0x544b7a,_0x561a('0x1d'));return![];}if(!_0x544b7a['online']){writeLog(_0xb88610,_0x544b7a,'OFFLINE');return![];}if(_0x544b7a[_0x593515+_0x561a('0x1e')]){writeLog(_0xb88610,_0x544b7a,_0x561a('0x1f'));return![];}if(_0x562329&&_0x544b7a['hasOwnProperty'](_0x593515+'Capacity')&&_0x544b7a['hasOwnProperty'](_0x593515+_0x561a('0x20'))){if(_0x544b7a[_0x593515+_0x561a('0x21')]>0x0&&_0x544b7a[_0x593515+'CurrentCapacity']>=_0x544b7a[_0x593515+_0x561a('0x21')]){writeLog(_0xb88610,_0x544b7a,_0x593515['toUpperCase']()+_0x561a('0x22'));return![];}}return!![];};exports[_0x561a('0x23')]=function(_0x19f5e5,_0x1eea93,_0x1b1e61,_0x3de0f6,_0x261efd){return sendNotification(!![],_0x19f5e5,_0x1eea93,_0x1b1e61,_0x3de0f6,_0x261efd);};exports[_0x561a('0x24')]=function(_0x44fd4d,_0x2293bf,_0x1e9c37,_0x1d8948,_0x4d3b16){return sendNotification(![],_0x44fd4d,_0x2293bf,_0x1e9c37,_0x1d8948,_0x4d3b16);};exports[_0x561a('0x25')]=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 e2212ce..3f63dc8 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 _0x7dbd=['info','[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next','getMustacheRender','[%s][SYSTEM]\x20commnad:\x20%s','exec','trim','replace','isEmpty','[%s][SYSTEM]\x20no\x20variable','body','[%s][SYSTEM]\x20set\x20variable\x20%s:\x20%s','next','error','isObject','stringify','validate','shelljs','lodash','../../../../config/logger','routing','string','command\x20is\x20a\x20string\x20and\x20it\x20is\x20required','consequence','length','[%s][SYSTEM]\x20%s','map','message','join'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x7dbd,0x197));var _0xd7db=function(_0x5b013d,_0xc7691c){_0x5b013d=_0x5b013d-0x0;var _0x2b6eef=_0x7dbd[_0x5b013d];return _0x2b6eef;};'use strict';var schema=require(_0xd7db('0x0'));var sh=require(_0xd7db('0x1'));var _=require(_0xd7db('0x2'));var utils=require('./utils');var logger=require(_0xd7db('0x3'))(_0xd7db('0x4'));var system=schema({'command':{'type':_0xd7db('0x5'),'required':!![],'message':_0xd7db('0x6')}});exports[_0xd7db('0x7')]=function(_0x21b161,_0x4c82af){return function(_0xe1102b){try{var _0x4c6db1={'command':_0x4c82af[0x0]};var _0x34168d=system['validate'](_0x4c6db1,{'typecast':!![]});if(_0x34168d[_0xd7db('0x8')]){logger['error'](_0xd7db('0x9'),_0x21b161,_[_0xd7db('0xa')](_0x34168d,_0xd7db('0xb'))[_0xd7db('0xc')](',\x20'));logger[_0xd7db('0xd')](_0xd7db('0xe'),_0x21b161);_0xe1102b['next']();}else{var _0x1e5c36=this;var _0x2462c7=utils[_0xd7db('0xf')](_0x4c82af[0x0],this);logger['info'](_0xd7db('0x10'),_0x21b161,_0x2462c7);sh[_0xd7db('0x11')](_[_0xd7db('0x12')](_0x2462c7),function(_0x570cc2,_0x2ad31d){logger[_0xd7db('0xd')]('[%s][SYSTEM]\x20result\x20code:\x20%s',_0x21b161,_0x570cc2);if(_0x570cc2==0x0){var _0x2b5d8f=_0x2ad31d[_0xd7db('0x13')](/(\r\n|\n|\r)/gm,'');if(_['isNil'](_0x4c82af[0x1])||_[_0xd7db('0x14')](_0x4c82af[0x1])){logger['info'](_0xd7db('0x15'),_0x21b161);_0x1e5c36[_0xd7db('0x16')][_0x4c82af[0x1]]=_0x2b5d8f;}else{logger[_0xd7db('0xd')](_0xd7db('0x17'),_0x21b161,_0x4c82af[0x1],_0x2b5d8f);_0x1e5c36[_0xd7db('0x16')][_0x4c82af[0x1]]=_0x2b5d8f;}}_0xe1102b[_0xd7db('0x18')]();});}}catch(_0x493051){logger[_0xd7db('0x19')](_0xd7db('0x9'),_0x21b161,_[_0xd7db('0x1a')](_0x493051)?JSON[_0xd7db('0x1b')](_0x493051):_0x493051);logger[_0xd7db('0xd')](_0xd7db('0xe'),_0x21b161);_0xe1102b[_0xd7db('0x18')]();}};}; \ No newline at end of file +var _0x6de3=['consequence','length','[%s][SYSTEM]\x20%s','message','info','[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next','next','[%s][SYSTEM]\x20commnad:\x20%s','exec','trim','[%s][SYSTEM]\x20result\x20code:\x20%s','replace','isNil','[%s][SYSTEM]\x20no\x20variable','[%s][SYSTEM]\x20set\x20variable\x20%s:\x20%s','isObject','stringify','validate','lodash','./utils','../../../../config/logger','routing','string','command\x20is\x20a\x20string\x20and\x20it\x20is\x20required'];(function(_0x14e9cd,_0xd130c4){var _0x2450be=function(_0x5e9e12){while(--_0x5e9e12){_0x14e9cd['push'](_0x14e9cd['shift']());}};_0x2450be(++_0xd130c4);}(_0x6de3,0x89));var _0x36de=function(_0x34b5fb,_0x19f2ce){_0x34b5fb=_0x34b5fb-0x0;var _0x473c41=_0x6de3[_0x34b5fb];return _0x473c41;};'use strict';var schema=require(_0x36de('0x0'));var sh=require('shelljs');var _=require(_0x36de('0x1'));var utils=require(_0x36de('0x2'));var logger=require(_0x36de('0x3'))(_0x36de('0x4'));var system=schema({'command':{'type':_0x36de('0x5'),'required':!![],'message':_0x36de('0x6')}});exports[_0x36de('0x7')]=function(_0x2f7152,_0x13becf){return function(_0x4d5fd6){try{var _0x163e48={'command':_0x13becf[0x0]};var _0x3a570d=system[_0x36de('0x0')](_0x163e48,{'typecast':!![]});if(_0x3a570d[_0x36de('0x8')]){logger['error'](_0x36de('0x9'),_0x2f7152,_['map'](_0x3a570d,_0x36de('0xa'))['join'](',\x20'));logger[_0x36de('0xb')](_0x36de('0xc'),_0x2f7152);_0x4d5fd6[_0x36de('0xd')]();}else{var _0xf55070=this;var _0x3d3bc4=utils['getMustacheRender'](_0x13becf[0x0],this);logger[_0x36de('0xb')](_0x36de('0xe'),_0x2f7152,_0x3d3bc4);sh[_0x36de('0xf')](_[_0x36de('0x10')](_0x3d3bc4),function(_0x389530,_0xc963bc){logger[_0x36de('0xb')](_0x36de('0x11'),_0x2f7152,_0x389530);if(_0x389530==0x0){var _0x3628e4=_0xc963bc[_0x36de('0x12')](/(\r\n|\n|\r)/gm,'');if(_[_0x36de('0x13')](_0x13becf[0x1])||_['isEmpty'](_0x13becf[0x1])){logger[_0x36de('0xb')](_0x36de('0x14'),_0x2f7152);_0xf55070['body'][_0x13becf[0x1]]=_0x3628e4;}else{logger['info'](_0x36de('0x15'),_0x2f7152,_0x13becf[0x1],_0x3628e4);_0xf55070['body'][_0x13becf[0x1]]=_0x3628e4;}}_0x4d5fd6[_0x36de('0xd')]();});}}catch(_0x2ff7bf){logger['error']('[%s][SYSTEM]\x20%s',_0x2f7152,_[_0x36de('0x16')](_0x2ff7bf)?JSON[_0x36de('0x17')](_0x2ff7bf):_0x2ff7bf);logger[_0x36de('0xb')](_0x36de('0xc'),_0x2f7152);_0x4d5fd6[_0x36de('0xd')]();}};}; \ 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 58d5bac..0f851a7 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 _0xe81e=['routing','TagId\x20is\x20a\x20string\x20and\x20it\x20is\x20required','consequence','error','[%s][TAG]\x20%s','map','message','info','[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next','next','channel','Interaction','addTags','interaction','then','[%s][TAG]\x20tag\x20\x22%s\x22\x20added\x20to\x20%s\x20interaction\x20%s','catch','stringify','finally','validate','lodash','../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/smsInteraction','../../rpc/faxInteraction','../../rpc/whatsappInteraction'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xe81e,0x1cd));var _0xee81=function(_0x17cf02,_0x554107){_0x17cf02=_0x17cf02-0x0;var _0x4b9510=_0xe81e[_0x17cf02];return _0x4b9510;};'use strict';var schema=require(_0xee81('0x0'));var _=require(_0xee81('0x1'));var rpc={'chatInteraction':require(_0xee81('0x2')),'openchannelInteraction':require(_0xee81('0x3')),'smsInteraction':require(_0xee81('0x4')),'mailInteraction':require('../../rpc/mailInteraction'),'faxInteraction':require(_0xee81('0x5')),'whatsappInteraction':require(_0xee81('0x6'))};var logger=require('../../../../config/logger')(_0xee81('0x7'));var tag=schema({'tag':{'type':'number','required':!![],'message':_0xee81('0x8')}});exports[_0xee81('0x9')]=function(_0x3c4161,_0x53eb2a,_0x3f266,_0x11f0d2){return function(_0x405b57){try{var _0x44a4a4={'tag':_0x53eb2a[0x0]};var _0x52515b=tag['validate'](_0x44a4a4,{'typecast':!![]});if(_0x52515b['length']){logger[_0xee81('0xa')](_0xee81('0xb'),_0x3c4161,_[_0xee81('0xc')](_0x52515b,_0xee81('0xd'))['join'](',\x20'));logger[_0xee81('0xe')](_0xee81('0xf'),_0x3c4161);_0x405b57[_0xee81('0x10')]();}else{var _0x17180d={'ids':[_0x53eb2a[0x0]]};if(rpc[_0x11f0d2[_0xee81('0x11')]+_0xee81('0x12')]){rpc[_0x11f0d2[_0xee81('0x11')]+_0xee81('0x12')][_0xee81('0x13')](_0x11f0d2[_0xee81('0x14')]['id'],_0x17180d)[_0xee81('0x15')](function(_0x562be4){logger[_0xee81('0xe')](_0xee81('0x16'),_0x3c4161,_0x53eb2a[0x1],_0x11f0d2[_0xee81('0x11')],_0x11f0d2[_0xee81('0x14')]['id']);})[_0xee81('0x17')](function(_0x53a56c){logger[_0xee81('0xa')](_0xee81('0xb'),_0x3c4161,JSON[_0xee81('0x18')](_0x53a56c));logger[_0xee81('0xe')]('[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next',_0x3c4161);})[_0xee81('0x19')](function(){_0x405b57[_0xee81('0x10')]();});}}}catch(_0x4de72e){logger[_0xee81('0xa')]('[%s][TAG]\x20%s',_0x3c4161,_['isObject'](_0x4de72e)?JSON[_0xee81('0x18')](_0x4de72e):_0x4de72e);logger['info'](_0xee81('0xf'),_0x3c4161);_0x405b57[_0xee81('0x10')]();}};}; \ No newline at end of file +var _0xd406=['error','map','message','join','[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next','next','channel','Interaction','addTags','interaction','then','[%s][TAG]\x20%s','info','finally','isObject','validate','../../rpc/chatInteraction','../../rpc/mailInteraction','../../rpc/faxInteraction','../../rpc/whatsappInteraction','../../../../config/logger','routing','number','TagId\x20is\x20a\x20string\x20and\x20it\x20is\x20required','consequence','length'];(function(_0x319ece,_0x194eba){var _0x26b838=function(_0x2dbb14){while(--_0x2dbb14){_0x319ece['push'](_0x319ece['shift']());}};_0x26b838(++_0x194eba);}(_0xd406,0xf9));var _0x6d40=function(_0x4538b9,_0x4ee76d){_0x4538b9=_0x4538b9-0x0;var _0x2bfdc0=_0xd406[_0x4538b9];return _0x2bfdc0;};'use strict';var schema=require(_0x6d40('0x0'));var _=require('lodash');var rpc={'chatInteraction':require(_0x6d40('0x1')),'openchannelInteraction':require('../../rpc/openchannelInteraction'),'smsInteraction':require('../../rpc/smsInteraction'),'mailInteraction':require(_0x6d40('0x2')),'faxInteraction':require(_0x6d40('0x3')),'whatsappInteraction':require(_0x6d40('0x4'))};var logger=require(_0x6d40('0x5'))(_0x6d40('0x6'));var tag=schema({'tag':{'type':_0x6d40('0x7'),'required':!![],'message':_0x6d40('0x8')}});exports[_0x6d40('0x9')]=function(_0x40a0a7,_0x46dcd6,_0x170e2b,_0x3718ed){return function(_0x424939){try{var _0x3bd719={'tag':_0x46dcd6[0x0]};var _0x294f9e=tag['validate'](_0x3bd719,{'typecast':!![]});if(_0x294f9e[_0x6d40('0xa')]){logger[_0x6d40('0xb')]('[%s][TAG]\x20%s',_0x40a0a7,_[_0x6d40('0xc')](_0x294f9e,_0x6d40('0xd'))[_0x6d40('0xe')](',\x20'));logger['info'](_0x6d40('0xf'),_0x40a0a7);_0x424939[_0x6d40('0x10')]();}else{var _0x5d64e8={'ids':[_0x46dcd6[0x0]]};if(rpc[_0x3718ed[_0x6d40('0x11')]+_0x6d40('0x12')]){rpc[_0x3718ed[_0x6d40('0x11')]+_0x6d40('0x12')][_0x6d40('0x13')](_0x3718ed[_0x6d40('0x14')]['id'],_0x5d64e8)[_0x6d40('0x15')](function(_0x5b7a09){logger['info']('[%s][TAG]\x20tag\x20\x22%s\x22\x20added\x20to\x20%s\x20interaction\x20%s',_0x40a0a7,_0x46dcd6[0x1],_0x3718ed[_0x6d40('0x11')],_0x3718ed[_0x6d40('0x14')]['id']);})['catch'](function(_0x113e14){logger[_0x6d40('0xb')](_0x6d40('0x16'),_0x40a0a7,JSON['stringify'](_0x113e14));logger[_0x6d40('0x17')](_0x6d40('0xf'),_0x40a0a7);})[_0x6d40('0x18')](function(){_0x424939[_0x6d40('0x10')]();});}}}catch(_0x215fdf){logger[_0x6d40('0xb')]('[%s][TAG]\x20%s',_0x40a0a7,_[_0x6d40('0x19')](_0x215fdf)?JSON['stringify'](_0x215fdf):_0x215fdf);logger[_0x6d40('0x17')](_0x6d40('0xf'),_0x40a0a7);_0x424939[_0x6d40('0x10')]();}};}; \ 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 b889b71..bc8f4d1 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 _0x47c7=['message','account','interaction','mustache','exports','render','merge','contact'];(function(_0x3051d9,_0x3de423){var _0xcc0a87=function(_0x588cee){while(--_0x588cee){_0x3051d9['push'](_0x3051d9['shift']());}};_0xcc0a87(++_0x3de423);}(_0x47c7,0x1ab));var _0x747c=function(_0x2db12b,_0x30ab1d){_0x2db12b=_0x2db12b-0x0;var _0x20990b=_0x47c7[_0x2db12b];return _0x20990b;};'use strict';var Mustache=require(_0x747c('0x0'));var _=require('lodash');module[_0x747c('0x1')]={'getMustacheRender':function(_0x63d85a,_0x4a6fc3){return Mustache[_0x747c('0x2')](_0x63d85a,_[_0x747c('0x3')](_0x4a6fc3['body'],{'contact':_0x4a6fc3[_0x747c('0x4')],'message':_0x4a6fc3[_0x747c('0x5')],'account':_0x4a6fc3[_0x747c('0x6')],'interaction':_0x4a6fc3[_0x747c('0x7')],'list':_0x4a6fc3['list']}))||'';}}; \ No newline at end of file +var _0xa1fd=['list','mustache','lodash','exports','render','merge','body','contact','message','interaction'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xa1fd,0x1b9));var _0xda1f=function(_0x36665f,_0x4f9488){_0x36665f=_0x36665f-0x0;var _0x481d25=_0xa1fd[_0x36665f];return _0x481d25;};'use strict';var Mustache=require(_0xda1f('0x0'));var _=require(_0xda1f('0x1'));module[_0xda1f('0x2')]={'getMustacheRender':function(_0x3feff6,_0x595195){return Mustache[_0xda1f('0x3')](_0x3feff6,_[_0xda1f('0x4')](_0x595195[_0xda1f('0x5')],{'contact':_0x595195[_0xda1f('0x6')],'message':_0x595195[_0xda1f('0x7')],'account':_0x595195['account'],'interaction':_0x595195[_0xda1f('0x8')],'list':_0x595195[_0xda1f('0x9')]}))||'';}}; \ No newline at end of file diff --git a/server/services/routing/server/index.js b/server/services/routing/server/index.js index dda553e..c11f065 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 _0xde51=['routing\x20is\x20empty','end','QueueReport','update','UserId','catch','message\x20is\x20empty','agent','agents','busy','hasOwnProperty','capacity','CurrentCapacity','updateRealtime','values','chatQueues','available','loggedIn','name','paused','waiting','mailQueues','openchannelQueues','smsQueues','faxQueues','whatsappQueues','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','server','http','127.0.0.1','log','Routing\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','lodash','util','path','jayson/promise','bluebird','uuid','../../../config/environment','../../../config/logger','../rpc/openchannelQueueReport','../rpc/smsQueueReport','../rpc/faxQueueReport','../rpc/whatsappQueueReport','../lib/rule-engine','%s.%s.%s','isNil','IntervalId','Intervals','map','interval','listen','rules','channel','message','interaction','isArray','applications','length','existsSync','join','.js','app','toLowerCase','autoreply','push','dialogflow','appdata','split','slice','amazonlex','tag','TagId','format','%s:%s:%s','condition','intervals','consequence','priority','info','Push\x20new\x20rule','on\x20interval','error','Please\x20create\x20a\x20new\x20file\x20under','execute','Applications\x20executed','stringify','matchPath','emit','No\x20applications\x20to\x20execute','stack'];(function(_0x27b859,_0x540b7f){var _0x309e69=function(_0x2caffb){while(--_0x2caffb){_0x27b859['push'](_0x27b859['shift']());}};_0x309e69(++_0x540b7f);}(_0xde51,0x139));var _0x1de5=function(_0x2cdec6,_0x39d4c8){_0x2cdec6=_0x2cdec6-0x0;var _0xa36703=_0xde51[_0x2cdec6];return _0xa36703;};'use strict';var _=require(_0x1de5('0x0'));var util=require(_0x1de5('0x1'));var path=require(_0x1de5('0x2'));var fs=require('fs');var jayson=require(_0x1de5('0x3'));var BPromise=require(_0x1de5('0x4'));var uuid=require(_0x1de5('0x5'));var config=require(_0x1de5('0x6'));var logger=require(_0x1de5('0x7'))('routing');var rpc={'openchannelQueueReport':require(_0x1de5('0x8')),'mailQueueReport':require('../rpc/mailQueueReport'),'chatQueueReport':require('../rpc/chatQueueReport'),'smsQueueReport':require(_0x1de5('0x9')),'faxQueueReport':require(_0x1de5('0xa')),'whatsappQueueReport':require(_0x1de5('0xb'))};var RuleEngine=require(_0x1de5('0xc'));function getId(_0x49f370,_0x4f3f01,_0x1fce33){return util['format'](_0x1de5('0xd'),_0x49f370,_0x4f3f01||0x0,_0x1fce33||0x0);}function getIntervals(_0x5c3286,_0x54a0bf){var _0x10039c=[];if(!_[_0x1de5('0xe')](_0x54a0bf[_0x1de5('0xf')])&&!_[_0x1de5('0xe')](_0x5c3286[_0x54a0bf[_0x1de5('0xf')]])&&!_[_0x1de5('0xe')](_0x5c3286[_0x54a0bf['IntervalId']][_0x1de5('0x10')])){_0x10039c=_[_0x1de5('0x11')](_0x5c3286[_0x54a0bf[_0x1de5('0xf')]][_0x1de5('0x10')],_0x1de5('0x12'));}else if(!_[_0x1de5('0xe')](_0x54a0bf['interval'])){_0x10039c=[_0x54a0bf[_0x1de5('0x12')]];}return _0x10039c;}exports[_0x1de5('0x13')]=function(_0x282d08){_0x282d08[_0x1de5('0x14')]={};return new BPromise(function(_0xa6a916,_0x102dfd){var _0x42152e={'Start':function(_0x37d840){var _0x247984=this;return new Promise(function(_0x31ec65,_0xd25215){if(_0x37d840){try{var _0xdec1f2=[];var _0x629e07=getId(_0x37d840[_0x1de5('0x15')],_0x37d840[_0x1de5('0x16')]?_0x37d840[_0x1de5('0x16')]['id']:0x0,_0x37d840['interaction']?_0x37d840[_0x1de5('0x17')]['id']:0x0);if(_0x37d840['applications']&&_[_0x1de5('0x18')](_0x37d840[_0x1de5('0x19')])&&_0x37d840[_0x1de5('0x19')][_0x1de5('0x1a')]){for(var _0x309a23=0x0;_0x309a23<_0x37d840[_0x1de5('0x19')][_0x1de5('0x1a')];_0x309a23+=0x1){var _0x4f95ea=_0x37d840[_0x1de5('0x19')][_0x309a23];if(fs[_0x1de5('0x1b')](path[_0x1de5('0x1c')](__dirname,_0x1de5('0x19'),_0x4f95ea['app']+_0x1de5('0x1d')))){var _0x407ea4=[];switch(_0x4f95ea[_0x1de5('0x1e')][_0x1de5('0x1f')]()){case _0x1de5('0x20'):var _0x4d0363=_0x4f95ea['appdata']['split'](',');_0x407ea4[_0x1de5('0x21')](_0x4d0363[0x0]);_0x407ea4[_0x1de5('0x21')](_0x4d0363['slice'](0x1,_0x4d0363[_0x1de5('0x1a')])['join'](','));break;case _0x1de5('0x22'):var _0x232b32=_0x4f95ea[_0x1de5('0x23')][_0x1de5('0x24')](',');_0x407ea4[_0x1de5('0x21')](_0x232b32[0x0]);_0x407ea4[_0x1de5('0x21')](_0x232b32[0x1]);_0x407ea4[_0x1de5('0x21')](_0x232b32[_0x1de5('0x25')](0x2,_0x232b32['length'])[_0x1de5('0x1c')](','));break;case _0x1de5('0x26'):var _0x267a7e=_0x4f95ea[_0x1de5('0x23')][_0x1de5('0x24')](',');_0x407ea4[_0x1de5('0x21')](_0x267a7e[0x0]);_0x407ea4[_0x1de5('0x21')](_0x267a7e[0x1]);_0x407ea4[_0x1de5('0x21')](_0x267a7e[0x2]);_0x407ea4[_0x1de5('0x21')](_0x267a7e[0x3]);_0x407ea4[_0x1de5('0x21')](_0x267a7e[_0x1de5('0x25')](0x4,_0x267a7e[_0x1de5('0x1a')])[_0x1de5('0x1c')](','));break;case _0x1de5('0x16'):_0x407ea4[_0x1de5('0x21')](_0x4f95ea[_0x1de5('0x23')]);break;case _0x1de5('0x27'):_0x407ea4[_0x1de5('0x21')](_0x4f95ea[_0x1de5('0x28')]);_0x407ea4[_0x1de5('0x21')](_0x4f95ea[_0x1de5('0x23')]);break;default:_0x407ea4=_[_0x1de5('0xe')](_0x4f95ea[_0x1de5('0x23')])?[]:_0x4f95ea[_0x1de5('0x23')][_0x1de5('0x24')](',');}var _0x546b59={'id':util[_0x1de5('0x29')](_0x1de5('0x2a'),_0x629e07,_0x4f95ea['id'],_0x4f95ea[_0x1de5('0x1e')]),'condition':require('./interval')[_0x1de5('0x2b')](_0x629e07,getIntervals(_0x282d08[_0x1de5('0x2c')],_0x4f95ea),_0x282d08),'consequence':require('./applications/'+_0x4f95ea[_0x1de5('0x1e')])[_0x1de5('0x2d')](_0x629e07,_0x407ea4,_0x282d08,_0x37d840),'p':_0x4f95ea[_0x1de5('0x2e')]||0x0};logger[_0x1de5('0x2f')](_0x1de5('0x30'),_0x546b59['id'],_0x1de5('0x31'),getIntervals(_0x282d08[_0x1de5('0x2c')],_0x4f95ea)[_0x1de5('0x1c')]('\x20|\x20'));_0xdec1f2[_0x1de5('0x21')](_0x546b59);}else{logger[_0x1de5('0x32')](_0x1de5('0x33'),path[_0x1de5('0x1c')](__dirname,'applications',_0x4f95ea[_0x1de5('0x1e')]+_0x1de5('0x1d')));}}_0x282d08[_0x1de5('0x14')][_0x629e07]=new RuleEngine(_0xdec1f2);_0x282d08[_0x1de5('0x14')][_0x629e07][_0x1de5('0x34')](_0x37d840,function(_0x6d92a2){logger[_0x1de5('0x2f')](_0x1de5('0x35'),JSON[_0x1de5('0x36')](_0x6d92a2[_0x1de5('0x37')]));if(_0x282d08[_0x1de5('0x14')][_0x629e07]){_0x282d08['rules'][_0x629e07][_0x1de5('0x38')]('complete');}});return _0x31ec65({'code':0xc8,'message':_0x37d840});}else{logger[_0x1de5('0x2f')](_0x1de5('0x39'));return _0x31ec65({'code':0xc8,'message':_0x37d840});}}catch(_0x348839){logger[_0x1de5('0x32')](_0x348839[_0x1de5('0x3a')]);return _0xd25215(_0x247984[_0x1de5('0x32')](0x1f4,_0x348839));}}return _0xd25215(_0x1de5('0x3b'));});},'AcceptMessage':function(_0x47d610){var _0x58fe7f=this;return new Promise(function(_0x18f3f0,_0x55175c){if(_0x47d610['message']&&_0x47d610[_0x1de5('0x16')]['id']){try{var _0x9e4f44=getId(_0x47d610['channel'],_0x47d610[_0x1de5('0x16')]?_0x47d610[_0x1de5('0x16')]['id']:0x0,_0x47d610[_0x1de5('0x17')]?_0x47d610[_0x1de5('0x17')]['id']:0x0);if(_0x282d08['rules'][_0x9e4f44]){_0x282d08['rules'][_0x9e4f44]['emit'](_0x1de5('0x3c'));if(rpc[_0x47d610[_0x1de5('0x15')]+_0x1de5('0x3d')]){rpc[_0x47d610[_0x1de5('0x15')]+_0x1de5('0x3d')][_0x1de5('0x3e')](_0x9e4f44,{'UserId':_0x47d610['message'][_0x1de5('0x3f')]})[_0x1de5('0x40')](function(_0x5da937){logger[_0x1de5('0x32')]('error\x20update\x20queue\x20report');});}}return _0x18f3f0({'code':0xc8,'message':_0x47d610});}catch(_0x3294d7){logger[_0x1de5('0x32')](_0x3294d7[_0x1de5('0x3a')]);return _0x55175c(_0x58fe7f[_0x1de5('0x32')](0x1f4,_0x3294d7));}}logger[_0x1de5('0x32')](_0x1de5('0x41'));return _0x55175c(_0x58fe7f[_0x1de5('0x32')](0x1f4,_0x1de5('0x41')));});},'RejectMessage':function(_0x4bde9d){var _0x15e731=this;return new Promise(function(_0x11136f,_0x14e968){if(_0x4bde9d[_0x1de5('0x42')]&&_0x4bde9d[_0x1de5('0x42')]['id']){try{if(_0x282d08['agents'][_0x4bde9d['agent']['id']]){_0x282d08[_0x1de5('0x43')][_0x4bde9d[_0x1de5('0x42')]['id']][_0x1de5('0x44')]=![];_0x282d08['agents'][_0x4bde9d[_0x1de5('0x42')]['id']]['busyQueue']=undefined;}return _0x11136f({'code':0xc8,'message':_0x4bde9d});}catch(_0x3be336){logger[_0x1de5('0x32')](_0x3be336['stack']);return _0x14e968(_0x15e731[_0x1de5('0x32')](0x1f4,_0x3be336));}}logger[_0x1de5('0x32')](_0x1de5('0x41'));return _0x14e968(_0x15e731[_0x1de5('0x32')](0x1f4,'message\x20is\x20empty'));});},'AbandonInteraction':function(_0x33250d){var _0x360f24=this;return new Promise(function(_0x2d97b9,_0x545b5f){if(_0x33250d[_0x1de5('0x15')]&&_0x33250d[_0x1de5('0x17')]&&_0x33250d[_0x1de5('0x17')]['id']){try{var _0x9cdf3b=getId(_0x33250d[_0x1de5('0x15')],_0x33250d[_0x1de5('0x16')]?_0x33250d['message']['id']:0x0,_0x33250d[_0x1de5('0x17')]?_0x33250d[_0x1de5('0x17')]['id']:0x0);if(_0x282d08['rules'][_0x9cdf3b]){_0x282d08[_0x1de5('0x14')][_0x9cdf3b][_0x1de5('0x38')]('end');}return _0x2d97b9({'code':0xc8,'message':_0x33250d});}catch(_0x583022){logger[_0x1de5('0x32')](_0x583022['stack']);return _0x545b5f(_0x360f24[_0x1de5('0x32')](0x1f4,_0x583022));}}logger['error'](_0x1de5('0x41'));return _0x545b5f(_0x360f24[_0x1de5('0x32')](0x1f4,'message\x20is\x20empty'));});},'AgentCapacity':function(_0x1893d7){var _0xe16b6d=this;return new Promise(function(_0x1677a0,_0x834abb){if(_0x282d08[_0x1de5('0x43')][_0x1de5('0x45')](_0x1893d7['id'])){for(var _0x4fd554 in _0x1893d7[_0x1de5('0x46')]){if(_0x1893d7[_0x1de5('0x46')][_0x1de5('0x45')](_0x4fd554)){if(_0x282d08[_0x1de5('0x43')][_0x1893d7['id']][_0x1de5('0x45')](_0x4fd554+_0x1de5('0x47'))){_0x282d08['agents'][_0x1893d7['id']][_0x4fd554+_0x1de5('0x47')]=parseInt(_0x1893d7['capacity'][_0x4fd554],0xa);}}}_0x282d08[_0x1de5('0x43')][_0x1893d7['id']][_0x1de5('0x48')]();return _0x1677a0({'code':0xc8,'message':_0x282d08[_0x1de5('0x43')][_0x1893d7['id']]});}else{return _0x834abb(_0xe16b6d[_0x1de5('0x32')](0x1f4,'agent\x20not\x20found'));}});},'Agents':function(_0x84cb81){return new Promise(function(_0x19a14f,_0x185e29){var _0x489e1c=_[_0x1de5('0x49')](_0x282d08[_0x1de5('0x43')]);_0x19a14f({'count':_0x489e1c[_0x1de5('0x1a')],'rows':_0x489e1c});});},'ChatQueues':function(_0x2a048f){return new Promise(function(_0xf535fc,_0xeca8f2){var _0x15e390=[];for(var _0x279d0b in _0x282d08[_0x1de5('0x4a')]){if(_0x282d08[_0x1de5('0x4a')][_0x1de5('0x45')](_0x279d0b)){var _0x16b82d=_0x282d08[_0x1de5('0x4a')][_0x279d0b];var _0x49c081={'id':_0x16b82d['id'],'available':_0x16b82d[_0x1de5('0x4b')],'loggedIn':_0x16b82d[_0x1de5('0x4c')],'name':_0x16b82d[_0x1de5('0x4d')],'paused':_0x16b82d[_0x1de5('0x4e')],'waiting':_0x16b82d[_0x1de5('0x4f')]};_0x15e390[_0x1de5('0x21')](_0x49c081);}}_0xf535fc({'count':_0x15e390['length'],'rows':_0x15e390});});},'MailQueues':function(_0x23fae6){return new Promise(function(_0x14a3d0,_0x2a1801){var _0x59a20d=[];for(var _0x56c6d7 in _0x282d08[_0x1de5('0x50')]){if(_0x282d08['mailQueues'][_0x1de5('0x45')](_0x56c6d7)){var _0x463518=_0x282d08[_0x1de5('0x50')][_0x56c6d7];var _0x1c5f96={'id':_0x463518['id'],'available':_0x463518[_0x1de5('0x4b')],'loggedIn':_0x463518[_0x1de5('0x4c')],'name':_0x463518[_0x1de5('0x4d')],'paused':_0x463518[_0x1de5('0x4e')],'waiting':_0x463518[_0x1de5('0x4f')]};_0x59a20d[_0x1de5('0x21')](_0x1c5f96);}}_0x14a3d0({'count':_0x59a20d['length'],'rows':_0x59a20d});});},'OpenchannelQueues':function(_0x2038eb){return new Promise(function(_0x31484c,_0x298f30){var _0x217587=[];for(var _0x4e2423 in _0x282d08[_0x1de5('0x51')]){if(_0x282d08[_0x1de5('0x51')][_0x1de5('0x45')](_0x4e2423)){var _0x23b7bd=_0x282d08[_0x1de5('0x51')][_0x4e2423];var _0x104c2d={'id':_0x23b7bd['id'],'available':_0x23b7bd['available'],'loggedIn':_0x23b7bd[_0x1de5('0x4c')],'name':_0x23b7bd[_0x1de5('0x4d')],'paused':_0x23b7bd[_0x1de5('0x4e')],'waiting':_0x23b7bd['waiting']};_0x217587[_0x1de5('0x21')](_0x104c2d);}}_0x31484c({'count':_0x217587[_0x1de5('0x1a')],'rows':_0x217587});});},'SmsQueues':function(_0x2549c9){return new Promise(function(_0x5ecadf,_0x2c21ad){var _0x5f29b6=[];for(var _0x22f1a1 in _0x282d08[_0x1de5('0x52')]){if(_0x282d08[_0x1de5('0x52')][_0x1de5('0x45')](_0x22f1a1)){var _0x1e1948=_0x282d08[_0x1de5('0x52')][_0x22f1a1];var _0x572efe={'id':_0x1e1948['id'],'available':_0x1e1948['available'],'loggedIn':_0x1e1948['loggedIn'],'name':_0x1e1948[_0x1de5('0x4d')],'paused':_0x1e1948[_0x1de5('0x4e')],'waiting':_0x1e1948['waiting']};_0x5f29b6['push'](_0x572efe);}}_0x5ecadf({'count':_0x5f29b6[_0x1de5('0x1a')],'rows':_0x5f29b6});});},'FaxQueues':function(_0x3f2143){return new Promise(function(_0xc9f82c,_0x29c8f1){var _0x442f58=[];for(var _0x5352da in _0x282d08['faxQueues']){if(_0x282d08[_0x1de5('0x53')]['hasOwnProperty'](_0x5352da)){var _0x470705=_0x282d08[_0x1de5('0x53')][_0x5352da];var _0x55b76e={'id':_0x470705['id'],'available':_0x470705['available'],'loggedIn':_0x470705[_0x1de5('0x4c')],'name':_0x470705[_0x1de5('0x4d')],'paused':_0x470705[_0x1de5('0x4e')],'waiting':_0x470705[_0x1de5('0x4f')]};_0x442f58[_0x1de5('0x21')](_0x55b76e);}}_0xc9f82c({'count':_0x442f58[_0x1de5('0x1a')],'rows':_0x442f58});});},'WhatsappQueues':function(_0x4f3174){return new Promise(function(_0x415f66,_0x2ecd7){var _0xbf09fa=[];for(var _0x19901 in _0x282d08[_0x1de5('0x54')]){if(_0x282d08[_0x1de5('0x54')][_0x1de5('0x45')](_0x19901)){var _0x21ba5f=_0x282d08[_0x1de5('0x54')][_0x19901];var _0x469c1e={'id':_0x21ba5f['id'],'available':_0x21ba5f[_0x1de5('0x4b')],'loggedIn':_0x21ba5f[_0x1de5('0x4c')],'name':_0x21ba5f[_0x1de5('0x4d')],'paused':_0x21ba5f[_0x1de5('0x4e')],'waiting':_0x21ba5f[_0x1de5('0x4f')]};_0xbf09fa[_0x1de5('0x21')](_0x469c1e);}}_0x415f66({'count':_0xbf09fa[_0x1de5('0x1a')],'rows':_0xbf09fa});});},'ChatQueuesWaitingInteractions':function(_0x1f0d7b){return new Promise(function(_0x1db4aa,_0x29c9d2){var _0x24d866=_['values'](_0x282d08['chatQueuesWaitingInteractions']);_0x1db4aa({'count':_0x24d866['length'],'rows':_0x24d866});});},'MailQueuesWaitingInteractions':function(_0x3698a5){return new Promise(function(_0x11876c,_0xc3dfe2){var _0x373c3a=_[_0x1de5('0x49')](_0x282d08[_0x1de5('0x55')]);_0x11876c({'count':_0x373c3a['length'],'rows':_0x373c3a});});},'OpenchannelQueuesWaitingInteractions':function(_0x248b63){return new Promise(function(_0x7ce7ee,_0x3cc69b){var _0xdf9b6e=_['values'](_0x282d08[_0x1de5('0x56')]);_0x7ce7ee({'count':_0xdf9b6e['length'],'rows':_0xdf9b6e});});},'SmsQueuesWaitingInteractions':function(_0x4668de){return new Promise(function(_0x4228de,_0x42ae5d){var _0x18418a=_[_0x1de5('0x49')](_0x282d08['smsQueuesWaitingInteractions']);_0x4228de({'count':_0x18418a[_0x1de5('0x1a')],'rows':_0x18418a});});},'FaxQueuesWaitingInteractions':function(_0x50a073){return new Promise(function(_0x33912e,_0x42e7f8){var _0x316519=_[_0x1de5('0x49')](_0x282d08['faxQueuesWaitingInteractions']);_0x33912e({'count':_0x316519[_0x1de5('0x1a')],'rows':_0x316519});});},'WhatsappQueuesWaitingInteractions':function(_0x7882fb){return new Promise(function(_0x30ac56,_0x41d56d){var _0x790cad=_['values'](_0x282d08[_0x1de5('0x57')]);_0x30ac56({'count':_0x790cad['length'],'rows':_0x790cad});});}};var _0x11e112=jayson[_0x1de5('0x58')](_0x42152e)[_0x1de5('0x59')]();_0x11e112['on'](_0x1de5('0x32'),function(_0x3c952e){logger[_0x1de5('0x32')](JSON[_0x1de5('0x36')](_0x3c952e));return _0x102dfd(_0x3c952e);});_0x11e112[_0x1de5('0x13')](0x232c,_0x1de5('0x5a'),function(){console[_0x1de5('0x5b')](_0x1de5('0x5c'),0x232c);return _0xa6a916('RPC\x20listening\x20on\x20port:'+0x232c);});});}; \ No newline at end of file +var _0x2b39=['whatsappQueuesWaitingInteractions','server','http','127.0.0.1','log','RPC\x20listening\x20on\x20port:','lodash','util','path','jayson/promise','bluebird','uuid','../../../config/logger','../rpc/openchannelQueueReport','../rpc/mailQueueReport','../rpc/chatQueueReport','../rpc/smsQueueReport','../rpc/faxQueueReport','../rpc/whatsappQueueReport','IntervalId','isNil','Intervals','map','interval','listen','rules','channel','message','interaction','applications','length','existsSync','join','.js','app','toLowerCase','autoreply','appdata','split','push','slice','dialogflow','amazonlex','tag','format','%s:%s:%s','./interval','intervals','consequence','priority','info','Push\x20new\x20rule','on\x20interval','\x20|\x20','Please\x20create\x20a\x20new\x20file\x20under','execute','Applications\x20executed','stringify','emit','error','routing\x20is\x20empty','end','QueueReport','update','UserId','catch','error\x20update\x20queue\x20report','stack','message\x20is\x20empty','agent','agents','busyQueue','hasOwnProperty','CurrentCapacity','updateRealtime','agent\x20not\x20found','values','chatQueues','loggedIn','name','paused','waiting','mailQueues','available','openchannelQueues','smsQueues','faxQueues','whatsappQueues','chatQueuesWaitingInteractions','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','faxQueuesWaitingInteractions'];(function(_0x23e985,_0x1fe322){var _0xf47a90=function(_0x2d2c4e){while(--_0x2d2c4e){_0x23e985['push'](_0x23e985['shift']());}};_0xf47a90(++_0x1fe322);}(_0x2b39,0x11d));var _0x92b3=function(_0x423f00,_0x467bb2){_0x423f00=_0x423f00-0x0;var _0x238c49=_0x2b39[_0x423f00];return _0x238c49;};'use strict';var _=require(_0x92b3('0x0'));var util=require(_0x92b3('0x1'));var path=require(_0x92b3('0x2'));var fs=require('fs');var jayson=require(_0x92b3('0x3'));var BPromise=require(_0x92b3('0x4'));var uuid=require(_0x92b3('0x5'));var config=require('../../../config/environment');var logger=require(_0x92b3('0x6'))('routing');var rpc={'openchannelQueueReport':require(_0x92b3('0x7')),'mailQueueReport':require(_0x92b3('0x8')),'chatQueueReport':require(_0x92b3('0x9')),'smsQueueReport':require(_0x92b3('0xa')),'faxQueueReport':require(_0x92b3('0xb')),'whatsappQueueReport':require(_0x92b3('0xc'))};var RuleEngine=require('../lib/rule-engine');function getId(_0x947378,_0x9e6ebc,_0x162d4c){return util['format']('%s.%s.%s',_0x947378,_0x9e6ebc||0x0,_0x162d4c||0x0);}function getIntervals(_0x1bd4ad,_0x5f4698){var _0x340e8c=[];if(!_['isNil'](_0x5f4698[_0x92b3('0xd')])&&!_['isNil'](_0x1bd4ad[_0x5f4698[_0x92b3('0xd')]])&&!_[_0x92b3('0xe')](_0x1bd4ad[_0x5f4698[_0x92b3('0xd')]][_0x92b3('0xf')])){_0x340e8c=_[_0x92b3('0x10')](_0x1bd4ad[_0x5f4698[_0x92b3('0xd')]][_0x92b3('0xf')],_0x92b3('0x11'));}else if(!_[_0x92b3('0xe')](_0x5f4698[_0x92b3('0x11')])){_0x340e8c=[_0x5f4698[_0x92b3('0x11')]];}return _0x340e8c;}exports[_0x92b3('0x12')]=function(_0x35639a){_0x35639a[_0x92b3('0x13')]={};return new BPromise(function(_0x42907a,_0x4aa47b){var _0x379ec3={'Start':function(_0x538256){var _0x4e1be7=this;return new Promise(function(_0x5a62c5,_0x36418f){if(_0x538256){try{var _0x2d9494=[];var _0x2e2026=getId(_0x538256[_0x92b3('0x14')],_0x538256[_0x92b3('0x15')]?_0x538256[_0x92b3('0x15')]['id']:0x0,_0x538256[_0x92b3('0x16')]?_0x538256[_0x92b3('0x16')]['id']:0x0);if(_0x538256[_0x92b3('0x17')]&&_['isArray'](_0x538256['applications'])&&_0x538256[_0x92b3('0x17')][_0x92b3('0x18')]){for(var _0x16ea11=0x0;_0x16ea11<_0x538256['applications']['length'];_0x16ea11+=0x1){var _0xe025cb=_0x538256[_0x92b3('0x17')][_0x16ea11];if(fs[_0x92b3('0x19')](path[_0x92b3('0x1a')](__dirname,'applications',_0xe025cb['app']+_0x92b3('0x1b')))){var _0x26f453=[];switch(_0xe025cb[_0x92b3('0x1c')][_0x92b3('0x1d')]()){case _0x92b3('0x1e'):var _0x56bfa9=_0xe025cb[_0x92b3('0x1f')][_0x92b3('0x20')](',');_0x26f453[_0x92b3('0x21')](_0x56bfa9[0x0]);_0x26f453[_0x92b3('0x21')](_0x56bfa9[_0x92b3('0x22')](0x1,_0x56bfa9[_0x92b3('0x18')])[_0x92b3('0x1a')](','));break;case _0x92b3('0x23'):var _0x2918c3=_0xe025cb['appdata'][_0x92b3('0x20')](',');_0x26f453[_0x92b3('0x21')](_0x2918c3[0x0]);_0x26f453[_0x92b3('0x21')](_0x2918c3[0x1]);_0x26f453[_0x92b3('0x21')](_0x2918c3['slice'](0x2,_0x2918c3[_0x92b3('0x18')])[_0x92b3('0x1a')](','));break;case _0x92b3('0x24'):var _0x194f5e=_0xe025cb[_0x92b3('0x1f')][_0x92b3('0x20')](',');_0x26f453[_0x92b3('0x21')](_0x194f5e[0x0]);_0x26f453[_0x92b3('0x21')](_0x194f5e[0x1]);_0x26f453[_0x92b3('0x21')](_0x194f5e[0x2]);_0x26f453[_0x92b3('0x21')](_0x194f5e[0x3]);_0x26f453[_0x92b3('0x21')](_0x194f5e[_0x92b3('0x22')](0x4,_0x194f5e[_0x92b3('0x18')])[_0x92b3('0x1a')](','));break;case'message':_0x26f453[_0x92b3('0x21')](_0xe025cb[_0x92b3('0x1f')]);break;case _0x92b3('0x25'):_0x26f453[_0x92b3('0x21')](_0xe025cb['TagId']);_0x26f453[_0x92b3('0x21')](_0xe025cb['appdata']);break;default:_0x26f453=_[_0x92b3('0xe')](_0xe025cb[_0x92b3('0x1f')])?[]:_0xe025cb['appdata'][_0x92b3('0x20')](',');}var _0x473456={'id':util[_0x92b3('0x26')](_0x92b3('0x27'),_0x2e2026,_0xe025cb['id'],_0xe025cb[_0x92b3('0x1c')]),'condition':require(_0x92b3('0x28'))['condition'](_0x2e2026,getIntervals(_0x35639a[_0x92b3('0x29')],_0xe025cb),_0x35639a),'consequence':require('./applications/'+_0xe025cb[_0x92b3('0x1c')])[_0x92b3('0x2a')](_0x2e2026,_0x26f453,_0x35639a,_0x538256),'p':_0xe025cb[_0x92b3('0x2b')]||0x0};logger[_0x92b3('0x2c')](_0x92b3('0x2d'),_0x473456['id'],_0x92b3('0x2e'),getIntervals(_0x35639a[_0x92b3('0x29')],_0xe025cb)[_0x92b3('0x1a')](_0x92b3('0x2f')));_0x2d9494[_0x92b3('0x21')](_0x473456);}else{logger['error'](_0x92b3('0x30'),path['join'](__dirname,'applications',_0xe025cb[_0x92b3('0x1c')]+'.js'));}}_0x35639a[_0x92b3('0x13')][_0x2e2026]=new RuleEngine(_0x2d9494);_0x35639a[_0x92b3('0x13')][_0x2e2026][_0x92b3('0x31')](_0x538256,function(_0x36a52b){logger[_0x92b3('0x2c')](_0x92b3('0x32'),JSON[_0x92b3('0x33')](_0x36a52b['matchPath']));if(_0x35639a[_0x92b3('0x13')][_0x2e2026]){_0x35639a['rules'][_0x2e2026][_0x92b3('0x34')]('complete');}});return _0x5a62c5({'code':0xc8,'message':_0x538256});}else{logger[_0x92b3('0x2c')]('No\x20applications\x20to\x20execute');return _0x5a62c5({'code':0xc8,'message':_0x538256});}}catch(_0x5dc5c2){logger[_0x92b3('0x35')](_0x5dc5c2['stack']);return _0x36418f(_0x4e1be7['error'](0x1f4,_0x5dc5c2));}}return _0x36418f(_0x92b3('0x36'));});},'AcceptMessage':function(_0x495b56){var _0x485944=this;return new Promise(function(_0x2fcb0e,_0x30551c){if(_0x495b56[_0x92b3('0x15')]&&_0x495b56[_0x92b3('0x15')]['id']){try{var _0x4eb0a9=getId(_0x495b56['channel'],_0x495b56[_0x92b3('0x15')]?_0x495b56['message']['id']:0x0,_0x495b56['interaction']?_0x495b56[_0x92b3('0x16')]['id']:0x0);if(_0x35639a[_0x92b3('0x13')][_0x4eb0a9]){_0x35639a[_0x92b3('0x13')][_0x4eb0a9][_0x92b3('0x34')](_0x92b3('0x37'));if(rpc[_0x495b56[_0x92b3('0x14')]+_0x92b3('0x38')]){rpc[_0x495b56['channel']+_0x92b3('0x38')][_0x92b3('0x39')](_0x4eb0a9,{'UserId':_0x495b56[_0x92b3('0x15')][_0x92b3('0x3a')]})[_0x92b3('0x3b')](function(_0x3dc9fb){logger[_0x92b3('0x35')](_0x92b3('0x3c'));});}}return _0x2fcb0e({'code':0xc8,'message':_0x495b56});}catch(_0x4b587e){logger['error'](_0x4b587e[_0x92b3('0x3d')]);return _0x30551c(_0x485944[_0x92b3('0x35')](0x1f4,_0x4b587e));}}logger[_0x92b3('0x35')]('message\x20is\x20empty');return _0x30551c(_0x485944[_0x92b3('0x35')](0x1f4,_0x92b3('0x3e')));});},'RejectMessage':function(_0x23f54b){var _0x56e24d=this;return new Promise(function(_0x12623d,_0x45734c){if(_0x23f54b['agent']&&_0x23f54b[_0x92b3('0x3f')]['id']){try{if(_0x35639a[_0x92b3('0x40')][_0x23f54b[_0x92b3('0x3f')]['id']]){_0x35639a[_0x92b3('0x40')][_0x23f54b[_0x92b3('0x3f')]['id']]['busy']=![];_0x35639a[_0x92b3('0x40')][_0x23f54b[_0x92b3('0x3f')]['id']][_0x92b3('0x41')]=undefined;}return _0x12623d({'code':0xc8,'message':_0x23f54b});}catch(_0x3bc8ed){logger[_0x92b3('0x35')](_0x3bc8ed[_0x92b3('0x3d')]);return _0x45734c(_0x56e24d[_0x92b3('0x35')](0x1f4,_0x3bc8ed));}}logger[_0x92b3('0x35')]('message\x20is\x20empty');return _0x45734c(_0x56e24d[_0x92b3('0x35')](0x1f4,_0x92b3('0x3e')));});},'AbandonInteraction':function(_0x34db04){var _0x233fd4=this;return new Promise(function(_0x25d34d,_0x31688a){if(_0x34db04['channel']&&_0x34db04[_0x92b3('0x16')]&&_0x34db04[_0x92b3('0x16')]['id']){try{var _0x1a17d5=getId(_0x34db04[_0x92b3('0x14')],_0x34db04[_0x92b3('0x15')]?_0x34db04['message']['id']:0x0,_0x34db04[_0x92b3('0x16')]?_0x34db04['interaction']['id']:0x0);if(_0x35639a[_0x92b3('0x13')][_0x1a17d5]){_0x35639a['rules'][_0x1a17d5][_0x92b3('0x34')]('end');}return _0x25d34d({'code':0xc8,'message':_0x34db04});}catch(_0x181ff2){logger[_0x92b3('0x35')](_0x181ff2[_0x92b3('0x3d')]);return _0x31688a(_0x233fd4['error'](0x1f4,_0x181ff2));}}logger[_0x92b3('0x35')](_0x92b3('0x3e'));return _0x31688a(_0x233fd4[_0x92b3('0x35')](0x1f4,_0x92b3('0x3e')));});},'AgentCapacity':function(_0x43c336){var _0x1051f4=this;return new Promise(function(_0x37dcc1,_0x23c8f8){if(_0x35639a['agents'][_0x92b3('0x42')](_0x43c336['id'])){for(var _0x3d44be in _0x43c336['capacity']){if(_0x43c336['capacity'][_0x92b3('0x42')](_0x3d44be)){if(_0x35639a['agents'][_0x43c336['id']]['hasOwnProperty'](_0x3d44be+_0x92b3('0x43'))){_0x35639a[_0x92b3('0x40')][_0x43c336['id']][_0x3d44be+'CurrentCapacity']=parseInt(_0x43c336['capacity'][_0x3d44be],0xa);}}}_0x35639a[_0x92b3('0x40')][_0x43c336['id']][_0x92b3('0x44')]();return _0x37dcc1({'code':0xc8,'message':_0x35639a[_0x92b3('0x40')][_0x43c336['id']]});}else{return _0x23c8f8(_0x1051f4['error'](0x1f4,_0x92b3('0x45')));}});},'Agents':function(_0x29a9ca){return new Promise(function(_0x56f13d,_0x2944cf){var _0x25aad4=_[_0x92b3('0x46')](_0x35639a[_0x92b3('0x40')]);_0x56f13d({'count':_0x25aad4[_0x92b3('0x18')],'rows':_0x25aad4});});},'ChatQueues':function(_0x272a9d){return new Promise(function(_0x724895,_0x3ddac9){var _0x1401fd=[];for(var _0x1e8f81 in _0x35639a[_0x92b3('0x47')]){if(_0x35639a[_0x92b3('0x47')][_0x92b3('0x42')](_0x1e8f81)){var _0x190046=_0x35639a[_0x92b3('0x47')][_0x1e8f81];var _0x1a713b={'id':_0x190046['id'],'available':_0x190046['available'],'loggedIn':_0x190046[_0x92b3('0x48')],'name':_0x190046[_0x92b3('0x49')],'paused':_0x190046[_0x92b3('0x4a')],'waiting':_0x190046[_0x92b3('0x4b')]};_0x1401fd[_0x92b3('0x21')](_0x1a713b);}}_0x724895({'count':_0x1401fd['length'],'rows':_0x1401fd});});},'MailQueues':function(_0x5b3328){return new Promise(function(_0x5d5ba5,_0x56059b){var _0x3633cf=[];for(var _0x4bc0b6 in _0x35639a['mailQueues']){if(_0x35639a['mailQueues'][_0x92b3('0x42')](_0x4bc0b6)){var _0x36fd6b=_0x35639a[_0x92b3('0x4c')][_0x4bc0b6];var _0x4f3021={'id':_0x36fd6b['id'],'available':_0x36fd6b[_0x92b3('0x4d')],'loggedIn':_0x36fd6b[_0x92b3('0x48')],'name':_0x36fd6b['name'],'paused':_0x36fd6b[_0x92b3('0x4a')],'waiting':_0x36fd6b[_0x92b3('0x4b')]};_0x3633cf[_0x92b3('0x21')](_0x4f3021);}}_0x5d5ba5({'count':_0x3633cf[_0x92b3('0x18')],'rows':_0x3633cf});});},'OpenchannelQueues':function(_0x1772e9){return new Promise(function(_0x2201de,_0x2bbc13){var _0x3c87c7=[];for(var _0x4a3b38 in _0x35639a['openchannelQueues']){if(_0x35639a['openchannelQueues'][_0x92b3('0x42')](_0x4a3b38)){var _0xff4505=_0x35639a[_0x92b3('0x4e')][_0x4a3b38];var _0x198968={'id':_0xff4505['id'],'available':_0xff4505['available'],'loggedIn':_0xff4505[_0x92b3('0x48')],'name':_0xff4505[_0x92b3('0x49')],'paused':_0xff4505[_0x92b3('0x4a')],'waiting':_0xff4505[_0x92b3('0x4b')]};_0x3c87c7['push'](_0x198968);}}_0x2201de({'count':_0x3c87c7[_0x92b3('0x18')],'rows':_0x3c87c7});});},'SmsQueues':function(_0xa4515d){return new Promise(function(_0x24fa52,_0x436ff6){var _0x49437e=[];for(var _0x124c82 in _0x35639a[_0x92b3('0x4f')]){if(_0x35639a[_0x92b3('0x4f')][_0x92b3('0x42')](_0x124c82)){var _0xa81b9e=_0x35639a[_0x92b3('0x4f')][_0x124c82];var _0x505b05={'id':_0xa81b9e['id'],'available':_0xa81b9e['available'],'loggedIn':_0xa81b9e[_0x92b3('0x48')],'name':_0xa81b9e[_0x92b3('0x49')],'paused':_0xa81b9e['paused'],'waiting':_0xa81b9e[_0x92b3('0x4b')]};_0x49437e[_0x92b3('0x21')](_0x505b05);}}_0x24fa52({'count':_0x49437e['length'],'rows':_0x49437e});});},'FaxQueues':function(_0x12f67b){return new Promise(function(_0xc7c916,_0x389535){var _0x209127=[];for(var _0x1dfb5b in _0x35639a['faxQueues']){if(_0x35639a[_0x92b3('0x50')][_0x92b3('0x42')](_0x1dfb5b)){var _0x18a1bf=_0x35639a[_0x92b3('0x50')][_0x1dfb5b];var _0x2f2e15={'id':_0x18a1bf['id'],'available':_0x18a1bf['available'],'loggedIn':_0x18a1bf[_0x92b3('0x48')],'name':_0x18a1bf['name'],'paused':_0x18a1bf[_0x92b3('0x4a')],'waiting':_0x18a1bf[_0x92b3('0x4b')]};_0x209127[_0x92b3('0x21')](_0x2f2e15);}}_0xc7c916({'count':_0x209127['length'],'rows':_0x209127});});},'WhatsappQueues':function(_0x121892){return new Promise(function(_0x397079,_0x9187fd){var _0xe42a6b=[];for(var _0x473d15 in _0x35639a[_0x92b3('0x51')]){if(_0x35639a['whatsappQueues']['hasOwnProperty'](_0x473d15)){var _0x4cce0a=_0x35639a[_0x92b3('0x51')][_0x473d15];var _0x2360ef={'id':_0x4cce0a['id'],'available':_0x4cce0a[_0x92b3('0x4d')],'loggedIn':_0x4cce0a[_0x92b3('0x48')],'name':_0x4cce0a[_0x92b3('0x49')],'paused':_0x4cce0a['paused'],'waiting':_0x4cce0a['waiting']};_0xe42a6b[_0x92b3('0x21')](_0x2360ef);}}_0x397079({'count':_0xe42a6b[_0x92b3('0x18')],'rows':_0xe42a6b});});},'ChatQueuesWaitingInteractions':function(_0x4ef93b){return new Promise(function(_0x91e97e,_0x314676){var _0x18bec7=_[_0x92b3('0x46')](_0x35639a[_0x92b3('0x52')]);_0x91e97e({'count':_0x18bec7[_0x92b3('0x18')],'rows':_0x18bec7});});},'MailQueuesWaitingInteractions':function(_0x2daa50){return new Promise(function(_0xe0a30,_0x104977){var _0x5ce769=_[_0x92b3('0x46')](_0x35639a[_0x92b3('0x53')]);_0xe0a30({'count':_0x5ce769[_0x92b3('0x18')],'rows':_0x5ce769});});},'OpenchannelQueuesWaitingInteractions':function(_0x3a91d8){return new Promise(function(_0x247470,_0x37d870){var _0x4eb787=_[_0x92b3('0x46')](_0x35639a[_0x92b3('0x54')]);_0x247470({'count':_0x4eb787[_0x92b3('0x18')],'rows':_0x4eb787});});},'SmsQueuesWaitingInteractions':function(_0x1c6332){return new Promise(function(_0x54e206,_0x414bc6){var _0x1f8208=_['values'](_0x35639a[_0x92b3('0x55')]);_0x54e206({'count':_0x1f8208['length'],'rows':_0x1f8208});});},'FaxQueuesWaitingInteractions':function(_0x56a132){return new Promise(function(_0x485755,_0x27e3f9){var _0x136b11=_[_0x92b3('0x46')](_0x35639a[_0x92b3('0x56')]);_0x485755({'count':_0x136b11[_0x92b3('0x18')],'rows':_0x136b11});});},'WhatsappQueuesWaitingInteractions':function(_0x2be8bf){return new Promise(function(_0xa8c85a,_0x275754){var _0x253378=_[_0x92b3('0x46')](_0x35639a[_0x92b3('0x57')]);_0xa8c85a({'count':_0x253378[_0x92b3('0x18')],'rows':_0x253378});});}};var _0x3bc581=jayson[_0x92b3('0x58')](_0x379ec3)[_0x92b3('0x59')]();_0x3bc581['on'](_0x92b3('0x35'),function(_0x5c6b3b){logger['error'](JSON[_0x92b3('0x33')](_0x5c6b3b));return _0x4aa47b(_0x5c6b3b);});_0x3bc581[_0x92b3('0x12')](0x232c,_0x92b3('0x5a'),function(){console[_0x92b3('0x5b')]('Routing\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!',0x232c);return _0x42907a(_0x92b3('0x5c')+0x232c);});});}; \ No newline at end of file diff --git a/server/services/routing/server/interval.js b/server/services/routing/server/interval.js index e40725e..d6109bf 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 _0x1478=['client','http','request','then','error','message','catch','condition','rules','info','[%s][INTERVAL]\x20ROUTING\x20STOPPED','stop','push','Command','iftime\x20%s','indexOf','true','[%s][INTERVAL]\x20%s','all','some','[%s][INTERVAL]\x20%s\x20%s','join','\x20|\x20','when','log','../../../config/logger','routing'];(function(_0x368806,_0x360d78){var _0xa5d327=function(_0x596c2a){while(--_0x596c2a){_0x368806['push'](_0x368806['shift']());}};_0xa5d327(++_0x360d78);}(_0x1478,0x1ae));var _0x8147=function(_0x270d0d,_0x3fe5af){_0x270d0d=_0x270d0d-0x0;var _0x1e000b=_0x1478[_0x270d0d];return _0x1e000b;};'use strict';var util=require('util');var BPromise=require('bluebird');var jayson=require('jayson/promise');var _=require('lodash');var logger=require(_0x8147('0x0'))(_0x8147('0x1'));var client=jayson[_0x8147('0x2')][_0x8147('0x3')]({'port':0x232a});function request(_0x369d54,_0x28bfac){return new BPromise(function(_0x47019e,_0xfd6b49){return client[_0x8147('0x4')](_0x369d54,_0x28bfac)[_0x8147('0x5')](function(_0x5e38ae){if(_0x5e38ae[_0x8147('0x6')]){return _0xfd6b49(_0x5e38ae['error'][_0x8147('0x7')]);}else{return _0x47019e(_0x5e38ae['result']);}})[_0x8147('0x8')](function(_0xd97877){return _0xfd6b49(_0xd97877);});});}exports[_0x8147('0x9')]=function(_0x265f0b,_0x226752,_0x4c3ac1){return function(_0x5a8470){if(_0x4c3ac1[_0x8147('0xa')]&&!_0x4c3ac1[_0x8147('0xa')][_0x265f0b]){logger[_0x8147('0xb')](_0x8147('0xc'),_0x265f0b);return _0x5a8470[_0x8147('0xd')]();}var _0x1b0f7e=[];for(var _0x5ecba7=0x0;_0x5ecba7<_0x226752['length'];_0x5ecba7+=0x1){_0x1b0f7e[_0x8147('0xe')](request(_0x8147('0xf'),{'command':util['format'](_0x8147('0x10'),_0x226752[_0x5ecba7])})[_0x8147('0x5')](function(_0x18c70e){return _0x18c70e&&_0x18c70e['message']&&_0x18c70e[_0x8147('0x7')][_0x8147('0x11')](_0x8147('0x12'))>=0x0?!![]:![];})['catch'](function(_0x3f2a5a){logger[_0x8147('0x6')](_0x8147('0x13'),_0x265f0b,_0x226752[_0x5ecba7]);}));}BPromise[_0x8147('0x14')](_0x1b0f7e)[_0x8147('0x5')](function(_0x2db10e){var _0x1f50c7=_[_0x8147('0x15')](_0x2db10e);logger[_0x8147('0xb')](_0x8147('0x16'),_0x265f0b,_0x226752[_0x8147('0x17')](_0x8147('0x18')),_0x1f50c7);_0x5a8470[_0x8147('0x19')](_0x1f50c7);})[_0x8147('0x8')](function(_0x4f2c66){console[_0x8147('0x1a')](_0x4f2c66);logger[_0x8147('0x6')](_0x8147('0x16'),_0x265f0b,_0x226752['join'](_0x8147('0x18')),_0x4f2c66['stack']);_0x5a8470[_0x8147('0xd')]();});};}; \ No newline at end of file +var _0xc77d=['true','[%s][INTERVAL]\x20%s','all','some','[%s][INTERVAL]\x20%s\x20%s','join','\x20|\x20','when','log','stack','stop','util','lodash','../../../config/logger','routing','request','error','message','catch','rules','info','[%s][INTERVAL]\x20ROUTING\x20STOPPED','push','Command','format','iftime\x20%s','then','indexOf'];(function(_0x24e832,_0x9c8319){var _0x352549=function(_0x5c182a){while(--_0x5c182a){_0x24e832['push'](_0x24e832['shift']());}};_0x352549(++_0x9c8319);}(_0xc77d,0x1af));var _0xdc77=function(_0x5283d4,_0x134a3b){_0x5283d4=_0x5283d4-0x0;var _0x2d0300=_0xc77d[_0x5283d4];return _0x2d0300;};'use strict';var util=require(_0xdc77('0x0'));var BPromise=require('bluebird');var jayson=require('jayson/promise');var _=require(_0xdc77('0x1'));var logger=require(_0xdc77('0x2'))(_0xdc77('0x3'));var client=jayson['client']['http']({'port':0x232a});function request(_0x562b84,_0x48c032){return new BPromise(function(_0x12d865,_0x35ccf1){return client[_0xdc77('0x4')](_0x562b84,_0x48c032)['then'](function(_0xc4e426){if(_0xc4e426[_0xdc77('0x5')]){return _0x35ccf1(_0xc4e426['error'][_0xdc77('0x6')]);}else{return _0x12d865(_0xc4e426['result']);}})[_0xdc77('0x7')](function(_0x5d0a3c){return _0x35ccf1(_0x5d0a3c);});});}exports['condition']=function(_0x587951,_0x517444,_0x5d3f32){return function(_0x348f8d){if(_0x5d3f32[_0xdc77('0x8')]&&!_0x5d3f32[_0xdc77('0x8')][_0x587951]){logger[_0xdc77('0x9')](_0xdc77('0xa'),_0x587951);return _0x348f8d['stop']();}var _0x56c6bf=[];for(var _0x317b6a=0x0;_0x317b6a<_0x517444['length'];_0x317b6a+=0x1){_0x56c6bf[_0xdc77('0xb')](request(_0xdc77('0xc'),{'command':util[_0xdc77('0xd')](_0xdc77('0xe'),_0x517444[_0x317b6a])})[_0xdc77('0xf')](function(_0x315440){return _0x315440&&_0x315440[_0xdc77('0x6')]&&_0x315440[_0xdc77('0x6')][_0xdc77('0x10')](_0xdc77('0x11'))>=0x0?!![]:![];})[_0xdc77('0x7')](function(_0x52176e){logger[_0xdc77('0x5')](_0xdc77('0x12'),_0x587951,_0x517444[_0x317b6a]);}));}BPromise[_0xdc77('0x13')](_0x56c6bf)['then'](function(_0x322ea7){var _0x233e6c=_[_0xdc77('0x14')](_0x322ea7);logger[_0xdc77('0x9')](_0xdc77('0x15'),_0x587951,_0x517444[_0xdc77('0x16')](_0xdc77('0x17')),_0x233e6c);_0x348f8d[_0xdc77('0x18')](_0x233e6c);})[_0xdc77('0x7')](function(_0x463bfe){console[_0xdc77('0x19')](_0x463bfe);logger[_0xdc77('0x5')](_0xdc77('0x15'),_0x587951,_0x517444[_0xdc77('0x16')](_0xdc77('0x17')),_0x463bfe[_0xdc77('0x1a')]);_0x348f8d[_0xdc77('0x1b')]();});};}; \ No newline at end of file diff --git a/server/services/xdr/agents.controller.js b/server/services/xdr/agents.controller.js index 17bbe2b..015aeef 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 _0xc5a5=['request','CreateVoiceAgentReport','destuniqueid','agentcalled','agentcalledAt','now','called','connectedlinename','error','stack','isNil','agentringnoanswer','agentringnoanswerAt','timeout','reason','ringtime','talktime','push','queuecallerabandon','forIn','abandoned','holdtime','agentconnect','agentconnectAt','connect','answered_elsewhere','answeredelsewheredestinationuniqueid','agentcomplete','agentcompleteAt','transfer','transfereruniqueid','transfertype','extension','transferuniqueid','attendedtransfer','origtransfereruniqueid','origtransfererlinkedid','secondtransfereruniqueid','ATTENDED','transferexten','origtransfererexten','transfereeuniqueid','agententerreason','clone','calleridname','secondtransfererlinkedid','secondtransfererexten','transfertargetuniqueid','hangup','rejected','splice','diffTime','complete','agent','lodash','util','./utils','format','AGENT|%s|%s|%s|%s|%s|%s|%s|%s','uniqueid','channel','queue','membername','interface','calleridnum','connectedlinenum','lastevent','getVoiceQueueByName','then','type','agentacw','acw','acwtime','acwTimeout'];(function(_0x173bb7,_0x43062b){var _0x171434=function(_0x5d6766){while(--_0x5d6766){_0x173bb7['push'](_0x173bb7['shift']());}};_0x171434(++_0x43062b);}(_0xc5a5,0x80));var _0x5c5a=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xc5a5[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x5c5a('0x0'));var util=require(_0x5c5a('0x1'));var utils=require(_0x5c5a('0x2'));var agents={};var transfers={};var unanswered=[];function writeDB(_0x136700,_0x4b3646){utils['info'](util[_0x5c5a('0x3')](_0x5c5a('0x4'),_0x136700[_0x5c5a('0x5')],_0x136700[_0x5c5a('0x6')],_0x136700[_0x5c5a('0x7')],_0x136700[_0x5c5a('0x8')],_0x136700[_0x5c5a('0x9')],_0x136700[_0x5c5a('0xa')],_0x136700[_0x5c5a('0xb')],_0x136700[_0x5c5a('0xc')]));if(_0x136700[_0x5c5a('0x7')]){utils[_0x5c5a('0xd')](_0x136700[_0x5c5a('0x7')])[_0x5c5a('0xe')](function(_0x35c9bb){if(_0x35c9bb){_0x136700[_0x5c5a('0xf')]=_0x35c9bb[_0x5c5a('0xf')];_0x136700[_0x5c5a('0x10')]=_0x136700['agentcomplete']?_0x35c9bb[_0x5c5a('0x11')]:![];_0x136700[_0x5c5a('0x12')]=_0x136700[_0x5c5a('0x10')]?_0x35c9bb[_0x5c5a('0x13')]:0x0;}utils[_0x5c5a('0x14')](_0x5c5a('0x15'),_0x136700);});}else{utils[_0x5c5a('0x14')](_0x5c5a('0x15'),_0x136700);}if(_0x4b3646){delete transfers[_0x136700[_0x5c5a('0x5')]];}else{delete agents[_0x136700[_0x5c5a('0x16')]];}}exports[_0x5c5a('0x17')]=function(_0x81baea){try{agents[_0x81baea['destuniqueid']]=_0x81baea;agents[_0x81baea[_0x5c5a('0x16')]][_0x5c5a('0x18')]=utils[_0x5c5a('0x19')]();agents[_0x81baea[_0x5c5a('0x16')]][_0x5c5a('0xc')]=_0x5c5a('0x1a');agents[_0x81baea[_0x5c5a('0x16')]][_0x5c5a('0xb')]=null;agents[_0x81baea[_0x5c5a('0x16')]][_0x5c5a('0x1b')]=null;}catch(_0x7b9876){utils[_0x5c5a('0x1c')](_0x7b9876[_0x5c5a('0x1d')]);}};exports['agentringnoanswer']=function(_0x274a35){try{if(!_[_0x5c5a('0x1e')](agents[_0x274a35[_0x5c5a('0x16')]])){agents[_0x274a35[_0x5c5a('0x16')]][_0x5c5a('0x1f')]=!![];agents[_0x274a35[_0x5c5a('0x16')]][_0x5c5a('0x20')]=utils[_0x5c5a('0x19')]();agents[_0x274a35[_0x5c5a('0x16')]]['lastevent']=_0x5c5a('0x21');agents[_0x274a35[_0x5c5a('0x16')]][_0x5c5a('0x22')]=_0x5c5a('0x21');agents[_0x274a35[_0x5c5a('0x16')]]['holdtime']=_0x274a35[_0x5c5a('0x23')]?parseInt(_0x274a35[_0x5c5a('0x23')])/0x3e8:0x0;agents[_0x274a35[_0x5c5a('0x16')]][_0x5c5a('0x24')]=0x0;unanswered[_0x5c5a('0x25')](_0x274a35['destuniqueid']);}}catch(_0x211dd9){utils[_0x5c5a('0x1c')](_0x211dd9['stack']);}};exports[_0x5c5a('0x26')]=function(_0x546a8b){try{_[_0x5c5a('0x27')](agents,function(_0x51037d,_0x5ecea0){if(_0x51037d[_0x5c5a('0x5')]==_0x546a8b['uniqueid']&&!_['includes'](unanswered,_0x51037d[_0x5c5a('0x16')])){_0x51037d[_0x5c5a('0x1f')]=!![];_0x51037d[_0x5c5a('0x20')]=utils[_0x5c5a('0x19')]();_0x51037d[_0x5c5a('0xc')]=_0x5c5a('0x28');_0x51037d[_0x5c5a('0x22')]='abandoned';_0x51037d[_0x5c5a('0x29')]=_0x546a8b[_0x5c5a('0x29')];_0x51037d[_0x5c5a('0x24')]=0x0;writeDB(_0x51037d);}});}catch(_0x3885d3){utils[_0x5c5a('0x1c')](_0x3885d3[_0x5c5a('0x1d')]);}};exports[_0x5c5a('0x2a')]=function(_0x2b1d36){try{if(agents[_0x2b1d36[_0x5c5a('0x16')]]){agents[_0x2b1d36[_0x5c5a('0x16')]][_0x5c5a('0x2b')]=utils[_0x5c5a('0x19')]();agents[_0x2b1d36[_0x5c5a('0x16')]]['connectedlinenum']=_0x2b1d36[_0x5c5a('0xb')];agents[_0x2b1d36[_0x5c5a('0x16')]][_0x5c5a('0x1b')]=_0x2b1d36[_0x5c5a('0x1b')];agents[_0x2b1d36[_0x5c5a('0x16')]]['holdtime']=_0x2b1d36[_0x5c5a('0x23')];agents[_0x2b1d36[_0x5c5a('0x16')]]['lastevent']=_0x5c5a('0x2c');_[_0x5c5a('0x27')](agents,function(_0x45309a,_0x5a7586){if(_0x45309a[_0x5c5a('0x16')]!=_0x2b1d36[_0x5c5a('0x16')]&&_0x45309a[_0x5c5a('0x5')]==_0x2b1d36['uniqueid']){_0x45309a[_0x5c5a('0x24')]=0x0;_0x45309a[_0x5c5a('0x29')]=_0x2b1d36[_0x5c5a('0x23')];_0x45309a[_0x5c5a('0x1f')]=!![];_0x45309a[_0x5c5a('0x20')]=utils[_0x5c5a('0x19')]();_0x45309a[_0x5c5a('0xc')]=_0x5c5a('0x2d');_0x45309a[_0x5c5a('0x22')]=_0x5c5a('0x2d');_0x45309a[_0x5c5a('0x2e')]=_0x2b1d36[_0x5c5a('0x16')];_0x45309a['answeredelsewheremembername']=_0x2b1d36[_0x5c5a('0x8')];writeDB(_0x45309a);}});}}catch(_0x274d1e){utils[_0x5c5a('0x1c')](_0x274d1e['stack']);}};exports[_0x5c5a('0x2f')]=function(_0x5786db){try{if(!_[_0x5c5a('0x1e')](agents[_0x5786db[_0x5c5a('0x16')]])){agents[_0x5786db[_0x5c5a('0x16')]]['agentcomplete']=!![];agents[_0x5786db['destuniqueid']][_0x5c5a('0x30')]=utils[_0x5c5a('0x19')]();agents[_0x5786db[_0x5c5a('0x16')]]['talktime']=utils['diffTime'](agents[_0x5786db[_0x5c5a('0x16')]]['agentcompleteAt'],agents[_0x5786db[_0x5c5a('0x16')]]['agentconnectAt']);agents[_0x5786db[_0x5c5a('0x16')]][_0x5c5a('0x22')]=_0x5786db[_0x5c5a('0x22')];agents[_0x5786db['destuniqueid']][_0x5c5a('0xc')]='complete';writeDB(agents[_0x5786db[_0x5c5a('0x16')]]);}}catch(_0x2cac52){utils[_0x5c5a('0x1c')](_0x2cac52['stack']);}};exports['blindtransfer']=function(_0x13d363){try{if(!_[_0x5c5a('0x1e')](agents[_0x13d363['transfereruniqueid']])){agents[_0x13d363['transfereruniqueid']][_0x5c5a('0x31')]=!![];agents[_0x13d363[_0x5c5a('0x32')]][_0x5c5a('0x33')]='blind';agents[_0x13d363[_0x5c5a('0x32')]]['transferexten']=_0x13d363[_0x5c5a('0x34')];agents[_0x13d363[_0x5c5a('0x32')]][_0x5c5a('0x35')]=agents[_0x13d363[_0x5c5a('0x32')]]['uniqueid'];}}catch(_0x2e4901){utils['error'](_0x2e4901['stack']);}};exports[_0x5c5a('0x36')]=function(_0x427786){try{if(_0x427786[_0x5c5a('0x37')]==_0x427786[_0x5c5a('0x38')]){if(!_[_0x5c5a('0x1e')](agents[_0x427786['secondtransfereruniqueid']])){agents[_0x427786[_0x5c5a('0x39')]]['transfer']=!![];agents[_0x427786['secondtransfereruniqueid']][_0x5c5a('0x33')]=_0x5c5a('0x3a');agents[_0x427786['secondtransfereruniqueid']][_0x5c5a('0x3b')]=_0x427786[_0x5c5a('0x3c')];agents[_0x427786['secondtransfereruniqueid']]['transferuniqueid']=_0x427786[_0x5c5a('0x37')];}if(_0x427786['transfereeuniqueid']&&agents[_0x427786[_0x5c5a('0x3d')]]){agents[_0x427786[_0x5c5a('0x3d')]][_0x5c5a('0x3e')]=0x1;transfers[_0x427786[_0x5c5a('0x3d')]]=_[_0x5c5a('0x3f')](agents[_0x427786['transfereeuniqueid']]);transfers[_0x427786[_0x5c5a('0x3d')]]['calleridnum']=agents[_0x427786[_0x5c5a('0x39')]][_0x5c5a('0xa')];transfers[_0x427786[_0x5c5a('0x3d')]][_0x5c5a('0x40')]=agents[_0x427786['secondtransfereruniqueid']][_0x5c5a('0x40')];transfers[_0x427786[_0x5c5a('0x3d')]][_0x5c5a('0x18')]=utils[_0x5c5a('0x19')]();transfers[_0x427786[_0x5c5a('0x3d')]][_0x5c5a('0x2b')]=utils[_0x5c5a('0x19')]();transfers[_0x427786[_0x5c5a('0x3d')]]['holdtime']=0x0;transfers[_0x427786[_0x5c5a('0x3d')]][_0x5c5a('0x3e')]=0x2;}}else if(_0x427786['secondtransfereruniqueid']==_0x427786[_0x5c5a('0x41')]){if(!_[_0x5c5a('0x1e')](agents[_0x427786[_0x5c5a('0x37')]])){agents[_0x427786['origtransfereruniqueid']][_0x5c5a('0x31')]=!![];agents[_0x427786[_0x5c5a('0x37')]][_0x5c5a('0x33')]=_0x5c5a('0x3a');agents[_0x427786[_0x5c5a('0x37')]]['transferexten']=_0x427786[_0x5c5a('0x42')];agents[_0x427786[_0x5c5a('0x37')]][_0x5c5a('0x35')]=_0x427786[_0x5c5a('0x39')];}if(_0x427786['transfertargetuniqueid']&&agents[_0x427786[_0x5c5a('0x43')]]){agents[_0x427786['transfertargetuniqueid']][_0x5c5a('0x3e')]=0x1;transfers[_0x427786[_0x5c5a('0x43')]]=_[_0x5c5a('0x3f')](agents[_0x427786['transfertargetuniqueid']]);transfers[_0x427786[_0x5c5a('0x43')]][_0x5c5a('0xa')]=agents[_0x427786[_0x5c5a('0x37')]][_0x5c5a('0xa')];transfers[_0x427786[_0x5c5a('0x43')]][_0x5c5a('0x40')]=agents[_0x427786[_0x5c5a('0x37')]][_0x5c5a('0x40')];transfers[_0x427786[_0x5c5a('0x43')]][_0x5c5a('0x18')]=utils['now']();transfers[_0x427786[_0x5c5a('0x43')]][_0x5c5a('0x2b')]=utils[_0x5c5a('0x19')]();transfers[_0x427786[_0x5c5a('0x43')]][_0x5c5a('0x29')]=0x0;transfers[_0x427786['transfertargetuniqueid']][_0x5c5a('0x3e')]=0x2;}}}catch(_0x1b044b){utils[_0x5c5a('0x1c')](_0x1b044b['stack']);}};exports[_0x5c5a('0x44')]=function(_0x41b232){try{if(agents[_0x41b232[_0x5c5a('0x5')]]&&agents[_0x41b232[_0x5c5a('0x5')]][_0x5c5a('0x22')]===_0x5c5a('0x21')){if(_0x41b232['cause']==='21'){agents[_0x41b232['uniqueid']][_0x5c5a('0x22')]='rejected';agents[_0x41b232[_0x5c5a('0x5')]][_0x5c5a('0xc')]=_0x5c5a('0x45');}writeDB(agents[_0x41b232[_0x5c5a('0x5')]]);var _0x27c606=unanswered['indexOf'](_0x41b232['uniqueid']);if(_0x27c606>-0x1)unanswered[_0x5c5a('0x46')](_0x27c606,0x1);}if(transfers[_0x41b232[_0x5c5a('0x5')]]){transfers[_0x41b232[_0x5c5a('0x5')]][_0x5c5a('0x2f')]=!![];transfers[_0x41b232['uniqueid']][_0x5c5a('0x30')]=utils[_0x5c5a('0x19')]();transfers[_0x41b232[_0x5c5a('0x5')]][_0x5c5a('0x24')]=utils[_0x5c5a('0x47')](transfers[_0x41b232[_0x5c5a('0x5')]][_0x5c5a('0x30')],transfers[_0x41b232[_0x5c5a('0x5')]][_0x5c5a('0x2b')]);transfers[_0x41b232[_0x5c5a('0x5')]][_0x5c5a('0x22')]='agent';transfers[_0x41b232['uniqueid']][_0x5c5a('0xc')]=_0x5c5a('0x48');writeDB(transfers[_0x41b232[_0x5c5a('0x5')]],!![]);}if(agents[_0x41b232[_0x5c5a('0x5')]]&&agents[_0x41b232[_0x5c5a('0x5')]][_0x5c5a('0x2b')]){agents[_0x41b232[_0x5c5a('0x5')]][_0x5c5a('0x2f')]=!![];agents[_0x41b232[_0x5c5a('0x5')]][_0x5c5a('0x30')]=utils[_0x5c5a('0x19')]();agents[_0x41b232[_0x5c5a('0x5')]][_0x5c5a('0x24')]=utils[_0x5c5a('0x47')](agents[_0x41b232[_0x5c5a('0x5')]][_0x5c5a('0x30')],agents[_0x41b232[_0x5c5a('0x5')]][_0x5c5a('0x2b')]);agents[_0x41b232[_0x5c5a('0x5')]][_0x5c5a('0x22')]=agents[_0x41b232[_0x5c5a('0x5')]][_0x5c5a('0x31')]?'transfer':_0x5c5a('0x49');agents[_0x41b232[_0x5c5a('0x5')]][_0x5c5a('0xc')]='complete';writeDB(agents[_0x41b232[_0x5c5a('0x5')]]);}}catch(_0x3b07e0){utils['error'](_0x3b07e0[_0x5c5a('0x1d')]);}}; \ No newline at end of file +var _0x97c8=['origtransfererlinkedid','secondtransfereruniqueid','transferuniqueid','transfereeuniqueid','agententerreason','clone','calleridnum','calleridname','ATTENDED','secondtransfererexten','transfertargetuniqueid','hangup','rejected','indexOf','splice','agent','util','./utils','format','AGENT|%s|%s|%s|%s|%s|%s|%s|%s','uniqueid','queue','membername','interface','connectedlinenum','lastevent','then','type','agentacw','agentcomplete','acwtime','request','CreateVoiceAgentReport','destuniqueid','agentcalled','agentcalledAt','now','called','error','stack','agentringnoanswer','agentringnoanswerAt','timeout','reason','holdtime','push','forIn','includes','abandoned','talktime','agentconnect','agentconnectAt','connectedlinename','ringtime','connect','answered_elsewhere','answeredelsewheredestinationuniqueid','answeredelsewheremembername','isNil','diffTime','agentcompleteAt','complete','transfereruniqueid','transfer','transfertype','blind','transferexten','extension','attendedtransfer','origtransfereruniqueid'];(function(_0x236d24,_0x29e80a){var _0x1574cf=function(_0x5d1dad){while(--_0x5d1dad){_0x236d24['push'](_0x236d24['shift']());}};_0x1574cf(++_0x29e80a);}(_0x97c8,0x1b4));var _0x897c=function(_0xe89d97,_0x33e5ac){_0xe89d97=_0xe89d97-0x0;var _0x1b6e5d=_0x97c8[_0xe89d97];return _0x1b6e5d;};'use strict';var _=require('lodash');var util=require(_0x897c('0x0'));var utils=require(_0x897c('0x1'));var agents={};var transfers={};var unanswered=[];function writeDB(_0x4d5c7f,_0x34d914){utils['info'](util[_0x897c('0x2')](_0x897c('0x3'),_0x4d5c7f[_0x897c('0x4')],_0x4d5c7f['channel'],_0x4d5c7f[_0x897c('0x5')],_0x4d5c7f[_0x897c('0x6')],_0x4d5c7f[_0x897c('0x7')],_0x4d5c7f['calleridnum'],_0x4d5c7f[_0x897c('0x8')],_0x4d5c7f[_0x897c('0x9')]));if(_0x4d5c7f[_0x897c('0x5')]){utils['getVoiceQueueByName'](_0x4d5c7f[_0x897c('0x5')])[_0x897c('0xa')](function(_0x31f2a){if(_0x31f2a){_0x4d5c7f[_0x897c('0xb')]=_0x31f2a['type'];_0x4d5c7f[_0x897c('0xc')]=_0x4d5c7f[_0x897c('0xd')]?_0x31f2a['acw']:![];_0x4d5c7f[_0x897c('0xe')]=_0x4d5c7f['agentacw']?_0x31f2a['acwTimeout']:0x0;}utils[_0x897c('0xf')](_0x897c('0x10'),_0x4d5c7f);});}else{utils[_0x897c('0xf')](_0x897c('0x10'),_0x4d5c7f);}if(_0x34d914){delete transfers[_0x4d5c7f['uniqueid']];}else{delete agents[_0x4d5c7f[_0x897c('0x11')]];}}exports[_0x897c('0x12')]=function(_0x2e6232){try{agents[_0x2e6232[_0x897c('0x11')]]=_0x2e6232;agents[_0x2e6232['destuniqueid']][_0x897c('0x13')]=utils[_0x897c('0x14')]();agents[_0x2e6232[_0x897c('0x11')]][_0x897c('0x9')]=_0x897c('0x15');agents[_0x2e6232['destuniqueid']][_0x897c('0x8')]=null;agents[_0x2e6232[_0x897c('0x11')]]['connectedlinename']=null;}catch(_0x794d46){utils[_0x897c('0x16')](_0x794d46[_0x897c('0x17')]);}};exports[_0x897c('0x18')]=function(_0x349c44){try{if(!_['isNil'](agents[_0x349c44[_0x897c('0x11')]])){agents[_0x349c44[_0x897c('0x11')]]['agentringnoanswer']=!![];agents[_0x349c44['destuniqueid']][_0x897c('0x19')]=utils['now']();agents[_0x349c44[_0x897c('0x11')]]['lastevent']=_0x897c('0x1a');agents[_0x349c44[_0x897c('0x11')]][_0x897c('0x1b')]='timeout';agents[_0x349c44['destuniqueid']][_0x897c('0x1c')]=_0x349c44['ringtime']?parseInt(_0x349c44['ringtime'])/0x3e8:0x0;agents[_0x349c44[_0x897c('0x11')]]['talktime']=0x0;unanswered[_0x897c('0x1d')](_0x349c44['destuniqueid']);}}catch(_0x2c76c9){utils[_0x897c('0x16')](_0x2c76c9[_0x897c('0x17')]);}};exports['queuecallerabandon']=function(_0x82bd9){try{_[_0x897c('0x1e')](agents,function(_0x2b87c8,_0x4bb54e){if(_0x2b87c8['uniqueid']==_0x82bd9[_0x897c('0x4')]&&!_[_0x897c('0x1f')](unanswered,_0x2b87c8[_0x897c('0x11')])){_0x2b87c8[_0x897c('0x18')]=!![];_0x2b87c8[_0x897c('0x19')]=utils[_0x897c('0x14')]();_0x2b87c8['lastevent']='abandoned';_0x2b87c8[_0x897c('0x1b')]=_0x897c('0x20');_0x2b87c8['holdtime']=_0x82bd9['holdtime'];_0x2b87c8[_0x897c('0x21')]=0x0;writeDB(_0x2b87c8);}});}catch(_0x37a3e7){utils[_0x897c('0x16')](_0x37a3e7[_0x897c('0x17')]);}};exports[_0x897c('0x22')]=function(_0x5e7714){try{if(agents[_0x5e7714[_0x897c('0x11')]]){agents[_0x5e7714[_0x897c('0x11')]][_0x897c('0x23')]=utils[_0x897c('0x14')]();agents[_0x5e7714[_0x897c('0x11')]][_0x897c('0x8')]=_0x5e7714[_0x897c('0x8')];agents[_0x5e7714['destuniqueid']]['connectedlinename']=_0x5e7714[_0x897c('0x24')];agents[_0x5e7714[_0x897c('0x11')]][_0x897c('0x1c')]=_0x5e7714[_0x897c('0x25')];agents[_0x5e7714[_0x897c('0x11')]][_0x897c('0x9')]=_0x897c('0x26');_['forIn'](agents,function(_0x4583c0,_0x53ea7b){if(_0x4583c0[_0x897c('0x11')]!=_0x5e7714[_0x897c('0x11')]&&_0x4583c0[_0x897c('0x4')]==_0x5e7714[_0x897c('0x4')]){_0x4583c0[_0x897c('0x21')]=0x0;_0x4583c0[_0x897c('0x1c')]=_0x5e7714[_0x897c('0x25')];_0x4583c0[_0x897c('0x18')]=!![];_0x4583c0[_0x897c('0x19')]=utils['now']();_0x4583c0['lastevent']=_0x897c('0x27');_0x4583c0[_0x897c('0x1b')]=_0x897c('0x27');_0x4583c0[_0x897c('0x28')]=_0x5e7714['destuniqueid'];_0x4583c0[_0x897c('0x29')]=_0x5e7714[_0x897c('0x6')];writeDB(_0x4583c0);}});}}catch(_0x4a96c8){utils[_0x897c('0x16')](_0x4a96c8[_0x897c('0x17')]);}};exports[_0x897c('0xd')]=function(_0x1e1f81){try{if(!_[_0x897c('0x2a')](agents[_0x1e1f81[_0x897c('0x11')]])){agents[_0x1e1f81[_0x897c('0x11')]][_0x897c('0xd')]=!![];agents[_0x1e1f81[_0x897c('0x11')]]['agentcompleteAt']=utils['now']();agents[_0x1e1f81[_0x897c('0x11')]][_0x897c('0x21')]=utils[_0x897c('0x2b')](agents[_0x1e1f81['destuniqueid']][_0x897c('0x2c')],agents[_0x1e1f81[_0x897c('0x11')]][_0x897c('0x23')]);agents[_0x1e1f81['destuniqueid']][_0x897c('0x1b')]=_0x1e1f81['reason'];agents[_0x1e1f81[_0x897c('0x11')]]['lastevent']=_0x897c('0x2d');writeDB(agents[_0x1e1f81['destuniqueid']]);}}catch(_0x195fbd){utils[_0x897c('0x16')](_0x195fbd[_0x897c('0x17')]);}};exports['blindtransfer']=function(_0x15cbfc){try{if(!_[_0x897c('0x2a')](agents[_0x15cbfc['transfereruniqueid']])){agents[_0x15cbfc[_0x897c('0x2e')]][_0x897c('0x2f')]=!![];agents[_0x15cbfc[_0x897c('0x2e')]][_0x897c('0x30')]=_0x897c('0x31');agents[_0x15cbfc[_0x897c('0x2e')]][_0x897c('0x32')]=_0x15cbfc[_0x897c('0x33')];agents[_0x15cbfc[_0x897c('0x2e')]]['transferuniqueid']=agents[_0x15cbfc[_0x897c('0x2e')]]['uniqueid'];}}catch(_0x1b6035){utils['error'](_0x1b6035['stack']);}};exports[_0x897c('0x34')]=function(_0x49af69){try{if(_0x49af69[_0x897c('0x35')]==_0x49af69[_0x897c('0x36')]){if(!_[_0x897c('0x2a')](agents[_0x49af69[_0x897c('0x37')]])){agents[_0x49af69[_0x897c('0x37')]]['transfer']=!![];agents[_0x49af69[_0x897c('0x37')]][_0x897c('0x30')]='ATTENDED';agents[_0x49af69['secondtransfereruniqueid']][_0x897c('0x32')]=_0x49af69['origtransfererexten'];agents[_0x49af69['secondtransfereruniqueid']][_0x897c('0x38')]=_0x49af69['origtransfereruniqueid'];}if(_0x49af69['transfereeuniqueid']&&agents[_0x49af69['transfereeuniqueid']]){agents[_0x49af69[_0x897c('0x39')]][_0x897c('0x3a')]=0x1;transfers[_0x49af69[_0x897c('0x39')]]=_[_0x897c('0x3b')](agents[_0x49af69[_0x897c('0x39')]]);transfers[_0x49af69['transfereeuniqueid']][_0x897c('0x3c')]=agents[_0x49af69[_0x897c('0x37')]][_0x897c('0x3c')];transfers[_0x49af69[_0x897c('0x39')]][_0x897c('0x3d')]=agents[_0x49af69[_0x897c('0x37')]][_0x897c('0x3d')];transfers[_0x49af69[_0x897c('0x39')]][_0x897c('0x13')]=utils[_0x897c('0x14')]();transfers[_0x49af69[_0x897c('0x39')]][_0x897c('0x23')]=utils['now']();transfers[_0x49af69['transfereeuniqueid']][_0x897c('0x1c')]=0x0;transfers[_0x49af69[_0x897c('0x39')]][_0x897c('0x3a')]=0x2;}}else if(_0x49af69[_0x897c('0x37')]==_0x49af69['secondtransfererlinkedid']){if(!_[_0x897c('0x2a')](agents[_0x49af69[_0x897c('0x35')]])){agents[_0x49af69[_0x897c('0x35')]]['transfer']=!![];agents[_0x49af69[_0x897c('0x35')]][_0x897c('0x30')]=_0x897c('0x3e');agents[_0x49af69['origtransfereruniqueid']][_0x897c('0x32')]=_0x49af69[_0x897c('0x3f')];agents[_0x49af69['origtransfereruniqueid']][_0x897c('0x38')]=_0x49af69[_0x897c('0x37')];}if(_0x49af69[_0x897c('0x40')]&&agents[_0x49af69[_0x897c('0x40')]]){agents[_0x49af69['transfertargetuniqueid']][_0x897c('0x3a')]=0x1;transfers[_0x49af69[_0x897c('0x40')]]=_[_0x897c('0x3b')](agents[_0x49af69[_0x897c('0x40')]]);transfers[_0x49af69[_0x897c('0x40')]]['calleridnum']=agents[_0x49af69[_0x897c('0x35')]][_0x897c('0x3c')];transfers[_0x49af69['transfertargetuniqueid']][_0x897c('0x3d')]=agents[_0x49af69[_0x897c('0x35')]]['calleridname'];transfers[_0x49af69[_0x897c('0x40')]][_0x897c('0x13')]=utils[_0x897c('0x14')]();transfers[_0x49af69['transfertargetuniqueid']][_0x897c('0x23')]=utils[_0x897c('0x14')]();transfers[_0x49af69[_0x897c('0x40')]][_0x897c('0x1c')]=0x0;transfers[_0x49af69[_0x897c('0x40')]][_0x897c('0x3a')]=0x2;}}}catch(_0x42f65b){utils[_0x897c('0x16')](_0x42f65b['stack']);}};exports[_0x897c('0x41')]=function(_0x3f9327){try{if(agents[_0x3f9327[_0x897c('0x4')]]&&agents[_0x3f9327['uniqueid']][_0x897c('0x1b')]===_0x897c('0x1a')){if(_0x3f9327['cause']==='21'){agents[_0x3f9327['uniqueid']][_0x897c('0x1b')]=_0x897c('0x42');agents[_0x3f9327['uniqueid']][_0x897c('0x9')]=_0x897c('0x42');}writeDB(agents[_0x3f9327[_0x897c('0x4')]]);var _0x270e06=unanswered[_0x897c('0x43')](_0x3f9327[_0x897c('0x4')]);if(_0x270e06>-0x1)unanswered[_0x897c('0x44')](_0x270e06,0x1);}if(transfers[_0x3f9327[_0x897c('0x4')]]){transfers[_0x3f9327[_0x897c('0x4')]]['agentcomplete']=!![];transfers[_0x3f9327[_0x897c('0x4')]][_0x897c('0x2c')]=utils[_0x897c('0x14')]();transfers[_0x3f9327[_0x897c('0x4')]][_0x897c('0x21')]=utils['diffTime'](transfers[_0x3f9327['uniqueid']][_0x897c('0x2c')],transfers[_0x3f9327['uniqueid']][_0x897c('0x23')]);transfers[_0x3f9327[_0x897c('0x4')]][_0x897c('0x1b')]=_0x897c('0x45');transfers[_0x3f9327['uniqueid']][_0x897c('0x9')]=_0x897c('0x2d');writeDB(transfers[_0x3f9327[_0x897c('0x4')]],!![]);}if(agents[_0x3f9327[_0x897c('0x4')]]&&agents[_0x3f9327[_0x897c('0x4')]][_0x897c('0x23')]){agents[_0x3f9327[_0x897c('0x4')]]['agentcomplete']=!![];agents[_0x3f9327['uniqueid']][_0x897c('0x2c')]=utils['now']();agents[_0x3f9327['uniqueid']][_0x897c('0x21')]=utils[_0x897c('0x2b')](agents[_0x3f9327[_0x897c('0x4')]][_0x897c('0x2c')],agents[_0x3f9327[_0x897c('0x4')]]['agentconnectAt']);agents[_0x3f9327[_0x897c('0x4')]]['reason']=agents[_0x3f9327['uniqueid']][_0x897c('0x2f')]?'transfer':_0x897c('0x45');agents[_0x3f9327[_0x897c('0x4')]][_0x897c('0x9')]='complete';writeDB(agents[_0x3f9327[_0x897c('0x4')]]);}}catch(_0x28814e){utils[_0x897c('0x16')](_0x28814e[_0x897c('0x17')]);}}; \ No newline at end of file diff --git a/server/services/xdr/calls.controller.js b/server/services/xdr/calls.controller.js index 7d51587..f874b57 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 _0x59f8=['transfertargetchannel','destinationchannel','origtransfererchannel','musiconholdstart','musiconholdstartAt','varset','variable','xmd-originatecalleridnum','value','xmd-phone','\x22\x20<','xmd-callerid-preview','xmd-callerid','xmd-queue','Queue','lastdata','queue','xmd-contactid','routeid','sipcallid','newexten','application','toLowerCase','set','appdata','substring','lastIndexOf','includes','hangup','noop','gotoif','lodash','util','./utils','FAILED','NO\x20ANSWER','BUSY','info','format','uniqueid','channel','type','accountcode','source','destination','disposition','then','CreateVoiceCallReport','request','linkedid','OutgoingSpoolFailed','calleridnum','exten','now','stack','newstate','isNil','channelstate','systemanswertime','answertime','toNumber','ANSWERED','error','callerid','calleridname','endtime','duration','diffTime','billableseconds','localtwolinkedid','transfereechannel','secondtransfererchannel','userfield','_attended'];(function(_0x45a8b4,_0x4d6432){var _0x2b4483=function(_0x49554d){while(--_0x49554d){_0x45a8b4['push'](_0x45a8b4['shift']());}};_0x2b4483(++_0x4d6432);}(_0x59f8,0x191));var _0x859f=function(_0x2a68d1,_0x30b274){_0x2a68d1=_0x2a68d1-0x0;var _0x144666=_0x59f8[_0x2a68d1];return _0x144666;};'use strict';var _=require(_0x859f('0x0'));var util=require(_0x859f('0x1'));var utils=require(_0x859f('0x2'));var dispositions=['NO\x20ANSWER','FAILED',_0x859f('0x3'),_0x859f('0x4'),_0x859f('0x4'),_0x859f('0x4'),'ANSWERED',_0x859f('0x5'),_0x859f('0x3'),_0x859f('0x3'),_0x859f('0x3')];var channels={};function writeDB(_0x4b3615){utils[_0x859f('0x6')](util[_0x859f('0x7')]('CALL|%s|%s|%s|%s|%s|%s|%s|%s',_0x4b3615[_0x859f('0x8')],_0x4b3615[_0x859f('0x9')],_0x4b3615[_0x859f('0xa')],_0x4b3615[_0x859f('0xb')],_0x4b3615[_0x859f('0xc')],_0x4b3615[_0x859f('0xd')],_0x4b3615['callerid'],_0x4b3615[_0x859f('0xe')]));if(_0x4b3615[_0x859f('0xb')]){utils['getUserByInternal'](_0x4b3615['accountcode'])[_0x859f('0xf')](function(_0x27dbb4){if(_0x27dbb4){_0x4b3615['UserId']=_0x27dbb4['id'];}utils['request'](_0x859f('0x10'),_0x4b3615);});}else{utils[_0x859f('0x11')]('CreateVoiceCallReport',_0x4b3615);}if(channels[_0x4b3615[_0x859f('0x8')]]){delete channels[_0x4b3615[_0x859f('0x8')]];}}exports['newchannel']=function(_0x7c073b){try{if(_0x7c073b[_0x859f('0x8')]==_0x7c073b[_0x859f('0x12')]&&_0x7c073b[_0x859f('0x9')]!=_0x859f('0x13')){channels[_0x7c073b[_0x859f('0x8')]]={'uniqueid':_0x7c073b[_0x859f('0x8')],'accountcode':_0x7c073b[_0x859f('0xb')],'source':_0x7c073b[_0x859f('0x14')],'destination':_0x7c073b[_0x859f('0x15')],'destinationcontext':_0x7c073b['context'],'channel':_0x7c073b['channel'],'starttime':utils[_0x859f('0x16')](),'answertime':null,'systemanswertime':null,'mohtime':0x0,'disposition':'NO\x20ANSWER','amaflags':'DOCUMENTATION'};}}catch(_0x32cee3){utils['error'](_0x32cee3[_0x859f('0x17')]);}};exports[_0x859f('0x18')]=function(_0x160047){try{if(!_[_0x859f('0x19')](channels[_0x160047[_0x859f('0x8')]])&&_0x160047[_0x859f('0x1a')]==0x6){if(_[_0x859f('0x19')](channels[_0x160047[_0x859f('0x8')]][_0x859f('0x1b')])){channels[_0x160047[_0x859f('0x8')]]['systemanswertime']=utils[_0x859f('0x16')]();}}else if(!_[_0x859f('0x19')](channels[_0x160047['linkedid']])&&_0x160047[_0x859f('0x1a')]==0x6&&_0x160047['context']!='transfer'){channels[_0x160047[_0x859f('0x12')]][_0x859f('0xb')]=_0x160047[_0x859f('0xb')];channels[_0x160047[_0x859f('0x12')]]['destinationchannel']=_0x160047[_0x859f('0x9')];if(_[_0x859f('0x19')](channels[_0x160047[_0x859f('0x12')]]['answertime'])){channels[_0x160047['linkedid']][_0x859f('0x1c')]=utils[_0x859f('0x16')]();}channels[_0x160047[_0x859f('0x12')]][_0x859f('0xe')]=dispositions[_[_0x859f('0x1d')](_0x160047[_0x859f('0x1a')])]||_0x859f('0x1e');}}catch(_0x1f5785){utils[_0x859f('0x1f')](_0x1f5785['stack']);}};exports['hangup']=function(_0x97c39){try{if(!_[_0x859f('0x19')](channels[_0x97c39[_0x859f('0x8')]])){if(_[_0x859f('0x19')](channels[_0x97c39[_0x859f('0x8')]][_0x859f('0x20')])){channels[_0x97c39['uniqueid']][_0x859f('0x20')]=_0x97c39[_0x859f('0x21')]+'\x20<'+_0x97c39['calleridnum']+'>';}channels[_0x97c39[_0x859f('0x8')]][_0x859f('0x22')]=utils[_0x859f('0x16')]();channels[_0x97c39[_0x859f('0x8')]][_0x859f('0x23')]=utils[_0x859f('0x24')](channels[_0x97c39[_0x859f('0x8')]][_0x859f('0x22')],channels[_0x97c39[_0x859f('0x8')]]['starttime']);channels[_0x97c39[_0x859f('0x8')]][_0x859f('0x25')]=channels[_0x97c39[_0x859f('0x8')]][_0x859f('0x1c')]?utils[_0x859f('0x24')](channels[_0x97c39[_0x859f('0x8')]][_0x859f('0x22')],channels[_0x97c39[_0x859f('0x8')]][_0x859f('0x1c')]):0x0;writeDB(channels[_0x97c39[_0x859f('0x8')]]);}}catch(_0xe48e96){utils[_0x859f('0x1f')](_0xe48e96[_0x859f('0x17')]);}};exports['attendedtransfer']=function(_0x2f9f2e){try{if(!_['isNil'](channels[_0x2f9f2e[_0x859f('0x26')]])){if(channels[_0x2f9f2e[_0x859f('0x26')]]['channel']==_0x2f9f2e[_0x859f('0x27')]){channels[_0x2f9f2e[_0x859f('0x26')]]['destinationchannel']=_0x2f9f2e[_0x859f('0x28')];channels[_0x2f9f2e[_0x859f('0x26')]][_0x859f('0x29')]=_0x859f('0x2a');}else if(channels[_0x2f9f2e[_0x859f('0x26')]]['channel']=_0x2f9f2e[_0x859f('0x2b')]){channels[_0x2f9f2e['localtwolinkedid']][_0x859f('0x2c')]=_0x2f9f2e[_0x859f('0x2d')];channels[_0x2f9f2e['localtwolinkedid']][_0x859f('0x29')]='_attended';}}}catch(_0x2424f2){utils[_0x859f('0x1f')](_0x2424f2[_0x859f('0x17')]);}};exports[_0x859f('0x2e')]=function(_0x4f170d){try{if(!_['isNil'](channels[_0x4f170d['uniqueid']])){channels[_0x4f170d[_0x859f('0x8')]]['musiconholdstartAt']=utils[_0x859f('0x16')]();}}catch(_0x2af670){utils[_0x859f('0x1f')](_0x2af670[_0x859f('0x17')]);}};exports['musiconholdstop']=function(_0x16d497){try{if(!_[_0x859f('0x19')](channels[_0x16d497[_0x859f('0x8')]])){if(!_['isNil'](channels[_0x16d497[_0x859f('0x8')]][_0x859f('0x2f')])){channels[_0x16d497[_0x859f('0x8')]]['mohtime']+=utils[_0x859f('0x24')](utils['now'](),channels[_0x16d497[_0x859f('0x8')]][_0x859f('0x2f')]);delete channels[_0x16d497[_0x859f('0x8')]][_0x859f('0x2f')];}}}catch(_0xd4eb35){utils[_0x859f('0x1f')](_0xd4eb35[_0x859f('0x17')]);}};exports[_0x859f('0x30')]=function(_0x32ea73){try{if(!_[_0x859f('0x19')](channels[_0x32ea73[_0x859f('0x8')]])){if(!_[_0x859f('0x19')](_0x32ea73[_0x859f('0x31')][_0x859f('0x32')])){channels[_0x32ea73[_0x859f('0x8')]][_0x859f('0xc')]=_0x32ea73[_0x859f('0x33')];}if(!_[_0x859f('0x19')](_0x32ea73[_0x859f('0x31')][_0x859f('0x34')])){channels[_0x32ea73[_0x859f('0x8')]]['destination']=_0x32ea73[_0x859f('0x33')];channels[_0x32ea73[_0x859f('0x8')]][_0x859f('0x20')]='\x22'+_0x32ea73[_0x859f('0x33')]+_0x859f('0x35')+_0x32ea73[_0x859f('0x33')]+'>';}if(!_[_0x859f('0x19')](_0x32ea73[_0x859f('0x31')][_0x859f('0x36')])||!_[_0x859f('0x19')](_0x32ea73[_0x859f('0x31')][_0x859f('0x37')])){channels[_0x32ea73[_0x859f('0x8')]]['callerid']=_0x32ea73[_0x859f('0x33')];}if(!_[_0x859f('0x19')](_0x32ea73[_0x859f('0x31')][_0x859f('0x38')])||!_[_0x859f('0x19')](_0x32ea73[_0x859f('0x31')]['xmcs-queue'])){channels[_0x32ea73[_0x859f('0x8')]]['lastapplication']=_0x859f('0x39');channels[_0x32ea73['uniqueid']][_0x859f('0x3a')]=_0x32ea73[_0x859f('0x33')];channels[_0x32ea73[_0x859f('0x8')]][_0x859f('0x3b')]=!![];}if(!_[_0x859f('0x19')](_0x32ea73['variable'][_0x859f('0x3c')])){channels[_0x32ea73[_0x859f('0x8')]]['ContactId']=_0x32ea73[_0x859f('0x33')];}if(!_[_0x859f('0x19')](_0x32ea73[_0x859f('0x31')]['xmd-cdrtype'])){channels[_0x32ea73[_0x859f('0x8')]][_0x859f('0xa')]=_0x32ea73[_0x859f('0x33')];}if(!_[_0x859f('0x19')](_0x32ea73[_0x859f('0x31')]['outboundrouteid'])){channels[_0x32ea73[_0x859f('0x8')]][_0x859f('0x3d')]=_0x32ea73[_0x859f('0x33')];}if(!_[_0x859f('0x19')](_0x32ea73[_0x859f('0x31')][_0x859f('0x3e')])){channels[_0x32ea73[_0x859f('0x8')]][_0x859f('0x3e')]=_0x32ea73[_0x859f('0x33')];}}}catch(_0x3dc88d){utils['error'](_0x3dc88d['stack']);}};exports[_0x859f('0x3f')]=function(_0x10dc26){try{if(!_[_0x859f('0x19')](channels[_0x10dc26['uniqueid']])){if(_0x10dc26[_0x859f('0x40')][_0x859f('0x41')]()==_0x859f('0x42')&&_['startsWith'](_0x10dc26[_0x859f('0x43')][_0x859f('0x41')](),'cdr')){var _0x31be97=_0x10dc26[_0x859f('0x43')]['split']('=');var _0x1a2c1=_0x31be97[0x0][_0x859f('0x44')](_0x31be97[0x0][_0x859f('0x45')]('(')+0x1,_0x31be97[0x0][_0x859f('0x45')](')'));var _0x5bf049=_0x31be97[0x1];channels[_0x10dc26[_0x859f('0x8')]][_0x1a2c1]=_0x5bf049;}if(!_[_0x859f('0x46')]([_0x859f('0x47'),_0x859f('0x48'),'execif',_0x859f('0x42'),_0x859f('0x49')],_0x10dc26[_0x859f('0x40')][_0x859f('0x41')]())){channels[_0x10dc26[_0x859f('0x8')]]['lastapplication']=_0x10dc26[_0x859f('0x40')];channels[_0x10dc26[_0x859f('0x8')]][_0x859f('0x3a')]=_0x10dc26[_0x859f('0x43')];}}}catch(_0x3b0caf){utils[_0x859f('0x1f')](_0x3b0caf[_0x859f('0x17')]);}}; \ No newline at end of file +var _0xaec7=['xmd-originatecalleridnum','value','xmd-phone','xmd-callerid-preview','xmd-callerid','xmd-queue','xmcs-queue','lastapplication','Queue','lastdata','xmd-contactid','ContactId','xmd-cdrtype','outboundrouteid','sipcallid','toLowerCase','set','startsWith','appdata','cdr','split','substring','lastIndexOf','includes','noop','execif','gotoif','application','util','./utils','NO\x20ANSWER','FAILED','ANSWERED','BUSY','info','format','uniqueid','channel','type','accountcode','source','destination','callerid','getUserByInternal','then','UserId','request','CreateVoiceCallReport','linkedid','exten','context','now','DOCUMENTATION','stack','newstate','isNil','channelstate','systemanswertime','transfer','destinationchannel','hangup','calleridname','endtime','duration','diffTime','starttime','answertime','error','attendedtransfer','localtwolinkedid','transfereechannel','userfield','_attended','origtransfererchannel','musiconholdstart','musiconholdstartAt','musiconholdstop','varset','variable'];(function(_0x4d674b,_0x176474){var _0x535a1f=function(_0xac7726){while(--_0xac7726){_0x4d674b['push'](_0x4d674b['shift']());}};_0x535a1f(++_0x176474);}(_0xaec7,0x1a7));var _0x7aec=function(_0x40dd56,_0x726ca5){_0x40dd56=_0x40dd56-0x0;var _0x4f850f=_0xaec7[_0x40dd56];return _0x4f850f;};'use strict';var _=require('lodash');var util=require(_0x7aec('0x0'));var utils=require(_0x7aec('0x1'));var dispositions=[_0x7aec('0x2'),_0x7aec('0x3'),_0x7aec('0x3'),_0x7aec('0x2'),_0x7aec('0x2'),_0x7aec('0x2'),_0x7aec('0x4'),_0x7aec('0x5'),'FAILED',_0x7aec('0x3'),_0x7aec('0x3')];var channels={};function writeDB(_0x258d68){utils[_0x7aec('0x6')](util[_0x7aec('0x7')]('CALL|%s|%s|%s|%s|%s|%s|%s|%s',_0x258d68[_0x7aec('0x8')],_0x258d68[_0x7aec('0x9')],_0x258d68[_0x7aec('0xa')],_0x258d68[_0x7aec('0xb')],_0x258d68[_0x7aec('0xc')],_0x258d68[_0x7aec('0xd')],_0x258d68[_0x7aec('0xe')],_0x258d68['disposition']));if(_0x258d68[_0x7aec('0xb')]){utils[_0x7aec('0xf')](_0x258d68[_0x7aec('0xb')])[_0x7aec('0x10')](function(_0x22482d){if(_0x22482d){_0x258d68[_0x7aec('0x11')]=_0x22482d['id'];}utils[_0x7aec('0x12')](_0x7aec('0x13'),_0x258d68);});}else{utils['request'](_0x7aec('0x13'),_0x258d68);}if(channels[_0x258d68[_0x7aec('0x8')]]){delete channels[_0x258d68[_0x7aec('0x8')]];}}exports['newchannel']=function(_0x29cb6d){try{if(_0x29cb6d['uniqueid']==_0x29cb6d[_0x7aec('0x14')]&&_0x29cb6d[_0x7aec('0x9')]!='OutgoingSpoolFailed'){channels[_0x29cb6d[_0x7aec('0x8')]]={'uniqueid':_0x29cb6d[_0x7aec('0x8')],'accountcode':_0x29cb6d[_0x7aec('0xb')],'source':_0x29cb6d['calleridnum'],'destination':_0x29cb6d[_0x7aec('0x15')],'destinationcontext':_0x29cb6d[_0x7aec('0x16')],'channel':_0x29cb6d[_0x7aec('0x9')],'starttime':utils[_0x7aec('0x17')](),'answertime':null,'systemanswertime':null,'mohtime':0x0,'disposition':_0x7aec('0x2'),'amaflags':_0x7aec('0x18')};}}catch(_0x4ff630){utils['error'](_0x4ff630[_0x7aec('0x19')]);}};exports[_0x7aec('0x1a')]=function(_0x4d6a2a){try{if(!_[_0x7aec('0x1b')](channels[_0x4d6a2a[_0x7aec('0x8')]])&&_0x4d6a2a[_0x7aec('0x1c')]==0x6){if(_[_0x7aec('0x1b')](channels[_0x4d6a2a[_0x7aec('0x8')]][_0x7aec('0x1d')])){channels[_0x4d6a2a[_0x7aec('0x8')]]['systemanswertime']=utils[_0x7aec('0x17')]();}}else if(!_['isNil'](channels[_0x4d6a2a[_0x7aec('0x14')]])&&_0x4d6a2a[_0x7aec('0x1c')]==0x6&&_0x4d6a2a[_0x7aec('0x16')]!=_0x7aec('0x1e')){channels[_0x4d6a2a[_0x7aec('0x14')]]['accountcode']=_0x4d6a2a['accountcode'];channels[_0x4d6a2a[_0x7aec('0x14')]][_0x7aec('0x1f')]=_0x4d6a2a[_0x7aec('0x9')];if(_[_0x7aec('0x1b')](channels[_0x4d6a2a[_0x7aec('0x14')]]['answertime'])){channels[_0x4d6a2a[_0x7aec('0x14')]]['answertime']=utils['now']();}channels[_0x4d6a2a[_0x7aec('0x14')]]['disposition']=dispositions[_['toNumber'](_0x4d6a2a['channelstate'])]||'ANSWERED';}}catch(_0x330a02){utils['error'](_0x330a02[_0x7aec('0x19')]);}};exports[_0x7aec('0x20')]=function(_0x34ba8e){try{if(!_[_0x7aec('0x1b')](channels[_0x34ba8e['uniqueid']])){if(_[_0x7aec('0x1b')](channels[_0x34ba8e[_0x7aec('0x8')]][_0x7aec('0xe')])){channels[_0x34ba8e[_0x7aec('0x8')]][_0x7aec('0xe')]=_0x34ba8e[_0x7aec('0x21')]+'\x20<'+_0x34ba8e['calleridnum']+'>';}channels[_0x34ba8e[_0x7aec('0x8')]][_0x7aec('0x22')]=utils[_0x7aec('0x17')]();channels[_0x34ba8e[_0x7aec('0x8')]][_0x7aec('0x23')]=utils[_0x7aec('0x24')](channels[_0x34ba8e[_0x7aec('0x8')]]['endtime'],channels[_0x34ba8e['uniqueid']][_0x7aec('0x25')]);channels[_0x34ba8e[_0x7aec('0x8')]]['billableseconds']=channels[_0x34ba8e[_0x7aec('0x8')]][_0x7aec('0x26')]?utils[_0x7aec('0x24')](channels[_0x34ba8e[_0x7aec('0x8')]][_0x7aec('0x22')],channels[_0x34ba8e[_0x7aec('0x8')]][_0x7aec('0x26')]):0x0;writeDB(channels[_0x34ba8e['uniqueid']]);}}catch(_0x13be7f){utils[_0x7aec('0x27')](_0x13be7f[_0x7aec('0x19')]);}};exports[_0x7aec('0x28')]=function(_0xbe29c1){try{if(!_[_0x7aec('0x1b')](channels[_0xbe29c1[_0x7aec('0x29')]])){if(channels[_0xbe29c1[_0x7aec('0x29')]][_0x7aec('0x9')]==_0xbe29c1[_0x7aec('0x2a')]){channels[_0xbe29c1[_0x7aec('0x29')]][_0x7aec('0x1f')]=_0xbe29c1['secondtransfererchannel'];channels[_0xbe29c1['localtwolinkedid']][_0x7aec('0x2b')]=_0x7aec('0x2c');}else if(channels[_0xbe29c1[_0x7aec('0x29')]][_0x7aec('0x9')]=_0xbe29c1['transfertargetchannel']){channels[_0xbe29c1[_0x7aec('0x29')]][_0x7aec('0x1f')]=_0xbe29c1[_0x7aec('0x2d')];channels[_0xbe29c1[_0x7aec('0x29')]][_0x7aec('0x2b')]=_0x7aec('0x2c');}}}catch(_0x358a5e){utils[_0x7aec('0x27')](_0x358a5e[_0x7aec('0x19')]);}};exports[_0x7aec('0x2e')]=function(_0x5b3c60){try{if(!_[_0x7aec('0x1b')](channels[_0x5b3c60[_0x7aec('0x8')]])){channels[_0x5b3c60[_0x7aec('0x8')]][_0x7aec('0x2f')]=utils[_0x7aec('0x17')]();}}catch(_0x190929){utils[_0x7aec('0x27')](_0x190929[_0x7aec('0x19')]);}};exports[_0x7aec('0x30')]=function(_0x1eb5e4){try{if(!_['isNil'](channels[_0x1eb5e4[_0x7aec('0x8')]])){if(!_[_0x7aec('0x1b')](channels[_0x1eb5e4['uniqueid']][_0x7aec('0x2f')])){channels[_0x1eb5e4[_0x7aec('0x8')]]['mohtime']+=utils[_0x7aec('0x24')](utils[_0x7aec('0x17')](),channels[_0x1eb5e4[_0x7aec('0x8')]][_0x7aec('0x2f')]);delete channels[_0x1eb5e4[_0x7aec('0x8')]]['musiconholdstartAt'];}}}catch(_0x5f3576){utils['error'](_0x5f3576[_0x7aec('0x19')]);}};exports[_0x7aec('0x31')]=function(_0x204afe){try{if(!_['isNil'](channels[_0x204afe['uniqueid']])){if(!_[_0x7aec('0x1b')](_0x204afe[_0x7aec('0x32')][_0x7aec('0x33')])){channels[_0x204afe[_0x7aec('0x8')]]['source']=_0x204afe[_0x7aec('0x34')];}if(!_['isNil'](_0x204afe[_0x7aec('0x32')][_0x7aec('0x35')])){channels[_0x204afe[_0x7aec('0x8')]][_0x7aec('0xd')]=_0x204afe[_0x7aec('0x34')];channels[_0x204afe['uniqueid']][_0x7aec('0xe')]='\x22'+_0x204afe[_0x7aec('0x34')]+'\x22\x20<'+_0x204afe[_0x7aec('0x34')]+'>';}if(!_[_0x7aec('0x1b')](_0x204afe[_0x7aec('0x32')][_0x7aec('0x36')])||!_['isNil'](_0x204afe[_0x7aec('0x32')][_0x7aec('0x37')])){channels[_0x204afe[_0x7aec('0x8')]][_0x7aec('0xe')]=_0x204afe[_0x7aec('0x34')];}if(!_[_0x7aec('0x1b')](_0x204afe[_0x7aec('0x32')][_0x7aec('0x38')])||!_[_0x7aec('0x1b')](_0x204afe[_0x7aec('0x32')][_0x7aec('0x39')])){channels[_0x204afe[_0x7aec('0x8')]][_0x7aec('0x3a')]=_0x7aec('0x3b');channels[_0x204afe[_0x7aec('0x8')]][_0x7aec('0x3c')]=_0x204afe[_0x7aec('0x34')];channels[_0x204afe['uniqueid']]['queue']=!![];}if(!_[_0x7aec('0x1b')](_0x204afe[_0x7aec('0x32')][_0x7aec('0x3d')])){channels[_0x204afe[_0x7aec('0x8')]][_0x7aec('0x3e')]=_0x204afe[_0x7aec('0x34')];}if(!_[_0x7aec('0x1b')](_0x204afe[_0x7aec('0x32')][_0x7aec('0x3f')])){channels[_0x204afe[_0x7aec('0x8')]][_0x7aec('0xa')]=_0x204afe[_0x7aec('0x34')];}if(!_[_0x7aec('0x1b')](_0x204afe[_0x7aec('0x32')][_0x7aec('0x40')])){channels[_0x204afe['uniqueid']]['routeid']=_0x204afe[_0x7aec('0x34')];}if(!_['isNil'](_0x204afe[_0x7aec('0x32')][_0x7aec('0x41')])){channels[_0x204afe[_0x7aec('0x8')]][_0x7aec('0x41')]=_0x204afe[_0x7aec('0x34')];}}}catch(_0x3646bf){utils[_0x7aec('0x27')](_0x3646bf[_0x7aec('0x19')]);}};exports['newexten']=function(_0x1b06a0){try{if(!_[_0x7aec('0x1b')](channels[_0x1b06a0[_0x7aec('0x8')]])){if(_0x1b06a0['application'][_0x7aec('0x42')]()==_0x7aec('0x43')&&_[_0x7aec('0x44')](_0x1b06a0[_0x7aec('0x45')][_0x7aec('0x42')](),_0x7aec('0x46'))){var _0x4a69c3=_0x1b06a0[_0x7aec('0x45')][_0x7aec('0x47')]('=');var _0x5ed815=_0x4a69c3[0x0][_0x7aec('0x48')](_0x4a69c3[0x0]['lastIndexOf']('(')+0x1,_0x4a69c3[0x0][_0x7aec('0x49')](')'));var _0x246ef7=_0x4a69c3[0x1];channels[_0x1b06a0['uniqueid']][_0x5ed815]=_0x246ef7;}if(!_[_0x7aec('0x4a')](['hangup',_0x7aec('0x4b'),_0x7aec('0x4c'),_0x7aec('0x43'),_0x7aec('0x4d')],_0x1b06a0[_0x7aec('0x4e')][_0x7aec('0x42')]())){channels[_0x1b06a0[_0x7aec('0x8')]][_0x7aec('0x3a')]=_0x1b06a0['application'];channels[_0x1b06a0['uniqueid']][_0x7aec('0x3c')]=_0x1b06a0['appdata'];}}}catch(_0x45c743){utils['error'](_0x45c743[_0x7aec('0x19')]);}}; \ No newline at end of file diff --git a/server/services/xdr/core.controller.js b/server/services/xdr/core.controller.js index bc0a3c0..2f42c98 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 _0x4745=['shutdown','SHUTDOWN','fullybooted','FULLYBOOTED','error','close','CLOSE','./utils','lodash','connect','info','CONNECTED'];(function(_0x9c3c56,_0x169b56){var _0x2dd782=function(_0x386962){while(--_0x386962){_0x9c3c56['push'](_0x9c3c56['shift']());}};_0x2dd782(++_0x169b56);}(_0x4745,0x1e7));var _0x5474=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0x4745[_0x2f5ac5];return _0x37c9a8;};'use strict';var utils=require(_0x5474('0x0'));var _=require(_0x5474('0x1'));exports[_0x5474('0x2')]=function(){utils[_0x5474('0x3')](_0x5474('0x4'));};exports[_0x5474('0x5')]=function(){utils[_0x5474('0x3')](_0x5474('0x6'));};exports[_0x5474('0x7')]=function(){utils[_0x5474('0x3')](_0x5474('0x8'));};exports[_0x5474('0x9')]=function(_0x4e7ce7){utils[_0x5474('0x9')](_0x4e7ce7);};exports[_0x5474('0xa')]=function(){utils['info'](_0x5474('0xb'));};exports['managerevent']=function(_0x902ba8){}; \ No newline at end of file +var _0x7278=['FULLYBOOTED','error','close','CLOSE','managerevent','./utils','lodash','connect','info','CONNECTED','SHUTDOWN','fullybooted'];(function(_0x2418e0,_0x7215b0){var _0x55ffbf=function(_0x4fc0ec){while(--_0x4fc0ec){_0x2418e0['push'](_0x2418e0['shift']());}};_0x55ffbf(++_0x7215b0);}(_0x7278,0x161));var _0x8727=function(_0x479692,_0x497af4){_0x479692=_0x479692-0x0;var _0x3f24f1=_0x7278[_0x479692];return _0x3f24f1;};'use strict';var utils=require(_0x8727('0x0'));var _=require(_0x8727('0x1'));exports[_0x8727('0x2')]=function(){utils[_0x8727('0x3')](_0x8727('0x4'));};exports['shutdown']=function(){utils[_0x8727('0x3')](_0x8727('0x5'));};exports[_0x8727('0x6')]=function(){utils[_0x8727('0x3')](_0x8727('0x7'));};exports[_0x8727('0x8')]=function(_0x180b71){utils['error'](_0x180b71);};exports[_0x8727('0x9')]=function(){utils[_0x8727('0x3')](_0x8727('0xa'));};exports[_0x8727('0xb')]=function(_0x4160c3){}; \ No newline at end of file diff --git a/server/services/xdr/dials.controller.js b/server/services/xdr/dials.controller.js index bc9ac7a..f1b7008 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 _0xaed1=['dialstatus','request','CreateVoiceDialReport','application','toLowerCase','startsWith','appdata','cdr(routeid)','split','error','stack','isNil','dialbegin','assign','starttime','now','lastevent','called','dialend','answertime','hangup','complete','duration','holdtime','diffTime','billableseconds','lodash','util','./utils','info','format','DIAL|%s|%s|%s|%s|%s|%s','uniqueid','channel','dialstring','calleridnum','connectedlinenum'];(function(_0x8dc04d,_0xaa7559){var _0x2f5f28=function(_0xdd2d1d){while(--_0xdd2d1d){_0x8dc04d['push'](_0x8dc04d['shift']());}};_0x2f5f28(++_0xaa7559);}(_0xaed1,0x1b1));var _0x1aed=function(_0x2f8a22,_0x143d0e){_0x2f8a22=_0x2f8a22-0x0;var _0x7d7ae5=_0xaed1[_0x2f8a22];return _0x7d7ae5;};'use strict';var _=require(_0x1aed('0x0'));var util=require(_0x1aed('0x1'));var utils=require(_0x1aed('0x2'));var dials={};function writeDB(_0x32b8cd){utils[_0x1aed('0x3')](util[_0x1aed('0x4')](_0x1aed('0x5'),_0x32b8cd[_0x1aed('0x6')],_0x32b8cd[_0x1aed('0x7')],_0x32b8cd[_0x1aed('0x8')],_0x32b8cd[_0x1aed('0x9')],_0x32b8cd[_0x1aed('0xa')],_0x32b8cd[_0x1aed('0xb')]));utils[_0x1aed('0xc')](_0x1aed('0xd'),_0x32b8cd);delete dials[_0x32b8cd[_0x1aed('0x6')]];}exports['newexten']=function(_0x3e0d0f){try{if(_0x3e0d0f[_0x1aed('0xe')][_0x1aed('0xf')]()=='set'&&_[_0x1aed('0x10')](_0x3e0d0f[_0x1aed('0x11')][_0x1aed('0xf')](),_0x1aed('0x12'))){var _0x467a42=_0x3e0d0f['appdata'][_0x1aed('0x13')]('=');dials[_0x3e0d0f['uniqueid']]={'routeId':_0x467a42[0x1]};}}catch(_0x4b4b67){utils[_0x1aed('0x14')](_0x4b4b67[_0x1aed('0x15')]);}};exports['varset']=function(_0x233e4){try{if(!_[_0x1aed('0x16')](_0x233e4['variable']['outboundrouteid'])){dials[_0x233e4[_0x1aed('0x6')]]={'routeId':_0x233e4['value']};}}catch(_0x4d88c9){utils[_0x1aed('0x14')](_0x4d88c9[_0x1aed('0x15')]);}};exports[_0x1aed('0x17')]=function(_0x4056fb){try{if(!_[_0x1aed('0x16')](dials[_0x4056fb[_0x1aed('0x6')]])){dials[_0x4056fb['uniqueid']]=_[_0x1aed('0x18')](dials[_0x4056fb[_0x1aed('0x6')]],_0x4056fb);dials[_0x4056fb[_0x1aed('0x6')]][_0x1aed('0x19')]=utils[_0x1aed('0x1a')]();dials[_0x4056fb[_0x1aed('0x6')]][_0x1aed('0x1b')]=_0x1aed('0x1c');}}catch(_0x272b4c){utils[_0x1aed('0x14')](_0x272b4c['stack']);}};exports[_0x1aed('0x1d')]=function(_0x11a747){try{if(!_[_0x1aed('0x16')](dials[_0x11a747[_0x1aed('0x6')]])){dials[_0x11a747[_0x1aed('0x6')]]['dialstatus']=_0x11a747[_0x1aed('0xb')];if(_0x11a747[_0x1aed('0xb')]=='ANSWER'){dials[_0x11a747[_0x1aed('0x6')]]=_['assign'](dials[_0x11a747[_0x1aed('0x6')]],_0x11a747);dials[_0x11a747[_0x1aed('0x6')]][_0x1aed('0x1e')]=utils['now']();dials[_0x11a747[_0x1aed('0x6')]][_0x1aed('0x1b')]='connect';}}}catch(_0x2ab3f3){utils[_0x1aed('0x14')](_0x2ab3f3[_0x1aed('0x15')]);}};exports[_0x1aed('0x1f')]=function(_0x47fa08){try{if(!_[_0x1aed('0x16')](dials[_0x47fa08[_0x1aed('0x6')]])){dials[_0x47fa08[_0x1aed('0x6')]]=_[_0x1aed('0x18')](dials[_0x47fa08[_0x1aed('0x6')]],{'endtime':utils[_0x1aed('0x1a')](),'lastevent':_0x1aed('0x20')});dials[_0x47fa08[_0x1aed('0x6')]][_0x1aed('0x21')]=utils['diffTime'](dials[_0x47fa08[_0x1aed('0x6')]]['endtime'],dials[_0x47fa08[_0x1aed('0x6')]]['starttime']);dials[_0x47fa08[_0x1aed('0x6')]][_0x1aed('0x22')]=utils[_0x1aed('0x23')](dials[_0x47fa08[_0x1aed('0x6')]][_0x1aed('0x1e')]||dials[_0x47fa08[_0x1aed('0x6')]]['endtime'],dials[_0x47fa08[_0x1aed('0x6')]]['starttime']);dials[_0x47fa08['uniqueid']][_0x1aed('0x24')]=dials[_0x47fa08['uniqueid']][_0x1aed('0x1e')]?utils[_0x1aed('0x23')](dials[_0x47fa08[_0x1aed('0x6')]]['endtime'],dials[_0x47fa08[_0x1aed('0x6')]][_0x1aed('0x1e')]):0x0;writeDB(dials[_0x47fa08[_0x1aed('0x6')]]);}}catch(_0x2d4552){utils[_0x1aed('0x14')](_0x2d4552[_0x1aed('0x15')]);}}; \ No newline at end of file +var _0x6629=['CreateVoiceDialReport','newexten','application','toLowerCase','set','appdata','cdr(routeid)','error','stack','varset','variable','outboundrouteid','value','dialbegin','assign','starttime','lastevent','called','dialend','isNil','answertime','now','hangup','complete','duration','endtime','holdtime','diffTime','billableseconds','lodash','util','format','DIAL|%s|%s|%s|%s|%s|%s','uniqueid','dialstatus','request'];(function(_0x2b2ac8,_0x22f79a){var _0x5cd081=function(_0x31155d){while(--_0x31155d){_0x2b2ac8['push'](_0x2b2ac8['shift']());}};_0x5cd081(++_0x22f79a);}(_0x6629,0x1a9));var _0x9662=function(_0x315e3c,_0xb112ee){_0x315e3c=_0x315e3c-0x0;var _0x4ad165=_0x6629[_0x315e3c];return _0x4ad165;};'use strict';var _=require(_0x9662('0x0'));var util=require(_0x9662('0x1'));var utils=require('./utils');var dials={};function writeDB(_0x11dfb5){utils['info'](util[_0x9662('0x2')](_0x9662('0x3'),_0x11dfb5[_0x9662('0x4')],_0x11dfb5['channel'],_0x11dfb5['dialstring'],_0x11dfb5['calleridnum'],_0x11dfb5['connectedlinenum'],_0x11dfb5[_0x9662('0x5')]));utils[_0x9662('0x6')](_0x9662('0x7'),_0x11dfb5);delete dials[_0x11dfb5[_0x9662('0x4')]];}exports[_0x9662('0x8')]=function(_0xbd5747){try{if(_0xbd5747[_0x9662('0x9')][_0x9662('0xa')]()==_0x9662('0xb')&&_['startsWith'](_0xbd5747[_0x9662('0xc')][_0x9662('0xa')](),_0x9662('0xd'))){var _0x552558=_0xbd5747[_0x9662('0xc')]['split']('=');dials[_0xbd5747[_0x9662('0x4')]]={'routeId':_0x552558[0x1]};}}catch(_0x495488){utils[_0x9662('0xe')](_0x495488[_0x9662('0xf')]);}};exports[_0x9662('0x10')]=function(_0x5da90d){try{if(!_['isNil'](_0x5da90d[_0x9662('0x11')][_0x9662('0x12')])){dials[_0x5da90d[_0x9662('0x4')]]={'routeId':_0x5da90d[_0x9662('0x13')]};}}catch(_0x2a8fc3){utils['error'](_0x2a8fc3[_0x9662('0xf')]);}};exports[_0x9662('0x14')]=function(_0x104071){try{if(!_['isNil'](dials[_0x104071[_0x9662('0x4')]])){dials[_0x104071[_0x9662('0x4')]]=_[_0x9662('0x15')](dials[_0x104071[_0x9662('0x4')]],_0x104071);dials[_0x104071['uniqueid']][_0x9662('0x16')]=utils['now']();dials[_0x104071[_0x9662('0x4')]][_0x9662('0x17')]=_0x9662('0x18');}}catch(_0x4ae800){utils['error'](_0x4ae800[_0x9662('0xf')]);}};exports[_0x9662('0x19')]=function(_0x2dd785){try{if(!_[_0x9662('0x1a')](dials[_0x2dd785['uniqueid']])){dials[_0x2dd785[_0x9662('0x4')]]['dialstatus']=_0x2dd785[_0x9662('0x5')];if(_0x2dd785[_0x9662('0x5')]=='ANSWER'){dials[_0x2dd785[_0x9662('0x4')]]=_[_0x9662('0x15')](dials[_0x2dd785['uniqueid']],_0x2dd785);dials[_0x2dd785[_0x9662('0x4')]][_0x9662('0x1b')]=utils[_0x9662('0x1c')]();dials[_0x2dd785[_0x9662('0x4')]][_0x9662('0x17')]='connect';}}}catch(_0x4000a8){utils[_0x9662('0xe')](_0x4000a8[_0x9662('0xf')]);}};exports[_0x9662('0x1d')]=function(_0x964f9d){try{if(!_['isNil'](dials[_0x964f9d[_0x9662('0x4')]])){dials[_0x964f9d[_0x9662('0x4')]]=_[_0x9662('0x15')](dials[_0x964f9d[_0x9662('0x4')]],{'endtime':utils[_0x9662('0x1c')](),'lastevent':_0x9662('0x1e')});dials[_0x964f9d[_0x9662('0x4')]][_0x9662('0x1f')]=utils['diffTime'](dials[_0x964f9d[_0x9662('0x4')]][_0x9662('0x20')],dials[_0x964f9d['uniqueid']][_0x9662('0x16')]);dials[_0x964f9d[_0x9662('0x4')]][_0x9662('0x21')]=utils[_0x9662('0x22')](dials[_0x964f9d[_0x9662('0x4')]][_0x9662('0x1b')]||dials[_0x964f9d[_0x9662('0x4')]][_0x9662('0x20')],dials[_0x964f9d[_0x9662('0x4')]][_0x9662('0x16')]);dials[_0x964f9d[_0x9662('0x4')]][_0x9662('0x23')]=dials[_0x964f9d[_0x9662('0x4')]][_0x9662('0x1b')]?utils[_0x9662('0x22')](dials[_0x964f9d[_0x9662('0x4')]]['endtime'],dials[_0x964f9d[_0x9662('0x4')]][_0x9662('0x1b')]):0x0;writeDB(dials[_0x964f9d[_0x9662('0x4')]]);}}catch(_0x4b292b){utils[_0x9662('0xe')](_0x4b292b[_0x9662('0xf')]);}}; \ No newline at end of file diff --git a/server/services/xdr/index.js b/server/services/xdr/index.js index 7b41de1..fe9861c 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 _0xaa29=['queuecallerjoin','queuecallerleave','musiconholdstart','musiconholdstop','newstate','hangup','cdr','blindtransfer','attendedtransfer','varset','newexten','newchannel','dialbegin','dialend','asterisk-manager','./utils','port','asterisk','keepConnected','xdr','disabled','info','./agents.controller','./calls.controller','./recordings.controller','./members.controller','./core.controller','connect','shutdown','fullybooted','error','close','managerevent','devicestatechange','agentringnoanswer','agentconnect','agentcomplete','queuecallerabandon'];(function(_0x56fe98,_0x43dc16){var _0x212f4f=function(_0xc3427d){while(--_0xc3427d){_0x56fe98['push'](_0x56fe98['shift']());}};_0x212f4f(++_0x43dc16);}(_0xaa29,0x1b0));var _0x9aa2=function(_0x3a2977,_0x3d246a){_0x3a2977=_0x3a2977-0x0;var _0x1ec08c=_0xaa29[_0x3a2977];return _0x1ec08c;};var AsteriskManager=require(_0x9aa2('0x0'));var config=require('../../config/environment');var utils=require(_0x9aa2('0x1'));var ami=new AsteriskManager(config['asterisk'][_0x9aa2('0x2')],config['asterisk']['ip'],config['asterisk']['username'],config[_0x9aa2('0x3')]['password'],!![]);ami[_0x9aa2('0x4')]();if(config[_0x9aa2('0x5')]&&config[_0x9aa2('0x5')][_0x9aa2('0x6')]){utils[_0x9aa2('0x7')]('XDR\x20DISABLED');}else{var agents=require(_0x9aa2('0x8'));var calls=require(_0x9aa2('0x9'));var queues=require('./queues.controller');var recordings=require(_0x9aa2('0xa'));var members=require(_0x9aa2('0xb'));var dials=require('./dials.controller');var transfers=require('./transfers.controller');var core=require(_0x9aa2('0xc'));ami['on'](_0x9aa2('0xd'),core['connect']);ami['on'](_0x9aa2('0xe'),core[_0x9aa2('0xe')]);ami['on'](_0x9aa2('0xf'),core[_0x9aa2('0xf')]);ami['on'](_0x9aa2('0x10'),core[_0x9aa2('0x10')]);ami['on'](_0x9aa2('0x11'),core[_0x9aa2('0x11')]);ami['on']('managerevent',core[_0x9aa2('0x12')]);ami['on']('devicestatechange',function(_0x3bc08f){try{members[_0x9aa2('0x13')](_0x3bc08f);}catch(_0x3b34de){utils[_0x9aa2('0x10')](_0x3b34de);}});ami['on']('agentcalled',function(_0x9054ac){try{agents['agentcalled'](_0x9054ac);}catch(_0x292d96){utils[_0x9aa2('0x10')](_0x292d96);}});ami['on'](_0x9aa2('0x14'),function(_0x33c76e){try{agents[_0x9aa2('0x14')](_0x33c76e);}catch(_0x4d051e){utils[_0x9aa2('0x10')](_0x4d051e);}});ami['on'](_0x9aa2('0x15'),function(_0x2196b7){try{agents['agentconnect'](_0x2196b7);queues['agentconnect'](_0x2196b7);}catch(_0x12ed7f){utils[_0x9aa2('0x10')](_0x12ed7f);}});ami['on']('agentcomplete',function(_0x376fb2){try{agents['agentcomplete'](_0x376fb2);queues[_0x9aa2('0x16')](_0x376fb2);members[_0x9aa2('0x16')](_0x376fb2);}catch(_0x1d6daf){utils['error'](_0x1d6daf);}});ami['on'](_0x9aa2('0x17'),function(_0x2f4d0c){try{agents['queuecallerabandon'](_0x2f4d0c);queues['queuecallerabandon'](_0x2f4d0c);}catch(_0x4a81f6){utils[_0x9aa2('0x10')](_0x4a81f6);}});ami['on'](_0x9aa2('0x18'),function(_0x33aedd){try{queues[_0x9aa2('0x18')](_0x33aedd);recordings[_0x9aa2('0x18')](_0x33aedd);}catch(_0x115295){utils['error'](_0x115295);}});ami['on'](_0x9aa2('0x19'),function(_0x5e59c0){try{queues[_0x9aa2('0x19')](_0x5e59c0);}catch(_0x48676e){utils[_0x9aa2('0x10')](_0x48676e);}});ami['on'](_0x9aa2('0x1a'),function(_0x2ccfc0){try{queues[_0x9aa2('0x1a')](_0x2ccfc0);calls[_0x9aa2('0x1a')](_0x2ccfc0);}catch(_0x23519a){utils[_0x9aa2('0x10')](_0x23519a);}});ami['on'](_0x9aa2('0x1b'),function(_0x3544da){try{queues[_0x9aa2('0x1b')](_0x3544da);calls[_0x9aa2('0x1b')](_0x3544da);}catch(_0x33890a){utils['error'](_0x33890a);}});ami['on'](_0x9aa2('0x1c'),function(_0x438a32){try{calls[_0x9aa2('0x1c')](_0x438a32);recordings[_0x9aa2('0x1c')](_0x438a32);}catch(_0x23065d){utils[_0x9aa2('0x10')](_0x23065d);}});ami['on'](_0x9aa2('0x1d'),function(_0x5864e4){try{calls[_0x9aa2('0x1d')](_0x5864e4);recordings['hangup'](_0x5864e4);dials[_0x9aa2('0x1d')](_0x5864e4);agents[_0x9aa2('0x1d')](_0x5864e4);queues[_0x9aa2('0x1d')](_0x5864e4);}catch(_0x312eb8){utils[_0x9aa2('0x10')](_0x312eb8);}});ami['on']('cdr',function(_0x33327b){try{members[_0x9aa2('0x1e')](_0x33327b);}catch(_0x303fc2){utils['error'](_0x303fc2);}});ami['on'](_0x9aa2('0x1f'),function(_0x21cab8){try{queues[_0x9aa2('0x1f')](_0x21cab8);agents[_0x9aa2('0x1f')](_0x21cab8);transfers['blindtransfer'](_0x21cab8);}catch(_0x1fca70){utils['error'](_0x1fca70);}});ami['on'](_0x9aa2('0x20'),function(_0x31a17e){try{queues[_0x9aa2('0x20')](_0x31a17e);transfers['attendedtransfer'](_0x31a17e);agents[_0x9aa2('0x20')](_0x31a17e);calls[_0x9aa2('0x20')](_0x31a17e);}catch(_0x131ef8){utils[_0x9aa2('0x10')](_0x131ef8);}});ami['on']('varset',function(_0x1c4879){try{queues['varset'](_0x1c4879);recordings[_0x9aa2('0x21')](_0x1c4879);calls[_0x9aa2('0x21')](_0x1c4879);dials['varset'](_0x1c4879);}catch(_0x493931){utils['error'](_0x493931);}});ami['on'](_0x9aa2('0x22'),function(_0x222dbb){try{calls[_0x9aa2('0x22')](_0x222dbb);recordings[_0x9aa2('0x22')](_0x222dbb);dials['newexten'](_0x222dbb);}catch(_0x2def0f){utils['error'](_0x2def0f);}});ami['on'](_0x9aa2('0x23'),function(_0x21bf6c){try{calls[_0x9aa2('0x23')](_0x21bf6c);recordings[_0x9aa2('0x23')](_0x21bf6c);}catch(_0x2bd95c){utils[_0x9aa2('0x10')](_0x2bd95c);}});ami['on'](_0x9aa2('0x24'),function(_0x3a0539){try{dials['dialbegin'](_0x3a0539);}catch(_0x54ebf0){utils[_0x9aa2('0x10')](_0x54ebf0);}});ami['on'](_0x9aa2('0x25'),function(_0x35a0a6){try{dials[_0x9aa2('0x25')](_0x35a0a6);}catch(_0x40e8cd){utils[_0x9aa2('0x10')](_0x40e8cd);}});} \ No newline at end of file +var _0x29aa=['newstate','hangup','cdr','blindtransfer','attendedtransfer','varset','newexten','newchannel','dialbegin','asterisk-manager','../../config/environment','./utils','asterisk','port','username','password','xdr','info','XDR\x20DISABLED','./agents.controller','./queues.controller','./dials.controller','./core.controller','connect','shutdown','fullybooted','error','close','managerevent','devicestatechange','agentcalled','agentringnoanswer','agentconnect','agentcomplete','queuecallerabandon','queuecallerjoin','queuecallerleave','musiconholdstart','musiconholdstop'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x29aa,0x18f));var _0xa29a=function(_0x2d879d,_0x40805c){_0x2d879d=_0x2d879d-0x0;var _0x172210=_0x29aa[_0x2d879d];return _0x172210;};var AsteriskManager=require(_0xa29a('0x0'));var config=require(_0xa29a('0x1'));var utils=require(_0xa29a('0x2'));var ami=new AsteriskManager(config[_0xa29a('0x3')][_0xa29a('0x4')],config['asterisk']['ip'],config[_0xa29a('0x3')][_0xa29a('0x5')],config[_0xa29a('0x3')][_0xa29a('0x6')],!![]);ami['keepConnected']();if(config[_0xa29a('0x7')]&&config['xdr']['disabled']){utils[_0xa29a('0x8')](_0xa29a('0x9'));}else{var agents=require(_0xa29a('0xa'));var calls=require('./calls.controller');var queues=require(_0xa29a('0xb'));var recordings=require('./recordings.controller');var members=require('./members.controller');var dials=require(_0xa29a('0xc'));var transfers=require('./transfers.controller');var core=require(_0xa29a('0xd'));ami['on'](_0xa29a('0xe'),core[_0xa29a('0xe')]);ami['on'](_0xa29a('0xf'),core[_0xa29a('0xf')]);ami['on'](_0xa29a('0x10'),core[_0xa29a('0x10')]);ami['on'](_0xa29a('0x11'),core['error']);ami['on'](_0xa29a('0x12'),core[_0xa29a('0x12')]);ami['on'](_0xa29a('0x13'),core[_0xa29a('0x13')]);ami['on'](_0xa29a('0x14'),function(_0x59d6f3){try{members[_0xa29a('0x14')](_0x59d6f3);}catch(_0x1ead66){utils[_0xa29a('0x11')](_0x1ead66);}});ami['on']('agentcalled',function(_0x4819c1){try{agents[_0xa29a('0x15')](_0x4819c1);}catch(_0x4e88b9){utils[_0xa29a('0x11')](_0x4e88b9);}});ami['on'](_0xa29a('0x16'),function(_0x15fc60){try{agents[_0xa29a('0x16')](_0x15fc60);}catch(_0x403c14){utils[_0xa29a('0x11')](_0x403c14);}});ami['on'](_0xa29a('0x17'),function(_0xa48e6c){try{agents[_0xa29a('0x17')](_0xa48e6c);queues[_0xa29a('0x17')](_0xa48e6c);}catch(_0x5be78c){utils[_0xa29a('0x11')](_0x5be78c);}});ami['on'](_0xa29a('0x18'),function(_0x4d390b){try{agents[_0xa29a('0x18')](_0x4d390b);queues[_0xa29a('0x18')](_0x4d390b);members['agentcomplete'](_0x4d390b);}catch(_0x12f689){utils[_0xa29a('0x11')](_0x12f689);}});ami['on'](_0xa29a('0x19'),function(_0x2c50e6){try{agents['queuecallerabandon'](_0x2c50e6);queues[_0xa29a('0x19')](_0x2c50e6);}catch(_0x323846){utils['error'](_0x323846);}});ami['on']('queuecallerjoin',function(_0x3a70f9){try{queues[_0xa29a('0x1a')](_0x3a70f9);recordings[_0xa29a('0x1a')](_0x3a70f9);}catch(_0x1f2bf5){utils['error'](_0x1f2bf5);}});ami['on'](_0xa29a('0x1b'),function(_0x188cca){try{queues[_0xa29a('0x1b')](_0x188cca);}catch(_0x32c4ec){utils[_0xa29a('0x11')](_0x32c4ec);}});ami['on']('musiconholdstart',function(_0xea6ddb){try{queues[_0xa29a('0x1c')](_0xea6ddb);calls[_0xa29a('0x1c')](_0xea6ddb);}catch(_0x1d066b){utils[_0xa29a('0x11')](_0x1d066b);}});ami['on'](_0xa29a('0x1d'),function(_0x42e441){try{queues[_0xa29a('0x1d')](_0x42e441);calls[_0xa29a('0x1d')](_0x42e441);}catch(_0x5b42c9){utils[_0xa29a('0x11')](_0x5b42c9);}});ami['on'](_0xa29a('0x1e'),function(_0x58a48c){try{calls[_0xa29a('0x1e')](_0x58a48c);recordings['newstate'](_0x58a48c);}catch(_0x523b45){utils['error'](_0x523b45);}});ami['on']('hangup',function(_0x55501f){try{calls[_0xa29a('0x1f')](_0x55501f);recordings['hangup'](_0x55501f);dials[_0xa29a('0x1f')](_0x55501f);agents[_0xa29a('0x1f')](_0x55501f);queues[_0xa29a('0x1f')](_0x55501f);}catch(_0xa6f05e){utils['error'](_0xa6f05e);}});ami['on'](_0xa29a('0x20'),function(_0x461877){try{members[_0xa29a('0x20')](_0x461877);}catch(_0x19aafb){utils[_0xa29a('0x11')](_0x19aafb);}});ami['on'](_0xa29a('0x21'),function(_0x20056c){try{queues['blindtransfer'](_0x20056c);agents[_0xa29a('0x21')](_0x20056c);transfers['blindtransfer'](_0x20056c);}catch(_0x15fb9a){utils[_0xa29a('0x11')](_0x15fb9a);}});ami['on'](_0xa29a('0x22'),function(_0x212fb0){try{queues[_0xa29a('0x22')](_0x212fb0);transfers[_0xa29a('0x22')](_0x212fb0);agents[_0xa29a('0x22')](_0x212fb0);calls[_0xa29a('0x22')](_0x212fb0);}catch(_0x31e79d){utils[_0xa29a('0x11')](_0x31e79d);}});ami['on'](_0xa29a('0x23'),function(_0x43219f){try{queues[_0xa29a('0x23')](_0x43219f);recordings[_0xa29a('0x23')](_0x43219f);calls[_0xa29a('0x23')](_0x43219f);dials[_0xa29a('0x23')](_0x43219f);}catch(_0x33d3b9){utils[_0xa29a('0x11')](_0x33d3b9);}});ami['on'](_0xa29a('0x24'),function(_0x5ded47){try{calls['newexten'](_0x5ded47);recordings[_0xa29a('0x24')](_0x5ded47);dials[_0xa29a('0x24')](_0x5ded47);}catch(_0x202f5f){utils[_0xa29a('0x11')](_0x202f5f);}});ami['on'](_0xa29a('0x25'),function(_0x3efccd){try{calls[_0xa29a('0x25')](_0x3efccd);recordings[_0xa29a('0x25')](_0x3efccd);}catch(_0x2fccd3){utils[_0xa29a('0x11')](_0x2fccd3);}});ami['on'](_0xa29a('0x26'),function(_0x1c52c2){try{dials[_0xa29a('0x26')](_0x1c52c2);}catch(_0x4c34af){utils['error'](_0x4c34af);}});ami['on']('dialend',function(_0x1c4c5c){try{dials['dialend'](_0x1c4c5c);}catch(_0x1f030b){utils[_0xa29a('0x11')](_0x1f030b);}});} \ No newline at end of file diff --git a/server/services/xdr/members.controller.js b/server/services/xdr/members.controller.js index 977d5e5..229cbdf 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 _0x82aa=['uniqueid','agentcomplete','assign','queue','cdr','channel','source','data3','destinationchannel','isNil','destination','lodash','util','./utils','Queue:','info','format','MEMBER|%s|%s|%s|%s|%s|%s','interface','data2','membername','type','getUserByInterface','then','name','internal','request','CreateMemberReport','getUserByName','split','catch','error','some','startsWith','devicestatechange','state','device','voice','agent','NOT_INUSE','exitAt','now','duration','diffTime','enterAt'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x82aa,0x92));var _0xa82a=function(_0x21a9d9,_0x4d5ac8){_0x21a9d9=_0x21a9d9-0x0;var _0x46adce=_0x82aa[_0x21a9d9];return _0x46adce;};'use strict';var _=require(_0xa82a('0x0'));var util=require(_0xa82a('0x1'));var utils=require(_0xa82a('0x2'));var members={};var exclude=['Local/_attended@transfer',_0xa82a('0x3')];function writeDB(_0x1e9acc){utils[_0xa82a('0x4')](util[_0xa82a('0x5')](_0xa82a('0x6'),_0x1e9acc['uniqueid'],_0x1e9acc[_0xa82a('0x7')],_0x1e9acc['channel'],_0x1e9acc[_0xa82a('0x8')],_0x1e9acc[_0xa82a('0x9')],_0x1e9acc[_0xa82a('0xa')]));if(_0x1e9acc['interface']){utils[_0xa82a('0xb')](_0x1e9acc['interface'])[_0xa82a('0xc')](function(_0x58d439){if(_0x58d439){_0x1e9acc['membername']=_0x58d439[_0xa82a('0xd')];_0x1e9acc[_0xa82a('0xe')]=_0x58d439[_0xa82a('0xe')];utils[_0xa82a('0xf')](_0xa82a('0x10'),_0x1e9acc);}else{utils[_0xa82a('0x11')](_0x1e9acc[_0xa82a('0x7')][_0xa82a('0x12')]('/')[0x1])['then'](function(_0x652198){if(_0x652198){_0x1e9acc['membername']=_0x652198[_0xa82a('0xd')];_0x1e9acc['internal']=_0x652198[_0xa82a('0xe')];utils[_0xa82a('0xf')](_0xa82a('0x10'),_0x1e9acc);}});}})[_0xa82a('0x13')](function(_0x28f33f){utils[_0xa82a('0x14')](_0x28f33f);});}delete members[_0x1e9acc[_0xa82a('0x7')]];}function startsWith(_0x4e3184,_0x382d75){return _[_0xa82a('0x15')](_0x4e3184,function(_0x609bba){return _[_0xa82a('0x16')](_0x382d75,_0x609bba);});}exports[_0xa82a('0x17')]=function(_0x25c780){switch(_0x25c780[_0xa82a('0x18')]){case'INUSE':case'BUSY':if(!startsWith(exclude,_0x25c780[_0xa82a('0x19')])){members[_0x25c780[_0xa82a('0x19')]]={'channel':_0xa82a('0x1a'),'interface':_0x25c780['device'],'type':'TALKING','enterAt':utils['now'](),'role':_0xa82a('0x1b')};}break;case _0xa82a('0x1c'):if(!_['isNil'](members[_0x25c780['device']])){members[_0x25c780[_0xa82a('0x19')]][_0xa82a('0x1d')]=utils[_0xa82a('0x1e')]();members[_0x25c780[_0xa82a('0x19')]][_0xa82a('0x1f')]=utils[_0xa82a('0x20')](members[_0x25c780['device']][_0xa82a('0x1d')],members[_0x25c780['device']][_0xa82a('0x21')]);if(members[_0x25c780['device']][_0xa82a('0x22')]){writeDB(members[_0x25c780[_0xa82a('0x19')]]);}}default:break;}};exports[_0xa82a('0x23')]=function(_0xad5ff9){if(!_['isNil'](members[_0xad5ff9[_0xa82a('0x7')]])){members[_0xad5ff9[_0xa82a('0x7')]]=_[_0xa82a('0x24')](members[_0xad5ff9[_0xa82a('0x7')]],{'data4':_0xad5ff9[_0xa82a('0x25')],'uniqueid':_0xad5ff9[_0xa82a('0x22')]});}};exports[_0xa82a('0x26')]=function(_0xb5c333){if(_0xb5c333[_0xa82a('0x27')]){var _0x2585df=_0xb5c333['channel'][_0xa82a('0x12')]('-')[0x0];if(!_['isNil'](members[_0x2585df])){members[_0x2585df]=_['assign'](members[_0x2585df],{'data1':members[_0x2585df]['data1']||_0xb5c333[_0xa82a('0xa')],'data2':members[_0x2585df][_0xa82a('0x8')]||_0xb5c333[_0xa82a('0x28')],'data3':members[_0x2585df][_0xa82a('0x29')]||_0xb5c333['destination'],'uniqueid':members[_0x2585df][_0xa82a('0x22')]||_0xb5c333[_0xa82a('0x22')]});if(members[_0x2585df][_0xa82a('0x1d')]){writeDB(members[_0x2585df]);}}}if(_0xb5c333[_0xa82a('0x2a')]){var _0x25bf49=_0xb5c333['destinationchannel']['split']('-')[0x0];if(!_[_0xa82a('0x2b')](members[_0x25bf49])){members[_0x25bf49]=_['assign'](members[_0x25bf49],{'data1':members[_0x25bf49]['data1']||_0xb5c333[_0xa82a('0xa')],'data2':members[_0x25bf49][_0xa82a('0x8')]||_0xb5c333['source'],'data3':members[_0x25bf49]['data3']||_0xb5c333[_0xa82a('0x2c')],'uniqueid':members[_0x25bf49]['uniqueid']||_0xb5c333[_0xa82a('0x22')]});if(members[_0x25bf49][_0xa82a('0x1d')]){writeDB(members[_0x25bf49]);}}}}; \ No newline at end of file +var _0x6252=['getUserByInterface','then','name','internal','request','CreateMemberReport','split','catch','error','some','startsWith','devicestatechange','state','BUSY','device','voice','TALKING','now','agent','NOT_INUSE','exitAt','duration','diffTime','enterAt','agentcomplete','isNil','assign','queue','uniqueid','cdr','data1','data2','data3','destination','destinationchannel','type','source','util','./utils','Queue:','format','MEMBER|%s|%s|%s|%s|%s|%s','interface','channel','membername'];(function(_0x56916d,_0x37b935){var _0x2b7f1f=function(_0x206eb1){while(--_0x206eb1){_0x56916d['push'](_0x56916d['shift']());}};_0x2b7f1f(++_0x37b935);}(_0x6252,0xac));var _0x2625=function(_0x45f951,_0x2750c8){_0x45f951=_0x45f951-0x0;var _0x24756c=_0x6252[_0x45f951];return _0x24756c;};'use strict';var _=require('lodash');var util=require(_0x2625('0x0'));var utils=require(_0x2625('0x1'));var members={};var exclude=['Local/_attended@transfer',_0x2625('0x2')];function writeDB(_0x4a12a6){utils['info'](util[_0x2625('0x3')](_0x2625('0x4'),_0x4a12a6['uniqueid'],_0x4a12a6[_0x2625('0x5')],_0x4a12a6[_0x2625('0x6')],_0x4a12a6['data2'],_0x4a12a6[_0x2625('0x7')],_0x4a12a6['type']));if(_0x4a12a6['interface']){utils[_0x2625('0x8')](_0x4a12a6['interface'])[_0x2625('0x9')](function(_0x4c57a0){if(_0x4c57a0){_0x4a12a6[_0x2625('0x7')]=_0x4c57a0[_0x2625('0xa')];_0x4a12a6['internal']=_0x4c57a0[_0x2625('0xb')];utils[_0x2625('0xc')](_0x2625('0xd'),_0x4a12a6);}else{utils['getUserByName'](_0x4a12a6[_0x2625('0x5')][_0x2625('0xe')]('/')[0x1])[_0x2625('0x9')](function(_0x5c6c8e){if(_0x5c6c8e){_0x4a12a6[_0x2625('0x7')]=_0x5c6c8e['name'];_0x4a12a6[_0x2625('0xb')]=_0x5c6c8e[_0x2625('0xb')];utils[_0x2625('0xc')](_0x2625('0xd'),_0x4a12a6);}});}})[_0x2625('0xf')](function(_0x555a82){utils[_0x2625('0x10')](_0x555a82);});}delete members[_0x4a12a6['interface']];}function startsWith(_0x3c5a0b,_0x176dc7){return _[_0x2625('0x11')](_0x3c5a0b,function(_0x4f8afb){return _[_0x2625('0x12')](_0x176dc7,_0x4f8afb);});}exports[_0x2625('0x13')]=function(_0x21fb32){switch(_0x21fb32[_0x2625('0x14')]){case'INUSE':case _0x2625('0x15'):if(!startsWith(exclude,_0x21fb32[_0x2625('0x16')])){members[_0x21fb32[_0x2625('0x16')]]={'channel':_0x2625('0x17'),'interface':_0x21fb32[_0x2625('0x16')],'type':_0x2625('0x18'),'enterAt':utils[_0x2625('0x19')](),'role':_0x2625('0x1a')};}break;case _0x2625('0x1b'):if(!_['isNil'](members[_0x21fb32[_0x2625('0x16')]])){members[_0x21fb32[_0x2625('0x16')]][_0x2625('0x1c')]=utils[_0x2625('0x19')]();members[_0x21fb32[_0x2625('0x16')]][_0x2625('0x1d')]=utils[_0x2625('0x1e')](members[_0x21fb32['device']]['exitAt'],members[_0x21fb32[_0x2625('0x16')]][_0x2625('0x1f')]);if(members[_0x21fb32[_0x2625('0x16')]]['uniqueid']){writeDB(members[_0x21fb32['device']]);}}default:break;}};exports[_0x2625('0x20')]=function(_0x47966d){if(!_[_0x2625('0x21')](members[_0x47966d[_0x2625('0x5')]])){members[_0x47966d[_0x2625('0x5')]]=_[_0x2625('0x22')](members[_0x47966d['interface']],{'data4':_0x47966d[_0x2625('0x23')],'uniqueid':_0x47966d[_0x2625('0x24')]});}};exports[_0x2625('0x25')]=function(_0x30ec04){if(_0x30ec04[_0x2625('0x6')]){var _0x15330e=_0x30ec04['channel'][_0x2625('0xe')]('-')[0x0];if(!_[_0x2625('0x21')](members[_0x15330e])){members[_0x15330e]=_[_0x2625('0x22')](members[_0x15330e],{'data1':members[_0x15330e][_0x2625('0x26')]||_0x30ec04['type'],'data2':members[_0x15330e][_0x2625('0x27')]||_0x30ec04['source'],'data3':members[_0x15330e][_0x2625('0x28')]||_0x30ec04[_0x2625('0x29')],'uniqueid':members[_0x15330e][_0x2625('0x24')]||_0x30ec04[_0x2625('0x24')]});if(members[_0x15330e][_0x2625('0x1c')]){writeDB(members[_0x15330e]);}}}if(_0x30ec04[_0x2625('0x2a')]){var _0x5aa174=_0x30ec04[_0x2625('0x2a')][_0x2625('0xe')]('-')[0x0];if(!_[_0x2625('0x21')](members[_0x5aa174])){members[_0x5aa174]=_[_0x2625('0x22')](members[_0x5aa174],{'data1':members[_0x5aa174][_0x2625('0x26')]||_0x30ec04[_0x2625('0x2b')],'data2':members[_0x5aa174][_0x2625('0x27')]||_0x30ec04[_0x2625('0x2c')],'data3':members[_0x5aa174][_0x2625('0x28')]||_0x30ec04['destination'],'uniqueid':members[_0x5aa174][_0x2625('0x24')]||_0x30ec04[_0x2625('0x24')]});if(members[_0x5aa174][_0x2625('0x1c')]){writeDB(members[_0x5aa174]);}}}}; \ No newline at end of file diff --git a/server/services/xdr/queues.controller.js b/server/services/xdr/queues.controller.js index 097c87c..065d196 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 _0xbabc=['diffTime','lodash','util','./utils','info','format','QUEUE|%s|%s|%s|%s|%s|%s|%s','uniqueid','channel','queue','lastAssignedTo','calleridnum','queuecallerexitreason','getVoiceQueueByName','then','type','request','CreateVoiceQueueReport','transfereduniqueid','queuecallerjoin','assign','position','now','hangup','isNil','queuecallerleaveAt','queuecallerabandon','queuecallercomplete','COMPLETEDBYAGENT','queuecallerenterreason','variable','queuestatus','value','toUpperCase','queuecallerabandonAt','queuecallerexit','queueposition','queuecallerexitAt','EXITWITHKEY','ABANDONED','queuecallerleave','holdtime','queuecallerjoinAt','count','connectedlinename','agentconnect','assigned','accountcode','membername','queuecallercompleteAt','reason','transfer','TRANSFER','COMPLETEDBY','transfereeuniqueid','transferexten','extension','transferuniqueid','BLINDTRANSFER','origtransfererlinkedid','secondtransfererlinkedid','transfertype','ATTENDED','origtransfererexten','origtransfereruniqueid','ATTENDEDTRANSFER','transfereelinkedid','clone','transfertargetuniqueid','calleridname','mohtime','secondtransfererexten','secondtransfereruniqueid','transfertargetlinkedid','stack','musiconholdstart','musiconholdstartAt','musiconholdstop'];(function(_0x39efba,_0x4df68a){var _0x28c0dc=function(_0x5722cc){while(--_0x5722cc){_0x39efba['push'](_0x39efba['shift']());}};_0x28c0dc(++_0x4df68a);}(_0xbabc,0xeb));var _0xcbab=function(_0x1c0e04,_0x402de0){_0x1c0e04=_0x1c0e04-0x0;var _0x2e01aa=_0xbabc[_0x1c0e04];return _0x2e01aa;};'use strict';var _=require(_0xcbab('0x0'));var util=require(_0xcbab('0x1'));var utils=require(_0xcbab('0x2'));var queues={};function writeDB(_0x5884ed){utils[_0xcbab('0x3')](util[_0xcbab('0x4')](_0xcbab('0x5'),_0x5884ed[_0xcbab('0x6')],_0x5884ed[_0xcbab('0x7')],_0x5884ed[_0xcbab('0x8')],_0x5884ed[_0xcbab('0x9')],_0x5884ed[_0xcbab('0xa')],_0x5884ed['accountcode'],_0x5884ed[_0xcbab('0xb')]));if(_0x5884ed[_0xcbab('0x8')]){utils[_0xcbab('0xc')](_0x5884ed[_0xcbab('0x8')])[_0xcbab('0xd')](function(_0x36e868){if(_0x36e868){_0x5884ed[_0xcbab('0xe')]=_0x36e868[_0xcbab('0xe')];}utils[_0xcbab('0xf')](_0xcbab('0x10'),_0x5884ed);});}else{utils[_0xcbab('0xf')](_0xcbab('0x10'),_0x5884ed);}if(_0x5884ed[_0xcbab('0x11')]){delete queues[_0x5884ed[_0xcbab('0x11')]];}else{delete queues[_0x5884ed[_0xcbab('0x6')]];}}exports[_0xcbab('0x12')]=function(_0x4ad728){queues[_0x4ad728[_0xcbab('0x6')]]=_[_0xcbab('0x13')](_0x4ad728,{'originalposition':_0x4ad728[_0xcbab('0x14')],'queuecallerjoinAt':utils[_0xcbab('0x15')](),'mohtime':0x0});};exports[_0xcbab('0x16')]=function(_0x2abdf2){if(!_[_0xcbab('0x17')](queues[_0x2abdf2[_0xcbab('0x6')]])){if(queues[_0x2abdf2[_0xcbab('0x6')]][_0xcbab('0x18')]){if(!queues[_0x2abdf2['uniqueid']][_0xcbab('0x19')]&&!queues[_0x2abdf2[_0xcbab('0x6')]]['queuecallerexit']){queues[_0x2abdf2[_0xcbab('0x6')]][_0xcbab('0x1a')]=!![];queues[_0x2abdf2[_0xcbab('0x6')]]['queuecallercompleteAt']=utils[_0xcbab('0x15')]();queues[_0x2abdf2[_0xcbab('0x6')]][_0xcbab('0xb')]=_0xcbab('0x1b');}writeDB(queues[_0x2abdf2[_0xcbab('0x6')]]);}else{if(queues[_0x2abdf2[_0xcbab('0x6')]][_0xcbab('0x11')]){queues[queues[_0x2abdf2[_0xcbab('0x6')]]['transfereduniqueid']]=queues[_0x2abdf2['uniqueid']];queues[queues[_0x2abdf2[_0xcbab('0x6')]][_0xcbab('0x11')]][_0xcbab('0x1c')]=0x2;delete queues[_0x2abdf2[_0xcbab('0x6')]];}}}};exports['varset']=function(_0x245cb6){if(!_[_0xcbab('0x17')](_0x245cb6[_0xcbab('0x1d')][_0xcbab('0x1e')])&&_0x245cb6[_0xcbab('0x1f')][_0xcbab('0x20')]()!=='CONTINUE'){if(!_[_0xcbab('0x17')](queues[_0x245cb6[_0xcbab('0x6')]])){queues[_0x245cb6['uniqueid']]['queuecallerabandon']=![];queues[_0x245cb6[_0xcbab('0x6')]][_0xcbab('0x21')]=null;queues[_0x245cb6[_0xcbab('0x6')]][_0xcbab('0x22')]=!![];queues[_0x245cb6['uniqueid']]['queuecallerexitAt']=utils[_0xcbab('0x15')]();queues[_0x245cb6[_0xcbab('0x6')]][_0xcbab('0xb')]=_0x245cb6[_0xcbab('0x1f')]['toUpperCase']();writeDB(queues[_0x245cb6[_0xcbab('0x6')]]);}}else if(!_['isNil'](_0x245cb6[_0xcbab('0x1d')][_0xcbab('0x23')])){if(!_[_0xcbab('0x17')](queues[_0x245cb6[_0xcbab('0x6')]])&&!queues[_0x245cb6[_0xcbab('0x6')]][_0xcbab('0x19')]){queues[_0x245cb6[_0xcbab('0x6')]][_0xcbab('0x19')]=![];queues[_0x245cb6[_0xcbab('0x6')]][_0xcbab('0x21')]=null;queues[_0x245cb6[_0xcbab('0x6')]][_0xcbab('0x22')]=!![];queues[_0x245cb6[_0xcbab('0x6')]][_0xcbab('0x24')]=utils[_0xcbab('0x15')]();queues[_0x245cb6[_0xcbab('0x6')]][_0xcbab('0xb')]=_0xcbab('0x25');}}};exports['queuecallerabandon']=function(_0x226aab){if(!_[_0xcbab('0x17')](queues[_0x226aab[_0xcbab('0x6')]])){queues[_0x226aab[_0xcbab('0x6')]][_0xcbab('0x22')]=![];queues[_0x226aab['uniqueid']]['queuecallerexitAt']=null;queues[_0x226aab['uniqueid']]['queuecallerabandon']=!![];queues[_0x226aab['uniqueid']]['queuecallerabandonAt']=utils[_0xcbab('0x15')]();queues[_0x226aab[_0xcbab('0x6')]][_0xcbab('0xb')]=_0xcbab('0x26');}};exports[_0xcbab('0x27')]=function(_0x43427e){if(!_[_0xcbab('0x17')](queues[_0x43427e[_0xcbab('0x6')]])){queues[_0x43427e[_0xcbab('0x6')]]['queuecallerleave']=!![];queues[_0x43427e[_0xcbab('0x6')]][_0xcbab('0x18')]=utils[_0xcbab('0x15')]();queues[_0x43427e[_0xcbab('0x6')]][_0xcbab('0x28')]=utils['diffTime'](queues[_0x43427e['uniqueid']][_0xcbab('0x18')],queues[_0x43427e[_0xcbab('0x6')]][_0xcbab('0x29')]);queues[_0x43427e[_0xcbab('0x6')]]['position']=_0x43427e[_0xcbab('0x14')];queues[_0x43427e[_0xcbab('0x6')]][_0xcbab('0x2a')]=_0x43427e[_0xcbab('0x2a')];queues[_0x43427e['uniqueid']]['connectedlinenum']=_0x43427e['connectedlinenum'];queues[_0x43427e[_0xcbab('0x6')]][_0xcbab('0x2b')]=_0x43427e['connectedlinename'];}};exports[_0xcbab('0x2c')]=function(_0xf1c660){if(!_['isNil'](queues[_0xf1c660[_0xcbab('0x6')]])){queues[_0xf1c660['uniqueid']][_0xcbab('0x19')]=![];queues[_0xf1c660['uniqueid']]['queuecallerabandon']=![];queues[_0xf1c660[_0xcbab('0x6')]]['queuecallerabandonAt']=null;queues[_0xf1c660[_0xcbab('0x6')]][_0xcbab('0x22')]=![];queues[_0xf1c660[_0xcbab('0x6')]]['queuecallerexitreason']=null;queues[_0xf1c660[_0xcbab('0x6')]]['queuecallerexitAt']=null;queues[_0xf1c660[_0xcbab('0x6')]][_0xcbab('0x2d')]=!![];queues[_0xf1c660[_0xcbab('0x6')]][_0xcbab('0x2e')]=_0xf1c660['destaccountcode'];queues[_0xf1c660[_0xcbab('0x6')]]['lastAssignedTo']=_0xf1c660['membername'];}};exports['agentcomplete']=function(_0x59af6c){if(!_['isNil'](queues[_0x59af6c[_0xcbab('0x6')]])){if(queues[_0x59af6c[_0xcbab('0x6')]][_0xcbab('0x18')]){queues[_0x59af6c['uniqueid']]['queuecallerabandon']=![];queues[_0x59af6c[_0xcbab('0x6')]][_0xcbab('0x19')]=![];queues[_0x59af6c[_0xcbab('0x6')]][_0xcbab('0x21')]=null;queues[_0x59af6c[_0xcbab('0x6')]][_0xcbab('0x22')]=![];queues[_0x59af6c[_0xcbab('0x6')]][_0xcbab('0x24')]=null;queues[_0x59af6c[_0xcbab('0x6')]]['assigned']=!![];queues[_0x59af6c['uniqueid']][_0xcbab('0x9')]=_0x59af6c[_0xcbab('0x2f')];queues[_0x59af6c[_0xcbab('0x6')]][_0xcbab('0x1a')]=!![];queues[_0x59af6c[_0xcbab('0x6')]][_0xcbab('0x30')]=utils['now']();if(_0x59af6c[_0xcbab('0x31')]==_0xcbab('0x32')){if(!queues[_0x59af6c['uniqueid']][_0xcbab('0x32')]){queues[_0x59af6c[_0xcbab('0x6')]]['queuecallerexitreason']=_0xcbab('0x33');}}else{queues[_0x59af6c[_0xcbab('0x6')]]['queuecallerexitreason']=_0xcbab('0x34')+_0x59af6c['reason'][_0xcbab('0x20')]();}writeDB(queues[_0x59af6c['uniqueid']]);}}};exports['blindtransfer']=function(_0x4be9a0){if(!_[_0xcbab('0x17')](queues[_0x4be9a0[_0xcbab('0x35')]])){queues[_0x4be9a0[_0xcbab('0x35')]][_0xcbab('0x32')]=!![];queues[_0x4be9a0[_0xcbab('0x35')]]['transfertype']='BLIND';queues[_0x4be9a0[_0xcbab('0x35')]][_0xcbab('0x36')]=_0x4be9a0[_0xcbab('0x37')];queues[_0x4be9a0[_0xcbab('0x35')]][_0xcbab('0x38')]=_0x4be9a0[_0xcbab('0x35')];queues[_0x4be9a0[_0xcbab('0x35')]]['queuecallerexitreason']=_0xcbab('0x39');}};exports['attendedtransfer']=function(_0x2924bb){try{if(_0x2924bb['origtransfereruniqueid']==_0x2924bb[_0xcbab('0x3a')]){if(!_['isNil'](queues[_0x2924bb[_0xcbab('0x3b')]])){queues[_0x2924bb[_0xcbab('0x3b')]]['transfer']=!![];queues[_0x2924bb[_0xcbab('0x3b')]][_0xcbab('0x3c')]=_0xcbab('0x3d');queues[_0x2924bb['secondtransfererlinkedid']]['transferexten']=_0x2924bb[_0xcbab('0x3e')];queues[_0x2924bb[_0xcbab('0x3b')]][_0xcbab('0x38')]=_0x2924bb[_0xcbab('0x3f')];queues[_0x2924bb[_0xcbab('0x3b')]][_0xcbab('0xb')]=_0xcbab('0x40');}if(!_['isNil'](queues[_0x2924bb[_0xcbab('0x3a')]])){if(_0x2924bb[_0xcbab('0x41')]&&queues[_0x2924bb['transfereelinkedid']]){queues[_0x2924bb[_0xcbab('0x41')]]['queuecallerenterreason']=0x1;queues[_0x2924bb[_0xcbab('0x35')]]=_[_0xcbab('0x42')](queues[_0x2924bb[_0xcbab('0x41')]]);queues[_0x2924bb['transfereeuniqueid']][_0xcbab('0x11')]=_0x2924bb[_0xcbab('0x43')];queues[_0x2924bb['transfereeuniqueid']]['queuecallerenterreason']=0x2;queues[_0x2924bb[_0xcbab('0x35')]]['calleridnum']=queues[_0x2924bb[_0xcbab('0x3b')]][_0xcbab('0xa')];queues[_0x2924bb[_0xcbab('0x35')]]['calleridname']=queues[_0x2924bb['secondtransfererlinkedid']][_0xcbab('0x44')];queues[_0x2924bb[_0xcbab('0x35')]]['queuecallerjoinAt']=utils[_0xcbab('0x15')]();queues[_0x2924bb[_0xcbab('0x35')]][_0xcbab('0x18')]=utils[_0xcbab('0x15')]();queues[_0x2924bb['transfereeuniqueid']]['holdtime']=0x0;queues[_0x2924bb[_0xcbab('0x35')]][_0xcbab('0x45')]=0x0;}else{queues[_0x2924bb[_0xcbab('0x3a')]]['transfereduniqueid']=_0x2924bb['secondtransfererlinkedid'];}}}else if(_0x2924bb['secondtransfereruniqueid']==_0x2924bb[_0xcbab('0x3b')]){if(!_['isNil'](queues[_0x2924bb[_0xcbab('0x3a')]])){queues[_0x2924bb['origtransfererlinkedid']][_0xcbab('0x32')]=!![];queues[_0x2924bb[_0xcbab('0x3a')]][_0xcbab('0x3c')]=_0xcbab('0x3d');queues[_0x2924bb[_0xcbab('0x3a')]][_0xcbab('0x36')]=_0x2924bb[_0xcbab('0x46')];queues[_0x2924bb[_0xcbab('0x3a')]][_0xcbab('0x38')]=_0x2924bb[_0xcbab('0x47')];queues[_0x2924bb[_0xcbab('0x3a')]][_0xcbab('0xb')]=_0xcbab('0x40');}if(!_[_0xcbab('0x17')](queues[_0x2924bb[_0xcbab('0x3b')]])){if(_0x2924bb[_0xcbab('0x48')]&&queues[_0x2924bb[_0xcbab('0x48')]]){queues[_0x2924bb[_0xcbab('0x48')]]['queuecallerenterreason']=0x1;queues[_0x2924bb[_0xcbab('0x43')]]=_[_0xcbab('0x42')](queues[_0x2924bb['transfertargetlinkedid']]);queues[_0x2924bb[_0xcbab('0x43')]][_0xcbab('0x11')]=_0x2924bb[_0xcbab('0x43')];queues[_0x2924bb[_0xcbab('0x43')]][_0xcbab('0x1c')]=0x2;queues[_0x2924bb[_0xcbab('0x43')]][_0xcbab('0xa')]=queues[_0x2924bb[_0xcbab('0x3a')]][_0xcbab('0xa')];queues[_0x2924bb['transfertargetuniqueid']]['calleridname']=queues[_0x2924bb[_0xcbab('0x3a')]][_0xcbab('0x44')];queues[_0x2924bb['transfertargetuniqueid']][_0xcbab('0x29')]=utils[_0xcbab('0x15')]();queues[_0x2924bb[_0xcbab('0x43')]]['queuecallerleaveAt']=utils[_0xcbab('0x15')]();queues[_0x2924bb[_0xcbab('0x43')]][_0xcbab('0x28')]=0x0;queues[_0x2924bb[_0xcbab('0x43')]]['mohtime']=0x0;}else{queues[_0x2924bb[_0xcbab('0x3b')]][_0xcbab('0x11')]=_0x2924bb['origtransfererlinkedid'];}}}}catch(_0x56b87d){utils['error'](_0x56b87d[_0xcbab('0x49')]);}};exports[_0xcbab('0x4a')]=function(_0x292be7){if(!_[_0xcbab('0x17')](queues[_0x292be7['uniqueid']])){queues[_0x292be7[_0xcbab('0x6')]][_0xcbab('0x4b')]=utils[_0xcbab('0x15')]();}};exports[_0xcbab('0x4c')]=function(_0x3d4da8){if(!_['isNil'](queues[_0x3d4da8[_0xcbab('0x6')]])){if(!_[_0xcbab('0x17')](queues[_0x3d4da8[_0xcbab('0x6')]][_0xcbab('0x4b')])){queues[_0x3d4da8['uniqueid']][_0xcbab('0x45')]+=utils[_0xcbab('0x4d')](utils[_0xcbab('0x15')](),queues[_0x3d4da8['uniqueid']][_0xcbab('0x4b')]);delete queues[_0x3d4da8[_0xcbab('0x6')]][_0xcbab('0x4b')];}}}; \ No newline at end of file +var _0x169b=['info','format','uniqueid','channel','calleridnum','queuecallerexitreason','queue','type','request','CreateVoiceQueueReport','transfereduniqueid','queuecallerjoin','assign','position','now','hangup','isNil','queuecallerleaveAt','queuecallerabandon','queuecallerexit','queuecallercomplete','queuecallercompleteAt','COMPLETEDBYAGENT','variable','toUpperCase','value','queueposition','queuecallerabandonAt','queuecallerexitAt','ABANDONED','queuecallerleave','holdtime','queuecallerjoinAt','count','connectedlinenum','connectedlinename','agentconnect','assigned','accountcode','destaccountcode','lastAssignedTo','agentcomplete','membername','reason','transfer','COMPLETEDBY','blindtransfer','transfereeuniqueid','transfertype','BLIND','transferexten','extension','transferuniqueid','BLINDTRANSFER','origtransfereruniqueid','origtransfererlinkedid','secondtransfererlinkedid','ATTENDEDTRANSFER','transfereelinkedid','queuecallerenterreason','transfertargetuniqueid','calleridname','mohtime','secondtransfereruniqueid','ATTENDED','secondtransfererexten','transfertargetlinkedid','clone','error','stack','musiconholdstart','musiconholdstartAt','musiconholdstop','diffTime','lodash','util','./utils'];(function(_0x4d3313,_0x56b507){var _0x4a7a5e=function(_0x45583a){while(--_0x45583a){_0x4d3313['push'](_0x4d3313['shift']());}};_0x4a7a5e(++_0x56b507);}(_0x169b,0xe4));var _0xb169=function(_0x5a80f5,_0x1cbe44){_0x5a80f5=_0x5a80f5-0x0;var _0x3acf33=_0x169b[_0x5a80f5];return _0x3acf33;};'use strict';var _=require(_0xb169('0x0'));var util=require(_0xb169('0x1'));var utils=require(_0xb169('0x2'));var queues={};function writeDB(_0x471113){utils[_0xb169('0x3')](util[_0xb169('0x4')]('QUEUE|%s|%s|%s|%s|%s|%s|%s',_0x471113[_0xb169('0x5')],_0x471113[_0xb169('0x6')],_0x471113['queue'],_0x471113['lastAssignedTo'],_0x471113[_0xb169('0x7')],_0x471113['accountcode'],_0x471113[_0xb169('0x8')]));if(_0x471113['queue']){utils['getVoiceQueueByName'](_0x471113[_0xb169('0x9')])['then'](function(_0x38a6c9){if(_0x38a6c9){_0x471113[_0xb169('0xa')]=_0x38a6c9['type'];}utils[_0xb169('0xb')](_0xb169('0xc'),_0x471113);});}else{utils[_0xb169('0xb')](_0xb169('0xc'),_0x471113);}if(_0x471113['transfereduniqueid']){delete queues[_0x471113[_0xb169('0xd')]];}else{delete queues[_0x471113[_0xb169('0x5')]];}}exports[_0xb169('0xe')]=function(_0x13611f){queues[_0x13611f[_0xb169('0x5')]]=_[_0xb169('0xf')](_0x13611f,{'originalposition':_0x13611f[_0xb169('0x10')],'queuecallerjoinAt':utils[_0xb169('0x11')](),'mohtime':0x0});};exports[_0xb169('0x12')]=function(_0x2f0c53){if(!_[_0xb169('0x13')](queues[_0x2f0c53[_0xb169('0x5')]])){if(queues[_0x2f0c53[_0xb169('0x5')]][_0xb169('0x14')]){if(!queues[_0x2f0c53[_0xb169('0x5')]][_0xb169('0x15')]&&!queues[_0x2f0c53[_0xb169('0x5')]][_0xb169('0x16')]){queues[_0x2f0c53[_0xb169('0x5')]][_0xb169('0x17')]=!![];queues[_0x2f0c53[_0xb169('0x5')]][_0xb169('0x18')]=utils[_0xb169('0x11')]();queues[_0x2f0c53[_0xb169('0x5')]][_0xb169('0x8')]=_0xb169('0x19');}writeDB(queues[_0x2f0c53[_0xb169('0x5')]]);}else{if(queues[_0x2f0c53[_0xb169('0x5')]][_0xb169('0xd')]){queues[queues[_0x2f0c53[_0xb169('0x5')]][_0xb169('0xd')]]=queues[_0x2f0c53[_0xb169('0x5')]];queues[queues[_0x2f0c53[_0xb169('0x5')]][_0xb169('0xd')]]['queuecallerenterreason']=0x2;delete queues[_0x2f0c53['uniqueid']];}}}};exports['varset']=function(_0x5930a1){if(!_[_0xb169('0x13')](_0x5930a1[_0xb169('0x1a')]['queuestatus'])&&_0x5930a1['value'][_0xb169('0x1b')]()!=='CONTINUE'){if(!_[_0xb169('0x13')](queues[_0x5930a1[_0xb169('0x5')]])){queues[_0x5930a1['uniqueid']]['queuecallerabandon']=![];queues[_0x5930a1['uniqueid']]['queuecallerabandonAt']=null;queues[_0x5930a1[_0xb169('0x5')]][_0xb169('0x16')]=!![];queues[_0x5930a1['uniqueid']]['queuecallerexitAt']=utils[_0xb169('0x11')]();queues[_0x5930a1[_0xb169('0x5')]][_0xb169('0x8')]=_0x5930a1[_0xb169('0x1c')][_0xb169('0x1b')]();writeDB(queues[_0x5930a1[_0xb169('0x5')]]);}}else if(!_[_0xb169('0x13')](_0x5930a1[_0xb169('0x1a')][_0xb169('0x1d')])){if(!_['isNil'](queues[_0x5930a1['uniqueid']])&&!queues[_0x5930a1[_0xb169('0x5')]][_0xb169('0x15')]){queues[_0x5930a1['uniqueid']][_0xb169('0x15')]=![];queues[_0x5930a1[_0xb169('0x5')]][_0xb169('0x1e')]=null;queues[_0x5930a1['uniqueid']][_0xb169('0x16')]=!![];queues[_0x5930a1[_0xb169('0x5')]][_0xb169('0x1f')]=utils['now']();queues[_0x5930a1['uniqueid']][_0xb169('0x8')]='EXITWITHKEY';}}};exports[_0xb169('0x15')]=function(_0x220f6d){if(!_[_0xb169('0x13')](queues[_0x220f6d[_0xb169('0x5')]])){queues[_0x220f6d[_0xb169('0x5')]][_0xb169('0x16')]=![];queues[_0x220f6d[_0xb169('0x5')]][_0xb169('0x1f')]=null;queues[_0x220f6d[_0xb169('0x5')]][_0xb169('0x15')]=!![];queues[_0x220f6d[_0xb169('0x5')]]['queuecallerabandonAt']=utils['now']();queues[_0x220f6d[_0xb169('0x5')]][_0xb169('0x8')]=_0xb169('0x20');}};exports['queuecallerleave']=function(_0xf43e68){if(!_[_0xb169('0x13')](queues[_0xf43e68[_0xb169('0x5')]])){queues[_0xf43e68['uniqueid']][_0xb169('0x21')]=!![];queues[_0xf43e68[_0xb169('0x5')]][_0xb169('0x14')]=utils['now']();queues[_0xf43e68[_0xb169('0x5')]][_0xb169('0x22')]=utils['diffTime'](queues[_0xf43e68[_0xb169('0x5')]][_0xb169('0x14')],queues[_0xf43e68[_0xb169('0x5')]][_0xb169('0x23')]);queues[_0xf43e68[_0xb169('0x5')]]['position']=_0xf43e68[_0xb169('0x10')];queues[_0xf43e68[_0xb169('0x5')]][_0xb169('0x24')]=_0xf43e68[_0xb169('0x24')];queues[_0xf43e68[_0xb169('0x5')]][_0xb169('0x25')]=_0xf43e68[_0xb169('0x25')];queues[_0xf43e68['uniqueid']][_0xb169('0x26')]=_0xf43e68[_0xb169('0x26')];}};exports[_0xb169('0x27')]=function(_0x13e217){if(!_[_0xb169('0x13')](queues[_0x13e217['uniqueid']])){queues[_0x13e217[_0xb169('0x5')]]['queuecallerabandon']=![];queues[_0x13e217[_0xb169('0x5')]][_0xb169('0x15')]=![];queues[_0x13e217['uniqueid']][_0xb169('0x1e')]=null;queues[_0x13e217['uniqueid']][_0xb169('0x16')]=![];queues[_0x13e217[_0xb169('0x5')]]['queuecallerexitreason']=null;queues[_0x13e217['uniqueid']][_0xb169('0x1f')]=null;queues[_0x13e217[_0xb169('0x5')]][_0xb169('0x28')]=!![];queues[_0x13e217['uniqueid']][_0xb169('0x29')]=_0x13e217[_0xb169('0x2a')];queues[_0x13e217[_0xb169('0x5')]][_0xb169('0x2b')]=_0x13e217['membername'];}};exports[_0xb169('0x2c')]=function(_0x3c91fb){if(!_['isNil'](queues[_0x3c91fb[_0xb169('0x5')]])){if(queues[_0x3c91fb[_0xb169('0x5')]]['queuecallerleaveAt']){queues[_0x3c91fb[_0xb169('0x5')]]['queuecallerabandon']=![];queues[_0x3c91fb['uniqueid']][_0xb169('0x15')]=![];queues[_0x3c91fb[_0xb169('0x5')]][_0xb169('0x1e')]=null;queues[_0x3c91fb[_0xb169('0x5')]][_0xb169('0x16')]=![];queues[_0x3c91fb['uniqueid']][_0xb169('0x1f')]=null;queues[_0x3c91fb[_0xb169('0x5')]][_0xb169('0x28')]=!![];queues[_0x3c91fb[_0xb169('0x5')]][_0xb169('0x2b')]=_0x3c91fb[_0xb169('0x2d')];queues[_0x3c91fb[_0xb169('0x5')]]['queuecallercomplete']=!![];queues[_0x3c91fb['uniqueid']][_0xb169('0x18')]=utils[_0xb169('0x11')]();if(_0x3c91fb[_0xb169('0x2e')]=='transfer'){if(!queues[_0x3c91fb['uniqueid']][_0xb169('0x2f')]){queues[_0x3c91fb['uniqueid']][_0xb169('0x8')]='TRANSFER';}}else{queues[_0x3c91fb['uniqueid']][_0xb169('0x8')]=_0xb169('0x30')+_0x3c91fb['reason'][_0xb169('0x1b')]();}writeDB(queues[_0x3c91fb['uniqueid']]);}}};exports[_0xb169('0x31')]=function(_0x121142){if(!_['isNil'](queues[_0x121142['transfereeuniqueid']])){queues[_0x121142[_0xb169('0x32')]][_0xb169('0x2f')]=!![];queues[_0x121142[_0xb169('0x32')]][_0xb169('0x33')]=_0xb169('0x34');queues[_0x121142[_0xb169('0x32')]][_0xb169('0x35')]=_0x121142[_0xb169('0x36')];queues[_0x121142['transfereeuniqueid']][_0xb169('0x37')]=_0x121142['transfereeuniqueid'];queues[_0x121142[_0xb169('0x32')]][_0xb169('0x8')]=_0xb169('0x38');}};exports['attendedtransfer']=function(_0x236adf){try{if(_0x236adf[_0xb169('0x39')]==_0x236adf[_0xb169('0x3a')]){if(!_[_0xb169('0x13')](queues[_0x236adf['secondtransfererlinkedid']])){queues[_0x236adf[_0xb169('0x3b')]][_0xb169('0x2f')]=!![];queues[_0x236adf[_0xb169('0x3b')]][_0xb169('0x33')]='ATTENDED';queues[_0x236adf['secondtransfererlinkedid']][_0xb169('0x35')]=_0x236adf['origtransfererexten'];queues[_0x236adf[_0xb169('0x3b')]][_0xb169('0x37')]=_0x236adf['origtransfereruniqueid'];queues[_0x236adf[_0xb169('0x3b')]]['queuecallerexitreason']=_0xb169('0x3c');}if(!_[_0xb169('0x13')](queues[_0x236adf[_0xb169('0x3a')]])){if(_0x236adf[_0xb169('0x3d')]&&queues[_0x236adf[_0xb169('0x3d')]]){queues[_0x236adf[_0xb169('0x3d')]][_0xb169('0x3e')]=0x1;queues[_0x236adf['transfereeuniqueid']]=_['clone'](queues[_0x236adf[_0xb169('0x3d')]]);queues[_0x236adf[_0xb169('0x32')]][_0xb169('0xd')]=_0x236adf[_0xb169('0x3f')];queues[_0x236adf['transfereeuniqueid']]['queuecallerenterreason']=0x2;queues[_0x236adf['transfereeuniqueid']][_0xb169('0x7')]=queues[_0x236adf[_0xb169('0x3b')]][_0xb169('0x7')];queues[_0x236adf[_0xb169('0x32')]]['calleridname']=queues[_0x236adf[_0xb169('0x3b')]][_0xb169('0x40')];queues[_0x236adf['transfereeuniqueid']][_0xb169('0x23')]=utils[_0xb169('0x11')]();queues[_0x236adf[_0xb169('0x32')]][_0xb169('0x14')]=utils[_0xb169('0x11')]();queues[_0x236adf[_0xb169('0x32')]][_0xb169('0x22')]=0x0;queues[_0x236adf[_0xb169('0x32')]][_0xb169('0x41')]=0x0;}else{queues[_0x236adf[_0xb169('0x3a')]][_0xb169('0xd')]=_0x236adf['secondtransfererlinkedid'];}}}else if(_0x236adf[_0xb169('0x42')]==_0x236adf[_0xb169('0x3b')]){if(!_['isNil'](queues[_0x236adf[_0xb169('0x3a')]])){queues[_0x236adf[_0xb169('0x3a')]][_0xb169('0x2f')]=!![];queues[_0x236adf[_0xb169('0x3a')]][_0xb169('0x33')]=_0xb169('0x43');queues[_0x236adf['origtransfererlinkedid']][_0xb169('0x35')]=_0x236adf[_0xb169('0x44')];queues[_0x236adf[_0xb169('0x3a')]][_0xb169('0x37')]=_0x236adf[_0xb169('0x42')];queues[_0x236adf[_0xb169('0x3a')]]['queuecallerexitreason']=_0xb169('0x3c');}if(!_[_0xb169('0x13')](queues[_0x236adf[_0xb169('0x3b')]])){if(_0x236adf['transfertargetlinkedid']&&queues[_0x236adf[_0xb169('0x45')]]){queues[_0x236adf[_0xb169('0x45')]]['queuecallerenterreason']=0x1;queues[_0x236adf[_0xb169('0x3f')]]=_[_0xb169('0x46')](queues[_0x236adf['transfertargetlinkedid']]);queues[_0x236adf[_0xb169('0x3f')]][_0xb169('0xd')]=_0x236adf[_0xb169('0x3f')];queues[_0x236adf[_0xb169('0x3f')]]['queuecallerenterreason']=0x2;queues[_0x236adf[_0xb169('0x3f')]][_0xb169('0x7')]=queues[_0x236adf[_0xb169('0x3a')]]['calleridnum'];queues[_0x236adf[_0xb169('0x3f')]]['calleridname']=queues[_0x236adf[_0xb169('0x3a')]][_0xb169('0x40')];queues[_0x236adf['transfertargetuniqueid']]['queuecallerjoinAt']=utils['now']();queues[_0x236adf[_0xb169('0x3f')]][_0xb169('0x14')]=utils[_0xb169('0x11')]();queues[_0x236adf[_0xb169('0x3f')]]['holdtime']=0x0;queues[_0x236adf['transfertargetuniqueid']][_0xb169('0x41')]=0x0;}else{queues[_0x236adf[_0xb169('0x3b')]]['transfereduniqueid']=_0x236adf[_0xb169('0x3a')];}}}}catch(_0x2fc903){utils[_0xb169('0x47')](_0x2fc903[_0xb169('0x48')]);}};exports[_0xb169('0x49')]=function(_0x325344){if(!_[_0xb169('0x13')](queues[_0x325344[_0xb169('0x5')]])){queues[_0x325344['uniqueid']][_0xb169('0x4a')]=utils[_0xb169('0x11')]();}};exports[_0xb169('0x4b')]=function(_0x1045af){if(!_['isNil'](queues[_0x1045af['uniqueid']])){if(!_['isNil'](queues[_0x1045af['uniqueid']][_0xb169('0x4a')])){queues[_0x1045af[_0xb169('0x5')]]['mohtime']+=utils[_0xb169('0x4c')](utils[_0xb169('0x11')](),queues[_0x1045af['uniqueid']][_0xb169('0x4a')]);delete queues[_0x1045af['uniqueid']]['musiconholdstartAt'];}}}; \ No newline at end of file diff --git a/server/services/xdr/recordings.controller.js b/server/services/xdr/recordings.controller.js index caffb5f..3d6474f 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 _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(_0x31d33a,_0x33e480){var _0x24eaa2=function(_0x437ed5){while(--_0x437ed5){_0x31d33a['push'](_0x31d33a['shift']());}};_0x24eaa2(++_0x33e480);}(_0xe706,0xa3));var _0x6e70=function(_0x434f2e,_0x68493e){_0x434f2e=_0x434f2e-0x0;var _0x76c0b9=_0xe706[_0x434f2e];return _0x76c0b9;};'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 +var _0xedd9=['UserId','request','CreateVoiceRecording','uniqueid','linkedid','context','channel','error','stack','isNil','channelstate','varset','variable','endsWith','value','.wav49','.WAV','find','monitors','calleridnum','calleridname','connectedlinenum','connectedlinename','type','outbound','clone','newexten','application','set','startsWith','appdata','cdr','split','substring','lastIndexOf','queuecallerjoin','queue','./utils','debug','accountcode','getUserByInternal','then','name'];(function(_0x33314d,_0x499628){var _0x4ffe8e=function(_0xb1ec35){while(--_0xb1ec35){_0x33314d['push'](_0x33314d['shift']());}};_0x4ffe8e(++_0x499628);}(_0xedd9,0xfc));var _0x9edd=function(_0x3e33d3,_0xa30c3){_0x3e33d3=_0x3e33d3-0x0;var _0x3ce611=_0xedd9[_0x3e33d3];return _0x3ce611;};'use strict';var _=require('lodash');var utils=require(_0x9edd('0x0'));var recordings={};function writeDB(_0x2d7989){utils[_0x9edd('0x1')](_0x2d7989);if(_0x2d7989[_0x9edd('0x2')]){utils[_0x9edd('0x3')](_0x2d7989[_0x9edd('0x2')])[_0x9edd('0x4')](function(_0x36b53f){if(_0x36b53f){_0x2d7989['membername']=_0x36b53f[_0x9edd('0x5')];_0x2d7989[_0x9edd('0x6')]=_0x36b53f['id'];}utils[_0x9edd('0x7')](_0x9edd('0x8'),_0x2d7989);});}else{utils['request'](_0x9edd('0x8'),_0x2d7989);}}exports['newchannel']=function(_0x172522){try{if(_0x172522[_0x9edd('0x9')]==_0x172522[_0x9edd('0xa')]){recordings[_0x172522[_0x9edd('0x9')]]={'uniqueid':_0x172522['uniqueid'],'accountcode':_0x172522[_0x9edd('0x2')],'exten':_0x172522['exten'],'context':_0x172522[_0x9edd('0xb')],'channel':_0x172522[_0x9edd('0xc')],'monitors':[]};}}catch(_0x523026){utils[_0x9edd('0xd')](_0x523026[_0x9edd('0xe')]);}};exports['newstate']=function(_0x30c0d7){try{if(!_[_0x9edd('0xf')](recordings[_0x30c0d7[_0x9edd('0x9')]])&&_0x30c0d7[_0x9edd('0x10')]==0x6){}else if(!_[_0x9edd('0xf')](recordings[_0x30c0d7[_0x9edd('0xa')]])&&_0x30c0d7[_0x9edd('0x10')]==0x6&&_0x30c0d7[_0x9edd('0xb')]!='transfer'){recordings[_0x30c0d7[_0x9edd('0xa')]][_0x9edd('0x2')]=_0x30c0d7[_0x9edd('0x2')];}}catch(_0x4d9a7){utils[_0x9edd('0xd')](_0x4d9a7[_0x9edd('0xe')]);}};exports[_0x9edd('0x11')]=function(_0x75a4ab){try{if(!_['isNil'](_0x75a4ab[_0x9edd('0x12')])&&!_[_0x9edd('0xf')](_0x75a4ab[_0x9edd('0x12')]['mixmonitor_filename'])){if(_[_0x9edd('0x13')](_0x75a4ab[_0x9edd('0x14')],_0x9edd('0x15'))){_0x75a4ab['value']=_0x75a4ab[_0x9edd('0x14')]['replace'](_0x9edd('0x15'),_0x9edd('0x16'));}if(recordings[_0x75a4ab['linkedid']]){var _0x498977=_[_0x9edd('0x17')](recordings[_0x75a4ab['linkedid']][_0x9edd('0x18')],{'value':_0x75a4ab['value']});if(_['isNil'](_0x498977)){recordings[_0x75a4ab[_0x9edd('0xa')]][_0x9edd('0x18')]['push']({'value':_0x75a4ab['value']});}}}}catch(_0x341d67){utils[_0x9edd('0xd')](_0x341d67[_0x9edd('0xe')]);}};exports['hangup']=function(_0x3741c8){try{if(!_[_0x9edd('0xf')](recordings[_0x3741c8[_0x9edd('0x9')]])){recordings[_0x3741c8[_0x9edd('0x9')]][_0x9edd('0x19')]=_0x3741c8['calleridnum'];recordings[_0x3741c8[_0x9edd('0x9')]][_0x9edd('0x1a')]=_0x3741c8[_0x9edd('0x1a')];recordings[_0x3741c8[_0x9edd('0x9')]][_0x9edd('0x1b')]=_0x3741c8['connectedlinenum'];recordings[_0x3741c8['uniqueid']][_0x9edd('0x1c')]=_0x3741c8[_0x9edd('0x1c')];if(recordings[_0x3741c8[_0x9edd('0x9')]][_0x9edd('0x1d')]==_0x9edd('0x1e')&&recordings[_0x3741c8['uniqueid']]['accountcode']){recordings[_0x3741c8[_0x9edd('0x9')]][_0x9edd('0x1b')]=recordings[_0x3741c8[_0x9edd('0x9')]]['accountcode'];recordings[_0x3741c8[_0x9edd('0x9')]][_0x9edd('0x1c')]='';}recordings[_0x3741c8[_0x9edd('0x9')]][_0x9edd('0x18')]['forEach'](_0x2155a1=>{var _0x3fb556=_[_0x9edd('0x1f')](recordings[_0x3741c8[_0x9edd('0x9')]]);_0x3fb556[_0x9edd('0x14')]=_0x2155a1[_0x9edd('0x14')];writeDB(_0x3fb556);});delete recordings[_0x3741c8[_0x9edd('0x9')]];}}catch(_0x1fba7b){utils[_0x9edd('0xd')](_0x1fba7b[_0x9edd('0xe')]);}};exports[_0x9edd('0x20')]=function(_0x138002){try{if(!_[_0x9edd('0xf')](recordings[_0x138002[_0x9edd('0x9')]])){if(_0x138002[_0x9edd('0x21')]['toLowerCase']()==_0x9edd('0x22')&&_[_0x9edd('0x23')](_0x138002[_0x9edd('0x24')]['toLowerCase'](),_0x9edd('0x25'))){var _0x3990fb=_0x138002[_0x9edd('0x24')][_0x9edd('0x26')]('=');var _0x21bc30=_0x3990fb[0x0][_0x9edd('0x27')](_0x3990fb[0x0][_0x9edd('0x28')]('(')+0x1,_0x3990fb[0x0][_0x9edd('0x28')](')'));var _0xd0fd74=_0x3990fb[0x1];recordings[_0x138002[_0x9edd('0x9')]][_0x21bc30]=_0xd0fd74;}}}catch(_0x29e789){utils[_0x9edd('0xd')](_0x29e789[_0x9edd('0xe')]);}};exports[_0x9edd('0x29')]=function(_0x5757fc){try{if(!_[_0x9edd('0xf')](recordings[_0x5757fc['uniqueid']])){recordings[_0x5757fc[_0x9edd('0x9')]][_0x9edd('0x2a')]=_0x5757fc[_0x9edd('0x2a')];}}catch(_0x434d26){utils[_0x9edd('0xd')](_0x434d26['stack']);}}; \ No newline at end of file diff --git a/server/services/xdr/transfers.controller.js b/server/services/xdr/transfers.controller.js index 72b2723..1880bc2 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 _0x3164=['request','blind','error','stack','attendedtransfer','assign','origtransfererchannel','origtransferercalleridnum','origtransferercalleridname','secondtransfererconnectedlinenum','secondtransfererconnectedlinename','secondtransferercontext','secondtransfererexten','origtransfererlinkedid','origtransferercontext','attended','isNil','transfereechannel','transfertargetcalleridnum','transfertargetaccountcode','transfertargetcontext','transfertargetlinkedid','lodash','util','./utils','info','TRANSFER|%s','type'];(function(_0x4c7c25,_0x1e16a8){var _0x297619=function(_0x453f76){while(--_0x453f76){_0x4c7c25['push'](_0x4c7c25['shift']());}};_0x297619(++_0x1e16a8);}(_0x3164,0x182));var _0x4316=function(_0x1322b1,_0x34df7c){_0x1322b1=_0x1322b1-0x0;var _0x33e327=_0x3164[_0x1322b1];return _0x33e327;};'use strict';var _=require(_0x4316('0x0'));var util=require(_0x4316('0x1'));var utils=require(_0x4316('0x2'));function writeDB(_0x1738ab){utils[_0x4316('0x3')](util['format'](_0x4316('0x4'),_0x1738ab[_0x4316('0x5')]));utils[_0x4316('0x6')]('CreateVoiceTransferReport',_0x1738ab);}exports['blindtransfer']=function(_0x27bfc8){try{_0x27bfc8[_0x4316('0x5')]=_0x4316('0x7');writeDB(_0x27bfc8);}catch(_0x29c3c1){utils[_0x4316('0x8')](_0x29c3c1[_0x4316('0x9')]);}};exports[_0x4316('0xa')]=function(_0x2b1420){try{_0x2b1420=_[_0x4316('0xb')](_0x2b1420,{'transfererchannel':_0x2b1420[_0x4316('0xc')],'transferercalleridnum':_0x2b1420[_0x4316('0xd')],'transferercalleridname':_0x2b1420[_0x4316('0xe')],'transfererconnectedlinenum':_0x2b1420[_0x4316('0xf')],'transfererconnectedlinename':_0x2b1420[_0x4316('0x10')],'transfereraccountcode':_0x2b1420['origtransfereraccountcode'],'transferercontext':_0x2b1420[_0x4316('0x11')],'transfererexten':_0x2b1420[_0x4316('0x12')],'transfererlinkedid':_0x2b1420[_0x4316('0x13')],'context':_0x2b1420[_0x4316('0x14')],'extension':_0x2b1420['origtransfererexten'],'type':_0x4316('0x15')});if(_[_0x4316('0x16')](_0x2b1420[_0x4316('0x17')])){_0x2b1420=_[_0x4316('0xb')](_0x2b1420,{'transfereechannel':_0x2b1420['transfertargetchannel'],'transfereecalleridnum':_0x2b1420[_0x4316('0x18')],'transfereecalleridname':_0x2b1420['transfertargetcalleridname'],'transfereeconnectedlinenum':_0x2b1420['transfertargetconnectedlinenum'],'transfereeconnectedlinename':_0x2b1420['transfertargetconnectedlinename'],'transfereeaccountcode':_0x2b1420[_0x4316('0x19')],'transfereecontext':_0x2b1420[_0x4316('0x1a')],'transfereeexten':_0x2b1420['transfertargetexten'],'transfereelinkedid':_0x2b1420[_0x4316('0x1b')]});}writeDB(_0x2b1420);}catch(_0x486a64){utils[_0x4316('0x8')](_0x486a64[_0x4316('0x9')]);}}; \ No newline at end of file +var _0xc57c=['origtransferercalleridname','secondtransfererconnectedlinenum','secondtransfererconnectedlinename','origtransfereraccountcode','secondtransfererexten','origtransfererlinkedid','origtransferercontext','origtransfererexten','attended','isNil','transfereechannel','transfertargetchannel','transfertargetcalleridnum','transfertargetcalleridname','transfertargetconnectedlinenum','transfertargetconnectedlinename','transfertargetaccountcode','transfertargetcontext','transfertargetlinkedid','lodash','./utils','info','format','TRANSFER|%s','type','request','CreateVoiceTransferReport','blindtransfer','blind','error','stack','attendedtransfer','assign','origtransfererchannel','origtransferercalleridnum'];(function(_0x2083ad,_0x1bbf3d){var _0x178293=function(_0x957979){while(--_0x957979){_0x2083ad['push'](_0x2083ad['shift']());}};_0x178293(++_0x1bbf3d);}(_0xc57c,0x9f));var _0xcc57=function(_0x111eaa,_0x51ad9e){_0x111eaa=_0x111eaa-0x0;var _0x5e0792=_0xc57c[_0x111eaa];return _0x5e0792;};'use strict';var _=require(_0xcc57('0x0'));var util=require('util');var utils=require(_0xcc57('0x1'));function writeDB(_0x44420c){utils[_0xcc57('0x2')](util[_0xcc57('0x3')](_0xcc57('0x4'),_0x44420c[_0xcc57('0x5')]));utils[_0xcc57('0x6')](_0xcc57('0x7'),_0x44420c);}exports[_0xcc57('0x8')]=function(_0x47e843){try{_0x47e843[_0xcc57('0x5')]=_0xcc57('0x9');writeDB(_0x47e843);}catch(_0x49138a){utils[_0xcc57('0xa')](_0x49138a[_0xcc57('0xb')]);}};exports[_0xcc57('0xc')]=function(_0x4e3395){try{_0x4e3395=_[_0xcc57('0xd')](_0x4e3395,{'transfererchannel':_0x4e3395[_0xcc57('0xe')],'transferercalleridnum':_0x4e3395[_0xcc57('0xf')],'transferercalleridname':_0x4e3395[_0xcc57('0x10')],'transfererconnectedlinenum':_0x4e3395[_0xcc57('0x11')],'transfererconnectedlinename':_0x4e3395[_0xcc57('0x12')],'transfereraccountcode':_0x4e3395[_0xcc57('0x13')],'transferercontext':_0x4e3395['secondtransferercontext'],'transfererexten':_0x4e3395[_0xcc57('0x14')],'transfererlinkedid':_0x4e3395[_0xcc57('0x15')],'context':_0x4e3395[_0xcc57('0x16')],'extension':_0x4e3395[_0xcc57('0x17')],'type':_0xcc57('0x18')});if(_[_0xcc57('0x19')](_0x4e3395[_0xcc57('0x1a')])){_0x4e3395=_['assign'](_0x4e3395,{'transfereechannel':_0x4e3395[_0xcc57('0x1b')],'transfereecalleridnum':_0x4e3395[_0xcc57('0x1c')],'transfereecalleridname':_0x4e3395[_0xcc57('0x1d')],'transfereeconnectedlinenum':_0x4e3395[_0xcc57('0x1e')],'transfereeconnectedlinename':_0x4e3395[_0xcc57('0x1f')],'transfereeaccountcode':_0x4e3395[_0xcc57('0x20')],'transfereecontext':_0x4e3395[_0xcc57('0x21')],'transfereeexten':_0x4e3395['transfertargetexten'],'transfereelinkedid':_0x4e3395[_0xcc57('0x22')]});}writeDB(_0x4e3395);}catch(_0x75a5f4){utils[_0xcc57('0xa')](_0x75a5f4[_0xcc57('0xb')]);}}; \ No newline at end of file diff --git a/server/services/xdr/utils.js b/server/services/xdr/utils.js index e2e6cbc..b69fe85 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 _0x341b=['GetUser','internal','GETUSER|','result','length','FOUND','NOTFOUND','getUserByInternal','getUserByInterface','getUserByName','GetVoiceQueue','name','acw','GETVOICEQUEUEBYNAME|','add','seconds','format','YYYY-MM-DD\x20HH:mm:ss','subtractTime','subtract','diffTime','sumTime','now','isAfter','jayson/promise','moment','client','http','info','debug','stringify','error','stack','request','then','catch'];(function(_0x594ee0,_0x481731){var _0x41d4df=function(_0x5194f5){while(--_0x5194f5){_0x594ee0['push'](_0x594ee0['shift']());}};_0x41d4df(++_0x481731);}(_0x341b,0xf0));var _0xb341=function(_0x36cb9c,_0x5e5f20){_0x36cb9c=_0x36cb9c-0x0;var _0x391f0c=_0x341b[_0x36cb9c];return _0x391f0c;};'use strict';var jayson=require(_0xb341('0x0'));var moment=require(_0xb341('0x1'));var BPromise=require('bluebird');var client=jayson[_0xb341('0x2')][_0xb341('0x3')]({'port':0x2329});var logger=require('../../config/logger')('xdr');exports[_0xb341('0x4')]=function(_0x28520d){logger[_0xb341('0x4')](_0x28520d);};exports[_0xb341('0x5')]=function(_0x1944cf){logger[_0xb341('0x5')](JSON[_0xb341('0x6')](_0x1944cf));};exports[_0xb341('0x7')]=function(_0x2f871f){logger[_0xb341('0x7')](_0x2f871f[_0xb341('0x8')]);};exports[_0xb341('0x9')]=function(_0x4edf76,_0x34b05a){return client[_0xb341('0x9')](_0x4edf76,{'body':_0x34b05a})[_0xb341('0xa')](function(_0x28adbb){logger[_0xb341('0x5')](JSON[_0xb341('0x6')](_0x28adbb));})[_0xb341('0xb')](function(_0x6fe40f){logger['error'](_0x6fe40f['stack']);});};function getUser(_0x5c846f){return client[_0xb341('0x9')](_0xb341('0xc'),{'options':{'raw':!![],'attributes':['id',_0xb341('0xd'),'name','interface'],'where':_0x5c846f,'limit':0x1}})[_0xb341('0xa')](function(_0x4b260a){logger[_0xb341('0x4')](_0xb341('0xe')+JSON[_0xb341('0x6')](_0x5c846f)+'|'+(_0x4b260a[_0xb341('0xf')][_0xb341('0x10')]?_0xb341('0x11'):_0xb341('0x12')));return _0x4b260a[_0xb341('0xf')][_0xb341('0x10')]?_0x4b260a[_0xb341('0xf')][0x0]:null;});}exports[_0xb341('0x13')]=function(_0x1ce211){return new BPromise(function(_0x45ecf3,_0x1c2d2d){if(_0x1ce211){return getUser({'internal':_0x1ce211})[_0xb341('0xa')](function(_0x125514){return _0x45ecf3(_0x125514);})['catch'](function(_0x59e5fb){logger['error'](_0x59e5fb['stack']);return _0x45ecf3(null);});}else{return _0x45ecf3(null);}});};exports[_0xb341('0x14')]=function(_0x147bc8){return new BPromise(function(_0x6620c4,_0x316afb){if(_0x147bc8){return getUser({'interface':_0x147bc8})[_0xb341('0xa')](function(_0x3e4b51){return _0x6620c4(_0x3e4b51);})[_0xb341('0xb')](function(_0x10e85c){logger['error'](_0x10e85c[_0xb341('0x8')]);return _0x6620c4(null);});}else{return _0x6620c4(null);}});};exports[_0xb341('0x15')]=function(_0x1d6889){return new BPromise(function(_0x7b1a62,_0x4a8888){if(_0x1d6889){return getUser({'name':_0x1d6889})[_0xb341('0xa')](function(_0x1ac49f){return _0x7b1a62(_0x1ac49f);})[_0xb341('0xb')](function(_0x4e8d3c){logger[_0xb341('0x7')](_0x4e8d3c['stack']);return _0x7b1a62(null);});}else{return _0x7b1a62(null);}});};exports['getVoiceQueueByName']=function(_0x52082d){return new BPromise(function(_0xf4d0aa,_0x4fd360){if(_0x52082d){return client[_0xb341('0x9')](_0xb341('0x16'),{'options':{'raw':!![],'attributes':['id',_0xb341('0x17'),'type',_0xb341('0x18'),'acwTimeout'],'where':{'name':_0x52082d},'limit':0x1}})[_0xb341('0xa')](function(_0x1fdbe4){logger[_0xb341('0x4')](_0xb341('0x19')+_0x52082d+'|'+(_0x1fdbe4['result'][_0xb341('0x10')]?_0xb341('0x11'):'NOTFOUND'));return _0xf4d0aa(_0x1fdbe4[_0xb341('0xf')]['length']?_0x1fdbe4['result'][0x0]:null);})[_0xb341('0xb')](function(_0x28a6e6){logger[_0xb341('0x7')](_0x28a6e6[_0xb341('0x8')]);return _0xf4d0aa(null);});}else{return _0xf4d0aa(null);}});};exports['addTime']=function(_0x26972e,_0x4a63b8){return moment(_0x26972e)[_0xb341('0x1a')](_0x4a63b8,_0xb341('0x1b'))[_0xb341('0x1c')](_0xb341('0x1d'));};exports[_0xb341('0x1e')]=function(_0x1fc5e5,_0x30d7af){return moment(_0x1fc5e5)[_0xb341('0x1f')](_0x30d7af,'seconds')[_0xb341('0x1c')](_0xb341('0x1d'));};exports[_0xb341('0x20')]=function(_0x10e363,_0x2cebb8){return moment(_0x10e363)['diff'](moment(_0x2cebb8),_0xb341('0x1b'));};exports[_0xb341('0x21')]=function(_0x42a53c,_0x4d7c02){return parseInt(_0x42a53c,0xa)+parseInt(_0x4d7c02,0xa);};exports[_0xb341('0x22')]=function(){return moment()[_0xb341('0x1c')](_0xb341('0x1d'));};exports[_0xb341('0x23')]=function(_0x4a54d2,_0x3b96ca){if(_0x3b96ca){return moment(_0x4a54d2)[_0xb341('0x23')](_0x3b96ca);}else{return!![];}};exports['isBefore']=function(_0x405b69,_0x52d525){if(_0x52d525){return moment(_0x405b69)['isBefore'](_0x52d525);}else if(_0x405b69){return!![];}else{return![];}}; \ No newline at end of file +var _0x9314=['length','getUserByInternal','getUserByInterface','getUserByName','getVoiceQueueByName','GetVoiceQueue','acw','acwTimeout','addTime','format','YYYY-MM-DD\x20HH:mm:ss','subtractTime','subtract','seconds','diff','sumTime','isAfter','isBefore','jayson/promise','moment','bluebird','client','http','../../config/logger','xdr','info','debug','stringify','stack','request','then','catch','error','internal','name','interface','GETUSER|','result','FOUND','NOTFOUND'];(function(_0x546895,_0xb414da){var _0x3b5a09=function(_0x1da01c){while(--_0x1da01c){_0x546895['push'](_0x546895['shift']());}};_0x3b5a09(++_0xb414da);}(_0x9314,0x17a));var _0x4931=function(_0x1694f5,_0x49b7c3){_0x1694f5=_0x1694f5-0x0;var _0x5b4321=_0x9314[_0x1694f5];return _0x5b4321;};'use strict';var jayson=require(_0x4931('0x0'));var moment=require(_0x4931('0x1'));var BPromise=require(_0x4931('0x2'));var client=jayson[_0x4931('0x3')][_0x4931('0x4')]({'port':0x2329});var logger=require(_0x4931('0x5'))(_0x4931('0x6'));exports[_0x4931('0x7')]=function(_0xd90e0b){logger['info'](_0xd90e0b);};exports[_0x4931('0x8')]=function(_0x50deb6){logger[_0x4931('0x8')](JSON[_0x4931('0x9')](_0x50deb6));};exports['error']=function(_0x3b6669){logger['error'](_0x3b6669[_0x4931('0xa')]);};exports[_0x4931('0xb')]=function(_0x2e31f3,_0x239974){return client[_0x4931('0xb')](_0x2e31f3,{'body':_0x239974})[_0x4931('0xc')](function(_0x7c6d86){logger[_0x4931('0x8')](JSON[_0x4931('0x9')](_0x7c6d86));})[_0x4931('0xd')](function(_0x223061){logger[_0x4931('0xe')](_0x223061[_0x4931('0xa')]);});};function getUser(_0x3abc6c){return client[_0x4931('0xb')]('GetUser',{'options':{'raw':!![],'attributes':['id',_0x4931('0xf'),_0x4931('0x10'),_0x4931('0x11')],'where':_0x3abc6c,'limit':0x1}})[_0x4931('0xc')](function(_0x590c2a){logger[_0x4931('0x7')](_0x4931('0x12')+JSON['stringify'](_0x3abc6c)+'|'+(_0x590c2a[_0x4931('0x13')]['length']?_0x4931('0x14'):_0x4931('0x15')));return _0x590c2a['result'][_0x4931('0x16')]?_0x590c2a[_0x4931('0x13')][0x0]:null;});}exports[_0x4931('0x17')]=function(_0x4cdf36){return new BPromise(function(_0x1f9374,_0x1ed906){if(_0x4cdf36){return getUser({'internal':_0x4cdf36})['then'](function(_0x3281b9){return _0x1f9374(_0x3281b9);})[_0x4931('0xd')](function(_0x76e77b){logger[_0x4931('0xe')](_0x76e77b['stack']);return _0x1f9374(null);});}else{return _0x1f9374(null);}});};exports[_0x4931('0x18')]=function(_0x5180e2){return new BPromise(function(_0x17970c,_0x1acb26){if(_0x5180e2){return getUser({'interface':_0x5180e2})[_0x4931('0xc')](function(_0x4ca2b5){return _0x17970c(_0x4ca2b5);})[_0x4931('0xd')](function(_0xfc1919){logger[_0x4931('0xe')](_0xfc1919[_0x4931('0xa')]);return _0x17970c(null);});}else{return _0x17970c(null);}});};exports[_0x4931('0x19')]=function(_0x370fe3){return new BPromise(function(_0x4113b9,_0x57ef66){if(_0x370fe3){return getUser({'name':_0x370fe3})[_0x4931('0xc')](function(_0x380708){return _0x4113b9(_0x380708);})['catch'](function(_0x494fb4){logger[_0x4931('0xe')](_0x494fb4[_0x4931('0xa')]);return _0x4113b9(null);});}else{return _0x4113b9(null);}});};exports[_0x4931('0x1a')]=function(_0x1400ab){return new BPromise(function(_0x3be144,_0x3d8a24){if(_0x1400ab){return client[_0x4931('0xb')](_0x4931('0x1b'),{'options':{'raw':!![],'attributes':['id',_0x4931('0x10'),'type',_0x4931('0x1c'),_0x4931('0x1d')],'where':{'name':_0x1400ab},'limit':0x1}})[_0x4931('0xc')](function(_0x52a492){logger[_0x4931('0x7')]('GETVOICEQUEUEBYNAME|'+_0x1400ab+'|'+(_0x52a492['result']['length']?'FOUND':'NOTFOUND'));return _0x3be144(_0x52a492[_0x4931('0x13')]['length']?_0x52a492[_0x4931('0x13')][0x0]:null);})['catch'](function(_0x407556){logger[_0x4931('0xe')](_0x407556['stack']);return _0x3be144(null);});}else{return _0x3be144(null);}});};exports[_0x4931('0x1e')]=function(_0x23c92a,_0x3ae889){return moment(_0x23c92a)['add'](_0x3ae889,'seconds')[_0x4931('0x1f')](_0x4931('0x20'));};exports[_0x4931('0x21')]=function(_0x1730c2,_0x50a8df){return moment(_0x1730c2)[_0x4931('0x22')](_0x50a8df,_0x4931('0x23'))['format']('YYYY-MM-DD\x20HH:mm:ss');};exports['diffTime']=function(_0xf07319,_0x45e6c8){return moment(_0xf07319)[_0x4931('0x24')](moment(_0x45e6c8),'seconds');};exports[_0x4931('0x25')]=function(_0x51dfd3,_0x765ecb){return parseInt(_0x51dfd3,0xa)+parseInt(_0x765ecb,0xa);};exports['now']=function(){return moment()[_0x4931('0x1f')](_0x4931('0x20'));};exports['isAfter']=function(_0x265b1c,_0x1ab361){if(_0x1ab361){return moment(_0x265b1c)[_0x4931('0x26')](_0x1ab361);}else{return!![];}};exports['isBefore']=function(_0x1e6921,_0x569e31){if(_0x569e31){return moment(_0x1e6921)[_0x4931('0x27')](_0x569e31);}else if(_0x1e6921){return!![];}else{return![];}}; \ No newline at end of file